diff -Nru cargo-0.35.0/appveyor.yml cargo-0.37.0/appveyor.yml --- cargo-0.35.0/appveyor.yml 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/appveyor.yml 2019-05-15 19:48:47.000000000 +0000 @@ -8,7 +8,6 @@ - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain nightly - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - - if defined MINIMAL_VERSIONS rustup toolchain install 1.31.0 - if defined OTHER_TARGET rustup target add %OTHER_TARGET% - rustc -V - cargo -V @@ -19,8 +18,4 @@ build: false test_script: - # we don't have ci time to run the full `cargo test` with `minimal-versions` like - # - if defined MINIMAL_VERSIONS cargo +nightly generate-lockfile -Z minimal-versions && cargo +stable test - # so we just run `cargo check --tests` like - - if defined MINIMAL_VERSIONS cargo +nightly generate-lockfile -Z minimal-versions && cargo +1.31.0 check --tests --features=deny-warnings - - if NOT defined MINIMAL_VERSIONS cargo test --features=deny-warnings + - cargo test --features=deny-warnings diff -Nru cargo-0.35.0/ARCHITECTURE.md cargo-0.37.0/ARCHITECTURE.md --- cargo-0.35.0/ARCHITECTURE.md 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/ARCHITECTURE.md 2019-05-15 19:48:47.000000000 +0000 @@ -12,19 +12,21 @@ ## Subcommands -Cargo is a single binary composed of a set of [`clap`][] subcommands. All subcommands live in +Cargo is a single binary composed of a set of [`clap`] subcommands. All subcommands live in `src/bin/cargo/commands` directory. `src/bin/cargo/main.rs` is the entry point. -Each subcommand, such as `src/bin/cargo/commands/build.rs`, has its own API +Each subcommand, such as [`src/bin/cargo/commands/build.rs`], has its own API interface, similarly to Git's, parsing command line options, reading the configuration files, discovering the Cargo project in the current directory and delegating the actual implementation to one -of the functions in `src/cargo/ops/mod.rs`. This short file is a good +of the functions in [`src/cargo/ops/mod.rs`]. This short file is a good place to find out about most of the things that Cargo can do. Subcommands are designed to pipe to one another, and custom subcommands make Cargo easy to extend and attach tools to. [`clap`]: https://clap.rs/ +[`src/bin/cargo/commands/build.rs`]: src/bin/cargo/commands/build.rs +[`src/cargo/ops/mod.rs`]: src/cargo/ops/mod.rs ## Important Data Structures @@ -32,15 +34,15 @@ There are some important data structures which are used throughout Cargo. -`Config` is available almost everywhere and holds "global" +[`Config`] is available almost everywhere and holds "global" information, such as `CARGO_HOME` or configuration from -`.cargo/config` files. The `shell` method of `Config` is the entry +`.cargo/config` files. The [`shell`] method of [`Config`] is the entry point for printing status messages and other info to the console. -`Workspace` is the description of the workspace for the current +[`Workspace`] is the description of the workspace for the current working directory. Each workspace contains at least one -`Package`. Each package corresponds to a single `Cargo.toml`, and may -define several `Target`s, such as the library, binaries, integration +[`Package`]. Each package corresponds to a single `Cargo.toml`, and may +define several [`Target`]s, such as the library, binaries, integration test or examples. Targets are crates (each target defines a crate root, like `src/lib.rs` or `examples/foo.rs`) and are what is actually compiled by `rustc`. @@ -50,18 +52,26 @@ package `foo` depends on package `bar`, that means that each target from `foo` needs the library target from `bar`. -`PackageId` is the unique identifier of a (possibly remote) +[`PackageId`] is the unique identifier of a (possibly remote) package. It consist of three components: name, version and source id. Source is the place where the source code for package comes from. Typical sources are crates.io, a git repository or a folder on the local hard drive. -`Resolve` is the representation of a directed acyclic graph of package -dependencies, which uses `PackageId`s for nodes. This is the data +[`Resolve`] is the representation of a directed acyclic graph of package +dependencies, which uses [`PackageId`]s for nodes. This is the data structure that is saved to the lock file. If there is no lock file, Cargo constructs a resolve by finding a graph of packages which matches declared dependency specification according to semver. +[`Config`]: https://docs.rs/cargo/latest/cargo/util/config/struct.Config.html +[`shell`]: https://docs.rs/cargo/latest/cargo/util/config/struct.Config.html#method.shell +[`Workspace`]: https://docs.rs/cargo/latest/cargo/core/struct.Workspace.html +[`Package`]: https://docs.rs/cargo/latest/cargo/core/package/struct.Package.html +[`Target`]: https://docs.rs/cargo/latest/cargo/core/manifest/struct.Target.html +[`PackageId`]: https://docs.rs/cargo/latest/cargo/core/package_id/struct.PackageId.html +[`Resolve`]: https://docs.rs/cargo/latest/cargo/core/struct.Resolve.html + ## Persistence @@ -70,9 +80,11 @@ main sources of information are `Cargo.toml` and `Cargo.lock` files, `.cargo/config` configuration files and the globally shared registry of packages downloaded from crates.io, usually located at -`~/.cargo/registry`. See `src/sources/registry` for the specifics of +`~/.cargo/registry`. See [`src/cargo/sources/registry`] for the specifics of the registry storage format. +[`src/cargo/sources/registry`]: src/cargo/sources/registry + ## Concurrency @@ -108,26 +120,31 @@ Alternatively to build and run a custom version of cargo simply run `cargo build` and execute `target/debug/cargo`. Note that `+nightly`/`+stable` (and variants), -being [rustup](https://rustup.rs/) features, won't work when executing the locally +being [rustup] features, won't work when executing the locally built cargo binary directly, you have to instead build with `cargo +nightly build` and run with `rustup run` (e.g `rustup run nightly /target/debug/cargo ..`) (or set the `RUSTC` env var to point to nightly rustc). +[rustup]: https://rustup.rs/ + + ## Logging -Cargo uses [`env_logger`](https://docs.rs/env_logger/*/env_logger/), so you can set -`RUST_LOG` environment variable to get the logs. This is useful both for diagnosing +Cargo uses [`env_logger`], so you can set +`CARGO_LOG` environment variable to get the logs. This is useful both for diagnosing bugs in stable Cargo and for local development. Cargo also has internal hierarchical profiling infrastructure, which is activated via `CARGO_PROFILE` variable ``` # Outputs all logs with levels debug and higher -$ RUST_LOG=debug cargo generate-lockfile +$ CARGO_LOG=debug cargo generate-lockfile # Don't forget that you can filter by module as well -$ RUST_LOG=cargo::core::resolver=trace cargo generate-lockfile +$ CARGO_LOG=cargo::core::resolver=trace cargo generate-lockfile # Output first three levels of profiling info $ CARGO_PROFILE=3 cargo generate-lockfile ``` + +[`env_logger`]: https://docs.rs/env_logger/*/env_logger/ diff -Nru cargo-0.35.0/Cargo.toml cargo-0.37.0/Cargo.toml --- cargo-0.35.0/Cargo.toml 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/Cargo.toml 2019-05-15 19:48:47.000000000 +0000 @@ -1,6 +1,6 @@ [package] name = "cargo" -version = "0.35.0" +version = "0.37.0" edition = "2018" authors = ["Yehuda Katz ", "Carl Lerche ", @@ -21,11 +21,11 @@ atty = "0.2" byteorder = "1.2" bytesize = "1.0" -crates-io = { path = "src/crates-io", version = "0.23" } +crates-io = { path = "src/crates-io", version = "0.25" } crossbeam-utils = "0.6" crypto-hash = "0.3.1" -curl = { version = "0.4.19", features = ['http2'] } -curl-sys = "0.4.15" +curl = { version = "0.4.21", features = ['http2'] } +curl-sys = "0.4.18" env_logger = "0.6.0" pretty_env_logger = { version = "0.3", optional = true } failure = "0.1.5" @@ -34,18 +34,19 @@ fs2 = "0.4" git2 = "0.8.0" git2-curl = "0.9.0" -glob = "0.2.11" +glob = "0.3.0" hex = "0.3" home = "0.3" -ignore = "0.4" +ignore = "0.4.7" lazy_static = "1.2.0" -jobserver = "0.1.11" +jobserver = "0.1.13" lazycell = "1.2.0" libc = "0.2" log = "0.4.6" libgit2-sys = "0.7.9" +memchr = "2.1.3" num_cpus = "1.0" -opener = "0.3.0" +opener = "0.4" rustfix = "0.4.4" same-file = "1" semver = { version = "0.9.0", features = ["serde"] } @@ -56,9 +57,10 @@ tar = { version = "0.4.18", default-features = false } tempfile = "3.0" termcolor = "1.0" -toml = "0.4.2" +toml = "0.5.0" url = "1.1" url_serde = "0.2.0" +walkdir = "2.2" clap = "2.31.2" unicode-width = "0.1.5" openssl = { version = '0.10.11', optional = true } @@ -99,7 +101,7 @@ [dev-dependencies] bufstream = "0.1" -proptest = "0.8.7" +proptest = "0.9.1" [[bin]] name = "cargo" diff -Nru cargo-0.35.0/CHANGELOG.md cargo-0.37.0/CHANGELOG.md --- cargo-0.35.0/CHANGELOG.md 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/CHANGELOG.md 2019-05-15 19:48:47.000000000 +0000 @@ -0,0 +1,489 @@ +# Changelog + +## Cargo 1.36 (2019-07-04) +[6f3e9c36...HEAD](https://github.com/rust-lang/cargo/compare/6f3e9c36...HEAD) + +### Added +- (Nightly only): Added [`-Z install-upgrade` + feature](https://github.com/rust-lang/cargo/blob/7b13469ee90a24fa5aa06166d447dac3370846ef/src/doc/src/reference/unstable.md#install-upgrade) + to track details about installed crates and to automatically update them if + they are out-of-date. [#6798](https://github.com/rust-lang/cargo/pull/6798) +- (Nightly only): Added the [`public-dependency` + feature](https://github.com/rust-lang/cargo/blob/7b13469ee90a24fa5aa06166d447dac3370846ef/src/doc/src/reference/unstable.md#public-dependency) + which allows tracking public versus private dependencies. + [#6772](https://github.com/rust-lang/cargo/pull/6772) + +### Changed +- `publish = ["crates-io"]` may be added to the manifest to restrict + publishing to crates.io only. + [#6838](https://github.com/rust-lang/cargo/pull/6838) +- macOS: Only include the default paths if `DYLD_FALLBACK_LIBRARY_PATH` is not + set. Also, remove `/lib` from the default set. + [#6856](https://github.com/rust-lang/cargo/pull/6856) +- `cargo publish` will now exit early if the login token is not available. + [#6854](https://github.com/rust-lang/cargo/pull/6854) +- HTTP/2 stream errors are now considered "spurious" and will cause a retry. + [#6861](https://github.com/rust-lang/cargo/pull/6861) +- (Nightly only): The `publish-lockfile` feature has had some significant + changes. The default is now `true`, the `Cargo.lock` will always be + published for binary crates. The `Cargo.lock` is now regenerated during + publishing. `cargo install` now ignores the `Cargo.lock` file by default, + and requires `--locked` to use the lock file. Warnings have been added if + yanked dependencies are detected. + [#6840](https://github.com/rust-lang/cargo/pull/6840) +- Setting a feature on a dependency where that feature points to a *required* + dependency is now an error. Previously it was a warning. + [#6860](https://github.com/rust-lang/cargo/pull/6860) +- Resolver performance improvements for some cases. + [#6853](https://github.com/rust-lang/cargo/pull/6853) + +### Fixed +- More carefully track the on-disk fingerprint information for dependencies. + This can help in some rare cases where the build is interrupted and + restarted. [#6832](https://github.com/rust-lang/cargo/pull/6832) +- `cargo run` now correctly passes non-UTF8 arguments to the child process. + [#6849](https://github.com/rust-lang/cargo/pull/6849) + +## Cargo 1.35 (2019-05-23) +[6789d8a0...6f3e9c36](https://github.com/rust-lang/cargo/compare/6789d8a0...6f3e9c36) + +### Added +- Added the `rustc-cdylib-link-arg` key for build scripts to specify linker + arguments for cdylib crates. + [#6298](https://github.com/rust-lang/cargo/pull/6298) +- (Nightly only): `cargo clippy-preview` is now a built-in cargo command. + [#6759](https://github.com/rust-lang/cargo/pull/6759) + +### Changed +- When passing a test filter, such as `cargo test foo`, don't build examples + (unless they set `test = true`). + [#6683](https://github.com/rust-lang/cargo/pull/6683) +- Forward the `--quiet` flag from `cargo test` to the libtest harness so that + tests are actually quiet. + [#6358](https://github.com/rust-lang/cargo/pull/6358) +- The verification step in `cargo package` that checks if any files are + modified is now stricter. It uses a hash of the contents instead of checking + filesystem mtimes. It also checks *all* files in the package. + [#6740](https://github.com/rust-lang/cargo/pull/6740) +- Jobserver tokens are now released whenever Cargo blocks on a file lock. + [#6748](https://github.com/rust-lang/cargo/pull/6748) +- Issue a warning for a previous bug in the TOML parser that allowed multiple + table headers with the same name. + [#6761](https://github.com/rust-lang/cargo/pull/6761) +- Removed the `CARGO_PKG_*` environment variables from the metadata hash and + added them to the fingerprint instead. This means that when these values + change, stale artifacts are not left behind. Also added the "repository" + value to the fingerprint. + [#6785](https://github.com/rust-lang/cargo/pull/6785) +- `cargo metadata` no longer shows a `null` field for a dependency without a + library in `resolve.nodes.deps`. The dependency is no longer shown. + [#6534](https://github.com/rust-lang/cargo/pull/6534) +- `cargo new` will no longer include an email address in the `authors` field + if it is set to the empty string. + [#6802](https://github.com/rust-lang/cargo/pull/6802) +- `cargo doc --open` now works when documenting multiple packages. + [#6803](https://github.com/rust-lang/cargo/pull/6803) +- `cargo install --path P` now loads the `.cargo/config` file from the + directory P. [#6805](https://github.com/rust-lang/cargo/pull/6805) +- Using semver metadata in a version requirement (such as `1.0.0+1234`) now + issues a warning that it is ignored. + [#6806](https://github.com/rust-lang/cargo/pull/6806) +- `cargo install` now rejects certain combinations of flags where some flags + would have been ignored. + [#6801](https://github.com/rust-lang/cargo/pull/6801) +- (Nightly only): The `build-override` profile setting now includes + proc-macros and their dependencies. + [#6811](https://github.com/rust-lang/cargo/pull/6811) +- Resolver performance improvements for some cases. + [#6776](https://github.com/rust-lang/cargo/pull/6776) +- (Nightly only): Optional and target dependencies now work better with `-Z + offline`. [#6814](https://github.com/rust-lang/cargo/pull/6814) + +### Fixed +- Fixed running separate commands (such as `cargo build` then `cargo test`) + where the second command could use stale results from a build script. + [#6720](https://github.com/rust-lang/cargo/pull/6720) +- Fixed `cargo fix` not working properly if a `.gitignore` file that matched + the root package directory. + [#6767](https://github.com/rust-lang/cargo/pull/6767) +- Fixed accidentally compiling a lib multiple times if `panic=unwind` was set + in a profile. [#6781](https://github.com/rust-lang/cargo/pull/6781) +- Paths to JSON files in `build.target` config value are now canonicalized to + fix building dependencies. + [#6778](https://github.com/rust-lang/cargo/pull/6778) +- Fixed re-running a build script if its compilation was interrupted (such as + if it is killed). [#6782](https://github.com/rust-lang/cargo/pull/6782) +- Fixed `cargo new` initializing a fossil repo. + [#6792](https://github.com/rust-lang/cargo/pull/6792) +- Fixed supporting updating a git repo that has a force push when using the + `git-fetch-with-cli` feature. `git-fetch-with-cli` also shows more error + information now when it fails. + [#6800](https://github.com/rust-lang/cargo/pull/6800) +- `--example` binaries built for the WASM target are fixed to no longer + include a metadata hash in the filename, and are correctly emitted in the + `compiler-artifact` JSON message. + [#6812](https://github.com/rust-lang/cargo/pull/6812) + +## Cargo 1.34 (2019-04-11) +[f099fe94...6789d8a0](https://github.com/rust-lang/cargo/compare/f099fe94...6789d8a0) + +### Added +- 🔥 Stabilized support for [alternate + registries](https://doc.rust-lang.org/1.34.0/cargo/reference/registries.html). + [#6654](https://github.com/rust-lang/cargo/pull/6654) +- (Nightly only): Added `-Z mtime-on-use` flag to cause the mtime to be + updated on the filesystem when a crate is used. This is intended to be able + to track stale artifacts in the future for cleaning up unused files. + [#6477](https://github.com/rust-lang/cargo/pull/6477) + [#6573](https://github.com/rust-lang/cargo/pull/6573) +- Added documentation on using builds.sr.ht Continuous Integration with Cargo. + [#6565](https://github.com/rust-lang/cargo/pull/6565) +- `Cargo.lock` now includes a comment at the top that it is `@generated`. + [#6548](https://github.com/rust-lang/cargo/pull/6548) +- Azure DevOps badges are now supported. + [#6264](https://github.com/rust-lang/cargo/pull/6264) +- (Nightly only): Added experimental `-Z dual-proc-macros` to build proc + macros for both the host and the target. + [#6547](https://github.com/rust-lang/cargo/pull/6547) +- Added a warning if `--exclude` flag specifies an unknown package. + [#6679](https://github.com/rust-lang/cargo/pull/6679) + +### Changed +- `cargo test --doc --no-run` doesn't do anything, so it now displays an error + to that effect. [#6628](https://github.com/rust-lang/cargo/pull/6628) +- Various updates to bash completion: add missing options and commands, + support libtest completions, use rustup for `--target` completion, fallback + to filename completion, fix editing the command line. + [#6644](https://github.com/rust-lang/cargo/pull/6644) +- Publishing a crate with a `[patch]` section no longer generates an error. + The `[patch]` section is removed from the manifest before publishing. + [#6535](https://github.com/rust-lang/cargo/pull/6535) +- `build.incremental = true` config value is now treated the same as + `CARGO_INCREMENTAL=1`, previously it was ignored. + [#6688](https://github.com/rust-lang/cargo/pull/6688) +- Errors from a registry are now always displayed regardless of the HTTP + response code. [#6771](https://github.com/rust-lang/cargo/pull/6771) + +### Fixed +- Fixed bash completion for `cargo run --example`. + [#6578](https://github.com/rust-lang/cargo/pull/6578) +- Fixed a race condition when using a *local* registry and running multiple + cargo commands at the same time that build the same crate. + [#6591](https://github.com/rust-lang/cargo/pull/6591) +- Fixed some flickering and excessive updates of the progress bar. + [#6615](https://github.com/rust-lang/cargo/pull/6615) +- Fixed a hang when using a git credential helper that returns incorrect + credentials. [#6681](https://github.com/rust-lang/cargo/pull/6681) +- Fixed resolving yanked crates with a local registry. + [#6750](https://github.com/rust-lang/cargo/pull/6750) + +## Cargo 1.33 (2019-02-28) +[8610973a...f099fe94](https://github.com/rust-lang/cargo/compare/8610973a...f099fe94) + +### Added +- `compiler-artifact` JSON messages now include an `"executable"` key which + includes the path to the executable that was built. + [#6363](https://github.com/rust-lang/cargo/pull/6363) +- The man pages have been rewritten, and are now published with the web + documentation. [#6405](https://github.com/rust-lang/cargo/pull/6405) +- (Nightly only): Allow using registry *names* in `[patch]` tables instead of + just URLs. [#6456](https://github.com/rust-lang/cargo/pull/6456) +- `cargo login` now displays a confirmation after saving the token. + [#6466](https://github.com/rust-lang/cargo/pull/6466) +- A warning is now emitted if a `[patch]` entry does not match any package. + [#6470](https://github.com/rust-lang/cargo/pull/6470) +- `cargo metadata` now includes the `links` key for a package. + [#6480](https://github.com/rust-lang/cargo/pull/6480) +- (Nightly only): `cargo metadata` added the `registry` key for dependencies. + [#6500](https://github.com/rust-lang/cargo/pull/6500) +- "Very verbose" output with `-vv` now displays the environment variables that + cargo sets when it runs a process. + [#6492](https://github.com/rust-lang/cargo/pull/6492) +- `--example`, `--bin`, `--bench`, or `--test` without an argument now lists + the available targets for those options. + [#6505](https://github.com/rust-lang/cargo/pull/6505) +- Windows: If a process fails with an extended status exit code, a + human-readable name for the code is now displayed. + [#6532](https://github.com/rust-lang/cargo/pull/6532) +- Added `--features`, `--no-default-features`, and `--all-features` flags to + the `cargo package` and `cargo publish` commands to use the given features + when verifying the package. + [#6453](https://github.com/rust-lang/cargo/pull/6453) + +### Changed +- If `cargo fix` fails to compile the fixed code, the rustc errors are now + displayed on the console. + [#6419](https://github.com/rust-lang/cargo/pull/6419) +- (Nightly only): Registry names are now restricted to the same style as + package names (alphanumeric, `-` and `_` characters). + [#6469](https://github.com/rust-lang/cargo/pull/6469) +- (Nightly only): `cargo login` now displays the `/me` URL from the registry + config. [#6466](https://github.com/rust-lang/cargo/pull/6466) +- Hide the `--host` flag from `cargo login`, it is unused. + [#6466](https://github.com/rust-lang/cargo/pull/6466) +- (Nightly only): `cargo login --registry=NAME` now supports interactive input + for the token. [#6466](https://github.com/rust-lang/cargo/pull/6466) +- (Nightly only): Registries may now elide the `api` key from `config.json` to + indicate they do not support API access. + [#6466](https://github.com/rust-lang/cargo/pull/6466) +- Build script fingerprints now include the rustc version. + [#6473](https://github.com/rust-lang/cargo/pull/6473) +- macOS: Switched to setting `DYLD_FALLBACK_LIBRARY_PATH` instead of + `DYLD_LIBRARY_PATH`. [#6355](https://github.com/rust-lang/cargo/pull/6355) +- `RUSTFLAGS` is now included in the metadata hash, meaning that changing + the flags will not overwrite previously built files. + [#6503](https://github.com/rust-lang/cargo/pull/6503) +- When updating the crate graph, unrelated yanked crates were erroneously + removed. They are now kept at their original version if possible. This was + causing unrelated packages to be downgraded during `cargo update -p + somecrate`. [#5702](https://github.com/rust-lang/cargo/issues/5702) +- TOML files now support the [0.5 TOML + syntax](https://github.com/toml-lang/toml/blob/master/CHANGELOG.md#050--2018-07-11). + +### Fixed +- `cargo fix` will now ignore suggestions that modify multiple files. + [#6402](https://github.com/rust-lang/cargo/pull/6402) +- `cargo fix` will now only fix one target at a time, to deal with targets + which share the same source files. + [#6434](https://github.com/rust-lang/cargo/pull/6434) +- (Nightly only): Fixed panic when using `--message-format=json` with metabuild. + [#6432](https://github.com/rust-lang/cargo/pull/6432) +- Fixed bash completion showing the list of cargo commands. + [#6461](https://github.com/rust-lang/cargo/issues/6461) +- `cargo init` will now avoid creating duplicate entries in `.gitignore` + files. [#6521](https://github.com/rust-lang/cargo/pull/6521) +- (Nightly only): Fixed detection of publishing to crates.io when using + alternate registries. [#6525](https://github.com/rust-lang/cargo/pull/6525) +- Builds now attempt to detect if a file is modified in the middle of a + compilation, allowing you to build again and pick up the new changes. This + is done by keeping track of when the compilation *starts* not when it + finishes. Also, [#5919](https://github.com/rust-lang/cargo/pull/5919) was + reverted, meaning that cargo does *not* treat equal filesystem mtimes as + requiring a rebuild. [#6484](https://github.com/rust-lang/cargo/pull/6484) + +## Cargo 1.32 (2019-01-17) +[339d9f9c...8610973a](https://github.com/rust-lang/cargo/compare/339d9f9c...8610973a) + +### Added +- (Nightly only): Allow usernames in registry URLs. + [#6242](https://github.com/rust-lang/cargo/pull/6242) +- Registries may now display warnings after a successful publish. + [#6303](https://github.com/rust-lang/cargo/pull/6303) +- Added a [glossary](https://doc.rust-lang.org/cargo/appendix/glossary.html) + to the documentation. [#6321](https://github.com/rust-lang/cargo/pull/6321) +- Added the alias `c` for `cargo check`. + [#6218](https://github.com/rust-lang/cargo/pull/6218) +- (Nightly only): Added `"compile_mode"` key to the build-plan JSON structure + to be able to distinguish running a custom build script versus compiling the + build script. [#6331](https://github.com/rust-lang/cargo/pull/6331) + +### Changed +- 🔥 HTTP/2 multiplexing is now enabled by default. The `http.multiplexing` + config value may be used to disable it. + [#6271](https://github.com/rust-lang/cargo/pull/6271) +- Use ANSI escape sequences to clear lines instead of spaces. + [#6233](https://github.com/rust-lang/cargo/pull/6233) +- Disable git templates when checking out git dependencies, which can cause + problems. [#6252](https://github.com/rust-lang/cargo/pull/6252) +- Include the `--update-head-ok` git flag when using the + `net.git-fetch-with-cli` option. This can help prevent failures when + fetching some repositories. + [#6250](https://github.com/rust-lang/cargo/pull/6250) +- When extracting a crate during the verification step of `cargo package`, the + filesystem mtimes are no longer set, which was failing on some rare + filesystems. [#6257](https://github.com/rust-lang/cargo/pull/6257) +- `crate-type = ["proc-macro"]` is now treated the same as `proc-macro = true` + in `Cargo.toml`. [#6256](https://github.com/rust-lang/cargo/pull/6256) +- An error is raised if `dependencies`, `features`, `target`, or `badges` is + set in a virtual workspace. Warnings are displayed if `replace` or `patch` + is used in a workspace member. + [#6276](https://github.com/rust-lang/cargo/pull/6276) +- Improved performance of the resolver in some cases. + [#6283](https://github.com/rust-lang/cargo/pull/6283) + [#6366](https://github.com/rust-lang/cargo/pull/6366) +- `.rmeta` files are no longer hard-linked into the base target directory + (`target/debug`). [#6292](https://github.com/rust-lang/cargo/pull/6292) +- A warning is issued if multiple targets are built with the same output + filenames. [#6308](https://github.com/rust-lang/cargo/pull/6308) +- When using `cargo build` (without `--release`) benchmarks are now built + using the "test" profile instead of "bench". This makes it easier to debug + benchmarks, and avoids confusing behavior. + [#6309](https://github.com/rust-lang/cargo/pull/6309) +- User aliases may now override built-in aliases (`b`, `r`, `t`, and `c`). + [#6259](https://github.com/rust-lang/cargo/pull/6259) +- Setting `autobins=false` now disables auto-discovery of inferred targets. + [#6329](https://github.com/rust-lang/cargo/pull/6329) +- `cargo verify-project` will now fail on stable if the project uses unstable + features. [#6326](https://github.com/rust-lang/cargo/pull/6326) +- Platform targets with an internal `.` within the name are now allowed. + [#6255](https://github.com/rust-lang/cargo/pull/6255) +- `cargo clean --release` now only deletes the release directory. + [#6349](https://github.com/rust-lang/cargo/pull/6349) + +### Fixed +- Avoid adding extra angle brackets in email address for `cargo new`. + [#6243](https://github.com/rust-lang/cargo/pull/6243) +- The progress bar is disabled if the CI environment variable is set. + [#6281](https://github.com/rust-lang/cargo/pull/6281) +- Avoid retaining all rustc output in memory. + [#6289](https://github.com/rust-lang/cargo/pull/6289) +- If JSON parsing fails, and rustc exits nonzero, don't lose the parse failure + message. [#6290](https://github.com/rust-lang/cargo/pull/6290) +- (Nightly only): `--out-dir` no longer copies over build scripts. + [#6300](https://github.com/rust-lang/cargo/pull/6300) +- Fixed renaming a project directory with build scripts. + [#6328](https://github.com/rust-lang/cargo/pull/6328) +- Fixed `cargo run --example NAME` to work correctly if the example sets + `crate_type = ["bin"]`. + [#6330](https://github.com/rust-lang/cargo/pull/6330) +- Fixed issue with `cargo package` git discovery being too aggressive. The + `--allow-dirty` now completely disables the git repo checks. + [#6280](https://github.com/rust-lang/cargo/pull/6280) +- Fixed build change tracking for `[patch]` deps which resulted in `cargo + build` rebuilding when it shouldn't. + [#6493](https://github.com/rust-lang/cargo/pull/6493) + +## Cargo 1.31 (2019-12-06) +[36d96825...339d9f9c](https://github.com/rust-lang/cargo/compare/36d96825...339d9f9c) + +### Added +- 🔥 Stabilized support for the 2018 edition. + [#5984](https://github.com/rust-lang/cargo/pull/5984) + [#5989](https://github.com/rust-lang/cargo/pull/5989) +- 🔥 Added the ability to [rename + dependencies](https://doc.rust-lang.org/1.31.0/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml) + in Cargo.toml. [#6319](https://github.com/rust-lang/cargo/pull/6319) +- 🔥 Added support for HTTP/2 pipelining and multiplexing. Set the + `http.multiplexing` config value to enable. + [#6005](https://github.com/rust-lang/cargo/pull/6005) +- (Nightly only): Added `--registry` flag to `cargo install`. + [#6128](https://github.com/rust-lang/cargo/pull/6128) +- (Nightly only): Added `registry.default` configuration value to specify the + default registry to use if `--registry` flag is not passed. + [#6135](https://github.com/rust-lang/cargo/pull/6135) +- (Nightly only): Added `--registry` flag to `cargo new` and `cargo init`. + [#6135](https://github.com/rust-lang/cargo/pull/6135) +- Added `http.debug` configuration value to debug HTTP connections. Use + `CARGO_HTTP_DEBUG=true RUST_LOG=cargo::ops::registry cargo build` to display + the debug information. [#6166](https://github.com/rust-lang/cargo/pull/6166) +- `CARGO_PKG_REPOSITORY` environment variable is set with the repository value + from `Cargo.toml` when building . + [#6096](https://github.com/rust-lang/cargo/pull/6096) + +### Changed +- `cargo test --doc` now rejects other flags instead of ignoring them. + [#6037](https://github.com/rust-lang/cargo/pull/6037) +- `cargo install` ignores `~/.cargo/config`. + [#6026](https://github.com/rust-lang/cargo/pull/6026) +- `cargo version --verbose` is now the same as `cargo -vV`. + [#6076](https://github.com/rust-lang/cargo/pull/6076) +- Comments at the top of `Cargo.lock` are now preserved. + [#6181](https://github.com/rust-lang/cargo/pull/6181) +- When building in "very verbose" mode (`cargo build -vv`), build script + output is prefixed with the package name and version, such as `[foo 0.0.1]`. + [#6164](https://github.com/rust-lang/cargo/pull/6164) +- If `cargo fix --broken-code` fails to compile after fixes have been applied, + the files are no longer reverted and are left in their broken state. + [#6316](https://github.com/rust-lang/cargo/pull/6316) + +### Fixed +- Windows: Pass Ctrl-C to the process with `cargo run`. + [#6004](https://github.com/rust-lang/cargo/pull/6004) +- macOS: Fix bash completion. + [#6038](https://github.com/rust-lang/cargo/pull/6038) +- Support arbitrary toolchain names when completing `+toolchain` in bash + completion. [#6038](https://github.com/rust-lang/cargo/pull/6038) +- Fixed edge cases in the resolver, when backtracking on failed dependencies. + [#5988](https://github.com/rust-lang/cargo/pull/5988) +- Fixed `cargo test --all-targets` running lib tests three times. + [#6039](https://github.com/rust-lang/cargo/pull/6039) +- Fixed publishing renamed dependencies to crates.io. + [#5993](https://github.com/rust-lang/cargo/pull/5993) +- Fixed `cargo install` on a git repo with multiple binaries. + [#6060](https://github.com/rust-lang/cargo/pull/6060) +- Fixed deeply nested JSON emitted by rustc being lost. + [#6081](https://github.com/rust-lang/cargo/pull/6081) +- Windows: Fix locking msys terminals to 60 characters. + [#6122](https://github.com/rust-lang/cargo/pull/6122) +- Fixed renamed dependencies with dashes. + [#6140](https://github.com/rust-lang/cargo/pull/6140) +- Fixed linking against the wrong dylib when the dylib existed in both + `target/debug` and `target/debug/deps`. + [#6167](https://github.com/rust-lang/cargo/pull/6167) +- Fixed some unnecessary recompiles when `panic=abort` is used. + [#6170](https://github.com/rust-lang/cargo/pull/6170) + +## Cargo 1.30 (2019-10-25) +[524a578d...36d96825](https://github.com/rust-lang/cargo/compare/524a578d...36d96825) + +### Added +- 🔥 Added an animated progress bar shows progress during building. + [#5995](https://github.com/rust-lang/cargo/pull/5995/) +- Added `resolve.nodes.deps` key to `cargo metadata`, which includes more + information about resolved dependencies, and properly handles renamed + dependencies. [#5871](https://github.com/rust-lang/cargo/pull/5871) +- When creating a package, provide more detail with `-v` when failing to + discover if files are dirty in a git repository. Also fix a problem with + discovery on Windows. [#5858](https://github.com/rust-lang/cargo/pull/5858) +- Filters like `--bin`, `--test`, `--example`, `--bench`, or `--lib` can be + used in a workspace without selecting a specific package. + [#5873](https://github.com/rust-lang/cargo/pull/5873) +- `cargo run` can be used in a workspace without selecting a specific package. + [#5877](https://github.com/rust-lang/cargo/pull/5877) +- `cargo doc --message-format=json` now outputs JSON messages from rustdoc. + [#5878](https://github.com/rust-lang/cargo/pull/5878) +- Added `--message-format=short` to show one-line messages. + [#5879](https://github.com/rust-lang/cargo/pull/5879) +- Added `.cargo_vcs_info.json` file to `.crate` packages that captures the + current git hash. [#5886](https://github.com/rust-lang/cargo/pull/5886) +- Added `net.git-fetch-with-cli` configuration option to use the `git` + executable to fetch repositories instead of using the built-in libgit2 + library. [#5914](https://github.com/rust-lang/cargo/pull/5914) +- Added `required-features` to `cargo metadata`. + [#5902](https://github.com/rust-lang/cargo/pull/5902) +- `cargo uninstall` within a package will now uninstall that package. + [#5927](https://github.com/rust-lang/cargo/pull/5927) +- (Nightly only): Added + [metabuild](https://doc.rust-lang.org/1.30.0/cargo/reference/unstable.html#metabuild). + [#5628](https://github.com/rust-lang/cargo/pull/5628) +- Added `--allow-staged` flag to `cargo fix` to allow it to run if files are + staged in git. [#5943](https://github.com/rust-lang/cargo/pull/5943) +- Added `net.low-speed-limit` config value, and also honor `net.timeout` for + http operations. [#5957](https://github.com/rust-lang/cargo/pull/5957) +- Added `--edition` flag to `cargo new`. + [#5984](https://github.com/rust-lang/cargo/pull/5984) +- Temporarily stabilized 2018 edition support for the duration of the beta. + [#5984](https://github.com/rust-lang/cargo/pull/5984) + [#5989](https://github.com/rust-lang/cargo/pull/5989) +- Added support for `target.'cfg(…)'.runner` config value to specify the + run/test/bench runner for config-expressioned targets. + [#5959](https://github.com/rust-lang/cargo/pull/5959) + +### Changed +- Windows: `cargo run` will not kill child processes when the main process + exits. [#5887](https://github.com/rust-lang/cargo/pull/5887) +- Switched to the `opener` crate to open a web browser with `cargo doc + --open`. This should more reliably select the system-preferred browser on + all platforms. [#5888](https://github.com/rust-lang/cargo/pull/5888) +- Equal file mtimes now cause a target to be rebuilt. Previously only if files + were strictly *newer* than the last build would it cause a rebuild. + [#5919](https://github.com/rust-lang/cargo/pull/5919) +- Ignore `build.target` config value when running `cargo install`. + [#5874](https://github.com/rust-lang/cargo/pull/5874) +- Ignore `RUSTC_WRAPPER` for `cargo fix`. + [#5983](https://github.com/rust-lang/cargo/pull/5983) +- Ignore empty `RUSTC_WRAPPER`. + [#5985](https://github.com/rust-lang/cargo/pull/5985) + +### Fixed +- Fixed error when creating a package with an edition field in `Cargo.toml`. + [#5908](https://github.com/rust-lang/cargo/pull/5908) +- More consistently use relative paths for path dependencies in a workspace. + [#5935](https://github.com/rust-lang/cargo/pull/5935) +- `cargo fix` now always runs, even if it was run previously. + [#5944](https://github.com/rust-lang/cargo/pull/5944) +- Windows: Attempt to more reliably detect terminal width. msys-based + terminals are forced to 60 characters wide. + [#6010](https://github.com/rust-lang/cargo/pull/6010) +- Allow multiple target flags with `cargo doc --document-private-items`. + [6022](https://github.com/rust-lang/cargo/pull/6022) diff -Nru cargo-0.35.0/CONTRIBUTING.md cargo-0.37.0/CONTRIBUTING.md --- cargo-0.35.0/CONTRIBUTING.md 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/CONTRIBUTING.md 2019-05-15 19:48:47.000000000 +0000 @@ -96,7 +96,7 @@ using `CFG_DISABLE_CROSS_TESTS=1 cargo test`. Note that some tests are enabled only on `nightly` toolchain. If you can, test both toolchains. * All code changes are expected to comply with the formatting suggested by `rustfmt`. -You can use `rustup component add --toolchain nightly rustfmt-preview` to install `rustfmt` and use +You can use `rustup component add --toolchain nightly rustfmt` to install `rustfmt` and use `rustfmt +nightly --unstable-features --skip-children` on the changed files to automatically format your code. * Push your commits to GitHub and create a pull request against Cargo's `master` branch. diff -Nru cargo-0.35.0/debian/bin/cargo cargo-0.37.0/debian/bin/cargo --- cargo-0.35.0/debian/bin/cargo 2019-03-11 02:43:37.000000000 +0000 +++ cargo-0.37.0/debian/bin/cargo 2019-08-16 01:35:57.000000000 +0000 @@ -54,9 +54,6 @@ include /usr/share/rustc/architecture.mk export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE - -Due to https://github.com/rust-lang/cargo/issues/6338 you may want to *unset* -RUSTFLAGS; if it's set (even to empty) it will break this script. """ import os @@ -79,7 +76,7 @@ def sourcepath(p=None): return os.path.join(os.getcwd(), p) if p else os.getcwd() -def prepare_debian(cargo_home, registry, cratespec, host_gnu_type, ldflags, link_from_system): +def prepare_debian(cargo_home, registry, cratespec, host_gnu_type, ldflags, link_from_system, extra_rustflags): registry_path = sourcepath(registry) if link_from_system: log("linking %s/* into %s/" % (SYSTEM_REGISTRY, registry_path)) @@ -96,8 +93,10 @@ rustflags.extend(["-C", "linker=%s-gcc" % host_gnu_type]) for f in ldflags: rustflags.extend(["-C", "link-arg=%s" % f]) - rustflags.extend(["--remap-path-prefix", - "%s=%s/%s" % (sourcepath(), SYSTEM_REGISTRY, cratespec.replace("_", "-"))]) + if link_from_system: + rustflags.extend(["--remap-path-prefix", "%s=%s/%s" % + (sourcepath(), SYSTEM_REGISTRY, cratespec.replace("_", "-"))]) + rustflags.extend(extra_rustflags.split()) # TODO: we cannot enable this until dh_shlibdeps works correctly; atm we get: # dpkg-shlibdeps: warning: can't extract name and version from library name 'libstd-XXXXXXXX.so' @@ -170,8 +169,12 @@ log("rust_type, gnu_type:", ", ".join([host_rust_type, host_gnu_type])) if "RUSTFLAGS" in os.environ: - log("\033[33;1mWARNING: RUSTFLAGS is set; this will probably override all Debian rust settings.\033[0m") - log("\033[33;1mWARNING: It is highly recommended to unset it; please see https://github.com/rust-lang/cargo/issues/6338 for details.\033[0m") + # see https://github.com/rust-lang/cargo/issues/6338 for explanation on why we must do this + log("unsetting RUSTFLAGS and assuming it will be (or already was) added to $CARGO_HOME/config") + extra_rustflags = os.environ["RUSTFLAGS"] + del os.environ["RUSTFLAGS"] + else: + extra_rustflags = "" if args[0] == "prepare-debian": registry = args[1] @@ -180,7 +183,7 @@ link_from_system = True return prepare_debian(cargo_home, registry, os.environ["DEB_CARGO_CRATE"], host_gnu_type, - os.getenv("LDFLAGS", "").split(), link_from_system) + os.getenv("LDFLAGS", "").split(), link_from_system, extra_rustflags) newargs = [] subcmd = None diff -Nru cargo-0.35.0/debian/changelog cargo-0.37.0/debian/changelog --- cargo-0.35.0/debian/changelog 2019-05-16 23:28:05.000000000 +0000 +++ cargo-0.37.0/debian/changelog 2019-08-18 19:19:40.000000000 +0000 @@ -1,8 +1,71 @@ -cargo (0.35.0-0ubuntu1~19.04.1) disco; urgency=medium +cargo (0.37.0-3ubuntu1~19.04.1) disco; urgency=medium * Backport to Disco. - -- Michael Hudson-Doyle Fri, 17 May 2019 11:28:05 +1200 + -- Michael Hudson-Doyle Mon, 19 Aug 2019 07:19:40 +1200 + +cargo (0.37.0-3ubuntu1) eoan; urgency=medium + + * Merge from Debian unstable. Remaining changes: + - Don't use the bootstrap.py script for bootstrapping as it no longer + works. + - remove debian/bootstrap.py + - update debian/make_orig_multi.sh + - Disable fetch tests on non x86/x86-64 architectures, as those hit an + unreachable!() in test code. Disable the Debian patch that disables these + tests on every architecture + - add debian/patches/disable-fetch-tests-on-non-x86.patch + - update debian/patches/series + - Disable test tool_paths::custom_runner which fails every now and again + because of a libstd bug (https://github.com/rust-lang/rust/issues/55242) + - add debian/patches/disable-tool_paths-custom_runner.patch + - update debian/patches/series + - Disable the large_conflict_cache test on non-x86 + - add debian/patches/disable-large_conflict_cache-test-on-non-x86.patch + - update debian/patches/series + + -- Michael Hudson-Doyle Sat, 17 Aug 2019 13:57:21 +1200 + +cargo (0.37.0-3) unstable; urgency=medium + + * Update 2001_more_portable_rustflags.patch, fixes mips FTBFS + + -- Ximin Luo Sat, 20 Jul 2019 16:02:08 -0700 + +cargo (0.37.0-2) unstable; urgency=medium + + * Bump serde vendored crate version up to 1.0.96 to avoid issue when + compiling with atomics (the default). + + -- Ximin Luo Thu, 18 Jul 2019 02:34:48 -0700 + +cargo (0.37.0-1) unstable; urgency=medium + + * New upstream release. + + -- Ximin Luo Tue, 16 Jul 2019 23:06:49 -0700 + +cargo (0.36.0-0ubuntu1) eoan; urgency=medium + + * New upstream version. + - Refreshed patches. + - Remove d/patches/typenum-rounding.patch, applied upstream. + - Add d/patches/disable-large_conflict_cache-test-on-non-x86.patch + + -- Łukasz 'sil2100' Zemczak Mon, 08 Jul 2019 14:11:59 +0200 + +cargo (0.35.0-2) unstable; urgency=medium + + * Use more portable flags in tests, fixing FTBFS on mips. + (Closes: #930218) + + -- Ximin Luo Sat, 08 Jun 2019 11:04:43 -0700 + +cargo (0.35.0-1) unstable; urgency=medium + + * New upstream release. + + -- Ximin Luo Fri, 31 May 2019 00:29:11 -0700 cargo (0.35.0-0ubuntu1) eoan; urgency=medium @@ -20,6 +83,19 @@ -- Michael Hudson-Doyle Tue, 14 May 2019 11:14:06 +1200 +cargo (0.33.0-3) unstable; urgency=medium + + * Drop patch to capture rustc error output, it is unnecessary. + * Add upstream patch to fix typenum bug. + + -- Ximin Luo Sat, 18 May 2019 20:22:22 -0700 + +cargo (0.33.0-2) unstable; urgency=medium + + * Add patch to capture rustc error output if extra-verbose. + + -- Ximin Luo Sat, 18 May 2019 12:14:38 -0700 + cargo (0.33.0-1ubuntu2) disco; urgency=medium * Fix a rounding issue in vendor/typenum. diff -Nru cargo-0.35.0/debian/control cargo-0.37.0/debian/control --- cargo-0.35.0/debian/control 2019-05-16 23:25:03.000000000 +0000 +++ cargo-0.37.0/debian/control 2019-08-18 04:14:25.000000000 +0000 @@ -71,3 +71,5 @@ project. . This package contains the documentation. + +# TODO: add a cargo-src package diff -Nru cargo-0.35.0/debian/copyright cargo-0.37.0/debian/copyright --- cargo-0.35.0/debian/copyright 2019-05-16 23:25:03.000000000 +0000 +++ cargo-0.37.0/debian/copyright 2019-08-18 04:14:25.000000000 +0000 @@ -1,4 +1,4 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: cargo Source: https://github.com/rust-lang/cargo @@ -9,6 +9,7 @@ LICENSE-* README.* ARCHITECTURE.* + CHANGELOG.* CONTRIBUTING.* appveyor.yml Copyright: 2014 The Rust Project Developers @@ -25,23 +26,12 @@ vendor/glob/* vendor/libc/* vendor/log/* - vendor/rand/* vendor/regex/* vendor/regex-syntax/* vendor/semver/* vendor/shell-escape/* vendor/vec_map/* vendor/unicode-width/* - vendor/rand_core/* - vendor/rand_core-0*/* - vendor/rand-*/* - vendor/rand_chacha/* - vendor/rand_hc/* - vendor/rand_isaac/* - vendor/rand_jitter/* - vendor/rand_os/* - vendor/rand_pcg/* - vendor/rand_xorshift/* vendor/num-integer/* vendor/num-traits/* Copyright: 2010-2019 The Rust Project Developers @@ -85,6 +75,29 @@ see https://github.com/servo/rust-fnv Files: + vendor/getrandom/* + vendor/rand/* + vendor/rand-0*/* + vendor/rand_core/* + vendor/rand_core-0*/* + vendor/rand_chacha/* + vendor/rand_chacha-0*/* + vendor/rand_hc/* + vendor/rand_hc-0*/* + vendor/rand_isaac/* + vendor/rand_jitter/* + vendor/rand_os/* + vendor/rand_pcg/* + vendor/rand_xorshift/* +Copyright: + 2019-2019 The Rand Project Developers + 2010-2019 The Rust Project Developers +License: MIT OR Apache-2.0 +Comment: + see https://github.com/rust-random/getrandom + see https://github.com/rust-random/rand + +Files: vendor/aho-corasick/* vendor/memchr/* vendor/utf8-ranges/* @@ -112,10 +125,14 @@ * https://github.com/BurntSushi/walkdir * https://github.com/BurntSushi/winapi-util -Files: vendor/ucd-util/* -Copyright: 2015 Andrew Gallant +Files: + vendor/bstr/* + vendor/ucd-util/* +Copyright: 2015-2019 Andrew Gallant License: MIT or Apache-2.0 -Comment: see https://github.com/BurntSushi/rucd +Comment: + see https://github.com/BurntSushi/bstr + see https://github.com/BurntSushi/rucd Files: vendor/ansi_term/* Copyright: 2014, Benjamin Sago @@ -139,6 +156,18 @@ Alexis Beingessner License: MIT or Apache-2.0 +Files: vendor/bytes/* +Copyright: 2015-2019 Carl Lerche +License: MIT +Comment: see https://github.com/carllerche/bytes + +Files: + vendor/c2-chacha/* + vendor/ppv-lite86/* +Copyright: 2019-2019 The CryptoCorrosion Contributors +License: MIT or Apache-2.0 +Comment: see https://github.com/cryptocorrosion/cryptocorrosion + Files: vendor/chrono/* Copyright: 2014-2018 Kang Seonghoon 2014-2018 Brandon W Maister @@ -185,10 +214,9 @@ Files: vendor/curl/* vendor/curl-sys/* -Copyright: 2014-2016 Carl Lerche - 2014-2016 Alex Crichton +Copyright: 2014-2019 Alex Crichton License: MIT -Comment: see https://github.com/sfackler/rust-openssl +Comment: see https://github.com/alexcrichton/curl-rust Files: vendor/failure/* vendor/failure_derive/* @@ -215,6 +243,13 @@ License: MIT or Apache-2.0 Comment: see https://github.com/brson/home +Files: vendor/http/* +Copyright: 2017-2019 Alex Crichton + 2017-2019 Carl Lerche + 2017-2019 Sean McArthur +License: MIT or Apache-2.0 +Comment: see https://github.com/hyperium/http + Files: vendor/humantime/* Copyright: 2016, The humantime Developers License: MIT or Apache-2.0 @@ -224,10 +259,19 @@ . See https://github.com/tailhook/humantime -Files: vendor/im-rc/* +Files: + vendor/im-rc/* + vendor/sized-chunks/* Copyright: 2017-2019 Bodil Stokke License: MPL-2.0+ -Comment: see https://github.com/bodil/im-rs +Comment: + see https://github.com/bodil/im-rs + see https://github.com/bodil/sized-chunks + +Files: vendor/iovec/* +Copyright: 2017-2018 Carl Lerche +License: MIT or Apache-2.0 +Comment: see https://github.com/carllerche/iovec Files: vendor/itoa/* vendor/quote/* @@ -271,6 +315,11 @@ Copyright: 2015, Sean McArthur License: MIT or Apache-2.0 +Files: vendor/numtoa/* +Copyright: 2017-2018 Michael Aaron Murphy +License: MIT OR Apache-2.0 +Comment: see https://gitlab.com/mmstick/numtoa + Files: vendor/opener/* Copyright: 2018 Brian Bowman License: MIT or Apache-2.0 @@ -357,6 +406,12 @@ Copyright: 2018 Simon Sapin License: MIT or Apache-2.0 +Files: vendor/spin/* +Copyright: 2014-2019 Mathijs van de Nes + 2014-2019 John Ericson +License: MIT +Comment: see https://github.com/mvdnes/spin-rs.git + Files: vendor/strsim/* Copyright: 2015 Danny Guo License: MIT @@ -417,10 +472,12 @@ License: MIT Comment: see https://github.com/reem/ -Files: vendor/url/* - vendor/percent-encoding/* +Files: + vendor/url/* + vendor/url_serde/* + vendor/percent-encoding/* Copyright: 2015-2016 Simon Sapin - 2013-2016 The rust-url developers + 2013-2019 The rust-url developers License: MIT or Apache-2.0 Comment: see https://github.com/servo/rust-url see https://github.com/servo/rust-url/tree/master/percent_encoding diff -Nru cargo-0.35.0/debian/debcargo-conf.patch cargo-0.37.0/debian/debcargo-conf.patch --- cargo-0.35.0/debian/debcargo-conf.patch 2019-02-27 08:18:03.000000000 +0000 +++ cargo-0.37.0/debian/debcargo-conf.patch 2019-08-16 01:35:57.000000000 +0000 @@ -64,86 +64,6 @@ +- + [dev-dependencies] + hex = "0.2" -diff --git a/src/curl/debian/patches/winapi3.patch b/src/curl/debian/patches/winapi3.patch -index dce2312..a4ab79e 100644 ---- a/src/curl/debian/patches/winapi3.patch -+++ b/src/curl/debian/patches/winapi3.patch -@@ -1,19 +1,24 @@ ----- a/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 --+++ b/Cargo.toml 2018-09-21 18:54:24.693880364 +0000 --@@ -48,4 +48,2 @@ version = "0.1.2" -+--- a/Cargo.toml -++++ b/Cargo.toml -+@@ -54,13 +54,12 @@ -+ [target."cfg(all(unix, not(target_os = \"macos\")))".dependencies.openssl-sys] - version = "0.9.33" ---[target."cfg(target_env=\"msvc\")".dependencies.kernel32-sys] -+ optional = true -+-[target."cfg(target_env = \"msvc\")".dependencies.kernel32-sys] - -version = "0.2.2" - --@@ -54,3 +52,4 @@ version = "0.1.13" -+ [target."cfg(target_env = \"msvc\")".dependencies.schannel] -+ version = "0.1.13" - [target."cfg(windows)".dependencies.winapi] - -version = "0.2.7" - +version = "0.3" - +features = ["winsock2", "wincrypt", "libloaderapi"] - [badges.appveyor] ----- a/src/easy/windows.rs 2018-09-21 18:01:35.962553903 +0000 --+++ b/src/easy/windows.rs 2018-09-21 18:01:35.962553903 +0000 --@@ -4,21 +4,21 @@ use libc::c_void; -+ repository = "alexcrichton/curl-rust" -+ -+--- a/src/easy/windows.rs -++++ b/src/easy/windows.rs -+@@ -4,21 +4,21 @@ - - #[cfg(target_env = "msvc")] - mod win { -@@ -38,20 +43,20 @@ - if n == ptr::null() { - None - } else { ----- a/src/lib.rs 2018-09-21 18:01:35.962553903 +0000 --+++ b/src/lib.rs 2018-09-21 18:01:35.962553903 +0000 --@@ -61,8 +61,6 @@ extern crate openssl_probe; -- #[cfg(windows)] -+--- a/src/lib.rs -++++ b/src/lib.rs -+@@ -62,8 +62,6 @@ - extern crate winapi; - ---#[cfg(target_env = "msvc")] ---extern crate kernel32; - #[cfg(target_env = "msvc")] -+-extern crate kernel32; -+-#[cfg(target_env = "msvc")] - extern crate schannel; - ----- a/src/multi.rs 2018-09-21 18:01:35.962553903 +0000 --+++ b/src/multi.rs 2018-09-21 18:01:35.962553903 +0000 --@@ -8,7 +8,7 @@ use libc::{c_int, c_char, c_void, c_long, c_short}; -+ use std::ffi::CStr; -+--- a/src/multi.rs -++++ b/src/multi.rs -+@@ -8,7 +8,7 @@ - use curl_sys; - - #[cfg(windows)] -diff --git a/src/jobserver/debian/patches/relax-dep-version.patch b/src/jobserver/debian/patches/relax-dep-version.patch -index b3218cc..e69de29 100644 ---- a/src/jobserver/debian/patches/relax-dep-version.patch -+++ b/src/jobserver/debian/patches/relax-dep-version.patch -@@ -1,8 +0,0 @@ ----- a/Cargo.toml 2018-08-03 01:58:48.002962262 -0700 --+++ b/Cargo.toml 2018-08-03 01:58:54.275006248 -0700 --@@ -61,4 +61,4 @@ -- [target."cfg(unix)".dependencies.libc] -- version = "0.2" -- [target."cfg(windows)".dependencies.rand] ---version = "0.4" --+version = "< 0.6, >= 0.4" diff --git a/src/unicode-bidi/debian/patches/no-flamegraphs.patch b/src/unicode-bidi/debian/patches/no-flamegraphs.patch index 6234d5d..9acab86 100644 --- a/src/unicode-bidi/debian/patches/no-flamegraphs.patch diff -Nru cargo-0.35.0/debian/patches/1001_vendor_serde_atomic-compat.patch cargo-0.37.0/debian/patches/1001_vendor_serde_atomic-compat.patch --- cargo-0.35.0/debian/patches/1001_vendor_serde_atomic-compat.patch 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/debian/patches/1001_vendor_serde_atomic-compat.patch 2019-08-16 01:35:57.000000000 +0000 @@ -0,0 +1,150 @@ +From 210c2419beeef0cabfb0b35106a27fdb0882d9cc Mon Sep 17 00:00:00 2001 +From: James Brown +Date: Wed, 17 Jul 2019 09:19:03 -0700 +Subject: [PATCH 1/4] conservatively limit atomic features + +--- + serde/build.rs | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +--- a/vendor/serde/build.rs ++++ b/vendor/serde/build.rs +@@ -70,7 +70,22 @@ + } + + if minor >= 34 { +- println!("cargo:rustc-cfg=std_integer_atomics"); ++ // Whitelist of archs that support std::sync::atomic module. Ideally we ++ // would use #[cfg(target_has_atomic = "...")] but it is not stable yet. ++ // Instead this is based on rustc's src/librustc_target/spec/*.rs. ++ let has_atomic64 = target.starts_with("x86_64") ++ || target.starts_with("i686") ++ || target.starts_with("aarch64") ++ || target.starts_with("powerpc64") ++ || target.starts_with("sparc64") ++ || target.starts_with("mips64el"); ++ let has_atomic32 = has_atomic64 || emscripten; ++ if has_atomic64 { ++ println!("cargo:rustc-cfg=std_atomic64"); ++ } ++ if has_atomic32 { ++ println!("cargo:rustc-cfg=std_atomic"); ++ } + } + } + +--- a/vendor/serde/src/de/impls.rs ++++ b/vendor/serde/src/de/impls.rs +@@ -2546,7 +2546,7 @@ + } + } + +-#[cfg(all(feature = "std", std_integer_atomics))] ++#[cfg(all(feature = "std", std_atomic))] + macro_rules! atomic_impl { + ($($ty:ident)*) => { + $( +@@ -2562,14 +2562,14 @@ + }; + } + +-#[cfg(all(feature = "std", std_integer_atomics))] ++#[cfg(all(feature = "std", std_atomic))] + atomic_impl! { + AtomicBool + AtomicI8 AtomicI16 AtomicI32 AtomicIsize + AtomicU8 AtomicU16 AtomicU32 AtomicUsize + } + +-#[cfg(all(feature = "std", std_integer_atomics, not(target_os = "emscripten")))] ++#[cfg(all(feature = "std", std_atomic64))] + atomic_impl! { + AtomicI64 AtomicU64 + } +--- a/vendor/serde/src/lib.rs ++++ b/vendor/serde/src/lib.rs +@@ -73,7 +73,7 @@ + //////////////////////////////////////////////////////////////////////////////// + + // Serde types in rustdoc of other crates get linked to here. +-#![doc(html_root_url = "https://docs.rs/serde/1.0.95")] ++#![doc(html_root_url = "https://docs.rs/serde/1.0.96")] + // Support using Serde without the standard library! + #![cfg_attr(not(feature = "std"), no_std)] + // Unstable functionality only if the user asks for it. For tracking and +@@ -212,12 +212,12 @@ + #[cfg(range_inclusive)] + pub use self::core::ops::RangeInclusive; + +- #[cfg(all(feature = "std", std_integer_atomics))] ++ #[cfg(all(feature = "std", std_atomic))] + pub use std::sync::atomic::{ + AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, AtomicU8, + AtomicUsize, Ordering, + }; +- #[cfg(all(feature = "std", std_integer_atomics, not(target_os = "emscripten")))] ++ #[cfg(all(feature = "std", std_atomic64))] + pub use std::sync::atomic::{AtomicI64, AtomicU64}; + + #[cfg(any(core_duration, feature = "std"))] +--- a/vendor/serde/src/ser/impls.rs ++++ b/vendor/serde/src/ser/impls.rs +@@ -842,7 +842,7 @@ + + //////////////////////////////////////////////////////////////////////////////// + +-#[cfg(all(feature = "std", std_integer_atomics))] ++#[cfg(all(feature = "std", std_atomic))] + macro_rules! atomic_impl { + ($($ty:ident)*) => { + $( +@@ -858,14 +858,14 @@ + } + } + +-#[cfg(all(feature = "std", std_integer_atomics))] ++#[cfg(all(feature = "std", std_atomic))] + atomic_impl! { + AtomicBool + AtomicI8 AtomicI16 AtomicI32 AtomicIsize + AtomicU8 AtomicU16 AtomicU32 AtomicUsize + } + +-#[cfg(all(feature = "std", std_integer_atomics, not(target_os = "emscripten")))] ++#[cfg(all(feature = "std", std_atomic64))] + atomic_impl! { + AtomicI64 AtomicU64 + } +--- a/vendor/serde_derive/src/lib.rs ++++ b/vendor/serde_derive/src/lib.rs +@@ -13,7 +13,7 @@ + //! + //! [https://serde.rs/derive.html]: https://serde.rs/derive.html + +-#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.95")] ++#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.96")] + #![allow(unknown_lints, bare_trait_objects)] + #![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] + #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))] +--- a/vendor/serde/Cargo.toml ++++ b/vendor/serde/Cargo.toml +@@ -12,7 +12,7 @@ + + [package] + name = "serde" +-version = "1.0.95" ++version = "1.0.96" + authors = ["Erick Tryzelaar ", "David Tolnay "] + build = "build.rs" + include = ["Cargo.toml", "build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] +--- a/vendor/serde_derive/Cargo.toml ++++ b/vendor/serde_derive/Cargo.toml +@@ -12,7 +12,7 @@ + + [package] + name = "serde_derive" +-version = "1.0.95" ++version = "1.0.96" + authors = ["Erick Tryzelaar ", "David Tolnay "] + include = ["Cargo.toml", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] + description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]" diff -Nru cargo-0.35.0/debian/patches/2001_more_portable_rustflags.patch cargo-0.37.0/debian/patches/2001_more_portable_rustflags.patch --- cargo-0.35.0/debian/patches/2001_more_portable_rustflags.patch 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/debian/patches/2001_more_portable_rustflags.patch 2019-08-16 01:35:57.000000000 +0000 @@ -0,0 +1,86 @@ +Bug: https://github.com/rust-lang/rust/issues/61440 +Forwarded: https://github.com/rust-lang/cargo/pull/7158 + +--- a/tests/testsuite/freshness.rs ++++ b/tests/testsuite/freshness.rs +@@ -1152,7 +1152,7 @@ + + p.cargo("build").run(); + p.cargo("build") +- .env("RUSTFLAGS", "-C target-cpu=native") ++ .env("RUSTFLAGS", "-C linker=cc") + .with_stderr( + "\ + [COMPILING] foo v0.0.1 ([..]) +@@ -1164,7 +1164,7 @@ + .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]") + .run(); + p.cargo("build") +- .env("RUSTFLAGS", "-C target-cpu=native") ++ .env("RUSTFLAGS", "-C linker=cc") + .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]") + .run(); + } +@@ -1216,7 +1216,7 @@ + .run(); + p.cargo("build -Z mtime-on-use") + .masquerade_as_nightly_cargo() +- .env("RUSTFLAGS", "-C target-cpu=native") ++ .env("RUSTFLAGS", "-C linker=cc") + .with_stderr( + "\ + [COMPILING] bar v0.0.1 ([..]) +@@ -1234,14 +1234,14 @@ + // This does not make new files, but it does update the mtime. + p.cargo("build -Z mtime-on-use") + .masquerade_as_nightly_cargo() +- .env("RUSTFLAGS", "-C target-cpu=native") ++ .env("RUSTFLAGS", "-C linker=cc") + .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]") + .run(); + simple_deps_cleaner(p.target_debug_dir(), timestamp); + // This should not recompile! + p.cargo("build -Z mtime-on-use") + .masquerade_as_nightly_cargo() +- .env("RUSTFLAGS", "-C target-cpu=native") ++ .env("RUSTFLAGS", "-C linker=cc") + .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]") + .run(); + // But this should be cleaned and so need a rebuild +@@ -1311,7 +1311,7 @@ + .run(); + p.cargo("build -Z mtime-on-use") + .masquerade_as_nightly_cargo() +- .env("RUSTFLAGS", "-C target-cpu=native") ++ .env("RUSTFLAGS", "-C linker=cc") + .with_stderr( + "\ + [COMPILING] bar v0.0.1 ([..]) +@@ -1329,14 +1329,14 @@ + // This does not make new files, but it does update the mtime. + p.cargo("build -Z mtime-on-use") + .masquerade_as_nightly_cargo() +- .env("RUSTFLAGS", "-C target-cpu=native") ++ .env("RUSTFLAGS", "-C linker=cc") + .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]") + .run(); + fingerprint_cleaner(p.target_debug_dir(), timestamp); + // This should not recompile! + p.cargo("build -Z mtime-on-use") + .masquerade_as_nightly_cargo() +- .env("RUSTFLAGS", "-C target-cpu=native") ++ .env("RUSTFLAGS", "-C linker=cc") + .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]") + .run(); + // But this should be cleaned and so need a rebuild +--- a/tests/testsuite/fix.rs ++++ b/tests/testsuite/fix.rs +@@ -413,7 +413,7 @@ + [FINISHED] [..] + "; + p.cargo("fix --edition --allow-no-vcs") +- .env("RUSTFLAGS", "-C target-cpu=native") ++ .env("RUSTFLAGS", "-C linker=cc") + .with_stderr(stderr) + .with_stdout("") + .run(); diff -Nru cargo-0.35.0/debian/patches/disable-large_conflict_cache-test-on-non-x86.patch cargo-0.37.0/debian/patches/disable-large_conflict_cache-test-on-non-x86.patch --- cargo-0.35.0/debian/patches/disable-large_conflict_cache-test-on-non-x86.patch 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/debian/patches/disable-large_conflict_cache-test-on-non-x86.patch 2019-08-16 03:05:33.000000000 +0000 @@ -0,0 +1,19 @@ +Description: Disable the large_conflict_cache test on non-x86 + The resolver large_conflict_cache test is failing on some of the non x86 + arches (e.g. armhf, arm64) apparently due to speed constraints. Since + these tests have been moved to their own crate upstream and are only ran as + part of upstream's own CI, let's not block on this failure. +Author: Łukasz 'sil2100' Zemczak +Forwarded: not-needed +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/tests/testsuite/resolve.rs ++++ b/tests/testsuite/resolve.rs +@@ -1342,6 +1342,7 @@ + } + + #[test] ++#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] + fn large_conflict_cache() { + let mut input = vec![ + pkg!(("last", "0.0.0") => [dep("bad")]), // just to make sure last is less constrained diff -Nru cargo-0.35.0/debian/patches/disable-tool_paths-custom_runner.patch cargo-0.37.0/debian/patches/disable-tool_paths-custom_runner.patch --- cargo-0.35.0/debian/patches/disable-tool_paths-custom_runner.patch 2019-05-14 01:14:16.000000000 +0000 +++ cargo-0.37.0/debian/patches/disable-tool_paths-custom_runner.patch 2019-08-16 03:05:33.000000000 +0000 @@ -8,7 +8,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/tests/testsuite/tool_paths.rs +++ b/tests/testsuite/tool_paths.rs -@@ -115,145 +115,149 @@ +@@ -115,88 +115,88 @@ )).run(); } @@ -85,79 +85,15 @@ - - p.cargo("run -- --param") - .with_status(101) -- .with_stderr_contains(&format!( +- .with_stderr_contains( - "\ -[COMPILING] foo v0.0.1 ([CWD]) -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -[RUNNING] `nonexistent-runner -r target/debug/foo[EXE] --param` -", -- )) -- .run(); --} -- --// custom runner set via `target.$triple.runner` have precende over `target.'cfg(..)'.runner` --#[test] --fn custom_runner_cfg_precedence() { -- let target = rustc_host(); -- -- let p = project() -- .file("src/main.rs", "fn main() {}") -- .file( -- ".cargo/config", -- &format!( -- r#" -- [target.'cfg(not(target_os = "none"))'] -- runner = "ignored-runner" -- -- [target.{}] -- runner = "nonexistent-runner -r" -- "#, -- target -- ), -- ) -- .build(); -- -- p.cargo("run -- --param") -- .with_status(101) -- .with_stderr_contains(&format!( -- "\ -- [COMPILING] foo v0.0.1 ([CWD]) --[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] --[RUNNING] `nonexistent-runner -r target/debug/foo[EXE] --param` --", -- )) -- .run(); --} -- --#[test] --fn custom_runner_cfg_collision() { -- let p = project() -- .file("src/main.rs", "fn main() {}") -- .file( -- ".cargo/config", -- r#" -- [target.'cfg(not(target_arch = "avr"))'] -- runner = "true" -- -- [target.'cfg(not(target_os = "none"))'] -- runner = "false" -- "#, - ) -- .build(); -- -- p.cargo("run -- --param") -- .with_status(101) -- .with_stderr_contains(&format!( -- "\ --[ERROR] several matching instances of `target.'cfg(..)'.runner` in `.cargo/config` --", -- )) - .run(); -} -+// These tests sometimes fail because of -+// https://github.com/rust-lang/rust/issues/55242 ("failed call to -+// CommandExt::exec corrupts environ of calling process") -+ +// #[test] +// fn custom_runner() { +// let target = rustc_host(); @@ -231,72 +167,15 @@ + +// p.cargo("run -- --param") +// .with_status(101) -+// .with_stderr_contains(&format!( ++// .with_stderr_contains( +// "\ +// [COMPILING] foo v0.0.1 ([CWD]) +// [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] +// [RUNNING] `nonexistent-runner -r target/debug/foo[EXE] --param` +// ", -+// )) -+// .run(); -+// } -+ -+// // custom runner set via `target.$triple.runner` have precende over `target.'cfg(..)'.runner` -+// #[test] -+// fn custom_runner_cfg_precedence() { -+// let target = rustc_host(); -+ -+// let p = project() -+// .file("src/main.rs", "fn main() {}") -+// .file( -+// ".cargo/config", -+// &format!( -+// r#" -+// [target.'cfg(not(target_os = "none"))'] -+// runner = "ignored-runner" -+ -+// [target.{}] -+// runner = "nonexistent-runner -r" -+// "#, -+// target -+// ), -+// ) -+// .build(); -+ -+// p.cargo("run -- --param") -+// .with_status(101) -+// .with_stderr_contains(&format!( -+// "\ -+// [COMPILING] foo v0.0.1 ([CWD]) -+// [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -+// [RUNNING] `nonexistent-runner -r target/debug/foo[EXE] --param` -+// ", -+// )) -+// .run(); -+// } -+ -+// #[test] -+// fn custom_runner_cfg_collision() { -+// let p = project() -+// .file("src/main.rs", "fn main() {}") -+// .file( -+// ".cargo/config", -+// r#" -+// [target.'cfg(not(target_arch = "avr"))'] -+// runner = "true" -+ -+// [target.'cfg(not(target_os = "none"))'] -+// runner = "false" -+// "#, +// ) -+// .build(); -+ -+// p.cargo("run -- --param") -+// .with_status(101) -+// .with_stderr_contains(&format!( -+// "\ -+// [ERROR] several matching instances of `target.'cfg(..)'.runner` in `.cargo/config` -+// ", -+// )) +// .run(); +// } + + // custom runner set via `target.$triple.runner` have precende over `target.'cfg(..)'.runner` + #[test] diff -Nru cargo-0.35.0/debian/patches/series cargo-0.37.0/debian/patches/series --- cargo-0.35.0/debian/patches/series 2019-05-16 23:25:03.000000000 +0000 +++ cargo-0.37.0/debian/patches/series 2019-08-18 04:14:25.000000000 +0000 @@ -1,5 +1,7 @@ +1001_vendor_serde_atomic-compat.patch 2002_disable-net-tests.patch #2005_disable_fetch_cross_tests.patch +2001_more_portable_rustflags.patch disable-fetch-tests-on-non-x86.patch disable-tool_paths-custom_runner.patch -typenum-rounding.patch +disable-large_conflict_cache-test-on-non-x86.patch diff -Nru cargo-0.35.0/debian/patches/typenum-rounding.patch cargo-0.37.0/debian/patches/typenum-rounding.patch --- cargo-0.35.0/debian/patches/typenum-rounding.patch 2019-05-14 01:14:16.000000000 +0000 +++ cargo-0.37.0/debian/patches/typenum-rounding.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -Description: fix rounding issue in typenum -Author: Michael Hudson-Doyle -Origin: vendor -Bug: https://github.com/paholg/typenum/pull/115 -Last-Update: 2019-03-13 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ ---- a/vendor/typenum/build/main.rs -+++ b/vendor/typenum/build/main.rs -@@ -77,7 +77,7 @@ - fn main() { - let highest: u64 = 1024; - -- let first2: u32 = (highest as f64).log(2.0) as u32 + 1; -+ let first2: u32 = (highest as f64).log(2.0).round() as u32 + 1; - let first10: u32 = (highest as f64).log(10.0) as u32 + 1; - let uints = (0..(highest + 1)) - .chain((first2..64).map(|i| 2u64.pow(i))) diff -Nru cargo-0.35.0/debian/rules cargo-0.37.0/debian/rules --- cargo-0.35.0/debian/rules 2019-05-16 23:25:03.000000000 +0000 +++ cargo-0.37.0/debian/rules 2019-08-18 04:14:25.000000000 +0000 @@ -13,10 +13,12 @@ export CARGO_HOME = $(CURDIR)/debian/cargo_home export DEB_CARGO_CRATE=cargo_$(DEB_VERSION_UPSTREAM) export DEB_CARGO_PACKAGE=cargo +export RUSTFLAGS += --remap-path-prefix=$(CURDIR)=/usr/src/cargo-$(DEB_VERSION_UPSTREAM) # don't shrink, this can take ages # see https://github.com/rust-lang/cargo/issues/6490 for details export PROPTEST_MAX_SHRINK_ITERS = 0 +export CARGO_TEST_SLOW_CPU_MULTIPLIER = 4 # To run a specific test, run something like: # $ debian/rules override_dh_auto_test-arch \ diff -Nru cargo-0.35.0/debian/scripts/debian-cargo-vendor cargo-0.37.0/debian/scripts/debian-cargo-vendor --- cargo-0.35.0/debian/scripts/debian-cargo-vendor 2019-02-27 08:18:03.000000000 +0000 +++ cargo-0.37.0/debian/scripts/debian-cargo-vendor 2019-08-16 01:35:57.000000000 +0000 @@ -1,5 +1,11 @@ #!/bin/bash # To run this, you need to first install cargo-vendor. +# +# TODO: this script has a known bug in: if the Debian patches being applied, +# changes the set of dependencies, then "cargo vendor" is not re-run in order +# to pick up this new set of dependencies. This is manifested by an error +# message like: "perhaps a crate was updated and forgotten to be re-vendored?" +# set -e SCRIPTDIR="$(dirname "$(readlink -f "$0")")" @@ -43,7 +49,7 @@ cp Cargo.lock Cargo.lock.orig if [ -d debcargo-conf ]; then ( cd debcargo-conf && git pull ); -else git clone https://salsa.debian.org/rust-team/debcargo-conf; fi +else git clone "${DEBCARGO_CONF:-https://salsa.debian.org/rust-team/debcargo-conf}"; fi # keep applying patches, and drop to a subshell for manual fixing, until it succeeds while ! ( cd vendor @@ -66,7 +72,9 @@ QUILT_PATCHES=debian/patches quilt push -a case $? in 0|2) true;; - *) echo >&2 "$0: patching $i failed <<<<<<<<<<<<<<<<<<<<<<<<"; x=false;; + *) echo >&2 "$0: patching $i failed <<<<<<<<<<<<<<<<<<<<<<<<" + QUILT_PATCHES=debian/patches quilt pop -af + x=false;; esac fi if [ -f ../../debcargo-conf/src/$i/debian/build.rs ]; then diff -Nru cargo-0.35.0/debian/source/lintian-overrides cargo-0.37.0/debian/source/lintian-overrides --- cargo-0.35.0/debian/source/lintian-overrides 2019-02-27 08:18:03.000000000 +0000 +++ cargo-0.37.0/debian/source/lintian-overrides 2019-08-16 01:35:57.000000000 +0000 @@ -1,2 +1,2 @@ -# Override for js file from vendored crate libnghttp2-sys documentation we can safely ignore this. -source-is-missing \ No newline at end of file +# debian policy bug #649530 +cargo source: missing-license-paragraph-in-dep5-copyright mpl-2.0+ (paragraph at line *) diff -Nru cargo-0.35.0/debian/vendor-tarball-unsuspicious.txt cargo-0.37.0/debian/vendor-tarball-unsuspicious.txt --- cargo-0.35.0/debian/vendor-tarball-unsuspicious.txt 2019-02-27 08:18:03.000000000 +0000 +++ cargo-0.37.0/debian/vendor-tarball-unsuspicious.txt 2019-08-16 01:35:57.000000000 +0000 @@ -1,62 +1,41 @@ # This is a list of files and dirs that are omitted from our custom # "suspicious files" scanner +# docs +clap/SPONSORS.md +failure/book/src/bail-and-ensure.md +failure/CODE_OF_CONDUCT.md +*/CHANGELOG.md +*/CONTRIBUTORS.md +*/LICENSE +*/LICENSE.md +*/README.md +*/Cargo.toml + # test data +bstr/src/unicode/data/*Test.txt flate2/tests/ idna/tests/punycode_tests.json -num/ci/ +idna/tests/IdnaTest.txt +im-rc/proptest-regressions/ openssl/test/ +regex/src/testdata/basic.dat +regex/tests/ schannel/test/* -tar/tests/archives/ -term/tests/data/ toml/tests/ url/tests/*.json -# misc support data -failure/CODE_OF_CONDUCT.md -failure_derive/CODE_OF_CONDUCT.md -hamcrest/LICENSE-* -*/.travis.yml -# "build status" link-images etc take up a lot of line-length -*/README.md +# ideally should be autogenerated, but too difficult today +bstr/src/unicode/fsm/*.dfa -# individual files, manually audited: -clap/CHANGELOG.md -clap/CONTRIBUTORS.md -clap/.github/CONTRIBUTING.md +# "verylongtext" but OK source code, manually audited: cloudabi/cloudabi.rs -conv/src/errors.rs -conv/src/impls.rs -conv/src/lib.rs -conv/src/macros.rs -docopt/src/test/testcases.rs -dtoa/performance.png -failure/book/src/bail-and-ensure.md git2/src/cred.rs -idna/src/uts46_mapping_table.rs -idna/tests/IdnaTest.txt -itoa/performance.png -lazy_static/src/lib.rs libz-sys/src/smoke.c -miniz-sys/miniz.c -num/doc/favicon.ico -num/doc/rust-logo-128x128-blk-v2.png -num/.travis/deploy.enc -regex/src/testdata/basic.dat -regex/tests/crates_regex.rs -regex/tests/fowler.rs +proptest/src/regex-contrib/crates_regex.rs +openssl-sys/build/expando.c +rustc-demangle/src/legacy.rs rustc-demangle/src/lib.rs -schannel/LICENSE.md -stable_deref_trait/src/lib.rs -synstructure/LICENSE -tar/Cargo.toml termion/logo.svg -term/scripts/id_rsa.enc -unicode-normalization/src/tables.rs -url/github.png -vec_map/Cargo.toml walkdir/compare/nftw.c -winapi/README.md winapi/src/lib.rs -winapi/src/winnt.rs -proptest/src/regex-contrib/crates_regex.rs diff -Nru cargo-0.35.0/LICENSE-APACHE cargo-0.37.0/LICENSE-APACHE --- cargo-0.35.0/LICENSE-APACHE 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/LICENSE-APACHE 2019-05-15 19:48:47.000000000 +0000 @@ -1,6 +1,6 @@ Apache License Version 2.0, January 2004 - http://www.apache.org/licenses/ + https://www.apache.org/licenses/LICENSE-2.0 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION @@ -192,7 +192,7 @@ you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff -Nru cargo-0.35.0/LICENSE-THIRD-PARTY cargo-0.37.0/LICENSE-THIRD-PARTY --- cargo-0.35.0/LICENSE-THIRD-PARTY 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/LICENSE-THIRD-PARTY 2019-05-15 19:48:47.000000000 +0000 @@ -3,7 +3,7 @@ license terms. These libraries are normally all linked static into the binary distributions of Cargo: -* OpenSSL - http://www.openssl.org/source/license.html +* OpenSSL - https://www.openssl.org/source/license.html Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. @@ -22,7 +22,7 @@ 3. All advertising materials mentioning features or use of this software must display the following acknowledgment: "This product includes software developed by the OpenSSL Project - for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + for use in the OpenSSL Toolkit. (https://www.openssl.org/)" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to endorse or promote products derived from this software without @@ -36,7 +36,7 @@ 6. Redistributions of any form whatsoever must retain the following acknowledgment: "This product includes software developed by the OpenSSL Project - for use in the OpenSSL Toolkit (http://www.openssl.org/)" + for use in the OpenSSL Toolkit (https://www.openssl.org/)" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -1037,7 +1037,7 @@ ---------------------------------------------------------------------- -* libssh2 - http://www.libssh2.org/license.html +* libssh2 - https://www.libssh2.org/license.html Copyright (c) 2004-2007 Sara Golemon Copyright (c) 2005,2006 Mikhail Gusarov @@ -1080,7 +1080,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* libcurl - http://curl.haxx.se/docs/copyright.html +* libcurl - https://curl.haxx.se/docs/copyright.html COPYRIGHT AND PERMISSION NOTICE @@ -1268,5 +1268,5 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - For more information, please refer to + For more information, please refer to diff -Nru cargo-0.35.0/README.md cargo-0.37.0/README.md --- cargo-0.35.0/README.md 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/README.md 2019-05-15 19:48:47.000000000 +0000 @@ -78,7 +78,7 @@ ### Third party software This product includes software developed by the OpenSSL Project -for use in the OpenSSL Toolkit (http://www.openssl.org/). +for use in the OpenSSL Toolkit (https://www.openssl.org/). In binary form, this product includes software that is licensed under the terms of the GNU General Public License, version 2, with a linking exception, diff -Nru cargo-0.35.0/src/bin/cargo/cli.rs cargo-0.37.0/src/bin/cargo/cli.rs --- cargo-0.35.0/src/bin/cargo/cli.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/cli.rs 2019-05-15 19:48:47.000000000 +0000 @@ -2,6 +2,7 @@ use clap::{AppSettings, Arg, ArgMatches}; +use cargo::core::features; use cargo::{self, CliResult, Config}; use super::commands; @@ -31,12 +32,25 @@ -Z avoid-dev-deps -- Avoid installing dev-dependencies if possible -Z minimal-versions -- Install minimal dependency versions instead of maximum -Z no-index-update -- Do not update the registry, avoids a network request for benchmarking - -Z offline -- Offline mode that does not perform network requests -Z unstable-options -- Allow the usage of unstable options such as --registry -Z config-profile -- Read profiles from .cargo/config files + -Z install-upgrade -- `cargo install` will upgrade instead of failing Run with 'cargo -Z [FLAG] [SUBCOMMAND]'" ); + if !features::nightly_features_allowed() { + println!( + "\nUnstable flags are only available on the nightly channel \ + of Cargo, but this is the `{}` channel.\n\ + {}", + features::channel(), + features::SEE_CHANNELS + ); + } + println!( + "\nSee https://doc.rust-lang.org/nightly/cargo/reference/unstable.html \ + for more information about these flags." + ); return Ok(()); } @@ -47,8 +61,8 @@ return Ok(()); } - if let Some(ref code) = args.value_of("explain") { - let mut procss = config.rustc(None)?.process(); + if let Some(code) = args.value_of("explain") { + let mut procss = config.load_global_rustc(None)?.process(); procss.arg("--explain").arg(code).exec()?; return Ok(()); } @@ -145,7 +159,7 @@ config.configure( args.occurrences_of("verbose") as u32, - if args.is_present("quiet") { + if args.is_present("quiet") || subcommand_args.is_present("quiet") { Some(true) } else { None @@ -153,6 +167,7 @@ &args.value_of("color").map(|s| s.to_string()), args.is_present("frozen"), args.is_present("locked"), + args.is_present("offline"), arg_target_dir, &args .values_of_lossy("unstable-features") @@ -176,7 +191,6 @@ AppSettings::VersionlessSubcommands, AppSettings::AllowExternalSubcommands, ]) - .about("") .template( "\ Rust's package manager @@ -217,11 +231,7 @@ .multiple(true) .global(true), ) - .arg( - opt("quiet", "No output printed to stdout") - .short("q") - .global(true), - ) + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg( opt("color", "Coloring: auto, always, never") .value_name("WHEN") @@ -229,6 +239,7 @@ ) .arg(opt("frozen", "Require Cargo.lock and cache are up to date").global(true)) .arg(opt("locked", "Require Cargo.lock is up to date").global(true)) + .arg(opt("offline", "Run without accessing the network").global(true)) .arg( Arg::with_name("unstable-features") .help("Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details") diff -Nru cargo-0.35.0/src/bin/cargo/commands/bench.rs cargo-0.37.0/src/bin/cargo/commands/bench.rs --- cargo-0.35.0/src/bin/cargo/commands/bench.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/bench.rs 2019-05-15 19:48:47.000000000 +0000 @@ -6,6 +6,7 @@ subcommand("bench") .setting(AppSettings::TrailingVarArg) .about("Execute all benchmarks of a local package") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg( Arg::with_name("BENCHNAME") .help("If specified, only run benches containing this string in their names"), @@ -82,17 +83,9 @@ compile_opts, }; - let mut bench_args = vec![]; - bench_args.extend( - args.value_of("BENCHNAME") - .into_iter() - .map(|s| s.to_string()), - ); - bench_args.extend( - args.values_of("args") - .unwrap_or_default() - .map(|s| s.to_string()), - ); + let bench_args = args.value_of("BENCHNAME").into_iter(); + let bench_args = bench_args.chain(args.values_of("args").unwrap_or_default()); + let bench_args = bench_args.collect::>(); let err = ops::run_benches(&ws, &ops, &bench_args)?; match err { diff -Nru cargo-0.35.0/src/bin/cargo/commands/build.rs cargo-0.37.0/src/bin/cargo/commands/build.rs --- cargo-0.35.0/src/bin/cargo/commands/build.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/build.rs 2019-05-15 19:48:47.000000000 +0000 @@ -7,6 +7,7 @@ // subcommand aliases are handled in aliased_command() // .alias("b") .about("Compile a local package and all of its dependencies") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg_package_spec( "Package to build (see `cargo help pkgid`)", "Build all packages in the workspace", @@ -29,7 +30,13 @@ .arg_features() .arg_target_triple("Build for the target triple") .arg_target_dir() - .arg(opt("out-dir", "Copy final artifacts to this directory").value_name("PATH")) + .arg( + opt( + "out-dir", + "Copy final artifacts to this directory (unstable)", + ) + .value_name("PATH"), + ) .arg_manifest_path() .arg_message_format() .arg_build_plan() @@ -51,11 +58,11 @@ let mut compile_opts = args.compile_options(config, CompileMode::Build, Some(&ws))?; compile_opts.export_dir = args.value_of_path("out-dir", config); - if compile_opts.export_dir.is_some() && !config.cli_unstable().unstable_options { - Err(failure::format_err!( - "`--out-dir` flag is unstable, pass `-Z unstable-options` to enable it" - ))?; - }; + if compile_opts.export_dir.is_some() { + config + .cli_unstable() + .fail_if_stable_opt("--out-dir", 6790)?; + } ops::compile(&ws, &compile_opts)?; Ok(()) } diff -Nru cargo-0.35.0/src/bin/cargo/commands/check.rs cargo-0.37.0/src/bin/cargo/commands/check.rs --- cargo-0.35.0/src/bin/cargo/commands/check.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/check.rs 2019-05-15 19:48:47.000000000 +0000 @@ -7,6 +7,7 @@ // subcommand aliases are handled in aliased_command() // .alias("c") .about("Check a local package and all of its dependencies for errors") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg_package_spec( "Package(s) to check", "Check all packages in the workspace", diff -Nru cargo-0.35.0/src/bin/cargo/commands/clean.rs cargo-0.37.0/src/bin/cargo/commands/clean.rs --- cargo-0.35.0/src/bin/cargo/commands/clean.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/clean.rs 2019-05-15 19:48:47.000000000 +0000 @@ -5,6 +5,7 @@ pub fn cli() -> App { subcommand("clean") .about("Remove artifacts that cargo has generated in the past") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg_package_spec_simple("Package to clean artifacts for") .arg_manifest_path() .arg_target_triple("Target triple to clean output for") diff -Nru cargo-0.35.0/src/bin/cargo/commands/clippy.rs cargo-0.37.0/src/bin/cargo/commands/clippy.rs --- cargo-0.35.0/src/bin/cargo/commands/clippy.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/clippy.rs 2019-05-15 19:48:47.000000000 +0000 @@ -0,0 +1,77 @@ +use crate::command_prelude::*; + +use cargo::ops; +use cargo::util; + +pub fn cli() -> App { + subcommand("clippy-preview") + .about("Checks a package to catch common mistakes and improve your Rust code.") + .arg_package_spec( + "Package(s) to check", + "Check all packages in the workspace", + "Exclude packages from the check", + ) + .arg_jobs() + .arg_targets_all( + "Check only this package's library", + "Check only the specified binary", + "Check all binaries", + "Check only the specified example", + "Check all examples", + "Check only the specified test target", + "Check all tests", + "Check only the specified bench target", + "Check all benches", + "Check all targets", + ) + .arg_release("Check artifacts in release mode, with optimizations") + .arg_features() + .arg_target_triple("Check for the target triple") + .arg_target_dir() + .arg_manifest_path() + .arg_message_format() + .after_help( + "\ +If the `--package` argument is given, then SPEC is a package ID specification +which indicates which package should be built. If it is not given, then the +current package is built. For more information on SPEC and its format, see the +`cargo help pkgid` command. + +All packages in the workspace are checked if the `--all` flag is supplied. The +`--all` flag is automatically assumed for a virtual manifest. +Note that `--exclude` has to be specified in conjunction with the `--all` flag. + +To allow or deny a lint from the command line you can use `cargo clippy --` +with: + + -W --warn OPT Set lint warnings + -A --allow OPT Set lint allowed + -D --deny OPT Set lint denied + -F --forbid OPT Set lint forbidden + +You can use tool lints to allow or deny lints from your code, eg.: + + #[allow(clippy::needless_lifetimes)] +", + ) +} + +pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult { + let ws = args.workspace(config)?; + + let mode = CompileMode::Check { test: false }; + let mut compile_opts = args.compile_options(config, mode, Some(&ws))?; + + if !config.cli_unstable().unstable_options { + return Err(failure::format_err!( + "`clippy-preview` is unstable, pass `-Z unstable-options` to enable it" + ) + .into()); + } + + let wrapper = util::process("clippy-driver"); + compile_opts.build_config.rustc_wrapper = Some(wrapper); + + ops::compile(&ws, &compile_opts)?; + Ok(()) +} diff -Nru cargo-0.35.0/src/bin/cargo/commands/doc.rs cargo-0.37.0/src/bin/cargo/commands/doc.rs --- cargo-0.35.0/src/bin/cargo/commands/doc.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/doc.rs 2019-05-15 19:48:47.000000000 +0000 @@ -5,6 +5,7 @@ pub fn cli() -> App { subcommand("doc") .about("Build a package's documentation") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg(opt( "open", "Opens the docs in a browser after the operation", diff -Nru cargo-0.35.0/src/bin/cargo/commands/fetch.rs cargo-0.37.0/src/bin/cargo/commands/fetch.rs --- cargo-0.35.0/src/bin/cargo/commands/fetch.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/fetch.rs 2019-05-15 19:48:47.000000000 +0000 @@ -6,6 +6,7 @@ pub fn cli() -> App { subcommand("fetch") .about("Fetch dependencies of a package from the network") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg_manifest_path() .arg_target_triple("Fetch dependencies for the target triple") .after_help( diff -Nru cargo-0.35.0/src/bin/cargo/commands/fix.rs cargo-0.37.0/src/bin/cargo/commands/fix.rs --- cargo-0.35.0/src/bin/cargo/commands/fix.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/fix.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,10 +1,11 @@ use crate::command_prelude::*; -use cargo::ops::{self, CompileFilter, FilterRule}; +use cargo::ops::{self, CompileFilter, FilterRule, LibRule}; pub fn cli() -> App { subcommand("fix") .about("Automatically fix lint warnings reported by rustc") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg_package_spec( "Package(s) to fix", "Fix all packages in the workspace", @@ -127,7 +128,7 @@ if let CompileFilter::Default { .. } = opts.filter { opts.filter = CompileFilter::Only { all_targets: true, - lib: true, + lib: LibRule::Default, bins: FilterRule::All, examples: FilterRule::All, benches: FilterRule::All, diff -Nru cargo-0.35.0/src/bin/cargo/commands/generate_lockfile.rs cargo-0.37.0/src/bin/cargo/commands/generate_lockfile.rs --- cargo-0.35.0/src/bin/cargo/commands/generate_lockfile.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/generate_lockfile.rs 2019-05-15 19:48:47.000000000 +0000 @@ -5,6 +5,7 @@ pub fn cli() -> App { subcommand("generate-lockfile") .about("Generate the lockfile for a package") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg_manifest_path() } diff -Nru cargo-0.35.0/src/bin/cargo/commands/git_checkout.rs cargo-0.37.0/src/bin/cargo/commands/git_checkout.rs --- cargo-0.35.0/src/bin/cargo/commands/git_checkout.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/git_checkout.rs 2019-05-15 19:48:47.000000000 +0000 @@ -7,6 +7,7 @@ pub fn cli() -> App { subcommand("git-checkout") .about("Checkout a copy of a Git repository") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg( Arg::with_name("url") .long("url") diff -Nru cargo-0.35.0/src/bin/cargo/commands/init.rs cargo-0.37.0/src/bin/cargo/commands/init.rs --- cargo-0.35.0/src/bin/cargo/commands/init.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/init.rs 2019-05-15 19:48:47.000000000 +0000 @@ -5,6 +5,7 @@ pub fn cli() -> App { subcommand("init") .about("Create a new cargo package in an existing directory") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg(Arg::with_name("path").default_value(".")) .arg(opt("registry", "Registry to use").value_name("REGISTRY")) .arg_new_opts() diff -Nru cargo-0.35.0/src/bin/cargo/commands/install.rs cargo-0.37.0/src/bin/cargo/commands/install.rs --- cargo-0.35.0/src/bin/cargo/commands/install.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/install.rs 2019-05-15 19:48:47.000000000 +0000 @@ -7,23 +7,49 @@ pub fn cli() -> App { subcommand("install") .about("Install a Rust binary. Default location is $HOME/.cargo/bin") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg(Arg::with_name("crate").empty_values(false).multiple(true)) .arg( - opt("version", "Specify a version to install from crates.io") + opt("version", "Specify a version to install") .alias("vers") - .value_name("VERSION"), + .value_name("VERSION") + .requires("crate"), + ) + .arg( + opt("git", "Git URL to install the specified crate from") + .value_name("URL") + .conflicts_with_all(&["path", "registry"]), + ) + .arg( + opt("branch", "Branch to use when installing from git") + .value_name("BRANCH") + .requires("git"), + ) + .arg( + opt("tag", "Tag to use when installing from git") + .value_name("TAG") + .requires("git"), + ) + .arg( + opt("rev", "Specific commit to use when installing from git") + .value_name("SHA") + .requires("git"), + ) + .arg( + opt("path", "Filesystem path to local crate to install") + .value_name("PATH") + .conflicts_with_all(&["git", "registry"]), ) - .arg(opt("git", "Git URL to install the specified crate from").value_name("URL")) - .arg(opt("branch", "Branch to use when installing from git").value_name("BRANCH")) - .arg(opt("tag", "Tag to use when installing from git").value_name("TAG")) - .arg(opt("rev", "Specific commit to use when installing from git").value_name("SHA")) - .arg(opt("path", "Filesystem path to local crate to install").value_name("PATH")) .arg(opt( "list", "list all installed packages and their versions", )) .arg_jobs() .arg(opt("force", "Force overwriting existing crates or binaries").short("f")) + .arg(opt( + "no-track", + "Do not save tracking information (unstable)", + )) .arg_features() .arg(opt("debug", "Build in debug mode instead of release mode")) .arg_targets_bins_examples( @@ -34,7 +60,12 @@ ) .arg_target_triple("Build for the target triple") .arg(opt("root", "Directory to install packages into").value_name("DIR")) - .arg(opt("registry", "Registry to use").value_name("REGISTRY")) + .arg( + opt("registry", "Registry to use") + .value_name("REGISTRY") + .requires("crate") + .conflicts_with_all(&["git", "path"]), + ) .after_help( "\ This command manages Cargo's local set of installed binary crates. Only packages @@ -45,10 +76,10 @@ `$CARGO_HOME` if set or `$HOME/.cargo` by default). There are multiple sources from which a crate can be installed. The default -location is crates.io but the `--git` and `--path` flags can change this source. -If the source contains more than one package (such as crates.io or a git -repository with multiple crates) the `` argument is required to indicate -which crate should be installed. +location is crates.io but the `--git`, `--path`, and `registry` flags can +change this source. If the source contains more than one package (such as +crates.io or a git repository with multiple crates) the `` argument is +required to indicate which crate should be installed. Crates from crates.io can optionally specify the version they wish to install via the `--version` flags, and similarly packages from git repositories can @@ -61,10 +92,9 @@ enables overwriting existing binaries. Thus you can reinstall a crate with `cargo install --force `. -Omitting the specification entirely will -install the crate in the current directory. That is, `install` is equivalent to -the more explicit `install --path .`. This behaviour is deprecated, and no -longer supported as of the Rust 2018 edition. +Omitting the specification entirely will install the crate in the +current directory. This behaviour is deprecated, and it no longer works in the +Rust 2018 edition. Use the more explicit `install --path .` instead. If the source is crates.io or `--git` then by default the crate will be built in a temporary target directory. To avoid this, the target directory can be @@ -77,7 +107,11 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult { let registry = args.registry(config)?; - config.reload_rooted_at_cargo_home()?; + if let Some(path) = args.value_of_path("path", config) { + config.reload_rooted_at(path)?; + } else { + config.reload_rooted_at(config.home().clone().into_path_unlocked())?; + } let workspace = args.workspace(config).ok(); let mut compile_opts = args.compile_options(config, CompileMode::Build, workspace.as_ref())?; @@ -117,6 +151,12 @@ let version = args.value_of("version"); let root = args.value_of("root"); + if args.is_present("no-track") && !config.cli_unstable().install_upgrade { + Err(failure::format_err!( + "`--no-track` flag is unstable, pass `-Z install-upgrade` to enable it" + ))?; + }; + if args.is_present("list") { ops::install_list(root, config)?; } else { @@ -128,6 +168,7 @@ version, &compile_opts, args.is_present("force"), + args.is_present("no-track"), )?; } Ok(()) diff -Nru cargo-0.35.0/src/bin/cargo/commands/locate_project.rs cargo-0.37.0/src/bin/cargo/commands/locate_project.rs --- cargo-0.35.0/src/bin/cargo/commands/locate_project.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/locate_project.rs 2019-05-15 19:48:47.000000000 +0000 @@ -6,6 +6,7 @@ pub fn cli() -> App { subcommand("locate-project") .about("Print a JSON representation of a Cargo.toml file's location") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg_manifest_path() } diff -Nru cargo-0.35.0/src/bin/cargo/commands/login.rs cargo-0.37.0/src/bin/cargo/commands/login.rs --- cargo-0.35.0/src/bin/cargo/commands/login.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/login.rs 2019-05-15 19:48:47.000000000 +0000 @@ -8,6 +8,7 @@ "Save an api token from the registry locally. \ If token is not specified, it will be read from stdin.", ) + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg(Arg::with_name("token")) .arg( opt("host", "Host to set the token for") diff -Nru cargo-0.35.0/src/bin/cargo/commands/metadata.rs cargo-0.37.0/src/bin/cargo/commands/metadata.rs --- cargo-0.35.0/src/bin/cargo/commands/metadata.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/metadata.rs 2019-05-15 19:48:47.000000000 +0000 @@ -10,6 +10,7 @@ the concrete used versions including overrides, \ in machine-readable format", ) + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg_features() .arg(opt( "no-deps", diff -Nru cargo-0.35.0/src/bin/cargo/commands/mod.rs cargo-0.37.0/src/bin/cargo/commands/mod.rs --- cargo-0.35.0/src/bin/cargo/commands/mod.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/mod.rs 2019-05-15 19:48:47.000000000 +0000 @@ -6,6 +6,7 @@ build::cli(), check::cli(), clean::cli(), + clippy::cli(), doc::cli(), fetch::cli(), fix::cli(), @@ -41,6 +42,7 @@ "build" => build::exec, "check" => check::exec, "clean" => clean::exec, + "clippy-preview" => clippy::exec, "doc" => doc::exec, "fetch" => fetch::exec, "fix" => fix::exec, @@ -76,6 +78,7 @@ pub mod build; pub mod check; pub mod clean; +pub mod clippy; pub mod doc; pub mod fetch; pub mod fix; diff -Nru cargo-0.35.0/src/bin/cargo/commands/new.rs cargo-0.37.0/src/bin/cargo/commands/new.rs --- cargo-0.35.0/src/bin/cargo/commands/new.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/new.rs 2019-05-15 19:48:47.000000000 +0000 @@ -5,6 +5,7 @@ pub fn cli() -> App { subcommand("new") .about("Create a new cargo package at ") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg(Arg::with_name("path").required(true)) .arg(opt("registry", "Registry to use").value_name("REGISTRY")) .arg_new_opts() diff -Nru cargo-0.35.0/src/bin/cargo/commands/owner.rs cargo-0.37.0/src/bin/cargo/commands/owner.rs --- cargo-0.35.0/src/bin/cargo/commands/owner.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/owner.rs 2019-05-15 19:48:47.000000000 +0000 @@ -5,8 +5,16 @@ pub fn cli() -> App { subcommand("owner") .about("Manage the owners of a crate on the registry") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg(Arg::with_name("crate")) - .arg(multi_opt("add", "LOGIN", "Name of a user or team to invite as an owner").short("a")) + .arg( + multi_opt( + "add", + "LOGIN", + "Name of a user or team to invite as an owner", + ) + .short("a"), + ) .arg( multi_opt( "remove", diff -Nru cargo-0.35.0/src/bin/cargo/commands/package.rs cargo-0.37.0/src/bin/cargo/commands/package.rs --- cargo-0.35.0/src/bin/cargo/commands/package.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/package.rs 2019-05-15 19:48:47.000000000 +0000 @@ -5,6 +5,7 @@ pub fn cli() -> App { subcommand("package") .about("Assemble the local package into a distributable tarball") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg( opt( "list", diff -Nru cargo-0.35.0/src/bin/cargo/commands/pkgid.rs cargo-0.37.0/src/bin/cargo/commands/pkgid.rs --- cargo-0.35.0/src/bin/cargo/commands/pkgid.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/pkgid.rs 2019-05-15 19:48:47.000000000 +0000 @@ -5,6 +5,7 @@ pub fn cli() -> App { subcommand("pkgid") .about("Print a fully qualified package specification") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg(Arg::with_name("spec")) .arg_package("Argument to get the package ID specifier for") .arg_manifest_path() @@ -27,7 +28,7 @@ crates.io/foo | foo | * | *://crates.io/foo crates.io/foo#1.2.3 | foo | 1.2.3 | *://crates.io/foo crates.io/bar#foo:1.2.3 | foo | 1.2.3 | *://crates.io/bar - http://crates.io/foo#1.2.3 | foo | 1.2.3 | http://crates.io/foo + https://crates.io/foo#1.2.3 | foo | 1.2.3 | https://crates.io/foo ", ) } diff -Nru cargo-0.35.0/src/bin/cargo/commands/publish.rs cargo-0.37.0/src/bin/cargo/commands/publish.rs --- cargo-0.35.0/src/bin/cargo/commands/publish.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/publish.rs 2019-05-15 19:48:47.000000000 +0000 @@ -5,6 +5,7 @@ pub fn cli() -> App { subcommand("publish") .about("Upload a package to the registry") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg_index() .arg(opt("token", "Token to use when uploading").value_name("TOKEN")) .arg(opt( diff -Nru cargo-0.35.0/src/bin/cargo/commands/read_manifest.rs cargo-0.37.0/src/bin/cargo/commands/read_manifest.rs --- cargo-0.35.0/src/bin/cargo/commands/read_manifest.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/read_manifest.rs 2019-05-15 19:48:47.000000000 +0000 @@ -11,6 +11,7 @@ Deprecated, use `cargo metadata --no-deps` instead.\ ", ) + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg_manifest_path() } diff -Nru cargo-0.35.0/src/bin/cargo/commands/run.rs cargo-0.37.0/src/bin/cargo/commands/run.rs --- cargo-0.35.0/src/bin/cargo/commands/run.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/run.rs 2019-05-15 19:48:47.000000000 +0000 @@ -9,6 +9,7 @@ // .alias("r") .setting(AppSettings::TrailingVarArg) .about("Run a binary or example of the local package") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg(Arg::with_name("args").multiple(true)) .arg_targets_bin_example( "Name of the bin target to run", @@ -49,7 +50,7 @@ .filter_map(|pkg| pkg.manifest().default_run()) .collect(); if default_runs.len() == 1 { - compile_opts.filter = CompileFilter::new( + compile_opts.filter = CompileFilter::from_raw_arguments( false, vec![default_runs[0].to_owned()], false, @@ -71,7 +72,7 @@ }; } }; - match ops::run(&ws, &compile_opts, &values(args, "args"))? { + match ops::run(&ws, &compile_opts, &values_os(args, "args"))? { None => Ok(()), Some(err) => { // If we never actually spawned the process then that sounds pretty diff -Nru cargo-0.35.0/src/bin/cargo/commands/rustc.rs cargo-0.37.0/src/bin/cargo/commands/rustc.rs --- cargo-0.35.0/src/bin/cargo/commands/rustc.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/rustc.rs 2019-05-15 19:48:47.000000000 +0000 @@ -6,6 +6,7 @@ subcommand("rustc") .setting(AppSettings::TrailingVarArg) .about("Compile a package and all of its dependencies") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg(Arg::with_name("args").multiple(true)) .arg_package("Package to build") .arg_jobs() diff -Nru cargo-0.35.0/src/bin/cargo/commands/rustdoc.rs cargo-0.37.0/src/bin/cargo/commands/rustdoc.rs --- cargo-0.35.0/src/bin/cargo/commands/rustdoc.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/rustdoc.rs 2019-05-15 19:48:47.000000000 +0000 @@ -6,6 +6,7 @@ subcommand("rustdoc") .setting(AppSettings::TrailingVarArg) .about("Build a package's documentation, using specified custom flags.") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg(Arg::with_name("args").multiple(true)) .arg(opt( "open", diff -Nru cargo-0.35.0/src/bin/cargo/commands/search.rs cargo-0.37.0/src/bin/cargo/commands/search.rs --- cargo-0.35.0/src/bin/cargo/commands/search.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/search.rs 2019-05-15 19:48:47.000000000 +0000 @@ -7,6 +7,7 @@ pub fn cli() -> App { subcommand("search") .about("Search packages in crates.io") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg(Arg::with_name("query").multiple(true)) .arg_index() .arg( diff -Nru cargo-0.35.0/src/bin/cargo/commands/test.rs cargo-0.37.0/src/bin/cargo/commands/test.rs --- cargo-0.35.0/src/bin/cargo/commands/test.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/test.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,4 +1,4 @@ -use cargo::ops::{self, CompileFilter}; +use cargo::ops::{self, CompileFilter, FilterRule, LibRule}; use crate::command_prelude::*; @@ -18,6 +18,13 @@ .multiple(true) .last(true), ) + .arg( + opt( + "quiet", + "Display one character per test instead of one line", + ) + .short("q"), + ) .arg_targets_all( "Test only this package's library unit tests", "Test only the specified binary", @@ -94,6 +101,13 @@ let mut compile_opts = args.compile_options(config, CompileMode::Test, Some(&ws))?; + // `TESTNAME` is actually an argument of the test binary, but it's + // important, so we explicitly mention it and reconfigure. + let test_name: Option<&str> = args.value_of("TESTNAME"); + let test_args = args.value_of("TESTNAME").into_iter(); + let test_args = test_args.chain(args.values_of("args").unwrap_or_default()); + let test_args = test_args.collect::>(); + let no_run = args.is_present("no-run"); let doc = args.is_present("doc"); if doc { @@ -111,17 +125,22 @@ } compile_opts.build_config.mode = CompileMode::Doctest; compile_opts.filter = ops::CompileFilter::new( - true, - Vec::new(), - false, - Vec::new(), - false, - Vec::new(), - false, - Vec::new(), - false, - false, + LibRule::True, + FilterRule::none(), + FilterRule::none(), + FilterRule::none(), + FilterRule::none(), ); + } else if test_name.is_some() { + if let CompileFilter::Default { .. } = compile_opts.filter { + compile_opts.filter = ops::CompileFilter::new( + LibRule::Default, // compile the library, so the unit tests can be run filtered + FilterRule::All, // compile the binaries, so the unit tests in binaries can be run filtered + FilterRule::All, // compile the tests, so the integration tests can be run filtered + FilterRule::none(), // specify --examples to unit test binaries filtered + FilterRule::none(), // specify --benches to unit test benchmarks filtered + ); // also, specify --doc to run doc tests filtered + } } let ops = ops::TestOptions { @@ -130,21 +149,14 @@ compile_opts, }; - // `TESTNAME` is actually an argument of the test binary, but it's - // important, so we explicitly mention it and reconfigure. - let mut test_args = vec![]; - test_args.extend(args.value_of("TESTNAME").into_iter().map(|s| s.to_string())); - test_args.extend( - args.values_of("args") - .unwrap_or_default() - .map(|s| s.to_string()), - ); - let err = ops::run_tests(&ws, &ops, &test_args)?; match err { None => Ok(()), Some(err) => Err(match err.exit.as_ref().and_then(|e| e.code()) { - Some(i) => CliError::new(failure::format_err!("{}", err.hint(&ws)), i), + Some(i) => CliError::new( + failure::format_err!("{}", err.hint(&ws, &ops.compile_opts)), + i, + ), None => CliError::new(err.into(), 101), }), } diff -Nru cargo-0.35.0/src/bin/cargo/commands/uninstall.rs cargo-0.37.0/src/bin/cargo/commands/uninstall.rs --- cargo-0.35.0/src/bin/cargo/commands/uninstall.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/uninstall.rs 2019-05-15 19:48:47.000000000 +0000 @@ -5,6 +5,7 @@ pub fn cli() -> App { subcommand("uninstall") .about("Remove a Rust binary") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg(Arg::with_name("spec").multiple(true)) .arg_package_spec_simple("Package to uninstall") .arg(multi_opt("bin", "NAME", "Only uninstall the binary NAME")) diff -Nru cargo-0.35.0/src/bin/cargo/commands/update.rs cargo-0.37.0/src/bin/cargo/commands/update.rs --- cargo-0.35.0/src/bin/cargo/commands/update.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/update.rs 2019-05-15 19:48:47.000000000 +0000 @@ -5,6 +5,7 @@ pub fn cli() -> App { subcommand("update") .about("Update dependencies as recorded in the local lock file") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg_package_spec_simple("Package to update") .arg(opt( "aggressive", diff -Nru cargo-0.35.0/src/bin/cargo/commands/verify_project.rs cargo-0.37.0/src/bin/cargo/commands/verify_project.rs --- cargo-0.35.0/src/bin/cargo/commands/verify_project.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/verify_project.rs 2019-05-15 19:48:47.000000000 +0000 @@ -8,6 +8,7 @@ pub fn cli() -> App { subcommand("verify-project") .about("Check correctness of crate manifest") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg_manifest_path() } diff -Nru cargo-0.35.0/src/bin/cargo/commands/version.rs cargo-0.37.0/src/bin/cargo/commands/version.rs --- cargo-0.35.0/src/bin/cargo/commands/version.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/version.rs 2019-05-15 19:48:47.000000000 +0000 @@ -3,7 +3,9 @@ use crate::cli; pub fn cli() -> App { - subcommand("version").about("Show version information") + subcommand("version") + .about("Show version information") + .arg(opt("quiet", "No output printed to stdout").short("q")) } pub fn exec(_config: &mut Config, args: &ArgMatches<'_>) -> CliResult { diff -Nru cargo-0.35.0/src/bin/cargo/commands/yank.rs cargo-0.37.0/src/bin/cargo/commands/yank.rs --- cargo-0.35.0/src/bin/cargo/commands/yank.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/commands/yank.rs 2019-05-15 19:48:47.000000000 +0000 @@ -5,6 +5,7 @@ pub fn cli() -> App { subcommand("yank") .about("Remove a pushed crate from the index") + .arg(opt("quiet", "No output printed to stdout").short("q")) .arg(Arg::with_name("crate")) .arg(opt("vers", "The version to yank or un-yank").value_name("VERSION")) .arg(opt( diff -Nru cargo-0.35.0/src/bin/cargo/main.rs cargo-0.37.0/src/bin/cargo/main.rs --- cargo-0.35.0/src/bin/cargo/main.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/bin/cargo/main.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,6 +1,8 @@ #![warn(rust_2018_idioms)] // while we're getting used to 2018 #![allow(clippy::too_many_arguments)] // large project #![allow(clippy::redundant_closure)] // there's a false positive +#![warn(clippy::needless_borrow)] +#![warn(clippy::redundant_clone)] use std::collections::BTreeSet; use std::env; @@ -18,9 +20,9 @@ fn main() { #[cfg(feature = "pretty-env-logger")] - pretty_env_logger::init(); + pretty_env_logger::init_custom_env("CARGO_LOG"); #[cfg(not(feature = "pretty-env-logger"))] - env_logger::init(); + env_logger::init_from_env("CARGO_LOG"); cargo::core::maybe_allow_nightly_features(); let mut config = match Config::default() { diff -Nru cargo-0.35.0/src/cargo/core/compiler/build_config.rs cargo-0.37.0/src/cargo/core/compiler/build_config.rs --- cargo-0.35.0/src/cargo/core/compiler/build_config.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/compiler/build_config.rs 2019-05-15 19:48:47.000000000 +0000 @@ -3,6 +3,7 @@ use serde::ser; +use crate::util::ProcessBuilder; use crate::util::{CargoResult, CargoResultExt, Config, RustfixDiagnosticServer}; /// Configuration information for a rustc build. @@ -23,12 +24,8 @@ pub force_rebuild: bool, /// Output a build plan to stdout instead of actually compiling. pub build_plan: bool, - /// Use Cargo itself as the wrapper around rustc, only used for `cargo fix`. - pub cargo_as_rustc_wrapper: bool, - /// Extra env vars to inject into rustc commands. - pub extra_rustc_env: Vec<(String, String)>, - /// Extra args to inject into rustc commands. - pub extra_rustc_args: Vec, + /// An optional wrapper, if any, used to wrap rustc invocations + pub rustc_wrapper: Option, pub rustfix_diagnostic_server: RefCell>, } @@ -65,7 +62,17 @@ failure::bail!("target was empty") } } - let cfg_target = config.get_string("build.target")?.map(|s| s.val); + let cfg_target = match config.get_string("build.target")? { + Some(ref target) if target.val.ends_with(".json") => { + let path = target.definition.root(config).join(&target.val); + let path_string = path + .into_os_string() + .into_string() + .map_err(|_| failure::format_err!("Target path is not valid unicode")); + Some(path_string?) + } + other => other.map(|t| t.val), + }; let target = requested_target.or(cfg_target); if jobs == Some(0) { @@ -88,9 +95,7 @@ message_format: MessageFormat::Human, force_rebuild: false, build_plan: false, - cargo_as_rustc_wrapper: false, - extra_rustc_env: Vec::new(), - extra_rustc_args: Vec::new(), + rustc_wrapper: None, rustfix_diagnostic_server: RefCell::new(None), }) } diff -Nru cargo-0.35.0/src/cargo/core/compiler/build_context/mod.rs cargo-0.37.0/src/cargo/core/compiler/build_context/mod.rs --- cargo-0.35.0/src/cargo/core/compiler/build_context/mod.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/compiler/build_context/mod.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,17 +1,16 @@ use std::collections::HashMap; -use std::env; use std::path::{Path, PathBuf}; use std::str; use log::debug; +use crate::core::compiler::unit::UnitInterner; +use crate::core::compiler::{BuildConfig, BuildOutput, Kind, Unit}; use crate::core::profiles::Profiles; use crate::core::{Dependency, Workspace}; use crate::core::{PackageId, PackageSet, Resolve}; use crate::util::errors::CargoResult; -use crate::util::{profile, Cfg, CfgExpr, Config, Rustc}; - -use super::{BuildConfig, BuildOutput, Kind, Unit}; +use crate::util::{profile, Cfg, Config, Rustc}; mod target_info; pub use self::target_info::{FileFlavor, TargetInfo}; @@ -38,6 +37,7 @@ pub target_config: TargetConfig, pub target_info: TargetInfo, pub host_info: TargetInfo, + pub units: &'a UnitInterner<'a>, } impl<'a, 'cfg> BuildContext<'a, 'cfg> { @@ -48,9 +48,14 @@ config: &'cfg Config, build_config: &'a BuildConfig, profiles: &'a Profiles, + units: &'a UnitInterner<'a>, extra_compiler_args: HashMap, Vec>, ) -> CargoResult> { - let rustc = config.rustc(Some(ws))?; + let mut rustc = config.load_global_rustc(Some(ws))?; + if let Some(wrapper) = &build_config.rustc_wrapper { + rustc.set_wrapper(wrapper.clone()); + } + let host_config = TargetConfig::new(config, &rustc.host)?; let target_config = match build_config.requested_target.as_ref() { Some(triple) => TargetConfig::new(config, triple)?, @@ -79,6 +84,7 @@ build_config, profiles, extra_compiler_args, + units, }) } @@ -87,6 +93,11 @@ .extern_crate_name(unit.pkg.package_id(), dep.pkg.package_id(), dep.target) } + pub fn is_public_dependency(&self, unit: &Unit<'a>, dep: &Unit<'a>) -> bool { + self.resolve + .is_public_dep(unit.pkg.package_id(), dep.pkg.package_id()) + } + /// Whether a dependency should be compiled for the host or target platform, /// specified by `Kind`. pub fn dep_platform_activated(&self, dep: &Dependency, kind: Kind) -> bool { @@ -153,26 +164,12 @@ self.build_config.jobs } - pub fn rustflags_args(&self, unit: &Unit<'_>) -> CargoResult> { - env_args( - self.config, - &self.build_config.requested_target, - self.host_triple(), - self.info(unit.kind).cfg(), - unit.kind, - "RUSTFLAGS", - ) - } - - pub fn rustdocflags_args(&self, unit: &Unit<'_>) -> CargoResult> { - env_args( - self.config, - &self.build_config.requested_target, - self.host_triple(), - self.info(unit.kind).cfg(), - unit.kind, - "RUSTDOCFLAGS", - ) + pub fn rustflags_args(&self, unit: &Unit<'_>) -> &[String] { + &self.info(unit.kind).rustflags + } + + pub fn rustdocflags_args(&self, unit: &Unit<'_>) -> &[String] { + &self.info(unit.kind).rustdocflags } pub fn show_warnings(&self, pkg: PackageId) -> bool { @@ -223,6 +220,7 @@ let mut output = BuildOutput { library_paths: Vec::new(), library_links: Vec::new(), + linker_args: Vec::new(), cfgs: Vec::new(), env: Vec::new(), metadata: Vec::new(), @@ -258,6 +256,10 @@ .library_paths .extend(list.iter().map(|v| PathBuf::from(&v.0))); } + "rustc-cdylib-link-arg" => { + let args = value.list(k)?; + output.linker_args.extend(args.iter().map(|v| v.0.clone())); + } "rustc-cfg" => { let list = value.list(k)?; output.cfgs.extend(list.iter().map(|v| v.0.clone())); @@ -283,124 +285,3 @@ Ok(ret) } } - -/// Acquire extra flags to pass to the compiler from various locations. -/// -/// The locations are: -/// -/// - the `RUSTFLAGS` environment variable -/// -/// then if this was not found -/// -/// - `target.*.rustflags` from the manifest (Cargo.toml) -/// - `target.cfg(..).rustflags` from the manifest -/// -/// then if neither of these were found -/// -/// - `build.rustflags` from the manifest -/// -/// Note that if a `target` is specified, no args will be passed to host code (plugins, build -/// scripts, ...), even if it is the same as the target. -fn env_args( - config: &Config, - requested_target: &Option, - host_triple: &str, - target_cfg: Option<&[Cfg]>, - kind: Kind, - name: &str, -) -> CargoResult> { - // We *want* to apply RUSTFLAGS only to builds for the - // requested target architecture, and not to things like build - // scripts and plugins, which may be for an entirely different - // architecture. Cargo's present architecture makes it quite - // hard to only apply flags to things that are not build - // scripts and plugins though, so we do something more hacky - // instead to avoid applying the same RUSTFLAGS to multiple targets - // arches: - // - // 1) If --target is not specified we just apply RUSTFLAGS to - // all builds; they are all going to have the same target. - // - // 2) If --target *is* specified then we only apply RUSTFLAGS - // to compilation units with the Target kind, which indicates - // it was chosen by the --target flag. - // - // This means that, e.g., even if the specified --target is the - // same as the host, build scripts in plugins won't get - // RUSTFLAGS. - let compiling_with_target = requested_target.is_some(); - let is_target_kind = kind == Kind::Target; - - if compiling_with_target && !is_target_kind { - // This is probably a build script or plugin and we're - // compiling with --target. In this scenario there are - // no rustflags we can apply. - return Ok(Vec::new()); - } - - // First try RUSTFLAGS from the environment - if let Ok(a) = env::var(name) { - let args = a - .split(' ') - .map(str::trim) - .filter(|s| !s.is_empty()) - .map(str::to_string); - return Ok(args.collect()); - } - - let mut rustflags = Vec::new(); - - let name = name - .chars() - .flat_map(|c| c.to_lowercase()) - .collect::(); - // Then the target.*.rustflags value... - let target = requested_target - .as_ref() - .map(|s| s.as_str()) - .unwrap_or(host_triple); - let key = format!("target.{}.{}", target, name); - if let Some(args) = config.get_list_or_split_string(&key)? { - let args = args.val.into_iter(); - rustflags.extend(args); - } - // ...including target.'cfg(...)'.rustflags - if let Some(target_cfg) = target_cfg { - if let Some(table) = config.get_table("target")? { - let cfgs = table - .val - .keys() - .filter(|key| CfgExpr::matches_key(key, target_cfg)); - - // Note that we may have multiple matching `[target]` sections and - // because we're passing flags to the compiler this can affect - // cargo's caching and whether it rebuilds. Ensure a deterministic - // ordering through sorting for now. We may perhaps one day wish to - // ensure a deterministic ordering via the order keys were defined - // in files perhaps. - let mut cfgs = cfgs.collect::>(); - cfgs.sort(); - - for n in cfgs { - let key = format!("target.{}.{}", n, name); - if let Some(args) = config.get_list_or_split_string(&key)? { - let args = args.val.into_iter(); - rustflags.extend(args); - } - } - } - } - - if !rustflags.is_empty() { - return Ok(rustflags); - } - - // Then the `build.rustflags` value. - let key = format!("build.{}", name); - if let Some(args) = config.get_list_or_split_string(&key)? { - let args = args.val.into_iter(); - return Ok(args.collect()); - } - - Ok(Vec::new()) -} diff -Nru cargo-0.35.0/src/cargo/core/compiler/build_context/target_info.rs cargo-0.37.0/src/cargo/core/compiler/build_context/target_info.rs --- cargo-0.35.0/src/cargo/core/compiler/build_context/target_info.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/compiler/build_context/target_info.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,11 +1,12 @@ use std::cell::RefCell; use std::collections::hash_map::{Entry, HashMap}; +use std::env; use std::path::PathBuf; use std::str::{self, FromStr}; -use super::env_args; -use super::Kind; +use crate::core::compiler::Kind; use crate::core::TargetKind; +use crate::util::CfgExpr; use crate::util::{CargoResult, CargoResultExt, Cfg, Config, ProcessBuilder, Rustc}; #[derive(Clone)] @@ -14,15 +15,17 @@ crate_types: RefCell>>, cfg: Option>, pub sysroot_libdir: Option, + pub rustflags: Vec, + pub rustdocflags: Vec, } /// Type of each file generated by a Unit. -#[derive(Copy, Clone, PartialEq, Eq, Debug)] +#[derive(Clone, PartialEq, Eq, Debug)] pub enum FileFlavor { /// Not a special file type. Normal, /// Something you can link against (e.g., a library). - Linkable, + Linkable { rmeta: bool }, /// Piece of external debug information (e.g., `.dSYM`/`.pdb` file). DebugInfo, } @@ -72,7 +75,7 @@ .arg("___") .arg("--print=file-names") .args(&rustflags) - .env_remove("RUST_LOG"); + .env_remove("RUSTC_LOG"); let target_triple = requested_target .as_ref() @@ -136,7 +139,7 @@ } let cfg = if has_cfg_and_sysroot { - Some(lines.map(Cfg::from_str).collect::>()?) + Some(lines.map(Cfg::from_str).collect::>>()?) } else { None }; @@ -144,8 +147,26 @@ Ok(TargetInfo { crate_type_process: Some(crate_type_process), crate_types: RefCell::new(map), - cfg, sysroot_libdir, + // recalculate `rustflags` from above now that we have `cfg` + // information + rustflags: env_args( + config, + requested_target, + &rustc.host, + cfg.as_ref().map(|v| v.as_ref()), + kind, + "RUSTFLAGS", + )?, + rustdocflags: env_args( + config, + requested_target, + &rustc.host, + cfg.as_ref().map(|v| v.as_ref()), + kind, + "RUSTDOCFLAGS", + )?, + cfg, }) } @@ -204,12 +225,16 @@ } // See rust-lang/cargo#4490, rust-lang/cargo#4960. - // - Only uplift debuginfo for binaries. - // Tests are run directly from `target/debug/deps/` - // and examples are inside target/debug/examples/ which already have symbols next to them, - // so no need to do anything. - if *kind == TargetKind::Bin { - if target_triple.contains("-apple-") { + // Only uplift debuginfo for binaries. + // - Tests are run directly from `target/debug/deps/` with the + // metadata hash still in the filename. + // - Examples are only uplifted for apple because the symbol file + // needs to match the executable file name to be found (i.e., it + // needs to remove the hash in the filename). On Windows, the path + // to the .pdb with the hash is embedded in the executable. + let is_apple = target_triple.contains("-apple-"); + if *kind == TargetKind::Bin || (*kind == TargetKind::ExampleBin && is_apple) { + if is_apple { ret.push(FileType { suffix: ".dSYM".to_string(), prefix: prefix.clone(), @@ -289,3 +314,124 @@ Ok(Some((prefix.to_string(), suffix.to_string()))) } + +/// Acquire extra flags to pass to the compiler from various locations. +/// +/// The locations are: +/// +/// - the `RUSTFLAGS` environment variable +/// +/// then if this was not found +/// +/// - `target.*.rustflags` from the manifest (Cargo.toml) +/// - `target.cfg(..).rustflags` from the manifest +/// +/// then if neither of these were found +/// +/// - `build.rustflags` from the manifest +/// +/// Note that if a `target` is specified, no args will be passed to host code (plugins, build +/// scripts, ...), even if it is the same as the target. +fn env_args( + config: &Config, + requested_target: &Option, + host_triple: &str, + target_cfg: Option<&[Cfg]>, + kind: Kind, + name: &str, +) -> CargoResult> { + // We *want* to apply RUSTFLAGS only to builds for the + // requested target architecture, and not to things like build + // scripts and plugins, which may be for an entirely different + // architecture. Cargo's present architecture makes it quite + // hard to only apply flags to things that are not build + // scripts and plugins though, so we do something more hacky + // instead to avoid applying the same RUSTFLAGS to multiple targets + // arches: + // + // 1) If --target is not specified we just apply RUSTFLAGS to + // all builds; they are all going to have the same target. + // + // 2) If --target *is* specified then we only apply RUSTFLAGS + // to compilation units with the Target kind, which indicates + // it was chosen by the --target flag. + // + // This means that, e.g., even if the specified --target is the + // same as the host, build scripts in plugins won't get + // RUSTFLAGS. + let compiling_with_target = requested_target.is_some(); + let is_target_kind = kind == Kind::Target; + + if compiling_with_target && !is_target_kind { + // This is probably a build script or plugin and we're + // compiling with --target. In this scenario there are + // no rustflags we can apply. + return Ok(Vec::new()); + } + + // First try RUSTFLAGS from the environment + if let Ok(a) = env::var(name) { + let args = a + .split(' ') + .map(str::trim) + .filter(|s| !s.is_empty()) + .map(str::to_string); + return Ok(args.collect()); + } + + let mut rustflags = Vec::new(); + + let name = name + .chars() + .flat_map(|c| c.to_lowercase()) + .collect::(); + // Then the target.*.rustflags value... + let target = requested_target + .as_ref() + .map(|s| s.as_str()) + .unwrap_or(host_triple); + let key = format!("target.{}.{}", target, name); + if let Some(args) = config.get_list_or_split_string(&key)? { + let args = args.val.into_iter(); + rustflags.extend(args); + } + // ...including target.'cfg(...)'.rustflags + if let Some(target_cfg) = target_cfg { + if let Some(table) = config.get_table("target")? { + let cfgs = table + .val + .keys() + .filter(|key| CfgExpr::matches_key(key, target_cfg)); + + // Note that we may have multiple matching `[target]` sections and + // because we're passing flags to the compiler this can affect + // cargo's caching and whether it rebuilds. Ensure a deterministic + // ordering through sorting for now. We may perhaps one day wish to + // ensure a deterministic ordering via the order keys were defined + // in files perhaps. + let mut cfgs = cfgs.collect::>(); + cfgs.sort(); + + for n in cfgs { + let key = format!("target.{}.{}", n, name); + if let Some(args) = config.get_list_or_split_string(&key)? { + let args = args.val.into_iter(); + rustflags.extend(args); + } + } + } + } + + if !rustflags.is_empty() { + return Ok(rustflags); + } + + // Then the `build.rustflags` value. + let key = format!("build.{}", name); + if let Some(args) = config.get_list_or_split_string(&key)? { + let args = args.val.into_iter(); + return Ok(args.collect()); + } + + Ok(Vec::new()) +} diff -Nru cargo-0.35.0/src/cargo/core/compiler/build_plan.rs cargo-0.37.0/src/cargo/core/compiler/build_plan.rs --- cargo-0.35.0/src/cargo/core/compiler/build_plan.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/compiler/build_plan.rs 2019-05-15 19:48:47.000000000 +0000 @@ -109,11 +109,11 @@ } } - pub fn add(&mut self, cx: &Context<'_, '_>, unit: &Unit<'_>) -> CargoResult<()> { + pub fn add<'a>(&mut self, cx: &Context<'a, '_>, unit: &Unit<'a>) -> CargoResult<()> { let id = self.plan.invocations.len(); self.invocation_map.insert(unit.buildkey(), id); let deps = cx - .dep_targets(&unit) + .dep_targets(unit) .iter() .map(|dep| self.invocation_map[&dep.buildkey()]) .collect(); diff -Nru cargo-0.35.0/src/cargo/core/compiler/compilation.rs cargo-0.37.0/src/cargo/core/compiler/compilation.rs --- cargo-0.35.0/src/cargo/core/compiler/compilation.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/compiler/compilation.rs 2019-05-15 19:48:47.000000000 +0000 @@ -6,7 +6,7 @@ use semver::Version; use super::BuildContext; -use crate::core::{Edition, Package, PackageId, Target, TargetKind}; +use crate::core::{Edition, Package, PackageId, Target}; use crate::util::{self, join_paths, process, CargoResult, CfgExpr, Config, ProcessBuilder}; pub struct Doctest { @@ -22,7 +22,7 @@ /// A structure returning the result of a compilation. pub struct Compilation<'cfg> { /// An array of all tests created during this compilation. - pub tests: Vec<(Package, TargetKind, String, PathBuf)>, + pub tests: Vec<(Package, Target, PathBuf)>, /// An array of all binaries created. pub binaries: Vec, @@ -75,29 +75,11 @@ impl<'cfg> Compilation<'cfg> { pub fn new<'a>(bcx: &BuildContext<'a, 'cfg>) -> CargoResult> { - // If we're using cargo as a rustc wrapper then we're in a situation - // like `cargo fix`. For now just disregard the `RUSTC_WRAPPER` env var - // (which is typically set to `sccache` for now). Eventually we'll - // probably want to implement `RUSTC_WRAPPER` for `cargo fix`, but we'll - // leave that open as a bug for now. - let mut rustc = if bcx.build_config.cargo_as_rustc_wrapper { - let mut rustc = bcx.rustc.process_no_wrapper(); - let prog = rustc.get_program().to_owned(); - rustc.env("RUSTC", prog); - rustc.program(env::current_exe()?); - rustc - } else { - bcx.rustc.process() - }; + let mut rustc = bcx.rustc.process(); + if bcx.config.extra_verbose() { rustc.display_env_vars(); } - for (k, v) in bcx.build_config.extra_rustc_env.iter() { - rustc.env(k, v); - } - for arg in bcx.build_config.extra_rustc_args.iter() { - rustc.arg(arg); - } let srv = bcx.build_config.rustfix_diagnostic_server.borrow(); if let Some(server) = &*srv { server.configure(&mut rustc); @@ -120,7 +102,7 @@ rustc_process: rustc, host: bcx.host_triple().to_string(), target: bcx.target_triple().to_string(), - target_runner: target_runner(&bcx)?, + target_runner: target_runner(bcx)?, }) } @@ -196,16 +178,17 @@ search_path }; - search_path.extend(util::dylib_path().into_iter()); - if cfg!(target_os = "macos") { + let dylib_path = util::dylib_path(); + let dylib_path_is_empty = dylib_path.is_empty(); + search_path.extend(dylib_path.into_iter()); + if cfg!(target_os = "macos") && dylib_path_is_empty { // These are the defaults when DYLD_FALLBACK_LIBRARY_PATH isn't - // set. Since Cargo is explicitly setting the value, make sure the - // defaults still work. - if let Ok(home) = env::var("HOME") { + // set or set to an empty string. Since Cargo is explicitly setting + // the value, make sure the defaults still work. + if let Some(home) = env::var_os("HOME") { search_path.push(PathBuf::from(home).join("lib")); } search_path.push(PathBuf::from("/usr/local/lib")); - search_path.push(PathBuf::from("/lib")); search_path.push(PathBuf::from("/usr/lib")); } let search_path = join_paths(&search_path, util::dylib_path_envvar())?; diff -Nru cargo-0.35.0/src/cargo/core/compiler/context/compilation_files.rs cargo-0.37.0/src/cargo/core/compiler/context/compilation_files.rs --- cargo-0.35.0/src/cargo/core/compiler/context/compilation_files.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/compiler/context/compilation_files.rs 2019-05-15 19:48:47.000000000 +0000 @@ -8,7 +8,8 @@ use lazycell::LazyCell; use log::info; -use super::{BuildContext, Context, FileFlavor, Kind, Layout, Unit}; +use super::{BuildContext, Context, FileFlavor, Kind, Layout}; +use crate::core::compiler::Unit; use crate::core::{TargetKind, Workspace}; use crate::util::{self, CargoResult}; @@ -166,8 +167,13 @@ } } - /// Returns the root of the build output tree. + /// Returns the root of the build output tree for the target pub fn target_root(&self) -> &Path { + self.target.as_ref().unwrap_or(&self.host).dest() + } + + /// Returns the root of the build output tree for the host + pub fn host_root(&self) -> &Path { self.host.dest() } @@ -186,7 +192,8 @@ self.layout(unit.kind).fingerprint().join(dir) } - /// Returns the appropriate directory layout for either a plugin or not. + /// Returns the directory where a compiled build script is stored. + /// `/path/to/target/{debug,release}/build/PKG-HASH` pub fn build_script_dir(&self, unit: &Unit<'a>) -> PathBuf { assert!(unit.target.is_custom_build()); assert!(!unit.mode.is_run_custom_build()); @@ -194,12 +201,20 @@ self.layout(Kind::Host).build().join(dir) } - /// Returns the appropriate directory layout for either a plugin or not. - pub fn build_script_out_dir(&self, unit: &Unit<'a>) -> PathBuf { + /// Returns the directory where information about running a build script + /// is stored. + /// `/path/to/target/{debug,release}/build/PKG-HASH` + pub fn build_script_run_dir(&self, unit: &Unit<'a>) -> PathBuf { assert!(unit.target.is_custom_build()); assert!(unit.mode.is_run_custom_build()); let dir = self.pkg_dir(unit); - self.layout(unit.kind).build().join(dir).join("out") + self.layout(unit.kind).build().join(dir) + } + + /// Returns the "OUT_DIR" directory for running a build script. + /// `/path/to/target/{debug,release}/build/PKG-HASH/out` + pub fn build_script_out_dir(&self, unit: &Unit<'a>) -> PathBuf { + self.build_script_run_dir(unit).join("out") } /// Returns the file stem for a given target/profile combo (with metadata). @@ -293,7 +308,7 @@ path, hardlink: None, export_path: None, - flavor: FileFlavor::Linkable, + flavor: FileFlavor::Linkable { rmeta: false }, }); } else { let mut add = |crate_type: &str, flavor: FileFlavor| -> CargoResult<()> { @@ -357,12 +372,21 @@ add( kind.crate_type(), if kind.linkable() { - FileFlavor::Linkable + FileFlavor::Linkable { rmeta: false } } else { FileFlavor::Normal }, )?; } + let path = out_dir.join(format!("lib{}.rmeta", file_stem)); + if !unit.target.requires_upstream_objects() { + ret.push(OutputFile { + path, + hardlink: None, + export_path: None, + flavor: FileFlavor::Linkable { rmeta: true }, + }); + } } } } @@ -435,7 +459,7 @@ if !(unit.mode.is_any_test() || unit.mode.is_check()) && (unit.target.is_dylib() || unit.target.is_cdylib() - || (unit.target.is_bin() && bcx.target_triple().starts_with("wasm32-"))) + || (unit.target.is_executable() && bcx.target_triple().starts_with("wasm32-"))) && unit.pkg.package_id().source_id().is_path() && __cargo_default_lib_metadata.is_err() { @@ -460,13 +484,6 @@ .stable_hash(bcx.ws.root()) .hash(&mut hasher); - // Add package properties which map to environment variables - // exposed by Cargo. - let manifest_metadata = unit.pkg.manifest().metadata(); - manifest_metadata.authors.hash(&mut hasher); - manifest_metadata.description.hash(&mut hasher); - manifest_metadata.homepage.hash(&mut hasher); - // Also mix in enabled features to our metadata. This'll ensure that // when changing feature sets each lib is separately cached. bcx.resolve @@ -489,7 +506,7 @@ // settings like debuginfo and whatnot. unit.profile.hash(&mut hasher); unit.mode.hash(&mut hasher); - if let Some(ref args) = bcx.extra_args_for(unit) { + if let Some(args) = bcx.extra_args_for(unit) { args.hash(&mut hasher); } @@ -497,9 +514,9 @@ // This helps when the target directory is a shared cache for projects with different cargo configs, // or if the user is experimenting with different rustflags manually. if unit.mode.is_doc() { - cx.bcx.rustdocflags_args(unit).ok().hash(&mut hasher); + cx.bcx.rustdocflags_args(unit).hash(&mut hasher); } else { - cx.bcx.rustflags_args(unit).ok().hash(&mut hasher); + cx.bcx.rustflags_args(unit).hash(&mut hasher); } // Artifacts compiled for the host should have a different metadata diff -Nru cargo-0.35.0/src/cargo/core/compiler/context/mod.rs cargo-0.37.0/src/cargo/core/compiler/context/mod.rs --- cargo-0.35.0/src/cargo/core/compiler/context/mod.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/compiler/context/mod.rs 2019-05-15 19:48:47.000000000 +0000 @@ -8,10 +8,10 @@ use jobserver::Client; use crate::core::compiler::compilation; -use crate::core::profiles::Profile; -use crate::core::{Package, PackageId, Resolve, Target}; +use crate::core::compiler::Unit; +use crate::core::{Package, PackageId, Resolve}; use crate::util::errors::{CargoResult, CargoResultExt}; -use crate::util::{internal, profile, short_hash, Config}; +use crate::util::{internal, profile, Config}; use super::build_plan::BuildPlan; use super::custom_build::{self, BuildDeps, BuildScripts, BuildState}; @@ -27,49 +27,6 @@ use self::compilation_files::CompilationFiles; pub use self::compilation_files::{Metadata, OutputFile}; -/// All information needed to define a unit. -/// -/// A unit is an object that has enough information so that cargo knows how to build it. -/// For example, if your package has dependencies, then every dependency will be built as a library -/// unit. If your package is a library, then it will be built as a library unit as well, or if it -/// is a binary with `main.rs`, then a binary will be output. There are also separate unit types -/// for `test`ing and `check`ing, amongst others. -/// -/// The unit also holds information about all possible metadata about the package in `pkg`. -/// -/// A unit needs to know extra information in addition to the type and root source file. For -/// example, it needs to know the target architecture (OS, chip arch etc.) and it needs to know -/// whether you want a debug or release build. There is enough information in this struct to figure -/// all that out. -#[derive(Clone, Copy, Eq, PartialEq, Hash, Debug, PartialOrd, Ord)] -pub struct Unit<'a> { - /// Information about available targets, which files to include/exclude, etc. Basically stuff in - /// `Cargo.toml`. - pub pkg: &'a Package, - /// Information about the specific target to build, out of the possible targets in `pkg`. Not - /// to be confused with *target-triple* (or *target architecture* ...), the target arch for a - /// build. - pub target: &'a Target, - /// The profile contains information about *how* the build should be run, including debug - /// level, etc. - pub profile: Profile, - /// Whether this compilation unit is for the host or target architecture. - /// - /// For example, when - /// cross compiling and using a custom build script, the build script needs to be compiled for - /// the host architecture so the host rustc can use it (when compiling to the target - /// architecture). - pub kind: Kind, - /// The "mode" this unit is being compiled for. See [`CompileMode`] for more details. - pub mode: CompileMode, -} - -impl<'a> Unit<'a> { - pub fn buildkey(&self) -> String { - format!("{}-{}", self.pkg.name(), short_hash(self)) - } -} - pub struct Context<'a, 'cfg: 'a> { pub bcx: &'a BuildContext<'a, 'cfg>, pub compilation: Compilation<'cfg>, @@ -85,6 +42,17 @@ unit_dependencies: HashMap, Vec>>, files: Option>, package_cache: HashMap, + + /// A flag indicating whether pipelining is enabled for this compilation + /// session. Pipelining largely only affects the edges of the dependency + /// graph that we generate at the end, and otherwise it's pretty + /// straightforward. + pipelining: bool, + + /// A set of units which are compiling rlibs and are expected to produce + /// metadata files in addition to the rlib itself. This is only filled in + /// when `pipelining` above is enabled. + rmeta_required: HashSet>, } impl<'a, 'cfg> Context<'a, 'cfg> { @@ -103,6 +71,12 @@ .chain_err(|| "failed to create jobserver")?, }; + let pipelining = bcx + .config + .get_bool("build.pipelining")? + .map(|t| t.val) + .unwrap_or(false); + Ok(Self { bcx, compilation: Compilation::new(bcx)?, @@ -119,6 +93,8 @@ unit_dependencies: HashMap::new(), files: None, package_cache: HashMap::new(), + rmeta_required: HashSet::new(), + pipelining, }) } @@ -167,11 +143,10 @@ if unit.mode == CompileMode::Test { self.compilation.tests.push(( unit.pkg.clone(), - unit.target.kind().clone(), - unit.target.name().to_string(), + unit.target.clone(), output.path.clone(), )); - } else if unit.target.is_bin() || unit.target.is_bin_example() { + } else if unit.target.is_executable() { self.compilation.binaries.push(bindst.clone()); } } @@ -239,12 +214,12 @@ .collect() }); } - let rustdocflags = self.bcx.rustdocflags_args(unit)?; + let rustdocflags = self.bcx.rustdocflags_args(unit); if !rustdocflags.is_empty() { self.compilation .rustdocflags .entry(unit.pkg.package_id()) - .or_insert(rustdocflags); + .or_insert(rustdocflags.to_vec()); } super::output_depinfo(&mut self, unit)?; @@ -277,7 +252,7 @@ continue; } - let is_binary = unit.target.is_bin() || unit.target.is_bin_example(); + let is_binary = unit.target.is_executable(); let is_test = unit.mode.is_any_test() && !unit.mode.is_check(); if is_binary || is_test { @@ -305,12 +280,7 @@ self.primary_packages .extend(units.iter().map(|u| u.pkg.package_id())); - build_unit_dependencies( - units, - self.bcx, - &mut self.unit_dependencies, - &mut self.package_cache, - )?; + build_unit_dependencies(self, units)?; let files = CompilationFiles::new( units, host_layout, @@ -381,9 +351,7 @@ return Vec::new(); } } - let mut deps = self.unit_dependencies[unit].clone(); - deps.sort(); - deps + self.unit_dependencies[unit].clone() } pub fn is_primary_package(&self, unit: &Unit<'a>) -> bool { @@ -431,9 +399,10 @@ path.display() ) }; - let suggestion = "Consider changing their names to be unique or compiling them separately.\n\ - This may become a hard error in the future; see \ - ."; + let suggestion = + "Consider changing their names to be unique or compiling them separately.\n\ + This may become a hard error in the future; see \ + ."; let report_collision = |unit: &Unit<'_>, other_unit: &Unit<'_>, path: &PathBuf| @@ -475,11 +444,11 @@ for unit in keys { for output in self.outputs(unit)?.iter() { if let Some(other_unit) = output_collisions.insert(output.path.clone(), unit) { - report_collision(unit, &other_unit, &output.path)?; + report_collision(unit, other_unit, &output.path)?; } if let Some(hardlink) = output.hardlink.as_ref() { if let Some(other_unit) = output_collisions.insert(hardlink.clone(), unit) { - report_collision(unit, &other_unit, hardlink)?; + report_collision(unit, other_unit, hardlink)?; } } if let Some(ref export_path) = output.export_path { @@ -489,7 +458,7 @@ {}\ The exported filenames should be unique.\n\ {}", - describe_collision(unit, &other_unit, &export_path), + describe_collision(unit, other_unit, export_path), suggestion ))?; } @@ -498,6 +467,27 @@ } Ok(()) } + + /// Returns whether when `parent` depends on `dep` if it only requires the + /// metadata file from `dep`. + pub fn only_requires_rmeta(&self, parent: &Unit<'a>, dep: &Unit<'a>) -> bool { + // this is only enabled when pipelining is enabled + self.pipelining + // We're only a candidate for requiring an `rmeta` file if we + // ourselves are building an rlib, + && !parent.target.requires_upstream_objects() + && parent.mode == CompileMode::Build + // Our dependency must also be built as an rlib, otherwise the + // object code must be useful in some fashion + && !dep.target.requires_upstream_objects() + && dep.mode == CompileMode::Build + } + + /// Returns whether when `unit` is built whether it should emit metadata as + /// well because some compilations rely on that. + pub fn rmeta_required(&self, unit: &Unit<'a>) -> bool { + self.rmeta_required.contains(unit) + } } #[derive(Default)] diff -Nru cargo-0.35.0/src/cargo/core/compiler/context/unit_dependencies.rs cargo-0.37.0/src/cargo/core/compiler/context/unit_dependencies.rs --- cargo-0.35.0/src/cargo/core/compiler/context/unit_dependencies.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/compiler/context/unit_dependencies.rs 2019-05-15 19:48:47.000000000 +0000 @@ -15,40 +15,35 @@ //! (for example, with and without tests), so we actually build a dependency //! graph of `Unit`s, which capture these properties. -use std::cell::RefCell; -use std::collections::{HashMap, HashSet}; - -use log::trace; - -use super::{BuildContext, CompileMode, Kind, Unit}; +use crate::core::compiler::Unit; +use crate::core::compiler::{BuildContext, CompileMode, Context, Kind}; use crate::core::dependency::Kind as DepKind; use crate::core::package::Downloads; use crate::core::profiles::UnitFor; use crate::core::{Package, PackageId, Target}; use crate::CargoResult; +use log::trace; +use std::collections::{HashMap, HashSet}; struct State<'a: 'tmp, 'cfg: 'a, 'tmp> { - bcx: &'tmp BuildContext<'a, 'cfg>, - deps: &'tmp mut HashMap, Vec>>, - pkgs: RefCell<&'tmp mut HashMap>, + cx: &'tmp mut Context<'a, 'cfg>, waiting_on_download: HashSet, downloads: Downloads<'a, 'cfg>, } pub fn build_unit_dependencies<'a, 'cfg>( + cx: &mut Context<'a, 'cfg>, roots: &[Unit<'a>], - bcx: &BuildContext<'a, 'cfg>, - deps: &mut HashMap, Vec>>, - pkgs: &mut HashMap, ) -> CargoResult<()> { - assert!(deps.is_empty(), "can only build unit deps once"); + assert!( + cx.unit_dependencies.is_empty(), + "can only build unit deps once" + ); let mut state = State { - bcx, - deps, - pkgs: RefCell::new(pkgs), + downloads: cx.bcx.packages.enable_download()?, + cx, waiting_on_download: HashSet::new(), - downloads: bcx.packages.enable_download()?, }; loop { @@ -61,7 +56,7 @@ // cleared, and avoid building the lib thrice (once with `panic`, once // without, once for `--test`). In particular, the lib included for // Doc tests and examples are `Build` mode here. - let unit_for = if unit.mode.is_any_test() || bcx.build_config.test() { + let unit_for = if unit.mode.is_any_test() || state.cx.bcx.build_config.test() { UnitFor::new_test() } else if unit.target.is_custom_build() { // This normally doesn't happen, except `clean` aggressively @@ -78,15 +73,26 @@ if !state.waiting_on_download.is_empty() { state.finish_some_downloads()?; - state.deps.clear(); + state.cx.unit_dependencies.clear(); } else { break; } } - trace!("ALL UNIT DEPENDENCIES {:#?}", state.deps); connect_run_custom_build_deps(&mut state); + trace!("ALL UNIT DEPENDENCIES {:#?}", state.cx.unit_dependencies); + + record_units_requiring_metadata(state.cx); + + // Dependencies are used in tons of places throughout the backend, many of + // which affect the determinism of the build itself. As a result be sure + // that dependency lists are always sorted to ensure we've always got a + // deterministic output. + for list in state.cx.unit_dependencies.values_mut() { + list.sort(); + } + Ok(()) } @@ -95,16 +101,16 @@ state: &mut State<'a, 'cfg, 'tmp>, unit_for: UnitFor, ) -> CargoResult<()> { - // Currently the `deps` map does not include `unit_for`. This should + // Currently the `unit_dependencies` map does not include `unit_for`. This should // be safe for now. `TestDependency` only exists to clear the `panic` // flag, and you'll never ask for a `unit` with `panic` set as a // `TestDependency`. `CustomBuild` should also be fine since if the // requested unit's settings are the same as `Any`, `CustomBuild` can't // affect anything else in the hierarchy. - if !state.deps.contains_key(unit) { + if !state.cx.unit_dependencies.contains_key(unit) { let unit_deps = compute_deps(unit, state, unit_for)?; let to_insert: Vec<_> = unit_deps.iter().map(|&(unit, _)| unit).collect(); - state.deps.insert(*unit, to_insert); + state.cx.unit_dependencies.insert(*unit, to_insert); for (unit, unit_for) in unit_deps { deps_of(&unit, state, unit_for)?; } @@ -122,13 +128,13 @@ unit_for: UnitFor, ) -> CargoResult, UnitFor)>> { if unit.mode.is_run_custom_build() { - return compute_deps_custom_build(unit, state.bcx); + return compute_deps_custom_build(unit, state.cx.bcx); } else if unit.mode.is_doc() && !unit.mode.is_any_test() { // Note: this does not include doc test. return compute_deps_doc(unit, state); } - let bcx = state.bcx; + let bcx = state.cx.bcx; let id = unit.pkg.package_id(); let deps = bcx.resolve.deps(id).filter(|&(_id, deps)| { assert!(!deps.is_empty()); @@ -286,7 +292,7 @@ unit: &Unit<'a>, state: &mut State<'a, 'cfg, 'tmp>, ) -> CargoResult, UnitFor)>> { - let bcx = state.bcx; + let bcx = state.cx.bcx; let deps = bcx .resolve .deps(unit.pkg.package_id()) @@ -342,7 +348,7 @@ fn maybe_lib<'a>( unit: &Unit<'a>, - bcx: &BuildContext<'_, '_>, + bcx: &BuildContext<'a, '_>, unit_for: UnitFor, ) -> Option<(Unit<'a>, UnitFor)> { unit.pkg.targets().iter().find(|t| t.linkable()).map(|t| { @@ -361,7 +367,7 @@ /// build script. fn dep_build_script<'a>( unit: &Unit<'a>, - bcx: &BuildContext<'_, '_>, + bcx: &BuildContext<'a, '_>, ) -> Option<(Unit<'a>, UnitFor)> { unit.pkg .targets() @@ -370,16 +376,15 @@ .map(|t| { // The profile stored in the Unit is the profile for the thing // the custom build script is running for. - ( - Unit { - pkg: unit.pkg, - target: t, - profile: bcx.profiles.get_profile_run_custom_build(&unit.profile), - kind: unit.kind, - mode: CompileMode::RunCustomBuild, - }, - UnitFor::new_build(), - ) + let unit = bcx.units.intern( + unit.pkg, + t, + bcx.profiles.get_profile_run_custom_build(&unit.profile), + unit.kind, + CompileMode::RunCustomBuild, + ); + + (unit, UnitFor::new_build()) }) } @@ -402,7 +407,7 @@ } fn new_unit<'a>( - bcx: &BuildContext<'_, '_>, + bcx: &BuildContext<'a, '_>, pkg: &'a Package, target: &'a Target, unit_for: UnitFor, @@ -416,13 +421,8 @@ mode, bcx.build_config.release, ); - Unit { - pkg, - target, - profile, - kind, - mode, - } + + bcx.units.intern(pkg, target, profile, kind, mode) } /// Fill in missing dependencies for units of the `RunCustomBuild` @@ -445,7 +445,7 @@ // have the build script as the key and the library would be in the // value's set. let mut reverse_deps = HashMap::new(); - for (unit, deps) in state.deps.iter() { + for (unit, deps) in state.cx.unit_dependencies.iter() { for dep in deps { if dep.mode == CompileMode::RunCustomBuild { reverse_deps @@ -466,7 +466,8 @@ // `dep_build_script` to manufacture an appropriate build script unit to // depend on. for unit in state - .deps + .cx + .unit_dependencies .keys() .filter(|k| k.mode == CompileMode::RunCustomBuild) { @@ -477,13 +478,13 @@ let to_add = reverse_deps .iter() - .flat_map(|reverse_dep| state.deps[reverse_dep].iter()) + .flat_map(|reverse_dep| state.cx.unit_dependencies[reverse_dep].iter()) .filter(|other| { other.pkg != unit.pkg && other.target.linkable() && other.pkg.manifest().links().is_some() }) - .filter_map(|other| dep_build_script(other, state.bcx).map(|p| p.0)) + .filter_map(|other| dep_build_script(other, state.cx.bcx).map(|p| p.0)) .collect::>(); if !to_add.is_empty() { @@ -494,21 +495,39 @@ // And finally, add in all the missing dependencies! for (unit, new_deps) in new_deps { - state.deps.get_mut(&unit).unwrap().extend(new_deps); + state + .cx + .unit_dependencies + .get_mut(&unit) + .unwrap() + .extend(new_deps); + } +} + +/// Records the list of units which are required to emit metadata. +/// +/// Units which depend only on the metadata of others requires the others to +/// actually produce metadata, so we'll record that here. +fn record_units_requiring_metadata(cx: &mut Context<'_, '_>) { + for (key, deps) in cx.unit_dependencies.iter() { + for dep in deps { + if cx.only_requires_rmeta(key, dep) { + cx.rmeta_required.insert(*dep); + } + } } } impl<'a, 'cfg, 'tmp> State<'a, 'cfg, 'tmp> { fn get(&mut self, id: PackageId) -> CargoResult> { - let mut pkgs = self.pkgs.borrow_mut(); - if let Some(pkg) = pkgs.get(&id) { + if let Some(pkg) = self.cx.package_cache.get(&id) { return Ok(Some(pkg)); } if !self.waiting_on_download.insert(id) { return Ok(None); } if let Some(pkg) = self.downloads.start(id)? { - pkgs.insert(id, pkg); + self.cx.package_cache.insert(id, pkg); self.waiting_on_download.remove(&id); return Ok(Some(pkg)); } @@ -528,7 +547,7 @@ loop { let pkg = self.downloads.wait()?; self.waiting_on_download.remove(&pkg.package_id()); - self.pkgs.borrow_mut().insert(pkg.package_id(), pkg); + self.cx.package_cache.insert(pkg.package_id(), pkg); // Arbitrarily choose that 5 or more packages concurrently download // is a good enough number to "fill the network pipe". If we have diff -Nru cargo-0.35.0/src/cargo/core/compiler/custom_build.rs cargo-0.37.0/src/cargo/core/compiler/custom_build.rs --- cargo-0.35.0/src/cargo/core/compiler/custom_build.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/compiler/custom_build.rs 2019-05-15 19:48:47.000000000 +0000 @@ -5,13 +5,14 @@ use std::str; use std::sync::{Arc, Mutex}; +use crate::core::compiler::job_queue::JobState; use crate::core::PackageId; use crate::util::errors::{CargoResult, CargoResultExt}; -use crate::util::machine_message; +use crate::util::machine_message::{self, Message}; +use crate::util::Cfg; use crate::util::{self, internal, paths, profile}; -use crate::util::{Cfg, Freshness}; -use super::job::Work; +use super::job::{Freshness, Job, Work}; use super::{fingerprint, Context, Kind, TargetConfig, Unit}; /// Contains the parsed output of a custom build script. @@ -21,6 +22,8 @@ pub library_paths: Vec, /// Names and link kinds of libraries, suitable for the `-l` flag. pub library_links: Vec, + /// Linker arguments suitable to be passed to `-C link-arg=` + pub linker_args: Vec, /// Various `--cfg` flags to pass to the compiler. pub cfgs: Vec, /// Additional environment variables to run the compiler with. @@ -65,6 +68,7 @@ pub plugins: BTreeSet, } +#[derive(Debug)] pub struct BuildDeps { pub build_script_output: PathBuf, pub rerun_if_changed: Vec, @@ -77,10 +81,7 @@ /// prepare work for. If the requirement is specified as both the target and the /// host platforms it is assumed that the two are equal and the build script is /// only run once (not twice). -pub fn prepare<'a, 'cfg>( - cx: &mut Context<'a, 'cfg>, - unit: &Unit<'a>, -) -> CargoResult<(Work, Work, Freshness)> { +pub fn prepare<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) -> CargoResult { let _p = profile::start(format!( "build script prepare: {}/{}", unit.pkg, @@ -88,41 +89,32 @@ )); let key = (unit.pkg.package_id(), unit.kind); - let overridden = cx.build_script_overridden.contains(&key); - let (work_dirty, work_fresh) = if overridden { - (Work::noop(), Work::noop()) - } else { - build_work(cx, unit)? - }; - if cx.bcx.build_config.build_plan { - Ok((work_dirty, work_fresh, Freshness::Dirty)) + if cx.build_script_overridden.contains(&key) { + fingerprint::prepare_target(cx, unit, false) } else { - // Now that we've prep'd our work, build the work needed to manage the - // fingerprint and then start returning that upwards. - let (freshness, dirty, fresh) = fingerprint::prepare_build_cmd(cx, unit)?; - - Ok((work_dirty.then(dirty), work_fresh.then(fresh), freshness)) + build_work(cx, unit) } } -fn emit_build_output(output: &BuildOutput, package_id: PackageId) { +fn emit_build_output(state: &JobState<'_>, output: &BuildOutput, package_id: PackageId) { let library_paths = output .library_paths .iter() .map(|l| l.display().to_string()) .collect::>(); - machine_message::emit(&machine_message::BuildScript { + let msg = machine_message::BuildScript { package_id, linked_libs: &output.library_links, linked_paths: &library_paths, cfgs: &output.cfgs, env: &output.env, - }); + }.to_json_string(); + state.stdout(&msg); } -fn build_work<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) -> CargoResult<(Work, Work)> { +fn build_work<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) -> CargoResult { assert!(unit.mode.is_run_custom_build()); let bcx = &cx.bcx; let dependencies = cx.dep_targets(unit); @@ -132,6 +124,7 @@ .expect("running a script not depending on an actual script"); let script_dir = cx.files().build_script_dir(build_script_unit); let script_out_dir = cx.files().build_script_out_dir(unit); + let script_run_dir = cx.files().build_script_run_dir(unit); let build_plan = bcx.build_config.build_plan; let invocation_name = unit.buildkey(); @@ -158,7 +151,7 @@ .env( "TARGET", &match unit.kind { - Kind::Host => &bcx.host_triple(), + Kind::Host => bcx.host_triple(), Kind::Target => bcx.target_triple(), }, ) @@ -241,14 +234,10 @@ let pkg_name = unit.pkg.to_string(); let build_state = Arc::clone(&cx.build_state); let id = unit.pkg.package_id(); - let (output_file, err_file, root_output_file) = { - let build_output_parent = script_out_dir.parent().unwrap(); - let output_file = build_output_parent.join("output"); - let err_file = build_output_parent.join("stderr"); - let root_output_file = build_output_parent.join("root-output"); - (output_file, err_file, root_output_file) - }; - let host_target_root = cx.files().target_root().to_path_buf(); + let output_file = script_run_dir.join("output"); + let err_file = script_run_dir.join("stderr"); + let root_output_file = script_run_dir.join("root-output"); + let host_target_root = cx.files().host_root().to_path_buf(); let all = ( id, pkg_name.clone(), @@ -260,22 +249,7 @@ let kind = unit.kind; let json_messages = bcx.build_config.json_messages(); let extra_verbose = bcx.config.extra_verbose(); - - // Check to see if the build script has already run, and if it has, keep - // track of whether it has told us about some explicit dependencies. - let prev_script_out_dir = paths::read_bytes(&root_output_file) - .and_then(|bytes| util::bytes2path(&bytes)) - .unwrap_or_else(|_| script_out_dir.clone()); - - let prev_output = BuildOutput::parse_file( - &output_file, - &pkg_name, - &prev_script_out_dir, - &script_out_dir, - ) - .ok(); - let deps = BuildDeps::new(&output_file, prev_output.as_ref()); - cx.build_explicit_deps.insert(*unit, deps); + let (prev_output, prev_script_out_dir) = prev_build_output(cx, unit); fs::create_dir_all(&script_dir)?; fs::create_dir_all(&script_out_dir)?; @@ -327,52 +301,58 @@ } } - // And now finally, run the build command itself! if build_plan { state.build_plan(invocation_name, cmd.clone(), Arc::new(Vec::new())); - } else { - state.running(&cmd); - let timestamp = paths::get_current_filesystem_time(&output_file)?; - let output = if extra_verbose { - let prefix = format!("[{} {}] ", id.name(), id.version()); - state.capture_output(&cmd, Some(prefix), true) - } else { - cmd.exec_with_output() - }; - let output = output.map_err(|e| { - failure::format_err!( - "failed to run custom build command for `{}`\n{}", - pkg_name, - e - ) - })?; + return Ok(()); + } - // After the build command has finished running, we need to be sure to - // remember all of its output so we can later discover precisely what it - // was, even if we don't run the build command again (due to freshness). - // - // This is also the location where we provide feedback into the build - // state informing what variables were discovered via our script as - // well. - paths::write(&output_file, &output.stdout)?; - filetime::set_file_times(output_file, timestamp, timestamp)?; - paths::write(&err_file, &output.stderr)?; - paths::write(&root_output_file, util::path2bytes(&script_out_dir)?)?; - let parsed_output = - BuildOutput::parse(&output.stdout, &pkg_name, &script_out_dir, &script_out_dir)?; + // And now finally, run the build command itself! + state.running(&cmd); + let timestamp = paths::set_invocation_time(&script_run_dir)?; + let prefix = format!("[{} {}] ", id.name(), id.version()); + let output = cmd + .exec_with_streaming( + &mut |stdout| { + if extra_verbose { + state.stdout(&format!("{}{}", prefix, stdout)); + } + Ok(()) + }, + &mut |stderr| { + if extra_verbose { + state.stderr(&format!("{}{}", prefix, stderr)); + } + Ok(()) + }, + true, + ) + .chain_err(|| format!("failed to run custom build command for `{}`", pkg_name))?; + + // After the build command has finished running, we need to be sure to + // remember all of its output so we can later discover precisely what it + // was, even if we don't run the build command again (due to freshness). + // + // This is also the location where we provide feedback into the build + // state informing what variables were discovered via our script as + // well. + paths::write(&output_file, &output.stdout)?; + filetime::set_file_times(output_file, timestamp, timestamp)?; + paths::write(&err_file, &output.stderr)?; + paths::write(&root_output_file, util::path2bytes(&script_out_dir)?)?; + let parsed_output = + BuildOutput::parse(&output.stdout, &pkg_name, &script_out_dir, &script_out_dir)?; - if json_messages { - emit_build_output(&parsed_output, id); - } - build_state.insert(id, kind, parsed_output); + if json_messages { + emit_build_output(state, &parsed_output, id); } + build_state.insert(id, kind, parsed_output); Ok(()) }); // Now that we've prepared our work-to-do, we need to prepare the fresh work // itself to run when we actually end up just discarding what we calculated // above. - let fresh = Work::new(move |_tx| { + let fresh = Work::new(move |state| { let (id, pkg_name, build_state, output_file, script_out_dir) = all; let output = match prev_output { Some(output) => output, @@ -385,14 +365,24 @@ }; if json_messages { - emit_build_output(&output, id); + emit_build_output(state, &output, id); } build_state.insert(id, kind, output); Ok(()) }); - Ok((dirty, fresh)) + let mut job = if cx.bcx.build_config.build_plan { + Job::new(Work::noop(), Freshness::Dirty) + } else { + fingerprint::prepare_target(cx, unit, false)? + }; + if job.freshness() == Freshness::Dirty { + job.before(dirty); + } else { + job.before(fresh); + } + Ok(job) } impl BuildState { @@ -440,6 +430,7 @@ ) -> CargoResult { let mut library_paths = Vec::new(); let mut library_links = Vec::new(); + let mut linker_args = Vec::new(); let mut cfgs = Vec::new(); let mut env = Vec::new(); let mut metadata = Vec::new(); @@ -487,6 +478,7 @@ } "rustc-link-lib" => library_links.push(value.to_string()), "rustc-link-search" => library_paths.push(PathBuf::from(value)), + "rustc-cdylib-link-arg" => linker_args.push(value.to_string()), "rustc-cfg" => cfgs.push(value.to_string()), "rustc-env" => env.push(BuildOutput::parse_rustc_env(&value, &whence)?), "warning" => warnings.push(value.to_string()), @@ -499,6 +491,7 @@ Ok(BuildOutput { library_paths, library_links, + linker_args, cfgs, env, metadata, @@ -634,22 +627,20 @@ return Ok(&out[unit]); } - { - let key = unit - .pkg - .manifest() - .links() - .map(|l| (l.to_string(), unit.kind)); - let build_state = &cx.build_state; - if let Some(output) = key.and_then(|k| build_state.overrides.get(&k)) { - let key = (unit.pkg.package_id(), unit.kind); - cx.build_script_overridden.insert(key); - build_state - .outputs - .lock() - .unwrap() - .insert(key, output.clone()); - } + let key = unit + .pkg + .manifest() + .links() + .map(|l| (l.to_string(), unit.kind)); + let build_state = &cx.build_state; + if let Some(output) = key.and_then(|k| build_state.overrides.get(&k)) { + let key = (unit.pkg.package_id(), unit.kind); + cx.build_script_overridden.insert(key); + build_state + .outputs + .lock() + .unwrap() + .insert(key, output.clone()); } let mut ret = BuildScripts::default(); @@ -658,6 +649,10 @@ add_to_link(&mut ret, unit.pkg.package_id(), unit.kind); } + if unit.mode.is_run_custom_build() { + parse_previous_explicit_deps(cx, unit)?; + } + // We want to invoke the compiler deterministically to be cache-friendly // to rustc invocation caching schemes, so be sure to generate the same // set of build script dependency orderings via sorting the targets that @@ -691,4 +686,46 @@ scripts.to_link.push((pkg, kind)); } } + + fn parse_previous_explicit_deps<'a, 'cfg>( + cx: &mut Context<'a, 'cfg>, + unit: &Unit<'a>, + ) -> CargoResult<()> { + let script_run_dir = cx.files().build_script_run_dir(unit); + let output_file = script_run_dir.join("output"); + let (prev_output, _) = prev_build_output(cx, unit); + let deps = BuildDeps::new(&output_file, prev_output.as_ref()); + cx.build_explicit_deps.insert(*unit, deps); + Ok(()) + } +} + +/// Returns the previous parsed `BuildOutput`, if any, from a previous +/// execution. +/// +/// Also returns the directory containing the output, typically used later in +/// processing. +fn prev_build_output<'a, 'cfg>( + cx: &mut Context<'a, 'cfg>, + unit: &Unit<'a>, +) -> (Option, PathBuf) { + let script_out_dir = cx.files().build_script_out_dir(unit); + let script_run_dir = cx.files().build_script_run_dir(unit); + let root_output_file = script_run_dir.join("root-output"); + let output_file = script_run_dir.join("output"); + + let prev_script_out_dir = paths::read_bytes(&root_output_file) + .and_then(|bytes| util::bytes2path(&bytes)) + .unwrap_or_else(|_| script_out_dir.clone()); + + ( + BuildOutput::parse_file( + &output_file, + &unit.pkg.to_string(), + &prev_script_out_dir, + &script_out_dir, + ) + .ok(), + prev_script_out_dir, + ) } diff -Nru cargo-0.35.0/src/cargo/core/compiler/fingerprint.rs cargo-0.37.0/src/cargo/core/compiler/fingerprint.rs --- cargo-0.35.0/src/cargo/core/compiler/fingerprint.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/compiler/fingerprint.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,3 +1,193 @@ +//! # Fingerprints +//! +//! This module implements change-tracking so that Cargo can know whether or +//! not something needs to be recompiled. A Cargo `Unit` can be either "dirty" +//! (needs to be recompiled) or "fresh" (it does not need to be recompiled). +//! There are several mechanisms that influence a Unit's freshness: +//! +//! - The `Metadata` hash isolates each Unit on the filesystem by being +//! embedded in the filename. If something in the hash changes, then the +//! output files will be missing, and the Unit will be dirty (missing +//! outputs are considered "dirty"). +//! - The `Fingerprint` is another hash, saved to the filesystem in the +//! `.fingerprint` directory, that tracks information about the inputs to a +//! Unit. If any of the inputs changes from the last compilation, then the +//! Unit is considered dirty. A missing fingerprint (such as during the +//! first build) is also considered dirty. +//! - Whether or not input files are actually present. For example a build +//! script which says it depends on a nonexistent file `foo` is always rerun. +//! - Propagation throughout the dependency graph of file modification time +//! information, used to detect changes on the filesystem. Each `Fingerprint` +//! keeps track of what files it'll be processing, and when necessary it will +//! check the `mtime` of each file (last modification time) and compare it to +//! dependencies and output to see if files have been changed or if a change +//! needs to force recompiles of downstream dependencies. +//! +//! Note: Fingerprinting is not a perfect solution. Filesystem mtime tracking +//! is notoriously imprecise and problematic. Only a small part of the +//! environment is captured. This is a balance of performance, simplicity, and +//! completeness. Sandboxing, hashing file contents, tracking every file +//! access, environment variable, and network operation would ensure more +//! reliable and reproducible builds at the cost of being complex, slow, and +//! platform-dependent. +//! +//! ## Fingerprints and Metadata +//! +//! Fingerprints and Metadata are similar, and track some of the same things. +//! The Metadata contains information that is required to keep Units separate. +//! The Fingerprint includes additional information that should cause a +//! recompile, but it is desired to reuse the same filenames. Generally the +//! items in the Metadata do not need to be in the Fingerprint. A comparison +//! of what is tracked: +//! +//! Value | Fingerprint | Metadata +//! -------------------------------------------|-------------|---------- +//! rustc | ✓ | ✓ +//! Profile | ✓ | ✓ +//! `cargo rustc` extra args | ✓ | ✓ +//! CompileMode | ✓ | ✓ +//! Target Name | ✓ | ✓ +//! Target Kind (bin/lib/etc.) | ✓ | ✓ +//! Enabled Features | ✓ | ✓ +//! Immediate dependency’s hashes | ✓[^1] | ✓ +//! Target or Host mode | | ✓ +//! __CARGO_DEFAULT_LIB_METADATA[^4] | | ✓ +//! package_id | | ✓ +//! authors, description, homepage, repo | ✓ | +//! Target src path | ✓ | +//! Target path relative to ws | ✓ | +//! Target flags (test/bench/for_host/edition) | ✓ | +//! -C incremental=… flag | ✓ | +//! mtime of sources | ✓[^3] | +//! RUSTFLAGS/RUSTDOCFLAGS | ✓ | +//! +//! [^1]: Build script and bin dependencies are not included. +//! +//! [^3]: The mtime is only tracked for workspace members and path +//! dependencies. Git dependencies track the git revision. +//! +//! [^4]: `__CARGO_DEFAULT_LIB_METADATA` is set by rustbuild to embed the +//! release channel (bootstrap/stable/beta/nightly) in libstd. +//! +//! ## Fingerprint files +//! +//! Fingerprint information is stored in the +//! `target/{debug,release}/.fingerprint/` directory. Each Unit is stored in a +//! separate directory. Each Unit directory contains: +//! +//! - A file with a 16 hex-digit hash. This is the Fingerprint hash, used for +//! quick loading and comparison. +//! - A `.json` file that contains details about the Fingerprint. This is only +//! used to log details about *why* a fingerprint is considered dirty. +//! `CARGO_LOG=cargo::core::compiler::fingerprint=trace cargo build` can be +//! used to display this log information. +//! - A "dep-info" file which contains a list of source filenames for the +//! target. This is produced by reading the output of `rustc +//! --emit=dep-info` and packing it into a condensed format. Cargo uses this +//! to check the mtime of every file to see if any of them have changed. +//! - An `invoked.timestamp` file whose filesystem mtime is updated every time +//! the Unit is built. This is an experimental feature used for cleaning +//! unused artifacts. +//! +//! Note that some units are a little different. A Unit for *running* a build +//! script or for `rustdoc` does not have a dep-info file (it's not +//! applicable). Build script `invoked.timestamp` files are in the build +//! output directory. +//! +//! ## Fingerprint calculation +//! +//! After the list of Units has been calculated, the Units are added to the +//! `JobQueue`. As each one is added, the fingerprint is calculated, and the +//! dirty/fresh status is recorded. A closure is used to update the fingerprint +//! on-disk when the Unit successfully finishes. The closure will recompute the +//! Fingerprint based on the updated information. If the Unit fails to compile, +//! the fingerprint is not updated. +//! +//! Fingerprints are cached in the `Context`. This makes computing +//! Fingerprints faster, but also is necessary for properly updating +//! dependency information. Since a Fingerprint includes the Fingerprints of +//! all dependencies, when it is updated, by using `Arc` clones, it +//! automatically picks up the updates to its dependencies. +//! +//! ## Considerations for inclusion in a fingerprint +//! +//! Over time we've realized a few items which historically were included in +//! fingerprint hashings should not actually be included. Examples are: +//! +//! * Modification time values. We strive to never include a modification time +//! inside a `Fingerprint` to get hashed into an actual value. While +//! theoretically fine to do, in practice this causes issues with common +//! applications like Docker. Docker, after a layer is built, will zero out +//! the nanosecond part of all filesystem modification times. This means that +//! the actual modification time is different for all build artifacts, which +//! if we tracked the actual values of modification times would cause +//! unnecessary recompiles. To fix this we instead only track paths which are +//! relevant. These paths are checked dynamically to see if they're up to +//! date, and the modifiation time doesn't make its way into the fingerprint +//! hash. +//! +//! * Absolute path names. We strive to maintain a property where if you rename +//! a project directory Cargo will continue to preserve all build artifacts +//! and reuse the cache. This means that we can't ever hash an absolute path +//! name. Instead we always hash relative path names and the "root" is passed +//! in at runtime dynamically. Some of this is best effort, but the general +//! idea is that we assume all accesses within a crate stay within that +//! crate. +//! +//! These are pretty tricky to test for unfortunately, but we should have a good +//! test suite nowadays and lord knows Cargo gets enough testing in the wild! +//! +//! ## Build scripts +//! +//! The *running* of a build script (`CompileMode::RunCustomBuild`) is treated +//! significantly different than all other Unit kinds. It has its own function +//! for calculating the Fingerprint (`calculate_run_custom_build`) and has some +//! unique considerations. It does not track the same information as a normal +//! Unit. The information tracked depends on the `rerun-if-changed` and +//! `rerun-if-env-changed` statements produced by the build script. If the +//! script does not emit either of these statements, the Fingerprint runs in +//! "old style" mode where an mtime change of *any* file in the package will +//! cause the build script to be re-run. Otherwise, the fingerprint *only* +//! tracks the individual "rerun-if" items listed by the build script. +//! +//! The "rerun-if" statements from a *previous* build are stored in the build +//! output directory in a file called `output`. Cargo parses this file when +//! the Unit for that build script is prepared for the `JobQueue`. The +//! Fingerprint code can then use that information to compute the Fingerprint +//! and compare against the old fingerprint hash. +//! +//! Care must be taken with build script Fingerprints because the +//! `Fingerprint::local` value may be changed after the build script runs +//! (such as if the build script adds or removes "rerun-if" items). +//! +//! Another complication is if a build script is overridden. In that case, the +//! fingerprint is the hash of the output of the override. +//! +//! ## Special considerations +//! +//! Registry dependencies do not track the mtime of files. This is because +//! registry dependencies are not expected to change (if a new version is +//! used, the Package ID will change, causing a rebuild). Cargo currently +//! partially works with Docker caching. When a Docker image is built, it has +//! normal mtime information. However, when a step is cached, the nanosecond +//! portions of all files is zeroed out. Currently this works, but care must +//! be taken for situations like these. +//! +//! HFS on macOS only supports 1 second timestamps. This causes a significant +//! number of problems, particularly with Cargo's testsuite which does rapid +//! builds in succession. Other filesystems have various degrees of +//! resolution. +//! +//! Various weird filesystems (such as network filesystems) also can cause +//! complications. Network filesystems may track the time on the server +//! (except when the time is set manually such as with +//! `filetime::set_file_times`). Not all filesystems support modifying the +//! mtime. +//! +//! See the `A-rebuild-detection` flag on the issue tracker for more: +//! + +use std::collections::HashMap; use std::env; use std::fs; use std::hash::{self, Hasher}; @@ -5,54 +195,45 @@ use std::sync::{Arc, Mutex}; use std::time::SystemTime; +use failure::{bail, format_err}; use filetime::FileTime; use log::{debug, info}; use serde::de; use serde::ser; use serde::{Deserialize, Serialize}; -use crate::core::{Edition, Package}; +use crate::core::Package; use crate::util; use crate::util::errors::{CargoResult, CargoResultExt}; use crate::util::paths; -use crate::util::{internal, profile, Dirty, Fresh, Freshness}; +use crate::util::{internal, profile}; use super::custom_build::BuildDeps; -use super::job::Work; -use super::{BuildContext, Context, FileFlavor, Unit}; +use super::job::{ + Freshness::{Dirty, Fresh}, + Job, Work, +}; +use super::{BuildContext, Context, FileFlavor, Kind, Unit}; -/// A tuple result of the `prepare_foo` functions in this module. +/// Determines if a `unit` is up-to-date, and if not prepares necessary work to +/// update the persisted fingerprint. +/// +/// This function will inspect `unit`, calculate a fingerprint for it, and then +/// return an appropriate `Job` to run. The returned `Job` will be a noop if +/// `unit` is considered "fresh", or if it was previously built and cached. +/// Otherwise the `Job` returned will write out the true fingerprint to the +/// filesystem, to be executed after the unit's work has completed. /// -/// The first element of the triple is whether the target in question is -/// currently fresh or not, and the second two elements are work to perform when -/// the target is dirty or fresh, respectively. -/// -/// Both units of work are always generated because a fresh package may still be -/// rebuilt if some upstream dependency changes. -pub type Preparation = (Freshness, Work, Work); - -/// Prepare the necessary work for the fingerprint for a specific target. -/// -/// When dealing with fingerprints, cargo gets to choose what granularity -/// "freshness" is considered at. One option is considering freshness at the -/// package level. This means that if anything in a package changes, the entire -/// package is rebuilt, unconditionally. This simplicity comes at a cost, -/// however, in that test-only changes will cause libraries to be rebuilt, which -/// is quite unfortunate! -/// -/// The cost was deemed high enough that fingerprints are now calculated at the -/// layer of a target rather than a package. Each target can then be kept track -/// of separately and only rebuilt as necessary. This requires cargo to -/// understand what the inputs are to a target, so we drive rustc with the -/// --dep-info flag to learn about all input files to a unit of compilation. -/// -/// This function will calculate the fingerprint for a target and prepare the -/// work necessary to either write the fingerprint or copy over all fresh files -/// from the old directories to their new locations. +/// The `force` flag is a way to force the `Job` to be "dirty", or always +/// update the fingerprint. **Beware using this flag** because it does not +/// transitively propagate throughout the dependency graph, it only forces this +/// one unit which is very unlikely to be what you want unless you're +/// exclusively talking about top-level units. pub fn prepare_target<'a, 'cfg>( cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>, -) -> CargoResult { + force: bool, +) -> CargoResult { let _p = profile::start(format!( "fingerprint: {} / {}", unit.pkg.package_id(), @@ -64,6 +245,9 @@ debug!("fingerprint at: {}", loc.display()); + // Figure out if this unit is up to date. After calculating the fingerprint + // compare it to an old version, if any, and attempt to print diagnostic + // information about failed comparisons to aid in debugging. let fingerprint = calculate(cx, unit)?; let mtime_on_use = cx.bcx.config.cli_unstable().mtime_on_use; let compare = compare_old_fingerprint(&loc, &*fingerprint, mtime_on_use); @@ -88,65 +272,65 @@ source.verify(unit.pkg.package_id())?; } - let root = cx.files().out_dir(unit); - let missing_outputs = { - let t = FileTime::from_system_time(SystemTime::now()); - if unit.mode.is_doc() { - !root - .join(unit.target.crate_name()) - .join("index.html") - .exists() - } else { - match cx - .outputs(unit)? - .iter() - .filter(|output| output.flavor != FileFlavor::DebugInfo) - .find(|output| { - if output.path.exists() { - if mtime_on_use { - // update the mtime so other cleaners know we used it - let _ = filetime::set_file_times(&output.path, t, t); - } - false - } else { - true - } - }) { - None => false, - Some(output) => { - info!("missing output path {:?}", output.path); - true - } + if compare.is_ok() && !force { + return Ok(Job::new(Work::noop(), Fresh)); + } + + let write_fingerprint = if unit.mode.is_run_custom_build() { + // For build scripts the `local` field of the fingerprint may change + // while we're executing it. For example it could be in the legacy + // "consider everything a dependency mode" and then we switch to "deps + // are explicitly specified" mode. + // + // To handle this movement we need to regenerate the `local` field of a + // build script's fingerprint after it's executed. We do this by + // using the `build_script_local_fingerprints` function which returns a + // thunk we can invoke on a foreign thread to calculate this. + let state = Arc::clone(&cx.build_state); + let key = (unit.pkg.package_id(), unit.kind); + let (gen_local, _overridden) = build_script_local_fingerprints(cx, unit); + let output_path = cx.build_explicit_deps[unit].build_script_output.clone(); + Work::new(move |_| { + let outputs = state.outputs.lock().unwrap(); + let outputs = &outputs[&key]; + let deps = BuildDeps::new(&output_path, Some(outputs)); + + // FIXME: it's basically buggy that we pass `None` to `call_box` + // here. See documentation on `build_script_local_fingerprints` + // below for more information. Despite this just try to proceed and + // hobble along if it happens to return `Some`. + if let Some(new_local) = gen_local.call_box(&deps, None)? { + *fingerprint.local.lock().unwrap() = new_local; + *fingerprint.memoized_hash.lock().unwrap() = None; } - } + + write_fingerprint(&loc, &fingerprint) + }) + } else { + Work::new(move |_| write_fingerprint(&loc, &fingerprint)) }; - let allow_failure = bcx.extra_args_for(unit).is_some(); - let target_root = cx.files().target_root().to_path_buf(); - let write_fingerprint = Work::new(move |_| { - match fingerprint.update_local(&target_root) { - Ok(()) => {} - Err(..) if allow_failure => return Ok(()), - Err(e) => return Err(e), - } - write_fingerprint(&loc, &*fingerprint) - }); - - let fresh = compare.is_ok() && !missing_outputs; - Ok(( - if fresh { Fresh } else { Dirty }, - write_fingerprint, - Work::noop(), - )) -} - -/// A compilation unit dependency has a fingerprint that is comprised of: -/// * its package ID -/// * its extern crate name -/// * its calculated fingerprint for the dependency + Ok(Job::new(write_fingerprint, Dirty)) +} + +/// Dependency edge information for fingerprints. This is generated for each +/// unit in `dep_targets` and is stored in a `Fingerprint` below. +#[derive(Clone)] struct DepFingerprint { - pkg_id: String, + /// The hash of the package id that this dependency points to + pkg_id: u64, + /// The crate name we're using for this dependency, which if we change we'll + /// need to recompile! name: String, + /// Whether or not this dependency is flagged as a public dependency or not. + public: bool, + /// Whether or not this dependency is an rmeta dependency or a "full" + /// dependency. In the case of an rmeta dependency our dependency edge only + /// actually requires the rmeta from what we depend on, so when checking + /// mtime information all files other than the rmeta can be ignored. + only_requires_rmeta: bool, + /// The dependency's fingerprint we recursively point to, containing all the + /// other hash information we'd otherwise need. fingerprint: Arc, } @@ -173,17 +357,71 @@ /// graph. #[derive(Serialize, Deserialize)] pub struct Fingerprint { + /// Hash of the version of `rustc` used. rustc: u64, + /// Sorted list of cfg features enabled. features: String, + /// Hash of the `Target` struct, including the target name, + /// package-relative source path, edition, etc. target: u64, + /// Hash of the `Profile`, `CompileMode`, and any extra flags passed via + /// `cargo rustc` or `cargo rustdoc`. profile: u64, + /// Hash of the path to the base source file. This is relative to the + /// workspace root for path members, or absolute for other sources. path: u64, + /// Fingerprints of dependencies. deps: Vec, - local: Vec, - #[serde(skip_serializing, skip_deserializing)] + /// Information about the inputs that affect this Unit (such as source + /// file mtimes or build script environment variables). + local: Mutex>, + /// Cached hash of the `Fingerprint` struct. Used to improve performance + /// for hashing. + #[serde(skip)] memoized_hash: Mutex>, + /// RUSTFLAGS/RUSTDOCFLAGS environment variable value (or config value). rustflags: Vec, - edition: Edition, + /// Hash of some metadata from the manifest, such as "authors", or + /// "description", which are exposed as environment variables during + /// compilation. + metadata: u64, + /// Description of whether the filesystem status for this unit is up to date + /// or should be considered stale. + #[serde(skip)] + fs_status: FsStatus, + /// Files, relative to `target_root`, that are produced by the step that + /// this `Fingerprint` represents. This is used to detect when the whole + /// fingerprint is out of date if this is missing, or if previous + /// fingerprints output files are regenerated and look newer than this one. + #[serde(skip)] + outputs: Vec, +} + +/// Indication of the status on the filesystem for a particular unit. +enum FsStatus { + /// This unit is to be considered stale, even if hash information all + /// matches. The filesystem inputs have changed (or are missing) and the + /// unit needs to subsequently be recompiled. + Stale, + + /// This unit is up-to-date. All outputs and their corresponding mtime are + /// listed in the payload here for other dependencies to compare against. + UpToDate { mtimes: HashMap }, +} + +impl FsStatus { + fn up_to_date(&self) -> bool { + match self { + FsStatus::UpToDate { .. } => true, + FsStatus::Stale => false, + } + } +} + +impl Default for FsStatus { + fn default() -> FsStatus { + FsStatus::Stale + } } impl Serialize for DepFingerprint { @@ -191,7 +429,13 @@ where S: ser::Serializer, { - (&self.pkg_id, &self.name, &self.fingerprint.hash()).serialize(ser) + ( + &self.pkg_id, + &self.name, + &self.public, + &self.fingerprint.hash(), + ) + .serialize(ser) } } @@ -200,35 +444,144 @@ where D: de::Deserializer<'de>, { - let (pkg_id, name, hash) = <(String, String, u64)>::deserialize(d)?; + let (pkg_id, name, public, hash) = <(u64, String, bool, u64)>::deserialize(d)?; Ok(DepFingerprint { pkg_id, name, + public, fingerprint: Arc::new(Fingerprint { - local: vec![LocalFingerprint::Precalculated(String::new())], memoized_hash: Mutex::new(Some(hash)), ..Fingerprint::new() }), + // This field is never read since it's only used in + // `check_filesystem` which isn't used by fingerprints loaded from + // disk. + only_requires_rmeta: false, }) } } -#[derive(Serialize, Deserialize, Hash)] +/// A `LocalFingerprint` represents something that we use to detect direct +/// changes to a `Fingerprint`. +/// +/// This is where we track file information, env vars, etc. This +/// `LocalFingerprint` struct is hashed and if the hash changes will force a +/// recompile of any fingerprint it's included into. Note that the "local" +/// terminology comes from the fact that it only has to do with one crate, and +/// `Fingerprint` tracks the transitive propagation of fingerprint changes. +/// +/// Note that because this is hashed its contents are carefully managed. Like +/// mentioned in the above module docs, we don't want to hash absolute paths or +/// mtime information. +/// +/// Also note that a `LocalFingerprint` is used in `check_filesystem` to detect +/// when the filesystem contains stale information (based on mtime currently). +/// The paths here don't change much between compilations but they're used as +/// inputs when we probe the filesystem looking at information. +#[derive(Debug, Serialize, Deserialize, Hash)] enum LocalFingerprint { + /// This is a precalculated fingerprint which has an opaque string we just + /// hash as usual. This variant is primarily used for git/crates.io + /// dependencies where the source never changes so we can quickly conclude + /// that there's some string we can hash and it won't really change much. + /// + /// This is also used for build scripts with no `rerun-if-*` statements, but + /// that's overall a mistake and causes bugs in Cargo. We shouldn't use this + /// for build scripts. Precalculated(String), - MtimeBased(MtimeSlot, PathBuf), - EnvBased(String, Option), + + /// This is used for crate compilations. The `dep_info` file is a relative + /// path anchored at `target_root(...)` to the dep-info file that Cargo + /// generates (which is a custom serialization after parsing rustc's own + /// `dep-info` output). + /// + /// The `dep_info` file, when present, also lists a number of other files + /// for us to look at. If any of those files are newer than this file then + /// we need to recompile. + CheckDepInfo { dep_info: PathBuf }, + + /// This represents a nonempty set of `rerun-if-changed` annotations printed + /// out by a build script. The `output` file is a arelative file anchored at + /// `target_root(...)` which is the actual output of the build script. That + /// output has already been parsed and the paths printed out via + /// `rerun-if-changed` are listed in `paths`. The `paths` field is relative + /// to `pkg.root()` + /// + /// This is considered up-to-date if all of the `paths` are older than + /// `output`, otherwise we need to recompile. + RerunIfChanged { + output: PathBuf, + paths: Vec, + }, + + /// This represents a single `rerun-if-env-changed` annotation printed by a + /// build script. The exact env var and value are hashed here. There's no + /// filesystem dependence here, and if the values are changed the hash will + /// change forcing a recompile. + RerunIfEnvChanged { var: String, val: Option }, +} + +enum StaleFile { + Missing(PathBuf), + Changed { + reference: PathBuf, + reference_mtime: FileTime, + stale: PathBuf, + stale_mtime: FileTime, + }, } impl LocalFingerprint { - fn mtime(root: &Path, mtime: Option, path: &Path) -> LocalFingerprint { - let mtime = MtimeSlot(Mutex::new(mtime)); - assert!(path.is_absolute()); - let path = path.strip_prefix(root).unwrap_or(path); - LocalFingerprint::MtimeBased(mtime, path.to_path_buf()) + /// Checks dynamically at runtime if this `LocalFingerprint` has a stale + /// file. + /// + /// This will use the absolute root paths passed in if necessary to guide + /// file accesses. + fn find_stale_file( + &self, + pkg_root: &Path, + target_root: &Path, + ) -> CargoResult> { + match self { + // We need to parse `dep_info`, learn about all the files the crate + // depends on, and then see if any of them are newer than the + // dep_info file itself. If the `dep_info` file is missing then this + // unit has never been compiled! + LocalFingerprint::CheckDepInfo { dep_info } => { + let dep_info = target_root.join(dep_info); + if let Some(paths) = parse_dep_info(pkg_root, &dep_info)? { + Ok(find_stale_file(&dep_info, paths.iter())) + } else { + Ok(Some(StaleFile::Missing(dep_info))) + } + } + + // We need to verify that no paths listed in `paths` are newer than + // the `output` path itself, or the last time the build script ran. + LocalFingerprint::RerunIfChanged { output, paths } => Ok(find_stale_file( + &target_root.join(output), + paths.iter().map(|p| pkg_root.join(p)), + )), + + // These have no dependencies on the filesystem, and their values + // are included natively in the `Fingerprint` hash so nothing + // tocheck for here. + LocalFingerprint::RerunIfEnvChanged { .. } => Ok(None), + LocalFingerprint::Precalculated(..) => Ok(None), + } + } + + fn kind(&self) -> &'static str { + match self { + LocalFingerprint::Precalculated(..) => "precalculated", + LocalFingerprint::CheckDepInfo { .. } => "dep-info", + LocalFingerprint::RerunIfChanged { .. } => "rerun-if-changed", + LocalFingerprint::RerunIfEnvChanged { .. } => "rerun-if-env-changed", + } } } +#[derive(Debug)] struct MtimeSlot(Mutex>); impl Fingerprint { @@ -240,29 +593,15 @@ path: 0, features: String::new(), deps: Vec::new(), - local: Vec::new(), + local: Mutex::new(Vec::new()), memoized_hash: Mutex::new(None), - edition: Edition::Edition2015, rustflags: Vec::new(), + metadata: 0, + fs_status: FsStatus::Stale, + outputs: Vec::new(), } } - fn update_local(&self, root: &Path) -> CargoResult<()> { - for local in self.local.iter() { - match *local { - LocalFingerprint::MtimeBased(ref slot, ref path) => { - let path = root.join(path); - let mtime = paths::mtime(&path)?; - *slot.0.lock().unwrap() = Some(mtime); - } - LocalFingerprint::EnvBased(..) | LocalFingerprint::Precalculated(..) => continue, - } - } - - *self.memoized_hash.lock().unwrap() = None; - Ok(()) - } - fn hash(&self) -> u64 { if let Some(s) = *self.memoized_hash.lock().unwrap() { return s; @@ -272,78 +611,94 @@ ret } + /// Compares this fingerprint with an old version which was previously + /// serialized to filesystem. + /// + /// The purpose of this is exclusively to produce a diagnostic message + /// indicating why we're recompiling something. This function always returns + /// an error, it will never return success. fn compare(&self, old: &Fingerprint) -> CargoResult<()> { if self.rustc != old.rustc { - failure::bail!("rust compiler has changed") + bail!("rust compiler has changed") } if self.features != old.features { - failure::bail!( + bail!( "features have changed: {} != {}", self.features, old.features ) } if self.target != old.target { - failure::bail!("target configuration has changed") + bail!("target configuration has changed") } if self.path != old.path { - failure::bail!("path to the compiler has changed") + bail!("path to the compiler has changed") } if self.profile != old.profile { - failure::bail!("profile configuration has changed") + bail!("profile configuration has changed") } if self.rustflags != old.rustflags { - failure::bail!("RUSTFLAGS has changed") + bail!("RUSTFLAGS has changed") } - if self.local.len() != old.local.len() { - failure::bail!("local lens changed"); + if self.metadata != old.metadata { + bail!("metadata changed") } - if self.edition != old.edition { - failure::bail!("edition changed") + let my_local = self.local.lock().unwrap(); + let old_local = old.local.lock().unwrap(); + if my_local.len() != old_local.len() { + bail!("local lens changed"); } - for (new, old) in self.local.iter().zip(&old.local) { + for (new, old) in my_local.iter().zip(old_local.iter()) { match (new, old) { + (LocalFingerprint::Precalculated(a), LocalFingerprint::Precalculated(b)) => { + if a != b { + bail!("precalculated components have changed: {} != {}", a, b) + } + } ( - &LocalFingerprint::Precalculated(ref a), - &LocalFingerprint::Precalculated(ref b), + LocalFingerprint::CheckDepInfo { dep_info: adep }, + LocalFingerprint::CheckDepInfo { dep_info: bdep }, ) => { - if a != b { - failure::bail!("precalculated components have changed: {} != {}", a, b) + if adep != bdep { + bail!("dep info output changed: {:?} != {:?}", adep, bdep) } } ( - &LocalFingerprint::MtimeBased(ref on_disk_mtime, ref ap), - &LocalFingerprint::MtimeBased(ref previously_built_mtime, ref bp), + LocalFingerprint::RerunIfChanged { + output: aout, + paths: apaths, + }, + LocalFingerprint::RerunIfChanged { + output: bout, + paths: bpaths, + }, ) => { - let on_disk_mtime = on_disk_mtime.0.lock().unwrap(); - let previously_built_mtime = previously_built_mtime.0.lock().unwrap(); - - let should_rebuild = match (*on_disk_mtime, *previously_built_mtime) { - (None, None) => false, - (Some(_), None) | (None, Some(_)) => true, - (Some(on_disk), Some(previously_built)) => on_disk > previously_built, - }; - - if should_rebuild { - failure::bail!( - "mtime based components have changed: previously {:?} now {:?}, \ - paths are {:?} and {:?}", - *previously_built_mtime, - *on_disk_mtime, - ap, - bp + if aout != bout { + bail!("rerun-if-changed output changed: {:?} != {:?}", aout, bout) + } + if apaths != bpaths { + bail!( + "rerun-if-changed output changed: {:?} != {:?}", + apaths, + bpaths, ) } } ( - &LocalFingerprint::EnvBased(ref akey, ref avalue), - &LocalFingerprint::EnvBased(ref bkey, ref bvalue), + LocalFingerprint::RerunIfEnvChanged { + var: akey, + val: avalue, + }, + LocalFingerprint::RerunIfEnvChanged { + var: bkey, + val: bvalue, + }, ) => { if *akey != *bkey { - failure::bail!("env vars changed: {} != {}", akey, bkey); + bail!("env vars changed: {} != {}", akey, bkey); } if *avalue != *bvalue { - failure::bail!( + bail!( "env var `{}` changed: previously {:?} now {:?}", akey, bvalue, @@ -351,18 +706,158 @@ ) } } - _ => failure::bail!("local fingerprint type has changed"), + (a, b) => bail!( + "local fingerprint type has changed ({} => {})", + b.kind(), + a.kind() + ), } } if self.deps.len() != old.deps.len() { - failure::bail!("number of dependencies has changed") + bail!("number of dependencies has changed") } for (a, b) in self.deps.iter().zip(old.deps.iter()) { - if a.name != b.name || a.fingerprint.hash() != b.fingerprint.hash() { - failure::bail!("new ({}) != old ({})", a.pkg_id, b.pkg_id) + if a.name != b.name { + let e = format_err!("`{}` != `{}`", a.name, b.name) + .context("unit dependency name changed"); + return Err(e.into()); + } + + if a.fingerprint.hash() != b.fingerprint.hash() { + let e = format_err!( + "new ({}/{:x}) != old ({}/{:x})", + a.name, + a.fingerprint.hash(), + b.name, + b.fingerprint.hash() + ) + .context("unit dependency information changed"); + return Err(e.into()); + } + } + + if !self.fs_status.up_to_date() { + bail!("current filesystem status shows we're outdated"); + } + + // This typically means some filesystem modifications happened or + // something transitive was odd. In general we should strive to provide + // a better error message than this, so if you see this message a lot it + // likely means this method needs to be updated! + bail!("two fingerprint comparison turned up nothing obvious"); + } + + /// Dynamically inspect the local filesystem to update the `fs_status` field + /// of this `Fingerprint`. + /// + /// This function is used just after a `Fingerprint` is constructed to check + /// the local state of the filesystem and propagate any dirtiness from + /// dependencies up to this unit as well. This function assumes that the + /// unit starts out as `FsStatus::Stale` and then it will optionally switch + /// it to `UpToDate` if it can. + fn check_filesystem( + &mut self, + pkg_root: &Path, + target_root: &Path, + mtime_on_use: bool, + ) -> CargoResult<()> { + assert!(!self.fs_status.up_to_date()); + + let mut mtimes = HashMap::new(); + + // Get the `mtime` of all outputs. Optionally update their mtime + // afterwards based on the `mtime_on_use` flag. Afterwards we want the + // minimum mtime as it's the one we'll be comparing to inputs and + // dependencies. + for output in self.outputs.iter() { + let mtime = match paths::mtime(output) { + Ok(mtime) => mtime, + + // This path failed to report its `mtime`. It probably doesn't + // exists, so leave ourselves as stale and bail out. + Err(e) => { + log::debug!("failed to get mtime of {:?}: {}", output, e); + return Ok(()); + } + }; + if mtime_on_use { + let t = FileTime::from_system_time(SystemTime::now()); + filetime::set_file_times(output, t, t)?; + } + assert!(mtimes.insert(output.clone(), mtime).is_none()); + } + + let max_mtime = match mtimes.values().max() { + Some(mtime) => mtime, + + // We had no output files. This means we're an overridden build + // script and we're just always up to date because we aren't + // watching the filesystem. + None => { + self.fs_status = FsStatus::UpToDate { mtimes }; + return Ok(()); + } + }; + + for dep in self.deps.iter() { + let dep_mtimes = match &dep.fingerprint.fs_status { + FsStatus::UpToDate { mtimes } => mtimes, + // If our dependency is stale, so are we, so bail out. + FsStatus::Stale => return Ok(()), + }; + + // If our dependency edge only requires the rmeta fiel to be present + // then we only need to look at that one output file, otherwise we + // need to consider all output files to see if we're out of date. + let dep_mtime = if dep.only_requires_rmeta { + dep_mtimes + .iter() + .filter_map(|(path, mtime)| { + if path.extension().and_then(|s| s.to_str()) == Some("rmeta") { + Some(mtime) + } else { + None + } + }) + .next() + .expect("failed to find rmeta") + } else { + match dep_mtimes.values().max() { + Some(mtime) => mtime, + // If our dependencies is up to date and has no filesystem + // interactions, then we can move on to the next dependency. + None => continue, + } + }; + + // If the dependency is newer than our own output then it was + // recompiled previously. We transitively become stale ourselves in + // that case, so bail out. + // + // Note that this comparison should probably be `>=`, not `>`, but + // for a discussion of why it's `>` see the discussion about #5918 + // below in `find_stale`. + if dep_mtime > max_mtime { + log::info!("dependency on `{}` is newer than we are", dep.name); + return Ok(()); + } + } + + // If we reached this far then all dependencies are up to date. Check + // all our `LocalFingerprint` information to see if we have any stale + // files for this package itself. If we do find something log a helpful + // message and bail out so we stay stale. + for local in self.local.get_mut().unwrap().iter() { + if let Some(file) = local.find_stale_file(pkg_root, target_root)? { + file.log(); + return Ok(()); } } + + // Everything was up to date! Record such. + self.fs_status = FsStatus::UpToDate { mtimes }; + Ok(()) } } @@ -377,12 +872,13 @@ profile, ref deps, ref local, - edition, + metadata, ref rustflags, .. } = *self; + let local = local.lock().unwrap(); ( - rustc, features, target, path, profile, local, edition, rustflags, + rustc, features, target, path, profile, &*local, metadata, rustflags, ) .hash(h); @@ -390,11 +886,14 @@ for DepFingerprint { pkg_id, name, + public, fingerprint, + only_requires_rmeta: _, // static property, no need to hash } in deps { pkg_id.hash(h); name.hash(h); + public.hash(h); // use memoized dep hashes to avoid exponential blowup h.write_u64(Fingerprint::hash(fingerprint)); } @@ -432,7 +931,68 @@ } } -/// Calculates the fingerprint for a package/target pair. +impl DepFingerprint { + fn new<'a, 'cfg>( + cx: &mut Context<'a, 'cfg>, + parent: &Unit<'a>, + dep: &Unit<'a>, + ) -> CargoResult { + let fingerprint = calculate(cx, dep)?; + let name = cx.bcx.extern_crate_name(parent, dep)?; + let public = cx.bcx.is_public_dependency(parent, dep); + + // We need to be careful about what we hash here. We have a goal of + // supporting renaming a project directory and not rebuilding + // everything. To do that, however, we need to make sure that the cwd + // doesn't make its way into any hashes, and one source of that is the + // `SourceId` for `path` packages. + // + // We already have a requirement that `path` packages all have unique + // names (sort of for this same reason), so if the package source is a + // `path` then we just hash the name, but otherwise we hash the full + // id as it won't change when the directory is renamed. + let pkg_id = if dep.pkg.package_id().source_id().is_path() { + util::hash_u64(dep.pkg.package_id().name()) + } else { + util::hash_u64(dep.pkg.package_id()) + }; + + Ok(DepFingerprint { + pkg_id, + name, + public, + fingerprint, + only_requires_rmeta: cx.only_requires_rmeta(parent, dep), + }) + } +} + +impl StaleFile { + /// Use the `log` crate to log a hopefully helpful message in diagnosing + /// what file is considered stale and why. This is intended to be used in + /// conjunction with `CARGO_LOG` to determine why Cargo is recompiling + /// something. Currently there's no user-facing usage of this other than + /// that. + fn log(&self) { + match self { + StaleFile::Missing(path) => { + log::info!("stale: missing {:?}", path); + } + StaleFile::Changed { + reference, + reference_mtime, + stale, + stale_mtime, + } => { + log::info!("stale: changed {:?}", stale); + log::info!(" (vs) {:?}", reference); + log::info!(" {:?} != {:?}", reference_mtime, stale_mtime); + } + } + } +} + +/// Calculates the fingerprint for a `unit`. /// /// This fingerprint is used by Cargo to learn about when information such as: /// @@ -441,74 +1001,116 @@ /// * The compiler changes /// * The set of features a package is built with changes /// * The profile a target is compiled with changes (e.g., opt-level changes) +/// * Any other compiler flags change that will affect the result /// /// Information like file modification time is only calculated for path -/// dependencies and is calculated in `calculate_target_fresh`. +/// dependencies. fn calculate<'a, 'cfg>( cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>, ) -> CargoResult> { - let bcx = cx.bcx; + // This function is slammed quite a lot, so the result is memoized. if let Some(s) = cx.fingerprints.get(unit) { return Ok(Arc::clone(s)); } + let mut fingerprint = if unit.mode.is_run_custom_build() { + calculate_run_custom_build(cx, unit)? + } else { + calculate_normal(cx, unit)? + }; + + // After we built the initial `Fingerprint` be sure to update the + // `fs_status` field of it. + let target_root = target_root(cx, unit); + let mtime_on_use = cx.bcx.config.cli_unstable().mtime_on_use; + fingerprint.check_filesystem(unit.pkg.root(), &target_root, mtime_on_use)?; + + let fingerprint = Arc::new(fingerprint); + cx.fingerprints.insert(*unit, Arc::clone(&fingerprint)); + Ok(fingerprint) +} - // Next, recursively calculate the fingerprint for all of our dependencies. +/// Calculate a fingerprint for a "normal" unit, or anything that's not a build +/// script. This is an internal helper of `calculate`, don't call directly. +fn calculate_normal<'a, 'cfg>( + cx: &mut Context<'a, 'cfg>, + unit: &Unit<'a>, +) -> CargoResult { + // Recursively calculate the fingerprint for all of our dependencies. // - // Skip the fingerprints of build scripts as they may not always be - // available and the dirtiness propagation for modification is tracked - // elsewhere. Also skip fingerprints of binaries because they don't actually - // induce a recompile, they're just dependencies in the sense that they need - // to be built. - let deps = cx.dep_targets(unit); - let deps = deps + // Skip fingerprints of binaries because they don't actually induce a + // recompile, they're just dependencies in the sense that they need to be + // built. + let mut deps = cx + .dep_targets(unit) .iter() - .filter(|u| !u.target.is_custom_build() && !u.target.is_bin()) - .map(|dep| { - calculate(cx, dep).and_then(|fingerprint| { - let name = cx.bcx.extern_crate_name(unit, dep)?; - Ok(DepFingerprint { - pkg_id: dep.pkg.package_id().to_string(), - name, - fingerprint, - }) - }) - }) + .filter(|u| !u.target.is_bin()) + .map(|dep| DepFingerprint::new(cx, unit, dep)) .collect::>>()?; + deps.sort_by(|a, b| a.pkg_id.cmp(&b.pkg_id)); - // And finally, calculate what our own local fingerprint is + // Afterwards calculate our own fingerprint information. We specially + // handle `path` packages to ensure we track files on the filesystem + // correctly, but otherwise upstream packages like from crates.io or git + // get bland fingerprints because they don't change without their + // `PackageId` changing. + let target_root = target_root(cx, unit); let local = if use_dep_info(unit) { let dep_info = dep_info_loc(cx, unit); - let mtime = dep_info_mtime_if_fresh(unit.pkg, &dep_info)?; - LocalFingerprint::mtime(cx.files().target_root(), mtime, &dep_info) + let dep_info = dep_info.strip_prefix(&target_root).unwrap().to_path_buf(); + vec![LocalFingerprint::CheckDepInfo { dep_info }] } else { - let fingerprint = pkg_fingerprint(&cx.bcx, unit.pkg)?; - LocalFingerprint::Precalculated(fingerprint) + let fingerprint = pkg_fingerprint(cx.bcx, unit.pkg)?; + vec![LocalFingerprint::Precalculated(fingerprint)] }; - let mut deps = deps; - deps.sort_by(|a, b| a.pkg_id.cmp(&b.pkg_id)); + + // Figure out what the outputs of our unit is, and we'll be storing them + // into the fingerprint as well. + let outputs = if unit.mode.is_doc() { + vec![cx + .files() + .out_dir(unit) + .join(unit.target.crate_name()) + .join("index.html")] + } else { + cx.outputs(unit)? + .iter() + .filter(|output| output.flavor != FileFlavor::DebugInfo) + .map(|output| output.path.clone()) + .collect() + }; + + // Fill out a bunch more information that we'll be tracking typically + // hashed to take up less space on disk as we just need to know when things + // change. let extra_flags = if unit.mode.is_doc() { - bcx.rustdocflags_args(unit)? + cx.bcx.rustdocflags_args(unit) } else { - bcx.rustflags_args(unit)? + cx.bcx.rustflags_args(unit) }; - let profile_hash = util::hash_u64(&(&unit.profile, unit.mode, bcx.extra_args_for(unit))); - let fingerprint = Arc::new(Fingerprint { - rustc: util::hash_u64(&bcx.rustc.verbose_version), + let profile_hash = util::hash_u64((&unit.profile, unit.mode, cx.bcx.extra_args_for(unit))); + // Include metadata since it is exposed as environment variables. + let m = unit.pkg.manifest().metadata(); + let metadata = util::hash_u64((&m.authors, &m.description, &m.homepage, &m.repository)); + Ok(Fingerprint { + rustc: util::hash_u64(&cx.bcx.rustc.verbose_version), target: util::hash_u64(&unit.target), profile: profile_hash, // Note that .0 is hashed here, not .1 which is the cwd. That doesn't // actually affect the output artifact so there's no need to hash it. - path: util::hash_u64(&super::path_args(&cx.bcx, unit).0), - features: format!("{:?}", bcx.resolve.features_sorted(unit.pkg.package_id())), + path: util::hash_u64(super::path_args(cx.bcx, unit).0), + features: format!( + "{:?}", + cx.bcx.resolve.features_sorted(unit.pkg.package_id()) + ), deps, - local: vec![local], + local: Mutex::new(local), memoized_hash: Mutex::new(None), - edition: unit.target.edition(), - rustflags: extra_flags, - }); - cx.fingerprints.insert(*unit, Arc::clone(&fingerprint)); - Ok(fingerprint) + metadata, + rustflags: extra_flags.to_vec(), + fs_status: FsStatus::Stale, + outputs, + }) } // We want to use the mtime for files if we're a path source, but if we're a @@ -520,119 +1122,165 @@ !unit.mode.is_doc() && path } -/// Prepare the necessary work for the fingerprint of a build command. -/// -/// Build commands are located on packages, not on targets. Additionally, we -/// don't have --dep-info to drive calculation of the fingerprint of a build -/// command. This brings up an interesting predicament which gives us a few -/// options to figure out whether a build command is dirty or not: -/// -/// 1. A build command is dirty if *any* file in a package changes. In theory -/// all files are candidate for being used by the build command. -/// 2. A build command is dirty if any file in a *specific directory* changes. -/// This may lose information as it may require files outside of the specific -/// directory. -/// 3. A build command must itself provide a dep-info-like file stating how it -/// should be considered dirty or not. -/// -/// The currently implemented solution is option (1), although it is planned to -/// migrate to option (2) in the near future. -pub fn prepare_build_cmd<'a, 'cfg>( +/// Calculate a fingerprint for an "execute a build script" unit. This is an +/// internal helper of `calculate`, don't call directly. +fn calculate_run_custom_build<'a, 'cfg>( cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>, -) -> CargoResult { - let _p = profile::start(format!("fingerprint build cmd: {}", unit.pkg.package_id())); - let new = cx.files().fingerprint_dir(unit); - let loc = new.join("build"); +) -> CargoResult { + // Using the `BuildDeps` information we'll have previously parsed and + // inserted into `build_explicit_deps` built an initial snapshot of the + // `LocalFingerprint` list for this build script. If we previously executed + // the build script this means we'll be watching files and env vars. + // Otherwise if we haven't previously executed it we'll just start watching + // the whole crate. + let (gen_local, overridden) = build_script_local_fingerprints(cx, unit); + let deps = &cx.build_explicit_deps[unit]; + let local = gen_local + .call_box(deps, Some(&|| pkg_fingerprint(cx.bcx, unit.pkg)))? + .unwrap(); + let output = deps.build_script_output.clone(); - debug!("fingerprint at: {}", loc.display()); + // Include any dependencies of our execution, which is typically just the + // compilation of the build script itself. (if the build script changes we + // should be rerun!). Note though that if we're an overridden build script + // we have no dependencies so no need to recurse in that case. + let deps = if overridden { + // Overridden build scripts don't need to track deps. + vec![] + } else { + cx.dep_targets(unit) + .iter() + .map(|dep| DepFingerprint::new(cx, unit, dep)) + .collect::>>()? + }; - let (local, output_path) = build_script_local_fingerprints(cx, unit)?; - let mut fingerprint = Fingerprint { - local, + Ok(Fingerprint { + local: Mutex::new(local), rustc: util::hash_u64(&cx.bcx.rustc.verbose_version), - ..Fingerprint::new() - }; - let mtime_on_use = cx.bcx.config.cli_unstable().mtime_on_use; - let compare = compare_old_fingerprint(&loc, &fingerprint, mtime_on_use); - log_compare(unit, &compare); + deps, + outputs: if overridden { Vec::new() } else { vec![output] }, - // When we write out the fingerprint, we may want to actually change the - // kind of fingerprint being recorded. If we started out, then the previous - // run of the build script (or if it had never run before) may indicate to - // use the `Precalculated` variant with the `pkg_fingerprint`. If the build - // script then prints `rerun-if-changed`, however, we need to record what's - // necessary for that fingerprint. - // - // Hence, if there were some `rerun-if-changed` directives forcibly change - // the kind of fingerprint by reinterpreting the dependencies output by the - // build script. - let state = Arc::clone(&cx.build_state); - let key = (unit.pkg.package_id(), unit.kind); - let pkg_root = unit.pkg.root().to_path_buf(); - let target_root = cx.files().target_root().to_path_buf(); - let write_fingerprint = Work::new(move |_| { - if let Some(output_path) = output_path { - let outputs = state.outputs.lock().unwrap(); - let outputs = &outputs[&key]; - if !outputs.rerun_if_changed.is_empty() || !outputs.rerun_if_env_changed.is_empty() { - let deps = BuildDeps::new(&output_path, Some(outputs)); - fingerprint.local = local_fingerprints_deps(&deps, &target_root, &pkg_root); - fingerprint.update_local(&target_root)?; - } - } - write_fingerprint(&loc, &fingerprint) - }); - - Ok(( - if compare.is_ok() { Fresh } else { Dirty }, - write_fingerprint, - Work::noop(), - )) + // Most of the other info is blank here as we don't really include it + // in the execution of the build script, but... this may be a latent + // bug in Cargo. + ..Fingerprint::new() + }) } +/// Get ready to compute the `LocalFingerprint` values for a `RunCustomBuild` +/// unit. +/// +/// This function has, what's on the surface, a seriously wonky interface. +/// You'll call this function and it'll return a closure and a boolean. The +/// boolean is pretty simple in that it indicates whether the `unit` has been +/// overridden via `.cargo/config`. The closure is much more complicated. +/// +/// This closure is intended to capture any local state necessary to compute +/// the `LocalFingerprint` values for this unit. It is `Send` and `'static` to +/// be sent to other threads as well (such as when we're executing build +/// scripts). That deduplication is the rationale for the closure at least. +/// +/// The arguments to the closure are a bit weirder, though, and I'll apologize +/// in advance for the weirdness too. The first argument to the closure (see +/// `MyFnOnce` below) is a `&BuildDeps`. This is the parsed version of a build +/// script, and when Cargo starts up this is cached from previous runs of a +/// build script. After a build script executes the output file is reparsed and +/// passed in here. +/// +/// The second argument is the weirdest, it's *optionally* a closure to +/// call `pkg_fingerprint` below. The `pkg_fingerprint` below requires access +/// to "source map" located in `Context`. That's very non-`'static` and +/// non-`Send`, so it can't be used on other threads, such as when we invoke +/// this after a build script has finished. The `Option` allows us to for sure +/// calculate it on the main thread at the beginning, and then swallow the bug +/// for now where a worker thread after a build script has finished doesn't +/// have access. Ideally there would be no second argument or it would be more +/// "first class" and not an `Option` but something that can be sent between +/// threads. In any case, it's a bug for now. +/// +/// This isn't the greatest of interfaces, and if there's suggestions to +/// improve please do so! +/// +/// FIXME(#6779) - see all the words above fn build_script_local_fingerprints<'a, 'cfg>( cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>, -) -> CargoResult<(Vec, Option)> { - let state = cx.build_state.outputs.lock().unwrap(); +) -> (Box, bool) { // First up, if this build script is entirely overridden, then we just - // return the hash of what we overrode it with. - // - // Note that the `None` here means that we don't want to update the local - // fingerprint afterwards because this is all just overridden. - if let Some(output) = state.get(&(unit.pkg.package_id(), unit.kind)) { + // return the hash of what we overrode it with. This is the easy case! + if let Some(fingerprint) = build_script_override_fingerprint(cx, unit) { debug!("override local fingerprints deps"); - let s = format!( - "overridden build state with hash: {}", - util::hash_u64(output) + return ( + Box::new( + move |_: &BuildDeps, _: Option<&dyn Fn() -> CargoResult>| { + Ok(Some(vec![fingerprint])) + }, + ), + true, // this is an overridden build script ); - return Ok((vec![LocalFingerprint::Precalculated(s)], None)); } - // Next up we look at the previously listed dependencies for the build - // script. If there are none then we're in the "old mode" where we just - // assume that we're changed if anything in the packaged changed. The - // `Some` here though means that we want to update our local fingerprints - // after we're done as running this build script may have created more - // dependencies. - let deps = &cx.build_explicit_deps[unit]; - let output = deps.build_script_output.clone(); - if deps.rerun_if_changed.is_empty() && deps.rerun_if_env_changed.is_empty() { - debug!("old local fingerprints deps"); - let s = pkg_fingerprint(&cx.bcx, unit.pkg)?; - return Ok((vec![LocalFingerprint::Precalculated(s)], Some(output))); - } + // ... Otherwise this is a "real" build script and we need to return a real + // closure. Our returned closure classifies the build script based on + // whether it prints `rerun-if-*`. If it *doesn't* print this it's where the + // magical second argument comes into play, which fingerprints a whole + // package. Remember that the fact that this is an `Option` is a bug, but a + // longstanding bug, in Cargo. Recent refactorings just made it painfully + // obvious. + let script_root = cx.files().build_script_run_dir(unit); + let pkg_root = unit.pkg.root().to_path_buf(); + let calculate = + move |deps: &BuildDeps, pkg_fingerprint: Option<&dyn Fn() -> CargoResult>| { + if deps.rerun_if_changed.is_empty() && deps.rerun_if_env_changed.is_empty() { + match pkg_fingerprint { + // FIXME: this is somewhat buggy with respect to docker and + // weird filesystems. The `Precalculated` variant + // constructed below will, for `path` dependencies, contain + // a stringified version of the mtime for the local crate. + // This violates one of the things we describe in this + // module's doc comment, never hashing mtimes. We should + // figure out a better scheme where a package fingerprint + // may be a string (like for a registry) or a list of files + // (like for a path dependency). Those list of files would + // be stored here rather than the the mtime of them. + Some(f) => { + debug!("old local fingerprints deps"); + let s = f()?; + return Ok(Some(vec![LocalFingerprint::Precalculated(s)])); + } + None => return Ok(None), + } + } + + // Ok so now we're in "new mode" where we can have files listed as + // dependencies as well as env vars listed as dependencies. Process + // them all here. + Ok(Some(local_fingerprints_deps(deps, &script_root, &pkg_root))) + }; - // Ok so now we're in "new mode" where we can have files listed as - // dependencies as well as env vars listed as dependencies. Process them all - // here. - Ok(( - local_fingerprints_deps(deps, cx.files().target_root(), unit.pkg.root()), - Some(output), - )) + // Note that `false` == "not overridden" + (Box::new(calculate), false) } +/// Create a `LocalFingerprint` for an overridden build script. +/// Returns None if it is not overridden. +fn build_script_override_fingerprint<'a, 'cfg>( + cx: &mut Context<'a, 'cfg>, + unit: &Unit<'a>, +) -> Option { + let state = cx.build_state.outputs.lock().unwrap(); + let output = state.get(&(unit.pkg.package_id(), unit.kind))?; + let s = format!( + "overridden build state with hash: {}", + util::hash_u64(output) + ); + Some(LocalFingerprint::Precalculated(s)) +} + +/// Compute the `LocalFingerprint` values for a `RunCustomBuild` unit for +/// non-overridden new-style build scripts only. This is only used when `deps` +/// is already known to have a nonempty `rerun-if-*` somewhere. fn local_fingerprints_deps( deps: &BuildDeps, target_root: &Path, @@ -640,16 +1288,30 @@ ) -> Vec { debug!("new local fingerprints deps"); let mut local = Vec::new(); + if !deps.rerun_if_changed.is_empty() { - let output = &deps.build_script_output; - let deps = deps.rerun_if_changed.iter().map(|p| pkg_root.join(p)); - let mtime = mtime_if_fresh(output, deps); - local.push(LocalFingerprint::mtime(target_root, mtime, output)); + // Note that like the module comment above says we are careful to never + // store an absolute path in `LocalFingerprint`, so ensure that we strip + // absolute prefixes from them. + let output = deps + .build_script_output + .strip_prefix(target_root) + .unwrap() + .to_path_buf(); + let paths = deps + .rerun_if_changed + .iter() + .map(|p| p.strip_prefix(pkg_root).unwrap_or(p).to_path_buf()) + .collect(); + local.push(LocalFingerprint::RerunIfChanged { output, paths }); } for var in deps.rerun_if_env_changed.iter() { let val = env::var(var).ok(); - local.push(LocalFingerprint::EnvBased(var.clone(), val)); + local.push(LocalFingerprint::RerunIfEnvChanged { + var: var.clone(), + val, + }); } local @@ -661,12 +1323,15 @@ // This is mostly so outside tools can reliably find out what rust version this file is for, // as we can use the full hash. let hash = fingerprint.hash(); - debug!("write fingerprint: {}", loc.display()); + debug!("write fingerprint ({:x}) : {}", hash, loc.display()); paths::write(loc, util::to_hex(hash).as_bytes())?; - paths::write( - &loc.with_extension("json"), - &serde_json::to_vec(&fingerprint).unwrap(), - )?; + + let json = serde_json::to_string(fingerprint).unwrap(); + if cfg!(debug_assertions) { + let f: Fingerprint = serde_json::from_str(&json).unwrap(); + assert_eq!(f.hash(), hash); + } + paths::write(&loc.with_extension("json"), json.as_bytes())?; Ok(()) } @@ -681,12 +1346,27 @@ Ok(()) } +/// Returns the location that the dep-info file will show up at for the `unit` +/// specified. pub fn dep_info_loc<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) -> PathBuf { cx.files() .fingerprint_dir(unit) .join(&format!("dep-{}", filename(cx, unit))) } +/// Returns an absolute path that the `unit`'s outputs should always be relative +/// to. This `target_root` variable is used to store relative path names in +/// `Fingerprint` instead of absolute pathnames (see module comment). +fn target_root<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) -> PathBuf { + if unit.mode.is_run_custom_build() { + cx.files().build_script_run_dir(unit) + } else if unit.kind == Kind::Host { + cx.files().host_root().to_path_buf() + } else { + cx.files().target_root().to_path_buf() + } +} + fn compare_old_fingerprint( loc: &Path, new_fingerprint: &Fingerprint, @@ -702,22 +1382,29 @@ let new_hash = new_fingerprint.hash(); - if util::to_hex(new_hash) == old_fingerprint_short { + if util::to_hex(new_hash) == old_fingerprint_short && new_fingerprint.fs_status.up_to_date() { return Ok(()); } let old_fingerprint_json = paths::read(&loc.with_extension("json"))?; - let old_fingerprint = serde_json::from_str(&old_fingerprint_json) + let old_fingerprint: Fingerprint = serde_json::from_str(&old_fingerprint_json) .chain_err(|| internal("failed to deserialize json"))?; - new_fingerprint.compare(&old_fingerprint) + debug_assert_eq!(util::to_hex(old_fingerprint.hash()), old_fingerprint_short); + let result = new_fingerprint.compare(&old_fingerprint); + assert!(result.is_err()); + result } fn log_compare(unit: &Unit<'_>, compare: &CargoResult<()>) { - let ce = match *compare { + let ce = match compare { Ok(..) => return, - Err(ref e) => e, + Err(e) => e, }; - info!("fingerprint error for {}: {}", unit.pkg, ce); + info!( + "fingerprint error for {}/{:?}/{:?}", + unit.pkg, unit.mode, unit.target, + ); + info!(" err: {}", ce); for cause in ce.iter_causes() { info!(" cause: {}", cause); @@ -725,7 +1412,7 @@ } // Parse the dep-info into a list of paths -pub fn parse_dep_info(pkg: &Package, dep_info: &Path) -> CargoResult>> { +pub fn parse_dep_info(pkg_root: &Path, dep_info: &Path) -> CargoResult>> { let data = match paths::read_bytes(dep_info) { Ok(data) => data, Err(_) => return Ok(None), @@ -733,7 +1420,7 @@ let paths = data .split(|&x| x == 0) .filter(|x| !x.is_empty()) - .map(|p| util::bytes2path(p).map(|p| pkg.root().join(p))) + .map(|p| util::bytes2path(p).map(|p| pkg_root.join(p))) .collect::, _>>()?; if paths.is_empty() { Ok(None) @@ -742,14 +1429,6 @@ } } -fn dep_info_mtime_if_fresh(pkg: &Package, dep_info: &Path) -> CargoResult> { - if let Some(paths) = parse_dep_info(pkg, dep_info)? { - Ok(mtime_if_fresh(dep_info, paths.iter())) - } else { - Ok(None) - } -} - fn pkg_fingerprint(bcx: &BuildContext<'_, '_>, pkg: &Package) -> CargoResult { let source_id = pkg.package_id().source_id(); let sources = bcx.packages.sources(); @@ -760,24 +1439,21 @@ source.fingerprint(pkg) } -fn mtime_if_fresh(output: &Path, paths: I) -> Option +fn find_stale_file(reference: &Path, paths: I) -> Option where I: IntoIterator, I::Item: AsRef, { - let mtime = match paths::mtime(output) { + let reference_mtime = match paths::mtime(reference) { Ok(mtime) => mtime, - Err(..) => return None, + Err(..) => return Some(StaleFile::Missing(reference.to_path_buf())), }; - let any_stale = paths.into_iter().any(|path| { + for path in paths { let path = path.as_ref(); - let mtime2 = match paths::mtime(path) { + let path_mtime = match paths::mtime(path) { Ok(mtime) => mtime, - Err(..) => { - info!("stale: {} -- missing", path.display()); - return true; - } + Err(..) => return Some(StaleFile::Missing(path.to_path_buf())), }; // TODO: fix #5918. @@ -798,19 +1474,19 @@ // if equal, files were changed just after a previous build finished. // Unfortunately this became problematic when (in #6484) cargo switch to more accurately // measuring the start time of builds. - if mtime2 > mtime { - info!("stale: {} -- {} vs {}", path.display(), mtime2, mtime); - true - } else { - false + if path_mtime <= reference_mtime { + continue; } - }); - if any_stale { - None - } else { - Some(mtime) + return Some(StaleFile::Changed { + reference: reference.to_path_buf(), + reference_mtime, + stale: path.to_path_buf(), + stale_mtime: path_mtime, + }); } + + None } fn filename<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) -> String { @@ -823,6 +1499,8 @@ "test-" } else if unit.mode.is_doc() { "doc-" + } else if unit.mode.is_run_custom_build() { + "run-" } else { "" }; @@ -893,3 +1571,30 @@ }) .collect() } + +// This trait solely exists for the `build_script_local_fingerprints` function +// above, see documentation there for more information. If we had `Box` we wouldn't need this. +trait MyFnOnce { + fn call_box( + self: Box, + f: &BuildDeps, + pkg_fingerprint: Option<&dyn Fn() -> CargoResult>, + ) -> CargoResult>>; +} + +impl MyFnOnce for F +where + F: FnOnce( + &BuildDeps, + Option<&dyn Fn() -> CargoResult>, + ) -> CargoResult>>, +{ + fn call_box( + self: Box, + f: &BuildDeps, + pkg_fingerprint: Option<&dyn Fn() -> CargoResult>, + ) -> CargoResult>> { + (*self)(f, pkg_fingerprint) + } +} diff -Nru cargo-0.35.0/src/cargo/core/compiler/job_queue.rs cargo-0.37.0/src/cargo/core/compiler/job_queue.rs --- cargo-0.35.0/src/cargo/core/compiler/job_queue.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/compiler/job_queue.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,9 +1,7 @@ -use std::collections::hash_map::HashMap; -use std::collections::HashSet; -use std::fmt; +use std::cell::Cell; +use std::collections::{HashMap, HashSet}; use std::io; -use std::mem; -use std::process::Output; +use std::marker; use std::sync::mpsc::{channel, Receiver, Sender}; use std::sync::Arc; @@ -11,17 +9,19 @@ use jobserver::{Acquired, HelperThread}; use log::{debug, info, trace}; -use crate::core::profiles::Profile; -use crate::core::{PackageId, Target, TargetKind}; +use super::context::OutputFile; +use super::job::{ + Freshness::{self, Dirty, Fresh}, + Job, +}; +use super::{BuildContext, BuildPlan, CompileMode, Context, Unit}; +use crate::core::{PackageId, TargetKind}; use crate::handle_error; use crate::util; use crate::util::diagnostic_server::{self, DiagnosticPrinter}; use crate::util::{internal, profile, CargoResult, CargoResultExt, ProcessBuilder}; -use crate::util::{Config, DependencyQueue, Dirty, Fresh, Freshness}; +use crate::util::{Config, DependencyQueue}; use crate::util::{Progress, ProgressStyle}; -use super::context::OutputFile; -use super::job::Job; -use super::{BuildContext, BuildPlan, CompileMode, Context, Kind, Unit}; /// A management structure of the entire dependency graph to compile. /// @@ -29,69 +29,64 @@ /// actual compilation step of each package. Packages enqueue units of work and /// then later on the entire graph is processed and compiled. pub struct JobQueue<'a, 'cfg> { - queue: DependencyQueue, Vec<(Job, Freshness)>>, - tx: Sender>, - rx: Receiver>, - active: Vec>, - pending: HashMap, PendingBuild>, + queue: DependencyQueue, Artifact, Job>, + tx: Sender, + rx: Receiver, + active: HashMap>, compiled: HashSet, documented: HashSet, counts: HashMap, is_release: bool, progress: Progress<'cfg>, + next_id: u32, } -/// A helper structure for metadata about the state of a building package. -struct PendingBuild { - /// The number of jobs currently active. - amt: usize, - /// The current freshness state of this package. Any dirty target within a - /// package will cause the entire package to become dirty. - fresh: Freshness, -} +pub struct JobState<'a> { + /// Channel back to the main thread to coordinate messages and such. + tx: Sender, -#[derive(Clone, Copy, Eq, PartialEq, Hash)] -struct Key<'a> { - pkg: PackageId, - target: &'a Target, - profile: Profile, - kind: Kind, - mode: CompileMode, + /// The job id that this state is associated with, used when sending + /// messages back to the main thread. + id: u32, + + /// Whether or not we're expected to have a call to `rmeta_produced`. Once + /// that method is called this is dynamically set to `false` to prevent + /// sending a double message later on. + rmeta_required: Cell, + + // Historical versions of Cargo made use of the `'a` argument here, so to + // leave the door open to future refactorings keep it here. + _marker: marker::PhantomData<&'a ()>, } -impl<'a> Key<'a> { - fn name_for_progress(&self) -> String { - let pkg_name = self.pkg.name(); - match self.mode { - CompileMode::Doc { .. } => format!("{}(doc)", pkg_name), - CompileMode::RunCustomBuild => format!("{}(build)", pkg_name), - _ => { - let annotation = match self.target.kind() { - TargetKind::Lib(_) => return pkg_name.to_string(), - TargetKind::CustomBuild => return format!("{}(build.rs)", pkg_name), - TargetKind::Bin => "bin", - TargetKind::Test => "test", - TargetKind::Bench => "bench", - TargetKind::ExampleBin | TargetKind::ExampleLib(_) => "example", - }; - format!("{}({})", self.target.name(), annotation) - } - } - } -} - -pub struct JobState<'a> { - tx: Sender>, +/// Possible artifacts that can be produced by compilations, used as edge values +/// in the dependency graph. +/// +/// As edge values we can have multiple kinds of edges depending on one node, +/// for example some units may only depend on the metadata for an rlib while +/// others depend on the full rlib. This `Artifact` enum is used to distinguish +/// this case and track the progress of compilations as they proceed. +#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] +enum Artifact { + /// A generic placeholder for "depends on everything run by a step" and + /// means that we can't start the next compilation until the previous has + /// finished entirely. + All, + + /// A node indicating that we only depend on the metadata of a compilation, + /// but the compilation is typically also producing an rlib. We can start + /// our step, however, before the full rlib is available. + Metadata, } -enum Message<'a> { +enum Message { Run(String), BuildPlanMsg(String, ProcessBuilder, Arc>), Stdout(String), Stderr(String), FixDiagnostic(diagnostic_server::Message), Token(io::Result), - Finish(Key<'a>, CargoResult<()>), + Finish(u32, Artifact, CargoResult<()>), } impl<'a> JobState<'a> { @@ -110,24 +105,25 @@ .send(Message::BuildPlanMsg(module_name, cmd, filenames)); } - pub fn capture_output( - &self, - cmd: &ProcessBuilder, - prefix: Option, - capture_output: bool, - ) -> CargoResult { - let prefix = prefix.unwrap_or_else(String::new); - cmd.exec_with_streaming( - &mut |out| { - let _ = self.tx.send(Message::Stdout(format!("{}{}", prefix, out))); - Ok(()) - }, - &mut |err| { - let _ = self.tx.send(Message::Stderr(format!("{}{}", prefix, err))); - Ok(()) - }, - capture_output, - ) + pub fn stdout(&self, stdout: &str) { + drop(self.tx.send(Message::Stdout(stdout.to_string()))); + } + + pub fn stderr(&self, stderr: &str) { + drop(self.tx.send(Message::Stderr(stderr.to_string()))); + } + + /// A method used to signal to the coordinator thread that the rmeta file + /// for an rlib has been produced. This is only called for some rmeta + /// builds when required, and can be called at any time before a job ends. + /// This should only be called once because a metadata file can only be + /// produced once! + pub fn rmeta_produced(&self) { + assert!(self.rmeta_required.get()); + self.rmeta_required.set(false); + let _ = self + .tx + .send(Message::Finish(self.id, Artifact::Metadata, Ok(()))); } } @@ -139,13 +135,13 @@ queue: DependencyQueue::new(), tx, rx, - active: Vec::new(), - pending: HashMap::new(), + active: HashMap::new(), compiled: HashSet::new(), documented: HashSet::new(), counts: HashMap::new(), is_release: bcx.build_config.release, progress, + next_id: 0, } } @@ -154,15 +150,73 @@ cx: &Context<'a, 'cfg>, unit: &Unit<'a>, job: Job, - fresh: Freshness, ) -> CargoResult<()> { - let key = Key::new(unit); - let deps = key.dependencies(cx)?; - self.queue - .queue(Fresh, &key, Vec::new(), &deps) - .push((job, fresh)); - *self.counts.entry(key.pkg).or_insert(0) += 1; - Ok(()) + let dependencies = cx.dep_targets(unit); + let mut queue_deps = dependencies + .iter() + .filter(|unit| { + // Binaries aren't actually needed to *compile* tests, just to run + // them, so we don't include this dependency edge in the job graph. + !unit.target.is_test() || !unit.target.is_bin() + }) + .cloned() + .map(|dep| { + // Handle the case here where our `unit -> dep` dependency may + // only require the metadata, not the full compilation to + // finish. Use the tables in `cx` to figure out what kind + // of artifact is associated with this dependency. + let artifact = if cx.only_requires_rmeta(unit, &dep) { + Artifact::Metadata + } else { + Artifact::All + }; + (dep, artifact) + }) + .collect::>(); + + // This is somewhat tricky, but we may need to synthesize some + // dependencies for this target if it requires full upstream + // compilations to have completed. If we're in pipelining mode then some + // dependency edges may be `Metadata` due to the above clause (as + // opposed to everything being `All`). For example consider: + // + // a (binary) + // └ b (lib) + // └ c (lib) + // + // Here the dependency edge from B to C will be `Metadata`, and the + // dependency edge from A to B will be `All`. For A to be compiled, + // however, it currently actually needs the full rlib of C. This means + // that we need to synthesize a dependency edge for the dependency graph + // from A to C. That's done here. + // + // This will walk all dependencies of the current target, and if any of + // *their* dependencies are `Metadata` then we depend on the `All` of + // the target as well. This should ensure that edges changed to + // `Metadata` propagate upwards `All` dependencies to anything that + // transitively contains the `Metadata` edge. + if unit.target.requires_upstream_objects() { + for dep in dependencies.iter() { + depend_on_deps_of_deps(cx, &mut queue_deps, dep); + } + + fn depend_on_deps_of_deps<'a>( + cx: &Context<'a, '_>, + deps: &mut Vec<(Unit<'a>, Artifact)>, + unit: &Unit<'a>, + ) { + for dep in cx.dep_targets(unit) { + if cx.only_requires_rmeta(unit, &dep) { + deps.push((dep, Artifact::All)); + depend_on_deps_of_deps(cx, deps, &dep); + } + } + } + } + + self.queue.queue(*unit, job, queue_deps); + *self.counts.entry(unit.pkg.package_id()).or_insert(0) += 1; + return Ok(()); } /// Executes all jobs necessary to build the dependency graph. @@ -170,26 +224,12 @@ /// This function will spawn off `config.jobs()` workers to build all of the /// necessary dependencies, in order. Freshness is propagated as far as /// possible along each dependency chain. - pub fn execute(&mut self, cx: &mut Context<'_, '_>, plan: &mut BuildPlan) -> CargoResult<()> { + pub fn execute(&mut self, cx: &mut Context<'a, '_>, plan: &mut BuildPlan) -> CargoResult<()> { let _p = profile::start("executing the job graph"); self.queue.queue_finished(); - // We need to give a handle to the send half of our message queue to the - // jobserver and (optionally) diagnostic helper thread. Unfortunately - // though we need the handle to be `'static` as that's typically what's - // required when spawning a thread! - // - // To work around this we transmute the `Sender` to a static lifetime. - // we're only sending "longer living" messages and we should also - // destroy all references to the channel before this function exits as - // the destructor for the `helper` object will ensure the associated - // thread is no longer running. - // - // As a result, this `transmute` to a longer lifetime should be safe in - // practice. + // Create a helper thread for acquiring jobserver tokens let tx = self.tx.clone(); - let tx = unsafe { mem::transmute::>, Sender>>(tx) }; - let tx2 = tx.clone(); let helper = cx .jobserver .clone() @@ -197,28 +237,37 @@ drop(tx.send(Message::Token(token))); }) .chain_err(|| "failed to create helper thread for jobserver management")?; + + // Create a helper thread to manage the diagnostics for rustfix if + // necessary. + let tx = self.tx.clone(); let _diagnostic_server = cx .bcx .build_config .rustfix_diagnostic_server .borrow_mut() .take() - .map(move |srv| srv.start(move |msg| drop(tx2.send(Message::FixDiagnostic(msg))))); + .map(move |srv| srv.start(move |msg| drop(tx.send(Message::FixDiagnostic(msg))))); + // Use `crossbeam` to create a scope in which we can execute scoped + // threads. Note that this isn't currently required by Cargo but it was + // historically required. This is left in for now in case we need the + // `'a` ability for child threads in the near future, but if this + // comment has been sitting here for a long time feel free to refactor + // away crossbeam. crossbeam_utils::thread::scope(|scope| self.drain_the_queue(cx, plan, scope, &helper)) - .expect("child threads should't panic") + .expect("child threads shouldn't panic") } fn drain_the_queue( &mut self, - cx: &mut Context<'_, '_>, + cx: &mut Context<'a, '_>, plan: &mut BuildPlan, scope: &Scope<'a>, jobserver_helper: &HelperThread, ) -> CargoResult<()> { let mut tokens = Vec::new(); let mut queue = Vec::new(); - let build_plan = cx.bcx.build_config.build_plan; let mut print = DiagnosticPrinter::new(cx.bcx.config); trace!("queue: {:#?}", self.queue); @@ -234,25 +283,16 @@ // and then immediately return. let mut error = None; let total = self.queue.len(); + let mut finished = 0; loop { // Dequeue as much work as we can, learning about everything // possible that can run. Note that this is also the point where we // start requesting job tokens. Each job after the first needs to // request a token. - while let Some((fresh, key, jobs)) = self.queue.dequeue() { - let total_fresh = jobs.iter().fold(fresh, |fresh, &(_, f)| f.combine(fresh)); - self.pending.insert( - key, - PendingBuild { - amt: jobs.len(), - fresh: total_fresh, - }, - ); - for (job, f) in jobs { - queue.push((key, job, f.combine(fresh))); - if !self.active.is_empty() || !queue.is_empty() { - jobserver_helper.request_token(); - } + while let Some((unit, job)) = self.queue.dequeue() { + queue.push((unit, job)); + if self.active.len() + queue.len() > 1 { + jobserver_helper.request_token(); } } @@ -260,8 +300,8 @@ // try to spawn it so long as we've got a jobserver token which says // we're able to perform some parallel work. while error.is_none() && self.active.len() < tokens.len() + 1 && !queue.is_empty() { - let (key, job, fresh) = queue.remove(0); - self.run(key, fresh, job, cx.bcx.config, scope, build_plan)?; + let (unit, job) = queue.remove(0); + self.run(&unit, job, cx, scope)?; } // If after all that we're not actually running anything then we're @@ -281,7 +321,7 @@ // unnecessarily. let events: Vec<_> = self.rx.try_iter().collect(); let events = if events.is_empty() { - self.show_progress(total); + self.show_progress(finished, total); vec![self.rx.recv().unwrap()] } else { events @@ -310,26 +350,28 @@ Message::FixDiagnostic(msg) => { print.print(&msg)?; } - Message::Finish(key, result) => { - info!("end: {:?}", key); - - // FIXME: switch to this when stabilized. - // self.active.remove_item(&key); - let pos = self - .active - .iter() - .position(|k| *k == key) - .expect("an unrecorded package has finished compiling"); - self.active.remove(pos); - if !self.active.is_empty() { - assert!(!tokens.is_empty()); - drop(tokens.pop()); - } + Message::Finish(id, artifact, result) => { + let unit = match artifact { + // If `id` has completely finished we remove it + // from the `active` map ... + Artifact::All => { + info!("end: {:?}", id); + finished += 1; + self.active.remove(&id).unwrap() + } + // ... otherwise if it hasn't finished we leave it + // in there as we'll get another `Finish` later on. + Artifact::Metadata => { + info!("end (meta): {:?}", id); + self.active[&id] + } + }; + info!("end ({:?}): {:?}", unit, result); match result { - Ok(()) => self.finish(key, cx)?, + Ok(()) => self.finish(&unit, artifact, cx)?, Err(e) => { let msg = "The following warnings were emitted during compilation:"; - self.emit_warnings(Some(msg), &key, cx)?; + self.emit_warnings(Some(msg), &unit, cx)?; if !self.active.is_empty() { error = Some(failure::format_err!("build failed")); @@ -374,29 +416,28 @@ let time_elapsed = util::elapsed(cx.bcx.config.creation_time().elapsed()); - if self.queue.is_empty() { + if let Some(e) = error { + Err(e) + } else if self.queue.is_empty() && queue.is_empty() { let message = format!( "{} [{}] target(s) in {}", build_type, opt_type, time_elapsed ); - if !build_plan { + if !cx.bcx.build_config.build_plan { cx.bcx.config.shell().status("Finished", message)?; } Ok(()) - } else if let Some(e) = error { - Err(e) } else { debug!("queue: {:#?}", self.queue); Err(internal("finished with jobs still left in the queue")) } } - fn show_progress(&mut self, total: usize) { - let count = total - self.queue.len(); + fn show_progress(&mut self, count: usize, total: usize) { let active_names = self .active - .iter() - .map(Key::name_for_progress) + .values() + .map(|u| self.name_for_progress(u)) .collect::>(); drop( self.progress @@ -404,31 +445,78 @@ ); } + fn name_for_progress(&self, unit: &Unit<'_>) -> String { + let pkg_name = unit.pkg.name(); + match unit.mode { + CompileMode::Doc { .. } => format!("{}(doc)", pkg_name), + CompileMode::RunCustomBuild => format!("{}(build)", pkg_name), + _ => { + let annotation = match unit.target.kind() { + TargetKind::Lib(_) => return pkg_name.to_string(), + TargetKind::CustomBuild => return format!("{}(build.rs)", pkg_name), + TargetKind::Bin => "bin", + TargetKind::Test => "test", + TargetKind::Bench => "bench", + TargetKind::ExampleBin | TargetKind::ExampleLib(_) => "example", + }; + format!("{}({})", unit.target.name(), annotation) + } + } + } + /// Executes a job in the `scope` given, pushing the spawned thread's /// handled onto `threads`. fn run( &mut self, - key: Key<'a>, - fresh: Freshness, + unit: &Unit<'a>, job: Job, - config: &Config, + cx: &Context<'a, '_>, scope: &Scope<'a>, - build_plan: bool, ) -> CargoResult<()> { - info!("start: {:?}", key); + let id = self.next_id; + self.next_id = id.checked_add(1).unwrap(); + + info!("start {}: {:?}", id, unit); - self.active.push(key); - *self.counts.get_mut(&key.pkg).unwrap() -= 1; + assert!(self.active.insert(id, *unit).is_none()); + *self.counts.get_mut(&unit.pkg.package_id()).unwrap() -= 1; let my_tx = self.tx.clone(); + let fresh = job.freshness(); + let rmeta_required = cx.rmeta_required(unit); let doit = move || { - let res = job.run(fresh, &JobState { tx: my_tx.clone() }); - my_tx.send(Message::Finish(key, res)).unwrap(); + let state = JobState { + id, + tx: my_tx.clone(), + rmeta_required: Cell::new(rmeta_required), + _marker: marker::PhantomData, + }; + let res = job.run(&state); + + // If the `rmeta_required` wasn't consumed but it was set + // previously, then we either have: + // + // 1. The `job` didn't do anything because it was "fresh". + // 2. The `job` returned an error and didn't reach the point where + // it called `rmeta_produced`. + // 3. We forgot to call `rmeta_produced` and there's a bug in Cargo. + // + // Ruling out the third, the other two are pretty common for 2 + // we'll just naturally abort the compilation operation but for 1 + // we need to make sure that the metadata is flagged as produced so + // send a synthetic message here. + if state.rmeta_required.get() && res.is_ok() { + my_tx + .send(Message::Finish(id, Artifact::Metadata, Ok(()))) + .unwrap(); + } + + my_tx.send(Message::Finish(id, Artifact::All, res)).unwrap(); }; - if !build_plan { + if !cx.bcx.build_config.build_plan { // Print out some nice progress information. - self.note_working_on(config, &key, fresh)?; + self.note_working_on(cx.bcx.config, unit, fresh)?; } match fresh { @@ -444,12 +532,12 @@ fn emit_warnings( &mut self, msg: Option<&str>, - key: &Key<'a>, + unit: &Unit<'a>, cx: &mut Context<'_, '_>, ) -> CargoResult<()> { let output = cx.build_state.outputs.lock().unwrap(); let bcx = &mut cx.bcx; - if let Some(output) = output.get(&(key.pkg, key.kind)) { + if let Some(output) = output.get(&(unit.pkg.package_id(), unit.kind)) { if !output.warnings.is_empty() { if let Some(msg) = msg { writeln!(bcx.config.shell().err(), "{}\n", msg)?; @@ -469,16 +557,16 @@ Ok(()) } - fn finish(&mut self, key: Key<'a>, cx: &mut Context<'_, '_>) -> CargoResult<()> { - if key.mode.is_run_custom_build() && cx.bcx.show_warnings(key.pkg) { - self.emit_warnings(None, &key, cx)?; - } - - let state = self.pending.get_mut(&key).unwrap(); - state.amt -= 1; - if state.amt == 0 { - self.queue.finish(&key, state.fresh); + fn finish( + &mut self, + unit: &Unit<'a>, + artifact: Artifact, + cx: &mut Context<'_, '_>, + ) -> CargoResult<()> { + if unit.mode.is_run_custom_build() && cx.bcx.show_warnings(unit.pkg.package_id()) { + self.emit_warnings(None, unit, cx)?; } + self.queue.finish(unit, &artifact); Ok(()) } @@ -494,11 +582,11 @@ fn note_working_on( &mut self, config: &Config, - key: &Key<'a>, + unit: &Unit<'a>, fresh: Freshness, ) -> CargoResult<()> { - if (self.compiled.contains(&key.pkg) && !key.mode.is_doc()) - || (self.documented.contains(&key.pkg) && key.mode.is_doc()) + if (self.compiled.contains(&unit.pkg.package_id()) && !unit.mode.is_doc()) + || (self.documented.contains(&unit.pkg.package_id()) && unit.mode.is_doc()) { return Ok(()); } @@ -507,76 +595,32 @@ // Any dirty stage which runs at least one command gets printed as // being a compiled package. Dirty => { - if key.mode.is_doc() { + if unit.mode.is_doc() { // Skip doc test. - if !key.mode.is_any_test() { - self.documented.insert(key.pkg); - config.shell().status("Documenting", key.pkg)?; + if !unit.mode.is_any_test() { + self.documented.insert(unit.pkg.package_id()); + config.shell().status("Documenting", unit.pkg)?; } } else { - self.compiled.insert(key.pkg); - if key.mode.is_check() { - config.shell().status("Checking", key.pkg)?; + self.compiled.insert(unit.pkg.package_id()); + if unit.mode.is_check() { + config.shell().status("Checking", unit.pkg)?; } else { - config.shell().status("Compiling", key.pkg)?; + config.shell().status("Compiling", unit.pkg)?; } } } Fresh => { // If doc test are last, only print "Fresh" if nothing has been printed. - if self.counts[&key.pkg] == 0 - && !(key.mode == CompileMode::Doctest && self.compiled.contains(&key.pkg)) + if self.counts[&unit.pkg.package_id()] == 0 + && !(unit.mode == CompileMode::Doctest + && self.compiled.contains(&unit.pkg.package_id())) { - self.compiled.insert(key.pkg); - config.shell().verbose(|c| c.status("Fresh", key.pkg))?; + self.compiled.insert(unit.pkg.package_id()); + config.shell().verbose(|c| c.status("Fresh", unit.pkg))?; } } } Ok(()) } } - -impl<'a> Key<'a> { - fn new(unit: &Unit<'a>) -> Key<'a> { - Key { - pkg: unit.pkg.package_id(), - target: unit.target, - profile: unit.profile, - kind: unit.kind, - mode: unit.mode, - } - } - - fn dependencies<'cfg>(&self, cx: &Context<'a, 'cfg>) -> CargoResult>> { - let unit = Unit { - pkg: cx.get_package(self.pkg)?, - target: self.target, - profile: self.profile, - kind: self.kind, - mode: self.mode, - }; - let targets = cx.dep_targets(&unit); - Ok(targets - .iter() - .filter_map(|unit| { - // Binaries aren't actually needed to *compile* tests, just to run - // them, so we don't include this dependency edge in the job graph. - if self.target.is_test() && unit.target.is_bin() { - None - } else { - Some(Key::new(unit)) - } - }) - .collect()) - } -} - -impl<'a> fmt::Debug for Key<'a> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!( - f, - "{} => {}/{} => {:?}", - self.pkg, self.target, self.profile, self.kind - ) - } -} diff -Nru cargo-0.35.0/src/cargo/core/compiler/job.rs cargo-0.37.0/src/cargo/core/compiler/job.rs --- cargo-0.35.0/src/cargo/core/compiler/job.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/compiler/job.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,11 +1,12 @@ use std::fmt; +use std::mem; use super::job_queue::JobState; -use crate::util::{CargoResult, Dirty, Fresh, Freshness}; +use crate::util::CargoResult; pub struct Job { - dirty: Work, - fresh: Work, + work: Work, + fresh: Freshness, } /// Each proc should send its description before starting. @@ -50,17 +51,26 @@ impl Job { /// Creates a new job representing a unit of work. - pub fn new(dirty: Work, fresh: Work) -> Job { - Job { dirty, fresh } + pub fn new(work: Work, fresh: Freshness) -> Job { + Job { work, fresh } } /// Consumes this job by running it, returning the result of the /// computation. - pub fn run(self, fresh: Freshness, state: &JobState<'_>) -> CargoResult<()> { - match fresh { - Fresh => self.fresh.call(state), - Dirty => self.dirty.call(state), - } + pub fn run(self, state: &JobState<'_>) -> CargoResult<()> { + self.work.call(state) + } + + /// Returns whether this job was fresh/dirty, where "fresh" means we're + /// likely to perform just some small bookkeeping where "dirty" means we'll + /// probably do something slow like invoke rustc. + pub fn freshness(&self) -> Freshness { + self.fresh + } + + pub fn before(&mut self, next: Work) { + let prev = mem::replace(&mut self.work, Work::noop()); + self.work = next.then(prev); } } @@ -69,3 +79,13 @@ write!(f, "Job {{ ... }}") } } + +/// Indication of the freshness of a package. +/// +/// A fresh package does not necessarily need to be rebuilt (unless a dependency +/// was also rebuilt), and a dirty package must always be rebuilt. +#[derive(PartialEq, Eq, Debug, Clone, Copy)] +pub enum Freshness { + Fresh, + Dirty, +} diff -Nru cargo-0.35.0/src/cargo/core/compiler/layout.rs cargo-0.37.0/src/cargo/core/compiler/layout.rs --- cargo-0.35.0/src/cargo/core/compiler/layout.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/compiler/layout.rs 2019-05-15 19:48:47.000000000 +0000 @@ -160,10 +160,9 @@ pub fn prepare(&mut self) -> io::Result<()> { if fs::metadata(&self.root).is_err() { fs::create_dir_all(&self.root)?; + self.exclude_from_backups(&self.root); } - self.exclude_from_backups(&self.root); - mkdir(&self.deps)?; mkdir(&self.native)?; mkdir(&self.incremental)?; diff -Nru cargo-0.35.0/src/cargo/core/compiler/mod.rs cargo-0.37.0/src/cargo/core/compiler/mod.rs --- cargo-0.35.0/src/cargo/core/compiler/mod.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/compiler/mod.rs 2019-05-15 19:48:47.000000000 +0000 @@ -9,36 +9,40 @@ mod job_queue; mod layout; mod output_depinfo; +mod unit; use std::env; use std::ffi::{OsStr, OsString}; use std::fs; -use std::io::{self, Write}; -use std::path::{self, Path, PathBuf}; +use std::path::{Path, PathBuf}; use std::sync::Arc; -use failure::Error; +use failure::{bail, Error}; use log::debug; use same_file::is_same_file; use serde::Serialize; -use crate::core::manifest::TargetSourcePath; -use crate::core::profiles::{Lto, Profile}; -use crate::core::{PackageId, Target}; -use crate::util::errors::{CargoResult, CargoResultExt, Internal, ProcessError}; -use crate::util::paths; -use crate::util::{self, machine_message, process, Freshness, ProcessBuilder}; -use crate::util::{internal, join_paths, profile}; pub use self::build_config::{BuildConfig, CompileMode, MessageFormat}; pub use self::build_context::{BuildContext, FileFlavor, TargetConfig, TargetInfo}; use self::build_plan::BuildPlan; pub use self::compilation::{Compilation, Doctest}; -pub use self::context::{Context, Unit}; +pub use self::context::Context; pub use self::custom_build::{BuildMap, BuildOutput, BuildScripts}; +pub use self::job::Freshness; use self::job::{Job, Work}; -use self::job_queue::JobQueue; +use self::job_queue::{JobQueue, JobState}; pub use self::layout::is_bad_artifact_name; use self::output_depinfo::output_depinfo; +pub use crate::core::compiler::unit::{Unit, UnitInterner}; +use crate::core::manifest::TargetSourcePath; +use crate::core::profiles::{Lto, PanicStrategy, Profile}; +use crate::core::Feature; +use crate::core::{PackageId, Target}; +use crate::util::errors::{CargoResult, CargoResultExt, Internal, ProcessError}; +use crate::util::machine_message::Message; +use crate::util::paths; +use crate::util::{self, machine_message, process, ProcessBuilder}; +use crate::util::{internal, join_paths, profile}; /// Indicates whether an object is for the host architcture or the target architecture. /// @@ -56,45 +60,19 @@ /// Called after a rustc process invocation is prepared up-front for a given /// unit of work (may still be modified for runtime-known dependencies, when /// the work is actually executed). - fn init(&self, _cx: &Context<'_, '_>, _unit: &Unit<'_>) {} + fn init<'a, 'cfg>(&self, _cx: &Context<'a, 'cfg>, _unit: &Unit<'a>) {} /// In case of an `Err`, Cargo will not continue with the build process for /// this package. fn exec( &self, cmd: ProcessBuilder, - _id: PackageId, - _target: &Target, - _mode: CompileMode, - ) -> CargoResult<()> { - cmd.exec()?; - Ok(()) - } - - fn exec_and_capture_output( - &self, - cmd: ProcessBuilder, id: PackageId, target: &Target, mode: CompileMode, - _state: &job_queue::JobState<'_>, - ) -> CargoResult<()> { - // We forward to `exec()` to keep RLS working. - self.exec(cmd, id, target, mode) - } - - fn exec_json( - &self, - cmd: ProcessBuilder, - _id: PackageId, - _target: &Target, - _mode: CompileMode, - handle_stdout: &mut dyn FnMut(&str) -> CargoResult<()>, - handle_stderr: &mut dyn FnMut(&str) -> CargoResult<()>, - ) -> CargoResult<()> { - cmd.exec_with_streaming(handle_stdout, handle_stderr, false)?; - Ok(()) - } + on_stdout_line: &mut dyn FnMut(&str) -> CargoResult<()>, + on_stderr_line: &mut dyn FnMut(&str) -> CargoResult<()>, + ) -> CargoResult<()>; /// Queried when queuing each unit of work. If it returns true, then the /// unit will always be rebuilt, independent of whether it needs to be. @@ -109,15 +87,17 @@ pub struct DefaultExecutor; impl Executor for DefaultExecutor { - fn exec_and_capture_output( + fn exec( &self, cmd: ProcessBuilder, _id: PackageId, _target: &Target, _mode: CompileMode, - state: &job_queue::JobState<'_>, + on_stdout_line: &mut dyn FnMut(&str) -> CargoResult<()>, + on_stderr_line: &mut dyn FnMut(&str) -> CargoResult<()>, ) -> CargoResult<()> { - state.capture_output(&cmd, None, false).map(drop) + cmd.exec_with_streaming(on_stdout_line, on_stderr_line, false) + .map(drop) } } @@ -141,35 +121,31 @@ fingerprint::prepare_init(cx, unit)?; cx.links.validate(bcx.resolve, unit)?; - let (dirty, fresh, freshness) = if unit.mode.is_run_custom_build() { + let job = if unit.mode.is_run_custom_build() { custom_build::prepare(cx, unit)? } else if unit.mode == CompileMode::Doctest { // We run these targets later, so this is just a no-op for now. - (Work::noop(), Work::noop(), Freshness::Fresh) + Job::new(Work::noop(), Freshness::Fresh) } else if build_plan { - ( - rustc(cx, unit, &exec.clone())?, - Work::noop(), - Freshness::Dirty, - ) + Job::new(rustc(cx, unit, &exec.clone())?, Freshness::Dirty) } else { - let (mut freshness, dirty, fresh) = fingerprint::prepare_target(cx, unit)?; - let work = if unit.mode.is_doc() { - rustdoc(cx, unit)? + let force = exec.force_rebuild(unit) || force_rebuild; + let mut job = fingerprint::prepare_target(cx, unit, force)?; + job.before(if job.freshness() == Freshness::Dirty { + let work = if unit.mode.is_doc() { + rustdoc(cx, unit)? + } else { + rustc(cx, unit, exec)? + }; + work.then(link_targets(cx, unit, false)?) } else { - rustc(cx, unit, exec)? - }; - // Need to link targets on both the dirty and fresh. - let dirty = work.then(link_targets(cx, unit, false)?).then(dirty); - let fresh = link_targets(cx, unit, true)?.then(fresh); - - if exec.force_rebuild(unit) || force_rebuild { - freshness = Freshness::Dirty; - } + // Need to link targets on both the dirty and fresh. + link_targets(cx, unit, true)? + }); - (dirty, fresh, freshness) + job }; - jobs.enqueue(cx, unit, Job::new(dirty, fresh), freshness)?; + jobs.enqueue(cx, unit, job)?; drop(p); // Be sure to compile all dependencies of this target as well. @@ -211,6 +187,7 @@ // If we are a binary and the package also contains a library, then we // don't pass the `-l` flags. let pass_l_flag = unit.target.is_lib() || !unit.pkg.targets().iter().any(|t| t.is_lib()); + let pass_cdylib_link_args = unit.target.is_cdylib(); let do_rename = unit.target.allows_underscores() && !unit.mode.is_any_test(); let real_name = unit.target.name().to_string(); let crate_name = unit.target.crate_name(); @@ -224,8 +201,7 @@ .with_extension("d"); let dep_info_loc = fingerprint::dep_info_loc(cx, unit); - rustc.args(&cx.bcx.rustflags_args(unit)?); - let json_messages = cx.bcx.build_config.json_messages(); + rustc.args(cx.bcx.rustflags_args(unit)); let package_id = unit.pkg.package_id(); let target = unit.target.clone(); let mode = unit.mode; @@ -233,12 +209,55 @@ exec.init(cx, unit); let exec = exec.clone(); - let root_output = cx.files().target_root().to_path_buf(); + let root_output = cx.files().host_root().to_path_buf(); let pkg_root = unit.pkg.root().to_path_buf(); let cwd = rustc .get_cwd() .unwrap_or_else(|| cx.bcx.config.cwd()) .to_path_buf(); + let fingerprint_dir = cx.files().fingerprint_dir(unit); + let rmeta_produced = cx.rmeta_required(unit); + + // If this unit is producing a required rmeta file then we need to know + // when the rmeta file is ready so we can signal to the rest of Cargo that + // it can continue dependant compilations. To do this we are currently + // required to switch the compiler into JSON message mode, but we still + // want to present human readable errors as well. (this rabbit hole just + // goes and goes) + // + // All that means is that if we're not already in JSON mode we need to + // switch to JSON mode, ensure that rustc error messages can be rendered + // prettily, and then when parsing JSON messages from rustc we need to + // internally understand that we should extract the `rendered` field and + // present it if we can. + let extract_rendered_errors = if rmeta_produced { + match cx.bcx.build_config.message_format { + MessageFormat::Json => { + rustc.arg("-Zemit-artifact-notifications"); + false + } + MessageFormat::Human => { + rustc + .arg("--error-format=json") + .arg("--json-rendered=termcolor") + .arg("-Zunstable-options") + .arg("-Zemit-artifact-notifications"); + true + } + + // FIXME(rust-lang/rust#60419): right now we have no way of turning + // on JSON messages from the compiler and also asking the rendered + // field to be in the `short` format. + MessageFormat::Short => { + bail!( + "currently `--message-format short` is incompatible with \ + pipelined compilation" + ); + } + } + } else { + false + }; return Ok(Work::new(move |state| { // Only at runtime have we discovered what the extra -L and -l @@ -256,6 +275,7 @@ &build_state, &build_deps, pass_l_flag, + pass_cdylib_link_args, current_id, )?; add_plugin_deps(&mut rustc, &build_state, &build_deps, &root_output)?; @@ -289,24 +309,29 @@ } state.running(&rustc); - let timestamp = paths::get_current_filesystem_time(&dep_info_loc)?; - if json_messages { - exec.exec_json( + let timestamp = paths::set_invocation_time(&fingerprint_dir)?; + if build_plan { + state.build_plan(buildkey, rustc.clone(), outputs.clone()); + } else { + exec.exec( rustc, package_id, &target, mode, - &mut assert_is_empty, - &mut |line| json_stderr(line, package_id, &target), + &mut |line| on_stdout_line(state, line, package_id, &target), + &mut |line| { + on_stderr_line( + state, + line, + package_id, + &target, + extract_rendered_errors, + rmeta_produced, + ) + }, ) .map_err(internal_if_simple_exit_code) .chain_err(|| format!("Could not compile `{}`.", name))?; - } else if build_plan { - state.build_plan(buildkey, rustc.clone(), outputs.clone()); - } else { - exec.exec_and_capture_output(rustc, package_id, &target, mode, state) - .map_err(internal_if_simple_exit_code) - .chain_err(|| format!("Could not compile `{}`.", name))?; } if do_rename && real_name != crate_name { @@ -345,6 +370,7 @@ build_state: &BuildMap, build_scripts: &BuildScripts, pass_l_flag: bool, + pass_cdylib_link_args: bool, current_id: PackageId, ) -> CargoResult<()> { for key in build_scripts.to_link.iter() { @@ -366,6 +392,12 @@ rustc.arg("-l").arg(name); } } + if pass_cdylib_link_args { + for arg in output.linker_args.iter() { + let link_arg = format!("link-arg={}", arg); + rustc.arg("-C").arg(link_arg); + } + } } } Ok(()) @@ -417,7 +449,7 @@ target.set_src_path(TargetSourcePath::Path(path)); } - Ok(Work::new(move |_| { + Ok(Work::new(move |state| { // If we're a "root crate", e.g., the target of this compilation, then we // hard link our outputs out of the `deps` directory into the directory // above. This means that `cargo build` will produce binaries in @@ -458,7 +490,7 @@ test: unit_mode.is_any_test(), }; - machine_message::emit(&machine_message::Artifact { + let msg = machine_message::Artifact { package_id, target: &target, profile: art_profile, @@ -466,7 +498,9 @@ filenames: destinations, executable, fresh, - }); + } + .to_json_string(); + state.stdout(&msg); } Ok(()) })) @@ -628,20 +662,19 @@ rustdoc.arg("--cfg").arg(&format!("feature=\"{}\"", feat)); } - add_error_format(bcx, &mut rustdoc); + add_error_format(cx, &mut rustdoc); - if let Some(ref args) = bcx.extra_args_for(unit) { + if let Some(args) = bcx.extra_args_for(unit) { rustdoc.args(args); } build_deps_args(&mut rustdoc, cx, unit)?; - rustdoc.args(&bcx.rustdocflags_args(unit)?); + rustdoc.args(bcx.rustdocflags_args(unit)); let name = unit.pkg.name().to_string(); let build_state = cx.build_state.clone(); let key = (unit.pkg.package_id(), unit.kind); - let json_messages = bcx.build_config.json_messages(); let package_id = unit.pkg.package_id(); let target = unit.target.clone(); @@ -656,18 +689,13 @@ } state.running(&rustdoc); - let exec_result = if json_messages { - rustdoc - .exec_with_streaming( - &mut assert_is_empty, - &mut |line| json_stderr(line, package_id, &target), - false, - ) - .map(drop) - } else { - state.capture_output(&rustdoc, None, false).map(drop) - }; - exec_result.chain_err(|| format!("Could not document `{}`.", name))?; + rustdoc + .exec_with_streaming( + &mut |line| on_stdout_line(state, line, package_id, &target), + &mut |line| on_stderr_line(state, line, package_id, &target, false, false), + false, + ) + .chain_err(|| format!("Could not document `{}`.", name))?; Ok(()) })) } @@ -730,8 +758,8 @@ cmd.args(&["--color", color]); } -fn add_error_format(bcx: &BuildContext<'_, '_>, cmd: &mut ProcessBuilder) { - match bcx.build_config.message_format { +fn add_error_format(cx: &Context<'_, '_>, cmd: &mut ProcessBuilder) { + match cx.bcx.build_config.message_format { MessageFormat::Human => (), MessageFormat::Json => { cmd.arg("--error-format").arg("json"); @@ -769,7 +797,7 @@ add_path_args(bcx, unit, cmd); add_color(bcx, cmd); - add_error_format(bcx, cmd); + add_error_format(cx, cmd); if !test { for crate_type in crate_types.iter() { @@ -779,6 +807,11 @@ if unit.mode.is_check() { cmd.arg("--emit=dep-info,metadata"); + } else if !unit.target.requires_upstream_objects() { + // Always produce metdata files for rlib outputs. Metadata may be used + // in this session for a pipelined compilation, or it may be used in a + // future Cargo session as part of a pipelined compile. + cmd.arg("--emit=dep-info,metadata,link"); } else { cmd.arg("--emit=dep-info,link"); } @@ -793,7 +826,7 @@ cmd.arg("-C").arg(&format!("opt-level={}", opt_level)); } - if let Some(panic) = panic.as_ref() { + if *panic != PanicStrategy::Unwind { cmd.arg("-C").arg(format!("panic={}", panic)); } @@ -821,7 +854,7 @@ cmd.arg("-C").arg(format!("debuginfo={}", debuginfo)); } - if let Some(ref args) = bcx.extra_args_for(unit) { + if let Some(args) = bcx.extra_args_for(unit) { cmd.args(args); } @@ -957,15 +990,23 @@ } } + let mut unstable_opts = false; + for dep in dep_targets { if dep.mode.is_run_custom_build() { cmd.env("OUT_DIR", &cx.files().build_script_out_dir(&dep)); } if dep.target.linkable() && !dep.mode.is_doc() { - link_to(cmd, cx, unit, &dep)?; + link_to(cmd, cx, unit, &dep, &mut unstable_opts)?; } } + // This will only be set if we're already using a feature + // requiring nightly rust + if unstable_opts { + cmd.arg("-Z").arg("unstable-options"); + } + return Ok(()); fn link_to<'a, 'cfg>( @@ -973,20 +1014,52 @@ cx: &mut Context<'a, 'cfg>, current: &Unit<'a>, dep: &Unit<'a>, + need_unstable_opts: &mut bool, ) -> CargoResult<()> { let bcx = cx.bcx; - for output in cx.outputs(dep)?.iter() { - if output.flavor != FileFlavor::Linkable { - continue; + + let mut value = OsString::new(); + value.push(bcx.extern_crate_name(current, dep)?); + value.push("="); + + let mut pass = |file| { + let mut value = value.clone(); + value.push(file); + + if current + .pkg + .manifest() + .features() + .require(Feature::public_dependency()) + .is_ok() + && !bcx.is_public_dependency(current, dep) + { + cmd.arg("--extern-private"); + *need_unstable_opts = true; + } else { + cmd.arg("--extern"); + } + + cmd.arg(&value); + }; + + let outputs = cx.outputs(dep)?; + let mut outputs = outputs.iter().filter_map(|output| match output.flavor { + FileFlavor::Linkable { rmeta } => Some((output, rmeta)), + _ => None, + }); + + if cx.only_requires_rmeta(current, dep) { + let (output, _rmeta) = outputs + .find(|(_output, rmeta)| *rmeta) + .expect("failed to find rlib dep for pipelined dep"); + pass(&output.path); + } else { + for (output, rmeta) in outputs { + if !rmeta { + pass(&output.path); + } } - let mut v = OsString::new(); - let name = bcx.extern_crate_name(current, dep)?; - v.push(name); - v.push("="); - v.push(cx.files().out_dir(dep)); - v.push(&path::MAIN_SEPARATOR.to_string()); - v.push(&output.path.file_name().unwrap()); - cmd.arg("--extern").arg(&v); } Ok(()) } @@ -1012,32 +1085,98 @@ } } -fn assert_is_empty(line: &str) -> CargoResult<()> { - if !line.is_empty() { - Err(internal(&format!( - "compiler stdout is not empty: `{}`", - line - ))) - } else { - Ok(()) - } +fn on_stdout_line( + state: &JobState<'_>, + line: &str, + _package_id: PackageId, + _target: &Target, +) -> CargoResult<()> { + state.stdout(line); + Ok(()) } -fn json_stderr(line: &str, package_id: PackageId, target: &Target) -> CargoResult<()> { - // Stderr from rustc/rustdoc can have a mix of JSON and non-JSON output. - if line.starts_with('{') { - // Handle JSON lines. - let compiler_message = serde_json::from_str(line) - .map_err(|_| internal(&format!("compiler produced invalid json: `{}`", line)))?; - - machine_message::emit(&machine_message::FromCompiler { - package_id, - target, - message: compiler_message, - }); - } else { - // Forward non-JSON to stderr. - writeln!(io::stderr(), "{}", line)?; +fn on_stderr_line( + state: &JobState<'_>, + line: &str, + package_id: PackageId, + target: &Target, + extract_rendered_messages: bool, + look_for_metadata_directive: bool, +) -> CargoResult<()> { + // We primarily want to use this function to process JSON messages from + // rustc. The compiler should always print one JSON message per line, and + // otherwise it may have other output intermingled (think RUST_LOG or + // something like that), so skip over everything that doesn't look like a + // JSON message. + if !line.starts_with('{') { + state.stderr(line); + return Ok(()); } + + let compiler_message: Box = match serde_json::from_str(line) { + Ok(msg) => msg, + + // If the compiler produced a line that started with `{` but it wasn't + // valid JSON, maybe it wasn't JSON in the first place! Forward it along + // to stderr. + Err(_) => { + state.stderr(line); + return Ok(()); + } + }; + + // In some modes of compilation Cargo switches the compiler to JSON mode + // but the user didn't request that so we still want to print pretty rustc + // colorized diagnostics. In those cases (`extract_rendered_messages`) we + // take a look at the JSON blob we go, see if it's a relevant diagnostics, + // and if so forward just that diagnostic for us to print. + if extract_rendered_messages { + #[derive(serde::Deserialize)] + struct CompilerMessage { + rendered: String, + } + if let Ok(error) = serde_json::from_str::(compiler_message.get()) { + state.stderr(&error.rendered); + return Ok(()); + } + } + + // In some modes of execution we will execute rustc with `-Z + // emit-artifact-notifications` to look for metadata files being produced. When this + // happens we may be able to start subsequent compilations more quickly than + // waiting for an entire compile to finish, possibly using more parallelism + // available to complete a compilation session more quickly. + // + // In these cases look for a matching directive and inform Cargo internally + // that a metadata file has been produced. + if look_for_metadata_directive { + #[derive(serde::Deserialize)] + struct ArtifactNotification { + artifact: String, + } + if let Ok(artifact) = serde_json::from_str::(compiler_message.get()) { + log::trace!("found directive from rustc: `{}`", artifact.artifact); + if artifact.artifact.ends_with(".rmeta") { + log::debug!("looks like metadata finished early!"); + state.rmeta_produced(); + } + return Ok(()); + } + } + + // And failing all that above we should have a legitimate JSON diagnostic + // from the compiler, so wrap it in an external Cargo JSON message + // indicating which package it came from and then emit it. + let msg = machine_message::FromCompiler { + package_id, + target, + message: compiler_message, + } + .to_json_string(); + + // Switch json lines from rustc/rustdoc that appear on stderr to stdout + // instead. We want the stdout of Cargo to always be machine parseable as + // stderr has our colorized human-readable messages. + state.stdout(&msg); Ok(()) } diff -Nru cargo-0.35.0/src/cargo/core/compiler/output_depinfo.rs cargo-0.37.0/src/cargo/core/compiler/output_depinfo.rs --- cargo-0.35.0/src/cargo/core/compiler/output_depinfo.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/compiler/output_depinfo.rs 2019-05-15 19:48:47.000000000 +0000 @@ -39,7 +39,7 @@ if !unit.mode.is_run_custom_build() { // Add dependencies from rustc dep-info output (stored in fingerprint directory) let dep_info_loc = fingerprint::dep_info_loc(context, unit); - if let Some(paths) = fingerprint::parse_dep_info(unit.pkg, &dep_info_loc)? { + if let Some(paths) = fingerprint::parse_dep_info(unit.pkg.root(), &dep_info_loc)? { for path in paths { deps.insert(path); } diff -Nru cargo-0.35.0/src/cargo/core/compiler/unit.rs cargo-0.37.0/src/cargo/core/compiler/unit.rs --- cargo-0.35.0/src/cargo/core/compiler/unit.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/compiler/unit.rs 2019-05-15 19:48:47.000000000 +0000 @@ -0,0 +1,171 @@ +use crate::core::compiler::{CompileMode, Kind}; +use crate::core::{profiles::Profile, Package, Target}; +use crate::util::hex::short_hash; +use std::cell::RefCell; +use std::collections::HashSet; +use std::fmt; +use std::hash::{Hash, Hasher}; +use std::ops::Deref; + +/// All information needed to define a unit. +/// +/// A unit is an object that has enough information so that cargo knows how to build it. +/// For example, if your package has dependencies, then every dependency will be built as a library +/// unit. If your package is a library, then it will be built as a library unit as well, or if it +/// is a binary with `main.rs`, then a binary will be output. There are also separate unit types +/// for `test`ing and `check`ing, amongst others. +/// +/// The unit also holds information about all possible metadata about the package in `pkg`. +/// +/// A unit needs to know extra information in addition to the type and root source file. For +/// example, it needs to know the target architecture (OS, chip arch etc.) and it needs to know +/// whether you want a debug or release build. There is enough information in this struct to figure +/// all that out. +#[derive(Clone, Copy, PartialOrd, Ord)] +pub struct Unit<'a> { + inner: &'a UnitInner<'a>, +} + +/// Internal fields of `Unit` which `Unit` will dereference to. +#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] +pub struct UnitInner<'a> { + /// Information about available targets, which files to include/exclude, etc. Basically stuff in + /// `Cargo.toml`. + pub pkg: &'a Package, + /// Information about the specific target to build, out of the possible targets in `pkg`. Not + /// to be confused with *target-triple* (or *target architecture* ...), the target arch for a + /// build. + pub target: &'a Target, + /// The profile contains information about *how* the build should be run, including debug + /// level, etc. + pub profile: Profile, + /// Whether this compilation unit is for the host or target architecture. + /// + /// For example, when + /// cross compiling and using a custom build script, the build script needs to be compiled for + /// the host architecture so the host rustc can use it (when compiling to the target + /// architecture). + pub kind: Kind, + /// The "mode" this unit is being compiled for. See [`CompileMode`] for more details. + pub mode: CompileMode, +} + +impl<'a> Unit<'a> { + pub fn buildkey(&self) -> String { + format!("{}-{}", self.pkg.name(), short_hash(self)) + } +} + +// Just hash the pointer for fast hashing +impl<'a> Hash for Unit<'a> { + fn hash(&self, hasher: &mut H) { + (self.inner as *const UnitInner<'a>).hash(hasher) + } +} + +// Just equate the pointer since these are interned +impl<'a> PartialEq for Unit<'a> { + fn eq(&self, other: &Unit<'a>) -> bool { + self.inner as *const UnitInner<'a> == other.inner as *const UnitInner<'a> + } +} + +impl<'a> Eq for Unit<'a> {} + +impl<'a> Deref for Unit<'a> { + type Target = UnitInner<'a>; + + fn deref(&self) -> &UnitInner<'a> { + self.inner + } +} + +impl<'a> fmt::Debug for Unit<'a> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Unit") + .field("pkg", &self.pkg) + .field("target", &self.target) + .field("profile", &self.profile) + .field("kind", &self.kind) + .field("mode", &self.mode) + .finish() + } +} + +/// A small structure used to "intern" `Unit` values. +/// +/// A `Unit` is just a thin pointer to an internal `UnitInner`. This is done to +/// ensure that `Unit` itself is quite small as well as enabling a very +/// efficient hash/equality implementation for `Unit`. All units are +/// manufactured through an interner which guarantees that each equivalent value +/// is only produced once. +pub struct UnitInterner<'a> { + state: RefCell>, +} + +struct InternerState<'a> { + cache: HashSet>>, +} + +impl<'a> UnitInterner<'a> { + /// Creates a new blank interner + pub fn new() -> UnitInterner<'a> { + UnitInterner { + state: RefCell::new(InternerState { + cache: HashSet::new(), + }), + } + } + + /// Creates a new `unit` from its components. The returned `Unit`'s fields + /// will all be equivalent to the provided arguments, although they may not + /// be the exact same instance. + pub fn intern( + &'a self, + pkg: &'a Package, + target: &'a Target, + profile: Profile, + kind: Kind, + mode: CompileMode, + ) -> Unit<'a> { + let inner = self.intern_inner(&UnitInner { + pkg, + target, + profile, + kind, + mode, + }); + Unit { inner } + } + + // Ok so interning here is a little unsafe, hence the usage of `unsafe` + // internally. The primary issue here is that we've got an internal cache of + // `UnitInner` instances added so far, but we may need to mutate it to add + // it, and the mutation for an interner happens behind a shared borrow. + // + // Our goal though is to escape the lifetime `borrow_mut` to the same + // lifetime as the borrowed passed into this function. That's where `unsafe` + // comes into play. What we're subverting here is resizing internally in the + // `HashSet` as well as overwriting previous keys in the `HashSet`. + // + // As a result we store `Box` internally to have an extra layer + // of indirection. That way `*const UnitInner` is a stable address that + // doesn't change with `HashSet` resizing. Furthermore we're careful to + // never overwrite an entry once inserted. + // + // Ideally we'd use an off-the-shelf interner from crates.io which avoids a + // small amount of unsafety here, but at the time this was written one + // wasn't obviously available. + fn intern_inner(&'a self, item: &UnitInner<'a>) -> &'a UnitInner<'a> { + let mut me = self.state.borrow_mut(); + if let Some(item) = me.cache.get(item) { + // note that `item` has type `&Box`. Use `&**` to + // convert that to `&UnitInner<'a>`, then do some trickery to extend + // the lifetime to the `'a` on the function here. + return unsafe { &*(&**item as *const UnitInner<'a>) }; + } + me.cache.insert(Box::new(item.clone())); + let item = me.cache.get(item).unwrap(); + return unsafe { &*(&**item as *const UnitInner<'a>) }; + } +} diff -Nru cargo-0.35.0/src/cargo/core/dependency.rs cargo-0.37.0/src/cargo/core/dependency.rs --- cargo-0.35.0/src/cargo/core/dependency.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/dependency.rs 2019-05-15 19:48:47.000000000 +0000 @@ -40,6 +40,7 @@ explicit_name_in_toml: Option, optional: bool, + public: bool, default_features: bool, features: Vec, @@ -217,6 +218,7 @@ kind: Kind::Normal, only_match_name: true, optional: false, + public: false, features: Vec::new(), default_features: true, specified_req: false, @@ -293,6 +295,20 @@ self.inner.kind } + pub fn is_public(&self) -> bool { + self.inner.public + } + + /// Sets whether the dependency is public. + pub fn set_public(&mut self, public: bool) -> &mut Dependency { + if public { + // Setting 'public' only makes sense for normal dependencies + assert_eq!(self.kind(), Kind::Normal); + } + Rc::make_mut(&mut self.inner).public = public; + self + } + pub fn specified_req(&self) -> bool { self.inner.specified_req } diff -Nru cargo-0.35.0/src/cargo/core/features.rs cargo-0.37.0/src/cargo/core/features.rs --- cargo-0.35.0/src/cargo/core/features.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/features.rs 2019-05-15 19:48:47.000000000 +0000 @@ -55,6 +55,10 @@ use crate::util::errors::CargoResult; +pub const SEE_CHANNELS: &str = + "See https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information \ + about Rust release channels."; + /// The edition of the compiler (RFC 2052) #[derive(Clone, Copy, Debug, Hash, PartialOrd, Ord, Eq, PartialEq, Serialize, Deserialize)] pub enum Edition { @@ -195,6 +199,9 @@ // Declarative build scripts. [unstable] metabuild: bool, + + // Specifying the 'public' attribute on dependencies + [unstable] public_dependency: bool, } } @@ -235,9 +242,11 @@ } Status::Unstable if !nightly_features_allowed() => failure::bail!( "the cargo feature `{}` requires a nightly version of \ - Cargo, but this is the `{}` channel", + Cargo, but this is the `{}` channel\n\ + {}", feature, - channel() + channel(), + SEE_CHANNELS ), Status::Unstable => {} } @@ -313,7 +322,6 @@ pub struct CliUnstable { pub print_im_a_teapot: bool, pub unstable_options: bool, - pub offline: bool, pub no_index_update: bool, pub avoid_dev_deps: bool, pub minimal_versions: bool, @@ -322,12 +330,19 @@ pub config_profile: bool, pub dual_proc_macros: bool, pub mtime_on_use: bool, + pub install_upgrade: bool, } impl CliUnstable { pub fn parse(&mut self, flags: &[String]) -> CargoResult<()> { if !flags.is_empty() && !nightly_features_allowed() { - failure::bail!("the `-Z` flag is only accepted on the nightly channel of Cargo") + failure::bail!( + "the `-Z` flag is only accepted on the nightly channel of Cargo, \ + but this is the `{}` channel\n\ + {}", + channel(), + SEE_CHANNELS + ); } for flag in flags { self.add(flag)?; @@ -351,7 +366,6 @@ match k { "print-im-a-teapot" => self.print_im_a_teapot = parse_bool(v)?, "unstable-options" => self.unstable_options = true, - "offline" => self.offline = true, "no-index-update" => self.no_index_update = true, "avoid-dev-deps" => self.avoid_dev_deps = true, "minimal-versions" => self.minimal_versions = true, @@ -360,14 +374,49 @@ "config-profile" => self.config_profile = true, "dual-proc-macros" => self.dual_proc_macros = true, "mtime-on-use" => self.mtime_on_use = true, + "install-upgrade" => self.install_upgrade = true, _ => failure::bail!("unknown `-Z` flag specified: {}", k), } Ok(()) } + + /// Generates an error if `-Z unstable-options` was not used. + /// Intended to be used when a user passes a command-line flag that + /// requires `-Z unstable-options`. + pub fn fail_if_stable_opt(&self, flag: &str, issue: u32) -> CargoResult<()> { + if !self.unstable_options { + let see = format!( + "See https://github.com/rust-lang/cargo/issues/{} for more \ + information about the `{}` flag.", + issue, flag + ); + if nightly_features_allowed() { + failure::bail!( + "the `{}` flag is unstable, pass `-Z unstable-options` to enable it\n\ + {}", + flag, + see + ); + } else { + failure::bail!( + "the `{}` flag is unstable, and only available on the nightly channel \ + of Cargo, but this is the `{}` channel\n\ + {}\n\ + {}", + flag, + channel(), + SEE_CHANNELS, + see + ); + } + } + Ok(()) + } } -fn channel() -> String { +/// Returns the current release channel ("stable", "beta", "nightly", "dev"). +pub fn channel() -> String { if let Ok(override_channel) = env::var("__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS") { return override_channel; } diff -Nru cargo-0.35.0/src/cargo/core/interning.rs cargo-0.37.0/src/cargo/core/interning.rs --- cargo-0.35.0/src/cargo/core/interning.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/interning.rs 2019-05-15 19:48:47.000000000 +0000 @@ -67,7 +67,7 @@ impl Borrow for InternedString { // If we implement Hash as `identity(self).hash(state)`, - // then this will nead to be removed. + // then this will need to be removed. fn borrow(&self) -> &str { self.as_str() } diff -Nru cargo-0.35.0/src/cargo/core/manifest.rs cargo-0.37.0/src/cargo/core/manifest.rs --- cargo-0.35.0/src/cargo/core/manifest.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/manifest.rs 2019-05-15 19:48:47.000000000 +0000 @@ -120,6 +120,19 @@ LibKind::Other(..) => false, } } + + pub fn requires_upstream_objects(&self) -> bool { + match *self { + // "lib" == "rlib" and is a compilation that doesn't actually + // require upstream object files to exist, only upstream metadata + // files. As a result, it doesn't require upstream artifacts + LibKind::Lib | LibKind::Rlib => false, + + // Everything else, however, is some form of "linkable output" or + // something that requires upstream object files. + _ => true, + } + } } impl fmt::Debug for LibKind { @@ -428,6 +441,9 @@ pub fn summary(&self) -> &Summary { &self.summary } + pub fn summary_mut(&mut self) -> &mut Summary { + &mut self.summary + } pub fn targets(&self) -> &[Target] { &self.targets } @@ -470,10 +486,6 @@ &self.features } - pub fn set_summary(&mut self, summary: Summary) { - self.summary = summary; - } - pub fn map_source(self, to_replace: SourceId, replace_with: SourceId) -> Manifest { Manifest { summary: self.summary.map_source(to_replace, replace_with), @@ -796,6 +808,10 @@ }) } + /// Returns whether this target produces an artifact which can be linked + /// into a Rust crate. + /// + /// This only returns true for certain kinds of libraries. pub fn linkable(&self) -> bool { match self.kind { TargetKind::Lib(ref kinds) => kinds.iter().any(|k| k.linkable()), @@ -803,6 +819,20 @@ } } + /// Returns whether production of this artifact requires the object files + /// from dependencies to be available. + /// + /// This only returns `false` when all we're producing is an rlib, otherwise + /// it will return `true`. + pub fn requires_upstream_objects(&self) -> bool { + match &self.kind { + TargetKind::Lib(kinds) | TargetKind::ExampleLib(kinds) => { + kinds.iter().any(|k| k.requires_upstream_objects()) + } + _ => true, + } + } + pub fn is_bin(&self) -> bool { self.kind == TargetKind::Bin } @@ -814,7 +844,14 @@ } } - pub fn is_bin_example(&self) -> bool { + /// Returns `true` if it is a binary or executable example. + /// NOTE: Tests are `false`! + pub fn is_executable(&self) -> bool { + self.is_bin() || self.is_exe_example() + } + + /// Returns `true` if it is an executable example. + pub fn is_exe_example(&self) -> bool { // Needed for --all-examples in contexts where only runnable examples make sense match self.kind { TargetKind::ExampleBin => true, diff -Nru cargo-0.35.0/src/cargo/core/mod.rs cargo-0.37.0/src/cargo/core/mod.rs --- cargo-0.35.0/src/cargo/core/mod.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/mod.rs 2019-05-15 19:48:47.000000000 +0000 @@ -3,6 +3,7 @@ enable_nightly_features, maybe_allow_nightly_features, nightly_features_allowed, }; pub use self::features::{CliUnstable, Edition, Feature, Features}; +pub use self::interning::InternedString; pub use self::manifest::{EitherManifest, VirtualManifest}; pub use self::manifest::{LibKind, Manifest, Target, TargetKind}; pub use self::package::{Package, PackageSet}; @@ -17,7 +18,7 @@ pub mod compiler; pub mod dependency; -mod features; +pub mod features; mod interning; pub mod manifest; pub mod package; diff -Nru cargo-0.35.0/src/cargo/core/package_id.rs cargo-0.37.0/src/cargo/core/package_id.rs --- cargo-0.35.0/src/cargo/core/package_id.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/package_id.rs 2019-05-15 19:48:47.000000000 +0000 @@ -224,7 +224,18 @@ let pkg_id = PackageId::new("foo", "1.0.0", SourceId::for_registry(&loc).unwrap()).unwrap(); assert_eq!(r#"PackageId { name: "foo", version: "1.0.0", source: "registry `https://github.com/rust-lang/crates.io-index`" }"#, format!("{:?}", pkg_id)); - let pretty = r#" + let expected = r#" +PackageId { + name: "foo", + version: "1.0.0", + source: "registry `https://github.com/rust-lang/crates.io-index`", +} +"# + .trim(); + + // Can be removed once trailing commas in Debug have reached the stable + // channel. + let expected_without_trailing_comma = r#" PackageId { name: "foo", version: "1.0.0", @@ -232,7 +243,13 @@ } "# .trim(); - assert_eq!(pretty, format!("{:#?}", pkg_id)); + + let actual = format!("{:#?}", pkg_id); + if actual.ends_with(",\n}") { + assert_eq!(actual, expected); + } else { + assert_eq!(actual, expected_without_trailing_comma); + } } #[test] diff -Nru cargo-0.35.0/src/cargo/core/package_id_spec.rs cargo-0.37.0/src/cargo/core/package_id_spec.rs --- cargo-0.35.0/src/cargo/core/package_id_spec.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/package_id_spec.rs 2019-05-15 19:48:47.000000000 +0000 @@ -5,6 +5,7 @@ use serde::{de, ser}; use url::Url; +use crate::core::interning::InternedString; use crate::core::PackageId; use crate::util::errors::{CargoResult, CargoResultExt}; use crate::util::{validate_package_name, ToSemver, ToUrl}; @@ -20,7 +21,7 @@ /// sufficient to uniquely define a package ID. #[derive(Clone, PartialEq, Eq, Debug, Hash, Ord, PartialOrd)] pub struct PackageIdSpec { - name: String, + name: InternedString, version: Option, url: Option, } @@ -35,8 +36,8 @@ /// use cargo::core::PackageIdSpec; /// /// let specs = vec![ - /// "http://crates.io/foo#1.2.3", - /// "http://crates.io/foo#bar:1.2.3", + /// "https://crates.io/foo#1.2.3", + /// "https://crates.io/foo#bar:1.2.3", /// "crates.io/foo", /// "crates.io/foo#1.2.3", /// "crates.io/foo#bar", @@ -66,7 +67,7 @@ }; validate_package_name(name, "pkgid", "")?; Ok(PackageIdSpec { - name: name.to_string(), + name: InternedString::new(name), version, url: None, }) @@ -86,7 +87,7 @@ /// fields filled in. pub fn from_package_id(package_id: PackageId) -> PackageIdSpec { PackageIdSpec { - name: package_id.name().to_string(), + name: package_id.name(), version: Some(package_id.version().clone()), url: Some(package_id.source_id().url().clone()), } @@ -117,19 +118,19 @@ match parts.next() { Some(part) => { let version = part.to_semver()?; - (name_or_version.to_string(), Some(version)) + (InternedString::new(name_or_version), Some(version)) } None => { if name_or_version.chars().next().unwrap().is_alphabetic() { - (name_or_version.to_string(), None) + (InternedString::new(name_or_version), None) } else { let version = name_or_version.to_semver()?; - (path_name.to_string(), Some(version)) + (InternedString::new(path_name), Some(version)) } } } } - None => (path_name.to_string(), None), + None => (InternedString::new(path_name), None), } }; Ok(PackageIdSpec { @@ -139,8 +140,8 @@ }) } - pub fn name(&self) -> &str { - &self.name + pub fn name(&self) -> InternedString { + self.name } pub fn version(&self) -> Option<&Version> { @@ -157,7 +158,7 @@ /// Checks whether the given `PackageId` matches the `PackageIdSpec`. pub fn matches(&self, package_id: PackageId) -> bool { - if self.name() != &*package_id.name() { + if self.name() != package_id.name() { return false; } @@ -234,7 +235,7 @@ } else { write!(f, "{}", url)?; } - if url.path_segments().unwrap().next_back().unwrap() != self.name { + if url.path_segments().unwrap().next_back().unwrap() != &*self.name { printed_name = true; write!(f, "#{}", self.name)?; } @@ -273,6 +274,7 @@ #[cfg(test)] mod tests { use super::PackageIdSpec; + use crate::core::interning::InternedString; use crate::core::{PackageId, SourceId}; use crate::util::ToSemver; use url::Url; @@ -286,25 +288,25 @@ } ok( - "http://crates.io/foo#1.2.3", + "https://crates.io/foo#1.2.3", PackageIdSpec { - name: "foo".to_string(), + name: InternedString::new("foo"), version: Some("1.2.3".to_semver().unwrap()), - url: Some(Url::parse("http://crates.io/foo").unwrap()), + url: Some(Url::parse("https://crates.io/foo").unwrap()), }, ); ok( - "http://crates.io/foo#bar:1.2.3", + "https://crates.io/foo#bar:1.2.3", PackageIdSpec { - name: "bar".to_string(), + name: InternedString::new("bar"), version: Some("1.2.3".to_semver().unwrap()), - url: Some(Url::parse("http://crates.io/foo").unwrap()), + url: Some(Url::parse("https://crates.io/foo").unwrap()), }, ); ok( "crates.io/foo", PackageIdSpec { - name: "foo".to_string(), + name: InternedString::new("foo"), version: None, url: Some(Url::parse("cargo://crates.io/foo").unwrap()), }, @@ -312,7 +314,7 @@ ok( "crates.io/foo#1.2.3", PackageIdSpec { - name: "foo".to_string(), + name: InternedString::new("foo"), version: Some("1.2.3".to_semver().unwrap()), url: Some(Url::parse("cargo://crates.io/foo").unwrap()), }, @@ -320,7 +322,7 @@ ok( "crates.io/foo#bar", PackageIdSpec { - name: "bar".to_string(), + name: InternedString::new("bar"), version: None, url: Some(Url::parse("cargo://crates.io/foo").unwrap()), }, @@ -328,7 +330,7 @@ ok( "crates.io/foo#bar:1.2.3", PackageIdSpec { - name: "bar".to_string(), + name: InternedString::new("bar"), version: Some("1.2.3".to_semver().unwrap()), url: Some(Url::parse("cargo://crates.io/foo").unwrap()), }, @@ -336,7 +338,7 @@ ok( "foo", PackageIdSpec { - name: "foo".to_string(), + name: InternedString::new("foo"), version: None, url: None, }, @@ -344,7 +346,7 @@ ok( "foo:1.2.3", PackageIdSpec { - name: "foo".to_string(), + name: InternedString::new("foo"), version: Some("1.2.3".to_semver().unwrap()), url: None, }, @@ -356,13 +358,13 @@ assert!(PackageIdSpec::parse("baz:").is_err()); assert!(PackageIdSpec::parse("baz:*").is_err()); assert!(PackageIdSpec::parse("baz:1.0").is_err()); - assert!(PackageIdSpec::parse("http://baz:1.0").is_err()); - assert!(PackageIdSpec::parse("http://#baz:1.0").is_err()); + assert!(PackageIdSpec::parse("https://baz:1.0").is_err()); + assert!(PackageIdSpec::parse("https://#baz:1.0").is_err()); } #[test] fn matching() { - let url = Url::parse("http://example.com").unwrap(); + let url = Url::parse("https://example.com").unwrap(); let sid = SourceId::for_registry(&url).unwrap(); let foo = PackageId::new("foo", "1.2.3", sid).unwrap(); let bar = PackageId::new("bar", "1.2.3", sid).unwrap(); diff -Nru cargo-0.35.0/src/cargo/core/package.rs cargo-0.37.0/src/cargo/core/package.rs --- cargo-0.35.0/src/cargo/core/package.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/package.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,4 +1,4 @@ -use std::cell::{Cell, Ref, RefCell}; +use std::cell::{Cell, Ref, RefCell, RefMut}; use std::cmp::Ordering; use std::collections::{HashMap, HashSet}; use std::fmt; @@ -22,6 +22,7 @@ use crate::core::{Dependency, Manifest, PackageId, SourceId, Target}; use crate::core::{FeatureMap, SourceMap, Summary}; use crate::ops; +use crate::util::config::PackageCacheLock; use crate::util::errors::{CargoResult, CargoResultExt, HttpNot200}; use crate::util::network::Retry; use crate::util::{self, internal, lev_distance, Config, Progress, ProgressStyle}; @@ -105,7 +106,7 @@ SerializedPackage { name: &*package_id.name(), - version: &package_id.version(), + version: package_id.version(), id: package_id, license, license_file, @@ -146,6 +147,10 @@ pub fn manifest(&self) -> &Manifest { &self.manifest } + /// Gets the manifest. + pub fn manifest_mut(&mut self) -> &mut Manifest { + &mut self.manifest + } /// Gets the path to the manifest. pub fn manifest_path(&self) -> &Path { &self.manifest_path @@ -232,6 +237,12 @@ toml )) } + + /// Returns if package should include `Cargo.lock`. + pub fn include_lockfile(&self) -> bool { + self.manifest().publish_lockfile() + && self.targets().iter().any(|t| t.is_example() || t.is_bin()) + } } impl fmt::Display for Package { @@ -263,26 +274,49 @@ } } +/// A set of packages, with the intent to download. +/// +/// This is primarily used to convert a set of `PackageId`s to `Package`s. It +/// will download as needed, or used the cached download if available. pub struct PackageSet<'cfg> { packages: HashMap>, sources: RefCell>, config: &'cfg Config, multi: Multi, + /// Used to prevent reusing the PackageSet to download twice. downloading: Cell, + /// Whether or not to use curl HTTP/2 multiplexing. multiplexing: bool, } +/// Helper for downloading crates. pub struct Downloads<'a, 'cfg: 'a> { set: &'a PackageSet<'cfg>, + /// When a download is started, it is added to this map. The key is a + /// "token" (see `Download::token`). It is removed once the download is + /// finished. pending: HashMap, EasyHandle)>, + /// Set of packages currently being downloaded. This should stay in sync + /// with `pending`. pending_ids: HashSet, + /// The final result of each download. A pair `(token, result)`. This is a + /// temporary holding area, needed because curl can report multiple + /// downloads at once, but the main loop (`wait`) is written to only + /// handle one at a time. results: Vec<(usize, Result<(), curl::Error>)>, + /// The next ID to use for creating a token (see `Download::token`). next: usize, + /// Progress bar. progress: RefCell>>, + /// Number of downloads that have successfully finished. downloads_finished: usize, + /// Total bytes for all successfully downloaded packages. downloaded_bytes: u64, + /// Size (in bytes) and package name of the largest downloaded package. largest: (u64, String), + /// Time when downloading started. start: Instant, + /// Indicates *all* downloads were successful. success: bool, /// Timeout management, both of timeout thresholds as well as whether or not @@ -291,10 +325,24 @@ /// Note that timeout management is done manually here instead of in libcurl /// because we want to apply timeouts to an entire batch of operations, not /// any one particular single operation. - timeout: ops::HttpTimeout, // timeout configuration - updated_at: Cell, // last time we received bytes - next_speed_check: Cell, // if threshold isn't 0 by this time, error - next_speed_check_bytes_threshold: Cell, // decremented when we receive bytes + timeout: ops::HttpTimeout, + /// Last time bytes were received. + updated_at: Cell, + /// This is a slow-speed check. It is reset to `now + timeout_duration` + /// every time at least `threshold` bytes are received. If the current + /// time ever exceeds `next_speed_check`, then give up and report a + /// timeout error. + next_speed_check: Cell, + /// This is the slow-speed threshold byte count. It starts at the + /// configured threshold value (default 10), and is decremented by the + /// number of bytes received in each chunk. If it is <= zero, the + /// threshold has been met and data is being received fast enough not to + /// trigger a timeout; reset `next_speed_check` and set this back to the + /// configured threshold. + next_speed_check_bytes_threshold: Cell, + /// Global filesystem lock to ensure only one Cargo is downloading at a + /// time. + _lock: PackageCacheLock<'cfg>, } struct Download<'cfg> { @@ -393,6 +441,7 @@ timeout, next_speed_check: Cell::new(Instant::now()), next_speed_check_bytes_threshold: Cell::new(0), + _lock: self.config.acquire_package_cache_lock()?, }) } @@ -416,6 +465,10 @@ pub fn sources(&self) -> Ref<'_, SourceMap<'cfg>> { self.sources.borrow() } + + pub fn sources_mut(&self) -> RefMut<'_, SourceMap<'cfg>> { + self.sources.borrow_mut() + } } // When dynamically linked against libcurl, we want to ignore some failures @@ -442,6 +495,12 @@ /// eventually be returned from `wait_for_download`. Returns `Some(pkg)` if /// the package is ready and doesn't need to be downloaded. pub fn start(&mut self, id: PackageId) -> CargoResult> { + Ok(self + .start_inner(id) + .chain_err(|| format!("failed to download `{}`", id))?) + } + + fn start_inner(&mut self, id: PackageId) -> CargoResult> { // First up see if we've already cached this package, in which case // there's nothing to do. let slot = self @@ -475,7 +534,7 @@ // Ok we're going to download this crate, so let's set up all our // internal state and hand off an `Easy` handle to our libcurl `Multi` // handle. This won't actually start the transfer, but later it'll - // hapen during `wait_for_download` + // happen during `wait_for_download` let token = self.next; self.next += 1; debug!("downloading {} as {}", id, token); @@ -711,6 +770,8 @@ Ok(()) } + /// Block, waiting for curl. Returns a token and a `Result` for that token + /// (`Ok` means the download successfully finished). fn wait_for_curl(&mut self) -> CargoResult<(usize, Result<(), curl::Error>)> { // This is the main workhorse loop. We use libcurl's portable `wait` // method to actually perform blocking. This isn't necessarily too @@ -740,7 +801,7 @@ self.set.multi.messages(|msg| { let token = msg.token().expect("failed to read token"); let handle = &pending[&token].1; - if let Some(result) = msg.result_for(&handle) { + if let Some(result) = msg.result_for(handle) { results.push((token, result)); } else { debug!("message without a result (?)"); @@ -884,13 +945,23 @@ if !self.success { return; } + // pick the correct plural of crate(s) + let crate_string = if self.downloads_finished == 1 { + "crate" + } else { + "crates" + }; let mut status = format!( - "{} crates ({}) in {}", + "{} {} ({}) in {}", self.downloads_finished, + crate_string, ByteSize(self.downloaded_bytes), util::elapsed(self.start.elapsed()) ); - if self.largest.0 > ByteSize::mb(1).0 { + // print the size of largest crate if it was >1mb + // however don't print if only a single crate was downloaded + // because it is obvious that it will be the largest then + if self.largest.0 > ByteSize::mb(1).0 && self.downloads_finished > 1 { status.push_str(&format!( " (largest was `{}` at {})", self.largest.1, diff -Nru cargo-0.35.0/src/cargo/core/profiles.rs cargo-0.37.0/src/cargo/core/profiles.rs --- cargo-0.35.0/src/cargo/core/profiles.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/profiles.rs 2019-05-15 19:48:47.000000000 +0000 @@ -111,8 +111,8 @@ let mut profile = maker.get_profile(Some(pkg_id), is_member, unit_for); // `panic` should not be set for tests/benches, or any of their // dependencies. - if !unit_for.is_panic_ok() || mode.is_any_test() { - profile.panic = None; + if !unit_for.is_panic_abort_ok() || mode.is_any_test() { + profile.panic = PanicStrategy::Unwind; } // Incremental can be globally overridden. @@ -282,7 +282,7 @@ let name_matches: Vec = packages .package_ids() .filter_map(|pkg_id| { - if pkg_id.name().as_str() == spec.name() { + if pkg_id.name() == spec.name() { Some(pkg_id.to_string()) } else { None @@ -292,7 +292,7 @@ if name_matches.is_empty() { let suggestion = packages .package_ids() - .map(|p| (lev_distance(spec.name(), &p.name()), p.name())) + .map(|p| (lev_distance(&*spec.name(), &p.name()), p.name())) .filter(|&(d, _)| d < 4) .min_by_key(|p| p.0) .map(|p| p.1); @@ -328,7 +328,7 @@ toml: &TomlProfile, ) { merge_profile(profile, toml); - if unit_for.is_custom_build() { + if unit_for.is_build() { if let Some(ref build_override) = toml.build_override { merge_profile(profile, build_override); } @@ -390,8 +390,13 @@ if let Some(rpath) = toml.rpath { profile.rpath = rpath; } - if let Some(ref panic) = toml.panic { - profile.panic = Some(InternedString::new(panic)); + if let Some(panic) = &toml.panic { + profile.panic = match panic.as_str() { + "unwind" => PanicStrategy::Unwind, + "abort" => PanicStrategy::Abort, + // This should be validated in TomlProfile::validate + _ => panic!("Unexpected panic setting `{}`", panic), + }; } if let Some(overflow_checks) = toml.overflow_checks { profile.overflow_checks = overflow_checks; @@ -415,7 +420,7 @@ pub overflow_checks: bool, pub rpath: bool, pub incremental: bool, - pub panic: Option, + pub panic: PanicStrategy, } impl Default for Profile { @@ -430,7 +435,7 @@ overflow_checks: false, rpath: false, incremental: false, - panic: None, + panic: PanicStrategy::Unwind, } } } @@ -530,26 +535,26 @@ fn comparable( &self, ) -> ( - &InternedString, - &Lto, - &Option, - &Option, - &bool, - &bool, - &bool, - &bool, - &Option, + InternedString, + Lto, + Option, + Option, + bool, + bool, + bool, + bool, + PanicStrategy, ) { ( - &self.opt_level, - &self.lto, - &self.codegen_units, - &self.debuginfo, - &self.debug_assertions, - &self.overflow_checks, - &self.rpath, - &self.incremental, - &self.panic, + self.opt_level, + self.lto, + self.codegen_units, + self.debuginfo, + self.debug_assertions, + self.overflow_checks, + self.rpath, + self.incremental, + self.panic, ) } } @@ -564,18 +569,36 @@ Named(InternedString), } +/// The `panic` setting. +#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash, PartialOrd, Ord)] +pub enum PanicStrategy { + Unwind, + Abort, +} + +impl fmt::Display for PanicStrategy { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match *self { + PanicStrategy::Unwind => "unwind", + PanicStrategy::Abort => "abort", + } + .fmt(f) + } +} + /// Flags used in creating `Unit`s to indicate the purpose for the target, and /// to ensure the target's dependencies have the correct settings. #[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] pub struct UnitFor { - /// A target for `build.rs` or any of its dependencies. This enables - /// `build-override` profiles for these targets. - custom_build: bool, - /// This is true if it is *allowed* to set the `panic` flag. Currently + /// A target for `build.rs` or any of its dependencies, or a proc-macro or + /// any of its dependencies. This enables `build-override` profiles for + /// these targets. + build: bool, + /// This is true if it is *allowed* to set the `panic=abort` flag. Currently /// this is false for test/bench targets and all their dependencies, and /// "for_host" units such as proc macro and custom build scripts and their /// dependencies. - panic_ok: bool, + panic_abort_ok: bool, } impl UnitFor { @@ -583,71 +606,71 @@ /// proc macro/plugin, or test/bench). pub fn new_normal() -> UnitFor { UnitFor { - custom_build: false, - panic_ok: true, + build: false, + panic_abort_ok: true, } } /// A unit for a custom build script or its dependencies. pub fn new_build() -> UnitFor { UnitFor { - custom_build: true, - panic_ok: false, + build: true, + panic_abort_ok: false, } } /// A unit for a proc macro or compiler plugin or their dependencies. pub fn new_compiler() -> UnitFor { UnitFor { - custom_build: false, - panic_ok: false, + build: false, + panic_abort_ok: false, } } /// A unit for a test/bench target or their dependencies. pub fn new_test() -> UnitFor { UnitFor { - custom_build: false, - panic_ok: false, + build: false, + panic_abort_ok: false, } } /// Creates a variant based on `for_host` setting. /// - /// When `for_host` is true, this clears `panic_ok` in a sticky fashion so - /// that all its dependencies also have `panic_ok=false`. + /// When `for_host` is true, this clears `panic_abort_ok` in a sticky fashion so + /// that all its dependencies also have `panic_abort_ok=false`. pub fn with_for_host(self, for_host: bool) -> UnitFor { UnitFor { - custom_build: self.custom_build, - panic_ok: self.panic_ok && !for_host, + build: self.build || for_host, + panic_abort_ok: self.panic_abort_ok && !for_host, } } /// Returns `true` if this unit is for a custom build script or one of its /// dependencies. - pub fn is_custom_build(self) -> bool { - self.custom_build + pub fn is_build(self) -> bool { + self.build } /// Returns `true` if this unit is allowed to set the `panic` compiler flag. - pub fn is_panic_ok(self) -> bool { - self.panic_ok + pub fn is_panic_abort_ok(self) -> bool { + self.panic_abort_ok } /// All possible values, used by `clean`. pub fn all_values() -> &'static [UnitFor] { static ALL: [UnitFor; 3] = [ UnitFor { - custom_build: false, - panic_ok: true, + build: false, + panic_abort_ok: true, }, UnitFor { - custom_build: true, - panic_ok: false, + build: true, + panic_abort_ok: false, }, UnitFor { - custom_build: false, - panic_ok: false, + build: false, + panic_abort_ok: false, }, ]; &ALL diff -Nru cargo-0.35.0/src/cargo/core/registry.rs cargo-0.37.0/src/cargo/core/registry.rs --- cargo-0.35.0/src/cargo/core/registry.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/registry.rs 2019-05-15 19:48:47.000000000 +0000 @@ -221,7 +221,7 @@ .iter() .map(|dep| { debug!( - "registring a patch for `{}` with `{}`", + "registering a patch for `{}` with `{}`", url, dep.package_name() ); diff -Nru cargo-0.35.0/src/cargo/core/resolver/conflict_cache.rs cargo-0.37.0/src/cargo/core/resolver/conflict_cache.rs --- cargo-0.35.0/src/cargo/core/resolver/conflict_cache.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/resolver/conflict_cache.rs 2019-05-15 19:48:47.000000000 +0000 @@ -2,7 +2,7 @@ use log::trace; -use super::types::ConflictReason; +use super::types::{ConflictMap, ConflictReason}; use crate::core::resolver::Context; use crate::core::{Dependency, PackageId}; @@ -10,7 +10,7 @@ /// efficiently see if any of the stored sets are a subset of a search set. enum ConflictStoreTrie { /// One of the stored sets. - Leaf(BTreeMap), + Leaf(ConflictMap), /// A map from an element to a subtrie where /// all the sets in the subtrie contains that element. Node(BTreeMap), @@ -18,57 +18,64 @@ impl ConflictStoreTrie { /// Finds any known set of conflicts, if any, - /// which are activated in `cx` and pass the `filter` specified? - fn find_conflicting( + /// where all elements return some from `is_active` and contain `PackageId` specified. + /// If more then one are activated, then it will return + /// one that will allow for the most jump-back. + fn find( &self, - cx: &Context, + is_active: &impl Fn(PackageId) -> Option, must_contain: Option, - ) -> Option<&BTreeMap> { + ) -> Option<(&ConflictMap, usize)> { match self { ConflictStoreTrie::Leaf(c) => { if must_contain.is_none() { - // `is_conflicting` checks that all the elements are active, - // but we have checked each one by the recursion of this function. - debug_assert!(cx.is_conflicting(None, c)); - Some(c) + Some((c, 0)) } else { // We did not find `must_contain`, so we need to keep looking. None } } ConflictStoreTrie::Node(m) => { + let mut out = None; for (&pid, store) in must_contain .map(|f| m.range(..=f)) .unwrap_or_else(|| m.range(..)) { // If the key is active, then we need to check all of the corresponding subtrie. - if cx.is_active(pid) { - if let Some(o) = - store.find_conflicting(cx, must_contain.filter(|&f| f != pid)) + if let Some(age_this) = is_active(pid) { + if let Some((o, age_o)) = + store.find(is_active, must_contain.filter(|&f| f != pid)) { - return Some(o); + let age = if must_contain == Some(pid) { + // all the results will include `must_contain` + // so the age of must_contain is not relevant to find the best result. + age_o + } else { + std::cmp::max(age_this, age_o) + }; + let out_age = out.get_or_insert((o, age)).1; + if out_age > age { + // we found one that can jump-back further so replace the out. + out = Some((o, age)); + } } } // Else, if it is not active then there is no way any of the corresponding // subtrie will be conflicting. } - None + out } } } - fn insert( - &mut self, - mut iter: impl Iterator, - con: BTreeMap, - ) { + fn insert(&mut self, mut iter: impl Iterator, con: ConflictMap) { if let Some(pid) = iter.next() { if let ConflictStoreTrie::Node(p) = self { p.entry(pid) .or_insert_with(|| ConflictStoreTrie::Node(BTreeMap::new())) .insert(iter, con); } - // Else, we already have a subset of this in the `ConflictStore`. + // Else, we already have a subset of this in the `ConflictStore`. } else { // We are at the end of the set we are adding, there are three cases for what to do // next: @@ -140,39 +147,51 @@ dep_from_pid: HashMap::new(), } } + pub fn find( + &self, + dep: &Dependency, + is_active: &impl Fn(PackageId) -> Option, + must_contain: Option, + ) -> Option<&ConflictMap> { + self.con_from_dep + .get(dep)? + .find(is_active, must_contain) + .map(|(c, _)| c) + } /// Finds any known set of conflicts, if any, - /// which are activated in `cx` and pass the `filter` specified? + /// which are activated in `cx` and contain `PackageId` specified. + /// If more then one are activated, then it will return + /// one that will allow for the most jump-back. pub fn find_conflicting( &self, cx: &Context, dep: &Dependency, must_contain: Option, - ) -> Option<&BTreeMap> { - let out = self - .con_from_dep - .get(dep)? - .find_conflicting(cx, must_contain); + ) -> Option<&ConflictMap> { + let out = self.find(dep, &|id| cx.is_active(id), must_contain); if cfg!(debug_assertions) { - if let Some(f) = must_contain { - if let Some(c) = &out { + if let Some(c) = &out { + assert!(cx.is_conflicting(None, c).is_some()); + if let Some(f) = must_contain { assert!(c.contains_key(&f)); } } } out } - pub fn conflicting( - &self, - cx: &Context, - dep: &Dependency, - ) -> Option<&BTreeMap> { + pub fn conflicting(&self, cx: &Context, dep: &Dependency) -> Option<&ConflictMap> { self.find_conflicting(cx, dep, None) } /// Adds to the cache a conflict of the form: /// `dep` is known to be unresolvable if /// all the `PackageId` entries are activated. - pub fn insert(&mut self, dep: &Dependency, con: &BTreeMap) { + pub fn insert(&mut self, dep: &Dependency, con: &ConflictMap) { + if con.values().any(|c| *c == ConflictReason::PublicDependency) { + // TODO: needs more info for back jumping + // for now refuse to cache it. + return; + } self.con_from_dep .entry(dep.clone()) .or_insert_with(|| ConflictStoreTrie::Node(BTreeMap::new())) @@ -192,6 +211,7 @@ .insert(dep.clone()); } } + pub fn dependencies_conflicting_with(&self, pid: PackageId) -> Option<&HashSet> { self.dep_from_pid.get(&pid) } diff -Nru cargo-0.35.0/src/cargo/core/resolver/context.rs cargo-0.37.0/src/cargo/core/resolver/context.rs --- cargo-0.35.0/src/cargo/core/resolver/context.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/resolver/context.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,4 +1,5 @@ -use std::collections::{BTreeMap, HashMap, HashSet}; +use std::collections::HashMap; +use std::num::NonZeroU64; use std::rc::Rc; // "ensure" seems to require "bail" be in scope (macro hygiene issue?). @@ -7,12 +8,12 @@ use log::debug; use crate::core::interning::InternedString; -use crate::core::{Dependency, FeatureValue, PackageId, SourceId, Summary}; +use crate::core::{Dependency, PackageId, SourceId, Summary}; use crate::util::CargoResult; use crate::util::Graph; -use super::errors::ActivateResult; -use super::types::{ConflictReason, DepInfo, GraphNode, Method, RcList, RegistryQueryer}; +use super::dep_cache::RegistryQueryer; +use super::types::{ConflictMap, FeaturesSet, Method}; pub use super::encode::{EncodableDependency, EncodablePackageId, EncodableResolve}; pub use super::encode::{Metadata, WorkspaceResolve}; @@ -25,57 +26,106 @@ #[derive(Clone)] pub struct Context { pub activations: Activations, - pub resolve_features: im_rc::HashMap>>, + /// list the features that are activated for each package + pub resolve_features: im_rc::HashMap, + /// get the package that will be linking to a native library by its links attribute pub links: im_rc::HashMap, + /// for each package the list of names it can see, + /// then for each name the exact version that name represents and weather the name is public. + pub public_dependency: + Option>>, + + /// a way to look up for a package in activations what packages required it + /// and all of the exact deps that it fulfilled. + pub parents: Graph>>, +} - // These are two cheaply-cloneable lists (O(1) clone) which are effectively - // hash maps but are built up as "construction lists". We'll iterate these - // at the very end and actually construct the map that we're making. - pub resolve_graph: RcList, - pub resolve_replacements: RcList<(PackageId, PackageId)>, +/// When backtracking it can be useful to know how far back to go. +/// The `ContextAge` of a `Context` is a monotonically increasing counter of the number +/// of decisions made to get to this state. +/// Several structures store the `ContextAge` when it was added, +/// to be used in `find_candidate` for backtracking. +pub type ContextAge = usize; + +/// Find the activated version of a crate based on the name, source, and semver compatibility. +/// By storing this in a hash map we ensure that there is only one +/// semver compatible version of each crate. +/// This all so stores the `ContextAge`. +pub type Activations = + im_rc::HashMap<(InternedString, SourceId, SemverCompatibility), (Summary, ContextAge)>; + +/// A type that represents when cargo treats two Versions as compatible. +/// Versions `a` and `b` are compatible if their left-most nonzero digit is the +/// same. +#[derive(Clone, Copy, Eq, PartialEq, Hash)] +pub enum SemverCompatibility { + Major(NonZeroU64), + Minor(NonZeroU64), + Patch(u64), +} - // These warnings are printed after resolution. - pub warnings: RcList, +impl From<&semver::Version> for SemverCompatibility { + fn from(ver: &semver::Version) -> Self { + if let Some(m) = NonZeroU64::new(ver.major) { + return SemverCompatibility::Major(m); + } + if let Some(m) = NonZeroU64::new(ver.minor) { + return SemverCompatibility::Minor(m); + } + SemverCompatibility::Patch(ver.patch) + } } -pub type Activations = im_rc::HashMap<(InternedString, SourceId), Rc>>; +impl PackageId { + pub fn as_activations_key(self) -> (InternedString, SourceId, SemverCompatibility) { + (self.name(), self.source_id(), self.version().into()) + } +} impl Context { - pub fn new() -> Context { + pub fn new(check_public_visible_dependencies: bool) -> Context { Context { - resolve_graph: RcList::new(), resolve_features: im_rc::HashMap::new(), links: im_rc::HashMap::new(), - resolve_replacements: RcList::new(), + public_dependency: if check_public_visible_dependencies { + Some(im_rc::HashMap::new()) + } else { + None + }, + parents: Graph::new(), activations: im_rc::HashMap::new(), - warnings: RcList::new(), } } /// Activate this summary by inserting it into our list of known activations. /// /// Returns `true` if this summary with the given method is already activated. - pub fn flag_activated(&mut self, summary: &Summary, method: &Method<'_>) -> CargoResult { + pub fn flag_activated(&mut self, summary: &Summary, method: &Method) -> CargoResult { let id = summary.package_id(); - let prev = self - .activations - .entry((id.name(), id.source_id())) - .or_insert_with(|| Rc::new(Vec::new())); - if !prev.iter().any(|c| c == summary) { - self.resolve_graph.push(GraphNode::Add(id)); - if let Some(link) = summary.links() { - ensure!( - self.links.insert(link, id).is_none(), - "Attempting to resolve a dependency with more then one crate with the \ - links={}.\nThis will not build as is. Consider rebuilding the .lock file.", - &*link + let age: ContextAge = self.age(); + match self.activations.entry(id.as_activations_key()) { + im_rc::hashmap::Entry::Occupied(o) => { + debug_assert_eq!( + &o.get().0, + summary, + "cargo does not allow two semver compatible versions" ); } - Rc::make_mut(prev).push(summary.clone()); - return Ok(false); + im_rc::hashmap::Entry::Vacant(v) => { + if let Some(link) = summary.links() { + ensure!( + self.links.insert(link, id).is_none(), + "Attempting to resolve a dependency with more then one crate with the \ + links={}.\nThis will not build as is. Consider rebuilding the .lock file.", + &*link + ); + } + v.insert((summary.clone(), age)); + return Ok(false); + } } debug!("checking if {} is already activated", summary.package_id()); - let (features, use_default) = match *method { + let (features, use_default) = match method { Method::Everything | Method::Required { all_features: true, .. @@ -90,330 +140,69 @@ let has_default_feature = summary.features().contains_key("default"); Ok(match self.resolve_features.get(&id) { Some(prev) => { - features.iter().all(|f| prev.contains(f)) + features.is_subset(prev) && (!use_default || prev.contains("default") || !has_default_feature) } None => features.is_empty() && (!use_default || !has_default_feature), }) } - pub fn build_deps( - &mut self, - registry: &mut RegistryQueryer<'_>, - parent: Option<&Summary>, - candidate: &Summary, - method: &Method<'_>, - ) -> ActivateResult> { - // First, figure out our set of dependencies based on the requested set - // of features. This also calculates what features we're going to enable - // for our own dependencies. - let deps = self.resolve_features(parent, candidate, method)?; - - // Next, transform all dependencies into a list of possible candidates - // which can satisfy that dependency. - let mut deps = deps - .into_iter() - .map(|(dep, features)| { - let candidates = registry.query(&dep)?; - Ok((dep, candidates, Rc::new(features))) - }) - .collect::>>()?; - - // Attempt to resolve dependencies with fewer candidates before trying - // dependencies with more candidates. This way if the dependency with - // only one candidate can't be resolved we don't have to do a bunch of - // work before we figure that out. - deps.sort_by_key(|&(_, ref a, _)| a.len()); - - Ok(deps) - } - - pub fn prev_active(&self, dep: &Dependency) -> &[Summary] { - self.activations - .get(&(dep.package_name(), dep.source_id())) - .map(|v| &v[..]) - .unwrap_or(&[]) + /// Returns the `ContextAge` of this `Context`. + /// For now we use (len of activations) as the age. + /// See the `ContextAge` docs for more details. + pub fn age(&self) -> ContextAge { + self.activations.len() } - pub fn is_active(&self, id: PackageId) -> bool { + /// If the package is active returns the `ContextAge` when it was added + pub fn is_active(&self, id: PackageId) -> Option { self.activations - .get(&(id.name(), id.source_id())) - .map(|v| v.iter().any(|s| s.package_id() == id)) - .unwrap_or(false) + .get(&id.as_activations_key()) + .and_then(|(s, l)| if s.package_id() == id { Some(*l) } else { None }) } /// Checks whether all of `parent` and the keys of `conflicting activations` /// are still active. + /// If so returns the `ContextAge` when the newest one was added. pub fn is_conflicting( &self, parent: Option, - conflicting_activations: &BTreeMap, - ) -> bool { - conflicting_activations - .keys() - .chain(parent.as_ref()) - .all(|&id| self.is_active(id)) - } - - /// Returns all dependencies and the features we want from them. - fn resolve_features<'b>( - &mut self, - parent: Option<&Summary>, - s: &'b Summary, - method: &'b Method<'_>, - ) -> ActivateResult)>> { - let dev_deps = match *method { - Method::Everything => true, - Method::Required { dev_deps, .. } => dev_deps, - }; - - // First, filter by dev-dependencies. - let deps = s.dependencies(); - let deps = deps.iter().filter(|d| d.is_transitive() || dev_deps); - - let reqs = build_requirements(s, method)?; - let mut ret = Vec::new(); - let mut used_features = HashSet::new(); - let default_dep = (false, Vec::new()); - - // Next, collect all actually enabled dependencies and their features. - for dep in deps { - // Skip optional dependencies, but not those enabled through a - // feature - if dep.is_optional() && !reqs.deps.contains_key(&dep.name_in_toml()) { - continue; - } - // So we want this dependency. Move the features we want from - // `feature_deps` to `ret` and register ourselves as using this - // name. - let base = reqs.deps.get(&dep.name_in_toml()).unwrap_or(&default_dep); - used_features.insert(dep.name_in_toml()); - let always_required = !dep.is_optional() - && !s - .dependencies() - .iter() - .any(|d| d.is_optional() && d.name_in_toml() == dep.name_in_toml()); - if always_required && base.0 { - self.warnings.push(format!( - "Package `{}` does not have feature `{}`. It has a required dependency \ - with that name, but only optional dependencies can be used as features. \ - This is currently a warning to ease the transition, but it will become an \ - error in the future.", - s.package_id(), - dep.name_in_toml() - )); - } - let mut base = base.1.clone(); - base.extend(dep.features().iter()); - for feature in base.iter() { - if feature.contains('/') { - return Err(failure::format_err!( - "feature names may not contain slashes: `{}`", - feature - ) - .into()); - } - } - ret.push((dep.clone(), base)); - } - - // Any entries in `reqs.dep` which weren't used are bugs in that the - // package does not actually have those dependencies. We classified - // them as dependencies in the first place because there is no such - // feature, either. - let remaining = reqs - .deps - .keys() - .cloned() - .filter(|s| !used_features.contains(s)) - .collect::>(); - if !remaining.is_empty() { - let features = remaining.join(", "); - return Err(match parent { - None => failure::format_err!( - "Package `{}` does not have these features: `{}`", - s.package_id(), - features - ) - .into(), - Some(p) => (p.package_id(), ConflictReason::MissingFeatures(features)).into(), - }); - } - - // Record what list of features is active for this package. - if !reqs.used.is_empty() { - let pkgid = s.package_id(); - - let set = Rc::make_mut( - self.resolve_features - .entry(pkgid) - .or_insert_with(|| Rc::new(HashSet::new())), - ); - - for feature in reqs.used { - set.insert(feature); + conflicting_activations: &ConflictMap, + ) -> Option { + let mut max = 0; + for &id in conflicting_activations.keys().chain(parent.as_ref()) { + if let Some(age) = self.is_active(id) { + max = std::cmp::max(max, age); + } else { + return None; } } - - Ok(ret) + Some(max) } - pub fn resolve_replacements(&self) -> HashMap { - let mut replacements = HashMap::new(); - let mut cur = &self.resolve_replacements; - while let Some(ref node) = cur.head { - let (k, v) = node.0; - replacements.insert(k, v); - cur = &node.1; - } - replacements + pub fn resolve_replacements( + &self, + registry: &RegistryQueryer<'_>, + ) -> HashMap { + self.activations + .values() + .filter_map(|(s, _)| registry.used_replacement_for(s.package_id())) + .collect() } pub fn graph(&self) -> Graph> { let mut graph: Graph> = Graph::new(); - let mut cur = &self.resolve_graph; - while let Some(ref node) = cur.head { - match node.0 { - GraphNode::Add(ref p) => graph.add(p.clone()), - GraphNode::Link(ref a, ref b, ref dep) => { - graph.link(a.clone(), b.clone()).push(dep.clone()); - } + self.activations + .values() + .for_each(|(r, _)| graph.add(r.package_id())); + for i in self.parents.iter() { + graph.add(*i); + for (o, e) in self.parents.edges(i) { + let old_link = graph.link(*o, *i); + assert!(old_link.is_empty()); + *old_link = e.to_vec(); } - cur = &node.1; } graph } } - -/// Takes requested features for a single package from the input `Method` and -/// recurses to find all requested features, dependencies and requested -/// dependency features in a `Requirements` object, returning it to the resolver. -fn build_requirements<'a, 'b: 'a>( - s: &'a Summary, - method: &'b Method<'_>, -) -> CargoResult> { - let mut reqs = Requirements::new(s); - - match *method { - Method::Everything - | Method::Required { - all_features: true, .. - } => { - for key in s.features().keys() { - reqs.require_feature(*key)?; - } - for dep in s.dependencies().iter().filter(|d| d.is_optional()) { - reqs.require_dependency(dep.name_in_toml()); - } - } - Method::Required { - all_features: false, - features: requested, - .. - } => { - for &f in requested.iter() { - reqs.require_value(&FeatureValue::new(f, s))?; - } - } - } - match *method { - Method::Everything - | Method::Required { - uses_default_features: true, - .. - } => { - if s.features().contains_key("default") { - reqs.require_feature(InternedString::new("default"))?; - } - } - Method::Required { - uses_default_features: false, - .. - } => {} - } - Ok(reqs) -} - -struct Requirements<'a> { - summary: &'a Summary, - // The deps map is a mapping of package name to list of features enabled. - // Each package should be enabled, and each package should have the - // specified set of features enabled. The boolean indicates whether this - // package was specifically requested (rather than just requesting features - // *within* this package). - deps: HashMap)>, - // The used features set is the set of features which this local package had - // enabled, which is later used when compiling to instruct the code what - // features were enabled. - used: HashSet, - visited: HashSet, -} - -impl<'r> Requirements<'r> { - fn new(summary: &Summary) -> Requirements<'_> { - Requirements { - summary, - deps: HashMap::new(), - used: HashSet::new(), - visited: HashSet::new(), - } - } - - fn require_crate_feature(&mut self, package: InternedString, feat: InternedString) { - self.used.insert(package); - self.deps - .entry(package) - .or_insert((false, Vec::new())) - .1 - .push(feat); - } - - fn seen(&mut self, feat: InternedString) -> bool { - if self.visited.insert(feat) { - self.used.insert(feat); - false - } else { - true - } - } - - fn require_dependency(&mut self, pkg: InternedString) { - if self.seen(pkg) { - return; - } - self.deps.entry(pkg).or_insert((false, Vec::new())).0 = true; - } - - fn require_feature(&mut self, feat: InternedString) -> CargoResult<()> { - if feat.is_empty() || self.seen(feat) { - return Ok(()); - } - for fv in self - .summary - .features() - .get(feat.as_str()) - .expect("must be a valid feature") - { - match *fv { - FeatureValue::Feature(ref dep_feat) if **dep_feat == *feat => failure::bail!( - "cyclic feature dependency: feature `{}` depends on itself", - feat - ), - _ => {} - } - self.require_value(fv)?; - } - Ok(()) - } - - fn require_value<'f>(&mut self, fv: &'f FeatureValue) -> CargoResult<()> { - match fv { - FeatureValue::Feature(feat) => self.require_feature(*feat)?, - FeatureValue::Crate(dep) => self.require_dependency(*dep), - FeatureValue::CrateFeature(dep, dep_feat) => { - self.require_crate_feature(*dep, *dep_feat) - } - }; - Ok(()) - } -} diff -Nru cargo-0.35.0/src/cargo/core/resolver/dep_cache.rs cargo-0.37.0/src/cargo/core/resolver/dep_cache.rs --- cargo-0.35.0/src/cargo/core/resolver/dep_cache.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/resolver/dep_cache.rs 2019-05-15 19:48:47.000000000 +0000 @@ -0,0 +1,474 @@ +//! There are 2 sources of facts for the resolver: +//! +//! - The `Registry` tells us for a `Dependency` what versions are available to fulfil it. +//! - The `Summary` tells us for a version (and features) what dependencies need to be fulfilled for it to be activated. +//! +//! These constitute immutable facts, the soled ground truth that all other inference depends on. +//! Theoretically this could all be enumerated ahead of time, but we want to be lazy and only +//! look up things we need to. The compromise is to cache the results as they are computed. +//! +//! This module impl that cache in all the gory details + +use std::cmp::Ordering; +use std::collections::{BTreeSet, HashMap, HashSet}; +use std::rc::Rc; + +use log::debug; + +use crate::core::interning::InternedString; +use crate::core::{Dependency, FeatureValue, PackageId, PackageIdSpec, Registry, Summary}; +use crate::util::errors::CargoResult; + +use crate::core::resolver::types::{ConflictReason, DepInfo, FeaturesSet}; +use crate::core::resolver::{ActivateResult, Method}; + +pub struct RegistryQueryer<'a> { + pub registry: &'a mut (dyn Registry + 'a), + replacements: &'a [(PackageIdSpec, Dependency)], + try_to_use: &'a HashSet, + /// If set the list of dependency candidates will be sorted by minimal + /// versions first. That allows `cargo update -Z minimal-versions` which will + /// specify minimum dependency versions to be used. + minimal_versions: bool, + /// a cache of `Candidate`s that fulfil a `Dependency` + registry_cache: HashMap>>, + /// a cache of `Dependency`s that are required for a `Summary` + summary_cache: HashMap< + (Option, Summary, Method), + Rc<(HashSet, Rc>)>, + >, + /// all the cases we ended up using a supplied replacement + used_replacements: HashMap, +} + +impl<'a> RegistryQueryer<'a> { + pub fn new( + registry: &'a mut dyn Registry, + replacements: &'a [(PackageIdSpec, Dependency)], + try_to_use: &'a HashSet, + minimal_versions: bool, + ) -> Self { + RegistryQueryer { + registry, + replacements, + try_to_use, + minimal_versions, + registry_cache: HashMap::new(), + summary_cache: HashMap::new(), + used_replacements: HashMap::new(), + } + } + + pub fn used_replacement_for(&self, p: PackageId) -> Option<(PackageId, PackageId)> { + self.used_replacements.get(&p).map(|r| (p, r.package_id())) + } + + pub fn replacement_summary(&self, p: PackageId) -> Option<&Summary> { + self.used_replacements.get(&p) + } + + /// Queries the `registry` to return a list of candidates for `dep`. + /// + /// This method is the location where overrides are taken into account. If + /// any candidates are returned which match an override then the override is + /// applied by performing a second query for what the override should + /// return. + pub fn query(&mut self, dep: &Dependency) -> CargoResult>> { + if let Some(out) = self.registry_cache.get(dep).cloned() { + return Ok(out); + } + + let mut ret = Vec::new(); + self.registry.query( + dep, + &mut |s| { + ret.push(s); + }, + false, + )?; + for summary in ret.iter_mut() { + let mut potential_matches = self + .replacements + .iter() + .filter(|&&(ref spec, _)| spec.matches(summary.package_id())); + + let &(ref spec, ref dep) = match potential_matches.next() { + None => continue, + Some(replacement) => replacement, + }; + debug!( + "found an override for {} {}", + dep.package_name(), + dep.version_req() + ); + + let mut summaries = self.registry.query_vec(dep, false)?.into_iter(); + let s = summaries.next().ok_or_else(|| { + failure::format_err!( + "no matching package for override `{}` found\n\ + location searched: {}\n\ + version required: {}", + spec, + dep.source_id(), + dep.version_req() + ) + })?; + let summaries = summaries.collect::>(); + if !summaries.is_empty() { + let bullets = summaries + .iter() + .map(|s| format!(" * {}", s.package_id())) + .collect::>(); + failure::bail!( + "the replacement specification `{}` matched \ + multiple packages:\n * {}\n{}", + spec, + s.package_id(), + bullets.join("\n") + ); + } + + // The dependency should be hard-coded to have the same name and an + // exact version requirement, so both of these assertions should + // never fail. + assert_eq!(s.version(), summary.version()); + assert_eq!(s.name(), summary.name()); + + let replace = if s.source_id() == summary.source_id() { + debug!("Preventing\n{:?}\nfrom replacing\n{:?}", summary, s); + None + } else { + Some(s) + }; + let matched_spec = spec.clone(); + + // Make sure no duplicates + if let Some(&(ref spec, _)) = potential_matches.next() { + failure::bail!( + "overlapping replacement specifications found:\n\n \ + * {}\n * {}\n\nboth specifications match: {}", + matched_spec, + spec, + summary.package_id() + ); + } + + for dep in summary.dependencies() { + debug!("\t{} => {}", dep.package_name(), dep.version_req()); + } + if let Some(r) = replace { + self.used_replacements.insert(summary.package_id(), r); + } + } + + // When we attempt versions for a package we'll want to do so in a + // sorted fashion to pick the "best candidates" first. Currently we try + // prioritized summaries (those in `try_to_use`) and failing that we + // list everything from the maximum version to the lowest version. + ret.sort_unstable_by(|a, b| { + let a_in_previous = self.try_to_use.contains(&a.package_id()); + let b_in_previous = self.try_to_use.contains(&b.package_id()); + let previous_cmp = a_in_previous.cmp(&b_in_previous).reverse(); + match previous_cmp { + Ordering::Equal => { + let cmp = a.version().cmp(b.version()); + if self.minimal_versions { + // Lower version ordered first. + cmp + } else { + // Higher version ordered first. + cmp.reverse() + } + } + _ => previous_cmp, + } + }); + + let out = Rc::new(ret); + + self.registry_cache.insert(dep.clone(), out.clone()); + + Ok(out) + } + + /// Find out what dependencies will be added by activating `candidate`, + /// with features described in `method`. Then look up in the `registry` + /// the candidates that will fulfil each of these dependencies, as it is the + /// next obvious question. + pub fn build_deps( + &mut self, + parent: Option, + candidate: &Summary, + method: &Method, + ) -> ActivateResult, Rc>)>> { + // if we have calculated a result before, then we can just return it, + // as it is a "pure" query of its arguments. + if let Some(out) = self + .summary_cache + .get(&(parent, candidate.clone(), method.clone())) + .cloned() + { + return Ok(out); + } + // First, figure out our set of dependencies based on the requested set + // of features. This also calculates what features we're going to enable + // for our own dependencies. + let (used_features, deps) = resolve_features(parent, candidate, method)?; + + // Next, transform all dependencies into a list of possible candidates + // which can satisfy that dependency. + let mut deps = deps + .into_iter() + .map(|(dep, features)| { + let candidates = self.query(&dep)?; + Ok((dep, candidates, features)) + }) + .collect::>>()?; + + // Attempt to resolve dependencies with fewer candidates before trying + // dependencies with more candidates. This way if the dependency with + // only one candidate can't be resolved we don't have to do a bunch of + // work before we figure that out. + deps.sort_by_key(|&(_, ref a, _)| a.len()); + + let out = Rc::new((used_features, Rc::new(deps))); + + // If we succeed we add the result to the cache so we can use it again next time. + // We dont cache the failure cases as they dont impl Clone. + self.summary_cache + .insert((parent, candidate.clone(), method.clone()), out.clone()); + + Ok(out) + } +} + +/// Returns the features we ended up using and +/// all dependencies and the features we want from each of them. +pub fn resolve_features<'b>( + parent: Option, + s: &'b Summary, + method: &'b Method, +) -> ActivateResult<(HashSet, Vec<(Dependency, FeaturesSet)>)> { + let dev_deps = match *method { + Method::Everything => true, + Method::Required { dev_deps, .. } => dev_deps, + }; + + // First, filter by dev-dependencies. + let deps = s.dependencies(); + let deps = deps.iter().filter(|d| d.is_transitive() || dev_deps); + + let reqs = build_requirements(s, method)?; + let mut ret = Vec::new(); + let mut used_features = HashSet::new(); + let default_dep = (false, BTreeSet::new()); + + // Next, collect all actually enabled dependencies and their features. + for dep in deps { + // Skip optional dependencies, but not those enabled through a + // feature + if dep.is_optional() && !reqs.deps.contains_key(&dep.name_in_toml()) { + continue; + } + // So we want this dependency. Move the features we want from + // `feature_deps` to `ret` and register ourselves as using this + // name. + let base = reqs.deps.get(&dep.name_in_toml()).unwrap_or(&default_dep); + used_features.insert(dep.name_in_toml()); + let always_required = !dep.is_optional() + && !s + .dependencies() + .iter() + .any(|d| d.is_optional() && d.name_in_toml() == dep.name_in_toml()); + if always_required && base.0 { + return Err(match parent { + None => failure::format_err!( + "Package `{}` does not have feature `{}`. It has a required dependency \ + with that name, but only optional dependencies can be used as features.", + s.package_id(), + dep.name_in_toml() + ) + .into(), + Some(p) => ( + p, + ConflictReason::RequiredDependencyAsFeatures(dep.name_in_toml()), + ) + .into(), + }); + } + let mut base = base.1.clone(); + base.extend(dep.features().iter()); + for feature in base.iter() { + if feature.contains('/') { + return Err(failure::format_err!( + "feature names may not contain slashes: `{}`", + feature + ) + .into()); + } + } + ret.push((dep.clone(), Rc::new(base))); + } + + // Any entries in `reqs.dep` which weren't used are bugs in that the + // package does not actually have those dependencies. We classified + // them as dependencies in the first place because there is no such + // feature, either. + let remaining = reqs + .deps + .keys() + .cloned() + .filter(|s| !used_features.contains(s)) + .collect::>(); + if !remaining.is_empty() { + let features = remaining.join(", "); + return Err(match parent { + None => failure::format_err!( + "Package `{}` does not have these features: `{}`", + s.package_id(), + features + ) + .into(), + Some(p) => (p, ConflictReason::MissingFeatures(features)).into(), + }); + } + + Ok((reqs.into_used(), ret)) +} + +/// Takes requested features for a single package from the input `Method` and +/// recurses to find all requested features, dependencies and requested +/// dependency features in a `Requirements` object, returning it to the resolver. +fn build_requirements<'a, 'b: 'a>( + s: &'a Summary, + method: &'b Method, +) -> CargoResult> { + let mut reqs = Requirements::new(s); + + match method { + Method::Everything + | Method::Required { + all_features: true, .. + } => { + for key in s.features().keys() { + reqs.require_feature(*key)?; + } + for dep in s.dependencies().iter().filter(|d| d.is_optional()) { + reqs.require_dependency(dep.name_in_toml()); + } + } + Method::Required { + all_features: false, + features: requested, + .. + } => { + for &f in requested.iter() { + reqs.require_value(&FeatureValue::new(f, s))?; + } + } + } + match *method { + Method::Everything + | Method::Required { + uses_default_features: true, + .. + } => { + if s.features().contains_key("default") { + reqs.require_feature(InternedString::new("default"))?; + } + } + Method::Required { + uses_default_features: false, + .. + } => {} + } + Ok(reqs) +} + +struct Requirements<'a> { + summary: &'a Summary, + // The deps map is a mapping of package name to list of features enabled. + // Each package should be enabled, and each package should have the + // specified set of features enabled. The boolean indicates whether this + // package was specifically requested (rather than just requesting features + // *within* this package). + deps: HashMap)>, + // The used features set is the set of features which this local package had + // enabled, which is later used when compiling to instruct the code what + // features were enabled. + used: HashSet, + visited: HashSet, +} + +impl Requirements<'_> { + fn new(summary: &Summary) -> Requirements<'_> { + Requirements { + summary, + deps: HashMap::new(), + used: HashSet::new(), + visited: HashSet::new(), + } + } + + fn into_used(self) -> HashSet { + self.used + } + + fn require_crate_feature(&mut self, package: InternedString, feat: InternedString) { + self.used.insert(package); + self.deps + .entry(package) + .or_insert((false, BTreeSet::new())) + .1 + .insert(feat); + } + + fn seen(&mut self, feat: InternedString) -> bool { + if self.visited.insert(feat) { + self.used.insert(feat); + false + } else { + true + } + } + + fn require_dependency(&mut self, pkg: InternedString) { + if self.seen(pkg) { + return; + } + self.deps.entry(pkg).or_insert((false, BTreeSet::new())).0 = true; + } + + fn require_feature(&mut self, feat: InternedString) -> CargoResult<()> { + if feat.is_empty() || self.seen(feat) { + return Ok(()); + } + for fv in self + .summary + .features() + .get(feat.as_str()) + .expect("must be a valid feature") + { + match *fv { + FeatureValue::Feature(ref dep_feat) if **dep_feat == *feat => failure::bail!( + "cyclic feature dependency: feature `{}` depends on itself", + feat + ), + _ => {} + } + self.require_value(fv)?; + } + Ok(()) + } + + fn require_value(&mut self, fv: &FeatureValue) -> CargoResult<()> { + match fv { + FeatureValue::Feature(feat) => self.require_feature(*feat)?, + FeatureValue::Crate(dep) => self.require_dependency(*dep), + FeatureValue::CrateFeature(dep, dep_feat) => { + self.require_crate_feature(*dep, *dep_feat) + } + }; + Ok(()) + } +} diff -Nru cargo-0.35.0/src/cargo/core/resolver/errors.rs cargo-0.37.0/src/cargo/core/resolver/errors.rs --- cargo-0.35.0/src/cargo/core/resolver/errors.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/resolver/errors.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,4 +1,3 @@ -use std::collections::BTreeMap; use std::fmt; use crate::core::{Dependency, PackageId, Registry, Summary}; @@ -8,7 +7,7 @@ use semver; use super::context::Context; -use super::types::{Candidate, ConflictReason}; +use super::types::{ConflictMap, ConflictReason}; /// Error during resolution providing a path of `PackageId`s. pub struct ResolveError { @@ -51,6 +50,7 @@ pub type ActivateResult = Result; +#[derive(Debug)] pub enum ActivateError { Fatal(failure::Error), Conflict(PackageId, ConflictReason), @@ -73,16 +73,15 @@ registry: &mut dyn Registry, parent: &Summary, dep: &Dependency, - conflicting_activations: &BTreeMap, - candidates: &[Candidate], + conflicting_activations: &ConflictMap, + candidates: &[Summary], config: Option<&Config>, ) -> ResolveError { - let graph = cx.graph(); let to_resolve_err = |err| { ResolveError::new( err, - graph - .path_to_top(&parent.package_id()) + cx.parents + .path_to_bottom(&parent.package_id()) .into_iter() .cloned() .collect(), @@ -92,7 +91,9 @@ if !candidates.is_empty() { let mut msg = format!("failed to select a version for `{}`.", dep.package_name()); msg.push_str("\n ... required by "); - msg.push_str(&describe_path(&graph.path_to_top(&parent.package_id()))); + msg.push_str(&describe_path( + &cx.parents.path_to_bottom(&parent.package_id()), + )); msg.push_str("\nversions that meet the requirements `"); msg.push_str(&dep.version_req().to_string()); @@ -100,7 +101,7 @@ msg.push_str( &candidates .iter() - .map(|v| v.summary.version()) + .map(|v| v.version()) .map(|v| v.to_string()) .collect::>() .join(", "), @@ -123,10 +124,10 @@ msg.push_str(link); msg.push_str("` as well:\n"); } - msg.push_str(&describe_path(&graph.path_to_top(p))); + msg.push_str(&describe_path(&cx.parents.path_to_bottom(p))); } - let (features_errors, other_errors): (Vec<_>, Vec<_>) = other_errors + let (features_errors, mut other_errors): (Vec<_>, Vec<_>) = other_errors .drain(..) .partition(|&(_, r)| r.is_missing_features()); @@ -145,6 +146,29 @@ // p == parent so the full path is redundant. } + let (required_dependency_as_features_errors, other_errors): (Vec<_>, Vec<_>) = other_errors + .drain(..) + .partition(|&(_, r)| r.is_required_dependency_as_features()); + + for &(p, r) in required_dependency_as_features_errors.iter() { + if let ConflictReason::RequiredDependencyAsFeatures(ref features) = *r { + msg.push_str("\n\nthe package `"); + msg.push_str(&*p.name()); + msg.push_str("` depends on `"); + msg.push_str(&*dep.package_name()); + msg.push_str("`, with features: `"); + msg.push_str(features); + msg.push_str("` but `"); + msg.push_str(&*dep.package_name()); + msg.push_str("` does not have these features.\n"); + msg.push_str( + " It has a required dependency with that name, \ + but only optional dependencies can be used as features.\n", + ); + } + // p == parent so the full path is redundant. + } + if !other_errors.is_empty() { msg.push_str( "\n\nall possible versions conflict with \ @@ -154,7 +178,7 @@ for &(p, _) in other_errors.iter() { msg.push_str("\n\n previously selected "); - msg.push_str(&describe_path(&graph.path_to_top(p))); + msg.push_str(&describe_path(&cx.parents.path_to_bottom(p))); } msg.push_str("\n\nfailed to select a version for `"); @@ -204,7 +228,9 @@ registry.describe_source(dep.source_id()), ); msg.push_str("required by "); - msg.push_str(&describe_path(&graph.path_to_top(&parent.package_id()))); + msg.push_str(&describe_path( + &cx.parents.path_to_bottom(&parent.package_id()), + )); // If we have a path dependency with a locked version, then this may // indicate that we updated a sub-package and forgot to run `cargo @@ -265,15 +291,17 @@ msg.push_str("\n"); } msg.push_str("required by "); - msg.push_str(&describe_path(&graph.path_to_top(&parent.package_id()))); + msg.push_str(&describe_path( + &cx.parents.path_to_bottom(&parent.package_id()), + )); msg }; if let Some(config) = config { - if config.cli_unstable().offline { + if config.offline() { msg.push_str( - "\nAs a reminder, you're using offline mode (-Z offline) \ + "\nAs a reminder, you're using offline mode (--offline) \ which can sometimes cause surprising resolution failures, \ if this error is too confusing you may wish to retry \ without the offline flag.", diff -Nru cargo-0.35.0/src/cargo/core/resolver/mod.rs cargo-0.37.0/src/cargo/core/resolver/mod.rs --- cargo-0.35.0/src/cargo/core/resolver/mod.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/resolver/mod.rs 2019-05-15 19:48:47.000000000 +0000 @@ -54,7 +54,6 @@ use log::{debug, trace}; -use crate::core::interning::InternedString; use crate::core::PackageIdSpec; use crate::core::{Dependency, PackageId, Registry, Summary}; use crate::util::config::Config; @@ -62,8 +61,9 @@ use crate::util::profile; use self::context::{Activations, Context}; -use self::types::{Candidate, ConflictReason, DepsFrame, GraphNode}; -use self::types::{RcVecIter, RegistryQueryer, RemainingDeps, ResolverProgress}; +use self::dep_cache::RegistryQueryer; +use self::types::{ConflictMap, ConflictReason, DepsFrame}; +use self::types::{FeaturesSet, RcVecIter, RemainingDeps, ResolverProgress}; pub use self::encode::{EncodableDependency, EncodablePackageId, EncodableResolve}; pub use self::encode::{Metadata, WorkspaceResolve}; @@ -73,6 +73,7 @@ mod conflict_cache; mod context; +mod dep_cache; mod encode; mod errors; mod resolve; @@ -107,15 +108,26 @@ /// /// * `print_warnings` - whether or not to print backwards-compatibility /// warnings and such +/// +/// * `check_public_visible_dependencies` - a flag for whether to enforce the restrictions +/// introduced in the "public & private dependencies" RFC (1977). The current implementation +/// makes sure that there is only one version of each name visible to each package. +/// +/// But there are 2 stable ways to directly depend on different versions of the same name. +/// 1. Use the renamed dependencies functionality +/// 2. Use 'cfg({})' dependencies functionality +/// +/// When we have a decision for how to implement is without breaking existing functionality +/// this flag can be removed. pub fn resolve( - summaries: &[(Summary, Method<'_>)], + summaries: &[(Summary, Method)], replacements: &[(PackageIdSpec, Dependency)], registry: &mut dyn Registry, try_to_use: &HashSet, config: Option<&Config>, - print_warnings: bool, + check_public_visible_dependencies: bool, ) -> CargoResult { - let cx = Context::new(); + let cx = Context::new(check_public_visible_dependencies); let _p = profile::start("resolving"); let minimal_versions = match config { Some(config) => config.cli_unstable().minimal_versions, @@ -125,13 +137,13 @@ let cx = activate_deps_loop(cx, &mut registry, summaries, config)?; let mut cksums = HashMap::new(); - for summary in cx.activations.values().flat_map(|v| v.iter()) { + for (summary, _) in cx.activations.values() { let cksum = summary.checksum().map(|s| s.to_string()); cksums.insert(summary.package_id(), cksum); } let resolve = Resolve::new( cx.graph(), - cx.resolve_replacements(), + cx.resolve_replacements(®istry), cx.resolve_features .iter() .map(|(k, v)| (*k, v.iter().map(|x| x.to_string()).collect())) @@ -145,18 +157,6 @@ check_duplicate_pkgs_in_lockfile(&resolve)?; trace!("resolved: {:?}", resolve); - // If we have a shell, emit warnings about required deps used as feature. - if let Some(config) = config { - if print_warnings { - let mut shell = config.shell(); - let mut warnings = &cx.warnings; - while let Some(ref head) = warnings.head { - shell.warn(&head.0)?; - warnings = &head.1; - } - } - } - Ok(resolve) } @@ -168,7 +168,7 @@ fn activate_deps_loop( mut cx: Context, registry: &mut RegistryQueryer<'_>, - summaries: &[(Summary, Method<'_>)], + summaries: &[(Summary, Method)], config: Option<&Config>, ) -> CargoResult { let mut backtrack_stack = Vec::new(); @@ -181,11 +181,7 @@ // Activate all the initial summaries to kick off some work. for &(ref summary, ref method) in summaries { debug!("initial activation: {}", summary.package_id()); - let candidate = Candidate { - summary: summary.clone(), - replace: None, - }; - let res = activate(&mut cx, registry, None, candidate, method); + let res = activate(&mut cx, registry, None, summary.clone(), method.clone()); match res { Ok(Some((frame, _))) => remaining_deps.push(frame), Ok(None) => (), @@ -225,13 +221,6 @@ dep.package_name(), candidates.len() ); - trace!( - "{}[{}]>{} {} prev activations", - parent.name(), - cur, - dep.package_name(), - cx.prev_active(&dep).len() - ); let just_here_for_the_error_messages = just_here_for_the_error_messages && past_conflicting_activations @@ -247,7 +236,7 @@ // // This is a map of package ID to a reason why that packaged caused a // conflict for us. - let mut conflicting_activations = BTreeMap::new(); + let mut conflicting_activations = ConflictMap::new(); // When backtracking we don't fully update `conflicting_activations` // especially for the cases that we didn't make a backtrack frame in the @@ -257,7 +246,12 @@ let mut backtracked = false; loop { - let next = remaining_candidates.next(&mut conflicting_activations, &cx, &dep); + let next = remaining_candidates.next( + &mut conflicting_activations, + &cx, + &dep, + parent.package_id(), + ); let (candidate, has_another) = next.ok_or(()).or_else(|_| { // If we get here then our `remaining_candidates` was just @@ -287,15 +281,29 @@ // As we mentioned above with the `backtracked` variable if this // local is set to `true` then our `conflicting_activations` may // not be right, so we can't push into our global cache. + let mut generalize_conflicting_activations = None; if !just_here_for_the_error_messages && !backtracked { past_conflicting_activations.insert(&dep, &conflicting_activations); + if let Some(c) = generalize_conflicting( + &cx, + registry, + &mut past_conflicting_activations, + &parent, + &dep, + &conflicting_activations, + ) { + generalize_conflicting_activations = Some(c); + } } match find_candidate( + &cx, &mut backtrack_stack, &parent, backtracked, - &conflicting_activations, + generalize_conflicting_activations + .as_ref() + .unwrap_or(&conflicting_activations), ) { Some((candidate, has_another, frame)) => { // Reset all of our local variables used with the @@ -358,10 +366,10 @@ None }; - let pid = candidate.summary.package_id(); + let pid = candidate.package_id(); let method = Method::Required { dev_deps: false, - features: &features, + features: Rc::clone(&features), all_features: false, uses_default_features: dep.uses_default_features(), }; @@ -370,9 +378,9 @@ parent.name(), cur, dep.package_name(), - candidate.summary.version() + candidate.version() ); - let res = activate(&mut cx, registry, Some((&parent, &dep)), candidate, &method); + let res = activate(&mut cx, registry, Some((&parent, &dep)), candidate, method); let successfully_activated = match res { // Success! We've now activated our `candidate` in our context @@ -483,6 +491,7 @@ let activate_for_error_message = has_past_conflicting_dep && !has_another && { just_here_for_the_error_messages || { find_candidate( + &cx, &mut backtrack_stack.clone(), &parent, backtracked, @@ -582,48 +591,109 @@ cx: &mut Context, registry: &mut RegistryQueryer<'_>, parent: Option<(&Summary, &Dependency)>, - candidate: Candidate, - method: &Method<'_>, + candidate: Summary, + method: Method, ) -> ActivateResult> { + let candidate_pid = candidate.package_id(); if let Some((parent, dep)) = parent { - cx.resolve_graph.push(GraphNode::Link( - parent.package_id(), - candidate.summary.package_id(), - dep.clone(), - )); + let parent_pid = parent.package_id(); + Rc::make_mut( + // add a edge from candidate to parent in the parents graph + cx.parents.link(candidate_pid, parent_pid), + ) + // and associate dep with that edge + .push(dep.clone()); + if let Some(public_dependency) = cx.public_dependency.as_mut() { + // one tricky part is that `candidate_pid` may already be active and + // have public dependencies of its own. So we not only need to mark + // `candidate_pid` as visible to its parents but also all of its existing + // public dependencies. + let existing_public_deps: Vec = public_dependency + .get(&candidate_pid) + .iter() + .flat_map(|x| x.values()) + .filter_map(|x| if x.1 { Some(&x.0) } else { None }) + .chain(&Some(candidate_pid)) + .cloned() + .collect(); + for c in existing_public_deps { + // for each (transitive) parent that can newly see `t` + let mut stack = vec![(parent_pid, dep.is_public())]; + while let Some((p, public)) = stack.pop() { + match public_dependency.entry(p).or_default().entry(c.name()) { + im_rc::hashmap::Entry::Occupied(mut o) => { + // the (transitive) parent can already see something by `c`s name, it had better be `c`. + assert_eq!(o.get().0, c); + if o.get().1 { + // The previous time the parent saw `c`, it was a public dependency. + // So all of its parents already know about `c` + // and we can save some time by stopping now. + continue; + } + if public { + // Mark that `c` has now bean seen publicly + o.insert((c, public)); + } + } + im_rc::hashmap::Entry::Vacant(v) => { + // The (transitive) parent does not have anything by `c`s name, + // so we add `c`. + v.insert((c, public)); + } + } + // if `candidate_pid` was a private dependency of `p` then `p` parents can't see `c` thru `p` + if public { + // if it was public, then we add all of `p`s parents to be checked + for &(grand, ref d) in cx.parents.edges(&p) { + stack.push((grand, d.iter().any(|x| x.is_public()))); + } + } + } + } + } } - let activated = cx.flag_activated(&candidate.summary, method)?; + let activated = cx.flag_activated(&candidate, &method)?; - let candidate = match candidate.replace { + let candidate = match registry.replacement_summary(candidate_pid) { Some(replace) => { - cx.resolve_replacements - .push((candidate.summary.package_id(), replace.package_id())); - if cx.flag_activated(&replace, method)? && activated { + if cx.flag_activated(&replace, &method)? && activated { return Ok(None); } trace!( "activating {} (replacing {})", replace.package_id(), - candidate.summary.package_id() + candidate_pid ); - replace + replace.clone() } None => { if activated { return Ok(None); } - trace!("activating {}", candidate.summary.package_id()); - candidate.summary + trace!("activating {}", candidate_pid); + candidate } }; let now = Instant::now(); - let deps = cx.build_deps(registry, parent.map(|p| p.0), &candidate, method)?; + let (used_features, deps) = + &*registry.build_deps(parent.map(|p| p.0.package_id()), &candidate, &method)?; + + // Record what list of features is active for this package. + if !used_features.is_empty() { + Rc::make_mut( + cx.resolve_features + .entry(candidate.package_id()) + .or_insert_with(Rc::default), + ) + .extend(used_features); + } + let frame = DepsFrame { parent: candidate, just_for_error_messages: false, - remaining_siblings: RcVecIter::new(Rc::new(deps)), + remaining_siblings: RcVecIter::new(Rc::clone(deps)), }; Ok(Some((frame, now.elapsed()))) } @@ -636,8 +706,8 @@ remaining_candidates: RemainingCandidates, parent: Summary, dep: Dependency, - features: Rc>, - conflicting_activations: BTreeMap, + features: FeaturesSet, + conflicting_activations: ConflictMap, } /// A helper "iterator" used to extract candidates within a current `Context` of @@ -653,13 +723,13 @@ /// filtered out, and as they are filtered the causes will be added to `conflicting_prev_active`. #[derive(Clone)] struct RemainingCandidates { - remaining: RcVecIter, + remaining: RcVecIter, // This is a inlined peekable generator - has_another: Option, + has_another: Option, } impl RemainingCandidates { - fn new(candidates: &Rc>) -> RemainingCandidates { + fn new(candidates: &Rc>) -> RemainingCandidates { RemainingCandidates { remaining: RcVecIter::new(Rc::clone(candidates)), has_another: None, @@ -684,20 +754,20 @@ /// original list for the reason listed. fn next( &mut self, - conflicting_prev_active: &mut BTreeMap, + conflicting_prev_active: &mut ConflictMap, cx: &Context, dep: &Dependency, - ) -> Option<(Candidate, bool)> { - let prev_active = cx.prev_active(dep); - - for (_, b) in self.remaining.by_ref() { + parent: PackageId, + ) -> Option<(Summary, bool)> { + 'main: for (_, b) in self.remaining.by_ref() { + let b_id = b.package_id(); // The `links` key in the manifest dictates that there's only one // package in a dependency graph, globally, with that particular // `links` key. If this candidate links to something that's already // linked to by a different package then we've gotta skip this. - if let Some(link) = b.summary.links() { + if let Some(link) = b.links() { if let Some(&a) = cx.links.get(&link) { - if a != b.summary.package_id() { + if a != b_id { conflicting_prev_active .entry(a) .or_insert_with(|| ConflictReason::Links(link)); @@ -714,17 +784,51 @@ // // Here we throw out our candidate if it's *compatible*, yet not // equal, to all previously activated versions. - if let Some(a) = prev_active - .iter() - .find(|a| compatible(a.version(), b.summary.version())) - { - if *a != b.summary { + if let Some((a, _)) = cx.activations.get(&b_id.as_activations_key()) { + if *a != b { conflicting_prev_active .entry(a.package_id()) .or_insert(ConflictReason::Semver); continue; } } + // We may still have to reject do to a public dependency conflict. If one of any of our + // ancestors that can see us already knows about a different crate with this name then + // we have to reject this candidate. Additionally this candidate may already have been + // activated and have public dependants of its own, + // all of witch also need to be checked the same way. + if let Some(public_dependency) = cx.public_dependency.as_ref() { + let existing_public_deps: Vec = public_dependency + .get(&b_id) + .iter() + .flat_map(|x| x.values()) + .filter_map(|x| if x.1 { Some(&x.0) } else { None }) + .chain(&Some(b_id)) + .cloned() + .collect(); + for t in existing_public_deps { + // for each (transitive) parent that can newly see `t` + let mut stack = vec![(parent, dep.is_public())]; + while let Some((p, public)) = stack.pop() { + // TODO: dont look at the same thing more then once + if let Some(o) = public_dependency.get(&p).and_then(|x| x.get(&t.name())) { + if o.0 != t { + // the (transitive) parent can already see a different version by `t`s name. + // So, adding `b` will cause `p` to have a public dependency conflict on `t`. + conflicting_prev_active.insert(p, ConflictReason::PublicDependency); + continue 'main; + } + } + // if `b` was a private dependency of `p` then `p` parents can't see `t` thru `p` + if public { + // if it was public, then we add all of `p`s parents to be checked + for &(grand, ref d) in cx.parents.edges(&p) { + stack.push((grand, d.iter().any(|x| x.is_public()))); + } + } + } + } + } // Well if we made it this far then we've got a valid dependency. We // want this iterator to be inherently "peekable" so we don't @@ -743,25 +847,111 @@ } } -// Returns if `a` and `b` are compatible in the semver sense. This is a -// commutative operation. -// -// Versions `a` and `b` are compatible if their left-most nonzero digit is the -// same. -fn compatible(a: &semver::Version, b: &semver::Version) -> bool { - if a.major != b.major { - return false; - } - if a.major != 0 { - return true; - } - if a.minor != b.minor { - return false; - } - if a.minor != 0 { - return true; +/// Attempts to find a new conflict that allows a `find_candidate` feather then the input one. +/// It will add the new conflict to the cache if one is found. +/// +/// Panics if the input conflict is not all active in `cx`. +fn generalize_conflicting( + cx: &Context, + registry: &mut RegistryQueryer<'_>, + past_conflicting_activations: &mut conflict_cache::ConflictCache, + parent: &Summary, + dep: &Dependency, + conflicting_activations: &ConflictMap, +) -> Option { + if conflicting_activations.is_empty() { + return None; + } + // We need to determine the `ContextAge` that this `conflicting_activations` will jump to, and why. + let (backtrack_critical_age, backtrack_critical_id) = conflicting_activations + .keys() + .map(|&c| (cx.is_active(c).expect("not currently active!?"), c)) + .max() + .unwrap(); + let backtrack_critical_reason: ConflictReason = + conflicting_activations[&backtrack_critical_id].clone(); + + if cx + .parents + .is_path_from_to(&parent.package_id(), &backtrack_critical_id) + { + // We are a descendant of the trigger of the problem. + // The best generalization of this is to let things bubble up + // and let `backtrack_critical_id` figure this out. + return None; + } + // What parents does that critical activation have + for (critical_parent, critical_parents_deps) in + cx.parents.edges(&backtrack_critical_id).filter(|(p, _)| { + // it will only help backjump further if it is older then the critical_age + cx.is_active(*p).expect("parent not currently active!?") < backtrack_critical_age + }) + { + for critical_parents_dep in critical_parents_deps.iter() { + // A dep is equivalent to one of the things it can resolve to. + // Thus, if all the things it can resolve to have already ben determined + // to be conflicting, then we can just say that we conflict with the parent. + if let Some(others) = registry + .query(critical_parents_dep) + .expect("an already used dep now error!?") + .iter() + .rev() // the last one to be tried is the least likely to be in the cache, so start with that. + .map(|other| { + past_conflicting_activations + .find( + dep, + &|id| { + if id == other.package_id() { + // we are imagining that we used other instead + Some(backtrack_critical_age) + } else { + cx.is_active(id).filter(|&age| + // we only care about things that are older then critical_age + age < backtrack_critical_age) + } + }, + Some(other.package_id()), + ) + .map(|con| (other.package_id(), con)) + }) + .collect::>>() + { + let mut con = conflicting_activations.clone(); + // It is always valid to combine previously inserted conflicts. + // A, B are both known bad states each that can never be activated. + // A + B is redundant but cant be activated, as if + // A + B is active then A is active and we know that is not ok. + for (_, other) in &others { + con.extend(other.iter().map(|(&id, re)| (id, re.clone()))); + } + // Now that we have this combined conflict, we can do a substitution: + // A dep is equivalent to one of the things it can resolve to. + // So we can remove all the things that it resolves to and replace with the parent. + for (other_id, _) in &others { + con.remove(other_id); + } + con.insert(*critical_parent, backtrack_critical_reason); + + if cfg!(debug_assertions) { + // the entire point is to find an older conflict, so let's make sure we did + let new_age = con + .keys() + .map(|&c| cx.is_active(c).expect("not currently active!?")) + .max() + .unwrap(); + assert!( + new_age < backtrack_critical_age, + "new_age {} < backtrack_critical_age {}", + new_age, + backtrack_critical_age + ); + } + past_conflicting_activations.insert(dep, &con); + return Some(con); + } + } } - a.patch == b.patch + None } /// Looks through the states in `backtrack_stack` for dependencies with @@ -774,43 +964,75 @@ /// Read /// For several more detailed explanations of the logic here. fn find_candidate( + cx: &Context, backtrack_stack: &mut Vec, parent: &Summary, backtracked: bool, - conflicting_activations: &BTreeMap, -) -> Option<(Candidate, bool, BacktrackFrame)> { + conflicting_activations: &ConflictMap, +) -> Option<(Summary, bool, BacktrackFrame)> { + // When we're calling this method we know that `parent` failed to + // activate. That means that some dependency failed to get resolved for + // whatever reason. Normally, that means that all of those reasons + // (plus maybe some extras) are listed in `conflicting_activations`. + // + // The abnormal situations are things that do not put all of the reasons in `conflicting_activations`: + // If we backtracked we do not know how our `conflicting_activations` related to + // the cause of that backtrack, so we do not update it. + // If we had a PublicDependency conflict, then we do not yet have a compact way to + // represent all the parts of the problem, so `conflicting_activations` is incomplete. + let age = if !backtracked + && !conflicting_activations + .values() + .any(|c| *c == ConflictReason::PublicDependency) + { + // we dont have abnormal situations. So we can ask `cx` for how far back we need to go. + cx.is_conflicting(Some(parent.package_id()), conflicting_activations) + } else { + None + }; + while let Some(mut frame) = backtrack_stack.pop() { let next = frame.remaining_candidates.next( &mut frame.conflicting_activations, &frame.context, &frame.dep, + frame.parent.package_id(), ); let (candidate, has_another) = match next { Some(pair) => pair, None => continue, }; - // When we're calling this method we know that `parent` failed to - // activate. That means that some dependency failed to get resolved for - // whatever reason, and all of those reasons (plus maybe some extras) - // are listed in `conflicting_activations`. - // - // This means that if all members of `conflicting_activations` are still + + // If all members of `conflicting_activations` are still // active in this back up we know that we're guaranteed to not actually // make any progress. As a result if we hit this condition we can // completely skip this backtrack frame and move on to the next. - if !backtracked - && frame - .context - .is_conflicting(Some(parent.package_id()), conflicting_activations) - { - trace!( - "{} = \"{}\" skip as not solving {}: {:?}", - frame.dep.package_name(), - frame.dep.version_req(), - parent.package_id(), - conflicting_activations - ); - continue; + if let Some(age) = age { + if frame.context.age() > age { + trace!( + "{} = \"{}\" skip as not solving {}: {:?}", + frame.dep.package_name(), + frame.dep.version_req(), + parent.package_id(), + conflicting_activations + ); + // above we use `cx` to determine that this is still going to be conflicting. + // but lets just double check. + debug_assert!( + frame + .context + .is_conflicting(Some(parent.package_id()), conflicting_activations) + == Some(age) + ); + continue; + } else { + // above we use `cx` to determine that this is not going to be conflicting. + // but lets just double check. + debug_assert!(frame + .context + .is_conflicting(Some(parent.package_id()), conflicting_activations) + .is_none()); + } } return Some((candidate, has_another, frame)); @@ -821,8 +1043,7 @@ fn check_cycles(resolve: &Resolve, activations: &Activations) -> CargoResult<()> { let summaries: HashMap = activations .values() - .flat_map(|v| v.iter()) - .map(|s| (s.package_id(), s)) + .map(|(s, _)| (s.package_id(), s)) .collect(); // Sort packages to produce user friendly deterministic errors. diff -Nru cargo-0.35.0/src/cargo/core/resolver/resolve.rs cargo-0.37.0/src/cargo/core/resolver/resolve.rs --- cargo-0.35.0/src/cargo/core/resolver/resolve.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/resolver/resolve.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,11 +1,11 @@ use std::borrow::Borrow; use std::collections::{HashMap, HashSet}; use std::fmt; -use std::hash::Hash; use std::iter::FromIterator; use url::Url; +use crate::core::dependency::Kind; use crate::core::{Dependency, PackageId, PackageIdSpec, Summary, Target}; use crate::util::errors::CargoResult; use crate::util::Graph; @@ -30,6 +30,8 @@ checksums: HashMap>, metadata: Metadata, unused_patches: Vec, + // A map from packages to a set of their public dependencies + public_dependencies: HashMap>, } impl Resolve { @@ -42,6 +44,30 @@ unused_patches: Vec, ) -> Resolve { let reverse_replacements = replacements.iter().map(|(&p, &r)| (r, p)).collect(); + let public_dependencies = graph + .iter() + .map(|p| { + let public_deps = graph + .edges(p) + .flat_map(|(dep_package, deps)| { + let id_opt: Option = deps + .iter() + .find(|d| d.kind() == Kind::Normal) + .and_then(|d| { + if d.is_public() { + Some(dep_package.clone()) + } else { + None + } + }); + id_opt + }) + .collect::>(); + + (p.clone(), public_deps) + }) + .collect(); + Resolve { graph, replacements, @@ -51,6 +77,7 @@ unused_patches, empty_features: HashSet::new(), reverse_replacements, + public_dependencies, } } @@ -163,7 +190,7 @@ pub fn contains(&self, k: &Q) -> bool where PackageId: Borrow, - Q: Hash + Eq, + Q: Ord + Eq, { self.graph.contains(k) } @@ -179,11 +206,11 @@ pub fn deps(&self, pkg: PackageId) -> impl Iterator { self.graph .edges(&pkg) - .map(move |(&id, deps)| (self.replacement(id).unwrap_or(id), deps.as_slice())) + .map(move |&(id, ref deps)| (self.replacement(id).unwrap_or(id), deps.as_slice())) } pub fn deps_not_replaced<'a>(&'a self, pkg: PackageId) -> impl Iterator + 'a { - self.graph.edges(&pkg).map(|(&id, _)| id) + self.graph.edges(&pkg).map(|&(id, _)| id) } pub fn replacement(&self, pkg: PackageId) -> Option { @@ -198,6 +225,13 @@ self.features.get(&pkg).unwrap_or(&self.empty_features) } + pub fn is_public_dep(&self, pkg: PackageId, dep: PackageId) -> bool { + self.public_dependencies + .get(&pkg) + .map(|public_deps| public_deps.contains(&dep)) + .unwrap_or_else(|| panic!("Unknown dependency {:?} for package {:?}", dep, pkg)) + } + pub fn features_sorted(&self, pkg: PackageId) -> Vec<&str> { let mut v = Vec::from_iter(self.features(pkg).iter().map(|s| s.as_ref())); v.sort_unstable(); diff -Nru cargo-0.35.0/src/cargo/core/resolver/types.rs cargo-0.37.0/src/cargo/core/resolver/types.rs --- cargo-0.35.0/src/cargo/core/resolver/types.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/resolver/types.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,13 +1,11 @@ use std::cmp::Ordering; -use std::collections::{HashMap, HashSet}; +use std::collections::{BTreeMap, BTreeSet}; use std::ops::Range; use std::rc::Rc; use std::time::{Duration, Instant}; -use log::debug; - use crate::core::interning::InternedString; -use crate::core::{Dependency, PackageId, PackageIdSpec, Registry, Summary}; +use crate::core::{Dependency, PackageId, Summary}; use crate::util::errors::CargoResult; use crate::util::Config; @@ -32,7 +30,7 @@ printed: false, deps_time: Duration::new(0, 0), // Some CI setups are much slower then the equipment used by Cargo itself. - // Architectures that do not have a modern processor, hardware emulation, ect. + // Architectures that do not have a modern processor, hardware emulation, etc. // In the test code we have `slow_cpu_multiplier`, but that is not accessible here. #[cfg(debug_assertions)] slow_cpu_multiplier: std::env::var("CARGO_TEST_SLOW_CPU_MULTIPLIER") @@ -91,192 +89,40 @@ } } -pub struct RegistryQueryer<'a> { - pub registry: &'a mut (dyn Registry + 'a), - replacements: &'a [(PackageIdSpec, Dependency)], - try_to_use: &'a HashSet, - cache: HashMap>>, - // If set the list of dependency candidates will be sorted by minimal - // versions first. That allows `cargo update -Z minimal-versions` which will - // specify minimum dependency versions to be used. - minimal_versions: bool, -} - -impl<'a> RegistryQueryer<'a> { - pub fn new( - registry: &'a mut dyn Registry, - replacements: &'a [(PackageIdSpec, Dependency)], - try_to_use: &'a HashSet, - minimal_versions: bool, - ) -> Self { - RegistryQueryer { - registry, - replacements, - cache: HashMap::new(), - try_to_use, - minimal_versions, - } - } - - /// Queries the `registry` to return a list of candidates for `dep`. - /// - /// This method is the location where overrides are taken into account. If - /// any candidates are returned which match an override then the override is - /// applied by performing a second query for what the override should - /// return. - pub fn query(&mut self, dep: &Dependency) -> CargoResult>> { - if let Some(out) = self.cache.get(dep).cloned() { - return Ok(out); - } - - let mut ret = Vec::new(); - self.registry.query( - dep, - &mut |s| { - ret.push(Candidate { - summary: s, - replace: None, - }); - }, - false, - )?; - for candidate in ret.iter_mut() { - let summary = &candidate.summary; - - let mut potential_matches = self - .replacements - .iter() - .filter(|&&(ref spec, _)| spec.matches(summary.package_id())); - - let &(ref spec, ref dep) = match potential_matches.next() { - None => continue, - Some(replacement) => replacement, - }; - debug!( - "found an override for {} {}", - dep.package_name(), - dep.version_req() - ); - - let mut summaries = self.registry.query_vec(dep, false)?.into_iter(); - let s = summaries.next().ok_or_else(|| { - failure::format_err!( - "no matching package for override `{}` found\n\ - location searched: {}\n\ - version required: {}", - spec, - dep.source_id(), - dep.version_req() - ) - })?; - let summaries = summaries.collect::>(); - if !summaries.is_empty() { - let bullets = summaries - .iter() - .map(|s| format!(" * {}", s.package_id())) - .collect::>(); - failure::bail!( - "the replacement specification `{}` matched \ - multiple packages:\n * {}\n{}", - spec, - s.package_id(), - bullets.join("\n") - ); - } - - // The dependency should be hard-coded to have the same name and an - // exact version requirement, so both of these assertions should - // never fail. - assert_eq!(s.version(), summary.version()); - assert_eq!(s.name(), summary.name()); - - let replace = if s.source_id() == summary.source_id() { - debug!("Preventing\n{:?}\nfrom replacing\n{:?}", summary, s); - None - } else { - Some(s) - }; - let matched_spec = spec.clone(); - - // Make sure no duplicates - if let Some(&(ref spec, _)) = potential_matches.next() { - failure::bail!( - "overlapping replacement specifications found:\n\n \ - * {}\n * {}\n\nboth specifications match: {}", - matched_spec, - spec, - summary.package_id() - ); - } +/// The preferred way to store the set of activated features for a package. +/// This is sorted so that it impls Hash, and owns its contents, +/// needed so it can be part of the key for caching in the `DepsCache`. +/// It is also cloned often as part of `Context`, hence the `RC`. +/// `im-rs::OrdSet` was slower of small sets like this, +/// but this can change with improvements to std, im, or llvm. +/// Using a consistent type for this allows us to use the highly +/// optimized comparison operators like `is_subset` at the interfaces. +pub type FeaturesSet = Rc>; - for dep in summary.dependencies() { - debug!("\t{} => {}", dep.package_name(), dep.version_req()); - } - - candidate.replace = replace; - } - - // When we attempt versions for a package we'll want to do so in a - // sorted fashion to pick the "best candidates" first. Currently we try - // prioritized summaries (those in `try_to_use`) and failing that we - // list everything from the maximum version to the lowest version. - ret.sort_unstable_by(|a, b| { - let a_in_previous = self.try_to_use.contains(&a.summary.package_id()); - let b_in_previous = self.try_to_use.contains(&b.summary.package_id()); - let previous_cmp = a_in_previous.cmp(&b_in_previous).reverse(); - match previous_cmp { - Ordering::Equal => { - let cmp = a.summary.version().cmp(b.summary.version()); - if self.minimal_versions { - // Lower version ordered first. - cmp - } else { - // Higher version ordered first. - cmp.reverse() - } - } - _ => previous_cmp, - } - }); - - let out = Rc::new(ret); - - self.cache.insert(dep.clone(), out.clone()); - - Ok(out) - } -} - -#[derive(Clone, Copy)] -pub enum Method<'a> { +#[derive(Clone, Eq, PartialEq, Hash)] +pub enum Method { Everything, // equivalent to Required { dev_deps: true, all_features: true, .. } Required { dev_deps: bool, - features: &'a [InternedString], + features: FeaturesSet, all_features: bool, uses_default_features: bool, }, } -impl<'r> Method<'r> { - pub fn split_features(features: &[String]) -> Vec { +impl Method { + pub fn split_features(features: &[String]) -> BTreeSet { features .iter() .flat_map(|s| s.split_whitespace()) .flat_map(|s| s.split(',')) .filter(|s| !s.is_empty()) - .map(|s| InternedString::new(s)) - .collect::>() + .map(InternedString::new) + .collect::>() } } #[derive(Clone)] -pub struct Candidate { - pub summary: Summary, - pub replace: Option, -} - -#[derive(Clone)] pub struct DepsFrame { pub parent: Summary, pub just_for_error_messages: bool, @@ -376,10 +222,10 @@ } } -// Information about the dependencies for a crate, a tuple of: -// -// (dependency info, candidates, features activated) -pub type DepInfo = (Dependency, Rc>, Rc>); +/// Information about the dependencies for a crate, a tuple of: +/// +/// (dependency info, candidates, features activated) +pub type DepInfo = (Dependency, Rc>, FeaturesSet); /// All possible reasons that a package might fail to activate. /// @@ -402,6 +248,17 @@ /// candidate. For example we tried to activate feature `foo` but the /// candidate we're activating didn't actually have the feature `foo`. MissingFeatures(String), + + /// A dependency listed features that ended up being a required dependency. + /// For example we tried to activate feature `foo` but the + /// candidate we're activating didn't actually have the feature `foo` + /// it had a dependency `foo` instead. + RequiredDependencyAsFeatures(InternedString), + + // TODO: needs more info for `activation_error` + // TODO: needs more info for `find_candidate` + /// pub dep error + PublicDependency, } impl ConflictReason { @@ -418,8 +275,21 @@ } false } + + pub fn is_required_dependency_as_features(&self) -> bool { + if let ConflictReason::RequiredDependencyAsFeatures(_) = *self { + return true; + } + false + } } +/// A list of packages that have gotten in the way of resolving a dependency. +/// If resolving a dependency fails then this represents an incompatibility, +/// that dependency will never be resolve while all of these packages are active. +/// This is useless if the packages can't be simultaneously activated for other reasons. +pub type ConflictMap = BTreeMap; + pub struct RcVecIter { vec: Rc>, rest: Range, @@ -470,50 +340,3 @@ } impl ExactSizeIterator for RcVecIter {} - -pub struct RcList { - pub head: Option)>>, -} - -impl RcList { - pub fn new() -> RcList { - RcList { head: None } - } - - pub fn push(&mut self, data: T) { - let node = Rc::new(( - data, - RcList { - head: self.head.take(), - }, - )); - self.head = Some(node); - } -} - -// Not derived to avoid `T: Clone` -impl Clone for RcList { - fn clone(&self) -> RcList { - RcList { - head: self.head.clone(), - } - } -} - -// Avoid stack overflows on drop by turning recursion into a loop -impl Drop for RcList { - fn drop(&mut self) { - let mut cur = self.head.take(); - while let Some(head) = cur { - match Rc::try_unwrap(head) { - Ok((_data, mut next)) => cur = next.head.take(), - Err(_) => break, - } - } - } -} - -pub enum GraphNode { - Add(PackageId), - Link(PackageId, PackageId, Dependency), -} diff -Nru cargo-0.35.0/src/cargo/core/source/mod.rs cargo-0.37.0/src/cargo/core/source/mod.rs --- cargo-0.35.0/src/cargo/core/source/mod.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/source/mod.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,8 +1,8 @@ use std::collections::hash_map::HashMap; use std::fmt; -use crate::core::{Dependency, Package, PackageId, Summary}; use crate::core::package::PackageSet; +use crate::core::{Dependency, Package, PackageId, Summary}; use crate::util::{CargoResult, Config}; mod source_id; @@ -96,6 +96,10 @@ /// queries, even if they are yanked. Currently only applies to registry /// sources. fn add_to_yanked_whitelist(&mut self, pkgs: &[PackageId]); + + /// Query if a package is yanked. Only registry sources can mark packages + /// as yanked. This ignores the yanked whitelist. + fn is_yanked(&mut self, _pkg: PackageId) -> CargoResult; } pub enum MaybePackage { @@ -169,6 +173,10 @@ fn add_to_yanked_whitelist(&mut self, pkgs: &[PackageId]) { (**self).add_to_yanked_whitelist(pkgs); } + + fn is_yanked(&mut self, pkg: PackageId) -> CargoResult { + (**self).is_yanked(pkg) + } } impl<'a, T: Source + ?Sized + 'a> Source for &'a mut T { @@ -227,6 +235,10 @@ fn add_to_yanked_whitelist(&mut self, pkgs: &[PackageId]) { (**self).add_to_yanked_whitelist(pkgs); } + + fn is_yanked(&mut self, pkg: PackageId) -> CargoResult { + (**self).is_yanked(pkg) + } } /// A `HashMap` of `SourceId` -> `Box`. diff -Nru cargo-0.35.0/src/cargo/core/source/source_id.rs cargo-0.37.0/src/cargo/core/source/source_id.rs --- cargo-0.35.0/src/cargo/core/source/source_id.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/source/source_id.rs 2019-05-15 19:48:47.000000000 +0000 @@ -228,7 +228,7 @@ &self.inner.url } - pub fn display_registry(self) -> String { + pub fn display_index(self) -> String { if self.is_default_registry() { "crates.io index".to_string() } else { @@ -236,6 +236,16 @@ } } + pub fn display_registry_name(self) -> String { + if self.is_default_registry() { + "crates.io".to_string() + } else if let Some(name) = &self.inner.name { + name.clone() + } else { + url_display(self.url()) + } + } + /// Returns `true` if this source is from a filesystem path. pub fn is_path(self) -> bool { self.inner.kind == Kind::Path @@ -327,7 +337,7 @@ Kind::Registry => {} _ => return false, } - self.inner.url.to_string() == CRATES_IO_INDEX + self.inner.url.as_str() == CRATES_IO_INDEX } /// Hashes `self`. @@ -368,7 +378,7 @@ impl Ord for SourceId { fn cmp(&self, other: &SourceId) -> Ordering { - self.inner.cmp(&other.inner) + self.inner.cmp(other.inner) } } diff -Nru cargo-0.35.0/src/cargo/core/summary.rs cargo-0.37.0/src/cargo/core/summary.rs --- cargo-0.35.0/src/cargo/core/summary.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/summary.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,6 +1,7 @@ use std::borrow::Borrow; use std::collections::{BTreeMap, HashMap}; use std::fmt::Display; +use std::hash::{Hash, Hasher}; use std::mem; use std::rc::Rc; @@ -58,7 +59,7 @@ ) } } - let feature_map = build_feature_map(&features, &dependencies, namespaced_features)?; + let feature_map = build_feature_map(features, &dependencies, namespaced_features)?; Ok(Summary { inner: Rc::new(Inner { package_id: pkg_id, @@ -104,9 +105,8 @@ self } - pub fn set_checksum(mut self, cksum: String) -> Summary { + pub fn set_checksum(&mut self, cksum: String) { Rc::make_mut(&mut self.inner).checksum = Some(cksum); - self } pub fn map_dependencies(mut self, f: F) -> Summary @@ -138,6 +138,14 @@ } } +impl Eq for Summary {} + +impl Hash for Summary { + fn hash(&self, state: &mut H) { + self.inner.package_id.hash(state); + } +} + // Checks features for errors, bailing out a CargoResult:Err if invalid, // and creates FeatureValues for each feature. fn build_feature_map( @@ -170,7 +178,7 @@ // iteration over the list if the dependency is found in the list. let mut dependency_found = if namespaced { match dep_map.get(feature.borrow()) { - Some(ref dep_data) => { + Some(dep_data) => { if !dep_data.iter().any(|d| d.is_optional()) { failure::bail!( "Feature `{}` includes the dependency of the same name, but this is \ diff -Nru cargo-0.35.0/src/cargo/core/workspace.rs cargo-0.37.0/src/cargo/core/workspace.rs --- cargo-0.35.0/src/cargo/core/workspace.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/core/workspace.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,6 +1,6 @@ use std::cell::RefCell; use std::collections::hash_map::{Entry, HashMap}; -use std::collections::BTreeMap; +use std::collections::{BTreeMap, HashSet}; use std::path::{Path, PathBuf}; use std::slice; @@ -8,9 +8,10 @@ use log::debug; use url::Url; +use crate::core::features::Features; use crate::core::profiles::Profiles; use crate::core::registry::PackageRegistry; -use crate::core::{Dependency, PackageIdSpec}; +use crate::core::{Dependency, PackageId, PackageIdSpec}; use crate::core::{EitherManifest, Package, SourceId, VirtualManifest}; use crate::ops; use crate::sources::PathSource; @@ -51,6 +52,7 @@ // paths. The packages themselves can be looked up through the `packages` // set above. members: Vec, + member_ids: HashSet, // The subset of `members` that are used by the // `build`, `check`, `test`, and `bench` subcommands @@ -77,6 +79,10 @@ // A cache of loaded packages for particular paths which is disjoint from // `packages` up above, used in the `load` method down below. loaded_packages: RefCell>, + + // If `true`, then the resolver will ignore any existing `Cargo.lock` + // file. This is set for `cargo install` without `--locked`. + ignore_lock: bool, } // Separate structure for tracking loaded packages (to avoid loading anything @@ -144,10 +150,12 @@ root_manifest: None, target_dir, members: Vec::new(), + member_ids: HashSet::new(), default_members: Vec::new(), is_ephemeral: false, require_optional_deps: true, loaded_packages: RefCell::new(HashMap::new()), + ignore_lock: false, }; ws.root_manifest = ws.find_root(manifest_path)?; ws.find_members()?; @@ -180,13 +188,16 @@ root_manifest: None, target_dir: None, members: Vec::new(), + member_ids: HashSet::new(), default_members: Vec::new(), is_ephemeral: true, require_optional_deps, loaded_packages: RefCell::new(HashMap::new()), + ignore_lock: false, }; { let key = ws.current_manifest.parent().unwrap(); + let id = package.package_id(); let package = MaybePackage::Package(package); ws.packages.packages.insert(key.to_path_buf(), package); ws.target_dir = if let Some(dir) = target_dir { @@ -195,6 +206,7 @@ ws.config.target_dir()? }; ws.members.push(ws.current_manifest.clone()); + ws.member_ids.insert(id); ws.default_members.push(ws.current_manifest.clone()); } Ok(ws) @@ -309,7 +321,7 @@ /// Returns true if the package is a member of the workspace. pub fn is_member(&self, pkg: &Package) -> bool { - self.members().any(|p| p == pkg) + self.member_ids.contains(&pkg.package_id()) } pub fn is_ephemeral(&self) -> bool { @@ -320,14 +332,23 @@ self.require_optional_deps } - pub fn set_require_optional_deps<'a>( - &'a mut self, + pub fn set_require_optional_deps( + &mut self, require_optional_deps: bool, ) -> &mut Workspace<'cfg> { self.require_optional_deps = require_optional_deps; self } + pub fn ignore_lock(&self) -> bool { + self.ignore_lock + } + + pub fn set_ignore_lock(&mut self, ignore_lock: bool) -> &mut Workspace<'cfg> { + self.ignore_lock = ignore_lock; + self + } + /// Finds the root of a workspace for the crate whose manifest is located /// at `manifest_path`. /// @@ -415,6 +436,10 @@ debug!("find_members - only me as a member"); self.members.push(self.current_manifest.clone()); self.default_members.push(self.current_manifest.clone()); + if let Ok(pkg) = self.current() { + let id = pkg.package_id(); + self.member_ids.insert(id); + } return Ok(()); } }; @@ -500,6 +525,7 @@ MaybePackage::Package(ref p) => p, MaybePackage::Virtual(_) => return Ok(()), }; + self.member_ids.insert(pkg.package_id()); pkg.dependencies() .iter() .map(|d| d.source_id()) @@ -515,6 +541,13 @@ Ok(()) } + pub fn features(&self) -> &Features { + match self.root_maybe() { + MaybePackage::Package(p) => p.manifest().features(), + MaybePackage::Virtual(vm) => vm.features(), + } + } + /// Validates a workspace, ensuring that a number of invariants are upheld: /// /// 1. A workspace only has one root. @@ -522,10 +555,7 @@ /// 3. The current crate is a member of this workspace. fn validate(&mut self) -> CargoResult<()> { // Validate config profiles only once per workspace. - let features = match self.root_maybe() { - MaybePackage::Package(p) => p.manifest().features(), - MaybePackage::Virtual(vm) => vm.features(), - }; + let features = self.features(); let mut warnings = Vec::new(); self.config.profiles()?.validate(features, &mut warnings)?; for warning in warnings { @@ -660,7 +690,10 @@ failure::bail!( "current package believes it's in a workspace when it's not:\n\ current: {}\n\ - workspace: {}\n\n{}", + workspace: {}\n\n{}\n\ + Alternatively, to keep it out of the workspace, add the package \ + to the `workspace.exclude` array, or add an empty `[workspace]` \ + table to the package's manifest.", self.current_manifest.display(), root.display(), extra diff -Nru cargo-0.35.0/src/cargo/lib.rs cargo-0.37.0/src/cargo/lib.rs --- cargo-0.35.0/src/cargo/lib.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/lib.rs 2019-05-15 19:48:47.000000000 +0000 @@ -10,10 +10,13 @@ #![allow(clippy::identity_op)] // used for vertical alignment #![allow(clippy::implicit_hasher)] // large project #![allow(clippy::large_enum_variant)] // large project +#![allow(clippy::redundant_closure)] // closures can be less verbose #![allow(clippy::redundant_closure_call)] // closures over try catch blocks #![allow(clippy::too_many_arguments)] // large project #![allow(clippy::type_complexity)] // there's an exceptionally complex type #![allow(clippy::wrong_self_convention)] // perhaps `Rc` should be special-cased in Clippy? +#![warn(clippy::needless_borrow)] +#![warn(clippy::redundant_clone)] use std::fmt; diff -Nru cargo-0.35.0/src/cargo/ops/cargo_clean.rs cargo-0.37.0/src/cargo/ops/cargo_clean.rs --- cargo-0.35.0/src/cargo/ops/cargo_clean.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/ops/cargo_clean.rs 2019-05-15 19:48:47.000000000 +0000 @@ -2,7 +2,8 @@ use std::fs; use std::path::Path; -use crate::core::compiler::{BuildConfig, BuildContext, CompileMode, Context, Kind, Unit}; +use crate::core::compiler::UnitInterner; +use crate::core::compiler::{BuildConfig, BuildContext, CompileMode, Context, Kind}; use crate::core::profiles::UnitFor; use crate::core::Workspace; use crate::ops; @@ -50,6 +51,19 @@ let (packages, resolve) = ops::resolve_ws(ws)?; let profiles = ws.profiles(); + let interner = UnitInterner::new(); + let mut build_config = BuildConfig::new(config, Some(1), &opts.target, CompileMode::Build)?; + build_config.release = opts.release; + let bcx = BuildContext::new( + ws, + &resolve, + &packages, + opts.config, + &build_config, + profiles, + &interner, + HashMap::new(), + )?; let mut units = Vec::new(); for spec in opts.spec.iter() { @@ -79,30 +93,13 @@ opts.release, ) }; - units.push(Unit { - pkg, - target, - profile, - kind: *kind, - mode: *mode, - }); + units.push(bcx.units.intern(pkg, target, profile, *kind, *mode)); } } } } } - let mut build_config = BuildConfig::new(config, Some(1), &opts.target, CompileMode::Build)?; - build_config.release = opts.release; - let bcx = BuildContext::new( - ws, - &resolve, - &packages, - opts.config, - &build_config, - profiles, - HashMap::new(), - )?; let mut cx = Context::new(config, &bcx)?; cx.prepare_units(None, &units)?; diff -Nru cargo-0.35.0/src/cargo/ops/cargo_compile.rs cargo-0.37.0/src/cargo/ops/cargo_compile.rs --- cargo-0.35.0/src/cargo/ops/cargo_compile.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/ops/cargo_compile.rs 2019-05-15 19:48:47.000000000 +0000 @@ -23,15 +23,15 @@ use std::collections::{BTreeSet, HashMap, HashSet}; use std::iter::FromIterator; use std::path::PathBuf; +use std::rc::Rc; use std::sync::Arc; -use crate::core::compiler::{ - BuildConfig, BuildContext, Compilation, Context, DefaultExecutor, Executor, -}; +use crate::core::compiler::{BuildConfig, BuildContext, Compilation, Context}; use crate::core::compiler::{CompileMode, Kind, Unit}; +use crate::core::compiler::{DefaultExecutor, Executor, UnitInterner}; use crate::core::profiles::{Profiles, UnitFor}; use crate::core::resolver::{Method, Resolve}; -use crate::core::{Package, Source, Target}; +use crate::core::{Package, Target}; use crate::core::{PackageId, PackageIdSpec, TargetKind, Workspace}; use crate::ops; use crate::util::config::Config; @@ -126,12 +126,16 @@ if !opt_out.is_empty() { ws.config().shell().warn(format!( "excluded package(s) {} not found in workspace `{}`", - opt_out.iter().map(|x| x.as_ref()).collect::>().join(", "), + opt_out + .iter() + .map(|x| x.as_ref()) + .collect::>() + .join(", "), ws.root().display(), ))?; } packages - }, + } Packages::Packages(packages) if packages.is_empty() => { vec![PackageIdSpec::from_package_id(ws.current()?.package_id())] } @@ -182,6 +186,27 @@ }; Ok(packages) } + + /// Returns whether or not the user needs to pass a `-p` flag to target a + /// specific package in the workspace. + pub fn needs_spec_flag(&self, ws: &Workspace<'_>) -> bool { + match self { + Packages::Default => ws.default_members().count() > 1, + Packages::All => ws.members().count() > 1, + Packages::Packages(_) => true, + Packages::OptOut(_) => true, + } + } +} + +#[derive(Debug, PartialEq, Eq)] +pub enum LibRule { + /// Include the library, fail if not present + True, + /// Include the library if present + Default, + /// Exclude the library + False, } #[derive(Debug)] @@ -198,7 +223,7 @@ }, Only { all_targets: bool, - lib: bool, + lib: LibRule, bins: FilterRule, examples: FilterRule, tests: FilterRule, @@ -222,12 +247,11 @@ exec: &Arc, ) -> CargoResult> { ws.emit_warnings()?; - compile_ws(ws, None, options, exec) + compile_ws(ws, options, exec) } pub fn compile_ws<'a>( ws: &Workspace<'a>, - source: Option>, options: &CompileOptions<'a>, exec: &Arc, ) -> CargoResult> { @@ -245,6 +269,27 @@ ref export_dir, } = *options; + match build_config.mode { + CompileMode::Test + | CompileMode::Build + | CompileMode::Check { .. } + | CompileMode::Bench + | CompileMode::RunCustomBuild => { + if std::env::var("RUST_FLAGS").is_ok() { + config.shell().warn( + "Cargo does not read `RUST_FLAGS` environment variable. Did you mean `RUSTFLAGS`?", + )?; + } + } + CompileMode::Doc { .. } | CompileMode::Doctest => { + if std::env::var("RUSTDOC_FLAGS").is_ok() { + config.shell().warn( + "Cargo does not read `RUSTDOC_FLAGS` environment variable. Did you mean `RUSTDOCFLAGS`?" + )?; + } + } + } + let default_arch_kind = if build_config.requested_target.is_some() { Kind::Target } else { @@ -255,11 +300,11 @@ let features = Method::split_features(features); let method = Method::Required { dev_deps: ws.require_optional_deps() || filter.need_dev_deps(build_config.mode), - features: &features, + features: Rc::new(features), all_features, uses_default_features: !no_default_features, }; - let resolve = ops::resolve_ws_with_method(ws, source, method, &specs)?; + let resolve = ops::resolve_ws_with_method(ws, method, &specs)?; let (packages, resolve_with_overrides) = resolve; let to_build_ids = specs @@ -304,6 +349,17 @@ let profiles = ws.profiles(); profiles.validate_packages(&mut config.shell(), &packages)?; + let interner = UnitInterner::new(); + let mut bcx = BuildContext::new( + ws, + &resolve_with_overrides, + &packages, + config, + build_config, + profiles, + &interner, + HashMap::new(), + )?; let units = generate_targets( ws, profiles, @@ -311,10 +367,9 @@ filter, default_arch_kind, &resolve_with_overrides, - build_config, + &bcx, )?; - let mut extra_compiler_args = HashMap::new(); if let Some(args) = extra_args { if units.len() != 1 { failure::bail!( @@ -324,29 +379,20 @@ extra_args_name ); } - extra_compiler_args.insert(units[0], args); + bcx.extra_compiler_args.insert(units[0], args); } if let Some(args) = local_rustdoc_args { for unit in &units { if unit.mode.is_doc() { - extra_compiler_args.insert(*unit, args.clone()); + bcx.extra_compiler_args.insert(*unit, args.clone()); } } } let ret = { let _p = profile::start("compiling"); - let bcx = BuildContext::new( - ws, - &resolve_with_overrides, - &packages, - config, - &build_config, - profiles, - extra_compiler_args, - )?; let cx = Context::new(config, &bcx)?; - cx.compile(&units, export_dir.clone(), &exec)? + cx.compile(&units, export_dir.clone(), exec)? }; Ok(ret) @@ -361,6 +407,10 @@ } } + pub fn none() -> FilterRule { + FilterRule::Just(Vec::new()) + } + fn matches(&self, target: &Target) -> bool { match *self { FilterRule::All => true, @@ -384,7 +434,8 @@ } impl CompileFilter { - pub fn new( + /// Construct a CompileFilter from raw command line arguments. + pub fn from_raw_arguments( lib_only: bool, bins: Vec, all_bins: bool, @@ -396,6 +447,11 @@ all_bens: bool, all_targets: bool, ) -> CompileFilter { + let rule_lib = if lib_only { + LibRule::True + } else { + LibRule::False + }; let rule_bins = FilterRule::new(bins, all_bins); let rule_tsts = FilterRule::new(tsts, all_tsts); let rule_exms = FilterRule::new(exms, all_exms); @@ -404,13 +460,26 @@ if all_targets { CompileFilter::Only { all_targets: true, - lib: true, + lib: LibRule::Default, bins: FilterRule::All, examples: FilterRule::All, benches: FilterRule::All, tests: FilterRule::All, } - } else if lib_only + } else { + CompileFilter::new(rule_lib, rule_bins, rule_tsts, rule_exms, rule_bens) + } + } + + /// Construct a CompileFilter from underlying primitives. + pub fn new( + rule_lib: LibRule, + rule_bins: FilterRule, + rule_tsts: FilterRule, + rule_exms: FilterRule, + rule_bens: FilterRule, + ) -> CompileFilter { + if rule_lib == LibRule::True || rule_bins.is_specific() || rule_tsts.is_specific() || rule_exms.is_specific() @@ -418,7 +487,7 @@ { CompileFilter::Only { all_targets: false, - lib: lib_only, + lib: rule_lib, bins: rule_bins, examples: rule_exms, benches: rule_bens, @@ -454,7 +523,7 @@ match *self { CompileFilter::Default { .. } => true, CompileFilter::Only { - lib, + ref lib, ref bins, ref examples, ref tests, @@ -466,7 +535,13 @@ TargetKind::Test => tests, TargetKind::Bench => benches, TargetKind::ExampleBin | TargetKind::ExampleLib(..) => examples, - TargetKind::Lib(..) => return lib, + TargetKind::Lib(..) => { + return match *lib { + LibRule::True => true, + LibRule::Default => true, + LibRule::False => false, + }; + } TargetKind::CustomBuild => return false, }; rule.matches(target) @@ -507,11 +582,11 @@ filter: &CompileFilter, default_arch_kind: Kind, resolve: &Resolve, - build_config: &BuildConfig, + bcx: &BuildContext<'a, '_>, ) -> CargoResult>> { // Helper for creating a `Unit` struct. let new_unit = |pkg: &'a Package, target: &'a Target, target_mode: CompileMode| { - let unit_for = if build_config.mode.is_any_test() { + let unit_for = if bcx.build_config.mode.is_any_test() { // NOTE: the `UnitFor` here is subtle. If you have a profile // with `panic` set, the `panic` flag is cleared for // tests/benchmarks and their dependencies. If this @@ -576,15 +651,9 @@ ws.is_member(pkg), unit_for, target_mode, - build_config.release, + bcx.build_config.release, ); - Unit { - pkg, - target, - profile, - kind, - mode: target_mode, - } + bcx.units.intern(pkg, target, profile, kind, target_mode) }; // Create a list of proposed targets. @@ -595,14 +664,14 @@ required_features_filterable, } => { for pkg in packages { - let default = filter_default_targets(pkg.targets(), build_config.mode); + let default = filter_default_targets(pkg.targets(), bcx.build_config.mode); proposals.extend(default.into_iter().map(|target| Proposal { pkg, target, requires_features: !required_features_filterable, - mode: build_config.mode, + mode: bcx.build_config.mode, })); - if build_config.mode == CompileMode::Test { + if bcx.build_config.mode == CompileMode::Test { if let Some(t) = pkg .targets() .iter() @@ -620,17 +689,19 @@ } CompileFilter::Only { all_targets, - lib, + ref lib, ref bins, ref examples, ref tests, ref benches, } => { - if lib { + if *lib != LibRule::False { let mut libs = Vec::new(); - for proposal in filter_targets(packages, Target::is_lib, false, build_config.mode) { + for proposal in + filter_targets(packages, Target::is_lib, false, bcx.build_config.mode) + { let Proposal { target, pkg, .. } = proposal; - if build_config.mode == CompileMode::Doctest && !target.doctestable() { + if bcx.build_config.mode == CompileMode::Doctest && !target.doctestable() { ws.config().shell().warn(format!( "doc tests are not supported for crate type(s) `{}` in package `{}`", target.rustc_crate_types().join(", "), @@ -640,7 +711,7 @@ libs.push(proposal) } } - if !all_targets && libs.is_empty() { + if !all_targets && libs.is_empty() && *lib == LibRule::True { let names = packages.iter().map(|pkg| pkg.name()).collect::>(); if names.len() == 1 { failure::bail!("no library targets found in package `{}`", names[0]); @@ -660,10 +731,10 @@ FilterRule::All => Target::tested, FilterRule::Just(_) => Target::is_test, }; - let test_mode = match build_config.mode { + let test_mode = match bcx.build_config.mode { CompileMode::Build => CompileMode::Test, CompileMode::Check { .. } => CompileMode::Check { test: true }, - _ => build_config.mode, + _ => bcx.build_config.mode, }; // If `--benches` was specified, add all targets that would be // generated by `cargo bench`. @@ -671,10 +742,10 @@ FilterRule::All => Target::benched, FilterRule::Just(_) => Target::is_bench, }; - let bench_mode = match build_config.mode { + let bench_mode = match bcx.build_config.mode { CompileMode::Build => CompileMode::Bench, CompileMode::Check { .. } => CompileMode::Check { test: true }, - _ => build_config.mode, + _ => bcx.build_config.mode, }; proposals.extend(list_rule_targets( @@ -682,14 +753,14 @@ bins, "bin", Target::is_bin, - build_config.mode, + bcx.build_config.mode, )?); proposals.extend(list_rule_targets( packages, examples, "example", Target::is_example, - build_config.mode, + bcx.build_config.mode, )?); proposals.extend(list_rule_targets( packages, diff -Nru cargo-0.35.0/src/cargo/ops/cargo_doc.rs cargo-0.37.0/src/cargo/ops/cargo_doc.rs --- cargo-0.35.0/src/cargo/ops/cargo_doc.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/ops/cargo_doc.rs 2019-05-15 19:48:47.000000000 +0000 @@ -23,7 +23,6 @@ let specs = options.compile_opts.spec.to_package_id_specs(ws)?; let resolve = ops::resolve_ws_precisely( ws, - None, &options.compile_opts.features, options.compile_opts.all_features, options.compile_opts.no_default_features, @@ -39,6 +38,7 @@ let mut lib_names = HashMap::new(); let mut bin_names = HashMap::new(); + let mut names = Vec::new(); for package in &pkgs { for target in package.targets().iter().filter(|t| t.documented()) { if target.is_lib() { @@ -62,27 +62,16 @@ package ); } + names.push(target.crate_name()); } } ops::compile(ws, &options.compile_opts)?; if options.open_result { - let name = if pkgs.len() > 1 { - failure::bail!( - "Passing multiple packages and `open` is not supported.\n\ - Please re-run this command with `-p ` where `` \ - is one of the following:\n {}", - pkgs.iter() - .map(|p| p.name().as_str()) - .collect::>() - .join("\n ") - ); - } else { - match lib_names.keys().chain(bin_names.keys()).nth(0) { - Some(s) => s.to_string(), - None => return Ok(()), - } + let name = match names.first() { + Some(s) => s.to_string(), + None => return Ok(()), }; // Don't bother locking here as if this is getting deleted there's diff -Nru cargo-0.35.0/src/cargo/ops/cargo_fetch.rs cargo-0.37.0/src/cargo/ops/cargo_fetch.rs --- cargo-0.35.0/src/cargo/ops/cargo_fetch.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/ops/cargo_fetch.rs 2019-05-15 19:48:47.000000000 +0000 @@ -21,7 +21,7 @@ let jobs = Some(1); let config = ws.config(); let build_config = BuildConfig::new(config, jobs, &options.target, CompileMode::Build)?; - let rustc = config.rustc(Some(ws))?; + let rustc = config.load_global_rustc(Some(ws))?; let target_info = TargetInfo::new(config, &build_config.requested_target, &rustc, Kind::Target)?; { diff -Nru cargo-0.35.0/src/cargo/ops/cargo_generate_lockfile.rs cargo-0.37.0/src/cargo/ops/cargo_generate_lockfile.rs --- cargo-0.35.0/src/cargo/ops/cargo_generate_lockfile.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/ops/cargo_generate_lockfile.rs 2019-05-15 19:48:47.000000000 +0000 @@ -21,16 +21,8 @@ pub fn generate_lockfile(ws: &Workspace<'_>) -> CargoResult<()> { let mut registry = PackageRegistry::new(ws.config())?; - let resolve = ops::resolve_with_previous( - &mut registry, - ws, - Method::Everything, - None, - None, - &[], - true, - true, - )?; + let resolve = + ops::resolve_with_previous(&mut registry, ws, Method::Everything, None, None, &[], true)?; ops::write_pkg_lockfile(ws, &resolve)?; Ok(()) } @@ -44,13 +36,29 @@ failure::bail!("you can't generate a lockfile for an empty workspace.") } - if opts.config.cli_unstable().offline { + if opts.config.offline() { failure::bail!("you can't update in the offline mode"); } + // Updates often require a lot of modifications to the registry, so ensure + // that we're synchronized against other Cargos. + let _lock = ws.config().acquire_package_cache_lock()?; + let previous_resolve = match ops::load_pkg_lockfile(ws)? { Some(resolve) => resolve, - None => return generate_lockfile(ws), + None => { + match opts.precise { + None => return generate_lockfile(ws), + + // Precise option specified, so calculate a previous_resolve required + // by precise package update later. + Some(_) => { + let mut registry = PackageRegistry::new(opts.config)?; + ops::resolve_with_previous(&mut registry, ws, Method::Everything, + None, None, &[], true)? + } + } + } }; let mut registry = PackageRegistry::new(opts.config)?; let mut to_avoid = HashSet::new(); @@ -81,6 +89,7 @@ }); } } + registry.add_sources(sources)?; } @@ -92,7 +101,6 @@ Some(&to_avoid), &[], true, - true, )?; // Summarize what is changing for the user. diff -Nru cargo-0.35.0/src/cargo/ops/cargo_install.rs cargo-0.37.0/src/cargo/ops/cargo_install.rs --- cargo-0.35.0/src/cargo/ops/cargo_install.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/ops/cargo_install.rs 2019-05-15 19:48:47.000000000 +0000 @@ -3,18 +3,18 @@ use std::sync::Arc; use std::{env, fs}; +use failure::{bail, format_err}; use tempfile::Builder as TempFileBuilder; +use crate::core::compiler::Freshness; use crate::core::compiler::{DefaultExecutor, Executor}; -use crate::core::{Edition, Package, Source, SourceId}; -use crate::core::{PackageId, Workspace}; +use crate::core::resolver::Method; +use crate::core::{Edition, PackageId, PackageIdSpec, Source, SourceId, Workspace}; +use crate::ops; use crate::ops::common_for_install_and_uninstall::*; -use crate::ops::{self, CompileFilter}; use crate::sources::{GitSource, SourceConfigMap}; use crate::util::errors::{CargoResult, CargoResultExt}; -use crate::util::paths; -use crate::util::Config; -use crate::util::Filesystem; +use crate::util::{paths, Config, Filesystem}; struct Transaction { bins: Vec, @@ -42,6 +42,7 @@ vers: Option<&str>, opts: &ops::CompileOptions<'_>, force: bool, + no_track: bool, ) -> CargoResult<()> { let root = resolve_root(root, opts.config)?; let map = SourceConfigMap::new(opts.config)?; @@ -56,6 +57,7 @@ vers, opts, force, + no_track, true, )?; (true, false) @@ -75,6 +77,7 @@ vers, opts, force, + no_track, first, ) { Ok(()) => succeeded.push(krate), @@ -106,7 +109,7 @@ if installed_anything { // Print a warning that if this directory isn't in PATH that they won't be // able to run these commands. - let dst = metadata(opts.config, &root)?.parent().join("bin"); + let dst = root.join("bin").into_path_unlocked(); let path = env::var_os("PATH").unwrap_or_default(); for path in env::split_paths(&path) { if path == dst { @@ -122,7 +125,7 @@ } if scheduled_error { - failure::bail!("some crates failed to install"); + bail!("some crates failed to install"); } Ok(()) @@ -137,11 +140,12 @@ vers: Option<&str>, opts: &ops::CompileOptions<'_>, force: bool, + no_track: bool, is_first_install: bool, ) -> CargoResult<()> { let config = opts.config; - let (pkg, source) = if source_id.is_git() { + let pkg = if source_id.is_git() { select_pkg( GitSource::new(source_id, config)?, krate, @@ -153,7 +157,7 @@ } else if source_id.is_path() { let mut src = path_source(source_id, config)?; if !src.path().is_dir() { - failure::bail!( + bail!( "`{}` is not a directory. \ --path must point to a directory containing a Cargo.toml file.", src.path().display() @@ -161,14 +165,14 @@ } if !src.path().join("Cargo.toml").exists() { if from_cwd { - failure::bail!( + bail!( "`{}` is not a crate root; specify a crate to \ install from crates.io, or use --path or --git to \ specify an alternate source", src.path().display() ); } else { - failure::bail!( + bail!( "`{}` does not contain a Cargo.toml file. \ --path must point to a directory containing a Cargo.toml file.", src.path().display() @@ -187,7 +191,7 @@ config, is_first_install, &mut |_| { - failure::bail!( + bail!( "must specify a crate to install from \ crates.io, or use --path or --git to \ specify alternate source" @@ -211,7 +215,7 @@ Some(Filesystem::new(config.cwd().join("target-install"))) }; - let ws = match overidden_target_dir { + let mut ws = match overidden_target_dir { Some(dir) => Workspace::ephemeral(pkg, config, Some(dir), false)?, None => { let mut ws = Workspace::new(pkg.manifest_path(), config)?; @@ -219,6 +223,7 @@ ws } }; + ws.set_ignore_lock(config.lock_update_allowed()); let pkg = ws.current()?; if from_cwd { @@ -230,7 +235,7 @@ Use `cargo build` if you want to simply build the package.", )? } else { - failure::bail!( + bail!( "Using `cargo install` to install the binaries for the \ package in current working directory is no longer supported, \ use `cargo install --path .` instead. \ @@ -239,33 +244,83 @@ } }; - config.shell().status("Installing", pkg)?; + // For bare `cargo install` (no `--bin` or `--example`), check if there is + // *something* to install. Explicit `--bin` or `--example` flags will be + // checked at the start of `compile_ws`. + if !opts.filter.is_specific() && !pkg.targets().iter().any(|t| t.is_bin()) { + bail!("specified package `{}` has no binaries", pkg); + } // Preflight checks to check up front whether we'll overwrite something. // We have to check this again afterwards, but may as well avoid building // anything if we're gonna throw it away anyway. - { - let metadata = metadata(config, root)?; - let list = read_crate_list(&metadata)?; - let dst = metadata.parent().join("bin"); - check_overwrites(&dst, pkg, &opts.filter, &list, force)?; + let dst = root.join("bin").into_path_unlocked(); + let rustc = config.load_global_rustc(Some(&ws))?; + let target = opts + .build_config + .requested_target + .as_ref() + .unwrap_or(&rustc.host) + .clone(); + + // Helper for --no-track flag to make sure it doesn't overwrite anything. + let no_track_duplicates = || -> CargoResult>> { + let duplicates: BTreeMap> = exe_names(pkg, &opts.filter) + .into_iter() + .filter(|name| dst.join(name).exists()) + .map(|name| (name, None)) + .collect(); + if !force && !duplicates.is_empty() { + let mut msg: Vec = duplicates + .iter() + .map(|(name, _)| format!("binary `{}` already exists in destination", name)) + .collect(); + msg.push("Add --force to overwrite".to_string()); + bail!("{}", msg.join("\n")); + } + Ok(duplicates) + }; + + // WARNING: no_track does not perform locking, so there is no protection + // of concurrent installs. + if no_track { + // Check for conflicts. + no_track_duplicates()?; + } else { + let tracker = InstallTracker::load(config, root)?; + let (freshness, _duplicates) = + tracker.check_upgrade(&dst, pkg, force, opts, &target, &rustc.verbose_version)?; + if freshness == Freshness::Fresh { + let msg = format!( + "package `{}` is already installed, use --force to override", + pkg + ); + config.shell().status("Ignored", &msg)?; + return Ok(()); + } + // Unlock while building. + drop(tracker); } + config.shell().status("Installing", pkg)?; + + check_yanked_install(&ws)?; + let exec: Arc = Arc::new(DefaultExecutor); - let compile = ops::compile_ws(&ws, Some(source), opts, &exec).chain_err(|| { + let compile = ops::compile_ws(&ws, opts, &exec).chain_err(|| { if let Some(td) = td_opt.take() { // preserve the temporary directory, so the user can inspect it td.into_path(); } - failure::format_err!( + format_err!( "failed to compile `{}`, intermediate artifacts can be \ found at `{}`", pkg, ws.target_dir().display() ) })?; - let binaries: Vec<(&str, &Path)> = compile + let mut binaries: Vec<(&str, &Path)> = compile .binaries .iter() .map(|bin| { @@ -273,21 +328,24 @@ if let Some(s) = name.to_str() { Ok((s, bin.as_ref())) } else { - failure::bail!("Binary `{:?}` name can't be serialized into string", name) + bail!("Binary `{:?}` name can't be serialized into string", name) } }) .collect::>()?; if binaries.is_empty() { - failure::bail!( - "no binaries are available for install using the selected \ - features" - ); + bail!("no binaries are available for install using the selected features"); } + // This is primarily to make testing easier. + binaries.sort_unstable(); - let metadata = metadata(config, root)?; - let mut list = read_crate_list(&metadata)?; - let dst = metadata.parent().join("bin"); - let duplicates = check_overwrites(&dst, pkg, &opts.filter, &list, force)?; + let (tracker, duplicates) = if no_track { + (None, no_track_duplicates()?) + } else { + let tracker = InstallTracker::load(config, root)?; + let (_freshness, duplicates) = + tracker.check_upgrade(&dst, pkg, force, opts, &target, &rustc.verbose_version)?; + (Some(tracker), duplicates) + }; fs::create_dir_all(&dst)?; @@ -304,7 +362,7 @@ continue; } fs::copy(src, &dst).chain_err(|| { - failure::format_err!("failed to copy `{}` to `{}`", src.display(), dst.display()) + format_err!("failed to copy `{}` to `{}`", src.display(), dst.display()) })?; } @@ -314,6 +372,7 @@ .partition(|&bin| duplicates.contains_key(bin)); let mut installed = Transaction { bins: Vec::new() }; + let mut successful_bins = BTreeSet::new(); // Move the temporary copies into `dst` starting with new binaries. for bin in to_install.iter() { @@ -321,76 +380,44 @@ let dst = dst.join(bin); config.shell().status("Installing", dst.display())?; fs::rename(&src, &dst).chain_err(|| { - failure::format_err!("failed to move `{}` to `{}`", src.display(), dst.display()) + format_err!("failed to move `{}` to `{}`", src.display(), dst.display()) })?; installed.bins.push(dst); + successful_bins.insert(bin.to_string()); } // Repeat for binaries which replace existing ones but don't pop the error // up until after updating metadata. - let mut replaced_names = Vec::new(); - let result = { + let replace_result = { let mut try_install = || -> CargoResult<()> { for &bin in to_replace.iter() { let src = staging_dir.path().join(bin); let dst = dst.join(bin); config.shell().status("Replacing", dst.display())?; fs::rename(&src, &dst).chain_err(|| { - failure::format_err!( - "failed to move `{}` to `{}`", - src.display(), - dst.display() - ) + format_err!("failed to move `{}` to `{}`", src.display(), dst.display()) })?; - replaced_names.push(bin); + successful_bins.insert(bin.to_string()); } Ok(()) }; try_install() }; - // Update records of replaced binaries. - for &bin in replaced_names.iter() { - if let Some(&Some(ref p)) = duplicates.get(bin) { - if let Some(set) = list.v1_mut().get_mut(p) { - set.remove(bin); - } - } - // Failsafe to force replacing metadata for git packages - // https://github.com/rust-lang/cargo/issues/4582 - if let Some(set) = list.v1_mut().remove(&pkg.package_id()) { - list.v1_mut().insert(pkg.package_id(), set); - } - list.v1_mut() - .entry(pkg.package_id()) - .or_insert_with(BTreeSet::new) - .insert(bin.to_string()); - } + if let Some(mut tracker) = tracker { + tracker.mark_installed( + pkg, + &successful_bins, + vers.map(|s| s.to_string()), + opts, + target, + rustc.verbose_version, + ); - // Remove empty metadata lines. - let pkgs = list - .v1() - .iter() - .filter_map(|(&p, set)| if set.is_empty() { Some(p) } else { None }) - .collect::>(); - for p in pkgs.iter() { - list.v1_mut().remove(p); - } - - // If installation was successful record newly installed binaries. - if result.is_ok() { - list.v1_mut() - .entry(pkg.package_id()) - .or_insert_with(BTreeSet::new) - .extend(to_install.iter().map(|s| s.to_string())); - } - - let write_result = write_crate_list(&metadata, list); - match write_result { - // Replacement error (if any) isn't actually caused by write error - // but this seems to be the only way to show both. - Err(err) => result.chain_err(|| err)?, - Ok(_) => result?, + match tracker.save() { + Err(err) => replace_result.chain_err(|| err)?, + Ok(_) => replace_result?, + } } // Reaching here means all actions have succeeded. Clean up. @@ -402,98 +429,91 @@ paths::remove_dir_all(&target_dir)?; } - Ok(()) -} - -fn check_overwrites( - dst: &Path, - pkg: &Package, - filter: &ops::CompileFilter, - prev: &CrateListingV1, - force: bool, -) -> CargoResult>> { - // If explicit --bin or --example flags were passed then those'll - // get checked during cargo_compile, we only care about the "build - // everything" case here - if !filter.is_specific() && !pkg.targets().iter().any(|t| t.is_bin()) { - failure::bail!("specified package has no binaries") - } - let duplicates = find_duplicates(dst, pkg, filter, prev); - if force || duplicates.is_empty() { - return Ok(duplicates); - } - // Format the error message. - let mut msg = String::new(); - for (bin, p) in duplicates.iter() { - msg.push_str(&format!("binary `{}` already exists in destination", bin)); - if let Some(p) = p.as_ref() { - msg.push_str(&format!(" as part of `{}`\n", p)); + // Helper for creating status messages. + fn executables>(mut names: impl Iterator + Clone) -> String { + if names.clone().count() == 1 { + format!("(executable `{}`)", names.next().unwrap().as_ref()) } else { - msg.push_str("\n"); + format!( + "(executables {})", + names + .map(|b| format!("`{}`", b.as_ref())) + .collect::>() + .join(", ") + ) } } - msg.push_str("Add --force to overwrite"); - Err(failure::format_err!("{}", msg)) -} -fn find_duplicates( - dst: &Path, - pkg: &Package, - filter: &ops::CompileFilter, - prev: &CrateListingV1, -) -> BTreeMap> { - let check = |name: String| { - // Need to provide type, works around Rust Issue #93349 - let name = format!("{}{}", name, env::consts::EXE_SUFFIX); - if fs::metadata(dst.join(&name)).is_err() { - None - } else if let Some((&p, _)) = prev.v1().iter().find(|&(_, v)| v.contains(&name)) { - Some((name, Some(p))) - } else { - Some((name, None)) + if duplicates.is_empty() { + config.shell().status( + "Installed", + format!("package `{}` {}", pkg, executables(successful_bins.iter())), + )?; + Ok(()) + } else { + if !to_install.is_empty() { + config.shell().status( + "Installed", + format!("package `{}` {}", pkg, executables(to_install.iter())), + )?; + } + // Invert the duplicate map. + let mut pkg_map = BTreeMap::new(); + for (bin_name, opt_pkg_id) in &duplicates { + let key = opt_pkg_id.map_or_else(|| "unknown".to_string(), |pkg_id| pkg_id.to_string()); + pkg_map.entry(key).or_insert_with(Vec::new).push(bin_name); + } + for (pkg_descr, bin_names) in &pkg_map { + config.shell().status( + "Replaced", + format!( + "package `{}` with `{}` {}", + pkg_descr, + pkg, + executables(bin_names.iter()) + ), + )?; } - }; - match *filter { - CompileFilter::Default { .. } => pkg - .targets() - .iter() - .filter(|t| t.is_bin()) - .filter_map(|t| check(t.name().to_string())) - .collect(), - CompileFilter::Only { - ref bins, - ref examples, - .. - } => { - let all_bins: Vec = bins.try_collect().unwrap_or_else(|| { - pkg.targets() - .iter() - .filter(|t| t.is_bin()) - .map(|t| t.name().to_string()) - .collect() - }); - let all_examples: Vec = examples.try_collect().unwrap_or_else(|| { - pkg.targets() - .iter() - .filter(|t| t.is_bin_example()) - .map(|t| t.name().to_string()) - .collect() - }); + Ok(()) + } +} - all_bins - .iter() - .chain(all_examples.iter()) - .filter_map(|t| check(t.clone())) - .collect::>>() +fn check_yanked_install(ws: &Workspace<'_>) -> CargoResult<()> { + if ws.ignore_lock() || !ws.root().join("Cargo.lock").exists() { + return Ok(()); + } + let specs = vec![PackageIdSpec::from_package_id(ws.current()?.package_id())]; + // It would be best if `source` could be passed in here to avoid a + // duplicate "Updating", but since `source` is taken by value, then it + // wouldn't be available for `compile_ws`. + let (pkg_set, resolve) = ops::resolve_ws_with_method(ws, Method::Everything, &specs)?; + let mut sources = pkg_set.sources_mut(); + + // Checking the yanked status invovles taking a look at the registry and + // maybe updating files, so be sure to lock it here. + let _lock = ws.config().acquire_package_cache_lock()?; + + for pkg_id in resolve.iter() { + if let Some(source) = sources.get_mut(pkg_id.source_id()) { + if source.is_yanked(pkg_id)? { + ws.config().shell().warn(format!( + "package `{}` in Cargo.lock is yanked in registry `{}`, \ + consider running without --locked", + pkg_id, + pkg_id.source_id().display_registry_name() + ))?; + } } } + + Ok(()) } +/// Display a list of installed binaries. pub fn install_list(dst: Option<&str>, config: &Config) -> CargoResult<()> { - let dst = resolve_root(dst, config)?; - let dst = metadata(config, &dst)?; - let list = read_crate_list(&dst)?; - for (k, v) in list.v1().iter() { + let root = resolve_root(dst, config)?; + let tracker = InstallTracker::load(config, &root)?; + for (k, v) in tracker.all_installed_bins() { println!("{}:", k); for bin in v { println!(" {}", bin); diff -Nru cargo-0.35.0/src/cargo/ops/cargo_new.rs cargo-0.37.0/src/cargo/ops/cargo_new.rs --- cargo-0.35.0/src/cargo/ops/cargo_new.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/ops/cargo_new.rs 2019-05-15 19:48:47.000000000 +0000 @@ -9,7 +9,7 @@ use git2::Repository as GitRepository; use crate::core::{compiler, Workspace}; -use crate::util::errors::{CargoResult, CargoResultExt}; +use crate::util::errors::{self, CargoResult, CargoResultExt}; use crate::util::{existing_vcs_repo, internal, FossilRepo, GitRepo, HgRepo, PijulRepo}; use crate::util::{paths, validate_package_name, Config}; @@ -438,10 +438,12 @@ /// Return the correctly formatted content of the ignore file for the given /// version control system as `String`. fn format_new(&self, vcs: VersionControl) -> String { - match vcs { - VersionControl::Hg => self.hg_ignore.join("\n"), - _ => self.ignore.join("\n"), - } + let ignore_items = match vcs { + VersionControl::Hg => &self.hg_ignore, + _ => &self.ignore, + }; + + ignore_items.join("\n") + "\n" } /// format_existing is used to format the IgnoreList when the ignore file @@ -459,15 +461,15 @@ let mut out = "\n\n#Added by cargo\n\ #\n\ - #already existing elements are commented out\n" + #already existing elements are commented out\n\n" .to_string(); for item in ignore_items { - out.push('\n'); if existing_items.contains(item) { out.push('#'); } - out.push_str(item) + out.push_str(item); + out.push('\n'); } out @@ -522,7 +524,7 @@ } } VersionControl::Fossil => { - if path.join(".fossil").exists() { + if !path.join(".fossil").exists() { FossilRepo::init(path, config.cwd())?; } } @@ -543,7 +545,7 @@ // both `ignore` and `hgignore` are in sync. let mut ignore = IgnoreList::new(); ignore.push("/target", "^target/"); - ignore.push("**/*.rs.bk", "glob:*.rs.bk\n"); + ignore.push("**/*.rs.bk", "glob:*.rs.bk"); if !opts.bin { ignore.push("Cargo.lock", "glob:Cargo.lock"); } @@ -565,7 +567,13 @@ (Some(name), Some(email), _, _) | (Some(name), None, _, Some(email)) | (None, Some(email), name, _) - | (None, None, name, Some(email)) => format!("{} <{}>", name, email), + | (None, None, name, Some(email)) => { + if email.is_empty() { + name + } else { + format!("{} <{}>", name, email) + } + } (Some(name), None, _, None) | (None, None, name, None) => name, }; @@ -610,6 +618,8 @@ authors = [{}] edition = {} {} +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + [dependencies] {}"#, name, @@ -669,7 +679,7 @@ let msg = format!( "compiling this new crate may not work due to invalid \ workspace configuration\n\n{}", - e + errors::display_causes(&e) ); config.shell().warn(msg)?; } diff -Nru cargo-0.35.0/src/cargo/ops/cargo_output_metadata.rs cargo-0.37.0/src/cargo/ops/cargo_output_metadata.rs --- cargo-0.35.0/src/cargo/ops/cargo_output_metadata.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/ops/cargo_output_metadata.rs 2019-05-15 19:48:47.000000000 +0000 @@ -42,7 +42,7 @@ packages: ws.members().cloned().collect(), workspace_members: ws.members().map(|pkg| pkg.package_id()).collect(), resolve: None, - target_directory: ws.target_dir().clone().into_path_unlocked(), + target_directory: ws.target_dir().into_path_unlocked(), version: VERSION, workspace_root: ws.root().to_path_buf(), }) @@ -52,7 +52,6 @@ let specs = Packages::All.to_package_id_specs(ws)?; let (package_set, resolve) = ops::resolve_ws_precisely( ws, - None, &opt.features, opt.all_features, opt.no_default_features, @@ -70,7 +69,7 @@ resolve: (packages, resolve), root: ws.current_opt().map(|pkg| pkg.package_id()), }), - target_directory: ws.target_dir().clone().into_path_unlocked(), + target_directory: ws.target_dir().into_path_unlocked(), version: VERSION, workspace_root: ws.root().to_path_buf(), }) @@ -105,7 +104,7 @@ { #[derive(Serialize)] struct Dep { - name: Option, + name: String, pkg: PackageId, } @@ -123,13 +122,12 @@ dependencies: resolve.deps(id).map(|(pkg, _deps)| pkg).collect(), deps: resolve .deps(id) - .map(|(pkg, _deps)| { - let name = packages + .filter_map(|(pkg, _deps)| { + packages .get(&pkg) .and_then(|pkg| pkg.targets().iter().find(|t| t.is_lib())) - .and_then(|lib_target| resolve.extern_crate_name(id, pkg, lib_target).ok()); - - Dep { name, pkg } + .and_then(|lib_target| resolve.extern_crate_name(id, pkg, lib_target).ok()) + .map(|name| Dep { name, pkg }) }) .collect(), features: resolve.features_sorted(id), diff -Nru cargo-0.35.0/src/cargo/ops/cargo_package.rs cargo-0.37.0/src/cargo/ops/cargo_package.rs --- cargo-0.35.0/src/cargo/ops/cargo_package.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/ops/cargo_package.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,7 +1,9 @@ +use std::collections::{BTreeSet, HashMap}; use std::fs::{self, File}; use std::io::prelude::*; use std::io::SeekFrom; use std::path::{self, Path, PathBuf}; +use std::rc::Rc; use std::sync::Arc; use flate2::read::GzDecoder; @@ -9,13 +11,19 @@ use log::debug; use serde_json::{self, json}; use tar::{Archive, Builder, EntryType, Header}; +use termcolor::Color; use crate::core::compiler::{BuildConfig, CompileMode, DefaultExecutor, Executor}; -use crate::core::{Package, Source, SourceId, Workspace}; +use crate::core::resolver::Method; +use crate::core::Feature; +use crate::core::{ + Package, PackageId, PackageIdSpec, PackageSet, Resolve, Source, SourceId, Verbosity, Workspace, +}; use crate::ops; use crate::sources::PathSource; use crate::util::errors::{CargoResult, CargoResultExt}; use crate::util::paths; +use crate::util::toml::TomlManifest; use crate::util::{self, internal, Config, FileLock}; pub struct PackageOpts<'cfg> { @@ -34,6 +42,7 @@ static VCS_INFO_FILE: &'static str = ".cargo_vcs_info.json"; pub fn package(ws: &Workspace<'_>, opts: &PackageOpts<'_>) -> CargoResult> { + // Make sure the Cargo.lock is up-to-date and valid. ops::resolve_ws(ws)?; let pkg = ws.current()?; let config = ws.config(); @@ -47,6 +56,12 @@ verify_dependencies(pkg)?; + if !pkg.manifest().exclude().is_empty() && !pkg.manifest().include().is_empty() { + config.shell().warn( + "both package.include and package.exclude are specified; \ + the exclude list will be ignored", + )?; + } // `list_files` outputs warnings as a side effect, so only do it once. let src_files = src.list_files(pkg)?; @@ -58,7 +73,7 @@ // dirty. This will `bail!` if dirty, unless allow_dirty. Produce json // info for any sha1 (HEAD revision) returned. let vcs_info = if !opts.allow_dirty { - check_repo_state(pkg, &src_files, &config, opts.allow_dirty)? + check_repo_state(pkg, &src_files, config, opts.allow_dirty)? .map(|h| json!({"git":{"sha1": h}})) } else { None @@ -71,7 +86,8 @@ .iter() .map(|file| file.strip_prefix(root).unwrap().to_path_buf()) .collect(); - if include_lockfile(pkg) { + if pkg.include_lockfile() && !list.contains(&PathBuf::from("Cargo.lock")) { + // A generated Cargo.lock will be included. list.push("Cargo.lock".into()); } if vcs_info.is_some() { @@ -115,8 +131,31 @@ Ok(Some(dst)) } -fn include_lockfile(pkg: &Package) -> bool { - pkg.manifest().publish_lockfile() && pkg.targets().iter().any(|t| t.is_example() || t.is_bin()) +/// Construct `Cargo.lock` for the package to be published. +fn build_lock(ws: &Workspace<'_>) -> CargoResult { + let config = ws.config(); + let orig_resolve = ops::load_pkg_lockfile(ws)?; + + // Convert Package -> TomlManifest -> Manifest -> Package + let orig_pkg = ws.current()?; + let toml_manifest = Rc::new(orig_pkg.manifest().original().prepare_for_publish(config)?); + let package_root = orig_pkg.root(); + let source_id = orig_pkg.package_id().source_id(); + let (manifest, _nested_paths) = + TomlManifest::to_real_manifest(&toml_manifest, source_id, package_root, config)?; + let new_pkg = Package::new(manifest, orig_pkg.manifest_path()); + + // Regenerate Cargo.lock using the old one as a guide. + let specs = vec![PackageIdSpec::from_package_id(new_pkg.package_id())]; + let tmp_ws = Workspace::ephemeral(new_pkg, ws.config(), None, true)?; + let (pkg_set, new_resolve) = ops::resolve_ws_with_method(&tmp_ws, Method::Everything, &specs)?; + + if let Some(orig_resolve) = orig_resolve { + compare_resolve(config, tmp_ws.current()?, &orig_resolve, &new_resolve)?; + } + check_yanked(config, &pkg_set, &new_resolve)?; + + ops::resolve_to_string(&tmp_ws, &new_resolve) } // Checks that the package has some piece of metadata that a human can @@ -152,7 +191,7 @@ config.shell().warn(&format!( "manifest has no {things}.\n\ - See for more info.", + See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.", things = things ))? } @@ -175,7 +214,7 @@ } // Checks if the package source is in a *git* DVCS repository. If *git*, and -// the source is *dirty* (e.g., has uncommited changes) and not `allow_dirty` +// the source is *dirty* (e.g., has uncommitted changes) and not `allow_dirty` // then `bail!` with an informative message. Otherwise return the sha1 hash of // the current *HEAD* commit, or `None` if *dirty*. fn check_repo_state( @@ -294,21 +333,26 @@ let pkg = ws.current()?; let config = ws.config(); let root = pkg.root(); - for file in src_files.iter() { - let relative = file.strip_prefix(root)?; + + for src_file in src_files { + let relative = src_file.strip_prefix(root)?; check_filename(relative)?; - let relative = relative.to_str().ok_or_else(|| { + let relative_str = relative.to_str().ok_or_else(|| { failure::format_err!("non-utf8 path in source directory: {}", relative.display()) })?; + if relative_str == "Cargo.lock" { + // This is added manually below. + continue; + } config .shell() - .verbose(|shell| shell.status("Archiving", &relative))?; + .verbose(|shell| shell.status("Archiving", &relative_str))?; let path = format!( "{}-{}{}{}", pkg.name(), pkg.version(), path::MAIN_SEPARATOR, - relative + relative_str ); // The `tar::Builder` type by default will build GNU archives, but @@ -332,20 +376,21 @@ let mut header = Header::new_ustar(); header .set_path(&path) - .chain_err(|| format!("failed to add to archive: `{}`", relative))?; - let mut file = File::open(file) - .chain_err(|| format!("failed to open for archiving: `{}`", file.display()))?; + .chain_err(|| format!("failed to add to archive: `{}`", relative_str))?; + let mut file = File::open(src_file) + .chain_err(|| format!("failed to open for archiving: `{}`", src_file.display()))?; let metadata = file .metadata() - .chain_err(|| format!("could not learn metadata for: `{}`", relative))?; + .chain_err(|| format!("could not learn metadata for: `{}`", relative_str))?; header.set_metadata(&metadata); - if relative == "Cargo.toml" { + if relative_str == "Cargo.toml" { let orig = Path::new(&path).with_file_name("Cargo.toml.orig"); header.set_path(&orig)?; header.set_cksum(); - ar.append(&header, &mut file) - .chain_err(|| internal(format!("could not archive source file `{}`", relative)))?; + ar.append(&header, &mut file).chain_err(|| { + internal(format!("could not archive source file `{}`", relative_str)) + })?; let mut header = Header::new_ustar(); let toml = pkg.to_registry_toml(ws.config())?; @@ -354,16 +399,18 @@ header.set_mode(0o644); header.set_size(toml.len() as u64); header.set_cksum(); - ar.append(&header, toml.as_bytes()) - .chain_err(|| internal(format!("could not archive source file `{}`", relative)))?; + ar.append(&header, toml.as_bytes()).chain_err(|| { + internal(format!("could not archive source file `{}`", relative_str)) + })?; } else { header.set_cksum(); - ar.append(&header, &mut file) - .chain_err(|| internal(format!("could not archive source file `{}`", relative)))?; + ar.append(&header, &mut file).chain_err(|| { + internal(format!("could not archive source file `{}`", relative_str)) + })?; } } - if let Some(ref json) = vcs_info { + if let Some(json) = vcs_info { let filename: PathBuf = Path::new(VCS_INFO_FILE).into(); debug_assert!(check_filename(&filename).is_ok()); let fnd = filename.display(); @@ -392,8 +439,12 @@ .chain_err(|| internal(format!("could not archive source file `{}`", fnd)))?; } - if include_lockfile(pkg) { - let toml = paths::read(&ws.root().join("Cargo.lock"))?; + if pkg.include_lockfile() { + let new_lock = build_lock(&ws)?; + + config + .shell() + .verbose(|shell| shell.status("Archiving", "Cargo.lock"))?; let path = format!( "{}-{}{}Cargo.lock", pkg.name(), @@ -404,9 +455,9 @@ header.set_path(&path)?; header.set_entry_type(EntryType::file()); header.set_mode(0o644); - header.set_size(toml.len() as u64); + header.set_size(new_lock.len() as u64); header.set_cksum(); - ar.append(&header, toml.as_bytes()) + ar.append(&header, new_lock.as_bytes()) .chain_err(|| internal("could not archive source file `Cargo.lock`"))?; } @@ -415,6 +466,114 @@ Ok(()) } +/// Generate warnings when packaging Cargo.lock, and the resolve have changed. +fn compare_resolve( + config: &Config, + current_pkg: &Package, + orig_resolve: &Resolve, + new_resolve: &Resolve, +) -> CargoResult<()> { + if config.shell().verbosity() != Verbosity::Verbose { + return Ok(()); + } + let new_set: BTreeSet = new_resolve.iter().collect(); + let orig_set: BTreeSet = orig_resolve.iter().collect(); + let added = new_set.difference(&orig_set); + // Removed entries are ignored, this is used to quickly find hints for why + // an entry changed. + let removed: Vec<&PackageId> = orig_set.difference(&new_set).collect(); + for pkg_id in added { + if pkg_id.name() == current_pkg.name() && pkg_id.version() == current_pkg.version() { + // Skip the package that is being created, since its SourceId + // (directory) changes. + continue; + } + // Check for candidates where the source has changed (such as [patch] + // or a dependency with multiple sources like path/version). + let removed_candidates: Vec<&PackageId> = removed + .iter() + .filter(|orig_pkg_id| { + orig_pkg_id.name() == pkg_id.name() && orig_pkg_id.version() == pkg_id.version() + }) + .cloned() + .collect(); + let extra = match removed_candidates.len() { + 0 => { + // This can happen if the original was out of date. + let previous_versions: Vec<&PackageId> = removed + .iter() + .filter(|orig_pkg_id| orig_pkg_id.name() == pkg_id.name()) + .cloned() + .collect(); + match previous_versions.len() { + 0 => String::new(), + 1 => format!( + ", previous version was `{}`", + previous_versions[0].version() + ), + _ => format!( + ", previous versions were: {}", + previous_versions + .iter() + .map(|pkg_id| format!("`{}`", pkg_id.version())) + .collect::>() + .join(", ") + ), + } + } + 1 => { + // This can happen for multi-sourced dependencies like + // `{path="...", version="..."}` or `[patch]` replacement. + // `[replace]` is not captured in Cargo.lock. + format!( + ", was originally sourced from `{}`", + removed_candidates[0].source_id() + ) + } + _ => { + // I don't know if there is a way to actually trigger this, + // but handle it just in case. + let comma_list = removed_candidates + .iter() + .map(|pkg_id| format!("`{}`", pkg_id.source_id())) + .collect::>() + .join(", "); + format!( + ", was originally sourced from one of these sources: {}", + comma_list + ) + } + }; + let msg = format!( + "package `{}` added to the packaged Cargo.lock file{}", + pkg_id, extra + ); + config.shell().status_with_color("Note", msg, Color::Cyan)?; + } + Ok(()) +} + +fn check_yanked(config: &Config, pkg_set: &PackageSet<'_>, resolve: &Resolve) -> CargoResult<()> { + // Checking the yanked status invovles taking a look at the registry and + // maybe updating files, so be sure to lock it here. + let _lock = config.acquire_package_cache_lock()?; + + let mut sources = pkg_set.sources_mut(); + for pkg_id in resolve.iter() { + if let Some(source) = sources.get_mut(pkg_id.source_id()) { + if source.is_yanked(pkg_id)? { + config.shell().warn(format!( + "package `{}` in Cargo.lock is yanked in registry `{}`, \ + consider updating to a version that is not yanked", + pkg_id, + pkg_id.source_id().display_registry_name() + ))?; + } + } + } + Ok(()) +} + fn run_verify(ws: &Workspace<'_>, tar: &FileLock, opts: &PackageOpts<'_>) -> CargoResult<()> { let config = ws.config(); let pkg = ws.current()?; @@ -439,13 +598,25 @@ let id = SourceId::for_path(&dst)?; let mut src = PathSource::new(&dst, id, ws.config()); let new_pkg = src.root_package()?; - let pkg_fingerprint = src.last_modified_file(&new_pkg)?; + let pkg_fingerprint = hash_all(&dst)?; let ws = Workspace::ephemeral(new_pkg, config, None, true)?; + let rustc_args = if pkg + .manifest() + .features() + .require(Feature::public_dependency()) + .is_ok() + { + // FIXME: Turn this on at some point in the future + //Some(vec!["-D exported_private_dependencies".to_string()]) + None + } else { + None + }; + let exec: Arc = Arc::new(DefaultExecutor); ops::compile_ws( &ws, - None, &ops::CompileOptions { config, build_config: BuildConfig::new(config, opts.jobs, &opts.target, CompileMode::Build)?, @@ -457,7 +628,7 @@ required_features_filterable: true, }, target_rustdoc_args: None, - target_rustc_args: None, + target_rustc_args: rustc_args, local_rustdoc_args: None, export_dir: None, }, @@ -465,21 +636,78 @@ )?; // Check that `build.rs` didn't modify any files in the `src` directory. - let ws_fingerprint = src.last_modified_file(ws.current()?)?; + let ws_fingerprint = hash_all(&dst)?; if pkg_fingerprint != ws_fingerprint { - let (_, path) = ws_fingerprint; + let changes = report_hash_difference(&pkg_fingerprint, &ws_fingerprint); failure::bail!( "Source directory was modified by build.rs during cargo publish. \ - Build scripts should not modify anything outside of OUT_DIR. \ - Modified file: {}\n\n\ + Build scripts should not modify anything outside of OUT_DIR.\n\ + {}\n\n\ To proceed despite this, pass the `--no-verify` flag.", - path.display() + changes ) } Ok(()) } +fn hash_all(path: &Path) -> CargoResult> { + fn wrap(path: &Path) -> CargoResult> { + let mut result = HashMap::new(); + let walker = walkdir::WalkDir::new(path).into_iter(); + for entry in walker.filter_entry(|e| !(e.depth() == 1 && e.file_name() == "target")) { + let entry = entry?; + let file_type = entry.file_type(); + if file_type.is_file() { + let contents = fs::read(entry.path())?; + let hash = util::hex::hash_u64(&contents); + result.insert(entry.path().to_path_buf(), hash); + } else if file_type.is_symlink() { + let hash = util::hex::hash_u64(&fs::read_link(entry.path())?); + result.insert(entry.path().to_path_buf(), hash); + } + } + Ok(result) + } + let result = wrap(path).chain_err(|| format!("failed to verify output at {:?}", path))?; + Ok(result) +} + +fn report_hash_difference(orig: &HashMap, after: &HashMap) -> String { + let mut changed = Vec::new(); + let mut removed = Vec::new(); + for (key, value) in orig { + match after.get(key) { + Some(after_value) => { + if value != after_value { + changed.push(key.to_string_lossy()); + } + } + None => removed.push(key.to_string_lossy()), + } + } + let mut added: Vec<_> = after + .keys() + .filter(|key| !orig.contains_key(*key)) + .map(|key| key.to_string_lossy()) + .collect(); + let mut result = Vec::new(); + if !changed.is_empty() { + changed.sort_unstable(); + result.push(format!("Changed: {}", changed.join("\n\t"))); + } + if !added.is_empty() { + added.sort_unstable(); + result.push(format!("Added: {}", added.join("\n\t"))); + } + if !removed.is_empty() { + removed.sort_unstable(); + result.push(format!("Removed: {}", removed.join("\n\t"))); + } + assert!(!result.is_empty(), "unexpected empty change detection"); + result.join("\n") +} + // It can often be the case that files of a particular name on one platform // can't actually be created on another platform. For example files with colons // in the name are allowed on Unix but not on Windows. diff -Nru cargo-0.35.0/src/cargo/ops/cargo_run.rs cargo-0.37.0/src/cargo/ops/cargo_run.rs --- cargo-0.35.0/src/cargo/ops/cargo_run.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/ops/cargo_run.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,3 +1,4 @@ +use std::ffi::OsString; use std::iter; use std::path::Path; @@ -8,7 +9,7 @@ pub fn run( ws: &Workspace<'_>, options: &ops::CompileOptions<'_>, - args: &[String], + args: &[OsString], ) -> CargoResult> { let config = ws.config(); diff -Nru cargo-0.35.0/src/cargo/ops/cargo_test.rs cargo-0.37.0/src/cargo/ops/cargo_test.rs --- cargo-0.35.0/src/cargo/ops/cargo_test.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/ops/cargo_test.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,6 +1,7 @@ use std::ffi::OsString; use crate::core::compiler::{Compilation, Doctest}; +use crate::core::shell::Verbosity; use crate::core::Workspace; use crate::ops; use crate::util::errors::CargoResult; @@ -15,7 +16,7 @@ pub fn run_tests( ws: &Workspace<'_>, options: &TestOptions<'_>, - test_args: &[String], + test_args: &[&str], ) -> CargoResult> { let compilation = compile_tests(ws, options)?; @@ -42,16 +43,19 @@ pub fn run_benches( ws: &Workspace<'_>, options: &TestOptions<'_>, - args: &[String], + args: &[&str], ) -> CargoResult> { - let mut args = args.to_vec(); - args.push("--bench".to_string()); let compilation = compile_tests(ws, options)?; if options.no_run { return Ok(None); } + + let mut args = args.to_vec(); + args.push("--bench"); + let (test, errors) = run_unit_tests(options, &args, &compilation)?; + match errors.len() { 0 => Ok(None), _ => Ok(Some(CargoTestError::new(test, errors))), @@ -72,7 +76,7 @@ /// Runs the unit and integration tests of a package. fn run_unit_tests( options: &TestOptions<'_>, - test_args: &[String], + test_args: &[&str], compilation: &Compilation<'_>, ) -> CargoResult<(Test, Vec)> { let config = options.compile_opts.config; @@ -80,10 +84,15 @@ let mut errors = Vec::new(); - for &(ref pkg, ref kind, ref test, ref exe) in &compilation.tests { + for &(ref pkg, ref target, ref exe) in &compilation.tests { + let kind = target.kind(); + let test = target.name().to_string(); let exe_display = exe.strip_prefix(cwd).unwrap_or(exe).display(); let mut cmd = compilation.target_process(exe, pkg)?; cmd.args(test_args); + if target.harness() && config.shell().verbosity() == Verbosity::Quiet { + cmd.arg("--quiet"); + } config .shell() .concise(|shell| shell.status("Running", &exe_display))?; @@ -125,7 +134,7 @@ fn run_doc_tests( options: &TestOptions<'_>, - test_args: &[String], + test_args: &[&str], compilation: &Compilation<'_>, ) -> CargoResult<(Test, Vec)> { let mut errors = Vec::new(); diff -Nru cargo-0.35.0/src/cargo/ops/cargo_uninstall.rs cargo-0.37.0/src/cargo/ops/cargo_uninstall.rs --- cargo-0.35.0/src/cargo/ops/cargo_uninstall.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/ops/cargo_uninstall.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,5 +1,6 @@ -use std::collections::btree_map::Entry; -use std::{env, fs}; +use failure::bail; +use std::collections::BTreeSet; +use std::env; use crate::core::PackageId; use crate::core::{PackageIdSpec, SourceId}; @@ -7,7 +8,7 @@ use crate::util::errors::CargoResult; use crate::util::paths; use crate::util::Config; -use crate::util::{FileLock, Filesystem}; +use crate::util::Filesystem; pub fn uninstall( root: Option<&str>, @@ -16,7 +17,7 @@ config: &Config, ) -> CargoResult<()> { if specs.len() > 1 && !bins.is_empty() { - failure::bail!("A binary can only be associated with a single installed package, specifying multiple specs with --bin is redundant."); + bail!("A binary can only be associated with a single installed package, specifying multiple specs with --bin is redundant."); } let root = resolve_root(root, config)?; @@ -62,7 +63,7 @@ }; if scheduled_error { - failure::bail!("some packages failed to uninstall"); + bail!("some packages failed to uninstall"); } Ok(()) @@ -74,80 +75,74 @@ bins: &[String], config: &Config, ) -> CargoResult<()> { - let crate_metadata = metadata(config, root)?; - let metadata = read_crate_list(&crate_metadata)?; - let pkgid = PackageIdSpec::query_str(spec, metadata.v1().keys().cloned())?; - uninstall_pkgid(&crate_metadata, metadata, pkgid, bins, config) + let tracker = InstallTracker::load(config, root)?; + let all_pkgs = tracker.all_installed_bins().map(|(pkg_id, _set)| *pkg_id); + let pkgid = PackageIdSpec::query_str(spec, all_pkgs)?; + uninstall_pkgid(root, tracker, pkgid, bins, config) } fn uninstall_cwd(root: &Filesystem, bins: &[String], config: &Config) -> CargoResult<()> { - let crate_metadata = metadata(config, root)?; - let metadata = read_crate_list(&crate_metadata)?; + let tracker = InstallTracker::load(config, root)?; let source_id = SourceId::for_path(config.cwd())?; let src = path_source(source_id, config)?; - let (pkg, _source) = select_pkg(src, None, None, config, true, &mut |path| { + let pkg = select_pkg(src, None, None, config, true, &mut |path| { path.read_packages() })?; let pkgid = pkg.package_id(); - uninstall_pkgid(&crate_metadata, metadata, pkgid, bins, config) + uninstall_pkgid(root, tracker, pkgid, bins, config) } fn uninstall_pkgid( - crate_metadata: &FileLock, - mut metadata: CrateListingV1, + root: &Filesystem, + mut tracker: InstallTracker, pkgid: PackageId, bins: &[String], config: &Config, ) -> CargoResult<()> { let mut to_remove = Vec::new(); - { - let mut installed = match metadata.v1_mut().entry(pkgid) { - Entry::Occupied(e) => e, - Entry::Vacant(..) => failure::bail!("package `{}` is not installed", pkgid), - }; - - let dst = crate_metadata.parent().join("bin"); - for bin in installed.get() { - let bin = dst.join(bin); - if fs::metadata(&bin).is_err() { - failure::bail!( - "corrupt metadata, `{}` does not exist when it should", - bin.display() - ) - } - } - - let bins = bins - .iter() - .map(|s| { - if s.ends_with(env::consts::EXE_SUFFIX) { - s.to_string() - } else { - format!("{}{}", s, env::consts::EXE_SUFFIX) - } - }) - .collect::>(); + let installed = match tracker.installed_bins(pkgid) { + Some(bins) => bins.clone(), + None => bail!("package `{}` is not installed", pkgid), + }; - for bin in bins.iter() { - if !installed.get().contains(bin) { - failure::bail!("binary `{}` not installed as part of `{}`", bin, pkgid) - } + let dst = root.join("bin").into_path_unlocked(); + for bin in &installed { + let bin = dst.join(bin); + if !bin.exists() { + bail!( + "corrupt metadata, `{}` does not exist when it should", + bin.display() + ) } + } - if bins.is_empty() { - to_remove.extend(installed.get().iter().map(|b| dst.join(b))); - installed.get_mut().clear(); - } else { - for bin in bins.iter() { - to_remove.push(dst.join(bin)); - installed.get_mut().remove(bin); + let bins = bins + .iter() + .map(|s| { + if s.ends_with(env::consts::EXE_SUFFIX) { + s.to_string() + } else { + format!("{}{}", s, env::consts::EXE_SUFFIX) } + }) + .collect::>(); + + for bin in bins.iter() { + if !installed.contains(bin) { + bail!("binary `{}` not installed as part of `{}`", bin, pkgid) } - if installed.get().is_empty() { - installed.remove(); + } + + if bins.is_empty() { + to_remove.extend(installed.iter().map(|b| dst.join(b))); + tracker.remove(pkgid, &installed); + } else { + for bin in bins.iter() { + to_remove.push(dst.join(bin)); } + tracker.remove(pkgid, &bins); } - write_crate_list(&crate_metadata, metadata)?; + tracker.save()?; for bin in to_remove { config.shell().status("Removing", bin.display())?; paths::remove_file(bin)?; diff -Nru cargo-0.35.0/src/cargo/ops/common_for_install_and_uninstall.rs cargo-0.37.0/src/cargo/ops/common_for_install_and_uninstall.rs --- cargo-0.35.0/src/cargo/ops/common_for_install_and_uninstall.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/ops/common_for_install_and_uninstall.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,45 +1,538 @@ -use std::collections::{BTreeMap, BTreeSet}; +use std::collections::{btree_map, BTreeMap, BTreeSet}; use std::env; use std::io::prelude::*; use std::io::SeekFrom; use std::path::{Path, PathBuf}; +use failure::{bail, format_err}; use semver::VersionReq; use serde::{Deserialize, Serialize}; -use crate::core::PackageId; -use crate::core::{Dependency, Package, Source, SourceId}; +use crate::core::compiler::Freshness; +use crate::core::{Dependency, Package, PackageId, Source, SourceId}; +use crate::ops::{self, CompileFilter, CompileOptions}; use crate::sources::PathSource; use crate::util::errors::{CargoResult, CargoResultExt}; -use crate::util::{internal, Config, ToSemver}; +use crate::util::{Config, ToSemver}; use crate::util::{FileLock, Filesystem}; -#[derive(Deserialize, Serialize)] -#[serde(untagged)] -pub enum CrateListing { - V1(CrateListingV1), - Empty(Empty), +/// On-disk tracking for which package installed which binary. +/// +/// v1 is an older style, v2 is a new (experimental) style that tracks more +/// information. The new style is only enabled with the `-Z install-upgrade` +/// flag (which sets the `unstable_upgrade` flag). v1 is still considered the +/// source of truth. When v2 is used, it will sync with any changes with v1, +/// and will continue to update v1. +/// +/// This maintains a filesystem lock, preventing other instances of Cargo from +/// modifying at the same time. Drop the value to unlock. +/// +/// If/when v2 is stabilized, it is intended that v1 is retained for a while +/// during a longish transition period, and then v1 can be removed. +pub struct InstallTracker { + v1: CrateListingV1, + v2: CrateListingV2, + v1_lock: FileLock, + v2_lock: Option, + unstable_upgrade: bool, } -#[derive(Deserialize, Serialize)] -#[serde(deny_unknown_fields)] -pub struct Empty {} +/// Tracking information for the set of installed packages. +/// +/// This v2 format is unstable and requires the `-Z unstable-upgrade` option +/// to enable. +#[derive(Default, Deserialize, Serialize)] +struct CrateListingV2 { + installs: BTreeMap, + /// Forwards compatibility. + #[serde(flatten)] + other: BTreeMap, +} + +/// Tracking information for the installation of a single package. +/// +/// This tracks the settings that were used when the package was installed. +/// Future attempts to install the same package will check these settings to +/// determine if it needs to be rebuilt/reinstalled. If nothing has changed, +/// then Cargo will inform the user that it is "up to date". +/// +/// This is only used for the (unstable) v2 format. +#[derive(Debug, Deserialize, Serialize)] +struct InstallInfo { + /// Version requested via `--version`. + /// None if `--version` not specified. Currently not used, possibly may be + /// used in the future. + version_req: Option, + /// Set of binary names installed. + bins: BTreeSet, + /// Set of features explicitly enabled. + features: BTreeSet, + all_features: bool, + no_default_features: bool, + /// Either "debug" or "release". + profile: String, + /// The installation target. + /// Either the host or the value specified in `--target`. + /// None if unknown (when loading from v1). + target: Option, + /// Output of `rustc -V`. + /// None if unknown (when loading from v1). + /// Currently not used, possibly may be used in the future. + rustc: Option, + /// Forwards compatibility. + #[serde(flatten)] + other: BTreeMap, +} -#[derive(Deserialize, Serialize)] +/// Tracking information for the set of installed packages. +#[derive(Default, Deserialize, Serialize)] pub struct CrateListingV1 { v1: BTreeMap>, } +impl InstallTracker { + /// Create an InstallTracker from information on disk. + pub fn load(config: &Config, root: &Filesystem) -> CargoResult { + let unstable_upgrade = config.cli_unstable().install_upgrade; + let v1_lock = root.open_rw(Path::new(".crates.toml"), config, "crate metadata")?; + let v2_lock = if unstable_upgrade { + Some(root.open_rw(Path::new(".crates2.json"), config, "crate metadata")?) + } else { + None + }; + + let v1 = (|| -> CargoResult<_> { + let mut contents = String::new(); + v1_lock.file().read_to_string(&mut contents)?; + if contents.is_empty() { + Ok(CrateListingV1::default()) + } else { + Ok(toml::from_str(&contents) + .chain_err(|| format_err!("invalid TOML found for metadata"))?) + } + })() + .chain_err(|| { + format_err!( + "failed to parse crate metadata at `{}`", + v1_lock.path().to_string_lossy() + ) + })?; + + let v2 = (|| -> CargoResult<_> { + match &v2_lock { + Some(lock) => { + let mut contents = String::new(); + lock.file().read_to_string(&mut contents)?; + let mut v2 = if contents.is_empty() { + CrateListingV2::default() + } else { + serde_json::from_str(&contents) + .chain_err(|| format_err!("invalid JSON found for metadata"))? + }; + v2.sync_v1(&v1)?; + Ok(v2) + } + None => Ok(CrateListingV2::default()), + } + })() + .chain_err(|| { + format_err!( + "failed to parse crate metadata at `{}`", + v2_lock.as_ref().unwrap().path().to_string_lossy() + ) + })?; + + Ok(InstallTracker { + v1, + v2, + v1_lock, + v2_lock, + unstable_upgrade, + }) + } + + /// Checks if the given package should be built, and checks if executables + /// already exist in the destination directory. + /// + /// Returns a tuple `(freshness, map)`. `freshness` indicates if the + /// package should be built (`Dirty`) or if it is already up-to-date + /// (`Fresh`) and should be skipped. The map maps binary names to the + /// PackageId that installed it (which is None if not known). + /// + /// If there are no duplicates, then it will be considered `Dirty` (i.e., + /// it is OK to build/install). + /// + /// `force=true` will always be considered `Dirty` (i.e., it will always + /// be rebuilt/reinstalled). + /// + /// Returns an error if there is a duplicate and `--force` is not used. + pub fn check_upgrade( + &self, + dst: &Path, + pkg: &Package, + force: bool, + opts: &CompileOptions<'_>, + target: &str, + _rustc: &str, + ) -> CargoResult<(Freshness, BTreeMap>)> { + let exes = exe_names(pkg, &opts.filter); + // Check if any tracked exe's are already installed. + let duplicates = self.find_duplicates(dst, &exes); + if force || duplicates.is_empty() { + return Ok((Freshness::Dirty, duplicates)); + } + // Check if all duplicates come from packages of the same name. If + // there are duplicates from other packages, then --force will be + // required. + // + // There may be multiple matching duplicates if different versions of + // the same package installed different binaries. + // + // This does not check the source_id in order to allow the user to + // switch between different sources. For example, installing from git, + // and then switching to the official crates.io release or vice-versa. + // If the source_id were included, then the user would get possibly + // confusing errors like "package `foo 1.0.0` is already installed" + // and the change of source may not be obvious why it fails. + let matching_duplicates: Vec = duplicates + .values() + .filter_map(|v| match v { + Some(dupe_pkg_id) if dupe_pkg_id.name() == pkg.name() => Some(*dupe_pkg_id), + _ => None, + }) + .collect(); + + // If both sets are the same length, that means all duplicates come + // from packages with the same name. + if self.unstable_upgrade && matching_duplicates.len() == duplicates.len() { + // Determine if it is dirty or fresh. + let source_id = pkg.package_id().source_id(); + if source_id.is_path() { + // `cargo install --path ...` is always rebuilt. + return Ok((Freshness::Dirty, duplicates)); + } + if matching_duplicates.iter().all(|dupe_pkg_id| { + let info = self + .v2 + .installs + .get(dupe_pkg_id) + .expect("dupes must be in sync"); + let precise_equal = if source_id.is_git() { + // Git sources must have the exact same hash to be + // considered "fresh". + dupe_pkg_id.source_id().precise() == source_id.precise() + } else { + true + }; + + dupe_pkg_id.version() == pkg.version() + && dupe_pkg_id.source_id() == source_id + && precise_equal + && info.is_up_to_date(opts, target, &exes) + }) { + Ok((Freshness::Fresh, duplicates)) + } else { + Ok((Freshness::Dirty, duplicates)) + } + } else { + // Format the error message. + let mut msg = String::new(); + for (bin, p) in duplicates.iter() { + msg.push_str(&format!("binary `{}` already exists in destination", bin)); + if let Some(p) = p.as_ref() { + msg.push_str(&format!(" as part of `{}`\n", p)); + } else { + msg.push_str("\n"); + } + } + msg.push_str("Add --force to overwrite"); + bail!("{}", msg); + } + } + + /// Check if any executables are already installed. + /// + /// Returns a map of duplicates, the key is the executable name and the + /// value is the PackageId that is already installed. The PackageId is + /// None if it is an untracked executable. + fn find_duplicates( + &self, + dst: &Path, + exes: &BTreeSet, + ) -> BTreeMap> { + exes.iter() + .filter_map(|name| { + if !dst.join(&name).exists() { + None + } else if self.unstable_upgrade { + let p = self.v2.package_for_bin(name); + Some((name.clone(), p)) + } else { + let p = self.v1.package_for_bin(name); + Some((name.clone(), p)) + } + }) + .collect() + } + + /// Mark that a package was installed. + pub fn mark_installed( + &mut self, + package: &Package, + bins: &BTreeSet, + version_req: Option, + opts: &CompileOptions<'_>, + target: String, + rustc: String, + ) { + if self.unstable_upgrade { + self.v2 + .mark_installed(package, bins, version_req, opts, target, rustc) + } + self.v1.mark_installed(package, bins); + } + + /// Save tracking information to disk. + pub fn save(&self) -> CargoResult<()> { + self.v1.save(&self.v1_lock).chain_err(|| { + format_err!( + "failed to write crate metadata at `{}`", + self.v1_lock.path().to_string_lossy() + ) + })?; + + if self.unstable_upgrade { + self.v2.save(self.v2_lock.as_ref().unwrap()).chain_err(|| { + format_err!( + "failed to write crate metadata at `{}`", + self.v2_lock.as_ref().unwrap().path().to_string_lossy() + ) + })?; + } + Ok(()) + } + + /// Iterator of all installed binaries. + /// Items are `(pkg_id, bins)` where `bins` is the set of binaries that + /// package installed. + pub fn all_installed_bins(&self) -> impl Iterator)> { + self.v1.v1.iter() + } + + /// Set of binaries installed by a particular package. + /// Returns None if the package is not installed. + pub fn installed_bins(&self, pkg_id: PackageId) -> Option<&BTreeSet> { + self.v1.v1.get(&pkg_id) + } + + /// Remove a package from the tracker. + pub fn remove(&mut self, pkg_id: PackageId, bins: &BTreeSet) { + self.v1.remove(pkg_id, bins); + if self.unstable_upgrade { + self.v2.remove(pkg_id, bins); + } + } +} + impl CrateListingV1 { - pub fn v1(&self) -> &BTreeMap> { - &self.v1 + fn package_for_bin(&self, bin_name: &str) -> Option { + self.v1 + .iter() + .find(|(_, bins)| bins.contains(bin_name)) + .map(|(pkg_id, _)| *pkg_id) + } + + fn mark_installed(&mut self, pkg: &Package, bins: &BTreeSet) { + // Remove bins from any other packages. + for other_bins in self.v1.values_mut() { + for bin in bins { + other_bins.remove(bin); + } + } + // Remove entries where `bins` is empty. + let to_remove = self + .v1 + .iter() + .filter_map(|(&p, set)| if set.is_empty() { Some(p) } else { None }) + .collect::>(); + for p in to_remove.iter() { + self.v1.remove(p); + } + // Add these bins. + self.v1 + .entry(pkg.package_id()) + .or_insert_with(BTreeSet::new) + .append(&mut bins.clone()); + } + + fn remove(&mut self, pkg_id: PackageId, bins: &BTreeSet) { + let mut installed = match self.v1.entry(pkg_id) { + btree_map::Entry::Occupied(e) => e, + btree_map::Entry::Vacant(..) => panic!("v1 unexpected missing `{}`", pkg_id), + }; + + for bin in bins { + installed.get_mut().remove(bin); + } + if installed.get().is_empty() { + installed.remove(); + } + } + + fn save(&self, lock: &FileLock) -> CargoResult<()> { + let mut file = lock.file(); + file.seek(SeekFrom::Start(0))?; + file.set_len(0)?; + let data = toml::to_string(self)?; + file.write_all(data.as_bytes())?; + Ok(()) + } +} + +impl CrateListingV2 { + /// Incorporate any changes from v1 into self. + /// This handles the initial upgrade to v2, *and* handles the case + /// where v2 is in use, and a v1 update is made, then v2 is used again. + /// i.e., `cargo +new install foo ; cargo +old install bar ; cargo +new install bar` + /// For now, v1 is the source of truth, so its values are trusted over v2. + fn sync_v1(&mut self, v1: &CrateListingV1) -> CargoResult<()> { + // Make the `bins` entries the same. + for (pkg_id, bins) in &v1.v1 { + self.installs + .entry(*pkg_id) + .and_modify(|info| info.bins = bins.clone()) + .or_insert_with(|| InstallInfo::from_v1(bins)); + } + // Remove any packages that aren't present in v1. + let to_remove: Vec<_> = self + .installs + .keys() + .filter(|pkg_id| !v1.v1.contains_key(pkg_id)) + .cloned() + .collect(); + for pkg_id in to_remove { + self.installs.remove(&pkg_id); + } + Ok(()) } - pub fn v1_mut(&mut self) -> &mut BTreeMap> { - &mut self.v1 + fn package_for_bin(&self, bin_name: &str) -> Option { + self.installs + .iter() + .find(|(_, info)| info.bins.contains(bin_name)) + .map(|(pkg_id, _)| *pkg_id) + } + + fn mark_installed( + &mut self, + pkg: &Package, + bins: &BTreeSet, + version_req: Option, + opts: &CompileOptions<'_>, + target: String, + rustc: String, + ) { + // Remove bins from any other packages. + for info in &mut self.installs.values_mut() { + for bin in bins { + info.bins.remove(bin); + } + } + // Remove entries where `bins` is empty. + let to_remove = self + .installs + .iter() + .filter_map(|(&p, info)| if info.bins.is_empty() { Some(p) } else { None }) + .collect::>(); + for p in to_remove.iter() { + self.installs.remove(p); + } + // Add these bins. + if let Some(info) = self.installs.get_mut(&pkg.package_id()) { + info.bins.append(&mut bins.clone()); + info.version_req = version_req; + info.features = feature_set(&opts.features); + info.all_features = opts.all_features; + info.no_default_features = opts.no_default_features; + info.profile = profile_name(opts.build_config.release).to_string(); + info.target = Some(target); + info.rustc = Some(rustc); + } else { + self.installs.insert( + pkg.package_id(), + InstallInfo { + version_req, + bins: bins.clone(), + features: feature_set(&opts.features), + all_features: opts.all_features, + no_default_features: opts.no_default_features, + profile: profile_name(opts.build_config.release).to_string(), + target: Some(target), + rustc: Some(rustc), + other: BTreeMap::new(), + }, + ); + } + } + + fn remove(&mut self, pkg_id: PackageId, bins: &BTreeSet) { + let mut info_entry = match self.installs.entry(pkg_id) { + btree_map::Entry::Occupied(e) => e, + btree_map::Entry::Vacant(..) => panic!("v2 unexpected missing `{}`", pkg_id), + }; + + for bin in bins { + info_entry.get_mut().bins.remove(bin); + } + if info_entry.get().bins.is_empty() { + info_entry.remove(); + } + } + + fn save(&self, lock: &FileLock) -> CargoResult<()> { + let mut file = lock.file(); + file.seek(SeekFrom::Start(0))?; + file.set_len(0)?; + let data = serde_json::to_string(self)?; + file.write_all(data.as_bytes())?; + Ok(()) + } +} + +impl InstallInfo { + fn from_v1(set: &BTreeSet) -> InstallInfo { + InstallInfo { + version_req: None, + bins: set.clone(), + features: BTreeSet::new(), + all_features: false, + no_default_features: false, + profile: "release".to_string(), + target: None, + rustc: None, + other: BTreeMap::new(), + } + } + + /// Determine if this installation is "up to date", or if it needs to be reinstalled. + /// + /// This does not do Package/Source/Version checking. + fn is_up_to_date( + &self, + opts: &CompileOptions<'_>, + target: &str, + exes: &BTreeSet, + ) -> bool { + self.features == feature_set(&opts.features) + && self.all_features == opts.all_features + && self.no_default_features == opts.no_default_features + && self.profile == profile_name(opts.build_config.release) + && (self.target.is_none() || self.target.as_ref().map(|t| t.as_ref()) == Some(target)) + && &self.bins == exes } } +/// Determines the root directory where installation is done. pub fn resolve_root(flag: Option<&str>, config: &Config) -> CargoResult { let config_root = config.get_path("install.root")?; Ok(flag @@ -50,14 +543,16 @@ .unwrap_or_else(|| config.home().clone())) } +/// Determines the `PathSource` from a `SourceId`. pub fn path_source<'a>(source_id: SourceId, config: &'a Config) -> CargoResult> { let path = source_id .url() .to_file_path() - .map_err(|()| failure::format_err!("path sources must have a valid path"))?; + .map_err(|()| format_err!("path sources must have a valid path"))?; Ok(PathSource::new(&path, source_id, config)) } +/// Gets a Package based on command-line requirements. pub fn select_pkg<'a, T>( mut source: T, name: Option<&str>, @@ -65,132 +560,150 @@ config: &Config, needs_update: bool, list_all: &mut dyn FnMut(&mut T) -> CargoResult>, -) -> CargoResult<(Package, Box)> +) -> CargoResult where T: Source + 'a, { + // This operation may involve updating some sources or making a few queries + // which may involve frobbing caches, as a result make sure we synchronize + // with other global Cargos + let _lock = config.acquire_package_cache_lock()?; + if needs_update { source.update()?; } - match name { - Some(name) => { - let vers = match vers { - Some(v) => { - // If the version begins with character <, >, =, ^, ~ parse it as a - // version range, otherwise parse it as a specific version - let first = v.chars().nth(0).ok_or_else(|| { - failure::format_err!("no version provided for the `--vers` flag") - })?; - - match first { - '<' | '>' | '=' | '^' | '~' => match v.parse::() { - Ok(v) => Some(v.to_string()), - Err(_) => failure::bail!( + if let Some(name) = name { + let vers = if let Some(v) = vers { + // If the version begins with character <, >, =, ^, ~ parse it as a + // version range, otherwise parse it as a specific version + let first = v + .chars() + .nth(0) + .ok_or_else(|| format_err!("no version provided for the `--vers` flag"))?; + + let is_req = "<>=^~".contains(first) || v.contains('*'); + if is_req { + match v.parse::() { + Ok(v) => Some(v.to_string()), + Err(_) => bail!( + "the `--vers` provided, `{}`, is \ + not a valid semver version requirement\n\n\ + Please have a look at \ + https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html \ + for the correct format", + v + ), + } + } else { + match v.to_semver() { + Ok(v) => Some(format!("={}", v)), + Err(e) => { + let mut msg = if config.cli_unstable().install_upgrade { + format!( + "the `--vers` provided, `{}`, is \ + not a valid semver version: {}\n", + v, e + ) + } else { + format!( "the `--vers` provided, `{}`, is \ - not a valid semver version requirement\n\n - Please have a look at \ - http://doc.crates.io/specifying-dependencies.html \ - for the correct format", + not a valid semver version\n\n\ + historically Cargo treated this \ + as a semver version requirement \ + accidentally\nand will continue \ + to do so, but this behavior \ + will be removed eventually", + v + ) + }; + + // If it is not a valid version but it is a valid version + // requirement, add a note to the warning + if v.parse::().is_ok() { + msg.push_str(&format!( + "\nif you want to specify semver range, \ + add an explicit qualifier, like ^{}", v - ), - }, - _ => match v.to_semver() { - Ok(v) => Some(format!("={}", v)), - Err(_) => { - let mut msg = format!( - "\ - the `--vers` provided, `{}`, is \ - not a valid semver version\n\n\ - historically Cargo treated this \ - as a semver version requirement \ - accidentally\nand will continue \ - to do so, but this behavior \ - will be removed eventually", - v - ); - - // If it is not a valid version but it is a valid version - // requirement, add a note to the warning - if v.parse::().is_ok() { - msg.push_str(&format!( - "\nif you want to specify semver range, \ - add an explicit qualifier, like ^{}", - v - )); - } - config.shell().warn(&msg)?; - Some(v.to_string()) - } - }, + )); + } + if config.cli_unstable().install_upgrade { + bail!(msg); + } else { + config.shell().warn(&msg)?; + } + Some(v.to_string()) } } - None => None, - }; - let vers = vers.as_ref().map(|s| &**s); - let vers_spec = if vers.is_none() && source.source_id().is_registry() { - // Avoid pre-release versions from crate.io - // unless explicitly asked for - Some("*") - } else { - vers - }; - let dep = Dependency::parse_no_deprecated(name, vers_spec, source.source_id())?; - let deps = source.query_vec(&dep)?; - match deps.iter().map(|p| p.package_id()).max() { - Some(pkgid) => { - let pkg = Box::new(&mut source).download_now(pkgid, config)?; - Ok((pkg, Box::new(source))) - }, - None => { - let vers_info = vers - .map(|v| format!(" with version `{}`", v)) - .unwrap_or_default(); - failure::bail!( - "could not find `{}` in {}{}", - name, - source.source_id(), - vers_info - ) - } } - } - None => { - let candidates = list_all(&mut source)?; - let binaries = candidates - .iter() - .filter(|cand| cand.targets().iter().filter(|t| t.is_bin()).count() > 0); - let examples = candidates - .iter() - .filter(|cand| cand.targets().iter().filter(|t| t.is_example()).count() > 0); - let pkg = match one(binaries, |v| multi_err("binaries", v))? { - Some(p) => p, - None => match one(examples, |v| multi_err("examples", v))? { - Some(p) => p, - None => failure::bail!( - "no packages found with binaries or \ - examples" - ), - }, - }; - return Ok((pkg.clone(), Box::new(source))); - - fn multi_err(kind: &str, mut pkgs: Vec<&Package>) -> String { - pkgs.sort_unstable_by_key(|a| a.name()); - format!( - "multiple packages with {} found: {}", - kind, - pkgs.iter() - .map(|p| p.name().as_str()) - .collect::>() - .join(", ") + } else { + None + }; + let vers = vers.as_ref().map(|s| &**s); + let vers_spec = if vers.is_none() && source.source_id().is_registry() { + // Avoid pre-release versions from crate.io + // unless explicitly asked for + Some("*") + } else { + vers + }; + let dep = Dependency::parse_no_deprecated(name, vers_spec, source.source_id())?; + let deps = source.query_vec(&dep)?; + match deps.iter().map(|p| p.package_id()).max() { + Some(pkgid) => { + let pkg = Box::new(&mut source).download_now(pkgid, config)?; + Ok(pkg) + } + None => { + let vers_info = vers + .map(|v| format!(" with version `{}`", v)) + .unwrap_or_default(); + bail!( + "could not find `{}` in {}{}", + name, + source.source_id(), + vers_info ) } } + } else { + let candidates = list_all(&mut source)?; + let binaries = candidates + .iter() + .filter(|cand| cand.targets().iter().filter(|t| t.is_bin()).count() > 0); + let examples = candidates + .iter() + .filter(|cand| cand.targets().iter().filter(|t| t.is_example()).count() > 0); + let pkg = match one(binaries, |v| multi_err("binaries", v))? { + Some(p) => p, + None => match one(examples, |v| multi_err("examples", v))? { + Some(p) => p, + None => bail!( + "no packages found with binaries or \ + examples" + ), + }, + }; + return Ok(pkg.clone()); + + fn multi_err(kind: &str, mut pkgs: Vec<&Package>) -> String { + pkgs.sort_unstable_by_key(|a| a.name()); + format!( + "multiple packages with {} found: {}", + kind, + pkgs.iter() + .map(|p| p.name().as_str()) + .collect::>() + .join(", ") + ) + } } } -pub fn one(mut i: I, f: F) -> CargoResult> +/// Get one element from the iterator. +/// Returns None if none left. +/// Returns error if there is more than one item in the iterator. +fn one(mut i: I, f: F) -> CargoResult> where I: Iterator, F: FnOnce(Vec) -> String, @@ -199,53 +712,61 @@ (Some(i1), Some(i2)) => { let mut v = vec![i1, i2]; v.extend(i); - Err(failure::format_err!("{}", f(v))) + Err(format_err!("{}", f(v))) } (Some(i), None) => Ok(Some(i)), (None, _) => Ok(None), } } -pub fn read_crate_list(file: &FileLock) -> CargoResult { - let listing = (|| -> CargoResult<_> { - let mut contents = String::new(); - file.file().read_to_string(&mut contents)?; - let listing = - toml::from_str(&contents).chain_err(|| internal("invalid TOML found for metadata"))?; - match listing { - CrateListing::V1(v1) => Ok(v1), - CrateListing::Empty(_) => Ok(CrateListingV1 { - v1: BTreeMap::new(), - }), - } - })() - .chain_err(|| { - failure::format_err!( - "failed to parse crate metadata at `{}`", - file.path().to_string_lossy() - ) - })?; - Ok(listing) -} - -pub fn write_crate_list(file: &FileLock, listing: CrateListingV1) -> CargoResult<()> { - (|| -> CargoResult<_> { - let mut file = file.file(); - file.seek(SeekFrom::Start(0))?; - file.set_len(0)?; - let data = toml::to_string(&CrateListing::V1(listing))?; - file.write_all(data.as_bytes())?; - Ok(()) - })() - .chain_err(|| { - failure::format_err!( - "failed to write crate metadata at `{}`", - file.path().to_string_lossy() - ) - })?; - Ok(()) +fn profile_name(release: bool) -> &'static str { + if release { + "release" + } else { + "dev" + } +} + +/// Helper to convert features Vec to a BTreeSet. +fn feature_set(features: &[String]) -> BTreeSet { + features.iter().cloned().collect() } -pub fn metadata(config: &Config, root: &Filesystem) -> CargoResult { - root.open_rw(Path::new(".crates.toml"), config, "crate metadata") +/// Helper to get the executable names from a filter. +pub fn exe_names(pkg: &Package, filter: &ops::CompileFilter) -> BTreeSet { + let to_exe = |name| format!("{}{}", name, env::consts::EXE_SUFFIX); + match filter { + CompileFilter::Default { .. } => pkg + .targets() + .iter() + .filter(|t| t.is_bin()) + .map(|t| to_exe(t.name())) + .collect(), + CompileFilter::Only { + ref bins, + ref examples, + .. + } => { + let all_bins: Vec = bins.try_collect().unwrap_or_else(|| { + pkg.targets() + .iter() + .filter(|t| t.is_bin()) + .map(|t| t.name().to_string()) + .collect() + }); + let all_examples: Vec = examples.try_collect().unwrap_or_else(|| { + pkg.targets() + .iter() + .filter(|t| t.is_exe_example()) + .map(|t| t.name().to_string()) + .collect() + }); + + all_bins + .iter() + .chain(all_examples.iter()) + .map(|name| to_exe(name)) + .collect() + } + } } diff -Nru cargo-0.35.0/src/cargo/ops/fix.rs cargo-0.37.0/src/cargo/ops/fix.rs --- cargo-0.35.0/src/cargo/ops/fix.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/ops/fix.rs 2019-05-15 19:48:47.000000000 +0000 @@ -56,7 +56,7 @@ use crate::ops::{self, CompileOptions}; use crate::util::diagnostic_server::{Message, RustfixDiagnosticServer}; use crate::util::errors::CargoResult; -use crate::util::paths; +use crate::util::{self, paths}; use crate::util::{existing_vcs_repo, LockServer, LockServerClient}; const FIX_ENV: &str = "__CARGO_FIX_PLZ"; @@ -81,46 +81,31 @@ // Spin up our lock server, which our subprocesses will use to synchronize fixes. let lock_server = LockServer::new()?; - opts.compile_opts - .build_config - .extra_rustc_env - .push((FIX_ENV.to_string(), lock_server.addr().to_string())); + let mut wrapper = util::process(env::current_exe()?); + wrapper.env(FIX_ENV, lock_server.addr().to_string()); let _started = lock_server.start()?; opts.compile_opts.build_config.force_rebuild = true; if opts.broken_code { - let key = BROKEN_CODE_ENV.to_string(); - opts.compile_opts - .build_config - .extra_rustc_env - .push((key, "1".to_string())); + wrapper.env(BROKEN_CODE_ENV, "1"); } if opts.edition { - let key = EDITION_ENV.to_string(); - opts.compile_opts - .build_config - .extra_rustc_env - .push((key, "1".to_string())); + wrapper.env(EDITION_ENV, "1"); } else if let Some(edition) = opts.prepare_for { - opts.compile_opts - .build_config - .extra_rustc_env - .push((PREPARE_FOR_ENV.to_string(), edition.to_string())); + wrapper.env(PREPARE_FOR_ENV, edition); } if opts.idioms { - opts.compile_opts - .build_config - .extra_rustc_env - .push((IDIOMS_ENV.to_string(), "1".to_string())); + wrapper.env(IDIOMS_ENV, "1"); } - opts.compile_opts.build_config.cargo_as_rustc_wrapper = true; + *opts .compile_opts .build_config .rustfix_diagnostic_server .borrow_mut() = Some(RustfixDiagnosticServer::new()?); + opts.compile_opts.build_config.rustc_wrapper = Some(wrapper); ops::compile(ws, &opts.compile_opts)?; Ok(()) @@ -207,7 +192,7 @@ let args = FixArgs::get(); trace!("cargo-fix as rustc got file {:?}", args.file); - let rustc = env::var_os("RUSTC").expect("failed to find RUSTC env var"); + let rustc = args.rustc.as_ref().expect("fix wrapper rustc was not set"); // Our goal is to fix only the crates that the end user is interested in. // That's very likely to only mean the crates in the workspace the user is @@ -576,6 +561,7 @@ enabled_edition: Option, other: Vec, primary_package: bool, + rustc: Option, } enum PrepareFor { @@ -593,7 +579,8 @@ impl FixArgs { fn get() -> FixArgs { let mut ret = FixArgs::default(); - for arg in env::args_os().skip(1) { + ret.rustc = env::args_os().nth(1).map(PathBuf::from); + for arg in env::args_os().skip(2) { let path = PathBuf::from(arg); if path.extension().and_then(|s| s.to_str()) == Some("rs") && path.exists() { ret.file = Some(path); diff -Nru cargo-0.35.0/src/cargo/ops/lockfile.rs cargo-0.37.0/src/cargo/ops/lockfile.rs --- cargo-0.35.0/src/cargo/ops/lockfile.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/ops/lockfile.rs 2019-05-15 19:48:47.000000000 +0000 @@ -29,7 +29,57 @@ Ok(resolve) } +/// Generate a toml String of Cargo.lock from a Resolve. +pub fn resolve_to_string(ws: &Workspace<'_>, resolve: &Resolve) -> CargoResult { + let (_orig, out, _ws_root) = resolve_to_string_orig(ws, resolve)?; + Ok(out) +} + pub fn write_pkg_lockfile(ws: &Workspace<'_>, resolve: &Resolve) -> CargoResult<()> { + let (orig, out, ws_root) = resolve_to_string_orig(ws, resolve)?; + + // If the lock file contents haven't changed so don't rewrite it. This is + // helpful on read-only filesystems. + if let Some(orig) = orig { + if are_equal_lockfiles(orig, &out, ws) { + return Ok(()); + } + } + + if !ws.config().lock_update_allowed() { + if ws.config().offline() { + failure::bail!("can't update in the offline mode"); + } + + let flag = if ws.config().network_allowed() { + "--locked" + } else { + "--frozen" + }; + failure::bail!( + "the lock file {} needs to be updated but {} was passed to \ + prevent this", + ws.root().to_path_buf().join("Cargo.lock").display(), + flag + ); + } + + // Ok, if that didn't work just write it out + ws_root + .open_rw("Cargo.lock", ws.config(), "Cargo.lock file") + .and_then(|mut f| { + f.file().set_len(0)?; + f.write_all(out.as_bytes())?; + Ok(()) + }) + .chain_err(|| format!("failed to write {}", ws.root().join("Cargo.lock").display()))?; + Ok(()) +} + +fn resolve_to_string_orig( + ws: &Workspace<'_>, + resolve: &Resolve, +) -> CargoResult<(Option, String, Filesystem)> { // Load the original lock file if it exists. let ws_root = Filesystem::new(ws.root().to_path_buf()); let orig = ws_root.open_ro("Cargo.lock", ws.config(), "Cargo.lock file"); @@ -94,42 +144,7 @@ out.push_str(&meta.to_string()); } - // If the lock file contents haven't changed so don't rewrite it. This is - // helpful on read-only filesystems. - if let Ok(orig) = orig { - if are_equal_lockfiles(orig, &out, ws) { - return Ok(()); - } - } - - if !ws.config().lock_update_allowed() { - if ws.config().cli_unstable().offline { - failure::bail!("can't update in the offline mode"); - } - - let flag = if ws.config().network_allowed() { - "--locked" - } else { - "--frozen" - }; - failure::bail!( - "the lock file {} needs to be updated but {} was passed to \ - prevent this", - ws.root().to_path_buf().join("Cargo.lock").display(), - flag - ); - } - - // Ok, if that didn't work just write it out - ws_root - .open_rw("Cargo.lock", ws.config(), "Cargo.lock file") - .and_then(|mut f| { - f.file().set_len(0)?; - f.write_all(out.as_bytes())?; - Ok(()) - }) - .chain_err(|| format!("failed to write {}", ws.root().join("Cargo.lock").display()))?; - Ok(()) + Ok((orig.ok(), out, ws_root)) } fn are_equal_lockfiles(mut orig: String, current: &str, ws: &Workspace<'_>) -> bool { diff -Nru cargo-0.35.0/src/cargo/ops/mod.rs cargo-0.37.0/src/cargo/ops/mod.rs --- cargo-0.35.0/src/cargo/ops/mod.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/ops/mod.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,6 +1,6 @@ pub use self::cargo_clean::{clean, CleanOptions}; pub use self::cargo_compile::{compile, compile_with_exec, compile_ws, CompileOptions}; -pub use self::cargo_compile::{CompileFilter, FilterRule, Packages}; +pub use self::cargo_compile::{CompileFilter, FilterRule, LibRule, Packages}; pub use self::cargo_doc::{doc, DocOptions}; pub use self::cargo_fetch::{fetch, FetchOptions}; pub use self::cargo_generate_lockfile::generate_lockfile; @@ -16,7 +16,7 @@ pub use self::cargo_test::{run_benches, run_tests, TestOptions}; pub use self::cargo_uninstall::uninstall; pub use self::fix::{fix, fix_maybe_exec_rustc, FixOptions}; -pub use self::lockfile::{load_pkg_lockfile, write_pkg_lockfile}; +pub use self::lockfile::{load_pkg_lockfile, resolve_to_string, write_pkg_lockfile}; pub use self::registry::HttpTimeout; pub use self::registry::{configure_http_handle, http_handle_and_timeout}; pub use self::registry::{http_handle, needs_custom_http_transport, registry_login, search}; diff -Nru cargo-0.35.0/src/cargo/ops/registry.rs cargo-0.37.0/src/cargo/ops/registry.rs --- cargo-0.35.0/src/cargo/ops/registry.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/ops/registry.rs 2019-05-15 19:48:47.000000000 +0000 @@ -8,6 +8,7 @@ use crates_io::{NewCrate, NewCrateDependency, Registry}; use curl::easy::{Easy, InfoType, SslOpt}; +use failure::{bail, format_err}; use log::{log, Level}; use url::percent_encoding::{percent_encode, QUERY_ENCODE_SET}; @@ -16,7 +17,7 @@ use crate::core::source::Source; use crate::core::{Package, SourceId, Workspace}; use crate::ops; -use crate::sources::{RegistrySource, SourceConfigMap}; +use crate::sources::{RegistrySource, SourceConfigMap, CRATES_IO_REGISTRY}; use crate::util::config::{self, Config}; use crate::util::errors::{CargoResult, CargoResultExt}; use crate::util::important_paths::find_root_manifest_for_wd; @@ -48,14 +49,16 @@ let pkg = ws.current()?; if let Some(ref allowed_registries) = *pkg.publish() { - if !match opts.registry { - Some(ref registry) => allowed_registries.contains(registry), - None => false, - } { - failure::bail!( - "some crates cannot be published.\n\ - `{}` is marked as unpublishable", - pkg.name() + let reg_name = opts + .registry + .clone() + .unwrap_or_else(|| CRATES_IO_REGISTRY.to_string()); + if !allowed_registries.contains(®_name) { + bail!( + "`{}` cannot be published.\n\ + The registry `{}` is not listed in the `publish` value in Cargo.toml.", + pkg.name(), + reg_name ); } } @@ -66,6 +69,7 @@ opts.index.clone(), opts.registry.clone(), true, + !opts.dry_run, )?; verify_dependencies(pkg, ®istry, reg_id)?; @@ -112,7 +116,7 @@ for dep in pkg.dependencies().iter() { if dep.source_id().is_path() { if !dep.specified_req() { - failure::bail!( + bail!( "all path dependencies must have a version specified \ when publishing.\ndependency `{}` does not specify \ a version", @@ -125,13 +129,8 @@ // This extra hostname check is mostly to assist with testing, // but also prevents someone using `--index` to specify // something that points to crates.io. - let is_crates_io = registry - .host() - .to_url() - .map(|u| u.host_str() == Some("crates.io")) - .unwrap_or(false); - if registry_src.is_default_registry() || is_crates_io { - failure::bail!("crates cannot be published to crates.io with dependencies sourced from other\n\ + if registry_src.is_default_registry() || registry.host_is_crates_io() { + bail!("crates cannot be published to crates.io with dependencies sourced from other\n\ registries either publish `{}` on crates.io or pull it into this repository\n\ and specify it with a path and version\n\ (crate `{}` is pulled from {})", @@ -140,7 +139,7 @@ dep.source_id()); } } else { - failure::bail!( + bail!( "crates cannot be published with dependencies sourced from \ a repository\neither publish `{}` as its own crate and \ specify a version as a dependency or pull it into this \ @@ -221,7 +220,7 @@ }; if let Some(ref file) = *license_file { if fs::metadata(&pkg.root().join(file)).is_err() { - failure::bail!("the license file `{}` does not exist", file) + bail!("the license file `{}` does not exist", file) } } @@ -238,7 +237,7 @@ .map(|(feat, values)| { ( feat.to_string(), - values.iter().map(|fv| fv.to_string(&summary)).collect(), + values.iter().map(|fv| fv.to_string(summary)).collect(), ) }) .collect::>>(); @@ -286,7 +285,7 @@ the following are not valid badges and were ignored: {}. \ Either the badge type specified is unknown or a required \ attribute is missing. Please see \ - http://doc.crates.io/manifest.html#package-metadata \ + https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata \ for valid badge types and their required attributes.", warnings.invalid_badges.join(", ") ); @@ -320,9 +319,11 @@ ) } None => { - // Checking out for default index and token + // Checking for default index and token ( - config.get_string("registry.index")?.map(|p| p.val), + config + .get_default_registry_index()? + .map(|url| url.to_string()), config.get_string("registry.token")?.map(|p| p.val), ) } @@ -331,12 +332,13 @@ Ok(RegistryConfig { index, token }) } -pub fn registry( +fn registry( config: &Config, token: Option, index: Option, registry: Option, force_update: bool, + validate_token: bool, ) -> CargoResult<(Registry, SourceId)> { // Parse all configuration options let RegistryConfig { @@ -346,6 +348,7 @@ let token = token.or(token_config); let sid = get_source_id(config, index_config.or(index), registry)?; let api_host = { + let _lock = config.acquire_package_cache_lock()?; let mut src = RegistrySource::remote(sid, &HashSet::new(), config); // Only update the index if the config is not available or `force` is set. let cfg = src.config(); @@ -357,9 +360,12 @@ cfg.unwrap() }; cfg.and_then(|cfg| cfg.api) - .ok_or_else(|| failure::format_err!("{} does not support API commands", sid))? + .ok_or_else(|| format_err!("{} does not support API commands", sid))? }; let handle = http_handle(config)?; + if validate_token && token.is_none() { + bail!("no upload token found, please run `cargo login`"); + }; Ok((Registry::new_handle(api_host, token, handle), sid)) } @@ -372,13 +378,13 @@ pub fn http_handle_and_timeout(config: &Config) -> CargoResult<(Easy, HttpTimeout)> { if config.frozen() { - failure::bail!( + bail!( "attempting to make an HTTP request, but --frozen was \ specified" ) } if !config.network_allowed() { - failure::bail!("can't make HTTP request in the offline mode") + bail!("can't make HTTP request in the offline mode") } // The timeout option for libcurl by default times out the entire transfer, @@ -533,7 +539,7 @@ token: Option, reg: Option, ) -> CargoResult<()> { - let (registry, _) = registry(config, token.clone(), None, reg.clone(), false)?; + let (registry, _) = registry(config, token.clone(), None, reg.clone(), false, false)?; let token = match token { Some(token) => token, @@ -601,13 +607,14 @@ opts.index.clone(), opts.registry.clone(), true, + true, )?; if let Some(ref v) = opts.to_add { let v = v.iter().map(|s| &s[..]).collect::>(); - let msg = registry.add_owners(&name, &v).map_err(|e| { - failure::format_err!("failed to invite owners to crate {}: {}", name, e) - })?; + let msg = registry + .add_owners(&name, &v) + .map_err(|e| format_err!("failed to invite owners to crate {}: {}", name, e))?; config.shell().status("Owner", msg)?; } @@ -658,10 +665,10 @@ }; let version = match version { Some(v) => v, - None => failure::bail!("a version must be specified to yank"), + None => bail!("a version must be specified to yank"), }; - let (mut registry, _) = registry(config, token, index, reg, true)?; + let (mut registry, _) = registry(config, token, index, reg, true, true)?; if undo { config @@ -717,7 +724,7 @@ prefix } - let (mut registry, source_id) = registry(config, None, index, reg, false)?; + let (mut registry, source_id) = registry(config, None, index, reg, false, false)?; let (crates, total_crates) = registry .search(query, limit) .chain_err(|| "failed to retrieve search results from the registry")?; @@ -760,7 +767,7 @@ } else if total_crates > limit && limit >= search_max_limit { let extra = if source_id.is_default_registry() { format!( - " (go to http://crates.io/search?q={} to see more)", + " (go to https://crates.io/search?q={} to see more)", percent_encode(query.as_bytes(), QUERY_ENCODE_SET) ) } else { diff -Nru cargo-0.35.0/src/cargo/ops/resolve.rs cargo-0.37.0/src/cargo/ops/resolve.rs --- cargo-0.35.0/src/cargo/ops/resolve.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/ops/resolve.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,9 +1,11 @@ use std::collections::HashSet; +use std::rc::Rc; use log::{debug, trace}; use crate::core::registry::PackageRegistry; use crate::core::resolver::{self, Method, Resolve}; +use crate::core::Feature; use crate::core::{PackageId, PackageIdSpec, PackageSet, Source, SourceId, Workspace}; use crate::ops; use crate::sources::PathSource; @@ -23,7 +25,7 @@ /// lock file. pub fn resolve_ws<'a>(ws: &Workspace<'a>) -> CargoResult<(PackageSet<'a>, Resolve)> { let mut registry = PackageRegistry::new(ws.config())?; - let resolve = resolve_with_registry(ws, &mut registry, true)?; + let resolve = resolve_with_registry(ws, &mut registry)?; let packages = get_resolved_packages(&resolve, registry)?; Ok((packages, resolve)) } @@ -32,7 +34,6 @@ /// taking into account `paths` overrides and activated features. pub fn resolve_ws_precisely<'a>( ws: &Workspace<'a>, - source: Option>, features: &[String], all_features: bool, no_default_features: bool, @@ -44,30 +45,28 @@ } else { Method::Required { dev_deps: true, - features: &features, + features: Rc::new(features), all_features: false, uses_default_features: !no_default_features, } }; - resolve_ws_with_method(ws, source, method, specs) + resolve_ws_with_method(ws, method, specs) } pub fn resolve_ws_with_method<'a>( ws: &Workspace<'a>, - source: Option>, - method: Method<'_>, + method: Method, specs: &[PackageIdSpec], ) -> CargoResult<(PackageSet<'a>, Resolve)> { let mut registry = PackageRegistry::new(ws.config())?; - if let Some(source) = source { - registry.add_preloaded(source); - } let mut add_patches = true; - let resolve = if ws.require_optional_deps() { + let resolve = if ws.ignore_lock() { + None + } else if ws.require_optional_deps() { // First, resolve the root_package's *listed* dependencies, as well as // downloading and updating all remotes and such. - let resolve = resolve_with_registry(ws, &mut registry, false)?; + let resolve = resolve_with_registry(ws, &mut registry)?; add_patches = false; // Second, resolve with precisely what we're doing. Filter out @@ -101,7 +100,6 @@ None, specs, add_patches, - true, )?; let packages = get_resolved_packages(&resolved_with_overrides, registry)?; @@ -112,7 +110,6 @@ fn resolve_with_registry<'cfg>( ws: &Workspace<'cfg>, registry: &mut PackageRegistry<'cfg>, - warn: bool, ) -> CargoResult { let prev = ops::load_pkg_lockfile(ws)?; let resolve = resolve_with_previous( @@ -123,7 +120,6 @@ None, &[], true, - warn, )?; if !ws.is_ephemeral() { @@ -144,13 +140,16 @@ pub fn resolve_with_previous<'cfg>( registry: &mut PackageRegistry<'cfg>, ws: &Workspace<'cfg>, - method: Method<'_>, + method: Method, previous: Option<&Resolve>, to_avoid: Option<&HashSet>, specs: &[PackageIdSpec], register_patches: bool, - warn: bool, ) -> CargoResult { + // We only want one Cargo at a time resolving a crate graph since this can + // involve a lot of frobbing of the global caches. + let _lock = ws.config().acquire_package_cache_lock()?; + // Here we place an artificial limitation that all non-registry sources // cannot be locked at more than one revision. This means that if a Git // repository provides more than one package, they must all be updated in @@ -229,7 +228,7 @@ let mut summaries = Vec::new(); if ws.config().cli_unstable().package_features { let mut members = Vec::new(); - match method { + match &method { Method::Everything => members.extend(ws.members()), Method::Required { features, @@ -248,7 +247,7 @@ // of current workspace. Add all packages from workspace to get `foo` // into the resolution graph. if members.is_empty() { - if !(features.is_empty() && !all_features && uses_default_features) { + if !(features.is_empty() && !all_features && *uses_default_features) { failure::bail!("cannot specify features for packages outside of workspace"); } members.extend(ws.members()); @@ -257,7 +256,7 @@ } for member in members { let summary = registry.lock(member.summary().clone()); - summaries.push((summary, method)) + summaries.push((summary, method.clone())) } } else { for member in ws.members() { @@ -288,13 +287,13 @@ } => { let base = Method::Required { dev_deps, - features: &[], + features: Rc::default(), all_features, uses_default_features: true, }; let member_id = member.package_id(); match ws.current_opt() { - Some(current) if member_id == current.package_id() => method, + Some(current) if member_id == current.package_id() => method.clone(), _ => { if specs.iter().any(|spec| spec.matches(member_id)) { base @@ -337,7 +336,7 @@ registry, &try_to_use, Some(ws.config()), - warn, + ws.features().require(Feature::public_dependency()).is_ok(), )?; resolved.register_used_patches(registry.patches()); if register_patches { @@ -519,6 +518,7 @@ if !visited.insert(member.package_id()) { continue; } + let is_ws_member = ws.is_member(&member); for dep in member.dependencies() { // If this dependency didn't match anything special then we may want // to poison the source as it may have been added. If this path @@ -531,11 +531,7 @@ // non-workspace member and then simultaneously editing the // dependency on that crate to enable the feature. For now, // this bug is better than the always-updating registry though. - if !ws - .members() - .any(|pkg| pkg.package_id() == member.package_id()) - && (dep.is_optional() || !dep.is_transitive()) - { + if !is_ws_member && (dep.is_optional() || !dep.is_transitive()) { continue; } diff -Nru cargo-0.35.0/src/cargo/sources/directory.rs cargo-0.37.0/src/cargo/sources/directory.rs --- cargo-0.35.0/src/cargo/sources/directory.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/sources/directory.rs 2019-05-15 19:48:47.000000000 +0000 @@ -116,7 +116,7 @@ let mut src = PathSource::new(&path, self.source_id, self.config); src.update()?; - let pkg = src.root_package()?; + let mut pkg = src.root_package()?; let cksum_file = path.join(".cargo-checksum.json"); let cksum = paths::read(&path.join(cksum_file)).chain_err(|| { @@ -136,13 +136,11 @@ ) })?; - let mut manifest = pkg.manifest().clone(); - let mut summary = manifest.summary().clone(); - if let Some(ref package) = cksum.package { - summary = summary.set_checksum(package.clone()); + if let Some(package) = &cksum.package { + pkg.manifest_mut() + .summary_mut() + .set_checksum(package.clone()); } - manifest.set_summary(summary); - let pkg = Package::new(manifest, pkg.manifest_path()); self.packages.insert(pkg.package_id(), (pkg, cksum)); } @@ -216,4 +214,8 @@ } fn add_to_yanked_whitelist(&mut self, _pkgs: &[PackageId]) {} + + fn is_yanked(&mut self, _pkg: PackageId) -> CargoResult { + Ok(false) + } } diff -Nru cargo-0.35.0/src/cargo/sources/git/source.rs cargo-0.37.0/src/cargo/sources/git/source.rs --- cargo-0.35.0/src/cargo/sources/git/source.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/sources/git/source.rs 2019-05-15 19:48:47.000000000 +0000 @@ -154,16 +154,13 @@ } fn update(&mut self) -> CargoResult<()> { - let lock = - self.config - .git_path() - .open_rw(".cargo-lock-git", self.config, "the git checkouts")?; + let git_path = self.config.git_path(); + let git_path = self.config.assert_package_cache_locked(&git_path); + let db_path = git_path.join("db").join(&self.ident); - let db_path = lock.parent().join("db").join(&self.ident); - - if self.config.cli_unstable().offline && !db_path.exists() { + if self.config.offline() && !db_path.exists() { failure::bail!( - "can't checkout from '{}': you are in the offline mode (-Z offline)", + "can't checkout from '{}': you are in the offline mode (--offline)", self.remote.url() ); } @@ -175,7 +172,7 @@ let actual_rev = self.remote.rev_for(&db_path, &self.reference); let should_update = actual_rev.is_err() || self.source_id.precise().is_none(); - let (db, actual_rev) = if should_update && !self.config.cli_unstable().offline { + let (db, actual_rev) = if should_update && !self.config.offline() { self.config.shell().status( "Updating", format!("git repository `{}`", self.remote.url()), @@ -189,21 +186,17 @@ (self.remote.db_at(&db_path)?, actual_rev.unwrap()) }; - // Don’t use the full hash, in order to contribute less to reaching the path length limit - // on Windows. See . + // Don’t use the full hash, in order to contribute less to reaching the + // path length limit on Windows. See + // . let short_id = db.to_short_id(&actual_rev).unwrap(); - let checkout_path = lock - .parent() + let checkout_path = git_path .join("checkouts") .join(&self.ident) .join(short_id.as_str()); - // Copy the database to the checkout location. After this we could drop - // the lock on the database as we no longer needed it, but we leave it - // in scope so the destructors here won't tamper with too much. - // Checkout is immutable, so we don't need to protect it with a lock once - // it is created. + // Copy the database to the checkout location. db.copy_to(actual_rev.clone(), &checkout_path, self.config)?; let source_id = self.source_id.with_precise(Some(actual_rev.to_string())); @@ -239,6 +232,10 @@ } fn add_to_yanked_whitelist(&mut self, _pkgs: &[PackageId]) {} + + fn is_yanked(&mut self, _pkg: PackageId) -> CargoResult { + Ok(false) + } } #[cfg(test)] diff -Nru cargo-0.35.0/src/cargo/sources/git/utils.rs cargo-0.37.0/src/cargo/sources/git/utils.rs --- cargo-0.35.0/src/cargo/sources/git/utils.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/sources/git/utils.rs 2019-05-15 19:48:47.000000000 +0000 @@ -508,7 +508,8 @@ // callback asking for other authentication methods to try. Check // cred_helper_bad to make sure we only try the git credentail helper // once, to avoid looping forever. - if allowed.contains(git2::CredentialType::USER_PASS_PLAINTEXT) && cred_helper_bad.is_none() { + if allowed.contains(git2::CredentialType::USER_PASS_PLAINTEXT) && cred_helper_bad.is_none() + { let r = git2::Cred::credential_helper(cfg, url, username); cred_helper_bad = Some(r.is_err()); return r; @@ -702,7 +703,7 @@ // request we're about to issue. maybe_gc_repo(repo)?; - // Unfortuantely `libgit2` is notably lacking in the realm of authentication + // Unfortunately `libgit2` is notably lacking in the realm of authentication // when compared to the `git` command line. As a result, allow an escape // hatch for users that would prefer to use `git`-the-CLI for fetching // repositories instead of `libgit2`-the-library. This should make more @@ -721,7 +722,7 @@ // repository. It could also fail, however, for a whole slew of other // reasons (aka network related reasons). We want Cargo to automatically // recover from corrupt repositories, but we don't want Cargo to stomp - // over other legitimate errors.o + // over other legitimate errors. // // Consequently we save off the error of the `fetch` operation and if it // looks like a "corrupt repo" error then we blow away the repo and try @@ -765,7 +766,7 @@ let mut cmd = process("git"); cmd.arg("fetch") .arg("--tags") // fetch all tags - .arg("--quiet") + .arg("--force") // handle force pushes .arg("--update-head-ok") // see discussion in #2078 .arg(url.to_string()) .arg(refspec) @@ -773,7 +774,7 @@ config .shell() .verbose(|s| s.status("Running", &cmd.to_string()))?; - cmd.exec()?; + cmd.exec_with_output()?; Ok(()) } @@ -863,7 +864,7 @@ fn init(path: &Path, bare: bool) -> CargoResult { let mut opts = git2::RepositoryInitOptions::new(); - // Skip anyting related to templates, they just call all sorts of issues as + // Skip anything related to templates, they just call all sorts of issues as // we really don't want to use them yet they insist on being used. See #6240 // for an example issue that comes up. opts.external_template(false); diff -Nru cargo-0.35.0/src/cargo/sources/path.rs cargo-0.37.0/src/cargo/sources/path.rs --- cargo-0.35.0/src/cargo/sources/path.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/sources/path.rs 2019-05-15 19:48:47.000000000 +0000 @@ -11,9 +11,7 @@ use crate::core::source::MaybePackage; use crate::core::{Dependency, Package, PackageId, Source, SourceId, Summary}; use crate::ops; -use crate::util::paths; -use crate::util::Config; -use crate::util::{internal, CargoResult}; +use crate::util::{internal, paths, CargoResult, CargoResultExt, Config}; pub struct PathSource<'cfg> { source_id: SourceId, @@ -103,10 +101,10 @@ /// stages are: /// /// 1) Only warn users about the future change iff their matching rules are - /// affected. (CURRENT STAGE) + /// affected. /// /// 2) Switch to the new strategy and update documents. Still keep warning - /// affected users. + /// affected users. (CURRENT STAGE) /// /// 3) Drop the old strategy and no more warnings. /// @@ -124,7 +122,6 @@ p }; Pattern::new(pattern) - .map_err(|e| failure::format_err!("could not parse glob pattern `{}`: {}", p, e)) }; let glob_exclude = pkg @@ -132,14 +129,27 @@ .exclude() .iter() .map(|p| glob_parse(p)) - .collect::, _>>()?; + .collect::, _>>(); let glob_include = pkg .manifest() .include() .iter() .map(|p| glob_parse(p)) - .collect::, _>>()?; + .collect::, _>>(); + + // Don't warn if using a negate pattern, since those weren't ever + // previously supported. + let has_negate = pkg + .manifest() + .exclude() + .iter() + .chain(pkg.manifest().include().iter()) + .any(|p| p.starts_with("!")); + // Don't warn about glob mismatch if it doesn't parse. + let glob_is_valid = glob_exclude.is_ok() && glob_include.is_ok() && !has_negate; + let glob_exclude = glob_exclude.unwrap_or_else(|_| Vec::new()); + let glob_include = glob_include.unwrap_or_else(|_| Vec::new()); let glob_should_package = |relative_path: &Path| -> bool { fn glob_match(patterns: &[Pattern], relative_path: &Path) -> bool { @@ -178,10 +188,7 @@ { Match::None => Ok(true), Match::Ignore(_) => Ok(false), - Match::Whitelist(pattern) => Err(failure::format_err!( - "exclude rules cannot start with `!`: {}", - pattern.original() - )), + Match::Whitelist(_) => Ok(true), } } else { match ignore_include @@ -189,10 +196,7 @@ { Match::None => Ok(false), Match::Ignore(_) => Ok(true), - Match::Whitelist(pattern) => Err(failure::format_err!( - "include rules cannot start with `!`: {}", - pattern.original() - )), + Match::Whitelist(_) => Ok(false), } } }; @@ -201,23 +205,31 @@ let mut filter = |path: &Path| -> CargoResult { let relative_path = path.strip_prefix(root)?; + + let rel = relative_path.as_os_str(); + if rel == "Cargo.lock" { + return Ok(pkg.include_lockfile()); + } else if rel == "Cargo.toml" { + return Ok(true); + } + let glob_should_package = glob_should_package(relative_path); let ignore_should_package = ignore_should_package(relative_path)?; - if glob_should_package != ignore_should_package { + if glob_is_valid && glob_should_package != ignore_should_package { if glob_should_package { if no_include_option { self.config.shell().warn(format!( - "Pattern matching for Cargo's include/exclude fields is changing and \ - file `{}` WILL be excluded in a future Cargo version.\n\ + "Pattern matching for Cargo's include/exclude fields has changed and \ + file `{}` is now excluded.\n\ See for more \ information.", relative_path.display() ))?; } else { self.config.shell().warn(format!( - "Pattern matching for Cargo's include/exclude fields is changing and \ - file `{}` WILL NOT be included in a future Cargo version.\n\ + "Pattern matching for Cargo's include/exclude fields has changed and \ + file `{}` is no longer included.\n\ See for more \ information.", relative_path.display() @@ -225,16 +237,16 @@ } } else if no_include_option { self.config.shell().warn(format!( - "Pattern matching for Cargo's include/exclude fields is changing and \ - file `{}` WILL NOT be excluded in a future Cargo version.\n\ + "Pattern matching for Cargo's include/exclude fields has changed and \ + file `{}` is NOT excluded.\n\ See for more \ information.", relative_path.display() ))?; } else { self.config.shell().warn(format!( - "Pattern matching for Cargo's include/exclude fields is changing and \ - file `{}` WILL be included in a future Cargo version.\n\ + "Pattern matching for Cargo's include/exclude fields has changed and \ + file `{}` is now included.\n\ See for more \ information.", relative_path.display() @@ -242,8 +254,7 @@ } } - // Update to `ignore_should_package` for Stage 2. - Ok(glob_should_package) + Ok(ignore_should_package) }; // Attempt Git-prepopulate only if no `include` (see rust-lang/cargo#4135). @@ -334,7 +345,11 @@ } let statuses = repo.statuses(Some(&mut opts))?; let untracked = statuses.iter().filter_map(|entry| match entry.status() { - git2::Status::WT_NEW => Some((join(root, entry.path_bytes()), None)), + // Don't include Cargo.lock if it is untracked. Packaging will + // generate a new one as needed. + git2::Status::WT_NEW if entry.path() != Some("Cargo.lock") => { + Some((join(root, entry.path_bytes()), None)) + } _ => None, }); @@ -344,17 +359,15 @@ let file_path = file_path?; // Filter out files blatantly outside this package. This is helped a - // bit obove via the `pathspec` function call, but we need to filter + // bit above via the `pathspec` function call, but we need to filter // the entries in the index as well. if !file_path.starts_with(pkg_path) { continue; } match file_path.file_name().and_then(|s| s.to_str()) { - // Filter out `Cargo.lock` and `target` always; we don't want to - // package a lock file no one will ever read and we also avoid - // build artifacts. - Some("Cargo.lock") | Some("target") => continue, + // The `target` directory is never included. + Some("target") => continue, // Keep track of all sub-packages found and also strip out all // matches we've found so far. Note, though, that if we find @@ -455,7 +468,10 @@ // // TODO: drop `collect` and sort after transition period and dropping warning tests. // See rust-lang/cargo#4268 and rust-lang/cargo#4270. - let mut entries: Vec = fs::read_dir(path)?.map(|e| e.unwrap().path()).collect(); + let mut entries: Vec = fs::read_dir(path) + .chain_err(|| format!("cannot read {:?}", path))? + .map(|e| e.unwrap().path()) + .collect(); entries.sort_unstable_by(|a, b| a.as_os_str().cmp(b.as_os_str())); for path in entries { let name = path.file_name().and_then(|s| s.to_str()); @@ -466,7 +482,7 @@ if is_root { // Skip Cargo artifacts. match name { - Some("target") | Some("Cargo.lock") => continue, + Some("target") => continue, _ => {} } } @@ -574,4 +590,8 @@ } fn add_to_yanked_whitelist(&mut self, _pkgs: &[PackageId]) {} + + fn is_yanked(&mut self, _pkg: PackageId) -> CargoResult { + Ok(false) + } } diff -Nru cargo-0.35.0/src/cargo/sources/registry/index.rs cargo-0.37.0/src/cargo/sources/registry/index.rs --- cargo-0.35.0/src/cargo/sources/registry/index.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/sources/registry/index.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,14 +1,82 @@ +//! Management of the index of a registry source +//! +//! This module contains management of the index and various operations, such as +//! actually parsing the index, looking for crates, etc. This is intended to be +//! abstract over remote indices (downloaded via git) and local registry indices +//! (which are all just present on the filesystem). +//! +//! ## Index Performance +//! +//! One important aspect of the index is that we want to optimize the "happy +//! path" as much as possible. Whenever you type `cargo build` Cargo will +//! *always* reparse the registry and learn about dependency information. This +//! is done because Cargo needs to learn about the upstream crates.io crates +//! that you're using and ensure that the preexisting `Cargo.lock` still matches +//! the current state of the world. +//! +//! Consequently, Cargo "null builds" (the index that Cargo adds to each build +//! itself) need to be fast when accessing the index. The primary performance +//! optimization here is to avoid parsing JSON blobs from the registry if we +//! don't need them. Most secondary optimizations are centered around removing +//! allocations and such, but avoiding parsing JSON is the #1 optimization. +//! +//! When we get queries from the resolver we're given a `Dependency`. This +//! dependency in turn has a version requirement, and with lock files that +//! already exist these version requirements are exact version requirements +//! `=a.b.c`. This means that we in theory only need to parse one line of JSON +//! per query in the registry, the one that matches version `a.b.c`. +//! +//! The crates.io index, however, is not amenable to this form of query. Instead +//! the crates.io index simply is a file where each line is a JSON blob. To +//! learn about the versions in each JSON blob we would need to parse the JSON, +//! defeating the purpose of trying to parse as little as possible. +//! +//! > Note that as a small aside even *loading* the JSON from the registry is +//! > actually pretty slow. For crates.io and remote registries we don't +//! > actually check out the git index on disk because that takes quite some +//! > time and is quite large. Instead we use `libgit2` to read the JSON from +//! > the raw git objects. This in turn can be slow (aka show up high in +//! > profiles) because libgit2 has to do deflate decompression and such. +//! +//! To solve all these issues a strategy is employed here where Cargo basically +//! creates an index into the index. The first time a package is queried about +//! (first time being for an entire computer) Cargo will load the contents +//! (slowly via libgit2) from the registry. It will then (slowly) parse every +//! single line to learn about its versions. Afterwards, however, Cargo will +//! emit a new file (a cache) which is amenable for speedily parsing in future +//! invocations. +//! +//! This cache file is currently organized by basically having the semver +//! version extracted from each JSON blob. That way Cargo can quickly and easily +//! parse all versions contained and which JSON blob they're associated with. +//! The JSON blob then doesn't actually need to get parsed unless the version is +//! parsed. +//! +//! Altogether the initial measurements of this shows a massive improvement for +//! Cargo null build performance. It's expected that the improvements earned +//! here will continue to grow over time in the sense that the previous +//! implementation (parse all lines each time) actually continues to slow down +//! over time as new versions of a crate are published. In any case when first +//! implemented a null build of Cargo itself would parse 3700 JSON blobs from +//! the registry and load 150 blobs from git. Afterwards it parses 150 JSON +//! blobs and loads 0 files git. Removing 200ms or more from Cargo's startup +//! time is certainly nothing to sneeze at! +//! +//! Note that this is just a high-level overview, there's of course lots of +//! details like invalidating caches and whatnot which are handled below, but +//! hopefully those are more obvious inline in the code itself. + use std::collections::{HashMap, HashSet}; +use std::fs; use std::path::Path; use std::str; -use log::{info, trace}; -use semver::Version; +use log::info; +use semver::{Version, VersionReq}; use crate::core::dependency::Dependency; -use crate::core::{PackageId, SourceId, Summary}; -use crate::sources::registry::RegistryData; -use crate::sources::registry::{RegistryPackage, INDEX_LOCK}; +use crate::core::{InternedString, PackageId, SourceId, Summary}; +use crate::sources::registry::{RegistryData, RegistryPackage}; use crate::util::{internal, CargoResult, Config, Filesystem, ToSemver}; /// Crates.io treats hyphen and underscores as interchangeable, but the index and old Cargo do not. @@ -99,11 +167,65 @@ pub struct RegistryIndex<'cfg> { source_id: SourceId, path: Filesystem, - cache: HashMap<&'static str, Vec<(Summary, bool)>>, - // `(name, vers)` -> `checksum` - hashes: HashMap<&'static str, HashMap>, + summaries_cache: HashMap, config: &'cfg Config, - locked: bool, +} + +/// An internal cache of summaries for a particular package. +/// +/// A list of summaries are loaded from disk via one of two methods: +/// +/// 1. Primarily Cargo will parse the corresponding file for a crate in the +/// upstream crates.io registry. That's just a JSON blob per line which we +/// can parse, extract the version, and then store here. +/// +/// 2. Alternatively, if Cargo has previously run, we'll have a cached index of +/// dependencies for the upstream index. This is a file that Cargo maintains +/// lazily on the local filesystem and is much faster to parse since it +/// doesn't involve parsing all of the JSON. +/// +/// The outward-facing interface of this doesn't matter too much where it's +/// loaded from, but it's important when reading the implementation to note that +/// we try to parse as little as possible! +#[derive(Default)] +struct Summaries { + /// A raw vector of uninterpreted bytes. This is what `Unparsed` start/end + /// fields are indexes into. If a `Summaries` is loaded from the crates.io + /// index then this field will be empty since nothing is `Unparsed`. + raw_data: Vec, + + /// All known versions of a crate, keyed from their `Version` to the + /// possibly parsed or unparsed version of the full summary. + versions: HashMap, +} + +/// A lazily parsed `IndexSummary`. +enum MaybeIndexSummary { + /// A summary which has not been parsed, The `start` and `end` are pointers + /// into `Summaries::raw_data` which this is an entry of. + Unparsed { start: usize, end: usize }, + + /// An actually parsed summary. + Parsed(IndexSummary), +} + +/// A parsed representation of a summary from the index. +/// +/// In addition to a full `Summary` we have a few auxiliary pieces of +/// information liked `yanked` and what the checksum hash is. +pub struct IndexSummary { + pub summary: Summary, + pub yanked: bool, + pub hash: String, +} + +/// A representation of the cache on disk that Cargo maintains of summaries. +/// Cargo will initially parse all summaries in the registry and will then +/// serialize that into this form and place it in a new location on disk, +/// ensuring that access in the future is much speedier. +#[derive(Default)] +struct SummariesCache<'a> { + versions: Vec<(Version, &'a [u8])>, } impl<'cfg> RegistryIndex<'cfg> { @@ -111,160 +233,127 @@ source_id: SourceId, path: &Filesystem, config: &'cfg Config, - locked: bool, ) -> RegistryIndex<'cfg> { RegistryIndex { source_id, path: path.clone(), - cache: HashMap::new(), - hashes: HashMap::new(), + summaries_cache: HashMap::new(), config, - locked, } } /// Returns the hash listed for a specified `PackageId`. pub fn hash(&mut self, pkg: PackageId, load: &mut dyn RegistryData) -> CargoResult { - let name = pkg.name().as_str(); - let version = pkg.version(); - if let Some(s) = self.hashes.get(name).and_then(|v| v.get(version)) { - return Ok(s.clone()); - } - // Ok, we're missing the key, so parse the index file to load it. - self.summaries(name, load)?; - self.hashes - .get(name) - .and_then(|v| v.get(version)) - .ok_or_else(|| internal(format!("no hash listed for {}", pkg))) - .map(|s| s.clone()) + let req = VersionReq::exact(pkg.version()); + let summary = self + .summaries(pkg.name(), &req, load)? + .next() + .ok_or_else(|| internal(format!("no hash listed for {}", pkg)))?; + Ok(summary.hash.clone()) } - /// Parses the on-disk metadata for the package provided. + /// Load a list of summaries for `name` package in this registry which + /// match `req` /// - /// Returns a list of pairs of `(summary, yanked)` for the package name specified. - pub fn summaries( - &mut self, - name: &'static str, + /// This function will semantically parse the on-disk index, match all + /// versions, and then return an iterator over all summaries which matched. + /// Internally there's quite a few layer of caching to amortize this cost + /// though since this method is called quite a lot on null builds in Cargo. + pub fn summaries<'a, 'b>( + &'a mut self, + name: InternedString, + req: &'b VersionReq, load: &mut dyn RegistryData, - ) -> CargoResult<&Vec<(Summary, bool)>> { - if self.cache.contains_key(name) { - return Ok(&self.cache[name]); - } + ) -> CargoResult + 'b> + where + 'a: 'b, + { + let source_id = self.source_id.clone(); + + // First up actually parse what summaries we have available. If Cargo + // has run previously this will parse a Cargo-specific cache file rather + // than the registry itself. In effect this is intended to be a quite + // cheap operation. let summaries = self.load_summaries(name, load)?; - self.cache.insert(name, summaries); - Ok(&self.cache[name]) + + // Iterate over our summaries, extract all relevant ones which match our + // version requirement, and then parse all corresponding rows in the + // registry. As a reminder this `summaries` method is called for each + // entry in a lock file on every build, so we want to absolutely + // minimize the amount of work being done here and parse as little as + // necessary. + let raw_data = &summaries.raw_data; + Ok(summaries + .versions + .iter_mut() + .filter_map(move |(k, v)| if req.matches(k) { Some(v) } else { None }) + .filter_map(move |maybe| match maybe.parse(raw_data, source_id) { + Ok(summary) => Some(summary), + Err(e) => { + info!("failed to parse `{}` registry package: {}", name, e); + None + } + })) } fn load_summaries( &mut self, - name: &str, + name: InternedString, load: &mut dyn RegistryData, - ) -> CargoResult> { + ) -> CargoResult<&mut Summaries> { + // If we've previously loaded what versions are present for `name`, just + // return that since our cache should still be valid. + if self.summaries_cache.contains_key(&name) { + return Ok(self.summaries_cache.get_mut(&name).unwrap()); + } + // Prepare the `RegistryData` which will lazily initialize internal data - // structures. Note that this is also importantly needed to initialize - // to avoid deadlocks where we acquire a lock below but the `load` - // function inside *also* wants to acquire a lock. See an instance of - // this on #5551. + // structures. load.prepare()?; - let (root, _lock) = if self.locked { - let lock = self - .path - .open_ro(Path::new(INDEX_LOCK), self.config, "the registry index"); - match lock { - Ok(lock) => (lock.path().parent().unwrap().to_path_buf(), Some(lock)), - Err(_) => return Ok(Vec::new()), - } - } else { - (self.path.clone().into_path_unlocked(), None) - }; + // let root = self.config.assert_package_cache_locked(&self.path); + let root = load.assert_index_locked(&self.path); + let cache_root = root.join(".cache"); + let index_version = load.current_version(); + + // See module comment in `registry/mod.rs` for why this is structured + // the way it is. let fs_name = name .chars() .flat_map(|c| c.to_lowercase()) .collect::(); - - // See module comment for why this is structured the way it is. let raw_path = match fs_name.len() { 1 => format!("1/{}", fs_name), 2 => format!("2/{}", fs_name), 3 => format!("3/{}/{}", &fs_name[..1], fs_name), _ => format!("{}/{}/{}", &fs_name[0..2], &fs_name[2..4], fs_name), }; - let mut ret = Vec::new(); - for path in UncanonicalizedIter::new(&raw_path).take(1024) { - let mut hit_closure = false; - let err = load.load(&root, Path::new(&path), &mut |contents| { - hit_closure = true; - let contents = str::from_utf8(contents) - .map_err(|_| failure::format_err!("registry index file was not valid utf-8"))?; - ret.reserve(contents.lines().count()); - let lines = contents.lines().map(|s| s.trim()).filter(|l| !l.is_empty()); - - let online = !self.config.cli_unstable().offline; - // Attempt forwards-compatibility on the index by ignoring - // everything that we ourselves don't understand, that should - // allow future cargo implementations to break the - // interpretation of each line here and older cargo will simply - // ignore the new lines. - ret.extend(lines.filter_map(|line| { - let (summary, locked) = match self.parse_registry_package(line) { - Ok(p) => p, - Err(e) => { - info!("failed to parse `{}` registry package: {}", name, e); - trace!("line: {}", line); - return None; - } - }; - if online || load.is_crate_downloaded(summary.package_id()) { - Some((summary, locked)) - } else { - None - } - })); - Ok(()) - }); - - // We ignore lookup failures as those are just crates which don't exist - // or we haven't updated the registry yet. If we actually ran the - // closure though then we care about those errors. - if hit_closure { - err?; - // Crates.io ensures that there is only one hyphen and underscore equivalent - // result in the index so return when we find it. - return Ok(ret); + // Attempt to handle misspellings by searching for a chain of related + // names to the original `raw_path` name. Only return summaries + // associated with the first hit, however. The resolver will later + // reject any candidates that have the wrong name, and with this it'll + // along the way produce helpful "did you mean?" suggestions. + for path in UncanonicalizedIter::new(&raw_path).take(1024) { + let summaries = Summaries::parse( + index_version.as_ref().map(|s| &**s), + &root, + &cache_root, + path.as_ref(), + self.source_id, + load, + self.config, + )?; + if let Some(summaries) = summaries { + self.summaries_cache.insert(name, summaries); + return Ok(self.summaries_cache.get_mut(&name).unwrap()); } } - Ok(ret) - } - - /// Parses a line from the registry's index file into a `Summary` for a package. - /// - /// The returned boolean is whether or not the summary has been yanked. - fn parse_registry_package(&mut self, line: &str) -> CargoResult<(Summary, bool)> { - let RegistryPackage { - name, - vers, - cksum, - deps, - features, - yanked, - links, - } = serde_json::from_str(line)?; - let pkgid = PackageId::new(&name, &vers, self.source_id)?; - let name = pkgid.name(); - let deps = deps - .into_iter() - .map(|dep| dep.into_dep(self.source_id)) - .collect::>>()?; - let summary = Summary::new(pkgid, deps, &features, links, false)?; - let summary = summary.set_checksum(cksum.clone()); - self.hashes - .entry(name.as_str()) - .or_insert_with(HashMap::new) - .insert(vers, cksum); - Ok((summary, yanked.unwrap_or(false))) + // If nothing was found then this crate doesn't exists, so just use an + // empty `Summaries` list. + self.summaries_cache.insert(name, Summaries::default()); + Ok(self.summaries_cache.get_mut(&name).unwrap()) } pub fn query_inner( @@ -274,25 +363,57 @@ yanked_whitelist: &HashSet, f: &mut dyn FnMut(Summary), ) -> CargoResult<()> { + if self.config.offline() + && self.query_inner_with_online(dep, load, yanked_whitelist, f, false)? != 0 + { + return Ok(()); + // If offline, and there are no matches, try again with online. + // This is necessary for dependencies that are not used (such as + // target-cfg or optional), but are not downloaded. Normally the + // build should succeed if they are not downloaded and not used, + // but they still need to resolve. If they are actually needed + // then cargo will fail to download and an error message + // indicating that the required dependency is unavailable while + // offline will be displayed. + } + self.query_inner_with_online(dep, load, yanked_whitelist, f, true)?; + Ok(()) + } + + fn query_inner_with_online( + &mut self, + dep: &Dependency, + load: &mut dyn RegistryData, + yanked_whitelist: &HashSet, + f: &mut dyn FnMut(Summary), + online: bool, + ) -> CargoResult { let source_id = self.source_id; - let name = dep.package_name().as_str(); - let summaries = self.summaries(name, load)?; - let summaries = summaries - .iter() - .filter(|&(summary, yanked)| { - !yanked || { - log::debug!("{:?}", yanked_whitelist); - log::debug!("{:?}", summary.package_id()); - yanked_whitelist.contains(&summary.package_id()) - } - }) - .map(|s| s.0.clone()); + let summaries = self + .summaries(dep.package_name(), dep.version_req(), load)? + // First filter summaries for `--offline`. If we're online then + // everything is a candidate, otherwise if we're offline we're only + // going to consider candidates which are actually present on disk. + // + // Note: This particular logic can cause problems with + // optional dependencies when offline. If at least 1 version + // of an optional dependency is downloaded, but that version + // does not satisfy the requirements, then resolution will + // fail. Unfortunately, whether or not something is optional + // is not known here. + .filter(|s| (online || load.is_crate_downloaded(s.summary.package_id()))) + // Next filter out all yanked packages. Some yanked packages may + // leak throguh if they're in a whitelist (aka if they were + // previously in `Cargo.lock` + .filter(|s| !s.yanked || yanked_whitelist.contains(&s.summary.package_id())) + .map(|s| s.summary.clone()); // Handle `cargo update --precise` here. If specified, our own source // will have a precise version listed of the form // `=o->` where `` is the name of a crate on // this source, `` is the version installed and ` is the // version requested (argument to `--precise`). + let name = dep.package_name().as_str(); let summaries = summaries.filter(|s| match source_id.precise() { Some(p) if p.starts_with(name) && p[name.len()..].starts_with('=') => { let mut vers = p[name.len() + 1..].splitn(2, "->"); @@ -308,9 +429,330 @@ _ => true, }); + let mut count = 0; for summary in summaries { f(summary); + count += 1; } - Ok(()) + Ok(count) + } + + pub fn is_yanked(&mut self, pkg: PackageId, load: &mut dyn RegistryData) -> CargoResult { + let req = VersionReq::exact(pkg.version()); + let found = self + .summaries(pkg.name(), &req, load)? + .any(|summary| summary.yanked); + Ok(found) } } + +impl Summaries { + /// Parse out a `Summaries` instances from on-disk state. + /// + /// This will attempt to prefer parsing a previous cache file that already + /// exists from a previous invocation of Cargo (aka you're typing `cargo + /// build` again after typing it previously). If parsing fails or the cache + /// isn't found, then we take a slower path which loads the full descriptor + /// for `relative` from the underlying index (aka typically libgit2 with + /// crates.io) and then parse everything in there. + /// + /// * `index_version` - a version string to describe the current state of + /// the index which for remote registries is the current git sha and + /// for local registries is not available. + /// * `root` - this is the root argument passed to `load` + /// * `cache_root` - this is the root on the filesystem itself of where to + /// store cache files. + /// * `relative` - this is the file we're loading from cache or the index + /// data + /// * `source_id` - the registry's SourceId used when parsing JSON blobs to + /// create summaries. + /// * `load` - the actual index implementation which may be very slow to + /// call. We avoid this if we can. + pub fn parse( + index_version: Option<&str>, + root: &Path, + cache_root: &Path, + relative: &Path, + source_id: SourceId, + load: &mut dyn RegistryData, + config: &Config, + ) -> CargoResult> { + // First up, attempt to load the cache. This could fail for all manner + // of reasons, but consider all of them non-fatal and just log their + // occurrence in case anyone is debugging anything. + let cache_path = cache_root.join(relative); + let mut cache_contents = None; + if let Some(index_version) = index_version { + match fs::read(&cache_path) { + Ok(contents) => match Summaries::parse_cache(contents, index_version) { + Ok(s) => { + log::debug!("fast path for registry cache of {:?}", relative); + if cfg!(debug_assertions) { + cache_contents = Some(s.raw_data); + } else { + return Ok(Some(s)); + } + } + Err(e) => { + log::debug!("failed to parse {:?} cache: {}", relative, e); + } + }, + Err(e) => log::debug!("cache missing for {:?} error: {}", relative, e), + } + } + + // This is the fallback path where we actually talk to libgit2 to load + // information. Here we parse every single line in the index (as we need + // to find the versions) + log::debug!("slow path for {:?}", relative); + let mut ret = Summaries::default(); + let mut hit_closure = false; + let mut cache_bytes = None; + let err = load.load(root, relative, &mut |contents| { + ret.raw_data = contents.to_vec(); + let mut cache = SummariesCache::default(); + hit_closure = true; + for line in split(contents, b'\n') { + // Attempt forwards-compatibility on the index by ignoring + // everything that we ourselves don't understand, that should + // allow future cargo implementations to break the + // interpretation of each line here and older cargo will simply + // ignore the new lines. + let summary = match IndexSummary::parse(line, source_id) { + Ok(summary) => summary, + Err(e) => { + log::info!("failed to parse {:?} registry package: {}", relative, e); + continue; + } + }; + let version = summary.summary.package_id().version().clone(); + cache.versions.push((version.clone(), line)); + ret.versions.insert(version, summary.into()); + } + if let Some(index_version) = index_version { + cache_bytes = Some(cache.serialize(index_version)); + } + Ok(()) + }); + + // We ignore lookup failures as those are just crates which don't exist + // or we haven't updated the registry yet. If we actually ran the + // closure though then we care about those errors. + if !hit_closure { + debug_assert!(cache_contents.is_none()); + return Ok(None); + } + err?; + + // If we've got debug assertions enabled and the cache was previously + // present and considered fresh this is where the debug assertions + // actually happens to verify that our cache is indeed fresh and + // computes exactly the same value as before. + if cfg!(debug_assertions) && cache_contents.is_some() { + assert_eq!(cache_bytes, cache_contents); + } + + // Once we have our `cache_bytes` which represents the `Summaries` we're + // about to return, write that back out to disk so future Cargo + // invocations can use it. + // + // This is opportunistic so we ignore failure here but are sure to log + // something in case of error. + if let Some(cache_bytes) = cache_bytes { + if fs::create_dir_all(cache_path.parent().unwrap()).is_ok() { + let path = Filesystem::new(cache_path.clone()); + config.assert_package_cache_locked(&path); + if let Err(e) = fs::write(cache_path, cache_bytes) { + log::info!("failed to write cache: {}", e); + } + } + } + + Ok(Some(ret)) + } + + /// Parses an open `File` which represents information previously cached by + /// Cargo. + pub fn parse_cache(contents: Vec, last_index_update: &str) -> CargoResult { + let cache = SummariesCache::parse(&contents, last_index_update)?; + let mut ret = Summaries::default(); + for (version, summary) in cache.versions { + let (start, end) = subslice_bounds(&contents, summary); + ret.versions + .insert(version, MaybeIndexSummary::Unparsed { start, end }); + } + ret.raw_data = contents; + return Ok(ret); + + // Returns the start/end offsets of `inner` with `outer`. Asserts that + // `inner` is a subslice of `outer`. + fn subslice_bounds(outer: &[u8], inner: &[u8]) -> (usize, usize) { + let outer_start = outer.as_ptr() as usize; + let outer_end = outer_start + outer.len(); + let inner_start = inner.as_ptr() as usize; + let inner_end = inner_start + inner.len(); + assert!(inner_start >= outer_start); + assert!(inner_end <= outer_end); + (inner_start - outer_start, inner_end - outer_start) + } + } +} + +// Implementation of serializing/deserializing the cache of summaries on disk. +// Currently the format looks like: +// +// +--------------+-------------+---+ +// | version byte | git sha rev | 0 | +// +--------------+-------------+---+ +// +// followed by... +// +// +----------------+---+------------+---+ +// | semver version | 0 | JSON blob | 0 | ... +// +----------------+---+------------+---+ +// +// The idea is that this is a very easy file for Cargo to parse in future +// invocations. The read from disk should be quite fast and then afterwards all +// we need to know is what versions correspond to which JSON blob. +// +// The leading version byte is intended to ensure that there's some level of +// future compatibility against changes to this cache format so if different +// versions of Cargo share the same cache they don't get too confused. The git +// sha lets us know when the file needs to be regenerated (it needs regeneration +// whenever the index itself updates). + +const CURRENT_CACHE_VERSION: u8 = 1; + +impl<'a> SummariesCache<'a> { + fn parse(data: &'a [u8], last_index_update: &str) -> CargoResult> { + // NB: keep this method in sync with `serialize` below + let (first_byte, rest) = data + .split_first() + .ok_or_else(|| failure::format_err!("malformed cache"))?; + if *first_byte != CURRENT_CACHE_VERSION { + failure::bail!("looks like a different Cargo's cache, bailing out"); + } + let mut iter = split(rest, 0); + if let Some(update) = iter.next() { + if update != last_index_update.as_bytes() { + failure::bail!( + "cache out of date: current index ({}) != cache ({})", + last_index_update, + str::from_utf8(update)?, + ) + } + } else { + failure::bail!("malformed file"); + } + let mut ret = SummariesCache::default(); + while let Some(version) = iter.next() { + let version = str::from_utf8(version)?; + let version = Version::parse(version)?; + let summary = iter.next().unwrap(); + ret.versions.push((version, summary)); + } + Ok(ret) + } + + fn serialize(&self, index_version: &str) -> Vec { + // NB: keep this method in sync with `parse` above + let size = self + .versions + .iter() + .map(|(_version, data)| (10 + data.len())) + .sum(); + let mut contents = Vec::with_capacity(size); + contents.push(CURRENT_CACHE_VERSION); + contents.extend_from_slice(index_version.as_bytes()); + contents.push(0); + for (version, data) in self.versions.iter() { + contents.extend_from_slice(version.to_string().as_bytes()); + contents.push(0); + contents.extend_from_slice(data); + contents.push(0); + } + return contents; + } +} + +impl MaybeIndexSummary { + /// Parses this "maybe a summary" into a `Parsed` for sure variant. + /// + /// Does nothing if this is already `Parsed`, and otherwise the `raw_data` + /// passed in is sliced with the bounds in `Unparsed` and then actually + /// parsed. + fn parse(&mut self, raw_data: &[u8], source_id: SourceId) -> CargoResult<&IndexSummary> { + let (start, end) = match self { + MaybeIndexSummary::Unparsed { start, end } => (*start, *end), + MaybeIndexSummary::Parsed(summary) => return Ok(summary), + }; + let summary = IndexSummary::parse(&raw_data[start..end], source_id)?; + *self = MaybeIndexSummary::Parsed(summary); + match self { + MaybeIndexSummary::Unparsed { .. } => unreachable!(), + MaybeIndexSummary::Parsed(summary) => Ok(summary), + } + } +} + +impl From for MaybeIndexSummary { + fn from(summary: IndexSummary) -> MaybeIndexSummary { + MaybeIndexSummary::Parsed(summary) + } +} + +impl IndexSummary { + /// Parses a line from the registry's index file into an `IndexSummary` for + /// a package. + /// + /// The `line` provided is expected to be valid JSON. + fn parse(line: &[u8], source_id: SourceId) -> CargoResult { + let RegistryPackage { + name, + vers, + cksum, + deps, + features, + yanked, + links, + } = serde_json::from_slice(line)?; + log::trace!("json parsed registry {}/{}", name, vers); + let pkgid = PackageId::new(&name, &vers, source_id)?; + let deps = deps + .into_iter() + .map(|dep| dep.into_dep(source_id)) + .collect::>>()?; + let mut summary = Summary::new(pkgid, deps, &features, links, false)?; + summary.set_checksum(cksum.clone()); + Ok(IndexSummary { + summary, + yanked: yanked.unwrap_or(false), + hash: cksum, + }) + } +} + +fn split<'a>(haystack: &'a [u8], needle: u8) -> impl Iterator + 'a { + struct Split<'a> { + haystack: &'a [u8], + needle: u8, + } + + impl<'a> Iterator for Split<'a> { + type Item = &'a [u8]; + + fn next(&mut self) -> Option<&'a [u8]> { + if self.haystack.is_empty() { + return None; + } + let (ret, remaining) = match memchr::memchr(self.needle, self.haystack) { + Some(pos) => (&self.haystack[..pos], &self.haystack[pos + 1..]), + None => (self.haystack, &[][..]), + }; + self.haystack = remaining; + Some(ret) + } + } + + Split { haystack, needle } +} diff -Nru cargo-0.35.0/src/cargo/sources/registry/local.rs cargo-0.37.0/src/cargo/sources/registry/local.rs --- cargo-0.35.0/src/cargo/sources/registry/local.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/sources/registry/local.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,13 +1,13 @@ -use std::io::prelude::*; -use std::io::SeekFrom; -use std::path::Path; - -use crate::core::PackageId; +use crate::core::{InternedString, PackageId}; use crate::sources::registry::{MaybeLock, RegistryConfig, RegistryData}; use crate::util::errors::{CargoResult, CargoResultExt}; use crate::util::paths; -use crate::util::{Config, FileLock, Filesystem, Sha256}; +use crate::util::{Config, Filesystem, Sha256}; use hex; +use std::fs::File; +use std::io::prelude::*; +use std::io::SeekFrom; +use std::path::Path; pub struct LocalRegistry<'cfg> { index_path: Filesystem, @@ -36,6 +36,16 @@ &self.index_path } + fn assert_index_locked<'a>(&self, path: &'a Filesystem) -> &'a Path { + // Note that the `*_unlocked` variant is used here since we're not + // modifying the index and it's required to be externally synchronized. + path.as_path_unlocked() + } + + fn current_version(&self) -> Option { + None + } + fn load( &self, root: &Path, @@ -71,7 +81,12 @@ fn download(&mut self, pkg: PackageId, checksum: &str) -> CargoResult { let crate_file = format!("{}-{}.crate", pkg.name(), pkg.version()); - let mut crate_file = self.root.open_ro(&crate_file, self.config, "crate file")?; + + // Note that the usage of `into_path_unlocked` here is because the local + // crate files here never change in that we're not the one writing them, + // so it's not our responsibility to synchronize access to them. + let path = self.root.join(&crate_file).into_path_unlocked(); + let mut crate_file = File::open(&path)?; // If we've already got an unpacked version of this crate, then skip the // checksum below as it is in theory already verified. @@ -89,7 +104,7 @@ loop { let n = crate_file .read(&mut buf) - .chain_err(|| format!("failed to read `{}`", crate_file.path().display()))?; + .chain_err(|| format!("failed to read `{}`", path.display()))?; if n == 0 { break; } @@ -109,7 +124,7 @@ _pkg: PackageId, _checksum: &str, _data: &[u8], - ) -> CargoResult { + ) -> CargoResult { panic!("this source doesn't download") } } diff -Nru cargo-0.35.0/src/cargo/sources/registry/mod.rs cargo-0.37.0/src/cargo/sources/registry/mod.rs --- cargo-0.35.0/src/cargo/sources/registry/mod.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/sources/registry/mod.rs 2019-05-15 19:48:47.000000000 +0000 @@ -161,25 +161,25 @@ use std::borrow::Cow; use std::collections::BTreeMap; use std::collections::HashSet; +use std::fs::{File, OpenOptions}; use std::io::Write; use std::path::{Path, PathBuf}; use flate2::read::GzDecoder; use log::debug; -use semver::Version; +use semver::{Version, VersionReq}; use serde::Deserialize; use tar::Archive; use crate::core::dependency::{Dependency, Kind}; use crate::core::source::MaybePackage; -use crate::core::{Package, PackageId, Source, SourceId, Summary}; +use crate::core::{InternedString, Package, PackageId, Source, SourceId, Summary}; use crate::sources::PathSource; use crate::util::errors::CargoResultExt; use crate::util::hex; use crate::util::to_url::ToUrl; -use crate::util::{internal, CargoResult, Config, FileLock, Filesystem}; +use crate::util::{internal, CargoResult, Config, Filesystem}; -const INDEX_LOCK: &str = ".cargo-index-lock"; const PACKAGE_SOURCE_LOCK: &str = ".cargo-ok"; pub const CRATES_IO_INDEX: &str = "https://github.com/rust-lang/crates.io-index"; pub const CRATES_IO_REGISTRY: &str = "crates-io"; @@ -194,7 +194,6 @@ ops: Box, index: index::RegistryIndex<'cfg>, yanked_whitelist: HashSet, - index_locked: bool, } #[derive(Deserialize)] @@ -208,7 +207,7 @@ /// /// For backwards compatibility, if the string does not contain `{crate}` or /// `{version}`, it will be extended with `/{crate}/{version}/download` to - /// support registries like crates.io which were crated before the + /// support registries like crates.io which were created before the /// templating setup was created. pub dl: String, @@ -285,6 +284,7 @@ kind: Option>, registry: Option>, package: Option>, + public: Option, } impl<'a> RegistryDependency<'a> { @@ -300,6 +300,7 @@ kind, registry, package, + public, } = self; let id = if let Some(registry) = ®istry { @@ -324,6 +325,9 @@ None => None, }; + // All dependencies are private by default + let public = public.unwrap_or(false); + // Unfortunately older versions of cargo and/or the registry ended up // publishing lots of entries where the features array contained the // empty feature, "", inside. This confuses the resolution process much @@ -341,7 +345,8 @@ .set_default_features(default_features) .set_features(features) .set_platform(platform) - .set_kind(kind); + .set_kind(kind) + .set_public(public); Ok(dep) } @@ -352,27 +357,25 @@ fn index_path(&self) -> &Filesystem; fn load( &self, - _root: &Path, + root: &Path, path: &Path, data: &mut dyn FnMut(&[u8]) -> CargoResult<()>, ) -> CargoResult<()>; fn config(&mut self) -> CargoResult>; fn update_index(&mut self) -> CargoResult<()>; fn download(&mut self, pkg: PackageId, checksum: &str) -> CargoResult; - fn finish_download( - &mut self, - pkg: PackageId, - checksum: &str, - data: &[u8], - ) -> CargoResult; + fn finish_download(&mut self, pkg: PackageId, checksum: &str, data: &[u8]) + -> CargoResult; fn is_crate_downloaded(&self, _pkg: PackageId) -> bool { true } + fn assert_index_locked<'a>(&self, path: &'a Filesystem) -> &'a Path; + fn current_version(&self) -> Option; } pub enum MaybeLock { - Ready(FileLock), + Ready(File), Download { url: String, descriptor: String }, } @@ -394,14 +397,7 @@ ) -> RegistrySource<'cfg> { let name = short_name(source_id); let ops = remote::RemoteRegistry::new(source_id, config, &name); - RegistrySource::new( - source_id, - config, - &name, - Box::new(ops), - yanked_whitelist, - true, - ) + RegistrySource::new(source_id, config, &name, Box::new(ops), yanked_whitelist) } pub fn local( @@ -412,14 +408,7 @@ ) -> RegistrySource<'cfg> { let name = short_name(source_id); let ops = local::LocalRegistry::new(path, config, &name); - RegistrySource::new( - source_id, - config, - &name, - Box::new(ops), - yanked_whitelist, - false, - ) + RegistrySource::new(source_id, config, &name, Box::new(ops), yanked_whitelist) } fn new( @@ -428,16 +417,14 @@ name: &str, ops: Box, yanked_whitelist: &HashSet, - index_locked: bool, ) -> RegistrySource<'cfg> { RegistrySource { src_path: config.registry_source_path().join(name), config, source_id, updated: false, - index: index::RegistryIndex::new(source_id, ops.index_path(), config, index_locked), + index: index::RegistryIndex::new(source_id, ops.index_path(), config), yanked_whitelist: yanked_whitelist.clone(), - index_locked, ops, } } @@ -453,36 +440,27 @@ /// compiled. /// /// No action is taken if the source looks like it's already unpacked. - fn unpack_package(&self, pkg: PackageId, tarball: &FileLock) -> CargoResult { + fn unpack_package(&self, pkg: PackageId, tarball: &File) -> CargoResult { // The `.cargo-ok` file is used to track if the source is already - // unpacked and to lock the directory for unpacking. - let mut ok = { - let package_dir = format!("{}-{}", pkg.name(), pkg.version()); - let dst = self.src_path.join(&package_dir); - dst.create_dir()?; - - // Attempt to open a read-only copy first to avoid an exclusive write - // lock and also work with read-only filesystems. If the file has - // any data, assume the source is already unpacked. - if let Ok(ok) = dst.open_ro(PACKAGE_SOURCE_LOCK, self.config, &package_dir) { - let meta = ok.file().metadata()?; - if meta.len() > 0 { - let unpack_dir = ok.parent().to_path_buf(); - return Ok(unpack_dir); - } + // unpacked. + let package_dir = format!("{}-{}", pkg.name(), pkg.version()); + let dst = self.src_path.join(&package_dir); + dst.create_dir()?; + let path = dst.join(PACKAGE_SOURCE_LOCK); + let path = self.config.assert_package_cache_locked(&path); + let unpack_dir = path.parent().unwrap(); + if let Ok(meta) = path.metadata() { + if meta.len() > 0 { + return Ok(unpack_dir.to_path_buf()); } - - dst.open_rw(PACKAGE_SOURCE_LOCK, self.config, &package_dir)? - }; - let unpack_dir = ok.parent().to_path_buf(); - - // If the file has any data, assume the source is already unpacked. - let meta = ok.file().metadata()?; - if meta.len() > 0 { - return Ok(unpack_dir); } + let mut ok = OpenOptions::new() + .create(true) + .read(true) + .write(true) + .open(&path)?; - let gz = GzDecoder::new(tarball.file()); + let gz = GzDecoder::new(tarball); let mut tar = Archive::new(gz); let prefix = unpack_dir.file_name().unwrap(); let parent = unpack_dir.parent().unwrap(); @@ -517,27 +495,43 @@ // Write to the lock file to indicate that unpacking was successful. write!(ok, "ok")?; - Ok(unpack_dir) + Ok(unpack_dir.to_path_buf()) } fn do_update(&mut self) -> CargoResult<()> { self.ops.update_index()?; let path = self.ops.index_path(); - self.index = - index::RegistryIndex::new(self.source_id, path, self.config, self.index_locked); + self.index = index::RegistryIndex::new(self.source_id, path, self.config); + self.updated = true; Ok(()) } - fn get_pkg(&mut self, package: PackageId, path: &FileLock) -> CargoResult { + fn get_pkg(&mut self, package: PackageId, path: &File) -> CargoResult { let path = self .unpack_package(package, path) .chain_err(|| internal(format!("failed to unpack package `{}`", package)))?; let mut src = PathSource::new(&path, self.source_id, self.config); src.update()?; - let pkg = match src.download(package)? { + let mut pkg = match src.download(package)? { MaybePackage::Ready(pkg) => pkg, MaybePackage::Download { .. } => unreachable!(), }; + + // After we've loaded the package configure it's summary's `checksum` + // field with the checksum we know for this `PackageId`. + let req = VersionReq::exact(package.version()); + let summary_with_cksum = self + .index + .summaries(package.name(), &req, &mut *self.ops)? + .map(|s| s.summary.clone()) + .next() + .expect("summary not found"); + if let Some(cksum) = summary_with_cksum.checksum() { + pkg.manifest_mut() + .summary_mut() + .set_checksum(cksum.to_string()); + } + Ok(pkg) } } @@ -628,10 +622,17 @@ } fn describe(&self) -> String { - self.source_id.display_registry() + self.source_id.display_index() } fn add_to_yanked_whitelist(&mut self, pkgs: &[PackageId]) { self.yanked_whitelist.extend(pkgs); } + + fn is_yanked(&mut self, pkg: PackageId) -> CargoResult { + if !self.updated { + self.do_update()?; + } + self.index.is_yanked(pkg, &mut *self.ops) + } } diff -Nru cargo-0.35.0/src/cargo/sources/registry/remote.rs cargo-0.37.0/src/cargo/sources/registry/remote.rs --- cargo-0.35.0/src/cargo/sources/registry/remote.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/sources/registry/remote.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,24 +1,20 @@ +use crate::core::{InternedString, PackageId, SourceId}; +use crate::sources::git; +use crate::sources::registry::MaybeLock; +use crate::sources::registry::{RegistryConfig, RegistryData, CRATE_TEMPLATE, VERSION_TEMPLATE}; +use crate::util::errors::{CargoResult, CargoResultExt}; +use crate::util::{Config, Filesystem, Sha256}; +use lazycell::LazyCell; +use log::{debug, trace}; use std::cell::{Cell, Ref, RefCell}; use std::fmt::Write as FmtWrite; +use std::fs::{self, File, OpenOptions}; use std::io::prelude::*; use std::io::SeekFrom; use std::mem; use std::path::Path; use std::str; -use lazycell::LazyCell; -use log::{debug, trace}; - -use crate::core::{PackageId, SourceId}; -use crate::sources::git; -use crate::sources::registry::MaybeLock; -use crate::sources::registry::{ - RegistryConfig, RegistryData, CRATE_TEMPLATE, INDEX_LOCK, VERSION_TEMPLATE, -}; -use crate::util::errors::{CargoResult, CargoResultExt}; -use crate::util::{Config, Sha256}; -use crate::util::{FileLock, Filesystem}; - pub struct RemoteRegistry<'cfg> { index_path: Filesystem, cache_path: Filesystem, @@ -27,6 +23,7 @@ tree: RefCell>>, repo: LazyCell, head: Cell>, + current_sha: Cell>, } impl<'cfg> RemoteRegistry<'cfg> { @@ -39,12 +36,13 @@ tree: RefCell::new(None), repo: LazyCell::new(), head: Cell::new(None), + current_sha: Cell::new(None), } } fn repo(&self) -> CargoResult<&git2::Repository> { self.repo.try_borrow_with(|| { - let path = self.index_path.clone().into_path_unlocked(); + let path = self.config.assert_package_cache_locked(&self.index_path); // Fast path without a lock if let Ok(repo) = git2::Repository::open(&path) { @@ -54,15 +52,11 @@ // Ok, now we need to lock and try the whole thing over again. trace!("acquiring registry index lock"); - let lock = self.index_path.open_rw( - Path::new(INDEX_LOCK), - self.config, - "the registry index", - )?; match git2::Repository::open(&path) { Ok(repo) => Ok(repo), Err(_) => { - let _ = lock.remove_siblings(); + drop(fs::remove_dir_all(&path)); + fs::create_dir_all(&path)?; // Note that we'd actually prefer to use a bare repository // here as we're not actually going to check anything out. @@ -129,6 +123,8 @@ } } +const LAST_UPDATED_FILE: &str = ".last-updated"; + impl<'cfg> RegistryData for RemoteRegistry<'cfg> { fn prepare(&self) -> CargoResult<()> { self.repo()?; // create intermediate dirs and initialize the repo @@ -139,6 +135,19 @@ &self.index_path } + fn assert_index_locked<'a>(&self, path: &'a Filesystem) -> &'a Path { + self.config.assert_package_cache_locked(path) + } + + fn current_version(&self) -> Option { + if let Some(sha) = self.current_sha.get() { + return Some(sha); + } + let sha = InternedString::new(&self.head().ok()?.to_string()); + self.current_sha.set(Some(sha)); + Some(sha) + } + fn load( &self, _root: &Path, @@ -162,9 +171,7 @@ fn config(&mut self) -> CargoResult> { debug!("loading config"); self.prepare()?; - let _lock = - self.index_path - .open_ro(Path::new(INDEX_LOCK), self.config, "the registry index")?; + self.config.assert_package_cache_locked(&self.index_path); let mut config = None; self.load(Path::new(""), Path::new("config.json"), &mut |json| { config = Some(serde_json::from_slice(json)?); @@ -175,12 +182,30 @@ } fn update_index(&mut self) -> CargoResult<()> { - if self.config.cli_unstable().offline { + if self.config.offline() { + if self.repo()?.is_empty()? { + // An empty repository is guaranteed to fail, since hitting + // this path means we need at least one crate. This is an + // attempt to provide a better error message other than "no + // matching package named …". + failure::bail!( + "unable to fetch {} in offline mode\n\ + Try running without the offline flag, or try running \ + `cargo fetch` within your project directory before going offline.", + self.source_id + ); + } return Ok(()); } if self.config.cli_unstable().no_index_update { return Ok(()); } + // Make sure the index is only updated once per session since it is an + // expensive operation. This generally only happens when the resolver + // is run multiple times, such as during `cargo publish`. + if self.config.updated_sources().contains(&self.source_id) { + return Ok(()); + } debug!("updating the index"); @@ -195,12 +220,11 @@ self.prepare()?; self.head.set(None); *self.tree.borrow_mut() = None; - let _lock = - self.index_path - .open_rw(Path::new(INDEX_LOCK), self.config, "the registry index")?; + self.current_sha.set(None); + let path = self.config.assert_package_cache_locked(&self.index_path); self.config .shell() - .status("Updating", self.source_id.display_registry())?; + .status("Updating", self.source_id.display_index())?; // git fetch origin master let url = self.source_id.url(); @@ -208,6 +232,12 @@ let repo = self.repo.borrow_mut().unwrap(); git::fetch(repo, url, refspec, self.config) .chain_err(|| format!("failed to fetch `{}`", url))?; + self.config.updated_sources().insert(self.source_id); + + // Create a dummy file to record the mtime for when we updated the + // index. + File::create(&path.join(LAST_UPDATED_FILE))?; + Ok(()) } @@ -220,8 +250,10 @@ // // If this fails then we fall through to the exclusive path where we may // have to redownload the file. - if let Ok(dst) = self.cache_path.open_ro(&filename, self.config, &filename) { - let meta = dst.file().metadata()?; + let path = self.cache_path.join(&filename); + let path = self.config.assert_package_cache_locked(&path); + if let Ok(dst) = File::open(&path) { + let meta = dst.metadata()?; if meta.len() > 0 { return Ok(MaybeLock::Ready(dst)); } @@ -247,7 +279,7 @@ pkg: PackageId, checksum: &str, data: &[u8], - ) -> CargoResult { + ) -> CargoResult { // Verify what we just downloaded let mut state = Sha256::new(); state.update(data); @@ -256,8 +288,15 @@ } let filename = self.filename(pkg); - let mut dst = self.cache_path.open_rw(&filename, self.config, &filename)?; - let meta = dst.file().metadata()?; + self.cache_path.create_dir()?; + let path = self.cache_path.join(&filename); + let path = self.config.assert_package_cache_locked(&path); + let mut dst = OpenOptions::new() + .create(true) + .read(true) + .write(true) + .open(&path)?; + let meta = dst.metadata()?; if meta.len() > 0 { return Ok(dst); } @@ -271,8 +310,10 @@ let filename = format!("{}-{}.crate", pkg.name(), pkg.version()); let path = Path::new(&filename); - if let Ok(dst) = self.cache_path.open_ro(path, self.config, &filename) { - if let Ok(meta) = dst.file().metadata() { + let path = self.cache_path.join(path); + let path = self.config.assert_package_cache_locked(&path); + if let Ok(dst) = File::open(path) { + if let Ok(meta) = dst.metadata() { return meta.len() > 0; } } diff -Nru cargo-0.35.0/src/cargo/sources/replaced.rs cargo-0.37.0/src/cargo/sources/replaced.rs --- cargo-0.35.0/src/cargo/sources/replaced.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/sources/replaced.rs 2019-05-15 19:48:47.000000000 +0000 @@ -115,8 +115,14 @@ } fn add_to_yanked_whitelist(&mut self, pkgs: &[PackageId]) { - let pkgs = pkgs.iter().map(|id| id.with_source_id(self.replace_with)) + let pkgs = pkgs + .iter() + .map(|id| id.with_source_id(self.replace_with)) .collect::>(); self.inner.add_to_yanked_whitelist(&pkgs); } + + fn is_yanked(&mut self, pkg: PackageId) -> CargoResult { + self.inner.is_yanked(pkg) + } } diff -Nru cargo-0.35.0/src/cargo/util/command_prelude.rs cargo-0.37.0/src/cargo/util/command_prelude.rs --- cargo-0.35.0/src/cargo/util/command_prelude.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/command_prelude.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,3 +1,4 @@ +use std::ffi::{OsStr, OsString}; use std::fs; use std::path::PathBuf; @@ -141,7 +142,10 @@ } fn arg_build_plan(self) -> Self { - self._arg(opt("build-plan", "Output the build plan in JSON")) + self._arg(opt( + "build-plan", + "Output the build plan in JSON (unstable)", + )) } fn arg_new_opts(self) -> Self { @@ -315,10 +319,10 @@ build_config.message_format = message_format; build_config.release = self._is_present("release"); build_config.build_plan = self._is_present("build-plan"); - if build_config.build_plan && !config.cli_unstable().unstable_options { - Err(failure::format_err!( - "`--build-plan` flag is unstable, pass `-Z unstable-options` to enable it" - ))?; + if build_config.build_plan { + config + .cli_unstable() + .fail_if_stable_opt("--build-plan", 5579)?; }; let opts = CompileOptions { @@ -328,7 +332,7 @@ all_features: self._is_present("all-features"), no_default_features: self._is_present("no-default-features"), spec, - filter: CompileFilter::new( + filter: CompileFilter::from_raw_arguments( self._is_present("lib"), self._values_of("bin"), self._is_present("bins"), @@ -434,19 +438,19 @@ compile_opts: &CompileOptions<'_>, ) -> CargoResult<()> { if self.is_present_with_zero_values("example") { - print_available_examples(&workspace, &compile_opts)?; + print_available_examples(workspace, compile_opts)?; } if self.is_present_with_zero_values("bin") { - print_available_binaries(&workspace, &compile_opts)?; + print_available_binaries(workspace, compile_opts)?; } if self.is_present_with_zero_values("bench") { - print_available_benches(&workspace, &compile_opts)?; + print_available_benches(workspace, compile_opts)?; } if self.is_present_with_zero_values("test") { - print_available_tests(&workspace, &compile_opts)?; + print_available_tests(workspace, compile_opts)?; } Ok(()) @@ -460,6 +464,10 @@ fn _values_of(&self, name: &str) -> Vec; + fn _value_of_os(&self, name: &str) -> Option<&OsStr>; + + fn _values_of_os(&self, name: &str) -> Vec; + fn _is_present(&self, name: &str) -> bool; } @@ -468,6 +476,10 @@ self.value_of(name) } + fn _value_of_os(&self, name: &str) -> Option<&OsStr> { + self.value_of_os(name) + } + fn _values_of(&self, name: &str) -> Vec { self.values_of(name) .unwrap_or_default() @@ -475,16 +487,24 @@ .collect() } + fn _values_of_os(&self, name: &str) -> Vec { + self.values_of_os(name) + .unwrap_or_default() + .map(|s| s.to_os_string()) + .collect() + } + fn _is_present(&self, name: &str) -> bool { self.is_present(name) } } pub fn values(args: &ArgMatches<'_>, name: &str) -> Vec { - args.values_of(name) - .unwrap_or_default() - .map(|s| s.to_string()) - .collect() + args._values_of(name) +} + +pub fn values_os(args: &ArgMatches<'_>, name: &str) -> Vec { + args._values_of_os(name) } #[derive(PartialEq, PartialOrd, Eq, Ord)] diff -Nru cargo-0.35.0/src/cargo/util/config.rs cargo-0.37.0/src/cargo/util/config.rs --- cargo-0.35.0/src/cargo/util/config.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/config.rs 2019-05-15 19:48:47.000000000 +0000 @@ -6,7 +6,7 @@ use std::fmt; use std::fs::{self, File}; use std::io::prelude::*; -use std::io::SeekFrom; +use std::io::{self, SeekFrom}; use std::mem; use std::path::{Path, PathBuf}; use std::str::FromStr; @@ -20,17 +20,17 @@ use serde::{de, de::IntoDeserializer}; use url::Url; +use self::ConfigValue as CV; use crate::core::profiles::ConfigProfiles; use crate::core::shell::Verbosity; use crate::core::{CliUnstable, Shell, SourceId, Workspace}; use crate::ops; -use crate::util::errors::{internal, CargoResult, CargoResultExt}; +use crate::util::errors::{self, internal, CargoResult, CargoResultExt}; use crate::util::toml as cargo_toml; use crate::util::Filesystem; use crate::util::Rustc; -use crate::util::ToUrl; -use crate::util::{paths, validate_package_name}; -use self::ConfigValue as CV; +use crate::util::{paths, validate_package_name, FileLock}; +use crate::util::{ToUrl, ToUrlWithBase}; /// Configuration information for cargo. This is not specific to a build, it is information /// relating to cargo itself. @@ -52,10 +52,15 @@ rustdoc: LazyCell, /// Whether we are printing extra verbose messages extra_verbose: bool, - /// `frozen` is set if we shouldn't access the network + /// `frozen` is the same as `locked`, but additionally will not access the + /// network to determine if the lock file is out-of-date. frozen: bool, - /// `locked` is set if we should not update lock files + /// `locked` is set if we should not update lock files. If the lock file + /// is missing, or needs to be updated, an error is produced. locked: bool, + /// `offline` is set if we should never access the network, but otherwise + /// continue operating if possible. + offline: bool, /// A global static IPC control mechanism (used for managing parallel builds) jobserver: Option, /// Cli flags of the form "-Z something" @@ -74,6 +79,11 @@ env: HashMap, /// Profiles loaded from config. profiles: LazyCell, + /// Tracks which sources have been updated to avoid multiple updates. + updated_sources: LazyCell>>, + /// Lock, if held, of the global package cache along with the number of + /// acquisitions so far. + package_cache_lock: RefCell>, } impl Config { @@ -114,6 +124,7 @@ extra_verbose: false, frozen: false, locked: false, + offline: false, jobserver: unsafe { if GLOBAL_JOBSERVER.is_null() { None @@ -129,6 +140,8 @@ target_dir: None, env, profiles: LazyCell::new(), + updated_sources: LazyCell::new(), + package_cache_lock: RefCell::new(None), } } @@ -191,15 +204,16 @@ } /// Gets the path to the `rustc` executable. - pub fn rustc(&self, ws: Option<&Workspace<'_>>) -> CargoResult { + pub fn load_global_rustc(&self, ws: Option<&Workspace<'_>>) -> CargoResult { let cache_location = ws.map(|ws| { ws.target_dir() .join(".rustc_info.json") .into_path_unlocked() }); + let wrapper = self.maybe_get_tool("rustc_wrapper")?; Rustc::new( self.get_tool("rustc")?, - self.maybe_get_tool("rustc_wrapper")?, + wrapper, &self .home() .join("bin") @@ -270,6 +284,12 @@ }) } + pub fn updated_sources(&self) -> RefMut<'_, HashSet> { + self.updated_sources + .borrow_with(|| RefCell::new(HashSet::new())) + .borrow_mut() + } + pub fn values(&self) -> CargoResult<&HashMap> { self.values.try_borrow_with(|| self.load_values()) } @@ -285,9 +305,8 @@ } } - pub fn reload_rooted_at_cargo_home(&mut self) -> CargoResult<()> { - let home = self.home_path.clone().into_path_unlocked(); - let values = self.load_values_from(&home)?; + pub fn reload_rooted_at>(&mut self, path: P) -> CargoResult<()> { + let values = self.load_values_from(path.as_ref())?; self.values.replace(values); Ok(()) } @@ -547,6 +566,7 @@ color: &Option, frozen: bool, locked: bool, + offline: bool, target_dir: &Option, unstable_flags: &[String], ) -> CargoResult<()> { @@ -591,6 +611,11 @@ self.extra_verbose = extra_verbose; self.frozen = frozen; self.locked = locked; + self.offline = offline + || self + .get::>("net.offline") + .unwrap_or(None) + .unwrap_or(false); self.target_dir = cli_target_dir; self.cli_flags.parse(unstable_flags)?; @@ -606,7 +631,11 @@ } pub fn network_allowed(&self) -> bool { - !self.frozen() && !self.cli_unstable().offline + !self.frozen() && !self.offline() + } + + pub fn offline(&self) -> bool { + self.offline } pub fn frozen(&self) -> bool { @@ -658,18 +687,34 @@ validate_package_name(registry, "registry name", "")?; Ok( match self.get_string(&format!("registries.{}.index", registry))? { - Some(index) => { - let url = index.val.to_url()?; - if url.password().is_some() { - failure::bail!("Registry URLs may not contain passwords"); - } - url - } + Some(index) => self.resolve_registry_index(index)?, None => failure::bail!("No index found for registry: `{}`", registry), }, ) } + /// Gets the index for the default registry. + pub fn get_default_registry_index(&self) -> CargoResult> { + Ok(match self.get_string("registry.index")? { + Some(index) => Some(self.resolve_registry_index(index)?), + None => None, + }) + } + + fn resolve_registry_index(&self, index: Value) -> CargoResult { + let base = index + .definition + .root(&self) + .join("truncated-by-url_with_base"); + // Parse val to check it is a URL, not a relative path without a protocol. + let _parsed = index.val.to_url()?; + let url = index.val.to_url_with_base(Some(&*base))?; + if url.password().is_some() { + failure::bail!("Registry URLs may not contain passwords"); + } + Ok(url) + } + /// Loads credentials config from the credentials file into the `ConfigValue` object, if /// present. fn load_credentials(&self, cfg: &mut ConfigValue) -> CargoResult<()> { @@ -756,7 +801,7 @@ /// Looks for a path for `tool` in an environment variable or config path, defaulting to `tool` /// as a path. - fn get_tool(&self, tool: &str) -> CargoResult { + pub fn get_tool(&self, tool: &str) -> CargoResult { self.maybe_get_tool(tool) .map(|t| t.unwrap_or_else(|| PathBuf::from(tool))) } @@ -803,6 +848,86 @@ }; T::deserialize(d).map_err(|e| e.into()) } + + pub fn assert_package_cache_locked<'a>(&self, f: &'a Filesystem) -> &'a Path { + let ret = f.as_path_unlocked(); + assert!( + self.package_cache_lock.borrow().is_some(), + "pacakge cache lock is not currently held, Cargo forgot to call \ + `acquire_package_cache_lock` before we got to this stack frame", + ); + assert!(ret.starts_with(self.home_path.as_path_unlocked())); + return ret; + } + + /// Acquires an exclusive lock on the global "package cache" + /// + /// This lock is global per-process and can be acquired recursively. An RAII + /// structure is returned to release the lock, and if this process + /// abnormally terminates the lock is also released. + pub fn acquire_package_cache_lock<'a>(&'a self) -> CargoResult> { + let mut slot = self.package_cache_lock.borrow_mut(); + match *slot { + // We've already acquired the lock in this process, so simply bump + // the count and continue. + Some((_, ref mut cnt)) => { + *cnt += 1; + } + None => { + let path = ".package-cache"; + let desc = "package cache lock"; + + // First, attempt to open an exclusive lock which is in general + // the purpose of this lock! + // + // If that fails because of a readonly filesystem, though, then + // we don't want to fail because it's a readonly filesystem. In + // some situations Cargo is prepared to have a readonly + // filesystem yet still work since it's all been pre-downloaded + // and/or pre-unpacked. In these situations we want to keep + // Cargo running if possible, so if it's a readonly filesystem + // switch to a shared lock which should hopefully succeed so we + // can continue. + // + // Note that the package cache lock protects files in the same + // directory, so if it's a readonly filesystem we assume that + // the entire package cache is readonly, so we're just acquiring + // something to prove it works, we're not actually doing any + // synchronization at that point. + match self.home_path.open_rw(path, self, desc) { + Ok(lock) => *slot = Some((lock, 1)), + Err(e) => { + if maybe_readonly(&e) { + if let Ok(lock) = self.home_path.open_ro(path, self, desc) { + *slot = Some((lock, 1)); + return Ok(PackageCacheLock(self)); + } + } + + Err(e).chain_err(|| "failed to acquire package cache lock")?; + } + } + } + } + return Ok(PackageCacheLock(self)); + + fn maybe_readonly(err: &failure::Error) -> bool { + err.iter_chain().any(|err| { + if let Some(io) = err.downcast_ref::() { + if io.kind() == io::ErrorKind::PermissionDenied { + return true; + } + + #[cfg(unix)] + return io.raw_os_error() == Some(libc::EROFS); + } + + false + }) + } + } + + pub fn release_package_cache_lock(&self) {} } /// A segment of a config key. @@ -924,8 +1049,7 @@ } } -impl std::error::Error for ConfigError { -} +impl std::error::Error for ConfigError {} // Future note: currently, we cannot override `Fail::cause` (due to // specialization) so we have no way to return the underlying causes. In the @@ -933,12 +1057,7 @@ // `cause` and avoid doing the cause formatting here. impl fmt::Display for ConfigError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let message = self - .error - .iter_chain() - .map(|e| e.to_string()) - .collect::>() - .join("\nCaused by:\n "); + let message = errors::display_causes(&self.error); if let Some(ref definition) = self.definition { write!(f, "error in {}: {}", definition, message) } else { @@ -1645,3 +1764,16 @@ Ok(()) } } + +pub struct PackageCacheLock<'a>(&'a Config); + +impl Drop for PackageCacheLock<'_> { + fn drop(&mut self) { + let mut slot = self.0.package_cache_lock.borrow_mut(); + let (_, cnt) = slot.as_mut().unwrap(); + *cnt -= 1; + if *cnt == 0 { + *slot = None; + } + } +} diff -Nru cargo-0.35.0/src/cargo/util/dependency_queue.rs cargo-0.37.0/src/cargo/util/dependency_queue.rs --- cargo-0.35.0/src/cargo/util/dependency_queue.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/dependency_queue.rs 2019-05-15 19:48:47.000000000 +0000 @@ -3,103 +3,80 @@ //! //! This structure is used to store the dependency graph and dynamically update //! it to figure out when a dependency should be built. +//! +//! Dependencies in this queue are represented as a (node, edge) pair. This is +//! used to model nodes which produce multiple outputs at different times but +//! some nodes may only require one of the outputs and can start before the +//! whole node is finished. -use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::collections::{HashMap, HashSet}; use std::hash::Hash; -pub use self::Freshness::{Dirty, Fresh}; - #[derive(Debug)] -pub struct DependencyQueue { +pub struct DependencyQueue { /// A list of all known keys to build. /// /// The value of the hash map is list of dependencies which still need to be /// built before the package can be built. Note that the set is dynamically /// updated as more dependencies are built. - dep_map: HashMap, V)>, + dep_map: HashMap, V)>, /// A reverse mapping of a package to all packages that depend on that /// package. /// /// This map is statically known and does not get updated throughout the /// lifecycle of the DependencyQueue. - reverse_dep_map: HashMap>, - - /// A set of dirty packages. /// - /// Packages may become dirty over time if their dependencies are rebuilt. - dirty: HashSet, - - /// The packages which are currently being built, waiting for a call to - /// `finish`. - pending: HashSet, + /// This is sort of like a `HashMap<(N, E), HashSet>` map, but more + /// easily indexable with just an `N` + reverse_dep_map: HashMap>>, /// Topological depth of each key - depth: HashMap, -} - -/// Indication of the freshness of a package. -/// -/// A fresh package does not necessarily need to be rebuilt (unless a dependency -/// was also rebuilt), and a dirty package must always be rebuilt. -#[derive(PartialEq, Eq, Debug, Clone, Copy)] -pub enum Freshness { - Fresh, - Dirty, -} - -impl Freshness { - pub fn combine(self, other: Freshness) -> Freshness { - match self { - Fresh => other, - Dirty => Dirty, - } - } + depth: HashMap, } -impl Default for DependencyQueue { - fn default() -> DependencyQueue { +impl Default for DependencyQueue { + fn default() -> DependencyQueue { DependencyQueue::new() } } -impl DependencyQueue { +impl DependencyQueue { /// Creates a new dependency queue with 0 packages. - pub fn new() -> DependencyQueue { + pub fn new() -> DependencyQueue { DependencyQueue { dep_map: HashMap::new(), reverse_dep_map: HashMap::new(), - dirty: HashSet::new(), - pending: HashSet::new(), depth: HashMap::new(), } } +} - /// Adds a new package to this dependency queue. +impl DependencyQueue { + /// Adds a new ndoe and its dependencies to this queue. /// - /// It is assumed that any dependencies of this package will eventually also - /// be added to the dependency queue. - pub fn queue(&mut self, fresh: Freshness, key: &K, value: V, dependencies: &[K]) -> &mut V { - let slot = match self.dep_map.entry(key.clone()) { - Occupied(v) => return &mut v.into_mut().1, - Vacant(v) => v, - }; - - if fresh == Dirty { - self.dirty.insert(key.clone()); - } + /// The `key` specified is a new node in the dependency graph, and the node + /// depend on all the dependencies iterated by `dependencies`. Each + /// dependency is a node/edge pair, where edges can be thought of as + /// productions from nodes (aka if it's just `()` it's just waiting for the + /// node to finish). + /// + /// An optional `value` can also be associated with `key` which is reclaimed + /// when the node is ready to go. + pub fn queue(&mut self, key: N, value: V, dependencies: impl IntoIterator) { + assert!(!self.dep_map.contains_key(&key)); let mut my_dependencies = HashSet::new(); - for dep in dependencies { - my_dependencies.insert(dep.clone()); - let rev = self - .reverse_dep_map - .entry(dep.clone()) - .or_insert_with(HashSet::new); - rev.insert(key.clone()); + for (dep, edge) in dependencies { + my_dependencies.insert((dep.clone(), edge.clone())); + self.reverse_dep_map + .entry(dep) + .or_insert_with(HashMap::new) + .entry(edge) + .or_insert_with(HashSet::new) + .insert(key.clone()); } - &mut slot.insert((my_dependencies, value)).1 + self.dep_map.insert(key, (my_dependencies, value)); } /// All nodes have been added, calculate some internal metadata and prepare @@ -109,10 +86,10 @@ depth(key, &self.reverse_dep_map, &mut self.depth); } - fn depth( - key: &K, - map: &HashMap>, - results: &mut HashMap, + fn depth( + key: &N, + map: &HashMap>>, + results: &mut HashMap, ) -> usize { const IN_PROGRESS: usize = !0; @@ -124,9 +101,10 @@ results.insert(key.clone(), IN_PROGRESS); let depth = 1 + map - .get(&key) + .get(key) .into_iter() - .flat_map(|it| it) + .flat_map(|it| it.values()) + .flat_map(|set| set) .map(|dep| depth(dep, map, results)) .max() .unwrap_or(0); @@ -141,7 +119,7 @@ /// /// A package is ready to be built when it has 0 un-built dependencies. If /// `None` is returned then no packages are ready to be built. - pub fn dequeue(&mut self) -> Option<(Freshness, K, V)> { + pub fn dequeue(&mut self) -> Option<(N, V)> { // Look at all our crates and find everything that's ready to build (no // deps). After we've got that candidate set select the one which has // the maximum depth in the dependency graph. This way we should @@ -155,7 +133,7 @@ let next = self .dep_map .iter() - .filter(|&(_, &(ref deps, _))| deps.is_empty()) + .filter(|(_, (deps, _))| deps.is_empty()) .map(|(key, _)| key.clone()) .max_by_key(|k| self.depth[k]); let key = match next { @@ -163,71 +141,64 @@ None => return None, }; let (_, data) = self.dep_map.remove(&key).unwrap(); - let fresh = if self.dirty.contains(&key) { - Dirty - } else { - Fresh - }; - self.pending.insert(key.clone()); - Some((fresh, key, data)) + Some((key, data)) } /// Returns `true` if there are remaining packages to be built. pub fn is_empty(&self) -> bool { - self.dep_map.is_empty() && self.pending.is_empty() + self.dep_map.is_empty() } /// Returns the number of remaining packages to be built. pub fn len(&self) -> usize { - self.dep_map.len() + self.pending.len() + self.dep_map.len() } - /// Indicate that a package has been built. + /// Indicate that something has finished. /// - /// This function will update the dependency queue with this information, - /// possibly allowing the next invocation of `dequeue` to return a package. - pub fn finish(&mut self, key: &K, fresh: Freshness) { - assert!(self.pending.remove(key)); - let reverse_deps = match self.reverse_dep_map.get(key) { + /// Calling this function indicates that the `node` has produced `edge`. All + /// remaining work items which only depend on this node/edge pair are now + /// candidates to start their job. + pub fn finish(&mut self, node: &N, edge: &E) { + let reverse_deps = self.reverse_dep_map.get(node).and_then(|map| map.get(edge)); + let reverse_deps = match reverse_deps { Some(deps) => deps, None => return, }; + let key = (node.clone(), edge.clone()); for dep in reverse_deps.iter() { - if fresh == Dirty { - self.dirty.insert(dep.clone()); - } - assert!(self.dep_map.get_mut(dep).unwrap().0.remove(key)); + assert!(self.dep_map.get_mut(dep).unwrap().0.remove(&key)); } } } #[cfg(test)] mod test { - use super::{DependencyQueue, Freshness}; + use super::DependencyQueue; #[test] fn deep_first() { let mut q = DependencyQueue::new(); - q.queue(Freshness::Fresh, &1, (), &[]); - q.queue(Freshness::Fresh, &2, (), &[1]); - q.queue(Freshness::Fresh, &3, (), &[]); - q.queue(Freshness::Fresh, &4, (), &[2, 3]); - q.queue(Freshness::Fresh, &5, (), &[4, 3]); + q.queue(1, (), vec![]); + q.queue(2, (), vec![(1, ())]); + q.queue(3, (), vec![]); + q.queue(4, (), vec![(2, ()), (3, ())]); + q.queue(5, (), vec![(4, ()), (3, ())]); q.queue_finished(); - assert_eq!(q.dequeue(), Some((Freshness::Fresh, 1, ()))); - assert_eq!(q.dequeue(), Some((Freshness::Fresh, 3, ()))); + assert_eq!(q.dequeue(), Some((1, ()))); + assert_eq!(q.dequeue(), Some((3, ()))); assert_eq!(q.dequeue(), None); - q.finish(&3, Freshness::Fresh); + q.finish(&3, &()); assert_eq!(q.dequeue(), None); - q.finish(&1, Freshness::Fresh); - assert_eq!(q.dequeue(), Some((Freshness::Fresh, 2, ()))); + q.finish(&1, &()); + assert_eq!(q.dequeue(), Some((2, ()))); assert_eq!(q.dequeue(), None); - q.finish(&2, Freshness::Fresh); - assert_eq!(q.dequeue(), Some((Freshness::Fresh, 4, ()))); + q.finish(&2, &()); + assert_eq!(q.dequeue(), Some((4, ()))); assert_eq!(q.dequeue(), None); - q.finish(&4, Freshness::Fresh); - assert_eq!(q.dequeue(), Some((Freshness::Fresh, 5, ()))); + q.finish(&4, &()); + assert_eq!(q.dequeue(), Some((5, ()))); } } diff -Nru cargo-0.35.0/src/cargo/util/diagnostic_server.rs cargo-0.37.0/src/cargo/util/diagnostic_server.rs --- cargo-0.35.0/src/cargo/util/diagnostic_server.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/diagnostic_server.rs 2019-05-15 19:48:47.000000000 +0000 @@ -174,7 +174,7 @@ then you can re-enable the `edition` key in `Cargo.toml`. For some more information about transitioning to the {0} edition see: - https://rust-lang-nursery.github.io/edition-guide/editions/transitioning-an-existing-project-to-a-new-edition.html + https://doc.rust-lang.org/edition-guide/editions/transitioning-an-existing-project-to-a-new-edition.html ", edition, file, @@ -200,7 +200,7 @@ `Cargo.toml` and then rerunning this command; a more detailed transition guide can be found at - https://rust-lang-nursery.github.io/edition-guide/editions/transitioning-an-existing-project-to-a-new-edition.html + https://doc.rust-lang.org/edition-guide/editions/transitioning-an-existing-project-to-a-new-edition.html ", idioms, file, diff -Nru cargo-0.35.0/src/cargo/util/errors.rs cargo-0.37.0/src/cargo/util/errors.rs --- cargo-0.35.0/src/cargo/util/errors.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/errors.rs 2019-05-15 19:48:47.000000000 +0000 @@ -10,6 +10,7 @@ use log::trace; use crate::core::{TargetKind, Workspace}; +use crate::ops::CompileOptions; pub type CargoResult = failure::Fallible; // Alex's body isn't quite ready to give up "Result" @@ -188,14 +189,14 @@ } } - pub fn hint(&self, ws: &Workspace<'_>) -> String { + pub fn hint(&self, ws: &Workspace<'_>, opts: &CompileOptions<'_>) -> String { match self.test { Test::UnitTest { ref kind, ref name, ref pkg_name, } => { - let pkg_info = if ws.members().count() > 1 && ws.is_virtual() { + let pkg_info = if opts.spec.needs_spec_flag(ws) { format!("-p {} ", pkg_name) } else { String::new() @@ -387,3 +388,11 @@ fn _internal(error: &dyn fmt::Display) -> failure::Error { Internal::new(failure::format_err!("{}", error)).into() } + +pub fn display_causes(error: &Error) -> String { + error + .iter_chain() + .map(|e| e.to_string()) + .collect::>() + .join("\nCaused by:\n ") +} diff -Nru cargo-0.35.0/src/cargo/util/flock.rs cargo-0.37.0/src/cargo/util/flock.rs --- cargo-0.35.0/src/cargo/util/flock.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/flock.rs 2019-05-15 19:48:47.000000000 +0000 @@ -12,6 +12,7 @@ use crate::util::paths; use crate::util::Config; +#[derive(Debug)] pub struct FileLock { f: Option, path: PathBuf, @@ -136,6 +137,14 @@ self.root } + /// Returns the underlying `Path`. + /// + /// Note that this is a relatively dangerous operation and should be used + /// with great caution!. + pub fn as_path_unlocked(&self) -> &Path { + &self.root + } + /// Creates the directory pointed to by this filesystem. /// /// Handles errors where other Cargo processes are also attempting to @@ -312,8 +321,27 @@ let msg = format!("waiting for file lock on {}", msg); config.shell().status_with_color("Blocking", &msg, Cyan)?; - block().chain_err(|| format!("failed to lock file: {}", path.display()))?; - return Ok(()); + // We're about to block the current process and not really do anything + // productive for what could possibly be a very long time. We could be + // waiting, for example, on another Cargo to finish a download, finish an + // entire build, etc. Since we're not doing anything productive we're not + // making good use of our jobserver token, if we have one. + // + // This can typically come about if `cargo` is invoked from `make` (or some + // other jobserver-providing system). In this situation it's actually best + // if we release the token back to the original jobserver to let some other + // cpu-hungry work continue to make progress. After we're done blocking + // we'll block waiting to reacquire a token as we'll probably be doing cpu + // hungry work ourselves. + let jobserver = config.jobserver_from_env(); + if let Some(server) = jobserver { + server.release_raw()?; + } + let result = block().chain_err(|| format!("failed to lock file: {}", path.display())); + if let Some(server) = jobserver { + server.acquire_raw()?; + } + return Ok(result?); #[cfg(all(target_os = "linux", not(target_env = "musl")))] fn is_on_nfs_mount(path: &Path) -> bool { diff -Nru cargo-0.35.0/src/cargo/util/graph.rs cargo-0.37.0/src/cargo/util/graph.rs --- cargo-0.35.0/src/cargo/util/graph.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/graph.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,27 +1,28 @@ use std::borrow::Borrow; -use std::collections::{HashMap, HashSet}; +use std::collections::BTreeSet; use std::fmt; -use std::hash::Hash; -pub struct Graph { - nodes: HashMap>, +use im_rc; + +pub struct Graph { + nodes: im_rc::OrdMap>, } -impl Graph { +impl Graph { pub fn new() -> Graph { Graph { - nodes: HashMap::new(), + nodes: im_rc::OrdMap::new(), } } pub fn add(&mut self, node: N) { - self.nodes.entry(node).or_insert_with(HashMap::new); + self.nodes.entry(node).or_insert_with(im_rc::OrdMap::new); } pub fn link(&mut self, node: N, child: N) -> &mut E { self.nodes .entry(node) - .or_insert_with(HashMap::new) + .or_insert_with(im_rc::OrdMap::new) .entry(child) .or_insert_with(Default::default) } @@ -29,7 +30,7 @@ pub fn contains(&self, k: &Q) -> bool where N: Borrow, - Q: Hash + Eq, + Q: Ord + Eq, { self.nodes.contains_key(k) } @@ -38,14 +39,14 @@ self.nodes.get(from)?.get(to) } - pub fn edges(&self, from: &N) -> impl Iterator { + pub fn edges(&self, from: &N) -> impl Iterator { self.nodes.get(from).into_iter().flat_map(|x| x.iter()) } /// A topological sort of the `Graph` pub fn sort(&self) -> Vec { let mut ret = Vec::new(); - let mut marks = HashSet::new(); + let mut marks = BTreeSet::new(); for node in self.nodes.keys() { self.sort_inner_visit(node, &mut ret, &mut marks); @@ -54,7 +55,7 @@ ret } - fn sort_inner_visit(&self, node: &N, dst: &mut Vec, marks: &mut HashSet) { + fn sort_inner_visit(&self, node: &N, dst: &mut Vec, marks: &mut BTreeSet) { if !marks.insert(node.clone()) { return; } @@ -70,6 +71,41 @@ self.nodes.keys() } + /// Checks if there is a path from `from` to `to`. + pub fn is_path_from_to<'a>(&'a self, from: &'a N, to: &'a N) -> bool { + let mut stack = vec![from]; + let mut seen = BTreeSet::new(); + seen.insert(from); + while let Some(iter) = stack.pop().and_then(|p| self.nodes.get(p)) { + for p in iter.keys() { + if p == to { + return true; + } + if seen.insert(p) { + stack.push(p); + } + } + } + false + } + + /// Resolves one of the paths from the given dependent package down to + /// a leaf. + pub fn path_to_bottom<'a>(&'a self, mut pkg: &'a N) -> Vec<&'a N> { + let mut result = vec![pkg]; + while let Some(p) = self.nodes.get(pkg).and_then(|p| { + p.iter() + // Note that we can have "cycles" introduced through dev-dependency + // edges, so make sure we don't loop infinitely. + .find(|&(node, _)| !result.contains(&node)) + .map(|(ref p, _)| p) + }) { + result.push(p); + pkg = p; + } + result + } + /// Resolves one of the paths from the given dependent package up to /// the root. pub fn path_to_top<'a>(&'a self, mut pkg: &'a N) -> Vec<&'a N> { @@ -84,7 +120,7 @@ // Note that we can have "cycles" introduced through dev-dependency // edges, so make sure we don't loop infinitely. .find(|&(node, _)| !res.contains(&node)) - .map(|p| p.0) + .map(|(ref p, _)| p) }; while let Some(p) = first_pkg_depending_on(pkg, &result) { result.push(p); @@ -94,13 +130,13 @@ } } -impl Default for Graph { +impl Default for Graph { fn default() -> Graph { Graph::new() } } -impl fmt::Debug for Graph { +impl fmt::Debug for Graph { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { writeln!(fmt, "Graph {{")?; @@ -118,14 +154,14 @@ } } -impl PartialEq for Graph { +impl PartialEq for Graph { fn eq(&self, other: &Graph) -> bool { self.nodes.eq(&other.nodes) } } -impl Eq for Graph {} +impl Eq for Graph {} -impl Clone for Graph { +impl Clone for Graph { fn clone(&self) -> Graph { Graph { nodes: self.nodes.clone(), diff -Nru cargo-0.35.0/src/cargo/util/hex.rs cargo-0.37.0/src/cargo/util/hex.rs --- cargo-0.35.0/src/cargo/util/hex.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/hex.rs 2019-05-15 19:48:47.000000000 +0000 @@ -16,7 +16,7 @@ ]) } -pub fn hash_u64(hashable: &H) -> u64 { +pub fn hash_u64(hashable: H) -> u64 { let mut hasher = SipHasher::new_with_keys(0, 0); hashable.hash(&mut hasher); hasher.finish() diff -Nru cargo-0.35.0/src/cargo/util/machine_message.rs cargo-0.37.0/src/cargo/util/machine_message.rs --- cargo-0.35.0/src/cargo/util/machine_message.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/machine_message.rs 2019-05-15 19:48:47.000000000 +0000 @@ -8,13 +8,13 @@ pub trait Message: ser::Serialize { fn reason(&self) -> &str; -} -pub fn emit(t: &T) { - let json = serde_json::to_string(t).unwrap(); - assert!(json.starts_with("{\"")); - let reason = json!(t.reason()); - println!("{{\"reason\":{},{}", reason, &json[1..]); + fn to_json_string(&self) -> String { + let json = serde_json::to_string(self).unwrap(); + assert!(json.starts_with("{\"")); + let reason = json!(self.reason()); + format!("{{\"reason\":{},{}", reason, &json[1..]) + } } #[derive(Serialize)] diff -Nru cargo-0.35.0/src/cargo/util/mod.rs cargo-0.37.0/src/cargo/util/mod.rs --- cargo-0.35.0/src/cargo/util/mod.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/mod.rs 2019-05-15 19:48:47.000000000 +0000 @@ -2,7 +2,7 @@ pub use self::cfg::{Cfg, CfgExpr}; pub use self::config::{homedir, Config, ConfigValue}; -pub use self::dependency_queue::{DependencyQueue, Dirty, Fresh, Freshness}; +pub use self::dependency_queue::DependencyQueue; pub use self::diagnostic_server::RustfixDiagnosticServer; pub use self::errors::{internal, process_error}; pub use self::errors::{CargoResult, CargoResultExt, CliResult, Test}; @@ -21,6 +21,7 @@ pub use self::sha256::Sha256; pub use self::to_semver::ToSemver; pub use self::to_url::ToUrl; +pub use self::to_url_with_base::ToUrlWithBase; pub use self::vcs::{existing_vcs_repo, FossilRepo, GitRepo, HgRepo, PijulRepo}; pub use self::workspace::{ print_available_benches, print_available_binaries, print_available_examples, @@ -47,10 +48,11 @@ pub mod profile; mod progress; mod read2; -mod rustc; +pub mod rustc; mod sha256; pub mod to_semver; pub mod to_url; +mod to_url_with_base; pub mod toml; mod vcs; mod workspace; diff -Nru cargo-0.35.0/src/cargo/util/network.rs cargo-0.37.0/src/cargo/util/network.rs --- cargo-0.35.0/src/cargo/util/network.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/network.rs 2019-05-15 19:48:47.000000000 +0000 @@ -50,6 +50,7 @@ || curl_err.is_couldnt_resolve_host() || curl_err.is_operation_timedout() || curl_err.is_recv_error() + || curl_err.is_http2_stream_error() { return true; } @@ -125,3 +126,10 @@ let result = with_retry(&config, || results.pop().unwrap()); assert_eq!(result.unwrap(), ()) } + +#[test] +fn curle_http2_stream_is_spurious() { + let code = curl_sys::CURLE_HTTP2_STREAM; + let err = curl::Error::new(code); + assert!(maybe_spurious(&err.into())); +} diff -Nru cargo-0.35.0/src/cargo/util/paths.rs cargo-0.37.0/src/cargo/util/paths.rs --- cargo-0.35.0/src/cargo/util/paths.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/paths.rs 2019-05-15 19:48:47.000000000 +0000 @@ -187,16 +187,17 @@ Ok(FileTime::from_last_modification_time(&meta)) } -/// get `FileTime::from_system_time(SystemTime::now());` using the exact clock that this file system is using. -pub fn get_current_filesystem_time(path: &Path) -> CargoResult { +/// Record the current time on the filesystem (using the filesystem's clock) +/// using a file at the given directory. Returns the current time. +pub fn set_invocation_time(path: &Path) -> CargoResult { // note that if `FileTime::from_system_time(SystemTime::now());` is determined to be sufficient, // then this can be removed. - let timestamp = path.with_file_name("invoked.timestamp"); + let timestamp = path.join("invoked.timestamp"); write( ×tamp, b"This file has an mtime of when this was started.", )?; - Ok(mtime(×tamp)?) + mtime(×tamp) } #[cfg(unix)] diff -Nru cargo-0.35.0/src/cargo/util/process_builder.rs cargo-0.37.0/src/cargo/util/process_builder.rs --- cargo-0.35.0/src/cargo/util/process_builder.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/process_builder.rs 2019-05-15 19:48:47.000000000 +0000 @@ -80,10 +80,7 @@ /// (chainable) Replaces the args list with the given `args`. pub fn args_replace>(&mut self, args: &[T]) -> &mut ProcessBuilder { - self.args = args - .iter() - .map(|t| t.as_ref().to_os_string()) - .collect(); + self.args = args.iter().map(|t| t.as_ref().to_os_string()).collect(); self } diff -Nru cargo-0.35.0/src/cargo/util/progress.rs cargo-0.37.0/src/cargo/util/progress.rs --- cargo-0.35.0/src/cargo/util/progress.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/progress.rs 2019-05-15 19:48:47.000000000 +0000 @@ -356,7 +356,8 @@ ); // combining diacritics have width zero and thus can fit max_width. - let zalgo_msg = "z̸̧̢̗͉̝̦͍̱ͧͦͨ̑̅̌ͥ́͢a̢ͬͨ̽ͯ̅̑ͥ͋̏̑ͫ̄͢͏̫̝̪̤͎̱̣͍̭̞̙̱͙͍̘̭͚l̶̡̛̥̝̰̭̹̯̯̞̪͇̱̦͙͔̘̼͇͓̈ͨ͗ͧ̓͒ͦ̀̇ͣ̈ͭ͊͛̃̑͒̿̕͜g̸̷̢̩̻̻͚̠͓̞̥͐ͩ͌̑ͥ̊̽͋͐̐͌͛̐̇̑ͨ́ͅo͙̳̣͔̰̠̜͕͕̞̦̙̭̜̯̹̬̻̓͑ͦ͋̈̉͌̃ͯ̀̂͠ͅ ̸̡͎̦̲̖̤̺̜̮̱̰̥͔̯̅̏ͬ̂ͨ̋̃̽̈́̾̔̇ͣ̚͜͜h̡ͫ̐̅̿̍̀͜҉̛͇̭̹̰̠͙̞ẽ̶̙̹̳̖͉͎̦͂̋̓ͮ̔ͬ̐̀͂̌͑̒͆̚͜͠ ͓͓̟͍̮̬̝̝̰͓͎̼̻ͦ͐̾̔͒̃̓͟͟c̮̦͍̺͈͚̯͕̄̒͐̂͊̊͗͊ͤͣ̀͘̕͝͞o̶͍͚͍̣̮͌ͦ̽̑ͩ̅ͮ̐̽̏͗́͂̅ͪ͠m̷̧͖̻͔̥̪̭͉͉̤̻͖̩̤͖̘ͦ̂͌̆̂ͦ̒͊ͯͬ͊̉̌ͬ͝͡e̵̹̣͍̜̺̤̤̯̫̹̠̮͎͙̯͚̰̼͗͐̀̒͂̉̀̚͝͞s̵̲͍͙͖̪͓͓̺̱̭̩̣͖̣ͤͤ͂̎̈͗͆ͨͪ̆̈͗͝͠"; + let zalgo_msg = + "z̸̧̢̗͉̝̦͍̱ͧͦͨ̑̅̌ͥ́͢a̢ͬͨ̽ͯ̅̑ͥ͋̏̑ͫ̄͢͏̫̝̪̤͎̱̣͍̭̞̙̱͙͍̘̭͚l̶̡̛̥̝̰̭̹̯̯̞̪͇̱̦͙͔̘̼͇͓̈ͨ͗ͧ̓͒ͦ̀̇ͣ̈ͭ͊͛̃̑͒̿̕͜g̸̷̢̩̻̻͚̠͓̞̥͐ͩ͌̑ͥ̊̽͋͐̐͌͛̐̇̑ͨ́ͅo͙̳̣͔̰̠̜͕͕̞̦̙̭̜̯̹̬̻̓͑ͦ͋̈̉͌̃ͯ̀̂͠ͅ ̸̡͎̦̲̖̤̺̜̮̱̰̥͔̯̅̏ͬ̂ͨ̋̃̽̈́̾̔̇ͣ̚͜͜h̡ͫ̐̅̿̍̀͜҉̛͇̭̹̰̠͙̞ẽ̶̙̹̳̖͉͎̦͂̋̓ͮ̔ͬ̐̀͂̌͑̒͆̚͜͠ ͓͓̟͍̮̬̝̝̰͓͎̼̻ͦ͐̾̔͒̃̓͟͟c̮̦͍̺͈͚̯͕̄̒͐̂͊̊͗͊ͤͣ̀͘̕͝͞o̶͍͚͍̣̮͌ͦ̽̑ͩ̅ͮ̐̽̏͗́͂̅ͪ͠m̷̧͖̻͔̥̪̭͉͉̤̻͖̩̤͖̘ͦ̂͌̆̂ͦ̒͊ͯͬ͊̉̌ͬ͝͡e̵̹̣͍̜̺̤̤̯̫̹̠̮͎͙̯͚̰̼͗͐̀̒͂̉̀̚͝͞s̵̲͍͙͖̪͓͓̺̱̭̩̣͖̣ͤͤ͂̎̈͗͆ͨͪ̆̈͗͝͠"; assert_eq!( format.progress_status(3, 4, zalgo_msg), Some("[=============> ] 3/4".to_string() + zalgo_msg) diff -Nru cargo-0.35.0/src/cargo/util/rustc.rs cargo-0.37.0/src/cargo/util/rustc.rs --- cargo-0.35.0/src/cargo/util/rustc.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/rustc.rs 2019-05-15 19:48:47.000000000 +0000 @@ -20,7 +20,7 @@ pub path: PathBuf, /// An optional program that will be passed the path of the rust exe as its first argument, and /// rustc args following this. - pub wrapper: Option, + pub wrapper: Option, /// Verbose version information (the output of `rustc -vV`) pub verbose_version: String, /// The host triple (arch-platform-OS), this comes from verbose_version. @@ -59,7 +59,7 @@ Ok(Rustc { path, - wrapper, + wrapper: wrapper.map(util::process), verbose_version, host, cache: Mutex::new(cache), @@ -69,8 +69,8 @@ /// Gets a process builder set up to use the found rustc version, with a wrapper if `Some`. pub fn process(&self) -> ProcessBuilder { match self.wrapper { - Some(ref wrapper) if !wrapper.as_os_str().is_empty() => { - let mut cmd = util::process(wrapper); + Some(ref wrapper) if !wrapper.get_program().is_empty() => { + let mut cmd = wrapper.clone(); cmd.arg(&self.path); cmd } @@ -89,13 +89,17 @@ pub fn cached_success(&self, cmd: &ProcessBuilder) -> CargoResult { self.cache.lock().unwrap().cached_success(cmd) } + + pub fn set_wrapper(&mut self, wrapper: ProcessBuilder) { + self.wrapper = Some(wrapper); + } } -/// It is a well known that `rustc` is not the fastest compiler in the world. -/// What is less known is that even `rustc --version --verbose` takes about a -/// hundred milliseconds! Because we need compiler version info even for no-op -/// builds, we cache it here, based on compiler's mtime and rustup's current -/// toolchain. +/// It is a well known fact that `rustc` is not the fastest compiler in the +/// world. What is less known is that even `rustc --version --verbose` takes +/// about a hundred milliseconds! Because we need compiler version info even +/// for no-op builds, we cache it here, based on compiler's mtime and rustup's +/// current toolchain. /// /// https://github.com/rust-lang/cargo/issues/5315 /// https://github.com/rust-lang/rust/issues/49761 diff -Nru cargo-0.35.0/src/cargo/util/toml/mod.rs cargo-0.37.0/src/cargo/util/toml/mod.rs --- cargo-0.35.0/src/cargo/util/toml/mod.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/toml/mod.rs 2019-05-15 19:48:47.000000000 +0000 @@ -5,6 +5,7 @@ use std::rc::Rc; use std::str; +use failure::bail; use log::{debug, trace}; use semver::{self, VersionReq}; use serde::de; @@ -52,8 +53,9 @@ let package_root = manifest_file.parent().unwrap(); let toml = { - let pretty_filename = - manifest_file.strip_prefix(config.cwd()).unwrap_or(manifest_file); + let pretty_filename = manifest_file + .strip_prefix(config.cwd()) + .unwrap_or(manifest_file); parse(contents, pretty_filename, config)? }; @@ -78,7 +80,7 @@ TomlManifest::to_real_manifest(&manifest, source_id, package_root, config)?; add_unused(manifest.warnings_mut()); if !manifest.targets().iter().any(|t| !t.is_custom_build()) { - failure::bail!( + bail!( "no targets specified in the manifest\n \ either src/lib.rs, src/main.rs, a [lib] section, or \ [[bin]] section must be present" @@ -142,6 +144,24 @@ return Ok(ret); } + let mut third_parser = toml::de::Deserializer::new(toml); + third_parser.set_allow_duplicate_after_longer_table(true); + if let Ok(ret) = toml::Value::deserialize(&mut third_parser) { + let msg = format!( + "\ +TOML file found which contains invalid syntax and will soon not parse +at `{}`. + +The TOML spec requires that each table header is defined at most once, but +historical versions of Cargo have erroneously accepted this file. The table +definitions will need to be merged together with one table header to proceed, +and this will become a hard error in the future.", + file.display() + ); + config.shell().warn(&msg)?; + return Ok(ret); + } + let first_error = failure::Error::from(first_error); Err(first_error.context("could not parse input as TOML").into()) } @@ -219,6 +239,7 @@ #[serde(rename = "default_features")] default_features2: Option, package: Option, + public: Option, } #[derive(Debug, Deserialize, Serialize)] @@ -453,7 +474,7 @@ "dev" | "release" => {} _ => { if self.overrides.is_some() || self.build_override.is_some() { - failure::bail!( + bail!( "Profile overrides may only be specified for \ `dev` or `release` profile, not `{}`.", name @@ -473,21 +494,31 @@ } _ => {} } + + if let Some(panic) = &self.panic { + if panic != "unwind" && panic != "abort" { + bail!( + "`panic` setting of `{}` is not a valid setting,\ + must be `unwind` or `abort`", + panic + ); + } + } Ok(()) } fn validate_override(&self) -> CargoResult<()> { if self.overrides.is_some() || self.build_override.is_some() { - failure::bail!("Profile overrides cannot be nested."); + bail!("Profile overrides cannot be nested."); } if self.panic.is_some() { - failure::bail!("`panic` may not be specified in a profile override.") + bail!("`panic` may not be specified in a profile override.") } if self.lto.is_some() { - failure::bail!("`lto` may not be specified in a profile override.") + bail!("`lto` may not be specified in a profile override.") } if self.rpath.is_some() { - failure::bail!("`rpath` may not be specified in a profile override.") + bail!("`rpath` may not be specified in a profile override.") } Ok(()) } @@ -792,7 +823,7 @@ } } - fn to_real_manifest( + pub fn to_real_manifest( me: &Rc, source_id: SourceId, package_root: &Path, @@ -805,14 +836,14 @@ // Parse features first so they will be available when parsing other parts of the TOML. let empty = Vec::new(); let cargo_features = me.cargo_features.as_ref().unwrap_or(&empty); - let features = Features::new(&cargo_features, &mut warnings)?; + let features = Features::new(cargo_features, &mut warnings)?; let project = me.project.as_ref().or_else(|| me.package.as_ref()); let project = project.ok_or_else(|| failure::format_err!("no `package` section found"))?; let package_name = project.name.trim(); if package_name.is_empty() { - failure::bail!("package name cannot be an empty string") + bail!("package name cannot be an empty string") } validate_package_name(package_name, "package name", "")?; @@ -933,7 +964,7 @@ let name = dep.name_in_toml(); let prev = names_sources.insert(name.to_string(), dep.source_id()); if prev.is_some() && prev != Some(dep.source_id()) { - failure::bail!( + bail!( "Dependency '{}' has different source paths depending on the build \ target. Each dependency must have a single canonical source path \ irrespective of build target.", @@ -980,7 +1011,7 @@ let workspace_config = match (me.workspace.as_ref(), project.workspace.as_ref()) { (Some(config), None) => WorkspaceConfig::Root(WorkspaceRootConfig::new( - &package_root, + package_root, &config.members, &config.default_members, &config.exclude, @@ -988,7 +1019,7 @@ (None, root) => WorkspaceConfig::Member { root: root.cloned(), }, - (Some(..), Some(..)) => failure::bail!( + (Some(..), Some(..)) => bail!( "cannot configure both `package.workspace` and \ `[workspace]`, only one can be specified" ), @@ -1005,7 +1036,7 @@ features.require(Feature::publish_lockfile())?; b } - None => false, + None => features.is_enabled(Feature::publish_lockfile()), }; if summary.features().contains_key("default-features") { @@ -1064,43 +1095,43 @@ config: &Config, ) -> CargoResult<(VirtualManifest, Vec)> { if me.project.is_some() { - failure::bail!("virtual manifests do not define [project]"); + bail!("virtual manifests do not define [project]"); } if me.package.is_some() { - failure::bail!("virtual manifests do not define [package]"); + bail!("virtual manifests do not define [package]"); } if me.lib.is_some() { - failure::bail!("virtual manifests do not specify [lib]"); + bail!("virtual manifests do not specify [lib]"); } if me.bin.is_some() { - failure::bail!("virtual manifests do not specify [[bin]]"); + bail!("virtual manifests do not specify [[bin]]"); } if me.example.is_some() { - failure::bail!("virtual manifests do not specify [[example]]"); + bail!("virtual manifests do not specify [[example]]"); } if me.test.is_some() { - failure::bail!("virtual manifests do not specify [[test]]"); + bail!("virtual manifests do not specify [[test]]"); } if me.bench.is_some() { - failure::bail!("virtual manifests do not specify [[bench]]"); + bail!("virtual manifests do not specify [[bench]]"); } if me.dependencies.is_some() { - failure::bail!("virtual manifests do not specify [dependencies]"); + bail!("virtual manifests do not specify [dependencies]"); } if me.dev_dependencies.is_some() || me.dev_dependencies2.is_some() { - failure::bail!("virtual manifests do not specify [dev-dependencies]"); + bail!("virtual manifests do not specify [dev-dependencies]"); } if me.build_dependencies.is_some() || me.build_dependencies2.is_some() { - failure::bail!("virtual manifests do not specify [build-dependencies]"); + bail!("virtual manifests do not specify [build-dependencies]"); } if me.features.is_some() { - failure::bail!("virtual manifests do not specify [features]"); + bail!("virtual manifests do not specify [features]"); } if me.target.is_some() { - failure::bail!("virtual manifests do not specify [target]"); + bail!("virtual manifests do not specify [target]"); } if me.badges.is_some() { - failure::bail!("virtual manifests do not specify [badges]"); + bail!("virtual manifests do not specify [badges]"); } let mut nested_paths = Vec::new(); @@ -1108,7 +1139,7 @@ let mut deps = Vec::new(); let empty = Vec::new(); let cargo_features = me.cargo_features.as_ref().unwrap_or(&empty); - let features = Features::new(&cargo_features, &mut warnings)?; + let features = Features::new(cargo_features, &mut warnings)?; let (replace, patch) = { let mut cx = Context { @@ -1127,13 +1158,13 @@ let profiles = Profiles::new(me.profile.as_ref(), config, &features, &mut warnings)?; let workspace_config = match me.workspace { Some(ref config) => WorkspaceConfig::Root(WorkspaceRootConfig::new( - &root, + root, &config.members, &config.default_members, &config.exclude, )), None => { - failure::bail!("virtual manifests must be configured with [workspace]"); + bail!("virtual manifests must be configured with [workspace]"); } }; Ok(( @@ -1144,7 +1175,7 @@ fn replace(&self, cx: &mut Context<'_, '_>) -> CargoResult> { if self.patch.is_some() && self.replace.is_some() { - failure::bail!("cannot specify both [replace] and [patch]"); + bail!("cannot specify both [replace] and [patch]"); } let mut replace = Vec::new(); for (spec, replacement) in self.replace.iter().flat_map(|x| x) { @@ -1164,14 +1195,14 @@ TomlDependency::Simple(..) => true, }; if version_specified { - failure::bail!( + bail!( "replacements cannot specify a version \ requirement, but found one for `{}`", spec ); } - let mut dep = replacement.to_dependency(spec.name(), cx, None)?; + let mut dep = replacement.to_dependency(spec.name().as_str(), cx, None)?; { let version = spec.version().ok_or_else(|| { failure::format_err!( @@ -1288,6 +1319,17 @@ cx.warnings.push(msg); } + if let Some(version) = &self.version { + if version.contains('+') { + cx.warnings.push(format!( + "version requirement `{}` for dependency `{}` \ + includes semver metadata which will be ignored, removing the \ + metadata is recommended to avoid confusion", + version, name_in_toml + )); + } + } + if self.git.is_none() { let git_only_keys = [ (&self.branch, "branch"), @@ -1313,12 +1355,12 @@ self.registry.as_ref(), self.registry_index.as_ref(), ) { - (Some(_), _, Some(_), _) | (Some(_), _, _, Some(_)) => failure::bail!( + (Some(_), _, Some(_), _) | (Some(_), _, _, Some(_)) => bail!( "dependency ({}) specification is ambiguous. \ Only one of `git` or `registry` is allowed.", name_in_toml ), - (_, _, Some(_), Some(_)) => failure::bail!( + (_, _, Some(_), Some(_)) => bail!( "dependency ({}) specification is ambiguous. \ Only one of `registry` or `registry-index` is allowed.", name_in_toml @@ -1420,6 +1462,16 @@ cx.features.require(Feature::rename_dependency())?; dep.set_explicit_name_in_toml(name_in_toml); } + + if let Some(p) = self.public { + cx.features.require(Feature::public_dependency())?; + + if dep.kind() != Kind::Normal { + bail!("'public' specifier can only be used on regular dependencies, not {:?} dependencies", dep.kind()); + } + + dep.set_public(p); + } Ok(dep) } } diff -Nru cargo-0.35.0/src/cargo/util/to_url.rs cargo-0.37.0/src/cargo/util/to_url.rs --- cargo-0.35.0/src/cargo/util/to_url.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/to_url.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,4 +1,4 @@ -use std::path::Path; +use std::path::{Path, PathBuf}; use url::Url; @@ -22,3 +22,9 @@ .map_err(|()| failure::format_err!("invalid path url `{}`", self.display())) } } + +impl<'a> ToUrl for &'a PathBuf { + fn to_url(self) -> CargoResult { + self.as_path().to_url() + } +} diff -Nru cargo-0.35.0/src/cargo/util/to_url_with_base.rs cargo-0.37.0/src/cargo/util/to_url_with_base.rs --- cargo-0.35.0/src/cargo/util/to_url_with_base.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/to_url_with_base.rs 2019-05-15 19:48:47.000000000 +0000 @@ -0,0 +1,50 @@ +use crate::util::{CargoResult, ToUrl}; + +use url::Url; + +/// A type that can be interpreted as a relative Url and converted to +/// a Url. +pub trait ToUrlWithBase { + /// Performs the conversion + fn to_url_with_base(self, base: Option) -> CargoResult; +} + +impl<'a> ToUrlWithBase for &'a str { + fn to_url_with_base(self, base: Option) -> CargoResult { + let base_url = match base { + Some(base) => Some( + base.to_url() + .map_err(|s| failure::format_err!("invalid url `{}`: {}", self, s))?, + ), + None => None, + }; + + Url::options() + .base_url(base_url.as_ref()) + .parse(self) + .map_err(|s| failure::format_err!("invalid url `{}`: {}", self, s)) + } +} + +#[cfg(test)] +mod tests { + use crate::util::ToUrlWithBase; + + #[test] + fn to_url_with_base() { + assert_eq!( + "rel/path" + .to_url_with_base(Some("file:///abs/path/")) + .unwrap() + .to_string(), + "file:///abs/path/rel/path" + ); + assert_eq!( + "rel/path" + .to_url_with_base(Some("file:///abs/path/popped-file")) + .unwrap() + .to_string(), + "file:///abs/path/rel/path" + ); + } +} diff -Nru cargo-0.35.0/src/cargo/util/vcs.rs cargo-0.37.0/src/cargo/util/vcs.rs --- cargo-0.35.0/src/cargo/util/vcs.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/cargo/util/vcs.rs 2019-05-15 19:48:47.000000000 +0000 @@ -13,9 +13,12 @@ pub fn existing_vcs_repo(path: &Path, cwd: &Path) -> bool { fn in_git_repo(path: &Path, cwd: &Path) -> bool { if let Ok(repo) = GitRepo::discover(path, cwd) { - repo.is_path_ignored(path) - .map(|ignored| !ignored) - .unwrap_or(true) + // Don't check if the working directory itself is ignored. + if repo.workdir().map_or(false, |workdir| workdir == path) { + true + } else { + !repo.is_path_ignored(path).unwrap_or(false) + } } else { false } diff -Nru cargo-0.35.0/src/crates-io/Cargo.toml cargo-0.37.0/src/crates-io/Cargo.toml --- cargo-0.35.0/src/crates-io/Cargo.toml 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/crates-io/Cargo.toml 2019-05-15 19:48:47.000000000 +0000 @@ -1,6 +1,6 @@ [package] name = "crates-io" -version = "0.23.0" +version = "0.25.0" edition = "2018" authors = ["Alex Crichton "] license = "MIT OR Apache-2.0" diff -Nru cargo-0.35.0/src/crates-io/lib.rs cargo-0.37.0/src/crates-io/lib.rs --- cargo-0.35.0/src/crates-io/lib.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/crates-io/lib.rs 2019-05-15 19:48:47.000000000 +0000 @@ -5,6 +5,7 @@ use std::fs::File; use std::io::prelude::*; use std::io::Cursor; +use std::time::Instant; use curl::easy::{Easy, List}; use failure::bail; @@ -12,6 +13,7 @@ use serde::{Deserialize, Serialize}; use serde_json; use url::percent_encoding::{percent_encode, QUERY_ENCODE_SET}; +use url::Url; pub type Result = std::result::Result; @@ -141,6 +143,12 @@ &self.host } + pub fn host_is_crates_io(&self) -> bool { + Url::parse(self.host()) + .map(|u| u.host_str() == Some("crates.io")) + .unwrap_or(false) + } + pub fn add_owners(&mut self, krate: &str, owners: &[&str]) -> Result { let body = serde_json::to_string(&OwnersReq { users: owners })?; let body = self.put(&format!("/crates/{}/owners", krate), body.as_bytes())?; @@ -207,7 +215,7 @@ headers.append(&format!("Authorization: {}", token))?; self.handle.http_headers(headers)?; - let body = handle(&mut self.handle, &mut |buf| body.read(buf).unwrap_or(0))?; + let body = self.handle(&mut |buf| body.read(buf).unwrap_or(0))?; let response = if body.is_empty() { "{}".parse()? @@ -300,55 +308,62 @@ Some(mut body) => { self.handle.upload(true)?; self.handle.in_filesize(body.len() as u64)?; - handle(&mut self.handle, &mut |buf| body.read(buf).unwrap_or(0)) + self.handle(&mut |buf| body.read(buf).unwrap_or(0)) } - None => handle(&mut self.handle, &mut |_| 0), + None => self.handle(&mut |_| 0), } } -} -fn handle(handle: &mut Easy, read: &mut dyn FnMut(&mut [u8]) -> usize) -> Result { - let mut headers = Vec::new(); - let mut body = Vec::new(); - { - let mut handle = handle.transfer(); - handle.read_function(|buf| Ok(read(buf)))?; - handle.write_function(|data| { - body.extend_from_slice(data); - Ok(data.len()) - })?; - handle.header_function(|data| { - headers.push(String::from_utf8_lossy(data).into_owned()); - true - })?; - handle.perform()?; - } - - let body = match String::from_utf8(body) { - Ok(body) => body, - Err(..) => bail!("response body was not valid utf-8"), - }; - let errors = serde_json::from_str::(&body).ok().map(|s| { - s.errors.into_iter().map(|s| s.detail).collect::>() - }); - - match (handle.response_code()?, errors) { - (0, None) | (200, None) => {}, - (code, Some(errors)) => { - let code = StatusCode::from_u16(code as _)?; - bail!("api errors (status {}): {}", code, errors.join(", ")) + fn handle(&mut self, read: &mut dyn FnMut(&mut [u8]) -> usize) -> Result { + let mut headers = Vec::new(); + let mut body = Vec::new(); + let started; + { + let mut handle = self.handle.transfer(); + handle.read_function(|buf| Ok(read(buf)))?; + handle.write_function(|data| { + body.extend_from_slice(data); + Ok(data.len()) + })?; + handle.header_function(|data| { + headers.push(String::from_utf8_lossy(data).into_owned()); + true + })?; + started = Instant::now(); + handle.perform()?; + } + + let body = match String::from_utf8(body) { + Ok(body) => body, + Err(..) => bail!("response body was not valid utf-8"), + }; + let errors = serde_json::from_str::(&body).ok().map(|s| { + s.errors.into_iter().map(|s| s.detail).collect::>() + }); + + match (self.handle.response_code()?, errors) { + (0, None) | (200, None) => {}, + (503, None) if started.elapsed().as_secs() >= 29 && self.host_is_crates_io() => { + bail!("Request timed out after 30 seconds. If you're trying to \ + upload a crate it may be too large. If the crate is under \ + 10MB in size, you can email help@crates.io for assistance.") + } + (code, Some(errors)) => { + let code = StatusCode::from_u16(code as _)?; + bail!("api errors (status {}): {}", code, errors.join(", ")) + } + (code, None) => bail!( + "failed to get a 200 OK response, got {}\n\ + headers:\n\ + \t{}\n\ + body:\n\ + {}", + code, + headers.join("\n\t"), + body, + ), } - (code, None) => bail!( - "failed to get a 200 OK response, got {}\n\ - headers:\n\ - \t{}\n\ - body:\n\ - {}", - code, - headers.join("\n\t"), - body, - ), - } - Ok(body) + Ok(body) + } } diff -Nru cargo-0.35.0/src/crates-io/LICENSE-APACHE cargo-0.37.0/src/crates-io/LICENSE-APACHE --- cargo-0.35.0/src/crates-io/LICENSE-APACHE 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/crates-io/LICENSE-APACHE 2019-05-15 19:48:47.000000000 +0000 @@ -1,6 +1,6 @@ Apache License Version 2.0, January 2004 - http://www.apache.org/licenses/ + https://www.apache.org/licenses/LICENSE-2.0 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION @@ -192,7 +192,7 @@ you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff -Nru cargo-0.35.0/src/doc/.gitignore cargo-0.37.0/src/doc/.gitignore --- cargo-0.35.0/src/doc/.gitignore 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/src/doc/.gitignore 2019-05-15 19:48:47.000000000 +0000 @@ -0,0 +1,2 @@ +# Ignore built book +book/ diff -Nru cargo-0.35.0/src/doc/man/cargo.adoc cargo-0.37.0/src/doc/man/cargo.adoc --- cargo-0.35.0/src/doc/man/cargo.adoc 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/cargo.adoc 2019-05-15 19:48:47.000000000 +0000 @@ -17,7 +17,7 @@ == DESCRIPTION This program is a package manager and build tool for the Rust language, -available at . +available at . == COMMANDS diff -Nru cargo-0.35.0/src/doc/man/cargo-build.adoc cargo-0.37.0/src/doc/man/cargo-build.adoc --- cargo-0.35.0/src/doc/man/cargo-build.adoc 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/cargo-build.adoc 2019-05-15 19:48:47.000000000 +0000 @@ -44,8 +44,10 @@ *--out-dir* _DIRECTORY_:: Copy final artifacts to this directory. + -This option is unstable and available only on the nightly channel and requires -the `-Z unstable-options` flag to enable. +This option is unstable and available only on the +link:https://doc.rust-lang.org/book/appendix-07-nightly-rust.html[nightly channel] +and requires the `-Z unstable-options` flag to enable. +See https://github.com/rust-lang/cargo/issues/6790 for more information. === Display Options @@ -57,8 +59,10 @@ Outputs a series of JSON messages to stdout that indicate the commands to run the build. + -This option is unstable and available only on the nightly channel and requires -the `-Z unstable-options` flag to enable. +This option is unstable and available only on the +link:https://doc.rust-lang.org/book/appendix-07-nightly-rust.html[nightly channel] +and requires the `-Z unstable-options` flag to enable. +See https://github.com/rust-lang/cargo/issues/5579 for more information. === Manifest Options diff -Nru cargo-0.35.0/src/doc/man/cargo-fetch.adoc cargo-0.37.0/src/doc/man/cargo-fetch.adoc --- cargo-0.35.0/src/doc/man/cargo-fetch.adoc 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/cargo-fetch.adoc 2019-05-15 19:48:47.000000000 +0000 @@ -23,6 +23,10 @@ If `--target` is not specified, then all target dependencies are fetched. +See also the link:https://crates.io/crates/cargo-prefetch[cargo-prefetch] +plugin which adds a command to download popular crates. This may be useful if +you plan to use Cargo without a network with the `--offline` flag. + == OPTIONS === Fetch options diff -Nru cargo-0.35.0/src/doc/man/cargo-install.adoc cargo-0.37.0/src/doc/man/cargo-install.adoc --- cargo-0.35.0/src/doc/man/cargo-install.adoc 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/cargo-install.adoc 2019-05-15 19:48:47.000000000 +0000 @@ -24,10 +24,10 @@ include::description-install-root.adoc[] There are multiple sources from which a crate can be installed. The default -location is crates.io but the `--git` and `--path` flags can change this -source. If the source contains more than one package (such as crates.io or a -git repository with multiple crates) the _CRATE_ argument is required to -indicate which crate should be installed. +location is crates.io but the `--git`, `--path`, and `registry` flags can +change this source. If the source contains more than one package (such as +crates.io or a git repository with multiple crates) the _CRATE_ argument is +required to indicate which crate should be installed. Crates from crates.io can optionally specify the version they wish to install via the `--version` flags, and similarly packages from git repositories can @@ -48,7 +48,7 @@ *--vers* _VERSION_:: *--version* _VERSION_:: - Specify a version to install from crates.io. + Specify a version to install. *--git* _URL_:: Git URL to install the specified crate from. @@ -100,6 +100,10 @@ *--debug*:: Build with the `dev` profile instead the `release` profile. +=== Manifest Options + +include::options-locked.adoc[] + === Miscellaneous Options include::options-jobs.adoc[] diff -Nru cargo-0.35.0/src/doc/man/cargo-metadata.adoc cargo-0.37.0/src/doc/man/cargo-metadata.adoc --- cargo-0.35.0/src/doc/man/cargo-metadata.adoc 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/cargo-metadata.adoc 2019-05-15 19:48:47.000000000 +0000 @@ -212,7 +212,7 @@ */ "deps": [ { - /* The name of the dependency. + /* The name of the dependency's library target. If this is a renamed dependency, this is the new name. */ diff -Nru cargo-0.35.0/src/doc/man/cargo-publish.adoc cargo-0.37.0/src/doc/man/cargo-publish.adoc --- cargo-0.35.0/src/doc/man/cargo-publish.adoc 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/cargo-publish.adoc 2019-05-15 19:48:47.000000000 +0000 @@ -9,7 +9,7 @@ == SYNOPSIS -`cargo package [_OPTIONS_]` +`cargo publish [_OPTIONS_]` == DESCRIPTION diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-bench.html cargo-0.37.0/src/doc/man/generated/cargo-bench.html --- cargo-0.35.0/src/doc/man/generated/cargo-bench.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-bench.html 2019-05-15 19:48:47.000000000 +0000 @@ -341,6 +341,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-build.html cargo-0.37.0/src/doc/man/generated/cargo-build.html --- cargo-0.35.0/src/doc/man/generated/cargo-build.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-build.html 2019-05-15 19:48:47.000000000 +0000 @@ -185,8 +185,10 @@

Copy final artifacts to this directory.

-

This option is unstable and available only on the nightly channel and requires -the -Z unstable-options flag to enable.

+

This option is unstable and available only on the +nightly channel +and requires the -Z unstable-options flag to enable. +See https://github.com/rust-lang/cargo/issues/6790 for more information.

@@ -253,8 +255,10 @@

Outputs a series of JSON messages to stdout that indicate the commands to run the build.

-

This option is unstable and available only on the nightly channel and requires -the -Z unstable-options flag to enable.

+

This option is unstable and available only on the +nightly channel +and requires the -Z unstable-options flag to enable. +See https://github.com/rust-lang/cargo/issues/5579 for more information.

@@ -282,6 +286,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-check.html cargo-0.37.0/src/doc/man/generated/cargo-check.html --- cargo-0.35.0/src/doc/man/generated/cargo-check.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-check.html 2019-05-15 19:48:47.000000000 +0000 @@ -277,6 +277,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-clean.html cargo-0.37.0/src/doc/man/generated/cargo-clean.html --- cargo-0.35.0/src/doc/man/generated/cargo-clean.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-clean.html 2019-05-15 19:48:47.000000000 +0000 @@ -141,6 +141,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-doc.html cargo-0.37.0/src/doc/man/generated/cargo-doc.html --- cargo-0.35.0/src/doc/man/generated/cargo-doc.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-doc.html 2019-05-15 19:48:47.000000000 +0000 @@ -245,6 +245,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-fetch.html cargo-0.37.0/src/doc/man/generated/cargo-fetch.html --- cargo-0.35.0/src/doc/man/generated/cargo-fetch.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-fetch.html 2019-05-15 19:48:47.000000000 +0000 @@ -26,6 +26,11 @@

If --target is not specified, then all target dependencies are fetched.

+
+

See also the cargo-prefetch +plugin which adds a command to download popular crates. This may be useful if +you plan to use Cargo without a network with the --offline flag.

+
@@ -113,6 +118,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-fix.html cargo-0.37.0/src/doc/man/generated/cargo-fix.html --- cargo-0.35.0/src/doc/man/generated/cargo-fix.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-fix.html 2019-05-15 19:48:47.000000000 +0000 @@ -348,6 +348,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-generate-lockfile.html cargo-0.37.0/src/doc/man/generated/cargo-generate-lockfile.html --- cargo-0.35.0/src/doc/man/generated/cargo-generate-lockfile.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-generate-lockfile.html 2019-05-15 19:48:47.000000000 +0000 @@ -91,6 +91,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/generated/cargo.html cargo-0.37.0/src/doc/man/generated/cargo.html --- cargo-0.35.0/src/doc/man/generated/cargo.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo.html 2019-05-15 19:48:47.000000000 +0000 @@ -19,7 +19,7 @@

This program is a package manager and build tool for the Rust language, -available at http://rust-lang.org.

+available at https://rust-lang.org.

@@ -265,6 +265,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-install.html cargo-0.37.0/src/doc/man/generated/cargo-install.html --- cargo-0.35.0/src/doc/man/generated/cargo-install.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-install.html 2019-05-15 19:48:47.000000000 +0000 @@ -45,10 +45,10 @@

There are multiple sources from which a crate can be installed. The default -location is crates.io but the --git and --path flags can change this -source. If the source contains more than one package (such as crates.io or a -git repository with multiple crates) the CRATE argument is required to -indicate which crate should be installed.

+location is crates.io but the --git, --path, and registry flags can +change this source. If the source contains more than one package (such as +crates.io or a git repository with multiple crates) the CRATE argument is +required to indicate which crate should be installed.

Crates from crates.io can optionally specify the version they wish to install @@ -77,7 +77,7 @@

--vers VERSION
--version VERSION
-

Specify a version to install from crates.io.

+

Specify a version to install.

--git URL
@@ -185,6 +185,43 @@
+ +
+

Manifest Options

+
+
+
--frozen
+
--locked
+
+

Either of these flags requires that the Cargo.lock file is +up-to-date. If the lock file is missing, or it needs to be updated, Cargo will +exit with an error. The --frozen flag also prevents Cargo from +attempting to access the network to determine if it is out-of-date.

+
+

These may be used in environments where you want to assert that the +Cargo.lock file is up-to-date (such as a CI build) or want to avoid network +access.

+
+
+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
+
+

Miscellaneous Options

diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-metadata.html cargo-0.37.0/src/doc/man/generated/cargo-metadata.html --- cargo-0.35.0/src/doc/man/generated/cargo-metadata.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-metadata.html 2019-05-15 19:48:47.000000000 +0000 @@ -219,7 +219,7 @@ */ "deps": [ { - /* The name of the dependency. + /* The name of the dependency's library target. If this is a renamed dependency, this is the new name. */ @@ -363,6 +363,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-package.html cargo-0.37.0/src/doc/man/generated/cargo-package.html --- cargo-0.35.0/src/doc/man/generated/cargo-package.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-package.html 2019-05-15 19:48:47.000000000 +0000 @@ -170,6 +170,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-pkgid.html cargo-0.37.0/src/doc/man/generated/cargo-pkgid.html --- cargo-0.35.0/src/doc/man/generated/cargo-pkgid.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-pkgid.html 2019-05-15 19:48:47.000000000 +0000 @@ -150,6 +150,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-publish.html cargo-0.37.0/src/doc/man/generated/cargo-publish.html --- cargo-0.35.0/src/doc/man/generated/cargo-publish.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-publish.html 2019-05-15 19:48:47.000000000 +0000 @@ -6,7 +6,7 @@

SYNOPSIS

-

cargo package [OPTIONS]

+

cargo publish [OPTIONS]

@@ -169,6 +169,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-run.html cargo-0.37.0/src/doc/man/generated/cargo-run.html --- cargo-0.35.0/src/doc/man/generated/cargo-run.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-run.html 2019-05-15 19:48:47.000000000 +0000 @@ -207,6 +207,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-rustc.html cargo-0.37.0/src/doc/man/generated/cargo-rustc.html --- cargo-0.35.0/src/doc/man/generated/cargo-rustc.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-rustc.html 2019-05-15 19:48:47.000000000 +0000 @@ -269,6 +269,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-rustdoc.html cargo-0.37.0/src/doc/man/generated/cargo-rustdoc.html --- cargo-0.35.0/src/doc/man/generated/cargo-rustdoc.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-rustdoc.html 2019-05-15 19:48:47.000000000 +0000 @@ -282,6 +282,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-test.html cargo-0.37.0/src/doc/man/generated/cargo-test.html --- cargo-0.35.0/src/doc/man/generated/cargo-test.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-test.html 2019-05-15 19:48:47.000000000 +0000 @@ -366,6 +366,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-update.html cargo-0.37.0/src/doc/man/generated/cargo-update.html --- cargo-0.35.0/src/doc/man/generated/cargo-update.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-update.html 2019-05-15 19:48:47.000000000 +0000 @@ -125,6 +125,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/generated/cargo-verify-project.html cargo-0.37.0/src/doc/man/generated/cargo-verify-project.html --- cargo-0.35.0/src/doc/man/generated/cargo-verify-project.html 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/generated/cargo-verify-project.html 2019-05-15 19:48:47.000000000 +0000 @@ -99,6 +99,23 @@ access.

+
--offline
+
+

Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible.

+
+

Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the cargo-fetch(1) command to download dependencies before going +offline.

+
+
+

May also be specified with the net.offline config value.

+
+
diff -Nru cargo-0.35.0/src/doc/man/options-locked.adoc cargo-0.37.0/src/doc/man/options-locked.adoc --- cargo-0.35.0/src/doc/man/options-locked.adoc 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/man/options-locked.adoc 2019-05-15 19:48:47.000000000 +0000 @@ -8,3 +8,17 @@ These may be used in environments where you want to assert that the `Cargo.lock` file is up-to-date (such as a CI build) or want to avoid network access. + +*--offline*:: + Prevents Cargo from accessing the network for any reason. Without this + flag, Cargo will stop with an error if it needs to access the network and + the network is not available. With this flag, Cargo will attempt to + proceed without the network if possible. ++ +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the man:cargo-fetch[1] command to download dependencies before going +offline. ++ +May also be specified with the `net.offline` linkcargo:reference/config.html[config value]. diff -Nru cargo-0.35.0/src/doc/src/appendix/glossary.md cargo-0.37.0/src/doc/src/appendix/glossary.md --- cargo-0.35.0/src/doc/src/appendix/glossary.md 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/src/appendix/glossary.md 2019-05-15 19:48:47.000000000 +0000 @@ -21,15 +21,22 @@ ### Feature -A [*feature*][feature] is a named flag which allows for conditional -compilation. A feature can refer to an optional dependency, or an arbitrary -name defined in a `Cargo.toml` manifest that can be checked within source -code. - -Cargo has [*unstable feature flags*][cargo-unstable] which can be used to -enable experimental behavior of Cargo itself. The Rust compiler and Rustdoc -also have their own unstable feature flags (see [The Unstable -Book][unstable-book] and [The Rustdoc Book][rustdoc-unstable]). +The meaning of *feature* depends on the context: + +- A [*feature*][feature] is a named flag which allows for conditional + compilation. A feature can refer to an optional dependency, or an arbitrary + name defined in a `Cargo.toml` manifest that can be checked within source + code. + +- Cargo has [*unstable feature flags*][cargo-unstable] which can be used to + enable experimental behavior of Cargo itself. + +- The Rust compiler and Rustdoc have their own unstable feature flags (see + [The Unstable Book][unstable-book] and [The Rustdoc + Book][rustdoc-unstable]). + +- CPU targets have [*target features*][target-feature] which specify + capabilities of a CPU. ### Index @@ -169,10 +176,10 @@ [Directory Sources]: reference/source-replacement.html#directory-sources [Local Registry Sources]: reference/source-replacement.html#local-registry-sources [Source Replacement]: reference/source-replacement.html -[cargo-unstable]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html +[cargo-unstable]: reference/unstable.html [config option]: reference/config.html [directory layout]: reference/manifest.html#the-project-layout -[edition guide]: https://rust-lang-nursery.github.io/edition-guide/ +[edition guide]: ../edition-guide/index.html [edition-field]: reference/manifest.html#the-edition-field-optional [environment variable]: reference/environment-variables.html [feature]: reference/manifest.html#the-features-section @@ -184,6 +191,7 @@ [path overrides]: reference/specifying-dependencies.html#overriding-with-local-dependencies [pkgid-spec]: reference/pkgid-spec.html [rustdoc-unstable]: https://doc.rust-lang.org/nightly/rustdoc/unstable-features.html +[target-feature]: ../reference/attributes/codegen.html#the-target_feature-attribute [targets]: reference/manifest.html#configuring-a-target [unstable-book]: https://doc.rust-lang.org/nightly/unstable-book/index.html [virtual]: reference/manifest.html#virtual-manifest diff -Nru cargo-0.35.0/src/doc/src/guide/dependencies.md cargo-0.37.0/src/doc/src/guide/dependencies.md --- cargo-0.35.0/src/doc/src/guide/dependencies.md 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/src/guide/dependencies.md 2019-05-15 19:48:47.000000000 +0000 @@ -35,6 +35,7 @@ name = "hello_world" version = "0.1.0" authors = ["Your Name "] +edition = "2018" [dependencies] time = "0.1.12" @@ -68,11 +69,9 @@ Now, if `regex` gets updated, we will still build with the same revision until we choose to `cargo update`. -You can now use the `regex` library using `extern crate` in `main.rs`. +You can now use the `regex` library in `main.rs`. ```rust -extern crate regex; - use regex::Regex; fn main() { diff -Nru cargo-0.35.0/src/doc/src/guide/tests.md cargo-0.37.0/src/doc/src/guide/tests.md --- cargo-0.35.0/src/doc/src/guide/tests.md 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/src/guide/tests.md 2019-05-15 19:48:47.000000000 +0000 @@ -36,4 +36,4 @@ documentation. Please see the [testing guide][testing] in the Rust documentation for more details. -[testing]: https://doc.rust-lang.org/book/testing.html +[testing]: ../book/ch11-00-testing.html diff -Nru cargo-0.35.0/src/doc/src/reference/build-scripts.md cargo-0.37.0/src/doc/src/reference/build-scripts.md --- cargo-0.35.0/src/doc/src/reference/build-scripts.md 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/src/reference/build-scripts.md 2019-05-15 19:48:47.000000000 +0000 @@ -19,7 +19,7 @@ The Rust file designated by the `build` command (relative to the package root) will be compiled and invoked before anything else is compiled in the package, allowing your Rust code to depend on the built or generated artifacts. -By default Cargo looks up for `"build.rs"` file in a package root (even if you +By default Cargo looks for a `"build.rs"` file in a package root (even if you do not specify a value for `build`). Use `build = "custom_build_name.rs"` to specify a custom build name or `build = false` to disable automatic detection of the build script. @@ -62,6 +62,7 @@ cargo:rustc-link-search=native=/path/to/foo cargo:rustc-cfg=foo cargo:rustc-env=FOO=bar +cargo:rustc-cdylib-link-arg=-Wl,-soname,libfoo.so.1.2.3 # arbitrary user-defined metadata cargo:root=/path/to/foo cargo:libdir=/path/to/foo/lib @@ -93,6 +94,9 @@ This is useful for embedding additional metadata in crate's code, such as the hash of Git HEAD or the unique identifier of a continuous integration server. +* `rustc-cdylib-link-arg=FLAG` is a flag passed to the compiler as + `-C link-arg=FLAG` when building a `cdylib`. Its usage is highly platform + specific. It is useful to set the shared library version or the runtime-path. * `rerun-if-changed=PATH` is a path to a file or directory which indicates that the build script should be re-run if it changes (detected by a more-recent last-modified timestamp on the file). Normally build scripts are re-run if diff -Nru cargo-0.35.0/src/doc/src/reference/config.md cargo-0.37.0/src/doc/src/reference/config.md --- cargo-0.35.0/src/doc/src/reference/config.md 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/src/reference/config.md 2019-05-15 19:48:47.000000000 +0000 @@ -113,7 +113,7 @@ # This setting can be used to help debug what's going on with HTTP requests made # by Cargo. When set to `true` then Cargo's normal debug logging will be filled # in with HTTP information, which you can extract with -# `RUST_LOG=cargo::ops::registry=debug` (and `trace` may print more). +# `CARGO_LOG=cargo::ops::registry=debug` (and `trace` may print more). # # Be wary when posting these logs elsewhere though, it may be the case that a # header has an authentication token in it you don't want leaked! Be sure to @@ -141,6 +141,7 @@ [net] retry = 2 # number of times a network call will automatically retried git-fetch-with-cli = false # if `true` we'll use `git`-the-CLI to fetch git repos +offline = false # do not access the network, but otherwise try to proceed if possible # Alias cargo commands. The first 4 aliases are built in. If your # command requires grouped whitespace use the list format. diff -Nru cargo-0.35.0/src/doc/src/reference/environment-variables.md cargo-0.37.0/src/doc/src/reference/environment-variables.md --- cargo-0.35.0/src/doc/src/reference/environment-variables.md 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/src/reference/environment-variables.md 2019-05-15 19:48:47.000000000 +0000 @@ -131,7 +131,7 @@ information. [links]: reference/build-scripts.html#the-links-manifest-key -[configuration]: https://doc.rust-lang.org/reference/attributes.html#conditional-compilation +[configuration]: ../reference/conditional-compilation.html [jobserver]: https://www.gnu.org/software/make/manual/html_node/Job-Slots.html [cargo-config]: reference/config.html [Target Triple]: appendix/glossary.html#target diff -Nru cargo-0.35.0/src/doc/src/reference/manifest.md cargo-0.37.0/src/doc/src/reference/manifest.md --- cargo-0.35.0/src/doc/src/reference/manifest.md 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/src/reference/manifest.md 2019-05-15 19:48:47.000000000 +0000 @@ -27,12 +27,12 @@ enforcing only ASCII characters, not a reserved name, not a special Windows name such as "nul", is not too long, etc. -[alphanumeric]: https://doc.rust-lang.org/std/primitive.char.html#method.is_alphanumeric +[alphanumeric]: ../std/primitive.char.html#method.is_alphanumeric #### The `version` field Cargo bakes in the concept of [Semantic -Versioning](http://semver.org/), so make sure you follow some basic rules: +Versioning](https://semver.org/), so make sure you follow some basic rules: * Before you reach 1.0.0, anything goes, but if you make breaking changes, increment the minor version. In Rust, breaking changes include adding fields to @@ -73,11 +73,11 @@ #### The `build` field (optional) -This field specifies a file in the package root which is a [build script][1] for -building native code. More information can be found in the build script -[guide][1]. +This field specifies a file in the package root which is a [build script] for +building native code. More information can be found in the [build script +guide][build script]. -[1]: reference/build-scripts.html +[build script]: reference/build-scripts.html ```toml [package] @@ -121,15 +121,39 @@ #### The `exclude` and `include` fields (optional) -You can explicitly specify to Cargo that a set of [globs][globs] should be -ignored or included for the purposes of packaging and rebuilding a package. The -globs specified in the `exclude` field identify a set of files that are not -included when a package is published as well as ignored for the purposes of -detecting when to rebuild a package, and the globs in `include` specify files -that are explicitly included. +You can explicitly specify that a set of file patterns should be ignored or +included for the purposes of packaging. The patterns specified in the +`exclude` field identify a set of files that are not included, and the +patterns in `include` specify files that are explicitly included. + +The patterns should be [gitignore]-style patterns. Briefly: + +- `foo` matches any file or directory with the name `foo` anywhere in the + package. This is equivalent to the pattern `**/foo`. +- `/foo` matches any file or directory with the name `foo` only in the root of + the package. +- `foo/` matches any *directory* with the name `foo` anywhere in the package. +- Common glob patterns like `*`, `?`, and `[]` are supported: + - `*` matches zero or more characters except `/`. For example, `*.html` + matches any file or directory with the `.html` extension anywhere in the + package. + - `?` matches any character except `/`. For example, `foo?` matches `food`, + but not `foo`. + - `[]` allows for matching a range of characters. For example, `[ab]` + matches either `a` or `b`. `[a-z]` matches letters a through z. +- `**/` prefix matches in any directory. For example, `**/foo/bar` matches the + file or directory `bar` anywhere that is directly under directory `foo`. +- `/**` suffix matches everything inside. For example, `foo/**` matches all + files inside directory `foo`, including all files in subdirectories below + `foo`. +- `/**/` matches zero or more directories. For example, `a/**/b` matches + `a/b`, `a/x/b`, `a/x/y/b`, and so on. +- `!` prefix negates a pattern. For example, a pattern of `src/**.rs` and + `!foo.rs` would match all files with the `.rs` extension inside the `src` + directory, except for any file named `foo.rs`. -If a VCS is being used for a package, the `exclude` field will be seeded with -the VCS’ ignore settings (`.gitignore` for git for example). +If git is being used for a package, the `exclude` field will be seeded with +the `gitignore` settings from the repository. ```toml [package] @@ -145,23 +169,17 @@ The options are mutually exclusive: setting `include` will override an `exclude`. Note that `include` must be an exhaustive list of files as otherwise -necessary source files may not be included. +necessary source files may not be included. The package's `Cargo.toml` is +automatically included. -[globs]: https://docs.rs/glob/0.2.11/glob/struct.Pattern.html - -#### Migrating to `gitignore`-like pattern matching +The include/exclude list is also used for change tracking in some situations. +For targets built with `rustdoc`, it is used to determine the list of files to +track to determine if the target should be rebuilt. If the package has a +[build script] that does not emit any `rerun-if-*` directives, then the +include/exclude list is used for tracking if the build script should be re-run +if any of those files change. -The current interpretation of these configs is based on UNIX Globs, as -implemented in the [`glob` crate](https://crates.io/crates/glob). We want -Cargo's `include` and `exclude` configs to work as similar to `gitignore` as -possible. [The `gitignore` specification](https://git-scm.com/docs/gitignore) is -also based on Globs, but has a bunch of additional features that enable easier -pattern writing and more control. Therefore, we are migrating the interpretation -for the rules of these configs to use the [`ignore` -crate](https://crates.io/crates/ignore), and treat them each rule as a single -line in a `gitignore` file. See [the tracking -issue](https://github.com/rust-lang/cargo/issues/4268) for more details on the -migration. +[gitignore]: https://git-scm.com/docs/gitignore #### The `publish` field (optional) @@ -298,9 +316,21 @@ # Is it maintained percentage of open issues: `repository` is required. is-it-maintained-open-issues = { repository = "..." } -# Maintenance: `status` is required. Available options are `actively-developed`, -# `passively-maintained`, `as-is`, `experimental`, `looking-for-maintainer`, -# `deprecated`, and the default `none`, which displays no badge on crates.io. +# Maintenance: `status` is required. Available options are: +# - `actively-developed`: New features are being added and bugs are being fixed. +# - `passively-maintained`: There are no plans for new features, but the maintainer intends to +# respond to issues that get filed. +# - `as-is`: The crate is feature complete, the maintainer does not intend to continue working on +# it or providing support, but it works for the purposes it was designed for. +# - `experimental`: The author wants to share it with the community but is not intending to meet +# anyone's particular use case. +# - `looking-for-maintainer`: The current maintainer would like to transfer the crate to someone +# else. +# - `deprecated`: The maintainer does not recommend using this crate (the description of the crate +# can describe why, there could be a better solution available or there could be problems with +# the crate that the author does not want to fix). +# - `none`: Displays no badge on crates.io, since the maintainer has not chosen to specify +# their intentions, potential crate users will need to investigate on their own. maintenance = { status = "..." } ``` @@ -602,6 +632,8 @@ Most of the time workspaces will not need to be dealt with as `cargo new` and `cargo init` will handle workspace configuration automatically. +[globs]: https://docs.rs/glob/0.2.11/glob/struct.Pattern.html + #### Virtual Manifest In workspace manifests, if the `package` table is present, the workspace root @@ -636,10 +668,6 @@ executable consists of more than just one source file, you might also use a directory inside `src/bin` containing a `main.rs` file which will be treated as an executable with a name of the parent directory. -Do note, however, once you add a `[[bin]]` section ([see -below](#configuring-a-target)), Cargo will no longer automatically build files -located in `src/bin/*.rs`. Instead you must create a `[[bin]]` section for -each file you want to build. Your package can optionally contain folders named `examples`, `tests`, and `benches`, which Cargo will treat as containing examples, @@ -670,7 +698,13 @@ To structure your code after you've created the files and folders for your package, you should remember to use Rust's module system, which you can read -about in [the book](https://doc.rust-lang.org/book/crates-and-modules.html). +about in [the +book](../book/ch07-00-managing-growing-projects-with-packages-crates-and-modules.html). + +See [Configuring a target](#configuring-a-target) below for more details on +manually configuring target settings. See [Target +auto-discovery](#target-auto-discovery) below for more information on +controlling how Cargo automatically infers targets. ### Examples @@ -686,7 +720,7 @@ Specify `crate-type` to make an example be compiled as a library (additional information about crate types is available in -[The Rust Reference](https://doc.rust-lang.org/reference/linkage.html)): +[The Rust Reference](../reference/linkage.html)): ```toml [[example]] @@ -788,9 +822,45 @@ path = "src/my-cool-binary.rs" ``` -The `[package]` also includes the optional `autobins`, `autoexamples`, -`autotests`, and `autobenches` keys to explicitly opt-in or opt-out of -auto-discovering specific target kinds. +#### Target auto-discovery + +By default, Cargo automatically determines the targets to build based on the +[layout of the files](#the-project-layout) on the filesystem. The target +configuration tables, such as `[lib]`, `[[bin]]`, `[[test]]`, `[[bench]]`, or +`[[example]]`, can be used to add additional targets that don't follow the +standard directory layout. + +The automatic target discovery can be disabled so that only manually +configured targets will be built. Setting the keys `autobins`, `autoexamples`, +`autotests`, or `autobenches` to `false` in the `[package]` section will +disable auto-discovery of the corresponding target type. + +Disabling automatic discovery should only be needed for specialized +situations. For example, if you have a library where you want a *module* named +`bin`, this would present a problem because Cargo would usually attempt to +compile anything in the `bin` directory as an executable. Here is a sample +layout of this scenario: + +``` +├── Cargo.toml +└── src +    ├── lib.rs +    └── bin +       └── mod.rs +``` + +To prevent Cargo from inferring `src/bin/mod.rs` as an executable, set +`autobins = false` in `Cargo.toml` to disable auto-discovery: + +```toml +[package] +# … +autobins = false +``` + +> **Note**: For packages with the 2015 edition, the default for auto-discovery +> is `false` if at least one target is manually defined in `Cargo.toml`. +> Beginning with the 2018 edition, the default is always `true`. #### The `required-features` field (optional) @@ -828,7 +898,7 @@ `proc-macro`. You can read more about the different crate types in the -[Rust Reference Manual](https://doc.rust-lang.org/reference/linkage.html) +[Rust Reference Manual](../reference/linkage.html) ### The `[patch]` Section diff -Nru cargo-0.35.0/src/doc/src/reference/pkgid-spec.md cargo-0.37.0/src/doc/src/reference/pkgid-spec.md --- cargo-0.35.0/src/doc/src/reference/pkgid-spec.md 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/src/reference/pkgid-spec.md 2019-05-15 19:48:47.000000000 +0000 @@ -34,7 +34,7 @@ | `crates.io/foo` | `foo` | `*` | `*://crates.io/foo` | | `crates.io/foo#1.2.3` | `foo` | `1.2.3` | `*://crates.io/foo` | | `crates.io/bar#foo:1.2.3` | `foo` | `1.2.3` | `*://crates.io/bar` | -| `http://crates.io/foo#1.2.3` | `foo` | `1.2.3` | `http://crates.io/foo` | +| `https://crates.io/foo#1.2.3`| `foo` | `1.2.3` | `https://crates.io/foo` | #### Brevity of specifications diff -Nru cargo-0.35.0/src/doc/src/reference/registries.md cargo-0.37.0/src/doc/src/reference/registries.md --- cargo-0.35.0/src/doc/src/reference/registries.md 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/src/reference/registries.md 2019-05-15 19:48:47.000000000 +0000 @@ -130,7 +130,7 @@ may have the markers `{crate}` and `{version}` which are replaced with the name and version of the crate to download. If the markers are not present, then the value `/{crate}/{version}/download` is appended to the end. -- `api`: This is the base URL for the web API. This key is optional, and if it +- `api`: This is the base URL for the web API. This key is optional, but if it is not specified, commands such as [`cargo publish`] will not work. The web API is described below. @@ -584,7 +584,7 @@ [`cargo login`]: commands/cargo-login.html [`cargo package`]: commands/cargo-package.html [`cargo publish`]: commands/cargo-publish.html -[alphanumeric]: https://doc.rust-lang.org/std/primitive.char.html#method.is_alphanumeric +[alphanumeric]: ../std/primitive.char.html#method.is_alphanumeric [config]: reference/config.html [crates.io]: https://crates.io/ [publishing documentation]: reference/publishing.html#cargo-owner diff -Nru cargo-0.35.0/src/doc/src/reference/source-replacement.md cargo-0.37.0/src/doc/src/reference/source-replacement.md --- cargo-0.35.0/src/doc/src/reference/source-replacement.md 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/src/reference/source-replacement.md 2019-05-15 19:48:47.000000000 +0000 @@ -4,42 +4,9 @@ dependencies in the [overriding dependencies][overriding] section of this documentation. -Cargo supports the ability to **replace one source with another** to express -strategies along the lines of mirrors or vendoring dependencies. Configuration -is currently done through the [`.cargo/config` configuration][config] mechanism, -like so: - -[config]: reference/config.html - -```toml -# The `source` table is where all keys related to source-replacement -# are stored. -[source] - -# Under the `source` table are a number of other tables whose keys are a -# name for the relevant source. For example this section defines a new -# source, called `my-awesome-source`, which comes from a directory -# located at `vendor` relative to the directory containing this `.cargo/config` -# file -[source.my-awesome-source] -directory = "vendor" - -# Git sources can optionally specify a branch/tag/rev as well -git = "https://example.com/path/to/repo" -# branch = "master" -# tag = "v1.0.1" -# rev = "313f44e8" - -# The crates.io default source for crates is available under the name -# "crates-io", and here we use the `replace-with` key to indicate that it's -# replaced with our source above. -[source.crates-io] -replace-with = "my-awesome-source" -``` - -With this configuration Cargo attempts to look up all crates in the directory -"vendor" rather than querying the online registry at crates.io. Using source -replacement Cargo can express: +A *source* is a provider that contains crates that may be included as +dependencies for a package. Cargo supports the ability to **replace one source +with another** to express strategies such as: * Vendoring - custom sources can be defined which represent crates on the local filesystem. These sources are subsets of the source that they're replacing and @@ -49,18 +16,18 @@ cache for crates.io itself. Cargo has a core assumption about source replacement that the source code is -exactly the same from both sources. In our above example Cargo assumes that all -of the crates coming from `my-awesome-source` are the exact same as the copies -from `crates-io`. Note that this also means that `my-awesome-source` is not -allowed to have crates which are not present in the `crates-io` source. +exactly the same from both sources. Note that this also means that +a replacement source is not allowed to have crates which are not present in the +original source. As a consequence, source replacement is not appropriate for situations such as patching a dependency or a private registry. Cargo supports patching dependencies through the usage of [the `[replace]` key][replace-section], and -private registry support is planned for a future version of Cargo. +private registry support is described in [Registries][registries]. [replace-section]: reference/manifest.html#the-replace-section [overriding]: reference/specifying-dependencies.html#overriding-dependencies +[registries]: reference/registries.html ### Configuration @@ -68,6 +35,24 @@ and the full set of available keys are: ```toml +# The `source` table is where all keys related to source-replacement +# are stored. +[source] + +# Under the `source` table are a number of other tables whose keys are a +# name for the relevant source. For example this section defines a new +# source, called `my-vendor-source`, which comes from a directory +# located at `vendor` relative to the directory containing this `.cargo/config` +# file +[source.my-vendor-source] +directory = "vendor" + +# The crates.io default source for crates is available under the name +# "crates-io", and here we use the `replace-with` key to indicate that it's +# replaced with our source above. +[source.crates-io] +replace-with = "my-vendor-source" + # Each source has its own table where the key is the name of the source [source.the-source-name] @@ -75,20 +60,20 @@ # defined elsewhere replace-with = "another-source" -# Available kinds of sources that can be specified (described below) +# Several kinds of sources can be specified (described in more detail below): registry = "https://example.com/path/to/index" local-registry = "path/to/registry" directory = "path/to/vendor" -``` - -The `crates-io` represents the crates.io online registry (default source of -crates) and can be replaced with: -```toml -[source.crates-io] -replace-with = 'another-source' +# Git sources can optionally specify a branch/tag/rev as well +git = "https://example.com/path/to/repo" +# branch = "master" +# tag = "v1.0.1" +# rev = "313f44e8" ``` +[config]: reference/config.html + ### Registry Sources A "registry source" is one that is the same as crates.io itself. That is, it has @@ -107,8 +92,9 @@ made up of a set of `*.crate` files and an index like the normal registry is. The primary way to manage and create local registry sources is through the -[`cargo-local-registry`][cargo-local-registry] subcommand, available on -crates.io and can be installed with `cargo install cargo-local-registry`. +[`cargo-local-registry`][cargo-local-registry] subcommand, +[available on crates.io][cargo-local-registry] and can be installed with +`cargo install cargo-local-registry`. [cargo-local-registry]: https://crates.io/crates/cargo-local-registry @@ -122,7 +108,8 @@ A "directory source" is similar to a local registry source where it contains a number of crates available on the local filesystem, suitable for vendoring dependencies. Also like local registries, directory sources can primarily be -managed by an external subcommand, [`cargo-vendor`][cargo-vendor], which can be +managed by an external subcommand, [`cargo-vendor`][cargo-vendor], +[available on crates.io][cargo-vendor] and can be installed with `cargo install cargo-vendor`. [cargo-vendor]: https://crates.io/crates/cargo-vendor diff -Nru cargo-0.35.0/src/doc/src/reference/specifying-dependencies.md cargo-0.37.0/src/doc/src/reference/specifying-dependencies.md --- cargo-0.35.0/src/doc/src/reference/specifying-dependencies.md 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/src/reference/specifying-dependencies.md 2019-05-15 19:48:47.000000000 +0000 @@ -40,14 +40,14 @@ be allowed with them: ```notrust -^1.2.3 := >=1.2.3 <2.0.0 -^1.2 := >=1.2.0 <2.0.0 -^1 := >=1.0.0 <2.0.0 -^0.2.3 := >=0.2.3 <0.3.0 -^0.2 := >= 0.2.0 < 0.3.0 -^0.0.3 := >=0.0.3 <0.0.4 -^0.0 := >=0.0.0 <0.1.0 -^0 := >=0.0.0 <1.0.0 +^1.2.3 := >=1.2.3 <2.0.0 +^1.2 := >=1.2.0 <2.0.0 +^1 := >=1.0.0 <2.0.0 +^0.2.3 := >=0.2.3 <0.3.0 +^0.2 := >=0.2.0 <0.3.0 +^0.0.3 := >=0.0.3 <0.0.4 +^0.0 := >=0.0.0 <0.1.0 +^0 := >=0.0.0 <1.0.0 ``` This compatibility convention is different from SemVer in the way it treats @@ -65,9 +65,9 @@ `~1.2.3` is an example of a tilde requirement. ```notrust -~1.2.3 := >=1.2.3 <1.3.0 -~1.2 := >=1.2.0 <1.3.0 -~1 := >=1.0.0 <2.0.0 +~1.2.3 := >=1.2.3 <1.3.0 +~1.2 := >=1.2.0 <1.3.0 +~1 := >=1.0.0 <2.0.0 ``` ### Wildcard requirements @@ -78,8 +78,8 @@ `*`, `1.*` and `1.2.*` are examples of wildcard requirements. ```notrust -* := >=0.0.0 -1.* := >=1.0.0 <2.0.0 +* := >=0.0.0 +1.* := >=1.0.0 <2.0.0 1.2.* := >=1.2.0 <1.3.0 ``` diff -Nru cargo-0.35.0/src/doc/src/reference/unstable.md cargo-0.37.0/src/doc/src/reference/unstable.md --- cargo-0.35.0/src/doc/src/reference/unstable.md 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/doc/src/reference/unstable.md 2019-05-15 19:48:47.000000000 +0000 @@ -30,19 +30,6 @@ publish-lockfile = true ``` - -### Offline Mode -* Original Issue: [#4686](https://github.com/rust-lang/cargo/issues/4686) -* Tracking Issue: [#5655](https://github.com/rust-lang/cargo/issues/5655) - -The `-Z offline` flag prevents Cargo from attempting to access the network for -any reason. Typically Cargo will stop with an error if it wants to access the -network and it is not available. - -Beware that this may result in different dependency resolution than online -mode. Cargo will restrict itself to crates that are available locally, even -if there might be a newer version as indicated in the local copy of the index. - ### no-index-update * Original Issue: [#3479](https://github.com/rust-lang/cargo/issues/3479) @@ -77,6 +64,7 @@ ### out-dir * Original Issue: [#4875](https://github.com/rust-lang/cargo/issues/4875) +* Tracking Issue: [#6790](https://github.com/rust-lang/cargo/issues/6790) This feature allows you to specify the directory where artifacts will be copied to after they are built. Typically artifacts are only written to the @@ -117,8 +105,9 @@ [profile.dev.overrides."*"] opt-level = 2 -# Build scripts and their dependencies will be compiled with -Copt-level=3 -# By default, build scripts use the same rules as the rest of the profile +# Build scripts or proc-macros and their dependencies will be compiled with +# `-Copt-level=3`. By default, they use the same rules as the rest of the +# profile. [profile.dev.build-override] opt-level = 3 ``` @@ -148,7 +137,7 @@ ### Namespaced features * Original issue: [#1286](https://github.com/rust-lang/cargo/issues/1286) -* Tracking Issue: [rust-lang/cargo#5565](https://github.com/rust-lang/cargo/issues/5565) +* Tracking Issue: [#5565](https://github.com/rust-lang/cargo/issues/5565) Currently, it is not possible to have a feature and a dependency with the same name in the manifest. If you set `namespaced-features` to `true`, the namespaces @@ -175,7 +164,7 @@ ### Build-plan -* Tracking Issue: [rust-lang/cargo#5579](https://github.com/rust-lang/cargo/issues/5579) +* Tracking Issue: [#5579](https://github.com/rust-lang/cargo/issues/5579) The `--build-plan` argument for the `build` command will output JSON with information about which commands would be run without actually executing @@ -230,3 +219,52 @@ Metabuild packages should have a public function called `metabuild` that performs the same actions as a regular `build.rs` script would perform. + +### install-upgrade +* Tracking Issue: [#6797](https://github.com/rust-lang/cargo/issues/6797) + +The `install-upgrade` feature changes the behavior of `cargo install` so that +it will reinstall a package if it is not "up-to-date". If it is "up-to-date", +it will do nothing and exit with success instead of failing. Example: + +``` +cargo +nightly install foo -Z install-upgrade +``` + +Cargo tracks some information to determine if a package is "up-to-date", +including: + +- The package version and source. +- The set of binary names installed. +- The chosen features. +- The release mode (`--debug`). +- The target (`--target`). + +If any of these values change, then Cargo will reinstall the package. + +Installation will still fail if a different package installs a binary of the +same name. `--force` may be used to unconditionally reinstall the package. + +Installing with `--path` will always build and install, unless there are +conflicting binaries from another package. + +Additionally, a new flag `--no-track` is available to prevent `cargo install` +from writing tracking information in `$CARGO_HOME` about which packages are +installed. + +### public-dependency +* Tracking Issue: [#44663](https://github.com/rust-lang/rust/issues/44663) + +The 'public-dependency' features allows marking dependencies as 'public' +or 'private'. When this feature is enabled, additional information is passed to rustc to allow +the 'exported_private_dependencies' lint to function properly. + +This requires the appropriate key to be set in `cargo-features`: + +```toml +cargo-features = ["public-dependency"] + +[dependencies] +my_dep = { version = "1.2.3", public = true } +private_dep = "2.0.0" # Will be 'private' by default +``` diff -Nru cargo-0.35.0/src/etc/_cargo cargo-0.37.0/src/etc/_cargo --- cargo-0.35.0/src/etc/_cargo 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/_cargo 2019-05-15 19:48:47.000000000 +0000 @@ -106,6 +106,7 @@ '--manifest-path=[path to manifest]: :_files -/' \ '--no-deps[do not build docs for dependencies]' \ '--no-default-features[do not build the default features]' \ + '--document-private-items[include non-public items in the documentation]' \ '--open[open docs in browser after the build]' \ '(-p, --package)'{-p,--package}'=[package to document]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ @@ -151,7 +152,7 @@ init) _arguments \ - '--bin[use binary template]' \ + '--lib[use library template]' \ '--vcs:initialize a new repo with a given VCS:(git hg none)' \ '(-h, --help)'{-h,--help}'[show help message]' \ '--name=[set the resulting package name]' \ @@ -213,7 +214,7 @@ new) _arguments \ - '--bin[use binary template]' \ + '--lib[use library template]' \ '--vcs:initialize a new repo with a given VCS:(git hg none)' \ '(-h, --help)'{-h,--help}'[show help message]' \ '--name=[set the resulting package name]' \ @@ -321,6 +322,7 @@ '(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \ '--manifest-path=[path to the manifest to document]: :_files -/' \ '--no-default-features[do not build the `default` feature]' \ + '--document-private-items[include non-public items in the documentation]' \ '--open[open the docs in a browser after the operation]' \ '(-p, --package)'{-p,--package}'=[package to document]' \ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ diff -Nru cargo-0.35.0/src/etc/cargo.bashcomp.sh cargo-0.37.0/src/etc/cargo.bashcomp.sh --- cargo-0.35.0/src/etc/cargo.bashcomp.sh 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/cargo.bashcomp.sh 2019-05-15 19:48:47.000000000 +0000 @@ -1,3 +1,7 @@ +# Required for bash versions < 4.1 +# Default bash version is 3.2 on latest macOS. See #6874 +shopt -s extglob + command -v cargo >/dev/null 2>&1 && _cargo() { diff -Nru cargo-0.35.0/src/etc/man/cargo.1 cargo-0.37.0/src/etc/man/cargo.1 --- cargo-0.35.0/src/etc/man/cargo.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo.1 2019-05-15 19:48:47.000000000 +0000 @@ -44,7 +44,7 @@ .sp This program is a package manager and build tool for the Rust language, available at \c -.URL "http://rust\-lang.org" "" "." +.URL "https://rust\-lang.org" "" "." .SH "COMMANDS" .SS "Build Commands" .sp diff -Nru cargo-0.35.0/src/etc/man/cargo-bench.1 cargo-0.37.0/src/etc/man/cargo-bench.1 --- cargo-0.35.0/src/etc/man/cargo-bench.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo-bench.1 2019-05-15 19:48:47.000000000 +0000 @@ -2,12 +2,12 @@ .\" Title: cargo-bench .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 1.5.8 -.\" Date: 2018-12-23 +.\" Date: 2019-05-08 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "CARGO\-BENCH" "1" "2018-12-23" "\ \&" "\ \&" +.TH "CARGO\-BENCH" "1" "2019-05-08" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -401,6 +401,23 @@ \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network access. .RE +.sp +\fB\-\-offline\fP +.RS 4 +Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible. +.sp +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the \fBcargo\-fetch\fP(1) command to download dependencies before going +offline. +.sp +May also be specified with the \fBnet.offline\fP \c +.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." +.RE .SS "Common Options" .sp \fB\-h\fP, \fB\-\-help\fP diff -Nru cargo-0.35.0/src/etc/man/cargo-build.1 cargo-0.37.0/src/etc/man/cargo-build.1 --- cargo-0.35.0/src/etc/man/cargo-build.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo-build.1 2019-05-15 19:48:47.000000000 +0000 @@ -2,12 +2,12 @@ .\" Title: cargo-build .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 1.5.8 -.\" Date: 2018-12-20 +.\" Date: 2019-05-08 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "CARGO\-BUILD" "1" "2018-12-20" "\ \&" "\ \&" +.TH "CARGO\-BUILD" "1" "2019-05-08" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -189,8 +189,13 @@ .RS 4 Copy final artifacts to this directory. .sp -This option is unstable and available only on the nightly channel and requires -the \fB\-Z unstable\-options\fP flag to enable. +This option is unstable and available only on the +\c +.URL "https://doc.rust\-lang.org/book/appendix\-07\-nightly\-rust.html" "nightly channel" +and requires the \fB\-Z unstable\-options\fP flag to enable. +See \c +.URL "https://github.com/rust\-lang/cargo/issues/6790" "" " " +for more information. .RE .SS "Display Options" .sp @@ -292,8 +297,13 @@ Outputs a series of JSON messages to stdout that indicate the commands to run the build. .sp -This option is unstable and available only on the nightly channel and requires -the \fB\-Z unstable\-options\fP flag to enable. +This option is unstable and available only on the +\c +.URL "https://doc.rust\-lang.org/book/appendix\-07\-nightly\-rust.html" "nightly channel" +and requires the \fB\-Z unstable\-options\fP flag to enable. +See \c +.URL "https://github.com/rust\-lang/cargo/issues/5579" "" " " +for more information. .RE .SS "Manifest Options" .sp @@ -314,6 +324,23 @@ \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network access. .RE +.sp +\fB\-\-offline\fP +.RS 4 +Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible. +.sp +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the \fBcargo\-fetch\fP(1) command to download dependencies before going +offline. +.sp +May also be specified with the \fBnet.offline\fP \c +.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." +.RE .SS "Common Options" .sp \fB\-h\fP, \fB\-\-help\fP diff -Nru cargo-0.35.0/src/etc/man/cargo-check.1 cargo-0.37.0/src/etc/man/cargo-check.1 --- cargo-0.35.0/src/etc/man/cargo-check.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo-check.1 2019-05-15 19:48:47.000000000 +0000 @@ -2,12 +2,12 @@ .\" Title: cargo-check .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 1.5.8 -.\" Date: 2018-12-20 +.\" Date: 2019-04-16 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "CARGO\-CHECK" "1" "2018-12-20" "\ \&" "\ \&" +.TH "CARGO\-CHECK" "1" "2019-04-16" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -310,6 +310,23 @@ \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network access. .RE +.sp +\fB\-\-offline\fP +.RS 4 +Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible. +.sp +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the \fBcargo\-fetch\fP(1) command to download dependencies before going +offline. +.sp +May also be specified with the \fBnet.offline\fP \c +.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." +.RE .SS "Common Options" .sp \fB\-h\fP, \fB\-\-help\fP diff -Nru cargo-0.35.0/src/etc/man/cargo-clean.1 cargo-0.37.0/src/etc/man/cargo-clean.1 --- cargo-0.35.0/src/etc/man/cargo-clean.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo-clean.1 2019-05-15 19:48:47.000000000 +0000 @@ -2,12 +2,12 @@ .\" Title: cargo-clean .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 1.5.8 -.\" Date: 2018-12-20 +.\" Date: 2019-04-16 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "CARGO\-CLEAN" "1" "2018-12-20" "\ \&" "\ \&" +.TH "CARGO\-CLEAN" "1" "2019-04-16" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -158,6 +158,23 @@ \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network access. .RE +.sp +\fB\-\-offline\fP +.RS 4 +Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible. +.sp +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the \fBcargo\-fetch\fP(1) command to download dependencies before going +offline. +.sp +May also be specified with the \fBnet.offline\fP \c +.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." +.RE .SS "Common Options" .sp \fB\-h\fP, \fB\-\-help\fP diff -Nru cargo-0.35.0/src/etc/man/cargo-doc.1 cargo-0.37.0/src/etc/man/cargo-doc.1 --- cargo-0.35.0/src/etc/man/cargo-doc.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo-doc.1 2019-05-15 19:48:47.000000000 +0000 @@ -2,12 +2,12 @@ .\" Title: cargo-doc .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 1.5.8 -.\" Date: 2018-12-20 +.\" Date: 2019-04-16 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "CARGO\-DOC" "1" "2018-12-20" "\ \&" "\ \&" +.TH "CARGO\-DOC" "1" "2019-04-16" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -267,6 +267,23 @@ \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network access. .RE +.sp +\fB\-\-offline\fP +.RS 4 +Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible. +.sp +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the \fBcargo\-fetch\fP(1) command to download dependencies before going +offline. +.sp +May also be specified with the \fBnet.offline\fP \c +.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." +.RE .SS "Common Options" .sp \fB\-h\fP, \fB\-\-help\fP diff -Nru cargo-0.35.0/src/etc/man/cargo-fetch.1 cargo-0.37.0/src/etc/man/cargo-fetch.1 --- cargo-0.35.0/src/etc/man/cargo-fetch.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo-fetch.1 2019-05-15 19:48:47.000000000 +0000 @@ -2,12 +2,12 @@ .\" Title: cargo-fetch .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 1.5.8 -.\" Date: 2018-12-20 +.\" Date: 2019-05-12 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "CARGO\-FETCH" "1" "2018-12-20" "\ \&" "\ \&" +.TH "CARGO\-FETCH" "1" "2019-05-12" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -43,6 +43,11 @@ file before fetching the dependencies. .sp If \fB\-\-target\fP is not specified, then all target dependencies are fetched. +.sp +See also the \c +.URL "https://crates.io/crates/cargo\-prefetch" "cargo\-prefetch" +plugin which adds a command to download popular crates. This may be useful if +you plan to use Cargo without a network with the \fB\-\-offline\fP flag. .SH "OPTIONS" .SS "Fetch options" .sp @@ -131,6 +136,23 @@ \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network access. .RE +.sp +\fB\-\-offline\fP +.RS 4 +Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible. +.sp +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the \fBcargo\-fetch\fP(1) command to download dependencies before going +offline. +.sp +May also be specified with the \fBnet.offline\fP \c +.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." +.RE .SS "Common Options" .sp \fB\-h\fP, \fB\-\-help\fP diff -Nru cargo-0.35.0/src/etc/man/cargo-fix.1 cargo-0.37.0/src/etc/man/cargo-fix.1 --- cargo-0.35.0/src/etc/man/cargo-fix.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo-fix.1 2019-05-15 19:48:47.000000000 +0000 @@ -2,12 +2,12 @@ .\" Title: cargo-fix .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 1.5.8 -.\" Date: 2018-12-20 +.\" Date: 2019-04-16 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "CARGO\-FIX" "1" "2018-12-20" "\ \&" "\ \&" +.TH "CARGO\-FIX" "1" "2019-04-16" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -380,6 +380,23 @@ \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network access. .RE +.sp +\fB\-\-offline\fP +.RS 4 +Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible. +.sp +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the \fBcargo\-fetch\fP(1) command to download dependencies before going +offline. +.sp +May also be specified with the \fBnet.offline\fP \c +.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." +.RE .SS "Common Options" .sp \fB\-h\fP, \fB\-\-help\fP diff -Nru cargo-0.35.0/src/etc/man/cargo-generate-lockfile.1 cargo-0.37.0/src/etc/man/cargo-generate-lockfile.1 --- cargo-0.35.0/src/etc/man/cargo-generate-lockfile.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo-generate-lockfile.1 2019-05-15 19:48:47.000000000 +0000 @@ -2,12 +2,12 @@ .\" Title: cargo-generate-lockfile .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 1.5.8 -.\" Date: 2018-12-20 +.\" Date: 2019-04-16 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "CARGO\-GENERATE\-LOCKFILE" "1" "2018-12-20" "\ \&" "\ \&" +.TH "CARGO\-GENERATE\-LOCKFILE" "1" "2019-04-16" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -116,6 +116,23 @@ \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network access. .RE +.sp +\fB\-\-offline\fP +.RS 4 +Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible. +.sp +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the \fBcargo\-fetch\fP(1) command to download dependencies before going +offline. +.sp +May also be specified with the \fBnet.offline\fP \c +.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." +.RE .SS "Common Options" .sp \fB\-h\fP, \fB\-\-help\fP diff -Nru cargo-0.35.0/src/etc/man/cargo-install.1 cargo-0.37.0/src/etc/man/cargo-install.1 --- cargo-0.35.0/src/etc/man/cargo-install.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo-install.1 2019-05-15 19:48:47.000000000 +0000 @@ -2,12 +2,12 @@ .\" Title: cargo-install .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 1.5.8 -.\" Date: 2019-01-23 +.\" Date: 2019-05-12 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "CARGO\-INSTALL" "1" "2019-01-23" "\ \&" "\ \&" +.TH "CARGO\-INSTALL" "1" "2019-05-12" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -103,10 +103,10 @@ .RE .sp There are multiple sources from which a crate can be installed. The default -location is crates.io but the \fB\-\-git\fP and \fB\-\-path\fP flags can change this -source. If the source contains more than one package (such as crates.io or a -git repository with multiple crates) the \fICRATE\fP argument is required to -indicate which crate should be installed. +location is crates.io but the \fB\-\-git\fP, \fB\-\-path\fP, and \fBregistry\fP flags can +change this source. If the source contains more than one package (such as +crates.io or a git repository with multiple crates) the \fICRATE\fP argument is +required to indicate which crate should be installed. .sp Crates from crates.io can optionally specify the version they wish to install via the \fB\-\-version\fP flags, and similarly packages from git repositories can @@ -125,7 +125,7 @@ .sp \fB\-\-vers\fP \fIVERSION\fP, \fB\-\-version\fP \fIVERSION\fP .RS 4 -Specify a version to install from crates.io. +Specify a version to install. .RE .sp \fB\-\-git\fP \fIURL\fP @@ -235,6 +235,36 @@ .RS 4 Build with the \fBdev\fP profile instead the \fBrelease\fP profile. .RE +.SS "Manifest Options" +.sp +\fB\-\-frozen\fP, \fB\-\-locked\fP +.RS 4 +Either of these flags requires that the \fBCargo.lock\fP file is +up\-to\-date. If the lock file is missing, or it needs to be updated, Cargo will +exit with an error. The \fB\-\-frozen\fP flag also prevents Cargo from +attempting to access the network to determine if it is out\-of\-date. +.sp +These may be used in environments where you want to assert that the +\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network +access. +.RE +.sp +\fB\-\-offline\fP +.RS 4 +Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible. +.sp +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the \fBcargo\-fetch\fP(1) command to download dependencies before going +offline. +.sp +May also be specified with the \fBnet.offline\fP \c +.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." +.RE .SS "Miscellaneous Options" .sp \fB\-j\fP \fIN\fP, \fB\-\-jobs\fP \fIN\fP diff -Nru cargo-0.35.0/src/etc/man/cargo-metadata.1 cargo-0.37.0/src/etc/man/cargo-metadata.1 --- cargo-0.35.0/src/etc/man/cargo-metadata.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo-metadata.1 2019-05-15 19:48:47.000000000 +0000 @@ -2,12 +2,12 @@ .\" Title: cargo-metadata .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 1.5.8 -.\" Date: 2019-01-05 +.\" Date: 2019-05-08 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "CARGO\-METADATA" "1" "2019-01-05" "\ \&" "\ \&" +.TH "CARGO\-METADATA" "1" "2019-05-08" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -233,7 +233,7 @@ */ "deps": [ { - /* The name of the dependency. + /* The name of the dependency\(aqs library target. If this is a renamed dependency, this is the new name. */ @@ -376,6 +376,23 @@ \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network access. .RE +.sp +\fB\-\-offline\fP +.RS 4 +Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible. +.sp +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the \fBcargo\-fetch\fP(1) command to download dependencies before going +offline. +.sp +May also be specified with the \fBnet.offline\fP \c +.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." +.RE .SS "Common Options" .sp \fB\-h\fP, \fB\-\-help\fP diff -Nru cargo-0.35.0/src/etc/man/cargo-pkgid.1 cargo-0.37.0/src/etc/man/cargo-pkgid.1 --- cargo-0.35.0/src/etc/man/cargo-pkgid.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo-pkgid.1 2019-05-15 19:48:47.000000000 +0000 @@ -2,12 +2,12 @@ .\" Title: cargo-pkgid .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 1.5.8 -.\" Date: 2018-12-20 +.\" Date: 2019-04-16 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "CARGO\-PKGID" "1" "2018-12-20" "\ \&" "\ \&" +.TH "CARGO\-PKGID" "1" "2019-04-16" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -193,6 +193,23 @@ \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network access. .RE +.sp +\fB\-\-offline\fP +.RS 4 +Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible. +.sp +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the \fBcargo\-fetch\fP(1) command to download dependencies before going +offline. +.sp +May also be specified with the \fBnet.offline\fP \c +.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." +.RE .SS "Common Options" .sp \fB\-h\fP, \fB\-\-help\fP diff -Nru cargo-0.35.0/src/etc/man/cargo-publish.1 cargo-0.37.0/src/etc/man/cargo-publish.1 --- cargo-0.35.0/src/etc/man/cargo-publish.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo-publish.1 2019-05-15 19:48:47.000000000 +0000 @@ -2,12 +2,12 @@ .\" Title: cargo-publish .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 1.5.8 -.\" Date: 2019-02-13 +.\" Date: 2019-05-08 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "CARGO\-PUBLISH" "1" "2019-02-13" "\ \&" "\ \&" +.TH "CARGO\-PUBLISH" "1" "2019-05-08" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -31,7 +31,7 @@ cargo\-publish \- Upload a package to the registry .SH "SYNOPSIS" .sp -\fBcargo package [\fIOPTIONS\fP]\fP +\fBcargo publish [\fIOPTIONS\fP]\fP .SH "DESCRIPTION" .sp This command will create a distributable, compressed \fB.crate\fP file with the @@ -201,6 +201,23 @@ \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network access. .RE +.sp +\fB\-\-offline\fP +.RS 4 +Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible. +.sp +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the \fBcargo\-fetch\fP(1) command to download dependencies before going +offline. +.sp +May also be specified with the \fBnet.offline\fP \c +.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." +.RE .SS "Miscellaneous Options" .sp \fB\-j\fP \fIN\fP, \fB\-\-jobs\fP \fIN\fP diff -Nru cargo-0.35.0/src/etc/man/cargo-run.1 cargo-0.37.0/src/etc/man/cargo-run.1 --- cargo-0.35.0/src/etc/man/cargo-run.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo-run.1 2019-05-15 19:48:47.000000000 +0000 @@ -2,12 +2,12 @@ .\" Title: cargo-run .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 1.5.8 -.\" Date: 2019-02-05 +.\" Date: 2019-05-08 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "CARGO\-RUN" "1" "2019-02-05" "\ \&" "\ \&" +.TH "CARGO\-RUN" "1" "2019-05-08" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -229,6 +229,23 @@ \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network access. .RE +.sp +\fB\-\-offline\fP +.RS 4 +Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible. +.sp +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the \fBcargo\-fetch\fP(1) command to download dependencies before going +offline. +.sp +May also be specified with the \fBnet.offline\fP \c +.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." +.RE .SS "Common Options" .sp \fB\-h\fP, \fB\-\-help\fP diff -Nru cargo-0.35.0/src/etc/man/cargo-rustc.1 cargo-0.37.0/src/etc/man/cargo-rustc.1 --- cargo-0.35.0/src/etc/man/cargo-rustc.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo-rustc.1 2019-05-15 19:48:47.000000000 +0000 @@ -2,12 +2,12 @@ .\" Title: cargo-rustc .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 1.5.8 -.\" Date: 2018-12-20 +.\" Date: 2019-04-16 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "CARGO\-RUSTC" "1" "2018-12-20" "\ \&" "\ \&" +.TH "CARGO\-RUSTC" "1" "2019-04-16" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -299,6 +299,23 @@ \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network access. .RE +.sp +\fB\-\-offline\fP +.RS 4 +Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible. +.sp +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the \fBcargo\-fetch\fP(1) command to download dependencies before going +offline. +.sp +May also be specified with the \fBnet.offline\fP \c +.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." +.RE .SS "Common Options" .sp \fB\-h\fP, \fB\-\-help\fP diff -Nru cargo-0.35.0/src/etc/man/cargo-rustdoc.1 cargo-0.37.0/src/etc/man/cargo-rustdoc.1 --- cargo-0.35.0/src/etc/man/cargo-rustdoc.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo-rustdoc.1 2019-05-15 19:48:47.000000000 +0000 @@ -2,12 +2,12 @@ .\" Title: cargo-rustdoc .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 1.5.8 -.\" Date: 2018-12-20 +.\" Date: 2019-04-16 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "CARGO\-RUSTDOC" "1" "2018-12-20" "\ \&" "\ \&" +.TH "CARGO\-RUSTDOC" "1" "2019-04-16" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -307,6 +307,23 @@ \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network access. .RE +.sp +\fB\-\-offline\fP +.RS 4 +Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible. +.sp +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the \fBcargo\-fetch\fP(1) command to download dependencies before going +offline. +.sp +May also be specified with the \fBnet.offline\fP \c +.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." +.RE .SS "Common Options" .sp \fB\-h\fP, \fB\-\-help\fP diff -Nru cargo-0.35.0/src/etc/man/cargo-test.1 cargo-0.37.0/src/etc/man/cargo-test.1 --- cargo-0.35.0/src/etc/man/cargo-test.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo-test.1 2019-05-15 19:48:47.000000000 +0000 @@ -2,12 +2,12 @@ .\" Title: cargo-test .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 1.5.8 -.\" Date: 2018-12-23 +.\" Date: 2019-05-08 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "CARGO\-TEST" "1" "2018-12-23" "\ \&" "\ \&" +.TH "CARGO\-TEST" "1" "2019-05-08" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -443,6 +443,23 @@ \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network access. .RE +.sp +\fB\-\-offline\fP +.RS 4 +Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible. +.sp +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the \fBcargo\-fetch\fP(1) command to download dependencies before going +offline. +.sp +May also be specified with the \fBnet.offline\fP \c +.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." +.RE .SS "Common Options" .sp \fB\-h\fP, \fB\-\-help\fP diff -Nru cargo-0.35.0/src/etc/man/cargo-update.1 cargo-0.37.0/src/etc/man/cargo-update.1 --- cargo-0.35.0/src/etc/man/cargo-update.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo-update.1 2019-05-15 19:48:47.000000000 +0000 @@ -2,12 +2,12 @@ .\" Title: cargo-update .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 1.5.8 -.\" Date: 2018-12-23 +.\" Date: 2019-04-16 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "CARGO\-UPDATE" "1" "2018-12-23" "\ \&" "\ \&" +.TH "CARGO\-UPDATE" "1" "2019-04-16" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -146,6 +146,23 @@ \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network access. .RE +.sp +\fB\-\-offline\fP +.RS 4 +Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible. +.sp +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the \fBcargo\-fetch\fP(1) command to download dependencies before going +offline. +.sp +May also be specified with the \fBnet.offline\fP \c +.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." +.RE .SS "Common Options" .sp \fB\-h\fP, \fB\-\-help\fP diff -Nru cargo-0.35.0/src/etc/man/cargo-verify-project.1 cargo-0.37.0/src/etc/man/cargo-verify-project.1 --- cargo-0.35.0/src/etc/man/cargo-verify-project.1 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/src/etc/man/cargo-verify-project.1 2019-05-15 19:48:47.000000000 +0000 @@ -2,12 +2,12 @@ .\" Title: cargo-verify-project .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 1.5.8 -.\" Date: 2018-12-20 +.\" Date: 2019-04-16 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "CARGO\-VERIFY\-PROJECT" "1" "2018-12-20" "\ \&" "\ \&" +.TH "CARGO\-VERIFY\-PROJECT" "1" "2019-04-16" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -126,6 +126,23 @@ \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network access. .RE +.sp +\fB\-\-offline\fP +.RS 4 +Prevents Cargo from accessing the network for any reason. Without this +flag, Cargo will stop with an error if it needs to access the network and +the network is not available. With this flag, Cargo will attempt to +proceed without the network if possible. +.sp +Beware that this may result in different dependency resolution than online +mode. Cargo will restrict itself to crates that are downloaded locally, even +if there might be a newer version as indicated in the local copy of the index. +See the \fBcargo\-fetch\fP(1) command to download dependencies before going +offline. +.sp +May also be specified with the \fBnet.offline\fP \c +.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." +.RE .SS "Common Options" .sp \fB\-h\fP, \fB\-\-help\fP diff -Nru cargo-0.35.0/tests/testsuite/alt_registry.rs cargo-0.37.0/tests/testsuite/alt_registry.rs --- cargo-0.35.0/tests/testsuite/alt_registry.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/alt_registry.rs 2019-05-15 19:48:47.000000000 +0000 @@ -289,6 +289,9 @@ ) .build(); + // Login so that we have the token available + p.cargo("login --registry fakeio TOKEN").run(); + p.cargo("publish --registry fakeio") .with_status(101) .with_stderr_contains("[ERROR] crates cannot be published to crates.io[..]") @@ -525,7 +528,31 @@ } #[test] -fn passwords_in_url_forbidden() { +fn passwords_in_registry_index_url_forbidden() { + registry::init(); + + let config = paths::home().join(".cargo/config"); + + File::create(config) + .unwrap() + .write_all( + br#" + [registry] + index = "ssh://git:secret@foobar.com" + "#, + ) + .unwrap(); + + let p = project().file("src/main.rs", "fn main() {}").build(); + + p.cargo("publish") + .with_status(101) + .with_stderr_contains("error: Registry URLs may not contain passwords") + .run(); +} + +#[test] +fn passwords_in_registries_index_url_forbidden() { registry::init(); let config = paths::home().join(".cargo/config"); @@ -620,7 +647,13 @@ .run(); for cmd in &[ - "init", "install", "login", "owner", "publish", "search", "yank", + "init", + "install foo", + "login", + "owner", + "publish", + "search", + "yank", ] { p.cargo(cmd) .arg("--registry") @@ -1132,3 +1165,154 @@ ) .run(); } + +#[test] +fn registries_index_relative_url() { + let config = paths::root().join(".cargo/config"); + fs::create_dir_all(config.parent().unwrap()).unwrap(); + File::create(&config) + .unwrap() + .write_all( + br#" + [registries.relative] + index = "file:alternative-registry" + "#, + ) + .unwrap(); + + registry::init(); + + let p = project() + .file( + "Cargo.toml", + r#" + [project] + name = "foo" + version = "0.0.1" + authors = [] + + [dependencies.bar] + version = "0.0.1" + registry = "relative" + "#, + ) + .file("src/main.rs", "fn main() {}") + .build(); + + Package::new("bar", "0.0.1").alternative(true).publish(); + + p.cargo("build") + .with_stderr(&format!( + "\ +[UPDATING] `{reg}` index +[DOWNLOADING] crates ... +[DOWNLOADED] bar v0.0.1 (registry `[ROOT][..]`) +[COMPILING] bar v0.0.1 (registry `[ROOT][..]`) +[COMPILING] foo v0.0.1 ([CWD]) +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s +", + reg = registry::alt_registry_path().to_str().unwrap() + )) + .run(); +} + +#[test] +fn registry_index_relative_url() { + let config = paths::root().join(".cargo/config"); + fs::create_dir_all(config.parent().unwrap()).unwrap(); + File::create(&config) + .unwrap() + .write_all( + br#" + [registry] + index = "file:alternative-registry" + "#, + ) + .unwrap(); + + registry::init(); + + let p = project() + .file( + "Cargo.toml", + r#" + [project] + name = "foo" + version = "0.0.1" + authors = [] + + [dependencies.bar] + version = "0.0.1" + "#, + ) + .file("src/main.rs", "fn main() {}") + .build(); + + Package::new("bar", "0.0.1").alternative(true).publish(); + + fs::remove_file(paths::home().join(".cargo/config")).unwrap(); + + p.cargo("build") + .with_stderr(&format!( + "\ +warning: custom registry support via the `registry.index` configuration is being removed, this functionality will not work in the future +[UPDATING] `{reg}` index +[DOWNLOADING] crates ... +[DOWNLOADED] bar v0.0.1 (registry `[ROOT][..]`) +[COMPILING] bar v0.0.1 (registry `[ROOT][..]`) +[COMPILING] foo v0.0.1 ([CWD]) +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s +", + reg = registry::alt_registry_path().to_str().unwrap() + )) + .run(); +} + +#[test] +fn registries_index_relative_path_not_allowed() { + let config = paths::root().join(".cargo/config"); + fs::create_dir_all(config.parent().unwrap()).unwrap(); + File::create(&config) + .unwrap() + .write_all( + br#" + [registries.relative] + index = "alternative-registry" + "#, + ) + .unwrap(); + + registry::init(); + + let p = project() + .file( + "Cargo.toml", + r#" + [project] + name = "foo" + version = "0.0.1" + authors = [] + + [dependencies.bar] + version = "0.0.1" + registry = "relative" + "#, + ) + .file("src/main.rs", "fn main() {}") + .build(); + + Package::new("bar", "0.0.1").alternative(true).publish(); + + p.cargo("build") + .with_stderr(&format!( + "\ +error: failed to parse manifest at `{root}/foo/Cargo.toml` + +Caused by: + invalid url `alternative-registry`: relative URL without a base +", + root = paths::root().to_str().unwrap() + )) + .with_status(101) + .run(); +} diff -Nru cargo-0.35.0/tests/testsuite/bad_config.rs cargo-0.37.0/tests/testsuite/bad_config.rs --- cargo-0.35.0/tests/testsuite/bad_config.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/bad_config.rs 2019-05-15 19:48:47.000000000 +0000 @@ -857,7 +857,7 @@ authors = [] [dependencies.bar] - git = "https://127.0.0.1" + git = "http://127.0.0.1" branch = "master" tag = "some-tag" "#, @@ -953,7 +953,7 @@ ".cargo/config", r#" [source.crates-io] - registry = 'http://example.com' + registry = 'https://example.com' replace-with = 'crates-io' "#, ) @@ -995,11 +995,11 @@ ".cargo/config", r#" [source.crates-io] - registry = 'http://example.com' + registry = 'https://example.com' replace-with = 'bar' [source.bar] - registry = 'http://example.com' + registry = 'https://example.com' replace-with = 'crates-io' "#, ) @@ -1042,7 +1042,7 @@ ".cargo/config", r#" [source.crates-io] - registry = 'http://example.com' + registry = 'https://example.com' replace-with = 'bar' [source.bar] @@ -1076,7 +1076,7 @@ authors = [] [dependencies.bar] - git = "https://127.0.0.1" + git = "http://127.0.0.1" path = "bar" "#, ) @@ -1115,7 +1115,7 @@ ".cargo/config", r#" [source.crates-io] - registry = 'http://example.com' + registry = 'https://example.com' replace-with = ['not', 'a', 'string'] "#, ) @@ -1176,7 +1176,7 @@ ".cargo/config", r#" [source.foo] - registry = 'http://example.com' + registry = 'https://example.com' local-registry = 'file:///another/file' "#, ) @@ -1280,3 +1280,25 @@ ) .run(); } + +#[test] +fn warn_semver_metadata() { + Package::new("bar", "1.0.0").publish(); + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "1.0.0" + + [dependencies] + bar = "1.0.0+1234" + "#, + ) + .file("src/lib.rs", "") + .build(); + p.cargo("check") + .with_stderr_contains("[WARNING] version requirement `1.0.0+1234` for dependency `bar`[..]") + .run(); +} diff -Nru cargo-0.35.0/tests/testsuite/build_lib.rs cargo-0.37.0/tests/testsuite/build_lib.rs --- cargo-0.35.0/tests/testsuite/build_lib.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/build_lib.rs 2019-05-15 19:48:47.000000000 +0000 @@ -12,7 +12,7 @@ "\ [COMPILING] foo v0.0.1 ([CWD]) [RUNNING] `rustc --crate-name foo src/lib.rs --color never --crate-type lib \ - --emit=dep-info,link -C debuginfo=2 \ + --emit=[..]link -C debuginfo=2 \ -C metadata=[..] \ --out-dir [..] \ -L dependency=[CWD]/target/debug/deps` diff -Nru cargo-0.35.0/tests/testsuite/build_plan.rs cargo-0.37.0/tests/testsuite/build_plan.rs --- cargo-0.35.0/tests/testsuite/build_plan.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/build_plan.rs 2019-05-15 19:48:47.000000000 +0000 @@ -85,7 +85,8 @@ "kind": "Host", "links": "{...}", "outputs": [ - "[..]/foo/target/debug/deps/libbar-[..].rlib" + "[..]/foo/target/debug/deps/libbar-[..].rlib", + "[..]/foo/target/debug/deps/libbar-[..].rmeta" ], "package_name": "bar", "package_version": "0.0.1", @@ -101,7 +102,8 @@ "kind": "Host", "links": "{...}", "outputs": [ - "[..]/foo/target/debug/deps/libfoo-[..].rlib" + "[..]/foo/target/debug/deps/libfoo-[..].rlib", + "[..]/foo/target/debug/deps/libfoo-[..].rmeta" ], "package_name": "foo", "package_version": "0.5.0", diff -Nru cargo-0.35.0/tests/testsuite/build.rs cargo-0.37.0/tests/testsuite/build.rs --- cargo-0.35.0/tests/testsuite/build.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/build.rs 2019-05-15 19:48:47.000000000 +0000 @@ -6,7 +6,7 @@ use crate::support::registry::Package; use crate::support::ProjectBuilder; use crate::support::{ - basic_bin_manifest, basic_lib_manifest, basic_manifest, is_nightly, rustc_host, sleep_ms, + basic_bin_manifest, basic_lib_manifest, basic_manifest, rustc_host, sleep_ms, }; use crate::support::{main_file, project, Execs}; use cargo::util::paths::dylib_path_envvar; @@ -957,190 +957,6 @@ } #[test] -fn cargo_compile_path_with_offline() { - let p = project() - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.0.1" - authors = [] - - [dependencies.bar] - path = "bar" - "#, - ) - .file("src/lib.rs", "") - .file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1")) - .file("bar/src/lib.rs", "") - .build(); - - p.cargo("build -Zoffline") - .masquerade_as_nightly_cargo() - .run(); -} - -#[test] -fn cargo_compile_with_downloaded_dependency_with_offline() { - Package::new("present_dep", "1.2.3") - .file("Cargo.toml", &basic_manifest("present_dep", "1.2.3")) - .file("src/lib.rs", "") - .publish(); - - { - // make package downloaded - let p = project() - .file( - "Cargo.toml", - r#" - [project] - name = "foo" - version = "0.1.0" - - [dependencies] - present_dep = "1.2.3" - "#, - ) - .file("src/lib.rs", "") - .build(); - p.cargo("build").run(); - } - - let p2 = project() - .at("bar") - .file( - "Cargo.toml", - r#" - [project] - name = "bar" - version = "0.1.0" - - [dependencies] - present_dep = "1.2.3" - "#, - ) - .file("src/lib.rs", "") - .build(); - - p2.cargo("build -Zoffline") - .masquerade_as_nightly_cargo() - .with_stderr( - "\ -[COMPILING] present_dep v1.2.3 -[COMPILING] bar v0.1.0 ([..]) -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]", - ) - .run(); -} - -#[test] -fn cargo_compile_offline_not_try_update() { - let p = project() - .at("bar") - .file( - "Cargo.toml", - r#" - [project] - name = "bar" - version = "0.1.0" - - [dependencies] - not_cached_dep = "1.2.5" - "#, - ) - .file("src/lib.rs", "") - .build(); - - p.cargo("build -Zoffline") - .masquerade_as_nightly_cargo() - .with_status(101) - .with_stderr( - "\ -error: no matching package named `not_cached_dep` found -location searched: registry `[..]` -required by package `bar v0.1.0 ([..])` -As a reminder, you're using offline mode (-Z offline) \ -which can sometimes cause surprising resolution failures, \ -if this error is too confusing you may wish to retry \ -without the offline flag.", - ) - .run(); -} - -#[test] -fn compile_offline_without_maxvers_cached() { - Package::new("present_dep", "1.2.1").publish(); - Package::new("present_dep", "1.2.2").publish(); - - Package::new("present_dep", "1.2.3") - .file("Cargo.toml", &basic_manifest("present_dep", "1.2.3")) - .file( - "src/lib.rs", - r#"pub fn get_version()->&'static str {"1.2.3"}"#, - ) - .publish(); - - Package::new("present_dep", "1.2.5") - .file("Cargo.toml", &basic_manifest("present_dep", "1.2.5")) - .file("src/lib.rs", r#"pub fn get_version(){"1.2.5"}"#) - .publish(); - - { - // make package cached - let p = project() - .file( - "Cargo.toml", - r#" - [project] - name = "foo" - version = "0.1.0" - - [dependencies] - present_dep = "=1.2.3" - "#, - ) - .file("src/lib.rs", "") - .build(); - p.cargo("build").run(); - } - - let p2 = project() - .file( - "Cargo.toml", - r#" - [project] - name = "foo" - version = "0.1.0" - - [dependencies] - present_dep = "1.2" - "#, - ) - .file( - "src/main.rs", - "\ -extern crate present_dep; -fn main(){ - println!(\"{}\", present_dep::get_version()); -}", - ) - .build(); - - p2.cargo("run -Zoffline") - .masquerade_as_nightly_cargo() - .with_stderr( - "\ -[COMPILING] present_dep v1.2.3 -[COMPILING] foo v0.1.0 ([CWD]) -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] - Running `[..]`", - ) - .with_stdout("1.2.3") - .run(); -} - -#[test] fn incompatible_dependencies() { Package::new("bad", "0.1.0").publish(); Package::new("bad", "1.0.0").publish(); @@ -1240,61 +1056,6 @@ } #[test] -fn compile_offline_while_transitive_dep_not_cached() { - let baz = Package::new("baz", "1.0.0"); - let baz_path = baz.archive_dst(); - baz.publish(); - - let mut content = Vec::new(); - - let mut file = File::open(baz_path.clone()).ok().unwrap(); - let _ok = file.read_to_end(&mut content).ok().unwrap(); - drop(file); - drop(File::create(baz_path.clone()).ok().unwrap()); - - Package::new("bar", "0.1.0").dep("baz", "1.0.0").publish(); - - let p = project() - .file( - "Cargo.toml", - r#" - [project] - name = "foo" - version = "0.0.1" - - [dependencies] - bar = "0.1.0" - "#, - ) - .file("src/main.rs", "fn main(){}") - .build(); - - // simulate download bar, but fail to download baz - p.cargo("build") - .with_status(101) - .with_stderr_contains("[..]failed to verify the checksum of `baz[..]") - .run(); - - drop(File::create(baz_path).ok().unwrap().write_all(&content)); - - p.cargo("build -Zoffline") - .masquerade_as_nightly_cargo() - .with_status(101) - .with_stderr( - "\ -error: no matching package named `baz` found -location searched: registry `[..]` -required by package `bar v0.1.0` - ... which is depended on by `foo v0.0.1 ([CWD])` -As a reminder, you're using offline mode (-Z offline) \ -which can sometimes cause surprising resolution failures, \ -if this error is too confusing you may wish to retry \ -without the offline flag.", - ) - .run(); -} - -#[test] fn compile_path_dep_then_change_version() { let p = project() .file( @@ -1387,14 +1148,14 @@ "\ [COMPILING] bar v0.0.1 ([CWD]/bar) [RUNNING] `rustc --crate-name bar bar/src/lib.rs --color never --crate-type dylib \ - --emit=dep-info,link \ + --emit=[..]link \ -C prefer-dynamic -C debuginfo=2 \ -C metadata=[..] \ --out-dir [..] \ -L dependency=[CWD]/target/debug/deps` [COMPILING] foo v0.0.1 ([CWD]) [RUNNING] `rustc --crate-name foo src/lib.rs --color never --crate-type lib \ - --emit=dep-info,link -C debuginfo=2 \ + --emit=[..]link -C debuginfo=2 \ -C metadata=[..] \ -C extra-filename=[..] \ --out-dir [..] \ @@ -1415,14 +1176,14 @@ "\ [COMPILING] bar v0.0.1 ([CWD]/bar) [RUNNING] `rustc --crate-name bar bar/src/lib.rs --color never --crate-type dylib \ - --emit=dep-info,link \ + --emit=[..]link \ -C prefer-dynamic -C debuginfo=2 \ -C metadata=[..] \ --out-dir [..] \ -L dependency=[CWD]/target/debug/deps` [COMPILING] foo v0.0.1 ([CWD]) [RUNNING] `rustc --crate-name foo src/lib.rs --color never --crate-type lib \ - --emit=dep-info,link -C debuginfo=2 \ + --emit=[..]link -C debuginfo=2 \ -C metadata=[..] \ -C extra-filename=[..] \ --out-dir [..] \ @@ -1446,8 +1207,8 @@ name = "foo" version = "0.5.1-alpha.1" description = "This is foo" - homepage = "http://example.com" - repository = "http://example.com/repo.git" + homepage = "https://example.com" + repository = "https://example.com/repo.git" authors = ["wycats@example.com"] "#, ) @@ -1475,8 +1236,8 @@ assert_eq!(s, foo::version()); println!("{}", s); assert_eq!("foo", PKG_NAME); - assert_eq!("http://example.com", HOMEPAGE); - assert_eq!("http://example.com/repo.git", REPOSITORY); + assert_eq!("https://example.com", HOMEPAGE); + assert_eq!("https://example.com/repo.git", REPOSITORY); assert_eq!("This is foo", DESCRIPTION); let s = format!("{}.{}.{}-{}", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, VERSION_PRE); @@ -1796,7 +1557,7 @@ "\ [COMPILING] test v0.0.0 ([CWD]) [RUNNING] `rustc --crate-name test src/main.rs --color never --crate-type bin \ - --emit=dep-info,link \ + --emit=[..]link \ -C opt-level=3 \ -C lto \ -C metadata=[..] \ @@ -1816,7 +1577,7 @@ "\ [COMPILING] foo v0.0.1 ([CWD]) [RUNNING] `rustc --crate-name foo src/lib.rs --color never --crate-type lib \ - --emit=dep-info,link -C debuginfo=2 \ + --emit=[..]link -C debuginfo=2 \ -C metadata=[..] \ --out-dir [..] \ -L dependency=[CWD]/target/debug/deps` @@ -1834,7 +1595,7 @@ "\ [COMPILING] foo v0.0.1 ([CWD]) [RUNNING] `rustc --crate-name foo src/lib.rs --color never --crate-type lib \ - --emit=dep-info,link \ + --emit=[..]link \ -C opt-level=3 \ -C metadata=[..] \ --out-dir [..] \ @@ -1884,7 +1645,7 @@ [COMPILING] foo v0.0.0 ([CWD]/foo) [RUNNING] `rustc --crate-name foo foo/src/lib.rs --color never \ --crate-type dylib --crate-type rlib \ - --emit=dep-info,link \ + --emit=[..]link \ -C prefer-dynamic \ -C opt-level=3 \ -C metadata=[..] \ @@ -1892,7 +1653,7 @@ -L dependency=[CWD]/target/release/deps` [COMPILING] test v0.0.0 ([CWD]) [RUNNING] `rustc --crate-name test src/lib.rs --color never --crate-type lib \ - --emit=dep-info,link \ + --emit=[..]link \ -C opt-level=3 \ -C metadata=[..] \ --out-dir [..] \ @@ -1955,7 +1716,7 @@ ) .build(); - p.cargo("test -v").run(); + p.cargo("build --examples").run(); p.process(&p.bin("examples/hello")) .with_stdout("Hello, World!\n") .run(); @@ -2126,7 +1887,7 @@ ) .build(); - p.cargo("test").run(); + p.cargo("build --examples").run(); p.process(&p.bin("examples/hello")) .with_stdout("Hello, World!\n") .run(); @@ -2267,7 +2028,7 @@ .build(); // env var is a test for #1381 - p.cargo("build").env("RUST_LOG", "nekoneko=trace").run(); + p.cargo("build").env("CARGO_LOG", "nekoneko=trace").run(); } #[test] @@ -2706,10 +2467,6 @@ #[test] fn example_as_proc_macro() { - if !is_nightly() { - return; - } - let p = project() .file( "Cargo.toml", @@ -2725,7 +2482,18 @@ "#, ) .file("src/lib.rs", "") - .file("examples/ex.rs", "#![feature(proc_macro)]") + .file( + "examples/ex.rs", + r#" + extern crate proc_macro; + use proc_macro::TokenStream; + + #[proc_macro] + pub fn eat(_item: TokenStream) -> TokenStream { + "".parse().unwrap() + } + "#, + ) .build(); p.cargo("build --example=ex").run(); @@ -2739,13 +2507,13 @@ .file("examples/foo.rs", "fn main() {}") .build(); - p.cargo("test --no-run -v").run(); + p.cargo("build --examples").run(); assert!(!p.bin("foo").is_file()); // We expect a file of the form bin/foo-{metadata_hash} assert!(p.bin("examples/foo").is_file()); - p.cargo("test --no-run -v").run(); + p.cargo("build --examples").run(); assert!(!p.bin("foo").is_file()); // We expect a file of the form bin/foo-{metadata_hash} @@ -3333,7 +3101,10 @@ "name":"bar", "src_path":"[..]lib.rs" }, - "filenames":["[..].rlib"], + "filenames":[ + "[..].rlib", + "[..].rmeta" + ], "fresh": false } @@ -3432,7 +3203,10 @@ "name":"bar", "src_path":"[..]lib.rs" }, - "filenames":["[..].rlib"], + "filenames":[ + "[..].rlib", + "[..].rmeta" + ], "fresh": true } @@ -4212,7 +3986,7 @@ .file("examples/baz/main.rs", "fn main() {}") .build(); - p.cargo("test").run(); + p.cargo("build --examples").run(); assert!(p.bin("examples/bar").is_file()); assert!(p.bin("examples/baz").is_file()); } @@ -4364,10 +4138,8 @@ } #[test] +#[cfg(any(target_os = "macos", target_os = "ios"))] fn uplift_dsym_of_bin_on_mac() { - if !cfg!(any(target_os = "macos", target_os = "ios")) { - return; - } let p = project() .file("src/main.rs", "fn main() { panic!(); }") .file("src/bin/b.rs", "fn main() { panic!(); }") @@ -4376,23 +4148,17 @@ .build(); p.cargo("build --bins --examples --tests").run(); - assert!(p.bin("foo.dSYM").is_dir()); - assert!(p.bin("b.dSYM").is_dir()); - assert!(p - .bin("b.dSYM") - .symlink_metadata() - .expect("read metadata from b.dSYM") - .file_type() - .is_symlink()); - assert!(!p.bin("c.dSYM").is_dir()); - assert!(!p.bin("d.dSYM").is_dir()); + assert!(p.target_debug_dir().join("foo.dSYM").is_dir()); + assert!(p.target_debug_dir().join("b.dSYM").is_dir()); + assert!(p.target_debug_dir().join("b.dSYM").is_symlink()); + assert!(p.target_debug_dir().join("examples/c.dSYM").is_symlink()); + assert!(!p.target_debug_dir().join("c.dSYM").exists()); + assert!(!p.target_debug_dir().join("d.dSYM").exists()); } #[test] +#[cfg(all(target_os = "windows", target_env = "msvc"))] fn uplift_pdb_of_bin_on_windows() { - if !cfg!(all(target_os = "windows", target_env = "msvc")) { - return; - } let p = project() .file("src/main.rs", "fn main() { panic!(); }") .file("src/bin/b.rs", "fn main() { panic!(); }") @@ -4403,8 +4169,10 @@ p.cargo("build --bins --examples --tests").run(); assert!(p.target_debug_dir().join("foo.pdb").is_file()); assert!(p.target_debug_dir().join("b.pdb").is_file()); - assert!(!p.target_debug_dir().join("c.pdb").is_file()); - assert!(!p.target_debug_dir().join("d.pdb").is_file()); + assert!(!p.target_debug_dir().join("examples/c.pdb").exists()); + assert_eq!(p.glob("target/debug/examples/c-*.pdb").count(), 1); + assert!(!p.target_debug_dir().join("c.pdb").exists()); + assert!(!p.target_debug_dir().join("d.pdb").exists()); } // Ensure that `cargo build` chooses the correct profile for building @@ -4422,11 +4190,11 @@ p.cargo("build -v") .with_stderr_contains( "[RUNNING] `rustc --crate-name foo src/lib.rs --color never --crate-type lib \ - --emit=dep-info,link[..]", + --emit=[..]link[..]", ) .with_stderr_contains( "[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \ - --emit=dep-info,link[..]", + --emit=[..]link[..]", ) .run(); @@ -4434,15 +4202,15 @@ p.cargo("build -v --test=t1") .with_stderr_contains( "[RUNNING] `rustc --crate-name foo src/lib.rs --color never --crate-type lib \ - --emit=dep-info,link -C debuginfo=2 [..]", + --emit=[..]link -C debuginfo=2 [..]", ) .with_stderr_contains( - "[RUNNING] `rustc --crate-name t1 tests/t1.rs --color never --emit=dep-info,link \ + "[RUNNING] `rustc --crate-name t1 tests/t1.rs --color never --emit=[..]link \ -C debuginfo=2 [..]", ) .with_stderr_contains( "[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \ - --emit=dep-info,link -C debuginfo=2 [..]", + --emit=[..]link -C debuginfo=2 [..]", ) .run(); @@ -4451,16 +4219,16 @@ p.cargo("build -v --bench=b1") .with_stderr_contains( "[RUNNING] `rustc --crate-name foo src/lib.rs --color never --crate-type lib \ - --emit=dep-info,link -C debuginfo=2 [..]", + --emit=[..]link -C debuginfo=2 [..]", ) .with_stderr_contains( - "[RUNNING] `rustc --crate-name b1 benches/b1.rs --color never --emit=dep-info,link \ + "[RUNNING] `rustc --crate-name b1 benches/b1.rs --color never --emit=[..]link \ -C debuginfo=2 [..]", ) .with_stderr_does_not_contain("opt-level") .with_stderr_contains( "[RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \ - --emit=dep-info,link -C debuginfo=2 [..]", + --emit=[..]link -C debuginfo=2 [..]", ) .run(); } @@ -4473,18 +4241,18 @@ .with_stderr_contains( "\ [RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \ - --emit=dep-info,link[..]", + --emit=[..]link[..]", ) // Benchmarks. .with_stderr_does_not_contain( "\ - [RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=dep-info,link \ + [RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \ -C opt-level=3 --test [..]", ) // Unit tests. .with_stderr_does_not_contain( "\ - [RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=dep-info,link \ + [RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \ -C debuginfo=2 --test [..]", ) .run(); @@ -4498,12 +4266,12 @@ .with_stderr_contains( "\ [RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \ - --emit=dep-info,link[..]", + --emit=[..]link[..]", ) // Unit tests. .with_stderr_contains( "\ - [RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=dep-info,link \ + [RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \ -C debuginfo=2 --test [..]", ) .run(); @@ -4517,12 +4285,12 @@ .with_stderr_contains( "\ [RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \ - --emit=dep-info,link[..]", + --emit=[..]link[..]", ) // Unit tests. .with_stderr_contains( "\ - [RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=dep-info,link \ + [RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \ -C debuginfo=2 --test [..]", ) .run(); @@ -4741,69 +4509,122 @@ } #[test] -fn json_parse_fail() { - // Ensure when JSON parsing fails, and rustc exits with non-zero exit - // code, a useful error message is displayed. +fn tricky_pipelining() { + if !crate::support::is_nightly() { + return; + } + let foo = project() .file( "Cargo.toml", r#" - [package] - name = "foo" - version = "0.1.0" - [dependencies] - pm = { path = "pm" } - "#, + [package] + name = "foo" + version = "0.1.0" + [dependencies] + bar = { path = "bar" } + "#, ) + .file("src/lib.rs", "extern crate bar;") + .file("bar/Cargo.toml", &basic_lib_manifest("bar")) + .file("bar/src/lib.rs", "") + .build(); + + foo.cargo("build -p bar") + .env("CARGO_BUILD_PIPELINING", "true") + .run(); + foo.cargo("build -p foo") + .env("CARGO_BUILD_PIPELINING", "true") + .run(); +} + +#[test] +fn pipelining_works() { + if !crate::support::is_nightly() { + return; + } + + let foo = project() .file( - "src/lib.rs", + "Cargo.toml", r#" - #[macro_use] - extern crate pm; + [package] + name = "foo" + version = "0.1.0" + [dependencies] + bar = { path = "bar" } + "#, + ) + .file("src/lib.rs", "extern crate bar;") + .file("bar/Cargo.toml", &basic_lib_manifest("bar")) + .file("bar/src/lib.rs", "") + .build(); - #[derive(Foo)] - pub struct S; - "#, + foo.cargo("build") + .env("CARGO_BUILD_PIPELINING", "true") + .with_stdout("") + .with_stderr("\ +[COMPILING] [..] +[COMPILING] [..] +[FINISHED] [..] +") + .run(); +} + +#[test] +fn forward_rustc_output() { + let foo = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + edition = '2018' + [dependencies] + bar = { path = "bar" } + "#, ) + .file("src/lib.rs", "bar::foo!();") .file( - "pm/Cargo.toml", + "bar/Cargo.toml", r#" - [package] - name = "pm" - version = "0.1.0" - [lib] - proc-macro = true - "#, + [package] + name = "bar" + version = "0.1.0" + [lib] + proc-macro = true + "#, ) .file( - "pm/src/lib.rs", + "bar/src/lib.rs", r#" - extern crate proc_macro; - use proc_macro::TokenStream; + extern crate proc_macro; + use proc_macro::*; - #[proc_macro_derive(Foo)] - pub fn derive(_input: TokenStream) -> TokenStream { - eprintln!("{{evil proc macro}}"); - panic!("something went wrong"); - } - "#, + #[proc_macro] + pub fn foo(input: TokenStream) -> TokenStream { + println!("a"); + println!("b"); + println!("{{}}"); + eprintln!("c"); + eprintln!("d"); + eprintln!("{{a"); // "malformed json" + input + } + "#, ) .build(); - foo.cargo("build --message-format=json") - .with_stderr( - "\ -[COMPILING] pm [..] -[COMPILING] foo [..] -[ERROR] Could not compile `foo`. - -Caused by: - compiler produced invalid json: `{evil proc macro}` - -Caused by: - failed to parse process output: `rustc [..] -", - ) - .with_status(101) + foo.cargo("build") + .with_stdout("a\nb\n{}") + .with_stderr("\ +[COMPILING] [..] +[COMPILING] [..] +c +d +{a +[FINISHED] [..] +") .run(); } diff -Nru cargo-0.35.0/tests/testsuite/build_script.rs cargo-0.37.0/tests/testsuite/build_script.rs --- cargo-0.35.0/tests/testsuite/build_script.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/build_script.rs 2019-05-15 19:48:47.000000000 +0000 @@ -35,7 +35,9 @@ [RUNNING] `rustc --crate-name build_script_build build.rs --color never --crate-type bin [..]` [RUNNING] `[..]/build-script-build` [ERROR] failed to run custom build command for `foo v0.5.0 ([CWD])` -process didn't exit successfully: `[..]/build-script-build` (exit code: 101)", + +Caused by: + process didn't exit successfully: `[..]/build-script-build` (exit code: 101)", ) .run(); } @@ -241,7 +243,7 @@ -C metadata=[..] \ -C extra-filename=-[..] \ --out-dir [CWD]/target \ - --emit=dep-info,link \ + --emit=[..]link \ -L [CWD]/target \ -L [CWD]/target/deps` ", @@ -1015,19 +1017,19 @@ [RUNNING] `rustc [..] a/build.rs [..] --extern b=[..]` [RUNNING] `[..]/a-[..]/build-script-build` [RUNNING] `rustc --crate-name a [..]lib.rs --color never --crate-type lib \ - --emit=dep-info,link -C debuginfo=2 \ + --emit=[..]link -C debuginfo=2 \ -C metadata=[..] \ --out-dir [..]target/debug/deps \ -L [..]target/debug/deps` [COMPILING] foo v0.5.0 ([CWD]) [RUNNING] `rustc --crate-name build_script_build build.rs --color never --crate-type bin \ - --emit=dep-info,link \ + --emit=[..]link \ -C debuginfo=2 -C metadata=[..] --out-dir [..] \ -L [..]target/debug/deps \ --extern a=[..]liba[..].rlib` [RUNNING] `[..]/foo-[..]/build-script-build` [RUNNING] `rustc --crate-name foo [..]lib.rs --color never --crate-type lib \ - --emit=dep-info,link -C debuginfo=2 \ + --emit=[..]link -C debuginfo=2 \ -C metadata=[..] \ --out-dir [..] \ -L [..]target/debug/deps` @@ -1547,13 +1549,13 @@ build .cargo("build -v") - .env("RUST_LOG", "cargo::ops::cargo_rustc") + .env("CARGO_LOG", "cargo::ops::cargo_rustc") .run(); let root = build.root().join("target").join("debug"); foo.cargo("build -v") .env("BUILDER_ROOT", root) - .env("RUST_LOG", "cargo::ops::cargo_rustc") + .env("CARGO_LOG", "cargo::ops::cargo_rustc") .run(); } @@ -2406,7 +2408,6 @@ .run(); p.cargo("build -v") - .env("RUST_LOG", "cargo::ops::cargo_rustc::fingerprint=info") .with_stderr( "\ [FRESH] foo v0.5.0 ([..]) @@ -2461,7 +2462,7 @@ .run(); p.cargo("build -v") - .env("RUST_LOG", "cargo::ops::cargo_rustc::fingerprint=info") + .env("CARGO_LOG", "cargo::ops::cargo_rustc::fingerprint=info") .with_stderr( "\ [FRESH] foo v0.5.0 ([..]) @@ -3696,3 +3697,142 @@ ) .run(); } + +#[test] +fn using_rerun_if_changed_does_not_rebuild() { + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + authors = [] + "#, + ) + .file( + "build.rs", + r#" + fn main() { + println!("cargo:rerun-if-changed=build.rs"); + } + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("build").run(); + p.cargo("build").with_stderr("[FINISHED] [..]").run(); +} + +#[test] +fn links_interrupted_can_restart() { + // Test for a `links` dependent build script getting canceled and then + // restarted. Steps: + // 1. Build to establish fingerprints. + // 2. Change something (an env var in this case) that triggers the + // dependent build script to run again. Kill the top-level build script + // while it is running (such as hitting Ctrl-C). + // 3. Run the build again, it should re-run the build script. + let bar = project() + .at("bar") + .file( + "Cargo.toml", + r#" + [package] + name = "bar" + version = "0.5.0" + authors = [] + links = "foo" + build = "build.rs" + "#, + ) + .file("src/lib.rs", "") + .file( + "build.rs", + r#" + fn main() { + println!("cargo:rerun-if-env-changed=SOMEVAR"); + } + "#, + ) + .build(); + + let p = project() + .file( + "Cargo.toml", + &format!( + r#" + [package] + name = "foo" + version = "0.5.0" + authors = [] + build = "build.rs" + + [dependencies.bar] + path = '{}' + "#, + bar.root().display() + ), + ) + .file("src/lib.rs", "") + .file( + "build.rs", + r#" + use std::env; + fn main() { + println!("cargo:rebuild-if-changed=build.rs"); + if std::path::Path::new("abort").exists() { + panic!("Crash!"); + } + } + "#, + ) + .build(); + + p.cargo("build").run(); + // Simulate the user hitting Ctrl-C during a build. + p.change_file("abort", ""); + // Set SOMEVAR to trigger a rebuild. + p.cargo("build") + .env("SOMEVAR", "1") + .with_stderr_contains("[..]Crash![..]") + .with_status(101) + .run(); + fs::remove_file(p.root().join("abort")).unwrap(); + // Try again without aborting the script. + // ***This is currently broken, the script does not re-run. + p.cargo("build -v") + .env("SOMEVAR", "1") + .with_stderr_contains("[RUNNING] [..]/foo-[..]/build-script-build[..]") + .run(); +} + +#[test] +#[cfg(unix)] +fn build_script_scan_eacces() { + // build.rs causes a scan of the whole project, which can be a problem if + // a directory is not accessible. + use std::os::unix::fs::PermissionsExt; + let p = project() + .file("src/lib.rs", "") + .file("build.rs", "fn main() {}") + .file("secrets/stuff", "") + .build(); + let path = p.root().join("secrets"); + fs::set_permissions(&path, fs::Permissions::from_mode(0)).unwrap(); + // "Caused by" is a string from libc such as the following: + // Permission denied (os error 13) + p.cargo("build") + .with_stderr( + "\ +[ERROR] cannot read \"[..]/foo/secrets\" + +Caused by: + [..] +", + ) + .with_status(101) + .run(); + fs::set_permissions(&path, fs::Permissions::from_mode(0o755)).unwrap(); +} diff -Nru cargo-0.35.0/tests/testsuite/cargo_features.rs cargo-0.37.0/tests/testsuite/cargo_features.rs --- cargo-0.35.0/tests/testsuite/cargo_features.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/cargo_features.rs 2019-05-15 19:48:47.000000000 +0000 @@ -146,6 +146,7 @@ Caused by: the cargo feature `test-dummy-unstable` requires a nightly version of Cargo, \ but this is the `stable` channel +See [..] ", ) .run(); @@ -207,6 +208,7 @@ Caused by: the cargo feature `test-dummy-unstable` requires a nightly version of Cargo, \ but this is the `stable` channel +See [..] ", ) .run(); @@ -248,6 +250,7 @@ Caused by: the cargo feature `test-dummy-unstable` requires a nightly version of Cargo, \ but this is the `stable` channel +See [..] ", ) .run(); @@ -272,7 +275,11 @@ .build(); p.cargo("build -Zprint-im-a-teapot") .with_status(101) - .with_stderr("error: the `-Z` flag is only accepted on the nightly channel of Cargo") + .with_stderr( + "error: the `-Z` flag is only accepted on the nightly \ + channel of Cargo, but this is the `stable` channel\n\ + See [..]", + ) .run(); p.cargo("build -Zarg") diff -Nru cargo-0.35.0/tests/testsuite/check.rs cargo-0.37.0/tests/testsuite/check.rs --- cargo-0.35.0/tests/testsuite/check.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/check.rs 2019-05-15 19:48:47.000000000 +0000 @@ -4,7 +4,6 @@ use crate::support::paths::CargoPathExt; use crate::support::registry::Package; use crate::support::{basic_manifest, project}; -use glob::glob; #[test] fn check_success() { @@ -191,8 +190,8 @@ .file("src/lib.rs", "pub fn baz() {}") .build(); - foo.cargo("build").run(); - foo.cargo("check").run(); + foo.cargo("build -v").run(); + foo.cargo("check -v").run(); } // Checks that where a project has both a lib and a bin, the lib is only checked @@ -205,7 +204,7 @@ .build(); foo.cargo("check -v") - .with_stderr_contains("[..] --emit=dep-info,metadata [..]") + .with_stderr_contains("[..] --emit=[..]metadata [..]") .run(); } @@ -623,43 +622,34 @@ .file("benches/b1.rs", "") .build(); - let assert_glob = |path: &str, count: usize| { - assert_eq!( - glob(&p.root().join(path).to_str().unwrap()) - .unwrap() - .count(), - count - ); - }; - p.cargo("check").run(); assert!(!p.root().join("target/debug/libfoo.rmeta").is_file()); assert!(!p.root().join("target/debug/libfoo.rlib").is_file()); assert!(!p.root().join("target/debug").join(exe("foo")).is_file()); - assert_glob("target/debug/deps/libfoo-*.rmeta", 2); + assert_eq!(p.glob("target/debug/deps/libfoo-*.rmeta").count(), 2); p.root().join("target").rm_rf(); p.cargo("check --lib").run(); assert!(!p.root().join("target/debug/libfoo.rmeta").is_file()); assert!(!p.root().join("target/debug/libfoo.rlib").is_file()); assert!(!p.root().join("target/debug").join(exe("foo")).is_file()); - assert_glob("target/debug/deps/libfoo-*.rmeta", 1); + assert_eq!(p.glob("target/debug/deps/libfoo-*.rmeta").count(), 1); p.root().join("target").rm_rf(); p.cargo("check --bin foo").run(); assert!(!p.root().join("target/debug/libfoo.rmeta").is_file()); assert!(!p.root().join("target/debug/libfoo.rlib").is_file()); assert!(!p.root().join("target/debug").join(exe("foo")).is_file()); - assert_glob("target/debug/deps/libfoo-*.rmeta", 2); + assert_eq!(p.glob("target/debug/deps/libfoo-*.rmeta").count(), 2); p.root().join("target").rm_rf(); p.cargo("check --test t1").run(); assert!(!p.root().join("target/debug/libfoo.rmeta").is_file()); assert!(!p.root().join("target/debug/libfoo.rlib").is_file()); assert!(!p.root().join("target/debug").join(exe("foo")).is_file()); - assert_glob("target/debug/t1-*", 0); - assert_glob("target/debug/deps/libfoo-*.rmeta", 1); - assert_glob("target/debug/deps/libt1-*.rmeta", 1); + assert_eq!(p.glob("target/debug/t1-*").count(), 0); + assert_eq!(p.glob("target/debug/deps/libfoo-*.rmeta").count(), 1); + assert_eq!(p.glob("target/debug/deps/libt1-*.rmeta").count(), 1); p.root().join("target").rm_rf(); p.cargo("check --example ex1").run(); @@ -670,17 +660,17 @@ .join("target/debug/examples") .join(exe("ex1")) .is_file()); - assert_glob("target/debug/deps/libfoo-*.rmeta", 1); - assert_glob("target/debug/examples/libex1-*.rmeta", 1); + assert_eq!(p.glob("target/debug/deps/libfoo-*.rmeta").count(), 1); + assert_eq!(p.glob("target/debug/examples/libex1-*.rmeta").count(), 1); p.root().join("target").rm_rf(); p.cargo("check --bench b1").run(); assert!(!p.root().join("target/debug/libfoo.rmeta").is_file()); assert!(!p.root().join("target/debug/libfoo.rlib").is_file()); assert!(!p.root().join("target/debug").join(exe("foo")).is_file()); - assert_glob("target/debug/b1-*", 0); - assert_glob("target/debug/deps/libfoo-*.rmeta", 1); - assert_glob("target/debug/deps/libb1-*.rmeta", 1); + assert_eq!(p.glob("target/debug/b1-*").count(), 0); + assert_eq!(p.glob("target/debug/deps/libfoo-*.rmeta").count(), 1); + assert_eq!(p.glob("target/debug/deps/libb1-*.rmeta").count(), 1); } #[test] @@ -740,7 +730,7 @@ "#, ) .build(); - p.cargo("check -v").env("RUST_LOG", "cargo=trace").run(); + p.cargo("check -v").env("CARGO_LOG", "cargo=trace").run(); } #[test] diff -Nru cargo-0.35.0/tests/testsuite/clean.rs cargo-0.37.0/tests/testsuite/clean.rs --- cargo-0.35.0/tests/testsuite/clean.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/clean.rs 2019-05-15 19:48:47.000000000 +0000 @@ -28,10 +28,7 @@ p.cargo("build").run(); assert!(p.build_dir().is_dir()); - p.cargo("clean") - .cwd(&p.root().join("src")) - .with_stdout("") - .run(); + p.cargo("clean").cwd("src").with_stdout("").run(); assert!(!p.build_dir().is_dir()); } @@ -78,7 +75,7 @@ assert!(d2_path.is_file()); p.cargo("clean -p d1 -p d2") - .cwd(&p.root().join("src")) + .cwd("src") .with_stdout("") .run(); assert!(p.bin("foo").is_file()); @@ -292,8 +289,32 @@ "\ [REMOVING] [..] [REMOVING] [..] +[REMOVING] [..] ", ) .run(); p.cargo("build").run(); } + +#[test] +fn clean_remove_rlib_rmeta() { + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.0.1" + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("build").run(); + assert!(p.target_debug_dir().join("libfoo.rlib").exists()); + let rmeta = p.glob("target/debug/deps/*.rmeta").next().unwrap().unwrap(); + assert!(rmeta.exists()); + p.cargo("clean -p foo").run(); + assert!(!p.target_debug_dir().join("libfoo.rlib").exists()); + assert!(!rmeta.exists()); +} diff -Nru cargo-0.35.0/tests/testsuite/concurrent.rs cargo-0.37.0/tests/testsuite/concurrent.rs --- cargo-0.35.0/tests/testsuite/concurrent.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/concurrent.rs 2019-05-15 19:48:47.000000000 +0000 @@ -29,8 +29,8 @@ .file("b/src/main.rs", "fn main() {}"); let p = p.build(); - let mut a = p.cargo("install").cwd(p.root().join("a")).build_command(); - let mut b = p.cargo("install").cwd(p.root().join("b")).build_command(); + let mut a = p.cargo("install").cwd("a").build_command(); + let mut b = p.cargo("install").cwd("b").build_command(); a.stdout(Stdio::piped()).stderr(Stdio::piped()); b.stdout(Stdio::piped()).stderr(Stdio::piped()); @@ -87,8 +87,8 @@ .file("b/src/main.rs", "fn main() {}"); let p = p.build(); - let mut a = p.cargo("install").cwd(p.root().join("a")).build_command(); - let mut b = p.cargo("install").cwd(p.root().join("b")).build_command(); + let mut a = p.cargo("install").cwd("a").build_command(); + let mut b = p.cargo("install").cwd("b").build_command(); a.stdout(Stdio::piped()).stderr(Stdio::piped()); b.stdout(Stdio::piped()).stderr(Stdio::piped()); @@ -157,8 +157,8 @@ .file("b/src/main.rs", "fn main() {}"); let p = p.build(); - let mut a = p.cargo("build").cwd(p.root().join("a")).build_command(); - let mut b = p.cargo("build").cwd(p.root().join("b")).build_command(); + let mut a = p.cargo("build").cwd("a").build_command(); + let mut b = p.cargo("build").cwd("b").build_command(); a.stdout(Stdio::piped()).stderr(Stdio::piped()); b.stdout(Stdio::piped()).stderr(Stdio::piped()); @@ -247,8 +247,8 @@ ); let p = p.build(); - let mut a = p.cargo("build -v").cwd(p.root().join("a")).build_command(); - let mut b = p.cargo("build -v").cwd(p.root().join("b")).build_command(); + let mut a = p.cargo("build -v").cwd("a").build_command(); + let mut b = p.cargo("build -v").cwd("b").build_command(); a.stdout(Stdio::piped()).stderr(Stdio::piped()); b.stdout(Stdio::piped()).stderr(Stdio::piped()); @@ -316,7 +316,7 @@ // Generate a Cargo.lock pointing at the current rev, then clear out the // target directory - p.cargo("build").cwd(p.root().join("a")).run(); + p.cargo("build").cwd("a").run(); fs::remove_dir_all(p.root().join("a/target")).unwrap(); // Make a new commit on the master branch @@ -330,8 +330,8 @@ // Now run both builds in parallel. The build of `b` should pick up the // newest commit while the build of `a` should use the locked old commit. - let mut a = p.cargo("build").cwd(p.root().join("a")).build_command(); - let mut b = p.cargo("build").cwd(p.root().join("b")).build_command(); + let mut a = p.cargo("build").cwd("a").build_command(); + let mut b = p.cargo("build").cwd("b").build_command(); a.stdout(Stdio::piped()).stderr(Stdio::piped()); b.stdout(Stdio::piped()).stderr(Stdio::piped()); @@ -453,7 +453,7 @@ let a = a.join().unwrap(); execs() - .with_stderr( + .with_stderr_contains( "\ [COMPILING] foo v0.0.1 [..] [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -461,7 +461,7 @@ ) .run_output(&a); execs() - .with_stderr( + .with_stderr_contains( "\ [COMPILING] foo v0.0.1 [..] [FINISHED] release [optimized] target(s) in [..] diff -Nru cargo-0.35.0/tests/testsuite/config.rs cargo-0.37.0/tests/testsuite/config.rs --- cargo-0.35.0/tests/testsuite/config.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/config.rs 2019-05-15 19:48:47.000000000 +0000 @@ -61,6 +61,7 @@ &None, false, false, + false, &None, &["advanced-env".into()], ) diff -Nru cargo-0.35.0/tests/testsuite/corrupt_git.rs cargo-0.37.0/tests/testsuite/corrupt_git.rs --- cargo-0.35.0/tests/testsuite/corrupt_git.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/corrupt_git.rs 2019-05-15 19:48:47.000000000 +0000 @@ -47,7 +47,7 @@ } println!("deleting {}", file.display()); cargopaths::remove_file(&file).unwrap(); - project.cargo("build -v").env("RUST_LOG", log).run(); + project.cargo("build -v").env("CARGO_LOG", log).run(); if !file.exists() { continue; @@ -60,7 +60,7 @@ .unwrap() .set_len(2) .unwrap(); - project.cargo("build -v").env("RUST_LOG", log).run(); + project.cargo("build -v").env("CARGO_LOG", log).run(); } } @@ -124,7 +124,7 @@ } println!("deleting {}", file.display()); cargopaths::remove_file(&file).unwrap(); - project.cargo("build -v").env("RUST_LOG", log).run(); + project.cargo("build -v").env("CARGO_LOG", log).run(); if !file.exists() { continue; @@ -137,7 +137,7 @@ .unwrap() .set_len(2) .unwrap(); - project.cargo("build -v").env("RUST_LOG", log).run(); + project.cargo("build -v").env("CARGO_LOG", log).run(); } } diff -Nru cargo-0.35.0/tests/testsuite/cross_compile.rs cargo-0.37.0/tests/testsuite/cross_compile.rs --- cargo-0.35.0/tests/testsuite/cross_compile.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/cross_compile.rs 2019-05-15 19:48:47.000000000 +0000 @@ -149,6 +149,7 @@ return; } if !is_nightly() { + // plugins are unstable return; } @@ -241,6 +242,7 @@ return; } if !is_nightly() { + // plugins are unstable return; } @@ -377,7 +379,7 @@ "\ [COMPILING] foo v0.5.0 ([CWD]) [RUNNING] `rustc --crate-name foo src/foo.rs --color never --crate-type bin \ - --emit=dep-info,link -C debuginfo=2 \ + --emit=[..]link -C debuginfo=2 \ -C metadata=[..] \ --out-dir [CWD]/target/{target}/debug/deps \ --target {target} \ @@ -396,6 +398,7 @@ return; } if !is_nightly() { + // plugins are unstable return; } diff -Nru cargo-0.35.0/tests/testsuite/custom_target.rs cargo-0.37.0/tests/testsuite/custom_target.rs --- cargo-0.35.0/tests/testsuite/custom_target.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/custom_target.rs 2019-05-15 19:48:47.000000000 +0000 @@ -4,6 +4,7 @@ #[test] fn custom_target_minimal() { if !is_nightly() { + // Requires features no_core, lang_items return; } let p = project() @@ -53,6 +54,7 @@ #[test] fn custom_target_dependency() { if !is_nightly() { + // Requires features no_core, lang_items, optin_builtin_traits return; } let p = project() diff -Nru cargo-0.35.0/tests/testsuite/directory.rs cargo-0.37.0/tests/testsuite/directory.rs --- cargo-0.35.0/tests/testsuite/directory.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/directory.rs 2019-05-15 19:48:47.000000000 +0000 @@ -141,12 +141,14 @@ cargo_process("install bar") .with_stderr( - " Installing bar v0.1.0 - Compiling foo v0.0.1 - Compiling bar v0.1.0 - Finished release [optimized] target(s) in [..]s - Installing [..]bar[..] -warning: be sure to add `[..]` to your PATH to be able to run the installed binaries + "\ +[INSTALLING] bar v0.1.0 +[COMPILING] foo v0.0.1 +[COMPILING] bar v0.1.0 +[FINISHED] release [optimized] target(s) in [..]s +[INSTALLING] [..]bar[..] +[INSTALLED] package `bar v0.1.0` (executable `bar[EXE]`) +[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries ", ) .run(); @@ -229,12 +231,14 @@ cargo_process("install bar") .with_stderr( - " Installing bar v0.1.0 - Compiling foo v0.0.1 - Compiling bar v0.1.0 - Finished release [optimized] target(s) in [..]s - Installing [..]bar[..] -warning: be sure to add `[..]` to your PATH to be able to run the installed binaries + "\ +[INSTALLING] bar v0.1.0 +[COMPILING] foo v0.0.1 +[COMPILING] bar v0.1.0 +[FINISHED] release [optimized] target(s) in [..]s +[INSTALLING] [..]bar[..] +[INSTALLED] package `bar v0.1.0` (executable `bar[EXE]`) +[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries ", ) .run(); @@ -577,7 +581,7 @@ let root = paths::root(); t!(fs::create_dir(&root.join(".cargo"))); t!(t!(File::create(root.join(".cargo/config"))).write_all( - &format!( + format!( r#" [source.my-git-repo] git = '{}' @@ -710,9 +714,9 @@ ) .build(); - p.cargo("build").cwd(p.root().join("foo")).run(); + p.cargo("build").cwd("foo").run(); p.cargo("build") - .cwd(p.root().join("bar")) + .cwd("bar") .with_stderr( "\ [COMPILING] bar [..] diff -Nru cargo-0.35.0/tests/testsuite/doc.rs cargo-0.37.0/tests/testsuite/doc.rs --- cargo-0.35.0/tests/testsuite/doc.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/doc.rs 2019-05-15 19:48:47.000000000 +0000 @@ -2,8 +2,6 @@ use std::io::Read; use std::str; -use glob::glob; - use crate::support::paths::CargoPathExt; use crate::support::registry::Package; use crate::support::{basic_lib_manifest, basic_manifest, git, project}; @@ -113,26 +111,11 @@ assert!(p.root().join("target/doc/bar/index.html").is_file()); // Verify that it only emits rmeta for the dependency. - assert_eq!( - glob(&p.root().join("target/debug/**/*.rlib").to_str().unwrap()) - .unwrap() - .count(), - 0 - ); - assert_eq!( - glob( - &p.root() - .join("target/debug/deps/libbar-*.rmeta") - .to_str() - .unwrap() - ) - .unwrap() - .count(), - 1 - ); + assert_eq!(p.glob("target/debug/**/*.rlib").count(), 0); + assert_eq!(p.glob("target/debug/deps/libbar-*.rmeta").count(), 1); p.cargo("doc") - .env("RUST_LOG", "cargo::ops::cargo_rustc::fingerprint") + .env("CARGO_LOG", "cargo::ops::cargo_rustc::fingerprint") .with_stdout("") .run(); @@ -903,9 +886,6 @@ #[test] fn plugins_no_use_target() { - if !is_nightly() { - return; - } let p = project() .file( "Cargo.toml", @@ -1032,6 +1012,7 @@ } #[test] +#[cfg(not(any(target_os = "windows", target_os = "macos")))] fn doc_workspace_open_help_message() { let p = project() .file( @@ -1049,19 +1030,10 @@ // The order in which bar is compiled or documented is not deterministic p.cargo("doc --all --open") - .with_status(101) + .env("BROWSER", "echo") .with_stderr_contains("[..] Documenting bar v0.1.0 ([..])") .with_stderr_contains("[..] Documenting foo v0.1.0 ([..])") - .with_stderr_contains( - "error: Passing multiple packages and `open` \ - is not supported.", - ) - .with_stderr_contains( - "Please re-run this command with `-p ` \ - where `` is one of the following:", - ) - .with_stderr_contains(" foo") - .with_stderr_contains(" bar") + .with_stderr_contains("[..] Opening [..]/foo/index.html") .run(); } @@ -1165,16 +1137,10 @@ #[test] fn doc_edition() { - if !is_nightly() { - // Stable rustdoc won't have the edition option. Remove this once it - // is stabilized. - return; - } let p = project() .file( "Cargo.toml", r#" - cargo-features = ["edition"] [package] name = "foo" version = "0.0.1" @@ -1186,26 +1152,20 @@ .build(); p.cargo("doc -v") - .masquerade_as_nightly_cargo() .with_stderr_contains("[RUNNING] `rustdoc [..]--edition=2018[..]") .run(); p.cargo("test -v") - .masquerade_as_nightly_cargo() .with_stderr_contains("[RUNNING] `rustdoc [..]--edition=2018[..]") .run(); } #[test] fn doc_target_edition() { - if !is_nightly() { - return; - } let p = project() .file( "Cargo.toml", r#" - cargo-features = ["edition"] [package] name = "foo" version = "0.0.1" @@ -1219,12 +1179,10 @@ .build(); p.cargo("doc -v") - .masquerade_as_nightly_cargo() .with_stderr_contains("[RUNNING] `rustdoc [..]--edition=2018[..]") .run(); p.cargo("test -v") - .masquerade_as_nightly_cargo() .with_stderr_contains("[RUNNING] `rustdoc [..]--edition=2018[..]") .run(); } diff -Nru cargo-0.35.0/tests/testsuite/edition.rs cargo-0.37.0/tests/testsuite/edition.rs --- cargo-0.35.0/tests/testsuite/edition.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/edition.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,11 +1,7 @@ -use crate::support::{basic_lib_manifest, is_nightly, project}; +use crate::support::{basic_lib_manifest, project}; #[test] fn edition_works_for_build_script() { - if !is_nightly() { - return; - } - let p = project() .file( "Cargo.toml", @@ -32,5 +28,5 @@ .file("a/src/lib.rs", "pub fn foo() {}") .build(); - p.cargo("build -v").masquerade_as_nightly_cargo().run(); + p.cargo("build -v").run(); } diff -Nru cargo-0.35.0/tests/testsuite/features.rs cargo-0.37.0/tests/testsuite/features.rs --- cargo-0.35.0/tests/testsuite/features.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/features.rs 2019-05-15 19:48:47.000000000 +0000 @@ -291,13 +291,12 @@ .file("bar/src/lib.rs", "") .build(); - p.cargo("build --features bar").with_stderr("\ -warning: Package `foo v0.0.1 ([..])` does not have feature `bar`. It has a required dependency with \ -that name, but only optional dependencies can be used as features. [..] - Compiling bar v0.0.1 ([..]) - Compiling foo v0.0.1 ([..]) - Finished dev [unoptimized + debuginfo] target(s) in [..]s -").run(); + p.cargo("build --features bar") +.with_stderr( + "\ +error: Package `foo v0.0.1 ([..])` does not have feature `bar`. It has a required dependency with that name, but only optional dependencies can be used as features. +", + ).with_status(101).run(); } #[test] @@ -335,13 +334,17 @@ .build(); p.cargo("build").with_stderr("\ -warning: Package `bar v0.0.1 ([..])` does not have feature `baz`. It has a required dependency with \ -that name, but only optional dependencies can be used as features. [..] - Compiling baz v0.0.1 ([..]) - Compiling bar v0.0.1 ([..]) - Compiling foo v0.0.1 ([..]) - Finished dev [unoptimized + debuginfo] target(s) in [..]s -").run(); +error: failed to select a version for `bar`. + ... required by package `foo v0.0.1 ([..])` +versions that meet the requirements `*` are: 0.0.1 + +the package `foo` depends on `bar`, with features: `baz` but `bar` does not have these features. + It has a required dependency with that name, but only optional dependencies can be used as features. + + +failed to select a version for `bar` which could resolve this conflict +").with_status(101) + .run(); } #[test] diff -Nru cargo-0.35.0/tests/testsuite/fix.rs cargo-0.37.0/tests/testsuite/fix.rs --- cargo-0.35.0/tests/testsuite/fix.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/fix.rs 2019-05-15 19:48:47.000000000 +0000 @@ -3,7 +3,6 @@ use git2; use crate::support::git; -use crate::support::is_nightly; use crate::support::{basic_manifest, project}; use std::io::Write; @@ -134,11 +133,11 @@ .build(); // Build our rustc shim - p.cargo("build").cwd(p.root().join("foo")).run(); + p.cargo("build").cwd("foo").run(); // Attempt to fix code, but our shim will always fail the second compile p.cargo("fix --allow-no-vcs --lib") - .cwd(p.root().join("bar")) + .cwd("bar") .env("__CARGO_FIX_YOLO", "1") .env("RUSTC", p.root().join("foo/target/debug/foo")) .with_stderr_contains( @@ -259,7 +258,7 @@ p.cargo("fix --allow-no-vcs") .env("__CARGO_FIX_YOLO", "1") - .cwd(p.root().join("foo")) + .cwd("foo") .run(); assert!(p.read_file("bar/src/lib.rs").contains("mut")); @@ -267,15 +266,11 @@ #[test] fn prepare_for_2018() { - if !is_nightly() { - return; - } let p = project() .file( "src/lib.rs", r#" #![allow(unused)] - #![feature(rust_2018_preview)] mod foo { pub const FOO: &str = "fooo"; @@ -311,15 +306,10 @@ #[test] fn local_paths() { - if !is_nightly() { - return; - } let p = project() .file( "src/lib.rs", r#" - #![feature(rust_2018_preview)] - use test::foo; mod test { @@ -350,9 +340,6 @@ #[test] fn upgrade_extern_crate() { - if !is_nightly() { - return; - } let p = project() .file( "Cargo.toml", @@ -403,15 +390,11 @@ #[test] fn specify_rustflags() { - if !is_nightly() { - return; - } let p = project() .file( "src/lib.rs", r#" #![allow(unused)] - #![feature(rust_2018_preview)] mod foo { pub const FOO: &str = "fooo"; @@ -702,7 +685,10 @@ #[test] fn shows_warnings() { let p = project() - .file("src/lib.rs", "#[deprecated] fn bar() {} pub fn foo() { let _ = bar(); }") + .file( + "src/lib.rs", + "#[deprecated] fn bar() {} pub fn foo() { let _ = bar(); }", + ) .build(); p.cargo("fix --allow-no-vcs") @@ -874,15 +860,10 @@ #[test] fn fix_overlapping() { - if !is_nightly() { - return; - } let p = project() .file( "src/lib.rs", r#" - #![feature(rust_2018_preview)] - pub fn foo() {} pub struct A; @@ -912,9 +893,6 @@ #[test] fn fix_idioms() { - if !is_nightly() { - return; - } let p = project() .file( "Cargo.toml", @@ -952,9 +930,7 @@ fn idioms_2015_ok() { let p = project().file("src/lib.rs", "").build(); - p.cargo("fix --edition-idioms --allow-no-vcs") - .masquerade_as_nightly_cargo() - .run(); + p.cargo("fix --edition-idioms --allow-no-vcs").run(); } #[test] @@ -1196,9 +1172,6 @@ #[test] fn fix_to_broken_code() { - if !is_nightly() { - return; - } let p = project() .file( "foo/Cargo.toml", @@ -1254,11 +1227,11 @@ .build(); // Build our rustc shim - p.cargo("build").cwd(p.root().join("foo")).run(); + p.cargo("build").cwd("foo").run(); // Attempt to fix code, but our shim will always fail the second compile p.cargo("fix --allow-no-vcs --broken-code") - .cwd(p.root().join("bar")) + .cwd("bar") .env("RUSTC", p.root().join("foo/target/debug/foo")) .with_status(101) .with_stderr_contains("[WARNING] failed to automatically apply fixes [..]") @@ -1289,3 +1262,26 @@ assert_eq!(p.read_file("tests/common/mod.rs"), "pub fn r#try() {}"); } + +#[test] +fn fix_in_existing_repo_weird_ignore() { + // Check that ignore doesn't ignore the repo itself. + let p = git::new("foo", |project| { + project + .file("src/lib.rs", "") + .file(".gitignore", "foo\ninner\n") + .file("inner/file", "") + }) + .unwrap(); + + p.cargo("fix").run(); + // This is questionable about whether it is the right behavior. It should + // probably be checking if any source file for the current project is + // ignored. + p.cargo("fix") + .cwd("inner") + .with_stderr_contains("[ERROR] no VCS found[..]") + .with_status(101) + .run(); + p.cargo("fix").cwd("src").run(); +} diff -Nru cargo-0.35.0/tests/testsuite/freshness.rs cargo-0.37.0/tests/testsuite/freshness.rs --- cargo-0.35.0/tests/testsuite/freshness.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/freshness.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,11 +1,12 @@ +use filetime::FileTime; use std::fs::{self, File, OpenOptions}; use std::io::prelude::*; use std::net::TcpListener; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use std::thread; use std::time::SystemTime; -use crate::support::paths::CargoPathExt; +use crate::support::paths::{self, CargoPathExt}; use crate::support::registry::Package; use crate::support::sleep_ms; use crate::support::{basic_manifest, is_coarse_mtime, project}; @@ -247,7 +248,6 @@ "\ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] [RUNNING] target[..]debug[..]deps[..]foo-[..][EXE] -[DOCTEST] foo ", ) .run(); @@ -340,7 +340,7 @@ /* Build and rebuild a/. Ensure dep_crate only builds once */ p.cargo("run") - .cwd(p.root().join("a")) + .cwd("a") .with_stdout("ftest off") .with_stderr( "\ @@ -351,9 +351,9 @@ ", ) .run(); - p.cargo("clean -p a").cwd(p.root().join("a")).run(); + p.cargo("clean -p a").cwd("a").run(); p.cargo("run") - .cwd(p.root().join("a")) + .cwd("a") .with_stdout("ftest off") .with_stderr( "\ @@ -366,7 +366,7 @@ /* Build and rebuild b/. Ensure dep_crate only builds once */ p.cargo("run") - .cwd(p.root().join("b")) + .cwd("b") .with_stdout("ftest on") .with_stderr( "\ @@ -377,9 +377,9 @@ ", ) .run(); - p.cargo("clean -p b").cwd(p.root().join("b")).run(); + p.cargo("clean -p b").cwd("b").run(); p.cargo("run") - .cwd(p.root().join("b")) + .cwd("b") .with_stdout("ftest on") .with_stderr( "\ @@ -392,9 +392,9 @@ /* Build a/ package again. If we cache different feature dep builds correctly, * this should not cause a rebuild of dep_crate */ - p.cargo("clean -p a").cwd(p.root().join("a")).run(); + p.cargo("clean -p a").cwd("a").run(); p.cargo("run") - .cwd(p.root().join("a")) + .cwd("a") .with_stdout("ftest off") .with_stderr( "\ @@ -407,9 +407,9 @@ /* Build b/ package again. If we cache different feature dep builds correctly, * this should not cause a rebuild */ - p.cargo("clean -p b").cwd(p.root().join("b")).run(); + p.cargo("clean -p b").cwd("b").run(); p.cargo("run") - .cwd(p.root().join("b")) + .cwd("b") .with_stdout("ftest on") .with_stderr( "\ @@ -682,7 +682,7 @@ .build(); p.cargo("build") - .cwd(p.root().join("a1")) + .cwd("a1") .with_stderr(&format!( "\ [COMPILING] d v0.0.1 ({dir}/d) @@ -695,7 +695,7 @@ )) .run(); p.cargo("build") - .cwd(p.root().join("a2")) + .cwd("a2") .with_stderr( "\ [COMPILING] a2 v0.0.1 ([CWD]) @@ -760,7 +760,7 @@ p.root().move_into_the_future(); p.cargo("build") - .env("RUST_LOG", "") + .env("CARGO_LOG", "") .with_stdout("") .with_stderr( "\ @@ -1439,8 +1439,8 @@ .with_stderr_unordered( "\ [COMPILING] bar [..] -[RUNNING] `rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C debuginfo=2 [..] -[RUNNING] `rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C panic=abort -C debuginfo=2 [..] +[RUNNING] `rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C debuginfo=2 [..] +[RUNNING] `rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort -C debuginfo=2 [..] [COMPILING] somepm [..] [RUNNING] `rustc --crate-name somepm [..] [COMPILING] foo [..] @@ -1527,7 +1527,7 @@ .file( "root/Cargo.toml", r#" - [project] + [package] name = "root" version = "0.1.0" authors = [] @@ -1549,7 +1549,7 @@ .file( "proc_macro_dep/Cargo.toml", r#" - [project] + [package] name = "proc_macro_dep" version = "0.1.0" authors = [] @@ -1617,3 +1617,410 @@ t.join().ok().unwrap(); } + +#[test] +fn dirty_both_lib_and_test() { + // This tests that all artifacts that depend on the results of a build + // script will get rebuilt when the build script reruns, even for separate + // commands. It does the following: + // + // 1. Project "foo" has a build script which will compile a small + // staticlib to link against. Normally this would use the `cc` crate, + // but here we just use rustc to avoid the `cc` dependency. + // 2. Build the library. + // 3. Build the unit test. The staticlib intentionally has a bad value. + // 4. Rewrite the staticlib with the correct value. + // 5. Build the library again. + // 6. Build the unit test. This should recompile. + + let slib = |n| { + format!( + r#" + #[no_mangle] + pub extern "C" fn doit() -> i32 {{ + return {}; + }} + "#, + n + ) + }; + + let p = project() + .file( + "src/lib.rs", + r#" + extern "C" { + fn doit() -> i32; + } + + #[test] + fn t1() { + assert_eq!(unsafe { doit() }, 1, "doit assert failure"); + } + "#, + ) + .file( + "build.rs", + r#" + use std::env; + use std::path::PathBuf; + use std::process::Command; + + fn main() { + let rustc = env::var_os("RUSTC").unwrap(); + let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); + assert!( + Command::new(rustc) + .args(&[ + "--crate-type=staticlib", + "--out-dir", + out_dir.to_str().unwrap(), + "slib.rs" + ]) + .status() + .unwrap() + .success(), + "slib build failed" + ); + println!("cargo:rustc-link-lib=slib"); + println!("cargo:rustc-link-search={}", out_dir.display()); + } + "#, + ) + .file("slib.rs", &slib(2)) + .build(); + + p.cargo("build").run(); + + // 2 != 1 + p.cargo("test --lib") + .with_status(101) + .with_stdout_contains("[..]doit assert failure[..]") + .run(); + + if is_coarse_mtime() { + // #5918 + sleep_ms(1000); + } + // Fix the mistake. + p.change_file("slib.rs", &slib(1)); + + p.cargo("build").run(); + // This should recompile with the new static lib, and the test should pass. + p.cargo("test --lib").run(); +} + +#[test] +fn script_fails_stay_dirty() { + // Check if a script is aborted (such as hitting Ctrl-C) that it will re-run. + // Steps: + // 1. Build to establish fingerprints. + // 2. Make a change that triggers the build script to re-run. Abort the + // script while it is running. + // 3. Run the build again and make sure it re-runs the script. + let p = project() + .file( + "build.rs", + r#" + mod helper; + fn main() { + println!("cargo:rerun-if-changed=build.rs"); + helper::doit(); + } + "#, + ) + .file("helper.rs", "pub fn doit() {}") + .file("src/lib.rs", "") + .build(); + + p.cargo("build").run(); + if is_coarse_mtime() { + sleep_ms(1000); + } + p.change_file("helper.rs", r#"pub fn doit() {panic!("Crash!");}"#); + p.cargo("build") + .with_stderr_contains("[..]Crash![..]") + .with_status(101) + .run(); + // There was a bug where this second call would be "fresh". + p.cargo("build") + .with_stderr_contains("[..]Crash![..]") + .with_status(101) + .run(); +} + +#[test] +fn simulated_docker_deps_stay_cached() { + // Test what happens in docker where the nanoseconds are zeroed out. + Package::new("regdep", "1.0.0").publish(); + Package::new("regdep_old_style", "1.0.0") + .file("build.rs", "fn main() {}") + .file("src/lib.rs", "") + .publish(); + Package::new("regdep_env", "1.0.0") + .file( + "build.rs", + r#" + fn main() { + println!("cargo:rerun-if-env-changed=SOMEVAR"); + } + "#, + ) + .file("src/lib.rs", "") + .publish(); + Package::new("regdep_rerun", "1.0.0") + .file( + "build.rs", + r#" + fn main() { + println!("cargo:rerun-if-changed=build.rs"); + } + "#, + ) + .file("src/lib.rs", "") + .publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + + [dependencies] + pathdep = { path = "pathdep" } + regdep = "1.0" + regdep_old_style = "1.0" + regdep_env = "1.0" + regdep_rerun = "1.0" + "#, + ) + .file( + "src/lib.rs", + " + extern crate pathdep; + extern crate regdep; + extern crate regdep_old_style; + extern crate regdep_env; + extern crate regdep_rerun; + ", + ) + .file("build.rs", "fn main() {}") + .file("pathdep/Cargo.toml", &basic_manifest("pathdep", "1.0.0")) + .file("pathdep/src/lib.rs", "") + .build(); + + p.cargo("build").run(); + + let already_zero = { + // This happens on HFS with 1-second timestamp resolution, + // or other filesystems where it just so happens to write exactly on a + // 1-second boundary. + let metadata = fs::metadata(p.root().join("src/lib.rs")).unwrap(); + let mtime = FileTime::from_last_modification_time(&metadata); + mtime.nanoseconds() == 0 + }; + + // Recursively remove `nanoseconds` from every path. + fn zeropath(path: &Path) { + for entry in walkdir::WalkDir::new(path) + .into_iter() + .filter_map(|e| e.ok()) + { + let metadata = fs::metadata(entry.path()).unwrap(); + let mtime = metadata.modified().unwrap(); + let mtime_duration = mtime.duration_since(SystemTime::UNIX_EPOCH).unwrap(); + let trunc_mtime = FileTime::from_unix_time(mtime_duration.as_secs() as i64, 0); + let atime = metadata.accessed().unwrap(); + let atime_duration = atime.duration_since(SystemTime::UNIX_EPOCH).unwrap(); + let trunc_atime = FileTime::from_unix_time(atime_duration.as_secs() as i64, 0); + if let Err(e) = filetime::set_file_times(entry.path(), trunc_atime, trunc_mtime) { + // Windows doesn't allow changing filetimes on some things + // (directories, other random things I'm not sure why). Just + // ignore them. + if e.kind() == std::io::ErrorKind::PermissionDenied { + println!("PermissionDenied filetime on {:?}", entry.path()); + } else { + panic!("FileTime error on {:?}: {:?}", entry.path(), e); + } + } + } + } + zeropath(&p.root()); + zeropath(&paths::home()); + + if already_zero { + println!("already zero"); + // If it was already truncated, then everything stays fresh. + p.cargo("build -v") + .with_stderr_unordered( + "\ +[FRESH] pathdep [..] +[FRESH] regdep [..] +[FRESH] regdep_env [..] +[FRESH] regdep_old_style [..] +[FRESH] regdep_rerun [..] +[FRESH] foo [..] +[FINISHED] [..] +", + ) + .run(); + } else { + println!("not already zero"); + // It is not ideal that `foo` gets recompiled, but that is the current + // behavior. Currently mtimes are ignored for registry deps. + // + // Note that this behavior is due to the fact that `foo` has a build + // script in "old" mode where it doesn't print `rerun-if-*`. In this + // mode we use `Precalculated` to fingerprint a path dependency, where + // `Precalculated` is an opaque string which has the most recent mtime + // in it. It differs between builds because one has nsec=0 and the other + // likely has a nonzero nsec. Hence, the rebuild. + p.cargo("build -v") + .with_stderr_unordered( + "\ +[FRESH] pathdep [..] +[FRESH] regdep [..] +[FRESH] regdep_env [..] +[FRESH] regdep_old_style [..] +[FRESH] regdep_rerun [..] +[COMPILING] foo [..] +[RUNNING] [..]/foo-[..]/build-script-build[..] +[RUNNING] `rustc --crate-name foo[..] +[FINISHED] [..] +", + ) + .run(); + } +} + +#[test] +fn metadata_change_invalidates() { + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("build").run(); + + for attr in &[ + "authors = [\"foo\"]", + "description = \"desc\"", + "homepage = \"https://example.com\"", + "repository =\"https://example.com\"", + ] { + let mut file = OpenOptions::new() + .write(true) + .append(true) + .open(p.root().join("Cargo.toml")) + .unwrap(); + writeln!(file, "{}", attr).unwrap(); + p.cargo("build") + .with_stderr_contains("[COMPILING] foo [..]") + .run(); + } + p.cargo("build -v") + .with_stderr_contains("[FRESH] foo[..]") + .run(); + assert_eq!(p.glob("target/debug/deps/libfoo-*.rlib").count(), 1); +} + +#[test] +fn edition_change_invalidates() { + const MANIFEST: &str = r#" + [package] + name = "foo" + version = "0.1.0" + "#; + let p = project() + .file("Cargo.toml", MANIFEST) + .file("src/lib.rs", "") + .build(); + p.cargo("build").run(); + p.change_file("Cargo.toml", &format!("{}edition = \"2018\"", MANIFEST)); + p.cargo("build") + .with_stderr_contains("[COMPILING] foo [..]") + .run(); + p.change_file( + "Cargo.toml", + &format!( + r#"{}edition = "2018" + [lib] + edition = "2015" + "#, + MANIFEST + ), + ); + p.cargo("build") + .with_stderr_contains("[COMPILING] foo [..]") + .run(); + p.cargo("build -v") + .with_stderr_contains("[FRESH] foo[..]") + .run(); + assert_eq!(p.glob("target/debug/deps/libfoo-*.rlib").count(), 1); +} + +#[test] +fn rename_with_path_deps() { + let p = project() + .file( + "Cargo.toml", + r#" + [project] + name = "foo" + version = "0.5.0" + authors = [] + + [dependencies] + a = { path = 'a' } + "#, + ) + .file("src/lib.rs", "extern crate a; pub fn foo() { a::foo(); }") + .file( + "a/Cargo.toml", + r#" + [project] + name = "a" + version = "0.5.0" + authors = [] + + [dependencies] + b = { path = 'b' } + "#, + ) + .file("a/src/lib.rs", "extern crate b; pub fn foo() { b::foo() }") + .file( + "a/b/Cargo.toml", + r#" + [project] + name = "b" + version = "0.5.0" + authors = [] + "#, + ) + .file("a/b/src/lib.rs", "pub fn foo() { }"); + let p = p.build(); + + p.cargo("build").run(); + + // Now rename the root directory and rerun `cargo run`. Not only should we + // not build anything but we also shouldn't crash. + let mut new = p.root(); + new.pop(); + new.push("foo2"); + + fs::rename(p.root(), &new).unwrap(); + + p.cargo("build") + .cwd(&new) + .with_stderr("[FINISHED] [..]") + .run(); +} diff -Nru cargo-0.35.0/tests/testsuite/git.rs cargo-0.37.0/tests/testsuite/git.rs --- cargo-0.35.0/tests/testsuite/git.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/git.rs 2019-05-15 19:48:47.000000000 +0000 @@ -13,6 +13,13 @@ use crate::support::Project; use crate::support::{basic_lib_manifest, basic_manifest, git, main_file, path2url, project}; +fn disable_git_cli() -> bool { + // mingw git on Windows does not support Windows-style file URIs. + // Appveyor in the rust repo has that git up front in the PATH instead + // of Git-for-Windows, which causes this to fail. + env::var("CARGO_TEST_DISABLE_GIT_CLI") == Ok("1".to_string()) +} + #[test] fn cargo_compile_simple_git_dep() { let project = project(); @@ -77,175 +84,6 @@ } #[test] -fn cargo_compile_forbird_git_httpsrepo_offline() { - let p = project() - .file( - "Cargo.toml", - r#" - - [project] - name = "foo" - version = "0.5.0" - authors = ["chabapok@example.com"] - - [dependencies.dep1] - git = 'https://github.com/some_user/dep1.git' - "#, - ) - .file("src/main.rs", "") - .build(); - - p.cargo("build -Zoffline").masquerade_as_nightly_cargo().with_status(101). - with_stderr("\ -error: failed to load source for a dependency on `dep1` - -Caused by: - Unable to update https://github.com/some_user/dep1.git - -Caused by: - can't checkout from 'https://github.com/some_user/dep1.git': you are in the offline mode (-Z offline)").run(); -} - -#[test] -fn cargo_compile_offline_with_cached_git_dep() { - let git_project = git::new("dep1", |project| { - project - .file("Cargo.toml", &basic_lib_manifest("dep1")) - .file( - "src/lib.rs", - r#" - pub static COOL_STR:&str = "cached git repo rev1"; - "#, - ) - }) - .unwrap(); - - let repo = git2::Repository::open(&git_project.root()).unwrap(); - let rev1 = repo.revparse_single("HEAD").unwrap().id(); - - // Commit the changes and make sure we trigger a recompile - File::create(&git_project.root().join("src/lib.rs")) - .unwrap() - .write_all(br#"pub static COOL_STR:&str = "cached git repo rev2";"#) - .unwrap(); - git::add(&repo); - let rev2 = git::commit(&repo); - - { - // cache to registry rev1 and rev2 - let prj = project() - .at("cache_git_dep") - .file( - "Cargo.toml", - &format!( - r#" - [project] - name = "cache_git_dep" - version = "0.5.0" - - [dependencies.dep1] - git = '{}' - rev = "{}" - "#, - git_project.url(), - rev1 - ), - ) - .file("src/main.rs", "fn main(){}") - .build(); - prj.cargo("build").run(); - - File::create(&prj.root().join("Cargo.toml")) - .unwrap() - .write_all( - &format!( - r#" - [project] - name = "cache_git_dep" - version = "0.5.0" - - [dependencies.dep1] - git = '{}' - rev = "{}" - "#, - git_project.url(), - rev2 - ) - .as_bytes(), - ) - .unwrap(); - prj.cargo("build").run(); - } - - let p = project() - .file( - "Cargo.toml", - &format!( - r#" - [project] - name = "foo" - version = "0.5.0" - - [dependencies.dep1] - git = '{}' - "#, - git_project.url() - ), - ) - .file( - "src/main.rs", - &main_file(r#""hello from {}", dep1::COOL_STR"#, &["dep1"]), - ) - .build(); - - let git_root = git_project.root(); - - p.cargo("build -Zoffline") - .masquerade_as_nightly_cargo() - .with_stderr(format!( - "\ -[COMPILING] dep1 v0.5.0 ({}#[..]) -[COMPILING] foo v0.5.0 ([CWD]) -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]", - path2url(git_root), - )) - .run(); - - assert!(p.bin("foo").is_file()); - - p.process(&p.bin("foo")) - .with_stdout("hello from cached git repo rev2\n") - .run(); - - File::create(&p.root().join("Cargo.toml")) - .unwrap() - .write_all( - &format!( - r#" - [project] - name = "foo" - version = "0.5.0" - - [dependencies.dep1] - git = '{}' - rev = "{}" - "#, - git_project.url(), - rev1 - ) - .as_bytes(), - ) - .unwrap(); - - p.cargo("build -Zoffline") - .masquerade_as_nightly_cargo() - .run(); - p.process(&p.bin("foo")) - .with_stdout("hello from cached git repo rev1\n") - .run(); -} - -#[test] fn cargo_compile_git_dep_branch() { let project = project(); let git_project = git::new("dep1", |project| { @@ -2477,132 +2315,50 @@ } #[test] -#[ignore] // accesses crates.io fn include_overrides_gitignore() { - let p = git::new("reduction", |repo| { + // Make sure that `package.include` takes precedence over .gitignore. + let p = git::new("foo", |repo| { repo.file( "Cargo.toml", r#" [package] - name = "reduction" + name = "foo" version = "0.5.0" - authors = ["pnkfelix"] - build = "tango-build.rs" - include = ["src/lib.rs", "src/incl.rs", "src/mod.md", "tango-build.rs", "Cargo.toml"] - - [build-dependencies] - filetime = "0.1" + include = ["src/lib.rs", "ignored.txt", "Cargo.toml"] "#, ) .file( ".gitignore", r#" - target + /target Cargo.lock - # Below files represent generated code, thus not managed by `git` - src/incl.rs - src/not_incl.rs - "#, - ) - .file( - "tango-build.rs", - r#" - extern crate filetime; - use filetime::FileTime; - use std::fs::{self, File}; - - fn main() { - // generate files, or bring their timestamps into sync. - let source = "src/mod.md"; - - let metadata = fs::metadata(source).unwrap(); - let mtime = FileTime::from_last_modification_time(&metadata); - let atime = FileTime::from_last_access_time(&metadata); - - // sync time stamps for generated files with time stamp of source file. - - let files = ["src/not_incl.rs", "src/incl.rs"]; - for file in files.iter() { - File::create(file).unwrap(); - filetime::set_file_times(file, atime, mtime).unwrap(); - } - } - "#, - ) - .file("src/lib.rs", "mod not_incl; mod incl;") - .file( - "src/mod.md", - r#" - (The content of this file does not matter since we are not doing real codegen.) + ignored.txt "#, ) + .file("src/lib.rs", "") + .file("ignored.txt", "") + .file("build.rs", "fn main() {}") }) .unwrap(); - println!("build 1: all is new"); - p.cargo("build -v") - .with_stderr( - "\ -[UPDATING] `[..]` index -[DOWNLOADED] filetime [..] -[DOWNLOADED] libc [..] -[COMPILING] libc [..] -[RUNNING] `rustc --crate-name libc [..]` -[COMPILING] filetime [..] -[RUNNING] `rustc --crate-name filetime [..]` -[COMPILING] reduction [..] -[RUNNING] `rustc --crate-name build_script_tango_build tango-build.rs --crate-type bin [..]` -[RUNNING] `[..]/build-script-tango-build` -[RUNNING] `rustc --crate-name reduction src/lib.rs --crate-type lib [..]` -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -", - ) - .run(); - - println!("build 2: nothing changed; file timestamps reset by build script"); - p.cargo("build -v") - .with_stderr( - "\ -[FRESH] libc [..] -[FRESH] filetime [..] -[FRESH] reduction [..] -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -", - ) - .run(); - - println!("build 3: touch `src/not_incl.rs`; expect build script **not** re-run"); - sleep_ms(1000); - File::create(p.root().join("src").join("not_incl.rs")).unwrap(); - + p.cargo("build").run(); + p.change_file("ignored.txt", "Trigger rebuild."); p.cargo("build -v") .with_stderr( "\ -[FRESH] libc [..] -[FRESH] filetime [..] -[COMPILING] reduction [..] -[RUNNING] `rustc --crate-name reduction src/lib.rs --crate-type lib [..]` +[COMPILING] foo v0.5.0 ([..]) +[RUNNING] `[..]build-script-build[..]` +[RUNNING] `rustc --crate-name foo src/lib.rs [..]` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", ) .run(); - - // This final case models the bug from rust-lang/cargo#4135: an - // explicitly included file should cause a build-script re-run, - // even if that same file is matched by `.gitignore`. - println!("build 4: touch `src/incl.rs`; expect build script re-run"); - sleep_ms(1000); - File::create(p.root().join("src").join("incl.rs")).unwrap(); - - p.cargo("build -v") - .with_stderr( + p.cargo("package --list --allow-dirty") + .with_stdout( "\ -[FRESH] libc [..] -[FRESH] filetime [..] -[COMPILING] reduction [..] -[RUNNING] `[..]/build-script-tango-build` -[RUNNING] `rustc --crate-name reduction src/lib.rs --crate-type lib [..]` -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] +Cargo.toml +ignored.txt +src/lib.rs ", ) .run(); @@ -2714,7 +2470,7 @@ }); let repo = git2::Repository::open(&git_project2.root()).unwrap(); - let url = format!("http://{}:{}/", addr.ip(), addr.port()); + let url = format!("https://{}:{}/", addr.ip(), addr.port()); { let mut s = repo.submodule(&url, Path::new("bar"), false).unwrap(); let subrepo = s.open().unwrap(); @@ -2772,10 +2528,7 @@ #[test] fn use_the_cli() { - if env::var("CARGO_TEST_DISABLE_GIT_CLI") == Ok("1".to_string()) { - // mingw git on Windows does not support Windows-style file URIs. - // Appveyor in the rust repo has that git up front in the PATH instead - // of Git-for-Windows, which causes this to fail. + if disable_git_cli() { return; } let project = project(); @@ -2861,7 +2614,7 @@ File::create(paths::home().join(".gitconfig")) .unwrap() .write_all( - &format!( + format!( r#" [init] templatedir = {} @@ -2880,3 +2633,64 @@ p.cargo("build").run(); } + +#[test] +fn git_with_cli_force() { + if disable_git_cli() { + return; + } + // Supports a force-pushed repo. + let git_project = git::new("dep1", |project| { + project + .file("Cargo.toml", &basic_lib_manifest("dep1")) + .file("src/lib.rs", r#"pub fn f() { println!("one"); }"#) + }) + .unwrap(); + let p = project() + .file( + "Cargo.toml", + &format!( + r#" + [project] + name = "foo" + version = "0.0.1" + edition = "2018" + + [dependencies] + dep1 = {{ git = "{}" }} + "#, + git_project.url() + ), + ) + .file("src/main.rs", "fn main() { dep1::f(); }") + .file( + ".cargo/config", + " + [net] + git-fetch-with-cli = true + ", + ) + .build(); + p.cargo("build").run(); + p.rename_run("foo", "foo1").with_stdout("one").run(); + + // commit --amend a change that will require a force fetch. + let repo = git2::Repository::open(&git_project.root()).unwrap(); + git_project.change_file("src/lib.rs", r#"pub fn f() { println!("two"); }"#); + git::add(&repo); + let id = repo.refname_to_id("HEAD").unwrap(); + let commit = repo.find_commit(id).unwrap(); + let tree_id = t!(t!(repo.index()).write_tree()); + t!(commit.amend( + Some("HEAD"), + None, + None, + None, + None, + Some(&t!(repo.find_tree(tree_id))) + )); + // Perform the fetch. + p.cargo("update").run(); + p.cargo("build").run(); + p.rename_run("foo", "foo2").with_stdout("two").run(); +} diff -Nru cargo-0.35.0/tests/testsuite/init.rs cargo-0.37.0/tests/testsuite/init.rs --- cargo-0.35.0/tests/testsuite/init.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/init.rs 2019-05-15 19:48:47.000000000 +0000 @@ -2,6 +2,7 @@ use std::env; use std::fs::{self, File}; use std::io::prelude::*; +use std::process::Command; use crate::support::{paths, Execs}; @@ -11,6 +12,18 @@ execs } +fn mercurial_available() -> bool { + let result = Command::new("hg") + .arg("--version") + .output() + .map(|o| o.status.success()) + .unwrap_or(false); + if !result { + println!("`hg` not available, skipping test"); + } + result +} + #[test] fn simple_lib() { cargo_process("init --lib --vcs none --edition 2015") @@ -48,10 +61,11 @@ fn simple_git_ignore_exists() { // write a .gitignore file with one entry fs::create_dir_all(paths::root().join("foo")).unwrap(); - let mut ignore_file = File::create(paths::root().join("foo/.gitignore")).unwrap(); - ignore_file - .write("/target\n**/some.file".as_bytes()) - .unwrap(); + fs::write( + paths::root().join("foo/.gitignore"), + "/target\n**/some.file", + ) + .unwrap(); cargo_process("init --lib foo --edition 2015") .env("USER", "foo") @@ -79,7 +93,7 @@ \n\ #/target\n\ **/*.rs.bk\n\ - Cargo.lock", + Cargo.lock\n", ); cargo_process("build").cwd(&paths::root().join("foo")).run(); @@ -453,6 +467,63 @@ } #[test] +fn terminating_newline_in_new_git_ignore() { + cargo_process("init --vcs git --lib") + .env("USER", "foo") + .run(); + + let content = fs::read_to_string(&paths::root().join(".gitignore")).unwrap(); + + let mut last_chars = content.chars().rev(); + assert_eq!(last_chars.next(), Some('\n')); + assert_ne!(last_chars.next(), Some('\n')); +} + +#[test] +fn terminating_newline_in_new_mercurial_ignore() { + if !mercurial_available() { + return; + } + cargo_process("init --vcs hg --lib") + .env("USER", "foo") + .run(); + + let content = fs::read_to_string(&paths::root().join(".hgignore")).unwrap(); + + let mut last_chars = content.chars().rev(); + assert_eq!(last_chars.next(), Some('\n')); + assert_ne!(last_chars.next(), Some('\n')); +} + +#[test] +fn terminating_newline_in_existing_git_ignore() { + fs::create_dir(&paths::root().join(".git")).unwrap(); + fs::write(&paths::root().join(".gitignore"), b"first").unwrap(); + + cargo_process("init --lib").env("USER", "foo").run(); + + let content = fs::read_to_string(&paths::root().join(".gitignore")).unwrap(); + + let mut last_chars = content.chars().rev(); + assert_eq!(last_chars.next(), Some('\n')); + assert_ne!(last_chars.next(), Some('\n')); +} + +#[test] +fn terminating_newline_in_existing_mercurial_ignore() { + fs::create_dir(&paths::root().join(".hg")).unwrap(); + fs::write(&paths::root().join(".hgignore"), b"first").unwrap(); + + cargo_process("init --lib").env("USER", "foo").run(); + + let content = fs::read_to_string(&paths::root().join(".hgignore")).unwrap(); + + let mut last_chars = content.chars().rev(); + assert_eq!(last_chars.next(), Some('\n')); + assert_ne!(last_chars.next(), Some('\n')); +} + +#[test] fn cargo_lock_gitignored_if_lib1() { fs::create_dir(&paths::root().join(".git")).unwrap(); diff -Nru cargo-0.35.0/tests/testsuite/install.rs cargo-0.37.0/tests/testsuite/install.rs --- cargo-0.35.0/tests/testsuite/install.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/install.rs 2019-05-15 19:48:47.000000000 +0000 @@ -35,7 +35,8 @@ [COMPILING] foo v0.0.1 [FINISHED] release [optimized] target(s) in [..] [INSTALLING] [CWD]/home/.cargo/bin/foo[EXE] -warning: be sure to add `[..]` to your PATH to be able to run the installed binaries +[INSTALLED] package `foo v0.0.1` (executable `foo[EXE]`) +[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries ", ) .run(); @@ -63,16 +64,18 @@ [COMPILING] foo v0.0.1 [FINISHED] release [optimized] target(s) in [..] [INSTALLING] [CWD]/home/.cargo/bin/foo[EXE] +[INSTALLED] package `foo v0.0.1` (executable `foo[EXE]`) [DOWNLOADING] crates ... [DOWNLOADED] bar v0.0.2 (registry `[CWD]/registry`) [INSTALLING] bar v0.0.2 [COMPILING] bar v0.0.2 [FINISHED] release [optimized] target(s) in [..] [INSTALLING] [CWD]/home/.cargo/bin/bar[EXE] -error: could not find `baz` in registry `[..]` +[INSTALLED] package `bar v0.0.2` (executable `bar[EXE]`) +[ERROR] could not find `baz` in registry `[..]` [SUMMARY] Successfully installed foo, bar! Failed to install baz (see error(s) above). -warning: be sure to add `[..]` to your PATH to be able to run the installed binaries -error: some crates failed to install +[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries +[ERROR] some crates failed to install ", ) .run(); @@ -111,7 +114,8 @@ [COMPILING] foo v0.2.1 [FINISHED] release [optimized] target(s) in [..] [INSTALLING] [CWD]/home/.cargo/bin/foo[EXE] -warning: be sure to add `[..]` to your PATH to be able to run the installed binaries +[INSTALLED] package `foo v0.2.1` (executable `foo[EXE]`) +[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries ", ) .run(); @@ -251,7 +255,6 @@ .with_status(101) .with_stderr( "\ -[INSTALLING] foo v0.0.1 [..] [ERROR] binary `foo[..]` already exists in destination as part of `foo v0.0.1 [..]` Add --force to overwrite ", @@ -427,8 +430,7 @@ .with_status(101) .with_stderr( "\ -[INSTALLING] foo [..] -[ERROR] specified package has no binaries +[ERROR] specified package `foo v0.0.1 ([..])` has no binaries ", ) .run(); @@ -461,7 +463,6 @@ .with_status(101) .with_stderr( "\ -[INSTALLING] foo v0.0.1 [..] [ERROR] binary `foo-bin1[..]` already exists in destination as part of `foo v0.0.1 ([..])` binary `foo-bin2[..]` already exists in destination as part of `foo v0.0.1 ([..])` Add --force to overwrite @@ -490,7 +491,8 @@ [COMPILING] foo v0.2.0 ([..]) [FINISHED] release [optimized] target(s) in [..] [REPLACING] [CWD]/home/.cargo/bin/foo[EXE] -warning: be sure to add `[..]` to your PATH to be able to run the installed binaries +[REPLACED] package `foo v0.0.1 ([..]/foo)` with `foo v0.2.0 ([..]/foo2)` (executable `foo[EXE]`) +[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries ", ) .run(); @@ -530,7 +532,9 @@ [FINISHED] release [optimized] target(s) in [..] [INSTALLING] [CWD]/home/.cargo/bin/foo-bin3[EXE] [REPLACING] [CWD]/home/.cargo/bin/foo-bin2[EXE] -warning: be sure to add `[..]` to your PATH to be able to run the installed binaries +[INSTALLED] package `foo v0.2.0 ([..]/foo2)` (executable `foo-bin3[EXE]`) +[REPLACED] package `foo v0.0.1 ([..]/foo)` with `foo v0.2.0 ([..]/foo2)` (executable `foo-bin2[EXE]`) +[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries ", ) .run(); @@ -572,7 +576,8 @@ [COMPILING] foo v0.2.0 ([..]) [FINISHED] release [optimized] target(s) in [..] [REPLACING] [CWD]/home/.cargo/bin/foo-bin2[EXE] -warning: be sure to add `[..]` to your PATH to be able to run the installed binaries +[REPLACED] package `foo v0.0.1 ([..]/foo)` with `foo v0.2.0 ([..]/foo2)` (executable `foo-bin2[EXE]`) +[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries ", ) .run(); @@ -627,7 +632,8 @@ [COMPILING] foo v0.1.0 ([..]) [FINISHED] release [optimized] target(s) in [..] [INSTALLING] [CWD]/home/.cargo/bin/foo[EXE] -warning: be sure to add `[..]` to your PATH to be able to run the installed binaries +[INSTALLED] package `foo v0.1.0 ([..]/foo#[..])` (executable `foo[EXE]`) +[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries ", ) .run(); @@ -770,17 +776,10 @@ #[test] fn installs_from_cwd_with_2018_warnings() { - if !support::is_nightly() { - // Stable rust won't have the edition option. Remove this once it - // is stabilized. - return; - } let p = project() .file( "Cargo.toml", r#" - cargo-features = ["edition"] - [package] name = "foo" version = "0.1.0" @@ -792,7 +791,6 @@ .build(); p.cargo("install") - .masquerade_as_nightly_cargo() .with_status(101) .with_stderr_contains( "error: Using `cargo install` to install the binaries for the \ @@ -814,7 +812,8 @@ [COMPILING] foo v0.0.1 ([CWD]) [FINISHED] release [optimized] target(s) in [..] [INSTALLING] {home}/bin/foo[EXE] -warning: be sure to add `{home}/bin` to your PATH to be able to run the installed binaries", +[INSTALLED] package `foo v0.0.1 ([..]/foo)` (executable `foo[EXE]`) +[WARNING] be sure to add `{home}/bin` to your PATH to be able to run the installed binaries", home = cargo_home().display(), )) .run(); @@ -873,10 +872,12 @@ cargo_process("install --path") .arg(p.root()) .with_stderr( - "[INSTALLING] [..] + "\ +[INSTALLING] [..] [FINISHED] release [optimized] target(s) in [..] [INSTALLING] [..] -warning: be sure to add `[..]` to your PATH to be able to run the installed binaries +[INSTALLED] package `foo v0.0.1 ([..]/foo)` (executable `foo[EXE]`) +[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries ", ) .run(); @@ -1186,6 +1187,7 @@ #[test] fn install_respects_lock_file() { + // `cargo install` now requires --locked to use a Cargo.lock. Package::new("bar", "0.1.0").publish(); Package::new("bar", "0.1.1") .file("src/lib.rs", "not rust") @@ -1215,7 +1217,57 @@ ) .publish(); - cargo_process("install foo").run(); + cargo_process("install foo") + .with_stderr_contains("[..]not rust[..]") + .with_status(101) + .run(); + cargo_process("install --locked foo").run(); +} + +#[test] +fn install_path_respects_lock_file() { + // --path version of install_path_respects_lock_file, --locked is required + // to use Cargo.lock. + Package::new("bar", "0.1.0").publish(); + Package::new("bar", "0.1.1") + .file("src/lib.rs", "not rust") + .publish(); + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + + [dependencies] + bar = "0.1" + "#, + ) + .file("src/main.rs", "extern crate bar; fn main() {}") + .file( + "Cargo.lock", + r#" +[[package]] +name = "bar" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "foo" +version = "0.1.0" +dependencies = [ + "bar 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] +"#, + ) + .build(); + + p.cargo("install --path .") + .with_stderr_contains("[..]not rust[..]") + .with_status(101) + .run(); + p.cargo("install --path . --locked").run(); } #[test] @@ -1311,14 +1363,15 @@ .file("bar/src/main.rs", "fn main() {}") .build(); - p.cargo("build --release").cwd(p.root().join("bar")).run(); + p.cargo("build --release").cwd("bar").run(); cargo_process("install --path") .arg(p.root().join("bar")) .with_stderr( "[INSTALLING] [..] [FINISHED] release [optimized] target(s) in [..] [INSTALLING] [..] -warning: be sure to add `[..]` to your PATH to be able to run the installed binaries +[INSTALLED] package `bar v0.1.0 ([..]/bar)` (executable `bar[EXE]`) +[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries ", ) .run(); @@ -1348,7 +1401,7 @@ pkg("bar", "0.0.1"); let config = cargo_home().join("config"); - let mut toml = fs::read_to_string(&config).unwrap_or(String::new()); + let mut toml = fs::read_to_string(&config).unwrap_or_default(); toml.push_str( r#" @@ -1363,3 +1416,43 @@ .with_stderr_contains("[..]--target nonexistent[..]") .run(); } + +#[test] +fn install_path_config() { + project() + .file( + ".cargo/config", + r#" + [build] + target = 'nonexistent' + "#, + ) + .file("src/main.rs", "fn main() {}") + .build(); + cargo_process("install --path foo") + .with_status(101) + .with_stderr_contains("[..]--target nonexistent[..]") + .run(); +} + +#[test] +fn install_version_req() { + // Try using a few versionreq styles. + pkg("foo", "0.0.3"); + pkg("foo", "1.0.4"); + pkg("foo", "1.0.5"); + cargo_process("install foo --version=*") + .with_stderr_does_not_contain("[WARNING][..]is not a valid semver[..]") + .with_stderr_contains("[INSTALLING] foo v1.0.5") + .run(); + cargo_process("uninstall foo").run(); + cargo_process("install foo --version=^1.0") + .with_stderr_does_not_contain("[WARNING][..]is not a valid semver[..]") + .with_stderr_contains("[INSTALLING] foo v1.0.5") + .run(); + cargo_process("uninstall foo").run(); + cargo_process("install foo --version=0.0.*") + .with_stderr_does_not_contain("[WARNING][..]is not a valid semver[..]") + .with_stderr_contains("[INSTALLING] foo v0.0.3") + .run(); +} diff -Nru cargo-0.35.0/tests/testsuite/install_upgrade.rs cargo-0.37.0/tests/testsuite/install_upgrade.rs --- cargo-0.35.0/tests/testsuite/install_upgrade.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/install_upgrade.rs 2019-05-15 19:48:47.000000000 +0000 @@ -0,0 +1,786 @@ +use cargo::core::PackageId; +use std::collections::BTreeSet; +use std::env; +use std::fs; +use std::path::PathBuf; +use std::sync::atomic::{AtomicUsize, Ordering}; + +use crate::support::install::{cargo_home, exe}; +use crate::support::paths::CargoPathExt; +use crate::support::registry::Package; +use crate::support::{ + basic_manifest, cargo_process, cross_compile, execs, git, process, project, Execs, +}; + +// Helper for publishing a package. +fn pkg(name: &str, vers: &str) { + Package::new(name, vers) + .file( + "src/main.rs", + r#"fn main() { println!("{}", env!("CARGO_PKG_VERSION")) }"#, + ) + .publish(); +} + +fn v1_path() -> PathBuf { + cargo_home().join(".crates.toml") +} + +fn v2_path() -> PathBuf { + cargo_home().join(".crates2.json") +} + +fn load_crates1() -> toml::Value { + toml::from_str(&fs::read_to_string(v1_path()).unwrap()).unwrap() +} + +fn load_crates2() -> serde_json::Value { + serde_json::from_str(&fs::read_to_string(v2_path()).unwrap()).unwrap() +} + +fn installed_exe(name: &str) -> PathBuf { + cargo_home().join("bin").join(exe(name)) +} + +/// Helper for executing binaries installed by cargo. +fn installed_process(name: &str) -> Execs { + static NEXT_ID: AtomicUsize = AtomicUsize::new(0); + thread_local!(static UNIQUE_ID: usize = NEXT_ID.fetch_add(1, Ordering::SeqCst)); + + // This copies the executable to a unique name so that it may be safely + // replaced on Windows. See Project::rename_run for details. + let src = installed_exe(name); + let dst = installed_exe(&UNIQUE_ID.with(|my_id| format!("{}-{}", name, my_id))); + // Note: Cannot use copy. On Linux, file descriptors may be left open to + // the executable as other tests in other threads are constantly spawning + // new processes (see https://github.com/rust-lang/cargo/pull/5557 for + // more). + fs::rename(&src, &dst) + .unwrap_or_else(|e| panic!("Failed to rename `{:?}` to `{:?}`: {}", src, dst, e)); + // Leave behind a fake file so that reinstall duplicate check works. + fs::write(src, "").unwrap(); + let p = process(dst); + execs().with_process_builder(p) +} + +/// Check that the given package name/version has the following bins listed in +/// the trackers. Also verifies that both trackers are in sync and valid. +fn validate_trackers(name: &str, version: &str, bins: &[&str]) { + let v1 = load_crates1(); + let v1_table = v1.get("v1").unwrap().as_table().unwrap(); + let v2 = load_crates2(); + let v2_table = v2["installs"].as_object().unwrap(); + assert_eq!(v1_table.len(), v2_table.len()); + // Convert `bins` to a BTreeSet. + let bins: BTreeSet = bins + .iter() + .map(|b| format!("{}{}", b, env::consts::EXE_SUFFIX)) + .collect(); + // Check every entry matches between v1 and v2. + for (pkg_id_str, v1_bins) in v1_table { + let pkg_id: PackageId = toml::Value::from(pkg_id_str.to_string()) + .try_into() + .unwrap(); + let v1_bins: BTreeSet = v1_bins + .as_array() + .unwrap() + .iter() + .map(|b| b.as_str().unwrap().to_string()) + .collect(); + if pkg_id.name().as_str() == name && pkg_id.version().to_string() == version { + assert_eq!(bins, v1_bins); + } + let pkg_id_value = serde_json::to_value(&pkg_id).unwrap(); + let pkg_id_str = pkg_id_value.as_str().unwrap(); + let v2_info = v2_table + .get(pkg_id_str) + .expect("v2 missing v1 pkg") + .as_object() + .unwrap(); + let v2_bins = v2_info["bins"].as_array().unwrap(); + let v2_bins: BTreeSet = v2_bins + .iter() + .map(|b| b.as_str().unwrap().to_string()) + .collect(); + assert_eq!(v1_bins, v2_bins); + } +} + +#[test] +fn registry_upgrade() { + // Installing and upgrading from a registry. + pkg("foo", "1.0.0"); + cargo_process("install foo -Z install-upgrade") + .masquerade_as_nightly_cargo() + .with_stderr( + "\ +[UPDATING] `[..]` index +[DOWNLOADING] crates ... +[DOWNLOADED] foo v1.0.0 (registry [..]) +[INSTALLING] foo v1.0.0 +[COMPILING] foo v1.0.0 +[FINISHED] release [optimized] target(s) in [..] +[INSTALLING] [CWD]/home/.cargo/bin/foo[EXE] +[INSTALLED] package `foo v1.0.0` (executable `foo[EXE]`) +[WARNING] be sure to add [..] +", + ) + .run(); + installed_process("foo").with_stdout("1.0.0").run(); + validate_trackers("foo", "1.0.0", &["foo"]); + + cargo_process("install foo -Z install-upgrade") + .masquerade_as_nightly_cargo() + .with_stderr( + "\ +[UPDATING] `[..]` index +[IGNORED] package `foo v1.0.0` is already installed[..] +[WARNING] be sure to add [..] +", + ) + .run(); + + pkg("foo", "1.0.1"); + + cargo_process("install foo -Z install-upgrade") + .masquerade_as_nightly_cargo() + .with_stderr( + "\ +[UPDATING] `[..]` index +[DOWNLOADING] crates ... +[DOWNLOADED] foo v1.0.1 (registry [..]) +[INSTALLING] foo v1.0.1 +[COMPILING] foo v1.0.1 +[FINISHED] release [optimized] target(s) in [..] +[REPLACING] [CWD]/home/.cargo/bin/foo[EXE] +[REPLACED] package `foo v1.0.0` with `foo v1.0.1` (executable `foo[EXE]`) +[WARNING] be sure to add [..] +", + ) + .run(); + + installed_process("foo").with_stdout("1.0.1").run(); + validate_trackers("foo", "1.0.1", &["foo"]); + + cargo_process("install foo --version=1.0.0 -Z install-upgrade") + .masquerade_as_nightly_cargo() + .with_stderr_contains("[COMPILING] foo v1.0.0") + .run(); + installed_process("foo").with_stdout("1.0.0").run(); + validate_trackers("foo", "1.0.0", &["foo"]); + + cargo_process("install foo --version=^1.0 -Z install-upgrade") + .masquerade_as_nightly_cargo() + .with_stderr_contains("[COMPILING] foo v1.0.1") + .run(); + installed_process("foo").with_stdout("1.0.1").run(); + validate_trackers("foo", "1.0.1", &["foo"]); + + cargo_process("install foo --version=^1.0 -Z install-upgrade") + .masquerade_as_nightly_cargo() + .with_stderr_contains("[IGNORED] package `foo v1.0.1` is already installed[..]") + .run(); +} + +#[test] +fn uninstall() { + // Basic uninstall test. + pkg("foo", "1.0.0"); + cargo_process("install foo -Z install-upgrade") + .masquerade_as_nightly_cargo() + .run(); + cargo_process("uninstall foo -Z install-upgrade") + .masquerade_as_nightly_cargo() + .run(); + let data = load_crates2(); + assert_eq!(data["installs"].as_object().unwrap().len(), 0); + let v1_table = load_crates1(); + assert_eq!(v1_table.get("v1").unwrap().as_table().unwrap().len(), 0); +} + +#[test] +fn upgrade_force() { + pkg("foo", "1.0.0"); + cargo_process("install foo -Z install-upgrade") + .masquerade_as_nightly_cargo() + .run(); + cargo_process("install foo -Z install-upgrade --force") + .masquerade_as_nightly_cargo() + .with_stderr( + "\ +[UPDATING] `[..]` index +[INSTALLING] foo v1.0.0 +[COMPILING] foo v1.0.0 +[FINISHED] release [optimized] target(s) in [..] +[REPLACING] [..]/.cargo/bin/foo[EXE] +[REPLACED] package `foo v1.0.0` with `foo v1.0.0` (executable `foo[EXE]`) +[WARNING] be sure to add `[..]/.cargo/bin` to your PATH [..] +", + ) + .run(); + validate_trackers("foo", "1.0.0", &["foo"]); +} + +#[test] +fn ambiguous_version_no_longer_allowed() { + // Non-semver-requirement is not allowed for `--version`. + pkg("foo", "1.0.0"); + cargo_process("install foo --version=1.0 -Z install-upgrade") + .masquerade_as_nightly_cargo() + .with_stderr( + "\ +[UPDATING] `[..]` index +[ERROR] the `--vers` provided, `1.0`, is not a valid semver version: cannot parse '1.0' as a semver + +if you want to specify semver range, add an explicit qualifier, like ^1.0 +", + ) + .with_status(101) + .run(); +} + +#[test] +fn path_is_always_dirty() { + // --path should always reinstall. + let p = project().file("src/main.rs", "fn main() {}").build(); + p.cargo("install --path . -Z install-upgrade") + .masquerade_as_nightly_cargo() + .run(); + p.cargo("install --path . -Z install-upgrade") + .masquerade_as_nightly_cargo() + .with_stderr_contains("[REPLACING] [..]/foo[EXE]") + .run(); +} + +#[test] +fn fails_for_conflicts_unknown() { + // If an untracked file is in the way, it should fail. + pkg("foo", "1.0.0"); + let exe = installed_exe("foo"); + exe.parent().unwrap().mkdir_p(); + fs::write(exe, "").unwrap(); + cargo_process("install foo -Z install-upgrade") + .masquerade_as_nightly_cargo() + .with_stderr_contains("[ERROR] binary `foo[EXE]` already exists in destination") + .with_status(101) + .run(); +} + +#[test] +fn fails_for_conflicts_known() { + // If the same binary exists in another package, it should fail. + pkg("foo", "1.0.0"); + Package::new("bar", "1.0.0") + .file("src/bin/foo.rs", "fn main() {}") + .publish(); + cargo_process("install foo -Z install-upgrade") + .masquerade_as_nightly_cargo() + .run(); + cargo_process("install bar -Z install-upgrade") + .masquerade_as_nightly_cargo() + .with_stderr_contains( + "[ERROR] binary `foo[EXE]` already exists in destination as part of `foo v1.0.0`", + ) + .with_status(101) + .run(); +} + +#[test] +fn supports_multiple_binary_names() { + // Can individually install with --bin or --example + Package::new("foo", "1.0.0") + .file("src/main.rs", r#"fn main() { println!("foo"); }"#) + .file("src/bin/a.rs", r#"fn main() { println!("a"); }"#) + .file("examples/ex1.rs", r#"fn main() { println!("ex1"); }"#) + .publish(); + cargo_process("install foo -Z install-upgrade --bin foo") + .masquerade_as_nightly_cargo() + .run(); + installed_process("foo").with_stdout("foo").run(); + assert!(!installed_exe("a").exists()); + assert!(!installed_exe("ex1").exists()); + validate_trackers("foo", "1.0.0", &["foo"]); + cargo_process("install foo -Z install-upgrade --bin a") + .masquerade_as_nightly_cargo() + .run(); + installed_process("a").with_stdout("a").run(); + assert!(!installed_exe("ex1").exists()); + validate_trackers("foo", "1.0.0", &["a", "foo"]); + cargo_process("install foo -Z install-upgrade --example ex1") + .masquerade_as_nightly_cargo() + .run(); + installed_process("ex1").with_stdout("ex1").run(); + validate_trackers("foo", "1.0.0", &["a", "ex1", "foo"]); + cargo_process("uninstall foo -Z install-upgrade --bin foo") + .masquerade_as_nightly_cargo() + .run(); + assert!(!installed_exe("foo").exists()); + assert!(installed_exe("ex1").exists()); + validate_trackers("foo", "1.0.0", &["a", "ex1"]); + cargo_process("uninstall foo -Z install-upgrade") + .masquerade_as_nightly_cargo() + .run(); + assert!(!installed_exe("ex1").exists()); + assert!(!installed_exe("a").exists()); +} + +#[test] +fn v1_already_installed_fresh() { + // Install with v1, then try to install again with v2. + pkg("foo", "1.0.0"); + cargo_process("install foo").run(); + cargo_process("install foo -Z install-upgrade") + .with_stderr_contains("[IGNORED] package `foo v1.0.0` is already installed[..]") + .masquerade_as_nightly_cargo() + .run(); +} + +#[test] +fn v1_already_installed_dirty() { + // Install with v1, then install a new version with v2. + pkg("foo", "1.0.0"); + cargo_process("install foo").run(); + pkg("foo", "1.0.1"); + cargo_process("install foo -Z install-upgrade") + .with_stderr_contains("[COMPILING] foo v1.0.1") + .with_stderr_contains("[REPLACING] [..]/foo[EXE]") + .masquerade_as_nightly_cargo() + .run(); + validate_trackers("foo", "1.0.1", &["foo"]); +} + +#[test] +fn change_features_rebuilds() { + Package::new("foo", "1.0.0") + .file( + "src/main.rs", + r#"fn main() { + if cfg!(feature = "f1") { + println!("f1"); + } + if cfg!(feature = "f2") { + println!("f2"); + } + }"#, + ) + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "1.0.0" + + [features] + f1 = [] + f2 = [] + default = ["f1"] + "#, + ) + .publish(); + cargo_process("install foo -Z install-upgrade") + .masquerade_as_nightly_cargo() + .run(); + installed_process("foo").with_stdout("f1").run(); + cargo_process("install foo -Z install-upgrade --no-default-features") + .masquerade_as_nightly_cargo() + .run(); + installed_process("foo").with_stdout("").run(); + cargo_process("install foo -Z install-upgrade --all-features") + .masquerade_as_nightly_cargo() + .run(); + installed_process("foo").with_stdout("f1\nf2").run(); + cargo_process("install foo -Z install-upgrade --no-default-features --features=f1") + .masquerade_as_nightly_cargo() + .run(); + installed_process("foo").with_stdout("f1").run(); +} + +#[test] +fn change_profile_rebuilds() { + pkg("foo", "1.0.0"); + cargo_process("install foo -Z install-upgrade") + .masquerade_as_nightly_cargo() + .run(); + cargo_process("install foo -Z install-upgrade --debug") + .masquerade_as_nightly_cargo() + .with_stderr_contains("[COMPILING] foo v1.0.0") + .with_stderr_contains("[REPLACING] [..]foo[EXE]") + .run(); + cargo_process("install foo -Z install-upgrade --debug") + .masquerade_as_nightly_cargo() + .with_stderr_contains("[IGNORED] package `foo v1.0.0` is already installed[..]") + .run(); +} + +#[test] +fn change_target_rebuilds() { + if cross_compile::disabled() { + return; + } + pkg("foo", "1.0.0"); + cargo_process("install foo -Z install-upgrade") + .masquerade_as_nightly_cargo() + .run(); + let target = cross_compile::alternate(); + cargo_process("install foo -v -Z install-upgrade --target") + .arg(&target) + .masquerade_as_nightly_cargo() + .with_stderr_contains("[COMPILING] foo v1.0.0") + .with_stderr_contains("[REPLACING] [..]foo[EXE]") + .with_stderr_contains(&format!("[..]--target {}[..]", target)) + .run(); +} + +#[test] +fn change_bin_sets_rebuilds() { + // Changing which bins in a multi-bin project should reinstall. + Package::new("foo", "1.0.0") + .file("src/main.rs", "fn main() { }") + .file("src/bin/x.rs", "fn main() { }") + .file("src/bin/y.rs", "fn main() { }") + .publish(); + cargo_process("install foo -Z install-upgrade --bin x") + .masquerade_as_nightly_cargo() + .run(); + assert!(installed_exe("x").exists()); + assert!(!installed_exe("y").exists()); + assert!(!installed_exe("foo").exists()); + validate_trackers("foo", "1.0.0", &["x"]); + cargo_process("install foo -Z install-upgrade --bin y") + .masquerade_as_nightly_cargo() + .with_stderr_contains("[INSTALLED] package `foo v1.0.0` (executable `y[EXE]`)") + .run(); + assert!(installed_exe("x").exists()); + assert!(installed_exe("y").exists()); + assert!(!installed_exe("foo").exists()); + validate_trackers("foo", "1.0.0", &["x", "y"]); + cargo_process("install foo -Z install-upgrade") + .masquerade_as_nightly_cargo() + .with_stderr_contains("[INSTALLED] package `foo v1.0.0` (executable `foo[EXE]`)") + .with_stderr_contains( + "[REPLACED] package `foo v1.0.0` with `foo v1.0.0` (executables `x[EXE]`, `y[EXE]`)", + ) + .run(); + assert!(installed_exe("x").exists()); + assert!(installed_exe("y").exists()); + assert!(installed_exe("foo").exists()); + validate_trackers("foo", "1.0.0", &["foo", "x", "y"]); +} + +#[test] +fn forwards_compatible() { + // Unknown fields should be preserved. + pkg("foo", "1.0.0"); + pkg("bar", "1.0.0"); + cargo_process("install foo -Z install-upgrade") + .masquerade_as_nightly_cargo() + .run(); + let key = "foo 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)"; + let v2 = cargo_home().join(".crates2.json"); + let mut data = load_crates2(); + data["newfield"] = serde_json::Value::Bool(true); + data["installs"][key]["moreinfo"] = serde_json::Value::String("shazam".to_string()); + fs::write(&v2, serde_json::to_string(&data).unwrap()).unwrap(); + cargo_process("install bar -Z install-upgrade") + .masquerade_as_nightly_cargo() + .run(); + let data: serde_json::Value = serde_json::from_str(&fs::read_to_string(&v2).unwrap()).unwrap(); + assert_eq!(data["newfield"].as_bool().unwrap(), true); + assert_eq!( + data["installs"][key]["moreinfo"].as_str().unwrap(), + "shazam" + ); +} + +#[test] +fn v2_syncs() { + // V2 inherits the installs from V1. + pkg("one", "1.0.0"); + pkg("two", "1.0.0"); + pkg("three", "1.0.0"); + let p = project() + .file("src/bin/x.rs", "fn main() {}") + .file("src/bin/y.rs", "fn main() {}") + .build(); + cargo_process("install one -Z install-upgrade") + .masquerade_as_nightly_cargo() + .run(); + validate_trackers("one", "1.0.0", &["one"]); + p.cargo("install -Z install-upgrade --path .") + .masquerade_as_nightly_cargo() + .run(); + validate_trackers("foo", "1.0.0", &["x", "y"]); + // v1 add/remove + cargo_process("install two").run(); + cargo_process("uninstall one").run(); + // This should pick up that `two` was added, `one` was removed. + cargo_process("install three -Z install-upgrade") + .masquerade_as_nightly_cargo() + .run(); + validate_trackers("three", "1.0.0", &["three"]); + cargo_process("install --list") + .with_stdout( + "\ +foo v0.0.1 ([..]/foo): + x[EXE] + y[EXE] +three v1.0.0: + three[EXE] +two v1.0.0: + two[EXE] +", + ) + .run(); + cargo_process("install one -Z install-upgrade") + .masquerade_as_nightly_cargo() + .run(); + installed_process("one").with_stdout("1.0.0").run(); + validate_trackers("one", "1.0.0", &["one"]); + cargo_process("install two -Z install-upgrade") + .masquerade_as_nightly_cargo() + .with_stderr_contains("[IGNORED] package `two v1.0.0` is already installed[..]") + .run(); + // v1 remove + p.cargo("uninstall --bin x").run(); + pkg("x", "1.0.0"); + pkg("y", "1.0.0"); + // This should succeed because `x` was removed in V1. + cargo_process("install x -Z install-upgrade") + .masquerade_as_nightly_cargo() + .run(); + validate_trackers("x", "1.0.0", &["x"]); + // This should fail because `y` still exists in a different package. + cargo_process("install y -Z install-upgrade") + .masquerade_as_nightly_cargo() + .with_stderr_contains( + "[ERROR] binary `y[EXE]` already exists in destination \ + as part of `foo v0.0.1 ([..])`", + ) + .with_status(101) + .run(); +} + +#[test] +fn upgrade_git() { + let git_project = + git::new("foo", |project| project.file("src/main.rs", "fn main() {}")).unwrap(); + // install + cargo_process("install -Z install-upgrade --git") + .arg(git_project.url().to_string()) + .masquerade_as_nightly_cargo() + .run(); + // Check install stays fresh. + cargo_process("install -Z install-upgrade --git") + .arg(git_project.url().to_string()) + .masquerade_as_nightly_cargo() + .with_stderr_contains( + "[IGNORED] package `foo v0.0.1 (file://[..]/foo#[..])` is \ + already installed,[..]", + ) + .run(); + // Modify a file. + let repo = git2::Repository::open(git_project.root()).unwrap(); + git_project.change_file("src/main.rs", r#"fn main() {println!("onomatopoeia");}"#); + git::add(&repo); + git::commit(&repo); + // Install should reinstall. + cargo_process("install -Z install-upgrade --git") + .arg(git_project.url().to_string()) + .masquerade_as_nightly_cargo() + .with_stderr_contains("[COMPILING] foo v0.0.1 ([..])") + .with_stderr_contains("[REPLACING] [..]/foo[EXE]") + .run(); + installed_process("foo").with_stdout("onomatopoeia").run(); + // Check install stays fresh. + cargo_process("install -Z install-upgrade --git") + .arg(git_project.url().to_string()) + .masquerade_as_nightly_cargo() + .with_stderr_contains( + "[IGNORED] package `foo v0.0.1 (file://[..]/foo#[..])` is \ + already installed,[..]", + ) + .run(); +} + +#[test] +fn switch_sources() { + // Installing what appears to be the same thing, but from different + // sources should reinstall. + pkg("foo", "1.0.0"); + Package::new("foo", "1.0.0") + .file("src/main.rs", r#"fn main() { println!("alt"); }"#) + .alternative(true) + .publish(); + let p = project() + .at("foo-local") // so it doesn't use the same directory as the git project + .file("Cargo.toml", &basic_manifest("foo", "1.0.0")) + .file("src/main.rs", r#"fn main() { println!("local"); }"#) + .build(); + let git_project = git::new("foo", |project| { + project.file("src/main.rs", r#"fn main() { println!("git"); }"#) + }) + .unwrap(); + + cargo_process("install -Z install-upgrade foo") + .masquerade_as_nightly_cargo() + .run(); + installed_process("foo").with_stdout("1.0.0").run(); + cargo_process("install -Z install-upgrade foo --registry alternative") + .masquerade_as_nightly_cargo() + .run(); + installed_process("foo").with_stdout("alt").run(); + p.cargo("install -Z install-upgrade --path .") + .masquerade_as_nightly_cargo() + .run(); + installed_process("foo").with_stdout("local").run(); + cargo_process("install -Z install-upgrade --git") + .arg(git_project.url().to_string()) + .masquerade_as_nightly_cargo() + .run(); + installed_process("foo").with_stdout("git").run(); +} + +#[test] +fn multiple_report() { + // Testing the full output that indicates installed/ignored/replaced/summary. + pkg("one", "1.0.0"); + pkg("two", "1.0.0"); + fn three(vers: &str) { + Package::new("three", vers) + .file("src/main.rs", "fn main() { }") + .file("src/bin/x.rs", "fn main() { }") + .file("src/bin/y.rs", "fn main() { }") + .publish(); + } + three("1.0.0"); + cargo_process("install -Z install-upgrade one two three") + .masquerade_as_nightly_cargo() + .with_stderr( + "\ +[UPDATING] `[..]` index +[DOWNLOADING] crates ... +[DOWNLOADED] one v1.0.0 (registry `[..]`) +[INSTALLING] one v1.0.0 +[COMPILING] one v1.0.0 +[FINISHED] release [optimized] target(s) in [..] +[INSTALLING] [..]/.cargo/bin/one[EXE] +[INSTALLED] package `one v1.0.0` (executable `one[EXE]`) +[DOWNLOADING] crates ... +[DOWNLOADED] two v1.0.0 (registry `[..]`) +[INSTALLING] two v1.0.0 +[COMPILING] two v1.0.0 +[FINISHED] release [optimized] target(s) in [..] +[INSTALLING] [..]/.cargo/bin/two[EXE] +[INSTALLED] package `two v1.0.0` (executable `two[EXE]`) +[DOWNLOADING] crates ... +[DOWNLOADED] three v1.0.0 (registry `[..]`) +[INSTALLING] three v1.0.0 +[COMPILING] three v1.0.0 +[FINISHED] release [optimized] target(s) in [..] +[INSTALLING] [..]/.cargo/bin/three[EXE] +[INSTALLING] [..]/.cargo/bin/x[EXE] +[INSTALLING] [..]/.cargo/bin/y[EXE] +[INSTALLED] package `three v1.0.0` (executables `three[EXE]`, `x[EXE]`, `y[EXE]`) +[SUMMARY] Successfully installed one, two, three! +[WARNING] be sure to add `[..]/.cargo/bin` to your PATH [..] +", + ) + .run(); + pkg("foo", "1.0.1"); + pkg("bar", "1.0.1"); + three("1.0.1"); + cargo_process("install -Z install-upgrade one two three") + .masquerade_as_nightly_cargo() + .with_stderr( + "\ +[UPDATING] `[..]` index +[IGNORED] package `one v1.0.0` is already installed, use --force to override +[IGNORED] package `two v1.0.0` is already installed, use --force to override +[DOWNLOADING] crates ... +[DOWNLOADED] three v1.0.1 (registry `[..]`) +[INSTALLING] three v1.0.1 +[COMPILING] three v1.0.1 +[FINISHED] release [optimized] target(s) in [..] +[REPLACING] [..]/.cargo/bin/three[EXE] +[REPLACING] [..]/.cargo/bin/x[EXE] +[REPLACING] [..]/.cargo/bin/y[EXE] +[REPLACED] package `three v1.0.0` with `three v1.0.1` (executables `three[EXE]`, `x[EXE]`, `y[EXE]`) +[SUMMARY] Successfully installed one, two, three! +[WARNING] be sure to add `[..]/.cargo/bin` to your PATH [..] +", + ) + .run(); + cargo_process("uninstall -Z install-upgrade three") + .masquerade_as_nightly_cargo() + .with_stderr( + "\ +[REMOVING] [..]/.cargo/bin/three[EXE] +[REMOVING] [..]/.cargo/bin/x[EXE] +[REMOVING] [..]/.cargo/bin/y[EXE] +", + ) + .run(); + cargo_process("install -Z install-upgrade three --bin x") + .masquerade_as_nightly_cargo() + .with_stderr( + "\ +[UPDATING] `[..]` index +[INSTALLING] three v1.0.1 +[COMPILING] three v1.0.1 +[FINISHED] release [optimized] target(s) in [..] +[INSTALLING] [..]/.cargo/bin/x[EXE] +[INSTALLED] package `three v1.0.1` (executable `x[EXE]`) +[WARNING] be sure to add `[..]/.cargo/bin` to your PATH [..] +", + ) + .run(); + cargo_process("install -Z install-upgrade three") + .masquerade_as_nightly_cargo() + .with_stderr( + "\ +[UPDATING] `[..]` index +[INSTALLING] three v1.0.1 +[COMPILING] three v1.0.1 +[FINISHED] release [optimized] target(s) in [..] +[INSTALLING] [..]/.cargo/bin/three[EXE] +[INSTALLING] [..]/.cargo/bin/y[EXE] +[REPLACING] [..]/.cargo/bin/x[EXE] +[INSTALLED] package `three v1.0.1` (executables `three[EXE]`, `y[EXE]`) +[REPLACED] package `three v1.0.1` with `three v1.0.1` (executable `x[EXE]`) +[WARNING] be sure to add `[..]/.cargo/bin` to your PATH [..] +", + ) + .run(); +} + +#[test] +fn no_track_gated() { + cargo_process("install --no-track foo") + .masquerade_as_nightly_cargo() + .with_stderr( + "[ERROR] `--no-track` flag is unstable, pass `-Z install-upgrade` to enable it", + ) + .with_status(101) + .run(); +} + +#[test] +fn no_track() { + pkg("foo", "1.0.0"); + cargo_process("install --no-track foo -Z install-upgrade") + .masquerade_as_nightly_cargo() + .run(); + assert!(!v1_path().exists()); + assert!(!v2_path().exists()); + cargo_process("install --no-track foo -Z install-upgrade") + .masquerade_as_nightly_cargo() + .with_stderr( + "\ +[UPDATING] `[..]` index +[ERROR] binary `foo[EXE]` already exists in destination +Add --force to overwrite +", + ) + .with_status(101) + .run(); +} diff -Nru cargo-0.35.0/tests/testsuite/main.rs cargo-0.37.0/tests/testsuite/main.rs --- cargo-0.35.0/tests/testsuite/main.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/main.rs 2019-05-15 19:48:47.000000000 +0000 @@ -2,6 +2,9 @@ #![cfg_attr(feature = "deny-warnings", deny(warnings))] #![allow(clippy::blacklisted_name)] #![allow(clippy::explicit_iter_loop)] +#![allow(clippy::redundant_closure)] +#![warn(clippy::needless_borrow)] +#![warn(clippy::redundant_clone)] #[macro_use] mod support; @@ -42,6 +45,7 @@ mod git; mod init; mod install; +mod install_upgrade; mod jobserver; mod list_targets; mod local_registry; @@ -52,6 +56,7 @@ mod metadata; mod net_config; mod new; +mod offline; mod out_dir; mod overrides; mod package; @@ -63,7 +68,9 @@ mod profile_overrides; mod profile_targets; mod profiles; +mod pub_priv; mod publish; +mod publish_lockfile; mod read_manifest; mod registry; mod rename_deps; diff -Nru cargo-0.35.0/tests/testsuite/member_errors.rs cargo-0.37.0/tests/testsuite/member_errors.rs --- cargo-0.35.0/tests/testsuite/member_errors.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/member_errors.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,9 +1,11 @@ use cargo::core::resolver::ResolveError; -use cargo::core::{compiler::CompileMode, Workspace}; +use cargo::core::{compiler::CompileMode, Shell, Workspace}; use cargo::ops::{self, CompileOptions}; use cargo::util::{config::Config, errors::ManifestError}; +use crate::support::install::cargo_home; use crate::support::project; +use crate::support::registry; /// Tests inclusion of a `ManifestError` pointing to a member manifest /// when that manifest fails to deserialize. @@ -139,7 +141,9 @@ .file("bar/src/main.rs", "fn main() {}") .build(); - let config = Config::default().unwrap(); + // Prevent this test from accessing the network by setting up .cargo/config. + registry::init(); + let config = Config::new(Shell::new(), cargo_home(), cargo_home()); let ws = Workspace::new(&p.root().join("Cargo.toml"), &config).unwrap(); let compile_options = CompileOptions::new(&config, CompileMode::Build).unwrap(); let member_bar = ws.members().find(|m| &*m.name() == "bar").unwrap(); diff -Nru cargo-0.35.0/tests/testsuite/metabuild.rs cargo-0.37.0/tests/testsuite/metabuild.rs --- cargo-0.35.0/tests/testsuite/metabuild.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/metabuild.rs 2019-05-15 19:48:47.000000000 +0000 @@ -2,7 +2,6 @@ basic_lib_manifest, basic_manifest, is_coarse_mtime, project, registry::Package, rustc_host, Project, }; -use glob::glob; use serde_json; use std::str; @@ -435,8 +434,7 @@ .as_array() .unwrap() .iter() - .filter(|p| p["name"].as_str().unwrap() == "foo") - .next() + .find(|p| p["name"].as_str().unwrap() == "foo") .unwrap()["metabuild"] .as_array() .unwrap() @@ -463,7 +461,10 @@ "compile_mode": "build", "kind": "Host", "deps": [], - "outputs": ["[..]/target/debug/deps/libmb-[..].rlib"], + "outputs": [ + "[..]/target/debug/deps/libmb-[..].rlib", + "[..]/target/debug/deps/libmb-[..].rmeta" + ], "links": {}, "program": "rustc", "args": "{...}", @@ -477,7 +478,10 @@ "compile_mode": "build", "kind": "Host", "deps": [], - "outputs": ["[..]/target/debug/deps/libmb_other-[..].rlib"], + "outputs": [ + "[..]/target/debug/deps/libmb_other-[..].rlib", + "[..]/target/debug/deps/libmb_other-[..].rmeta" + ], "links": {}, "program": "rustc", "args": "{...}", @@ -519,7 +523,10 @@ "compile_mode": "build", "kind": "Host", "deps": [3], - "outputs": ["[..]/foo/target/debug/deps/libfoo-[..].rlib"], + "outputs": [ + "[..]/foo/target/debug/deps/libfoo-[..].rlib", + "[..]/foo/target/debug/deps/libfoo-[..].rmeta" + ], "links": "{...}", "program": "rustc", "args": "{...}", @@ -537,17 +544,7 @@ ) .run(); - assert_eq!( - glob( - &p.root() - .join("target/.metabuild/metabuild-foo-*.rs") - .to_str() - .unwrap() - ) - .unwrap() - .count(), - 1 - ); + assert_eq!(p.glob("target/.metabuild/metabuild-foo-*.rs").count(), 1); } #[test] @@ -623,14 +620,7 @@ .run(); assert_eq!( - glob( - &p.root() - .join("target/.metabuild/metabuild-member?-*.rs") - .to_str() - .unwrap() - ) - .unwrap() - .count(), + p.glob("target/.metabuild/metabuild-member?-*.rs").count(), 2 ); } @@ -681,17 +671,7 @@ .with_stdout_contains("[dep 1.0.0] Hello mb") .run(); - assert_eq!( - glob( - &p.root() - .join("target/.metabuild/metabuild-dep-*.rs") - .to_str() - .unwrap() - ) - .unwrap() - .count(), - 1 - ); + assert_eq!(p.glob("target/.metabuild/metabuild-dep-*.rs").count(), 1); } #[test] diff -Nru cargo-0.35.0/tests/testsuite/metadata.rs cargo-0.37.0/tests/testsuite/metadata.rs --- cargo-0.35.0/tests/testsuite/metadata.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/metadata.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1208,8 +1208,6 @@ .file( "Cargo.toml", r#" - cargo-features = ["edition"] - [package] name = "foo" version = "0.1.0" @@ -1219,7 +1217,6 @@ ) .build(); p.cargo("metadata") - .masquerade_as_nightly_cargo() .with_json( r#" { @@ -1291,8 +1288,6 @@ .file( "Cargo.toml", r#" - cargo-features = ["edition"] - [package] name = "foo" version = "0.1.0" @@ -1305,7 +1300,6 @@ ) .build(); p.cargo("metadata") - .masquerade_as_nightly_cargo() .with_json( r#" { @@ -1389,8 +1383,6 @@ .file( "Cargo.toml", r#" - cargo-features = ["rename-dependency"] - [project] name = "foo" version = "0.0.1" @@ -1405,7 +1397,6 @@ .build(); p.cargo("metadata") - .masquerade_as_nightly_cargo() .with_json( r#" { @@ -1669,3 +1660,32 @@ ) .run() } + +#[test] +fn deps_with_bin_only() { + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + [dependencies] + bdep = { path = "bdep" } + "#, + ) + .file("src/lib.rs", "") + .file("bdep/Cargo.toml", &basic_bin_manifest("bdep")) + .file("bdep/src/main.rs", "fn main() {}") + .build(); + + let output = p + .cargo("metadata") + .exec_with_output() + .expect("cargo metadata failed"); + let stdout = std::str::from_utf8(&output.stdout).unwrap(); + let meta: serde_json::Value = serde_json::from_str(stdout).expect("failed to parse json"); + let nodes = &meta["resolve"]["nodes"]; + assert!(nodes[0]["deps"].as_array().unwrap().is_empty()); + assert!(nodes[1]["deps"].as_array().unwrap().is_empty()); +} diff -Nru cargo-0.35.0/tests/testsuite/net_config.rs cargo-0.37.0/tests/testsuite/net_config.rs --- cargo-0.35.0/tests/testsuite/net_config.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/net_config.rs 2019-05-15 19:48:47.000000000 +0000 @@ -12,7 +12,7 @@ authors = [] [dependencies.bar] - git = "https://127.0.0.1:11/foo/bar" + git = "http://127.0.0.1:11/foo/bar" "#, ) .file("src/main.rs", "") @@ -48,7 +48,7 @@ authors = [] [dependencies.bar] - git = "https://127.0.0.1:11/foo/bar" + git = "http://127.0.0.1:11/foo/bar" "#, ) .file( diff -Nru cargo-0.35.0/tests/testsuite/new.rs cargo-0.37.0/tests/testsuite/new.rs --- cargo-0.35.0/tests/testsuite/new.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/new.rs 2019-05-15 19:48:47.000000000 +0000 @@ -89,7 +89,7 @@ .unwrap() .read_to_string(&mut contents) .unwrap(); - assert_eq!(contents, "/target\n**/*.rs.bk\nCargo.lock",); + assert_eq!(contents, "/target\n**/*.rs.bk\nCargo.lock\n",); cargo_process("build").cwd(&paths::root().join("foo")).run(); } @@ -511,3 +511,22 @@ .with_status(1) .run(); } + +#[test] +fn new_with_blank_email() { + cargo_process("new foo") + .env("CARGO_NAME", "Sen") + .env("CARGO_EMAIL", "") + .run(); + + let contents = fs::read_to_string(paths::root().join("foo/Cargo.toml")).unwrap(); + assert!(contents.contains(r#"authors = ["Sen"]"#), contents); +} + +#[test] +fn new_with_reference_link() { + cargo_process("new foo").env("USER", "foo").run(); + + let contents = fs::read_to_string(paths::root().join("foo/Cargo.toml")).unwrap(); + assert!(contents.contains("# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html")) +} diff -Nru cargo-0.35.0/tests/testsuite/offline.rs cargo-0.37.0/tests/testsuite/offline.rs --- cargo-0.35.0/tests/testsuite/offline.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/offline.rs 2019-05-15 19:48:47.000000000 +0000 @@ -0,0 +1,537 @@ +use crate::support::{basic_manifest, git, main_file, path2url, project, registry::Package}; +use std::fs; + +#[test] +fn offline_unused_target_dep() { + // --offline with a target dependency that is not used and not downloaded. + Package::new("unused_dep", "1.0.0").publish(); + Package::new("used_dep", "1.0.0").publish(); + let p = project() + .file( + "Cargo.toml", + r#" + [project] + name = "foo" + version = "0.1.0" + [dependencies] + used_dep = "1.0" + [target.'cfg(unused)'.dependencies] + unused_dep = "1.0" + "#, + ) + .file("src/lib.rs", "") + .build(); + // Do a build that downloads only what is necessary. + p.cargo("build") + .with_stderr_contains("[DOWNLOADED] used_dep [..]") + .with_stderr_does_not_contain("[DOWNLOADED] unused_dep [..]") + .run(); + p.cargo("clean").run(); + // Build offline, make sure it works. + p.cargo("build --offline").run(); +} + +#[test] +fn offline_missing_optional() { + Package::new("opt_dep", "1.0.0").publish(); + let p = project() + .file( + "Cargo.toml", + r#" + [project] + name = "foo" + version = "0.1.0" + [dependencies] + opt_dep = { version = "1.0", optional = true } + "#, + ) + .file("src/lib.rs", "") + .build(); + // Do a build that downloads only what is necessary. + p.cargo("build") + .with_stderr_does_not_contain("[DOWNLOADED] opt_dep [..]") + .run(); + p.cargo("clean").run(); + // Build offline, make sure it works. + p.cargo("build --offline").run(); + p.cargo("build --offline --features=opt_dep") + .with_stderr( + "\ +[ERROR] failed to download `opt_dep v1.0.0` + +Caused by: + can't make HTTP request in the offline mode +", + ) + .with_status(101) + .run(); +} + +#[test] +fn cargo_compile_path_with_offline() { + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.0.1" + authors = [] + + [dependencies.bar] + path = "bar" + "#, + ) + .file("src/lib.rs", "") + .file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1")) + .file("bar/src/lib.rs", "") + .build(); + + p.cargo("build --offline").run(); +} + +#[test] +fn cargo_compile_with_downloaded_dependency_with_offline() { + Package::new("present_dep", "1.2.3") + .file("Cargo.toml", &basic_manifest("present_dep", "1.2.3")) + .file("src/lib.rs", "") + .publish(); + + // make package downloaded + let p = project() + .file( + "Cargo.toml", + r#" + [project] + name = "foo" + version = "0.1.0" + + [dependencies] + present_dep = "1.2.3" + "#, + ) + .file("src/lib.rs", "") + .build(); + p.cargo("build").run(); + + let p2 = project() + .at("bar") + .file( + "Cargo.toml", + r#" + [project] + name = "bar" + version = "0.1.0" + + [dependencies] + present_dep = "1.2.3" + "#, + ) + .file("src/lib.rs", "") + .build(); + + p2.cargo("build --offline") + .with_stderr( + "\ +[COMPILING] present_dep v1.2.3 +[COMPILING] bar v0.1.0 ([..]) +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]", + ) + .run(); +} + +#[test] +fn cargo_compile_offline_not_try_update() { + let p = project() + .at("bar") + .file( + "Cargo.toml", + r#" + [project] + name = "bar" + version = "0.1.0" + + [dependencies] + not_cached_dep = "1.2.5" + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("build --offline") + .with_status(101) + .with_stderr( + "\ +[ERROR] failed to load source for a dependency on `not_cached_dep` + +Caused by: + Unable to update registry `https://github.com/rust-lang/crates.io-index` + +Caused by: + unable to fetch registry `https://github.com/rust-lang/crates.io-index` in offline mode +Try running without the offline flag, or try running `cargo fetch` within your \ +project directory before going offline. +", + ) + .run(); + + p.change_file(".cargo/config", "net.offline = true"); + p.cargo("build") + .with_status(101) + .with_stderr_contains("[..]Unable to update registry[..]") + .run(); +} + +#[test] +fn compile_offline_without_maxvers_cached() { + Package::new("present_dep", "1.2.1").publish(); + Package::new("present_dep", "1.2.2").publish(); + + Package::new("present_dep", "1.2.3") + .file("Cargo.toml", &basic_manifest("present_dep", "1.2.3")) + .file( + "src/lib.rs", + r#"pub fn get_version()->&'static str {"1.2.3"}"#, + ) + .publish(); + + Package::new("present_dep", "1.2.5") + .file("Cargo.toml", &basic_manifest("present_dep", "1.2.5")) + .file("src/lib.rs", r#"pub fn get_version(){"1.2.5"}"#) + .publish(); + + // make package cached + let p = project() + .file( + "Cargo.toml", + r#" + [project] + name = "foo" + version = "0.1.0" + + [dependencies] + present_dep = "=1.2.3" + "#, + ) + .file("src/lib.rs", "") + .build(); + p.cargo("build").run(); + + let p2 = project() + .file( + "Cargo.toml", + r#" + [project] + name = "foo" + version = "0.1.0" + + [dependencies] + present_dep = "1.2" + "#, + ) + .file( + "src/main.rs", + "\ +extern crate present_dep; +fn main(){ + println!(\"{}\", present_dep::get_version()); +}", + ) + .build(); + + p2.cargo("run --offline") + .with_stderr( + "\ +[COMPILING] present_dep v1.2.3 +[COMPILING] foo v0.1.0 ([CWD]) +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] + Running `[..]`", + ) + .with_stdout("1.2.3") + .run(); +} + +#[test] +fn cargo_compile_forbird_git_httpsrepo_offline() { + let p = project() + .file( + "Cargo.toml", + r#" + + [project] + name = "foo" + version = "0.5.0" + authors = ["chabapok@example.com"] + + [dependencies.dep1] + git = 'https://github.com/some_user/dep1.git' + "#, + ) + .file("src/main.rs", "") + .build(); + + p.cargo("build --offline").with_status(101).with_stderr("\ +error: failed to load source for a dependency on `dep1` + +Caused by: + Unable to update https://github.com/some_user/dep1.git + +Caused by: + can't checkout from 'https://github.com/some_user/dep1.git': you are in the offline mode (--offline)").run(); +} + +#[test] +fn compile_offline_while_transitive_dep_not_cached() { + let baz = Package::new("baz", "1.0.0"); + let baz_path = baz.archive_dst(); + baz.publish(); + + let baz_content = fs::read(&baz_path).unwrap(); + // Truncate the file to simulate a download failure. + fs::write(&baz_path, &[]).unwrap(); + + Package::new("bar", "0.1.0").dep("baz", "1.0.0").publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + [project] + name = "foo" + version = "0.0.1" + + [dependencies] + bar = "0.1.0" + "#, + ) + .file("src/main.rs", "fn main(){}") + .build(); + + // simulate download bar, but fail to download baz + p.cargo("build") + .with_status(101) + .with_stderr_contains("[..]failed to verify the checksum of `baz[..]") + .run(); + + // Restore the file contents. + fs::write(&baz_path, &baz_content).unwrap(); + + p.cargo("build --offline") + .with_status(101) + .with_stderr( + "\ +[ERROR] failed to download `baz v1.0.0` + +Caused by: + can't make HTTP request in the offline mode +", + ) + .run(); +} + +#[test] +fn update_offline() { + let p = project() + .file( + "Cargo.toml", + r#" + [project] + name = "foo" + version = "0.0.1" + authors = [] + + [dependencies] + bar = "*" + "#, + ) + .file("src/main.rs", "fn main() {}") + .build(); + p.cargo("update --offline") + .with_status(101) + .with_stderr("error: you can't update in the offline mode[..]") + .run(); +} + +#[test] +fn cargo_compile_offline_with_cached_git_dep() { + let git_project = git::new("dep1", |project| { + project + .file("Cargo.toml", &basic_manifest("dep1", "0.5.0")) + .file( + "src/lib.rs", + r#" + pub static COOL_STR:&str = "cached git repo rev1"; + "#, + ) + }) + .unwrap(); + + let repo = git2::Repository::open(&git_project.root()).unwrap(); + let rev1 = repo.revparse_single("HEAD").unwrap().id(); + + // Commit the changes and make sure we trigger a recompile + git_project.change_file( + "src/lib.rs", + r#"pub static COOL_STR:&str = "cached git repo rev2";"#, + ); + git::add(&repo); + let rev2 = git::commit(&repo); + + // cache to registry rev1 and rev2 + let prj = project() + .at("cache_git_dep") + .file( + "Cargo.toml", + &format!( + r#" + [project] + name = "cache_git_dep" + version = "0.5.0" + + [dependencies.dep1] + git = '{}' + rev = "{}" + "#, + git_project.url(), + rev1 + ), + ) + .file("src/main.rs", "fn main(){}") + .build(); + prj.cargo("build").run(); + + prj.change_file( + "Cargo.toml", + &format!( + r#" + [project] + name = "cache_git_dep" + version = "0.5.0" + + [dependencies.dep1] + git = '{}' + rev = "{}" + "#, + git_project.url(), + rev2 + ), + ); + prj.cargo("build").run(); + + let p = project() + .file( + "Cargo.toml", + &format!( + r#" + [project] + name = "foo" + version = "0.5.0" + + [dependencies.dep1] + git = '{}' + "#, + git_project.url() + ), + ) + .file( + "src/main.rs", + &main_file(r#""hello from {}", dep1::COOL_STR"#, &["dep1"]), + ) + .build(); + + let git_root = git_project.root(); + + p.cargo("build --offline") + .with_stderr(format!( + "\ +[COMPILING] dep1 v0.5.0 ({}#[..]) +[COMPILING] foo v0.5.0 ([CWD]) +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]", + path2url(git_root), + )) + .run(); + + assert!(p.bin("foo").is_file()); + + p.process(&p.bin("foo")) + .with_stdout("hello from cached git repo rev2\n") + .run(); + + p.change_file( + "Cargo.toml", + &format!( + r#" + [project] + name = "foo" + version = "0.5.0" + + [dependencies.dep1] + git = '{}' + rev = "{}" + "#, + git_project.url(), + rev1 + ), + ); + + p.cargo("build --offline").run(); + p.process(&p.bin("foo")) + .with_stdout("hello from cached git repo rev1\n") + .run(); +} + +#[test] +fn offline_resolve_optional_fail() { + // Example where resolve fails offline. + // + // This happens if at least 1 version of an optional dependency is + // available, but none of them satisfy the requirements. The current logic + // that handles this is `RegistryIndex::query_inner`, and it doesn't know + // if the package being queried is an optional one. This is not ideal, it + // would be best if it just ignored optional (unselected) dependencies. + Package::new("dep", "1.0.0").publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + + [dependencies] + dep = { version = "1.0", optional = true } + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("fetch").run(); + + // Change dep to 2.0. + p.change_file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + + [dependencies] + dep = { version = "2.0", optional = true } + "#, + ); + + p.cargo("build --offline") + .with_status(101) + .with_stderr("\ +[ERROR] failed to select a version for the requirement `dep = \"^2.0\"` + candidate versions found which didn't match: 1.0.0 + location searched: `[..]` index (which is replacing registry `https://github.com/rust-lang/crates.io-index`) +required by package `foo v0.1.0 ([..]/foo)` +perhaps a crate was updated and forgotten to be re-vendored? +As a reminder, you're using offline mode (--offline) which can sometimes cause \ +surprising resolution failures, if this error is too confusing you may wish to \ +retry without the offline flag. +") + .run(); +} diff -Nru cargo-0.35.0/tests/testsuite/overrides.rs cargo-0.37.0/tests/testsuite/overrides.rs --- cargo-0.35.0/tests/testsuite/overrides.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/overrides.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1096,7 +1096,7 @@ .build(); p.cargo("build") - .cwd(p.root().join("first_crate")) + .cwd("first_crate") .with_stdout("") .with_stderr( "\ @@ -1108,7 +1108,7 @@ .run(); p.cargo("build") - .cwd(p.root().join("second_crate")) + .cwd("second_crate") .with_stdout("") .with_stderr( "\ diff -Nru cargo-0.35.0/tests/testsuite/package.rs cargo-0.37.0/tests/testsuite/package.rs --- cargo-0.35.0/tests/testsuite/package.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/package.rs 2019-05-15 19:48:47.000000000 +0000 @@ -3,12 +3,12 @@ use std::io::prelude::*; use std::path::Path; +use crate::support::cargo_process; +use crate::support::paths::CargoPathExt; use crate::support::registry::Package; use crate::support::{ - basic_manifest, git, is_nightly, path2url, paths, project, publish::validate_crate_contents, - registry, + basic_manifest, git, path2url, paths, project, publish::validate_crate_contents, registry, }; -use crate::support::{cargo_process, sleep_ms}; use git2; #[test] @@ -70,7 +70,7 @@ "\ warning: manifest has no description, license, license-file, documentation, \ homepage or repository. -See for more info. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. [PACKAGING] foo v0.0.1 ([CWD]) [VERIFYING] foo v0.0.1 ([CWD]) [COMPILING] foo v0.0.1 ([CWD][..]) @@ -96,7 +96,7 @@ .with_stderr( "\ warning: manifest has no description, documentation, homepage or repository. -See for more info. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. [PACKAGING] foo v0.0.1 ([CWD]) [VERIFYING] foo v0.0.1 ([CWD]) [COMPILING] foo v0.0.1 ([CWD][..]) @@ -149,7 +149,7 @@ .with_stderr( "\ [WARNING] manifest has no description[..] -See for more info. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. [PACKAGING] foo v0.0.1 ([..]) [ARCHIVING] [..] [ARCHIVING] [..] @@ -186,7 +186,7 @@ .with_stderr( "\ [WARNING] manifest has no description[..] -See for more info. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. [PACKAGING] a v0.0.1 ([..]) [ARCHIVING] Cargo.toml [ARCHIVING] src/lib.rs @@ -204,7 +204,7 @@ .with_stderr( "\ [WARNING] manifest has no description[..] -See for more info. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. [PACKAGING] foo v0.0.1 ([CWD]) [VERIFYING] foo v0.0.1 ([CWD]) [COMPILING] foo v0.0.1 ([CWD][..]) @@ -280,7 +280,7 @@ .with_stderr( "\ [WARNING] manifest has no documentation, homepage or repository. -See for more info. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. [ERROR] all path dependencies must have a version specified when packaging. dependency `bar` does not specify a version. ", @@ -363,18 +363,18 @@ .with_stderr( "\ [WARNING] manifest has no description[..] -See for more info. -[WARNING] [..] file `dir_root_1/some_dir/file` WILL be excluded [..] +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[WARNING] [..] file `dir_root_1/some_dir/file` is now excluded. See [..] -[WARNING] [..] file `dir_root_2/some_dir/file` WILL be excluded [..] +[WARNING] [..] file `dir_root_2/some_dir/file` is now excluded. See [..] -[WARNING] [..] file `dir_root_3/some_dir/file` WILL be excluded [..] +[WARNING] [..] file `dir_root_3/some_dir/file` is now excluded. See [..] -[WARNING] [..] file `some_dir/dir_deep_1/some_dir/file` WILL be excluded [..] +[WARNING] [..] file `some_dir/dir_deep_1/some_dir/file` is now excluded. See [..] -[WARNING] [..] file `some_dir/dir_deep_3/some_dir/file` WILL be excluded [..] +[WARNING] [..] file `some_dir/dir_deep_3/some_dir/file` is now excluded. See [..] -[WARNING] [..] file `some_dir/file_deep_1` WILL be excluded [..] +[WARNING] [..] file `some_dir/file_deep_1` is now excluded. See [..] [PACKAGING] foo v0.0.1 ([..]) [ARCHIVING] [..] @@ -389,12 +389,6 @@ [ARCHIVING] [..] [ARCHIVING] [..] [ARCHIVING] [..] -[ARCHIVING] [..] -[ARCHIVING] [..] -[ARCHIVING] [..] -[ARCHIVING] [..] -[ARCHIVING] [..] -[ARCHIVING] [..] [ARCHIVING] .cargo_vcs_info.json ", ) @@ -408,18 +402,12 @@ "\ .cargo_vcs_info.json Cargo.toml -dir_root_1/some_dir/file -dir_root_2/some_dir/file -dir_root_3/some_dir/file file_root_3 file_root_4 file_root_5 -some_dir/dir_deep_1/some_dir/file some_dir/dir_deep_2/some_dir/file -some_dir/dir_deep_3/some_dir/file some_dir/dir_deep_4/some_dir/file some_dir/dir_deep_5/some_dir/file -some_dir/file_deep_1 some_dir/file_deep_2 some_dir/file_deep_3 some_dir/file_deep_4 @@ -456,7 +444,8 @@ .with_stderr( "\ [WARNING] manifest has no description[..] -See for more info. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[WARNING] both package.include and package.exclude are specified; the exclude list will be ignored [PACKAGING] foo v0.0.1 ([..]) [ARCHIVING] [..] [ARCHIVING] [..] @@ -570,7 +559,7 @@ .with_stderr( "\ [WARNING] manifest has no documentation[..] -See for more info. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. [PACKAGING] foo v0.0.1 ([CWD]) [VERIFYING] foo v0.0.1 ([CWD]) [COMPILING] foo v0.0.1 ([CWD][..]) @@ -771,8 +760,6 @@ .file( "Cargo.toml", r#" - cargo-features = ["alternative-registries"] - [project] name = "foo" version = "0.0.1" @@ -798,9 +785,7 @@ .file("bar/src/lib.rs", "") .build(); - p.cargo("package --no-verify") - .masquerade_as_nightly_cargo() - .run(); + p.cargo("package --no-verify").run(); let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap(); let rewritten_toml = format!( @@ -816,8 +801,6 @@ # editing this file be aware that the upstream Cargo.toml # will likely look very different (and much more reasonable) -cargo-features = ["alternative-registries"] - [package] name = "foo" version = "0.0.1" @@ -884,9 +867,7 @@ .file("bar/src/lib.rs", "") .build(); - p.cargo("package --no-verify") - .cwd(p.root().join("bar")) - .run(); + p.cargo("package --no-verify").cwd("bar").run(); let f = File::open(&p.root().join("target/package/bar-0.1.0.crate")).unwrap(); let rewritten_toml = r#"# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO @@ -910,7 +891,7 @@ f, "bar-0.1.0.crate", &["Cargo.toml", "Cargo.toml.orig", "src/lib.rs"], - &[("Cargo.toml", &rewritten_toml)], + &[("Cargo.toml", rewritten_toml)], ); } @@ -956,11 +937,6 @@ .build(); p.cargo("build -v") - .masquerade_as_nightly_cargo() - .without_status() // passes on nightly, fails on stable, b/c --edition is nightly-only - // --edition is still in flux and we're not passing -Zunstable-options - // from Cargo so it will probably error. Only partially match the output - // until stuff stabilizes .with_stderr_contains( "\ [COMPILING] foo v0.0.1 ([..]) @@ -972,11 +948,6 @@ #[test] fn edition_with_metadata() { - if !is_nightly() { - // --edition is nightly-only - return; - } - let p = project() .file( "Cargo.toml", @@ -1031,197 +1002,27 @@ } #[test] -fn package_lockfile() { - let p = project() - .file( - "Cargo.toml", - r#" - cargo-features = ["publish-lockfile"] - - [project] - name = "foo" - version = "0.0.1" - authors = [] - license = "MIT" - description = "foo" - publish-lockfile = true - "#, - ) - .file("src/main.rs", "fn main() {}") - .build(); - - p.cargo("package") - .masquerade_as_nightly_cargo() - .with_stderr( - "\ -[WARNING] manifest has no documentation[..] -See [..] -[PACKAGING] foo v0.0.1 ([CWD]) -[VERIFYING] foo v0.0.1 ([CWD]) -[COMPILING] foo v0.0.1 ([CWD][..]) -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -", - ) - .run(); - assert!(p.root().join("target/package/foo-0.0.1.crate").is_file()); - p.cargo("package -l") - .masquerade_as_nightly_cargo() - .with_stdout( - "\ -Cargo.lock -Cargo.toml -src/main.rs -", - ) - .run(); - p.cargo("package") - .masquerade_as_nightly_cargo() - .with_stdout("") - .run(); - - let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap(); - validate_crate_contents( - f, - "foo-0.0.1.crate", - &["Cargo.toml", "Cargo.toml.orig", "Cargo.lock", "src/main.rs"], - &[], - ); -} - -#[test] -fn package_lockfile_git_repo() { - let p = project().build(); - - // Create a Git repository containing a minimal Rust project. - let _ = git::repo(&paths::root().join("foo")) - .file( - "Cargo.toml", - r#" - cargo-features = ["publish-lockfile"] - - [project] - name = "foo" - version = "0.0.1" - license = "MIT" - description = "foo" - documentation = "foo" - homepage = "foo" - repository = "foo" - publish-lockfile = true - "#, - ) - .file("src/main.rs", "fn main() {}") - .build(); - p.cargo("package -l") - .masquerade_as_nightly_cargo() - .with_stdout( - "\ -.cargo_vcs_info.json -Cargo.lock -Cargo.toml -src/main.rs -", - ) - .run(); -} - -#[test] -fn no_lock_file_with_library() { - let p = project() - .file( - "Cargo.toml", - r#" - cargo-features = ["publish-lockfile"] - - [project] - name = "foo" - version = "0.0.1" - authors = [] - license = "MIT" - description = "foo" - publish-lockfile = true - "#, - ) - .file("src/lib.rs", "") - .build(); - - p.cargo("package").masquerade_as_nightly_cargo().run(); - - let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap(); - validate_crate_contents( - f, - "foo-0.0.1.crate", - &["Cargo.toml", "Cargo.toml.orig", "src/lib.rs"], - &[], - ); -} - -#[test] -fn lock_file_and_workspace() { - let p = project() - .file( - "Cargo.toml", - r#" - [workspace] - members = ["foo"] - "#, - ) - .file( - "foo/Cargo.toml", - r#" - cargo-features = ["publish-lockfile"] - - [package] - name = "foo" - version = "0.0.1" - authors = [] - license = "MIT" - description = "foo" - publish-lockfile = true - "#, - ) - .file("foo/src/main.rs", "fn main() {}") - .build(); - - p.cargo("package") - .cwd(p.root().join("foo")) - .masquerade_as_nightly_cargo() - .run(); - - let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap(); - validate_crate_contents( - f, - "foo-0.0.1.crate", - &["Cargo.toml", "Cargo.toml.orig", "src/main.rs", "Cargo.lock"], - &[], - ); -} - -#[test] fn do_not_package_if_src_was_modified() { let p = project() .file("src/main.rs", r#"fn main() { println!("hello"); }"#) + .file("foo.txt", "") + .file("bar.txt", "") .file( "build.rs", r#" - use std::fs::File; - use std::io::Write; + use std::fs; fn main() { - let mut file = File::create("src/generated.txt").expect("failed to create file"); - file.write_all(b"Hello, world of generated files.").expect("failed to write"); + fs::write("src/generated.txt", + "Hello, world of generated files." + ).expect("failed to create file"); + fs::remove_file("foo.txt").expect("failed to remove"); + fs::write("bar.txt", "updated content").expect("failed to update"); } "#, ) .build(); - if cfg!(target_os = "macos") { - // MacOS has 1s resolution filesystem. - // If src/main.rs is created within 1s of src/generated.txt, then it - // won't trigger the modification check. - sleep_ms(1000); - } - p.cargo("package") .with_status(101) .with_stderr_contains( @@ -1230,7 +1031,10 @@ Caused by: Source directory was modified by build.rs during cargo publish. \ -Build scripts should not modify anything outside of OUT_DIR. Modified file: [..]src/generated.txt +Build scripts should not modify anything outside of OUT_DIR. +Changed: [CWD]/target/package/foo-0.0.1/bar.txt +Added: [CWD]/target/package/foo-0.0.1/src/generated.txt +Removed: [CWD]/target/package/foo-0.0.1/foo.txt To proceed despite this, pass the `--no-verify` flag.", ) @@ -1265,7 +1069,7 @@ ) .build(); - p.cargo("package --features required").masquerade_as_nightly_cargo().run(); + p.cargo("package --features required").run(); } #[test] @@ -1294,7 +1098,7 @@ ) .build(); - p.cargo("package --all-features").masquerade_as_nightly_cargo().run(); + p.cargo("package --all-features").run(); } #[test] @@ -1324,8 +1128,231 @@ .build(); p.cargo("package --no-default-features") - .masquerade_as_nightly_cargo() .with_stderr_contains("error: This crate requires `required` feature!") .with_status(101) .run(); } + +#[test] +fn include_cargo_toml_implicit() { + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + include = ["src/lib.rs"] + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("package --list") + .with_stdout("Cargo.toml\nsrc/lib.rs\n") + .run(); +} + +fn include_exclude_test( + include: &str, + exclude: &str, + files: &[&str], + expected: &str, + has_warnings: bool, +) { + let mut pb = project().file( + "Cargo.toml", + &format!( + r#" + [package] + name = "foo" + version = "0.1.0" + authors = [] + license = "MIT" + description = "foo" + documentation = "foo" + homepage = "foo" + repository = "foo" + include = {} + exclude = {} + "#, + include, exclude + ), + ); + for file in files { + pb = pb.file(file, ""); + } + let p = pb.build(); + + let mut e = p.cargo("package --list"); + if has_warnings { + e.with_stderr_contains("[..]"); + } else { + e.with_stderr(""); + } + e.with_stdout(expected).run(); + p.root().rm_rf(); +} + +#[test] +fn package_include_ignore_only() { + // Test with a gitignore pattern that fails to parse with glob. + // This is a somewhat nonsense pattern, but is an example of something git + // allows and glob does not. + assert!(glob::Pattern::new("src/abc**").is_err()); + + include_exclude_test( + r#"["Cargo.toml", "src/abc**", "src/lib.rs"]"#, + "[]", + &["src/lib.rs", "src/abc1.rs", "src/abc2.rs", "src/abc/mod.rs"], + "Cargo.toml\n\ + src/abc/mod.rs\n\ + src/abc1.rs\n\ + src/abc2.rs\n\ + src/lib.rs\n\ + ", + false, + ) +} + +#[test] +fn gitignore_patterns() { + include_exclude_test( + r#"["Cargo.toml", "foo"]"#, // include + "[]", + &["src/lib.rs", "foo", "a/foo", "a/b/foo", "x/foo/y", "bar"], + "Cargo.toml\n\ + a/b/foo\n\ + a/foo\n\ + foo\n\ + x/foo/y\n\ + ", + true, + ); + + include_exclude_test( + r#"["Cargo.toml", "/foo"]"#, // include + "[]", + &["src/lib.rs", "foo", "a/foo", "a/b/foo", "x/foo/y", "bar"], + "Cargo.toml\n\ + foo\n\ + ", + false, + ); + + include_exclude_test( + "[]", + r#"["foo/"]"#, // exclude + &["src/lib.rs", "foo", "a/foo", "x/foo/y", "bar"], + "Cargo.toml\n\ + a/foo\n\ + bar\n\ + foo\n\ + src/lib.rs\n\ + ", + true, + ); + + include_exclude_test( + "[]", + r#"["*.txt", "[ab]", "[x-z]"]"#, // exclude + &[ + "src/lib.rs", + "foo.txt", + "bar/foo.txt", + "other", + "a", + "b", + "c", + "x", + "y", + "z", + ], + "Cargo.toml\n\ + c\n\ + other\n\ + src/lib.rs\n\ + ", + false, + ); + + include_exclude_test( + r#"["Cargo.toml", "**/foo/bar"]"#, // include + "[]", + &["src/lib.rs", "a/foo/bar", "foo", "bar"], + "Cargo.toml\n\ + a/foo/bar\n\ + ", + false, + ); + + include_exclude_test( + r#"["Cargo.toml", "foo/**"]"#, // include + "[]", + &["src/lib.rs", "a/foo/bar", "foo/x/y/z"], + "Cargo.toml\n\ + foo/x/y/z\n\ + ", + false, + ); + + include_exclude_test( + r#"["Cargo.toml", "a/**/b"]"#, // include + "[]", + &["src/lib.rs", "a/b", "a/x/b", "a/x/y/b"], + "Cargo.toml\n\ + a/b\n\ + a/x/b\n\ + a/x/y/b\n\ + ", + false, + ); +} + +#[test] +fn gitignore_negate() { + include_exclude_test( + r#"["Cargo.toml", "*.rs", "!foo.rs", "\\!important"]"#, // include + "[]", + &["src/lib.rs", "foo.rs", "!important"], + "!important\n\ + Cargo.toml\n\ + src/lib.rs\n\ + ", + false, + ); + + // NOTE: This is unusual compared to git. Git treats `src/` as a + // short-circuit which means rules like `!src/foo.rs` would never run. + // However, because Cargo only works by iterating over *files*, it doesn't + // short-circuit. + include_exclude_test( + r#"["Cargo.toml", "src/", "!src/foo.rs"]"#, // include + "[]", + &["src/lib.rs", "src/foo.rs"], + "Cargo.toml\n\ + src/lib.rs\n\ + ", + false, + ); + + include_exclude_test( + r#"["Cargo.toml", "src/*.rs", "!foo.rs"]"#, // include + "[]", + &["src/lib.rs", "foo.rs", "src/foo.rs", "src/bar/foo.rs"], + "Cargo.toml\n\ + src/lib.rs\n\ + ", + false, + ); + + include_exclude_test( + "[]", + r#"["*.rs", "!foo.rs", "\\!important"]"#, // exclude + &["src/lib.rs", "foo.rs", "!important"], + "Cargo.toml\n\ + foo.rs\n\ + ", + false, + ); +} diff -Nru cargo-0.35.0/tests/testsuite/path.rs cargo-0.37.0/tests/testsuite/path.rs --- cargo-0.35.0/tests/testsuite/path.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/path.rs 2019-05-15 19:48:47.000000000 +0000 @@ -580,7 +580,7 @@ .build(); let p = project(); - let root = p.root().clone(); + let root = p.root(); let p = p .file(".cargo/config", &format!("paths = ['{}']", root.display())) .file( @@ -881,7 +881,7 @@ .file("b/.cargo/config", r#"paths = ["../a"]"#) .build(); p.cargo("build") - .cwd(p.root().join("b")) + .cwd("b") .with_stderr( "\ [COMPILING] a2 v0.5.0 ([..]) diff -Nru cargo-0.35.0/tests/testsuite/plugins.rs cargo-0.37.0/tests/testsuite/plugins.rs --- cargo-0.35.0/tests/testsuite/plugins.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/plugins.rs 2019-05-15 19:48:47.000000000 +0000 @@ -4,6 +4,7 @@ #[test] fn plugin_to_the_max() { if !is_nightly() { + // plugins are unstable return; } @@ -103,6 +104,7 @@ #[test] fn plugin_with_dynamic_native_dependency() { if !is_nightly() { + // plugins are unstable return; } @@ -335,6 +337,7 @@ #[test] fn panic_abort_plugins() { if !is_nightly() { + // requires rustc_private return; } @@ -382,6 +385,7 @@ #[test] fn shared_panic_abort_plugins() { if !is_nightly() { + // requires rustc_private return; } diff -Nru cargo-0.35.0/tests/testsuite/proc_macro.rs cargo-0.37.0/tests/testsuite/proc_macro.rs --- cargo-0.35.0/tests/testsuite/proc_macro.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/proc_macro.rs 2019-05-15 19:48:47.000000000 +0000 @@ -204,6 +204,7 @@ #[test] fn plugin_and_proc_macro() { if !is_nightly() { + // plugins are unstable return; } diff -Nru cargo-0.35.0/tests/testsuite/profile_overrides.rs cargo-0.37.0/tests/testsuite/profile_overrides.rs --- cargo-0.35.0/tests/testsuite/profile_overrides.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/profile_overrides.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,3 +1,4 @@ +use crate::support::registry::Package; use crate::support::{basic_lib_manifest, basic_manifest, project}; #[test] @@ -201,7 +202,7 @@ ), ("overrides = {}", "Profile overrides cannot be nested."), ]; - for &(ref snippet, ref expected) in bad_values.iter() { + for &(snippet, expected) in bad_values.iter() { let p = project() .file( "Cargo.toml", @@ -320,17 +321,17 @@ p.cargo("build -v").masquerade_as_nightly_cargo().with_stderr_unordered("\ [COMPILING] m3 [..] [COMPILING] dep [..] -[RUNNING] `rustc --crate-name m3 m3/src/lib.rs --color never --crate-type lib --emit=dep-info,link -C codegen-units=4 [..] -[RUNNING] `rustc --crate-name dep [..]dep/src/lib.rs --color never --crate-type lib --emit=dep-info,link -C codegen-units=3 [..] -[RUNNING] `rustc --crate-name m3 m3/src/lib.rs --color never --crate-type lib --emit=dep-info,link -C codegen-units=1 [..] -[RUNNING] `rustc --crate-name build_script_build m1/build.rs --color never --crate-type bin --emit=dep-info,link -C codegen-units=4 [..] +[RUNNING] `rustc --crate-name m3 m3/src/lib.rs --color never --crate-type lib --emit=[..]link -C codegen-units=4 [..] +[RUNNING] `rustc --crate-name dep [..]dep/src/lib.rs --color never --crate-type lib --emit=[..]link -C codegen-units=3 [..] +[RUNNING] `rustc --crate-name m3 m3/src/lib.rs --color never --crate-type lib --emit=[..]link -C codegen-units=1 [..] +[RUNNING] `rustc --crate-name build_script_build m1/build.rs --color never --crate-type bin --emit=[..]link -C codegen-units=4 [..] [COMPILING] m2 [..] -[RUNNING] `rustc --crate-name build_script_build m2/build.rs --color never --crate-type bin --emit=dep-info,link -C codegen-units=2 [..] +[RUNNING] `rustc --crate-name build_script_build m2/build.rs --color never --crate-type bin --emit=[..]link -C codegen-units=2 [..] [RUNNING] `[..]/m1-[..]/build-script-build` [RUNNING] `[..]/m2-[..]/build-script-build` -[RUNNING] `rustc --crate-name m2 m2/src/lib.rs --color never --crate-type lib --emit=dep-info,link -C codegen-units=2 [..] +[RUNNING] `rustc --crate-name m2 m2/src/lib.rs --color never --crate-type lib --emit=[..]link -C codegen-units=2 [..] [COMPILING] m1 [..] -[RUNNING] `rustc --crate-name m1 m1/src/lib.rs --color never --crate-type lib --emit=dep-info,link -C codegen-units=1 [..] +[RUNNING] `rustc --crate-name m1 m1/src/lib.rs --color never --crate-type lib --emit=[..]link -C codegen-units=1 [..] [FINISHED] dev [unoptimized + debuginfo] [..] ", ) @@ -439,3 +440,70 @@ .with_stderr_contains("[RUNNING] `rustc [..]dep2/src/lib.rs [..] -C codegen-units=2 [..]") .run(); } + +#[test] +fn override_proc_macro() { + Package::new("shared", "1.0.0").publish(); + let p = project() + .file( + "Cargo.toml", + r#" + cargo-features = ["profile-overrides"] + [package] + name = "foo" + version = "0.1.0" + edition = "2018" + + [dependencies] + shared = "1.0" + pm = {path = "pm"} + + [profile.dev.build-override] + codegen-units = 4 + "#, + ) + .file("src/lib.rs", r#"pm::eat!{}"#) + .file( + "pm/Cargo.toml", + r#" + [package] + name = "pm" + version = "0.1.0" + + [lib] + proc-macro = true + + [dependencies] + shared = "1.0" + "#, + ) + .file( + "pm/src/lib.rs", + r#" + extern crate proc_macro; + use proc_macro::TokenStream; + + #[proc_macro] + pub fn eat(_item: TokenStream) -> TokenStream { + "".parse().unwrap() + } + "#, + ) + .build(); + + p.cargo("build -v") + .masquerade_as_nightly_cargo() + // Shared built for the proc-macro. + .with_stderr_contains("[RUNNING] `rustc [..]--crate-name shared [..]-C codegen-units=4[..]") + // Shared built for the library. + .with_stderr_line_without( + &["[RUNNING] `rustc --crate-name shared"], + &["-C codegen-units"], + ) + .with_stderr_contains("[RUNNING] `rustc [..]--crate-name pm [..]-C codegen-units=4[..]") + .with_stderr_line_without( + &["[RUNNING] `rustc [..]--crate-name foo"], + &["-C codegen-units"], + ) + .run(); +} diff -Nru cargo-0.35.0/tests/testsuite/profiles.rs cargo-0.37.0/tests/testsuite/profiles.rs --- cargo-0.35.0/tests/testsuite/profiles.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/profiles.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,6 +1,5 @@ use std::env; -use crate::support::is_nightly; use crate::support::project; #[test] @@ -28,7 +27,7 @@ "\ [COMPILING] test v0.0.0 ([CWD]) [RUNNING] `rustc --crate-name test src/lib.rs --color never --crate-type lib \ - --emit=dep-info,link \ + --emit=[..]link \ -C opt-level=1 \ -C debug-assertions=on \ -C metadata=[..] \ @@ -64,7 +63,7 @@ "\ [COMPILING] test v0.0.0 ([CWD]) [RUNNING] `rustc --crate-name test src/lib.rs --color never --crate-type lib \ - --emit=dep-info,link \ + --emit=[..]link \ -C debuginfo=2 \ -C metadata=[..] \ --out-dir [..] \ @@ -97,7 +96,7 @@ "\ [COMPILING] test v0.0.0 ([CWD]) [RUNNING] `rustc --crate-name test src/lib.rs --color never --crate-type lib \ - --emit=dep-info,link \ + --emit=[..]link \ -C debuginfo=1 \ -C metadata=[..] \ --out-dir [..] \ @@ -133,7 +132,7 @@ "\ [COMPILING] test v0.0.0 ([CWD]) [RUNNING] `rustc --crate-name test src/lib.rs --color never --crate-type lib \ - --emit=dep-info,link \ + --emit=[..]link \ -C opt-level={level} \ -C debuginfo=2 \ -C debug-assertions=on \ @@ -149,10 +148,6 @@ #[test] fn opt_level_overrides() { - if !is_nightly() { - return; - } - for &(profile_level, rustc_level) in &[ ("1", "1"), ("2", "2"), @@ -211,7 +206,7 @@ [COMPILING] foo v0.0.0 ([CWD]/foo) [RUNNING] `rustc --crate-name foo foo/src/lib.rs --color never \ --crate-type dylib --crate-type rlib \ - --emit=dep-info,link \ + --emit=[..]link \ -C prefer-dynamic \ -C opt-level=1 \ -C debuginfo=2 \ @@ -220,7 +215,7 @@ -L dependency=[CWD]/target/release/deps` [COMPILING] test v0.0.0 ([CWD]) [RUNNING] `rustc --crate-name test src/lib.rs --color never --crate-type lib \ - --emit=dep-info,link \ + --emit=[..]link \ -C opt-level=1 \ -C debuginfo=2 \ -C metadata=[..] \ @@ -273,7 +268,7 @@ .build(); p.cargo("build -v") - .cwd(p.root().join("bar")) + .cwd("bar") .with_stderr( "\ [WARNING] profiles for the non root package will be ignored, specify profiles at the workspace root: @@ -315,7 +310,7 @@ .build(); p.cargo("build -v") - .cwd(p.root().join("bar")) + .cwd("bar") .with_stderr( "\ [COMPILING] bar v0.1.0 ([..]) @@ -376,3 +371,40 @@ .with_stderr_contains("[WARNING] profile `doc` is deprecated and has no effect") .run(); } + +#[test] +fn panic_unwind_does_not_build_twice() { + // Check for a bug where `lib` was built twice, once with panic set and + // once without. Since "unwind" is the default, they are the same and + // should only be built once. + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + + [profile.dev] + panic = "unwind" + "#, + ) + .file("src/lib.rs", "") + .file("src/main.rs", "fn main() {}") + .file("tests/t1.rs", "") + .build(); + + p.cargo("test -v --tests --no-run") + .with_stderr_unordered( + "\ +[COMPILING] foo [..] +[RUNNING] `rustc --crate-name foo src/lib.rs [..]--crate-type lib [..] +[RUNNING] `rustc --crate-name foo src/lib.rs [..] --test [..] +[RUNNING] `rustc --crate-name foo src/main.rs [..]--crate-type bin [..] +[RUNNING] `rustc --crate-name foo src/main.rs [..] --test [..] +[RUNNING] `rustc --crate-name t1 tests/t1.rs [..] +[FINISHED] [..] +", + ) + .run(); +} diff -Nru cargo-0.35.0/tests/testsuite/profile_targets.rs cargo-0.37.0/tests/testsuite/profile_targets.rs --- cargo-0.35.0/tests/testsuite/profile_targets.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/profile_targets.rs 2019-05-15 19:48:47.000000000 +0000 @@ -78,16 +78,16 @@ // - build_script_build is built without panic because it thinks `build.rs` is a plugin. p.cargo("build -vv").with_stderr_unordered("\ [COMPILING] bar [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] bdep [..] -[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] foo [..] -[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] [RUNNING] `[..]/target/debug/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0 -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=dep-info,link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=[..]link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] [FINISHED] dev [unoptimized + debuginfo] [..] ").run(); p.cargo("build -vv") @@ -109,16 +109,16 @@ // `build --release` p.cargo("build --release -vv").with_stderr_unordered("\ [COMPILING] bar [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C codegen-units=2 [..] [COMPILING] bdep [..] -[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C codegen-units=2 [..] [COMPILING] foo [..] -[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C codegen-units=2 [..] [RUNNING] `[..]/target/release/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3 -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] -[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] [FINISHED] release [optimized] [..] ").run(); p.cargo("build --release -vv") @@ -165,22 +165,22 @@ // example dev build p.cargo("build --all-targets -vv").with_stderr_unordered("\ [COMPILING] bar [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] bdep [..] -[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] foo [..] -[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] [RUNNING] `[..]/target/debug/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0 -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..]` -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=dep-info,link -C codegen-units=3 -C debuginfo=2 --test [..]` -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..]` -[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=dep-info,link -C codegen-units=3 -C debuginfo=2 --test [..]` -[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=dep-info,link -C codegen-units=3 -C debuginfo=2 --test [..]` -[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=dep-info,link -C codegen-units=3 -C debuginfo=2 --test [..]` -[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=dep-info,link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..]` -[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--crate-type bin --emit=dep-info,link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..]` +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..]` +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=[..]link -C codegen-units=3 -C debuginfo=2 --test [..]` +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..]` +[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=[..]link -C codegen-units=3 -C debuginfo=2 --test [..]` +[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=[..]link -C codegen-units=3 -C debuginfo=2 --test [..]` +[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=[..]link -C codegen-units=3 -C debuginfo=2 --test [..]` +[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=[..]link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..]` +[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--crate-type bin --emit=[..]link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..]` [FINISHED] dev [unoptimized + debuginfo] [..] ").run(); p.cargo("build -vv") @@ -230,22 +230,22 @@ // example release build p.cargo("build --all-targets --release -vv").with_stderr_unordered("\ [COMPILING] bar [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] [COMPILING] bdep [..] -[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C codegen-units=2 [..] [COMPILING] foo [..] -[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C codegen-units=2 [..] [RUNNING] `[..]/target/release/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3 -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C panic=abort -C codegen-units=2 [..]` -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=dep-info,link -C opt-level=3 -C codegen-units=4 --test [..]` -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..]` -[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=dep-info,link -C opt-level=3 -C codegen-units=4 --test [..]` -[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=dep-info,link -C opt-level=3 -C codegen-units=4 --test [..]` -[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=dep-info,link -C opt-level=3 -C codegen-units=4 --test [..]` -[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C codegen-units=2 [..]` -[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C codegen-units=2 [..]` +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort -C codegen-units=2 [..]` +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=[..]link -C opt-level=3 -C codegen-units=4 --test [..]` +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C codegen-units=2 [..]` +[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=[..]link -C opt-level=3 -C codegen-units=4 --test [..]` +[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=[..]link -C opt-level=3 -C codegen-units=4 --test [..]` +[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=[..]link -C opt-level=3 -C codegen-units=4 --test [..]` +[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C panic=abort -C codegen-units=2 [..]` +[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C panic=abort -C codegen-units=2 [..]` [FINISHED] release [optimized] [..] ").run(); p.cargo("build --all-targets --release -vv") @@ -286,21 +286,21 @@ // p.cargo("test -vv").with_stderr_unordered("\ [COMPILING] bar [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] bdep [..] -[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] foo [..] -[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] [RUNNING] `[..]/target/debug/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0 -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=dep-info,link -C codegen-units=3 -C debuginfo=2 --test [..] -[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=dep-info,link -C codegen-units=3 -C debuginfo=2 --test [..] -[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--crate-type bin --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=dep-info,link -C codegen-units=3 -C debuginfo=2 --test [..] -[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=dep-info,link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=[..]link -C codegen-units=3 -C debuginfo=2 --test [..] +[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=[..]link -C codegen-units=3 -C debuginfo=2 --test [..] +[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--crate-type bin --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=[..]link -C codegen-units=3 -C debuginfo=2 --test [..] +[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=[..]link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] [FINISHED] dev [unoptimized + debuginfo] [..] [RUNNING] `[..]/deps/foo-[..]` [RUNNING] `[..]/deps/foo-[..]` @@ -351,21 +351,21 @@ // p.cargo("test --release -vv").with_stderr_unordered("\ [COMPILING] bar [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] [COMPILING] bdep [..] -[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C codegen-units=2 [..] [COMPILING] foo [..] -[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C codegen-units=2 [..] [RUNNING] `[..]/target/release/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3 -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=dep-info,link -C opt-level=3 -C codegen-units=4 --test [..] -[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=dep-info,link -C opt-level=3 -C codegen-units=4 --test [..] -[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=dep-info,link -C opt-level=3 -C codegen-units=4 --test [..] -[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--crate-type bin --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] -[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=[..]link -C opt-level=3 -C codegen-units=4 --test [..] +[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=[..]link -C opt-level=3 -C codegen-units=4 --test [..] +[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=[..]link -C opt-level=3 -C codegen-units=4 --test [..] +[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] [FINISHED] release [optimized] [..] [RUNNING] `[..]/deps/foo-[..]` [RUNNING] `[..]/deps/foo-[..]` @@ -416,20 +416,20 @@ // p.cargo("bench -vv").with_stderr_unordered("\ [COMPILING] bar [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] [COMPILING] bdep [..] -[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C codegen-units=2 [..] [COMPILING] foo [..] -[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C codegen-units=2 [..] [RUNNING] `[..]target/release/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3 -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=dep-info,link -C opt-level=3 -C codegen-units=4 --test [..] -[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=dep-info,link -C opt-level=3 -C codegen-units=4 --test [..] -[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=dep-info,link -C opt-level=3 -C codegen-units=4 --test [..] -[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=[..]link -C opt-level=3 -C codegen-units=4 --test [..] +[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=[..]link -C opt-level=3 -C codegen-units=4 --test [..] +[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=[..]link -C opt-level=3 -C codegen-units=4 --test [..] +[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] [FINISHED] release [optimized] [..] [RUNNING] `[..]/deps/foo-[..] --bench` [RUNNING] `[..]/deps/foo-[..] --bench` @@ -480,23 +480,23 @@ // p.cargo("check --all-targets -vv").with_stderr_unordered("\ [COMPILING] bar [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,metadata -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,metadata -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] bdep[..] -[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] foo [..] -[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] [RUNNING] `[..]target/debug/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0 -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,metadata -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,metadata -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=dep-info,metadata -C codegen-units=1 -C debuginfo=2 --test [..] -[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=dep-info,metadata -C codegen-units=1 -C debuginfo=2 --test [..] -[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=dep-info,metadata -C codegen-units=1 -C debuginfo=2 --test [..] -[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=dep-info,metadata -C codegen-units=1 -C debuginfo=2 --test [..] -[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--crate-type bin --emit=dep-info,metadata -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=dep-info,metadata -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]metadata -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]metadata -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=[..]metadata -C codegen-units=1 -C debuginfo=2 --test [..] +[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=[..]metadata -C codegen-units=1 -C debuginfo=2 --test [..] +[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=[..]metadata -C codegen-units=1 -C debuginfo=2 --test [..] +[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=[..]metadata -C codegen-units=1 -C debuginfo=2 --test [..] +[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--crate-type bin --emit=[..]metadata -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=[..]metadata -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] [FINISHED] dev [unoptimized + debuginfo] [..] ").run(); // Starting with Rust 1.27, rustc emits `rmeta` files for bins, so @@ -525,23 +525,23 @@ // `dev` for all targets. p.cargo("check --all-targets --release -vv").with_stderr_unordered("\ [COMPILING] bar [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,metadata -C opt-level=3 -C codegen-units=2 [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,metadata -C opt-level=3 -C panic=abort -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata -C opt-level=3 -C panic=abort -C codegen-units=2 [..] [COMPILING] bdep[..] -[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C codegen-units=2 [..] [COMPILING] foo [..] -[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C codegen-units=2 [..] [RUNNING] `[..]target/release/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3 -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,metadata -C opt-level=3 -C panic=abort -C codegen-units=2 [..] -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,metadata -C opt-level=3 -C codegen-units=2 [..] -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=dep-info,metadata -C opt-level=3 -C codegen-units=2 --test [..] -[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=dep-info,metadata -C opt-level=3 -C codegen-units=2 --test [..] -[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=dep-info,metadata -C opt-level=3 -C codegen-units=2 --test [..] -[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=dep-info,metadata -C opt-level=3 -C codegen-units=2 --test [..] -[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--crate-type bin --emit=dep-info,metadata -C opt-level=3 -C panic=abort -C codegen-units=2 [..] -[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=dep-info,metadata -C opt-level=3 -C panic=abort -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]metadata -C opt-level=3 -C panic=abort -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]metadata -C opt-level=3 -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=[..]metadata -C opt-level=3 -C codegen-units=2 --test [..] +[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=[..]metadata -C opt-level=3 -C codegen-units=2 --test [..] +[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=[..]metadata -C opt-level=3 -C codegen-units=2 --test [..] +[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=[..]metadata -C opt-level=3 -C codegen-units=2 --test [..] +[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--crate-type bin --emit=[..]metadata -C opt-level=3 -C panic=abort -C codegen-units=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=[..]metadata -C opt-level=3 -C panic=abort -C codegen-units=2 [..] [FINISHED] release [optimized] [..] ").run(); @@ -586,20 +586,20 @@ // p.cargo("check --all-targets --profile=test -vv").with_stderr_unordered("\ [COMPILING] bar [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,metadata -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] bdep[..] -[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] foo [..] -[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] [RUNNING] `[..]target/debug/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0 -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,metadata -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=dep-info,metadata -C codegen-units=1 -C debuginfo=2 --test [..] -[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=dep-info,metadata -C codegen-units=1 -C debuginfo=2 --test [..] -[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=dep-info,metadata -C codegen-units=1 -C debuginfo=2 --test [..] -[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=dep-info,metadata -C codegen-units=1 -C debuginfo=2 --test [..] -[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--emit=dep-info,metadata -C codegen-units=1 -C debuginfo=2 --test [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]metadata -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=[..]metadata -C codegen-units=1 -C debuginfo=2 --test [..] +[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=[..]metadata -C codegen-units=1 -C debuginfo=2 --test [..] +[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=[..]metadata -C codegen-units=1 -C debuginfo=2 --test [..] +[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=[..]metadata -C codegen-units=1 -C debuginfo=2 --test [..] +[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--emit=[..]metadata -C codegen-units=1 -C debuginfo=2 --test [..] [FINISHED] dev [unoptimized + debuginfo] [..] ").run(); @@ -632,13 +632,13 @@ p.cargo("doc -vv").with_stderr_unordered("\ [COMPILING] bar [..] [DOCUMENTING] bar [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] [RUNNING] `rustdoc --crate-name bar bar/src/lib.rs [..] -[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=dep-info,metadata -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] bdep [..] -[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] foo [..] -[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] +[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..] [RUNNING] `[..]target/debug/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0 [DOCUMENTING] foo [..] diff -Nru cargo-0.35.0/tests/testsuite/publish_lockfile.rs cargo-0.37.0/tests/testsuite/publish_lockfile.rs --- cargo-0.35.0/tests/testsuite/publish_lockfile.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/publish_lockfile.rs 2019-05-15 19:48:47.000000000 +0000 @@ -0,0 +1,451 @@ +use std; +use std::fs::File; + +use crate::support::registry::Package; +use crate::support::{ + basic_manifest, cargo_process, git, paths, project, publish::validate_crate_contents, +}; + +fn pl_manifest(name: &str, version: &str, extra: &str) -> String { + format!( + r#" + cargo-features = ["publish-lockfile"] + + [project] + name = "{}" + version = "{}" + authors = [] + license = "MIT" + description = "foo" + documentation = "foo" + homepage = "foo" + repository = "foo" + publish-lockfile = true + + {} + "#, + name, version, extra + ) +} + +#[test] +fn package_lockfile() { + let p = project() + .file("Cargo.toml", &pl_manifest("foo", "0.0.1", "")) + .file("src/main.rs", "fn main() {}") + .build(); + + p.cargo("package") + .masquerade_as_nightly_cargo() + .with_stderr( + "\ +[PACKAGING] foo v0.0.1 ([CWD]) +[VERIFYING] foo v0.0.1 ([CWD]) +[COMPILING] foo v0.0.1 ([CWD][..]) +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] +", + ) + .run(); + assert!(p.root().join("target/package/foo-0.0.1.crate").is_file()); + p.cargo("package -l") + .masquerade_as_nightly_cargo() + .with_stdout( + "\ +Cargo.lock +Cargo.toml +src/main.rs +", + ) + .run(); + p.cargo("package") + .masquerade_as_nightly_cargo() + .with_stdout("") + .run(); + + let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap(); + validate_crate_contents( + f, + "foo-0.0.1.crate", + &["Cargo.toml", "Cargo.toml.orig", "Cargo.lock", "src/main.rs"], + &[], + ); +} + +#[test] +fn package_lockfile_git_repo() { + // Create a Git repository containing a minimal Rust project. + let g = git::repo(&paths::root().join("foo")) + .file("Cargo.toml", &pl_manifest("foo", "0.0.1", "")) + .file("src/main.rs", "fn main() {}") + .build(); + cargo_process("package -l") + .cwd(g.root()) + .masquerade_as_nightly_cargo() + .with_stdout( + "\ +.cargo_vcs_info.json +Cargo.lock +Cargo.toml +src/main.rs +", + ) + .run(); + cargo_process("package -v") + .cwd(g.root()) + .masquerade_as_nightly_cargo() + .with_stderr( + "\ +[PACKAGING] foo v0.0.1 ([..]) +[ARCHIVING] Cargo.toml +[ARCHIVING] src/main.rs +[ARCHIVING] .cargo_vcs_info.json +[ARCHIVING] Cargo.lock +[VERIFYING] foo v0.0.1 ([..]) +[COMPILING] foo v0.0.1 ([..]) +[RUNNING] `rustc --crate-name foo src/main.rs [..] +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] +", + ) + .run(); +} + +#[test] +fn no_lock_file_with_library() { + let p = project() + .file("Cargo.toml", &pl_manifest("foo", "0.0.1", "")) + .file("src/lib.rs", "") + .build(); + + p.cargo("package").masquerade_as_nightly_cargo().run(); + + let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap(); + validate_crate_contents( + f, + "foo-0.0.1.crate", + &["Cargo.toml", "Cargo.toml.orig", "src/lib.rs"], + &[], + ); +} + +#[test] +fn lock_file_and_workspace() { + let p = project() + .file( + "Cargo.toml", + r#" + [workspace] + members = ["foo"] + "#, + ) + .file("foo/Cargo.toml", &pl_manifest("foo", "0.0.1", "")) + .file("foo/src/main.rs", "fn main() {}") + .build(); + + p.cargo("package") + .cwd("foo") + .masquerade_as_nightly_cargo() + .run(); + + let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap(); + validate_crate_contents( + f, + "foo-0.0.1.crate", + &["Cargo.toml", "Cargo.toml.orig", "src/main.rs", "Cargo.lock"], + &[], + ); +} + +#[test] +fn note_resolve_changes() { + // `multi` has multiple sources (path and registry). + Package::new("mutli", "0.1.0").publish(); + // `updated` is always from registry, but should not change. + Package::new("updated", "1.0.0").publish(); + // `patched` is [patch]ed. + Package::new("patched", "1.0.0").publish(); + + let p = project() + .file( + "Cargo.toml", + &pl_manifest( + "foo", + "0.0.1", + r#" + [dependencies] + mutli = { path = "mutli", version = "0.1" } + updated = "1.0" + patched = "1.0" + + [patch.crates-io] + patched = { path = "patched" } + "#, + ), + ) + .file("src/main.rs", "fn main() {}") + .file("mutli/Cargo.toml", &basic_manifest("mutli", "0.1.0")) + .file("mutli/src/lib.rs", "") + .file("patched/Cargo.toml", &basic_manifest("patched", "1.0.0")) + .file("patched/src/lib.rs", "") + .build(); + + p.cargo("generate-lockfile") + .masquerade_as_nightly_cargo() + .run(); + + // Make sure this does not change or warn. + Package::new("updated", "1.0.1").publish(); + + p.cargo("package --no-verify -v --allow-dirty") + .masquerade_as_nightly_cargo() + .with_stderr_unordered( + "\ +[PACKAGING] foo v0.0.1 ([..]) +[ARCHIVING] Cargo.toml +[ARCHIVING] src/main.rs +[ARCHIVING] Cargo.lock +[UPDATING] `[..]` index +[NOTE] package `mutli v0.1.0` added to the packaged Cargo.lock file, was originally sourced from `[..]/foo/mutli` +[NOTE] package `patched v1.0.0` added to the packaged Cargo.lock file, was originally sourced from `[..]/foo/patched` +", + ) + .run(); +} + +#[test] +fn outdated_lock_version_change_does_not_warn() { + // If the version of the package being packaged changes, but Cargo.lock is + // not updated, don't bother warning about it. + let p = project() + .file("Cargo.toml", &pl_manifest("foo", "0.1.0", "")) + .file("src/main.rs", "fn main() {}") + .build(); + + p.cargo("generate-lockfile") + .masquerade_as_nightly_cargo() + .run(); + + p.change_file("Cargo.toml", &pl_manifest("foo", "0.2.0", "")); + + p.cargo("package --no-verify") + .masquerade_as_nightly_cargo() + .with_stderr("[PACKAGING] foo v0.2.0 ([..])") + .run(); +} + +#[test] +fn no_warn_workspace_extras() { + // Other entries in workspace lock file should be ignored. + Package::new("dep1", "1.0.0").publish(); + Package::new("dep2", "1.0.0").publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + [workspace] + members = ["a", "b"] + "#, + ) + .file( + "a/Cargo.toml", + &pl_manifest( + "a", + "0.1.0", + r#" + [dependencies] + dep1 = "1.0" + "#, + ), + ) + .file("a/src/main.rs", "fn main() {}") + .file( + "b/Cargo.toml", + &pl_manifest( + "b", + "0.1.0", + r#" + [dependencies] + dep2 = "1.0" + "#, + ), + ) + .file("b/src/main.rs", "fn main() {}") + .build(); + p.cargo("generate-lockfile") + .masquerade_as_nightly_cargo() + .run(); + p.cargo("package --no-verify") + .cwd("a") + .masquerade_as_nightly_cargo() + .with_stderr( + "\ +[PACKAGING] a v0.1.0 ([..]) +[UPDATING] `[..]` index +", + ) + .run(); +} + +#[test] +fn warn_package_with_yanked() { + Package::new("bar", "0.1.0").publish(); + let p = project() + .file( + "Cargo.toml", + &pl_manifest( + "foo", + "0.0.1", + r#" + [dependencies] + bar = "0.1" + "#, + ), + ) + .file("src/main.rs", "fn main() {}") + .build(); + p.cargo("generate-lockfile") + .masquerade_as_nightly_cargo() + .run(); + Package::new("bar", "0.1.0").yanked(true).publish(); + // Make sure it sticks with the locked (yanked) version. + Package::new("bar", "0.1.1").publish(); + p.cargo("package --no-verify") + .masquerade_as_nightly_cargo() + .with_stderr( + "\ +[PACKAGING] foo v0.0.1 ([..]) +[UPDATING] `[..]` index +[WARNING] package `bar v0.1.0` in Cargo.lock is yanked in registry \ + `crates.io`, consider updating to a version that is not yanked +", + ) + .run(); +} + +#[test] +fn warn_install_with_yanked() { + Package::new("bar", "0.1.0").yanked(true).publish(); + Package::new("bar", "0.1.1").publish(); + Package::new("foo", "0.1.0") + .dep("bar", "0.1") + .file("src/main.rs", "fn main() {}") + .file( + "Cargo.lock", + r#" +[[package]] +name = "bar" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "foo" +version = "0.1.0" +dependencies = [ + "bar 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + "#, + ) + .publish(); + + cargo_process("install --locked foo") + .with_stderr( + "\ +[UPDATING] `[..]` index +[DOWNLOADING] crates ... +[DOWNLOADED] foo v0.1.0 (registry `[..]`) +[INSTALLING] foo v0.1.0 +[WARNING] package `bar v0.1.0` in Cargo.lock is yanked in registry \ + `crates.io`, consider running without --locked +[DOWNLOADING] crates ... +[DOWNLOADED] bar v0.1.0 (registry `[..]`) +[COMPILING] bar v0.1.0 +[COMPILING] foo v0.1.0 +[FINISHED] release [optimized] target(s) in [..] +[INSTALLING] [..]/.cargo/bin/foo[EXE] +[INSTALLED] package `foo v0.1.0` (executable `foo[EXE]`) +[WARNING] be sure to add [..] +", + ) + .run(); + + // Try again without --locked, make sure it uses 0.1.1 and does not warn. + cargo_process("install --force foo") + .with_stderr( + "\ +[UPDATING] `[..]` index +[INSTALLING] foo v0.1.0 +[DOWNLOADING] crates ... +[DOWNLOADED] bar v0.1.1 (registry `[..]`) +[COMPILING] bar v0.1.1 +[COMPILING] foo v0.1.0 +[FINISHED] release [optimized] target(s) in [..] +[REPLACING] [..]/.cargo/bin/foo[EXE] +[REPLACED] package `foo v0.1.0` with `foo v0.1.0` (executable `foo[EXE]`) +[WARNING] be sure to add [..] +", + ) + .run(); +} + +#[test] +fn publish_lockfile_default() { + let p = project() + .file( + "Cargo.toml", + r#" + cargo-features = ["publish-lockfile"] + [package] + name = "foo" + version = "1.0.0" + authors = [] + license = "MIT" + description = "foo" + documentation = "foo" + homepage = "foo" + repository = "foo" + "#, + ) + .file("src/main.rs", "fn main() {}") + .build(); + + p.cargo("package -l") + .masquerade_as_nightly_cargo() + .with_stdout( + "\ +Cargo.lock +Cargo.toml +src/main.rs +", + ) + .run(); + + let p = project() + .file( + "Cargo.toml", + r#" + cargo-features = ["publish-lockfile"] + [package] + name = "foo" + version = "1.0.0" + authors = [] + license = "MIT" + description = "foo" + documentation = "foo" + homepage = "foo" + repository = "foo" + publish-lockfile = false + "#, + ) + .file("src/main.rs", "fn main() {}") + .build(); + + p.cargo("package -l") + .masquerade_as_nightly_cargo() + .with_stdout( + "\ +Cargo.toml +src/main.rs +", + ) + .run(); +} diff -Nru cargo-0.35.0/tests/testsuite/publish.rs cargo-0.37.0/tests/testsuite/publish.rs --- cargo-0.35.0/tests/testsuite/publish.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/publish.rs 2019-05-15 19:48:47.000000000 +0000 @@ -354,8 +354,8 @@ .with_status(101) .with_stderr( "\ -[ERROR] some crates cannot be published. -`foo` is marked as unpublishable +[ERROR] `foo` cannot be published. +The registry `crates-io` is not listed in the `publish` value in Cargo.toml. ", ) .run(); @@ -457,7 +457,7 @@ .build(); p.cargo("publish") - .cwd(p.root().join("bar")) + .cwd("bar") .arg("--index") .arg(registry_url().to_string()) .run(); @@ -531,7 +531,7 @@ ) .nocommit_file("bar/src/main.rs", "fn main() {}"); p.cargo("publish") - .cwd(p.root().join("bar")) + .cwd("bar") .arg("--index") .arg(registry_url().to_string()) .run(); @@ -644,8 +644,8 @@ .with_status(101) .with_stderr( "\ -[ERROR] some crates cannot be published. -`foo` is marked as unpublishable +[ERROR] `foo` cannot be published. +The registry `alternative` is not listed in the `publish` value in Cargo.toml. ", ) .run(); @@ -675,8 +675,8 @@ .with_status(101) .with_stderr( "\ -[ERROR] some crates cannot be published. -`foo` is marked as unpublishable +[ERROR] `foo` cannot be published. +The registry `alternative` is not listed in the `publish` value in Cargo.toml. ", ) .run(); @@ -745,14 +745,48 @@ .with_status(101) .with_stderr( "\ -[ERROR] some crates cannot be published. -`foo` is marked as unpublishable +[ERROR] `foo` cannot be published. +The registry `alternative` is not listed in the `publish` value in Cargo.toml. ", ) .run(); } #[test] +fn publish_with_crates_io_explicit() { + // Explicitly setting `crates-io` in the publish list. + registry::init(); + + let p = project() + .file( + "Cargo.toml", + r#" + [project] + name = "foo" + version = "0.0.1" + authors = [] + license = "MIT" + description = "foo" + publish = ["crates-io"] + "#, + ) + .file("src/main.rs", "fn main() {}") + .build(); + + p.cargo("publish --registry alternative") + .with_status(101) + .with_stderr( + "\ +[ERROR] `foo` cannot be published. +The registry `alternative` is not listed in the `publish` value in Cargo.toml. +", + ) + .run(); + + p.cargo("publish").run(); +} + +#[test] fn publish_with_select_features() { registry::init(); @@ -943,3 +977,39 @@ &["Cargo.toml", "Cargo.toml.orig", "src/main.rs"], ); } + +#[test] +fn publish_checks_for_token_before_verify() { + registry::init(); + + let p = project() + .file( + "Cargo.toml", + r#" + [project] + name = "foo" + version = "0.0.1" + authors = [] + license = "MIT" + description = "foo" + "#, + ) + .file("src/main.rs", "fn main() {}") + .build(); + + let credentials = paths::home().join(".cargo/credentials"); + fs::remove_file(&credentials).unwrap(); + + // Assert upload token error before the package is verified + p.cargo("publish") + .with_status(101) + .with_stderr_contains("[ERROR] no upload token found, please run `cargo login`") + .with_stderr_does_not_contain("[VERIFYING] foo v0.0.1 ([CWD])") + .run(); + + // Assert package verified successfully on dry run + p.cargo("publish --dry-run") + .with_status(0) + .with_stderr_contains("[VERIFYING] foo v0.0.1 ([CWD])") + .run(); +} diff -Nru cargo-0.35.0/tests/testsuite/pub_priv.rs cargo-0.37.0/tests/testsuite/pub_priv.rs --- cargo-0.35.0/tests/testsuite/pub_priv.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/pub_priv.rs 2019-05-15 19:48:47.000000000 +0000 @@ -0,0 +1,204 @@ +use crate::support::registry::Package; +use crate::support::{is_nightly, project}; + +#[test] +fn exported_priv_warning() { + if !is_nightly() { + return; + } + Package::new("priv_dep", "0.1.0") + .file("src/lib.rs", "pub struct FromPriv;") + .publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + cargo-features = ["public-dependency"] + + [package] + name = "foo" + version = "0.0.1" + + [dependencies] + priv_dep = "0.1.0" + "#, + ) + .file( + "src/lib.rs", + " + extern crate priv_dep; + pub fn use_priv(_: priv_dep::FromPriv) {} + ", + ) + .build(); + + p.cargo("build --message-format=short") + .masquerade_as_nightly_cargo() + .with_stderr( + "\ +[UPDATING] `[..]` index +[DOWNLOADING] crates ... +[DOWNLOADED] priv_dep v0.1.0 ([..]) +[COMPILING] priv_dep v0.1.0 +[COMPILING] foo v0.0.1 ([CWD]) +src/lib.rs:3:13: warning: type `priv_dep::FromPriv` from private dependency 'priv_dep' in public interface +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] +" + ) + .run() +} + +#[test] +fn exported_pub_dep() { + if !is_nightly() { + return; + } + Package::new("pub_dep", "0.1.0") + .file("src/lib.rs", "pub struct FromPub;") + .publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + cargo-features = ["public-dependency"] + + [package] + name = "foo" + version = "0.0.1" + + [dependencies] + pub_dep = {version = "0.1.0", public = true} + "#, + ) + .file( + "src/lib.rs", + " + extern crate pub_dep; + pub fn use_pub(_: pub_dep::FromPub) {} + ", + ) + .build(); + + p.cargo("build --message-format=short") + .masquerade_as_nightly_cargo() + .with_stderr( + "\ +[UPDATING] `[..]` index +[DOWNLOADING] crates ... +[DOWNLOADED] pub_dep v0.1.0 ([..]) +[COMPILING] pub_dep v0.1.0 +[COMPILING] foo v0.0.1 ([CWD]) +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] +", + ) + .run() +} + +#[test] +pub fn requires_nightly_cargo() { + let p = project() + .file( + "Cargo.toml", + r#" + cargo-features = ["public-dependency"] + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("build --message-format=short") + .with_status(101) + .with_stderr( + "\ +error: failed to parse manifest at `[..]` + +Caused by: + the cargo feature `public-dependency` requires a nightly version of Cargo, but this is the `stable` channel +See https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels. +" + ) + .run() +} + +#[test] +fn requires_feature() { + Package::new("pub_dep", "0.1.0") + .file("src/lib.rs", "") + .publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + + [package] + name = "foo" + version = "0.0.1" + + [dependencies] + pub_dep = { version = "0.1.0", public = true } + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("build --message-format=short") + .masquerade_as_nightly_cargo() + .with_status(101) + .with_stderr( + "\ +error: failed to parse manifest at `[..]` + +Caused by: + feature `public-dependency` is required + +consider adding `cargo-features = [\"public-dependency\"]` to the manifest +", + ) + .run() +} + +#[test] +fn pub_dev_dependency() { + Package::new("pub_dep", "0.1.0") + .file("src/lib.rs", "pub struct FromPub;") + .publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + cargo-features = ["public-dependency"] + + [package] + name = "foo" + version = "0.0.1" + + [dev-dependencies] + pub_dep = {version = "0.1.0", public = true} + "#, + ) + .file( + "src/lib.rs", + " + extern crate pub_dep; + pub fn use_pub(_: pub_dep::FromPub) {} + ", + ) + .build(); + + p.cargo("build --message-format=short") + .masquerade_as_nightly_cargo() + .with_status(101) + .with_stderr( + "\ +error: failed to parse manifest at `[..]` + +Caused by: + 'public' specifier can only be used on regular dependencies, not Development dependencies +", + ) + .run() +} diff -Nru cargo-0.35.0/tests/testsuite/registry.rs cargo-0.37.0/tests/testsuite/registry.rs --- cargo-0.35.0/tests/testsuite/registry.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/registry.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,5 +1,6 @@ use std::fs::{self, File}; use std::io::prelude::*; +use std::path::Path; use crate::support::cargo_process; use crate::support::git; @@ -820,30 +821,6 @@ } #[test] -fn update_offline() { - let p = project() - .file( - "Cargo.toml", - r#" - [project] - name = "foo" - version = "0.0.1" - authors = [] - - [dependencies] - bar = "*" - "#, - ) - .file("src/main.rs", "fn main() {}") - .build(); - p.cargo("update -Zoffline") - .masquerade_as_nightly_cargo() - .with_status(101) - .with_stderr("error: you can't update in the offline mode[..]") - .run(); -} - -#[test] fn dev_dependency_not_used() { let p = project() .file( @@ -1977,3 +1954,77 @@ p.cargo("build --features bar/foo01").run(); p.cargo("build --features bar/another").run(); } + +#[test] +fn ignore_invalid_json_lines() { + Package::new("foo", "0.1.0").publish(); + Package::new("foo", "0.1.1").invalid_json(true).publish(); + Package::new("foo", "0.2.0").publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + [project] + name = "a" + version = "0.5.0" + authors = [] + + [dependencies] + foo = '0.1.0' + foo02 = { version = '0.2.0', package = 'foo' } + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("build").run(); +} + +#[test] +fn readonly_registry_still_works() { + Package::new("foo", "0.1.0").publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + [project] + name = "a" + version = "0.5.0" + authors = [] + + [dependencies] + foo = '0.1.0' + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("generate-lockfile").run(); + p.cargo("fetch --locked").run(); + chmod_readonly(&paths::home(), true); + p.cargo("build").run(); + // make sure we un-readonly the files afterwards so "cargo clean" can remove them (#6934) + chmod_readonly(&paths::home(), false); + + + fn chmod_readonly(path: &Path, readonly: bool) { + for entry in t!(path.read_dir()) { + let entry = t!(entry); + let path = entry.path(); + if t!(entry.file_type()).is_dir() { + chmod_readonly(&path, readonly); + } else { + set_readonly(&path, readonly); + } + } + set_readonly(path, readonly); + } + + fn set_readonly(path: &Path, readonly: bool) { + let mut perms = t!(path.metadata()).permissions(); + perms.set_readonly(readonly); + t!(fs::set_permissions(path, perms)); + } +} diff -Nru cargo-0.35.0/tests/testsuite/rename_deps.rs cargo-0.37.0/tests/testsuite/rename_deps.rs --- cargo-0.35.0/tests/testsuite/rename_deps.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/rename_deps.rs 2019-05-15 19:48:47.000000000 +0000 @@ -85,7 +85,6 @@ "Cargo.toml", &format!( r#" - cargo-features = ["alternative-registries"] [package] name = "test" version = "0.1.0" @@ -123,7 +122,7 @@ .file("foo/src/lib.rs", "pub fn foo4() {}") .build(); - p.cargo("build -v").masquerade_as_nightly_cargo().run(); + p.cargo("build -v").run(); } #[test] diff -Nru cargo-0.35.0/tests/testsuite/resolve.rs cargo-0.37.0/tests/testsuite/resolve.rs --- cargo-0.35.0/tests/testsuite/resolve.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/resolve.rs 2019-05-15 19:48:47.000000000 +0000 @@ -7,12 +7,12 @@ use crate::support::project; use crate::support::registry::Package; use crate::support::resolver::{ - assert_contains, assert_same, dep, dep_kind, dep_loc, dep_req, loc_names, names, pkg, pkg_dep, - pkg_id, pkg_loc, registry, registry_strategy, remove_dep, resolve, resolve_and_validated, - resolve_with_config, PrettyPrintRegistry, ToDep, ToPkgId, + assert_contains, assert_same, dep, dep_kind, dep_loc, dep_req, dep_req_kind, loc_names, names, + pkg, pkg_dep, pkg_id, pkg_loc, registry, registry_strategy, remove_dep, resolve, + resolve_and_validated, resolve_with_config, PrettyPrintRegistry, ToDep, ToPkgId, }; -use proptest::{prelude::*, *}; +use proptest::prelude::*; // NOTE: proptest is a form of fuzz testing. It generates random input and makes sure that // certain universal truths are upheld. Therefore, it can pass when there is a problem, @@ -37,7 +37,7 @@ /// NOTE: if you think this test has failed spuriously see the note at the top of this macro. #[test] - fn passes_validation( + fn prop_passes_validation( PrettyPrintRegistry(input) in registry_strategy(50, 20, 60) ) { let reg = registry(input.clone()); @@ -46,7 +46,7 @@ // So we try some of the most complicated. for this in input.iter().rev().take(20) { let _ = resolve_and_validated( - &pkg_id("root"), + pkg_id("root"), vec![dep_req(&this.name(), &format!("={}", this.version()))], ®, ); @@ -55,7 +55,7 @@ /// NOTE: if you think this test has failed spuriously see the note at the top of this macro. #[test] - fn minimum_version_errors_the_same( + fn prop_minimum_version_errors_the_same( PrettyPrintRegistry(input) in registry_strategy(50, 20, 60) ) { enable_nightly_features(); @@ -68,6 +68,7 @@ &None, false, false, + false, &None, &["minimal-versions".to_string()], ) @@ -81,13 +82,13 @@ // minimal-versions change what order the candidates // are tried but not the existence of a solution let res = resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep_req(&this.name(), &format!("={}", this.version()))], ®, ); let mres = resolve_with_config( - &pkg_id("root"), + pkg_id("root"), vec![dep_req(&this.name(), &format!("={}", this.version()))], ®, Some(&config), @@ -105,19 +106,19 @@ /// NOTE: if you think this test has failed spuriously see the note at the top of this macro. #[test] - fn removing_a_dep_cant_break( + fn prop_removing_a_dep_cant_break( PrettyPrintRegistry(input) in registry_strategy(50, 20, 60), - indexes_to_remove in collection::vec((any::(), any::()), ..10) + indexes_to_remove in prop::collection::vec((any::(), any::()), ..10) ) { let reg = registry(input.clone()); let mut removed_input = input.clone(); - for (summery_idx, dep_idx) in indexes_to_remove { - if removed_input.len() > 0 { - let summery_idx = summery_idx.index(removed_input.len()); - let deps = removed_input[summery_idx].dependencies(); - if deps.len() > 0 { - let new = remove_dep(&removed_input[summery_idx], dep_idx.index(deps.len())); - removed_input[summery_idx] = new; + for (summary_idx, dep_idx) in indexes_to_remove { + if !removed_input.is_empty() { + let summary_idx = summary_idx.index(removed_input.len()); + let deps = removed_input[summary_idx].dependencies(); + if !deps.is_empty() { + let new = remove_dep(&removed_input[summary_idx], dep_idx.index(deps.len())); + removed_input[summary_idx] = new; } } } @@ -127,13 +128,13 @@ // So we try some of the most complicated. for this in input.iter().rev().take(10) { if resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep_req(&this.name(), &format!("={}", this.version()))], ®, ).is_ok() { prop_assert!( resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep_req(&this.name(), &format!("={}", this.version()))], &removed_reg, ).is_ok(), @@ -147,9 +148,9 @@ /// NOTE: if you think this test has failed spuriously see the note at the top of this macro. #[test] - fn limited_independence_of_irrelevant_alternatives( + fn prop_limited_independence_of_irrelevant_alternatives( PrettyPrintRegistry(input) in registry_strategy(50, 20, 60), - indexes_to_unpublish in collection::vec(any::(), ..10) + indexes_to_unpublish in prop::collection::vec(any::(), ..10) ) { let reg = registry(input.clone()); // there is only a small chance that any one @@ -157,7 +158,7 @@ // So we try some of the most complicated. for this in input.iter().rev().take(10) { let res = resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep_req(&this.name(), &format!("={}", this.version()))], ®, ); @@ -183,7 +184,7 @@ ); let res = resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep_req(&this.name(), &format!("={}", this.version()))], &new_reg, ); @@ -217,7 +218,7 @@ ); let res = resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep_req(&this.name(), &format!("={}", this.version()))], &new_reg, ); @@ -236,6 +237,136 @@ } #[test] +fn basic_public_dependency() { + let reg = registry(vec![ + pkg!(("A", "0.1.0")), + pkg!(("A", "0.2.0")), + pkg!("B" => [dep_req_kind("A", "0.1", Kind::Normal, true)]), + pkg!("C" => [dep("A"), dep("B")]), + ]); + + let res = resolve_and_validated(pkg_id("root"), vec![dep("C")], ®).unwrap(); + assert_same( + &res, + &names(&[ + ("root", "1.0.0"), + ("C", "1.0.0"), + ("B", "1.0.0"), + ("A", "0.1.0"), + ]), + ); +} + +#[test] +fn public_dependency_filling_in() { + // The resolver has an optimization where if a candidate to resolve a dependency + // has already bean activated then we skip looking at the candidates dependencies. + // However, we have to be careful as the new path may make pub dependencies invalid. + + // Triggering this case requires dependencies to be resolved in a specific order. + // Fuzzing found this unintuitive case, that triggers this unfortunate order of operations: + // 1. `d`'s dep on `c` is resolved + // 2. `d`'s dep on `a` is resolved with `0.1.1` + // 3. `c`'s dep on `b` is resolved with `0.0.2` + // 4. `b`'s dep on `a` is resolved with `0.0.6` no pub dev conflict as `b` is private to `c` + // 5. `d`'s dep on `b` is resolved with `0.0.2` triggering the optimization. + // Do we notice that `d` has a pub dep conflict on `a`? Lets try it and see. + let reg = registry(vec![ + pkg!(("a", "0.0.6")), + pkg!(("a", "0.1.1")), + pkg!(("b", "0.0.0") => [dep("bad")]), + pkg!(("b", "0.0.1") => [dep("bad")]), + pkg!(("b", "0.0.2") => [dep_req_kind("a", "=0.0.6", Kind::Normal, true)]), + pkg!("c" => [dep_req("b", ">=0.0.1")]), + pkg!("d" => [dep("c"), dep("a"), dep("b")]), + ]); + + let res = resolve_and_validated(pkg_id("root"), vec![dep("d")], ®).unwrap(); + assert_same( + &res, + &names(&[ + ("root", "1.0.0"), + ("d", "1.0.0"), + ("c", "1.0.0"), + ("b", "0.0.2"), + ("a", "0.0.6"), + ]), + ); +} + +#[test] +fn public_dependency_filling_in_and_update() { + // The resolver has an optimization where if a candidate to resolve a dependency + // has already bean activated then we skip looking at the candidates dependencies. + // However, we have to be careful as the new path may make pub dependencies invalid. + + // Triggering this case requires dependencies to be resolved in a specific order. + // Fuzzing found this unintuitive case, that triggers this unfortunate order of operations: + // 1. `D`'s dep on `B` is resolved + // 2. `D`'s dep on `C` is resolved + // 3. `B`'s dep on `A` is resolved with `0.0.0` + // 4. `C`'s dep on `B` triggering the optimization. + // So did we add `A 0.0.0` to the deps `C` can see? + // Or are we going to resolve `C`'s dep on `A` with `0.0.2`? + // Lets try it and see. + let reg = registry(vec![ + pkg!(("A", "0.0.0")), + pkg!(("A", "0.0.2")), + pkg!("B" => [dep_req_kind("A", "=0.0.0", Kind::Normal, true),]), + pkg!("C" => [dep("A"),dep("B")]), + pkg!("D" => [dep("B"),dep("C")]), + ]); + let res = resolve_and_validated(pkg_id("root"), vec![dep("D")], ®).unwrap(); + assert_same( + &res, + &names(&[ + ("root", "1.0.0"), + ("D", "1.0.0"), + ("C", "1.0.0"), + ("B", "1.0.0"), + ("A", "0.0.0"), + ]), + ); +} + +#[test] +fn public_dependency_skipping() { + // When backtracking due to a failed dependency, if Cargo is + // trying to be clever and skip irrelevant dependencies, care must + // the effects of pub dep must be accounted for. + let input = vec![ + pkg!(("a", "0.2.0")), + pkg!(("a", "2.0.0")), + pkg!(("b", "0.0.0") => [dep("bad")]), + pkg!(("b", "0.2.1") => [dep_req_kind("a", "0.2.0", Kind::Normal, true)]), + pkg!("c" => [dep("a"),dep("b")]), + ]; + let reg = registry(input); + + resolve(pkg_id("root"), vec![dep("c")], ®).unwrap(); +} + +#[test] +fn public_dependency_skipping_in_backtracking() { + // When backtracking due to a failed dependency, if Cargo is + // trying to be clever and skip irrelevant dependencies, care must + // the effects of pub dep must be accounted for. + let input = vec![ + pkg!(("A", "0.0.0") => [dep("bad")]), + pkg!(("A", "0.0.1") => [dep("bad")]), + pkg!(("A", "0.0.2") => [dep("bad")]), + pkg!(("A", "0.0.3") => [dep("bad")]), + pkg!(("A", "0.0.4")), + pkg!(("A", "0.0.5")), + pkg!("B" => [dep_req_kind("A", ">= 0.0.3", Kind::Normal, true)]), + pkg!("C" => [dep_req("A", "<= 0.0.4"), dep("B")]), + ]; + let reg = registry(input); + + resolve(pkg_id("root"), vec![dep("C")], ®).unwrap(); +} + +#[test] #[should_panic(expected = "assertion failed: !name.is_empty()")] fn test_dependency_with_empty_name() { // Bug 5229, dependency-names must not be empty @@ -244,7 +375,7 @@ #[test] fn test_resolving_empty_dependency_list() { - let res = resolve(&pkg_id("root"), Vec::new(), ®istry(vec![])).unwrap(); + let res = resolve(pkg_id("root"), Vec::new(), ®istry(vec![])).unwrap(); assert_eq!(res, names(&["root"])); } @@ -252,28 +383,28 @@ #[test] fn test_resolving_only_package() { let reg = registry(vec![pkg!("foo")]); - let res = resolve(&pkg_id("root"), vec![dep("foo")], ®).unwrap(); + let res = resolve(pkg_id("root"), vec![dep("foo")], ®).unwrap(); assert_same(&res, &names(&["root", "foo"])); } #[test] fn test_resolving_one_dep() { let reg = registry(vec![pkg!("foo"), pkg!("bar")]); - let res = resolve(&pkg_id("root"), vec![dep("foo")], ®).unwrap(); + let res = resolve(pkg_id("root"), vec![dep("foo")], ®).unwrap(); assert_same(&res, &names(&["root", "foo"])); } #[test] fn test_resolving_multiple_deps() { let reg = registry(vec![pkg!("foo"), pkg!("bar"), pkg!("baz")]); - let res = resolve(&pkg_id("root"), vec![dep("foo"), dep("baz")], ®).unwrap(); + let res = resolve(pkg_id("root"), vec![dep("foo"), dep("baz")], ®).unwrap(); assert_same(&res, &names(&["root", "foo", "baz"])); } #[test] fn test_resolving_transitive_deps() { let reg = registry(vec![pkg!("foo"), pkg!("bar" => ["foo"])]); - let res = resolve(&pkg_id("root"), vec![dep("bar")], ®).unwrap(); + let res = resolve(pkg_id("root"), vec![dep("bar")], ®).unwrap(); assert_same(&res, &names(&["root", "foo", "bar"])); } @@ -281,7 +412,7 @@ #[test] fn test_resolving_common_transitive_deps() { let reg = registry(vec![pkg!("foo" => ["bar"]), pkg!("bar")]); - let res = resolve(&pkg_id("root"), vec![dep("foo"), dep("bar")], ®).unwrap(); + let res = resolve(pkg_id("root"), vec![dep("foo"), dep("bar")], ®).unwrap(); assert_same(&res, &names(&["root", "foo", "bar"])); } @@ -289,24 +420,24 @@ #[test] fn test_resolving_with_same_name() { let list = vec![ - pkg_loc("foo", "http://first.example.com"), - pkg_loc("bar", "http://second.example.com"), + pkg_loc("foo", "https://first.example.com"), + pkg_loc("bar", "https://second.example.com"), ]; let reg = registry(list); let res = resolve( - &pkg_id("root"), + pkg_id("root"), vec![ - dep_loc("foo", "http://first.example.com"), - dep_loc("bar", "http://second.example.com"), + dep_loc("foo", "https://first.example.com"), + dep_loc("bar", "https://second.example.com"), ], ®, ) .unwrap(); let mut names = loc_names(&[ - ("foo", "http://first.example.com"), - ("bar", "http://second.example.com"), + ("foo", "https://first.example.com"), + ("bar", "https://second.example.com"), ]); names.push(pkg_id("root")); @@ -323,7 +454,7 @@ ]); let res = resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep("foo"), dep_kind("baz", Kind::Development)], ®, ) @@ -336,7 +467,7 @@ fn resolving_with_many_versions() { let reg = registry(vec![pkg!(("foo", "1.0.1")), pkg!(("foo", "1.0.2"))]); - let res = resolve(&pkg_id("root"), vec![dep("foo")], ®).unwrap(); + let res = resolve(pkg_id("root"), vec![dep("foo")], ®).unwrap(); assert_same(&res, &names(&[("root", "1.0.0"), ("foo", "1.0.2")])); } @@ -345,7 +476,7 @@ fn resolving_with_specific_version() { let reg = registry(vec![pkg!(("foo", "1.0.1")), pkg!(("foo", "1.0.2"))]); - let res = resolve(&pkg_id("root"), vec![dep_req("foo", "=1.0.1")], ®).unwrap(); + let res = resolve(pkg_id("root"), vec![dep_req("foo", "=1.0.1")], ®).unwrap(); assert_same(&res, &names(&[("root", "1.0.0"), ("foo", "1.0.1")])); } @@ -361,7 +492,7 @@ ]); let res = resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep_req("foo", "1.0.0"), dep_req("bar", "1.0.0")], ®, ) @@ -403,13 +534,14 @@ &None, false, false, + false, &None, &["minimal-versions".to_string()], ) .unwrap(); let res = resolve_with_config( - &pkg_id("root"), + pkg_id("root"), vec![dep_req("foo", "1.0.0"), dep_req("bar", "1.0.0")], ®, Some(&config), @@ -470,7 +602,7 @@ ]); assert!(resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep_req("foo", "=1.0.1"), dep("bar")], ® ) @@ -485,7 +617,7 @@ // This test documents the current behavior. let reg = registry(vec![pkg!(("foo", "1.0.0")), pkg!("bar" => ["Foo"])]); - assert!(resolve(&pkg_id("root"), vec![dep("bar")], ®).is_err()); + assert!(resolve(pkg_id("root"), vec![dep("bar")], ®).is_err()); } #[test] @@ -496,7 +628,7 @@ // This test documents the current behavior. let reg = registry(vec![pkg!(("fo-o", "1.0.0")), pkg!("bar" => ["fo_o"])]); - assert!(resolve(&pkg_id("root"), vec![dep("bar")], ®).is_err()); + assert!(resolve(pkg_id("root"), vec![dep("bar")], ®).is_err()); } #[test] @@ -508,7 +640,7 @@ pkg!("baz"), ]); - let res = resolve(&pkg_id("root"), vec![dep_req("foo", "^1")], ®).unwrap(); + let res = resolve(pkg_id("root"), vec![dep_req("foo", "^1")], ®).unwrap(); assert_contains( &res, @@ -528,7 +660,7 @@ pkg!("bar"), ]); - let res = resolve(&pkg_id("root"), vec![dep_req("foo", "^1")], ®).unwrap(); + let res = resolve(pkg_id("root"), vec![dep_req("foo", "^1")], ®).unwrap(); assert_contains( &res, @@ -550,7 +682,7 @@ pkg!("d4" => [dep_req("foo", "0.2")]), ]); - let res = resolve(&pkg_id("root"), vec![dep("bar")], ®).unwrap(); + let res = resolve(pkg_id("root"), vec![dep("bar")], ®).unwrap(); assert_same( &res, @@ -583,7 +715,7 @@ pkg!(("dep_req", "2.0.0")), ]); - let res = resolve(&pkg_id("root"), vec![dep_req("foo", "1")], ®).unwrap(); + let res = resolve(pkg_id("root"), vec![dep_req("foo", "1")], ®).unwrap(); assert_same( &res, @@ -611,7 +743,7 @@ ]); let res = resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep_req("d", "1"), dep_req("r", "1")], ®, ) @@ -664,7 +796,7 @@ } let reg = registry(reglist); - let res = resolve(&pkg_id("root"), vec![dep_req("foo", "1")], ®).unwrap(); + let res = resolve(pkg_id("root"), vec![dep_req("foo", "1")], ®).unwrap(); assert_contains( &res, @@ -699,7 +831,7 @@ let reg = registry(reglist.clone()); - let res = resolve(&pkg_id("root"), vec![dep("level0")], ®); + let res = resolve(pkg_id("root"), vec![dep("level0")], ®); assert!(res.is_err()); @@ -709,7 +841,7 @@ let reg = registry(reglist.clone()); - let res = resolve(&pkg_id("root"), vec![dep("level0")], ®).unwrap(); + let res = resolve(pkg_id("root"), vec![dep("level0")], ®).unwrap(); assert_contains(&res, &names(&[("root", "1.0.0"), ("level0", "1.0.0")])); @@ -723,7 +855,7 @@ let reg = registry(reglist.clone()); let res = resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep("level0"), dep("constrained")], ®, ) @@ -741,7 +873,7 @@ let reg = registry(reglist.clone()); let res = resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep_req("level0", "1.0.1"), dep("constrained")], ®, ) @@ -756,10 +888,10 @@ ]), ); - let reg = registry(reglist.clone()); + let reg = registry(reglist); let res = resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep_req("level0", "1.0.1"), dep_req("constrained", "1.1.0")], ®, ); @@ -799,10 +931,10 @@ } } - let reg = registry(reglist.clone()); + let reg = registry(reglist); let res = resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep("backtrack_trap0"), dep("cloaking")], ®, ); @@ -854,7 +986,7 @@ // but `constrained= "2.0.1"` is already picked. // Only then to try and solve `constrained= "~1.0.0"` which is incompatible. let res = resolve( - &pkg_id("root"), + pkg_id("root"), vec![ dep("backtrack_trap0"), dep_req("constrained", "2.0.1"), @@ -881,10 +1013,10 @@ ]), ); - let reg = registry(reglist.clone()); + let reg = registry(reglist); let res = resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep("level0"), dep_req("constrained", "2.0.1")], ®, ); @@ -892,7 +1024,7 @@ assert!(res.is_err()); let res = resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep("level0"), dep_req("constrained", "2.0.0")], ®, ) @@ -936,7 +1068,7 @@ } let reg = registry(reglist); - let res = resolve(&pkg_id("root"), vec![dep_req("foo", "1")], ®).unwrap(); + let res = resolve(pkg_id("root"), vec![dep_req("foo", "1")], ®).unwrap(); assert_contains( &res, @@ -982,7 +1114,7 @@ pkg!(("D", "1.0.105")), ]); - let res = resolve(&pkg_id("root"), vec![dep_req("A", "1")], ®).unwrap(); + let res = resolve(pkg_id("root"), vec![dep_req("A", "1")], ®).unwrap(); assert_same( &res, @@ -997,11 +1129,11 @@ } #[test] -fn incomplete_information_skiping() { +fn incomplete_information_skipping() { // When backtracking due to a failed dependency, if Cargo is // trying to be clever and skip irrelevant dependencies, care must // be taken to not miss the transitive effects of alternatives. - // Fuzzing discovered that for some reason cargo was skiping based + // Fuzzing discovered that for some reason cargo was skipping based // on incomplete information in the following case: // minimized bug found in: // https://github.com/rust-lang/cargo/commit/003c29b0c71e5ea28fbe8e72c148c755c9f3f8d9 @@ -1028,7 +1160,7 @@ ]; let reg = registry(input.clone()); - let res = resolve(&pkg_id("root"), vec![dep("g")], ®).unwrap(); + let res = resolve(pkg_id("root"), vec![dep("g")], ®).unwrap(); let package_to_yank = "to_yank".to_pkgid(); // this package is not used in the resolution. assert!(!res.contains(&package_to_yank)); @@ -1042,15 +1174,15 @@ ); assert_eq!(input.len(), new_reg.len() + 1); // it should still build - assert!(resolve(&pkg_id("root"), vec![dep("g")], &new_reg).is_ok()); + assert!(resolve(pkg_id("root"), vec![dep("g")], &new_reg).is_ok()); } #[test] -fn incomplete_information_skiping_2() { +fn incomplete_information_skipping_2() { // When backtracking due to a failed dependency, if Cargo is // trying to be clever and skip irrelevant dependencies, care must // be taken to not miss the transitive effects of alternatives. - // Fuzzing discovered that for some reason cargo was skiping based + // Fuzzing discovered that for some reason cargo was skipping based // on incomplete information in the following case: // https://github.com/rust-lang/cargo/commit/003c29b0c71e5ea28fbe8e72c148c755c9f3f8d9 let input = vec![ @@ -1097,7 +1229,7 @@ ]; let reg = registry(input.clone()); - let res = resolve(&pkg_id("root"), vec![dep("i")], ®).unwrap(); + let res = resolve(pkg_id("root"), vec![dep("i")], ®).unwrap(); let package_to_yank = ("to_yank", "8.8.1").to_pkgid(); // this package is not used in the resolution. assert!(!res.contains(&package_to_yank)); @@ -1111,15 +1243,15 @@ ); assert_eq!(input.len(), new_reg.len() + 1); // it should still build - assert!(resolve(&pkg_id("root"), vec![dep("i")], &new_reg).is_ok()); + assert!(resolve(pkg_id("root"), vec![dep("i")], &new_reg).is_ok()); } #[test] -fn incomplete_information_skiping_3() { +fn incomplete_information_skipping_3() { // When backtracking due to a failed dependency, if Cargo is // trying to be clever and skip irrelevant dependencies, care must // be taken to not miss the transitive effects of alternatives. - // Fuzzing discovered that for some reason cargo was skiping based + // Fuzzing discovered that for some reason cargo was skipping based // on incomplete information in the following case: // minimized bug found in: // https://github.com/rust-lang/cargo/commit/003c29b0c71e5ea28fbe8e72c148c755c9f3f8d9 @@ -1147,7 +1279,7 @@ ]; let reg = registry(input.clone()); - let res = resolve(&pkg_id("root"), vec![dep("b")], ®).unwrap(); + let res = resolve(pkg_id("root"), vec![dep("b")], ®).unwrap(); let package_to_yank = ("to_yank", "3.0.3").to_pkgid(); // this package is not used in the resolution. assert!(!res.contains(&package_to_yank)); @@ -1161,22 +1293,22 @@ ); assert_eq!(input.len(), new_reg.len() + 1); // it should still build - assert!(resolve(&pkg_id("root"), vec![dep("b")], &new_reg).is_ok()); + assert!(resolve(pkg_id("root"), vec![dep("b")], &new_reg).is_ok()); } #[test] fn resolving_but_no_exists() { let reg = registry(vec![]); - let res = resolve(&pkg_id("root"), vec![dep_req("foo", "1")], ®); + let res = resolve(pkg_id("root"), vec![dep_req("foo", "1")], ®); assert!(res.is_err()); assert_eq!( res.err().unwrap().to_string(), "\ no matching package named `foo` found\n\ - location searched: registry `http://example.com/`\n\ - required by package `root v1.0.0 (registry `http://example.com/`)`\ + location searched: registry `https://example.com/`\n\ + required by package `root v1.0.0 (registry `https://example.com/`)`\ " ); } @@ -1185,7 +1317,7 @@ fn resolving_cycle() { let reg = registry(vec![pkg!("foo" => ["foo"])]); - let _ = resolve(&pkg_id("root"), vec![dep_req("foo", "1")], ®); + let _ = resolve(pkg_id("root"), vec![dep_req("foo", "1")], ®); } #[test] @@ -1197,7 +1329,7 @@ ]); let res = resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep_req("bar", "1"), dep_req("foo", "=1.0.0")], ®, ) @@ -1215,7 +1347,7 @@ pkg!(("last", "0.0.0") => [dep("bad")]), // just to make sure last is less constrained ]; let mut root_deps = vec![dep("last")]; - const NUM_VERSIONS: u8 = 3; + const NUM_VERSIONS: u8 = 20; for name in 0..=NUM_VERSIONS { // a large number of conflicts can easily be generated by a sys crate. let sys_name = format!("{}-sys", (b'a' + name) as char); @@ -1235,7 +1367,7 @@ } } let reg = registry(input); - let _ = resolve(&pkg_id("root"), root_deps, ®); + let _ = resolve(pkg_id("root"), root_deps, ®); } #[test] @@ -1274,6 +1406,34 @@ ]), ]; - let reg = registry(input.clone()); - let _ = resolve_and_validated(&pkg_id("root"), vec![dep("j")], ®); + let reg = registry(input); + let _ = resolve_and_validated(pkg_id("root"), vec![dep("j")], ®); +} + +#[test] +fn conflict_store_more_then_one_match() { + let input = vec![ + pkg!(("A", "0.0.0")), + pkg!(("A", "0.0.1")), + pkg!(("A-sys", "0.0.0")), + pkg!(("A-sys", "0.0.1")), + pkg!(("A-sys", "0.0.2")), + pkg!(("A-sys", "0.0.3")), + pkg!(("A-sys", "0.0.12")), + pkg!(("A-sys", "0.0.16")), + pkg!(("B-sys", "0.0.0")), + pkg!(("B-sys", "0.0.1")), + pkg!(("B-sys", "0.0.2") => [dep_req("A-sys", "= 0.0.12"),]), + pkg!(("BA-sys", "0.0.0") => [dep_req("A-sys","= 0.0.16"),]), + pkg!(("BA-sys", "0.0.1") => [dep("bad"),]), + pkg!(("BA-sys", "0.0.2") => [dep("bad"),]), + pkg!("nA" => [ + dep("A"), + dep_req("A-sys", "<= 0.0.3"), + dep("B-sys"), + dep("BA-sys"), + ]), + ]; + let reg = registry(input); + let _ = resolve_and_validated(pkg_id("root"), vec![dep("nA")], ®); } diff -Nru cargo-0.35.0/tests/testsuite/run.rs cargo-0.37.0/tests/testsuite/run.rs --- cargo-0.35.0/tests/testsuite/run.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/run.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,4 +1,3 @@ -use crate::support; use crate::support::{basic_bin_manifest, basic_lib_manifest, project, Project}; use cargo::util::paths::dylib_path_envvar; @@ -76,6 +75,32 @@ p.cargo("run hello world").run(); } +#[cfg(unix)] +#[test] +fn simple_with_non_utf8_args() { + use std::os::unix::ffi::OsStrExt; + + let p = project() + .file( + "src/main.rs", + r#" + use std::ffi::OsStr; + use std::os::unix::ffi::OsStrExt; + + fn main() { + assert_eq!(std::env::args_os().nth(1).unwrap(), OsStr::from_bytes(b"hello")); + assert_eq!(std::env::args_os().nth(2).unwrap(), OsStr::from_bytes(b"ab\xffcd")); + } + "#, + ) + .build(); + + p.cargo("run") + .arg("hello") + .arg(std::ffi::OsStr::from_bytes(b"ab\xFFcd")) + .run(); +} + #[test] fn exit_code() { let p = project() @@ -435,10 +460,6 @@ #[test] fn run_example_autodiscover_2015() { - if !support::is_nightly() { - return; - } - let p = autodiscover_examples_project("2015", None); p.cargo("run --example a") .with_status(101) @@ -467,10 +488,6 @@ #[test] fn run_example_autodiscover_2015_with_autoexamples_enabled() { - if !support::is_nightly() { - return; - } - let p = autodiscover_examples_project("2015", Some(true)); p.cargo("run --example a") .with_stderr( @@ -485,10 +502,6 @@ #[test] fn run_example_autodiscover_2015_with_autoexamples_disabled() { - if !support::is_nightly() { - return; - } - let p = autodiscover_examples_project("2015", Some(false)); p.cargo("run --example a") .with_status(101) @@ -498,10 +511,6 @@ #[test] fn run_example_autodiscover_2018() { - if !support::is_nightly() { - return; - } - let p = autodiscover_examples_project("2018", None); p.cargo("run --example a") .with_stderr( @@ -688,14 +697,14 @@ "\ [COMPILING] bar v0.5.0 ([CWD]/bar) [RUNNING] `rustc --crate-name bar bar/src/bar.rs --color never --crate-type lib \ - --emit=dep-info,link \ + --emit=[..]link \ -C opt-level=3 \ -C metadata=[..] \ --out-dir [CWD]/target/release/deps \ -L dependency=[CWD]/target/release/deps` [COMPILING] foo v0.0.1 ([CWD]) [RUNNING] `rustc --crate-name a examples/a.rs --color never --crate-type bin \ - --emit=dep-info,link \ + --emit=[..]link \ -C opt-level=3 \ -C metadata=[..] \ --out-dir [CWD]/target/release/examples \ @@ -717,14 +726,14 @@ "\ [COMPILING] bar v0.5.0 ([CWD]/bar) [RUNNING] `rustc --crate-name bar bar/src/bar.rs --color never --crate-type lib \ - --emit=dep-info,link \ + --emit=[..]link \ -C debuginfo=2 \ -C metadata=[..] \ --out-dir [CWD]/target/debug/deps \ -L dependency=[CWD]/target/debug/deps` [COMPILING] foo v0.0.1 ([CWD]) [RUNNING] `rustc --crate-name a examples/a.rs --color never --crate-type bin \ - --emit=dep-info,link \ + --emit=[..]link \ -C debuginfo=2 \ -C metadata=[..] \ --out-dir [CWD]/target/debug/examples \ @@ -1029,7 +1038,7 @@ let cargo = || { let mut process_builder = p.cargo("run"); - process_builder.cwd(p.root().join("foo")); + process_builder.cwd("foo"); process_builder }; @@ -1127,7 +1136,10 @@ .file("b/src/main.rs", r#"fn main() {println!("run-b");}"#) .build(); - p.cargo("run").masquerade_as_nightly_cargo().with_stdout("run-a").run(); + p.cargo("run") + .masquerade_as_nightly_cargo() + .with_stdout("run-a") + .run(); } #[test] @@ -1211,6 +1223,13 @@ ) .unwrap(); p.root().rm_rf(); - p2.cargo("run").run(); - p2.cargo("test").run(); + const VAR: &str = "DYLD_FALLBACK_LIBRARY_PATH"; + // Reset DYLD_FALLBACK_LIBRARY_PATH so that we don't inherit anything that + // was set by the cargo that invoked the test. + p2.cargo("run").env_remove(VAR).run(); + p2.cargo("test").env_remove(VAR).run(); + // Ensure this still works when DYLD_FALLBACK_LIBRARY_PATH has + // a value set. + p2.cargo("run").env(VAR, &libdir).run(); + p2.cargo("test").env(VAR, &libdir).run(); } diff -Nru cargo-0.35.0/tests/testsuite/rustc_info_cache.rs cargo-0.37.0/tests/testsuite/rustc_info_cache.rs --- cargo-0.35.0/tests/testsuite/rustc_info_cache.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/rustc_info_cache.rs 2019-05-15 19:48:47.000000000 +0000 @@ -13,7 +13,7 @@ let update = "[..]updated rustc info cache[..]"; p.cargo("build") - .env("RUST_LOG", "cargo::util::rustc=info") + .env("CARGO_LOG", "cargo::util::rustc=info") .with_stderr_contains("[..]failed to read rustc info cache[..]") .with_stderr_contains(miss) .with_stderr_does_not_contain(hit) @@ -21,7 +21,7 @@ .run(); p.cargo("build") - .env("RUST_LOG", "cargo::util::rustc=info") + .env("CARGO_LOG", "cargo::util::rustc=info") .with_stderr_contains("[..]reusing existing rustc info cache[..]") .with_stderr_contains(hit) .with_stderr_does_not_contain(miss) @@ -29,7 +29,7 @@ .run(); p.cargo("build") - .env("RUST_LOG", "cargo::util::rustc=info") + .env("CARGO_LOG", "cargo::util::rustc=info") .env("CARGO_CACHE_RUSTC_INFO", "0") .with_stderr_contains("[..]rustc info cache disabled[..]") .with_stderr_does_not_contain(update) @@ -63,7 +63,7 @@ }; p.cargo("build") - .env("RUST_LOG", "cargo::util::rustc=info") + .env("CARGO_LOG", "cargo::util::rustc=info") .env("RUSTC", other_rustc.display().to_string()) .with_stderr_contains("[..]different compiler, creating new rustc info cache[..]") .with_stderr_contains(miss) @@ -72,7 +72,7 @@ .run(); p.cargo("build") - .env("RUST_LOG", "cargo::util::rustc=info") + .env("CARGO_LOG", "cargo::util::rustc=info") .env("RUSTC", other_rustc.display().to_string()) .with_stderr_contains("[..]reusing existing rustc info cache[..]") .with_stderr_contains(hit) @@ -83,7 +83,7 @@ other_rustc.move_into_the_future(); p.cargo("build") - .env("RUST_LOG", "cargo::util::rustc=info") + .env("CARGO_LOG", "cargo::util::rustc=info") .env("RUSTC", other_rustc.display().to_string()) .with_stderr_contains("[..]different compiler, creating new rustc info cache[..]") .with_stderr_contains(miss) @@ -92,7 +92,7 @@ .run(); p.cargo("build") - .env("RUST_LOG", "cargo::util::rustc=info") + .env("CARGO_LOG", "cargo::util::rustc=info") .env("RUSTC", other_rustc.display().to_string()) .with_stderr_contains("[..]reusing existing rustc info cache[..]") .with_stderr_contains(hit) diff -Nru cargo-0.35.0/tests/testsuite/rustc.rs cargo-0.37.0/tests/testsuite/rustc.rs --- cargo-0.35.0/tests/testsuite/rustc.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/rustc.rs 2019-05-15 19:48:47.000000000 +0000 @@ -16,7 +16,7 @@ "\ [COMPILING] foo v0.0.1 ([CWD]) [RUNNING] `rustc --crate-name foo src/lib.rs --color never --crate-type lib \ - --emit=dep-info,link -C debuginfo=2 \ + --emit=[..]link -C debuginfo=2 \ -C metadata=[..] \ --out-dir [..] \ -L dependency=[CWD]/target/debug/deps` @@ -38,7 +38,7 @@ "\ [COMPILING] foo v0.0.1 ([CWD]) [RUNNING] `rustc --crate-name foo src/lib.rs --color never --crate-type lib \ - --emit=dep-info,link -C debuginfo=2 \ + --emit=[..]link -C debuginfo=2 \ -C debug-assertions=off \ -C metadata=[..] \ --out-dir [..] \ @@ -61,12 +61,12 @@ "\ [COMPILING] {name} v{version} ([CWD]) [RUNNING] `rustc --crate-name {name} src/lib.rs --color never --crate-type lib \ - --emit=dep-info,link -C debuginfo=2 \ + --emit=[..]link -C debuginfo=2 \ -C metadata=[..] \ --out-dir [..] \ -L dependency=[CWD]/target/debug/deps` [RUNNING] `rustc --crate-name {name} src/main.rs --color never --crate-type bin \ - --emit=dep-info,link -C debuginfo=2 \ + --emit=[..]link -C debuginfo=2 \ -C debug-assertions \ -C metadata=[..] \ --out-dir [..] \ @@ -106,10 +106,10 @@ .with_stderr( "\ [COMPILING] foo v0.0.1 ([CWD]) -[RUNNING] `rustc --crate-name foo src/lib.rs --color never --crate-type lib --emit=dep-info,link \ +[RUNNING] `rustc --crate-name foo src/lib.rs --color never --crate-type lib --emit=[..]link \ -C debuginfo=2 -C metadata=[..] \ --out-dir [..]` -[RUNNING] `rustc --crate-name bar src/bin/bar.rs --color never --crate-type bin --emit=dep-info,link \ +[RUNNING] `rustc --crate-name bar src/bin/bar.rs --color never --crate-type bin --emit=[..]link \ -C debuginfo=2 -C debug-assertions [..]` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", @@ -144,10 +144,10 @@ .with_stderr( "\ [COMPILING] foo v0.0.1 ([CWD]) -[RUNNING] `rustc --crate-name foo src/lib.rs --color never --crate-type lib --emit=dep-info,link \ +[RUNNING] `rustc --crate-name foo src/lib.rs --color never --crate-type lib --emit=[..]link \ -C debuginfo=2 -C metadata=[..] \ --out-dir [..]` -[RUNNING] `rustc --crate-name bar tests/bar.rs --color never --emit=dep-info,link -C debuginfo=2 \ +[RUNNING] `rustc --crate-name bar tests/bar.rs --color never --emit=[..]link -C debuginfo=2 \ -C debug-assertions [..]--test[..]` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", @@ -233,18 +233,18 @@ .with_stderr_contains( "\ [RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \ - --emit=dep-info,link[..]", + --emit=[..]link[..]", ) // bench .with_stderr_does_not_contain( "\ - [RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=dep-info,link \ + [RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \ -C opt-level=3 --test [..]", ) // unit test .with_stderr_does_not_contain( "\ - [RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=dep-info,link \ + [RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \ -C debuginfo=2 --test [..]", ) .run(); @@ -258,12 +258,12 @@ .with_stderr_contains( "\ [RUNNING] `rustc --crate-name foo src/main.rs --color never --crate-type bin \ - --emit=dep-info,link[..]", + --emit=[..]link[..]", ) // unit test .with_stderr_contains( "\ - [RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=dep-info,link \ + [RUNNING] `rustc --crate-name foo src/main.rs --color never --emit=[..]link \ -C debuginfo=2 --test [..]", ) .run(); diff -Nru cargo-0.35.0/tests/testsuite/rustdocflags.rs cargo-0.37.0/tests/testsuite/rustdocflags.rs --- cargo-0.35.0/tests/testsuite/rustdocflags.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/rustdocflags.rs 2019-05-15 19:48:47.000000000 +0000 @@ -85,3 +85,13 @@ .env("RUSTDOCFLAGS", "--markdown-no-toc") .run(); } + +#[test] +fn rustdocflags_misspelled() { + let p = project().file("src/main.rs", "fn main() { }").build(); + + p.cargo("doc") + .env("RUSTDOC_FLAGS", "foo") + .with_stderr_contains("[WARNING] Cargo does not read `RUSTDOC_FLAGS` environment variable. Did you mean `RUSTDOCFLAGS`?") + .run(); +} diff -Nru cargo-0.35.0/tests/testsuite/rustflags.rs cargo-0.37.0/tests/testsuite/rustflags.rs --- cargo-0.35.0/tests/testsuite/rustflags.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/rustflags.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1325,3 +1325,37 @@ p1.cargo("run").run(); p1.cargo("build").with_stderr("[FINISHED] [..]").run(); } + +#[test] +fn env_rustflags_misspelled() { + let p = project().file("src/main.rs", "fn main() { }").build(); + + for cmd in &["check", "build", "run", "test", "bench"] { + p.cargo(cmd) + .env("RUST_FLAGS", "foo") + .with_stderr_contains("[WARNING] Cargo does not read `RUST_FLAGS` environment variable. Did you mean `RUSTFLAGS`?") + .run(); + } +} + +#[test] +fn env_rustflags_misspelled_build_script() { + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.0.1" + build = "build.rs" + "#, + ) + .file("src/lib.rs", "") + .file("build.rs", "fn main() { }") + .build(); + + p.cargo("build") + .env("RUST_FLAGS", "foo") + .with_stderr_contains("[WARNING] Cargo does not read `RUST_FLAGS` environment variable. Did you mean `RUSTFLAGS`?") + .run(); +} diff -Nru cargo-0.35.0/tests/testsuite/search.rs cargo-0.37.0/tests/testsuite/search.rs --- cargo-0.35.0/tests/testsuite/search.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/search.rs 2019-05-15 19:48:47.000000000 +0000 @@ -108,15 +108,15 @@ let sid = SourceId::for_registry(®istry_url()).unwrap(); let cfg = Config::new(Shell::new(), paths::root(), paths::home().join(".cargo")); + let lock = cfg.acquire_package_cache_lock().unwrap(); let mut regsrc = RegistrySource::remote(sid, &HashSet::new(), &cfg); regsrc.update().unwrap(); + drop(lock); cargo_process("search postgres") - .with_stdout_contains( - "hoare = \"0.1.1\" # Design by contract style assertions for Rust", - ) - .with_stderr("") // without "Updating ... index" - .run(); + .with_stdout_contains("hoare = \"0.1.1\" # Design by contract style assertions for Rust") + .with_stderr("") // without "Updating ... index" + .run(); } #[test] diff -Nru cargo-0.35.0/tests/testsuite/small_fd_limits.rs cargo-0.37.0/tests/testsuite/small_fd_limits.rs --- cargo-0.35.0/tests/testsuite/small_fd_limits.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/small_fd_limits.rs 2019-05-15 19:48:47.000000000 +0000 @@ -73,7 +73,7 @@ if let Some(path) = path_env { cmd.env("PATH", path); } - cmd.env("RUST_LOG", "trace"); + cmd.env("CARGO_LOG", "trace"); cmd.run(); let after = find_index() .join(".git/objects/pack") diff -Nru cargo-0.35.0/tests/testsuite/support/install.rs cargo-0.37.0/tests/testsuite/support/install.rs --- cargo-0.35.0/tests/testsuite/support/install.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/support/install.rs 2019-05-15 19:48:47.000000000 +0000 @@ -1,3 +1,4 @@ +use std::env::consts::EXE_SUFFIX; use std::path::{Path, PathBuf}; use crate::support::paths; @@ -23,9 +24,5 @@ } pub fn exe(name: &str) -> String { - if cfg!(windows) { - format!("{}.exe", name) - } else { - name.to_string() - } + format!("{}{}", name, EXE_SUFFIX) } diff -Nru cargo-0.35.0/tests/testsuite/support/mod.rs cargo-0.37.0/tests/testsuite/support/mod.rs --- cargo-0.35.0/tests/testsuite/support/mod.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/support/mod.rs 2019-05-15 19:48:47.000000000 +0000 @@ -60,6 +60,7 @@ ``` if !is_nightly() { + // Add a comment here explaining why this is necessary. return; } ``` @@ -370,6 +371,14 @@ )) } + /// Returns an iterator of paths matching the glob pattern, which is + /// relative to the project root. + pub fn glob>(&self, pattern: P) -> glob::Paths { + let pattern = self.root().join(pattern); + glob::glob(pattern.to_str().expect("failed to convert pattern to str")) + .expect("failed to glob") + } + /// Changes the contents of an existing file. pub fn change_file(&self, path: &str, body: &str) { FileBuilder::new(self.root().join(path), body).mk() @@ -506,10 +515,10 @@ } buf.push_str("fn main() { println!("); - buf.push_str(&println); + buf.push_str(println); buf.push_str("); }\n"); - buf.to_string() + buf } trait ErrMsg { @@ -570,6 +579,7 @@ expect_stderr_not_contains: Vec, expect_stderr_unordered: Vec, expect_neither_contains: Vec, + expect_stderr_with_without: Vec<(Vec, Vec)>, expect_json: Option>, expect_json_contains_unordered: Vec, stream_output: bool, @@ -687,6 +697,37 @@ self } + /// Verify that a particular line appears in stderr with and without the + /// given substrings. Exactly one line must match. + /// + /// The substrings are matched as `contains`. Example: + /// + /// ```no_run + /// execs.with_stderr_line_without( + /// &[ + /// "[RUNNING] `rustc --crate-name build_script_build", + /// "-C opt-level=3", + /// ], + /// &["-C debuginfo", "-C incremental"], + /// ) + /// ``` + /// + /// This will check that a build line includes `-C opt-level=3` but does + /// not contain `-C debuginfo` or `-C incremental`. + /// + /// Be careful writing the `without` fragments, see note in + /// `with_stderr_does_not_contain`. + pub fn with_stderr_line_without( + &mut self, + with: &[S], + without: &[S], + ) -> &mut Self { + let with = with.iter().map(|s| s.to_string()).collect(); + let without = without.iter().map(|s| s.to_string()).collect(); + self.expect_stderr_with_without.push((with, without)); + self + } + /// Verifies the JSON output matches the given JSON. /// Typically used when testing cargo commands that emit JSON. /// Each separate JSON object should be separated by a blank line. @@ -749,7 +790,12 @@ pub fn cwd>(&mut self, path: T) -> &mut Self { if let Some(ref mut p) = self.process_builder { - p.cwd(path); + if let Some(cwd) = p.get_cwd() { + let new_path = cwd.join(path.as_ref()); + p.cwd(new_path); + } else { + p.cwd(path); + } } self } @@ -817,6 +863,7 @@ && self.expect_stderr_not_contains.is_empty() && self.expect_stderr_unordered.is_empty() && self.expect_neither_contains.is_empty() + && self.expect_stderr_with_without.is_empty() && self.expect_json.is_none() && self.expect_json_contains_unordered.is_empty() { @@ -913,7 +960,7 @@ } for &(ref expect, number) in self.expect_stdout_contains_n.iter() { self.match_std( - Some(&expect), + Some(expect), &actual.stdout, "stdout", &actual.stderr, @@ -991,6 +1038,10 @@ } } + for (with, without) in self.expect_stderr_with_without.iter() { + self.match_with_without(&actual.stderr, with, without)?; + } + if let Some(ref objects) = self.expect_json { let stdout = str::from_utf8(&actual.stdout) .map_err(|_| "stdout was not utf8 encoded".to_owned())?; @@ -1050,6 +1101,32 @@ ) } + fn normalize_actual(&self, description: &str, actual: &[u8]) -> Result { + let actual = match str::from_utf8(actual) { + Err(..) => return Err(format!("{} was not utf8 encoded", description)), + Ok(actual) => actual, + }; + // Let's not deal with \r\n vs \n on windows... + let actual = actual.replace("\r", ""); + let actual = actual.replace("\t", ""); + Ok(actual) + } + + fn replace_expected(&self, expected: &str) -> String { + // Do the template replacements on the expected string. + let replaced = match self.process_builder { + None => expected.to_string(), + Some(ref p) => match p.get_cwd() { + None => expected.to_string(), + Some(cwd) => expected.replace("[CWD]", &cwd.display().to_string()), + }, + }; + + // On Windows, we need to use a wildcard for the drive, + // because we don't actually know what it will be. + replaced.replace("[ROOT]", if cfg!(windows) { r#"[..]:\"# } else { "/" }) + } + fn match_std( &self, expected: Option<&String>, @@ -1059,33 +1136,11 @@ kind: MatchKind, ) -> MatchResult { let out = match expected { - Some(out) => { - // Do the template replacements on the expected string. - let replaced = match self.process_builder { - None => out.to_string(), - Some(ref p) => match p.get_cwd() { - None => out.to_string(), - Some(cwd) => out.replace("[CWD]", &cwd.display().to_string()), - }, - }; - - // On Windows, we need to use a wildcard for the drive, - // because we don't actually know what it will be. - let replaced = - replaced.replace("[ROOT]", if cfg!(windows) { r#"[..]:\"# } else { "/" }); - - replaced - } + Some(out) => self.replace_expected(out), None => return Ok(()), }; - let actual = match str::from_utf8(actual) { - Err(..) => return Err(format!("{} was not utf8 encoded", description)), - Ok(actual) => actual, - }; - // Let's not deal with `\r\n` vs `\n` on Windows. - let actual = actual.replace("\r", ""); - let actual = actual.replace("\t", ""); + let actual = self.normalize_actual(description, actual)?; match kind { MatchKind::Exact => { @@ -1209,6 +1264,47 @@ } } + fn match_with_without( + &self, + actual: &[u8], + with: &[String], + without: &[String], + ) -> MatchResult { + let actual = self.normalize_actual("stderr", actual)?; + let contains = |s, line| { + let mut s = self.replace_expected(s); + s.insert_str(0, "[..]"); + s.push_str("[..]"); + lines_match(&s, line) + }; + let matches: Vec<&str> = actual + .lines() + .filter(|line| with.iter().all(|with| contains(with, line))) + .filter(|line| !without.iter().any(|without| contains(without, line))) + .collect(); + match matches.len() { + 0 => Err(format!( + "Could not find expected line in output.\n\ + With contents: {:?}\n\ + Without contents: {:?}\n\ + Actual stderr:\n\ + {}\n", + with, without, actual + )), + 1 => Ok(()), + _ => Err(format!( + "Found multiple matching lines, but only expected one.\n\ + With contents: {:?}\n\ + Without contents: {:?}\n\ + Matching lines:\n\ + {}\n", + with, + without, + matches.join("\n") + )), + } + } + fn match_json(&self, expected: &Value, line: &str) -> MatchResult { let actual = match line.parse() { Err(e) => return Err(format!("invalid json, {}:\n`{}`", e, line)), @@ -1233,7 +1329,7 @@ .enumerate() .filter_map(|(i, (a, e))| match (a, e) { (Some(a), Some(e)) => { - if lines_match(&e, &a) { + if lines_match(e, a) { None } else { Some(format!("{:3} - |{}|\n + |{}|\n", i, e, a)) @@ -1314,7 +1410,7 @@ /// arbitrary nested JSON (useful for parts of object emitted by other programs /// (e.g., rustc) rather than Cargo itself). Arrays are sorted before comparison. pub fn find_json_mismatch(expected: &Value, actual: &Value) -> Result<(), String> { - match find_json_mismatch_r(expected, &actual) { + match find_json_mismatch_r(expected, actual) { Some((expected_part, actual_part)) => Err(format!( "JSON mismatch\nExpected:\n{}\nWas:\n{}\nExpected part:\n{}\nActual part:\n{}\n", serde_json::to_string_pretty(expected).unwrap(), @@ -1355,7 +1451,7 @@ if !l.is_empty() { assert!(!r.is_empty()); - Some((&l[0], &r[0])) + Some((l[0], r[0])) } else { assert_eq!(r.len(), 0); None @@ -1426,6 +1522,7 @@ expect_stderr_not_contains: Vec::new(), expect_stderr_unordered: Vec::new(), expect_neither_contains: Vec::new(), + expect_stderr_with_without: Vec::new(), expect_json: None, expect_json_contains_unordered: Vec::new(), stream_output: false, @@ -1519,7 +1616,11 @@ ("[UNPACKING]", " Unpacking"), ("[SUMMARY]", " Summary"), ("[FIXING]", " Fixing"), - ("[EXE]", if cfg!(windows) { ".exe" } else { "" }), + ("[EXE]", env::consts::EXE_SUFFIX), + ("[IGNORED]", " Ignored"), + ("[INSTALLED]", " Installed"), + ("[REPLACED]", " Replaced"), + ("[NOTE]", " Note"), ]; let mut result = input.to_owned(); for &(pat, subst) in ¯os { @@ -1579,6 +1680,7 @@ .env_remove("XDG_CONFIG_HOME") // see #2345 .env("GIT_CONFIG_NOSYSTEM", "1") // keep trying to sandbox ourselves .env_remove("EMAIL") + .env_remove("USER") // not set on some rust-lang docker images .env_remove("MFLAGS") .env_remove("MAKEFLAGS") .env_remove("CARGO_MAKEFLAGS") @@ -1638,7 +1740,7 @@ } /// Some CI setups are much slower then the equipment used by Cargo itself. -/// Architectures that do not have a modern processor, hardware emulation, ect. +/// Architectures that do not have a modern processor, hardware emulation, etc. /// This provides a way for those setups to increase the cut off for all the time based test. pub fn slow_cpu_multiplier(main: u64) -> Duration { lazy_static::lazy_static! { diff -Nru cargo-0.35.0/tests/testsuite/support/paths.rs cargo-0.37.0/tests/testsuite/support/paths.rs --- cargo-0.35.0/tests/testsuite/support/paths.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/support/paths.rs 2019-05-15 19:48:47.000000000 +0000 @@ -70,6 +70,8 @@ fn move_in_time(&self, travel_amount: F) where F: Fn(i64, u32) -> (i64, u32); + + fn is_symlink(&self) -> bool; } impl CargoPathExt for Path { @@ -142,6 +144,12 @@ }); } } + + fn is_symlink(&self) -> bool { + fs::symlink_metadata(self) + .map(|m| m.file_type().is_symlink()) + .unwrap_or(false) + } } fn do_op(path: &Path, desc: &str, mut f: F) @@ -150,10 +158,18 @@ { match f(path) { Ok(()) => {} - Err(ref e) if cfg!(windows) && e.kind() == ErrorKind::PermissionDenied => { + Err(ref e) if e.kind() == ErrorKind::PermissionDenied => { let mut p = t!(path.metadata()).permissions(); p.set_readonly(false); t!(fs::set_permissions(path, p)); + + // Unix also requires the parent to not be readonly for example when + // removing files + let parent = path.parent().unwrap(); + let mut p = t!(parent.metadata()).permissions(); + p.set_readonly(false); + t!(fs::set_permissions(parent, p)); + f(path).unwrap_or_else(|e| { panic!("failed to {} {}: {}", desc, path.display(), e); }) diff -Nru cargo-0.35.0/tests/testsuite/support/registry.rs cargo-0.37.0/tests/testsuite/support/registry.rs --- cargo-0.35.0/tests/testsuite/support/registry.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/support/registry.rs 2019-05-15 19:48:47.000000000 +0000 @@ -7,8 +7,6 @@ use cargo::util::Sha256; use flate2::write::GzEncoder; use flate2::Compression; -use git2; -use hex; use tar::{Builder, Header}; use url::Url; @@ -126,6 +124,7 @@ /// /// p.cargo("run").with_stdout("24").run(); /// ``` +#[must_use] pub struct Package { name: String, vers: String, @@ -136,6 +135,7 @@ features: HashMap>, local: bool, alternative: bool, + invalid_json: bool, } #[derive(Clone)] @@ -231,6 +231,7 @@ features: HashMap::new(), local: false, alternative: false, + invalid_json: false, } } @@ -341,6 +342,13 @@ self } + /// Causes the JSON line emitted in the index to be invalid, presumably + /// causing Cargo to skip over this version. + pub fn invalid_json(&mut self, invalid: bool) -> &mut Package { + self.invalid_json = invalid; + self + } + /// Creates the package and place it in the registry. /// /// This does not actually use Cargo's publishing system, but instead @@ -383,8 +391,13 @@ t!(t!(File::open(&self.archive_dst())).read_to_end(&mut c)); cksum(&c) }; + let name = if self.invalid_json { + serde_json::json!(1) + } else { + serde_json::json!(self.name) + }; let line = serde_json::json!({ - "name": self.name, + "name": name, "vers": self.vers, "deps": deps, "cksum": cksum, @@ -444,19 +457,14 @@ } fn make_archive(&self) { - let features = if self.deps.iter().any(|dep| dep.registry.is_some()) { - "cargo-features = [\"alternative-registries\"]\n" - } else { - "" - }; let mut manifest = format!( r#" - {}[package] + [package] name = "{}" version = "{}" authors = [] "#, - features, self.name, self.vers + self.name, self.vers ); for dep in self.deps.iter() { let target = match dep.target { diff -Nru cargo-0.35.0/tests/testsuite/support/resolver.rs cargo-0.37.0/tests/testsuite/support/resolver.rs --- cargo-0.35.0/tests/testsuite/support/resolver.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/support/resolver.rs 2019-05-15 19:48:47.000000000 +0000 @@ -21,7 +21,7 @@ use proptest::test_runner::TestRunner; pub fn resolve( - pkg: &PackageId, + pkg: PackageId, deps: Vec, registry: &[Summary], ) -> CargoResult> { @@ -29,17 +29,17 @@ } pub fn resolve_and_validated( - pkg: &PackageId, + pkg: PackageId, deps: Vec, registry: &[Summary], ) -> CargoResult> { let resolve = resolve_with_config_raw(pkg, deps, registry, None)?; - let mut stack = vec![pkg.clone()]; + let mut stack = vec![pkg]; let mut used = HashSet::new(); let mut links = HashSet::new(); while let Some(p) = stack.pop() { assert!(resolve.contains(&p)); - if used.insert(p.clone()) { + if used.insert(p) { // in the tests all `links` crates end in `-sys` if p.name().ends_with("-sys") { assert!(links.insert(p.name())); @@ -48,7 +48,7 @@ for d in deps { assert!(d.matches_id(dp)); } - dp.clone() + dp })); } } @@ -58,7 +58,7 @@ } pub fn resolve_with_config( - pkg: &PackageId, + pkg: PackageId, deps: Vec, registry: &[Summary], config: Option<&Config>, @@ -68,12 +68,15 @@ } pub fn resolve_with_config_raw( - pkg: &PackageId, + pkg: PackageId, deps: Vec, registry: &[Summary], config: Option<&Config>, ) -> CargoResult { - struct MyRegistry<'a>(&'a [Summary]); + struct MyRegistry<'a> { + list: &'a [Summary], + used: HashSet, + }; impl<'a> Registry for MyRegistry<'a> { fn query( &mut self, @@ -81,8 +84,9 @@ f: &mut dyn FnMut(Summary), fuzzy: bool, ) -> CargoResult<()> { - for summary in self.0.iter() { + for summary in self.list.iter() { if fuzzy || dep.matches(summary) { + self.used.insert(summary.package_id()); f(summary.clone()); } } @@ -97,9 +101,30 @@ false } } - let mut registry = MyRegistry(registry); + impl<'a> Drop for MyRegistry<'a> { + fn drop(&mut self) { + if std::thread::panicking() && self.list.len() != self.used.len() { + // we found a case that causes a panic and did not use all of the input. + // lets print the part of the input that was used for minimization. + println!( + "{:?}", + PrettyPrintRegistry( + self.list + .iter() + .filter(|s| { self.used.contains(&s.package_id()) }) + .cloned() + .collect() + ) + ); + } + } + } + let mut registry = MyRegistry { + list: registry, + used: HashSet::new(), + }; let summary = Summary::new( - pkg.clone(), + pkg, deps, &BTreeMap::>::new(), None::, @@ -114,7 +139,7 @@ &mut registry, &HashSet::new(), config, - false, + true, ); // The largest test in our suite takes less then 30 sec. @@ -145,7 +170,7 @@ impl ToPkgId for PackageId { fn to_pkgid(&self) -> PackageId { - self.clone() + *self } } @@ -176,7 +201,7 @@ fn registry_loc() -> SourceId { lazy_static::lazy_static! { static ref EXAMPLE_DOT_COM: SourceId = - SourceId::for_registry(&"http://example.com".to_url().unwrap()).unwrap(); + SourceId::for_registry(&"https://example.com".to_url().unwrap()).unwrap(); } *EXAMPLE_DOT_COM } @@ -250,9 +275,10 @@ pub fn dep_req(name: &str, req: &str) -> Dependency { Dependency::parse_no_deprecated(name, Some(req), registry_loc()).unwrap() } -pub fn dep_req_kind(name: &str, req: &str, kind: Kind) -> Dependency { +pub fn dep_req_kind(name: &str, req: &str, kind: Kind, public: bool) -> Dependency { let mut dep = dep_req(name, req); dep.set_kind(kind); + dep.set_public(public); dep } @@ -297,9 +323,12 @@ } else { write!(f, "pkg!((\"{}\", \"{}\") => [", s.name(), s.version())?; for d in s.dependencies() { - if d.kind() == Kind::Normal && &d.version_req().to_string() == "*" { + if d.kind() == Kind::Normal + && &d.version_req().to_string() == "*" + && !d.is_public() + { write!(f, "dep(\"{}\"),", d.name_in_toml())?; - } else if d.kind() == Kind::Normal { + } else if d.kind() == Kind::Normal && !d.is_public() { write!( f, "dep_req(\"{}\", \"{}\"),", @@ -309,14 +338,15 @@ } else { write!( f, - "dep_req_kind(\"{}\", \"{}\", {}),", + "dep_req_kind(\"{}\", \"{}\", {}, {}),", d.name_in_toml(), d.version_req(), match d.kind() { Kind::Development => "Kind::Development", Kind::Build => "Kind::Build", Kind::Normal => "Kind::Normal", - } + }, + d.is_public() )?; } } @@ -341,8 +371,8 @@ pkg!(("bar", "2.0.0") => [dep_req("baz", "=1.0.1")]), pkg!(("baz", "1.0.2") => [dep_req("other", "2")]), pkg!(("baz", "1.0.1")), - pkg!(("cat", "1.0.2") => [dep_req_kind("other", "2", Kind::Build)]), - pkg!(("cat", "1.0.2") => [dep_req_kind("other", "2", Kind::Development)]), + pkg!(("cat", "1.0.2") => [dep_req_kind("other", "2", Kind::Build, false)]), + pkg!(("cat", "1.0.3") => [dep_req_kind("other", "2", Kind::Development, false)]), pkg!(("dep_req", "1.0.0")), pkg!(("dep_req", "2.0.0")), ]) @@ -354,8 +384,8 @@ pkg!((\"bar\", \"2.0.0\") => [dep_req(\"baz\", \"= 1.0.1\"),]),\ pkg!((\"baz\", \"1.0.2\") => [dep_req(\"other\", \"^2\"),]),\ pkg!((\"baz\", \"1.0.1\")),\ - pkg!((\"cat\", \"1.0.2\") => [dep_req_kind(\"other\", \"^2\", Kind::Build),]),\ - pkg!((\"cat\", \"1.0.2\") => [dep_req_kind(\"other\", \"^2\", Kind::Development),]),\ + pkg!((\"cat\", \"1.0.2\") => [dep_req_kind(\"other\", \"^2\", Kind::Build, false),]),\ + pkg!((\"cat\", \"1.0.3\") => [dep_req_kind(\"other\", \"^2\", Kind::Development, false),]),\ pkg!((\"dep_req\", \"1.0.0\")),\ pkg!((\"dep_req\", \"2.0.0\")),]" ) @@ -405,7 +435,14 @@ let max_deps = max_versions * (max_crates * (max_crates - 1)) / shrinkage; let raw_version_range = (any::(), any::()); - let raw_dependency = (any::(), any::(), raw_version_range, 0..=1); + let raw_dependency = ( + any::(), + any::(), + raw_version_range, + 0..=1, + Just(false), + // TODO: ^ this needs to be set back to `any::()` and work before public & private dependencies can stabilize + ); fn order_index(a: Index, b: Index, size: usize) -> (usize, usize) { let (a, b) = (a.index(size), b.index(size)); @@ -432,7 +469,7 @@ .collect(); let len_all_pkgid = list_of_pkgid.len(); let mut dependency_by_pkgid = vec![vec![]; len_all_pkgid]; - for (a, b, (c, d), k) in raw_dependencies { + for (a, b, (c, d), k, p) in raw_dependencies { let (a, b) = order_index(a, b, len_all_pkgid); let (a, b) = if reverse_alphabetical { (b, a) } else { (a, b) }; let ((dep_name, _), _) = list_of_pkgid[a]; @@ -444,7 +481,7 @@ let (c, d) = order_index(c, d, s.len()); dependency_by_pkgid[b].push(dep_req_kind( - &dep_name, + dep_name, &if c == 0 && d == s_last_index { "*".to_string() } else if c == 0 { @@ -459,9 +496,10 @@ match k { 0 => Kind::Normal, 1 => Kind::Build, - // => Kind::Development, // Development has not impact so don't gen + // => Kind::Development, // Development has no impact so don't gen _ => panic!("bad index for Kind"), }, + p, )) } @@ -490,24 +528,24 @@ /// This test is to test the generator to ensure /// that it makes registries with large dependency trees -/// -/// This is a form of randomized testing, if you are unlucky it can fail. -/// A failure on its own is not a big deal. If you did not change the -/// `registry_strategy` then feel free to retry without concern. #[test] fn meta_test_deep_trees_from_strategy() { let mut dis = [0; 21]; let strategy = registry_strategy(50, 20, 60); + let mut test_runner = TestRunner::deterministic(); for _ in 0..128 { let PrettyPrintRegistry(input) = strategy - .new_tree(&mut TestRunner::default()) + .new_tree(&mut TestRunner::new_with_rng( + Default::default(), + test_runner.new_rng(), + )) .unwrap() .current(); let reg = registry(input.clone()); for this in input.iter().rev().take(10) { let res = resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep_req(&this.name(), &format!("={}", this.version()))], ®, ); @@ -529,24 +567,24 @@ /// This test is to test the generator to ensure /// that it makes registries that include multiple versions of the same library -/// -/// This is a form of randomized testing, if you are unlucky it can fail. -/// A failure on its own is not a big deal. If you did not change the -/// `registry_strategy` then feel free to retry without concern. #[test] fn meta_test_multiple_versions_strategy() { let mut dis = [0; 10]; let strategy = registry_strategy(50, 20, 60); + let mut test_runner = TestRunner::deterministic(); for _ in 0..128 { let PrettyPrintRegistry(input) = strategy - .new_tree(&mut TestRunner::default()) + .new_tree(&mut TestRunner::new_with_rng( + Default::default(), + test_runner.new_rng(), + )) .unwrap() .current(); let reg = registry(input.clone()); for this in input.iter().rev().take(10) { let res = resolve( - &pkg_id("root"), + pkg_id("root"), vec![dep_req(&this.name(), &format!("={}", this.version()))], ®, ); diff -Nru cargo-0.35.0/tests/testsuite/test.rs cargo-0.37.0/tests/testsuite/test.rs --- cargo-0.35.0/tests/testsuite/test.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/test.rs 2019-05-15 19:48:47.000000000 +0000 @@ -6,7 +6,7 @@ use crate::support::paths::CargoPathExt; use crate::support::registry::Package; use crate::support::{basic_bin_manifest, basic_lib_manifest, basic_manifest, cargo_exe, project}; -use crate::support::{is_nightly, rustc_host, sleep_ms}; +use crate::support::{rustc_host, sleep_ms}; #[test] fn cargo_test_simple() { @@ -106,9 +106,6 @@ #[test] fn cargo_test_overflow_checks() { - if !is_nightly() { - return; - } let p = project() .file( "Cargo.toml", @@ -145,6 +142,78 @@ } #[test] +fn cargo_test_quiet_with_harness() { + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + authors = [] + + [[test]] + name = "foo" + path = "src/foo.rs" + harness = true + "#, + ) + .file( + "src/foo.rs", + r#" + fn main() {} + #[test] fn test_hello() {} + "#, + ) + .build(); + + p.cargo("test -q") + .with_stdout( + " +running 1 test +. +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out + +", + ) + .with_stderr("") + .run(); +} + +#[test] +fn cargo_test_quiet_no_harness() { + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + authors = [] + + [[bin]] + name = "foo" + test = false + + [[test]] + name = "foo" + path = "src/main.rs" + harness = false + "#, + ) + .file( + "src/main.rs", + r#" + fn main() {} + #[test] fn test_hello() {} + "#, + ) + .build(); + + p.cargo("test -q").with_stdout("").with_stderr("").run(); +} + +#[test] fn cargo_test_verbose() { let p = project() .file("Cargo.toml", &basic_bin_manifest("foo")) @@ -163,7 +232,8 @@ [COMPILING] foo v0.5.0 ([CWD]) [RUNNING] `rustc [..] src/main.rs [..]` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -[RUNNING] `[..]target/debug/deps/foo-[..][EXE] hello`", +[RUNNING] `[CWD]/target/debug/deps/foo-[..] hello` +", ) .with_stdout_contains("test test_hello ... ok") .run(); @@ -601,10 +671,10 @@ [COMPILING] foo v0.0.1 ([CWD]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] [RUNNING] target/debug/deps/foo-[..][EXE] -[DOCTEST] foo", +", ) + .with_stdout_contains("running 1 test") .with_stdout_contains("test bar ... ok") - .with_stdout_contains("running 0 tests") .run(); p.cargo("test foo") @@ -612,10 +682,10 @@ "\ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] [RUNNING] target/debug/deps/foo-[..][EXE] -[DOCTEST] foo", +", ) + .with_stdout_contains("running 1 test") .with_stdout_contains("test foo ... ok") - .with_stdout_contains("running 0 tests") .run(); } @@ -1463,6 +1533,38 @@ } #[test] +fn test_filtered_excludes_compiling_examples() { + let p = project() + .file( + "src/lib.rs", + "#[cfg(test)] mod tests { #[test] fn foo() { assert!(true); } }", + ) + .file("examples/ex1.rs", "fn main() {}") + .build(); + + p.cargo("test -v foo") + .with_stdout( + " +running 1 test +test tests::foo ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out + +", + ) + .with_stderr( + "\ +[COMPILING] foo v0.0.1 ([CWD]) +[RUNNING] `rustc --crate-name foo src/lib.rs [..] --test [..]` +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] +[RUNNING] `[CWD]/target/debug/deps/foo-[..] foo` +", + ) + .with_stderr_does_not_contain("[RUNNING][..]rustc[..]ex1[..]") + .run(); +} + +#[test] fn test_no_harness() { let p = project() .file( @@ -3168,7 +3270,7 @@ } #[test] -fn test_hint_workspace() { +fn test_hint_workspace_virtual() { let p = project() .file( "Cargo.toml", @@ -3187,6 +3289,40 @@ .with_stderr_contains("[ERROR] test failed, to rerun pass '-p b --lib'") .with_status(101) .run(); + p.cargo("test") + .cwd("b") + .with_stderr_contains("[ERROR] test failed, to rerun pass '--lib'") + .with_status(101) + .run(); +} + +#[test] +fn test_hint_workspace_nonvirtual() { + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + + [workspace] + members = ["a"] + "#, + ) + .file("src/lib.rs", "") + .file("a/Cargo.toml", &basic_manifest("a", "0.1.0")) + .file("a/src/lib.rs", "#[test] fn t1() {assert!(false)}") + .build(); + + p.cargo("test --all") + .with_stderr_contains("[ERROR] test failed, to rerun pass '-p a --lib'") + .with_status(101) + .run(); + p.cargo("test -p a") + .with_stderr_contains("[ERROR] test failed, to rerun pass '-p a --lib'") + .with_status(101) + .run(); } #[test] @@ -3426,13 +3562,13 @@ ) .run(); - p.cargo("test --doc") - .with_stderr( - "\ -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -[DOCTEST] foo -", - ) + // This has been modified to attempt to diagnose spurious errors on CI. + // For some reason, this is recompiling the lib when it shouldn't. If the + // root cause is ever found, the changes here should be reverted. + // See https://github.com/rust-lang/cargo/issues/6887 + p.cargo("test --doc -vv") + .with_stderr_does_not_contain("[COMPILING] foo [..]") + .with_stderr_contains("[DOCTEST] foo") .with_stdout( " running 1 test @@ -3442,6 +3578,7 @@ ", ) + .env("CARGO_LOG", "cargo=trace") .run(); p.cargo("test --lib --doc") diff -Nru cargo-0.35.0/tests/testsuite/tool_paths.rs cargo-0.37.0/tests/testsuite/tool_paths.rs --- cargo-0.35.0/tests/testsuite/tool_paths.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/tool_paths.rs 2019-05-15 19:48:47.000000000 +0000 @@ -105,7 +105,7 @@ let prefix = p.root().into_os_string().into_string().unwrap(); - p.cargo("build --verbose").cwd(p.root().join("bar")).with_stderr(&format!( + p.cargo("build --verbose").cwd("bar").with_stderr(&format!( "\ [COMPILING] bar v0.5.0 ([CWD]) [RUNNING] `rustc [..] -C ar={prefix}/./nonexistent-ar -C linker={prefix}/./tools/nonexistent-linker [..]` @@ -188,13 +188,13 @@ p.cargo("run -- --param") .with_status(101) - .with_stderr_contains(&format!( + .with_stderr_contains( "\ [COMPILING] foo v0.0.1 ([CWD]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] [RUNNING] `nonexistent-runner -r target/debug/foo[EXE] --param` ", - )) + ) .run(); } @@ -222,13 +222,13 @@ p.cargo("run -- --param") .with_status(101) - .with_stderr_contains(&format!( + .with_stderr_contains( "\ [COMPILING] foo v0.0.1 ([CWD]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] [RUNNING] `nonexistent-runner -r target/debug/foo[EXE] --param` ", - )) + ) .run(); } @@ -250,10 +250,10 @@ p.cargo("run -- --param") .with_status(101) - .with_stderr_contains(&format!( + .with_stderr_contains( "\ [ERROR] several matching instances of `target.'cfg(..)'.runner` in `.cargo/config` ", - )) + ) .run(); } diff -Nru cargo-0.35.0/tests/testsuite/update.rs cargo-0.37.0/tests/testsuite/update.rs --- cargo-0.35.0/tests/testsuite/update.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/update.rs 2019-05-15 19:48:47.000000000 +0000 @@ -205,7 +205,7 @@ Package::new("log", "0.1.1").publish(); p.uncomment_root_manifest(); - p.cargo("build").env("RUST_LOG", "cargo=trace").run(); + p.cargo("build").env("CARGO_LOG", "cargo=trace").run(); } #[test] @@ -395,6 +395,168 @@ .run(); } +// cargo update should respect its arguments even without a lockfile. +// See issue "Running cargo update without a Cargo.lock ignores arguments" +// at . +#[test] +fn update_precise_first_run() { + Package::new("serde", "0.1.0").publish(); + Package::new("serde", "0.2.0").publish(); + Package::new("serde", "0.2.1").publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "bar" + version = "0.0.1" + + [dependencies] + serde = "0.2" + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("update -p serde --precise 0.2.0") + .with_stderr( + "\ +[UPDATING] `[..]` index +[UPDATING] serde v0.2.1 -> v0.2.0 +", + ) + .run(); + + // Assert `cargo metadata` shows serde 0.2.0 + p.cargo("metadata") + .with_json( + r#"{ + "packages": [ + { + "authors": [], + "categories": [], + "dependencies": [], + "description": null, + "edition": "2015", + "features": {}, + "id": "serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "keywords": [], + "license": null, + "license_file": null, + "links": null, + "manifest_path": "[..]/home/.cargo/registry/src/-[..]/serde-0.2.0/Cargo.toml", + "metadata": null, + "name": "serde", + "readme": null, + "repository": null, + "source": "registry+https://github.com/rust-lang/crates.io-index", + "targets": [ + { + "crate_types": [ + "lib" + ], + "edition": "2015", + "kind": [ + "lib" + ], + "name": "serde", + "src_path": "[..]/home/.cargo/registry/src/-[..]/serde-0.2.0/src/lib.rs" + } + ], + "version": "0.2.0" + }, + { + "authors": [], + "categories": [], + "dependencies": [ + { + "features": [], + "kind": null, + "name": "serde", + "optional": false, + "registry": null, + "rename": null, + "req": "^0.2", + "source": "registry+https://github.com/rust-lang/crates.io-index", + "target": null, + "uses_default_features": true + } + ], + "description": null, + "edition": "2015", + "features": {}, + "id": "bar 0.0.1 (path+file://[..]/foo)", + "keywords": [], + "license": null, + "license_file": null, + "links": null, + "manifest_path": "[..]/foo/Cargo.toml", + "metadata": null, + "name": "bar", + "readme": null, + "repository": null, + "source": null, + "targets": [ + { + "crate_types": [ + "lib" + ], + "edition": "2015", + "kind": [ + "lib" + ], + "name": "bar", + "src_path": "[..]/foo/src/lib.rs" + } + ], + "version": "0.0.1" + } + ], + "resolve": { + "nodes": [ + { + "dependencies": [ + "serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" + ], + "deps": [ + { + "name": "serde", + "pkg": "serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" + } + ], + "features": [], + "id": "bar 0.0.1 (path+file://[..]/foo)" + }, + { + "dependencies": [], + "deps": [], + "features": [], + "id": "serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" + } + ], + "root": "bar 0.0.1 (path+file://[..]/foo)" + }, + "target_directory": "[..]/foo/target", + "version": 1, + "workspace_members": [ + "bar 0.0.1 (path+file://[..]/foo)" + ], + "workspace_root": "[..]/foo" +}"#, + ) + .run(); + + p.cargo("update -p serde --precise 0.2.0") + .with_stderr( + "\ +[UPDATING] `[..]` index +", + ) + .run(); + +} + #[test] fn preserve_top_comment() { let p = project().file("src/lib.rs", "").build(); diff -Nru cargo-0.35.0/tests/testsuite/workspaces.rs cargo-0.37.0/tests/testsuite/workspaces.rs --- cargo-0.35.0/tests/testsuite/workspaces.rs 2019-04-01 21:32:07.000000000 +0000 +++ cargo-0.37.0/tests/testsuite/workspaces.rs 2019-05-15 19:48:47.000000000 +0000 @@ -39,7 +39,7 @@ assert!(p.bin("foo").is_file()); assert!(!p.bin("bar").is_file()); - p.cargo("build").cwd(p.root().join("bar")).run(); + p.cargo("build").cwd("bar").run(); assert!(p.bin("foo").is_file()); assert!(p.bin("bar").is_file()); @@ -106,7 +106,7 @@ assert!(p.bin("foo").is_file()); assert!(!p.bin("bar").is_file()); - p.cargo("build").cwd(p.root().join("bar")).run(); + p.cargo("build").cwd("bar").run(); assert!(p.bin("foo").is_file()); assert!(p.bin("bar").is_file()); @@ -141,7 +141,7 @@ assert!(p.bin("foo").is_file()); assert!(!p.bin("bar").is_file()); - p.cargo("build").cwd(p.root().join("bar")).run(); + p.cargo("build").cwd("bar").run(); assert!(p.bin("foo").is_file()); assert!(p.bin("bar").is_file()); @@ -191,12 +191,12 @@ assert!(!p.bin("bar").is_file()); assert!(!p.bin("baz").is_file()); - p.cargo("build").cwd(p.root().join("bar")).run(); + p.cargo("build").cwd("bar").run(); assert!(p.bin("foo").is_file()); assert!(p.bin("bar").is_file()); assert!(!p.bin("baz").is_file()); - p.cargo("build").cwd(p.root().join("baz")).run(); + p.cargo("build").cwd("baz").run(); assert!(p.bin("foo").is_file()); assert!(p.bin("bar").is_file()); assert!(p.bin("baz").is_file()); @@ -238,8 +238,8 @@ .file("bar/src/lib.rs", ""); let p = p.build(); - p.cargo("build").cwd(p.root().join("foo")).run(); - p.cargo("build").cwd(p.root().join("bar")).run(); + p.cargo("build").cwd("foo").run(); + p.cargo("build").cwd("bar").run(); assert!(p.root().join("foo/Cargo.lock").is_file()); assert!(!p.root().join("bar/Cargo.lock").is_file()); } @@ -305,7 +305,7 @@ let p = p.build(); p.cargo("build") - .cwd(p.root().join("bar")) + .cwd("bar") .with_status(101) .with_stderr( "\ @@ -314,6 +314,7 @@ workspace: [..]Cargo.toml this may be fixable [..] +[..] ", ) .run(); @@ -705,7 +706,7 @@ .run(); p.cargo("build") - .cwd(p.root().join("bar")) + .cwd("bar") .with_stderr( "\ [DOWNLOADING] crates ... @@ -731,7 +732,7 @@ .file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0")) .file("bar/src/main.rs", "fn main() {}"); let p = p.build(); - p.cargo("build").cwd(p.root().join("bar")).run(); + p.cargo("build").cwd("bar").run(); assert!(p.root().join("Cargo.lock").is_file()); assert!(p.bin("bar").is_file()); assert!(!p.root().join("bar/Cargo.lock").is_file()); @@ -769,7 +770,7 @@ .file("bar/src/main.rs", "fn main() {}"); let p = p.build(); p.cargo("build") - .cwd(p.root().join("bar")) + .cwd("bar") .with_status(101) .with_stderr( "\ @@ -779,6 +780,7 @@ this may be fixable by adding `bar` to the `workspace.members` array of the \ manifest located at: [..] +[..] ", ) .run(); @@ -938,9 +940,9 @@ .file("p3/src/lib.rs", ""); let p = p.build(); - p.cargo("build").cwd(p.root().join("p1")).run(); - p.cargo("build").cwd(p.root().join("p2")).run(); - p.cargo("build").cwd(p.root().join("p3")).run(); + p.cargo("build").cwd("p1").run(); + p.cargo("build").cwd("p2").run(); + p.cargo("build").cwd("p3").run(); p.cargo("build").run(); assert!(p.root().join("target").is_dir()); @@ -979,6 +981,7 @@ this may be fixable by ensuring that this crate is depended on by the workspace \ root: [..] +[..] [CREATED] library `bar` package ", ) @@ -986,6 +989,26 @@ } #[test] +fn new_warning_with_corrupt_ws() { + let p = project().file("Cargo.toml", "asdf").build(); + p.cargo("new bar") + .env("USER", "foo") + .with_stderr( + "\ +[WARNING] compiling this new crate may not work due to invalid workspace configuration + +failed to parse manifest at `[..]foo/Cargo.toml` +Caused by: + could not parse input as TOML +Caused by: + expected an equals, found eof at line 1 + Created binary (application) `bar` package +", + ) + .run(); +} + +#[test] fn lock_doesnt_change_depending_on_crate() { let p = project() .file( @@ -1027,7 +1050,7 @@ let mut lockfile = String::new(); t!(t!(File::open(p.root().join("Cargo.lock"))).read_to_string(&mut lockfile)); - p.cargo("build").cwd(p.root().join("baz")).run(); + p.cargo("build").cwd("baz").run(); let mut lockfile2 = String::new(); t!(t!(File::open(p.root().join("Cargo.lock"))).read_to_string(&mut lockfile2)); @@ -1075,17 +1098,17 @@ ); let p = p.build(); - p.cargo("run").cwd(p.root().join("bin")).run(); + p.cargo("run").cwd("bin").run(); sleep_ms(1000); t!(t!(File::create(p.root().join("lib/src/lib.rs"))) .write_all(br#"pub fn foo() -> u32 { 1 }"#)); - p.cargo("build").cwd(p.root().join("lib")).run(); + p.cargo("build").cwd("lib").run(); p.cargo("run") - .cwd(p.root().join("bin")) + .cwd("bin") .with_status(101) .with_stderr_contains("[..]assertion[..]") .run(); @@ -1159,7 +1182,7 @@ let p = p.build(); - p.cargo("build").cwd(p.root().join("a")).run(); + p.cargo("build").cwd("a").run(); } #[test] @@ -1241,7 +1264,7 @@ let p = p.build(); p.cargo("build") - .cwd(p.root().join("bar")) + .cwd("bar") .with_status(101) .with_stderr_contains("[ERROR] failed to parse manifest at `[..]`") .run(); @@ -1276,8 +1299,8 @@ .file("bar/src/main.rs", "fn main() {}"); let p = p.build(); - p.cargo("build").cwd(p.root().join("foo")).run(); - p.cargo("build").cwd(p.root().join("bar")).run(); + p.cargo("build").cwd("foo").run(); + p.cargo("build").cwd("bar").run(); } #[test] @@ -1305,7 +1328,7 @@ p.cargo("build --manifest-path ./Cargo.toml").run(); p.cargo("build --manifest-path ../Cargo.toml") - .cwd(p.root().join("subproj")) + .cwd("subproj") .run(); } @@ -1332,7 +1355,7 @@ .file("foo/src/lib.rs", ""); let p = p.build(); - p.cargo("build").cwd(p.root().join("ws")).run(); + p.cargo("build").cwd("ws").run(); } #[test] @@ -1387,7 +1410,7 @@ .file("bar/src/lib.rs", "pub fn f() { }"); let p = p.build(); - p.cargo("build").cwd(p.root().join("ws")).run(); + p.cargo("build").cwd("ws").run(); assert!(p.root().join("ws/Cargo.lock").is_file()); assert!(p.root().join("ws/target").is_dir()); @@ -1396,7 +1419,7 @@ assert!(!p.root().join("bar/Cargo.lock").is_file()); assert!(!p.root().join("bar/target").is_dir()); - p.cargo("build").cwd(p.root().join("foo")).run(); + p.cargo("build").cwd("foo").run(); assert!(p.root().join("foo/Cargo.lock").is_file()); assert!(p.root().join("foo/target").is_dir()); assert!(!p.root().join("bar/Cargo.lock").is_file()); @@ -1445,12 +1468,12 @@ .file("foo/bar/src/lib.rs", "pub fn f() { }"); let p = p.build(); - p.cargo("build").cwd(p.root().join("ws")).run(); + p.cargo("build").cwd("ws").run(); assert!(!p.root().join("foo/bar/Cargo.lock").is_file()); assert!(!p.root().join("foo/bar/target").is_dir()); - p.cargo("build").cwd(p.root().join("foo/bar")).run(); + p.cargo("build").cwd("foo/bar").run(); assert!(!p.root().join("foo/bar/Cargo.lock").is_file()); assert!(!p.root().join("foo/bar/target").is_dir()); @@ -1478,7 +1501,7 @@ p.cargo("build").run(); assert!(p.root().join("target").is_dir()); - p.cargo("build").cwd(p.root().join("foo")).run(); + p.cargo("build").cwd("foo").run(); assert!(p.root().join("foo/target").is_dir()); } @@ -1507,9 +1530,9 @@ p.cargo("build").run(); assert!(p.root().join("target").is_dir()); - p.cargo("build").cwd(p.root().join("foo")).run(); + p.cargo("build").cwd("foo").run(); assert!(p.root().join("foo/target").is_dir()); - p.cargo("build").cwd(p.root().join("foo/bar")).run(); + p.cargo("build").cwd("foo/bar").run(); assert!(!p.root().join("foo/bar/target").is_dir()); } @@ -1540,9 +1563,9 @@ p.cargo("build").run(); assert!(p.root().join("target").is_dir()); - p.cargo("build").cwd(p.root().join("foo")).run(); + p.cargo("build").cwd("foo").run(); assert!(p.root().join("foo/target").is_dir()); - p.cargo("build").cwd(p.root().join("foo/bar")).run(); + p.cargo("build").cwd("foo/bar").run(); assert!(p.root().join("foo/bar/target").is_dir()); } @@ -1602,15 +1625,15 @@ assert!(!p.bin("bar").is_file()); assert!(!p.bin("baz").is_file()); - p.cargo("build").cwd(p.root().join("crates/bar")).run(); + p.cargo("build").cwd("crates/bar").run(); assert!(p.bin("foo").is_file()); assert!(p.bin("bar").is_file()); - p.cargo("build").cwd(p.root().join("crates/baz")).run(); + p.cargo("build").cwd("crates/baz").run(); assert!(p.bin("foo").is_file()); assert!(p.bin("baz").is_file()); - p.cargo("build").cwd(p.root().join("crates/qux")).run(); + p.cargo("build").cwd("crates/qux").run(); assert!(!p.bin("qux").is_file()); assert!(p.root().join("Cargo.lock").is_file()); @@ -1664,15 +1687,15 @@ assert!(!p.bin("bar").is_file()); assert!(!p.bin("baz").is_file()); - p.cargo("build").cwd(p.root().join("crates/bar")).run(); + p.cargo("build").cwd("crates/bar").run(); assert!(p.bin("foo").is_file()); assert!(p.bin("bar").is_file()); - p.cargo("build").cwd(p.root().join("crates/baz")).run(); + p.cargo("build").cwd("crates/baz").run(); assert!(p.bin("foo").is_file()); assert!(p.bin("baz").is_file()); - p.cargo("build").cwd(p.root().join("crates/qux")).run(); + p.cargo("build").cwd("crates/qux").run(); assert!(!p.bin("qux").is_file()); assert!(p.root().join("Cargo.lock").is_file()); @@ -1795,7 +1818,7 @@ // Ideally once we solve rust-lang/cargo#3620, then a single Cargo build at the top level // will be enough. p.cargo("build") - .cwd(p.root().join("caller1")) + .cwd("caller1") .with_stderr( "\ [..]Compiling feat_lib v0.1.0 ([..]) @@ -1808,15 +1831,15 @@ // Alternate building `caller2`/`caller1` a few times, just to make sure // features are being built separately. Should not rebuild anything. p.cargo("build") - .cwd(p.root().join("caller2")) + .cwd("caller2") .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]") .run(); p.cargo("build") - .cwd(p.root().join("caller1")) + .cwd("caller1") .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]") .run(); p.cargo("build") - .cwd(p.root().join("caller2")) + .cwd("caller2") .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]") .run(); } @@ -1892,10 +1915,10 @@ .file("foo/bar/src/lib.rs", ""); p.build(); - p.cargo("build").cwd(p.root().join("foo")).run(); + p.cargo("build").cwd("foo").run(); assert!(p.root().join("target").is_dir()); assert!(!p.root().join("foo/target").is_dir()); - p.cargo("build").cwd(p.root().join("foo/bar")).run(); + p.cargo("build").cwd("foo/bar").run(); assert!(p.root().join("foo/bar/target").is_dir()); } */ diff -Nru cargo-0.35.0/vendor/aho-corasick/.cargo-checksum.json cargo-0.37.0/vendor/aho-corasick/.cargo-checksum.json --- cargo-0.35.0/vendor/aho-corasick/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/aho-corasick/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c"} \ No newline at end of file +{"files":{},"package":"36b7aa1ccb7d7ea3f437cf025a2ab1c47cc6c1bc9fc84918ff449def12f5e282"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/aho-corasick/Cargo.toml cargo-0.37.0/vendor/aho-corasick/Cargo.toml --- cargo-0.35.0/vendor/aho-corasick/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/aho-corasick/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "aho-corasick" -version = "0.7.3" +version = "0.7.4" authors = ["Andrew Gallant "] exclude = ["/aho-corasick-debug", "/bench", "/ci/*", "/.travis.yml"] autotests = false @@ -34,6 +34,8 @@ [dependencies.memchr] version = "2.2.0" default-features = false +[dev-dependencies.doc-comment] +version = "0.3.1" [features] default = ["std"] diff -Nru cargo-0.35.0/vendor/aho-corasick/src/lib.rs cargo-0.37.0/vendor/aho-corasick/src/lib.rs --- cargo-0.35.0/vendor/aho-corasick/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/aho-corasick/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -180,6 +180,7 @@ */ #![deny(missing_docs)] +#![allow(bare_trait_objects)] // We can never be truly no_std, but we could be alloc-only some day, so // require the std feature for now. @@ -187,6 +188,12 @@ compile_error!("`std` feature is currently required to build this crate"); extern crate memchr; +#[cfg(test)] +#[macro_use] +extern crate doc_comment; + +#[cfg(test)] +doctest!("../README.md"); pub use ahocorasick::{ AhoCorasick, AhoCorasickBuilder, MatchKind, diff -Nru cargo-0.35.0/vendor/aho-corasick/src/nfa.rs cargo-0.37.0/vendor/aho-corasick/src/nfa.rs --- cargo-0.35.0/vendor/aho-corasick/src/nfa.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/aho-corasick/src/nfa.rs 2019-07-17 05:42:23.000000000 +0000 @@ -924,9 +924,21 @@ let mut queue: VecDeque> = VecDeque::new(); let start = QueuedState::start(&self.nfa); for b in AllBytesIter::new() { - let next = self.nfa.start().next_state(b); - if next != start.id { - queue.push_back(start.next_queued_state(&self.nfa, next)); + let next_id = self.nfa.start().next_state(b); + if next_id != start.id { + let next = start.next_queued_state(&self.nfa, next_id); + queue.push_back(next); + // If a state immediately following the start state is a match + // state, then we never want to follow its failure transition + // since the failure transition necessarily leads back to the + // start state, which we never want to do for leftmost matching + // after a match has been found. + // + // N.B. This is a special case of the more general handling + // found below. + if self.nfa.state(next_id).is_match() { + self.nfa.state_mut(next_id).fail = dead_id(); + } } } while let Some(item) = queue.pop_front() { @@ -986,6 +998,13 @@ it.nfa().state_mut(next.id).fail = dead_id(); continue; } + assert_ne!( + start.id, + it.nfa().state(next.id).fail, + "states that are match states or follow match \ + states should never have a failure transition \ + back to the start state in leftmost searching", + ); } it.nfa().state_mut(next.id).fail = fail; it.nfa().copy_matches(fail, next.id); @@ -1215,7 +1234,8 @@ let nfa: NFA = Builder::new() .dense_depth(0) // .match_kind(MatchKind::LeftmostShortest) - .match_kind(MatchKind::LeftmostLongest) + // .match_kind(MatchKind::LeftmostLongest) + .match_kind(MatchKind::LeftmostFirst) // .build(&["abcd", "ce", "b"]) // .build(&["ab", "bc"]) // .build(&["b", "bcd", "ce"]) @@ -1223,7 +1243,7 @@ // .build(&["abc", "bd", "ab"]) // .build(&["abcdefghi", "hz", "abcdefgh"]) // .build(&["abcd", "bce", "b"]) - .build(&["a", "ababcde"]) + .build(&["abcdefg", "bcde", "bcdef"]) .unwrap(); println!("{:?}", nfa); } diff -Nru cargo-0.35.0/vendor/aho-corasick/src/tests.rs cargo-0.37.0/vendor/aho-corasick/src/tests.rs --- cargo-0.35.0/vendor/aho-corasick/src/tests.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/aho-corasick/src/tests.rs 2019-07-17 05:42:23.000000000 +0000 @@ -184,6 +184,9 @@ t!(leftmost000, &["ab", "ab"], "abcd", &[(0, 0, 2)]), t!(leftmost010, &["a", ""], "a", &[(0, 0, 1), (1, 1, 1)]), t!(leftmost020, &["", ""], "a", &[(0, 0, 0), (0, 1, 1)]), + t!(leftmost030, &["a", "ab"], "aa", &[(0, 0, 1), (0, 1, 2)]), + t!(leftmost031, &["ab", "a"], "aa", &[(1, 0, 1), (1, 1, 2)]), + t!(leftmost032, &["ab", "a"], "xayabbbz", &[(1, 1, 2), (0, 3, 5)]), t!(leftmost300, &["abcd", "bce", "b"], "abce", &[(1, 1, 4)]), t!(leftmost310, &["abcd", "ce", "bc"], "abce", &[(2, 1, 3)]), @@ -228,6 +231,7 @@ ]), t!(leftfirst020, &["abcd", "ab"], "abcd", &[(0, 0, 4)]), t!(leftfirst030, &["ab", "ab"], "abcd", &[(0, 0, 2)]), + t!(leftfirst040, &["a", "ab"], "xayabbbz", &[(0, 1, 2), (0, 3, 4)]), t!(leftlong100, &["abcdefg", "bcde", "bcdef"], "abcdef", &[(1, 1, 5)]), t!(leftlong110, &["abcdefg", "bcdef", "bcde"], "abcdef", &[(1, 1, 6)]), @@ -281,6 +285,7 @@ t!(leftlong330, &["abcd", "b", "ce"], "abce", &[ (1, 1, 2), (2, 2, 4), ]), + t!(leftlong340, &["a", "ab"], "xayabbbz", &[(0, 1, 2), (1, 3, 5)]), ]; /// Tests for non-overlapping match semantics. diff -Nru cargo-0.35.0/vendor/atty/appveyor.yml cargo-0.37.0/vendor/atty/appveyor.yml --- cargo-0.35.0/vendor/atty/appveyor.yml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/atty/appveyor.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -environment: - matrix: - - TARGET: nightly-x86_64-pc-windows-msvc - - TARGET: nightly-i686-pc-windows-msvc - - TARGET: nightly-x86_64-pc-windows-gnu - - TARGET: nightly-i686-pc-windows-gnu -install: - - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-${env:TARGET}.exe" -FileName "rust-install.exe" - - ps: .\rust-install.exe /VERYSILENT /NORESTART /DIR="C:\rust" | Out-Null - - ps: $env:PATH="$env:PATH;C:\rust\bin" - - call "%VCVARS%" || ver>nul - - rustc -vV - - cargo -vV -build: false -test_script: - - cargo build diff -Nru cargo-0.35.0/vendor/atty/.cargo-checksum.json cargo-0.37.0/vendor/atty/.cargo-checksum.json --- cargo-0.35.0/vendor/atty/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/atty/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"} \ No newline at end of file +{"files":{},"package":"1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/atty/Cargo.toml cargo-0.37.0/vendor/atty/Cargo.toml --- cargo-0.35.0/vendor/atty/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/atty/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,17 +12,16 @@ [package] name = "atty" -version = "0.2.11" +version = "0.2.13" authors = ["softprops "] +exclude = ["/.travis.yml", "/appveyor.yml"] description = "A simple interface for querying atty" homepage = "https://github.com/softprops/atty" documentation = "http://softprops.github.io/atty" readme = "README.md" -keywords = ["terminal", "tty"] +keywords = ["terminal", "tty", "isatty"] license = "MIT" repository = "https://github.com/softprops/atty" -[target."cfg(target_os = \"redox\")".dependencies.termion] -version = "1.5" [target."cfg(unix)".dependencies.libc] version = "0.2" default-features = false diff -Nru cargo-0.35.0/vendor/atty/CHANGELOG.md cargo-0.37.0/vendor/atty/CHANGELOG.md --- cargo-0.35.0/vendor/atty/CHANGELOG.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/atty/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -1,3 +1,11 @@ +# 0.2.13 + +* support older versions of rust that do now support 2018 edition + +# 0.2.12 + +* Redox is now in the unix family so redox cfg is no longer needed [#35](https://github.com/softprops/atty/pull/35) + # 0.2.11 * fix msys detection with `winapi@0.3.5` [#28](https://github.com/softprops/atty/pull/28) diff -Nru cargo-0.35.0/vendor/atty/LICENSE cargo-0.37.0/vendor/atty/LICENSE --- cargo-0.35.0/vendor/atty/LICENSE 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/atty/LICENSE 2019-07-17 05:42:23.000000000 +0000 @@ -1,4 +1,4 @@ -Copyright (c) 2015-2017 Doug Tangren +Copyright (c) 2015-2019 Doug Tangren Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff -Nru cargo-0.35.0/vendor/atty/README.md cargo-0.37.0/vendor/atty/README.md --- cargo-0.35.0/vendor/atty/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/atty/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -17,8 +17,6 @@ ## usage ```rust -extern crate atty; - use atty::Stream; fn main() { @@ -73,4 +71,4 @@ stdin? true ``` -Doug Tangren (softprops) 2015-2017 +Doug Tangren (softprops) 2015-2019 diff -Nru cargo-0.35.0/vendor/atty/rustfmt.toml cargo-0.37.0/vendor/atty/rustfmt.toml --- cargo-0.35.0/vendor/atty/rustfmt.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/atty/rustfmt.toml 2019-07-17 05:42:23.000000000 +0000 @@ -1,10 +1,4 @@ -# keep imports tidy -reorder_imported_names = true -reorder_imports = true -reorder_imports_in_group = true -# there is no try! -use_try_shorthand = true -# don't create rustfmt artifacts -write_mode = "Replace" -# reduce wide load -max_width = 80 \ No newline at end of file +# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#fn_args_layout +fn_args_layout = "Vertical" +# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#merge_imports +merge_imports = true \ No newline at end of file diff -Nru cargo-0.35.0/vendor/atty/src/lib.rs cargo-0.37.0/vendor/atty/src/lib.rs --- cargo-0.35.0/vendor/atty/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/atty/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -21,8 +21,6 @@ extern crate libc; #[cfg(windows)] extern crate winapi; -#[cfg(target_os = "redox")] -extern crate termion; #[cfg(windows)] use winapi::shared::minwindef::DWORD; @@ -53,8 +51,10 @@ /// returns true if this is a tty #[cfg(windows)] pub fn is(stream: Stream) -> bool { - use winapi::um::winbase::{STD_ERROR_HANDLE as STD_ERROR, STD_INPUT_HANDLE as STD_INPUT, - STD_OUTPUT_HANDLE as STD_OUTPUT}; + use winapi::um::winbase::{ + STD_ERROR_HANDLE as STD_ERROR, STD_INPUT_HANDLE as STD_INPUT, + STD_OUTPUT_HANDLE as STD_OUTPUT, + }; let (fd, others) = match stream { Stream::Stdin => (STD_INPUT, [STD_ERROR, STD_OUTPUT]), @@ -88,8 +88,7 @@ /// Returns true if any of the given fds are on a console. #[cfg(windows)] unsafe fn console_on_any(fds: &[DWORD]) -> bool { - use winapi::um::consoleapi::GetConsoleMode; - use winapi::um::processenv::GetStdHandle; + use winapi::um::{consoleapi::GetConsoleMode, processenv::GetStdHandle}; for &fd in fds { let mut out = 0; @@ -104,15 +103,16 @@ /// Returns true if there is an MSYS tty on the given handle. #[cfg(windows)] unsafe fn msys_tty_on(fd: DWORD) -> bool { - use std::mem; - use std::slice; + use std::{mem, slice}; - use winapi::ctypes::c_void; - use winapi::um::winbase::GetFileInformationByHandleEx; - use winapi::um::fileapi::FILE_NAME_INFO; - use winapi::um::minwinbase::FileNameInfo; - use winapi::um::processenv::GetStdHandle; - use winapi::shared::minwindef::MAX_PATH; + use winapi::{ + ctypes::c_void, + shared::minwindef::MAX_PATH, + um::{ + fileapi::FILE_NAME_INFO, minwinbase::FileNameInfo, processenv::GetStdHandle, + winbase::GetFileInformationByHandleEx, + }, + }; let size = mem::size_of::(); let mut name_info_bytes = vec![0u8; size + MAX_PATH * mem::size_of::()]; @@ -141,19 +141,6 @@ } /// returns true if this is a tty -#[cfg(target_os = "redox")] -pub fn is(stream: Stream) -> bool { - use std::io; - use termion::is_tty; - - match stream { - Stream::Stdin => is_tty(&io::stdin()), - Stream::Stdout => is_tty(&io::stdout()), - Stream::Stderr => is_tty(&io::stderr()), - } -} - -/// returns true if this is a tty #[cfg(target_arch = "wasm32")] pub fn is(_stream: Stream) -> bool { false @@ -161,7 +148,7 @@ #[cfg(test)] mod tests { - use super::{Stream, is}; + use super::{is, Stream}; #[test] #[cfg(windows)] diff -Nru cargo-0.35.0/vendor/autocfg/.cargo-checksum.json cargo-0.37.0/vendor/autocfg/.cargo-checksum.json --- cargo-0.35.0/vendor/autocfg/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/autocfg/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799"} \ No newline at end of file +{"files":{},"package":"22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/autocfg/Cargo.toml cargo-0.37.0/vendor/autocfg/Cargo.toml --- cargo-0.35.0/vendor/autocfg/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/autocfg/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,7 +12,7 @@ [package] name = "autocfg" -version = "0.1.2" +version = "0.1.5" authors = ["Josh Stone "] description = "Automatic cfg for Rust compiler features" readme = "README.md" diff -Nru cargo-0.35.0/vendor/autocfg/README.md cargo-0.37.0/vendor/autocfg/README.md --- cargo-0.35.0/vendor/autocfg/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/autocfg/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -43,7 +43,17 @@ ## Release Notes -- 0.1.2 (2018-01-16) +- 0.1.5 (2019-07-16) + - Mask some warnings from newer rustc. + +- 0.1.4 (2019-05-22) + - Relax `std`/`no_std` probing to a warning instead of an error. + - Improve `rustc` bootstrap compatibility. + +- 0.1.3 (2019-05-21) + - Auto-detects if `#![no_std]` is needed for the `$TARGET` + +- 0.1.2 (2019-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` diff -Nru cargo-0.35.0/vendor/autocfg/src/lib.rs cargo-0.37.0/vendor/autocfg/src/lib.rs --- cargo-0.35.0/vendor/autocfg/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/autocfg/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -36,13 +36,20 @@ #![deny(missing_debug_implementations)] #![deny(missing_docs)] +// allow future warnings that can't be fixed while keeping 1.0 compatibility +#![allow(unknown_lints)] +#![allow(bare_trait_objects)] +#![allow(ellipsis_inclusive_range_patterns)] use std::env; use std::ffi::OsString; use std::fs; -use std::io::Write; +use std::io::{stderr, Write}; use std::path::PathBuf; use std::process::{Command, Stdio}; +#[allow(deprecated)] +use std::sync::atomic::ATOMIC_USIZE_INIT; +use std::sync::atomic::{AtomicUsize, Ordering}; mod error; pub use error::Error; @@ -60,6 +67,7 @@ rustc: PathBuf, rustc_version: Version, target: Option, + no_std: bool, } /// Writes a config flag for rustc on standard out. @@ -137,12 +145,25 @@ return Err(error::from_str("output path is not a writable directory")); } - Ok(AutoCfg { + let mut ac = AutoCfg { out_dir: dir, rustc: rustc, rustc_version: rustc_version, target: env::var_os("TARGET"), - }) + no_std: false, + }; + + // Sanity check with and without `std`. + if !ac.probe("").unwrap_or(false) { + ac.no_std = true; + if !ac.probe("").unwrap_or(false) { + // Neither worked, so assume nothing... + ac.no_std = false; + let warning = b"warning: autocfg could not probe for `std`\n"; + stderr().write_all(warning).ok(); + } + } + Ok(ac) } /// Test whether the current `rustc` reports a version greater than @@ -160,14 +181,14 @@ } fn probe>(&self, code: T) -> Result { - use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; - + #[allow(deprecated)] 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-name") + .arg(format!("probe{}", id)) .arg("--crate-type=lib") .arg("--out-dir") .arg(&self.out_dir) @@ -179,14 +200,13 @@ 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 mut stdin = child.stdin.take().expect("rustc stdin"); + + if self.no_std { + try!(stdin.write_all(b"#![no_std]\n").map_err(error::from_io)); + } + try!(stdin.write_all(code.as_ref()).map_err(error::from_io)); + drop(stdin); let status = try!(child.wait().map_err(error::from_io)); Ok(status.success()) @@ -284,5 +304,6 @@ .map(|c| match c { 'A'...'Z' | 'a'...'z' | '0'...'9' => c, _ => '_', - }).collect() + }) + .collect() } diff -Nru cargo-0.35.0/vendor/autocfg/src/tests.rs cargo-0.37.0/vendor/autocfg/src/tests.rs --- cargo-0.35.0/vendor/autocfg/src/tests.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/autocfg/src/tests.rs 2019-07-17 05:42:23.000000000 +0000 @@ -55,3 +55,11 @@ assert!(missing ^ ac.probe_trait("std::iter::Sum")); assert!(missing ^ ac.probe_type("std::iter::Sum")); } + +#[test] +fn probe_no_std() { + let ac = AutoCfg::with_dir("target").unwrap(); + assert!(ac.probe_type("i32")); + assert!(ac.probe_type("[i32]")); + assert_eq!(ac.probe_type("Vec"), !ac.no_std); +} diff -Nru cargo-0.35.0/vendor/autocfg/src/version.rs cargo-0.37.0/vendor/autocfg/src/version.rs --- cargo-0.35.0/vendor/autocfg/src/version.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/autocfg/src/version.rs 2019-07-17 05:42:23.000000000 +0000 @@ -24,12 +24,10 @@ pub fn from_rustc(rustc: &Path) -> Result { // Get rustc's verbose version - let output = try!( - Command::new(rustc) - .args(&["--version", "--verbose"]) - .output() - .map_err(error::from_io) - ); + 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")); } diff -Nru cargo-0.35.0/vendor/backtrace/azure-pipelines.yml cargo-0.37.0/vendor/backtrace/azure-pipelines.yml --- cargo-0.35.0/vendor/backtrace/azure-pipelines.yml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/azure-pipelines.yml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ - script: cargo build displayName: "Build crate" variables: - TOOLCHAIN: 1.25.0 + TOOLCHAIN: 1.32.0 - job: Docker pool: @@ -32,7 +32,7 @@ matrix: aarch64: TARGET: aarch64-unknown-linux-gnu - armhv: + armhf: TARGET: arm-unknown-linux-gnueabihf armv7: TARGET: armv7-unknown-linux-gnueabihf @@ -140,6 +140,9 @@ TARGET: x86_64-pc-windows-msvc i686-msvc: TARGET: i686-pc-windows-msvc + # this looks to be required to get full fidelity of backtrace + # information on 32-bit MSVC + RUSTFLAGS: -Cforce-frame-pointers x86_64-gnu: TARGET: x86_64-pc-windows-gnu i686-gnu: diff -Nru cargo-0.35.0/vendor/backtrace/build.rs cargo-0.37.0/vendor/backtrace/build.rs --- cargo-0.35.0/vendor/backtrace/build.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/build.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -extern crate autocfg; - -fn main() { - let ac = autocfg::new(); - - // ffi types moved from `std` to `core` in Rust 1.30, so we need to adjust imports based on - // this. - // - // - ac.emit_rustc_version(1, 30); - - println!("cargo:rerun-if-changed=build.rs"); -} diff -Nru cargo-0.35.0/vendor/backtrace/.cargo-checksum.json cargo-0.37.0/vendor/backtrace/.cargo-checksum.json --- cargo-0.35.0/vendor/backtrace/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"56acb7e9c23cb8c3a1f51713695c552a81ee667d9fd060d1ef407908480b7174"} \ No newline at end of file +{"files":{},"package":"18b50f5258d1a9ad8396d2d345827875de4261b158124d4c819d9b351454fae5"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/backtrace/Cargo.toml cargo-0.37.0/vendor/backtrace/Cargo.toml --- cargo-0.35.0/vendor/backtrace/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -11,17 +11,18 @@ # will likely look very different (and much more reasonable) [package] +edition = "2018" name = "backtrace" -version = "0.3.16" -authors = ["Alex Crichton ", "The Rust Project Developers"] +version = "0.3.32" +authors = ["The Rust Project Developers"] autoexamples = true autotests = true description = "A library to acquire a stack trace (backtrace) at runtime in a Rust program.\n" -homepage = "https://github.com/alexcrichton/backtrace-rs" +homepage = "https://github.com/rust-lang/backtrace-rs" documentation = "https://docs.rs/backtrace" readme = "README.md" license = "MIT/Apache-2.0" -repository = "https://github.com/alexcrichton/backtrace-rs" +repository = "https://github.com/rust-lang/backtrace-rs" [[example]] name = "backtrace" @@ -43,9 +44,16 @@ name = "smoke" required-features = ["std"] edition = "2018" + +[[test]] +name = "accuracy" +required-features = ["std", "dbghelp", "libbacktrace", "libunwind"] +edition = "2018" [dependencies.addr2line] version = "0.9.0" +features = ["std", "std-object"] optional = true +default-features = false [dependencies.backtrace-sys] version = "0.1.17" @@ -54,14 +62,28 @@ [dependencies.cfg-if] version = "0.1.6" +[dependencies.compiler_builtins] +version = "0.1.2" +optional = true + +[dependencies.core] +version = "1.0.0" +optional = true +package = "rustc-std-workspace-core" + [dependencies.cpp_demangle] version = "0.2.3" optional = true default-features = false [dependencies.findshlibs] -version = "0.4.1" +version = "0.5.0" +optional = true + +[dependencies.goblin] +version = "0.0.22" optional = true +default-features = false [dependencies.libc] version = "0.2.45" @@ -80,25 +102,21 @@ [dependencies.serde] version = "1.0" +features = ["derive"] optional = true -[dependencies.serde_derive] -version = "1.0" -optional = true -[build-dependencies.autocfg] -version = "0.1" - [features] coresymbolication = [] dbghelp = [] -default = ["std", "libunwind", "libbacktrace", "coresymbolication", "dladdr", "dbghelp"] +default = ["std", "libunwind", "libbacktrace", "dladdr", "dbghelp"] dladdr = [] -gimli-symbolize = ["addr2line", "findshlibs", "memmap"] +gimli-symbolize = ["addr2line", "findshlibs", "memmap", "goblin"] kernel32 = [] libbacktrace = ["backtrace-sys"] libunwind = [] +rustc-dep-of-std = ["backtrace-sys/rustc-dep-of-std", "cfg-if/rustc-dep-of-std", "core", "compiler_builtins", "libc/rustc-dep-of-std", "rustc-demangle/rustc-dep-of-std"] serialize-rustc = ["rustc-serialize"] -serialize-serde = ["serde", "serde_derive"] +serialize-serde = ["serde"] std = [] unix-backtrace = [] verify-winapi = ["winapi/dbghelp", "winapi/handleapi", "winapi/libloaderapi", "winapi/minwindef", "winapi/processthreadsapi", "winapi/winbase", "winapi/winnt"] diff -Nru cargo-0.35.0/vendor/backtrace/ci/azure-install-rust.yml cargo-0.37.0/vendor/backtrace/ci/azure-install-rust.yml --- cargo-0.35.0/vendor/backtrace/ci/azure-install-rust.yml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/ci/azure-install-rust.yml 2019-07-17 05:42:23.000000000 +0000 @@ -5,15 +5,17 @@ if [ "$toolchain" = "" ]; then toolchain=stable fi - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $toolchain - echo "##vso[task.prependpath]$HOME/.cargo/bin" + if command -v rustup; then + rustup update --no-self-update $toolchain + rustup default $toolchain + else + curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $toolchain + echo "##vso[task.prependpath]$HOME/.cargo/bin" + fi displayName: Install rust (unix) condition: ne( variables['Agent.OS'], 'Windows_NT' ) - - script: | - curl -sSf -o rustup-init.exe https://win.rustup.rs - rustup-init.exe -y --default-toolchain stable-%TARGET% - echo ##vso[task.prependpath]%USERPROFILE%\.cargo\bin + - bash: rustup update --no-self-update stable-$TARGET && rustup default stable-$TARGET displayName: Install rust (windows) condition: eq( variables['Agent.OS'], 'Windows_NT' ) diff -Nru cargo-0.35.0/vendor/backtrace/ci/azure-test-all.yml cargo-0.37.0/vendor/backtrace/ci/azure-test-all.yml --- cargo-0.35.0/vendor/backtrace/ci/azure-test-all.yml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/ci/azure-test-all.yml 2019-07-17 05:42:23.000000000 +0000 @@ -3,12 +3,14 @@ submodules: true - template: azure-install-rust.yml - - bash: cargo build --manifest-path backtrace-sys/Cargo.toml + - bash: cargo build --manifest-path crates/backtrace-sys/Cargo.toml displayName: "Build backtrace-sys" - bash: cargo build displayName: "Build backtrace" - bash: cargo test displayName: "Test backtrace" + - bash: cargo test --features 'gimli-symbolize' + displayName: "Test backtrace (gimli-symbolize)" - bash: cargo test --no-default-features displayName: "Test backtrace (-default)" - bash: cargo test --no-default-features --features 'std' @@ -19,12 +21,20 @@ displayName: "Test backtrace (-default + libunwind + dladdr)" - bash: cargo test --no-default-features --features 'libunwind libbacktrace std' displayName: "Test backtrace (-default + libunwind + libbacktrace)" + - bash: cargo test --no-default-features --features 'libunwind libbacktrace dbghelp std' + displayName: "Test backtrace (-default + libunwind + libbacktrace + dbghelp)" + - bash: cargo test --no-default-features --features 'libunwind coresymbolication dbghelp std' + displayName: "Test backtrace (-default + libunwind + coresymbolication + dbghelp)" + - bash: cargo test --no-default-features --features 'libunwind coresymbolication dbghelp std libbacktrace' + displayName: "Test backtrace (-default + libunwind + coresymbolication + dbghelp + libbacktrace)" - bash: cargo test --no-default-features --features 'unix-backtrace std' displayName: "Test backtrace (-default + unix-backtrace)" - bash: cargo test --no-default-features --features 'unix-backtrace dladdr std' displayName: "Test backtrace (-default + unix-backtrace + dladdr)" - bash: cargo test --no-default-features --features 'unix-backtrace libbacktrace std' displayName: "Test backtrace (-default + unix-backtrace + libbacktrace)" + - bash: cargo test --no-default-features --features 'unix-backtrace coresymbolication std' + displayName: "Test backtrace (-default + unix-backtrace + coresymbolication)" - bash: cargo test --no-default-features --features 'serialize-serde std' displayName: "Test backtrace (-default + serialize-serde + std)" - bash: cargo test --no-default-features --features 'serialize-rustc std' @@ -33,11 +43,17 @@ displayName: "Test backtrace (-default + serialize-rustc + serialize-serde + std)" - bash: cargo test --no-default-features --features 'cpp_demangle std' displayName: "Test backtrace (-default + cpp_demangle + std)" - - bash: cargo test --no-default-features --features 'gimli-symbolize std' - displayName: "Test backtrace (-default + gimli-symbolize + std)" - bash: cargo test --no-default-features --features 'dbghelp std' displayName: "Test backtrace (-default + dbghelp + std)" - bash: cargo test --no-default-features --features 'dbghelp std verify-winapi' displayName: "Test backtrace (-default + dbghelp + std + verify-winapi)" - - bash: cd ./cpp_smoke_test && cargo test + - bash: cd ./crates/cpp_smoke_test && cargo test displayName: "Test cpp_smoke_test" + - bash: cd ./crates/without_debuginfo && cargo test --features libbacktrace + displayName: "Test without debuginfo (libbacktrace)" + - bash: cd ./crates/without_debuginfo && cargo test --features 'libbacktrace coresymbolication' + displayName: "Test without debuginfo (coresymbolication)" + # TODO: there's a bug on stable Rust right now (1.35.0) which prevents testing + # gimli here, so disable this temporarily until 1.36.0 is released. + # - bash: cd ./crates/without_debuginfo && cargo test --features 'libbacktrace gimli-symbolize' + # displayName: "Test without debuginfo (gimli-symbolize)" diff -Nru cargo-0.35.0/vendor/backtrace/ci/run-docker.sh cargo-0.37.0/vendor/backtrace/ci/run-docker.sh --- cargo-0.35.0/vendor/backtrace/ci/run-docker.sh 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/ci/run-docker.sh 2019-07-17 05:42:23.000000000 +0000 @@ -10,7 +10,7 @@ --user `id -u`:`id -g` \ --rm \ --init \ - --volume $HOME/.cargo:/cargo \ + --volume $(dirname $(dirname `which cargo`)):/cargo \ --env CARGO_HOME=/cargo \ --volume `rustc --print sysroot`:/rust:ro \ --env TARGET=$1 \ diff -Nru cargo-0.35.0/vendor/backtrace/debian/patches/series cargo-0.37.0/vendor/backtrace/debian/patches/series --- cargo-0.35.0/vendor/backtrace/debian/patches/series 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -update-dep-object.patch diff -Nru cargo-0.35.0/vendor/backtrace/debian/patches/update-dep-object.patch cargo-0.37.0/vendor/backtrace/debian/patches/update-dep-object.patch --- cargo-0.35.0/vendor/backtrace/debian/patches/update-dep-object.patch 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/debian/patches/update-dep-object.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ---- a/Cargo.toml -+++ b/Cargo.toml -@@ -67,7 +67,7 @@ - optional = true - - [dependencies.object] --version = "0.9.0" -+version = "0.11" - optional = true - - [dependencies.rustc-demangle] diff -Nru cargo-0.35.0/vendor/backtrace/.pc/applied-patches cargo-0.37.0/vendor/backtrace/.pc/applied-patches --- cargo-0.35.0/vendor/backtrace/.pc/applied-patches 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/.pc/applied-patches 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -update-dep-object.patch diff -Nru cargo-0.35.0/vendor/backtrace/.pc/.quilt_patches cargo-0.37.0/vendor/backtrace/.pc/.quilt_patches --- cargo-0.35.0/vendor/backtrace/.pc/.quilt_patches 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/.pc/.quilt_patches 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -debian/patches diff -Nru cargo-0.35.0/vendor/backtrace/.pc/.quilt_series cargo-0.37.0/vendor/backtrace/.pc/.quilt_series --- cargo-0.35.0/vendor/backtrace/.pc/.quilt_series 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/.pc/.quilt_series 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -series diff -Nru cargo-0.35.0/vendor/backtrace/.pc/update-dep-object.patch/Cargo.toml cargo-0.37.0/vendor/backtrace/.pc/update-dep-object.patch/Cargo.toml --- cargo-0.35.0/vendor/backtrace/.pc/update-dep-object.patch/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/.pc/update-dep-object.patch/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 @@ -1,107 +0,0 @@ -# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO -# -# When uploading crates to the registry Cargo will automatically -# "normalize" Cargo.toml files for maximal compatibility -# with all versions of Cargo and also rewrite `path` dependencies -# 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 = "backtrace" -version = "0.3.16" -authors = ["Alex Crichton ", "The Rust Project Developers"] -autoexamples = true -autotests = true -description = "A library to acquire a stack trace (backtrace) at runtime in a Rust program.\n" -homepage = "https://github.com/alexcrichton/backtrace-rs" -documentation = "https://docs.rs/backtrace" -readme = "README.md" -license = "MIT/Apache-2.0" -repository = "https://github.com/alexcrichton/backtrace-rs" - -[[example]] -name = "backtrace" -required-features = ["std"] - -[[example]] -name = "raw" -required-features = ["std"] - -[[test]] -name = "skip_inner_frames" -required-features = ["std"] - -[[test]] -name = "long_fn_name" -required-features = ["std"] - -[[test]] -name = "smoke" -required-features = ["std"] -edition = "2018" -[dependencies.addr2line] -version = "0.9.0" -optional = true - -[dependencies.backtrace-sys] -version = "0.1.17" -optional = true - -[dependencies.cfg-if] -version = "0.1.6" - -[dependencies.cpp_demangle] -version = "0.2.3" -optional = true -default-features = false - -[dependencies.findshlibs] -version = "0.4.1" -optional = true - -[dependencies.libc] -version = "0.2.45" -default-features = false - -[dependencies.memmap] -version = "0.7.0" -optional = true - -[dependencies.rustc-demangle] -version = "0.1.4" - -[dependencies.rustc-serialize] -version = "0.3" -optional = true - -[dependencies.serde] -version = "1.0" -optional = true - -[dependencies.serde_derive] -version = "1.0" -optional = true -[build-dependencies.autocfg] -version = "0.1" - -[features] -coresymbolication = [] -dbghelp = [] -default = ["std", "libunwind", "libbacktrace", "coresymbolication", "dladdr", "dbghelp"] -dladdr = [] -gimli-symbolize = ["addr2line", "findshlibs", "memmap"] -kernel32 = [] -libbacktrace = ["backtrace-sys"] -libunwind = [] -serialize-rustc = ["rustc-serialize"] -serialize-serde = ["serde", "serde_derive"] -std = [] -unix-backtrace = [] -verify-winapi = ["winapi/dbghelp", "winapi/handleapi", "winapi/libloaderapi", "winapi/minwindef", "winapi/processthreadsapi", "winapi/winbase", "winapi/winnt"] -[target."cfg(windows)".dependencies.winapi] -version = "0.3.3" -optional = true diff -Nru cargo-0.35.0/vendor/backtrace/.pc/.version cargo-0.37.0/vendor/backtrace/.pc/.version --- cargo-0.35.0/vendor/backtrace/.pc/.version 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/.pc/.version 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -2 diff -Nru cargo-0.35.0/vendor/backtrace/README.md cargo-0.37.0/vendor/backtrace/README.md --- cargo-0.35.0/vendor/backtrace/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -1,13 +1,13 @@ # backtrace-rs -[![Build Status](https://travis-ci.com/alexcrichton/backtrace-rs.svg?branch=master)](https://travis-ci.com/alexcrichton/backtrace-rs) -[![Build status](https://ci.appveyor.com/api/projects/status/v4l9oj4aqbbgyx44?svg=true)](https://ci.appveyor.com/project/alexcrichton/backtrace-rs) +[![Build Status](https://dev.azure.com/rust-lang/backtrace-rs/_apis/build/status/rust-lang.backtrace-rs?branchName=master)](https://dev.azure.com/rust-lang/backtrace-rs/_build/latest?definitionId=12&branchName=master) [Documentation](https://docs.rs/backtrace) A library for acquiring backtraces at runtime for Rust. This library aims to -enhance the support of the standard library by providing a more stable and -programmatic interface. +enhance the support of the standard library by providing a programmatic +interface to work with, but it also supports simply easily printing the current +backtrace like libstd's panics. ## Install @@ -16,12 +16,9 @@ backtrace = "0.3" ``` -```rust -extern crate backtrace; -``` - -Note that this crate requires `make`, `objcopy`, and `ar` to be present on Linux -systems. +Note that this crate requires `cc` and `ar` to be present on Unix systems when +`libbacktrace` is used (which is the default). For configuring C compilers see +the [`cc` crate documentation](https://github.com/alexcrichton/cc-rs). ## Usage @@ -68,11 +65,6 @@ } ``` -## Platform Support - -This library currently supports OSX, Linux, and Windows. Support for other -platforms is always welcome! - # License This project is licensed under either of diff -Nru cargo-0.35.0/vendor/backtrace/src/backtrace/dbghelp.rs cargo-0.37.0/vendor/backtrace/src/backtrace/dbghelp.rs --- cargo-0.35.0/vendor/backtrace/src/backtrace/dbghelp.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/backtrace/dbghelp.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,14 +8,23 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +//! Backtrace strategy for MSVC platforms. +//! +//! This module contains the ability to generate a backtrace on MSVC using one +//! of two possible methods. The `StackWalkEx` function is primarily used if +//! possible, but not all systems have that. Failing that the `StackWalk64` +//! function is used instead. Note that `StackWalkEx` is favored because it +//! handles debuginfo internally and returns inline frame information. +//! +//! Note that all dbghelp support is loaded dynamically, see `src/dbghelp.rs` +//! for more information about that. + #![allow(bad_style)] +use core::ffi::c_void; use core::mem; -use core::prelude::v1::*; - -use dbghelp; -use windows::*; -use types::c_void; +use crate::dbghelp; +use crate::windows::*; #[derive(Clone, Copy)] pub enum Frame { @@ -181,3 +190,16 @@ frame.addr_frame_mut().Mode = AddrModeFlat; IMAGE_FILE_MACHINE_ARM64 } + +#[cfg(target_arch = "arm")] +fn init_frame(frame: &mut Frame, ctx: &CONTEXT) -> WORD { + frame.addr_pc_mut().Offset = ctx.Pc as u64; + frame.addr_pc_mut().Mode = AddrModeFlat; + frame.addr_stack_mut().Offset = ctx.Sp as u64; + frame.addr_stack_mut().Mode = AddrModeFlat; + unsafe { + frame.addr_frame_mut().Offset = ctx.R11 as u64; + } + frame.addr_frame_mut().Mode = AddrModeFlat; + IMAGE_FILE_MACHINE_ARMNT +} diff -Nru cargo-0.35.0/vendor/backtrace/src/backtrace/libunwind.rs cargo-0.37.0/vendor/backtrace/src/backtrace/libunwind.rs --- cargo-0.35.0/vendor/backtrace/src/backtrace/libunwind.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/backtrace/libunwind.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,7 +8,24 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use types::c_void; +//! Backtrace support using libunwind/gcc_s/etc APIs. +//! +//! This module contains the ability to unwind the stack using libunwind-style +//! APIs. Note that there's a whole bunch of implementations of the +//! libunwind-like API, and this is just trying to be compatible with most of +//! them all at once instead of being picky. +//! +//! The libunwind API is powered by `_Unwind_Backtrace` and is in practice very +//! reliable at generating a backtrace. It's not entirely clear how it does it +//! (frame pointers? eh_frame info? both?) but it seems to work! +//! +//! Most of the complexity of this module is handling the various platform +//! differences across libunwind implementations. Otherwise this is a pretty +//! straightforward Rust binding to the libunwind APIs. +//! +//! This is the default unwinding API for all non-Windows platforms currently. + +use core::ffi::c_void; pub enum Frame { Raw(*mut uw::_Unwind_Context), @@ -31,16 +48,9 @@ Frame::Raw(ctx) => ctx, Frame::Cloned { ip, .. } => return ip, }; - let mut ip_before_insn = 0; - let mut ip = unsafe { - uw::_Unwind_GetIPInfo(ctx, &mut ip_before_insn) as *mut c_void - }; - if !ip.is_null() && ip_before_insn == 0 { - // this is a non-signaling frame, so `ip` refers to the address - // after the calling instruction. account for that. - ip = (ip as usize - 1) as *mut _; + unsafe { + uw::_Unwind_GetIP(ctx) as *mut c_void } - return ip } pub fn symbol_address(&self) -> *mut c_void { @@ -48,16 +58,14 @@ return symbol_address; } - // dladdr() on osx gets whiny when we use FindEnclosingFunction, and - // it appears to work fine without it, so we only use - // FindEnclosingFunction on non-osx platforms. In doing so, we get a - // slightly more accurate stack trace in the process. + // It seems that on OSX `_Unwind_FindEnclosingFunction` returns a + // pointer to... something that's unclear. It's definitely not always + // the enclosing function for whatever reason. It's not entirely clear + // to me what's going on here, so pessimize this for now and just always + // return the ip. // - // This is often because panic involves the last instruction of a - // function being "call std::rt::begin_unwind", with no ret - // instructions after it. This means that the return instruction - // pointer points *outside* of the calling function, and by - // unwinding it we go back to the original function. + // Note the `skip_inner_frames.rs` test is skipped on OSX due to this + // clause, and if this is fixed that test in theory can be run on OSX! if cfg!(target_os = "macos") || cfg!(target_os = "ios") { self.ip() } else { @@ -86,7 +94,7 @@ inner: Frame::Raw(ctx), }; - let mut bomb = ::Bomb { enabled: true }; + let mut bomb = crate::Bomb { enabled: true }; let keep_going = cb(&cx); bomb.enabled = false; @@ -109,8 +117,7 @@ mod uw { pub use self::_Unwind_Reason_Code::*; - use libc::{self, c_int}; - use types::c_void; + use core::ffi::c_void; #[repr(C)] pub enum _Unwind_Reason_Code { @@ -143,8 +150,7 @@ #[cfg(all(not(all(target_os = "android", target_arch = "arm")), not(all(target_os = "freebsd", target_arch = "arm")), not(all(target_os = "linux", target_arch = "arm"))))] - pub fn _Unwind_GetIPInfo(ctx: *mut _Unwind_Context, - ip_before_insn: *mut c_int) + pub fn _Unwind_GetIP(ctx: *mut _Unwind_Context) -> libc::uintptr_t; #[cfg(all(not(target_os = "android"), @@ -203,19 +209,6 @@ (val & !1) as libc::uintptr_t } - // This function doesn't exist on Android or ARM/Linux, so make it same - // to _Unwind_GetIP - #[cfg(any(all(target_os = "android", target_arch = "arm"), - all(target_os = "freebsd", target_arch = "arm"), - all(target_os = "linux", target_arch = "arm")))] - pub unsafe fn _Unwind_GetIPInfo(ctx: *mut _Unwind_Context, - ip_before_insn: *mut c_int) - -> libc::uintptr_t - { - *ip_before_insn = 0; - _Unwind_GetIP(ctx) - } - // This function also doesn't exist on Android or ARM/Linux, so make it // a no-op #[cfg(any(target_os = "android", diff -Nru cargo-0.35.0/vendor/backtrace/src/backtrace/mod.rs cargo-0.37.0/vendor/backtrace/src/backtrace/mod.rs --- cargo-0.35.0/vendor/backtrace/src/backtrace/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/backtrace/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,5 +1,5 @@ +use core::ffi::c_void; use core::fmt; -use types::c_void; /// Inspects the current call-stack, passing all active frames into the closure /// provided to calculate a stack trace. @@ -27,6 +27,13 @@ /// This function requires the `std` feature of the `backtrace` crate to be /// enabled, and the `std` feature is enabled by default. /// +/// # Panics +/// +/// This function strives to never panic, but if the `cb` provided panics then +/// some platforms will force a double panic to abort the process. Some +/// platforms use a C library which internally uses callbacks which cannot be +/// unwound through, so panicking from `cb` may trigger a process abort. +/// /// # Example /// /// ``` @@ -42,7 +49,7 @@ /// ``` #[cfg(feature = "std")] pub fn trace bool>(cb: F) { - let _guard = ::lock::lock(); + let _guard = crate::lock::lock(); unsafe { trace_unsynchronized(cb) } } @@ -51,6 +58,10 @@ /// This function does not have synchronization guarentees but is available /// when the `std` feature of this crate isn't compiled in. See the `trace` /// function for more documentation and examples. +/// +/// # Panics +/// +/// See information on `trace` for caveats on `cb` panicking. pub unsafe fn trace_unsynchronized bool>(mut cb: F) { trace_imp(&mut cb) } @@ -101,22 +112,32 @@ } } -cfg_if! { - if #[cfg(any(all(unix, - not(target_os = "emscripten"), - not(all(target_os = "ios", target_arch = "arm")), - feature = "libunwind"), - target_env="sgx"))] { +cfg_if::cfg_if! { + if #[cfg( + any( + all( + unix, + not(target_os = "emscripten"), + not(all(target_os = "ios", target_arch = "arm")), + feature = "libunwind", + ), + target_env = "sgx", + ) + )] { mod libunwind; use self::libunwind::trace as trace_imp; pub(crate) use self::libunwind::Frame as FrameImp; - } else if #[cfg(all(unix, - not(target_os = "emscripten"), - feature = "unix-backtrace"))] { + } else if #[cfg( + all( + unix, + not(target_os = "emscripten"), + feature = "unix-backtrace", + ) + )] { mod unix_backtrace; use self::unix_backtrace::trace as trace_imp; pub(crate) use self::unix_backtrace::Frame as FrameImp; - } else if #[cfg(all(windows, feature = "dbghelp"))] { + } else if #[cfg(all(windows, feature = "dbghelp", not(target_vendor = "uwp")))] { mod dbghelp; use self::dbghelp::trace as trace_imp; pub(crate) use self::dbghelp::Frame as FrameImp; diff -Nru cargo-0.35.0/vendor/backtrace/src/backtrace/noop.rs cargo-0.37.0/vendor/backtrace/src/backtrace/noop.rs --- cargo-0.35.0/vendor/backtrace/src/backtrace/noop.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/backtrace/noop.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,4 +1,7 @@ -use types::c_void; +//! Empty implementation of unwinding used when no other implementation is +//! appropriate. + +use core::ffi::c_void; #[inline(always)] pub fn trace(_cb: &mut FnMut(&super::Frame) -> bool) {} diff -Nru cargo-0.35.0/vendor/backtrace/src/backtrace/unix_backtrace.rs cargo-0.37.0/vendor/backtrace/src/backtrace/unix_backtrace.rs --- cargo-0.35.0/vendor/backtrace/src/backtrace/unix_backtrace.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/backtrace/unix_backtrace.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,11 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +//! Unwinding through the `backtrace` function provided in Unix. +//! +//! This is an alternative unwinding strategy for Unix platforms which don't +//! have support for libunwind but do have support for `backtrace`. Currently +//! there's not a whole lot of those though. This module is a relatively +//! straightforward binding of the `backtrace` API to the `Frame` API that we'd +//! like to have. + +use core::ffi::c_void; use core::mem; use libc::c_int; -use types::c_void; - #[derive(Clone)] pub struct Frame { addr: usize, diff -Nru cargo-0.35.0/vendor/backtrace/src/capture.rs cargo-0.37.0/vendor/backtrace/src/capture.rs --- cargo-0.35.0/vendor/backtrace/src/capture.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/capture.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,9 +1,11 @@ +use crate::{resolve, resolve_frame, trace, Symbol, SymbolName}; +use std::ffi::c_void; use std::fmt; use std::path::{Path, PathBuf}; use std::prelude::v1::*; -use types::c_void; -use {resolve, resolve_frame, trace, Symbol, SymbolName}; +#[cfg(feature = "serde")] +use serde::{Serialize, Deserialize}; /// Representation of an owned and self-contained backtrace. /// @@ -12,9 +14,14 @@ /// /// `Backtrace` supports pretty-printing of backtraces through its `Debug` /// implementation. +/// +/// # Required features +/// +/// This function requires the `std` feature of the `backtrace` crate to be +/// enabled, and the `std` feature is enabled by default. #[derive(Clone)] #[cfg_attr(feature = "serialize-rustc", derive(RustcDecodable, RustcEncodable))] -#[cfg_attr(feature = "serialize-serde", derive(Deserialize, Serialize))] +#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] pub struct Backtrace { // Frames here are listed from top-to-bottom of the stack frames: Vec, @@ -32,6 +39,11 @@ /// /// This type is returned as a list from `Backtrace::frames` and represents one /// stack frame in a captured backtrace. +/// +/// # Required features +/// +/// This function requires the `std` feature of the `backtrace` crate to be +/// enabled, and the `std` feature is enabled by default. #[derive(Clone)] pub struct BacktraceFrame { frame: Frame, @@ -40,9 +52,12 @@ #[derive(Clone)] enum Frame { - Raw(::Frame), + Raw(crate::Frame), #[allow(dead_code)] - Deserialized { ip: usize, symbol_address: usize }, + Deserialized { + ip: usize, + symbol_address: usize, + }, } impl Frame { @@ -65,9 +80,14 @@ /// /// This type is returned as a list from `BacktraceFrame::symbols` and /// represents the metadata for a symbol in a backtrace. +/// +/// # Required features +/// +/// This function requires the `std` feature of the `backtrace` crate to be +/// enabled, and the `std` feature is enabled by default. #[derive(Clone)] #[cfg_attr(feature = "serialize-rustc", derive(RustcDecodable, RustcEncodable))] -#[cfg_attr(feature = "serialize-serde", derive(Deserialize, Serialize))] +#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] pub struct BacktraceSymbol { name: Option>, addr: Option, @@ -84,6 +104,12 @@ /// elsewhere, and the purpose of this value is to be entirely self /// contained. /// + /// Note that on some platforms acquiring a full backtrace and resolving it + /// can be extremely expensive. If the cost is too much for your application + /// it's recommended to instead use `Backtrace::new_unresolved()` which + /// avoids the symbol resolution step (which typically takes the longest) + /// and allows deferring that to a later date. + /// /// # Examples /// /// ``` @@ -91,6 +117,11 @@ /// /// let current_backtrace = Backtrace::new(); /// ``` + /// + /// # Required features + /// + /// This function requires the `std` feature of the `backtrace` crate to be + /// enabled, and the `std` feature is enabled by default. #[inline(never)] // want to make sure there's a frame here to remove pub fn new() -> Backtrace { let _guard = lock_and_platform_init(); @@ -117,6 +148,11 @@ /// current_backtrace.resolve(); /// println!("{:?}", current_backtrace); // symbol names now present /// ``` + /// + /// # Required features + /// + /// This function requires the `std` feature of the `backtrace` crate to be + /// enabled, and the `std` feature is enabled by default. #[inline(never)] // want to make sure there's a frame here to remove pub fn new_unresolved() -> Backtrace { let _guard = lock_and_platform_init(); @@ -124,23 +160,15 @@ } fn create(ip: usize) -> Backtrace { - let ip_lo = ip; - let ip_hi = ip + 128; - let mut frames = Vec::new(); let mut actual_start_index = None; trace(|frame| { - let ip = frame.ip() as usize; frames.push(BacktraceFrame { frame: Frame::Raw(frame.clone()), symbols: None, }); - if cfg!(not(all(target_os = "windows", target_arch = "x86"))) - && ip >= ip_lo - && ip <= ip_hi - && actual_start_index.is_none() - { + if frame.symbol_address() as usize == ip && actual_start_index.is_none() { actual_start_index = Some(frames.len()); } true @@ -157,6 +185,11 @@ /// The first entry of this slice is likely the function `Backtrace::new`, /// and the last frame is likely something about how this thread or the main /// function started. + /// + /// # Required features + /// + /// This function requires the `std` feature of the `backtrace` crate to be + /// enabled, and the `std` feature is enabled by default. pub fn frames(&self) -> &[BacktraceFrame] { &self.frames[self.actual_start_index..] } @@ -166,6 +199,11 @@ /// /// If this backtrace has been previously resolved or was created through /// `new`, this function does nothing. + /// + /// # Required features + /// + /// This function requires the `std` feature of the `backtrace` crate to be + /// enabled, and the `std` feature is enabled by default. pub fn resolve(&mut self) { let _guard = lock_and_platform_init(); for frame in self.frames.iter_mut().filter(|f| f.symbols.is_none()) { @@ -208,11 +246,21 @@ impl BacktraceFrame { /// Same as `Frame::ip` + /// + /// # Required features + /// + /// This function requires the `std` feature of the `backtrace` crate to be + /// enabled, and the `std` feature is enabled by default. pub fn ip(&self) -> *mut c_void { self.frame.ip() as *mut c_void } /// Same as `Frame::symbol_address` + /// + /// # Required features + /// + /// This function requires the `std` feature of the `backtrace` crate to be + /// enabled, and the `std` feature is enabled by default. pub fn symbol_address(&self) -> *mut c_void { self.frame.symbol_address() as *mut c_void } @@ -226,6 +274,11 @@ /// /// Note that if this frame came from an unresolved backtrace then this will /// return an empty list. + /// + /// # Required features + /// + /// This function requires the `std` feature of the `backtrace` crate to be + /// enabled, and the `std` feature is enabled by default. pub fn symbols(&self) -> &[BacktraceSymbol] { self.symbols.as_ref().map(|s| &s[..]).unwrap_or(&[]) } @@ -233,21 +286,41 @@ impl BacktraceSymbol { /// Same as `Symbol::name` + /// + /// # Required features + /// + /// This function requires the `std` feature of the `backtrace` crate to be + /// enabled, and the `std` feature is enabled by default. pub fn name(&self) -> Option { self.name.as_ref().map(|s| SymbolName::new(s)) } /// Same as `Symbol::addr` + /// + /// # Required features + /// + /// This function requires the `std` feature of the `backtrace` crate to be + /// enabled, and the `std` feature is enabled by default. pub fn addr(&self) -> Option<*mut c_void> { self.addr.map(|s| s as *mut c_void) } /// Same as `Symbol::filename` + /// + /// # Required features + /// + /// This function requires the `std` feature of the `backtrace` crate to be + /// enabled, and the `std` feature is enabled by default. pub fn filename(&self) -> Option<&Path> { self.filename.as_ref().map(|p| &**p) } /// Same as `Symbol::lineno` + /// + /// # Required features + /// + /// This function requires the `std` feature of the `backtrace` crate to be + /// enabled, and the `std` feature is enabled by default. pub fn lineno(&self) -> Option { self.lineno } @@ -434,7 +507,7 @@ } } -#[cfg(feature = "serialize-serde")] +#[cfg(feature = "serde")] mod serde_impls { extern crate serde; diff -Nru cargo-0.35.0/vendor/backtrace/src/dbghelp.rs cargo-0.37.0/vendor/backtrace/src/dbghelp.rs --- cargo-0.35.0/vendor/backtrace/src/dbghelp.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/dbghelp.rs 2019-07-17 05:42:23.000000000 +0000 @@ -14,23 +14,29 @@ //! be in the business of duplicating winapi, so we have a Cargo feature //! `verify-winapi` which asserts that all bindings match those in winapi and //! this feature is enabled on CI. +//! +//! Finally, you'll note here that the dll for `dbghelp.dll` is never unloaded, +//! and that's currently intentional. The thinking is that we can globally cache +//! it and use it between calls to the API, avoiding expensive loads/unloads. If +//! this is a problem for leak detectors or something like that we can cross the +//! bridge when we get there. #![allow(non_snake_case)] +use crate::windows::*; use core::mem; use core::ptr; -use windows::*; // Work around `SymGetOptions` and `SymSetOptions` not being present in winapi // itself. Otherwise this is only used when we're double-checking types against // winapi. #[cfg(feature = "verify-winapi")] mod dbghelp { + use crate::windows::*; pub use winapi::um::dbghelp::{ StackWalk64, SymCleanup, SymFromAddrW, SymFunctionTableAccess64, SymGetLineFromAddrW64, SymGetModuleBase64, SymInitializeW, }; - use windows::*; extern "system" { // Not defined in winapi yet @@ -104,24 +110,13 @@ /// error if `LoadLibraryW` fails. /// /// Panics if library is already loaded. - fn open(&mut self) -> Result<(), ()> { - assert!(self.dll.is_null()); - let lib = [ - 'd' as u16, - 'b' as u16, - 'g' as u16, - 'h' as u16, - 'e' as u16, - 'l' as u16, - 'p' as u16, - '.' as u16, - 'd' as u16, - 'l' as u16, - 'l' as u16, - 0, - ]; + fn ensure_open(&mut self) -> Result<(), ()> { + if !self.dll.is_null() { + return Ok(()) + } + let lib = b"dbghelp.dll\0"; unsafe { - self.dll = LoadLibraryW(lib.as_ptr()); + self.dll = LoadLibraryA(lib.as_ptr() as *const i8); if self.dll.is_null() { Err(()) } else { @@ -130,17 +125,6 @@ } } - /// Unloads `dbghelp.dll`, resetting all function pointers to zero - /// as well. - fn close(&mut self) { - assert!(!self.dll.is_null()); - unsafe { - $(self.$name = 0;)* - FreeLibrary(self.dll); - self.dll = ptr::null_mut(); - } - } - // Function for each method we'd like to use. When called it will // either read the cached function pointer or load it and return the // loaded value. Loads are asserted to succeed. @@ -293,7 +277,7 @@ // Actually load `dbghelp.dll` into the process here, returning an error if // that fails. - DBGHELP.open()?; + DBGHELP.ensure_open()?; OPTS_ORIG = DBGHELP.SymGetOptions().unwrap()(); @@ -307,7 +291,6 @@ // Symbols may have been initialized by another library or an // external debugger DBGHELP.SymSetOptions().unwrap()(OPTS_ORIG); - DBGHELP.close(); Err(()) } else { COUNT += 1; @@ -330,13 +313,6 @@ // backtrace is finished. DBGHELP.SymCleanup().unwrap()(GetCurrentProcess()); DBGHELP.SymSetOptions().unwrap()(OPTS_ORIG); - - // We can in theory leak this to stay in a global and we simply - // always reuse it, but for now let's be tidy and release all our - // resources. If we get bug reports the we could basically elide - // this `close()` (and the one above) and then update `open` to be a - // noop if it's already opened. - DBGHELP.close(); } } } diff -Nru cargo-0.35.0/vendor/backtrace/src/dylib.rs cargo-0.37.0/vendor/backtrace/src/dylib.rs --- cargo-0.35.0/vendor/backtrace/src/dylib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/dylib.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -use core::marker; -use core::mem; -use core::sync::atomic::{AtomicUsize, Ordering}; - -use libc::{self, c_char, c_void}; - -pub struct Dylib { - pub init: AtomicUsize, -} - -pub struct Symbol { - pub name: &'static str, - pub addr: AtomicUsize, - pub _marker: marker::PhantomData, -} - -impl Dylib { - pub unsafe fn get<'a, T>(&self, sym: &'a Symbol) -> Option<&'a T> { - self.load().and_then(|handle| sym.get(handle)) - } - - pub unsafe fn init(&self, path: &str) -> bool { - if self.init.load(Ordering::SeqCst) != 0 { - return true; - } - assert!(path.as_bytes()[path.len() - 1] == 0); - let ptr = libc::dlopen(path.as_ptr() as *const c_char, libc::RTLD_LAZY); - if ptr.is_null() { - return false; - } - match self - .init - .compare_and_swap(0, ptr as usize, Ordering::SeqCst) - { - 0 => {} - _ => { - libc::dlclose(ptr); - } - } - return true; - } - - unsafe fn load(&self) -> Option<*mut c_void> { - match self.init.load(Ordering::SeqCst) { - 0 => None, - n => Some(n as *mut c_void), - } - } -} - -impl Symbol { - unsafe fn get(&self, handle: *mut c_void) -> Option<&T> { - assert_eq!(mem::size_of::(), mem::size_of_val(&self.addr)); - if self.addr.load(Ordering::SeqCst) == 0 { - self.addr - .store(fetch(handle, self.name.as_ptr()), Ordering::SeqCst) - } - if self.addr.load(Ordering::SeqCst) == 1 { - None - } else { - mem::transmute::<&AtomicUsize, Option<&T>>(&self.addr) - } - } -} - -unsafe fn fetch(handle: *mut c_void, name: *const u8) -> usize { - let ptr = libc::dlsym(handle, name as *const _); - if ptr.is_null() { - 1 - } else { - ptr as usize - } -} diff -Nru cargo-0.35.0/vendor/backtrace/src/lib.rs cargo-0.37.0/vendor/backtrace/src/lib.rs --- cargo-0.35.0/vendor/backtrace/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -17,12 +17,6 @@ //! of defaults is chosen for the current platform, but the features activated //! can also be controlled at a finer granularity. //! -//! # Platform Support -//! -//! Currently this library is verified to work on Linux, OSX, and Windows, but -//! it may work on other platforms as well. Note that the quality of the -//! backtrace may vary across platforms. -//! //! # API Principles //! //! This library attempts to be as flexible as possible to accommodate different @@ -71,59 +65,29 @@ #![doc(html_root_url = "https://docs.rs/backtrace")] #![deny(missing_docs)] #![no_std] -#![cfg_attr(target_env = "sgx", feature(sgx_platform))] +#![cfg_attr(all(feature = "std", target_env = "sgx"), feature(sgx_platform))] +#![allow(bare_trait_objects)] // TODO: remove when updating to 2018 edition +#![allow(rust_2018_idioms)] // TODO: remove when updating to 2018 edition #[cfg(feature = "std")] #[macro_use] extern crate std; -extern crate libc; -#[cfg(all(windows, feature = "verify-winapi"))] -extern crate winapi; - -#[cfg(feature = "serde_derive")] -#[cfg_attr(feature = "serde_derive", macro_use)] -extern crate serde_derive; - -#[cfg(feature = "rustc-serialize")] -extern crate rustc_serialize; - -#[macro_use] -extern crate cfg_if; - -extern crate rustc_demangle; - -#[cfg(feature = "cpp_demangle")] -extern crate cpp_demangle; - -cfg_if! { - if #[cfg(all(feature = "gimli-symbolize", unix, target_os = "linux"))] { - extern crate addr2line; - extern crate findshlibs; - extern crate memmap; - } -} - -#[allow(dead_code)] // not used everywhere -#[cfg(unix)] -#[macro_use] -mod dylib; - -pub use backtrace::{trace_unsynchronized, Frame}; +pub use crate::backtrace::{trace_unsynchronized, Frame}; mod backtrace; -pub use symbolize::{resolve_unsynchronized, Symbol, SymbolName}; -pub use symbolize::resolve_frame_unsynchronized; +pub use crate::symbolize::resolve_frame_unsynchronized; +pub use crate::symbolize::{resolve_unsynchronized, Symbol, SymbolName}; mod symbolize; -pub use types::BytesOrWideString; +pub use crate::types::BytesOrWideString; mod types; -cfg_if! { +cfg_if::cfg_if! { if #[cfg(feature = "std")] { - pub use backtrace::trace; - pub use symbolize::{resolve, resolve_frame}; - pub use capture::{Backtrace, BacktraceFrame, BacktraceSymbol}; + pub use crate::backtrace::trace; + pub use crate::symbolize::{resolve, resolve_frame}; + pub use crate::capture::{Backtrace, BacktraceFrame, BacktraceSymbol}; mod capture; } } @@ -180,7 +144,7 @@ } } -#[cfg(all(windows, feature = "dbghelp"))] +#[cfg(all(windows, feature = "dbghelp", not(target_vendor = "uwp")))] mod dbghelp; #[cfg(windows)] mod windows; diff -Nru cargo-0.35.0/vendor/backtrace/src/symbolize/coresymbolication.rs cargo-0.37.0/vendor/backtrace/src/symbolize/coresymbolication.rs --- cargo-0.35.0/vendor/backtrace/src/symbolize/coresymbolication.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/symbolize/coresymbolication.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,27 +8,38 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +//! Symbolication strategy that's OSX-specific and uses the `CoreSymbolication` +//! framework, if possible. +//! +//! This strategy uses internal private APIs that are somewhat undocumented but +//! seem to be widely used on OSX. This is the default symbolication strategy +//! for OSX, but is turned off in release builds for iOS due to reports of apps +//! being rejected due to using these APIs. +//! +//! This would probably be good to get official one day and not using private +//! APIs, but for now it should largely suffice. +//! +//! Note that this module will dynamically load `CoreSymbolication` and its APIs +//! through dlopen/dlsym, and if the loading fails this falls back to `dladdr` +//! as a symbolication strategy. + #![allow(bad_style)] +use crate::symbolize::dladdr; +use crate::symbolize::ResolveWhat; +use crate::types::BytesOrWideString; +use crate::SymbolName; +use core::ffi::c_void; use core::mem; use core::ptr; use core::slice; -#[allow(deprecated)] // atomic initializer is relative new currently -use core::sync::atomic::ATOMIC_USIZE_INIT; - -use libc::{self, Dl_info, c_char, c_int}; - -use SymbolName; -use dylib::Dylib; -use dylib::Symbol as DylibSymbol; -use types::{BytesOrWideString, c_void}; -use symbolize::ResolveWhat; +use libc::{c_char, c_int}; #[repr(C)] #[derive(Copy, Clone, PartialEq)] pub struct CSTypeRef { cpp_data: *const c_void, - cpp_obj: *const c_void + cpp_obj: *const c_void, } const CS_NOW: u64 = 0x80000000; @@ -44,14 +55,14 @@ name: *const c_char, addr: *mut c_void, }, - Dladdr(Dl_info), + Dladdr(dladdr::Symbol), } impl Symbol { pub fn name(&self) -> Option { let name = match *self { Symbol::Core { name, .. } => name, - Symbol::Dladdr(ref info) => info.dli_sname, + Symbol::Dladdr(ref info) => return info.name(), }; if name.is_null() { None @@ -66,7 +77,7 @@ pub fn addr(&self) -> Option<*mut c_void> { match *self { Symbol::Core { addr, .. } => Some(addr), - Symbol::Dladdr(ref info) => Some(info.dli_saddr as *mut _), + Symbol::Dladdr(ref info) => info.addr(), } } @@ -92,9 +103,9 @@ #[cfg(feature = "std")] pub fn filename(&self) -> Option<&::std::path::Path> { + use std::ffi::OsStr; use std::os::unix::prelude::*; use std::path::Path; - use std::ffi::OsStr; self.filename_bytes().map(OsStr::from_bytes).map(Path::new) } @@ -108,27 +119,75 @@ } } -#[allow(deprecated)] // atomic initializer is relative new currently -static CORESYMBOLICATION: Dylib = Dylib { init: ATOMIC_USIZE_INIT }; +macro_rules! coresymbolication { + (#[load_path = $path:tt] extern "C" { + $(fn $name:ident($($arg:ident: $argty:ty),*) -> $ret: ty;)* + }) => ( + pub struct CoreSymbolication { + // The loaded dynamic library + dll: *mut c_void, + + // Each function pointer for each function we might use + $($name: usize,)* + } + + static mut CORESYMBOLICATION: CoreSymbolication = CoreSymbolication { + // Initially we haven't loaded the dynamic library + dll: 0 as *mut _, + // Initiall all functions are set to zero to say they need to be + // dynamically loaded. + $($name: 0,)* + }; -macro_rules! dlsym { - (extern { - $(fn $name:ident($($arg:ident: $t:ty),*) -> $ret:ty;)* - }) => ($( - #[allow(deprecated)] // atomic initializer is relative new currently - static $name: ::dylib::Symbol $ret> = - ::dylib::Symbol { - name: concat!(stringify!($name), "\0"), - addr: ::core::sync::atomic::ATOMIC_USIZE_INIT, - _marker: ::core::marker::PhantomData, - }; - )*) + // Convenience typedef for each function type. + $(pub type $name = unsafe extern "C" fn($($argty),*) -> $ret;)* + + impl CoreSymbolication { + /// Attempts to open `dbghelp.dll`. Returns `true` if it works or + /// `false` if `dlopen` fails. + fn open(&mut self) -> bool { + if !self.dll.is_null() { + return true; + } + let lib = concat!($path, "\0").as_bytes(); + unsafe { + self.dll = libc::dlopen(lib.as_ptr() as *const _, libc::RTLD_LAZY); + !self.dll.is_null() + } + } + + // Function for each method we'd like to use. When called it will + // either read the cached function pointer or load it and return the + // loaded value. Loads are asserted to succeed. + $(pub fn $name(&mut self) -> $name { + unsafe { + if self.$name == 0 { + let name = concat!(stringify!($name), "\0"); + self.$name = self.symbol(name.as_bytes()) + .expect(concat!("symbol ", stringify!($name), " is missing")); + } + mem::transmute::(self.$name) + } + })* + + fn symbol(&self, symbol: &[u8]) -> Option { + unsafe { + match libc::dlsym(self.dll, symbol.as_ptr() as *const _) as usize { + 0 => None, + n => Some(n), + } + } + } + } + ) } -dlsym! { - extern { +coresymbolication! { + #[load_path = "/System/Library/PrivateFrameworks/CoreSymbolication.framework\ + /Versions/A/CoreSymbolication"] + extern "C" { fn CSSymbolicatorCreateWithPid(pid: c_int) -> CSTypeRef; - fn CSRelease(rf: CSTypeRef) -> c_void; + fn CSRelease(rf: CSTypeRef) -> (); fn CSSymbolicatorGetSymbolWithAddressAtTime( cs: CSTypeRef, addr: *const c_void, time: u64) -> CSTypeRef; fn CSSymbolicatorGetSourceInfoWithAddressAtTime( @@ -142,67 +201,77 @@ } } -unsafe fn get(sym: &DylibSymbol) -> &T { - CORESYMBOLICATION.get(sym).unwrap() -} - unsafe fn try_resolve(addr: *mut c_void, cb: &mut FnMut(&super::Symbol)) -> bool { - let path = "/System/Library/PrivateFrameworks/CoreSymbolication.framework\ - /Versions/A/CoreSymbolication\0"; - if !CORESYMBOLICATION.init(path) { + // Note that this is externally synchronized so there's no need for + // synchronization here, making this `static mut` safer. + let lib = &mut CORESYMBOLICATION; + if !lib.open() { return false; } - let cs = get(&CSSymbolicatorCreateWithPid)(libc::getpid()); + let cs = lib.CSSymbolicatorCreateWithPid()(libc::getpid()); if cs == CSREF_NULL { - return false + return false; } + let _dtor = OwnedCSTypeRef { + ptr: cs, + CSRelease: lib.CSRelease(), + }; - let info = get(&CSSymbolicatorGetSourceInfoWithAddressAtTime)( - cs, addr, CS_NOW); + let info = lib.CSSymbolicatorGetSourceInfoWithAddressAtTime()(cs, addr, CS_NOW); let sym = if info == CSREF_NULL { - get(&CSSymbolicatorGetSymbolWithAddressAtTime)(cs, addr, CS_NOW) + lib.CSSymbolicatorGetSymbolWithAddressAtTime()(cs, addr, CS_NOW) } else { - get(&CSSourceInfoGetSymbol)(info) + lib.CSSourceInfoGetSymbol()(info) }; + if sym == CSREF_NULL { + return false; + } + let owner = lib.CSSymbolGetSymbolOwner()(sym); + if owner == CSREF_NULL { + return false; + } + + cb(&super::Symbol { + inner: Symbol::Core { + path: if info != CSREF_NULL { + lib.CSSourceInfoGetPath()(info) + } else { + ptr::null() + }, + lineno: if info != CSREF_NULL { + lib.CSSourceInfoGetLineNumber()(info) as u32 + } else { + 0 + }, + name: lib.CSSymbolGetMangledName()(sym), + addr: lib.CSSymbolOwnerGetBaseAddress()(owner), + }, + }); + true +} - let mut rv = false; - if sym != CSREF_NULL { - let owner = get(&CSSymbolGetSymbolOwner)(sym); - if owner != CSREF_NULL { - cb(&super::Symbol { - inner: Symbol::Core { - path: if info != CSREF_NULL { - get(&CSSourceInfoGetPath)(info) - } else { - ptr::null() - }, - lineno: if info != CSREF_NULL { - get(&CSSourceInfoGetLineNumber)(info) as u32 - } else { - 0 - }, - name: get(&CSSymbolGetMangledName)(sym), - addr: get(&CSSymbolOwnerGetBaseAddress)(owner), - }, - }); - rv = true; +struct OwnedCSTypeRef { + ptr: CSTypeRef, + CSRelease: unsafe extern "C" fn(CSTypeRef), +} + +impl Drop for OwnedCSTypeRef { + fn drop(&mut self) { + unsafe { + (self.CSRelease)(self.ptr); } } - get(&CSRelease)(cs); - - rv } pub unsafe fn resolve(what: ResolveWhat, cb: &mut FnMut(&super::Symbol)) { let addr = what.address_or_ip(); if try_resolve(addr, cb) { - return + return; } - let mut info: Dl_info = mem::zeroed(); - if libc::dladdr(addr as *mut _, &mut info) != 0 { + dladdr::resolve(addr, &mut |sym| { cb(&super::Symbol { - inner: Symbol::Dladdr(info), - }); - } + inner: Symbol::Dladdr(sym), + }) + }) } diff -Nru cargo-0.35.0/vendor/backtrace/src/symbolize/dbghelp.rs cargo-0.37.0/vendor/backtrace/src/symbolize/dbghelp.rs --- cargo-0.35.0/vendor/backtrace/src/symbolize/dbghelp.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/symbolize/dbghelp.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,28 +8,36 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +//! Symbolication strategy using `dbghelp.dll` on Windows, only used for MSVC +//! +//! This symbolication strategy, like with backtraces, uses dynamically loaded +//! information from `dbghelp.dll`. (see `src/dbghelp.rs` for info about why +//! it's dynamically loaded). +//! +//! This API selects its resolution strategy based on the frame provided or the +//! information we have at hand. If a frame from `StackWalkEx` is given to us +//! then we use similar APIs to generate correct information about inlined +//! functions. Otherwise if all we have is an address or an older stack frame +//! from `StackWalk64` we use the older APIs for symbolication. +//! +//! There's a good deal of support in this module, but a good chunk of it is +//! converting back and forth between Windows types and Rust types. For example +//! symbols come to us as wide strings which we then convert to utf-8 strings if +//! we can. + #![allow(bad_style)] -// This is a hack for compatibility with rustc 1.25.0. The no_std mode of this -// crate is not supported pre-1.30.0, but in std mode the `char` module here -// moved in rustc 1.26.0 (ish). As a result, in std mode we use `std::char` to -// retain compatibility with rustc 1.25.0, but in `no_std` mode (which is -// 1.30.0+ already) we use `core::char`. -#[cfg(not(feature = "std"))] +use crate::backtrace::FrameImp as Frame; +use crate::dbghelp; +use crate::symbolize::ResolveWhat; +use crate::types::BytesOrWideString; +use crate::windows::*; +use crate::SymbolName; use core::char; -#[cfg(feature = "std")] -use std::char; - +use core::ffi::c_void; use core::mem; use core::slice; -use backtrace::FrameImp as Frame; -use dbghelp; -use symbolize::ResolveWhat; -use types::{c_void, BytesOrWideString}; -use windows::*; -use SymbolName; - // Store an OsString on std so we can provide the symbol name and filename. pub struct Symbol { name: *const [u8], @@ -79,7 +87,7 @@ }; match what { - ResolveWhat::Address(addr) => resolve_without_inline(&dbghelp, addr, cb), + ResolveWhat::Address(_) => resolve_without_inline(&dbghelp, what.address_or_ip(), cb), ResolveWhat::Frame(frame) => match &frame.inner { Frame::New(frame) => resolve_with_inline(&dbghelp, frame, cb), Frame::Old(_) => resolve_without_inline(&dbghelp, frame.ip(), cb), @@ -96,7 +104,7 @@ |info| { dbghelp.SymFromInlineContextW()( GetCurrentProcess(), - frame.AddrPC.Offset, + super::adjust_ip(frame.AddrPC.Offset as *mut _) as u64, frame.InlineFrameContext, &mut 0, info, @@ -105,7 +113,7 @@ |line| { dbghelp.SymGetLineFromInlineContextW()( GetCurrentProcess(), - frame.AddrPC.Offset, + super::adjust_ip(frame.AddrPC.Offset as *mut _) as u64, frame.InlineFrameContext, 0, &mut 0, diff -Nru cargo-0.35.0/vendor/backtrace/src/symbolize/dladdr_resolve.rs cargo-0.37.0/vendor/backtrace/src/symbolize/dladdr_resolve.rs --- cargo-0.35.0/vendor/backtrace/src/symbolize/dladdr_resolve.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/symbolize/dladdr_resolve.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,52 @@ +// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Symbolication strategy using `dladdr` +//! +//! The `dladdr` API is available on most Unix implementations but it's quite +//! basic, not handling inline frame information at all. Since it's so prevalent +//! though we have an option to use it! + +use core::ffi::c_void; +use crate::types::BytesOrWideString; +use crate::symbolize::{dladdr, SymbolName, ResolveWhat}; + +pub struct Symbol(dladdr::Symbol); + +impl Symbol { + pub fn name(&self) -> Option { + self.0.name() + } + + pub fn addr(&self) -> Option<*mut c_void> { + self.0.addr() + } + + pub fn filename_raw(&self) -> Option { + self.0.filename_raw() + } + + #[cfg(feature = "std")] + pub fn filename(&self) -> Option<&::std::path::Path> { + self.0.filename() + } + + pub fn lineno(&self) -> Option { + self.0.lineno() + } +} + +pub unsafe fn resolve(what: ResolveWhat, cb: &mut FnMut(&super::Symbol)) { + dladdr::resolve(what.address_or_ip(), &mut |sym| { + cb(&super::Symbol { + inner: Symbol(sym), + }) + }); +} diff -Nru cargo-0.35.0/vendor/backtrace/src/symbolize/dladdr.rs cargo-0.37.0/vendor/backtrace/src/symbolize/dladdr.rs --- cargo-0.35.0/vendor/backtrace/src/symbolize/dladdr.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/symbolize/dladdr.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,57 +8,95 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::{mem, slice}; +//! Common support for resolving with `dladdr`, often used as a fallback if +//! other strategies don't work. -use types::{BytesOrWideString, c_void}; -use libc::{self, Dl_info}; -use symbolize::ResolveWhat; +#![allow(dead_code)] -use SymbolName; +cfg_if::cfg_if! { + if #[cfg(all(unix, not(target_os = "emscripten"), feature = "dladdr"))] { + use core::{mem, slice}; + use crate::types::BytesOrWideString; + use core::ffi::c_void; + use libc::{self, Dl_info}; -pub struct Symbol { - inner: Dl_info, -} + use crate::SymbolName; + + pub struct Symbol { + inner: Dl_info, + } + + impl Symbol { + pub fn name(&self) -> Option { + if self.inner.dli_sname.is_null() { + None + } else { + let ptr = self.inner.dli_sname as *const u8; + unsafe { + let len = libc::strlen(self.inner.dli_sname); + Some(SymbolName::new(slice::from_raw_parts(ptr, len))) + } + } + } + + pub fn addr(&self) -> Option<*mut c_void> { + Some(self.inner.dli_saddr as *mut _) + } -impl Symbol { - pub fn name(&self) -> Option { - if self.inner.dli_sname.is_null() { - None - } else { - let ptr = self.inner.dli_sname as *const u8; - unsafe { - let len = libc::strlen(self.inner.dli_sname); - Some(SymbolName::new(slice::from_raw_parts(ptr, len))) + pub fn filename_raw(&self) -> Option { + None + } + + #[cfg(feature = "std")] + pub fn filename(&self) -> Option<&::std::path::Path> { + None + } + + pub fn lineno(&self) -> Option { + None } } - } - pub fn addr(&self) -> Option<*mut c_void> { - Some(self.inner.dli_saddr as *mut _) - } + pub unsafe fn resolve(addr: *mut c_void, cb: &mut FnMut(Symbol)) { + let mut info = Symbol { + inner: mem::zeroed(), + }; + if libc::dladdr(addr as *mut _, &mut info.inner) != 0 { + cb(info) + } + } + } else { + use core::ffi::c_void; + use crate::types::BytesOrWideString; + use crate::symbolize::SymbolName; + + pub enum Symbol {} + + impl Symbol { + pub fn name(&self) -> Option { + match *self {} + } - pub fn filename_raw(&self) -> Option { - None - } + pub fn addr(&self) -> Option<*mut c_void> { + match *self {} + } - #[cfg(feature = "std")] - pub fn filename(&self) -> Option<&::std::path::Path> { - None - } + pub fn filename_raw(&self) -> Option { + match *self {} + } - pub fn lineno(&self) -> Option { - None - } -} + #[cfg(feature = "std")] + pub fn filename(&self) -> Option<&::std::path::Path> { + match *self {} + } + + pub fn lineno(&self) -> Option { + match *self {} + } + } -pub unsafe fn resolve(what: ResolveWhat, cb: &mut FnMut(&super::Symbol)) { - let addr = what.address_or_ip(); - let mut info: super::Symbol = super::Symbol { - inner: Symbol { - inner: mem::zeroed(), - }, - }; - if libc::dladdr(addr as *mut _, &mut info.inner.inner) != 0 { - cb(&info) + pub unsafe fn resolve(addr: *mut c_void, cb: &mut FnMut(Symbol)) { + drop((addr, cb)); + } } } diff -Nru cargo-0.35.0/vendor/backtrace/src/symbolize/gimli.rs cargo-0.37.0/vendor/backtrace/src/symbolize/gimli.rs --- cargo-0.35.0/vendor/backtrace/src/symbolize/gimli.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/symbolize/gimli.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,55 +1,139 @@ -use addr2line; +//! Support for symbolication using the `gimli` crate on crates.io +//! +//! This implementation is largely a work in progress and is off by default for +//! all platforms, but it's hoped to be developed over time! Long-term this is +//! intended to wholesale replace the `libbacktrace.rs` implementation. + +use self::gimli::read::EndianRcSlice; +use self::gimli::RunTimeEndian; +use crate::symbolize::dladdr; +use crate::symbolize::ResolveWhat; +use crate::types::BytesOrWideString; +use crate::SymbolName; +use addr2line::gimli; use addr2line::object::{self, Object}; +use core::cell::RefCell; +use core::convert::TryFrom; +use core::mem; +use core::u32; use findshlibs::{self, Segment, SharedLibrary}; use libc::c_void; use memmap::Mmap; -use std::cell::RefCell; use std::env; use std::fs::File; -use std::mem; use std::path::{Path, PathBuf}; use std::prelude::v1::*; -use std::u32; - -use symbolize::ResolveWhat; -use types::BytesOrWideString; -use SymbolName; const MAPPINGS_CACHE_SIZE: usize = 4; -type Dwarf = addr2line::Context; type Symbols<'map> = object::SymbolMap<'map>; struct Mapping { - dwarf: Dwarf, + dwarf: addr2line::Context, // 'static lifetime is a lie to hack around lack of support for self-referential structs. symbols: Symbols<'static>, _map: Mmap, } +macro_rules! mk { + (Mapping { $map:expr, $object:expr }) => {{ + Mapping { + dwarf: addr2line::Context::new(&$object).ok()?, + // Convert to 'static lifetimes since the symbols should + // only borrow `map` and we're preserving `map` below. + // + // TODO: how do we know that `symbol_map` *only* borrows `map`? + symbols: unsafe { mem::transmute::>($object.symbol_map()) }, + _map: $map, + } + }}; +} + +fn mmap(path: &Path) -> Option { + let file = File::open(path).ok()?; + // TODO: not completely safe, see https://github.com/danburkert/memmap-rs/issues/25 + unsafe { Mmap::map(&file).ok() } +} + impl Mapping { - fn new(path: &PathBuf) -> Option { - let file = File::open(path).ok()?; - // TODO: not completely safe, see https://github.com/danburkert/memmap-rs/issues/25 - let map = unsafe { Mmap::map(&file).ok()? }; - let (dwarf, symbols) = { - let object = object::ElfFile::parse(&*map).ok()?; - let dwarf = addr2line::Context::new(&object).ok()?; - let symbols = object.symbol_map(); - // Convert to 'static lifetimes. - (dwarf, unsafe { mem::transmute(symbols) }) - }; - Some(Mapping { - dwarf, - symbols, - _map: map, - }) + fn new(path: &Path) -> Option { + if cfg!(target_os = "macos") { + Mapping::new_find_dsym(path) + } else { + let map = mmap(path)?; + let object = object::ElfFile::parse(&map).ok()?; + Some(mk!(Mapping { map, object })) + } + } + + fn new_find_dsym(path: &Path) -> Option { + // First up we need to load the unique UUID which is stored in the macho + // header of the file we're reading, specified at `path`. + let map = mmap(path)?; + let object = object::MachOFile::parse(&map).ok()?; + let uuid = get_uuid(&object)?; + + // Next we need to look for a `*.dSYM` file. For now we just probe the + // containing directory and look around for something that matches + // `*.dSYM`. Once it's found we root through the dwarf resources that it + // contains and try to find a macho file which has a matching UUID as + // the one of our own file. If we find a match that's the dwarf file we + // want to return. + let parent = path.parent()?; + for entry in parent.read_dir().ok()? { + let entry = entry.ok()?; + let filename = match entry.file_name().into_string() { + Ok(name) => name, + Err(_) => continue, + }; + if !filename.ends_with(".dSYM") { + continue; + } + let candidates = entry.path().join("Contents/Resources/DWARF"); + if let Some(mapping) = load_dsym(&candidates, &uuid) { + return Some(mapping); + } + } + + // Looks like nothing matched our UUID, so let's at least return our own + // file. This should have the symbol table for at least some + // symbolication purposes. + return Some(mk!(Mapping { map, object })); + + fn load_dsym(dir: &Path, uuid: &[u8]) -> Option { + for entry in dir.read_dir().ok()? { + let entry = entry.ok()?; + let map = mmap(&entry.path())?; + let object = object::MachOFile::parse(&map).ok()?; + let entry_uuid = get_uuid(&object)?; + if &entry_uuid[..] != uuid { + continue; + } + return Some(mk!(Mapping { map, object })); + } + + None + } + + fn get_uuid(object: &object::MachOFile) -> Option<[u8; 16]> { + use goblin::mach::load_command::CommandVariant; + + object + .macho() + .load_commands + .iter() + .filter_map(|cmd| match cmd.command { + CommandVariant::Uuid(u) => Some(u.uuid), + _ => None, + }) + .next() + } } // Ensure the 'static lifetimes don't leak. fn rent(&self, mut f: F) where - F: FnMut(&Dwarf, &Symbols), + F: FnMut(&addr2line::Context, &Symbols), { f(&self.dwarf, &self.symbols) } @@ -72,7 +156,7 @@ fn with_mapping_for_path(path: PathBuf, f: F) where - F: FnMut(&Dwarf, &Symbols), + F: FnMut(&addr2line::Context, &Symbols), { MAPPINGS_CACHE.with(|cache| { let mut cache = cache.borrow_mut(); @@ -108,8 +192,13 @@ }); } -pub fn resolve(what: ResolveWhat, cb: &mut FnMut(&super::Symbol)) { +pub unsafe fn resolve(what: ResolveWhat, cb: &mut FnMut(&super::Symbol)) { let addr = what.address_or_ip(); + let mut cb = DladdrFallback { + cb, + addr, + called: false, + }; // First, find the file containing the segment that the given AVMA (after // relocation) address falls within. Use the containing segment to compute @@ -157,17 +246,15 @@ let mut found_sym = false; if let Ok(mut frames) = dwarf.find_frames(addr.0 as u64) { while let Ok(Some(frame)) = frames.next() { - let (file, line) = frame - .location - .map(|l| (l.file, l.line)) - .unwrap_or((None, None)); - let name = frame - .function - .and_then(|f| f.raw_name().ok().map(|f| f.to_string())); - let sym = super::Symbol { - inner: Symbol::new(addr.0 as usize, file, line, name), - }; - cb(&sym); + let name = frame.function.as_ref().and_then(|f| f.raw_name().ok()); + let name = name.as_ref().map(|n| n.as_bytes() as *const _); + cb.call(&super::Symbol { + inner: Symbol::Frame { + addr: addr.0 as *mut c_void, + frame, + name, + }, + }); found_sym = true; } } @@ -176,56 +263,124 @@ if !found_sym { if let Some(name) = symbols.get(addr.0 as u64).and_then(|x| x.name()) { let sym = super::Symbol { - inner: Symbol::new(addr.0 as usize, None, None, Some(name.to_string())), + inner: Symbol::Symbol { + addr: addr.0 as usize as *mut c_void, + name: name.as_bytes(), + }, }; - cb(&sym); + cb.call(&sym); } } }); + + drop(cb); } -pub struct Symbol { - addr: usize, - file: Option, - line: Option, - name: Option, +struct DladdrFallback<'a, 'b> { + addr: *mut c_void, + called: bool, + cb: &'a mut (FnMut(&super::Symbol) + 'b), } -impl Symbol { - fn new(addr: usize, file: Option, line: Option, name: Option) -> Symbol { - Symbol { - addr, - file, - line, - name, +impl DladdrFallback<'_, '_> { + fn call(&mut self, sym: &super::Symbol) { + self.called = true; + (self.cb)(sym); + } +} + +impl Drop for DladdrFallback<'_, '_> { + fn drop(&mut self) { + if self.called { + return; + } + unsafe { + dladdr::resolve(self.addr, &mut |sym| { + (self.cb)(&super::Symbol { + inner: Symbol::Dladdr(sym), + }) + }); } } +} +pub enum Symbol { + /// We were able to locate frame information for this symbol, and + /// `addr2line`'s frame internally has all the nitty gritty details. + Frame { + addr: *mut c_void, + frame: addr2line::Frame>, + // Note that this would ideally be `&[u8]`, but we currently can't have + // a lifetime parameter on this type. Eventually in the next breaking + // change of this crate we should add a lifetime parameter to the + // `Symbol` type in the top-level module, and then thread that lifetime + // through to here. + name: Option<*const [u8]>, + }, + /// We weren't able to find anything in the debuginfo for this address, but + /// we were able to find an entry into the symbol table for the symbol name. + Symbol { + addr: *mut c_void, + // see note on `name` above + name: *const [u8], + }, + /// We weren't able to find anything in the original file, so we had to fall + /// back to using `dladdr` which had a hit. + Dladdr(dladdr::Symbol), +} + +impl Symbol { pub fn name(&self) -> Option { - self.name.as_ref().map(|s| SymbolName::new(s.as_bytes())) + match self { + Symbol::Dladdr(s) => s.name(), + Symbol::Frame { name, .. } => { + let name = name.as_ref()?; + unsafe { Some(SymbolName::new(&**name)) } + } + Symbol::Symbol { name, .. } => unsafe { Some(SymbolName::new(&**name)) }, + } } pub fn addr(&self) -> Option<*mut c_void> { - Some(self.addr as *mut c_void) + match self { + Symbol::Dladdr(s) => s.addr(), + Symbol::Frame { addr, .. } => Some(*addr), + Symbol::Symbol { addr, .. } => Some(*addr), + } } pub fn filename_raw(&self) -> Option { - self.file - .as_ref() - .map(|f| BytesOrWideString::Bytes(f.as_bytes())) + match self { + Symbol::Dladdr(s) => return s.filename_raw(), + Symbol::Frame { frame, .. } => { + let location = frame.location.as_ref()?; + let file = location.file.as_ref()?; + Some(BytesOrWideString::Bytes(file.as_bytes())) + } + Symbol::Symbol { .. } => None, + } } pub fn filename(&self) -> Option<&Path> { - self.file.as_ref().map(Path::new) + match self { + Symbol::Dladdr(s) => return s.filename(), + Symbol::Frame { frame, .. } => { + let location = frame.location.as_ref()?; + let file = location.file.as_ref()?; + Some(Path::new(file)) + } + Symbol::Symbol { .. } => None, + } } pub fn lineno(&self) -> Option { - self.line.and_then(|l| { - if l > (u32::MAX as u64) { - None - } else { - Some(l as u32) + match self { + Symbol::Dladdr(s) => return s.lineno(), + Symbol::Frame { frame, .. } => { + let location = frame.location.as_ref()?; + location.line.and_then(|l| u32::try_from(l).ok()) } - }) + Symbol::Symbol { .. } => None, + } } } diff -Nru cargo-0.35.0/vendor/backtrace/src/symbolize/libbacktrace.rs cargo-0.37.0/vendor/backtrace/src/symbolize/libbacktrace.rs --- cargo-0.35.0/vendor/backtrace/src/symbolize/libbacktrace.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/symbolize/libbacktrace.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,18 +8,39 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +//! Symbolication strategy using the DWARF-parsing code in libbacktrace. +//! +//! The libbacktrace C library, typically distributed with gcc, supports not +//! only generating a backtrace (which we don't actually use) but also +//! symbolicating the backtrace and handling dwarf debug information about +//! things like inlined frames and whatnot. +//! +//! This is relatively complicated due to lots of various concerns here, but the +//! basic idea is: +//! +//! * First we call `backtrace_syminfo`. This gets symbol information from the +//! dynamic symbol table if we can. +//! * Next we call `backtrace_pcinfo`. This will parse debuginfo tables if +//! they're available and allow us to recover information about inline frames, +//! filenames, line numbers, etc. +//! +//! There's lots of trickery about getting the dwarf tables into libbacktrace, +//! but hopefully it's not the end of the world and is clear enough when reading +//! below. +//! +//! This is the default symbolication strategy for non-MSVC and non-OSX +//! platforms. In libstd though this is the default strategy for OSX. + #![allow(bad_style)] extern crate backtrace_sys as bt; use core::{ptr, slice}; - use libc::{self, c_char, c_int, c_void, uintptr_t}; -use SymbolName; - -use symbolize::ResolveWhat; -use types::BytesOrWideString; +use crate::symbolize::{ResolveWhat, SymbolName}; +use crate::symbolize::dladdr; +use crate::types::BytesOrWideString; pub enum Symbol { Syminfo { @@ -31,25 +52,44 @@ filename: *const c_char, lineno: c_int, function: *const c_char, + symname: *const c_char, }, + Dladdr(dladdr::Symbol), } impl Symbol { pub fn name(&self) -> Option { - let ptr = match *self { - Symbol::Syminfo { symname, .. } => symname, - Symbol::Pcinfo { function, .. } => function, - }; - if ptr.is_null() { - None - } else { + let symbol = |ptr: *const c_char| { unsafe { - let len = libc::strlen(ptr); - Some(SymbolName::new(slice::from_raw_parts( - ptr as *const u8, - len, - ))) + if ptr.is_null() { + None + } else { + let len = libc::strlen(ptr); + Some(SymbolName::new(slice::from_raw_parts( + ptr as *const u8, + len, + ))) + } + } + }; + match *self { + Symbol::Syminfo { symname, .. } => symbol(symname), + Symbol::Pcinfo { function, symname, .. } => { + // If possible prefer the `function` name which comes from + // debuginfo and can typically be more accurate for inline + // frames for example. If that's not present though fall back to + // the symbol table name specified in `symname`. + // + // Note that sometimes `function` can feel somewhat less + // accurate, for example being listed as `try` + // isntead of `std::panicking::try::do_call`. It's not really + // clear why, but overall the `function` name seems more accurate. + if let Some(sym) = symbol(function) { + return Some(sym) + } + symbol(symname) } + Symbol::Dladdr(ref s) => s.name(), } } @@ -57,6 +97,7 @@ let pc = match *self { Symbol::Syminfo { pc, .. } => pc, Symbol::Pcinfo { pc, .. } => pc, + Symbol::Dladdr(ref s) => return s.addr(), }; if pc == 0 { None @@ -75,6 +116,7 @@ Some(slice::from_raw_parts(ptr, len)) } } + Symbol::Dladdr(_) => None, } } @@ -106,6 +148,7 @@ match *self { Symbol::Syminfo { .. } => None, Symbol::Pcinfo { lineno, .. } => Some(lineno as u32), + Symbol::Dladdr(ref s) => s.lineno(), } } } @@ -114,6 +157,12 @@ // do nothing for now } +/// Type of the `data` pointer passed into `syminfo_cb` +struct SyminfoState<'a> { + cb: &'a mut (FnMut(&super::Symbol) + 'a), + pc: usize, +} + extern "C" fn syminfo_cb( data: *mut c_void, pc: uintptr_t, @@ -121,17 +170,47 @@ _symval: uintptr_t, _symsize: uintptr_t, ) { + let mut bomb = crate::Bomb { enabled: true }; + + // Once this callback is invoked from `backtrace_syminfo` when we start + // resolving we go further to call `backtrace_pcinfo`. The + // `backtrace_pcinfo` function will consult debug information and attemp tto + // do things like recover file/line information as well as inlined frames. + // Note though that `backtrace_pcinfo` can fail or not do much if there's + // not debug info, so if that happens we're sure to call the callback with + // at least one symbol from the `syminfo_cb`. unsafe { - call( - data, - &super::Symbol { + let syminfo_state = &mut *(data as *mut SyminfoState); + let mut pcinfo_state = PcinfoState { + symname, + called: false, + cb: syminfo_state.cb, + }; + bt::backtrace_pcinfo( + init_state(), + syminfo_state.pc as uintptr_t, + pcinfo_cb, + error_cb, + &mut pcinfo_state as *mut _ as *mut _, + ); + if !pcinfo_state.called { + (pcinfo_state.cb)(&super::Symbol { inner: Symbol::Syminfo { pc: pc, symname: symname, }, - }, - ); + }); + } } + + bomb.enabled = false; +} + +/// Type of the `data` pointer passed into `pcinfo_cb` +struct PcinfoState<'a> { + cb: &'a mut (FnMut(&super::Symbol) + 'a), + symname: *const c_char, + called: bool, } extern "C" fn pcinfo_cb( @@ -141,30 +220,27 @@ lineno: c_int, function: *const c_char, ) -> c_int { + if filename.is_null() || function.is_null() { + return -1; + } + let mut bomb = crate::Bomb { enabled: true }; + unsafe { - if filename.is_null() || function.is_null() { - return -1; - } - call( - data, - &super::Symbol { - inner: Symbol::Pcinfo { - pc: pc, - filename: filename, - lineno: lineno, - function: function, - }, + let state = &mut *(data as *mut PcinfoState); + state.called = true; + (state.cb)(&super::Symbol { + inner: Symbol::Pcinfo { + pc: pc, + filename: filename, + lineno: lineno, + symname: state.symname, + function, }, - ); - return 0; + }); } -} -unsafe fn call(data: *mut c_void, sym: &super::Symbol) { - let cb = data as *mut &mut FnMut(&super::Symbol); - let mut bomb = ::Bomb { enabled: true }; - (*cb)(sym); bomb.enabled = false; + return 0; } // The libbacktrace API supports creating a state, but it does not @@ -222,7 +298,7 @@ // // Given all that we try as hard as possible to *not* pass in a filename, // but we must on platforms that don't support /proc/self/exe at all. - cfg_if! { + cfg_if::cfg_if! { if #[cfg(any(target_os = "macos", target_os = "ios"))] { // Note that ideally we'd use `std::env::current_exe`, but we can't // require `std` here. @@ -250,7 +326,7 @@ } } } else if #[cfg(windows)] { - use windows::*; + use crate::windows::*; // Windows has a mode of opening files where after it's opened it // can't be deleted. That's in general what we want here because we @@ -334,29 +410,48 @@ } } -pub unsafe fn resolve(what: ResolveWhat, mut cb: &mut FnMut(&super::Symbol)) { - let symaddr = what.address_or_ip(); +pub unsafe fn resolve(what: ResolveWhat, cb: &mut FnMut(&super::Symbol)) { + let symaddr = what.address_or_ip() as usize; // backtrace errors are currently swept under the rug let state = init_state(); if state.is_null() { - return; + return dladdr_fallback(what.address_or_ip(), cb); } - let ret = bt::backtrace_pcinfo( - state, - symaddr as uintptr_t, - pcinfo_cb, - error_cb, - &mut cb as *mut _ as *mut _, - ); - if ret != 0 { + // Call the `backtrace_syminfo` API first. This is (from reading the code) + // guaranteed to call `syminfo_cb` exactly once (or fail with an error + // presumably). We then handle more within the `syminfo_cb`. + // + // Note that we do this since `syminfo` will consult the symbol table, + // finding symbol names even if there's no debug information in the binary. + let mut called = false; + { + let mut syminfo_state = SyminfoState { + pc: symaddr, + cb: &mut |sym| { + called = true; + cb(sym); + }, + }; bt::backtrace_syminfo( state, symaddr as uintptr_t, syminfo_cb, error_cb, - &mut cb as *mut _ as *mut _, + &mut syminfo_state as *mut _ as *mut _, ); } + + if !called { + dladdr_fallback(what.address_or_ip(), cb); + } +} + +unsafe fn dladdr_fallback(addr: *mut c_void, cb: &mut FnMut(&super::Symbol)) { + dladdr::resolve(addr, &mut |sym| { + cb(&super::Symbol { + inner: Symbol::Dladdr(sym), + }) + }); } diff -Nru cargo-0.35.0/vendor/backtrace/src/symbolize/mod.rs cargo-0.37.0/vendor/backtrace/src/symbolize/mod.rs --- cargo-0.35.0/vendor/backtrace/src/symbolize/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/symbolize/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,16 +1,16 @@ use core::{fmt, str}; -cfg_if! { +cfg_if::cfg_if! { if #[cfg(feature = "std")] { use std::path::Path; use std::prelude::v1::*; } } +use crate::backtrace::Frame; +use crate::types::BytesOrWideString; +use core::ffi::c_void; use rustc_demangle::{try_demangle, Demangle}; -use types::{c_void, BytesOrWideString}; - -use backtrace::Frame; /// Resolve an address to a symbol, passing the symbol to the specified /// closure. @@ -33,6 +33,13 @@ /// This function requires the `std` feature of the `backtrace` crate to be /// enabled, and the `std` feature is enabled by default. /// +/// # Panics +/// +/// This function strives to never panic, but if the `cb` provided panics then +/// some platforms will force a double panic to abort the process. Some +/// platforms use a C library which internally uses callbacks which cannot be +/// unwound through, so panicking from `cb` may trigger a process abort. +/// /// # Example /// /// ``` @@ -52,7 +59,7 @@ /// ``` #[cfg(feature = "std")] pub fn resolve(addr: *mut c_void, cb: F) { - let _guard = ::lock::lock(); + let _guard = crate::lock::lock(); unsafe { resolve_unsynchronized(addr, cb) } } @@ -70,6 +77,13 @@ /// This function requires the `std` feature of the `backtrace` crate to be /// enabled, and the `std` feature is enabled by default. /// +/// # Panics +/// +/// This function strives to never panic, but if the `cb` provided panics then +/// some platforms will force a double panic to abort the process. Some +/// platforms use a C library which internally uses callbacks which cannot be +/// unwound through, so panicking from `cb` may trigger a process abort. +/// /// # Example /// /// ``` @@ -87,7 +101,7 @@ /// ``` #[cfg(feature = "std")] pub fn resolve_frame(frame: &Frame, cb: F) { - let _guard = ::lock::lock(); + let _guard = crate::lock::lock(); unsafe { resolve_frame_unsynchronized(frame, cb) } } @@ -99,18 +113,48 @@ impl<'a> ResolveWhat<'a> { #[allow(dead_code)] fn address_or_ip(&self) -> *mut c_void { - match *self { - ResolveWhat::Address(a) => a, - ResolveWhat::Frame(ref f) => f.ip(), + match self { + ResolveWhat::Address(a) => adjust_ip(*a), + ResolveWhat::Frame(f) => adjust_ip(f.ip()), } } } +// IP values from stack frames are typically (always?) the instruction +// *after* the call that's the actual stack trace. Symbolizing this on +// causes the filename/line number to be one ahead and perhaps into +// the void if it's near the end of the function. +// +// This appears to basically always be the case on all platforms, so we always +// subtract one from a resolved ip to resolve it to the previous call +// instruction instead of the instruction being returned to. +// +// Ideally we would not do this. Ideally we would require callers of the +// `resolve` APIs here to manually do the -1 and account that they want location +// information for the *previous* instruction, not the current. Ideally we'd +// also expose on `Frame` if we are indeed the address of the next instruction +// or the current. +// +// For now though this is a pretty niche concern so we just internally always +// subtract one. Consumers should keep working and getting pretty good results, +// so we should be good enough. +fn adjust_ip(a: *mut c_void) -> *mut c_void { + if a.is_null() { + a + } else { + (a as usize - 1) as *mut c_void + } +} + /// Same as `resolve`, only unsafe as it's unsynchronized. /// /// This function does not have synchronization guarentees but is available when /// the `std` feature of this crate isn't compiled in. See the `resolve` /// function for more documentation and examples. +/// +/// # Panics +/// +/// See information on `resolve` for caveats on `cb` panicking. pub unsafe fn resolve_unsynchronized(addr: *mut c_void, mut cb: F) where F: FnMut(&Symbol), @@ -123,6 +167,10 @@ /// This function does not have synchronization guarentees but is available /// when the `std` feature of this crate isn't compiled in. See the /// `resolve_frame` function for more documentation and examples. +/// +/// # Panics +/// +/// See information on `resolve_frame` for caveats on `cb` panicking. pub unsafe fn resolve_frame_unsynchronized(frame: &Frame, mut cb: F) where F: FnMut(&Symbol), @@ -183,7 +231,10 @@ /// debuginfo. If neither of these conditions is met then this will likely /// return `None`. /// - /// This function requires the `std` feature to be enabled for this crate. + /// # Required features + /// + /// This function requires the `std` feature of the `backtrace` crate to be + /// enabled, and the `std` feature is enabled by default. #[cfg(feature = "std")] #[allow(unreachable_code)] pub fn filename(&self) -> Option<&Path> { @@ -215,7 +266,7 @@ } } -cfg_if! { +cfg_if::cfg_if! { if #[cfg(feature = "cpp_demangle")] { // Maybe a parsed C++ symbol, if parsing the mangled symbol as Rust // failed. @@ -318,7 +369,7 @@ Ok(()) } -cfg_if! { +cfg_if::cfg_if! { if #[cfg(feature = "cpp_demangle")] { impl<'a> fmt::Display for SymbolName<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -344,7 +395,7 @@ } } -cfg_if! { +cfg_if::cfg_if! { if #[cfg(all(feature = "std", feature = "cpp_demangle"))] { impl<'a> fmt::Debug for SymbolName<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -380,15 +431,21 @@ } } -cfg_if! { +mod dladdr; + +cfg_if::cfg_if! { if #[cfg(all(windows, target_env = "msvc", feature = "dbghelp"))] { mod dbghelp; use self::dbghelp::resolve as resolve_imp; use self::dbghelp::Symbol as SymbolImp; - } else if #[cfg(all(feature = "std", - feature = "gimli-symbolize", - unix, - target_os = "linux"))] { + } else if #[cfg(all( + feature = "std", + feature = "gimli-symbolize", + any( + target_os = "linux", + target_os = "macos", + ), + ))] { mod gimli; use self::gimli::resolve as resolve_imp; use self::gimli::Symbol as SymbolImp; @@ -402,7 +459,7 @@ use self::coresymbolication::resolve as resolve_imp; use self::coresymbolication::Symbol as SymbolImp; } else if #[cfg(all(feature = "libbacktrace", - any(unix, all(windows, target_env = "gnu")), + any(unix, all(windows, not(target_vendor = "uwp"), target_env = "gnu")), not(target_os = "fuchsia"), not(target_os = "emscripten")))] { mod libbacktrace; @@ -411,9 +468,9 @@ } else if #[cfg(all(unix, not(target_os = "emscripten"), feature = "dladdr"))] { - mod dladdr; - use self::dladdr::resolve as resolve_imp; - use self::dladdr::Symbol as SymbolImp; + mod dladdr_resolve; + use self::dladdr_resolve::resolve as resolve_imp; + use self::dladdr_resolve::Symbol as SymbolImp; } else { mod noop; use self::noop::resolve as resolve_imp; diff -Nru cargo-0.35.0/vendor/backtrace/src/symbolize/noop.rs cargo-0.37.0/vendor/backtrace/src/symbolize/noop.rs --- cargo-0.35.0/vendor/backtrace/src/symbolize/noop.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/symbolize/noop.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,6 +1,10 @@ -use types::{BytesOrWideString, c_void}; -use SymbolName; -use symbolize::ResolveWhat; +//! Empty symbolication strategy used to compile for platforms that have no +//! support. + +use core::ffi::c_void; +use crate::types::BytesOrWideString; +use crate::SymbolName; +use crate::symbolize::ResolveWhat; pub unsafe fn resolve(_addr: ResolveWhat, _cb: &mut FnMut(&super::Symbol)) { } diff -Nru cargo-0.35.0/vendor/backtrace/src/types.rs cargo-0.37.0/vendor/backtrace/src/types.rs --- cargo-0.35.0/vendor/backtrace/src/types.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/types.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,16 +1,11 @@ //! Platform dependent types. -cfg_if! { +cfg_if::cfg_if! { if #[cfg(feature = "std")] { - pub use std::os::raw::c_void; use std::borrow::Cow; use std::fmt; use std::path::PathBuf; use std::prelude::v1::*; - } else if #[cfg(rustc_1_30)] { - pub use core::ffi::c_void; - } else { - compile_error!("`backtrace` requires Rust >=1.30.0 to support `no_std`."); } } @@ -29,6 +24,11 @@ impl<'a> BytesOrWideString<'a> { /// Lossy converts to a `Cow`, will allocate if `Bytes` is not valid /// UTF-8 or if `BytesOrWideString` is `Wide`. + /// + /// # Required features + /// + /// This function requires the `std` feature of the `backtrace` crate to be + /// enabled, and the `std` feature is enabled by default. pub fn to_str_lossy(&self) -> Cow<'a, str> { use self::BytesOrWideString::*; @@ -39,6 +39,11 @@ } /// Provides a `Path` representation of `BytesOrWideString`. + /// + /// # Required features + /// + /// This function requires the `std` feature of the `backtrace` crate to be + /// enabled, and the `std` feature is enabled by default. pub fn into_path_buf(self) -> PathBuf { #[cfg(unix)] { diff -Nru cargo-0.35.0/vendor/backtrace/src/windows.rs cargo-0.37.0/vendor/backtrace/src/windows.rs --- cargo-0.35.0/vendor/backtrace/src/windows.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/src/windows.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,7 +9,7 @@ #![allow(bad_style, dead_code)] -cfg_if! { +cfg_if::cfg_if! { if #[cfg(feature = "verify-winapi")] { pub use self::winapi::c_void; pub use self::winapi::HINSTANCE; @@ -309,6 +309,7 @@ pub const IMAGE_FILE_MACHINE_ARM64: u16 = 43620; pub const IMAGE_FILE_MACHINE_AMD64: u16 = 34404; pub const IMAGE_FILE_MACHINE_I386: u16 = 332; + pub const IMAGE_FILE_MACHINE_ARMNT: u16 = 452; pub const FILE_SHARE_READ: DWORD = 0x1; pub const FILE_SHARE_WRITE: DWORD = 0x2; pub const OPEN_EXISTING: DWORD = 0x3; @@ -338,8 +339,7 @@ pub fn GetCurrentProcess() -> HANDLE; pub fn GetCurrentThread() -> HANDLE; pub fn RtlCaptureContext(ContextRecord: PCONTEXT) -> (); - pub fn LoadLibraryW(a: *const u16) -> HMODULE; - pub fn FreeLibrary(h: HMODULE) -> BOOL; + pub fn LoadLibraryA(a: *const i8) -> HMODULE; pub fn GetProcAddress(h: HMODULE, name: *const i8) -> FARPROC; pub fn OpenProcess( dwDesiredAccess: DWORD, @@ -557,3 +557,54 @@ pub struct FLOATING_SAVE_AREA { _Dummy: [u8; 512], } + +#[cfg(target_arch = "arm")] +ffi! { + // #[repr(C)] + // pub struct NEON128 { + // pub Low: ULONG64, + // pub High: LONG64, + // } + + // pub type PNEON128 = *mut NEON128; + + #[repr(C)] + pub struct CONTEXT_u { + // pub Q: [NEON128; 16], + pub D: [ULONG64; 32], + // pub S: [DWORD; 32], + } + + pub const ARM_MAX_BREAKPOINTS: usize = 8; + pub const ARM_MAX_WATCHPOINTS: usize = 1; + + #[repr(C)] + pub struct CONTEXT { + pub ContextFlags: DWORD, + pub R0: DWORD, + pub R1: DWORD, + pub R2: DWORD, + pub R3: DWORD, + pub R4: DWORD, + pub R5: DWORD, + pub R6: DWORD, + pub R7: DWORD, + pub R8: DWORD, + pub R9: DWORD, + pub R10: DWORD, + pub R11: DWORD, + pub R12: DWORD, + pub Sp: DWORD, + pub Lr: DWORD, + pub Pc: DWORD, + pub Cpsr: DWORD, + pub Fpsrc: DWORD, + pub Padding: DWORD, + pub u: CONTEXT_u, + pub Bvr: [DWORD; ARM_MAX_BREAKPOINTS], + pub Bcr: [DWORD; ARM_MAX_BREAKPOINTS], + pub Wvr: [DWORD; ARM_MAX_WATCHPOINTS], + pub Wcr: [DWORD; ARM_MAX_WATCHPOINTS], + pub Padding2: [DWORD; 2], + } +} // IFDEF(arm) diff -Nru cargo-0.35.0/vendor/backtrace/tests/accuracy/auxiliary.rs cargo-0.37.0/vendor/backtrace/tests/accuracy/auxiliary.rs --- cargo-0.35.0/vendor/backtrace/tests/accuracy/auxiliary.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/tests/accuracy/auxiliary.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,16 @@ +#[inline(never)] +pub fn callback(f: F) +where + F: FnOnce((&'static str, u32)), +{ + f((file!(), line!())) +} + +#[inline(always)] +#[cfg_attr(feature = "coresymbolication", inline(never))] +pub fn callback_inlined(f: F) +where + F: FnOnce((&'static str, u32)), +{ + f((file!(), line!())) +} diff -Nru cargo-0.35.0/vendor/backtrace/tests/accuracy/main.rs cargo-0.37.0/vendor/backtrace/tests/accuracy/main.rs --- cargo-0.35.0/vendor/backtrace/tests/accuracy/main.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/tests/accuracy/main.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,92 @@ +mod auxiliary; + +macro_rules! pos { + () => { + (file!(), line!()) + }; +} + +macro_rules! check { + ($($pos:expr),*) => ({ + verify(&[$($pos,)* pos!()]); + }) +} + +type Pos = (&'static str, u32); + +#[test] +fn doit() { + outer(pos!()); +} + +#[inline(never)] +fn outer(main_pos: Pos) { + inner(main_pos, pos!()); + inner_inlined(main_pos, pos!()); +} + +#[inline(never)] +#[rustfmt::skip] +fn inner(main_pos: Pos, outer_pos: Pos) { + check!(main_pos, outer_pos); + check!(main_pos, outer_pos); + let inner_pos = pos!(); auxiliary::callback(|aux_pos| { + check!(main_pos, outer_pos, inner_pos, aux_pos); + }); + let inner_pos = pos!(); auxiliary::callback_inlined(|aux_pos| { + check!(main_pos, outer_pos, inner_pos, aux_pos); + }); +} + +#[inline(always)] +#[cfg_attr(feature = "coresymbolication", inline(never))] +#[rustfmt::skip] +fn inner_inlined(main_pos: Pos, outer_pos: Pos) { + check!(main_pos, outer_pos); + check!(main_pos, outer_pos); + + #[inline(always)] + #[cfg_attr(feature = "coresymbolication", inline(never))] + fn inner_further_inlined(main_pos: Pos, outer_pos: Pos, inner_pos: Pos) { + check!(main_pos, outer_pos, inner_pos); + } + inner_further_inlined(main_pos, outer_pos, pos!()); + + let inner_pos = pos!(); auxiliary::callback(|aux_pos| { + check!(main_pos, outer_pos, inner_pos, aux_pos); + }); + let inner_pos = pos!(); auxiliary::callback_inlined(|aux_pos| { + check!(main_pos, outer_pos, inner_pos, aux_pos); + }); + + // this tests a distinction between two independent calls to the inlined function. + // (un)fortunately, LLVM somehow merges two consecutive such calls into one node. + inner_further_inlined(main_pos, outer_pos, pos!()); +} + +fn verify(filelines: &[Pos]) { + let trace = backtrace::Backtrace::new(); + println!("-----------------------------------"); + println!("looking for:"); + for (file, line) in filelines.iter().rev() { + println!("\t{}:{}", file, line); + } + println!("found:\n{:?}", trace); + let mut symbols = trace.frames().iter().flat_map(|frame| frame.symbols()); + let mut iter = filelines.iter().rev(); + while let Some((file, line)) = iter.next() { + loop { + let sym = match symbols.next() { + Some(sym) => sym, + None => panic!("failed to find {}:{}", file, line), + }; + if let Some(filename) = sym.filename() { + if let Some(lineno) = sym.lineno() { + if filename.ends_with(file) && lineno == *line { + break; + } + } + } + } + } +} diff -Nru cargo-0.35.0/vendor/backtrace/tests/long_fn_name.rs cargo-0.37.0/vendor/backtrace/tests/long_fn_name.rs --- cargo-0.35.0/vendor/backtrace/tests/long_fn_name.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/tests/long_fn_name.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,8 +9,8 @@ pub struct _234567890_234567890_234567890_234567890_234567890(T); impl _234567890_234567890_234567890_234567890_234567890 { #[allow(dead_code)] - pub fn new() -> ::Backtrace { - ::Backtrace::new() + pub fn new() -> crate::Backtrace { + crate::Backtrace::new() } } } diff -Nru cargo-0.35.0/vendor/backtrace/tests/skip_inner_frames.rs cargo-0.37.0/vendor/backtrace/tests/skip_inner_frames.rs --- cargo-0.35.0/vendor/backtrace/tests/skip_inner_frames.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/tests/skip_inner_frames.rs 2019-07-17 05:42:23.000000000 +0000 @@ -2,54 +2,48 @@ use backtrace::Backtrace; -const FRAME_RANGE: usize = 128; // should be close enough not to give false positives +// This test only works on platforms which have a working `symbol_address` +// function for frames which reports the starting address of a symbol. As a +// result it's only enabled on a few platforms. +const ENABLED: bool = cfg!(all( + // Windows hasn't really been tested, and OSX doesn't support actually + // finding an enclosing frame, so disable this + target_os = "linux", + // This is the only method currently that supports accurate enough + // backtraces for this test to work. + feature = "libunwind", + // On ARM finding the enclosing function is simply returning the ip itself. + not(target_arch = "arm"), +)); #[test] -#[cfg_attr( - any( - not(any( - all(unix, feature = "libunwind", feature = "unix-backtrace"), - all(windows, feature = "dbghelp") - )), - all(target_os = "windows", target_arch = "x86") - ), - ignore -)] fn backtrace_new_unresolved_should_start_with_call_site_trace() { + if !ENABLED { + return; + } let mut b = Backtrace::new_unresolved(); b.resolve(); println!("{:?}", b); - println!("{:#?}", b); assert!(!b.frames().is_empty()); let this_ip = backtrace_new_unresolved_should_start_with_call_site_trace as usize; - let frame_ip = b.frames().first().unwrap().ip() as usize; - - assert!(frame_ip >= this_ip); - assert!(frame_ip <= this_ip + FRAME_RANGE); + println!("this_ip: {:?}", this_ip as *const usize); + let frame_ip = b.frames().first().unwrap().symbol_address() as usize; + assert_eq!(this_ip, frame_ip); } #[test] -#[cfg_attr( - any( - not(any( - all(unix, feature = "libunwind", feature = "unix-backtrace"), - all(feature = "dbghelp", windows) - )), - all(target_os = "windows", target_arch = "x86") - ), - ignore -)] fn backtrace_new_should_start_with_call_site_trace() { + if !ENABLED { + return; + } let b = Backtrace::new(); println!("{:?}", b); assert!(!b.frames().is_empty()); let this_ip = backtrace_new_should_start_with_call_site_trace as usize; - let frame_ip = b.frames().first().unwrap().ip() as usize; - - assert!(frame_ip >= this_ip); - assert!(frame_ip <= this_ip + FRAME_RANGE); + let frame_ip = b.frames().first().unwrap().symbol_address() as usize; + assert_eq!(this_ip, frame_ip); } diff -Nru cargo-0.35.0/vendor/backtrace/tests/smoke.rs cargo-0.37.0/vendor/backtrace/tests/smoke.rs --- cargo-0.35.0/vendor/backtrace/tests/smoke.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace/tests/smoke.rs 2019-07-17 05:42:23.000000000 +0000 @@ -5,8 +5,7 @@ static LIBUNWIND: bool = cfg!(all(unix, feature = "libunwind")); static UNIX_BACKTRACE: bool = cfg!(all(unix, feature = "unix-backtrace")); -static LIBBACKTRACE: bool = cfg!(feature = "libbacktrace") - && !cfg!(target_os = "fuchsia"); +static LIBBACKTRACE: bool = cfg!(feature = "libbacktrace") && !cfg!(target_os = "fuchsia"); static CORESYMBOLICATION: bool = cfg!(all( any(target_os = "macos", target_os = "ios"), feature = "coresymbolication" @@ -103,10 +102,32 @@ expected_file: &str, expected_line: u32, ) { + backtrace::resolve_frame(frame, |sym| { + print!("symbol ip:{:?} address:{:?} ", frame.ip(), frame.symbol_address()); + if let Some(name) = sym.name() { + print!("name:{} ", name); + } + if let Some(file) = sym.filename() { + print!("file:{} ", file.display()); + } + if let Some(lineno) = sym.lineno() { + print!("lineno:{} ", lineno); + } + println!(); + }); + let ip = frame.ip() as usize; let sym = frame.symbol_address() as usize; assert!(ip >= sym); - assert!(sym >= actual_fn_pointer); + assert!( + sym >= actual_fn_pointer, + "{:?} < {:?} ({} {}:{})", + sym as *const usize, + actual_fn_pointer as *const usize, + expected_name, + expected_file, + expected_line, + ); // windows dbghelp is *quite* liberal (and wrong) in many of its reports // right now... @@ -129,7 +150,6 @@ addr = sym.addr(); line = sym.lineno(); file = sym.filename().map(|v| v.to_path_buf()); - println!(" sym: {:?}", name); }); // dbghelp doesn't always resolve symbols right now diff -Nru cargo-0.35.0/vendor/backtrace-sys/build.rs.orig cargo-0.37.0/vendor/backtrace-sys/build.rs.orig --- cargo-0.35.0/vendor/backtrace-sys/build.rs.orig 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace-sys/build.rs.orig 2019-07-17 05:42:23.000000000 +0000 @@ -1,10 +1,124 @@ -use std::process::Command; +extern crate cc; + +use std::env; +use std::fs::File; +use std::path::PathBuf; fn main() { - let search_dir = Command::new("sh") - .args(&["-c", "gcc -print-search-dirs | sed -ne 's/^install: //p'"]) - .output().expect("failed to find gcc install dir").stdout; - println!("cargo:rustc-link-lib=static=backtrace"); - println!("cargo:rustc-link-search=native={}", String::from_utf8(search_dir).unwrap().trim_right()); - println!("dh-cargo:deb-built-using=backtrace=0~={}", "libgcc-[0-9]+-dev .*"); + let target = env::var("TARGET").unwrap(); + + if target.contains("msvc") || // libbacktrace isn't used on MSVC windows + target.contains("emscripten") || // no way this will ever compile for emscripten + target.contains("cloudabi") || + target.contains("wasm32") + { + println!("cargo:rustc-cfg=empty"); + return; + } + + let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); + + let mut build = cc::Build::new(); + build + .include("src/libbacktrace") + .include(&out_dir) + .warnings(false) + .file("src/libbacktrace/alloc.c") + .file("src/libbacktrace/dwarf.c") + .file("src/libbacktrace/fileline.c") + .file("src/libbacktrace/posix.c") + .file("src/libbacktrace/read.c") + .file("src/libbacktrace/sort.c") + .file("src/libbacktrace/state.c"); + + // No need to have any symbols reexported form shared objects + build.flag("-fvisibility=hidden"); + + if target.contains("darwin") { + build.file("src/libbacktrace/macho.c"); + } else if target.contains("windows") { + build.file("src/libbacktrace/pecoff.c"); + } else { + build.file("src/libbacktrace/elf.c"); + + let pointer_width = env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap(); + if pointer_width == "64" { + build.define("BACKTRACE_ELF_SIZE", "64"); + } else { + build.define("BACKTRACE_ELF_SIZE", "32"); + } + } + + File::create(out_dir.join("backtrace-supported.h")).unwrap(); + build.define("BACKTRACE_SUPPORTED", "1"); + build.define("BACKTRACE_USES_MALLOC", "1"); + build.define("BACKTRACE_SUPPORTS_THREADS", "0"); + build.define("BACKTRACE_SUPPORTS_DATA", "0"); + + File::create(out_dir.join("config.h")).unwrap(); + if !target.contains("apple-ios") + && !target.contains("solaris") + && !target.contains("redox") + && !target.contains("android") + && !target.contains("haiku") + && !target.contains("vxworks") + { + build.define("HAVE_DL_ITERATE_PHDR", "1"); + } + build.define("_GNU_SOURCE", "1"); + build.define("_LARGE_FILES", "1"); + + // When we're built as part of the Rust compiler, this is used to enable + // debug information in libbacktrace itself. + let any_debug = env::var("RUSTC_DEBUGINFO").unwrap_or_default() == "true" + || env::var("RUSTC_DEBUGINFO_LINES").unwrap_or_default() == "true"; + build.debug(any_debug); + + let syms = [ + "backtrace_full", + "backtrace_dwarf_add", + "backtrace_initialize", + "backtrace_pcinfo", + "backtrace_syminfo", + "backtrace_get_view", + "backtrace_release_view", + "backtrace_alloc", + "backtrace_free", + "backtrace_vector_finish", + "backtrace_vector_grow", + "backtrace_vector_release", + "backtrace_close", + "backtrace_open", + "backtrace_print", + "backtrace_simple", + "backtrace_qsort", + "backtrace_create_state", + "backtrace_uncompress_zdebug", + + // These should be `static` in C, but they aren't... + "macho_get_view", + "macho_symbol_type_relevant", + "macho_get_commands", + "macho_try_dsym", + "macho_try_dwarf", + "macho_get_addr_range", + "macho_get_uuid", + "macho_add", + "macho_add_symtab", + "macho_file_to_host_u64", + "macho_file_to_host_u32", + "macho_file_to_host_u16", + ]; + let prefix = if cfg!(feature = "rustc-dep-of-std") { + println!("cargo:rustc-cfg=rdos"); + "__rdos_" + } else { + println!("cargo:rustc-cfg=rbt"); + "__rbt_" + }; + for sym in syms.iter() { + build.define(sym, &format!("{}{}", prefix, sym)[..]); + } + + build.compile("backtrace"); } diff -Nru cargo-0.35.0/vendor/backtrace-sys/.cargo-checksum.json cargo-0.37.0/vendor/backtrace-sys/.cargo-checksum.json --- cargo-0.35.0/vendor/backtrace-sys/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace-sys/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6"} \ No newline at end of file +{"files":{},"package":"5b3a000b9c543553af61bc01cbfc403b04b5caa9e421033866f2e98061eb3e61"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/backtrace-sys/Cargo.toml cargo-0.37.0/vendor/backtrace-sys/Cargo.toml --- cargo-0.35.0/vendor/backtrace-sys/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace-sys/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,7 +12,7 @@ [package] name = "backtrace-sys" -version = "0.1.28" +version = "0.1.30" authors = ["Alex Crichton "] build = "build.rs" description = "Bindings to the libbacktrace gcc library\n" @@ -20,6 +20,18 @@ documentation = "http://alexcrichton.com/backtrace-rs" license = "MIT/Apache-2.0" repository = "https://github.com/alexcrichton/backtrace-rs" +[dependencies.compiler_builtins] +version = "0.1.2" +optional = true + +[dependencies.core] +version = "1.0.0" +optional = true +package = "rustc-std-workspace-core" + [dependencies.libc] version = "0.2" default-features = false + +[features] +rustc-dep-of-std = ["core", "compiler_builtins"] diff -Nru cargo-0.35.0/vendor/backtrace-sys/debian/patches/remove-unneeded-dep.patch cargo-0.37.0/vendor/backtrace-sys/debian/patches/remove-unneeded-dep.patch --- cargo-0.35.0/vendor/backtrace-sys/debian/patches/remove-unneeded-dep.patch 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace-sys/debian/patches/remove-unneeded-dep.patch 2019-07-17 05:42:23.000000000 +0000 @@ -7,16 +7,14 @@ Cargo.toml | 2 -- 1 file changed, 2 deletions(-) -diff --git a/Cargo.toml b/Cargo.toml -index f47ab6d..85ca93e 100644 --- a/Cargo.toml +++ b/Cargo.toml -@@ -23,5 +23,3 @@ repository = "https://github.com/alexcrichton/backtrace-rs" +@@ -32,8 +32,6 @@ [dependencies.libc] version = "0.2" default-features = false -[build-dependencies.cc] -version = "1.0" --- -2.20.1 - + + [features] + rustc-dep-of-std = ["core", "compiler_builtins"] diff -Nru cargo-0.35.0/vendor/backtrace-sys/LICENSE-APACHE cargo-0.37.0/vendor/backtrace-sys/LICENSE-APACHE --- cargo-0.35.0/vendor/backtrace-sys/LICENSE-APACHE 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace-sys/LICENSE-APACHE 1970-01-01 00:00:00.000000000 +0000 @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor 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, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff -Nru cargo-0.35.0/vendor/backtrace-sys/LICENSE-MIT cargo-0.37.0/vendor/backtrace-sys/LICENSE-MIT --- cargo-0.35.0/vendor/backtrace-sys/LICENSE-MIT 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace-sys/LICENSE-MIT 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -Copyright (c) 2014 Alex Crichton - -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 -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff -Nru cargo-0.35.0/vendor/backtrace-sys/.pc/remove-unneeded-dep.patch/Cargo.toml cargo-0.37.0/vendor/backtrace-sys/.pc/remove-unneeded-dep.patch/Cargo.toml --- cargo-0.35.0/vendor/backtrace-sys/.pc/remove-unneeded-dep.patch/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace-sys/.pc/remove-unneeded-dep.patch/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,7 +12,7 @@ [package] name = "backtrace-sys" -version = "0.1.28" +version = "0.1.30" authors = ["Alex Crichton "] build = "build.rs" description = "Bindings to the libbacktrace gcc library\n" @@ -20,8 +20,20 @@ documentation = "http://alexcrichton.com/backtrace-rs" license = "MIT/Apache-2.0" repository = "https://github.com/alexcrichton/backtrace-rs" +[dependencies.compiler_builtins] +version = "0.1.2" +optional = true + +[dependencies.core] +version = "1.0.0" +optional = true +package = "rustc-std-workspace-core" + [dependencies.libc] version = "0.2" default-features = false [build-dependencies.cc] version = "1.0" + +[features] +rustc-dep-of-std = ["core", "compiler_builtins"] diff -Nru cargo-0.35.0/vendor/backtrace-sys/src/lib.rs cargo-0.37.0/vendor/backtrace-sys/src/lib.rs --- cargo-0.35.0/vendor/backtrace-sys/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/backtrace-sys/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,46 +7,52 @@ pub use self::bindings::*; #[cfg(not(empty))] mod bindings { - use libc::{c_void, c_char, c_int, uintptr_t}; + use libc::{c_char, c_int, c_void, uintptr_t}; - pub type backtrace_syminfo_callback = - extern fn(data: *mut c_void, - pc: uintptr_t, - symname: *const c_char, - symval: uintptr_t, - symsize: uintptr_t); - pub type backtrace_full_callback = - extern fn(data: *mut c_void, - pc: uintptr_t, - filename: *const c_char, - lineno: c_int, - function: *const c_char) -> c_int; + pub type backtrace_syminfo_callback = extern "C" fn( + data: *mut c_void, + pc: uintptr_t, + symname: *const c_char, + symval: uintptr_t, + symsize: uintptr_t, + ); + pub type backtrace_full_callback = extern "C" fn( + data: *mut c_void, + pc: uintptr_t, + filename: *const c_char, + lineno: c_int, + function: *const c_char, + ) -> c_int; pub type backtrace_error_callback = - extern fn(data: *mut c_void, - msg: *const c_char, - errnum: c_int); + extern "C" fn(data: *mut c_void, msg: *const c_char, errnum: c_int); pub enum backtrace_state {} extern "C" { #[cfg_attr(rdos, link_name = "__rdos_backtrace_create_state")] #[cfg_attr(rbt, link_name = "__rbt_backtrace_create_state")] - pub fn backtrace_create_state(filename: *const c_char, - threaded: c_int, - error: backtrace_error_callback, - data: *mut c_void) -> *mut backtrace_state; + pub fn backtrace_create_state( + filename: *const c_char, + threaded: c_int, + error: backtrace_error_callback, + data: *mut c_void, + ) -> *mut backtrace_state; #[cfg_attr(rdos, link_name = "__rdos_backtrace_syminfo")] #[cfg_attr(rbt, link_name = "__rbt_backtrace_syminfo")] - pub fn backtrace_syminfo(state: *mut backtrace_state, - addr: uintptr_t, - cb: backtrace_syminfo_callback, - error: backtrace_error_callback, - data: *mut c_void) -> c_int; + pub fn backtrace_syminfo( + state: *mut backtrace_state, + addr: uintptr_t, + cb: backtrace_syminfo_callback, + error: backtrace_error_callback, + data: *mut c_void, + ) -> c_int; #[cfg_attr(rdos, link_name = "__rdos_backtrace_pcinfo")] #[cfg_attr(rbt, link_name = "__rbt_backtrace_pcinfo")] - pub fn backtrace_pcinfo(state: *mut backtrace_state, - addr: uintptr_t, - cb: backtrace_full_callback, - error: backtrace_error_callback, - data: *mut c_void) -> c_int; + pub fn backtrace_pcinfo( + state: *mut backtrace_state, + addr: uintptr_t, + cb: backtrace_full_callback, + error: backtrace_error_callback, + data: *mut c_void, + ) -> c_int; } } diff -Nru cargo-0.35.0/vendor/bitflags/build.rs cargo-0.37.0/vendor/bitflags/build.rs --- cargo-0.35.0/vendor/bitflags/build.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/bitflags/build.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,44 @@ +use std::env; +use std::process::Command; +use std::str::{self, FromStr}; + +fn main(){ + let minor = match rustc_minor_version() { + Some(minor) => minor, + None => return, + }; + + // const fn stabilized in Rust 1.31: + if minor >= 31 { + println!("cargo:rustc-cfg=bitflags_const_fn"); + } +} + +fn rustc_minor_version() -> Option { + let rustc = match env::var_os("RUSTC") { + Some(rustc) => rustc, + None => return None, + }; + + let output = match Command::new(rustc).arg("--version").output() { + Ok(output) => output, + Err(_) => return None, + }; + + let version = match str::from_utf8(&output.stdout) { + Ok(version) => version, + Err(_) => return None, + }; + + let mut pieces = version.split('.'); + if pieces.next() != Some("rustc 1") { + return None; + } + + let next = match pieces.next() { + Some(next) => next, + None => return None, + }; + + u32::from_str(next).ok() +} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/bitflags/.cargo-checksum.json cargo-0.37.0/vendor/bitflags/.cargo-checksum.json --- cargo-0.35.0/vendor/bitflags/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bitflags/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"} \ No newline at end of file +{"files":{},"package":"3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/bitflags/Cargo.toml cargo-0.37.0/vendor/bitflags/Cargo.toml --- cargo-0.35.0/vendor/bitflags/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bitflags/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,8 +12,9 @@ [package] name = "bitflags" -version = "1.0.4" +version = "1.1.0" authors = ["The Rust Project Developers"] +build = "build.rs" exclude = [".travis.yml", "appveyor.yml", "bors.toml"] description = "A macro to generate structures which behave like bitflags.\n" homepage = "https://github.com/bitflags/bitflags" diff -Nru cargo-0.35.0/vendor/bitflags/CHANGELOG.md cargo-0.37.0/vendor/bitflags/CHANGELOG.md --- cargo-0.35.0/vendor/bitflags/CHANGELOG.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bitflags/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -1,108 +1,134 @@ -# 1.0.3 - -- Improve zero value flag handling and documentation ([#157]) - -[#157]: https://github.com/rust-lang-nursery/bitflags/pull/157 - -# 1.0.2 - -- 30% improvement in compile time of bitflags crate ([#156]) - -- Documentation improvements ([#153]) - -- Implementation cleanup ([#149]) - -[#156]: https://github.com/rust-lang-nursery/bitflags/pull/156 -[#153]: https://github.com/rust-lang-nursery/bitflags/pull/153 -[#149]: https://github.com/rust-lang-nursery/bitflags/pull/149 - -# 1.0.1 -- Add support for `pub(restricted)` specifier on the bitflags struct ([#135]) -- Optimize performance of `all()` when called from a separate crate ([#136]) - -[#135]: https://github.com/rust-lang-nursery/bitflags/pull/135 -[#136]: https://github.com/rust-lang-nursery/bitflags/pull/136 - -# 1.0.0 -- **[breaking change]** Macro now generates [associated constants](https://doc.rust-lang.org/reference/items.html#associated-constants) ([#24]) - -- **[breaking change]** Minimum supported version is Rust **1.20**, due to usage of associated constants - -- After being broken in 0.9, the `#[deprecated]` attribute is now supported again ([#112]) - -- Other improvements to unit tests and documentation ([#106] and [#115]) - -[#24]: https://github.com/rust-lang-nursery/bitflags/pull/24 -[#106]: https://github.com/rust-lang-nursery/bitflags/pull/106 -[#112]: https://github.com/rust-lang-nursery/bitflags/pull/112 -[#115]: https://github.com/rust-lang-nursery/bitflags/pull/115 - -## How to update your code to use associated constants -Assuming the following structure definition: -```rust -bitflags! { - struct Something: u8 { - const FOO = 0b01, - const BAR = 0b10 - } -} -``` -In 0.9 and older you could do: -```rust -let x = FOO.bits | BAR.bits; -``` -Now you must use: -```rust -let x = Something::FOO.bits | Something::BAR.bits; -``` - -# 0.9.1 -- Fix the implementation of `Formatting` traits when other formatting traits were present in scope ([#105]) - -[#105]: https://github.com/rust-lang-nursery/bitflags/pull/105 - -# 0.9.0 -- **[breaking change]** Use struct keyword instead of flags to define bitflag types ([#84]) - -- **[breaking change]** Terminate const items with semicolons instead of commas ([#87]) - -- Implement the `Hex`, `Octal`, and `Binary` formatting traits ([#86]) - -- Printing an empty flag value with the `Debug` trait now prints "(empty)" instead of nothing ([#85]) - -- The `bitflags!` macro can now be used inside of a fn body, to define a type local to that function ([#74]) - -[#74]: https://github.com/rust-lang-nursery/bitflags/pull/74 -[#84]: https://github.com/rust-lang-nursery/bitflags/pull/84 -[#85]: https://github.com/rust-lang-nursery/bitflags/pull/85 -[#86]: https://github.com/rust-lang-nursery/bitflags/pull/86 -[#87]: https://github.com/rust-lang-nursery/bitflags/pull/87 - -# 0.8.2 -- Update feature flag used when building bitflags as a dependency of the Rust toolchain - -# 0.8.1 -- Allow bitflags to be used as a dependency of the Rust toolchain - -# 0.8.0 -- Add support for the experimental `i128` and `u128` integer types ([#57]) -- Add set method: `flags.set(SOME_FLAG, true)` or `flags.set(SOME_FLAG, false)` ([#55]) - This may break code that defines its own set method - -[#55]: https://github.com/rust-lang-nursery/bitflags/pull/55 -[#57]: https://github.com/rust-lang-nursery/bitflags/pull/57 - -# 0.7.1 -*(yanked)* - -# 0.7.0 -- Implement the Extend trait ([#49]) -- Allow definitions inside the `bitflags!` macro to refer to items imported from other modules ([#51]) - -[#49]: https://github.com/rust-lang-nursery/bitflags/pull/49 -[#51]: https://github.com/rust-lang-nursery/bitflags/pull/51 - -# 0.6.0 -- The `no_std` feature was removed as it is now the default -- The `assignment_operators` feature was remove as it is now enabled by default -- Some clippy suggestions have been applied +# 1.1.0 + +This is a re-release of `1.0.5`, which was yanked due to a bug in the RLS. + +# 1.0.5 + +- Use compiletest_rs flags supported by stable toolchain ([#171]) + +- Put the user provided attributes first ([#173]) + +- Make bitflags methods `const` on newer compilers ([#175]) + +[#171]: https://github.com/rust-lang-nursery/bitflags/pull/171 +[#173]: https://github.com/rust-lang-nursery/bitflags/pull/173 +[#175]: https://github.com/rust-lang-nursery/bitflags/pull/175 + +# 1.0.4 + +- Support Rust 2018 style macro imports ([#165]) + + ```rust + use bitflags::bitflags; + ``` + +[#165]: https://github.com/rust-lang-nursery/bitflags/pull/165 + +# 1.0.3 + +- Improve zero value flag handling and documentation ([#157]) + +[#157]: https://github.com/rust-lang-nursery/bitflags/pull/157 + +# 1.0.2 + +- 30% improvement in compile time of bitflags crate ([#156]) + +- Documentation improvements ([#153]) + +- Implementation cleanup ([#149]) + +[#156]: https://github.com/rust-lang-nursery/bitflags/pull/156 +[#153]: https://github.com/rust-lang-nursery/bitflags/pull/153 +[#149]: https://github.com/rust-lang-nursery/bitflags/pull/149 + +# 1.0.1 +- Add support for `pub(restricted)` specifier on the bitflags struct ([#135]) +- Optimize performance of `all()` when called from a separate crate ([#136]) + +[#135]: https://github.com/rust-lang-nursery/bitflags/pull/135 +[#136]: https://github.com/rust-lang-nursery/bitflags/pull/136 + +# 1.0.0 +- **[breaking change]** Macro now generates [associated constants](https://doc.rust-lang.org/reference/items.html#associated-constants) ([#24]) + +- **[breaking change]** Minimum supported version is Rust **1.20**, due to usage of associated constants + +- After being broken in 0.9, the `#[deprecated]` attribute is now supported again ([#112]) + +- Other improvements to unit tests and documentation ([#106] and [#115]) + +[#24]: https://github.com/rust-lang-nursery/bitflags/pull/24 +[#106]: https://github.com/rust-lang-nursery/bitflags/pull/106 +[#112]: https://github.com/rust-lang-nursery/bitflags/pull/112 +[#115]: https://github.com/rust-lang-nursery/bitflags/pull/115 + +## How to update your code to use associated constants +Assuming the following structure definition: +```rust +bitflags! { + struct Something: u8 { + const FOO = 0b01, + const BAR = 0b10 + } +} +``` +In 0.9 and older you could do: +```rust +let x = FOO.bits | BAR.bits; +``` +Now you must use: +```rust +let x = Something::FOO.bits | Something::BAR.bits; +``` + +# 0.9.1 +- Fix the implementation of `Formatting` traits when other formatting traits were present in scope ([#105]) + +[#105]: https://github.com/rust-lang-nursery/bitflags/pull/105 + +# 0.9.0 +- **[breaking change]** Use struct keyword instead of flags to define bitflag types ([#84]) + +- **[breaking change]** Terminate const items with semicolons instead of commas ([#87]) + +- Implement the `Hex`, `Octal`, and `Binary` formatting traits ([#86]) + +- Printing an empty flag value with the `Debug` trait now prints "(empty)" instead of nothing ([#85]) + +- The `bitflags!` macro can now be used inside of a fn body, to define a type local to that function ([#74]) + +[#74]: https://github.com/rust-lang-nursery/bitflags/pull/74 +[#84]: https://github.com/rust-lang-nursery/bitflags/pull/84 +[#85]: https://github.com/rust-lang-nursery/bitflags/pull/85 +[#86]: https://github.com/rust-lang-nursery/bitflags/pull/86 +[#87]: https://github.com/rust-lang-nursery/bitflags/pull/87 + +# 0.8.2 +- Update feature flag used when building bitflags as a dependency of the Rust toolchain + +# 0.8.1 +- Allow bitflags to be used as a dependency of the Rust toolchain + +# 0.8.0 +- Add support for the experimental `i128` and `u128` integer types ([#57]) +- Add set method: `flags.set(SOME_FLAG, true)` or `flags.set(SOME_FLAG, false)` ([#55]) + This may break code that defines its own set method + +[#55]: https://github.com/rust-lang-nursery/bitflags/pull/55 +[#57]: https://github.com/rust-lang-nursery/bitflags/pull/57 + +# 0.7.1 +*(yanked)* + +# 0.7.0 +- Implement the Extend trait ([#49]) +- Allow definitions inside the `bitflags!` macro to refer to items imported from other modules ([#51]) + +[#49]: https://github.com/rust-lang-nursery/bitflags/pull/49 +[#51]: https://github.com/rust-lang-nursery/bitflags/pull/51 + +# 0.6.0 +- The `no_std` feature was removed as it is now the default +- The `assignment_operators` feature was remove as it is now enabled by default +- Some clippy suggestions have been applied diff -Nru cargo-0.35.0/vendor/bitflags/CODE_OF_CONDUCT.md cargo-0.37.0/vendor/bitflags/CODE_OF_CONDUCT.md --- cargo-0.35.0/vendor/bitflags/CODE_OF_CONDUCT.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bitflags/CODE_OF_CONDUCT.md 2019-07-17 05:42:23.000000000 +0000 @@ -1,73 +1,73 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of experience, -education, socio-economic status, nationality, personal appearance, race, -religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at coc@senaite.org. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html - +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +education, socio-economic status, nationality, personal appearance, race, +religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at coc@senaite.org. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + [homepage]: https://www.contributor-covenant.org \ No newline at end of file diff -Nru cargo-0.35.0/vendor/bitflags/LICENSE-APACHE cargo-0.37.0/vendor/bitflags/LICENSE-APACHE --- cargo-0.35.0/vendor/bitflags/LICENSE-APACHE 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bitflags/LICENSE-APACHE 2019-07-17 05:42:23.000000000 +0000 @@ -1,201 +1,201 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor 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, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor 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, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff -Nru cargo-0.35.0/vendor/bitflags/LICENSE-MIT cargo-0.37.0/vendor/bitflags/LICENSE-MIT --- cargo-0.35.0/vendor/bitflags/LICENSE-MIT 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bitflags/LICENSE-MIT 2019-07-17 05:42:23.000000000 +0000 @@ -1,25 +1,25 @@ -Copyright (c) 2014 The Rust Project Developers - -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 -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. +Copyright (c) 2014 The Rust Project Developers + +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 +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff -Nru cargo-0.35.0/vendor/bitflags/README.md cargo-0.37.0/vendor/bitflags/README.md --- cargo-0.35.0/vendor/bitflags/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bitflags/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -1,34 +1,34 @@ -bitflags -======== - -[![Build Status](https://travis-ci.com/bitflags/bitflags.svg?branch=master)](https://travis-ci.com/bitflags/bitflags) -[![Join the chat at https://gitter.im/bitflags/Lobby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bitflags/Lobby?utm_source=badge&utm_medium=badge&utm_content=badge) -[![Latest version](https://img.shields.io/crates/v/bitflags.svg)](https://crates.io/crates/bitflags) -[![Documentation](https://docs.rs/bitflags/badge.svg)](https://docs.rs/bitflags) -![Minimum rustc version](https://img.shields.io/badge/rustc-1.20+-yellow.svg) -![License](https://img.shields.io/crates/l/bitflags.svg) - -A Rust macro to generate structures which behave like a set of bitflags - -- [Documentation](https://docs.rs/bitflags) -- [Release notes](https://github.com/bitflags/bitflags/releases) - -## Usage - -Add this to your `Cargo.toml`: - -```toml -[dependencies] -bitflags = "1.0" -``` - -and this to your crate root: - -```rust -#[macro_use] -extern crate bitflags; -``` - -## Rust Version Support - -The minimum supported Rust version is 1.20 due to use of associated constants. +bitflags +======== + +[![Build Status](https://travis-ci.com/bitflags/bitflags.svg?branch=master)](https://travis-ci.com/bitflags/bitflags) +[![Join the chat at https://gitter.im/bitflags/Lobby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bitflags/Lobby?utm_source=badge&utm_medium=badge&utm_content=badge) +[![Latest version](https://img.shields.io/crates/v/bitflags.svg)](https://crates.io/crates/bitflags) +[![Documentation](https://docs.rs/bitflags/badge.svg)](https://docs.rs/bitflags) +![Minimum rustc version](https://img.shields.io/badge/rustc-1.20+-yellow.svg) +![License](https://img.shields.io/crates/l/bitflags.svg) + +A Rust macro to generate structures which behave like a set of bitflags + +- [Documentation](https://docs.rs/bitflags) +- [Release notes](https://github.com/bitflags/bitflags/releases) + +## Usage + +Add this to your `Cargo.toml`: + +```toml +[dependencies] +bitflags = "1.0" +``` + +and this to your crate root: + +```rust +#[macro_use] +extern crate bitflags; +``` + +## Rust Version Support + +The minimum supported Rust version is 1.20 due to use of associated constants. diff -Nru cargo-0.35.0/vendor/bitflags/src/example_generated.rs cargo-0.37.0/vendor/bitflags/src/example_generated.rs --- cargo-0.35.0/vendor/bitflags/src/example_generated.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bitflags/src/example_generated.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,14 +1,14 @@ -//! This module shows an example of code generated by the macro. **IT MUST NOT BE USED OUTSIDE THIS -//! CRATE**. - -bitflags! { - /// This is the same `Flags` struct defined in the [crate level example](../index.html#example). - /// Note that this struct is just for documentation purposes only, it must not be used outside - /// this crate. - pub struct Flags: u32 { - const A = 0b00000001; - const B = 0b00000010; - const C = 0b00000100; - const ABC = Self::A.bits | Self::B.bits | Self::C.bits; - } -} +//! This module shows an example of code generated by the macro. **IT MUST NOT BE USED OUTSIDE THIS +//! CRATE**. + +bitflags! { + /// This is the same `Flags` struct defined in the [crate level example](../index.html#example). + /// Note that this struct is just for documentation purposes only, it must not be used outside + /// this crate. + pub struct Flags: u32 { + const A = 0b00000001; + const B = 0b00000010; + const C = 0b00000100; + const ABC = Self::A.bits | Self::B.bits | Self::C.bits; + } +} diff -Nru cargo-0.35.0/vendor/bitflags/src/lib.rs cargo-0.37.0/vendor/bitflags/src/lib.rs --- cargo-0.35.0/vendor/bitflags/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bitflags/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,1229 +1,1353 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! A typesafe bitmask flag generator useful for sets of C-style bitmask flags. -//! It can be used for creating typesafe wrappers around C APIs. -//! -//! The `bitflags!` macro generates a `struct` that manages a set of flags. The -//! flags should only be defined for integer types, otherwise unexpected type -//! errors may occur at compile time. -//! -//! # Example -//! -//! ``` -//! #[macro_use] -//! extern crate bitflags; -//! -//! bitflags! { -//! struct Flags: u32 { -//! const A = 0b00000001; -//! const B = 0b00000010; -//! const C = 0b00000100; -//! const ABC = Self::A.bits | Self::B.bits | Self::C.bits; -//! } -//! } -//! -//! fn main() { -//! let e1 = Flags::A | Flags::C; -//! let e2 = Flags::B | Flags::C; -//! assert_eq!((e1 | e2), Flags::ABC); // union -//! assert_eq!((e1 & e2), Flags::C); // intersection -//! assert_eq!((e1 - e2), Flags::A); // set difference -//! assert_eq!(!e2, Flags::A); // set complement -//! } -//! ``` -//! -//! See [`example_generated::Flags`](./example_generated/struct.Flags.html) for documentation of code -//! generated by the above `bitflags!` expansion. -//! -//! The generated `struct`s can also be extended with type and trait -//! implementations: -//! -//! ``` -//! #[macro_use] -//! extern crate bitflags; -//! -//! use std::fmt; -//! -//! bitflags! { -//! struct Flags: u32 { -//! const A = 0b00000001; -//! const B = 0b00000010; -//! } -//! } -//! -//! impl Flags { -//! pub fn clear(&mut self) { -//! self.bits = 0; // The `bits` field can be accessed from within the -//! // same module where the `bitflags!` macro was invoked. -//! } -//! } -//! -//! impl fmt::Display for Flags { -//! fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { -//! write!(f, "hi!") -//! } -//! } -//! -//! fn main() { -//! let mut flags = Flags::A | Flags::B; -//! flags.clear(); -//! assert!(flags.is_empty()); -//! assert_eq!(format!("{}", flags), "hi!"); -//! assert_eq!(format!("{:?}", Flags::A | Flags::B), "A | B"); -//! assert_eq!(format!("{:?}", Flags::B), "B"); -//! } -//! ``` -//! -//! # Visibility -//! -//! The generated struct and its associated flag constants are not exported -//! out of the current module by default. A definition can be exported out of -//! the current module by adding `pub` before `flags`: -//! -//! ``` -//! #[macro_use] -//! extern crate bitflags; -//! -//! mod example { -//! bitflags! { -//! pub struct Flags1: u32 { -//! const A = 0b00000001; -//! } -//! } -//! bitflags! { -//! # pub -//! struct Flags2: u32 { -//! const B = 0b00000010; -//! } -//! } -//! } -//! -//! fn main() { -//! let flag1 = example::Flags1::A; -//! let flag2 = example::Flags2::B; // error: const `B` is private -//! } -//! ``` -//! -//! # Attributes -//! -//! Attributes can be attached to the generated `struct` by placing them -//! before the `flags` keyword. -//! -//! # Trait implementations -//! -//! The `Copy`, `Clone`, `PartialEq`, `Eq`, `PartialOrd`, `Ord` and `Hash` -//! traits automatically derived for the `struct` using the `derive` attribute. -//! Additional traits can be derived by providing an explicit `derive` -//! attribute on `flags`. -//! -//! The `Extend` and `FromIterator` traits are implemented for the `struct`, -//! too: `Extend` adds the union of the instances of the `struct` iterated over, -//! while `FromIterator` calculates the union. -//! -//! The `Binary`, `Debug`, `LowerExp`, `Octal` and `UpperExp` trait is also -//! implemented by displaying the bits value of the internal struct. -//! -//! ## Operators -//! -//! The following operator traits are implemented for the generated `struct`: -//! -//! - `BitOr` and `BitOrAssign`: union -//! - `BitAnd` and `BitAndAssign`: intersection -//! - `BitXor` and `BitXorAssign`: toggle -//! - `Sub` and `SubAssign`: set difference -//! - `Not`: set complement -//! -//! # Methods -//! -//! The following methods are defined for the generated `struct`: -//! -//! - `empty`: an empty set of flags -//! - `all`: the set of all flags -//! - `bits`: the raw value of the flags currently stored -//! - `from_bits`: convert from underlying bit representation, unless that -//! representation contains bits that do not correspond to a flag -//! - `from_bits_truncate`: convert from underlying bit representation, dropping -//! any bits that do not correspond to flags -//! - `is_empty`: `true` if no flags are currently stored -//! - `is_all`: `true` if all flags are currently set -//! - `intersects`: `true` if there are flags common to both `self` and `other` -//! - `contains`: `true` all of the flags in `other` are contained within `self` -//! - `insert`: inserts the specified flags in-place -//! - `remove`: removes the specified flags in-place -//! - `toggle`: the specified flags will be inserted if not present, and removed -//! if they are. -//! - `set`: inserts or removes the specified flags depending on the passed value -//! -//! ## Default -//! -//! The `Default` trait is not automatically implemented for the generated struct. -//! -//! If your default value is equal to `0` (which is the same value as calling `empty()` -//! on the generated struct), you can simply derive `Default`: -//! -//! ``` -//! #[macro_use] -//! extern crate bitflags; -//! -//! bitflags! { -//! // Results in default value with bits: 0 -//! #[derive(Default)] -//! struct Flags: u32 { -//! const A = 0b00000001; -//! const B = 0b00000010; -//! const C = 0b00000100; -//! } -//! } -//! -//! fn main() { -//! let derived_default: Flags = Default::default(); -//! assert_eq!(derived_default.bits(), 0); -//! } -//! ``` -//! -//! If your default value is not equal to `0` you need to implement `Default` yourself: -//! -//! ``` -//! #[macro_use] -//! extern crate bitflags; -//! -//! bitflags! { -//! struct Flags: u32 { -//! const A = 0b00000001; -//! const B = 0b00000010; -//! const C = 0b00000100; -//! } -//! } -//! -//! // explicit `Default` implementation -//! impl Default for Flags { -//! fn default() -> Flags { -//! Flags::A | Flags::C -//! } -//! } -//! -//! fn main() { -//! let implemented_default: Flags = Default::default(); -//! assert_eq!(implemented_default, (Flags::A | Flags::C)); -//! } -//! ``` -//! -//! # Zero Flags -//! -//! Flags with a value equal to zero will have some strange behavior that one should be aware of. -//! -//! ``` -//! #[macro_use] -//! extern crate bitflags; -//! -//! bitflags! { -//! struct Flags: u32 { -//! const NONE = 0b00000000; -//! const SOME = 0b00000001; -//! } -//! } -//! -//! fn main() { -//! let empty = Flags::empty(); -//! let none = Flags::NONE; -//! let some = Flags::SOME; -//! -//! // Zero flags are treated as always present -//! assert!(empty.contains(Flags::NONE)); -//! assert!(none.contains(Flags::NONE)); -//! assert!(some.contains(Flags::NONE)); -//! -//! // Zero flags will be ignored when testing for emptiness -//! assert!(none.is_empty()); -//! } -//! ``` - -#![no_std] -#![doc(html_root_url = "https://docs.rs/bitflags/1.0.4")] - -#[cfg(test)] -#[macro_use] -extern crate std; - -// Re-export libcore using an alias so that the macros can work without -// requiring `extern crate core` downstream. -#[doc(hidden)] -pub extern crate core as _core; - -/// The macro used to generate the flag structure. -/// -/// See the [crate level docs](../bitflags/index.html) for complete documentation. -/// -/// # Example -/// -/// ``` -/// #[macro_use] -/// extern crate bitflags; -/// -/// bitflags! { -/// struct Flags: u32 { -/// const A = 0b00000001; -/// const B = 0b00000010; -/// const C = 0b00000100; -/// const ABC = Self::A.bits | Self::B.bits | Self::C.bits; -/// } -/// } -/// -/// fn main() { -/// let e1 = Flags::A | Flags::C; -/// let e2 = Flags::B | Flags::C; -/// assert_eq!((e1 | e2), Flags::ABC); // union -/// assert_eq!((e1 & e2), Flags::C); // intersection -/// assert_eq!((e1 - e2), Flags::A); // set difference -/// assert_eq!(!e2, Flags::A); // set complement -/// } -/// ``` -/// -/// The generated `struct`s can also be extended with type and trait -/// implementations: -/// -/// ``` -/// #[macro_use] -/// extern crate bitflags; -/// -/// use std::fmt; -/// -/// bitflags! { -/// struct Flags: u32 { -/// const A = 0b00000001; -/// const B = 0b00000010; -/// } -/// } -/// -/// impl Flags { -/// pub fn clear(&mut self) { -/// self.bits = 0; // The `bits` field can be accessed from within the -/// // same module where the `bitflags!` macro was invoked. -/// } -/// } -/// -/// impl fmt::Display for Flags { -/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { -/// write!(f, "hi!") -/// } -/// } -/// -/// fn main() { -/// let mut flags = Flags::A | Flags::B; -/// flags.clear(); -/// assert!(flags.is_empty()); -/// assert_eq!(format!("{}", flags), "hi!"); -/// assert_eq!(format!("{:?}", Flags::A | Flags::B), "A | B"); -/// assert_eq!(format!("{:?}", Flags::B), "B"); -/// } -/// ``` -#[macro_export(local_inner_macros)] -macro_rules! bitflags { - ( - $(#[$outer:meta])* - pub struct $BitFlags:ident: $T:ty { - $( - $(#[$inner:ident $($args:tt)*])* - const $Flag:ident = $value:expr; - )+ - } - ) => { - __bitflags! { - $(#[$outer])* - (pub) $BitFlags: $T { - $( - $(#[$inner $($args)*])* - $Flag = $value; - )+ - } - } - }; - ( - $(#[$outer:meta])* - struct $BitFlags:ident: $T:ty { - $( - $(#[$inner:ident $($args:tt)*])* - const $Flag:ident = $value:expr; - )+ - } - ) => { - __bitflags! { - $(#[$outer])* - () $BitFlags: $T { - $( - $(#[$inner $($args)*])* - $Flag = $value; - )+ - } - } - }; - ( - $(#[$outer:meta])* - pub ($($vis:tt)+) struct $BitFlags:ident: $T:ty { - $( - $(#[$inner:ident $($args:tt)*])* - const $Flag:ident = $value:expr; - )+ - } - ) => { - __bitflags! { - $(#[$outer])* - (pub ($($vis)+)) $BitFlags: $T { - $( - $(#[$inner $($args)*])* - $Flag = $value; - )+ - } - } - }; -} - -#[macro_export(local_inner_macros)] -#[doc(hidden)] -macro_rules! __bitflags { - ( - $(#[$outer:meta])* - ($($vis:tt)*) $BitFlags:ident: $T:ty { - $( - $(#[$inner:ident $($args:tt)*])* - $Flag:ident = $value:expr; - )+ - } - ) => { - #[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)] - $(#[$outer])* - $($vis)* struct $BitFlags { - bits: $T, - } - - __impl_bitflags! { - $BitFlags: $T { - $( - $(#[$inner $($args)*])* - $Flag = $value; - )+ - } - } - }; -} - -#[macro_export(local_inner_macros)] -#[doc(hidden)] -macro_rules! __impl_bitflags { - ( - $BitFlags:ident: $T:ty { - $( - $(#[$attr:ident $($args:tt)*])* - $Flag:ident = $value:expr; - )+ - } - ) => { - impl $crate::_core::fmt::Debug for $BitFlags { - fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result { - // This convoluted approach is to handle #[cfg]-based flag - // omission correctly. For example it needs to support: - // - // #[cfg(unix)] const A: Flag = /* ... */; - // #[cfg(windows)] const B: Flag = /* ... */; - - // Unconditionally define a check for every flag, even disabled - // ones. - #[allow(non_snake_case)] - trait __BitFlags { - $( - #[inline] - fn $Flag(&self) -> bool { false } - )+ - } - - // Conditionally override the check for just those flags that - // are not #[cfg]ed away. - impl __BitFlags for $BitFlags { - $( - __impl_bitflags! { - #[allow(deprecated)] - #[inline] - $(? #[$attr $($args)*])* - fn $Flag(&self) -> bool { - if Self::$Flag.bits == 0 && self.bits != 0 { - false - } else { - self.bits & Self::$Flag.bits == Self::$Flag.bits - } - } - } - )+ - } - - let mut first = true; - $( - if <$BitFlags as __BitFlags>::$Flag(self) { - if !first { - f.write_str(" | ")?; - } - first = false; - f.write_str(__bitflags_stringify!($Flag))?; - } - )+ - if first { - f.write_str("(empty)")?; - } - Ok(()) - } - } - impl $crate::_core::fmt::Binary for $BitFlags { - fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result { - $crate::_core::fmt::Binary::fmt(&self.bits, f) - } - } - impl $crate::_core::fmt::Octal for $BitFlags { - fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result { - $crate::_core::fmt::Octal::fmt(&self.bits, f) - } - } - impl $crate::_core::fmt::LowerHex for $BitFlags { - fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result { - $crate::_core::fmt::LowerHex::fmt(&self.bits, f) - } - } - impl $crate::_core::fmt::UpperHex for $BitFlags { - fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result { - $crate::_core::fmt::UpperHex::fmt(&self.bits, f) - } - } - - #[allow(dead_code)] - impl $BitFlags { - $( - $(#[$attr $($args)*])* - pub const $Flag: $BitFlags = $BitFlags { bits: $value }; - )+ - - /// Returns an empty set of flags. - #[inline] - pub fn empty() -> $BitFlags { - $BitFlags { bits: 0 } - } - - /// Returns the set containing all flags. - #[inline] - pub fn all() -> $BitFlags { - // See `Debug::fmt` for why this approach is taken. - #[allow(non_snake_case)] - trait __BitFlags { - $( - #[inline] - fn $Flag() -> $T { 0 } - )+ - } - impl __BitFlags for $BitFlags { - $( - __impl_bitflags! { - #[allow(deprecated)] - #[inline] - $(? #[$attr $($args)*])* - fn $Flag() -> $T { Self::$Flag.bits } - } - )+ - } - $BitFlags { bits: $(<$BitFlags as __BitFlags>::$Flag())|+ } - } - - /// Returns the raw value of the flags currently stored. - #[inline] - pub fn bits(&self) -> $T { - self.bits - } - - /// Convert from underlying bit representation, unless that - /// representation contains bits that do not correspond to a flag. - #[inline] - pub fn from_bits(bits: $T) -> $crate::_core::option::Option<$BitFlags> { - if (bits & !$BitFlags::all().bits()) == 0 { - $crate::_core::option::Option::Some($BitFlags { bits }) - } else { - $crate::_core::option::Option::None - } - } - - /// Convert from underlying bit representation, dropping any bits - /// that do not correspond to flags. - #[inline] - pub fn from_bits_truncate(bits: $T) -> $BitFlags { - $BitFlags { bits } & $BitFlags::all() - } - - /// Returns `true` if no flags are currently stored. - #[inline] - pub fn is_empty(&self) -> bool { - *self == $BitFlags::empty() - } - - /// Returns `true` if all flags are currently set. - #[inline] - pub fn is_all(&self) -> bool { - *self == $BitFlags::all() - } - - /// Returns `true` if there are flags common to both `self` and `other`. - #[inline] - pub fn intersects(&self, other: $BitFlags) -> bool { - !(*self & other).is_empty() - } - - /// Returns `true` all of the flags in `other` are contained within `self`. - #[inline] - pub fn contains(&self, other: $BitFlags) -> bool { - (*self & other) == other - } - - /// Inserts the specified flags in-place. - #[inline] - pub fn insert(&mut self, other: $BitFlags) { - self.bits |= other.bits; - } - - /// Removes the specified flags in-place. - #[inline] - pub fn remove(&mut self, other: $BitFlags) { - self.bits &= !other.bits; - } - - /// Toggles the specified flags in-place. - #[inline] - pub fn toggle(&mut self, other: $BitFlags) { - self.bits ^= other.bits; - } - - /// Inserts or removes the specified flags depending on the passed value. - #[inline] - pub fn set(&mut self, other: $BitFlags, value: bool) { - if value { - self.insert(other); - } else { - self.remove(other); - } - } - } - - impl $crate::_core::ops::BitOr for $BitFlags { - type Output = $BitFlags; - - /// Returns the union of the two sets of flags. - #[inline] - fn bitor(self, other: $BitFlags) -> $BitFlags { - $BitFlags { bits: self.bits | other.bits } - } - } - - impl $crate::_core::ops::BitOrAssign for $BitFlags { - - /// Adds the set of flags. - #[inline] - fn bitor_assign(&mut self, other: $BitFlags) { - self.bits |= other.bits; - } - } - - impl $crate::_core::ops::BitXor for $BitFlags { - type Output = $BitFlags; - - /// Returns the left flags, but with all the right flags toggled. - #[inline] - fn bitxor(self, other: $BitFlags) -> $BitFlags { - $BitFlags { bits: self.bits ^ other.bits } - } - } - - impl $crate::_core::ops::BitXorAssign for $BitFlags { - - /// Toggles the set of flags. - #[inline] - fn bitxor_assign(&mut self, other: $BitFlags) { - self.bits ^= other.bits; - } - } - - impl $crate::_core::ops::BitAnd for $BitFlags { - type Output = $BitFlags; - - /// Returns the intersection between the two sets of flags. - #[inline] - fn bitand(self, other: $BitFlags) -> $BitFlags { - $BitFlags { bits: self.bits & other.bits } - } - } - - impl $crate::_core::ops::BitAndAssign for $BitFlags { - - /// Disables all flags disabled in the set. - #[inline] - fn bitand_assign(&mut self, other: $BitFlags) { - self.bits &= other.bits; - } - } - - impl $crate::_core::ops::Sub for $BitFlags { - type Output = $BitFlags; - - /// Returns the set difference of the two sets of flags. - #[inline] - fn sub(self, other: $BitFlags) -> $BitFlags { - $BitFlags { bits: self.bits & !other.bits } - } - } - - impl $crate::_core::ops::SubAssign for $BitFlags { - - /// Disables all flags enabled in the set. - #[inline] - fn sub_assign(&mut self, other: $BitFlags) { - self.bits &= !other.bits; - } - } - - impl $crate::_core::ops::Not for $BitFlags { - type Output = $BitFlags; - - /// Returns the complement of this set of flags. - #[inline] - fn not(self) -> $BitFlags { - $BitFlags { bits: !self.bits } & $BitFlags::all() - } - } - - impl $crate::_core::iter::Extend<$BitFlags> for $BitFlags { - fn extend>(&mut self, iterator: T) { - for item in iterator { - self.insert(item) - } - } - } - - impl $crate::_core::iter::FromIterator<$BitFlags> for $BitFlags { - fn from_iter>(iterator: T) -> $BitFlags { - let mut result = Self::empty(); - result.extend(iterator); - result - } - } - }; - - // Every attribute that the user writes on a const is applied to the - // corresponding const that we generate, but within the implementation of - // Debug and all() we want to ignore everything but #[cfg] attributes. In - // particular, including a #[deprecated] attribute on those items would fail - // to compile. - // https://github.com/bitflags/bitflags/issues/109 - // - // Input: - // - // ? #[cfg(feature = "advanced")] - // ? #[deprecated(note = "Use somthing else.")] - // ? #[doc = r"High quality documentation."] - // fn f() -> i32 { /* ... */ } - // - // Output: - // - // #[cfg(feature = "advanced")] - // fn f() -> i32 { /* ... */ } - ( - $(#[$filtered:meta])* - ? #[cfg $($cfgargs:tt)*] - $(? #[$rest:ident $($restargs:tt)*])* - fn $($item:tt)* - ) => { - __impl_bitflags! { - $(#[$filtered])* - #[cfg $($cfgargs)*] - $(? #[$rest $($restargs)*])* - fn $($item)* - } - }; - ( - $(#[$filtered:meta])* - // $next != `cfg` - ? #[$next:ident $($nextargs:tt)*] - $(? #[$rest:ident $($restargs:tt)*])* - fn $($item:tt)* - ) => { - __impl_bitflags! { - $(#[$filtered])* - // $next filtered out - $(? #[$rest $($restargs)*])* - fn $($item)* - } - }; - ( - $(#[$filtered:meta])* - fn $($item:tt)* - ) => { - $(#[$filtered])* - fn $($item)* - }; -} - -// Same as std::stringify but callable from __impl_bitflags, which needs to use -// local_inner_macros so can only directly call macros from this crate. -#[macro_export] -#[doc(hidden)] -macro_rules! __bitflags_stringify { - ($s:ident) => { - stringify!($s) - }; -} - -#[cfg(feature = "example_generated")] -pub mod example_generated; - -#[cfg(test)] -mod tests { - use std::collections::hash_map::DefaultHasher; - use std::hash::{Hash, Hasher}; - - bitflags! { - #[doc = "> The first principle is that you must not fool yourself — and"] - #[doc = "> you are the easiest person to fool."] - #[doc = "> "] - #[doc = "> - Richard Feynman"] - struct Flags: u32 { - const A = 0b00000001; - #[doc = " macros are way better at generating code than trans is"] - const B = 0b00000010; - const C = 0b00000100; - #[doc = "* cmr bed"] - #[doc = "* strcat table"] - #[doc = " wait what?"] - const ABC = Self::A.bits | Self::B.bits | Self::C.bits; - } - } - - bitflags! { - struct _CfgFlags: u32 { - #[cfg(windows)] - const _CFG_A = 0b01; - #[cfg(unix)] - const _CFG_B = 0b01; - #[cfg(windows)] - const _CFG_C = _CFG_A.bits | 0b10; - } - } - - bitflags! { - struct AnotherSetOfFlags: i8 { - const ANOTHER_FLAG = -1_i8; - } - } - - bitflags! { - struct LongFlags: u32 { - const LONG_A = 0b1111111111111111; - } - } - - #[test] - fn test_bits() { - assert_eq!(Flags::empty().bits(), 0b00000000); - assert_eq!(Flags::A.bits(), 0b00000001); - assert_eq!(Flags::ABC.bits(), 0b00000111); - - assert_eq!(AnotherSetOfFlags::empty().bits(), 0b00); - assert_eq!(AnotherSetOfFlags::ANOTHER_FLAG.bits(), !0_i8); - } - - #[test] - fn test_from_bits() { - assert_eq!(Flags::from_bits(0), Some(Flags::empty())); - assert_eq!(Flags::from_bits(0b1), Some(Flags::A)); - assert_eq!(Flags::from_bits(0b10), Some(Flags::B)); - assert_eq!(Flags::from_bits(0b11), Some(Flags::A | Flags::B)); - assert_eq!(Flags::from_bits(0b1000), None); - - assert_eq!( - AnotherSetOfFlags::from_bits(!0_i8), - Some(AnotherSetOfFlags::ANOTHER_FLAG) - ); - } - - #[test] - fn test_from_bits_truncate() { - assert_eq!(Flags::from_bits_truncate(0), Flags::empty()); - assert_eq!(Flags::from_bits_truncate(0b1), Flags::A); - assert_eq!(Flags::from_bits_truncate(0b10), Flags::B); - assert_eq!(Flags::from_bits_truncate(0b11), (Flags::A | Flags::B)); - assert_eq!(Flags::from_bits_truncate(0b1000), Flags::empty()); - assert_eq!(Flags::from_bits_truncate(0b1001), Flags::A); - - assert_eq!( - AnotherSetOfFlags::from_bits_truncate(0_i8), - AnotherSetOfFlags::empty() - ); - } - - #[test] - fn test_is_empty() { - assert!(Flags::empty().is_empty()); - assert!(!Flags::A.is_empty()); - assert!(!Flags::ABC.is_empty()); - - assert!(!AnotherSetOfFlags::ANOTHER_FLAG.is_empty()); - } - - #[test] - fn test_is_all() { - assert!(Flags::all().is_all()); - assert!(!Flags::A.is_all()); - assert!(Flags::ABC.is_all()); - - assert!(AnotherSetOfFlags::ANOTHER_FLAG.is_all()); - } - - #[test] - fn test_two_empties_do_not_intersect() { - let e1 = Flags::empty(); - let e2 = Flags::empty(); - assert!(!e1.intersects(e2)); - - assert!(AnotherSetOfFlags::ANOTHER_FLAG.intersects(AnotherSetOfFlags::ANOTHER_FLAG)); - } - - #[test] - fn test_empty_does_not_intersect_with_full() { - let e1 = Flags::empty(); - let e2 = Flags::ABC; - assert!(!e1.intersects(e2)); - } - - #[test] - fn test_disjoint_intersects() { - let e1 = Flags::A; - let e2 = Flags::B; - assert!(!e1.intersects(e2)); - } - - #[test] - fn test_overlapping_intersects() { - let e1 = Flags::A; - let e2 = Flags::A | Flags::B; - assert!(e1.intersects(e2)); - } - - #[test] - fn test_contains() { - let e1 = Flags::A; - let e2 = Flags::A | Flags::B; - assert!(!e1.contains(e2)); - assert!(e2.contains(e1)); - assert!(Flags::ABC.contains(e2)); - - assert!(AnotherSetOfFlags::ANOTHER_FLAG.contains(AnotherSetOfFlags::ANOTHER_FLAG)); - } - - #[test] - fn test_insert() { - let mut e1 = Flags::A; - let e2 = Flags::A | Flags::B; - e1.insert(e2); - assert_eq!(e1, e2); - - let mut e3 = AnotherSetOfFlags::empty(); - e3.insert(AnotherSetOfFlags::ANOTHER_FLAG); - assert_eq!(e3, AnotherSetOfFlags::ANOTHER_FLAG); - } - - #[test] - fn test_remove() { - let mut e1 = Flags::A | Flags::B; - let e2 = Flags::A | Flags::C; - e1.remove(e2); - assert_eq!(e1, Flags::B); - - let mut e3 = AnotherSetOfFlags::ANOTHER_FLAG; - e3.remove(AnotherSetOfFlags::ANOTHER_FLAG); - assert_eq!(e3, AnotherSetOfFlags::empty()); - } - - #[test] - fn test_operators() { - let e1 = Flags::A | Flags::C; - let e2 = Flags::B | Flags::C; - assert_eq!((e1 | e2), Flags::ABC); // union - assert_eq!((e1 & e2), Flags::C); // intersection - assert_eq!((e1 - e2), Flags::A); // set difference - assert_eq!(!e2, Flags::A); // set complement - assert_eq!(e1 ^ e2, Flags::A | Flags::B); // toggle - let mut e3 = e1; - e3.toggle(e2); - assert_eq!(e3, Flags::A | Flags::B); - - let mut m4 = AnotherSetOfFlags::empty(); - m4.toggle(AnotherSetOfFlags::empty()); - assert_eq!(m4, AnotherSetOfFlags::empty()); - } - - #[test] - fn test_set() { - let mut e1 = Flags::A | Flags::C; - e1.set(Flags::B, true); - e1.set(Flags::C, false); - - assert_eq!(e1, Flags::A | Flags::B); - } - - #[test] - fn test_assignment_operators() { - let mut m1 = Flags::empty(); - let e1 = Flags::A | Flags::C; - // union - m1 |= Flags::A; - assert_eq!(m1, Flags::A); - // intersection - m1 &= e1; - assert_eq!(m1, Flags::A); - // set difference - m1 -= m1; - assert_eq!(m1, Flags::empty()); - // toggle - m1 ^= e1; - assert_eq!(m1, e1); - } - - #[test] - fn test_extend() { - let mut flags; - - flags = Flags::empty(); - flags.extend([].iter().cloned()); - assert_eq!(flags, Flags::empty()); - - flags = Flags::empty(); - flags.extend([Flags::A, Flags::B].iter().cloned()); - assert_eq!(flags, Flags::A | Flags::B); - - flags = Flags::A; - flags.extend([Flags::A, Flags::B].iter().cloned()); - assert_eq!(flags, Flags::A | Flags::B); - - flags = Flags::B; - flags.extend([Flags::A, Flags::ABC].iter().cloned()); - assert_eq!(flags, Flags::ABC); - } - - #[test] - fn test_from_iterator() { - assert_eq!([].iter().cloned().collect::(), Flags::empty()); - assert_eq!( - [Flags::A, Flags::B].iter().cloned().collect::(), - Flags::A | Flags::B - ); - assert_eq!( - [Flags::A, Flags::ABC].iter().cloned().collect::(), - Flags::ABC - ); - } - - #[test] - fn test_lt() { - let mut a = Flags::empty(); - let mut b = Flags::empty(); - - assert!(!(a < b) && !(b < a)); - b = Flags::B; - assert!(a < b); - a = Flags::C; - assert!(!(a < b) && b < a); - b = Flags::C | Flags::B; - assert!(a < b); - } - - #[test] - fn test_ord() { - let mut a = Flags::empty(); - let mut b = Flags::empty(); - - assert!(a <= b && a >= b); - a = Flags::A; - assert!(a > b && a >= b); - assert!(b < a && b <= a); - b = Flags::B; - assert!(b > a && b >= a); - assert!(a < b && a <= b); - } - - fn hash(t: &T) -> u64 { - let mut s = DefaultHasher::new(); - t.hash(&mut s); - s.finish() - } - - #[test] - fn test_hash() { - let mut x = Flags::empty(); - let mut y = Flags::empty(); - assert_eq!(hash(&x), hash(&y)); - x = Flags::all(); - y = Flags::ABC; - assert_eq!(hash(&x), hash(&y)); - } - - #[test] - fn test_debug() { - assert_eq!(format!("{:?}", Flags::A | Flags::B), "A | B"); - assert_eq!(format!("{:?}", Flags::empty()), "(empty)"); - assert_eq!(format!("{:?}", Flags::ABC), "A | B | C | ABC"); - } - - #[test] - fn test_binary() { - assert_eq!(format!("{:b}", Flags::ABC), "111"); - assert_eq!(format!("{:#b}", Flags::ABC), "0b111"); - } - - #[test] - fn test_octal() { - assert_eq!(format!("{:o}", LongFlags::LONG_A), "177777"); - assert_eq!(format!("{:#o}", LongFlags::LONG_A), "0o177777"); - } - - #[test] - fn test_lowerhex() { - assert_eq!(format!("{:x}", LongFlags::LONG_A), "ffff"); - assert_eq!(format!("{:#x}", LongFlags::LONG_A), "0xffff"); - } - - #[test] - fn test_upperhex() { - assert_eq!(format!("{:X}", LongFlags::LONG_A), "FFFF"); - assert_eq!(format!("{:#X}", LongFlags::LONG_A), "0xFFFF"); - } - - mod submodule { - bitflags! { - pub struct PublicFlags: i8 { - const X = 0; - } - } - bitflags! { - struct PrivateFlags: i8 { - const Y = 0; - } - } - - #[test] - fn test_private() { - let _ = PrivateFlags::Y; - } - } - - #[test] - fn test_public() { - let _ = submodule::PublicFlags::X; - } - - mod t1 { - mod foo { - pub type Bar = i32; - } - - bitflags! { - /// baz - struct Flags: foo::Bar { - const A = 0b00000001; - #[cfg(foo)] - const B = 0b00000010; - #[cfg(foo)] - const C = 0b00000010; - } - } - } - - #[test] - fn test_in_function() { - bitflags! { - struct Flags: u8 { - const A = 1; - #[cfg(any())] // false - const B = 2; - } - } - assert_eq!(Flags::all(), Flags::A); - assert_eq!(format!("{:?}", Flags::A), "A"); - } - - #[test] - fn test_deprecated() { - bitflags! { - pub struct TestFlags: u32 { - #[deprecated(note = "Use something else.")] - const ONE = 1; - } - } - } - - #[test] - fn test_pub_crate() { - mod module { - bitflags! { - pub (crate) struct Test: u8 { - const FOO = 1; - } - } - } - - assert_eq!(module::Test::FOO.bits(), 1); - } - - #[test] - fn test_pub_in_module() { - mod module { - mod submodule { - bitflags! { - // `pub (in super)` means only the module `module` will - // be able to access this. - pub (in super) struct Test: u8 { - const FOO = 1; - } - } - } - - mod test { - // Note: due to `pub (in super)`, - // this cannot be accessed directly by the testing code. - pub(super) fn value() -> u8 { - super::submodule::Test::FOO.bits() - } - } - - pub fn value() -> u8 { - test::value() - } - } - - assert_eq!(module::value(), 1) - } - - #[test] - fn test_zero_value_flags() { - bitflags! { - struct Flags: u32 { - const NONE = 0b0; - const SOME = 0b1; - } - } - - assert!(Flags::empty().contains(Flags::NONE)); - assert!(Flags::SOME.contains(Flags::NONE)); - assert!(Flags::NONE.is_empty()); - - assert_eq!(format!("{:?}", Flags::empty()), "NONE"); - assert_eq!(format!("{:?}", Flags::SOME), "SOME"); - } -} +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! A typesafe bitmask flag generator useful for sets of C-style bitmask flags. +//! It can be used for creating typesafe wrappers around C APIs. +//! +//! The `bitflags!` macro generates a `struct` that manages a set of flags. The +//! flags should only be defined for integer types, otherwise unexpected type +//! errors may occur at compile time. +//! +//! # Example +//! +//! ``` +//! #[macro_use] +//! extern crate bitflags; +//! +//! bitflags! { +//! struct Flags: u32 { +//! const A = 0b00000001; +//! const B = 0b00000010; +//! const C = 0b00000100; +//! const ABC = Self::A.bits | Self::B.bits | Self::C.bits; +//! } +//! } +//! +//! fn main() { +//! let e1 = Flags::A | Flags::C; +//! let e2 = Flags::B | Flags::C; +//! assert_eq!((e1 | e2), Flags::ABC); // union +//! assert_eq!((e1 & e2), Flags::C); // intersection +//! assert_eq!((e1 - e2), Flags::A); // set difference +//! assert_eq!(!e2, Flags::A); // set complement +//! } +//! ``` +//! +//! See [`example_generated::Flags`](./example_generated/struct.Flags.html) for documentation of code +//! generated by the above `bitflags!` expansion. +//! +//! The generated `struct`s can also be extended with type and trait +//! implementations: +//! +//! ``` +//! #[macro_use] +//! extern crate bitflags; +//! +//! use std::fmt; +//! +//! bitflags! { +//! struct Flags: u32 { +//! const A = 0b00000001; +//! const B = 0b00000010; +//! } +//! } +//! +//! impl Flags { +//! pub fn clear(&mut self) { +//! self.bits = 0; // The `bits` field can be accessed from within the +//! // same module where the `bitflags!` macro was invoked. +//! } +//! } +//! +//! impl fmt::Display for Flags { +//! fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +//! write!(f, "hi!") +//! } +//! } +//! +//! fn main() { +//! let mut flags = Flags::A | Flags::B; +//! flags.clear(); +//! assert!(flags.is_empty()); +//! assert_eq!(format!("{}", flags), "hi!"); +//! assert_eq!(format!("{:?}", Flags::A | Flags::B), "A | B"); +//! assert_eq!(format!("{:?}", Flags::B), "B"); +//! } +//! ``` +//! +//! # Visibility +//! +//! The generated struct and its associated flag constants are not exported +//! out of the current module by default. A definition can be exported out of +//! the current module by adding `pub` before `flags`: +//! +//! ``` +//! #[macro_use] +//! extern crate bitflags; +//! +//! mod example { +//! bitflags! { +//! pub struct Flags1: u32 { +//! const A = 0b00000001; +//! } +//! } +//! bitflags! { +//! # pub +//! struct Flags2: u32 { +//! const B = 0b00000010; +//! } +//! } +//! } +//! +//! fn main() { +//! let flag1 = example::Flags1::A; +//! let flag2 = example::Flags2::B; // error: const `B` is private +//! } +//! ``` +//! +//! # Attributes +//! +//! Attributes can be attached to the generated `struct` by placing them +//! before the `flags` keyword. +//! +//! # Trait implementations +//! +//! The `Copy`, `Clone`, `PartialEq`, `Eq`, `PartialOrd`, `Ord` and `Hash` +//! traits automatically derived for the `struct` using the `derive` attribute. +//! Additional traits can be derived by providing an explicit `derive` +//! attribute on `flags`. +//! +//! The `Extend` and `FromIterator` traits are implemented for the `struct`, +//! too: `Extend` adds the union of the instances of the `struct` iterated over, +//! while `FromIterator` calculates the union. +//! +//! The `Binary`, `Debug`, `LowerExp`, `Octal` and `UpperExp` trait is also +//! implemented by displaying the bits value of the internal struct. +//! +//! ## Operators +//! +//! The following operator traits are implemented for the generated `struct`: +//! +//! - `BitOr` and `BitOrAssign`: union +//! - `BitAnd` and `BitAndAssign`: intersection +//! - `BitXor` and `BitXorAssign`: toggle +//! - `Sub` and `SubAssign`: set difference +//! - `Not`: set complement +//! +//! # Methods +//! +//! The following methods are defined for the generated `struct`: +//! +//! - `empty`: an empty set of flags +//! - `all`: the set of all flags +//! - `bits`: the raw value of the flags currently stored +//! - `from_bits`: convert from underlying bit representation, unless that +//! representation contains bits that do not correspond to a flag +//! - `from_bits_truncate`: convert from underlying bit representation, dropping +//! any bits that do not correspond to flags +//! - `is_empty`: `true` if no flags are currently stored +//! - `is_all`: `true` if all flags are currently set +//! - `intersects`: `true` if there are flags common to both `self` and `other` +//! - `contains`: `true` all of the flags in `other` are contained within `self` +//! - `insert`: inserts the specified flags in-place +//! - `remove`: removes the specified flags in-place +//! - `toggle`: the specified flags will be inserted if not present, and removed +//! if they are. +//! - `set`: inserts or removes the specified flags depending on the passed value +//! +//! ## Default +//! +//! The `Default` trait is not automatically implemented for the generated struct. +//! +//! If your default value is equal to `0` (which is the same value as calling `empty()` +//! on the generated struct), you can simply derive `Default`: +//! +//! ``` +//! #[macro_use] +//! extern crate bitflags; +//! +//! bitflags! { +//! // Results in default value with bits: 0 +//! #[derive(Default)] +//! struct Flags: u32 { +//! const A = 0b00000001; +//! const B = 0b00000010; +//! const C = 0b00000100; +//! } +//! } +//! +//! fn main() { +//! let derived_default: Flags = Default::default(); +//! assert_eq!(derived_default.bits(), 0); +//! } +//! ``` +//! +//! If your default value is not equal to `0` you need to implement `Default` yourself: +//! +//! ``` +//! #[macro_use] +//! extern crate bitflags; +//! +//! bitflags! { +//! struct Flags: u32 { +//! const A = 0b00000001; +//! const B = 0b00000010; +//! const C = 0b00000100; +//! } +//! } +//! +//! // explicit `Default` implementation +//! impl Default for Flags { +//! fn default() -> Flags { +//! Flags::A | Flags::C +//! } +//! } +//! +//! fn main() { +//! let implemented_default: Flags = Default::default(); +//! assert_eq!(implemented_default, (Flags::A | Flags::C)); +//! } +//! ``` +//! +//! # Zero Flags +//! +//! Flags with a value equal to zero will have some strange behavior that one should be aware of. +//! +//! ``` +//! #[macro_use] +//! extern crate bitflags; +//! +//! bitflags! { +//! struct Flags: u32 { +//! const NONE = 0b00000000; +//! const SOME = 0b00000001; +//! } +//! } +//! +//! fn main() { +//! let empty = Flags::empty(); +//! let none = Flags::NONE; +//! let some = Flags::SOME; +//! +//! // Zero flags are treated as always present +//! assert!(empty.contains(Flags::NONE)); +//! assert!(none.contains(Flags::NONE)); +//! assert!(some.contains(Flags::NONE)); +//! +//! // Zero flags will be ignored when testing for emptiness +//! assert!(none.is_empty()); +//! } +//! ``` + +#![no_std] +#![doc(html_root_url = "https://docs.rs/bitflags/1.1.0")] + +#[cfg(test)] +#[macro_use] +extern crate std; + +// Re-export libcore using an alias so that the macros can work without +// requiring `extern crate core` downstream. +#[doc(hidden)] +pub extern crate core as _core; + +/// The macro used to generate the flag structure. +/// +/// See the [crate level docs](../bitflags/index.html) for complete documentation. +/// +/// # Example +/// +/// ``` +/// #[macro_use] +/// extern crate bitflags; +/// +/// bitflags! { +/// struct Flags: u32 { +/// const A = 0b00000001; +/// const B = 0b00000010; +/// const C = 0b00000100; +/// const ABC = Self::A.bits | Self::B.bits | Self::C.bits; +/// } +/// } +/// +/// fn main() { +/// let e1 = Flags::A | Flags::C; +/// let e2 = Flags::B | Flags::C; +/// assert_eq!((e1 | e2), Flags::ABC); // union +/// assert_eq!((e1 & e2), Flags::C); // intersection +/// assert_eq!((e1 - e2), Flags::A); // set difference +/// assert_eq!(!e2, Flags::A); // set complement +/// } +/// ``` +/// +/// The generated `struct`s can also be extended with type and trait +/// implementations: +/// +/// ``` +/// #[macro_use] +/// extern crate bitflags; +/// +/// use std::fmt; +/// +/// bitflags! { +/// struct Flags: u32 { +/// const A = 0b00000001; +/// const B = 0b00000010; +/// } +/// } +/// +/// impl Flags { +/// pub fn clear(&mut self) { +/// self.bits = 0; // The `bits` field can be accessed from within the +/// // same module where the `bitflags!` macro was invoked. +/// } +/// } +/// +/// impl fmt::Display for Flags { +/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +/// write!(f, "hi!") +/// } +/// } +/// +/// fn main() { +/// let mut flags = Flags::A | Flags::B; +/// flags.clear(); +/// assert!(flags.is_empty()); +/// assert_eq!(format!("{}", flags), "hi!"); +/// assert_eq!(format!("{:?}", Flags::A | Flags::B), "A | B"); +/// assert_eq!(format!("{:?}", Flags::B), "B"); +/// } +/// ``` +#[macro_export(local_inner_macros)] +macro_rules! bitflags { + ( + $(#[$outer:meta])* + pub struct $BitFlags:ident: $T:ty { + $( + $(#[$inner:ident $($args:tt)*])* + const $Flag:ident = $value:expr; + )+ + } + ) => { + __bitflags! { + $(#[$outer])* + (pub) $BitFlags: $T { + $( + $(#[$inner $($args)*])* + $Flag = $value; + )+ + } + } + }; + ( + $(#[$outer:meta])* + struct $BitFlags:ident: $T:ty { + $( + $(#[$inner:ident $($args:tt)*])* + const $Flag:ident = $value:expr; + )+ + } + ) => { + __bitflags! { + $(#[$outer])* + () $BitFlags: $T { + $( + $(#[$inner $($args)*])* + $Flag = $value; + )+ + } + } + }; + ( + $(#[$outer:meta])* + pub ($($vis:tt)+) struct $BitFlags:ident: $T:ty { + $( + $(#[$inner:ident $($args:tt)*])* + const $Flag:ident = $value:expr; + )+ + } + ) => { + __bitflags! { + $(#[$outer])* + (pub ($($vis)+)) $BitFlags: $T { + $( + $(#[$inner $($args)*])* + $Flag = $value; + )+ + } + } + }; +} + +#[macro_export(local_inner_macros)] +#[doc(hidden)] +macro_rules! __bitflags { + ( + $(#[$outer:meta])* + ($($vis:tt)*) $BitFlags:ident: $T:ty { + $( + $(#[$inner:ident $($args:tt)*])* + $Flag:ident = $value:expr; + )+ + } + ) => { + $(#[$outer])* + #[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)] + $($vis)* struct $BitFlags { + bits: $T, + } + + __impl_bitflags! { + $BitFlags: $T { + $( + $(#[$inner $($args)*])* + $Flag = $value; + )+ + } + } + }; +} + +#[macro_export(local_inner_macros)] +#[doc(hidden)] +#[cfg(bitflags_const_fn)] +macro_rules! __fn_bitflags { + ( + $(# $attr_args:tt)* + const fn $($item:tt)* + ) => { + $(# $attr_args)* + const fn $($item)* + }; + ( + $(# $attr_args:tt)* + pub const fn $($item:tt)* + ) => { + $(# $attr_args)* + pub const fn $($item)* + }; +} + +#[macro_export(local_inner_macros)] +#[doc(hidden)] +#[cfg(not(bitflags_const_fn))] +macro_rules! __fn_bitflags { + ( + $(# $attr_args:tt)* + const fn $($item:tt)* + ) => { + $(# $attr_args)* + fn $($item)* + }; + ( + $(# $attr_args:tt)* + pub const fn $($item:tt)* + ) => { + $(# $attr_args)* + pub fn $($item)* + }; +} + +#[macro_export(local_inner_macros)] +#[doc(hidden)] +macro_rules! __impl_bitflags { + ( + $BitFlags:ident: $T:ty { + $( + $(#[$attr:ident $($args:tt)*])* + $Flag:ident = $value:expr; + )+ + } + ) => { + impl $crate::_core::fmt::Debug for $BitFlags { + fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result { + // This convoluted approach is to handle #[cfg]-based flag + // omission correctly. For example it needs to support: + // + // #[cfg(unix)] const A: Flag = /* ... */; + // #[cfg(windows)] const B: Flag = /* ... */; + + // Unconditionally define a check for every flag, even disabled + // ones. + #[allow(non_snake_case)] + trait __BitFlags { + $( + #[inline] + fn $Flag(&self) -> bool { false } + )+ + } + + // Conditionally override the check for just those flags that + // are not #[cfg]ed away. + impl __BitFlags for $BitFlags { + $( + __impl_bitflags! { + #[allow(deprecated)] + #[inline] + $(? #[$attr $($args)*])* + fn $Flag(&self) -> bool { + if Self::$Flag.bits == 0 && self.bits != 0 { + false + } else { + self.bits & Self::$Flag.bits == Self::$Flag.bits + } + } + } + )+ + } + + let mut first = true; + $( + if <$BitFlags as __BitFlags>::$Flag(self) { + if !first { + f.write_str(" | ")?; + } + first = false; + f.write_str(__bitflags_stringify!($Flag))?; + } + )+ + if first { + f.write_str("(empty)")?; + } + Ok(()) + } + } + impl $crate::_core::fmt::Binary for $BitFlags { + fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result { + $crate::_core::fmt::Binary::fmt(&self.bits, f) + } + } + impl $crate::_core::fmt::Octal for $BitFlags { + fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result { + $crate::_core::fmt::Octal::fmt(&self.bits, f) + } + } + impl $crate::_core::fmt::LowerHex for $BitFlags { + fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result { + $crate::_core::fmt::LowerHex::fmt(&self.bits, f) + } + } + impl $crate::_core::fmt::UpperHex for $BitFlags { + fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result { + $crate::_core::fmt::UpperHex::fmt(&self.bits, f) + } + } + + #[allow(dead_code)] + impl $BitFlags { + $( + $(#[$attr $($args)*])* + pub const $Flag: $BitFlags = $BitFlags { bits: $value }; + )+ + + __fn_bitflags! { + /// Returns an empty set of flags + #[inline] + pub const fn empty() -> $BitFlags { + $BitFlags { bits: 0 } + } + } + + __fn_bitflags! { + /// Returns the set containing all flags. + #[inline] + pub const fn all() -> $BitFlags { + // See `Debug::fmt` for why this approach is taken. + #[allow(non_snake_case)] + trait __BitFlags { + $( + #[inline] + const $Flag: $T = 0; + )+ + } + impl __BitFlags for $BitFlags { + $( + __impl_bitflags! { + #[allow(deprecated)] + #[inline] + $(? #[$attr $($args)*])* + const $Flag: $T = Self::$Flag.bits; + } + )+ + } + $BitFlags { bits: $(<$BitFlags as __BitFlags>::$Flag)|+ } + } + } + + __fn_bitflags! { + /// Returns the raw value of the flags currently stored. + #[inline] + pub const fn bits(&self) -> $T { + self.bits + } + } + + /// Convert from underlying bit representation, unless that + /// representation contains bits that do not correspond to a flag. + #[inline] + pub fn from_bits(bits: $T) -> $crate::_core::option::Option<$BitFlags> { + if (bits & !$BitFlags::all().bits()) == 0 { + $crate::_core::option::Option::Some($BitFlags { bits }) + } else { + $crate::_core::option::Option::None + } + } + + __fn_bitflags! { + /// Convert from underlying bit representation, dropping any bits + /// that do not correspond to flags. + #[inline] + pub const fn from_bits_truncate(bits: $T) -> $BitFlags { + $BitFlags { bits: bits & $BitFlags::all().bits } + } + } + + __fn_bitflags! { + /// Returns `true` if no flags are currently stored. + #[inline] + pub const fn is_empty(&self) -> bool { + self.bits() == $BitFlags::empty().bits() + } + } + + __fn_bitflags! { + /// Returns `true` if all flags are currently set. + #[inline] + pub const fn is_all(&self) -> bool { + self.bits == $BitFlags::all().bits + } + } + + __fn_bitflags! { + /// Returns `true` if there are flags common to both `self` and `other`. + #[inline] + pub const fn intersects(&self, other: $BitFlags) -> bool { + !$BitFlags{ bits: self.bits & other.bits}.is_empty() + } + } + + __fn_bitflags! { + /// Returns `true` all of the flags in `other` are contained within `self`. + #[inline] + pub const fn contains(&self, other: $BitFlags) -> bool { + (self.bits & other.bits) == other.bits + } + } + + /// Inserts the specified flags in-place. + #[inline] + pub fn insert(&mut self, other: $BitFlags) { + self.bits |= other.bits; + } + + /// Removes the specified flags in-place. + #[inline] + pub fn remove(&mut self, other: $BitFlags) { + self.bits &= !other.bits; + } + + /// Toggles the specified flags in-place. + #[inline] + pub fn toggle(&mut self, other: $BitFlags) { + self.bits ^= other.bits; + } + + /// Inserts or removes the specified flags depending on the passed value. + #[inline] + pub fn set(&mut self, other: $BitFlags, value: bool) { + if value { + self.insert(other); + } else { + self.remove(other); + } + } + } + + impl $crate::_core::ops::BitOr for $BitFlags { + type Output = $BitFlags; + + /// Returns the union of the two sets of flags. + #[inline] + fn bitor(self, other: $BitFlags) -> $BitFlags { + $BitFlags { bits: self.bits | other.bits } + } + } + + impl $crate::_core::ops::BitOrAssign for $BitFlags { + + /// Adds the set of flags. + #[inline] + fn bitor_assign(&mut self, other: $BitFlags) { + self.bits |= other.bits; + } + } + + impl $crate::_core::ops::BitXor for $BitFlags { + type Output = $BitFlags; + + /// Returns the left flags, but with all the right flags toggled. + #[inline] + fn bitxor(self, other: $BitFlags) -> $BitFlags { + $BitFlags { bits: self.bits ^ other.bits } + } + } + + impl $crate::_core::ops::BitXorAssign for $BitFlags { + + /// Toggles the set of flags. + #[inline] + fn bitxor_assign(&mut self, other: $BitFlags) { + self.bits ^= other.bits; + } + } + + impl $crate::_core::ops::BitAnd for $BitFlags { + type Output = $BitFlags; + + /// Returns the intersection between the two sets of flags. + #[inline] + fn bitand(self, other: $BitFlags) -> $BitFlags { + $BitFlags { bits: self.bits & other.bits } + } + } + + impl $crate::_core::ops::BitAndAssign for $BitFlags { + + /// Disables all flags disabled in the set. + #[inline] + fn bitand_assign(&mut self, other: $BitFlags) { + self.bits &= other.bits; + } + } + + impl $crate::_core::ops::Sub for $BitFlags { + type Output = $BitFlags; + + /// Returns the set difference of the two sets of flags. + #[inline] + fn sub(self, other: $BitFlags) -> $BitFlags { + $BitFlags { bits: self.bits & !other.bits } + } + } + + impl $crate::_core::ops::SubAssign for $BitFlags { + + /// Disables all flags enabled in the set. + #[inline] + fn sub_assign(&mut self, other: $BitFlags) { + self.bits &= !other.bits; + } + } + + impl $crate::_core::ops::Not for $BitFlags { + type Output = $BitFlags; + + /// Returns the complement of this set of flags. + #[inline] + fn not(self) -> $BitFlags { + $BitFlags { bits: !self.bits } & $BitFlags::all() + } + } + + impl $crate::_core::iter::Extend<$BitFlags> for $BitFlags { + fn extend>(&mut self, iterator: T) { + for item in iterator { + self.insert(item) + } + } + } + + impl $crate::_core::iter::FromIterator<$BitFlags> for $BitFlags { + fn from_iter>(iterator: T) -> $BitFlags { + let mut result = Self::empty(); + result.extend(iterator); + result + } + } + }; + + // Every attribute that the user writes on a const is applied to the + // corresponding const that we generate, but within the implementation of + // Debug and all() we want to ignore everything but #[cfg] attributes. In + // particular, including a #[deprecated] attribute on those items would fail + // to compile. + // https://github.com/bitflags/bitflags/issues/109 + // + // Input: + // + // ? #[cfg(feature = "advanced")] + // ? #[deprecated(note = "Use somthing else.")] + // ? #[doc = r"High quality documentation."] + // fn f() -> i32 { /* ... */ } + // + // Output: + // + // #[cfg(feature = "advanced")] + // fn f() -> i32 { /* ... */ } + ( + $(#[$filtered:meta])* + ? #[cfg $($cfgargs:tt)*] + $(? #[$rest:ident $($restargs:tt)*])* + fn $($item:tt)* + ) => { + __impl_bitflags! { + $(#[$filtered])* + #[cfg $($cfgargs)*] + $(? #[$rest $($restargs)*])* + fn $($item)* + } + }; + ( + $(#[$filtered:meta])* + // $next != `cfg` + ? #[$next:ident $($nextargs:tt)*] + $(? #[$rest:ident $($restargs:tt)*])* + fn $($item:tt)* + ) => { + __impl_bitflags! { + $(#[$filtered])* + // $next filtered out + $(? #[$rest $($restargs)*])* + fn $($item)* + } + }; + ( + $(#[$filtered:meta])* + fn $($item:tt)* + ) => { + $(#[$filtered])* + fn $($item)* + }; + + // Every attribute that the user writes on a const is applied to the + // corresponding const that we generate, but within the implementation of + // Debug and all() we want to ignore everything but #[cfg] attributes. In + // particular, including a #[deprecated] attribute on those items would fail + // to compile. + // https://github.com/bitflags/bitflags/issues/109 + // + // const version + // + // Input: + // + // ? #[cfg(feature = "advanced")] + // ? #[deprecated(note = "Use somthing else.")] + // ? #[doc = r"High quality documentation."] + // const f: i32 { /* ... */ } + // + // Output: + // + // #[cfg(feature = "advanced")] + // const f: i32 { /* ... */ } + ( + $(#[$filtered:meta])* + ? #[cfg $($cfgargs:tt)*] + $(? #[$rest:ident $($restargs:tt)*])* + const $($item:tt)* + ) => { + __impl_bitflags! { + $(#[$filtered])* + #[cfg $($cfgargs)*] + $(? #[$rest $($restargs)*])* + const $($item)* + } + }; + ( + $(#[$filtered:meta])* + // $next != `cfg` + ? #[$next:ident $($nextargs:tt)*] + $(? #[$rest:ident $($restargs:tt)*])* + const $($item:tt)* + ) => { + __impl_bitflags! { + $(#[$filtered])* + // $next filtered out + $(? #[$rest $($restargs)*])* + const $($item)* + } + }; + ( + $(#[$filtered:meta])* + const $($item:tt)* + ) => { + $(#[$filtered])* + const $($item)* + }; +} + +// Same as std::stringify but callable from __impl_bitflags, which needs to use +// local_inner_macros so can only directly call macros from this crate. +#[macro_export] +#[doc(hidden)] +macro_rules! __bitflags_stringify { + ($s:ident) => { + stringify!($s) + }; +} + +#[cfg(feature = "example_generated")] +pub mod example_generated; + +#[cfg(test)] +mod tests { + use std::collections::hash_map::DefaultHasher; + use std::hash::{Hash, Hasher}; + + bitflags! { + #[doc = "> The first principle is that you must not fool yourself — and"] + #[doc = "> you are the easiest person to fool."] + #[doc = "> "] + #[doc = "> - Richard Feynman"] + struct Flags: u32 { + const A = 0b00000001; + #[doc = " macros are way better at generating code than trans is"] + const B = 0b00000010; + const C = 0b00000100; + #[doc = "* cmr bed"] + #[doc = "* strcat table"] + #[doc = " wait what?"] + const ABC = Self::A.bits | Self::B.bits | Self::C.bits; + } + } + + bitflags! { + struct _CfgFlags: u32 { + #[cfg(windows)] + const _CFG_A = 0b01; + #[cfg(unix)] + const _CFG_B = 0b01; + #[cfg(windows)] + const _CFG_C = _CFG_A.bits | 0b10; + } + } + + bitflags! { + struct AnotherSetOfFlags: i8 { + const ANOTHER_FLAG = -1_i8; + } + } + + bitflags! { + struct LongFlags: u32 { + const LONG_A = 0b1111111111111111; + } + } + + #[test] + fn test_bits() { + assert_eq!(Flags::empty().bits(), 0b00000000); + assert_eq!(Flags::A.bits(), 0b00000001); + assert_eq!(Flags::ABC.bits(), 0b00000111); + + assert_eq!(AnotherSetOfFlags::empty().bits(), 0b00); + assert_eq!(AnotherSetOfFlags::ANOTHER_FLAG.bits(), !0_i8); + } + + #[test] + fn test_from_bits() { + assert_eq!(Flags::from_bits(0), Some(Flags::empty())); + assert_eq!(Flags::from_bits(0b1), Some(Flags::A)); + assert_eq!(Flags::from_bits(0b10), Some(Flags::B)); + assert_eq!(Flags::from_bits(0b11), Some(Flags::A | Flags::B)); + assert_eq!(Flags::from_bits(0b1000), None); + + assert_eq!( + AnotherSetOfFlags::from_bits(!0_i8), + Some(AnotherSetOfFlags::ANOTHER_FLAG) + ); + } + + #[test] + fn test_from_bits_truncate() { + assert_eq!(Flags::from_bits_truncate(0), Flags::empty()); + assert_eq!(Flags::from_bits_truncate(0b1), Flags::A); + assert_eq!(Flags::from_bits_truncate(0b10), Flags::B); + assert_eq!(Flags::from_bits_truncate(0b11), (Flags::A | Flags::B)); + assert_eq!(Flags::from_bits_truncate(0b1000), Flags::empty()); + assert_eq!(Flags::from_bits_truncate(0b1001), Flags::A); + + assert_eq!( + AnotherSetOfFlags::from_bits_truncate(0_i8), + AnotherSetOfFlags::empty() + ); + } + + #[test] + fn test_is_empty() { + assert!(Flags::empty().is_empty()); + assert!(!Flags::A.is_empty()); + assert!(!Flags::ABC.is_empty()); + + assert!(!AnotherSetOfFlags::ANOTHER_FLAG.is_empty()); + } + + #[test] + fn test_is_all() { + assert!(Flags::all().is_all()); + assert!(!Flags::A.is_all()); + assert!(Flags::ABC.is_all()); + + assert!(AnotherSetOfFlags::ANOTHER_FLAG.is_all()); + } + + #[test] + fn test_two_empties_do_not_intersect() { + let e1 = Flags::empty(); + let e2 = Flags::empty(); + assert!(!e1.intersects(e2)); + + assert!(AnotherSetOfFlags::ANOTHER_FLAG.intersects(AnotherSetOfFlags::ANOTHER_FLAG)); + } + + #[test] + fn test_empty_does_not_intersect_with_full() { + let e1 = Flags::empty(); + let e2 = Flags::ABC; + assert!(!e1.intersects(e2)); + } + + #[test] + fn test_disjoint_intersects() { + let e1 = Flags::A; + let e2 = Flags::B; + assert!(!e1.intersects(e2)); + } + + #[test] + fn test_overlapping_intersects() { + let e1 = Flags::A; + let e2 = Flags::A | Flags::B; + assert!(e1.intersects(e2)); + } + + #[test] + fn test_contains() { + let e1 = Flags::A; + let e2 = Flags::A | Flags::B; + assert!(!e1.contains(e2)); + assert!(e2.contains(e1)); + assert!(Flags::ABC.contains(e2)); + + assert!(AnotherSetOfFlags::ANOTHER_FLAG.contains(AnotherSetOfFlags::ANOTHER_FLAG)); + } + + #[test] + fn test_insert() { + let mut e1 = Flags::A; + let e2 = Flags::A | Flags::B; + e1.insert(e2); + assert_eq!(e1, e2); + + let mut e3 = AnotherSetOfFlags::empty(); + e3.insert(AnotherSetOfFlags::ANOTHER_FLAG); + assert_eq!(e3, AnotherSetOfFlags::ANOTHER_FLAG); + } + + #[test] + fn test_remove() { + let mut e1 = Flags::A | Flags::B; + let e2 = Flags::A | Flags::C; + e1.remove(e2); + assert_eq!(e1, Flags::B); + + let mut e3 = AnotherSetOfFlags::ANOTHER_FLAG; + e3.remove(AnotherSetOfFlags::ANOTHER_FLAG); + assert_eq!(e3, AnotherSetOfFlags::empty()); + } + + #[test] + fn test_operators() { + let e1 = Flags::A | Flags::C; + let e2 = Flags::B | Flags::C; + assert_eq!((e1 | e2), Flags::ABC); // union + assert_eq!((e1 & e2), Flags::C); // intersection + assert_eq!((e1 - e2), Flags::A); // set difference + assert_eq!(!e2, Flags::A); // set complement + assert_eq!(e1 ^ e2, Flags::A | Flags::B); // toggle + let mut e3 = e1; + e3.toggle(e2); + assert_eq!(e3, Flags::A | Flags::B); + + let mut m4 = AnotherSetOfFlags::empty(); + m4.toggle(AnotherSetOfFlags::empty()); + assert_eq!(m4, AnotherSetOfFlags::empty()); + } + + #[test] + fn test_set() { + let mut e1 = Flags::A | Flags::C; + e1.set(Flags::B, true); + e1.set(Flags::C, false); + + assert_eq!(e1, Flags::A | Flags::B); + } + + #[test] + fn test_assignment_operators() { + let mut m1 = Flags::empty(); + let e1 = Flags::A | Flags::C; + // union + m1 |= Flags::A; + assert_eq!(m1, Flags::A); + // intersection + m1 &= e1; + assert_eq!(m1, Flags::A); + // set difference + m1 -= m1; + assert_eq!(m1, Flags::empty()); + // toggle + m1 ^= e1; + assert_eq!(m1, e1); + } + + + #[cfg(bitflags_const_fn)] + #[test] + fn test_const_fn() { + const M1: Flags = Flags::empty(); + + const M2: Flags = Flags::A; + assert_eq!(M2, Flags::A); + + const M3: Flags = Flags::C; + assert_eq!(M3, Flags::C); + } + + #[test] + fn test_extend() { + let mut flags; + + flags = Flags::empty(); + flags.extend([].iter().cloned()); + assert_eq!(flags, Flags::empty()); + + flags = Flags::empty(); + flags.extend([Flags::A, Flags::B].iter().cloned()); + assert_eq!(flags, Flags::A | Flags::B); + + flags = Flags::A; + flags.extend([Flags::A, Flags::B].iter().cloned()); + assert_eq!(flags, Flags::A | Flags::B); + + flags = Flags::B; + flags.extend([Flags::A, Flags::ABC].iter().cloned()); + assert_eq!(flags, Flags::ABC); + } + + #[test] + fn test_from_iterator() { + assert_eq!([].iter().cloned().collect::(), Flags::empty()); + assert_eq!( + [Flags::A, Flags::B].iter().cloned().collect::(), + Flags::A | Flags::B + ); + assert_eq!( + [Flags::A, Flags::ABC].iter().cloned().collect::(), + Flags::ABC + ); + } + + #[test] + fn test_lt() { + let mut a = Flags::empty(); + let mut b = Flags::empty(); + + assert!(!(a < b) && !(b < a)); + b = Flags::B; + assert!(a < b); + a = Flags::C; + assert!(!(a < b) && b < a); + b = Flags::C | Flags::B; + assert!(a < b); + } + + #[test] + fn test_ord() { + let mut a = Flags::empty(); + let mut b = Flags::empty(); + + assert!(a <= b && a >= b); + a = Flags::A; + assert!(a > b && a >= b); + assert!(b < a && b <= a); + b = Flags::B; + assert!(b > a && b >= a); + assert!(a < b && a <= b); + } + + fn hash(t: &T) -> u64 { + let mut s = DefaultHasher::new(); + t.hash(&mut s); + s.finish() + } + + #[test] + fn test_hash() { + let mut x = Flags::empty(); + let mut y = Flags::empty(); + assert_eq!(hash(&x), hash(&y)); + x = Flags::all(); + y = Flags::ABC; + assert_eq!(hash(&x), hash(&y)); + } + + #[test] + fn test_debug() { + assert_eq!(format!("{:?}", Flags::A | Flags::B), "A | B"); + assert_eq!(format!("{:?}", Flags::empty()), "(empty)"); + assert_eq!(format!("{:?}", Flags::ABC), "A | B | C | ABC"); + } + + #[test] + fn test_binary() { + assert_eq!(format!("{:b}", Flags::ABC), "111"); + assert_eq!(format!("{:#b}", Flags::ABC), "0b111"); + } + + #[test] + fn test_octal() { + assert_eq!(format!("{:o}", LongFlags::LONG_A), "177777"); + assert_eq!(format!("{:#o}", LongFlags::LONG_A), "0o177777"); + } + + #[test] + fn test_lowerhex() { + assert_eq!(format!("{:x}", LongFlags::LONG_A), "ffff"); + assert_eq!(format!("{:#x}", LongFlags::LONG_A), "0xffff"); + } + + #[test] + fn test_upperhex() { + assert_eq!(format!("{:X}", LongFlags::LONG_A), "FFFF"); + assert_eq!(format!("{:#X}", LongFlags::LONG_A), "0xFFFF"); + } + + mod submodule { + bitflags! { + pub struct PublicFlags: i8 { + const X = 0; + } + } + bitflags! { + struct PrivateFlags: i8 { + const Y = 0; + } + } + + #[test] + fn test_private() { + let _ = PrivateFlags::Y; + } + } + + #[test] + fn test_public() { + let _ = submodule::PublicFlags::X; + } + + mod t1 { + mod foo { + pub type Bar = i32; + } + + bitflags! { + /// baz + struct Flags: foo::Bar { + const A = 0b00000001; + #[cfg(foo)] + const B = 0b00000010; + #[cfg(foo)] + const C = 0b00000010; + } + } + } + + #[test] + fn test_in_function() { + bitflags! { + struct Flags: u8 { + const A = 1; + #[cfg(any())] // false + const B = 2; + } + } + assert_eq!(Flags::all(), Flags::A); + assert_eq!(format!("{:?}", Flags::A), "A"); + } + + #[test] + fn test_deprecated() { + bitflags! { + pub struct TestFlags: u32 { + #[deprecated(note = "Use something else.")] + const ONE = 1; + } + } + } + + #[test] + fn test_pub_crate() { + mod module { + bitflags! { + pub (crate) struct Test: u8 { + const FOO = 1; + } + } + } + + assert_eq!(module::Test::FOO.bits(), 1); + } + + #[test] + fn test_pub_in_module() { + mod module { + mod submodule { + bitflags! { + // `pub (in super)` means only the module `module` will + // be able to access this. + pub (in super) struct Test: u8 { + const FOO = 1; + } + } + } + + mod test { + // Note: due to `pub (in super)`, + // this cannot be accessed directly by the testing code. + pub(super) fn value() -> u8 { + super::submodule::Test::FOO.bits() + } + } + + pub fn value() -> u8 { + test::value() + } + } + + assert_eq!(module::value(), 1) + } + + #[test] + fn test_zero_value_flags() { + bitflags! { + struct Flags: u32 { + const NONE = 0b0; + const SOME = 0b1; + } + } + + assert!(Flags::empty().contains(Flags::NONE)); + assert!(Flags::SOME.contains(Flags::NONE)); + assert!(Flags::NONE.is_empty()); + + assert_eq!(format!("{:?}", Flags::empty()), "NONE"); + assert_eq!(format!("{:?}", Flags::SOME), "SOME"); + } +} diff -Nru cargo-0.35.0/vendor/bstr/.cargo-checksum.json cargo-0.37.0/vendor/bstr/.cargo-checksum.json --- cargo-0.35.0/vendor/bstr/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"853b090ce0f45d0265902666bf88039ea3da825e33796716c511a1ec9c170036"} \ No newline at end of file +{"files":{},"package":"fc0662252f9bba48c251a16d16a768b9fcd959593bde07544710bce6efe60b7a"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/bstr/Cargo.toml cargo-0.37.0/vendor/bstr/Cargo.toml --- cargo-0.35.0/vendor/bstr/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "bstr" -version = "0.1.3" +version = "0.2.2" authors = ["Andrew Gallant "] exclude = ["/ci/*", "/.travis.yml", "/appveyor.yml"] description = "A string type that is not required to be valid UTF-8." diff -Nru cargo-0.35.0/vendor/bstr/examples/graphemes.rs cargo-0.37.0/vendor/bstr/examples/graphemes.rs --- cargo-0.35.0/vendor/bstr/examples/graphemes.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/examples/graphemes.rs 2019-07-17 05:42:23.000000000 +0000 @@ -3,9 +3,9 @@ use std::error::Error; use std::io::{self, Write}; -use bstr::io::BufReadExt; +use bstr::{io::BufReadExt, ByteSlice}; -fn main() -> Result<(), Box> { +fn main() -> Result<(), Box> { let stdin = io::stdin(); let mut stdout = io::BufWriter::new(io::stdout()); @@ -16,7 +16,7 @@ .take(10) .last() .unwrap_or(line.len()); - stdout.write_all(line[..end].trim_end().as_bytes())?; + stdout.write_all(line[..end].trim_end())?; stdout.write_all(b"\n")?; Ok(true) })?; diff -Nru cargo-0.35.0/vendor/bstr/examples/graphemes-std.rs cargo-0.37.0/vendor/bstr/examples/graphemes-std.rs --- cargo-0.35.0/vendor/bstr/examples/graphemes-std.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/examples/graphemes-std.rs 2019-07-17 05:42:23.000000000 +0000 @@ -5,7 +5,7 @@ use unicode_segmentation::UnicodeSegmentation; -fn main() -> Result<(), Box> { +fn main() -> Result<(), Box> { let stdin = io::stdin(); let mut stdin = stdin.lock(); let mut stdout = io::BufWriter::new(io::stdout()); diff -Nru cargo-0.35.0/vendor/bstr/examples/lines.rs cargo-0.37.0/vendor/bstr/examples/lines.rs --- cargo-0.35.0/vendor/bstr/examples/lines.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/examples/lines.rs 2019-07-17 05:42:23.000000000 +0000 @@ -3,15 +3,15 @@ use std::error::Error; use std::io::{self, Write}; -use bstr::io::BufReadExt; +use bstr::{io::BufReadExt, ByteSlice}; -fn main() -> Result<(), Box> { +fn main() -> Result<(), Box> { let stdin = io::stdin(); let mut stdout = io::BufWriter::new(io::stdout()); stdin.lock().for_byte_line_with_terminator(|line| { - if line.contains("Dimension") { - stdout.write_all(line.as_bytes())?; + if line.contains_str("Dimension") { + stdout.write_all(line)?; } Ok(true) })?; diff -Nru cargo-0.35.0/vendor/bstr/examples/lines-std.rs cargo-0.37.0/vendor/bstr/examples/lines-std.rs --- cargo-0.35.0/vendor/bstr/examples/lines-std.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/examples/lines-std.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,7 +1,7 @@ use std::error::Error; use std::io::{self, BufRead, Write}; -fn main() -> Result<(), Box> { +fn main() -> Result<(), Box> { let stdin = io::stdin(); let mut stdin = stdin.lock(); let mut stdout = io::BufWriter::new(io::stdout()); diff -Nru cargo-0.35.0/vendor/bstr/examples/uppercase.rs cargo-0.37.0/vendor/bstr/examples/uppercase.rs --- cargo-0.35.0/vendor/bstr/examples/uppercase.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/examples/uppercase.rs 2019-07-17 05:42:23.000000000 +0000 @@ -3,18 +3,17 @@ use std::error::Error; use std::io::{self, Write}; -use bstr::BString; -use bstr::io::BufReadExt; +use bstr::{io::BufReadExt, ByteSlice}; -fn main() -> Result<(), Box> { +fn main() -> Result<(), Box> { let stdin = io::stdin(); let mut stdout = io::BufWriter::new(io::stdout()); - let mut upper = BString::new(); + let mut upper = vec![]; stdin.lock().for_byte_line_with_terminator(|line| { upper.clear(); line.to_uppercase_into(&mut upper); - stdout.write_all(upper.as_bytes())?; + stdout.write_all(&upper)?; Ok(true) })?; Ok(()) diff -Nru cargo-0.35.0/vendor/bstr/examples/uppercase-std.rs cargo-0.37.0/vendor/bstr/examples/uppercase-std.rs --- cargo-0.35.0/vendor/bstr/examples/uppercase-std.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/examples/uppercase-std.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,7 +1,7 @@ use std::error::Error; use std::io::{self, BufRead, Write}; -fn main() -> Result<(), Box> { +fn main() -> Result<(), Box> { let stdin = io::stdin(); let mut stdin = stdin.lock(); let mut stdout = io::BufWriter::new(io::stdout()); diff -Nru cargo-0.35.0/vendor/bstr/examples/words.rs cargo-0.37.0/vendor/bstr/examples/words.rs --- cargo-0.35.0/vendor/bstr/examples/words.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/examples/words.rs 2019-07-17 05:42:23.000000000 +0000 @@ -3,9 +3,9 @@ use std::error::Error; use std::io; -use bstr::io::BufReadExt; +use bstr::{io::BufReadExt, ByteSlice}; -fn main() -> Result<(), Box> { +fn main() -> Result<(), Box> { let stdin = io::stdin(); let mut words = 0; stdin.lock().for_byte_line_with_terminator(|line| { diff -Nru cargo-0.35.0/vendor/bstr/examples/words-std.rs cargo-0.37.0/vendor/bstr/examples/words-std.rs --- cargo-0.35.0/vendor/bstr/examples/words-std.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/examples/words-std.rs 2019-07-17 05:42:23.000000000 +0000 @@ -5,7 +5,7 @@ use unicode_segmentation::UnicodeSegmentation; -fn main() -> Result<(), Box> { +fn main() -> Result<(), Box> { let stdin = io::stdin(); let mut stdin = stdin.lock(); diff -Nru cargo-0.35.0/vendor/bstr/LICENSE-MIT cargo-0.37.0/vendor/bstr/LICENSE-MIT --- cargo-0.35.0/vendor/bstr/LICENSE-MIT 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/LICENSE-MIT 2019-07-17 05:42:23.000000000 +0000 @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 Andrew Gallant +Copyright (c) 2018-2019 Andrew Gallant Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff -Nru cargo-0.35.0/vendor/bstr/README.md cargo-0.37.0/vendor/bstr/README.md --- cargo-0.35.0/vendor/bstr/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -1,9 +1,9 @@ bstr ==== -This crate provides a `BString` and `BStr` types that are conventionally UTF-8 -for Rust. They differ from the standard library's `String` and `str` types in -that they are not required to be valid UTF-8, but may be fully or partially -valid UTF-8. +This crate provides extension traits for `&[u8]` and `Vec` that enable +their use as byte strings, where byte strings are _conventionally_ UTF-8. This +differs from the standard library's `String` and `str` types in that they are +not required to be valid UTF-8, but may be fully or partially valid UTF-8. [![Linux build status](https://api.travis-ci.org/BurntSushi/bstr.svg)](https://travis-ci.org/BurntSushi/bstr) [![Windows build status](https://ci.appveyor.com/api/projects/status/github/BurntSushi/bstr?svg=true)](https://ci.appveyor.com/project/BurntSushi/bstr) @@ -18,7 +18,7 @@ ### When should I use byte strings? See this part of the documentation for more details: -https://docs.rs/bstr/0.1.0/bstr/#when-should-i-use-byte-strings. +https://docs.rs/bstr/0.2.0/bstr/#when-should-i-use-byte-strings. The short story is that byte strings are useful when it is inconvenient or incorrect to require valid UTF-8. @@ -30,7 +30,7 @@ ```toml [dependencies] -bstr = "0.1" +bstr = "0.2" ``` @@ -46,15 +46,15 @@ use std::error::Error; use std::io::{self, Write}; -use bstr::io::BufReadExt; +use bstr::{ByteSlice, io::BufReadExt}; -fn main() -> Result<(), Box> { +fn main() -> Result<(), Box> { let stdin = io::stdin(); let mut stdout = io::BufWriter::new(io::stdout()); stdin.lock().for_byte_line_with_terminator(|line| { - if line.contains("Dimension") { - stdout.write_all(line.as_bytes())?; + if line.contains_str("Dimension") { + stdout.write_all(line)?; } Ok(true) })?; @@ -69,9 +69,9 @@ use std::error::Error; use std::io; -use bstr::io::BufReadExt; +use bstr::{ByteSlice, io::BufReadExt}; -fn main() -> Result<(), Box> { +fn main() -> Result<(), Box> { let stdin = io::stdin(); let mut words = 0; stdin.lock().for_byte_line_with_terminator(|line| { @@ -92,18 +92,17 @@ use std::error::Error; use std::io::{self, Write}; -use bstr::BString; -use bstr::io::BufReadExt; +use bstr::{ByteSlice, io::BufReadExt}; -fn main() -> Result<(), Box> { +fn main() -> Result<(), Box> { let stdin = io::stdin(); let mut stdout = io::BufWriter::new(io::stdout()); - let mut upper = BString::new(); + let mut upper = vec![]; stdin.lock().for_byte_line_with_terminator(|line| { upper.clear(); line.to_uppercase_into(&mut upper); - stdout.write_all(upper.as_bytes())?; + stdout.write_all(&upper)?; Ok(true) })?; Ok(()) @@ -118,9 +117,9 @@ use std::error::Error; use std::io::{self, Write}; -use bstr::io::BufReadExt; +use bstr::{ByteSlice, io::BufReadExt}; -fn main() -> Result<(), Box> { +fn main() -> Result<(), Box> { let stdin = io::stdin(); let mut stdout = io::BufWriter::new(io::stdout()); @@ -131,7 +130,7 @@ .take(10) .last() .unwrap_or(line.len()); - stdout.write_all(line[..end].trim_end().as_bytes())?; + stdout.write_all(line[..end].trim_end())?; stdout.write_all(b"\n")?; Ok(true) })?; @@ -146,7 +145,7 @@ and Unicode support. * `std` - **Enabled** by default. This provides APIs that require the standard - library, such as `BString`. + library, such as `Vec`. * `unicode` - **Enabled** by default. This provides APIs that require sizable Unicode data compiled into the binary. This includes, but is not limited to, grapheme/word/sentence segmenters. When this is disabled, basic support such @@ -206,8 +205,8 @@ ### High level motivation Strictly speaking, the `bstr` crate provides very little that can't already be -achieved with a `Vec`/`&[u8]` and the ecosystem of library crates. For -example: +achieved with the standard library `Vec`/`&[u8]` APIs and the ecosystem of +library crates. For example: * The standard library's [`Utf8Error`](https://doc.rust-lang.org/std/str/struct.Utf8Error.html) diff -Nru cargo-0.35.0/vendor/bstr/rustfmt.toml cargo-0.37.0/vendor/bstr/rustfmt.toml --- cargo-0.35.0/vendor/bstr/rustfmt.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/rustfmt.toml 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1,2 @@ -disable_all_formatting = true +max_width = 79 +use_small_heuristics = "max" diff -Nru cargo-0.35.0/vendor/bstr/src/ascii.rs cargo-0.37.0/vendor/bstr/src/ascii.rs --- cargo-0.35.0/vendor/bstr/src/ascii.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/ascii.rs 2019-07-17 05:42:23.000000000 +0000 @@ -147,8 +147,10 @@ let a = _mm_load_si128(ptr as *const __m128i); let b = _mm_load_si128(ptr.add(VECTOR_SIZE) as *const __m128i); - let c = _mm_load_si128(ptr.add(2 * VECTOR_SIZE) as *const __m128i); - let d = _mm_load_si128(ptr.add(3 * VECTOR_SIZE) as *const __m128i); + let c = + _mm_load_si128(ptr.add(2 * VECTOR_SIZE) as *const __m128i); + let d = + _mm_load_si128(ptr.add(3 * VECTOR_SIZE) as *const __m128i); let or1 = _mm_or_si128(a, b); let or2 = _mm_or_si128(c, d); @@ -222,9 +224,13 @@ #[cfg(any(test, not(target_arch = "x86_64")))] fn first_non_ascii_byte_mask(mask: usize) -> usize { #[cfg(target_endian = "little")] - { mask.trailing_zeros() as usize / 8 } + { + mask.trailing_zeros() as usize / 8 + } #[cfg(target_endian = "big")] - { mask.leading_zeros() as usize / 8 } + { + mask.leading_zeros() as usize / 8 + } } /// Increment the given pointer by the given amount. @@ -271,7 +277,9 @@ i, first_non_ascii_byte_fallback(s.as_bytes()), "i: {:?}, len: {:?}, s: {:?}", - i, s.len(), s + i, + s.len(), + s ); } } @@ -290,13 +298,18 @@ for i in 0..517 { for align in 0..65 { let mut s = "a".repeat(i); - s.push_str("☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃"); + s.push_str( + "☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃", + ); let s = s.get(align..).unwrap_or(""); assert_eq!( i.saturating_sub(align), first_non_ascii_byte_fallback(s.as_bytes()), "i: {:?}, align: {:?}, len: {:?}, s: {:?}", - i, align, s.len(), s + i, + align, + s.len(), + s ); } } @@ -308,13 +321,18 @@ for i in 0..517 { for align in 0..65 { let mut s = "a".repeat(i); - s.push_str("☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃"); + s.push_str( + "☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃", + ); let s = s.get(align..).unwrap_or(""); assert_eq!( i.saturating_sub(align), first_non_ascii_byte_sse2(s.as_bytes()), "i: {:?}, align: {:?}, len: {:?}, s: {:?}", - i, align, s.len(), s + i, + align, + s.len(), + s ); } } diff -Nru cargo-0.35.0/vendor/bstr/src/bstring.rs cargo-0.37.0/vendor/bstr/src/bstring.rs --- cargo-0.35.0/vendor/bstr/src/bstring.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/bstring.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,98 +1,19 @@ -use std::borrow::Cow; -use std::error; -use std::ffi::{OsStr, OsString}; -use std::fmt; -use std::iter; -use std::ops; -use std::path::{Path, PathBuf}; -use std::ptr; -use std::str; -use std::vec; - use bstr::BStr; -use utf8::{self, Utf8Error}; - -/// Concatenate the elements given by the iterator together into a single -/// `BString`. -/// -/// The elements may be any type that can be cheaply converted into an `&[u8]`. -/// This includes, but is not limited to, `&str`, `&BStr` and `&[u8]` itself. -/// -/// # Examples -/// -/// Basic usage: -/// -/// ``` -/// use bstr; -/// -/// let s = bstr::concat(&["foo", "bar", "baz"]); -/// assert_eq!(s, "foobarbaz"); -/// ``` -#[inline] -pub fn concat( - elements: I, -) -> BString -where T: AsRef<[u8]>, - I: IntoIterator -{ - let mut dest = BString::new(); - for element in elements { - dest.push(element); - } - dest -} -/// Join the elements given by the iterator with the given separator into a -/// single `BString`. -/// -/// Both the separator and the elements may be any type that can be cheaply -/// converted into an `&[u8]`. This includes, but is not limited to, -/// `&str`, `&BStr` and `&[u8]` itself. -/// -/// # Examples -/// -/// Basic usage: -/// -/// ``` -/// use bstr; -/// -/// let s = bstr::join(",", &["foo", "bar", "baz"]); -/// assert_eq!(s, "foo,bar,baz"); -/// ``` -#[inline] -pub fn join( - separator: B, - elements: I, -) -> BString -where B: AsRef<[u8]>, - T: AsRef<[u8]>, - I: IntoIterator -{ - let mut it = elements.into_iter(); - let mut dest = BString::new(); - match it.next() { - None => return dest, - Some(first) => { - dest.push(first); - } - } - for element in it { - dest.push(&separator); - dest.push(element); - } - dest -} - -/// A growable byte string that is conventionally UTF-8. +/// A wrapper for `Vec` that provides convenient string oriented trait +/// impls. /// /// A `BString` has ownership over its contents and corresponds to /// a growable or shrinkable buffer. Its borrowed counterpart is a /// [`BStr`](struct.BStr.html), called a byte string slice. /// +/// Using a `BString` is just like using a `Vec`, since `BString` +/// implements `Deref` to `Vec`. So all methods available on `Vec` +/// are also available on `BString`. +/// /// # Examples /// -/// You can create a new `BString` from a literal Unicode string or a literal -/// byte string with `BString::from`: +/// You can create a new `BString` from a `Vec` via a `From` impl: /// /// ``` /// use bstr::BString; @@ -100,92 +21,11 @@ /// let s = BString::from("Hello, world!"); /// ``` /// -/// You can append bytes, characters or other strings to a `BString`: -/// -/// ``` -/// use bstr::BString; -/// -/// let mut s = BString::from("Hello, "); -/// s.push_byte(b'w'); -/// s.push_char('o'); -/// s.push("rl"); -/// s.push(b"d!"); -/// assert_eq!(s, "Hello, world!"); -/// ``` -/// -/// If you have a `String` or a `Vec`, then you can create a `BString` -/// from it with zero cost: -/// -/// ``` -/// use bstr::BString; -/// -/// let s = BString::from(vec![b'f', b'o', b'o']); -/// let s = BString::from("foo".to_string()); -/// ``` -/// -/// A `BString` can be freely converted back to a `Vec`: -/// -/// ``` -/// use bstr::BString; -/// -/// let s = BString::from("foo"); -/// let vector = s.into_vec(); -/// assert_eq!(vector, vec![b'f', b'o', b'o']); -/// ``` -/// -/// However, converting from a `BString` to a `String` requires UTF-8 -/// validation: -/// -/// ``` -/// use bstr::BString; -/// -/// # fn example() -> Result<(), ::bstr::FromUtf8Error> { -/// let bytes = BString::from("hello"); -/// let string = bytes.into_string()?; -/// -/// assert_eq!("hello", string); -/// # Ok(()) }; example().unwrap() -/// ``` -/// -/// # UTF-8 -/// -/// Like byte string slices (`BStr`), a `BString` is only conventionally -/// UTF-8. This is in constrast to the standard library's `String` type, which -/// is guaranteed to be valid UTF-8. -/// -/// Because of this relaxation, types such as `Vec`, `&[u8]`, `String` and -/// `&str` can all be converted to a `BString` (or `BStr`) at zero cost without -/// any validation step. -/// -/// Moreover, this relaxation implies that many of the restrictions around -/// mutating a `String` do not apply to `BString`. Namely, if your `BString` -/// is valid UTF-8, then the various methods that mutate the `BString` do not -/// necessarily prevent you from causing the bytes to become invalid UTF-8. -/// For example: -/// -/// ``` -/// use bstr::{B, BString}; -/// -/// let mut s = BString::from("hello"); -/// s[1] = b'\xFF'; -/// // `s` was valid UTF-8, but now it's now. -/// assert_eq!(s, B(b"h\xFFllo")); -/// ``` -/// /// # Deref /// /// The `BString` type implements `Deref` and `DerefMut`, where the target -/// types are `&BStr` and `&mut BStr`, respectively. `Deref` permits all of the -/// methods defined on `BStr` to be implicitly callable on any `BString`. -/// For example, the `contains` method is defined on `BStr` and not `BString`, -/// but values of type `BString` can still use it directly: -/// -/// ``` -/// use bstr::BString; -/// -/// let s = BString::from("foobarbaz"); -/// assert!(s.contains("bar")); -/// ``` +/// types are `&Vec` and `&mut Vec`, respectively. `Deref` permits all of the +/// methods defined on `Vec` to be implicitly callable on any `BString`. /// /// For more information about how deref works, see the documentation for the /// [`std::ops::Deref`](https://doc.rust-lang.org/std/ops/trait.Deref.html) @@ -198,1391 +38,22 @@ /// region of memory containing the bytes, a length and a capacity. #[derive(Clone, Hash)] pub struct BString { - bytes: Vec, + pub(crate) bytes: Vec, } impl BString { - /// Creates a new empty `BString`. - /// - /// Given that the `BString` is empty, this will not allocate any initial - /// buffer. While that means that this initial operation is very - /// inexpensive, it may cause excessive allocation later when you add - /// data. If you have an idea of how much data the `String` will hold, - /// consider the [`with_capacity`] method to prevent excessive - /// re-allocation. - /// - /// [`with_capacity`]: #method.with_capacity - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let s = BString::new(); - /// ``` - #[inline] - pub fn new() -> BString { - BString { bytes: vec![] } - } - - /// Creates a new empty `BString` with a particular capacity. - /// - /// `BString`s have an internal buffer to hold their data. The capacity is - /// the length of that buffer, and can be queried with the [`capacity`] - /// method. This method creates an empty `BString`, but one with an initial - /// buffer that can hold `capacity` bytes. This is useful when you may be - /// appending a bunch of data to the `BString`, reducing the number of - /// reallocations it needs to do. - /// - /// [`capacity`]: #method.capacity - /// - /// If the given capacity is `0`, no allocation will occur, and this method - /// is identical to the [`new`] method. - /// - /// [`new`]: #method.new - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::with_capacity(10); - /// - /// // The String contains no chars, even though it has capacity for more - /// assert_eq!(s.len(), 0); - /// - /// // These are all done without reallocating... - /// let cap = s.capacity(); - /// for i in 0..10 { - /// s.push_char('a'); - /// } - /// - /// assert_eq!(s.capacity(), cap); - /// - /// // ...but this may make the vector reallocate - /// s.push_char('a'); - /// ``` #[inline] - pub fn with_capacity(capacity: usize) -> BString { - BString { bytes: Vec::with_capacity(capacity) } - } - - /// Create a new byte string from the given bytes. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let bytes = vec![b'a', b'b', b'c']; - /// let s = BString::from_vec(bytes); - /// assert_eq!("abc", s); - /// ``` - #[inline] - pub fn from_vec(bytes: Vec) -> BString { - BString { bytes } - } - - /// Create a new byte string by copying the given slice. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let s = BString::from_slice(b"abc"); - /// assert_eq!("abc", s); - /// ``` - #[inline] - pub fn from_slice>(slice: B) -> BString { - BString::from_vec(slice.as_ref().to_vec()) - } - - /// Create a new byte string from an owned OS string. - /// - /// On Unix, this always succeeds and is zero cost. On non-Unix systems, - /// this returns the original OS string if it is not valid UTF-8. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use std::ffi::OsString; - /// - /// use bstr::BString; - /// - /// let os_str = OsString::from("foo"); - /// let bs = BString::from_os_string(os_str).expect("must be valid UTF-8"); - /// assert_eq!(bs, "foo"); - /// ``` - #[inline] - pub fn from_os_string(os_str: OsString) -> Result { - BString::from_os_string_imp(os_str) - } - - #[cfg(unix)] - #[inline] - fn from_os_string_imp(os_str: OsString) -> Result { - use std::os::unix::ffi::OsStringExt; - - Ok(BString::from(os_str.into_vec())) - } - - #[cfg(not(unix))] - #[inline] - fn from_os_string_imp(os_str: OsString) -> Result { - os_str.into_string().map(BString::from) - } - - /// Lossily create a new byte string from an OS string slice. - /// - /// On Unix, this always succeeds, is zero cost and always returns a slice. - /// On non-Unix systems, this does a UTF-8 check. If the given OS string - /// slice is not valid UTF-8, then it is lossily decoded into valid UTF-8 - /// (with invalid bytes replaced by the Unicode replacement codepoint). - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use std::ffi::OsStr; - /// - /// use bstr::{B, BString}; - /// - /// let os_str = OsStr::new("foo"); - /// let bs = BString::from_os_str_lossy(os_str); - /// assert_eq!(bs, B("foo")); - /// ``` - #[inline] - pub fn from_os_str_lossy<'a>(os_str: &'a OsStr) -> Cow<'a, BStr> { - BString::from_os_str_lossy_imp(os_str) - } - - #[cfg(unix)] - #[inline] - fn from_os_str_lossy_imp<'a>(os_str: &'a OsStr) -> Cow<'a, BStr> { - use std::os::unix::ffi::OsStrExt; - - Cow::Borrowed(BStr::new(os_str.as_bytes())) - } - - #[cfg(not(unix))] - #[inline] - fn from_os_str_lossy_imp<'a>(os_str: &'a OsStr) -> Cow<'a, BStr> { - match os_str.to_string_lossy() { - Cow::Borrowed(x) => Cow::Borrowed(BStr::new(x)), - Cow::Owned(x) => Cow::Owned(BString::from(x)), - } - } - - /// Create a new byte string from an owned file path. - /// - /// On Unix, this always succeeds and is zero cost. On non-Unix systems, - /// this returns the original path if it is not valid UTF-8. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use std::path::PathBuf; - /// - /// use bstr::BString; - /// - /// let path = PathBuf::from("foo"); - /// let bs = BString::from_path_buf(path).expect("must be valid UTF-8"); - /// assert_eq!(bs, "foo"); - /// ``` - #[inline] - pub fn from_path_buf(path: PathBuf) -> Result { - BString::from_os_string(path.into_os_string()) - .map_err(PathBuf::from) - } - - /// Lossily create a new byte string from a file path. - /// - /// On Unix, this always succeeds, is zero cost and always returns a slice. - /// On non-Unix systems, this does a UTF-8 check. If the given path is not - /// valid UTF-8, then it is lossily decoded into valid UTF-8 (with invalid - /// bytes replaced by the Unicode replacement codepoint). - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use std::path::Path; - /// - /// use bstr::{B, BString}; - /// - /// let path = Path::new("foo"); - /// let bs = BString::from_path_lossy(path); - /// assert_eq!(bs, B("foo")); - /// ``` - #[inline] - pub fn from_path_lossy<'a>(path: &'a Path) -> Cow<'a, BStr> { - BString::from_os_str_lossy(path.as_os_str()) - } - - /// Appends the given byte to the end of this byte string. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("abc"); - /// s.push_byte(b'\xE2'); - /// s.push_byte(b'\x98'); - /// s.push_byte(b'\x83'); - /// assert_eq!("abc☃", s); - /// ``` - #[inline] - pub fn push_byte(&mut self, byte: u8) { - self.bytes.push(byte); - } - - /// Appends the given `char` to the end of this byte string. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("abc"); - /// s.push_char('1'); - /// s.push_char('2'); - /// s.push_char('3'); - /// assert_eq!("abc123", s); - /// ``` - #[inline] - pub fn push_char(&mut self, ch: char) { - if ch.len_utf8() == 1 { - self.bytes.push(ch as u8); - return; - } - self.bytes.extend_from_slice(ch.encode_utf8(&mut [0; 4]).as_bytes()); - } - - /// Appends the given slice to the end of this byte string. This accepts - /// any type that be converted to a `&[u8]`. This includes, but is not - /// limited to, `&str`, `&BStr`, and of course, `&[u8]` itself. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("abc"); - /// s.push(b"123"); - /// assert_eq!("abc123", s); - /// ``` - #[inline] - pub fn push>(&mut self, bytes: B) { - self.bytes.extend_from_slice(bytes.as_ref()); - } - - /// Extracts a byte string slice containing the entire `BString`. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{BStr, BString}; - /// - /// let s = BString::from("foo"); - /// - /// assert_eq!(BStr::new("foo"), s.as_bstr()); - /// ``` - #[inline] - pub fn as_bstr(&self) -> &BStr { - BStr::from_bytes(&self.bytes) - } - - /// Returns this `BString` as a borrowed byte vector. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let bs = BString::from("ab"); - /// assert!(bs.as_vec().capacity() >= 2); - /// ``` - #[inline] - pub fn as_vec(&self) -> &Vec { + pub(crate) fn as_bytes(&self) -> &[u8] { &self.bytes } - /// Converts a `BString` into a mutable string slice. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("foobar"); - /// let s_mut_str = s.as_mut_bstr(); - /// - /// s_mut_str[0] = b'F'; - /// - /// assert_eq!("Foobar", s_mut_str); - /// ``` - #[inline] - pub fn as_mut_bstr(&mut self) -> &mut BStr { - BStr::from_bytes_mut(&mut self.bytes) - } - - /// Returns this `BString` as a mutable byte vector. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut bs = BString::from("ab"); - /// bs.as_mut_vec().push(b'c'); - /// assert_eq!("abc", bs); - /// ``` - #[inline] - pub fn as_mut_vec(&mut self) -> &mut Vec { - &mut self.bytes - } - - /// Converts a `BString` into a byte vector. - /// - /// This consumes the `BString`, and thus the contents are not copied. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let s = BString::from("hello"); - /// let bytes = s.into_vec(); - /// - /// assert_eq!(vec![104, 101, 108, 108, 111], &bytes[..]); - /// ``` - #[inline] - pub fn into_vec(self) -> Vec { - self.bytes - } - - /// Converts a `BString` into a `String` if and only if this byte string is - /// valid UTF-8. - /// - /// If it is not valid UTF-8, then the error `std::string::FromUtf8Error` - /// is returned. (This error can be used to examine why UTF-8 validation - /// failed, or to regain the original byte string.) - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// # fn example() -> Result<(), ::bstr::FromUtf8Error> { - /// let bytes = BString::from("hello"); - /// let string = bytes.into_string()?; - /// - /// assert_eq!("hello", string); - /// # Ok(()) }; example().unwrap() - /// ``` - /// - /// If this byte string is not valid UTF-8, then an error will be returned. - /// That error can then be used to inspect the location at which invalid - /// UTF-8 was found, or to regain the original byte string: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let bytes = BString::from_slice(b"foo\xFFbar"); - /// let err = bytes.into_string().unwrap_err(); - /// - /// assert_eq!(err.utf8_error().valid_up_to(), 3); - /// assert_eq!(err.utf8_error().error_len(), Some(1)); - /// - /// // At no point in this example is an allocation performed. - /// let bytes = BString::from(err.into_bstring()); - /// assert_eq!(bytes, B(b"foo\xFFbar")); - /// ``` - #[inline] - pub fn into_string(self) -> Result { - match utf8::validate(self.as_bytes()) { - Err(err) => { - Err(FromUtf8Error { original: self, err: err }) - } - Ok(()) => { - // SAFETY: This is safe because of the guarantees provided by - // utf8::validate. - unsafe { Ok(self.into_string_unchecked()) } - } - } - } - - /// Lossily converts a `BString` into a `String`. If this byte string - /// contains invalid UTF-8, then the invalid bytes are replaced with the - /// Unicode replacement codepoint. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let bytes = BString::from_slice(b"foo\xFFbar"); - /// let string = bytes.into_string_lossy(); - /// assert_eq!(string, "foo\u{FFFD}bar"); - /// ``` - #[inline] - pub fn into_string_lossy(self) -> String { - self.to_string() - } - - /// Unsafely convert this byte string into a `String`, without checking for - /// valid UTF-8. - /// - /// # Safety - /// - /// Callers *must* ensure that this byte string is valid UTF-8 before - /// calling this method. Converting a byte string into a `String` that is - /// not valid UTF-8 is considered undefined behavior. - /// - /// This routine is useful in performance sensitive contexts where the - /// UTF-8 validity of the byte string is already known and it is - /// undesirable to pay the cost of an additional UTF-8 validation check - /// that [`into_string`](#method.into_string) performs. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// // SAFETY: This is safe because string literals are guaranteed to be - /// // valid UTF-8 by the Rust compiler. - /// let s = unsafe { BString::from("☃βツ").into_string_unchecked() }; - /// assert_eq!("☃βツ", s); - /// ``` - pub unsafe fn into_string_unchecked(self) -> String { - String::from_utf8_unchecked(self.into_vec()) - } - - /// Converts this byte string into an OS string, in place. - /// - /// On Unix, this always succeeds and is zero cost. On non-Unix systems, - /// this returns the original byte string if it is not valid UTF-8. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use std::ffi::OsStr; - /// - /// use bstr::BString; - /// - /// let bs = BString::from("foo"); - /// let os_str = bs.into_os_string().expect("should be valid UTF-8"); - /// assert_eq!(os_str, OsStr::new("foo")); - /// ``` - #[inline] - pub fn into_os_string(self) -> Result { - self.into_os_string_imp() - } - - #[cfg(unix)] - #[inline] - fn into_os_string_imp(self) -> Result { - use std::os::unix::ffi::OsStringExt; - - Ok(OsString::from_vec(self.into_vec())) - } - - #[cfg(not(unix))] - #[inline] - fn into_os_string_imp(self) -> Result { - match self.into_string() { - Ok(s) => Ok(OsString::from(s)), - Err(err) => Err(err.into_bstring()), - } - } - - /// Lossily converts this byte string into an OS string, in place. - /// - /// On Unix, this always succeeds and is zero cost. On non-Unix systems, - /// this will perform a UTF-8 check and lossily convert this byte string - /// into valid UTF-8 using the Unicode replacement codepoint. - /// - /// Note that this can prevent the correct roundtripping of file paths on - /// non-Unix systems such as Windows, where file paths are an arbitrary - /// sequence of 16-bit integers. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let bs = BString::from_slice(b"foo\xFFbar"); - /// let os_str = bs.into_os_string_lossy(); - /// assert_eq!(os_str.to_string_lossy(), "foo\u{FFFD}bar"); - /// ``` - #[inline] - pub fn into_os_string_lossy(self) -> OsString { - self.into_os_string_lossy_imp() - } - - #[cfg(unix)] - #[inline] - fn into_os_string_lossy_imp(self) -> OsString { - use std::os::unix::ffi::OsStringExt; - - OsString::from_vec(self.into_vec()) - } - - #[cfg(not(unix))] - #[inline] - fn into_os_string_lossy_imp(self) -> OsString { - OsString::from(self.into_string_lossy()) - } - - /// Converts this byte string into an owned file path, in place. - /// - /// On Unix, this always succeeds and is zero cost. On non-Unix systems, - /// this returns the original byte string if it is not valid UTF-8. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let bs = BString::from("foo"); - /// let path = bs.into_path_buf().expect("should be valid UTF-8"); - /// assert_eq!(path.as_os_str(), "foo"); - /// ``` - #[inline] - pub fn into_path_buf(self) -> Result { - self.into_os_string().map(PathBuf::from) - } - - /// Lossily converts this byte string into an owned file path, in place. - /// - /// On Unix, this always succeeds and is zero cost. On non-Unix systems, - /// this will perform a UTF-8 check and lossily convert this byte string - /// into valid UTF-8 using the Unicode replacement codepoint. - /// - /// Note that this can prevent the correct roundtripping of file paths on - /// non-Unix systems such as Windows, where file paths are an arbitrary - /// sequence of 16-bit integers. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let bs = BString::from_slice(b"foo\xFFbar"); - /// let path = bs.into_path_buf_lossy(); - /// assert_eq!(path.to_string_lossy(), "foo\u{FFFD}bar"); - /// ``` - #[inline] - pub fn into_path_buf_lossy(self) -> PathBuf { - PathBuf::from(self.into_os_string_lossy()) - } - - /// Converts this `BString` into a `Box`. - /// - /// This will drop any excess capacity. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let s = BString::from("foobar"); - /// let b = s.into_boxed_bstr(); - /// assert_eq!(6, b.len()); - /// ``` - #[inline] - pub fn into_boxed_bstr(self) -> Box { - unsafe { - let slice = self.bytes.into_boxed_slice(); - Box::from_raw(Box::into_raw(slice) as *mut BStr) - } - } - - /// Returns this byte string's capacity, in bytes. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let s = BString::with_capacity(10); - /// assert_eq!(10, s.capacity()); - /// ``` - #[inline] - pub fn capacity(&self) -> usize { - self.bytes.capacity() - } - - /// Truncates this byte string, removing all contents. - /// - /// The resulting byte string will always have length `0`, but its capacity - /// remains unchanged. - #[inline] - pub fn clear(&mut self) { - self.bytes.clear(); - } - - /// Ensures that this `BString`'s capacity is at least `additional` - /// bytes larger than its length. - /// - /// The capacity may be increased by more than `additional` bytes if it - /// chooses, to prevent frequent reallocations. - /// - /// If you do not want this "at least" behavior, use the - /// [`reserve_exact`](#method.reserve_exact) method instead. - /// - /// # Panics - /// - /// Panics if the new capacity overflows `usize`. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::new(); - /// s.reserve(10); - /// assert!(s.capacity() >= 10); - /// ``` - #[inline] - pub fn reserve(&mut self, additional: usize) { - self.bytes.reserve(additional); - } - - /// Ensures that this `BString`'s capacity is exactly `additional` - /// bytes larger than its length. - /// - /// Consider using the [`reserve`](#method.reserve) method unless you - /// absolutely know better than the allocator. - /// - /// # Panics - /// - /// Panics if the new capacity overflows `usize`. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::new(); - /// s.reserve_exact(10); - /// assert!(s.capacity() >= 10); - /// ``` - #[inline] - pub fn reserve_exact(&mut self, additional: usize) { - self.bytes.reserve_exact(additional); - } - - /// Shrinks the capacity of this `BString` to match its length. - /// - /// Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("foo"); - /// s.reserve(10); - /// assert!(s.capacity() >= 10); - /// s.shrink_to_fit(); - /// assert_eq!(3, s.capacity()); - /// ``` - #[inline] - pub fn shrink_to_fit(&mut self) { - self.bytes.shrink_to_fit(); - } - - /// Shortens this `BString` to the specified length, in bytes. - /// - /// If `new_len` is greater than or equal to this byte string's current - /// length, then this has no effect. - /// - /// Note that this does _not_ panic if the result is not on a valid - /// `char` boundary. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("foobar"); - /// s.truncate(3); - /// assert_eq!("foo", s); - /// ``` #[inline] - pub fn truncate(&mut self, new_len: usize) { - if new_len < self.len() { - self.bytes.truncate(new_len); - } + pub(crate) fn as_bstr(&self) -> &BStr { + BStr::new(&self.bytes) } - /// Resizes this byte string in place so that the length of this byte - /// string is equivalent to `new_len`. - /// - /// If `new_len` is greater than the length of this byte string, then - /// the byte string is extended by the difference, which each additional - /// byte filled with the given value. If `new_len` is less than the length - /// of this byte string, then it is simply truncated. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("f"); - /// s.resize(3, b'o'); - /// assert_eq!(s, "foo"); - /// s.resize(1, b'o'); - /// assert_eq!(s, "f"); - /// ``` #[inline] - pub fn resize(&mut self, new_len: usize, value: u8) { - self.bytes.resize(new_len, value); - } - - /// Removes the last codepoint from this `BString` and returns it. - /// - /// If this byte string is empty, then `None` is returned. If the last - /// bytes of this byte string do not correspond to a valid UTF-8 code unit - /// sequence, then the Unicode replacement codepoint is yielded instead in - /// accordance with the - /// [replacement codepoint substitution policy](index.html#handling-of-invalid-utf8-8). - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("foo"); - /// assert_eq!(s.pop_char(), Some('o')); - /// assert_eq!(s.pop_char(), Some('o')); - /// assert_eq!(s.pop_char(), Some('f')); - /// assert_eq!(s.pop_char(), None); - /// ``` - /// - /// This shows the replacement codepoint substitution policy. Note that - /// the first pop yields a replacement codepoint but actually removes two - /// bytes. This is in contrast with subsequent pops when encountering - /// `\xFF` since `\xFF` is never a valid prefix for any valid UTF-8 - /// code unit sequence. - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from_slice(b"f\xFF\xFF\xFFoo\xE2\x98"); - /// assert_eq!(s.pop_char(), Some('\u{FFFD}')); - /// assert_eq!(s.pop_char(), Some('o')); - /// assert_eq!(s.pop_char(), Some('o')); - /// assert_eq!(s.pop_char(), Some('\u{FFFD}')); - /// assert_eq!(s.pop_char(), Some('\u{FFFD}')); - /// assert_eq!(s.pop_char(), Some('\u{FFFD}')); - /// assert_eq!(s.pop_char(), Some('f')); - /// assert_eq!(s.pop_char(), None); - /// ``` - #[inline] - pub fn pop_char(&mut self) -> Option { - let (ch, size) = utf8::decode_last_lossy(self.as_bytes()); - if size == 0 { - return None; - } - let new_len = self.len() - size; - self.truncate(new_len); - Some(ch) - } - - /// Removes the last byte from this `BString` and returns it. - /// - /// If this byte string is empty, then `None` is returned. - /// - /// Note that if the last codepoint in this byte string is not ASCII, then - /// removing the last byte could make this byte string contain invalid - /// UTF-8. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("foo"); - /// assert_eq!(s.pop_byte(), Some(b'o')); - /// assert_eq!(s.pop_byte(), Some(b'o')); - /// assert_eq!(s.pop_byte(), Some(b'f')); - /// assert_eq!(s.pop_byte(), None); - /// ``` - #[inline] - pub fn pop_byte(&mut self) -> Option { - self.bytes.pop() - } - - /// **DEPRECATED**: Use - /// [`pop_char`](struct.BString.html#method.pop_char) - /// or - /// [`pop_byte`](struct.BString.html#method.pop_byte) - /// instead. - /// - /// Removes the last codepoint from this `BString` and returns it. - /// - /// If this byte string is empty, then `None` is returned. If the last - /// bytes of this byte string do not correspond to a valid UTF-8 code unit - /// sequence, then the Unicode replacement codepoint is yielded instead in - /// accordance with the - /// [replacement codepoint substitution policy](index.html#handling-of-invalid-utf8-8). - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("foo"); - /// assert_eq!(s.pop(), Some('o')); - /// assert_eq!(s.pop(), Some('o')); - /// assert_eq!(s.pop(), Some('f')); - /// assert_eq!(s.pop(), None); - /// ``` - /// - /// This shows the replacement codepoint substitution policy. Note that - /// the first pop yields a replacement codepoint but actually removes two - /// bytes. This is in contrast with subsequent pops when encountering - /// `\xFF` since `\xFF` is never a valid prefix for any valid UTF-8 - /// code unit sequence. - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from_slice(b"f\xFF\xFF\xFFoo\xE2\x98"); - /// assert_eq!(s.pop(), Some('\u{FFFD}')); - /// assert_eq!(s.pop(), Some('o')); - /// assert_eq!(s.pop(), Some('o')); - /// assert_eq!(s.pop(), Some('\u{FFFD}')); - /// assert_eq!(s.pop(), Some('\u{FFFD}')); - /// assert_eq!(s.pop(), Some('\u{FFFD}')); - /// assert_eq!(s.pop(), Some('f')); - /// assert_eq!(s.pop(), None); - /// ``` - #[deprecated(since = "0.1.1", note = "use pop_char or pop_byte instead")] - #[inline] - pub fn pop(&mut self) -> Option { - self.pop_char() - } - - /// Removes a `char` from this `BString` at the given byte position and - /// returns it. - /// - /// If the bytes at the given position do not lead to a valid UTF-8 code - /// unit sequence, then a - /// [replacement codepoint is returned instead](index.html#handling-of-invalid-utf8-8). - /// - /// # Panics - /// - /// Panics if `at` is larger than or equal to this byte string's length. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("foo☃bar"); - /// assert_eq!('☃', s.remove(3)); - /// assert_eq!("foobar", s); - /// ``` - /// - /// This example shows how the Unicode replacement codepoint policy is - /// used: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from_slice(b"foo\xFFbar"); - /// assert_eq!('\u{FFFD}', s.remove(3)); - /// assert_eq!("foobar", s); - /// ``` - #[inline] - pub fn remove(&mut self, at: usize) -> char { - let (ch, size) = utf8::decode_lossy(self[at..].as_bytes()); - assert!(size > 0, "expected {} to be less than {}", at, self.len()); - self.bytes.drain(at..at + size); - ch - } - - /// Inserts the given codepoint into this `BString` at a particular byte - /// position. - /// - /// This is an `O(n)` operation as it may copy a number of elements in this - /// byte string proportional to its length. - /// - /// # Panics - /// - /// Panics if `at` is larger than the byte string's length. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("foobar"); - /// s.insert_char(3, '☃'); - /// assert_eq!("foo☃bar", s); - /// ``` - #[inline] - pub fn insert_char(&mut self, at: usize, ch: char) { - self.insert(at, ch.encode_utf8(&mut [0; 4]).as_bytes()); - } - - /// Inserts the given byte string into this byte string at a particular - /// byte position. - /// - /// This is an `O(n)` operation as it may copy a number of elements in this - /// byte string proportional to its length. - /// - /// Note that the type parameter `B` on this method means that it can - /// accept anything that can be cheaply converted to a `&[u8]`. This - /// includes, but is not limited to, `&str`, `&BStr` and `&[u8]` itself. - /// - /// # Panics - /// - /// Panics if `at` is larger than the byte string's length. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("foobar"); - /// s.insert(3, "☃☃☃"); - /// assert_eq!("foo☃☃☃bar", s); - /// ``` - #[inline] - pub fn insert>(&mut self, at: usize, bytes: B) { - assert!(at <= self.len(), "expected {} to be <= {}", at, self.len()); - - let bytes = bytes.as_ref(); - let len = self.len(); - - // SAFETY: We'd like to efficiently splice in the given bytes into - // this byte string. Since we are only working with `u8` elements here, - // we only need to consider whether our bounds are correct and whether - // our byte string has enough space. - self.reserve(bytes.len()); - unsafe { - // Shift bytes after `at` over by the length of `bytes` to make - // room for it. This requires referencing two regions of memory - // that may overlap, so we use ptr::copy. - ptr::copy( - self.bytes.as_ptr().add(at), - self.bytes.as_mut_ptr().add(at + bytes.len()), - len - at, - ); - // Now copy the bytes given into the room we made above. In this - // case, we know that the given bytes cannot possibly overlap - // with this byte string since we have a mutable borrow of the - // latter. Thus, we can use a nonoverlapping copy. - ptr::copy_nonoverlapping( - bytes.as_ptr(), - self.bytes.as_mut_ptr().add(at), - bytes.len(), - ); - self.bytes.set_len(len + bytes.len()); - } - } - - /// Splits this `BString` into two separate byte strings at the given - /// index. - /// - /// This returns a newly allocated `BString`, while `self` retans bytes - /// `[0, at)` and the returned `BString` contains bytes `[at, len)`. - /// - /// The capacity of `self` does not change. - /// - /// # Panics - /// - /// Panics if `at` is beyond the end of this byte string. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("foobar"); - /// let bar = s.split_off(3); - /// assert_eq!(s, "foo"); - /// assert_eq!(bar, "bar"); - /// ``` - #[inline] - pub fn split_off(&mut self, at: usize) -> BString { - BString::from(self.bytes.split_off(at)) - } - - /// Removes the specified range in this byte string and replaces it with - /// the given bytes. The given bytes do not need to have the same length - /// as the range provided. - /// - /// # Panics - /// - /// Panics if the given range is invalid. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("foobar"); - /// s.replace_range(2..4, "xxxxx"); - /// assert_eq!(s, "foxxxxxar"); - /// ``` - #[inline] - pub fn replace_range( - &mut self, - range: R, - replace_with: B, - ) where R: ops::RangeBounds, - B: AsRef<[u8]> - { - self.bytes.splice(range, replace_with.as_ref().iter().cloned()); - } - - /// Creates a draining iterator that removes the specified range in this - /// `BString` and yields each of the removed bytes. - /// - /// Note that the elements specified by the given range are removed - /// regardless of whether the returned iterator is fully exhausted. - /// - /// Also note that is is unspecified how many bytes are removed from the - /// `BString` if the `DrainBytes` iterator is leaked. - /// - /// # Panics - /// - /// Panics if the given range is not valid. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("foobar"); - /// { - /// let mut drainer = s.drain_bytes(2..4); - /// assert_eq!(drainer.next(), Some(b'o')); - /// assert_eq!(drainer.next(), Some(b'b')); - /// assert_eq!(drainer.next(), None); - /// } - /// assert_eq!(s, "foar"); - /// ``` - #[inline] - pub fn drain_bytes( - &mut self, - range: R, - ) -> DrainBytes - where R: ops::RangeBounds - { - DrainBytes { it: self.bytes.drain(range) } - } -} - -/// A draining byte oriented iterator for `BString`. -/// -/// This iterator is created by -/// [`BString::drain`](struct.BString.html#method.drain). -/// -/// # Examples -/// -/// Basic usage: -/// -/// ``` -/// use bstr::BString; -/// -/// let mut s = BString::from("foobar"); -/// { -/// let mut drainer = s.drain_bytes(2..4); -/// assert_eq!(drainer.next(), Some(b'o')); -/// assert_eq!(drainer.next(), Some(b'b')); -/// assert_eq!(drainer.next(), None); -/// } -/// assert_eq!(s, "foar"); -/// ``` -#[derive(Debug)] -pub struct DrainBytes<'a> { - it: vec::Drain<'a, u8>, -} - -impl<'a> iter::FusedIterator for DrainBytes<'a> {} - -impl<'a> Iterator for DrainBytes<'a> { - type Item = u8; - - #[inline] - fn next(&mut self) -> Option { - self.it.next() - } -} - -impl<'a> DoubleEndedIterator for DrainBytes<'a> { - #[inline] - fn next_back(&mut self) -> Option { - self.it.next_back() - } -} - -impl<'a> ExactSizeIterator for DrainBytes<'a> { - #[inline] - fn len(&self) -> usize { - self.it.len() - } -} - -/// An error that may occur when converting a `BString` to a `String`. -/// -/// This error includes the original `BString` that failed to convert to a -/// `String`. This permits callers to recover the allocation used even if it -/// it not valid UTF-8. -/// -/// # Examples -/// -/// Basic usage: -/// -/// ``` -/// use bstr::{B, BString}; -/// -/// let bytes = BString::from_slice(b"foo\xFFbar"); -/// let err = bytes.into_string().unwrap_err(); -/// -/// assert_eq!(err.utf8_error().valid_up_to(), 3); -/// assert_eq!(err.utf8_error().error_len(), Some(1)); -/// -/// // At no point in this example is an allocation performed. -/// let bytes = BString::from(err.into_bstring()); -/// assert_eq!(bytes, B(b"foo\xFFbar")); -/// ``` -#[derive(Debug, Eq, PartialEq)] -pub struct FromUtf8Error { - original: BString, - err: Utf8Error, -} - -impl FromUtf8Error { - /// Return the original bytes as a slice that failed to convert to a - /// `String`. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let bytes = BString::from_slice(b"foo\xFFbar"); - /// let err = bytes.into_string().unwrap_err(); - /// - /// // At no point in this example is an allocation performed. - /// assert_eq!(err.as_bstr(), B(b"foo\xFFbar")); - /// ``` - #[inline] - pub fn as_bstr(&self) -> &BStr { - &self.original - } - - /// Consume this error and return the original byte string that failed to - /// convert to a `String`. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let bytes = BString::from_slice(b"foo\xFFbar"); - /// let err = bytes.into_string().unwrap_err(); - /// let original = err.into_bstring(); - /// - /// // At no point in this example is an allocation performed. - /// assert_eq!(original, B(b"foo\xFFbar")); - /// ``` - #[inline] - pub fn into_bstring(self) -> BString { - self.original - } - - /// Return the underlying UTF-8 error that occurred. This error provides - /// information on the nature and location of the invalid UTF-8 detected. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let bytes = BString::from_slice(b"foo\xFFbar"); - /// let err = bytes.into_string().unwrap_err(); - /// - /// assert_eq!(err.utf8_error().valid_up_to(), 3); - /// assert_eq!(err.utf8_error().error_len(), Some(1)); - /// ``` - #[inline] - pub fn utf8_error(&self) -> &Utf8Error { - &self.err - } -} - -impl error::Error for FromUtf8Error { - #[inline] - fn description(&self) -> &str { "invalid UTF-8 vector" } -} - -impl fmt::Display for FromUtf8Error { - #[inline] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", self.err) - } -} - -#[cfg(test)] -mod tests { - use bstr::B; - use super::*; - - #[test] - fn insert() { - let mut s = BString::new(); - s.insert(0, "foo"); - assert_eq!("foo", s); - - let mut s = BString::from("a"); - s.insert(0, "foo"); - assert_eq!("fooa", s); - - let mut s = BString::from("a"); - s.insert(1, "foo"); - assert_eq!("afoo", s); - - let mut s = BString::from("foobar"); - s.insert(3, "quux"); - assert_eq!("fooquuxbar", s); - - let mut s = BString::from("foobar"); - s.insert(3, "x"); - assert_eq!("fooxbar", s); - - let mut s = BString::from("foobar"); - s.insert(0, "x"); - assert_eq!("xfoobar", s); - - let mut s = BString::from("foobar"); - s.insert(6, "x"); - assert_eq!("foobarx", s); - - let mut s = BString::from("foobar"); - s.insert(3, "quuxbazquux"); - assert_eq!("fooquuxbazquuxbar", s); - } - - #[test] - #[should_panic] - fn insert_fail1() { - let mut s = BString::new(); - s.insert(1, "foo"); - } - - #[test] - #[should_panic] - fn insert_fail2() { - let mut s = BString::from("a"); - s.insert(2, "foo"); - } - - #[test] - #[should_panic] - fn insert_fail3() { - let mut s = BString::from("foobar"); - s.insert(7, "foo"); - } - - #[test] - fn collect() { - let s: BString = vec!['a', 'b', 'c'].into_iter().collect(); - assert_eq!(s, "abc"); - - let s: BString = vec!["a", "b", "c"].into_iter().collect(); - assert_eq!(s, "abc"); - - let s: BString = vec![B("a"), B("b"), B("c")].into_iter().collect(); - assert_eq!(s, "abc"); + pub(crate) fn as_mut_bstr(&mut self) -> &mut BStr { + BStr::new_mut(&mut self.bytes) } } diff -Nru cargo-0.35.0/vendor/bstr/src/bstr.rs cargo-0.37.0/vendor/bstr/src/bstr.rs --- cargo-0.35.0/vendor/bstr/src/bstr.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/bstr.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,114 +1,13 @@ -#[cfg(feature = "std")] -use std::borrow::Cow; -#[cfg(feature = "std")] -use std::ffi::OsStr; -#[cfg(feature = "std")] -use std::iter; -#[cfg(feature = "std")] -use std::path::Path; - -use core::cmp; use core::mem; -use core::ops; -use core::ptr; -use core::slice; -use core::str; - -use memchr::{memchr, memrchr}; - -use ascii; -#[cfg(feature = "std")] -use bstring::BString; -use search::{PrefilterState, TwoWay}; -use slice_index::SliceIndex; -#[cfg(feature = "unicode")] -use unicode::{ - Graphemes, GraphemeIndices, - Sentences, SentenceIndices, - Words, WordIndices, WordsWithBreaks, WordsWithBreakIndices, - whitespace_len_fwd, whitespace_len_rev, -}; -use utf8::{self, Chars, CharIndices, Utf8Error}; - -/// A short-hand constructor for building a `&BStr`. -/// -/// This idiosyncratic constructor is useful for concisely building byte string -/// slices. Its primary utility is in conveniently writing byte string literals -/// in a uniform way. For example, consider this code that does not compile: -/// -/// ```ignore -/// let strs = vec![b"a", b"xy"]; -/// ``` -/// -/// The above code doesn't compile because the type of the byte string literal -/// `b"a"` is `&'static [u8; 1]`, and the type of `b"xy"` is -/// `&'static [u8; 2]`. Since their types aren't the same, they can't be stored -/// in the same `Vec`. (This is dissimilar from normal Unicode string slices, -/// where both `"a"` and `"xy"` have the same type of `&'static str`.) -/// -/// One way of getting the above code to compile is to convert byte strings to -/// slices. You might try this: -/// -/// ```ignore -/// let strs = vec![&b"a", &b"xy"]; -/// ``` -/// -/// But this just creates values with type `& &'static [u8; 1]` and -/// `& &'static [u8; 2]`. Instead, you need to force the issue like so: -/// -/// ``` -/// let strs = vec![&b"a"[..], &b"xy"[..]]; -/// // or -/// let strs = vec![b"a".as_ref(), b"xy".as_ref()]; -/// ``` -/// -/// But neither of these are particularly convenient to type, especially when -/// it's something as common as a string literal. Thus, this constructor -/// permits writing the following instead: -/// -/// ``` -/// use bstr::B; -/// -/// let strs = vec![B("a"), B(b"xy")]; -/// ``` -/// -/// Notice that this also lets you mix and match both string literals and byte -/// string literals. This can be quite convenient! -#[allow(non_snake_case)] -#[inline] -pub fn B<'a, B: ?Sized + AsRef<[u8]>>(bytes: &'a B) -> &'a BStr { - BStr::new(bytes.as_ref()) -} -/// A byte string slice that is conventionally UTF-8. -/// -/// A byte string slice is the core string type in this library, and is usually -/// seen in its borrowed form, `&BStr`. The principle difference between a -/// `&BStr` and a `&str` (Rust's standard Unicode string slice) is that a -/// `&BStr` is only *conventionally* UTF-8, where as a `&str` is guaranteed to -/// always be valid UTF-8. +/// A wrapper for `&[u8]` that provides convenient string oriented trait impls. /// /// If you need ownership or a growable byte string buffer, then use /// [`BString`](struct.BString.html). /// -/// # Literals -/// -/// A byte string literal has type `&'static BStr`. The most convenient way to -/// write a byte string literal is by using the short-hand [`B`](fn.B.html) -/// constructor function: -/// -/// ``` -/// use bstr::{B, BStr}; -/// -/// // A byte string literal can be constructed from a normal Unicode string. -/// let s = B("a byte string literal"); -/// // A byte string literal can also be constructed from a Rust byte string. -/// let s = B(b"another byte string literal"); -/// -/// // BStr::new can also be used: -/// let s = BStr::new("a byte string literal"); -/// let s = BStr::new(b"another byte string literal"); -/// ``` +/// Using a `&BStr` is just like using a `&[u8]`, since `BStr` +/// implements `Deref` to `[u8]`. So all methods available on `[u8]` +/// are also available on `BStr`. /// /// # Representation /// @@ -127,3865 +26,36 @@ /// The `Display` implementation behaves as if `BStr` were first lossily /// converted to a `str`. Invalid UTF-8 bytes are substituted with the Unicode /// replacement codepoint, which looks like this: �. -/// -/// # Indexing and slicing -/// -/// A `BStr` implements indexing and slicing using `[..]` notation. Unlike -/// the standard `str` type, the `BStr` type permits callers to index -/// individual bytes. For example: -/// -/// ``` -/// use bstr::B; -/// -/// let s = B("foo☃bar"); -/// assert_eq!(&s[0..3], "foo"); -/// assert_eq!(s[2], b'o'); -/// assert_eq!(&s[3..6], "☃"); -/// -/// // Nothing stops you from indexing or slicing invalid UTF-8. -/// assert_eq!(s[3], b'\xE2'); -/// assert_eq!(&s[3..5], B(b"\xE2\x98")); -/// ``` #[derive(Hash)] pub struct BStr { - bytes: [u8], + pub(crate) bytes: [u8], } impl BStr { - /// Create a byte string slice from anything that can be borrowed as a - /// sequence of bytes. This includes, but is not limited to, `&Vec`, - /// `&[u8]`, `&String` and `&str`. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BStr; - /// - /// assert_eq!("abc", BStr::new("abc")); - /// assert_eq!("abc", BStr::new(b"abc")); - /// ``` #[inline] - pub fn new>(bytes: &B) -> &BStr { + pub(crate) fn new>(bytes: &B) -> &BStr { BStr::from_bytes(bytes.as_ref()) } - /// Create a mutable byte string slice from anything that can be borrowed - /// as a sequence of bytes. This includes, but is not limited to, `&mut - /// Vec` and `&mut [u8]`. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BStr; - /// - /// assert_eq!("abc", BStr::new("abc")); - /// assert_eq!("abc", BStr::new(b"abc")); - /// ``` #[inline] - pub fn new_mut>(bytes: &mut B) -> &mut BStr { + pub(crate) fn new_mut>( + bytes: &mut B, + ) -> &mut BStr { BStr::from_bytes_mut(bytes.as_mut()) } - /// Create an immutable byte string slice from an immutable byte slice. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BStr; - /// - /// let bytes = &[b'a']; - /// let bs = BStr::from_bytes(bytes); - /// assert_eq!("a", bs); - /// ``` #[inline] - pub fn from_bytes(slice: &[u8]) -> &BStr { + pub(crate) fn from_bytes(slice: &[u8]) -> &BStr { unsafe { mem::transmute(slice) } } - /// Create a mutable byte string slice from a mutable byte slice. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BStr; - /// - /// let bytes = &mut [b'a']; - /// { - /// let bs = BStr::from_bytes_mut(bytes); - /// bs[0] = b'b'; - /// } - /// assert_eq!(b"b", bytes); - /// ``` #[inline] - pub fn from_bytes_mut(slice: &mut [u8]) -> &mut BStr { + pub(crate) fn from_bytes_mut(slice: &mut [u8]) -> &mut BStr { unsafe { mem::transmute(slice) } } - /// Create a byte string from its constituent pointer and length, where - /// the length is the number of bytes in the byte string. - /// - /// # Safety - /// - /// This function is unsafe as there is no guarantee that the given pointer - /// is valid for `len` elements, nor whether the lifetime inferred is a - /// suitable lifetime for the returned slice. - /// - /// `data` must be a non-null pointer, even for a zero length slice. A - /// pointer that is usable for zero-length slices can be obtaining from - /// the standard library's `NonNull::dangling()` constructor. - /// - /// The total size of the given slice must be no larger than `isize::MAX` - /// bytes in memory. - /// - /// # Caveat - /// - /// The lifetime for the returned slice is inferred from its usage. To - /// prevent accidental misuse, it's suggested to tie the lifetime to - /// whichever source lifetime is safe in the context, such as by providing - /// a helper function taking the lifetime of a host value for the slice, or - /// by explicit annotation. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BStr; - /// - /// // manifest a byte string from a single byte - /// let x = b'Z'; - /// let ptr = &x as *const u8; - /// let s = unsafe { BStr::from_raw_parts(ptr, 1) }; - /// assert_eq!(s, "Z"); - /// ``` - pub unsafe fn from_raw_parts<'a>(data: *const u8, len: usize) -> &'a BStr { - BStr::new(slice::from_raw_parts(data, len)) - } - - /// Create a mutable byte string from its constituent pointer and length, - /// where the length is the number of bytes in the byte string. - /// - /// # Safety - /// - /// This function is unsafe as there is no guarantee that the given pointer - /// is valid for `len` elements, nor whether the lifetime inferred is a - /// suitable lifetime for the returned slice. - /// - /// `data` must be a non-null pointer, even for a zero length slice. A - /// pointer that is usable for zero-length slices can be obtaining from - /// the standard library's `NonNull::dangling()` constructor. - /// - /// The total size of the given slice must be no larger than `isize::MAX` - /// bytes in memory. - /// - /// The above reasons are the same as for - /// [`from_raw_parts`](#method.from_raw_parts). In addition, for this - /// constructor, callers must guarantee that the mutable slice returned - /// is not aliased with any other reference. - /// - /// # Caveat - /// - /// The lifetime for the returned slice is inferred from its usage. To - /// prevent accidental misuse, it's suggested to tie the lifetime to - /// whichever source lifetime is safe in the context, such as by providing - /// a helper function taking the lifetime of a host value for the slice, or - /// by explicit annotation. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use std::mem; - /// use bstr::{BStr, BString}; - /// - /// // For demonstration purposes, get a mutable pointer to a byte string. - /// let mut buf = BString::from("bar"); - /// let ptr = buf.as_mut_ptr(); - /// // Drop buf without deallocating, to avoid &mut aliasing. - /// mem::forget(buf); - /// - /// // Now convert it to a mutable byte string from the raw pointer. - /// let mut s = unsafe { BStr::from_raw_parts_mut(ptr, 3) }; - /// s.make_ascii_uppercase(); - /// assert_eq!(s, "BAR"); - /// ``` - pub unsafe fn from_raw_parts_mut<'a>( - data: *mut u8, - len: usize, - ) -> &'a mut BStr { - BStr::new_mut(slice::from_raw_parts_mut(data, len)) - } - - /// Create an immutable byte string from an OS string slice. - /// - /// On Unix, this always succeeds and is zero cost. On non-Unix systems, - /// this returns `None` if the given OS string is not valid UTF-8. (For - /// example, on Windows, file paths are allowed to be a sequence of - /// arbitrary 16-bit integers. Not all such sequences can be transcoded to - /// valid UTF-8.) - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use std::ffi::OsStr; - /// - /// use bstr::BStr; - /// - /// let os_str = OsStr::new("foo"); - /// let bs = BStr::from_os_str(os_str).expect("should be valid UTF-8"); - /// assert_eq!(bs, "foo"); - /// ``` - #[cfg(feature = "std")] - #[inline] - pub fn from_os_str(os_str: &OsStr) -> Option<&BStr> { - BStr::from_os_str_imp(os_str) - } - - #[cfg(feature = "std")] - #[cfg(unix)] - #[inline] - fn from_os_str_imp(os_str: &OsStr) -> Option<&BStr> { - use std::os::unix::ffi::OsStrExt; - - Some(BStr::new(os_str.as_bytes())) - } - - #[cfg(feature = "std")] - #[cfg(not(unix))] - #[inline] - fn from_os_str_imp(os_str: &OsStr) -> Option<&BStr> { - os_str.to_str().map(BStr::new) - } - - /// Create an immutable byte string from a file path. - /// - /// On Unix, this always succeeds and is zero cost. On non-Unix systems, - /// this returns `None` if the given path is not valid UTF-8. (For example, - /// on Windows, file paths are allowed to be a sequence of arbitrary 16-bit - /// integers. Not all such sequences can be transcoded to valid UTF-8.) - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use std::path::Path; - /// - /// use bstr::BStr; - /// - /// let path = Path::new("foo"); - /// let bs = BStr::from_path(path).expect("should be valid UTF-8"); - /// assert_eq!(bs, "foo"); - /// ``` - #[cfg(feature = "std")] - #[inline] - pub fn from_path(path: &Path) -> Option<&BStr> { - BStr::from_os_str(path.as_os_str()) - } - - /// Returns the length, in bytes, of this byte string. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BStr; - /// - /// assert_eq!(0, BStr::new("").len()); - /// assert_eq!(3, BStr::new("abc").len()); - /// assert_eq!(8, BStr::new("☃βツ").len()); - /// ``` #[inline] - pub fn len(&self) -> usize { - self.bytes.len() - } - - /// Returns true if and only if the length of this byte string is zero. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BStr; - /// - /// assert!(BStr::new("").is_empty()); - /// assert!(!BStr::new("abc").is_empty()); - /// ``` - #[inline] - pub fn is_empty(&self) -> bool { - self.bytes.is_empty() - } - - /// Returns an immutable byte slice of this `BStr`'s contents. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B("hello"); - /// - /// assert_eq!(&[104, 101, 108, 108, 111], s.as_bytes()); - /// ``` - #[inline] - pub fn as_bytes(&self) -> &[u8] { + pub(crate) fn as_bytes(&self) -> &[u8] { &self.bytes } - - /// Returns a mutable byte slice of this `BStr`'s contents. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("hello"); - /// s.as_bytes_mut()[1] = b'a'; - /// - /// assert_eq!(&[104, 97, 108, 108, 111], s.as_bytes()); - /// ``` - #[inline] - pub fn as_bytes_mut(&mut self) -> &mut [u8] { - &mut self.bytes - } - - /// Create a new owned byte string from this byte string slice. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BStr; - /// - /// let s = BStr::new("abc"); - /// let mut owned = s.to_bstring(); - /// owned.push_char('d'); - /// assert_eq!("abcd", owned); - /// ``` - #[cfg(feature = "std")] - #[inline] - pub fn to_bstring(&self) -> BString { - BString::from_vec(self.as_bytes().to_vec()) - } - - /// Safely convert this byte string into a `&str` if it's valid UTF-8. - /// - /// If this byte string is not valid UTF-8, then an error is returned. The - /// error returned indicates the first invalid byte found and the length - /// of the error. - /// - /// In cases where a lossy conversion to `&str` is acceptable, then use one - /// of the [`to_str_lossy`](#method.to_str_lossy) - /// or [`to_str_lossy_into`](#method.to_str_lossy_into) methods. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// # fn example() -> Result<(), bstr::Utf8Error> { - /// let s = B("☃βツ").to_str()?; - /// assert_eq!("☃βツ", s); - /// - /// let mut bstring = BString::from("☃βツ"); - /// bstring.push_byte(b'\xFF'); - /// let err = bstring.to_str().unwrap_err(); - /// assert_eq!(8, err.valid_up_to()); - /// # Ok(()) }; example().unwrap() - /// ``` - #[inline] - pub fn to_str(&self) -> Result<&str, Utf8Error> { - utf8::validate(self.as_bytes()).map(|_| { - // SAFETY: This is safe because of the guarantees provided by - // utf8::validate. - unsafe { - str::from_utf8_unchecked(self.as_bytes()) - } - }) - } - - /// Unsafely convert this byte string into a `&str`, without checking for - /// valid UTF-8. - /// - /// # Safety - /// - /// Callers *must* ensure that this byte string is valid UTF-8 before - /// calling this method. Converting a byte string into a `&str` that is - /// not valid UTF-8 is considered undefined behavior. - /// - /// This routine is useful in performance sensitive contexts where the - /// UTF-8 validity of the byte string is already known and it is - /// undesirable to pay the cost of an additional UTF-8 validation check - /// that [`to_str`](#method.to_str) performs. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// // SAFETY: This is safe because string literals are guaranteed to be - /// // valid UTF-8 by the Rust compiler. - /// let s = unsafe { B("☃βツ").to_str_unchecked() }; - /// assert_eq!("☃βツ", s); - /// ``` - pub unsafe fn to_str_unchecked(&self) -> &str { - str::from_utf8_unchecked(self.as_bytes()) - } - - /// Convert this byte string to a valid UTF-8 string by replacing invalid - /// UTF-8 bytes with the Unicode replacement codepoint (`U+FFFD`). - /// - /// If the byte string is already valid UTF-8, then no copying or - /// allocation is performed and a borrrowed string slice is returned. If - /// the byte string is not valid UTF-8, then an owned string buffer is - /// returned with invalid bytes replaced by the replacement codepoint. - /// - /// This method uses the "substitution of maximal subparts" (Unicode - /// Standard, Chapter 3, Section 9) strategy for inserting the replacement - /// codepoint. Specifically, a replacement codepoint is inserted whenever a - /// byte is found that cannot possibly lead to a valid code unit sequence. - /// If there were previous bytes that represented a prefix of a well-formed - /// code unit sequence, then all of those bytes are substituted with a - /// single replacement codepoint. The "substitution of maximal subparts" - /// strategy is the same strategy used by - /// [W3C's Encoding standard](https://www.w3.org/TR/encoding/). - /// For a more precise description of the maximal subpart strategy, see - /// the Unicode Standard, Chapter 3, Section 9. See also - /// [Public Review Issue #121](http://www.unicode.org/review/pr-121.html). - /// - /// N.B. Rust's standard library also appears to use the same strategy, - /// but it does not appear to be an API guarantee. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use std::borrow::Cow; - /// use bstr::BString; - /// - /// let mut bstring = BString::from("☃βツ"); - /// assert_eq!(Cow::Borrowed("☃βツ"), bstring.to_str_lossy()); - /// - /// // Add a byte that makes the sequence invalid. - /// bstring.push_byte(b'\xFF'); - /// assert_eq!(Cow::Borrowed("☃βツ\u{FFFD}"), bstring.to_str_lossy()); - /// ``` - /// - /// This demonstrates the "maximal subpart" substitution logic. - /// - /// ``` - /// use bstr::B; - /// - /// // \x61 is the ASCII codepoint for 'a'. - /// // \xF1\x80\x80 is a valid 3-byte code unit prefix. - /// // \xE1\x80 is a valid 2-byte code unit prefix. - /// // \xC2 is a valid 1-byte code unit prefix. - /// // \x62 is the ASCII codepoint for 'b'. - /// // - /// // In sum, each of the prefixes is replaced by a single replacement - /// // codepoint since none of the prefixes are properly completed. This - /// // is in contrast to other strategies that might insert a replacement - /// // codepoint for every single byte. - /// let bs = B(b"\x61\xF1\x80\x80\xE1\x80\xC2\x62"); - /// assert_eq!("a\u{FFFD}\u{FFFD}\u{FFFD}b", bs.to_str_lossy()); - /// ``` - #[cfg(feature = "std")] - #[inline] - pub fn to_str_lossy(&self) -> Cow { - match utf8::validate(self.as_bytes()) { - Ok(()) => { - // SAFETY: This is safe because of the guarantees provided by - // utf8::validate. - unsafe { - Cow::Borrowed(str::from_utf8_unchecked(self.as_bytes())) - } - } - Err(err) => { - let mut lossy = String::with_capacity(self.len()); - let (valid, after) = self - .as_bytes() - .split_at(err.valid_up_to()); - // SAFETY: This is safe because utf8::validate guarantees - // that all of `valid` is valid UTF-8. - lossy.push_str(unsafe { str::from_utf8_unchecked(valid) }); - lossy.push_str("\u{FFFD}"); - if let Some(len) = err.error_len() { - B(&after[len..]).to_str_lossy_into(&mut lossy); - } - Cow::Owned(lossy) - } - } - } - - /// Copy the contents of this byte string into the given owned string - /// buffer, while replacing invalid UTF-8 code unit sequences with the - /// Unicode replacement codepoint (`U+FFFD`). - /// - /// This method uses the same "substitution of maximal subparts" strategy - /// for inserting the replacement codepoint as the - /// [`to_str_lossy`](#method.to_str_lossy) method. - /// - /// This routine is useful for amortizing allocation. However, unlike - /// `to_str_lossy`, this routine will _always_ copy the contents of this - /// byte string into the destination buffer, even if this byte string is - /// valid UTF-8. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use std::borrow::Cow; - /// use bstr::BString; - /// - /// let mut bstring = BString::from("☃βツ"); - /// // Add a byte that makes the sequence invalid. - /// bstring.push_byte(b'\xFF'); - /// - /// let mut dest = String::new(); - /// bstring.to_str_lossy_into(&mut dest); - /// assert_eq!("☃βツ\u{FFFD}", dest); - /// ``` - #[cfg(feature = "std")] - #[inline] - pub fn to_str_lossy_into(&self, dest: &mut String) { - dest.reserve(self.len()); - let mut bytes = self.as_bytes(); - loop { - match utf8::validate(bytes) { - Ok(()) => { - // SAFETY: This is safe because utf8::validate guarantees - // that all of `bytes` is valid UTF-8. - dest.push_str(unsafe { str::from_utf8_unchecked(bytes) }); - break; - } - Err(err) => { - let (valid, after) = bytes.split_at(err.valid_up_to()); - // SAFETY: This is safe because utf8::validate guarantees - // that all of `valid` is valid UTF-8. - dest.push_str(unsafe { str::from_utf8_unchecked(valid) }); - dest.push_str("\u{FFFD}"); - match err.error_len() { - None => break, - Some(len) => bytes = &after[len..], - } - } - } - } - } - - /// Create an OS string slice from this byte string. - /// - /// On Unix, this always succeeds and is zero cost. On non-Unix systems, - /// this returns a UTF-8 decoding error if this byte string is not valid - /// UTF-8. (For example, on Windows, file paths are allowed to be a - /// sequence of arbitrary 16-bit integers. There is no obvious mapping from - /// an arbitrary sequence of 8-bit integers to an arbitrary sequence of - /// 16-bit integers.) - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let bs = B("foo"); - /// let os_str = bs.to_os_str().expect("should be valid UTF-8"); - /// assert_eq!(os_str, "foo"); - /// ``` - #[cfg(feature = "std")] - #[inline] - pub fn to_os_str(&self) -> Result<&OsStr, Utf8Error> { - self.to_os_str_imp() - } - - #[cfg(feature = "std")] - #[cfg(unix)] - #[inline] - fn to_os_str_imp(&self) -> Result<&OsStr, Utf8Error> { - use std::os::unix::ffi::OsStrExt; - - Ok(OsStr::from_bytes(self.as_bytes())) - } - - #[cfg(feature = "std")] - #[cfg(not(unix))] - #[inline] - fn to_os_str_imp(&self) -> Result<&OsStr, Utf8Error> { - self.to_str().map(OsStr::new) - } - - /// Lossily create an OS string slice from this byte string. - /// - /// On Unix, this always succeeds and is zero cost. On non-Unix systems, - /// this will perform a UTF-8 check and lossily convert this byte string - /// into valid UTF-8 using the Unicode replacement codepoint. - /// - /// Note that this can prevent the correct roundtripping of file paths on - /// non-Unix systems such as Windows, where file paths are an arbitrary - /// sequence of 16-bit integers. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let bs = B(b"foo\xFFbar"); - /// let os_str = bs.to_os_str_lossy(); - /// assert_eq!(os_str.to_string_lossy(), "foo\u{FFFD}bar"); - /// ``` - #[cfg(feature = "std")] - #[inline] - pub fn to_os_str_lossy(&self) -> Cow { - self.to_os_str_lossy_imp() - } - - #[cfg(feature = "std")] - #[cfg(unix)] - #[inline] - fn to_os_str_lossy_imp(&self) -> Cow { - use std::os::unix::ffi::OsStrExt; - - Cow::Borrowed(OsStr::from_bytes(self.as_bytes())) - } - - #[cfg(feature = "std")] - #[cfg(not(unix))] - #[inline] - fn to_os_str_lossy_imp(&self) -> Cow { - use std::ffi::OsString; - - match self.to_str_lossy() { - Cow::Borrowed(x) => Cow::Borrowed(OsStr::new(x)), - Cow::Owned(x) => Cow::Owned(OsString::from(x)), - } - } - - /// Create a path slice from this byte string. - /// - /// On Unix, this always succeeds and is zero cost. On non-Unix systems, - /// this returns a UTF-8 decoding error if this byte string is not valid - /// UTF-8. (For example, on Windows, file paths are allowed to be a - /// sequence of arbitrary 16-bit integers. There is no obvious mapping from - /// an arbitrary sequence of 8-bit integers to an arbitrary sequence of - /// 16-bit integers.) - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let bs = B("foo"); - /// let path = bs.to_path().expect("should be valid UTF-8"); - /// assert_eq!(path.as_os_str(), "foo"); - /// ``` - #[cfg(feature = "std")] - #[inline] - pub fn to_path(&self) -> Result<&Path, Utf8Error> { - self.to_os_str().map(Path::new) - } - - /// Lossily create a path slice from this byte string. - /// - /// On Unix, this always succeeds and is zero cost. On non-Unix systems, - /// this will perform a UTF-8 check and lossily convert this byte string - /// into valid UTF-8 using the Unicode replacement codepoint. - /// - /// Note that this can prevent the correct roundtripping of file paths on - /// non-Unix systems such as Windows, where file paths are an arbitrary - /// sequence of 16-bit integers. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let bs = B(b"foo\xFFbar"); - /// let path = bs.to_path_lossy(); - /// assert_eq!(path.to_string_lossy(), "foo\u{FFFD}bar"); - /// ``` - #[cfg(feature = "std")] - #[inline] - pub fn to_path_lossy(&self) -> Cow { - use std::path::PathBuf; - - match self.to_os_str_lossy() { - Cow::Borrowed(x) => Cow::Borrowed(Path::new(x)), - Cow::Owned(x) => Cow::Owned(PathBuf::from(x)), - } - } - - /// Create a new `BString` by repeating this byte string `n` times. - /// - /// # Panics - /// - /// This function panics if the capacity of the new `BString` would - /// overflow. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// assert_eq!("foofoofoofoo", B("foo").repeat(4)); - /// assert_eq!("", B("foo").repeat(0)); - /// ``` - #[cfg(feature = "std")] - #[inline] - pub fn repeat(&self, n: usize) -> BString { - iter::repeat(self).take(n).collect() - } - - /// Returns true if and only if this byte string contains the given needle. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// assert!(B("foo bar").contains("foo")); - /// assert!(B("foo bar").contains("bar")); - /// assert!(!B("foo").contains("foobar")); - /// ``` - #[inline] - pub fn contains>(&self, needle: B) -> bool { - self.find(needle).is_some() - } - - /// Returns true if and only if this byte string has the given prefix. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// assert!(B("foo bar").starts_with("foo")); - /// assert!(!B("foo bar").starts_with("bar")); - /// assert!(!B("foo").starts_with("foobar")); - /// ``` - #[inline] - pub fn starts_with>(&self, prefix: B) -> bool { - let prefix = prefix.as_ref(); - self.get(..prefix.len()).map_or(false, |x| x == prefix) - } - - /// Returns true if and only if this byte string has the given suffix. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// assert!(B("foo bar").ends_with("bar")); - /// assert!(!B("foo bar").ends_with("foo")); - /// assert!(!B("bar").ends_with("foobar")); - /// ``` - #[inline] - pub fn ends_with>(&self, suffix: B) -> bool { - let suffix = suffix.as_ref(); - self.len() - .checked_sub(suffix.len()) - .map_or(false, |s| &self[s..] == suffix) - } - - /// Returns the index of the first occurrence of the given needle. - /// - /// The needle may be any type that can be cheaply converted into a - /// `&[u8]`. This includes, but is not limited to, `&str`, `&BStr`, and of - /// course, `&[u8]` itself. - /// - /// Note that if you're are searching for the same needle in many - /// different small haystacks, it may be faster to initialize a - /// [`Finder`](struct.Finder.html) once, and reuse it for each search. - /// - /// # Complexity - /// - /// This routine is guaranteed to have worst case linear time complexity - /// with respect to both the needle and the haystack. That is, this runs - /// in `O(needle.len() + haystack.len())` time. - /// - /// This routine is also guaranteed to have worst case constant space - /// complexity. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B("foo bar baz"); - /// assert_eq!(Some(0), s.find("foo")); - /// assert_eq!(Some(4), s.find("bar")); - /// assert_eq!(None, s.find("quux")); - /// ``` - #[inline] - pub fn find>(&self, needle: B) -> Option { - Finder::new(needle.as_ref()).find(self) - } - - /// Returns the index of the last occurrence of the given needle. - /// - /// The needle may be any type that can be cheaply converted into a - /// `&[u8]`. This includes, but is not limited to, `&str`, `&BStr`, and of - /// course, `&[u8]` itself. - /// - /// Note that if you're are searching for the same needle in many - /// different small haystacks, it may be faster to initialize a - /// [`FinderReverse`](struct.FinderReverse.html) once, and reuse it for - /// each search. - /// - /// # Complexity - /// - /// This routine is guaranteed to have worst case linear time complexity - /// with respect to both the needle and the haystack. That is, this runs - /// in `O(needle.len() + haystack.len())` time. - /// - /// This routine is also guaranteed to have worst case constant space - /// complexity. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B("foo bar baz"); - /// assert_eq!(Some(0), s.rfind("foo")); - /// assert_eq!(Some(4), s.rfind("bar")); - /// assert_eq!(Some(8), s.rfind("ba")); - /// assert_eq!(None, s.rfind("quux")); - /// ``` - #[inline] - pub fn rfind>(&self, needle: B) -> Option { - FinderReverse::new(needle.as_ref()).rfind(self) - } - - /// Returns an iterator of the non-overlapping occurrences of the given - /// needle. The iterator yields byte offset positions indicating the start - /// of each match. - /// - /// # Complexity - /// - /// This routine is guaranteed to have worst case linear time complexity - /// with respect to both the needle and the haystack. That is, this runs - /// in `O(needle.len() + haystack.len())` time. - /// - /// This routine is also guaranteed to have worst case constant space - /// complexity. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B("foo bar foo foo quux foo"); - /// let matches: Vec = s.find_iter("foo").collect(); - /// assert_eq!(matches, vec![0, 8, 12, 21]); - /// ``` - /// - /// An empty string matches at every position, including the position - /// immediately following the last byte: - /// - /// ``` - /// use bstr::B; - /// - /// let matches: Vec = B("foo").find_iter("").collect(); - /// assert_eq!(matches, vec![0, 1, 2, 3]); - /// - /// let matches: Vec = B("").find_iter("").collect(); - /// assert_eq!(matches, vec![0]); - /// ``` - #[inline] - pub fn find_iter<'a, B: ?Sized + AsRef<[u8]>>( - &'a self, - needle: &'a B, - ) -> Find<'a> { - Find::new(self, BStr::new(needle.as_ref())) - } - - /// Returns an iterator of the non-overlapping occurrences of the given - /// needle in reverse. The iterator yields byte offset positions indicating - /// the start of each match. - /// - /// # Complexity - /// - /// This routine is guaranteed to have worst case linear time complexity - /// with respect to both the needle and the haystack. That is, this runs - /// in `O(needle.len() + haystack.len())` time. - /// - /// This routine is also guaranteed to have worst case constant space - /// complexity. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B("foo bar foo foo quux foo"); - /// let matches: Vec = s.rfind_iter("foo").collect(); - /// assert_eq!(matches, vec![21, 12, 8, 0]); - /// ``` - /// - /// An empty string matches at every position, including the position - /// immediately following the last byte: - /// - /// ``` - /// use bstr::B; - /// - /// let matches: Vec = B("foo").rfind_iter("").collect(); - /// assert_eq!(matches, vec![3, 2, 1, 0]); - /// - /// let matches: Vec = B("").rfind_iter("").collect(); - /// assert_eq!(matches, vec![0]); - /// ``` - #[inline] - pub fn rfind_iter<'a, B: ?Sized + AsRef<[u8]>>( - &'a self, - needle: &'a B, - ) -> FindReverse<'a> { - FindReverse::new(self, BStr::new(needle.as_ref())) - } - - /// Returns the index of the first occurrence of the given byte. If the - /// byte does not occur in this byte string, then `None` is returned. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// assert_eq!(Some(10), B("foo bar baz").find_byte(b'z')); - /// assert_eq!(None, B("foo bar baz").find_byte(b'y')); - /// ``` - #[inline] - pub fn find_byte(&self, byte: u8) -> Option { - memchr(byte, self.as_bytes()) - } - - /// Returns the index of the last occurrence of the given byte. If the - /// byte does not occur in this byte string, then `None` is returned. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// assert_eq!(Some(10), B("foo bar baz").rfind_byte(b'z')); - /// assert_eq!(None, B("foo bar baz").rfind_byte(b'y')); - /// ``` - #[inline] - pub fn rfind_byte(&self, byte: u8) -> Option { - memrchr(byte, self.as_bytes()) - } - - /// Returns the index of the first occurrence of the given codepoint. - /// If the codepoint does not occur in this byte string, then `None` is - /// returned. - /// - /// Note that if one searches for the replacement codepoint, `\u{FFFD}`, - /// then only explicit occurrences of that encoding will be found. Invalid - /// UTF-8 sequences will not be matched. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// assert_eq!(Some(10), B("foo bar baz").find_char('z')); - /// assert_eq!(Some(4), B("αβγγδ").find_char('γ')); - /// assert_eq!(None, B("foo bar baz").find_char('y')); - /// ``` - #[inline] - pub fn find_char(&self, ch: char) -> Option { - self.find(ch.encode_utf8(&mut [0; 4])) - } - - /// Returns the index of the last occurrence of the given codepoint. - /// If the codepoint does not occur in this byte string, then `None` is - /// returned. - /// - /// Note that if one searches for the replacement codepoint, `\u{FFFD}`, - /// then only explicit occurrences of that encoding will be found. Invalid - /// UTF-8 sequences will not be matched. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// assert_eq!(Some(10), B("foo bar baz").rfind_char('z')); - /// assert_eq!(Some(6), B("αβγγδ").rfind_char('γ')); - /// assert_eq!(None, B("foo bar baz").rfind_char('y')); - /// ``` - #[inline] - pub fn rfind_char(&self, ch: char) -> Option { - self.rfind(ch.encode_utf8(&mut [0; 4])) - } - - /// Returns an iterator over the fields in a byte string, separated by - /// contiguous whitespace. - /// - /// # Example - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BStr}; - /// - /// let s = B(" foo\tbar\t\u{2003}\nquux \n"); - /// let fields: Vec<&BStr> = s.fields().collect(); - /// assert_eq!(fields, vec!["foo", "bar", "quux"]); - /// ``` - /// - /// A byte string consisting of just whitespace yields no elements: - /// - /// ``` - /// use bstr::B; - /// - /// assert_eq!(0, B(" \n\t\u{2003}\n \t").fields().count()); - /// ``` - #[inline] - pub fn fields(&self) -> Fields { - Fields::new(self) - } - - /// Returns an iterator over the fields in a byte string, separated by - /// contiguous codepoints satisfying the given predicate. - /// - /// If this byte - /// - /// # Example - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BStr}; - /// - /// let s = B("123foo999999bar1quux123456"); - /// let fields: Vec<&BStr> = s.fields_with(|c| c.is_numeric()).collect(); - /// assert_eq!(fields, vec!["foo", "bar", "quux"]); - /// ``` - /// - /// A byte string consisting of all codepoints satisfying the predicate - /// yields no elements: - /// - /// ``` - /// use bstr::B; - /// - /// assert_eq!(0, B("1911354563").fields_with(|c| c.is_numeric()).count()); - /// ``` - #[inline] - pub fn fields_with bool>(&self, f: F) -> FieldsWith { - FieldsWith::new(self, f) - } - - /// Returns an iterator over substrings of this byte string, separated - /// by the given byte string. Each element yielded is guaranteed not to - /// include the splitter substring. - /// - /// The splitter may be any type that can be cheaply converted into a - /// `&[u8]`. This includes, but is not limited to, `&str`, `&BStr`, and of - /// course, `&[u8]` itself. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BStr}; - /// - /// let x: Vec<&BStr> = B("Mary had a little lamb").split(" ").collect(); - /// assert_eq!(x, vec!["Mary", "had", "a", "little", "lamb"]); - /// - /// let x: Vec<&BStr> = B("").split("X").collect(); - /// assert_eq!(x, vec![""]); - /// - /// let x: Vec<&BStr> = B("lionXXtigerXleopard").split("X").collect(); - /// assert_eq!(x, vec!["lion", "", "tiger", "leopard"]); - /// - /// let x: Vec<&BStr> = B("lion::tiger::leopard").split("::").collect(); - /// assert_eq!(x, vec!["lion", "tiger", "leopard"]); - /// ``` - /// - /// If a string contains multiple contiguous separators, you will end up - /// with empty strings yielded by the iterator: - /// - /// ``` - /// use bstr::{B, BStr}; - /// - /// let x: Vec<&BStr> = B("||||a||b|c").split("|").collect(); - /// assert_eq!(x, vec!["", "", "", "", "a", "", "b", "c"]); - /// - /// let x: Vec<&BStr> = B("(///)").split("/").collect(); - /// assert_eq!(x, vec!["(", "", "", ")"]); - /// ``` - /// - /// Separators at the start or end of a string are neighbored by empty - /// strings. - /// - /// ``` - /// use bstr::{B, BStr}; - /// - /// let x: Vec<&BStr> = B("010").split("0").collect(); - /// assert_eq!(x, vec!["", "1", ""]); - /// ``` - /// - /// When the empty string is used as a separator, it splits every **byte** - /// in the byte string, along with the beginning and end of the byte - /// string. - /// - /// ``` - /// use bstr::{B, BStr}; - /// - /// let x: Vec<&BStr> = B("rust").split("").collect(); - /// assert_eq!(x, vec!["", "r", "u", "s", "t", ""]); - /// - /// // Splitting by an empty string is not UTF-8 aware. Elements yielded - /// // may not be valid UTF-8! - /// let x: Vec<&BStr> = B("☃").split("").collect(); - /// assert_eq!(x, vec![B(""), B(b"\xE2"), B(b"\x98"), B(b"\x83"), B("")]); - /// ``` - /// - /// Contiguous separators, especially whitespace, can lead to possibly - /// surprising behavior. For example, this code is correct: - /// - /// ``` - /// use bstr::{B, BStr}; - /// - /// let x: Vec<&BStr> = B(" a b c").split(" ").collect(); - /// assert_eq!(x, vec!["", "", "", "", "a", "", "b", "c"]); - /// ``` - /// - /// It does *not* give you `["a", "b", "c"]`. For that behavior, use - /// [`fields`](#method.fields) instead. - #[inline] - pub fn split<'a, B: ?Sized + AsRef<[u8]>>( - &'a self, - splitter: &'a B, - ) -> Split<'a> { - Split::new(self, BStr::new(splitter.as_ref())) - } - - /// Returns an iterator over substrings of this byte string, separated by - /// the given byte string, in reverse. Each element yielded is guaranteed - /// not to include the splitter substring. - /// - /// The splitter may be any type that can be cheaply converted into a - /// `&[u8]`. This includes, but is not limited to, `&str`, `&BStr`, and of - /// course, `&[u8]` itself. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BStr}; - /// - /// let x: Vec<&BStr> = B("Mary had a little lamb").rsplit(" ").collect(); - /// assert_eq!(x, vec!["lamb", "little", "a", "had", "Mary"]); - /// - /// let x: Vec<&BStr> = B("").rsplit("X").collect(); - /// assert_eq!(x, vec![""]); - /// - /// let x: Vec<&BStr> = B("lionXXtigerXleopard").rsplit("X").collect(); - /// assert_eq!(x, vec!["leopard", "tiger", "", "lion"]); - /// - /// let x: Vec<&BStr> = B("lion::tiger::leopard").rsplit("::").collect(); - /// assert_eq!(x, vec!["leopard", "tiger", "lion"]); - /// ``` - /// - /// If a string contains multiple contiguous separators, you will end up - /// with empty strings yielded by the iterator: - /// - /// ``` - /// use bstr::{B, BStr}; - /// - /// let x: Vec<&BStr> = B("||||a||b|c").rsplit("|").collect(); - /// assert_eq!(x, vec!["c", "b", "", "a", "", "", "", ""]); - /// - /// let x: Vec<&BStr> = B("(///)").rsplit("/").collect(); - /// assert_eq!(x, vec![")", "", "", "("]); - /// ``` - /// - /// Separators at the start or end of a string are neighbored by empty - /// strings. - /// - /// ``` - /// use bstr::{B, BStr}; - /// - /// let x: Vec<&BStr> = B("010").rsplit("0").collect(); - /// assert_eq!(x, vec!["", "1", ""]); - /// ``` - /// - /// When the empty string is used as a separator, it splits every **byte** - /// in the byte string, along with the beginning and end of the byte - /// string. - /// - /// ``` - /// use bstr::{B, BStr}; - /// - /// let x: Vec<&BStr> = B("rust").rsplit("").collect(); - /// assert_eq!(x, vec!["", "t", "s", "u", "r", ""]); - /// - /// // Splitting by an empty string is not UTF-8 aware. Elements yielded - /// // may not be valid UTF-8! - /// let x: Vec<&BStr> = B("☃").rsplit("").collect(); - /// assert_eq!(x, vec![B(""), B(b"\x83"), B(b"\x98"), B(b"\xE2"), B("")]); - /// ``` - /// - /// Contiguous separators, especially whitespace, can lead to possibly - /// surprising behavior. For example, this code is correct: - /// - /// ``` - /// use bstr::{B, BStr}; - /// - /// let x: Vec<&BStr> = B(" a b c").rsplit(" ").collect(); - /// assert_eq!(x, vec!["c", "b", "", "a", "", "", "", ""]); - /// ``` - /// - /// It does *not* give you `["a", "b", "c"]`. - #[inline] - pub fn rsplit<'a, B: ?Sized + AsRef<[u8]>>( - &'a self, - splitter: &'a B, - ) -> SplitReverse<'a> { - SplitReverse::new(self, BStr::new(splitter.as_ref())) - } - - /// Returns an iterator of at most `limit` substrings of this byte string, - /// separated by the given byte string. If `limit` substrings are yielded, - /// then the last substring will contain the remainder of this byte string. - /// - /// The splitter may be any type that can be cheaply converted into a - /// `&[u8]`. This includes, but is not limited to, `&str`, `&BStr`, and of - /// course, `&[u8]` itself. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BStr}; - /// - /// let x: Vec<_> = B("Mary had a little lamb").splitn(3, " ").collect(); - /// assert_eq!(x, vec!["Mary", "had", "a little lamb"]); - /// - /// let x: Vec<_> = B("").splitn(3, "X").collect(); - /// assert_eq!(x, vec![""]); - /// - /// let x: Vec<_> = B("lionXXtigerXleopard").splitn(3, "X").collect(); - /// assert_eq!(x, vec!["lion", "", "tigerXleopard"]); - /// - /// let x: Vec<_> = B("lion::tiger::leopard").splitn(2, "::").collect(); - /// assert_eq!(x, vec!["lion", "tiger::leopard"]); - /// - /// let x: Vec<_> = B("abcXdef").splitn(1, "X").collect(); - /// assert_eq!(x, vec!["abcXdef"]); - /// - /// let x: Vec<_> = B("abcXdef").splitn(0, "X").collect(); - /// assert!(x.is_empty()); - /// ``` - #[inline] - pub fn splitn<'a, B: ?Sized + AsRef<[u8]>>( - &'a self, - limit: usize, - splitter: &'a B, - ) -> SplitN<'a> { - SplitN::new(self, BStr::new(splitter.as_ref()), limit) - } - - /// Returns an iterator of at most `limit` substrings of this byte string, - /// separated by the given byte string, in reverse. If `limit` substrings - /// are yielded, then the last substring will contain the remainder of this - /// byte string. - /// - /// The splitter may be any type that can be cheaply converted into a - /// `&[u8]`. This includes, but is not limited to, `&str`, `&BStr`, and of - /// course, `&[u8]` itself. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BStr}; - /// - /// let x: Vec<_> = B("Mary had a little lamb").rsplitn(3, " ").collect(); - /// assert_eq!(x, vec!["lamb", "little", "Mary had a"]); - /// - /// let x: Vec<_> = B("").rsplitn(3, "X").collect(); - /// assert_eq!(x, vec![""]); - /// - /// let x: Vec<_> = B("lionXXtigerXleopard").rsplitn(3, "X").collect(); - /// assert_eq!(x, vec!["leopard", "tiger", "lionX"]); - /// - /// let x: Vec<_> = B("lion::tiger::leopard").rsplitn(2, "::").collect(); - /// assert_eq!(x, vec!["leopard", "lion::tiger"]); - /// - /// let x: Vec<_> = B("abcXdef").rsplitn(1, "X").collect(); - /// assert_eq!(x, vec!["abcXdef"]); - /// - /// let x: Vec<_> = B("abcXdef").rsplitn(0, "X").collect(); - /// assert!(x.is_empty()); - /// ``` - #[inline] - pub fn rsplitn<'a, B: ?Sized + AsRef<[u8]>>( - &'a self, - limit: usize, - splitter: &'a B, - ) -> SplitNReverse<'a> { - SplitNReverse::new(self, BStr::new(splitter.as_ref()), limit) - } - - /// Replace all matches of the given needle with the given replacement, and - /// the result as a new `BString`. - /// - /// This routine is useful as a convenience. If you need to reuse an - /// allocation, use [`replace_into`](#method.replace_into) instead. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B("this is old").replace("old", "new"); - /// assert_eq!(s, "this is new"); - /// ``` - /// - /// When the pattern doesn't match: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B("this is old").replace("nada nada", "limonada"); - /// assert_eq!(s, "this is old"); - /// ``` - /// - /// When the needle is an empty string: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B("foo").replace("", "Z"); - /// assert_eq!(s, "ZfZoZoZ"); - /// ``` - #[cfg(feature = "std")] - #[inline] - pub fn replace, R: AsRef<[u8]>>( - &self, - needle: N, - replacement: R, - ) -> BString { - let mut dest = BString::with_capacity(self.len()); - self.replace_into(needle, replacement, &mut dest); - dest - } - - /// Replace up to `limit` matches of the given needle with the given - /// replacement, and the result as a new `BString`. - /// - /// This routine is useful as a convenience. If you need to reuse an - /// allocation, use [`replacen_into`](#method.replacen_into) instead. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B("foofoo").replacen("o", "z", 2); - /// assert_eq!(s, "fzzfoo"); - /// ``` - /// - /// When the pattern doesn't match: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B("foofoo").replacen("a", "z", 2); - /// assert_eq!(s, "foofoo"); - /// ``` - /// - /// When the needle is an empty string: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B("foo").replacen("", "Z", 2); - /// assert_eq!(s, "ZfZoo"); - /// ``` - #[cfg(feature = "std")] - #[inline] - pub fn replacen, R: AsRef<[u8]>>( - &self, - needle: N, - replacement: R, - limit: usize, - ) -> BString { - let mut dest = BString::with_capacity(self.len()); - self.replacen_into(needle, replacement, limit, &mut dest); - dest - } - - /// Replace all matches of the given needle with the given replacement, - /// and write the result into the provided `BString`. - /// - /// This does **not** clear `dest` before writing to it. - /// - /// This routine is useful for reusing allocation. For a more convenient - /// API, use [`replace`](#method.replace) instead. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B("this is old"); - /// - /// let mut dest = BString::new(); - /// s.replace_into("old", "new", &mut dest); - /// assert_eq!(dest, "this is new"); - /// ``` - /// - /// When the pattern doesn't match: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B("this is old"); - /// - /// let mut dest = BString::new(); - /// s.replace_into("nada nada", "limonada", &mut dest); - /// assert_eq!(dest, "this is old"); - /// ``` - /// - /// When the needle is an empty string: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B("foo"); - /// - /// let mut dest = BString::new(); - /// s.replace_into("", "Z", &mut dest); - /// assert_eq!(dest, "ZfZoZoZ"); - /// ``` - #[cfg(feature = "std")] - #[inline] - pub fn replace_into, R: AsRef<[u8]>>( - &self, - needle: N, - replacement: R, - dest: &mut BString, - ) { - let (needle, replacement) = (needle.as_ref(), replacement.as_ref()); - - let mut last = 0; - for start in self.find_iter(needle) { - dest.push(&self[last..start]); - dest.push(replacement); - last = start + needle.len(); - } - dest.push(&self[last..]); - } - - /// Replace up to `limit` matches of the given needle with the given - /// replacement, and write the result into the provided `BString`. - /// - /// This does **not** clear `dest` before writing to it. - /// - /// This routine is useful for reusing allocation. For a more convenient - /// API, use [`replace`](#method.replacen) instead. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B("foofoo"); - /// - /// let mut dest = BString::new(); - /// s.replacen_into("o", "z", 2, &mut dest); - /// assert_eq!(dest, "fzzfoo"); - /// ``` - /// - /// When the pattern doesn't match: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B("foofoo"); - /// - /// let mut dest = BString::new(); - /// s.replacen_into("a", "z", 2, &mut dest); - /// assert_eq!(dest, "foofoo"); - /// ``` - /// - /// When the needle is an empty string: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B("foo"); - /// - /// let mut dest = BString::new(); - /// s.replacen_into("", "Z", 2, &mut dest); - /// assert_eq!(dest, "ZfZoo"); - /// ``` - #[cfg(feature = "std")] - #[inline] - pub fn replacen_into, R: AsRef<[u8]>>( - &self, - needle: N, - replacement: R, - limit: usize, - dest: &mut BString, - ) { - let (needle, replacement) = (needle.as_ref(), replacement.as_ref()); - - let mut last = 0; - for start in self.find_iter(needle).take(limit) { - dest.push(&self[last..start]); - dest.push(replacement); - last = start + needle.len(); - } - dest.push(&self[last..]); - } - - /// Returns an iterator over the bytes in this byte string. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let bs = B("foobar"); - /// let bytes: Vec = bs.bytes().collect(); - /// assert_eq!(bytes, bs); - /// ``` - #[inline] - pub fn bytes(&self) -> Bytes { - Bytes { it: self.as_bytes().iter() } - } - - /// Returns an iterator over the Unicode scalar values in this byte string. - /// If invalid UTF-8 is encountered, then the Unicode replacement codepoint - /// is yielded instead. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let bs = B(b"\xE2\x98\x83\xFF\xF0\x9D\x9E\x83\xE2\x98\x61"); - /// let chars: Vec = bs.chars().collect(); - /// assert_eq!(vec!['☃', '\u{FFFD}', '𝞃', '\u{FFFD}', 'a'], chars); - /// ``` - /// - /// Codepoints can also be iterated over in reverse: - /// - /// ``` - /// use bstr::B; - /// - /// let bs = B(b"\xE2\x98\x83\xFF\xF0\x9D\x9E\x83\xE2\x98\x61"); - /// let chars: Vec = bs.chars().rev().collect(); - /// assert_eq!(vec!['a', '\u{FFFD}', '𝞃', '\u{FFFD}', '☃'], chars); - /// ``` - #[inline] - pub fn chars(&self) -> Chars { - Chars::new(self) - } - - /// Returns an iterator over the Unicode scalar values in this byte string - /// along with their starting and ending byte index positions. If invalid - /// UTF-8 is encountered, then the Unicode replacement codepoint is yielded - /// instead. - /// - /// Note that this is slightly different from the `CharIndices` iterator - /// provided by the standard library. Aside from working on possibly - /// invalid UTF-8, this iterator provides both the corresponding starting - /// and ending byte indices of each codepoint yielded. The ending position - /// is necessary to slice the original byte string when invalid UTF-8 bytes - /// are converted into a Unicode replacement codepoint, since a single - /// replacement codepoint can substitute anywhere from 1 to 3 invalid bytes - /// (inclusive). - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let bs = B(b"\xE2\x98\x83\xFF\xF0\x9D\x9E\x83\xE2\x98\x61"); - /// let chars: Vec<(usize, usize, char)> = bs.char_indices().collect(); - /// assert_eq!(chars, vec![ - /// (0, 3, '☃'), - /// (3, 4, '\u{FFFD}'), - /// (4, 8, '𝞃'), - /// (8, 10, '\u{FFFD}'), - /// (10, 11, 'a'), - /// ]); - /// ``` - /// - /// Codepoints can also be iterated over in reverse: - /// - /// ``` - /// use bstr::B; - /// - /// let bs = B(b"\xE2\x98\x83\xFF\xF0\x9D\x9E\x83\xE2\x98\x61"); - /// let chars: Vec<(usize, usize, char)> = bs - /// .char_indices() - /// .rev() - /// .collect(); - /// assert_eq!(chars, vec![ - /// (10, 11, 'a'), - /// (8, 10, '\u{FFFD}'), - /// (4, 8, '𝞃'), - /// (3, 4, '\u{FFFD}'), - /// (0, 3, '☃'), - /// ]); - /// ``` - #[inline] - pub fn char_indices(&self) -> CharIndices { - CharIndices::new(self) - } - - /// Returns an iterator over the grapheme clusters in this byte string. - /// If invalid UTF-8 is encountered, then the Unicode replacement codepoint - /// is yielded instead. - /// - /// # Examples - /// - /// This example shows how multiple codepoints can combine to form a - /// single grapheme cluster: - /// - /// ``` - /// use bstr::B; - /// - /// let bs = B("a\u{0300}\u{0316}\u{1F1FA}\u{1F1F8}"); - /// let graphemes: Vec<&str> = bs.graphemes().collect(); - /// assert_eq!(vec!["à̖", "🇺🇸"], graphemes); - /// ``` - /// - /// This shows that graphemes can be iterated over in reverse: - /// - /// ``` - /// use bstr::B; - /// - /// let bs = B("a\u{0300}\u{0316}\u{1F1FA}\u{1F1F8}"); - /// let graphemes: Vec<&str> = bs.graphemes().rev().collect(); - /// assert_eq!(vec!["🇺🇸", "à̖"], graphemes); - /// ``` - #[cfg(feature = "unicode")] - #[inline] - pub fn graphemes(&self) -> Graphemes { - Graphemes::new(self) - } - - /// Returns an iterator over the grapheme clusters in this byte string - /// along with their starting and ending byte index positions. If invalid - /// UTF-8 is encountered, then the Unicode replacement codepoint is yielded - /// instead. - /// - /// # Examples - /// - /// This example shows how to get the byte offsets of each individual - /// grapheme cluster: - /// - /// ``` - /// use bstr::B; - /// - /// let bs = B("a\u{0300}\u{0316}\u{1F1FA}\u{1F1F8}"); - /// let graphemes: Vec<(usize, usize, &str)> = - /// bs.grapheme_indices().collect(); - /// assert_eq!(vec![(0, 5, "à̖"), (5, 13, "🇺🇸")], graphemes); - /// ``` - /// - /// This example shows what happens when invalid UTF-8 is enountered. Note - /// that the offsets are valid indices into the original string, and do - /// not necessarily correspond to the length of the `&str` returned! - /// - /// ``` - /// use bstr::BString; - /// - /// let mut bytes = BString::new(); - /// bytes.push("a\u{0300}\u{0316}"); - /// bytes.push_byte(b'\xFF'); - /// bytes.push("\u{1F1FA}\u{1F1F8}"); - /// - /// let graphemes: Vec<(usize, usize, &str)> = - /// bytes.grapheme_indices().collect(); - /// assert_eq!( - /// graphemes, - /// vec![(0, 5, "à̖"), (5, 6, "\u{FFFD}"), (6, 14, "🇺🇸")] - /// ); - /// ``` - #[cfg(feature = "unicode")] - #[inline] - pub fn grapheme_indices(&self) -> GraphemeIndices { - GraphemeIndices::new(self) - } - - /// Returns an iterator over the words in this byte string. If invalid - /// UTF-8 is encountered, then the Unicode replacement codepoint is yielded - /// instead. - /// - /// This is similar to - /// [`words_with_breaks`](struct.BStr.html#method.words_with_breaks), - /// except it only returns elements that contain a "word" character. A word - /// character is defined by UTS #18 (Annex C) to be the combination of the - /// `Alphabetic` and `Join_Control` properties, along with the - /// `Decimal_Number`, `Mark` and `Connector_Punctuation` general - /// categories. - /// - /// Since words are made up of one or more codepoints, this iterator - /// yields `&str` elements. When invalid UTF-8 is encountered, replacement - /// codepoints are [substituted](index.html#handling-of-invalid-utf-8). - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let bs = B(r#"The quick ("brown") fox can't jump 32.3 feet, right?"#); - /// let words: Vec<&str> = bs.words().collect(); - /// assert_eq!(words, vec![ - /// "The", "quick", "brown", "fox", "can't", - /// "jump", "32.3", "feet", "right", - /// ]); - /// ``` - #[cfg(feature = "unicode")] - #[inline] - pub fn words(&self) -> Words { - Words::new(self) - } - - /// Returns an iterator over the words in this byte string along with - /// their starting and ending byte index positions. - /// - /// This is similar to - /// [`words_with_break_indices`](struct.BStr.html#method.words_with_break_indices), - /// except it only returns elements that contain a "word" character. A word - /// character is defined by UTS #18 (Annex C) to be the combination of the - /// `Alphabetic` and `Join_Control` properties, along with the - /// `Decimal_Number`, `Mark` and `Connector_Punctuation` general - /// categories. - /// - /// Since words are made up of one or more codepoints, this iterator - /// yields `&str` elements. When invalid UTF-8 is encountered, replacement - /// codepoints are [substituted](index.html#handling-of-invalid-utf-8). - /// - /// # Examples - /// - /// This example shows how to get the byte offsets of each individual - /// word: - /// - /// ``` - /// use bstr::B; - /// - /// let bs = B("can't jump 32.3 feet"); - /// let words: Vec<(usize, usize, &str)> = bs.word_indices().collect(); - /// assert_eq!(words, vec![ - /// (0, 5, "can't"), - /// (6, 10, "jump"), - /// (11, 15, "32.3"), - /// (16, 20, "feet"), - /// ]); - /// ``` - #[cfg(feature = "unicode")] - #[inline] - pub fn word_indices(&self) -> WordIndices { - WordIndices::new(self) - } - - /// Returns an iterator over the words in this byte string, along with - /// all breaks between the words. Concatenating all elements yielded by - /// the iterator results in the original string (modulo Unicode replacement - /// codepoint substitutions if invalid UTF-8 is encountered). - /// - /// Since words are made up of one or more codepoints, this iterator - /// yields `&str` elements. When invalid UTF-8 is encountered, replacement - /// codepoints are [substituted](index.html#handling-of-invalid-utf-8). - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let bs = B(r#"The quick ("brown") fox can't jump 32.3 feet, right?"#); - /// let words: Vec<&str> = bs.words_with_breaks().collect(); - /// assert_eq!(words, vec![ - /// "The", " ", "quick", " ", "(", "\"", "brown", "\"", ")", - /// " ", "fox", " ", "can't", " ", "jump", " ", "32.3", " ", "feet", - /// ",", " ", "right", "?", - /// ]); - /// ``` - #[cfg(feature = "unicode")] - #[inline] - pub fn words_with_breaks(&self) -> WordsWithBreaks { - WordsWithBreaks::new(self) - } - - /// Returns an iterator over the words and their byte offsets in this - /// byte string, along with all breaks between the words. Concatenating - /// all elements yielded by the iterator results in the original string - /// (modulo Unicode replacement codepoint substitutions if invalid UTF-8 is - /// encountered). - /// - /// Since words are made up of one or more codepoints, this iterator - /// yields `&str` elements. When invalid UTF-8 is encountered, replacement - /// codepoints are [substituted](index.html#handling-of-invalid-utf-8). - /// - /// # Examples - /// - /// This example shows how to get the byte offsets of each individual - /// word: - /// - /// ``` - /// use bstr::B; - /// - /// let bs = B("can't jump 32.3 feet"); - /// let words: Vec<(usize, usize, &str)> = - /// bs.words_with_break_indices().collect(); - /// assert_eq!(words, vec![ - /// (0, 5, "can't"), - /// (5, 6, " "), - /// (6, 10, "jump"), - /// (10, 11, " "), - /// (11, 15, "32.3"), - /// (15, 16, " "), - /// (16, 20, "feet"), - /// ]); - /// ``` - #[cfg(feature = "unicode")] - #[inline] - pub fn words_with_break_indices(&self) -> WordsWithBreakIndices { - WordsWithBreakIndices::new(self) - } - - /// Returns an iterator over the sentences in this byte string. - /// - /// Typically, a sentence will include its trailing punctuation and - /// whitespace. Concatenating all elements yielded by the iterator - /// results in the original string (modulo Unicode replacement codepoint - /// substitutions if invalid UTF-8 is encountered). - /// - /// Since sentences are made up of one or more codepoints, this iterator - /// yields `&str` elements. When invalid UTF-8 is encountered, replacement - /// codepoints are [substituted](index.html#handling-of-invalid-utf-8). - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let bs = B("I want this. Not that. Right now."); - /// let sentences: Vec<&str> = bs.sentences().collect(); - /// assert_eq!(sentences, vec![ - /// "I want this. ", - /// "Not that. ", - /// "Right now.", - /// ]); - /// ``` - #[cfg(feature = "unicode")] - #[inline] - pub fn sentences(&self) -> Sentences { - Sentences::new(self) - } - - /// Returns an iterator over the sentences in this byte string along with - /// their starting and ending byte index positions. - /// - /// Typically, a sentence will include its trailing punctuation and - /// whitespace. Concatenating all elements yielded by the iterator - /// results in the original string (modulo Unicode replacement codepoint - /// substitutions if invalid UTF-8 is encountered). - /// - /// Since sentences are made up of one or more codepoints, this iterator - /// yields `&str` elements. When invalid UTF-8 is encountered, replacement - /// codepoints are [substituted](index.html#handling-of-invalid-utf-8). - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let bs = B("I want this. Not that. Right now."); - /// let sentences: Vec<(usize, usize, &str)> = - /// bs.sentence_indices().collect(); - /// assert_eq!(sentences, vec![ - /// (0, 13, "I want this. "), - /// (13, 23, "Not that. "), - /// (23, 33, "Right now."), - /// ]); - /// ``` - #[cfg(feature = "unicode")] - #[inline] - pub fn sentence_indices(&self) -> SentenceIndices { - SentenceIndices::new(self) - } - - /// An iterator over all lines in a byte string, without their - /// terminators. - /// - /// For this iterator, the only line terminators recognized are `\r\n` and - /// `\n`. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BStr}; - /// - /// let s = B("\ - /// foo - /// - /// bar\r - /// baz - /// - /// - /// quux"); - /// let lines: Vec<&BStr> = s.lines().collect(); - /// assert_eq!(lines, vec![ - /// "foo", "", "bar", "baz", "", "", "quux", - /// ]); - /// ``` - #[inline] - pub fn lines(&self) -> Lines { - Lines::new(self) - } - - /// An iterator over all lines in a byte string, including their - /// terminators. - /// - /// For this iterator, the only line terminator recognized is `\n`. (Since - /// line terminators are included, this also handles `\r\n` line endings.) - /// - /// Line terminators are only included if they are present in the original - /// byte string. For example, the last line in a byte string may not end - /// with a line terminator. - /// - /// Concatenating all elements yielded by this iterator is guaranteed to - /// yield the original byte string. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BStr}; - /// - /// let s = B("\ - /// foo - /// - /// bar\r - /// baz - /// - /// - /// quux"); - /// let lines: Vec<&BStr> = s.lines_with_terminator().collect(); - /// assert_eq!(lines, vec![ - /// "foo\n", "\n", "bar\r\n", "baz\n", "\n", "\n", "quux", - /// ]); - /// ``` - #[inline] - pub fn lines_with_terminator(&self) -> LinesWithTerminator { - LinesWithTerminator::new(self) - } - - /// Return a byte string slice with leading and trailing whitespace - /// removed. - /// - /// Whitespace is defined according to the terms of the `White_Space` - /// Unicode property. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B(" foo\tbar\t\u{2003}\n"); - /// assert_eq!(s.trim(), "foo\tbar"); - /// ``` - #[cfg(feature = "unicode")] - #[inline] - pub fn trim(&self) -> &BStr { - self.trim_start().trim_end() - } - - /// Return a byte string slice with leading whitespace removed. - /// - /// Whitespace is defined according to the terms of the `White_Space` - /// Unicode property. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B(" foo\tbar\t\u{2003}\n"); - /// assert_eq!(s.trim_start(), "foo\tbar\t\u{2003}\n"); - /// ``` - #[inline] - pub fn trim_start(&self) -> &BStr { - self.trim_start_imp() - } - - #[cfg(feature = "unicode")] - #[inline] - fn trim_start_imp(&self) -> &BStr { - let start = whitespace_len_fwd(self.as_bytes()); - &self[start..] - } - - #[cfg(not(feature = "unicode"))] - #[inline] - fn trim_start_imp(&self) -> &BStr { - self.trim_start_with(|c| c.is_whitespace()) - } - - /// Return a byte string slice with trailing whitespace removed. - /// - /// Whitespace is defined according to the terms of the `White_Space` - /// Unicode property. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B(" foo\tbar\t\u{2003}\n"); - /// assert_eq!(s.trim_end(), " foo\tbar"); - /// ``` - #[inline] - pub fn trim_end(&self) -> &BStr { - self.trim_end_imp() - } - - #[cfg(feature = "unicode")] - #[inline] - fn trim_end_imp(&self) -> &BStr { - let end = whitespace_len_rev(self.as_bytes()); - &self[..end] - } - - #[cfg(not(feature = "unicode"))] - #[inline] - fn trim_end_imp(&self) -> &BStr { - self.trim_end_with(|c| c.is_whitespace()) - } - - /// Return a byte string slice with leading and trailing characters - /// satisfying the given predicate removed. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B("123foo5bar789"); - /// assert_eq!(s.trim_with(|c| c.is_numeric()), "foo5bar"); - /// ``` - #[inline] - pub fn trim_with bool>(&self, mut trim: F) -> &BStr { - self.trim_start_with(&mut trim).trim_end_with(&mut trim) - } - - /// Return a byte string slice with leading characters satisfying the given - /// predicate removed. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B("123foo5bar789"); - /// assert_eq!(s.trim_start_with(|c| c.is_numeric()), "foo5bar789"); - /// ``` - #[inline] - pub fn trim_start_with bool>( - &self, - mut trim: F, - ) -> &BStr { - for (s, _, ch) in self.char_indices() { - if !trim(ch) { - return &self[s..]; - } - } - B("") - } - - /// Return a byte string slice with trailing characters satisfying the - /// given predicate removed. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B("123foo5bar"); - /// assert_eq!(s.trim_end_with(|c| c.is_numeric()), "123foo5bar"); - /// ``` - #[inline] - pub fn trim_end_with bool>( - &self, - mut trim: F, - ) -> &BStr { - for (_, e, ch) in self.char_indices().rev() { - if !trim(ch) { - return &self[..e]; - } - } - B("") - } - - /// Returns a new `BString` containing the lowercase equivalent of this - /// byte string. - /// - /// In this case, lowercase is defined according to the `Lowercase` Unicode - /// property. - /// - /// If invalid UTF-8 is seen, or if a character has no lowercase variant, - /// then it is written to the given buffer unchanged. - /// - /// Note that some characters in this byte string may expand into multiple - /// characters when changing the case, so the number of bytes written to - /// the given byte string may not be equivalent to the number of bytes in - /// this byte string. - /// - /// If you'd like to reuse an allocation for performance reasons, then use - /// [`to_lowercase_into`](#method.to_lowercase_into) instead. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B("HELLO Β"); - /// assert_eq!("hello β", s.to_lowercase()); - /// ``` - /// - /// Scripts without case are not changed: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B("农历新年"); - /// assert_eq!("农历新年", s.to_lowercase()); - /// ``` - /// - /// Invalid UTF-8 remains as is: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B(b"FOO\xFFBAR\xE2\x98BAZ"); - /// assert_eq!(B(b"foo\xFFbar\xE2\x98baz"), s.to_lowercase()); - /// ``` - #[cfg(all(feature = "std", feature = "unicode"))] - #[inline] - pub fn to_lowercase(&self) -> BString { - let mut buf = BString::new(); - self.to_lowercase_into(&mut buf); - buf - } - - /// Writes the lowercase equivalent of this byte string into the given - /// buffer. The buffer is not cleared before written to. - /// - /// In this case, lowercase is defined according to the `Lowercase` - /// Unicode property. - /// - /// If invalid UTF-8 is seen, or if a character has no lowercase variant, - /// then it is written to the given buffer unchanged. - /// - /// Note that some characters in this byte string may expand into multiple - /// characters when changing the case, so the number of bytes written to - /// the given byte string may not be equivalent to the number of bytes in - /// this byte string. - /// - /// If you don't need to amortize allocation and instead prefer - /// convenience, then use [`to_lowercase`](#method.to_lowercase) instead. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B("HELLO Β"); - /// - /// let mut buf = BString::new(); - /// s.to_lowercase_into(&mut buf); - /// assert_eq!("hello β", buf); - /// ``` - /// - /// Scripts without case are not changed: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B("农历新年"); - /// - /// let mut buf = BString::new(); - /// s.to_lowercase_into(&mut buf); - /// assert_eq!("农历新年", buf); - /// ``` - /// - /// Invalid UTF-8 remains as is: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B(b"FOO\xFFBAR\xE2\x98BAZ"); - /// - /// let mut buf = BString::new(); - /// s.to_lowercase_into(&mut buf); - /// assert_eq!(B(b"foo\xFFbar\xE2\x98baz"), buf); - /// ``` - #[cfg(all(feature = "std", feature = "unicode"))] - #[inline] - pub fn to_lowercase_into(&self, buf: &mut BString) { - // TODO: This is the best we can do given what std exposes I think. - // If we roll our own case handling, then we might be able to do this - // a bit faster. We shouldn't roll our own case handling unless we - // need to, e.g., for doing caseless matching or case folding. - - // TODO(BUG): This doesn't handle any special casing rules. - - buf.reserve(self.len()); - for (s, e, ch) in self.char_indices() { - if ch == '\u{FFFD}' { - buf.push(&self[s..e]); - } else { - for upper in ch.to_lowercase() { - buf.push_char(upper); - } - } - } - } - - /// Returns a new `BString` containing the ASCII lowercase equivalent of - /// this byte string. - /// - /// In this case, lowercase is only defined in ASCII letters. Namely, the - /// letters `A-Z` are converted to `a-z`. All other bytes remain unchanged. - /// In particular, the length of the byte string returned is always - /// equivalent to the length of this byte string. - /// - /// If you'd like to reuse an allocation for performance reasons, then use - /// [`make_ascii_lowercase`](#method.make_ascii_lowercase) to perform - /// the conversion in place. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B("HELLO Β"); - /// assert_eq!("hello Β", s.to_ascii_lowercase()); - /// ``` - /// - /// Invalid UTF-8 remains as is: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B(b"FOO\xFFBAR\xE2\x98BAZ"); - /// assert_eq!(B(b"foo\xFFbar\xE2\x98baz"), s.to_ascii_lowercase()); - /// ``` - #[cfg(feature = "std")] - #[inline] - pub fn to_ascii_lowercase(&self) -> BString { - BString::from(self.as_bytes().to_ascii_lowercase()) - } - - /// Convert this byte string to its lowercase ASCII equivalent in place. - /// - /// In this case, lowercase is only defined in ASCII letters. Namely, the - /// letters `A-Z` are converted to `a-z`. All other bytes remain unchanged. - /// - /// If you don't need to do the conversion in - /// place and instead prefer convenience, then use - /// [`to_ascii_lowercase`](#method.to_ascii_lowercase) instead. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("HELLO Β"); - /// s.make_ascii_lowercase(); - /// assert_eq!("hello Β", s); - /// ``` - /// - /// Invalid UTF-8 remains as is: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let mut s = BString::from_slice(b"FOO\xFFBAR\xE2\x98BAZ"); - /// s.make_ascii_lowercase(); - /// assert_eq!(B(b"foo\xFFbar\xE2\x98baz"), s); - /// ``` - #[inline] - pub fn make_ascii_lowercase(&mut self) { - self.as_bytes_mut().make_ascii_lowercase(); - } - - /// Returns a new `BString` containing the uppercase equivalent of this - /// byte string. - /// - /// In this case, uppercase is defined according to the `Uppercase` - /// Unicode property. - /// - /// If invalid UTF-8 is seen, or if a character has no uppercase variant, - /// then it is written to the given buffer unchanged. - /// - /// Note that some characters in this byte string may expand into multiple - /// characters when changing the case, so the number of bytes written to - /// the given byte string may not be equivalent to the number of bytes in - /// this byte string. - /// - /// If you'd like to reuse an allocation for performance reasons, then use - /// [`to_uppercase_into`](#method.to_uppercase_into) instead. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B("hello β"); - /// assert_eq!("HELLO Β", s.to_uppercase()); - /// ``` - /// - /// Scripts without case are not changed: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B("农历新年"); - /// assert_eq!("农历新年", s.to_uppercase()); - /// ``` - /// - /// Invalid UTF-8 remains as is: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B(b"foo\xFFbar\xE2\x98baz"); - /// assert_eq!(B(b"FOO\xFFBAR\xE2\x98BAZ"), s.to_uppercase()); - /// ``` - #[cfg(all(feature = "std", feature = "unicode"))] - #[inline] - pub fn to_uppercase(&self) -> BString { - let mut buf = BString::new(); - self.to_uppercase_into(&mut buf); - buf - } - - /// Writes the uppercase equivalent of this byte string into the given - /// buffer. The buffer is not cleared before written to. - /// - /// In this case, uppercase is defined according to the `Uppercase` - /// Unicode property. - /// - /// If invalid UTF-8 is seen, or if a character has no uppercase variant, - /// then it is written to the given buffer unchanged. - /// - /// Note that some characters in this byte string may expand into multiple - /// characters when changing the case, so the number of bytes written to - /// the given byte string may not be equivalent to the number of bytes in - /// this byte string. - /// - /// If you don't need to amortize allocation and instead prefer - /// convenience, then use [`to_uppercase`](#method.to_uppercase) instead. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B("hello β"); - /// - /// let mut buf = BString::new(); - /// s.to_uppercase_into(&mut buf); - /// assert_eq!("HELLO Β", buf); - /// ``` - /// - /// Scripts without case are not changed: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B("农历新年"); - /// - /// let mut buf = BString::new(); - /// s.to_uppercase_into(&mut buf); - /// assert_eq!("农历新年", buf); - /// ``` - /// - /// Invalid UTF-8 remains as is: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B(b"foo\xFFbar\xE2\x98baz"); - /// - /// let mut buf = BString::new(); - /// s.to_uppercase_into(&mut buf); - /// assert_eq!(B(b"FOO\xFFBAR\xE2\x98BAZ"), buf); - /// ``` - #[cfg(all(feature = "std", feature = "unicode"))] - #[inline] - pub fn to_uppercase_into(&self, buf: &mut BString) { - // TODO: This is the best we can do given what std exposes I think. - // If we roll our own case handling, then we might be able to do this - // a bit faster. We shouldn't roll our own case handling unless we - // need to, e.g., for doing caseless matching or case folding. - buf.reserve(self.len()); - for (s, e, ch) in self.char_indices() { - if ch == '\u{FFFD}' { - buf.push(&self[s..e]); - } else if ch.is_ascii() { - buf.push_char(ch.to_ascii_uppercase()); - } else { - for upper in ch.to_uppercase() { - buf.push_char(upper); - } - } - } - } - - /// Returns a new `BString` containing the ASCII uppercase equivalent of - /// this byte string. - /// - /// In this case, uppercase is only defined in ASCII letters. Namely, the - /// letters `a-z` are converted to `A-Z`. All other bytes remain unchanged. - /// In particular, the length of the byte string returned is always - /// equivalent to the length of this byte string. - /// - /// If you'd like to reuse an allocation for performance reasons, then use - /// [`make_ascii_uppercase`](#method.make_ascii_uppercase) to perform - /// the conversion in place. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B("hello β"); - /// assert_eq!("HELLO β", s.to_ascii_uppercase()); - /// ``` - /// - /// Invalid UTF-8 remains as is: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let s = B(b"foo\xFFbar\xE2\x98baz"); - /// assert_eq!(B(b"FOO\xFFBAR\xE2\x98BAZ"), s.to_ascii_uppercase()); - /// ``` - #[cfg(feature = "std")] - #[inline] - pub fn to_ascii_uppercase(&self) -> BString { - BString::from(self.as_bytes().to_ascii_uppercase()) - } - - /// Convert this byte string to its uppercase ASCII equivalent in place. - /// - /// In this case, uppercase is only defined in ASCII letters. Namely, the - /// letters `a-z` are converted to `A-Z`. All other bytes remain unchanged. - /// - /// If you don't need to do the conversion in - /// place and instead prefer convenience, then use - /// [`to_ascii_uppercase`](#method.to_ascii_uppercase) instead. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("hello β"); - /// s.make_ascii_uppercase(); - /// assert_eq!("HELLO β", s); - /// ``` - /// - /// Invalid UTF-8 remains as is: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let mut s = BString::from_slice(b"foo\xFFbar\xE2\x98baz"); - /// s.make_ascii_uppercase(); - /// assert_eq!(B(b"FOO\xFFBAR\xE2\x98BAZ"), s); - /// ``` - #[inline] - pub fn make_ascii_uppercase(&mut self) { - self.as_bytes_mut().make_ascii_uppercase(); - } - - /// Reverse the bytes in this string, in place. - /// - /// Note that this is not necessarily a well formed operation. For example, - /// if this byte string contains valid UTF-8 that isn't ASCII, then - /// reversing the string will likely result in invalid UTF-8 and otherwise - /// non-sensical content. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("hello"); - /// s.reverse_bytes(); - /// assert_eq!(s, "olleh"); - /// ``` - #[inline] - pub fn reverse_bytes(&mut self) { - self.as_bytes_mut().reverse(); - } - - /// Reverse the codepoints in this string, in place. - /// - /// If this byte string is valid UTF-8, then its reversal by codepoint - /// is also guaranteed to be valid UTF-8. - /// - /// This operation is equivalent to the following, but without allocating: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("foo☃bar"); - /// - /// let mut chars: Vec = s.chars().collect(); - /// chars.reverse(); - /// - /// let reversed: String = chars.into_iter().collect(); - /// assert_eq!(reversed, "rab☃oof"); - /// ``` - /// - /// Note that this is not necessarily a well formed operation. For example, - /// if this byte string contains grapheme clusters with more than one - /// codepoint, then those grapheme clusters will not necessarily be - /// preserved. If you'd like to preserve grapheme clusters, then use - /// [`reverse_graphemes`](#method.reverse_graphemes) instead. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("foo☃bar"); - /// s.reverse_chars(); - /// assert_eq!(s, "rab☃oof"); - /// ``` - /// - /// This example shows that not all reversals lead to a well formed string. - /// For example, in this case, combining marks are used to put accents over - /// some letters, and those accent marks must appear after the codepoints - /// they modify. - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let mut s = BString::from("résumé"); - /// s.reverse_chars(); - /// assert_eq!(s, B(b"\xCC\x81emus\xCC\x81er")); - /// ``` - /// - /// A word of warning: the above example relies on the fact that - /// `résumé` is in decomposed normal form, which means there are separate - /// codepoints for the accents above `e`. If it is instead in composed - /// normal form, then the example works: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let mut s = BString::from("résumé"); - /// s.reverse_chars(); - /// assert_eq!(s, "émusér"); - /// ``` - /// - /// The point here is to be cautious and not assume that just because - /// `reverse_chars` works in one case, that it therefore works in all - /// cases. - #[inline] - pub fn reverse_chars(&mut self) { - let mut i = 0; - loop { - let (_, size) = utf8::decode(self[i..].as_bytes()); - if size == 0 { - break; - } - if size > 1 { - self[i..i + size].reverse_bytes(); - } - i += size; - } - self.reverse_bytes(); - } - - /// Reverse the graphemes in this string, in place. - /// - /// If this byte string is valid UTF-8, then its reversal by grapheme - /// is also guaranteed to be valid UTF-8. - /// - /// This operation is equivalent to the following, but without allocating: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("foo☃bar"); - /// - /// let mut graphemes: Vec<&str> = s.graphemes().collect(); - /// graphemes.reverse(); - /// - /// let reversed = graphemes.concat(); - /// assert_eq!(reversed, "rab☃oof"); - /// ``` - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("foo☃bar"); - /// s.reverse_graphemes(); - /// assert_eq!(s, "rab☃oof"); - /// ``` - /// - /// This example shows how this correctly handles grapheme clusters, - /// unlike `reverse_chars`. - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("résumé"); - /// s.reverse_graphemes(); - /// assert_eq!(s, "émusér"); - /// ``` - #[cfg(feature = "unicode")] - #[inline] - pub fn reverse_graphemes(&mut self) { - use unicode::decode_grapheme; - - let mut i = 0; - loop { - let (_, size) = decode_grapheme(&self[i..]); - if size == 0 { - break; - } - if size > 1 { - self[i..i + size].reverse_bytes(); - } - i += size; - } - self.reverse_bytes(); - } - - /// Returns true if and only if every byte in this byte string is ASCII. - /// - /// ASCII is an encoding that defines 128 codepoints. A byte corresponds to - /// an ASCII codepoint if and only if it is in the inclusive range - /// `[0, 127]`. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// assert!(B("abc").is_ascii()); - /// assert!(!B("☃βツ").is_ascii()); - /// assert!(!B(b"\xFF").is_ascii()); - /// ``` - #[inline] - pub fn is_ascii(&self) -> bool { - ascii::first_non_ascii_byte(&self.bytes) == self.len() - } - - /// Returns true if and only if the entire byte string is valid UTF-8. - /// - /// If you need location information about where a byte string's first - /// invalid UTF-8 byte is, then use the [`to_str`](#method.to_str) method. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// assert!(B("abc").is_utf8()); - /// assert!(B("☃βツ").is_utf8()); - /// // invalid bytes - /// assert!(!B(b"abc\xFF").is_utf8()); - /// // surrogate encoding - /// assert!(!B(b"\xED\xA0\x80").is_utf8()); - /// // incomplete sequence - /// assert!(!B(b"\xF0\x9D\x9Ca").is_utf8()); - /// // overlong sequence - /// assert!(!B(b"\xF0\x82\x82\xAC").is_utf8()); - /// ``` - #[inline] - pub fn is_utf8(&self) -> bool { - utf8::validate(self.as_bytes()).is_ok() - } - - /// Divides this byte string into two at an index. - /// - /// The first byte string will contain all bytes at indices `[0, at)`, and - /// the second byte string will contain all bytes at indices `[at, len)`. - /// - /// # Panics - /// - /// Panics if `at > len`. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// assert_eq!(B("foobar").split_at(3), (B("foo"), B("bar"))); - /// assert_eq!(B("foobar").split_at(0), (B(""), B("foobar"))); - /// assert_eq!(B("foobar").split_at(6), (B("foobar"), B(""))); - /// ``` - #[inline] - pub fn split_at(&self, at: usize) -> (&BStr, &BStr) { - let (left, right) = self.as_bytes().split_at(at); - (BStr::new(left), BStr::new(right)) - } - - /// Divides this mutable byte string into two at an index. - /// - /// The first byte string will contain all bytes at indices `[0, at)`, and - /// the second byte string will contain all bytes at indices `[at, len)`. - /// - /// # Panics - /// - /// Panics if `at > len`. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::{B, BString}; - /// - /// let mut b = BString::from("foobar"); - /// { - /// let (left, right) = b.split_at_mut(3); - /// left[2] = b'z'; - /// right[2] = b'z'; - /// } - /// assert_eq!(b, B("fozbaz")); - /// ``` - #[inline] - pub fn split_at_mut(&mut self, at: usize) -> (&mut BStr, &mut BStr) { - let (left, right) = self.as_bytes_mut().split_at_mut(at); - (BStr::new_mut(left), BStr::new_mut(right)) - } - - /// Retrieve a reference to a byte or a subslice, depending on the type of - /// the index given. - /// - /// If given a position, this returns a reference to the byte at that - /// position, if it exists. - /// - /// If given a range, this returns the slice of bytes corresponding to that - /// range in this byte string. - /// - /// In the case of invalid indices, this returns `None`. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B("baz"); - /// assert_eq!(s.get(1), Some(&b'a')); - /// assert_eq!(s.get(0..2), Some(B("ba"))); - /// assert_eq!(s.get(2..), Some(B("z"))); - /// assert_eq!(s.get(1..=2), Some(B("az"))); - /// ``` - #[inline] - pub fn get(&self, at: I) -> Option<&I::Output> { - at.get(self) - } - - /// Retrieve a mutable reference to a byte or a subslice, depending on the - /// type of the index given. - /// - /// If given a position, this returns a reference to the byte at that - /// position, if it exists. - /// - /// If given a range, this returns the slice of bytes corresponding to that - /// range in this byte string. - /// - /// In the case of invalid indices, this returns `None`. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("baz"); - /// if let Some(mut slice) = s.get_mut(1..) { - /// slice[0] = b'o'; - /// slice[1] = b'p'; - /// } - /// assert_eq!(s, "bop"); - /// ``` - #[inline] - pub fn get_mut(&mut self, at: I) -> Option<&mut I::Output> { - at.get_mut(self) - } - - /// Retrieve a reference to a byte or a subslice, depending on the type of - /// the index given, while explicitly eliding bounds checks. - /// - /// If given a position, this returns a reference to the byte at that - /// position, if it exists. - /// - /// If given a range, this returns the slice of bytes corresponding to that - /// range in this byte string. - /// - /// In the case of invalid indices, this returns `None`. - /// - /// # Safety - /// - /// Callers must ensure that the supplied bounds are correct. If they - /// are out of bounds, then this results in undefined behavior. For a - /// safe alternative, use [`get`](#method.get). - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B("baz"); - /// unsafe { - /// assert_eq!(s.get_unchecked(1), &b'a'); - /// assert_eq!(s.get_unchecked(0..2), "ba"); - /// assert_eq!(s.get_unchecked(2..), "z"); - /// assert_eq!(s.get_unchecked(1..=2), "az"); - /// } - /// ``` - pub unsafe fn get_unchecked(&self, at: I) -> &I::Output { - at.get_unchecked(self) - } - - /// Retrieve a mutable reference to a byte or a subslice, depending on the - /// type of the index given, while explicitly eliding bounds checks. - /// - /// If given a position, this returns a reference to the byte at that - /// position, if it exists. - /// - /// If given a range, this returns the slice of bytes corresponding to that - /// range in this byte string. - /// - /// In the case of invalid indices, this returns `None`. - /// - /// # Safety - /// - /// Callers must ensure that the supplied bounds are correct. If they - /// are out of bounds, then this results in undefined behavior. For a - /// safe alternative, use [`get_mut`](#method.get_mut). - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BString; - /// - /// let mut s = BString::from("baz"); - /// { - /// let mut slice = unsafe { s.get_unchecked_mut(1..) }; - /// slice[0] = b'o'; - /// slice[1] = b'p'; - /// } - /// assert_eq!(s, "bop"); - /// ``` - pub unsafe fn get_unchecked_mut( - &mut self, - at: I, - ) -> &mut I::Output { - at.get_unchecked_mut(self) - } - - /// Returns the last byte in this byte string, if it's non-empty. If this - /// byte string is empty, this returns `None`. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// assert_eq!(Some(b'z'), B("baz").last()); - /// assert_eq!(None, B("").last()); - /// ``` - #[inline] - pub fn last(&self) -> Option { - self.get(self.len().saturating_sub(1)).map(|&b| b) - } - - /// Copies elements from one part of the slice to another part of itself, - /// where the parts may be overlapping. - /// - /// `src` is the range within this byte string to copy from, while `dest` - /// is the starting index of the range within this byte string to copy to. - /// The length indicated by `src` must be less than or equal to the number - /// of bytes from `dest` to the end of the byte string. - /// - /// # Panics - /// - /// Panics if either range is out of bounds, or if `src` is too big to fit - /// into `dest`, or if the end of `src` is before the start. - /// - /// # Examples - /// - /// Copying four bytes within a byte string: - /// - /// ``` - /// use bstr::BStr; - /// - /// let mut buf = *b"Hello, World!"; - /// let s = BStr::new_mut(&mut buf); - /// s.copy_within(1..5, 8); - /// assert_eq!(s, "Hello, Wello!"); - /// ``` - #[inline] - pub fn copy_within( - &mut self, - src: R, - dest: usize, - ) where R: ops::RangeBounds - { - let src_start = match src.start_bound() { - ops::Bound::Included(&n) => n, - ops::Bound::Excluded(&n) => { - n.checked_add(1).expect("attempted to index slice beyond max") - } - ops::Bound::Unbounded => 0, - }; - let src_end = match src.end_bound() { - ops::Bound::Included(&n) => { - n.checked_add(1).expect("attempted to index slice beyond max") - } - ops::Bound::Excluded(&n) => n, - ops::Bound::Unbounded => self.len(), - }; - assert!(src_start <= src_end, "src end is before src start"); - assert!(src_end <= self.len(), "src is out of bounds"); - let count = src_end - src_start; - assert!(dest <= self.len() - count, "dest is out of bounds"); - - // SAFETY: This is safe because we use ptr::copy to handle overlapping - // copies, and is also safe because we've checked all the bounds above. - // Finally, we are only dealing with u8 data, which is Copy, which - // means we can copy without worrying about ownership/destructors. - unsafe { - ptr::copy( - self.get_unchecked(src_start), - self.get_unchecked_mut(dest), - count, - ); - } - } - - /// Returns a raw pointer to this byte string's underlying bytes. - /// - /// # Safety - /// - /// The caller must ensure that the byte string outlives the pointer this - /// function returns, or else it will end up pointing to garbage. - /// - /// Modifying the container (like a `BString`) referenced by this byte - /// string may cause its buffer to be reallocated, which would also make - /// any pointers to it invalid. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::B; - /// - /// let s = B("hello"); - /// let p = s.as_ptr(); - /// - /// unsafe { - /// assert_eq!(*p.add(2), b'l'); - /// } - /// ``` - #[inline] - pub fn as_ptr(&self) -> *const u8 { - self.as_bytes().as_ptr() - } - - /// Returns a raw mutable pointer to this byte string's underlying bytes. - /// - /// # Safety - /// - /// The caller must ensure that the byte string outlives the pointer this - /// function returns, or else it will end up pointing to garbage. - /// - /// Modifying the container (like a `BString`) referenced by this byte - /// string may cause its buffer to be reallocated, which would also make - /// any pointers to it invalid. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::BStr; - /// - /// let mut buf = &mut [b'h', b'e', b'l', b'l', b'o']; - /// let mut s = BStr::new_mut(buf); - /// let p = s.as_mut_ptr(); - /// - /// unsafe { - /// *p.add(2) = b'Z'; - /// } - /// assert_eq!("heZlo", s); - /// ``` - #[inline] - pub fn as_mut_ptr(&mut self) -> *mut u8 { - self.as_bytes_mut().as_mut_ptr() - } -} - -/// A single substring searcher fixed to a particular needle. -/// -/// The purpose of this type is to permit callers to construct a substring -/// searcher that can be used to search haystacks without the overhead of -/// constructing the searcher in the first place. This is a somewhat niche -/// concern when it's necessary to re-use the same needle to search multiple -/// different haystacks with as little overhead as possible. In general, using -/// [`BStr::find`](struct.BStr.html#method.find) -/// or -/// [`BStr::find_iter`](struct.BStr.html#method.find_iter) -/// is good enough, but `Finder` is useful when you can meaningfully observe -/// searcher construction time in a profile. -/// -/// When the `std` feature is enabled, then this type has an `into_owned` -/// version which permits building a `Finder` that is not connected to the -/// lifetime of its needle. -#[derive(Clone, Debug)] -pub struct Finder<'a> { - searcher: TwoWay<'a>, -} - -impl<'a> Finder<'a> { - /// Create a new finder for the given needle. - #[inline] - pub fn new>(needle: &'a B) -> Finder<'a> { - Finder { searcher: TwoWay::forward(BStr::new(needle)) } - } - - /// Convert this finder into its owned variant, such that it no longer - /// borrows the needle. - /// - /// If this is already an owned finder, then this is a no-op. Otherwise, - /// this copies the needle. - /// - /// This is only available when the `std` feature is enabled. - #[cfg(feature = "std")] - #[inline] - pub fn into_owned(self) -> Finder<'static> { - Finder { searcher: self.searcher.into_owned() } - } - - /// Returns the needle that this finder searches for. - /// - /// Note that the lifetime of the needle returned is tied to the lifetime - /// of the finder, and may be shorter than the `'a` lifetime. Namely, a - /// finder's needle can be either borrowed or owned, so the lifetime of the - /// needle returned must necessarily be the shorter of the two. - #[inline] - pub fn needle(&self) -> &BStr { - self.searcher.needle() - } - - /// Returns the index of the first occurrence of this needle in the given - /// haystack. - /// - /// The haystack may be any type that can be cheaply converted into a - /// `&[u8]`. This includes, but is not limited to, `&str`, `&BStr`, and of - /// course, `&[u8]` itself. - /// - /// # Complexity - /// - /// This routine is guaranteed to have worst case linear time complexity - /// with respect to both the needle and the haystack. That is, this runs - /// in `O(needle.len() + haystack.len())` time. - /// - /// This routine is also guaranteed to have worst case constant space - /// complexity. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::Finder; - /// - /// let haystack = "foo bar baz"; - /// assert_eq!(Some(0), Finder::new("foo").find(haystack)); - /// assert_eq!(Some(4), Finder::new("bar").find(haystack)); - /// assert_eq!(None, Finder::new("quux").find(haystack)); - /// ``` - #[inline] - pub fn find>(&self, haystack: B) -> Option { - self.searcher.find(BStr::new(haystack.as_ref())) - } -} - -/// A single substring reverse searcher fixed to a particular needle. -/// -/// The purpose of this type is to permit callers to construct a substring -/// searcher that can be used to search haystacks without the overhead of -/// constructing the searcher in the first place. This is a somewhat niche -/// concern when it's necessary to re-use the same needle to search multiple -/// different haystacks with as little overhead as possible. In general, using -/// [`BStr::rfind`](struct.BStr.html#method.rfind) -/// or -/// [`BStr::rfind_iter`](struct.BStr.html#method.rfind_iter) -/// is good enough, but `FinderReverse` is useful when you can meaningfully -/// observe searcher construction time in a profile. -/// -/// When the `std` feature is enabled, then this type has an `into_owned` -/// version which permits building a `FinderReverse` that is not connected to -/// the lifetime of its needle. -#[derive(Clone, Debug)] -pub struct FinderReverse<'a> { - searcher: TwoWay<'a>, -} - -impl<'a> FinderReverse<'a> { - /// Create a new reverse finder for the given needle. - #[inline] - pub fn new>(needle: &'a B) -> FinderReverse<'a> { - FinderReverse { searcher: TwoWay::reverse(BStr::new(needle)) } - } - - /// Convert this finder into its owned variant, such that it no longer - /// borrows the needle. - /// - /// If this is already an owned finder, then this is a no-op. Otherwise, - /// this copies the needle. - /// - /// This is only available when the `std` feature is enabled. - #[cfg(feature = "std")] - #[inline] - pub fn into_owned(self) -> FinderReverse<'static> { - FinderReverse { searcher: self.searcher.into_owned() } - } - - /// Returns the needle that this finder searches for. - /// - /// Note that the lifetime of the needle returned is tied to the lifetime - /// of this finder, and may be shorter than the `'a` lifetime. Namely, - /// a finder's needle can be either borrowed or owned, so the lifetime of - /// the needle returned must necessarily be the shorter of the two. - #[inline] - pub fn needle(&self) -> &BStr { - self.searcher.needle() - } - - /// Returns the index of the last occurrence of this needle in the given - /// haystack. - /// - /// The haystack may be any type that can be cheaply converted into a - /// `&[u8]`. This includes, but is not limited to, `&str`, `&BStr`, and of - /// course, `&[u8]` itself. - /// - /// # Complexity - /// - /// This routine is guaranteed to have worst case linear time complexity - /// with respect to both the needle and the haystack. That is, this runs - /// in `O(needle.len() + haystack.len())` time. - /// - /// This routine is also guaranteed to have worst case constant space - /// complexity. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use bstr::FinderReverse; - /// - /// let haystack = "foo bar baz"; - /// assert_eq!(Some(0), FinderReverse::new("foo").rfind(haystack)); - /// assert_eq!(Some(4), FinderReverse::new("bar").rfind(haystack)); - /// assert_eq!(None, FinderReverse::new("quux").rfind(haystack)); - /// ``` - #[inline] - pub fn rfind>(&self, haystack: B) -> Option { - self.searcher.rfind(BStr::new(haystack.as_ref())) - } -} - -/// An iterator over non-overlapping substring matches. -/// -/// Matches are reported by the byte offset at which they begin. -/// -/// `'a` is the shorter of two lifetimes: the byte string being searched or the -/// byte string being looked for. -#[derive(Debug)] -pub struct Find<'a> { - haystack: &'a BStr, - prestate: PrefilterState, - searcher: TwoWay<'a>, - pos: usize, -} - -impl<'a> Find<'a> { - fn new(haystack: &'a BStr, needle: &'a BStr) -> Find<'a> { - let searcher = TwoWay::forward(needle); - let prestate = searcher.prefilter_state(); - Find { haystack, prestate, searcher, pos: 0 } - } -} - -impl<'a> Iterator for Find<'a> { - type Item = usize; - - #[inline] - fn next(&mut self) -> Option { - if self.pos > self.haystack.len() { - return None; - } - let result = self.searcher.find_with( - &mut self.prestate, - &self.haystack[self.pos..], - ); - match result { - None => None, - Some(i) => { - let pos = self.pos + i; - self.pos = pos + cmp::max(1, self.searcher.needle().len()); - Some(pos) - } - } - } -} - -/// An iterator over non-overlapping substring matches in reverse. -/// -/// Matches are reported by the byte offset at which they begin. -/// -/// `'a` is the shorter of two lifetimes: the byte string being searched or the -/// byte string being looked for. -#[derive(Debug)] -pub struct FindReverse<'a> { - haystack: &'a BStr, - prestate: PrefilterState, - searcher: TwoWay<'a>, - /// When searching with an empty needle, this gets set to `None` after - /// we've yielded the last element at `0`. - pos: Option, -} - -impl<'a> FindReverse<'a> { - fn new(haystack: &'a BStr, needle: &'a BStr) -> FindReverse<'a> { - let searcher = TwoWay::reverse(needle); - let prestate = searcher.prefilter_state(); - let pos = Some(haystack.len()); - FindReverse { haystack, prestate, searcher, pos } - } - - fn haystack(&self) -> &'a BStr { - self.haystack - } - - fn needle(&self) -> &BStr { - self.searcher.needle() - } -} - -impl<'a> Iterator for FindReverse<'a> { - type Item = usize; - - #[inline] - fn next(&mut self) -> Option { - let pos = match self.pos { - None => return None, - Some(pos) => pos, - }; - let result = self.searcher.rfind_with( - &mut self.prestate, - &self.haystack[..pos], - ); - match result { - None => None, - Some(i) => { - if pos == i { - self.pos = pos.checked_sub(1); - } else { - self.pos = Some(i); - } - Some(i) - } - } - } -} - -/// An iterator over the bytes in a byte string. -/// -/// `'a` is the lifetime of the byte string being traversed. -#[derive(Debug)] -pub struct Bytes<'a> { - it: slice::Iter<'a, u8>, -} - -impl<'a> Iterator for Bytes<'a> { - type Item = u8; - - #[inline] - fn next(&mut self) -> Option { - self.it.next().map(|&b| b) - } -} - -impl<'a> DoubleEndedIterator for Bytes<'a> { - #[inline] - fn next_back(&mut self) -> Option { - self.it.next_back().map(|&b| b) - } -} - -impl<'a> ExactSizeIterator for Bytes<'a> { - #[inline] - fn len(&self) -> usize { - self.it.len() - } -} - -/// An iterator over the fields in a byte string, separated by whitespace. -/// -/// This iterator splits on contiguous runs of whitespace, such that the fields -/// in `foo\t\t\n \nbar` are `foo` and `bar`. -/// -/// `'a` is the lifetime of the byte string being split. -#[derive(Debug)] -pub struct Fields<'a> { - it: FieldsWith<'a, fn(char) -> bool>, -} - -impl<'a> Fields<'a> { - fn new(bytes: &'a BStr) -> Fields<'a> { - Fields { it: bytes.fields_with(|ch| ch.is_whitespace()) } - } -} - -impl<'a> Iterator for Fields<'a> { - type Item = &'a BStr; - - #[inline] - fn next(&mut self) -> Option<&'a BStr> { - self.it.next() - } -} - -/// An iterator over fields in the byte string, separated by a predicate over -/// codepoints. -/// -/// This iterator splits a byte string based on its predicate function such -/// that the elements returned are separated by contiguous runs of codepoints -/// for which the predicate returns true. -/// -/// `'a` is the lifetime of the byte string being split, while `F` is the type -/// of the predicate, i.e., `FnMut(char) -> bool`. -#[derive(Debug)] -pub struct FieldsWith<'a, F> { - f: F, - bytes: &'a BStr, - chars: CharIndices<'a>, -} - -impl<'a, F: FnMut(char) -> bool> FieldsWith<'a, F> { - fn new(bytes: &'a BStr, f: F) -> FieldsWith<'a, F> { - FieldsWith { - f: f, - bytes: bytes, - chars: bytes.char_indices(), - } - } -} - -impl<'a, F: FnMut(char) -> bool> Iterator for FieldsWith<'a, F> { - type Item = &'a BStr; - - #[inline] - fn next(&mut self) -> Option<&'a BStr> { - let (start, mut end); - loop { - match self.chars.next() { - None => return None, - Some((s, e, ch)) => { - if !(self.f)(ch) { - start = s; - end = e; - break; - } - } - } - } - while let Some((_, e, ch)) = self.chars.next() { - if (self.f)(ch) { - break; - } - end = e; - } - Some(&self.bytes[start..end]) - } -} - -/// An iterator over substrings in a byte string, split by a separator. -/// -/// `'a` is the lifetime of the byte string being split, while `F` is the type -/// of the predicate, i.e., `FnMut(char) -> bool`. -#[derive(Debug)] -pub struct Split<'a> { - finder: Find<'a>, - /// The end position of the previous match of our splitter. The element - /// we yield corresponds to the substring starting at `last` up to the - /// beginning of the next match of the splitter. - last: usize, - /// Only set when iteration is complete. A corner case here is when a - /// splitter is matched at the end of the haystack. At that point, we still - /// need to yield an empty string following it. - done: bool, -} - -impl<'a> Split<'a> { - fn new(haystack: &'a BStr, splitter: &'a BStr) -> Split<'a> { - let finder = haystack.find_iter(splitter); - Split { finder, last: 0, done: false } - } -} - -impl<'a> Iterator for Split<'a> { - type Item = &'a BStr; - - #[inline] - fn next(&mut self) -> Option<&'a BStr> { - let haystack = self.finder.haystack; - match self.finder.next() { - Some(start) => { - let next = &haystack[self.last..start]; - self.last = start + self.finder.searcher.needle().len(); - Some(next) - } - None => { - if self.last >= haystack.len() { - if !self.done { - self.done = true; - Some(B("")) - } else { - None - } - } else { - let s = &haystack[self.last..]; - self.last = haystack.len(); - self.done = true; - Some(s) - } - } - } - } -} - -/// An iterator over substrings in a byte string, split by a separator, in -/// reverse. -/// -/// `'a` is the lifetime of the byte string being split, while `F` is the type -/// of the predicate, i.e., `FnMut(char) -> bool`. -#[derive(Debug)] -pub struct SplitReverse<'a> { - finder: FindReverse<'a>, - /// The end position of the previous match of our splitter. The element - /// we yield corresponds to the substring starting at `last` up to the - /// beginning of the next match of the splitter. - last: usize, - /// Only set when iteration is complete. A corner case here is when a - /// splitter is matched at the end of the haystack. At that point, we still - /// need to yield an empty string following it. - done: bool, -} - -impl<'a> SplitReverse<'a> { - fn new(haystack: &'a BStr, splitter: &'a BStr) -> SplitReverse<'a> { - let finder = haystack.rfind_iter(splitter); - SplitReverse { finder, last: haystack.len(), done: false } - } -} - -impl<'a> Iterator for SplitReverse<'a> { - type Item = &'a BStr; - - #[inline] - fn next(&mut self) -> Option<&'a BStr> { - let haystack = self.finder.haystack(); - match self.finder.next() { - Some(start) => { - let nlen = self.finder.needle().len(); - let next = &haystack[start + nlen..self.last]; - self.last = start; - Some(next) - } - None => { - if self.last == 0 { - if !self.done { - self.done = true; - Some(B("")) - } else { - None - } - } else { - let s = &haystack[..self.last]; - self.last = 0; - self.done = true; - Some(s) - } - } - } - } -} - -/// An iterator over at most `n` substrings in a byte string, split by a -/// separator. -/// -/// `'a` is the lifetime of the byte string being split, while `F` is the type -/// of the predicate, i.e., `FnMut(char) -> bool`. -#[derive(Debug)] -pub struct SplitN<'a> { - split: Split<'a>, - limit: usize, - count: usize, -} - -impl<'a> SplitN<'a> { - fn new( - haystack: &'a BStr, - splitter: &'a BStr, - limit: usize, - ) -> SplitN<'a> { - let split = haystack.split(splitter); - SplitN { split, limit, count: 0 } - } -} - -impl<'a> Iterator for SplitN<'a> { - type Item = &'a BStr; - - #[inline] - fn next(&mut self) -> Option<&'a BStr> { - self.count += 1; - if self.count > self.limit { - None - } else if self.count == self.limit { - Some(&self.split.finder.haystack[self.split.last..]) - } else { - self.split.next() - } - } -} - - -/// An iterator over at most `n` substrings in a byte string, split by a -/// separator, in reverse. -/// -/// `'a` is the lifetime of the byte string being split, while `F` is the type -/// of the predicate, i.e., `FnMut(char) -> bool`. -#[derive(Debug)] -pub struct SplitNReverse<'a> { - split: SplitReverse<'a>, - limit: usize, - count: usize, -} - -impl<'a> SplitNReverse<'a> { - fn new( - haystack: &'a BStr, - splitter: &'a BStr, - limit: usize, - ) -> SplitNReverse<'a> { - let split = haystack.rsplit(splitter); - SplitNReverse { split, limit, count: 0 } - } -} - -impl<'a> Iterator for SplitNReverse<'a> { - type Item = &'a BStr; - - #[inline] - fn next(&mut self) -> Option<&'a BStr> { - self.count += 1; - if self.count > self.limit { - None - } else if self.count == self.limit { - Some(&self.split.finder.haystack()[..self.split.last]) - } else { - self.split.next() - } - } -} - -/// An iterator over all lines in a byte string, without their terminators. -/// -/// For this iterator, the only line terminators recognized are `\r\n` and -/// `\n`. -/// -/// `'a` is the lifetime of the byte string being iterated over. -pub struct Lines<'a> { - it: LinesWithTerminator<'a>, -} - -impl<'a> Lines<'a> { - fn new(bytes: &'a BStr) -> Lines<'a> { - Lines { it: LinesWithTerminator::new(bytes) } - } -} - -impl<'a> Iterator for Lines<'a> { - type Item = &'a BStr; - - #[inline] - fn next(&mut self) -> Option<&'a BStr> { - let mut line = self.it.next()?; - if line.last() == Some(b'\n') { - line = &line[..line.len() - 1]; - if line.last() == Some(b'\r') { - line = &line[..line.len() - 1]; - } - } - Some(line) - } -} - -/// An iterator over all lines in a byte string, including their terminators. -/// -/// For this iterator, the only line terminator recognized is `\n`. (Since -/// line terminators are included, this also handles `\r\n` line endings.) -/// -/// Line terminators are only included if they are present in the original -/// byte string. For example, the last line in a byte string may not end with -/// a line terminator. -/// -/// Concatenating all elements yielded by this iterator is guaranteed to yield -/// the original byte string. -/// -/// `'a` is the lifetime of the byte string being iterated over. -pub struct LinesWithTerminator<'a> { - bytes: &'a BStr, -} - -impl<'a> LinesWithTerminator<'a> { - fn new(bytes: &'a BStr) -> LinesWithTerminator<'a> { - LinesWithTerminator { bytes } - } -} - -impl<'a> Iterator for LinesWithTerminator<'a> { - type Item = &'a BStr; - - #[inline] - fn next(&mut self) -> Option<&'a BStr> { - match self.bytes.find_byte(b'\n') { - None if self.bytes.is_empty() => None, - None => { - let line = self.bytes; - self.bytes = B(""); - Some(line) - } - Some(end) => { - let line = &self.bytes[..end + 1]; - self.bytes = &self.bytes[end + 1..]; - Some(line) - } - } - } -} - -#[cfg(test)] -mod tests { - use tests::LOSSY_TESTS; - use super::*; - - #[test] - fn to_str_lossy() { - for (i, &(expected, input)) in LOSSY_TESTS.iter().enumerate() { - let got = B(input).to_str_lossy(); - assert_eq!( - expected.as_bytes(), - got.as_bytes(), - "to_str_lossy(ith: {:?}, given: {:?})", - i, input, - ); - - let mut got = String::new(); - B(input).to_str_lossy_into(&mut got); - assert_eq!( - expected.as_bytes(), got.as_bytes(), "to_str_lossy_into", - ); - - let got = String::from_utf8_lossy(input); - assert_eq!(expected.as_bytes(), got.as_bytes(), "std"); - } - } - - #[test] - #[should_panic] - fn copy_within_fail1() { - let mut buf = *b"foobar"; - let s = BStr::new_mut(&mut buf); - s.copy_within(0..2, 5); - } - - #[test] - #[should_panic] - fn copy_within_fail2() { - let mut buf = *b"foobar"; - let s = BStr::new_mut(&mut buf); - s.copy_within(3..2, 0); - } - - #[test] - #[should_panic] - fn copy_within_fail3() { - let mut buf = *b"foobar"; - let s = BStr::new_mut(&mut buf); - s.copy_within(5..7, 0); - } - - #[test] - #[should_panic] - fn copy_within_fail4() { - let mut buf = *b"foobar"; - let s = BStr::new_mut(&mut buf); - s.copy_within(0..1, 6); - } } diff -Nru cargo-0.35.0/vendor/bstr/src/cow.rs cargo-0.37.0/vendor/bstr/src/cow.rs --- cargo-0.35.0/vendor/bstr/src/cow.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/cow.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,52 +1,48 @@ -#[cfg(feature = "std")] -use std::borrow::Cow; use core::ops; - -use bstr::BStr; #[cfg(feature = "std")] -use bstring::BString; +use std::borrow::Cow; -/// A specialized copy-on-write BStr. +/// A specialized copy-on-write byte string. /// -/// The purpose of this type is to permit usage of a "borrowed or owned byte -/// string" in a way that keeps std/no-std compatibility. That is, in no-std -/// mode, this type devolves into a simple &BStr with no owned variant +/// The purpose of this type is to permit usage of a "borrowed or owned +/// byte string" in a way that keeps std/no-std compatibility. That is, in +/// no-std mode, this type devolves into a simple &[u8] with no owned variant /// availble. #[derive(Clone, Debug)] -pub struct CowBStr<'a>(Imp<'a>); +pub struct CowBytes<'a>(Imp<'a>); #[cfg(feature = "std")] #[derive(Clone, Debug)] -struct Imp<'a>(Cow<'a, BStr>); +struct Imp<'a>(Cow<'a, [u8]>); #[cfg(not(feature = "std"))] #[derive(Clone, Debug)] -struct Imp<'a>(&'a BStr); +struct Imp<'a>(&'a [u8]); -impl<'a> ops::Deref for CowBStr<'a> { - type Target = BStr; +impl<'a> ops::Deref for CowBytes<'a> { + type Target = [u8]; - fn deref(&self) -> &BStr { - self.as_bstr() + fn deref(&self) -> &[u8] { + self.as_slice() } } -impl<'a> CowBStr<'a> { - /// Create a new borrowed CowBStr. - pub fn new>(bytes: &'a B) -> CowBStr<'a> { - CowBStr(Imp::new(BStr::new(bytes))) +impl<'a> CowBytes<'a> { + /// Create a new borrowed CowBytes. + pub fn new>(bytes: &'a B) -> CowBytes<'a> { + CowBytes(Imp::new(bytes.as_ref())) } - /// Create a new owned CowBStr. + /// Create a new owned CowBytes. #[cfg(feature = "std")] - pub fn new_owned(bytes: BString) -> CowBStr<'static> { - CowBStr(Imp(Cow::Owned(bytes))) + pub fn new_owned(bytes: Vec) -> CowBytes<'static> { + CowBytes(Imp(Cow::Owned(bytes))) } /// Return a borrowed byte string, regardless of whether this is an owned /// or borrowed byte string internally. - pub fn as_bstr(&self) -> &BStr { - self.0.as_bstr() + pub fn as_slice(&self) -> &[u8] { + self.0.as_slice() } /// Return an owned version of this copy-on-write byte string. @@ -54,28 +50,27 @@ /// If this is already an owned byte string internally, then this is a /// no-op. Otherwise, the internal byte string is copied. #[cfg(feature = "std")] - pub fn into_owned(self) -> CowBStr<'static> { + pub fn into_owned(self) -> CowBytes<'static> { match (self.0).0 { - Cow::Borrowed(b) => CowBStr::new_owned(b.to_bstring()), - Cow::Owned(b) => CowBStr::new_owned(b), + Cow::Borrowed(b) => CowBytes::new_owned(b.to_vec()), + Cow::Owned(b) => CowBytes::new_owned(b), } } } impl<'a> Imp<'a> { #[cfg(feature = "std")] - pub fn new(bytes: &'a BStr) -> Imp<'a> { + pub fn new(bytes: &'a [u8]) -> Imp<'a> { Imp(Cow::Borrowed(bytes)) } #[cfg(not(feature = "std"))] - pub fn new(bytes: &'a BStr) -> Imp<'a> { + pub fn new(bytes: &'a [u8]) -> Imp<'a> { Imp(bytes) } #[cfg(feature = "std")] - pub fn as_bstr(&self) -> &BStr { - // &*self.0 + pub fn as_slice(&self) -> &[u8] { match self.0 { Cow::Owned(ref x) => x, Cow::Borrowed(x) => x, @@ -83,7 +78,7 @@ } #[cfg(not(feature = "std"))] - pub fn as_bstr(&self) -> &BStr { + pub fn as_slice(&self) -> &[u8] { self.0 } } diff -Nru cargo-0.35.0/vendor/bstr/src/ext_slice.rs cargo-0.37.0/vendor/bstr/src/ext_slice.rs --- cargo-0.35.0/vendor/bstr/src/ext_slice.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/ext_slice.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,3459 @@ +#[cfg(feature = "std")] +use std::borrow::Cow; +#[cfg(feature = "std")] +use std::ffi::OsStr; +#[cfg(feature = "std")] +use std::path::Path; + +use core::cmp; +use core::ops; +use core::ptr; +use core::slice; +use core::str; + +use memchr::{memchr, memrchr}; + +use ascii; +use bstr::BStr; +#[cfg(feature = "std")] +use ext_vec::ByteVec; +use search::{PrefilterState, TwoWay}; +#[cfg(feature = "unicode")] +use unicode::{ + whitespace_len_fwd, whitespace_len_rev, GraphemeIndices, Graphemes, + SentenceIndices, Sentences, WordIndices, Words, WordsWithBreakIndices, + WordsWithBreaks, +}; +use utf8::{self, CharIndices, Chars, Utf8Error}; + +/// A short-hand constructor for building a `&[u8]`. +/// +/// This idiosyncratic constructor is useful for concisely building byte string +/// slices. Its primary utility is in conveniently writing byte string literals +/// in a uniform way. For example, consider this code that does not compile: +/// +/// ```ignore +/// let strs = vec![b"a", b"xy"]; +/// ``` +/// +/// The above code doesn't compile because the type of the byte string literal +/// `b"a"` is `&'static [u8; 1]`, and the type of `b"xy"` is +/// `&'static [u8; 2]`. Since their types aren't the same, they can't be stored +/// in the same `Vec`. (This is dissimilar from normal Unicode string slices, +/// where both `"a"` and `"xy"` have the same type of `&'static str`.) +/// +/// One way of getting the above code to compile is to convert byte strings to +/// slices. You might try this: +/// +/// ```ignore +/// let strs = vec![&b"a", &b"xy"]; +/// ``` +/// +/// But this just creates values with type `& &'static [u8; 1]` and +/// `& &'static [u8; 2]`. Instead, you need to force the issue like so: +/// +/// ``` +/// let strs = vec![&b"a"[..], &b"xy"[..]]; +/// // or +/// let strs = vec![b"a".as_ref(), b"xy".as_ref()]; +/// ``` +/// +/// But neither of these are particularly convenient to type, especially when +/// it's something as common as a string literal. Thus, this constructor +/// permits writing the following instead: +/// +/// ``` +/// use bstr::B; +/// +/// let strs = vec![B("a"), B(b"xy")]; +/// ``` +/// +/// Notice that this also lets you mix and match both string literals and byte +/// string literals. This can be quite convenient! +#[allow(non_snake_case)] +#[inline] +pub fn B<'a, B: ?Sized + AsRef<[u8]>>(bytes: &'a B) -> &'a [u8] { + bytes.as_ref() +} + +impl ByteSlice for [u8] { + fn as_bytes(&self) -> &[u8] { + self + } + fn as_bytes_mut(&mut self) -> &mut [u8] { + self + } +} + +/// Ensure that callers cannot implement `ByteSlice` by making an +/// umplementable trait its super trait. +pub trait Sealed {} +impl Sealed for [u8] {} + +/// A trait that extends a slice of bytes with string oriented methods. +pub trait ByteSlice: Sealed { + /// A method for accessing the raw bytes of this type. This is always a + /// no-op and callers shouldn't care about it. This only exists for making + /// the extension trait work. + #[doc(hidden)] + fn as_bytes(&self) -> &[u8]; + + /// A method for accessing the raw bytes of this type, mutably. This is + /// always a no-op and callers shouldn't care about it. This only exists + /// for making the extension trait work. + #[doc(hidden)] + fn as_bytes_mut(&mut self) -> &mut [u8]; + + /// Return this byte slice as a `&BStr`. + /// + /// Use `&BStr` is useful because of its `fmt::Debug` representation + /// and various other trait implementations (such as `PartialEq` and + /// `PartialOrd`). In particular, the `Debug` implementation for `BStr` + /// shows its bytes as a normal string. For invalid UTF-8, hex escape + /// sequences are used. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// println!("{:?}", b"foo\xFFbar".as_bstr()); + /// ``` + fn as_bstr(&self) -> &BStr { + BStr::new(self.as_bytes()) + } + + /// Return this byte slice as a `&mut BStr`. + /// + /// Use `&mut BStr` is useful because of its `fmt::Debug` representation + /// and various other trait implementations (such as `PartialEq` and + /// `PartialOrd`). In particular, the `Debug` implementation for `BStr` + /// shows its bytes as a normal string. For invalid UTF-8, hex escape + /// sequences are used. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let mut bytes = *b"foo\xFFbar"; + /// println!("{:?}", &mut bytes.as_bstr_mut()); + /// ``` + fn as_bstr_mut(&mut self) -> &mut BStr { + BStr::new_mut(self.as_bytes_mut()) + } + + /// Create an immutable byte string from an OS string slice. + /// + /// On Unix, this always succeeds and is zero cost. On non-Unix systems, + /// this returns `None` if the given OS string is not valid UTF-8. (For + /// example, on Windows, file paths are allowed to be a sequence of + /// arbitrary 16-bit integers. Not all such sequences can be transcoded to + /// valid UTF-8.) + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use std::ffi::OsStr; + /// + /// use bstr::{B, ByteSlice}; + /// + /// let os_str = OsStr::new("foo"); + /// let bs = <[u8]>::from_os_str(os_str).expect("should be valid UTF-8"); + /// assert_eq!(bs, B("foo")); + /// ``` + #[cfg(feature = "std")] + #[inline] + fn from_os_str(os_str: &OsStr) -> Option<&[u8]> { + #[cfg(unix)] + #[inline] + fn imp(os_str: &OsStr) -> Option<&[u8]> { + use std::os::unix::ffi::OsStrExt; + + Some(os_str.as_bytes()) + } + + #[cfg(not(unix))] + #[inline] + fn imp(os_str: &OsStr) -> Option<&[u8]> { + os_str.to_str().map(|s| s.as_bytes()) + } + + imp(os_str) + } + + /// Create an immutable byte string from a file path. + /// + /// On Unix, this always succeeds and is zero cost. On non-Unix systems, + /// this returns `None` if the given path is not valid UTF-8. (For example, + /// on Windows, file paths are allowed to be a sequence of arbitrary 16-bit + /// integers. Not all such sequences can be transcoded to valid UTF-8.) + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use std::path::Path; + /// + /// use bstr::{B, ByteSlice}; + /// + /// let path = Path::new("foo"); + /// let bs = <[u8]>::from_path(path).expect("should be valid UTF-8"); + /// assert_eq!(bs, B("foo")); + /// ``` + #[cfg(feature = "std")] + #[inline] + fn from_path(path: &Path) -> Option<&[u8]> { + Self::from_os_str(path.as_os_str()) + } + + /// Safely convert this byte string into a `&str` if it's valid UTF-8. + /// + /// If this byte string is not valid UTF-8, then an error is returned. The + /// error returned indicates the first invalid byte found and the length + /// of the error. + /// + /// In cases where a lossy conversion to `&str` is acceptable, then use one + /// of the [`to_str_lossy`](trait.ByteSlice.html#method.to_str_lossy) or + /// [`to_str_lossy_into`](trait.ByteSlice.html#method.to_str_lossy_into) + /// methods. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice, ByteVec}; + /// + /// # fn example() -> Result<(), bstr::Utf8Error> { + /// let s = B("☃βツ").to_str()?; + /// assert_eq!("☃βツ", s); + /// + /// let mut bstring = >::from("☃βツ"); + /// bstring.push(b'\xFF'); + /// let err = bstring.to_str().unwrap_err(); + /// assert_eq!(8, err.valid_up_to()); + /// # Ok(()) }; example().unwrap() + /// ``` + #[inline] + fn to_str(&self) -> Result<&str, Utf8Error> { + utf8::validate(self.as_bytes()).map(|_| { + // SAFETY: This is safe because of the guarantees provided by + // utf8::validate. + unsafe { str::from_utf8_unchecked(self.as_bytes()) } + }) + } + + /// Unsafely convert this byte string into a `&str`, without checking for + /// valid UTF-8. + /// + /// # Safety + /// + /// Callers *must* ensure that this byte string is valid UTF-8 before + /// calling this method. Converting a byte string into a `&str` that is + /// not valid UTF-8 is considered undefined behavior. + /// + /// This routine is useful in performance sensitive contexts where the + /// UTF-8 validity of the byte string is already known and it is + /// undesirable to pay the cost of an additional UTF-8 validation check + /// that [`to_str`](trait.ByteSlice.html#method.to_str) performs. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// // SAFETY: This is safe because string literals are guaranteed to be + /// // valid UTF-8 by the Rust compiler. + /// let s = unsafe { B("☃βツ").to_str_unchecked() }; + /// assert_eq!("☃βツ", s); + /// ``` + unsafe fn to_str_unchecked(&self) -> &str { + str::from_utf8_unchecked(self.as_bytes()) + } + + /// Convert this byte string to a valid UTF-8 string by replacing invalid + /// UTF-8 bytes with the Unicode replacement codepoint (`U+FFFD`). + /// + /// If the byte string is already valid UTF-8, then no copying or + /// allocation is performed and a borrrowed string slice is returned. If + /// the byte string is not valid UTF-8, then an owned string buffer is + /// returned with invalid bytes replaced by the replacement codepoint. + /// + /// This method uses the "substitution of maximal subparts" (Unicode + /// Standard, Chapter 3, Section 9) strategy for inserting the replacement + /// codepoint. Specifically, a replacement codepoint is inserted whenever a + /// byte is found that cannot possibly lead to a valid code unit sequence. + /// If there were previous bytes that represented a prefix of a well-formed + /// code unit sequence, then all of those bytes are substituted with a + /// single replacement codepoint. The "substitution of maximal subparts" + /// strategy is the same strategy used by + /// [W3C's Encoding standard](https://www.w3.org/TR/encoding/). + /// For a more precise description of the maximal subpart strategy, see + /// the Unicode Standard, Chapter 3, Section 9. See also + /// [Public Review Issue #121](http://www.unicode.org/review/pr-121.html). + /// + /// N.B. Rust's standard library also appears to use the same strategy, + /// but it does not appear to be an API guarantee. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use std::borrow::Cow; + /// + /// use bstr::ByteSlice; + /// + /// let mut bstring = >::from("☃βツ"); + /// assert_eq!(Cow::Borrowed("☃βツ"), bstring.to_str_lossy()); + /// + /// // Add a byte that makes the sequence invalid. + /// bstring.push(b'\xFF'); + /// assert_eq!(Cow::Borrowed("☃βツ\u{FFFD}"), bstring.to_str_lossy()); + /// ``` + /// + /// This demonstrates the "maximal subpart" substitution logic. + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// // \x61 is the ASCII codepoint for 'a'. + /// // \xF1\x80\x80 is a valid 3-byte code unit prefix. + /// // \xE1\x80 is a valid 2-byte code unit prefix. + /// // \xC2 is a valid 1-byte code unit prefix. + /// // \x62 is the ASCII codepoint for 'b'. + /// // + /// // In sum, each of the prefixes is replaced by a single replacement + /// // codepoint since none of the prefixes are properly completed. This + /// // is in contrast to other strategies that might insert a replacement + /// // codepoint for every single byte. + /// let bs = B(b"\x61\xF1\x80\x80\xE1\x80\xC2\x62"); + /// assert_eq!("a\u{FFFD}\u{FFFD}\u{FFFD}b", bs.to_str_lossy()); + /// ``` + #[cfg(feature = "std")] + #[inline] + fn to_str_lossy(&self) -> Cow { + match utf8::validate(self.as_bytes()) { + Ok(()) => { + // SAFETY: This is safe because of the guarantees provided by + // utf8::validate. + unsafe { + Cow::Borrowed(str::from_utf8_unchecked(self.as_bytes())) + } + } + Err(err) => { + let mut lossy = String::with_capacity(self.as_bytes().len()); + let (valid, after) = + self.as_bytes().split_at(err.valid_up_to()); + // SAFETY: This is safe because utf8::validate guarantees + // that all of `valid` is valid UTF-8. + lossy.push_str(unsafe { str::from_utf8_unchecked(valid) }); + lossy.push_str("\u{FFFD}"); + if let Some(len) = err.error_len() { + after[len..].to_str_lossy_into(&mut lossy); + } + Cow::Owned(lossy) + } + } + } + + /// Copy the contents of this byte string into the given owned string + /// buffer, while replacing invalid UTF-8 code unit sequences with the + /// Unicode replacement codepoint (`U+FFFD`). + /// + /// This method uses the same "substitution of maximal subparts" strategy + /// for inserting the replacement codepoint as the + /// [`to_str_lossy`](trait.ByteSlice.html#method.to_str_lossy) method. + /// + /// This routine is useful for amortizing allocation. However, unlike + /// `to_str_lossy`, this routine will _always_ copy the contents of this + /// byte string into the destination buffer, even if this byte string is + /// valid UTF-8. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use std::borrow::Cow; + /// + /// use bstr::ByteSlice; + /// + /// let mut bstring = >::from("☃βツ"); + /// // Add a byte that makes the sequence invalid. + /// bstring.push(b'\xFF'); + /// + /// let mut dest = String::new(); + /// bstring.to_str_lossy_into(&mut dest); + /// assert_eq!("☃βツ\u{FFFD}", dest); + /// ``` + #[cfg(feature = "std")] + #[inline] + fn to_str_lossy_into(&self, dest: &mut String) { + let mut bytes = self.as_bytes(); + dest.reserve(bytes.len()); + loop { + match utf8::validate(bytes) { + Ok(()) => { + // SAFETY: This is safe because utf8::validate guarantees + // that all of `bytes` is valid UTF-8. + dest.push_str(unsafe { str::from_utf8_unchecked(bytes) }); + break; + } + Err(err) => { + let (valid, after) = bytes.split_at(err.valid_up_to()); + // SAFETY: This is safe because utf8::validate guarantees + // that all of `valid` is valid UTF-8. + dest.push_str(unsafe { str::from_utf8_unchecked(valid) }); + dest.push_str("\u{FFFD}"); + match err.error_len() { + None => break, + Some(len) => bytes = &after[len..], + } + } + } + } + } + + /// Create an OS string slice from this byte string. + /// + /// On Unix, this always succeeds and is zero cost. On non-Unix systems, + /// this returns a UTF-8 decoding error if this byte string is not valid + /// UTF-8. (For example, on Windows, file paths are allowed to be a + /// sequence of arbitrary 16-bit integers. There is no obvious mapping from + /// an arbitrary sequence of 8-bit integers to an arbitrary sequence of + /// 16-bit integers.) + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let os_str = b"foo".to_os_str().expect("should be valid UTF-8"); + /// assert_eq!(os_str, "foo"); + /// ``` + #[cfg(feature = "std")] + #[inline] + fn to_os_str(&self) -> Result<&OsStr, Utf8Error> { + #[cfg(unix)] + #[inline] + fn imp(bytes: &[u8]) -> Result<&OsStr, Utf8Error> { + use std::os::unix::ffi::OsStrExt; + + Ok(OsStr::from_bytes(bytes)) + } + + #[cfg(not(unix))] + #[inline] + fn imp(bytes: &[u8]) -> Result<&OsStr, Utf8Error> { + bytes.to_str().map(OsStr::new) + } + + imp(self.as_bytes()) + } + + /// Lossily create an OS string slice from this byte string. + /// + /// On Unix, this always succeeds and is zero cost. On non-Unix systems, + /// this will perform a UTF-8 check and lossily convert this byte string + /// into valid UTF-8 using the Unicode replacement codepoint. + /// + /// Note that this can prevent the correct roundtripping of file paths on + /// non-Unix systems such as Windows, where file paths are an arbitrary + /// sequence of 16-bit integers. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let os_str = b"foo\xFFbar".to_os_str_lossy(); + /// assert_eq!(os_str.to_string_lossy(), "foo\u{FFFD}bar"); + /// ``` + #[cfg(feature = "std")] + #[inline] + fn to_os_str_lossy(&self) -> Cow { + #[cfg(unix)] + #[inline] + fn imp(bytes: &[u8]) -> Cow { + use std::os::unix::ffi::OsStrExt; + + Cow::Borrowed(OsStr::from_bytes(bytes)) + } + + #[cfg(not(unix))] + #[inline] + fn imp(bytes: &[u8]) -> Cow { + use std::ffi::OsString; + + match bytes.to_str_lossy() { + Cow::Borrowed(x) => Cow::Borrowed(OsStr::new(x)), + Cow::Owned(x) => Cow::Owned(OsString::from(x)), + } + } + + imp(self.as_bytes()) + } + + /// Create a path slice from this byte string. + /// + /// On Unix, this always succeeds and is zero cost. On non-Unix systems, + /// this returns a UTF-8 decoding error if this byte string is not valid + /// UTF-8. (For example, on Windows, file paths are allowed to be a + /// sequence of arbitrary 16-bit integers. There is no obvious mapping from + /// an arbitrary sequence of 8-bit integers to an arbitrary sequence of + /// 16-bit integers.) + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let path = b"foo".to_path().expect("should be valid UTF-8"); + /// assert_eq!(path.as_os_str(), "foo"); + /// ``` + #[cfg(feature = "std")] + #[inline] + fn to_path(&self) -> Result<&Path, Utf8Error> { + self.to_os_str().map(Path::new) + } + + /// Lossily create a path slice from this byte string. + /// + /// On Unix, this always succeeds and is zero cost. On non-Unix systems, + /// this will perform a UTF-8 check and lossily convert this byte string + /// into valid UTF-8 using the Unicode replacement codepoint. + /// + /// Note that this can prevent the correct roundtripping of file paths on + /// non-Unix systems such as Windows, where file paths are an arbitrary + /// sequence of 16-bit integers. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let bs = b"foo\xFFbar"; + /// let path = bs.to_path_lossy(); + /// assert_eq!(path.to_string_lossy(), "foo\u{FFFD}bar"); + /// ``` + #[cfg(feature = "std")] + #[inline] + fn to_path_lossy(&self) -> Cow { + use std::path::PathBuf; + + match self.to_os_str_lossy() { + Cow::Borrowed(x) => Cow::Borrowed(Path::new(x)), + Cow::Owned(x) => Cow::Owned(PathBuf::from(x)), + } + } + + /// Create a new byte string by repeating this byte string `n` times. + /// + /// # Panics + /// + /// This function panics if the capacity of the new byte string would + /// overflow. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// assert_eq!(b"foo".repeatn(4), B("foofoofoofoo")); + /// assert_eq!(b"foo".repeatn(0), B("")); + /// ``` + #[cfg(feature = "std")] + #[inline] + fn repeatn(&self, n: usize) -> Vec { + let bs = self.as_bytes(); + let mut dst = vec![0; bs.len() * n]; + for i in 0..n { + dst[i * bs.len()..(i + 1) * bs.len()].copy_from_slice(bs); + } + dst + } + + /// Returns true if and only if this byte string contains the given needle. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// assert!(b"foo bar".contains_str("foo")); + /// assert!(b"foo bar".contains_str("bar")); + /// assert!(!b"foo".contains_str("foobar")); + /// ``` + #[inline] + fn contains_str>(&self, needle: B) -> bool { + self.find(needle).is_some() + } + + /// Returns true if and only if this byte string has the given prefix. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// assert!(b"foo bar".starts_with_str("foo")); + /// assert!(!b"foo bar".starts_with_str("bar")); + /// assert!(!b"foo".starts_with_str("foobar")); + /// ``` + #[inline] + fn starts_with_str>(&self, prefix: B) -> bool { + self.as_bytes().starts_with(prefix.as_ref()) + } + + /// Returns true if and only if this byte string has the given suffix. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// assert!(b"foo bar".ends_with_str("bar")); + /// assert!(!b"foo bar".ends_with_str("foo")); + /// assert!(!b"bar".ends_with_str("foobar")); + /// ``` + #[inline] + fn ends_with_str>(&self, suffix: B) -> bool { + self.as_bytes().ends_with(suffix.as_ref()) + } + + /// Returns the index of the first occurrence of the given needle. + /// + /// The needle may be any type that can be cheaply converted into a + /// `&[u8]`. This includes, but is not limited to, `&str` and `&[u8]`. + /// + /// Note that if you're are searching for the same needle in many + /// different small haystacks, it may be faster to initialize a + /// [`Finder`](struct.Finder.html) once, and reuse it for each search. + /// + /// # Complexity + /// + /// This routine is guaranteed to have worst case linear time complexity + /// with respect to both the needle and the haystack. That is, this runs + /// in `O(needle.len() + haystack.len())` time. + /// + /// This routine is also guaranteed to have worst case constant space + /// complexity. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let s = b"foo bar baz"; + /// assert_eq!(Some(0), s.find("foo")); + /// assert_eq!(Some(4), s.find("bar")); + /// assert_eq!(None, s.find("quux")); + /// ``` + #[inline] + fn find>(&self, needle: B) -> Option { + Finder::new(needle.as_ref()).find(self.as_bytes()) + } + + /// Returns the index of the last occurrence of the given needle. + /// + /// The needle may be any type that can be cheaply converted into a + /// `&[u8]`. This includes, but is not limited to, `&str` and `&[u8]`. + /// + /// Note that if you're are searching for the same needle in many + /// different small haystacks, it may be faster to initialize a + /// [`FinderReverse`](struct.FinderReverse.html) once, and reuse it for + /// each search. + /// + /// # Complexity + /// + /// This routine is guaranteed to have worst case linear time complexity + /// with respect to both the needle and the haystack. That is, this runs + /// in `O(needle.len() + haystack.len())` time. + /// + /// This routine is also guaranteed to have worst case constant space + /// complexity. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let s = b"foo bar baz"; + /// assert_eq!(Some(0), s.rfind("foo")); + /// assert_eq!(Some(4), s.rfind("bar")); + /// assert_eq!(Some(8), s.rfind("ba")); + /// assert_eq!(None, s.rfind("quux")); + /// ``` + #[inline] + fn rfind>(&self, needle: B) -> Option { + FinderReverse::new(needle.as_ref()).rfind(self.as_bytes()) + } + + /// Returns an iterator of the non-overlapping occurrences of the given + /// needle. The iterator yields byte offset positions indicating the start + /// of each match. + /// + /// # Complexity + /// + /// This routine is guaranteed to have worst case linear time complexity + /// with respect to both the needle and the haystack. That is, this runs + /// in `O(needle.len() + haystack.len())` time. + /// + /// This routine is also guaranteed to have worst case constant space + /// complexity. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let s = b"foo bar foo foo quux foo"; + /// let matches: Vec = s.find_iter("foo").collect(); + /// assert_eq!(matches, vec![0, 8, 12, 21]); + /// ``` + /// + /// An empty string matches at every position, including the position + /// immediately following the last byte: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let matches: Vec = b"foo".find_iter("").collect(); + /// assert_eq!(matches, vec![0, 1, 2, 3]); + /// + /// let matches: Vec = b"".find_iter("").collect(); + /// assert_eq!(matches, vec![0]); + /// ``` + #[inline] + fn find_iter<'a, B: ?Sized + AsRef<[u8]>>( + &'a self, + needle: &'a B, + ) -> Find<'a> { + Find::new(self.as_bytes(), needle.as_ref()) + } + + /// Returns an iterator of the non-overlapping occurrences of the given + /// needle in reverse. The iterator yields byte offset positions indicating + /// the start of each match. + /// + /// # Complexity + /// + /// This routine is guaranteed to have worst case linear time complexity + /// with respect to both the needle and the haystack. That is, this runs + /// in `O(needle.len() + haystack.len())` time. + /// + /// This routine is also guaranteed to have worst case constant space + /// complexity. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let s = b"foo bar foo foo quux foo"; + /// let matches: Vec = s.rfind_iter("foo").collect(); + /// assert_eq!(matches, vec![21, 12, 8, 0]); + /// ``` + /// + /// An empty string matches at every position, including the position + /// immediately following the last byte: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let matches: Vec = b"foo".rfind_iter("").collect(); + /// assert_eq!(matches, vec![3, 2, 1, 0]); + /// + /// let matches: Vec = b"".rfind_iter("").collect(); + /// assert_eq!(matches, vec![0]); + /// ``` + #[inline] + fn rfind_iter<'a, B: ?Sized + AsRef<[u8]>>( + &'a self, + needle: &'a B, + ) -> FindReverse<'a> { + FindReverse::new(self.as_bytes(), needle.as_ref()) + } + + /// Returns the index of the first occurrence of the given byte. If the + /// byte does not occur in this byte string, then `None` is returned. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// assert_eq!(Some(10), b"foo bar baz".find_byte(b'z')); + /// assert_eq!(None, b"foo bar baz".find_byte(b'y')); + /// ``` + #[inline] + fn find_byte(&self, byte: u8) -> Option { + memchr(byte, self.as_bytes()) + } + + /// Returns the index of the last occurrence of the given byte. If the + /// byte does not occur in this byte string, then `None` is returned. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// assert_eq!(Some(10), b"foo bar baz".rfind_byte(b'z')); + /// assert_eq!(None, b"foo bar baz".rfind_byte(b'y')); + /// ``` + #[inline] + fn rfind_byte(&self, byte: u8) -> Option { + memrchr(byte, self.as_bytes()) + } + + /// Returns the index of the first occurrence of the given codepoint. + /// If the codepoint does not occur in this byte string, then `None` is + /// returned. + /// + /// Note that if one searches for the replacement codepoint, `\u{FFFD}`, + /// then only explicit occurrences of that encoding will be found. Invalid + /// UTF-8 sequences will not be matched. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// assert_eq!(Some(10), b"foo bar baz".find_char('z')); + /// assert_eq!(Some(4), B("αβγγδ").find_char('γ')); + /// assert_eq!(None, b"foo bar baz".find_char('y')); + /// ``` + #[inline] + fn find_char(&self, ch: char) -> Option { + self.find(ch.encode_utf8(&mut [0; 4])) + } + + /// Returns the index of the last occurrence of the given codepoint. + /// If the codepoint does not occur in this byte string, then `None` is + /// returned. + /// + /// Note that if one searches for the replacement codepoint, `\u{FFFD}`, + /// then only explicit occurrences of that encoding will be found. Invalid + /// UTF-8 sequences will not be matched. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// assert_eq!(Some(10), b"foo bar baz".rfind_char('z')); + /// assert_eq!(Some(6), B("αβγγδ").rfind_char('γ')); + /// assert_eq!(None, b"foo bar baz".rfind_char('y')); + /// ``` + #[inline] + fn rfind_char(&self, ch: char) -> Option { + self.rfind(ch.encode_utf8(&mut [0; 4])) + } + + /// Returns an iterator over the fields in a byte string, separated by + /// contiguous whitespace. + /// + /// # Example + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B(" foo\tbar\t\u{2003}\nquux \n"); + /// let fields: Vec<&[u8]> = s.fields().collect(); + /// assert_eq!(fields, vec![B("foo"), B("bar"), B("quux")]); + /// ``` + /// + /// A byte string consisting of just whitespace yields no elements: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// assert_eq!(0, B(" \n\t\u{2003}\n \t").fields().count()); + /// ``` + #[inline] + fn fields(&self) -> Fields { + Fields::new(self.as_bytes()) + } + + /// Returns an iterator over the fields in a byte string, separated by + /// contiguous codepoints satisfying the given predicate. + /// + /// If this byte + /// + /// # Example + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = b"123foo999999bar1quux123456"; + /// let fields: Vec<&[u8]> = s.fields_with(|c| c.is_numeric()).collect(); + /// assert_eq!(fields, vec![B("foo"), B("bar"), B("quux")]); + /// ``` + /// + /// A byte string consisting of all codepoints satisfying the predicate + /// yields no elements: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// assert_eq!(0, b"1911354563".fields_with(|c| c.is_numeric()).count()); + /// ``` + #[inline] + fn fields_with bool>(&self, f: F) -> FieldsWith { + FieldsWith::new(self.as_bytes(), f) + } + + /// Returns an iterator over substrings of this byte string, separated + /// by the given byte string. Each element yielded is guaranteed not to + /// include the splitter substring. + /// + /// The splitter may be any type that can be cheaply converted into a + /// `&[u8]`. This includes, but is not limited to, `&str` and `&[u8]`. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let x: Vec<&[u8]> = b"Mary had a little lamb".split_str(" ").collect(); + /// assert_eq!(x, vec![ + /// B("Mary"), B("had"), B("a"), B("little"), B("lamb"), + /// ]); + /// + /// let x: Vec<&[u8]> = b"".split_str("X").collect(); + /// assert_eq!(x, vec![b""]); + /// + /// let x: Vec<&[u8]> = b"lionXXtigerXleopard".split_str("X").collect(); + /// assert_eq!(x, vec![B("lion"), B(""), B("tiger"), B("leopard")]); + /// + /// let x: Vec<&[u8]> = b"lion::tiger::leopard".split_str("::").collect(); + /// assert_eq!(x, vec![B("lion"), B("tiger"), B("leopard")]); + /// ``` + /// + /// If a string contains multiple contiguous separators, you will end up + /// with empty strings yielded by the iterator: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let x: Vec<&[u8]> = b"||||a||b|c".split_str("|").collect(); + /// assert_eq!(x, vec![ + /// B(""), B(""), B(""), B(""), B("a"), B(""), B("b"), B("c"), + /// ]); + /// + /// let x: Vec<&[u8]> = b"(///)".split_str("/").collect(); + /// assert_eq!(x, vec![B("("), B(""), B(""), B(")")]); + /// ``` + /// + /// Separators at the start or end of a string are neighbored by empty + /// strings. + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let x: Vec<&[u8]> = b"010".split_str("0").collect(); + /// assert_eq!(x, vec![B(""), B("1"), B("")]); + /// ``` + /// + /// When the empty string is used as a separator, it splits every **byte** + /// in the byte string, along with the beginning and end of the byte + /// string. + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let x: Vec<&[u8]> = b"rust".split_str("").collect(); + /// assert_eq!(x, vec![ + /// B(""), B("r"), B("u"), B("s"), B("t"), B(""), + /// ]); + /// + /// // Splitting by an empty string is not UTF-8 aware. Elements yielded + /// // may not be valid UTF-8! + /// let x: Vec<&[u8]> = B("☃").split_str("").collect(); + /// assert_eq!(x, vec![ + /// B(""), B(b"\xE2"), B(b"\x98"), B(b"\x83"), B(""), + /// ]); + /// ``` + /// + /// Contiguous separators, especially whitespace, can lead to possibly + /// surprising behavior. For example, this code is correct: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let x: Vec<&[u8]> = b" a b c".split_str(" ").collect(); + /// assert_eq!(x, vec![ + /// B(""), B(""), B(""), B(""), B("a"), B(""), B("b"), B("c"), + /// ]); + /// ``` + /// + /// It does *not* give you `["a", "b", "c"]`. For that behavior, use + /// [`fields`](#method.fields) instead. + #[inline] + fn split_str<'a, B: ?Sized + AsRef<[u8]>>( + &'a self, + splitter: &'a B, + ) -> Split<'a> { + Split::new(self.as_bytes(), splitter.as_ref()) + } + + /// Returns an iterator over substrings of this byte string, separated by + /// the given byte string, in reverse. Each element yielded is guaranteed + /// not to include the splitter substring. + /// + /// The splitter may be any type that can be cheaply converted into a + /// `&[u8]`. This includes, but is not limited to, `&str` and `&[u8]`. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let x: Vec<&[u8]> = + /// b"Mary had a little lamb".rsplit_str(" ").collect(); + /// assert_eq!(x, vec![ + /// B("lamb"), B("little"), B("a"), B("had"), B("Mary"), + /// ]); + /// + /// let x: Vec<&[u8]> = b"".rsplit_str("X").collect(); + /// assert_eq!(x, vec![b""]); + /// + /// let x: Vec<&[u8]> = b"lionXXtigerXleopard".rsplit_str("X").collect(); + /// assert_eq!(x, vec![B("leopard"), B("tiger"), B(""), B("lion")]); + /// + /// let x: Vec<&[u8]> = b"lion::tiger::leopard".rsplit_str("::").collect(); + /// assert_eq!(x, vec![B("leopard"), B("tiger"), B("lion")]); + /// ``` + /// + /// If a string contains multiple contiguous separators, you will end up + /// with empty strings yielded by the iterator: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let x: Vec<&[u8]> = b"||||a||b|c".rsplit_str("|").collect(); + /// assert_eq!(x, vec![ + /// B("c"), B("b"), B(""), B("a"), B(""), B(""), B(""), B(""), + /// ]); + /// + /// let x: Vec<&[u8]> = b"(///)".rsplit_str("/").collect(); + /// assert_eq!(x, vec![B(")"), B(""), B(""), B("(")]); + /// ``` + /// + /// Separators at the start or end of a string are neighbored by empty + /// strings. + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let x: Vec<&[u8]> = b"010".rsplit_str("0").collect(); + /// assert_eq!(x, vec![B(""), B("1"), B("")]); + /// ``` + /// + /// When the empty string is used as a separator, it splits every **byte** + /// in the byte string, along with the beginning and end of the byte + /// string. + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let x: Vec<&[u8]> = b"rust".rsplit_str("").collect(); + /// assert_eq!(x, vec![ + /// B(""), B("t"), B("s"), B("u"), B("r"), B(""), + /// ]); + /// + /// // Splitting by an empty string is not UTF-8 aware. Elements yielded + /// // may not be valid UTF-8! + /// let x: Vec<&[u8]> = B("☃").rsplit_str("").collect(); + /// assert_eq!(x, vec![B(""), B(b"\x83"), B(b"\x98"), B(b"\xE2"), B("")]); + /// ``` + /// + /// Contiguous separators, especially whitespace, can lead to possibly + /// surprising behavior. For example, this code is correct: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let x: Vec<&[u8]> = b" a b c".rsplit_str(" ").collect(); + /// assert_eq!(x, vec![ + /// B("c"), B("b"), B(""), B("a"), B(""), B(""), B(""), B(""), + /// ]); + /// ``` + /// + /// It does *not* give you `["a", "b", "c"]`. + #[inline] + fn rsplit_str<'a, B: ?Sized + AsRef<[u8]>>( + &'a self, + splitter: &'a B, + ) -> SplitReverse<'a> { + SplitReverse::new(self.as_bytes(), splitter.as_ref()) + } + + /// Returns an iterator of at most `limit` substrings of this byte string, + /// separated by the given byte string. If `limit` substrings are yielded, + /// then the last substring will contain the remainder of this byte string. + /// + /// The needle may be any type that can be cheaply converted into a + /// `&[u8]`. This includes, but is not limited to, `&str` and `&[u8]`. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let x: Vec<_> = b"Mary had a little lamb".splitn_str(3, " ").collect(); + /// assert_eq!(x, vec![B("Mary"), B("had"), B("a little lamb")]); + /// + /// let x: Vec<_> = b"".splitn_str(3, "X").collect(); + /// assert_eq!(x, vec![b""]); + /// + /// let x: Vec<_> = b"lionXXtigerXleopard".splitn_str(3, "X").collect(); + /// assert_eq!(x, vec![B("lion"), B(""), B("tigerXleopard")]); + /// + /// let x: Vec<_> = b"lion::tiger::leopard".splitn_str(2, "::").collect(); + /// assert_eq!(x, vec![B("lion"), B("tiger::leopard")]); + /// + /// let x: Vec<_> = b"abcXdef".splitn_str(1, "X").collect(); + /// assert_eq!(x, vec![B("abcXdef")]); + /// + /// let x: Vec<_> = b"abcXdef".splitn_str(0, "X").collect(); + /// assert!(x.is_empty()); + /// ``` + #[inline] + fn splitn_str<'a, B: ?Sized + AsRef<[u8]>>( + &'a self, + limit: usize, + splitter: &'a B, + ) -> SplitN<'a> { + SplitN::new(self.as_bytes(), splitter.as_ref(), limit) + } + + /// Returns an iterator of at most `limit` substrings of this byte string, + /// separated by the given byte string, in reverse. If `limit` substrings + /// are yielded, then the last substring will contain the remainder of this + /// byte string. + /// + /// The needle may be any type that can be cheaply converted into a + /// `&[u8]`. This includes, but is not limited to, `&str` and `&[u8]`. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let x: Vec<_> = + /// b"Mary had a little lamb".rsplitn_str(3, " ").collect(); + /// assert_eq!(x, vec![B("lamb"), B("little"), B("Mary had a")]); + /// + /// let x: Vec<_> = b"".rsplitn_str(3, "X").collect(); + /// assert_eq!(x, vec![b""]); + /// + /// let x: Vec<_> = b"lionXXtigerXleopard".rsplitn_str(3, "X").collect(); + /// assert_eq!(x, vec![B("leopard"), B("tiger"), B("lionX")]); + /// + /// let x: Vec<_> = b"lion::tiger::leopard".rsplitn_str(2, "::").collect(); + /// assert_eq!(x, vec![B("leopard"), B("lion::tiger")]); + /// + /// let x: Vec<_> = b"abcXdef".rsplitn_str(1, "X").collect(); + /// assert_eq!(x, vec![B("abcXdef")]); + /// + /// let x: Vec<_> = b"abcXdef".rsplitn_str(0, "X").collect(); + /// assert!(x.is_empty()); + /// ``` + #[inline] + fn rsplitn_str<'a, B: ?Sized + AsRef<[u8]>>( + &'a self, + limit: usize, + splitter: &'a B, + ) -> SplitNReverse<'a> { + SplitNReverse::new(self.as_bytes(), splitter.as_ref(), limit) + } + + /// Replace all matches of the given needle with the given replacement, and + /// the result as a new `Vec`. + /// + /// This routine is useful as a convenience. If you need to reuse an + /// allocation, use [`replace_into`](#method.replace_into) instead. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let s = b"this is old".replace("old", "new"); + /// assert_eq!(s, "this is new".as_bytes()); + /// ``` + /// + /// When the pattern doesn't match: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let s = b"this is old".replace("nada nada", "limonada"); + /// assert_eq!(s, "this is old".as_bytes()); + /// ``` + /// + /// When the needle is an empty string: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let s = b"foo".replace("", "Z"); + /// assert_eq!(s, "ZfZoZoZ".as_bytes()); + /// ``` + #[cfg(feature = "std")] + #[inline] + fn replace, R: AsRef<[u8]>>( + &self, + needle: N, + replacement: R, + ) -> Vec { + let mut dest = Vec::with_capacity(self.as_bytes().len()); + self.replace_into(needle, replacement, &mut dest); + dest + } + + /// Replace up to `limit` matches of the given needle with the given + /// replacement, and the result as a new `Vec`. + /// + /// This routine is useful as a convenience. If you need to reuse an + /// allocation, use [`replacen_into`](#method.replacen_into) instead. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let s = b"foofoo".replacen("o", "z", 2); + /// assert_eq!(s, "fzzfoo".as_bytes()); + /// ``` + /// + /// When the pattern doesn't match: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let s = b"foofoo".replacen("a", "z", 2); + /// assert_eq!(s, "foofoo".as_bytes()); + /// ``` + /// + /// When the needle is an empty string: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let s = b"foo".replacen("", "Z", 2); + /// assert_eq!(s, "ZfZoo".as_bytes()); + /// ``` + #[cfg(feature = "std")] + #[inline] + fn replacen, R: AsRef<[u8]>>( + &self, + needle: N, + replacement: R, + limit: usize, + ) -> Vec { + let mut dest = Vec::with_capacity(self.as_bytes().len()); + self.replacen_into(needle, replacement, limit, &mut dest); + dest + } + + /// Replace all matches of the given needle with the given replacement, + /// and write the result into the provided `Vec`. + /// + /// This does **not** clear `dest` before writing to it. + /// + /// This routine is useful for reusing allocation. For a more convenient + /// API, use [`replace`](#method.replace) instead. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let s = b"this is old"; + /// + /// let mut dest = vec![]; + /// s.replace_into("old", "new", &mut dest); + /// assert_eq!(dest, "this is new".as_bytes()); + /// ``` + /// + /// When the pattern doesn't match: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let s = b"this is old"; + /// + /// let mut dest = vec![]; + /// s.replace_into("nada nada", "limonada", &mut dest); + /// assert_eq!(dest, "this is old".as_bytes()); + /// ``` + /// + /// When the needle is an empty string: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let s = b"foo"; + /// + /// let mut dest = vec![]; + /// s.replace_into("", "Z", &mut dest); + /// assert_eq!(dest, "ZfZoZoZ".as_bytes()); + /// ``` + #[cfg(feature = "std")] + #[inline] + fn replace_into, R: AsRef<[u8]>>( + &self, + needle: N, + replacement: R, + dest: &mut Vec, + ) { + let (needle, replacement) = (needle.as_ref(), replacement.as_ref()); + + let mut last = 0; + for start in self.find_iter(needle) { + dest.push_str(&self.as_bytes()[last..start]); + dest.push_str(replacement); + last = start + needle.len(); + } + dest.push_str(&self.as_bytes()[last..]); + } + + /// Replace up to `limit` matches of the given needle with the given + /// replacement, and write the result into the provided `Vec`. + /// + /// This does **not** clear `dest` before writing to it. + /// + /// This routine is useful for reusing allocation. For a more convenient + /// API, use [`replacen`](#method.replacen) instead. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let s = b"foofoo"; + /// + /// let mut dest = vec![]; + /// s.replacen_into("o", "z", 2, &mut dest); + /// assert_eq!(dest, "fzzfoo".as_bytes()); + /// ``` + /// + /// When the pattern doesn't match: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let s = b"foofoo"; + /// + /// let mut dest = vec![]; + /// s.replacen_into("a", "z", 2, &mut dest); + /// assert_eq!(dest, "foofoo".as_bytes()); + /// ``` + /// + /// When the needle is an empty string: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let s = b"foo"; + /// + /// let mut dest = vec![]; + /// s.replacen_into("", "Z", 2, &mut dest); + /// assert_eq!(dest, "ZfZoo".as_bytes()); + /// ``` + #[cfg(feature = "std")] + #[inline] + fn replacen_into, R: AsRef<[u8]>>( + &self, + needle: N, + replacement: R, + limit: usize, + dest: &mut Vec, + ) { + let (needle, replacement) = (needle.as_ref(), replacement.as_ref()); + + let mut last = 0; + for start in self.find_iter(needle).take(limit) { + dest.push_str(&self.as_bytes()[last..start]); + dest.push_str(replacement); + last = start + needle.len(); + } + dest.push_str(&self.as_bytes()[last..]); + } + + /// Returns an iterator over the bytes in this byte string. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let bs = b"foobar"; + /// let bytes: Vec = bs.bytes().collect(); + /// assert_eq!(bytes, bs); + /// ``` + #[inline] + fn bytes(&self) -> Bytes { + Bytes { it: self.as_bytes().iter() } + } + + /// Returns an iterator over the Unicode scalar values in this byte string. + /// If invalid UTF-8 is encountered, then the Unicode replacement codepoint + /// is yielded instead. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let bs = b"\xE2\x98\x83\xFF\xF0\x9D\x9E\x83\xE2\x98\x61"; + /// let chars: Vec = bs.chars().collect(); + /// assert_eq!(vec!['☃', '\u{FFFD}', '𝞃', '\u{FFFD}', 'a'], chars); + /// ``` + /// + /// Codepoints can also be iterated over in reverse: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let bs = b"\xE2\x98\x83\xFF\xF0\x9D\x9E\x83\xE2\x98\x61"; + /// let chars: Vec = bs.chars().rev().collect(); + /// assert_eq!(vec!['a', '\u{FFFD}', '𝞃', '\u{FFFD}', '☃'], chars); + /// ``` + #[inline] + fn chars(&self) -> Chars { + Chars::new(self.as_bytes()) + } + + /// Returns an iterator over the Unicode scalar values in this byte string + /// along with their starting and ending byte index positions. If invalid + /// UTF-8 is encountered, then the Unicode replacement codepoint is yielded + /// instead. + /// + /// Note that this is slightly different from the `CharIndices` iterator + /// provided by the standard library. Aside from working on possibly + /// invalid UTF-8, this iterator provides both the corresponding starting + /// and ending byte indices of each codepoint yielded. The ending position + /// is necessary to slice the original byte string when invalid UTF-8 bytes + /// are converted into a Unicode replacement codepoint, since a single + /// replacement codepoint can substitute anywhere from 1 to 3 invalid bytes + /// (inclusive). + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let bs = b"\xE2\x98\x83\xFF\xF0\x9D\x9E\x83\xE2\x98\x61"; + /// let chars: Vec<(usize, usize, char)> = bs.char_indices().collect(); + /// assert_eq!(chars, vec![ + /// (0, 3, '☃'), + /// (3, 4, '\u{FFFD}'), + /// (4, 8, '𝞃'), + /// (8, 10, '\u{FFFD}'), + /// (10, 11, 'a'), + /// ]); + /// ``` + /// + /// Codepoints can also be iterated over in reverse: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let bs = b"\xE2\x98\x83\xFF\xF0\x9D\x9E\x83\xE2\x98\x61"; + /// let chars: Vec<(usize, usize, char)> = bs + /// .char_indices() + /// .rev() + /// .collect(); + /// assert_eq!(chars, vec![ + /// (10, 11, 'a'), + /// (8, 10, '\u{FFFD}'), + /// (4, 8, '𝞃'), + /// (3, 4, '\u{FFFD}'), + /// (0, 3, '☃'), + /// ]); + /// ``` + #[inline] + fn char_indices(&self) -> CharIndices { + CharIndices::new(self.as_bytes()) + } + + /// Returns an iterator over the grapheme clusters in this byte string. + /// If invalid UTF-8 is encountered, then the Unicode replacement codepoint + /// is yielded instead. + /// + /// # Examples + /// + /// This example shows how multiple codepoints can combine to form a + /// single grapheme cluster: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let bs = "a\u{0300}\u{0316}\u{1F1FA}\u{1F1F8}".as_bytes(); + /// let graphemes: Vec<&str> = bs.graphemes().collect(); + /// assert_eq!(vec!["à̖", "🇺🇸"], graphemes); + /// ``` + /// + /// This shows that graphemes can be iterated over in reverse: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let bs = "a\u{0300}\u{0316}\u{1F1FA}\u{1F1F8}".as_bytes(); + /// let graphemes: Vec<&str> = bs.graphemes().rev().collect(); + /// assert_eq!(vec!["🇺🇸", "à̖"], graphemes); + /// ``` + #[cfg(feature = "unicode")] + #[inline] + fn graphemes(&self) -> Graphemes { + Graphemes::new(self.as_bytes()) + } + + /// Returns an iterator over the grapheme clusters in this byte string + /// along with their starting and ending byte index positions. If invalid + /// UTF-8 is encountered, then the Unicode replacement codepoint is yielded + /// instead. + /// + /// # Examples + /// + /// This example shows how to get the byte offsets of each individual + /// grapheme cluster: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let bs = "a\u{0300}\u{0316}\u{1F1FA}\u{1F1F8}".as_bytes(); + /// let graphemes: Vec<(usize, usize, &str)> = + /// bs.grapheme_indices().collect(); + /// assert_eq!(vec![(0, 5, "à̖"), (5, 13, "🇺🇸")], graphemes); + /// ``` + /// + /// This example shows what happens when invalid UTF-8 is enountered. Note + /// that the offsets are valid indices into the original string, and do + /// not necessarily correspond to the length of the `&str` returned! + /// + /// ``` + /// use bstr::{ByteSlice, ByteVec}; + /// + /// let mut bytes = vec![]; + /// bytes.push_str("a\u{0300}\u{0316}"); + /// bytes.push(b'\xFF'); + /// bytes.push_str("\u{1F1FA}\u{1F1F8}"); + /// + /// let graphemes: Vec<(usize, usize, &str)> = + /// bytes.grapheme_indices().collect(); + /// assert_eq!( + /// graphemes, + /// vec![(0, 5, "à̖"), (5, 6, "\u{FFFD}"), (6, 14, "🇺🇸")] + /// ); + /// ``` + #[cfg(feature = "unicode")] + #[inline] + fn grapheme_indices(&self) -> GraphemeIndices { + GraphemeIndices::new(self.as_bytes()) + } + + /// Returns an iterator over the words in this byte string. If invalid + /// UTF-8 is encountered, then the Unicode replacement codepoint is yielded + /// instead. + /// + /// This is similar to + /// [`words_with_breaks`](trait.ByteSlice.html#method.words_with_breaks), + /// except it only returns elements that contain a "word" character. A word + /// character is defined by UTS #18 (Annex C) to be the combination of the + /// `Alphabetic` and `Join_Control` properties, along with the + /// `Decimal_Number`, `Mark` and `Connector_Punctuation` general + /// categories. + /// + /// Since words are made up of one or more codepoints, this iterator + /// yields `&str` elements. When invalid UTF-8 is encountered, replacement + /// codepoints are [substituted](index.html#handling-of-invalid-utf-8). + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let bs = br#"The quick ("brown") fox can't jump 32.3 feet, right?"#; + /// let words: Vec<&str> = bs.words().collect(); + /// assert_eq!(words, vec![ + /// "The", "quick", "brown", "fox", "can't", + /// "jump", "32.3", "feet", "right", + /// ]); + /// ``` + #[cfg(feature = "unicode")] + #[inline] + fn words(&self) -> Words { + Words::new(self.as_bytes()) + } + + /// Returns an iterator over the words in this byte string along with + /// their starting and ending byte index positions. + /// + /// This is similar to + /// [`words_with_break_indices`](trait.ByteSlice.html#method.words_with_break_indices), + /// except it only returns elements that contain a "word" character. A word + /// character is defined by UTS #18 (Annex C) to be the combination of the + /// `Alphabetic` and `Join_Control` properties, along with the + /// `Decimal_Number`, `Mark` and `Connector_Punctuation` general + /// categories. + /// + /// Since words are made up of one or more codepoints, this iterator + /// yields `&str` elements. When invalid UTF-8 is encountered, replacement + /// codepoints are [substituted](index.html#handling-of-invalid-utf-8). + /// + /// # Examples + /// + /// This example shows how to get the byte offsets of each individual + /// word: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let bs = b"can't jump 32.3 feet"; + /// let words: Vec<(usize, usize, &str)> = bs.word_indices().collect(); + /// assert_eq!(words, vec![ + /// (0, 5, "can't"), + /// (6, 10, "jump"), + /// (11, 15, "32.3"), + /// (16, 20, "feet"), + /// ]); + /// ``` + #[cfg(feature = "unicode")] + #[inline] + fn word_indices(&self) -> WordIndices { + WordIndices::new(self.as_bytes()) + } + + /// Returns an iterator over the words in this byte string, along with + /// all breaks between the words. Concatenating all elements yielded by + /// the iterator results in the original string (modulo Unicode replacement + /// codepoint substitutions if invalid UTF-8 is encountered). + /// + /// Since words are made up of one or more codepoints, this iterator + /// yields `&str` elements. When invalid UTF-8 is encountered, replacement + /// codepoints are [substituted](index.html#handling-of-invalid-utf-8). + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let bs = br#"The quick ("brown") fox can't jump 32.3 feet, right?"#; + /// let words: Vec<&str> = bs.words_with_breaks().collect(); + /// assert_eq!(words, vec![ + /// "The", " ", "quick", " ", "(", "\"", "brown", "\"", ")", + /// " ", "fox", " ", "can't", " ", "jump", " ", "32.3", " ", "feet", + /// ",", " ", "right", "?", + /// ]); + /// ``` + #[cfg(feature = "unicode")] + #[inline] + fn words_with_breaks(&self) -> WordsWithBreaks { + WordsWithBreaks::new(self.as_bytes()) + } + + /// Returns an iterator over the words and their byte offsets in this + /// byte string, along with all breaks between the words. Concatenating + /// all elements yielded by the iterator results in the original string + /// (modulo Unicode replacement codepoint substitutions if invalid UTF-8 is + /// encountered). + /// + /// Since words are made up of one or more codepoints, this iterator + /// yields `&str` elements. When invalid UTF-8 is encountered, replacement + /// codepoints are [substituted](index.html#handling-of-invalid-utf-8). + /// + /// # Examples + /// + /// This example shows how to get the byte offsets of each individual + /// word: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let bs = b"can't jump 32.3 feet"; + /// let words: Vec<(usize, usize, &str)> = + /// bs.words_with_break_indices().collect(); + /// assert_eq!(words, vec![ + /// (0, 5, "can't"), + /// (5, 6, " "), + /// (6, 10, "jump"), + /// (10, 11, " "), + /// (11, 15, "32.3"), + /// (15, 16, " "), + /// (16, 20, "feet"), + /// ]); + /// ``` + #[cfg(feature = "unicode")] + #[inline] + fn words_with_break_indices(&self) -> WordsWithBreakIndices { + WordsWithBreakIndices::new(self.as_bytes()) + } + + /// Returns an iterator over the sentences in this byte string. + /// + /// Typically, a sentence will include its trailing punctuation and + /// whitespace. Concatenating all elements yielded by the iterator + /// results in the original string (modulo Unicode replacement codepoint + /// substitutions if invalid UTF-8 is encountered). + /// + /// Since sentences are made up of one or more codepoints, this iterator + /// yields `&str` elements. When invalid UTF-8 is encountered, replacement + /// codepoints are [substituted](index.html#handling-of-invalid-utf-8). + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let bs = b"I want this. Not that. Right now."; + /// let sentences: Vec<&str> = bs.sentences().collect(); + /// assert_eq!(sentences, vec![ + /// "I want this. ", + /// "Not that. ", + /// "Right now.", + /// ]); + /// ``` + #[cfg(feature = "unicode")] + #[inline] + fn sentences(&self) -> Sentences { + Sentences::new(self.as_bytes()) + } + + /// Returns an iterator over the sentences in this byte string along with + /// their starting and ending byte index positions. + /// + /// Typically, a sentence will include its trailing punctuation and + /// whitespace. Concatenating all elements yielded by the iterator + /// results in the original string (modulo Unicode replacement codepoint + /// substitutions if invalid UTF-8 is encountered). + /// + /// Since sentences are made up of one or more codepoints, this iterator + /// yields `&str` elements. When invalid UTF-8 is encountered, replacement + /// codepoints are [substituted](index.html#handling-of-invalid-utf-8). + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let bs = b"I want this. Not that. Right now."; + /// let sentences: Vec<(usize, usize, &str)> = + /// bs.sentence_indices().collect(); + /// assert_eq!(sentences, vec![ + /// (0, 13, "I want this. "), + /// (13, 23, "Not that. "), + /// (23, 33, "Right now."), + /// ]); + /// ``` + #[cfg(feature = "unicode")] + #[inline] + fn sentence_indices(&self) -> SentenceIndices { + SentenceIndices::new(self.as_bytes()) + } + + /// An iterator over all lines in a byte string, without their + /// terminators. + /// + /// For this iterator, the only line terminators recognized are `\r\n` and + /// `\n`. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = b"\ + /// foo + /// + /// bar\r + /// baz + /// + /// + /// quux"; + /// let lines: Vec<&[u8]> = s.lines().collect(); + /// assert_eq!(lines, vec![ + /// B("foo"), B(""), B("bar"), B("baz"), B(""), B(""), B("quux"), + /// ]); + /// ``` + #[inline] + fn lines(&self) -> Lines { + Lines::new(self.as_bytes()) + } + + /// An iterator over all lines in a byte string, including their + /// terminators. + /// + /// For this iterator, the only line terminator recognized is `\n`. (Since + /// line terminators are included, this also handles `\r\n` line endings.) + /// + /// Line terminators are only included if they are present in the original + /// byte string. For example, the last line in a byte string may not end + /// with a line terminator. + /// + /// Concatenating all elements yielded by this iterator is guaranteed to + /// yield the original byte string. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = b"\ + /// foo + /// + /// bar\r + /// baz + /// + /// + /// quux"; + /// let lines: Vec<&[u8]> = s.lines_with_terminator().collect(); + /// assert_eq!(lines, vec![ + /// B("foo\n"), + /// B("\n"), + /// B("bar\r\n"), + /// B("baz\n"), + /// B("\n"), + /// B("\n"), + /// B("quux"), + /// ]); + /// ``` + #[inline] + fn lines_with_terminator(&self) -> LinesWithTerminator { + LinesWithTerminator::new(self.as_bytes()) + } + + /// Return a byte string slice with leading and trailing whitespace + /// removed. + /// + /// Whitespace is defined according to the terms of the `White_Space` + /// Unicode property. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B(" foo\tbar\t\u{2003}\n"); + /// assert_eq!(s.trim(), B("foo\tbar")); + /// ``` + #[cfg(feature = "unicode")] + #[inline] + fn trim(&self) -> &[u8] { + self.trim_start().trim_end() + } + + /// Return a byte string slice with leading whitespace removed. + /// + /// Whitespace is defined according to the terms of the `White_Space` + /// Unicode property. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B(" foo\tbar\t\u{2003}\n"); + /// assert_eq!(s.trim_start(), B("foo\tbar\t\u{2003}\n")); + /// ``` + #[cfg(feature = "unicode")] + #[inline] + fn trim_start(&self) -> &[u8] { + let start = whitespace_len_fwd(self.as_bytes()); + &self.as_bytes()[start..] + } + + /// Return a byte string slice with trailing whitespace removed. + /// + /// Whitespace is defined according to the terms of the `White_Space` + /// Unicode property. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B(" foo\tbar\t\u{2003}\n"); + /// assert_eq!(s.trim_end(), B(" foo\tbar")); + /// ``` + #[cfg(feature = "unicode")] + #[inline] + fn trim_end(&self) -> &[u8] { + let end = whitespace_len_rev(self.as_bytes()); + &self.as_bytes()[..end] + } + + /// Return a byte string slice with leading and trailing characters + /// satisfying the given predicate removed. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = b"123foo5bar789"; + /// assert_eq!(s.trim_with(|c| c.is_numeric()), B("foo5bar")); + /// ``` + #[inline] + fn trim_with bool>(&self, mut trim: F) -> &[u8] { + self.trim_start_with(&mut trim).trim_end_with(&mut trim) + } + + /// Return a byte string slice with leading characters satisfying the given + /// predicate removed. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = b"123foo5bar789"; + /// assert_eq!(s.trim_start_with(|c| c.is_numeric()), B("foo5bar789")); + /// ``` + #[inline] + fn trim_start_with bool>(&self, mut trim: F) -> &[u8] { + for (s, _, ch) in self.char_indices() { + if !trim(ch) { + return &self.as_bytes()[s..]; + } + } + b"" + } + + /// Return a byte string slice with trailing characters satisfying the + /// given predicate removed. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = b"123foo5bar"; + /// assert_eq!(s.trim_end_with(|c| c.is_numeric()), B("123foo5bar")); + /// ``` + #[inline] + fn trim_end_with bool>(&self, mut trim: F) -> &[u8] { + for (_, e, ch) in self.char_indices().rev() { + if !trim(ch) { + return &self.as_bytes()[..e]; + } + } + b"" + } + + /// Returns a new `Vec` containing the lowercase equivalent of this + /// byte string. + /// + /// In this case, lowercase is defined according to the `Lowercase` Unicode + /// property. + /// + /// If invalid UTF-8 is seen, or if a character has no lowercase variant, + /// then it is written to the given buffer unchanged. + /// + /// Note that some characters in this byte string may expand into multiple + /// characters when changing the case, so the number of bytes written to + /// the given byte string may not be equivalent to the number of bytes in + /// this byte string. + /// + /// If you'd like to reuse an allocation for performance reasons, then use + /// [`to_lowercase_into`](#method.to_lowercase_into) instead. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B("HELLO Β"); + /// assert_eq!("hello β".as_bytes(), s.to_lowercase().as_bytes()); + /// ``` + /// + /// Scripts without case are not changed: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B("农历新年"); + /// assert_eq!("农历新年".as_bytes(), s.to_lowercase().as_bytes()); + /// ``` + /// + /// Invalid UTF-8 remains as is: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B(b"FOO\xFFBAR\xE2\x98BAZ"); + /// assert_eq!(B(b"foo\xFFbar\xE2\x98baz"), s.to_lowercase().as_bytes()); + /// ``` + #[cfg(all(feature = "std", feature = "unicode"))] + #[inline] + fn to_lowercase(&self) -> Vec { + let mut buf = vec![]; + self.to_lowercase_into(&mut buf); + buf + } + + /// Writes the lowercase equivalent of this byte string into the given + /// buffer. The buffer is not cleared before written to. + /// + /// In this case, lowercase is defined according to the `Lowercase` + /// Unicode property. + /// + /// If invalid UTF-8 is seen, or if a character has no lowercase variant, + /// then it is written to the given buffer unchanged. + /// + /// Note that some characters in this byte string may expand into multiple + /// characters when changing the case, so the number of bytes written to + /// the given byte string may not be equivalent to the number of bytes in + /// this byte string. + /// + /// If you don't need to amortize allocation and instead prefer + /// convenience, then use [`to_lowercase`](#method.to_lowercase) instead. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B("HELLO Β"); + /// + /// let mut buf = vec![]; + /// s.to_lowercase_into(&mut buf); + /// assert_eq!("hello β".as_bytes(), buf.as_bytes()); + /// ``` + /// + /// Scripts without case are not changed: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B("农历新年"); + /// + /// let mut buf = vec![]; + /// s.to_lowercase_into(&mut buf); + /// assert_eq!("农历新年".as_bytes(), buf.as_bytes()); + /// ``` + /// + /// Invalid UTF-8 remains as is: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B(b"FOO\xFFBAR\xE2\x98BAZ"); + /// + /// let mut buf = vec![]; + /// s.to_lowercase_into(&mut buf); + /// assert_eq!(B(b"foo\xFFbar\xE2\x98baz"), buf.as_bytes()); + /// ``` + #[cfg(all(feature = "std", feature = "unicode"))] + #[inline] + fn to_lowercase_into(&self, buf: &mut Vec) { + // TODO: This is the best we can do given what std exposes I think. + // If we roll our own case handling, then we might be able to do this + // a bit faster. We shouldn't roll our own case handling unless we + // need to, e.g., for doing caseless matching or case folding. + + // TODO(BUG): This doesn't handle any special casing rules. + + buf.reserve(self.as_bytes().len()); + for (s, e, ch) in self.char_indices() { + if ch == '\u{FFFD}' { + buf.push_str(&self.as_bytes()[s..e]); + } else if ch.is_ascii() { + buf.push_char(ch.to_ascii_lowercase()); + } else { + for upper in ch.to_lowercase() { + buf.push_char(upper); + } + } + } + } + + /// Returns a new `Vec` containing the ASCII lowercase equivalent of + /// this byte string. + /// + /// In this case, lowercase is only defined in ASCII letters. Namely, the + /// letters `A-Z` are converted to `a-z`. All other bytes remain unchanged. + /// In particular, the length of the byte string returned is always + /// equivalent to the length of this byte string. + /// + /// If you'd like to reuse an allocation for performance reasons, then use + /// [`make_ascii_lowercase`](#method.make_ascii_lowercase) to perform + /// the conversion in place. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B("HELLO Β"); + /// assert_eq!("hello Β".as_bytes(), s.to_ascii_lowercase().as_bytes()); + /// ``` + /// + /// Invalid UTF-8 remains as is: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B(b"FOO\xFFBAR\xE2\x98BAZ"); + /// assert_eq!(s.to_ascii_lowercase(), B(b"foo\xFFbar\xE2\x98baz")); + /// ``` + #[cfg(feature = "std")] + #[inline] + fn to_ascii_lowercase(&self) -> Vec { + self.as_bytes().to_ascii_lowercase() + } + + /// Convert this byte string to its lowercase ASCII equivalent in place. + /// + /// In this case, lowercase is only defined in ASCII letters. Namely, the + /// letters `A-Z` are converted to `a-z`. All other bytes remain unchanged. + /// + /// If you don't need to do the conversion in + /// place and instead prefer convenience, then use + /// [`to_ascii_lowercase`](#method.to_ascii_lowercase) instead. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let mut s = >::from("HELLO Β"); + /// s.make_ascii_lowercase(); + /// assert_eq!(s, "hello Β".as_bytes()); + /// ``` + /// + /// Invalid UTF-8 remains as is: + /// + /// ``` + /// use bstr::{B, ByteSlice, ByteVec}; + /// + /// let mut s = >::from_slice(b"FOO\xFFBAR\xE2\x98BAZ"); + /// s.make_ascii_lowercase(); + /// assert_eq!(s, B(b"foo\xFFbar\xE2\x98baz")); + /// ``` + #[inline] + fn make_ascii_lowercase(&mut self) { + self.as_bytes_mut().make_ascii_lowercase(); + } + + /// Returns a new `Vec` containing the uppercase equivalent of this + /// byte string. + /// + /// In this case, uppercase is defined according to the `Uppercase` + /// Unicode property. + /// + /// If invalid UTF-8 is seen, or if a character has no uppercase variant, + /// then it is written to the given buffer unchanged. + /// + /// Note that some characters in this byte string may expand into multiple + /// characters when changing the case, so the number of bytes written to + /// the given byte string may not be equivalent to the number of bytes in + /// this byte string. + /// + /// If you'd like to reuse an allocation for performance reasons, then use + /// [`to_uppercase_into`](#method.to_uppercase_into) instead. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B("hello β"); + /// assert_eq!(s.to_uppercase(), B("HELLO Β")); + /// ``` + /// + /// Scripts without case are not changed: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B("农历新年"); + /// assert_eq!(s.to_uppercase(), B("农历新年")); + /// ``` + /// + /// Invalid UTF-8 remains as is: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B(b"foo\xFFbar\xE2\x98baz"); + /// assert_eq!(s.to_uppercase(), B(b"FOO\xFFBAR\xE2\x98BAZ")); + /// ``` + #[cfg(all(feature = "std", feature = "unicode"))] + #[inline] + fn to_uppercase(&self) -> Vec { + let mut buf = vec![]; + self.to_uppercase_into(&mut buf); + buf + } + + /// Writes the uppercase equivalent of this byte string into the given + /// buffer. The buffer is not cleared before written to. + /// + /// In this case, uppercase is defined according to the `Uppercase` + /// Unicode property. + /// + /// If invalid UTF-8 is seen, or if a character has no uppercase variant, + /// then it is written to the given buffer unchanged. + /// + /// Note that some characters in this byte string may expand into multiple + /// characters when changing the case, so the number of bytes written to + /// the given byte string may not be equivalent to the number of bytes in + /// this byte string. + /// + /// If you don't need to amortize allocation and instead prefer + /// convenience, then use [`to_uppercase`](#method.to_uppercase) instead. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B("hello β"); + /// + /// let mut buf = vec![]; + /// s.to_uppercase_into(&mut buf); + /// assert_eq!(buf, B("HELLO Β")); + /// ``` + /// + /// Scripts without case are not changed: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B("农历新年"); + /// + /// let mut buf = vec![]; + /// s.to_uppercase_into(&mut buf); + /// assert_eq!(buf, B("农历新年")); + /// ``` + /// + /// Invalid UTF-8 remains as is: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B(b"foo\xFFbar\xE2\x98baz"); + /// + /// let mut buf = vec![]; + /// s.to_uppercase_into(&mut buf); + /// assert_eq!(buf, B(b"FOO\xFFBAR\xE2\x98BAZ")); + /// ``` + #[cfg(all(feature = "std", feature = "unicode"))] + #[inline] + fn to_uppercase_into(&self, buf: &mut Vec) { + // TODO: This is the best we can do given what std exposes I think. + // If we roll our own case handling, then we might be able to do this + // a bit faster. We shouldn't roll our own case handling unless we + // need to, e.g., for doing caseless matching or case folding. + buf.reserve(self.as_bytes().len()); + for (s, e, ch) in self.char_indices() { + if ch == '\u{FFFD}' { + buf.push_str(&self.as_bytes()[s..e]); + } else if ch.is_ascii() { + buf.push_char(ch.to_ascii_uppercase()); + } else { + for upper in ch.to_uppercase() { + buf.push_char(upper); + } + } + } + } + + /// Returns a new `Vec` containing the ASCII uppercase equivalent of + /// this byte string. + /// + /// In this case, uppercase is only defined in ASCII letters. Namely, the + /// letters `a-z` are converted to `A-Z`. All other bytes remain unchanged. + /// In particular, the length of the byte string returned is always + /// equivalent to the length of this byte string. + /// + /// If you'd like to reuse an allocation for performance reasons, then use + /// [`make_ascii_uppercase`](#method.make_ascii_uppercase) to perform + /// the conversion in place. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B("hello β"); + /// assert_eq!(s.to_ascii_uppercase(), B("HELLO β")); + /// ``` + /// + /// Invalid UTF-8 remains as is: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let s = B(b"foo\xFFbar\xE2\x98baz"); + /// assert_eq!(s.to_ascii_uppercase(), B(b"FOO\xFFBAR\xE2\x98BAZ")); + /// ``` + #[cfg(feature = "std")] + #[inline] + fn to_ascii_uppercase(&self) -> Vec { + self.as_bytes().to_ascii_uppercase() + } + + /// Convert this byte string to its uppercase ASCII equivalent in place. + /// + /// In this case, uppercase is only defined in ASCII letters. Namely, the + /// letters `a-z` are converted to `A-Z`. All other bytes remain unchanged. + /// + /// If you don't need to do the conversion in + /// place and instead prefer convenience, then use + /// [`to_ascii_uppercase`](#method.to_ascii_uppercase) instead. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let mut s = >::from("hello β"); + /// s.make_ascii_uppercase(); + /// assert_eq!(s, B("HELLO β")); + /// ``` + /// + /// Invalid UTF-8 remains as is: + /// + /// ``` + /// use bstr::{B, ByteSlice, ByteVec}; + /// + /// let mut s = >::from_slice(b"foo\xFFbar\xE2\x98baz"); + /// s.make_ascii_uppercase(); + /// assert_eq!(s, B(b"FOO\xFFBAR\xE2\x98BAZ")); + /// ``` + #[inline] + fn make_ascii_uppercase(&mut self) { + self.as_bytes_mut().make_ascii_uppercase(); + } + + /// Reverse the bytes in this string, in place. + /// + /// This is not necessarily a well formed operation! For example, if this + /// byte string contains valid UTF-8 that isn't ASCII, then reversing the + /// string will likely result in invalid UTF-8 and otherwise non-sensical + /// content. + /// + /// Note that this is equivalent to the generic `[u8]::reverse` method. + /// This method is provided to permit callers to explicitly differentiate + /// between reversing bytes, codepoints and graphemes. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let mut s = >::from("hello"); + /// s.reverse_bytes(); + /// assert_eq!(s, "olleh".as_bytes()); + /// ``` + #[inline] + fn reverse_bytes(&mut self) { + self.as_bytes_mut().reverse(); + } + + /// Reverse the codepoints in this string, in place. + /// + /// If this byte string is valid UTF-8, then its reversal by codepoint + /// is also guaranteed to be valid UTF-8. + /// + /// This operation is equivalent to the following, but without allocating: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let mut s = >::from("foo☃bar"); + /// + /// let mut chars: Vec = s.chars().collect(); + /// chars.reverse(); + /// + /// let reversed: String = chars.into_iter().collect(); + /// assert_eq!(reversed, "rab☃oof"); + /// ``` + /// + /// Note that this is not necessarily a well formed operation. For example, + /// if this byte string contains grapheme clusters with more than one + /// codepoint, then those grapheme clusters will not necessarily be + /// preserved. If you'd like to preserve grapheme clusters, then use + /// [`reverse_graphemes`](#method.reverse_graphemes) instead. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let mut s = >::from("foo☃bar"); + /// s.reverse_chars(); + /// assert_eq!(s, "rab☃oof".as_bytes()); + /// ``` + /// + /// This example shows that not all reversals lead to a well formed string. + /// For example, in this case, combining marks are used to put accents over + /// some letters, and those accent marks must appear after the codepoints + /// they modify. + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let mut s = >::from("résumé"); + /// s.reverse_chars(); + /// assert_eq!(s, B(b"\xCC\x81emus\xCC\x81er")); + /// ``` + /// + /// A word of warning: the above example relies on the fact that + /// `résumé` is in decomposed normal form, which means there are separate + /// codepoints for the accents above `e`. If it is instead in composed + /// normal form, then the example works: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let mut s = >::from("résumé"); + /// s.reverse_chars(); + /// assert_eq!(s, B("émusér")); + /// ``` + /// + /// The point here is to be cautious and not assume that just because + /// `reverse_chars` works in one case, that it therefore works in all + /// cases. + #[inline] + fn reverse_chars(&mut self) { + let mut i = 0; + loop { + let (_, size) = utf8::decode(&self.as_bytes()[i..]); + if size == 0 { + break; + } + if size > 1 { + self.as_bytes_mut()[i..i + size].reverse_bytes(); + } + i += size; + } + self.reverse_bytes(); + } + + /// Reverse the graphemes in this string, in place. + /// + /// If this byte string is valid UTF-8, then its reversal by grapheme + /// is also guaranteed to be valid UTF-8. + /// + /// This operation is equivalent to the following, but without allocating: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let mut s = >::from("foo☃bar"); + /// + /// let mut graphemes: Vec<&str> = s.graphemes().collect(); + /// graphemes.reverse(); + /// + /// let reversed = graphemes.concat(); + /// assert_eq!(reversed, "rab☃oof"); + /// ``` + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let mut s = >::from("foo☃bar"); + /// s.reverse_graphemes(); + /// assert_eq!(s, "rab☃oof".as_bytes()); + /// ``` + /// + /// This example shows how this correctly handles grapheme clusters, + /// unlike `reverse_chars`. + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// let mut s = >::from("résumé"); + /// s.reverse_graphemes(); + /// assert_eq!(s, "émusér".as_bytes()); + /// ``` + #[cfg(feature = "unicode")] + #[inline] + fn reverse_graphemes(&mut self) { + use unicode::decode_grapheme; + + let mut i = 0; + loop { + let (_, size) = decode_grapheme(&self.as_bytes()[i..]); + if size == 0 { + break; + } + if size > 1 { + self.as_bytes_mut()[i..i + size].reverse_bytes(); + } + i += size; + } + self.reverse_bytes(); + } + + /// Returns true if and only if every byte in this byte string is ASCII. + /// + /// ASCII is an encoding that defines 128 codepoints. A byte corresponds to + /// an ASCII codepoint if and only if it is in the inclusive range + /// `[0, 127]`. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// assert!(B("abc").is_ascii()); + /// assert!(!B("☃βツ").is_ascii()); + /// assert!(!B(b"\xFF").is_ascii()); + /// ``` + #[inline] + fn is_ascii(&self) -> bool { + ascii::first_non_ascii_byte(self.as_bytes()) == self.as_bytes().len() + } + + /// Returns true if and only if the entire byte string is valid UTF-8. + /// + /// If you need location information about where a byte string's first + /// invalid UTF-8 byte is, then use the [`to_str`](#method.to_str) method. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// assert!(B("abc").is_utf8()); + /// assert!(B("☃βツ").is_utf8()); + /// // invalid bytes + /// assert!(!B(b"abc\xFF").is_utf8()); + /// // surrogate encoding + /// assert!(!B(b"\xED\xA0\x80").is_utf8()); + /// // incomplete sequence + /// assert!(!B(b"\xF0\x9D\x9Ca").is_utf8()); + /// // overlong sequence + /// assert!(!B(b"\xF0\x82\x82\xAC").is_utf8()); + /// ``` + #[inline] + fn is_utf8(&self) -> bool { + utf8::validate(self.as_bytes()).is_ok() + } + + /// Returns the last byte in this byte string, if it's non-empty. If this + /// byte string is empty, this returns `None`. + /// + /// Note that this is like the generic `[u8]::last`, except this returns + /// the byte by value instead of a reference to the byte. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteSlice; + /// + /// assert_eq!(Some(b'z'), b"baz".last_byte()); + /// assert_eq!(None, b"".last_byte()); + /// ``` + #[inline] + fn last_byte(&self) -> Option { + let bytes = self.as_bytes(); + bytes.get(bytes.len().saturating_sub(1)).map(|&b| b) + } + + /// Copies elements from one part of the slice to another part of itself, + /// where the parts may be overlapping. + /// + /// `src` is the range within this byte string to copy from, while `dest` + /// is the starting index of the range within this byte string to copy to. + /// The length indicated by `src` must be less than or equal to the number + /// of bytes from `dest` to the end of the byte string. + /// + /// # Panics + /// + /// Panics if either range is out of bounds, or if `src` is too big to fit + /// into `dest`, or if the end of `src` is before the start. + /// + /// # Examples + /// + /// Copying four bytes within a byte string: + /// + /// ``` + /// use bstr::{B, ByteSlice}; + /// + /// let mut buf = *b"Hello, World!"; + /// let s = &mut buf; + /// s.copy_within_str(1..5, 8); + /// assert_eq!(s, B("Hello, Wello!")); + /// ``` + #[inline] + fn copy_within_str(&mut self, src: R, dest: usize) + where + R: ops::RangeBounds, + { + // TODO: Deprecate this once slice::copy_within stabilizes. + let src_start = match src.start_bound() { + ops::Bound::Included(&n) => n, + ops::Bound::Excluded(&n) => { + n.checked_add(1).expect("attempted to index slice beyond max") + } + ops::Bound::Unbounded => 0, + }; + let src_end = match src.end_bound() { + ops::Bound::Included(&n) => { + n.checked_add(1).expect("attempted to index slice beyond max") + } + ops::Bound::Excluded(&n) => n, + ops::Bound::Unbounded => self.as_bytes().len(), + }; + assert!(src_start <= src_end, "src end is before src start"); + assert!(src_end <= self.as_bytes().len(), "src is out of bounds"); + let count = src_end - src_start; + assert!( + dest <= self.as_bytes().len() - count, + "dest is out of bounds", + ); + + // SAFETY: This is safe because we use ptr::copy to handle overlapping + // copies, and is also safe because we've checked all the bounds above. + // Finally, we are only dealing with u8 data, which is Copy, which + // means we can copy without worrying about ownership/destructors. + unsafe { + ptr::copy( + self.as_bytes().get_unchecked(src_start), + self.as_bytes_mut().get_unchecked_mut(dest), + count, + ); + } + } +} + +/// A single substring searcher fixed to a particular needle. +/// +/// The purpose of this type is to permit callers to construct a substring +/// searcher that can be used to search haystacks without the overhead of +/// constructing the searcher in the first place. This is a somewhat niche +/// concern when it's necessary to re-use the same needle to search multiple +/// different haystacks with as little overhead as possible. In general, using +/// [`ByteSlice::find`](trait.ByteSlice.html#method.find) +/// or +/// [`ByteSlice::find_iter`](trait.ByteSlice.html#method.find_iter) +/// is good enough, but `Finder` is useful when you can meaningfully observe +/// searcher construction time in a profile. +/// +/// When the `std` feature is enabled, then this type has an `into_owned` +/// version which permits building a `Finder` that is not connected to the +/// lifetime of its needle. +#[derive(Clone, Debug)] +pub struct Finder<'a> { + searcher: TwoWay<'a>, +} + +impl<'a> Finder<'a> { + /// Create a new finder for the given needle. + #[inline] + pub fn new>(needle: &'a B) -> Finder<'a> { + Finder { searcher: TwoWay::forward(needle.as_ref()) } + } + + /// Convert this finder into its owned variant, such that it no longer + /// borrows the needle. + /// + /// If this is already an owned finder, then this is a no-op. Otherwise, + /// this copies the needle. + /// + /// This is only available when the `std` feature is enabled. + #[cfg(feature = "std")] + #[inline] + pub fn into_owned(self) -> Finder<'static> { + Finder { searcher: self.searcher.into_owned() } + } + + /// Returns the needle that this finder searches for. + /// + /// Note that the lifetime of the needle returned is tied to the lifetime + /// of the finder, and may be shorter than the `'a` lifetime. Namely, a + /// finder's needle can be either borrowed or owned, so the lifetime of the + /// needle returned must necessarily be the shorter of the two. + #[inline] + pub fn needle(&self) -> &[u8] { + self.searcher.needle() + } + + /// Returns the index of the first occurrence of this needle in the given + /// haystack. + /// + /// The haystack may be any type that can be cheaply converted into a + /// `&[u8]`. This includes, but is not limited to, `&str` and `&[u8]`. + /// + /// # Complexity + /// + /// This routine is guaranteed to have worst case linear time complexity + /// with respect to both the needle and the haystack. That is, this runs + /// in `O(needle.len() + haystack.len())` time. + /// + /// This routine is also guaranteed to have worst case constant space + /// complexity. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::Finder; + /// + /// let haystack = "foo bar baz"; + /// assert_eq!(Some(0), Finder::new("foo").find(haystack)); + /// assert_eq!(Some(4), Finder::new("bar").find(haystack)); + /// assert_eq!(None, Finder::new("quux").find(haystack)); + /// ``` + #[inline] + pub fn find>(&self, haystack: B) -> Option { + self.searcher.find(haystack.as_ref()) + } +} + +/// A single substring reverse searcher fixed to a particular needle. +/// +/// The purpose of this type is to permit callers to construct a substring +/// searcher that can be used to search haystacks without the overhead of +/// constructing the searcher in the first place. This is a somewhat niche +/// concern when it's necessary to re-use the same needle to search multiple +/// different haystacks with as little overhead as possible. In general, using +/// [`ByteSlice::rfind`](trait.ByteSlice.html#method.rfind) +/// or +/// [`ByteSlice::rfind_iter`](trait.ByteSlice.html#method.rfind_iter) +/// is good enough, but `FinderReverse` is useful when you can meaningfully +/// observe searcher construction time in a profile. +/// +/// When the `std` feature is enabled, then this type has an `into_owned` +/// version which permits building a `FinderReverse` that is not connected to +/// the lifetime of its needle. +#[derive(Clone, Debug)] +pub struct FinderReverse<'a> { + searcher: TwoWay<'a>, +} + +impl<'a> FinderReverse<'a> { + /// Create a new reverse finder for the given needle. + #[inline] + pub fn new>(needle: &'a B) -> FinderReverse<'a> { + FinderReverse { searcher: TwoWay::reverse(needle.as_ref()) } + } + + /// Convert this finder into its owned variant, such that it no longer + /// borrows the needle. + /// + /// If this is already an owned finder, then this is a no-op. Otherwise, + /// this copies the needle. + /// + /// This is only available when the `std` feature is enabled. + #[cfg(feature = "std")] + #[inline] + pub fn into_owned(self) -> FinderReverse<'static> { + FinderReverse { searcher: self.searcher.into_owned() } + } + + /// Returns the needle that this finder searches for. + /// + /// Note that the lifetime of the needle returned is tied to the lifetime + /// of this finder, and may be shorter than the `'a` lifetime. Namely, + /// a finder's needle can be either borrowed or owned, so the lifetime of + /// the needle returned must necessarily be the shorter of the two. + #[inline] + pub fn needle(&self) -> &[u8] { + self.searcher.needle() + } + + /// Returns the index of the last occurrence of this needle in the given + /// haystack. + /// + /// The haystack may be any type that can be cheaply converted into a + /// `&[u8]`. This includes, but is not limited to, `&str` and `&[u8]`. + /// + /// # Complexity + /// + /// This routine is guaranteed to have worst case linear time complexity + /// with respect to both the needle and the haystack. That is, this runs + /// in `O(needle.len() + haystack.len())` time. + /// + /// This routine is also guaranteed to have worst case constant space + /// complexity. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::FinderReverse; + /// + /// let haystack = "foo bar baz"; + /// assert_eq!(Some(0), FinderReverse::new("foo").rfind(haystack)); + /// assert_eq!(Some(4), FinderReverse::new("bar").rfind(haystack)); + /// assert_eq!(None, FinderReverse::new("quux").rfind(haystack)); + /// ``` + #[inline] + pub fn rfind>(&self, haystack: B) -> Option { + self.searcher.rfind(haystack.as_ref()) + } +} + +/// An iterator over non-overlapping substring matches. +/// +/// Matches are reported by the byte offset at which they begin. +/// +/// `'a` is the shorter of two lifetimes: the byte string being searched or the +/// byte string being looked for. +#[derive(Debug)] +pub struct Find<'a> { + haystack: &'a [u8], + prestate: PrefilterState, + searcher: TwoWay<'a>, + pos: usize, +} + +impl<'a> Find<'a> { + fn new(haystack: &'a [u8], needle: &'a [u8]) -> Find<'a> { + let searcher = TwoWay::forward(needle); + let prestate = searcher.prefilter_state(); + Find { haystack, prestate, searcher, pos: 0 } + } +} + +impl<'a> Iterator for Find<'a> { + type Item = usize; + + #[inline] + fn next(&mut self) -> Option { + if self.pos > self.haystack.len() { + return None; + } + let result = self + .searcher + .find_with(&mut self.prestate, &self.haystack[self.pos..]); + match result { + None => None, + Some(i) => { + let pos = self.pos + i; + self.pos = pos + cmp::max(1, self.searcher.needle().len()); + Some(pos) + } + } + } +} + +/// An iterator over non-overlapping substring matches in reverse. +/// +/// Matches are reported by the byte offset at which they begin. +/// +/// `'a` is the shorter of two lifetimes: the byte string being searched or the +/// byte string being looked for. +#[derive(Debug)] +pub struct FindReverse<'a> { + haystack: &'a [u8], + prestate: PrefilterState, + searcher: TwoWay<'a>, + /// When searching with an empty needle, this gets set to `None` after + /// we've yielded the last element at `0`. + pos: Option, +} + +impl<'a> FindReverse<'a> { + fn new(haystack: &'a [u8], needle: &'a [u8]) -> FindReverse<'a> { + let searcher = TwoWay::reverse(needle); + let prestate = searcher.prefilter_state(); + let pos = Some(haystack.len()); + FindReverse { haystack, prestate, searcher, pos } + } + + fn haystack(&self) -> &'a [u8] { + self.haystack + } + + fn needle(&self) -> &[u8] { + self.searcher.needle() + } +} + +impl<'a> Iterator for FindReverse<'a> { + type Item = usize; + + #[inline] + fn next(&mut self) -> Option { + let pos = match self.pos { + None => return None, + Some(pos) => pos, + }; + let result = self + .searcher + .rfind_with(&mut self.prestate, &self.haystack[..pos]); + match result { + None => None, + Some(i) => { + if pos == i { + self.pos = pos.checked_sub(1); + } else { + self.pos = Some(i); + } + Some(i) + } + } + } +} + +/// An iterator over the bytes in a byte string. +/// +/// `'a` is the lifetime of the byte string being traversed. +#[derive(Clone, Debug)] +pub struct Bytes<'a> { + it: slice::Iter<'a, u8>, +} + +impl<'a> Iterator for Bytes<'a> { + type Item = u8; + + #[inline] + fn next(&mut self) -> Option { + self.it.next().map(|&b| b) + } +} + +impl<'a> DoubleEndedIterator for Bytes<'a> { + #[inline] + fn next_back(&mut self) -> Option { + self.it.next_back().map(|&b| b) + } +} + +impl<'a> ExactSizeIterator for Bytes<'a> { + #[inline] + fn len(&self) -> usize { + self.it.len() + } +} + +/// An iterator over the fields in a byte string, separated by whitespace. +/// +/// This iterator splits on contiguous runs of whitespace, such that the fields +/// in `foo\t\t\n \nbar` are `foo` and `bar`. +/// +/// `'a` is the lifetime of the byte string being split. +#[derive(Debug)] +pub struct Fields<'a> { + it: FieldsWith<'a, fn(char) -> bool>, +} + +impl<'a> Fields<'a> { + fn new(bytes: &'a [u8]) -> Fields<'a> { + Fields { it: bytes.fields_with(|ch| ch.is_whitespace()) } + } +} + +impl<'a> Iterator for Fields<'a> { + type Item = &'a [u8]; + + #[inline] + fn next(&mut self) -> Option<&'a [u8]> { + self.it.next() + } +} + +/// An iterator over fields in the byte string, separated by a predicate over +/// codepoints. +/// +/// This iterator splits a byte string based on its predicate function such +/// that the elements returned are separated by contiguous runs of codepoints +/// for which the predicate returns true. +/// +/// `'a` is the lifetime of the byte string being split, while `F` is the type +/// of the predicate, i.e., `FnMut(char) -> bool`. +#[derive(Debug)] +pub struct FieldsWith<'a, F> { + f: F, + bytes: &'a [u8], + chars: CharIndices<'a>, +} + +impl<'a, F: FnMut(char) -> bool> FieldsWith<'a, F> { + fn new(bytes: &'a [u8], f: F) -> FieldsWith<'a, F> { + FieldsWith { f: f, bytes: bytes, chars: bytes.char_indices() } + } +} + +impl<'a, F: FnMut(char) -> bool> Iterator for FieldsWith<'a, F> { + type Item = &'a [u8]; + + #[inline] + fn next(&mut self) -> Option<&'a [u8]> { + let (start, mut end); + loop { + match self.chars.next() { + None => return None, + Some((s, e, ch)) => { + if !(self.f)(ch) { + start = s; + end = e; + break; + } + } + } + } + while let Some((_, e, ch)) = self.chars.next() { + if (self.f)(ch) { + break; + } + end = e; + } + Some(&self.bytes[start..end]) + } +} + +/// An iterator over substrings in a byte string, split by a separator. +/// +/// `'a` is the lifetime of the byte string being split, while `F` is the type +/// of the predicate, i.e., `FnMut(char) -> bool`. +#[derive(Debug)] +pub struct Split<'a> { + finder: Find<'a>, + /// The end position of the previous match of our splitter. The element + /// we yield corresponds to the substring starting at `last` up to the + /// beginning of the next match of the splitter. + last: usize, + /// Only set when iteration is complete. A corner case here is when a + /// splitter is matched at the end of the haystack. At that point, we still + /// need to yield an empty string following it. + done: bool, +} + +impl<'a> Split<'a> { + fn new(haystack: &'a [u8], splitter: &'a [u8]) -> Split<'a> { + let finder = haystack.find_iter(splitter); + Split { finder, last: 0, done: false } + } +} + +impl<'a> Iterator for Split<'a> { + type Item = &'a [u8]; + + #[inline] + fn next(&mut self) -> Option<&'a [u8]> { + let haystack = self.finder.haystack; + match self.finder.next() { + Some(start) => { + let next = &haystack[self.last..start]; + self.last = start + self.finder.searcher.needle().len(); + Some(next) + } + None => { + if self.last >= haystack.len() { + if !self.done { + self.done = true; + Some(b"") + } else { + None + } + } else { + let s = &haystack[self.last..]; + self.last = haystack.len(); + self.done = true; + Some(s) + } + } + } + } +} + +/// An iterator over substrings in a byte string, split by a separator, in +/// reverse. +/// +/// `'a` is the lifetime of the byte string being split, while `F` is the type +/// of the predicate, i.e., `FnMut(char) -> bool`. +#[derive(Debug)] +pub struct SplitReverse<'a> { + finder: FindReverse<'a>, + /// The end position of the previous match of our splitter. The element + /// we yield corresponds to the substring starting at `last` up to the + /// beginning of the next match of the splitter. + last: usize, + /// Only set when iteration is complete. A corner case here is when a + /// splitter is matched at the end of the haystack. At that point, we still + /// need to yield an empty string following it. + done: bool, +} + +impl<'a> SplitReverse<'a> { + fn new(haystack: &'a [u8], splitter: &'a [u8]) -> SplitReverse<'a> { + let finder = haystack.rfind_iter(splitter); + SplitReverse { finder, last: haystack.len(), done: false } + } +} + +impl<'a> Iterator for SplitReverse<'a> { + type Item = &'a [u8]; + + #[inline] + fn next(&mut self) -> Option<&'a [u8]> { + let haystack = self.finder.haystack(); + match self.finder.next() { + Some(start) => { + let nlen = self.finder.needle().len(); + let next = &haystack[start + nlen..self.last]; + self.last = start; + Some(next) + } + None => { + if self.last == 0 { + if !self.done { + self.done = true; + Some(b"") + } else { + None + } + } else { + let s = &haystack[..self.last]; + self.last = 0; + self.done = true; + Some(s) + } + } + } + } +} + +/// An iterator over at most `n` substrings in a byte string, split by a +/// separator. +/// +/// `'a` is the lifetime of the byte string being split, while `F` is the type +/// of the predicate, i.e., `FnMut(char) -> bool`. +#[derive(Debug)] +pub struct SplitN<'a> { + split: Split<'a>, + limit: usize, + count: usize, +} + +impl<'a> SplitN<'a> { + fn new( + haystack: &'a [u8], + splitter: &'a [u8], + limit: usize, + ) -> SplitN<'a> { + let split = haystack.split_str(splitter); + SplitN { split, limit, count: 0 } + } +} + +impl<'a> Iterator for SplitN<'a> { + type Item = &'a [u8]; + + #[inline] + fn next(&mut self) -> Option<&'a [u8]> { + self.count += 1; + if self.count > self.limit { + None + } else if self.count == self.limit { + Some(&self.split.finder.haystack[self.split.last..]) + } else { + self.split.next() + } + } +} + +/// An iterator over at most `n` substrings in a byte string, split by a +/// separator, in reverse. +/// +/// `'a` is the lifetime of the byte string being split, while `F` is the type +/// of the predicate, i.e., `FnMut(char) -> bool`. +#[derive(Debug)] +pub struct SplitNReverse<'a> { + split: SplitReverse<'a>, + limit: usize, + count: usize, +} + +impl<'a> SplitNReverse<'a> { + fn new( + haystack: &'a [u8], + splitter: &'a [u8], + limit: usize, + ) -> SplitNReverse<'a> { + let split = haystack.rsplit_str(splitter); + SplitNReverse { split, limit, count: 0 } + } +} + +impl<'a> Iterator for SplitNReverse<'a> { + type Item = &'a [u8]; + + #[inline] + fn next(&mut self) -> Option<&'a [u8]> { + self.count += 1; + if self.count > self.limit { + None + } else if self.count == self.limit { + Some(&self.split.finder.haystack()[..self.split.last]) + } else { + self.split.next() + } + } +} + +/// An iterator over all lines in a byte string, without their terminators. +/// +/// For this iterator, the only line terminators recognized are `\r\n` and +/// `\n`. +/// +/// `'a` is the lifetime of the byte string being iterated over. +pub struct Lines<'a> { + it: LinesWithTerminator<'a>, +} + +impl<'a> Lines<'a> { + fn new(bytes: &'a [u8]) -> Lines<'a> { + Lines { it: LinesWithTerminator::new(bytes) } + } +} + +impl<'a> Iterator for Lines<'a> { + type Item = &'a [u8]; + + #[inline] + fn next(&mut self) -> Option<&'a [u8]> { + let mut line = self.it.next()?; + if line.last_byte() == Some(b'\n') { + line = &line[..line.len() - 1]; + if line.last_byte() == Some(b'\r') { + line = &line[..line.len() - 1]; + } + } + Some(line) + } +} + +/// An iterator over all lines in a byte string, including their terminators. +/// +/// For this iterator, the only line terminator recognized is `\n`. (Since +/// line terminators are included, this also handles `\r\n` line endings.) +/// +/// Line terminators are only included if they are present in the original +/// byte string. For example, the last line in a byte string may not end with +/// a line terminator. +/// +/// Concatenating all elements yielded by this iterator is guaranteed to yield +/// the original byte string. +/// +/// `'a` is the lifetime of the byte string being iterated over. +pub struct LinesWithTerminator<'a> { + bytes: &'a [u8], +} + +impl<'a> LinesWithTerminator<'a> { + fn new(bytes: &'a [u8]) -> LinesWithTerminator<'a> { + LinesWithTerminator { bytes } + } +} + +impl<'a> Iterator for LinesWithTerminator<'a> { + type Item = &'a [u8]; + + #[inline] + fn next(&mut self) -> Option<&'a [u8]> { + match self.bytes.find_byte(b'\n') { + None if self.bytes.is_empty() => None, + None => { + let line = self.bytes; + self.bytes = b""; + Some(line) + } + Some(end) => { + let line = &self.bytes[..end + 1]; + self.bytes = &self.bytes[end + 1..]; + Some(line) + } + } + } +} + +#[cfg(test)] +mod tests { + use ext_slice::{ByteSlice, B}; + use tests::LOSSY_TESTS; + + #[test] + fn to_str_lossy() { + for (i, &(expected, input)) in LOSSY_TESTS.iter().enumerate() { + let got = B(input).to_str_lossy(); + assert_eq!( + expected.as_bytes(), + got.as_bytes(), + "to_str_lossy(ith: {:?}, given: {:?})", + i, + input, + ); + + let mut got = String::new(); + B(input).to_str_lossy_into(&mut got); + assert_eq!( + expected.as_bytes(), + got.as_bytes(), + "to_str_lossy_into", + ); + + let got = String::from_utf8_lossy(input); + assert_eq!(expected.as_bytes(), got.as_bytes(), "std"); + } + } + + #[test] + #[should_panic] + fn copy_within_fail1() { + let mut buf = *b"foobar"; + let s = &mut buf; + s.copy_within_str(0..2, 5); + } + + #[test] + #[should_panic] + fn copy_within_fail2() { + let mut buf = *b"foobar"; + let s = &mut buf; + s.copy_within_str(3..2, 0); + } + + #[test] + #[should_panic] + fn copy_within_fail3() { + let mut buf = *b"foobar"; + let s = &mut buf; + s.copy_within_str(5..7, 0); + } + + #[test] + #[should_panic] + fn copy_within_fail4() { + let mut buf = *b"foobar"; + let s = &mut buf; + s.copy_within_str(0..1, 6); + } +} diff -Nru cargo-0.35.0/vendor/bstr/src/ext_vec.rs cargo-0.37.0/vendor/bstr/src/ext_vec.rs --- cargo-0.35.0/vendor/bstr/src/ext_vec.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/ext_vec.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,1093 @@ +#![allow(unused_imports)] + +use std::borrow::Cow; +use std::error; +use std::ffi::{OsStr, OsString}; +use std::fmt; +use std::iter; +use std::ops; +use std::path::{Path, PathBuf}; +use std::ptr; +use std::str; +use std::vec; + +use ext_slice::ByteSlice; +use utf8::{self, Utf8Error}; + +/// Concatenate the elements given by the iterator together into a single +/// `Vec`. +/// +/// The elements may be any type that can be cheaply converted into an `&[u8]`. +/// This includes, but is not limited to, `&str`, `&BStr` and `&[u8]` itself. +/// +/// # Examples +/// +/// Basic usage: +/// +/// ``` +/// use bstr; +/// +/// let s = bstr::concat(&["foo", "bar", "baz"]); +/// assert_eq!(s, "foobarbaz".as_bytes()); +/// ``` +#[inline] +pub fn concat(elements: I) -> Vec +where + T: AsRef<[u8]>, + I: IntoIterator, +{ + let mut dest = vec![]; + for element in elements { + dest.push_str(element); + } + dest +} + +/// Join the elements given by the iterator with the given separator into a +/// single `Vec`. +/// +/// Both the separator and the elements may be any type that can be cheaply +/// converted into an `&[u8]`. This includes, but is not limited to, +/// `&str`, `&BStr` and `&[u8]` itself. +/// +/// # Examples +/// +/// Basic usage: +/// +/// ``` +/// use bstr; +/// +/// let s = bstr::join(",", &["foo", "bar", "baz"]); +/// assert_eq!(s, "foo,bar,baz".as_bytes()); +/// ``` +#[inline] +pub fn join(separator: B, elements: I) -> Vec +where + B: AsRef<[u8]>, + T: AsRef<[u8]>, + I: IntoIterator, +{ + let mut it = elements.into_iter(); + let mut dest = vec![]; + match it.next() { + None => return dest, + Some(first) => { + dest.push_str(first); + } + } + for element in it { + dest.push_str(&separator); + dest.push_str(element); + } + dest +} + +impl ByteVec for Vec { + fn as_vec(&self) -> &Vec { + self + } + fn as_vec_mut(&mut self) -> &mut Vec { + self + } + fn into_vec(self) -> Vec { + self + } +} + +/// Ensure that callers cannot implement `ByteSlice` by making an +/// umplementable trait its super trait. +pub trait Sealed {} +impl Sealed for Vec {} + +/// A trait that extends a slice of bytes with string oriented methods. +pub trait ByteVec: Sealed { + /// A method for accessing the raw vector bytes of this type. This is + /// always a no-op and callers shouldn't care about it. This only exists + /// for making the extension trait work. + #[doc(hidden)] + fn as_vec(&self) -> &Vec; + + /// A method for accessing the raw vector bytes of this type, mutably. This + /// is always a no-op and callers shouldn't care about it. This only exists + /// for making the extension trait work. + #[doc(hidden)] + fn as_vec_mut(&mut self) -> &mut Vec; + + /// A method for consuming ownership of this vector. This is always a no-op + /// and callers shouldn't care about it. This only exists for making the + /// extension trait work. + #[doc(hidden)] + fn into_vec(self) -> Vec + where + Self: Sized; + + /// Create a new owned byte string from the given byte slice. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteVec}; + /// + /// let s = >::from_slice(b"abc"); + /// assert_eq!(s, B("abc")); + /// ``` + fn from_slice>(bytes: B) -> Vec { + bytes.as_ref().to_vec() + } + + /// Create a new byte string from an owned OS string. + /// + /// On Unix, this always succeeds and is zero cost. On non-Unix systems, + /// this returns the original OS string if it is not valid UTF-8. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use std::ffi::OsString; + /// + /// use bstr::{B, ByteVec}; + /// + /// let os_str = OsString::from("foo"); + /// let bs = Vec::from_os_string(os_str).expect("valid UTF-8"); + /// assert_eq!(bs, B("foo")); + /// ``` + #[inline] + fn from_os_string(os_str: OsString) -> Result, OsString> { + #[cfg(unix)] + #[inline] + fn imp(os_str: OsString) -> Result, OsString> { + use std::os::unix::ffi::OsStringExt; + + Ok(Vec::from(os_str.into_vec())) + } + + #[cfg(not(unix))] + #[inline] + fn imp(os_str: OsString) -> Result, OsString> { + os_str.into_string().map(Vec::from) + } + + imp(os_str) + } + + /// Lossily create a new byte string from an OS string slice. + /// + /// On Unix, this always succeeds, is zero cost and always returns a slice. + /// On non-Unix systems, this does a UTF-8 check. If the given OS string + /// slice is not valid UTF-8, then it is lossily decoded into valid UTF-8 + /// (with invalid bytes replaced by the Unicode replacement codepoint). + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use std::ffi::OsStr; + /// + /// use bstr::{B, ByteVec}; + /// + /// let os_str = OsStr::new("foo"); + /// let bs = Vec::from_os_str_lossy(os_str); + /// assert_eq!(bs, B("foo")); + /// ``` + #[inline] + fn from_os_str_lossy<'a>(os_str: &'a OsStr) -> Cow<'a, [u8]> { + #[cfg(unix)] + #[inline] + fn imp<'a>(os_str: &'a OsStr) -> Cow<'a, [u8]> { + use std::os::unix::ffi::OsStrExt; + + Cow::Borrowed(os_str.as_bytes()) + } + + #[cfg(not(unix))] + #[inline] + fn imp<'a>(os_str: &'a OsStr) -> Cow<'a, [u8]> { + match os_str.to_string_lossy() { + Cow::Borrowed(x) => Cow::Borrowed(x.as_bytes()), + Cow::Owned(x) => Cow::Owned(Vec::from(x)), + } + } + + imp(os_str) + } + + /// Create a new byte string from an owned file path. + /// + /// On Unix, this always succeeds and is zero cost. On non-Unix systems, + /// this returns the original path if it is not valid UTF-8. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use std::path::PathBuf; + /// + /// use bstr::{B, ByteVec}; + /// + /// let path = PathBuf::from("foo"); + /// let bs = Vec::from_path_buf(path).expect("must be valid UTF-8"); + /// assert_eq!(bs, B("foo")); + /// ``` + #[inline] + fn from_path_buf(path: PathBuf) -> Result, PathBuf> { + Vec::from_os_string(path.into_os_string()).map_err(PathBuf::from) + } + + /// Lossily create a new byte string from a file path. + /// + /// On Unix, this always succeeds, is zero cost and always returns a slice. + /// On non-Unix systems, this does a UTF-8 check. If the given path is not + /// valid UTF-8, then it is lossily decoded into valid UTF-8 (with invalid + /// bytes replaced by the Unicode replacement codepoint). + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use std::path::Path; + /// + /// use bstr::{B, ByteVec}; + /// + /// let path = Path::new("foo"); + /// let bs = Vec::from_path_lossy(path); + /// assert_eq!(bs, B("foo")); + /// ``` + #[inline] + fn from_path_lossy<'a>(path: &'a Path) -> Cow<'a, [u8]> { + Vec::from_os_str_lossy(path.as_os_str()) + } + + /// Appends the given byte to the end of this byte string. + /// + /// Note that this is equivalent to the generic `Vec::push` method. This + /// method is provided to permit callers to explicitly differentiate + /// between pushing bytes, codepoints and strings. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteVec; + /// + /// let mut s = >::from("abc"); + /// s.push_byte(b'\xE2'); + /// s.push_byte(b'\x98'); + /// s.push_byte(b'\x83'); + /// assert_eq!(s, "abc☃".as_bytes()); + /// ``` + #[inline] + fn push_byte(&mut self, byte: u8) { + self.as_vec_mut().push(byte); + } + + /// Appends the given `char` to the end of this byte string. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteVec; + /// + /// let mut s = >::from("abc"); + /// s.push_char('1'); + /// s.push_char('2'); + /// s.push_char('3'); + /// assert_eq!(s, "abc123".as_bytes()); + /// ``` + #[inline] + fn push_char(&mut self, ch: char) { + if ch.len_utf8() == 1 { + self.push_byte(ch as u8); + return; + } + self.as_vec_mut() + .extend_from_slice(ch.encode_utf8(&mut [0; 4]).as_bytes()); + } + + /// Appends the given slice to the end of this byte string. This accepts + /// any type that be converted to a `&[u8]`. This includes, but is not + /// limited to, `&str`, `&BStr`, and of course, `&[u8]` itself. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteVec; + /// + /// let mut s = >::from("abc"); + /// s.push_str(b"123"); + /// assert_eq!(s, "abc123".as_bytes()); + /// ``` + #[inline] + fn push_str>(&mut self, bytes: B) { + self.as_vec_mut().extend_from_slice(bytes.as_ref()); + } + + /// Converts a `Vec` into a `String` if and only if this byte string is + /// valid UTF-8. + /// + /// If it is not valid UTF-8, then a + /// [`FromUtf8Error`](struct.FromUtf8Error.html) + /// is returned. (This error can be used to examine why UTF-8 validation + /// failed, or to regain the original byte string.) + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteVec; + /// + /// # fn example() -> Result<(), Box> { + /// let bytes = Vec::from("hello"); + /// let string = bytes.into_string()?; + /// + /// assert_eq!("hello", string); + /// # Ok(()) }; example().unwrap() + /// ``` + /// + /// If this byte string is not valid UTF-8, then an error will be returned. + /// That error can then be used to inspect the location at which invalid + /// UTF-8 was found, or to regain the original byte string: + /// + /// ``` + /// use bstr::{B, ByteVec}; + /// + /// let bytes = Vec::from_slice(b"foo\xFFbar"); + /// let err = bytes.into_string().unwrap_err(); + /// + /// assert_eq!(err.utf8_error().valid_up_to(), 3); + /// assert_eq!(err.utf8_error().error_len(), Some(1)); + /// + /// // At no point in this example is an allocation performed. + /// let bytes = Vec::from(err.into_vec()); + /// assert_eq!(bytes, B(b"foo\xFFbar")); + /// ``` + #[inline] + fn into_string(self) -> Result + where + Self: Sized, + { + match utf8::validate(self.as_vec()) { + Err(err) => { + Err(FromUtf8Error { original: self.into_vec(), err: err }) + } + Ok(()) => { + // SAFETY: This is safe because of the guarantees provided by + // utf8::validate. + unsafe { Ok(self.into_string_unchecked()) } + } + } + } + + /// Lossily converts a `Vec` into a `String`. If this byte string + /// contains invalid UTF-8, then the invalid bytes are replaced with the + /// Unicode replacement codepoint. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteVec; + /// + /// let bytes = Vec::from_slice(b"foo\xFFbar"); + /// let string = bytes.into_string_lossy(); + /// assert_eq!(string, "foo\u{FFFD}bar"); + /// ``` + #[inline] + fn into_string_lossy(self) -> String + where + Self: Sized, + { + let v = self.as_vec(); + if let Ok(allutf8) = v.to_str() { + return allutf8.to_string(); + } + let mut dst = String::with_capacity(v.len()); + for ch in v.chars() { + dst.push(ch); + } + dst + } + + /// Unsafely convert this byte string into a `String`, without checking for + /// valid UTF-8. + /// + /// # Safety + /// + /// Callers *must* ensure that this byte string is valid UTF-8 before + /// calling this method. Converting a byte string into a `String` that is + /// not valid UTF-8 is considered undefined behavior. + /// + /// This routine is useful in performance sensitive contexts where the + /// UTF-8 validity of the byte string is already known and it is + /// undesirable to pay the cost of an additional UTF-8 validation check + /// that [`into_string`](#method.into_string) performs. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteVec; + /// + /// // SAFETY: This is safe because string literals are guaranteed to be + /// // valid UTF-8 by the Rust compiler. + /// let s = unsafe { Vec::from("☃βツ").into_string_unchecked() }; + /// assert_eq!("☃βツ", s); + /// ``` + unsafe fn into_string_unchecked(self) -> String + where + Self: Sized, + { + String::from_utf8_unchecked(self.into_vec()) + } + + /// Converts this byte string into an OS string, in place. + /// + /// On Unix, this always succeeds and is zero cost. On non-Unix systems, + /// this returns the original byte string if it is not valid UTF-8. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use std::ffi::OsStr; + /// + /// use bstr::ByteVec; + /// + /// let bs = Vec::from("foo"); + /// let os_str = bs.into_os_string().expect("should be valid UTF-8"); + /// assert_eq!(os_str, OsStr::new("foo")); + /// ``` + #[inline] + fn into_os_string(self) -> Result> + where + Self: Sized, + { + #[cfg(unix)] + #[inline] + fn imp(v: Vec) -> Result> { + use std::os::unix::ffi::OsStringExt; + + Ok(OsString::from_vec(v)) + } + + #[cfg(not(unix))] + #[inline] + fn imp(v: Vec) -> Result> { + match v.into_string() { + Ok(s) => Ok(OsString::from(s)), + Err(err) => Err(err.into_vec()), + } + } + + imp(self.into_vec()) + } + + /// Lossily converts this byte string into an OS string, in place. + /// + /// On Unix, this always succeeds and is zero cost. On non-Unix systems, + /// this will perform a UTF-8 check and lossily convert this byte string + /// into valid UTF-8 using the Unicode replacement codepoint. + /// + /// Note that this can prevent the correct roundtripping of file paths on + /// non-Unix systems such as Windows, where file paths are an arbitrary + /// sequence of 16-bit integers. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteVec; + /// + /// let bs = Vec::from_slice(b"foo\xFFbar"); + /// let os_str = bs.into_os_string_lossy(); + /// assert_eq!(os_str.to_string_lossy(), "foo\u{FFFD}bar"); + /// ``` + #[inline] + fn into_os_string_lossy(self) -> OsString + where + Self: Sized, + { + #[cfg(unix)] + #[inline] + fn imp(v: Vec) -> OsString { + use std::os::unix::ffi::OsStringExt; + + OsString::from_vec(v) + } + + #[cfg(not(unix))] + #[inline] + fn imp(v: Vec) -> OsString { + OsString::from(v.into_string_lossy()) + } + + imp(self.into_vec()) + } + + /// Converts this byte string into an owned file path, in place. + /// + /// On Unix, this always succeeds and is zero cost. On non-Unix systems, + /// this returns the original byte string if it is not valid UTF-8. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteVec; + /// + /// let bs = Vec::from("foo"); + /// let path = bs.into_path_buf().expect("should be valid UTF-8"); + /// assert_eq!(path.as_os_str(), "foo"); + /// ``` + #[inline] + fn into_path_buf(self) -> Result> + where + Self: Sized, + { + self.into_os_string().map(PathBuf::from) + } + + /// Lossily converts this byte string into an owned file path, in place. + /// + /// On Unix, this always succeeds and is zero cost. On non-Unix systems, + /// this will perform a UTF-8 check and lossily convert this byte string + /// into valid UTF-8 using the Unicode replacement codepoint. + /// + /// Note that this can prevent the correct roundtripping of file paths on + /// non-Unix systems such as Windows, where file paths are an arbitrary + /// sequence of 16-bit integers. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteVec; + /// + /// let bs = Vec::from_slice(b"foo\xFFbar"); + /// let path = bs.into_path_buf_lossy(); + /// assert_eq!(path.to_string_lossy(), "foo\u{FFFD}bar"); + /// ``` + #[inline] + fn into_path_buf_lossy(self) -> PathBuf + where + Self: Sized, + { + PathBuf::from(self.into_os_string_lossy()) + } + + /// Removes the last byte from this `Vec` and returns it. + /// + /// If this byte string is empty, then `None` is returned. + /// + /// If the last codepoint in this byte string is not ASCII, then removing + /// the last byte could make this byte string contain invalid UTF-8. + /// + /// Note that this is equivalent to the generic `Vec::pop` method. This + /// method is provided to permit callers to explicitly differentiate + /// between popping bytes and codepoints. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteVec; + /// + /// let mut s = Vec::from("foo"); + /// assert_eq!(s.pop_byte(), Some(b'o')); + /// assert_eq!(s.pop_byte(), Some(b'o')); + /// assert_eq!(s.pop_byte(), Some(b'f')); + /// assert_eq!(s.pop_byte(), None); + /// ``` + #[inline] + fn pop_byte(&mut self) -> Option { + self.as_vec_mut().pop() + } + + /// Removes the last codepoint from this `Vec` and returns it. + /// + /// If this byte string is empty, then `None` is returned. If the last + /// bytes of this byte string do not correspond to a valid UTF-8 code unit + /// sequence, then the Unicode replacement codepoint is yielded instead in + /// accordance with the + /// [replacement codepoint substitution policy](index.html#handling-of-invalid-utf8-8). + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteVec; + /// + /// let mut s = Vec::from("foo"); + /// assert_eq!(s.pop_char(), Some('o')); + /// assert_eq!(s.pop_char(), Some('o')); + /// assert_eq!(s.pop_char(), Some('f')); + /// assert_eq!(s.pop_char(), None); + /// ``` + /// + /// This shows the replacement codepoint substitution policy. Note that + /// the first pop yields a replacement codepoint but actually removes two + /// bytes. This is in contrast with subsequent pops when encountering + /// `\xFF` since `\xFF` is never a valid prefix for any valid UTF-8 + /// code unit sequence. + /// + /// ``` + /// use bstr::ByteVec; + /// + /// let mut s = Vec::from_slice(b"f\xFF\xFF\xFFoo\xE2\x98"); + /// assert_eq!(s.pop_char(), Some('\u{FFFD}')); + /// assert_eq!(s.pop_char(), Some('o')); + /// assert_eq!(s.pop_char(), Some('o')); + /// assert_eq!(s.pop_char(), Some('\u{FFFD}')); + /// assert_eq!(s.pop_char(), Some('\u{FFFD}')); + /// assert_eq!(s.pop_char(), Some('\u{FFFD}')); + /// assert_eq!(s.pop_char(), Some('f')); + /// assert_eq!(s.pop_char(), None); + /// ``` + #[inline] + fn pop_char(&mut self) -> Option { + let (ch, size) = utf8::decode_last_lossy(self.as_vec()); + if size == 0 { + return None; + } + let new_len = self.as_vec().len() - size; + self.as_vec_mut().truncate(new_len); + Some(ch) + } + + /// Removes a `char` from this `Vec` at the given byte position and + /// returns it. + /// + /// If the bytes at the given position do not lead to a valid UTF-8 code + /// unit sequence, then a + /// [replacement codepoint is returned instead](index.html#handling-of-invalid-utf8-8). + /// + /// # Panics + /// + /// Panics if `at` is larger than or equal to this byte string's length. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteVec; + /// + /// let mut s = Vec::from("foo☃bar"); + /// assert_eq!(s.remove_char(3), '☃'); + /// assert_eq!(s, b"foobar"); + /// ``` + /// + /// This example shows how the Unicode replacement codepoint policy is + /// used: + /// + /// ``` + /// use bstr::ByteVec; + /// + /// let mut s = Vec::from_slice(b"foo\xFFbar"); + /// assert_eq!(s.remove_char(3), '\u{FFFD}'); + /// assert_eq!(s, b"foobar"); + /// ``` + #[inline] + fn remove_char(&mut self, at: usize) -> char { + let (ch, size) = utf8::decode_lossy(&self.as_vec()[at..]); + assert!( + size > 0, + "expected {} to be less than {}", + at, + self.as_vec().len(), + ); + self.as_vec_mut().drain(at..at + size); + ch + } + + /// Inserts the given codepoint into this `Vec` at a particular byte + /// position. + /// + /// This is an `O(n)` operation as it may copy a number of elements in this + /// byte string proportional to its length. + /// + /// # Panics + /// + /// Panics if `at` is larger than the byte string's length. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteVec; + /// + /// let mut s = Vec::from("foobar"); + /// s.insert_char(3, '☃'); + /// assert_eq!(s, "foo☃bar".as_bytes()); + /// ``` + #[inline] + fn insert_char(&mut self, at: usize, ch: char) { + self.insert_str(at, ch.encode_utf8(&mut [0; 4]).as_bytes()); + } + + /// Inserts the given byte string into this byte string at a particular + /// byte position. + /// + /// This is an `O(n)` operation as it may copy a number of elements in this + /// byte string proportional to its length. + /// + /// The given byte string may be any type that can be cheaply converted + /// into a `&[u8]`. This includes, but is not limited to, `&str` and + /// `&[u8]`. + /// + /// # Panics + /// + /// Panics if `at` is larger than the byte string's length. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteVec; + /// + /// let mut s = Vec::from("foobar"); + /// s.insert_str(3, "☃☃☃"); + /// assert_eq!(s, "foo☃☃☃bar".as_bytes()); + /// ``` + #[inline] + fn insert_str>(&mut self, at: usize, bytes: B) { + let bytes = bytes.as_ref(); + let len = self.as_vec().len(); + assert!(at <= len, "expected {} to be <= {}", at, len); + + // SAFETY: We'd like to efficiently splice in the given bytes into + // this byte string. Since we are only working with `u8` elements here, + // we only need to consider whether our bounds are correct and whether + // our byte string has enough space. + self.as_vec_mut().reserve(bytes.len()); + unsafe { + // Shift bytes after `at` over by the length of `bytes` to make + // room for it. This requires referencing two regions of memory + // that may overlap, so we use ptr::copy. + ptr::copy( + self.as_vec().as_ptr().add(at), + self.as_vec_mut().as_mut_ptr().add(at + bytes.len()), + len - at, + ); + // Now copy the bytes given into the room we made above. In this + // case, we know that the given bytes cannot possibly overlap + // with this byte string since we have a mutable borrow of the + // latter. Thus, we can use a nonoverlapping copy. + ptr::copy_nonoverlapping( + bytes.as_ptr(), + self.as_vec_mut().as_mut_ptr().add(at), + bytes.len(), + ); + self.as_vec_mut().set_len(len + bytes.len()); + } + } + + /// Removes the specified range in this byte string and replaces it with + /// the given bytes. The given bytes do not need to have the same length + /// as the range provided. + /// + /// # Panics + /// + /// Panics if the given range is invalid. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteVec; + /// + /// let mut s = Vec::from("foobar"); + /// s.replace_range(2..4, "xxxxx"); + /// assert_eq!(s, "foxxxxxar".as_bytes()); + /// ``` + #[inline] + fn replace_range(&mut self, range: R, replace_with: B) + where + R: ops::RangeBounds, + B: AsRef<[u8]>, + { + self.as_vec_mut().splice(range, replace_with.as_ref().iter().cloned()); + } + + /// Creates a draining iterator that removes the specified range in this + /// `Vec` and yields each of the removed bytes. + /// + /// Note that the elements specified by the given range are removed + /// regardless of whether the returned iterator is fully exhausted. + /// + /// Also note that is is unspecified how many bytes are removed from the + /// `Vec` if the `DrainBytes` iterator is leaked. + /// + /// # Panics + /// + /// Panics if the given range is not valid. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::ByteVec; + /// + /// let mut s = Vec::from("foobar"); + /// { + /// let mut drainer = s.drain_bytes(2..4); + /// assert_eq!(drainer.next(), Some(b'o')); + /// assert_eq!(drainer.next(), Some(b'b')); + /// assert_eq!(drainer.next(), None); + /// } + /// assert_eq!(s, "foar".as_bytes()); + /// ``` + #[inline] + fn drain_bytes(&mut self, range: R) -> DrainBytes + where + R: ops::RangeBounds, + { + DrainBytes { it: self.as_vec_mut().drain(range) } + } +} + +/// A draining byte oriented iterator for `Vec`. +/// +/// This iterator is created by +/// [`ByteVec::drain_bytes`](trait.ByteVec.html#method.drain_bytes). +/// +/// # Examples +/// +/// Basic usage: +/// +/// ``` +/// use bstr::ByteVec; +/// +/// let mut s = Vec::from("foobar"); +/// { +/// let mut drainer = s.drain_bytes(2..4); +/// assert_eq!(drainer.next(), Some(b'o')); +/// assert_eq!(drainer.next(), Some(b'b')); +/// assert_eq!(drainer.next(), None); +/// } +/// assert_eq!(s, "foar".as_bytes()); +/// ``` +#[derive(Debug)] +pub struct DrainBytes<'a> { + it: vec::Drain<'a, u8>, +} + +impl<'a> iter::FusedIterator for DrainBytes<'a> {} + +impl<'a> Iterator for DrainBytes<'a> { + type Item = u8; + + #[inline] + fn next(&mut self) -> Option { + self.it.next() + } +} + +impl<'a> DoubleEndedIterator for DrainBytes<'a> { + #[inline] + fn next_back(&mut self) -> Option { + self.it.next_back() + } +} + +impl<'a> ExactSizeIterator for DrainBytes<'a> { + #[inline] + fn len(&self) -> usize { + self.it.len() + } +} + +/// An error that may occur when converting a `Vec` to a `String`. +/// +/// This error includes the original `Vec` that failed to convert to a +/// `String`. This permits callers to recover the allocation used even if it +/// it not valid UTF-8. +/// +/// # Examples +/// +/// Basic usage: +/// +/// ``` +/// use bstr::{B, ByteVec}; +/// +/// let bytes = Vec::from_slice(b"foo\xFFbar"); +/// let err = bytes.into_string().unwrap_err(); +/// +/// assert_eq!(err.utf8_error().valid_up_to(), 3); +/// assert_eq!(err.utf8_error().error_len(), Some(1)); +/// +/// // At no point in this example is an allocation performed. +/// let bytes = Vec::from(err.into_vec()); +/// assert_eq!(bytes, B(b"foo\xFFbar")); +/// ``` +#[derive(Debug, Eq, PartialEq)] +pub struct FromUtf8Error { + original: Vec, + err: Utf8Error, +} + +impl FromUtf8Error { + /// Return the original bytes as a slice that failed to convert to a + /// `String`. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteVec}; + /// + /// let bytes = Vec::from_slice(b"foo\xFFbar"); + /// let err = bytes.into_string().unwrap_err(); + /// + /// // At no point in this example is an allocation performed. + /// assert_eq!(err.as_bytes(), B(b"foo\xFFbar")); + /// ``` + #[inline] + pub fn as_bytes(&self) -> &[u8] { + &self.original + } + + /// Consume this error and return the original byte string that failed to + /// convert to a `String`. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteVec}; + /// + /// let bytes = Vec::from_slice(b"foo\xFFbar"); + /// let err = bytes.into_string().unwrap_err(); + /// let original = err.into_vec(); + /// + /// // At no point in this example is an allocation performed. + /// assert_eq!(original, B(b"foo\xFFbar")); + /// ``` + #[inline] + pub fn into_vec(self) -> Vec { + self.original + } + + /// Return the underlying UTF-8 error that occurred. This error provides + /// information on the nature and location of the invalid UTF-8 detected. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use bstr::{B, ByteVec}; + /// + /// let bytes = Vec::from_slice(b"foo\xFFbar"); + /// let err = bytes.into_string().unwrap_err(); + /// + /// assert_eq!(err.utf8_error().valid_up_to(), 3); + /// assert_eq!(err.utf8_error().error_len(), Some(1)); + /// ``` + #[inline] + pub fn utf8_error(&self) -> &Utf8Error { + &self.err + } +} + +impl error::Error for FromUtf8Error { + #[inline] + fn description(&self) -> &str { + "invalid UTF-8 vector" + } +} + +impl fmt::Display for FromUtf8Error { + #[inline] + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.err) + } +} + +#[cfg(test)] +mod tests { + use ext_slice::B; + use ext_vec::ByteVec; + + #[test] + fn insert() { + let mut s = vec![]; + s.insert_str(0, "foo"); + assert_eq!(s, "foo".as_bytes()); + + let mut s = Vec::from("a"); + s.insert_str(0, "foo"); + assert_eq!(s, "fooa".as_bytes()); + + let mut s = Vec::from("a"); + s.insert_str(1, "foo"); + assert_eq!(s, "afoo".as_bytes()); + + let mut s = Vec::from("foobar"); + s.insert_str(3, "quux"); + assert_eq!(s, "fooquuxbar".as_bytes()); + + let mut s = Vec::from("foobar"); + s.insert_str(3, "x"); + assert_eq!(s, "fooxbar".as_bytes()); + + let mut s = Vec::from("foobar"); + s.insert_str(0, "x"); + assert_eq!(s, "xfoobar".as_bytes()); + + let mut s = Vec::from("foobar"); + s.insert_str(6, "x"); + assert_eq!(s, "foobarx".as_bytes()); + + let mut s = Vec::from("foobar"); + s.insert_str(3, "quuxbazquux"); + assert_eq!(s, "fooquuxbazquuxbar".as_bytes()); + } + + #[test] + #[should_panic] + fn insert_fail1() { + let mut s = vec![]; + s.insert_str(1, "foo"); + } + + #[test] + #[should_panic] + fn insert_fail2() { + let mut s = Vec::from("a"); + s.insert_str(2, "foo"); + } + + #[test] + #[should_panic] + fn insert_fail3() { + let mut s = Vec::from("foobar"); + s.insert_str(7, "foo"); + } +} diff -Nru cargo-0.35.0/vendor/bstr/src/freqs.rs cargo-0.37.0/vendor/bstr/src/freqs.rs --- cargo-0.35.0/vendor/bstr/src/freqs.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/freqs.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,258 +0,0 @@ -pub const BYTE_FREQUENCIES: [u8; 256] = [ - 55, // '\x00' - 52, // '\x01' - 51, // '\x02' - 50, // '\x03' - 49, // '\x04' - 48, // '\x05' - 47, // '\x06' - 46, // '\x07' - 45, // '\x08' - 103, // '\t' - 242, // '\n' - 66, // '\x0b' - 67, // '\x0c' - 229, // '\r' - 44, // '\x0e' - 43, // '\x0f' - 42, // '\x10' - 41, // '\x11' - 40, // '\x12' - 39, // '\x13' - 38, // '\x14' - 37, // '\x15' - 36, // '\x16' - 35, // '\x17' - 34, // '\x18' - 33, // '\x19' - 56, // '\x1a' - 32, // '\x1b' - 31, // '\x1c' - 30, // '\x1d' - 29, // '\x1e' - 28, // '\x1f' - 255, // ' ' - 148, // '!' - 164, // '"' - 149, // '#' - 136, // '$' - 160, // '%' - 155, // '&' - 173, // "'" - 221, // '(' - 222, // ')' - 134, // '*' - 122, // '+' - 232, // ',' - 202, // '-' - 215, // '.' - 224, // '/' - 208, // '0' - 220, // '1' - 204, // '2' - 187, // '3' - 183, // '4' - 179, // '5' - 177, // '6' - 168, // '7' - 178, // '8' - 200, // '9' - 226, // ':' - 195, // ';' - 154, // '<' - 184, // '=' - 174, // '>' - 126, // '?' - 120, // '@' - 191, // 'A' - 157, // 'B' - 194, // 'C' - 170, // 'D' - 189, // 'E' - 162, // 'F' - 161, // 'G' - 150, // 'H' - 193, // 'I' - 142, // 'J' - 137, // 'K' - 171, // 'L' - 176, // 'M' - 185, // 'N' - 167, // 'O' - 186, // 'P' - 112, // 'Q' - 175, // 'R' - 192, // 'S' - 188, // 'T' - 156, // 'U' - 140, // 'V' - 143, // 'W' - 123, // 'X' - 133, // 'Y' - 128, // 'Z' - 147, // '[' - 138, // '\\' - 146, // ']' - 114, // '^' - 223, // '_' - 151, // '`' - 249, // 'a' - 216, // 'b' - 238, // 'c' - 236, // 'd' - 253, // 'e' - 227, // 'f' - 218, // 'g' - 230, // 'h' - 247, // 'i' - 135, // 'j' - 180, // 'k' - 241, // 'l' - 233, // 'm' - 246, // 'n' - 244, // 'o' - 231, // 'p' - 139, // 'q' - 245, // 'r' - 243, // 's' - 251, // 't' - 235, // 'u' - 201, // 'v' - 196, // 'w' - 240, // 'x' - 214, // 'y' - 152, // 'z' - 182, // '{' - 205, // '|' - 181, // '}' - 127, // '~' - 27, // '\x7f' - 212, // '\x80' - 211, // '\x81' - 210, // '\x82' - 213, // '\x83' - 228, // '\x84' - 197, // '\x85' - 169, // '\x86' - 159, // '\x87' - 131, // '\x88' - 172, // '\x89' - 105, // '\x8a' - 80, // '\x8b' - 98, // '\x8c' - 96, // '\x8d' - 97, // '\x8e' - 81, // '\x8f' - 207, // '\x90' - 145, // '\x91' - 116, // '\x92' - 115, // '\x93' - 144, // '\x94' - 130, // '\x95' - 153, // '\x96' - 121, // '\x97' - 107, // '\x98' - 132, // '\x99' - 109, // '\x9a' - 110, // '\x9b' - 124, // '\x9c' - 111, // '\x9d' - 82, // '\x9e' - 108, // '\x9f' - 118, // '\xa0' - 141, // '¡' - 113, // '¢' - 129, // '£' - 119, // '¤' - 125, // '¥' - 165, // '¦' - 117, // '§' - 92, // '¨' - 106, // '©' - 83, // 'ª' - 72, // '«' - 99, // '¬' - 93, // '\xad' - 65, // '®' - 79, // '¯' - 166, // '°' - 237, // '±' - 163, // '²' - 199, // '³' - 190, // '´' - 225, // 'µ' - 209, // '¶' - 203, // '·' - 198, // '¸' - 217, // '¹' - 219, // 'º' - 206, // '»' - 234, // '¼' - 248, // '½' - 158, // '¾' - 239, // '¿' - 255, // 'À' - 255, // 'Á' - 255, // 'Â' - 255, // 'Ã' - 255, // 'Ä' - 255, // 'Å' - 255, // 'Æ' - 255, // 'Ç' - 255, // 'È' - 255, // 'É' - 255, // 'Ê' - 255, // 'Ë' - 255, // 'Ì' - 255, // 'Í' - 255, // 'Î' - 255, // 'Ï' - 255, // 'Ð' - 255, // 'Ñ' - 255, // 'Ò' - 255, // 'Ó' - 255, // 'Ô' - 255, // 'Õ' - 255, // 'Ö' - 255, // '×' - 255, // 'Ø' - 255, // 'Ù' - 255, // 'Ú' - 255, // 'Û' - 255, // 'Ü' - 255, // 'Ý' - 255, // 'Þ' - 255, // 'ß' - 255, // 'à' - 255, // 'á' - 255, // 'â' - 255, // 'ã' - 255, // 'ä' - 255, // 'å' - 255, // 'æ' - 255, // 'ç' - 255, // 'è' - 255, // 'é' - 255, // 'ê' - 255, // 'ë' - 255, // 'ì' - 255, // 'í' - 255, // 'î' - 255, // 'ï' - 255, // 'ð' - 255, // 'ñ' - 255, // 'ò' - 255, // 'ó' - 255, // 'ô' - 255, // 'õ' - 255, // 'ö' - 255, // '÷' - 255, // 'ø' - 255, // 'ù' - 255, // 'ú' - 255, // 'û' - 255, // 'ü' - 255, // 'ý' - 255, // 'þ' - 255, // 'ÿ' -]; diff -Nru cargo-0.35.0/vendor/bstr/src/impls.rs cargo-0.37.0/vendor/bstr/src/impls.rs --- cargo-0.35.0/vendor/bstr/src/impls.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/impls.rs 2019-07-17 05:42:23.000000000 +0000 @@ -15,7 +15,7 @@ PartialEq::eq(this, other.as_bytes()) } } - } + }; } macro_rules! impl_partial_eq_cow { @@ -35,7 +35,7 @@ PartialEq::eq(this, other.as_bytes()) } } - } + }; } macro_rules! impl_partial_ord { @@ -55,12 +55,12 @@ PartialOrd::partial_cmp(this, other.as_bytes()) } } - } + }; } #[cfg(feature = "std")] mod bstring { - use std::borrow::{Borrow, ToOwned}; + use std::borrow::{Borrow, Cow, ToOwned}; use std::cmp::Ordering; use std::fmt; use std::iter::FromIterator; @@ -68,6 +68,7 @@ use bstr::BStr; use bstring::BString; + use ext_vec::ByteVec; impl fmt::Display for BString { #[inline] @@ -84,25 +85,25 @@ } impl ops::Deref for BString { - type Target = BStr; + type Target = Vec; #[inline] - fn deref(&self) -> &BStr { - self.as_bstr() + fn deref(&self) -> &Vec { + &self.bytes } } impl ops::DerefMut for BString { #[inline] - fn deref_mut(&mut self) -> &mut BStr { - self.as_mut_bstr() + fn deref_mut(&mut self) -> &mut Vec { + &mut self.bytes } } impl AsRef<[u8]> for BString { #[inline] fn as_ref(&self) -> &[u8] { - self.as_bytes() + &self.bytes } } @@ -116,7 +117,7 @@ impl AsMut<[u8]> for BString { #[inline] fn as_mut(&mut self) -> &mut [u8] { - self.as_bytes_mut() + &mut self.bytes } } @@ -139,107 +140,120 @@ #[inline] fn to_owned(&self) -> BString { - self.to_bstring() + BString::from(self) + } + } + + impl Default for BString { + fn default() -> BString { + BString::from(vec![]) } } impl<'a> From<&'a [u8]> for BString { #[inline] fn from(s: &'a [u8]) -> BString { - BString::from_vec(s.to_vec()) + BString::from(s.to_vec()) } } impl From> for BString { #[inline] fn from(s: Vec) -> BString { - BString::from_vec(s) + BString { bytes: s } } } impl From for Vec { #[inline] fn from(s: BString) -> Vec { - s.into_vec() + s.bytes } } impl<'a> From<&'a str> for BString { #[inline] fn from(s: &'a str) -> BString { - BString::from_vec(s.as_bytes().to_vec()) + BString::from(s.as_bytes().to_vec()) } } impl From for BString { #[inline] fn from(s: String) -> BString { - BString::from_vec(s.into_bytes()) + BString::from(s.into_bytes()) } } impl<'a> From<&'a BStr> for BString { #[inline] fn from(s: &'a BStr) -> BString { - s.to_bstring() + BString::from(s.bytes.to_vec()) + } + } + + impl<'a> From for Cow<'a, BStr> { + #[inline] + fn from(s: BString) -> Cow<'a, BStr> { + Cow::Owned(s) } } impl FromIterator for BString { #[inline] - fn from_iter>(iter: T) -> BString { + fn from_iter>(iter: T) -> BString { BString::from(iter.into_iter().collect::()) } } impl FromIterator for BString { #[inline] - fn from_iter>(iter: T) -> BString { + fn from_iter>(iter: T) -> BString { BString::from(iter.into_iter().collect::>()) } } impl<'a> FromIterator<&'a str> for BString { #[inline] - fn from_iter>(iter: T) -> BString { - let mut buf = BString::new(); + fn from_iter>(iter: T) -> BString { + let mut buf = vec![]; for b in iter { - buf.push(b); + buf.push_str(b); } - buf + BString::from(buf) } } impl<'a> FromIterator<&'a [u8]> for BString { #[inline] - fn from_iter>(iter: T) -> BString { - let mut buf = BString::new(); + fn from_iter>(iter: T) -> BString { + let mut buf = vec![]; for b in iter { - buf.push(b); + buf.push_str(b); } - buf + BString::from(buf) } } impl<'a> FromIterator<&'a BStr> for BString { #[inline] - fn from_iter>(iter: T) -> BString { - let mut buf = BString::new(); + fn from_iter>(iter: T) -> BString { + let mut buf = vec![]; for b in iter { - buf.push(b); + buf.push_str(b); } - buf + BString::from(buf) } } impl FromIterator for BString { #[inline] - fn from_iter>(iter: T) -> BString { - let mut buf = BString::new(); + fn from_iter>(iter: T) -> BString { + let mut buf = vec![]; for b in iter { - buf.push(b); + buf.push_str(b); } - buf + BString::from(buf) } } @@ -264,7 +278,7 @@ impl PartialOrd for BString { #[inline] fn partial_cmp(&self, other: &BString) -> Option { - PartialOrd::partial_cmp(self.as_bytes(), other.as_bytes()) + PartialOrd::partial_cmp(&self.bytes, &other.bytes) } } @@ -294,6 +308,7 @@ use core::ops; use bstr::BStr; + use ext_slice::ByteSlice; impl fmt::Display for BStr { #[inline] @@ -326,6 +341,22 @@ } } + impl ops::Deref for BStr { + type Target = [u8]; + + #[inline] + fn deref(&self) -> &[u8] { + &self.bytes + } + } + + impl ops::DerefMut for BStr { + #[inline] + fn deref_mut(&mut self) -> &mut [u8] { + &mut self.bytes + } + } + impl ops::Index for BStr { type Output = u8; @@ -392,7 +423,7 @@ impl ops::IndexMut for BStr { #[inline] fn index_mut(&mut self, idx: usize) -> &mut u8 { - &mut self.as_bytes_mut()[idx] + &mut self.bytes[idx] } } @@ -406,35 +437,35 @@ impl ops::IndexMut> for BStr { #[inline] fn index_mut(&mut self, r: ops::Range) -> &mut BStr { - BStr::from_bytes_mut(&mut self.as_bytes_mut()[r.start..r.end]) + BStr::from_bytes_mut(&mut self.bytes[r.start..r.end]) } } impl ops::IndexMut> for BStr { #[inline] fn index_mut(&mut self, r: ops::RangeInclusive) -> &mut BStr { - BStr::from_bytes_mut(&mut self.as_bytes_mut()[*r.start()..=*r.end()]) + BStr::from_bytes_mut(&mut self.bytes[*r.start()..=*r.end()]) } } impl ops::IndexMut> for BStr { #[inline] fn index_mut(&mut self, r: ops::RangeFrom) -> &mut BStr { - BStr::from_bytes_mut(&mut self.as_bytes_mut()[r.start..]) + BStr::from_bytes_mut(&mut self.bytes[r.start..]) } } impl ops::IndexMut> for BStr { #[inline] fn index_mut(&mut self, r: ops::RangeTo) -> &mut BStr { - BStr::from_bytes_mut(&mut self.as_bytes_mut()[..r.end]) + BStr::from_bytes_mut(&mut self.bytes[..r.end]) } } impl ops::IndexMut> for BStr { #[inline] fn index_mut(&mut self, r: ops::RangeToInclusive) -> &mut BStr { - BStr::from_bytes_mut(&mut self.as_bytes_mut()[..=r.end]) + BStr::from_bytes_mut(&mut self.bytes[..=r.end]) } } @@ -462,7 +493,7 @@ impl AsMut<[u8]> for BStr { #[inline] fn as_mut(&mut self) -> &mut [u8] { - self.as_bytes_mut() + &mut self.bytes } } @@ -473,6 +504,18 @@ } } + impl<'a> Default for &'a BStr { + fn default() -> &'a BStr { + BStr::from_bytes(b"") + } + } + + impl<'a> Default for &'a mut BStr { + fn default() -> &'a mut BStr { + BStr::from_bytes_mut(&mut []) + } + } + impl<'a> From<&'a [u8]> for &'a BStr { #[inline] fn from(s: &'a [u8]) -> &'a BStr { @@ -487,6 +530,14 @@ } } + #[cfg(feature = "std")] + impl<'a> From<&'a BStr> for Cow<'a, BStr> { + #[inline] + fn from(s: &'a BStr) -> Cow<'a, BStr> { + Cow::Borrowed(s) + } + } + impl Eq for BStr {} impl PartialEq for BStr { @@ -550,19 +601,17 @@ use std::fmt; use serde::{ - Serialize, Serializer, - Deserialize, Deserializer, de::Error, de::Visitor, + de::Error, de::Visitor, Deserialize, Deserializer, Serialize, + Serializer, }; use bstr::BStr; impl Serialize for BStr { #[inline] - fn serialize( - &self, - serializer: S, - ) -> Result - where S: Serializer + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, { serializer.serialize_bytes(self.as_bytes()) } @@ -570,10 +619,9 @@ impl<'a, 'de: 'a> Deserialize<'de> for &'a BStr { #[inline] - fn deserialize( - deserializer: D, - ) -> Result<&'a BStr, D::Error> - where D: Deserializer<'de> + fn deserialize(deserializer: D) -> Result<&'a BStr, D::Error> + where + D: Deserializer<'de>, { struct BStrVisitor; @@ -612,19 +660,17 @@ use std::fmt; use serde::{ + de::Error, de::SeqAccess, de::Visitor, Deserialize, Deserializer, Serialize, Serializer, - Deserialize, Deserializer, de::Error, de::SeqAccess, de::Visitor, }; use bstring::BString; impl Serialize for BString { #[inline] - fn serialize( - &self, - serializer: S, - ) -> Result - where S: Serializer + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, { serializer.serialize_bytes(self.as_bytes()) } @@ -632,10 +678,9 @@ impl<'de> Deserialize<'de> for BString { #[inline] - fn deserialize( - deserializer: D, - ) -> Result - where D: Deserializer<'de> + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, { struct BStringVisitor; @@ -652,11 +697,11 @@ mut visitor: V, ) -> Result { let len = cmp::min(visitor.size_hint().unwrap_or(0), 256); - let mut bytes = BString::with_capacity(len); + let mut bytes = Vec::with_capacity(len); while let Some(v) = visitor.next_element()? { - bytes.push_byte(v); + bytes.push(v); } - Ok(bytes) + Ok(BString::from(bytes)) } #[inline] @@ -708,8 +753,8 @@ BString::from(Vec::::arbitrary(g)) } - fn shrink(&self) -> Box> { - Box::new(self.as_vec().shrink().map(BString::from)) + fn shrink(&self) -> Box> { + Box::new(self.bytes.shrink().map(BString::from)) } } } diff -Nru cargo-0.35.0/vendor/bstr/src/io.rs cargo-0.37.0/vendor/bstr/src/io.rs --- cargo-0.35.0/vendor/bstr/src/io.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/io.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,8 +9,8 @@ use std::io; -use bstr::BStr; -use bstring::BString; +use ext_slice::ByteSlice; +use ext_vec::ByteVec; /// An extention trait for /// [`std::io::BufRead`](https://doc.rust-lang.org/std/io/trait.BufRead.html) @@ -19,7 +19,7 @@ /// Returns an iterator over the lines of this reader, where each line /// is represented as a byte string. /// - /// Each item yielded by this iterator is a `io::Result`, where + /// Each item yielded by this iterator is a `io::Result>`, where /// an error is yielded if there was a problem reading from the underlying /// reader. /// @@ -44,12 +44,15 @@ /// lines.push(line); /// } /// assert_eq!(lines.len(), 3); - /// assert_eq!(lines[0], "lorem"); - /// assert_eq!(lines[1], "ipsum"); - /// assert_eq!(lines[2], "dolor"); + /// assert_eq!(lines[0], "lorem".as_bytes()); + /// assert_eq!(lines[1], "ipsum".as_bytes()); + /// assert_eq!(lines[2], "dolor".as_bytes()); /// # Ok(()) }; example().unwrap() /// ``` - fn byte_lines(self) -> ByteLines where Self: Sized { + fn byte_lines(self) -> ByteLines + where + Self: Sized, + { ByteLines { buf: self } } @@ -80,24 +83,22 @@ /// /// let mut lines = vec![]; /// cursor.for_byte_line(|line| { - /// lines.push(line.to_bstring()); + /// lines.push(line.to_vec()); /// Ok(true) /// })?; /// assert_eq!(lines.len(), 3); - /// assert_eq!(lines[0], "lorem"); - /// assert_eq!(lines[1], "ipsum"); - /// assert_eq!(lines[2], "dolor"); + /// assert_eq!(lines[0], "lorem".as_bytes()); + /// assert_eq!(lines[1], "ipsum".as_bytes()); + /// assert_eq!(lines[2], "dolor".as_bytes()); /// # Ok(()) }; example().unwrap() /// ``` - fn for_byte_line( - mut self, - mut for_each_line: F, - ) -> io::Result<()> - where Self: Sized, - F: FnMut(&BStr) -> io::Result + fn for_byte_line(mut self, mut for_each_line: F) -> io::Result<()> + where + Self: Sized, + F: FnMut(&[u8]) -> io::Result, { - let mut bytes = BString::new(); - while self.read_until(b'\n', bytes.as_mut_vec())? > 0 { + let mut bytes = vec![]; + while self.read_until(b'\n', &mut bytes)? > 0 { trim_line(&mut bytes); if !for_each_line(&bytes)? { break; @@ -135,24 +136,25 @@ /// /// let mut lines = vec![]; /// cursor.for_byte_line_with_terminator(|line| { - /// lines.push(line.to_bstring()); + /// lines.push(line.to_vec()); /// Ok(true) /// })?; /// assert_eq!(lines.len(), 3); - /// assert_eq!(lines[0], "lorem\n"); - /// assert_eq!(lines[1], "ipsum\r\n"); - /// assert_eq!(lines[2], "dolor"); + /// assert_eq!(lines[0], "lorem\n".as_bytes()); + /// assert_eq!(lines[1], "ipsum\r\n".as_bytes()); + /// assert_eq!(lines[2], "dolor".as_bytes()); /// # Ok(()) }; example().unwrap() /// ``` fn for_byte_line_with_terminator( mut self, mut for_each_line: F, ) -> io::Result<()> - where Self: Sized, - F: FnMut(&BStr) -> io::Result + where + Self: Sized, + F: FnMut(&[u8]) -> io::Result, { - let mut bytes = BString::new(); - while self.read_until(b'\n', bytes.as_mut_vec())? > 0 { + let mut bytes = vec![]; + while self.read_until(b'\n', &mut bytes)? > 0 { if !for_each_line(&bytes)? { break; } @@ -178,11 +180,11 @@ } impl Iterator for ByteLines { - type Item = io::Result; + type Item = io::Result>; - fn next(&mut self) -> Option> { - let mut bytes = BString::new(); - match self.buf.read_until(b'\n', bytes.as_mut_vec()) { + fn next(&mut self) -> Option>> { + let mut bytes = vec![]; + match self.buf.read_until(b'\n', &mut bytes) { Err(e) => Some(Err(e)), Ok(0) => None, Ok(_) => { @@ -193,10 +195,10 @@ } } -fn trim_line(line: &mut BString) { - if line.last() == Some(b'\n') { +fn trim_line(line: &mut Vec) { + if line.last_byte() == Some(b'\n') { line.pop_byte(); - if line.last() == Some(b'\r') { + if line.last_byte() == Some(b'\r') { line.pop_byte(); } } diff -Nru cargo-0.35.0/vendor/bstr/src/lib.rs cargo-0.37.0/vendor/bstr/src/lib.rs --- cargo-0.35.0/vendor/bstr/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -4,32 +4,42 @@ Byte strings are just like standard Unicode strings with one very important difference: byte strings are only *conventionally* UTF-8 while Rust's standard Unicode strings are *guaranteed* to be valid UTF-8. The primary motivation for -this type is for handling arbitrary bytes that are mostly UTF-8. +byte strings is for handling arbitrary bytes that are mostly UTF-8. # Overview -There are two primary types in this crate: +This crate provides two important traits that provide string oriented methods +on `&[u8]` and `Vec` types: +* [`ByteSlice`](trait.ByteSlice.html) extends the `[u8]` type with additional + string oriented methods. +* [`ByteVec`](trait.ByteVec.html) extends the `Vec` type with additional + string oriented methods. + +Additionally, this crate provides two concrete byte string types that deref to +`[u8]` and `Vec`. These are useful for storing byte string types, and come +with convenient `std::fmt::Debug` implementations: + +* [`BStr`](struct.BStr.html) is a byte string slice, analogous to `str`. * [`BString`](struct.BString.html) is an owned growable byte string buffer, analogous to `String`. -* [`BStr`](struct.BStr.html) is a byte string slice, analogous to `str`. Additionally, the free function [`B`](fn.B.html) serves as a convenient short hand for writing byte string literals. # Quick examples -Byte strings are effectively the same thing as a `Vec` or a `&[u8]`, except -they provide a string oriented API. Operations such as iterating over +Byte strings build on the existing APIs for `Vec` and `&[u8]`, with +additional string oriented methods. Operations such as iterating over graphemes, searching for substrings, replacing substrings, trimming and case -conversion are examples of things not provided on the standard `&[u8]` APIs -but are provided by this crate. For example, this code iterates over all of -occurrences of a subtring: +conversion are examples of things not provided on the standard library `&[u8]` +APIs but are provided by this crate. For example, this code iterates over all +of occurrences of a subtring: ``` -use bstr::B; +use bstr::ByteSlice; -let s = B("foo bar foo foo quux foo"); +let s = b"foo bar foo foo quux foo"; let mut matches = vec![]; for start in s.find_iter("foo") { @@ -38,28 +48,54 @@ assert_eq!(matches, [0, 8, 12, 21]); ``` -Here's another example showing how to do a search and replace: +Here's another example showing how to do a search and replace (and also showing +use of the `B` function): ``` -use bstr::B; +use bstr::{B, ByteSlice}; -let old = B("foo bar foo foo quux foo"); +let old = B("foo ☃☃☃ foo foo quux foo"); let new = old.replace("foo", "hello"); -assert_eq!(new, "hello bar hello hello quux hello"); +assert_eq!(new, B("hello ☃☃☃ hello hello quux hello")); ``` And here's an example that shows case conversion, even in the presence of invalid UTF-8: ``` -use bstr::{B, BString}; +use bstr::{ByteSlice, ByteVec}; -let mut lower = BString::from("hello β"); +let mut lower = Vec::from("hello β"); lower[0] = b'\xFF'; // lowercase β is uppercased to Β -assert_eq!(lower.to_uppercase(), B(b"\xFFELLO \xCE\x92")); +assert_eq!(lower.to_uppercase(), b"\xFFELLO \xCE\x92"); +``` + +# Convenient debug representation + +When working with byte strings, it is often useful to be able to print them +as if they were byte strings and not sequences of integers. While this crate +cannot affect the `std::fmt::Debug` implementations for `[u8]` and `Vec`, +this crate does provide the `BStr` and `BString` types which have convenient +`std::fmt::Debug` implementations. + +For example, this + +``` +use bstr::ByteSlice; + +let mut bytes = Vec::from("hello β"); +bytes[0] = b'\xFF'; + +println!("{:?}", bytes.as_bstr()); ``` +will output `"\xFFello β"`. + +This example works because the +[`ByteSlice::as_bstr`](trait.ByteSlice.html#method.as_bstr) +method converts any `&[u8]` to a `&BStr`. + # When should I use byte strings? This library is somewhat of an experiment that reflects my hypothesis that @@ -106,33 +142,36 @@ Since this library is still experimental, you should not use it in the public API of your crates until it hits `1.0` (unless you're OK with with tracking -breaking releases of `bstr`). It is a priority to move this crate to `1.0` -expediently so that `BString` and `BStr` may be used in the public APIs of -other crates. While both `BString` and `BStr` do provide zero cost ways of -converting between `Vec` and `&[u8]`, it is often convenient to provide -trait implementations for `BString` and `BStr`, which requires making `bstr` a -public dependency. +breaking releases of `bstr`). + +In general, it should be possible to avoid putting anything in this crate into +your public APIs. Namely, you should never need to use the `ByteSlice` or +`ByteVec` traits as bounds on public APIs, since their only purpose is to +extend the methods on the concrete types `[u8]` and `Vec`, respectively. +Similarly, it should not be necessary to put either the `BStr` or `BString` +types into public APIs. If you want to use them internally, then they can +be converted to/from `[u8]`/`Vec` as needed. # Differences with standard strings -The primary difference between `BStr` and `str` is that the former is +The primary difference between `[u8]` and `str` is that the former is conventionally UTF-8 while the latter is guaranteed to be UTF-8. The phrase -"conventionally UTF-8" means that a `BStr` may contain bytes that do not form -a valid UTF-8 sequence, but operations defined on the type are generally most -useful on valid UTF-8 sequences. For example, iterating over Unicode codepoints -or grapheme clusters is an operation that is only defined on valid UTF-8. -Therefore, when invalid UTF-8 is encountered, the Unicode replacement codepoint -is substituted. Thus, a byte string that is not UTF-8 at all is of limited -utility when using these methods. +"conventionally UTF-8" means that a `[u8]` may contain bytes that do not form +a valid UTF-8 sequence, but operations defined on the type in this crate are +generally most useful on valid UTF-8 sequences. For example, iterating over +Unicode codepoints or grapheme clusters is an operation that is only defined +on valid UTF-8. Therefore, when invalid UTF-8 is encountered, the Unicode +replacement codepoint is substituted. Thus, a byte string that is not UTF-8 at +all is of limited utility when using these crate. However, not all operations on byte strings are specifically Unicode aware. For example, substring search has no specific Unicode semantics ascribed to it. It works just as well for byte strings that are completely valid UTF-8 as for byte strings that contain no valid UTF-8 at all. Similarly for replacements and -various other operations. +various other operations that do not need any Unicode specific tailoring. -Aside from the difference in how UTF-8 is handled, the APIs between `BStr` and -`str` (and `BString` and `String`) are intentionally very similar, including +Aside from the difference in how UTF-8 is handled, the APIs between `[u8]` and +`str` (and `Vec` and `String`) are intentionally very similar, including maintaining the same behavior for corner cases in things like substring splitting. There are, however, some differences: @@ -155,9 +194,16 @@ in this crate, as is consistent with treating byte strings as a sequence of bytes. This means callers are responsible for maintaining a UTF-8 invariant if that's important. +* Some routines provided by this crate, such as `starts_with_str`, have a + `_str` suffix to differentiate them from similar routines already defined + on the `[u8]` type. The difference is that `starts_with` requires its + parameter to be a `&[u8]`, where as `starts_with_str` permits its parameter + to by anything that implements `AsRef<[u8]>`, which is more flexible. This + means you can write `bytes.starts_with_str("☃")` instead of + `bytes.starts_with("☃".as_bytes())`. Otherwise, you should find most of the APIs between this crate and the standard -library to be very similar, if not identical. +library string APIs to be very similar, if not identical. # Handling of invalid UTF-8 @@ -176,9 +222,9 @@ replacement codepoint whenever it comes across bytes that are not valid UTF-8: ``` -use bstr::B; +use bstr::ByteSlice; -let bs = B(b"a\xFF\xFFz"); +let bs = b"a\xFF\xFFz"; let chars: Vec = bs.chars().collect(); assert_eq!(vec!['a', '\u{FFFD}', '\u{FFFD}', 'z'], chars); ``` @@ -196,9 +242,9 @@ replacement codepoint. For example: ``` -use bstr::B; +use bstr::ByteSlice; -let bs = B(b"a\xF0\x9F\x87z"); +let bs = b"a\xF0\x9F\x87z"; let chars: Vec = bs.chars().collect(); // The bytes \xF0\x9F\x87 could lead to a valid UTF-8 sequence, but 3 of them // on their own are invalid. Only one replacement codepoint is substituted, @@ -212,9 +258,9 @@ the replacement codepoint. For example: ``` -use bstr::{B, BStr}; +use bstr::{B, ByteSlice}; -let bs = B(b"a\xE2\x98z"); +let bs = b"a\xE2\x98z"; let chars: Vec<(usize, usize, char)> = bs.char_indices().collect(); // Even though the replacement codepoint is encoded as 3 bytes itself, the // byte range given here is only two bytes, corresponding to the original @@ -223,7 +269,7 @@ // Thus, getting the original raw bytes is as simple as slicing the original // byte string: -let chars: Vec<&BStr> = bs.char_indices().map(|(s, e, _)| &bs[s..e]).collect(); +let chars: Vec<&[u8]> = bs.char_indices().map(|(s, e, _)| &bs[s..e]).collect(); assert_eq!(vec![B("a"), B(b"\xE2\x98"), B("z")], chars); ``` @@ -281,25 +327,25 @@ While this library may provide facilities for (1) in the future, currently, this library only provides facilities for (2) and (3). In particular, a suite of conversion functions are provided that permit converting between byte -strings, OS strings and file paths. For owned `BString`s, they are: +strings, OS strings and file paths. For owned byte strings, they are: -* [`BString::from_os_string`](struct.BString.html#method.from_os_string) -* [`BString::from_os_str_lossy`](struct.BString.html#method.from_os_str_lossy) -* [`BString::from_path_buf`](struct.BString.html#method.from_path_buf) -* [`BString::from_path_lossy`](struct.BString.html#method.from_path_lossy) -* [`BString::into_os_string`](struct.BString.html#method.into_os_string) -* [`BString::into_os_string_lossy`](struct.BString.html#method.into_os_string_lossy) -* [`BString::into_path_buf`](struct.BString.html#method.into_path_buf) -* [`BString::into_path_buf_lossy`](struct.BString.html#method.into_path_buf_lossy) +* [`ByteVec::from_os_string`](trait.ByteVec.html#method.from_os_string) +* [`ByteVec::from_os_str_lossy`](trait.ByteVec.html#method.from_os_str_lossy) +* [`ByteVec::from_path_buf`](trait.ByteVec.html#method.from_path_buf) +* [`ByteVec::from_path_lossy`](trait.ByteVec.html#method.from_path_lossy) +* [`ByteVec::into_os_string`](trait.ByteVec.html#method.into_os_string) +* [`ByteVec::into_os_string_lossy`](trait.ByteVec.html#method.into_os_string_lossy) +* [`ByteVec::into_path_buf`](trait.ByteVec.html#method.into_path_buf) +* [`ByteVec::into_path_buf_lossy`](trait.ByteVec.html#method.into_path_buf_lossy) For byte string slices, they are: -* [`BStr::from_os_str`](struct.BStr.html#method.from_os_str) -* [`BStr::from_path`](struct.BStr.html#method.from_path) -* [`BStr::to_os_str`](struct.BStr.html#method.to_os_str) -* [`BStr::to_os_str_lossy`](struct.BStr.html#method.to_os_str_lossy) -* [`BStr::to_path`](struct.BStr.html#method.to_path) -* [`BStr::to_path_lossy`](struct.BStr.html#method.to_path_lossy) +* [`ByteSlice::from_os_str`](trait.ByteSlice.html#method.from_os_str) +* [`ByteSlice::from_path`](trait.ByteSlice.html#method.from_path) +* [`ByteSlice::to_os_str`](trait.ByteSlice.html#method.to_os_str) +* [`ByteSlice::to_os_str_lossy`](trait.ByteSlice.html#method.to_os_str_lossy) +* [`ByteSlice::to_path`](trait.ByteSlice.html#method.to_path) +* [`ByteSlice::to_path_lossy`](trait.ByteSlice.html#method.to_path_lossy) On Unix, all of these conversions are rigorously zero cost, which gives one a way to ergonomically deal with raw file paths exactly as they are using @@ -321,6 +367,7 @@ */ #![cfg_attr(not(feature = "std"), no_std)] +#![allow(dead_code)] #[cfg(feature = "std")] extern crate core; @@ -339,27 +386,23 @@ #[cfg(test)] extern crate ucd_parse; -pub use bstr::{ - B, BStr, - Bytes, - Finder, FinderReverse, Find, FindReverse, - Split, SplitReverse, SplitN, SplitNReverse, - Fields, FieldsWith, - Lines, LinesWithTerminator, +pub use bstr::BStr; +pub use bstring::BString; +pub use ext_slice::{ + ByteSlice, Bytes, Fields, FieldsWith, Find, FindReverse, Finder, + FinderReverse, Lines, LinesWithTerminator, Split, SplitN, SplitNReverse, + SplitReverse, B, }; #[cfg(feature = "std")] -pub use bstring::{BString, DrainBytes, FromUtf8Error, concat, join}; -pub use slice_index::SliceIndex; +pub use ext_vec::{concat, join, ByteVec, DrainBytes, FromUtf8Error}; #[cfg(feature = "unicode")] pub use unicode::{ - Graphemes, GraphemeIndices, - Sentences, SentenceIndices, - Words, WordIndices, WordsWithBreaks, WordsWithBreakIndices, + GraphemeIndices, Graphemes, SentenceIndices, Sentences, WordIndices, + Words, WordsWithBreakIndices, WordsWithBreaks, }; pub use utf8::{ - Utf8Error, Chars, CharIndices, - decode as decode_utf8, - decode_last as decode_last_utf8, + decode as decode_utf8, decode_last as decode_last_utf8, CharIndices, + Chars, Utf8Error, }; mod ascii; @@ -367,11 +410,12 @@ #[cfg(feature = "std")] mod bstring; mod cow; +mod ext_slice; +mod ext_vec; mod impls; #[cfg(feature = "std")] pub mod io; mod search; -mod slice_index; #[cfg(test)] mod tests; #[cfg(feature = "unicode")] @@ -380,7 +424,9 @@ #[cfg(test)] mod apitests { - use super::*; + use bstr::BStr; + use bstring::BString; + use ext_slice::{Finder, FinderReverse}; #[test] fn oibits() { diff -Nru cargo-0.35.0/vendor/bstr/src/search/byte_frequencies.rs cargo-0.37.0/vendor/bstr/src/search/byte_frequencies.rs --- cargo-0.35.0/vendor/bstr/src/search/byte_frequencies.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/search/byte_frequencies.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,36 +1,36 @@ pub const BYTE_FREQUENCIES: [u8; 256] = [ - 55, // '\x00' - 52, // '\x01' - 51, // '\x02' - 50, // '\x03' - 49, // '\x04' - 48, // '\x05' - 47, // '\x06' - 46, // '\x07' - 45, // '\x08' + 55, // '\x00' + 52, // '\x01' + 51, // '\x02' + 50, // '\x03' + 49, // '\x04' + 48, // '\x05' + 47, // '\x06' + 46, // '\x07' + 45, // '\x08' 103, // '\t' 242, // '\n' - 66, // '\x0b' - 67, // '\x0c' + 66, // '\x0b' + 67, // '\x0c' 229, // '\r' - 44, // '\x0e' - 43, // '\x0f' - 42, // '\x10' - 41, // '\x11' - 40, // '\x12' - 39, // '\x13' - 38, // '\x14' - 37, // '\x15' - 36, // '\x16' - 35, // '\x17' - 34, // '\x18' - 33, // '\x19' - 56, // '\x1a' - 32, // '\x1b' - 31, // '\x1c' - 30, // '\x1d' - 29, // '\x1e' - 28, // '\x1f' + 44, // '\x0e' + 43, // '\x0f' + 42, // '\x10' + 41, // '\x11' + 40, // '\x12' + 39, // '\x13' + 38, // '\x14' + 37, // '\x15' + 36, // '\x16' + 35, // '\x17' + 34, // '\x18' + 33, // '\x19' + 56, // '\x1a' + 32, // '\x1b' + 31, // '\x1c' + 30, // '\x1d' + 29, // '\x1e' + 28, // '\x1f' 255, // ' ' 148, // '!' 164, // '"' @@ -126,7 +126,7 @@ 205, // '|' 181, // '}' 127, // '~' - 27, // '\x7f' + 27, // '\x7f' 212, // '\x80' 211, // '\x81' 210, // '\x82' @@ -138,11 +138,11 @@ 131, // '\x88' 172, // '\x89' 105, // '\x8a' - 80, // '\x8b' - 98, // '\x8c' - 96, // '\x8d' - 97, // '\x8e' - 81, // '\x8f' + 80, // '\x8b' + 98, // '\x8c' + 96, // '\x8d' + 97, // '\x8e' + 81, // '\x8f' 207, // '\x90' 145, // '\x91' 116, // '\x92' @@ -157,7 +157,7 @@ 110, // '\x9b' 124, // '\x9c' 111, // '\x9d' - 82, // '\x9e' + 82, // '\x9e' 108, // '\x9f' 118, // '\xa0' 141, // '¡' @@ -167,14 +167,14 @@ 125, // '¥' 165, // '¦' 117, // '§' - 92, // '¨' + 92, // '¨' 106, // '©' - 83, // 'ª' - 72, // '«' - 99, // '¬' - 93, // '\xad' - 65, // '®' - 79, // '¯' + 83, // 'ª' + 72, // '«' + 99, // '¬' + 93, // '\xad' + 65, // '®' + 79, // '¯' 166, // '°' 237, // '±' 163, // '²' diff -Nru cargo-0.35.0/vendor/bstr/src/search/prefilter.rs cargo-0.37.0/vendor/bstr/src/search/prefilter.rs --- cargo-0.35.0/vendor/bstr/src/search/prefilter.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/search/prefilter.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,6 +1,6 @@ use core::mem; -use bstr::BStr; +use ext_slice::ByteSlice; use search::byte_frequencies::BYTE_FREQUENCIES; /// PrefilterState tracks state associated with the effectiveness of a @@ -148,7 +148,7 @@ } /// Return search info for the given needle in the forward direction. - pub fn forward(needle: &BStr) -> Freqy { + pub fn forward(needle: &[u8]) -> Freqy { if needle.is_empty() { return Freqy::inert(); } @@ -184,7 +184,7 @@ } /// Return search info for the given needle in the reverse direction. - pub fn reverse(needle: &BStr) -> Freqy { + pub fn reverse(needle: &[u8]) -> Freqy { if needle.is_empty() { return Freqy::inert(); } @@ -233,7 +233,7 @@ pub fn find_candidate( &self, prestate: &mut PrefilterState, - haystack: &BStr, + haystack: &[u8], ) -> Option { debug_assert!(!self.inert); @@ -289,7 +289,7 @@ pub fn rfind_candidate( &self, prestate: &mut PrefilterState, - haystack: &BStr, + haystack: &[u8], ) -> Option { debug_assert!(!self.inert); @@ -341,8 +341,8 @@ #[cfg(test)] mod tests { - use bstr::B; use super::*; + use ext_slice::B; #[test] fn freqy_forward() { diff -Nru cargo-0.35.0/vendor/bstr/src/search/tests.rs cargo-0.37.0/vendor/bstr/src/search/tests.rs --- cargo-0.35.0/vendor/bstr/src/search/tests.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/search/tests.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,5 +1,3 @@ -use bstr::{B, BStr}; -use bstring::BString; use search::twoway::TwoWay; /// Each test is a (needle, haystack, expected_fwd, expected_rev) tuple. @@ -38,10 +36,8 @@ ("abc", "zzabc", Some(2), Some(2)), ("abc", "azbc", None, None), ("abc", "abzc", None, None), - ("abczdef", "abczdefzzzzzzzzzzzzzzzzzzzz", Some(0), Some(0)), ("abczdef", "zzzzzzzzzzzzzzzzzzzzabczdef", Some(20), Some(20)), - // Failures caught by quickcheck. ("\u{0}\u{15}", "\u{0}\u{15}\u{15}\u{0}", Some(0), Some(0)), ("\u{0}\u{1e}", "\u{1e}\u{0}", None, None), @@ -63,15 +59,18 @@ /// needle in the haystack, or `None` if one doesn't exist. fn run_search_tests_fwd( name: &str, - mut search: impl FnMut(&BStr, &BStr) -> Option, + mut search: impl FnMut(&[u8], &[u8]) -> Option, ) { for &(needle, haystack, expected_fwd, _) in SEARCH_TESTS { - let (n, h) = (B(needle), B(haystack)); + let (n, h) = (needle.as_bytes(), haystack.as_bytes()); assert_eq!( expected_fwd, search(n, h), "{}: needle: {:?}, haystack: {:?}, expected: {:?}", - name, n, h, expected_fwd + name, + n, + h, + expected_fwd ); } } @@ -82,39 +81,42 @@ /// needle in the haystack, or `None` if one doesn't exist. fn run_search_tests_rev( name: &str, - mut search: impl FnMut(&BStr, &BStr) -> Option, + mut search: impl FnMut(&[u8], &[u8]) -> Option, ) { for &(needle, haystack, _, expected_rev) in SEARCH_TESTS { - let (n, h) = (B(needle), B(haystack)); + let (n, h) = (needle.as_bytes(), haystack.as_bytes()); assert_eq!( expected_rev, search(n, h), "{}: needle: {:?}, haystack: {:?}, expected: {:?}", - name, n, h, expected_rev + name, + n, + h, + expected_rev ); } } quickcheck! { - fn qc_twoway_fwd_prefix_is_substring(bs: BString) -> bool { + fn qc_twoway_fwd_prefix_is_substring(bs: Vec) -> bool { prop_prefix_is_substring(false, &bs, |n, h| TwoWay::forward(n).find(h)) } - fn qc_twoway_fwd_suffix_is_substring(bs: BString) -> bool { + fn qc_twoway_fwd_suffix_is_substring(bs: Vec) -> bool { prop_suffix_is_substring(false, &bs, |n, h| TwoWay::forward(n).find(h)) } - fn qc_twoway_rev_prefix_is_substring(bs: BString) -> bool { + fn qc_twoway_rev_prefix_is_substring(bs: Vec) -> bool { prop_prefix_is_substring(true, &bs, |n, h| TwoWay::reverse(n).rfind(h)) } - fn qc_twoway_rev_suffix_is_substring(bs: BString) -> bool { + fn qc_twoway_rev_suffix_is_substring(bs: Vec) -> bool { prop_suffix_is_substring(true, &bs, |n, h| TwoWay::reverse(n).rfind(h)) } fn qc_twoway_fwd_matches_naive( - needle: BString, - haystack: BString + needle: Vec, + haystack: Vec ) -> bool { prop_matches_naive( false, @@ -125,8 +127,8 @@ } fn qc_twoway_rev_matches_naive( - needle: BString, - haystack: BString + needle: Vec, + haystack: Vec ) -> bool { prop_matches_naive( true, @@ -140,8 +142,8 @@ /// Check that every prefix of the given byte string is a substring. fn prop_prefix_is_substring( reverse: bool, - bs: &BStr, - mut search: impl FnMut(&BStr, &BStr) -> Option, + bs: &[u8], + mut search: impl FnMut(&[u8], &[u8]) -> Option, ) -> bool { if bs.is_empty() { return true; @@ -160,8 +162,8 @@ /// Check that every suffix of the given byte string is a substring. fn prop_suffix_is_substring( reverse: bool, - bs: &BStr, - mut search: impl FnMut(&BStr, &BStr) -> Option, + bs: &[u8], + mut search: impl FnMut(&[u8], &[u8]) -> Option, ) -> bool { if bs.is_empty() { return true; @@ -181,9 +183,9 @@ /// algorithm. fn prop_matches_naive( reverse: bool, - needle: &BStr, - haystack: &BStr, - mut search: impl FnMut(&BStr, &BStr) -> Option, + needle: &[u8], + haystack: &[u8], + mut search: impl FnMut(&[u8], &[u8]) -> Option, ) -> bool { if reverse { naive_rfind(needle, haystack) == search(needle, haystack) @@ -193,7 +195,7 @@ } /// Naively search forwards for the given needle in the given haystack. -fn naive_find(needle: &BStr, haystack: &BStr) -> Option { +fn naive_find(needle: &[u8], haystack: &[u8]) -> Option { if needle.is_empty() { return Some(0); } else if haystack.len() < needle.len() { @@ -208,7 +210,7 @@ } /// Naively search in reverse for the given needle in the given haystack. -fn naive_rfind(needle: &BStr, haystack: &BStr) -> Option { +fn naive_rfind(needle: &[u8], haystack: &[u8]) -> Option { if needle.is_empty() { return Some(haystack.len()); } else if haystack.len() < needle.len() { diff -Nru cargo-0.35.0/vendor/bstr/src/search/twoway.rs cargo-0.37.0/vendor/bstr/src/search/twoway.rs --- cargo-0.35.0/vendor/bstr/src/search/twoway.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/search/twoway.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,7 +1,7 @@ use core::cmp; -use bstr::BStr; -use cow::CowBStr; +use cow::CowBytes; +use ext_slice::ByteSlice; use search::prefilter::{Freqy, PrefilterState}; /// An implementation of the TwoWay substring search algorithm, with heuristics @@ -30,7 +30,7 @@ #[derive(Clone, Debug)] pub struct TwoWay<'b> { /// The needle that we're looking for. - needle: CowBStr<'b>, + needle: CowBytes<'b>, /// An implementation of a fast skip loop based on hard-coded frequency /// data. This is only used when conditions are deemed favorable. freqy: Freqy, @@ -51,14 +51,14 @@ impl<'b> TwoWay<'b> { /// Create a searcher that uses the Two-Way algorithm by searching forwards /// through any haystack. - pub fn forward(needle: &'b BStr) -> TwoWay<'b> { + pub fn forward(needle: &'b [u8]) -> TwoWay<'b> { let freqy = Freqy::forward(needle); if needle.is_empty() { return TwoWay { - needle: CowBStr::new(needle), + needle: CowBytes::new(needle), freqy, critical_pos: 0, - shift: Shift::Large { shift: 0 }, + shift: Shift::Large { shift: 0 }, }; } @@ -71,20 +71,20 @@ (max_suffix.period, max_suffix.pos) }; let shift = Shift::forward(needle, period_lower_bound, critical_pos); - let needle = CowBStr::new(needle); + let needle = CowBytes::new(needle); TwoWay { needle, freqy, critical_pos, shift } } /// Create a searcher that uses the Two-Way algorithm by searching in /// reverse through any haystack. - pub fn reverse(needle: &'b BStr) -> TwoWay<'b> { + pub fn reverse(needle: &'b [u8]) -> TwoWay<'b> { let freqy = Freqy::reverse(needle); if needle.is_empty() { return TwoWay { - needle: CowBStr::new(needle), + needle: CowBytes::new(needle), freqy, critical_pos: 0, - shift: Shift::Large { shift: 0 }, + shift: Shift::Large { shift: 0 }, }; } @@ -97,7 +97,7 @@ (max_suffix.period, max_suffix.pos) }; let shift = Shift::reverse(needle, period_lower_bound, critical_pos); - let needle = CowBStr::new(needle); + let needle = CowBytes::new(needle); TwoWay { needle, freqy, critical_pos, shift } } @@ -115,8 +115,8 @@ } /// Return the needle used by this searcher. - pub fn needle(&self) -> &BStr { - self.needle.as_bstr() + pub fn needle(&self) -> &[u8] { + self.needle.as_slice() } /// Convert this searched into an owned version, where the needle is @@ -136,7 +136,7 @@ /// /// This will automatically initialize prefilter state. This should only /// be used for one-off searches. - pub fn find(&self, haystack: &BStr) -> Option { + pub fn find(&self, haystack: &[u8]) -> Option { self.find_with(&mut self.prefilter_state(), haystack) } @@ -145,7 +145,7 @@ /// /// This will automatically initialize prefilter state. This should only /// be used for one-off searches. - pub fn rfind(&self, haystack: &BStr) -> Option { + pub fn rfind(&self, haystack: &[u8]) -> Option { self.rfind_with(&mut self.prefilter_state(), haystack) } @@ -157,7 +157,7 @@ pub fn find_with( &self, prestate: &mut PrefilterState, - haystack: &BStr, + haystack: &[u8], ) -> Option { if self.needle.is_empty() { return Some(0); @@ -184,7 +184,7 @@ pub fn rfind_with( &self, prestate: &mut PrefilterState, - haystack: &BStr, + haystack: &[u8], ) -> Option { if self.needle.is_empty() { return Some(haystack.len()); @@ -218,7 +218,7 @@ fn find_small( &self, prestate: &mut PrefilterState, - haystack: &BStr, + haystack: &[u8], period: usize, ) -> Option { if prestate.is_effective() { @@ -233,10 +233,10 @@ &self, prestate: &mut PrefilterState, prefilter: bool, - haystack: &BStr, + haystack: &[u8], period: usize, ) -> Option { - let needle = self.needle.as_bstr(); + let needle = self.needle.as_slice(); let mut pos = 0; let mut shift = 0; while pos + needle.len() <= haystack.len() { @@ -279,7 +279,7 @@ fn find_large( &self, prestate: &mut PrefilterState, - haystack: &BStr, + haystack: &[u8], shift: usize, ) -> Option { if prestate.is_effective() { @@ -294,10 +294,10 @@ &self, prestate: &mut PrefilterState, prefilter: bool, - haystack: &BStr, + haystack: &[u8], shift: usize, ) -> Option { - let needle = self.needle.as_bstr(); + let needle = self.needle.as_slice(); let mut pos = 0; while pos + needle.len() <= haystack.len() { let mut i = self.critical_pos; @@ -335,7 +335,7 @@ fn rfind_small( &self, prestate: &mut PrefilterState, - haystack: &BStr, + haystack: &[u8], period: usize, ) -> Option { if prestate.is_effective() { @@ -350,7 +350,7 @@ &self, prestate: &mut PrefilterState, prefilter: bool, - haystack: &BStr, + haystack: &[u8], period: usize, ) -> Option { let needle = &*self.needle; @@ -397,7 +397,7 @@ fn rfind_large( &self, prestate: &mut PrefilterState, - haystack: &BStr, + haystack: &[u8], shift: usize, ) -> Option { if prestate.is_effective() { @@ -412,7 +412,7 @@ &self, prestate: &mut PrefilterState, prefilter: bool, - haystack: &BStr, + haystack: &[u8], shift: usize, ) -> Option { let needle = &*self.needle; @@ -496,7 +496,7 @@ /// lexicographic suffixes, and choosing the right-most starting position. /// The lower bound on the period is then the period of the chosen suffix. fn forward( - needle: &BStr, + needle: &[u8], period_lower_bound: usize, critical_pos: usize, ) -> Shift { @@ -519,7 +519,7 @@ /// lexicographic suffixes, and choosing the left-most starting position. /// The lower bound on the period is then the period of the chosen suffix. fn reverse( - needle: &BStr, + needle: &[u8], period_lower_bound: usize, critical_pos: usize, ) -> Shift { @@ -555,7 +555,7 @@ } impl Suffix { - fn forward(needle: &BStr, kind: SuffixKind) -> Suffix { + fn forward(needle: &[u8], kind: SuffixKind) -> Suffix { debug_assert!(!needle.is_empty()); // suffix represents our maximal (or minimal) suffix, along with @@ -605,7 +605,7 @@ suffix } - fn reverse(needle: &BStr, kind: SuffixKind) -> Suffix { + fn reverse(needle: &[u8], kind: SuffixKind) -> Suffix { debug_assert!(!needle.is_empty()); // See the comments in `forward` for how this works. @@ -703,30 +703,28 @@ // N.B. There are more holistic tests in src/search/tests.rs. #[cfg(test)] mod tests { - use bstr::{B, BStr}; - use bstring::BString; - use super::*; + use ext_slice::B; /// Convenience wrapper for computing the suffix as a byte string. - fn get_suffix_forward(needle: &BStr, kind: SuffixKind) -> (&BStr, usize) { + fn get_suffix_forward(needle: &[u8], kind: SuffixKind) -> (&[u8], usize) { let s = Suffix::forward(needle, kind); (&needle[s.pos..], s.period) } /// Convenience wrapper for computing the reverse suffix as a byte string. - fn get_suffix_reverse(needle: &BStr, kind: SuffixKind) -> (&BStr, usize) { + fn get_suffix_reverse(needle: &[u8], kind: SuffixKind) -> (&[u8], usize) { let s = Suffix::reverse(needle, kind); (&needle[..s.pos], s.period) } /// Return all of the non-empty suffixes in the given byte string. - fn suffixes(bytes: &BStr) -> Vec<&BStr> { + fn suffixes(bytes: &[u8]) -> Vec<&[u8]> { (0..bytes.len()).map(|i| &bytes[i..]).collect() } /// Return the lexicographically maximal suffix of the given byte string. - fn naive_maximal_suffix_forward(needle: &BStr) -> &BStr { + fn naive_maximal_suffix_forward(needle: &[u8]) -> &[u8] { let mut sufs = suffixes(needle); sufs.sort(); sufs.pop().unwrap() @@ -734,11 +732,11 @@ /// Return the lexicographically maximal suffix of the reverse of the given /// byte string. - fn naive_maximal_suffix_reverse(needle: &BStr) -> BString { - let mut reversed = needle.to_bstring(); - reversed.reverse_bytes(); - let mut got = naive_maximal_suffix_forward(&reversed).to_bstring(); - got.reverse_bytes(); + fn naive_maximal_suffix_reverse(needle: &[u8]) -> Vec { + let mut reversed = needle.to_vec(); + reversed.reverse(); + let mut got = naive_maximal_suffix_forward(&reversed).to_vec(); + got.reverse(); got } @@ -746,20 +744,16 @@ fn suffix_forward() { macro_rules! assert_suffix_min { ($given:expr, $expected:expr, $period:expr) => { - let (got_suffix, got_period) = get_suffix_forward( - B($given), - SuffixKind::Minimal, - ); + let (got_suffix, got_period) = + get_suffix_forward($given.as_bytes(), SuffixKind::Minimal); assert_eq!((B($expected), $period), (got_suffix, got_period)); }; } macro_rules! assert_suffix_max { ($given:expr, $expected:expr, $period:expr) => { - let (got_suffix, got_period) = get_suffix_forward( - B($given), - SuffixKind::Maximal, - ); + let (got_suffix, got_period) = + get_suffix_forward($given.as_bytes(), SuffixKind::Maximal); assert_eq!((B($expected), $period), (got_suffix, got_period)); }; } @@ -805,20 +799,16 @@ fn suffix_reverse() { macro_rules! assert_suffix_min { ($given:expr, $expected:expr, $period:expr) => { - let (got_suffix, got_period) = get_suffix_reverse( - B($given), - SuffixKind::Minimal, - ); + let (got_suffix, got_period) = + get_suffix_reverse($given.as_bytes(), SuffixKind::Minimal); assert_eq!((B($expected), $period), (got_suffix, got_period)); }; } macro_rules! assert_suffix_max { ($given:expr, $expected:expr, $period:expr) => { - let (got_suffix, got_period) = get_suffix_reverse( - B($given), - SuffixKind::Maximal, - ); + let (got_suffix, got_period) = + get_suffix_reverse($given.as_bytes(), SuffixKind::Maximal); assert_eq!((B($expected), $period), (got_suffix, got_period)); }; } @@ -859,7 +849,6 @@ quickcheck! { fn qc_suffix_forward_maximal(bytes: Vec) -> bool { - let bytes = BString::from(bytes); if bytes.is_empty() { return true; } @@ -870,14 +859,13 @@ } fn qc_suffix_reverse_maximal(bytes: Vec) -> bool { - let bytes = BString::from(bytes); if bytes.is_empty() { return true; } let (got, _) = get_suffix_reverse(&bytes, SuffixKind::Maximal); let expected = naive_maximal_suffix_reverse(&bytes); - got == expected + expected == got } } } diff -Nru cargo-0.35.0/vendor/bstr/src/slice_index.rs cargo-0.37.0/vendor/bstr/src/slice_index.rs --- cargo-0.35.0/vendor/bstr/src/slice_index.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/slice_index.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,292 +0,0 @@ -use core::ops; - -use bstr::BStr; - -/// Ensure that callers cannot implement `SliceIndex` by making an -/// umplementable trait its super trait. -pub trait Sealed {} -impl Sealed for usize {} -impl Sealed for ops::Range {} -impl Sealed for ops::RangeTo {} -impl Sealed for ops::RangeFrom {} -impl Sealed for ops::RangeFull {} -impl Sealed for ops::RangeInclusive {} -impl Sealed for ops::RangeToInclusive {} - -/// A trait that parameterizes the different types of indexing a byte string. -/// -/// In general, this trait makes it possible to define generic routines like -/// `get` that can accept either single positions or ranges, and return single -/// bytes or slices, respectively. -/// -/// This trait is sealed such that callers cannot implement it. In general, -/// callers should not need to interact with this trait directly unless you're -/// defining generic functions that index or slice a byte string. -pub trait SliceIndex: Sealed { - /// The output type returned by methods. For indexing by position, this - /// is always a single byte (`u8`). For ranges, this is always a slice - /// (`BStr`). - type Output: ?Sized; - - /// Returns a shared reference to the output at this location, if in - /// bounds. - fn get(self, slice: &BStr) -> Option<&Self::Output>; - - /// Returns a mutable reference to the output at this location, if in - /// bounds. - fn get_mut(self, slice: &mut BStr) -> Option<&mut Self::Output>; - - /// Returns a shared reference to the output at this location, without - /// performing any bounds checking. - unsafe fn get_unchecked(self, slice: &BStr) -> &Self::Output; - - /// Returns a mutable reference to the output at this location, without - /// performing any bounds checking. - unsafe fn get_unchecked_mut(self, slice: &mut BStr) -> &mut Self::Output; - - /// Returns a shared reference to the output at this location, panicking - /// if out of bounds. - fn index(self, slice: &BStr) -> &Self::Output; - - /// Returns a mutable reference to the output at this location, panicking - /// if out of bounds. - fn index_mut(self, slice: &mut BStr) -> &mut Self::Output; -} - -impl SliceIndex for usize { - type Output = u8; - - #[inline] - fn get(self, slice: &BStr) -> Option<&u8> { - slice.as_bytes().get(self) - } - - #[inline] - fn get_mut(self, slice: &mut BStr) -> Option<&mut u8> { - slice.as_bytes_mut().get_mut(self) - } - - #[inline] - unsafe fn get_unchecked(self, slice: &BStr) -> &u8 { - slice.as_bytes().get_unchecked(self) - } - - #[inline] - unsafe fn get_unchecked_mut(self, slice: &mut BStr) -> &mut u8 { - slice.as_bytes_mut().get_unchecked_mut(self) - } - - #[inline] - fn index(self, slice: &BStr) -> &u8 { - &slice.as_bytes()[self] - } - - #[inline] - fn index_mut(self, slice: &mut BStr) -> &mut u8 { - &mut slice.as_bytes_mut()[self] - } -} - -impl SliceIndex for ops::Range { - type Output = BStr; - - #[inline] - fn get(self, slice: &BStr) -> Option<&BStr> { - slice.as_bytes().get(self).map(BStr::new) - } - - #[inline] - fn get_mut(self, slice: &mut BStr) -> Option<&mut BStr> { - slice.as_bytes_mut().get_mut(self).map(BStr::new_mut) - } - - #[inline] - unsafe fn get_unchecked(self, slice: &BStr) -> &BStr { - BStr::new(slice.as_bytes().get_unchecked(self)) - } - - #[inline] - unsafe fn get_unchecked_mut(self, slice: &mut BStr) -> &mut BStr { - BStr::new_mut(slice.as_bytes_mut().get_unchecked_mut(self)) - } - - #[inline] - fn index(self, slice: &BStr) -> &BStr { - &slice[self] - } - - #[inline] - fn index_mut(self, slice: &mut BStr) -> &mut BStr { - &mut slice[self] - } -} - -impl SliceIndex for ops::RangeTo { - type Output = BStr; - - #[inline] - fn get(self, slice: &BStr) -> Option<&BStr> { - slice.as_bytes().get(self).map(BStr::new) - } - - #[inline] - fn get_mut(self, slice: &mut BStr) -> Option<&mut BStr> { - slice.as_bytes_mut().get_mut(self).map(BStr::new_mut) - } - - #[inline] - unsafe fn get_unchecked(self, slice: &BStr) -> &BStr { - BStr::new(slice.as_bytes().get_unchecked(self)) - } - - #[inline] - unsafe fn get_unchecked_mut(self, slice: &mut BStr) -> &mut BStr { - BStr::new_mut(slice.as_bytes_mut().get_unchecked_mut(self)) - } - - #[inline] - fn index(self, slice: &BStr) -> &BStr { - &slice[self] - } - - #[inline] - fn index_mut(self, slice: &mut BStr) -> &mut BStr { - &mut slice[self] - } -} - -impl SliceIndex for ops::RangeFrom { - type Output = BStr; - - #[inline] - fn get(self, slice: &BStr) -> Option<&BStr> { - slice.as_bytes().get(self).map(BStr::new) - } - - #[inline] - fn get_mut(self, slice: &mut BStr) -> Option<&mut BStr> { - slice.as_bytes_mut().get_mut(self).map(BStr::new_mut) - } - - #[inline] - unsafe fn get_unchecked(self, slice: &BStr) -> &BStr { - BStr::new(slice.as_bytes().get_unchecked(self)) - } - - #[inline] - unsafe fn get_unchecked_mut(self, slice: &mut BStr) -> &mut BStr { - BStr::new_mut(slice.as_bytes_mut().get_unchecked_mut(self)) - } - - #[inline] - fn index(self, slice: &BStr) -> &BStr { - &slice[self] - } - - #[inline] - fn index_mut(self, slice: &mut BStr) -> &mut BStr { - &mut slice[self] - } -} - -impl SliceIndex for ops::RangeFull { - type Output = BStr; - - #[inline] - fn get(self, slice: &BStr) -> Option<&BStr> { - slice.as_bytes().get(self).map(BStr::new) - } - - #[inline] - fn get_mut(self, slice: &mut BStr) -> Option<&mut BStr> { - slice.as_bytes_mut().get_mut(self).map(BStr::new_mut) - } - - #[inline] - unsafe fn get_unchecked(self, slice: &BStr) -> &BStr { - BStr::new(slice.as_bytes().get_unchecked(self)) - } - - #[inline] - unsafe fn get_unchecked_mut(self, slice: &mut BStr) -> &mut BStr { - BStr::new_mut(slice.as_bytes_mut().get_unchecked_mut(self)) - } - - #[inline] - fn index(self, slice: &BStr) -> &BStr { - &slice[self] - } - - #[inline] - fn index_mut(self, slice: &mut BStr) -> &mut BStr { - &mut slice[self] - } -} - -impl SliceIndex for ops::RangeInclusive { - type Output = BStr; - - #[inline] - fn get(self, slice: &BStr) -> Option<&BStr> { - slice.as_bytes().get(self).map(BStr::new) - } - - #[inline] - fn get_mut(self, slice: &mut BStr) -> Option<&mut BStr> { - slice.as_bytes_mut().get_mut(self).map(BStr::new_mut) - } - - #[inline] - unsafe fn get_unchecked(self, slice: &BStr) -> &BStr { - BStr::new(slice.as_bytes().get_unchecked(self)) - } - - #[inline] - unsafe fn get_unchecked_mut(self, slice: &mut BStr) -> &mut BStr { - BStr::new_mut(slice.as_bytes_mut().get_unchecked_mut(self)) - } - - #[inline] - fn index(self, slice: &BStr) -> &BStr { - &slice[self] - } - - #[inline] - fn index_mut(self, slice: &mut BStr) -> &mut BStr { - &mut slice[self] - } -} - -impl SliceIndex for ops::RangeToInclusive { - type Output = BStr; - - #[inline] - fn get(self, slice: &BStr) -> Option<&BStr> { - slice.as_bytes().get(self).map(BStr::new) - } - - #[inline] - fn get_mut(self, slice: &mut BStr) -> Option<&mut BStr> { - slice.as_bytes_mut().get_mut(self).map(BStr::new_mut) - } - - #[inline] - unsafe fn get_unchecked(self, slice: &BStr) -> &BStr { - BStr::new(slice.as_bytes().get_unchecked(self)) - } - - #[inline] - unsafe fn get_unchecked_mut(self, slice: &mut BStr) -> &mut BStr { - BStr::new_mut(slice.as_bytes_mut().get_unchecked_mut(self)) - } - - #[inline] - fn index(self, slice: &BStr) -> &BStr { - &slice[self] - } - - #[inline] - fn index_mut(self, slice: &mut BStr) -> &mut BStr { - &mut slice[self] - } -} diff -Nru cargo-0.35.0/vendor/bstr/src/unicode/fsm/grapheme_break_fwd.rs cargo-0.37.0/vendor/bstr/src/unicode/fsm/grapheme_break_fwd.rs --- cargo-0.35.0/vendor/bstr/src/unicode/fsm/grapheme_break_fwd.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/unicode/fsm/grapheme_break_fwd.rs 2019-07-17 05:42:23.000000000 +0000 @@ -6,40 +6,36 @@ #[cfg(target_endian = "big")] lazy_static! { - pub static ref GRAPHEME_BREAK_FWD: ::regex_automata::SparseDFA<&'static [u8], u16> = { - #[repr(C)] - struct Aligned { - _align: [u8; 0], - bytes: B, - } - - static ALIGNED: &'static Aligned<[u8]> = &Aligned { - _align: [], - bytes: *include_bytes!("grapheme_break_fwd.bigendian.dfa"), + pub static ref GRAPHEME_BREAK_FWD: ::regex_automata::SparseDFA<&'static [u8], u16> = { + #[repr(C)] + struct Aligned { + _align: [u8; 0], + bytes: B, + } + + static ALIGNED: &'static Aligned<[u8]> = &Aligned { + _align: [], + bytes: *include_bytes!("grapheme_break_fwd.bigendian.dfa"), + }; + + unsafe { ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) } }; - - unsafe { - ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) - } - }; } #[cfg(target_endian = "little")] lazy_static! { - pub static ref GRAPHEME_BREAK_FWD: ::regex_automata::SparseDFA<&'static [u8], u16> = { - #[repr(C)] - struct Aligned { - _align: [u8; 0], - bytes: B, - } - - static ALIGNED: &'static Aligned<[u8]> = &Aligned { - _align: [], - bytes: *include_bytes!("grapheme_break_fwd.littleendian.dfa"), + pub static ref GRAPHEME_BREAK_FWD: ::regex_automata::SparseDFA<&'static [u8], u16> = { + #[repr(C)] + struct Aligned { + _align: [u8; 0], + bytes: B, + } + + static ALIGNED: &'static Aligned<[u8]> = &Aligned { + _align: [], + bytes: *include_bytes!("grapheme_break_fwd.littleendian.dfa"), + }; + + unsafe { ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) } }; - - unsafe { - ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) - } - }; } diff -Nru cargo-0.35.0/vendor/bstr/src/unicode/fsm/grapheme_break_rev.rs cargo-0.37.0/vendor/bstr/src/unicode/fsm/grapheme_break_rev.rs --- cargo-0.35.0/vendor/bstr/src/unicode/fsm/grapheme_break_rev.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/unicode/fsm/grapheme_break_rev.rs 2019-07-17 05:42:23.000000000 +0000 @@ -6,40 +6,36 @@ #[cfg(target_endian = "big")] lazy_static! { - pub static ref GRAPHEME_BREAK_REV: ::regex_automata::SparseDFA<&'static [u8], u16> = { - #[repr(C)] - struct Aligned { - _align: [u8; 0], - bytes: B, - } - - static ALIGNED: &'static Aligned<[u8]> = &Aligned { - _align: [], - bytes: *include_bytes!("grapheme_break_rev.bigendian.dfa"), + pub static ref GRAPHEME_BREAK_REV: ::regex_automata::SparseDFA<&'static [u8], u16> = { + #[repr(C)] + struct Aligned { + _align: [u8; 0], + bytes: B, + } + + static ALIGNED: &'static Aligned<[u8]> = &Aligned { + _align: [], + bytes: *include_bytes!("grapheme_break_rev.bigendian.dfa"), + }; + + unsafe { ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) } }; - - unsafe { - ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) - } - }; } #[cfg(target_endian = "little")] lazy_static! { - pub static ref GRAPHEME_BREAK_REV: ::regex_automata::SparseDFA<&'static [u8], u16> = { - #[repr(C)] - struct Aligned { - _align: [u8; 0], - bytes: B, - } - - static ALIGNED: &'static Aligned<[u8]> = &Aligned { - _align: [], - bytes: *include_bytes!("grapheme_break_rev.littleendian.dfa"), + pub static ref GRAPHEME_BREAK_REV: ::regex_automata::SparseDFA<&'static [u8], u16> = { + #[repr(C)] + struct Aligned { + _align: [u8; 0], + bytes: B, + } + + static ALIGNED: &'static Aligned<[u8]> = &Aligned { + _align: [], + bytes: *include_bytes!("grapheme_break_rev.littleendian.dfa"), + }; + + unsafe { ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) } }; - - unsafe { - ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) - } - }; } diff -Nru cargo-0.35.0/vendor/bstr/src/unicode/fsm/regional_indicator_rev.rs cargo-0.37.0/vendor/bstr/src/unicode/fsm/regional_indicator_rev.rs --- cargo-0.35.0/vendor/bstr/src/unicode/fsm/regional_indicator_rev.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/unicode/fsm/regional_indicator_rev.rs 2019-07-17 05:42:23.000000000 +0000 @@ -6,40 +6,36 @@ #[cfg(target_endian = "big")] lazy_static! { - pub static ref REGIONAL_INDICATOR_REV: ::regex_automata::DenseDFA<&'static [u8], u8> = { - #[repr(C)] - struct Aligned { - _align: [u8; 0], - bytes: B, - } - - static ALIGNED: &'static Aligned<[u8]> = &Aligned { - _align: [], - bytes: *include_bytes!("regional_indicator_rev.bigendian.dfa"), + pub static ref REGIONAL_INDICATOR_REV: ::regex_automata::DenseDFA<&'static [u8], u8> = { + #[repr(C)] + struct Aligned { + _align: [u8; 0], + bytes: B, + } + + static ALIGNED: &'static Aligned<[u8]> = &Aligned { + _align: [], + bytes: *include_bytes!("regional_indicator_rev.bigendian.dfa"), + }; + + unsafe { ::regex_automata::DenseDFA::from_bytes(&ALIGNED.bytes) } }; - - unsafe { - ::regex_automata::DenseDFA::from_bytes(&ALIGNED.bytes) - } - }; } #[cfg(target_endian = "little")] lazy_static! { - pub static ref REGIONAL_INDICATOR_REV: ::regex_automata::DenseDFA<&'static [u8], u8> = { - #[repr(C)] - struct Aligned { - _align: [u8; 0], - bytes: B, - } - - static ALIGNED: &'static Aligned<[u8]> = &Aligned { - _align: [], - bytes: *include_bytes!("regional_indicator_rev.littleendian.dfa"), + pub static ref REGIONAL_INDICATOR_REV: ::regex_automata::DenseDFA<&'static [u8], u8> = { + #[repr(C)] + struct Aligned { + _align: [u8; 0], + bytes: B, + } + + static ALIGNED: &'static Aligned<[u8]> = &Aligned { + _align: [], + bytes: *include_bytes!("regional_indicator_rev.littleendian.dfa"), + }; + + unsafe { ::regex_automata::DenseDFA::from_bytes(&ALIGNED.bytes) } }; - - unsafe { - ::regex_automata::DenseDFA::from_bytes(&ALIGNED.bytes) - } - }; } diff -Nru cargo-0.35.0/vendor/bstr/src/unicode/fsm/sentence_break_fwd.rs cargo-0.37.0/vendor/bstr/src/unicode/fsm/sentence_break_fwd.rs --- cargo-0.35.0/vendor/bstr/src/unicode/fsm/sentence_break_fwd.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/unicode/fsm/sentence_break_fwd.rs 2019-07-17 05:42:23.000000000 +0000 @@ -6,40 +6,36 @@ #[cfg(target_endian = "big")] lazy_static! { - pub static ref SENTENCE_BREAK_FWD: ::regex_automata::SparseDFA<&'static [u8], u32> = { - #[repr(C)] - struct Aligned { - _align: [u8; 0], - bytes: B, - } - - static ALIGNED: &'static Aligned<[u8]> = &Aligned { - _align: [], - bytes: *include_bytes!("sentence_break_fwd.bigendian.dfa"), + pub static ref SENTENCE_BREAK_FWD: ::regex_automata::SparseDFA<&'static [u8], u32> = { + #[repr(C)] + struct Aligned { + _align: [u8; 0], + bytes: B, + } + + static ALIGNED: &'static Aligned<[u8]> = &Aligned { + _align: [], + bytes: *include_bytes!("sentence_break_fwd.bigendian.dfa"), + }; + + unsafe { ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) } }; - - unsafe { - ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) - } - }; } #[cfg(target_endian = "little")] lazy_static! { - pub static ref SENTENCE_BREAK_FWD: ::regex_automata::SparseDFA<&'static [u8], u32> = { - #[repr(C)] - struct Aligned { - _align: [u8; 0], - bytes: B, - } - - static ALIGNED: &'static Aligned<[u8]> = &Aligned { - _align: [], - bytes: *include_bytes!("sentence_break_fwd.littleendian.dfa"), + pub static ref SENTENCE_BREAK_FWD: ::regex_automata::SparseDFA<&'static [u8], u32> = { + #[repr(C)] + struct Aligned { + _align: [u8; 0], + bytes: B, + } + + static ALIGNED: &'static Aligned<[u8]> = &Aligned { + _align: [], + bytes: *include_bytes!("sentence_break_fwd.littleendian.dfa"), + }; + + unsafe { ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) } }; - - unsafe { - ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) - } - }; } diff -Nru cargo-0.35.0/vendor/bstr/src/unicode/fsm/simple_word_fwd.rs cargo-0.37.0/vendor/bstr/src/unicode/fsm/simple_word_fwd.rs --- cargo-0.35.0/vendor/bstr/src/unicode/fsm/simple_word_fwd.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/unicode/fsm/simple_word_fwd.rs 2019-07-17 05:42:23.000000000 +0000 @@ -6,40 +6,36 @@ #[cfg(target_endian = "big")] lazy_static! { - pub static ref SIMPLE_WORD_FWD: ::regex_automata::SparseDFA<&'static [u8], u16> = { - #[repr(C)] - struct Aligned { - _align: [u8; 0], - bytes: B, - } - - static ALIGNED: &'static Aligned<[u8]> = &Aligned { - _align: [], - bytes: *include_bytes!("simple_word_fwd.bigendian.dfa"), + pub static ref SIMPLE_WORD_FWD: ::regex_automata::SparseDFA<&'static [u8], u16> = { + #[repr(C)] + struct Aligned { + _align: [u8; 0], + bytes: B, + } + + static ALIGNED: &'static Aligned<[u8]> = &Aligned { + _align: [], + bytes: *include_bytes!("simple_word_fwd.bigendian.dfa"), + }; + + unsafe { ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) } }; - - unsafe { - ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) - } - }; } #[cfg(target_endian = "little")] lazy_static! { - pub static ref SIMPLE_WORD_FWD: ::regex_automata::SparseDFA<&'static [u8], u16> = { - #[repr(C)] - struct Aligned { - _align: [u8; 0], - bytes: B, - } - - static ALIGNED: &'static Aligned<[u8]> = &Aligned { - _align: [], - bytes: *include_bytes!("simple_word_fwd.littleendian.dfa"), + pub static ref SIMPLE_WORD_FWD: ::regex_automata::SparseDFA<&'static [u8], u16> = { + #[repr(C)] + struct Aligned { + _align: [u8; 0], + bytes: B, + } + + static ALIGNED: &'static Aligned<[u8]> = &Aligned { + _align: [], + bytes: *include_bytes!("simple_word_fwd.littleendian.dfa"), + }; + + unsafe { ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) } }; - - unsafe { - ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) - } - }; } diff -Nru cargo-0.35.0/vendor/bstr/src/unicode/fsm/whitespace_anchored_fwd.rs cargo-0.37.0/vendor/bstr/src/unicode/fsm/whitespace_anchored_fwd.rs --- cargo-0.35.0/vendor/bstr/src/unicode/fsm/whitespace_anchored_fwd.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/unicode/fsm/whitespace_anchored_fwd.rs 2019-07-17 05:42:23.000000000 +0000 @@ -6,40 +6,36 @@ #[cfg(target_endian = "big")] lazy_static! { - pub static ref WHITESPACE_ANCHORED_FWD: ::regex_automata::DenseDFA<&'static [u8], u8> = { - #[repr(C)] - struct Aligned { - _align: [u8; 0], - bytes: B, - } - - static ALIGNED: &'static Aligned<[u8]> = &Aligned { - _align: [], - bytes: *include_bytes!("whitespace_anchored_fwd.bigendian.dfa"), + pub static ref WHITESPACE_ANCHORED_FWD: ::regex_automata::DenseDFA<&'static [u8], u8> = { + #[repr(C)] + struct Aligned { + _align: [u8; 0], + bytes: B, + } + + static ALIGNED: &'static Aligned<[u8]> = &Aligned { + _align: [], + bytes: *include_bytes!("whitespace_anchored_fwd.bigendian.dfa"), + }; + + unsafe { ::regex_automata::DenseDFA::from_bytes(&ALIGNED.bytes) } }; - - unsafe { - ::regex_automata::DenseDFA::from_bytes(&ALIGNED.bytes) - } - }; } #[cfg(target_endian = "little")] lazy_static! { - pub static ref WHITESPACE_ANCHORED_FWD: ::regex_automata::DenseDFA<&'static [u8], u8> = { - #[repr(C)] - struct Aligned { - _align: [u8; 0], - bytes: B, - } - - static ALIGNED: &'static Aligned<[u8]> = &Aligned { - _align: [], - bytes: *include_bytes!("whitespace_anchored_fwd.littleendian.dfa"), + pub static ref WHITESPACE_ANCHORED_FWD: ::regex_automata::DenseDFA<&'static [u8], u8> = { + #[repr(C)] + struct Aligned { + _align: [u8; 0], + bytes: B, + } + + static ALIGNED: &'static Aligned<[u8]> = &Aligned { + _align: [], + bytes: *include_bytes!("whitespace_anchored_fwd.littleendian.dfa"), + }; + + unsafe { ::regex_automata::DenseDFA::from_bytes(&ALIGNED.bytes) } }; - - unsafe { - ::regex_automata::DenseDFA::from_bytes(&ALIGNED.bytes) - } - }; } diff -Nru cargo-0.35.0/vendor/bstr/src/unicode/fsm/whitespace_anchored_rev.rs cargo-0.37.0/vendor/bstr/src/unicode/fsm/whitespace_anchored_rev.rs --- cargo-0.35.0/vendor/bstr/src/unicode/fsm/whitespace_anchored_rev.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/unicode/fsm/whitespace_anchored_rev.rs 2019-07-17 05:42:23.000000000 +0000 @@ -6,40 +6,36 @@ #[cfg(target_endian = "big")] lazy_static! { - pub static ref WHITESPACE_ANCHORED_REV: ::regex_automata::DenseDFA<&'static [u8], u8> = { - #[repr(C)] - struct Aligned { - _align: [u8; 0], - bytes: B, - } - - static ALIGNED: &'static Aligned<[u8]> = &Aligned { - _align: [], - bytes: *include_bytes!("whitespace_anchored_rev.bigendian.dfa"), + pub static ref WHITESPACE_ANCHORED_REV: ::regex_automata::DenseDFA<&'static [u8], u8> = { + #[repr(C)] + struct Aligned { + _align: [u8; 0], + bytes: B, + } + + static ALIGNED: &'static Aligned<[u8]> = &Aligned { + _align: [], + bytes: *include_bytes!("whitespace_anchored_rev.bigendian.dfa"), + }; + + unsafe { ::regex_automata::DenseDFA::from_bytes(&ALIGNED.bytes) } }; - - unsafe { - ::regex_automata::DenseDFA::from_bytes(&ALIGNED.bytes) - } - }; } #[cfg(target_endian = "little")] lazy_static! { - pub static ref WHITESPACE_ANCHORED_REV: ::regex_automata::DenseDFA<&'static [u8], u8> = { - #[repr(C)] - struct Aligned { - _align: [u8; 0], - bytes: B, - } - - static ALIGNED: &'static Aligned<[u8]> = &Aligned { - _align: [], - bytes: *include_bytes!("whitespace_anchored_rev.littleendian.dfa"), + pub static ref WHITESPACE_ANCHORED_REV: ::regex_automata::DenseDFA<&'static [u8], u8> = { + #[repr(C)] + struct Aligned { + _align: [u8; 0], + bytes: B, + } + + static ALIGNED: &'static Aligned<[u8]> = &Aligned { + _align: [], + bytes: *include_bytes!("whitespace_anchored_rev.littleendian.dfa"), + }; + + unsafe { ::regex_automata::DenseDFA::from_bytes(&ALIGNED.bytes) } }; - - unsafe { - ::regex_automata::DenseDFA::from_bytes(&ALIGNED.bytes) - } - }; } diff -Nru cargo-0.35.0/vendor/bstr/src/unicode/fsm/word_break_fwd.rs cargo-0.37.0/vendor/bstr/src/unicode/fsm/word_break_fwd.rs --- cargo-0.35.0/vendor/bstr/src/unicode/fsm/word_break_fwd.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/unicode/fsm/word_break_fwd.rs 2019-07-17 05:42:23.000000000 +0000 @@ -6,40 +6,36 @@ #[cfg(target_endian = "big")] lazy_static! { - pub static ref WORD_BREAK_FWD: ::regex_automata::SparseDFA<&'static [u8], u32> = { - #[repr(C)] - struct Aligned { - _align: [u8; 0], - bytes: B, - } - - static ALIGNED: &'static Aligned<[u8]> = &Aligned { - _align: [], - bytes: *include_bytes!("word_break_fwd.bigendian.dfa"), + pub static ref WORD_BREAK_FWD: ::regex_automata::SparseDFA<&'static [u8], u32> = { + #[repr(C)] + struct Aligned { + _align: [u8; 0], + bytes: B, + } + + static ALIGNED: &'static Aligned<[u8]> = &Aligned { + _align: [], + bytes: *include_bytes!("word_break_fwd.bigendian.dfa"), + }; + + unsafe { ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) } }; - - unsafe { - ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) - } - }; } #[cfg(target_endian = "little")] lazy_static! { - pub static ref WORD_BREAK_FWD: ::regex_automata::SparseDFA<&'static [u8], u32> = { - #[repr(C)] - struct Aligned { - _align: [u8; 0], - bytes: B, - } - - static ALIGNED: &'static Aligned<[u8]> = &Aligned { - _align: [], - bytes: *include_bytes!("word_break_fwd.littleendian.dfa"), + pub static ref WORD_BREAK_FWD: ::regex_automata::SparseDFA<&'static [u8], u32> = { + #[repr(C)] + struct Aligned { + _align: [u8; 0], + bytes: B, + } + + static ALIGNED: &'static Aligned<[u8]> = &Aligned { + _align: [], + bytes: *include_bytes!("word_break_fwd.littleendian.dfa"), + }; + + unsafe { ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) } }; - - unsafe { - ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) - } - }; } diff -Nru cargo-0.35.0/vendor/bstr/src/unicode/grapheme.rs cargo-0.37.0/vendor/bstr/src/unicode/grapheme.rs --- cargo-0.35.0/vendor/bstr/src/unicode/grapheme.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/unicode/grapheme.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,6 +1,6 @@ use regex_automata::DFA; -use bstr::BStr; +use ext_slice::ByteSlice; use unicode::fsm::grapheme_break_fwd::GRAPHEME_BREAK_FWD; use unicode::fsm::grapheme_break_rev::GRAPHEME_BREAK_REV; use unicode::fsm::regional_indicator_rev::REGIONAL_INDICATOR_REV; @@ -9,7 +9,7 @@ /// An iterator over grapheme clusters in a byte string. /// /// This iterator is typically constructed by -/// [`bstr::graphemes`](struct.BStr.html#method.graphemes). +/// [`ByteSlice::graphemes`](trait.ByteSlice.html#method.graphemes). /// /// Unicode defines a grapheme cluster as an *approximation* to a single user /// visible character. A grapheme cluster, or just "grapheme," is made up of @@ -28,11 +28,11 @@ /// [UAX #29](https://www.unicode.org/reports/tr29/tr29-33.html#Grapheme_Cluster_Boundaries). #[derive(Clone, Debug)] pub struct Graphemes<'a> { - bs: &'a BStr, + bs: &'a [u8], } impl<'a> Graphemes<'a> { - pub(crate) fn new(bs: &'a BStr) -> Graphemes<'a> { + pub(crate) fn new(bs: &'a [u8]) -> Graphemes<'a> { Graphemes { bs } } @@ -44,19 +44,19 @@ /// # Examples /// /// ``` - /// use bstr::B; + /// use bstr::ByteSlice; /// - /// let mut it = B("abc").graphemes(); + /// let mut it = b"abc".graphemes(); /// - /// assert_eq!("abc", it.as_bstr()); + /// assert_eq!(b"abc", it.as_bytes()); /// it.next(); - /// assert_eq!("bc", it.as_bstr()); + /// assert_eq!(b"bc", it.as_bytes()); /// it.next(); /// it.next(); - /// assert_eq!("", it.as_bstr()); + /// assert_eq!(b"", it.as_bytes()); /// ``` #[inline] - pub fn as_bstr(&self) -> &'a BStr { + pub fn as_bytes(&self) -> &'a [u8] { self.bs } } @@ -82,7 +82,7 @@ if size == 0 { return None; } - self.bs = &self.bs[..self.bs.len()-size]; + self.bs = &self.bs[..self.bs.len() - size]; Some(grapheme) } } @@ -91,7 +91,7 @@ /// positions. /// /// This iterator is typically constructed by -/// [`bstr::grapheme_indices`](struct.BStr.html#method.grapheme_indices). +/// [`ByteSlice::grapheme_indices`](trait.ByteSlice.html#method.grapheme_indices). /// /// Unicode defines a grapheme cluster as an *approximation* to a single user /// visible character. A grapheme cluster, or just "grapheme," is made up of @@ -118,13 +118,13 @@ /// [UAX #29](https://www.unicode.org/reports/tr29/tr29-33.html#Grapheme_Cluster_Boundaries). #[derive(Clone, Debug)] pub struct GraphemeIndices<'a> { - bs: &'a BStr, + bs: &'a [u8], forward_index: usize, reverse_index: usize, } impl<'a> GraphemeIndices<'a> { - pub(crate) fn new(bs: &'a BStr) -> GraphemeIndices<'a> { + pub(crate) fn new(bs: &'a [u8]) -> GraphemeIndices<'a> { GraphemeIndices { bs: bs, forward_index: 0, reverse_index: bs.len() } } @@ -136,19 +136,19 @@ /// # Examples /// /// ``` - /// use bstr::B; + /// use bstr::ByteSlice; /// - /// let mut it = B("abc").grapheme_indices(); + /// let mut it = b"abc".grapheme_indices(); /// - /// assert_eq!("abc", it.as_bstr()); + /// assert_eq!(b"abc", it.as_bytes()); /// it.next(); - /// assert_eq!("bc", it.as_bstr()); + /// assert_eq!(b"bc", it.as_bytes()); /// it.next(); /// it.next(); - /// assert_eq!("", it.as_bstr()); + /// assert_eq!(b"", it.as_bytes()); /// ``` #[inline] - pub fn as_bstr(&self) -> &'a BStr { + pub fn as_bytes(&self) -> &'a [u8] { self.bs } } @@ -176,7 +176,7 @@ if size == 0 { return None; } - self.bs = &self.bs[..self.bs.len()-size]; + self.bs = &self.bs[..self.bs.len() - size]; self.reverse_index -= size; Some((self.reverse_index, self.reverse_index + size, grapheme)) } @@ -188,25 +188,25 @@ /// codepoint if invalid UTF-8 was found), along with the number of bytes /// decoded in the byte string. The number of bytes decoded may not be the /// same as the length of grapheme in the case where invalid UTF-8 is found. -pub fn decode_grapheme(bs: &BStr) -> (&str, usize) { +pub fn decode_grapheme(bs: &[u8]) -> (&str, usize) { if bs.is_empty() { ("", 0) - } else if let Some(end) = GRAPHEME_BREAK_FWD.find(bs.as_bytes()) { + } else if let Some(end) = GRAPHEME_BREAK_FWD.find(bs) { // Safe because a match can only occur for valid UTF-8. let grapheme = unsafe { bs[..end].to_str_unchecked() }; (grapheme, grapheme.len()) } else { const INVALID: &'static str = "\u{FFFD}"; // No match on non-empty bytes implies we found invalid UTF-8. - let (_, size) = utf8::decode_lossy(bs.as_bytes()); + let (_, size) = utf8::decode_lossy(bs); (INVALID, size) } } -fn decode_last_grapheme(bs: &BStr) -> (&str, usize) { +fn decode_last_grapheme(bs: &[u8]) -> (&str, usize) { if bs.is_empty() { ("", 0) - } else if let Some(mut start) = GRAPHEME_BREAK_REV.rfind(bs.as_bytes()) { + } else if let Some(mut start) = GRAPHEME_BREAK_REV.rfind(bs) { start = adjust_rev_for_regional_indicator(bs, start); // Safe because a match can only occur for valid UTF-8. let grapheme = unsafe { bs[start..].to_str_unchecked() }; @@ -214,7 +214,7 @@ } else { const INVALID: &'static str = "\u{FFFD}"; // No match on non-empty bytes implies we found invalid UTF-8. - let (_, size) = utf8::decode_last_lossy(bs.as_bytes()); + let (_, size) = utf8::decode_last_lossy(bs); (INVALID, size) } } @@ -232,7 +232,7 @@ /// occur between regional indicators where it would cause an odd number of /// regional indicators to exist before the break from the *start* of the /// string. A reverse regex cannot detect this case easily without look-around. -fn adjust_rev_for_regional_indicator(mut bs: &BStr, i: usize) -> usize { +fn adjust_rev_for_regional_indicator(mut bs: &[u8], i: usize) -> usize { // All regional indicators use a 4 byte encoding, and we only care about // the case where we found a pair of regional indicators. if bs.len() - i != 8 { @@ -246,7 +246,7 @@ // regional indicator codepoints. A fix probably requires refactoring this // code a bit such that we don't rescan regional indicators. let mut count = 0; - while let Some(start) = REGIONAL_INDICATOR_REV.rfind(bs.as_bytes()) { + while let Some(start) = REGIONAL_INDICATOR_REV.rfind(bs) { bs = &bs[..start]; count += 1; } @@ -261,24 +261,24 @@ mod tests { use ucd_parse::GraphemeClusterBreakTest; - use bstr::B; - use tests::LOSSY_TESTS; use super::*; + use ext_slice::ByteSlice; + use tests::LOSSY_TESTS; #[test] fn forward_ucd() { for (i, test) in ucdtests().into_iter().enumerate() { let given = test.grapheme_clusters.concat(); - let got: Vec = Graphemes::new(B(&given)) + let got: Vec = Graphemes::new(given.as_bytes()) .map(|cluster| cluster.to_string()) .collect(); assert_eq!( test.grapheme_clusters, got, "\ngrapheme forward break test {} failed:\n\ - given: {:?}\n\ - expected: {:?}\n\ - got: {:?}\n", + given: {:?}\n\ + expected: {:?}\n\ + got: {:?}\n", i, uniescape(&given), uniescape_vec(&test.grapheme_clusters), @@ -291,7 +291,7 @@ fn reverse_ucd() { for (i, test) in ucdtests().into_iter().enumerate() { let given = test.grapheme_clusters.concat(); - let mut got: Vec = Graphemes::new(B(&given)) + let mut got: Vec = Graphemes::new(given.as_bytes()) .rev() .map(|cluster| cluster.to_string()) .collect(); @@ -300,9 +300,9 @@ test.grapheme_clusters, got, "\n\ngrapheme reverse break test {} failed:\n\ - given: {:?}\n\ - expected: {:?}\n\ - got: {:?}\n", + given: {:?}\n\ + expected: {:?}\n\ + got: {:?}\n", i, uniescape(&given), uniescape_vec(&test.grapheme_clusters), @@ -314,7 +314,7 @@ #[test] fn forward_lossy() { for &(expected, input) in LOSSY_TESTS { - let got = Graphemes::new(B(input)).collect::(); + let got = Graphemes::new(input.as_bytes()).collect::(); assert_eq!(expected, got); } } @@ -323,9 +323,8 @@ fn reverse_lossy() { for &(expected, input) in LOSSY_TESTS { let expected: String = expected.chars().rev().collect(); - let got = Graphemes::new(B(input)) - .rev() - .collect::(); + let got = + Graphemes::new(input.as_bytes()).rev().collect::(); assert_eq!(expected, got); } } @@ -340,9 +339,8 @@ /// Return all of the UCD for grapheme breaks. fn ucdtests() -> Vec { - const TESTDATA: &'static str = include_str!( - "data/GraphemeBreakTest.txt" - ); + const TESTDATA: &'static str = + include_str!("data/GraphemeBreakTest.txt"); let mut tests = vec![]; for mut line in TESTDATA.lines() { diff -Nru cargo-0.35.0/vendor/bstr/src/unicode/mod.rs cargo-0.37.0/vendor/bstr/src/unicode/mod.rs --- cargo-0.35.0/vendor/bstr/src/unicode/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/unicode/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,8 +1,8 @@ -pub use self::grapheme::{Graphemes, GraphemeIndices, decode_grapheme}; -pub use self::sentence::{Sentences, SentenceIndices}; +pub use self::grapheme::{decode_grapheme, GraphemeIndices, Graphemes}; +pub use self::sentence::{SentenceIndices, Sentences}; pub use self::whitespace::{whitespace_len_fwd, whitespace_len_rev}; pub use self::word::{ - Words, WordIndices, WordsWithBreaks, WordsWithBreakIndices, + WordIndices, Words, WordsWithBreakIndices, WordsWithBreaks, }; mod fsm; diff -Nru cargo-0.35.0/vendor/bstr/src/unicode/sentence.rs cargo-0.37.0/vendor/bstr/src/unicode/sentence.rs --- cargo-0.35.0/vendor/bstr/src/unicode/sentence.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/unicode/sentence.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,13 +1,13 @@ use regex_automata::DFA; -use bstr::BStr; +use ext_slice::ByteSlice; use unicode::fsm::sentence_break_fwd::SENTENCE_BREAK_FWD; use utf8; /// An iterator over sentences in a byte string. /// /// This iterator is typically constructed by -/// [`bstr::sentences`](struct.BStr.html#method.sentences). +/// [`ByteSlice::sentences`](trait.ByteSlice.html#method.sentences). /// /// Sentences typically include their trailing punctuation and whitespace. /// @@ -20,11 +20,11 @@ /// [UAX #29](https://www.unicode.org/reports/tr29/tr29-33.html#Sentence_Boundaries). #[derive(Clone, Debug)] pub struct Sentences<'a> { - bs: &'a BStr, + bs: &'a [u8], } impl<'a> Sentences<'a> { - pub(crate) fn new(bs: &'a BStr) -> Sentences<'a> { + pub(crate) fn new(bs: &'a [u8]) -> Sentences<'a> { Sentences { bs } } @@ -36,19 +36,19 @@ /// # Examples /// /// ``` - /// use bstr::B; + /// use bstr::ByteSlice; /// - /// let mut it = B("I want this. Not that. Right now.").sentences(); + /// let mut it = b"I want this. Not that. Right now.".sentences(); /// - /// assert_eq!("I want this. Not that. Right now.", it.as_bstr()); + /// assert_eq!(&b"I want this. Not that. Right now."[..], it.as_bytes()); /// it.next(); - /// assert_eq!("Not that. Right now.", it.as_bstr()); + /// assert_eq!(b"Not that. Right now.", it.as_bytes()); /// it.next(); /// it.next(); - /// assert_eq!("", it.as_bstr()); + /// assert_eq!(b"", it.as_bytes()); /// ``` #[inline] - pub fn as_bstr(&self) -> &'a BStr { + pub fn as_bytes(&self) -> &'a [u8] { self.bs } } @@ -70,7 +70,7 @@ /// An iterator over sentences in a byte string, along with their byte offsets. /// /// This iterator is typically constructed by -/// [`bstr::sentence_indices`](struct.BStr.html#method.sentence_indices). +/// [`ByteSlice::sentence_indices`](trait.ByteSlice.html#method.sentence_indices). /// /// Sentences typically include their trailing punctuation and whitespace. /// @@ -91,12 +91,12 @@ /// [UAX #29](https://www.unicode.org/reports/tr29/tr29-33.html#Sentence_Boundaries). #[derive(Clone, Debug)] pub struct SentenceIndices<'a> { - bs: &'a BStr, + bs: &'a [u8], forward_index: usize, } impl<'a> SentenceIndices<'a> { - pub(crate) fn new(bs: &'a BStr) -> SentenceIndices<'a> { + pub(crate) fn new(bs: &'a [u8]) -> SentenceIndices<'a> { SentenceIndices { bs: bs, forward_index: 0 } } @@ -108,19 +108,19 @@ /// # Examples /// /// ``` - /// use bstr::B; + /// use bstr::ByteSlice; /// - /// let mut it = B("I want this. Not that. Right now.").sentence_indices(); + /// let mut it = b"I want this. Not that. Right now.".sentence_indices(); /// - /// assert_eq!("I want this. Not that. Right now.", it.as_bstr()); + /// assert_eq!(&b"I want this. Not that. Right now."[..], it.as_bytes()); /// it.next(); - /// assert_eq!("Not that. Right now.", it.as_bstr()); + /// assert_eq!(b"Not that. Right now.", it.as_bytes()); /// it.next(); /// it.next(); - /// assert_eq!("", it.as_bstr()); + /// assert_eq!(b"", it.as_bytes()); /// ``` #[inline] - pub fn as_bstr(&self) -> &'a BStr { + pub fn as_bytes(&self) -> &'a [u8] { self.bs } } @@ -141,17 +141,17 @@ } } -fn decode_sentence(bs: &BStr) -> (&str, usize) { +fn decode_sentence(bs: &[u8]) -> (&str, usize) { if bs.is_empty() { ("", 0) - } else if let Some(end) = SENTENCE_BREAK_FWD.find(bs.as_bytes()) { + } else if let Some(end) = SENTENCE_BREAK_FWD.find(bs) { // Safe because a match can only occur for valid UTF-8. let sentence = unsafe { bs[..end].to_str_unchecked() }; (sentence, sentence.len()) } else { const INVALID: &'static str = "\u{FFFD}"; // No match on non-empty bytes implies we found invalid UTF-8. - let (_, size) = utf8::decode_lossy(bs.as_bytes()); + let (_, size) = utf8::decode_lossy(bs); (INVALID, size) } } @@ -160,7 +160,7 @@ mod tests { use ucd_parse::SentenceBreakTest; - use bstr::{B, BStr}; + use ext_slice::ByteSlice; #[test] fn forward_ucd() { @@ -171,11 +171,11 @@ test.sentences, got, "\n\nsentence forward break test {} failed:\n\ - given: {:?}\n\ - expected: {:?}\n\ - got: {:?}\n", + given: {:?}\n\ + expected: {:?}\n\ + got: {:?}\n", i, - BStr::new(&given), + given, strs_to_bstrs(&test.sentences), strs_to_bstrs(&got), ); @@ -195,18 +195,17 @@ } fn sentences(bytes: &[u8]) -> Vec<&str> { - BStr::new(bytes).sentences().collect() + bytes.sentences().collect() } - fn strs_to_bstrs>(strs: &[S]) -> Vec<&BStr> { - strs.iter().map(|s| B(s.as_ref())).collect() + fn strs_to_bstrs>(strs: &[S]) -> Vec<&[u8]> { + strs.iter().map(|s| s.as_ref().as_bytes()).collect() } /// Return all of the UCD for sentence breaks. fn ucdtests() -> Vec { - const TESTDATA: &'static str = include_str!( - "data/SentenceBreakTest.txt" - ); + const TESTDATA: &'static str = + include_str!("data/SentenceBreakTest.txt"); let mut tests = vec![]; for mut line in TESTDATA.lines() { diff -Nru cargo-0.35.0/vendor/bstr/src/unicode/word.rs cargo-0.37.0/vendor/bstr/src/unicode/word.rs --- cargo-0.35.0/vendor/bstr/src/unicode/word.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/unicode/word.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,6 +1,6 @@ use regex_automata::DFA; -use bstr::BStr; +use ext_slice::ByteSlice; use unicode::fsm::simple_word_fwd::SIMPLE_WORD_FWD; use unicode::fsm::word_break_fwd::WORD_BREAK_FWD; use utf8; @@ -8,7 +8,7 @@ /// An iterator over words in a byte string. /// /// This iterator is typically constructed by -/// [`bstr::words`](struct.BStr.html#method.words). +/// [`ByteSlice::words`](trait.ByteSlice.html#method.words). /// /// This is similar to the [`WordsWithBreaks`](struct.WordsWithBreaks.html) /// iterator, except it only returns elements that contain a "word" character. @@ -29,7 +29,7 @@ pub struct Words<'a>(WordsWithBreaks<'a>); impl<'a> Words<'a> { - pub(crate) fn new(bs: &'a BStr) -> Words<'a> { + pub(crate) fn new(bs: &'a [u8]) -> Words<'a> { Words(WordsWithBreaks::new(bs)) } @@ -41,20 +41,20 @@ /// # Examples /// /// ``` - /// use bstr::B; + /// use bstr::ByteSlice; /// - /// let mut it = B("foo bar baz").words(); + /// let mut it = b"foo bar baz".words(); /// - /// assert_eq!("foo bar baz", it.as_bstr()); + /// assert_eq!(b"foo bar baz", it.as_bytes()); /// it.next(); /// it.next(); - /// assert_eq!(" baz", it.as_bstr()); + /// assert_eq!(b" baz", it.as_bytes()); /// it.next(); - /// assert_eq!("", it.as_bstr()); + /// assert_eq!(b"", it.as_bytes()); /// ``` #[inline] - pub fn as_bstr(&self) -> &'a BStr { - self.0.as_bstr() + pub fn as_bytes(&self) -> &'a [u8] { + self.0.as_bytes() } } @@ -75,7 +75,7 @@ /// An iterator over words in a byte string and their byte index positions. /// /// This iterator is typically constructed by -/// [`bstr::word_indices`](struct.BStr.html#method.word_indices). +/// [`ByteSlice::word_indices`](trait.ByteSlice.html#method.word_indices). /// /// This is similar to the /// [`WordsWithBreakIndices`](struct.WordsWithBreakIndices.html) iterator, @@ -104,7 +104,7 @@ pub struct WordIndices<'a>(WordsWithBreakIndices<'a>); impl<'a> WordIndices<'a> { - pub(crate) fn new(bs: &'a BStr) -> WordIndices<'a> { + pub(crate) fn new(bs: &'a [u8]) -> WordIndices<'a> { WordIndices(WordsWithBreakIndices::new(bs)) } @@ -116,21 +116,21 @@ /// # Examples /// /// ``` - /// use bstr::B; + /// use bstr::ByteSlice; /// - /// let mut it = B("foo bar baz").word_indices(); + /// let mut it = b"foo bar baz".word_indices(); /// - /// assert_eq!("foo bar baz", it.as_bstr()); + /// assert_eq!(b"foo bar baz", it.as_bytes()); /// it.next(); /// it.next(); - /// assert_eq!(" baz", it.as_bstr()); + /// assert_eq!(b" baz", it.as_bytes()); /// it.next(); /// it.next(); - /// assert_eq!("", it.as_bstr()); + /// assert_eq!(b"", it.as_bytes()); /// ``` #[inline] - pub fn as_bstr(&self) -> &'a BStr { - self.0.as_bstr() + pub fn as_bytes(&self) -> &'a [u8] { + self.0.as_bytes() } } @@ -151,7 +151,7 @@ /// An iterator over all word breaks in a byte string. /// /// This iterator is typically constructed by -/// [`bstr::words_with_breaks`](struct.BStr.html#method.words_with_breaks). +/// [`ByteSlice::words_with_breaks`](trait.ByteSlice.html#method.words_with_breaks). /// /// This iterator yields not only all words, but the content that comes between /// words. In particular, if all elements yielded by this iterator are @@ -169,11 +169,11 @@ /// that do not use spaces between words. #[derive(Clone, Debug)] pub struct WordsWithBreaks<'a> { - bs: &'a BStr, + bs: &'a [u8], } impl<'a> WordsWithBreaks<'a> { - pub(crate) fn new(bs: &'a BStr) -> WordsWithBreaks<'a> { + pub(crate) fn new(bs: &'a [u8]) -> WordsWithBreaks<'a> { WordsWithBreaks { bs } } @@ -185,22 +185,22 @@ /// # Examples /// /// ``` - /// use bstr::B; + /// use bstr::ByteSlice; /// - /// let mut it = B("foo bar baz").words_with_breaks(); + /// let mut it = b"foo bar baz".words_with_breaks(); /// - /// assert_eq!("foo bar baz", it.as_bstr()); + /// assert_eq!(b"foo bar baz", it.as_bytes()); /// it.next(); - /// assert_eq!(" bar baz", it.as_bstr()); + /// assert_eq!(b" bar baz", it.as_bytes()); /// it.next(); /// it.next(); - /// assert_eq!(" baz", it.as_bstr()); + /// assert_eq!(b" baz", it.as_bytes()); /// it.next(); /// it.next(); - /// assert_eq!("", it.as_bstr()); + /// assert_eq!(b"", it.as_bytes()); /// ``` #[inline] - pub fn as_bstr(&self) -> &'a BStr { + pub fn as_bytes(&self) -> &'a [u8] { self.bs } } @@ -223,7 +223,7 @@ /// index positions. /// /// This iterator is typically constructed by -/// [`bstr::words_with_break_indices`](struct.BStr.html#method.words_with_break_indices). +/// [`ByteSlice::words_with_break_indices`](trait.ByteSlice.html#method.words_with_break_indices). /// /// This iterator yields not only all words, but the content that comes between /// words. In particular, if all elements yielded by this iterator are @@ -248,12 +248,12 @@ /// that do not use spaces between words. #[derive(Clone, Debug)] pub struct WordsWithBreakIndices<'a> { - bs: &'a BStr, + bs: &'a [u8], forward_index: usize, } impl<'a> WordsWithBreakIndices<'a> { - pub(crate) fn new(bs: &'a BStr) -> WordsWithBreakIndices<'a> { + pub(crate) fn new(bs: &'a [u8]) -> WordsWithBreakIndices<'a> { WordsWithBreakIndices { bs: bs, forward_index: 0 } } @@ -265,22 +265,22 @@ /// # Examples /// /// ``` - /// use bstr::B; + /// use bstr::ByteSlice; /// - /// let mut it = B("foo bar baz").words_with_break_indices(); + /// let mut it = b"foo bar baz".words_with_break_indices(); /// - /// assert_eq!("foo bar baz", it.as_bstr()); + /// assert_eq!(b"foo bar baz", it.as_bytes()); /// it.next(); - /// assert_eq!(" bar baz", it.as_bstr()); + /// assert_eq!(b" bar baz", it.as_bytes()); /// it.next(); /// it.next(); - /// assert_eq!(" baz", it.as_bstr()); + /// assert_eq!(b" baz", it.as_bytes()); /// it.next(); /// it.next(); - /// assert_eq!("", it.as_bstr()); + /// assert_eq!(b"", it.as_bytes()); /// ``` #[inline] - pub fn as_bstr(&self) -> &'a BStr { + pub fn as_bytes(&self) -> &'a [u8] { self.bs } } @@ -301,17 +301,17 @@ } } -fn decode_word(bs: &BStr) -> (&str, usize) { +fn decode_word(bs: &[u8]) -> (&str, usize) { if bs.is_empty() { ("", 0) - } else if let Some(end) = WORD_BREAK_FWD.find(bs.as_bytes()) { + } else if let Some(end) = WORD_BREAK_FWD.find(bs) { // Safe because a match can only occur for valid UTF-8. let word = unsafe { bs[..end].to_str_unchecked() }; (word, word.len()) } else { const INVALID: &'static str = "\u{FFFD}"; // No match on non-empty bytes implies we found invalid UTF-8. - let (_, size) = utf8::decode_lossy(bs.as_bytes()); + let (_, size) = utf8::decode_lossy(bs); (INVALID, size) } } @@ -320,7 +320,7 @@ mod tests { use ucd_parse::WordBreakTest; - use bstr::BStr; + use ext_slice::ByteSlice; #[test] fn forward_ucd() { @@ -331,11 +331,11 @@ test.words, got, "\n\nword forward break test {} failed:\n\ - given: {:?}\n\ - expected: {:?}\n\ - got: {:?}\n", + given: {:?}\n\ + expected: {:?}\n\ + got: {:?}\n", i, - BStr::new(&given), + given, strs_to_bstrs(&test.words), strs_to_bstrs(&got), ); @@ -350,10 +350,7 @@ #[test] fn forward_additional() { assert_eq!(vec!["a", ".", " ", "Y"], words(b"a. Y")); - assert_eq!( - vec!["r", ".", " ", "Yo"], - words(b"r. Yo") - ); + assert_eq!(vec!["r", ".", " ", "Yo"], words(b"r. Yo")); assert_eq!( vec!["whatsoever", ".", " ", "You", " ", "may"], words(b"whatsoever. You may") @@ -363,76 +360,38 @@ words(b"21stcentury'syesterday") ); - assert_eq!( - vec!["Bonta_", "'", "s"], - words(b"Bonta_'s") - ); - assert_eq!( - vec!["_vhat's"], - words(b"_vhat's") - ); - assert_eq!( - vec!["__on'anima"], - words(b"__on'anima") - ); - assert_eq!( - vec!["123_", "'", "4"], - words(b"123_'4") - ); - assert_eq!( - vec!["_123'4"], - words(b"_123'4") - ); - assert_eq!( - vec!["__12'345"], - words(b"__12'345") - ); + assert_eq!(vec!["Bonta_", "'", "s"], words(b"Bonta_'s")); + assert_eq!(vec!["_vhat's"], words(b"_vhat's")); + assert_eq!(vec!["__on'anima"], words(b"__on'anima")); + assert_eq!(vec!["123_", "'", "4"], words(b"123_'4")); + assert_eq!(vec!["_123'4"], words(b"_123'4")); + assert_eq!(vec!["__12'345"], words(b"__12'345")); assert_eq!( vec!["tomorrowat4", ":", "00", ","], words(b"tomorrowat4:00,") ); - assert_eq!( - vec!["RS1", "'", "s"], - words(b"RS1's") - ); - assert_eq!( - vec!["X38"], - words(b"X38") - ); + assert_eq!(vec!["RS1", "'", "s"], words(b"RS1's")); + assert_eq!(vec!["X38"], words(b"X38")); - assert_eq!( - vec!["4abc", ":", "00", ","], - words(b"4abc:00,") - ); - assert_eq!( - vec!["12S", "'", "1"], - words(b"12S'1") - ); - assert_eq!( - vec!["1XY"], - words(b"1XY") - ); + assert_eq!(vec!["4abc", ":", "00", ","], words(b"4abc:00,")); + assert_eq!(vec!["12S", "'", "1"], words(b"12S'1")); + assert_eq!(vec!["1XY"], words(b"1XY")); - assert_eq!( - vec!["\u{FEFF}", "Ты"], - words("\u{FEFF}Ты".as_bytes()) - ); + assert_eq!(vec!["\u{FEFF}", "Ты"], words("\u{FEFF}Ты".as_bytes())); } fn words(bytes: &[u8]) -> Vec<&str> { - BStr::new(bytes).words_with_breaks().collect() + bytes.words_with_breaks().collect() } - fn strs_to_bstrs>(strs: &[S]) -> Vec<&BStr> { - strs.iter().map(|s| BStr::new(s.as_ref())).collect() + fn strs_to_bstrs>(strs: &[S]) -> Vec<&[u8]> { + strs.iter().map(|s| s.as_ref().as_bytes()).collect() } /// Return all of the UCD for word breaks. fn ucdtests() -> Vec { - const TESTDATA: &'static str = include_str!( - "data/WordBreakTest.txt" - ); + const TESTDATA: &'static str = include_str!("data/WordBreakTest.txt"); let mut tests = vec![]; for mut line in TESTDATA.lines() { diff -Nru cargo-0.35.0/vendor/bstr/src/utf8.rs cargo-0.37.0/vendor/bstr/src/utf8.rs --- cargo-0.35.0/vendor/bstr/src/utf8.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/bstr/src/utf8.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,11 +1,10 @@ use core::char; use core::cmp; +use core::fmt; #[cfg(feature = "std")] use std::error; -use core::fmt; use ascii; -use bstr::BStr; // The UTF-8 decoder provided here is based on the one presented here: // https://bjoern.hoehrmann.de/utf-8/decoder/dfa/ @@ -40,6 +39,7 @@ const ACCEPT: usize = 12; const REJECT: usize = 0; +#[cfg_attr(rustfmt, rustfmt::skip)] static CLASSES: [u8; 256] = [ 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, @@ -51,6 +51,7 @@ 10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3, 11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8, ]; +#[cfg_attr(rustfmt, rustfmt::skip)] static STATES_FORWARD: &'static [u8] = &[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 24, 36, 60, 96, 84, 0, 0, 0, 48, 72, @@ -70,15 +71,15 @@ /// ["maximal subpart" strategy](http://www.unicode.org/review/pr-121.html). /// /// This iterator is created by the -/// [`chars`](struct.BStr.html#method.chars) method on -/// [`BStr`](struct.BStr.html). +/// [`chars`](trait.ByteSlice.html#method.chars) method provided by the +/// [`ByteSlice`](trait.ByteSlice.html) extension trait for `&[u8]`. #[derive(Clone, Debug)] pub struct Chars<'a> { - bs: &'a BStr, + bs: &'a [u8], } impl<'a> Chars<'a> { - pub(crate) fn new(bs: &'a BStr) -> Chars<'a> { + pub(crate) fn new(bs: &'a [u8]) -> Chars<'a> { Chars { bs } } @@ -90,19 +91,19 @@ /// # Examples /// /// ``` - /// use bstr::BStr; + /// use bstr::ByteSlice; /// - /// let mut chars = BStr::new("abc").chars(); + /// let mut chars = b"abc".chars(); /// - /// assert_eq!("abc", chars.as_bstr()); + /// assert_eq!(b"abc", chars.as_bytes()); /// chars.next(); - /// assert_eq!("bc", chars.as_bstr()); + /// assert_eq!(b"bc", chars.as_bytes()); /// chars.next(); /// chars.next(); - /// assert_eq!("", chars.as_bstr()); + /// assert_eq!(b"", chars.as_bytes()); /// ``` #[inline] - pub fn as_bstr(&self) -> &'a BStr { + pub fn as_bytes(&self) -> &'a [u8] { self.bs } } @@ -112,7 +113,7 @@ #[inline] fn next(&mut self) -> Option { - let (ch, size) = decode_lossy(self.bs.as_bytes()); + let (ch, size) = decode_lossy(self.bs); if size == 0 { return None; } @@ -124,11 +125,11 @@ impl<'a> DoubleEndedIterator for Chars<'a> { #[inline] fn next_back(&mut self) -> Option { - let (ch, size) = decode_last_lossy(self.bs.as_bytes()); + let (ch, size) = decode_last_lossy(self.bs); if size == 0 { return None; } - self.bs = &self.bs[..self.bs.len()-size]; + self.bs = &self.bs[..self.bs.len() - size]; Some(ch) } } @@ -149,17 +150,17 @@ /// substitute anywhere from 1 to 3 invalid bytes (inclusive). /// /// This iterator is created by the -/// [`char_indices`](struct.BStr.html#method.char_indices) method on -/// [`BStr`](struct.BStr.html). +/// [`char_indices`](trait.ByteSlice.html#method.char_indices) method provided +/// by the [`ByteSlice`](trait.ByteSlice.html) extension trait for `&[u8]`. #[derive(Clone, Debug)] pub struct CharIndices<'a> { - bs: &'a BStr, + bs: &'a [u8], forward_index: usize, reverse_index: usize, } impl<'a> CharIndices<'a> { - pub(crate) fn new(bs: &'a BStr) -> CharIndices<'a> { + pub(crate) fn new(bs: &'a [u8]) -> CharIndices<'a> { CharIndices { bs: bs, forward_index: 0, reverse_index: bs.len() } } @@ -171,19 +172,19 @@ /// # Examples /// /// ``` - /// use bstr::B; + /// use bstr::ByteSlice; /// - /// let mut it = B("abc").char_indices(); + /// let mut it = b"abc".char_indices(); /// - /// assert_eq!("abc", it.as_bstr()); + /// assert_eq!(b"abc", it.as_bytes()); /// it.next(); - /// assert_eq!("bc", it.as_bstr()); + /// assert_eq!(b"bc", it.as_bytes()); /// it.next(); /// it.next(); - /// assert_eq!("", it.as_bstr()); + /// assert_eq!(b"", it.as_bytes()); /// ``` #[inline] - pub fn as_bstr(&self) -> &'a BStr { + pub fn as_bytes(&self) -> &'a [u8] { self.bs } } @@ -194,7 +195,7 @@ #[inline] fn next(&mut self) -> Option<(usize, usize, char)> { let index = self.forward_index; - let (ch, size) = decode_lossy(self.bs.as_bytes()); + let (ch, size) = decode_lossy(self.bs); if size == 0 { return None; } @@ -207,11 +208,11 @@ impl<'a> DoubleEndedIterator for CharIndices<'a> { #[inline] fn next_back(&mut self) -> Option<(usize, usize, char)> { - let (ch, size) = decode_last_lossy(self.bs.as_bytes()); + let (ch, size) = decode_last_lossy(self.bs); if size == 0 { return None; } - self.bs = &self.bs[..self.bs.len()-size]; + self.bs = &self.bs[..self.bs.len() - size]; self.reverse_index -= size; Some((self.reverse_index, self.reverse_index + size, ch)) } @@ -221,7 +222,7 @@ /// /// This error occurs when attempting to convert a non-UTF-8 byte /// string to a Rust string that must be valid UTF-8. For example, -/// [`to_str`](struct.BStr.html#method.to_str) is one such method. +/// [`to_str`](trait.ByteSlice.html#method.to_str) is one such method. /// /// # Example /// @@ -229,7 +230,7 @@ /// but ends with a sequence that is a possible prefix of valid UTF-8. /// /// ``` -/// use bstr::B; +/// use bstr::{B, ByteSlice}; /// /// let s = B(b"foobar\xF1\x80\x80"); /// let err = s.to_str().unwrap_err(); @@ -241,9 +242,9 @@ /// invalid UTF-8. /// /// ``` -/// use bstr::B; +/// use bstr::ByteSlice; /// -/// let s = B(b"foobar\xF1\x80\x80quux"); +/// let s = b"foobar\xF1\x80\x80quux"; /// let err = s.to_str().unwrap_err(); /// assert_eq!(err.valid_up_to(), 6); /// // The error length reports the maximum number of bytes that correspond to @@ -253,14 +254,14 @@ /// // In contrast to the above which contains a single invalid prefix, /// // consider the case of multiple individal bytes that are never valid /// // prefixes. Note how the value of error_len changes! -/// let s = B(b"foobar\xFF\xFFquux"); +/// let s = b"foobar\xFF\xFFquux"; /// let err = s.to_str().unwrap_err(); /// assert_eq!(err.valid_up_to(), 6); /// assert_eq!(err.error_len(), Some(1)); /// /// // The fact that it's an invalid prefix does not change error_len even /// // when it immediately precedes the end of the string. -/// let s = B(b"foobar\xFF"); +/// let s = b"foobar\xFF"; /// let err = s.to_str().unwrap_err(); /// assert_eq!(err.valid_up_to(), 6); /// assert_eq!(err.error_len(), Some(1)); @@ -281,9 +282,9 @@ /// possibly empty prefix that is guaranteed to be valid UTF-8: /// /// ``` - /// use bstr::B; + /// use bstr::ByteSlice; /// - /// let s = B(b"foobar\xF1\x80\x80quux"); + /// let s = b"foobar\xF1\x80\x80quux"; /// let err = s.to_str().unwrap_err(); /// /// // This is guaranteed to never panic. @@ -312,7 +313,9 @@ #[cfg(feature = "std")] impl error::Error for Utf8Error { - fn description(&self) -> &str { "invalid UTF-8" } + fn description(&self) -> &str { + "invalid UTF-8" + } } impl fmt::Display for Utf8Error { @@ -341,7 +344,7 @@ // to validate as much ASCII as possible very quickly. if state == ACCEPT && b <= 0x7F - && slice.get(i+1).map_or(false, |&b| b <= 0x7F) + && slice.get(i + 1).map_or(false, |&b| b <= 0x7F) { i += ascii::first_non_ascii_byte(&slice[i..]); continue; @@ -455,9 +458,9 @@ /// codepoint: /// /// ``` -/// use bstr::decode_utf8; +/// use bstr::{B, decode_utf8}; /// -/// let mut bytes = &b"\xE2\x98\x83\xFF\xF0\x9D\x9E\x83\xE2\x98\x61"[..]; +/// let mut bytes = B(b"\xE2\x98\x83\xFF\xF0\x9D\x9E\x83\xE2\x98\x61"); /// let mut chars = vec![]; /// while !bytes.is_empty() { /// let (ch, size) = decode_utf8(bytes); @@ -529,9 +532,9 @@ /// codepoint: /// /// ```ignore -/// use bstr::decode_utf8_lossy; +/// use bstr::{B, decode_utf8_lossy}; /// -/// let mut bytes = &b"\xE2\x98\x83\xFF\xF0\x9D\x9E\x83\xE2\x98\x61"[..]; +/// let mut bytes = B(b"\xE2\x98\x83\xFF\xF0\x9D\x9E\x83\xE2\x98\x61"); /// let mut chars = vec![]; /// while !bytes.is_empty() { /// let (ch, size) = decode_utf8_lossy(bytes); @@ -582,9 +585,9 @@ /// replacement codepoint: /// /// ``` -/// use bstr::decode_last_utf8; +/// use bstr::{B, decode_last_utf8}; /// -/// let mut bytes = &b"\xE2\x98\x83\xFF\xF0\x9D\x9E\x83\xE2\x98\x61"[..]; +/// let mut bytes = B(b"\xE2\x98\x83\xFF\xF0\x9D\x9E\x83\xE2\x98\x61"); /// let mut chars = vec![]; /// while !bytes.is_empty() { /// let (ch, size) = decode_last_utf8(bytes); @@ -655,7 +658,7 @@ /// ```ignore /// use bstr::decode_last_utf8_lossy; /// -/// let mut bytes = &b"\xE2\x98\x83\xFF\xF0\x9D\x9E\x83\xE2\x98\x61"[..]; +/// let mut bytes = B(b"\xE2\x98\x83\xFF\xF0\x9D\x9E\x83\xE2\x98\x61"); /// let mut chars = vec![]; /// while !bytes.is_empty() { /// let (ch, size) = decode_last_utf8_lossy(bytes); @@ -694,7 +697,7 @@ mod tests { use std::char; - use bstr::B; + use ext_slice::{ByteSlice, B}; use tests::LOSSY_TESTS; use utf8::{self, Utf8Error}; @@ -724,15 +727,15 @@ assert_eq!(Ok(()), utf8::validate(b"abc")); assert_eq!(Ok(()), utf8::validate(b"a\xE2\x98\x83a")); assert_eq!(Ok(()), utf8::validate(b"a\xF0\x9D\x9C\xB7a")); - assert_eq!(Ok(()), utf8::validate( - b"\xE2\x98\x83\xF0\x9D\x9C\xB7", - )); - assert_eq!(Ok(()), utf8::validate( - b"a\xE2\x98\x83a\xF0\x9D\x9C\xB7a", - )); - assert_eq!(Ok(()), utf8::validate( - b"\xEF\xBF\xBD\xE2\x98\x83\xEF\xBF\xBD", - )); + assert_eq!(Ok(()), utf8::validate(b"\xE2\x98\x83\xF0\x9D\x9C\xB7",)); + assert_eq!( + Ok(()), + utf8::validate(b"a\xE2\x98\x83a\xF0\x9D\x9C\xB7a",) + ); + assert_eq!( + Ok(()), + utf8::validate(b"\xEF\xBF\xBD\xE2\x98\x83\xEF\xBF\xBD",) + ); } #[test] @@ -760,39 +763,45 @@ // overlong sequences, but that we get valid_up_to correct. assert_eq!(Err(utf8e2(0, 1)), utf8::validate(b"\xF0\x82\x82\xAC")); assert_eq!(Err(utf8e2(1, 1)), utf8::validate(b"a\xF0\x82\x82\xAC")); - assert_eq!(Err(utf8e2(3, 1)), utf8::validate( - b"\xE2\x98\x83\xF0\x82\x82\xAC", - )); + assert_eq!( + Err(utf8e2(3, 1)), + utf8::validate(b"\xE2\x98\x83\xF0\x82\x82\xAC",) + ); // Check that encoding a surrogate codepoint using the UTF-8 scheme // fails validation. assert_eq!(Err(utf8e2(0, 1)), utf8::validate(b"\xED\xA0\x80")); assert_eq!(Err(utf8e2(1, 1)), utf8::validate(b"a\xED\xA0\x80")); - assert_eq!(Err(utf8e2(3, 1)), utf8::validate( - b"\xE2\x98\x83\xED\xA0\x80", - )); + assert_eq!( + Err(utf8e2(3, 1)), + utf8::validate(b"\xE2\x98\x83\xED\xA0\x80",) + ); // Check that an incomplete 2-byte sequence fails. assert_eq!(Err(utf8e2(0, 1)), utf8::validate(b"\xCEa")); assert_eq!(Err(utf8e2(1, 1)), utf8::validate(b"a\xCEa")); - assert_eq!(Err(utf8e2(3, 1)), utf8::validate( - b"\xE2\x98\x83\xCE\xE2\x98\x83", - )); + assert_eq!( + Err(utf8e2(3, 1)), + utf8::validate(b"\xE2\x98\x83\xCE\xE2\x98\x83",) + ); // Check that an incomplete 3-byte sequence fails. assert_eq!(Err(utf8e2(0, 2)), utf8::validate(b"\xE2\x98a")); assert_eq!(Err(utf8e2(1, 2)), utf8::validate(b"a\xE2\x98a")); - assert_eq!(Err(utf8e2(3, 2)), utf8::validate( - b"\xE2\x98\x83\xE2\x98\xE2\x98\x83", - )); + assert_eq!( + Err(utf8e2(3, 2)), + utf8::validate(b"\xE2\x98\x83\xE2\x98\xE2\x98\x83",) + ); // Check that an incomplete 4-byte sequence fails. assert_eq!(Err(utf8e2(0, 3)), utf8::validate(b"\xF0\x9D\x9Ca")); assert_eq!(Err(utf8e2(1, 3)), utf8::validate(b"a\xF0\x9D\x9Ca")); - assert_eq!(Err(utf8e2(4, 3)), utf8::validate( - b"\xF0\x9D\x9C\xB1\xF0\x9D\x9C\xE2\x98\x83", - )); - assert_eq!(Err(utf8e2(6, 3)), utf8::validate( - b"foobar\xF1\x80\x80quux", - )); + assert_eq!( + Err(utf8e2(4, 3)), + utf8::validate(b"\xF0\x9D\x9C\xB1\xF0\x9D\x9C\xE2\x98\x83",) + ); + assert_eq!( + Err(utf8e2(6, 3)), + utf8::validate(b"foobar\xF1\x80\x80quux",) + ); // Check that an incomplete (EOF) 2-byte sequence fails. assert_eq!(Err(utf8e(0)), utf8::validate(b"\xCE")); @@ -805,15 +814,17 @@ // Check that an incomplete (EOF) 4-byte sequence fails. assert_eq!(Err(utf8e(0)), utf8::validate(b"\xF0\x9D\x9C")); assert_eq!(Err(utf8e(1)), utf8::validate(b"a\xF0\x9D\x9C")); - assert_eq!(Err(utf8e(4)), utf8::validate( - b"\xF0\x9D\x9C\xB1\xF0\x9D\x9C", - )); + assert_eq!( + Err(utf8e(4)), + utf8::validate(b"\xF0\x9D\x9C\xB1\xF0\x9D\x9C",) + ); // Test that we errors correct even after long valid sequences. This // checks that our "backup" logic for detecting errors is correct. - assert_eq!(Err(utf8e2(8, 1)), utf8::validate( - b"\xe2\x98\x83\xce\xb2\xe3\x83\x84\xFF", - )); + assert_eq!( + Err(utf8e2(8, 1)), + utf8::validate(b"\xe2\x98\x83\xce\xb2\xe3\x83\x84\xFF",) + ); } #[test] @@ -832,7 +843,10 @@ assert_eq!(vec!['☃', '☃'], d("☃☃")); assert_eq!(vec!['α', 'β', 'γ', 'δ', 'ε'], d("αβγδε")); assert_eq!(vec!['☃', '⛄', '⛇'], d("☃⛄⛇")); - assert_eq!(vec!['𝗮', '𝗯', '𝗰', '𝗱', '𝗲'], d("𝗮𝗯𝗰𝗱𝗲")); + assert_eq!( + vec!['𝗮', '𝗯', '𝗰', '𝗱', '𝗲'], + d("𝗮𝗯𝗰𝗱𝗲") + ); } #[test] @@ -931,7 +945,7 @@ let mut chars = vec![]; while !s.is_empty() { let (ch, size) = utf8::decode_last(s.as_bytes()); - s = &s[..s.len()-size]; + s = &s[..s.len() - size]; chars.push(ch.unwrap()); } chars @@ -941,7 +955,10 @@ assert_eq!(vec!['☃', '☃'], d("☃☃")); assert_eq!(vec!['ε', 'δ', 'γ', 'β', 'α'], d("αβγδε")); assert_eq!(vec!['⛇', '⛄', '☃'], d("☃⛄⛇")); - assert_eq!(vec!['𝗲', '𝗱', '𝗰', '𝗯', '𝗮'], d("𝗮𝗯𝗰𝗱𝗲")); + assert_eq!( + vec!['𝗲', '𝗱', '𝗰', '𝗯', '𝗮'], + d("𝗮𝗯𝗰𝗱𝗲") + ); } #[test] @@ -1076,15 +1093,15 @@ let got: String = B(input).chars().collect(); assert_eq!( expected, got, - "chars(ith: {:?}, given: {:?})", i, input, + "chars(ith: {:?}, given: {:?})", + i, input, ); - let got: String = B(input) - .char_indices() - .map(|(_, _, ch)| ch) - .collect(); + let got: String = + B(input).char_indices().map(|(_, _, ch)| ch).collect(); assert_eq!( expected, got, - "char_indices(ith: {:?}, given: {:?})", i, input, + "char_indices(ith: {:?}, given: {:?})", + i, input, ); let expected: String = expected.chars().rev().collect(); @@ -1092,16 +1109,15 @@ let got: String = B(input).chars().rev().collect(); assert_eq!( expected, got, - "chars.rev(ith: {:?}, given: {:?})", i, input, + "chars.rev(ith: {:?}, given: {:?})", + i, input, ); - let got: String = B(input) - .char_indices() - .rev() - .map(|(_, _, ch)| ch) - .collect(); + let got: String = + B(input).char_indices().rev().map(|(_, _, ch)| ch).collect(); assert_eq!( expected, got, - "char_indices.rev(ith: {:?}, given: {:?})", i, input, + "char_indices.rev(ith: {:?}, given: {:?})", + i, input, ); } } diff -Nru cargo-0.35.0/vendor/byteorder/.cargo-checksum.json cargo-0.37.0/vendor/byteorder/.cargo-checksum.json --- cargo-0.35.0/vendor/byteorder/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/byteorder/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb"} \ No newline at end of file +{"files":{},"package":"a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/byteorder/Cargo.toml cargo-0.37.0/vendor/byteorder/Cargo.toml --- cargo-0.35.0/vendor/byteorder/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/byteorder/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,7 +12,7 @@ [package] name = "byteorder" -version = "1.3.1" +version = "1.3.2" authors = ["Andrew Gallant "] build = "build.rs" exclude = ["/ci/*"] @@ -30,6 +30,9 @@ [lib] name = "byteorder" bench = false +[dev-dependencies.doc-comment] +version = "0.3" + [dev-dependencies.quickcheck] version = "0.8" default-features = false diff -Nru cargo-0.35.0/vendor/byteorder/README.md cargo-0.37.0/vendor/byteorder/README.md --- cargo-0.35.0/vendor/byteorder/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/byteorder/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -1,5 +1,5 @@ -This crate provides convenience methods for encoding and decoding numbers in -either big-endian or little-endian order. +This crate provides convenience methods for encoding and decoding +numbers in either big-endian or little-endian order. [![Build status](https://api.travis-ci.org/BurntSushi/byteorder.svg)](https://travis-ci.org/BurntSushi/byteorder) [![](http://meritbadge.herokuapp.com/byteorder)](https://crates.io/crates/byteorder) @@ -54,3 +54,10 @@ [dependencies] byteorder = { version = "1", default-features = false } ``` + + +### Alternatives + +Note that as of Rust 1.32, the standard numeric types provide built-in methods +like `to_le_bytes` and `from_le_bytes`, which support some of the same use +cases. diff -Nru cargo-0.35.0/vendor/byteorder/src/io.rs cargo-0.37.0/vendor/byteorder/src/io.rs --- cargo-0.35.0/vendor/byteorder/src/io.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/byteorder/src/io.rs 2019-07-17 05:42:23.000000000 +0000 @@ -685,6 +685,42 @@ Ok(()) } + /// Reads a sequence of signed 8 bit integers from the underlying reader. + /// + /// The given buffer is either filled completely or an error is returned. + /// If an error is returned, the contents of `dst` are unspecified. + /// + /// Note that since each `i8` is a single byte, no byte order conversions + /// are used. This method is included because it provides a safe, simple + /// way for the caller to read into a `&mut [i8]` buffer. (Without this + /// method, the caller would have to either use `unsafe` code or convert + /// each byte to `i8` individually.) + /// + /// # Errors + /// + /// This method returns the same errors as [`Read::read_exact`]. + /// + /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact + /// + /// # Examples + /// + /// Read a sequence of signed 8 bit integers from a `Read`: + /// + /// ```rust + /// use std::io::Cursor; + /// use byteorder::{BigEndian, ReadBytesExt}; + /// + /// let mut rdr = Cursor::new(vec![2, 251, 3]); + /// let mut dst = [0; 3]; + /// rdr.read_i8_into(&mut dst).unwrap(); + /// assert_eq!([2, -5, 3], dst); + /// ``` + #[inline] + fn read_i8_into(&mut self, dst: &mut [i8]) -> Result<()> { + let buf = unsafe { slice_to_u8_mut(dst) }; + self.read_exact(buf) + } + /// Reads a sequence of signed 16 bit integers from the underlying /// reader. /// diff -Nru cargo-0.35.0/vendor/byteorder/src/lib.rs cargo-0.37.0/vendor/byteorder/src/lib.rs --- cargo-0.35.0/vendor/byteorder/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/byteorder/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,6 +1,6 @@ /*! -This crate provides convenience methods for encoding and decoding numbers -in either [big-endian or little-endian order]. +This crate provides convenience methods for encoding and decoding numbers in +either [big-endian or little-endian order]. The organization of the crate is pretty simple. A trait, [`ByteOrder`], specifies byte conversion methods for each type of number in Rust (sans numbers that have @@ -49,6 +49,12 @@ This crate can also be used without the standard library. +# Alternatives + +Note that as of Rust 1.32, the standard numeric types provide built-in methods +like `to_le_bytes` and `from_le_bytes`, which support some of the same use +cases. + [big-endian or little-endian order]: https://en.wikipedia.org/wiki/Endianness [`ByteOrder`]: trait.ByteOrder.html [`BigEndian`]: enum.BigEndian.html @@ -67,6 +73,13 @@ #[cfg(feature = "std")] extern crate core; +#[cfg(test)] +#[macro_use] +extern crate doc_comment; + +#[cfg(test)] +doctest!("../README.md"); + use core::fmt::Debug; use core::hash::Hash; use core::ptr::copy_nonoverlapping; @@ -200,8 +213,8 @@ /// use byteorder::{ByteOrder, BigEndian}; /// /// let mut buf = [0; 2]; -/// BigEndian::write_i16(&mut buf, -50_000); -/// assert_eq!(-50_000, BigEndian::read_i16(&buf)); +/// BigEndian::write_i16(&mut buf, -5_000); +/// assert_eq!(-5_000, BigEndian::read_i16(&buf)); /// ``` /// /// [`BigEndian`]: enum.BigEndian.html @@ -372,8 +385,8 @@ /// use byteorder::{ByteOrder, LittleEndian}; /// /// let mut buf = [0; 2]; - /// LittleEndian::write_u16(&mut buf, 1_000_000); - /// assert_eq!(1_000_000, LittleEndian::read_u16(&buf)); + /// LittleEndian::write_u16(&mut buf, 1_000); + /// assert_eq!(1_000, LittleEndian::read_u16(&buf)); /// ``` fn write_u16(buf: &mut [u8], n: u16); @@ -1079,7 +1092,7 @@ /// use byteorder::{ByteOrder, LittleEndian}; /// /// let mut bytes = [0; 8]; - /// let numbers_given = [1, 2, 0xf00f, 0xffee]; + /// let numbers_given = [1, 2, 0x0f, 0xee]; /// LittleEndian::write_i16_into(&numbers_given, &mut bytes); /// /// let mut numbers_got = [0; 4]; @@ -1258,7 +1271,7 @@ /// use byteorder::{ByteOrder, LittleEndian}; /// /// let mut bytes = [0; 32]; - /// let numbers_given = [1.0, 2.0, 31.312e311, -11.32e91]; + /// let numbers_given = [1.0, 2.0, 31.312e211, -11.32e91]; /// LittleEndian::write_f64_into(&numbers_given, &mut bytes); /// /// let mut numbers_got = [0.0; 4]; @@ -1292,7 +1305,7 @@ /// use byteorder::{ByteOrder, LittleEndian}; /// /// let mut bytes = [0; 32]; - /// let numbers_given = [1.0, 2.0, 31.312e311, -11.32e91]; + /// let numbers_given = [1.0, 2.0, 31.312e211, -11.32e91]; /// LittleEndian::write_f64_into(&numbers_given, &mut bytes); /// /// let mut numbers_got = [0.0; 4]; @@ -1412,7 +1425,7 @@ /// use byteorder::{ByteOrder, LittleEndian}; /// /// let mut bytes = [0; 8]; - /// let numbers_given = [1, 2, 0xf00f, 0xffee]; + /// let numbers_given = [1, 2, 0x0f, 0xee]; /// LittleEndian::write_i16_into(&numbers_given, &mut bytes); /// /// let mut numbers_got = [0; 4]; @@ -1557,7 +1570,7 @@ /// use byteorder::{ByteOrder, LittleEndian}; /// /// let mut bytes = [0; 32]; - /// let numbers_given = [1.0, 2.0, 31.312e311, -11.32e91]; + /// let numbers_given = [1.0, 2.0, 31.312e211, -11.32e91]; /// LittleEndian::write_f64_into(&numbers_given, &mut bytes); /// /// let mut numbers_got = [0.0; 4]; @@ -1663,9 +1676,9 @@ /// ```rust /// use byteorder::{ByteOrder, BigEndian}; /// - /// let mut numbers = [5, 65000]; + /// let mut numbers = [5, 6500]; /// BigEndian::from_slice_i16(&mut numbers); - /// assert_eq!(numbers, [5i16.to_be(), 65000i16.to_be()]); + /// assert_eq!(numbers, [5i16.to_be(), 6500i16.to_be()]); /// ``` #[inline] fn from_slice_i16(src: &mut [i16]) { @@ -1845,8 +1858,8 @@ /// use byteorder::{ByteOrder, NetworkEndian, BigEndian}; /// /// let mut buf = [0; 2]; -/// BigEndian::write_i16(&mut buf, -50_000); -/// assert_eq!(-50_000, NetworkEndian::read_i16(&buf)); +/// BigEndian::write_i16(&mut buf, -5_000); +/// assert_eq!(-5_000, NetworkEndian::read_i16(&buf)); /// ``` /// /// [`BigEndian`]: enum.BigEndian.html diff -Nru cargo-0.35.0/vendor/c2-chacha/benches/chacha20.rs cargo-0.37.0/vendor/c2-chacha/benches/chacha20.rs --- cargo-0.35.0/vendor/c2-chacha/benches/chacha20.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/c2-chacha/benches/chacha20.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,20 @@ +#![feature(test)] +extern crate c2_chacha; +extern crate stream_cipher; +extern crate test; + +use c2_chacha::ChaCha20; +use stream_cipher::{NewStreamCipher, SyncStreamCipher}; +use test::Bencher; + +#[bench] +pub fn stream_10k(b: &mut Bencher) { + let mut state = ChaCha20::new_var(&[0; 32], &[0; 8]).unwrap(); + let mut result = [0; 1024]; + b.iter(|| { + for _ in 0..10 { + state.apply_keystream(&mut result) + } + }); + b.bytes = 10240; +} diff -Nru cargo-0.35.0/vendor/c2-chacha/benches/machine.rs cargo-0.37.0/vendor/c2-chacha/benches/machine.rs --- cargo-0.35.0/vendor/c2-chacha/benches/machine.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/c2-chacha/benches/machine.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,39 @@ +#![feature(test)] +extern crate c2_chacha; +extern crate stream_cipher; +extern crate test; + +use c2_chacha::simd::machine::x86; +use c2_chacha::simd::Machine; +use c2_chacha::ChaChaState; +use test::Bencher; + +macro_rules! mach_bench { + ($MachName:ident, $feature:expr, $enable:expr) => { + #[allow(non_snake_case)] + #[bench] + pub fn $MachName(b: &mut Bencher) { + if !$enable { + return; + } + let m = unsafe { x86::$MachName::instance() }; + let z = m + .vec::<::u64x2, _>([0x0, 0x0]) + .into(); + let mut state = ChaChaState { b: z, c: z, d: z }; + let mut out = [0; 256]; + #[target_feature(enable = $feature)] + unsafe fn runner(m: M, state: &mut ChaChaState, out: &mut [u8; 256]) { + c2_chacha::refill_wide_impl(m, state, 40 * 20 / 2, out) + } + b.iter(|| unsafe { runner(m, &mut state, &mut out) }); + b.bytes = 10240; + } + }; +} + +mach_bench!(SSE2, "sse2", is_x86_feature_detected!("sse2")); +mach_bench!(SSSE3, "ssse3", is_x86_feature_detected!("ssse3")); +mach_bench!(SSE41, "sse4.1", is_x86_feature_detected!("sse4.1")); +mach_bench!(AVX, "avx", is_x86_feature_detected!("avx")); +mach_bench!(AVX2, "avx2", is_x86_feature_detected!("avx2")); diff -Nru cargo-0.35.0/vendor/c2-chacha/.cargo-checksum.json cargo-0.37.0/vendor/c2-chacha/.cargo-checksum.json --- cargo-0.35.0/vendor/c2-chacha/.cargo-checksum.json 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/c2-chacha/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +{"files":{},"package":"7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/c2-chacha/Cargo.toml cargo-0.37.0/vendor/c2-chacha/Cargo.toml --- cargo-0.35.0/vendor/c2-chacha/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/c2-chacha/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,49 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# 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] +edition = "2018" +name = "c2-chacha" +version = "0.2.2" +authors = ["The CryptoCorrosion Contributors"] +description = "The ChaCha family of stream ciphers" +documentation = "https://docs.rs/c2-chacha" +readme = "README.md" +keywords = ["chacha", "chacha20", "xchacha20", "cipher", "crypto"] +categories = ["cryptography", "no-std"] +license = "MIT/Apache-2.0" +repository = "https://github.com/cryptocorrosion/cryptocorrosion" +[dependencies.byteorder] +version = "1.3" +optional = true + +[dependencies.lazy_static] +version = "1.2" +optional = true + +[dependencies.ppv-lite86] +version = "0.2.1" +package = "ppv-lite86" + +[dependencies.stream-cipher] +version = "0.3" +optional = true +[dev-dependencies.hex-literal] +version = "0.1" + +[features] +default = ["std", "simd", "rustcrypto_api"] +rustcrypto_api = ["stream-cipher", "byteorder"] +simd = ["ppv-lite86/simd"] +std = ["lazy_static"] +[badges.travis-ci] +repository = "cryptocorrosion/cryptocorrosion" diff -Nru cargo-0.35.0/vendor/c2-chacha/LICENSE-APACHE cargo-0.37.0/vendor/c2-chacha/LICENSE-APACHE --- cargo-0.35.0/vendor/c2-chacha/LICENSE-APACHE 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/c2-chacha/LICENSE-APACHE 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor 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, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2019 The CryptoCorrosion Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff -Nru cargo-0.35.0/vendor/c2-chacha/LICENSE-MIT cargo-0.37.0/vendor/c2-chacha/LICENSE-MIT --- cargo-0.35.0/vendor/c2-chacha/LICENSE-MIT 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/c2-chacha/LICENSE-MIT 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,25 @@ +Copyright (c) 2019 The CryptoCorrosion Contributors + +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 +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff -Nru cargo-0.35.0/vendor/c2-chacha/README.md cargo-0.37.0/vendor/c2-chacha/README.md --- cargo-0.35.0/vendor/c2-chacha/README.md 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/c2-chacha/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,24 @@ +# The ChaCha family of stream ciphers + +## Features + +- pure Rust implementation +- supports the RustCrypto API +- builds on stable Rust +- portable +- fast: within 15% of throughput of a hand-optimized ASM SIMD implementation + (floodberry/chacha-opt) on my machine (a Xeon X5650, using ppv-lite86) +- no-std compatible (std required only for runtime algorithm selection) + +## Supported Variants + +ChaCha20: used in chacha20-poly1305 in TLS, OpenSSH; arc4random in the BSDs, +Linux /dev/urandom since 4.8. + +Ietf: IETF RFC 7539. Longer nonce, short block counter. + +XChaCha20: constructed analogously to XSalsa20; a mixing step during +initialization allows using a long nonce and along with a full-sized block +counter. + +ChaCha12, ChaCha8: faster; lower security margin of safety. diff -Nru cargo-0.35.0/vendor/c2-chacha/src/guts.rs cargo-0.37.0/vendor/c2-chacha/src/guts.rs --- cargo-0.35.0/vendor/c2-chacha/src/guts.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/c2-chacha/src/guts.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,299 @@ +#[cfg(feature = "rustcrypto_api")] +pub use stream_cipher::generic_array; + +pub use ppv_lite86::Machine; +use ppv_lite86::{vec128_storage, ArithOps, BitOps32, LaneWords4, MultiLane, StoreBytes, Vec4}; + +pub(crate) const BLOCK: usize = 64; +pub(crate) const BLOCK64: u64 = BLOCK as u64; +const LOG2_BUFBLOCKS: u64 = 2; +const BUFBLOCKS: u64 = 1 << LOG2_BUFBLOCKS; +pub(crate) const BUFSZ64: u64 = BLOCK64 * BUFBLOCKS; +pub(crate) const BUFSZ: usize = BUFSZ64 as usize; + +#[derive(Clone)] +pub struct ChaCha { + pub(crate) b: vec128_storage, + pub(crate) c: vec128_storage, + pub(crate) d: vec128_storage, +} + +#[derive(Clone)] +pub struct State { + pub(crate) a: V, + pub(crate) b: V, + pub(crate) c: V, + pub(crate) d: V, +} + +#[inline(always)] +pub(crate) fn round(mut x: State) -> State { + x.a += x.b; + x.d = (x.d ^ x.a).rotate_each_word_right16(); + x.c += x.d; + x.b = (x.b ^ x.c).rotate_each_word_right20(); + x.a += x.b; + x.d = (x.d ^ x.a).rotate_each_word_right24(); + x.c += x.d; + x.b = (x.b ^ x.c).rotate_each_word_right25(); + x +} + +#[inline(always)] +pub(crate) fn diagonalize(mut x: State) -> State { + x.b = x.b.shuffle_lane_words3012(); + x.c = x.c.shuffle_lane_words2301(); + x.d = x.d.shuffle_lane_words1230(); + x +} +#[inline(always)] +pub(crate) fn undiagonalize(mut x: State) -> State { + x.b = x.b.shuffle_lane_words1230(); + x.c = x.c.shuffle_lane_words2301(); + x.d = x.d.shuffle_lane_words3012(); + x +} + +impl ChaCha { + #[inline(always)] + pub fn new(key: &[u8; 32], nonce: &[u8]) -> Self { + init_chacha(key, nonce) + } + + #[inline(always)] + fn pos64(&self, m: M) -> u64 { + let d: M::u32x4 = m.unpack(self.d); + ((d.extract(1) as u64) << 32) | d.extract(0) as u64 + } + + /// Set 64-bit block count, affecting next refill. + #[inline(always)] + pub(crate) fn seek64(&mut self, m: M, blockct: u64) { + let d: M::u32x4 = m.unpack(self.d); + self.d = d + .insert((blockct >> 32) as u32, 1) + .insert(blockct as u32, 0) + .into(); + } + + /// Set 32-bit block count, affecting next refill. + #[inline(always)] + pub(crate) fn seek32(&mut self, m: M, blockct: u32) { + let d: M::u32x4 = m.unpack(self.d); + self.d = d.insert(blockct, 0).into(); + } + + /// Produce output from the current state. + #[inline(always)] + fn output_narrow(&mut self, m: M, x: State, out: &mut [u8; BLOCK]) { + let k = m.vec([0x6170_7865, 0x3320_646e, 0x7962_2d32, 0x6b20_6574]); + (x.a + k).write_le(&mut out[0..16]); + (x.b + m.unpack(self.b)).write_le(&mut out[16..32]); + (x.c + m.unpack(self.c)).write_le(&mut out[32..48]); + (x.d + m.unpack(self.d)).write_le(&mut out[48..64]); + } + + /// Add one to the block counter (no overflow check). + #[inline(always)] + fn inc_block_ct(&mut self, m: M) { + let mut pos = self.pos64(m); + let d0: M::u32x4 = m.unpack(self.d); + pos += 1; + let d1 = d0.insert((pos >> 32) as u32, 1).insert(pos as u32, 0); + self.d = d1.into(); + } + + /// Produce 4 blocks of output, advancing the state + #[inline(always)] + pub fn refill4(&mut self, drounds: u32, out: &mut [u8; BUFSZ]) { + refill_wide(self, drounds, out) + } + + /// Produce a block of output, advancing the state + #[inline(always)] + pub fn refill(&mut self, drounds: u32, out: &mut [u8; BLOCK]) { + refill_narrow(self, drounds, out) + } + + #[inline(always)] + pub(crate) fn refill_rounds(&mut self, drounds: u32) -> State { + refill_narrow_rounds(self, drounds) + } + + #[inline(always)] + pub fn set_stream_param(&mut self, param: u32, value: u64) { + set_stream_param(self, param, value) + } + + #[inline(always)] + pub fn get_stream_param(&self, param: u32) -> u64 { + get_stream_param(self, param) + } +} + +#[inline(always)] +fn refill_wide_impl( + m: Mach, + state: &mut ChaCha, + drounds: u32, + out: &mut [u8; BUFSZ], +) { + let k = m.vec([0x6170_7865, 0x3320_646e, 0x7962_2d32, 0x6b20_6574]); + let mut pos = state.pos64(m); + let d0: Mach::u32x4 = m.unpack(state.d); + pos += 1; + let d1 = d0.insert((pos >> 32) as u32, 1).insert(pos as u32, 0); + pos += 1; + let d2 = d0.insert((pos >> 32) as u32, 1).insert(pos as u32, 0); + pos += 1; + let d3 = d0.insert((pos >> 32) as u32, 1).insert(pos as u32, 0); + + let b = m.unpack(state.b); + let c = m.unpack(state.c); + let mut x = State { + a: Mach::u32x4x4::from_lanes([k, k, k, k]), + b: Mach::u32x4x4::from_lanes([b, b, b, b]), + c: Mach::u32x4x4::from_lanes([c, c, c, c]), + d: m.unpack(Mach::u32x4x4::from_lanes([d0, d1, d2, d3]).into()), + }; + for _ in 0..drounds { + x = round(x); + x = undiagonalize(round(diagonalize(x))); + } + let mut pos = state.pos64(m); + let d0: Mach::u32x4 = m.unpack(state.d); + pos += 1; + let d1 = d0.insert((pos >> 32) as u32, 1).insert(pos as u32, 0); + pos += 1; + let d2 = d0.insert((pos >> 32) as u32, 1).insert(pos as u32, 0); + pos += 1; + let d3 = d0.insert((pos >> 32) as u32, 1).insert(pos as u32, 0); + pos += 1; + let d4 = d0.insert((pos >> 32) as u32, 1).insert(pos as u32, 0); + + let (a, b, c, d) = ( + x.a.to_lanes(), + x.b.to_lanes(), + x.c.to_lanes(), + x.d.to_lanes(), + ); + let sb = m.unpack(state.b); + let sc = m.unpack(state.c); + let sd = [m.unpack(state.d), d1, d2, d3]; + state.d = d4.into(); + let mut words = out.chunks_exact_mut(16); + for ((((&a, &b), &c), &d), &sd) in a.iter().zip(&b).zip(&c).zip(&d).zip(&sd) { + (a + k).write_le(words.next().unwrap()); + (b + sb).write_le(words.next().unwrap()); + (c + sc).write_le(words.next().unwrap()); + (d + sd).write_le(words.next().unwrap()); + } +} + +dispatch!(m, Mach, { + fn refill_wide(state: &mut ChaCha, drounds: u32, out: &mut [u8; BUFSZ]) { + refill_wide_impl(m, state, drounds, out); + } +}); + +/// Refill the buffer from a single-block round, updating the block count. +dispatch_light128!(m, Mach, { + fn refill_narrow(state: &mut ChaCha, drounds: u32, out: &mut [u8; BLOCK]) { + let x = refill_narrow_rounds(state, drounds); + let x = State { + a: m.unpack(x.a), + b: m.unpack(x.b), + c: m.unpack(x.c), + d: m.unpack(x.d), + }; + state.output_narrow(m, x, out); + state.inc_block_ct(m); + } +}); + +/// Single-block, rounds-only; shared by try_apply_keystream for tails shorter than BUFSZ +/// and XChaCha's setup step. +dispatch!(m, Mach, { + fn refill_narrow_rounds(state: &mut ChaCha, drounds: u32) -> State { + let k: Mach::u32x4 = m.vec([0x6170_7865, 0x3320_646e, 0x7962_2d32, 0x6b20_6574]); + let mut x = State { + a: k, + b: m.unpack(state.b), + c: m.unpack(state.c), + d: m.unpack(state.d), + }; + for _ in 0..drounds { + x = round(x); + x = undiagonalize(round(diagonalize(x))); + } + State { + a: x.a.into(), + b: x.b.into(), + c: x.c.into(), + d: x.d.into(), + } + } +}); + +dispatch_light128!(m, Mach, { + fn set_stream_param(state: &mut ChaCha, param: u32, value: u64) { + let d: Mach::u32x4 = m.unpack(state.d); + state.d = d + .insert((value >> 32) as u32, (param << 1) | 1) + .insert(value as u32, param << 1) + .into(); + } +}); + +dispatch_light128!(m, Mach, { + fn get_stream_param(state: &ChaCha, param: u32) -> u64 { + let d: Mach::u32x4 = m.unpack(state.d); + ((d.extract((param << 1) | 1) as u64) << 32) | d.extract(param << 1) as u64 + } +}); + +fn read_u32le(xs: &[u8]) -> u32 { + assert_eq!(xs.len(), 4); + u32::from(xs[0]) | (u32::from(xs[1]) << 8) | (u32::from(xs[2]) << 16) | (u32::from(xs[3]) << 24) +} + +dispatch_light128!(m, Mach, { + fn init_chacha(key: &[u8; 32], nonce: &[u8]) -> ChaCha { + let ctr_nonce = [ + 0, + if nonce.len() == 12 { + read_u32le(&nonce[0..4]) + } else { + 0 + }, + read_u32le(&nonce[nonce.len() - 8..nonce.len() - 4]), + read_u32le(&nonce[nonce.len() - 4..]), + ]; + let key0: Mach::u32x4 = m.read_le(&key[..16]); + let key1: Mach::u32x4 = m.read_le(&key[16..]); + ChaCha { + b: key0.into(), + c: key1.into(), + d: ctr_nonce.into(), + } + } +}); + +dispatch_light128!(m, Mach, { + fn init_chacha_x(key: &[u8; 32], nonce: &[u8; 24], rounds: u32) -> ChaCha { + let key0: Mach::u32x4 = m.read_le(&key[..16]); + let key1: Mach::u32x4 = m.read_le(&key[16..]); + let nonce0: Mach::u32x4 = m.read_le(&nonce[..16]); + let mut state = ChaCha { + b: key0.into(), + c: key1.into(), + d: nonce0.into(), + }; + let x = refill_narrow_rounds(&mut state, rounds); + let ctr_nonce1 = [0, 0, read_u32le(&nonce[16..20]), read_u32le(&nonce[20..24])]; + state.b = x.a; + state.c = x.d; + state.d = ctr_nonce1.into(); + state + } +}); diff -Nru cargo-0.35.0/vendor/c2-chacha/src/lib.rs cargo-0.37.0/vendor/c2-chacha/src/lib.rs --- cargo-0.35.0/vendor/c2-chacha/src/lib.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/c2-chacha/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,49 @@ +// copyright 2019 Kaz Wesley + +//! Pure Rust ChaCha with SIMD optimizations. +//! +//! Stream-cipher usage: +//! ``` +//! extern crate c2_chacha; +//! +//! use c2_chacha::stream_cipher::{NewStreamCipher, SyncStreamCipher, SyncStreamCipherSeek}; +//! use c2_chacha::{ChaCha20, ChaCha12}; +//! +//! let key = b"very secret key-the most secret."; +//! let iv = b"my nonce"; +//! let plaintext = b"The quick brown fox jumps over the lazy dog."; +//! +//! let mut buffer = plaintext.to_vec(); +//! // create cipher instance +//! let mut cipher = ChaCha20::new_var(key, iv).unwrap(); +//! // apply keystream (encrypt) +//! cipher.apply_keystream(&mut buffer); +//! // and decrypt it back +//! cipher.seek(0); +//! cipher.apply_keystream(&mut buffer); +//! // stream ciphers can be used with streaming messages +//! let mut cipher = ChaCha12::new_var(key, iv).unwrap(); +//! for chunk in buffer.chunks_mut(3) { +//! cipher.apply_keystream(chunk); +//! } +//! ``` + +#![cfg_attr(not(feature = "std"), no_std)] + +#[cfg(test)] +#[macro_use] +extern crate hex_literal; + +#[cfg(feature = "std")] +#[macro_use] +extern crate lazy_static; + +#[macro_use] +extern crate ppv_lite86; + +pub mod guts; + +#[cfg(feature = "rustcrypto_api")] +mod rustcrypto_impl; +#[cfg(feature = "rustcrypto_api")] +pub use self::rustcrypto_impl::{stream_cipher, ChaCha12, ChaCha20, ChaCha8, Ietf, XChaCha20}; diff -Nru cargo-0.35.0/vendor/c2-chacha/src/rustcrypto_impl.rs cargo-0.37.0/vendor/c2-chacha/src/rustcrypto_impl.rs --- cargo-0.35.0/vendor/c2-chacha/src/rustcrypto_impl.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/c2-chacha/src/rustcrypto_impl.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,548 @@ +use byteorder::{ByteOrder, LE}; +use core::cmp; +use crate::guts::generic_array::typenum::{Unsigned, U10, U12, U24, U32, U4, U6, U8}; +use crate::guts::generic_array::{ArrayLength, GenericArray}; +use crate::guts::{ChaCha, Machine, BLOCK, BLOCK64, BUFSZ}; +pub use stream_cipher; +use stream_cipher::{LoopError, NewStreamCipher, SyncStreamCipher, SyncStreamCipherSeek}; + +const BIG_LEN: u64 = 0; +const SMALL_LEN: u64 = 1 << 32; + +#[derive(Clone)] +pub struct Buffer { + pub state: ChaCha, + pub out: [u8; BLOCK], + pub have: i8, + pub len: u64, + pub fresh: bool, +} + +#[derive(Default)] +pub struct X; +#[derive(Default)] +pub struct O; +#[derive(Clone)] +pub struct ChaChaAny { + pub state: Buffer, + pub _nonce_size: NonceSize, + pub _rounds: Rounds, + pub _is_x: IsX, +} + +impl Buffer { + fn try_apply_keystream( + &mut self, + mut data: &mut [u8], + drounds: u32, + ) -> Result<(), ()> { + // Lazy fill: after a seek() we may be partway into a block we don't have yet. + // We can do this before the overflow check because this is not an effect of the current + // operation. + if self.have < 0 { + self.state.refill(drounds, &mut self.out); + self.have += BLOCK as i8; + // checked in seek() + self.len -= 1; + } + let mut have = self.have as usize; + let have_ready = cmp::min(have, data.len()); + // Check if the requested position would wrap the block counter. Use self.fresh as an extra + // bit to distinguish the initial state from the valid state with no blocks left. + let datalen = (data.len() - have_ready) as u64; + let blocks_needed = datalen / BLOCK64 + u64::from(datalen % BLOCK64 != 0); + let (l, o) = self.len.overflowing_sub(blocks_needed); + if o && !self.fresh { + return Err(()); + } + self.len = l; + self.fresh &= blocks_needed == 0; + // If we have data in the buffer, use that first. + let (d0, d1) = data.split_at_mut(have_ready); + for (data_b, key_b) in d0.iter_mut().zip(&self.out[(BLOCK - have)..]) { + *data_b ^= *key_b; + } + data = d1; + have -= have_ready; + // Process wide chunks. + if EnableWide::BOOL { + let (d0, d1) = data.split_at_mut(data.len() & !(BUFSZ - 1)); + for dd in d0.chunks_exact_mut(BUFSZ) { + let mut buf = [0; BUFSZ]; + self.state.refill4(drounds, &mut buf); + for (data_b, key_b) in dd.iter_mut().zip(buf.iter()) { + *data_b ^= *key_b; + } + } + data = d1; + } + // Handle the tail a block at a time so we'll have storage for any leftovers. + for dd in data.chunks_mut(BLOCK) { + self.state.refill(drounds, &mut self.out); + for (data_b, key_b) in dd.iter_mut().zip(self.out.iter()) { + *data_b ^= *key_b; + } + have = BLOCK - dd.len(); + } + self.have = have as i8; + Ok(()) + } +} + +dispatch_light128!(m, Mach, { + fn seek64(buf: &mut Buffer, ct: u64) { + let blockct = ct / BLOCK64; + buf.len = BIG_LEN.wrapping_sub(blockct); + buf.fresh = blockct == 0; + buf.have = -((ct % BLOCK64) as i8); + buf.state.seek64(m, blockct); + } +}); + +dispatch_light128!(m, Mach, { + fn seek32(buf: &mut Buffer, ct: u64) { + let blockct = ct / BLOCK64; + assert!(blockct < SMALL_LEN || (blockct == SMALL_LEN && ct % BLOCK64 == 0)); + buf.len = SMALL_LEN - blockct; + buf.have = -((ct % BLOCK64) as i8); + buf.state.seek32(m, blockct as u32); + } +}); + +#[cfg(test)] +impl ChaChaAny { + pub fn try_apply_keystream_narrow(&mut self, data: &mut [u8]) -> Result<(), ()> { + self.state + .try_apply_keystream::(data, Rounds::U32) + } +} + +impl ChaChaAny +where + NonceSize: Unsigned + ArrayLength + Default, + Rounds: Default, +{ + #[inline] + fn new(key: &GenericArray, nonce: &GenericArray) -> Self { + let nonce_len = nonce.len(); + ChaChaAny { + state: Buffer { + state: init_chacha(key, nonce), + out: [0; BLOCK], + have: 0, + len: if nonce_len == 12 { SMALL_LEN } else { BIG_LEN }, + fresh: nonce_len != 12, + }, + _nonce_size: Default::default(), + _rounds: Default::default(), + _is_x: Default::default(), + } + } +} + +impl ChaChaAny { + fn new(key: &GenericArray, nonce: &GenericArray) -> Self { + ChaChaAny { + state: Buffer { + state: init_chacha_x(key, nonce, Rounds::U32), + out: [0; BLOCK], + have: 0, + len: BIG_LEN, + fresh: true, + }, + _nonce_size: Default::default(), + _rounds: Default::default(), + _is_x: Default::default(), + } + } +} + +impl ChaChaAny { + #[inline(always)] + fn seek(&mut self, ct: u64) { + if NonceSize::U32 != 12 { + seek64(&mut self.state, ct); + } else { + seek32(&mut self.state, ct); + } + } +} + +impl ChaChaAny { + #[inline] + fn try_apply_keystream(&mut self, data: &mut [u8]) -> Result<(), ()> { + self.state + .try_apply_keystream::(data, Rounds::U32) + } +} + +impl NewStreamCipher for ChaChaAny +where + NonceSize: Unsigned + ArrayLength + Default, + Rounds: Default, +{ + type KeySize = U32; + type NonceSize = NonceSize; + #[inline] + fn new( + key: &GenericArray, + nonce: &GenericArray, + ) -> Self { + Self::new(key, nonce) + } +} + +impl NewStreamCipher for ChaChaAny { + type KeySize = U32; + type NonceSize = U24; + #[inline] + fn new( + key: &GenericArray, + nonce: &GenericArray, + ) -> Self { + Self::new(key, nonce) + } +} + +impl SyncStreamCipherSeek for ChaChaAny { + #[inline] + fn current_pos(&self) -> u64 { + unimplemented!() + } + #[inline(always)] + fn seek(&mut self, ct: u64) { + Self::seek(self, ct) + } +} + +impl SyncStreamCipher for ChaChaAny { + #[inline] + fn try_apply_keystream(&mut self, data: &mut [u8]) -> Result<(), LoopError> { + Self::try_apply_keystream(self, data).map_err(|_| LoopError) + } +} + +trait AsBool { + const BOOL: bool; +} +struct WideEnabled; +impl AsBool for WideEnabled { + const BOOL: bool = true; +} +#[cfg(test)] +struct WideDisabled; +#[cfg(test)] +impl AsBool for WideDisabled { + const BOOL: bool = false; +} + +dispatch_light128!(m, Mach, { + fn init_chacha(key: &GenericArray, nonce: &[u8]) -> ChaCha { + let ctr_nonce = [ + 0, + if nonce.len() == 12 { + LE::read_u32(&nonce[0..4]) + } else { + 0 + }, + LE::read_u32(&nonce[nonce.len() - 8..nonce.len() - 4]), + LE::read_u32(&nonce[nonce.len() - 4..]), + ]; + let key0: Mach::u32x4 = m.read_le(&key[..16]); + let key1: Mach::u32x4 = m.read_le(&key[16..]); + ChaCha { + b: key0.into(), + c: key1.into(), + d: ctr_nonce.into(), + } + } +}); + +dispatch_light128!(m, Mach, { + fn init_chacha_x( + key: &GenericArray, + nonce: &GenericArray, + rounds: u32, + ) -> ChaCha { + let key0: Mach::u32x4 = m.read_le(&key[..16]); + let key1: Mach::u32x4 = m.read_le(&key[16..]); + let nonce0: Mach::u32x4 = m.read_le(&nonce[..16]); + let mut state = ChaCha { + b: key0.into(), + c: key1.into(), + d: nonce0.into(), + }; + let x = state.refill_rounds(rounds); + let ctr_nonce1 = [ + 0, + 0, + LE::read_u32(&nonce[16..20]), + LE::read_u32(&nonce[20..24]), + ]; + state.b = x.a; + state.c = x.d; + state.d = ctr_nonce1.into(); + state + } +}); + +/// IETF RFC 7539 ChaCha. Unsuitable for messages longer than 256 GiB. +pub type Ietf = ChaChaAny; +/// ChaCha20, as used in several standards; from Bernstein's original publication. +pub type ChaCha20 = ChaChaAny; +/// Similar to ChaCha20, but with fewer rounds for higher performance. +pub type ChaCha12 = ChaChaAny; +/// Similar to ChaCha20, but with fewer rounds for higher performance. +pub type ChaCha8 = ChaChaAny; +/// Constructed analogously to XSalsa20; mixes during initialization to support both a long nonce +/// and a full-length (64-bit) block counter. +pub type XChaCha20 = ChaChaAny; + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn chacha20_case_1() { + let key = hex!("fa44478c59ca70538e3549096ce8b523232c50d9e8e8d10c203ef6c8d07098a5"); + let nonce = hex!("8d3a0d6d7827c007"); + let expected = hex!(" + 1546a547ff77c5c964e44fd039e913c6395c8f19d43efaa880750f6687b4e6e2d8f42f63546da2d133b5aa2f1ef3f218b6c72943089e4012 + 210c2cbed0e8e93498a6825fc8ff7a504f26db33b6cbe36299436244c9b2eff88302c55933911b7d5dea75f2b6d4761ba44bb6f814c9879d + 2ba2ac8b178fa1104a368694872339738ffb960e33db39efb8eaef885b910eea078e7a1feb3f8185dafd1455b704d76da3a0ce4760741841 + 217bba1e4ece760eaf68617133431feb806c061173af6b8b2a23be90c5d145cc258e3c119aab2800f0c7bc1959dae75481712cab731b7dfd + 783fa3a228f9968aaea68f36a92f43c9b523337a55b97bcaf5f5774447bf41e8"); + let mut state = ChaCha20::new( + GenericArray::from_slice(&key), + GenericArray::from_slice(&nonce), + ); + let offset = 0x3fffffff70u64; + assert!((offset >> 38) != ((offset + 240) >> 38)); // This will overflow the small word of the counter + state.seek(offset); + let mut result = [0; 256]; + state.apply_keystream(&mut result); + assert_eq!(&expected[..], &result[..]); + } + + #[test] + fn chacha12_case_1() { + let key = hex!("27fc120b013b829f1faeefd1ab417e8662f43e0d73f98de866e346353180fdb7"); + let nonce = hex!("db4b4a41d8df18aa"); + let expected = hex!(" + 5f3c8c190a78ab7fe808cae9cbcb0a9837c893492d963a1c2eda6c1558b02c83fc02a44cbbb7e6204d51d1c2430e9c0b58f2937bf593840c + 850bda9051a1f051ddf09d2a03ebf09f01bdba9da0b6da791b2e645641047d11ebf85087d4de5c015fddd044"); + let mut state = ChaCha12::new( + GenericArray::from_slice(&key), + GenericArray::from_slice(&nonce), + ); + let mut result = [0u8; 100]; + state.apply_keystream(&mut result); + assert_eq!(&expected[..], &result[..]); + } + + #[test] + fn chacha8_case_1() { + let key = hex!("641aeaeb08036b617a42cf14e8c5d2d115f8d7cb6ea5e28b9bfaf83e038426a7"); + let nonce = hex!("a14a1168271d459b"); + let mut state = ChaCha8::new( + GenericArray::from_slice(&key), + GenericArray::from_slice(&nonce), + ); + let expected = hex!( + "1721c044a8a6453522dddb3143d0be3512633ca3c79bf8ccc3594cb2c2f310f7bd544f55ce0db38123412d6c45207d5cf9af0c6c680cce1f + 7e43388d1b0346b7133c59fd6af4a5a568aa334ccdc38af5ace201df84d0a3ca225494ca6209345fcf30132e"); + let mut result = [0u8; 100]; + state.apply_keystream(&mut result); + assert_eq!(&expected[..], &result[..]); + } + + #[test] + fn test_ietf() { + let key = hex!("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"); + let nonce = hex!("000000090000004a00000000"); + let expected = hex!( + " + 10f1e7e4d13b5915500fdd1fa32071c4c7d1f4c733c068030422aa9ac3d46c4e + d2826446079faa0914c2d705d98b02a2b5129cd1de164eb9cbd083e8a2503c4e" + ); + let mut state = Ietf::new( + GenericArray::from_slice(&key), + GenericArray::from_slice(&nonce), + ); + let mut result = [0; 64]; + state.seek(64); + state.apply_keystream(&mut result); + assert_eq!(&expected[..], &result[..]); + } + + #[test] + fn rfc_7539_case_1() { + let key = hex!("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"); + let nonce = hex!("000000090000004a00000000"); + let mut state = Ietf::new( + GenericArray::from_slice(&key), + GenericArray::from_slice(&nonce), + ); + let mut result = [0; 128]; + state.apply_keystream(&mut result); + let expected = hex!( + "10f1e7e4d13b5915500fdd1fa32071c4c7d1f4c733c068030422aa9ac3d46c4e + d2826446079faa0914c2d705d98b02a2b5129cd1de164eb9cbd083e8a2503c4e" + ); + assert_eq!(&expected[..], &result[64..]); + } + + #[test] + fn rfc_7539_case_2() { + let key = hex!("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"); + let nonce = hex!("000000000000004a00000000"); + let mut state = Ietf::new( + GenericArray::from_slice(&key), + GenericArray::from_slice(&nonce), + ); + let plaintext = b"Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it."; + let mut buf = [0u8; 178]; + buf[64..].copy_from_slice(plaintext); + state.apply_keystream(&mut buf); + let expected = hex!(" + 6e2e359a2568f98041ba0728dd0d6981e97e7aec1d4360c20a27afccfd9fae0bf91b65c5524733ab8f593dabcd62b3571639d624e65152ab + 8f530c359f0861d807ca0dbf500d6a6156a38e088a22b65e52bc514d16ccf806818ce91ab77937365af90bbf74a35be6b40b8eedf2785e42 + 874d"); + assert_eq!(&expected[..], &buf[64..]); + } + + #[test] + fn rfc_7539_case_2_chunked() { + let key = hex!("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"); + let nonce = hex!("000000000000004a00000000"); + let mut state = Ietf::new( + GenericArray::from_slice(&key), + GenericArray::from_slice(&nonce), + ); + let plaintext = b"Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it."; + let mut buf = [0u8; 178]; + buf[64..].copy_from_slice(plaintext); + state.apply_keystream(&mut buf[..40]); + state.apply_keystream(&mut buf[40..78]); + state.apply_keystream(&mut buf[78..79]); + state.apply_keystream(&mut buf[79..128]); + state.apply_keystream(&mut buf[128..]); + let expected = hex!(" + 6e2e359a2568f98041ba0728dd0d6981e97e7aec1d4360c20a27afccfd9fae0bf91b65c5524733ab8f593dabcd62b3571639d624e65152ab + 8f530c359f0861d807ca0dbf500d6a6156a38e088a22b65e52bc514d16ccf806818ce91ab77937365af90bbf74a35be6b40b8eedf2785e42 + 874d"); + assert_eq!(&expected[..], &buf[64..]); + } + + #[test] + fn xchacha20_case_1() { + let key = hex!("82f411a074f656c66e7dbddb0a2c1b22760b9b2105f4ffdbb1d4b1e824e21def"); + let nonce = hex!("3b07ca6e729eb44a510b7a1be51847838a804f8b106b38bd"); + let mut state = XChaCha20::new( + GenericArray::from_slice(&key), + GenericArray::from_slice(&nonce), + ); + let mut xs = [0u8; 100]; + state.apply_keystream(&mut xs); + let expected = hex!(" + 201863970b8e081f4122addfdf32f6c03e48d9bc4e34a59654f49248b9be59d3eaa106ac3376e7e7d9d1251f2cbf61ef27000f3d19afb76b + 9c247151e7bc26467583f520518eccd2055ccd6cc8a195953d82a10c2065916778db35da2be44415d2f5efb0"); + assert_eq!(&expected[..], &xs[..]); + } + + #[test] + fn seek_off_end() { + let mut st = Ietf::new( + GenericArray::from_slice(&[0xff; 32]), + GenericArray::from_slice(&[0; 12]), + ); + st.seek(0x40_0000_0000); + + assert!(st.try_apply_keystream(&mut [0u8; 1]).is_err()); + } + + #[test] + fn read_last_bytes() { + let mut st = Ietf::new( + GenericArray::from_slice(&[0xff; 32]), + GenericArray::from_slice(&[0; 12]), + ); + + st.seek(0x40_0000_0000 - 10); + st.apply_keystream(&mut [0u8; 10]); + assert!(st.try_apply_keystream(&mut [0u8; 1]).is_err()); + + st.seek(0x40_0000_0000 - 10); + assert!(st.try_apply_keystream(&mut [0u8; 11]).is_err()); + } + + #[test] + fn seek_consistency() { + let mut st = Ietf::new( + GenericArray::from_slice(&[50; 32]), + GenericArray::from_slice(&[44; 12]), + ); + + let mut continuous = [0u8; 1000]; + st.apply_keystream(&mut continuous); + + let mut chunks = [0u8; 1000]; + + st.seek(128); + st.apply_keystream(&mut chunks[128..300]); + + st.seek(0); + st.apply_keystream(&mut chunks[0..10]); + + st.seek(300); + st.apply_keystream(&mut chunks[300..533]); + + st.seek(533); + st.apply_keystream(&mut chunks[533..]); + + st.seek(10); + st.apply_keystream(&mut chunks[10..128]); + + assert_eq!(&continuous[..], &chunks[..]); + } + + #[test] + fn wide_matches_narrow() { + let key = hex!("fa44478c59ca70538e3549096ce8b523232c50d9e8e8d10c203ef6c8d07098a5"); + let nonce = hex!("8d3a0d6d7827c007"); + let mut buf = [0; 2048]; + let mut state = ChaCha20::new( + GenericArray::from_slice(&key), + GenericArray::from_slice(&nonce), + ); + + let lens = [ + 2048, 2047, 1537, 1536, 1535, 1025, 1024, 1023, 768, 513, 512, 511, 200, 100, 50, + ]; + + for &len in &lens { + let buf = &mut buf[0..len]; + + // encrypt with hybrid wide/narrow + state.seek(0); + state.apply_keystream(buf); + state.seek(0); + // decrypt with narrow only + state.try_apply_keystream_narrow(buf).unwrap(); + for &byte in buf.iter() { + assert_eq!(byte, 0); + } + + // encrypt with hybrid wide/narrow + let offset = 0x3fffffff70u64; + state.seek(offset); + state.apply_keystream(buf); + // decrypt with narrow only + state.seek(offset); + state.try_apply_keystream_narrow(buf).unwrap(); + for &byte in buf.iter() { + assert_eq!(byte, 0); + } + } + } +} diff -Nru cargo-0.35.0/vendor/chrono/appveyor.yml cargo-0.37.0/vendor/chrono/appveyor.yml --- cargo-0.35.0/vendor/chrono/appveyor.yml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/chrono/appveyor.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -environment: - matrix: - - TARGET: 1.13.0-x86_64-pc-windows-gnu - - TARGET: nightly-x86_64-pc-windows-msvc - - TARGET: nightly-i686-pc-windows-msvc - - TARGET: nightly-x86_64-pc-windows-gnu - - TARGET: nightly-i686-pc-windows-gnu -matrix: - allow_failures: - - channel: nightly -install: - - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-${env:TARGET}.exe" -FileName "rust-install.exe" - - ps: .\rust-install.exe /VERYSILENT /NORESTART /DIR="C:\rust" | Out-Null - - ps: $env:PATH="$env:PATH;C:\rust\bin" - - rustc -vV - - cargo -vV - -build: false - -test_script: - - sh -c 'PATH=`rustc --print sysroot`/bin:$PATH ./ci/travis.sh' diff -Nru cargo-0.35.0/vendor/chrono/.cargo-checksum.json cargo-0.37.0/vendor/chrono/.cargo-checksum.json --- cargo-0.35.0/vendor/chrono/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/chrono/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878"} \ No newline at end of file +{"files":{},"package":"77d81f58b7301084de3b958691458a53c3f7e0b1d702f77e550b6a88e3a88abe"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/chrono/Cargo.toml cargo-0.37.0/vendor/chrono/Cargo.toml --- cargo-0.35.0/vendor/chrono/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/chrono/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,8 +12,9 @@ [package] name = "chrono" -version = "0.4.6" +version = "0.4.7" authors = ["Kang Seonghoon ", "Brandon W Maister "] +exclude = ["/ci/*", "/.travis.yml", "/appveyor.yml", "/Makefile"] description = "Date and time library for Rust" homepage = "https://github.com/chronotope/chrono" documentation = "https://docs.rs/chrono/" @@ -30,6 +31,10 @@ [lib] name = "chrono" +[dependencies.libc] +version = "0.2" +default-features = false + [dependencies.num-integer] version = "0.1.36" default-features = false @@ -52,6 +57,9 @@ [dev-dependencies.bincode] version = "0.8.0" +[dev-dependencies.doc-comment] +version = "0.3" + [dev-dependencies.num-iter] version = "0.1.35" default-features = false diff -Nru cargo-0.35.0/vendor/chrono/CHANGELOG.md cargo-0.37.0/vendor/chrono/CHANGELOG.md --- cargo-0.35.0/vendor/chrono/CHANGELOG.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/chrono/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -6,7 +6,29 @@ Chrono obeys the principle of [Semantic Versioning](http://semver.org/). There were/are numerous minor versions before 1.0 due to the language changes. -Versions with only mechnical changes will be omitted from the following list. +Versions with only mechanical changes will be omitted from the following list. + +## 0.4.7 + +### Fixes + +* Disable libc default features so that CI continues to work on rust 1.13 +* Fix panic on negative inputs to timestamp_millis (@cmars #292) +* Make `LocalResult` `Copy/Eq/Hash` + +### Features + +* Add `std::convert::From` conversions between the different timezone formats + (@mqudsi #271) +* Add `timestamp_nanos` methods (@jean-airoldie #308) +* Documentation improvements + +## 0.4.6 + +### Maintenance + +* Doc improvements -- improve README CI verification, external links +* winapi upgrade to 0.3 ## 0.4.5 diff -Nru cargo-0.35.0/vendor/chrono/ci/fix-readme.sh cargo-0.37.0/vendor/chrono/ci/fix-readme.sh --- cargo-0.35.0/vendor/chrono/ci/fix-readme.sh 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/chrono/ci/fix-readme.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -#!/bin/bash - -VERSION="$( cargo read-manifest | python -c 'import json, sys; print(json.load(sys.stdin)["version"])')" -LIB="$1" - -# Make the Chrono in the header a link to the docs -awk '/^\/\/! # Chrono: / { print "[Chrono][docsrs]:", substr($0, index($0, $4))}' "$LIB" -awk '/^\/\/! # Chrono: / { print "[Chrono][docsrs]:", substr($0, index($0, $4))}' "$LIB" | sed 's/./=/g' -# Add all the badges -echo ' -[![Chrono on Travis CI][travis-image]][travis] -[![Chrono on Appveyor][appveyor-image]][appveyor] -[![Chrono on crates.io][cratesio-image]][cratesio] -[![Chrono on docs.rs][docsrs-image]][docsrs] -[![Join the chat at https://gitter.im/chrono-rs/chrono][gitter-image]][gitter] - -[travis-image]: https://travis-ci.org/chronotope/chrono.svg?branch=master -[travis]: https://travis-ci.org/chronotope/chrono -[appveyor-image]: https://ci.appveyor.com/api/projects/status/2ia91ofww4w31m2w/branch/master?svg=true -[appveyor]: https://ci.appveyor.com/project/chronotope/chrono -[cratesio-image]: https://img.shields.io/crates/v/chrono.svg -[cratesio]: https://crates.io/crates/chrono -[docsrs-image]: https://docs.rs/chrono/badge.svg -[docsrs]: https://docs.rs/chrono -[gitter-image]: https://badges.gitter.im/chrono-rs/chrono.svg -[gitter]: https://gitter.im/chrono-rs/chrono' - -# print the section between the header and the usage -awk '/^\/\/! # Chrono:/,/^\/\/! ## /' "$LIB" | cut -b 5- | grep -v '^#' | \ - sed 's/](\.\//](https:\/\/docs.rs\/chrono\/'$VERSION'\/chrono\//g' -echo -# Replace relative doc links with links to this exact version of docs on -# docs.rs -awk '/^\/\/! ## /,!/^\/\/!/' "$LIB" | cut -b 5- | grep -v '^# ' | \ - sed 's/](\.\//](https:\/\/docs.rs\/chrono\/'$VERSION'\/chrono\//g' \ diff -Nru cargo-0.35.0/vendor/chrono/ci/travis.sh cargo-0.37.0/vendor/chrono/ci/travis.sh --- cargo-0.35.0/vendor/chrono/ci/travis.sh 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/chrono/ci/travis.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,100 +0,0 @@ -#!/bin/bash - -# This is the script that's executed by travis, you can run it yourself to run -# the exact same suite - -set -e - -DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -channel() { - if [ -n "${TRAVIS}" ]; then - if [ "${TRAVIS_RUST_VERSION}" = "${CHANNEL}" ]; then - pwd - (set -x; cargo "$@") - fi - elif [ -n "${APPVEYOR}" ]; then - if [ "${APPVEYOR_RUST_CHANNEL}" = "${CHANNEL}" ]; then - pwd - (set -x; cargo "$@") - fi - else - pwd - (set -x; cargo "+${CHANNEL}" "$@") - fi -} - -build_and_test() { - # interleave building and testing in hope that it saves time - # also vary the local time zone to (hopefully) catch tz-dependent bugs - # also avoid doc-testing multiple times---it takes a lot and rarely helps - cargo clean - channel build -v - TZ=ACST-9:30 channel test -v --lib - channel build -v --features rustc-serialize - TZ=EST4 channel test -v --features rustc-serialize --lib - channel build -v --features serde - TZ=UTC0 channel test -v --features serde --lib - channel build -v --features serde,rustc-serialize - TZ=Asia/Katmandu channel test -v --features serde,rustc-serialize - - # without default "clock" feature - channel build -v --no-default-features - TZ=ACST-9:30 channel test -v --no-default-features --lib - channel build -v --no-default-features --features rustc-serialize - TZ=EST4 channel test -v --no-default-features --features rustc-serialize --lib - channel build -v --no-default-features --features serde - TZ=UTC0 channel test -v --no-default-features --features serde --lib - channel build -v --no-default-features --features serde,rustc-serialize - TZ=Asia/Katmandu channel test -v --no-default-features --features serde,rustc-serialize --lib - - if [[ "$CHANNEL" == stable ]]; then - if [[ -n "$TRAVIS" ]] ; then - check_readme - fi - fi -} - -build_only() { - # Rust 1.13 doesn't support custom derive, so, to avoid doctests which - # validate that, we just build there. - cargo clean - channel build -v - channel build -v --features rustc-serialize - channel build -v --features 'serde bincode' - channel build -v --no-default-features -} - -run_clippy() { - # cached installation will not work on a later nightly - if [ -n "${TRAVIS}" ] && ! cargo install clippy --debug --force; then - echo "COULD NOT COMPILE CLIPPY, IGNORING CLIPPY TESTS" - exit - fi - - cargo clippy --features 'serde bincode rustc-serialize' -- -Dclippy -} - -check_readme() { - make readme - (set -x; git diff --exit-code -- README.md) ; echo $? -} - -rustc --version -cargo --version - -CHANNEL=nightly -if [ "x${CLIPPY}" = xy ] ; then - run_clippy -else - build_and_test -fi - -CHANNEL=beta -build_and_test - -CHANNEL=stable -build_and_test - -CHANNEL=1.13.0 -build_only diff -Nru cargo-0.35.0/vendor/chrono/Makefile cargo-0.37.0/vendor/chrono/Makefile --- cargo-0.35.0/vendor/chrono/Makefile 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/chrono/Makefile 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -# this Makefile is mostly for the packaging convenience. -# casual users should use `cargo` to retrieve the appropriate version of Chrono. - -.PHONY: all -all: - @echo 'Try `cargo build` instead.' - -.PHONY: authors -authors: - echo 'Chrono is mainly written by Kang Seonghoon ,' > AUTHORS.txt - echo 'and also the following people (in ascending order):' >> AUTHORS.txt - echo >> AUTHORS.txt - git log --format='%aN <%aE>' | grep -v 'Kang Seonghoon' | sort -u >> AUTHORS.txt - -.PHONY: readme README.md -readme: README.md - -README.md: src/lib.rs - ( ./ci/fix-readme.sh $< ) > $@ - -.PHONY: test -test: - TZ=UTC0 cargo test --features 'serde rustc-serialize bincode' --lib - TZ=ACST-9:30 cargo test --features 'serde rustc-serialize bincode' --lib - TZ=EST4 cargo test --features 'serde rustc-serialize bincode' - -.PHONY: doc -doc: authors readme - cargo doc --features 'serde rustc-serialize bincode' - diff -Nru cargo-0.35.0/vendor/chrono/README.md cargo-0.37.0/vendor/chrono/README.md --- cargo-0.35.0/vendor/chrono/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/chrono/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -82,7 +82,7 @@ months. Chrono does not yet natively support -the standard [`Duration`](https://docs.rs/time/0.1.40/time/struct.Duration.html) type, +the standard [`Duration`](https://doc.rust-lang.org/std/time/struct.Duration.html) type, but it will be supported in the future. Meanwhile you can convert between two types with [`Duration::from_std`](https://docs.rs/time/0.1.40/time/struct.Duration.html#method.from_std) @@ -93,7 +93,7 @@ ### Date and Time Chrono provides a -[**`DateTime`**](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html) +[**`DateTime`**](https://docs.rs/chrono/0.4/chrono/struct.DateTime.html) type to represent a date and a time in a timezone. For more abstract moment-in-time tracking such as internal timekeeping @@ -104,15 +104,15 @@ is an opaque but monotonically-increasing representation of a moment in time. `DateTime` is timezone-aware and must be constructed from -the [**`TimeZone`**](https://docs.rs/chrono/0.4.6/chrono/offset/trait.TimeZone.html) object, +the [**`TimeZone`**](https://docs.rs/chrono/0.4/chrono/offset/trait.TimeZone.html) object, which defines how the local date is converted to and back from the UTC date. There are three well-known `TimeZone` implementations: -* [**`Utc`**](https://docs.rs/chrono/0.4.6/chrono/offset/struct.Utc.html) specifies the UTC time zone. It is most efficient. +* [**`Utc`**](https://docs.rs/chrono/0.4/chrono/offset/struct.Utc.html) specifies the UTC time zone. It is most efficient. -* [**`Local`**](https://docs.rs/chrono/0.4.6/chrono/offset/struct.Local.html) specifies the system local time zone. +* [**`Local`**](https://docs.rs/chrono/0.4/chrono/offset/struct.Local.html) specifies the system local time zone. -* [**`FixedOffset`**](https://docs.rs/chrono/0.4.6/chrono/offset/struct.FixedOffset.html) specifies +* [**`FixedOffset`**](https://docs.rs/chrono/0.4/chrono/offset/struct.FixedOffset.html) specifies an arbitrary, fixed time zone such as UTC+09:00 or UTC-10:30. This often results from the parsed textual date and time. Since it stores the most information and does not depend on the system environment, @@ -120,12 +120,12 @@ `DateTime`s with different `TimeZone` types are distinct and do not mix, but can be converted to each other using -the [`DateTime::with_timezone`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.with_timezone) method. +the [`DateTime::with_timezone`](https://docs.rs/chrono/0.4/chrono/struct.DateTime.html#method.with_timezone) method. You can get the current date and time in the UTC time zone -([`Utc::now()`](https://docs.rs/chrono/0.4.6/chrono/offset/struct.Utc.html#method.now)) +([`Utc::now()`](https://docs.rs/chrono/0.4/chrono/offset/struct.Utc.html#method.now)) or in the local time zone -([`Local::now()`](https://docs.rs/chrono/0.4.6/chrono/offset/struct.Local.html#method.now)). +([`Local::now()`](https://docs.rs/chrono/0.4/chrono/offset/struct.Local.html#method.now)). ```rust use chrono::prelude::*; @@ -166,17 +166,19 @@ ``` Various properties are available to the date and time, and can be altered individually. -Most of them are defined in the traits [`Datelike`](https://docs.rs/chrono/0.4.6/chrono/trait.Datelike.html) and -[`Timelike`](https://docs.rs/chrono/0.4.6/chrono/trait.Timelike.html) which you should `use` before. +Most of them are defined in the traits [`Datelike`](https://docs.rs/chrono/0.4/chrono/trait.Datelike.html) and +[`Timelike`](https://docs.rs/chrono/0.4/chrono/trait.Timelike.html) which you should `use` before. Addition and subtraction is also supported. The following illustrates most supported operations to the date and time: ```rust +extern crate time; + use chrono::prelude::*; use time::Duration; // assume this returned `2014-11-28T21:45:59.324310806+09:00`: -let dt = Local::now(); +let dt = FixedOffset::east(9*3600).ymd(2014, 11, 28).and_hms_nano(21, 45, 59, 324310806); // property accessors assert_eq!((dt.year(), dt.month(), dt.day()), (2014, 11, 28)); @@ -210,15 +212,15 @@ ### Formatting and Parsing -Formatting is done via the [`format`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.format) method, +Formatting is done via the [`format`](https://docs.rs/chrono/0.4/chrono/struct.DateTime.html#method.format) method, which format is equivalent to the familiar `strftime` format. -See [`format::strftime`](https://docs.rs/chrono/0.4.6/chrono/format/strftime/index.html#specifiers) +See [`format::strftime`](https://docs.rs/chrono/0.4/chrono/format/strftime/index.html#specifiers) documentation for full syntax and list of specifiers. The default `to_string` method and `{:?}` specifier also give a reasonable representation. -Chrono also provides [`to_rfc2822`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.to_rfc2822) and -[`to_rfc3339`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.to_rfc3339) methods +Chrono also provides [`to_rfc2822`](https://docs.rs/chrono/0.4/chrono/struct.DateTime.html#method.to_rfc2822) and +[`to_rfc3339`](https://docs.rs/chrono/0.4/chrono/struct.DateTime.html#method.to_rfc3339) methods for well-known formats. ```rust @@ -248,23 +250,23 @@ ([`std::fmt::Debug`](https://doc.rust-lang.org/std/fmt/trait.Debug.html)) format specifier prints, and requires the offset to be present. -2. [`DateTime::parse_from_str`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.parse_from_str) parses +2. [`DateTime::parse_from_str`](https://docs.rs/chrono/0.4/chrono/struct.DateTime.html#method.parse_from_str) parses a date and time with offsets and returns `DateTime`. This should be used when the offset is a part of input and the caller cannot guess that. It *cannot* be used when the offset can be missing. - [`DateTime::parse_from_rfc2822`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.parse_from_rfc2822) + [`DateTime::parse_from_rfc2822`](https://docs.rs/chrono/0.4/chrono/struct.DateTime.html#method.parse_from_rfc2822) and - [`DateTime::parse_from_rfc3339`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.parse_from_rfc3339) + [`DateTime::parse_from_rfc3339`](https://docs.rs/chrono/0.4/chrono/struct.DateTime.html#method.parse_from_rfc3339) are similar but for well-known formats. -3. [`Offset::datetime_from_str`](https://docs.rs/chrono/0.4.6/chrono/offset/trait.TimeZone.html#method.datetime_from_str) is +3. [`Offset::datetime_from_str`](https://docs.rs/chrono/0.4/chrono/offset/trait.TimeZone.html#method.datetime_from_str) is similar but returns `DateTime` of given offset. When the explicit offset is missing from the input, it simply uses given offset. It issues an error when the input contains an explicit offset different from the current offset. More detailed control over the parsing process is available via -[`format`](https://docs.rs/chrono/0.4.6/chrono/format/index.html) module. +[`format`](https://docs.rs/chrono/0.4/chrono/format/index.html) module. ```rust use chrono::prelude::*; @@ -296,23 +298,23 @@ assert!(Utc.datetime_from_str("Sat Nov 28 12:00:09 2014", "%a %b %e %T %Y").is_err()); ``` -Again : See [`format::strftime`](https://docs.rs/chrono/0.4.6/chrono/format/strftime/index.html#specifiers) +Again : See [`format::strftime`](https://docs.rs/chrono/0.4/chrono/format/strftime/index.html#specifiers) documentation for full syntax and list of specifiers. ### Conversion from and to EPOCH timestamps -Use [`Utc.timestamp(seconds, nanoseconds)`](https://docs.rs/chrono/0.4.6/chrono/offset/trait.TimeZone.html#method.timestamp) -to construct a [`DateTime`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html) from a UNIX timestamp +Use [`Utc.timestamp(seconds, nanoseconds)`](https://docs.rs/chrono/0.4/chrono/offset/trait.TimeZone.html#method.timestamp) +to construct a [`DateTime`](https://docs.rs/chrono/0.4/chrono/struct.DateTime.html) from a UNIX timestamp (seconds, nanoseconds that passed since January 1st 1970). -Use [`DateTime.timestamp`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.timestamp) to get the timestamp (in seconds) -from a [`DateTime`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html). Additionally, you can use -[`DateTime.timestamp_subsec_nanos`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.timestamp_subsec_nanos) +Use [`DateTime.timestamp`](https://docs.rs/chrono/0.4/chrono/struct.DateTime.html#method.timestamp) to get the timestamp (in seconds) +from a [`DateTime`](https://docs.rs/chrono/0.4/chrono/struct.DateTime.html). Additionally, you can use +[`DateTime.timestamp_subsec_nanos`](https://docs.rs/chrono/0.4/chrono/struct.DateTime.html#method.timestamp_subsec_nanos) to get the number of additional number of nanoseconds. ```rust // We need the trait in scope to use Utc::timestamp(). -use chrono::TimeZone; +use chrono::{DateTime, TimeZone, Utc}; // Construct a datetime from epoch: let dt = Utc.timestamp(1_500_000_000, 0); @@ -325,7 +327,7 @@ ### Individual date -Chrono also provides an individual date type ([**`Date`**](https://docs.rs/chrono/0.4.6/chrono/struct.Date.html)). +Chrono also provides an individual date type ([**`Date`**](https://docs.rs/chrono/0.4/chrono/struct.Date.html)). It also has time zones attached, and have to be constructed via time zones. Most operations available to `DateTime` are also available to `Date` whenever appropriate. @@ -344,26 +346,26 @@ There is no timezone-aware `Time` due to the lack of usefulness and also the complexity. -`DateTime` has [`date`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.date) method +`DateTime` has [`date`](https://docs.rs/chrono/0.4/chrono/struct.DateTime.html#method.date) method which returns a `Date` which represents its date component. -There is also a [`time`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.time) method, +There is also a [`time`](https://docs.rs/chrono/0.4/chrono/struct.DateTime.html#method.time) method, which simply returns a naive local time described below. ### Naive date and time Chrono provides naive counterparts to `Date`, (non-existent) `Time` and `DateTime` -as [**`NaiveDate`**](https://docs.rs/chrono/0.4.6/chrono/naive/struct.NaiveDate.html), -[**`NaiveTime`**](https://docs.rs/chrono/0.4.6/chrono/naive/struct.NaiveTime.html) and -[**`NaiveDateTime`**](https://docs.rs/chrono/0.4.6/chrono/naive/struct.NaiveDateTime.html) respectively. +as [**`NaiveDate`**](https://docs.rs/chrono/0.4/chrono/naive/struct.NaiveDate.html), +[**`NaiveTime`**](https://docs.rs/chrono/0.4/chrono/naive/struct.NaiveTime.html) and +[**`NaiveDateTime`**](https://docs.rs/chrono/0.4/chrono/naive/struct.NaiveDateTime.html) respectively. They have almost equivalent interfaces as their timezone-aware twins, but are not associated to time zones obviously and can be quite low-level. They are mostly useful for building blocks for higher-level types. Timezone-aware `DateTime` and `Date` types have two methods returning naive versions: -[`naive_local`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.naive_local) returns +[`naive_local`](https://docs.rs/chrono/0.4/chrono/struct.DateTime.html#method.naive_local) returns a view to the naive local time, -and [`naive_utc`](https://docs.rs/chrono/0.4.6/chrono/struct.DateTime.html#method.naive_utc) returns +and [`naive_utc`](https://docs.rs/chrono/0.4/chrono/struct.DateTime.html#method.naive_utc) returns a view to the naive UTC time. ## Limitations @@ -375,7 +377,7 @@ Time types are limited in the nanosecond accuracy. [Leap seconds are supported in the representation but -Chrono doesn't try to make use of them](https://docs.rs/chrono/0.4.6/chrono/naive/struct.NaiveTime.html#leap-second-handling). +Chrono doesn't try to make use of them](https://docs.rs/chrono/0.4/chrono/naive/struct.NaiveTime.html#leap-second-handling). (The main reason is that leap seconds are not really predictable.) Almost *every* operation over the possible leap seconds will ignore them. Consider using `NaiveDateTime` with the implicit TAI (International Atomic Time) scale diff -Nru cargo-0.35.0/vendor/chrono/src/datetime.rs cargo-0.37.0/vendor/chrono/src/datetime.rs --- cargo-0.35.0/vendor/chrono/src/datetime.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/chrono/src/datetime.rs 2019-07-17 05:42:23.000000000 +0000 @@ -235,6 +235,75 @@ } } +/// Convert a `DateTime` instance into a `DateTime` instance. +impl From> for DateTime { + /// Convert this `DateTime` instance into a `DateTime` instance. + /// + /// Conversion is done via [`DateTime::with_timezone`]. Note that the converted value returned by + /// this will be created with a fixed timezone offset of 0. + fn from(src: DateTime) -> Self { + src.with_timezone(&FixedOffset::east(0)) + } +} + +/// Convert a `DateTime` instance into a `DateTime` instance. +#[cfg(feature="clock")] +impl From> for DateTime { + /// Convert this `DateTime` instance into a `DateTime` instance. + /// + /// Conversion is performed via [`DateTime::with_timezone`], accounting for the difference in timezones. + fn from(src: DateTime) -> Self { + src.with_timezone(&Local) + } +} + +/// Convert a `DateTime` instance into a `DateTime` instance. +impl From> for DateTime { + /// Convert this `DateTime` instance into a `DateTime` instance. + /// + /// Conversion is performed via [`DateTime::with_timezone`], accounting for the timezone + /// difference. + fn from(src: DateTime) -> Self { + src.with_timezone(&Utc) + } +} + +/// Convert a `DateTime` instance into a `DateTime` instance. +#[cfg(feature="clock")] +impl From> for DateTime { + /// Convert this `DateTime` instance into a `DateTime` instance. + /// + /// Conversion is performed via [`DateTime::with_timezone`]. Returns the equivalent value in local + /// time. + fn from(src: DateTime) -> Self { + src.with_timezone(&Local) + } +} + +/// Convert a `DateTime` instance into a `DateTime` instance. +#[cfg(feature="clock")] +impl From> for DateTime { + /// Convert this `DateTime` instance into a `DateTime` instance. + /// + /// Conversion is performed via [`DateTime::with_timezone`], accounting for the difference in + /// timezones. + fn from(src: DateTime) -> Self { + src.with_timezone(&Utc) + } +} + +/// Convert a `DateTime` instance into a `DateTime` instance. +#[cfg(feature="clock")] +impl From> for DateTime { + /// Convert this `DateTime` instance into a `DateTime` instance. + /// + /// Conversion is performed via [`DateTime::with_timezone`]. Note that the converted value returned + /// by this will be created with a fixed timezone offset of 0. + fn from(src: DateTime) -> Self { + src.with_timezone(&FixedOffset::east(0)) + } +} + /// Maps the local datetime to other datetime with given conversion function. fn map_local(dt: &DateTime, mut f: F) -> Option> where F: FnMut(NaiveDateTime) -> Option { @@ -616,6 +685,14 @@ } } +#[test] +fn test_auto_conversion() { + let utc_dt = Utc.ymd(2018, 9, 5).and_hms(23, 58, 0); + let cdt_dt = FixedOffset::west(5 * 60 * 60).ymd(2018, 9, 5).and_hms(18, 58, 0); + let utc_dt2: DateTime = cdt_dt.into(); + assert_eq!(utc_dt, utc_dt2); +} + #[cfg(all(test, any(feature = "rustc-serialize", feature = "serde")))] fn test_encodable_json(to_string_utc: FUtc, to_string_fixed: FFixed) where FUtc: Fn(&DateTime) -> Result, diff -Nru cargo-0.35.0/vendor/chrono/src/format/parse.rs cargo-0.37.0/vendor/chrono/src/format/parse.rs --- cargo-0.35.0/vendor/chrono/src/format/parse.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/chrono/src/format/parse.rs 2019-07-17 05:42:23.000000000 +0000 @@ -4,6 +4,8 @@ //! Date and time parsing routines. +#![allow(deprecated)] + use std::usize; use Weekday; diff -Nru cargo-0.35.0/vendor/chrono/src/format/scan.rs cargo-0.37.0/vendor/chrono/src/format/scan.rs --- cargo-0.35.0/vendor/chrono/src/format/scan.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/chrono/src/format/scan.rs 2019-07-17 05:42:23.000000000 +0000 @@ -5,6 +5,8 @@ * Various scanning routines for the parser. */ +#![allow(deprecated)] + use Weekday; use super::{ParseResult, TOO_SHORT, INVALID, OUT_OF_RANGE}; diff -Nru cargo-0.35.0/vendor/chrono/src/lib.rs cargo-0.37.0/vendor/chrono/src/lib.rs --- cargo-0.35.0/vendor/chrono/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/chrono/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -66,7 +66,7 @@ //! months. //! //! Chrono does not yet natively support -//! the standard [`Duration`](https://docs.rs/time/0.1.40/time/struct.Duration.html) type, +//! the standard [`Duration`](https://doc.rust-lang.org/std/time/struct.Duration.html) type, //! but it will be supported in the future. //! Meanwhile you can convert between two types with //! [`Duration::from_std`](https://docs.rs/time/0.1.40/time/struct.Duration.html#method.from_std) @@ -158,15 +158,15 @@ //! The following illustrates most supported operations to the date and time: //! //! ```rust -//! # extern crate chrono; extern crate time; fn main() { +//! # extern crate chrono; +//! extern crate time; +//! +//! # fn main() { //! use chrono::prelude::*; //! use time::Duration; //! -//! # /* we intentionally fake the datetime... //! // assume this returned `2014-11-28T21:45:59.324310806+09:00`: -//! let dt = Local::now(); -//! # */ // up to here. we now define a fixed datetime for the illustrative purpose. -//! # let dt = FixedOffset::east(9*3600).ymd(2014, 11, 28).and_hms_nano(21, 45, 59, 324310806); +//! let dt = FixedOffset::east(9*3600).ymd(2014, 11, 28).and_hms_nano(21, 45, 59, 324310806); //! //! // property accessors //! assert_eq!((dt.year(), dt.month(), dt.day()), (2014, 11, 28)); @@ -302,10 +302,8 @@ //! to get the number of additional number of nanoseconds. //! //! ```rust -//! # use chrono::DateTime; -//! # use chrono::Utc; //! // We need the trait in scope to use Utc::timestamp(). -//! use chrono::TimeZone; +//! use chrono::{DateTime, TimeZone, Utc}; //! //! // Construct a datetime from epoch: //! let dt = Utc.timestamp(1_500_000_000, 0); @@ -413,6 +411,12 @@ extern crate rustc_serialize; #[cfg(feature = "serde")] extern crate serde as serdelib; +#[cfg(test)] +#[macro_use] +extern crate doc_comment; + +#[cfg(test)] +doctest!("../README.md"); // this reexport is to aid the transition and should not be in the prelude! pub use oldtime::Duration; @@ -451,7 +455,7 @@ mod oldtime; pub mod offset; pub mod naive { - //! Date and time types which do not concern about the timezones. + //! Date and time types unconcerned with timezones. //! //! They are primarily building blocks for other types //! (e.g. [`TimeZone`](../offset/trait.TimeZone.html)), diff -Nru cargo-0.35.0/vendor/chrono/src/naive/datetime.rs cargo-0.37.0/vendor/chrono/src/naive/datetime.rs --- cargo-0.35.0/vendor/chrono/src/naive/datetime.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/chrono/src/naive/datetime.rs 2019-07-17 05:42:23.000000000 +0000 @@ -305,21 +305,33 @@ /// Note that this does *not* account for the timezone! /// The true "UNIX timestamp" would count seconds since the midnight *UTC* on the epoch. /// + /// # Panics + /// /// Note also that this does reduce the number of years that can be - /// represented from ~584 Billion to ~584. (If this is a problem, - /// please file an issue to let me know what domain needs nanosecond - /// precision over millenia, I'm curious.) + /// represented from ~584 Billion to ~584 years. The dates that can be + /// represented as nanoseconds are between 1677-09-21T00:12:44.0 and + /// 2262-04-11T23:47:16.854775804. + /// + /// (If this is a problem, please file an issue to let me know what domain + /// needs nanosecond precision over millenia, I'm curious.) /// /// # Example /// /// ~~~~ - /// use chrono::NaiveDate; + /// use chrono::{NaiveDate, NaiveDateTime}; /// /// let dt = NaiveDate::from_ymd(1970, 1, 1).and_hms_nano(0, 0, 1, 444); /// assert_eq!(dt.timestamp_nanos(), 1_000_000_444); /// /// let dt = NaiveDate::from_ymd(2001, 9, 9).and_hms_nano(1, 46, 40, 555); - /// assert_eq!(dt.timestamp_nanos(), 1_000_000_000_000_000_555); + /// + /// const A_BILLION: i64 = 1_000_000_000; + /// let nanos = dt.timestamp_nanos(); + /// assert_eq!(nanos, 1_000_000_000_000_000_555); + /// assert_eq!( + /// dt, + /// NaiveDateTime::from_timestamp(nanos / A_BILLION, (nanos % A_BILLION) as u32) + /// ); /// ~~~~ #[inline] pub fn timestamp_nanos(&self) -> i64 { @@ -2348,4 +2360,24 @@ let time = base + Duration::microseconds(t); assert_eq!(t, time.signed_duration_since(base).num_microseconds().unwrap()); } + + #[test] + fn test_nanosecond_range() { + const A_BILLION: i64 = 1_000_000_000; + let maximum = "2262-04-11T23:47:16.854775804"; + let parsed: NaiveDateTime = maximum.parse().unwrap(); + let nanos = parsed.timestamp_nanos(); + assert_eq!( + parsed, + NaiveDateTime::from_timestamp(nanos / A_BILLION, (nanos % A_BILLION) as u32) + ); + + let minimum = "1677-09-21T00:12:44.000000000"; + let parsed: NaiveDateTime = minimum.parse().unwrap(); + let nanos = parsed.timestamp_nanos(); + assert_eq!( + parsed, + NaiveDateTime::from_timestamp(nanos / A_BILLION, (nanos % A_BILLION) as u32) + ); + } } diff -Nru cargo-0.35.0/vendor/chrono/src/offset/fixed.rs cargo-0.37.0/vendor/chrono/src/offset/fixed.rs --- cargo-0.35.0/vendor/chrono/src/offset/fixed.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/chrono/src/offset/fixed.rs 2019-07-17 05:42:23.000000000 +0000 @@ -86,11 +86,13 @@ } /// Returns the number of seconds to add to convert from UTC to the local time. + #[inline] pub fn local_minus_utc(&self) -> i32 { self.local_minus_utc } /// Returns the number of seconds to add to convert from the local time to UTC. + #[inline] pub fn utc_minus_local(&self) -> i32 { -self.local_minus_utc } diff -Nru cargo-0.35.0/vendor/chrono/src/offset/mod.rs cargo-0.37.0/vendor/chrono/src/offset/mod.rs --- cargo-0.35.0/vendor/chrono/src/offset/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/chrono/src/offset/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -20,13 +20,13 @@ use std::fmt; +use format::{parse, ParseResult, Parsed, StrftimeItems}; +use naive::{NaiveDate, NaiveDateTime, NaiveTime}; use Weekday; -use naive::{NaiveDate, NaiveTime, NaiveDateTime}; use {Date, DateTime}; -use format::{parse, Parsed, ParseResult, StrftimeItems}; /// The conversion result from the local time to the timezone-aware datetime types. -#[derive(Clone, PartialEq, Debug)] +#[derive(Clone, PartialEq, Debug, Copy, Eq, Hash)] pub enum LocalResult { /// Given local time representation is invalid. /// This can occur when, for example, the positive timezone transition. @@ -41,17 +41,26 @@ impl LocalResult { /// Returns `Some` only when the conversion result is unique, or `None` otherwise. pub fn single(self) -> Option { - match self { LocalResult::Single(t) => Some(t), _ => None } + match self { + LocalResult::Single(t) => Some(t), + _ => None, + } } /// Returns `Some` for the earliest possible conversion result, or `None` if none. pub fn earliest(self) -> Option { - match self { LocalResult::Single(t) | LocalResult::Ambiguous(t,_) => Some(t), _ => None } + match self { + LocalResult::Single(t) | LocalResult::Ambiguous(t, _) => Some(t), + _ => None, + } } /// Returns `Some` for the latest possible conversion result, or `None` if none. pub fn latest(self) -> Option { - match self { LocalResult::Single(t) | LocalResult::Ambiguous(_,t) => Some(t), _ => None } + match self { + LocalResult::Single(t) | LocalResult::Ambiguous(_, t) => Some(t), + _ => None, + } } /// Maps a `LocalResult` into `LocalResult` with given function. @@ -72,8 +81,9 @@ #[inline] pub fn and_time(self, time: NaiveTime) -> LocalResult> { match self { - LocalResult::Single(d) => d.and_time(time) - .map_or(LocalResult::None, LocalResult::Single), + LocalResult::Single(d) => d + .and_time(time) + .map_or(LocalResult::None, LocalResult::Single), _ => LocalResult::None, } } @@ -85,8 +95,9 @@ #[inline] pub fn and_hms_opt(self, hour: u32, min: u32, sec: u32) -> LocalResult> { match self { - LocalResult::Single(d) => d.and_hms_opt(hour, min, sec) - .map_or(LocalResult::None, LocalResult::Single), + LocalResult::Single(d) => d + .and_hms_opt(hour, min, sec) + .map_or(LocalResult::None, LocalResult::Single), _ => LocalResult::None, } } @@ -97,11 +108,17 @@ /// /// Propagates any error. Ambiguous result would be discarded. #[inline] - pub fn and_hms_milli_opt(self, hour: u32, min: u32, sec: u32, - milli: u32) -> LocalResult> { + pub fn and_hms_milli_opt( + self, + hour: u32, + min: u32, + sec: u32, + milli: u32, + ) -> LocalResult> { match self { - LocalResult::Single(d) => d.and_hms_milli_opt(hour, min, sec, milli) - .map_or(LocalResult::None, LocalResult::Single), + LocalResult::Single(d) => d + .and_hms_milli_opt(hour, min, sec, milli) + .map_or(LocalResult::None, LocalResult::Single), _ => LocalResult::None, } } @@ -112,11 +129,17 @@ /// /// Propagates any error. Ambiguous result would be discarded. #[inline] - pub fn and_hms_micro_opt(self, hour: u32, min: u32, sec: u32, - micro: u32) -> LocalResult> { + pub fn and_hms_micro_opt( + self, + hour: u32, + min: u32, + sec: u32, + micro: u32, + ) -> LocalResult> { match self { - LocalResult::Single(d) => d.and_hms_micro_opt(hour, min, sec, micro) - .map_or(LocalResult::None, LocalResult::Single), + LocalResult::Single(d) => d + .and_hms_micro_opt(hour, min, sec, micro) + .map_or(LocalResult::None, LocalResult::Single), _ => LocalResult::None, } } @@ -127,15 +150,20 @@ /// /// Propagates any error. Ambiguous result would be discarded. #[inline] - pub fn and_hms_nano_opt(self, hour: u32, min: u32, sec: u32, - nano: u32) -> LocalResult> { + pub fn and_hms_nano_opt( + self, + hour: u32, + min: u32, + sec: u32, + nano: u32, + ) -> LocalResult> { match self { - LocalResult::Single(d) => d.and_hms_nano_opt(hour, min, sec, nano) - .map_or(LocalResult::None, LocalResult::Single), + LocalResult::Single(d) => d + .and_hms_nano_opt(hour, min, sec, nano) + .map_or(LocalResult::None, LocalResult::Single), _ => LocalResult::None, } } - } impl LocalResult { @@ -144,7 +172,7 @@ match self { LocalResult::None => panic!("No such local time"), LocalResult::Single(t) => t, - LocalResult::Ambiguous(t1,t2) => { + LocalResult::Ambiguous(t1, t2) => { panic!("Ambiguous local time, ranging from {:?} to {:?}", t1, t2) } } @@ -345,10 +373,36 @@ /// }; /// ~~~~ fn timestamp_millis_opt(&self, millis: i64) -> LocalResult> { - let (secs, millis) = (millis / 1000, millis % 1000); + let (mut secs, mut millis) = (millis / 1000, millis % 1000); + if millis < 0 { + secs -= 1; + millis += 1000; + } self.timestamp_opt(secs, millis as u32 * 1_000_000) } + /// Makes a new `DateTime` from the number of non-leap nanoseconds + /// since January 1, 1970 0:00:00 UTC (aka "UNIX timestamp"). + /// + /// Unlike [`timestamp_millis`](#method.timestamp_millis), this never + /// panics. + /// + /// # Example + /// + /// ~~~~ + /// use chrono::{Utc, TimeZone}; + /// + /// assert_eq!(Utc.timestamp_nanos(1431648000000000).timestamp(), 1431648); + /// ~~~~ + fn timestamp_nanos(&self, nanos: i64) -> DateTime { + let (mut secs, mut nanos) = (nanos / 1_000_000_000, nanos % 1_000_000_000); + if nanos < 0 { + secs -= 1; + nanos += 1_000_000_000; + } + self.timestamp_opt(secs, nanos as u32).unwrap() + } + /// Parses a string with the specified format string and /// returns a `DateTime` with the current offset. /// See the [`format::strftime` module](../format/strftime/index.html) @@ -384,9 +438,8 @@ /// Converts the local `NaiveDateTime` to the timezone-aware `DateTime` if possible. fn from_local_datetime(&self, local: &NaiveDateTime) -> LocalResult> { - self.offset_from_local_datetime(local).map(|offset| { - DateTime::from_utc(*local - offset.fix(), offset) - }) + self.offset_from_local_datetime(local) + .map(|offset| DateTime::from_utc(*local - offset.fix(), offset)) } /// Creates the offset for given UTC `NaiveDate`. This cannot fail. @@ -408,12 +461,52 @@ } } -mod utc; mod fixed; -#[cfg(feature="clock")] +#[cfg(feature = "clock")] mod local; +mod utc; -pub use self::utc::Utc; pub use self::fixed::FixedOffset; -#[cfg(feature="clock")] +#[cfg(feature = "clock")] pub use self::local::Local; +pub use self::utc::Utc; + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_negative_millis() { + let dt = Utc.timestamp_millis(-1000); + assert_eq!(dt.to_string(), "1969-12-31 23:59:59 UTC"); + let dt = Utc.timestamp_millis(-999); + assert_eq!(dt.to_string(), "1969-12-31 23:59:59.001 UTC"); + let dt = Utc.timestamp_millis(-1); + assert_eq!(dt.to_string(), "1969-12-31 23:59:59.999 UTC"); + let dt = Utc.timestamp_millis(-60000); + assert_eq!(dt.to_string(), "1969-12-31 23:59:00 UTC"); + let dt = Utc.timestamp_millis(-3600000); + assert_eq!(dt.to_string(), "1969-12-31 23:00:00 UTC"); + } + + #[test] + fn test_negative_nanos() { + let dt = Utc.timestamp_nanos(-1_000_000_000); + assert_eq!(dt.to_string(), "1969-12-31 23:59:59 UTC"); + let dt = Utc.timestamp_nanos(-999_999_999); + assert_eq!(dt.to_string(), "1969-12-31 23:59:59.000000001 UTC"); + let dt = Utc.timestamp_nanos(-1); + assert_eq!(dt.to_string(), "1969-12-31 23:59:59.999999999 UTC"); + let dt = Utc.timestamp_nanos(-60_000_000_000); + assert_eq!(dt.to_string(), "1969-12-31 23:59:00 UTC"); + let dt = Utc.timestamp_nanos(-3_600_000_000_000); + assert_eq!(dt.to_string(), "1969-12-31 23:00:00 UTC"); + } + + #[test] + fn test_nanos_never_panics() { + Utc.timestamp_nanos(i64::max_value()); + Utc.timestamp_nanos(i64::default()); + Utc.timestamp_nanos(i64::min_value()); + } +} diff -Nru cargo-0.35.0/vendor/clap/Cargo.toml cargo-0.37.0/vendor/clap/Cargo.toml --- cargo-0.35.0/vendor/clap/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/clap/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -64,7 +64,7 @@ version = "1.0" [dependencies.strsim] -version = "0.8" +version = ">= 0.7, < 0.10" optional = true [dependencies.term_size] diff -Nru cargo-0.35.0/vendor/clap/debian/patches/no-clippy.patch cargo-0.37.0/vendor/clap/debian/patches/no-clippy.patch --- cargo-0.35.0/vendor/clap/debian/patches/no-clippy.patch 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/clap/debian/patches/no-clippy.patch 2019-07-17 05:42:23.000000000 +0000 @@ -1,6 +1,6 @@ ---- a/Cargo.toml 2018-09-07 20:46:25.639402810 -0700 -+++ b/Cargo.toml 2018-09-07 20:46:37.055559250 -0700 -@@ -71,10 +71,6 @@ +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -63,10 +63,6 @@ [dependencies.bitflags] version = "1.0" @@ -9,9 +9,9 @@ -optional = true - [dependencies.strsim] - version = "0.7.0" + version = "0.8" optional = true -@@ -110,7 +106,6 @@ +@@ -102,7 +98,6 @@ debug = [] default = ["suggestions", "color", "vec_map"] doc = ["yaml"] diff -Nru cargo-0.35.0/vendor/clap/debian/patches/relax-dep-versions.patch cargo-0.37.0/vendor/clap/debian/patches/relax-dep-versions.patch --- cargo-0.35.0/vendor/clap/debian/patches/relax-dep-versions.patch 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/clap/debian/patches/relax-dep-versions.patch 2019-07-17 05:42:23.000000000 +0000 @@ -1,5 +1,14 @@ --- a/Cargo.toml +++ b/Cargo.toml +@@ -64,7 +64,7 @@ + version = "1.0" + + [dependencies.strsim] +-version = "0.8" ++version = ">= 0.7, < 0.10" + optional = true + + [dependencies.term_size] @@ -82,7 +82,7 @@ optional = true diff -Nru cargo-0.35.0/vendor/core-foundation/debian/patches/0001-Use-libc-c_char-instead-of-i8-for-libc-calls.patch cargo-0.37.0/vendor/core-foundation/debian/patches/0001-Use-libc-c_char-instead-of-i8-for-libc-calls.patch --- cargo-0.35.0/vendor/core-foundation/debian/patches/0001-Use-libc-c_char-instead-of-i8-for-libc-calls.patch 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/core-foundation/debian/patches/0001-Use-libc-c_char-instead-of-i8-for-libc-calls.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -From 2cffc810d382f83b7ac5073fa9c57dc7d208803c Mon Sep 17 00:00:00 2001 -From: Wolfgang Silbermayr -Date: Fri, 7 Dec 2018 06:11:50 +0100 -Subject: [PATCH] Use libc c_char instead of i8 for libc calls - ---- - src/url.rs | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/url.rs b/src/url.rs -index edf1de8..199ad2e 100644 ---- a/src/url.rs -+++ b/src/url.rs -@@ -20,7 +20,7 @@ use std::ptr; - use std::path::{Path, PathBuf}; - use std::mem; - --use libc::{strlen, PATH_MAX}; -+use libc::{c_char, strlen, PATH_MAX}; - - #[cfg(unix)] - use std::os::unix::ffi::OsStrExt; -@@ -83,7 +83,7 @@ impl CFURL { - if result == false as Boolean { - return None; - } -- let len = strlen(buf.as_ptr() as *const i8); -+ let len = strlen(buf.as_ptr() as *const c_char); - let path = OsStr::from_bytes(&buf[0..len]); - Some(PathBuf::from(path)) - } --- -2.20.0.rc2 - diff -Nru cargo-0.35.0/vendor/core-foundation/debian/patches/update-dep-uuid-version.patch cargo-0.37.0/vendor/core-foundation/debian/patches/update-dep-uuid-version.patch --- cargo-0.35.0/vendor/core-foundation/debian/patches/update-dep-uuid-version.patch 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/core-foundation/debian/patches/update-dep-uuid-version.patch 2019-07-17 05:42:23.000000000 +0000 @@ -1,6 +1,6 @@ --- a/Cargo.toml +++ b/Cargo.toml -@@ -31,7 +31,7 @@ +@@ -29,7 +29,7 @@ version = "0.2" [dependencies.uuid] @@ -11,7 +11,7 @@ [features] --- a/src/uuid.rs +++ b/src/uuid.rs -@@ -68,7 +68,7 @@ +@@ -62,7 +62,7 @@ b.byte14, b.byte15, ]; diff -Nru cargo-0.35.0/vendor/curl/.cargo-checksum.json cargo-0.37.0/vendor/curl/.cargo-checksum.json --- cargo-0.35.0/vendor/curl/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/curl/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"a85f2f95f2bd277d316d1aa8a477687ab4a6942258c7db7c89c187534669979c"} \ No newline at end of file +{"files":{},"package":"f8ed9a22aa8c4e49ac0c896279ef532a43a7df2f54fcd19fa36960de029f965f"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/curl/Cargo.toml cargo-0.37.0/vendor/curl/Cargo.toml --- cargo-0.35.0/vendor/curl/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/curl/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,7 +12,7 @@ [package] name = "curl" -version = "0.4.21" +version = "0.4.22" authors = ["Alex Crichton "] autotests = true description = "Rust bindings to libcurl for making HTTP requests" @@ -54,13 +54,12 @@ [target."cfg(all(unix, not(target_os = \"macos\")))".dependencies.openssl-sys] version = "0.9.43" optional = true -[target."cfg(target_env = \"msvc\")".dependencies.kernel32-sys] -version = "0.2.2" [target."cfg(target_env = \"msvc\")".dependencies.schannel] version = "0.1.13" [target."cfg(windows)".dependencies.winapi] -version = "0.2.7" +version = "0.3" +features = ["winsock2", "wincrypt", "libloaderapi"] [badges.appveyor] repository = "alexcrichton/curl-rust" diff -Nru cargo-0.35.0/vendor/curl/debian/patches/winapi3.patch cargo-0.37.0/vendor/curl/debian/patches/winapi3.patch --- cargo-0.35.0/vendor/curl/debian/patches/winapi3.patch 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/curl/debian/patches/winapi3.patch 2019-07-17 05:42:23.000000000 +0000 @@ -1,29 +1,34 @@ ---- a/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 -+++ b/Cargo.toml 2018-09-21 18:54:24.693880364 +0000 -@@ -48,4 +48,2 @@ version = "0.1.2" - version = "0.9.33" --[target."cfg(target_env=\"msvc\")".dependencies.kernel32-sys] +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -54,13 +54,12 @@ + [target."cfg(all(unix, not(target_os = \"macos\")))".dependencies.openssl-sys] + version = "0.9.43" + optional = true +-[target."cfg(target_env = \"msvc\")".dependencies.kernel32-sys] -version = "0.2.2" -@@ -54,3 +52,4 @@ version = "0.1.13" + [target."cfg(target_env = \"msvc\")".dependencies.schannel] + version = "0.1.13" [target."cfg(windows)".dependencies.winapi] -version = "0.2.7" +version = "0.3" +features = ["winsock2", "wincrypt", "libloaderapi"] [badges.appveyor] ---- a/src/easy/windows.rs 2018-09-21 18:01:35.962553903 +0000 -+++ b/src/easy/windows.rs 2018-09-21 18:01:35.962553903 +0000 -@@ -4,21 +4,21 @@ use libc::c_void; + repository = "alexcrichton/curl-rust" + +--- a/src/easy/windows.rs ++++ b/src/easy/windows.rs +@@ -4,21 +4,21 @@ #[cfg(target_env = "msvc")] mod win { - use kernel32; + use schannel::cert_context::ValidUses; + use schannel::cert_store::CertStore; use std::ffi::CString; use std::mem; use std::ptr; - use schannel::cert_context::ValidUses; - use schannel::cert_store::CertStore; - use winapi::{self, c_void, c_uchar, c_long, c_int}; + use winapi::{self, c_int, c_long, c_uchar, c_void}; + use winapi::um::libloaderapi::{GetModuleHandleW, GetProcAddress}; fn lookup(module: &str, symbol: &str) -> Option<*const c_void> { @@ -38,25 +43,25 @@ if n == ptr::null() { None } else { ---- a/src/lib.rs 2018-09-21 18:01:35.962553903 +0000 -+++ b/src/lib.rs 2018-09-21 18:01:35.962553903 +0000 -@@ -61,8 +61,6 @@ extern crate openssl_probe; - #[cfg(windows)] +--- a/src/lib.rs ++++ b/src/lib.rs +@@ -63,8 +63,6 @@ extern crate winapi; --#[cfg(target_env = "msvc")] --extern crate kernel32; #[cfg(target_env = "msvc")] +-extern crate kernel32; +-#[cfg(target_env = "msvc")] extern crate schannel; ---- a/src/multi.rs 2018-09-21 18:01:35.962553903 +0000 -+++ b/src/multi.rs 2018-09-21 18:01:35.962553903 +0000 -@@ -8,7 +8,7 @@ use libc::{c_int, c_char, c_void, c_long, c_short}; - use curl_sys; - + use std::ffi::CStr; +--- a/src/multi.rs ++++ b/src/multi.rs +@@ -10,7 +10,7 @@ + #[cfg(unix)] + use libc::{fd_set, pollfd, POLLIN, POLLOUT, POLLPRI}; #[cfg(windows)] -use winapi::winsock2::fd_set; +use winapi::um::winsock2::fd_set; - #[cfg(unix)] - use libc::{fd_set, pollfd, POLLIN, POLLPRI, POLLOUT}; + use easy::{Easy, Easy2}; + use panic; diff -Nru cargo-0.35.0/vendor/curl/.pc/applied-patches cargo-0.37.0/vendor/curl/.pc/applied-patches --- cargo-0.35.0/vendor/curl/.pc/applied-patches 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/curl/.pc/applied-patches 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +winapi3.patch diff -Nru cargo-0.35.0/vendor/curl/.pc/winapi3.patch/Cargo.toml cargo-0.37.0/vendor/curl/.pc/winapi3.patch/Cargo.toml --- cargo-0.35.0/vendor/curl/.pc/winapi3.patch/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/curl/.pc/winapi3.patch/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,68 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# 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 = "curl" +version = "0.4.22" +authors = ["Alex Crichton "] +autotests = true +description = "Rust bindings to libcurl for making HTTP requests" +homepage = "https://github.com/alexcrichton/curl-rust" +documentation = "https://docs.rs/curl" +categories = ["api-bindings", "web-programming::http-client"] +license = "MIT" +repository = "https://github.com/alexcrichton/curl-rust" + +[[test]] +name = "atexit" +harness = false +[dependencies.curl-sys] +version = "0.4.18" +default-features = false + +[dependencies.libc] +version = "0.2.42" + +[dependencies.socket2] +version = "0.3.7" +[dev-dependencies.mio] +version = "0.6" + +[dev-dependencies.mio-extras] +version = "2.0.3" + +[features] +default = ["ssl"] +force-system-lib-on-osx = ["curl-sys/force-system-lib-on-osx"] +http2 = ["curl-sys/http2"] +ssl = ["openssl-sys", "openssl-probe", "curl-sys/ssl"] +static-curl = ["curl-sys/static-curl"] +static-ssl = ["curl-sys/static-ssl"] +[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies.openssl-probe] +version = "0.1.2" +optional = true + +[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies.openssl-sys] +version = "0.9.43" +optional = true +[target."cfg(target_env = \"msvc\")".dependencies.kernel32-sys] +version = "0.2.2" + +[target."cfg(target_env = \"msvc\")".dependencies.schannel] +version = "0.1.13" +[target."cfg(windows)".dependencies.winapi] +version = "0.2.7" +[badges.appveyor] +repository = "alexcrichton/curl-rust" + +[badges.travis-ci] +repository = "alexcrichton/curl-rust" diff -Nru cargo-0.35.0/vendor/curl/.pc/winapi3.patch/src/easy/windows.rs cargo-0.37.0/vendor/curl/.pc/winapi3.patch/src/easy/windows.rs --- cargo-0.35.0/vendor/curl/.pc/winapi3.patch/src/easy/windows.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/curl/.pc/winapi3.patch/src/easy/windows.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,131 @@ +#![allow(non_camel_case_types, non_snake_case)] + +use libc::c_void; + +#[cfg(target_env = "msvc")] +mod win { + use kernel32; + use schannel::cert_context::ValidUses; + use schannel::cert_store::CertStore; + use std::ffi::CString; + use std::mem; + use std::ptr; + use winapi::{self, c_int, c_long, c_uchar, c_void}; + + fn lookup(module: &str, symbol: &str) -> Option<*const c_void> { + unsafe { + let symbol = CString::new(symbol).unwrap(); + let mut mod_buf: Vec = module.encode_utf16().collect(); + mod_buf.push(0); + let handle = kernel32::GetModuleHandleW(mod_buf.as_mut_ptr()); + let n = kernel32::GetProcAddress(handle, symbol.as_ptr()); + if n == ptr::null() { + None + } else { + Some(n) + } + } + } + + pub enum X509_STORE {} + pub enum X509 {} + pub enum SSL_CTX {} + + type d2i_X509_fn = unsafe extern "C" fn( + a: *mut *mut X509, + pp: *mut *const c_uchar, + length: c_long, + ) -> *mut X509; + type X509_free_fn = unsafe extern "C" fn(x: *mut X509); + type X509_STORE_add_cert_fn = + unsafe extern "C" fn(store: *mut X509_STORE, x: *mut X509) -> c_int; + type SSL_CTX_get_cert_store_fn = unsafe extern "C" fn(ctx: *const SSL_CTX) -> *mut X509_STORE; + + struct OpenSSL { + d2i_X509: d2i_X509_fn, + X509_free: X509_free_fn, + X509_STORE_add_cert: X509_STORE_add_cert_fn, + SSL_CTX_get_cert_store: SSL_CTX_get_cert_store_fn, + } + + unsafe fn lookup_functions(crypto_module: &str, ssl_module: &str) -> Option { + macro_rules! get { + ($(let $sym:ident in $module:expr;)*) => ($( + let $sym = match lookup($module, stringify!($sym)) { + Some(p) => p, + None => return None, + }; + )*) + } + get! { + let d2i_X509 in crypto_module; + let X509_free in crypto_module; + let X509_STORE_add_cert in crypto_module; + let SSL_CTX_get_cert_store in ssl_module; + } + Some(OpenSSL { + d2i_X509: mem::transmute(d2i_X509), + X509_free: mem::transmute(X509_free), + X509_STORE_add_cert: mem::transmute(X509_STORE_add_cert), + SSL_CTX_get_cert_store: mem::transmute(SSL_CTX_get_cert_store), + }) + } + + pub unsafe fn add_certs_to_context(ssl_ctx: *mut c_void) { + // check the runtime version of OpenSSL + let openssl = match ::version::Version::get().ssl_version() { + Some(ssl_ver) if ssl_ver.starts_with("OpenSSL/1.1.0") => { + lookup_functions("libcrypto", "libssl") + } + Some(ssl_ver) if ssl_ver.starts_with("OpenSSL/1.0.2") => { + lookup_functions("libeay32", "ssleay32") + } + _ => return, + }; + let openssl = match openssl { + Some(s) => s, + None => return, + }; + + let openssl_store = (openssl.SSL_CTX_get_cert_store)(ssl_ctx as *const SSL_CTX); + let mut store = match CertStore::open_current_user("ROOT") { + Ok(s) => s, + Err(_) => return, + }; + + for cert in store.certs() { + let valid_uses = match cert.valid_uses() { + Ok(v) => v, + Err(_) => continue, + }; + + // check the extended key usage for the "Server Authentication" OID + match valid_uses { + ValidUses::All => {} + ValidUses::Oids(ref oids) => { + let oid = winapi::wincrypt::szOID_PKIX_KP_SERVER_AUTH.to_owned(); + if !oids.contains(&oid) { + continue; + } + } + } + + let der = cert.to_der(); + let x509 = (openssl.d2i_X509)(ptr::null_mut(), &mut der.as_ptr(), der.len() as c_long); + if !x509.is_null() { + (openssl.X509_STORE_add_cert)(openssl_store, x509); + (openssl.X509_free)(x509); + } + } + } +} + +#[cfg(target_env = "msvc")] +pub fn add_certs_to_context(ssl_ctx: *mut c_void) { + unsafe { + win::add_certs_to_context(ssl_ctx as *mut _); + } +} + +#[cfg(not(target_env = "msvc"))] +pub fn add_certs_to_context(_: *mut c_void) {} diff -Nru cargo-0.35.0/vendor/curl/.pc/winapi3.patch/src/lib.rs cargo-0.37.0/vendor/curl/.pc/winapi3.patch/src/lib.rs --- cargo-0.35.0/vendor/curl/.pc/winapi3.patch/src/lib.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/curl/.pc/winapi3.patch/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,130 @@ +//! Rust bindings to the libcurl C library +//! +//! This crate contains bindings for an HTTP/HTTPS client which is powered by +//! [libcurl], the same library behind the `curl` command line tool. The API +//! currently closely matches that of libcurl itself, except that a Rustic layer +//! of safety is applied on top. +//! +//! [libcurl]: https://curl.haxx.se/libcurl/ +//! +//! # The "Easy" API +//! +//! The easiest way to send a request is to use the `Easy` api which corresponds +//! to `CURL` in libcurl. This handle supports a wide variety of options and can +//! be used to make a single blocking request in a thread. Callbacks can be +//! specified to deal with data as it arrives and a handle can be reused to +//! cache connections and such. +//! +//! ```rust,no_run +//! use std::io::{stdout, Write}; +//! +//! use curl::easy::Easy; +//! +//! // Write the contents of rust-lang.org to stdout +//! let mut easy = Easy::new(); +//! easy.url("https://www.rust-lang.org/").unwrap(); +//! easy.write_function(|data| { +//! stdout().write_all(data).unwrap(); +//! Ok(data.len()) +//! }).unwrap(); +//! easy.perform().unwrap(); +//! ``` +//! +//! # What about multiple concurrent HTTP requests? +//! +//! One option you have currently is to send multiple requests in multiple +//! threads, but otherwise libcurl has a "multi" interface for doing this +//! operation. Initial bindings of this interface can be found in the `multi` +//! module, but feedback is welcome! +//! +//! # Where does libcurl come from? +//! +//! This crate links to the `curl-sys` crate which is in turn responsible for +//! acquiring and linking to the libcurl library. Currently this crate will +//! build libcurl from source if one is not already detected on the system. +//! +//! There is a large number of releases for libcurl, all with different sets of +//! capabilities. Robust programs may wish to inspect `Version::get()` to test +//! what features are implemented in the linked build of libcurl at runtime. + +#![deny(missing_docs, missing_debug_implementations)] +#![doc(html_root_url = "https://docs.rs/curl/0.4")] + +extern crate curl_sys; +extern crate libc; +extern crate socket2; + +#[cfg(need_openssl_probe)] +extern crate openssl_probe; +#[cfg(need_openssl_init)] +extern crate openssl_sys; + +#[cfg(windows)] +extern crate winapi; + +#[cfg(target_env = "msvc")] +extern crate kernel32; +#[cfg(target_env = "msvc")] +extern crate schannel; + +use std::ffi::CStr; +use std::str; +use std::sync::{Once, ONCE_INIT}; + +pub use error::{Error, FormError, MultiError, ShareError}; +mod error; + +pub use version::{Protocols, Version}; +mod version; + +pub mod easy; +pub mod multi; +mod panic; + +/// Initializes the underlying libcurl library. +/// +/// It's not required to call this before the library is used, but it's +/// recommended to do so as soon as the program starts. +pub fn init() { + static INIT: Once = ONCE_INIT; + INIT.call_once(|| { + platform_init(); + unsafe { + assert_eq!(curl_sys::curl_global_init(curl_sys::CURL_GLOBAL_ALL), 0); + } + + // Note that we explicitly don't schedule a call to + // `curl_global_cleanup`. The documentation for that function says + // + // > You must not call it when any other thread in the program (i.e. a + // > thread sharing the same memory) is running. This doesn't just mean + // > no other thread that is using libcurl. + // + // We can't ever be sure of that, so unfortunately we can't call the + // function. + }); + + #[cfg(need_openssl_init)] + fn platform_init() { + openssl_sys::init(); + } + + #[cfg(not(need_openssl_init))] + fn platform_init() {} +} + +unsafe fn opt_str<'a>(ptr: *const libc::c_char) -> Option<&'a str> { + if ptr.is_null() { + None + } else { + Some(str::from_utf8(CStr::from_ptr(ptr).to_bytes()).unwrap()) + } +} + +fn cvt(r: curl_sys::CURLcode) -> Result<(), Error> { + if r == curl_sys::CURLE_OK { + Ok(()) + } else { + Err(Error::new(r)) + } +} diff -Nru cargo-0.35.0/vendor/curl/.pc/winapi3.patch/src/multi.rs cargo-0.37.0/vendor/curl/.pc/winapi3.patch/src/multi.rs --- cargo-0.35.0/vendor/curl/.pc/winapi3.patch/src/multi.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/curl/.pc/winapi3.patch/src/multi.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,1102 @@ +//! Multi - initiating multiple requests simultaneously + +use std::fmt; +use std::marker; +use std::time::Duration; + +use curl_sys; +use libc::{c_char, c_int, c_long, c_short, c_void}; + +#[cfg(unix)] +use libc::{fd_set, pollfd, POLLIN, POLLOUT, POLLPRI}; +#[cfg(windows)] +use winapi::winsock2::fd_set; + +use easy::{Easy, Easy2}; +use panic; +use {Error, MultiError}; + +/// A multi handle for initiating multiple connections simultaneously. +/// +/// This structure corresponds to `CURLM` in libcurl and provides the ability to +/// have multiple transfers in flight simultaneously. This handle is then used +/// to manage each transfer. The main purpose of a `CURLM` is for the +/// *application* to drive the I/O rather than libcurl itself doing all the +/// blocking. Methods like `action` allow the application to inform libcurl of +/// when events have happened. +/// +/// Lots more documentation can be found on the libcurl [multi tutorial] where +/// the APIs correspond pretty closely with this crate. +/// +/// [multi tutorial]: https://curl.haxx.se/libcurl/c/libcurl-multi.html +pub struct Multi { + raw: *mut curl_sys::CURLM, + data: Box, +} + +struct MultiData { + socket: Box, + timer: Box) -> bool + Send>, +} + +/// Message from the `messages` function of a multi handle. +/// +/// Currently only indicates whether a transfer is done. +pub struct Message<'multi> { + ptr: *mut curl_sys::CURLMsg, + _multi: &'multi Multi, +} + +/// Wrapper around an easy handle while it's owned by a multi handle. +/// +/// Once an easy handle has been added to a multi handle then it can no longer +/// be used via `perform`. This handle is also used to remove the easy handle +/// from the multi handle when desired. +pub struct EasyHandle { + easy: Easy, + // This is now effecitvely bound to a `Multi`, so it is no longer sendable. + _marker: marker::PhantomData<&'static Multi>, +} + +/// Wrapper around an easy handle while it's owned by a multi handle. +/// +/// Once an easy handle has been added to a multi handle then it can no longer +/// be used via `perform`. This handle is also used to remove the easy handle +/// from the multi handle when desired. +pub struct Easy2Handle { + easy: Easy2, + // This is now effecitvely bound to a `Multi`, so it is no longer sendable. + _marker: marker::PhantomData<&'static Multi>, +} + +/// Notification of the events that have happened on a socket. +/// +/// This type is passed as an argument to the `action` method on a multi handle +/// to indicate what events have occurred on a socket. +pub struct Events { + bits: c_int, +} + +/// Notification of events that are requested on a socket. +/// +/// This type is yielded to the `socket_function` callback to indicate what +/// events are requested on a socket. +pub struct SocketEvents { + bits: c_int, +} + +/// Raw underlying socket type that the multi handles use +pub type Socket = curl_sys::curl_socket_t; + +/// File descriptor to wait on for use with the `wait` method on a multi handle. +pub struct WaitFd { + inner: curl_sys::curl_waitfd, +} + +impl Multi { + /// Creates a new multi session through which multiple HTTP transfers can be + /// initiated. + pub fn new() -> Multi { + unsafe { + ::init(); + let ptr = curl_sys::curl_multi_init(); + assert!(!ptr.is_null()); + Multi { + raw: ptr, + data: Box::new(MultiData { + socket: Box::new(|_, _, _| ()), + timer: Box::new(|_| true), + }), + } + } + } + + /// Set the callback informed about what to wait for + /// + /// When the `action` function runs, it informs the application about + /// updates in the socket (file descriptor) status by doing none, one, or + /// multiple calls to the socket callback. The callback gets status updates + /// with changes since the previous time the callback was called. See + /// `action` for more details on how the callback is used and should work. + /// + /// The `SocketEvents` parameter informs the callback on the status of the + /// given socket, and the methods on that type can be used to learn about + /// what's going on with the socket. + /// + /// The third `usize` parameter is a custom value set by the `assign` method + /// below. + pub fn socket_function(&mut self, f: F) -> Result<(), MultiError> + where + F: FnMut(Socket, SocketEvents, usize) + Send + 'static, + { + self._socket_function(Box::new(f)) + } + + fn _socket_function( + &mut self, + f: Box, + ) -> Result<(), MultiError> { + self.data.socket = f; + let cb: curl_sys::curl_socket_callback = cb; + try!(self.setopt_ptr( + curl_sys::CURLMOPT_SOCKETFUNCTION, + cb as usize as *const c_char + )); + let ptr = &*self.data as *const _; + try!(self.setopt_ptr(curl_sys::CURLMOPT_SOCKETDATA, ptr as *const c_char)); + return Ok(()); + + // TODO: figure out how to expose `_easy` + extern "C" fn cb( + _easy: *mut curl_sys::CURL, + socket: curl_sys::curl_socket_t, + what: c_int, + userptr: *mut c_void, + socketp: *mut c_void, + ) -> c_int { + panic::catch(|| unsafe { + let f = &mut (*(userptr as *mut MultiData)).socket; + f(socket, SocketEvents { bits: what }, socketp as usize) + }); + 0 + } + } + + /// Set data to associate with an internal socket + /// + /// This function creates an association in the multi handle between the + /// given socket and a private token of the application. This is designed + /// for `action` uses. + /// + /// When set, the token will be passed to all future socket callbacks for + /// the specified socket. + /// + /// If the given socket isn't already in use by libcurl, this function will + /// return an error. + /// + /// libcurl only keeps one single token associated with a socket, so + /// calling this function several times for the same socket will make the + /// last set token get used. + /// + /// The idea here being that this association (socket to token) is something + /// that just about every application that uses this API will need and then + /// libcurl can just as well do it since it already has an internal hash + /// table lookup for this. + /// + /// # Typical Usage + /// + /// In a typical application you allocate a struct or at least use some kind + /// of semi-dynamic data for each socket that we must wait for action on + /// when using the `action` approach. + /// + /// When our socket-callback gets called by libcurl and we get to know about + /// yet another socket to wait for, we can use `assign` to point out the + /// particular data so that when we get updates about this same socket + /// again, we don't have to find the struct associated with this socket by + /// ourselves. + pub fn assign(&self, socket: Socket, token: usize) -> Result<(), MultiError> { + unsafe { + try!(cvt(curl_sys::curl_multi_assign( + self.raw, + socket, + token as *mut _ + ))); + Ok(()) + } + } + + /// Set callback to receive timeout values + /// + /// Certain features, such as timeouts and retries, require you to call + /// libcurl even when there is no activity on the file descriptors. + /// + /// Your callback function should install a non-repeating timer with the + /// interval specified. Each time that timer fires, call either `action` or + /// `perform`, depending on which interface you use. + /// + /// A timeout value of `None` means you should delete your timer. + /// + /// A timeout value of 0 means you should call `action` or `perform` (once) + /// as soon as possible. + /// + /// This callback will only be called when the timeout changes. + /// + /// The timer callback should return `true` on success, and `false` on + /// error. This callback can be used instead of, or in addition to, + /// `get_timeout`. + pub fn timer_function(&mut self, f: F) -> Result<(), MultiError> + where + F: FnMut(Option) -> bool + Send + 'static, + { + self._timer_function(Box::new(f)) + } + + fn _timer_function( + &mut self, + f: Box) -> bool + Send>, + ) -> Result<(), MultiError> { + self.data.timer = f; + let cb: curl_sys::curl_multi_timer_callback = cb; + try!(self.setopt_ptr( + curl_sys::CURLMOPT_TIMERFUNCTION, + cb as usize as *const c_char + )); + let ptr = &*self.data as *const _; + try!(self.setopt_ptr(curl_sys::CURLMOPT_TIMERDATA, ptr as *const c_char)); + return Ok(()); + + // TODO: figure out how to expose `_multi` + extern "C" fn cb( + _multi: *mut curl_sys::CURLM, + timeout_ms: c_long, + user: *mut c_void, + ) -> c_int { + let keep_going = panic::catch(|| unsafe { + let f = &mut (*(user as *mut MultiData)).timer; + if timeout_ms == -1 { + f(None) + } else { + f(Some(Duration::from_millis(timeout_ms as u64))) + } + }) + .unwrap_or(false); + if keep_going { + 0 + } else { + -1 + } + } + } + + /// Enable or disable HTTP pipelining and multiplexing. + /// + /// When http_1 is true, enable HTTP/1.1 pipelining, which means that if + /// you add a second request that can use an already existing connection, + /// the second request will be "piped" on the same connection rather than + /// being executed in parallel. + /// + /// When multiplex is true, enable HTTP/2 multiplexing, which means that + /// follow-up requests can re-use an existing connection and send the new + /// request multiplexed over that at the same time as other transfers are + /// already using that single connection. + pub fn pipelining(&mut self, http_1: bool, multiplex: bool) -> Result<(), MultiError> { + let bitmask = if http_1 { curl_sys::CURLPIPE_HTTP1 } else { 0 } + | if multiplex { + curl_sys::CURLPIPE_MULTIPLEX + } else { + 0 + }; + self.setopt_long(curl_sys::CURLMOPT_PIPELINING, bitmask) + } + + /// Sets the max number of connections to a single host. + /// + /// Pass a long to indicate the max number of simultaneously open connections + /// to a single host (a host being the same as a host name + port number pair). + /// For each new session to a host, libcurl will open up a new connection up to the + /// limit set by the provided value. When the limit is reached, the sessions will + /// be pending until a connection becomes available. If pipelining is enabled, + /// libcurl will try to pipeline if the host is capable of it. + pub fn set_max_host_connections(&mut self, val: usize) -> Result<(), MultiError> { + self.setopt_long(curl_sys::CURLMOPT_MAX_HOST_CONNECTIONS, val as c_long) + } + + /// Sets the pipeline length. + /// + /// This sets the max number that will be used as the maximum amount of + /// outstanding reuqests in an HTTP/1.1 pipelined connection. This option + /// is only used for HTTP/1.1 pipelining, and not HTTP/2 multiplexing. + pub fn set_pipeline_length(&mut self, val: usize) -> Result<(), MultiError> { + self.setopt_long(curl_sys::CURLMOPT_MAX_PIPELINE_LENGTH, val as c_long) + } + + fn setopt_long(&mut self, opt: curl_sys::CURLMoption, val: c_long) -> Result<(), MultiError> { + unsafe { cvt(curl_sys::curl_multi_setopt(self.raw, opt, val)) } + } + + fn setopt_ptr( + &mut self, + opt: curl_sys::CURLMoption, + val: *const c_char, + ) -> Result<(), MultiError> { + unsafe { cvt(curl_sys::curl_multi_setopt(self.raw, opt, val)) } + } + + /// Add an easy handle to a multi session + /// + /// Adds a standard easy handle to the multi stack. This function call will + /// make this multi handle control the specified easy handle. + /// + /// When an easy interface is added to a multi handle, it will use a shared + /// connection cache owned by the multi handle. Removing and adding new easy + /// handles will not affect the pool of connections or the ability to do + /// connection re-use. + /// + /// If you have `timer_function` set in the multi handle (and you really + /// should if you're working event-based with `action` and friends), that + /// callback will be called from within this function to ask for an updated + /// timer so that your main event loop will get the activity on this handle + /// to get started. + /// + /// The easy handle will remain added to the multi handle until you remove + /// it again with `remove` on the returned handle - even when a transfer + /// with that specific easy handle is completed. + pub fn add(&self, mut easy: Easy) -> Result { + // Clear any configuration set by previous transfers because we're + // moving this into a `Send+'static` situation now basically. + easy.transfer(); + + unsafe { + try!(cvt(curl_sys::curl_multi_add_handle(self.raw, easy.raw()))); + } + Ok(EasyHandle { + easy: easy, + _marker: marker::PhantomData, + }) + } + + /// Same as `add`, but works with the `Easy2` type. + pub fn add2(&self, easy: Easy2) -> Result, MultiError> { + unsafe { + try!(cvt(curl_sys::curl_multi_add_handle(self.raw, easy.raw()))); + } + Ok(Easy2Handle { + easy: easy, + _marker: marker::PhantomData, + }) + } + + /// Remove an easy handle from this multi session + /// + /// Removes the easy handle from this multi handle. This will make the + /// returned easy handle be removed from this multi handle's control. + /// + /// When the easy handle has been removed from a multi stack, it is again + /// perfectly legal to invoke `perform` on it. + /// + /// Removing an easy handle while being used is perfectly legal and will + /// effectively halt the transfer in progress involving that easy handle. + /// All other easy handles and transfers will remain unaffected. + pub fn remove(&self, easy: EasyHandle) -> Result { + unsafe { + try!(cvt(curl_sys::curl_multi_remove_handle( + self.raw, + easy.easy.raw() + ))); + } + Ok(easy.easy) + } + + /// Same as `remove`, but for `Easy2Handle`. + pub fn remove2(&self, easy: Easy2Handle) -> Result, MultiError> { + unsafe { + try!(cvt(curl_sys::curl_multi_remove_handle( + self.raw, + easy.easy.raw() + ))); + } + Ok(easy.easy) + } + + /// Read multi stack informationals + /// + /// Ask the multi handle if there are any messages/informationals from the + /// individual transfers. Messages may include informationals such as an + /// error code from the transfer or just the fact that a transfer is + /// completed. More details on these should be written down as well. + pub fn messages(&self, mut f: F) + where + F: FnMut(Message), + { + self._messages(&mut f) + } + + fn _messages(&self, f: &mut FnMut(Message)) { + let mut queue = 0; + unsafe { + loop { + let ptr = curl_sys::curl_multi_info_read(self.raw, &mut queue); + if ptr.is_null() { + break; + } + f(Message { + ptr: ptr, + _multi: self, + }) + } + } + } + + /// Inform of reads/writes available data given an action + /// + /// When the application has detected action on a socket handled by libcurl, + /// it should call this function with the sockfd argument set to + /// the socket with the action. When the events on a socket are known, they + /// can be passed `events`. When the events on a socket are unknown, pass + /// `Events::new()` instead, and libcurl will test the descriptor + /// internally. + /// + /// The returned integer will contain the number of running easy handles + /// within the multi handle. When this number reaches zero, all transfers + /// are complete/done. When you call `action` on a specific socket and the + /// counter decreases by one, it DOES NOT necessarily mean that this exact + /// socket/transfer is the one that completed. Use `messages` to figure out + /// which easy handle that completed. + /// + /// The `action` function informs the application about updates in the + /// socket (file descriptor) status by doing none, one, or multiple calls to + /// the socket callback function set with the `socket_function` method. They + /// update the status with changes since the previous time the callback was + /// called. + pub fn action(&self, socket: Socket, events: &Events) -> Result { + let mut remaining = 0; + unsafe { + try!(cvt(curl_sys::curl_multi_socket_action( + self.raw, + socket, + events.bits, + &mut remaining + ))); + Ok(remaining as u32) + } + } + + /// Inform libcurl that a timeout has expired and sockets should be tested. + /// + /// The returned integer will contain the number of running easy handles + /// within the multi handle. When this number reaches zero, all transfers + /// are complete/done. When you call `action` on a specific socket and the + /// counter decreases by one, it DOES NOT necessarily mean that this exact + /// socket/transfer is the one that completed. Use `messages` to figure out + /// which easy handle that completed. + /// + /// Get the timeout time by calling the `timer_function` method. Your + /// application will then get called with information on how long to wait + /// for socket actions at most before doing the timeout action: call the + /// `timeout` method. You can also use the `get_timeout` function to + /// poll the value at any given time, but for an event-based system using + /// the callback is far better than relying on polling the timeout value. + pub fn timeout(&self) -> Result { + let mut remaining = 0; + unsafe { + try!(cvt(curl_sys::curl_multi_socket_action( + self.raw, + curl_sys::CURL_SOCKET_BAD, + 0, + &mut remaining + ))); + Ok(remaining as u32) + } + } + + /// Get how long to wait for action before proceeding + /// + /// An application using the libcurl multi interface should call + /// `get_timeout` to figure out how long it should wait for socket actions - + /// at most - before proceeding. + /// + /// Proceeding means either doing the socket-style timeout action: call the + /// `timeout` function, or call `perform` if you're using the simpler and + /// older multi interface approach. + /// + /// The timeout value returned is the duration at this very moment. If 0, it + /// means you should proceed immediately without waiting for anything. If it + /// returns `None`, there's no timeout at all set. + /// + /// Note: if libcurl returns a `None` timeout here, it just means that + /// libcurl currently has no stored timeout value. You must not wait too + /// long (more than a few seconds perhaps) before you call `perform` again. + pub fn get_timeout(&self) -> Result, MultiError> { + let mut ms = 0; + unsafe { + try!(cvt(curl_sys::curl_multi_timeout(self.raw, &mut ms))); + if ms == -1 { + Ok(None) + } else { + Ok(Some(Duration::from_millis(ms as u64))) + } + } + } + + /// Block until activity is detected or a timeout passes. + /// + /// The timeout is used in millisecond-precision. Large durations are + /// clamped at the maximum value curl accepts. + /// + /// The returned integer will contain the number of internal file + /// descriptors on which interesting events occured. + /// + /// This function is a simpler alternative to using `fdset()` and `select()` + /// and does not suffer from file descriptor limits. + /// + /// # Example + /// + /// ``` + /// use curl::multi::Multi; + /// use std::time::Duration; + /// + /// let m = Multi::new(); + /// + /// // Add some Easy handles... + /// + /// while m.perform().unwrap() > 0 { + /// m.wait(&mut [], Duration::from_secs(1)).unwrap(); + /// } + /// ``` + pub fn wait(&self, waitfds: &mut [WaitFd], timeout: Duration) -> Result { + let timeout_ms = { + let secs = timeout.as_secs(); + if secs > (i32::max_value() / 1000) as u64 { + // Duration too large, clamp at maximum value. + i32::max_value() + } else { + secs as i32 * 1000 + timeout.subsec_nanos() as i32 / 1000_000 + } + }; + unsafe { + let mut ret = 0; + try!(cvt(curl_sys::curl_multi_wait( + self.raw, + waitfds.as_mut_ptr() as *mut _, + waitfds.len() as u32, + timeout_ms, + &mut ret + ))); + Ok(ret as u32) + } + } + + /// Reads/writes available data from each easy handle. + /// + /// This function handles transfers on all the added handles that need + /// attention in an non-blocking fashion. + /// + /// When an application has found out there's data available for this handle + /// or a timeout has elapsed, the application should call this function to + /// read/write whatever there is to read or write right now etc. This + /// method returns as soon as the reads/writes are done. This function does + /// not require that there actually is any data available for reading or + /// that data can be written, it can be called just in case. It will return + /// the number of handles that still transfer data. + /// + /// If the amount of running handles is changed from the previous call (or + /// is less than the amount of easy handles you've added to the multi + /// handle), you know that there is one or more transfers less "running". + /// You can then call `info` to get information about each individual + /// completed transfer, and that returned info includes `Error` and more. + /// If an added handle fails very quickly, it may never be counted as a + /// running handle. + /// + /// When running_handles is set to zero (0) on the return of this function, + /// there is no longer any transfers in progress. + /// + /// # Return + /// + /// Before libcurl version 7.20.0: If you receive `is_call_perform`, this + /// basically means that you should call `perform` again, before you select + /// on more actions. You don't have to do it immediately, but the return + /// code means that libcurl may have more data available to return or that + /// there may be more data to send off before it is "satisfied". Do note + /// that `perform` will return `is_call_perform` only when it wants to be + /// called again immediately. When things are fine and there is nothing + /// immediate it wants done, it'll return `Ok` and you need to wait for + /// "action" and then call this function again. + /// + /// This function only returns errors etc regarding the whole multi stack. + /// Problems still might have occurred on individual transfers even when + /// this function returns `Ok`. Use `info` to figure out how individual + /// transfers did. + pub fn perform(&self) -> Result { + unsafe { + let mut ret = 0; + try!(cvt(curl_sys::curl_multi_perform(self.raw, &mut ret))); + Ok(ret as u32) + } + } + + /// Extracts file descriptor information from a multi handle + /// + /// This function extracts file descriptor information from a given + /// handle, and libcurl returns its `fd_set` sets. The application can use + /// these to `select()` on, but be sure to `FD_ZERO` them before calling + /// this function as curl_multi_fdset only adds its own descriptors, it + /// doesn't zero or otherwise remove any others. The curl_multi_perform + /// function should be called as soon as one of them is ready to be read + /// from or written to. + /// + /// If no file descriptors are set by libcurl, this function will return + /// `Ok(None)`. Otherwise `Ok(Some(n))` will be returned where `n` the + /// highest descriptor number libcurl set. When `Ok(None)` is returned it + /// is because libcurl currently does something that isn't possible for + /// your application to monitor with a socket and unfortunately you can + /// then not know exactly when the current action is completed using + /// `select()`. You then need to wait a while before you proceed and call + /// `perform` anyway. + /// + /// When doing `select()`, you should use `get_timeout` to figure out + /// how long to wait for action. Call `perform` even if no activity has + /// been seen on the `fd_set`s after the timeout expires as otherwise + /// internal retries and timeouts may not work as you'd think and want. + /// + /// If one of the sockets used by libcurl happens to be larger than what + /// can be set in an `fd_set`, which on POSIX systems means that the file + /// descriptor is larger than `FD_SETSIZE`, then libcurl will try to not + /// set it. Setting a too large file descriptor in an `fd_set` implies an out + /// of bounds write which can cause crashes, or worse. The effect of NOT + /// storing it will possibly save you from the crash, but will make your + /// program NOT wait for sockets it should wait for... + pub fn fdset2( + &self, + read: Option<&mut curl_sys::fd_set>, + write: Option<&mut curl_sys::fd_set>, + except: Option<&mut curl_sys::fd_set>, + ) -> Result, MultiError> { + unsafe { + let mut ret = 0; + let read = read.map(|r| r as *mut _).unwrap_or(0 as *mut _); + let write = write.map(|r| r as *mut _).unwrap_or(0 as *mut _); + let except = except.map(|r| r as *mut _).unwrap_or(0 as *mut _); + try!(cvt(curl_sys::curl_multi_fdset( + self.raw, read, write, except, &mut ret + ))); + if ret == -1 { + Ok(None) + } else { + Ok(Some(ret)) + } + } + } + + #[doc(hidden)] + #[deprecated(note = "renamed to fdset2")] + pub fn fdset( + &self, + read: Option<&mut fd_set>, + write: Option<&mut fd_set>, + except: Option<&mut fd_set>, + ) -> Result, MultiError> { + unsafe { + let mut ret = 0; + let read = read.map(|r| r as *mut _).unwrap_or(0 as *mut _); + let write = write.map(|r| r as *mut _).unwrap_or(0 as *mut _); + let except = except.map(|r| r as *mut _).unwrap_or(0 as *mut _); + try!(cvt(curl_sys::curl_multi_fdset( + self.raw, + read as *mut _, + write as *mut _, + except as *mut _, + &mut ret + ))); + if ret == -1 { + Ok(None) + } else { + Ok(Some(ret)) + } + } + } + + /// Attempt to close the multi handle and clean up all associated resources. + /// + /// Cleans up and removes a whole multi stack. It does not free or touch any + /// individual easy handles in any way - they still need to be closed + /// individually. + pub fn close(&self) -> Result<(), MultiError> { + unsafe { cvt(curl_sys::curl_multi_cleanup(self.raw)) } + } +} + +fn cvt(code: curl_sys::CURLMcode) -> Result<(), MultiError> { + if code == curl_sys::CURLM_OK { + Ok(()) + } else { + Err(MultiError::new(code)) + } +} + +impl fmt::Debug for Multi { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Multi").field("raw", &self.raw).finish() + } +} + +impl Drop for Multi { + fn drop(&mut self) { + let _ = self.close(); + } +} + +impl EasyHandle { + /// Sets an internal private token for this `EasyHandle`. + /// + /// This function will set the `CURLOPT_PRIVATE` field on the underlying + /// easy handle. + pub fn set_token(&mut self, token: usize) -> Result<(), Error> { + unsafe { + ::cvt(curl_sys::curl_easy_setopt( + self.easy.raw(), + curl_sys::CURLOPT_PRIVATE, + token, + )) + } + } + + /// Unpause reading on a connection. + /// + /// Using this function, you can explicitly unpause a connection that was + /// previously paused. + /// + /// A connection can be paused by letting the read or the write callbacks + /// return `ReadError::Pause` or `WriteError::Pause`. + /// + /// The chance is high that you will get your write callback called before + /// this function returns. + pub fn unpause_read(&self) -> Result<(), Error> { + self.easy.unpause_read() + } + + /// Unpause writing on a connection. + /// + /// Using this function, you can explicitly unpause a connection that was + /// previously paused. + /// + /// A connection can be paused by letting the read or the write callbacks + /// return `ReadError::Pause` or `WriteError::Pause`. A write callback that + /// returns pause signals to the library that it couldn't take care of any + /// data at all, and that data will then be delivered again to the callback + /// when the writing is later unpaused. + pub fn unpause_write(&self) -> Result<(), Error> { + self.easy.unpause_write() + } +} + +impl fmt::Debug for EasyHandle { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.easy.fmt(f) + } +} + +impl Easy2Handle { + /// Acquires a reference to the underlying handler for events. + pub fn get_ref(&self) -> &H { + self.easy.get_ref() + } + + /// Acquires a reference to the underlying handler for events. + pub fn get_mut(&mut self) -> &mut H { + self.easy.get_mut() + } + + /// Same as `EasyHandle::set_token` + pub fn set_token(&mut self, token: usize) -> Result<(), Error> { + unsafe { + ::cvt(curl_sys::curl_easy_setopt( + self.easy.raw(), + curl_sys::CURLOPT_PRIVATE, + token, + )) + } + } + + /// Unpause reading on a connection. + /// + /// Using this function, you can explicitly unpause a connection that was + /// previously paused. + /// + /// A connection can be paused by letting the read or the write callbacks + /// return `ReadError::Pause` or `WriteError::Pause`. + /// + /// The chance is high that you will get your write callback called before + /// this function returns. + pub fn unpause_read(&self) -> Result<(), Error> { + self.easy.unpause_read() + } + + /// Unpause writing on a connection. + /// + /// Using this function, you can explicitly unpause a connection that was + /// previously paused. + /// + /// A connection can be paused by letting the read or the write callbacks + /// return `ReadError::Pause` or `WriteError::Pause`. A write callback that + /// returns pause signals to the library that it couldn't take care of any + /// data at all, and that data will then be delivered again to the callback + /// when the writing is later unpaused. + pub fn unpause_write(&self) -> Result<(), Error> { + self.easy.unpause_write() + } +} + +impl fmt::Debug for Easy2Handle { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.easy.fmt(f) + } +} + +impl<'multi> Message<'multi> { + /// If this message indicates that a transfer has finished, returns the + /// result of the transfer in `Some`. + /// + /// If the message doesn't indicate that a transfer has finished, then + /// `None` is returned. + /// + /// Note that the `result*_for` methods below should be preferred as they + /// provide better error messages as the associated error data on the + /// handle can be associated with the error type. + pub fn result(&self) -> Option> { + unsafe { + if (*self.ptr).msg == curl_sys::CURLMSG_DONE { + Some(::cvt((*self.ptr).data as curl_sys::CURLcode)) + } else { + None + } + } + } + + /// Same as `result`, except only returns `Some` for the specified handle. + /// + /// Note that this function produces better error messages than `result` as + /// it uses `take_error_buf` to associate error information with the + /// returned error. + pub fn result_for(&self, handle: &EasyHandle) -> Option> { + if !self.is_for(handle) { + return None; + } + let mut err = self.result(); + if let Some(Err(e)) = &mut err { + if let Some(s) = handle.easy.take_error_buf() { + e.set_extra(s); + } + } + return err; + } + + /// Same as `result`, except only returns `Some` for the specified handle. + /// + /// Note that this function produces better error messages than `result` as + /// it uses `take_error_buf` to associate error information with the + /// returned error. + pub fn result_for2(&self, handle: &Easy2Handle) -> Option> { + if !self.is_for2(handle) { + return None; + } + let mut err = self.result(); + if let Some(Err(e)) = &mut err { + if let Some(s) = handle.easy.take_error_buf() { + e.set_extra(s); + } + } + return err; + } + + /// Returns whether this easy message was for the specified easy handle or + /// not. + pub fn is_for(&self, handle: &EasyHandle) -> bool { + unsafe { (*self.ptr).easy_handle == handle.easy.raw() } + } + + /// Same as `is_for`, but for `Easy2Handle`. + pub fn is_for2(&self, handle: &Easy2Handle) -> bool { + unsafe { (*self.ptr).easy_handle == handle.easy.raw() } + } + + /// Returns the token associated with the easy handle that this message + /// represents a completion for. + /// + /// This function will return the token assigned with + /// `EasyHandle::set_token`. This reads the `CURLINFO_PRIVATE` field of the + /// underlying `*mut CURL`. + pub fn token(&self) -> Result { + unsafe { + let mut p = 0usize; + try!(::cvt(curl_sys::curl_easy_getinfo( + (*self.ptr).easy_handle, + curl_sys::CURLINFO_PRIVATE, + &mut p + ))); + Ok(p) + } + } +} + +impl<'a> fmt::Debug for Message<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Message").field("ptr", &self.ptr).finish() + } +} + +impl Events { + /// Creates a new blank event bit mask. + pub fn new() -> Events { + Events { bits: 0 } + } + + /// Set or unset the whether these events indicate that input is ready. + pub fn input(&mut self, val: bool) -> &mut Events { + self.flag(curl_sys::CURL_CSELECT_IN, val) + } + + /// Set or unset the whether these events indicate that output is ready. + pub fn output(&mut self, val: bool) -> &mut Events { + self.flag(curl_sys::CURL_CSELECT_OUT, val) + } + + /// Set or unset the whether these events indicate that an error has + /// happened. + pub fn error(&mut self, val: bool) -> &mut Events { + self.flag(curl_sys::CURL_CSELECT_ERR, val) + } + + fn flag(&mut self, flag: c_int, val: bool) -> &mut Events { + if val { + self.bits |= flag; + } else { + self.bits &= !flag; + } + self + } +} + +impl fmt::Debug for Events { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Events") + .field("input", &(self.bits & curl_sys::CURL_CSELECT_IN != 0)) + .field("output", &(self.bits & curl_sys::CURL_CSELECT_IN != 0)) + .field("error", &(self.bits & curl_sys::CURL_CSELECT_IN != 0)) + .finish() + } +} + +impl SocketEvents { + /// Wait for incoming data. For the socket to become readable. + pub fn input(&self) -> bool { + self.bits & curl_sys::CURL_POLL_IN == curl_sys::CURL_POLL_IN + } + + /// Wait for outgoing data. For the socket to become writable. + pub fn output(&self) -> bool { + self.bits & curl_sys::CURL_POLL_OUT == curl_sys::CURL_POLL_OUT + } + + /// Wait for incoming and outgoing data. For the socket to become readable + /// or writable. + pub fn input_and_output(&self) -> bool { + self.bits & curl_sys::CURL_POLL_INOUT == curl_sys::CURL_POLL_INOUT + } + + /// The specified socket/file descriptor is no longer used by libcurl. + pub fn remove(&self) -> bool { + self.bits & curl_sys::CURL_POLL_REMOVE == curl_sys::CURL_POLL_REMOVE + } +} + +impl fmt::Debug for SocketEvents { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Events") + .field("input", &self.input()) + .field("output", &self.output()) + .field("remove", &self.remove()) + .finish() + } +} + +impl WaitFd { + /// Constructs an empty (invalid) WaitFd. + pub fn new() -> WaitFd { + WaitFd { + inner: curl_sys::curl_waitfd { + fd: 0, + events: 0, + revents: 0, + }, + } + } + + /// Set the file descriptor to wait for. + pub fn set_fd(&mut self, fd: Socket) { + self.inner.fd = fd; + } + + /// Indicate that the socket should poll on read events such as new data + /// received. + /// + /// Corresponds to `CURL_WAIT_POLLIN`. + pub fn poll_on_read(&mut self, val: bool) -> &mut WaitFd { + self.flag(curl_sys::CURL_WAIT_POLLIN, val) + } + + /// Indicate that the socket should poll on high priority read events such + /// as out of band data. + /// + /// Corresponds to `CURL_WAIT_POLLPRI`. + pub fn poll_on_priority_read(&mut self, val: bool) -> &mut WaitFd { + self.flag(curl_sys::CURL_WAIT_POLLPRI, val) + } + + /// Indicate that the socket should poll on write events such as the socket + /// being clear to write without blocking. + /// + /// Corresponds to `CURL_WAIT_POLLOUT`. + pub fn poll_on_write(&mut self, val: bool) -> &mut WaitFd { + self.flag(curl_sys::CURL_WAIT_POLLOUT, val) + } + + fn flag(&mut self, flag: c_short, val: bool) -> &mut WaitFd { + if val { + self.inner.events |= flag; + } else { + self.inner.events &= !flag; + } + self + } + + /// After a call to `wait`, returns `true` if `poll_on_read` was set and a + /// read event occured. + pub fn received_read(&self) -> bool { + self.inner.revents & curl_sys::CURL_WAIT_POLLIN == curl_sys::CURL_WAIT_POLLIN + } + + /// After a call to `wait`, returns `true` if `poll_on_priority_read` was set and a + /// priority read event occured. + pub fn received_priority_read(&self) -> bool { + self.inner.revents & curl_sys::CURL_WAIT_POLLPRI == curl_sys::CURL_WAIT_POLLPRI + } + + /// After a call to `wait`, returns `true` if `poll_on_write` was set and a + /// write event occured. + pub fn received_write(&self) -> bool { + self.inner.revents & curl_sys::CURL_WAIT_POLLOUT == curl_sys::CURL_WAIT_POLLOUT + } +} + +#[cfg(unix)] +impl From for WaitFd { + fn from(pfd: pollfd) -> WaitFd { + let mut events = 0; + if pfd.events & POLLIN == POLLIN { + events |= curl_sys::CURL_WAIT_POLLIN; + } + if pfd.events & POLLPRI == POLLPRI { + events |= curl_sys::CURL_WAIT_POLLPRI; + } + if pfd.events & POLLOUT == POLLOUT { + events |= curl_sys::CURL_WAIT_POLLOUT; + } + WaitFd { + inner: curl_sys::curl_waitfd { + fd: pfd.fd, + events: events, + revents: 0, + }, + } + } +} + +impl fmt::Debug for WaitFd { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("WaitFd") + .field("fd", &self.inner.fd) + .field("events", &self.inner.fd) + .field("revents", &self.inner.fd) + .finish() + } +} diff -Nru cargo-0.35.0/vendor/curl/README.md cargo-0.37.0/vendor/curl/README.md --- cargo-0.35.0/vendor/curl/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/curl/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -135,7 +135,7 @@ - `http2`: Enable HTTP/2 support via libnghttp2. Disabled by default. - `static-curl`: Use a bundled libcurl version and statically link to it. Disabled by default. - `static-ssl`: Use a bundled OpenSSL version and statically link to it. Only applies on platforms that use OpenSSL. Disabled by default. -- `spengo`: Enable SPENGO support. Disabled by default. +- `spnego`: Enable SPNEGO support. Disabled by default. ## Version Support diff -Nru cargo-0.35.0/vendor/curl/src/easy/form.rs cargo-0.37.0/vendor/curl/src/easy/form.rs --- cargo-0.35.0/vendor/curl/src/easy/form.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/curl/src/easy/form.rs 2019-07-17 05:42:23.000000000 +0000 @@ -250,8 +250,16 @@ self._buffer(name.as_ref(), data) } - fn _buffer(&mut self, name: &'data Path, data: Vec) -> &mut Self { + fn _buffer(&mut self, name: &'data Path, mut data: Vec) -> &mut Self { if let Some(bytes) = self.path2cstr(name) { + // If `CURLFORM_BUFFERLENGTH` is set to `0`, libcurl will instead do a strlen() on the + // contents to figure out the size so we need to make sure the buffer is actually + // zero terminated. + let length = data.len(); + if length == 0 { + data.push(0); + } + let pos = self.array.len() - 1; self.array.insert( pos, @@ -272,7 +280,7 @@ pos + 2, curl_sys::curl_forms { option: curl_sys::CURLFORM_BUFFERLENGTH, - value: data.len() as *mut _, + value: length as *mut _, }, ); self.form.buffers.push(data); diff -Nru cargo-0.35.0/vendor/curl/src/easy/windows.rs cargo-0.37.0/vendor/curl/src/easy/windows.rs --- cargo-0.35.0/vendor/curl/src/easy/windows.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/curl/src/easy/windows.rs 2019-07-17 05:42:23.000000000 +0000 @@ -4,21 +4,21 @@ #[cfg(target_env = "msvc")] mod win { - use kernel32; use schannel::cert_context::ValidUses; use schannel::cert_store::CertStore; use std::ffi::CString; use std::mem; use std::ptr; use winapi::{self, c_int, c_long, c_uchar, c_void}; + use winapi::um::libloaderapi::{GetModuleHandleW, GetProcAddress}; fn lookup(module: &str, symbol: &str) -> Option<*const c_void> { unsafe { let symbol = CString::new(symbol).unwrap(); let mut mod_buf: Vec = module.encode_utf16().collect(); mod_buf.push(0); - let handle = kernel32::GetModuleHandleW(mod_buf.as_mut_ptr()); - let n = kernel32::GetProcAddress(handle, symbol.as_ptr()); + let handle = GetModuleHandleW(mod_buf.as_mut_ptr()); + let n = GetProcAddress(handle, symbol.as_ptr()); if n == ptr::null() { None } else { diff -Nru cargo-0.35.0/vendor/curl/src/lib.rs cargo-0.37.0/vendor/curl/src/lib.rs --- cargo-0.35.0/vendor/curl/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/curl/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -63,8 +63,6 @@ extern crate winapi; #[cfg(target_env = "msvc")] -extern crate kernel32; -#[cfg(target_env = "msvc")] extern crate schannel; use std::ffi::CStr; diff -Nru cargo-0.35.0/vendor/curl/src/multi.rs cargo-0.37.0/vendor/curl/src/multi.rs --- cargo-0.35.0/vendor/curl/src/multi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/curl/src/multi.rs 2019-07-17 05:42:23.000000000 +0000 @@ -10,7 +10,7 @@ #[cfg(unix)] use libc::{fd_set, pollfd, POLLIN, POLLOUT, POLLPRI}; #[cfg(windows)] -use winapi::winsock2::fd_set; +use winapi::um::winsock2::fd_set; use easy::{Easy, Easy2}; use panic; diff -Nru cargo-0.35.0/vendor/curl-sys/build.rs cargo-0.37.0/vendor/curl-sys/build.rs --- cargo-0.35.0/vendor/curl-sys/build.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/curl-sys/build.rs 2019-07-17 05:42:23.000000000 +0000 @@ -131,6 +131,7 @@ .file("curl/lib/cookie.c") .file("curl/lib/curl_addrinfo.c") .file("curl/lib/curl_ctype.c") + .file("curl/lib/curl_get_line.c") .file("curl/lib/curl_memrchr.c") .file("curl/lib/curl_range.c") .file("curl/lib/curl_threads.c") @@ -162,7 +163,6 @@ .file("curl/lib/netrc.c") .file("curl/lib/nonblock.c") .file("curl/lib/parsedate.c") - .file("curl/lib/pipeline.c") .file("curl/lib/progress.c") .file("curl/lib/rand.c") .file("curl/lib/select.c") diff -Nru cargo-0.35.0/vendor/curl-sys/.cargo-checksum.json cargo-0.37.0/vendor/curl-sys/.cargo-checksum.json --- cargo-0.35.0/vendor/curl-sys/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/curl-sys/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"9d91a0052d5b982887d8e829bee0faffc7218ea3c6ebd3d6c2c8f678a93c9a42"} \ No newline at end of file +{"files":{},"package":"5e90ae10f635645cba9cad1023535f54915a95c58c44751c6ed70dbaeb17a408"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/curl-sys/Cargo.toml cargo-0.37.0/vendor/curl-sys/Cargo.toml --- cargo-0.35.0/vendor/curl-sys/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/curl-sys/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,7 +12,7 @@ [package] name = "curl-sys" -version = "0.4.18" +version = "0.4.20" authors = ["Alex Crichton "] build = "build.rs" links = "curl" @@ -47,7 +47,7 @@ spnego = [] ssl = ["openssl-sys"] static-curl = [] -static-ssl = ["openssl-sys/vendored"] +static-ssl = ["openssl-sys"] [target."cfg(all(unix, not(target_os = \"macos\")))".dependencies.openssl-sys] version = "0.9" optional = true diff -Nru cargo-0.35.0/vendor/curl-sys/debian/patches/disable-vendor.patch cargo-0.37.0/vendor/curl-sys/debian/patches/disable-vendor.patch --- cargo-0.35.0/vendor/curl-sys/debian/patches/disable-vendor.patch 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/curl-sys/debian/patches/disable-vendor.patch 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,11 @@ +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -47,7 +47,7 @@ + spnego = [] + ssl = ["openssl-sys"] + static-curl = [] +-static-ssl = ["openssl-sys/vendored"] ++static-ssl = ["openssl-sys"] + [target."cfg(all(unix, not(target_os = \"macos\")))".dependencies.openssl-sys] + version = "0.9" + optional = true diff -Nru cargo-0.35.0/vendor/curl-sys/debian/patches/series cargo-0.37.0/vendor/curl-sys/debian/patches/series --- cargo-0.35.0/vendor/curl-sys/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/curl-sys/debian/patches/series 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +disable-vendor.patch diff -Nru cargo-0.35.0/vendor/curl-sys/.pc/applied-patches cargo-0.37.0/vendor/curl-sys/.pc/applied-patches --- cargo-0.35.0/vendor/curl-sys/.pc/applied-patches 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/curl-sys/.pc/applied-patches 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +disable-vendor.patch diff -Nru cargo-0.35.0/vendor/curl-sys/.pc/disable-vendor.patch/Cargo.toml cargo-0.37.0/vendor/curl-sys/.pc/disable-vendor.patch/Cargo.toml --- cargo-0.35.0/vendor/curl-sys/.pc/disable-vendor.patch/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/curl-sys/.pc/disable-vendor.patch/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,63 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# 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 = "curl-sys" +version = "0.4.20" +authors = ["Alex Crichton "] +build = "build.rs" +links = "curl" +description = "Native bindings to the libcurl library" +documentation = "https://docs.rs/curl-sys" +categories = ["external-ffi-bindings"] +license = "MIT" +repository = "https://github.com/alexcrichton/curl-rust" + +[lib] +name = "curl_sys" +path = "lib.rs" +[dependencies.libc] +version = "0.2.2" + +[dependencies.libnghttp2-sys] +version = "0.1" +optional = true + +[dependencies.libz-sys] +version = "1.0.18" +[build-dependencies.cc] +version = "1.0" + +[build-dependencies.pkg-config] +version = "0.3.3" + +[features] +default = ["ssl"] +force-system-lib-on-osx = [] +http2 = ["libnghttp2-sys"] +spnego = [] +ssl = ["openssl-sys"] +static-curl = [] +static-ssl = ["openssl-sys/vendored"] +[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies.openssl-sys] +version = "0.9" +optional = true +[target."cfg(target_env = \"msvc\")".build-dependencies.vcpkg] +version = "0.2" +[target."cfg(windows)".dependencies.winapi] +version = "0.3" +features = ["winsock2", "ws2def"] +[badges.appveyor] +repository = "alexcrichton/curl-rust" + +[badges.travis-ci] +repository = "alexcrichton/curl-rust" diff -Nru cargo-0.35.0/vendor/curl-sys/.pc/.quilt_patches cargo-0.37.0/vendor/curl-sys/.pc/.quilt_patches --- cargo-0.35.0/vendor/curl-sys/.pc/.quilt_patches 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/curl-sys/.pc/.quilt_patches 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +debian/patches diff -Nru cargo-0.35.0/vendor/curl-sys/.pc/.quilt_series cargo-0.37.0/vendor/curl-sys/.pc/.quilt_series --- cargo-0.35.0/vendor/curl-sys/.pc/.quilt_series 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/curl-sys/.pc/.quilt_series 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +series diff -Nru cargo-0.35.0/vendor/curl-sys/.pc/.version cargo-0.37.0/vendor/curl-sys/.pc/.version --- cargo-0.35.0/vendor/curl-sys/.pc/.version 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/curl-sys/.pc/.version 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +2 diff -Nru cargo-0.35.0/vendor/env_logger/.cargo-checksum.json cargo-0.37.0/vendor/env_logger/.cargo-checksum.json --- cargo-0.35.0/vendor/env_logger/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/env_logger/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"b61fa891024a945da30a9581546e8cfaf5602c7b3f4c137a2805cf388f92075a"} \ No newline at end of file +{"files":{},"package":"aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/env_logger/Cargo.toml cargo-0.37.0/vendor/env_logger/Cargo.toml --- cargo-0.35.0/vendor/env_logger/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/env_logger/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "env_logger" -version = "0.6.1" +version = "0.6.2" authors = ["The Rust Project Developers"] description = "A logging implementation for `log` which is configured via an environment\nvariable.\n" documentation = "https://docs.rs/env_logger" diff -Nru cargo-0.35.0/vendor/env_logger/CHANGELOG.md cargo-0.37.0/vendor/env_logger/CHANGELOG.md --- cargo-0.35.0/vendor/env_logger/CHANGELOG.md 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/env_logger/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,3 @@ +Changes to this crate are tracked via [GitHub Releases][releases]. + +[releases]: https://github.com/sebasmagri/env_logger/releases diff -Nru cargo-0.35.0/vendor/env_logger/examples/default.rs cargo-0.37.0/vendor/env_logger/examples/default.rs --- cargo-0.35.0/vendor/env_logger/examples/default.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/env_logger/examples/default.rs 2019-07-17 05:42:23.000000000 +0000 @@ -22,6 +22,9 @@ use env_logger::Env; fn main() { + // The `Env` lets us tweak what the environment + // variables to read are and what the default + // value is if they're missing let env = Env::default() .filter_or("MY_LOG_LEVEL", "trace") .write_style_or("MY_LOG_STYLE", "always"); diff -Nru cargo-0.35.0/vendor/env_logger/examples/filters_from_code.rs cargo-0.37.0/vendor/env_logger/examples/filters_from_code.rs --- cargo-0.35.0/vendor/env_logger/examples/filters_from_code.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/env_logger/examples/filters_from_code.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,19 @@ +/*! +Specify logging filters in code instead of using an environment variable. +*/ + +#[macro_use] +extern crate log; +extern crate env_logger; + +fn main() { + env_logger::builder() + .filter_level(log::LevelFilter::Trace) + .init(); + + trace!("some trace log"); + debug!("some debug log"); + info!("some information log"); + warn!("some warning log"); + error!("some error log"); +} diff -Nru cargo-0.35.0/vendor/env_logger/README.md cargo-0.37.0/vendor/env_logger/README.md --- cargo-0.35.0/vendor/env_logger/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/env_logger/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -16,7 +16,7 @@ ```toml [dependencies] log = "0.4.0" -env_logger = "0.6.1" +env_logger = "0.6.2" ``` `env_logger` must be initialized as early as possible in the project. After it's initialized, you can use the `log` macros to do actual logging. @@ -43,6 +43,8 @@ [2018-11-03T06:09:06Z INFO default] starting up ``` +`env_logger` can be configured in other ways besides an environment variable. See [the examples](https://github.com/sebasmagri/env_logger/tree/master/examples) for more approaches. + ### In tests Tests can use the `env_logger` crate to see log messages generated during that test: @@ -52,7 +54,7 @@ log = "0.4.0" [dev-dependencies] -env_logger = "0.6.1" +env_logger = "0.6.2" ``` ```rust @@ -147,4 +149,4 @@ The default format won't optimise for long-term stability, and explicitly makes no guarantees about the stability of its output across major, minor or patch version bumps during `0.x`. -If you want to capture or interpret the output of `env_logger` programmatically then you should use a custom format. \ No newline at end of file +If you want to capture or interpret the output of `env_logger` programmatically then you should use a custom format. diff -Nru cargo-0.35.0/vendor/env_logger/src/fmt/mod.rs cargo-0.37.0/vendor/env_logger/src/fmt/mod.rs --- cargo-0.35.0/vendor/env_logger/src/fmt/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/env_logger/src/fmt/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -117,6 +117,7 @@ pub default_format_timestamp_nanos: bool, pub default_format_module_path: bool, pub default_format_level: bool, + #[allow(unknown_lints, bare_trait_objects)] pub custom_format: Option io::Result<()> + Sync + Send>>, built: bool, } @@ -140,6 +141,7 @@ /// If the `custom_format` is `Some`, then any `default_format` switches are ignored. /// If the `custom_format` is `None`, then a default format is returned. /// Any `default_format` switches set to `false` won't be written by the format. + #[allow(unknown_lints, bare_trait_objects)] pub fn build(&mut self) -> Box io::Result<()> + Sync + Send> { assert!(!self.built, "attempt to re-use consumed builder"); @@ -353,4 +355,4 @@ assert_eq!("log message\n", written); } -} \ No newline at end of file +} diff -Nru cargo-0.35.0/vendor/env_logger/src/lib.rs cargo-0.37.0/vendor/env_logger/src/lib.rs --- cargo-0.35.0/vendor/env_logger/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/env_logger/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -157,6 +157,8 @@ //! //! #[test] //! fn it_works() { +//! init(); +//! //! info!("This record will be captured by `cargo test`"); //! //! assert_eq!(2, 1 + 1); @@ -236,7 +238,7 @@ #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://www.rust-lang.org/static/images/favicon.ico", - html_root_url = "https://docs.rs/env_logger/0.6.1")] + html_root_url = "https://docs.rs/env_logger/0.6.2")] #![cfg_attr(test, deny(warnings))] // When compiled for the rustc compiler itself we want to make sure that this is @@ -320,6 +322,7 @@ pub struct Logger { writer: Writer, filter: Filter, + #[allow(unknown_lints, bare_trait_objects)] format: Box io::Result<()> + Sync + Send>, } diff -Nru cargo-0.35.0/vendor/filetime/.cargo-checksum.json cargo-0.37.0/vendor/filetime/.cargo-checksum.json --- cargo-0.35.0/vendor/filetime/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/filetime/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"2f8c63033fcba1f51ef744505b3cad42510432b904c062afa67ad7ece008429d"} \ No newline at end of file +{"files":{},"package":"450537dc346f0c4d738dda31e790da1da5d4bd12145aad4da0d03d713cb3794f"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/filetime/Cargo.toml cargo-0.37.0/vendor/filetime/Cargo.toml --- cargo-0.35.0/vendor/filetime/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/filetime/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -11,8 +11,9 @@ # will likely look very different (and much more reasonable) [package] +edition = "2018" name = "filetime" -version = "0.2.5" +version = "0.2.6" authors = ["Alex Crichton "] description = "Platform-agnostic accessors of timestamps in File metadata\n" homepage = "https://github.com/alexcrichton/filetime" @@ -29,3 +30,6 @@ version = "0.1" [target."cfg(unix)".dependencies.libc] version = "0.2" +[target."cfg(windows)".dependencies.winapi] +version = "0.3" +features = ["fileapi", "minwindef", "winbase"] diff -Nru cargo-0.35.0/vendor/filetime/src/lib.rs cargo-0.37.0/vendor/filetime/src/lib.rs --- cargo-0.35.0/vendor/filetime/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/filetime/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -34,16 +34,13 @@ //! println!("{}", mtime.seconds()); //! ``` -#[macro_use] -extern crate cfg_if; - use std::fmt; use std::fs; use std::io; use std::path::Path; use std::time::{Duration, SystemTime, UNIX_EPOCH}; -cfg_if! { +cfg_if::cfg_if! { if #[cfg(target_os = "redox")] { #[path = "redox.rs"] mod imp; @@ -75,12 +72,18 @@ /// /// Useful for creating the base of a cmp::max chain of times. pub fn zero() -> FileTime { - FileTime { seconds: 0, nanos: 0 } + FileTime { + seconds: 0, + nanos: 0, + } } fn emulate_second_only_system(self) -> FileTime { if cfg!(emulate_second_only_system) { - FileTime {seconds: self.seconds, nanos: 0} + FileTime { + seconds: self.seconds, + nanos: 0, + } } else { self } @@ -98,9 +101,10 @@ /// instance may not be the same as that passed in. pub fn from_unix_time(seconds: i64, nanos: u32) -> FileTime { FileTime { - seconds: seconds + if cfg!(windows) {11644473600} else {0}, + seconds: seconds + if cfg!(windows) { 11644473600 } else { 0 }, nanos, - }.emulate_second_only_system() + } + .emulate_second_only_system() } /// Creates a new timestamp from the last modification time listed in the @@ -144,23 +148,25 @@ UNIX_EPOCH }; - time.duration_since(epoch).map(|d| FileTime { - seconds: d.as_secs() as i64, - nanos: d.subsec_nanos() - }) - .unwrap_or_else(|e| { - let until_epoch = e.duration(); - let (sec_offset, nanos) = if until_epoch.subsec_nanos() == 0 { - (0, 0) - } else { - (-1, 1_000_000_000 - until_epoch.subsec_nanos()) - }; - - FileTime { - seconds: -1 * until_epoch.as_secs() as i64 + sec_offset, - nanos - } - }).emulate_second_only_system() + time.duration_since(epoch) + .map(|d| FileTime { + seconds: d.as_secs() as i64, + nanos: d.subsec_nanos(), + }) + .unwrap_or_else(|e| { + let until_epoch = e.duration(); + let (sec_offset, nanos) = if until_epoch.subsec_nanos() == 0 { + (0, 0) + } else { + (-1, 1_000_000_000 - until_epoch.subsec_nanos()) + }; + + FileTime { + seconds: -1 * until_epoch.as_secs() as i64 + sec_offset, + nanos, + } + }) + .emulate_second_only_system() } /// Returns the whole number of seconds represented by this timestamp. @@ -168,7 +174,9 @@ /// Note that this value's meaning is **platform specific**. On Unix /// platform time stamps are typically relative to January 1, 1970, but on /// Windows platforms time stamps are relative to January 1, 1601. - pub fn seconds(&self) -> i64 { self.seconds } + pub fn seconds(&self) -> i64 { + self.seconds + } /// Returns the whole number of seconds represented by this timestamp, /// relative to the Unix epoch start of January 1, 1970. @@ -176,7 +184,7 @@ /// Note that this does not return the same value as `seconds` for Windows /// platforms as seconds are relative to a different date there. pub fn unix_seconds(&self) -> i64 { - self.seconds - if cfg!(windows) {11644473600} else {0} + self.seconds - if cfg!(windows) { 11644473600 } else { 0 } } /// Returns the nanosecond precision of this timestamp. @@ -184,7 +192,9 @@ /// The returned value is always less than one billion and represents a /// portion of a second forward from the seconds returned by the `seconds` /// method. - pub fn nanoseconds(&self) -> u32 { self.nanos } + pub fn nanoseconds(&self) -> u32 { + self.nanos + } } impl fmt::Display for FileTime { @@ -203,49 +213,97 @@ /// /// This function will set the `atime` and `mtime` metadata fields for a file /// on the local filesystem, returning any error encountered. -pub fn set_file_times

(p: P, atime: FileTime, mtime: FileTime) - -> io::Result<()> - where P: AsRef +pub fn set_file_times

(p: P, atime: FileTime, mtime: FileTime) -> io::Result<()> +where + P: AsRef, { imp::set_file_times(p.as_ref(), atime, mtime) } +/// Set the last access and modification times for a file handle. +/// +/// This function will either or both of the `atime` and `mtime` metadata +/// fields for a file handle , returning any error encountered. If `None` is +/// specified then the time won't be updated. If `None` is specified for both +/// options then no action is taken. +pub fn set_file_handle_times( + f: &fs::File, + atime: Option, + mtime: Option, +) -> io::Result<()> { + imp::set_file_handle_times(f, atime, mtime) +} + /// Set the last access and modification times for a file on the filesystem. /// This function does not follow symlink. /// /// This function will set the `atime` and `mtime` metadata fields for a file /// on the local filesystem, returning any error encountered. -pub fn set_symlink_file_times

(p: P, atime: FileTime, mtime: FileTime) - -> io::Result<()> - where P: AsRef +pub fn set_symlink_file_times

(p: P, atime: FileTime, mtime: FileTime) -> io::Result<()> +where + P: AsRef, { imp::set_symlink_file_times(p.as_ref(), atime, mtime) } +/// Set the last modification time for a file on the filesystem. +/// +/// This function will set the `mtime` metadata field for a file on the local +/// filesystem, returning any error encountered. +/// +/// # Platform support +/// +/// Where supported this will attempt to issue just one syscall to update only +/// the `mtime`, but where not supported this may issue one syscall to learn the +/// existing `atime` so only the `mtime` can be configured. +pub fn set_file_mtime

(p: P, mtime: FileTime) -> io::Result<()> +where + P: AsRef, +{ + imp::set_file_mtime(p.as_ref(), mtime) +} + +/// Set the last access time for a file on the filesystem. +/// +/// This function will set the `atime` metadata field for a file on the local +/// filesystem, returning any error encountered. +/// +/// # Platform support +/// +/// Where supported this will attempt to issue just one syscall to update only +/// the `atime`, but where not supported this may issue one syscall to learn the +/// existing `mtime` so only the `atime` can be configured. +pub fn set_file_atime

(p: P, atime: FileTime) -> io::Result<()> +where + P: AsRef, +{ + imp::set_file_atime(p.as_ref(), atime) +} + #[cfg(test)] mod tests { - extern crate tempdir; - + use tempdir::TempDir; + use super::{set_file_handle_times, set_file_times, set_symlink_file_times, FileTime}; + use std::fs::{self, File}; use std::io; use std::path::Path; - use std::fs::{self, File}; - use self::tempdir::TempDir; - use super::{FileTime, set_file_times, set_symlink_file_times}; use std::time::{Duration, UNIX_EPOCH}; #[cfg(unix)] - fn make_symlink(src: P, dst: Q) -> io::Result<()> - where P: AsRef, - Q: AsRef, + fn make_symlink(src: P, dst: Q) -> io::Result<()> + where + P: AsRef, + Q: AsRef, { use std::os::unix::fs::symlink; symlink(src, dst) } #[cfg(windows)] - fn make_symlink(src: P, dst: Q) -> io::Result<()> - where P: AsRef, - Q: AsRef, + fn make_symlink(src: P, dst: Q) -> io::Result<()> + where + P: AsRef, + Q: AsRef, { use std::os::windows::fs::symlink_file; symlink_file(src, dst) @@ -324,47 +382,66 @@ } #[test] - fn set_file_times_test() { - let td = TempDir::new("filetime").unwrap(); + fn set_file_times_test() -> io::Result<()> { + let td = TempDir::new("filetime")?; let path = td.path().join("foo.txt"); - File::create(&path).unwrap(); + let mut f = File::create(&path)?; - let metadata = fs::metadata(&path).unwrap(); + let metadata = fs::metadata(&path)?; let mtime = FileTime::from_last_modification_time(&metadata); let atime = FileTime::from_last_access_time(&metadata); - set_file_times(&path, atime, mtime).unwrap(); + set_file_times(&path, atime, mtime)?; let new_mtime = FileTime::from_unix_time(10_000, 0); - set_file_times(&path, atime, new_mtime).unwrap(); + set_file_times(&path, atime, new_mtime)?; - let metadata = fs::metadata(&path).unwrap(); + let metadata = fs::metadata(&path)?; let mtime = FileTime::from_last_modification_time(&metadata); assert_eq!(mtime, new_mtime); + // Update just mtime + let new_mtime = FileTime::from_unix_time(20_000, 0); + set_file_handle_times(&mut f, None, Some(new_mtime))?; + let metadata = f.metadata()?; + let mtime = FileTime::from_last_modification_time(&metadata); + assert_eq!(mtime, new_mtime); + let new_atime = FileTime::from_last_access_time(&metadata); + assert_eq!(atime, new_atime); + + // Update just atime + let new_atime = FileTime::from_unix_time(30_000, 0); + set_file_handle_times(&mut f, Some(new_atime), None)?; + let metadata = f.metadata()?; + let mtime = FileTime::from_last_modification_time(&metadata); + assert_eq!(mtime, new_mtime); + let atime = FileTime::from_last_access_time(&metadata); + assert_eq!(atime, new_atime); + let spath = td.path().join("bar.txt"); - make_symlink(&path, &spath).unwrap(); - let metadata = fs::symlink_metadata(&spath).unwrap(); + make_symlink(&path, &spath)?; + let metadata = fs::symlink_metadata(&spath)?; let smtime = FileTime::from_last_modification_time(&metadata); - set_file_times(&spath, atime, mtime).unwrap(); + set_file_times(&spath, atime, mtime)?; - let metadata = fs::metadata(&path).unwrap(); + let metadata = fs::metadata(&path)?; let cur_mtime = FileTime::from_last_modification_time(&metadata); assert_eq!(mtime, cur_mtime); - let metadata = fs::symlink_metadata(&spath).unwrap(); + let metadata = fs::symlink_metadata(&spath)?; let cur_mtime = FileTime::from_last_modification_time(&metadata); assert_eq!(smtime, cur_mtime); - set_file_times(&spath, atime, new_mtime).unwrap(); + set_file_times(&spath, atime, new_mtime)?; - let metadata = fs::metadata(&path).unwrap(); + let metadata = fs::metadata(&path)?; let mtime = FileTime::from_last_modification_time(&metadata); assert_eq!(mtime, new_mtime); - let metadata = fs::symlink_metadata(&spath).unwrap(); + let metadata = fs::symlink_metadata(&spath)?; let mtime = FileTime::from_last_modification_time(&metadata); assert_eq!(mtime, smtime); + Ok(()) } #[test] @@ -443,4 +520,34 @@ let mtime = FileTime::from_last_modification_time(&metadata); assert_eq!(mtime, new_smtime); } + + #[test] + fn set_single_time_test() { + use super::{set_file_atime, set_file_mtime}; + + let td = TempDir::new("filetime").unwrap(); + let path = td.path().join("foo.txt"); + File::create(&path).unwrap(); + + let metadata = fs::metadata(&path).unwrap(); + let mtime = FileTime::from_last_modification_time(&metadata); + let atime = FileTime::from_last_access_time(&metadata); + set_file_times(&path, atime, mtime).unwrap(); + + let new_mtime = FileTime::from_unix_time(10_000, 0); + set_file_mtime(&path, new_mtime).unwrap(); + + let metadata = fs::metadata(&path).unwrap(); + let mtime = FileTime::from_last_modification_time(&metadata); + assert_eq!(mtime, new_mtime); + assert_eq!(atime, FileTime::from_last_access_time(&metadata)); + + let new_atime = FileTime::from_unix_time(20_000, 0); + set_file_atime(&path, new_atime).unwrap(); + + let metadata = fs::metadata(&path).unwrap(); + let atime = FileTime::from_last_access_time(&metadata); + assert_eq!(atime, new_atime); + assert_eq!(mtime, FileTime::from_last_modification_time(&metadata)); + } } diff -Nru cargo-0.35.0/vendor/filetime/src/redox.rs cargo-0.37.0/vendor/filetime/src/redox.rs --- cargo-0.35.0/vendor/filetime/src/redox.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/filetime/src/redox.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,11 +1,8 @@ -extern crate syscall; - -use std::fs; +use std::fs::{self, File}; use std::io; use std::os::unix::prelude::*; use std::path::Path; - -use FileTime; +use crate::FileTime; pub fn set_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { let fd = syscall::open(p.as_os_str().as_bytes(), 0) @@ -13,6 +10,22 @@ set_file_times_redox(fd, atime, mtime) } +pub fn set_file_mtime(_p: &Path, _mtime: FileTime) -> io::Result<()> { + unimplemented!() +} + +pub fn set_file_atime(_p: &Path, _atime: FileTime) -> io::Result<()> { + unimplemented!() +} + +pub fn set_file_handle_times( + _f: &File, + _atime: Option, + _mtime: Option, +) -> io::Result<()> { + unimplemented!() +} + pub fn set_symlink_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { let fd = syscall::open(p.as_os_str().as_bytes(), syscall::O_NOFOLLOW) .map_err(|err| io::Error::from_raw_os_error(err.errno))?; @@ -20,7 +33,7 @@ } fn set_file_times_redox(fd: usize, atime: FileTime, mtime: FileTime) -> io::Result<()> { - use self::syscall::TimeSpec; + use syscall::TimeSpec; fn to_timespec(ft: &FileTime) -> TimeSpec { TimeSpec { diff -Nru cargo-0.35.0/vendor/filetime/src/unix/linux.rs cargo-0.37.0/vendor/filetime/src/unix/linux.rs --- cargo-0.35.0/vendor/filetime/src/unix/linux.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/filetime/src/unix/linux.rs 2019-07-17 05:42:23.000000000 +0000 @@ -2,61 +2,101 @@ //! always available so we also fall back to `utimes` if we couldn't find //! `utimensat` at runtime. +use crate::FileTime; +use std::ffi::CString; +use std::fs; use std::io; -use std::mem; +use std::os::unix::prelude::*; use std::path::Path; -use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; -use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT}; - -use FileTime; -use super::libc::{self, c_int, c_char, timespec}; +use std::ptr; +use std::sync::atomic::AtomicBool; +use std::sync::atomic::Ordering::SeqCst; pub fn set_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { - set_times(p, atime, mtime, false) + set_times(p, Some(atime), Some(mtime), false) } -pub fn set_symlink_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { - set_times(p, atime, mtime, true) +pub fn set_file_mtime(p: &Path, mtime: FileTime) -> io::Result<()> { + set_times(p, None, Some(mtime), false) +} + +pub fn set_file_atime(p: &Path, atime: FileTime) -> io::Result<()> { + set_times(p, Some(atime), None, false) } -fn set_times(p: &Path, atime: FileTime, mtime: FileTime, symlink: bool) -> io::Result<()> { - let flags = if symlink { libc::AT_SYMLINK_NOFOLLOW } else { 0 }; - let utimes = if symlink { libc::lutimes } else { libc::utimes }; - - // Try to use the more-accurate `utimensat` when possible. - static INVALID: AtomicBool = ATOMIC_BOOL_INIT; - if !INVALID.load(Ordering::SeqCst) { - if let Some(f) = utimensat() { - // Even when libc has `utimensat`, the kernel may return `ENOSYS`, - // and then we'll need to use the `utimes` fallback instead. - match super::utimensat(p, atime, mtime, f, flags) { - Err(ref e) if e.raw_os_error() == Some(libc::ENOSYS) => { - INVALID.store(true, Ordering::SeqCst); - } - valid => return valid, - } +pub fn set_file_handle_times( + f: &fs::File, + atime: Option, + mtime: Option, +) -> io::Result<()> { + // Attempt to use the `utimensat` syscall, but if it's not supported by the + // current kernel then fall back to an older syscall. + static INVALID: AtomicBool = AtomicBool::new(false); + if !INVALID.load(SeqCst) { + let times = [super::to_timespec(&atime), super::to_timespec(&mtime)]; + let rc = unsafe { + libc::syscall( + libc::SYS_utimensat, + f.as_raw_fd(), + ptr::null::(), + times.as_ptr(), + 0, + ) + }; + if rc == 0 { + return Ok(()); + } + let err = io::Error::last_os_error(); + if err.raw_os_error() == Some(libc::ENOSYS) { + INVALID.store(true, SeqCst); + } else { + return Err(err); } } - super::utimes(p, atime, mtime, utimes) + super::utimes::set_file_handle_times(f, atime, mtime) } -fn utimensat() -> Option c_int> { - static ADDR: AtomicUsize = ATOMIC_USIZE_INIT; - unsafe { - match ADDR.load(Ordering::SeqCst) { - 0 => {} - 1 => return None, - n => return Some(mem::transmute(n)), +pub fn set_symlink_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { + set_times(p, Some(atime), Some(mtime), true) +} + +fn set_times( + p: &Path, + atime: Option, + mtime: Option, + symlink: bool, +) -> io::Result<()> { + let flags = if symlink { + libc::AT_SYMLINK_NOFOLLOW + } else { + 0 + }; + + // Same as the `if` statement above. + static INVALID: AtomicBool = AtomicBool::new(false); + if !INVALID.load(SeqCst) { + let p = CString::new(p.as_os_str().as_bytes())?; + let times = [super::to_timespec(&atime), super::to_timespec(&mtime)]; + let rc = unsafe { + libc::syscall( + libc::SYS_utimensat, + libc::AT_FDCWD, + p.as_ptr(), + times.as_ptr(), + flags, + ) + }; + if rc == 0 { + return Ok(()); } - let name = b"utimensat\0"; - let sym = libc::dlsym(libc::RTLD_DEFAULT, name.as_ptr() as *const _); - let (val, ret) = if sym.is_null() { - (1, None) + let err = io::Error::last_os_error(); + if err.raw_os_error() == Some(libc::ENOSYS) { + INVALID.store(true, SeqCst); } else { - (sym as usize, Some(mem::transmute(sym))) - }; - ADDR.store(val, Ordering::SeqCst); - return ret + return Err(err); + } } + + super::utimes::set_times(p, atime, mtime, symlink) } diff -Nru cargo-0.35.0/vendor/filetime/src/unix/mod.rs cargo-0.37.0/vendor/filetime/src/unix/mod.rs --- cargo-0.35.0/vendor/filetime/src/unix/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/filetime/src/unix/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,18 +1,11 @@ -extern crate libc; - -use std::ffi::CString; +use crate::FileTime; +use libc::{time_t, timespec}; use std::fs; -use std::io; use std::os::unix::prelude::*; -use std::path::Path; - -use self::libc::{c_int, c_char, timeval, time_t, suseconds_t}; -use self::libc::{timespec}; -use FileTime; - -cfg_if! { +cfg_if::cfg_if! { if #[cfg(target_os = "linux")] { + mod utimes; mod linux; pub use self::linux::*; } else if #[cfg(any(target_os = "android", @@ -30,51 +23,18 @@ } #[allow(dead_code)] -fn utimes(p: &Path, - atime: FileTime, - mtime: FileTime, - utimes: unsafe extern fn(*const c_char, *const timeval) -> c_int) - -> io::Result<()> -{ - let times = [to_timeval(&atime), to_timeval(&mtime)]; - let p = try!(CString::new(p.as_os_str().as_bytes())); - return if unsafe { utimes(p.as_ptr() as *const _, times.as_ptr()) == 0 } { - Ok(()) - } else { - Err(io::Error::last_os_error()) - }; +fn to_timespec(ft: &Option) -> timespec { + const UTIME_OMIT: i64 = 1073741822; - fn to_timeval(ft: &FileTime) -> timeval { - timeval { + if let &Some(ft) = ft { + timespec { tv_sec: ft.seconds() as time_t, - tv_usec: (ft.nanoseconds() / 1000) as suseconds_t, + tv_nsec: ft.nanoseconds() as _, } - } -} - -#[allow(dead_code)] -fn utimensat(p: &Path, - atime: FileTime, - mtime: FileTime, - f: unsafe extern fn(c_int, *const c_char, *const timespec, c_int) -> c_int, - flags: c_int) - -> io::Result<()> -{ - let times = [to_timespec(&atime), to_timespec(&mtime)]; - let p = try!(CString::new(p.as_os_str().as_bytes())); - let rc = unsafe { - f(libc::AT_FDCWD, p.as_ptr() as *const _, times.as_ptr(), flags) - }; - return if rc == 0 { - Ok(()) } else { - Err(io::Error::last_os_error()) - }; - - fn to_timespec(ft: &FileTime) -> timespec { timespec { - tv_sec: ft.seconds() as time_t, - tv_nsec: ft.nanoseconds() as _, + tv_sec: 0, + tv_nsec: UTIME_OMIT as _, } } } diff -Nru cargo-0.35.0/vendor/filetime/src/unix/utimensat.rs cargo-0.37.0/vendor/filetime/src/unix/utimensat.rs --- cargo-0.35.0/vendor/filetime/src/unix/utimensat.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/filetime/src/unix/utimensat.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,13 +1,58 @@ -use std::path::Path; +use crate::FileTime; +use std::ffi::CString; +use std::fs::File; use std::io; - -use FileTime; -use super::libc; +use std::os::unix::prelude::*; +use std::path::Path; pub fn set_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { - super::utimensat(p, atime, mtime, libc::utimensat, 0) + set_times(p, Some(atime), Some(mtime), false) +} + +pub fn set_file_mtime(p: &Path, mtime: FileTime) -> io::Result<()> { + set_times(p, None, Some(mtime), false) +} + +pub fn set_file_atime(p: &Path, atime: FileTime) -> io::Result<()> { + set_times(p, Some(atime), None, false) +} + +pub fn set_file_handle_times( + f: &File, + atime: Option, + mtime: Option, +) -> io::Result<()> { + let times = [super::to_timespec(&atime), super::to_timespec(&mtime)]; + let rc = unsafe { libc::futimens(f.as_raw_fd(), times.as_ptr()) }; + if rc == 0 { + Ok(()) + } else { + Err(io::Error::last_os_error()) + } } pub fn set_symlink_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { - super::utimensat(p, atime, mtime, libc::utimensat, libc::AT_SYMLINK_NOFOLLOW) + set_times(p, Some(atime), Some(mtime), false) +} + +fn set_times( + p: &Path, + atime: Option, + mtime: Option, + symlink: bool, +) -> io::Result<()> { + let flags = if symlink { + libc::AT_SYMLINK_NOFOLLOW + } else { + 0 + }; + + let p = CString::new(p.as_os_str().as_bytes())?; + let times = [super::to_timespec(&atime), super::to_timespec(&mtime)]; + let rc = unsafe { libc::utimensat(libc::AT_FDCWD, p.as_ptr(), times.as_ptr(), flags) }; + if rc == 0 { + Ok(()) + } else { + Err(io::Error::last_os_error()) + } } diff -Nru cargo-0.35.0/vendor/filetime/src/unix/utimes.rs cargo-0.37.0/vendor/filetime/src/unix/utimes.rs --- cargo-0.35.0/vendor/filetime/src/unix/utimes.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/filetime/src/unix/utimes.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,13 +1,98 @@ -use std::path::Path; +use crate::FileTime; +use std::ffi::CString; +use std::fs; use std::io; +use std::os::unix::prelude::*; +use std::path::Path; -use FileTime; -use super::libc; - +#[allow(dead_code)] pub fn set_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { - super::utimes(p, atime, mtime, libc::utimes) + set_times(p, Some(atime), Some(mtime), false) +} + +#[allow(dead_code)] +pub fn set_file_mtime(p: &Path, mtime: FileTime) -> io::Result<()> { + set_times(p, None, Some(mtime), false) +} + +#[allow(dead_code)] +pub fn set_file_atime(p: &Path, atime: FileTime) -> io::Result<()> { + set_times(p, Some(atime), None, false) } +#[allow(dead_code)] +pub fn set_file_handle_times( + f: &fs::File, + atime: Option, + mtime: Option, +) -> io::Result<()> { + let (atime, mtime) = match get_times(atime, mtime, || f.metadata())? { + Some(pair) => pair, + None => return Ok(()), + }; + let times = [to_timeval(&atime), to_timeval(&mtime)]; + let rc = unsafe { libc::futimes(f.as_raw_fd(), times.as_ptr()) }; + return if rc == 0 { + Ok(()) + } else { + Err(io::Error::last_os_error()) + }; +} + +fn get_times( + atime: Option, + mtime: Option, + current: impl FnOnce() -> io::Result, +) -> io::Result> { + let pair = match (atime, mtime) { + (Some(a), Some(b)) => (a, b), + (None, None) => return Ok(None), + (Some(a), None) => { + let meta = current()?; + (a, FileTime::from_last_modification_time(&meta)) + } + (None, Some(b)) => { + let meta = current()?; + (FileTime::from_last_access_time(&meta), b) + } + }; + Ok(Some(pair)) +} + +#[allow(dead_code)] pub fn set_symlink_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { - super::utimes(p, atime, mtime, libc::lutimes) + set_times(p, Some(atime), Some(mtime), true) +} + +pub fn set_times( + p: &Path, + atime: Option, + mtime: Option, + symlink: bool, +) -> io::Result<()> { + let (atime, mtime) = match get_times(atime, mtime, || p.metadata())? { + Some(pair) => pair, + None => return Ok(()), + }; + let p = CString::new(p.as_os_str().as_bytes())?; + let times = [to_timeval(&atime), to_timeval(&mtime)]; + let rc = unsafe { + if symlink { + libc::lutimes(p.as_ptr(), times.as_ptr()) + } else { + libc::utimes(p.as_ptr(), times.as_ptr()) + } + }; + return if rc == 0 { + Ok(()) + } else { + Err(io::Error::last_os_error()) + }; +} + +fn to_timeval(ft: &FileTime) -> libc::timeval { + libc::timeval { + tv_sec: ft.seconds() as libc::time_t, + tv_usec: (ft.nanoseconds() / 1000) as libc::suseconds_t, + } } diff -Nru cargo-0.35.0/vendor/filetime/src/wasm.rs cargo-0.37.0/vendor/filetime/src/wasm.rs --- cargo-0.35.0/vendor/filetime/src/wasm.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/filetime/src/wasm.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,26 +1,40 @@ -#![allow(unused_variables)] -#![allow(bad_style)] - +use crate::FileTime; +use std::fs::{self, File}; +use std::io; use std::path::Path; -use std::{fs, io}; -use FileTime; -pub fn set_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { +pub fn set_file_times(_p: &Path, _atime: FileTime, _mtime: FileTime) -> io::Result<()> { + Err(io::Error::new(io::ErrorKind::Other, "Wasm not implemented")) +} + +pub fn set_symlink_file_times(_p: &Path, _atime: FileTime, _mtime: FileTime) -> io::Result<()> { + Err(io::Error::new(io::ErrorKind::Other, "Wasm not implemented")) +} + +pub fn set_file_mtime(_p: &Path, _mtime: FileTime) -> io::Result<()> { Err(io::Error::new(io::ErrorKind::Other, "Wasm not implemented")) } -pub fn set_symlink_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { +pub fn set_file_atime(_p: &Path, _atime: FileTime) -> io::Result<()> { Err(io::Error::new(io::ErrorKind::Other, "Wasm not implemented")) } -pub fn from_last_modification_time(meta: &fs::Metadata) -> FileTime { +pub fn from_last_modification_time(_meta: &fs::Metadata) -> FileTime { unimplemented!() } -pub fn from_last_access_time(meta: &fs::Metadata) -> FileTime { +pub fn from_last_access_time(_meta: &fs::Metadata) -> FileTime { unimplemented!() } -pub fn from_creation_time(meta: &fs::Metadata) -> Option { +pub fn from_creation_time(_meta: &fs::Metadata) -> Option { unimplemented!() } + +pub fn set_file_handle_times( + _f: &File, + _atime: Option, + _mtime: Option, +) -> io::Result<()> { + Err(io::Error::new(io::ErrorKind::Other, "Wasm not implemented")) +} diff -Nru cargo-0.35.0/vendor/filetime/src/windows.rs cargo-0.37.0/vendor/filetime/src/windows.rs --- cargo-0.35.0/vendor/filetime/src/windows.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/filetime/src/windows.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,53 +1,48 @@ -#![allow(bad_style)] - -use std::fs::{self, OpenOptions}; +use crate::FileTime; +use std::fs::{self, File, OpenOptions}; use std::io; use std::os::windows::prelude::*; use std::path::Path; - -use FileTime; +use std::ptr; +use winapi::shared::minwindef::*; +use winapi::um::fileapi::*; +use winapi::um::winbase::*; pub fn set_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { - set_file_times_w(p, atime, mtime, OpenOptions::new()) + let f = OpenOptions::new().write(true).open(p)?; + set_file_handle_times(&f, Some(atime), Some(mtime)) } -pub fn set_symlink_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { - use std::os::windows::fs::OpenOptionsExt; - const FILE_FLAG_OPEN_REPARSE_POINT: u32 = 0x00200000; - - let mut options = OpenOptions::new(); - options.custom_flags(FILE_FLAG_OPEN_REPARSE_POINT); - set_file_times_w(p, atime, mtime, options) +pub fn set_file_mtime(p: &Path, mtime: FileTime) -> io::Result<()> { + let f = OpenOptions::new().write(true).open(p)?; + set_file_handle_times(&f, None, Some(mtime)) } -pub fn set_file_times_w(p: &Path, - atime: FileTime, - mtime: FileTime, - mut options: OpenOptions) -> io::Result<()> { - type BOOL = i32; - type HANDLE = *mut u8; - type DWORD = u32; - - #[repr(C)] - struct FILETIME { - dwLowDateTime: u32, - dwHighDateTime: u32, - } - - extern "system" { - fn SetFileTime(hFile: HANDLE, - lpCreationTime: *const FILETIME, - lpLastAccessTime: *const FILETIME, - lpLastWriteTime: *const FILETIME) -> BOOL; - } +pub fn set_file_atime(p: &Path, atime: FileTime) -> io::Result<()> { + let f = OpenOptions::new().write(true).open(p)?; + set_file_handle_times(&f, Some(atime), None) +} - let f = try!(options.write(true).open(p)); - let atime = to_filetime(&atime); - let mtime = to_filetime(&mtime); +pub fn set_file_handle_times( + f: &File, + atime: Option, + mtime: Option, +) -> io::Result<()> { + let atime = atime.map(to_filetime); + let mtime = mtime.map(to_filetime); return unsafe { - let ret = SetFileTime(f.as_raw_handle() as *mut _, - 0 as *const _, - &atime, &mtime); + let ret = SetFileTime( + f.as_raw_handle() as *mut _, + ptr::null(), + atime + .as_ref() + .map(|p| p as *const FILETIME) + .unwrap_or(ptr::null()), + mtime + .as_ref() + .map(|p| p as *const FILETIME) + .unwrap_or(ptr::null()), + ); if ret != 0 { Ok(()) } else { @@ -55,9 +50,8 @@ } }; - fn to_filetime(ft: &FileTime) -> FILETIME { - let intervals = ft.seconds() * (1_000_000_000 / 100) + - ((ft.nanoseconds() as i64) / 100); + fn to_filetime(ft: FileTime) -> FILETIME { + let intervals = ft.seconds() * (1_000_000_000 / 100) + ((ft.nanoseconds() as i64) / 100); FILETIME { dwLowDateTime: intervals as DWORD, dwHighDateTime: (intervals >> 32) as DWORD, @@ -65,6 +59,16 @@ } } +pub fn set_symlink_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { + use std::os::windows::fs::OpenOptionsExt; + + let f = OpenOptions::new() + .write(true) + .custom_flags(FILE_FLAG_OPEN_REPARSE_POINT) + .open(p)?; + set_file_handle_times(&f, Some(atime), Some(mtime)) +} + pub fn from_last_modification_time(meta: &fs::Metadata) -> FileTime { from_intervals(meta.last_write_time()) } diff -Nru cargo-0.35.0/vendor/flate2/azure-pipelines.yml cargo-0.37.0/vendor/flate2/azure-pipelines.yml --- cargo-0.35.0/vendor/flate2/azure-pipelines.yml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/flate2/azure-pipelines.yml 2019-07-17 05:42:23.000000000 +0000 @@ -35,6 +35,13 @@ - template: ci/azure-install-rust.yml - script: rustup target add wasm32-unknown-unknown - script: cargo build --target wasm32-unknown-unknown +- job: wasi + steps: + - template: ci/azure-install-rust.yml + parameters: + toolchain: nightly + - script: rustup target add wasm32-wasi + - script: cargo build --target wasm32-wasi - job: rust_backend steps: - template: ci/azure-install-rust.yml diff -Nru cargo-0.35.0/vendor/flate2/.cargo-checksum.json cargo-0.37.0/vendor/flate2/.cargo-checksum.json --- cargo-0.35.0/vendor/flate2/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/flate2/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"f87e68aa82b2de08a6e037f1385455759df6e445a8df5e005b4297191dbf18aa"} \ No newline at end of file +{"files":{},"package":"550934ad4808d5d39365e5d61727309bf18b3b02c6c56b729cb92e7dd84bc3d8"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/flate2/Cargo.toml cargo-0.37.0/vendor/flate2/Cargo.toml --- cargo-0.35.0/vendor/flate2/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/flate2/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,7 +12,7 @@ [package] name = "flate2" -version = "1.0.7" +version = "1.0.9" authors = ["Alex Crichton "] description = "Bindings to miniz.c for DEFLATE compression and decompression exposed as\nReader/Writer streams. Contains bindings for zlib, deflate, and gzip-based\nstreams.\n" homepage = "https://github.com/alexcrichton/flate2-rs" diff -Nru cargo-0.35.0/vendor/flate2/ci/azure-install-rust.yml cargo-0.37.0/vendor/flate2/ci/azure-install-rust.yml --- cargo-0.35.0/vendor/flate2/ci/azure-install-rust.yml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/flate2/ci/azure-install-rust.yml 2019-07-17 05:42:23.000000000 +0000 @@ -3,18 +3,21 @@ steps: - bash: | - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $TOOLCHAIN - echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" - displayName: Install rust + set -e + if command -v rustup; then + rustup update $TOOLCHAIN + rustup default $TOOLCHAIN + else + curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $TOOLCHAIN + echo "##vso[task.prependpath]$HOME/.cargo/bin" + fi + displayName: Install rust - Unix condition: ne( variables['Agent.OS'], 'Windows_NT' ) env: TOOLCHAIN: ${{ parameters.toolchain }} - - script: | - curl -sSf -o rustup-init.exe https://win.rustup.rs - rustup-init.exe -y --default-toolchain %TOOLCHAIN% - echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin" - displayName: Install rust + - bash: rustup update --no-self-update $TOOLCHAIN && rustup default $TOOLCHAIN + displayName: Install rust - Windows condition: eq( variables['Agent.OS'], 'Windows_NT' ) env: TOOLCHAIN: ${{ parameters.toolchain }} diff -Nru cargo-0.35.0/vendor/flate2/debian/patches/disable-miniz.patch cargo-0.37.0/vendor/flate2/debian/patches/disable-miniz.patch --- cargo-0.35.0/vendor/flate2/debian/patches/disable-miniz.patch 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/flate2/debian/patches/disable-miniz.patch 2019-07-17 05:42:23.000000000 +0000 @@ -14,10 +14,10 @@ -optional = true - [dependencies.tokio-io] - version = "0.1" + version = "0.1.11" optional = true -@@ -59,13 +50,12 @@ - version = "0.1" +@@ -68,13 +59,12 @@ + version = "0.1.10" [features] -default = ["miniz-sys"] diff -Nru cargo-0.35.0/vendor/flate2/.pc/disable-miniz.patch/Cargo.toml cargo-0.37.0/vendor/flate2/.pc/disable-miniz.patch/Cargo.toml --- cargo-0.35.0/vendor/flate2/.pc/disable-miniz.patch/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/flate2/.pc/disable-miniz.patch/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,7 +12,7 @@ [package] name = "flate2" -version = "1.0.7" +version = "1.0.9" authors = ["Alex Crichton "] description = "Bindings to miniz.c for DEFLATE compression and decompression exposed as\nReader/Writer streams. Contains bindings for zlib, deflate, and gzip-based\nstreams.\n" homepage = "https://github.com/alexcrichton/flate2-rs" diff -Nru cargo-0.35.0/vendor/flate2/src/mem.rs cargo-0.37.0/vendor/flate2/src/mem.rs --- cargo-0.35.0/vendor/flate2/src/mem.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/flate2/src/mem.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,4 +1,5 @@ use std::error::Error; +use std::cmp; use std::fmt; use std::io; use std::marker; @@ -198,6 +199,33 @@ /// to be performed, and the `zlib_header` argument indicates whether the /// output data should have a zlib header or not. pub fn new(level: Compression, zlib_header: bool) -> Compress { + Compress::make(level, zlib_header, ffi::MZ_DEFAULT_WINDOW_BITS as u8) + } + + /// Creates a new object ready for compressing data that it's given. + /// + /// The `level` argument here indicates what level of compression is going + /// to be performed, and the `zlib_header` argument indicates whether the + /// output data should have a zlib header or not. The `window_bits` parameter + /// indicates the base-2 logarithm of the sliding window size and must be + /// between 9 and 15. + /// + /// # Panics + /// + /// If `window_bits` does not fall into the range 9 ..= 15, + /// `new_with_window_bits` will panic. + /// + /// # Note + /// + /// This constructor is only available when the `zlib` feature is used. + /// Other backends currently do not support custom window bits. + #[cfg(feature = "zlib")] + pub fn new_with_window_bits(level: Compression, zlib_header: bool, window_bits: u8) -> Compress { + Compress::make(level, zlib_header, window_bits) + } + + fn make(level: Compression, zlib_header: bool, window_bits: u8) -> Compress { + assert!(window_bits > 8 && window_bits < 16, "window_bits must be within 9 ..= 15"); unsafe { let mut state = ffi::StreamWrapper::default(); let ret = ffi::mz_deflateInit2( @@ -205,14 +233,14 @@ level.0 as c_int, ffi::MZ_DEFLATED, if zlib_header { - ffi::MZ_DEFAULT_WINDOW_BITS + window_bits as c_int } else { - -ffi::MZ_DEFAULT_WINDOW_BITS + -(window_bits as c_int) }, 9, ffi::MZ_DEFAULT_STRATEGY, ); - debug_assert_eq!(ret, 0); + assert_eq!(ret, 0); Compress { inner: Stream { stream_wrapper: state, @@ -243,6 +271,7 @@ pub fn set_dictionary(&mut self, dictionary: &[u8]) -> Result { let stream = &mut *self.inner.stream_wrapper; let rc = unsafe { + assert!(dictionary.len() < ffi::uInt::max_value() as usize); ffi::deflateSetDictionary(stream, dictionary.as_ptr(), dictionary.len() as ffi::uInt) }; @@ -302,9 +331,9 @@ ) -> Result { let raw = &mut *self.inner.stream_wrapper; raw.next_in = input.as_ptr() as *mut _; - raw.avail_in = input.len() as c_uint; + raw.avail_in = cmp::min(input.len(), c_uint::max_value() as usize) as c_uint; raw.next_out = output.as_mut_ptr(); - raw.avail_out = output.len() as c_uint; + raw.avail_out = cmp::min(output.len(), c_uint::max_value() as usize) as c_uint; let rc = unsafe { ffi::mz_deflate(raw, flush as c_int) }; @@ -358,17 +387,42 @@ /// The `zlib_header` argument indicates whether the input data is expected /// to have a zlib header or not. pub fn new(zlib_header: bool) -> Decompress { + Decompress::make(zlib_header, ffi::MZ_DEFAULT_WINDOW_BITS as u8) + } + + /// Creates a new object ready for decompressing data that it's given. + /// + /// The `zlib_header` argument indicates whether the input data is expected + /// to have a zlib header or not. The `window_bits` parameter indicates the + /// base-2 logarithm of the sliding window size and must be between 9 and 15. + /// + /// # Panics + /// + /// If `window_bits` does not fall into the range 9 ..= 15, + /// `new_with_window_bits` will panic. + /// + /// # Note + /// + /// This constructor is only available when the `zlib` feature is used. + /// Other backends currently do not support custom window bits. + #[cfg(feature = "zlib")] + pub fn new_with_window_bits(zlib_header: bool, window_bits: u8) -> Decompress { + Decompress::make(zlib_header, window_bits) + } + + fn make(zlib_header: bool, window_bits: u8) -> Decompress { + assert!(window_bits > 8 && window_bits < 16, "window_bits must be within 9 ..= 15"); unsafe { let mut state = ffi::StreamWrapper::default(); let ret = ffi::mz_inflateInit2( &mut *state, if zlib_header { - ffi::MZ_DEFAULT_WINDOW_BITS + window_bits as c_int } else { - -ffi::MZ_DEFAULT_WINDOW_BITS + -(window_bits as c_int) }, ); - debug_assert_eq!(ret, 0); + assert_eq!(ret, 0); Decompress { inner: Stream { stream_wrapper: state, @@ -422,9 +476,9 @@ ) -> Result { let raw = &mut *self.inner.stream_wrapper; raw.next_in = input.as_ptr() as *mut u8; - raw.avail_in = input.len() as c_uint; + raw.avail_in = cmp::min(input.len(), c_uint::max_value() as usize) as c_uint; raw.next_out = output.as_mut_ptr(); - raw.avail_out = output.len() as c_uint; + raw.avail_out = cmp::min(output.len(), c_uint::max_value() as usize) as c_uint; let rc = unsafe { ffi::mz_inflate(raw, flush as c_int) }; @@ -485,6 +539,7 @@ pub fn set_dictionary(&mut self, dictionary: &[u8]) -> Result { let stream = &mut *self.inner.stream_wrapper; let rc = unsafe { + assert!(dictionary.len() < ffi::uInt::max_value() as usize); ffi::inflateSetDictionary(stream, dictionary.as_ptr(), dictionary.len() as ffi::uInt) }; diff -Nru cargo-0.35.0/vendor/getrandom/benches/mod.rs cargo-0.37.0/vendor/getrandom/benches/mod.rs --- cargo-0.35.0/vendor/getrandom/benches/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/benches/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,23 @@ +#![feature(test)] +extern crate getrandom; +extern crate test; + +#[bench] +fn bench_64(b: &mut test::Bencher) { + let mut buf = [0u8; 64]; + b.iter(|| { + getrandom::getrandom(&mut buf[..]).unwrap(); + test::black_box(&buf); + }); + b.bytes = buf.len() as u64; +} + +#[bench] +fn bench_65536(b: &mut test::Bencher) { + let mut buf = [0u8; 65536]; + b.iter(|| { + getrandom::getrandom(&mut buf[..]).unwrap(); + test::black_box(&buf); + }); + b.bytes = buf.len() as u64; +} diff -Nru cargo-0.35.0/vendor/getrandom/.cargo-checksum.json cargo-0.37.0/vendor/getrandom/.cargo-checksum.json --- cargo-0.35.0/vendor/getrandom/.cargo-checksum.json 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +{"files":{},"package":"e65cce4e5084b14874c4e7097f38cab54f47ee554f9194673456ea379dcc4c55"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/getrandom/Cargo.toml cargo-0.37.0/vendor/getrandom/Cargo.toml --- cargo-0.35.0/vendor/getrandom/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,51 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# 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] +edition = "2018" +name = "getrandom" +version = "0.1.6" +authors = ["The Rand Project Developers"] +exclude = ["utils/*", ".*", "appveyor.yml"] +description = "A small cross-platform library for retrieving random data from system source" +documentation = "https://docs.rs/getrandom" +categories = ["os", "no-std"] +license = "MIT OR Apache-2.0" +repository = "https://github.com/rust-random/getrandom" +[dependencies.log] +version = "0.4" +optional = true + +[features] +std = [] +[target."cfg(any(unix, target_os = \"redox\"))".dependencies.lazy_static] +version = "1.3.0" +[target."cfg(any(unix, target_os = \"wasi\"))".dependencies.libc] +version = "0.2.54" +[target."cfg(target_os = \"uefi\")".dependencies.lazy_static] +version = "1.3.0" +features = ["spin_no_std"] +[target.wasm32-unknown-unknown.dependencies.lazy_static] +version = "1.3.0" + +[target.wasm32-unknown-unknown.dependencies.stdweb] +version = "0.4.9" +optional = true + +[target.wasm32-unknown-unknown.dependencies.wasm-bindgen] +version = "0.2.29" +optional = true +[badges.appveyor] +repository = "rust-random/getrandom" + +[badges.travis-ci] +repository = "rust-random/getrandom" diff -Nru cargo-0.35.0/vendor/getrandom/CHANGELOG.md cargo-0.37.0/vendor/getrandom/CHANGELOG.md --- cargo-0.35.0/vendor/getrandom/CHANGELOG.md 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,67 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.1.6] - 2019-06-30 +### Changed +- Minor change of RDRAND AMD bug handling. [#48] + +[#43]: https://github.com/rust-random/getrandom/pull/43 + +## [0.1.5] - 2019-06-29 +### Fixed +- Use shared `File` instead of shared file descriptor. [#44] +- Workaround for RDRAND hardware bug present on some AMD CPUs. [#43] + +### Changed +- Try `getentropy` and then fallback to `/dev/random` on macOS. [#38] + +[#38]: https://github.com/rust-random/getrandom/issues/38 +[#43]: https://github.com/rust-random/getrandom/pull/43 +[#44]: https://github.com/rust-random/getrandom/issues/44 + +## [0.1.4] - 2019-06-28 +### Added +- Add support for `x86_64-unknown-uefi` target by using RDRAND with CPUID +feature detection. [#30] + +### Fixed +- Fix long buffer issues on Windows and Linux. [#31] [#32] +- Check `EPERM` in addition to `ENOSYS` on Linux. [#37] + +### Changed +- Improve efficiency by sharing file descriptor across threads. [#13] +- Remove `cloudabi`, `winapi`, and `fuchsia-cprng` dependencies. [#40] +- Improve RDRAND implementation. [#24] +- Don't block during syscall detection on Linux. [#26] +- Increase consistency with libc implementation on FreeBSD. [#36] +- Apply `rustfmt`. [#39] + +[#30]: https://github.com/rust-random/getrandom/pull/30 +[#13]: https://github.com/rust-random/getrandom/issues/13 +[#40]: https://github.com/rust-random/getrandom/pull/40 +[#26]: https://github.com/rust-random/getrandom/pull/26 +[#24]: https://github.com/rust-random/getrandom/pull/24 +[#39]: https://github.com/rust-random/getrandom/pull/39 +[#36]: https://github.com/rust-random/getrandom/pull/36 +[#31]: https://github.com/rust-random/getrandom/issues/31 +[#32]: https://github.com/rust-random/getrandom/issues/32 +[#37]: https://github.com/rust-random/getrandom/issues/37 + +## [0.1.3] - 2019-05-15 +- Update for `wasm32-unknown-wasi` being renamed to `wasm32-wasi`, and for + WASI being categorized as an OS. + +## [0.1.2] - 2019-04-06 +- Add support for `wasm32-unknown-wasi` target. + +## [0.1.1] - 2019-04-05 +- Enable std functionality for CloudABI by default. + +## [0.1.0] - 2019-03-23 +Publish initial implementation. + +## [0.0.0] - 2019-01-19 +Publish an empty template library. diff -Nru cargo-0.35.0/vendor/getrandom/LICENSE-APACHE cargo-0.37.0/vendor/getrandom/LICENSE-APACHE --- cargo-0.35.0/vendor/getrandom/LICENSE-APACHE 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/LICENSE-APACHE 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor 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, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff -Nru cargo-0.35.0/vendor/getrandom/LICENSE-MIT cargo-0.37.0/vendor/getrandom/LICENSE-MIT --- cargo-0.35.0/vendor/getrandom/LICENSE-MIT 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/LICENSE-MIT 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,26 @@ +Copyright 2018 Developers of the Rand project +Copyright (c) 2014 The Rust Project Developers + +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 +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff -Nru cargo-0.35.0/vendor/getrandom/README.md cargo-0.37.0/vendor/getrandom/README.md --- cargo-0.35.0/vendor/getrandom/README.md 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,67 @@ +# getrandom + +[![Build Status](https://travis-ci.org/rust-random/getrandom.svg?branch=master)](https://travis-ci.org/rust-random/getrandom) +[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-random/getrandom?svg=true)](https://ci.appveyor.com/project/rust-random/getrandom) +[![Crate](https://img.shields.io/crates/v/getrandom.svg)](https://crates.io/crates/getrandom) +[![Documentation](https://docs.rs/getrandom/badge.svg)](https://docs.rs/getrandom) +[![Dependency status](https://deps.rs/repo/github/rust-random/getrandom/status.svg)](https://deps.rs/repo/github/rust-random/getrandom) + + +A Rust library for retrieving random data from (operating) system source. It is +assumed that system always provides high-quality cryptographically secure random +data, ideally backed by hardware entropy sources. This crate derives its name +from Linux's `getrandom` function, but is cross platform, roughly supporting +the same set of platforms as Rust's `std` lib. + +This is a low-level API. Most users should prefer using high-level random-number +library like [`rand`]. + +[`rand`]: https://crates.io/crates/rand + + +## Usage + +Add this to your `Cargo.toml`: + +```toml +[dependencies] +getrandom = "0.1" +``` + +Then invoke the `getrandom` function: + +```rust +fn get_random_buf() -> Result<[u8; 32], getrandom::Error> { + let mut buf = [0u8; 32]; + getrandom::getrandom(&mut buf)?; + buf +} +``` + +## Features + +This library is `no_std` compatible, but uses `std` on most platforms. + +The `log` library is supported as an optional dependency. If enabled, error +reporting will be improved on some platforms. + +For WebAssembly (`wasm32`), WASI and Emscripten targets are supported directly; otherwise +one of the following features must be enabled: + +- [`wasm-bindgen`](https://crates.io/crates/wasm_bindgen) +- [`stdweb`](https://crates.io/crates/stdweb) + +## Minimum Supported Rust Version + +This crate requires Rust 1.32.0 or later. + + +# License + +The `getrandom` library is distributed under either of + + * [Apache License, Version 2.0](LICENSE-APACHE) + * [MIT license](LICENSE-MIT) + +at your option. + diff -Nru cargo-0.35.0/vendor/getrandom/src/cloudabi.rs cargo-0.37.0/vendor/getrandom/src/cloudabi.rs --- cargo-0.35.0/vendor/getrandom/src/cloudabi.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/src/cloudabi.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,30 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Implementation for CloudABI +use crate::Error; +use core::num::NonZeroU32; + +extern "C" { + fn cloudabi_sys_random_get(buf: *mut u8, buf_len: usize) -> u16; +} + +pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> { + let errno = unsafe { cloudabi_sys_random_get(dest.as_mut_ptr(), dest.len()) }; + if let Some(code) = NonZeroU32::new(errno as u32) { + error!("cloudabi_sys_random_get failed with code {}", code); + Err(Error::from(code)) + } else { + Ok(()) // Zero means success for CloudABI + } +} + +#[inline(always)] +pub fn error_msg_inner(_: NonZeroU32) -> Option<&'static str> { + None +} diff -Nru cargo-0.35.0/vendor/getrandom/src/dummy.rs cargo-0.37.0/vendor/getrandom/src/dummy.rs --- cargo-0.35.0/vendor/getrandom/src/dummy.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/src/dummy.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,22 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! A dummy implementation for unsupported targets which always returns +//! `Err(Error::UNAVAILABLE)` +use crate::Error; +use core::num::NonZeroU32; + +pub fn getrandom_inner(_: &mut [u8]) -> Result<(), Error> { + error!("no support for this platform"); + Err(Error::UNAVAILABLE) +} + +#[inline(always)] +pub fn error_msg_inner(_: NonZeroU32) -> Option<&'static str> { + None +} diff -Nru cargo-0.35.0/vendor/getrandom/src/error_impls.rs cargo-0.37.0/vendor/getrandom/src/error_impls.rs --- cargo-0.35.0/vendor/getrandom/src/error_impls.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/src/error_impls.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,34 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +extern crate std; + +use crate::error::Error; +use core::convert::From; +use core::num::NonZeroU32; +use std::{error, io}; + +impl From for Error { + fn from(err: io::Error) -> Self { + err.raw_os_error() + .and_then(|code| NonZeroU32::new(code as u32)) + .map(|code| Error(code)) + // in practice this should never happen + .unwrap_or(Error::UNKNOWN) + } +} + +impl From for io::Error { + fn from(err: Error) -> Self { + match err.msg() { + Some(msg) => io::Error::new(io::ErrorKind::Other, msg), + None => io::Error::from_raw_os_error(err.0.get() as i32), + } + } +} + +impl error::Error for Error {} diff -Nru cargo-0.35.0/vendor/getrandom/src/error.rs cargo-0.37.0/vendor/getrandom/src/error.rs --- cargo-0.35.0/vendor/getrandom/src/error.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/src/error.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,93 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +use core::convert::From; +use core::fmt; +use core::num::NonZeroU32; + +// A randomly-chosen 24-bit prefix for our codes +pub(crate) const CODE_PREFIX: u32 = 0x57f4c500; +const CODE_UNKNOWN: u32 = CODE_PREFIX | 0x00; +const CODE_UNAVAILABLE: u32 = CODE_PREFIX | 0x01; + +/// The error type. +/// +/// This type is small and no-std compatible. +#[derive(Copy, Clone, Eq, PartialEq)] +pub struct Error(pub(crate) NonZeroU32); + +impl Error { + /// An unknown error. + pub const UNKNOWN: Error = Error(unsafe { NonZeroU32::new_unchecked(CODE_UNKNOWN) }); + + /// No generator is available. + pub const UNAVAILABLE: Error = Error(unsafe { NonZeroU32::new_unchecked(CODE_UNAVAILABLE) }); + + /// Extract the error code. + /// + /// This may equal one of the codes defined in this library or may be a + /// system error code. + /// + /// One may attempt to format this error via the `Display` implementation. + pub fn code(&self) -> NonZeroU32 { + self.0 + } + + pub(crate) fn msg(&self) -> Option<&'static str> { + if let Some(msg) = super::error_msg_inner(self.0) { + Some(msg) + } else { + match *self { + Error::UNKNOWN => Some("getrandom: unknown error"), + Error::UNAVAILABLE => Some("getrandom: unavailable"), + _ => None, + } + } + } +} + +impl fmt::Debug for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match self.msg() { + Some(msg) => write!(f, "Error(\"{}\")", msg), + None => write!(f, "Error(0x{:08X})", self.0), + } + } +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match self.msg() { + Some(msg) => write!(f, "{}", msg), + None => write!(f, "getrandom: unknown code 0x{:08X}", self.0), + } + } +} + +impl From for Error { + fn from(code: NonZeroU32) -> Self { + Error(code) + } +} + +impl From<&Error> for Error { + fn from(error: &Error) -> Self { + *error + } +} + +#[cfg(test)] +mod tests { + use super::Error; + use core::mem::size_of; + + #[test] + fn test_size() { + assert_eq!(size_of::(), 4); + assert_eq!(size_of::>(), 4); + } +} diff -Nru cargo-0.35.0/vendor/getrandom/src/freebsd.rs cargo-0.37.0/vendor/getrandom/src/freebsd.rs --- cargo-0.35.0/vendor/getrandom/src/freebsd.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/src/freebsd.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,48 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Implementation for FreeBSD +extern crate std; + +use crate::Error; +use core::num::NonZeroU32; +use core::ptr; +use std::io; + +fn kern_arnd(buf: &mut [u8]) -> Result { + static MIB: [libc::c_int; 2] = [libc::CTL_KERN, libc::KERN_ARND]; + let mut len = buf.len(); + let ret = unsafe { + libc::sysctl( + MIB.as_ptr(), + MIB.len() as libc::c_uint, + buf.as_mut_ptr() as *mut _, + &mut len, + ptr::null(), + 0, + ) + }; + if ret == -1 { + error!("freebsd: kern.arandom syscall failed"); + return Err(io::Error::last_os_error().into()); + } + Ok(len) +} + +pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> { + let mut start = 0; + while start < dest.len() { + start += kern_arnd(&mut dest[start..])?; + } + Ok(()) +} + +#[inline(always)] +pub fn error_msg_inner(_: NonZeroU32) -> Option<&'static str> { + None +} diff -Nru cargo-0.35.0/vendor/getrandom/src/fuchsia.rs cargo-0.37.0/vendor/getrandom/src/fuchsia.rs --- cargo-0.35.0/vendor/getrandom/src/fuchsia.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/src/fuchsia.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,26 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Implementation for Fuchsia Zircon +use crate::Error; +use core::num::NonZeroU32; + +#[link(name = "zircon")] +extern "C" { + fn zx_cprng_draw(buffer: *mut u8, length: usize); +} + +pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> { + unsafe { zx_cprng_draw(dest.as_mut_ptr(), dest.len()) } + Ok(()) +} + +#[inline(always)] +pub fn error_msg_inner(_: NonZeroU32) -> Option<&'static str> { + None +} diff -Nru cargo-0.35.0/vendor/getrandom/src/ios.rs cargo-0.37.0/vendor/getrandom/src/ios.rs --- cargo-0.35.0/vendor/getrandom/src/ios.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/src/ios.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,41 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Implementation for iOS +extern crate std; + +use crate::Error; +use core::num::NonZeroU32; +use std::io; + +// TODO: Make extern once extern_types feature is stabilized. See: +// https://github.com/rust-lang/rust/issues/43467 +#[repr(C)] +struct SecRandom([u8; 0]); + +#[link(name = "Security", kind = "framework")] +extern "C" { + static kSecRandomDefault: *const SecRandom; + + fn SecRandomCopyBytes(rnd: *const SecRandom, count: usize, bytes: *mut u8) -> i32; +} + +pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> { + let ret = unsafe { SecRandomCopyBytes(kSecRandomDefault, dest.len(), dest.as_mut_ptr()) }; + if ret == -1 { + error!("SecRandomCopyBytes call failed"); + Err(io::Error::last_os_error().into()) + } else { + Ok(()) + } +} + +#[inline(always)] +pub fn error_msg_inner(_: NonZeroU32) -> Option<&'static str> { + None +} diff -Nru cargo-0.35.0/vendor/getrandom/src/lib.rs cargo-0.37.0/vendor/getrandom/src/lib.rs --- cargo-0.35.0/vendor/getrandom/src/lib.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,264 @@ +// Copyright 2019 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Interface to the random number generator of the operating system. +//! +//! # Platform sources +//! +//! | OS | interface +//! |------------------|--------------------------------------------------------- +//! | Linux, Android | [`getrandom`][1] system call if available, otherwise [`/dev/urandom`][2] after reading from `/dev/random` once +//! | Windows | [`RtlGenRandom`][3] +//! | macOS | [`getentropy()`][19] if available, otherise [`/dev/random`][20] (identical to `/dev/urandom`) +//! | iOS | [`SecRandomCopyBytes`][4] +//! | FreeBSD | [`kern.arandom`][5] +//! | OpenBSD, Bitrig | [`getentropy`][6] +//! | NetBSD | [`/dev/urandom`][7] after reading from `/dev/random` once +//! | Dragonfly BSD | [`/dev/random`][8] +//! | Solaris, illumos | [`getrandom`][9] system call if available, otherwise [`/dev/random`][10] +//! | Fuchsia OS | [`cprng_draw`][11] +//! | Redox | [`rand:`][12] +//! | CloudABI | [`cloudabi_sys_random_get`][13] +//! | Haiku | `/dev/random` (identical to `/dev/urandom`) +//! | SGX, UEFI | [RDRAND][18] +//! | Web browsers | [`Crypto.getRandomValues`][14] (see [Support for WebAssembly and ams.js][14]) +//! | Node.js | [`crypto.randomBytes`][15] (see [Support for WebAssembly and ams.js][16]) +//! | WASI | [`__wasi_random_get`][17] +//! +//! Getrandom doesn't have a blanket implementation for all Unix-like operating +//! systems that reads from `/dev/urandom`. This ensures all supported operating +//! systems are using the recommended interface and respect maximum buffer +//! sizes. +//! +//! ## Support for WebAssembly and ams.js +//! +//! The three Emscripten targets `asmjs-unknown-emscripten`, +//! `wasm32-unknown-emscripten` and `wasm32-experimental-emscripten` use +//! Emscripten's emulation of `/dev/random` on web browsers and Node.js. +//! +//! The bare WASM target `wasm32-unknown-unknown` tries to call the javascript +//! methods directly, using either `stdweb` or `wasm-bindgen` depending on what +//! features are activated for this crate. Note that if both features are +//! enabled `wasm-bindgen` will be used. If neither feature is enabled, +//! `getrandom` will always fail. +//! +//! The WASI target `wasm32-wasi` uses the `__wasi_random_get` function defined +//! by the WASI standard. +//! +//! +//! ## Early boot +//! +//! It is possible that early in the boot process the OS hasn't had enough time +//! yet to collect entropy to securely seed its RNG, especially on virtual +//! machines. +//! +//! Some operating systems always block the thread until the RNG is securely +//! seeded. This can take anywhere from a few seconds to more than a minute. +//! Others make a best effort to use a seed from before the shutdown and don't +//! document much. +//! +//! A few, Linux, NetBSD and Solaris, offer a choice between blocking and +//! getting an error; in these cases we always choose to block. +//! +//! On Linux (when the `genrandom` system call is not available) and on NetBSD +//! reading from `/dev/urandom` never blocks, even when the OS hasn't collected +//! enough entropy yet. To avoid returning low-entropy bytes, we first read from +//! `/dev/random` and only switch to `/dev/urandom` once this has succeeded. +//! +//! # Error handling +//! +//! We always choose failure over returning insecure "random" bytes. In general, +//! on supported platforms, failure is highly unlikely, though not impossible. +//! If an error does occur, then it is likely that it will occur on every call to +//! `getrandom`, hence after the first successful call one can be reasonably +//! confident that no errors will occur. +//! +//! On unsupported platforms, `getrandom` always fails with [`Error::UNAVAILABLE`]. +//! +//! ## Error codes +//! The crate uses the following custom error codes: +//! - `0x57f4c500` (dec: 1475659008) - an unknown error. Constant: +//! [`Error::UNKNOWN`] +//! - `0x57f4c501` (dec: 1475659009) - no generator is available. Constant: +//! [`Error::UNAVAILABLE`] +//! - `0x57f4c580` (dec: 1475659136) - `self.crypto` is undefined, +//! `wasm-bindgen` specific error. +//! - `0x57f4c581` (dec: 1475659137) - `crypto.getRandomValues` is undefined, +//! `wasm-bindgen` specific error. +//! +//! These codes are provided for reference only and should not be matched upon +//! (but you can match on `Error` constants). The codes may change in future and +//! such change will not be considered a breaking one. +//! +//! Other error codes will originate from an underlying system. In case if such +//! error is encountered, please consult with your system documentation. +//! +//! [1]: http://man7.org/linux/man-pages/man2/getrandom.2.html +//! [2]: http://man7.org/linux/man-pages/man4/urandom.4.html +//! [3]: https://docs.microsoft.com/en-us/windows/desktop/api/ntsecapi/nf-ntsecapi-rtlgenrandom +//! [4]: https://developer.apple.com/documentation/security/1399291-secrandomcopybytes?language=objc +//! [5]: https://www.freebsd.org/cgi/man.cgi?query=random&sektion=4 +//! [6]: https://man.openbsd.org/getentropy.2 +//! [7]: http://netbsd.gw.com/cgi-bin/man-cgi?random+4+NetBSD-current +//! [8]: https://leaf.dragonflybsd.org/cgi/web-man?command=random§ion=4 +//! [9]: https://docs.oracle.com/cd/E88353_01/html/E37841/getrandom-2.html +//! [10]: https://docs.oracle.com/cd/E86824_01/html/E54777/random-7d.html +//! [11]: https://fuchsia.googlesource.com/fuchsia/+/master/zircon/docs/syscalls/cprng_draw.md +//! [12]: https://github.com/redox-os/randd/blob/master/src/main.rs +//! [13]: https://github.com/nuxinl/cloudabi#random_get +//! [14]: https://www.w3.org/TR/WebCryptoAPI/#Crypto-method-getRandomValues +//! [15]: https://nodejs.org/api/crypto.html#crypto_crypto_randombytes_size_callback +//! [16]: #support-for-webassembly-and-amsjs +//! [17]: https://github.com/CraneStation/wasmtime/blob/master/docs/WASI-api.md#__wasi_random_get +//! [18]: https://software.intel.com/en-us/articles/intel-digital-random-number-generator-drng-software-implementation-guide +//! [19]: https://www.unix.com/man-page/mojave/2/getentropy/ +//! [20]: https://www.unix.com/man-page/mojave/4/random/ + +#![doc( + html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png", + html_favicon_url = "https://www.rust-lang.org/favicon.ico", + html_root_url = "https://rust-random.github.io/rand/" +)] +#![no_std] +#![cfg_attr(feature = "stdweb", recursion_limit = "128")] + +#[cfg(feature = "log")] +#[macro_use] +extern crate log; +#[cfg(not(feature = "log"))] +#[allow(unused)] +macro_rules! error { + ($($x:tt)*) => {}; +} + +// temp fix for stdweb +#[cfg(target_arch = "wasm32")] +extern crate std; + +mod error; +pub use crate::error::Error; + +// System-specific implementations. +// +// These should all provide getrandom_inner with the same signature as getrandom. + +macro_rules! mod_use { + ($cond:meta, $module:ident) => { + #[$cond] + mod $module; + #[$cond] + use crate::$module::{error_msg_inner, getrandom_inner}; + }; +} + +// These targets use std anyway, so we use the std declarations. +#[cfg(any( + feature = "std", + windows, + unix, + target_os = "redox", + target_arch = "wasm32", +))] +mod error_impls; + +// These targets read from a file as a fallback method. +#[cfg(any( + target_os = "android", + target_os = "linux", + target_os = "macos", + target_os = "solaris", + target_os = "illumos", +))] +mod use_file; + +mod_use!(cfg(target_os = "android"), linux_android); +mod_use!(cfg(target_os = "bitrig"), openbsd_bitrig); +mod_use!(cfg(target_os = "cloudabi"), cloudabi); +mod_use!(cfg(target_os = "dragonfly"), use_file); +mod_use!(cfg(target_os = "emscripten"), use_file); +mod_use!(cfg(target_os = "freebsd"), freebsd); +mod_use!(cfg(target_os = "fuchsia"), fuchsia); +mod_use!(cfg(target_os = "haiku"), use_file); +mod_use!(cfg(target_os = "illumos"), solaris_illumos); +mod_use!(cfg(target_os = "ios"), ios); +mod_use!(cfg(target_os = "linux"), linux_android); +mod_use!(cfg(target_os = "macos"), macos); +mod_use!(cfg(target_os = "netbsd"), use_file); +mod_use!(cfg(target_os = "openbsd"), openbsd_bitrig); +mod_use!(cfg(target_os = "redox"), use_file); +mod_use!(cfg(target_os = "solaris"), solaris_illumos); +mod_use!(cfg(windows), windows); +mod_use!(cfg(target_env = "sgx"), rdrand); +mod_use!(cfg(all(target_arch = "x86_64", target_os = "uefi")), rdrand); +mod_use!(cfg(target_os = "wasi"), wasi); + +mod_use!( + cfg(all( + target_arch = "wasm32", + not(target_os = "emscripten"), + not(target_os = "wasi"), + feature = "wasm-bindgen" + )), + wasm32_bindgen +); + +mod_use!( + cfg(all( + target_arch = "wasm32", + not(target_os = "emscripten"), + not(target_os = "wasi"), + not(feature = "wasm-bindgen"), + feature = "stdweb", + )), + wasm32_stdweb +); + +mod_use!( + cfg(not(any( + target_os = "android", + target_os = "bitrig", + target_os = "cloudabi", + target_os = "dragonfly", + target_os = "emscripten", + target_os = "freebsd", + target_os = "fuchsia", + target_os = "haiku", + target_os = "illumos", + target_os = "ios", + target_os = "linux", + target_os = "macos", + target_os = "netbsd", + target_os = "openbsd", + target_os = "redox", + target_os = "solaris", + all(target_arch = "x86_64", target_os = "uefi"), + target_os = "wasi", + target_env = "sgx", + windows, + all( + target_arch = "wasm32", + any(feature = "wasm-bindgen", feature = "stdweb"), + ), + ))), + dummy +); + +/// Fill `dest` with random bytes from the system's preferred random number +/// source. +/// +/// This function returns an error on any failure, including partial reads. We +/// make no guarantees regarding the contents of `dest` on error. +/// +/// Blocking is possible, at least during early boot; see module documentation. +/// +/// In general, `getrandom` will be fast enough for interactive usage, though +/// significantly slower than a user-space CSPRNG; for the latter consider +/// [`rand::thread_rng`](https://docs.rs/rand/*/rand/fn.thread_rng.html). +pub fn getrandom(dest: &mut [u8]) -> Result<(), error::Error> { + getrandom_inner(dest) +} diff -Nru cargo-0.35.0/vendor/getrandom/src/linux_android.rs cargo-0.37.0/vendor/getrandom/src/linux_android.rs --- cargo-0.35.0/vendor/getrandom/src/linux_android.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/src/linux_android.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,61 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Implementation for Linux / Android +extern crate std; + +use crate::{use_file, Error}; +use core::num::NonZeroU32; +use lazy_static::lazy_static; +use std::io; + +fn syscall_getrandom(dest: &mut [u8], block: bool) -> Result { + let flags = if block { 0 } else { libc::GRND_NONBLOCK }; + let ret = unsafe { libc::syscall(libc::SYS_getrandom, dest.as_mut_ptr(), dest.len(), flags) }; + if ret < 0 { + let err = io::Error::last_os_error(); + if err.raw_os_error() == Some(libc::EINTR) { + return Ok(0); // Call was interrupted, try again + } + error!("Linux getrandom syscall failed with return value {}", ret); + return Err(err); + } + Ok(ret as usize) +} + +pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> { + lazy_static! { + static ref HAS_GETRANDOM: bool = is_getrandom_available(); + } + match *HAS_GETRANDOM { + true => { + let mut start = 0; + while start < dest.len() { + start += syscall_getrandom(&mut dest[start..], true)?; + } + Ok(()) + } + false => use_file::getrandom_inner(dest), + } +} + +fn is_getrandom_available() -> bool { + match syscall_getrandom(&mut [], false) { + Err(err) => match err.raw_os_error() { + Some(libc::ENOSYS) => false, // No kernel support + Some(libc::EPERM) => false, // Blocked by seccomp + _ => true, + }, + Ok(_) => true, + } +} + +#[inline(always)] +pub fn error_msg_inner(_: NonZeroU32) -> Option<&'static str> { + None +} diff -Nru cargo-0.35.0/vendor/getrandom/src/macos.rs cargo-0.37.0/vendor/getrandom/src/macos.rs --- cargo-0.35.0/vendor/getrandom/src/macos.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/src/macos.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,49 @@ +// Copyright 2019 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Implementation for macOS +extern crate std; + +use crate::{use_file, Error}; +use core::mem; +use core::num::NonZeroU32; +use lazy_static::lazy_static; +use std::io; + +type GetEntropyFn = unsafe extern "C" fn(*mut u8, libc::size_t) -> libc::c_int; + +fn fetch_getentropy() -> Option { + let name = "getentropy\0"; + let addr = unsafe { libc::dlsym(libc::RTLD_DEFAULT, name.as_ptr() as *const _) }; + unsafe { mem::transmute(addr) } +} + +pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> { + lazy_static! { + static ref GETENTROPY_FUNC: Option = fetch_getentropy(); + } + if let Some(fptr) = *GETENTROPY_FUNC { + for chunk in dest.chunks_mut(256) { + let ret = unsafe { fptr(chunk.as_mut_ptr(), chunk.len()) }; + if ret != 0 { + error!("getentropy syscall failed with ret={}", ret); + return Err(io::Error::last_os_error().into()); + } + } + Ok(()) + } else { + // We fallback to reading from /dev/random instead of SecRandomCopyBytes + // to avoid high startup costs and linking the Security framework. + use_file::getrandom_inner(dest) + } +} + +#[inline(always)] +pub fn error_msg_inner(_: NonZeroU32) -> Option<&'static str> { + None +} diff -Nru cargo-0.35.0/vendor/getrandom/src/openbsd_bitrig.rs cargo-0.37.0/vendor/getrandom/src/openbsd_bitrig.rs --- cargo-0.35.0/vendor/getrandom/src/openbsd_bitrig.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/src/openbsd_bitrig.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,30 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Implementation for OpenBSD / Bitrig +extern crate std; + +use crate::Error; +use std::io; +use std::num::NonZeroU32; + +pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> { + for chunk in dest.chunks_mut(256) { + let ret = unsafe { libc::getentropy(chunk.as_mut_ptr() as *mut libc::c_void, chunk.len()) }; + if ret == -1 { + error!("libc::getentropy call failed"); + return Err(io::Error::last_os_error().into()); + } + } + Ok(()) +} + +#[inline(always)] +pub fn error_msg_inner(_: NonZeroU32) -> Option<&'static str> { + None +} diff -Nru cargo-0.35.0/vendor/getrandom/src/rdrand.rs cargo-0.37.0/vendor/getrandom/src/rdrand.rs --- cargo-0.35.0/vendor/getrandom/src/rdrand.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/src/rdrand.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,97 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Implementation for SGX using RDRAND instruction +use crate::Error; +use core::arch::x86_64::_rdrand64_step; +use core::mem; +use core::num::NonZeroU32; + +// Recommendation from "Intel® Digital Random Number Generator (DRNG) Software +// Implementation Guide" - Section 5.2.1 and "Intel® 64 and IA-32 Architectures +// Software Developer’s Manual" - Volume 1 - Section 7.3.17.1. +const RETRY_LIMIT: usize = 10; +const WORD_SIZE: usize = mem::size_of::(); + +#[target_feature(enable = "rdrand")] +unsafe fn rdrand() -> Result<[u8; WORD_SIZE], Error> { + for _ in 0..RETRY_LIMIT { + let mut el = mem::uninitialized(); + if _rdrand64_step(&mut el) == 1 { + // AMD CPUs from families 14h to 16h (pre Ryzen) sometimes fail to + // set CF on bogus random data, so we check these values explictly. + // See https://github.com/systemd/systemd/issues/11810#issuecomment-489727505 + // We perform this check regardless of target to guard against + // any implementation that incorrectly fails to set CF. + if el != 0 && el != !0 { + return Ok(el.to_ne_bytes()); + } + error!("RDRAND returned {:X}, CPU RNG may be broken", el); + // Keep looping in case this was a false positive. + } + } + error!("RDRAND failed, CPU issue likely"); + Err(Error::UNKNOWN) +} + +// "rdrand" target feature requires "+rdrnd" flag, see https://github.com/rust-lang/rust/issues/49653. +#[cfg(all(target_env = "sgx", not(target_feature = "rdrand")))] +compile_error!( + "SGX targets require 'rdrand' target feature. Enable by using -C target-feature=+rdrnd." +); + +#[cfg(target_feature = "rdrand")] +fn is_rdrand_supported() -> bool { + true +} + +// TODO use is_x86_feature_detected!("rdrand") when that works in core. See: +// https://github.com/rust-lang-nursery/stdsimd/issues/464 +#[cfg(not(target_feature = "rdrand"))] +fn is_rdrand_supported() -> bool { + use core::arch::x86_64::__cpuid; + use lazy_static::lazy_static; + // SAFETY: All x86_64 CPUs support CPUID leaf 1 + const FLAG: u32 = 1 << 30; + lazy_static! { + static ref HAS_RDRAND: bool = unsafe { __cpuid(1).ecx & FLAG != 0 }; + } + *HAS_RDRAND +} + +pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> { + if !is_rdrand_supported() { + return Err(Error::UNAVAILABLE); + } + + // SAFETY: After this point, rdrand is supported, so calling the rdrand + // functions is not undefined behavior. + unsafe { rdrand_exact(dest) } +} + +#[target_feature(enable = "rdrand")] +unsafe fn rdrand_exact(dest: &mut [u8]) -> Result<(), Error> { + // We use chunks_exact_mut instead of chunks_mut as it allows almost all + // calls to memcpy to be elided by the compiler. + let mut chunks = dest.chunks_exact_mut(WORD_SIZE); + for chunk in chunks.by_ref() { + chunk.copy_from_slice(&rdrand()?); + } + + let tail = chunks.into_remainder(); + let n = tail.len(); + if n > 0 { + tail.copy_from_slice(&rdrand()?[..n]); + } + Ok(()) +} + +#[inline(always)] +pub fn error_msg_inner(_: NonZeroU32) -> Option<&'static str> { + None +} diff -Nru cargo-0.35.0/vendor/getrandom/src/solaris_illumos.rs cargo-0.37.0/vendor/getrandom/src/solaris_illumos.rs --- cargo-0.35.0/vendor/getrandom/src/solaris_illumos.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/src/solaris_illumos.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,69 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Implementation for the Solaris family +//! +//! Read from `/dev/random`, with chunks of limited size (256 bytes). +//! `/dev/random` uses the Hash_DRBG with SHA512 algorithm from NIST SP 800-90A. +//! `/dev/urandom` uses the FIPS 186-2 algorithm, which is considered less +//! secure. We choose to read from `/dev/random`. +//! +//! Since Solaris 11.3 and mid-2015 illumos, the `getrandom` syscall is available. +//! To make sure we can compile on both Solaris and its derivatives, as well as +//! function, we check for the existance of getrandom(2) in libc by calling +//! libc::dlsym. +extern crate std; + +use crate::{use_file, Error}; +use core::mem; +use core::num::NonZeroU32; +use lazy_static::lazy_static; +use std::io; + +#[cfg(target_os = "illumos")] +type GetRandomFn = unsafe extern "C" fn(*mut u8, libc::size_t, libc::c_uint) -> libc::ssize_t; +#[cfg(target_os = "solaris")] +type GetRandomFn = unsafe extern "C" fn(*mut u8, libc::size_t, libc::c_uint) -> libc::c_int; + +fn libc_getrandom(rand: GetRandomFn, dest: &mut [u8]) -> Result<(), Error> { + let ret = unsafe { rand(dest.as_mut_ptr(), dest.len(), 0) as libc::ssize_t }; + + if ret == -1 || ret != dest.len() as libc::ssize_t { + error!("getrandom syscall failed with ret={}", ret); + Err(io::Error::last_os_error().into()) + } else { + Ok(()) + } +} + +pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> { + lazy_static! { + static ref GETRANDOM_FUNC: Option = fetch_getrandom(); + } + + // 256 bytes is the lowest common denominator across all the Solaris + // derived platforms for atomically obtaining random data. + for chunk in dest.chunks_mut(256) { + match *GETRANDOM_FUNC { + Some(fptr) => libc_getrandom(fptr, chunk)?, + None => use_file::getrandom_inner(chunk)?, + }; + } + Ok(()) +} + +fn fetch_getrandom() -> Option { + let name = "getrandom\0"; + let addr = unsafe { libc::dlsym(libc::RTLD_DEFAULT, name.as_ptr() as *const _) }; + unsafe { mem::transmute(addr) } +} + +#[inline(always)] +pub fn error_msg_inner(_: NonZeroU32) -> Option<&'static str> { + None +} diff -Nru cargo-0.35.0/vendor/getrandom/src/use_file.rs cargo-0.37.0/vendor/getrandom/src/use_file.rs --- cargo-0.35.0/vendor/getrandom/src/use_file.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/src/use_file.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,60 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Implementations that just need to read from a file +extern crate std; + +use crate::Error; +use core::num::NonZeroU32; +use lazy_static::lazy_static; +use std::{fs::File, io::Read}; + +#[cfg(target_os = "redox")] +const FILE_PATH: &str = "rand:"; +#[cfg(any(target_os = "android", target_os = "linux", target_os = "netbsd"))] +const FILE_PATH: &str = "/dev/urandom"; +#[cfg(any( + target_os = "dragonfly", + target_os = "emscripten", + target_os = "haiku", + target_os = "macos", + target_os = "solaris", + target_os = "illumos" +))] +const FILE_PATH: &str = "/dev/random"; + +pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> { + lazy_static! { + static ref FILE: Result = init_file(); + } + let mut f = FILE.as_ref()?; + + if cfg!(target_os = "emscripten") { + // `Crypto.getRandomValues` documents `dest` should be at most 65536 bytes. + for chunk in dest.chunks_mut(65536) { + f.read_exact(chunk)?; + } + } else { + f.read_exact(dest)?; + } + Ok(()) +} + +fn init_file() -> Result { + if FILE_PATH == "/dev/urandom" { + // read one byte from "/dev/random" to ensure that OS RNG has initialized + File::open("/dev/random")?.read_exact(&mut [0u8; 1])?; + } + Ok(File::open(FILE_PATH)?) +} + +#[inline(always)] +#[allow(dead_code)] +pub fn error_msg_inner(_: NonZeroU32) -> Option<&'static str> { + None +} diff -Nru cargo-0.35.0/vendor/getrandom/src/wasi.rs cargo-0.37.0/vendor/getrandom/src/wasi.rs --- cargo-0.35.0/vendor/getrandom/src/wasi.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/src/wasi.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,28 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Implementation for WASI +use crate::Error; +use core::num::NonZeroU32; +use std::io; + +pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> { + let ret = + unsafe { libc::__wasi_random_get(dest.as_mut_ptr() as *mut libc::c_void, dest.len()) }; + if ret == libc::__WASI_ESUCCESS { + Ok(()) + } else { + error!("WASI: __wasi_random_get failed with return value {}", ret); + Err(io::Error::last_os_error().into()) + } +} + +#[inline(always)] +pub fn error_msg_inner(_: NonZeroU32) -> Option<&'static str> { + None +} diff -Nru cargo-0.35.0/vendor/getrandom/src/wasm32_bindgen.rs cargo-0.37.0/vendor/getrandom/src/wasm32_bindgen.rs --- cargo-0.35.0/vendor/getrandom/src/wasm32_bindgen.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/src/wasm32_bindgen.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,144 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Implementation for WASM via wasm-bindgen +use core::cell::RefCell; +use core::mem; +use core::num::NonZeroU32; +use std::thread_local; + +use wasm_bindgen::prelude::*; + +use crate::error::CODE_PREFIX; +use crate::Error; + +const CODE_CRYPTO_UNDEF: u32 = CODE_PREFIX | 0x80; +const CODE_GRV_UNDEF: u32 = CODE_PREFIX | 0x81; + +#[derive(Clone, Debug)] +enum RngSource { + Node(NodeCrypto), + Browser(BrowserCrypto), +} + +// JsValues are always per-thread, so we initialize RngSource for each thread. +// See: https://github.com/rustwasm/wasm-bindgen/pull/955 +thread_local!( + static RNG_SOURCE: RefCell> = RefCell::new(None); +); + +pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> { + assert_eq!(mem::size_of::(), 4); + + RNG_SOURCE.with(|f| { + let mut source = f.borrow_mut(); + if source.is_none() { + *source = Some(getrandom_init()?); + } + + match source.as_ref().unwrap() { + RngSource::Node(n) => n.random_fill_sync(dest), + RngSource::Browser(n) => { + // see https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues + // + // where it says: + // + // > A QuotaExceededError DOMException is thrown if the + // > requested length is greater than 65536 bytes. + for chunk in dest.chunks_mut(65536) { + n.get_random_values(chunk) + } + } + }; + Ok(()) + }) +} + +fn getrandom_init() -> Result { + // First up we need to detect if we're running in node.js or a + // browser. To do this we get ahold of the `this` object (in a bit + // of a roundabout fashion). + // + // Once we have `this` we look at its `self` property, which is + // only defined on the web (either a main window or web worker). + let this = Function::new("return this").call(&JsValue::undefined()); + assert!(this != JsValue::undefined()); + let this = This::from(this); + let is_browser = this.self_() != JsValue::undefined(); + + if !is_browser { + return Ok(RngSource::Node(node_require("crypto"))); + } + + // If `self` is defined then we're in a browser somehow (main window + // or web worker). Here we want to try to use + // `crypto.getRandomValues`, but if `crypto` isn't defined we assume + // we're in an older web browser and the OS RNG isn't available. + let crypto = this.crypto(); + if crypto.is_undefined() { + return Err(Error::from(unsafe { + NonZeroU32::new_unchecked(CODE_CRYPTO_UNDEF) + })); + } + + // Test if `crypto.getRandomValues` is undefined as well + let crypto: BrowserCrypto = crypto.into(); + if crypto.get_random_values_fn().is_undefined() { + return Err(Error::from(unsafe { + NonZeroU32::new_unchecked(CODE_GRV_UNDEF) + })); + } + + // Ok! `self.crypto.getRandomValues` is a defined value, so let's + // assume we can do browser crypto. + Ok(RngSource::Browser(crypto)) +} + +#[inline(always)] +pub fn error_msg_inner(n: NonZeroU32) -> Option<&'static str> { + match n.get() { + CODE_CRYPTO_UNDEF => Some("getrandom: self.crypto is undefined"), + CODE_GRV_UNDEF => Some("crypto.getRandomValues is undefined"), + _ => None, + } +} + +#[wasm_bindgen] +extern "C" { + type Function; + #[wasm_bindgen(constructor)] + fn new(s: &str) -> Function; + #[wasm_bindgen(method)] + fn call(this: &Function, self_: &JsValue) -> JsValue; + + type This; + #[wasm_bindgen(method, getter, structural, js_name = self)] + fn self_(me: &This) -> JsValue; + #[wasm_bindgen(method, getter, structural)] + fn crypto(me: &This) -> JsValue; + + #[derive(Clone, Debug)] + type BrowserCrypto; + + // TODO: these `structural` annotations here ideally wouldn't be here to + // avoid a JS shim, but for now with feature detection they're + // unavoidable. + #[wasm_bindgen(method, js_name = getRandomValues, structural, getter)] + fn get_random_values_fn(me: &BrowserCrypto) -> JsValue; + #[wasm_bindgen(method, js_name = getRandomValues, structural)] + fn get_random_values(me: &BrowserCrypto, buf: &mut [u8]); + + #[wasm_bindgen(js_name = require)] + fn node_require(s: &str) -> NodeCrypto; + + #[derive(Clone, Debug)] + type NodeCrypto; + + #[wasm_bindgen(method, js_name = randomFillSync, structural)] + fn random_fill_sync(me: &NodeCrypto, buf: &mut [u8]); +} diff -Nru cargo-0.35.0/vendor/getrandom/src/wasm32_stdweb.rs cargo-0.37.0/vendor/getrandom/src/wasm32_stdweb.rs --- cargo-0.35.0/vendor/getrandom/src/wasm32_stdweb.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/src/wasm32_stdweb.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,114 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Implementation for WASM via stdweb +use core::mem; +use core::num::NonZeroU32; + +use stdweb::unstable::TryInto; +use stdweb::web::error::Error as WebError; +use stdweb::{_js_impl, js}; + +use crate::Error; +use lazy_static::lazy_static; + +#[derive(Clone, Copy, Debug)] +enum RngSource { + Browser, + Node, +} + +pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> { + assert_eq!(mem::size_of::(), 4); + + lazy_static! { + static ref RNG_SOURCE: Result = getrandom_init(); + } + getrandom_fill((*RNG_SOURCE)?, dest) +} + +fn getrandom_init() -> Result { + let result = js! { + try { + if ( + typeof self === "object" && + typeof self.crypto === "object" && + typeof self.crypto.getRandomValues === "function" + ) { + return { success: true, ty: 1 }; + } + + if (typeof require("crypto").randomBytes === "function") { + return { success: true, ty: 2 }; + } + + return { success: false, error: new Error("not supported") }; + } catch(err) { + return { success: false, error: err }; + } + }; + + if js! { return @{ result.as_ref() }.success } == true { + let ty = js! { return @{ result }.ty }; + + if ty == 1 { + Ok(RngSource::Browser) + } else if ty == 2 { + Ok(RngSource::Node) + } else { + unreachable!() + } + } else { + let err: WebError = js! { return @{ result }.error }.try_into().unwrap(); + error!("getrandom unavailable: {}", err); + Err(Error::UNAVAILABLE) + } +} + +fn getrandom_fill(source: RngSource, dest: &mut [u8]) -> Result<(), Error> { + for chunk in dest.chunks_mut(65536) { + let len = chunk.len() as u32; + let ptr = chunk.as_mut_ptr() as i32; + + let result = match source { + RngSource::Browser => js! { + try { + let array = new Uint8Array(@{ len }); + self.crypto.getRandomValues(array); + HEAPU8.set(array, @{ ptr }); + + return { success: true }; + } catch(err) { + return { success: false, error: err }; + } + }, + RngSource::Node => js! { + try { + let bytes = require("crypto").randomBytes(@{ len }); + HEAPU8.set(new Uint8Array(bytes), @{ ptr }); + + return { success: true }; + } catch(err) { + return { success: false, error: err }; + } + }, + }; + + if js! { return @{ result.as_ref() }.success } != true { + let err: WebError = js! { return @{ result }.error }.try_into().unwrap(); + error!("getrandom failed: {}", err); + return Err(Error::UNKNOWN); + } + } + Ok(()) +} + +#[inline(always)] +pub fn error_msg_inner(_: NonZeroU32) -> Option<&'static str> { + None +} diff -Nru cargo-0.35.0/vendor/getrandom/src/windows.rs cargo-0.37.0/vendor/getrandom/src/windows.rs --- cargo-0.35.0/vendor/getrandom/src/windows.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/src/windows.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,36 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Implementation for Windows +extern crate std; + +use crate::Error; +use core::num::NonZeroU32; +use std::io; + +extern "system" { + #[link_name = "SystemFunction036"] + fn RtlGenRandom(RandomBuffer: *mut u8, RandomBufferLength: u32) -> u8; +} + +pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> { + // Prevent overflow of u32 + for chunk in dest.chunks_mut(u32::max_value() as usize) { + let ret = unsafe { RtlGenRandom(chunk.as_mut_ptr(), chunk.len() as u32) }; + if ret == 0 { + error!("RtlGenRandom call failed"); + return Err(io::Error::last_os_error().into()); + } + } + Ok(()) +} + +#[inline(always)] +pub fn error_msg_inner(_: NonZeroU32) -> Option<&'static str> { + None +} diff -Nru cargo-0.35.0/vendor/getrandom/tests/mod.rs cargo-0.37.0/vendor/getrandom/tests/mod.rs --- cargo-0.35.0/vendor/getrandom/tests/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/getrandom/tests/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,61 @@ +extern crate getrandom; + +use getrandom::getrandom; + +#[test] +fn test_zero() { + // Test that APIs are happy with zero-length requests + getrandom(&mut [0u8; 0]).unwrap(); +} + +#[test] +fn test_diff() { + let mut v1 = [0u8; 1000]; + getrandom(&mut v1).unwrap(); + + let mut v2 = [0u8; 1000]; + getrandom(&mut v2).unwrap(); + + let mut n_diff_bits = 0; + for i in 0..v1.len() { + n_diff_bits += (v1[i] ^ v2[i]).count_ones(); + } + + // Check at least 1 bit per byte differs. p(failure) < 1e-1000 with random input. + assert!(n_diff_bits >= v1.len() as u32); +} + +#[test] +fn test_huge() { + let mut huge = [0u8; 100_000]; + getrandom(&mut huge).unwrap(); +} + +#[cfg(any(unix, windows, target_os = "redox", target_os = "fuchsia"))] +#[test] +fn test_multithreading() { + use std::sync::mpsc::channel; + use std::thread; + + let mut txs = vec![]; + for _ in 0..20 { + let (tx, rx) = channel(); + txs.push(tx); + + thread::spawn(move || { + // wait until all the tasks are ready to go. + rx.recv().unwrap(); + let mut v = [0u8; 1000]; + + for _ in 0..100 { + getrandom(&mut v).unwrap(); + thread::yield_now(); + } + }); + } + + // start all the tasks + for tx in txs.iter() { + tx.send(()).unwrap(); + } +} diff -Nru cargo-0.35.0/vendor/git2/Cargo.toml cargo-0.37.0/vendor/git2/Cargo.toml --- cargo-0.35.0/vendor/git2/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/git2/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -61,7 +61,6 @@ ssh = ["libgit2-sys/ssh"] ssh_key_from_memory = ["libgit2-sys/ssh_key_from_memory"] unstable = [] -vendored-openssl = ["openssl-sys/vendored"] [target."cfg(all(unix, not(target_os = \"macos\")))".dependencies.openssl-probe] version = "0.1" optional = true diff -Nru cargo-0.35.0/vendor/git2/debian/patches/disable-vendor.patch cargo-0.37.0/vendor/git2/debian/patches/disable-vendor.patch --- cargo-0.35.0/vendor/git2/debian/patches/disable-vendor.patch 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/git2/debian/patches/disable-vendor.patch 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,10 @@ +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -61,7 +61,6 @@ + ssh = ["libgit2-sys/ssh"] + ssh_key_from_memory = ["libgit2-sys/ssh_key_from_memory"] + unstable = [] +-vendored-openssl = ["openssl-sys/vendored"] + [target."cfg(all(unix, not(target_os = \"macos\")))".dependencies.openssl-probe] + version = "0.1" + optional = true diff -Nru cargo-0.35.0/vendor/git2/debian/patches/series cargo-0.37.0/vendor/git2/debian/patches/series --- cargo-0.35.0/vendor/git2/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/git2/debian/patches/series 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +disable-vendor.patch diff -Nru cargo-0.35.0/vendor/git2/.pc/applied-patches cargo-0.37.0/vendor/git2/.pc/applied-patches --- cargo-0.35.0/vendor/git2/.pc/applied-patches 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/git2/.pc/applied-patches 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +disable-vendor.patch diff -Nru cargo-0.35.0/vendor/git2/.pc/disable-vendor.patch/Cargo.toml cargo-0.37.0/vendor/git2/.pc/disable-vendor.patch/Cargo.toml --- cargo-0.35.0/vendor/git2/.pc/disable-vendor.patch/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/git2/.pc/disable-vendor.patch/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,76 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# 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 = "git2" +version = "0.8.0" +authors = ["Alex Crichton "] +description = "Bindings to libgit2 for interoperating with git repositories. This library is\nboth threadsafe and memory safe and allows both reading and writing git\nrepositories.\n" +homepage = "https://github.com/alexcrichton/git2-rs" +documentation = "https://docs.rs/git2" +readme = "README.md" +keywords = ["git"] +categories = ["api-bindings"] +license = "MIT/Apache-2.0" +repository = "https://github.com/alexcrichton/git2-rs" +[dependencies.bitflags] +version = "1.0" + +[dependencies.libc] +version = "0.2" + +[dependencies.libgit2-sys] +version = "0.7.11" + +[dependencies.log] +version = "0.4" + +[dependencies.url] +version = "1.0" +[dev-dependencies.docopt] +version = "1.0" + +[dev-dependencies.serde] +version = "1.0" + +[dev-dependencies.serde_derive] +version = "1.0" + +[dev-dependencies.tempdir] +version = "0.3.7" + +[dev-dependencies.thread-id] +version = "3.3.0" + +[dev-dependencies.time] +version = "0.1.39" + +[features] +curl = ["libgit2-sys/curl"] +default = ["ssh", "https", "curl", "ssh_key_from_memory"] +https = ["libgit2-sys/https", "openssl-sys", "openssl-probe"] +ssh = ["libgit2-sys/ssh"] +ssh_key_from_memory = ["libgit2-sys/ssh_key_from_memory"] +unstable = [] +vendored-openssl = ["openssl-sys/vendored"] +[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies.openssl-probe] +version = "0.1" +optional = true + +[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies.openssl-sys] +version = "0.9.0" +optional = true +[badges.appveyor] +repository = "alexcrichton/git2-rs" + +[badges.travis-ci] +repository = "alexcrichton/git2-rs" diff -Nru cargo-0.35.0/vendor/git2/.pc/.quilt_patches cargo-0.37.0/vendor/git2/.pc/.quilt_patches --- cargo-0.35.0/vendor/git2/.pc/.quilt_patches 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/git2/.pc/.quilt_patches 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +debian/patches diff -Nru cargo-0.35.0/vendor/git2/.pc/.quilt_series cargo-0.37.0/vendor/git2/.pc/.quilt_series --- cargo-0.35.0/vendor/git2/.pc/.quilt_series 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/git2/.pc/.quilt_series 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +series diff -Nru cargo-0.35.0/vendor/git2/.pc/.version cargo-0.37.0/vendor/git2/.pc/.version --- cargo-0.35.0/vendor/git2/.pc/.version 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/git2/.pc/.version 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +2 diff -Nru cargo-0.35.0/vendor/glob/.cargo-checksum.json cargo-0.37.0/vendor/glob/.cargo-checksum.json --- cargo-0.35.0/vendor/glob/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/glob/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"} \ No newline at end of file +{"files":{},"package":"9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/glob/Cargo.toml cargo-0.37.0/vendor/glob/Cargo.toml --- cargo-0.35.0/vendor/glob/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/glob/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -1,15 +1,24 @@ -[package] +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# 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 = "glob" -version = "0.2.11" +version = "0.3.0" authors = ["The Rust Project Developers"] -license = "MIT/Apache-2.0" +description = "Support for matching file paths against Unix shell style patterns.\n" homepage = "https://github.com/rust-lang/glob" +documentation = "https://docs.rs/glob/0.3.0" +categories = ["filesystem"] +license = "MIT/Apache-2.0" repository = "https://github.com/rust-lang/glob" -documentation = "https://doc.rust-lang.org/glob" -description = """ -Support for matching file paths against Unix shell style patterns. -""" - -[dev-dependencies] -tempdir = "0.3" +[dev-dependencies.tempdir] +version = "0.3" diff -Nru cargo-0.35.0/vendor/glob/README.md cargo-0.37.0/vendor/glob/README.md --- cargo-0.35.0/vendor/glob/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/glob/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -13,7 +13,7 @@ ```toml [dependencies] -glob = "*" +glob = "0.3.0" ``` And add this to your crate root: @@ -22,3 +22,17 @@ extern crate glob; ``` +## Examples + +Print all jpg files in /media/ and all of its subdirectories. + +```rust +use glob::glob; + +for entry in glob("/media/**/*.jpg").expect("Failed to read glob pattern") { + match entry { + Ok(path) => println!("{:?}", path.display()), + Err(e) => println!("{:?}", e), + } +} +``` diff -Nru cargo-0.35.0/vendor/glob/src/lib.rs cargo-0.37.0/vendor/glob/src/lib.rs --- cargo-0.35.0/vendor/glob/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/glob/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -10,35 +10,71 @@ //! Support for matching file paths against Unix shell style patterns. //! -//! The `glob` and `glob_with` functions, in concert with the `Paths` -//! type, allow querying the filesystem for all files that match a particular -//! pattern - just like the libc `glob` function (for an example see the `glob` -//! documentation). The methods on the `Pattern` type provide functionality -//! for checking if individual paths match a particular pattern - in a similar -//! manner to the libc `fnmatch` function +//! The `glob` and `glob_with` functions allow querying the filesystem for all +//! files that match a particular pattern (similar to the libc `glob` function). +//! The methods on the `Pattern` type provide functionality for checking if +//! individual paths match a particular pattern (similar to the libc `fnmatch` +//! function). +//! //! For consistency across platforms, and for Windows support, this module //! is implemented entirely in Rust rather than deferring to the libc //! `glob`/`fnmatch` functions. - -#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", - html_favicon_url = "https://www.rust-lang.org/favicon.ico", - html_root_url = "https://doc.rust-lang.org/glob/")] +//! +//! # Examples +//! +//! To print all jpg files in `/media/` and all of its subdirectories. +//! +//! ```rust,no_run +//! use glob::glob; +//! +//! for entry in glob("/media/**/*.jpg").expect("Failed to read glob pattern") { +//! match entry { +//! Ok(path) => println!("{:?}", path.display()), +//! Err(e) => println!("{:?}", e), +//! } +//! } +//! ``` +//! +//! To print all files containing the letter "a", case insensitive, in a `local` +//! directory relative to the current working directory. This ignores errors +//! instead of printing them. +//! +//! ```rust,no_run +//! use glob::glob_with; +//! use glob::MatchOptions; +//! +//! let options = MatchOptions { +//! case_sensitive: false, +//! require_literal_separator: false, +//! require_literal_leading_dot: false, +//! }; +//! for entry in glob_with("local/*a*", options).unwrap() { +//! if let Ok(path) = entry { +//! println!("{:?}", path.display()) +//! } +//! } +//! ``` + +#![doc( + html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", + html_favicon_url = "https://www.rust-lang.org/favicon.ico", + html_root_url = "https://docs.rs/glob/0.3.0" +)] +#![deny(missing_docs)] #![cfg_attr(all(test, windows), feature(std_misc))] -use std::ascii::AsciiExt; use std::cmp; +use std::error::Error; use std::fmt; use std::fs; -use std::io::prelude::*; use std::io; -use std::path::{self, Path, PathBuf, Component}; +use std::path::{self, Component, Path, PathBuf}; use std::str::FromStr; -use std::error::Error; -use PatternToken::{Char, AnyChar, AnySequence, AnyRecursiveSequence, AnyWithin}; +use CharSpecifier::{CharRange, SingleChar}; +use MatchResult::{EntirePatternDoesntMatch, Match, SubPatternDoesntMatch}; use PatternToken::AnyExcept; -use CharSpecifier::{SingleChar, CharRange}; -use MatchResult::{Match, SubPatternDoesntMatch, EntirePatternDoesntMatch}; +use PatternToken::{AnyChar, AnyRecursiveSequence, AnySequence, AnyWithin, Char}; /// An iterator that yields `Path`s from the filesystem that match a particular /// pattern. @@ -57,8 +93,9 @@ scope: Option, } -/// Return an iterator that produces all the Paths that match the given pattern, -/// which may be absolute or relative to the current working directory. +/// Return an iterator that produces all the `Path`s that match the given +/// pattern using default match options, which may be absolute or relative to +/// the current working directory. /// /// This may return an error if the pattern is invalid. /// @@ -75,12 +112,12 @@ /// /// See the `Paths` documentation for more information. /// -/// # Example +/// # Examples /// /// Consider a directory `/media/pictures` containing only the files /// `kittens.jpg`, `puppies.jpg` and `hamsters.gif`: /// -/// ```rust +/// ```rust,no_run /// use glob::glob; /// /// for entry in glob("/media/pictures/*.jpg").unwrap() { @@ -112,13 +149,14 @@ /// println!("{}", path.display()); /// } /// ``` -/// +/// Paths are yielded in alphabetical order. pub fn glob(pattern: &str) -> Result { - glob_with(pattern, &MatchOptions::new()) + glob_with(pattern, MatchOptions::new()) } -/// Return an iterator that produces all the Paths that match the given pattern, -/// which may be absolute or relative to the current working directory. +/// Return an iterator that produces all the `Path`s that match the given +/// pattern using the specified match options, which may be absolute or relative +/// to the current working directory. /// /// This may return an error if the pattern is invalid. /// @@ -129,10 +167,7 @@ /// passed to this function. /// /// Paths are yielded in alphabetical order. -pub fn glob_with(pattern: &str, options: &MatchOptions) -> Result { - // make sure that the pattern is valid first, else early return with error - let _compiled = try!(Pattern::new(pattern)); - +pub fn glob_with(pattern: &str, options: MatchOptions) -> Result { #[cfg(windows)] fn check_windows_verbatim(p: &Path) -> bool { use std::path::Prefix; @@ -156,11 +191,15 @@ p.to_path_buf() } + // make sure that the pattern is valid first, else early return with error + if let Err(err) = Pattern::new(pattern) { + return Err(err); + } + let mut components = Path::new(pattern).components().peekable(); loop { match components.peek() { - Some(&Component::Prefix(..)) | - Some(&Component::RootDir) => { + Some(&Component::Prefix(..)) | Some(&Component::RootDir) => { components.next(); } _ => break, @@ -182,21 +221,20 @@ return Ok(Paths { dir_patterns: Vec::new(), require_dir: false, - options: options.clone(), + options, todo: Vec::new(), scope: None, }); } - let scope = root.map(to_scope).unwrap_or_else(|| PathBuf::from(".")); + let scope = root.map_or_else(|| PathBuf::from("."), to_scope); let mut dir_patterns = Vec::new(); - let components = pattern[cmp::min(root_len, pattern.len())..] - .split_terminator(path::is_separator); + let components = + pattern[cmp::min(root_len, pattern.len())..].split_terminator(path::is_separator); for component in components { - let compiled = try!(Pattern::new(component)); - dir_patterns.push(compiled); + dir_patterns.push(Pattern::new(component)?); } if root_len == pattern.len() { @@ -207,14 +245,15 @@ }); } - let require_dir = pattern.chars().next_back().map(path::is_separator) == Some(true); + let last_is_separator = pattern.chars().next_back().map(path::is_separator); + let require_dir = last_is_separator == Some(true); let todo = Vec::new(); Ok(Paths { - dir_patterns: dir_patterns, - require_dir: require_dir, - options: options.clone(), - todo: todo, + dir_patterns, + require_dir, + options, + todo, scope: Some(scope), }) } @@ -223,7 +262,7 @@ /// /// This is typically returned when a particular path cannot be read /// to determine if its contents match the glob pattern. This is possible -/// if the program lacks the permissions, for example. +/// if the program lacks the appropriate permissions, for example. #[derive(Debug)] pub struct GlobError { path: PathBuf, @@ -240,12 +279,18 @@ pub fn error(&self) -> &io::Error { &self.error } + + /// Consumes self, returning the _raw_ underlying `io::Error` + pub fn into_error(self) -> io::Error { + self.error + } } impl Error for GlobError { fn description(&self) -> &str { self.error.description() } + fn cause(&self) -> Option<&Error> { Some(&self.error) } @@ -253,10 +298,12 @@ impl fmt::Display for GlobError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, - "attempting to read `{}` resulted in an error: {}", - self.path.display(), - self.error) + write!( + f, + "attempting to read `{}` resulted in an error: {}", + self.path.display(), + self.error + ) } } @@ -279,11 +326,11 @@ // failing to fill the buffer is an iteration error construction of the // iterator (i.e. glob()) only fails if it fails to compile the Pattern if let Some(scope) = self.scope.take() { - if self.dir_patterns.len() > 0 { + if !self.dir_patterns.is_empty() { // Shouldn't happen, but we're using -1 as a special index. assert!(self.dir_patterns.len() < !0 as usize); - fill_todo(&mut self.todo, &self.dir_patterns, 0, &scope, &self.options); + fill_todo(&mut self.todo, &self.dir_patterns, 0, &scope, self.options); } } @@ -310,8 +357,9 @@ let mut next = idx; // collapse consecutive recursive patterns - while (next + 1) < self.dir_patterns.len() && - self.dir_patterns[next + 1].is_recursive { + while (next + 1) < self.dir_patterns.len() + && self.dir_patterns[next + 1].is_recursive + { next += 1; } @@ -319,11 +367,13 @@ // the path is a directory, so it's a match // push this directory's contents - fill_todo(&mut self.todo, - &self.dir_patterns, - next, - &path, - &self.options); + fill_todo( + &mut self.todo, + &self.dir_patterns, + next, + &path, + self.options, + ); if next == self.dir_patterns.len() - 1 { // pattern ends in recursive pattern, so return this @@ -333,25 +383,29 @@ // advanced to the next pattern for this path idx = next + 1; } - } else if next != self.dir_patterns.len() - 1 { + } else if next == self.dir_patterns.len() - 1 { + // not a directory and it's the last pattern, meaning no + // match + continue; + } else { // advanced to the next pattern for this path idx = next + 1; - } else { - // not a directory and it's the last pattern, meaning no match - continue; } } // not recursive, so match normally - if self.dir_patterns[idx].matches_with({ - match path.file_name().and_then(|s| s.to_str()) { - // FIXME (#9639): How do we handle non-utf8 filenames? - // Ignore them for now Ideally we'd still match them - // against a * - None => continue, - Some(x) => x - } - }, &self.options) { + if self.dir_patterns[idx].matches_with( + { + match path.file_name().and_then(|s| s.to_str()) { + // FIXME (#9639): How do we handle non-utf8 filenames? + // Ignore them for now; ideally we'd still match them + // against a * + None => continue, + Some(x) => x, + } + }, + self.options, + ) { if idx == self.dir_patterns.len() - 1 { // it is not possible for a pattern to match a directory // *AND* its children so we don't need to check the @@ -361,8 +415,13 @@ return Some(Ok(path)); } } else { - fill_todo(&mut self.todo, &self.dir_patterns, - idx + 1, &path, &self.options); + fill_todo( + &mut self.todo, + &self.dir_patterns, + idx + 1, + &path, + self.options, + ); } } } @@ -388,38 +447,39 @@ impl fmt::Display for PatternError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, - "Pattern syntax error near position {}: {}", - self.pos, - self.msg) + write!( + f, + "Pattern syntax error near position {}: {}", + self.pos, self.msg + ) } } /// A compiled Unix shell style pattern. /// -/// `?` matches any single character +/// - `?` matches any single character. /// -/// `*` matches any (possibly empty) sequence of characters +/// - `*` matches any (possibly empty) sequence of characters. /// -/// `**` matches the current directory and arbitrary subdirectories. This -/// sequence **must** form a single path component, so both `**a` and `b**` are -/// invalid and will result in an error. A sequence of more than two -/// consecutive `*` characters is also invalid. -/// -/// `[...]` matches any character inside the brackets. -/// Character sequences can also specify ranges -/// of characters, as ordered by Unicode, so e.g. `[0-9]` specifies any -/// character between 0 and 9 inclusive. An unclosed bracket is invalid. -/// -/// `[!...]` is the negation of `[...]`, i.e. it matches any characters **not** -/// in the brackets. -/// -/// The metacharacters `?`, `*`, `[`, `]` can be matched by using brackets -/// (e.g. `[?]`). When a `]` occurs immediately following `[` or `[!` then -/// it is interpreted as being part of, rather then ending, the character -/// set, so `]` and NOT `]` can be matched by `[]]` and `[!]]` respectively. -/// The `-` character can be specified inside a character sequence pattern by -/// placing it at the start or the end, e.g. `[abc-]`. +/// - `**` matches the current directory and arbitrary subdirectories. This +/// sequence **must** form a single path component, so both `**a` and `b**` +/// are invalid and will result in an error. A sequence of more than two +/// consecutive `*` characters is also invalid. +/// +/// - `[...]` matches any character inside the brackets. Character sequences +/// can also specify ranges of characters, as ordered by Unicode, so e.g. +/// `[0-9]` specifies any character between 0 and 9 inclusive. An unclosed +/// bracket is invalid. +/// +/// - `[!...]` is the negation of `[...]`, i.e. it matches any characters +/// **not** in the brackets. +/// +/// - The metacharacters `?`, `*`, `[`, `]` can be matched by using brackets +/// (e.g. `[?]`). When a `]` occurs immediately following `[` or `[!` then it +/// is interpreted as being part of, rather then ending, the character set, so +/// `]` and NOT `]` can be matched by `[]]` and `[!]]` respectively. The `-` +/// character can be specified inside a character sequence pattern by placing +/// it at the start or the end, e.g. `[abc-]`. #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default, Debug)] pub struct Pattern { original: String, @@ -437,8 +497,8 @@ impl FromStr for Pattern { type Err = PatternError; - fn from_str(s: &str) -> Result { - Pattern::new(s) + fn from_str(s: &str) -> Result { + Self::new(s) } } @@ -465,17 +525,16 @@ EntirePatternDoesntMatch, } -const ERROR_WILDCARDS: &'static str = "wildcards are either regular `*` or recursive `**`"; -const ERROR_RECURSIVE_WILDCARDS: &'static str = "recursive wildcards must form a single path \ - component"; -const ERROR_INVALID_RANGE: &'static str = "invalid range pattern"; +const ERROR_WILDCARDS: &str = "wildcards are either regular `*` or recursive `**`"; +const ERROR_RECURSIVE_WILDCARDS: &str = "recursive wildcards must form a single path \ + component"; +const ERROR_INVALID_RANGE: &str = "invalid range pattern"; impl Pattern { /// This function compiles Unix shell style patterns. /// - /// An invalid glob pattern will yield an error. - pub fn new(pattern: &str) -> Result { - + /// An invalid glob pattern will yield a `PatternError`. + pub fn new(pattern: &str) -> Result { let chars = pattern.chars().collect::>(); let mut tokens = Vec::new(); let mut is_recursive = false; @@ -510,18 +569,18 @@ if i < chars.len() && path::is_separator(chars[i]) { i += 1; true - // or the pattern ends here - // this enables the existing globbing mechanism + // or the pattern ends here + // this enables the existing globbing mechanism } else if i == chars.len() { true - // `**` ends in non-separator + // `**` ends in non-separator } else { return Err(PatternError { pos: i, msg: ERROR_RECURSIVE_WILDCARDS, }); } - // `**` begins with non-separator + // `**` begins with non-separator } else { return Err(PatternError { pos: old - 1, @@ -544,7 +603,6 @@ } } '[' => { - if i + 4 <= chars.len() && chars[i + 1] == '!' { match chars[i + 3..].iter().position(|x| *x == ']') { None => (), @@ -581,10 +639,10 @@ } } - Ok(Pattern { - tokens: tokens, + Ok(Self { + tokens, original: pattern.to_string(), - is_recursive: is_recursive, + is_recursive, }) } @@ -613,7 +671,7 @@ /// Return if the given `str` matches this `Pattern` using the default /// match options (i.e. `MatchOptions::new()`). /// - /// # Example + /// # Examples /// /// ```rust /// use glob::Pattern; @@ -623,7 +681,7 @@ /// assert!(Pattern::new("d*g").unwrap().matches("doog")); /// ``` pub fn matches(&self, str: &str) -> bool { - self.matches_with(str, &MatchOptions::new()) + self.matches_with(str, MatchOptions::new()) } /// Return if the given `Path`, when converted to a `str`, matches this @@ -635,29 +693,30 @@ /// Return if the given `str` matches this `Pattern` using the specified /// match options. - pub fn matches_with(&self, str: &str, options: &MatchOptions) -> bool { + pub fn matches_with(&self, str: &str, options: MatchOptions) -> bool { self.matches_from(true, str.chars(), 0, options) == Match } /// Return if the given `Path`, when converted to a `str`, matches this /// `Pattern` using the specified match options. - pub fn matches_path_with(&self, path: &Path, options: &MatchOptions) -> bool { + pub fn matches_path_with(&self, path: &Path, options: MatchOptions) -> bool { // FIXME (#9639): This needs to handle non-utf8 paths - path.to_str().map_or(false, |s| self.matches_with(s, options)) + path.to_str() + .map_or(false, |s| self.matches_with(s, options)) } /// Access the original glob pattern. - pub fn as_str<'a>(&'a self) -> &'a str { + pub fn as_str(&self) -> &str { &self.original } - fn matches_from(&self, - mut follows_separator: bool, - mut file: std::str::Chars, - i: usize, - options: &MatchOptions) - -> MatchResult { - + fn matches_from( + &self, + mut follows_separator: bool, + mut file: std::str::Chars, + i: usize, + options: MatchOptions, + ) -> MatchResult { for (ti, token) in self.tokens[i..].iter().enumerate() { match *token { AnySequence | AnyRecursiveSequence => { @@ -680,14 +739,19 @@ follows_separator = path::is_separator(c); match *token { AnyRecursiveSequence if !follows_separator => continue, - AnySequence if options.require_literal_separator && - follows_separator => return SubPatternDoesntMatch, + AnySequence + if options.require_literal_separator && follows_separator => + { + return SubPatternDoesntMatch + } _ => (), } - match self.matches_from(follows_separator, - file.clone(), - i + ti + 1, - options) { + match self.matches_from( + follows_separator, + file.clone(), + i + ti + 1, + options, + ) { SubPatternDoesntMatch => (), // keep trying m => return m, } @@ -703,9 +767,13 @@ if !match *token { AnyChar | AnyWithin(..) | AnyExcept(..) - if (options.require_literal_separator && is_sep) || - (follows_separator && options.require_literal_leading_dot && - c == '.') => false, + if (options.require_literal_separator && is_sep) + || (follows_separator + && options.require_literal_leading_dot + && c == '.') => + { + false + } AnyChar => true, AnyWithin(ref specifiers) => in_char_specifiers(&specifiers, c, options), AnyExcept(ref specifiers) => !in_char_specifiers(&specifiers, c, options), @@ -731,21 +799,24 @@ // Fills `todo` with paths under `path` to be matched by `patterns[idx]`, // special-casing patterns to match `.` and `..`, and avoiding `readdir()` // calls when there are no metacharacters in the pattern. -fn fill_todo(todo: &mut Vec>, - patterns: &[Pattern], - idx: usize, - path: &Path, - options: &MatchOptions) { +fn fill_todo( + todo: &mut Vec>, + patterns: &[Pattern], + idx: usize, + path: &Path, + options: MatchOptions, +) { // convert a pattern that's just many Char(_) to a string fn pattern_as_str(pattern: &Pattern) -> Option { let mut s = String::new(); - for token in pattern.tokens.iter() { + for token in &pattern.tokens { match *token { Char(c) => s.push(c), _ => return None, } } - return Some(s); + + Some(s) } let add = |todo: &mut Vec<_>, next_path: PathBuf| { @@ -782,15 +853,15 @@ None if is_dir => { let dirs = fs::read_dir(path).and_then(|d| { d.map(|e| { - e.map(|e| { - if curdir { - PathBuf::from(e.path().file_name().unwrap()) - } else { - e.path() - } - }) - }) - .collect::, _>>() + e.map(|e| { + if curdir { + PathBuf::from(e.path().file_name().unwrap()) + } else { + e.path() + } + }) + }) + .collect::, _>>() }); match dirs { Ok(mut children) => { @@ -802,8 +873,8 @@ // requires that the pattern has a leading dot, even if the // `MatchOptions` field `require_literal_leading_dot` is not // set. - if pattern.tokens.len() > 0 && pattern.tokens[0] == Char('.') { - for &special in [".", ".."].iter() { + if !pattern.tokens.is_empty() && pattern.tokens[0] == Char('.') { + for &special in &[".", ".."] { if pattern.matches_with(special, options) { add(todo, path.join(special)); } @@ -839,8 +910,7 @@ cs } -fn in_char_specifiers(specifiers: &[CharSpecifier], c: char, options: &MatchOptions) -> bool { - +fn in_char_specifiers(specifiers: &[CharSpecifier], c: char, options: MatchOptions) -> bool { for &specifier in specifiers.iter() { match specifier { SingleChar(sc) => { @@ -849,10 +919,8 @@ } } CharRange(start, end) => { - // FIXME: work with non-ascii chars properly (issue #1347) if !options.case_sensitive && c.is_ascii() && start.is_ascii() && end.is_ascii() { - let start = start.to_ascii_lowercase(); let end = end.to_ascii_lowercase(); @@ -891,10 +959,9 @@ } } - -/// Configuration options to modify the behaviour of `Pattern::matches_with(..)` +/// Configuration options to modify the behaviour of `Pattern::matches_with(..)`. #[allow(missing_copy_implementations)] -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] pub struct MatchOptions { /// Whether or not patterns should be matched in a case-sensitive manner. /// This currently only considers upper/lower case relationships between @@ -902,13 +969,13 @@ /// Unicode. pub case_sensitive: bool, - /// If this is true then path-component separator characters (e.g. `/` on + /// Whether or not path-component separator characters (e.g. `/` on /// Posix) must be matched by a literal `/`, rather than by `*` or `?` or - /// `[...]` + /// `[...]`. pub require_literal_separator: bool, - /// If this is true then paths that contain components that start with a `.` - /// will not match unless the `.` appears literally in the pattern: `*`, `?`, `**`, + /// Whether or not paths that contain components that start with a `.` + /// will require that `.` appears literally in the pattern; `*`, `?`, `**`, /// or `[...]` will not match. This is useful because such files are /// conventionally considered hidden on Unix systems and it might be /// desirable to skip them when listing files. @@ -925,12 +992,12 @@ /// ```rust,ignore /// MatchOptions { /// case_sensitive: true, - /// require_literal_separator: false. + /// require_literal_separator: false, /// require_literal_leading_dot: false /// } /// ``` - pub fn new() -> MatchOptions { - MatchOptions { + pub fn new() -> Self { + Self { case_sensitive: true, require_literal_separator: false, require_literal_leading_dot: false, @@ -940,8 +1007,8 @@ #[cfg(test)] mod test { + use super::{glob, MatchOptions, Pattern}; use std::path::Path; - use super::{glob, Pattern, MatchOptions}; #[test] fn test_pattern_from_str() { @@ -979,7 +1046,7 @@ // this test assumes that there is a /root directory and that // the user running this test is not root or otherwise doesn't // have permission to read its contents - #[cfg(unix)] + #[cfg(all(unix, not(target_os = "macos")))] #[test] fn test_iteration_errors() { use std::io; @@ -1015,11 +1082,14 @@ // check windows absolute paths with host/device components let root_with_device = current_dir() - .ok() - .and_then(|p| p.prefix().map(|p| p.join("*"))) - .unwrap(); + .ok() + .and_then(|p| p.prefix().map(|p| p.join("*"))) + .unwrap(); // FIXME (#9639): This needs to handle non-utf8 paths - assert!(glob(root_with_device.as_os_str().to_str().unwrap()).unwrap().next().is_some()); + assert!(glob(root_with_device.as_os_str().to_str().unwrap()) + .unwrap() + .next() + .is_some()); } win() } @@ -1031,11 +1101,15 @@ assert!(!Pattern::new("a*b*c").unwrap().matches("abcd")); assert!(Pattern::new("a*b*c").unwrap().matches("a_b_c")); assert!(Pattern::new("a*b*c").unwrap().matches("a___b___c")); - assert!(Pattern::new("abc*abc*abc").unwrap().matches("abcabcabcabcabcabcabc")); - assert!(!Pattern::new("abc*abc*abc").unwrap().matches("abcabcabcabcabcabcabca")); + assert!(Pattern::new("abc*abc*abc") + .unwrap() + .matches("abcabcabcabcabcabcabc")); + assert!(!Pattern::new("abc*abc*abc") + .unwrap() + .matches("abcabcabcabcabcabcabca")); assert!(Pattern::new("a*a*a*a*a*a*a*a*a") - .unwrap() - .matches("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")); + .unwrap() + .matches("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")); assert!(Pattern::new("a*b[xyz]c*d").unwrap().matches("abxcdbxcddd")); } @@ -1057,7 +1131,6 @@ assert!(pat.matches(".asdf")); assert!(pat.matches("/x/.asdf")); - // collapse consecutive wildcards let pat = Pattern::new("some/**/**/needle.txt").unwrap(); assert!(pat.matches("some/needle.txt")); @@ -1096,7 +1169,6 @@ #[test] fn test_range_pattern() { - let pat = Pattern::new("a[0-9]b").unwrap(); for i in 0..10 { assert!(pat.matches(&format!("a{}b", i))); @@ -1116,8 +1188,11 @@ assert!(pat.matches(&c.to_string())); } for c in "ABCDEFGHIJKLMNOPQRSTUVWXYZ".chars() { - let options = MatchOptions { case_sensitive: false, ..MatchOptions::new() }; - assert!(pat.matches_with(&c.to_string(), &options)); + let options = MatchOptions { + case_sensitive: false, + ..MatchOptions::new() + }; + assert!(pat.matches_with(&c.to_string(), options)); } assert!(pat.matches("1")); assert!(pat.matches("2")); @@ -1169,7 +1244,6 @@ #[test] fn test_pattern_matches_case_insensitive() { - let pat = Pattern::new("aBcDeFg").unwrap(); let options = MatchOptions { case_sensitive: false, @@ -1177,15 +1251,14 @@ require_literal_leading_dot: false, }; - assert!(pat.matches_with("aBcDeFg", &options)); - assert!(pat.matches_with("abcdefg", &options)); - assert!(pat.matches_with("ABCDEFG", &options)); - assert!(pat.matches_with("AbCdEfG", &options)); + assert!(pat.matches_with("aBcDeFg", options)); + assert!(pat.matches_with("abcdefg", options)); + assert!(pat.matches_with("ABCDEFG", options)); + assert!(pat.matches_with("AbCdEfG", options)); } #[test] fn test_pattern_matches_case_insensitive_range() { - let pat_within = Pattern::new("[a]").unwrap(); let pat_except = Pattern::new("[!a]").unwrap(); @@ -1200,18 +1273,17 @@ require_literal_leading_dot: false, }; - assert!(pat_within.matches_with("a", &options_case_insensitive)); - assert!(pat_within.matches_with("A", &options_case_insensitive)); - assert!(!pat_within.matches_with("A", &options_case_sensitive)); - - assert!(!pat_except.matches_with("a", &options_case_insensitive)); - assert!(!pat_except.matches_with("A", &options_case_insensitive)); - assert!(pat_except.matches_with("A", &options_case_sensitive)); + assert!(pat_within.matches_with("a", options_case_insensitive)); + assert!(pat_within.matches_with("A", options_case_insensitive)); + assert!(!pat_within.matches_with("A", options_case_sensitive)); + + assert!(!pat_except.matches_with("a", options_case_insensitive)); + assert!(!pat_except.matches_with("A", options_case_insensitive)); + assert!(pat_except.matches_with("A", options_case_sensitive)); } #[test] fn test_pattern_matches_require_literal_separator() { - let options_require_literal = MatchOptions { case_sensitive: true, require_literal_separator: true, @@ -1223,34 +1295,35 @@ require_literal_leading_dot: false, }; - assert!(Pattern::new("abc/def").unwrap().matches_with("abc/def", &options_require_literal)); + assert!(Pattern::new("abc/def") + .unwrap() + .matches_with("abc/def", options_require_literal)); assert!(!Pattern::new("abc?def") - .unwrap() - .matches_with("abc/def", &options_require_literal)); + .unwrap() + .matches_with("abc/def", options_require_literal)); assert!(!Pattern::new("abc*def") - .unwrap() - .matches_with("abc/def", &options_require_literal)); + .unwrap() + .matches_with("abc/def", options_require_literal)); assert!(!Pattern::new("abc[/]def") - .unwrap() - .matches_with("abc/def", &options_require_literal)); + .unwrap() + .matches_with("abc/def", options_require_literal)); assert!(Pattern::new("abc/def") - .unwrap() - .matches_with("abc/def", &options_not_require_literal)); + .unwrap() + .matches_with("abc/def", options_not_require_literal)); assert!(Pattern::new("abc?def") - .unwrap() - .matches_with("abc/def", &options_not_require_literal)); + .unwrap() + .matches_with("abc/def", options_not_require_literal)); assert!(Pattern::new("abc*def") - .unwrap() - .matches_with("abc/def", &options_not_require_literal)); + .unwrap() + .matches_with("abc/def", options_not_require_literal)); assert!(Pattern::new("abc[/]def") - .unwrap() - .matches_with("abc/def", &options_not_require_literal)); + .unwrap() + .matches_with("abc/def", options_not_require_literal)); } #[test] fn test_pattern_matches_require_literal_leading_dot() { - let options_require_literal_leading_dot = MatchOptions { case_sensitive: true, require_literal_separator: false, @@ -1262,39 +1335,65 @@ require_literal_leading_dot: false, }; - let f = |options| Pattern::new("*.txt").unwrap().matches_with(".hello.txt", options); - assert!(f(&options_not_require_literal_leading_dot)); - assert!(!f(&options_require_literal_leading_dot)); - - let f = |options| Pattern::new(".*.*").unwrap().matches_with(".hello.txt", options); - assert!(f(&options_not_require_literal_leading_dot)); - assert!(f(&options_require_literal_leading_dot)); - - let f = |options| Pattern::new("aaa/bbb/*").unwrap().matches_with("aaa/bbb/.ccc", options); - assert!(f(&options_not_require_literal_leading_dot)); - assert!(!f(&options_require_literal_leading_dot)); + let f = |options| { + Pattern::new("*.txt") + .unwrap() + .matches_with(".hello.txt", options) + }; + assert!(f(options_not_require_literal_leading_dot)); + assert!(!f(options_require_literal_leading_dot)); + + let f = |options| { + Pattern::new(".*.*") + .unwrap() + .matches_with(".hello.txt", options) + }; + assert!(f(options_not_require_literal_leading_dot)); + assert!(f(options_require_literal_leading_dot)); + + let f = |options| { + Pattern::new("aaa/bbb/*") + .unwrap() + .matches_with("aaa/bbb/.ccc", options) + }; + assert!(f(options_not_require_literal_leading_dot)); + assert!(!f(options_require_literal_leading_dot)); let f = |options| { - Pattern::new("aaa/bbb/*").unwrap().matches_with("aaa/bbb/c.c.c.", options) + Pattern::new("aaa/bbb/*") + .unwrap() + .matches_with("aaa/bbb/c.c.c.", options) }; - assert!(f(&options_not_require_literal_leading_dot)); - assert!(f(&options_require_literal_leading_dot)); + assert!(f(options_not_require_literal_leading_dot)); + assert!(f(options_require_literal_leading_dot)); - let f = |options| Pattern::new("aaa/bbb/.*").unwrap().matches_with("aaa/bbb/.ccc", options); - assert!(f(&options_not_require_literal_leading_dot)); - assert!(f(&options_require_literal_leading_dot)); - - let f = |options| Pattern::new("aaa/?bbb").unwrap().matches_with("aaa/.bbb", options); - assert!(f(&options_not_require_literal_leading_dot)); - assert!(!f(&options_require_literal_leading_dot)); - - let f = |options| Pattern::new("aaa/[.]bbb").unwrap().matches_with("aaa/.bbb", options); - assert!(f(&options_not_require_literal_leading_dot)); - assert!(!f(&options_require_literal_leading_dot)); + let f = |options| { + Pattern::new("aaa/bbb/.*") + .unwrap() + .matches_with("aaa/bbb/.ccc", options) + }; + assert!(f(options_not_require_literal_leading_dot)); + assert!(f(options_require_literal_leading_dot)); + + let f = |options| { + Pattern::new("aaa/?bbb") + .unwrap() + .matches_with("aaa/.bbb", options) + }; + assert!(f(options_not_require_literal_leading_dot)); + assert!(!f(options_require_literal_leading_dot)); + + let f = |options| { + Pattern::new("aaa/[.]bbb") + .unwrap() + .matches_with("aaa/.bbb", options) + }; + assert!(f(options_not_require_literal_leading_dot)); + assert!(!f(options_require_literal_leading_dot)); let f = |options| Pattern::new("**/*").unwrap().matches_with(".bbb", options); - assert!(f(&options_not_require_literal_leading_dot)); - assert!(!f(&options_require_literal_leading_dot)); + assert!(f(options_not_require_literal_leading_dot)); + assert!(!f(options_require_literal_leading_dot)); } #[test] diff -Nru cargo-0.35.0/vendor/glob/tests/glob-std.rs cargo-0.37.0/vendor/glob/tests/glob-std.rs --- cargo-0.35.0/vendor/glob/tests/glob-std.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/glob/tests/glob-std.rs 2019-07-17 05:42:23.000000000 +0000 @@ -17,8 +17,8 @@ use glob::glob; use std::env; -use std::path::PathBuf; use std::fs; +use std::path::PathBuf; use tempdir::TempDir; #[test] @@ -79,63 +79,91 @@ mk_file("r/three/c.md", false); // all recursive entities - assert_eq!(glob_vec("r/**"), vec!( - PathBuf::from("r/another"), - PathBuf::from("r/one"), - PathBuf::from("r/one/another"), - PathBuf::from("r/one/another/deep"), - PathBuf::from("r/three"), - PathBuf::from("r/two"))); + assert_eq!( + glob_vec("r/**"), + vec!( + PathBuf::from("r/another"), + PathBuf::from("r/one"), + PathBuf::from("r/one/another"), + PathBuf::from("r/one/another/deep"), + PathBuf::from("r/three"), + PathBuf::from("r/two") + ) + ); // collapse consecutive recursive patterns - assert_eq!(glob_vec("r/**/**"), vec!( - PathBuf::from("r/another"), - PathBuf::from("r/one"), - PathBuf::from("r/one/another"), - PathBuf::from("r/one/another/deep"), - PathBuf::from("r/three"), - PathBuf::from("r/two"))); - - assert_eq!(glob_vec("r/**/*"), vec!( - PathBuf::from("r/another"), - PathBuf::from("r/another/a.md"), - PathBuf::from("r/current_dir.md"), - PathBuf::from("r/one"), - PathBuf::from("r/one/a.md"), - PathBuf::from("r/one/another"), - PathBuf::from("r/one/another/a.md"), - PathBuf::from("r/one/another/deep"), - PathBuf::from("r/one/another/deep/spelunking.md"), - PathBuf::from("r/three"), - PathBuf::from("r/three/c.md"), - PathBuf::from("r/two"), - PathBuf::from("r/two/b.md"))); + assert_eq!( + glob_vec("r/**/**"), + vec!( + PathBuf::from("r/another"), + PathBuf::from("r/one"), + PathBuf::from("r/one/another"), + PathBuf::from("r/one/another/deep"), + PathBuf::from("r/three"), + PathBuf::from("r/two") + ) + ); + + assert_eq!( + glob_vec("r/**/*"), + vec!( + PathBuf::from("r/another"), + PathBuf::from("r/another/a.md"), + PathBuf::from("r/current_dir.md"), + PathBuf::from("r/one"), + PathBuf::from("r/one/a.md"), + PathBuf::from("r/one/another"), + PathBuf::from("r/one/another/a.md"), + PathBuf::from("r/one/another/deep"), + PathBuf::from("r/one/another/deep/spelunking.md"), + PathBuf::from("r/three"), + PathBuf::from("r/three/c.md"), + PathBuf::from("r/two"), + PathBuf::from("r/two/b.md") + ) + ); // followed by a wildcard - assert_eq!(glob_vec("r/**/*.md"), vec!( - PathBuf::from("r/another/a.md"), - PathBuf::from("r/current_dir.md"), - PathBuf::from("r/one/a.md"), - PathBuf::from("r/one/another/a.md"), - PathBuf::from("r/one/another/deep/spelunking.md"), - PathBuf::from("r/three/c.md"), - PathBuf::from("r/two/b.md"))); + assert_eq!( + glob_vec("r/**/*.md"), + vec!( + PathBuf::from("r/another/a.md"), + PathBuf::from("r/current_dir.md"), + PathBuf::from("r/one/a.md"), + PathBuf::from("r/one/another/a.md"), + PathBuf::from("r/one/another/deep/spelunking.md"), + PathBuf::from("r/three/c.md"), + PathBuf::from("r/two/b.md") + ) + ); // followed by a precise pattern - assert_eq!(glob_vec("r/one/**/a.md"), vec!( - PathBuf::from("r/one/a.md"), - PathBuf::from("r/one/another/a.md"))); + assert_eq!( + glob_vec("r/one/**/a.md"), + vec!( + PathBuf::from("r/one/a.md"), + PathBuf::from("r/one/another/a.md") + ) + ); // followed by another recursive pattern // collapses consecutive recursives into one - assert_eq!(glob_vec("r/one/**/**/a.md"), vec!( - PathBuf::from("r/one/a.md"), - PathBuf::from("r/one/another/a.md"))); + assert_eq!( + glob_vec("r/one/**/**/a.md"), + vec!( + PathBuf::from("r/one/a.md"), + PathBuf::from("r/one/another/a.md") + ) + ); // followed by two precise patterns - assert_eq!(glob_vec("r/**/another/a.md"), vec!( - PathBuf::from("r/another/a.md"), - PathBuf::from("r/one/another/a.md"))); + assert_eq!( + glob_vec("r/**/another/a.md"), + vec!( + PathBuf::from("r/another/a.md"), + PathBuf::from("r/one/another/a.md") + ) + ); assert_eq!(glob_vec(""), Vec::::new()); assert_eq!(glob_vec("."), vec!(PathBuf::from("."))); @@ -155,20 +183,32 @@ assert_eq!(glob_vec("aaa\\apple"), vec!(PathBuf::from("aaa/apple"))); } - assert_eq!(glob_vec("???/"), vec!( - PathBuf::from("aaa"), - PathBuf::from("bbb"), - PathBuf::from("ccc"), - PathBuf::from("xyz"))); - - assert_eq!(glob_vec("aaa/tomato/tom?to.txt"), vec!( - PathBuf::from("aaa/tomato/tomato.txt"), - PathBuf::from("aaa/tomato/tomoto.txt"))); - - assert_eq!(glob_vec("xyz/?"), vec!( - PathBuf::from("xyz/x"), - PathBuf::from("xyz/y"), - PathBuf::from("xyz/z"))); + assert_eq!( + glob_vec("???/"), + vec!( + PathBuf::from("aaa"), + PathBuf::from("bbb"), + PathBuf::from("ccc"), + PathBuf::from("xyz") + ) + ); + + assert_eq!( + glob_vec("aaa/tomato/tom?to.txt"), + vec!( + PathBuf::from("aaa/tomato/tomato.txt"), + PathBuf::from("aaa/tomato/tomoto.txt") + ) + ); + + assert_eq!( + glob_vec("xyz/?"), + vec!( + PathBuf::from("xyz/x"), + PathBuf::from("xyz/y"), + PathBuf::from("xyz/z") + ) + ); assert_eq!(glob_vec("a*"), vec!(PathBuf::from("aaa"))); assert_eq!(glob_vec("*a*"), vec!(PathBuf::from("aaa"))); @@ -179,23 +219,39 @@ assert_eq!(glob_vec("*a*a*a*"), vec!(PathBuf::from("aaa"))); assert_eq!(glob_vec("aaa*/"), vec!(PathBuf::from("aaa"))); - assert_eq!(glob_vec("aaa/*"), vec!( - PathBuf::from("aaa/apple"), - PathBuf::from("aaa/orange"), - PathBuf::from("aaa/tomato"))); - - assert_eq!(glob_vec("aaa/*a*"), vec!( - PathBuf::from("aaa/apple"), - PathBuf::from("aaa/orange"), - PathBuf::from("aaa/tomato"))); - - assert_eq!(glob_vec("*/*/*.txt"), vec!( - PathBuf::from("aaa/tomato/tomato.txt"), - PathBuf::from("aaa/tomato/tomoto.txt"))); - - assert_eq!(glob_vec("*/*/t[aob]m?to[.]t[!y]t"), vec!( - PathBuf::from("aaa/tomato/tomato.txt"), - PathBuf::from("aaa/tomato/tomoto.txt"))); + assert_eq!( + glob_vec("aaa/*"), + vec!( + PathBuf::from("aaa/apple"), + PathBuf::from("aaa/orange"), + PathBuf::from("aaa/tomato") + ) + ); + + assert_eq!( + glob_vec("aaa/*a*"), + vec!( + PathBuf::from("aaa/apple"), + PathBuf::from("aaa/orange"), + PathBuf::from("aaa/tomato") + ) + ); + + assert_eq!( + glob_vec("*/*/*.txt"), + vec!( + PathBuf::from("aaa/tomato/tomato.txt"), + PathBuf::from("aaa/tomato/tomoto.txt") + ) + ); + + assert_eq!( + glob_vec("*/*/t[aob]m?to[.]t[!y]t"), + vec!( + PathBuf::from("aaa/tomato/tomato.txt"), + PathBuf::from("aaa/tomato/tomoto.txt") + ) + ); assert_eq!(glob_vec("./aaa"), vec!(PathBuf::from("aaa"))); assert_eq!(glob_vec("./*"), glob_vec("*")); @@ -219,60 +275,103 @@ assert_eq!(glob_vec("aa[!a]"), Vec::::new()); assert_eq!(glob_vec("aa[!abc]"), Vec::::new()); - assert_eq!(glob_vec("bbb/specials/[[]"), vec!(PathBuf::from("bbb/specials/["))); - assert_eq!(glob_vec("bbb/specials/!"), vec!(PathBuf::from("bbb/specials/!"))); - assert_eq!(glob_vec("bbb/specials/[]]"), vec!(PathBuf::from("bbb/specials/]"))); + assert_eq!( + glob_vec("bbb/specials/[[]"), + vec!(PathBuf::from("bbb/specials/[")) + ); + assert_eq!( + glob_vec("bbb/specials/!"), + vec!(PathBuf::from("bbb/specials/!")) + ); + assert_eq!( + glob_vec("bbb/specials/[]]"), + vec!(PathBuf::from("bbb/specials/]")) + ); if env::consts::FAMILY != "windows" { - assert_eq!(glob_vec("bbb/specials/[*]"), vec!(PathBuf::from("bbb/specials/*"))); - assert_eq!(glob_vec("bbb/specials/[?]"), vec!(PathBuf::from("bbb/specials/?"))); + assert_eq!( + glob_vec("bbb/specials/[*]"), + vec!(PathBuf::from("bbb/specials/*")) + ); + assert_eq!( + glob_vec("bbb/specials/[?]"), + vec!(PathBuf::from("bbb/specials/?")) + ); } if env::consts::FAMILY == "windows" { - - assert_eq!(glob_vec("bbb/specials/[![]"), vec!( - PathBuf::from("bbb/specials/!"), - PathBuf::from("bbb/specials/]"))); - - assert_eq!(glob_vec("bbb/specials/[!]]"), vec!( - PathBuf::from("bbb/specials/!"), - PathBuf::from("bbb/specials/["))); - - assert_eq!(glob_vec("bbb/specials/[!!]"), vec!( - PathBuf::from("bbb/specials/["), - PathBuf::from("bbb/specials/]"))); - + assert_eq!( + glob_vec("bbb/specials/[![]"), + vec!( + PathBuf::from("bbb/specials/!"), + PathBuf::from("bbb/specials/]") + ) + ); + + assert_eq!( + glob_vec("bbb/specials/[!]]"), + vec!( + PathBuf::from("bbb/specials/!"), + PathBuf::from("bbb/specials/[") + ) + ); + + assert_eq!( + glob_vec("bbb/specials/[!!]"), + vec!( + PathBuf::from("bbb/specials/["), + PathBuf::from("bbb/specials/]") + ) + ); } else { - - assert_eq!(glob_vec("bbb/specials/[![]"), vec!( - PathBuf::from("bbb/specials/!"), - PathBuf::from("bbb/specials/*"), - PathBuf::from("bbb/specials/?"), - PathBuf::from("bbb/specials/]"))); - - assert_eq!(glob_vec("bbb/specials/[!]]"), vec!( - PathBuf::from("bbb/specials/!"), - PathBuf::from("bbb/specials/*"), - PathBuf::from("bbb/specials/?"), - PathBuf::from("bbb/specials/["))); - - assert_eq!(glob_vec("bbb/specials/[!!]"), vec!( - PathBuf::from("bbb/specials/*"), - PathBuf::from("bbb/specials/?"), - PathBuf::from("bbb/specials/["), - PathBuf::from("bbb/specials/]"))); - - assert_eq!(glob_vec("bbb/specials/[!*]"), vec!( - PathBuf::from("bbb/specials/!"), - PathBuf::from("bbb/specials/?"), - PathBuf::from("bbb/specials/["), - PathBuf::from("bbb/specials/]"))); - - assert_eq!(glob_vec("bbb/specials/[!?]"), vec!( - PathBuf::from("bbb/specials/!"), - PathBuf::from("bbb/specials/*"), - PathBuf::from("bbb/specials/["), - PathBuf::from("bbb/specials/]"))); - + assert_eq!( + glob_vec("bbb/specials/[![]"), + vec!( + PathBuf::from("bbb/specials/!"), + PathBuf::from("bbb/specials/*"), + PathBuf::from("bbb/specials/?"), + PathBuf::from("bbb/specials/]") + ) + ); + + assert_eq!( + glob_vec("bbb/specials/[!]]"), + vec!( + PathBuf::from("bbb/specials/!"), + PathBuf::from("bbb/specials/*"), + PathBuf::from("bbb/specials/?"), + PathBuf::from("bbb/specials/[") + ) + ); + + assert_eq!( + glob_vec("bbb/specials/[!!]"), + vec!( + PathBuf::from("bbb/specials/*"), + PathBuf::from("bbb/specials/?"), + PathBuf::from("bbb/specials/["), + PathBuf::from("bbb/specials/]") + ) + ); + + assert_eq!( + glob_vec("bbb/specials/[!*]"), + vec!( + PathBuf::from("bbb/specials/!"), + PathBuf::from("bbb/specials/?"), + PathBuf::from("bbb/specials/["), + PathBuf::from("bbb/specials/]") + ) + ); + + assert_eq!( + glob_vec("bbb/specials/[!?]"), + vec!( + PathBuf::from("bbb/specials/!"), + PathBuf::from("bbb/specials/*"), + PathBuf::from("bbb/specials/["), + PathBuf::from("bbb/specials/]") + ) + ); } } diff -Nru cargo-0.35.0/vendor/globset/.cargo-checksum.json cargo-0.37.0/vendor/globset/.cargo-checksum.json --- cargo-0.35.0/vendor/globset/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/globset/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"ef4feaabe24a0a658fd9cf4a9acf6ed284f045c77df0f49020ba3245cfb7b454"} \ No newline at end of file +{"files":{},"package":"925aa2cac82d8834e2b2a4415b6f6879757fb5c0928fc445ae76461a12eed8f2"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/globset/Cargo.toml cargo-0.37.0/vendor/globset/Cargo.toml --- cargo-0.35.0/vendor/globset/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/globset/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "globset" -version = "0.4.3" +version = "0.4.4" authors = ["Andrew Gallant "] description = "Cross platform single glob and glob set matching. Glob set matching is the\nprocess of matching one or more glob patterns against a single candidate path\nsimultaneously, and returning all of the globs that matched.\n" homepage = "https://github.com/BurntSushi/ripgrep/tree/master/globset" @@ -29,7 +29,7 @@ version = "0.7.3" [dependencies.bstr] -version = "0.1.2" +version = "0.2.0" features = ["std"] default-features = false diff -Nru cargo-0.35.0/vendor/globset/src/glob.rs cargo-0.37.0/vendor/globset/src/glob.rs --- cargo-0.35.0/vendor/globset/src/glob.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/globset/src/glob.rs 2019-07-17 05:42:23.000000000 +0000 @@ -120,7 +120,7 @@ /// Tests whether the given path matches this pattern or not. pub fn is_match_candidate(&self, path: &Candidate) -> bool { - self.re.is_match(path.path.as_bytes()) + self.re.is_match(&path.path) } } @@ -145,7 +145,7 @@ /// Tests whether the given path matches this pattern or not. fn is_match_candidate(&self, candidate: &Candidate) -> bool { - let byte_path = candidate.path.as_bytes(); + let byte_path = &*candidate.path; match self.strategy { MatchStrategy::Literal(ref lit) => lit.as_bytes() == byte_path, diff -Nru cargo-0.35.0/vendor/globset/src/lib.rs cargo-0.37.0/vendor/globset/src/lib.rs --- cargo-0.35.0/vendor/globset/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/globset/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -119,7 +119,7 @@ use std::str; use aho_corasick::AhoCorasick; -use bstr::{B, BStr, BString}; +use bstr::{B, ByteSlice, ByteVec}; use regex::bytes::{Regex, RegexBuilder, RegexSet}; use pathutil::{file_name, file_name_ext, normalize_path}; @@ -490,15 +490,15 @@ /// path against multiple globs or sets of globs. #[derive(Clone, Debug)] pub struct Candidate<'a> { - path: Cow<'a, BStr>, - basename: Cow<'a, BStr>, - ext: Cow<'a, BStr>, + path: Cow<'a, [u8]>, + basename: Cow<'a, [u8]>, + ext: Cow<'a, [u8]>, } impl<'a> Candidate<'a> { /// Create a new candidate for matching from the given path. pub fn new + ?Sized>(path: &'a P) -> Candidate<'a> { - let path = normalize_path(BString::from_path_lossy(path.as_ref())); + let path = normalize_path(Vec::from_path_lossy(path.as_ref())); let basename = file_name(&path).unwrap_or(Cow::Borrowed(B(""))); let ext = file_name_ext(&basename).unwrap_or(Cow::Borrowed(B(""))); Candidate { @@ -508,7 +508,7 @@ } } - fn path_prefix(&self, max: usize) -> &BStr { + fn path_prefix(&self, max: usize) -> &[u8] { if self.path.len() <= max { &*self.path } else { @@ -516,7 +516,7 @@ } } - fn path_suffix(&self, max: usize) -> &BStr { + fn path_suffix(&self, max: usize) -> &[u8] { if self.path.len() <= max { &*self.path } else { diff -Nru cargo-0.35.0/vendor/globset/src/pathutil.rs cargo-0.37.0/vendor/globset/src/pathutil.rs --- cargo-0.35.0/vendor/globset/src/pathutil.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/globset/src/pathutil.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,15 +1,15 @@ use std::borrow::Cow; -use bstr::BStr; +use bstr::{ByteSlice, ByteVec}; /// The final component of the path, if it is a normal file. /// /// If the path terminates in ., .., or consists solely of a root of prefix, /// file_name will return None. -pub fn file_name<'a>(path: &Cow<'a, BStr>) -> Option> { +pub fn file_name<'a>(path: &Cow<'a, [u8]>) -> Option> { if path.is_empty() { return None; - } else if path.last() == Some(b'.') { + } else if path.last_byte() == Some(b'.') { return None; } let last_slash = path.rfind_byte(b'/').map(|i| i + 1).unwrap_or(0); @@ -39,7 +39,7 @@ /// a pattern like `*.rs` is obviously trying to match files with a `rs` /// extension, but it also matches files like `.rs`, which doesn't have an /// extension according to std::path::Path::extension. -pub fn file_name_ext<'a>(name: &Cow<'a, BStr>) -> Option> { +pub fn file_name_ext<'a>(name: &Cow<'a, [u8]>) -> Option> { if name.is_empty() { return None; } @@ -60,7 +60,7 @@ /// Normalizes a path to use `/` as a separator everywhere, even on platforms /// that recognize other characters as separators. #[cfg(unix)] -pub fn normalize_path(path: Cow) -> Cow { +pub fn normalize_path(path: Cow<[u8]>) -> Cow<[u8]> { // UNIX only uses /, so we're good. path } @@ -68,7 +68,7 @@ /// Normalizes a path to use `/` as a separator everywhere, even on platforms /// that recognize other characters as separators. #[cfg(not(unix))] -pub fn normalize_path(mut path: Cow) -> Cow { +pub fn normalize_path(mut path: Cow<[u8]>) -> Cow<[u8]> { use std::path::is_separator; for i in 0..path.len() { @@ -84,7 +84,7 @@ mod tests { use std::borrow::Cow; - use bstr::{B, BString}; + use bstr::{B, ByteVec}; use super::{file_name_ext, normalize_path}; @@ -92,7 +92,7 @@ ($name:ident, $file_name:expr, $ext:expr) => { #[test] fn $name() { - let bs = BString::from($file_name); + let bs = Vec::from($file_name); let got = file_name_ext(&Cow::Owned(bs)); assert_eq!($ext.map(|s| Cow::Borrowed(B(s))), got); } @@ -109,7 +109,7 @@ ($name:ident, $path:expr, $expected:expr) => { #[test] fn $name() { - let bs = BString::from_slice($path); + let bs = Vec::from_slice($path); let got = normalize_path(Cow::Owned(bs)); assert_eq!($expected.to_vec(), got.into_owned()); } diff -Nru cargo-0.35.0/vendor/jobserver/.cargo-checksum.json cargo-0.37.0/vendor/jobserver/.cargo-checksum.json --- cargo-0.35.0/vendor/jobserver/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/jobserver/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"b3d51e24009d966c8285d524dbaf6d60926636b2a89caee9ce0bd612494ddc16"} \ No newline at end of file +{"files":{},"package":"680de885fb4b562691e35943978a85fa6401197014a4bf545d92510073fa41df"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/jobserver/Cargo.toml cargo-0.37.0/vendor/jobserver/Cargo.toml --- cargo-0.35.0/vendor/jobserver/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/jobserver/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,7 +12,7 @@ [package] name = "jobserver" -version = "0.1.13" +version = "0.1.14" authors = ["Alex Crichton "] description = "An implementation of the GNU make jobserver for Rust\n" homepage = "https://github.com/alexcrichton/jobserver-rs" @@ -43,7 +43,7 @@ name = "helper" path = "tests/helper.rs" [dependencies.log] -version = "0.4" +version = "0.4.6" [dev-dependencies.futures] version = "0.1" @@ -59,6 +59,6 @@ [dev-dependencies.tokio-process] version = "0.2" [target."cfg(unix)".dependencies.libc] -version = "0.2" +version = "0.2.50" [target."cfg(windows)".dependencies.rand] -version = "0.6" +version = "< 0.7, >= 0.4" diff -Nru cargo-0.35.0/vendor/jobserver/debian/patches/relax-dep-version.patch cargo-0.37.0/vendor/jobserver/debian/patches/relax-dep-version.patch --- cargo-0.35.0/vendor/jobserver/debian/patches/relax-dep-version.patch 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/jobserver/debian/patches/relax-dep-version.patch 2019-07-17 05:42:23.000000000 +0000 @@ -1,8 +1,8 @@ ---- a/Cargo.toml 2018-08-03 01:58:48.002962262 -0700 -+++ b/Cargo.toml 2018-08-03 01:58:54.275006248 -0700 +--- a/Cargo.toml ++++ b/Cargo.toml @@ -61,4 +61,4 @@ [target."cfg(unix)".dependencies.libc] - version = "0.2" + version = "0.2.50" [target."cfg(windows)".dependencies.rand] --version = "0.4" -+version = "< 0.6, >= 0.4" +-version = "0.6.5" ++version = "< 0.7, >= 0.4" diff -Nru cargo-0.35.0/vendor/jobserver/debian/patches/series cargo-0.37.0/vendor/jobserver/debian/patches/series --- cargo-0.35.0/vendor/jobserver/debian/patches/series 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/jobserver/debian/patches/series 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +relax-dep-version.patch diff -Nru cargo-0.35.0/vendor/jobserver/.pc/applied-patches cargo-0.37.0/vendor/jobserver/.pc/applied-patches --- cargo-0.35.0/vendor/jobserver/.pc/applied-patches 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/jobserver/.pc/applied-patches 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +relax-dep-version.patch diff -Nru cargo-0.35.0/vendor/jobserver/.pc/relax-dep-version.patch/Cargo.toml cargo-0.37.0/vendor/jobserver/.pc/relax-dep-version.patch/Cargo.toml --- cargo-0.35.0/vendor/jobserver/.pc/relax-dep-version.patch/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/jobserver/.pc/relax-dep-version.patch/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,64 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# 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 = "jobserver" +version = "0.1.14" +authors = ["Alex Crichton "] +description = "An implementation of the GNU make jobserver for Rust\n" +homepage = "https://github.com/alexcrichton/jobserver-rs" +documentation = "https://docs.rs/jobserver" +license = "MIT/Apache-2.0" +repository = "https://github.com/alexcrichton/jobserver-rs" + +[[test]] +name = "client" +path = "tests/client.rs" +harness = false + +[[test]] +name = "server" +path = "tests/server.rs" + +[[test]] +name = "client-of-myself" +path = "tests/client-of-myself.rs" +harness = false + +[[test]] +name = "make-as-a-client" +path = "tests/make-as-a-client.rs" +harness = false + +[[test]] +name = "helper" +path = "tests/helper.rs" +[dependencies.log] +version = "0.4.6" +[dev-dependencies.futures] +version = "0.1" + +[dev-dependencies.num_cpus] +version = "1.0" + +[dev-dependencies.tempdir] +version = "0.3" + +[dev-dependencies.tokio-core] +version = "0.1" + +[dev-dependencies.tokio-process] +version = "0.2" +[target."cfg(unix)".dependencies.libc] +version = "0.2.50" +[target."cfg(windows)".dependencies.rand] +version = "0.6.5" diff -Nru cargo-0.35.0/vendor/jobserver/src/lib.rs cargo-0.37.0/vendor/jobserver/src/lib.rs --- cargo-0.35.0/vendor/jobserver/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/jobserver/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -254,6 +254,8 @@ /// On Unix and Windows this will clobber the `CARGO_MAKEFLAGS` environment /// variables for the child process, and on Unix this will also allow the /// two file descriptors for this client to be inherited to the child. + /// + /// On platforms other than Unix and Windows this panics. pub fn configure(&self, cmd: &mut Command) { let arg = self.inner.string_arg(); // Older implementations of make use `--jobserver-fds` and newer @@ -662,7 +664,7 @@ // return an error, but on other platforms it may not. In // that sense we don't actually know if this will succeed or // not! - libc::pthread_kill(self.thread.as_pthread_t(), libc::SIGUSR1); + libc::pthread_kill(self.thread.as_pthread_t() as _, libc::SIGUSR1); match self.rx_done.recv_timeout(dur) { Ok(()) | Err(RecvTimeoutError::Disconnected) => { @@ -961,3 +963,94 @@ } } } + +#[cfg(not(any(unix, windows)))] +mod imp { + use std::io; + use std::sync::Mutex; + use std::sync::mpsc::{self, SyncSender, Receiver}; + use std::thread::{Builder, JoinHandle}; + use std::process::Command; + + #[derive(Debug)] + pub struct Client { + tx: SyncSender<()>, + rx: Mutex>, + } + + #[derive(Debug)] + pub struct Acquired(()); + + impl Client { + pub fn new(limit: usize) -> io::Result { + let (tx, rx) = mpsc::sync_channel(limit); + for _ in 0..limit { + tx.send(()).unwrap(); + } + Ok(Client { + tx, + rx: Mutex::new(rx), + }) + } + + pub unsafe fn open(_s: &str) -> Option { + None + } + + pub fn acquire(&self) -> io::Result { + self.rx.lock().unwrap().recv().unwrap(); + Ok(Acquired(())) + } + + pub fn release(&self, _data: Option<&Acquired>) -> io::Result<()> { + self.tx.send(()).unwrap(); + Ok(()) + } + + pub fn string_arg(&self) -> String { + panic!( + "On this platform there is no cross process jobserver support, + so Client::configure is not supported." + ); + } + + pub fn configure(&self, _cmd: &mut Command) { + unreachable!(); + } + } + + #[derive(Debug)] + pub struct Helper { + thread: JoinHandle<()>, + } + + pub fn spawn_helper(client: ::Client, + rx: Receiver<()>, + mut f: Box) + Send>) + -> io::Result + { + let thread = Builder::new().spawn(move || { + for () in rx { + let res = client.acquire(); + f(res); + } + })?; + + Ok(Helper { + thread: thread, + }) + } + + impl Helper { + pub fn join(self) { + drop(self.thread.join()); + } + } +} + +#[test] +fn no_helper_deadlock() { + let x = crate::Client::new(32).unwrap(); + let _y = x.clone(); + std::mem::drop(x.into_helper_thread(|_| {}).unwrap()); +} diff -Nru cargo-0.35.0/vendor/kernel32-sys/build.rs cargo-0.37.0/vendor/kernel32-sys/build.rs --- cargo-0.35.0/vendor/kernel32-sys/build.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/kernel32-sys/build.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -extern crate build; -fn main() { - build::link("kernel32", false) -} diff -Nru cargo-0.35.0/vendor/kernel32-sys/.cargo-checksum.json cargo-0.37.0/vendor/kernel32-sys/.cargo-checksum.json --- cargo-0.35.0/vendor/kernel32-sys/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/kernel32-sys/.cargo-checksum.json 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"files":{},"package":"7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/kernel32-sys/Cargo.toml cargo-0.37.0/vendor/kernel32-sys/Cargo.toml --- cargo-0.35.0/vendor/kernel32-sys/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/kernel32-sys/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -[package] -name = "kernel32-sys" -version = "0.2.2" -authors = ["Peter Atashian "] -description = "Contains function definitions for the Windows API library kernel32. See winapi for types and constants." -documentation = "https://retep998.github.io/doc/kernel32/" -repository = "https://github.com/retep998/winapi-rs" -readme = "README.md" -keywords = ["windows", "ffi", "win32"] -license = "MIT" -build = "build.rs" -[lib] -name = "kernel32" -[dependencies] -winapi = { version = "0.2.5", path = "../.." } -[build-dependencies] -winapi-build = { version = "0.1.1", path = "../../build" } diff -Nru cargo-0.35.0/vendor/kernel32-sys/README.md cargo-0.37.0/vendor/kernel32-sys/README.md --- cargo-0.35.0/vendor/kernel32-sys/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/kernel32-sys/README.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -# kernel32 # -Contains function definitions for the Windows API library kernel32. See winapi for types and constants. - -```toml -[dependencies] -kernel32-sys = "0.2.1" -``` - -```rust -extern crate kernel32; -``` - -[Documentation](https://retep998.github.io/doc/kernel32/) diff -Nru cargo-0.35.0/vendor/kernel32-sys/src/lib.rs cargo-0.37.0/vendor/kernel32-sys/src/lib.rs --- cargo-0.35.0/vendor/kernel32-sys/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/kernel32-sys/src/lib.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,2754 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! FFI bindings to kernel32. -#![cfg(windows)] -extern crate winapi; -use winapi::*; -extern "system" { - pub fn AcquireSRWLockExclusive(SRWLock: PSRWLOCK); - pub fn AcquireSRWLockShared(SRWLock: PSRWLOCK); - pub fn ActivateActCtx(hActCtx: HANDLE, lpCookie: *mut ULONG_PTR) -> BOOL; - pub fn AddAtomA(lpString: LPCSTR) -> ATOM; - pub fn AddAtomW(lpString: LPCWSTR) -> ATOM; - pub fn AddConsoleAliasA(Source: LPSTR, Target: LPSTR, ExeName: LPSTR) -> BOOL; - pub fn AddConsoleAliasW(Source: LPWSTR, Target: LPWSTR, ExeName: LPWSTR) -> BOOL; - pub fn AddDllDirectory(NewDirectory: PCWSTR) -> DLL_DIRECTORY_COOKIE; - pub fn AddIntegrityLabelToBoundaryDescriptor( - BoundaryDescriptor: *mut HANDLE, IntegrityLabel: PSID, - ) -> BOOL; - // pub fn AddLocalAlternateComputerNameA(); - // pub fn AddLocalAlternateComputerNameW(); - pub fn AddRefActCtx(hActCtx: HANDLE); - pub fn AddResourceAttributeAce( - pAcl: PACL, dwAceRevision: DWORD, AceFlags: DWORD, AccessMask: DWORD, pSid: PSID, - pAttributeInfo: PCLAIM_SECURITY_ATTRIBUTES_INFORMATION, pReturnLength: PDWORD, - ) -> BOOL; - pub fn AddSIDToBoundaryDescriptor(BoundaryDescriptor: *mut HANDLE, RequiredSid: PSID) -> BOOL; - pub fn AddScopedPolicyIDAce( - pAcl: PACL, dwAceRevision: DWORD, AceFlags: DWORD, AccessMask: DWORD, pSid: PSID, - ) -> BOOL; - pub fn AddSecureMemoryCacheCallback(pfnCallBack: PSECURE_MEMORY_CACHE_CALLBACK) -> BOOL; - pub fn AddVectoredContinueHandler(First: ULONG, Handler: PVECTORED_EXCEPTION_HANDLER) -> PVOID; - pub fn AddVectoredExceptionHandler( - First: ULONG, Handler: PVECTORED_EXCEPTION_HANDLER, - ) -> PVOID; - pub fn AllocConsole() -> BOOL; - pub fn AllocateUserPhysicalPages( - hProcess: HANDLE, NumberOfPages: PULONG_PTR, PageArray: PULONG_PTR, - ) -> BOOL; - pub fn AllocateUserPhysicalPagesNuma( - hProcess: HANDLE, NumberOfPages: PULONG_PTR, PageArray: PULONG_PTR, nndPreferred: DWORD, - ) -> BOOL; - // pub fn AppXGetOSMaxVersionTested(); - pub fn ApplicationRecoveryFinished(bSuccess: BOOL); - pub fn ApplicationRecoveryInProgress(pbCancelled: PBOOL) -> HRESULT; - pub fn AreFileApisANSI() -> BOOL; - pub fn AssignProcessToJobObject(hJob: HANDLE, hProcess: HANDLE) -> BOOL; - pub fn AttachConsole(dwProcessId: DWORD) -> BOOL; - pub fn BackupRead( - hFile: HANDLE, lpBuffer: LPBYTE, nNumberOfBytesToRead: DWORD, lpNumberOfBytesRead: LPDWORD, - bAbort: BOOL, bProcessSecurity: BOOL, lpContext: *mut LPVOID, - ) -> BOOL; - pub fn BackupSeek( - hFile: HANDLE, dwLowBytesToSeek: DWORD, dwHighBytesToSeek: DWORD, - lpdwLowByteSeeked: LPDWORD, lpdwHighByteSeeked: LPDWORD, lpContext: *mut LPVOID, - ) -> BOOL; - pub fn BackupWrite( - hFile: HANDLE, lpBuffer: LPBYTE, nNumberOfBytesToWrite: DWORD, - lpNumberOfBytesWritten: LPDWORD, bAbort: BOOL, bProcessSecurity: BOOL, - lpContext: *mut LPVOID, - ) -> BOOL; - // pub fn BaseSetLastNTError(); - pub fn Beep(dwFreq: DWORD, dwDuration: DWORD) -> BOOL; - pub fn BeginUpdateResourceA(pFileName: LPCSTR, bDeleteExistingResources: BOOL) -> HANDLE; - pub fn BeginUpdateResourceW(pFileName: LPCWSTR, bDeleteExistingResources: BOOL) -> HANDLE; - pub fn BindIoCompletionCallback( - FileHandle: HANDLE, Function: LPOVERLAPPED_COMPLETION_ROUTINE, Flags: ULONG, - ) -> BOOL; - pub fn BuildCommDCBA(lpDef: LPCSTR, lpDCB: LPDCB) -> BOOL; - pub fn BuildCommDCBAndTimeoutsA( - lpDef: LPCSTR, lpDCB: LPDCB, lpCommTimeouts: LPCOMMTIMEOUTS, - ) -> BOOL; - pub fn BuildCommDCBAndTimeoutsW( - lpDef: LPCWSTR, lpDCB: LPDCB, lpCommTimeouts: LPCOMMTIMEOUTS, - ) -> BOOL; - pub fn BuildCommDCBW(lpDef: LPCWSTR, lpDCB: LPDCB) -> BOOL; - pub fn CallNamedPipeA( - lpNamedPipeName: LPCSTR, lpInBuffer: LPVOID, nInBufferSize: DWORD, lpOutBuffer: LPVOID, - nOutBufferSize: DWORD, lpBytesRead: LPDWORD, nTimeOut: DWORD, - ) -> BOOL; - pub fn CallNamedPipeW( - lpNamedPipeName: LPCWSTR, lpInBuffer: LPVOID, nInBufferSize: DWORD, lpOutBuffer: LPVOID, - nOutBufferSize: DWORD, lpBytesRead: LPDWORD, nTimeOut: DWORD, - ) -> BOOL; - pub fn CallbackMayRunLong(pci: PTP_CALLBACK_INSTANCE) -> BOOL; - pub fn CalloutOnFiberStack( - lpFiber: PVOID, lpStartAddress: PFIBER_CALLOUT_ROUTINE, lpParameter: PVOID, - ) -> PVOID; - pub fn CancelDeviceWakeupRequest(hDevice: HANDLE) -> BOOL; - pub fn CancelIo(hFile: HANDLE) -> BOOL; - pub fn CancelIoEx(hFile: HANDLE, lpOverlapped: LPOVERLAPPED) -> BOOL; - pub fn CancelSynchronousIo(hThread: HANDLE) -> BOOL; - pub fn CancelThreadpoolIo(pio: PTP_IO); - pub fn CancelTimerQueueTimer(TimerQueue: HANDLE, Timer: HANDLE) -> BOOL; - pub fn CancelWaitableTimer(hTimer: HANDLE) -> BOOL; - pub fn CeipIsOptedIn() -> BOOL; - pub fn ChangeTimerQueueTimer( - TimerQueue: HANDLE, Timer: HANDLE, DueTime: ULONG, Period: ULONG, - ) -> BOOL; - // pub fn CheckElevation(); - // pub fn CheckElevationEnabled(); - pub fn CheckNameLegalDOS8Dot3A( - lpName: LPCSTR, lpOemName: LPSTR, OemNameSize: DWORD, pbNameContainsSpaces: PBOOL, - pbNameLegal: PBOOL, - ) -> BOOL; - pub fn CheckNameLegalDOS8Dot3W( - lpName: LPCWSTR, lpOemName: LPSTR, OemNameSize: DWORD, pbNameContainsSpaces: PBOOL, - pbNameLegal: PBOOL, - ) -> BOOL; - pub fn CheckRemoteDebuggerPresent(hProcess: HANDLE, pbDebuggerPresent: PBOOL) -> BOOL; - pub fn CheckTokenCapability( - TokenHandle: HANDLE, CapabilitySidToCheck: PSID, HasCapability: PBOOL, - ) -> BOOL; - pub fn CheckTokenMembershipEx( - TokenHandle: HANDLE, SidToCheck: PSID, Flags: DWORD, IsMember: PBOOL, - ) -> BOOL; - pub fn ClearCommBreak(hFile: HANDLE) -> BOOL; - pub fn ClearCommError(hFile: HANDLE, lpErrors: LPDWORD, lpStat: LPCOMSTAT) -> BOOL; - pub fn CloseHandle(hObject: HANDLE) -> BOOL; - // pub fn ClosePackageInfo(); - pub fn ClosePrivateNamespace(Handle: HANDLE, Flags: ULONG) -> BOOLEAN; - // pub fn CloseState(); - pub fn CloseThreadpool(ptpp: PTP_POOL); - pub fn CloseThreadpoolCleanupGroup(ptpcg: PTP_CLEANUP_GROUP); - pub fn CloseThreadpoolCleanupGroupMembers( - ptpcg: PTP_CLEANUP_GROUP, fCancelPendingCallbacks: BOOL, pvCleanupContext: PVOID, - ); - pub fn CloseThreadpoolIo(pio: PTP_IO); - pub fn CloseThreadpoolTimer(pti: PTP_TIMER); - pub fn CloseThreadpoolWait(pwa: PTP_WAIT); - pub fn CloseThreadpoolWork(pwk: PTP_WORK); - pub fn CommConfigDialogA(lpszName: LPCSTR, hWnd: HWND, lpCC: LPCOMMCONFIG) -> BOOL; - pub fn CommConfigDialogW(lpszName: LPCWSTR, hWnd: HWND, lpCC: LPCOMMCONFIG) -> BOOL; - pub fn CompareFileTime(lpFileTime1: *const FILETIME, lpFileTime2: *const FILETIME) -> LONG; - pub fn CompareStringA( - Locale: LCID, dwCmpFlags: DWORD, lpString1: PCNZCH, cchCount1: c_int, lpString2: PCNZCH, - cchCount2: c_int, - ) -> c_int; - pub fn CompareStringEx( - lpLocaleName: LPCWSTR, dwCmpFlags: DWORD, lpString1: LPCWCH, cchCount1: c_int, - lpString2: LPCWCH, cchCount2: c_int, lpVersionInformation: LPNLSVERSIONINFO, - lpReserved: LPVOID, lParam: LPARAM, - ) -> c_int; - pub fn CompareStringOrdinal( - lpString1: LPCWCH, cchCount1: c_int, lpString2: LPCWCH, cchCount2: c_int, bIgnoreCase: BOOL, - ) -> c_int; - pub fn CompareStringW( - Locale: LCID, dwCmpFlags: DWORD, lpString1: PCNZWCH, cchCount1: c_int, lpString2: PCNZWCH, - cchCount2: c_int, - ) -> c_int; - pub fn ConnectNamedPipe(hNamedPipe: HANDLE, lpOverlapped: LPOVERLAPPED) -> BOOL; - pub fn ContinueDebugEvent( - dwProcessId: DWORD, dwThreadId: DWORD, dwContinueStatus: DWORD, - ) -> BOOL; - pub fn ConvertDefaultLocale(Locale: LCID) -> LCID; - pub fn ConvertFiberToThread() -> BOOL; - pub fn ConvertThreadToFiber(lpParameter: LPVOID) -> LPVOID; - pub fn ConvertThreadToFiberEx(lpParameter: LPVOID, dwFlags: DWORD) -> LPVOID; - pub fn CopyContext(Destination: PCONTEXT, ContextFlags: DWORD, Source: PCONTEXT) -> BOOL; - pub fn CopyFile2( - pwszExistingFileName: PCWSTR, pwszNewFileName: PCWSTR, - pExtendedParameters: *mut COPYFILE2_EXTENDED_PARAMETERS, - ) -> HRESULT; - pub fn CopyFileA( - lpExistingFileName: LPCSTR, lpNewFileName: LPCSTR, bFailIfExists: BOOL - ) -> BOOL; - pub fn CopyFileExA( - lpExistingFileName: LPCSTR, lpNewFileName: LPCSTR, lpProgressRoutine: LPPROGRESS_ROUTINE, - lpData: LPVOID, pbCancel: LPBOOL, dwCopyFlags: DWORD, - ) -> BOOL; - pub fn CopyFileExW( - lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, lpProgressRoutine: LPPROGRESS_ROUTINE, - lpData: LPVOID, pbCancel: LPBOOL, dwCopyFlags: DWORD, - ) -> BOOL; - pub fn CopyFileTransactedA( - lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, lpProgressRoutine: LPPROGRESS_ROUTINE, - lpData: LPVOID, pbCancel: LPBOOL, dwCopyFlags: DWORD, hTransaction: HANDLE, - ) -> BOOL; - pub fn CopyFileTransactedW( - lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, lpProgressRoutine: LPPROGRESS_ROUTINE, - lpData: LPVOID, pbCancel: LPBOOL, dwCopyFlags: DWORD, hTransaction: HANDLE, - ) -> BOOL; - pub fn CopyFileW( - lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, bFailIfExists: BOOL - ) -> BOOL; - pub fn CreateActCtxA(pActCtx: PCACTCTXA) -> HANDLE; - pub fn CreateActCtxW(pActCtx: PCACTCTXW) -> HANDLE; - pub fn CreateBoundaryDescriptorA(Name: LPCSTR, Flags: ULONG) -> HANDLE; - pub fn CreateBoundaryDescriptorW(Name: LPCWSTR, Flags: ULONG) -> HANDLE; - pub fn CreateConsoleScreenBuffer( - dwDesiredAccess: DWORD, dwShareMode: DWORD, - lpSecurityAttributes: *const SECURITY_ATTRIBUTES, dwFlags: DWORD, - lpScreenBufferData: LPVOID, - ) -> HANDLE; - pub fn CreateDirectoryA( - lpPathName: LPCSTR, lpSecurityAttributes: LPSECURITY_ATTRIBUTES, - ) -> BOOL; - pub fn CreateDirectoryExA( - lpTemplateDirectory: LPCSTR, lpNewDirectory: LPCSTR, - lpSecurityAttributes: LPSECURITY_ATTRIBUTES, - ) -> BOOL; - pub fn CreateDirectoryExW( - lpTemplateDirectory: LPCWSTR, lpNewDirectory: LPCWSTR, - lpSecurityAttributes: LPSECURITY_ATTRIBUTES, - ) -> BOOL; - pub fn CreateDirectoryTransactedA( - lpTemplateDirectory: LPCSTR, lpNewDirectory: LPCSTR, - lpSecurityAttributes: LPSECURITY_ATTRIBUTES, hTransaction: HANDLE, - ) -> BOOL; - pub fn CreateDirectoryTransactedW( - lpTemplateDirectory: LPCWSTR, lpNewDirectory: LPCWSTR, - lpSecurityAttributes: LPSECURITY_ATTRIBUTES, hTransaction: HANDLE, - ) -> BOOL; - pub fn CreateDirectoryW( - lpPathName: LPCWSTR, lpSecurityAttributes: LPSECURITY_ATTRIBUTES, - ) -> BOOL; - pub fn CreateEventA( - lpEventAttributes: LPSECURITY_ATTRIBUTES, bManualReset: BOOL, bInitialState: BOOL, - lpName: LPCSTR, - ) -> HANDLE; - pub fn CreateEventW( - lpEventAttributes: LPSECURITY_ATTRIBUTES, bManualReset: BOOL, bInitialState: BOOL, - lpName: LPCWSTR, - ) -> HANDLE; - pub fn CreateEventExA( - lpEventAttributes: LPSECURITY_ATTRIBUTES, lpName: LPCSTR, dwFlags: DWORD, - dwDesiredAccess: DWORD, - ) -> HANDLE; - pub fn CreateEventExW( - lpEventAttributes: LPSECURITY_ATTRIBUTES, lpName: LPCWSTR, dwFlags: DWORD, - dwDesiredAccess: DWORD, - ) -> HANDLE; - pub fn CreateFiber( - dwStackSize: SIZE_T, lpStartAddress: LPFIBER_START_ROUTINE, lpParameter: LPVOID, - ) -> LPVOID; - pub fn CreateFiberEx( - dwStackCommitSize: SIZE_T, dwStackReserveSize: SIZE_T, dwFlags: DWORD, - lpStartAddress: LPFIBER_START_ROUTINE, lpParameter: LPVOID, - ) -> LPVOID; - pub fn CreateFile2( - lpFileName: LPCWSTR, dwDesiredAccess: DWORD, dwShareMode: DWORD, - dwCreationDisposition: DWORD, pCreateExParams: LPCREATEFILE2_EXTENDED_PARAMETERS, - ) -> HANDLE; - pub fn CreateFileA( - lpFileName: LPCSTR, dwDesiredAccess: DWORD, dwShareMode: DWORD, - lpSecurityAttributes: LPSECURITY_ATTRIBUTES, dwCreationDisposition: DWORD, - dwFlagsAndAttributes: DWORD, hTemplateFile: HANDLE, - ) -> HANDLE; - pub fn CreateFileMappingA( - hFile: HANDLE, lpAttributes: LPSECURITY_ATTRIBUTES, flProtect: DWORD, - dwMaximumSizeHigh: DWORD, dwMaximumSizeLow: DWORD, lpName: LPCSTR, - ) -> HANDLE; - pub fn CreateFileMappingFromApp( - hFile: HANDLE, SecurityAttributes: PSECURITY_ATTRIBUTES, PageProtection: ULONG, - MaximumSize: ULONG64, Name: PCWSTR, - ) -> HANDLE; - pub fn CreateFileMappingNumaA( - hFile: HANDLE, lpFileMappingAttributes: LPSECURITY_ATTRIBUTES, flProtect: DWORD, - dwMaximumSizeHigh: DWORD, dwMaximumSizeLow: DWORD, lpName: LPCSTR, nndPreferred: DWORD, - ) -> HANDLE; - pub fn CreateFileMappingNumaW( - hFile: HANDLE, lpFileMappingAttributes: LPSECURITY_ATTRIBUTES, flProtect: DWORD, - dwMaximumSizeHigh: DWORD, dwMaximumSizeLow: DWORD, lpName: LPCWSTR, nndPreferred: DWORD, - ) -> HANDLE; - pub fn CreateFileMappingW( - hFile: HANDLE, lpAttributes: LPSECURITY_ATTRIBUTES, flProtect: DWORD, - dwMaximumSizeHigh: DWORD, dwMaximumSizeLow: DWORD, lpName: LPCWSTR, - ) -> HANDLE; - pub fn CreateFileTransactedA( - lpFileName: LPCSTR, dwDesiredAccess: DWORD, dwShareMode: DWORD, - lpSecurityAttributes: LPSECURITY_ATTRIBUTES, dwCreationDisposition: DWORD, - dwFlagsAndAttributes: DWORD, hTemplateFile: HANDLE, hTransaction: HANDLE, - pusMiniVersion: PUSHORT, lpExtendedParameter: PVOID, - ) -> HANDLE; - pub fn CreateFileTransactedW( - lpFileName: LPCWSTR, dwDesiredAccess: DWORD, dwShareMode: DWORD, - lpSecurityAttributes: LPSECURITY_ATTRIBUTES, dwCreationDisposition: DWORD, - dwFlagsAndAttributes: DWORD, hTemplateFile: HANDLE, hTransaction: HANDLE, - pusMiniVersion: PUSHORT, lpExtendedParameter: PVOID, - ) -> HANDLE; - pub fn CreateFileW( - lpFileName: LPCWSTR, dwDesiredAccess: DWORD, dwShareMode: DWORD, - lpSecurityAttributes: LPSECURITY_ATTRIBUTES, dwCreationDisposition: DWORD, - dwFlagsAndAttributes: DWORD, hTemplateFile: HANDLE, - ) -> HANDLE; - pub fn CreateHardLinkA( - lpFileName: LPCSTR, lpExistingFileName: LPCSTR, lpSecurityAttributes: LPSECURITY_ATTRIBUTES, - ) -> BOOL; - pub fn CreateHardLinkTransactedA( - lpFileName: LPCSTR, lpExistingFileName: LPCSTR, lpSecurityAttributes: LPSECURITY_ATTRIBUTES, - hTransaction: HANDLE, - ) -> BOOL; - pub fn CreateHardLinkTransactedW( - lpFileName: LPCWSTR, lpExistingFileName: LPCWSTR, - lpSecurityAttributes: LPSECURITY_ATTRIBUTES, hTransaction: HANDLE, - ); - pub fn CreateHardLinkW( - lpFileName: LPCWSTR, lpExistingFileName: LPCWSTR, - lpSecurityAttributes: LPSECURITY_ATTRIBUTES, - ) -> BOOL; - pub fn CreateIoCompletionPort( - FileHandle: HANDLE, ExistingCompletionPort: HANDLE, CompletionKey: ULONG_PTR, - NumberOfConcurrentThreads: DWORD, - ) -> HANDLE; - pub fn CreateJobObjectA(lpJobAttributes: LPSECURITY_ATTRIBUTES, lpName: LPCSTR) -> HANDLE; - pub fn CreateJobObjectW(lpJobAttributes: LPSECURITY_ATTRIBUTES, lpName: LPCWSTR) -> HANDLE; - pub fn CreateJobSet(NumJob: ULONG, UserJobSet: PJOB_SET_ARRAY, Flags: ULONG) -> BOOL; - pub fn CreateMailslotA( - lpName: LPCSTR, nMaxMessageSize: DWORD, lReadTimeout: DWORD, - lpSecurityAttributes: LPSECURITY_ATTRIBUTES, - ) -> HANDLE; - pub fn CreateMailslotW( - lpName: LPCWSTR, nMaxMessageSize: DWORD, lReadTimeout: DWORD, - lpSecurityAttributes: LPSECURITY_ATTRIBUTES, - ) -> HANDLE; - pub fn CreateMemoryResourceNotification( - NotificationType: MEMORY_RESOURCE_NOTIFICATION_TYPE, - ) -> HANDLE; - pub fn CreateMutexA( - lpMutexAttributes: LPSECURITY_ATTRIBUTES, bInitialOwner: BOOL, lpName: LPCSTR, - ) -> HANDLE; - pub fn CreateMutexExA( - lpMutexAttributes: LPSECURITY_ATTRIBUTES, lpName: LPCSTR, dwFlags: DWORD, - dwDesiredAccess: DWORD, - ) -> HANDLE; - pub fn CreateMutexExW( - lpMutexAttributes: LPSECURITY_ATTRIBUTES, lpName: LPCWSTR, dwFlags: DWORD, - dwDesiredAccess: DWORD, - ) -> HANDLE; - pub fn CreateMutexW( - lpMutexAttributes: LPSECURITY_ATTRIBUTES, bInitialOwner: BOOL, lpName: LPCWSTR, - ) -> HANDLE; - pub fn CreateNamedPipeA( - lpName: LPCSTR, dwOpenMode: DWORD, dwPipeMode: DWORD, nMaxInstances: DWORD, - nOutBufferSize: DWORD, nInBufferSize: DWORD, nDefaultTimeOut: DWORD, - lpSecurityAttributes: LPSECURITY_ATTRIBUTES, - ) -> HANDLE; - pub fn CreateNamedPipeW( - lpName: LPCWSTR, dwOpenMode: DWORD, dwPipeMode: DWORD, nMaxInstances: DWORD, - nOutBufferSize: DWORD, nInBufferSize: DWORD, nDefaultTimeOut: DWORD, - lpSecurityAttributes: LPSECURITY_ATTRIBUTES, - ) -> HANDLE; - pub fn CreatePipe( - hReadPipe: PHANDLE, hWritePipe: PHANDLE, lpPipeAttributes: LPSECURITY_ATTRIBUTES, - nSize: DWORD, - ) -> BOOL; - pub fn CreatePrivateNamespaceA( - lpPrivateNamespaceAttributes: LPSECURITY_ATTRIBUTES, lpBoundaryDescriptor: LPVOID, - lpAliasPrefix: LPCSTR, - ) -> HANDLE; - pub fn CreatePrivateNamespaceW( - lpPrivateNamespaceAttributes: LPSECURITY_ATTRIBUTES, lpBoundaryDescriptor: LPVOID, - lpAliasPrefix: LPCWSTR, - ) -> HANDLE; - pub fn CreateProcessA( - lpApplicationName: LPCSTR, lpCommandLine: LPSTR, lpProcessAttributes: LPSECURITY_ATTRIBUTES, - lpThreadAttributes: LPSECURITY_ATTRIBUTES, bInheritHandles: BOOL, dwCreationFlags: DWORD, - lpEnvironment: LPVOID, lpCurrentDirectory: LPCSTR, lpStartupInfo: LPSTARTUPINFOA, - lpProcessInformation: LPPROCESS_INFORMATION, - ) -> BOOL; - pub fn CreateProcessW( - lpApplicationName: LPCWSTR, lpCommandLine: LPWSTR, - lpProcessAttributes: LPSECURITY_ATTRIBUTES, lpThreadAttributes: LPSECURITY_ATTRIBUTES, - bInheritHandles: BOOL, dwCreationFlags: DWORD, lpEnvironment: LPVOID, - lpCurrentDirectory: LPCWSTR, lpStartupInfo: LPSTARTUPINFOW, - lpProcessInformation: LPPROCESS_INFORMATION, - ) -> BOOL; - pub fn CreateRemoteThread( - hProcess: HANDLE, lpThreadAttributes: LPSECURITY_ATTRIBUTES, dwStackSize: SIZE_T, - lpStartAddress: LPTHREAD_START_ROUTINE, lpParameter: LPVOID, dwCreationFlags: DWORD, - lpThreadId: LPDWORD, - ) -> HANDLE; - pub fn CreateRemoteThreadEx( - hProcess: HANDLE, lpThreadAttributes: LPSECURITY_ATTRIBUTES, dwStackSize: SIZE_T, - lpStartAddress: LPTHREAD_START_ROUTINE, lpParameter: LPVOID, dwCreationFlags: DWORD, - lpAttributeList: LPPROC_THREAD_ATTRIBUTE_LIST, lpThreadId: LPDWORD, - ) -> HANDLE; - pub fn CreateSemaphoreA( - lpSemaphoreAttributes: LPSECURITY_ATTRIBUTES, lInitialCount: LONG, lMaximumCount: LONG, - lpName: LPCSTR, - ) -> HANDLE; - pub fn CreateSemaphoreExA( - lpSemaphoreAttributes: LPSECURITY_ATTRIBUTES, lInitialCount: LONG, lMaximumCount: LONG, - lpName: LPCSTR, dwFlags: DWORD, dwDesiredAccess: DWORD, - ) -> HANDLE; - pub fn CreateSemaphoreExW( - lpSemaphoreAttributes: LPSECURITY_ATTRIBUTES, lInitialCount: LONG, lMaximumCount: LONG, - lpName: LPCWSTR, dwFlags: DWORD, dwDesiredAccess: DWORD, - ) -> HANDLE; - pub fn CreateSemaphoreW( - lpSemaphoreAttributes: LPSECURITY_ATTRIBUTES, lInitialCount: LONG, lMaximumCount: LONG, - lpName: LPCWSTR, - ) -> HANDLE; - pub fn CreateSymbolicLinkA( - lpSymlinkFileName: LPCSTR, lpTargetFileName: LPCSTR, dwFlags: DWORD, - ) -> BOOLEAN; - pub fn CreateSymbolicLinkTransactedA( - lpSymlinkFileName: LPCSTR, lpTargetFileName: LPCSTR, dwFlags: DWORD, hTransaction: HANDLE, - ) -> BOOLEAN; - pub fn CreateSymbolicLinkTransactedW( - lpSymlinkFileName: LPCWSTR, lpTargetFileName: LPCWSTR, dwFlags: DWORD, hTransaction: HANDLE, - ) -> BOOLEAN; - pub fn CreateSymbolicLinkW( - lpSymlinkFileName: LPCWSTR, lpTargetFileName: LPCWSTR, dwFlags: DWORD, - ) -> BOOLEAN; - pub fn CreateTapePartition( - hDevice: HANDLE, dwPartitionMethod: DWORD, dwCount: DWORD, dwSize: DWORD, - ) -> DWORD; - pub fn CreateThread( - lpThreadAttributes: LPSECURITY_ATTRIBUTES, dwStackSize: SIZE_T, - lpStartAddress: LPTHREAD_START_ROUTINE, lpParameter: LPVOID, dwCreationFlags: DWORD, - lpThreadId: LPDWORD, - ) -> HANDLE; - pub fn CreateThreadpool(reserved: PVOID) -> PTP_POOL; - pub fn CreateThreadpoolCleanupGroup() -> PTP_CLEANUP_GROUP; - pub fn CreateThreadpoolIo( - fl: HANDLE, pfnio: PTP_WIN32_IO_CALLBACK, pv: PVOID, pcbe: PTP_CALLBACK_ENVIRON, - ) -> PTP_IO; - pub fn CreateThreadpoolTimer( - pfnti: PTP_TIMER_CALLBACK, pv: PVOID, pcbe: PTP_CALLBACK_ENVIRON, - ) -> PTP_TIMER; - pub fn CreateThreadpoolWait( - pfnwa: PTP_WAIT_CALLBACK, pv: PVOID, pcbe: PTP_CALLBACK_ENVIRON, - ) -> PTP_WAIT; - pub fn CreateThreadpoolWork( - pfnwk: PTP_WORK_CALLBACK, pv: PVOID, pcbe: PTP_CALLBACK_ENVIRON, - ) -> PTP_WORK; - pub fn CreateTimerQueue() -> HANDLE; - pub fn CreateTimerQueueTimer( - phNewTimer: PHANDLE, TimerQueue: HANDLE, Callback: WAITORTIMERCALLBACK, Parameter: PVOID, - DueTime: DWORD, Period: DWORD, Flags: ULONG, - ) -> BOOL; - pub fn CreateToolhelp32Snapshot(dwFlags: DWORD, th32ProcessID: DWORD) -> HANDLE; - #[cfg(target_arch = "x86_64")] - pub fn CreateUmsCompletionList(UmsCompletionList: *mut PUMS_COMPLETION_LIST) -> BOOL; - #[cfg(target_arch = "x86_64")] - pub fn CreateUmsThreadContext(lpUmsThread: *mut PUMS_CONTEXT) -> BOOL; - pub fn CreateWaitableTimerA( - lpTimerAttributes: LPSECURITY_ATTRIBUTES, bManualReset: BOOL, lpTimerName: LPCSTR, - ) -> HANDLE; - pub fn CreateWaitableTimerExA( - lpTimerAttributes: LPSECURITY_ATTRIBUTES, lpTimerName: LPCSTR, dwFlags: DWORD, - dwDesiredAccess: DWORD, - ) -> HANDLE; - pub fn CreateWaitableTimerExW( - lpTimerAttributes: LPSECURITY_ATTRIBUTES, lpTimerName: LPCWSTR, dwFlags: DWORD, - dwDesiredAccess: DWORD, - ) -> HANDLE; - pub fn CreateWaitableTimerW( - lpTimerAttributes: LPSECURITY_ATTRIBUTES, bManualReset: BOOL, lpTimerName: LPCWSTR, - ) -> HANDLE; - // pub fn CtrlRoutine(); - pub fn DeactivateActCtx(dwFlags: DWORD, ulCookie: ULONG_PTR) -> BOOL; - pub fn DebugActiveProcess(dwProcessId: DWORD) -> BOOL; - pub fn DebugActiveProcessStop(dwProcessId: DWORD) -> BOOL; - pub fn DebugBreak(); - pub fn DebugBreakProcess(Process: HANDLE) -> BOOL; - pub fn DebugSetProcessKillOnExit(KillOnExit: BOOL) -> BOOL; - pub fn DecodePointer(Ptr: PVOID) -> PVOID; - pub fn DecodeSystemPointer(Ptr: PVOID) -> PVOID; - pub fn DefineDosDeviceA(dwFlags: DWORD, lpDeviceName: LPCSTR, lpTargetPath: LPCSTR) -> BOOL; - pub fn DefineDosDeviceW(dwFlags: DWORD, lpDeviceName: LPCWSTR, lpTargetPath: LPCWSTR) -> BOOL; - pub fn DelayLoadFailureHook(pszDllName: LPCSTR, pszProcName: LPCSTR) -> FARPROC; - pub fn DeleteAtom(nAtom: ATOM) -> ATOM; - pub fn DeleteBoundaryDescriptor(BoundaryDescriptor: HANDLE); - pub fn DeleteCriticalSection(lpCriticalSection: LPCRITICAL_SECTION); - pub fn DeleteFiber(lpFiber: LPVOID); - pub fn DeleteFileA(lpFileName: LPCSTR) -> BOOL; - pub fn DeleteFileTransactedA(lpFileName: LPCSTR, hTransaction: HANDLE) -> BOOL; - pub fn DeleteFileTransactedW(lpFileName: LPCWSTR, hTransaction: HANDLE) -> BOOL; - pub fn DeleteFileW(lpFileName: LPCWSTR) -> BOOL; - pub fn DeleteProcThreadAttributeList(lpAttributeList: LPPROC_THREAD_ATTRIBUTE_LIST); - pub fn DeleteSynchronizationBarrier(lpBarrier: LPSYNCHRONIZATION_BARRIER) -> BOOL; - pub fn DeleteTimerQueue(TimerQueue: HANDLE) -> BOOL; - pub fn DeleteTimerQueueEx(TimerQueue: HANDLE, CompletionEvent: HANDLE) -> BOOL; - pub fn DeleteTimerQueueTimer( - TimerQueue: HANDLE, Timer: HANDLE, CompletionEvent: HANDLE, - ) -> BOOL; - #[cfg(target_arch = "x86_64")] - pub fn DeleteUmsCompletionList(UmsCompletionList: PUMS_COMPLETION_LIST) -> BOOL; - #[cfg(target_arch = "x86_64")] - pub fn DeleteUmsThreadContext(UmsThread: PUMS_CONTEXT) -> BOOL; - pub fn DeleteVolumeMountPointA(lpszVolumeMountPoint: LPCSTR) -> BOOL; - pub fn DeleteVolumeMountPointW(lpszVolumeMountPoint: LPCWSTR) -> BOOL; - #[cfg(target_arch = "x86_64")] - pub fn DequeueUmsCompletionListItems( - UmsCompletionList: PUMS_COMPLETION_LIST, WaitTimeOut: DWORD, - UmsThreadList: *mut PUMS_CONTEXT, - ) -> BOOL; - pub fn DeviceIoControl( - hDevice: HANDLE, dwIoControlCode: DWORD, lpInBuffer: LPVOID, nInBufferSize: DWORD, - lpOutBuffer: LPVOID, nOutBufferSize: DWORD, lpBytesReturned: LPDWORD, - lpOverlapped: LPOVERLAPPED, - ) -> BOOL; - pub fn DisableThreadLibraryCalls(hLibModule: HMODULE) -> BOOL; - pub fn DisableThreadProfiling(PerformanceDataHandle: HANDLE) -> DWORD; - pub fn DisassociateCurrentThreadFromCallback(pci: PTP_CALLBACK_INSTANCE); - pub fn DisconnectNamedPipe(hNamedPipe: HANDLE) -> BOOL; - pub fn DnsHostnameToComputerNameA( - Hostname: LPCSTR, ComputerName: LPCSTR, nSize: LPDWORD, - ) -> BOOL; - pub fn DnsHostnameToComputerNameExW( - Hostname: LPCWSTR, ComputerName: LPWSTR, nSize: LPDWORD, - ) -> BOOL; - pub fn DnsHostnameToComputerNameW( - Hostname: LPCWSTR, ComputerName: LPWSTR, nSize: LPDWORD, - ) -> BOOL; - pub fn DosDateTimeToFileTime(wFatDate: WORD, wFatTime: WORD, lpFileTime: LPFILETIME) -> BOOL; - // pub fn DosPathToSessionPathW(); - pub fn DuplicateHandle( - hSourceProcessHandle: HANDLE, hSourceHandle: HANDLE, hTargetProcessHandle: HANDLE, - lpTargetHandle: LPHANDLE, dwDesiredAccess: DWORD, bInheritHandle: BOOL, dwOptions: DWORD, - ) -> BOOL; - pub fn EnableThreadProfiling( - ThreadHandle: HANDLE, Flags: DWORD, HardwareCounters: DWORD64, - PerformanceDataHandle: *mut HANDLE, - ) -> BOOL; - pub fn EncodePointer(Ptr: PVOID) -> PVOID; - pub fn EncodeSystemPointer(Ptr: PVOID) -> PVOID; - pub fn EndUpdateResourceA(hUpdate: HANDLE, fDiscard: BOOL) -> BOOL; - pub fn EndUpdateResourceW(hUpdate: HANDLE, fDiscard: BOOL) -> BOOL; - pub fn EnterCriticalSection(lpCriticalSection: LPCRITICAL_SECTION); - pub fn EnterSynchronizationBarrier( - lpBarrier: LPSYNCHRONIZATION_BARRIER, dwFlags: DWORD, - ) -> BOOL; - #[cfg(target_arch = "x86_64")] - pub fn EnterUmsSchedulingMode(SchedulerStartupInfo: PUMS_SCHEDULER_STARTUP_INFO) -> BOOL; - pub fn EnumCalendarInfoA( - lpCalInfoEnumProc: CALINFO_ENUMPROCA, Locale: LCID, Calendar: CALID, CalType: CALTYPE, - ) -> BOOL; - pub fn EnumCalendarInfoExA( - lpCalInfoEnumProcEx: CALINFO_ENUMPROCEXA, Locale: LCID, Calendar: CALID, CalType: CALTYPE, - ) -> BOOL; - pub fn EnumCalendarInfoExEx( - pCalInfoEnumProcExEx: CALINFO_ENUMPROCEXEX, lpLocaleName: LPCWSTR, Calendar: CALID, - lpReserved: LPCWSTR, CalType: CALTYPE, lParam: LPARAM, - ) -> BOOL; - pub fn EnumCalendarInfoExW( - lpCalInfoEnumProcEx: CALINFO_ENUMPROCEXW, Locale: LCID, Calendar: CALID, CalType: CALTYPE, - ) -> BOOL; - pub fn EnumCalendarInfoW( - lpCalInfoEnumProc: CALINFO_ENUMPROCW, Locale: LCID, Calendar: CALID, CalType: CALTYPE, - ) -> BOOL; - pub fn EnumDateFormatsA( - lpDateFmtEnumProc: DATEFMT_ENUMPROCA, Locale: LCID, dwFlags: DWORD, - ) -> BOOL; - pub fn EnumDateFormatsExA( - lpDateFmtEnumProcEx: DATEFMT_ENUMPROCEXA, Locale: LCID, dwFlags: DWORD, - ) -> BOOL; - pub fn EnumDateFormatsExEx( - lpDateFmtEnumProcExEx: DATEFMT_ENUMPROCEXEX, lpLocaleName: LPCWSTR, dwFlags: DWORD, - lParam: LPARAM, - ) -> BOOL; - pub fn EnumDateFormatsExW( - lpDateFmtEnumProcEx: DATEFMT_ENUMPROCEXW, Locale: LCID, dwFlags: DWORD, - ) -> BOOL; - pub fn EnumDateFormatsW( - lpDateFmtEnumProc: DATEFMT_ENUMPROCW, Locale: LCID, dwFlags: DWORD, - ) -> BOOL; - pub fn EnumLanguageGroupLocalesA( - lpLangGroupLocaleEnumProc: LANGGROUPLOCALE_ENUMPROCA, LanguageGroup: LGRPID, dwFlags: DWORD, - lParam: LONG_PTR, - ) -> BOOL; - pub fn EnumLanguageGroupLocalesW( - lpLangGroupLocaleEnumProc: LANGGROUPLOCALE_ENUMPROCW, LanguageGroup: LGRPID, dwFlags: DWORD, - lParam: LONG_PTR, - ) -> BOOL; - pub fn EnumResourceLanguagesA( - hModule: HMODULE, lpType: LPCSTR, lpName: LPCSTR, lpEnumFunc: ENUMRESLANGPROCA, - lParam: LONG_PTR, - ) -> BOOL; - pub fn EnumResourceLanguagesExA( - hModule: HMODULE, lpType: LPCSTR, lpName: LPCSTR, lpEnumFunc: ENUMRESLANGPROCA, - lParam: LONG_PTR, dwFlags: DWORD, LangId: LANGID, - ) -> BOOL; - pub fn EnumResourceLanguagesExW( - hModule: HMODULE, lpType: LPCWSTR, lpName: LPCWSTR, lpEnumFunc: ENUMRESLANGPROCW, - lParam: LONG_PTR, dwFlags: DWORD, LangId: LANGID, - ) -> BOOL; - pub fn EnumResourceLanguagesW( - hModule: HMODULE, lpType: LPCWSTR, lpName: LPCWSTR, lpEnumFunc: ENUMRESLANGPROCW, - lParam: LONG_PTR, - ) -> BOOL; - pub fn EnumResourceNamesA( - hModule: HMODULE, lpType: LPCSTR, lpEnumFunc: ENUMRESNAMEPROCA, lParam: LONG_PTR, - ) -> BOOL; - pub fn EnumResourceNamesExA( - hModule: HMODULE, lpType: LPCSTR, lpEnumFunc: ENUMRESNAMEPROCA, lParam: LONG_PTR, - dwFlags: DWORD, LangId: LANGID, - ) -> BOOL; - pub fn EnumResourceNamesExW( - hModule: HMODULE, lpType: LPCWSTR, lpEnumFunc: ENUMRESNAMEPROCW, lParam: LONG_PTR, - dwFlags: DWORD, LangId: LANGID, - ) -> BOOL; - pub fn EnumResourceNamesW( - hModule: HMODULE, lpType: LPCWSTR, lpEnumFunc: ENUMRESNAMEPROCW, lParam: LONG_PTR, - ) -> BOOL; - pub fn EnumResourceTypesA( - hModule: HMODULE, lpEnumFunc: ENUMRESTYPEPROCA, lParam: LONG_PTR, - ) -> BOOL; - pub fn EnumResourceTypesExA( - hModule: HMODULE, lpEnumFunc: ENUMRESTYPEPROCA, lParam: LONG_PTR, dwFlags: DWORD, - LangId: LANGID, - ) -> BOOL; - pub fn EnumResourceTypesExW( - hModule: HMODULE, lpEnumFunc: ENUMRESTYPEPROCW, lParam: LONG_PTR, dwFlags: DWORD, - LangId: LANGID, - ) -> BOOL; - pub fn EnumResourceTypesW( - hModule: HMODULE, lpEnumFunc: ENUMRESTYPEPROCW, lParam: LONG_PTR, - ) -> BOOL; - pub fn EnumSystemCodePagesA(lpCodePageEnumProc: CODEPAGE_ENUMPROCA, dwFlags: DWORD) -> BOOL; - pub fn EnumSystemCodePagesW(lpCodePageEnumProc: CODEPAGE_ENUMPROCW, dwFlags: DWORD) -> BOOL; - pub fn EnumSystemFirmwareTables( - FirmwareTableProviderSignature: DWORD, pFirmwareTableEnumBuffer: PVOID, BufferSize: DWORD, - ) -> UINT; - pub fn EnumSystemGeoID( - GeoClass: GEOCLASS, ParentGeoId: GEOID, lpGeoEnumProc: GEO_ENUMPROC, - ) -> BOOL; - pub fn EnumSystemLanguageGroupsA( - lpLanguageGroupEnumProc: LANGUAGEGROUP_ENUMPROCA, dwFlags: DWORD, lParam: LONG_PTR, - ) -> BOOL; - pub fn EnumSystemLanguageGroupsW( - lpLanguageGroupEnumProc: LANGUAGEGROUP_ENUMPROCW, dwFlags: DWORD, lParam: LONG_PTR, - ) -> BOOL; - pub fn EnumSystemLocalesA(lpLocaleEnumProc: LOCALE_ENUMPROCA, dwFlags: DWORD) -> BOOL; - pub fn EnumSystemLocalesEx( - lpLocaleEnumProcEx: LOCALE_ENUMPROCEX, dwFlags: DWORD, lParam: LPARAM, lpReserved: LPVOID, - ) -> BOOL; - pub fn EnumSystemLocalesW(lpLocaleEnumProc: LOCALE_ENUMPROCW, dwFlags: DWORD) -> BOOL; - pub fn EnumTimeFormatsA( - lpTimeFmtEnumProc: TIMEFMT_ENUMPROCA, Locale: LCID, dwFlags: DWORD, - ) -> BOOL; - pub fn EnumTimeFormatsEx( - lpTimeFmtEnumProcEx: TIMEFMT_ENUMPROCEX, lpLocaleName: LPCWSTR, dwFlags: DWORD, - lParam: LPARAM, - ) -> BOOL; - pub fn EnumTimeFormatsW( - lpTimeFmtEnumProc: TIMEFMT_ENUMPROCW, Locale: LCID, dwFlags: DWORD, - ) -> BOOL; - pub fn EnumUILanguagesA( - lpUILanguageEnumProc: UILANGUAGE_ENUMPROCA, dwFlags: DWORD, lParam: LONG_PTR, - ) -> BOOL; - pub fn EnumUILanguagesW( - lpUILanguageEnumProc: UILANGUAGE_ENUMPROCW, dwFlags: DWORD, lParam: LONG_PTR, - ) -> BOOL; - // pub fn EnumerateLocalComputerNamesA(); - // pub fn EnumerateLocalComputerNamesW(); - pub fn EraseTape(hDevice: HANDLE, dwEraseType: DWORD, bImmediate: BOOL) -> DWORD; - pub fn EscapeCommFunction(hFile: HANDLE, dwFunc: DWORD) -> BOOL; - #[cfg(target_arch = "x86_64")] - pub fn ExecuteUmsThread(UmsThread: PUMS_CONTEXT) -> BOOL; - pub fn ExitProcess(uExitCode: UINT); - pub fn ExitThread(dwExitCode: DWORD); - pub fn ExpandEnvironmentStringsA(lpSrc: LPCSTR, lpDst: LPSTR, nSize: DWORD) -> DWORD; - pub fn ExpandEnvironmentStringsW(lpSrc: LPCWSTR, lpDst: LPWSTR, nSize: DWORD) -> DWORD; - pub fn FatalAppExitA(uAction: UINT, lpMessageText: LPCSTR); - pub fn FatalAppExitW(uAction: UINT, lpMessageText: LPCWSTR); - pub fn FatalExit(ExitCode: c_int); - pub fn FileTimeToDosDateTime( - lpFileTime: *const FILETIME, lpFatDate: LPWORD, lpFatTime: LPWORD, - ) -> BOOL; - pub fn FileTimeToLocalFileTime( - lpFileTime: *const FILETIME, lpLocalFileTime: LPFILETIME, - ) -> BOOL; - pub fn FileTimeToSystemTime( - lpFileTime: *const FILETIME, lpSystemTime: LPSYSTEMTIME, - ) -> BOOL; - pub fn FillConsoleOutputAttribute( - hConsoleOutput: HANDLE, wAttribute: WORD, nLength: DWORD, dwWriteCoord: COORD, - lpNumberOfAttrsWritten: LPDWORD, - ) -> BOOL; - pub fn FillConsoleOutputCharacterA( - hConsoleOutput: HANDLE, cCharacter: CHAR, nLength: DWORD, dwWriteCoord: COORD, - lpNumberOfCharsWritten: LPDWORD, - ) -> BOOL; - pub fn FillConsoleOutputCharacterW( - hConsoleOutput: HANDLE, cCharacter: WCHAR, nLength: DWORD, dwWriteCoord: COORD, - lpNumberOfCharsWritten: LPDWORD, - ) -> BOOL; - pub fn FindActCtxSectionGuid( - dwFlags: DWORD, lpExtensionGuid: *const GUID, ulSectionId: ULONG, lpGuidToFind: *const GUID, - ReturnedData: PACTCTX_SECTION_KEYED_DATA, - ) -> BOOL; - pub fn FindActCtxSectionStringA( - dwFlags: DWORD, lpExtensionGuid: *const GUID, ulSectionId: ULONG, lpStringToFind: LPCSTR, - ReturnedData: PACTCTX_SECTION_KEYED_DATA, - ) -> BOOL; - pub fn FindActCtxSectionStringW( - dwFlags: DWORD, lpExtensionGuid: *const GUID, ulSectionId: ULONG, lpStringToFind: LPCWSTR, - ReturnedData: PACTCTX_SECTION_KEYED_DATA, - ) -> BOOL; - pub fn FindAtomA(lpString: LPCSTR) -> ATOM; - pub fn FindAtomW(lpString: LPCWSTR) -> ATOM; - pub fn FindClose(hFindFile: HANDLE) -> BOOL; - pub fn FindCloseChangeNotification(hChangeHandle: HANDLE) -> BOOL; - pub fn FindFirstChangeNotificationA( - lpPathName: LPCSTR, bWatchSubtree: BOOL, dwNotifyFilter: DWORD, - ) -> HANDLE; - pub fn FindFirstChangeNotificationW( - lpPathName: LPCWSTR, bWatchSubtree: BOOL, dwNotifyFilter: DWORD, - ) -> HANDLE; - pub fn FindFirstFileA(lpFileName: LPCSTR, lpFindFileData: LPWIN32_FIND_DATAA) -> HANDLE; - pub fn FindFirstFileExA( - lpFileName: LPCSTR, fInfoLevelId: FINDEX_INFO_LEVELS, lpFindFileData: LPVOID, - fSearchOp: FINDEX_SEARCH_OPS, lpSearchFilter: LPVOID, dwAdditionalFlags: DWORD, - ) -> HANDLE; - pub fn FindFirstFileExW( - lpFileName: LPCWSTR, fInfoLevelId: FINDEX_INFO_LEVELS, lpFindFileData: LPVOID, - fSearchOp: FINDEX_SEARCH_OPS, lpSearchFilter: LPVOID, dwAdditionalFlags: DWORD, - ) -> HANDLE; - pub fn FindFirstFileNameTransactedW( - lpFileName: LPCWSTR, dwFlags: DWORD, StringLength: LPDWORD, LinkName: PWSTR, - hTransaction: HANDLE, - ) -> HANDLE; - pub fn FindFirstFileNameW( - lpFileName: LPCWSTR, dwFlags: DWORD, StringLength: LPDWORD, LinkName: PWSTR, - ) -> HANDLE; - pub fn FindFirstFileTransactedA( - lpFileName: LPCSTR, fInfoLevelId: FINDEX_INFO_LEVELS, lpFindFileData: LPVOID, - fSearchOp: FINDEX_SEARCH_OPS, lpSearchFilter: LPVOID, dwAdditionalFlags: DWORD, - hTransaction: HANDLE, - ) -> HANDLE; - pub fn FindFirstFileTransactedW( - lpFileName: LPCWSTR, fInfoLevelId: FINDEX_INFO_LEVELS, lpFindFileData: LPVOID, - fSearchOp: FINDEX_SEARCH_OPS, lpSearchFilter: LPVOID, dwAdditionalFlags: DWORD, - hTransaction: HANDLE, - ) -> HANDLE; - pub fn FindFirstFileW(lpFileName: LPCWSTR, lpFindFileData: LPWIN32_FIND_DATAW) -> HANDLE; - pub fn FindFirstStreamTransactedW( - lpFileName: LPCWSTR, InfoLevel: STREAM_INFO_LEVELS, lpFindStreamData: LPVOID, - dwFlags: DWORD, hTransaction: HANDLE, - ) -> HANDLE; - pub fn FindFirstStreamW( - lpFileName: LPCWSTR, InfoLevel: STREAM_INFO_LEVELS, lpFindStreamData: LPVOID, - dwFlags: DWORD, - ) -> HANDLE; - pub fn FindFirstVolumeA(lpszVolumeName: LPSTR, cchBufferLength: DWORD) -> HANDLE; - pub fn FindFirstVolumeMountPointA( - lpszRootPathName: LPCSTR, lpszVolumeMountPoint: LPSTR, cchBufferLength: DWORD, - ) -> HANDLE; - pub fn FindFirstVolumeMountPointW( - lpszRootPathName: LPCWSTR, lpszVolumeMountPoint: LPWSTR, cchBufferLength: DWORD, - ) -> HANDLE; - pub fn FindFirstVolumeW(lpszVolumeName: LPWSTR, cchBufferLength: DWORD) -> HANDLE; - pub fn FindNLSString( - Locale: LCID, dwFindNLSStringFlags: DWORD, lpStringSource: LPCWSTR, cchSource: c_int, - lpStringValue: LPCWSTR, cchValue: c_int, pcchFound: LPINT, - ) -> c_int; - pub fn FindNLSStringEx( - lpLocaleName: LPCWSTR, dwFindNLSStringFlags: DWORD, lpStringSource: LPCWSTR, - cchSource: c_int, lpStringValue: LPCWSTR, cchValue: c_int, pcchFound: LPINT, - lpVersionInformation: LPNLSVERSIONINFO, lpReserved: LPVOID, sortHandle: LPARAM, - ) -> c_int; - pub fn FindNextChangeNotification(hChangeHandle: HANDLE) -> BOOL; - pub fn FindNextFileA(hFindFile: HANDLE, lpFindFileData: LPWIN32_FIND_DATAA) -> BOOL; - pub fn FindNextFileNameW(hFindStream: HANDLE, StringLength: LPDWORD, LinkName: PWSTR) -> BOOL; - pub fn FindNextFileW(hFindFile: HANDLE, lpFindFileData: LPWIN32_FIND_DATAW) -> BOOL; - pub fn FindNextStreamW(hFindStream: HANDLE, lpFindStreamData: LPVOID) -> BOOL; - pub fn FindNextVolumeA( - hFindVolume: HANDLE, lpszVolumeName: LPSTR, cchBufferLength: DWORD, - ) -> BOOL; - pub fn FindNextVolumeMountPointA( - hFindVolumeMountPoint: HANDLE, lpszVolumeMountPoint: LPSTR, cchBufferLength: DWORD, - ) -> BOOL; - pub fn FindNextVolumeMountPointW( - hFindVolumeMountPoint: HANDLE, lpszVolumeMountPoint: LPWSTR, cchBufferLength: DWORD, - ) -> BOOL; - pub fn FindNextVolumeW( - hFindVolume: HANDLE, lpszVolumeName: LPWSTR, cchBufferLength: DWORD, - ) -> BOOL; - // pub fn FindPackagesByPackageFamily(); - pub fn FindResourceA(hModule: HMODULE, lpName: LPCSTR, lpType: LPCSTR) -> HRSRC; - pub fn FindResourceExA( - hModule: HMODULE, lpName: LPCSTR, lpType: LPCSTR, wLanguage: WORD, - ) -> HRSRC; - pub fn FindResourceExW( - hModule: HMODULE, lpName: LPCWSTR, lpType: LPCWSTR, wLanguage: WORD, - ) -> HRSRC; - pub fn FindResourceW(hModule: HMODULE, lpName: LPCWSTR, lpType: LPCWSTR) -> HRSRC; - pub fn FindStringOrdinal( - dwFindStringOrdinalFlags: DWORD, lpStringSource: LPCWSTR, cchSource: c_int, - lpStringValue: LPCWSTR, cchValue: c_int, bIgnoreCase: BOOL, - ) -> c_int; - pub fn FindVolumeClose(hFindVolume: HANDLE) -> BOOL; - pub fn FindVolumeMountPointClose(hFindVolumeMountPoint: HANDLE) -> BOOL; - pub fn FlsAlloc(lpCallback: PFLS_CALLBACK_FUNCTION) -> DWORD; - pub fn FlsFree(dwFlsIndex: DWORD) -> BOOL; - pub fn FlsGetValue(dwFlsIndex: DWORD) -> PVOID; - pub fn FlsSetValue(dwFlsIndex: DWORD, lpFlsData: PVOID) -> BOOL; - pub fn FlushConsoleInputBuffer(hConsoleInput: HANDLE) -> BOOL; - pub fn FlushFileBuffers(hFile: HANDLE) -> BOOL; - pub fn FlushInstructionCache(hProcess: HANDLE, lpBaseAddress: LPCVOID, dwSize: SIZE_T) -> BOOL; - pub fn FlushProcessWriteBuffers(); - pub fn FlushViewOfFile(lpBaseAddress: LPCVOID, dwNumberOfBytesToFlush: SIZE_T) -> BOOL; - pub fn FoldStringA( - dwMapFlags: DWORD, lpSrcStr: LPCSTR, cchSrc: c_int, lpDestStr: LPSTR, cchDest: c_int, - ) -> c_int; - pub fn FoldStringW( - dwMapFlags: DWORD, lpSrcStr: LPCWCH, cchSrc: c_int, lpDestStr: LPWSTR, cchDest: c_int, - ) -> c_int; - // pub fn FormatApplicationUserModelId(); - pub fn FormatMessageA( - dwFlags: DWORD, lpSource: LPCVOID, dwMessageId: DWORD, dwLanguageId: DWORD, - lpBuffer: LPSTR, nSize: DWORD, Arguments: *mut va_list, - ) -> DWORD; - pub fn FormatMessageW( - dwFlags: DWORD, lpSource: LPCVOID, dwMessageId: DWORD, dwLanguageId: DWORD, - lpBuffer: LPWSTR, nSize: DWORD, Arguments: *mut va_list, - ) -> DWORD; - pub fn FreeConsole() -> BOOL; - pub fn FreeEnvironmentStringsA(penv: LPCH) -> BOOL; - pub fn FreeEnvironmentStringsW(penv: LPWCH) -> BOOL; - pub fn FreeLibrary(hLibModule: HMODULE) -> BOOL; - pub fn FreeLibraryAndExitThread(hLibModule: HMODULE, dwExitCode: DWORD); - pub fn FreeLibraryWhenCallbackReturns(pci: PTP_CALLBACK_INSTANCE, module: HMODULE); - pub fn FreeResource(hResData: HGLOBAL) -> BOOL; - pub fn FreeUserPhysicalPages( - hProcess: HANDLE, NumberOfPages: PULONG_PTR, PageArray: PULONG_PTR, - ) -> BOOL; - pub fn GenerateConsoleCtrlEvent(dwCtrlEvent: DWORD, dwProcessGroupId: DWORD) -> BOOL; - pub fn GetACP() -> UINT; - pub fn GetActiveProcessorCount(GroupNumber: WORD) -> DWORD; - pub fn GetActiveProcessorGroupCount() -> WORD; - pub fn GetAppContainerAce( - Acl: PACL, StartingAceIndex: DWORD, AppContainerAce: *mut PVOID, - AppContainerAceIndex: *mut DWORD, - ) -> BOOL; - pub fn GetAppContainerNamedObjectPath( - Token: HANDLE, AppContainerSid: PSID, ObjectPathLength: ULONG, ObjectPath: LPWSTR, - ReturnLength: PULONG, - ) -> BOOL; - pub fn GetApplicationRecoveryCallback( - hProcess: HANDLE, pRecoveryCallback: *mut APPLICATION_RECOVERY_CALLBACK, - ppvParameter: *mut PVOID, pdwPingInterval: PDWORD, pdwFlags: PDWORD, - ) -> HRESULT; - pub fn GetApplicationRestartSettings( - hProcess: HANDLE, pwzCommandline: PWSTR, pcchSize: PDWORD, pdwFlags: PDWORD, - ) -> HRESULT; - // pub fn GetApplicationUserModelId(); - pub fn GetAtomNameA(nAtom: ATOM, lpBuffer: LPSTR, nSize: c_int) -> UINT; - pub fn GetAtomNameW(nAtom: ATOM, lpBuffer: LPWSTR, nSize: c_int) -> UINT; - pub fn GetBinaryTypeA(lpApplicationName: LPCSTR, lpBinaryType: LPDWORD) -> BOOL; - pub fn GetBinaryTypeW(lpApplicationName: LPCWSTR, lpBinaryType: LPDWORD) -> BOOL; - pub fn GetCPInfo(CodePage: UINT, lpCPInfo: LPCPINFO) -> BOOL; - pub fn GetCPInfoExA(CodePage: UINT, dwFlags: DWORD, lpCPInfoEx: LPCPINFOEXA) -> BOOL; - pub fn GetCPInfoExW(CodePage: UINT, dwFlags: DWORD, lpCPInfoEx: LPCPINFOEXW) -> BOOL; - pub fn GetCachedSigningLevel( - File: HANDLE, Flags: PULONG, SigningLevel: PULONG, Thumbprint: PUCHAR, - ThumbprintSize: PULONG, ThumbprintAlgorithm: PULONG, - ) -> BOOL; - pub fn GetCalendarInfoA( - Locale: LCID, Calendar: CALID, CalType: CALTYPE, lpCalData: LPSTR, cchData: c_int, - lpValue: LPDWORD, - ) -> c_int; - pub fn GetCalendarInfoEx( - lpLocaleName: LPCWSTR, Calendar: CALID, lpReserved: LPCWSTR, CalType: CALTYPE, - lpCalData: LPWSTR, cchData: c_int, lpValue: LPDWORD, - ) -> c_int; - pub fn GetCalendarInfoW( - Locale: LCID, Calendar: CALID, CalType: CALTYPE, lpCalData: LPWSTR, cchData: c_int, - lpValue: LPDWORD, - ) -> c_int; - pub fn GetCommConfig(hCommDev: HANDLE, lpCC: LPCOMMCONFIG, lpdwSize: LPDWORD) -> BOOL; - pub fn GetCommMask(hFile: HANDLE, lpEvtMask: LPDWORD) -> BOOL; - pub fn GetCommModemStatus(hFile: HANDLE, lpModemStat: LPDWORD) -> BOOL; - pub fn GetCommProperties(hFile: HANDLE, lpCommProp: LPCOMMPROP) -> BOOL; - pub fn GetCommState(hFile: HANDLE, lpDCB: LPDCB) -> BOOL; - pub fn GetCommTimeouts(hFile: HANDLE, lpCommTimeouts: LPCOMMTIMEOUTS) -> BOOL; - pub fn GetCommandLineA() -> LPSTR; - pub fn GetCommandLineW() -> LPWSTR; - pub fn GetCompressedFileSizeA(lpFileName: LPCSTR, lpFileSizeHigh: LPDWORD) -> DWORD; - pub fn GetCompressedFileSizeTransactedA( - lpFileName: LPCSTR, lpFileSizeHigh: LPDWORD, hTransaction: HANDLE, - ) -> DWORD; - pub fn GetCompressedFileSizeTransactedW( - lpFileName: LPCWSTR, lpFileSizeHigh: LPDWORD, hTransaction: HANDLE, - ); - pub fn GetCompressedFileSizeW(lpFileName: LPCWSTR, lpFileSizeHigh: LPDWORD) -> DWORD; - pub fn GetComputerNameA(lpBuffer: LPSTR, nSize: LPDWORD) -> BOOL; - pub fn GetComputerNameExA( - NameType: COMPUTER_NAME_FORMAT, lpBuffer: LPSTR, nSize: LPDWORD, - ) -> BOOL; - pub fn GetComputerNameExW( - NameType: COMPUTER_NAME_FORMAT, lpBuffer: LPWSTR, nSize: LPDWORD, - ) -> BOOL; - pub fn GetComputerNameW(lpBuffer: LPWSTR, nSize: LPDWORD) -> BOOL; - pub fn GetConsoleAliasA( - Source: LPSTR, TargetBuffer: LPSTR, TargetBufferLength: DWORD, ExeName: LPSTR, - ) -> DWORD; - pub fn GetConsoleAliasExesA(ExeNameBuffer: LPSTR, ExeNameBufferLength: DWORD) -> DWORD; - pub fn GetConsoleAliasExesLengthA() -> DWORD; - pub fn GetConsoleAliasExesLengthW() -> DWORD; - pub fn GetConsoleAliasExesW(ExeNameBuffer: LPWSTR, ExeNameBufferLength: DWORD) -> DWORD; - pub fn GetConsoleAliasW( - Source: LPWSTR, TargetBuffer: LPWSTR, TargetBufferLength: DWORD, ExeName: LPWSTR, - ) -> DWORD; - pub fn GetConsoleAliasesA( - AliasBuffer: LPSTR, AliasBufferLength: DWORD, ExeName: LPSTR, - ) -> DWORD; - pub fn GetConsoleAliasesLengthA(ExeName: LPSTR) -> DWORD; - pub fn GetConsoleAliasesLengthW(ExeName: LPWSTR) -> DWORD; - pub fn GetConsoleAliasesW( - AliasBuffer: LPWSTR, AliasBufferLength: DWORD, ExeName: LPWSTR, - ) -> DWORD; - pub fn GetConsoleCP() -> UINT; - pub fn GetConsoleCursorInfo( - hConsoleOutput: HANDLE, lpConsoleCursorInfo: PCONSOLE_CURSOR_INFO, - ) -> BOOL; - pub fn GetConsoleDisplayMode(lpModeFlags: LPDWORD) -> BOOL; - pub fn GetConsoleFontSize(hConsoleOutput: HANDLE, nFont: DWORD) -> COORD; - pub fn GetConsoleHistoryInfo(lpConsoleHistoryInfo: PCONSOLE_HISTORY_INFO) -> BOOL; - pub fn GetConsoleMode(hConsoleHandle: HANDLE, lpMode: LPDWORD) -> BOOL; - pub fn GetConsoleOriginalTitleA(lpConsoleTitle: LPSTR, nSize: DWORD) -> DWORD; - pub fn GetConsoleOriginalTitleW(lpConsoleTitle: LPWSTR, nSize: DWORD) -> DWORD; - pub fn GetConsoleOutputCP() -> UINT; - pub fn GetConsoleProcessList(lpdwProcessList: LPDWORD, dwProcessCount: DWORD) -> DWORD; - pub fn GetConsoleScreenBufferInfo( - hConsoleOutput: HANDLE, lpConsoleScreenBufferInfo: PCONSOLE_SCREEN_BUFFER_INFO, - ) -> BOOL; - pub fn GetConsoleScreenBufferInfoEx( - hConsoleOutput: HANDLE, lpConsoleScreenBufferInfoEx: PCONSOLE_SCREEN_BUFFER_INFOEX, - ) -> BOOL; - pub fn GetConsoleSelectionInfo(lpConsoleSelectionInfo: PCONSOLE_SELECTION_INFO) -> BOOL; - pub fn GetConsoleTitleA(lpConsoleTitle: LPSTR, nSize: DWORD) -> DWORD; - pub fn GetConsoleTitleW(lpConsoleTitle: LPWSTR, nSize: DWORD) -> DWORD; - pub fn GetConsoleWindow() -> HWND; - pub fn GetCurrencyFormatA( - Locale: LCID, dwFlags: DWORD, lpValue: LPCSTR, lpFormat: *const CURRENCYFMTA, - lpCurrencyStr: LPSTR, cchCurrency: c_int, - ) -> c_int; - pub fn GetCurrencyFormatEx( - lpLocaleName: LPCWSTR, dwFlags: DWORD, lpValue: LPCWSTR, lpFormat: *const CURRENCYFMTW, - lpCurrencyStr: LPWSTR, cchCurrency: c_int, - ) -> c_int; - pub fn GetCurrencyFormatW( - Locale: LCID, dwFlags: DWORD, lpValue: LPCWSTR, lpFormat: *const CURRENCYFMTW, - lpCurrencyStr: LPWSTR, cchCurrency: c_int, - ) -> c_int; - pub fn GetCurrentActCtx(lphActCtx: *mut HANDLE) -> BOOL; - // pub fn GetCurrentApplicationUserModelId(); - pub fn GetCurrentConsoleFont( - hConsoleOutput: HANDLE, bMaximumWindow: BOOL, lpConsoleCurrentFont: PCONSOLE_FONT_INFO, - ) -> BOOL; - pub fn GetCurrentConsoleFontEx( - hConsoleOutput: HANDLE, bMaximumWindow: BOOL, lpConsoleCurrentFontEx: PCONSOLE_FONT_INFOEX, - ) -> BOOL; - pub fn GetCurrentDirectoryA(nBufferLength: DWORD, lpBuffer: LPSTR) -> DWORD; - pub fn GetCurrentDirectoryW(nBufferLength: DWORD, lpBuffer: LPWSTR) -> DWORD; - // pub fn GetCurrentPackageFamilyName(); - // pub fn GetCurrentPackageFullName(); - // pub fn GetCurrentPackageId(); - // pub fn GetCurrentPackageInfo(); - // pub fn GetCurrentPackagePath(); - pub fn GetCurrentProcess() -> HANDLE; - pub fn GetCurrentProcessId() -> DWORD; - pub fn GetCurrentProcessorNumber() -> DWORD; - pub fn GetCurrentProcessorNumberEx(ProcNumber: PPROCESSOR_NUMBER); - pub fn GetCurrentThread() -> HANDLE; - pub fn GetCurrentThreadId() -> DWORD; - pub fn GetCurrentThreadStackLimits(LowLimit: PULONG_PTR, HighLimit: PULONG_PTR); - #[cfg(target_arch = "x86_64")] - pub fn GetCurrentUmsThread() -> PUMS_CONTEXT; - pub fn GetDateFormatA( - Locale: LCID, dwFlags: DWORD, lpDate: *const SYSTEMTIME, lpFormat: LPCSTR, lpDateStr: LPSTR, - cchDate: c_int, - ) -> c_int; - pub fn GetDateFormatEx( - lpLocaleName: LPCWSTR, dwFlags: DWORD, lpDate: *const SYSTEMTIME, lpFormat: LPCWSTR, - lpDateStr: LPWSTR, cchDate: c_int, lpCalendar: LPCWSTR, - ) -> c_int; - pub fn GetDateFormatW( - Locale: LCID, dwFlags: DWORD, lpDate: *const SYSTEMTIME, lpFormat: LPCWSTR, - lpDateStr: LPWSTR, cchDate: c_int, - ) -> c_int; - pub fn GetDefaultCommConfigA(lpszName: LPCSTR, lpCC: LPCOMMCONFIG, lpdwSize: LPDWORD) -> BOOL; - pub fn GetDefaultCommConfigW(lpszName: LPCWSTR, lpCC: LPCOMMCONFIG, lpdwSize: LPDWORD) -> BOOL; - pub fn GetDevicePowerState(hDevice: HANDLE, pfOn: *mut BOOL) -> BOOL; - pub fn GetDiskFreeSpaceA( - lpRootPathName: LPCSTR, lpSectorsPerCluster: LPDWORD, lpBytesPerSector: LPDWORD, - lpNumberOfFreeClusters: LPDWORD, lpTotalNumberOfClusters: LPDWORD, - ) -> BOOL; - pub fn GetDiskFreeSpaceExA( - lpDirectoryName: LPCSTR, lpFreeBytesAvailableToCaller: PULARGE_INTEGER, - lpTotalNumberOfBytes: PULARGE_INTEGER, lpTotalNumberOfFreeBytes: PULARGE_INTEGER, - ) -> BOOL; - pub fn GetDiskFreeSpaceExW( - lpDirectoryName: LPCWSTR, lpFreeBytesAvailableToCaller: PULARGE_INTEGER, - lpTotalNumberOfBytes: PULARGE_INTEGER, lpTotalNumberOfFreeBytes: PULARGE_INTEGER, - ) -> BOOL; - pub fn GetDiskFreeSpaceW( - lpRootPathName: LPCWSTR, lpSectorsPerCluster: LPDWORD, lpBytesPerSector: LPDWORD, - lpNumberOfFreeClusters: LPDWORD, lpTotalNumberOfClusters: LPDWORD, - ) -> BOOL; - pub fn GetDllDirectoryA(nBufferLength: DWORD, lpBuffer: LPSTR) -> DWORD; - pub fn GetDllDirectoryW(nBufferLength: DWORD, lpBuffer: LPWSTR) -> DWORD; - pub fn GetDriveTypeA(lpRootPathName: LPCSTR) -> UINT; - pub fn GetDriveTypeW(lpRootPathName: LPCWSTR) -> UINT; - pub fn GetDurationFormat( - Locale: LCID, dwFlags: DWORD, lpDuration: *const SYSTEMTIME, ullDuration: ULONGLONG, - lpFormat: LPCWSTR, lpDurationStr: LPWSTR, cchDuration: c_int, - ) -> c_int; - pub fn GetDurationFormatEx( - lpLocaleName: LPCWSTR, dwFlags: DWORD, lpDuration: *const SYSTEMTIME, - ullDuration: ULONGLONG, lpFormat: LPCWSTR, lpDurationStr: LPWSTR, cchDuration: c_int, - ) -> c_int; - pub fn GetDynamicTimeZoneInformation( - pTimeZoneInformation: PDYNAMIC_TIME_ZONE_INFORMATION, - ) -> DWORD; - #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] - pub fn GetEnabledXStateFeatures() -> DWORD64; - pub fn GetEnvironmentStrings() -> LPCH; - pub fn GetEnvironmentStringsW() -> LPWCH; - pub fn GetEnvironmentVariableA(lpName: LPCSTR, lpBuffer: LPSTR, nSize: DWORD) -> DWORD; - pub fn GetEnvironmentVariableW(lpName: LPCWSTR, lpBuffer: LPWSTR, nSize: DWORD) -> DWORD; - // pub fn GetEraNameCountedString(); - pub fn GetErrorMode() -> UINT; - pub fn GetExitCodeProcess(hProcess: HANDLE, lpExitCode: LPDWORD) -> BOOL; - pub fn GetExitCodeThread(hThread: HANDLE, lpExitCode: LPDWORD) -> BOOL; - pub fn GetFileAttributesA(lpFileName: LPCSTR) -> DWORD; - pub fn GetFileAttributesExA( - lpFileName: LPCSTR, fInfoLevelId: GET_FILEEX_INFO_LEVELS, lpFileInformation: LPVOID, - ) -> BOOL; - pub fn GetFileAttributesExW( - lpFileName: LPCWSTR, fInfoLevelId: GET_FILEEX_INFO_LEVELS, lpFileInformation: LPVOID, - ) -> BOOL; - pub fn GetFileAttributesTransactedA( - lpFileName: LPCSTR, fInfoLevelId: GET_FILEEX_INFO_LEVELS, lpFileInformation: LPVOID, - hTransaction: HANDLE, - ) -> BOOL; - pub fn GetFileAttributesTransactedW( - lpFileName: LPCWSTR, fInfoLevelId: GET_FILEEX_INFO_LEVELS, lpFileInformation: LPVOID, - hTransaction: HANDLE, - ) -> BOOL; - pub fn GetFileAttributesW(lpFileName: LPCWSTR) -> DWORD; - pub fn GetFileBandwidthReservation( - hFile: HANDLE, lpPeriodMilliseconds: LPDWORD, lpBytesPerPeriod: LPDWORD, - pDiscardable: LPBOOL, lpTransferSize: LPDWORD, lpNumOutstandingRequests: LPDWORD, - ) -> BOOL; - pub fn GetFileInformationByHandle( - hFile: HANDLE, lpFileInformation: LPBY_HANDLE_FILE_INFORMATION, - ) -> BOOL; - pub fn GetFileInformationByHandleEx( - hFile: HANDLE, FileInformationClass: FILE_INFO_BY_HANDLE_CLASS, lpFileInformation: LPVOID, - dwBufferSize: DWORD, - ) -> BOOL; - pub fn GetFileMUIInfo( - dwFlags: DWORD, pcwszFilePath: PCWSTR, pFileMUIInfo: PFILEMUIINFO, - pcbFileMUIInfo: *mut DWORD, - ) -> BOOL; - pub fn GetFileMUIPath( - dwFlags: DWORD, pcwszFilePath: PCWSTR, pwszLanguage: PWSTR, pcchLanguage: PULONG, - pwszFileMUIPath: PWSTR, pcchFileMUIPath: PULONG, pululEnumerator: PULONGLONG, - ) -> BOOL; - pub fn GetFileSize(hFile: HANDLE, lpFileSizeHigh: LPDWORD) -> DWORD; - pub fn GetFileSizeEx(hFile: HANDLE, lpFileSize: PLARGE_INTEGER) -> BOOL; - pub fn GetFileTime( - hFile: HANDLE, lpCreationTime: LPFILETIME, lpLastAccessTime: LPFILETIME, - lpLastWriteTime: LPFILETIME, - ) -> BOOL; - pub fn GetFileType(hFile: HANDLE) -> DWORD; - pub fn GetFinalPathNameByHandleA( - hFile: HANDLE, lpszFilePath: LPSTR, cchFilePath: DWORD, dwFlags: DWORD, - ) -> DWORD; - pub fn GetFinalPathNameByHandleW( - hFile: HANDLE, lpszFilePath: LPWSTR, cchFilePath: DWORD, dwFlags: DWORD, - ) -> DWORD; - pub fn GetFirmwareEnvironmentVariableA( - lpName: LPCSTR, lpGuid: LPCSTR, pBuffer: PVOID, nSize: DWORD, - ) -> DWORD; - pub fn GetFirmwareEnvironmentVariableExA( - lpName: LPCSTR, lpGuid: LPCSTR, pBuffer: PVOID, nSize: DWORD, pdwAttribubutes: PDWORD, - ) -> DWORD; - pub fn GetFirmwareEnvironmentVariableExW( - lpName: LPCWSTR, lpGuid: LPCWSTR, pBuffer: PVOID, nSize: DWORD, pdwAttribubutes: PDWORD, - ) -> DWORD; - pub fn GetFirmwareEnvironmentVariableW( - lpName: LPCWSTR, lpGuid: LPCWSTR, pBuffer: PVOID, nSize: DWORD, - ) -> DWORD; - pub fn GetFirmwareType(FirmwareType: PFIRMWARE_TYPE) -> BOOL; - pub fn GetFullPathNameA( - lpFileName: LPCSTR, nBufferLength: DWORD, lpBuffer: LPSTR, lpFilePart: *mut LPSTR, - ) -> DWORD; - pub fn GetFullPathNameTransactedA( - lpFileName: LPCSTR, nBufferLength: DWORD, lpBuffer: LPSTR, lpFilePart: *mut LPSTR, - hTransaction: HANDLE, - ) -> DWORD; - pub fn GetFullPathNameTransactedW( - lpFileName: LPCWSTR, nBufferLength: DWORD, lpBuffer: LPWSTR, lpFilePart: *mut LPWSTR, - hTransaction: HANDLE, - ); - pub fn GetFullPathNameW( - lpFileName: LPCWSTR, nBufferLength: DWORD, lpBuffer: LPWSTR, lpFilePart: *mut LPWSTR, - ) -> DWORD; - pub fn GetGeoInfoA( - Location: GEOID, GeoType: GEOTYPE, lpGeoData: LPSTR, cchData: c_int, LangId: LANGID, - ) -> c_int; - pub fn GetGeoInfoW( - Location: GEOID, GeoType: GEOTYPE, lpGeoData: LPWSTR, cchData: c_int, LangId: LANGID, - ) -> c_int; - pub fn GetHandleInformation(hObject: HANDLE, lpdwFlags: LPDWORD) -> BOOL; - pub fn GetLargePageMinimum() -> SIZE_T; - pub fn GetLargestConsoleWindowSize(hConsoleOutput: HANDLE) -> COORD; - pub fn GetLastError() -> DWORD; - pub fn GetLocalTime(lpSystemTime: LPSYSTEMTIME); - pub fn GetLocaleInfoA( - Locale: LCID, LCType: LCTYPE, lpLCData: LPSTR, cchData: c_int, - ) -> c_int; - pub fn GetLocaleInfoEx( - lpLocaleName: LPCWSTR, LCType: LCTYPE, lpLCData: LPWSTR, cchData: c_int, - ) -> c_int; - pub fn GetLocaleInfoW( - Locale: LCID, LCType: LCTYPE, lpLCData: LPWSTR, cchData: c_int, - ) -> c_int; - pub fn GetLogicalDriveStringsA(nBufferLength: DWORD, lpBuffer: LPSTR) -> DWORD; - pub fn GetLogicalDriveStringsW(nBufferLength: DWORD, lpBuffer: LPWSTR) -> DWORD; - pub fn GetLogicalDrives() -> DWORD; - pub fn GetLogicalProcessorInformation( - Buffer: PSYSTEM_LOGICAL_PROCESSOR_INFORMATION, ReturnedLength: PDWORD, - ) -> BOOL; - pub fn GetLogicalProcessorInformationEx( - RelationshipType: LOGICAL_PROCESSOR_RELATIONSHIP, - Buffer: PSYSTEM_LOGICAL_PROCESSOR_INFORMATION, - ReturnedLength: PDWORD, - ) -> BOOL; - pub fn GetLongPathNameA(lpszShortPath: LPCSTR, lpszLongPath: LPSTR, cchBuffer: DWORD) -> DWORD; - pub fn GetLongPathNameTransactedA( - lpszShortPath: LPCSTR, lpszLongPath: LPSTR, cchBuffer: DWORD, hTransaction: HANDLE, - ) -> DWORD; - pub fn GetLongPathNameTransactedW( - lpszShortPath: LPCWSTR, lpszLongPath: LPWSTR, cchBuffer: DWORD, hTransaction: HANDLE, - ) -> DWORD; - pub fn GetLongPathNameW( - lpszShortPath: LPCWSTR, lpszLongPath: LPWSTR, cchBuffer: DWORD, - ) -> DWORD; - pub fn GetMailslotInfo( - hMailslot: HANDLE, lpMaxMessageSize: LPDWORD, lpNextSize: LPDWORD, lpMessageCount: LPDWORD, - lpReadTimeout: LPDWORD, - ) -> BOOL; - pub fn GetMaximumProcessorCount(GroupNumber: WORD) -> DWORD; - pub fn GetMaximumProcessorGroupCount() -> WORD; - pub fn GetMemoryErrorHandlingCapabilities(Capabilities: PULONG) -> BOOL; - pub fn GetModuleFileNameA( - hModule: HMODULE, lpFilename: LPSTR, nSize: DWORD, - ) -> DWORD; - pub fn GetModuleFileNameW( - hModule: HMODULE, lpFilename: LPWSTR, nSize: DWORD, - ) -> DWORD; - pub fn GetModuleHandleA(lpModuleName: LPCSTR) -> HMODULE; - pub fn GetModuleHandleExA( - dwFlags: DWORD, lpModuleName: LPCSTR, phModule: *mut HMODULE, - ) -> BOOL; - pub fn GetModuleHandleExW( - dwFlags: DWORD, lpModuleName: LPCWSTR, phModule: *mut HMODULE, - ) -> BOOL; - pub fn GetModuleHandleW(lpModuleName: LPCWSTR) -> HMODULE; - pub fn GetNLSVersion( - Function: NLS_FUNCTION, Locale: LCID, lpVersionInformation: LPNLSVERSIONINFO, - ) -> BOOL; - pub fn GetNLSVersionEx( - function: NLS_FUNCTION, lpLocaleName: LPCWSTR, lpVersionInformation: LPNLSVERSIONINFOEX, - ) -> BOOL; - // pub fn GetNamedPipeAttribute(); - pub fn GetNamedPipeClientComputerNameA( - Pipe: HANDLE, ClientComputerName: LPSTR, ClientComputerNameLength: ULONG, - ) -> BOOL; - pub fn GetNamedPipeClientComputerNameW( - Pipe: HANDLE, ClientComputerName: LPWSTR, ClientComputerNameLength: ULONG, - ) -> BOOL; - pub fn GetNamedPipeClientProcessId(Pipe: HANDLE, ClientProcessId: PULONG) -> BOOL; - pub fn GetNamedPipeClientSessionId(Pipe: HANDLE, ClientSessionId: PULONG) -> BOOL; - pub fn GetNamedPipeHandleStateA( - hNamedPipe: HANDLE, lpState: LPDWORD, lpCurInstances: LPDWORD, - lpMaxCollectionCount: LPDWORD, lpCollectDataTimeout: LPDWORD, lpUserName: LPSTR, - nMaxUserNameSize: DWORD, - ) -> BOOL; - pub fn GetNamedPipeHandleStateW( - hNamedPipe: HANDLE, lpState: LPDWORD, lpCurInstances: LPDWORD, - lpMaxCollectionCount: LPDWORD, lpCollectDataTimeout: LPDWORD, lpUserName: LPWSTR, - nMaxUserNameSize: DWORD, - ) -> BOOL; - pub fn GetNamedPipeInfo( - hNamedPipe: HANDLE, lpFlags: LPDWORD, lpOutBufferSize: LPDWORD, lpInBufferSize: LPDWORD, - lpMaxInstances: LPDWORD, - ) -> BOOL; - pub fn GetNamedPipeServerProcessId(Pipe: HANDLE, ServerProcessId: PULONG) -> BOOL; - pub fn GetNamedPipeServerSessionId(Pipe: HANDLE, ServerSessionId: PULONG) -> BOOL; - pub fn GetNativeSystemInfo(lpSystemInfo: LPSYSTEM_INFO); - #[cfg(target_arch = "x86_64")] - pub fn GetNextUmsListItem(UmsContext: PUMS_CONTEXT) -> PUMS_CONTEXT; - pub fn GetNumaAvailableMemoryNode(Node: UCHAR, AvailableBytes: PULONGLONG) -> BOOL; - pub fn GetNumaAvailableMemoryNodeEx(Node: USHORT, AvailableBytes: PULONGLONG) -> BOOL; - pub fn GetNumaHighestNodeNumber(HighestNodeNumber: PULONG) -> BOOL; - pub fn GetNumaNodeNumberFromHandle(hFile: HANDLE, NodeNumber: PUSHORT) -> BOOL; - pub fn GetNumaNodeProcessorMask(Node: UCHAR, ProcessorMask: PULONGLONG) -> BOOL; - pub fn GetNumaNodeProcessorMaskEx(Node: USHORT, ProcessorMask: PGROUP_AFFINITY) -> BOOL; - pub fn GetNumaProcessorNode(Processor: UCHAR, NodeNumber: PUCHAR) -> BOOL; - pub fn GetNumaProcessorNodeEx(Processor: PPROCESSOR_NUMBER, NodeNumber: PUSHORT) -> BOOL; - pub fn GetNumaProximityNode(ProximityId: ULONG, NodeNumber: PUCHAR) -> BOOL; - pub fn GetNumaProximityNodeEx(ProximityId: ULONG, NodeNumber: PUSHORT) -> BOOL; - pub fn GetNumberFormatA( - Locale: LCID, dwFlags: DWORD, lpValue: LPCSTR, lpFormat: *const NUMBERFMTA, - lpNumberStr: LPSTR, cchNumber: c_int, - ) -> c_int; - pub fn GetNumberFormatEx( - lpLocaleName: LPCWSTR, dwFlags: DWORD, lpValue: LPCWSTR, lpFormat: *const NUMBERFMTW, - lpNumberStr: LPWSTR, cchNumber: c_int, - ) -> c_int; - pub fn GetNumberFormatW( - Locale: LCID, dwFlags: DWORD, lpValue: LPCWSTR, lpFormat: *const NUMBERFMTW, - lpNumberStr: LPWSTR, cchNumber: c_int, - ) -> c_int; - pub fn GetNumberOfConsoleInputEvents(hConsoleInput: HANDLE, lpNumberOfEvents: LPDWORD) -> BOOL; - pub fn GetNumberOfConsoleMouseButtons(lpNumberOfMouseButtons: LPDWORD) -> BOOL; - pub fn GetOEMCP() -> UINT; - pub fn GetOverlappedResult( - hFile: HANDLE, lpOverlapped: LPOVERLAPPED, lpNumberOfBytesTransferred: LPDWORD, bWait: BOOL, - ) -> BOOL; - pub fn GetOverlappedResultEx( - hFile: HANDLE, lpOverlapped: LPOVERLAPPED, lpNumberOfBytesTransferred: LPDWORD, - dwMilliseconds: DWORD, bAlertable: BOOL, - ) -> BOOL; - // pub fn GetPackageApplicationIds(); - // pub fn GetPackageFamilyName(); - // pub fn GetPackageFullName(); - // pub fn GetPackageId(); - // pub fn GetPackageInfo(); - // pub fn GetPackagePath(); - // pub fn GetPackagePathByFullName(); - // pub fn GetPackagesByPackageFamily(); - pub fn GetPhysicallyInstalledSystemMemory(TotalMemoryInKilobytes: PULONGLONG) -> BOOL; - pub fn GetPriorityClass(hProcess: HANDLE) -> DWORD; - pub fn GetPrivateProfileIntA( - lpAppName: LPCSTR, lpKeyName: LPCSTR, nDefault: INT, lpFileName: LPCSTR, - ) -> UINT; - pub fn GetPrivateProfileIntW( - lpAppName: LPCWSTR, lpKeyName: LPCWSTR, nDefault: INT, lpFileName: LPCWSTR, - ) -> UINT; - pub fn GetPrivateProfileSectionA( - lpAppName: LPCSTR, lpReturnedString: LPSTR, nSize: DWORD, lpFileName: LPCSTR, - ) -> DWORD; - pub fn GetPrivateProfileSectionNamesA( - lpszReturnBuffer: LPSTR, nSize: DWORD, lpFileName: LPCSTR, - ) -> DWORD; - pub fn GetPrivateProfileSectionNamesW( - lpszReturnBuffer: LPWSTR, nSize: DWORD, lpFileName: LPCWSTR, - ) -> DWORD; - pub fn GetPrivateProfileSectionW( - lpAppName: LPCWSTR, lpReturnedString: LPWSTR, nSize: DWORD, lpFileName: LPCWSTR, - ) -> DWORD; - pub fn GetPrivateProfileStringA( - lpAppName: LPCSTR, lpKeyName: LPCSTR, lpDefault: LPCSTR, lpReturnedString: LPSTR, - nSize: DWORD, lpFileName: LPCSTR, - ) -> DWORD; - pub fn GetPrivateProfileStringW( - lpAppName: LPCWSTR, lpKeyName: LPCWSTR, lpDefault: LPCWSTR, lpReturnedString: LPWSTR, - nSize: DWORD, lpFileName: LPCWSTR, - ) -> DWORD; - pub fn GetPrivateProfileStructA( - lpszSection: LPCSTR, lpszKey: LPCSTR, lpStruct: LPVOID, uSizeStruct: UINT, szFile: LPCSTR, - ) -> BOOL; - pub fn GetPrivateProfileStructW( - lpszSection: LPCWSTR, lpszKey: LPCWSTR, lpStruct: LPVOID, uSizeStruct: UINT, - szFile: LPCWSTR, - ) -> BOOL; - pub fn GetProcAddress(hModule: HMODULE, lpProcName: LPCSTR) -> FARPROC; - pub fn GetProcessAffinityMask( - hProcess: HANDLE, lpProcessAffinityMask: PDWORD_PTR, lpSystemAffinityMask: PDWORD_PTR, - ) -> BOOL; - pub fn GetProcessDEPPolicy(hProcess: HANDLE, lpFlags: LPDWORD, lpPermanent: PBOOL) -> BOOL; - pub fn GetProcessGroupAffinity( - hProcess: HANDLE, GroupCount: PUSHORT, GroupArray: PUSHORT, - ) -> BOOL; - pub fn GetProcessHandleCount(hProcess: HANDLE, pdwHandleCount: PDWORD) -> BOOL; - pub fn GetProcessHeap() -> HANDLE; - pub fn GetProcessHeaps(NumberOfHeaps: DWORD, ProcessHeaps: PHANDLE) -> DWORD; - pub fn GetProcessId(Process: HANDLE) -> DWORD; - pub fn GetProcessIdOfThread(Thread: HANDLE) -> DWORD; - pub fn GetProcessInformation( - hProcess: HANDLE, ProcessInformationClass: PROCESS_INFORMATION_CLASS, - ProcessInformation: LPVOID, ProcessInformationSize: DWORD, - ) -> BOOL; - pub fn GetProcessIoCounters(hProcess: HANDLE, lpIoCounters: PIO_COUNTERS) -> BOOL; - pub fn GetProcessMitigationPolicy( - hProcess: HANDLE, MitigationPolicy: PROCESS_MITIGATION_POLICY, lpBuffer: PVOID, - dwLength: SIZE_T, - ) -> BOOL; - pub fn GetProcessPreferredUILanguages( - dwFlags: DWORD, pulNumLanguages: PULONG, pwszLanguagesBuffer: PZZWSTR, - pcchLanguagesBuffer: PULONG, - ) -> BOOL; - pub fn GetProcessPriorityBoost(hProcess: HANDLE, pDisablePriorityBoost: PBOOL) -> BOOL; - pub fn GetProcessShutdownParameters(lpdwLevel: LPDWORD, lpdwFlags: LPDWORD) -> BOOL; - pub fn GetProcessTimes( - hProcess: HANDLE, lpCreationTime: LPFILETIME, lpExitTime: LPFILETIME, - lpKernelTime: LPFILETIME, lpUserTime: LPFILETIME, - ) -> BOOL; - pub fn GetProcessVersion(ProcessId: DWORD) -> DWORD; - pub fn GetProcessWorkingSetSize( - hProcess: HANDLE, lpMinimumWorkingSetSize: PSIZE_T, lpMaximumWorkingSetSize: PSIZE_T, - ) -> BOOL; - pub fn GetProcessWorkingSetSizeEx( - hProcess: HANDLE, lpMinimumWorkingSetSize: PSIZE_T, lpMaximumWorkingSetSize: PSIZE_T, - Flags: PDWORD, - ) -> BOOL; - pub fn GetProcessorSystemCycleTime( - Group: USHORT, Buffer: PSYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION, ReturnedLength: PDWORD, - ) -> BOOL; - pub fn GetProductInfo( - dwOSMajorVersion: DWORD, dwOSMinorVersion: DWORD, dwSpMajorVersion: DWORD, - dwSpMinorVersion: DWORD, pdwReturnedProductType: PDWORD, - ) -> BOOL; - pub fn GetProfileIntA(lpAppName: LPCSTR, lpKeyName: LPCSTR, nDefault: INT) -> UINT; - pub fn GetProfileIntW(lpAppName: LPCWSTR, lpKeyName: LPCWSTR, nDefault: INT) -> UINT; - pub fn GetProfileSectionA(lpAppName: LPCSTR, lpReturnedString: LPSTR, nSize: DWORD) -> DWORD; - pub fn GetProfileSectionW(lpAppName: LPCWSTR, lpReturnedString: LPWSTR, nSize: DWORD) -> DWORD; - pub fn GetProfileStringA( - lpAppName: LPCSTR, lpKeyName: LPCSTR, lpDefault: LPCSTR, lpReturnedString: LPSTR, - nSize: DWORD, - ) -> DWORD; - pub fn GetProfileStringW( - lpAppName: LPCWSTR, lpKeyName: LPCWSTR, lpDefault: LPCWSTR, lpReturnedString: LPWSTR, - nSize: DWORD, - ) -> DWORD; - pub fn GetQueuedCompletionStatus( - CompletionPort: HANDLE, lpNumberOfBytesTransferred: LPDWORD, lpCompletionKey: PULONG_PTR, - lpOverlapped: *mut LPOVERLAPPED, dwMilliseconds: DWORD, - ) -> BOOL; - pub fn GetQueuedCompletionStatusEx( - CompletionPort: HANDLE, lpCompletionPortEntries: LPOVERLAPPED_ENTRY, ulCount: ULONG, - ulNumEntriesRemoved: PULONG, dwMilliseconds: DWORD, fAlertable: BOOL, - ) -> BOOL; - pub fn GetShortPathNameA( - lpszLongPath: LPCSTR, lpszShortPath: LPSTR, cchBuffer: DWORD, - ) -> DWORD; - pub fn GetShortPathNameW( - lpszLongPath: LPCWSTR, lpszShortPath: LPWSTR, cchBuffer: DWORD, - ) -> DWORD; - // pub fn GetStagedPackagePathByFullName(); - pub fn GetStartupInfoA(lpStartupInfo: LPSTARTUPINFOA); - pub fn GetStartupInfoW(lpStartupInfo: LPSTARTUPINFOW); - // pub fn GetStateFolder(); - pub fn GetStdHandle(nStdHandle: DWORD) -> HANDLE; - pub fn GetStringScripts( - dwFlags: DWORD, lpString: LPCWSTR, cchString: c_int, lpScripts: LPWSTR, cchScripts: c_int, - ) -> c_int; - pub fn GetStringTypeA( - Locale: LCID, dwInfoType: DWORD, lpSrcStr: LPCSTR, cchSrc: c_int, lpCharType: LPWORD, - ) -> BOOL; - pub fn GetStringTypeExA( - Locale: LCID, dwInfoType: DWORD, lpSrcStr: LPCSTR, cchSrc: c_int, lpCharType: LPWORD, - ) -> BOOL; - pub fn GetStringTypeExW( - Locale: LCID, dwInfoType: DWORD, lpSrcStr: LPCWCH, cchSrc: c_int, lpCharType: LPWORD, - ) -> BOOL; - pub fn GetStringTypeW( - dwInfoType: DWORD, lpSrcStr: LPCWCH, cchSrc: c_int, lpCharType: LPWORD, - ) -> BOOL; - // pub fn GetSystemAppDataKey(); - pub fn GetSystemDEPPolicy() -> DEP_SYSTEM_POLICY_TYPE; - pub fn GetSystemDefaultLCID() -> LCID; - pub fn GetSystemDefaultLangID() -> LANGID; - pub fn GetSystemDefaultLocaleName(lpLocaleName: LPWSTR, cchLocaleName: c_int) -> c_int; - pub fn GetSystemDefaultUILanguage() -> LANGID; - pub fn GetSystemDirectoryA(lpBuffer: LPSTR, uSize: UINT) -> UINT; - pub fn GetSystemDirectoryW(lpBuffer: LPWSTR, uSize: UINT) -> UINT; - pub fn GetSystemFileCacheSize( - lpMinimumFileCacheSize: PSIZE_T, lpMaximumFileCacheSize: PSIZE_T, lpFlags: PDWORD, - ) -> BOOL; - pub fn GetSystemFirmwareTable( - FirmwareTableProviderSignature: DWORD, FirmwareTableID: DWORD, pFirmwareTableBuffer: PVOID, - BufferSize: DWORD, - ) -> UINT; - pub fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO); - pub fn GetSystemPowerStatus(lpSystemPowerStatus: LPSYSTEM_POWER_STATUS) -> BOOL; - pub fn GetSystemPreferredUILanguages( - dwFlags: DWORD, pulNumLanguages: PULONG, pwszLanguagesBuffer: PZZWSTR, - pcchLanguagesBuffer: PULONG, - ) -> BOOL; - pub fn GetSystemRegistryQuota(pdwQuotaAllowed: PDWORD, pdwQuotaUsed: PDWORD) -> BOOL; - pub fn GetSystemTime(lpSystemTime: LPSYSTEMTIME); - pub fn GetSystemTimeAdjustment( - lpTimeAdjustment: PDWORD, lpTimeIncrement: PDWORD, lpTimeAdjustmentDisabled: PBOOL, - ) -> BOOL; - pub fn GetSystemTimeAsFileTime(lpSystemTimeAsFileTime: LPFILETIME); - pub fn GetSystemTimePreciseAsFileTime(lpSystemTimeAsFileTime: LPFILETIME); - pub fn GetSystemTimes( - lpIdleTime: LPFILETIME, lpKernelTime: LPFILETIME, lpUserTime: LPFILETIME, - ) -> BOOL; - pub fn GetSystemWindowsDirectoryA(lpBuffer: LPSTR, uSize: UINT) -> UINT; - pub fn GetSystemWindowsDirectoryW(lpBuffer: LPWSTR, uSize: UINT) -> UINT; - pub fn GetSystemWow64DirectoryA(lpBuffer: LPSTR, uSize: UINT) -> UINT; - pub fn GetSystemWow64DirectoryW(lpBuffer: LPWSTR, uSize: UINT) -> UINT; - pub fn GetTapeParameters( - hDevice: HANDLE, dwOperation: DWORD, lpdwSize: LPDWORD, lpTapeInformation: LPVOID - ) -> DWORD; - pub fn GetTapePosition( - hDevice: HANDLE, dwPositionType: DWORD, lpdwPartition: LPDWORD, - lpdwOffsetLow: LPDWORD, lpdwOffsetHigh: LPDWORD - ) -> DWORD; - pub fn GetTapeStatus(hDevice: HANDLE) -> DWORD; - pub fn GetTempFileNameA( - lpPathName: LPCSTR, lpPrefixString: LPCSTR, uUnique: UINT, lpTempFileName: LPSTR, - ) -> UINT; - pub fn GetTempFileNameW( - lpPathName: LPCWSTR, lpPrefixString: LPCWSTR, uUnique: UINT, lpTempFileName: LPWSTR, - ) -> UINT; - pub fn GetTempPathA(nBufferLength: DWORD, lpBuffer: LPSTR) -> DWORD; - pub fn GetTempPathW(nBufferLength: DWORD, lpBuffer: LPWSTR) -> DWORD; - pub fn GetThreadContext(hThread: HANDLE, lpContext: LPCONTEXT) -> BOOL; - pub fn GetThreadErrorMode() -> DWORD; - pub fn GetThreadGroupAffinity(hThread: HANDLE, GroupAffinity: PGROUP_AFFINITY) -> BOOL; - pub fn GetThreadIOPendingFlag(hThread: HANDLE, lpIOIsPending: PBOOL) -> BOOL; - pub fn GetThreadId(Thread: HANDLE) -> DWORD; - pub fn GetThreadIdealProcessorEx(hThread: HANDLE, lpIdealProcessor: PPROCESSOR_NUMBER) -> BOOL; - pub fn GetThreadInformation( - hThread: HANDLE, ThreadInformationClass: THREAD_INFORMATION_CLASS, - ThreadInformation: LPVOID, ThreadInformationSize: DWORD, - ) -> BOOL; - pub fn GetThreadLocale() -> LCID; - pub fn GetThreadPreferredUILanguages( - dwFlags: DWORD, pulNumLanguages: PULONG, pwszLanguagesBuffer: PZZWSTR, - pcchLanguagesBuffer: PULONG, - ) -> BOOL; - pub fn GetThreadPriority(hThread: HANDLE) -> c_int; - pub fn GetThreadPriorityBoost(hThread: HANDLE, pDisablePriorityBoost: PBOOL) -> BOOL; - pub fn GetThreadSelectorEntry( - hThread: HANDLE, dwSelector: DWORD, lpSelectorEntry: LPLDT_ENTRY, - ) -> BOOL; - pub fn GetThreadTimes( - hThread: HANDLE, lpCreationTime: LPFILETIME, lpExitTime: LPFILETIME, - lpKernelTime: LPFILETIME, lpUserTime: LPFILETIME, - ) -> BOOL; - pub fn GetThreadUILanguage() -> LANGID; - pub fn GetTickCount() -> DWORD; - pub fn GetTickCount64() -> ULONGLONG; - pub fn GetTimeFormatA( - Locale: LCID, dwFlags: DWORD, lpTime: *const SYSTEMTIME, lpFormat: LPCSTR, - lpTimeStr: LPSTR, cchTime: c_int, - ) -> c_int; - pub fn GetTimeFormatEx( - lpLocaleName: LPCWSTR, dwFlags: DWORD, lpTime: *const SYSTEMTIME, lpFormat: LPCWSTR, - lpTimeStr: LPWSTR, cchTime: c_int, - ) -> c_int; - pub fn GetTimeFormatW( - Locale: LCID, dwFlags: DWORD, lpTime: *const SYSTEMTIME, lpFormat: LPCWSTR, - lpTimeStr: LPWSTR, cchTime: c_int, - ) -> c_int; - pub fn GetTimeZoneInformation(lpTimeZoneInformation: LPTIME_ZONE_INFORMATION) -> DWORD; - pub fn GetTimeZoneInformationForYear( - wYear: USHORT, pdtzi: PDYNAMIC_TIME_ZONE_INFORMATION, ptzi: LPTIME_ZONE_INFORMATION, - ) -> BOOL; - pub fn GetUILanguageInfo( - dwFlags: DWORD, pwmszLanguage: PCZZWSTR, pwszFallbackLanguages: PZZWSTR, - pcchFallbackLanguages: PDWORD, pAttributes: PDWORD, - ) -> BOOL; - #[cfg(target_arch = "x86_64")] - pub fn GetUmsCompletionListEvent( - UmsCompletionList: PUMS_COMPLETION_LIST, UmsCompletionEvent: PHANDLE, - ) -> BOOL; - #[cfg(target_arch = "x86_64")] - pub fn GetUmsSystemThreadInformation( - ThreadHandle: HANDLE, SystemThreadInfo: PUMS_SYSTEM_THREAD_INFORMATION, - ) -> BOOL; - pub fn GetUserDefaultLCID() -> LCID; - pub fn GetUserDefaultLangID() -> LANGID; - pub fn GetUserDefaultLocaleName(lpLocaleName: LPWSTR, cchLocaleName: c_int) -> c_int; - pub fn GetUserDefaultUILanguage() -> LANGID; - pub fn GetUserGeoID(GeoClass: GEOCLASS) -> GEOID; - pub fn GetUserPreferredUILanguages( - dwFlags: DWORD, pulNumLanguages: PULONG, pwszLanguagesBuffer: PZZWSTR, - pcchLanguagesBuffer: PULONG, - ) -> BOOL; - pub fn GetVersion() -> DWORD; - pub fn GetVersionExA(lpVersionInformation: LPOSVERSIONINFOA) -> BOOL; - pub fn GetVersionExW(lpVersionInformation: LPOSVERSIONINFOW) -> BOOL; - pub fn GetVolumeInformationA( - lpRootPathName: LPCSTR, lpVolumeNameBuffer: LPSTR, nVolumeNameSize: DWORD, - lpVolumeSerialNumber: LPDWORD, lpMaximumComponentLength: LPDWORD, - lpFileSystemFlags: LPDWORD, lpFileSystemNameBuffer: LPSTR, nFileSystemNameSize: DWORD, - ) -> BOOL; - pub fn GetVolumeInformationByHandleW( - hFile: HANDLE, lpVolumeNameBuffer: LPWSTR, nVolumeNameSize: DWORD, - lpVolumeSerialNumber: LPDWORD, lpMaximumComponentLength: LPDWORD, - lpFileSystemFlags: LPDWORD, lpFileSystemNameBuffer: LPWSTR, nFileSystemNameSize: DWORD, - ) -> BOOL; - pub fn GetVolumeInformationW( - lpRootPathName: LPCWSTR, lpVolumeNameBuffer: LPWSTR, nVolumeNameSize: DWORD, - lpVolumeSerialNumber: LPDWORD, lpMaximumComponentLength: LPDWORD, - lpFileSystemFlags: LPDWORD, lpFileSystemNameBuffer: LPWSTR, nFileSystemNameSize: DWORD, - ) -> BOOL; - pub fn GetVolumeNameForVolumeMountPointA( - lpszVolumeMountPoint: LPCSTR, lpszVolumeName: LPSTR, cchBufferLength: DWORD, - ) -> BOOL; - pub fn GetVolumeNameForVolumeMountPointW( - lpszVolumeMountPoint: LPCWSTR, lpszVolumeName: LPWSTR, cchBufferLength: DWORD, - ) -> BOOL; - pub fn GetVolumePathNameA( - lpszFileName: LPCSTR, lpszVolumePathName: LPSTR, cchBufferLength: DWORD, - ) -> BOOL; - pub fn GetVolumePathNameW( - lpszFileName: LPCWSTR, lpszVolumePathName: LPWSTR, cchBufferLength: DWORD, - ) -> BOOL; - pub fn GetVolumePathNamesForVolumeNameA( - lpszVolumeName: LPCSTR, lpszVolumePathNames: LPCH, cchBufferLength: DWORD, - lpcchReturnLength: PDWORD, - ) -> BOOL; - pub fn GetVolumePathNamesForVolumeNameW( - lpszVolumeName: LPCWSTR, lpszVolumePathNames: LPWCH, cchBufferLength: DWORD, - lpcchReturnLength: PDWORD, - ) -> BOOL; - pub fn GetWindowsDirectoryA(lpBuffer: LPSTR, uSize: UINT) -> UINT; - pub fn GetWindowsDirectoryW(lpBuffer: LPWSTR, uSize: UINT) -> UINT; - pub fn GetWriteWatch( - dwFlags: DWORD, lpBaseAddress: PVOID, dwRegionSize: SIZE_T, lpAddresses: *mut PVOID, - lpdwCount: *mut ULONG_PTR, lpdwGranularity: LPDWORD, - ) -> UINT; - #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] - pub fn GetXStateFeaturesMask(Context: PCONTEXT, FeatureMask: PDWORD64) -> BOOL; - pub fn GlobalAddAtomA(lpString: LPCSTR) -> ATOM; - pub fn GlobalAddAtomExA(lpString: LPCSTR, Flags: DWORD) -> ATOM; - pub fn GlobalAddAtomExW(lpString: LPCWSTR, Flags: DWORD) -> ATOM; - pub fn GlobalAddAtomW(lpString: LPCWSTR) -> ATOM; - pub fn GlobalAlloc(uFlags: UINT, dwBytes: SIZE_T) -> HGLOBAL; - pub fn GlobalCompact(dwMinFree: DWORD) -> SIZE_T; - pub fn GlobalDeleteAtom(nAtom: ATOM) -> ATOM; - pub fn GlobalFindAtomA(lpString: LPCSTR) -> ATOM; - pub fn GlobalFindAtomW(lpString: LPCWSTR) -> ATOM; - pub fn GlobalFix(hMem: HGLOBAL); - pub fn GlobalFlags(hMem: HGLOBAL) -> UINT; - pub fn GlobalFree(hMem: HGLOBAL) -> HGLOBAL; - pub fn GlobalGetAtomNameA(nAtom: ATOM, lpBuffer: LPSTR, nSize: c_int) -> UINT; - pub fn GlobalGetAtomNameW(nAtom: ATOM, lpBuffer: LPWSTR, nSize: c_int) -> UINT; - pub fn GlobalHandle(pMem: LPCVOID) -> HGLOBAL; - pub fn GlobalLock(hMem: HGLOBAL) -> LPVOID; - pub fn GlobalMemoryStatus(lpBuffer: LPMEMORYSTATUS); - pub fn GlobalMemoryStatusEx(lpBuffer: LPMEMORYSTATUSEX) -> BOOL; - pub fn GlobalReAlloc(hMem: HGLOBAL, dwBytes: SIZE_T, uFlags: UINT) -> HGLOBAL; - pub fn GlobalSize(hMem: HGLOBAL) -> SIZE_T; - pub fn GlobalUnWire(hMem: HGLOBAL) -> BOOL; - pub fn GlobalUnfix(hMem: HGLOBAL); - pub fn GlobalUnlock(hMem: HGLOBAL) -> BOOL; - pub fn GlobalWire(hMem: HGLOBAL) -> LPVOID; - pub fn Heap32First(lphe: LPHEAPENTRY32, th32ProcessID: DWORD, th32HeapID: ULONG_PTR) -> BOOL; - pub fn Heap32ListFirst(hSnapshot: HANDLE, lphl: LPHEAPLIST32) -> BOOL; - pub fn Heap32ListNext(hSnapshot: HANDLE, lphl: LPHEAPLIST32) -> BOOL; - pub fn Heap32Next(lphe: LPHEAPENTRY32) -> BOOL; - pub fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T) -> LPVOID; - pub fn HeapCompact(hHeap: HANDLE, dwFlags: DWORD) -> SIZE_T; - pub fn HeapCreate(flOptions: DWORD, dwInitialSize: SIZE_T, dwMaximumSize: SIZE_T) -> HANDLE; - pub fn HeapDestroy(hHeap: HANDLE) -> BOOL; - pub fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID) -> BOOL; - pub fn HeapLock(hHeap: HANDLE) -> BOOL; - pub fn HeapQueryInformation( - HeapHandle: HANDLE, HeapInformationClass: HEAP_INFORMATION_CLASS, HeapInformation: PVOID, - HeapInformationLength: SIZE_T, ReturnLength: PSIZE_T, - ) -> BOOL; - pub fn HeapReAlloc(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID, dwBytes: SIZE_T) -> LPVOID; - pub fn HeapSetInformation( - HeapHandle: HANDLE, HeapInformationClass: HEAP_INFORMATION_CLASS, HeapInformation: PVOID, - HeapInformationLength: SIZE_T, - ) -> BOOL; - pub fn HeapSize(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPCVOID) -> SIZE_T; - pub fn HeapSummary(hHeap: HANDLE, dwFlags: DWORD, lpSummary: LPHEAP_SUMMARY) -> BOOL; - pub fn HeapUnlock(hHeap: HANDLE) -> BOOL; - pub fn HeapValidate(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPCVOID) -> BOOL; - pub fn HeapWalk(hHeap: HANDLE, lpEntry: LPPROCESS_HEAP_ENTRY) -> BOOL; - pub fn InitAtomTable(nSize: DWORD) -> BOOL; - pub fn InitOnceBeginInitialize( - lpInitOnce: LPINIT_ONCE, dwFlags: DWORD, fPending: PBOOL, lpContext: *mut LPVOID, - ) -> BOOL; - pub fn InitOnceComplete( - lpInitOnce: LPINIT_ONCE, dwFlags: DWORD, lpContext: LPVOID, - ) -> BOOL; - pub fn InitOnceExecuteOnce( - InitOnce: PINIT_ONCE, InitFn: PINIT_ONCE_FN, Parameter: PVOID, Context: *mut LPVOID, - ) -> BOOL; - pub fn InitOnceInitialize(InitOnce: PINIT_ONCE); - pub fn InitializeConditionVariable(ConditionVariable: PCONDITION_VARIABLE); - pub fn InitializeContext( - Buffer: PVOID, ContextFlags: DWORD, Context: *mut PCONTEXT, ContextLength: PDWORD, - ) -> BOOL; - pub fn InitializeCriticalSection(lpCriticalSection: LPCRITICAL_SECTION); - pub fn InitializeCriticalSectionAndSpinCount( - lpCriticalSection: LPCRITICAL_SECTION, dwSpinCount: DWORD, - ) -> BOOL; - pub fn InitializeCriticalSectionEx( - lpCriticalSection: LPCRITICAL_SECTION, dwSpinCount: DWORD, Flags: DWORD, - ) -> BOOL; - pub fn InitializeProcThreadAttributeList( - lpAttributeList: LPPROC_THREAD_ATTRIBUTE_LIST, dwAttributeCount: DWORD, dwFlags: DWORD, - lpSize: PSIZE_T, - ) -> BOOL; - pub fn InitializeSListHead(ListHead: PSLIST_HEADER); - pub fn InitializeSRWLock(SRWLock: PSRWLOCK); - pub fn InitializeSynchronizationBarrier( - lpBarrier: LPSYNCHRONIZATION_BARRIER, lTotalThreads: LONG, lSpinCount: LONG, - ) -> BOOL; - pub fn InstallELAMCertificateInfo(ELAMFile: HANDLE) -> BOOL; - #[cfg(target_arch = "x86")] - pub fn InterlockedCompareExchange( - Destination: *mut LONG, ExChange: LONG, Comperand: LONG, - ) -> LONG; - #[cfg(target_arch = "x86")] - pub fn InterlockedCompareExchange64( - Destination: *mut LONG64, ExChange: LONG64, Comperand: LONG64, - ) -> LONG64; - #[cfg(target_arch = "x86")] - pub fn InterlockedDecrement(Addend: *mut LONG) -> LONG; - #[cfg(target_arch = "x86")] - pub fn InterlockedExchange(Target: *mut LONG, Value: LONG) -> LONG; - #[cfg(target_arch = "x86")] - pub fn InterlockedExchangeAdd(Addend: *mut LONG, Value: LONG) -> LONG; - pub fn InterlockedFlushSList(ListHead: PSLIST_HEADER) -> PSLIST_ENTRY; - #[cfg(target_arch = "x86")] - pub fn InterlockedIncrement(Addend: *mut LONG) -> LONG; - pub fn InterlockedPopEntrySList(ListHead: PSLIST_HEADER) -> PSLIST_ENTRY; - pub fn InterlockedPushEntrySList( - ListHead: PSLIST_HEADER, ListEntry: PSLIST_ENTRY, - ) -> PSLIST_ENTRY; - pub fn InterlockedPushListSListEx( - ListHead: PSLIST_HEADER, List: PSLIST_ENTRY, ListEnd: PSLIST_ENTRY, Count: ULONG, - ) -> PSLIST_ENTRY; - pub fn IsBadCodePtr(lpfn: FARPROC) -> BOOL; - pub fn IsBadHugeReadPtr(lp: *const VOID, ucb: UINT_PTR) -> BOOL; - pub fn IsBadHugeWritePtr(lp: LPVOID, ucb: UINT_PTR) -> BOOL; - pub fn IsBadReadPtr(lp: *const VOID, ucb: UINT_PTR) -> BOOL; - pub fn IsBadStringPtrA(lpsz: LPCSTR, ucchMax: UINT_PTR) -> BOOL; - pub fn IsBadStringPtrW(lpsz: LPCWSTR, ucchMax: UINT_PTR) -> BOOL; - pub fn IsBadWritePtr(lp: LPVOID, ucb: UINT_PTR) -> BOOL; - pub fn IsDBCSLeadByte(TestChar: BYTE) -> BOOL; - pub fn IsDBCSLeadByteEx(CodePage: UINT, TestChar: BYTE) -> BOOL; - pub fn IsDebuggerPresent() -> BOOL; - pub fn IsNLSDefinedString( - Function: NLS_FUNCTION, dwFlags: DWORD, lpVersionInformation: LPNLSVERSIONINFO, - lpString: LPCWSTR, cchStr: INT, - ) -> BOOL; - pub fn IsNativeVhdBoot(NativeVhdBoot: PBOOL) -> BOOL; - pub fn IsNormalizedString(NormForm: NORM_FORM, lpString: LPCWSTR, cwLength: c_int) -> BOOL; - pub fn IsProcessCritical(hProcess: HANDLE, Critical: PBOOL) -> BOOL; - pub fn IsProcessInJob(ProcessHandle: HANDLE, JobHandle: HANDLE, Result: PBOOL) -> BOOL; - pub fn IsProcessorFeaturePresent(ProcessorFeature: DWORD) -> BOOL; - pub fn IsSystemResumeAutomatic() -> BOOL; - pub fn IsThreadAFiber() -> BOOL; - pub fn IsThreadpoolTimerSet(pti: PTP_TIMER) -> BOOL; - pub fn IsValidCodePage(CodePage: UINT) -> BOOL; - pub fn IsValidLanguageGroup(LanguageGroup: LGRPID, dwFlags: DWORD) -> BOOL; - pub fn IsValidLocale(Locale: LCID, dwFlags: DWORD) -> BOOL; - pub fn IsValidLocaleName(lpLocaleName: LPCWSTR) -> BOOL; - pub fn IsValidNLSVersion( - function: NLS_FUNCTION, lpLocaleName: LPCWSTR, lpVersionInformation: LPNLSVERSIONINFOEX, - ) -> BOOL; - pub fn IsWow64Process(hProcess: HANDLE, Wow64Process: PBOOL) -> BOOL; - pub fn K32EmptyWorkingSet(hProcess: HANDLE) -> BOOL; - pub fn K32EnumDeviceDrivers(lpImageBase: *mut LPVOID, cb: DWORD, lpcbNeeded: LPDWORD) -> BOOL; - pub fn K32EnumPageFilesA( - pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKA, pContext: LPVOID, - ) -> BOOL; - pub fn K32EnumPageFilesW( - pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKW, pContext: LPVOID, - ) -> BOOL; - pub fn K32EnumProcessModules( - hProcess: HANDLE, lphModule: *mut HMODULE, cb: DWORD, lpcbNeeded: LPDWORD, - ) -> BOOL; - pub fn K32EnumProcessModulesEx( - hProcess: HANDLE, lphModule: *mut HMODULE, cb: DWORD, lpcbNeeded: LPDWORD, - dwFilterFlag: DWORD, - ) -> BOOL; - pub fn K32EnumProcesses( - lpidProcess: *mut DWORD, cb: DWORD, lpcbNeeded: LPDWORD, - ) -> BOOL; - pub fn K32GetDeviceDriverBaseNameA(ImageBase: LPVOID, lpFilename: LPSTR, nSize: DWORD) -> DWORD; - pub fn K32GetDeviceDriverBaseNameW( - ImageBase: LPVOID, lpFilename: LPWSTR, nSize: DWORD, - ) -> DWORD; - pub fn K32GetDeviceDriverFileNameA(ImageBase: LPVOID, lpFilename: LPSTR, nSize: DWORD) -> DWORD; - pub fn K32GetDeviceDriverFileNameW( - ImageBase: LPVOID, lpFilename: LPWSTR, nSize: DWORD, - ) -> DWORD; - pub fn K32GetMappedFileNameA( - hProcess: HANDLE, lpv: LPVOID, lpFilename: LPSTR, nSize: DWORD, - ) -> DWORD; - pub fn K32GetMappedFileNameW( - hProcess: HANDLE, lpv: LPVOID, lpFilename: LPWSTR, nSize: DWORD, - ) -> DWORD; - pub fn K32GetModuleBaseNameA( - hProcess: HANDLE, hModule: HMODULE, lpBaseName: LPSTR, nSize: DWORD, - ) -> DWORD; - pub fn K32GetModuleBaseNameW( - hProcess: HANDLE, hModule: HMODULE, lpBaseName: LPWSTR, nSize: DWORD, - ) -> DWORD; - pub fn K32GetModuleFileNameExA( - hProcess: HANDLE, hModule: HMODULE, lpFilename: LPSTR, nSize: DWORD, - ) -> DWORD; - pub fn K32GetModuleFileNameExW( - hProcess: HANDLE, hModule: HMODULE, lpFilename: LPWSTR, nSize: DWORD, - ) -> DWORD; - pub fn K32GetModuleInformation( - hProcess: HANDLE, hModule: HMODULE, lpmodinfo: LPMODULEINFO, cb: DWORD, - ) -> BOOL; - pub fn K32GetPerformanceInfo( - pPerformanceInformation: PPERFORMANCE_INFORMATION, cb: DWORD, - ) -> BOOL; - pub fn K32GetProcessImageFileNameA( - hProcess: HANDLE, lpImageFileName: LPSTR, nSize: DWORD, - ) -> DWORD; - pub fn K32GetProcessImageFileNameW( - hProcess: HANDLE, lpImageFileName: LPWSTR, nSize: DWORD, - ) -> DWORD; - pub fn K32GetProcessMemoryInfo( - Process: HANDLE, ppsmemCounters: PPROCESS_MEMORY_COUNTERS, cb: DWORD, - ) -> BOOL; - pub fn K32GetWsChanges( - hProcess: HANDLE, lpWatchInfo: PPSAPI_WS_WATCH_INFORMATION, cb: DWORD, - ) -> BOOL; - pub fn K32GetWsChangesEx( - hProcess: HANDLE, lpWatchInfoEx: PPSAPI_WS_WATCH_INFORMATION_EX, cb: PDWORD, - ) -> BOOL; - pub fn K32InitializeProcessForWsWatch(hProcess: HANDLE) -> BOOL; - pub fn K32QueryWorkingSet(hProcess: HANDLE, pv: PVOID, cb: DWORD) -> BOOL; - pub fn K32QueryWorkingSetEx(hProcess: HANDLE, pv: PVOID, cb: DWORD) -> BOOL; - pub fn LCIDToLocaleName(Locale: LCID, lpName: LPWSTR, cchName: c_int, dwFlags: DWORD) -> c_int; - pub fn LCMapStringA( - Locale: LCID, dwMapFlags: DWORD, lpSrcStr: LPCSTR, cchSrc: c_int, lpDestStr: LPSTR, - cchDest: c_int, - ) -> c_int; - pub fn LCMapStringEx( - lpLocaleName: LPCWSTR, dwMapFlags: DWORD, lpSrcStr: LPCWSTR, cchSrc: c_int, - lpDestStr: LPWSTR, cchDest: c_int, lpVersionInformation: LPNLSVERSIONINFO, - lpReserved: LPVOID, sortHandle: LPARAM, - ) -> c_int; - pub fn LCMapStringW( - Locale: LCID, dwMapFlags: DWORD, lpSrcStr: LPCWSTR, cchSrc: c_int, lpDestStr: LPWSTR, - cchDest: c_int, - ) -> c_int; - pub fn LeaveCriticalSection(lpCriticalSection: LPCRITICAL_SECTION); - pub fn LeaveCriticalSectionWhenCallbackReturns( - pci: PTP_CALLBACK_INSTANCE, pcs: PCRITICAL_SECTION, - ); - // pub fn LoadAppInitDlls(); - pub fn LoadLibraryA(lpFileName: LPCSTR) -> HMODULE; - pub fn LoadLibraryExA(lpLibFileName: LPCSTR, hFile: HANDLE, dwFlags: DWORD) -> HMODULE; - pub fn LoadLibraryExW(lpLibFileName: LPCWSTR, hFile: HANDLE, dwFlags: DWORD) -> HMODULE; - pub fn LoadLibraryW(lpFileName: LPCWSTR) -> HMODULE; - pub fn LoadModule(lpModuleName: LPCSTR, lpParameterBlock: LPVOID) -> DWORD; - pub fn LoadPackagedLibrary(lpwLibFileName: LPCWSTR, Reserved: DWORD) -> HMODULE; - pub fn LoadResource(hModule: HMODULE, hResInfo: HRSRC) -> HGLOBAL; - // pub fn LoadStringBaseExW(); - // pub fn LoadStringBaseW(); - pub fn LocalAlloc(uFlags: UINT, uBytes: SIZE_T) -> HLOCAL; - pub fn LocalCompact(uMinFree: UINT) -> SIZE_T; - pub fn LocalFileTimeToFileTime( - lpLocalFileTime: *const FILETIME, lpFileTime: LPFILETIME, - ) -> BOOL; - pub fn LocalFlags(hMem: HLOCAL) -> UINT; - pub fn LocalFree(hMem: HLOCAL) -> HLOCAL; - pub fn LocalHandle(pMem: LPCVOID) -> HLOCAL; - pub fn LocalLock(hMem: HLOCAL) -> LPVOID; - pub fn LocalReAlloc(hMem: HLOCAL, uBytes: SIZE_T, uFlags: UINT) -> HLOCAL; - pub fn LocalShrink(hMem: HLOCAL, cbNewSize: UINT) -> SIZE_T; - pub fn LocalSize(hMem: HLOCAL) -> SIZE_T; - pub fn LocalUnlock(hMem: HLOCAL) -> BOOL; - pub fn LocaleNameToLCID(lpName: LPCWSTR, dwFlags: DWORD) -> LCID; - #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] - pub fn LocateXStateFeature(Context: PCONTEXT, FeatureId: DWORD, Length: PDWORD) -> PVOID; - pub fn LockFile( - hFile: HANDLE, dwFileOffsetLow: DWORD, dwFileOffsetHigh: DWORD, - nNumberOfBytesToLockLow: DWORD, nNumberOfBytesToLockHigh: DWORD, - ) -> BOOL; - pub fn LockFileEx( - hFile: HANDLE, dwFlags: DWORD, dwReserved: DWORD, nNumberOfBytesToLockLow: DWORD, - nNumberOfBytesToLockHigh: DWORD, lpOverlapped: LPOVERLAPPED, - ) -> BOOL; - pub fn LockResource(hResData: HGLOBAL) -> LPVOID; - pub fn MapUserPhysicalPages( - VirtualAddress: PVOID, NumberOfPages: ULONG_PTR, PageArray: PULONG_PTR, - ) -> BOOL; - pub fn MapUserPhysicalPagesScatter( - VirtualAddresses: *mut PVOID, NumberOfPages: ULONG_PTR, PageArray: PULONG_PTR, - ) -> BOOL; - pub fn MapViewOfFile( - hFileMappingObject: HANDLE, dwDesiredAccess: DWORD, dwFileOffsetHigh: DWORD, - dwFileOffsetLow: DWORD, dwNumberOfBytesToMap: SIZE_T, - ) -> LPVOID; - pub fn MapViewOfFileEx( - hFileMappingObject: HANDLE, dwDesiredAccess: DWORD, dwFileOffsetHigh: DWORD, - dwFileOffsetLow: DWORD, dwNumberOfBytesToMap: SIZE_T, lpBaseAddress: LPVOID, - ) -> LPVOID; - pub fn MapViewOfFileExNuma( - hFileMappingObject: HANDLE, dwDesiredAccess: DWORD, dwFileOffsetHigh: DWORD, - dwFileOffsetLow: DWORD, dwNumberOfBytesToMap: SIZE_T, lpBaseAddress: LPVOID, - nndPreferred: DWORD, - ) -> LPVOID; - pub fn MapViewOfFileFromApp( - hFileMappingObject: HANDLE, DesiredAccess: ULONG, FileOffset: ULONG64, - NumberOfBytesToMap: SIZE_T, - ) -> PVOID; - pub fn Module32First(hSnapshot: HANDLE, lpme: LPMODULEENTRY32) -> BOOL; - pub fn Module32FirstW(hSnapshot: HANDLE, lpme: LPMODULEENTRY32W) -> BOOL; - pub fn Module32Next(hSnapshot: HANDLE, lpme: LPMODULEENTRY32) -> BOOL; - pub fn Module32NextW(hSnapshot: HANDLE, lpme: LPMODULEENTRY32W) -> BOOL; - pub fn MoveFileA(lpExistingFileName: LPCSTR, lpNewFileName: LPCSTR) -> BOOL; - pub fn MoveFileExA(lpExistingFileName: LPCSTR, lpNewFileName: LPCSTR, dwFlags: DWORD) -> BOOL; - pub fn MoveFileExW(lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, dwFlags: DWORD) -> BOOL; - pub fn MoveFileTransactedA( - lpExistingFileName: LPCSTR, lpNewFileName: LPCSTR, lpProgressRoutine: LPPROGRESS_ROUTINE, - lpData: LPVOID, dwFlags: DWORD, hTransaction: HANDLE, - ) -> BOOL; - pub fn MoveFileTransactedW( - lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, lpProgressRoutine: LPPROGRESS_ROUTINE, - lpData: LPVOID, dwFlags: DWORD, hTransaction: HANDLE, - ) -> BOOL; - pub fn MoveFileW(lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR) -> BOOL; - pub fn MoveFileWithProgressA( - lpExistingFileName: LPCSTR, lpNewFileName: LPCSTR, lpProgressRoutine: LPPROGRESS_ROUTINE, - lpData: LPVOID, dwFlags: DWORD, - ) -> BOOL; - pub fn MoveFileWithProgressW( - lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, lpProgressRoutine: LPPROGRESS_ROUTINE, - lpData: LPVOID, dwFlags: DWORD, - ) -> BOOL; - pub fn MulDiv(nNumber: c_int, nNumerator: c_int, nDenominator: c_int) -> c_int; - pub fn MultiByteToWideChar( - CodePage: UINT, dwFlags: DWORD, lpMultiByteStr: LPCSTR, cbMultiByte: c_int, - lpWideCharStr: LPWSTR, cchWideChar: c_int, - ) -> c_int; - pub fn NeedCurrentDirectoryForExePathA(ExeName: LPCSTR) -> BOOL; - pub fn NeedCurrentDirectoryForExePathW(ExeName: LPCWSTR) -> BOOL; - pub fn NormalizeString( - NormForm: NORM_FORM, lpSrcString: LPCWSTR, cwSrcLength: c_int, lpDstString: LPWSTR, - cwDstLength: c_int, - ) -> c_int; - // pub fn NotifyMountMgr(); - pub fn NotifyUILanguageChange( - dwFlags: DWORD, pcwstrNewLanguage: PCWSTR, pcwstrPreviousLanguage: PCWSTR, - dwReserved: DWORD, pdwStatusRtrn: PDWORD, - ) -> BOOL; - // pub fn OOBEComplete(); - pub fn OpenEventA(dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCSTR) -> HANDLE; - pub fn OpenEventW(dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCWSTR) -> HANDLE; - pub fn OpenFile(lpFileName: LPCSTR, lpReOpenBuff: LPOFSTRUCT, uStyle: UINT) -> HFILE; - pub fn OpenFileById( - hVolumeHint: HANDLE, lpFileId: LPFILE_ID_DESCRIPTOR, dwDesiredAccess: DWORD, - dwShareMode: DWORD, lpSecurityAttributes: LPSECURITY_ATTRIBUTES, - dwFlagsAndAttributes: DWORD, - ) -> HANDLE; - pub fn OpenFileMappingA( - dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCSTR, - ) -> HANDLE; - pub fn OpenFileMappingW( - dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCWSTR, - ) -> HANDLE; - pub fn OpenJobObjectA(dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCSTR) -> HANDLE; - pub fn OpenJobObjectW(dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCWSTR) -> HANDLE; - pub fn OpenMutexA(dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCSTR) -> HANDLE; - pub fn OpenMutexW(dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCWSTR) -> HANDLE; - // pub fn OpenPackageInfoByFullName(); - pub fn OpenPrivateNamespaceA(lpBoundaryDescriptor: LPVOID, lpAliasPrefix: LPCSTR) -> HANDLE; - pub fn OpenPrivateNamespaceW(lpBoundaryDescriptor: LPVOID, lpAliasPrefix: LPCWSTR) -> HANDLE; - pub fn OpenProcess(dwDesiredAccess: DWORD, bInheritHandle: BOOL, dwProcessId: DWORD) -> HANDLE; - pub fn OpenSemaphoreA(dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCSTR) -> HANDLE; - pub fn OpenSemaphoreW(dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: LPCWSTR) -> HANDLE; - // pub fn OpenState(); - // pub fn OpenStateExplicit(); - pub fn OpenThread(dwDesiredAccess: DWORD, bInheritHandle: BOOL, dwThreadId: DWORD) -> HANDLE; - pub fn OpenWaitableTimerA( - dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpTimerName: LPCSTR, - ) -> HANDLE; - pub fn OpenWaitableTimerW( - dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpTimerName: LPCWSTR, - ) -> HANDLE; - pub fn OutputDebugStringA(lpOutputString: LPCSTR); - pub fn OutputDebugStringW(lpOutputString: LPCWSTR); - // pub fn PackageFamilyNameFromFullName(); - // pub fn PackageFamilyNameFromId(); - // pub fn PackageFullNameFromId(); - // pub fn PackageIdFromFullName(); - // pub fn PackageNameAndPublisherIdFromFamilyName(); - // pub fn ParseApplicationUserModelId(); - pub fn PeekConsoleInputA( - hConsoleInput: HANDLE, lpBuffer: PINPUT_RECORD, nLength: DWORD, - lpNumberOfEventsRead: LPDWORD, - ) -> BOOL; - pub fn PeekConsoleInputW( - hConsoleInput: HANDLE, lpBuffer: PINPUT_RECORD, nLength: DWORD, - lpNumberOfEventsRead: LPDWORD, - ) -> BOOL; - pub fn PeekNamedPipe( - hNamedPipe: HANDLE, lpBuffer: LPVOID, nBufferSize: DWORD, lpBytesRead: LPDWORD, - lpTotalBytesAvail: LPDWORD, lpBytesLeftThisMessage: LPDWORD, - ) -> BOOL; - pub fn PostQueuedCompletionStatus( - CompletionPort: HANDLE, dwNumberOfBytesTransferred: DWORD, dwCompletionKey: ULONG_PTR, - lpOverlapped: LPOVERLAPPED, - ) -> BOOL; - pub fn PowerClearRequest(PowerRequest: HANDLE, RequestType: POWER_REQUEST_TYPE) -> BOOL; - pub fn PowerCreateRequest(Context: PREASON_CONTEXT) -> HANDLE; - pub fn PowerSetRequest(PowerRequest: HANDLE, RequestType: POWER_REQUEST_TYPE) -> BOOL; - pub fn PrefetchVirtualMemory( - hProcess: HANDLE, NumberOfEntries: ULONG_PTR, VirtualAddresses: PWIN32_MEMORY_RANGE_ENTRY, - Flags: ULONG, - ) -> BOOL; - pub fn PrepareTape(hDevice: HANDLE, dwOperation: DWORD, bImmediate: BOOL) -> DWORD; - pub fn Process32First(hSnapshot: HANDLE, lppe: LPPROCESSENTRY32) -> BOOL; - pub fn Process32FirstW(hSnapshot: HANDLE, lppe: LPPROCESSENTRY32W) -> BOOL; - pub fn Process32Next(hSnapshot: HANDLE, lppe: LPPROCESSENTRY32) -> BOOL; - pub fn Process32NextW(hSnapshot: HANDLE, lppe: LPPROCESSENTRY32W) -> BOOL; - pub fn ProcessIdToSessionId(dwProcessId: DWORD, pSessionId: *mut DWORD) -> BOOL; - pub fn PssCaptureSnapshot( - ProcessHandle: HANDLE, CaptureFlags: PSS_CAPTURE_FLAGS, ThreadContextFlags: DWORD, - SnapshotHandle: *mut HPSS, - ) -> DWORD; - pub fn PssDuplicateSnapshot( - SourceProcessHandle: HANDLE, SnapshotHandle: HPSS, TargetProcessHandle: HANDLE, - TargetSnapshotHandle: *mut HPSS, Flags: PSS_DUPLICATE_FLAGS, - ) -> DWORD; - pub fn PssFreeSnapshot(ProcessHandle: HANDLE, SnapshotHandle: HPSS) -> DWORD; - pub fn PssQuerySnapshot( - SnapshotHandle: HPSS, InformationClass: PSS_QUERY_INFORMATION_CLASS, Buffer: *mut c_void, - BufferLength: DWORD, - ) -> DWORD; - pub fn PssWalkMarkerCreate( - Allocator: *const PSS_ALLOCATOR, WalkMarkerHandle: *mut HPSSWALK, - ) -> DWORD; - pub fn PssWalkMarkerFree(WalkMarkerHandle: HPSSWALK) -> DWORD; - pub fn PssWalkMarkerGetPosition(WalkMarkerHandle: HPSSWALK, Position: *mut ULONG_PTR) -> DWORD; - // pub fn PssWalkMarkerRewind(); - // pub fn PssWalkMarkerSeek(); - pub fn PssWalkMarkerSeekToBeginning(WalkMarkerHandle: HPSS) -> DWORD; - pub fn PssWalkMarkerSetPosition(WalkMarkerHandle: HPSSWALK, Position: ULONG_PTR) -> DWORD; - // pub fn PssWalkMarkerTell(); - pub fn PssWalkSnapshot( - SnapshotHandle: HPSS, InformationClass: PSS_WALK_INFORMATION_CLASS, - WalkMarkerHandle: HPSSWALK, Buffer: *mut c_void, BufferLength: DWORD, - ) -> DWORD; - pub fn PulseEvent(hEvent: HANDLE) -> BOOL; - pub fn PurgeComm(hFile: HANDLE, dwFlags: DWORD) -> BOOL; - pub fn QueryActCtxSettingsW( - dwFlags: DWORD, hActCtx: HANDLE, settingsNameSpace: PCWSTR, settingName: PCWSTR, - pvBuffer: PWSTR, dwBuffer: SIZE_T, pdwWrittenOrRequired: *mut SIZE_T, - ) -> BOOL; - pub fn QueryActCtxW( - dwFlags: DWORD, hActCtx: HANDLE, pvSubInstance: PVOID, ulInfoClass: ULONG, pvBuffer: PVOID, - cbBuffer: SIZE_T, pcbWrittenOrRequired: *mut SIZE_T, - ) -> BOOL; - pub fn QueryDepthSList(ListHead: PSLIST_HEADER) -> USHORT; - pub fn QueryDosDeviceA(lpDeviceName: LPCSTR, lpTargetPath: LPSTR, ucchMax: DWORD) -> DWORD; - pub fn QueryDosDeviceW(lpDeviceName: LPCWSTR, lpTargetPath: LPWSTR, ucchMax: DWORD) -> DWORD; - pub fn QueryFullProcessImageNameA( - hProcess: HANDLE, dwFlags: DWORD, lpExeName: LPSTR, lpdwSize: PDWORD, - ) -> BOOL; - pub fn QueryFullProcessImageNameW( - hProcess: HANDLE, dwFlags: DWORD, lpExeName: LPWSTR, lpdwSize: PDWORD, - ) -> BOOL; - pub fn QueryIdleProcessorCycleTime( - BufferLength: PULONG, ProcessorIdleCycleTime: PULONG64, - ) -> BOOL; - pub fn QueryIdleProcessorCycleTimeEx( - Group: USHORT, BufferLength: PULONG, ProcessorIdleCycleTime: PULONG64, - ) -> BOOL; - pub fn QueryInformationJobObject( - hJob: HANDLE, JobObjectInformationClass: JOBOBJECTINFOCLASS, - lpJobObjectInformation: LPVOID, cbJobObjectInformationLength: DWORD, - lpReturnLength: LPDWORD, - ) -> BOOL; - pub fn QueryMemoryResourceNotification( - ResourceNotificationHandle: HANDLE, ResourceState: PBOOL, - ) -> BOOL; - pub fn QueryPerformanceCounter(lpPerformanceCount: *mut LARGE_INTEGER) -> BOOL; - pub fn QueryPerformanceFrequency(lpFrequency: *mut LARGE_INTEGER) -> BOOL; - pub fn QueryProcessAffinityUpdateMode(hProcess: HANDLE, lpdwFlags: LPDWORD) -> BOOL; - pub fn QueryProcessCycleTime(ProcessHandle: HANDLE, CycleTime: PULONG64) -> BOOL; - pub fn QueryProtectedPolicy(PolicyGuid: LPCGUID, PolicyValue: PULONG_PTR) -> BOOL; - pub fn QueryThreadCycleTime(ThreadHandle: HANDLE, CycleTime: PULONG64) -> BOOL; - pub fn QueryThreadProfiling(ThreadHandle: HANDLE, Enabled: PBOOLEAN) -> DWORD; - pub fn QueryThreadpoolStackInformation( - ptpp: PTP_POOL, ptpsi: PTP_POOL_STACK_INFORMATION, - ) -> BOOL; - #[cfg(target_arch = "x86_64")] - pub fn QueryUmsThreadInformation( - UmsThread: PUMS_CONTEXT, UmsThreadInfoClass: UMS_THREAD_INFO_CLASS, - UmsThreadInformation: PVOID, UmsThreadInformationLength: ULONG, ReturnLength: PULONG, - ) -> BOOL; - pub fn QueryUnbiasedInterruptTime(UnbiasedTime: PULONGLONG) -> BOOL; - pub fn QueueUserAPC(pfnAPC: PAPCFUNC, hThread: HANDLE, dwData: ULONG_PTR) -> DWORD; - pub fn QueueUserWorkItem( - Function: LPTHREAD_START_ROUTINE, Context: PVOID, Flags: ULONG, - ) -> BOOL; - pub fn RaiseException( - dwExceptionCode: DWORD, dwExceptionFlags: DWORD, nNumberOfArguments: DWORD, - lpArguments: *const ULONG_PTR, - ); - pub fn RaiseFailFastException( - pExceptionRecord: PEXCEPTION_RECORD, pContextRecord: PCONTEXT, dwFlags: DWORD, - ); - pub fn ReOpenFile( - hOriginalFile: HANDLE, dwDesiredAccess: DWORD, dwShareMode: DWORD, dwFlags: DWORD, - ) -> HANDLE; - pub fn ReadConsoleA( - hConsoleInput: HANDLE, lpBuffer: LPVOID, nNumberOfCharsToRead: DWORD, - lpNumberOfCharsRead: LPDWORD, pInputControl: PCONSOLE_READCONSOLE_CONTROL, - ) -> BOOL; - pub fn ReadConsoleInputA( - hConsoleInput: HANDLE, lpBuffer: PINPUT_RECORD, nLength: DWORD, - lpNumberOfEventsRead: LPDWORD, - ) -> BOOL; - pub fn ReadConsoleInputW( - hConsoleInput: HANDLE, lpBuffer: PINPUT_RECORD, nLength: DWORD, - lpNumberOfEventsRead: LPDWORD, - ) -> BOOL; - pub fn ReadConsoleOutputA( - hConsoleOutput: HANDLE, lpBuffer: PCHAR_INFO, dwBufferSize: COORD, dwBufferCoord: COORD, - lpReadRegion: PSMALL_RECT, - ) -> BOOL; - pub fn ReadConsoleOutputAttribute( - hConsoleOutput: HANDLE, lpAttribute: LPWORD, nLength: DWORD, dwReadCoord: COORD, - lpNumberOfAttrsRead: LPDWORD, - ) -> BOOL; - pub fn ReadConsoleOutputCharacterA( - hConsoleOutput: HANDLE, lpCharacter: LPSTR, nLength: DWORD, dwReadCoord: COORD, - lpNumberOfCharsRead: LPDWORD, - ) -> BOOL; - pub fn ReadConsoleOutputCharacterW( - hConsoleOutput: HANDLE, lpCharacter: LPWSTR, nLength: DWORD, dwReadCoord: COORD, - lpNumberOfCharsRead: LPDWORD, - ) -> BOOL; - pub fn ReadConsoleOutputW( - hConsoleOutput: HANDLE, lpBuffer: PCHAR_INFO, dwBufferSize: COORD, dwBufferCoord: COORD, - lpReadRegion: PSMALL_RECT, - ) -> BOOL; - pub fn ReadConsoleW( - hConsoleInput: HANDLE, lpBuffer: LPVOID, nNumberOfCharsToRead: DWORD, - lpNumberOfCharsRead: LPDWORD, pInputControl: PCONSOLE_READCONSOLE_CONTROL, - ) -> BOOL; - pub fn ReadDirectoryChangesW( - hDirectory: HANDLE, lpBuffer: LPVOID, nBufferLength: DWORD, bWatchSubtree: BOOL, - dwNotifyFilter: DWORD, lpBytesReturned: LPDWORD, lpOverlapped: LPOVERLAPPED, - lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, - ) -> BOOL; - pub fn ReadFile( - hFile: HANDLE, lpBuffer: LPVOID, nNumberOfBytesToRead: DWORD, lpNumberOfBytesRead: LPDWORD, - lpOverlapped: LPOVERLAPPED, - ) -> BOOL; - pub fn ReadFileEx( - hFile: HANDLE, lpBuffer: LPVOID, nNumberOfBytesToRead: DWORD, lpOverlapped: LPOVERLAPPED, - lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, - ) -> BOOL; - pub fn ReadFileScatter( - hFile: HANDLE, aSegmentArray: *mut FILE_SEGMENT_ELEMENT, nNumberOfBytesToRead: DWORD, - lpReserved: LPDWORD, lpOverlapped: LPOVERLAPPED, - ) -> BOOL; - pub fn ReadProcessMemory( - hProcess: HANDLE, lpBaseAddress: LPCVOID, lpBuffer: LPVOID, nSize: SIZE_T, - lpNumberOfBytesRead: *mut SIZE_T, - ) -> BOOL; - pub fn ReadThreadProfilingData( - PerformanceDataHandle: HANDLE, Flags: DWORD, PerformanceData: PPERFORMANCE_DATA, - ) -> DWORD; - pub fn RegisterApplicationRecoveryCallback( - pRecoveyCallback: APPLICATION_RECOVERY_CALLBACK, pvParameter: PVOID, dwPingInterval: DWORD, - dwFlags: DWORD, - ) -> HRESULT; - pub fn RegisterApplicationRestart(pwzCommandline: PCWSTR, dwFlags: DWORD) -> HRESULT; - pub fn RegisterBadMemoryNotification(Callback: PBAD_MEMORY_CALLBACK_ROUTINE) -> PVOID; - // pub fn RegisterWaitForInputIdle(); - pub fn RegisterWaitForSingleObject( - phNewWaitObject: PHANDLE, hObject: HANDLE, Callback: WAITORTIMERCALLBACK, Context: PVOID, - dwMilliseconds: ULONG, dwFlags: ULONG, - ) -> BOOL; - pub fn RegisterWaitForSingleObjectEx( - hObject: HANDLE, Callback: WAITORTIMERCALLBACK, Context: PVOID, dwMilliseconds: ULONG, - dwFlags: ULONG, - ) -> HANDLE; - // pub fn RegisterWaitUntilOOBECompleted(); - pub fn ReleaseActCtx(hActCtx: HANDLE); - pub fn ReleaseMutex(hMutex: HANDLE) -> BOOL; - pub fn ReleaseMutexWhenCallbackReturns(pci: PTP_CALLBACK_INSTANCE, mutex: HANDLE); - pub fn ReleaseSRWLockExclusive(SRWLock: PSRWLOCK); - pub fn ReleaseSRWLockShared(SRWLock: PSRWLOCK); - pub fn ReleaseSemaphore( - hSemaphore: HANDLE, lReleaseCount: LONG, lpPreviousCount: LPLONG, - ) -> BOOL; - pub fn ReleaseSemaphoreWhenCallbackReturns( - pci: PTP_CALLBACK_INSTANCE, sem: HANDLE, crel: DWORD, - ); - pub fn RemoveDirectoryA(lpPathName: LPCSTR) -> BOOL; - pub fn RemoveDirectoryTransactedA(lpPathName: LPCSTR, hTransaction: HANDLE) -> BOOL; - pub fn RemoveDirectoryTransactedW(lpPathName: LPCWSTR, hTransaction: HANDLE) -> BOOL; - pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL; - pub fn RemoveDllDirectory(Cookie: DLL_DIRECTORY_COOKIE) -> BOOL; - // pub fn RemoveLocalAlternateComputerNameA(); - // pub fn RemoveLocalAlternateComputerNameW(); - pub fn RemoveSecureMemoryCacheCallback(pfnCallBack: PSECURE_MEMORY_CACHE_CALLBACK) -> BOOL; - pub fn RemoveVectoredContinueHandler(Handle: PVOID) -> ULONG; - pub fn RemoveVectoredExceptionHandler(Handle: PVOID) -> ULONG; - pub fn ReplaceFileA( - lpReplacedFileName: LPCSTR, lpReplacementFileName: LPCSTR, lpBackupFileName: LPCSTR, - dwReplaceFlags: DWORD, lpExclude: LPVOID, lpReserved: LPVOID, - ); - pub fn ReplaceFileW( - lpReplacedFileName: LPCWSTR, lpReplacementFileName: LPCWSTR, lpBackupFileName: LPCWSTR, - dwReplaceFlags: DWORD, lpExclude: LPVOID, lpReserved: LPVOID, - ); - pub fn ReplacePartitionUnit( - TargetPartition: PWSTR, SparePartition: PWSTR, Flags: ULONG, - ) -> BOOL; - pub fn RequestDeviceWakeup(hDevice: HANDLE) -> BOOL; - pub fn RequestWakeupLatency(latency: LATENCY_TIME) -> BOOL; - pub fn ResetEvent(hEvent: HANDLE) -> BOOL; - pub fn ResetWriteWatch(lpBaseAddress: LPVOID, dwRegionSize: SIZE_T) -> UINT; - // pub fn ResolveDelayLoadedAPI(); - // pub fn ResolveDelayLoadsFromDll(); - pub fn ResolveLocaleName( - lpNameToResolve: LPCWSTR, lpLocaleName: LPWSTR, cchLocaleName: c_int, - ) -> c_int; - pub fn RestoreLastError(dwErrCode: DWORD); - pub fn ResumeThread(hThread: HANDLE) -> DWORD; - #[cfg(target_arch = "arm")] - pub fn RtlAddFunctionTable( - FunctionTable: PRUNTIME_FUNCTION, EntryCount: DWORD, BaseAddress: DWORD, - ) -> BOOLEAN; - #[cfg(target_arch = "x86_64")] - pub fn RtlAddFunctionTable( - FunctionTable: PRUNTIME_FUNCTION, EntryCount: DWORD, BaseAddress: DWORD64, - ) -> BOOLEAN; - pub fn RtlCaptureContext(ContextRecord: PCONTEXT); - pub fn RtlCaptureStackBackTrace( - FramesToSkip: DWORD, FramesToCapture: DWORD, BackTrace: *mut PVOID, BackTraceHash: PDWORD, - ) -> WORD; - // #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] - pub fn RtlCompareMemory(Source1: *const VOID, Source2: *const VOID, Length: SIZE_T) -> SIZE_T; - // #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] - pub fn RtlCopyMemory(Destination: PVOID, Source: *const VOID, Length: SIZE_T); - #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] - pub fn RtlDeleteFunctionTable(FunctionTable: PRUNTIME_FUNCTION) -> BOOLEAN; - // pub fn RtlFillMemory(); - #[cfg(target_arch = "arm")] - pub fn RtlInstallFunctionTableCallback( - TableIdentifier: DWORD, BaseAddress: DWORD, Length: DWORD, - Callback: PGET_RUNTIME_FUNCTION_CALLBACK, Context: PVOID, OutOfProcessCallbackDll: PCWSTR, - ) -> BOOLEAN; - #[cfg(target_arch = "x86_64")] - pub fn RtlInstallFunctionTableCallback( - TableIdentifier: DWORD64, BaseAddress: DWORD64, Length: DWORD, - Callback: PGET_RUNTIME_FUNCTION_CALLBACK, Context: PVOID, OutOfProcessCallbackDll: PCWSTR, - ) -> BOOLEAN; - #[cfg(target_arch = "arm")] - pub fn RtlLookupFunctionEntry( - ControlPc: ULONG_PTR, ImageBase: PDWORD, HistoryTable: PUNWIND_HISTORY_TABLE, - ) -> PRUNTIME_FUNCTION; - #[cfg(target_arch = "x86_64")] - pub fn RtlLookupFunctionEntry( - ControlPc: DWORD64, ImageBase: PDWORD64, HistoryTable: PUNWIND_HISTORY_TABLE, - ) -> PRUNTIME_FUNCTION; - // pub fn RtlMoveMemory(); - // #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] - pub fn RtlPcToFileHeader(PcValue: PVOID, BaseOfImage: *mut PVOID) -> PVOID; - // #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] - // pub fn RtlRaiseException(); - #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] - pub fn RtlRestoreContext(ContextRecord: PCONTEXT, ExceptionRecord: *mut EXCEPTION_RECORD); - pub fn RtlUnwind( - TargetFrame: PVOID, TargetIp: PVOID, ExceptionRecord: PEXCEPTION_RECORD, ReturnValue: PVOID, - ); - #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] - pub fn RtlUnwindEx( - TargetFrame: PVOID, TargetIp: PVOID, ExceptionRecord: PEXCEPTION_RECORD, ReturnValue: PVOID, - ContextRecord: PCONTEXT, HistoryTable: PUNWIND_HISTORY_TABLE, - ); - #[cfg(target_arch = "arm")] - pub fn RtlVirtualUnwind( - HandlerType: DWORD, ImageBase: DWORD, ControlPc: DWORD, FunctionEntry: PRUNTIME_FUNCTION, - ContextRecord: PCONTEXT, HandlerData: *mut PVOID, EstablisherFrame: PDWORD, - ContextPointers: PKNONVOLATILE_CONTEXT_POINTERS, - ) -> PEXCEPTION_ROUTINE; - #[cfg(target_arch = "x86_64")] - pub fn RtlVirtualUnwind( - HandlerType: DWORD, ImageBase: DWORD64, ControlPc: DWORD64, - FunctionEntry: PRUNTIME_FUNCTION, ContextRecord: PCONTEXT, HandlerData: *mut PVOID, - EstablisherFrame: PDWORD64, ContextPointers: PKNONVOLATILE_CONTEXT_POINTERS, - ) -> PEXCEPTION_ROUTINE; - // pub fn RtlZeroMemory(); - pub fn ScrollConsoleScreenBufferA( - hConsoleOutput: HANDLE, lpScrollRectangle: *const SMALL_RECT, - lpClipRectangle: *const SMALL_RECT, dwDestinationOrigin: COORD, lpFill: *const CHAR_INFO, - ) -> BOOL; - pub fn ScrollConsoleScreenBufferW( - hConsoleOutput: HANDLE, lpScrollRectangle: *const SMALL_RECT, - lpClipRectangle: *const SMALL_RECT, dwDestinationOrigin: COORD, lpFill: *const CHAR_INFO, - ) -> BOOL; - pub fn SearchPathA( - lpPath: LPCSTR, lpFileName: LPCSTR, lpExtension: LPCSTR, nBufferLength: DWORD, - lpBuffer: LPSTR, lpFilePart: *mut LPSTR, - ) -> DWORD; - pub fn SearchPathW( - lpPath: LPCWSTR, lpFileName: LPCWSTR, lpExtension: LPCWSTR, nBufferLength: DWORD, - lpBuffer: LPWSTR, lpFilePart: *mut LPWSTR, - ) -> DWORD; - pub fn SetCachedSigningLevel( - SourceFiles: PHANDLE, SourceFileCount: ULONG, Flags: ULONG, TargetFile: HANDLE, - ) -> BOOL; - pub fn SetCalendarInfoA( - Locale: LCID, Calendar: CALID, CalType: CALTYPE, lpCalData: LPCSTR, - ) -> BOOL; - pub fn SetCalendarInfoW( - Locale: LCID, Calendar: CALID, CalType: CALTYPE, lpCalData: LPCWSTR, - ) -> BOOL; - pub fn SetCommBreak(hFile: HANDLE) -> BOOL; - pub fn SetCommConfig(hCommDev: HANDLE, lpCC: LPCOMMCONFIG, dwSize: DWORD) -> BOOL; - pub fn SetCommMask(hFile: HANDLE, dwEvtMask: DWORD) -> BOOL; - pub fn SetCommState(hFile: HANDLE, lpDCB: LPDCB) -> BOOL; - pub fn SetCommTimeouts(hFile: HANDLE, lpCommTimeouts: LPCOMMTIMEOUTS) -> BOOL; - pub fn SetComputerNameA(lpComputerName: LPCSTR) -> BOOL; - pub fn SetComputerNameEx2W( - NameType: COMPUTER_NAME_FORMAT, Flags: DWORD, lpBuffer: LPCWSTR, - ) -> BOOL; - pub fn SetComputerNameExA(NameType: COMPUTER_NAME_FORMAT, lpBuffer: LPCSTR) -> BOOL; - pub fn SetComputerNameExW(NameType: COMPUTER_NAME_FORMAT, lpBuffer: LPCWSTR) -> BOOL; - pub fn SetComputerNameW(lpComputerName: LPCWSTR) -> BOOL; - pub fn SetConsoleActiveScreenBuffer(hConsoleOutput: HANDLE) -> BOOL; - pub fn SetConsoleCP(wCodePageID: UINT) -> BOOL; - pub fn SetConsoleCtrlHandler(HandlerRoutine: PHANDLER_ROUTINE, Add: BOOL) -> BOOL; - // pub fn SetConsoleCursor(); - pub fn SetConsoleCursorInfo( - hConsoleOutput: HANDLE, lpConsoleCursorInfo: *const CONSOLE_CURSOR_INFO, - ) -> BOOL; - pub fn SetConsoleCursorPosition(hConsoleOutput: HANDLE, dwCursorPosition: COORD) -> BOOL; - pub fn SetConsoleDisplayMode( - hConsoleOutput: HANDLE, dwFlags: DWORD, lpNewScreenBufferDimensions: PCOORD, - ) -> BOOL; - pub fn SetConsoleHistoryInfo(lpConsoleHistoryInfo: PCONSOLE_HISTORY_INFO) -> BOOL; - pub fn SetConsoleMode(hConsoleHandle: HANDLE, dwMode: DWORD) -> BOOL; - pub fn SetConsoleOutputCP(wCodePageID: UINT) -> BOOL; - pub fn SetConsoleScreenBufferInfoEx( - hConsoleOutput: HANDLE, lpConsoleScreenBufferInfoEx: PCONSOLE_SCREEN_BUFFER_INFOEX, - ) -> BOOL; - pub fn SetConsoleScreenBufferSize(hConsoleOutput: HANDLE, dwSize: COORD) -> BOOL; - pub fn SetConsoleTextAttribute(hConsoleOutput: HANDLE, wAttributes: WORD) -> BOOL; - pub fn SetConsoleTitleA(lpConsoleTitle: LPCSTR) -> BOOL; - pub fn SetConsoleTitleW(lpConsoleTitle: LPCWSTR) -> BOOL; - pub fn SetConsoleWindowInfo( - hConsoleOutput: HANDLE, bAbsolute: BOOL, lpConsoleWindow: *const SMALL_RECT, - ) -> BOOL; - pub fn SetCriticalSectionSpinCount( - lpCriticalSection: LPCRITICAL_SECTION, dwSpinCount: DWORD, - ) -> DWORD; - pub fn SetCurrentConsoleFontEx( - hConsoleOutput: HANDLE, bMaximumWindow: BOOL, lpConsoleCurrentFontEx: PCONSOLE_FONT_INFOEX, - ) -> BOOL; - pub fn SetCurrentDirectoryA(lpPathName: LPCSTR) -> BOOL; - pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL; - pub fn SetDefaultCommConfigA(lpszName: LPCSTR, lpCC: LPCOMMCONFIG, dwSize: DWORD) -> BOOL; - pub fn SetDefaultCommConfigW(lpszName: LPCWSTR, lpCC: LPCOMMCONFIG, dwSize: DWORD) -> BOOL; - pub fn SetDefaultDllDirectories(DirectoryFlags: DWORD) -> BOOL; - pub fn SetDllDirectoryA(lpPathName: LPCSTR) -> BOOL; - pub fn SetDllDirectoryW(lpPathName: LPCWSTR) -> BOOL; - pub fn SetDynamicTimeZoneInformation( - lpTimeZoneInformation: *const DYNAMIC_TIME_ZONE_INFORMATION, - ) -> BOOL; - pub fn SetEndOfFile(hFile: HANDLE) -> BOOL; - pub fn SetEnvironmentStringsA(NewEnvironment: LPCH) -> BOOL; - pub fn SetEnvironmentStringsW(NewEnvironment: LPWCH) -> BOOL; - pub fn SetEnvironmentVariableA(lpName: LPCSTR, lpValue: LPCSTR) -> BOOL; - pub fn SetEnvironmentVariableW(lpName: LPCWSTR, lpValue: LPCWSTR) -> BOOL; - pub fn SetErrorMode(uMode: UINT) -> UINT; - pub fn SetEvent(hEvent: HANDLE) -> BOOL; - pub fn SetEventWhenCallbackReturns(pci: PTP_CALLBACK_INSTANCE, evt: HANDLE); - pub fn SetFileApisToANSI(); - pub fn SetFileApisToOEM(); - pub fn SetFileAttributesA(lpFileName: LPCSTR, dwFileAttributes: DWORD) -> BOOL; - pub fn SetFileAttributesTransactedA( - lpFileName: LPCSTR, dwFileAttributes: DWORD, hTransaction: HANDLE, - ) -> BOOL; - pub fn SetFileAttributesTransactedW( - lpFileName: LPCWSTR, dwFileAttributes: DWORD, hTransaction: HANDLE, - ) -> BOOL; - pub fn SetFileAttributesW(lpFileName: LPCWSTR, dwFileAttributes: DWORD) -> BOOL; - pub fn SetFileBandwidthReservation( - hFile: HANDLE, nPeriodMilliseconds: DWORD, nBytesPerPeriod: DWORD, bDiscardable: BOOL, - lpTransferSize: LPDWORD, lpNumOutstandingRequests: LPDWORD, - ) -> BOOL; - pub fn SetFileCompletionNotificationModes(FileHandle: HANDLE, Flags: UCHAR) -> BOOL; - pub fn SetFileInformationByHandle( - hFile: HANDLE, FileInformationClass: FILE_INFO_BY_HANDLE_CLASS, lpFileInformation: LPVOID, - dwBufferSize: DWORD, - ) -> BOOL; - pub fn SetFileIoOverlappedRange( - FileHandle: HANDLE, OverlappedRangeStart: PUCHAR, Length: ULONG, - ) -> BOOL; - pub fn SetFilePointer( - hFile: HANDLE, lDistanceToMove: LONG, lpDistanceToMoveHigh: PLONG, dwMoveMethod: DWORD, - ) -> DWORD; - pub fn SetFilePointerEx( - hFile: HANDLE, liDistanceToMove: LARGE_INTEGER, lpNewFilePointer: PLARGE_INTEGER, - dwMoveMethod: DWORD, - ) -> BOOL; - pub fn SetFileShortNameA(hFile: HANDLE, lpShortName: LPCSTR) -> BOOL; - pub fn SetFileShortNameW(hFile: HANDLE, lpShortName: LPCWSTR) -> BOOL; - pub fn SetFileTime( - hFile: HANDLE, lpCreationTime: *const FILETIME, lpLastAccessTime: *const FILETIME, - lpLastWriteTime: *const FILETIME, - ) -> BOOL; - pub fn SetFileValidData(hFile: HANDLE, ValidDataLength: LONGLONG) -> BOOL; - pub fn SetFirmwareEnvironmentVariableA( - lpName: LPCSTR, lpGuid: LPCSTR, pValue: PVOID, nSize: DWORD, - ) -> BOOL; - pub fn SetFirmwareEnvironmentVariableExA( - lpName: LPCSTR, lpGuid: LPCSTR, pValue: PVOID, nSize: DWORD, dwAttributes: DWORD, - ) -> BOOL; - pub fn SetFirmwareEnvironmentVariableExW( - lpName: LPCWSTR, lpGuid: LPCWSTR, pValue: PVOID, nSize: DWORD, dwAttributes: DWORD, - ) -> BOOL; - pub fn SetFirmwareEnvironmentVariableW( - lpName: LPCWSTR, lpGuid: LPCWSTR, pValue: PVOID, nSize: DWORD, - ) -> BOOL; - pub fn SetHandleCount(uNumber: UINT) -> UINT; - pub fn SetHandleInformation(hObject: HANDLE, dwMask: DWORD, dwFlags: DWORD) -> BOOL; - pub fn SetInformationJobObject( - hJob: HANDLE, JobObjectInformationClass: JOBOBJECTINFOCLASS, - lpJobObjectInformation: LPVOID, cbJobObjectInformationLength: DWORD, - ) -> BOOL; - pub fn SetLastError(dwErrCode: DWORD); - // pub fn SetLocalPrimaryComputerNameA(); - // pub fn SetLocalPrimaryComputerNameW(); - pub fn SetLocalTime(lpSystemTime: *const SYSTEMTIME) -> BOOL; - pub fn SetLocaleInfoA(Locale: LCID, LCType: LCTYPE, lpLCData: LPCSTR) -> BOOL; - pub fn SetLocaleInfoW(Locale: LCID, LCType: LCTYPE, lpLCData: LPCWSTR) -> BOOL; - pub fn SetMailslotInfo(hMailslot: HANDLE, lReadTimeout: DWORD) -> BOOL; - pub fn SetMessageWaitingIndicator(hMsgIndicator: HANDLE, ulMsgCount: ULONG) -> BOOL; - pub fn SetNamedPipeAttribute( - Pipe: HANDLE, AttributeType: PIPE_ATTRIBUTE_TYPE, AttributeName: PSTR, - AttributeValue: PVOID, AttributeValueLength: SIZE_T, - ) -> BOOL; - pub fn SetNamedPipeHandleState( - hNamedPipe: HANDLE, lpMode: LPDWORD, lpMaxCollectionCount: LPDWORD, - lpCollectDataTimeout: LPDWORD, - ) -> BOOL; - pub fn SetPriorityClass(hProcess: HANDLE, dwPriorityClass: DWORD) -> BOOL; - pub fn SetProcessAffinityMask(hProcess: HANDLE, dwProcessAffinityMask: DWORD) -> BOOL; - pub fn SetProcessAffinityUpdateMode(hProcess: HANDLE, dwFlags: DWORD) -> BOOL; - pub fn SetProcessDEPPolicy(dwFlags: DWORD) -> BOOL; - pub fn SetProcessInformation( - hProcess: HANDLE, ProcessInformationClass: PROCESS_INFORMATION_CLASS, - ProcessInformation: LPVOID, ProcessInformationSize: DWORD, - ) -> BOOL; - pub fn SetProcessMitigationPolicy( - MitigationPolicy: PROCESS_MITIGATION_POLICY, lpBuffer: PVOID, dwLength: SIZE_T, - ) -> BOOL; - pub fn SetProcessPreferredUILanguages( - dwFlags: DWORD, pwszLanguagesBuffer: PCZZWSTR, pulNumLanguages: PULONG, - ) -> BOOL; - pub fn SetProcessPriorityBoost(hProcess: HANDLE, bDisablePriorityBoost: BOOL) -> BOOL; - pub fn SetProcessShutdownParameters(dwLevel: DWORD, dwFlags: DWORD) -> BOOL; - pub fn SetProcessWorkingSetSize( - hProcess: HANDLE, dwMinimumWorkingSetSize: SIZE_T, dwMaximumWorkingSetSize: SIZE_T, - ) -> BOOL; - pub fn SetProcessWorkingSetSizeEx( - hProcess: HANDLE, dwMinimumWorkingSetSize: SIZE_T, dwMaximumWorkingSetSize: SIZE_T, - Flags: DWORD, - ) -> BOOL; - pub fn SetProtectedPolicy( - PolicyGuid: LPCGUID, PolicyValue: ULONG_PTR, OldPolicyValue: PULONG_PTR, - ) -> BOOL; - pub fn SetSearchPathMode(Flags: DWORD) -> BOOL; - pub fn SetStdHandle(nStdHandle: DWORD, hHandle: HANDLE) -> BOOL; - pub fn SetStdHandleEx(nStdHandle: DWORD, hHandle: HANDLE, phPrevValue: PHANDLE) -> BOOL; - pub fn SetSystemFileCacheSize( - MinimumFileCacheSize: SIZE_T, MaximumFileCacheSize: SIZE_T, Flags: DWORD, - ) -> BOOL; - pub fn SetSystemPowerState(fSuspend: BOOL, fForce: BOOL) -> BOOL; - pub fn SetSystemTime(lpSystemTime: *const SYSTEMTIME) -> BOOL; - pub fn SetSystemTimeAdjustment(dwTimeAdjustment: DWORD, bTimeAdjustmentDisabled: BOOL) -> BOOL; - pub fn SetTapeParameters( - hDevice: HANDLE, dwOperation: DWORD, lpTapeInformation: LPVOID, - ) -> DWORD; - pub fn SetTapePosition( - hDevice: HANDLE, dwPositionMethod: DWORD, dwPartition: DWORD, - dwOffsetLow: DWORD, dwOffsetHigh: DWORD, bImmediate: BOOL - ) -> DWORD; - pub fn SetThreadAffinityMask(hThread: HANDLE, dwThreadAffinityMask: DWORD_PTR) -> DWORD_PTR; - pub fn SetThreadContext(hThread: HANDLE, lpContext: *const CONTEXT) -> BOOL; - pub fn SetThreadErrorMode(dwNewMode: DWORD, lpOldMode: LPDWORD) -> BOOL; - pub fn SetThreadExecutionState(esFlags: EXECUTION_STATE) -> EXECUTION_STATE; - pub fn SetThreadGroupAffinity( - hThread: HANDLE, GroupAffinity: *const GROUP_AFFINITY, - PreviousGroupAffinity: PGROUP_AFFINITY, - ) -> BOOL; - pub fn SetThreadIdealProcessor(hThread: HANDLE, dwIdealProcessor: DWORD) -> DWORD; - pub fn SetThreadIdealProcessorEx( - hThread: HANDLE, lpIdealProcessor: PPROCESSOR_NUMBER, - lpPreviousIdealProcessor: PPROCESSOR_NUMBER, - ) -> BOOL; - pub fn SetThreadInformation( - hThread: HANDLE, ThreadInformationClass: THREAD_INFORMATION_CLASS, - ThreadInformation: LPVOID, ThreadInformationSize: DWORD, - ); - pub fn SetThreadLocale(Locale: LCID) -> BOOL; - pub fn SetThreadPreferredUILanguages( - dwFlags: DWORD, pwszLanguagesBuffer: PCZZWSTR, pulNumLanguages: PULONG, - ) -> BOOL; - pub fn SetThreadPriority(hThread: HANDLE, nPriority: c_int) -> BOOL; - pub fn SetThreadPriorityBoost(hThread: HANDLE, bDisablePriorityBoost: BOOL) -> BOOL; - pub fn SetThreadStackGuarantee(StackSizeInBytes: PULONG) -> BOOL; - pub fn SetThreadUILanguage(LangId: LANGID) -> LANGID; - pub fn SetThreadpoolStackInformation( - ptpp: PTP_POOL, ptpsi: PTP_POOL_STACK_INFORMATION, - ) -> BOOL; - pub fn SetThreadpoolThreadMaximum(ptpp: PTP_POOL, cthrdMost: DWORD); - pub fn SetThreadpoolThreadMinimum(ptpp: PTP_POOL, cthrdMic: DWORD) -> BOOL; - pub fn SetThreadpoolTimer( - pti: PTP_TIMER, pftDueTime: PFILETIME, msPeriod: DWORD, msWindowLength: DWORD, - ); - pub fn SetThreadpoolTimerEx( - pti: PTP_TIMER, pftDueTime: PFILETIME, msPeriod: DWORD, msWindowLength: DWORD, - ) -> BOOL; - pub fn SetThreadpoolWait(pwa: PTP_WAIT, h: HANDLE, pftTimeout: PFILETIME); - pub fn SetThreadpoolWaitEx( - pwa: PTP_WAIT, h: HANDLE, pftTimeout: PFILETIME, Reserved: PVOID, - ) -> BOOL; - pub fn SetTimeZoneInformation(lpTimeZoneInformation: *const TIME_ZONE_INFORMATION) -> BOOL; - pub fn SetTimerQueueTimer( - TimerQueue: HANDLE, Callback: WAITORTIMERCALLBACK, Parameter: PVOID, DueTime: DWORD, - Period: DWORD, PreferIo: BOOL, - ) -> HANDLE; - #[cfg(target_arch = "x86_64")] - pub fn SetUmsThreadInformation( - UmsThread: PUMS_CONTEXT, UmsThreadInfoClass: UMS_THREAD_INFO_CLASS, - UmsThreadInformation: PVOID, UmsThreadInformationLength: ULONG, - ) -> BOOL; - pub fn SetUnhandledExceptionFilter( - lpTopLevelExceptionFilter: LPTOP_LEVEL_EXCEPTION_FILTER, - ) -> LPTOP_LEVEL_EXCEPTION_FILTER; - pub fn SetUserGeoID(GeoId: GEOID) -> BOOL; - pub fn SetVolumeLabelA(lpRootPathName: LPCSTR, lpVolumeName: LPCSTR) -> BOOL; - pub fn SetVolumeLabelW(lpRootPathName: LPCWSTR, lpVolumeName: LPCWSTR) -> BOOL; - pub fn SetVolumeMountPointA(lpszVolumeMountPoint: LPCSTR, lpszVolumeName: LPCSTR) -> BOOL; - pub fn SetVolumeMountPointW(lpszVolumeMountPoint: LPCWSTR, lpszVolumeName: LPCWSTR) -> BOOL; - pub fn SetWaitableTimer( - hTimer: HANDLE, lpDueTime: *const LARGE_INTEGER, lPeriod: LONG, - pfnCompletionRoutine: PTIMERAPCROUTINE, lpArgToCompletionRoutine: LPVOID, fResume: BOOL, - ) -> BOOL; - pub fn SetWaitableTimerEx( - hTimer: HANDLE, lpDueTime: *const LARGE_INTEGER, lPeriod: LONG, - pfnCompletionRoutine: PTIMERAPCROUTINE, lpArgToCompletionRoutine: LPVOID, - WakeContext: PREASON_CONTEXT, TolerableDelay: ULONG, - ) -> BOOL; - #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] - pub fn SetXStateFeaturesMask(Context: PCONTEXT, FeatureMask: DWORD64) -> BOOL; - pub fn SetupComm(hFile: HANDLE, dwInQueue: DWORD, dwOutQueue: DWORD) -> BOOL; - pub fn SignalObjectAndWait( - hObjectToSignal: HANDLE, hObjectToWaitOn: HANDLE, dwMilliseconds: DWORD, bAlertable: BOOL, - ) -> DWORD; - pub fn SizeofResource(hModule: HMODULE, hResInfo: HRSRC) -> DWORD; - pub fn Sleep(dwMilliseconds: DWORD); - pub fn SleepConditionVariableCS( - ConditionVariable: PCONDITION_VARIABLE, CriticalSection: PCRITICAL_SECTION, - dwMilliseconds: DWORD, - ) -> BOOL; - pub fn SleepConditionVariableSRW( - ConditionVariable: PCONDITION_VARIABLE, SRWLock: PSRWLOCK, dwMilliseconds: DWORD, - Flags: ULONG, - ) -> BOOL; - pub fn SleepEx(dwMilliseconds: DWORD, bAlertable: BOOL) -> DWORD; - pub fn StartThreadpoolIo(pio: PTP_IO); - pub fn SubmitThreadpoolWork(pwk: PTP_WORK); - pub fn SuspendThread(hThread: HANDLE) -> DWORD; - pub fn SwitchToFiber(lpFiber: LPVOID); - pub fn SwitchToThread() -> BOOL; - pub fn SystemTimeToFileTime(lpSystemTime: *const SYSTEMTIME, lpFileTime: LPFILETIME) -> BOOL; - pub fn SystemTimeToTzSpecificLocalTime( - lpTimeZoneInformation: *const TIME_ZONE_INFORMATION, lpUniversalTime: *const SYSTEMTIME, - lpLocalTime: LPSYSTEMTIME, - ) -> BOOL; - pub fn SystemTimeToTzSpecificLocalTimeEx( - lpTimeZoneInformation: *const DYNAMIC_TIME_ZONE_INFORMATION, - lpUniversalTime: *const SYSTEMTIME, lpLocalTime: LPSYSTEMTIME, - ) -> BOOL; - pub fn TerminateJobObject(hJob: HANDLE, uExitCode: UINT) -> BOOL; - pub fn TerminateProcess(hProcess: HANDLE, uExitCode: UINT) -> BOOL; - pub fn TerminateThread(hThread: HANDLE, dwExitCode: DWORD) -> BOOL; - pub fn Thread32First(hSnapshot: HANDLE, lpte: LPTHREADENTRY32) -> BOOL; - pub fn Thread32Next(hSnapshot: HANDLE, lpte: LPTHREADENTRY32) -> BOOL; - pub fn TlsAlloc() -> DWORD; - pub fn TlsFree(dwTlsIndex: DWORD) -> BOOL; - pub fn TlsGetValue(dwTlsIndex: DWORD) -> LPVOID; - pub fn TlsSetValue(dwTlsIndex: DWORD, lpTlsValue: LPVOID) -> BOOL; - pub fn Toolhelp32ReadProcessMemory(th32ProcessID: DWORD, lpBaseAddress: LPCVOID, - lpBuffer: LPVOID, cbRead: SIZE_T, lpNumberOfBytesRead: *mut SIZE_T - ) -> BOOL; - pub fn TransactNamedPipe( - hNamedPipe: HANDLE, lpInBuffer: LPVOID, nInBufferSize: DWORD, lpOutBuffer: LPVOID, - nOutBufferSize: DWORD, lpBytesRead: LPDWORD, lpOverlapped: LPOVERLAPPED, - ) -> BOOL; - pub fn TransmitCommChar(hFile: HANDLE, cChar: c_char) -> BOOL; - pub fn TryAcquireSRWLockExclusive(SRWLock: PSRWLOCK) -> BOOLEAN; - pub fn TryAcquireSRWLockShared(SRWLock: PSRWLOCK) -> BOOLEAN; - pub fn TryEnterCriticalSection(lpCriticalSection: LPCRITICAL_SECTION) -> BOOL; - pub fn TrySubmitThreadpoolCallback( - pfns: PTP_SIMPLE_CALLBACK, pv: PVOID, pcbe: PTP_CALLBACK_ENVIRON, - ) -> BOOL; - pub fn TzSpecificLocalTimeToSystemTime( - lpTimeZoneInformation: *const TIME_ZONE_INFORMATION, lpLocalTime: *const SYSTEMTIME, - lpUniversalTime: LPSYSTEMTIME, - ) -> BOOL; - pub fn TzSpecificLocalTimeToSystemTimeEx( - lpTimeZoneInformation: *const DYNAMIC_TIME_ZONE_INFORMATION, - lpLocalTime: *const SYSTEMTIME, lpUniversalTime: LPSYSTEMTIME, - ) -> BOOL; - #[cfg(target_arch = "x86_64")] - pub fn UmsThreadYield(SchedulerParam: PVOID) -> BOOL; - pub fn UnhandledExceptionFilter(ExceptionInfo: *mut EXCEPTION_POINTERS) -> LONG; - pub fn UnlockFile( - hFile: HANDLE, dwFileOffsetLow: DWORD, dwFileOffsetHigh: DWORD, - nNumberOfBytesToUnlockLow: DWORD, nNumberOfBytesToUnlockHigh: DWORD, - ) -> BOOL; - pub fn UnlockFileEx( - hFile: HANDLE, dwReserved: DWORD, nNumberOfBytesToUnlockLow: DWORD, - nNumberOfBytesToUnlockHigh: DWORD, lpOverlapped: LPOVERLAPPED, - ) -> BOOL; - pub fn UnmapViewOfFile(lpBaseAddress: LPCVOID) -> BOOL; - pub fn UnregisterApplicationRecoveryCallback() -> HRESULT; - pub fn UnregisterApplicationRestart() -> HRESULT; - pub fn UnregisterBadMemoryNotification(RegistrationHandle: PVOID) -> BOOL; - pub fn UnregisterWait(WaitHandle: HANDLE) -> BOOL; - pub fn UnregisterWaitEx(WaitHandle: HANDLE, CompletionEvent: HANDLE) -> BOOL; - // pub fn UnregisterWaitUntilOOBECompleted(); - pub fn UpdateProcThreadAttribute( - lpAttributeList: LPPROC_THREAD_ATTRIBUTE_LIST, dwFlags: DWORD, Attribute: DWORD_PTR, - lpValue: PVOID, cbSize: SIZE_T, lpPreviousValue: PVOID, lpReturnSize: PSIZE_T, - ) -> BOOL; - pub fn UpdateResourceA( - hUpdate: HANDLE, lpType: LPCSTR, lpName: LPCSTR, wLanguage: WORD, lpData: LPVOID, cb: DWORD, - ) -> BOOL; - pub fn UpdateResourceW( - hUpdate: HANDLE, lpType: LPCWSTR, lpName: LPCWSTR, wLanguage: WORD, lpData: LPVOID, - cb: DWORD, - ) -> BOOL; - pub fn VerLanguageNameA(wLang: DWORD, szLang: LPSTR, cchLang: DWORD) -> DWORD; - pub fn VerLanguageNameW(wLang: DWORD, szLang: LPWSTR, cchLang: DWORD) -> DWORD; - pub fn VerSetConditionMask( - ConditionMask: ULONGLONG, TypeMask: DWORD, Condition: BYTE, - ) -> ULONGLONG; - pub fn VerifyScripts( - dwFlags: DWORD, lpLocaleScripts: LPCWSTR, cchLocaleScripts: c_int, lpTestScripts: LPCWSTR, - cchTestScripts: c_int, - ) -> BOOL; - pub fn VerifyVersionInfoA( - lpVersionInformation: LPOSVERSIONINFOEXA, dwTypeMask: DWORD, dwlConditionMask: DWORDLONG, - ) -> BOOL; - pub fn VerifyVersionInfoW( - lpVersionInformation: LPOSVERSIONINFOEXW, dwTypeMask: DWORD, dwlConditionMask: DWORDLONG, - ) -> BOOL; - pub fn VirtualAlloc( - lpAddress: LPVOID, dwSize: SIZE_T, flAllocationType: DWORD, flProtect: DWORD, - ) -> LPVOID; - pub fn VirtualAllocEx( - hProcess: HANDLE, lpAddress: LPVOID, dwSize: SIZE_T, flAllocationType: DWORD, - flProtect: DWORD, - ) -> LPVOID; - pub fn VirtualAllocExNuma( - hProcess: HANDLE, lpAddress: LPVOID, dwSize: SIZE_T, flAllocationType: DWORD, - flProtect: DWORD, nndPreferred: DWORD, - ) -> LPVOID; - pub fn VirtualFree(lpAddress: LPVOID, dwSize: SIZE_T, dwFreeType: DWORD) -> BOOL; - pub fn VirtualFreeEx( - hProcess: HANDLE, lpAddress: LPVOID, dwSize: SIZE_T, dwFreeType: DWORD, - ) -> BOOL; - pub fn VirtualLock(lpAddress: LPVOID, dwSize: SIZE_T) -> BOOL; - pub fn VirtualProtect( - lpAddress: LPVOID, dwSize: SIZE_T, flNewProtect: DWORD, lpflOldProtect: PDWORD, - ) -> BOOL; - pub fn VirtualProtectEx( - hProcess: HANDLE, lpAddress: LPVOID, dwSize: SIZE_T, flNewProtect: DWORD, - lpflOldProtect: DWORD, - ) -> BOOL; - pub fn VirtualQuery( - lpAddress: LPCVOID, lpBuffer: PMEMORY_BASIC_INFORMATION, dwLength: SIZE_T, - ) -> SIZE_T; - pub fn VirtualQueryEx( - hProcess: HANDLE, lpAddress: LPCVOID, lpBuffer: PMEMORY_BASIC_INFORMATION, dwLength: SIZE_T, - ) -> SIZE_T; - pub fn VirtualUnlock(lpAddress: LPVOID, dwSize: SIZE_T) -> BOOL; - pub fn WTSGetActiveConsoleSessionId() -> DWORD; - pub fn WaitCommEvent(hFile: HANDLE, lpEvtMask: LPDWORD, lpOverlapped: LPOVERLAPPED) -> BOOL; - pub fn WaitForDebugEvent(lpDebugEvent: LPDEBUG_EVENT, dwMilliseconds: DWORD) -> BOOL; - pub fn WaitForMultipleObjects( - nCount: DWORD, lpHandles: *const HANDLE, bWaitAll: BOOL, dwMilliseconds: DWORD, - ) -> DWORD; - pub fn WaitForMultipleObjectsEx( - nCount: DWORD, lpHandles: *const HANDLE, bWaitAll: BOOL, dwMilliseconds: DWORD, - bAlertable: BOOL, - ) -> DWORD; - pub fn WaitForSingleObject(hHandle: HANDLE, dwMilliseconds: DWORD) -> DWORD; - pub fn WaitForSingleObjectEx( - hHandle: HANDLE, dwMilliseconds: DWORD, bAlertable: BOOL, - ) -> DWORD; - pub fn WaitForThreadpoolIoCallbacks(pio: PTP_IO, fCancelPendingCallbacks: BOOL); - pub fn WaitForThreadpoolTimerCallbacks(pti: PTP_TIMER, fCancelPendingCallbacks: BOOL); - pub fn WaitForThreadpoolWaitCallbacks(pwa: PTP_WAIT, fCancelPendingCallbacks: BOOL); - pub fn WaitForThreadpoolWorkCallbacks(pwk: PTP_WORK, fCancelPendingCallbacks: BOOL); - pub fn WaitNamedPipeA(lpNamedPipeName: LPCSTR, nTimeOut: DWORD) -> BOOL; - pub fn WaitNamedPipeW(lpNamedPipeName: LPCWSTR, nTimeOut: DWORD) -> BOOL; - pub fn WakeAllConditionVariable(ConditionVariable: PCONDITION_VARIABLE); - pub fn WakeConditionVariable(ConditionVariable: PCONDITION_VARIABLE); - pub fn WerGetFlags(hProcess: HANDLE, pdwFlags: PDWORD) -> HRESULT; - pub fn WerRegisterFile( - pwzFile: PCWSTR, regFileType: WER_REGISTER_FILE_TYPE, dwFlags: DWORD, - ) -> HRESULT; - pub fn WerRegisterMemoryBlock(pvAddress: PVOID, dwSize: DWORD) -> HRESULT; - pub fn WerRegisterRuntimeExceptionModule( - pwszOutOfProcessCallbackDll: PCWSTR, pContext: PVOID, - ) -> HRESULT; - pub fn WerSetFlags(dwFlags: DWORD) -> HRESULT; - pub fn WerUnregisterFile(pwzFilePath: PCWSTR) -> HRESULT; - pub fn WerUnregisterMemoryBlock(pvAddress: PVOID) -> HRESULT; - pub fn WerUnregisterRuntimeExceptionModule( - pwszOutOfProcessCallbackDll: PCWSTR, pContext: PVOID, - ) -> HRESULT; - // pub fn WerpInitiateRemoteRecovery(); - pub fn WideCharToMultiByte( - CodePage: UINT, dwFlags: DWORD, lpWideCharStr: LPCWSTR, cchWideChar: c_int, - lpMultiByteStr: LPSTR, cbMultiByte: c_int, lpDefaultChar: LPCSTR, lpUsedDefaultChar: LPBOOL, - ) -> c_int; - pub fn WinExec(lpCmdLine: LPCSTR, uCmdShow: UINT) -> UINT; - pub fn Wow64DisableWow64FsRedirection(OldValue: *mut PVOID) -> BOOL; - pub fn Wow64EnableWow64FsRedirection(Wow64FsEnableRedirection: BOOLEAN) -> BOOLEAN; - pub fn Wow64GetThreadContext(hThread: HANDLE, lpContext: PWOW64_CONTEXT) -> BOOL; - pub fn Wow64GetThreadSelectorEntry( - hThread: HANDLE, dwSelector: DWORD, lpSelectorEntry: PWOW64_LDT_ENTRY, - ) -> BOOL; - pub fn Wow64RevertWow64FsRedirection(OlValue: PVOID) -> BOOL; - pub fn Wow64SetThreadContext(hThread: HANDLE, lpContext: *const WOW64_CONTEXT) -> BOOL; - pub fn Wow64SuspendThread(hThread: HANDLE) -> DWORD; - pub fn WriteConsoleA( - hConsoleOutput: HANDLE, lpBuffer: *const VOID, nNumberOfCharsToWrite: DWORD, - lpNumberOfCharsWritten: LPDWORD, lpReserved: LPVOID, - ) -> BOOL; - pub fn WriteConsoleInputA( - hConsoleInput: HANDLE, lpBuffer: *const INPUT_RECORD, nLength: DWORD, - lpNumberOfEventsWritten: LPDWORD, - ) -> BOOL; - pub fn WriteConsoleInputW( - hConsoleInput: HANDLE, lpBuffer: *const INPUT_RECORD, nLength: DWORD, - lpNumberOfEventsWritten: LPDWORD, - ) -> BOOL; - pub fn WriteConsoleOutputA( - hConsoleOutput: HANDLE, lpBuffer: *const CHAR_INFO, dwBufferSize: COORD, - dwBufferCoord: COORD, lpWriteRegion: PSMALL_RECT, - ) -> BOOL; - pub fn WriteConsoleOutputAttribute( - hConsoleOutput: HANDLE, lpAttribute: *const WORD, nLength: DWORD, dwWriteCoord: COORD, - lpNumberOfAttrsWritten: LPDWORD, - ) -> BOOL; - pub fn WriteConsoleOutputCharacterA( - hConsoleOutput: HANDLE, lpCharacter: LPCSTR, nLength: DWORD, dwWriteCoord: COORD, - lpNumberOfCharsWritten: LPDWORD, - ) -> BOOL; - pub fn WriteConsoleOutputCharacterW( - hConsoleOutput: HANDLE, lpCharacter: LPCWSTR, nLength: DWORD, dwWriteCoord: COORD, - lpNumberOfCharsWritten: LPDWORD, - ) -> BOOL; - pub fn WriteConsoleOutputW( - hConsoleOutput: HANDLE, lpBuffer: *const CHAR_INFO, dwBufferSize: COORD, - dwBufferCoord: COORD, lpWriteRegion: PSMALL_RECT, - ) -> BOOL; - pub fn WriteConsoleW( - hConsoleOutput: HANDLE, lpBuffer: *const VOID, nNumberOfCharsToWrite: DWORD, - lpNumberOfCharsWritten: LPDWORD, lpReserved: LPVOID, - ) -> BOOL; - pub fn WriteFile( - hFile: HANDLE, lpBuffer: LPCVOID, nNumberOfBytesToWrite: DWORD, - lpNumberOfBytesWritten: LPDWORD, lpOverlapped: LPOVERLAPPED, - ) -> BOOL; - pub fn WriteFileEx( - hFile: HANDLE, lpBuffer: LPCVOID, nNumberOfBytesToWrite: DWORD, lpOverlapped: LPOVERLAPPED, - lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, - ) -> BOOL; - pub fn WriteFileGather( - hFile: HANDLE, aSegmentArray: *mut FILE_SEGMENT_ELEMENT, nNumberOfBytesToWrite: DWORD, - lpReserved: LPDWORD, lpOverlapped: LPOVERLAPPED, - ) -> BOOL; - pub fn WritePrivateProfileSectionA( - lpAppName: LPCSTR, lpString: LPCSTR, lpFileName: LPCSTR, - ) -> BOOL; - pub fn WritePrivateProfileSectionW( - lpAppName: LPCWSTR, lpString: LPCWSTR, lpFileName: LPCWSTR, - ) -> BOOL; - pub fn WritePrivateProfileStringA( - lpAppName: LPCSTR, lpKeyName: LPCSTR, lpString: LPCSTR, lpFileName: LPCSTR, - ) -> BOOL; - pub fn WritePrivateProfileStringW( - lpAppName: LPCWSTR, lpKeyName: LPCWSTR, lpString: LPCWSTR, lpFileName: LPCWSTR, - ) -> BOOL; - pub fn WritePrivateProfileStructA( - lpszSection: LPCSTR, lpszKey: LPCSTR, lpStruct: LPVOID, uSizeStruct: UINT, szFile: LPCSTR, - ) -> BOOL; - pub fn WritePrivateProfileStructW( - lpszSection: LPCWSTR, lpszKey: LPCWSTR, lpStruct: LPVOID, uSizeStruct: UINT, - szFile: LPCWSTR, - ) -> BOOL; - pub fn WriteProcessMemory( - hProcess: HANDLE, lpBaseAddress: LPVOID, lpBuffer: LPCVOID, nSize: SIZE_T, - lpNumberOfBytesWritten: *mut SIZE_T, - ) -> BOOL; - pub fn WriteProfileSectionA(lpAppName: LPCSTR, lpString: LPCSTR) -> BOOL; - pub fn WriteProfileSectionW(lpAppName: LPCWSTR, lpString: LPCWSTR) -> BOOL; - pub fn WriteProfileStringA(lpAppName: LPCSTR, lpKeyName: LPCSTR, lpString: LPCSTR) -> BOOL; - pub fn WriteProfileStringW(lpAppName: LPCWSTR, lpKeyName: LPCWSTR, lpString: LPCWSTR) -> BOOL; - pub fn WriteTapemark( - hDevice: HANDLE, dwTapemarkType: DWORD, dwTapemarkCount: DWORD, bImmediate: BOOL, - ) -> DWORD; - pub fn ZombifyActCtx(hActCtx: HANDLE) -> BOOL; - pub fn _hread(hFile: HFILE, lpBuffer: LPVOID, lBytes: c_long) -> c_long; - pub fn _hwrite(hFile: HFILE, lpBuffer: LPCCH, lBytes: c_long) -> c_long; - pub fn _lclose(hFile: HFILE) -> HFILE; - pub fn _lcreat(lpPathName: LPCSTR, iAttrubute: c_int) -> HFILE; - pub fn _llseek(hFile: HFILE, lOffset: LONG, iOrigin: c_int) -> LONG; - pub fn _lopen(lpPathName: LPCSTR, iReadWrite: c_int) -> HFILE; - pub fn _lread(hFile: HFILE, lpBuffer: LPVOID, uBytes: UINT) -> UINT; - pub fn _lwrite(hFile: HFILE, lpBuffer: LPCCH, uBytes: UINT) -> UINT; - pub fn lstrcat(lpString1: LPSTR, lpString2: LPCSTR) -> LPSTR; - pub fn lstrcatA(lpString1: LPSTR, lpString2: LPCSTR) -> LPSTR; - pub fn lstrcatW(lpString1: LPWSTR, lpString2: LPCWSTR) -> LPSTR; - pub fn lstrcmp(lpString1: LPCSTR, lpString2: LPCSTR) -> c_int; - pub fn lstrcmpA(lpString1: LPCSTR, lpString2: LPCSTR) -> c_int; - pub fn lstrcmpW(lpString1: LPCWSTR, lpString2: LPCWSTR) -> c_int; - pub fn lstrcmpi(lpString1: LPCSTR, lpString2: LPCSTR) -> c_int; - pub fn lstrcmpiA(lpString1: LPCSTR, lpString2: LPCSTR) -> c_int; - pub fn lstrcmpiW(lpString1: LPCWSTR, lpString2: LPCWSTR) -> c_int; - pub fn lstrcpy(lpString1: LPSTR, lpString2: LPCSTR) -> LPSTR; - pub fn lstrcpyA(lpString1: LPSTR, lpString2: LPCSTR) -> LPSTR; - pub fn lstrcpyW(lpString1: LPWSTR, lpString2: LPCWSTR) -> LPSTR; - pub fn lstrcpyn(lpString1: LPSTR, lpString2: LPCSTR, iMaxLength: c_int) -> LPSTR; - pub fn lstrcpynA(lpString1: LPSTR, lpString2: LPCSTR, iMaxLength: c_int) -> LPSTR; - pub fn lstrcpynW(lpString1: LPWSTR, lpString2: LPCWSTR, iMaxLength: c_int) -> LPSTR; - pub fn lstrlen(lpString: LPCSTR) -> c_int; - pub fn lstrlenA(lpString: LPCSTR) -> c_int; - pub fn lstrlenW(lpString: LPCWSTR) -> c_int; - #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] - pub fn uaw_lstrcmpW(String1: PCUWSTR, String2: PCUWSTR) -> c_int; - #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] - pub fn uaw_lstrcmpiW(String1: PCUWSTR, String2: PCUWSTR) -> c_int; - #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] - pub fn uaw_lstrlenW(String: LPCUWSTR) -> c_int; - #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] - pub fn uaw_wcschr(String: PCUWSTR, Character: WCHAR) -> PUWSTR; - #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] - pub fn uaw_wcscpy(Destination: PUWSTR, Source: PCUWSTR) -> PUWSTR; - #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] - pub fn uaw_wcsicmp(String1: PCUWSTR, String2: PCUWSTR) -> c_int; - #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] - pub fn uaw_wcslen(String: PCUWSTR) -> size_t; - #[cfg(any(target_arch = "arm", target_arch = "x86_64"))] - pub fn uaw_wcsrchr(String: PCUWSTR, Character: WCHAR) -> PUWSTR; -} diff -Nru cargo-0.35.0/vendor/libc/build.rs cargo-0.37.0/vendor/libc/build.rs --- cargo-0.35.0/vendor/libc/build.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/build.rs 2019-07-17 05:42:23.000000000 +0000 @@ -5,9 +5,21 @@ fn main() { let rustc_minor_ver = rustc_minor_version().expect("Failed to get rustc version"); - let rustc_dep_of_std = - std::env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok(); - let align_cargo_feature = std::env::var("CARGO_FEATURE_ALIGN").is_ok(); + let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok(); + let align_cargo_feature = env::var("CARGO_FEATURE_ALIGN").is_ok(); + + if env::var("CARGO_FEATURE_USE_STD").is_ok() { + println!( + "cargo:warning=\"libc's use_std cargo feature is deprecated since libc 0.2.55; \ + please consider using the `std` cargo feature instead\"" + ); + } + + if env::var("LIBC_CI").is_ok() { + if let Some(12) = which_freebsd() { + println!("cargo:rustc-cfg=freebsd12"); + } + } // Rust >= 1.15 supports private module use: if rustc_minor_ver >= 15 || rustc_dep_of_std { @@ -40,6 +52,11 @@ if rustc_minor_ver >= 33 || rustc_dep_of_std { println!("cargo:rustc-cfg=libc_packedN"); } + + // #[thread_local] is currently unstable + if rustc_dep_of_std { + println!("cargo:rustc-cfg=libc_thread_local"); + } } fn rustc_minor_version() -> Option { @@ -63,3 +80,26 @@ otry!(pieces.next()).parse().ok() } + +fn which_freebsd() -> Option { + let output = std::process::Command::new("freebsd-version").output().ok(); + if output.is_none() { + return None; + } + let output = output.unwrap(); + if !output.status.success() { + return None; + } + + let stdout = String::from_utf8(output.stdout).ok(); + if stdout.is_none() { + return None; + } + let stdout = stdout.unwrap(); + + match &stdout { + s if s.starts_with("11") => Some(11), + s if s.starts_with("12") => Some(12), + _ => None, + } +} diff -Nru cargo-0.35.0/vendor/libc/.cargo-checksum.json cargo-0.37.0/vendor/libc/.cargo-checksum.json --- cargo-0.35.0/vendor/libc/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"c6785aa7dd976f5fbf3b71cfd9cd49d7f783c1ff565a858d71031c6c313aa5c6"} \ No newline at end of file +{"files":{},"package":"d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/libc/Cargo.toml cargo-0.37.0/vendor/libc/Cargo.toml --- cargo-0.35.0/vendor/libc/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "libc" -version = "0.2.54" +version = "0.2.60" authors = ["The Rust Project Developers"] build = "build.rs" exclude = ["/ci/*", "/.travis.yml", "/appveyor.yml"] @@ -30,10 +30,11 @@ [features] align = [] -default = ["use_std"] +default = ["std"] extra_traits = [] rustc-dep-of-std = ["align", "rustc-std-workspace-core"] -use_std = [] +std = [] +use_std = ["std"] [badges.appveyor] project_name = "rust-lang-libs/libc" repository = "rust-lang/libc" diff -Nru cargo-0.35.0/vendor/libc/README.md cargo-0.37.0/vendor/libc/README.md --- cargo-0.35.0/vendor/libc/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -28,13 +28,15 @@ ## Features -* `use_std`: by default `libc` links to the standard library. Disable this +* `std`: by default `libc` links to the standard library. Disable this feature remove this dependency and be able to use `libc` in `#![no_std]` crates. * `extra_traits`: all `struct`s implemented in `libc` are `Copy` and `Clone`. This feature derives `Debug`, `Eq`, `Hash`, and `PartialEq`. +* **deprecated**: `use_std` is deprecated, and is equivalent to `std`. + ## Rust version support The minimum supported Rust toolchain version is **Rust 1.13.0** . APIs requiring @@ -54,7 +56,7 @@ [Platform-specific documentation (master branch)][docs.master]. See -[`ci/build.sh`](https://github.com/rust-lang/libc/blob/master/libc-test/build.rs) +[`ci/build.sh`](https://github.com/rust-lang/libc/blob/master/ci/build.sh) for the platforms on which `libc` is guaranteed to build for each Rust toolchain. The test-matrix at [Travis-CI], [Appveyor], and [Cirrus-CI] show the platforms in which `libc` tests are run. diff -Nru cargo-0.35.0/vendor/libc/src/cloudabi/mod.rs cargo-0.37.0/vendor/libc/src/cloudabi/mod.rs --- cargo-0.35.0/vendor/libc/src/cloudabi/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/cloudabi/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,12 +1,3 @@ -pub type int8_t = i8; -pub type int16_t = i16; -pub type int32_t = i32; -pub type int64_t = i64; -pub type uint8_t = u8; -pub type uint16_t = u16; -pub type uint32_t = u32; -pub type uint64_t = u64; - pub type c_schar = i8; pub type c_uchar = u8; pub type c_short = i16; diff -Nru cargo-0.35.0/vendor/libc/src/fixed_width_ints.rs cargo-0.37.0/vendor/libc/src/fixed_width_ints.rs --- cargo-0.35.0/vendor/libc/src/fixed_width_ints.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/fixed_width_ints.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,44 @@ +//! This module contains type aliases for C's fixed-width integer types . +//! +//! These aliases are deprecated: use the Rust types instead. + +#[deprecated( + since = "0.2.55", + note = "Use i8 instead." +)] +pub type int8_t = i8; +#[deprecated( + since = "0.2.55", + note = "Use i16 instead." +)] +pub type int16_t = i16; +#[deprecated( + since = "0.2.55", + note = "Use i32 instead." +)] +pub type int32_t = i32; +#[deprecated( + since = "0.2.55", + note = "Use i64 instead." +)] +pub type int64_t = i64; +#[deprecated( + since = "0.2.55", + note = "Use u8 instead." +)] +pub type uint8_t = u8; +#[deprecated( + since = "0.2.55", + note = "Use u16 instead." +)] +pub type uint16_t = u16; +#[deprecated( + since = "0.2.55", + note = "Use u32 instead." +)] +pub type uint32_t = u32; +#[deprecated( + since = "0.2.55", + note = "Use u64 instead." +)] +pub type uint64_t = u64; diff -Nru cargo-0.35.0/vendor/libc/src/fuchsia/aarch64.rs cargo-0.37.0/vendor/libc/src/fuchsia/aarch64.rs --- cargo-0.35.0/vendor/libc/src/fuchsia/aarch64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/fuchsia/aarch64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -64,273 +64,3 @@ pub const MINSIGSTKSZ: ::size_t = 6144; pub const SIGSTKSZ: ::size_t = 12288; - -#[doc(hidden)] -pub const PF_MAX: ::c_int = 43; -#[doc(hidden)] -pub const AF_MAX: ::c_int = PF_MAX; - -pub const SYS_io_setup: ::c_long = 0; -pub const SYS_io_destroy: ::c_long = 1; -pub const SYS_io_submit: ::c_long = 2; -pub const SYS_io_cancel: ::c_long = 3; -pub const SYS_io_getevents: ::c_long = 4; -pub const SYS_setxattr: ::c_long = 5; -pub const SYS_lsetxattr: ::c_long = 6; -pub const SYS_fsetxattr: ::c_long = 7; -pub const SYS_getxattr: ::c_long = 8; -pub const SYS_lgetxattr: ::c_long = 9; -pub const SYS_fgetxattr: ::c_long = 10; -pub const SYS_listxattr: ::c_long = 11; -pub const SYS_llistxattr: ::c_long = 12; -pub const SYS_flistxattr: ::c_long = 13; -pub const SYS_removexattr: ::c_long = 14; -pub const SYS_lremovexattr: ::c_long = 15; -pub const SYS_fremovexattr: ::c_long = 16; -pub const SYS_getcwd: ::c_long = 17; -pub const SYS_lookup_dcookie: ::c_long = 18; -pub const SYS_eventfd2: ::c_long = 19; -pub const SYS_epoll_create1: ::c_long = 20; -pub const SYS_epoll_ctl: ::c_long = 21; -pub const SYS_epoll_pwait: ::c_long = 22; -pub const SYS_dup: ::c_long = 23; -pub const SYS_dup3: ::c_long = 24; -pub const SYS_inotify_init1: ::c_long = 26; -pub const SYS_inotify_add_watch: ::c_long = 27; -pub const SYS_inotify_rm_watch: ::c_long = 28; -pub const SYS_ioctl: ::c_long = 29; -pub const SYS_ioprio_set: ::c_long = 30; -pub const SYS_ioprio_get: ::c_long = 31; -pub const SYS_flock: ::c_long = 32; -pub const SYS_mknodat: ::c_long = 33; -pub const SYS_mkdirat: ::c_long = 34; -pub const SYS_unlinkat: ::c_long = 35; -pub const SYS_symlinkat: ::c_long = 36; -pub const SYS_linkat: ::c_long = 37; -pub const SYS_renameat: ::c_long = 38; -pub const SYS_umount2: ::c_long = 39; -pub const SYS_mount: ::c_long = 40; -pub const SYS_pivot_root: ::c_long = 41; -pub const SYS_nfsservctl: ::c_long = 42; -pub const SYS_fallocate: ::c_long = 47; -pub const SYS_faccessat: ::c_long = 48; -pub const SYS_chdir: ::c_long = 49; -pub const SYS_fchdir: ::c_long = 50; -pub const SYS_chroot: ::c_long = 51; -pub const SYS_fchmod: ::c_long = 52; -pub const SYS_fchmodat: ::c_long = 53; -pub const SYS_fchownat: ::c_long = 54; -pub const SYS_fchown: ::c_long = 55; -pub const SYS_openat: ::c_long = 56; -pub const SYS_close: ::c_long = 57; -pub const SYS_vhangup: ::c_long = 58; -pub const SYS_pipe2: ::c_long = 59; -pub const SYS_quotactl: ::c_long = 60; -pub const SYS_getdents64: ::c_long = 61; -pub const SYS_read: ::c_long = 63; -pub const SYS_write: ::c_long = 64; -pub const SYS_readv: ::c_long = 65; -pub const SYS_writev: ::c_long = 66; -pub const SYS_pread64: ::c_long = 67; -pub const SYS_pwrite64: ::c_long = 68; -pub const SYS_preadv: ::c_long = 69; -pub const SYS_pwritev: ::c_long = 70; -pub const SYS_pselect6: ::c_long = 72; -pub const SYS_ppoll: ::c_long = 73; -pub const SYS_signalfd4: ::c_long = 74; -pub const SYS_vmsplice: ::c_long = 75; -pub const SYS_splice: ::c_long = 76; -pub const SYS_tee: ::c_long = 77; -pub const SYS_readlinkat: ::c_long = 78; -pub const SYS_sync: ::c_long = 81; -pub const SYS_fsync: ::c_long = 82; -pub const SYS_fdatasync: ::c_long = 83; -pub const SYS_sync_file_range: ::c_long = 84; -pub const SYS_timerfd_create: ::c_long = 85; -pub const SYS_timerfd_settime: ::c_long = 86; -pub const SYS_timerfd_gettime: ::c_long = 87; -pub const SYS_utimensat: ::c_long = 88; -pub const SYS_acct: ::c_long = 89; -pub const SYS_capget: ::c_long = 90; -pub const SYS_capset: ::c_long = 91; -pub const SYS_personality: ::c_long = 92; -pub const SYS_exit: ::c_long = 93; -pub const SYS_exit_group: ::c_long = 94; -pub const SYS_waitid: ::c_long = 95; -pub const SYS_set_tid_address: ::c_long = 96; -pub const SYS_unshare: ::c_long = 97; -pub const SYS_futex: ::c_long = 98; -pub const SYS_set_robust_list: ::c_long = 99; -pub const SYS_get_robust_list: ::c_long = 100; -pub const SYS_nanosleep: ::c_long = 101; -pub const SYS_getitimer: ::c_long = 102; -pub const SYS_setitimer: ::c_long = 103; -pub const SYS_kexec_load: ::c_long = 104; -pub const SYS_init_module: ::c_long = 105; -pub const SYS_delete_module: ::c_long = 106; -pub const SYS_timer_create: ::c_long = 107; -pub const SYS_timer_gettime: ::c_long = 108; -pub const SYS_timer_getoverrun: ::c_long = 109; -pub const SYS_timer_settime: ::c_long = 110; -pub const SYS_timer_delete: ::c_long = 111; -pub const SYS_clock_settime: ::c_long = 112; -pub const SYS_clock_gettime: ::c_long = 113; -pub const SYS_clock_getres: ::c_long = 114; -pub const SYS_clock_nanosleep: ::c_long = 115; -pub const SYS_syslog: ::c_long = 116; -pub const SYS_ptrace: ::c_long = 117; -pub const SYS_sched_setparam: ::c_long = 118; -pub const SYS_sched_setscheduler: ::c_long = 119; -pub const SYS_sched_getscheduler: ::c_long = 120; -pub const SYS_sched_getparam: ::c_long = 121; -pub const SYS_sched_setaffinity: ::c_long = 122; -pub const SYS_sched_getaffinity: ::c_long = 123; -pub const SYS_sched_yield: ::c_long = 124; -pub const SYS_sched_get_priority_max: ::c_long = 125; -pub const SYS_sched_get_priority_min: ::c_long = 126; -pub const SYS_sched_rr_get_interval: ::c_long = 127; -pub const SYS_restart_syscall: ::c_long = 128; -pub const SYS_kill: ::c_long = 129; -pub const SYS_tkill: ::c_long = 130; -pub const SYS_tgkill: ::c_long = 131; -pub const SYS_sigaltstack: ::c_long = 132; -pub const SYS_rt_sigsuspend: ::c_long = 133; -pub const SYS_rt_sigaction: ::c_long = 134; -pub const SYS_rt_sigprocmask: ::c_long = 135; -pub const SYS_rt_sigpending: ::c_long = 136; -pub const SYS_rt_sigtimedwait: ::c_long = 137; -pub const SYS_rt_sigqueueinfo: ::c_long = 138; -pub const SYS_rt_sigreturn: ::c_long = 139; -pub const SYS_setpriority: ::c_long = 140; -pub const SYS_getpriority: ::c_long = 141; -pub const SYS_reboot: ::c_long = 142; -pub const SYS_setregid: ::c_long = 143; -pub const SYS_setgid: ::c_long = 144; -pub const SYS_setreuid: ::c_long = 145; -pub const SYS_setuid: ::c_long = 146; -pub const SYS_setresuid: ::c_long = 147; -pub const SYS_getresuid: ::c_long = 148; -pub const SYS_setresgid: ::c_long = 149; -pub const SYS_getresgid: ::c_long = 150; -pub const SYS_setfsuid: ::c_long = 151; -pub const SYS_setfsgid: ::c_long = 152; -pub const SYS_times: ::c_long = 153; -pub const SYS_setpgid: ::c_long = 154; -pub const SYS_getpgid: ::c_long = 155; -pub const SYS_getsid: ::c_long = 156; -pub const SYS_setsid: ::c_long = 157; -pub const SYS_getgroups: ::c_long = 158; -pub const SYS_setgroups: ::c_long = 159; -pub const SYS_uname: ::c_long = 160; -pub const SYS_sethostname: ::c_long = 161; -pub const SYS_setdomainname: ::c_long = 162; -pub const SYS_getrlimit: ::c_long = 163; -pub const SYS_setrlimit: ::c_long = 164; -pub const SYS_getrusage: ::c_long = 165; -pub const SYS_umask: ::c_long = 166; -pub const SYS_prctl: ::c_long = 167; -pub const SYS_getcpu: ::c_long = 168; -pub const SYS_gettimeofday: ::c_long = 169; -pub const SYS_settimeofday: ::c_long = 170; -pub const SYS_adjtimex: ::c_long = 171; -pub const SYS_getpid: ::c_long = 172; -pub const SYS_getppid: ::c_long = 173; -pub const SYS_getuid: ::c_long = 174; -pub const SYS_geteuid: ::c_long = 175; -pub const SYS_getgid: ::c_long = 176; -pub const SYS_getegid: ::c_long = 177; -pub const SYS_gettid: ::c_long = 178; -pub const SYS_sysinfo: ::c_long = 179; -pub const SYS_mq_open: ::c_long = 180; -pub const SYS_mq_unlink: ::c_long = 181; -pub const SYS_mq_timedsend: ::c_long = 182; -pub const SYS_mq_timedreceive: ::c_long = 183; -pub const SYS_mq_notify: ::c_long = 184; -pub const SYS_mq_getsetattr: ::c_long = 185; -pub const SYS_msgget: ::c_long = 186; -pub const SYS_msgctl: ::c_long = 187; -pub const SYS_msgrcv: ::c_long = 188; -pub const SYS_msgsnd: ::c_long = 189; -pub const SYS_semget: ::c_long = 190; -pub const SYS_semctl: ::c_long = 191; -pub const SYS_semtimedop: ::c_long = 192; -pub const SYS_semop: ::c_long = 193; -pub const SYS_shmget: ::c_long = 194; -pub const SYS_shmctl: ::c_long = 195; -pub const SYS_shmat: ::c_long = 196; -pub const SYS_shmdt: ::c_long = 197; -pub const SYS_socket: ::c_long = 198; -pub const SYS_socketpair: ::c_long = 199; -pub const SYS_bind: ::c_long = 200; -pub const SYS_listen: ::c_long = 201; -pub const SYS_accept: ::c_long = 202; -pub const SYS_connect: ::c_long = 203; -pub const SYS_getsockname: ::c_long = 204; -pub const SYS_getpeername: ::c_long = 205; -pub const SYS_sendto: ::c_long = 206; -pub const SYS_recvfrom: ::c_long = 207; -pub const SYS_setsockopt: ::c_long = 208; -pub const SYS_getsockopt: ::c_long = 209; -pub const SYS_shutdown: ::c_long = 210; -pub const SYS_sendmsg: ::c_long = 211; -pub const SYS_recvmsg: ::c_long = 212; -pub const SYS_readahead: ::c_long = 213; -pub const SYS_brk: ::c_long = 214; -pub const SYS_munmap: ::c_long = 215; -pub const SYS_mremap: ::c_long = 216; -pub const SYS_add_key: ::c_long = 217; -pub const SYS_request_key: ::c_long = 218; -pub const SYS_keyctl: ::c_long = 219; -pub const SYS_clone: ::c_long = 220; -pub const SYS_execve: ::c_long = 221; -pub const SYS_swapon: ::c_long = 224; -pub const SYS_swapoff: ::c_long = 225; -pub const SYS_mprotect: ::c_long = 226; -pub const SYS_msync: ::c_long = 227; -pub const SYS_mlock: ::c_long = 228; -pub const SYS_munlock: ::c_long = 229; -pub const SYS_mlockall: ::c_long = 230; -pub const SYS_munlockall: ::c_long = 231; -pub const SYS_mincore: ::c_long = 232; -pub const SYS_madvise: ::c_long = 233; -pub const SYS_remap_file_pages: ::c_long = 234; -pub const SYS_mbind: ::c_long = 235; -pub const SYS_get_mempolicy: ::c_long = 236; -pub const SYS_set_mempolicy: ::c_long = 237; -pub const SYS_migrate_pages: ::c_long = 238; -pub const SYS_move_pages: ::c_long = 239; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 240; -pub const SYS_perf_event_open: ::c_long = 241; -pub const SYS_accept4: ::c_long = 242; -pub const SYS_recvmmsg: ::c_long = 243; -pub const SYS_wait4: ::c_long = 260; -pub const SYS_prlimit64: ::c_long = 261; -pub const SYS_fanotify_init: ::c_long = 262; -pub const SYS_fanotify_mark: ::c_long = 263; -pub const SYS_name_to_handle_at: ::c_long = 264; -pub const SYS_open_by_handle_at: ::c_long = 265; -pub const SYS_clock_adjtime: ::c_long = 266; -pub const SYS_syncfs: ::c_long = 267; -pub const SYS_setns: ::c_long = 268; -pub const SYS_sendmmsg: ::c_long = 269; -pub const SYS_process_vm_readv: ::c_long = 270; -pub const SYS_process_vm_writev: ::c_long = 271; -pub const SYS_kcmp: ::c_long = 272; -pub const SYS_finit_module: ::c_long = 273; -pub const SYS_sched_setattr: ::c_long = 274; -pub const SYS_sched_getattr: ::c_long = 275; -pub const SYS_renameat2: ::c_long = 276; -pub const SYS_seccomp: ::c_long = 277; -pub const SYS_getrandom: ::c_long = 278; -pub const SYS_memfd_create: ::c_long = 279; -pub const SYS_bpf: ::c_long = 280; -pub const SYS_execveat: ::c_long = 281; -pub const SYS_userfaultfd: ::c_long = 282; -pub const SYS_membarrier: ::c_long = 283; -pub const SYS_mlock2: ::c_long = 284; -pub const SYS_copy_file_range: ::c_long = 285; -pub const SYS_preadv2: ::c_long = 286; -pub const SYS_pwritev2: ::c_long = 287; -pub const SYS_pkey_mprotect: ::c_long = 288; -pub const SYS_pkey_alloc: ::c_long = 289; -pub const SYS_pkey_free: ::c_long = 290; diff -Nru cargo-0.35.0/vendor/libc/src/fuchsia/mod.rs cargo-0.37.0/vendor/libc/src/fuchsia/mod.rs --- cargo-0.35.0/vendor/libc/src/fuchsia/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/fuchsia/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -5,15 +5,6 @@ // PUB_TYPE -pub type int8_t = i8; -pub type int16_t = i16; -pub type int32_t = i32; -pub type int64_t = i64; -pub type uint8_t = u8; -pub type uint16_t = u16; -pub type uint32_t = u32; -pub type uint64_t = u64; - pub type c_schar = i8; pub type c_uchar = u8; pub type c_short = i16; @@ -27,6 +18,8 @@ pub type intmax_t = i64; pub type uintmax_t = u64; +pub type locale_t = *mut ::c_void; + pub type size_t = usize; pub type ptrdiff_t = isize; pub type intptr_t = isize; @@ -110,12 +103,7 @@ impl ::Clone for DIR { fn clone(&self) -> DIR { *self } } -#[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum locale_t {} -impl ::Copy for locale_t {} -impl ::Clone for locale_t { - fn clone(&self) -> locale_t { *self } -} + #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos64_t {} // TODO: fill this out with a struct impl ::Copy for fpos64_t {} @@ -369,13 +357,6 @@ pub ai_next: *mut addrinfo, } - pub struct sockaddr_nl { - pub nl_family: ::sa_family_t, - nl_pad: ::c_ushort, - pub nl_pid: u32, - pub nl_groups: u32 - } - pub struct sockaddr_ll { pub sll_family: ::c_ushort, pub sll_protocol: ::c_ushort, @@ -420,8 +401,8 @@ } pub struct epoll_event { - pub events: ::uint32_t, - pub u64: ::uint64_t, + pub events: u32, + pub u64: u64, } pub struct lconv { @@ -451,15 +432,6 @@ pub int_n_sign_posn: ::c_char, } - pub struct sigevent { - pub sigev_value: ::sigval, - pub sigev_signo: ::c_int, - pub sigev_notify: ::c_int, - pub sigev_notify_function: fn(::sigval), - pub sigev_notify_attributes: *mut pthread_attr_t, - pub __pad: [::c_char; 56 - 3 * 8 /* 8 == sizeof(long) */], - } - pub struct rlimit64 { pub rlim_cur: rlim64_t, pub rlim_max: rlim64_t, @@ -531,40 +503,40 @@ } pub struct dqblk { - pub dqb_bhardlimit: ::uint64_t, - pub dqb_bsoftlimit: ::uint64_t, - pub dqb_curspace: ::uint64_t, - pub dqb_ihardlimit: ::uint64_t, - pub dqb_isoftlimit: ::uint64_t, - pub dqb_curinodes: ::uint64_t, - pub dqb_btime: ::uint64_t, - pub dqb_itime: ::uint64_t, - pub dqb_valid: ::uint32_t, + pub dqb_bhardlimit: u64, + pub dqb_bsoftlimit: u64, + pub dqb_curspace: u64, + pub dqb_ihardlimit: u64, + pub dqb_isoftlimit: u64, + pub dqb_curinodes: u64, + pub dqb_btime: u64, + pub dqb_itime: u64, + pub dqb_valid: u32, } pub struct signalfd_siginfo { - pub ssi_signo: ::uint32_t, - pub ssi_errno: ::int32_t, - pub ssi_code: ::int32_t, - pub ssi_pid: ::uint32_t, - pub ssi_uid: ::uint32_t, - pub ssi_fd: ::int32_t, - pub ssi_tid: ::uint32_t, - pub ssi_band: ::uint32_t, - pub ssi_overrun: ::uint32_t, - pub ssi_trapno: ::uint32_t, - pub ssi_status: ::int32_t, - pub ssi_int: ::int32_t, - pub ssi_ptr: ::uint64_t, - pub ssi_utime: ::uint64_t, - pub ssi_stime: ::uint64_t, - pub ssi_addr: ::uint64_t, - pub ssi_addr_lsb: ::uint16_t, - _pad2: ::uint16_t, - pub ssi_syscall: ::int32_t, - pub ssi_call_addr: ::uint64_t, - pub ssi_arch: ::uint32_t, - _pad: [::uint8_t; 28], + pub ssi_signo: u32, + pub ssi_errno: i32, + pub ssi_code: i32, + pub ssi_pid: u32, + pub ssi_uid: u32, + pub ssi_fd: i32, + pub ssi_tid: u32, + pub ssi_band: u32, + pub ssi_overrun: u32, + pub ssi_trapno: u32, + pub ssi_status: i32, + pub ssi_int: i32, + pub ssi_ptr: u64, + pub ssi_utime: u64, + pub ssi_stime: u64, + pub ssi_addr: u64, + pub ssi_addr_lsb: u16, + _pad2: u16, + pub ssi_syscall: i32, + pub ssi_call_addr: u64, + pub ssi_arch: u32, + _pad: [u8; 28], } pub struct itimerspec { @@ -576,32 +548,6 @@ __val: [::c_int; 2], } - // x32 compatibility - // See https://sourceware.org/bugzilla/show_bug.cgi?id=21279 - pub struct mq_attr { - #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] - pub mq_flags: i64, - #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] - pub mq_maxmsg: i64, - #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] - pub mq_msgsize: i64, - #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] - pub mq_curmsgs: i64, - #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] - pad: [i64; 4], - - #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] - pub mq_flags: ::c_long, - #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] - pub mq_maxmsg: ::c_long, - #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] - pub mq_msgsize: ::c_long, - #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] - pub mq_curmsgs: ::c_long, - #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] - pad: [::c_long; 4], - } - pub struct cpu_set_t { #[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))] @@ -974,6 +920,48 @@ pub d_type: ::c_uchar, pub d_name: [::c_char; 256], } + + // x32 compatibility + // See https://sourceware.org/bugzilla/show_bug.cgi?id=21279 + pub struct mq_attr { + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub mq_flags: i64, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub mq_maxmsg: i64, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub mq_msgsize: i64, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub mq_curmsgs: i64, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pad: [i64; 4], + + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub mq_flags: ::c_long, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub mq_maxmsg: ::c_long, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub mq_msgsize: ::c_long, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub mq_curmsgs: ::c_long, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pad: [::c_long; 4], + } + + pub struct sockaddr_nl { + pub nl_family: ::sa_family_t, + nl_pad: ::c_ushort, + pub nl_pid: u32, + pub nl_groups: u32 + } + + pub struct sigevent { + pub sigev_value: ::sigval, + pub sigev_signo: ::c_int, + pub sigev_notify: ::c_int, + pub sigev_notify_function: fn(::sigval), + pub sigev_notify_attributes: *mut pthread_attr_t, + pub __pad: [::c_char; 56 - 3 * 8 /* 8 == sizeof(long) */], + } } cfg_if! { @@ -1214,6 +1202,92 @@ self.d_name.hash(state); } } + + impl PartialEq for mq_attr { + fn eq(&self, other: &mq_attr) -> bool { + self.mq_flags == other.mq_flags && + self.mq_maxmsg == other.mq_maxmsg && + self.mq_msgsize == other.mq_msgsize && + self.mq_curmsgs == other.mq_curmsgs + } + } + impl Eq for mq_attr {} + impl ::fmt::Debug for mq_attr { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("mq_attr") + .field("mq_flags", &self.mq_flags) + .field("mq_maxmsg", &self.mq_maxmsg) + .field("mq_msgsize", &self.mq_msgsize) + .field("mq_curmsgs", &self.mq_curmsgs) + .finish() + } + } + impl ::hash::Hash for mq_attr { + fn hash(&self, state: &mut H) { + self.mq_flags.hash(state); + self.mq_maxmsg.hash(state); + self.mq_msgsize.hash(state); + self.mq_curmsgs.hash(state); + } + } + + impl PartialEq for sockaddr_nl { + fn eq(&self, other: &sockaddr_nl) -> bool { + self.nl_family == other.nl_family && + self.nl_pid == other.nl_pid && + self.nl_groups == other.nl_groups + } + } + impl Eq for sockaddr_nl {} + impl ::fmt::Debug for sockaddr_nl { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sockaddr_nl") + .field("nl_family", &self.nl_family) + .field("nl_pid", &self.nl_pid) + .field("nl_groups", &self.nl_groups) + .finish() + } + } + impl ::hash::Hash for sockaddr_nl { + fn hash(&self, state: &mut H) { + self.nl_family.hash(state); + self.nl_pid.hash(state); + self.nl_groups.hash(state); + } + } + + impl PartialEq for sigevent { + fn eq(&self, other: &sigevent) -> bool { + self.sigev_value == other.sigev_value + && self.sigev_signo == other.sigev_signo + && self.sigev_notify == other.sigev_notify + && self.sigev_notify_function == other.sigev_notify_function + && self.sigev_notify_attributes + == other.sigev_notify_attributes + } + } + impl Eq for sigevent {} + impl ::fmt::Debug for sigevent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sigevent") + .field("sigev_value", &self.sigev_value) + .field("sigev_signo", &self.sigev_signo) + .field("sigev_notify", &self.sigev_notify) + .field("sigev_notify_function", &self.sigev_notify_function) + .field("sigev_notify_attributes", + &self.sigev_notify_attributes) + .finish() + } + } + impl ::hash::Hash for sigevent { + fn hash(&self, state: &mut H) { + self.sigev_value.hash(state); + self.sigev_signo.hash(state); + self.sigev_notify.hash(state); + self.sigev_notify_function.hash(state); + self.sigev_notify_attributes.hash(state); + } + } } } @@ -1753,16 +1827,16 @@ pub const Q_GETFMT: ::c_int = 0x800004; pub const Q_GETINFO: ::c_int = 0x800005; pub const Q_SETINFO: ::c_int = 0x800006; -pub const QIF_BLIMITS: ::uint32_t = 1; -pub const QIF_SPACE: ::uint32_t = 2; -pub const QIF_ILIMITS: ::uint32_t = 4; -pub const QIF_INODES: ::uint32_t = 8; -pub const QIF_BTIME: ::uint32_t = 16; -pub const QIF_ITIME: ::uint32_t = 32; -pub const QIF_LIMITS: ::uint32_t = 5; -pub const QIF_USAGE: ::uint32_t = 10; -pub const QIF_TIMES: ::uint32_t = 48; -pub const QIF_ALL: ::uint32_t = 63; +pub const QIF_BLIMITS: u32 = 1; +pub const QIF_SPACE: u32 = 2; +pub const QIF_ILIMITS: u32 = 4; +pub const QIF_INODES: u32 = 8; +pub const QIF_BTIME: u32 = 16; +pub const QIF_ITIME: u32 = 32; +pub const QIF_LIMITS: u32 = 5; +pub const QIF_USAGE: u32 = 10; +pub const QIF_TIMES: u32 = 48; +pub const QIF_ALL: u32 = 63; pub const MNT_FORCE: ::c_int = 0x1; @@ -2522,9 +2596,6 @@ pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3; pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4; -pub const GRND_NONBLOCK: ::c_uint = 0x0001; -pub const GRND_RANDOM: ::c_uint = 0x0002; - pub const ITIMER_REAL: ::c_int = 0; pub const ITIMER_VIRTUAL: ::c_int = 1; pub const ITIMER_PROF: ::c_int = 2; diff -Nru cargo-0.35.0/vendor/libc/src/fuchsia/x86_64.rs cargo-0.37.0/vendor/libc/src/fuchsia/x86_64.rs --- cargo-0.35.0/vendor/libc/src/fuchsia/x86_64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/fuchsia/x86_64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -117,340 +117,6 @@ } } -// Syscall table - -pub const SYS_read: ::c_long = 0; -pub const SYS_write: ::c_long = 1; -pub const SYS_open: ::c_long = 2; -pub const SYS_close: ::c_long = 3; -pub const SYS_stat: ::c_long = 4; -pub const SYS_fstat: ::c_long = 5; -pub const SYS_lstat: ::c_long = 6; -pub const SYS_poll: ::c_long = 7; -pub const SYS_lseek: ::c_long = 8; -pub const SYS_mmap: ::c_long = 9; -pub const SYS_mprotect: ::c_long = 10; -pub const SYS_munmap: ::c_long = 11; -pub const SYS_brk: ::c_long = 12; -pub const SYS_rt_sigaction: ::c_long = 13; -pub const SYS_rt_sigprocmask: ::c_long = 14; -pub const SYS_rt_sigreturn: ::c_long = 15; -pub const SYS_ioctl: ::c_long = 16; -pub const SYS_pread64: ::c_long = 17; -pub const SYS_pwrite64: ::c_long = 18; -pub const SYS_readv: ::c_long = 19; -pub const SYS_writev: ::c_long = 20; -pub const SYS_access: ::c_long = 21; -pub const SYS_pipe: ::c_long = 22; -pub const SYS_select: ::c_long = 23; -pub const SYS_sched_yield: ::c_long = 24; -pub const SYS_mremap: ::c_long = 25; -pub const SYS_msync: ::c_long = 26; -pub const SYS_mincore: ::c_long = 27; -pub const SYS_madvise: ::c_long = 28; -pub const SYS_shmget: ::c_long = 29; -pub const SYS_shmat: ::c_long = 30; -pub const SYS_shmctl: ::c_long = 31; -pub const SYS_dup: ::c_long = 32; -pub const SYS_dup2: ::c_long = 33; -pub const SYS_pause: ::c_long = 34; -pub const SYS_nanosleep: ::c_long = 35; -pub const SYS_getitimer: ::c_long = 36; -pub const SYS_alarm: ::c_long = 37; -pub const SYS_setitimer: ::c_long = 38; -pub const SYS_getpid: ::c_long = 39; -pub const SYS_sendfile: ::c_long = 40; -pub const SYS_socket: ::c_long = 41; -pub const SYS_connect: ::c_long = 42; -pub const SYS_accept: ::c_long = 43; -pub const SYS_sendto: ::c_long = 44; -pub const SYS_recvfrom: ::c_long = 45; -pub const SYS_sendmsg: ::c_long = 46; -pub const SYS_recvmsg: ::c_long = 47; -pub const SYS_shutdown: ::c_long = 48; -pub const SYS_bind: ::c_long = 49; -pub const SYS_listen: ::c_long = 50; -pub const SYS_getsockname: ::c_long = 51; -pub const SYS_getpeername: ::c_long = 52; -pub const SYS_socketpair: ::c_long = 53; -pub const SYS_setsockopt: ::c_long = 54; -pub const SYS_getsockopt: ::c_long = 55; -pub const SYS_clone: ::c_long = 56; -pub const SYS_fork: ::c_long = 57; -pub const SYS_vfork: ::c_long = 58; -pub const SYS_execve: ::c_long = 59; -pub const SYS_exit: ::c_long = 60; -pub const SYS_wait4: ::c_long = 61; -pub const SYS_kill: ::c_long = 62; -pub const SYS_uname: ::c_long = 63; -pub const SYS_semget: ::c_long = 64; -pub const SYS_semop: ::c_long = 65; -pub const SYS_semctl: ::c_long = 66; -pub const SYS_shmdt: ::c_long = 67; -pub const SYS_msgget: ::c_long = 68; -pub const SYS_msgsnd: ::c_long = 69; -pub const SYS_msgrcv: ::c_long = 70; -pub const SYS_msgctl: ::c_long = 71; -pub const SYS_fcntl: ::c_long = 72; -pub const SYS_flock: ::c_long = 73; -pub const SYS_fsync: ::c_long = 74; -pub const SYS_fdatasync: ::c_long = 75; -pub const SYS_truncate: ::c_long = 76; -pub const SYS_ftruncate: ::c_long = 77; -pub const SYS_getdents: ::c_long = 78; -pub const SYS_getcwd: ::c_long = 79; -pub const SYS_chdir: ::c_long = 80; -pub const SYS_fchdir: ::c_long = 81; -pub const SYS_rename: ::c_long = 82; -pub const SYS_mkdir: ::c_long = 83; -pub const SYS_rmdir: ::c_long = 84; -pub const SYS_creat: ::c_long = 85; -pub const SYS_link: ::c_long = 86; -pub const SYS_unlink: ::c_long = 87; -pub const SYS_symlink: ::c_long = 88; -pub const SYS_readlink: ::c_long = 89; -pub const SYS_chmod: ::c_long = 90; -pub const SYS_fchmod: ::c_long = 91; -pub const SYS_chown: ::c_long = 92; -pub const SYS_fchown: ::c_long = 93; -pub const SYS_lchown: ::c_long = 94; -pub const SYS_umask: ::c_long = 95; -pub const SYS_gettimeofday: ::c_long = 96; -pub const SYS_getrlimit: ::c_long = 97; -pub const SYS_getrusage: ::c_long = 98; -pub const SYS_sysinfo: ::c_long = 99; -pub const SYS_times: ::c_long = 100; -pub const SYS_ptrace: ::c_long = 101; -pub const SYS_getuid: ::c_long = 102; -pub const SYS_syslog: ::c_long = 103; -pub const SYS_getgid: ::c_long = 104; -pub const SYS_setuid: ::c_long = 105; -pub const SYS_setgid: ::c_long = 106; -pub const SYS_geteuid: ::c_long = 107; -pub const SYS_getegid: ::c_long = 108; -pub const SYS_setpgid: ::c_long = 109; -pub const SYS_getppid: ::c_long = 110; -pub const SYS_getpgrp: ::c_long = 111; -pub const SYS_setsid: ::c_long = 112; -pub const SYS_setreuid: ::c_long = 113; -pub const SYS_setregid: ::c_long = 114; -pub const SYS_getgroups: ::c_long = 115; -pub const SYS_setgroups: ::c_long = 116; -pub const SYS_setresuid: ::c_long = 117; -pub const SYS_getresuid: ::c_long = 118; -pub const SYS_setresgid: ::c_long = 119; -pub const SYS_getresgid: ::c_long = 120; -pub const SYS_getpgid: ::c_long = 121; -pub const SYS_setfsuid: ::c_long = 122; -pub const SYS_setfsgid: ::c_long = 123; -pub const SYS_getsid: ::c_long = 124; -pub const SYS_capget: ::c_long = 125; -pub const SYS_capset: ::c_long = 126; -pub const SYS_rt_sigpending: ::c_long = 127; -pub const SYS_rt_sigtimedwait: ::c_long = 128; -pub const SYS_rt_sigqueueinfo: ::c_long = 129; -pub const SYS_rt_sigsuspend: ::c_long = 130; -pub const SYS_sigaltstack: ::c_long = 131; -pub const SYS_utime: ::c_long = 132; -pub const SYS_mknod: ::c_long = 133; -pub const SYS_uselib: ::c_long = 134; -pub const SYS_personality: ::c_long = 135; -pub const SYS_ustat: ::c_long = 136; -pub const SYS_statfs: ::c_long = 137; -pub const SYS_fstatfs: ::c_long = 138; -pub const SYS_sysfs: ::c_long = 139; -pub const SYS_getpriority: ::c_long = 140; -pub const SYS_setpriority: ::c_long = 141; -pub const SYS_sched_setparam: ::c_long = 142; -pub const SYS_sched_getparam: ::c_long = 143; -pub const SYS_sched_setscheduler: ::c_long = 144; -pub const SYS_sched_getscheduler: ::c_long = 145; -pub const SYS_sched_get_priority_max: ::c_long = 146; -pub const SYS_sched_get_priority_min: ::c_long = 147; -pub const SYS_sched_rr_get_interval: ::c_long = 148; -pub const SYS_mlock: ::c_long = 149; -pub const SYS_munlock: ::c_long = 150; -pub const SYS_mlockall: ::c_long = 151; -pub const SYS_munlockall: ::c_long = 152; -pub const SYS_vhangup: ::c_long = 153; -pub const SYS_modify_ldt: ::c_long = 154; -pub const SYS_pivot_root: ::c_long = 155; -pub const SYS__sysctl: ::c_long = 156; -pub const SYS_prctl: ::c_long = 157; -pub const SYS_arch_prctl: ::c_long = 158; -pub const SYS_adjtimex: ::c_long = 159; -pub const SYS_setrlimit: ::c_long = 160; -pub const SYS_chroot: ::c_long = 161; -pub const SYS_sync: ::c_long = 162; -pub const SYS_acct: ::c_long = 163; -pub const SYS_settimeofday: ::c_long = 164; -pub const SYS_mount: ::c_long = 165; -pub const SYS_umount2: ::c_long = 166; -pub const SYS_swapon: ::c_long = 167; -pub const SYS_swapoff: ::c_long = 168; -pub const SYS_reboot: ::c_long = 169; -pub const SYS_sethostname: ::c_long = 170; -pub const SYS_setdomainname: ::c_long = 171; -pub const SYS_iopl: ::c_long = 172; -pub const SYS_ioperm: ::c_long = 173; -pub const SYS_create_module: ::c_long = 174; -pub const SYS_init_module: ::c_long = 175; -pub const SYS_delete_module: ::c_long = 176; -pub const SYS_get_kernel_syms: ::c_long = 177; -pub const SYS_query_module: ::c_long = 178; -pub const SYS_quotactl: ::c_long = 179; -pub const SYS_nfsservctl: ::c_long = 180; -pub const SYS_getpmsg: ::c_long = 181; -pub const SYS_putpmsg: ::c_long = 182; -pub const SYS_afs_syscall: ::c_long = 183; -pub const SYS_tuxcall: ::c_long = 184; -pub const SYS_security: ::c_long = 185; -pub const SYS_gettid: ::c_long = 186; -pub const SYS_readahead: ::c_long = 187; -pub const SYS_setxattr: ::c_long = 188; -pub const SYS_lsetxattr: ::c_long = 189; -pub const SYS_fsetxattr: ::c_long = 190; -pub const SYS_getxattr: ::c_long = 191; -pub const SYS_lgetxattr: ::c_long = 192; -pub const SYS_fgetxattr: ::c_long = 193; -pub const SYS_listxattr: ::c_long = 194; -pub const SYS_llistxattr: ::c_long = 195; -pub const SYS_flistxattr: ::c_long = 196; -pub const SYS_removexattr: ::c_long = 197; -pub const SYS_lremovexattr: ::c_long = 198; -pub const SYS_fremovexattr: ::c_long = 199; -pub const SYS_tkill: ::c_long = 200; -pub const SYS_time: ::c_long = 201; -pub const SYS_futex: ::c_long = 202; -pub const SYS_sched_setaffinity: ::c_long = 203; -pub const SYS_sched_getaffinity: ::c_long = 204; -pub const SYS_set_thread_area: ::c_long = 205; -pub const SYS_io_setup: ::c_long = 206; -pub const SYS_io_destroy: ::c_long = 207; -pub const SYS_io_getevents: ::c_long = 208; -pub const SYS_io_submit: ::c_long = 209; -pub const SYS_io_cancel: ::c_long = 210; -pub const SYS_get_thread_area: ::c_long = 211; -pub const SYS_lookup_dcookie: ::c_long = 212; -pub const SYS_epoll_create: ::c_long = 213; -pub const SYS_epoll_ctl_old: ::c_long = 214; -pub const SYS_epoll_wait_old: ::c_long = 215; -pub const SYS_remap_file_pages: ::c_long = 216; -pub const SYS_getdents64: ::c_long = 217; -pub const SYS_set_tid_address: ::c_long = 218; -pub const SYS_restart_syscall: ::c_long = 219; -pub const SYS_semtimedop: ::c_long = 220; -pub const SYS_fadvise64: ::c_long = 221; -pub const SYS_timer_create: ::c_long = 222; -pub const SYS_timer_settime: ::c_long = 223; -pub const SYS_timer_gettime: ::c_long = 224; -pub const SYS_timer_getoverrun: ::c_long = 225; -pub const SYS_timer_delete: ::c_long = 226; -pub const SYS_clock_settime: ::c_long = 227; -pub const SYS_clock_gettime: ::c_long = 228; -pub const SYS_clock_getres: ::c_long = 229; -pub const SYS_clock_nanosleep: ::c_long = 230; -pub const SYS_exit_group: ::c_long = 231; -pub const SYS_epoll_wait: ::c_long = 232; -pub const SYS_epoll_ctl: ::c_long = 233; -pub const SYS_tgkill: ::c_long = 234; -pub const SYS_utimes: ::c_long = 235; -pub const SYS_vserver: ::c_long = 236; -pub const SYS_mbind: ::c_long = 237; -pub const SYS_set_mempolicy: ::c_long = 238; -pub const SYS_get_mempolicy: ::c_long = 239; -pub const SYS_mq_open: ::c_long = 240; -pub const SYS_mq_unlink: ::c_long = 241; -pub const SYS_mq_timedsend: ::c_long = 242; -pub const SYS_mq_timedreceive: ::c_long = 243; -pub const SYS_mq_notify: ::c_long = 244; -pub const SYS_mq_getsetattr: ::c_long = 245; -pub const SYS_kexec_load: ::c_long = 246; -pub const SYS_waitid: ::c_long = 247; -pub const SYS_add_key: ::c_long = 248; -pub const SYS_request_key: ::c_long = 249; -pub const SYS_keyctl: ::c_long = 250; -pub const SYS_ioprio_set: ::c_long = 251; -pub const SYS_ioprio_get: ::c_long = 252; -pub const SYS_inotify_init: ::c_long = 253; -pub const SYS_inotify_add_watch: ::c_long = 254; -pub const SYS_inotify_rm_watch: ::c_long = 255; -pub const SYS_migrate_pages: ::c_long = 256; -pub const SYS_openat: ::c_long = 257; -pub const SYS_mkdirat: ::c_long = 258; -pub const SYS_mknodat: ::c_long = 259; -pub const SYS_fchownat: ::c_long = 260; -pub const SYS_futimesat: ::c_long = 261; -pub const SYS_newfstatat: ::c_long = 262; -pub const SYS_unlinkat: ::c_long = 263; -pub const SYS_renameat: ::c_long = 264; -pub const SYS_linkat: ::c_long = 265; -pub const SYS_symlinkat: ::c_long = 266; -pub const SYS_readlinkat: ::c_long = 267; -pub const SYS_fchmodat: ::c_long = 268; -pub const SYS_faccessat: ::c_long = 269; -pub const SYS_pselect6: ::c_long = 270; -pub const SYS_ppoll: ::c_long = 271; -pub const SYS_unshare: ::c_long = 272; -pub const SYS_set_robust_list: ::c_long = 273; -pub const SYS_get_robust_list: ::c_long = 274; -pub const SYS_splice: ::c_long = 275; -pub const SYS_tee: ::c_long = 276; -pub const SYS_sync_file_range: ::c_long = 277; -pub const SYS_vmsplice: ::c_long = 278; -pub const SYS_move_pages: ::c_long = 279; -pub const SYS_utimensat: ::c_long = 280; -pub const SYS_epoll_pwait: ::c_long = 281; -pub const SYS_signalfd: ::c_long = 282; -pub const SYS_timerfd_create: ::c_long = 283; -pub const SYS_eventfd: ::c_long = 284; -pub const SYS_fallocate: ::c_long = 285; -pub const SYS_timerfd_settime: ::c_long = 286; -pub const SYS_timerfd_gettime: ::c_long = 287; -pub const SYS_accept4: ::c_long = 288; -pub const SYS_signalfd4: ::c_long = 289; -pub const SYS_eventfd2: ::c_long = 290; -pub const SYS_epoll_create1: ::c_long = 291; -pub const SYS_dup3: ::c_long = 292; -pub const SYS_pipe2: ::c_long = 293; -pub const SYS_inotify_init1: ::c_long = 294; -pub const SYS_preadv: ::c_long = 295; -pub const SYS_pwritev: ::c_long = 296; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 297; -pub const SYS_perf_event_open: ::c_long = 298; -pub const SYS_recvmmsg: ::c_long = 299; -pub const SYS_fanotify_init: ::c_long = 300; -pub const SYS_fanotify_mark: ::c_long = 301; -pub const SYS_prlimit64: ::c_long = 302; -pub const SYS_name_to_handle_at: ::c_long = 303; -pub const SYS_open_by_handle_at: ::c_long = 304; -pub const SYS_clock_adjtime: ::c_long = 305; -pub const SYS_syncfs: ::c_long = 306; -pub const SYS_sendmmsg: ::c_long = 307; -pub const SYS_setns: ::c_long = 308; -pub const SYS_getcpu: ::c_long = 309; -pub const SYS_process_vm_readv: ::c_long = 310; -pub const SYS_process_vm_writev: ::c_long = 311; -pub const SYS_kcmp: ::c_long = 312; -pub const SYS_finit_module: ::c_long = 313; -pub const SYS_sched_setattr: ::c_long = 314; -pub const SYS_sched_getattr: ::c_long = 315; -pub const SYS_renameat2: ::c_long = 316; -pub const SYS_seccomp: ::c_long = 317; -pub const SYS_getrandom: ::c_long = 318; -pub const SYS_memfd_create: ::c_long = 319; -pub const SYS_kexec_file_load: ::c_long = 320; -pub const SYS_bpf: ::c_long = 321; -pub const SYS_execveat: ::c_long = 322; -pub const SYS_userfaultfd: ::c_long = 323; -pub const SYS_membarrier: ::c_long = 324; -pub const SYS_mlock2: ::c_long = 325; -pub const SYS_copy_file_range: ::c_long = 326; -pub const SYS_preadv2: ::c_long = 327; -pub const SYS_pwritev2: ::c_long = 328; -// FIXME syscalls 329-331 have been added in musl 1.16 -// See discussion https://github.com/rust-lang/libc/pull/699 - // offsets in user_regs_structs, from sys/reg.h pub const R15: ::c_int = 0; pub const R14: ::c_int = 1; @@ -484,8 +150,3 @@ pub const SIGSTKSZ: ::size_t = 8192; pub const MINSIGSTKSZ: ::size_t = 2048; - -#[doc(hidden)] -pub const AF_MAX: ::c_int = 42; -#[doc(hidden)] -pub const PF_MAX: ::c_int = AF_MAX; diff -Nru cargo-0.35.0/vendor/libc/src/hermit/mod.rs cargo-0.37.0/vendor/libc/src/hermit/mod.rs --- cargo-0.35.0/vendor/libc/src/hermit/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/hermit/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -13,15 +13,6 @@ // Ported by Colin Fink // and Stefan Lankes -pub type int8_t = i8; -pub type int16_t = i16; -pub type int32_t = i32; -pub type int64_t = i64; -pub type uint8_t = u8; -pub type uint16_t = u16; -pub type uint32_t = u32; -pub type uint64_t = u64; - pub type c_schar = i8; pub type c_uchar = u8; pub type c_short = i16; diff -Nru cargo-0.35.0/vendor/libc/src/lib.rs cargo-0.37.0/vendor/libc/src/lib.rs --- cargo-0.35.0/vendor/libc/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -21,11 +21,13 @@ feature = "rustc-dep-of-std", feature(cfg_target_vendor, link_cfg, no_core) )] +#![cfg_attr(libc_thread_local, feature(thread_local))] // Enable extra lints: #![cfg_attr(feature = "extra_traits", deny(missing_debug_implementations))] #![deny(missing_copy_implementations, safe_packed_borrows)] #![no_std] #![cfg_attr(feature = "rustc-dep-of-std", no_core)] +#![cfg_attr(target_os = "redox", feature(static_nobundle))] #[macro_use] mod macros; @@ -89,30 +91,51 @@ cfg_if! { if #[cfg(windows)] { + mod fixed_width_ints; + pub use fixed_width_ints::*; + mod windows; pub use windows::*; - } else if #[cfg(target_os = "redox")] { - mod redox; - pub use redox::*; } else if #[cfg(target_os = "cloudabi")] { + mod fixed_width_ints; + pub use fixed_width_ints::*; + mod cloudabi; pub use cloudabi::*; } else if #[cfg(target_os = "fuchsia")] { + mod fixed_width_ints; + pub use fixed_width_ints::*; + mod fuchsia; pub use fuchsia::*; } else if #[cfg(target_os = "switch")] { + mod fixed_width_ints; + pub use fixed_width_ints::*; + mod switch; pub use switch::*; } else if #[cfg(unix)] { + mod fixed_width_ints; + pub use fixed_width_ints::*; + mod unix; pub use unix::*; } else if #[cfg(target_os = "hermit")] { + mod fixed_width_ints; + pub use fixed_width_ints::*; + mod hermit; pub use hermit::*; } else if #[cfg(all(target_env = "sgx", target_vendor = "fortanix"))] { + mod fixed_width_ints; + pub use fixed_width_ints::*; + mod sgx; pub use sgx::*; } else if #[cfg(any(target_env = "wasi", target_os = "wasi"))] { + mod fixed_width_ints; + pub use fixed_width_ints::*; + mod wasi; pub use wasi::*; } else { diff -Nru cargo-0.35.0/vendor/libc/src/macros.rs cargo-0.37.0/vendor/libc/src/macros.rs --- cargo-0.35.0/vendor/libc/src/macros.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/macros.rs 2019-07-17 05:42:23.000000000 +0000 @@ -74,10 +74,13 @@ __item! { #[repr(C)] #[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] + #[allow(deprecated)] $(#[$attr])* pub struct $i { $($field)* } } + #[allow(deprecated)] impl ::Copy for $i {} + #[allow(deprecated)] impl ::Clone for $i { fn clone(&self) -> $i { *self } } @@ -155,3 +158,38 @@ }; )*) } + +// This macro is used to deprecate items that should be accessed via the mach crate +#[allow(unused_macros)] +macro_rules! deprecated_mach { + (pub const $id:ident: $ty:ty = $expr:expr;) => { + #[deprecated( + since = "0.2.55", + note = "Use the `mach` crate instead", + )] + #[allow(deprecated)] + pub const $id: $ty = $expr; + }; + ($(pub const $id:ident: $ty:ty = $expr:expr;)*) => { + $( + deprecated_mach!( + pub const $id: $ty = $expr; + ); + )* + }; + (pub type $id:ident = $ty:ty;) => { + #[deprecated( + since = "0.2.55", + note = "Use the `mach` crate instead", + )] + #[allow(deprecated)] + pub type $id = $ty; + }; + ($(pub type $id:ident = $ty:ty;)*) => { + $( + deprecated_mach!( + pub type $id = $ty; + ); + )* + } +} diff -Nru cargo-0.35.0/vendor/libc/src/redox/align.rs cargo-0.37.0/vendor/libc/src/redox/align.rs --- cargo-0.35.0/vendor/libc/src/redox/align.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/redox/align.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -s! { - #[repr(align(4))] - pub struct in6_addr { - pub s6_addr: [u8; 16], - } -} diff -Nru cargo-0.35.0/vendor/libc/src/redox/mod.rs cargo-0.37.0/vendor/libc/src/redox/mod.rs --- cargo-0.35.0/vendor/libc/src/redox/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/redox/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,416 +0,0 @@ -pub type int8_t = i8; -pub type int16_t = i16; -pub type int32_t = i32; -pub type int64_t = i64; -pub type uint8_t = u8; -pub type uint16_t = u16; -pub type uint32_t = u32; -pub type uint64_t = u64; - -pub type c_schar = i8; -pub type c_uchar = u8; -pub type c_short = i16; -pub type c_ushort = u16; -pub type c_int = i32; -pub type c_uint = u32; -pub type c_float = f32; -pub type c_double = f64; -pub type c_longlong = i64; -pub type c_ulonglong = u64; -pub type intmax_t = i64; -pub type uintmax_t = u64; - -pub type size_t = usize; -pub type ptrdiff_t = isize; -pub type intptr_t = isize; -pub type uintptr_t = usize; -pub type ssize_t = isize; - -pub type c_char = i8; -pub type c_long = i64; -pub type c_ulong = u64; - -pub type wchar_t = i32; -pub type wint_t = u32; -pub type wctype_t = i64; - -pub type regoff_t = size_t; -pub type off_t = c_long; -pub type mode_t = c_int; -pub type time_t = c_long; -pub type pid_t = c_int; -pub type id_t = c_uint; -pub type gid_t = c_int; -pub type uid_t = c_int; -pub type dev_t = c_long; -pub type ino_t = c_ulong; -pub type nlink_t = c_ulong; -pub type blksize_t = c_long; -pub type blkcnt_t = c_ulong; - -pub type fsblkcnt_t = c_ulong; -pub type fsfilcnt_t = c_ulong; - -pub type useconds_t = c_uint; -pub type suseconds_t = c_int; - -pub type clock_t = c_long; -pub type clockid_t = c_int; -pub type timer_t = *mut c_void; - -pub type nfds_t = c_ulong; - -s! { - pub struct fd_set { - fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE], - } - - pub struct pollfd { - pub fd: ::c_int, - pub events: ::c_short, - pub revents: ::c_short, - } - - pub struct stat { - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_nlink: ::nlink_t, - pub st_mode: ::mode_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt_t, - - pub st_atime: ::timespec, - pub st_mtime: ::timespec, - pub st_ctime: ::timespec, - - _pad: [c_char; 24], - } - - pub struct timeval { - pub tv_sec: time_t, - pub tv_usec: suseconds_t, - } - - pub struct timespec { - pub tv_sec: time_t, - pub tv_nsec: c_long, - } -} - -pub const INT_MIN: c_int = -2147483648; -pub const INT_MAX: c_int = 2147483647; - -pub const STDIN_FILENO: ::c_int = 0; -pub const STDOUT_FILENO: ::c_int = 1; -pub const STDERR_FILENO: ::c_int = 2; - -pub const EXIT_FAILURE: ::c_int = 1; -pub const EXIT_SUCCESS: ::c_int = 0; - -pub const FD_SETSIZE: usize = 1024; - -pub const MAP_SHARED: ::c_int = 1; -pub const MAP_PRIVATE: ::c_int = 2; -pub const MAP_ANONYMOUS: ::c_int = 4; -pub const MAP_ANON: ::c_int = MAP_ANONYMOUS; - -pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; - -pub const POLLIN: ::c_short = 0x001; -pub const POLLPRI: ::c_short = 0x002; -pub const POLLOUT: ::c_short = 0x004; -pub const POLLERR: ::c_short = 0x008; -pub const POLLHUP: ::c_short = 0x010; -pub const POLLNVAL: ::c_short = 0x020; - -pub const PROT_NONE: ::c_int = 0; -pub const PROT_EXEC: ::c_int = 1; -pub const PROT_WRITE: ::c_int = 2; -pub const PROT_READ: ::c_int = 4; - -pub const S_ISUID: ::c_int = 0x800; -pub const S_ISGID: ::c_int = 0x400; -pub const S_ISVTX: ::c_int = 0x200; - -pub const S_IFIFO: mode_t = 0x1000; -pub const S_IFCHR: mode_t = 0x2000; -pub const S_IFBLK: mode_t = 0x6000; -pub const S_IFDIR: mode_t = 0x4000; -pub const S_IFREG: mode_t = 0x8000; -pub const S_IFLNK: mode_t = 0xA000; -pub const S_IFSOCK: mode_t = 0xC000; -pub const S_IFMT: mode_t = 0xF000; -pub const S_IEXEC: mode_t = 0x40; -pub const S_IWRITE: mode_t = 0x80; -pub const S_IREAD: mode_t = 0x100; -pub const S_IRWXU: mode_t = 0x1C0; -pub const S_IXUSR: mode_t = 0x40; -pub const S_IWUSR: mode_t = 0x80; -pub const S_IRUSR: mode_t = 0x100; -pub const S_IRWXG: mode_t = 0x38; -pub const S_IXGRP: mode_t = 0x8; -pub const S_IWGRP: mode_t = 0x10; -pub const S_IRGRP: mode_t = 0x20; -pub const S_IRWXO: mode_t = 0x7; -pub const S_IXOTH: mode_t = 0x1; -pub const S_IWOTH: mode_t = 0x2; -pub const S_IROTH: mode_t = 0x4; - -pub const F_DUPFD: ::c_int = 0; -pub const F_GETFD: ::c_int = 1; -pub const F_SETFD: ::c_int = 2; -pub const F_GETFL: ::c_int = 3; -pub const F_SETFL: ::c_int = 4; - -pub const FD_CLOEXEC: ::c_int = 0x0100_0000; - -pub const O_RDONLY: ::c_int = 0x0001_0000; -pub const O_WRONLY: ::c_int = 0x0002_0000; -pub const O_RDWR: ::c_int = 0x0003_0000; -pub const O_NONBLOCK: ::c_int = 0x0004_0000; -pub const O_APPEND: ::c_int = 0x0008_0000; -pub const O_SHLOCK: ::c_int = 0x0010_0000; -pub const O_EXLOCK: ::c_int = 0x0020_0000; -pub const O_ASYNC: ::c_int = 0x0040_0000; -pub const O_FSYNC: ::c_int = 0x0080_0000; -pub const O_CLOEXEC: ::c_int = 0x0100_0000; -pub const O_CREAT: ::c_int = 0x0200_0000; -pub const O_TRUNC: ::c_int = 0x0400_0000; -pub const O_EXCL: ::c_int = 0x0800_0000; -pub const O_DIRECTORY: ::c_int = 0x1000_0000; -pub const O_STAT: ::c_int = 0x2000_0000; -pub const O_SYMLINK: ::c_int = 0x4000_0000; -pub const O_NOFOLLOW: ::c_int = 0x8000_0000; -pub const O_ACCMODE: ::c_int = O_RDONLY | O_WRONLY | O_RDWR; - -pub const SIGHUP: ::c_int = 1; -pub const SIGINT: ::c_int = 2; -pub const SIGQUIT: ::c_int = 3; -pub const SIGILL: ::c_int = 4; -pub const SIGTRAP: ::c_int = 5; -pub const SIGABRT: ::c_int = 6; -pub const SIGBUS: ::c_int = 7; -pub const SIGFPE: ::c_int = 8; -pub const SIGKILL: ::c_int = 9; -pub const SIGUSR1: ::c_int = 10; -pub const SIGSEGV: ::c_int = 11; -pub const SIGUSR2: ::c_int = 12; -pub const SIGPIPE: ::c_int = 13; -pub const SIGALRM: ::c_int = 14; -pub const SIGTERM: ::c_int = 15; -pub const SIGSTKFLT: ::c_int = 16; -pub const SIGCHLD: ::c_int = 17; -pub const SIGCONT: ::c_int = 18; -pub const SIGSTOP: ::c_int = 19; -pub const SIGTSTP: ::c_int = 20; -pub const SIGTTIN: ::c_int = 21; -pub const SIGTTOU: ::c_int = 22; -pub const SIGURG: ::c_int = 23; -pub const SIGXCPU: ::c_int = 24; -pub const SIGXFSZ: ::c_int = 25; -pub const SIGVTALRM: ::c_int = 26; -pub const SIGPROF: ::c_int = 27; -pub const SIGWINCH: ::c_int = 28; -pub const SIGIO: ::c_int = 29; -pub const SIGPWR: ::c_int = 30; -pub const SIGSYS: ::c_int = 31; - -#[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum FILE {} -impl ::Copy for FILE {} -impl ::Clone for FILE { - fn clone(&self) -> FILE { *self } -} -#[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum fpos_t {} // TODO: fill this out with a struct -impl ::Copy for fpos_t {} -impl ::Clone for fpos_t { - fn clone(&self) -> fpos_t { *self } -} - -// intentionally not public, only used for fd_set -cfg_if! { - if #[cfg(target_pointer_width = "32")] { - const ULONG_SIZE: usize = 32; - } else if #[cfg(target_pointer_width = "64")] { - const ULONG_SIZE: usize = 64; - } else { - // Unknown target_pointer_width - } -} - -extern { - pub fn isalnum(c: c_int) -> c_int; - pub fn isalpha(c: c_int) -> c_int; - pub fn iscntrl(c: c_int) -> c_int; - pub fn isdigit(c: c_int) -> c_int; - pub fn isgraph(c: c_int) -> c_int; - pub fn islower(c: c_int) -> c_int; - pub fn isprint(c: c_int) -> c_int; - pub fn ispunct(c: c_int) -> c_int; - pub fn isspace(c: c_int) -> c_int; - pub fn isupper(c: c_int) -> c_int; - pub fn isxdigit(c: c_int) -> c_int; - pub fn tolower(c: c_int) -> c_int; - pub fn toupper(c: c_int) -> c_int; - pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE; - pub fn freopen(filename: *const c_char, mode: *const c_char, - file: *mut FILE) -> *mut FILE; - pub fn fflush(file: *mut FILE) -> c_int; - pub fn fclose(file: *mut FILE) -> c_int; - pub fn remove(filename: *const c_char) -> c_int; - pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int; - pub fn tmpfile() -> *mut FILE; - pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, - size: size_t) -> c_int; - pub fn setbuf(stream: *mut FILE, buf: *mut c_char); - pub fn getchar() -> c_int; - pub fn putchar(c: c_int) -> c_int; - pub fn fgetc(stream: *mut FILE) -> c_int; - pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char; - pub fn fputc(c: c_int, stream: *mut FILE) -> c_int; - pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int; - pub fn puts(s: *const c_char) -> c_int; - pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int; - pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t, - stream: *mut FILE) -> size_t; - pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t, - stream: *mut FILE) -> size_t; - pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int; - pub fn ftell(stream: *mut FILE) -> c_long; - pub fn rewind(stream: *mut FILE); - pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int; - pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int; - pub fn feof(stream: *mut FILE) -> c_int; - pub fn ferror(stream: *mut FILE) -> c_int; - pub fn perror(s: *const c_char); - pub fn atoi(s: *const c_char) -> c_int; - pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; - pub fn strtol(s: *const c_char, endp: *mut *mut c_char, - base: c_int) -> c_long; - pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, - base: c_int) -> c_ulong; - pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; - pub fn malloc(size: size_t) -> *mut c_void; - pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; - pub fn free(p: *mut c_void); - pub fn abort() -> !; - pub fn exit(status: c_int) -> !; - pub fn _exit(status: c_int) -> !; - pub fn atexit(cb: extern fn()) -> c_int; - pub fn system(s: *const c_char) -> c_int; - pub fn getenv(s: *const c_char) -> *mut c_char; - - pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char; - pub fn strncpy(dst: *mut c_char, src: *const c_char, - n: size_t) -> *mut c_char; - pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char; - pub fn strncat(s: *mut c_char, ct: *const c_char, - n: size_t) -> *mut c_char; - pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int; - pub fn strncmp(cs: *const c_char, ct: *const c_char, - n: size_t) -> c_int; - pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int; - pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char; - pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char; - pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t; - pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t; - pub fn strdup(cs: *const c_char) -> *mut c_char; - pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char; - pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char; - pub fn strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char; - pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int; - pub fn strncasecmp(s1: *const c_char, s2: *const c_char, - n: size_t) -> c_int; - pub fn strlen(cs: *const c_char) -> size_t; - pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t; - pub fn strerror(n: c_int) -> *mut c_char; - pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char; - pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t; - pub fn wcslen(buf: *const wchar_t) -> size_t; - pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, - n: size_t) -> ::size_t; - - pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; - pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int; - pub fn memcpy(dest: *mut c_void, src: *const c_void, - n: size_t) -> *mut c_void; - pub fn memmove(dest: *mut c_void, src: *const c_void, - n: size_t) -> *mut c_void; - pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void; - - pub fn abs(i: c_int) -> c_int; - pub fn atof(s: *const c_char) -> c_double; - pub fn labs(i: c_long) -> c_long; - pub fn rand() -> c_int; - pub fn srand(seed: c_uint); - - pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int; - pub fn close(fd: ::c_int) -> ::c_int; - pub fn fchown(fd: ::c_int, uid: ::uid_t, gid: ::gid_t) -> ::c_int; - pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int; - pub fn fstat(fd: ::c_int, buf: *mut stat) -> ::c_int; - pub fn fsync(fd: ::c_int) -> ::c_int; - pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int; - pub fn getpid() -> pid_t; - pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; - pub fn mmap(addr: *mut ::c_void, - len: ::size_t, - prot: ::c_int, - flags: ::c_int, - fd: ::c_int, - offset: off_t) - -> *mut ::c_void; - pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) - -> ::c_int; - pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int; - pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int; - pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t; - pub fn setenv(name: *const c_char, val: *const c_char, overwrite: ::c_int) - -> ::c_int; - pub fn unsetenv(name: *const c_char) -> ::c_int; - pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) - -> ::ssize_t; -} - -#[link(name = "c")] -#[link(name = "m")] -extern {} - -pub use self::net::*; - -mod net; - -cfg_if! { - if #[cfg(libc_core_cvoid)] { - pub use ::ffi::c_void; - } else { - // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help - // enable more optimization opportunities around it recognizing things - // like malloc/free. - #[repr(u8)] - #[allow(missing_copy_implementations)] - #[allow(missing_debug_implementations)] - pub enum c_void { - // Two dummy variants so the #[repr] attribute can be used. - #[doc(hidden)] - __variant1, - #[doc(hidden)] - __variant2, - } - } -} - -cfg_if! { - if #[cfg(libc_align)] { - mod align; - pub use self::align::*; - } else { - mod no_align; - pub use self::no_align::*; - } -} diff -Nru cargo-0.35.0/vendor/libc/src/redox/net.rs cargo-0.37.0/vendor/libc/src/redox/net.rs --- cargo-0.35.0/vendor/libc/src/redox/net.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/redox/net.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ -pub type in_addr_t = u32; -pub type in_port_t = u16; - -pub type socklen_t = u32; -pub type sa_family_t = u16; - -s! { - pub struct in_addr { - pub s_addr: in_addr_t, - } - - pub struct ip_mreq { - pub imr_multiaddr: in_addr, - pub imr_interface: in_addr, - } - - pub struct ipv6_mreq { - pub ipv6mr_multiaddr: ::in6_addr, - pub ipv6mr_interface: ::c_uint, - } - - pub struct linger { - pub l_onoff: ::c_int, - pub l_linger: ::c_int, - } - - pub struct sockaddr { - pub sa_family: sa_family_t, - pub sa_data: [::c_char; 14], - } - - pub struct sockaddr_in { - pub sin_family: sa_family_t, - pub sin_port: ::in_port_t, - pub sin_addr: ::in_addr, - pub sin_zero: [u8; 8], - } - - pub struct sockaddr_in6 { - pub sin6_family: sa_family_t, - pub sin6_port: in_port_t, - pub sin6_flowinfo: u32, - pub sin6_addr: ::in6_addr, - pub sin6_scope_id: u32, - } - - pub struct sockaddr_storage { - pub ss_family: sa_family_t, - pub __ss_padding: [u8; 26], - } -} - -pub const AF_INET: ::c_int = 2; -pub const AF_INET6: ::c_int = 23; - -pub const SOCK_STREAM: ::c_int = 1; -pub const SOCK_DGRAM: ::c_int = 2; - -pub const IPPROTO_TCP: ::c_int = 6; -pub const IPPROTO_IP: ::c_int = 0; -pub const IPPROTO_IPV6: ::c_int = 41; - -pub const TCP_KEEPIDLE: ::c_int = 4; -pub const TCP_NODELAY: ::c_int = 8193; - -pub const IP_TTL: ::c_int = 8; -pub const IP_MULTICAST_LOOP: ::c_int = 9; -pub const IP_MULTICAST_TTL: ::c_int = 10; -pub const IP_ADD_MEMBERSHIP: ::c_int = 11; -pub const IP_DROP_MEMBERSHIP: ::c_int = 12; - -pub const IPV6_MULTICAST_LOOP: ::c_int = 19; -pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20; -pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21; -pub const IPV6_V6ONLY: ::c_int = 26; - -pub const SOL_SOCKET: ::c_int = 65535; - -pub const SO_REUSEADDR: ::c_int = 4; -pub const SO_BROADCAST: ::c_int = 6; -pub const SO_KEEPALIVE: ::c_int = 8; -pub const SO_RCVTIMEO: ::c_int = 20; -pub const SO_SNDTIMEO: ::c_int = 21; -pub const SO_LINGER: ::c_int = 128; -pub const SO_SNDBUF: ::c_int = 4097; -pub const SO_RCVBUF: ::c_int = 4098; -pub const SO_ERROR: ::c_int = 4105; - -extern { - pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int; - pub fn bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t) -> ::c_int; - pub fn connect(socket: ::c_int, address: *const sockaddr, - len: socklen_t) -> ::c_int; - pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int; - pub fn getsockname(socket: ::c_int, address: *mut sockaddr, - address_len: *mut socklen_t) -> ::c_int; - pub fn getsockopt(sockfd: ::c_int, - level: ::c_int, - optname: ::c_int, - optval: *mut ::c_void, - optlen: *mut ::socklen_t) -> ::c_int; - pub fn setsockopt(socket: ::c_int, level: ::c_int, name: ::c_int, - value: *const ::c_void, - option_len: socklen_t) -> ::c_int; - pub fn getpeername(socket: ::c_int, address: *mut sockaddr, - address_len: *mut socklen_t) -> ::c_int; - pub fn sendto(socket: ::c_int, buf: *const ::c_void, len: ::size_t, - flags: ::c_int, addr: *const sockaddr, - addrlen: socklen_t) -> ::ssize_t; - pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, - flags: ::c_int) -> ::ssize_t; - pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, - flags: ::c_int, addr: *mut ::sockaddr, - addrlen: *mut ::socklen_t) -> ::ssize_t; - pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, - flags: ::c_int) -> ::ssize_t; -} diff -Nru cargo-0.35.0/vendor/libc/src/redox/no_align.rs cargo-0.37.0/vendor/libc/src/redox/no_align.rs --- cargo-0.35.0/vendor/libc/src/redox/no_align.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/redox/no_align.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -s! { - pub struct in6_addr { - pub s6_addr: [u8; 16], - __align: [u32; 0], - } -} diff -Nru cargo-0.35.0/vendor/libc/src/sgx.rs cargo-0.37.0/vendor/libc/src/sgx.rs --- cargo-0.35.0/vendor/libc/src/sgx.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/sgx.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,14 +1,5 @@ //! SGX C types definition -pub type int8_t = i8; -pub type int16_t = i16; -pub type int32_t = i32; -pub type int64_t = i64; -pub type uint8_t = u8; -pub type uint16_t = u16; -pub type uint32_t = u32; -pub type uint64_t = u64; - pub type c_schar = i8; pub type c_uchar = u8; pub type c_short = i16; diff -Nru cargo-0.35.0/vendor/libc/src/switch.rs cargo-0.37.0/vendor/libc/src/switch.rs --- cargo-0.35.0/vendor/libc/src/switch.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/switch.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,14 +1,5 @@ //! Switch C type definitions -pub type int8_t = i8; -pub type int16_t = i16; -pub type int32_t = i32; -pub type int64_t = i64; -pub type uint8_t = u8; -pub type uint16_t = u16; -pub type uint32_t = u32; -pub type uint64_t = u64; - pub type c_schar = i8; pub type c_uchar = u8; pub type c_short = i16; diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/apple/b32.rs cargo-0.37.0/vendor/libc/src/unix/bsd/apple/b32.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/apple/b32.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/apple/b32.rs 2019-07-17 05:42:23.000000000 +0000 @@ -39,8 +39,8 @@ pub struct bpf_hdr { pub bh_tstamp: ::timeval, - pub bh_caplen: ::uint32_t, - pub bh_datalen: ::uint32_t, + pub bh_caplen: u32, + pub bh_datalen: u32, pub bh_hdrlen: ::c_ushort, } } diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/apple/b64.rs cargo-0.37.0/vendor/libc/src/unix/bsd/apple/b64.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/apple/b64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/apple/b64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -44,8 +44,8 @@ pub struct bpf_hdr { pub bh_tstamp: ::timeval32, - pub bh_caplen: ::uint32_t, - pub bh_datalen: ::uint32_t, + pub bh_caplen: u32, + pub bh_datalen: u32, pub bh_hdrlen: ::c_ushort, } } diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/apple/mod.rs cargo-0.37.0/vendor/libc/src/unix/bsd/apple/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/apple/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/apple/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -11,7 +11,6 @@ pub type nlink_t = u16; pub type blksize_t = i32; pub type rlim_t = u64; -pub type mach_timebase_info_data_t = mach_timebase_info; pub type pthread_key_t = c_ulong; pub type sigset_t = u32; pub type clockid_t = ::c_uint; @@ -26,12 +25,17 @@ pub type integer_t = ::c_int; pub type cpu_type_t = integer_t; pub type cpu_subtype_t = integer_t; -pub type vm_prot_t = ::c_int; + pub type posix_spawnattr_t = *mut ::c_void; pub type posix_spawn_file_actions_t = *mut ::c_void; pub type key_t = ::c_int; pub type shmatt_t = ::c_ushort; -pub type vm_size_t = ::uintptr_t; + +deprecated_mach! { + pub type vm_prot_t = ::c_int; + pub type vm_size_t = ::uintptr_t; + pub type mach_timebase_info_data_t = mach_timebase_info; +} #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} @@ -83,6 +87,10 @@ pub ai_next: *mut addrinfo, } + #[deprecated( + since = "0.2.55", + note = "Use the `mach` crate instead", + )] pub struct mach_timebase_info { pub numer: u32, pub denom: u32, @@ -107,10 +115,10 @@ pub st_size: ::off_t, pub st_blocks: ::blkcnt_t, pub st_blksize: blksize_t, - pub st_flags: ::uint32_t, - pub st_gen: ::uint32_t, - pub st_lspare: ::int32_t, - pub st_qspare: [::int64_t; 2], + pub st_flags: u32, + pub st_gen: u32, + pub st_lspare: i32, + pub st_qspare: [i64; 2], } pub struct pthread_mutexattr_t { @@ -136,6 +144,8 @@ pub si_uid: ::uid_t, pub si_status: ::c_int, pub si_addr: *mut ::c_void, + //Requires it to be union for tests + //pub si_value: ::sigval, _pad: [usize; 9], } @@ -195,26 +205,26 @@ } pub struct kevent64_s { - pub ident: ::uint64_t, - pub filter: ::int16_t, - pub flags: ::uint16_t, - pub fflags: ::uint32_t, - pub data: ::int64_t, - pub udata: ::uint64_t, - pub ext: [::uint64_t; 2], + pub ident: u64, + pub filter: i16, + pub flags: u16, + pub fflags: u32, + pub data: i64, + pub udata: u64, + pub ext: [u64; 2], } pub struct dqblk { - pub dqb_bhardlimit: ::uint64_t, - pub dqb_bsoftlimit: ::uint64_t, - pub dqb_curbytes: ::uint64_t, - pub dqb_ihardlimit: ::uint32_t, - pub dqb_isoftlimit: ::uint32_t, - pub dqb_curinodes: ::uint32_t, - pub dqb_btime: ::uint32_t, - pub dqb_itime: ::uint32_t, - pub dqb_id: ::uint32_t, - pub dqb_spare: [::uint32_t; 4], + pub dqb_bhardlimit: u64, + pub dqb_bsoftlimit: u64, + pub dqb_curbytes: u64, + pub dqb_ihardlimit: u32, + pub dqb_isoftlimit: u32, + pub dqb_curinodes: u32, + pub dqb_btime: u32, + pub dqb_itime: u32, + pub dqb_id: u32, + pub dqb_spare: [u32; 4], } pub struct if_msghdr { @@ -279,14 +289,6 @@ pub int_n_sign_posn: ::c_char, } - pub struct sigevent { - pub sigev_notify: ::c_int, - pub sigev_signo: ::c_int, - pub sigev_value: ::sigval, - __unused1: *mut ::c_void, //actually a function pointer - pub sigev_notify_attributes: *mut ::pthread_attr_t - } - pub struct proc_taskinfo { pub pti_virtual_size: u64, pub pti_resident_size: u64, @@ -353,6 +355,10 @@ pub cr_groups: [::gid_t;16] } + #[deprecated( + since = "0.2.55", + note = "Use the `mach` crate instead", + )] pub struct mach_header { pub magic: u32, pub cputype: cpu_type_t, @@ -363,6 +369,10 @@ pub flags: u32, } + #[deprecated( + since = "0.2.55", + note = "Use the `mach` crate instead", + )] pub struct mach_header_64 { pub magic: u32, pub cputype: cpu_type_t, @@ -431,10 +441,10 @@ pub struct sockaddr_ctl { pub sc_len: ::c_uchar, pub sc_family: ::c_uchar, - pub ss_sysaddr: ::uint16_t, - pub sc_id: ::uint32_t, - pub sc_unit: ::uint32_t, - pub sc_reserved: [::uint32_t; 5], + pub ss_sysaddr: u16, + pub sc_id: u32, + pub sc_unit: u32, + pub sc_reserved: [u32; 5], } pub struct in_pktinfo { @@ -487,9 +497,9 @@ #[cfg_attr(libc_packedN, repr(packed(4)))] pub struct kevent { pub ident: ::uintptr_t, - pub filter: ::int16_t, - pub flags: ::uint16_t, - pub fflags: ::uint32_t, + pub filter: i16, + pub flags: u16, + pub fflags: u32, pub data: ::intptr_t, pub udata: *mut ::c_void, } @@ -498,13 +508,13 @@ pub struct semid_ds { // Note the manpage shows different types than the system header. pub sem_perm: ipc_perm, - pub sem_base: ::int32_t, + pub sem_base: i32, pub sem_nsems: ::c_ushort, pub sem_otime: ::time_t, - pub sem_pad1: ::int32_t, + pub sem_pad1: i32, pub sem_ctime: ::time_t, - pub sem_pad2: ::int32_t, - pub sem_pad3: [::int32_t; 4], + pub sem_pad2: i32, + pub sem_pad3: [i32; 4], } #[cfg_attr(libc_packedN, repr(packed(4)))] @@ -536,22 +546,22 @@ } pub struct statfs { - pub f_bsize: ::uint32_t, - pub f_iosize: ::int32_t, - pub f_blocks: ::uint64_t, - pub f_bfree: ::uint64_t, - pub f_bavail: ::uint64_t, - pub f_files: ::uint64_t, - pub f_ffree: ::uint64_t, + pub f_bsize: u32, + pub f_iosize: i32, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, pub f_fsid: ::fsid_t, pub f_owner: ::uid_t, - pub f_type: ::uint32_t, - pub f_flags: ::uint32_t, - pub f_fssubtype: ::uint32_t, + pub f_type: u32, + pub f_flags: u32, + pub f_fssubtype: u32, pub f_fstypename: [::c_char; 16], pub f_mntonname: [::c_char; 1024], pub f_mntfromname: [::c_char; 1024], - pub f_reserved: [::uint32_t; 8], + pub f_reserved: [u32; 8], } pub struct dirent { @@ -594,7 +604,37 @@ pub ut_type: ::c_short, pub ut_tv: ::timeval, pub ut_host: [::c_char; _UTX_HOSTSIZE], - ut_pad: [::uint32_t; 16], + ut_pad: [u32; 16], + } + + pub struct sigevent { + pub sigev_notify: ::c_int, + pub sigev_signo: ::c_int, + pub sigev_value: ::sigval, + __unused1: *mut ::c_void, //actually a function pointer + pub sigev_notify_attributes: *mut ::pthread_attr_t + } +} + +impl siginfo_t { + pub unsafe fn si_addr(&self) -> *mut ::c_void { + self.si_addr + } + + pub unsafe fn si_value(&self) -> ::sigval { + #[repr(C)] + struct siginfo_timer { + _si_signo: ::c_int, + _si_errno: ::c_int, + _si_code: ::c_int, + _si_pid: ::pid_t, + _si_uid: ::uid_t, + _si_status: ::c_int, + _si_addr: *mut ::c_void, + si_value: ::sigval, + } + + (*(self as *const siginfo_t as *const siginfo_timer)).si_value } } @@ -1143,6 +1183,39 @@ self.ut_pad.hash(state); } } + + impl PartialEq for sigevent { + fn eq(&self, other: &sigevent) -> bool { + self.sigev_notify == other.sigev_notify + && self.sigev_signo == other.sigev_signo + && self.sigev_value == other.sigev_value + && self.sigev_notify_attributes + == other.sigev_notify_attributes + } + } + + impl Eq for sigevent {} + + impl ::fmt::Debug for sigevent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sigevent") + .field("sigev_notify", &self.sigev_notify) + .field("sigev_signo", &self.sigev_signo) + .field("sigev_value", &self.sigev_value) + .field("sigev_notify_attributes", + &self.sigev_notify_attributes) + .finish() + } + } + + impl ::hash::Hash for sigevent { + fn hash(&self, state: &mut H) { + self.sigev_notify.hash(state); + self.sigev_signo.hash(state); + self.sigev_value.hash(state); + self.sigev_notify_attributes.hash(state); + } + } } } @@ -1361,103 +1434,106 @@ pub const MAP_ANON: ::c_int = 0x1000; pub const MAP_ANONYMOUS: ::c_int = MAP_ANON; -pub const VM_FLAGS_FIXED: ::c_int = 0x0000; -pub const VM_FLAGS_ANYWHERE: ::c_int = 0x0001; -pub const VM_FLAGS_PURGABLE: ::c_int = 0x0002; -pub const VM_FLAGS_RANDOM_ADDR: ::c_int = 0x0008; -pub const VM_FLAGS_NO_CACHE: ::c_int = 0x0010; -pub const VM_FLAGS_RESILIENT_CODESIGN: ::c_int = 0x0020; -pub const VM_FLAGS_RESILIENT_MEDIA: ::c_int = 0x0040; -pub const VM_FLAGS_OVERWRITE: ::c_int = 0x4000; -pub const VM_FLAGS_SUPERPAGE_MASK: ::c_int = 0x70000; -pub const VM_FLAGS_RETURN_DATA_ADDR: ::c_int = 0x100000; -pub const VM_FLAGS_RETURN_4K_DATA_ADDR: ::c_int = 0x800000; -pub const VM_FLAGS_ALIAS_MASK: ::c_int = 0xFF000000; -pub const VM_FLAGS_USER_ALLOCATE: ::c_int = 0xff07401f; -pub const VM_FLAGS_USER_MAP: ::c_int = 0xff97401f; -pub const VM_FLAGS_USER_REMAP: ::c_int = VM_FLAGS_FIXED | VM_FLAGS_ANYWHERE | - VM_FLAGS_RANDOM_ADDR | - VM_FLAGS_OVERWRITE | - VM_FLAGS_RETURN_DATA_ADDR | - VM_FLAGS_RESILIENT_CODESIGN; - -pub const VM_FLAGS_SUPERPAGE_SHIFT: ::c_int = 16; -pub const SUPERPAGE_NONE: ::c_int = 0; -pub const SUPERPAGE_SIZE_ANY: ::c_int = 1; -pub const VM_FLAGS_SUPERPAGE_NONE: ::c_int = SUPERPAGE_NONE << - VM_FLAGS_SUPERPAGE_SHIFT; -pub const VM_FLAGS_SUPERPAGE_SIZE_ANY: ::c_int = SUPERPAGE_SIZE_ANY << - VM_FLAGS_SUPERPAGE_SHIFT; -pub const SUPERPAGE_SIZE_2MB: ::c_int = 2; -pub const VM_FLAGS_SUPERPAGE_SIZE_2MB: ::c_int = SUPERPAGE_SIZE_2MB << +deprecated_mach! { + pub const VM_FLAGS_FIXED: ::c_int = 0x0000; + pub const VM_FLAGS_ANYWHERE: ::c_int = 0x0001; + pub const VM_FLAGS_PURGABLE: ::c_int = 0x0002; + pub const VM_FLAGS_RANDOM_ADDR: ::c_int = 0x0008; + pub const VM_FLAGS_NO_CACHE: ::c_int = 0x0010; + pub const VM_FLAGS_RESILIENT_CODESIGN: ::c_int = 0x0020; + pub const VM_FLAGS_RESILIENT_MEDIA: ::c_int = 0x0040; + pub const VM_FLAGS_OVERWRITE: ::c_int = 0x4000; + pub const VM_FLAGS_SUPERPAGE_MASK: ::c_int = 0x70000; + pub const VM_FLAGS_RETURN_DATA_ADDR: ::c_int = 0x100000; + pub const VM_FLAGS_RETURN_4K_DATA_ADDR: ::c_int = 0x800000; + pub const VM_FLAGS_ALIAS_MASK: ::c_int = 0xFF000000; + pub const VM_FLAGS_USER_ALLOCATE: ::c_int = 0xff07401f; + pub const VM_FLAGS_USER_MAP: ::c_int = 0xff97401f; + pub const VM_FLAGS_USER_REMAP: ::c_int = VM_FLAGS_FIXED | + VM_FLAGS_ANYWHERE | + VM_FLAGS_RANDOM_ADDR | + VM_FLAGS_OVERWRITE | + VM_FLAGS_RETURN_DATA_ADDR | + VM_FLAGS_RESILIENT_CODESIGN; + + pub const VM_FLAGS_SUPERPAGE_SHIFT: ::c_int = 16; + pub const SUPERPAGE_NONE: ::c_int = 0; + pub const SUPERPAGE_SIZE_ANY: ::c_int = 1; + pub const VM_FLAGS_SUPERPAGE_NONE: ::c_int = SUPERPAGE_NONE << VM_FLAGS_SUPERPAGE_SHIFT; - -pub const VM_MEMORY_MALLOC: ::c_int = 1; -pub const VM_MEMORY_MALLOC_SMALL: ::c_int = 2; -pub const VM_MEMORY_MALLOC_LARGE: ::c_int = 3; -pub const VM_MEMORY_MALLOC_HUGE: ::c_int = 4; -pub const VM_MEMORY_SBRK: ::c_int = 5; -pub const VM_MEMORY_REALLOC: ::c_int = 6; -pub const VM_MEMORY_MALLOC_TINY: ::c_int = 7; -pub const VM_MEMORY_MALLOC_LARGE_REUSABLE: ::c_int = 8; -pub const VM_MEMORY_MALLOC_LARGE_REUSED: ::c_int = 9; -pub const VM_MEMORY_ANALYSIS_TOOL: ::c_int = 10; -pub const VM_MEMORY_MALLOC_NANO: ::c_int = 11; -pub const VM_MEMORY_MACH_MSG: ::c_int = 20; -pub const VM_MEMORY_IOKIT: ::c_int = 21; -pub const VM_MEMORY_STACK: ::c_int = 30; -pub const VM_MEMORY_GUARD: ::c_int = 31; -pub const VM_MEMORY_SHARED_PMAP: ::c_int = 32; -pub const VM_MEMORY_DYLIB: ::c_int = 33; -pub const VM_MEMORY_OBJC_DISPATCHERS: ::c_int = 34; -pub const VM_MEMORY_UNSHARED_PMAP: ::c_int = 35; -pub const VM_MEMORY_APPKIT: ::c_int = 40; -pub const VM_MEMORY_FOUNDATION: ::c_int = 41; -pub const VM_MEMORY_COREGRAPHICS: ::c_int = 42; -pub const VM_MEMORY_CORESERVICES: ::c_int = 43; -pub const VM_MEMORY_CARBON: ::c_int = VM_MEMORY_CORESERVICES; -pub const VM_MEMORY_JAVA: ::c_int = 44; -pub const VM_MEMORY_COREDATA: ::c_int = 45; -pub const VM_MEMORY_COREDATA_OBJECTIDS: ::c_int = 46; -pub const VM_MEMORY_ATS: ::c_int = 50; -pub const VM_MEMORY_LAYERKIT: ::c_int = 51; -pub const VM_MEMORY_CGIMAGE: ::c_int = 52; -pub const VM_MEMORY_TCMALLOC: ::c_int = 53; -pub const VM_MEMORY_COREGRAPHICS_DATA: ::c_int = 54; -pub const VM_MEMORY_COREGRAPHICS_SHARED: ::c_int = 55; -pub const VM_MEMORY_COREGRAPHICS_FRAMEBUFFERS: ::c_int = 56; -pub const VM_MEMORY_COREGRAPHICS_BACKINGSTORES: ::c_int = 57; -pub const VM_MEMORY_COREGRAPHICS_XALLOC: ::c_int = 58; -pub const VM_MEMORY_COREGRAPHICS_MISC: ::c_int = VM_MEMORY_COREGRAPHICS; -pub const VM_MEMORY_DYLD: ::c_int = 60; -pub const VM_MEMORY_DYLD_MALLOC: ::c_int = 61; -pub const VM_MEMORY_SQLITE: ::c_int = 62; -pub const VM_MEMORY_JAVASCRIPT_CORE: ::c_int = 63; -pub const VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR: ::c_int = 64; -pub const VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE: ::c_int = 65; -pub const VM_MEMORY_GLSL: ::c_int = 66; -pub const VM_MEMORY_OPENCL: ::c_int = 67; -pub const VM_MEMORY_COREIMAGE: ::c_int = 68; -pub const VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS: ::c_int = 69; -pub const VM_MEMORY_IMAGEIO: ::c_int = 70; -pub const VM_MEMORY_COREPROFILE: ::c_int = 71; -pub const VM_MEMORY_ASSETSD: ::c_int = 72; -pub const VM_MEMORY_OS_ALLOC_ONCE: ::c_int = 73; -pub const VM_MEMORY_LIBDISPATCH: ::c_int = 74; -pub const VM_MEMORY_ACCELERATE: ::c_int = 75; -pub const VM_MEMORY_COREUI: ::c_int = 76; -pub const VM_MEMORY_COREUIFILE: ::c_int = 77; -pub const VM_MEMORY_GENEALOGY: ::c_int = 78; -pub const VM_MEMORY_RAWCAMERA: ::c_int = 79; -pub const VM_MEMORY_CORPSEINFO: ::c_int = 80; -pub const VM_MEMORY_ASL: ::c_int = 81; -pub const VM_MEMORY_SWIFT_RUNTIME: ::c_int = 82; -pub const VM_MEMORY_SWIFT_METADATA: ::c_int = 83; -pub const VM_MEMORY_DHMM: ::c_int = 84; -pub const VM_MEMORY_SCENEKIT: ::c_int = 86; -pub const VM_MEMORY_SKYWALK: ::c_int = 87; -pub const VM_MEMORY_APPLICATION_SPECIFIC_1: ::c_int = 240; -pub const VM_MEMORY_APPLICATION_SPECIFIC_16: ::c_int = 255; + pub const VM_FLAGS_SUPERPAGE_SIZE_ANY: ::c_int = SUPERPAGE_SIZE_ANY << + VM_FLAGS_SUPERPAGE_SHIFT; + pub const SUPERPAGE_SIZE_2MB: ::c_int = 2; + pub const VM_FLAGS_SUPERPAGE_SIZE_2MB: ::c_int = SUPERPAGE_SIZE_2MB << + VM_FLAGS_SUPERPAGE_SHIFT; + + pub const VM_MEMORY_MALLOC: ::c_int = 1; + pub const VM_MEMORY_MALLOC_SMALL: ::c_int = 2; + pub const VM_MEMORY_MALLOC_LARGE: ::c_int = 3; + pub const VM_MEMORY_MALLOC_HUGE: ::c_int = 4; + pub const VM_MEMORY_SBRK: ::c_int = 5; + pub const VM_MEMORY_REALLOC: ::c_int = 6; + pub const VM_MEMORY_MALLOC_TINY: ::c_int = 7; + pub const VM_MEMORY_MALLOC_LARGE_REUSABLE: ::c_int = 8; + pub const VM_MEMORY_MALLOC_LARGE_REUSED: ::c_int = 9; + pub const VM_MEMORY_ANALYSIS_TOOL: ::c_int = 10; + pub const VM_MEMORY_MALLOC_NANO: ::c_int = 11; + pub const VM_MEMORY_MACH_MSG: ::c_int = 20; + pub const VM_MEMORY_IOKIT: ::c_int = 21; + pub const VM_MEMORY_STACK: ::c_int = 30; + pub const VM_MEMORY_GUARD: ::c_int = 31; + pub const VM_MEMORY_SHARED_PMAP: ::c_int = 32; + pub const VM_MEMORY_DYLIB: ::c_int = 33; + pub const VM_MEMORY_OBJC_DISPATCHERS: ::c_int = 34; + pub const VM_MEMORY_UNSHARED_PMAP: ::c_int = 35; + pub const VM_MEMORY_APPKIT: ::c_int = 40; + pub const VM_MEMORY_FOUNDATION: ::c_int = 41; + pub const VM_MEMORY_COREGRAPHICS: ::c_int = 42; + pub const VM_MEMORY_CORESERVICES: ::c_int = 43; + pub const VM_MEMORY_CARBON: ::c_int = VM_MEMORY_CORESERVICES; + pub const VM_MEMORY_JAVA: ::c_int = 44; + pub const VM_MEMORY_COREDATA: ::c_int = 45; + pub const VM_MEMORY_COREDATA_OBJECTIDS: ::c_int = 46; + pub const VM_MEMORY_ATS: ::c_int = 50; + pub const VM_MEMORY_LAYERKIT: ::c_int = 51; + pub const VM_MEMORY_CGIMAGE: ::c_int = 52; + pub const VM_MEMORY_TCMALLOC: ::c_int = 53; + pub const VM_MEMORY_COREGRAPHICS_DATA: ::c_int = 54; + pub const VM_MEMORY_COREGRAPHICS_SHARED: ::c_int = 55; + pub const VM_MEMORY_COREGRAPHICS_FRAMEBUFFERS: ::c_int = 56; + pub const VM_MEMORY_COREGRAPHICS_BACKINGSTORES: ::c_int = 57; + pub const VM_MEMORY_COREGRAPHICS_XALLOC: ::c_int = 58; + pub const VM_MEMORY_COREGRAPHICS_MISC: ::c_int = VM_MEMORY_COREGRAPHICS; + pub const VM_MEMORY_DYLD: ::c_int = 60; + pub const VM_MEMORY_DYLD_MALLOC: ::c_int = 61; + pub const VM_MEMORY_SQLITE: ::c_int = 62; + pub const VM_MEMORY_JAVASCRIPT_CORE: ::c_int = 63; + pub const VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR: ::c_int = 64; + pub const VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE: ::c_int = 65; + pub const VM_MEMORY_GLSL: ::c_int = 66; + pub const VM_MEMORY_OPENCL: ::c_int = 67; + pub const VM_MEMORY_COREIMAGE: ::c_int = 68; + pub const VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS: ::c_int = 69; + pub const VM_MEMORY_IMAGEIO: ::c_int = 70; + pub const VM_MEMORY_COREPROFILE: ::c_int = 71; + pub const VM_MEMORY_ASSETSD: ::c_int = 72; + pub const VM_MEMORY_OS_ALLOC_ONCE: ::c_int = 73; + pub const VM_MEMORY_LIBDISPATCH: ::c_int = 74; + pub const VM_MEMORY_ACCELERATE: ::c_int = 75; + pub const VM_MEMORY_COREUI: ::c_int = 76; + pub const VM_MEMORY_COREUIFILE: ::c_int = 77; + pub const VM_MEMORY_GENEALOGY: ::c_int = 78; + pub const VM_MEMORY_RAWCAMERA: ::c_int = 79; + pub const VM_MEMORY_CORPSEINFO: ::c_int = 80; + pub const VM_MEMORY_ASL: ::c_int = 81; + pub const VM_MEMORY_SWIFT_RUNTIME: ::c_int = 82; + pub const VM_MEMORY_SWIFT_METADATA: ::c_int = 83; + pub const VM_MEMORY_DHMM: ::c_int = 84; + pub const VM_MEMORY_SCENEKIT: ::c_int = 86; + pub const VM_MEMORY_SKYWALK: ::c_int = 87; + pub const VM_MEMORY_APPLICATION_SPECIFIC_1: ::c_int = 240; + pub const VM_MEMORY_APPLICATION_SPECIFIC_16: ::c_int = 255; +} pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; @@ -1685,11 +1761,6 @@ pub const TIOCPTYGNAME: ::c_uint = 0x40807453; pub const TIOCPTYUNLK: ::c_uint = 0x20007452; -pub const FIONCLEX: ::c_uint = 0x20006602; -pub const FIONREAD: ::c_ulong = 0x4004667f; -pub const FIOASYNC: ::c_ulong = 0x8004667d; -pub const FIOSETOWN: ::c_ulong = 0x8004667c; -pub const FIOGETOWN: ::c_ulong = 0x4004667b; pub const FIODTYPE: ::c_ulong = 0x4004667a; pub const B0: speed_t = 0; @@ -2063,8 +2134,6 @@ pub const AF_NETBIOS: ::c_int = 33; pub const AF_PPP: ::c_int = 34; pub const pseudo_AF_HDRCMPLT: ::c_int = 35; -#[doc(hidden)] -pub const AF_MAX: ::c_int = 40; pub const AF_SYS_CONTROL: ::c_int = 2; pub const SYSPROTO_EVENT: ::c_int = 1; @@ -2105,16 +2174,12 @@ pub const PF_SYSTEM: ::c_int = AF_SYSTEM; pub const PF_NETBIOS: ::c_int = AF_NETBIOS; pub const PF_PPP: ::c_int = AF_PPP; -#[doc(hidden)] -pub const PF_MAX: ::c_int = AF_MAX; - -#[doc(hidden)] -pub const NET_MAXID: ::c_int = AF_MAX; pub const NET_RT_DUMP: ::c_int = 1; pub const NET_RT_FLAGS: ::c_int = 2; pub const NET_RT_IFLIST: ::c_int = 3; #[doc(hidden)] +#[deprecated(since = "0.2.55")] pub const NET_RT_MAXID: ::c_int = 10; pub const SOMAXCONN: ::c_int = 128; @@ -2372,109 +2437,111 @@ pub const ST_NOSUID: ::c_ulong = 2; -pub const EVFILT_READ: ::int16_t = -1; -pub const EVFILT_WRITE: ::int16_t = -2; -pub const EVFILT_AIO: ::int16_t = -3; -pub const EVFILT_VNODE: ::int16_t = -4; -pub const EVFILT_PROC: ::int16_t = -5; -pub const EVFILT_SIGNAL: ::int16_t = -6; -pub const EVFILT_TIMER: ::int16_t = -7; -pub const EVFILT_MACHPORT: ::int16_t = -8; -pub const EVFILT_FS: ::int16_t = -9; -pub const EVFILT_USER: ::int16_t = -10; -pub const EVFILT_VM: ::int16_t = -12; - -pub const EV_ADD: ::uint16_t = 0x1; -pub const EV_DELETE: ::uint16_t = 0x2; -pub const EV_ENABLE: ::uint16_t = 0x4; -pub const EV_DISABLE: ::uint16_t = 0x8; -pub const EV_ONESHOT: ::uint16_t = 0x10; -pub const EV_CLEAR: ::uint16_t = 0x20; -pub const EV_RECEIPT: ::uint16_t = 0x40; -pub const EV_DISPATCH: ::uint16_t = 0x80; -pub const EV_FLAG0: ::uint16_t = 0x1000; -pub const EV_POLL: ::uint16_t = 0x1000; -pub const EV_FLAG1: ::uint16_t = 0x2000; -pub const EV_OOBAND: ::uint16_t = 0x2000; -pub const EV_ERROR: ::uint16_t = 0x4000; -pub const EV_EOF: ::uint16_t = 0x8000; -pub const EV_SYSFLAGS: ::uint16_t = 0xf000; - -pub const NOTE_TRIGGER: ::uint32_t = 0x01000000; -pub const NOTE_FFNOP: ::uint32_t = 0x00000000; -pub const NOTE_FFAND: ::uint32_t = 0x40000000; -pub const NOTE_FFOR: ::uint32_t = 0x80000000; -pub const NOTE_FFCOPY: ::uint32_t = 0xc0000000; -pub const NOTE_FFCTRLMASK: ::uint32_t = 0xc0000000; -pub const NOTE_FFLAGSMASK: ::uint32_t = 0x00ffffff; -pub const NOTE_LOWAT: ::uint32_t = 0x00000001; -pub const NOTE_DELETE: ::uint32_t = 0x00000001; -pub const NOTE_WRITE: ::uint32_t = 0x00000002; -pub const NOTE_EXTEND: ::uint32_t = 0x00000004; -pub const NOTE_ATTRIB: ::uint32_t = 0x00000008; -pub const NOTE_LINK: ::uint32_t = 0x00000010; -pub const NOTE_RENAME: ::uint32_t = 0x00000020; -pub const NOTE_REVOKE: ::uint32_t = 0x00000040; -pub const NOTE_NONE: ::uint32_t = 0x00000080; -pub const NOTE_EXIT: ::uint32_t = 0x80000000; -pub const NOTE_FORK: ::uint32_t = 0x40000000; -pub const NOTE_EXEC: ::uint32_t = 0x20000000; +pub const EVFILT_READ: i16 = -1; +pub const EVFILT_WRITE: i16 = -2; +pub const EVFILT_AIO: i16 = -3; +pub const EVFILT_VNODE: i16 = -4; +pub const EVFILT_PROC: i16 = -5; +pub const EVFILT_SIGNAL: i16 = -6; +pub const EVFILT_TIMER: i16 = -7; +pub const EVFILT_MACHPORT: i16 = -8; +pub const EVFILT_FS: i16 = -9; +pub const EVFILT_USER: i16 = -10; +pub const EVFILT_VM: i16 = -12; + +pub const EV_ADD: u16 = 0x1; +pub const EV_DELETE: u16 = 0x2; +pub const EV_ENABLE: u16 = 0x4; +pub const EV_DISABLE: u16 = 0x8; +pub const EV_ONESHOT: u16 = 0x10; +pub const EV_CLEAR: u16 = 0x20; +pub const EV_RECEIPT: u16 = 0x40; +pub const EV_DISPATCH: u16 = 0x80; +pub const EV_FLAG0: u16 = 0x1000; +pub const EV_POLL: u16 = 0x1000; +pub const EV_FLAG1: u16 = 0x2000; +pub const EV_OOBAND: u16 = 0x2000; +pub const EV_ERROR: u16 = 0x4000; +pub const EV_EOF: u16 = 0x8000; +pub const EV_SYSFLAGS: u16 = 0xf000; + +pub const NOTE_TRIGGER: u32 = 0x01000000; +pub const NOTE_FFNOP: u32 = 0x00000000; +pub const NOTE_FFAND: u32 = 0x40000000; +pub const NOTE_FFOR: u32 = 0x80000000; +pub const NOTE_FFCOPY: u32 = 0xc0000000; +pub const NOTE_FFCTRLMASK: u32 = 0xc0000000; +pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff; +pub const NOTE_LOWAT: u32 = 0x00000001; +pub const NOTE_DELETE: u32 = 0x00000001; +pub const NOTE_WRITE: u32 = 0x00000002; +pub const NOTE_EXTEND: u32 = 0x00000004; +pub const NOTE_ATTRIB: u32 = 0x00000008; +pub const NOTE_LINK: u32 = 0x00000010; +pub const NOTE_RENAME: u32 = 0x00000020; +pub const NOTE_REVOKE: u32 = 0x00000040; +pub const NOTE_NONE: u32 = 0x00000080; +pub const NOTE_EXIT: u32 = 0x80000000; +pub const NOTE_FORK: u32 = 0x40000000; +pub const NOTE_EXEC: u32 = 0x20000000; +#[doc(hidden)] #[deprecated(since="0.2.49", note="Deprecated since MacOSX 10.9")] -pub const NOTE_REAP: ::uint32_t = 0x10000000; -pub const NOTE_SIGNAL: ::uint32_t = 0x08000000; -pub const NOTE_EXITSTATUS: ::uint32_t = 0x04000000; -pub const NOTE_EXIT_DETAIL: ::uint32_t = 0x02000000; -pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff; -pub const NOTE_PCTRLMASK: ::uint32_t = 0xfff00000; +pub const NOTE_REAP: u32 = 0x10000000; +pub const NOTE_SIGNAL: u32 = 0x08000000; +pub const NOTE_EXITSTATUS: u32 = 0x04000000; +pub const NOTE_EXIT_DETAIL: u32 = 0x02000000; +pub const NOTE_PDATAMASK: u32 = 0x000fffff; +pub const NOTE_PCTRLMASK: u32 = 0xfff00000; +#[doc(hidden)] #[deprecated(since="0.2.49", note="Deprecated since MacOSX 10.9")] -pub const NOTE_EXIT_REPARENTED: ::uint32_t = 0x00080000; -pub const NOTE_EXIT_DETAIL_MASK: ::uint32_t = 0x00070000; -pub const NOTE_EXIT_DECRYPTFAIL: ::uint32_t = 0x00010000; -pub const NOTE_EXIT_MEMORY: ::uint32_t = 0x00020000; -pub const NOTE_EXIT_CSERROR: ::uint32_t = 0x00040000; -pub const NOTE_VM_PRESSURE: ::uint32_t = 0x80000000; -pub const NOTE_VM_PRESSURE_TERMINATE: ::uint32_t = 0x40000000; -pub const NOTE_VM_PRESSURE_SUDDEN_TERMINATE: ::uint32_t = 0x20000000; -pub const NOTE_VM_ERROR: ::uint32_t = 0x10000000; -pub const NOTE_SECONDS: ::uint32_t = 0x00000001; -pub const NOTE_USECONDS: ::uint32_t = 0x00000002; -pub const NOTE_NSECONDS: ::uint32_t = 0x00000004; -pub const NOTE_ABSOLUTE: ::uint32_t = 0x00000008; -pub const NOTE_LEEWAY: ::uint32_t = 0x00000010; -pub const NOTE_CRITICAL: ::uint32_t = 0x00000020; -pub const NOTE_BACKGROUND: ::uint32_t = 0x00000040; -pub const NOTE_TRACK: ::uint32_t = 0x00000001; -pub const NOTE_TRACKERR: ::uint32_t = 0x00000002; -pub const NOTE_CHILD: ::uint32_t = 0x00000004; - -pub const OCRNL: ::c_int = 0x00000010; -pub const ONOCR: ::c_int = 0x00000020; -pub const ONLRET: ::c_int = 0x00000040; -pub const OFILL: ::c_int = 0x00000080; -pub const NLDLY: ::c_int = 0x00000300; -pub const TABDLY: ::c_int = 0x00000c04; -pub const CRDLY: ::c_int = 0x00003000; -pub const FFDLY: ::c_int = 0x00004000; -pub const BSDLY: ::c_int = 0x00008000; -pub const VTDLY: ::c_int = 0x00010000; -pub const OFDEL: ::c_int = 0x00020000; - -pub const NL0: ::c_int = 0x00000000; -pub const NL1: ::c_int = 0x00000100; -pub const TAB0: ::c_int = 0x00000000; -pub const TAB1: ::c_int = 0x00000400; -pub const TAB2: ::c_int = 0x00000800; -pub const CR0: ::c_int = 0x00000000; -pub const CR1: ::c_int = 0x00001000; -pub const CR2: ::c_int = 0x00002000; -pub const CR3: ::c_int = 0x00003000; -pub const FF0: ::c_int = 0x00000000; -pub const FF1: ::c_int = 0x00004000; -pub const BS0: ::c_int = 0x00000000; -pub const BS1: ::c_int = 0x00008000; -pub const TAB3: ::c_int = 0x00000004; -pub const VT0: ::c_int = 0x00000000; -pub const VT1: ::c_int = 0x00010000; +pub const NOTE_EXIT_REPARENTED: u32 = 0x00080000; +pub const NOTE_EXIT_DETAIL_MASK: u32 = 0x00070000; +pub const NOTE_EXIT_DECRYPTFAIL: u32 = 0x00010000; +pub const NOTE_EXIT_MEMORY: u32 = 0x00020000; +pub const NOTE_EXIT_CSERROR: u32 = 0x00040000; +pub const NOTE_VM_PRESSURE: u32 = 0x80000000; +pub const NOTE_VM_PRESSURE_TERMINATE: u32 = 0x40000000; +pub const NOTE_VM_PRESSURE_SUDDEN_TERMINATE: u32 = 0x20000000; +pub const NOTE_VM_ERROR: u32 = 0x10000000; +pub const NOTE_SECONDS: u32 = 0x00000001; +pub const NOTE_USECONDS: u32 = 0x00000002; +pub const NOTE_NSECONDS: u32 = 0x00000004; +pub const NOTE_ABSOLUTE: u32 = 0x00000008; +pub const NOTE_LEEWAY: u32 = 0x00000010; +pub const NOTE_CRITICAL: u32 = 0x00000020; +pub const NOTE_BACKGROUND: u32 = 0x00000040; +pub const NOTE_TRACK: u32 = 0x00000001; +pub const NOTE_TRACKERR: u32 = 0x00000002; +pub const NOTE_CHILD: u32 = 0x00000004; + +pub const OCRNL: ::tcflag_t = 0x00000010; +pub const ONOCR: ::tcflag_t = 0x00000020; +pub const ONLRET: ::tcflag_t = 0x00000040; +pub const OFILL: ::tcflag_t = 0x00000080; +pub const NLDLY: ::tcflag_t = 0x00000300; +pub const TABDLY: ::tcflag_t = 0x00000c04; +pub const CRDLY: ::tcflag_t = 0x00003000; +pub const FFDLY: ::tcflag_t = 0x00004000; +pub const BSDLY: ::tcflag_t = 0x00008000; +pub const VTDLY: ::tcflag_t = 0x00010000; +pub const OFDEL: ::tcflag_t = 0x00020000; + +pub const NL0: ::tcflag_t = 0x00000000; +pub const NL1: ::tcflag_t = 0x00000100; +pub const TAB0: ::tcflag_t = 0x00000000; +pub const TAB1: ::tcflag_t = 0x00000400; +pub const TAB2: ::tcflag_t = 0x00000800; +pub const CR0: ::tcflag_t = 0x00000000; +pub const CR1: ::tcflag_t = 0x00001000; +pub const CR2: ::tcflag_t = 0x00002000; +pub const CR3: ::tcflag_t = 0x00003000; +pub const FF0: ::tcflag_t = 0x00000000; +pub const FF1: ::tcflag_t = 0x00004000; +pub const BS0: ::tcflag_t = 0x00000000; +pub const BS1: ::tcflag_t = 0x00008000; +pub const TAB3: ::tcflag_t = 0x00000004; +pub const VT0: ::tcflag_t = 0x00000000; +pub const VT1: ::tcflag_t = 0x00010000; pub const IUTF8: ::tcflag_t = 0x00004000; pub const CRTSCTS: ::tcflag_t = 0x00030000; @@ -2632,8 +2699,10 @@ pub const KERN_KDGETENTROPY: ::c_int = 16; pub const KERN_KDWRITETR: ::c_int = 17; pub const KERN_KDWRITEMAP: ::c_int = 18; +#[doc(hidden)] #[deprecated(since = "0.2.49", note ="Removed in MacOSX 10.12")] pub const KERN_KDENABLE_BG_TRACE: ::c_int = 19; +#[doc(hidden)] #[deprecated(since = "0.2.49", note ="Removed in MacOSX 10.12")] pub const KERN_KDDISABLE_BG_TRACE: ::c_int = 20; pub const KERN_KDREADCURTHRMAP: ::c_int = 21; @@ -2887,7 +2956,7 @@ pub const DLT_LOOP: ::c_uint = 108; // https://github.com/apple/darwin-xnu/blob/master/bsd/net/bpf.h#L100 -// sizeof(int32_t) +// sizeof(i32) pub const BPF_ALIGNMENT: ::c_int = 4; // sys/spawn.h: @@ -3014,11 +3083,15 @@ } extern { + pub fn setgrent(); + #[doc(hidden)] #[deprecated(since="0.2.49", note="Deprecated in MacOSX 10.5")] #[link_name = "daemon$1050"] pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; + #[doc(hidden)] #[deprecated(since="0.2.49", note="Deprecated in MacOSX 10.10")] pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; + #[doc(hidden)] #[deprecated(since="0.2.49", note="Deprecated in MacOSX 10.10")] pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, @@ -3045,6 +3118,8 @@ pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int; + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::c_void) -> ::c_int; pub fn getutxent() -> *mut utmpx; pub fn getutxid(ut: *const utmpx) -> *mut utmpx; pub fn getutxline(ut: *const utmpx) -> *mut utmpx; @@ -3100,7 +3175,10 @@ newp: *mut ::c_void, newlen: ::size_t) -> ::c_int; + #[deprecated(since = "0.2.55", note = "Use the mach crate")] pub fn mach_absolute_time() -> u64; + #[deprecated(since = "0.2.55", note = "Use the mach crate")] + #[allow(deprecated)] pub fn mach_timebase_info(info: *mut ::mach_timebase_info) -> ::c_int; pub fn pthread_setname_np(name: *const ::c_char) -> ::c_int; pub fn pthread_get_stackaddr_np(thread: ::pthread_t) -> *mut ::c_void; @@ -3220,9 +3298,14 @@ pub fn brk(addr: *const ::c_void) -> *mut ::c_void; pub fn sbrk(increment: ::c_int) -> *mut ::c_void; pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int; + #[deprecated(since = "0.2.55", note = "Use the mach crate")] pub fn _dyld_image_count() -> u32; + #[deprecated(since = "0.2.55", note = "Use the mach crate")] + #[allow(deprecated)] pub fn _dyld_get_image_header(image_index: u32) -> *const mach_header; + #[deprecated(since = "0.2.55", note = "Use the mach crate")] pub fn _dyld_get_image_vmaddr_slide(image_index: u32) -> ::intptr_t; + #[deprecated(since = "0.2.55", note = "Use the mach crate")] pub fn _dyld_get_image_name(image_index: u32) -> *const ::c_char; pub fn posix_spawn(pid: *mut ::pid_t, diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,12 @@ +// DragonFlyBSD's __error function is declared with "static inline", so it must +// be implemented in the libc crate, as a pointer to a static thread_local. +f! { + pub fn __error() -> *mut ::c_int { + &mut errno + } +} + +extern { + #[thread_local] + pub static mut errno: ::c_int; +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,3 +1,4 @@ +pub type dev_t = u32; pub type c_char = i8; pub type clock_t = u64; pub type ino_t = u64; @@ -27,6 +28,15 @@ } s! { + pub struct kevent { + pub ident: ::uintptr_t, + pub filter: ::c_short, + pub flags: ::c_ushort, + pub fflags: ::c_uint, + pub data: ::intptr_t, + pub udata: *mut ::c_void, + } + pub struct exit_status { pub e_termination: u16, pub e_exit: u16 @@ -60,19 +70,6 @@ pub mq_curmsgs: ::c_long, } - pub struct sigevent { - pub sigev_notify: ::c_int, - // The union is 8-byte in size, so it is aligned at a 8-byte offset. - #[cfg(target_pointer_width = "64")] - __unused1: ::c_int, - pub sigev_signo: ::c_int, //actually a union - // pad the union - #[cfg(target_pointer_width = "64")] - __unused2: ::c_int, - pub sigev_value: ::sigval, - __unused3: *mut ::c_void //actually a function pointer - } - pub struct statvfs { pub f_bsize: ::c_ulong, pub f_frsize: ::c_ulong, @@ -100,7 +97,7 @@ pub st_nlink: ::nlink_t, pub st_dev: ::dev_t, pub st_mode: ::mode_t, - pub st_padding1: ::uint16_t, + pub st_padding1: u16, pub st_uid: ::uid_t, pub st_gid: ::gid_t, pub st_rdev: ::dev_t, @@ -111,13 +108,13 @@ pub st_ctime: ::time_t, pub st_ctime_nsec: ::c_long, pub st_size: ::off_t, - pub st_blocks: ::int64_t, - pub st_blksize: ::uint32_t, - pub st_flags: ::uint32_t, - pub st_gen: ::uint32_t, - pub st_lspare: ::int32_t, - pub st_qspare1: ::int64_t, - pub st_qspare2: ::int64_t, + pub st_blocks: i64, + pub st_blksize: u32, + pub st_flags: u32, + pub st_gen: u32, + pub st_lspare: i32, + pub st_qspare1: i64, + pub st_qspare2: i64, } pub struct if_data { @@ -214,8 +211,8 @@ pub f_ffree: ::c_long, pub f_fsid: ::fsid_t, pub f_owner: ::uid_t, - pub f_type: ::int32_t, - pub f_flags: ::int32_t, + pub f_type: i32, + pub f_flags: i32, pub f_syncwrites: ::c_long, pub f_asyncwrites: ::c_long, pub f_fstypename: [::c_char; 16], @@ -224,6 +221,20 @@ pub f_asyncreads: ::c_long, pub f_mntfromname: [::c_char; 90], } + + pub struct sigevent { + pub sigev_notify: ::c_int, + // The union is 8-byte in size, so it is aligned at a 8-byte offset. + #[cfg(target_pointer_width = "64")] + __unused1: ::c_int, + pub sigev_signo: ::c_int, //actually a union + // pad the union + #[cfg(target_pointer_width = "64")] + __unused2: ::c_int, + pub sigev_value: ::sigval, + __unused3: *mut ::c_void //actually a function pointer + } + } cfg_if! { @@ -398,6 +409,31 @@ self.f_mntfromname.hash(state); } } + + impl PartialEq for sigevent { + fn eq(&self, other: &sigevent) -> bool { + self.sigev_notify == other.sigev_notify + && self.sigev_signo == other.sigev_signo + && self.sigev_value == other.sigev_value + } + } + impl Eq for sigevent {} + impl ::fmt::Debug for sigevent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sigevent") + .field("sigev_notify", &self.sigev_notify) + .field("sigev_signo", &self.sigev_signo) + .field("sigev_value", &self.sigev_value) + .finish() + } + } + impl ::hash::Hash for sigevent { + fn hash(&self, state: &mut H) { + self.sigev_notify.hash(state); + self.sigev_signo.hash(state); + self.sigev_value.hash(state); + } + } } } @@ -567,55 +603,55 @@ pub const CTL_P1003_1B_TIMER_MAX: ::c_int = 25; pub const CTL_P1003_1B_MAXID: ::c_int = 26; -pub const EVFILT_READ: ::int16_t = -1; -pub const EVFILT_WRITE: ::int16_t = -2; -pub const EVFILT_AIO: ::int16_t = -3; -pub const EVFILT_VNODE: ::int16_t = -4; -pub const EVFILT_PROC: ::int16_t = -5; -pub const EVFILT_SIGNAL: ::int16_t = -6; -pub const EVFILT_TIMER: ::int16_t = -7; -pub const EVFILT_EXCEPT: ::int16_t = -8; -pub const EVFILT_USER: ::int16_t = -9; -pub const EVFILT_FS: ::int16_t = -10; - -pub const EV_ADD: ::uint16_t = 0x1; -pub const EV_DELETE: ::uint16_t = 0x2; -pub const EV_ENABLE: ::uint16_t = 0x4; -pub const EV_DISABLE: ::uint16_t = 0x8; -pub const EV_ONESHOT: ::uint16_t = 0x10; -pub const EV_CLEAR: ::uint16_t = 0x20; -pub const EV_RECEIPT: ::uint16_t = 0x40; -pub const EV_DISPATCH: ::uint16_t = 0x80; -pub const EV_NODATA: ::uint16_t = 0x1000; -pub const EV_FLAG1: ::uint16_t = 0x2000; -pub const EV_ERROR: ::uint16_t = 0x4000; -pub const EV_EOF: ::uint16_t = 0x8000; -pub const EV_SYSFLAGS: ::uint16_t = 0xf000; - -pub const NOTE_TRIGGER: ::uint32_t = 0x01000000; -pub const NOTE_FFNOP: ::uint32_t = 0x00000000; -pub const NOTE_FFAND: ::uint32_t = 0x40000000; -pub const NOTE_FFOR: ::uint32_t = 0x80000000; -pub const NOTE_FFCOPY: ::uint32_t = 0xc0000000; -pub const NOTE_FFCTRLMASK: ::uint32_t = 0xc0000000; -pub const NOTE_FFLAGSMASK: ::uint32_t = 0x00ffffff; -pub const NOTE_LOWAT: ::uint32_t = 0x00000001; -pub const NOTE_OOB: ::uint32_t = 0x00000002; -pub const NOTE_DELETE: ::uint32_t = 0x00000001; -pub const NOTE_WRITE: ::uint32_t = 0x00000002; -pub const NOTE_EXTEND: ::uint32_t = 0x00000004; -pub const NOTE_ATTRIB: ::uint32_t = 0x00000008; -pub const NOTE_LINK: ::uint32_t = 0x00000010; -pub const NOTE_RENAME: ::uint32_t = 0x00000020; -pub const NOTE_REVOKE: ::uint32_t = 0x00000040; -pub const NOTE_EXIT: ::uint32_t = 0x80000000; -pub const NOTE_FORK: ::uint32_t = 0x40000000; -pub const NOTE_EXEC: ::uint32_t = 0x20000000; -pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff; -pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000; -pub const NOTE_TRACK: ::uint32_t = 0x00000001; -pub const NOTE_TRACKERR: ::uint32_t = 0x00000002; -pub const NOTE_CHILD: ::uint32_t = 0x00000004; +pub const EVFILT_READ: i16 = -1; +pub const EVFILT_WRITE: i16 = -2; +pub const EVFILT_AIO: i16 = -3; +pub const EVFILT_VNODE: i16 = -4; +pub const EVFILT_PROC: i16 = -5; +pub const EVFILT_SIGNAL: i16 = -6; +pub const EVFILT_TIMER: i16 = -7; +pub const EVFILT_EXCEPT: i16 = -8; +pub const EVFILT_USER: i16 = -9; +pub const EVFILT_FS: i16 = -10; + +pub const EV_ADD: u16 = 0x1; +pub const EV_DELETE: u16 = 0x2; +pub const EV_ENABLE: u16 = 0x4; +pub const EV_DISABLE: u16 = 0x8; +pub const EV_ONESHOT: u16 = 0x10; +pub const EV_CLEAR: u16 = 0x20; +pub const EV_RECEIPT: u16 = 0x40; +pub const EV_DISPATCH: u16 = 0x80; +pub const EV_NODATA: u16 = 0x1000; +pub const EV_FLAG1: u16 = 0x2000; +pub const EV_ERROR: u16 = 0x4000; +pub const EV_EOF: u16 = 0x8000; +pub const EV_SYSFLAGS: u16 = 0xf000; + +pub const NOTE_TRIGGER: u32 = 0x01000000; +pub const NOTE_FFNOP: u32 = 0x00000000; +pub const NOTE_FFAND: u32 = 0x40000000; +pub const NOTE_FFOR: u32 = 0x80000000; +pub const NOTE_FFCOPY: u32 = 0xc0000000; +pub const NOTE_FFCTRLMASK: u32 = 0xc0000000; +pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff; +pub const NOTE_LOWAT: u32 = 0x00000001; +pub const NOTE_OOB: u32 = 0x00000002; +pub const NOTE_DELETE: u32 = 0x00000001; +pub const NOTE_WRITE: u32 = 0x00000002; +pub const NOTE_EXTEND: u32 = 0x00000004; +pub const NOTE_ATTRIB: u32 = 0x00000008; +pub const NOTE_LINK: u32 = 0x00000010; +pub const NOTE_RENAME: u32 = 0x00000020; +pub const NOTE_REVOKE: u32 = 0x00000040; +pub const NOTE_EXIT: u32 = 0x80000000; +pub const NOTE_FORK: u32 = 0x40000000; +pub const NOTE_EXEC: u32 = 0x20000000; +pub const NOTE_PDATAMASK: u32 = 0x000fffff; +pub const NOTE_PCTRLMASK: u32 = 0xf0000000; +pub const NOTE_TRACK: u32 = 0x00000001; +pub const NOTE_TRACKERR: u32 = 0x00000002; +pub const NOTE_CHILD: u32 = 0x00000004; pub const SO_SNDSPACE: ::c_int = 0x100a; pub const SO_CPUHINT: ::c_int = 0x1030; @@ -881,10 +917,8 @@ pub const AF_BLUETOOTH: ::c_int = 33; pub const AF_MPLS: ::c_int = 34; pub const AF_IEEE80211: ::c_int = 35; -pub const AF_MAX: ::c_int = 36; pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH; -pub const PF_MAX: ::c_int = AF_MAX; pub const NET_RT_DUMP: ::c_int = 1; pub const NET_RT_FLAGS: ::c_int = 2; @@ -893,9 +927,6 @@ pub const SOMAXOPT_SIZE: ::c_int = 65536; -#[doc(hidden)] -pub const NET_MAXID: ::c_int = AF_MAX; - pub const MSG_UNUSED09: ::c_int = 0x00000200; pub const MSG_NOSIGNAL: ::c_int = 0x00000400; pub const MSG_SYNC: ::c_int = 0x00000800; @@ -1008,6 +1039,7 @@ } extern { + pub fn setgrent(); pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; @@ -1028,3 +1060,10 @@ pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; pub fn uname(buf: *mut ::utsname) -> ::c_int; } + +cfg_if! { + if #[cfg(libc_thread_local)] { + mod errno; + pub use self::errno::*; + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -23,8 +23,8 @@ pub st_blocks: ::blkcnt_t, pub st_blksize: ::blksize_t, pub st_flags: ::fflags_t, - pub st_gen: ::uint32_t, - pub st_lspare: ::int32_t, + pub st_gen: u32, + pub st_lspare: i32, pub st_birthtime: ::time_t, pub st_birthtime_nsec: ::c_long, } diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs 2019-07-17 05:42:23.000000000 +0000 @@ -26,8 +26,8 @@ pub st_blocks: ::blkcnt_t, pub st_blksize: ::blksize_t, pub st_flags: ::fflags_t, - pub st_gen: ::uint32_t, - pub st_lspare: ::int32_t, + pub st_gen: u32, + pub st_lspare: i32, pub st_birthtime: ::time_t, pub st_birthtime_nsec: ::c_long, pub st_birthtime_pad: ::c_long, diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,214 @@ +// APIs that had breaking changes after FreeBSD 11 + +// The type of `nlink_t` changed from `u16` to `u64` in FreeBSD 12: +pub type nlink_t = u16; +// Type of `dev_t` changed from `u32` to `u64` in FreeBSD 12: +pub type dev_t = u32; +// Type of `ino_t` changed from `unsigned int` to `unsigned long` in FreeBSD 12: +pub type ino_t = u32; + +s! { + pub struct kevent { + pub ident: ::uintptr_t, + pub filter: ::c_short, + pub flags: ::c_ushort, + pub fflags: ::c_uint, + pub data: ::intptr_t, + pub udata: *mut ::c_void, + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_lpid: ::pid_t, + pub shm_cpid: ::pid_t, + // Type of shm_nattc changed from `int` to `shmatt_t` (aka `unsigned + // int`) in FreeBSD 12: + pub shm_nattch: ::c_int, + pub shm_atime: ::time_t, + pub shm_dtime: ::time_t, + pub shm_ctime: ::time_t, + } +} + +s_no_extra_traits! { + pub struct dirent { + pub d_fileno: ::ino_t, + pub d_reclen: u16, + pub d_type: u8, + // Type of `d_namlen` changed from `char` to `u16` in FreeBSD 12: + pub d_namlen: u8, + pub d_name: [::c_char; 256], + } + + pub struct statfs { + pub f_version: u32, + pub f_type: u32, + pub f_flags: u64, + pub f_bsize: u64, + pub f_iosize: u64, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: i64, + pub f_files: u64, + pub f_ffree: i64, + pub f_syncwrites: u64, + pub f_asyncwrites: u64, + pub f_syncreads: u64, + pub f_asyncreads: u64, + f_spare: [u64; 10], + pub f_namemax: u32, + pub f_owner: ::uid_t, + pub f_fsid: ::fsid_t, + f_charspare: [::c_char; 80], + pub f_fstypename: [::c_char; 16], + // Array length changed from 88 to 1024 in FreeBSD 12: + pub f_mntfromname: [::c_char; 88], + // Array length changed from 88 to 1024 in FreeBSD 12: + pub f_mntonname: [::c_char; 88], + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for statfs { + fn eq(&self, other: &statfs) -> bool { + self.f_version == other.f_version + && self.f_type == other.f_type + && self.f_flags == other.f_flags + && self.f_bsize == other.f_bsize + && self.f_iosize == other.f_iosize + && self.f_blocks == other.f_blocks + && self.f_bfree == other.f_bfree + && self.f_bavail == other.f_bavail + && self.f_files == other.f_files + && self.f_ffree == other.f_ffree + && self.f_syncwrites == other.f_syncwrites + && self.f_asyncwrites == other.f_asyncwrites + && self.f_syncreads == other.f_syncreads + && self.f_asyncreads == other.f_asyncreads + && self.f_namemax == other.f_namemax + && self.f_owner == other.f_owner + && self.f_fsid == other.f_fsid + && self.f_fstypename == other.f_fstypename + && self + .f_mntfromname + .iter() + .zip(other.f_mntfromname.iter()) + .all(|(a,b)| a == b) + && self + .f_mntonname + .iter() + .zip(other.f_mntonname.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for statfs {} + impl ::fmt::Debug for statfs { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("statfs") + .field("f_bsize", &self.f_bsize) + .field("f_iosize", &self.f_iosize) + .field("f_blocks", &self.f_blocks) + .field("f_bfree", &self.f_bfree) + .field("f_bavail", &self.f_bavail) + .field("f_files", &self.f_files) + .field("f_ffree", &self.f_ffree) + .field("f_syncwrites", &self.f_syncwrites) + .field("f_asyncwrites", &self.f_asyncwrites) + .field("f_syncreads", &self.f_syncreads) + .field("f_asyncreads", &self.f_asyncreads) + .field("f_namemax", &self.f_namemax) + .field("f_owner", &self.f_owner) + .field("f_fsid", &self.f_fsid) + .field("f_fstypename", &self.f_fstypename) + .field("f_mntfromname", &&self.f_mntfromname[..]) + .field("f_mntonname", &&self.f_mntonname[..]) + .finish() + } + } + impl ::hash::Hash for statfs { + fn hash(&self, state: &mut H) { + self.f_version.hash(state); + self.f_type.hash(state); + self.f_flags.hash(state); + self.f_bsize.hash(state); + self.f_iosize.hash(state); + self.f_blocks.hash(state); + self.f_bfree.hash(state); + self.f_bavail.hash(state); + self.f_files.hash(state); + self.f_ffree.hash(state); + self.f_syncwrites.hash(state); + self.f_asyncwrites.hash(state); + self.f_syncreads.hash(state); + self.f_asyncreads.hash(state); + self.f_namemax.hash(state); + self.f_owner.hash(state); + self.f_fsid.hash(state); + self.f_fstypename.hash(state); + self.f_mntfromname.hash(state); + self.f_mntonname.hash(state); + } + } + + impl PartialEq for dirent { + fn eq(&self, other: &dirent) -> bool { + self.d_fileno == other.d_fileno + && self.d_reclen == other.d_reclen + && self.d_type == other.d_type + && self.d_namlen == other.d_namlen + && self + .d_name[..self.d_namlen as _] + .iter() + .zip(other.d_name.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for dirent {} + impl ::fmt::Debug for dirent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("dirent") + .field("d_fileno", &self.d_fileno) + .field("d_reclen", &self.d_reclen) + .field("d_type", &self.d_type) + .field("d_namlen", &self.d_namlen) + .field("d_name", &&self.d_name[..self.d_namlen as _]) + .finish() + } + } + impl ::hash::Hash for dirent { + fn hash(&self, state: &mut H) { + self.d_fileno.hash(state); + self.d_reclen.hash(state); + self.d_type.hash(state); + self.d_namlen.hash(state); + self.d_name[..self.d_namlen as _].hash(state); + } + } + } +} + +extern { + // Return type ::c_int was removed in FreeBSD 12 + pub fn setgrent() -> ::c_int; + + // Type of `addr` argument changed from `const void*` to `void*` + // in FreeBSD 12 + pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int) + -> ::c_int; + + // Return type ::c_int was removed in FreeBSD 12 + pub fn freelocale(loc: ::locale_t) -> ::c_int; + + // Return type ::c_int changed to ::ssize_t in FreeBSD 12: + pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t, + msgtyp: ::c_long, msgflg: ::c_int) -> ::c_int; +} + +cfg_if! { + if #[cfg(target_arch = "x86_64")] { + mod x86_64; + pub use self::x86_64::*; + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,30 @@ +#[repr(C)] +#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] +pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_size: ::off_t, + pub st_blocks: ::blkcnt_t, + pub st_blksize: ::blksize_t, + pub st_flags: ::fflags_t, + pub st_gen: u32, + pub st_lspare: i32, + pub st_birthtime: ::time_t, + pub st_birthtime_nsec: ::c_long, +} + +impl ::Copy for ::stat {} +impl ::Clone for ::stat { + fn clone(&self) -> ::stat { *self } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,207 @@ +// APIs that changed in FreeBSD12 + +pub type nlink_t = u64; +pub type dev_t = u64; +pub type ino_t = ::c_ulong; +pub type shmatt_t = ::c_uint; + +s! { + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_lpid: ::pid_t, + pub shm_cpid: ::pid_t, + pub shm_nattch: ::shmatt_t, + pub shm_atime: ::time_t, + pub shm_dtime: ::time_t, + pub shm_ctime: ::time_t, + } + + pub struct kevent { + pub ident: ::uintptr_t, + pub filter: ::c_short, + pub flags: ::c_ushort, + pub fflags: ::c_uint, + pub data: ::intptr_t, + pub udata: *mut ::c_void, + pub ext: [u64; 4], + } +} + +s_no_extra_traits! { + pub struct dirent { + pub d_fileno: ::ino_t, + pub d_off: ::off_t, + pub d_reclen: u16, + pub d_type: u8, + d_pad0: u8, + pub d_namlen: u16, + d_pad1: u16, + pub d_name: [::c_char; 256], + } + + pub struct statfs { + pub f_version: u32, + pub f_type: u32, + pub f_flags: u64, + pub f_bsize: u64, + pub f_iosize: u64, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: i64, + pub f_files: u64, + pub f_ffree: i64, + pub f_syncwrites: u64, + pub f_asyncwrites: u64, + pub f_syncreads: u64, + pub f_asyncreads: u64, + f_spare: [u64; 10], + pub f_namemax: u32, + pub f_owner: ::uid_t, + pub f_fsid: ::fsid_t, + f_charspare: [::c_char; 80], + pub f_fstypename: [::c_char; 16], + pub f_mntfromname: [::c_char; 1024], + pub f_mntonname: [::c_char; 1024], + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for statfs { + fn eq(&self, other: &statfs) -> bool { + self.f_version == other.f_version + && self.f_type == other.f_type + && self.f_flags == other.f_flags + && self.f_bsize == other.f_bsize + && self.f_iosize == other.f_iosize + && self.f_blocks == other.f_blocks + && self.f_bfree == other.f_bfree + && self.f_bavail == other.f_bavail + && self.f_files == other.f_files + && self.f_ffree == other.f_ffree + && self.f_syncwrites == other.f_syncwrites + && self.f_asyncwrites == other.f_asyncwrites + && self.f_syncreads == other.f_syncreads + && self.f_asyncreads == other.f_asyncreads + && self.f_namemax == other.f_namemax + && self.f_owner == other.f_owner + && self.f_fsid == other.f_fsid + && self.f_fstypename == other.f_fstypename + && self + .f_mntfromname + .iter() + .zip(other.f_mntfromname.iter()) + .all(|(a,b)| a == b) + && self + .f_mntonname + .iter() + .zip(other.f_mntonname.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for statfs {} + impl ::fmt::Debug for statfs { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("statfs") + .field("f_bsize", &self.f_bsize) + .field("f_iosize", &self.f_iosize) + .field("f_blocks", &self.f_blocks) + .field("f_bfree", &self.f_bfree) + .field("f_bavail", &self.f_bavail) + .field("f_files", &self.f_files) + .field("f_ffree", &self.f_ffree) + .field("f_syncwrites", &self.f_syncwrites) + .field("f_asyncwrites", &self.f_asyncwrites) + .field("f_syncreads", &self.f_syncreads) + .field("f_asyncreads", &self.f_asyncreads) + .field("f_namemax", &self.f_namemax) + .field("f_owner", &self.f_owner) + .field("f_fsid", &self.f_fsid) + .field("f_fstypename", &self.f_fstypename) + .field("f_mntfromname", &&self.f_mntfromname[..]) + .field("f_mntonname", &&self.f_mntonname[..]) + .finish() + } + } + impl ::hash::Hash for statfs { + fn hash(&self, state: &mut H) { + self.f_version.hash(state); + self.f_type.hash(state); + self.f_flags.hash(state); + self.f_bsize.hash(state); + self.f_iosize.hash(state); + self.f_blocks.hash(state); + self.f_bfree.hash(state); + self.f_bavail.hash(state); + self.f_files.hash(state); + self.f_ffree.hash(state); + self.f_syncwrites.hash(state); + self.f_asyncwrites.hash(state); + self.f_syncreads.hash(state); + self.f_asyncreads.hash(state); + self.f_namemax.hash(state); + self.f_owner.hash(state); + self.f_fsid.hash(state); + self.f_charspare.hash(state); + self.f_fstypename.hash(state); + self.f_mntfromname.hash(state); + self.f_mntonname.hash(state); + } + } + + impl PartialEq for dirent { + fn eq(&self, other: &dirent) -> bool { + self.d_fileno == other.d_fileno + && self.d_off == other.d_off + && self.d_reclen == other.d_reclen + && self.d_type == other.d_type + && self.d_namlen == other.d_namlen + && self + .d_name[..self.d_namlen as _] + .iter() + .zip(other.d_name.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for dirent {} + impl ::fmt::Debug for dirent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("dirent") + .field("d_fileno", &self.d_fileno) + .field("d_off", &self.d_off) + .field("d_reclen", &self.d_reclen) + .field("d_type", &self.d_type) + .field("d_namlen", &self.d_namlen) + .field("d_name", &&self.d_name[..self.d_namlen as _]) + .finish() + } + } + impl ::hash::Hash for dirent { + fn hash(&self, state: &mut H) { + self.d_fileno.hash(state); + self.d_off.hash(state); + self.d_reclen.hash(state); + self.d_type.hash(state); + self.d_namlen.hash(state); + self.d_name[..self.d_namlen as _].hash(state); + } + } + } +} + +extern { + pub fn setgrent(); + pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) + -> ::c_int; + pub fn freelocale(loc: ::locale_t); + pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t, + msgtyp: ::c_long, msgflg: ::c_int) -> ::ssize_t; +} + +cfg_if! { + if #[cfg(target_arch = "x86_64")] { + mod x86_64; + pub use self::x86_64::*; + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,32 @@ +#[repr(C)] +#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] +pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_nlink: ::nlink_t, + pub st_mode: ::mode_t, + st_padding0: i16, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + st_padding1: i32, + pub st_rdev: ::dev_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_birthtime: ::time_t, + pub st_birthtime_nsec: ::c_long, + pub st_size: ::off_t, + pub st_blocks: ::blkcnt_t, + pub st_blksize: ::blksize_t, + pub st_flags: ::fflags_t, + pub st_gen: u64, + pub st_spare: [u64; 10], +} + +impl ::Copy for ::stat {} +impl ::Clone for ::stat { + fn clone(&self) -> ::stat { *self } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,14 +1,13 @@ pub type fflags_t = u32; pub type clock_t = i32; -pub type ino_t = u32; + pub type lwpid_t = i32; -pub type nlink_t = u16; pub type blksize_t = i32; pub type clockid_t = ::c_int; pub type sem_t = _sem; -pub type fsblkcnt_t = ::uint64_t; -pub type fsfilcnt_t = ::uint64_t; +pub type fsblkcnt_t = u64; +pub type fsfilcnt_t = u64; pub type idtype_t = ::c_uint; pub type key_t = ::c_long; @@ -47,26 +46,6 @@ pub ip6: *mut ::in6_addr, } - pub struct mq_attr { - pub mq_flags: ::c_long, - pub mq_maxmsg: ::c_long, - pub mq_msgsize: ::c_long, - pub mq_curmsgs: ::c_long, - __reserved: [::c_long; 4] - } - - pub struct sigevent { - pub sigev_notify: ::c_int, - pub sigev_signo: ::c_int, - pub sigev_value: ::sigval, - //The rest of the structure is actually a union. We expose only - //sigev_notify_thread_id because it's the most useful union member. - pub sigev_notify_thread_id: ::lwpid_t, - #[cfg(target_pointer_width = "64")] - __unused1: ::c_int, - __unused2: [::c_long; 7] - } - pub struct statvfs { pub f_bavail: ::fsblkcnt_t, pub f_bfree: ::fsblkcnt_t, @@ -110,17 +89,6 @@ pub msg_ctime: ::time_t, } - pub struct shmid_ds { - pub shm_perm: ::ipc_perm, - pub shm_segsz: ::size_t, - pub shm_lpid: ::pid_t, - pub shm_cpid: ::pid_t, - pub shm_nattch: ::c_int, - pub shm_atime: ::time_t, - pub shm_dtime: ::time_t, - pub shm_ctime: ::time_t, - } - pub struct xucred { pub cr_version: ::c_uint, pub cr_uid: ::uid_t, @@ -153,39 +121,6 @@ pub __ut_spare: [::c_char; 64], } - pub struct dirent { - pub d_fileno: u32, - pub d_reclen: u16, - pub d_type: u8, - pub d_namlen: u8, - pub d_name: [::c_char; 256], - } - - pub struct statfs { - pub f_version: ::uint32_t, - pub f_type: ::uint32_t, - pub f_flags: ::uint64_t, - pub f_bsize: ::uint64_t, - pub f_iosize: ::uint64_t, - pub f_blocks: ::uint64_t, - pub f_bfree: ::uint64_t, - pub f_bavail: ::int64_t, - pub f_files: ::uint64_t, - pub f_ffree: ::int64_t, - pub f_syncwrites: ::uint64_t, - pub f_asyncwrites: ::uint64_t, - pub f_syncreads: ::uint64_t, - pub f_asyncreads: ::uint64_t, - f_spare: [::uint64_t; 10], - pub f_namemax: ::uint32_t, - pub f_owner: ::uid_t, - pub f_fsid: ::fsid_t, - f_charspare: [::c_char; 80], - pub f_fstypename: [::c_char; 16], - pub f_mntfromname: [::c_char; 88], - pub f_mntonname: [::c_char; 88], - } - pub struct sockaddr_dl { pub sdl_len: ::c_uchar, pub sdl_family: ::c_uchar, @@ -196,6 +131,26 @@ pub sdl_slen: ::c_uchar, pub sdl_data: [::c_char; 46], } + + pub struct mq_attr { + pub mq_flags: ::c_long, + pub mq_maxmsg: ::c_long, + pub mq_msgsize: ::c_long, + pub mq_curmsgs: ::c_long, + __reserved: [::c_long; 4] + } + + pub struct sigevent { + pub sigev_notify: ::c_int, + pub sigev_signo: ::c_int, + pub sigev_value: ::sigval, + //The rest of the structure is actually a union. We expose only + //sigev_notify_thread_id because it's the most useful union member. + pub sigev_notify_thread_id: ::lwpid_t, + #[cfg(target_pointer_width = "64")] + __unused1: ::c_int, + __unused2: [::c_long; 7] + } } cfg_if! { @@ -248,132 +203,6 @@ } } - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_fileno == other.d_fileno - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self.d_namlen == other.d_namlen - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for dirent {} - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_fileno", &self.d_fileno) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - .field("d_namlen", &self.d_namlen) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_fileno.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_namlen.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for statfs { - fn eq(&self, other: &statfs) -> bool { - self.f_version == other.f_version - && self.f_type == other.f_type - && self.f_flags == other.f_flags - && self.f_bsize == other.f_bsize - && self.f_iosize == other.f_iosize - && self.f_blocks == other.f_blocks - && self.f_bfree == other.f_bfree - && self.f_bavail == other.f_bavail - && self.f_files == other.f_files - && self.f_ffree == other.f_ffree - && self.f_syncwrites == other.f_syncwrites - && self.f_asyncwrites == other.f_asyncwrites - && self.f_syncreads == other.f_syncreads - && self.f_asyncreads == other.f_asyncreads - && self.f_spare == other.f_spare - && self.f_namemax == other.f_namemax - && self.f_owner == other.f_owner - && self.f_fsid == other.f_fsid - && self - .f_charspare - .iter() - .zip(other.f_charspare.iter()) - .all(|(a,b)| a == b) - && self.f_fstypename == other.f_fstypename - && self - .f_mntfromname - .iter() - .zip(other.f_mntfromname.iter()) - .all(|(a,b)| a == b) - && self - .f_mntonname - .iter() - .zip(other.f_mntonname.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for statfs {} - impl ::fmt::Debug for statfs { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("statfs") - .field("f_bsize", &self.f_bsize) - .field("f_iosize", &self.f_iosize) - .field("f_blocks", &self.f_blocks) - .field("f_bfree", &self.f_bfree) - .field("f_bavail", &self.f_bavail) - .field("f_files", &self.f_files) - .field("f_ffree", &self.f_ffree) - .field("f_syncwrites", &self.f_syncwrites) - .field("f_asyncwrites", &self.f_asyncwrites) - .field("f_syncreads", &self.f_syncreads) - .field("f_asyncreads", &self.f_asyncreads) - .field("f_spare", &self.f_spare) - .field("f_namemax", &self.f_namemax) - .field("f_owner", &self.f_owner) - .field("f_fsid", &self.f_fsid) - // FIXME: .field("f_charspare", &self.f_charspare) - .field("f_fstypename", &self.f_fstypename) - // FIXME: .field("f_mntfromname", &self.f_mntfromname) - // FIXME: .field("f_mntonname", &self.f_mntonname) - .finish() - } - } - impl ::hash::Hash for statfs { - fn hash(&self, state: &mut H) { - self.f_version.hash(state); - self.f_type.hash(state); - self.f_flags.hash(state); - self.f_bsize.hash(state); - self.f_iosize.hash(state); - self.f_blocks.hash(state); - self.f_bfree.hash(state); - self.f_bavail.hash(state); - self.f_files.hash(state); - self.f_ffree.hash(state); - self.f_syncwrites.hash(state); - self.f_asyncwrites.hash(state); - self.f_syncreads.hash(state); - self.f_asyncreads.hash(state); - self.f_spare.hash(state); - self.f_namemax.hash(state); - self.f_owner.hash(state); - self.f_fsid.hash(state); - self.f_charspare.hash(state); - self.f_fstypename.hash(state); - self.f_mntfromname.hash(state); - self.f_mntonname.hash(state); - } - } - impl PartialEq for sockaddr_dl { fn eq(&self, other: &sockaddr_dl) -> bool { self.sdl_len == other.sdl_len @@ -417,6 +246,64 @@ self.sdl_data.hash(state); } } + + impl PartialEq for mq_attr { + fn eq(&self, other: &mq_attr) -> bool { + self.mq_flags == other.mq_flags && + self.mq_maxmsg == other.mq_maxmsg && + self.mq_msgsize == other.mq_msgsize && + self.mq_curmsgs == other.mq_curmsgs + } + } + impl Eq for mq_attr {} + impl ::fmt::Debug for mq_attr { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("mq_attr") + .field("mq_flags", &self.mq_flags) + .field("mq_maxmsg", &self.mq_maxmsg) + .field("mq_msgsize", &self.mq_msgsize) + .field("mq_curmsgs", &self.mq_curmsgs) + .finish() + } + } + impl ::hash::Hash for mq_attr { + fn hash(&self, state: &mut H) { + self.mq_flags.hash(state); + self.mq_maxmsg.hash(state); + self.mq_msgsize.hash(state); + self.mq_curmsgs.hash(state); + } + } + + impl PartialEq for sigevent { + fn eq(&self, other: &sigevent) -> bool { + self.sigev_notify == other.sigev_notify + && self.sigev_signo == other.sigev_signo + && self.sigev_value == other.sigev_value + && self.sigev_notify_thread_id + == other.sigev_notify_thread_id + } + } + impl Eq for sigevent {} + impl ::fmt::Debug for sigevent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sigevent") + .field("sigev_notify", &self.sigev_notify) + .field("sigev_signo", &self.sigev_signo) + .field("sigev_value", &self.sigev_value) + .field("sigev_notify_thread_id", + &self.sigev_notify_thread_id) + .finish() + } + } + impl ::hash::Hash for sigevent { + fn hash(&self, state: &mut H) { + self.sigev_notify.hash(state); + self.sigev_signo.hash(state); + self.sigev_value.hash(state); + self.sigev_notify_thread_id.hash(state); + } + } } } @@ -465,61 +352,61 @@ pub const POLLINIGNEOF: ::c_short = 0x2000; -pub const EVFILT_READ: ::int16_t = -1; -pub const EVFILT_WRITE: ::int16_t = -2; -pub const EVFILT_AIO: ::int16_t = -3; -pub const EVFILT_VNODE: ::int16_t = -4; -pub const EVFILT_PROC: ::int16_t = -5; -pub const EVFILT_SIGNAL: ::int16_t = -6; -pub const EVFILT_TIMER: ::int16_t = -7; -pub const EVFILT_PROCDESC: ::int16_t = -8; -pub const EVFILT_FS: ::int16_t = -9; -pub const EVFILT_LIO: ::int16_t = -10; -pub const EVFILT_USER: ::int16_t = -11; -pub const EVFILT_SENDFILE: ::int16_t = -12; -pub const EVFILT_EMPTY: ::int16_t = -13; - -pub const EV_ADD: ::uint16_t = 0x1; -pub const EV_DELETE: ::uint16_t = 0x2; -pub const EV_ENABLE: ::uint16_t = 0x4; -pub const EV_DISABLE: ::uint16_t = 0x8; -pub const EV_ONESHOT: ::uint16_t = 0x10; -pub const EV_CLEAR: ::uint16_t = 0x20; -pub const EV_RECEIPT: ::uint16_t = 0x40; -pub const EV_DISPATCH: ::uint16_t = 0x80; -pub const EV_DROP: ::uint16_t = 0x1000; -pub const EV_FLAG1: ::uint16_t = 0x2000; -pub const EV_ERROR: ::uint16_t = 0x4000; -pub const EV_EOF: ::uint16_t = 0x8000; -pub const EV_SYSFLAGS: ::uint16_t = 0xf000; - -pub const NOTE_TRIGGER: ::uint32_t = 0x01000000; -pub const NOTE_FFNOP: ::uint32_t = 0x00000000; -pub const NOTE_FFAND: ::uint32_t = 0x40000000; -pub const NOTE_FFOR: ::uint32_t = 0x80000000; -pub const NOTE_FFCOPY: ::uint32_t = 0xc0000000; -pub const NOTE_FFCTRLMASK: ::uint32_t = 0xc0000000; -pub const NOTE_FFLAGSMASK: ::uint32_t = 0x00ffffff; -pub const NOTE_LOWAT: ::uint32_t = 0x00000001; -pub const NOTE_DELETE: ::uint32_t = 0x00000001; -pub const NOTE_WRITE: ::uint32_t = 0x00000002; -pub const NOTE_EXTEND: ::uint32_t = 0x00000004; -pub const NOTE_ATTRIB: ::uint32_t = 0x00000008; -pub const NOTE_LINK: ::uint32_t = 0x00000010; -pub const NOTE_RENAME: ::uint32_t = 0x00000020; -pub const NOTE_REVOKE: ::uint32_t = 0x00000040; -pub const NOTE_EXIT: ::uint32_t = 0x80000000; -pub const NOTE_FORK: ::uint32_t = 0x40000000; -pub const NOTE_EXEC: ::uint32_t = 0x20000000; -pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff; -pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000; -pub const NOTE_TRACK: ::uint32_t = 0x00000001; -pub const NOTE_TRACKERR: ::uint32_t = 0x00000002; -pub const NOTE_CHILD: ::uint32_t = 0x00000004; -pub const NOTE_SECONDS: ::uint32_t = 0x00000001; -pub const NOTE_MSECONDS: ::uint32_t = 0x00000002; -pub const NOTE_USECONDS: ::uint32_t = 0x00000004; -pub const NOTE_NSECONDS: ::uint32_t = 0x00000008; +pub const EVFILT_READ: i16 = -1; +pub const EVFILT_WRITE: i16 = -2; +pub const EVFILT_AIO: i16 = -3; +pub const EVFILT_VNODE: i16 = -4; +pub const EVFILT_PROC: i16 = -5; +pub const EVFILT_SIGNAL: i16 = -6; +pub const EVFILT_TIMER: i16 = -7; +pub const EVFILT_PROCDESC: i16 = -8; +pub const EVFILT_FS: i16 = -9; +pub const EVFILT_LIO: i16 = -10; +pub const EVFILT_USER: i16 = -11; +pub const EVFILT_SENDFILE: i16 = -12; +pub const EVFILT_EMPTY: i16 = -13; + +pub const EV_ADD: u16 = 0x1; +pub const EV_DELETE: u16 = 0x2; +pub const EV_ENABLE: u16 = 0x4; +pub const EV_DISABLE: u16 = 0x8; +pub const EV_ONESHOT: u16 = 0x10; +pub const EV_CLEAR: u16 = 0x20; +pub const EV_RECEIPT: u16 = 0x40; +pub const EV_DISPATCH: u16 = 0x80; +pub const EV_DROP: u16 = 0x1000; +pub const EV_FLAG1: u16 = 0x2000; +pub const EV_ERROR: u16 = 0x4000; +pub const EV_EOF: u16 = 0x8000; +pub const EV_SYSFLAGS: u16 = 0xf000; + +pub const NOTE_TRIGGER: u32 = 0x01000000; +pub const NOTE_FFNOP: u32 = 0x00000000; +pub const NOTE_FFAND: u32 = 0x40000000; +pub const NOTE_FFOR: u32 = 0x80000000; +pub const NOTE_FFCOPY: u32 = 0xc0000000; +pub const NOTE_FFCTRLMASK: u32 = 0xc0000000; +pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff; +pub const NOTE_LOWAT: u32 = 0x00000001; +pub const NOTE_DELETE: u32 = 0x00000001; +pub const NOTE_WRITE: u32 = 0x00000002; +pub const NOTE_EXTEND: u32 = 0x00000004; +pub const NOTE_ATTRIB: u32 = 0x00000008; +pub const NOTE_LINK: u32 = 0x00000010; +pub const NOTE_RENAME: u32 = 0x00000020; +pub const NOTE_REVOKE: u32 = 0x00000040; +pub const NOTE_EXIT: u32 = 0x80000000; +pub const NOTE_FORK: u32 = 0x40000000; +pub const NOTE_EXEC: u32 = 0x20000000; +pub const NOTE_PDATAMASK: u32 = 0x000fffff; +pub const NOTE_PCTRLMASK: u32 = 0xf0000000; +pub const NOTE_TRACK: u32 = 0x00000001; +pub const NOTE_TRACKERR: u32 = 0x00000002; +pub const NOTE_CHILD: u32 = 0x00000004; +pub const NOTE_SECONDS: u32 = 0x00000001; +pub const NOTE_MSECONDS: u32 = 0x00000002; +pub const NOTE_USECONDS: u32 = 0x00000004; +pub const NOTE_NSECONDS: u32 = 0x00000008; pub const MADV_PROTECT: ::c_int = 10; pub const RUSAGE_THREAD: ::c_int = 1; @@ -683,14 +570,6 @@ pub const TIOCM_DCD: ::c_int = 0x40; pub const H4DISC: ::c_int = 0x7; -pub const FIONCLEX: ::c_ulong = 0x20006602; -pub const FIONREAD: ::c_ulong = 0x4004667f; -pub const FIOASYNC: ::c_ulong = 0x8004667d; -pub const FIOSETOWN: ::c_ulong = 0x8004667c; -pub const FIOGETOWN: ::c_ulong = 0x4004667b; -pub const FIODTYPE: ::c_ulong = 0x4004667a; -pub const FIOGETLBA: ::c_ulong = 0x40046679; -pub const FIODGNAME: ::c_ulong = 0x80106678; pub const FIONWRITE: ::c_ulong = 0x40046677; pub const FIONSPACE: ::c_ulong = 0x40046676; pub const FIOSEEKDATA: ::c_ulong = 0xc0086661; @@ -767,8 +646,6 @@ pub const AF_IEEE80211: ::c_int = 37; pub const AF_INET_SDP: ::c_int = 40; pub const AF_INET6_SDP: ::c_int = 42; -#[doc(hidden)] -pub const AF_MAX: ::c_int = 42; // https://github.com/freebsd/freebsd/blob/master/sys/net/if.h#L140 pub const IFF_UP: ::c_int = 0x1; // (n) interface is up @@ -779,14 +656,20 @@ // 0x20 was IFF_SMART pub const IFF_RUNNING: ::c_int = 0x40; // (d) resources allocated #[doc(hidden)] -// IFF_DRV_RUNNING is deprecated. Use the portable `IFF_RUNNING` instead +#[deprecated( + since="0.2.54", + note="IFF_DRV_RUNNING is deprecated. Use the portable IFF_RUNNING instead" +)] pub const IFF_DRV_RUNNING: ::c_int = 0x40; pub const IFF_NOARP: ::c_int = 0x80; // (n) no address resolution protocol pub const IFF_PROMISC: ::c_int = 0x100; // (n) receive all packets pub const IFF_ALLMULTI: ::c_int = 0x200; // (n) receive all multicast packets pub const IFF_OACTIVE: ::c_int = 0x400; // (d) tx hardware queue is full #[doc(hidden)] -// IFF_DRV_OACTIVE is deprecated. Use the portable `IFF_OACTIVE` instead +#[deprecated( + since = "0.2.54", + note = "Use the portable `IFF_OACTIVE` instead", +)] pub const IFF_DRV_OACTIVE: ::c_int = 0x400; pub const IFF_SIMPLEX: ::c_int = 0x800; // (i) can't hear own transmissions pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit @@ -1069,8 +952,6 @@ pub const PF_IEEE80211: ::c_int = AF_IEEE80211; pub const PF_INET_SDP: ::c_int = AF_INET_SDP; pub const PF_INET6_SDP: ::c_int = AF_INET6_SDP; -#[doc(hidden)] -pub const PF_MAX: ::c_int = AF_MAX; pub const NET_RT_DUMP: ::c_int = 1; pub const NET_RT_FLAGS: ::c_int = 2; @@ -1106,14 +987,16 @@ // they were all removed in svn r262489. They remain here for backwards // compatibility only, and are scheduled to be removed in libc 1.0.0. #[doc(hidden)] -pub const NET_MAXID: ::c_int = AF_MAX; -#[doc(hidden)] +#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")] pub const CTL_MAXID: ::c_int = 10; #[doc(hidden)] +#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")] pub const KERN_MAXID: ::c_int = 38; #[doc(hidden)] +#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")] pub const HW_MAXID: ::c_int = 13; #[doc(hidden)] +#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")] pub const USER_MAXID: ::c_int = 21; #[doc(hidden)] pub const CTL_P1003_1B_MAXID: ::c_int = 26; @@ -1251,9 +1134,6 @@ extern { pub fn __error() -> *mut ::c_int; - pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int) - -> ::c_int; - pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int; @@ -1335,7 +1215,6 @@ timeout: *mut ::timespec) -> ::ssize_t; pub fn mq_getfd_np(mqd: ::mqd_t) -> ::c_int; - pub fn freelocale(loc: ::locale_t) -> ::c_int; pub fn waitid(idtype: idtype_t, id: ::id_t, infop: *mut ::siginfo_t, options: ::c_int) -> ::c_int; @@ -1349,8 +1228,6 @@ pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut ::msqid_ds) -> ::c_int; pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int; - pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t, - msgtyp: ::c_long, msgflg: ::c_int) -> ::c_int; pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t, msgflg: ::c_int) -> ::c_int; pub fn cfmakesane(termios: *mut ::termios); @@ -1452,6 +1329,16 @@ } cfg_if! { + if #[cfg(freebsd12)] { + mod freebsd12; + pub use self::freebsd12::*; + } else { + mod freebsd11; + pub use self::freebsd11::*; + } +} + +cfg_if! { if #[cfg(target_arch = "x86")] { mod x86; pub use self::x86::*; diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -23,8 +23,8 @@ pub st_blocks: ::blkcnt_t, pub st_blksize: ::blksize_t, pub st_flags: ::fflags_t, - pub st_gen: ::uint32_t, - pub st_lspare: ::int32_t, + pub st_gen: u32, + pub st_lspare: i32, pub st_birthtime: ::time_t, pub st_birthtime_nsec: ::c_long, } diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -4,32 +4,6 @@ pub type time_t = i64; pub type suseconds_t = i64; -s! { - pub struct stat { - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_size: ::off_t, - pub st_blocks: ::blkcnt_t, - pub st_blksize: ::blksize_t, - pub st_flags: ::fflags_t, - pub st_gen: ::uint32_t, - pub st_lspare: ::int32_t, - pub st_birthtime: ::time_t, - pub st_birthtime_nsec: ::c_long, - } -} - // should be pub(crate), but that requires Rust 1.18.0 cfg_if! { if #[cfg(libc_const_size_of)] { diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs 2019-07-17 05:42:23.000000000 +0000 @@ -23,8 +23,8 @@ pub st_blocks: ::blkcnt_t, pub st_blksize: ::blksize_t, pub st_flags: ::fflags_t, - pub st_gen: ::uint32_t, - pub st_lspare: ::int32_t, + pub st_gen: u32, + pub st_lspare: i32, pub st_birthtime: ::time_t, pub st_birthtime_nsec: ::c_long, __unused: [u8; 8], diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/mod.rs cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/freebsdlike/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/freebsdlike/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,4 +1,3 @@ -pub type dev_t = u32; pub type mode_t = u16; pub type pthread_attr_t = *mut ::c_void; pub type rlim_t = i64; @@ -22,6 +21,16 @@ fn clone(&self) -> timezone { *self } } +impl siginfo_t { + pub unsafe fn si_addr(&self) -> *mut ::c_void { + self.si_addr + } + + pub unsafe fn si_value(&self) -> ::sigval { + self.si_value + } +} + s! { pub struct in_addr { pub s_addr: ::in_addr_t, @@ -46,15 +55,6 @@ __unused8: *mut ::c_void, } - pub struct kevent { - pub ident: ::uintptr_t, - pub filter: ::c_short, - pub flags: ::c_ushort, - pub fflags: ::c_uint, - pub data: ::intptr_t, - pub udata: *mut ::c_void, - } - pub struct addrinfo { pub ai_flags: ::c_int, pub ai_family: ::c_int, @@ -78,7 +78,9 @@ pub si_uid: ::uid_t, pub si_status: ::c_int, pub si_addr: *mut ::c_void, - _pad: [::c_int; 12], + pub si_value: ::sigval, + _pad1: ::c_long, + _pad2: [::c_int; 7], } pub struct sigaction { @@ -758,7 +760,11 @@ pub const LOCK_UN: ::c_int = 8; pub const MAP_COPY: ::c_int = 0x0002; +#[doc(hidden)] +#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")] pub const MAP_RENAME: ::c_int = 0x0020; +#[doc(hidden)] +#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")] pub const MAP_NORESERVE: ::c_int = 0x0040; pub const MAP_HASSEMAPHORE: ::c_int = 0x0200; pub const MAP_STACK: ::c_int = 0x0400; @@ -1003,6 +1009,10 @@ pub const PPPDISC: ::c_int = 0x5; pub const NETGRAPHDISC: ::c_int = 0x6; +pub const FIODTYPE: ::c_ulong = 0x4004667a; +pub const FIOGETLBA: ::c_ulong = 0x40046679; +pub const FIODGNAME: ::c_ulong = 0x80106678; + pub const B0: speed_t = 0; pub const B50: speed_t = 50; pub const B75: speed_t = 75; @@ -1095,7 +1105,8 @@ -> ::c_int; pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; - + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::timezone) -> ::c_int; pub fn accept4(s: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int; pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int; @@ -1140,7 +1151,10 @@ pub fn getutxid(ut: *const utmpx) -> *mut utmpx; pub fn getutxline(ut: *const utmpx) -> *mut utmpx; pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int; - #[cfg_attr(target_os = "freebsd", link_name = "kevent@FBSD_1.0")] + #[cfg_attr( + all(target_os = "freebsd", not(freebsd12)), + link_name = "kevent@FBSD_1.0" + )] pub fn kevent(kq: ::c_int, changelist: *const ::kevent, nchanges: ::c_int, @@ -1156,7 +1170,10 @@ n: ::size_t) -> *mut ::c_void; pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int; - #[cfg_attr(target_os = "freebsd", link_name = "mknodat@FBSD_1.1")] + #[cfg_attr( + all(target_os = "freebsd", not(freebsd12)), + link_name = "mknodat@FBSD_1.1" + )] pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, dev: dev_t) -> ::c_int; pub fn mq_close(mqd: ::mqd_t) -> ::c_int; diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/mod.rs cargo-0.37.0/vendor/libc/src/unix/bsd/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -94,7 +94,7 @@ } pub struct fsid_t { - __fsid_val: [::int32_t; 2], + __fsid_val: [i32; 2], } pub struct if_nameindex { @@ -233,7 +233,12 @@ pub const LC_MESSAGES: ::c_int = 6; pub const FIOCLEX: ::c_ulong = 0x20006601; +pub const FIONCLEX: ::c_ulong = 0x20006602; +pub const FIONREAD: ::c_ulong = 0x4004667f; pub const FIONBIO: ::c_ulong = 0x8004667e; +pub const FIOASYNC: ::c_ulong = 0x8004667d; +pub const FIOSETOWN: ::c_ulong = 0x8004667c; +pub const FIOGETOWN: ::c_ulong = 0x4004667b; pub const PATH_MAX: ::c_int = 1024; @@ -488,6 +493,15 @@ } extern { + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "getrlimit$UNIX2003")] + pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "setrlimit$UNIX2003")] + pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; + + pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, + buflen: ::size_t) -> ::c_int; pub fn abs(i: ::c_int) -> ::c_int; pub fn atof(s: *const ::c_char) -> ::c_double; pub fn labs(i: ::c_long) -> ::c_long; @@ -506,7 +520,6 @@ pub fn getpwent() -> *mut passwd; pub fn setpwent(); pub fn endpwent(); - pub fn setgrent(); pub fn endgrent(); pub fn getgrent() -> *mut ::group; @@ -522,14 +535,20 @@ #[cfg_attr(target_os = "macos", link_name = "glob$INODE64")] #[cfg_attr(target_os = "netbsd", link_name = "__glob30")] - #[cfg_attr(target_os = "freebsd", link_name = "glob@FBSD_1.0")] + #[cfg_attr( + all(target_os = "freebsd", not(freebsd12)), + link_name = "glob@FBSD_1.0" + )] pub fn glob(pattern: *const ::c_char, flags: ::c_int, errfunc: ::Option ::c_int>, pglob: *mut ::glob_t) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__globfree30")] - #[cfg_attr(target_os = "freebsd", link_name = "globfree@FBSD_1.0")] + #[cfg_attr( + all(target_os = "freebsd", not(freebsd12)), + link_name = "globfree@FBSD_1.0" + )] pub fn globfree(pglob: *mut ::glob_t); pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) @@ -663,8 +682,7 @@ if #[cfg(any(target_os = "macos", target_os = "ios"))] { mod apple; pub use self::apple::*; - } else if #[cfg(any(target_os = "openbsd", target_os = "netbsd", - target_os = "bitrig"))] { + } else if #[cfg(any(target_os = "openbsd", target_os = "netbsd"))] { mod netbsdlike; pub use self::netbsdlike::*; } else if #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] { diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/mod.rs cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,14 +1,14 @@ pub type time_t = i64; pub type mode_t = u32; -pub type nlink_t = ::uint32_t; -pub type ino_t = ::uint64_t; +pub type nlink_t = u32; +pub type ino_t = u64; pub type pthread_key_t = ::c_int; pub type rlim_t = u64; pub type speed_t = ::c_uint; pub type tcflag_t = ::c_uint; pub type nl_item = c_long; pub type clockid_t = ::c_int; -pub type id_t = ::uint32_t; +pub type id_t = u32; pub type sem_t = *mut sem; #[cfg_attr(feature = "extra_traits", derive(Debug))] @@ -597,6 +597,7 @@ #[link(name = "util")] extern { + pub fn setgrent(); pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, @@ -676,9 +677,9 @@ if #[cfg(target_os = "netbsd")] { mod netbsd; pub use self::netbsd::*; - } else if #[cfg(any(target_os = "openbsd", target_os = "bitrig"))] { - mod openbsdlike; - pub use self::openbsdlike::*; + } else if #[cfg(target_os = "openbsd")] { + mod openbsd; + pub use self::openbsd::*; } else { // Unknown target_os } diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,14 +1,30 @@ pub type clock_t = ::c_uint; pub type suseconds_t = ::c_int; pub type dev_t = u64; -pub type blksize_t = ::int32_t; -pub type fsblkcnt_t = ::uint64_t; -pub type fsfilcnt_t = ::uint64_t; +pub type blksize_t = i32; +pub type fsblkcnt_t = u64; +pub type fsfilcnt_t = u64; pub type idtype_t = ::c_int; pub type mqd_t = ::c_int; type __pthread_spin_t = __cpu_simple_lock_nv_t; pub type vm_size_t = ::uintptr_t; +impl siginfo_t { + pub unsafe fn si_value(&self) -> ::sigval { + #[repr(C)] + struct siginfo_timer { + _si_signo: ::c_int, + _si_errno: ::c_int, + _si_code: ::c_int, + __pad1: ::c_int, + _pid: ::pid_t, + _uid: ::uid_t, + value: ::sigval, + } + (*(self as *const siginfo_t as *const siginfo_timer)).value + } +} + s! { pub struct aiocb { pub aio_offset: ::off_t, @@ -46,14 +62,6 @@ pub mq_curmsgs: ::c_long, } - pub struct sigevent { - pub sigev_notify: ::c_int, - pub sigev_signo: ::c_int, - pub sigev_value: ::sigval, - __unused1: *mut ::c_void, //actually a function pointer - pub sigev_notify_attributes: *mut ::c_void - } - pub struct sigset_t { __bits: [u32; 4], } @@ -77,9 +85,9 @@ pub st_size: ::off_t, pub st_blocks: ::blkcnt_t, pub st_blksize: ::blksize_t, - pub st_flags: ::uint32_t, - pub st_gen: ::uint32_t, - pub st_spare: [::uint32_t; 2], + pub st_flags: u32, + pub st_gen: u32, + pub st_spare: [u32; 2], } pub struct addrinfo { @@ -163,22 +171,22 @@ pub struct kevent { pub ident: ::uintptr_t, - pub filter: ::uint32_t, - pub flags: ::uint32_t, - pub fflags: ::uint32_t, - pub data: ::int64_t, + pub filter: u32, + pub flags: u32, + pub fflags: u32, + pub data: i64, pub udata: ::intptr_t, } pub struct dqblk { - pub dqb_bhardlimit: ::uint32_t, - pub dqb_bsoftlimit: ::uint32_t, - pub dqb_curblocks: ::uint32_t, - pub dqb_ihardlimit: ::uint32_t, - pub dqb_isoftlimit: ::uint32_t, - pub dqb_curinodes: ::uint32_t, - pub dqb_btime: ::int32_t, - pub dqb_itime: ::int32_t, + pub dqb_bhardlimit: u32, + pub dqb_bsoftlimit: u32, + pub dqb_curblocks: u32, + pub dqb_ihardlimit: u32, + pub dqb_isoftlimit: u32, + pub dqb_curinodes: u32, + pub dqb_btime: i32, + pub dqb_itime: i32, } pub struct Dl_info { @@ -261,10 +269,10 @@ pub sdl_len: ::c_uchar, pub sdl_family: ::c_uchar, pub sdl_index: ::c_ushort, - pub sdl_type: ::uint8_t, - pub sdl_nlen: ::uint8_t, - pub sdl_alen: ::uint8_t, - pub sdl_slen: ::uint8_t, + pub sdl_type: u8, + pub sdl_nlen: u8, + pub sdl_alen: u8, + pub sdl_slen: u8, pub sdl_data: [::c_char; 12], } @@ -304,7 +312,7 @@ pub sin_family: ::sa_family_t, pub sin_port: ::in_port_t, pub sin_addr: ::in_addr, - pub sin_zero: [::int8_t; 8], + pub sin_zero: [i8; 8], } pub struct dirent { @@ -331,18 +339,18 @@ pub f_favail: ::fsfilcnt_t, pub f_fresvd: ::fsfilcnt_t, - pub f_syncreads: ::uint64_t, - pub f_syncwrites: ::uint64_t, + pub f_syncreads: u64, + pub f_syncwrites: u64, - pub f_asyncreads: ::uint64_t, - pub f_asyncwrites: ::uint64_t, + pub f_asyncreads: u64, + pub f_asyncwrites: u64, pub f_fsidx: ::fsid_t, pub f_fsid: ::c_ulong, pub f_namemax: ::c_ulong, pub f_owner: ::uid_t, - pub f_spare: [::uint32_t; 4], + pub f_spare: [u32; 4], pub f_fstypename: [::c_char; 32], pub f_mntonname: [::c_char; 1024], @@ -356,6 +364,14 @@ __ss_pad2: i64, __ss_pad3: [u8; 112], } + + pub struct sigevent { + pub sigev_notify: ::c_int, + pub sigev_signo: ::c_int, + pub sigev_value: ::sigval, + __unused1: *mut ::c_void, //actually a function pointer + pub sigev_notify_attributes: *mut ::c_void + } } cfg_if! { @@ -658,6 +674,36 @@ self.__ss_pad3.hash(state); } } + + impl PartialEq for sigevent { + fn eq(&self, other: &sigevent) -> bool { + self.sigev_notify == other.sigev_notify + && self.sigev_signo == other.sigev_signo + && self.sigev_value == other.sigev_value + && self.sigev_notify_attributes + == other.sigev_notify_attributes + } + } + impl Eq for sigevent {} + impl ::fmt::Debug for sigevent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sigevent") + .field("sigev_notify", &self.sigev_notify) + .field("sigev_signo", &self.sigev_signo) + .field("sigev_value", &self.sigev_value) + .field("sigev_notify_attributes", + &self.sigev_notify_attributes) + .finish() + } + } + impl ::hash::Hash for sigevent { + fn hash(&self, state: &mut H) { + self.sigev_notify.hash(state); + self.sigev_signo.hash(state); + self.sigev_value.hash(state); + self.sigev_notify_attributes.hash(state); + } + } } } @@ -853,9 +899,6 @@ pub const AF_IEEE80211: ::c_int = 32; pub const AF_MPLS: ::c_int = 33; pub const AF_ROUTE: ::c_int = 34; -pub const AF_MAX: ::c_int = 36; - -pub const NET_MAXID: ::c_int = AF_MAX; pub const NET_RT_DUMP: ::c_int = 1; pub const NET_RT_FLAGS: ::c_int = 2; pub const NET_RT_OOOIFLIST: ::c_int = 3; @@ -870,7 +913,6 @@ pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH; pub const PF_MPLS: ::c_int = AF_MPLS; pub const PF_ROUTE: ::c_int = AF_ROUTE; -pub const PF_MAX: ::c_int = AF_MAX; pub const MSG_NBIO: ::c_int = 0x1000; pub const MSG_WAITFORONE: ::c_int = 0x2000; @@ -1086,43 +1128,43 @@ pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2; pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; -pub const EVFILT_AIO: ::uint32_t = 2; -pub const EVFILT_PROC: ::uint32_t = 4; -pub const EVFILT_READ: ::uint32_t = 0; -pub const EVFILT_SIGNAL: ::uint32_t = 5; -pub const EVFILT_TIMER: ::uint32_t = 6; -pub const EVFILT_VNODE: ::uint32_t = 3; -pub const EVFILT_WRITE: ::uint32_t = 1; - -pub const EV_ADD: ::uint32_t = 0x1; -pub const EV_DELETE: ::uint32_t = 0x2; -pub const EV_ENABLE: ::uint32_t = 0x4; -pub const EV_DISABLE: ::uint32_t = 0x8; -pub const EV_ONESHOT: ::uint32_t = 0x10; -pub const EV_CLEAR: ::uint32_t = 0x20; -pub const EV_RECEIPT: ::uint32_t = 0x40; -pub const EV_DISPATCH: ::uint32_t = 0x80; -pub const EV_FLAG1: ::uint32_t = 0x2000; -pub const EV_ERROR: ::uint32_t = 0x4000; -pub const EV_EOF: ::uint32_t = 0x8000; -pub const EV_SYSFLAGS: ::uint32_t = 0xf000; - -pub const NOTE_LOWAT: ::uint32_t = 0x00000001; -pub const NOTE_DELETE: ::uint32_t = 0x00000001; -pub const NOTE_WRITE: ::uint32_t = 0x00000002; -pub const NOTE_EXTEND: ::uint32_t = 0x00000004; -pub const NOTE_ATTRIB: ::uint32_t = 0x00000008; -pub const NOTE_LINK: ::uint32_t = 0x00000010; -pub const NOTE_RENAME: ::uint32_t = 0x00000020; -pub const NOTE_REVOKE: ::uint32_t = 0x00000040; -pub const NOTE_EXIT: ::uint32_t = 0x80000000; -pub const NOTE_FORK: ::uint32_t = 0x40000000; -pub const NOTE_EXEC: ::uint32_t = 0x20000000; -pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff; -pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000; -pub const NOTE_TRACK: ::uint32_t = 0x00000001; -pub const NOTE_TRACKERR: ::uint32_t = 0x00000002; -pub const NOTE_CHILD: ::uint32_t = 0x00000004; +pub const EVFILT_AIO: u32 = 2; +pub const EVFILT_PROC: u32 = 4; +pub const EVFILT_READ: u32 = 0; +pub const EVFILT_SIGNAL: u32 = 5; +pub const EVFILT_TIMER: u32 = 6; +pub const EVFILT_VNODE: u32 = 3; +pub const EVFILT_WRITE: u32 = 1; + +pub const EV_ADD: u32 = 0x1; +pub const EV_DELETE: u32 = 0x2; +pub const EV_ENABLE: u32 = 0x4; +pub const EV_DISABLE: u32 = 0x8; +pub const EV_ONESHOT: u32 = 0x10; +pub const EV_CLEAR: u32 = 0x20; +pub const EV_RECEIPT: u32 = 0x40; +pub const EV_DISPATCH: u32 = 0x80; +pub const EV_FLAG1: u32 = 0x2000; +pub const EV_ERROR: u32 = 0x4000; +pub const EV_EOF: u32 = 0x8000; +pub const EV_SYSFLAGS: u32 = 0xf000; + +pub const NOTE_LOWAT: u32 = 0x00000001; +pub const NOTE_DELETE: u32 = 0x00000001; +pub const NOTE_WRITE: u32 = 0x00000002; +pub const NOTE_EXTEND: u32 = 0x00000004; +pub const NOTE_ATTRIB: u32 = 0x00000008; +pub const NOTE_LINK: u32 = 0x00000010; +pub const NOTE_RENAME: u32 = 0x00000020; +pub const NOTE_REVOKE: u32 = 0x00000040; +pub const NOTE_EXIT: u32 = 0x80000000; +pub const NOTE_FORK: u32 = 0x40000000; +pub const NOTE_EXEC: u32 = 0x20000000; +pub const NOTE_PDATAMASK: u32 = 0x000fffff; +pub const NOTE_PCTRLMASK: u32 = 0xf0000000; +pub const NOTE_TRACK: u32 = 0x00000001; +pub const NOTE_TRACKERR: u32 = 0x00000002; +pub const NOTE_CHILD: u32 = 0x00000004; pub const TMP_MAX : ::c_uint = 308915776; @@ -1326,14 +1368,9 @@ pub const SOCK_CLOEXEC: ::c_int = 0x10000000; pub const SOCK_NONBLOCK: ::c_int = 0x20000000; -pub const FIONCLEX: ::c_ulong = 0x20006602; // Uncomment on next NetBSD release // pub const FIOSEEKDATA: ::c_ulong = 0xc0086661; // pub const FIOSEEKHOLE: ::c_ulong = 0xc0086662; -pub const FIONREAD: ::c_ulong = 0x4004667f; -pub const FIOASYNC: ::c_ulong = 0x8004667d; -pub const FIOSETOWN: ::c_ulong = 0x8004667c; -pub const FIOGETOWN: ::c_ulong = 0x4004667b; pub const OFIOGETBMAP: ::c_ulong = 0xc004667a; pub const FIOGETBMAP: ::c_ulong = 0xc008667a; pub const FIONWRITE: ::c_ulong = 0x40046679; @@ -1492,6 +1529,9 @@ #[link_name = "__lutimes50"] pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int; + #[link_name = "__gettimeofday50"] + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::c_void) -> ::c_int; pub fn getnameinfo(sa: *const ::sockaddr, salen: ::socklen_t, host: *mut ::c_char, diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsd/aarch64.rs cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsd/aarch64.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsd/aarch64.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsd/aarch64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,14 @@ +pub type c_long = i64; +pub type c_ulong = u64; +pub type c_char = u8; + +// should be pub(crate), but that requires Rust 1.18.0 +cfg_if! { + if #[cfg(libc_const_size_of)] { + #[doc(hidden)] + pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; + } else { + #[doc(hidden)] + pub const _ALIGNBYTES: usize = 8 - 1; + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,1442 @@ +use unix::bsd::O_SYNC; + +pub type clock_t = i64; +pub type suseconds_t = ::c_long; +pub type dev_t = i32; +pub type sigset_t = ::c_uint; +pub type blksize_t = i32; +pub type fsblkcnt_t = u64; +pub type fsfilcnt_t = u64; +pub type pthread_attr_t = *mut ::c_void; +pub type pthread_mutex_t = *mut ::c_void; +pub type pthread_mutexattr_t = *mut ::c_void; +pub type pthread_cond_t = *mut ::c_void; +pub type pthread_condattr_t = *mut ::c_void; +pub type pthread_rwlock_t = *mut ::c_void; +pub type pthread_rwlockattr_t = *mut ::c_void; +pub type caddr_t = *mut ::c_char; + +s! { + pub struct glob_t { + pub gl_pathc: ::size_t, + pub gl_matchc: ::size_t, + pub gl_offs: ::size_t, + pub gl_flags: ::c_int, + pub gl_pathv: *mut *mut ::c_char, + __unused1: *mut ::c_void, + __unused2: *mut ::c_void, + __unused3: *mut ::c_void, + __unused4: *mut ::c_void, + __unused5: *mut ::c_void, + __unused6: *mut ::c_void, + __unused7: *mut ::c_void, + } + + pub struct lconv { + pub decimal_point: *mut ::c_char, + pub thousands_sep: *mut ::c_char, + pub grouping: *mut ::c_char, + pub int_curr_symbol: *mut ::c_char, + pub currency_symbol: *mut ::c_char, + pub mon_decimal_point: *mut ::c_char, + pub mon_thousands_sep: *mut ::c_char, + pub mon_grouping: *mut ::c_char, + pub positive_sign: *mut ::c_char, + pub negative_sign: *mut ::c_char, + pub int_frac_digits: ::c_char, + pub frac_digits: ::c_char, + pub p_cs_precedes: ::c_char, + pub p_sep_by_space: ::c_char, + pub n_cs_precedes: ::c_char, + pub n_sep_by_space: ::c_char, + pub p_sign_posn: ::c_char, + pub n_sign_posn: ::c_char, + pub int_p_cs_precedes: ::c_char, + pub int_p_sep_by_space: ::c_char, + pub int_n_cs_precedes: ::c_char, + pub int_n_sep_by_space: ::c_char, + pub int_p_sign_posn: ::c_char, + pub int_n_sign_posn: ::c_char, + } + + pub struct ufs_args { + pub fspec: *mut ::c_char, + pub export_info: export_args, + } + + pub struct mfs_args { + pub fspec: *mut ::c_char, + pub export_info: export_args, + // https://github.com/openbsd/src/blob/master/sys/sys/types.h#L134 + pub base: *mut ::c_char, + pub size: ::c_ulong, + } + + pub struct iso_args { + pub fspec: *mut ::c_char, + pub export_info: export_args, + pub flags: ::c_int, + pub sess: ::c_int, + } + + pub struct nfs_args { + pub version: ::c_int, + pub addr: *mut ::sockaddr, + pub addrlen: ::c_int, + pub sotype: ::c_int, + pub proto: ::c_int, + pub fh: *mut ::c_uchar, + pub fhsize: ::c_int, + pub flags: ::c_int, + pub wsize: ::c_int, + pub rsize: ::c_int, + pub readdirsize: ::c_int, + pub timeo: ::c_int, + pub retrans: ::c_int, + pub maxgrouplist: ::c_int, + pub readahead: ::c_int, + pub leaseterm: ::c_int, + pub deadthresh: ::c_int, + pub hostname: *mut ::c_char, + pub acregmin: ::c_int, + pub acregmax: ::c_int, + pub acdirmin: ::c_int, + pub acdirmax: ::c_int, + } + + pub struct msdosfs_args { + pub fspec: *mut ::c_char, + pub export_info: export_args, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub mask: ::mode_t, + pub flags: ::c_int, + } + + pub struct ntfs_args { + pub fspec: *mut ::c_char, + pub export_info: export_args, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub mode: ::mode_t, + pub flag: ::c_ulong, + } + + pub struct udf_args { + pub fspec: *mut ::c_char, + pub lastblock: u32, + } + + pub struct tmpfs_args { + pub ta_version: ::c_int, + pub ta_nodes_max: ::ino_t, + pub ta_size_max: ::off_t, + pub ta_root_uid: ::uid_t, + pub ta_root_gid: ::gid_t, + pub ta_root_mode: ::mode_t, + } + + pub struct fusefs_args { + pub name: *mut ::c_char, + pub fd: ::c_int, + pub max_read: ::c_int, + pub allow_other: ::c_int, + } + + pub struct xucred { + pub cr_uid: ::uid_t, + pub cr_gid: ::gid_t, + pub cr_ngroups: ::c_short, + //https://github.com/openbsd/src/blob/master/sys/sys/syslimits.h#L44 + pub cr_groups: [::gid_t; 16], + } + + pub struct export_args { + pub ex_flags: ::c_int, + pub ex_root: ::uid_t, + pub ex_anon: xucred, + pub ex_addr: *mut ::sockaddr, + pub ex_addrlen: ::c_int, + pub ex_mask: *mut ::sockaddr, + pub ex_masklen: ::c_int, + } + + pub struct ip_mreq { + pub imr_multiaddr: in_addr, + pub imr_interface: in_addr, + } + + pub struct in_addr { + pub s_addr: ::in_addr_t, + } + + pub struct sockaddr_in { + pub sin_len: u8, + pub sin_family: ::sa_family_t, + pub sin_port: ::in_port_t, + pub sin_addr: ::in_addr, + pub sin_zero: [i8; 8], + } + + pub struct kevent { + pub ident: ::uintptr_t, + pub filter: ::c_short, + pub flags: ::c_ushort, + pub fflags: ::c_uint, + pub data: i64, + pub udata: *mut ::c_void, + } + + pub struct stat { + pub st_mode: ::mode_t, + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_size: ::off_t, + pub st_blocks: ::blkcnt_t, + pub st_blksize: ::blksize_t, + pub st_flags: u32, + pub st_gen: u32, + pub st_birthtime: ::time_t, + pub st_birthtime_nsec: ::c_long, + } + + pub struct statvfs { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_favail: ::fsfilcnt_t, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + } + + pub struct addrinfo { + pub ai_flags: ::c_int, + pub ai_family: ::c_int, + pub ai_socktype: ::c_int, + pub ai_protocol: ::c_int, + pub ai_addrlen: ::socklen_t, + pub ai_addr: *mut ::sockaddr, + pub ai_canonname: *mut ::c_char, + pub ai_next: *mut ::addrinfo, + } + + pub struct Dl_info { + pub dli_fname: *const ::c_char, + pub dli_fbase: *mut ::c_void, + pub dli_sname: *const ::c_char, + pub dli_saddr: *mut ::c_void, + } + + pub struct if_data { + pub ifi_type: ::c_uchar, + pub ifi_addrlen: ::c_uchar, + pub ifi_hdrlen: ::c_uchar, + pub ifi_link_state: ::c_uchar, + pub ifi_mtu: u32, + pub ifi_metric: u32, + pub ifi_rdomain: u32, + pub ifi_baudrate: u64, + pub ifi_ipackets: u64, + pub ifi_ierrors: u64, + pub ifi_opackets: u64, + pub ifi_oerrors: u64, + pub ifi_collisions: u64, + pub ifi_ibytes: u64, + pub ifi_obytes: u64, + pub ifi_imcasts: u64, + pub ifi_omcasts: u64, + pub ifi_iqdrops: u64, + pub ifi_oqdrops: u64, + pub ifi_noproto: u64, + pub ifi_capabilities: u32, + pub ifi_lastchange: ::timeval, + } + + pub struct if_msghdr { + pub ifm_msglen: ::c_ushort, + pub ifm_version: ::c_uchar, + pub ifm_type: ::c_uchar, + pub ifm_hdrlen: ::c_ushort, + pub ifm_index: ::c_ushort, + pub ifm_tableid: ::c_ushort, + pub ifm_pad1: ::c_uchar, + pub ifm_pad2: ::c_uchar, + pub ifm_addrs: ::c_int, + pub ifm_flags: ::c_int, + pub ifm_xflags: ::c_int, + pub ifm_data: if_data, + } + + pub struct sockaddr_dl { + pub sdl_len: ::c_uchar, + pub sdl_family: ::c_uchar, + pub sdl_index: ::c_ushort, + pub sdl_type: ::c_uchar, + pub sdl_nlen: ::c_uchar, + pub sdl_alen: ::c_uchar, + pub sdl_slen: ::c_uchar, + pub sdl_data: [::c_char; 24], + } + + pub struct sockpeercred { + pub uid: ::uid_t, + pub gid: ::gid_t, + pub pid: ::pid_t, + } + + pub struct arphdr { + pub ar_hrd: u16, + pub ar_pro: u16, + pub ar_hln: u8, + pub ar_pln: u8, + pub ar_op: u16, + } +} + +impl siginfo_t { + pub unsafe fn si_value(&self) -> ::sigval { + #[repr(C)] + struct siginfo_timer { + _si_signo: ::c_int, + _si_errno: ::c_int, + _si_code: ::c_int, + _pid: ::pid_t, + _uid: ::uid_t, + value: ::sigval, + } + (*(self as *const siginfo_t as *const siginfo_timer)).value + } +} + +s_no_extra_traits! { + pub struct dirent { + pub d_fileno: ::ino_t, + pub d_off: ::off_t, + pub d_reclen: u16, + pub d_type: u8, + pub d_namlen: u8, + __d_padding: [u8; 4], + pub d_name: [::c_char; 256], + } + + pub struct sockaddr_storage { + pub ss_len: u8, + pub ss_family: ::sa_family_t, + __ss_pad1: [u8; 6], + __ss_pad2: i64, + __ss_pad3: [u8; 240], + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_code: ::c_int, + pub si_errno: ::c_int, + pub si_addr: *mut ::c_char, + #[cfg(target_pointer_width = "32")] + __pad: [u8; 112], + #[cfg(target_pointer_width = "64")] + __pad: [u8; 108], + } + + pub struct lastlog { + ll_time: ::time_t, + ll_line: [::c_char; UT_LINESIZE], + ll_host: [::c_char; UT_HOSTSIZE], + } + + pub struct utmp { + pub ut_line: [::c_char; UT_LINESIZE], + pub ut_name: [::c_char; UT_NAMESIZE], + pub ut_host: [::c_char; UT_HOSTSIZE], + pub ut_time: ::time_t, + } + + pub union mount_info { + pub ufs_args: ufs_args, + pub mfs_args: mfs_args, + pub nfs_args: nfs_args, + pub iso_args: iso_args, + pub msdosfs_args: msdosfs_args, + pub ntfs_args: ntfs_args, + pub tmpfs_args: tmpfs_args, + align: [::c_char; 160], + } + +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for dirent { + fn eq(&self, other: &dirent) -> bool { + self.d_fileno == other.d_fileno + && self.d_off == other.d_off + && self.d_reclen == other.d_reclen + && self.d_type == other.d_type + && self.d_namlen == other.d_namlen + && self + .d_name + .iter() + .zip(other.d_name.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for dirent {} + + impl ::fmt::Debug for dirent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("dirent") + .field("d_fileno", &self.d_fileno) + .field("d_off", &self.d_off) + .field("d_reclen", &self.d_reclen) + .field("d_type", &self.d_type) + .field("d_namlen", &self.d_namlen) + // FIXME: .field("d_name", &self.d_name) + .finish() + } + } + + impl ::hash::Hash for dirent { + fn hash(&self, state: &mut H) { + self.d_fileno.hash(state); + self.d_off.hash(state); + self.d_reclen.hash(state); + self.d_type.hash(state); + self.d_namlen.hash(state); + self.d_name.hash(state); + } + } + + impl PartialEq for sockaddr_storage { + fn eq(&self, other: &sockaddr_storage) -> bool { + self.ss_len == other.ss_len + && self.ss_family == other.ss_family + } + } + + impl Eq for sockaddr_storage {} + + impl ::fmt::Debug for sockaddr_storage { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sockaddr_storage") + .field("ss_len", &self.ss_len) + .field("ss_family", &self.ss_family) + .finish() + } + } + + impl ::hash::Hash for sockaddr_storage { + fn hash(&self, state: &mut H) { + self.ss_len.hash(state); + self.ss_family.hash(state); + } + } + + impl PartialEq for siginfo_t { + fn eq(&self, other: &siginfo_t) -> bool { + self.si_signo == other.si_signo + && self.si_code == other.si_code + && self.si_errno == other.si_errno + && self.si_addr == other.si_addr + } + } + + impl Eq for siginfo_t {} + + impl ::fmt::Debug for siginfo_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("siginfo_t") + .field("si_signo", &self.si_signo) + .field("si_code", &self.si_code) + .field("si_errno", &self.si_errno) + .field("si_addr", &self.si_addr) + .finish() + } + } + + impl ::hash::Hash for siginfo_t { + fn hash(&self, state: &mut H) { + self.si_signo.hash(state); + self.si_code.hash(state); + self.si_errno.hash(state); + self.si_addr.hash(state); + } + } + + impl PartialEq for lastlog { + fn eq(&self, other: &lastlog) -> bool { + self.ll_time == other.ll_time + && self + .ll_line + .iter() + .zip(other.ll_line.iter()) + .all(|(a,b)| a == b) + && self + .ll_host + .iter() + .zip(other.ll_host.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for lastlog {} + + impl ::fmt::Debug for lastlog { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("lastlog") + .field("ll_time", &self.ll_time) + // FIXME: .field("ll_line", &self.ll_line) + // FIXME: .field("ll_host", &self.ll_host) + .finish() + } + } + + impl ::hash::Hash for lastlog { + fn hash(&self, state: &mut H) { + self.ll_time.hash(state); + self.ll_line.hash(state); + self.ll_host.hash(state); + } + } + + impl PartialEq for utmp { + fn eq(&self, other: &utmp) -> bool { + self.ut_time == other.ut_time + && self + .ut_line + .iter() + .zip(other.ut_line.iter()) + .all(|(a,b)| a == b) + && self + .ut_name + .iter() + .zip(other.ut_name.iter()) + .all(|(a,b)| a == b) + && self + .ut_host + .iter() + .zip(other.ut_host.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for utmp {} + + impl ::fmt::Debug for utmp { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("utmp") + // FIXME: .field("ut_line", &self.ut_line) + // FIXME: .field("ut_name", &self.ut_name) + // FIXME: .field("ut_host", &self.ut_host) + .field("ut_time", &self.ut_time) + .finish() + } + } + + impl ::hash::Hash for utmp { + fn hash(&self, state: &mut H) { + self.ut_line.hash(state); + self.ut_name.hash(state); + self.ut_host.hash(state); + self.ut_time.hash(state); + } + } + + impl PartialEq for mount_info { + fn eq(&self, other: &mount_info) -> bool { + unsafe { + self.align + .iter() + .zip(other.align.iter()) + .all(|(a,b)| a == b) + } + } + } + + impl Eq for mount_info { } + + impl ::fmt::Debug for mount_info { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("mount_info") + // FIXME: .field("align", &self.align) + .finish() + } + } + + impl ::hash::Hash for mount_info { + fn hash(&self, state: &mut H) { + unsafe { self.align.hash(state) }; + } + } + } +} + +cfg_if! { + if #[cfg(libc_union)] { + s_no_extra_traits! { + // This type uses the union mount_info: + pub struct statfs { + pub f_flags: u32, + pub f_bsize: u32, + pub f_iosize: u32, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: i64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: i64, + pub f_syncwrites: u64, + pub f_syncreads: u64, + pub f_asyncwrites: u64, + pub f_asyncreads: u64, + pub f_fsid: ::fsid_t, + pub f_namemax: u32, + pub f_owner: ::uid_t, + pub f_ctime: u64, + pub f_fstypename: [::c_char; 16], + pub f_mntonname: [::c_char; 90], + pub f_mntfromname: [::c_char; 90], + pub f_mntfromspec: [::c_char; 90], + pub mount_info: mount_info, + } + } + + cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for statfs { + fn eq(&self, other: &statfs) -> bool { + self.f_flags == other.f_flags + && self.f_bsize == other.f_bsize + && self.f_iosize == other.f_iosize + && self.f_blocks == other.f_blocks + && self.f_bfree == other.f_bfree + && self.f_bavail == other.f_bavail + && self.f_files == other.f_files + && self.f_ffree == other.f_ffree + && self.f_favail == other.f_favail + && self.f_syncwrites == other.f_syncwrites + && self.f_syncreads == other.f_syncreads + && self.f_asyncwrites == other.f_asyncwrites + && self.f_asyncreads == other.f_asyncreads + && self.f_fsid == other.f_fsid + && self.f_namemax == other.f_namemax + && self.f_owner == other.f_owner + && self.f_ctime == other.f_ctime + && self.f_fstypename + .iter() + .zip(other.f_fstypename.iter()) + .all(|(a,b)| a == b) + && self.f_mntonname + .iter() + .zip(other.f_mntonname.iter()) + .all(|(a,b)| a == b) + && self.f_mntfromname + .iter() + .zip(other.f_mntfromname.iter()) + .all(|(a,b)| a == b) + && self.f_mntfromspec + .iter() + .zip(other.f_mntfromspec.iter()) + .all(|(a,b)| a == b) + && self.mount_info == other.mount_info + } + } + + impl Eq for statfs { } + + impl ::fmt::Debug for statfs { + fn fmt(&self, f: &mut ::fmt::Formatter) + -> ::fmt::Result { + f.debug_struct("statfs") + .field("f_flags", &self.f_flags) + .field("f_bsize", &self.f_bsize) + .field("f_iosize", &self.f_iosize) + .field("f_blocks", &self.f_blocks) + .field("f_bfree", &self.f_bfree) + .field("f_bavail", &self.f_bavail) + .field("f_files", &self.f_files) + .field("f_ffree", &self.f_ffree) + .field("f_favail", &self.f_favail) + .field("f_syncwrites", &self.f_syncwrites) + .field("f_syncreads", &self.f_syncreads) + .field("f_asyncwrites", &self.f_asyncwrites) + .field("f_asyncreads", &self.f_asyncreads) + .field("f_fsid", &self.f_fsid) + .field("f_namemax", &self.f_namemax) + .field("f_owner", &self.f_owner) + .field("f_ctime", &self.f_ctime) + // FIXME: .field("f_fstypename", &self.f_fstypename) + // FIXME: .field("f_mntonname", &self.f_mntonname) + // FIXME: .field("f_mntfromname", &self.f_mntfromname) + // FIXME: .field("f_mntfromspec", &self.f_mntfromspec) + .field("mount_info", &self.mount_info) + .finish() + } + } + + impl ::hash::Hash for statfs { + fn hash(&self, state: &mut H) { + self.f_flags.hash(state); + self.f_bsize.hash(state); + self.f_iosize.hash(state); + self.f_blocks.hash(state); + self.f_bfree.hash(state); + self.f_bavail.hash(state); + self.f_files.hash(state); + self.f_ffree.hash(state); + self.f_favail.hash(state); + self.f_syncwrites.hash(state); + self.f_syncreads.hash(state); + self.f_asyncwrites.hash(state); + self.f_asyncreads.hash(state); + self.f_fsid.hash(state); + self.f_namemax.hash(state); + self.f_owner.hash(state); + self.f_ctime.hash(state); + self.f_fstypename.hash(state); + self.f_mntonname.hash(state); + self.f_mntfromname.hash(state); + self.f_mntfromspec.hash(state); + self.mount_info.hash(state); + } + } + } + } + } +} + +pub const UT_NAMESIZE: usize = 32; +pub const UT_LINESIZE: usize = 8; +pub const UT_HOSTSIZE: usize = 256; + +pub const O_CLOEXEC: ::c_int = 0x10000; +pub const O_DIRECTORY: ::c_int = 0x20000; +pub const O_RSYNC: ::c_int = O_SYNC; + +pub const MS_SYNC : ::c_int = 0x0002; +pub const MS_INVALIDATE : ::c_int = 0x0004; + +pub const POLLNORM: ::c_short = ::POLLRDNORM; + +pub const ENOATTR : ::c_int = 83; +pub const EILSEQ : ::c_int = 84; +pub const EOVERFLOW : ::c_int = 87; +pub const ECANCELED : ::c_int = 88; +pub const EIDRM : ::c_int = 89; +pub const ENOMSG : ::c_int = 90; +pub const ENOTSUP : ::c_int = 91; +pub const EBADMSG : ::c_int = 92; +pub const ENOTRECOVERABLE : ::c_int = 93; +pub const EOWNERDEAD : ::c_int = 94; +pub const EPROTO : ::c_int = 95; +pub const ELAST : ::c_int = 95; + +pub const F_DUPFD_CLOEXEC : ::c_int = 10; + +pub const AT_FDCWD: ::c_int = -100; +pub const AT_EACCESS: ::c_int = 0x01; +pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x02; +pub const AT_SYMLINK_FOLLOW: ::c_int = 0x04; +pub const AT_REMOVEDIR: ::c_int = 0x08; + +pub const RLIM_NLIMITS: ::c_int = 9; + +pub const SO_TIMESTAMP: ::c_int = 0x0800; +pub const SO_SNDTIMEO: ::c_int = 0x1005; +pub const SO_RCVTIMEO: ::c_int = 0x1006; +pub const SO_BINDANY: ::c_int = 0x1000; +pub const SO_NETPROC: ::c_int = 0x1020; +pub const SO_RTABLE: ::c_int = 0x1021; +pub const SO_PEERCRED: ::c_int = 0x1022; +pub const SO_SPLICE: ::c_int = 0x1023; + +// sys/netinet/in.h +// Protocols (RFC 1700) +// NOTE: These are in addition to the constants defined in src/unix/mod.rs + +// IPPROTO_IP defined in src/unix/mod.rs +/// Hop-by-hop option header +pub const IPPROTO_HOPOPTS: ::c_int = 0; +// IPPROTO_ICMP defined in src/unix/mod.rs +/// group mgmt protocol +pub const IPPROTO_IGMP: ::c_int = 2; +/// gateway^2 (deprecated) +pub const IPPROTO_GGP: ::c_int = 3; +/// for compatibility +pub const IPPROTO_IPIP: ::c_int = 4; +// IPPROTO_TCP defined in src/unix/mod.rs +/// exterior gateway protocol +pub const IPPROTO_EGP: ::c_int = 8; +/// pup +pub const IPPROTO_PUP: ::c_int = 12; +// IPPROTO_UDP defined in src/unix/mod.rs +/// xns idp +pub const IPPROTO_IDP: ::c_int = 22; +/// tp-4 w/ class negotiation +pub const IPPROTO_TP: ::c_int = 29; +// IPPROTO_IPV6 defined in src/unix/mod.rs +/// IP6 routing header +pub const IPPROTO_ROUTING: ::c_int = 43; +/// IP6 fragmentation header +pub const IPPROTO_FRAGMENT: ::c_int = 44; +/// resource reservation +pub const IPPROTO_RSVP: ::c_int = 46; +/// General Routing Encap. +pub const IPPROTO_GRE: ::c_int = 47; +/// IP6 Encap Sec. Payload +pub const IPPROTO_ESP: ::c_int = 50; +/// IP6 Auth Header +pub const IPPROTO_AH: ::c_int = 51; +/// IP Mobility RFC 2004 +pub const IPPROTO_MOBILE: ::c_int = 55; +// IPPROTO_ICMPV6 defined in src/unix/mod.rs +/// IP6 no next header +pub const IPPROTO_NONE: ::c_int = 59; +/// IP6 destination option +pub const IPPROTO_DSTOPTS: ::c_int = 60; +/// ISO cnlp +pub const IPPROTO_EON: ::c_int = 80; +/// Ethernet-in-IP +pub const IPPROTO_ETHERIP: ::c_int = 97; +/// encapsulation header +pub const IPPROTO_ENCAP: ::c_int = 98; +/// Protocol indep. multicast +pub const IPPROTO_PIM: ::c_int = 103; +/// IP Payload Comp. Protocol +pub const IPPROTO_IPCOMP: ::c_int = 108; +/// CARP +pub const IPPROTO_CARP: ::c_int = 112; +/// unicast MPLS packet +pub const IPPROTO_MPLS: ::c_int = 137; +/// PFSYNC +pub const IPPROTO_PFSYNC: ::c_int = 240; +pub const IPPROTO_MAX: ::c_int = 256; + +/* Only used internally, so it can be outside the range of valid IP protocols */ +/// Divert sockets +pub const IPPROTO_DIVERT: ::c_int = 258; + +pub const IP_RECVDSTADDR: ::c_int = 7; +pub const IP_SENDSRCADDR: ::c_int = IP_RECVDSTADDR; +pub const IP_RECVIF: ::c_int = 30; + +// sys/netinet/in.h +pub const TCP_MD5SIG: ::c_int = 0x04; +pub const TCP_NOPUSH: ::c_int = 0x10; + +pub const AF_ECMA: ::c_int = 8; +pub const AF_ROUTE: ::c_int = 17; +pub const AF_ENCAP: ::c_int = 28; +pub const AF_SIP: ::c_int = 29; +pub const AF_KEY: ::c_int = 30; +pub const pseudo_AF_HDRCMPLT: ::c_int = 31; +pub const AF_BLUETOOTH: ::c_int = 32; +pub const AF_MPLS: ::c_int = 33; +pub const pseudo_AF_PFLOW: ::c_int = 34; +pub const pseudo_AF_PIPEX: ::c_int = 35; +pub const NET_RT_DUMP: ::c_int = 1; +pub const NET_RT_FLAGS: ::c_int = 2; +pub const NET_RT_IFLIST: ::c_int = 3; +pub const NET_RT_STATS: ::c_int = 4; +pub const NET_RT_TABLE: ::c_int = 5; +pub const NET_RT_IFNAMES: ::c_int = 6; +#[doc(hidden)] +pub const NET_RT_MAXID: ::c_int = 7; + +pub const IPV6_JOIN_GROUP: ::c_int = 12; +pub const IPV6_LEAVE_GROUP: ::c_int = 13; + +pub const PF_ROUTE: ::c_int = AF_ROUTE; +pub const PF_ECMA: ::c_int = AF_ECMA; +pub const PF_ENCAP: ::c_int = AF_ENCAP; +pub const PF_SIP: ::c_int = AF_SIP; +pub const PF_KEY: ::c_int = AF_KEY; +pub const PF_BPF: ::c_int = pseudo_AF_HDRCMPLT; +pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH; +pub const PF_MPLS: ::c_int = AF_MPLS; +pub const PF_PFLOW: ::c_int = pseudo_AF_PFLOW; +pub const PF_PIPEX: ::c_int = pseudo_AF_PIPEX; + +pub const SCM_TIMESTAMP: ::c_int = 0x04; + +pub const O_DSYNC : ::c_int = 128; + +pub const MAP_RENAME : ::c_int = 0x0000; +pub const MAP_NORESERVE : ::c_int = 0x0000; +pub const MAP_HASSEMAPHORE : ::c_int = 0x0000; + +pub const EIPSEC : ::c_int = 82; +pub const ENOMEDIUM : ::c_int = 85; +pub const EMEDIUMTYPE : ::c_int = 86; + +pub const EAI_BADFLAGS: ::c_int = -1; +pub const EAI_NONAME: ::c_int = -2; +pub const EAI_AGAIN: ::c_int = -3; +pub const EAI_FAIL: ::c_int = -4; +pub const EAI_NODATA: ::c_int = -5; +pub const EAI_FAMILY: ::c_int = -6; +pub const EAI_SOCKTYPE: ::c_int = -7; +pub const EAI_SERVICE: ::c_int = -8; +pub const EAI_MEMORY: ::c_int = -10; +pub const EAI_SYSTEM: ::c_int = -11; +pub const EAI_OVERFLOW: ::c_int = -14; + +pub const RUSAGE_THREAD: ::c_int = 1; + +pub const MAP_COPY : ::c_int = 0x0002; +pub const MAP_NOEXTEND : ::c_int = 0x0000; + +pub const _PC_LINK_MAX : ::c_int = 1; +pub const _PC_MAX_CANON : ::c_int = 2; +pub const _PC_MAX_INPUT : ::c_int = 3; +pub const _PC_NAME_MAX : ::c_int = 4; +pub const _PC_PATH_MAX : ::c_int = 5; +pub const _PC_PIPE_BUF : ::c_int = 6; +pub const _PC_CHOWN_RESTRICTED : ::c_int = 7; +pub const _PC_NO_TRUNC : ::c_int = 8; +pub const _PC_VDISABLE : ::c_int = 9; +pub const _PC_2_SYMLINKS : ::c_int = 10; +pub const _PC_ALLOC_SIZE_MIN : ::c_int = 11; +pub const _PC_ASYNC_IO : ::c_int = 12; +pub const _PC_FILESIZEBITS : ::c_int = 13; +pub const _PC_PRIO_IO : ::c_int = 14; +pub const _PC_REC_INCR_XFER_SIZE : ::c_int = 15; +pub const _PC_REC_MAX_XFER_SIZE : ::c_int = 16; +pub const _PC_REC_MIN_XFER_SIZE : ::c_int = 17; +pub const _PC_REC_XFER_ALIGN : ::c_int = 18; +pub const _PC_SYMLINK_MAX : ::c_int = 19; +pub const _PC_SYNC_IO : ::c_int = 20; +pub const _PC_TIMESTAMP_RESOLUTION : ::c_int = 21; + +pub const _SC_CLK_TCK : ::c_int = 3; +pub const _SC_SEM_NSEMS_MAX : ::c_int = 31; +pub const _SC_SEM_VALUE_MAX : ::c_int = 32; +pub const _SC_HOST_NAME_MAX : ::c_int = 33; +pub const _SC_MONOTONIC_CLOCK : ::c_int = 34; +pub const _SC_2_PBS : ::c_int = 35; +pub const _SC_2_PBS_ACCOUNTING : ::c_int = 36; +pub const _SC_2_PBS_CHECKPOINT : ::c_int = 37; +pub const _SC_2_PBS_LOCATE : ::c_int = 38; +pub const _SC_2_PBS_MESSAGE : ::c_int = 39; +pub const _SC_2_PBS_TRACK : ::c_int = 40; +pub const _SC_ADVISORY_INFO : ::c_int = 41; +pub const _SC_AIO_LISTIO_MAX : ::c_int = 42; +pub const _SC_AIO_MAX : ::c_int = 43; +pub const _SC_AIO_PRIO_DELTA_MAX : ::c_int = 44; +pub const _SC_ASYNCHRONOUS_IO : ::c_int = 45; +pub const _SC_ATEXIT_MAX : ::c_int = 46; +pub const _SC_BARRIERS : ::c_int = 47; +pub const _SC_CLOCK_SELECTION : ::c_int = 48; +pub const _SC_CPUTIME : ::c_int = 49; +pub const _SC_DELAYTIMER_MAX : ::c_int = 50; +pub const _SC_IOV_MAX : ::c_int = 51; +pub const _SC_IPV6 : ::c_int = 52; +pub const _SC_MAPPED_FILES : ::c_int = 53; +pub const _SC_MEMLOCK : ::c_int = 54; +pub const _SC_MEMLOCK_RANGE : ::c_int = 55; +pub const _SC_MEMORY_PROTECTION : ::c_int = 56; +pub const _SC_MESSAGE_PASSING : ::c_int = 57; +pub const _SC_MQ_OPEN_MAX : ::c_int = 58; +pub const _SC_MQ_PRIO_MAX : ::c_int = 59; +pub const _SC_PRIORITIZED_IO : ::c_int = 60; +pub const _SC_PRIORITY_SCHEDULING : ::c_int = 61; +pub const _SC_RAW_SOCKETS : ::c_int = 62; +pub const _SC_READER_WRITER_LOCKS : ::c_int = 63; +pub const _SC_REALTIME_SIGNALS : ::c_int = 64; +pub const _SC_REGEXP : ::c_int = 65; +pub const _SC_RTSIG_MAX : ::c_int = 66; +pub const _SC_SEMAPHORES : ::c_int = 67; +pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 68; +pub const _SC_SHELL : ::c_int = 69; +pub const _SC_SIGQUEUE_MAX : ::c_int = 70; +pub const _SC_SPAWN : ::c_int = 71; +pub const _SC_SPIN_LOCKS : ::c_int = 72; +pub const _SC_SPORADIC_SERVER : ::c_int = 73; +pub const _SC_SS_REPL_MAX : ::c_int = 74; +pub const _SC_SYNCHRONIZED_IO : ::c_int = 75; +pub const _SC_SYMLOOP_MAX : ::c_int = 76; +pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 77; +pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 78; +pub const _SC_THREAD_CPUTIME : ::c_int = 79; +pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 80; +pub const _SC_THREAD_KEYS_MAX : ::c_int = 81; +pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 82; +pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 83; +pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 84; +pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 85; +pub const _SC_THREAD_ROBUST_PRIO_INHERIT : ::c_int = 86; +pub const _SC_THREAD_ROBUST_PRIO_PROTECT : ::c_int = 87; +pub const _SC_THREAD_SPORADIC_SERVER : ::c_int = 88; +pub const _SC_THREAD_STACK_MIN : ::c_int = 89; +pub const _SC_THREAD_THREADS_MAX : ::c_int = 90; +pub const _SC_THREADS : ::c_int = 91; +pub const _SC_TIMEOUTS : ::c_int = 92; +pub const _SC_TIMER_MAX : ::c_int = 93; +pub const _SC_TIMERS : ::c_int = 94; +pub const _SC_TRACE : ::c_int = 95; +pub const _SC_TRACE_EVENT_FILTER : ::c_int = 96; +pub const _SC_TRACE_EVENT_NAME_MAX : ::c_int = 97; +pub const _SC_TRACE_INHERIT : ::c_int = 98; +pub const _SC_TRACE_LOG : ::c_int = 99; +pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 100; +pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 101; +pub const _SC_LOGIN_NAME_MAX : ::c_int = 102; +pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 103; +pub const _SC_TRACE_NAME_MAX : ::c_int = 104; +pub const _SC_TRACE_SYS_MAX : ::c_int = 105; +pub const _SC_TRACE_USER_EVENT_MAX : ::c_int = 106; +pub const _SC_TTY_NAME_MAX : ::c_int = 107; +pub const _SC_TYPED_MEMORY_OBJECTS : ::c_int = 108; +pub const _SC_V6_ILP32_OFF32 : ::c_int = 109; +pub const _SC_V6_ILP32_OFFBIG : ::c_int = 110; +pub const _SC_V6_LP64_OFF64 : ::c_int = 111; +pub const _SC_V6_LPBIG_OFFBIG : ::c_int = 112; +pub const _SC_V7_ILP32_OFF32 : ::c_int = 113; +pub const _SC_V7_ILP32_OFFBIG : ::c_int = 114; +pub const _SC_V7_LP64_OFF64 : ::c_int = 115; +pub const _SC_V7_LPBIG_OFFBIG : ::c_int = 116; +pub const _SC_XOPEN_CRYPT : ::c_int = 117; +pub const _SC_XOPEN_ENH_I18N : ::c_int = 118; +pub const _SC_XOPEN_LEGACY : ::c_int = 119; +pub const _SC_XOPEN_REALTIME : ::c_int = 120; +pub const _SC_XOPEN_REALTIME_THREADS : ::c_int = 121; +pub const _SC_XOPEN_STREAMS : ::c_int = 122; +pub const _SC_XOPEN_UNIX : ::c_int = 123; +pub const _SC_XOPEN_UUCP : ::c_int = 124; +pub const _SC_XOPEN_VERSION : ::c_int = 125; +pub const _SC_PHYS_PAGES : ::c_int = 500; +pub const _SC_AVPHYS_PAGES : ::c_int = 501; +pub const _SC_NPROCESSORS_CONF : ::c_int = 502; +pub const _SC_NPROCESSORS_ONLN : ::c_int = 503; + +pub const FD_SETSIZE: usize = 1024; + +pub const ST_NOSUID: ::c_ulong = 2; + +pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _; +pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _; +pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _; + +pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1; +pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2; +pub const PTHREAD_MUTEX_NORMAL: ::c_int = 3; +pub const PTHREAD_MUTEX_STRICT_NP: ::c_int = 4; +pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_STRICT_NP; + +pub const EVFILT_AIO: i16 = -3; +pub const EVFILT_PROC: i16 = -5; +pub const EVFILT_READ: i16 = -1; +pub const EVFILT_SIGNAL: i16 = -6; +pub const EVFILT_TIMER: i16 = -7; +pub const EVFILT_VNODE: i16 = -4; +pub const EVFILT_WRITE: i16 = -2; + +pub const EV_ADD: u16 = 0x1; +pub const EV_DELETE: u16 = 0x2; +pub const EV_ENABLE: u16 = 0x4; +pub const EV_DISABLE: u16 = 0x8; +pub const EV_ONESHOT: u16 = 0x10; +pub const EV_CLEAR: u16 = 0x20; +pub const EV_RECEIPT: u16 = 0x40; +pub const EV_DISPATCH: u16 = 0x80; +pub const EV_FLAG1: u16 = 0x2000; +pub const EV_ERROR: u16 = 0x4000; +pub const EV_EOF: u16 = 0x8000; +pub const EV_SYSFLAGS: u16 = 0xf000; + +pub const NOTE_LOWAT: u32 = 0x00000001; +pub const NOTE_EOF: u32 = 0x00000002; +pub const NOTE_DELETE: u32 = 0x00000001; +pub const NOTE_WRITE: u32 = 0x00000002; +pub const NOTE_EXTEND: u32 = 0x00000004; +pub const NOTE_ATTRIB: u32 = 0x00000008; +pub const NOTE_LINK: u32 = 0x00000010; +pub const NOTE_RENAME: u32 = 0x00000020; +pub const NOTE_REVOKE: u32 = 0x00000040; +pub const NOTE_TRUNCATE: u32 = 0x00000080; +pub const NOTE_EXIT: u32 = 0x80000000; +pub const NOTE_FORK: u32 = 0x40000000; +pub const NOTE_EXEC: u32 = 0x20000000; +pub const NOTE_PDATAMASK: u32 = 0x000fffff; +pub const NOTE_PCTRLMASK: u32 = 0xf0000000; +pub const NOTE_TRACK: u32 = 0x00000001; +pub const NOTE_TRACKERR: u32 = 0x00000002; +pub const NOTE_CHILD: u32 = 0x00000004; + +pub const TMP_MAX : ::c_uint = 0x7fffffff; + +pub const NI_MAXHOST: ::size_t = 256; + +pub const RTLD_LOCAL: ::c_int = 0; + +pub const CTL_MAXNAME: ::c_int = 12; + +pub const CTLTYPE_NODE: ::c_int = 1; +pub const CTLTYPE_INT: ::c_int = 2; +pub const CTLTYPE_STRING: ::c_int = 3; +pub const CTLTYPE_QUAD: ::c_int = 4; +pub const CTLTYPE_STRUCT: ::c_int = 5; + +pub const CTL_UNSPEC: ::c_int = 0; +pub const CTL_KERN: ::c_int = 1; +pub const CTL_VM: ::c_int = 2; +pub const CTL_FS: ::c_int = 3; +pub const CTL_NET: ::c_int = 4; +pub const CTL_DEBUG: ::c_int = 5; +pub const CTL_HW: ::c_int = 6; +pub const CTL_MACHDEP: ::c_int = 7; +pub const CTL_DDB: ::c_int = 9; +pub const CTL_VFS: ::c_int = 10; +pub const CTL_MAXID: ::c_int = 11; + +pub const HW_NCPUONLINE: ::c_int = 25; + +pub const KERN_OSTYPE: ::c_int = 1; +pub const KERN_OSRELEASE: ::c_int = 2; +pub const KERN_OSREV: ::c_int = 3; +pub const KERN_VERSION: ::c_int = 4; +pub const KERN_MAXVNODES: ::c_int = 5; +pub const KERN_MAXPROC: ::c_int = 6; +pub const KERN_MAXFILES: ::c_int = 7; +pub const KERN_ARGMAX: ::c_int = 8; +pub const KERN_SECURELVL: ::c_int = 9; +pub const KERN_HOSTNAME: ::c_int = 10; +pub const KERN_HOSTID: ::c_int = 11; +pub const KERN_CLOCKRATE: ::c_int = 12; +pub const KERN_PROF: ::c_int = 16; +pub const KERN_POSIX1: ::c_int = 17; +pub const KERN_NGROUPS: ::c_int = 18; +pub const KERN_JOB_CONTROL: ::c_int = 19; +pub const KERN_SAVED_IDS: ::c_int = 20; +pub const KERN_BOOTTIME: ::c_int = 21; +pub const KERN_DOMAINNAME: ::c_int = 22; +pub const KERN_MAXPARTITIONS: ::c_int = 23; +pub const KERN_RAWPARTITION: ::c_int = 24; +pub const KERN_MAXTHREAD: ::c_int = 25; +pub const KERN_NTHREADS: ::c_int = 26; +pub const KERN_OSVERSION: ::c_int = 27; +pub const KERN_SOMAXCONN: ::c_int = 28; +pub const KERN_SOMINCONN: ::c_int = 29; +pub const KERN_USERMOUNT: ::c_int = 30; +pub const KERN_NOSUIDCOREDUMP: ::c_int = 32; +pub const KERN_FSYNC: ::c_int = 33; +pub const KERN_SYSVMSG: ::c_int = 34; +pub const KERN_SYSVSEM: ::c_int = 35; +pub const KERN_SYSVSHM: ::c_int = 36; +pub const KERN_ARND: ::c_int = 37; +pub const KERN_MSGBUFSIZE: ::c_int = 38; +pub const KERN_MALLOCSTATS: ::c_int = 39; +pub const KERN_CPTIME: ::c_int = 40; +pub const KERN_NCHSTATS: ::c_int = 41; +pub const KERN_FORKSTAT: ::c_int = 42; +pub const KERN_NSELCOLL: ::c_int = 43; +pub const KERN_TTY: ::c_int = 44; +pub const KERN_CCPU: ::c_int = 45; +pub const KERN_FSCALE: ::c_int = 46; +pub const KERN_NPROCS: ::c_int = 47; +pub const KERN_MSGBUF: ::c_int = 48; +pub const KERN_POOL: ::c_int = 49; +pub const KERN_STACKGAPRANDOM: ::c_int = 50; +pub const KERN_SYSVIPC_INFO: ::c_int = 51; +pub const KERN_SPLASSERT: ::c_int = 54; +pub const KERN_PROC_ARGS: ::c_int = 55; +pub const KERN_NFILES: ::c_int = 56; +pub const KERN_TTYCOUNT: ::c_int = 57; +pub const KERN_NUMVNODES: ::c_int = 58; +pub const KERN_MBSTAT: ::c_int = 59; +pub const KERN_SEMINFO: ::c_int = 61; +pub const KERN_SHMINFO: ::c_int = 62; +pub const KERN_INTRCNT: ::c_int = 63; +pub const KERN_WATCHDOG: ::c_int = 64; +pub const KERN_PROC: ::c_int = 66; +pub const KERN_MAXCLUSTERS: ::c_int = 67; +pub const KERN_EVCOUNT: ::c_int = 68; +pub const KERN_TIMECOUNTER: ::c_int = 69; +pub const KERN_MAXLOCKSPERUID: ::c_int = 70; +pub const KERN_CPTIME2: ::c_int = 71; +pub const KERN_CACHEPCT: ::c_int = 72; +pub const KERN_FILE: ::c_int = 73; +pub const KERN_CONSDEV: ::c_int = 75; +pub const KERN_NETLIVELOCKS: ::c_int = 76; +pub const KERN_POOL_DEBUG: ::c_int = 77; +pub const KERN_PROC_CWD: ::c_int = 78; +pub const KERN_PROC_NOBROADCASTKILL: ::c_int = 79; +pub const KERN_PROC_VMMAP: ::c_int = 80; +pub const KERN_GLOBAL_PTRACE: ::c_int = 81; +pub const KERN_CONSBUFSIZE: ::c_int = 82; +pub const KERN_CONSBUF: ::c_int = 83; +pub const KERN_AUDIO: ::c_int = 84; +pub const KERN_CPUSTATS: ::c_int = 85; +pub const KERN_PFSTATUS: ::c_int = 86; +pub const KERN_MAXID: ::c_int = 87; + +pub const KERN_PROC_ALL: ::c_int = 0; +pub const KERN_PROC_PID: ::c_int = 1; +pub const KERN_PROC_PGRP: ::c_int = 2; +pub const KERN_PROC_SESSION: ::c_int = 3; +pub const KERN_PROC_TTY: ::c_int = 4; +pub const KERN_PROC_UID: ::c_int = 5; +pub const KERN_PROC_RUID: ::c_int = 6; +pub const KERN_PROC_KTHREAD: ::c_int = 7; +pub const KERN_PROC_SHOW_THREADS: ::c_int = 0x40000000; + +pub const KERN_SYSVIPC_MSG_INFO: ::c_int = 1; +pub const KERN_SYSVIPC_SEM_INFO: ::c_int = 2; +pub const KERN_SYSVIPC_SHM_INFO: ::c_int = 3; + +pub const KERN_PROC_ARGV: ::c_int = 1; +pub const KERN_PROC_NARGV: ::c_int = 2; +pub const KERN_PROC_ENV: ::c_int = 3; +pub const KERN_PROC_NENV: ::c_int = 4; + +pub const KI_NGROUPS: ::c_int = 16; +pub const KI_MAXCOMLEN: ::c_int = 24; +pub const KI_WMESGLEN: ::c_int = 8; +pub const KI_MAXLOGNAME: ::c_int = 32; +pub const KI_EMULNAMELEN: ::c_int = 8; + +pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS; +pub const OLCUC: ::tcflag_t = 0x20; +pub const ONOCR: ::tcflag_t = 0x40; +pub const ONLRET: ::tcflag_t = 0x80; + +//https://github.com/openbsd/src/blob/master/sys/sys/mount.h +pub const ISOFSMNT_NORRIP: ::c_int = 0x1; // disable Rock Ridge Ext +pub const ISOFSMNT_GENS: ::c_int = 0x2; // enable generation numbers +pub const ISOFSMNT_EXTATT: ::c_int = 0x4; // enable extended attr +pub const ISOFSMNT_NOJOLIET: ::c_int = 0x8; // disable Joliet Ext +pub const ISOFSMNT_SESS: ::c_int = 0x10; // use iso_args.sess + +pub const NFS_ARGSVERSION: ::c_int = 4; // change when nfs_args changes + +pub const NFSMNT_RESVPORT: ::c_int = 0; // always use reserved ports +pub const NFSMNT_SOFT: ::c_int = 0x1; // soft mount (hard is default) +pub const NFSMNT_WSIZE: ::c_int = 0x2; // set write size +pub const NFSMNT_RSIZE: ::c_int = 0x4; // set read size +pub const NFSMNT_TIMEO: ::c_int = 0x8; // set initial timeout +pub const NFSMNT_RETRANS: ::c_int = 0x10; // set number of request retries +pub const NFSMNT_MAXGRPS: ::c_int = 0x20; // set maximum grouplist size +pub const NFSMNT_INT: ::c_int = 0x40; // allow interrupts on hard mount +pub const NFSMNT_NOCONN: ::c_int = 0x80; // Don't Connect the socket +pub const NFSMNT_NQNFS: ::c_int = 0x100; // Use Nqnfs protocol +pub const NFSMNT_NFSV3: ::c_int = 0x200; // Use NFS Version 3 protocol +pub const NFSMNT_KERB: ::c_int = 0x400; // Use Kerberos authentication +pub const NFSMNT_DUMBTIMR: ::c_int = 0x800; // Don't estimate rtt dynamically +pub const NFSMNT_LEASETERM: ::c_int = 0x1000; // set lease term (nqnfs) +pub const NFSMNT_READAHEAD: ::c_int = 0x2000; // set read ahead +pub const NFSMNT_DEADTHRESH: ::c_int = 0x4000; // set dead server retry thresh +pub const NFSMNT_NOAC: ::c_int = 0x8000; // disable attribute cache +pub const NFSMNT_RDIRPLUS: ::c_int = 0x10000; // Use Readdirplus for V3 +pub const NFSMNT_READDIRSIZE: ::c_int = 0x20000; // Set readdir size + +/* Flags valid only in mount syscall arguments */ +pub const NFSMNT_ACREGMIN: ::c_int = 0x40000; // acregmin field valid +pub const NFSMNT_ACREGMAX: ::c_int = 0x80000; // acregmax field valid +pub const NFSMNT_ACDIRMIN: ::c_int = 0x100000; // acdirmin field valid +pub const NFSMNT_ACDIRMAX: ::c_int = 0x200000; // acdirmax field valid + +/* Flags valid only in kernel */ +pub const NFSMNT_INTERNAL: ::c_int = 0xfffc0000; // Bits set internally +pub const NFSMNT_HASWRITEVERF: ::c_int = 0x40000; // Has write verifier for V3 +pub const NFSMNT_GOTPATHCONF: ::c_int = 0x80000; // Got the V3 pathconf info +pub const NFSMNT_GOTFSINFO: ::c_int = 0x100000; // Got the V3 fsinfo +pub const NFSMNT_MNTD: ::c_int = 0x200000; // Mnt server for mnt point +pub const NFSMNT_DISMINPROG: ::c_int = 0x400000; // Dismount in progress +pub const NFSMNT_DISMNT: ::c_int = 0x800000; // Dismounted +pub const NFSMNT_SNDLOCK: ::c_int = 0x1000000; // Send socket lock +pub const NFSMNT_WANTSND: ::c_int = 0x2000000; // Want above +pub const NFSMNT_RCVLOCK: ::c_int = 0x4000000; // Rcv socket lock +pub const NFSMNT_WANTRCV: ::c_int = 0x8000000; // Want above +pub const NFSMNT_WAITAUTH: ::c_int = 0x10000000; // Wait for authentication +pub const NFSMNT_HASAUTH: ::c_int = 0x20000000; // Has authenticator +pub const NFSMNT_WANTAUTH: ::c_int = 0x40000000; // Wants an authenticator +pub const NFSMNT_AUTHERR: ::c_int = 0x80000000; // Authentication error + +pub const MSDOSFSMNT_SHORTNAME: ::c_int = 0x1; // Force old DOS short names only +pub const MSDOSFSMNT_LONGNAME: ::c_int = 0x2; // Force Win'95 long names +pub const MSDOSFSMNT_NOWIN95: ::c_int = 0x4; // Completely ignore Win95 entries + +pub const NTFS_MFLAG_CASEINS: ::c_int = 0x1; +pub const NTFS_MFLAG_ALLNAMES: ::c_int = 0x2; + +pub const TMPFS_ARGS_VERSION: ::c_int = 1; + +pub const MAP_STACK : ::c_int = 0x4000; + +// https://github.com/openbsd/src/blob/master/sys/net/if.h#L187 +pub const IFF_UP: ::c_int = 0x1; // interface is up +pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid +pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging +pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net +pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link +pub const IFF_STATICARP: ::c_int = 0x20; // only static ARP +pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated +pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol +pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets +pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets +pub const IFF_OACTIVE: ::c_int = 0x400; // transmission in progress +pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions +pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit +pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit +pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit +pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast + +pub const PTHREAD_STACK_MIN : ::size_t = 4096; +pub const SIGSTKSZ : ::size_t = 28672; + +pub const PT_FIRSTMACH: ::c_int = 32; + +pub const SOCK_CLOEXEC: ::c_int = 0x8000; +pub const SOCK_NONBLOCK: ::c_int = 0x4000; +pub const SOCK_DNS: ::c_int = 0x1000; + +pub const PTRACE_FORK: ::c_int = 0x0002; + +pub const WCONTINUED: ::c_int = 8; + +fn _ALIGN(p: usize) -> usize { + (p + _ALIGNBYTES) & !_ALIGNBYTES +} + +f! { + pub fn WIFCONTINUED(status: ::c_int) -> bool { + status & 0o177777 == 0o177777 + } + + pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar { + (cmsg as *mut ::c_uchar) + .offset(_ALIGN(::mem::size_of::<::cmsghdr>()) as isize) + } + + pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint { + _ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length + } + + pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr) + -> *mut ::cmsghdr + { + if cmsg.is_null() { + return ::CMSG_FIRSTHDR(mhdr); + }; + let next = cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize) + + _ALIGN(::mem::size_of::<::cmsghdr>()); + let max = (*mhdr).msg_control as usize + + (*mhdr).msg_controllen as usize; + if next > max { + 0 as *mut ::cmsghdr + } else { + (cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)) + as *mut ::cmsghdr + } + } + + pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { + (_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize)) + as ::c_uint + } + + pub fn WSTOPSIG(status: ::c_int) -> ::c_int { + status >> 8 + } + + pub fn WIFSIGNALED(status: ::c_int) -> bool { + (status & 0o177) != 0o177 && (status & 0o177) != 0 + } + + pub fn WIFSTOPPED(status: ::c_int) -> bool { + (status & 0o177) == 0o177 + } +} + +extern { + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::timezone) -> ::c_int; + pub fn accept4(s: ::c_int, addr: *mut ::sockaddr, + addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int; + pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char, + envp: *const *const ::c_char) -> ::c_int; + pub fn pledge(promises: *const ::c_char, + execpromises: *const ::c_char) -> ::c_int; + pub fn strtonum(nptr: *const ::c_char, minval: ::c_longlong, + maxval: ::c_longlong, + errstr: *mut *const ::c_char) -> ::c_longlong; + pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int; + pub fn chflags(path: *const ::c_char, flags: ::c_uint) -> ::c_int; + pub fn fchflags(fd: ::c_int, flags: ::c_uint) -> ::c_int; + pub fn chflagsat(fd: ::c_int, path: *const ::c_char, flags: ::c_uint, + atflag: ::c_int) -> ::c_int; + pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; + pub fn getnameinfo(sa: *const ::sockaddr, + salen: ::socklen_t, + host: *mut ::c_char, + hostlen: ::size_t, + serv: *mut ::c_char, + servlen: ::size_t, + flags: ::c_int) -> ::c_int; + pub fn kevent(kq: ::c_int, + changelist: *const ::kevent, + nchanges: ::c_int, + eventlist: *mut ::kevent, + nevents: ::c_int, + timeout: *const ::timespec) -> ::c_int; + pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) + -> ::c_int; + pub fn pthread_main_np() -> ::c_int; + pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char); + pub fn pthread_stackseg_np(thread: ::pthread_t, + sinfo: *mut ::stack_t) -> ::c_int; + pub fn sysctl(name: *const ::c_int, + namelen: ::c_uint, + oldp: *mut ::c_void, + oldlenp: *mut ::size_t, + newp: *mut ::c_void, + newlen: ::size_t) + -> ::c_int; + pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; + pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int; + pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int; + pub fn ptrace(request: ::c_int, + pid: ::pid_t, + addr: caddr_t, + data: ::c_int) -> ::c_int; +} + +cfg_if! { + if #[cfg(libc_union)] { + extern { + // these functions use statfs which uses the union mount_info: + pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; + pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; + } + } +} + +cfg_if! { + if #[cfg(target_arch = "x86")] { + mod x86; + pub use self::x86::*; + } else if #[cfg(target_arch = "x86_64")] { + mod x86_64; + pub use self::x86_64::*; + } else if #[cfg(target_arch = "aarch64")] { + mod aarch64; + pub use self::aarch64::*; + } else { + // Unknown target_arch + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86_64.rs cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86_64.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86_64.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86_64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,22 @@ +use PT_FIRSTMACH; + +pub type c_long = i64; +pub type c_ulong = u64; +pub type c_char = i8; + +// should be pub(crate), but that requires Rust 1.18.0 +cfg_if! { + if #[cfg(libc_const_size_of)] { + #[doc(hidden)] + pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; + } else { + #[doc(hidden)] + pub const _ALIGNBYTES: usize = 8 - 1; + } +} + +pub const PT_STEP: ::c_int = PT_FIRSTMACH + 0; +pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1; +pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2; +pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3; +pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4; diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86.rs cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,14 @@ +pub type c_long = i32; +pub type c_ulong = u32; +pub type c_char = i8; + +// should be pub(crate), but that requires Rust 1.18.0 +cfg_if! { + if #[cfg(libc_const_size_of)] { + #[doc(hidden)] + pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1; + } else { + #[doc(hidden)] + pub const _ALIGNBYTES: usize = 4 - 1; + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,129 +0,0 @@ -pub type c_char = i8; - -s! { - pub struct glob_t { - pub gl_pathc: ::c_int, - pub gl_matchc: ::c_int, - pub gl_offs: ::c_int, - pub gl_flags: ::c_int, - pub gl_pathv: *mut *mut ::c_char, - __unused1: *mut ::c_void, - __unused2: *mut ::c_void, - __unused3: *mut ::c_void, - __unused4: *mut ::c_void, - __unused5: *mut ::c_void, - __unused6: *mut ::c_void, - __unused7: *mut ::c_void, - } - - pub struct lconv { - pub decimal_point: *mut ::c_char, - pub thousands_sep: *mut ::c_char, - pub grouping: *mut ::c_char, - pub int_curr_symbol: *mut ::c_char, - pub currency_symbol: *mut ::c_char, - pub mon_decimal_point: *mut ::c_char, - pub mon_thousands_sep: *mut ::c_char, - pub mon_grouping: *mut ::c_char, - pub positive_sign: *mut ::c_char, - pub negative_sign: *mut ::c_char, - pub int_frac_digits: ::c_char, - pub frac_digits: ::c_char, - pub p_cs_precedes: ::c_char, - pub p_sep_by_space: ::c_char, - pub n_cs_precedes: ::c_char, - pub n_sep_by_space: ::c_char, - pub p_sign_posn: ::c_char, - pub n_sign_posn: ::c_char, - pub int_p_cs_precedes: ::c_char, - pub int_n_cs_precedes: ::c_char, - pub int_p_sep_by_space: ::c_char, - pub int_n_sep_by_space: ::c_char, - pub int_p_sign_posn: ::c_char, - pub int_n_sign_posn: ::c_char, - } -} - -pub const LC_COLLATE_MASK: ::c_int = (1 << 0); -pub const LC_CTYPE_MASK: ::c_int = (1 << 1); -pub const LC_MESSAGES_MASK: ::c_int = (1 << 2); -pub const LC_MONETARY_MASK: ::c_int = (1 << 3); -pub const LC_NUMERIC_MASK: ::c_int = (1 << 4); -pub const LC_TIME_MASK: ::c_int = (1 << 5); -pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK - | LC_CTYPE_MASK - | LC_MESSAGES_MASK - | LC_MONETARY_MASK - | LC_NUMERIC_MASK - | LC_TIME_MASK; - -pub const ERA: ::nl_item = 52; -pub const ERA_D_FMT: ::nl_item = 53; -pub const ERA_D_T_FMT: ::nl_item = 54; -pub const ERA_T_FMT: ::nl_item = 55; -pub const ALT_DIGITS: ::nl_item = 56; - -pub const D_MD_ORDER: ::nl_item = 57; - -pub const ALTMON_1: ::nl_item = 58; -pub const ALTMON_2: ::nl_item = 59; -pub const ALTMON_3: ::nl_item = 60; -pub const ALTMON_4: ::nl_item = 61; -pub const ALTMON_5: ::nl_item = 62; -pub const ALTMON_6: ::nl_item = 63; -pub const ALTMON_7: ::nl_item = 64; -pub const ALTMON_8: ::nl_item = 65; -pub const ALTMON_9: ::nl_item = 66; -pub const ALTMON_10: ::nl_item = 67; -pub const ALTMON_11: ::nl_item = 68; -pub const ALTMON_12: ::nl_item = 69; - -pub const KERN_RND: ::c_int = 31; - -// https://github.com/bitrig/bitrig/blob/master/sys/net/if.h#L187 -pub const IFF_UP: ::c_int = 0x1; // interface is up -pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid -pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging -pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net -pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link -pub const IFF_NOTRAILERS: ::c_int = 0x20; // avoid use of trailers -pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated -pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol -pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets -pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets -pub const IFF_OACTIVE: ::c_int = 0x400; // transmission in progress -pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions -pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit -pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit -pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit -pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast - -pub const PTHREAD_STACK_MIN : ::size_t = 2048; -pub const SIGSTKSZ : ::size_t = 40960; - -pub const PT_FIRSTMACH: ::c_int = 32; - -extern { - pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; - pub fn duplocale(base: ::locale_t) -> ::locale_t; - pub fn freelocale(loc: ::locale_t) -> ::c_int; - pub fn newlocale(mask: ::c_int, - locale: *const ::c_char, - base: ::locale_t) -> ::locale_t; - pub fn uselocale(loc: ::locale_t) -> ::locale_t; - pub fn pledge(promises: *const ::c_char, - paths: *mut *const ::c_char) -> ::c_int; - pub fn querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char; -} - -cfg_if! { - if #[cfg(target_arch = "x86")] { - mod x86; - pub use self::x86::*; - } else if #[cfg(target_arch = "x86_64")] { - mod x86_64; - pub use self::x86_64::*; - } else { - // Unknown target_arch - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -use PT_FIRSTMACH; - -pub type c_long = i64; -pub type c_ulong = u64; - -pub const PT_STEP: ::c_int = PT_FIRSTMACH + 0; -pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1; -pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2; -pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3; -pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4; diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86.rs cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -pub type c_long = i32; -pub type c_ulong = u32; diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,948 +0,0 @@ -use unix::bsd::O_SYNC; - -pub type clock_t = i64; -pub type suseconds_t = ::c_long; -pub type dev_t = i32; -pub type sigset_t = ::c_uint; -pub type blksize_t = ::int32_t; -pub type fsblkcnt_t = ::uint64_t; -pub type fsfilcnt_t = ::uint64_t; -pub type pthread_attr_t = *mut ::c_void; -pub type pthread_mutex_t = *mut ::c_void; -pub type pthread_mutexattr_t = *mut ::c_void; -pub type pthread_cond_t = *mut ::c_void; -pub type pthread_condattr_t = *mut ::c_void; -pub type pthread_rwlock_t = *mut ::c_void; -pub type pthread_rwlockattr_t = *mut ::c_void; -pub type caddr_t = *mut ::c_char; - -s! { - pub struct ip_mreq { - pub imr_multiaddr: in_addr, - pub imr_interface: in_addr, - } - - pub struct in_addr { - pub s_addr: ::in_addr_t, - } - - pub struct sockaddr_in { - pub sin_len: u8, - pub sin_family: ::sa_family_t, - pub sin_port: ::in_port_t, - pub sin_addr: ::in_addr, - pub sin_zero: [::int8_t; 8], - } - - pub struct kevent { - pub ident: ::uintptr_t, - pub filter: ::c_short, - pub flags: ::c_ushort, - pub fflags: ::c_uint, - pub data: ::int64_t, - pub udata: *mut ::c_void, - } - - pub struct stat { - pub st_mode: ::mode_t, - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_size: ::off_t, - pub st_blocks: ::blkcnt_t, - pub st_blksize: ::blksize_t, - pub st_flags: ::uint32_t, - pub st_gen: ::uint32_t, - pub st_birthtime: ::time_t, - pub st_birthtime_nsec: ::c_long, - } - - pub struct statvfs { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_favail: ::fsfilcnt_t, - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - } - - pub struct addrinfo { - pub ai_flags: ::c_int, - pub ai_family: ::c_int, - pub ai_socktype: ::c_int, - pub ai_protocol: ::c_int, - pub ai_addrlen: ::socklen_t, - pub ai_addr: *mut ::sockaddr, - pub ai_canonname: *mut ::c_char, - pub ai_next: *mut ::addrinfo, - } - - pub struct Dl_info { - pub dli_fname: *const ::c_char, - pub dli_fbase: *mut ::c_void, - pub dli_sname: *const ::c_char, - pub dli_saddr: *mut ::c_void, - } - - pub struct if_data { - pub ifi_type: ::c_uchar, - pub ifi_addrlen: ::c_uchar, - pub ifi_hdrlen: ::c_uchar, - pub ifi_link_state: ::c_uchar, - pub ifi_mtu: u32, - pub ifi_metric: u32, - pub ifi_rdomain: u32, - pub ifi_baudrate: u64, - pub ifi_ipackets: u64, - pub ifi_ierrors: u64, - pub ifi_opackets: u64, - pub ifi_oerrors: u64, - pub ifi_collisions: u64, - pub ifi_ibytes: u64, - pub ifi_obytes: u64, - pub ifi_imcasts: u64, - pub ifi_omcasts: u64, - pub ifi_iqdrops: u64, - pub ifi_oqdrops: u64, - pub ifi_noproto: u64, - pub ifi_capabilities: u32, - pub ifi_lastchange: ::timeval, - } - - pub struct if_msghdr { - pub ifm_msglen: ::c_ushort, - pub ifm_version: ::c_uchar, - pub ifm_type: ::c_uchar, - pub ifm_hdrlen: ::c_ushort, - pub ifm_index: ::c_ushort, - pub ifm_tableid: ::c_ushort, - pub ifm_pad1: ::c_uchar, - pub ifm_pad2: ::c_uchar, - pub ifm_addrs: ::c_int, - pub ifm_flags: ::c_int, - pub ifm_xflags: ::c_int, - pub ifm_data: if_data, - } - - pub struct sockaddr_dl { - pub sdl_len: ::c_uchar, - pub sdl_family: ::c_uchar, - pub sdl_index: ::c_ushort, - pub sdl_type: ::c_uchar, - pub sdl_nlen: ::c_uchar, - pub sdl_alen: ::c_uchar, - pub sdl_slen: ::c_uchar, - pub sdl_data: [::c_char; 24], - } - - pub struct sockpeercred { - pub uid: ::uid_t, - pub gid: ::gid_t, - pub pid: ::pid_t, - } - - pub struct arphdr { - pub ar_hrd: u16, - pub ar_pro: u16, - pub ar_hln: u8, - pub ar_pln: u8, - pub ar_op: u16, - } -} - -s_no_extra_traits! { - pub struct dirent { - pub d_fileno: ::ino_t, - pub d_off: ::off_t, - pub d_reclen: u16, - pub d_type: u8, - pub d_namlen: u8, - __d_padding: [u8; 4], - pub d_name: [::c_char; 256], - } - - pub struct sockaddr_storage { - pub ss_len: u8, - pub ss_family: ::sa_family_t, - __ss_pad1: [u8; 6], - __ss_pad2: i64, - __ss_pad3: [u8; 240], - } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_code: ::c_int, - pub si_errno: ::c_int, - pub si_addr: *mut ::c_char, - #[cfg(target_pointer_width = "32")] - __pad: [u8; 112], - #[cfg(target_pointer_width = "64")] - __pad: [u8; 108], - } - - pub struct lastlog { - ll_time: ::time_t, - ll_line: [::c_char; UT_LINESIZE], - ll_host: [::c_char; UT_HOSTSIZE], - } - - pub struct utmp { - pub ut_line: [::c_char; UT_LINESIZE], - pub ut_name: [::c_char; UT_NAMESIZE], - pub ut_host: [::c_char; UT_HOSTSIZE], - pub ut_time: ::time_t, - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_fileno == other.d_fileno - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self.d_namlen == other.d_namlen - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for dirent {} - - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_fileno", &self.d_fileno) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - .field("d_namlen", &self.d_namlen) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_fileno.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_namlen.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for sockaddr_storage { - fn eq(&self, other: &sockaddr_storage) -> bool { - self.ss_len == other.ss_len - && self.ss_family == other.ss_family - } - } - - impl Eq for sockaddr_storage {} - - impl ::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_storage") - .field("ss_len", &self.ss_len) - .field("ss_family", &self.ss_family) - .finish() - } - } - - impl ::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { - self.ss_len.hash(state); - self.ss_family.hash(state); - } - } - - impl PartialEq for siginfo_t { - fn eq(&self, other: &siginfo_t) -> bool { - self.si_signo == other.si_signo - && self.si_code == other.si_code - && self.si_errno == other.si_errno - && self.si_addr == other.si_addr - } - } - - impl Eq for siginfo_t {} - - impl ::fmt::Debug for siginfo_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("siginfo_t") - .field("si_signo", &self.si_signo) - .field("si_code", &self.si_code) - .field("si_errno", &self.si_errno) - .field("si_addr", &self.si_addr) - .finish() - } - } - - impl ::hash::Hash for siginfo_t { - fn hash(&self, state: &mut H) { - self.si_signo.hash(state); - self.si_code.hash(state); - self.si_errno.hash(state); - self.si_addr.hash(state); - } - } - - impl PartialEq for lastlog { - fn eq(&self, other: &lastlog) -> bool { - self.ll_time == other.ll_time - && self - .ll_line - .iter() - .zip(other.ll_line.iter()) - .all(|(a,b)| a == b) - && self - .ll_host - .iter() - .zip(other.ll_host.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for lastlog {} - - impl ::fmt::Debug for lastlog { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("lastlog") - .field("ll_time", &self.ll_time) - // FIXME: .field("ll_line", &self.ll_line) - // FIXME: .field("ll_host", &self.ll_host) - .finish() - } - } - - impl ::hash::Hash for lastlog { - fn hash(&self, state: &mut H) { - self.ll_time.hash(state); - self.ll_line.hash(state); - self.ll_host.hash(state); - } - } - - impl PartialEq for utmp { - fn eq(&self, other: &utmp) -> bool { - self.ut_time == other.ut_time - && self - .ut_line - .iter() - .zip(other.ut_line.iter()) - .all(|(a,b)| a == b) - && self - .ut_name - .iter() - .zip(other.ut_name.iter()) - .all(|(a,b)| a == b) - && self - .ut_host - .iter() - .zip(other.ut_host.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for utmp {} - - impl ::fmt::Debug for utmp { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utmp") - // FIXME: .field("ut_line", &self.ut_line) - // FIXME: .field("ut_name", &self.ut_name) - // FIXME: .field("ut_host", &self.ut_host) - .field("ut_time", &self.ut_time) - .finish() - } - } - - impl ::hash::Hash for utmp { - fn hash(&self, state: &mut H) { - self.ut_line.hash(state); - self.ut_name.hash(state); - self.ut_host.hash(state); - self.ut_time.hash(state); - } - } - } -} - -pub const UT_NAMESIZE: usize = 32; -pub const UT_LINESIZE: usize = 8; -pub const UT_HOSTSIZE: usize = 256; - -pub const O_CLOEXEC: ::c_int = 0x10000; -pub const O_DIRECTORY: ::c_int = 0x20000; -pub const O_RSYNC: ::c_int = O_SYNC; - -pub const MS_SYNC : ::c_int = 0x0002; -pub const MS_INVALIDATE : ::c_int = 0x0004; - -pub const POLLNORM: ::c_short = ::POLLRDNORM; - -pub const ENOATTR : ::c_int = 83; -pub const EILSEQ : ::c_int = 84; -pub const EOVERFLOW : ::c_int = 87; -pub const ECANCELED : ::c_int = 88; -pub const EIDRM : ::c_int = 89; -pub const ENOMSG : ::c_int = 90; -pub const ENOTSUP : ::c_int = 91; -pub const EBADMSG : ::c_int = 92; -pub const ENOTRECOVERABLE : ::c_int = 93; -pub const EOWNERDEAD : ::c_int = 94; -pub const EPROTO : ::c_int = 95; -pub const ELAST : ::c_int = 95; - -pub const F_DUPFD_CLOEXEC : ::c_int = 10; - -pub const AT_FDCWD: ::c_int = -100; -pub const AT_EACCESS: ::c_int = 0x01; -pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x02; -pub const AT_SYMLINK_FOLLOW: ::c_int = 0x04; -pub const AT_REMOVEDIR: ::c_int = 0x08; - -pub const RLIM_NLIMITS: ::c_int = 9; - -pub const SO_TIMESTAMP: ::c_int = 0x0800; -pub const SO_SNDTIMEO: ::c_int = 0x1005; -pub const SO_RCVTIMEO: ::c_int = 0x1006; -pub const SO_BINDANY: ::c_int = 0x1000; -pub const SO_NETPROC: ::c_int = 0x1020; -pub const SO_RTABLE: ::c_int = 0x1021; -pub const SO_PEERCRED: ::c_int = 0x1022; -pub const SO_SPLICE: ::c_int = 0x1023; - -// sys/netinet/in.h -// Protocols (RFC 1700) -// NOTE: These are in addition to the constants defined in src/unix/mod.rs - -// IPPROTO_IP defined in src/unix/mod.rs -/// Hop-by-hop option header -pub const IPPROTO_HOPOPTS: ::c_int = 0; -// IPPROTO_ICMP defined in src/unix/mod.rs -/// group mgmt protocol -pub const IPPROTO_IGMP: ::c_int = 2; -/// gateway^2 (deprecated) -pub const IPPROTO_GGP: ::c_int = 3; -/// for compatibility -pub const IPPROTO_IPIP: ::c_int = 4; -// IPPROTO_TCP defined in src/unix/mod.rs -/// exterior gateway protocol -pub const IPPROTO_EGP: ::c_int = 8; -/// pup -pub const IPPROTO_PUP: ::c_int = 12; -// IPPROTO_UDP defined in src/unix/mod.rs -/// xns idp -pub const IPPROTO_IDP: ::c_int = 22; -/// tp-4 w/ class negotiation -pub const IPPROTO_TP: ::c_int = 29; -// IPPROTO_IPV6 defined in src/unix/mod.rs -/// IP6 routing header -pub const IPPROTO_ROUTING: ::c_int = 43; -/// IP6 fragmentation header -pub const IPPROTO_FRAGMENT: ::c_int = 44; -/// resource reservation -pub const IPPROTO_RSVP: ::c_int = 46; -/// General Routing Encap. -pub const IPPROTO_GRE: ::c_int = 47; -/// IP6 Encap Sec. Payload -pub const IPPROTO_ESP: ::c_int = 50; -/// IP6 Auth Header -pub const IPPROTO_AH: ::c_int = 51; -/// IP Mobility RFC 2004 -pub const IPPROTO_MOBILE: ::c_int = 55; -// IPPROTO_ICMPV6 defined in src/unix/mod.rs -/// IP6 no next header -pub const IPPROTO_NONE: ::c_int = 59; -/// IP6 destination option -pub const IPPROTO_DSTOPTS: ::c_int = 60; -/// ISO cnlp -pub const IPPROTO_EON: ::c_int = 80; -/// Ethernet-in-IP -pub const IPPROTO_ETHERIP: ::c_int = 97; -/// encapsulation header -pub const IPPROTO_ENCAP: ::c_int = 98; -/// Protocol indep. multicast -pub const IPPROTO_PIM: ::c_int = 103; -/// IP Payload Comp. Protocol -pub const IPPROTO_IPCOMP: ::c_int = 108; -/// CARP -pub const IPPROTO_CARP: ::c_int = 112; -/// unicast MPLS packet -pub const IPPROTO_MPLS: ::c_int = 137; -/// PFSYNC -pub const IPPROTO_PFSYNC: ::c_int = 240; -pub const IPPROTO_MAX: ::c_int = 256; - -/* Only used internally, so it can be outside the range of valid IP protocols */ -/// Divert sockets -pub const IPPROTO_DIVERT: ::c_int = 258; - -pub const IP_RECVDSTADDR: ::c_int = 7; -pub const IP_SENDSRCADDR: ::c_int = IP_RECVDSTADDR; -pub const IP_RECVIF: ::c_int = 30; - -// sys/netinet/in.h -pub const TCP_MD5SIG: ::c_int = 0x04; -pub const TCP_NOPUSH: ::c_int = 0x10; - -pub const AF_ECMA: ::c_int = 8; -pub const AF_ROUTE: ::c_int = 17; -pub const AF_ENCAP: ::c_int = 28; -pub const AF_SIP: ::c_int = 29; -pub const AF_KEY: ::c_int = 30; -pub const pseudo_AF_HDRCMPLT: ::c_int = 31; -pub const AF_BLUETOOTH: ::c_int = 32; -pub const AF_MPLS: ::c_int = 33; -pub const pseudo_AF_PFLOW: ::c_int = 34; -pub const pseudo_AF_PIPEX: ::c_int = 35; -#[doc(hidden)] -pub const AF_MAX: ::c_int = 36; - -#[doc(hidden)] -pub const NET_MAXID: ::c_int = AF_MAX; -pub const NET_RT_DUMP: ::c_int = 1; -pub const NET_RT_FLAGS: ::c_int = 2; -pub const NET_RT_IFLIST: ::c_int = 3; -pub const NET_RT_STATS: ::c_int = 4; -pub const NET_RT_TABLE: ::c_int = 5; -pub const NET_RT_IFNAMES: ::c_int = 6; -#[doc(hidden)] -pub const NET_RT_MAXID: ::c_int = 7; - -pub const IPV6_JOIN_GROUP: ::c_int = 12; -pub const IPV6_LEAVE_GROUP: ::c_int = 13; - -pub const PF_ROUTE: ::c_int = AF_ROUTE; -pub const PF_ECMA: ::c_int = AF_ECMA; -pub const PF_ENCAP: ::c_int = AF_ENCAP; -pub const PF_SIP: ::c_int = AF_SIP; -pub const PF_KEY: ::c_int = AF_KEY; -pub const PF_BPF: ::c_int = pseudo_AF_HDRCMPLT; -pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH; -pub const PF_MPLS: ::c_int = AF_MPLS; -pub const PF_PFLOW: ::c_int = pseudo_AF_PFLOW; -pub const PF_PIPEX: ::c_int = pseudo_AF_PIPEX; -#[doc(hidden)] -pub const PF_MAX: ::c_int = AF_MAX; - -pub const SCM_TIMESTAMP: ::c_int = 0x04; - -pub const O_DSYNC : ::c_int = 128; - -pub const MAP_RENAME : ::c_int = 0x0000; -pub const MAP_NORESERVE : ::c_int = 0x0000; -pub const MAP_HASSEMAPHORE : ::c_int = 0x0000; - -pub const EIPSEC : ::c_int = 82; -pub const ENOMEDIUM : ::c_int = 85; -pub const EMEDIUMTYPE : ::c_int = 86; - -pub const EAI_BADFLAGS: ::c_int = -1; -pub const EAI_NONAME: ::c_int = -2; -pub const EAI_AGAIN: ::c_int = -3; -pub const EAI_FAIL: ::c_int = -4; -pub const EAI_NODATA: ::c_int = -5; -pub const EAI_FAMILY: ::c_int = -6; -pub const EAI_SOCKTYPE: ::c_int = -7; -pub const EAI_SERVICE: ::c_int = -8; -pub const EAI_MEMORY: ::c_int = -10; -pub const EAI_SYSTEM: ::c_int = -11; -pub const EAI_OVERFLOW: ::c_int = -14; - -pub const RUSAGE_THREAD: ::c_int = 1; - -pub const MAP_COPY : ::c_int = 0x0002; -pub const MAP_NOEXTEND : ::c_int = 0x0000; - -pub const _PC_LINK_MAX : ::c_int = 1; -pub const _PC_MAX_CANON : ::c_int = 2; -pub const _PC_MAX_INPUT : ::c_int = 3; -pub const _PC_NAME_MAX : ::c_int = 4; -pub const _PC_PATH_MAX : ::c_int = 5; -pub const _PC_PIPE_BUF : ::c_int = 6; -pub const _PC_CHOWN_RESTRICTED : ::c_int = 7; -pub const _PC_NO_TRUNC : ::c_int = 8; -pub const _PC_VDISABLE : ::c_int = 9; -pub const _PC_2_SYMLINKS : ::c_int = 10; -pub const _PC_ALLOC_SIZE_MIN : ::c_int = 11; -pub const _PC_ASYNC_IO : ::c_int = 12; -pub const _PC_FILESIZEBITS : ::c_int = 13; -pub const _PC_PRIO_IO : ::c_int = 14; -pub const _PC_REC_INCR_XFER_SIZE : ::c_int = 15; -pub const _PC_REC_MAX_XFER_SIZE : ::c_int = 16; -pub const _PC_REC_MIN_XFER_SIZE : ::c_int = 17; -pub const _PC_REC_XFER_ALIGN : ::c_int = 18; -pub const _PC_SYMLINK_MAX : ::c_int = 19; -pub const _PC_SYNC_IO : ::c_int = 20; -pub const _PC_TIMESTAMP_RESOLUTION : ::c_int = 21; - -pub const _SC_CLK_TCK : ::c_int = 3; -pub const _SC_SEM_NSEMS_MAX : ::c_int = 31; -pub const _SC_SEM_VALUE_MAX : ::c_int = 32; -pub const _SC_HOST_NAME_MAX : ::c_int = 33; -pub const _SC_MONOTONIC_CLOCK : ::c_int = 34; -pub const _SC_2_PBS : ::c_int = 35; -pub const _SC_2_PBS_ACCOUNTING : ::c_int = 36; -pub const _SC_2_PBS_CHECKPOINT : ::c_int = 37; -pub const _SC_2_PBS_LOCATE : ::c_int = 38; -pub const _SC_2_PBS_MESSAGE : ::c_int = 39; -pub const _SC_2_PBS_TRACK : ::c_int = 40; -pub const _SC_ADVISORY_INFO : ::c_int = 41; -pub const _SC_AIO_LISTIO_MAX : ::c_int = 42; -pub const _SC_AIO_MAX : ::c_int = 43; -pub const _SC_AIO_PRIO_DELTA_MAX : ::c_int = 44; -pub const _SC_ASYNCHRONOUS_IO : ::c_int = 45; -pub const _SC_ATEXIT_MAX : ::c_int = 46; -pub const _SC_BARRIERS : ::c_int = 47; -pub const _SC_CLOCK_SELECTION : ::c_int = 48; -pub const _SC_CPUTIME : ::c_int = 49; -pub const _SC_DELAYTIMER_MAX : ::c_int = 50; -pub const _SC_IOV_MAX : ::c_int = 51; -pub const _SC_IPV6 : ::c_int = 52; -pub const _SC_MAPPED_FILES : ::c_int = 53; -pub const _SC_MEMLOCK : ::c_int = 54; -pub const _SC_MEMLOCK_RANGE : ::c_int = 55; -pub const _SC_MEMORY_PROTECTION : ::c_int = 56; -pub const _SC_MESSAGE_PASSING : ::c_int = 57; -pub const _SC_MQ_OPEN_MAX : ::c_int = 58; -pub const _SC_MQ_PRIO_MAX : ::c_int = 59; -pub const _SC_PRIORITIZED_IO : ::c_int = 60; -pub const _SC_PRIORITY_SCHEDULING : ::c_int = 61; -pub const _SC_RAW_SOCKETS : ::c_int = 62; -pub const _SC_READER_WRITER_LOCKS : ::c_int = 63; -pub const _SC_REALTIME_SIGNALS : ::c_int = 64; -pub const _SC_REGEXP : ::c_int = 65; -pub const _SC_RTSIG_MAX : ::c_int = 66; -pub const _SC_SEMAPHORES : ::c_int = 67; -pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 68; -pub const _SC_SHELL : ::c_int = 69; -pub const _SC_SIGQUEUE_MAX : ::c_int = 70; -pub const _SC_SPAWN : ::c_int = 71; -pub const _SC_SPIN_LOCKS : ::c_int = 72; -pub const _SC_SPORADIC_SERVER : ::c_int = 73; -pub const _SC_SS_REPL_MAX : ::c_int = 74; -pub const _SC_SYNCHRONIZED_IO : ::c_int = 75; -pub const _SC_SYMLOOP_MAX : ::c_int = 76; -pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 77; -pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 78; -pub const _SC_THREAD_CPUTIME : ::c_int = 79; -pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 80; -pub const _SC_THREAD_KEYS_MAX : ::c_int = 81; -pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 82; -pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 83; -pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 84; -pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 85; -pub const _SC_THREAD_ROBUST_PRIO_INHERIT : ::c_int = 86; -pub const _SC_THREAD_ROBUST_PRIO_PROTECT : ::c_int = 87; -pub const _SC_THREAD_SPORADIC_SERVER : ::c_int = 88; -pub const _SC_THREAD_STACK_MIN : ::c_int = 89; -pub const _SC_THREAD_THREADS_MAX : ::c_int = 90; -pub const _SC_THREADS : ::c_int = 91; -pub const _SC_TIMEOUTS : ::c_int = 92; -pub const _SC_TIMER_MAX : ::c_int = 93; -pub const _SC_TIMERS : ::c_int = 94; -pub const _SC_TRACE : ::c_int = 95; -pub const _SC_TRACE_EVENT_FILTER : ::c_int = 96; -pub const _SC_TRACE_EVENT_NAME_MAX : ::c_int = 97; -pub const _SC_TRACE_INHERIT : ::c_int = 98; -pub const _SC_TRACE_LOG : ::c_int = 99; -pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 100; -pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 101; -pub const _SC_LOGIN_NAME_MAX : ::c_int = 102; -pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 103; -pub const _SC_TRACE_NAME_MAX : ::c_int = 104; -pub const _SC_TRACE_SYS_MAX : ::c_int = 105; -pub const _SC_TRACE_USER_EVENT_MAX : ::c_int = 106; -pub const _SC_TTY_NAME_MAX : ::c_int = 107; -pub const _SC_TYPED_MEMORY_OBJECTS : ::c_int = 108; -pub const _SC_V6_ILP32_OFF32 : ::c_int = 109; -pub const _SC_V6_ILP32_OFFBIG : ::c_int = 110; -pub const _SC_V6_LP64_OFF64 : ::c_int = 111; -pub const _SC_V6_LPBIG_OFFBIG : ::c_int = 112; -pub const _SC_V7_ILP32_OFF32 : ::c_int = 113; -pub const _SC_V7_ILP32_OFFBIG : ::c_int = 114; -pub const _SC_V7_LP64_OFF64 : ::c_int = 115; -pub const _SC_V7_LPBIG_OFFBIG : ::c_int = 116; -pub const _SC_XOPEN_CRYPT : ::c_int = 117; -pub const _SC_XOPEN_ENH_I18N : ::c_int = 118; -pub const _SC_XOPEN_LEGACY : ::c_int = 119; -pub const _SC_XOPEN_REALTIME : ::c_int = 120; -pub const _SC_XOPEN_REALTIME_THREADS : ::c_int = 121; -pub const _SC_XOPEN_STREAMS : ::c_int = 122; -pub const _SC_XOPEN_UNIX : ::c_int = 123; -pub const _SC_XOPEN_UUCP : ::c_int = 124; -pub const _SC_XOPEN_VERSION : ::c_int = 125; -pub const _SC_PHYS_PAGES : ::c_int = 500; -pub const _SC_AVPHYS_PAGES : ::c_int = 501; -pub const _SC_NPROCESSORS_CONF : ::c_int = 502; -pub const _SC_NPROCESSORS_ONLN : ::c_int = 503; - -pub const FD_SETSIZE: usize = 1024; - -pub const ST_NOSUID: ::c_ulong = 2; - -pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _; -pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _; -pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _; - -pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1; -pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2; -pub const PTHREAD_MUTEX_NORMAL: ::c_int = 3; -pub const PTHREAD_MUTEX_STRICT_NP: ::c_int = 4; -pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_STRICT_NP; - -pub const EVFILT_AIO: ::int16_t = -3; -pub const EVFILT_PROC: ::int16_t = -5; -pub const EVFILT_READ: ::int16_t = -1; -pub const EVFILT_SIGNAL: ::int16_t = -6; -pub const EVFILT_TIMER: ::int16_t = -7; -pub const EVFILT_VNODE: ::int16_t = -4; -pub const EVFILT_WRITE: ::int16_t = -2; - -pub const EV_ADD: ::uint16_t = 0x1; -pub const EV_DELETE: ::uint16_t = 0x2; -pub const EV_ENABLE: ::uint16_t = 0x4; -pub const EV_DISABLE: ::uint16_t = 0x8; -pub const EV_ONESHOT: ::uint16_t = 0x10; -pub const EV_CLEAR: ::uint16_t = 0x20; -pub const EV_RECEIPT: ::uint16_t = 0x40; -pub const EV_DISPATCH: ::uint16_t = 0x80; -pub const EV_FLAG1: ::uint16_t = 0x2000; -pub const EV_ERROR: ::uint16_t = 0x4000; -pub const EV_EOF: ::uint16_t = 0x8000; -pub const EV_SYSFLAGS: ::uint16_t = 0xf000; - -pub const NOTE_LOWAT: ::uint32_t = 0x00000001; -pub const NOTE_EOF: ::uint32_t = 0x00000002; -pub const NOTE_DELETE: ::uint32_t = 0x00000001; -pub const NOTE_WRITE: ::uint32_t = 0x00000002; -pub const NOTE_EXTEND: ::uint32_t = 0x00000004; -pub const NOTE_ATTRIB: ::uint32_t = 0x00000008; -pub const NOTE_LINK: ::uint32_t = 0x00000010; -pub const NOTE_RENAME: ::uint32_t = 0x00000020; -pub const NOTE_REVOKE: ::uint32_t = 0x00000040; -pub const NOTE_TRUNCATE: ::uint32_t = 0x00000080; -pub const NOTE_EXIT: ::uint32_t = 0x80000000; -pub const NOTE_FORK: ::uint32_t = 0x40000000; -pub const NOTE_EXEC: ::uint32_t = 0x20000000; -pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff; -pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000; -pub const NOTE_TRACK: ::uint32_t = 0x00000001; -pub const NOTE_TRACKERR: ::uint32_t = 0x00000002; -pub const NOTE_CHILD: ::uint32_t = 0x00000004; - -pub const TMP_MAX : ::c_uint = 0x7fffffff; - -pub const NI_MAXHOST: ::size_t = 256; - -pub const RTLD_LOCAL: ::c_int = 0; -pub const CTL_MAXNAME: ::c_int = 12; -pub const CTLTYPE_NODE: ::c_int = 1; -pub const CTLTYPE_INT: ::c_int = 2; -pub const CTLTYPE_STRING: ::c_int = 3; -pub const CTLTYPE_QUAD: ::c_int = 4; -pub const CTLTYPE_STRUCT: ::c_int = 5; -pub const CTL_UNSPEC: ::c_int = 0; -pub const CTL_KERN: ::c_int = 1; -pub const CTL_VM: ::c_int = 2; -pub const CTL_FS: ::c_int = 3; -pub const CTL_NET: ::c_int = 4; -pub const CTL_DEBUG: ::c_int = 5; -pub const CTL_HW: ::c_int = 6; -pub const CTL_MACHDEP: ::c_int = 7; -pub const CTL_DDB: ::c_int = 9; -pub const CTL_VFS: ::c_int = 10; -pub const CTL_MAXID: ::c_int = 11; -pub const HW_NCPUONLINE: ::c_int = 25; -pub const KERN_OSTYPE: ::c_int = 1; -pub const KERN_OSRELEASE: ::c_int = 2; -pub const KERN_OSREV: ::c_int = 3; -pub const KERN_VERSION: ::c_int = 4; -pub const KERN_MAXVNODES: ::c_int = 5; -pub const KERN_MAXPROC: ::c_int = 6; -pub const KERN_MAXFILES: ::c_int = 7; -pub const KERN_ARGMAX: ::c_int = 8; -pub const KERN_SECURELVL: ::c_int = 9; -pub const KERN_HOSTNAME: ::c_int = 10; -pub const KERN_HOSTID: ::c_int = 11; -pub const KERN_CLOCKRATE: ::c_int = 12; -pub const KERN_PROF: ::c_int = 16; -pub const KERN_POSIX1: ::c_int = 17; -pub const KERN_NGROUPS: ::c_int = 18; -pub const KERN_JOB_CONTROL: ::c_int = 19; -pub const KERN_SAVED_IDS: ::c_int = 20; -pub const KERN_BOOTTIME: ::c_int = 21; -pub const KERN_DOMAINNAME: ::c_int = 22; -pub const KERN_MAXPARTITIONS: ::c_int = 23; -pub const KERN_RAWPARTITION: ::c_int = 24; -pub const KERN_MAXTHREAD: ::c_int = 25; -pub const KERN_NTHREADS: ::c_int = 26; -pub const KERN_OSVERSION: ::c_int = 27; -pub const KERN_SOMAXCONN: ::c_int = 28; -pub const KERN_SOMINCONN: ::c_int = 29; -pub const KERN_USERMOUNT: ::c_int = 30; -pub const KERN_NOSUIDCOREDUMP: ::c_int = 32; -pub const KERN_FSYNC: ::c_int = 33; -pub const KERN_SYSVMSG: ::c_int = 34; -pub const KERN_SYSVSEM: ::c_int = 35; -pub const KERN_SYSVSHM: ::c_int = 36; -pub const KERN_ARND: ::c_int = 37; -pub const KERN_MSGBUFSIZE: ::c_int = 38; -pub const KERN_MALLOCSTATS: ::c_int = 39; -pub const KERN_CPTIME: ::c_int = 40; -pub const KERN_NCHSTATS: ::c_int = 41; -pub const KERN_FORKSTAT: ::c_int = 42; -pub const KERN_NSELCOLL: ::c_int = 43; -pub const KERN_TTY: ::c_int = 44; -pub const KERN_CCPU: ::c_int = 45; -pub const KERN_FSCALE: ::c_int = 46; -pub const KERN_NPROCS: ::c_int = 47; -pub const KERN_MSGBUF: ::c_int = 48; -pub const KERN_POOL: ::c_int = 49; -pub const KERN_STACKGAPRANDOM: ::c_int = 50; -pub const KERN_SYSVIPC_INFO: ::c_int = 51; -pub const KERN_SPLASSERT: ::c_int = 54; -pub const KERN_PROC_ARGS: ::c_int = 55; -pub const KERN_NFILES: ::c_int = 56; -pub const KERN_TTYCOUNT: ::c_int = 57; -pub const KERN_NUMVNODES: ::c_int = 58; -pub const KERN_MBSTAT: ::c_int = 59; -pub const KERN_SEMINFO: ::c_int = 61; -pub const KERN_SHMINFO: ::c_int = 62; -pub const KERN_INTRCNT: ::c_int = 63; -pub const KERN_WATCHDOG: ::c_int = 64; -pub const KERN_PROC: ::c_int = 66; -pub const KERN_MAXCLUSTERS: ::c_int = 67; -pub const KERN_EVCOUNT: ::c_int = 68; -pub const KERN_TIMECOUNTER: ::c_int = 69; -pub const KERN_MAXLOCKSPERUID: ::c_int = 70; -pub const KERN_CPTIME2: ::c_int = 71; -pub const KERN_CACHEPCT: ::c_int = 72; -pub const KERN_FILE: ::c_int = 73; -pub const KERN_CONSDEV: ::c_int = 75; -pub const KERN_NETLIVELOCKS: ::c_int = 76; -pub const KERN_POOL_DEBUG: ::c_int = 77; -pub const KERN_PROC_CWD: ::c_int = 78; -pub const KERN_PROC_NOBROADCASTKILL: ::c_int = 79; -pub const KERN_PROC_VMMAP: ::c_int = 80; -pub const KERN_GLOBAL_PTRACE: ::c_int = 81; -pub const KERN_CONSBUFSIZE: ::c_int = 82; -pub const KERN_CONSBUF: ::c_int = 83; -pub const KERN_AUDIO: ::c_int = 84; -pub const KERN_CPUSTATS: ::c_int = 85; -pub const KERN_MAXID: ::c_int = 86; -pub const KERN_PROC_ALL: ::c_int = 0; -pub const KERN_PROC_PID: ::c_int = 1; -pub const KERN_PROC_PGRP: ::c_int = 2; -pub const KERN_PROC_SESSION: ::c_int = 3; -pub const KERN_PROC_TTY: ::c_int = 4; -pub const KERN_PROC_UID: ::c_int = 5; -pub const KERN_PROC_RUID: ::c_int = 6; -pub const KERN_PROC_KTHREAD: ::c_int = 7; -pub const KERN_PROC_SHOW_THREADS: ::c_int = 0x40000000; -pub const KERN_SYSVIPC_MSG_INFO: ::c_int = 1; -pub const KERN_SYSVIPC_SEM_INFO: ::c_int = 2; -pub const KERN_SYSVIPC_SHM_INFO: ::c_int = 3; -pub const KERN_PROC_ARGV: ::c_int = 1; -pub const KERN_PROC_NARGV: ::c_int = 2; -pub const KERN_PROC_ENV: ::c_int = 3; -pub const KERN_PROC_NENV: ::c_int = 4; -pub const KI_NGROUPS: ::c_int = 16; -pub const KI_MAXCOMLEN: ::c_int = 24; -pub const KI_WMESGLEN: ::c_int = 8; -pub const KI_MAXLOGNAME: ::c_int = 32; -pub const KI_EMULNAMELEN: ::c_int = 8; - -pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS; -pub const OLCUC: ::tcflag_t = 0x20; -pub const ONOCR: ::tcflag_t = 0x40; -pub const ONLRET: ::tcflag_t = 0x80; - -pub const SOCK_CLOEXEC: ::c_int = 0x8000; -pub const SOCK_NONBLOCK: ::c_int = 0x4000; -pub const SOCK_DNS: ::c_int = 0x1000; - -pub const PTRACE_FORK: ::c_int = 0x0002; - -pub const WCONTINUED: ::c_int = 8; - -f! { - pub fn WIFCONTINUED(status: ::c_int) -> bool { - status & 0o177777 == 0o177777 - } -} - -extern { - pub fn chflags(path: *const ::c_char, flags: ::c_uint) -> ::c_int; - pub fn fchflags(fd: ::c_int, flags: ::c_uint) -> ::c_int; - pub fn chflagsat(fd: ::c_int, path: *const ::c_char, flags: ::c_uint, - atflag: ::c_int) -> ::c_int; - pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; - pub fn getnameinfo(sa: *const ::sockaddr, - salen: ::socklen_t, - host: *mut ::c_char, - hostlen: ::size_t, - serv: *mut ::c_char, - servlen: ::size_t, - flags: ::c_int) -> ::c_int; - pub fn kevent(kq: ::c_int, - changelist: *const ::kevent, - nchanges: ::c_int, - eventlist: *mut ::kevent, - nevents: ::c_int, - timeout: *const ::timespec) -> ::c_int; - pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) - -> ::c_int; - pub fn pthread_main_np() -> ::c_int; - pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char); - pub fn pthread_stackseg_np(thread: ::pthread_t, - sinfo: *mut ::stack_t) -> ::c_int; - pub fn sysctl(name: *const ::c_int, - namelen: ::c_uint, - oldp: *mut ::c_void, - oldlenp: *mut ::size_t, - newp: *mut ::c_void, - newlen: ::size_t) - -> ::c_int; - pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; - pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int; - pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int; - pub fn ptrace(request: ::c_int, - pid: ::pid_t, - addr: caddr_t, - data: ::c_int) -> ::c_int; -} - -cfg_if! { - if #[cfg(target_os = "openbsd")] { - mod openbsd; - pub use self::openbsd::*; - } else if #[cfg(target_os = "bitrig")] { - mod bitrig; - pub use self::bitrig::*; - } else { - // Unknown target_os - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -pub type c_long = i64; -pub type c_ulong = u64; -pub type c_char = u8; - -// should be pub(crate), but that requires Rust 1.18.0 -cfg_if! { - if #[cfg(libc_const_size_of)] { - #[doc(hidden)] - pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; - } else { - #[doc(hidden)] - pub const _ALIGNBYTES: usize = 8 - 1; - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,497 +0,0 @@ -s! { - pub struct glob_t { - pub gl_pathc: ::size_t, - pub gl_matchc: ::size_t, - pub gl_offs: ::size_t, - pub gl_flags: ::c_int, - pub gl_pathv: *mut *mut ::c_char, - __unused1: *mut ::c_void, - __unused2: *mut ::c_void, - __unused3: *mut ::c_void, - __unused4: *mut ::c_void, - __unused5: *mut ::c_void, - __unused6: *mut ::c_void, - __unused7: *mut ::c_void, - } - - pub struct lconv { - pub decimal_point: *mut ::c_char, - pub thousands_sep: *mut ::c_char, - pub grouping: *mut ::c_char, - pub int_curr_symbol: *mut ::c_char, - pub currency_symbol: *mut ::c_char, - pub mon_decimal_point: *mut ::c_char, - pub mon_thousands_sep: *mut ::c_char, - pub mon_grouping: *mut ::c_char, - pub positive_sign: *mut ::c_char, - pub negative_sign: *mut ::c_char, - pub int_frac_digits: ::c_char, - pub frac_digits: ::c_char, - pub p_cs_precedes: ::c_char, - pub p_sep_by_space: ::c_char, - pub n_cs_precedes: ::c_char, - pub n_sep_by_space: ::c_char, - pub p_sign_posn: ::c_char, - pub n_sign_posn: ::c_char, - pub int_p_cs_precedes: ::c_char, - pub int_p_sep_by_space: ::c_char, - pub int_n_cs_precedes: ::c_char, - pub int_n_sep_by_space: ::c_char, - pub int_p_sign_posn: ::c_char, - pub int_n_sign_posn: ::c_char, - } - - pub struct ufs_args { - pub fspec: *mut ::c_char, - pub export_info: export_args, - } - - pub struct mfs_args { - pub fspec: *mut ::c_char, - pub export_info: export_args, - // https://github.com/openbsd/src/blob/master/sys/sys/types.h#L134 - pub base: *mut ::c_char, - pub size: ::c_ulong, - } - - pub struct iso_args { - pub fspec: *mut ::c_char, - pub export_info: export_args, - pub flags: ::c_int, - pub sess: ::c_int, - } - - pub struct nfs_args { - pub version: ::c_int, - pub addr: *mut ::sockaddr, - pub addrlen: ::c_int, - pub sotype: ::c_int, - pub proto: ::c_int, - pub fh: *mut ::c_uchar, - pub fhsize: ::c_int, - pub flags: ::c_int, - pub wsize: ::c_int, - pub rsize: ::c_int, - pub readdirsize: ::c_int, - pub timeo: ::c_int, - pub retrans: ::c_int, - pub maxgrouplist: ::c_int, - pub readahead: ::c_int, - pub leaseterm: ::c_int, - pub deadthresh: ::c_int, - pub hostname: *mut ::c_char, - pub acregmin: ::c_int, - pub acregmax: ::c_int, - pub acdirmin: ::c_int, - pub acdirmax: ::c_int, - } - - pub struct msdosfs_args { - pub fspec: *mut ::c_char, - pub export_info: export_args, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub mask: ::mode_t, - pub flags: ::c_int, - } - - pub struct ntfs_args { - pub fspec: *mut ::c_char, - pub export_info: export_args, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub mode: ::mode_t, - pub flag: ::c_ulong, - } - - pub struct udf_args { - pub fspec: *mut ::c_char, - pub lastblock: ::uint32_t, - } - - pub struct tmpfs_args { - pub ta_version: ::c_int, - pub ta_nodes_max: ::ino_t, - pub ta_size_max: ::off_t, - pub ta_root_uid: ::uid_t, - pub ta_root_gid: ::gid_t, - pub ta_root_mode: ::mode_t, - } - - pub struct fusefs_args { - pub name: *mut ::c_char, - pub fd: ::c_int, - pub max_read: ::c_int, - pub allow_other: ::c_int, - } - - pub struct xucred { - pub cr_uid: ::uid_t, - pub cr_gid: ::gid_t, - pub cr_ngroups: ::c_short, - //https://github.com/openbsd/src/blob/master/sys/sys/syslimits.h#L44 - pub cr_groups: [::gid_t; 16], - } - - pub struct export_args { - pub ex_flags: ::c_int, - pub ex_root: ::uid_t, - pub ex_anon: xucred, - pub ex_addr: *mut ::sockaddr, - pub ex_addrlen: ::c_int, - pub ex_mask: *mut ::sockaddr, - pub ex_masklen: ::c_int, - } -} - -s_no_extra_traits! { - pub union mount_info { - pub ufs_args: ufs_args, - pub mfs_args: mfs_args, - pub nfs_args: nfs_args, - pub iso_args: iso_args, - pub msdosfs_args: msdosfs_args, - pub ntfs_args: ntfs_args, - pub tmpfs_args: tmpfs_args, - align: [::c_char; 160], - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for mount_info { - fn eq(&self, other: &mount_info) -> bool { - unsafe { - self.align - .iter() - .zip(other.align.iter()) - .all(|(a,b)| a == b) - } - } - } - - impl Eq for mount_info { } - - impl ::fmt::Debug for mount_info { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("mount_info") - // FIXME: .field("align", &self.align) - .finish() - } - } - - impl ::hash::Hash for mount_info { - fn hash(&self, state: &mut H) { - unsafe { self.align.hash(state) }; - } - } - } -} - -cfg_if! { - if #[cfg(libc_union)] { - s_no_extra_traits! { - // This type uses the union mount_info: - pub struct statfs { - pub f_flags: ::uint32_t, - pub f_bsize: ::uint32_t, - pub f_iosize: ::uint32_t, - pub f_blocks: ::uint64_t, - pub f_bfree: ::uint64_t, - pub f_bavail: ::int64_t, - pub f_files: ::uint64_t, - pub f_ffree: ::uint64_t, - pub f_favail: ::int64_t, - pub f_syncwrites: ::uint64_t, - pub f_syncreads: ::uint64_t, - pub f_asyncwrites: ::uint64_t, - pub f_asyncreads: ::uint64_t, - pub f_fsid: ::fsid_t, - pub f_namemax: ::uint32_t, - pub f_owner: ::uid_t, - pub f_ctime: ::uint64_t, - pub f_fstypename: [::c_char; 16], - pub f_mntonname: [::c_char; 90], - pub f_mntfromname: [::c_char; 90], - pub f_mntfromspec: [::c_char; 90], - pub mount_info: mount_info, - } - } - - cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for statfs { - fn eq(&self, other: &statfs) -> bool { - self.f_flags == other.f_flags - && self.f_bsize == other.f_bsize - && self.f_iosize == other.f_iosize - && self.f_blocks == other.f_blocks - && self.f_bfree == other.f_bfree - && self.f_bavail == other.f_bavail - && self.f_files == other.f_files - && self.f_ffree == other.f_ffree - && self.f_favail == other.f_favail - && self.f_syncwrites == other.f_syncwrites - && self.f_syncreads == other.f_syncreads - && self.f_asyncwrites == other.f_asyncwrites - && self.f_asyncreads == other.f_asyncreads - && self.f_fsid == other.f_fsid - && self.f_namemax == other.f_namemax - && self.f_owner == other.f_owner - && self.f_ctime == other.f_ctime - && self.f_fstypename - .iter() - .zip(other.f_fstypename.iter()) - .all(|(a,b)| a == b) - && self.f_mntonname - .iter() - .zip(other.f_mntonname.iter()) - .all(|(a,b)| a == b) - && self.f_mntfromname - .iter() - .zip(other.f_mntfromname.iter()) - .all(|(a,b)| a == b) - && self.f_mntfromspec - .iter() - .zip(other.f_mntfromspec.iter()) - .all(|(a,b)| a == b) - && self.mount_info == other.mount_info - } - } - - impl Eq for statfs { } - - impl ::fmt::Debug for statfs { - fn fmt(&self, f: &mut ::fmt::Formatter) - -> ::fmt::Result { - f.debug_struct("statfs") - .field("f_flags", &self.f_flags) - .field("f_bsize", &self.f_bsize) - .field("f_iosize", &self.f_iosize) - .field("f_blocks", &self.f_blocks) - .field("f_bfree", &self.f_bfree) - .field("f_bavail", &self.f_bavail) - .field("f_files", &self.f_files) - .field("f_ffree", &self.f_ffree) - .field("f_favail", &self.f_favail) - .field("f_syncwrites", &self.f_syncwrites) - .field("f_syncreads", &self.f_syncreads) - .field("f_asyncwrites", &self.f_asyncwrites) - .field("f_asyncreads", &self.f_asyncreads) - .field("f_fsid", &self.f_fsid) - .field("f_namemax", &self.f_namemax) - .field("f_owner", &self.f_owner) - .field("f_ctime", &self.f_ctime) - // FIXME: .field("f_fstypename", &self.f_fstypename) - // FIXME: .field("f_mntonname", &self.f_mntonname) - // FIXME: .field("f_mntfromname", &self.f_mntfromname) - // FIXME: .field("f_mntfromspec", &self.f_mntfromspec) - .field("mount_info", &self.mount_info) - .finish() - } - } - - impl ::hash::Hash for statfs { - fn hash(&self, state: &mut H) { - self.f_flags.hash(state); - self.f_bsize.hash(state); - self.f_iosize.hash(state); - self.f_blocks.hash(state); - self.f_bfree.hash(state); - self.f_bavail.hash(state); - self.f_files.hash(state); - self.f_ffree.hash(state); - self.f_favail.hash(state); - self.f_syncwrites.hash(state); - self.f_syncreads.hash(state); - self.f_asyncwrites.hash(state); - self.f_asyncreads.hash(state); - self.f_fsid.hash(state); - self.f_namemax.hash(state); - self.f_owner.hash(state); - self.f_ctime.hash(state); - self.f_fstypename.hash(state); - self.f_mntonname.hash(state); - self.f_mntfromname.hash(state); - self.f_mntfromspec.hash(state); - self.mount_info.hash(state); - } - } - } - } - } -} - -//https://github.com/openbsd/src/blob/master/sys/sys/mount.h -pub const ISOFSMNT_NORRIP: ::c_int = 0x1; // disable Rock Ridge Ext -pub const ISOFSMNT_GENS: ::c_int = 0x2; // enable generation numbers -pub const ISOFSMNT_EXTATT: ::c_int = 0x4; // enable extended attr -pub const ISOFSMNT_NOJOLIET: ::c_int = 0x8; // disable Joliet Ext -pub const ISOFSMNT_SESS: ::c_int = 0x10; // use iso_args.sess - -pub const NFS_ARGSVERSION: ::c_int = 4; // change when nfs_args changes - -pub const NFSMNT_RESVPORT: ::c_int = 0; // always use reserved ports -pub const NFSMNT_SOFT: ::c_int = 0x1; // soft mount (hard is default) -pub const NFSMNT_WSIZE: ::c_int = 0x2; // set write size -pub const NFSMNT_RSIZE: ::c_int = 0x4; // set read size -pub const NFSMNT_TIMEO: ::c_int = 0x8; // set initial timeout -pub const NFSMNT_RETRANS: ::c_int = 0x10; // set number of request retries -pub const NFSMNT_MAXGRPS: ::c_int = 0x20; // set maximum grouplist size -pub const NFSMNT_INT: ::c_int = 0x40; // allow interrupts on hard mount -pub const NFSMNT_NOCONN: ::c_int = 0x80; // Don't Connect the socket -pub const NFSMNT_NQNFS: ::c_int = 0x100; // Use Nqnfs protocol -pub const NFSMNT_NFSV3: ::c_int = 0x200; // Use NFS Version 3 protocol -pub const NFSMNT_KERB: ::c_int = 0x400; // Use Kerberos authentication -pub const NFSMNT_DUMBTIMR: ::c_int = 0x800; // Don't estimate rtt dynamically -pub const NFSMNT_LEASETERM: ::c_int = 0x1000; // set lease term (nqnfs) -pub const NFSMNT_READAHEAD: ::c_int = 0x2000; // set read ahead -pub const NFSMNT_DEADTHRESH: ::c_int = 0x4000; // set dead server retry thresh -pub const NFSMNT_NOAC: ::c_int = 0x8000; // disable attribute cache -pub const NFSMNT_RDIRPLUS: ::c_int = 0x10000; // Use Readdirplus for V3 -pub const NFSMNT_READDIRSIZE: ::c_int = 0x20000; // Set readdir size - -/* Flags valid only in mount syscall arguments */ -pub const NFSMNT_ACREGMIN: ::c_int = 0x40000; // acregmin field valid -pub const NFSMNT_ACREGMAX: ::c_int = 0x80000; // acregmax field valid -pub const NFSMNT_ACDIRMIN: ::c_int = 0x100000; // acdirmin field valid -pub const NFSMNT_ACDIRMAX: ::c_int = 0x200000; // acdirmax field valid - -/* Flags valid only in kernel */ -pub const NFSMNT_INTERNAL: ::c_int = 0xfffc0000; // Bits set internally -pub const NFSMNT_HASWRITEVERF: ::c_int = 0x40000; // Has write verifier for V3 -pub const NFSMNT_GOTPATHCONF: ::c_int = 0x80000; // Got the V3 pathconf info -pub const NFSMNT_GOTFSINFO: ::c_int = 0x100000; // Got the V3 fsinfo -pub const NFSMNT_MNTD: ::c_int = 0x200000; // Mnt server for mnt point -pub const NFSMNT_DISMINPROG: ::c_int = 0x400000; // Dismount in progress -pub const NFSMNT_DISMNT: ::c_int = 0x800000; // Dismounted -pub const NFSMNT_SNDLOCK: ::c_int = 0x1000000; // Send socket lock -pub const NFSMNT_WANTSND: ::c_int = 0x2000000; // Want above -pub const NFSMNT_RCVLOCK: ::c_int = 0x4000000; // Rcv socket lock -pub const NFSMNT_WANTRCV: ::c_int = 0x8000000; // Want above -pub const NFSMNT_WAITAUTH: ::c_int = 0x10000000; // Wait for authentication -pub const NFSMNT_HASAUTH: ::c_int = 0x20000000; // Has authenticator -pub const NFSMNT_WANTAUTH: ::c_int = 0x40000000; // Wants an authenticator -pub const NFSMNT_AUTHERR: ::c_int = 0x80000000; // Authentication error - -pub const MSDOSFSMNT_SHORTNAME: ::c_int = 0x1; // Force old DOS short names only -pub const MSDOSFSMNT_LONGNAME: ::c_int = 0x2; // Force Win'95 long names -pub const MSDOSFSMNT_NOWIN95: ::c_int = 0x4; // Completely ignore Win95 entries - -pub const NTFS_MFLAG_CASEINS: ::c_int = 0x1; -pub const NTFS_MFLAG_ALLNAMES: ::c_int = 0x2; - -pub const TMPFS_ARGS_VERSION: ::c_int = 1; - -pub const MAP_STACK : ::c_int = 0x4000; - -// https://github.com/openbsd/src/blob/master/sys/net/if.h#L187 -pub const IFF_UP: ::c_int = 0x1; // interface is up -pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid -pub const IFF_DEBUG: ::c_int = 0x4; // turn on debugging -pub const IFF_LOOPBACK: ::c_int = 0x8; // is a loopback net -pub const IFF_POINTOPOINT: ::c_int = 0x10; // interface is point-to-point link -pub const IFF_STATICARP: ::c_int = 0x20; // only static ARP -pub const IFF_RUNNING: ::c_int = 0x40; // resources allocated -pub const IFF_NOARP: ::c_int = 0x80; // no address resolution protocol -pub const IFF_PROMISC: ::c_int = 0x100; // receive all packets -pub const IFF_ALLMULTI: ::c_int = 0x200; // receive all multicast packets -pub const IFF_OACTIVE: ::c_int = 0x400; // transmission in progress -pub const IFF_SIMPLEX: ::c_int = 0x800; // can't hear own transmissions -pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit -pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit -pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit -pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast - -pub const PTHREAD_STACK_MIN : ::size_t = 4096; -pub const SIGSTKSZ : ::size_t = 28672; - -pub const PT_FIRSTMACH: ::c_int = 32; - -fn _ALIGN(p: usize) -> usize { - (p + _ALIGNBYTES) & !_ALIGNBYTES -} - -f! { - pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar { - (cmsg as *mut ::c_uchar) - .offset(_ALIGN(::mem::size_of::<::cmsghdr>()) as isize) - } - - pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint { - _ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length - } - - pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr) - -> *mut ::cmsghdr - { - if cmsg.is_null() { - return ::CMSG_FIRSTHDR(mhdr); - }; - let next = cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize) - + _ALIGN(::mem::size_of::<::cmsghdr>()); - let max = (*mhdr).msg_control as usize - + (*mhdr).msg_controllen as usize; - if next > max { - 0 as *mut ::cmsghdr - } else { - (cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)) - as *mut ::cmsghdr - } - } - - pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { - (_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize)) - as ::c_uint - } - - pub fn WSTOPSIG(status: ::c_int) -> ::c_int { - status >> 8 - } - - pub fn WIFSIGNALED(status: ::c_int) -> bool { - (status & 0o177) != 0o177 && (status & 0o177) != 0 - } - - pub fn WIFSTOPPED(status: ::c_int) -> bool { - (status & 0o177) == 0o177 - } -} - -extern { - pub fn accept4(s: ::c_int, addr: *mut ::sockaddr, - addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int; - pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char, - envp: *const *const ::c_char) -> ::c_int; - pub fn pledge(promises: *const ::c_char, - execpromises: *const ::c_char) -> ::c_int; - pub fn strtonum(nptr: *const ::c_char, minval: ::c_longlong, - maxval: ::c_longlong, - errstr: *mut *const ::c_char) -> ::c_longlong; - pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int; -} - -cfg_if! { - if #[cfg(libc_union)] { - extern { - // these functions use statfs which uses the union mount_info: - pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; - pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; - } - } -} - -cfg_if! { - if #[cfg(target_arch = "x86")] { - mod x86; - pub use self::x86::*; - } else if #[cfg(target_arch = "x86_64")] { - mod x86_64; - pub use self::x86_64::*; - } else if #[cfg(target_arch = "aarch64")] { - mod aarch64; - pub use self::aarch64::*; - } else { - // Unknown target_arch - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -use PT_FIRSTMACH; - -pub type c_long = i64; -pub type c_ulong = u64; -pub type c_char = i8; - -// should be pub(crate), but that requires Rust 1.18.0 -cfg_if! { - if #[cfg(libc_const_size_of)] { - #[doc(hidden)] - pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; - } else { - #[doc(hidden)] - pub const _ALIGNBYTES: usize = 8 - 1; - } -} - -pub const PT_STEP: ::c_int = PT_FIRSTMACH + 0; -pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1; -pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2; -pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3; -pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4; diff -Nru cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs --- cargo-0.35.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -pub type c_long = i32; -pub type c_ulong = u32; -pub type c_char = i8; - -// should be pub(crate), but that requires Rust 1.18.0 -cfg_if! { - if #[cfg(libc_const_size_of)] { - #[doc(hidden)] - pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1; - } else { - #[doc(hidden)] - pub const _ALIGNBYTES: usize = 4 - 1; - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/haiku/mod.rs cargo-0.37.0/vendor/libc/src/unix/haiku/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/haiku/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/haiku/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -287,14 +287,6 @@ sa_userdata: *mut ::c_void, } - pub struct sigevent { - pub sigev_notify: ::c_int, - pub sigev_signo: ::c_int, - pub sigev_value: ::sigval, - __unused1: *mut ::c_void, // actually a function pointer - pub sigev_notify_attributes: *mut ::pthread_attr_t, - } - pub struct sem_t { pub se_type: i32, pub se_named_id: i32, // this is actually a union @@ -329,6 +321,14 @@ pub d_reclen: ::c_ushort, pub d_name: [::c_char; 1024], // Max length is _POSIX_PATH_MAX } + + pub struct sigevent { + pub sigev_notify: ::c_int, + pub sigev_signo: ::c_int, + pub sigev_value: ::sigval, + __unused1: *mut ::c_void, // actually a function pointer + pub sigev_notify_attributes: *mut ::pthread_attr_t, + } } cfg_if! { @@ -438,6 +438,36 @@ self.d_name.hash(state); } } + + impl PartialEq for sigevent { + fn eq(&self, other: &sigevent) -> bool { + self.sigev_notify == other.sigev_notify + && self.sigev_signo == other.sigev_signo + && self.sigev_value == other.sigev_value + && self.sigev_notify_attributes + == other.sigev_notify_attributes + } + } + impl Eq for sigevent {} + impl ::fmt::Debug for sigevent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sigevent") + .field("sigev_notify", &self.sigev_notify) + .field("sigev_signo", &self.sigev_signo) + .field("sigev_value", &self.sigev_value) + .field("sigev_notify_attributes", + &self.sigev_notify_attributes) + .finish() + } + } + impl ::hash::Hash for sigevent { + fn hash(&self, state: &mut H) { + self.sigev_notify.hash(state); + self.sigev_signo.hash(state); + self.sigev_value.hash(state); + self.sigev_notify_attributes.hash(state); + } + } } } @@ -770,7 +800,6 @@ pub const AF_LOCAL: ::c_int = 9; pub const AF_UNIX: ::c_int = AF_LOCAL; pub const AF_BLUETOOTH: ::c_int = 10; -pub const AF_MAX: ::c_int = 11; pub const IP_OPTIONS: ::c_int = 1; pub const IP_HDRINCL: ::c_int = 2; @@ -1147,6 +1176,31 @@ pub const TCOFLUSH: ::c_int = 0x02; pub const TCIOFLUSH: ::c_int = 0x03; +pub const TCGETA: ::c_int = 0x8000; +pub const TCSETA: ::c_int = TCGETA + 1; +pub const TCSETAF: ::c_int = TCGETA + 2; +pub const TCSETAW: ::c_int = TCGETA + 3; +pub const TCWAITEVENT: ::c_int = TCGETA + 4; +pub const TCSBRK: ::c_int = TCGETA + 5; +pub const TCFLSH: ::c_int = TCGETA + 6; +pub const TCXONC: ::c_int = TCGETA + 7; +pub const TCQUERYCONNECTED: ::c_int = TCGETA + 8; +pub const TCGETBITS: ::c_int = TCGETA + 9; +pub const TCSETDTR: ::c_int = TCGETA + 10; +pub const TCSETRTS: ::c_int = TCGETA + 11; +pub const TIOCGWINSZ: ::c_int = TCGETA + 12; +pub const TIOCSWINSZ: ::c_int = TCGETA + 13; +pub const TCVTIME: ::c_int = TCGETA + 14; +pub const TIOCGPGRP: ::c_int = TCGETA + 15; +pub const TIOCSPGRP: ::c_int = TCGETA + 16; +pub const TIOCSCTTY: ::c_int = TCGETA + 17; +pub const TIOCMGET: ::c_int = TCGETA + 18; +pub const TIOCMSET: ::c_int = TCGETA + 19; +pub const TIOCSBRK: ::c_int = TCGETA + 20; +pub const TIOCCBRK: ::c_int = TCGETA + 21; +pub const TIOCMBIS: ::c_int = TCGETA + 22; +pub const TIOCMBIC: ::c_int = TCGETA + 23; + f! { pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { let fd = fd as usize; @@ -1209,6 +1263,12 @@ } extern { + pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; + pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; + pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, + buflen: ::size_t) -> ::c_int; + pub fn _errnop() -> *mut ::c_int; + pub fn abs(i: ::c_int) -> ::c_int; pub fn atof(s: *const ::c_char) -> ::c_double; pub fn labs(i: ::c_long) -> ::c_long; @@ -1264,7 +1324,8 @@ errno: ::c_int) -> ::c_int>, pglob: *mut ::glob_t) -> ::c_int; pub fn globfree(pglob: *mut ::glob_t); - + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::c_void) -> ::c_int; pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int; diff -Nru cargo-0.35.0/vendor/libc/src/unix/hermit/mod.rs cargo-0.37.0/vendor/libc/src/unix/hermit/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/hermit/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/hermit/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -964,6 +964,11 @@ } extern { + pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; + pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; + pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, + buflen: ::size_t) -> ::c_int; + pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, @@ -981,6 +986,8 @@ pub fn clock_gettime(clock_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::c_void) -> ::c_int; pub fn getpwuid_r(uid: ::uid_t, pwd: *mut passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd) -> ::c_int; diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/android/b32/arm.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/android/b32/arm.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/android/b32/arm.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/android/b32/arm.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,357 @@ +pub type c_char = u8; +pub type wchar_t = u32; + +pub const O_DIRECT: ::c_int = 0x10000; +pub const O_DIRECTORY: ::c_int = 0x4000; +pub const O_NOFOLLOW: ::c_int = 0x8000; +pub const O_LARGEFILE: ::c_int = 0o400000; + +pub const SYS_restart_syscall: ::c_long = 0; +pub const SYS_exit: ::c_long = 1; +pub const SYS_fork: ::c_long = 2; +pub const SYS_read: ::c_long = 3; +pub const SYS_write: ::c_long = 4; +pub const SYS_open: ::c_long = 5; +pub const SYS_close: ::c_long = 6; +pub const SYS_creat: ::c_long = 8; +pub const SYS_link: ::c_long = 9; +pub const SYS_unlink: ::c_long = 10; +pub const SYS_execve: ::c_long = 11; +pub const SYS_chdir: ::c_long = 12; +pub const SYS_mknod: ::c_long = 14; +pub const SYS_chmod: ::c_long = 15; +pub const SYS_lchown: ::c_long = 16; +pub const SYS_lseek: ::c_long = 19; +pub const SYS_getpid: ::c_long = 20; +pub const SYS_mount: ::c_long = 21; +pub const SYS_setuid: ::c_long = 23; +pub const SYS_getuid: ::c_long = 24; +pub const SYS_ptrace: ::c_long = 26; +pub const SYS_pause: ::c_long = 29; +pub const SYS_access: ::c_long = 33; +pub const SYS_nice: ::c_long = 34; +pub const SYS_sync: ::c_long = 36; +pub const SYS_kill: ::c_long = 37; +pub const SYS_rename: ::c_long = 38; +pub const SYS_mkdir: ::c_long = 39; +pub const SYS_rmdir: ::c_long = 40; +pub const SYS_dup: ::c_long = 41; +pub const SYS_pipe: ::c_long = 42; +pub const SYS_times: ::c_long = 43; +pub const SYS_brk: ::c_long = 45; +pub const SYS_setgid: ::c_long = 46; +pub const SYS_getgid: ::c_long = 47; +pub const SYS_geteuid: ::c_long = 49; +pub const SYS_getegid: ::c_long = 50; +pub const SYS_acct: ::c_long = 51; +pub const SYS_umount2: ::c_long = 52; +pub const SYS_ioctl: ::c_long = 54; +pub const SYS_fcntl: ::c_long = 55; +pub const SYS_setpgid: ::c_long = 57; +pub const SYS_umask: ::c_long = 60; +pub const SYS_chroot: ::c_long = 61; +pub const SYS_ustat: ::c_long = 62; +pub const SYS_dup2: ::c_long = 63; +pub const SYS_getppid: ::c_long = 64; +pub const SYS_getpgrp: ::c_long = 65; +pub const SYS_setsid: ::c_long = 66; +pub const SYS_sigaction: ::c_long = 67; +pub const SYS_setreuid: ::c_long = 70; +pub const SYS_setregid: ::c_long = 71; +pub const SYS_sigsuspend: ::c_long = 72; +pub const SYS_sigpending: ::c_long = 73; +pub const SYS_sethostname: ::c_long = 74; +pub const SYS_setrlimit: ::c_long = 75; +pub const SYS_getrusage: ::c_long = 77; +pub const SYS_gettimeofday: ::c_long = 78; +pub const SYS_settimeofday: ::c_long = 79; +pub const SYS_getgroups: ::c_long = 80; +pub const SYS_setgroups: ::c_long = 81; +pub const SYS_symlink: ::c_long = 83; +pub const SYS_readlink: ::c_long = 85; +pub const SYS_uselib: ::c_long = 86; +pub const SYS_swapon: ::c_long = 87; +pub const SYS_reboot: ::c_long = 88; +pub const SYS_munmap: ::c_long = 91; +pub const SYS_truncate: ::c_long = 92; +pub const SYS_ftruncate: ::c_long = 93; +pub const SYS_fchmod: ::c_long = 94; +pub const SYS_fchown: ::c_long = 95; +pub const SYS_getpriority: ::c_long = 96; +pub const SYS_setpriority: ::c_long = 97; +pub const SYS_statfs: ::c_long = 99; +pub const SYS_fstatfs: ::c_long = 100; +pub const SYS_syslog: ::c_long = 103; +pub const SYS_setitimer: ::c_long = 104; +pub const SYS_getitimer: ::c_long = 105; +pub const SYS_stat: ::c_long = 106; +pub const SYS_lstat: ::c_long = 107; +pub const SYS_fstat: ::c_long = 108; +pub const SYS_vhangup: ::c_long = 111; +pub const SYS_wait4: ::c_long = 114; +pub const SYS_swapoff: ::c_long = 115; +pub const SYS_sysinfo: ::c_long = 116; +pub const SYS_fsync: ::c_long = 118; +pub const SYS_sigreturn: ::c_long = 119; +pub const SYS_clone: ::c_long = 120; +pub const SYS_setdomainname: ::c_long = 121; +pub const SYS_uname: ::c_long = 122; +pub const SYS_adjtimex: ::c_long = 124; +pub const SYS_mprotect: ::c_long = 125; +pub const SYS_sigprocmask: ::c_long = 126; +pub const SYS_init_module: ::c_long = 128; +pub const SYS_delete_module: ::c_long = 129; +pub const SYS_quotactl: ::c_long = 131; +pub const SYS_getpgid: ::c_long = 132; +pub const SYS_fchdir: ::c_long = 133; +pub const SYS_bdflush: ::c_long = 134; +pub const SYS_sysfs: ::c_long = 135; +pub const SYS_personality: ::c_long = 136; +pub const SYS_setfsuid: ::c_long = 138; +pub const SYS_setfsgid: ::c_long = 139; +pub const SYS_getdents: ::c_long = 141; +pub const SYS_flock: ::c_long = 143; +pub const SYS_msync: ::c_long = 144; +pub const SYS_readv: ::c_long = 145; +pub const SYS_writev: ::c_long = 146; +pub const SYS_getsid: ::c_long = 147; +pub const SYS_fdatasync: ::c_long = 148; +pub const SYS_mlock: ::c_long = 150; +pub const SYS_munlock: ::c_long = 151; +pub const SYS_mlockall: ::c_long = 152; +pub const SYS_munlockall: ::c_long = 153; +pub const SYS_sched_setparam: ::c_long = 154; +pub const SYS_sched_getparam: ::c_long = 155; +pub const SYS_sched_setscheduler: ::c_long = 156; +pub const SYS_sched_getscheduler: ::c_long = 157; +pub const SYS_sched_yield: ::c_long = 158; +pub const SYS_sched_get_priority_max: ::c_long = 159; +pub const SYS_sched_get_priority_min: ::c_long = 160; +pub const SYS_sched_rr_get_interval: ::c_long = 161; +pub const SYS_nanosleep: ::c_long = 162; +pub const SYS_mremap: ::c_long = 163; +pub const SYS_setresuid: ::c_long = 164; +pub const SYS_getresuid: ::c_long = 165; +pub const SYS_poll: ::c_long = 168; +pub const SYS_nfsservctl: ::c_long = 169; +pub const SYS_setresgid: ::c_long = 170; +pub const SYS_getresgid: ::c_long = 171; +pub const SYS_prctl: ::c_long = 172; +pub const SYS_rt_sigreturn: ::c_long = 173; +pub const SYS_rt_sigaction: ::c_long = 174; +pub const SYS_rt_sigprocmask: ::c_long = 175; +pub const SYS_rt_sigpending: ::c_long = 176; +pub const SYS_rt_sigtimedwait: ::c_long = 177; +pub const SYS_rt_sigqueueinfo: ::c_long = 178; +pub const SYS_rt_sigsuspend: ::c_long = 179; +pub const SYS_pread64: ::c_long = 180; +pub const SYS_pwrite64: ::c_long = 181; +pub const SYS_chown: ::c_long = 182; +pub const SYS_getcwd: ::c_long = 183; +pub const SYS_capget: ::c_long = 184; +pub const SYS_capset: ::c_long = 185; +pub const SYS_sigaltstack: ::c_long = 186; +pub const SYS_sendfile: ::c_long = 187; +pub const SYS_vfork: ::c_long = 190; +pub const SYS_ugetrlimit: ::c_long = 191; +pub const SYS_mmap2: ::c_long = 192; +pub const SYS_truncate64: ::c_long = 193; +pub const SYS_ftruncate64: ::c_long = 194; +pub const SYS_stat64: ::c_long = 195; +pub const SYS_lstat64: ::c_long = 196; +pub const SYS_fstat64: ::c_long = 197; +pub const SYS_lchown32: ::c_long = 198; +pub const SYS_getuid32: ::c_long = 199; +pub const SYS_getgid32: ::c_long = 200; +pub const SYS_geteuid32: ::c_long = 201; +pub const SYS_getegid32: ::c_long = 202; +pub const SYS_setreuid32: ::c_long = 203; +pub const SYS_setregid32: ::c_long = 204; +pub const SYS_getgroups32: ::c_long = 205; +pub const SYS_setgroups32: ::c_long = 206; +pub const SYS_fchown32: ::c_long = 207; +pub const SYS_setresuid32: ::c_long = 208; +pub const SYS_getresuid32: ::c_long = 209; +pub const SYS_setresgid32: ::c_long = 210; +pub const SYS_getresgid32: ::c_long = 211; +pub const SYS_chown32: ::c_long = 212; +pub const SYS_setuid32: ::c_long = 213; +pub const SYS_setgid32: ::c_long = 214; +pub const SYS_setfsuid32: ::c_long = 215; +pub const SYS_setfsgid32: ::c_long = 216; +pub const SYS_getdents64: ::c_long = 217; +pub const SYS_pivot_root: ::c_long = 218; +pub const SYS_mincore: ::c_long = 219; +pub const SYS_madvise: ::c_long = 220; +pub const SYS_fcntl64: ::c_long = 221; +pub const SYS_gettid: ::c_long = 224; +pub const SYS_readahead: ::c_long = 225; +pub const SYS_setxattr: ::c_long = 226; +pub const SYS_lsetxattr: ::c_long = 227; +pub const SYS_fsetxattr: ::c_long = 228; +pub const SYS_getxattr: ::c_long = 229; +pub const SYS_lgetxattr: ::c_long = 230; +pub const SYS_fgetxattr: ::c_long = 231; +pub const SYS_listxattr: ::c_long = 232; +pub const SYS_llistxattr: ::c_long = 233; +pub const SYS_flistxattr: ::c_long = 234; +pub const SYS_removexattr: ::c_long = 235; +pub const SYS_lremovexattr: ::c_long = 236; +pub const SYS_fremovexattr: ::c_long = 237; +pub const SYS_tkill: ::c_long = 238; +pub const SYS_sendfile64: ::c_long = 239; +pub const SYS_futex: ::c_long = 240; +pub const SYS_sched_setaffinity: ::c_long = 241; +pub const SYS_sched_getaffinity: ::c_long = 242; +pub const SYS_io_setup: ::c_long = 243; +pub const SYS_io_destroy: ::c_long = 244; +pub const SYS_io_getevents: ::c_long = 245; +pub const SYS_io_submit: ::c_long = 246; +pub const SYS_io_cancel: ::c_long = 247; +pub const SYS_exit_group: ::c_long = 248; +pub const SYS_lookup_dcookie: ::c_long = 249; +pub const SYS_epoll_create: ::c_long = 250; +pub const SYS_epoll_ctl: ::c_long = 251; +pub const SYS_epoll_wait: ::c_long = 252; +pub const SYS_remap_file_pages: ::c_long = 253; +pub const SYS_set_tid_address: ::c_long = 256; +pub const SYS_timer_create: ::c_long = 257; +pub const SYS_timer_settime: ::c_long = 258; +pub const SYS_timer_gettime: ::c_long = 259; +pub const SYS_timer_getoverrun: ::c_long = 260; +pub const SYS_timer_delete: ::c_long = 261; +pub const SYS_clock_settime: ::c_long = 262; +pub const SYS_clock_gettime: ::c_long = 263; +pub const SYS_clock_getres: ::c_long = 264; +pub const SYS_clock_nanosleep: ::c_long = 265; +pub const SYS_statfs64: ::c_long = 266; +pub const SYS_fstatfs64: ::c_long = 267; +pub const SYS_tgkill: ::c_long = 268; +pub const SYS_utimes: ::c_long = 269; +pub const SYS_arm_fadvise64_64: ::c_long = 270; +pub const SYS_pciconfig_iobase: ::c_long = 271; +pub const SYS_pciconfig_read: ::c_long = 272; +pub const SYS_pciconfig_write: ::c_long = 273; +pub const SYS_mq_open: ::c_long = 274; +pub const SYS_mq_unlink: ::c_long = 275; +pub const SYS_mq_timedsend: ::c_long = 276; +pub const SYS_mq_timedreceive: ::c_long = 277; +pub const SYS_mq_notify: ::c_long = 278; +pub const SYS_mq_getsetattr: ::c_long = 279; +pub const SYS_waitid: ::c_long = 280; +pub const SYS_socket: ::c_long = 281; +pub const SYS_bind: ::c_long = 282; +pub const SYS_connect: ::c_long = 283; +pub const SYS_listen: ::c_long = 284; +pub const SYS_accept: ::c_long = 285; +pub const SYS_getsockname: ::c_long = 286; +pub const SYS_getpeername: ::c_long = 287; +pub const SYS_socketpair: ::c_long = 288; +pub const SYS_send: ::c_long = 289; +pub const SYS_sendto: ::c_long = 290; +pub const SYS_recv: ::c_long = 291; +pub const SYS_recvfrom: ::c_long = 292; +pub const SYS_shutdown: ::c_long = 293; +pub const SYS_setsockopt: ::c_long = 294; +pub const SYS_getsockopt: ::c_long = 295; +pub const SYS_sendmsg: ::c_long = 296; +pub const SYS_recvmsg: ::c_long = 297; +pub const SYS_semop: ::c_long = 298; +pub const SYS_semget: ::c_long = 299; +pub const SYS_semctl: ::c_long = 300; +pub const SYS_msgsnd: ::c_long = 301; +pub const SYS_msgrcv: ::c_long = 302; +pub const SYS_msgget: ::c_long = 303; +pub const SYS_msgctl: ::c_long = 304; +pub const SYS_shmat: ::c_long = 305; +pub const SYS_shmdt: ::c_long = 306; +pub const SYS_shmget: ::c_long = 307; +pub const SYS_shmctl: ::c_long = 308; +pub const SYS_add_key: ::c_long = 309; +pub const SYS_request_key: ::c_long = 310; +pub const SYS_keyctl: ::c_long = 311; +pub const SYS_semtimedop: ::c_long = 312; +pub const SYS_vserver: ::c_long = 313; +pub const SYS_ioprio_set: ::c_long = 314; +pub const SYS_ioprio_get: ::c_long = 315; +pub const SYS_inotify_init: ::c_long = 316; +pub const SYS_inotify_add_watch: ::c_long = 317; +pub const SYS_inotify_rm_watch: ::c_long = 318; +pub const SYS_mbind: ::c_long = 319; +pub const SYS_get_mempolicy: ::c_long = 320; +pub const SYS_set_mempolicy: ::c_long = 321; +pub const SYS_openat: ::c_long = 322; +pub const SYS_mkdirat: ::c_long = 323; +pub const SYS_mknodat: ::c_long = 324; +pub const SYS_fchownat: ::c_long = 325; +pub const SYS_futimesat: ::c_long = 326; +pub const SYS_fstatat64: ::c_long = 327; +pub const SYS_unlinkat: ::c_long = 328; +pub const SYS_renameat: ::c_long = 329; +pub const SYS_linkat: ::c_long = 330; +pub const SYS_symlinkat: ::c_long = 331; +pub const SYS_readlinkat: ::c_long = 332; +pub const SYS_fchmodat: ::c_long = 333; +pub const SYS_faccessat: ::c_long = 334; +pub const SYS_pselect6: ::c_long = 335; +pub const SYS_ppoll: ::c_long = 336; +pub const SYS_unshare: ::c_long = 337; +pub const SYS_set_robust_list: ::c_long = 338; +pub const SYS_get_robust_list: ::c_long = 339; +pub const SYS_splice: ::c_long = 340; +pub const SYS_arm_sync_file_range: ::c_long = 341; +pub const SYS_tee: ::c_long = 342; +pub const SYS_vmsplice: ::c_long = 343; +pub const SYS_move_pages: ::c_long = 344; +pub const SYS_getcpu: ::c_long = 345; +pub const SYS_epoll_pwait: ::c_long = 346; +pub const SYS_kexec_load: ::c_long = 347; +pub const SYS_utimensat: ::c_long = 348; +pub const SYS_signalfd: ::c_long = 349; +pub const SYS_timerfd_create: ::c_long = 350; +pub const SYS_eventfd: ::c_long = 351; +pub const SYS_fallocate: ::c_long = 352; +pub const SYS_timerfd_settime: ::c_long = 353; +pub const SYS_timerfd_gettime: ::c_long = 354; +pub const SYS_signalfd4: ::c_long = 355; +pub const SYS_eventfd2: ::c_long = 356; +pub const SYS_epoll_create1: ::c_long = 357; +pub const SYS_dup3: ::c_long = 358; +pub const SYS_pipe2: ::c_long = 359; +pub const SYS_inotify_init1: ::c_long = 360; +pub const SYS_preadv: ::c_long = 361; +pub const SYS_pwritev: ::c_long = 362; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 363; +pub const SYS_perf_event_open: ::c_long = 364; +pub const SYS_recvmmsg: ::c_long = 365; +pub const SYS_accept4: ::c_long = 366; +pub const SYS_fanotify_init: ::c_long = 367; +pub const SYS_fanotify_mark: ::c_long = 368; +pub const SYS_prlimit64: ::c_long = 369; +pub const SYS_name_to_handle_at: ::c_long = 370; +pub const SYS_open_by_handle_at: ::c_long = 371; +pub const SYS_clock_adjtime: ::c_long = 372; +pub const SYS_syncfs: ::c_long = 373; +pub const SYS_sendmmsg: ::c_long = 374; +pub const SYS_setns: ::c_long = 375; +pub const SYS_process_vm_readv: ::c_long = 376; +pub const SYS_process_vm_writev: ::c_long = 377; +pub const SYS_kcmp: ::c_long = 378; +pub const SYS_finit_module: ::c_long = 379; +pub const SYS_sched_setattr: ::c_long = 380; +pub const SYS_sched_getattr: ::c_long = 381; +pub const SYS_renameat2: ::c_long = 382; +pub const SYS_seccomp: ::c_long = 383; +pub const SYS_getrandom: ::c_long = 384; +pub const SYS_memfd_create: ::c_long = 385; +pub const SYS_bpf: ::c_long = 386; +pub const SYS_execveat: ::c_long = 387; +pub const SYS_userfaultfd: ::c_long = 388; +pub const SYS_membarrier: ::c_long = 389; +pub const SYS_mlock2: ::c_long = 390; +pub const SYS_copy_file_range: ::c_long = 391; +pub const SYS_preadv2: ::c_long = 392; +pub const SYS_pwritev2: ::c_long = 393; +pub const SYS_pkey_mprotect: ::c_long = 394; +pub const SYS_pkey_alloc: ::c_long = 395; +pub const SYS_pkey_free: ::c_long = 396; diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/android/b32/mod.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/android/b32/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/android/b32/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/android/b32/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,223 @@ +// The following definitions are correct for arm and i686, +// but may be wrong for mips + +pub type c_long = i32; +pub type c_ulong = u32; +pub type mode_t = u16; +pub type off64_t = ::c_longlong; +pub type sigset_t = ::c_ulong; +pub type socklen_t = i32; +pub type time64_t = i64; + +s! { + pub struct sigaction { + pub sa_sigaction: ::sighandler_t, + pub sa_mask: ::sigset_t, + pub sa_flags: ::c_int, + pub sa_restorer: ::Option, + } + + pub struct rlimit64 { + pub rlim_cur: u64, + pub rlim_max: u64, + } + + pub struct stat { + pub st_dev: ::c_ulonglong, + __pad0: [::c_uchar; 4], + __st_ino: ::ino_t, + pub st_mode: ::c_uint, + pub st_nlink: ::c_uint, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::c_ulonglong, + __pad3: [::c_uchar; 4], + pub st_size: ::c_longlong, + pub st_blksize: ::blksize_t, + pub st_blocks: ::c_ulonglong, + pub st_atime: ::c_long, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::c_long, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::c_long, + pub st_ctime_nsec: ::c_long, + pub st_ino: ::c_ulonglong, + } + + pub struct stat64 { + pub st_dev: ::c_ulonglong, + __pad0: [::c_uchar; 4], + __st_ino: ::ino_t, + pub st_mode: ::c_uint, + pub st_nlink: ::c_uint, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::c_ulonglong, + __pad3: [::c_uchar; 4], + pub st_size: ::c_longlong, + pub st_blksize: ::blksize_t, + pub st_blocks: ::c_ulonglong, + pub st_atime: ::c_long, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::c_long, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::c_long, + pub st_ctime_nsec: ::c_long, + pub st_ino: ::c_ulonglong, + } + + pub struct statfs64 { + pub f_type: u32, + pub f_bsize: u32, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + f_fsid: [u32; 2], + pub f_namelen: u32, + pub f_frsize: u32, + pub f_flags: u32, + pub f_spare: [u32; 4], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: ::c_ulong, + pub f_bfree: ::c_ulong, + pub f_bavail: ::c_ulong, + pub f_files: ::c_ulong, + pub f_ffree: ::c_ulong, + pub f_favail: ::c_ulong, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + } + + pub struct pthread_attr_t { + pub flags: u32, + pub stack_base: *mut ::c_void, + pub stack_size: ::size_t, + pub guard_size: ::size_t, + pub sched_policy: i32, + pub sched_priority: i32, + } + + pub struct pthread_mutex_t { value: ::c_int } + + pub struct pthread_cond_t { value: ::c_int } + + pub struct pthread_rwlock_t { + lock: pthread_mutex_t, + cond: pthread_cond_t, + numLocks: ::c_int, + writerThreadId: ::c_int, + pendingReaders: ::c_int, + pendingWriters: ::c_int, + attr: i32, + __reserved: [::c_char; 12], + } + + pub struct passwd { + pub pw_name: *mut ::c_char, + pub pw_passwd: *mut ::c_char, + pub pw_uid: ::uid_t, + pub pw_gid: ::gid_t, + pub pw_dir: *mut ::c_char, + pub pw_shell: *mut ::c_char, + } + + pub struct statfs { + pub f_type: u32, + pub f_bsize: u32, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_fsid: ::__fsid_t, + pub f_namelen: u32, + pub f_frsize: u32, + pub f_flags: u32, + pub f_spare: [u32; 4], + } + + pub struct sysinfo { + pub uptime: ::c_long, + pub loads: [::c_ulong; 3], + pub totalram: ::c_ulong, + pub freeram: ::c_ulong, + pub sharedram: ::c_ulong, + pub bufferram: ::c_ulong, + pub totalswap: ::c_ulong, + pub freeswap: ::c_ulong, + pub procs: ::c_ushort, + pub pad: ::c_ushort, + pub totalhigh: ::c_ulong, + pub freehigh: ::c_ulong, + pub mem_unit: ::c_uint, + pub _f: [::c_char; 8], + } +} + +// These constants must be of the same type of sigaction.sa_flags +pub const SA_NOCLDSTOP: ::c_int = 0x00000001; +pub const SA_NOCLDWAIT: ::c_int = 0x00000002; +pub const SA_NODEFER: ::c_int = 0x40000000; +pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_RESETHAND: ::c_int = 0x80000000; +pub const SA_RESTART: ::c_int = 0x10000000; +pub const SA_SIGINFO: ::c_int = 0x00000004; + +pub const RTLD_GLOBAL: ::c_int = 2; +pub const RTLD_NOW: ::c_int = 0; +pub const RTLD_DEFAULT: *mut ::c_void = -1isize as *mut ::c_void; + +pub const PTRACE_GETFPREGS: ::c_int = 14; +pub const PTRACE_SETFPREGS: ::c_int = 15; +pub const PTRACE_GETREGS: ::c_int = 12; +pub const PTRACE_SETREGS: ::c_int = 13; + +pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { + value: 0, +}; +pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { + value: 0, +}; +pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { + lock: PTHREAD_MUTEX_INITIALIZER, + cond: PTHREAD_COND_INITIALIZER, + numLocks: 0, + writerThreadId: 0, + pendingReaders: 0, + pendingWriters: 0, + attr: 0, + __reserved: [0; 12], +}; +pub const PTHREAD_STACK_MIN: ::size_t = 4096 * 2; +pub const CPU_SETSIZE: ::size_t = 32; +pub const __CPU_BITS: ::size_t = 32; + +pub const UT_LINESIZE: usize = 8; +pub const UT_NAMESIZE: usize = 8; +pub const UT_HOSTSIZE: usize = 16; + +pub const SIGSTKSZ: ::size_t = 8192; +pub const MINSIGSTKSZ: ::size_t = 2048; + +extern { + pub fn timegm64(tm: *const ::tm) -> ::time64_t; +} + +cfg_if! { + if #[cfg(target_arch = "x86")] { + mod x86; + pub use self::x86::*; + } else if #[cfg(target_arch = "arm")] { + mod arm; + pub use self::arm::*; + } else { + // Unknown target_arch + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/android/b32/x86.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/android/b32/x86.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/android/b32/x86.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/android/b32/x86.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,415 @@ +pub type c_char = i8; +pub type wchar_t = i32; + +pub const O_DIRECT: ::c_int = 0x4000; +pub const O_DIRECTORY: ::c_int = 0x10000; +pub const O_NOFOLLOW: ::c_int = 0x20000; +pub const O_LARGEFILE: ::c_int = 0o0100000; + +pub const MAP_32BIT: ::c_int = 0x40; + +// Syscall table +pub const SYS_restart_syscall: ::c_long = 0; +pub const SYS_exit: ::c_long = 1; +pub const SYS_fork: ::c_long = 2; +pub const SYS_read: ::c_long = 3; +pub const SYS_write: ::c_long = 4; +pub const SYS_open: ::c_long = 5; +pub const SYS_close: ::c_long = 6; +pub const SYS_waitpid: ::c_long = 7; +pub const SYS_creat: ::c_long = 8; +pub const SYS_link: ::c_long = 9; +pub const SYS_unlink: ::c_long = 10; +pub const SYS_execve: ::c_long = 11; +pub const SYS_chdir: ::c_long = 12; +pub const SYS_time: ::c_long = 13; +pub const SYS_mknod: ::c_long = 14; +pub const SYS_chmod: ::c_long = 15; +pub const SYS_lchown: ::c_long = 16; +pub const SYS_break: ::c_long = 17; +pub const SYS_oldstat: ::c_long = 18; +pub const SYS_lseek: ::c_long = 19; +pub const SYS_getpid: ::c_long = 20; +pub const SYS_mount: ::c_long = 21; +pub const SYS_umount: ::c_long = 22; +pub const SYS_setuid: ::c_long = 23; +pub const SYS_getuid: ::c_long = 24; +pub const SYS_stime: ::c_long = 25; +pub const SYS_ptrace: ::c_long = 26; +pub const SYS_alarm: ::c_long = 27; +pub const SYS_oldfstat: ::c_long = 28; +pub const SYS_pause: ::c_long = 29; +pub const SYS_utime: ::c_long = 30; +pub const SYS_stty: ::c_long = 31; +pub const SYS_gtty: ::c_long = 32; +pub const SYS_access: ::c_long = 33; +pub const SYS_nice: ::c_long = 34; +pub const SYS_ftime: ::c_long = 35; +pub const SYS_sync: ::c_long = 36; +pub const SYS_kill: ::c_long = 37; +pub const SYS_rename: ::c_long = 38; +pub const SYS_mkdir: ::c_long = 39; +pub const SYS_rmdir: ::c_long = 40; +pub const SYS_dup: ::c_long = 41; +pub const SYS_pipe: ::c_long = 42; +pub const SYS_times: ::c_long = 43; +pub const SYS_prof: ::c_long = 44; +pub const SYS_brk: ::c_long = 45; +pub const SYS_setgid: ::c_long = 46; +pub const SYS_getgid: ::c_long = 47; +pub const SYS_signal: ::c_long = 48; +pub const SYS_geteuid: ::c_long = 49; +pub const SYS_getegid: ::c_long = 50; +pub const SYS_acct: ::c_long = 51; +pub const SYS_umount2: ::c_long = 52; +pub const SYS_lock: ::c_long = 53; +pub const SYS_ioctl: ::c_long = 54; +pub const SYS_fcntl: ::c_long = 55; +pub const SYS_mpx: ::c_long = 56; +pub const SYS_setpgid: ::c_long = 57; +pub const SYS_ulimit: ::c_long = 58; +pub const SYS_oldolduname: ::c_long = 59; +pub const SYS_umask: ::c_long = 60; +pub const SYS_chroot: ::c_long = 61; +pub const SYS_ustat: ::c_long = 62; +pub const SYS_dup2: ::c_long = 63; +pub const SYS_getppid: ::c_long = 64; +pub const SYS_getpgrp: ::c_long = 65; +pub const SYS_setsid: ::c_long = 66; +pub const SYS_sigaction: ::c_long = 67; +pub const SYS_sgetmask: ::c_long = 68; +pub const SYS_ssetmask: ::c_long = 69; +pub const SYS_setreuid: ::c_long = 70; +pub const SYS_setregid: ::c_long = 71; +pub const SYS_sigsuspend: ::c_long = 72; +pub const SYS_sigpending: ::c_long = 73; +pub const SYS_sethostname: ::c_long = 74; +pub const SYS_setrlimit: ::c_long = 75; +pub const SYS_getrlimit: ::c_long = 76; +pub const SYS_getrusage: ::c_long = 77; +pub const SYS_gettimeofday: ::c_long = 78; +pub const SYS_settimeofday: ::c_long = 79; +pub const SYS_getgroups: ::c_long = 80; +pub const SYS_setgroups: ::c_long = 81; +pub const SYS_select: ::c_long = 82; +pub const SYS_symlink: ::c_long = 83; +pub const SYS_oldlstat: ::c_long = 84; +pub const SYS_readlink: ::c_long = 85; +pub const SYS_uselib: ::c_long = 86; +pub const SYS_swapon: ::c_long = 87; +pub const SYS_reboot: ::c_long = 88; +pub const SYS_readdir: ::c_long = 89; +pub const SYS_mmap: ::c_long = 90; +pub const SYS_munmap: ::c_long = 91; +pub const SYS_truncate: ::c_long = 92; +pub const SYS_ftruncate: ::c_long = 93; +pub const SYS_fchmod: ::c_long = 94; +pub const SYS_fchown: ::c_long = 95; +pub const SYS_getpriority: ::c_long = 96; +pub const SYS_setpriority: ::c_long = 97; +pub const SYS_profil: ::c_long = 98; +pub const SYS_statfs: ::c_long = 99; +pub const SYS_fstatfs: ::c_long = 100; +pub const SYS_ioperm: ::c_long = 101; +pub const SYS_socketcall: ::c_long = 102; +pub const SYS_syslog: ::c_long = 103; +pub const SYS_setitimer: ::c_long = 104; +pub const SYS_getitimer: ::c_long = 105; +pub const SYS_stat: ::c_long = 106; +pub const SYS_lstat: ::c_long = 107; +pub const SYS_fstat: ::c_long = 108; +pub const SYS_olduname: ::c_long = 109; +pub const SYS_iopl: ::c_long = 110; +pub const SYS_vhangup: ::c_long = 111; +pub const SYS_idle: ::c_long = 112; +pub const SYS_vm86old: ::c_long = 113; +pub const SYS_wait4: ::c_long = 114; +pub const SYS_swapoff: ::c_long = 115; +pub const SYS_sysinfo: ::c_long = 116; +pub const SYS_ipc: ::c_long = 117; +pub const SYS_fsync: ::c_long = 118; +pub const SYS_sigreturn: ::c_long = 119; +pub const SYS_clone: ::c_long = 120; +pub const SYS_setdomainname: ::c_long = 121; +pub const SYS_uname: ::c_long = 122; +pub const SYS_modify_ldt: ::c_long = 123; +pub const SYS_adjtimex: ::c_long = 124; +pub const SYS_mprotect: ::c_long = 125; +pub const SYS_sigprocmask: ::c_long = 126; +pub const SYS_create_module: ::c_long = 127; +pub const SYS_init_module: ::c_long = 128; +pub const SYS_delete_module: ::c_long = 129; +pub const SYS_get_kernel_syms: ::c_long = 130; +pub const SYS_quotactl: ::c_long = 131; +pub const SYS_getpgid: ::c_long = 132; +pub const SYS_fchdir: ::c_long = 133; +pub const SYS_bdflush: ::c_long = 134; +pub const SYS_sysfs: ::c_long = 135; +pub const SYS_personality: ::c_long = 136; +pub const SYS_afs_syscall: ::c_long = 137; +pub const SYS_setfsuid: ::c_long = 138; +pub const SYS_setfsgid: ::c_long = 139; +// FIXME: SYS__llseek is in the NDK sources but for some reason is +// not available in the tests +// pub const SYS__llseek: ::c_long = 140; +pub const SYS_getdents: ::c_long = 141; +// FIXME: SYS__newselect is in the NDK sources but for some reason is +// not available in the tests +// pub const SYS__newselect: ::c_long = 142; +pub const SYS_flock: ::c_long = 143; +pub const SYS_msync: ::c_long = 144; +pub const SYS_readv: ::c_long = 145; +pub const SYS_writev: ::c_long = 146; +pub const SYS_getsid: ::c_long = 147; +pub const SYS_fdatasync: ::c_long = 148; +// FIXME: SYS__llseek is in the NDK sources but for some reason is +// not available in the tests +// pub const SYS__sysctl: ::c_long = 149; +pub const SYS_mlock: ::c_long = 150; +pub const SYS_munlock: ::c_long = 151; +pub const SYS_mlockall: ::c_long = 152; +pub const SYS_munlockall: ::c_long = 153; +pub const SYS_sched_setparam: ::c_long = 154; +pub const SYS_sched_getparam: ::c_long = 155; +pub const SYS_sched_setscheduler: ::c_long = 156; +pub const SYS_sched_getscheduler: ::c_long = 157; +pub const SYS_sched_yield: ::c_long = 158; +pub const SYS_sched_get_priority_max: ::c_long = 159; +pub const SYS_sched_get_priority_min: ::c_long = 160; +pub const SYS_sched_rr_get_interval: ::c_long = 161; +pub const SYS_nanosleep: ::c_long = 162; +pub const SYS_mremap: ::c_long = 163; +pub const SYS_setresuid: ::c_long = 164; +pub const SYS_getresuid: ::c_long = 165; +pub const SYS_vm86: ::c_long = 166; +pub const SYS_query_module: ::c_long = 167; +pub const SYS_poll: ::c_long = 168; +pub const SYS_nfsservctl: ::c_long = 169; +pub const SYS_setresgid: ::c_long = 170; +pub const SYS_getresgid: ::c_long = 171; +pub const SYS_prctl: ::c_long = 172; +pub const SYS_rt_sigreturn: ::c_long = 173; +pub const SYS_rt_sigaction: ::c_long = 174; +pub const SYS_rt_sigprocmask: ::c_long = 175; +pub const SYS_rt_sigpending: ::c_long = 176; +pub const SYS_rt_sigtimedwait: ::c_long = 177; +pub const SYS_rt_sigqueueinfo: ::c_long = 178; +pub const SYS_rt_sigsuspend: ::c_long = 179; +pub const SYS_pread64: ::c_long = 180; +pub const SYS_pwrite64: ::c_long = 181; +pub const SYS_chown: ::c_long = 182; +pub const SYS_getcwd: ::c_long = 183; +pub const SYS_capget: ::c_long = 184; +pub const SYS_capset: ::c_long = 185; +pub const SYS_sigaltstack: ::c_long = 186; +pub const SYS_sendfile: ::c_long = 187; +pub const SYS_getpmsg: ::c_long = 188; +pub const SYS_putpmsg: ::c_long = 189; +pub const SYS_vfork: ::c_long = 190; +pub const SYS_ugetrlimit: ::c_long = 191; +pub const SYS_mmap2: ::c_long = 192; +pub const SYS_truncate64: ::c_long = 193; +pub const SYS_ftruncate64: ::c_long = 194; +pub const SYS_stat64: ::c_long = 195; +pub const SYS_lstat64: ::c_long = 196; +pub const SYS_fstat64: ::c_long = 197; +pub const SYS_lchown32: ::c_long = 198; +pub const SYS_getuid32: ::c_long = 199; +pub const SYS_getgid32: ::c_long = 200; +pub const SYS_geteuid32: ::c_long = 201; +pub const SYS_getegid32: ::c_long = 202; +pub const SYS_setreuid32: ::c_long = 203; +pub const SYS_setregid32: ::c_long = 204; +pub const SYS_getgroups32: ::c_long = 205; +pub const SYS_setgroups32: ::c_long = 206; +pub const SYS_fchown32: ::c_long = 207; +pub const SYS_setresuid32: ::c_long = 208; +pub const SYS_getresuid32: ::c_long = 209; +pub const SYS_setresgid32: ::c_long = 210; +pub const SYS_getresgid32: ::c_long = 211; +pub const SYS_chown32: ::c_long = 212; +pub const SYS_setuid32: ::c_long = 213; +pub const SYS_setgid32: ::c_long = 214; +pub const SYS_setfsuid32: ::c_long = 215; +pub const SYS_setfsgid32: ::c_long = 216; +pub const SYS_pivot_root: ::c_long = 217; +pub const SYS_mincore: ::c_long = 218; +pub const SYS_madvise: ::c_long = 219; +pub const SYS_getdents64: ::c_long = 220; +pub const SYS_fcntl64: ::c_long = 221; +pub const SYS_gettid: ::c_long = 224; +pub const SYS_readahead: ::c_long = 225; +pub const SYS_setxattr: ::c_long = 226; +pub const SYS_lsetxattr: ::c_long = 227; +pub const SYS_fsetxattr: ::c_long = 228; +pub const SYS_getxattr: ::c_long = 229; +pub const SYS_lgetxattr: ::c_long = 230; +pub const SYS_fgetxattr: ::c_long = 231; +pub const SYS_listxattr: ::c_long = 232; +pub const SYS_llistxattr: ::c_long = 233; +pub const SYS_flistxattr: ::c_long = 234; +pub const SYS_removexattr: ::c_long = 235; +pub const SYS_lremovexattr: ::c_long = 236; +pub const SYS_fremovexattr: ::c_long = 237; +pub const SYS_tkill: ::c_long = 238; +pub const SYS_sendfile64: ::c_long = 239; +pub const SYS_futex: ::c_long = 240; +pub const SYS_sched_setaffinity: ::c_long = 241; +pub const SYS_sched_getaffinity: ::c_long = 242; +pub const SYS_set_thread_area: ::c_long = 243; +pub const SYS_get_thread_area: ::c_long = 244; +pub const SYS_io_setup: ::c_long = 245; +pub const SYS_io_destroy: ::c_long = 246; +pub const SYS_io_getevents: ::c_long = 247; +pub const SYS_io_submit: ::c_long = 248; +pub const SYS_io_cancel: ::c_long = 249; +pub const SYS_fadvise64: ::c_long = 250; +pub const SYS_exit_group: ::c_long = 252; +pub const SYS_lookup_dcookie: ::c_long = 253; +pub const SYS_epoll_create: ::c_long = 254; +pub const SYS_epoll_ctl: ::c_long = 255; +pub const SYS_epoll_wait: ::c_long = 256; +pub const SYS_remap_file_pages: ::c_long = 257; +pub const SYS_set_tid_address: ::c_long = 258; +pub const SYS_timer_create: ::c_long = 259; +pub const SYS_timer_settime: ::c_long = 260; +pub const SYS_timer_gettime: ::c_long = 261; +pub const SYS_timer_getoverrun: ::c_long = 262; +pub const SYS_timer_delete: ::c_long = 263; +pub const SYS_clock_settime: ::c_long = 264; +pub const SYS_clock_gettime: ::c_long = 265; +pub const SYS_clock_getres: ::c_long = 266; +pub const SYS_clock_nanosleep: ::c_long = 267; +pub const SYS_statfs64: ::c_long = 268; +pub const SYS_fstatfs64: ::c_long = 269; +pub const SYS_tgkill: ::c_long = 270; +pub const SYS_utimes: ::c_long = 271; +pub const SYS_fadvise64_64: ::c_long = 272; +pub const SYS_vserver: ::c_long = 273; +pub const SYS_mbind: ::c_long = 274; +pub const SYS_get_mempolicy: ::c_long = 275; +pub const SYS_set_mempolicy: ::c_long = 276; +pub const SYS_mq_open: ::c_long = 277; +pub const SYS_mq_unlink: ::c_long = 278; +pub const SYS_mq_timedsend: ::c_long = 279; +pub const SYS_mq_timedreceive: ::c_long = 280; +pub const SYS_mq_notify: ::c_long = 281; +pub const SYS_mq_getsetattr: ::c_long = 282; +pub const SYS_kexec_load: ::c_long = 283; +pub const SYS_waitid: ::c_long = 284; +pub const SYS_add_key: ::c_long = 286; +pub const SYS_request_key: ::c_long = 287; +pub const SYS_keyctl: ::c_long = 288; +pub const SYS_ioprio_set: ::c_long = 289; +pub const SYS_ioprio_get: ::c_long = 290; +pub const SYS_inotify_init: ::c_long = 291; +pub const SYS_inotify_add_watch: ::c_long = 292; +pub const SYS_inotify_rm_watch: ::c_long = 293; +pub const SYS_migrate_pages: ::c_long = 294; +pub const SYS_openat: ::c_long = 295; +pub const SYS_mkdirat: ::c_long = 296; +pub const SYS_mknodat: ::c_long = 297; +pub const SYS_fchownat: ::c_long = 298; +pub const SYS_futimesat: ::c_long = 299; +pub const SYS_fstatat64: ::c_long = 300; +pub const SYS_unlinkat: ::c_long = 301; +pub const SYS_renameat: ::c_long = 302; +pub const SYS_linkat: ::c_long = 303; +pub const SYS_symlinkat: ::c_long = 304; +pub const SYS_readlinkat: ::c_long = 305; +pub const SYS_fchmodat: ::c_long = 306; +pub const SYS_faccessat: ::c_long = 307; +pub const SYS_pselect6: ::c_long = 308; +pub const SYS_ppoll: ::c_long = 309; +pub const SYS_unshare: ::c_long = 310; +pub const SYS_set_robust_list: ::c_long = 311; +pub const SYS_get_robust_list: ::c_long = 312; +pub const SYS_splice: ::c_long = 313; +pub const SYS_sync_file_range: ::c_long = 314; +pub const SYS_tee: ::c_long = 315; +pub const SYS_vmsplice: ::c_long = 316; +pub const SYS_move_pages: ::c_long = 317; +pub const SYS_getcpu: ::c_long = 318; +pub const SYS_epoll_pwait: ::c_long = 319; +pub const SYS_utimensat: ::c_long = 320; +pub const SYS_signalfd: ::c_long = 321; +pub const SYS_timerfd_create: ::c_long = 322; +pub const SYS_eventfd: ::c_long = 323; +pub const SYS_fallocate: ::c_long = 324; +pub const SYS_timerfd_settime: ::c_long = 325; +pub const SYS_timerfd_gettime: ::c_long = 326; +pub const SYS_signalfd4: ::c_long = 327; +pub const SYS_eventfd2: ::c_long = 328; +pub const SYS_epoll_create1: ::c_long = 329; +pub const SYS_dup3: ::c_long = 330; +pub const SYS_pipe2: ::c_long = 331; +pub const SYS_inotify_init1: ::c_long = 332; +pub const SYS_preadv: ::c_long = 333; +pub const SYS_pwritev: ::c_long = 334; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 335; +pub const SYS_perf_event_open: ::c_long = 336; +pub const SYS_recvmmsg: ::c_long = 337; +pub const SYS_fanotify_init: ::c_long = 338; +pub const SYS_fanotify_mark: ::c_long = 339; +pub const SYS_prlimit64: ::c_long = 340; +pub const SYS_name_to_handle_at: ::c_long = 341; +pub const SYS_open_by_handle_at: ::c_long = 342; +pub const SYS_clock_adjtime: ::c_long = 343; +pub const SYS_syncfs: ::c_long = 344; +pub const SYS_sendmmsg: ::c_long = 345; +pub const SYS_setns: ::c_long = 346; +pub const SYS_process_vm_readv: ::c_long = 347; +pub const SYS_process_vm_writev: ::c_long = 348; +pub const SYS_kcmp: ::c_long = 349; +pub const SYS_finit_module: ::c_long = 350; +pub const SYS_sched_setattr: ::c_long = 351; +pub const SYS_sched_getattr: ::c_long = 352; +pub const SYS_renameat2: ::c_long = 353; +pub const SYS_seccomp: ::c_long = 354; +pub const SYS_getrandom: ::c_long = 355; +pub const SYS_memfd_create: ::c_long = 356; +pub const SYS_bpf: ::c_long = 357; +pub const SYS_execveat: ::c_long = 358; +pub const SYS_socket: ::c_long = 359; +pub const SYS_socketpair: ::c_long = 360; +pub const SYS_bind: ::c_long = 361; +pub const SYS_connect: ::c_long = 362; +pub const SYS_listen: ::c_long = 363; +pub const SYS_accept4: ::c_long = 364; +pub const SYS_getsockopt: ::c_long = 365; +pub const SYS_setsockopt: ::c_long = 366; +pub const SYS_getsockname: ::c_long = 367; +pub const SYS_getpeername: ::c_long = 368; +pub const SYS_sendto: ::c_long = 369; +pub const SYS_sendmsg: ::c_long = 370; +pub const SYS_recvfrom: ::c_long = 371; +pub const SYS_recvmsg: ::c_long = 372; +pub const SYS_shutdown: ::c_long = 373; +pub const SYS_userfaultfd: ::c_long = 374; +pub const SYS_membarrier: ::c_long = 375; +pub const SYS_mlock2: ::c_long = 376; +pub const SYS_copy_file_range: ::c_long = 377; +pub const SYS_preadv2: ::c_long = 378; +pub const SYS_pwritev2: ::c_long = 379; +pub const SYS_pkey_mprotect: ::c_long = 380; +pub const SYS_pkey_alloc: ::c_long = 381; +pub const SYS_pkey_free: ::c_long = 382; + +// offsets in user_regs_structs, from sys/reg.h +pub const EBX: ::c_int = 0; +pub const ECX: ::c_int = 1; +pub const EDX: ::c_int = 2; +pub const ESI: ::c_int = 3; +pub const EDI: ::c_int = 4; +pub const EBP: ::c_int = 5; +pub const EAX: ::c_int = 6; +pub const DS: ::c_int = 7; +pub const ES: ::c_int = 8; +pub const FS: ::c_int = 9; +pub const GS: ::c_int = 10; +pub const ORIG_EAX: ::c_int = 11; +pub const EIP: ::c_int = 12; +pub const CS: ::c_int = 13; +pub const EFL: ::c_int = 14; +pub const UESP: ::c_int = 15; +pub const SS: ::c_int = 16; diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/android/b64/aarch64.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/android/b64/aarch64.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/android/b64/aarch64.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/android/b64/aarch64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,325 @@ +pub type c_char = u8; +pub type wchar_t = u32; + +s! { + pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_mode: ::c_uint, + pub st_nlink: ::c_uint, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __pad1: ::c_ulong, + pub st_size: ::off64_t, + pub st_blksize: ::c_int, + __pad2: ::c_int, + pub st_blocks: ::c_long, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused4: ::c_uint, + __unused5: ::c_uint, + } + + pub struct stat64 { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_mode: ::c_uint, + pub st_nlink: ::c_uint, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __pad1: ::c_ulong, + pub st_size: ::off64_t, + pub st_blksize: ::c_int, + __pad2: ::c_int, + pub st_blocks: ::c_long, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused4: ::c_uint, + __unused5: ::c_uint, + } +} + +pub const O_DIRECT: ::c_int = 0x10000; +pub const O_DIRECTORY: ::c_int = 0x4000; +pub const O_NOFOLLOW: ::c_int = 0x8000; +pub const O_LARGEFILE: ::c_int = 0o400000; + +pub const SIGSTKSZ: ::size_t = 16384; +pub const MINSIGSTKSZ: ::size_t = 5120; + +pub const SYS_io_setup: ::c_long = 0; +pub const SYS_io_destroy: ::c_long = 1; +pub const SYS_io_submit: ::c_long = 2; +pub const SYS_io_cancel: ::c_long = 3; +pub const SYS_io_getevents: ::c_long = 4; +pub const SYS_setxattr: ::c_long = 5; +pub const SYS_lsetxattr: ::c_long = 6; +pub const SYS_fsetxattr: ::c_long = 7; +pub const SYS_getxattr: ::c_long = 8; +pub const SYS_lgetxattr: ::c_long = 9; +pub const SYS_fgetxattr: ::c_long = 10; +pub const SYS_listxattr: ::c_long = 11; +pub const SYS_llistxattr: ::c_long = 12; +pub const SYS_flistxattr: ::c_long = 13; +pub const SYS_removexattr: ::c_long = 14; +pub const SYS_lremovexattr: ::c_long = 15; +pub const SYS_fremovexattr: ::c_long = 16; +pub const SYS_getcwd: ::c_long = 17; +pub const SYS_lookup_dcookie: ::c_long = 18; +pub const SYS_eventfd2: ::c_long = 19; +pub const SYS_epoll_create1: ::c_long = 20; +pub const SYS_epoll_ctl: ::c_long = 21; +pub const SYS_epoll_pwait: ::c_long = 22; +pub const SYS_dup: ::c_long = 23; +pub const SYS_dup3: ::c_long = 24; +pub const SYS_inotify_init1: ::c_long = 26; +pub const SYS_inotify_add_watch: ::c_long = 27; +pub const SYS_inotify_rm_watch: ::c_long = 28; +pub const SYS_ioctl: ::c_long = 29; +pub const SYS_ioprio_set: ::c_long = 30; +pub const SYS_ioprio_get: ::c_long = 31; +pub const SYS_flock: ::c_long = 32; +pub const SYS_mknodat: ::c_long = 33; +pub const SYS_mkdirat: ::c_long = 34; +pub const SYS_unlinkat: ::c_long = 35; +pub const SYS_symlinkat: ::c_long = 36; +pub const SYS_linkat: ::c_long = 37; +pub const SYS_renameat: ::c_long = 38; +pub const SYS_umount2: ::c_long = 39; +pub const SYS_mount: ::c_long = 40; +pub const SYS_pivot_root: ::c_long = 41; +pub const SYS_nfsservctl: ::c_long = 42; +pub const SYS_fallocate: ::c_long = 47; +pub const SYS_faccessat: ::c_long = 48; +pub const SYS_chdir: ::c_long = 49; +pub const SYS_fchdir: ::c_long = 50; +pub const SYS_chroot: ::c_long = 51; +pub const SYS_fchmod: ::c_long = 52; +pub const SYS_fchmodat: ::c_long = 53; +pub const SYS_fchownat: ::c_long = 54; +pub const SYS_fchown: ::c_long = 55; +pub const SYS_openat: ::c_long = 56; +pub const SYS_close: ::c_long = 57; +pub const SYS_vhangup: ::c_long = 58; +pub const SYS_pipe2: ::c_long = 59; +pub const SYS_quotactl: ::c_long = 60; +pub const SYS_getdents64: ::c_long = 61; +pub const SYS_read: ::c_long = 63; +pub const SYS_write: ::c_long = 64; +pub const SYS_readv: ::c_long = 65; +pub const SYS_writev: ::c_long = 66; +pub const SYS_pread64: ::c_long = 67; +pub const SYS_pwrite64: ::c_long = 68; +pub const SYS_preadv: ::c_long = 69; +pub const SYS_pwritev: ::c_long = 70; +pub const SYS_pselect6: ::c_long = 72; +pub const SYS_ppoll: ::c_long = 73; +pub const SYS_signalfd4: ::c_long = 74; +pub const SYS_vmsplice: ::c_long = 75; +pub const SYS_splice: ::c_long = 76; +pub const SYS_tee: ::c_long = 77; +pub const SYS_readlinkat: ::c_long = 78; +pub const SYS_sync: ::c_long = 81; +pub const SYS_fsync: ::c_long = 82; +pub const SYS_fdatasync: ::c_long = 83; +pub const SYS_sync_file_range: ::c_long = 84; +pub const SYS_timerfd_create: ::c_long = 85; +pub const SYS_timerfd_settime: ::c_long = 86; +pub const SYS_timerfd_gettime: ::c_long = 87; +pub const SYS_utimensat: ::c_long = 88; +pub const SYS_acct: ::c_long = 89; +pub const SYS_capget: ::c_long = 90; +pub const SYS_capset: ::c_long = 91; +pub const SYS_personality: ::c_long = 92; +pub const SYS_exit: ::c_long = 93; +pub const SYS_exit_group: ::c_long = 94; +pub const SYS_waitid: ::c_long = 95; +pub const SYS_set_tid_address: ::c_long = 96; +pub const SYS_unshare: ::c_long = 97; +pub const SYS_futex: ::c_long = 98; +pub const SYS_set_robust_list: ::c_long = 99; +pub const SYS_get_robust_list: ::c_long = 100; +pub const SYS_nanosleep: ::c_long = 101; +pub const SYS_getitimer: ::c_long = 102; +pub const SYS_setitimer: ::c_long = 103; +pub const SYS_kexec_load: ::c_long = 104; +pub const SYS_init_module: ::c_long = 105; +pub const SYS_delete_module: ::c_long = 106; +pub const SYS_timer_create: ::c_long = 107; +pub const SYS_timer_gettime: ::c_long = 108; +pub const SYS_timer_getoverrun: ::c_long = 109; +pub const SYS_timer_settime: ::c_long = 110; +pub const SYS_timer_delete: ::c_long = 111; +pub const SYS_clock_settime: ::c_long = 112; +pub const SYS_clock_gettime: ::c_long = 113; +pub const SYS_clock_getres: ::c_long = 114; +pub const SYS_clock_nanosleep: ::c_long = 115; +pub const SYS_syslog: ::c_long = 116; +pub const SYS_ptrace: ::c_long = 117; +pub const SYS_sched_setparam: ::c_long = 118; +pub const SYS_sched_setscheduler: ::c_long = 119; +pub const SYS_sched_getscheduler: ::c_long = 120; +pub const SYS_sched_getparam: ::c_long = 121; +pub const SYS_sched_setaffinity: ::c_long = 122; +pub const SYS_sched_getaffinity: ::c_long = 123; +pub const SYS_sched_yield: ::c_long = 124; +pub const SYS_sched_get_priority_max: ::c_long = 125; +pub const SYS_sched_get_priority_min: ::c_long = 126; +pub const SYS_sched_rr_get_interval: ::c_long = 127; +pub const SYS_restart_syscall: ::c_long = 128; +pub const SYS_kill: ::c_long = 129; +pub const SYS_tkill: ::c_long = 130; +pub const SYS_tgkill: ::c_long = 131; +pub const SYS_sigaltstack: ::c_long = 132; +pub const SYS_rt_sigsuspend: ::c_long = 133; +pub const SYS_rt_sigaction: ::c_long = 134; +pub const SYS_rt_sigprocmask: ::c_long = 135; +pub const SYS_rt_sigpending: ::c_long = 136; +pub const SYS_rt_sigtimedwait: ::c_long = 137; +pub const SYS_rt_sigqueueinfo: ::c_long = 138; +pub const SYS_rt_sigreturn: ::c_long = 139; +pub const SYS_setpriority: ::c_long = 140; +pub const SYS_getpriority: ::c_long = 141; +pub const SYS_reboot: ::c_long = 142; +pub const SYS_setregid: ::c_long = 143; +pub const SYS_setgid: ::c_long = 144; +pub const SYS_setreuid: ::c_long = 145; +pub const SYS_setuid: ::c_long = 146; +pub const SYS_setresuid: ::c_long = 147; +pub const SYS_getresuid: ::c_long = 148; +pub const SYS_setresgid: ::c_long = 149; +pub const SYS_getresgid: ::c_long = 150; +pub const SYS_setfsuid: ::c_long = 151; +pub const SYS_setfsgid: ::c_long = 152; +pub const SYS_times: ::c_long = 153; +pub const SYS_setpgid: ::c_long = 154; +pub const SYS_getpgid: ::c_long = 155; +pub const SYS_getsid: ::c_long = 156; +pub const SYS_setsid: ::c_long = 157; +pub const SYS_getgroups: ::c_long = 158; +pub const SYS_setgroups: ::c_long = 159; +pub const SYS_uname: ::c_long = 160; +pub const SYS_sethostname: ::c_long = 161; +pub const SYS_setdomainname: ::c_long = 162; +pub const SYS_getrlimit: ::c_long = 163; +pub const SYS_setrlimit: ::c_long = 164; +pub const SYS_getrusage: ::c_long = 165; +pub const SYS_umask: ::c_long = 166; +pub const SYS_prctl: ::c_long = 167; +pub const SYS_getcpu: ::c_long = 168; +pub const SYS_gettimeofday: ::c_long = 169; +pub const SYS_settimeofday: ::c_long = 170; +pub const SYS_adjtimex: ::c_long = 171; +pub const SYS_getpid: ::c_long = 172; +pub const SYS_getppid: ::c_long = 173; +pub const SYS_getuid: ::c_long = 174; +pub const SYS_geteuid: ::c_long = 175; +pub const SYS_getgid: ::c_long = 176; +pub const SYS_getegid: ::c_long = 177; +pub const SYS_gettid: ::c_long = 178; +pub const SYS_sysinfo: ::c_long = 179; +pub const SYS_mq_open: ::c_long = 180; +pub const SYS_mq_unlink: ::c_long = 181; +pub const SYS_mq_timedsend: ::c_long = 182; +pub const SYS_mq_timedreceive: ::c_long = 183; +pub const SYS_mq_notify: ::c_long = 184; +pub const SYS_mq_getsetattr: ::c_long = 185; +pub const SYS_msgget: ::c_long = 186; +pub const SYS_msgctl: ::c_long = 187; +pub const SYS_msgrcv: ::c_long = 188; +pub const SYS_msgsnd: ::c_long = 189; +pub const SYS_semget: ::c_long = 190; +pub const SYS_semctl: ::c_long = 191; +pub const SYS_semtimedop: ::c_long = 192; +pub const SYS_semop: ::c_long = 193; +pub const SYS_shmget: ::c_long = 194; +pub const SYS_shmctl: ::c_long = 195; +pub const SYS_shmat: ::c_long = 196; +pub const SYS_shmdt: ::c_long = 197; +pub const SYS_socket: ::c_long = 198; +pub const SYS_socketpair: ::c_long = 199; +pub const SYS_bind: ::c_long = 200; +pub const SYS_listen: ::c_long = 201; +pub const SYS_accept: ::c_long = 202; +pub const SYS_connect: ::c_long = 203; +pub const SYS_getsockname: ::c_long = 204; +pub const SYS_getpeername: ::c_long = 205; +pub const SYS_sendto: ::c_long = 206; +pub const SYS_recvfrom: ::c_long = 207; +pub const SYS_setsockopt: ::c_long = 208; +pub const SYS_getsockopt: ::c_long = 209; +pub const SYS_shutdown: ::c_long = 210; +pub const SYS_sendmsg: ::c_long = 211; +pub const SYS_recvmsg: ::c_long = 212; +pub const SYS_readahead: ::c_long = 213; +pub const SYS_brk: ::c_long = 214; +pub const SYS_munmap: ::c_long = 215; +pub const SYS_mremap: ::c_long = 216; +pub const SYS_add_key: ::c_long = 217; +pub const SYS_request_key: ::c_long = 218; +pub const SYS_keyctl: ::c_long = 219; +pub const SYS_clone: ::c_long = 220; +pub const SYS_execve: ::c_long = 221; +pub const SYS_swapon: ::c_long = 224; +pub const SYS_swapoff: ::c_long = 225; +pub const SYS_mprotect: ::c_long = 226; +pub const SYS_msync: ::c_long = 227; +pub const SYS_mlock: ::c_long = 228; +pub const SYS_munlock: ::c_long = 229; +pub const SYS_mlockall: ::c_long = 230; +pub const SYS_munlockall: ::c_long = 231; +pub const SYS_mincore: ::c_long = 232; +pub const SYS_madvise: ::c_long = 233; +pub const SYS_remap_file_pages: ::c_long = 234; +pub const SYS_mbind: ::c_long = 235; +pub const SYS_get_mempolicy: ::c_long = 236; +pub const SYS_set_mempolicy: ::c_long = 237; +pub const SYS_migrate_pages: ::c_long = 238; +pub const SYS_move_pages: ::c_long = 239; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 240; +pub const SYS_perf_event_open: ::c_long = 241; +pub const SYS_accept4: ::c_long = 242; +pub const SYS_recvmmsg: ::c_long = 243; +pub const SYS_arch_specific_syscall: ::c_long = 244; +pub const SYS_wait4: ::c_long = 260; +pub const SYS_prlimit64: ::c_long = 261; +pub const SYS_fanotify_init: ::c_long = 262; +pub const SYS_fanotify_mark: ::c_long = 263; +pub const SYS_name_to_handle_at: ::c_long = 264; +pub const SYS_open_by_handle_at: ::c_long = 265; +pub const SYS_clock_adjtime: ::c_long = 266; +pub const SYS_syncfs: ::c_long = 267; +pub const SYS_setns: ::c_long = 268; +pub const SYS_sendmmsg: ::c_long = 269; +pub const SYS_process_vm_readv: ::c_long = 270; +pub const SYS_process_vm_writev: ::c_long = 271; +pub const SYS_kcmp: ::c_long = 272; +pub const SYS_finit_module: ::c_long = 273; +pub const SYS_sched_setattr: ::c_long = 274; +pub const SYS_sched_getattr: ::c_long = 275; +pub const SYS_renameat2: ::c_long = 276; +pub const SYS_seccomp: ::c_long = 277; +pub const SYS_getrandom: ::c_long = 278; +pub const SYS_memfd_create: ::c_long = 279; +pub const SYS_bpf: ::c_long = 280; +pub const SYS_execveat: ::c_long = 281; +pub const SYS_userfaultfd: ::c_long = 282; +pub const SYS_membarrier: ::c_long = 283; +pub const SYS_mlock2: ::c_long = 284; +pub const SYS_copy_file_range: ::c_long = 285; +pub const SYS_preadv2: ::c_long = 286; +pub const SYS_pwritev2: ::c_long = 287; +pub const SYS_pkey_mprotect: ::c_long = 288; +pub const SYS_pkey_alloc: ::c_long = 289; +pub const SYS_pkey_free: ::c_long = 290; +pub const SYS_syscalls: ::c_long = 292; diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/android/b64/mod.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/android/b64/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/android/b64/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/android/b64/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,281 @@ +// The following definitions are correct for aarch64 and x86_64, +// but may be wrong for mips64 + +pub type c_long = i64; +pub type c_ulong = u64; +pub type mode_t = u32; +pub type off64_t = i64; +pub type socklen_t = u32; + +s! { + pub struct sigset_t { + __val: [::c_ulong; 1], + } + + pub struct sigaction { + pub sa_flags: ::c_int, + pub sa_sigaction: ::sighandler_t, + pub sa_mask: ::sigset_t, + pub sa_restorer: ::Option, + } + + pub struct rlimit64 { + pub rlim_cur: ::c_ulonglong, + pub rlim_max: ::c_ulonglong, + } + + pub struct pthread_attr_t { + pub flags: u32, + pub stack_base: *mut ::c_void, + pub stack_size: ::size_t, + pub guard_size: ::size_t, + pub sched_policy: i32, + pub sched_priority: i32, + __reserved: [::c_char; 16], + } + + pub struct passwd { + pub pw_name: *mut ::c_char, + pub pw_passwd: *mut ::c_char, + pub pw_uid: ::uid_t, + pub pw_gid: ::gid_t, + pub pw_gecos: *mut ::c_char, + pub pw_dir: *mut ::c_char, + pub pw_shell: *mut ::c_char, + } + + pub struct statfs { + pub f_type: u64, + pub f_bsize: u64, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_fsid: ::__fsid_t, + pub f_namelen: u64, + pub f_frsize: u64, + pub f_flags: u64, + pub f_spare: [u64; 4], + } + + pub struct sysinfo { + pub uptime: ::c_long, + pub loads: [::c_ulong; 3], + pub totalram: ::c_ulong, + pub freeram: ::c_ulong, + pub sharedram: ::c_ulong, + pub bufferram: ::c_ulong, + pub totalswap: ::c_ulong, + pub freeswap: ::c_ulong, + pub procs: ::c_ushort, + pub pad: ::c_ushort, + pub totalhigh: ::c_ulong, + pub freehigh: ::c_ulong, + pub mem_unit: ::c_uint, + pub _f: [::c_char; 0], + } + + pub struct statfs64 { + pub f_type: u64, + pub f_bsize: u64, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + f_fsid: [u32; 2], + pub f_namelen: u64, + pub f_frsize: u64, + pub f_flags: u64, + pub f_spare: [u64; 4], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: u64, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } +} + +s_no_extra_traits!{ + pub struct pthread_mutex_t { + value: ::c_int, + __reserved: [::c_char; 36], + } + + pub struct pthread_cond_t { + value: ::c_int, + __reserved: [::c_char; 44], + } + + pub struct pthread_rwlock_t { + numLocks: ::c_int, + writerThreadId: ::c_int, + pendingReaders: ::c_int, + pendingWriters: ::c_int, + attr: i32, + __reserved: [::c_char; 36], + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for pthread_mutex_t { + fn eq(&self, other: &pthread_mutex_t) -> bool { + self.value == other.value + && self + .__reserved + .iter() + .zip(other.__reserved.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for pthread_mutex_t {} + + impl ::fmt::Debug for pthread_mutex_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("pthread_mutex_t") + .field("value", &self.value) + // FIXME: .field("__reserved", &self.__reserved) + .finish() + } + } + + impl ::hash::Hash for pthread_mutex_t { + fn hash(&self, state: &mut H) { + self.value.hash(state); + self.__reserved.hash(state); + } + } + + impl PartialEq for pthread_cond_t { + fn eq(&self, other: &pthread_cond_t) -> bool { + self.value == other.value + && self + .__reserved + .iter() + .zip(other.__reserved.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for pthread_cond_t {} + + impl ::fmt::Debug for pthread_cond_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("pthread_cond_t") + .field("value", &self.value) + // FIXME: .field("__reserved", &self.__reserved) + .finish() + } + } + + impl ::hash::Hash for pthread_cond_t { + fn hash(&self, state: &mut H) { + self.value.hash(state); + self.__reserved.hash(state); + } + } + + impl PartialEq for pthread_rwlock_t { + fn eq(&self, other: &pthread_rwlock_t) -> bool { + self.numLocks == other.numLocks + && self.writerThreadId == other.writerThreadId + && self.pendingReaders == other.pendingReaders + && self.pendingWriters == other.pendingWriters + && self.attr == other.attr + && self + .__reserved + .iter() + .zip(other.__reserved.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for pthread_rwlock_t {} + + impl ::fmt::Debug for pthread_rwlock_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("pthread_rwlock_t") + .field("numLocks", &self.numLocks) + .field("writerThreadId", &self.writerThreadId) + .field("pendingReaders", &self.pendingReaders) + .field("pendingWriters", &self.pendingWriters) + .field("attr", &self.attr) + // FIXME: .field("__reserved", &self.__reserved) + .finish() + } + } + + impl ::hash::Hash for pthread_rwlock_t { + fn hash(&self, state: &mut H) { + self.numLocks.hash(state); + self.writerThreadId.hash(state); + self.pendingReaders.hash(state); + self.pendingWriters.hash(state); + self.attr.hash(state); + self.__reserved.hash(state); + } + } + } +} + +// These constants must be of the same type of sigaction.sa_flags +pub const SA_NOCLDSTOP: ::c_int = 0x00000001; +pub const SA_NOCLDWAIT: ::c_int = 0x00000002; +pub const SA_NODEFER: ::c_int = 0x40000000; +pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_RESETHAND: ::c_int = 0x80000000; +pub const SA_RESTART: ::c_int = 0x10000000; +pub const SA_SIGINFO: ::c_int = 0x00000004; + +pub const RTLD_GLOBAL: ::c_int = 0x00100; +pub const RTLD_NOW: ::c_int = 2; +pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; + +pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { + value: 0, + __reserved: [0; 36], +}; +pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { + value: 0, + __reserved: [0; 44], +}; +pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { + numLocks: 0, + writerThreadId: 0, + pendingReaders: 0, + pendingWriters: 0, + attr: 0, + __reserved: [0; 36], +}; +pub const PTHREAD_STACK_MIN: ::size_t = 4096 * 4; +pub const CPU_SETSIZE: ::size_t = 1024; +pub const __CPU_BITS: ::size_t = 64; + +pub const UT_LINESIZE: usize = 32; +pub const UT_NAMESIZE: usize = 32; +pub const UT_HOSTSIZE: usize = 256; + +cfg_if! { + if #[cfg(target_arch = "x86_64")] { + mod x86_64; + pub use self::x86_64::*; + } else if #[cfg(target_arch = "aarch64")] { + mod aarch64; + pub use self::aarch64::*; + } else { + // Unknown target_arch + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/android/b64/x86_64.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/android/b64/x86_64.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/android/b64/x86_64.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/android/b64/x86_64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,420 @@ +pub type c_char = i8; +pub type wchar_t = i32; + +s! { + pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_nlink: ::c_ulong, + pub st_mode: ::c_uint, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + pub st_size: ::off64_t, + pub st_blksize: ::c_long, + pub st_blocks: ::c_long, + pub st_atime: ::c_long, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::c_long, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::c_long, + pub st_ctime_nsec: ::c_long, + __unused: [::c_long; 3], + } + + pub struct stat64 { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_nlink: ::c_ulong, + pub st_mode: ::c_uint, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + pub st_size: ::off64_t, + pub st_blksize: ::c_long, + pub st_blocks: ::c_long, + pub st_atime: ::c_long, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::c_long, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::c_long, + pub st_ctime_nsec: ::c_long, + __unused: [::c_long; 3], + } +} + +pub const O_DIRECT: ::c_int = 0x4000; +pub const O_DIRECTORY: ::c_int = 0x10000; +pub const O_NOFOLLOW: ::c_int = 0x20000; +pub const O_LARGEFILE: ::c_int = 0o0100000; + +pub const SIGSTKSZ: ::size_t = 8192; +pub const MINSIGSTKSZ: ::size_t = 2048; + +pub const MAP_32BIT: ::c_int = 0x40; + +// Syscall table + +pub const SYS_read: ::c_long = 0; +pub const SYS_write: ::c_long = 1; +pub const SYS_open: ::c_long = 2; +pub const SYS_close: ::c_long = 3; +pub const SYS_stat: ::c_long = 4; +pub const SYS_fstat: ::c_long = 5; +pub const SYS_lstat: ::c_long = 6; +pub const SYS_poll: ::c_long = 7; +pub const SYS_lseek: ::c_long = 8; +pub const SYS_mmap: ::c_long = 9; +pub const SYS_mprotect: ::c_long = 10; +pub const SYS_munmap: ::c_long = 11; +pub const SYS_brk: ::c_long = 12; +pub const SYS_rt_sigaction: ::c_long = 13; +pub const SYS_rt_sigprocmask: ::c_long = 14; +pub const SYS_rt_sigreturn: ::c_long = 15; +pub const SYS_ioctl: ::c_long = 16; +pub const SYS_pread64: ::c_long = 17; +pub const SYS_pwrite64: ::c_long = 18; +pub const SYS_readv: ::c_long = 19; +pub const SYS_writev: ::c_long = 20; +pub const SYS_access: ::c_long = 21; +pub const SYS_pipe: ::c_long = 22; +pub const SYS_select: ::c_long = 23; +pub const SYS_sched_yield: ::c_long = 24; +pub const SYS_mremap: ::c_long = 25; +pub const SYS_msync: ::c_long = 26; +pub const SYS_mincore: ::c_long = 27; +pub const SYS_madvise: ::c_long = 28; +pub const SYS_shmget: ::c_long = 29; +pub const SYS_shmat: ::c_long = 30; +pub const SYS_shmctl: ::c_long = 31; +pub const SYS_dup: ::c_long = 32; +pub const SYS_dup2: ::c_long = 33; +pub const SYS_pause: ::c_long = 34; +pub const SYS_nanosleep: ::c_long = 35; +pub const SYS_getitimer: ::c_long = 36; +pub const SYS_alarm: ::c_long = 37; +pub const SYS_setitimer: ::c_long = 38; +pub const SYS_getpid: ::c_long = 39; +pub const SYS_sendfile: ::c_long = 40; +pub const SYS_socket: ::c_long = 41; +pub const SYS_connect: ::c_long = 42; +pub const SYS_accept: ::c_long = 43; +pub const SYS_sendto: ::c_long = 44; +pub const SYS_recvfrom: ::c_long = 45; +pub const SYS_sendmsg: ::c_long = 46; +pub const SYS_recvmsg: ::c_long = 47; +pub const SYS_shutdown: ::c_long = 48; +pub const SYS_bind: ::c_long = 49; +pub const SYS_listen: ::c_long = 50; +pub const SYS_getsockname: ::c_long = 51; +pub const SYS_getpeername: ::c_long = 52; +pub const SYS_socketpair: ::c_long = 53; +pub const SYS_setsockopt: ::c_long = 54; +pub const SYS_getsockopt: ::c_long = 55; +pub const SYS_clone: ::c_long = 56; +pub const SYS_fork: ::c_long = 57; +pub const SYS_vfork: ::c_long = 58; +pub const SYS_execve: ::c_long = 59; +pub const SYS_exit: ::c_long = 60; +pub const SYS_wait4: ::c_long = 61; +pub const SYS_kill: ::c_long = 62; +pub const SYS_uname: ::c_long = 63; +pub const SYS_semget: ::c_long = 64; +pub const SYS_semop: ::c_long = 65; +pub const SYS_semctl: ::c_long = 66; +pub const SYS_shmdt: ::c_long = 67; +pub const SYS_msgget: ::c_long = 68; +pub const SYS_msgsnd: ::c_long = 69; +pub const SYS_msgrcv: ::c_long = 70; +pub const SYS_msgctl: ::c_long = 71; +pub const SYS_fcntl: ::c_long = 72; +pub const SYS_flock: ::c_long = 73; +pub const SYS_fsync: ::c_long = 74; +pub const SYS_fdatasync: ::c_long = 75; +pub const SYS_truncate: ::c_long = 76; +pub const SYS_ftruncate: ::c_long = 77; +pub const SYS_getdents: ::c_long = 78; +pub const SYS_getcwd: ::c_long = 79; +pub const SYS_chdir: ::c_long = 80; +pub const SYS_fchdir: ::c_long = 81; +pub const SYS_rename: ::c_long = 82; +pub const SYS_mkdir: ::c_long = 83; +pub const SYS_rmdir: ::c_long = 84; +pub const SYS_creat: ::c_long = 85; +pub const SYS_link: ::c_long = 86; +pub const SYS_unlink: ::c_long = 87; +pub const SYS_symlink: ::c_long = 88; +pub const SYS_readlink: ::c_long = 89; +pub const SYS_chmod: ::c_long = 90; +pub const SYS_fchmod: ::c_long = 91; +pub const SYS_chown: ::c_long = 92; +pub const SYS_fchown: ::c_long = 93; +pub const SYS_lchown: ::c_long = 94; +pub const SYS_umask: ::c_long = 95; +pub const SYS_gettimeofday: ::c_long = 96; +pub const SYS_getrlimit: ::c_long = 97; +pub const SYS_getrusage: ::c_long = 98; +pub const SYS_sysinfo: ::c_long = 99; +pub const SYS_times: ::c_long = 100; +pub const SYS_ptrace: ::c_long = 101; +pub const SYS_getuid: ::c_long = 102; +pub const SYS_syslog: ::c_long = 103; +pub const SYS_getgid: ::c_long = 104; +pub const SYS_setuid: ::c_long = 105; +pub const SYS_setgid: ::c_long = 106; +pub const SYS_geteuid: ::c_long = 107; +pub const SYS_getegid: ::c_long = 108; +pub const SYS_setpgid: ::c_long = 109; +pub const SYS_getppid: ::c_long = 110; +pub const SYS_getpgrp: ::c_long = 111; +pub const SYS_setsid: ::c_long = 112; +pub const SYS_setreuid: ::c_long = 113; +pub const SYS_setregid: ::c_long = 114; +pub const SYS_getgroups: ::c_long = 115; +pub const SYS_setgroups: ::c_long = 116; +pub const SYS_setresuid: ::c_long = 117; +pub const SYS_getresuid: ::c_long = 118; +pub const SYS_setresgid: ::c_long = 119; +pub const SYS_getresgid: ::c_long = 120; +pub const SYS_getpgid: ::c_long = 121; +pub const SYS_setfsuid: ::c_long = 122; +pub const SYS_setfsgid: ::c_long = 123; +pub const SYS_getsid: ::c_long = 124; +pub const SYS_capget: ::c_long = 125; +pub const SYS_capset: ::c_long = 126; +pub const SYS_rt_sigpending: ::c_long = 127; +pub const SYS_rt_sigtimedwait: ::c_long = 128; +pub const SYS_rt_sigqueueinfo: ::c_long = 129; +pub const SYS_rt_sigsuspend: ::c_long = 130; +pub const SYS_sigaltstack: ::c_long = 131; +pub const SYS_utime: ::c_long = 132; +pub const SYS_mknod: ::c_long = 133; +pub const SYS_uselib: ::c_long = 134; +pub const SYS_personality: ::c_long = 135; +pub const SYS_ustat: ::c_long = 136; +pub const SYS_statfs: ::c_long = 137; +pub const SYS_fstatfs: ::c_long = 138; +pub const SYS_sysfs: ::c_long = 139; +pub const SYS_getpriority: ::c_long = 140; +pub const SYS_setpriority: ::c_long = 141; +pub const SYS_sched_setparam: ::c_long = 142; +pub const SYS_sched_getparam: ::c_long = 143; +pub const SYS_sched_setscheduler: ::c_long = 144; +pub const SYS_sched_getscheduler: ::c_long = 145; +pub const SYS_sched_get_priority_max: ::c_long = 146; +pub const SYS_sched_get_priority_min: ::c_long = 147; +pub const SYS_sched_rr_get_interval: ::c_long = 148; +pub const SYS_mlock: ::c_long = 149; +pub const SYS_munlock: ::c_long = 150; +pub const SYS_mlockall: ::c_long = 151; +pub const SYS_munlockall: ::c_long = 152; +pub const SYS_vhangup: ::c_long = 153; +pub const SYS_modify_ldt: ::c_long = 154; +pub const SYS_pivot_root: ::c_long = 155; +// FIXME: SYS__sysctl is in the NDK sources but for some reason is +// not available in the tests +// pub const SYS__sysctl: ::c_long = 156; +pub const SYS_prctl: ::c_long = 157; +pub const SYS_arch_prctl: ::c_long = 158; +pub const SYS_adjtimex: ::c_long = 159; +pub const SYS_setrlimit: ::c_long = 160; +pub const SYS_chroot: ::c_long = 161; +pub const SYS_sync: ::c_long = 162; +pub const SYS_acct: ::c_long = 163; +pub const SYS_settimeofday: ::c_long = 164; +pub const SYS_mount: ::c_long = 165; +pub const SYS_umount2: ::c_long = 166; +pub const SYS_swapon: ::c_long = 167; +pub const SYS_swapoff: ::c_long = 168; +pub const SYS_reboot: ::c_long = 169; +pub const SYS_sethostname: ::c_long = 170; +pub const SYS_setdomainname: ::c_long = 171; +pub const SYS_iopl: ::c_long = 172; +pub const SYS_ioperm: ::c_long = 173; +pub const SYS_create_module: ::c_long = 174; +pub const SYS_init_module: ::c_long = 175; +pub const SYS_delete_module: ::c_long = 176; +pub const SYS_get_kernel_syms: ::c_long = 177; +pub const SYS_query_module: ::c_long = 178; +pub const SYS_quotactl: ::c_long = 179; +pub const SYS_nfsservctl: ::c_long = 180; +pub const SYS_getpmsg: ::c_long = 181; +pub const SYS_putpmsg: ::c_long = 182; +pub const SYS_afs_syscall: ::c_long = 183; +pub const SYS_tuxcall: ::c_long = 184; +pub const SYS_security: ::c_long = 185; +pub const SYS_gettid: ::c_long = 186; +pub const SYS_readahead: ::c_long = 187; +pub const SYS_setxattr: ::c_long = 188; +pub const SYS_lsetxattr: ::c_long = 189; +pub const SYS_fsetxattr: ::c_long = 190; +pub const SYS_getxattr: ::c_long = 191; +pub const SYS_lgetxattr: ::c_long = 192; +pub const SYS_fgetxattr: ::c_long = 193; +pub const SYS_listxattr: ::c_long = 194; +pub const SYS_llistxattr: ::c_long = 195; +pub const SYS_flistxattr: ::c_long = 196; +pub const SYS_removexattr: ::c_long = 197; +pub const SYS_lremovexattr: ::c_long = 198; +pub const SYS_fremovexattr: ::c_long = 199; +pub const SYS_tkill: ::c_long = 200; +pub const SYS_time: ::c_long = 201; +pub const SYS_futex: ::c_long = 202; +pub const SYS_sched_setaffinity: ::c_long = 203; +pub const SYS_sched_getaffinity: ::c_long = 204; +pub const SYS_set_thread_area: ::c_long = 205; +pub const SYS_io_setup: ::c_long = 206; +pub const SYS_io_destroy: ::c_long = 207; +pub const SYS_io_getevents: ::c_long = 208; +pub const SYS_io_submit: ::c_long = 209; +pub const SYS_io_cancel: ::c_long = 210; +pub const SYS_get_thread_area: ::c_long = 211; +pub const SYS_lookup_dcookie: ::c_long = 212; +pub const SYS_epoll_create: ::c_long = 213; +pub const SYS_epoll_ctl_old: ::c_long = 214; +pub const SYS_epoll_wait_old: ::c_long = 215; +pub const SYS_remap_file_pages: ::c_long = 216; +pub const SYS_getdents64: ::c_long = 217; +pub const SYS_set_tid_address: ::c_long = 218; +pub const SYS_restart_syscall: ::c_long = 219; +pub const SYS_semtimedop: ::c_long = 220; +pub const SYS_fadvise64: ::c_long = 221; +pub const SYS_timer_create: ::c_long = 222; +pub const SYS_timer_settime: ::c_long = 223; +pub const SYS_timer_gettime: ::c_long = 224; +pub const SYS_timer_getoverrun: ::c_long = 225; +pub const SYS_timer_delete: ::c_long = 226; +pub const SYS_clock_settime: ::c_long = 227; +pub const SYS_clock_gettime: ::c_long = 228; +pub const SYS_clock_getres: ::c_long = 229; +pub const SYS_clock_nanosleep: ::c_long = 230; +pub const SYS_exit_group: ::c_long = 231; +pub const SYS_epoll_wait: ::c_long = 232; +pub const SYS_epoll_ctl: ::c_long = 233; +pub const SYS_tgkill: ::c_long = 234; +pub const SYS_utimes: ::c_long = 235; +pub const SYS_vserver: ::c_long = 236; +pub const SYS_mbind: ::c_long = 237; +pub const SYS_set_mempolicy: ::c_long = 238; +pub const SYS_get_mempolicy: ::c_long = 239; +pub const SYS_mq_open: ::c_long = 240; +pub const SYS_mq_unlink: ::c_long = 241; +pub const SYS_mq_timedsend: ::c_long = 242; +pub const SYS_mq_timedreceive: ::c_long = 243; +pub const SYS_mq_notify: ::c_long = 244; +pub const SYS_mq_getsetattr: ::c_long = 245; +pub const SYS_kexec_load: ::c_long = 246; +pub const SYS_waitid: ::c_long = 247; +pub const SYS_add_key: ::c_long = 248; +pub const SYS_request_key: ::c_long = 249; +pub const SYS_keyctl: ::c_long = 250; +pub const SYS_ioprio_set: ::c_long = 251; +pub const SYS_ioprio_get: ::c_long = 252; +pub const SYS_inotify_init: ::c_long = 253; +pub const SYS_inotify_add_watch: ::c_long = 254; +pub const SYS_inotify_rm_watch: ::c_long = 255; +pub const SYS_migrate_pages: ::c_long = 256; +pub const SYS_openat: ::c_long = 257; +pub const SYS_mkdirat: ::c_long = 258; +pub const SYS_mknodat: ::c_long = 259; +pub const SYS_fchownat: ::c_long = 260; +pub const SYS_futimesat: ::c_long = 261; +pub const SYS_newfstatat: ::c_long = 262; +pub const SYS_unlinkat: ::c_long = 263; +pub const SYS_renameat: ::c_long = 264; +pub const SYS_linkat: ::c_long = 265; +pub const SYS_symlinkat: ::c_long = 266; +pub const SYS_readlinkat: ::c_long = 267; +pub const SYS_fchmodat: ::c_long = 268; +pub const SYS_faccessat: ::c_long = 269; +pub const SYS_pselect6: ::c_long = 270; +pub const SYS_ppoll: ::c_long = 271; +pub const SYS_unshare: ::c_long = 272; +pub const SYS_set_robust_list: ::c_long = 273; +pub const SYS_get_robust_list: ::c_long = 274; +pub const SYS_splice: ::c_long = 275; +pub const SYS_tee: ::c_long = 276; +pub const SYS_sync_file_range: ::c_long = 277; +pub const SYS_vmsplice: ::c_long = 278; +pub const SYS_move_pages: ::c_long = 279; +pub const SYS_utimensat: ::c_long = 280; +pub const SYS_epoll_pwait: ::c_long = 281; +pub const SYS_signalfd: ::c_long = 282; +pub const SYS_timerfd_create: ::c_long = 283; +pub const SYS_eventfd: ::c_long = 284; +pub const SYS_fallocate: ::c_long = 285; +pub const SYS_timerfd_settime: ::c_long = 286; +pub const SYS_timerfd_gettime: ::c_long = 287; +pub const SYS_accept4: ::c_long = 288; +pub const SYS_signalfd4: ::c_long = 289; +pub const SYS_eventfd2: ::c_long = 290; +pub const SYS_epoll_create1: ::c_long = 291; +pub const SYS_dup3: ::c_long = 292; +pub const SYS_pipe2: ::c_long = 293; +pub const SYS_inotify_init1: ::c_long = 294; +pub const SYS_preadv: ::c_long = 295; +pub const SYS_pwritev: ::c_long = 296; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 297; +pub const SYS_perf_event_open: ::c_long = 298; +pub const SYS_recvmmsg: ::c_long = 299; +pub const SYS_fanotify_init: ::c_long = 300; +pub const SYS_fanotify_mark: ::c_long = 301; +pub const SYS_prlimit64: ::c_long = 302; +pub const SYS_name_to_handle_at: ::c_long = 303; +pub const SYS_open_by_handle_at: ::c_long = 304; +pub const SYS_clock_adjtime: ::c_long = 305; +pub const SYS_syncfs: ::c_long = 306; +pub const SYS_sendmmsg: ::c_long = 307; +pub const SYS_setns: ::c_long = 308; +pub const SYS_getcpu: ::c_long = 309; +pub const SYS_process_vm_readv: ::c_long = 310; +pub const SYS_process_vm_writev: ::c_long = 311; +pub const SYS_kcmp: ::c_long = 312; +pub const SYS_finit_module: ::c_long = 313; +pub const SYS_sched_setattr: ::c_long = 314; +pub const SYS_sched_getattr: ::c_long = 315; +pub const SYS_renameat2: ::c_long = 316; +pub const SYS_seccomp: ::c_long = 317; +pub const SYS_getrandom: ::c_long = 318; +pub const SYS_memfd_create: ::c_long = 319; +pub const SYS_kexec_file_load: ::c_long = 320; +pub const SYS_bpf: ::c_long = 321; +pub const SYS_execveat: ::c_long = 322; +pub const SYS_userfaultfd: ::c_long = 323; +pub const SYS_membarrier: ::c_long = 324; +pub const SYS_mlock2: ::c_long = 325; +pub const SYS_copy_file_range: ::c_long = 326; +pub const SYS_preadv2: ::c_long = 327; +pub const SYS_pwritev2: ::c_long = 328; +pub const SYS_pkey_mprotect: ::c_long = 329; +pub const SYS_pkey_alloc: ::c_long = 330; +pub const SYS_pkey_free: ::c_long = 331; + +// offsets in user_regs_structs, from sys/reg.h +pub const R15: ::c_int = 0; +pub const R14: ::c_int = 1; +pub const R13: ::c_int = 2; +pub const R12: ::c_int = 3; +pub const RBP: ::c_int = 4; +pub const RBX: ::c_int = 5; +pub const R11: ::c_int = 6; +pub const R10: ::c_int = 7; +pub const R9: ::c_int = 8; +pub const R8: ::c_int = 9; +pub const RAX: ::c_int = 10; +pub const RCX: ::c_int = 11; +pub const RDX: ::c_int = 12; +pub const RSI: ::c_int = 13; +pub const RDI: ::c_int = 14; +pub const ORIG_RAX: ::c_int = 15; +pub const RIP: ::c_int = 16; +pub const CS: ::c_int = 17; +pub const EFLAGS: ::c_int = 18; +pub const RSP: ::c_int = 19; +pub const SS: ::c_int = 20; +pub const FS_BASE: ::c_int = 21; +pub const GS_BASE: ::c_int = 22; +pub const DS: ::c_int = 23; +pub const ES: ::c_int = 24; +pub const FS: ::c_int = 25; +pub const GS: ::c_int = 26; diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/android/mod.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/android/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/android/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/android/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,2209 @@ +//! Android-specific definitions for linux-like values + +pub type clock_t = ::c_long; +pub type time_t = ::c_long; +pub type suseconds_t = ::c_long; +pub type off_t = ::c_long; +pub type blkcnt_t = ::c_ulong; +pub type blksize_t = ::c_ulong; +pub type nlink_t = u32; +pub type useconds_t = u32; +pub type pthread_t = ::c_long; +pub type pthread_mutexattr_t = ::c_long; +pub type pthread_rwlockattr_t = ::c_long; +pub type pthread_condattr_t = ::c_long; +pub type pthread_key_t = ::c_int; +pub type fsfilcnt_t = ::c_ulong; +pub type fsblkcnt_t = ::c_ulong; +pub type nfds_t = ::c_uint; +pub type rlim_t = ::c_ulong; +pub type dev_t = ::c_ulong; +pub type ino_t = ::c_ulong; +pub type __CPU_BITTYPE = ::c_ulong; +pub type idtype_t = ::c_int; +pub type loff_t = ::c_longlong; + +s! { + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_flags: ::c_int, + pub ss_size: ::size_t + } + + pub struct __fsid_t { + __val: [::c_int; 2], + } + + pub struct msghdr { + pub msg_name: *mut ::c_void, + pub msg_namelen: ::socklen_t, + pub msg_iov: *mut ::iovec, + pub msg_iovlen: ::size_t, + pub msg_control: *mut ::c_void, + pub msg_controllen: ::size_t, + pub msg_flags: ::c_int, + } + + pub struct cmsghdr { + pub cmsg_len: ::size_t, + pub cmsg_level: ::c_int, + pub cmsg_type: ::c_int, + } + + pub struct termios { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; ::NCCS], + } + + pub struct termios2 { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; 19], + pub c_ispeed: ::speed_t, + pub c_ospeed: ::speed_t, + } + + pub struct flock { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off_t, + pub l_len: ::off_t, + pub l_pid: ::pid_t, + } + + pub struct cpu_set_t { + #[cfg(target_pointer_width = "64")] + __bits: [__CPU_BITTYPE; 16], + #[cfg(target_pointer_width = "32")] + __bits: [__CPU_BITTYPE; 1], + } + + pub struct sem_t { + count: ::c_uint, + #[cfg(target_pointer_width = "64")] + __reserved: [::c_int; 3], + } + + pub struct exit_status { + pub e_termination: ::c_short, + pub e_exit: ::c_short, + } + + pub struct statvfs { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_favail: ::fsfilcnt_t, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + #[cfg(target_pointer_width = "64")] + __f_reserved: [u32; 6], + } + + pub struct signalfd_siginfo { + pub ssi_signo: u32, + pub ssi_errno: i32, + pub ssi_code: i32, + pub ssi_pid: u32, + pub ssi_uid: u32, + pub ssi_fd: i32, + pub ssi_tid: u32, + pub ssi_band: u32, + pub ssi_overrun: u32, + pub ssi_trapno: u32, + pub ssi_status: i32, + pub ssi_int: i32, + pub ssi_ptr: ::c_ulonglong, + pub ssi_utime: ::c_ulonglong, + pub ssi_stime: ::c_ulonglong, + pub ssi_addr: ::c_ulonglong, + pub ssi_addr_lsb: u16, + _pad2: u16, + pub ssi_syscall: i32, + pub ssi_call_addr: u64, + pub ssi_arch: u32, + _pad: [u8; 28], + } + + pub struct ucred { + pub pid: ::pid_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + } + + pub struct genlmsghdr { + pub cmd: u8, + pub version: u8, + pub reserved: u16, + } + + pub struct nlmsghdr { + pub nlmsg_len: u32, + pub nlmsg_type: u16, + pub nlmsg_flags: u16, + pub nlmsg_seq: u32, + pub nlmsg_pid: u32, + } + + pub struct nlmsgerr { + pub error: ::c_int, + pub msg: nlmsghdr, + } + + pub struct nl_pktinfo { + pub group: u32, + } + + pub struct nl_mmap_req { + pub nm_block_size: ::c_uint, + pub nm_block_nr: ::c_uint, + pub nm_frame_size: ::c_uint, + pub nm_frame_nr: ::c_uint, + } + + pub struct nl_mmap_hdr { + pub nm_status: ::c_uint, + pub nm_len: ::c_uint, + pub nm_group: u32, + pub nm_pid: u32, + pub nm_uid: u32, + pub nm_gid: u32, + } + + pub struct nlattr { + pub nla_len: u16, + pub nla_type: u16, + } + + pub struct in6_pktinfo { + pub ipi6_addr: ::in6_addr, + pub ipi6_ifindex: ::c_int, + } + + pub struct inotify_event { + pub wd: ::c_int, + pub mask: u32, + pub cookie: u32, + pub len: u32 + } +} + +s_no_extra_traits!{ + pub struct sockaddr_nl { + pub nl_family: ::sa_family_t, + nl_pad: ::c_ushort, + pub nl_pid: u32, + pub nl_groups: u32 + } + + pub struct dirent { + pub d_ino: u64, + pub d_off: i64, + pub d_reclen: ::c_ushort, + pub d_type: ::c_uchar, + pub d_name: [::c_char; 256], + } + + pub struct dirent64 { + pub d_ino: u64, + pub d_off: i64, + pub d_reclen: ::c_ushort, + pub d_type: ::c_uchar, + pub d_name: [::c_char; 256], + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + pub _pad: [::c_int; 29], + _align: [usize; 0], + } + + pub struct lastlog { + ll_time: ::time_t, + ll_line: [::c_char; UT_LINESIZE], + ll_host: [::c_char; UT_HOSTSIZE], + } + + pub struct utmp { + pub ut_type: ::c_short, + pub ut_pid: ::pid_t, + pub ut_line: [::c_char; UT_LINESIZE], + pub ut_id: [::c_char; 4], + pub ut_user: [::c_char; UT_NAMESIZE], + pub ut_host: [::c_char; UT_HOSTSIZE], + pub ut_exit: exit_status, + pub ut_session: ::c_long, + pub ut_tv: ::timeval, + pub ut_addr_v6: [i32; 4], + unused: [::c_char; 20], + } + + pub struct sockaddr_alg { + pub salg_family: ::sa_family_t, + pub salg_type: [::c_uchar; 14], + pub salg_feat: u32, + pub salg_mask: u32, + pub salg_name: [::c_uchar; 64], + } + + pub struct af_alg_iv { + pub ivlen: u32, + pub iv: [::c_uchar; 0], + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for sockaddr_nl { + fn eq(&self, other: &sockaddr_nl) -> bool { + self.nl_family == other.nl_family && + self.nl_pid == other.nl_pid && + self.nl_groups == other.nl_groups + } + } + impl Eq for sockaddr_nl {} + impl ::fmt::Debug for sockaddr_nl { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sockaddr_nl") + .field("nl_family", &self.nl_family) + .field("nl_pid", &self.nl_pid) + .field("nl_groups", &self.nl_groups) + .finish() + } + } + impl ::hash::Hash for sockaddr_nl { + fn hash(&self, state: &mut H) { + self.nl_family.hash(state); + self.nl_pid.hash(state); + self.nl_groups.hash(state); + } + } + + impl PartialEq for dirent { + fn eq(&self, other: &dirent) -> bool { + self.d_ino == other.d_ino + && self.d_off == other.d_off + && self.d_reclen == other.d_reclen + && self.d_type == other.d_type + && self + .d_name + .iter() + .zip(other.d_name.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for dirent {} + + impl ::fmt::Debug for dirent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("dirent") + .field("d_ino", &self.d_ino) + .field("d_off", &self.d_off) + .field("d_reclen", &self.d_reclen) + .field("d_type", &self.d_type) + // FIXME: .field("d_name", &self.d_name) + .finish() + } + } + + impl ::hash::Hash for dirent { + fn hash(&self, state: &mut H) { + self.d_ino.hash(state); + self.d_off.hash(state); + self.d_reclen.hash(state); + self.d_type.hash(state); + self.d_name.hash(state); + } + } + + impl PartialEq for dirent64 { + fn eq(&self, other: &dirent64) -> bool { + self.d_ino == other.d_ino + && self.d_off == other.d_off + && self.d_reclen == other.d_reclen + && self.d_type == other.d_type + && self + .d_name + .iter() + .zip(other.d_name.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for dirent64 {} + + impl ::fmt::Debug for dirent64 { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("dirent64") + .field("d_ino", &self.d_ino) + .field("d_off", &self.d_off) + .field("d_reclen", &self.d_reclen) + .field("d_type", &self.d_type) + // FIXME: .field("d_name", &self.d_name) + .finish() + } + } + + impl ::hash::Hash for dirent64 { + fn hash(&self, state: &mut H) { + self.d_ino.hash(state); + self.d_off.hash(state); + self.d_reclen.hash(state); + self.d_type.hash(state); + self.d_name.hash(state); + } + } + + impl PartialEq for siginfo_t { + fn eq(&self, other: &siginfo_t) -> bool { + self.si_signo == other.si_signo + && self.si_errno == other.si_errno + && self.si_code == other.si_code + // Ignore _pad + // Ignore _align + } + } + + impl Eq for siginfo_t {} + + impl ::fmt::Debug for siginfo_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("siginfo_t") + .field("si_signo", &self.si_signo) + .field("si_errno", &self.si_errno) + .field("si_code", &self.si_code) + // Ignore _pad + // Ignore _align + .finish() + } + } + + impl ::hash::Hash for siginfo_t { + fn hash(&self, state: &mut H) { + self.si_signo.hash(state); + self.si_errno.hash(state); + self.si_code.hash(state); + // Ignore _pad + // Ignore _align + } + } + + impl PartialEq for lastlog { + fn eq(&self, other: &lastlog) -> bool { + self.ll_time == other.ll_time + && self + .ll_line + .iter() + .zip(other.ll_line.iter()) + .all(|(a,b)| a == b) + && self + .ll_host + .iter() + .zip(other.ll_host.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for lastlog {} + + impl ::fmt::Debug for lastlog { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("lastlog") + .field("ll_time", &self.ll_time) + .field("ll_line", &self.ll_line) + // FIXME: .field("ll_host", &self.ll_host) + .finish() + } + } + + impl ::hash::Hash for lastlog { + fn hash(&self, state: &mut H) { + self.ll_time.hash(state); + self.ll_line.hash(state); + self.ll_host.hash(state); + } + } + + impl PartialEq for utmp { + fn eq(&self, other: &utmp) -> bool { + self.ut_type == other.ut_type + && self.ut_pid == other.ut_pid + && self + .ut_line + .iter() + .zip(other.ut_line.iter()) + .all(|(a,b)| a == b) + && self.ut_id == other.ut_id + && self + .ut_user + .iter() + .zip(other.ut_user.iter()) + .all(|(a,b)| a == b) + && self + .ut_host + .iter() + .zip(other.ut_host.iter()) + .all(|(a,b)| a == b) + && self.ut_exit == other.ut_exit + && self.ut_session == other.ut_session + && self.ut_tv == other.ut_tv + && self.ut_addr_v6 == other.ut_addr_v6 + && self.unused == other.unused + } + } + + impl Eq for utmp {} + + impl ::fmt::Debug for utmp { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("utmp") + .field("ut_type", &self.ut_type) + .field("ut_pid", &self.ut_pid) + .field("ut_line", &self.ut_line) + .field("ut_id", &self.ut_id) + .field("ut_user", &self.ut_user) + // FIXME: .field("ut_host", &self.ut_host) + .field("ut_exit", &self.ut_exit) + .field("ut_session", &self.ut_session) + .field("ut_tv", &self.ut_tv) + .field("ut_addr_v6", &self.ut_addr_v6) + .field("unused", &self.unused) + .finish() + } + } + + impl ::hash::Hash for utmp { + fn hash(&self, state: &mut H) { + self.ut_type.hash(state); + self.ut_pid.hash(state); + self.ut_line.hash(state); + self.ut_id.hash(state); + self.ut_user.hash(state); + self.ut_host.hash(state); + self.ut_exit.hash(state); + self.ut_session.hash(state); + self.ut_tv.hash(state); + self.ut_addr_v6.hash(state); + self.unused.hash(state); + } + } + + impl PartialEq for sockaddr_alg { + fn eq(&self, other: &sockaddr_alg) -> bool { + self.salg_family == other.salg_family + && self + .salg_type + .iter() + .zip(other.salg_type.iter()) + .all(|(a, b)| a == b) + && self.salg_feat == other.salg_feat + && self.salg_mask == other.salg_mask + && self + .salg_name + .iter() + .zip(other.salg_name.iter()) + .all(|(a, b)| a == b) + } + } + + impl Eq for sockaddr_alg {} + + impl ::fmt::Debug for sockaddr_alg { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sockaddr_alg") + .field("salg_family", &self.salg_family) + .field("salg_type", &self.salg_type) + .field("salg_feat", &self.salg_feat) + .field("salg_mask", &self.salg_mask) + .field("salg_name", &&self.salg_name[..]) + .finish() + } + } + + impl ::hash::Hash for sockaddr_alg { + fn hash(&self, state: &mut H) { + self.salg_family.hash(state); + self.salg_type.hash(state); + self.salg_feat.hash(state); + self.salg_mask.hash(state); + self.salg_name.hash(state); + } + } + + impl af_alg_iv { + fn as_slice(&self) -> &[u8] { + unsafe { + ::core::slice::from_raw_parts( + self.iv.as_ptr(), + self.ivlen as usize + ) + } + } + } + + impl PartialEq for af_alg_iv { + fn eq(&self, other: &af_alg_iv) -> bool { + *self.as_slice() == *other.as_slice() + } + } + + impl Eq for af_alg_iv {} + + impl ::fmt::Debug for af_alg_iv { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("af_alg_iv") + .field("iv", &self.as_slice()) + .finish() + } + } + + impl ::hash::Hash for af_alg_iv { + fn hash(&self, state: &mut H) { + self.as_slice().hash(state); + } + } + } +} + +pub const MADV_SOFT_OFFLINE: ::c_int = 101; +pub const MS_NOUSER: ::c_ulong = 0xffffffff80000000; +pub const MS_RMT_MASK: ::c_ulong = 0x02800051; + +pub const O_TRUNC: ::c_int = 512; +pub const O_CLOEXEC: ::c_int = 0x80000; +pub const O_PATH: ::c_int = 0o10000000; +pub const O_NOATIME: ::c_int = 0o1000000; + +pub const EBFONT: ::c_int = 59; +pub const ENOSTR: ::c_int = 60; +pub const ENODATA: ::c_int = 61; +pub const ETIME: ::c_int = 62; +pub const ENOSR: ::c_int = 63; +pub const ENONET: ::c_int = 64; +pub const ENOPKG: ::c_int = 65; +pub const EREMOTE: ::c_int = 66; +pub const ENOLINK: ::c_int = 67; +pub const EADV: ::c_int = 68; +pub const ESRMNT: ::c_int = 69; +pub const ECOMM: ::c_int = 70; +pub const EPROTO: ::c_int = 71; +pub const EDOTDOT: ::c_int = 73; + +pub const EPOLL_CLOEXEC: ::c_int = 0x80000; +pub const EPOLLONESHOT: ::c_int = 0x40000000; +pub const EPOLLRDHUP: ::c_int = 0x00002000; +pub const EPOLLWAKEUP: ::c_int = 0x20000000; + +pub const EFD_CLOEXEC: ::c_int = 0x80000; + +pub const USER_PROCESS: ::c_short = 7; + +pub const FALLOC_FL_COLLAPSE_RANGE: ::c_int = 0x08; + +pub const BUFSIZ: ::c_uint = 1024; +pub const FILENAME_MAX: ::c_uint = 4096; +pub const FOPEN_MAX: ::c_uint = 20; +pub const POSIX_FADV_DONTNEED: ::c_int = 4; +pub const POSIX_FADV_NOREUSE: ::c_int = 5; +pub const L_tmpnam: ::c_uint = 4096; +pub const TMP_MAX: ::c_uint = 308915776; +pub const _PC_LINK_MAX: ::c_int = 1; +pub const _PC_MAX_CANON: ::c_int = 2; +pub const _PC_MAX_INPUT: ::c_int = 3; +pub const _PC_NAME_MAX: ::c_int = 4; +pub const _PC_PATH_MAX: ::c_int = 5; +pub const _PC_PIPE_BUF: ::c_int = 6; +pub const _PC_2_SYMLINKS: ::c_int = 7; +pub const _PC_ALLOC_SIZE_MIN: ::c_int = 8; +pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 9; +pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 10; +pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 11; +pub const _PC_REC_XFER_ALIGN: ::c_int = 12; +pub const _PC_SYMLINK_MAX: ::c_int = 13; +pub const _PC_CHOWN_RESTRICTED: ::c_int = 14; +pub const _PC_NO_TRUNC: ::c_int = 15; +pub const _PC_VDISABLE: ::c_int = 16; +pub const _PC_ASYNC_IO: ::c_int = 17; +pub const _PC_PRIO_IO: ::c_int = 18; +pub const _PC_SYNC_IO: ::c_int = 19; + +pub const FIONBIO: ::c_int = 0x5421; + +pub const _SC_ARG_MAX: ::c_int = 0; +pub const _SC_BC_BASE_MAX: ::c_int = 1; +pub const _SC_BC_DIM_MAX: ::c_int = 2; +pub const _SC_BC_SCALE_MAX: ::c_int = 3; +pub const _SC_BC_STRING_MAX: ::c_int = 4; +pub const _SC_CHILD_MAX: ::c_int = 5; +pub const _SC_CLK_TCK: ::c_int = 6; +pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 7; +pub const _SC_EXPR_NEST_MAX: ::c_int = 8; +pub const _SC_LINE_MAX: ::c_int = 9; +pub const _SC_NGROUPS_MAX: ::c_int = 10; +pub const _SC_OPEN_MAX: ::c_int = 11; +pub const _SC_PASS_MAX: ::c_int = 12; +pub const _SC_2_C_BIND: ::c_int = 13; +pub const _SC_2_C_DEV: ::c_int = 14; +pub const _SC_2_C_VERSION: ::c_int = 15; +pub const _SC_2_CHAR_TERM: ::c_int = 16; +pub const _SC_2_FORT_DEV: ::c_int = 17; +pub const _SC_2_FORT_RUN: ::c_int = 18; +pub const _SC_2_LOCALEDEF: ::c_int = 19; +pub const _SC_2_SW_DEV: ::c_int = 20; +pub const _SC_2_UPE: ::c_int = 21; +pub const _SC_2_VERSION: ::c_int = 22; +pub const _SC_JOB_CONTROL: ::c_int = 23; +pub const _SC_SAVED_IDS: ::c_int = 24; +pub const _SC_VERSION: ::c_int = 25; +pub const _SC_RE_DUP_MAX: ::c_int = 26; +pub const _SC_STREAM_MAX: ::c_int = 27; +pub const _SC_TZNAME_MAX: ::c_int = 28; +pub const _SC_XOPEN_CRYPT: ::c_int = 29; +pub const _SC_XOPEN_ENH_I18N: ::c_int = 30; +pub const _SC_XOPEN_SHM: ::c_int = 31; +pub const _SC_XOPEN_VERSION: ::c_int = 32; +pub const _SC_XOPEN_XCU_VERSION: ::c_int = 33; +pub const _SC_XOPEN_REALTIME: ::c_int = 34; +pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 35; +pub const _SC_XOPEN_LEGACY: ::c_int = 36; +pub const _SC_ATEXIT_MAX: ::c_int = 37; +pub const _SC_IOV_MAX: ::c_int = 38; +pub const _SC_PAGESIZE: ::c_int = 39; +pub const _SC_PAGE_SIZE: ::c_int = 40; +pub const _SC_XOPEN_UNIX: ::c_int = 41; +pub const _SC_XBS5_ILP32_OFF32: ::c_int = 42; +pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 43; +pub const _SC_XBS5_LP64_OFF64: ::c_int = 44; +pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 45; +pub const _SC_AIO_LISTIO_MAX: ::c_int = 46; +pub const _SC_AIO_MAX: ::c_int = 47; +pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 48; +pub const _SC_DELAYTIMER_MAX: ::c_int = 49; +pub const _SC_MQ_OPEN_MAX: ::c_int = 50; +pub const _SC_MQ_PRIO_MAX: ::c_int = 51; +pub const _SC_RTSIG_MAX: ::c_int = 52; +pub const _SC_SEM_NSEMS_MAX: ::c_int = 53; +pub const _SC_SEM_VALUE_MAX: ::c_int = 54; +pub const _SC_SIGQUEUE_MAX: ::c_int = 55; +pub const _SC_TIMER_MAX: ::c_int = 56; +pub const _SC_ASYNCHRONOUS_IO: ::c_int = 57; +pub const _SC_FSYNC: ::c_int = 58; +pub const _SC_MAPPED_FILES: ::c_int = 59; +pub const _SC_MEMLOCK: ::c_int = 60; +pub const _SC_MEMLOCK_RANGE: ::c_int = 61; +pub const _SC_MEMORY_PROTECTION: ::c_int = 62; +pub const _SC_MESSAGE_PASSING: ::c_int = 63; +pub const _SC_PRIORITIZED_IO: ::c_int = 64; +pub const _SC_PRIORITY_SCHEDULING: ::c_int = 65; +pub const _SC_REALTIME_SIGNALS: ::c_int = 66; +pub const _SC_SEMAPHORES: ::c_int = 67; +pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 68; +pub const _SC_SYNCHRONIZED_IO: ::c_int = 69; +pub const _SC_TIMERS: ::c_int = 70; +pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 71; +pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 72; +pub const _SC_LOGIN_NAME_MAX: ::c_int = 73; +pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 74; +pub const _SC_THREAD_KEYS_MAX: ::c_int = 75; +pub const _SC_THREAD_STACK_MIN: ::c_int = 76; +pub const _SC_THREAD_THREADS_MAX: ::c_int = 77; +pub const _SC_TTY_NAME_MAX: ::c_int = 78; +pub const _SC_THREADS: ::c_int = 79; +pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 80; +pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 81; +pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 82; +pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 83; +pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 84; +pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 85; +pub const _SC_NPROCESSORS_CONF: ::c_int = 96; +pub const _SC_NPROCESSORS_ONLN: ::c_int = 97; +pub const _SC_PHYS_PAGES: ::c_int = 98; +pub const _SC_AVPHYS_PAGES: ::c_int = 99; +pub const _SC_MONOTONIC_CLOCK: ::c_int = 100; + +pub const _SC_2_PBS: ::c_int = 101; +pub const _SC_2_PBS_ACCOUNTING: ::c_int = 102; +pub const _SC_2_PBS_CHECKPOINT: ::c_int = 103; +pub const _SC_2_PBS_LOCATE: ::c_int = 104; +pub const _SC_2_PBS_MESSAGE: ::c_int = 105; +pub const _SC_2_PBS_TRACK: ::c_int = 106; +pub const _SC_ADVISORY_INFO: ::c_int = 107; +pub const _SC_BARRIERS: ::c_int = 108; +pub const _SC_CLOCK_SELECTION: ::c_int = 109; +pub const _SC_CPUTIME: ::c_int = 110; +pub const _SC_HOST_NAME_MAX: ::c_int = 111; +pub const _SC_IPV6: ::c_int = 112; +pub const _SC_RAW_SOCKETS: ::c_int = 113; +pub const _SC_READER_WRITER_LOCKS: ::c_int = 114; +pub const _SC_REGEXP: ::c_int = 115; +pub const _SC_SHELL: ::c_int = 116; +pub const _SC_SPAWN: ::c_int = 117; +pub const _SC_SPIN_LOCKS: ::c_int = 118; +pub const _SC_SPORADIC_SERVER: ::c_int = 119; +pub const _SC_SS_REPL_MAX: ::c_int = 120; +pub const _SC_SYMLOOP_MAX: ::c_int = 121; +pub const _SC_THREAD_CPUTIME: ::c_int = 122; +pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 123; +pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 124; +pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 125; +pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 126; +pub const _SC_TIMEOUTS: ::c_int = 127; +pub const _SC_TRACE: ::c_int = 128; +pub const _SC_TRACE_EVENT_FILTER: ::c_int = 129; +pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 130; +pub const _SC_TRACE_INHERIT: ::c_int = 131; +pub const _SC_TRACE_LOG: ::c_int = 132; +pub const _SC_TRACE_NAME_MAX: ::c_int = 133; +pub const _SC_TRACE_SYS_MAX: ::c_int = 134; +pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 135; +pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 136; +pub const _SC_V7_ILP32_OFF32: ::c_int = 137; +pub const _SC_V7_ILP32_OFFBIG: ::c_int = 138; +pub const _SC_V7_LP64_OFF64: ::c_int = 139; +pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 140; +pub const _SC_XOPEN_STREAMS: ::c_int = 141; +pub const _SC_XOPEN_UUCP: ::c_int = 142; + +pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; +pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; +pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; +pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; + +pub const FIOCLEX: ::c_int = 0x5451; +pub const FIONCLEX: ::c_int = 0x5450; + +pub const SIGCHLD: ::c_int = 17; +pub const SIGBUS: ::c_int = 7; +pub const SIGUSR1: ::c_int = 10; +pub const SIGUSR2: ::c_int = 12; +pub const SIGCONT: ::c_int = 18; +pub const SIGSTOP: ::c_int = 19; +pub const SIGTSTP: ::c_int = 20; +pub const SIGURG: ::c_int = 23; +pub const SIGIO: ::c_int = 29; +pub const SIGSYS: ::c_int = 31; +pub const SIGSTKFLT: ::c_int = 16; +#[deprecated( + since = "0.2.55", + note = "Use SIGSYS instead" +)] +pub const SIGUNUSED: ::c_int = 31; +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; +pub const SIGPOLL: ::c_int = 29; +pub const SIGPWR: ::c_int = 30; +pub const SIG_SETMASK: ::c_int = 2; +pub const SIG_BLOCK: ::c_int = 0x000000; +pub const SIG_UNBLOCK: ::c_int = 0x01; + +pub const RUSAGE_CHILDREN: ::c_int = -1; + +pub const LC_PAPER: ::c_int = 7; +pub const LC_NAME: ::c_int = 8; +pub const LC_ADDRESS: ::c_int = 9; +pub const LC_TELEPHONE: ::c_int = 10; +pub const LC_MEASUREMENT: ::c_int = 11; +pub const LC_IDENTIFICATION: ::c_int = 12; +pub const LC_PAPER_MASK: ::c_int = (1 << LC_PAPER); +pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME); +pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS); +pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE); +pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT); +pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION); +pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK + | ::LC_NUMERIC_MASK + | ::LC_TIME_MASK + | ::LC_COLLATE_MASK + | ::LC_MONETARY_MASK + | ::LC_MESSAGES_MASK + | LC_PAPER_MASK + | LC_NAME_MASK + | LC_ADDRESS_MASK + | LC_TELEPHONE_MASK + | LC_MEASUREMENT_MASK + | LC_IDENTIFICATION_MASK; + +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_ANONYMOUS: ::c_int = 0x0020; +pub const MAP_GROWSDOWN: ::c_int = 0x0100; +pub const MAP_DENYWRITE: ::c_int = 0x0800; +pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_LOCKED: ::c_int = 0x02000; +pub const MAP_NORESERVE: ::c_int = 0x04000; +pub const MAP_POPULATE: ::c_int = 0x08000; +pub const MAP_NONBLOCK: ::c_int = 0x010000; +pub const MAP_STACK: ::c_int = 0x020000; + +pub const EDEADLK: ::c_int = 35; +pub const ENAMETOOLONG: ::c_int = 36; +pub const ENOLCK: ::c_int = 37; +pub const ENOSYS: ::c_int = 38; +pub const ENOTEMPTY: ::c_int = 39; +pub const ELOOP: ::c_int = 40; +pub const ENOMSG: ::c_int = 42; +pub const EIDRM: ::c_int = 43; +pub const ECHRNG: ::c_int = 44; +pub const EL2NSYNC: ::c_int = 45; +pub const EL3HLT: ::c_int = 46; +pub const EL3RST: ::c_int = 47; +pub const ELNRNG: ::c_int = 48; +pub const EUNATCH: ::c_int = 49; +pub const ENOCSI: ::c_int = 50; +pub const EL2HLT: ::c_int = 51; +pub const EBADE: ::c_int = 52; +pub const EBADR: ::c_int = 53; +pub const EXFULL: ::c_int = 54; +pub const ENOANO: ::c_int = 55; +pub const EBADRQC: ::c_int = 56; +pub const EBADSLT: ::c_int = 57; + +pub const EMULTIHOP: ::c_int = 72; +pub const EBADMSG: ::c_int = 74; +pub const EOVERFLOW: ::c_int = 75; +pub const ENOTUNIQ: ::c_int = 76; +pub const EBADFD: ::c_int = 77; +pub const EREMCHG: ::c_int = 78; +pub const ELIBACC: ::c_int = 79; +pub const ELIBBAD: ::c_int = 80; +pub const ELIBSCN: ::c_int = 81; +pub const ELIBMAX: ::c_int = 82; +pub const ELIBEXEC: ::c_int = 83; +pub const EILSEQ: ::c_int = 84; +pub const ERESTART: ::c_int = 85; +pub const ESTRPIPE: ::c_int = 86; +pub const EUSERS: ::c_int = 87; +pub const ENOTSOCK: ::c_int = 88; +pub const EDESTADDRREQ: ::c_int = 89; +pub const EMSGSIZE: ::c_int = 90; +pub const EPROTOTYPE: ::c_int = 91; +pub const ENOPROTOOPT: ::c_int = 92; +pub const EPROTONOSUPPORT: ::c_int = 93; +pub const ESOCKTNOSUPPORT: ::c_int = 94; +pub const EOPNOTSUPP: ::c_int = 95; +pub const ENOTSUP: ::c_int = EOPNOTSUPP; +pub const EPFNOSUPPORT: ::c_int = 96; +pub const EAFNOSUPPORT: ::c_int = 97; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const ENETDOWN: ::c_int = 100; +pub const ENETUNREACH: ::c_int = 101; +pub const ENETRESET: ::c_int = 102; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNRESET: ::c_int = 104; +pub const ENOBUFS: ::c_int = 105; +pub const EISCONN: ::c_int = 106; +pub const ENOTCONN: ::c_int = 107; +pub const ESHUTDOWN: ::c_int = 108; +pub const ETOOMANYREFS: ::c_int = 109; +pub const ETIMEDOUT: ::c_int = 110; +pub const ECONNREFUSED: ::c_int = 111; +pub const EHOSTDOWN: ::c_int = 112; +pub const EHOSTUNREACH: ::c_int = 113; +pub const EALREADY: ::c_int = 114; +pub const EINPROGRESS: ::c_int = 115; +pub const ESTALE: ::c_int = 116; +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; +pub const EDQUOT: ::c_int = 122; +pub const ENOMEDIUM: ::c_int = 123; +pub const EMEDIUMTYPE: ::c_int = 124; +pub const ECANCELED: ::c_int = 125; +pub const ENOKEY: ::c_int = 126; +pub const EKEYEXPIRED: ::c_int = 127; +pub const EKEYREVOKED: ::c_int = 128; +pub const EKEYREJECTED: ::c_int = 129; +pub const EOWNERDEAD: ::c_int = 130; +pub const ENOTRECOVERABLE: ::c_int = 131; + +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; +pub const SOCK_SEQPACKET: ::c_int = 5; +pub const SOCK_DCCP: ::c_int = 6; +pub const SOCK_PACKET: ::c_int = 10; + +pub const SOL_SOCKET: ::c_int = 1; +pub const SOL_SCTP: ::c_int = 132; +pub const SOL_IPX: ::c_int = 256; +pub const SOL_AX25: ::c_int = 257; +pub const SOL_ATALK: ::c_int = 258; +pub const SOL_NETROM: ::c_int = 259; +pub const SOL_ROSE: ::c_int = 260; + +/* DCCP socket options */ +pub const DCCP_SOCKOPT_PACKET_SIZE: ::c_int = 1; +pub const DCCP_SOCKOPT_SERVICE: ::c_int = 2; +pub const DCCP_SOCKOPT_CHANGE_L: ::c_int = 3; +pub const DCCP_SOCKOPT_CHANGE_R: ::c_int = 4; +pub const DCCP_SOCKOPT_GET_CUR_MPS: ::c_int = 5; +pub const DCCP_SOCKOPT_SERVER_TIMEWAIT: ::c_int = 6; +pub const DCCP_SOCKOPT_SEND_CSCOV: ::c_int = 10; +pub const DCCP_SOCKOPT_RECV_CSCOV: ::c_int = 11; +pub const DCCP_SOCKOPT_AVAILABLE_CCIDS: ::c_int = 12; +pub const DCCP_SOCKOPT_CCID: ::c_int = 13; +pub const DCCP_SOCKOPT_TX_CCID: ::c_int = 14; +pub const DCCP_SOCKOPT_RX_CCID: ::c_int = 15; +pub const DCCP_SOCKOPT_QPOLICY_ID: ::c_int = 16; +pub const DCCP_SOCKOPT_QPOLICY_TXQLEN: ::c_int = 17; +pub const DCCP_SOCKOPT_CCID_RX_INFO: ::c_int = 128; +pub const DCCP_SOCKOPT_CCID_TX_INFO: ::c_int = 192; + +/// maximum number of services provided on the same listening port +pub const DCCP_SERVICE_LIST_MAX_LEN: ::c_int = 32; + +pub const SO_REUSEADDR: ::c_int = 2; +pub const SO_TYPE: ::c_int = 3; +pub const SO_ERROR: ::c_int = 4; +pub const SO_DONTROUTE: ::c_int = 5; +pub const SO_BROADCAST: ::c_int = 6; +pub const SO_SNDBUF: ::c_int = 7; +pub const SO_RCVBUF: ::c_int = 8; +pub const SO_KEEPALIVE: ::c_int = 9; +pub const SO_OOBINLINE: ::c_int = 10; +pub const SO_PRIORITY: ::c_int = 12; +pub const SO_LINGER: ::c_int = 13; +pub const SO_BSDCOMPAT: ::c_int = 14; +pub const SO_REUSEPORT: ::c_int = 15; +pub const SO_PASSCRED: ::c_int = 16; +pub const SO_PEERCRED: ::c_int = 17; +pub const SO_RCVLOWAT: ::c_int = 18; +pub const SO_SNDLOWAT: ::c_int = 19; +pub const SO_RCVTIMEO: ::c_int = 20; +pub const SO_SNDTIMEO: ::c_int = 21; +pub const SO_BINDTODEVICE: ::c_int = 25; +pub const SO_TIMESTAMP: ::c_int = 29; +pub const SO_ACCEPTCONN: ::c_int = 30; +pub const SO_SNDBUFFORCE: ::c_int = 32; +pub const SO_RCVBUFFORCE: ::c_int = 33; +pub const SO_MARK: ::c_int = 36; +pub const SO_PROTOCOL: ::c_int = 38; +pub const SO_DOMAIN: ::c_int = 39; +pub const SO_RXQ_OVFL: ::c_int = 40; +pub const SO_PEEK_OFF: ::c_int = 42; +pub const SO_BUSY_POLL: ::c_int = 46; + +pub const IPTOS_ECN_NOTECT: u8 = 0x00; + +pub const O_ACCMODE: ::c_int = 3; +pub const O_APPEND: ::c_int = 1024; +pub const O_CREAT: ::c_int = 64; +pub const O_EXCL: ::c_int = 128; +pub const O_NOCTTY: ::c_int = 256; +pub const O_NONBLOCK: ::c_int = 2048; +pub const O_SYNC: ::c_int = 0x101000; +pub const O_ASYNC: ::c_int = 0x2000; +pub const O_NDELAY: ::c_int = 0x800; +pub const O_DSYNC: ::c_int = 4096; + +pub const NI_MAXHOST: ::size_t = 1025; + +pub const NCCS: usize = 19; +pub const TCSBRKP: ::c_int = 0x5425; +pub const TCSANOW: ::c_int = 0; +pub const TCSADRAIN: ::c_int = 0x1; +pub const TCSAFLUSH: ::c_int = 0x2; +pub const VEOF: usize = 4; +pub const VEOL: usize = 11; +pub const VEOL2: usize = 16; +pub const VMIN: usize = 6; +pub const IEXTEN: ::tcflag_t = 0x00008000; +pub const TOSTOP: ::tcflag_t = 0x00000100; +pub const FLUSHO: ::tcflag_t = 0x00001000; +pub const EXTPROC: ::tcflag_t = 0o200000; + +pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5; +pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff; +pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245; +pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45; +pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53; +pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53; +pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53; +pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53; +pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849; +pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6; +pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660; +pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6; +pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f; +pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f; +pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468; +pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478; +pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44; +pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c; +pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969; +pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1; +pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0; +pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f; +pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973; +pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b; +pub const TMPFS_MAGIC: ::c_long = 0x01021994; +pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2; + +pub const MAP_HUGETLB: ::c_int = 0x040000; + +pub const PTRACE_TRACEME: ::c_int = 0; +pub const PTRACE_PEEKTEXT: ::c_int = 1; +pub const PTRACE_PEEKDATA: ::c_int = 2; +pub const PTRACE_PEEKUSER: ::c_int = 3; +pub const PTRACE_POKETEXT: ::c_int = 4; +pub const PTRACE_POKEDATA: ::c_int = 5; +pub const PTRACE_POKEUSER: ::c_int = 6; +pub const PTRACE_CONT: ::c_int = 7; +pub const PTRACE_KILL: ::c_int = 8; +pub const PTRACE_SINGLESTEP: ::c_int = 9; +pub const PTRACE_ATTACH: ::c_int = 16; +pub const PTRACE_DETACH: ::c_int = 17; +pub const PTRACE_SYSCALL: ::c_int = 24; +pub const PTRACE_SETOPTIONS: ::c_int = 0x4200; +pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201; +pub const PTRACE_GETSIGINFO: ::c_int = 0x4202; +pub const PTRACE_SETSIGINFO: ::c_int = 0x4203; + +pub const EFD_NONBLOCK: ::c_int = 0x800; + +pub const F_GETLK: ::c_int = 5; +pub const F_GETOWN: ::c_int = 9; +pub const F_SETOWN: ::c_int = 8; +pub const F_SETLK: ::c_int = 6; +pub const F_SETLKW: ::c_int = 7; +pub const F_RDLCK: ::c_int = 0; +pub const F_WRLCK: ::c_int = 1; +pub const F_UNLCK: ::c_int = 2; + +pub const RLIMIT_CPU: ::c_int = 0; +pub const RLIMIT_FSIZE: ::c_int = 1; +pub const RLIMIT_DATA: ::c_int = 2; +pub const RLIMIT_STACK: ::c_int = 3; +pub const RLIMIT_CORE: ::c_int = 4; +pub const RLIMIT_LOCKS: ::c_int = 10; +pub const RLIMIT_SIGPENDING: ::c_int = 11; +pub const RLIMIT_MSGQUEUE: ::c_int = 12; +pub const RLIMIT_NICE: ::c_int = 13; +pub const RLIMIT_RTPRIO: ::c_int = 14; + +pub const TCGETS: ::c_int = 0x5401; +pub const TCSETS: ::c_int = 0x5402; +pub const TCSETSW: ::c_int = 0x5403; +pub const TCSETSF: ::c_int = 0x5404; +pub const TCGETA: ::c_int = 0x5405; +pub const TCSETA: ::c_int = 0x5406; +pub const TCSETAW: ::c_int = 0x5407; +pub const TCSETAF: ::c_int = 0x5408; +pub const TCSBRK: ::c_int = 0x5409; +pub const TCXONC: ::c_int = 0x540A; +pub const TCFLSH: ::c_int = 0x540B; +pub const TIOCGSOFTCAR: ::c_int = 0x5419; +pub const TIOCSSOFTCAR: ::c_int = 0x541A; +pub const TIOCINQ: ::c_int = 0x541B; +pub const TIOCLINUX: ::c_int = 0x541C; +pub const TIOCGSERIAL: ::c_int = 0x541E; +pub const TIOCEXCL: ::c_int = 0x540C; +pub const TIOCNXCL: ::c_int = 0x540D; +pub const TIOCSCTTY: ::c_int = 0x540E; +pub const TIOCGPGRP: ::c_int = 0x540F; +pub const TIOCSPGRP: ::c_int = 0x5410; +pub const TIOCOUTQ: ::c_int = 0x5411; +pub const TIOCSTI: ::c_int = 0x5412; +pub const TIOCGWINSZ: ::c_int = 0x5413; +pub const TIOCSWINSZ: ::c_int = 0x5414; +pub const TIOCMGET: ::c_int = 0x5415; +pub const TIOCMBIS: ::c_int = 0x5416; +pub const TIOCMBIC: ::c_int = 0x5417; +pub const TIOCMSET: ::c_int = 0x5418; +pub const FIONREAD: ::c_int = 0x541B; +pub const TIOCCONS: ::c_int = 0x541D; + +pub const ST_RDONLY: ::c_ulong = 1; +pub const ST_NOSUID: ::c_ulong = 2; +pub const ST_NODEV: ::c_ulong = 4; +pub const ST_NOEXEC: ::c_ulong = 8; +pub const ST_SYNCHRONOUS: ::c_ulong = 16; +pub const ST_MANDLOCK: ::c_ulong = 64; +pub const ST_NOATIME: ::c_ulong = 1024; +pub const ST_NODIRATIME: ::c_ulong = 2048; +pub const ST_RELATIME: ::c_ulong = 4096; + +pub const RTLD_NOLOAD: ::c_int = 0x4; + +pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t; + +pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead; +pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793; +pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278; +pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448; +pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216; + +pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567; +pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123; +pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF; +pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000; +pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC; +pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4; +pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2; +pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543; + +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; + +pub const CBAUD: ::tcflag_t = 0o0010017; +pub const TAB1: ::tcflag_t = 0x00000800; +pub const TAB2: ::tcflag_t = 0x00001000; +pub const TAB3: ::tcflag_t = 0x00001800; +pub const CR1: ::tcflag_t = 0x00000200; +pub const CR2: ::tcflag_t = 0x00000400; +pub const CR3: ::tcflag_t = 0x00000600; +pub const FF1: ::tcflag_t = 0x00008000; +pub const BS1: ::tcflag_t = 0x00002000; +pub const VT1: ::tcflag_t = 0x00004000; +pub const VWERASE: usize = 14; +pub const VREPRINT: usize = 12; +pub const VSUSP: usize = 10; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VDISCARD: usize = 13; +pub const VTIME: usize = 5; +pub const IXON: ::tcflag_t = 0x00000400; +pub const IXOFF: ::tcflag_t = 0x00001000; +pub const ONLCR: ::tcflag_t = 0x4; +pub const CSIZE: ::tcflag_t = 0x00000030; +pub const CS6: ::tcflag_t = 0x00000010; +pub const CS7: ::tcflag_t = 0x00000020; +pub const CS8: ::tcflag_t = 0x00000030; +pub const CSTOPB: ::tcflag_t = 0x00000040; +pub const CREAD: ::tcflag_t = 0x00000080; +pub const PARENB: ::tcflag_t = 0x00000100; +pub const PARODD: ::tcflag_t = 0x00000200; +pub const HUPCL: ::tcflag_t = 0x00000400; +pub const CLOCAL: ::tcflag_t = 0x00000800; +pub const ECHOKE: ::tcflag_t = 0x00000800; +pub const ECHOE: ::tcflag_t = 0x00000010; +pub const ECHOK: ::tcflag_t = 0x00000020; +pub const ECHONL: ::tcflag_t = 0x00000040; +pub const ECHOPRT: ::tcflag_t = 0x00000400; +pub const ECHOCTL: ::tcflag_t = 0x00000200; +pub const ISIG: ::tcflag_t = 0x00000001; +pub const ICANON: ::tcflag_t = 0x00000002; +pub const PENDIN: ::tcflag_t = 0x00004000; +pub const NOFLSH: ::tcflag_t = 0x00000080; +pub const VSWTC: usize = 7; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const XTABS: ::tcflag_t = 0o014000; + +pub const B0: ::speed_t = 0o000000; +pub const B50: ::speed_t = 0o000001; +pub const B75: ::speed_t = 0o000002; +pub const B110: ::speed_t = 0o000003; +pub const B134: ::speed_t = 0o000004; +pub const B150: ::speed_t = 0o000005; +pub const B200: ::speed_t = 0o000006; +pub const B300: ::speed_t = 0o000007; +pub const B600: ::speed_t = 0o000010; +pub const B1200: ::speed_t = 0o000011; +pub const B1800: ::speed_t = 0o000012; +pub const B2400: ::speed_t = 0o000013; +pub const B4800: ::speed_t = 0o000014; +pub const B9600: ::speed_t = 0o000015; +pub const B19200: ::speed_t = 0o000016; +pub const B38400: ::speed_t = 0o000017; +pub const EXTA: ::speed_t = B19200; +pub const EXTB: ::speed_t = B38400; +pub const BOTHER: ::speed_t = 0o010000; +pub const B57600: ::speed_t = 0o010001; +pub const B115200: ::speed_t = 0o010002; +pub const B230400: ::speed_t = 0o010003; +pub const B460800: ::speed_t = 0o010004; +pub const B500000: ::speed_t = 0o010005; +pub const B576000: ::speed_t = 0o010006; +pub const B921600: ::speed_t = 0o010007; +pub const B1000000: ::speed_t = 0o010010; +pub const B1152000: ::speed_t = 0o010011; +pub const B1500000: ::speed_t = 0o010012; +pub const B2000000: ::speed_t = 0o010013; +pub const B2500000: ::speed_t = 0o010014; +pub const B3000000: ::speed_t = 0o010015; +pub const B3500000: ::speed_t = 0o010016; +pub const B4000000: ::speed_t = 0o010017; + +pub const EAI_AGAIN: ::c_int = 2; +pub const EAI_BADFLAGS: ::c_int = 3; +pub const EAI_FAIL: ::c_int = 4; +pub const EAI_FAMILY: ::c_int = 5; +pub const EAI_MEMORY: ::c_int = 6; +pub const EAI_NODATA: ::c_int = 7; +pub const EAI_NONAME: ::c_int = 8; +pub const EAI_SERVICE: ::c_int = 9; +pub const EAI_SOCKTYPE: ::c_int = 10; +pub const EAI_SYSTEM: ::c_int = 11; +pub const EAI_OVERFLOW: ::c_int = 14; + +pub const NETLINK_ROUTE: ::c_int = 0; +pub const NETLINK_UNUSED: ::c_int = 1; +pub const NETLINK_USERSOCK: ::c_int = 2; +pub const NETLINK_FIREWALL: ::c_int = 3; +pub const NETLINK_SOCK_DIAG: ::c_int = 4; +pub const NETLINK_NFLOG: ::c_int = 5; +pub const NETLINK_XFRM: ::c_int = 6; +pub const NETLINK_SELINUX: ::c_int = 7; +pub const NETLINK_ISCSI: ::c_int = 8; +pub const NETLINK_AUDIT: ::c_int = 9; +pub const NETLINK_FIB_LOOKUP: ::c_int = 10; +pub const NETLINK_CONNECTOR: ::c_int = 11; +pub const NETLINK_NETFILTER: ::c_int = 12; +pub const NETLINK_IP6_FW: ::c_int = 13; +pub const NETLINK_DNRTMSG: ::c_int = 14; +pub const NETLINK_KOBJECT_UEVENT: ::c_int = 15; +pub const NETLINK_GENERIC: ::c_int = 16; +pub const NETLINK_SCSITRANSPORT: ::c_int = 18; +pub const NETLINK_ECRYPTFS: ::c_int = 19; +pub const NETLINK_RDMA: ::c_int = 20; +pub const NETLINK_CRYPTO: ::c_int = 21; +pub const NETLINK_INET_DIAG: ::c_int = NETLINK_SOCK_DIAG; + +pub const MAX_LINKS: ::c_int = 32; + +pub const NLM_F_REQUEST: ::c_int = 1; +pub const NLM_F_MULTI: ::c_int = 2; +pub const NLM_F_ACK: ::c_int = 4; +pub const NLM_F_ECHO: ::c_int = 8; +pub const NLM_F_DUMP_INTR: ::c_int = 16; + +pub const NLM_F_ROOT: ::c_int = 0x100; +pub const NLM_F_MATCH: ::c_int = 0x200; +pub const NLM_F_ATOMIC: ::c_int = 0x400; +pub const NLM_F_DUMP: ::c_int = NLM_F_ROOT | NLM_F_MATCH; + +pub const NLM_F_REPLACE: ::c_int = 0x100; +pub const NLM_F_EXCL: ::c_int = 0x200; +pub const NLM_F_CREATE: ::c_int = 0x400; +pub const NLM_F_APPEND: ::c_int = 0x800; + +pub const NLMSG_NOOP: ::c_int = 0x1; +pub const NLMSG_ERROR: ::c_int = 0x2; +pub const NLMSG_DONE: ::c_int = 0x3; +pub const NLMSG_OVERRUN: ::c_int = 0x4; +pub const NLMSG_MIN_TYPE: ::c_int = 0x10; + +pub const GENL_NAMSIZ: ::c_int = 16; + +pub const GENL_MIN_ID: ::c_int = NLMSG_MIN_TYPE; +pub const GENL_MAX_ID: ::c_int = 1023; + +pub const GENL_ADMIN_PERM: ::c_int = 0x01; +pub const GENL_CMD_CAP_DO: ::c_int = 0x02; +pub const GENL_CMD_CAP_DUMP: ::c_int = 0x04; +pub const GENL_CMD_CAP_HASPOL: ::c_int = 0x08; +pub const GENL_UNS_ADMIN_PERM: ::c_int = 0x10; + +pub const GENL_ID_CTRL: ::c_int = NLMSG_MIN_TYPE; +pub const GENL_ID_VFS_DQUOT: ::c_int = NLMSG_MIN_TYPE + 1; +pub const GENL_ID_PMCRAID: ::c_int = NLMSG_MIN_TYPE + 2; + +pub const CTRL_CMD_UNSPEC: ::c_int = 0; +pub const CTRL_CMD_NEWFAMILY: ::c_int = 1; +pub const CTRL_CMD_DELFAMILY: ::c_int = 2; +pub const CTRL_CMD_GETFAMILY: ::c_int = 3; +pub const CTRL_CMD_NEWOPS: ::c_int = 4; +pub const CTRL_CMD_DELOPS: ::c_int = 5; +pub const CTRL_CMD_GETOPS: ::c_int = 6; +pub const CTRL_CMD_NEWMCAST_GRP: ::c_int = 7; +pub const CTRL_CMD_DELMCAST_GRP: ::c_int = 8; +pub const CTRL_CMD_GETMCAST_GRP: ::c_int = 9; + +pub const CTRL_ATTR_UNSPEC: ::c_int = 0; +pub const CTRL_ATTR_FAMILY_ID: ::c_int = 1; +pub const CTRL_ATTR_FAMILY_NAME: ::c_int = 2; +pub const CTRL_ATTR_VERSION: ::c_int = 3; +pub const CTRL_ATTR_HDRSIZE: ::c_int = 4; +pub const CTRL_ATTR_MAXATTR: ::c_int = 5; +pub const CTRL_ATTR_OPS: ::c_int = 6; +pub const CTRL_ATTR_MCAST_GROUPS: ::c_int = 7; + +pub const CTRL_ATTR_OP_UNSPEC: ::c_int = 0; +pub const CTRL_ATTR_OP_ID: ::c_int = 1; +pub const CTRL_ATTR_OP_FLAGS: ::c_int = 2; + +pub const CTRL_ATTR_MCAST_GRP_UNSPEC: ::c_int = 0; +pub const CTRL_ATTR_MCAST_GRP_NAME: ::c_int = 1; +pub const CTRL_ATTR_MCAST_GRP_ID: ::c_int = 2; + +pub const NETLINK_ADD_MEMBERSHIP: ::c_int = 1; +pub const NETLINK_DROP_MEMBERSHIP: ::c_int = 2; +pub const NETLINK_PKTINFO: ::c_int = 3; +pub const NETLINK_BROADCAST_ERROR: ::c_int = 4; +pub const NETLINK_NO_ENOBUFS: ::c_int = 5; +pub const NETLINK_RX_RING: ::c_int = 6; +pub const NETLINK_TX_RING: ::c_int = 7; + +pub const GRND_NONBLOCK: ::c_uint = 0x0001; +pub const GRND_RANDOM: ::c_uint = 0x0002; + +pub const SECCOMP_MODE_DISABLED: ::c_uint = 0; +pub const SECCOMP_MODE_STRICT: ::c_uint = 1; +pub const SECCOMP_MODE_FILTER: ::c_uint = 2; + +pub const NLA_F_NESTED: ::c_int = 1 << 15; +pub const NLA_F_NET_BYTEORDER: ::c_int = 1 << 14; +pub const NLA_TYPE_MASK: ::c_int = !(NLA_F_NESTED | NLA_F_NET_BYTEORDER); + +pub const NLA_ALIGNTO: ::c_int = 4; + +pub const SIGEV_THREAD_ID: ::c_int = 4; + +pub const CIBAUD: ::tcflag_t = 0o02003600000; +pub const CBAUDEX: ::tcflag_t = 0o010000; + +pub const TIOCM_LE: ::c_int = 0x001; +pub const TIOCM_DTR: ::c_int = 0x002; +pub const TIOCM_RTS: ::c_int = 0x004; +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; +pub const TIOCM_CD: ::c_int = TIOCM_CAR; +pub const TIOCM_RI: ::c_int = TIOCM_RNG; + +pub const POLLWRNORM: ::c_short = 0x100; +pub const POLLWRBAND: ::c_short = 0x200; + +pub const SFD_CLOEXEC: ::c_int = O_CLOEXEC; +pub const SFD_NONBLOCK: ::c_int = O_NONBLOCK; + +pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK; + +pub const SO_ORIGINAL_DST: ::c_int = 80; +pub const IP_ORIGDSTADDR : ::c_int = 20; +pub const IP_RECVORIGDSTADDR : ::c_int = IP_ORIGDSTADDR; +pub const IPV6_ORIGDSTADDR : ::c_int = 74; +pub const IPV6_RECVORIGDSTADDR : ::c_int = IPV6_ORIGDSTADDR; +pub const IPV6_FLOWINFO: ::c_int = 11; +pub const IPV6_FLOWLABEL_MGR: ::c_int = 32; +pub const IPV6_FLOWINFO_SEND: ::c_int = 33; +pub const IPV6_FLOWINFO_FLOWLABEL: ::c_int = 0x000fffff; +pub const IPV6_FLOWINFO_PRIORITY: ::c_int = 0x0ff00000; +pub const IUTF8: ::tcflag_t = 0x00004000; +pub const CMSPAR: ::tcflag_t = 0o10000000000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; + +pub const MFD_CLOEXEC: ::c_uint = 0x0001; +pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002; +pub const MFD_HUGETLB: ::c_uint = 0x0004; + +// linux/netfilter.h +pub const NF_DROP: ::c_int = 0; +pub const NF_ACCEPT: ::c_int = 1; +pub const NF_STOLEN: ::c_int = 2; +pub const NF_QUEUE: ::c_int = 3; +pub const NF_REPEAT: ::c_int = 4; +pub const NF_STOP: ::c_int = 5; +pub const NF_MAX_VERDICT: ::c_int = NF_STOP; + +pub const NF_VERDICT_MASK: ::c_int = 0x000000ff; +pub const NF_VERDICT_FLAG_QUEUE_BYPASS: ::c_int = 0x00008000; + +pub const NF_VERDICT_QMASK: ::c_int = 0xffff0000; +pub const NF_VERDICT_QBITS: ::c_int = 16; + +pub const NF_VERDICT_BITS: ::c_int = 16; + +pub const NF_INET_PRE_ROUTING: ::c_int = 0; +pub const NF_INET_LOCAL_IN: ::c_int = 1; +pub const NF_INET_FORWARD: ::c_int = 2; +pub const NF_INET_LOCAL_OUT: ::c_int = 3; +pub const NF_INET_POST_ROUTING: ::c_int = 4; +pub const NF_INET_NUMHOOKS: ::c_int = 5; + +pub const NF_NETDEV_INGRESS: ::c_int = 0; +pub const NF_NETDEV_NUMHOOKS: ::c_int = 1; + +pub const NFPROTO_UNSPEC: ::c_int = 0; +pub const NFPROTO_INET: ::c_int = 1; +pub const NFPROTO_IPV4: ::c_int = 2; +pub const NFPROTO_ARP: ::c_int = 3; +pub const NFPROTO_NETDEV: ::c_int = 5; +pub const NFPROTO_BRIDGE: ::c_int = 7; +pub const NFPROTO_IPV6: ::c_int = 10; +pub const NFPROTO_DECNET: ::c_int = 12; +pub const NFPROTO_NUMPROTO: ::c_int = 13; + +// linux/netfilter_ipv4.h +pub const NF_IP_PRE_ROUTING: ::c_int = 0; +pub const NF_IP_LOCAL_IN: ::c_int = 1; +pub const NF_IP_FORWARD: ::c_int = 2; +pub const NF_IP_LOCAL_OUT: ::c_int = 3; +pub const NF_IP_POST_ROUTING: ::c_int = 4; +pub const NF_IP_NUMHOOKS: ::c_int = 5; + +pub const NF_IP_PRI_FIRST: ::c_int = ::INT_MIN; +pub const NF_IP_PRI_CONNTRACK_DEFRAG: ::c_int = -400; +pub const NF_IP_PRI_RAW: ::c_int = -300; +pub const NF_IP_PRI_SELINUX_FIRST: ::c_int = -225; +pub const NF_IP_PRI_CONNTRACK: ::c_int = -200; +pub const NF_IP_PRI_MANGLE: ::c_int = -150; +pub const NF_IP_PRI_NAT_DST: ::c_int = -100; +pub const NF_IP_PRI_FILTER: ::c_int = 0; +pub const NF_IP_PRI_SECURITY: ::c_int = 50; +pub const NF_IP_PRI_NAT_SRC: ::c_int = 100; +pub const NF_IP_PRI_SELINUX_LAST: ::c_int = 225; +pub const NF_IP_PRI_CONNTRACK_HELPER: ::c_int = 300; +pub const NF_IP_PRI_CONNTRACK_CONFIRM: ::c_int = ::INT_MAX; +pub const NF_IP_PRI_LAST: ::c_int = ::INT_MAX; + +// linux/netfilter_ipv6.h +pub const NF_IP6_PRE_ROUTING: ::c_int = 0; +pub const NF_IP6_LOCAL_IN: ::c_int = 1; +pub const NF_IP6_FORWARD: ::c_int = 2; +pub const NF_IP6_LOCAL_OUT: ::c_int = 3; +pub const NF_IP6_POST_ROUTING: ::c_int = 4; +pub const NF_IP6_NUMHOOKS: ::c_int = 5; + +pub const NF_IP6_PRI_FIRST: ::c_int = ::INT_MIN; +pub const NF_IP6_PRI_CONNTRACK_DEFRAG: ::c_int = -400; +pub const NF_IP6_PRI_RAW: ::c_int = -300; +pub const NF_IP6_PRI_SELINUX_FIRST: ::c_int = -225; +pub const NF_IP6_PRI_CONNTRACK: ::c_int = -200; +pub const NF_IP6_PRI_MANGLE: ::c_int = -150; +pub const NF_IP6_PRI_NAT_DST: ::c_int = -100; +pub const NF_IP6_PRI_FILTER: ::c_int = 0; +pub const NF_IP6_PRI_SECURITY: ::c_int = 50; +pub const NF_IP6_PRI_NAT_SRC: ::c_int = 100; +pub const NF_IP6_PRI_SELINUX_LAST: ::c_int = 225; +pub const NF_IP6_PRI_CONNTRACK_HELPER: ::c_int = 300; +pub const NF_IP6_PRI_LAST: ::c_int = ::INT_MAX; + +// linux/netfilter/nf_tables.h +pub const NFT_TABLE_MAXNAMELEN: ::c_int = 256; +pub const NFT_CHAIN_MAXNAMELEN: ::c_int = 256; +pub const NFT_SET_MAXNAMELEN: ::c_int = 256; +pub const NFT_OBJ_MAXNAMELEN: ::c_int = 256; +pub const NFT_USERDATA_MAXLEN: ::c_int = 256; + +pub const NFT_REG_VERDICT: ::c_int = 0; +pub const NFT_REG_1: ::c_int = 1; +pub const NFT_REG_2: ::c_int = 2; +pub const NFT_REG_3: ::c_int = 3; +pub const NFT_REG_4: ::c_int = 4; +pub const __NFT_REG_MAX: ::c_int = 5; +pub const NFT_REG32_00: ::c_int = 8; +pub const NFT_REG32_01: ::c_int = 9; +pub const NFT_REG32_02: ::c_int = 10; +pub const NFT_REG32_03: ::c_int = 11; +pub const NFT_REG32_04: ::c_int = 12; +pub const NFT_REG32_05: ::c_int = 13; +pub const NFT_REG32_06: ::c_int = 14; +pub const NFT_REG32_07: ::c_int = 15; +pub const NFT_REG32_08: ::c_int = 16; +pub const NFT_REG32_09: ::c_int = 17; +pub const NFT_REG32_10: ::c_int = 18; +pub const NFT_REG32_11: ::c_int = 19; +pub const NFT_REG32_12: ::c_int = 20; +pub const NFT_REG32_13: ::c_int = 21; +pub const NFT_REG32_14: ::c_int = 22; +pub const NFT_REG32_15: ::c_int = 23; + +pub const NFT_REG_SIZE: ::c_int = 16; +pub const NFT_REG32_SIZE: ::c_int = 4; + +pub const NFT_CONTINUE: ::c_int = -1; +pub const NFT_BREAK: ::c_int = -2; +pub const NFT_JUMP: ::c_int = -3; +pub const NFT_GOTO: ::c_int = -4; +pub const NFT_RETURN: ::c_int = -5; + +pub const NFT_MSG_NEWTABLE: ::c_int = 0; +pub const NFT_MSG_GETTABLE: ::c_int = 1; +pub const NFT_MSG_DELTABLE: ::c_int = 2; +pub const NFT_MSG_NEWCHAIN: ::c_int = 3; +pub const NFT_MSG_GETCHAIN: ::c_int = 4; +pub const NFT_MSG_DELCHAIN: ::c_int = 5; +pub const NFT_MSG_NEWRULE: ::c_int = 6; +pub const NFT_MSG_GETRULE: ::c_int = 7; +pub const NFT_MSG_DELRULE: ::c_int = 8; +pub const NFT_MSG_NEWSET: ::c_int = 9; +pub const NFT_MSG_GETSET: ::c_int = 10; +pub const NFT_MSG_DELSET: ::c_int = 11; +pub const NFT_MSG_NEWSETELEM: ::c_int = 12; +pub const NFT_MSG_GETSETELEM: ::c_int = 13; +pub const NFT_MSG_DELSETELEM: ::c_int = 14; +pub const NFT_MSG_NEWGEN: ::c_int = 15; +pub const NFT_MSG_GETGEN: ::c_int = 16; +pub const NFT_MSG_TRACE: ::c_int = 17; +pub const NFT_MSG_NEWOBJ: ::c_int = 18; +pub const NFT_MSG_GETOBJ: ::c_int = 19; +pub const NFT_MSG_DELOBJ: ::c_int = 20; +pub const NFT_MSG_GETOBJ_RESET: ::c_int = 21; +pub const NFT_MSG_MAX: ::c_int = 25; + +pub const NFT_SET_ANONYMOUS: ::c_int = 0x1; +pub const NFT_SET_CONSTANT: ::c_int = 0x2; +pub const NFT_SET_INTERVAL: ::c_int = 0x4; +pub const NFT_SET_MAP: ::c_int = 0x8; +pub const NFT_SET_TIMEOUT: ::c_int = 0x10; +pub const NFT_SET_EVAL: ::c_int = 0x20; + +pub const NFT_SET_POL_PERFORMANCE: ::c_int = 0; +pub const NFT_SET_POL_MEMORY: ::c_int = 1; + +pub const NFT_SET_ELEM_INTERVAL_END: ::c_int = 0x1; + +pub const NFT_DATA_VALUE: ::c_uint = 0; +pub const NFT_DATA_VERDICT: ::c_uint = 0xffffff00; + +pub const NFT_DATA_RESERVED_MASK: ::c_uint = 0xffffff00; + +pub const NFT_DATA_VALUE_MAXLEN: ::c_int = 64; + +pub const NFT_BYTEORDER_NTOH: ::c_int = 0; +pub const NFT_BYTEORDER_HTON: ::c_int = 1; + +pub const NFT_CMP_EQ: ::c_int = 0; +pub const NFT_CMP_NEQ: ::c_int = 1; +pub const NFT_CMP_LT: ::c_int = 2; +pub const NFT_CMP_LTE: ::c_int = 3; +pub const NFT_CMP_GT: ::c_int = 4; +pub const NFT_CMP_GTE: ::c_int = 5; + +pub const NFT_RANGE_EQ: ::c_int = 0; +pub const NFT_RANGE_NEQ: ::c_int = 1; + +pub const NFT_LOOKUP_F_INV: ::c_int = (1 << 0); + +pub const NFT_DYNSET_OP_ADD: ::c_int = 0; +pub const NFT_DYNSET_OP_UPDATE: ::c_int = 1; + +pub const NFT_DYNSET_F_INV: ::c_int = (1 << 0); + +pub const NFT_PAYLOAD_LL_HEADER: ::c_int = 0; +pub const NFT_PAYLOAD_NETWORK_HEADER: ::c_int = 1; +pub const NFT_PAYLOAD_TRANSPORT_HEADER: ::c_int = 2; + +pub const NFT_PAYLOAD_CSUM_NONE: ::c_int = 0; +pub const NFT_PAYLOAD_CSUM_INET: ::c_int = 1; + +pub const NFT_META_LEN: ::c_int = 0; +pub const NFT_META_PROTOCOL: ::c_int = 1; +pub const NFT_META_PRIORITY: ::c_int = 2; +pub const NFT_META_MARK: ::c_int = 3; +pub const NFT_META_IIF: ::c_int = 4; +pub const NFT_META_OIF: ::c_int = 5; +pub const NFT_META_IIFNAME: ::c_int = 6; +pub const NFT_META_OIFNAME: ::c_int = 7; +pub const NFT_META_IIFTYPE: ::c_int = 8; +pub const NFT_META_OIFTYPE: ::c_int = 9; +pub const NFT_META_SKUID: ::c_int = 10; +pub const NFT_META_SKGID: ::c_int = 11; +pub const NFT_META_NFTRACE: ::c_int = 12; +pub const NFT_META_RTCLASSID: ::c_int = 13; +pub const NFT_META_SECMARK: ::c_int = 14; +pub const NFT_META_NFPROTO: ::c_int = 15; +pub const NFT_META_L4PROTO: ::c_int = 16; +pub const NFT_META_BRI_IIFNAME: ::c_int = 17; +pub const NFT_META_BRI_OIFNAME: ::c_int = 18; +pub const NFT_META_PKTTYPE: ::c_int = 19; +pub const NFT_META_CPU: ::c_int = 20; +pub const NFT_META_IIFGROUP: ::c_int = 21; +pub const NFT_META_OIFGROUP: ::c_int = 22; +pub const NFT_META_CGROUP: ::c_int = 23; +pub const NFT_META_PRANDOM: ::c_int = 24; + +pub const NFT_CT_STATE: ::c_int = 0; +pub const NFT_CT_DIRECTION: ::c_int = 1; +pub const NFT_CT_STATUS: ::c_int = 2; +pub const NFT_CT_MARK: ::c_int = 3; +pub const NFT_CT_SECMARK: ::c_int = 4; +pub const NFT_CT_EXPIRATION: ::c_int = 5; +pub const NFT_CT_HELPER: ::c_int = 6; +pub const NFT_CT_L3PROTOCOL: ::c_int = 7; +pub const NFT_CT_SRC: ::c_int = 8; +pub const NFT_CT_DST: ::c_int = 9; +pub const NFT_CT_PROTOCOL: ::c_int = 10; +pub const NFT_CT_PROTO_SRC: ::c_int = 11; +pub const NFT_CT_PROTO_DST: ::c_int = 12; +pub const NFT_CT_LABELS: ::c_int = 13; +pub const NFT_CT_PKTS: ::c_int = 14; +pub const NFT_CT_BYTES: ::c_int = 15; + +pub const NFT_LIMIT_PKTS: ::c_int = 0; +pub const NFT_LIMIT_PKT_BYTES: ::c_int = 1; + +pub const NFT_LIMIT_F_INV: ::c_int = (1 << 0); + +pub const NFT_QUEUE_FLAG_BYPASS: ::c_int = 0x01; +pub const NFT_QUEUE_FLAG_CPU_FANOUT: ::c_int = 0x02; +pub const NFT_QUEUE_FLAG_MASK: ::c_int = 0x03; + +pub const NFT_QUOTA_F_INV: ::c_int = (1 << 0); + +pub const NFT_REJECT_ICMP_UNREACH: ::c_int = 0; +pub const NFT_REJECT_TCP_RST: ::c_int = 1; +pub const NFT_REJECT_ICMPX_UNREACH: ::c_int = 2; + +pub const NFT_REJECT_ICMPX_NO_ROUTE: ::c_int = 0; +pub const NFT_REJECT_ICMPX_PORT_UNREACH: ::c_int = 1; +pub const NFT_REJECT_ICMPX_HOST_UNREACH: ::c_int = 2; +pub const NFT_REJECT_ICMPX_ADMIN_PROHIBITED: ::c_int = 3; + +pub const NFT_NAT_SNAT: ::c_int = 0; +pub const NFT_NAT_DNAT: ::c_int = 1; + +pub const NFT_TRACETYPE_UNSPEC: ::c_int = 0; +pub const NFT_TRACETYPE_POLICY: ::c_int = 1; +pub const NFT_TRACETYPE_RETURN: ::c_int = 2; +pub const NFT_TRACETYPE_RULE: ::c_int = 3; + +pub const NFT_NG_INCREMENTAL: ::c_int = 0; +pub const NFT_NG_RANDOM: ::c_int = 1; + +pub const IFF_TUN: ::c_int = 0x0001; +pub const IFF_TAP: ::c_int = 0x0002; +pub const IFF_NO_PI: ::c_int = 0x1000; + +// start android/platform/bionic/libc/kernel/uapi/linux/if_ether.h +// from https://android.googlesource.com/ +// platform/bionic/+/master/libc/kernel/uapi/linux/if_ether.h +pub const ETH_ALEN: ::c_int = 6; +pub const ETH_HLEN: ::c_int = 14; +pub const ETH_ZLEN: ::c_int = 60; +pub const ETH_DATA_LEN: ::c_int = 1500; +pub const ETH_FRAME_LEN: ::c_int = 1514; +pub const ETH_FCS_LEN: ::c_int = 4; +pub const ETH_MIN_MTU: ::c_int = 68; +pub const ETH_MAX_MTU: ::c_int = 0xFFFF; +pub const ETH_P_LOOP: ::c_int = 0x0060; +pub const ETH_P_PUP: ::c_int = 0x0200; +pub const ETH_P_PUPAT: ::c_int = 0x0201; +pub const ETH_P_TSN: ::c_int = 0x22F0; +pub const ETH_P_IP: ::c_int = 0x0800; +pub const ETH_P_X25: ::c_int = 0x0805; +pub const ETH_P_ARP: ::c_int = 0x0806; +pub const ETH_P_BPQ: ::c_int = 0x08FF; +pub const ETH_P_IEEEPUP: ::c_int = 0x0a00; +pub const ETH_P_IEEEPUPAT: ::c_int = 0x0a01; +pub const ETH_P_BATMAN: ::c_int = 0x4305; +pub const ETH_P_DEC: ::c_int = 0x6000; +pub const ETH_P_DNA_DL: ::c_int = 0x6001; +pub const ETH_P_DNA_RC: ::c_int = 0x6002; +pub const ETH_P_DNA_RT: ::c_int = 0x6003; +pub const ETH_P_LAT: ::c_int = 0x6004; +pub const ETH_P_DIAG: ::c_int = 0x6005; +pub const ETH_P_CUST: ::c_int = 0x6006; +pub const ETH_P_SCA: ::c_int = 0x6007; +pub const ETH_P_TEB: ::c_int = 0x6558; +pub const ETH_P_RARP: ::c_int = 0x8035; +pub const ETH_P_ATALK: ::c_int = 0x809B; +pub const ETH_P_AARP: ::c_int = 0x80F3; +pub const ETH_P_8021Q: ::c_int = 0x8100; +/* see rust-lang/libc#924 pub const ETH_P_ERSPAN: ::c_int = 0x88BE;*/ +pub const ETH_P_IPX: ::c_int = 0x8137; +pub const ETH_P_IPV6: ::c_int = 0x86DD; +pub const ETH_P_PAUSE: ::c_int = 0x8808; +pub const ETH_P_SLOW: ::c_int = 0x8809; +pub const ETH_P_WCCP: ::c_int = 0x883E; +pub const ETH_P_MPLS_UC: ::c_int = 0x8847; +pub const ETH_P_MPLS_MC: ::c_int = 0x8848; +pub const ETH_P_ATMMPOA: ::c_int = 0x884c; +pub const ETH_P_PPP_DISC: ::c_int = 0x8863; +pub const ETH_P_PPP_SES: ::c_int = 0x8864; +pub const ETH_P_LINK_CTL: ::c_int = 0x886c; +pub const ETH_P_ATMFATE: ::c_int = 0x8884; +pub const ETH_P_PAE: ::c_int = 0x888E; +pub const ETH_P_AOE: ::c_int = 0x88A2; +pub const ETH_P_8021AD: ::c_int = 0x88A8; +pub const ETH_P_802_EX1: ::c_int = 0x88B5; +pub const ETH_P_TIPC: ::c_int = 0x88CA; +pub const ETH_P_MACSEC: ::c_int = 0x88E5; +pub const ETH_P_8021AH: ::c_int = 0x88E7; +pub const ETH_P_MVRP: ::c_int = 0x88F5; +pub const ETH_P_1588: ::c_int = 0x88F7; +pub const ETH_P_NCSI: ::c_int = 0x88F8; +pub const ETH_P_PRP: ::c_int = 0x88FB; +pub const ETH_P_FCOE: ::c_int = 0x8906; +/* see rust-lang/libc#924 pub const ETH_P_IBOE: ::c_int = 0x8915;*/ +pub const ETH_P_TDLS: ::c_int = 0x890D; +pub const ETH_P_FIP: ::c_int = 0x8914; +pub const ETH_P_80221: ::c_int = 0x8917; +pub const ETH_P_HSR: ::c_int = 0x892F; +/* see rust-lang/libc#924 pub const ETH_P_NSH: ::c_int = 0x894F;*/ +pub const ETH_P_LOOPBACK: ::c_int = 0x9000; +pub const ETH_P_QINQ1: ::c_int = 0x9100; +pub const ETH_P_QINQ2: ::c_int = 0x9200; +pub const ETH_P_QINQ3: ::c_int = 0x9300; +pub const ETH_P_EDSA: ::c_int = 0xDADA; +/* see rust-lang/libc#924 pub const ETH_P_IFE: ::c_int = 0xED3E;*/ +pub const ETH_P_AF_IUCV: ::c_int = 0xFBFB; +pub const ETH_P_802_3_MIN: ::c_int = 0x0600; +pub const ETH_P_802_3: ::c_int = 0x0001; +pub const ETH_P_AX25: ::c_int = 0x0002; +pub const ETH_P_ALL: ::c_int = 0x0003; +pub const ETH_P_802_2: ::c_int = 0x0004; +pub const ETH_P_SNAP: ::c_int = 0x0005; +pub const ETH_P_DDCMP: ::c_int = 0x0006; +pub const ETH_P_WAN_PPP: ::c_int = 0x0007; +pub const ETH_P_PPP_MP: ::c_int = 0x0008; +pub const ETH_P_LOCALTALK: ::c_int = 0x0009; +pub const ETH_P_CAN: ::c_int = 0x000C; +pub const ETH_P_CANFD: ::c_int = 0x000D; +pub const ETH_P_PPPTALK: ::c_int = 0x0010; +pub const ETH_P_TR_802_2: ::c_int = 0x0011; +pub const ETH_P_MOBITEX: ::c_int = 0x0015; +pub const ETH_P_CONTROL: ::c_int = 0x0016; +pub const ETH_P_IRDA: ::c_int = 0x0017; +pub const ETH_P_ECONET: ::c_int = 0x0018; +pub const ETH_P_HDLC: ::c_int = 0x0019; +pub const ETH_P_ARCNET: ::c_int = 0x001A; +pub const ETH_P_DSA: ::c_int = 0x001B; +pub const ETH_P_TRAILER: ::c_int = 0x001C; +pub const ETH_P_PHONET: ::c_int = 0x00F5; +pub const ETH_P_IEEE802154: ::c_int = 0x00F6; +pub const ETH_P_CAIF: ::c_int = 0x00F7; +pub const ETH_P_XDSA: ::c_int = 0x00F8; +/* see rust-lang/libc#924 pub const ETH_P_MAP: ::c_int = 0x00F9;*/ +// end android/platform/bionic/libc/kernel/uapi/linux/if_ether.h + +pub const SIOCADDRT: ::c_ulong = 0x0000890B; +pub const SIOCDELRT: ::c_ulong = 0x0000890C; +pub const SIOCGIFNAME: ::c_ulong = 0x00008910; +pub const SIOCSIFLINK: ::c_ulong = 0x00008911; +pub const SIOCGIFCONF: ::c_ulong = 0x00008912; +pub const SIOCGIFFLAGS: ::c_ulong = 0x00008913; +pub const SIOCSIFFLAGS: ::c_ulong = 0x00008914; +pub const SIOCGIFADDR: ::c_ulong = 0x00008915; +pub const SIOCSIFADDR: ::c_ulong = 0x00008916; +pub const SIOCGIFDSTADDR: ::c_ulong = 0x00008917; +pub const SIOCSIFDSTADDR: ::c_ulong = 0x00008918; +pub const SIOCGIFBRDADDR: ::c_ulong = 0x00008919; +pub const SIOCSIFBRDADDR: ::c_ulong = 0x0000891A; +pub const SIOCGIFNETMASK: ::c_ulong = 0x0000891B; +pub const SIOCSIFNETMASK: ::c_ulong = 0x0000891C; +pub const SIOCGIFMETRIC: ::c_ulong = 0x0000891D; +pub const SIOCSIFMETRIC: ::c_ulong = 0x0000891E; +pub const SIOCGIFMEM: ::c_ulong = 0x0000891F; +pub const SIOCSIFMEM: ::c_ulong = 0x00008920; +pub const SIOCGIFMTU: ::c_ulong = 0x00008921; +pub const SIOCSIFMTU: ::c_ulong = 0x00008922; +pub const SIOCSIFHWADDR: ::c_ulong = 0x00008924; +pub const SIOCGIFENCAP: ::c_ulong = 0x00008925; +pub const SIOCSIFENCAP: ::c_ulong = 0x00008926; +pub const SIOCGIFHWADDR: ::c_ulong = 0x00008927; +pub const SIOCGIFSLAVE: ::c_ulong = 0x00008929; +pub const SIOCSIFSLAVE: ::c_ulong = 0x00008930; +pub const SIOCADDMULTI: ::c_ulong = 0x00008931; +pub const SIOCDELMULTI: ::c_ulong = 0x00008932; +pub const SIOCDARP: ::c_ulong = 0x00008953; +pub const SIOCGARP: ::c_ulong = 0x00008954; +pub const SIOCSARP: ::c_ulong = 0x00008955; +pub const SIOCDRARP: ::c_ulong = 0x00008960; +pub const SIOCGRARP: ::c_ulong = 0x00008961; +pub const SIOCSRARP: ::c_ulong = 0x00008962; +pub const SIOCGIFMAP: ::c_ulong = 0x00008970; +pub const SIOCSIFMAP: ::c_ulong = 0x00008971; + +// linux/module.h +pub const MODULE_INIT_IGNORE_MODVERSIONS: ::c_uint = 0x0001; +pub const MODULE_INIT_IGNORE_VERMAGIC: ::c_uint = 0x0002; + +#[deprecated( + since = "0.2.55", + note = "ENOATTR is not available on Android; use ENODATA instead" +)] +pub const ENOATTR: ::c_int = ::ENODATA; + +// linux/if_alg.h +pub const ALG_SET_KEY: ::c_int = 1; +pub const ALG_SET_IV: ::c_int = 2; +pub const ALG_SET_OP: ::c_int = 3; +pub const ALG_SET_AEAD_ASSOCLEN: ::c_int = 4; +pub const ALG_SET_AEAD_AUTHSIZE: ::c_int = 5; + +pub const ALG_OP_DECRYPT: ::c_int = 0; +pub const ALG_OP_ENCRYPT: ::c_int = 1; + +// uapi/linux/inotify.h +pub const IN_ACCESS: u32 = 0x0000_0001; +pub const IN_MODIFY: u32 = 0x0000_0002; +pub const IN_ATTRIB: u32 = 0x0000_0004; +pub const IN_CLOSE_WRITE: u32 = 0x0000_0008; +pub const IN_CLOSE_NOWRITE: u32 = 0x0000_0010; +pub const IN_CLOSE: u32 = (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE); +pub const IN_OPEN: u32 = 0x0000_0020; +pub const IN_MOVED_FROM: u32 = 0x0000_0040; +pub const IN_MOVED_TO: u32 = 0x0000_0080; +pub const IN_MOVE: u32 = (IN_MOVED_FROM | IN_MOVED_TO); +pub const IN_CREATE: u32 = 0x0000_0100; +pub const IN_DELETE: u32 = 0x0000_0200; +pub const IN_DELETE_SELF: u32 = 0x0000_0400; +pub const IN_MOVE_SELF: u32 = 0x0000_0800; +pub const IN_UNMOUNT: u32 = 0x0000_2000; +pub const IN_Q_OVERFLOW: u32 = 0x0000_4000; +pub const IN_IGNORED: u32 = 0x0000_8000; +pub const IN_ONLYDIR: u32 = 0x0100_0000; +pub const IN_DONT_FOLLOW: u32 = 0x0200_0000; +// pub const IN_EXCL_UNLINK: u32 = 0x0400_0000; + +// pub const IN_MASK_CREATE: u32 = 0x1000_0000; +// pub const IN_MASK_ADD: u32 = 0x2000_0000; +pub const IN_ISDIR: u32 = 0x4000_0000; +pub const IN_ONESHOT: u32 = 0x8000_0000; + +pub const IN_ALL_EVENTS: u32 = ( + IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | + IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | + IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | + IN_MOVE_SELF +); + +pub const IN_CLOEXEC: ::c_int = O_CLOEXEC; +pub const IN_NONBLOCK: ::c_int = O_NONBLOCK; + +pub const FUTEX_WAIT: ::c_int = 0; +pub const FUTEX_WAKE: ::c_int = 1; +pub const FUTEX_FD: ::c_int = 2; +pub const FUTEX_REQUEUE: ::c_int = 3; +pub const FUTEX_CMP_REQUEUE: ::c_int = 4; +pub const FUTEX_WAKE_OP: ::c_int = 5; +pub const FUTEX_LOCK_PI: ::c_int = 6; +pub const FUTEX_UNLOCK_PI: ::c_int = 7; +pub const FUTEX_TRYLOCK_PI: ::c_int = 8; +pub const FUTEX_WAIT_BITSET: ::c_int = 9; +pub const FUTEX_WAKE_BITSET: ::c_int = 10; +pub const FUTEX_WAIT_REQUEUE_PI: ::c_int = 11; +pub const FUTEX_CMP_REQUEUE_PI: ::c_int = 12; + +pub const FUTEX_PRIVATE_FLAG: ::c_int = 128; +pub const FUTEX_CLOCK_REALTIME: ::c_int = 256; +pub const FUTEX_CMD_MASK: ::c_int = + !(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME); + +f! { + pub fn CMSG_NXTHDR(mhdr: *const msghdr, + cmsg: *const cmsghdr) -> *mut cmsghdr { + let next = (cmsg as usize + + super::CMSG_ALIGN((*cmsg).cmsg_len as usize)) + as *mut cmsghdr; + let max = (*mhdr).msg_control as usize + + (*mhdr).msg_controllen as usize; + if (next.offset(1)) as usize > max { + 0 as *mut cmsghdr + } else { + next as *mut cmsghdr + } + } + + pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { + for slot in cpuset.__bits.iter_mut() { + *slot = 0; + } + } + + pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { + let size_in___bits = 8 * ::mem::size_of_val(&cpuset.__bits[0]); + let (idx, offset) = (cpu / size_in___bits, cpu % size_in___bits); + cpuset.__bits[idx] |= 1 << offset; + () + } + + pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { + let size_in___bits = 8 * ::mem::size_of_val(&cpuset.__bits[0]); + let (idx, offset) = (cpu / size_in___bits, cpu % size_in___bits); + cpuset.__bits[idx] &= !(1 << offset); + () + } + + pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { + let size_in___bits = 8 * ::mem::size_of_val(&cpuset.__bits[0]); + let (idx, offset) = (cpu / size_in___bits, cpu % size_in___bits); + 0 != (cpuset.__bits[idx] & (1 << offset)) + } + + pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { + set1.__bits == set2.__bits + } + pub fn major(dev: ::dev_t) -> ::c_int { + ((dev >> 8) & 0xfff) as ::c_int + } + pub fn minor(dev: ::dev_t) -> ::c_int { + ((dev & 0xff) | ((dev >> 12) & 0xfff00)) as ::c_int + } + pub fn makedev(ma: ::c_int, mi: ::c_int) -> ::dev_t { + let ma = ma as ::dev_t; + let mi = mi as ::dev_t; + ((ma & 0xfff) << 8) | (mi & 0xff) | ((mi & 0xfff00) << 12) + } + + pub fn NLA_ALIGN(len: ::c_int) -> ::c_int { + return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1) + } +} + +extern { + pub fn getrlimit64(resource: ::c_int, + rlim: *mut rlimit64) -> ::c_int; + pub fn setrlimit64(resource: ::c_int, + rlim: *const rlimit64) -> ::c_int; + pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; + pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; + pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, + buflen: ::size_t) -> ::c_int; + + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::timezone) -> ::c_int; + pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) + -> ::c_int; + pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; + pub fn msync(addr: *mut ::c_void, len: ::size_t, + flags: ::c_int) -> ::c_int; + pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) + -> ::c_int; + pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, + flags: ::c_int, addr: *mut ::sockaddr, + addrlen: *mut ::socklen_t) -> ::ssize_t; + pub fn getnameinfo(sa: *const ::sockaddr, + salen: ::socklen_t, + host: *mut ::c_char, + hostlen: ::size_t, + serv: *mut ::c_char, + sevlen: ::size_t, + flags: ::c_int) -> ::c_int; + pub fn ptrace(request: ::c_int, ...) -> ::c_long; + pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; + pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; + pub fn __sched_cpualloc(count: ::size_t) -> *mut ::cpu_set_t; + pub fn __sched_cpufree(set: *mut ::cpu_set_t); + pub fn __sched_cpucount(setsize: ::size_t, + set: *const cpu_set_t) -> ::c_int; + pub fn sched_getcpu() -> ::c_int; + + pub fn utmpname(name: *const ::c_char) -> ::c_int; + pub fn setutent(); + pub fn getutent() -> *mut utmp; + + pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, + len: ::off_t) -> ::c_int; + pub fn signalfd(fd: ::c_int, mask: *const ::sigset_t, flags: ::c_int) + -> ::c_int; + pub fn syscall(num: ::c_long, ...) -> ::c_long; + pub fn sched_getaffinity(pid: ::pid_t, + cpusetsize: ::size_t, + cpuset: *mut cpu_set_t) -> ::c_int; + pub fn sched_setaffinity(pid: ::pid_t, + cpusetsize: ::size_t, + cpuset: *const cpu_set_t) -> ::c_int; + pub fn epoll_create(size: ::c_int) -> ::c_int; + pub fn epoll_create1(flags: ::c_int) -> ::c_int; + pub fn epoll_wait(epfd: ::c_int, + events: *mut ::epoll_event, + maxevents: ::c_int, + timeout: ::c_int) -> ::c_int; + pub fn epoll_ctl(epfd: ::c_int, + op: ::c_int, + fd: ::c_int, + event: *mut ::epoll_event) -> ::c_int; + pub fn pthread_getschedparam(native: ::pthread_t, + policy: *mut ::c_int, + param: *mut ::sched_param) -> ::c_int; + pub fn unshare(flags: ::c_int) -> ::c_int; + pub fn umount(target: *const ::c_char) -> ::c_int; + pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int; + pub fn tee(fd_in: ::c_int, + fd_out: ::c_int, + len: ::size_t, + flags: ::c_uint) -> ::ssize_t; + pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int; + pub fn splice(fd_in: ::c_int, + off_in: *mut ::loff_t, + fd_out: ::c_int, + off_out: *mut ::loff_t, + len: ::size_t, + flags: ::c_uint) -> ::ssize_t; + pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; + pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int; + pub fn sem_timedwait(sem: *mut sem_t, + abstime: *const ::timespec) -> ::c_int; + pub fn sem_getvalue(sem: *mut sem_t, + sval: *mut ::c_int) -> ::c_int; + pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int; + pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int; + pub fn swapoff(puath: *const ::c_char) -> ::c_int; + pub fn vmsplice(fd: ::c_int, + iov: *const ::iovec, + nr_segs: ::size_t, + flags: ::c_uint) -> ::ssize_t; + pub fn mount(src: *const ::c_char, + target: *const ::c_char, + fstype: *const ::c_char, + flags: ::c_ulong, + data: *const ::c_void) -> ::c_int; + pub fn personality(persona: ::c_uint) -> ::c_int; + pub fn prctl(option: ::c_int, ...) -> ::c_int; + pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int; + pub fn ppoll(fds: *mut ::pollfd, + nfds: nfds_t, + timeout: *const ::timespec, + sigmask: *const sigset_t) -> ::c_int; + pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t, + abstime: *const ::timespec) -> ::c_int; + pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int, + child_stack: *mut ::c_void, + flags: ::c_int, + arg: *mut ::c_void, ...) -> ::c_int; + pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int; + pub fn clock_nanosleep(clk_id: ::clockid_t, + flags: ::c_int, + rqtp: *const ::timespec, + rmtp: *mut ::timespec) -> ::c_int; + pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t, + guardsize: *mut ::size_t) -> ::c_int; + pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int; + pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int; + pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t, + pshared: *mut ::c_int) -> ::c_int; + pub fn sysinfo(info: *mut ::sysinfo) -> ::c_int; + pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int; + pub fn pthread_setschedparam(native: ::pthread_t, + policy: ::c_int, + param: *const ::sched_param) -> ::c_int; + pub fn swapon(path: *const ::c_char, swapflags: ::c_int) -> ::c_int; + pub fn sched_setscheduler(pid: ::pid_t, + policy: ::c_int, + param: *const ::sched_param) -> ::c_int; + pub fn sendfile(out_fd: ::c_int, + in_fd: ::c_int, + offset: *mut off_t, + count: ::size_t) -> ::ssize_t; + pub fn setfsgid(gid: ::gid_t) -> ::c_int; + pub fn setfsuid(uid: ::uid_t) -> ::c_int; + pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int; + #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")] + pub fn getgrgid_r(gid: ::gid_t, + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group) -> ::c_int; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "sigaltstack$UNIX2003")] + #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")] + pub fn sigaltstack(ss: *const stack_t, + oss: *mut stack_t) -> ::c_int; + pub fn sem_close(sem: *mut sem_t) -> ::c_int; + #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")] + pub fn getgrnam_r(name: *const ::c_char, + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group) -> ::c_int; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "pthread_sigmask$UNIX2003")] + pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, + oldset: *mut sigset_t) -> ::c_int; + pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t; + pub fn getgrnam(name: *const ::c_char) -> *mut ::group; + pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; + pub fn sem_unlink(name: *const ::c_char) -> ::c_int; + pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; + #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")] + #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")] + pub fn getpwnam_r(name: *const ::c_char, + pwd: *mut passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut passwd) -> ::c_int; + #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")] + #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")] + pub fn getpwuid_r(uid: ::uid_t, + pwd: *mut passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut passwd) -> ::c_int; + #[cfg_attr(all(target_os = "macos", target_arch ="x86"), + link_name = "sigwait$UNIX2003")] + #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] + pub fn sigwait(set: *const sigset_t, + sig: *mut ::c_int) -> ::c_int; + pub fn pthread_atfork(prepare: ::Option, + parent: ::Option, + child: ::Option) -> ::c_int; + pub fn getgrgid(gid: ::gid_t) -> *mut ::group; + pub fn getgrouplist(user: *const ::c_char, + group: ::gid_t, + groups: *mut ::gid_t, + ngroups: *mut ::c_int) -> ::c_int; + pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int; + pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t, + pshared: *mut ::c_int) -> ::c_int; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "popen$UNIX2003")] + pub fn popen(command: *const c_char, + mode: *const c_char) -> *mut ::FILE; + pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char, + mode: ::c_int, flags: ::c_int) -> ::c_int; + pub fn pthread_create(native: *mut ::pthread_t, + attr: *const ::pthread_attr_t, + f: extern fn(*mut ::c_void) -> *mut ::c_void, + value: *mut ::c_void) -> ::c_int; + pub fn __errno() -> *mut ::c_int; + pub fn inotify_rm_watch(fd: ::c_int, wd: u32) -> ::c_int; + pub fn sendmmsg(sockfd: ::c_int, msgvec: *const ::mmsghdr, vlen: ::c_uint, + flags: ::c_int) -> ::c_int; + pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, + flags: ::c_int, timeout: *const ::timespec) -> ::c_int; + pub fn inotify_init() -> ::c_int; + pub fn inotify_init1(flags: ::c_int) -> ::c_int; + pub fn inotify_add_watch(fd: ::c_int, + path: *const ::c_char, + mask: u32) -> ::c_int; +} + +cfg_if! { + if #[cfg(target_pointer_width = "32")] { + mod b32; + pub use self::b32::*; + } else if #[cfg(target_pointer_width = "64")] { + mod b64; + pub use self::b64::*; + } else { + // Unknown target_pointer_width + } +} + +impl siginfo_t { + pub unsafe fn si_value(&self) -> ::sigval { + #[repr(C)] + struct siginfo_timer { + _si_signo: ::c_int, + _si_errno: ::c_int, + _si_code: ::c_int, + _si_tid: ::c_int, + _si_overrun: ::c_int, + si_sigval: ::sigval, + } + (*(self as *const siginfo_t as *const siginfo_timer)).si_sigval + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/emscripten/align.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/emscripten/align.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/emscripten/align.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/emscripten/align.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,66 @@ +macro_rules! expand_align { + () => { + s! { + #[repr(align(4))] + pub struct pthread_mutex_t { + size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], + } + + #[repr(align(4))] + pub struct pthread_rwlock_t { + size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], + } + + #[repr(align(4))] + pub struct pthread_mutexattr_t { + size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], + } + + #[repr(align(4))] + pub struct pthread_rwlockattr_t { + size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T], + } + + #[repr(align(4))] + pub struct pthread_condattr_t { + size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], + } + } + + s_no_extra_traits! { + #[cfg_attr(target_pointer_width = "32", + repr(align(4)))] + #[cfg_attr(target_pointer_width = "64", + repr(align(8)))] + pub struct pthread_cond_t { + size: [u8; ::__SIZEOF_PTHREAD_COND_T], + } + } + + cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for pthread_cond_t { + fn eq(&self, other: &pthread_cond_t) -> bool { + self.size + .iter() + .zip(other.size.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for pthread_cond_t {} + impl ::fmt::Debug for pthread_cond_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("pthread_cond_t") + // FIXME: .field("size", &self.size) + .finish() + } + } + impl ::hash::Hash for pthread_cond_t { + fn hash(&self, state: &mut H) { + self.size.hash(state); + } + } + } + } + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/emscripten/mod.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/emscripten/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/emscripten/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/emscripten/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,1851 @@ +pub type c_char = i8; +pub type wchar_t = i32; +pub type useconds_t = u32; +pub type dev_t = u32; +pub type socklen_t = u32; +pub type pthread_t = c_ulong; +pub type mode_t = u32; +pub type ino64_t = u32; +pub type off64_t = i32; +pub type blkcnt64_t = i32; +pub type rlim64_t = u64; +pub type shmatt_t = ::c_ulong; +pub type mqd_t = ::c_int; +pub type msgqnum_t = ::c_ulong; +pub type msglen_t = ::c_ulong; +pub type nfds_t = ::c_ulong; +pub type nl_item = ::c_int; +pub type idtype_t = ::c_uint; +pub type loff_t = i32; +pub type pthread_key_t = ::c_uint; + +pub type clock_t = c_long; +pub type time_t = c_long; +pub type suseconds_t = c_long; +pub type ino_t = u32; +pub type off_t = i32; +pub type blkcnt_t = i32; + +pub type blksize_t = c_long; +pub type fsblkcnt_t = u32; +pub type fsfilcnt_t = u32; +pub type rlim_t = ::c_ulonglong; +pub type c_long = i32; +pub type c_ulong = u32; +pub type nlink_t = u32; + +#[cfg_attr(feature = "extra_traits", derive(Debug))] +pub enum fpos64_t {} // TODO: fill this out with a struct +impl ::Copy for fpos64_t {} +impl ::Clone for fpos64_t { + fn clone(&self) -> fpos64_t { *self } +} + +s! { + pub struct rlimit64 { + pub rlim_cur: rlim64_t, + pub rlim_max: rlim64_t, + } + + pub struct glob_t { + pub gl_pathc: ::size_t, + pub gl_pathv: *mut *mut c_char, + pub gl_offs: ::size_t, + pub gl_flags: ::c_int, + + __unused1: *mut ::c_void, + __unused2: *mut ::c_void, + __unused3: *mut ::c_void, + __unused4: *mut ::c_void, + __unused5: *mut ::c_void, + } + + pub struct passwd { + pub pw_name: *mut ::c_char, + pub pw_passwd: *mut ::c_char, + pub pw_uid: ::uid_t, + pub pw_gid: ::gid_t, + pub pw_gecos: *mut ::c_char, + pub pw_dir: *mut ::c_char, + pub pw_shell: *mut ::c_char, + } + + pub struct spwd { + pub sp_namp: *mut ::c_char, + pub sp_pwdp: *mut ::c_char, + pub sp_lstchg: ::c_long, + pub sp_min: ::c_long, + pub sp_max: ::c_long, + pub sp_warn: ::c_long, + pub sp_inact: ::c_long, + pub sp_expire: ::c_long, + pub sp_flag: ::c_ulong, + } + + pub struct statvfs { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_favail: ::fsfilcnt_t, + pub f_fsid: ::c_ulong, + __f_unused: ::c_int, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct dqblk { + pub dqb_bhardlimit: u64, + pub dqb_bsoftlimit: u64, + pub dqb_curspace: u64, + pub dqb_ihardlimit: u64, + pub dqb_isoftlimit: u64, + pub dqb_curinodes: u64, + pub dqb_btime: u64, + pub dqb_itime: u64, + pub dqb_valid: u32, + } + + pub struct signalfd_siginfo { + pub ssi_signo: u32, + pub ssi_errno: i32, + pub ssi_code: i32, + pub ssi_pid: u32, + pub ssi_uid: u32, + pub ssi_fd: i32, + pub ssi_tid: u32, + pub ssi_band: u32, + pub ssi_overrun: u32, + pub ssi_trapno: u32, + pub ssi_status: i32, + pub ssi_int: i32, + pub ssi_ptr: u64, + pub ssi_utime: u64, + pub ssi_stime: u64, + pub ssi_addr: u64, + pub ssi_addr_lsb: u16, + _pad2: u16, + pub ssi_syscall: i32, + pub ssi_call_addr: u64, + pub ssi_arch: u32, + _pad: [u8; 28], + } + + pub struct fsid_t { + __val: [::c_int; 2], + } + + pub struct cpu_set_t { + bits: [u32; 32], + } + + pub struct if_nameindex { + pub if_index: ::c_uint, + pub if_name: *mut ::c_char, + } + + // System V IPC + pub struct msginfo { + pub msgpool: ::c_int, + pub msgmap: ::c_int, + pub msgmax: ::c_int, + pub msgmnb: ::c_int, + pub msgmni: ::c_int, + pub msgssz: ::c_int, + pub msgtql: ::c_int, + pub msgseg: ::c_ushort, + } + + pub struct sembuf { + pub sem_num: ::c_ushort, + pub sem_op: ::c_short, + pub sem_flg: ::c_short, + } + + pub struct aiocb { + pub aio_fildes: ::c_int, + pub aio_lio_opcode: ::c_int, + pub aio_reqprio: ::c_int, + pub aio_buf: *mut ::c_void, + pub aio_nbytes: ::size_t, + pub aio_sigevent: ::sigevent, + __td: *mut ::c_void, + __lock: [::c_int; 2], + __err: ::c_int, + __ret: ::ssize_t, + pub aio_offset: off_t, + __next: *mut ::c_void, + __prev: *mut ::c_void, + __dummy4: [::c_char; 24], + } + + pub struct sigaction { + pub sa_sigaction: ::sighandler_t, + pub sa_mask: ::sigset_t, + pub sa_flags: ::c_int, + pub sa_restorer: ::Option, + } + + pub struct ipc_perm { + pub __ipc_perm_key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::mode_t, + pub __seq: ::c_int, + __unused1: ::c_long, + __unused2: ::c_long + } + + pub struct termios { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; ::NCCS], + pub __c_ispeed: ::speed_t, + pub __c_ospeed: ::speed_t, + } + + pub struct flock { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off_t, + pub l_len: ::off_t, + pub l_pid: ::pid_t, + } + + pub struct pthread_attr_t { + __size: [u32; 11] + } + + pub struct sigset_t { + __val: [::c_ulong; 32], + } + + pub struct msghdr { + pub msg_name: *mut ::c_void, + pub msg_namelen: ::socklen_t, + pub msg_iov: *mut ::iovec, + pub msg_iovlen: ::c_int, + pub msg_control: *mut ::c_void, + pub msg_controllen: ::socklen_t, + pub msg_flags: ::c_int, + } + + pub struct cmsghdr { + pub cmsg_len: ::socklen_t, + pub cmsg_level: ::c_int, + pub cmsg_type: ::c_int, + } + + pub struct sem_t { + __val: [::c_int; 4], + } + pub struct stat { + pub st_dev: ::dev_t, + __st_dev_padding: ::c_int, + __st_ino_truncated: ::c_long, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __st_rdev_padding: ::c_int, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_ino: ::ino_t, + } + + pub struct stat64 { + pub st_dev: ::dev_t, + __st_dev_padding: ::c_int, + __st_ino_truncated: ::c_long, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __st_rdev_padding: ::c_int, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_ino: ::ino_t, + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_flags: ::c_int, + pub ss_size: ::size_t + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_atime: ::time_t, + __unused1: ::c_int, + pub shm_dtime: ::time_t, + __unused2: ::c_int, + pub shm_ctime: ::time_t, + __unused3: ::c_int, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, + pub shm_nattch: ::c_ulong, + __pad1: ::c_ulong, + __pad2: ::c_ulong, + } + + pub struct msqid_ds { + pub msg_perm: ::ipc_perm, + pub msg_stime: ::time_t, + __unused1: ::c_int, + pub msg_rtime: ::time_t, + __unused2: ::c_int, + pub msg_ctime: ::time_t, + __unused3: ::c_int, + __msg_cbytes: ::c_ulong, + pub msg_qnum: ::msgqnum_t, + pub msg_qbytes: ::msglen_t, + pub msg_lspid: ::pid_t, + pub msg_lrpid: ::pid_t, + __pad1: ::c_ulong, + __pad2: ::c_ulong, + } + + pub struct statfs { + pub f_type: ::c_ulong, + pub f_bsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_flags: ::c_ulong, + pub f_spare: [::c_ulong; 4], + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + pub _pad: [::c_int; 29], + _align: [usize; 0], + } + + pub struct statfs64 { + pub f_type: ::c_ulong, + pub f_bsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_flags: ::c_ulong, + pub f_spare: [::c_ulong; 4], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u32, + pub f_bfree: u32, + pub f_bavail: u32, + pub f_files: u32, + pub f_ffree: u32, + pub f_favail: u32, + pub f_fsid: ::c_ulong, + __f_unused: ::c_int, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct arpd_request { + pub req: ::c_ushort, + pub ip: u32, + pub dev: ::c_ulong, + pub stamp: ::c_ulong, + pub updated: ::c_ulong, + pub ha: [::c_uchar; ::MAX_ADDR_LEN], + } +} + +s_no_extra_traits! { + pub struct dirent { + pub d_ino: ::ino_t, + pub d_off: ::off_t, + pub d_reclen: ::c_ushort, + pub d_type: ::c_uchar, + pub d_name: [::c_char; 256], + } + + pub struct dirent64 { + pub d_ino: ::ino64_t, + pub d_off: ::off64_t, + pub d_reclen: ::c_ushort, + pub d_type: ::c_uchar, + pub d_name: [::c_char; 256], + } + + pub struct sysinfo { + pub uptime: ::c_ulong, + pub loads: [::c_ulong; 3], + pub totalram: ::c_ulong, + pub freeram: ::c_ulong, + pub sharedram: ::c_ulong, + pub bufferram: ::c_ulong, + pub totalswap: ::c_ulong, + pub freeswap: ::c_ulong, + pub procs: ::c_ushort, + pub pad: ::c_ushort, + pub totalhigh: ::c_ulong, + pub freehigh: ::c_ulong, + pub mem_unit: ::c_uint, + pub __reserved: [::c_char; 256], + } + + pub struct mq_attr { + pub mq_flags: ::c_long, + pub mq_maxmsg: ::c_long, + pub mq_msgsize: ::c_long, + pub mq_curmsgs: ::c_long, + pad: [::c_long; 4] + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for dirent { + fn eq(&self, other: &dirent) -> bool { + self.d_ino == other.d_ino + && self.d_off == other.d_off + && self.d_reclen == other.d_reclen + && self.d_type == other.d_type + && self + .d_name + .iter() + .zip(other.d_name.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for dirent {} + impl ::fmt::Debug for dirent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("dirent") + .field("d_ino", &self.d_ino) + .field("d_off", &self.d_off) + .field("d_reclen", &self.d_reclen) + .field("d_type", &self.d_type) + // FIXME: .field("d_name", &self.d_name) + .finish() + } + } + impl ::hash::Hash for dirent { + fn hash(&self, state: &mut H) { + self.d_ino.hash(state); + self.d_off.hash(state); + self.d_reclen.hash(state); + self.d_type.hash(state); + self.d_name.hash(state); + } + } + + impl PartialEq for dirent64 { + fn eq(&self, other: &dirent64) -> bool { + self.d_ino == other.d_ino + && self.d_off == other.d_off + && self.d_reclen == other.d_reclen + && self.d_type == other.d_type + && self + .d_name + .iter() + .zip(other.d_name.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for dirent64 {} + impl ::fmt::Debug for dirent64 { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("dirent64") + .field("d_ino", &self.d_ino) + .field("d_off", &self.d_off) + .field("d_reclen", &self.d_reclen) + .field("d_type", &self.d_type) + // FIXME: .field("d_name", &self.d_name) + .finish() + } + } + impl ::hash::Hash for dirent64 { + fn hash(&self, state: &mut H) { + self.d_ino.hash(state); + self.d_off.hash(state); + self.d_reclen.hash(state); + self.d_type.hash(state); + self.d_name.hash(state); + } + } + + impl PartialEq for sysinfo { + fn eq(&self, other: &sysinfo) -> bool { + self.uptime == other.uptime + && self.loads == other.loads + && self.totalram == other.totalram + && self.freeram == other.freeram + && self.sharedram == other.sharedram + && self.bufferram == other.bufferram + && self.totalswap == other.totalswap + && self.freeswap == other.freeswap + && self.procs == other.procs + && self.pad == other.pad + && self.totalhigh == other.totalhigh + && self.freehigh == other.freehigh + && self.mem_unit == other.mem_unit + && self + .__reserved + .iter() + .zip(other.__reserved.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for sysinfo {} + impl ::fmt::Debug for sysinfo { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sysinfo") + .field("uptime", &self.uptime) + .field("loads", &self.loads) + .field("totalram", &self.totalram) + .field("freeram", &self.freeram) + .field("sharedram", &self.sharedram) + .field("bufferram", &self.bufferram) + .field("totalswap", &self.totalswap) + .field("freeswap", &self.freeswap) + .field("procs", &self.procs) + .field("pad", &self.pad) + .field("totalhigh", &self.totalhigh) + .field("freehigh", &self.freehigh) + .field("mem_unit", &self.mem_unit) + // FIXME: .field("__reserved", &self.__reserved) + .finish() + } + } + impl ::hash::Hash for sysinfo { + fn hash(&self, state: &mut H) { + self.uptime.hash(state); + self.loads.hash(state); + self.totalram.hash(state); + self.freeram.hash(state); + self.sharedram.hash(state); + self.bufferram.hash(state); + self.totalswap.hash(state); + self.freeswap.hash(state); + self.procs.hash(state); + self.pad.hash(state); + self.totalhigh.hash(state); + self.freehigh.hash(state); + self.mem_unit.hash(state); + self.__reserved.hash(state); + } + } + + impl PartialEq for mq_attr { + fn eq(&self, other: &mq_attr) -> bool { + self.mq_flags == other.mq_flags && + self.mq_maxmsg == other.mq_maxmsg && + self.mq_msgsize == other.mq_msgsize && + self.mq_curmsgs == other.mq_curmsgs + } + } + impl Eq for mq_attr {} + impl ::fmt::Debug for mq_attr { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("mq_attr") + .field("mq_flags", &self.mq_flags) + .field("mq_maxmsg", &self.mq_maxmsg) + .field("mq_msgsize", &self.mq_msgsize) + .field("mq_curmsgs", &self.mq_curmsgs) + .finish() + } + } + impl ::hash::Hash for mq_attr { + fn hash(&self, state: &mut H) { + self.mq_flags.hash(state); + self.mq_maxmsg.hash(state); + self.mq_msgsize.hash(state); + self.mq_curmsgs.hash(state); + } + } + } +} + +pub const MADV_SOFT_OFFLINE: ::c_int = 101; +pub const MS_NOUSER: ::c_ulong = 0x80000000; +pub const MS_RMT_MASK: ::c_ulong = 0x02800051; + +pub const ABDAY_1: ::nl_item = 0x20000; +pub const ABDAY_2: ::nl_item = 0x20001; +pub const ABDAY_3: ::nl_item = 0x20002; +pub const ABDAY_4: ::nl_item = 0x20003; +pub const ABDAY_5: ::nl_item = 0x20004; +pub const ABDAY_6: ::nl_item = 0x20005; +pub const ABDAY_7: ::nl_item = 0x20006; + +pub const DAY_1: ::nl_item = 0x20007; +pub const DAY_2: ::nl_item = 0x20008; +pub const DAY_3: ::nl_item = 0x20009; +pub const DAY_4: ::nl_item = 0x2000A; +pub const DAY_5: ::nl_item = 0x2000B; +pub const DAY_6: ::nl_item = 0x2000C; +pub const DAY_7: ::nl_item = 0x2000D; + +pub const ABMON_1: ::nl_item = 0x2000E; +pub const ABMON_2: ::nl_item = 0x2000F; +pub const ABMON_3: ::nl_item = 0x20010; +pub const ABMON_4: ::nl_item = 0x20011; +pub const ABMON_5: ::nl_item = 0x20012; +pub const ABMON_6: ::nl_item = 0x20013; +pub const ABMON_7: ::nl_item = 0x20014; +pub const ABMON_8: ::nl_item = 0x20015; +pub const ABMON_9: ::nl_item = 0x20016; +pub const ABMON_10: ::nl_item = 0x20017; +pub const ABMON_11: ::nl_item = 0x20018; +pub const ABMON_12: ::nl_item = 0x20019; + +pub const MON_1: ::nl_item = 0x2001A; +pub const MON_2: ::nl_item = 0x2001B; +pub const MON_3: ::nl_item = 0x2001C; +pub const MON_4: ::nl_item = 0x2001D; +pub const MON_5: ::nl_item = 0x2001E; +pub const MON_6: ::nl_item = 0x2001F; +pub const MON_7: ::nl_item = 0x20020; +pub const MON_8: ::nl_item = 0x20021; +pub const MON_9: ::nl_item = 0x20022; +pub const MON_10: ::nl_item = 0x20023; +pub const MON_11: ::nl_item = 0x20024; +pub const MON_12: ::nl_item = 0x20025; + +pub const AM_STR: ::nl_item = 0x20026; +pub const PM_STR: ::nl_item = 0x20027; + +pub const D_T_FMT: ::nl_item = 0x20028; +pub const D_FMT: ::nl_item = 0x20029; +pub const T_FMT: ::nl_item = 0x2002A; +pub const T_FMT_AMPM: ::nl_item = 0x2002B; + +pub const ERA: ::nl_item = 0x2002C; +pub const ERA_D_FMT: ::nl_item = 0x2002E; +pub const ALT_DIGITS: ::nl_item = 0x2002F; +pub const ERA_D_T_FMT: ::nl_item = 0x20030; +pub const ERA_T_FMT: ::nl_item = 0x20031; + +pub const CODESET: ::nl_item = 14; + +pub const CRNCYSTR: ::nl_item = 0x4000F; + +pub const RUSAGE_THREAD: ::c_int = 1; +pub const RUSAGE_CHILDREN: ::c_int = -1; + +pub const RADIXCHAR: ::nl_item = 0x10000; +pub const THOUSEP: ::nl_item = 0x10001; + +pub const YESEXPR: ::nl_item = 0x50000; +pub const NOEXPR: ::nl_item = 0x50001; +pub const YESSTR: ::nl_item = 0x50002; +pub const NOSTR: ::nl_item = 0x50003; + +pub const FILENAME_MAX: ::c_uint = 4096; +pub const L_tmpnam: ::c_uint = 20; +pub const _PC_LINK_MAX: ::c_int = 0; +pub const _PC_MAX_CANON: ::c_int = 1; +pub const _PC_MAX_INPUT: ::c_int = 2; +pub const _PC_NAME_MAX: ::c_int = 3; +pub const _PC_PATH_MAX: ::c_int = 4; +pub const _PC_PIPE_BUF: ::c_int = 5; +pub const _PC_CHOWN_RESTRICTED: ::c_int = 6; +pub const _PC_NO_TRUNC: ::c_int = 7; +pub const _PC_VDISABLE: ::c_int = 8; +pub const _PC_SYNC_IO: ::c_int = 9; +pub const _PC_ASYNC_IO: ::c_int = 10; +pub const _PC_PRIO_IO: ::c_int = 11; +pub const _PC_SOCK_MAXBUF: ::c_int = 12; +pub const _PC_FILESIZEBITS: ::c_int = 13; +pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14; +pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15; +pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16; +pub const _PC_REC_XFER_ALIGN: ::c_int = 17; +pub const _PC_ALLOC_SIZE_MIN: ::c_int = 18; +pub const _PC_SYMLINK_MAX: ::c_int = 19; +pub const _PC_2_SYMLINKS: ::c_int = 20; + +pub const _SC_ARG_MAX: ::c_int = 0; +pub const _SC_CHILD_MAX: ::c_int = 1; +pub const _SC_CLK_TCK: ::c_int = 2; +pub const _SC_NGROUPS_MAX: ::c_int = 3; +pub const _SC_OPEN_MAX: ::c_int = 4; +pub const _SC_STREAM_MAX: ::c_int = 5; +pub const _SC_TZNAME_MAX: ::c_int = 6; +pub const _SC_JOB_CONTROL: ::c_int = 7; +pub const _SC_SAVED_IDS: ::c_int = 8; +pub const _SC_REALTIME_SIGNALS: ::c_int = 9; +pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10; +pub const _SC_TIMERS: ::c_int = 11; +pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12; +pub const _SC_PRIORITIZED_IO: ::c_int = 13; +pub const _SC_SYNCHRONIZED_IO: ::c_int = 14; +pub const _SC_FSYNC: ::c_int = 15; +pub const _SC_MAPPED_FILES: ::c_int = 16; +pub const _SC_MEMLOCK: ::c_int = 17; +pub const _SC_MEMLOCK_RANGE: ::c_int = 18; +pub const _SC_MEMORY_PROTECTION: ::c_int = 19; +pub const _SC_MESSAGE_PASSING: ::c_int = 20; +pub const _SC_SEMAPHORES: ::c_int = 21; +pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22; +pub const _SC_AIO_LISTIO_MAX: ::c_int = 23; +pub const _SC_AIO_MAX: ::c_int = 24; +pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25; +pub const _SC_DELAYTIMER_MAX: ::c_int = 26; +pub const _SC_MQ_OPEN_MAX: ::c_int = 27; +pub const _SC_MQ_PRIO_MAX: ::c_int = 28; +pub const _SC_VERSION: ::c_int = 29; +pub const _SC_PAGESIZE: ::c_int = 30; +pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE; +pub const _SC_RTSIG_MAX: ::c_int = 31; +pub const _SC_SEM_NSEMS_MAX: ::c_int = 32; +pub const _SC_SEM_VALUE_MAX: ::c_int = 33; +pub const _SC_SIGQUEUE_MAX: ::c_int = 34; +pub const _SC_TIMER_MAX: ::c_int = 35; +pub const _SC_BC_BASE_MAX: ::c_int = 36; +pub const _SC_BC_DIM_MAX: ::c_int = 37; +pub const _SC_BC_SCALE_MAX: ::c_int = 38; +pub const _SC_BC_STRING_MAX: ::c_int = 39; +pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40; +pub const _SC_EXPR_NEST_MAX: ::c_int = 42; +pub const _SC_LINE_MAX: ::c_int = 43; +pub const _SC_RE_DUP_MAX: ::c_int = 44; +pub const _SC_2_VERSION: ::c_int = 46; +pub const _SC_2_C_BIND: ::c_int = 47; +pub const _SC_2_C_DEV: ::c_int = 48; +pub const _SC_2_FORT_DEV: ::c_int = 49; +pub const _SC_2_FORT_RUN: ::c_int = 50; +pub const _SC_2_SW_DEV: ::c_int = 51; +pub const _SC_2_LOCALEDEF: ::c_int = 52; +pub const _SC_UIO_MAXIOV: ::c_int = 60; +pub const _SC_IOV_MAX: ::c_int = 60; +pub const _SC_THREADS: ::c_int = 67; +pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68; +pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69; +pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70; +pub const _SC_LOGIN_NAME_MAX: ::c_int = 71; +pub const _SC_TTY_NAME_MAX: ::c_int = 72; +pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73; +pub const _SC_THREAD_KEYS_MAX: ::c_int = 74; +pub const _SC_THREAD_STACK_MIN: ::c_int = 75; +pub const _SC_THREAD_THREADS_MAX: ::c_int = 76; +pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77; +pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78; +pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79; +pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80; +pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81; +pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 82; +pub const _SC_NPROCESSORS_CONF: ::c_int = 83; +pub const _SC_NPROCESSORS_ONLN: ::c_int = 84; +pub const _SC_PHYS_PAGES: ::c_int = 85; +pub const _SC_AVPHYS_PAGES: ::c_int = 86; +pub const _SC_ATEXIT_MAX: ::c_int = 87; +pub const _SC_PASS_MAX: ::c_int = 88; +pub const _SC_XOPEN_VERSION: ::c_int = 89; +pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90; +pub const _SC_XOPEN_UNIX: ::c_int = 91; +pub const _SC_XOPEN_CRYPT: ::c_int = 92; +pub const _SC_XOPEN_ENH_I18N: ::c_int = 93; +pub const _SC_XOPEN_SHM: ::c_int = 94; +pub const _SC_2_CHAR_TERM: ::c_int = 95; +pub const _SC_2_UPE: ::c_int = 97; +pub const _SC_XOPEN_XPG2: ::c_int = 98; +pub const _SC_XOPEN_XPG3: ::c_int = 99; +pub const _SC_XOPEN_XPG4: ::c_int = 100; +pub const _SC_NZERO: ::c_int = 109; +pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125; +pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126; +pub const _SC_XBS5_LP64_OFF64: ::c_int = 127; +pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128; +pub const _SC_XOPEN_LEGACY: ::c_int = 129; +pub const _SC_XOPEN_REALTIME: ::c_int = 130; +pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131; +pub const _SC_ADVISORY_INFO: ::c_int = 132; +pub const _SC_BARRIERS: ::c_int = 133; +pub const _SC_CLOCK_SELECTION: ::c_int = 137; +pub const _SC_CPUTIME: ::c_int = 138; +pub const _SC_THREAD_CPUTIME: ::c_int = 139; +pub const _SC_MONOTONIC_CLOCK: ::c_int = 149; +pub const _SC_READER_WRITER_LOCKS: ::c_int = 153; +pub const _SC_SPIN_LOCKS: ::c_int = 154; +pub const _SC_REGEXP: ::c_int = 155; +pub const _SC_SHELL: ::c_int = 157; +pub const _SC_SPAWN: ::c_int = 159; +pub const _SC_SPORADIC_SERVER: ::c_int = 160; +pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 161; +pub const _SC_TIMEOUTS: ::c_int = 164; +pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 165; +pub const _SC_2_PBS: ::c_int = 168; +pub const _SC_2_PBS_ACCOUNTING: ::c_int = 169; +pub const _SC_2_PBS_LOCATE: ::c_int = 170; +pub const _SC_2_PBS_MESSAGE: ::c_int = 171; +pub const _SC_2_PBS_TRACK: ::c_int = 172; +pub const _SC_SYMLOOP_MAX: ::c_int = 173; +pub const _SC_STREAMS: ::c_int = 174; +pub const _SC_2_PBS_CHECKPOINT: ::c_int = 175; +pub const _SC_V6_ILP32_OFF32: ::c_int = 176; +pub const _SC_V6_ILP32_OFFBIG: ::c_int = 177; +pub const _SC_V6_LP64_OFF64: ::c_int = 178; +pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 179; +pub const _SC_HOST_NAME_MAX: ::c_int = 180; +pub const _SC_TRACE: ::c_int = 181; +pub const _SC_TRACE_EVENT_FILTER: ::c_int = 182; +pub const _SC_TRACE_INHERIT: ::c_int = 183; +pub const _SC_TRACE_LOG: ::c_int = 184; +pub const _SC_IPV6: ::c_int = 235; +pub const _SC_RAW_SOCKETS: ::c_int = 236; +pub const _SC_V7_ILP32_OFF32: ::c_int = 237; +pub const _SC_V7_ILP32_OFFBIG: ::c_int = 238; +pub const _SC_V7_LP64_OFF64: ::c_int = 239; +pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 240; +pub const _SC_SS_REPL_MAX: ::c_int = 241; +pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 242; +pub const _SC_TRACE_NAME_MAX: ::c_int = 243; +pub const _SC_TRACE_SYS_MAX: ::c_int = 244; +pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 245; +pub const _SC_XOPEN_STREAMS: ::c_int = 246; +pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 247; +pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 248; + +pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY; +pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY; + +pub const GLOB_ERR: ::c_int = 1 << 0; +pub const GLOB_MARK: ::c_int = 1 << 1; +pub const GLOB_NOSORT: ::c_int = 1 << 2; +pub const GLOB_DOOFFS: ::c_int = 1 << 3; +pub const GLOB_NOCHECK: ::c_int = 1 << 4; +pub const GLOB_APPEND: ::c_int = 1 << 5; +pub const GLOB_NOESCAPE: ::c_int = 1 << 6; + +pub const GLOB_NOSPACE: ::c_int = 1; +pub const GLOB_ABORTED: ::c_int = 2; +pub const GLOB_NOMATCH: ::c_int = 3; + +pub const POSIX_MADV_NORMAL: ::c_int = 0; +pub const POSIX_MADV_RANDOM: ::c_int = 1; +pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2; +pub const POSIX_MADV_WILLNEED: ::c_int = 3; + +pub const S_IEXEC: mode_t = 64; +pub const S_IWRITE: mode_t = 128; +pub const S_IREAD: mode_t = 256; + +pub const F_LOCK: ::c_int = 1; +pub const F_TEST: ::c_int = 3; +pub const F_TLOCK: ::c_int = 2; +pub const F_ULOCK: ::c_int = 0; + +pub const ST_RDONLY: ::c_ulong = 1; +pub const ST_NOSUID: ::c_ulong = 2; +pub const ST_NODEV: ::c_ulong = 4; +pub const ST_NOEXEC: ::c_ulong = 8; +pub const ST_SYNCHRONOUS: ::c_ulong = 16; +pub const ST_MANDLOCK: ::c_ulong = 64; +pub const ST_WRITE: ::c_ulong = 128; +pub const ST_APPEND: ::c_ulong = 256; +pub const ST_IMMUTABLE: ::c_ulong = 512; +pub const ST_NOATIME: ::c_ulong = 1024; +pub const ST_NODIRATIME: ::c_ulong = 2048; + +pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void; +pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; +pub const RTLD_NODELETE: ::c_int = 0x1000; +pub const RTLD_NOW: ::c_int = 0x2; + +pub const TCP_MD5SIG: ::c_int = 14; + +align_const! { + pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { + size: [0; __SIZEOF_PTHREAD_MUTEX_T], + }; + pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { + size: [0; __SIZEOF_PTHREAD_COND_T], + }; + pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { + size: [0; __SIZEOF_PTHREAD_RWLOCK_T], + }; +} + +pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; +pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; +pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; +pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; +pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0; +pub const PTHREAD_PROCESS_SHARED: ::c_int = 1; +pub const __SIZEOF_PTHREAD_COND_T: usize = 48; + +pub const SCHED_OTHER: ::c_int = 0; +pub const SCHED_FIFO: ::c_int = 1; +pub const SCHED_RR: ::c_int = 2; +pub const SCHED_BATCH: ::c_int = 3; +pub const SCHED_IDLE: ::c_int = 5; + +pub const AF_IB: ::c_int = 27; +pub const AF_MPLS: ::c_int = 28; +pub const AF_NFC: ::c_int = 39; +pub const AF_VSOCK: ::c_int = 40; +pub const PF_IB: ::c_int = AF_IB; +pub const PF_MPLS: ::c_int = AF_MPLS; +pub const PF_NFC: ::c_int = AF_NFC; +pub const PF_VSOCK: ::c_int = AF_VSOCK; + +// System V IPC +pub const IPC_PRIVATE: ::key_t = 0; + +pub const IPC_CREAT: ::c_int = 0o1000; +pub const IPC_EXCL: ::c_int = 0o2000; +pub const IPC_NOWAIT: ::c_int = 0o4000; + +pub const IPC_RMID: ::c_int = 0; +pub const IPC_SET: ::c_int = 1; +pub const IPC_STAT: ::c_int = 2; +pub const IPC_INFO: ::c_int = 3; +pub const MSG_STAT: ::c_int = 11; +pub const MSG_INFO: ::c_int = 12; + +pub const MSG_NOERROR: ::c_int = 0o10000; +pub const MSG_EXCEPT: ::c_int = 0o20000; + +pub const SHM_R: ::c_int = 0o400; +pub const SHM_W: ::c_int = 0o200; + +pub const SHM_RDONLY: ::c_int = 0o10000; +pub const SHM_RND: ::c_int = 0o20000; +pub const SHM_REMAP: ::c_int = 0o40000; +pub const SHM_EXEC: ::c_int = 0o100000; + +pub const SHM_LOCK: ::c_int = 11; +pub const SHM_UNLOCK: ::c_int = 12; + +pub const SHM_HUGETLB: ::c_int = 0o4000; +pub const SHM_NORESERVE: ::c_int = 0o10000; + +pub const EPOLLRDHUP: ::c_int = 0x2000; +pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000; +pub const EPOLLONESHOT: ::c_int = 0x40000000; + +pub const QFMT_VFS_OLD: ::c_int = 1; +pub const QFMT_VFS_V0: ::c_int = 2; + +pub const EFD_SEMAPHORE: ::c_int = 0x1; + +pub const LOG_NFACILITIES: ::c_int = 24; + +pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t; + +pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32; +pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32; +pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32; +pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32; +pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32; +pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32; +pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32; + +pub const AI_PASSIVE: ::c_int = 0x0001; +pub const AI_CANONNAME: ::c_int = 0x0002; +pub const AI_NUMERICHOST: ::c_int = 0x0004; +pub const AI_V4MAPPED: ::c_int = 0x0008; +pub const AI_ALL: ::c_int = 0x0010; +pub const AI_ADDRCONFIG: ::c_int = 0x0020; + +pub const AI_NUMERICSERV: ::c_int = 0x0400; + +pub const EAI_BADFLAGS: ::c_int = -1; +pub const EAI_NONAME: ::c_int = -2; +pub const EAI_AGAIN: ::c_int = -3; +pub const EAI_FAIL: ::c_int = -4; +pub const EAI_FAMILY: ::c_int = -6; +pub const EAI_SOCKTYPE: ::c_int = -7; +pub const EAI_SERVICE: ::c_int = -8; +pub const EAI_MEMORY: ::c_int = -10; +pub const EAI_OVERFLOW: ::c_int = -12; + +pub const NI_NUMERICHOST: ::c_int = 1; +pub const NI_NUMERICSERV: ::c_int = 2; +pub const NI_NOFQDN: ::c_int = 4; +pub const NI_NAMEREQD: ::c_int = 8; +pub const NI_DGRAM: ::c_int = 16; + +pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1; +pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2; +pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4; + +pub const EAI_SYSTEM: ::c_int = -11; + +pub const AIO_CANCELED: ::c_int = 0; +pub const AIO_NOTCANCELED: ::c_int = 1; +pub const AIO_ALLDONE: ::c_int = 2; +pub const LIO_READ: ::c_int = 0; +pub const LIO_WRITE: ::c_int = 1; +pub const LIO_NOP: ::c_int = 2; +pub const LIO_WAIT: ::c_int = 0; +pub const LIO_NOWAIT: ::c_int = 1; + +pub const MREMAP_MAYMOVE: ::c_int = 1; +pub const MREMAP_FIXED: ::c_int = 2; + +pub const PR_SET_PDEATHSIG: ::c_int = 1; +pub const PR_GET_PDEATHSIG: ::c_int = 2; + +pub const PR_GET_DUMPABLE: ::c_int = 3; +pub const PR_SET_DUMPABLE: ::c_int = 4; + +pub const PR_GET_UNALIGN: ::c_int = 5; +pub const PR_SET_UNALIGN: ::c_int = 6; +pub const PR_UNALIGN_NOPRINT: ::c_int = 1; +pub const PR_UNALIGN_SIGBUS: ::c_int = 2; + +pub const PR_GET_KEEPCAPS: ::c_int = 7; +pub const PR_SET_KEEPCAPS: ::c_int = 8; + +pub const PR_GET_FPEMU: ::c_int = 9; +pub const PR_SET_FPEMU: ::c_int = 10; +pub const PR_FPEMU_NOPRINT: ::c_int = 1; +pub const PR_FPEMU_SIGFPE: ::c_int = 2; + +pub const PR_GET_FPEXC: ::c_int = 11; +pub const PR_SET_FPEXC: ::c_int = 12; +pub const PR_FP_EXC_SW_ENABLE: ::c_int = 0x80; +pub const PR_FP_EXC_DIV: ::c_int = 0x010000; +pub const PR_FP_EXC_OVF: ::c_int = 0x020000; +pub const PR_FP_EXC_UND: ::c_int = 0x040000; +pub const PR_FP_EXC_RES: ::c_int = 0x080000; +pub const PR_FP_EXC_INV: ::c_int = 0x100000; +pub const PR_FP_EXC_DISABLED: ::c_int = 0; +pub const PR_FP_EXC_NONRECOV: ::c_int = 1; +pub const PR_FP_EXC_ASYNC: ::c_int = 2; +pub const PR_FP_EXC_PRECISE: ::c_int = 3; + +pub const PR_GET_TIMING: ::c_int = 13; +pub const PR_SET_TIMING: ::c_int = 14; +pub const PR_TIMING_STATISTICAL: ::c_int = 0; +pub const PR_TIMING_TIMESTAMP: ::c_int = 1; + +pub const PR_SET_NAME: ::c_int = 15; +pub const PR_GET_NAME: ::c_int = 16; + +pub const PR_GET_ENDIAN: ::c_int = 19; +pub const PR_SET_ENDIAN: ::c_int = 20; +pub const PR_ENDIAN_BIG: ::c_int = 0; +pub const PR_ENDIAN_LITTLE: ::c_int = 1; +pub const PR_ENDIAN_PPC_LITTLE: ::c_int = 2; + +pub const PR_GET_SECCOMP: ::c_int = 21; +pub const PR_SET_SECCOMP: ::c_int = 22; + +pub const PR_CAPBSET_READ: ::c_int = 23; +pub const PR_CAPBSET_DROP: ::c_int = 24; + +pub const PR_GET_TSC: ::c_int = 25; +pub const PR_SET_TSC: ::c_int = 26; +pub const PR_TSC_ENABLE: ::c_int = 1; +pub const PR_TSC_SIGSEGV: ::c_int = 2; + +pub const PR_GET_SECUREBITS: ::c_int = 27; +pub const PR_SET_SECUREBITS: ::c_int = 28; + +pub const PR_SET_TIMERSLACK: ::c_int = 29; +pub const PR_GET_TIMERSLACK: ::c_int = 30; + +pub const PR_TASK_PERF_EVENTS_DISABLE: ::c_int = 31; +pub const PR_TASK_PERF_EVENTS_ENABLE: ::c_int = 32; + +pub const PR_MCE_KILL: ::c_int = 33; +pub const PR_MCE_KILL_CLEAR: ::c_int = 0; +pub const PR_MCE_KILL_SET: ::c_int = 1; + +pub const PR_MCE_KILL_LATE: ::c_int = 0; +pub const PR_MCE_KILL_EARLY: ::c_int = 1; +pub const PR_MCE_KILL_DEFAULT: ::c_int = 2; + +pub const PR_MCE_KILL_GET: ::c_int = 34; + +pub const PR_SET_MM: ::c_int = 35; +pub const PR_SET_MM_START_CODE: ::c_int = 1; +pub const PR_SET_MM_END_CODE: ::c_int = 2; +pub const PR_SET_MM_START_DATA: ::c_int = 3; +pub const PR_SET_MM_END_DATA: ::c_int = 4; +pub const PR_SET_MM_START_STACK: ::c_int = 5; +pub const PR_SET_MM_START_BRK: ::c_int = 6; +pub const PR_SET_MM_BRK: ::c_int = 7; +pub const PR_SET_MM_ARG_START: ::c_int = 8; +pub const PR_SET_MM_ARG_END: ::c_int = 9; +pub const PR_SET_MM_ENV_START: ::c_int = 10; +pub const PR_SET_MM_ENV_END: ::c_int = 11; +pub const PR_SET_MM_AUXV: ::c_int = 12; +pub const PR_SET_MM_EXE_FILE: ::c_int = 13; +pub const PR_SET_MM_MAP: ::c_int = 14; +pub const PR_SET_MM_MAP_SIZE: ::c_int = 15; + +pub const PR_SET_PTRACER: ::c_int = 0x59616d61; + +pub const PR_SET_CHILD_SUBREAPER: ::c_int = 36; +pub const PR_GET_CHILD_SUBREAPER: ::c_int = 37; + +pub const PR_SET_NO_NEW_PRIVS: ::c_int = 38; +pub const PR_GET_NO_NEW_PRIVS: ::c_int = 39; + +pub const PR_GET_TID_ADDRESS: ::c_int = 40; + +pub const PR_SET_THP_DISABLE: ::c_int = 41; +pub const PR_GET_THP_DISABLE: ::c_int = 42; + +pub const PR_MPX_ENABLE_MANAGEMENT: ::c_int = 43; +pub const PR_MPX_DISABLE_MANAGEMENT: ::c_int = 44; + +pub const PR_SET_FP_MODE: ::c_int = 45; +pub const PR_GET_FP_MODE: ::c_int = 46; +pub const PR_FP_MODE_FR: ::c_int = 1 << 0; +pub const PR_FP_MODE_FRE: ::c_int = 1 << 1; + +pub const PR_CAP_AMBIENT: ::c_int = 47; +pub const PR_CAP_AMBIENT_IS_SET: ::c_int = 1; +pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2; +pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3; +pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4; + +pub const ITIMER_REAL: ::c_int = 0; +pub const ITIMER_VIRTUAL: ::c_int = 1; +pub const ITIMER_PROF: ::c_int = 2; + +pub const XATTR_CREATE: ::c_int = 0x1; +pub const XATTR_REPLACE: ::c_int = 0x2; + +pub const _POSIX_VDISABLE: ::cc_t = 0; + +pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01; +pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02; + +// On Linux, libc doesn't define this constant, libattr does instead. +// We still define it for Linux as it's defined by libc on other platforms, +// and it's mentioned in the man pages for getxattr and setxattr. +pub const SFD_CLOEXEC: ::c_int = 0x080000; + +pub const NCCS: usize = 32; + +pub const O_TRUNC: ::c_int = 512; +pub const O_NOATIME: ::c_int = 0o1000000; +pub const O_CLOEXEC: ::c_int = 0x80000; + +pub const EBFONT: ::c_int = 59; +pub const ENOSTR: ::c_int = 60; +pub const ENODATA: ::c_int = 61; +pub const ETIME: ::c_int = 62; +pub const ENOSR: ::c_int = 63; +pub const ENONET: ::c_int = 64; +pub const ENOPKG: ::c_int = 65; +pub const EREMOTE: ::c_int = 66; +pub const ENOLINK: ::c_int = 67; +pub const EADV: ::c_int = 68; +pub const ESRMNT: ::c_int = 69; +pub const ECOMM: ::c_int = 70; +pub const EPROTO: ::c_int = 71; +pub const EDOTDOT: ::c_int = 73; + +pub const SA_NODEFER: ::c_int = 0x40000000; +pub const SA_RESETHAND: ::c_int = 0x80000000; +pub const SA_RESTART: ::c_int = 0x10000000; +pub const SA_NOCLDSTOP: ::c_int = 0x00000001; + +pub const EPOLL_CLOEXEC: ::c_int = 0x80000; + +pub const EFD_CLOEXEC: ::c_int = 0x80000; + +pub const BUFSIZ: ::c_uint = 1024; +pub const TMP_MAX: ::c_uint = 10000; +pub const FOPEN_MAX: ::c_uint = 1000; +pub const O_PATH: ::c_int = 0o10000000; +pub const O_EXEC: ::c_int = 0o10000000; +pub const O_SEARCH: ::c_int = 0o10000000; +pub const O_ACCMODE: ::c_int = 0o10000003; +pub const O_NDELAY: ::c_int = O_NONBLOCK; +pub const NI_MAXHOST: ::socklen_t = 255; +pub const PTHREAD_STACK_MIN: ::size_t = 2048; +pub const POSIX_FADV_DONTNEED: ::c_int = 4; +pub const POSIX_FADV_NOREUSE: ::c_int = 5; + +pub const POSIX_MADV_DONTNEED: ::c_int = 0; + +pub const RLIM_INFINITY: ::rlim_t = !0; +pub const RLIMIT_NLIMITS: ::c_int = 15; + +pub const MAP_ANONYMOUS: ::c_int = MAP_ANON; + +pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16; +pub const TCP_THIN_DUPACK: ::c_int = 17; +pub const TCP_USER_TIMEOUT: ::c_int = 18; +pub const TCP_REPAIR: ::c_int = 19; +pub const TCP_REPAIR_QUEUE: ::c_int = 20; +pub const TCP_QUEUE_SEQ: ::c_int = 21; +pub const TCP_REPAIR_OPTIONS: ::c_int = 22; +pub const TCP_FASTOPEN: ::c_int = 23; +pub const TCP_TIMESTAMP: ::c_int = 24; + +#[doc(hidden)] +#[deprecated( + since = "0.2.55", + note = "Use SIGSYS instead" +)] +pub const SIGUNUSED: ::c_int = ::SIGSYS; + +pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; +pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; +pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; + +pub const CPU_SETSIZE: ::c_int = 128; + +pub const QFMT_VFS_V1: ::c_int = 4; + +pub const PTRACE_TRACEME: ::c_int = 0; +pub const PTRACE_PEEKTEXT: ::c_int = 1; +pub const PTRACE_PEEKDATA: ::c_int = 2; +pub const PTRACE_PEEKUSER: ::c_int = 3; +pub const PTRACE_POKETEXT: ::c_int = 4; +pub const PTRACE_POKEDATA: ::c_int = 5; +pub const PTRACE_POKEUSER: ::c_int = 6; +pub const PTRACE_CONT: ::c_int = 7; +pub const PTRACE_KILL: ::c_int = 8; +pub const PTRACE_SINGLESTEP: ::c_int = 9; +pub const PTRACE_ATTACH: ::c_int = 16; +pub const PTRACE_DETACH: ::c_int = 17; +pub const PTRACE_SYSCALL: ::c_int = 24; +pub const PTRACE_SETOPTIONS: ::c_int = 0x4200; +pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201; +pub const PTRACE_GETSIGINFO: ::c_int = 0x4202; +pub const PTRACE_SETSIGINFO: ::c_int = 0x4203; +pub const PTRACE_GETREGSET: ::c_int = 0x4204; +pub const PTRACE_SETREGSET: ::c_int = 0x4205; +pub const PTRACE_SEIZE: ::c_int = 0x4206; +pub const PTRACE_INTERRUPT: ::c_int = 0x4207; +pub const PTRACE_LISTEN: ::c_int = 0x4208; +pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209; + +pub const EPOLLWAKEUP: ::c_int = 0x20000000; + +pub const PTRACE_GETFPREGS: ::c_uint = 14; +pub const PTRACE_SETFPREGS: ::c_uint = 15; +pub const PTRACE_GETFPXREGS: ::c_uint = 18; +pub const PTRACE_SETFPXREGS: ::c_uint = 19; +pub const PTRACE_GETREGS: ::c_uint = 12; +pub const PTRACE_SETREGS: ::c_uint = 13; + +pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK; + +pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK; + +pub const TCSANOW: ::c_int = 0; +pub const TCSADRAIN: ::c_int = 1; +pub const TCSAFLUSH: ::c_int = 2; + +pub const TIOCINQ: ::c_int = ::FIONREAD; + +pub const RTLD_GLOBAL: ::c_int = 0x100; +pub const RTLD_NOLOAD: ::c_int = 0x4; + +// TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux +// kernel 3.10). See also linux_like/mod.rs +pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; +pub const CLOCK_TAI: ::clockid_t = 11; + +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; + +pub const SIGSTKSZ: ::size_t = 8192; +pub const MINSIGSTKSZ: ::size_t = 2048; +pub const CBAUD: ::tcflag_t = 0o0010017; +pub const TAB1: ::c_int = 0x00000800; +pub const TAB2: ::c_int = 0x00001000; +pub const TAB3: ::c_int = 0x00001800; +pub const CR1: ::c_int = 0x00000200; +pub const CR2: ::c_int = 0x00000400; +pub const CR3: ::c_int = 0x00000600; +pub const FF1: ::c_int = 0x00008000; +pub const BS1: ::c_int = 0x00002000; +pub const VT1: ::c_int = 0x00004000; +pub const VWERASE: usize = 14; +pub const VREPRINT: usize = 12; +pub const VSUSP: usize = 10; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VDISCARD: usize = 13; +pub const VTIME: usize = 5; +pub const IXON: ::tcflag_t = 0x00000400; +pub const IXOFF: ::tcflag_t = 0x00001000; +pub const ONLCR: ::tcflag_t = 0x4; +pub const CSIZE: ::tcflag_t = 0x00000030; +pub const CS6: ::tcflag_t = 0x00000010; +pub const CS7: ::tcflag_t = 0x00000020; +pub const CS8: ::tcflag_t = 0x00000030; +pub const CSTOPB: ::tcflag_t = 0x00000040; +pub const CREAD: ::tcflag_t = 0x00000080; +pub const PARENB: ::tcflag_t = 0x00000100; +pub const PARODD: ::tcflag_t = 0x00000200; +pub const HUPCL: ::tcflag_t = 0x00000400; +pub const CLOCAL: ::tcflag_t = 0x00000800; +pub const ECHOKE: ::tcflag_t = 0x00000800; +pub const ECHOE: ::tcflag_t = 0x00000010; +pub const ECHOK: ::tcflag_t = 0x00000020; +pub const ECHONL: ::tcflag_t = 0x00000040; +pub const ECHOPRT: ::tcflag_t = 0x00000400; +pub const ECHOCTL: ::tcflag_t = 0x00000200; +pub const ISIG: ::tcflag_t = 0x00000001; +pub const ICANON: ::tcflag_t = 0x00000002; +pub const PENDIN: ::tcflag_t = 0x00004000; +pub const NOFLSH: ::tcflag_t = 0x00000080; +pub const CBAUDEX: ::tcflag_t = 0o010000; +pub const VSWTC: usize = 7; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const XTABS: ::tcflag_t = 0o014000; + +pub const B0: ::speed_t = 0o000000; +pub const B50: ::speed_t = 0o000001; +pub const B75: ::speed_t = 0o000002; +pub const B110: ::speed_t = 0o000003; +pub const B134: ::speed_t = 0o000004; +pub const B150: ::speed_t = 0o000005; +pub const B200: ::speed_t = 0o000006; +pub const B300: ::speed_t = 0o000007; +pub const B600: ::speed_t = 0o000010; +pub const B1200: ::speed_t = 0o000011; +pub const B1800: ::speed_t = 0o000012; +pub const B2400: ::speed_t = 0o000013; +pub const B4800: ::speed_t = 0o000014; +pub const B9600: ::speed_t = 0o000015; +pub const B19200: ::speed_t = 0o000016; +pub const B38400: ::speed_t = 0o000017; +pub const B57600: ::speed_t = 0o010001; +pub const B115200: ::speed_t = 0o010002; +pub const B230400: ::speed_t = 0o010003; +pub const B460800: ::speed_t = 0o010004; +pub const B500000: ::speed_t = 0o010005; +pub const B576000: ::speed_t = 0o010006; +pub const B921600: ::speed_t = 0o010007; +pub const B1000000: ::speed_t = 0o010010; +pub const B1152000: ::speed_t = 0o010011; +pub const B1500000: ::speed_t = 0o010012; +pub const B2000000: ::speed_t = 0o010013; +pub const B2500000: ::speed_t = 0o010014; +pub const B3000000: ::speed_t = 0o010015; +pub const B3500000: ::speed_t = 0o010016; +pub const B4000000: ::speed_t = 0o010017; + +pub const SO_BINDTODEVICE: ::c_int = 25; +pub const SO_TIMESTAMP: ::c_int = 29; +pub const SO_MARK: ::c_int = 36; +pub const SO_RXQ_OVFL: ::c_int = 40; +pub const SO_PEEK_OFF: ::c_int = 42; +pub const SO_BUSY_POLL: ::c_int = 46; + +pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32; +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 28; + +pub const O_DIRECT: ::c_int = 0x4000; +pub const O_DIRECTORY: ::c_int = 0x10000; +pub const O_NOFOLLOW: ::c_int = 0x20000; +pub const O_ASYNC: ::c_int = 0x2000; + +pub const FIOCLEX: ::c_int = 0x5451; +pub const FIONBIO: ::c_int = 0x5421; + +pub const RLIMIT_RSS: ::c_int = 5; +pub const RLIMIT_NOFILE: ::c_int = 7; +pub const RLIMIT_AS: ::c_int = 9; +pub const RLIMIT_NPROC: ::c_int = 6; +pub const RLIMIT_MEMLOCK: ::c_int = 8; +pub const RLIMIT_CPU: ::c_int = 0; +pub const RLIMIT_FSIZE: ::c_int = 1; +pub const RLIMIT_DATA: ::c_int = 2; +pub const RLIMIT_STACK: ::c_int = 3; +pub const RLIMIT_CORE: ::c_int = 4; +pub const RLIMIT_LOCKS: ::c_int = 10; +pub const RLIMIT_SIGPENDING: ::c_int = 11; +pub const RLIMIT_MSGQUEUE: ::c_int = 12; +pub const RLIMIT_NICE: ::c_int = 13; +pub const RLIMIT_RTPRIO: ::c_int = 14; + +pub const O_APPEND: ::c_int = 1024; +pub const O_CREAT: ::c_int = 64; +pub const O_EXCL: ::c_int = 128; +pub const O_NOCTTY: ::c_int = 256; +pub const O_NONBLOCK: ::c_int = 2048; +pub const O_SYNC: ::c_int = 1052672; +pub const O_RSYNC: ::c_int = 1052672; +pub const O_DSYNC: ::c_int = 4096; + +pub const SOCK_NONBLOCK: ::c_int = 2048; + +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_GROWSDOWN: ::c_int = 0x0100; +pub const MAP_DENYWRITE: ::c_int = 0x0800; +pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_LOCKED: ::c_int = 0x02000; +pub const MAP_NORESERVE: ::c_int = 0x04000; +pub const MAP_POPULATE: ::c_int = 0x08000; +pub const MAP_NONBLOCK: ::c_int = 0x010000; +pub const MAP_STACK: ::c_int = 0x020000; + +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; +pub const SOCK_SEQPACKET: ::c_int = 5; + +pub const SOL_SOCKET: ::c_int = 1; + +pub const EDEADLK: ::c_int = 35; +pub const ENAMETOOLONG: ::c_int = 36; +pub const ENOLCK: ::c_int = 37; +pub const ENOSYS: ::c_int = 38; +pub const ENOTEMPTY: ::c_int = 39; +pub const ELOOP: ::c_int = 40; +pub const ENOMSG: ::c_int = 42; +pub const EIDRM: ::c_int = 43; +pub const ECHRNG: ::c_int = 44; +pub const EL2NSYNC: ::c_int = 45; +pub const EL3HLT: ::c_int = 46; +pub const EL3RST: ::c_int = 47; +pub const ELNRNG: ::c_int = 48; +pub const EUNATCH: ::c_int = 49; +pub const ENOCSI: ::c_int = 50; +pub const EL2HLT: ::c_int = 51; +pub const EBADE: ::c_int = 52; +pub const EBADR: ::c_int = 53; +pub const EXFULL: ::c_int = 54; +pub const ENOANO: ::c_int = 55; +pub const EBADRQC: ::c_int = 56; +pub const EBADSLT: ::c_int = 57; +pub const EDEADLOCK: ::c_int = EDEADLK; +pub const EMULTIHOP: ::c_int = 72; +pub const EBADMSG: ::c_int = 74; +pub const EOVERFLOW: ::c_int = 75; +pub const ENOTUNIQ: ::c_int = 76; +pub const EBADFD: ::c_int = 77; +pub const EREMCHG: ::c_int = 78; +pub const ELIBACC: ::c_int = 79; +pub const ELIBBAD: ::c_int = 80; +pub const ELIBSCN: ::c_int = 81; +pub const ELIBMAX: ::c_int = 82; +pub const ELIBEXEC: ::c_int = 83; +pub const EILSEQ: ::c_int = 84; +pub const ERESTART: ::c_int = 85; +pub const ESTRPIPE: ::c_int = 86; +pub const EUSERS: ::c_int = 87; +pub const ENOTSOCK: ::c_int = 88; +pub const EDESTADDRREQ: ::c_int = 89; +pub const EMSGSIZE: ::c_int = 90; +pub const EPROTOTYPE: ::c_int = 91; +pub const ENOPROTOOPT: ::c_int = 92; +pub const EPROTONOSUPPORT: ::c_int = 93; +pub const ESOCKTNOSUPPORT: ::c_int = 94; +pub const EOPNOTSUPP: ::c_int = 95; +pub const ENOTSUP: ::c_int = EOPNOTSUPP; +pub const EPFNOSUPPORT: ::c_int = 96; +pub const EAFNOSUPPORT: ::c_int = 97; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const ENETDOWN: ::c_int = 100; +pub const ENETUNREACH: ::c_int = 101; +pub const ENETRESET: ::c_int = 102; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNRESET: ::c_int = 104; +pub const ENOBUFS: ::c_int = 105; +pub const EISCONN: ::c_int = 106; +pub const ENOTCONN: ::c_int = 107; +pub const ESHUTDOWN: ::c_int = 108; +pub const ETOOMANYREFS: ::c_int = 109; +pub const ETIMEDOUT: ::c_int = 110; +pub const ECONNREFUSED: ::c_int = 111; +pub const EHOSTDOWN: ::c_int = 112; +pub const EHOSTUNREACH: ::c_int = 113; +pub const EALREADY: ::c_int = 114; +pub const EINPROGRESS: ::c_int = 115; +pub const ESTALE: ::c_int = 116; +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; +pub const EDQUOT: ::c_int = 122; +pub const ENOMEDIUM: ::c_int = 123; +pub const EMEDIUMTYPE: ::c_int = 124; +pub const ECANCELED: ::c_int = 125; +pub const ENOKEY: ::c_int = 126; +pub const EKEYEXPIRED: ::c_int = 127; +pub const EKEYREVOKED: ::c_int = 128; +pub const EKEYREJECTED: ::c_int = 129; +pub const EOWNERDEAD: ::c_int = 130; +pub const ENOTRECOVERABLE: ::c_int = 131; +pub const ERFKILL: ::c_int = 132; +pub const EHWPOISON: ::c_int = 133; + +pub const SO_REUSEADDR: ::c_int = 2; +pub const SO_TYPE: ::c_int = 3; +pub const SO_ERROR: ::c_int = 4; +pub const SO_DONTROUTE: ::c_int = 5; +pub const SO_BROADCAST: ::c_int = 6; +pub const SO_SNDBUF: ::c_int = 7; +pub const SO_RCVBUF: ::c_int = 8; +pub const SO_KEEPALIVE: ::c_int = 9; +pub const SO_OOBINLINE: ::c_int = 10; +pub const SO_LINGER: ::c_int = 13; +pub const SO_REUSEPORT: ::c_int = 15; +pub const SO_RCVLOWAT: ::c_int = 18; +pub const SO_SNDLOWAT: ::c_int = 19; +pub const SO_RCVTIMEO: ::c_int = 20; +pub const SO_SNDTIMEO: ::c_int = 21; +pub const SO_ACCEPTCONN: ::c_int = 30; + +pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_SIGINFO: ::c_int = 0x00000004; +pub const SA_NOCLDWAIT: ::c_int = 0x00000002; + +pub const SIGCHLD: ::c_int = 17; +pub const SIGBUS: ::c_int = 7; +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; +pub const SIGUSR1: ::c_int = 10; +pub const SIGUSR2: ::c_int = 12; +pub const SIGCONT: ::c_int = 18; +pub const SIGSTOP: ::c_int = 19; +pub const SIGTSTP: ::c_int = 20; +pub const SIGURG: ::c_int = 23; +pub const SIGIO: ::c_int = 29; +pub const SIGSYS: ::c_int = 31; +pub const SIGSTKFLT: ::c_int = 16; +pub const SIGPOLL: ::c_int = 29; +pub const SIGPWR: ::c_int = 30; +pub const SIG_SETMASK: ::c_int = 2; +pub const SIG_BLOCK: ::c_int = 0x000000; +pub const SIG_UNBLOCK: ::c_int = 0x01; + +pub const EXTPROC: ::tcflag_t = 0x00010000; + +pub const MAP_HUGETLB: ::c_int = 0x040000; + +pub const F_GETLK: ::c_int = 12; +pub const F_GETOWN: ::c_int = 9; +pub const F_SETLK: ::c_int = 13; +pub const F_SETLKW: ::c_int = 14; +pub const F_SETOWN: ::c_int = 8; + +pub const VEOF: usize = 4; +pub const VEOL: usize = 11; +pub const VEOL2: usize = 16; +pub const VMIN: usize = 6; +pub const IEXTEN: ::tcflag_t = 0x00008000; +pub const TOSTOP: ::tcflag_t = 0x00000100; +pub const FLUSHO: ::tcflag_t = 0x00001000; + +pub const TCGETS: ::c_int = 0x5401; +pub const TCSETS: ::c_int = 0x5402; +pub const TCSETSW: ::c_int = 0x5403; +pub const TCSETSF: ::c_int = 0x5404; +pub const TCGETA: ::c_int = 0x5405; +pub const TCSETA: ::c_int = 0x5406; +pub const TCSETAW: ::c_int = 0x5407; +pub const TCSETAF: ::c_int = 0x5408; +pub const TCSBRK: ::c_int = 0x5409; +pub const TCXONC: ::c_int = 0x540A; +pub const TCFLSH: ::c_int = 0x540B; +pub const TIOCGSOFTCAR: ::c_int = 0x5419; +pub const TIOCSSOFTCAR: ::c_int = 0x541A; +pub const TIOCLINUX: ::c_int = 0x541C; +pub const TIOCGSERIAL: ::c_int = 0x541E; +pub const TIOCEXCL: ::c_int = 0x540C; +pub const TIOCNXCL: ::c_int = 0x540D; +pub const TIOCSCTTY: ::c_int = 0x540E; +pub const TIOCGPGRP: ::c_int = 0x540F; +pub const TIOCSPGRP: ::c_int = 0x5410; +pub const TIOCOUTQ: ::c_int = 0x5411; +pub const TIOCSTI: ::c_int = 0x5412; +pub const TIOCGWINSZ: ::c_int = 0x5413; +pub const TIOCSWINSZ: ::c_int = 0x5414; +pub const TIOCMGET: ::c_int = 0x5415; +pub const TIOCMBIS: ::c_int = 0x5416; +pub const TIOCMBIC: ::c_int = 0x5417; +pub const TIOCMSET: ::c_int = 0x5418; +pub const FIONREAD: ::c_int = 0x541B; +pub const TIOCCONS: ::c_int = 0x541D; + +pub const SYS_gettid: ::c_long = 224; // Valid for arm (32-bit) and x86 (32-bit) + +pub const POLLWRNORM: ::c_short = 0x100; +pub const POLLWRBAND: ::c_short = 0x200; + +pub const TIOCM_LE: ::c_int = 0x001; +pub const TIOCM_DTR: ::c_int = 0x002; +pub const TIOCM_RTS: ::c_int = 0x004; +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; +pub const TIOCM_CD: ::c_int = TIOCM_CAR; +pub const TIOCM_RI: ::c_int = TIOCM_RNG; +pub const O_TMPFILE: ::c_int = 0x400000; + +pub const MAX_ADDR_LEN: usize = 7; +pub const ARPD_UPDATE: ::c_ushort = 0x01; +pub const ARPD_LOOKUP: ::c_ushort = 0x02; +pub const ARPD_FLUSH: ::c_ushort = 0x03; +pub const ATF_MAGIC: ::c_int = 0x80; + +f! { + pub fn CMSG_NXTHDR(mhdr: *const msghdr, + cmsg: *const cmsghdr) -> *mut cmsghdr { + if ((*cmsg).cmsg_len as usize) < ::mem::size_of::() { + return 0 as *mut cmsghdr; + }; + let next = (cmsg as usize + + super::CMSG_ALIGN((*cmsg).cmsg_len as usize)) + as *mut cmsghdr; + let max = (*mhdr).msg_control as usize + + (*mhdr).msg_controllen as usize; + if (next.offset(1)) as usize > max { + 0 as *mut cmsghdr + } else { + next as *mut cmsghdr + } + } + + pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { + for slot in cpuset.bits.iter_mut() { + *slot = 0; + } + } + + pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { + let size_in_bits + = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); + cpuset.bits[idx] |= 1 << offset; + () + } + + pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { + let size_in_bits + = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); + cpuset.bits[idx] &= !(1 << offset); + () + } + + pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { + let size_in_bits = 8 * ::mem::size_of_val(&cpuset.bits[0]); + let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); + 0 != (cpuset.bits[idx] & (1 << offset)) + } + + pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { + set1.bits == set2.bits + } + + pub fn major(dev: ::dev_t) -> ::c_uint { + // see + // https://github.com/kripken/emscripten/blob/ + // master/system/include/libc/sys/sysmacros.h + let mut major = 0; + major |= (dev & 0x00000fff) >> 8; + major |= (dev & 0xfffff000) >> 31 >> 1; + major as ::c_uint + } + + pub fn minor(dev: ::dev_t) -> ::c_uint { + // see + // https://github.com/kripken/emscripten/blob/ + // master/system/include/libc/sys/sysmacros.h + let mut minor = 0; + minor |= (dev & 0x000000ff) >> 0; + minor |= (dev & 0xffffff00) >> 12; + minor as ::c_uint + } + + pub fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t { + let major = major as ::dev_t; + let minor = minor as ::dev_t; + let mut dev = 0; + dev |= (major & 0x00000fff) << 8; + dev |= (major & 0xfffff000) << 31 << 1; + dev |= (minor & 0x000000ff) << 0; + dev |= (minor & 0xffffff00) << 12; + dev + } +} + +extern { + pub fn getrlimit64(resource: ::c_int, + rlim: *mut rlimit64) -> ::c_int; + pub fn setrlimit64(resource: ::c_int, + rlim: *const rlimit64) -> ::c_int; + pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; + pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; + pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, + buflen: ::size_t) -> ::c_int; + + pub fn abs(i: ::c_int) -> ::c_int; + pub fn atof(s: *const ::c_char) -> ::c_double; + pub fn labs(i: ::c_long) -> ::c_long; + pub fn rand() -> ::c_int; + pub fn srand(seed: ::c_uint); + + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::c_void) -> ::c_int; + + pub fn setpwent(); + pub fn endpwent(); + pub fn getpwent() -> *mut passwd; + + pub fn shm_open(name: *const c_char, oflag: ::c_int, + mode: mode_t) -> ::c_int; + + pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) + -> ::c_int; + pub fn __errno_location() -> *mut ::c_int; + + pub fn fopen64(filename: *const c_char, + mode: *const c_char) -> *mut ::FILE; + pub fn freopen64(filename: *const c_char, mode: *const c_char, + file: *mut ::FILE) -> *mut ::FILE; + pub fn tmpfile64() -> *mut ::FILE; + pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int; + pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int; + pub fn fseeko64(stream: *mut ::FILE, + offset: ::off64_t, + whence: ::c_int) -> ::c_int; + pub fn ftello64(stream: *mut ::FILE) -> ::off64_t; + pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, + len: ::off_t) -> ::c_int; + pub fn pwritev(fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + offset: ::off_t) -> ::ssize_t; + pub fn preadv(fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + offset: ::off_t) -> ::ssize_t; + pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int; + pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int; + pub fn mkostemps(template: *mut ::c_char, + suffixlen: ::c_int, + flags: ::c_int) -> ::c_int; + pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; + pub fn getnameinfo(sa: *const ::sockaddr, + salen: ::socklen_t, + host: *mut ::c_char, + hostlen: ::socklen_t, + serv: *mut ::c_char, + sevlen: ::socklen_t, + flags: ::c_int) -> ::c_int; + pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int; + + // Not available now on Android + pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, + mode: ::mode_t) -> ::c_int; + pub fn if_nameindex() -> *mut if_nameindex; + pub fn if_freenameindex(ptr: *mut if_nameindex); + + pub fn mremap(addr: *mut ::c_void, + len: ::size_t, + new_len: ::size_t, + flags: ::c_int, + ...) -> *mut ::c_void; + + pub fn glob(pattern: *const c_char, + flags: ::c_int, + errfunc: ::Option ::c_int>, + pglob: *mut ::glob_t) -> ::c_int; + pub fn globfree(pglob: *mut ::glob_t); + + pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) + -> ::c_int; + + pub fn shm_unlink(name: *const ::c_char) -> ::c_int; + + pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long); + + pub fn telldir(dirp: *mut ::DIR) -> ::c_long; + pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) + -> ::c_int; + + pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int; + + pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, + flags: ::c_int, addr: *mut ::sockaddr, + addrlen: *mut ::socklen_t) -> ::ssize_t; + pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; + pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; + + pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int; + pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int; + pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, + flags: ::c_uint) -> ::c_int; + pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, + flags: ::c_uint, timeout: *mut ::timespec) -> ::c_int; + pub fn sync(); + pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; + pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; + pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; + pub fn pthread_create(native: *mut ::pthread_t, + attr: *const ::pthread_attr_t, + f: extern fn(*mut ::c_void) -> *mut ::c_void, + value: *mut ::c_void) -> ::c_int; +} + +cfg_if! { + if #[cfg(libc_align)] { + #[macro_use] + mod align; + } else { + #[macro_use] + mod no_align; + } +} +expand_align!(); diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/emscripten/no_align.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/emscripten/no_align.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/emscripten/no_align.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/emscripten/no_align.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,63 @@ +macro_rules! expand_align { + () => { + s! { + pub struct pthread_mutex_t { + __align: [::c_long; 0], + size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], + } + + pub struct pthread_rwlock_t { + __align: [::c_long; 0], + size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], + } + + pub struct pthread_mutexattr_t { + __align: [::c_int; 0], + size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], + } + + pub struct pthread_rwlockattr_t { + __align: [::c_int; 0], + size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T], + } + + pub struct pthread_condattr_t { + __align: [::c_int; 0], + size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], + } + } + + s_no_extra_traits! { + pub struct pthread_cond_t { + __align: [*const ::c_void; 0], + size: [u8; ::__SIZEOF_PTHREAD_COND_T], + } + } + + cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for pthread_cond_t { + fn eq(&self, other: &pthread_cond_t) -> bool { + self.size + .iter() + .zip(other.size.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for pthread_cond_t {} + impl ::fmt::Debug for pthread_cond_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("pthread_cond_t") + // FIXME: .field("size", &self.size) + .finish() + } + } + impl ::hash::Hash for pthread_cond_t { + fn hash(&self, state: &mut H) { + self.size.hash(state); + } + } + } + } + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/align.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/align.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/align.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/align.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,98 @@ +macro_rules! expand_align { + () => { + s! { + #[cfg_attr(any(target_pointer_width = "32", + target_arch = "x86_64", + target_arch = "powerpc64", + target_arch = "mips64", + target_arch = "s390x", + target_arch = "sparc64", + target_arch = "aarch64"), + repr(align(4)))] + #[cfg_attr(not(any(target_pointer_width = "32", + target_arch = "x86_64", + target_arch = "powerpc64", + target_arch = "mips64", + target_arch = "s390x", + target_arch = "sparc64", + target_arch = "aarch64")), + repr(align(8)))] + pub struct pthread_mutexattr_t { + #[doc(hidden)] + size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], + } + + #[cfg_attr(any(target_env = "musl", target_pointer_width = "32"), + repr(align(4)))] + #[cfg_attr(all(not(target_env = "musl"), + target_pointer_width = "64"), + repr(align(8)))] + pub struct pthread_rwlockattr_t { + #[doc(hidden)] + size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T], + } + + #[repr(align(4))] + pub struct pthread_condattr_t { + #[doc(hidden)] + size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], + } + } + + s_no_extra_traits! { + #[cfg_attr(all(target_env = "musl", + target_pointer_width = "32"), + repr(align(4)))] + #[cfg_attr(all(target_env = "musl", + target_pointer_width = "64"), + repr(align(8)))] + #[cfg_attr(all(not(target_env = "musl"), + target_arch = "x86"), + repr(align(4)))] + #[cfg_attr(all(not(target_env = "musl"), + not(target_arch = "x86")), + repr(align(8)))] + pub struct pthread_cond_t { + #[doc(hidden)] + size: [u8; ::__SIZEOF_PTHREAD_COND_T], + } + + #[cfg_attr(all(target_pointer_width = "32", + any(target_arch = "mips", + target_arch = "arm", + target_arch = "powerpc", + target_arch = "x86_64", + target_arch = "x86")), + repr(align(4)))] + #[cfg_attr(any(target_pointer_width = "64", + not(any(target_arch = "mips", + target_arch = "arm", + target_arch = "powerpc", + target_arch = "x86_64", + target_arch = "x86"))), + repr(align(8)))] + pub struct pthread_mutex_t { + #[doc(hidden)] + size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], + } + + #[cfg_attr(all(target_pointer_width = "32", + any(target_arch = "mips", + target_arch = "arm", + target_arch = "powerpc", + target_arch = "x86_64", + target_arch = "x86")), + repr(align(4)))] + #[cfg_attr(any(target_pointer_width = "64", + not(any(target_arch = "mips", + target_arch = "arm", + target_arch = "powerpc", + target_arch = "x86_64", + target_arch = "x86"))), + repr(align(8)))] + pub struct pthread_rwlock_t { + size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], + } + } + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/align.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/align.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/align.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/align.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,13 @@ +s! { + // FIXME this is actually a union + #[cfg_attr(target_pointer_width = "32", + repr(align(4)))] + #[cfg_attr(target_pointer_width = "64", + repr(align(8)))] + pub struct sem_t { + #[cfg(target_pointer_width = "32")] + __size: [::c_char; 16], + #[cfg(target_pointer_width = "64")] + __size: [::c_char; 32], + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/arm.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/arm.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/arm.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/arm.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,864 @@ +pub type c_char = u8; +pub type wchar_t = u32; + +s! { + pub struct sigaction { + pub sa_sigaction: ::sighandler_t, + pub sa_mask: ::sigset_t, + pub sa_flags: ::c_int, + pub sa_restorer: ::Option, + } + + pub struct statfs { + pub f_type: ::__fsword_t, + pub f_bsize: ::__fsword_t, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + + pub f_namelen: ::__fsword_t, + pub f_frsize: ::__fsword_t, + f_spare: [::__fsword_t; 5], + } + + pub struct flock { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off_t, + pub l_len: ::off_t, + pub l_pid: ::pid_t, + } + + pub struct ipc_perm { + pub __key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::c_ushort, + __pad1: ::c_ushort, + pub __seq: ::c_ushort, + __pad2: ::c_ushort, + __unused1: ::c_ulong, + __unused2: ::c_ulong + } + + pub struct stat64 { + pub st_dev: ::dev_t, + __pad1: ::c_uint, + __st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __pad2: ::c_uint, + pub st_size: ::off64_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt64_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_ino: ::ino64_t, + } + + pub struct statfs64 { + pub f_type: ::__fsword_t, + pub f_bsize: ::__fsword_t, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_fsid: ::fsid_t, + pub f_namelen: ::__fsword_t, + pub f_frsize: ::__fsword_t, + pub f_flags: ::__fsword_t, + pub f_spare: [::__fsword_t; 4], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: u64, + pub f_fsid: ::c_ulong, + __f_unused: ::c_int, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_atime: ::time_t, + __unused1: ::c_ulong, + pub shm_dtime: ::time_t, + __unused2: ::c_ulong, + pub shm_ctime: ::time_t, + __unused3: ::c_ulong, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, + pub shm_nattch: ::shmatt_t, + __unused4: ::c_ulong, + __unused5: ::c_ulong + } + + pub struct msqid_ds { + pub msg_perm: ::ipc_perm, + pub msg_stime: ::time_t, + __glibc_reserved1: ::c_ulong, + pub msg_rtime: ::time_t, + __glibc_reserved2: ::c_ulong, + pub msg_ctime: ::time_t, + __glibc_reserved3: ::c_ulong, + __msg_cbytes: ::c_ulong, + pub msg_qnum: ::msgqnum_t, + pub msg_qbytes: ::msglen_t, + pub msg_lspid: ::pid_t, + pub msg_lrpid: ::pid_t, + __glibc_reserved4: ::c_ulong, + __glibc_reserved5: ::c_ulong, + } + + pub struct termios2 { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; 19], + pub c_ispeed: ::speed_t, + pub c_ospeed: ::speed_t, + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + #[doc(hidden)] + #[deprecated( + since="0.2.54", + note="Please leave a comment on \ + https://github.com/rust-lang/libc/pull/1316 if you're using \ + this field" + )] + pub _pad: [::c_int; 29], + _align: [usize; 0], + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_flags: ::c_int, + pub ss_size: ::size_t + } +} + +pub const RLIM_INFINITY: ::rlim_t = !0; +pub const VEOF: usize = 4; +pub const RTLD_DEEPBIND: ::c_int = 0x8; +pub const RTLD_GLOBAL: ::c_int = 0x100; +pub const RTLD_NOLOAD: ::c_int = 0x4; +pub const O_DIRECT: ::c_int = 0x10000; +pub const O_DIRECTORY: ::c_int = 0x4000; +pub const O_NOFOLLOW: ::c_int = 0x8000; +pub const O_LARGEFILE: ::c_int = 0o400000; +pub const O_APPEND: ::c_int = 1024; +pub const O_CREAT: ::c_int = 64; +pub const O_EXCL: ::c_int = 128; +pub const O_NOCTTY: ::c_int = 256; +pub const O_NONBLOCK: ::c_int = 2048; +pub const O_SYNC: ::c_int = 1052672; +pub const O_RSYNC: ::c_int = 1052672; +pub const O_DSYNC: ::c_int = 4096; +pub const O_FSYNC: ::c_int = 0x101000; +pub const O_ASYNC: ::c_int = 0x2000; +pub const O_NDELAY: ::c_int = 0x800; +pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7; +pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6; +pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; +pub const RLIMIT_AS: ::__rlimit_resource_t = 9; +pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; + +pub const MADV_SOFT_OFFLINE: ::c_int = 101; +pub const MAP_LOCKED: ::c_int = 0x02000; +pub const MAP_NORESERVE: ::c_int = 0x04000; +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_ANONYMOUS: ::c_int = 0x0020; +pub const MAP_DENYWRITE: ::c_int = 0x0800; +pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_POPULATE: ::c_int = 0x08000; +pub const MAP_NONBLOCK: ::c_int = 0x010000; +pub const MAP_STACK: ::c_int = 0x020000; +pub const MAP_HUGETLB: ::c_int = 0x040000; +pub const MAP_GROWSDOWN: ::c_int = 0x0100; + +pub const SOL_SOCKET: ::c_int = 1; + +pub const EDEADLOCK: ::c_int = 35; +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; +pub const EDEADLK: ::c_int = 35; +pub const ENAMETOOLONG: ::c_int = 36; +pub const ENOLCK: ::c_int = 37; +pub const ENOSYS: ::c_int = 38; +pub const ENOTEMPTY: ::c_int = 39; +pub const ELOOP: ::c_int = 40; +pub const ENOMSG: ::c_int = 42; +pub const EIDRM: ::c_int = 43; +pub const ECHRNG: ::c_int = 44; +pub const EL2NSYNC: ::c_int = 45; +pub const EL3HLT: ::c_int = 46; +pub const EL3RST: ::c_int = 47; +pub const ELNRNG: ::c_int = 48; +pub const EUNATCH: ::c_int = 49; +pub const ENOCSI: ::c_int = 50; +pub const EL2HLT: ::c_int = 51; +pub const EBADE: ::c_int = 52; +pub const EBADR: ::c_int = 53; +pub const EXFULL: ::c_int = 54; +pub const ENOANO: ::c_int = 55; +pub const EBADRQC: ::c_int = 56; +pub const EBADSLT: ::c_int = 57; +pub const EMULTIHOP: ::c_int = 72; +pub const EOVERFLOW: ::c_int = 75; +pub const ENOTUNIQ: ::c_int = 76; +pub const EBADFD: ::c_int = 77; +pub const EBADMSG: ::c_int = 74; +pub const EREMCHG: ::c_int = 78; +pub const ELIBACC: ::c_int = 79; +pub const ELIBBAD: ::c_int = 80; +pub const ELIBSCN: ::c_int = 81; +pub const ELIBMAX: ::c_int = 82; +pub const ELIBEXEC: ::c_int = 83; +pub const EILSEQ: ::c_int = 84; +pub const ERESTART: ::c_int = 85; +pub const ESTRPIPE: ::c_int = 86; +pub const EUSERS: ::c_int = 87; +pub const ENOTSOCK: ::c_int = 88; +pub const EDESTADDRREQ: ::c_int = 89; +pub const EMSGSIZE: ::c_int = 90; +pub const EPROTOTYPE: ::c_int = 91; +pub const ENOPROTOOPT: ::c_int = 92; +pub const EPROTONOSUPPORT: ::c_int = 93; +pub const ESOCKTNOSUPPORT: ::c_int = 94; +pub const EOPNOTSUPP: ::c_int = 95; +pub const EPFNOSUPPORT: ::c_int = 96; +pub const EAFNOSUPPORT: ::c_int = 97; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const ENETDOWN: ::c_int = 100; +pub const ENETUNREACH: ::c_int = 101; +pub const ENETRESET: ::c_int = 102; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNRESET: ::c_int = 104; +pub const ENOBUFS: ::c_int = 105; +pub const EISCONN: ::c_int = 106; +pub const ENOTCONN: ::c_int = 107; +pub const ESHUTDOWN: ::c_int = 108; +pub const ETOOMANYREFS: ::c_int = 109; +pub const ETIMEDOUT: ::c_int = 110; +pub const ECONNREFUSED: ::c_int = 111; +pub const EHOSTDOWN: ::c_int = 112; +pub const EHOSTUNREACH: ::c_int = 113; +pub const EALREADY: ::c_int = 114; +pub const EINPROGRESS: ::c_int = 115; +pub const ESTALE: ::c_int = 116; +pub const EDQUOT: ::c_int = 122; +pub const ENOMEDIUM: ::c_int = 123; +pub const EMEDIUMTYPE: ::c_int = 124; +pub const ECANCELED: ::c_int = 125; +pub const ENOKEY: ::c_int = 126; +pub const EKEYEXPIRED: ::c_int = 127; +pub const EKEYREVOKED: ::c_int = 128; +pub const EKEYREJECTED: ::c_int = 129; +pub const EOWNERDEAD: ::c_int = 130; +pub const ENOTRECOVERABLE: ::c_int = 131; +pub const EHWPOISON: ::c_int = 133; +pub const ERFKILL: ::c_int = 132; + +pub const SO_REUSEADDR: ::c_int = 2; +pub const SO_TYPE: ::c_int = 3; +pub const SO_ERROR: ::c_int = 4; +pub const SO_DONTROUTE: ::c_int = 5; +pub const SO_BROADCAST: ::c_int = 6; +pub const SO_SNDBUF: ::c_int = 7; +pub const SO_RCVBUF: ::c_int = 8; +pub const SO_KEEPALIVE: ::c_int = 9; +pub const SO_OOBINLINE: ::c_int = 10; +pub const SO_LINGER: ::c_int = 13; +pub const SO_REUSEPORT: ::c_int = 15; +pub const SO_ACCEPTCONN: ::c_int = 30; +pub const SO_PROTOCOL: ::c_int = 38; +pub const SO_DOMAIN: ::c_int = 39; +pub const SO_PASSCRED: ::c_int = 16; +pub const SO_PEERCRED: ::c_int = 17; +pub const SO_RCVLOWAT: ::c_int = 18; +pub const SO_SNDLOWAT: ::c_int = 19; +pub const SO_RCVTIMEO: ::c_int = 20; +pub const SO_SNDTIMEO: ::c_int = 21; +pub const SO_SNDBUFFORCE: ::c_int = 32; +pub const SO_RCVBUFFORCE: ::c_int = 33; + +pub const SA_SIGINFO: ::c_int = 0x00000004; +pub const SA_NOCLDWAIT: ::c_int = 0x00000002; + +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; + +pub const FIOCLEX: ::c_ulong = 0x5451; +pub const FIONCLEX: ::c_ulong = 0x5450; +pub const FIONBIO: ::c_ulong = 0x5421; + +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; + +pub const POLLWRNORM: ::c_short = 0x100; +pub const POLLWRBAND: ::c_short = 0x200; + +pub const F_GETLK: ::c_int = 5; +pub const F_GETOWN: ::c_int = 9; +pub const F_SETOWN: ::c_int = 8; + +pub const EFD_NONBLOCK: ::c_int = 0x800; +pub const SFD_NONBLOCK: ::c_int = 0x0800; + +pub const SIGCHLD: ::c_int = 17; +pub const SIGBUS: ::c_int = 7; +pub const SIGUSR1: ::c_int = 10; +pub const SIGUSR2: ::c_int = 12; +pub const SIGCONT: ::c_int = 18; +pub const SIGSTOP: ::c_int = 19; +pub const SIGTSTP: ::c_int = 20; +pub const SIGURG: ::c_int = 23; +pub const SIGIO: ::c_int = 29; +pub const SIGSYS: ::c_int = 31; +pub const SIGSTKFLT: ::c_int = 16; +#[deprecated( + since = "0.2.55", + note = "Use SIGSYS instead" +)] +pub const SIGUNUSED: ::c_int = 31; +pub const SIGPOLL: ::c_int = 29; +pub const SIGPWR: ::c_int = 30; +pub const SIG_SETMASK: ::c_int = 2; +pub const SIG_BLOCK: ::c_int = 0x000000; +pub const SIG_UNBLOCK: ::c_int = 0x01; +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; +pub const SIGSTKSZ: ::size_t = 8192; +pub const MINSIGSTKSZ: ::size_t = 2048; +pub const CBAUD: ::tcflag_t = 0o0010017; +pub const TAB1: ::tcflag_t = 0x00000800; +pub const TAB2: ::tcflag_t = 0x00001000; +pub const TAB3: ::tcflag_t = 0x00001800; +pub const CR1: ::tcflag_t = 0x00000200; +pub const CR2: ::tcflag_t = 0x00000400; +pub const CR3: ::tcflag_t = 0x00000600; +pub const FF1: ::tcflag_t = 0x00008000; +pub const BS1: ::tcflag_t = 0x00002000; +pub const VT1: ::tcflag_t = 0x00004000; +pub const VWERASE: usize = 14; +pub const VREPRINT: usize = 12; +pub const VSUSP: usize = 10; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VDISCARD: usize = 13; +pub const VTIME: usize = 5; +pub const IXON: ::tcflag_t = 0x00000400; +pub const IXOFF: ::tcflag_t = 0x00001000; +pub const ONLCR: ::tcflag_t = 0x4; +pub const CSIZE: ::tcflag_t = 0x00000030; +pub const CS6: ::tcflag_t = 0x00000010; +pub const CS7: ::tcflag_t = 0x00000020; +pub const CS8: ::tcflag_t = 0x00000030; +pub const CSTOPB: ::tcflag_t = 0x00000040; +pub const CREAD: ::tcflag_t = 0x00000080; +pub const PARENB: ::tcflag_t = 0x00000100; +pub const PARODD: ::tcflag_t = 0x00000200; +pub const HUPCL: ::tcflag_t = 0x00000400; +pub const CLOCAL: ::tcflag_t = 0x00000800; +pub const ECHOKE: ::tcflag_t = 0x00000800; +pub const ECHOE: ::tcflag_t = 0x00000010; +pub const ECHOK: ::tcflag_t = 0x00000020; +pub const ECHONL: ::tcflag_t = 0x00000040; +pub const ECHOPRT: ::tcflag_t = 0x00000400; +pub const ECHOCTL: ::tcflag_t = 0x00000200; +pub const ISIG: ::tcflag_t = 0x00000001; +pub const ICANON: ::tcflag_t = 0x00000002; +pub const PENDIN: ::tcflag_t = 0x00004000; +pub const NOFLSH: ::tcflag_t = 0x00000080; +pub const CIBAUD: ::tcflag_t = 0o02003600000; +pub const CBAUDEX: ::tcflag_t = 0o010000; +pub const VSWTC: usize = 7; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const XTABS: ::tcflag_t = 0o014000; + +pub const B0: ::speed_t = 0o000000; +pub const B50: ::speed_t = 0o000001; +pub const B75: ::speed_t = 0o000002; +pub const B110: ::speed_t = 0o000003; +pub const B134: ::speed_t = 0o000004; +pub const B150: ::speed_t = 0o000005; +pub const B200: ::speed_t = 0o000006; +pub const B300: ::speed_t = 0o000007; +pub const B600: ::speed_t = 0o000010; +pub const B1200: ::speed_t = 0o000011; +pub const B1800: ::speed_t = 0o000012; +pub const B2400: ::speed_t = 0o000013; +pub const B4800: ::speed_t = 0o000014; +pub const B9600: ::speed_t = 0o000015; +pub const B19200: ::speed_t = 0o000016; +pub const B38400: ::speed_t = 0o000017; +pub const EXTA: ::speed_t = B19200; +pub const EXTB: ::speed_t = B38400; +pub const BOTHER: ::speed_t = 0o010000; +pub const B57600: ::speed_t = 0o010001; +pub const B115200: ::speed_t = 0o010002; +pub const B230400: ::speed_t = 0o010003; +pub const B460800: ::speed_t = 0o010004; +pub const B500000: ::speed_t = 0o010005; +pub const B576000: ::speed_t = 0o010006; +pub const B921600: ::speed_t = 0o010007; +pub const B1000000: ::speed_t = 0o010010; +pub const B1152000: ::speed_t = 0o010011; +pub const B1500000: ::speed_t = 0o010012; +pub const B2000000: ::speed_t = 0o010013; +pub const B2500000: ::speed_t = 0o010014; +pub const B3000000: ::speed_t = 0o010015; +pub const B3500000: ::speed_t = 0o010016; +pub const B4000000: ::speed_t = 0o010017; + +pub const VEOL: usize = 11; +pub const VEOL2: usize = 16; +pub const VMIN: usize = 6; +pub const IEXTEN: ::tcflag_t = 0x00008000; +pub const TOSTOP: ::tcflag_t = 0x00000100; +pub const FLUSHO: ::tcflag_t = 0x00001000; +pub const EXTPROC: ::tcflag_t = 0x00010000; +pub const TCGETS: ::c_ulong = 0x5401; +pub const TCSETS: ::c_ulong = 0x5402; +pub const TCSETSW: ::c_ulong = 0x5403; +pub const TCSETSF: ::c_ulong = 0x5404; +pub const TCGETA: ::c_ulong = 0x5405; +pub const TCSETA: ::c_ulong = 0x5406; +pub const TCSETAW: ::c_ulong = 0x5407; +pub const TCSETAF: ::c_ulong = 0x5408; +pub const TCSBRK: ::c_ulong = 0x5409; +pub const TCXONC: ::c_ulong = 0x540A; +pub const TCFLSH: ::c_ulong = 0x540B; +pub const TIOCINQ: ::c_ulong = 0x541B; +pub const TIOCGPGRP: ::c_ulong = 0x540F; +pub const TIOCSPGRP: ::c_ulong = 0x5410; +pub const TIOCOUTQ: ::c_ulong = 0x5411; +pub const TIOCGWINSZ: ::c_ulong = 0x5413; +pub const TIOCSWINSZ: ::c_ulong = 0x5414; +pub const TIOCGRS485: ::c_int = 0x542E; +pub const TIOCSRS485: ::c_int = 0x542F; +pub const FIONREAD: ::c_ulong = 0x541B; + +pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; +pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; +pub const TIOCEXCL: ::c_ulong = 0x540C; +pub const TIOCNXCL: ::c_ulong = 0x540D; +pub const TIOCSCTTY: ::c_ulong = 0x540E; +pub const TIOCSTI: ::c_ulong = 0x5412; +pub const TIOCMGET: ::c_ulong = 0x5415; +pub const TIOCMBIS: ::c_ulong = 0x5416; +pub const TIOCMBIC: ::c_ulong = 0x5417; +pub const TIOCMSET: ::c_ulong = 0x5418; +pub const TIOCCONS: ::c_ulong = 0x541D; + +pub const TCSANOW: ::c_int = 0; +pub const TCSADRAIN: ::c_int = 1; +pub const TCSAFLUSH: ::c_int = 2; + +pub const TIOCLINUX: ::c_ulong = 0x541C; +pub const TIOCGSERIAL: ::c_ulong = 0x541E; +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; + +// Syscall table +pub const SYS_restart_syscall: ::c_long = 0; +pub const SYS_exit: ::c_long = 1; +pub const SYS_fork: ::c_long = 2; +pub const SYS_read: ::c_long = 3; +pub const SYS_write: ::c_long = 4; +pub const SYS_open: ::c_long = 5; +pub const SYS_close: ::c_long = 6; +pub const SYS_creat: ::c_long = 8; +pub const SYS_link: ::c_long = 9; +pub const SYS_unlink: ::c_long = 10; +pub const SYS_execve: ::c_long = 11; +pub const SYS_chdir: ::c_long = 12; +pub const SYS_mknod: ::c_long = 14; +pub const SYS_chmod: ::c_long = 15; +pub const SYS_lchown: ::c_long = 16; +pub const SYS_lseek: ::c_long = 19; +pub const SYS_getpid: ::c_long = 20; +pub const SYS_mount: ::c_long = 21; +pub const SYS_setuid: ::c_long = 23; +pub const SYS_getuid: ::c_long = 24; +pub const SYS_ptrace: ::c_long = 26; +pub const SYS_pause: ::c_long = 29; +pub const SYS_access: ::c_long = 33; +pub const SYS_nice: ::c_long = 34; +pub const SYS_sync: ::c_long = 36; +pub const SYS_kill: ::c_long = 37; +pub const SYS_rename: ::c_long = 38; +pub const SYS_mkdir: ::c_long = 39; +pub const SYS_rmdir: ::c_long = 40; +pub const SYS_dup: ::c_long = 41; +pub const SYS_pipe: ::c_long = 42; +pub const SYS_times: ::c_long = 43; +pub const SYS_brk: ::c_long = 45; +pub const SYS_setgid: ::c_long = 46; +pub const SYS_getgid: ::c_long = 47; +pub const SYS_geteuid: ::c_long = 49; +pub const SYS_getegid: ::c_long = 50; +pub const SYS_acct: ::c_long = 51; +pub const SYS_umount2: ::c_long = 52; +pub const SYS_ioctl: ::c_long = 54; +pub const SYS_fcntl: ::c_long = 55; +pub const SYS_setpgid: ::c_long = 57; +pub const SYS_umask: ::c_long = 60; +pub const SYS_chroot: ::c_long = 61; +pub const SYS_ustat: ::c_long = 62; +pub const SYS_dup2: ::c_long = 63; +pub const SYS_getppid: ::c_long = 64; +pub const SYS_getpgrp: ::c_long = 65; +pub const SYS_setsid: ::c_long = 66; +pub const SYS_sigaction: ::c_long = 67; +pub const SYS_setreuid: ::c_long = 70; +pub const SYS_setregid: ::c_long = 71; +pub const SYS_sigsuspend: ::c_long = 72; +pub const SYS_sigpending: ::c_long = 73; +pub const SYS_sethostname: ::c_long = 74; +pub const SYS_setrlimit: ::c_long = 75; +pub const SYS_getrusage: ::c_long = 77; +pub const SYS_gettimeofday: ::c_long = 78; +pub const SYS_settimeofday: ::c_long = 79; +pub const SYS_getgroups: ::c_long = 80; +pub const SYS_setgroups: ::c_long = 81; +pub const SYS_symlink: ::c_long = 83; +pub const SYS_readlink: ::c_long = 85; +pub const SYS_uselib: ::c_long = 86; +pub const SYS_swapon: ::c_long = 87; +pub const SYS_reboot: ::c_long = 88; +pub const SYS_munmap: ::c_long = 91; +pub const SYS_truncate: ::c_long = 92; +pub const SYS_ftruncate: ::c_long = 93; +pub const SYS_fchmod: ::c_long = 94; +pub const SYS_fchown: ::c_long = 95; +pub const SYS_getpriority: ::c_long = 96; +pub const SYS_setpriority: ::c_long = 97; +pub const SYS_statfs: ::c_long = 99; +pub const SYS_fstatfs: ::c_long = 100; +pub const SYS_syslog: ::c_long = 103; +pub const SYS_setitimer: ::c_long = 104; +pub const SYS_getitimer: ::c_long = 105; +pub const SYS_stat: ::c_long = 106; +pub const SYS_lstat: ::c_long = 107; +pub const SYS_fstat: ::c_long = 108; +pub const SYS_vhangup: ::c_long = 111; +pub const SYS_wait4: ::c_long = 114; +pub const SYS_swapoff: ::c_long = 115; +pub const SYS_sysinfo: ::c_long = 116; +pub const SYS_fsync: ::c_long = 118; +pub const SYS_sigreturn: ::c_long = 119; +pub const SYS_clone: ::c_long = 120; +pub const SYS_setdomainname: ::c_long = 121; +pub const SYS_uname: ::c_long = 122; +pub const SYS_adjtimex: ::c_long = 124; +pub const SYS_mprotect: ::c_long = 125; +pub const SYS_sigprocmask: ::c_long = 126; +pub const SYS_init_module: ::c_long = 128; +pub const SYS_delete_module: ::c_long = 129; +pub const SYS_quotactl: ::c_long = 131; +pub const SYS_getpgid: ::c_long = 132; +pub const SYS_fchdir: ::c_long = 133; +pub const SYS_bdflush: ::c_long = 134; +pub const SYS_sysfs: ::c_long = 135; +pub const SYS_personality: ::c_long = 136; +pub const SYS_setfsuid: ::c_long = 138; +pub const SYS_setfsgid: ::c_long = 139; +pub const SYS__llseek: ::c_long = 140; +pub const SYS_getdents: ::c_long = 141; +pub const SYS__newselect: ::c_long = 142; +pub const SYS_flock: ::c_long = 143; +pub const SYS_msync: ::c_long = 144; +pub const SYS_readv: ::c_long = 145; +pub const SYS_writev: ::c_long = 146; +pub const SYS_getsid: ::c_long = 147; +pub const SYS_fdatasync: ::c_long = 148; +pub const SYS__sysctl: ::c_long = 149; +pub const SYS_mlock: ::c_long = 150; +pub const SYS_munlock: ::c_long = 151; +pub const SYS_mlockall: ::c_long = 152; +pub const SYS_munlockall: ::c_long = 153; +pub const SYS_sched_setparam: ::c_long = 154; +pub const SYS_sched_getparam: ::c_long = 155; +pub const SYS_sched_setscheduler: ::c_long = 156; +pub const SYS_sched_getscheduler: ::c_long = 157; +pub const SYS_sched_yield: ::c_long = 158; +pub const SYS_sched_get_priority_max: ::c_long = 159; +pub const SYS_sched_get_priority_min: ::c_long = 160; +pub const SYS_sched_rr_get_interval: ::c_long = 161; +pub const SYS_nanosleep: ::c_long = 162; +pub const SYS_mremap: ::c_long = 163; +pub const SYS_setresuid: ::c_long = 164; +pub const SYS_getresuid: ::c_long = 165; +pub const SYS_poll: ::c_long = 168; +pub const SYS_nfsservctl: ::c_long = 169; +pub const SYS_setresgid: ::c_long = 170; +pub const SYS_getresgid: ::c_long = 171; +pub const SYS_prctl: ::c_long = 172; +pub const SYS_rt_sigreturn: ::c_long = 173; +pub const SYS_rt_sigaction: ::c_long = 174; +pub const SYS_rt_sigprocmask: ::c_long = 175; +pub const SYS_rt_sigpending: ::c_long = 176; +pub const SYS_rt_sigtimedwait: ::c_long = 177; +pub const SYS_rt_sigqueueinfo: ::c_long = 178; +pub const SYS_rt_sigsuspend: ::c_long = 179; +pub const SYS_pread64: ::c_long = 180; +pub const SYS_pwrite64: ::c_long = 181; +pub const SYS_chown: ::c_long = 182; +pub const SYS_getcwd: ::c_long = 183; +pub const SYS_capget: ::c_long = 184; +pub const SYS_capset: ::c_long = 185; +pub const SYS_sigaltstack: ::c_long = 186; +pub const SYS_sendfile: ::c_long = 187; +pub const SYS_vfork: ::c_long = 190; +pub const SYS_ugetrlimit: ::c_long = 191; +pub const SYS_mmap2: ::c_long = 192; +pub const SYS_truncate64: ::c_long = 193; +pub const SYS_ftruncate64: ::c_long = 194; +pub const SYS_stat64: ::c_long = 195; +pub const SYS_lstat64: ::c_long = 196; +pub const SYS_fstat64: ::c_long = 197; +pub const SYS_lchown32: ::c_long = 198; +pub const SYS_getuid32: ::c_long = 199; +pub const SYS_getgid32: ::c_long = 200; +pub const SYS_geteuid32: ::c_long = 201; +pub const SYS_getegid32: ::c_long = 202; +pub const SYS_setreuid32: ::c_long = 203; +pub const SYS_setregid32: ::c_long = 204; +pub const SYS_getgroups32: ::c_long = 205; +pub const SYS_setgroups32: ::c_long = 206; +pub const SYS_fchown32: ::c_long = 207; +pub const SYS_setresuid32: ::c_long = 208; +pub const SYS_getresuid32: ::c_long = 209; +pub const SYS_setresgid32: ::c_long = 210; +pub const SYS_getresgid32: ::c_long = 211; +pub const SYS_chown32: ::c_long = 212; +pub const SYS_setuid32: ::c_long = 213; +pub const SYS_setgid32: ::c_long = 214; +pub const SYS_setfsuid32: ::c_long = 215; +pub const SYS_setfsgid32: ::c_long = 216; +pub const SYS_getdents64: ::c_long = 217; +pub const SYS_pivot_root: ::c_long = 218; +pub const SYS_mincore: ::c_long = 219; +pub const SYS_madvise: ::c_long = 220; +pub const SYS_fcntl64: ::c_long = 221; +pub const SYS_gettid: ::c_long = 224; +pub const SYS_readahead: ::c_long = 225; +pub const SYS_setxattr: ::c_long = 226; +pub const SYS_lsetxattr: ::c_long = 227; +pub const SYS_fsetxattr: ::c_long = 228; +pub const SYS_getxattr: ::c_long = 229; +pub const SYS_lgetxattr: ::c_long = 230; +pub const SYS_fgetxattr: ::c_long = 231; +pub const SYS_listxattr: ::c_long = 232; +pub const SYS_llistxattr: ::c_long = 233; +pub const SYS_flistxattr: ::c_long = 234; +pub const SYS_removexattr: ::c_long = 235; +pub const SYS_lremovexattr: ::c_long = 236; +pub const SYS_fremovexattr: ::c_long = 237; +pub const SYS_tkill: ::c_long = 238; +pub const SYS_sendfile64: ::c_long = 239; +pub const SYS_futex: ::c_long = 240; +pub const SYS_sched_setaffinity: ::c_long = 241; +pub const SYS_sched_getaffinity: ::c_long = 242; +pub const SYS_io_setup: ::c_long = 243; +pub const SYS_io_destroy: ::c_long = 244; +pub const SYS_io_getevents: ::c_long = 245; +pub const SYS_io_submit: ::c_long = 246; +pub const SYS_io_cancel: ::c_long = 247; +pub const SYS_exit_group: ::c_long = 248; +pub const SYS_lookup_dcookie: ::c_long = 249; +pub const SYS_epoll_create: ::c_long = 250; +pub const SYS_epoll_ctl: ::c_long = 251; +pub const SYS_epoll_wait: ::c_long = 252; +pub const SYS_remap_file_pages: ::c_long = 253; +pub const SYS_set_tid_address: ::c_long = 256; +pub const SYS_timer_create: ::c_long = 257; +pub const SYS_timer_settime: ::c_long = 258; +pub const SYS_timer_gettime: ::c_long = 259; +pub const SYS_timer_getoverrun: ::c_long = 260; +pub const SYS_timer_delete: ::c_long = 261; +pub const SYS_clock_settime: ::c_long = 262; +pub const SYS_clock_gettime: ::c_long = 263; +pub const SYS_clock_getres: ::c_long = 264; +pub const SYS_clock_nanosleep: ::c_long = 265; +pub const SYS_statfs64: ::c_long = 266; +pub const SYS_fstatfs64: ::c_long = 267; +pub const SYS_tgkill: ::c_long = 268; +pub const SYS_utimes: ::c_long = 269; +pub const SYS_arm_fadvise64_64: ::c_long = 270; +pub const SYS_pciconfig_iobase: ::c_long = 271; +pub const SYS_pciconfig_read: ::c_long = 272; +pub const SYS_pciconfig_write: ::c_long = 273; +pub const SYS_mq_open: ::c_long = 274; +pub const SYS_mq_unlink: ::c_long = 275; +pub const SYS_mq_timedsend: ::c_long = 276; +pub const SYS_mq_timedreceive: ::c_long = 277; +pub const SYS_mq_notify: ::c_long = 278; +pub const SYS_mq_getsetattr: ::c_long = 279; +pub const SYS_waitid: ::c_long = 280; +pub const SYS_socket: ::c_long = 281; +pub const SYS_bind: ::c_long = 282; +pub const SYS_connect: ::c_long = 283; +pub const SYS_listen: ::c_long = 284; +pub const SYS_accept: ::c_long = 285; +pub const SYS_getsockname: ::c_long = 286; +pub const SYS_getpeername: ::c_long = 287; +pub const SYS_socketpair: ::c_long = 288; +pub const SYS_send: ::c_long = 289; +pub const SYS_sendto: ::c_long = 290; +pub const SYS_recv: ::c_long = 291; +pub const SYS_recvfrom: ::c_long = 292; +pub const SYS_shutdown: ::c_long = 293; +pub const SYS_setsockopt: ::c_long = 294; +pub const SYS_getsockopt: ::c_long = 295; +pub const SYS_sendmsg: ::c_long = 296; +pub const SYS_recvmsg: ::c_long = 297; +pub const SYS_semop: ::c_long = 298; +pub const SYS_semget: ::c_long = 299; +pub const SYS_semctl: ::c_long = 300; +pub const SYS_msgsnd: ::c_long = 301; +pub const SYS_msgrcv: ::c_long = 302; +pub const SYS_msgget: ::c_long = 303; +pub const SYS_msgctl: ::c_long = 304; +pub const SYS_shmat: ::c_long = 305; +pub const SYS_shmdt: ::c_long = 306; +pub const SYS_shmget: ::c_long = 307; +pub const SYS_shmctl: ::c_long = 308; +pub const SYS_add_key: ::c_long = 309; +pub const SYS_request_key: ::c_long = 310; +pub const SYS_keyctl: ::c_long = 311; +pub const SYS_semtimedop: ::c_long = 312; +pub const SYS_vserver: ::c_long = 313; +pub const SYS_ioprio_set: ::c_long = 314; +pub const SYS_ioprio_get: ::c_long = 315; +pub const SYS_inotify_init: ::c_long = 316; +pub const SYS_inotify_add_watch: ::c_long = 317; +pub const SYS_inotify_rm_watch: ::c_long = 318; +pub const SYS_mbind: ::c_long = 319; +pub const SYS_get_mempolicy: ::c_long = 320; +pub const SYS_set_mempolicy: ::c_long = 321; +pub const SYS_openat: ::c_long = 322; +pub const SYS_mkdirat: ::c_long = 323; +pub const SYS_mknodat: ::c_long = 324; +pub const SYS_fchownat: ::c_long = 325; +pub const SYS_futimesat: ::c_long = 326; +pub const SYS_fstatat64: ::c_long = 327; +pub const SYS_unlinkat: ::c_long = 328; +pub const SYS_renameat: ::c_long = 329; +pub const SYS_linkat: ::c_long = 330; +pub const SYS_symlinkat: ::c_long = 331; +pub const SYS_readlinkat: ::c_long = 332; +pub const SYS_fchmodat: ::c_long = 333; +pub const SYS_faccessat: ::c_long = 334; +pub const SYS_pselect6: ::c_long = 335; +pub const SYS_ppoll: ::c_long = 336; +pub const SYS_unshare: ::c_long = 337; +pub const SYS_set_robust_list: ::c_long = 338; +pub const SYS_get_robust_list: ::c_long = 339; +pub const SYS_splice: ::c_long = 340; +pub const SYS_arm_sync_file_range: ::c_long = 341; +pub const SYS_tee: ::c_long = 342; +pub const SYS_vmsplice: ::c_long = 343; +pub const SYS_move_pages: ::c_long = 344; +pub const SYS_getcpu: ::c_long = 345; +pub const SYS_epoll_pwait: ::c_long = 346; +pub const SYS_kexec_load: ::c_long = 347; +pub const SYS_utimensat: ::c_long = 348; +pub const SYS_signalfd: ::c_long = 349; +pub const SYS_timerfd_create: ::c_long = 350; +pub const SYS_eventfd: ::c_long = 351; +pub const SYS_fallocate: ::c_long = 352; +pub const SYS_timerfd_settime: ::c_long = 353; +pub const SYS_timerfd_gettime: ::c_long = 354; +pub const SYS_signalfd4: ::c_long = 355; +pub const SYS_eventfd2: ::c_long = 356; +pub const SYS_epoll_create1: ::c_long = 357; +pub const SYS_dup3: ::c_long = 358; +pub const SYS_pipe2: ::c_long = 359; +pub const SYS_inotify_init1: ::c_long = 360; +pub const SYS_preadv: ::c_long = 361; +pub const SYS_pwritev: ::c_long = 362; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 363; +pub const SYS_perf_event_open: ::c_long = 364; +pub const SYS_recvmmsg: ::c_long = 365; +pub const SYS_accept4: ::c_long = 366; +pub const SYS_fanotify_init: ::c_long = 367; +pub const SYS_fanotify_mark: ::c_long = 368; +pub const SYS_prlimit64: ::c_long = 369; +pub const SYS_name_to_handle_at: ::c_long = 370; +pub const SYS_open_by_handle_at: ::c_long = 371; +pub const SYS_clock_adjtime: ::c_long = 372; +pub const SYS_syncfs: ::c_long = 373; +pub const SYS_sendmmsg: ::c_long = 374; +pub const SYS_setns: ::c_long = 375; +pub const SYS_process_vm_readv: ::c_long = 376; +pub const SYS_process_vm_writev: ::c_long = 377; +pub const SYS_kcmp: ::c_long = 378; +pub const SYS_finit_module: ::c_long = 379; +pub const SYS_sched_setattr: ::c_long = 380; +pub const SYS_sched_getattr: ::c_long = 381; +pub const SYS_renameat2: ::c_long = 382; +pub const SYS_seccomp: ::c_long = 383; +pub const SYS_getrandom: ::c_long = 384; +pub const SYS_memfd_create: ::c_long = 385; +pub const SYS_bpf: ::c_long = 386; +pub const SYS_execveat: ::c_long = 387; +pub const SYS_userfaultfd: ::c_long = 388; +pub const SYS_membarrier: ::c_long = 389; +pub const SYS_mlock2: ::c_long = 390; +pub const SYS_copy_file_range: ::c_long = 391; +pub const SYS_preadv2: ::c_long = 392; +pub const SYS_pwritev2: ::c_long = 393; +pub const SYS_pkey_mprotect: ::c_long = 394; +pub const SYS_pkey_alloc: ::c_long = 395; +pub const SYS_pkey_free: ::c_long = 396; +pub const SYS_statx: ::c_long = 397; diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/mips.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/mips.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/mips.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/mips.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,893 @@ +pub type c_char = i8; +pub type wchar_t = i32; + +s! { + pub struct stat64 { + pub st_dev: ::c_ulong, + st_pad1: [::c_long; 3], + pub st_ino: ::ino64_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::c_ulong, + st_pad2: [::c_long; 2], + pub st_size: ::off64_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_blksize: ::blksize_t, + st_pad3: ::c_long, + pub st_blocks: ::blkcnt64_t, + st_pad5: [::c_long; 14], + } + + pub struct statfs { + pub f_type: ::c_long, + pub f_bsize: ::c_long, + pub f_frsize: ::c_long, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_files: ::fsblkcnt_t, + pub f_ffree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_fsid: ::fsid_t, + + pub f_namelen: ::c_long, + f_spare: [::c_long; 6], + } + + pub struct statfs64 { + pub f_type: ::c_long, + pub f_bsize: ::c_long, + pub f_frsize: ::c_long, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_bavail: u64, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_long, + pub f_flags: ::c_long, + pub f_spare: [::c_long; 5], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: u64, + pub f_fsid: ::c_ulong, + __f_unused: ::c_int, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct sigaction { + pub sa_flags: ::c_int, + pub sa_sigaction: ::sighandler_t, + pub sa_mask: ::sigset_t, + pub sa_restorer: ::Option, + _resv: [::c_int; 1], + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_size: ::size_t, + pub ss_flags: ::c_int, + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_code: ::c_int, + pub si_errno: ::c_int, + pub _pad: [::c_int; 29], + } + + pub struct ipc_perm { + pub __key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::c_uint, + pub __seq: ::c_ushort, + __pad1: ::c_ushort, + __unused1: ::c_ulong, + __unused2: ::c_ulong + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_atime: ::time_t, + pub shm_dtime: ::time_t, + pub shm_ctime: ::time_t, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, + pub shm_nattch: ::shmatt_t, + __unused4: ::c_ulong, + __unused5: ::c_ulong + } + + pub struct msqid_ds { + pub msg_perm: ::ipc_perm, + #[cfg(target_endian = "big")] + __glibc_reserved1: ::c_ulong, + pub msg_stime: ::time_t, + #[cfg(target_endian = "little")] + __glibc_reserved1: ::c_ulong, + #[cfg(target_endian = "big")] + __glibc_reserved2: ::c_ulong, + pub msg_rtime: ::time_t, + #[cfg(target_endian = "little")] + __glibc_reserved2: ::c_ulong, + #[cfg(target_endian = "big")] + __glibc_reserved3: ::c_ulong, + pub msg_ctime: ::time_t, + #[cfg(target_endian = "little")] + __glibc_reserved3: ::c_ulong, + __msg_cbytes: ::c_ulong, + pub msg_qnum: ::msgqnum_t, + pub msg_qbytes: ::msglen_t, + pub msg_lspid: ::pid_t, + pub msg_lrpid: ::pid_t, + __glibc_reserved4: ::c_ulong, + __glibc_reserved5: ::c_ulong, + } + + pub struct flock { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off_t, + pub l_len: ::off_t, + pub l_sysid: ::c_long, + pub l_pid: ::pid_t, + pad: [::c_long; 4], + } + + pub struct termios2 { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; 23], + pub c_ispeed: ::speed_t, + pub c_ospeed: ::speed_t, + } +} + +pub const O_LARGEFILE: ::c_int = 0x2000; + +pub const SYS_syscall: ::c_long = 4000 + 0; +pub const SYS_exit: ::c_long = 4000 + 1; +pub const SYS_fork: ::c_long = 4000 + 2; +pub const SYS_read: ::c_long = 4000 + 3; +pub const SYS_write: ::c_long = 4000 + 4; +pub const SYS_open: ::c_long = 4000 + 5; +pub const SYS_close: ::c_long = 4000 + 6; +pub const SYS_waitpid: ::c_long = 4000 + 7; +pub const SYS_creat: ::c_long = 4000 + 8; +pub const SYS_link: ::c_long = 4000 + 9; +pub const SYS_unlink: ::c_long = 4000 + 10; +pub const SYS_execve: ::c_long = 4000 + 11; +pub const SYS_chdir: ::c_long = 4000 + 12; +pub const SYS_time: ::c_long = 4000 + 13; +pub const SYS_mknod: ::c_long = 4000 + 14; +pub const SYS_chmod: ::c_long = 4000 + 15; +pub const SYS_lchown: ::c_long = 4000 + 16; +pub const SYS_break: ::c_long = 4000 + 17; +pub const SYS_lseek: ::c_long = 4000 + 19; +pub const SYS_getpid: ::c_long = 4000 + 20; +pub const SYS_mount: ::c_long = 4000 + 21; +pub const SYS_umount: ::c_long = 4000 + 22; +pub const SYS_setuid: ::c_long = 4000 + 23; +pub const SYS_getuid: ::c_long = 4000 + 24; +pub const SYS_stime: ::c_long = 4000 + 25; +pub const SYS_ptrace: ::c_long = 4000 + 26; +pub const SYS_alarm: ::c_long = 4000 + 27; +pub const SYS_pause: ::c_long = 4000 + 29; +pub const SYS_utime: ::c_long = 4000 + 30; +pub const SYS_stty: ::c_long = 4000 + 31; +pub const SYS_gtty: ::c_long = 4000 + 32; +pub const SYS_access: ::c_long = 4000 + 33; +pub const SYS_nice: ::c_long = 4000 + 34; +pub const SYS_ftime: ::c_long = 4000 + 35; +pub const SYS_sync: ::c_long = 4000 + 36; +pub const SYS_kill: ::c_long = 4000 + 37; +pub const SYS_rename: ::c_long = 4000 + 38; +pub const SYS_mkdir: ::c_long = 4000 + 39; +pub const SYS_rmdir: ::c_long = 4000 + 40; +pub const SYS_dup: ::c_long = 4000 + 41; +pub const SYS_pipe: ::c_long = 4000 + 42; +pub const SYS_times: ::c_long = 4000 + 43; +pub const SYS_prof: ::c_long = 4000 + 44; +pub const SYS_brk: ::c_long = 4000 + 45; +pub const SYS_setgid: ::c_long = 4000 + 46; +pub const SYS_getgid: ::c_long = 4000 + 47; +pub const SYS_signal: ::c_long = 4000 + 48; +pub const SYS_geteuid: ::c_long = 4000 + 49; +pub const SYS_getegid: ::c_long = 4000 + 50; +pub const SYS_acct: ::c_long = 4000 + 51; +pub const SYS_umount2: ::c_long = 4000 + 52; +pub const SYS_lock: ::c_long = 4000 + 53; +pub const SYS_ioctl: ::c_long = 4000 + 54; +pub const SYS_fcntl: ::c_long = 4000 + 55; +pub const SYS_mpx: ::c_long = 4000 + 56; +pub const SYS_setpgid: ::c_long = 4000 + 57; +pub const SYS_ulimit: ::c_long = 4000 + 58; +pub const SYS_umask: ::c_long = 4000 + 60; +pub const SYS_chroot: ::c_long = 4000 + 61; +pub const SYS_ustat: ::c_long = 4000 + 62; +pub const SYS_dup2: ::c_long = 4000 + 63; +pub const SYS_getppid: ::c_long = 4000 + 64; +pub const SYS_getpgrp: ::c_long = 4000 + 65; +pub const SYS_setsid: ::c_long = 4000 + 66; +pub const SYS_sigaction: ::c_long = 4000 + 67; +pub const SYS_sgetmask: ::c_long = 4000 + 68; +pub const SYS_ssetmask: ::c_long = 4000 + 69; +pub const SYS_setreuid: ::c_long = 4000 + 70; +pub const SYS_setregid: ::c_long = 4000 + 71; +pub const SYS_sigsuspend: ::c_long = 4000 + 72; +pub const SYS_sigpending: ::c_long = 4000 + 73; +pub const SYS_sethostname: ::c_long = 4000 + 74; +pub const SYS_setrlimit: ::c_long = 4000 + 75; +pub const SYS_getrlimit: ::c_long = 4000 + 76; +pub const SYS_getrusage: ::c_long = 4000 + 77; +pub const SYS_gettimeofday: ::c_long = 4000 + 78; +pub const SYS_settimeofday: ::c_long = 4000 + 79; +pub const SYS_getgroups: ::c_long = 4000 + 80; +pub const SYS_setgroups: ::c_long = 4000 + 81; +pub const SYS_symlink: ::c_long = 4000 + 83; +pub const SYS_readlink: ::c_long = 4000 + 85; +pub const SYS_uselib: ::c_long = 4000 + 86; +pub const SYS_swapon: ::c_long = 4000 + 87; +pub const SYS_reboot: ::c_long = 4000 + 88; +pub const SYS_readdir: ::c_long = 4000 + 89; +pub const SYS_mmap: ::c_long = 4000 + 90; +pub const SYS_munmap: ::c_long = 4000 + 91; +pub const SYS_truncate: ::c_long = 4000 + 92; +pub const SYS_ftruncate: ::c_long = 4000 + 93; +pub const SYS_fchmod: ::c_long = 4000 + 94; +pub const SYS_fchown: ::c_long = 4000 + 95; +pub const SYS_getpriority: ::c_long = 4000 + 96; +pub const SYS_setpriority: ::c_long = 4000 + 97; +pub const SYS_profil: ::c_long = 4000 + 98; +pub const SYS_statfs: ::c_long = 4000 + 99; +pub const SYS_fstatfs: ::c_long = 4000 + 100; +pub const SYS_ioperm: ::c_long = 4000 + 101; +pub const SYS_socketcall: ::c_long = 4000 + 102; +pub const SYS_syslog: ::c_long = 4000 + 103; +pub const SYS_setitimer: ::c_long = 4000 + 104; +pub const SYS_getitimer: ::c_long = 4000 + 105; +pub const SYS_stat: ::c_long = 4000 + 106; +pub const SYS_lstat: ::c_long = 4000 + 107; +pub const SYS_fstat: ::c_long = 4000 + 108; +pub const SYS_iopl: ::c_long = 4000 + 110; +pub const SYS_vhangup: ::c_long = 4000 + 111; +pub const SYS_idle: ::c_long = 4000 + 112; +pub const SYS_vm86: ::c_long = 4000 + 113; +pub const SYS_wait4: ::c_long = 4000 + 114; +pub const SYS_swapoff: ::c_long = 4000 + 115; +pub const SYS_sysinfo: ::c_long = 4000 + 116; +pub const SYS_ipc: ::c_long = 4000 + 117; +pub const SYS_fsync: ::c_long = 4000 + 118; +pub const SYS_sigreturn: ::c_long = 4000 + 119; +pub const SYS_clone: ::c_long = 4000 + 120; +pub const SYS_setdomainname: ::c_long = 4000 + 121; +pub const SYS_uname: ::c_long = 4000 + 122; +pub const SYS_modify_ldt: ::c_long = 4000 + 123; +pub const SYS_adjtimex: ::c_long = 4000 + 124; +pub const SYS_mprotect: ::c_long = 4000 + 125; +pub const SYS_sigprocmask: ::c_long = 4000 + 126; +pub const SYS_create_module: ::c_long = 4000 + 127; +pub const SYS_init_module: ::c_long = 4000 + 128; +pub const SYS_delete_module: ::c_long = 4000 + 129; +pub const SYS_get_kernel_syms: ::c_long = 4000 + 130; +pub const SYS_quotactl: ::c_long = 4000 + 131; +pub const SYS_getpgid: ::c_long = 4000 + 132; +pub const SYS_fchdir: ::c_long = 4000 + 133; +pub const SYS_bdflush: ::c_long = 4000 + 134; +pub const SYS_sysfs: ::c_long = 4000 + 135; +pub const SYS_personality: ::c_long = 4000 + 136; +pub const SYS_afs_syscall: ::c_long = 4000 + 137; +pub const SYS_setfsuid: ::c_long = 4000 + 138; +pub const SYS_setfsgid: ::c_long = 4000 + 139; +pub const SYS__llseek: ::c_long = 4000 + 140; +pub const SYS_getdents: ::c_long = 4000 + 141; +pub const SYS__newselect: ::c_long = 4000 + 142; +pub const SYS_flock: ::c_long = 4000 + 143; +pub const SYS_msync: ::c_long = 4000 + 144; +pub const SYS_readv: ::c_long = 4000 + 145; +pub const SYS_writev: ::c_long = 4000 + 146; +pub const SYS_cacheflush: ::c_long = 4000 + 147; +pub const SYS_cachectl: ::c_long = 4000 + 148; +pub const SYS_sysmips: ::c_long = 4000 + 149; +pub const SYS_getsid: ::c_long = 4000 + 151; +pub const SYS_fdatasync: ::c_long = 4000 + 152; +pub const SYS__sysctl: ::c_long = 4000 + 153; +pub const SYS_mlock: ::c_long = 4000 + 154; +pub const SYS_munlock: ::c_long = 4000 + 155; +pub const SYS_mlockall: ::c_long = 4000 + 156; +pub const SYS_munlockall: ::c_long = 4000 + 157; +pub const SYS_sched_setparam: ::c_long = 4000 + 158; +pub const SYS_sched_getparam: ::c_long = 4000 + 159; +pub const SYS_sched_setscheduler: ::c_long = 4000 + 160; +pub const SYS_sched_getscheduler: ::c_long = 4000 + 161; +pub const SYS_sched_yield: ::c_long = 4000 + 162; +pub const SYS_sched_get_priority_max: ::c_long = 4000 + 163; +pub const SYS_sched_get_priority_min: ::c_long = 4000 + 164; +pub const SYS_sched_rr_get_interval: ::c_long = 4000 + 165; +pub const SYS_nanosleep: ::c_long = 4000 + 166; +pub const SYS_mremap: ::c_long = 4000 + 167; +pub const SYS_accept: ::c_long = 4000 + 168; +pub const SYS_bind: ::c_long = 4000 + 169; +pub const SYS_connect: ::c_long = 4000 + 170; +pub const SYS_getpeername: ::c_long = 4000 + 171; +pub const SYS_getsockname: ::c_long = 4000 + 172; +pub const SYS_getsockopt: ::c_long = 4000 + 173; +pub const SYS_listen: ::c_long = 4000 + 174; +pub const SYS_recv: ::c_long = 4000 + 175; +pub const SYS_recvfrom: ::c_long = 4000 + 176; +pub const SYS_recvmsg: ::c_long = 4000 + 177; +pub const SYS_send: ::c_long = 4000 + 178; +pub const SYS_sendmsg: ::c_long = 4000 + 179; +pub const SYS_sendto: ::c_long = 4000 + 180; +pub const SYS_setsockopt: ::c_long = 4000 + 181; +pub const SYS_shutdown: ::c_long = 4000 + 182; +pub const SYS_socket: ::c_long = 4000 + 183; +pub const SYS_socketpair: ::c_long = 4000 + 184; +pub const SYS_setresuid: ::c_long = 4000 + 185; +pub const SYS_getresuid: ::c_long = 4000 + 186; +pub const SYS_query_module: ::c_long = 4000 + 187; +pub const SYS_poll: ::c_long = 4000 + 188; +pub const SYS_nfsservctl: ::c_long = 4000 + 189; +pub const SYS_setresgid: ::c_long = 4000 + 190; +pub const SYS_getresgid: ::c_long = 4000 + 191; +pub const SYS_prctl: ::c_long = 4000 + 192; +pub const SYS_rt_sigreturn: ::c_long = 4000 + 193; +pub const SYS_rt_sigaction: ::c_long = 4000 + 194; +pub const SYS_rt_sigprocmask: ::c_long = 4000 + 195; +pub const SYS_rt_sigpending: ::c_long = 4000 + 196; +pub const SYS_rt_sigtimedwait: ::c_long = 4000 + 197; +pub const SYS_rt_sigqueueinfo: ::c_long = 4000 + 198; +pub const SYS_rt_sigsuspend: ::c_long = 4000 + 199; +pub const SYS_pread64: ::c_long = 4000 + 200; +pub const SYS_pwrite64: ::c_long = 4000 + 201; +pub const SYS_chown: ::c_long = 4000 + 202; +pub const SYS_getcwd: ::c_long = 4000 + 203; +pub const SYS_capget: ::c_long = 4000 + 204; +pub const SYS_capset: ::c_long = 4000 + 205; +pub const SYS_sigaltstack: ::c_long = 4000 + 206; +pub const SYS_sendfile: ::c_long = 4000 + 207; +pub const SYS_getpmsg: ::c_long = 4000 + 208; +pub const SYS_putpmsg: ::c_long = 4000 + 209; +pub const SYS_mmap2: ::c_long = 4000 + 210; +pub const SYS_truncate64: ::c_long = 4000 + 211; +pub const SYS_ftruncate64: ::c_long = 4000 + 212; +pub const SYS_stat64: ::c_long = 4000 + 213; +pub const SYS_lstat64: ::c_long = 4000 + 214; +pub const SYS_fstat64: ::c_long = 4000 + 215; +pub const SYS_pivot_root: ::c_long = 4000 + 216; +pub const SYS_mincore: ::c_long = 4000 + 217; +pub const SYS_madvise: ::c_long = 4000 + 218; +pub const SYS_getdents64: ::c_long = 4000 + 219; +pub const SYS_fcntl64: ::c_long = 4000 + 220; +pub const SYS_gettid: ::c_long = 4000 + 222; +pub const SYS_readahead: ::c_long = 4000 + 223; +pub const SYS_setxattr: ::c_long = 4000 + 224; +pub const SYS_lsetxattr: ::c_long = 4000 + 225; +pub const SYS_fsetxattr: ::c_long = 4000 + 226; +pub const SYS_getxattr: ::c_long = 4000 + 227; +pub const SYS_lgetxattr: ::c_long = 4000 + 228; +pub const SYS_fgetxattr: ::c_long = 4000 + 229; +pub const SYS_listxattr: ::c_long = 4000 + 230; +pub const SYS_llistxattr: ::c_long = 4000 + 231; +pub const SYS_flistxattr: ::c_long = 4000 + 232; +pub const SYS_removexattr: ::c_long = 4000 + 233; +pub const SYS_lremovexattr: ::c_long = 4000 + 234; +pub const SYS_fremovexattr: ::c_long = 4000 + 235; +pub const SYS_tkill: ::c_long = 4000 + 236; +pub const SYS_sendfile64: ::c_long = 4000 + 237; +pub const SYS_futex: ::c_long = 4000 + 238; +pub const SYS_sched_setaffinity: ::c_long = 4000 + 239; +pub const SYS_sched_getaffinity: ::c_long = 4000 + 240; +pub const SYS_io_setup: ::c_long = 4000 + 241; +pub const SYS_io_destroy: ::c_long = 4000 + 242; +pub const SYS_io_getevents: ::c_long = 4000 + 243; +pub const SYS_io_submit: ::c_long = 4000 + 244; +pub const SYS_io_cancel: ::c_long = 4000 + 245; +pub const SYS_exit_group: ::c_long = 4000 + 246; +pub const SYS_lookup_dcookie: ::c_long = 4000 + 247; +pub const SYS_epoll_create: ::c_long = 4000 + 248; +pub const SYS_epoll_ctl: ::c_long = 4000 + 249; +pub const SYS_epoll_wait: ::c_long = 4000 + 250; +pub const SYS_remap_file_pages: ::c_long = 4000 + 251; +pub const SYS_set_tid_address: ::c_long = 4000 + 252; +pub const SYS_restart_syscall: ::c_long = 4000 + 253; +pub const SYS_fadvise64: ::c_long = 4000 + 254; +pub const SYS_statfs64: ::c_long = 4000 + 255; +pub const SYS_fstatfs64: ::c_long = 4000 + 256; +pub const SYS_timer_create: ::c_long = 4000 + 257; +pub const SYS_timer_settime: ::c_long = 4000 + 258; +pub const SYS_timer_gettime: ::c_long = 4000 + 259; +pub const SYS_timer_getoverrun: ::c_long = 4000 + 260; +pub const SYS_timer_delete: ::c_long = 4000 + 261; +pub const SYS_clock_settime: ::c_long = 4000 + 262; +pub const SYS_clock_gettime: ::c_long = 4000 + 263; +pub const SYS_clock_getres: ::c_long = 4000 + 264; +pub const SYS_clock_nanosleep: ::c_long = 4000 + 265; +pub const SYS_tgkill: ::c_long = 4000 + 266; +pub const SYS_utimes: ::c_long = 4000 + 267; +pub const SYS_mbind: ::c_long = 4000 + 268; +pub const SYS_get_mempolicy: ::c_long = 4000 + 269; +pub const SYS_set_mempolicy: ::c_long = 4000 + 270; +pub const SYS_mq_open: ::c_long = 4000 + 271; +pub const SYS_mq_unlink: ::c_long = 4000 + 272; +pub const SYS_mq_timedsend: ::c_long = 4000 + 273; +pub const SYS_mq_timedreceive: ::c_long = 4000 + 274; +pub const SYS_mq_notify: ::c_long = 4000 + 275; +pub const SYS_mq_getsetattr: ::c_long = 4000 + 276; +pub const SYS_vserver: ::c_long = 4000 + 277; +pub const SYS_waitid: ::c_long = 4000 + 278; +/* pub const SYS_sys_setaltroot: ::c_long = 4000 + 279; */ +pub const SYS_add_key: ::c_long = 4000 + 280; +pub const SYS_request_key: ::c_long = 4000 + 281; +pub const SYS_keyctl: ::c_long = 4000 + 282; +pub const SYS_set_thread_area: ::c_long = 4000 + 283; +pub const SYS_inotify_init: ::c_long = 4000 + 284; +pub const SYS_inotify_add_watch: ::c_long = 4000 + 285; +pub const SYS_inotify_rm_watch: ::c_long = 4000 + 286; +pub const SYS_migrate_pages: ::c_long = 4000 + 287; +pub const SYS_openat: ::c_long = 4000 + 288; +pub const SYS_mkdirat: ::c_long = 4000 + 289; +pub const SYS_mknodat: ::c_long = 4000 + 290; +pub const SYS_fchownat: ::c_long = 4000 + 291; +pub const SYS_futimesat: ::c_long = 4000 + 292; +pub const SYS_fstatat64: ::c_long = 4000 + 293; +pub const SYS_unlinkat: ::c_long = 4000 + 294; +pub const SYS_renameat: ::c_long = 4000 + 295; +pub const SYS_linkat: ::c_long = 4000 + 296; +pub const SYS_symlinkat: ::c_long = 4000 + 297; +pub const SYS_readlinkat: ::c_long = 4000 + 298; +pub const SYS_fchmodat: ::c_long = 4000 + 299; +pub const SYS_faccessat: ::c_long = 4000 + 300; +pub const SYS_pselect6: ::c_long = 4000 + 301; +pub const SYS_ppoll: ::c_long = 4000 + 302; +pub const SYS_unshare: ::c_long = 4000 + 303; +pub const SYS_splice: ::c_long = 4000 + 304; +pub const SYS_sync_file_range: ::c_long = 4000 + 305; +pub const SYS_tee: ::c_long = 4000 + 306; +pub const SYS_vmsplice: ::c_long = 4000 + 307; +pub const SYS_move_pages: ::c_long = 4000 + 308; +pub const SYS_set_robust_list: ::c_long = 4000 + 309; +pub const SYS_get_robust_list: ::c_long = 4000 + 310; +pub const SYS_kexec_load: ::c_long = 4000 + 311; +pub const SYS_getcpu: ::c_long = 4000 + 312; +pub const SYS_epoll_pwait: ::c_long = 4000 + 313; +pub const SYS_ioprio_set: ::c_long = 4000 + 314; +pub const SYS_ioprio_get: ::c_long = 4000 + 315; +pub const SYS_utimensat: ::c_long = 4000 + 316; +pub const SYS_signalfd: ::c_long = 4000 + 317; +pub const SYS_timerfd: ::c_long = 4000 + 318; +pub const SYS_eventfd: ::c_long = 4000 + 319; +pub const SYS_fallocate: ::c_long = 4000 + 320; +pub const SYS_timerfd_create: ::c_long = 4000 + 321; +pub const SYS_timerfd_gettime: ::c_long = 4000 + 322; +pub const SYS_timerfd_settime: ::c_long = 4000 + 323; +pub const SYS_signalfd4: ::c_long = 4000 + 324; +pub const SYS_eventfd2: ::c_long = 4000 + 325; +pub const SYS_epoll_create1: ::c_long = 4000 + 326; +pub const SYS_dup3: ::c_long = 4000 + 327; +pub const SYS_pipe2: ::c_long = 4000 + 328; +pub const SYS_inotify_init1: ::c_long = 4000 + 329; +pub const SYS_preadv: ::c_long = 4000 + 330; +pub const SYS_pwritev: ::c_long = 4000 + 331; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 4000 + 332; +pub const SYS_perf_event_open: ::c_long = 4000 + 333; +pub const SYS_accept4: ::c_long = 4000 + 334; +pub const SYS_recvmmsg: ::c_long = 4000 + 335; +pub const SYS_fanotify_init: ::c_long = 4000 + 336; +pub const SYS_fanotify_mark: ::c_long = 4000 + 337; +pub const SYS_prlimit64: ::c_long = 4000 + 338; +pub const SYS_name_to_handle_at: ::c_long = 4000 + 339; +pub const SYS_open_by_handle_at: ::c_long = 4000 + 340; +pub const SYS_clock_adjtime: ::c_long = 4000 + 341; +pub const SYS_syncfs: ::c_long = 4000 + 342; +pub const SYS_sendmmsg: ::c_long = 4000 + 343; +pub const SYS_setns: ::c_long = 4000 + 344; +pub const SYS_process_vm_readv: ::c_long = 4000 + 345; +pub const SYS_process_vm_writev: ::c_long = 4000 + 346; +pub const SYS_kcmp: ::c_long = 4000 + 347; +pub const SYS_finit_module: ::c_long = 4000 + 348; +pub const SYS_sched_setattr: ::c_long = 4000 + 349; +pub const SYS_sched_getattr: ::c_long = 4000 + 350; +pub const SYS_renameat2: ::c_long = 4000 + 351; +pub const SYS_seccomp: ::c_long = 4000 + 352; +pub const SYS_getrandom: ::c_long = 4000 + 353; +pub const SYS_memfd_create: ::c_long = 4000 + 354; +pub const SYS_bpf: ::c_long = 4000 + 355; +pub const SYS_execveat: ::c_long = 4000 + 356; +pub const SYS_userfaultfd: ::c_long = 4000 + 357; +pub const SYS_membarrier: ::c_long = 4000 + 358; +pub const SYS_mlock2: ::c_long = 4000 + 359; +pub const SYS_copy_file_range: ::c_long = 4000 + 360; +pub const SYS_preadv2: ::c_long = 4000 + 361; +pub const SYS_pwritev2: ::c_long = 4000 + 362; +pub const SYS_pkey_mprotect: ::c_long = 4000 + 363; +pub const SYS_pkey_alloc: ::c_long = 4000 + 364; +pub const SYS_pkey_free: ::c_long = 4000 + 365; + +pub const O_DIRECT: ::c_int = 0x8000; +pub const O_DIRECTORY: ::c_int = 0x10000; +pub const O_NOFOLLOW: ::c_int = 0x20000; + +pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff; +pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 5; +pub const RLIMIT_AS: ::__rlimit_resource_t = 6; +pub const RLIMIT_RSS: ::__rlimit_resource_t = 7; +pub const RLIMIT_NPROC: ::__rlimit_resource_t = 8; +pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 9; + +pub const O_APPEND: ::c_int = 8; +pub const O_CREAT: ::c_int = 256; +pub const O_EXCL: ::c_int = 1024; +pub const O_NOCTTY: ::c_int = 2048; +pub const O_NONBLOCK: ::c_int = 128; +pub const O_SYNC: ::c_int = 0x4010; +pub const O_RSYNC: ::c_int = 0x4010; +pub const O_DSYNC: ::c_int = 0x10; +pub const O_FSYNC: ::c_int = 0x4010; +pub const O_ASYNC: ::c_int = 0x1000; +pub const O_NDELAY: ::c_int = 0x80; + +pub const EDEADLK: ::c_int = 45; +pub const ENAMETOOLONG: ::c_int = 78; +pub const ENOLCK: ::c_int = 46; +pub const ENOSYS: ::c_int = 89; +pub const ENOTEMPTY: ::c_int = 93; +pub const ELOOP: ::c_int = 90; +pub const ENOMSG: ::c_int = 35; +pub const EIDRM: ::c_int = 36; +pub const ECHRNG: ::c_int = 37; +pub const EL2NSYNC: ::c_int = 38; +pub const EL3HLT: ::c_int = 39; +pub const EL3RST: ::c_int = 40; +pub const ELNRNG: ::c_int = 41; +pub const EUNATCH: ::c_int = 42; +pub const ENOCSI: ::c_int = 43; +pub const EL2HLT: ::c_int = 44; +pub const EBADE: ::c_int = 50; +pub const EBADR: ::c_int = 51; +pub const EXFULL: ::c_int = 52; +pub const ENOANO: ::c_int = 53; +pub const EBADRQC: ::c_int = 54; +pub const EBADSLT: ::c_int = 55; +pub const EDEADLOCK: ::c_int = 56; +pub const EMULTIHOP: ::c_int = 74; +pub const EOVERFLOW: ::c_int = 79; +pub const ENOTUNIQ: ::c_int = 80; +pub const EBADFD: ::c_int = 81; +pub const EBADMSG: ::c_int = 77; +pub const EREMCHG: ::c_int = 82; +pub const ELIBACC: ::c_int = 83; +pub const ELIBBAD: ::c_int = 84; +pub const ELIBSCN: ::c_int = 85; +pub const ELIBMAX: ::c_int = 86; +pub const ELIBEXEC: ::c_int = 87; +pub const EILSEQ: ::c_int = 88; +pub const ERESTART: ::c_int = 91; +pub const ESTRPIPE: ::c_int = 92; +pub const EUSERS: ::c_int = 94; +pub const ENOTSOCK: ::c_int = 95; +pub const EDESTADDRREQ: ::c_int = 96; +pub const EMSGSIZE: ::c_int = 97; +pub const EPROTOTYPE: ::c_int = 98; +pub const ENOPROTOOPT: ::c_int = 99; +pub const EPROTONOSUPPORT: ::c_int = 120; +pub const ESOCKTNOSUPPORT: ::c_int = 121; +pub const EOPNOTSUPP: ::c_int = 122; +pub const EPFNOSUPPORT: ::c_int = 123; +pub const EAFNOSUPPORT: ::c_int = 124; +pub const EADDRINUSE: ::c_int = 125; +pub const EADDRNOTAVAIL: ::c_int = 126; +pub const ENETDOWN: ::c_int = 127; +pub const ENETUNREACH: ::c_int = 128; +pub const ENETRESET: ::c_int = 129; +pub const ECONNABORTED: ::c_int = 130; +pub const ECONNRESET: ::c_int = 131; +pub const ENOBUFS: ::c_int = 132; +pub const EISCONN: ::c_int = 133; +pub const ENOTCONN: ::c_int = 134; +pub const ESHUTDOWN: ::c_int = 143; +pub const ETOOMANYREFS: ::c_int = 144; +pub const ETIMEDOUT: ::c_int = 145; +pub const ECONNREFUSED: ::c_int = 146; +pub const EHOSTDOWN: ::c_int = 147; +pub const EHOSTUNREACH: ::c_int = 148; +pub const EALREADY: ::c_int = 149; +pub const EINPROGRESS: ::c_int = 150; +pub const ESTALE: ::c_int = 151; +pub const EUCLEAN: ::c_int = 135; +pub const ENOTNAM: ::c_int = 137; +pub const ENAVAIL: ::c_int = 138; +pub const EISNAM: ::c_int = 139; +pub const EREMOTEIO: ::c_int = 140; +pub const EDQUOT: ::c_int = 1133; +pub const ENOMEDIUM: ::c_int = 159; +pub const EMEDIUMTYPE: ::c_int = 160; +pub const ECANCELED: ::c_int = 158; +pub const ENOKEY: ::c_int = 161; +pub const EKEYEXPIRED: ::c_int = 162; +pub const EKEYREVOKED: ::c_int = 163; +pub const EKEYREJECTED: ::c_int = 164; +pub const EOWNERDEAD: ::c_int = 165; +pub const ENOTRECOVERABLE: ::c_int = 166; +pub const ERFKILL: ::c_int = 167; + +pub const MAP_NORESERVE: ::c_int = 0x400; +pub const MAP_ANON: ::c_int = 0x800; +pub const MAP_ANONYMOUS: ::c_int = 0x800; +pub const MAP_GROWSDOWN: ::c_int = 0x1000; +pub const MAP_DENYWRITE: ::c_int = 0x2000; +pub const MAP_EXECUTABLE: ::c_int = 0x4000; +pub const MAP_LOCKED: ::c_int = 0x8000; +pub const MAP_POPULATE: ::c_int = 0x10000; +pub const MAP_NONBLOCK: ::c_int = 0x20000; +pub const MAP_STACK: ::c_int = 0x40000; + +pub const SOCK_STREAM: ::c_int = 2; +pub const SOCK_DGRAM: ::c_int = 1; + +pub const SOL_SOCKET: ::c_int = 0xffff; + +pub const SO_REUSEADDR: ::c_int = 0x0004; +pub const SO_KEEPALIVE: ::c_int = 0x0008; +pub const SO_DONTROUTE: ::c_int = 0x0010; +pub const SO_BROADCAST: ::c_int = 0x0020; +pub const SO_LINGER: ::c_int = 0x0080; +pub const SO_OOBINLINE: ::c_int = 0x0100; +pub const SO_REUSEPORT: ::c_int = 0x0200; +pub const SO_TYPE: ::c_int = 0x1008; +pub const SO_STYLE: ::c_int = SO_TYPE; +pub const SO_ERROR: ::c_int = 0x1007; +pub const SO_SNDBUF: ::c_int = 0x1001; +pub const SO_RCVBUF: ::c_int = 0x1002; +pub const SO_SNDLOWAT: ::c_int = 0x1003; +pub const SO_RCVLOWAT: ::c_int = 0x1004; +pub const SO_SNDTIMEO: ::c_int = 0x1005; +pub const SO_RCVTIMEO: ::c_int = 0x1006; +pub const SO_ACCEPTCONN: ::c_int = 0x1009; +pub const SO_PROTOCOL: ::c_int = 0x1028; +pub const SO_DOMAIN: ::c_int = 0x1029; +pub const SO_NO_CHECK: ::c_int = 11; +pub const SO_PASSCRED: ::c_int = 17; +pub const SO_PEERCRED: ::c_int = 18; +pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22; +pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23; +pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24; +pub const SO_ATTACH_FILTER: ::c_int = 26; +pub const SO_DETACH_FILTER: ::c_int = 27; +pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER; +pub const SO_PEERNAME: ::c_int = 28; +pub const SO_PEERSEC: ::c_int = 30; +pub const SO_SNDBUFFORCE: ::c_int = 31; +pub const SO_RCVBUFFORCE: ::c_int = 33; +pub const SO_PASSSEC: ::c_int = 34; +pub const SO_TIMESTAMPNS: ::c_int = 35; +pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS; + +pub const SO_WIFI_STATUS: ::c_int = 41; +pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS; +pub const SO_NOFCS: ::c_int = 43; +pub const SO_LOCK_FILTER: ::c_int = 44; +pub const SO_SELECT_ERR_QUEUE: ::c_int = 45; +pub const SO_MAX_PACING_RATE: ::c_int = 47; +pub const SO_BPF_EXTENSIONS: ::c_int = 48; +pub const SO_INCOMING_CPU: ::c_int = 49; +pub const SO_ATTACH_BPF: ::c_int = 50; +pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER; + +pub const FIOCLEX: ::c_ulong = 0x6601; +pub const FIONCLEX: ::c_ulong = 0x6602; +pub const FIONBIO: ::c_ulong = 0x667e; + +pub const SA_SIGINFO: ::c_int = 0x00000008; +pub const SA_NOCLDWAIT: ::c_int = 0x00010000; + +pub const SIGCHLD: ::c_int = 18; +pub const SIGBUS: ::c_int = 10; +pub const SIGTTIN: ::c_int = 26; +pub const SIGTTOU: ::c_int = 27; +pub const SIGXCPU: ::c_int = 30; +pub const SIGXFSZ: ::c_int = 31; +pub const SIGVTALRM: ::c_int = 28; +pub const SIGPROF: ::c_int = 29; +pub const SIGWINCH: ::c_int = 20; +pub const SIGUSR1: ::c_int = 16; +pub const SIGUSR2: ::c_int = 17; +pub const SIGCONT: ::c_int = 25; +pub const SIGSTOP: ::c_int = 23; +pub const SIGTSTP: ::c_int = 24; +pub const SIGURG: ::c_int = 21; +pub const SIGIO: ::c_int = 22; +pub const SIGSYS: ::c_int = 12; +pub const SIGPOLL: ::c_int = 22; +pub const SIGPWR: ::c_int = 19; +pub const SIG_SETMASK: ::c_int = 3; +pub const SIG_BLOCK: ::c_int = 0x1; +pub const SIG_UNBLOCK: ::c_int = 0x2; + +pub const POLLWRNORM: ::c_short = 0x004; +pub const POLLWRBAND: ::c_short = 0x100; + +pub const VEOF: usize = 16; +pub const VEOL: usize = 17; +pub const VEOL2: usize = 6; +pub const VMIN: usize = 4; +pub const IEXTEN: ::tcflag_t = 0x00000100; +pub const TOSTOP: ::tcflag_t = 0x00008000; +pub const FLUSHO: ::tcflag_t = 0x00002000; +pub const EXTPROC: ::tcflag_t = 0o200000; +pub const TCSANOW: ::c_int = 0x540e; +pub const TCSADRAIN: ::c_int = 0x540f; +pub const TCSAFLUSH: ::c_int = 0x5410; + +pub const PTRACE_GETFPXREGS: ::c_uint = 18; +pub const PTRACE_SETFPXREGS: ::c_uint = 19; + +pub const MAP_HUGETLB: ::c_int = 0x080000; + +pub const EFD_NONBLOCK: ::c_int = 0x80; + +pub const F_GETLK: ::c_int = 14; +pub const F_GETOWN: ::c_int = 23; +pub const F_SETOWN: ::c_int = 24; + +pub const SFD_NONBLOCK: ::c_int = 0x80; + +pub const TCGETS: ::c_ulong = 0x540d; +pub const TCSETS: ::c_ulong = 0x540e; +pub const TCSETSW: ::c_ulong = 0x540f; +pub const TCSETSF: ::c_ulong = 0x5410; +pub const TCGETA: ::c_ulong = 0x5401; +pub const TCSETA: ::c_ulong = 0x5402; +pub const TCSETAW: ::c_ulong = 0x5403; +pub const TCSETAF: ::c_ulong = 0x5404; +pub const TCSBRK: ::c_ulong = 0x5405; +pub const TCXONC: ::c_ulong = 0x5406; +pub const TCFLSH: ::c_ulong = 0x5407; +pub const TIOCGSOFTCAR: ::c_ulong = 0x5481; +pub const TIOCSSOFTCAR: ::c_ulong = 0x5482; +pub const TIOCINQ: ::c_ulong = 0x467f; +pub const TIOCLINUX: ::c_ulong = 0x5483; +pub const TIOCGSERIAL: ::c_ulong = 0x5484; +pub const TIOCEXCL: ::c_ulong = 0x740d; +pub const TIOCNXCL: ::c_ulong = 0x740e; +pub const TIOCSCTTY: ::c_ulong = 0x5480; +pub const TIOCGPGRP: ::c_ulong = 0x40047477; +pub const TIOCSPGRP: ::c_ulong = 0x80047476; +pub const TIOCOUTQ: ::c_ulong = 0x7472; +pub const TIOCSTI: ::c_ulong = 0x5472; +pub const TIOCGWINSZ: ::c_ulong = 0x40087468; +pub const TIOCSWINSZ: ::c_ulong = 0x80087467; +pub const TIOCMGET: ::c_ulong = 0x741d; +pub const TIOCMBIS: ::c_ulong = 0x741b; +pub const TIOCMBIC: ::c_ulong = 0x741c; +pub const TIOCMSET: ::c_ulong = 0x741a; +pub const FIONREAD: ::c_ulong = 0x467f; +pub const TIOCCONS: ::c_ulong = 0x80047478; + +pub const RTLD_DEEPBIND: ::c_int = 0x10; +pub const RTLD_GLOBAL: ::c_int = 0x4; +pub const RTLD_NOLOAD: ::c_int = 0x8; + +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; + +pub const SIGSTKSZ: ::size_t = 8192; +pub const MINSIGSTKSZ: ::size_t = 2048; +pub const CBAUD: ::tcflag_t = 0o0010017; +pub const TAB1: ::tcflag_t = 0x00000800; +pub const TAB2: ::tcflag_t = 0x00001000; +pub const TAB3: ::tcflag_t = 0x00001800; +pub const CR1: ::tcflag_t = 0x00000200; +pub const CR2: ::tcflag_t = 0x00000400; +pub const CR3: ::tcflag_t = 0x00000600; +pub const FF1: ::tcflag_t = 0x00008000; +pub const BS1: ::tcflag_t = 0x00002000; +pub const VT1: ::tcflag_t = 0x00004000; +pub const VWERASE: usize = 14; +pub const VREPRINT: usize = 12; +pub const VSUSP: usize = 10; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VDISCARD: usize = 13; +pub const VTIME: usize = 5; +pub const IXON: ::tcflag_t = 0x00000400; +pub const IXOFF: ::tcflag_t = 0x00001000; +pub const ONLCR: ::tcflag_t = 0x4; +pub const CSIZE: ::tcflag_t = 0x00000030; +pub const CS6: ::tcflag_t = 0x00000010; +pub const CS7: ::tcflag_t = 0x00000020; +pub const CS8: ::tcflag_t = 0x00000030; +pub const CSTOPB: ::tcflag_t = 0x00000040; +pub const CREAD: ::tcflag_t = 0x00000080; +pub const PARENB: ::tcflag_t = 0x00000100; +pub const PARODD: ::tcflag_t = 0x00000200; +pub const HUPCL: ::tcflag_t = 0x00000400; +pub const CLOCAL: ::tcflag_t = 0x00000800; +pub const ECHOKE: ::tcflag_t = 0x00000800; +pub const ECHOE: ::tcflag_t = 0x00000010; +pub const ECHOK: ::tcflag_t = 0x00000020; +pub const ECHONL: ::tcflag_t = 0x00000040; +pub const ECHOPRT: ::tcflag_t = 0x00000400; +pub const ECHOCTL: ::tcflag_t = 0x00000200; +pub const ISIG: ::tcflag_t = 0x00000001; +pub const ICANON: ::tcflag_t = 0x00000002; +pub const PENDIN: ::tcflag_t = 0x00004000; +pub const NOFLSH: ::tcflag_t = 0x00000080; +pub const CIBAUD: ::tcflag_t = 0o02003600000; +pub const CBAUDEX: ::tcflag_t = 0o010000; +pub const VSWTC: usize = 7; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const XTABS: ::tcflag_t = 0o014000; + +pub const B0: ::speed_t = 0o000000; +pub const B50: ::speed_t = 0o000001; +pub const B75: ::speed_t = 0o000002; +pub const B110: ::speed_t = 0o000003; +pub const B134: ::speed_t = 0o000004; +pub const B150: ::speed_t = 0o000005; +pub const B200: ::speed_t = 0o000006; +pub const B300: ::speed_t = 0o000007; +pub const B600: ::speed_t = 0o000010; +pub const B1200: ::speed_t = 0o000011; +pub const B1800: ::speed_t = 0o000012; +pub const B2400: ::speed_t = 0o000013; +pub const B4800: ::speed_t = 0o000014; +pub const B9600: ::speed_t = 0o000015; +pub const B19200: ::speed_t = 0o000016; +pub const B38400: ::speed_t = 0o000017; +pub const EXTA: ::speed_t = B19200; +pub const EXTB: ::speed_t = B38400; +pub const BOTHER: ::speed_t = 0o010000; +pub const B57600: ::speed_t = 0o010001; +pub const B115200: ::speed_t = 0o010002; +pub const B230400: ::speed_t = 0o010003; +pub const B460800: ::speed_t = 0o010004; +pub const B500000: ::speed_t = 0o010005; +pub const B576000: ::speed_t = 0o010006; +pub const B921600: ::speed_t = 0o010007; +pub const B1000000: ::speed_t = 0o010010; +pub const B1152000: ::speed_t = 0o010011; +pub const B1500000: ::speed_t = 0o010012; +pub const B2000000: ::speed_t = 0o010013; +pub const B2500000: ::speed_t = 0o010014; +pub const B3000000: ::speed_t = 0o010015; +pub const B3500000: ::speed_t = 0o010016; +pub const B4000000: ::speed_t = 0o010017; + +pub const TIOCM_ST: ::c_int = 0x010; +pub const TIOCM_SR: ::c_int = 0x020; +pub const TIOCM_CTS: ::c_int = 0x040; +pub const TIOCM_CAR: ::c_int = 0x100; +pub const TIOCM_RNG: ::c_int = 0x200; +pub const TIOCM_DSR: ::c_int = 0x400; + +pub const EHWPOISON: ::c_int = 168; diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/mod.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,267 @@ +//! 32-bit specific definitions for linux-like values + +use pthread_mutex_t; + +pub type c_long = i32; +pub type c_ulong = u32; +pub type clock_t = i32; +pub type time_t = i32; +pub type suseconds_t = i32; +pub type ino_t = u32; +pub type off_t = i32; +pub type blkcnt_t = i32; + +pub type fsblkcnt_t = ::c_ulong; +pub type fsfilcnt_t = ::c_ulong; +pub type rlim_t = c_ulong; +pub type shmatt_t = ::c_ulong; +pub type msgqnum_t = ::c_ulong; +pub type msglen_t = ::c_ulong; +pub type blksize_t = i32; +pub type nlink_t = u32; +pub type __u64 = ::c_ulonglong; +pub type __fsword_t = i32; + +s! { + pub struct stat { + #[cfg(not(target_arch = "mips"))] + pub st_dev: ::dev_t, + #[cfg(target_arch = "mips")] + pub st_dev: ::c_ulong, + + #[cfg(not(target_arch = "mips"))] + __pad1: ::c_short, + #[cfg(target_arch = "mips")] + st_pad1: [::c_long; 3], + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + #[cfg(not(target_arch = "mips"))] + pub st_rdev: ::dev_t, + #[cfg(target_arch = "mips")] + pub st_rdev: ::c_ulong, + #[cfg(not(target_arch = "mips"))] + __pad2: ::c_short, + #[cfg(target_arch = "mips")] + st_pad2: [::c_long; 2], + pub st_size: ::off_t, + #[cfg(target_arch = "mips")] + st_pad3: ::c_long, + #[cfg(not(target_arch = "mips"))] + pub st_blksize: ::blksize_t, + #[cfg(not(target_arch = "mips"))] + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + #[cfg(not(target_arch = "mips"))] + __unused4: ::c_long, + #[cfg(not(target_arch = "mips"))] + __unused5: ::c_long, + #[cfg(target_arch = "mips")] + pub st_blksize: ::blksize_t, + #[cfg(target_arch = "mips")] + pub st_blocks: ::blkcnt_t, + #[cfg(target_arch = "mips")] + st_pad5: [::c_long; 14], + } + + pub struct statvfs { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_favail: ::fsfilcnt_t, + pub f_fsid: ::c_ulong, + __f_unused: ::c_int, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct pthread_attr_t { + __size: [u32; 9] + } + + pub struct sigset_t { + __val: [::c_ulong; 32], + } + + pub struct sysinfo { + pub uptime: ::c_long, + pub loads: [::c_ulong; 3], + pub totalram: ::c_ulong, + pub freeram: ::c_ulong, + pub sharedram: ::c_ulong, + pub bufferram: ::c_ulong, + pub totalswap: ::c_ulong, + pub freeswap: ::c_ulong, + pub procs: ::c_ushort, + #[deprecated( + since = "0.2.58", + note = "This padding field might become private in the future" + )] + pub pad: ::c_ushort, + pub totalhigh: ::c_ulong, + pub freehigh: ::c_ulong, + pub mem_unit: ::c_uint, + pub _f: [::c_char; 8], + } +} + +pub const O_NOATIME: ::c_int = 0o1000000; +pub const O_PATH: ::c_int = 0o10000000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; + +pub const SO_PRIORITY: ::c_int = 12; +pub const SO_BSDCOMPAT: ::c_int = 14; +pub const SO_BINDTODEVICE: ::c_int = 25; +pub const SO_TIMESTAMP: ::c_int = 29; +pub const SO_MARK: ::c_int = 36; +pub const SO_RXQ_OVFL: ::c_int = 40; +pub const SO_PEEK_OFF: ::c_int = 42; +pub const SO_BUSY_POLL: ::c_int = 46; + +pub const SA_ONSTACK: ::c_int = 0x08000000; + +pub const PTRACE_DETACH: ::c_uint = 17; +pub const POSIX_FADV_DONTNEED: ::c_int = 4; +pub const POSIX_FADV_NOREUSE: ::c_int = 5; + +pub const F_SETLK: ::c_int = 6; +pub const F_SETLKW: ::c_int = 7; + +pub const F_RDLCK: ::c_int = 0; +pub const F_WRLCK: ::c_int = 1; +pub const F_UNLCK: ::c_int = 2; + +pub const SFD_CLOEXEC: ::c_int = 0x080000; + +pub const NCCS: usize = 32; + +pub const O_TRUNC: ::c_int = 512; + +pub const O_CLOEXEC: ::c_int = 0x80000; + +pub const EBFONT: ::c_int = 59; +pub const ENOSTR: ::c_int = 60; +pub const ENODATA: ::c_int = 61; +pub const ETIME: ::c_int = 62; +pub const ENOSR: ::c_int = 63; +pub const ENONET: ::c_int = 64; +pub const ENOPKG: ::c_int = 65; +pub const EREMOTE: ::c_int = 66; +pub const ENOLINK: ::c_int = 67; +pub const EADV: ::c_int = 68; +pub const ESRMNT: ::c_int = 69; +pub const ECOMM: ::c_int = 70; +pub const EPROTO: ::c_int = 71; +pub const EDOTDOT: ::c_int = 73; + +pub const SA_NODEFER: ::c_int = 0x40000000; +pub const SA_RESETHAND: ::c_int = 0x80000000; +pub const SA_RESTART: ::c_int = 0x10000000; +pub const SA_NOCLDSTOP: ::c_int = 0x00000001; + +pub const EPOLL_CLOEXEC: ::c_int = 0x80000; + +pub const EFD_CLOEXEC: ::c_int = 0x80000; + +pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; +pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32; +pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; +pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; + +align_const! { + #[cfg(target_endian = "little")] + pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, + ], + }; + #[cfg(target_endian = "little")] + pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, + ], + }; + #[cfg(target_endian = "little")] + pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, + ], + }; + #[cfg(target_endian = "big")] + pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, + ], + }; + #[cfg(target_endian = "big")] + pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, + 0, 0, 0, + ], + }; + #[cfg(target_endian = "big")] + pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, + 0, 0, 0, + ], + }; +} + +pub const PTRACE_GETFPREGS: ::c_uint = 14; +pub const PTRACE_SETFPREGS: ::c_uint = 15; +pub const PTRACE_GETREGS: ::c_uint = 12; +pub const PTRACE_SETREGS: ::c_uint = 13; + +#[link(name = "util")] +extern { + pub fn sysctl(name: *mut ::c_int, + namelen: ::c_int, + oldp: *mut ::c_void, + oldlenp: *mut ::size_t, + newp: *mut ::c_void, + newlen: ::size_t) + -> ::c_int; +} + +cfg_if! { + if #[cfg(target_arch = "x86")] { + mod x86; + pub use self::x86::*; + } else if #[cfg(target_arch = "arm")] { + mod arm; + pub use self::arm::*; + } else if #[cfg(target_arch = "mips")] { + mod mips; + pub use self::mips::*; + } else if #[cfg(target_arch = "powerpc")] { + mod powerpc; + pub use self::powerpc::*; + } else { + // Unknown target_arch + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/powerpc.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/powerpc.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/powerpc.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/powerpc.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,868 @@ +pub type c_char = u8; +pub type wchar_t = i32; + +s! { + pub struct sigaction { + pub sa_sigaction: ::sighandler_t, + pub sa_mask: ::sigset_t, + pub sa_flags: ::c_int, + pub sa_restorer: ::Option, + } + + pub struct statfs { + pub f_type: ::__fsword_t, + pub f_bsize: ::__fsword_t, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + + pub f_namelen: ::__fsword_t, + pub f_frsize: ::__fsword_t, + f_spare: [::__fsword_t; 5], + } + + pub struct flock { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off_t, + pub l_len: ::off_t, + pub l_pid: ::pid_t, + } + + pub struct ipc_perm { + __key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::mode_t, + __seq: u32, + __pad1: u32, + __glibc_reserved1: u64, + __glibc_reserved2: u64, + } + + pub struct stat64 { + pub st_dev: ::dev_t, + pub st_ino: ::ino64_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __pad2: ::c_ushort, + pub st_size: ::off64_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt64_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __glibc_reserved4: ::c_ulong, + __glibc_reserved5: ::c_ulong, + } + + pub struct statfs64 { + pub f_type: ::__fsword_t, + pub f_bsize: ::__fsword_t, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_fsid: ::fsid_t, + pub f_namelen: ::__fsword_t, + pub f_frsize: ::__fsword_t, + pub f_flags: ::__fsword_t, + pub f_spare: [::__fsword_t; 4], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: u64, + pub f_fsid: ::c_ulong, + __f_unused: ::c_int, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + __glibc_reserved1: ::c_uint, + pub shm_atime: ::time_t, + __glibc_reserved2: ::c_uint, + pub shm_dtime: ::time_t, + __glibc_reserved3: ::c_uint, + pub shm_ctime: ::time_t, + __glibc_reserved4: ::c_uint, + pub shm_segsz: ::size_t, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, + pub shm_nattch: ::shmatt_t, + __glibc_reserved5: ::c_ulong, + __glibc_reserved6: ::c_ulong, + } + + pub struct msqid_ds { + pub msg_perm: ::ipc_perm, + __glibc_reserved1: ::c_uint, + pub msg_stime: ::time_t, + __glibc_reserved2: ::c_uint, + pub msg_rtime: ::time_t, + __glibc_reserved3: ::c_uint, + pub msg_ctime: ::time_t, + __msg_cbytes: ::c_ulong, + pub msg_qnum: ::msgqnum_t, + pub msg_qbytes: ::msglen_t, + pub msg_lspid: ::pid_t, + pub msg_lrpid: ::pid_t, + __glibc_reserved4: ::c_ulong, + __glibc_reserved5: ::c_ulong, + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + #[doc(hidden)] + #[deprecated( + since="0.2.54", + note="Please leave a comment on \ + https://github.com/rust-lang/libc/pull/1316 if you're using \ + this field" + )] + pub _pad: [::c_int; 29], + _align: [usize; 0], + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_flags: ::c_int, + pub ss_size: ::size_t + } +} + +pub const RLIM_INFINITY: ::rlim_t = !0; +pub const VEOF: usize = 4; +pub const RTLD_DEEPBIND: ::c_int = 0x8; +pub const RTLD_GLOBAL: ::c_int = 0x100; +pub const RTLD_NOLOAD: ::c_int = 0x4; +pub const O_DIRECT: ::c_int = 0x20000; +pub const O_DIRECTORY: ::c_int = 0x4000; +pub const O_NOFOLLOW: ::c_int = 0x8000; +pub const O_LARGEFILE: ::c_int = 0o200000; +pub const O_APPEND: ::c_int = 1024; +pub const O_CREAT: ::c_int = 64; +pub const O_EXCL: ::c_int = 128; +pub const O_NOCTTY: ::c_int = 256; +pub const O_NONBLOCK: ::c_int = 2048; +pub const O_SYNC: ::c_int = 1052672; +pub const O_RSYNC: ::c_int = 1052672; +pub const O_DSYNC: ::c_int = 4096; +pub const O_FSYNC: ::c_int = 0x101000; +pub const O_ASYNC: ::c_int = 0x2000; +pub const O_NDELAY: ::c_int = 0x800; +pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7; +pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6; +pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; +pub const RLIMIT_AS: ::__rlimit_resource_t = 9; +pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; +pub const TCSANOW: ::c_int = 0; +pub const TCSADRAIN: ::c_int = 1; +pub const TCSAFLUSH: ::c_int = 2; + +pub const TIOCLINUX: ::c_ulong = 0x541C; +pub const TIOCGSERIAL: ::c_ulong = 0x541E; +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; + +pub const MADV_SOFT_OFFLINE: ::c_int = 101; +pub const MAP_LOCKED: ::c_int = 0x00080; +pub const MAP_NORESERVE: ::c_int = 0x00040; +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_ANONYMOUS: ::c_int = 0x0020; +pub const MAP_DENYWRITE: ::c_int = 0x0800; +pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_POPULATE: ::c_int = 0x08000; +pub const MAP_NONBLOCK: ::c_int = 0x010000; +pub const MAP_STACK: ::c_int = 0x020000; +pub const MAP_HUGETLB: ::c_int = 0x040000; +pub const MAP_GROWSDOWN: ::c_int = 0x0100; + +pub const SOL_SOCKET: ::c_int = 1; + +pub const EDEADLOCK: ::c_int = 58; +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; +pub const EDEADLK: ::c_int = 35; +pub const ENAMETOOLONG: ::c_int = 36; +pub const ENOLCK: ::c_int = 37; +pub const ENOSYS: ::c_int = 38; +pub const ENOTEMPTY: ::c_int = 39; +pub const ELOOP: ::c_int = 40; +pub const ENOMSG: ::c_int = 42; +pub const EIDRM: ::c_int = 43; +pub const ECHRNG: ::c_int = 44; +pub const EL2NSYNC: ::c_int = 45; +pub const EL3HLT: ::c_int = 46; +pub const EL3RST: ::c_int = 47; +pub const ELNRNG: ::c_int = 48; +pub const EUNATCH: ::c_int = 49; +pub const ENOCSI: ::c_int = 50; +pub const EL2HLT: ::c_int = 51; +pub const EBADE: ::c_int = 52; +pub const EBADR: ::c_int = 53; +pub const EXFULL: ::c_int = 54; +pub const ENOANO: ::c_int = 55; +pub const EBADRQC: ::c_int = 56; +pub const EBADSLT: ::c_int = 57; +pub const EMULTIHOP: ::c_int = 72; +pub const EOVERFLOW: ::c_int = 75; +pub const ENOTUNIQ: ::c_int = 76; +pub const EBADFD: ::c_int = 77; +pub const EBADMSG: ::c_int = 74; +pub const EREMCHG: ::c_int = 78; +pub const ELIBACC: ::c_int = 79; +pub const ELIBBAD: ::c_int = 80; +pub const ELIBSCN: ::c_int = 81; +pub const ELIBMAX: ::c_int = 82; +pub const ELIBEXEC: ::c_int = 83; +pub const EILSEQ: ::c_int = 84; +pub const ERESTART: ::c_int = 85; +pub const ESTRPIPE: ::c_int = 86; +pub const EUSERS: ::c_int = 87; +pub const ENOTSOCK: ::c_int = 88; +pub const EDESTADDRREQ: ::c_int = 89; +pub const EMSGSIZE: ::c_int = 90; +pub const EPROTOTYPE: ::c_int = 91; +pub const ENOPROTOOPT: ::c_int = 92; +pub const EPROTONOSUPPORT: ::c_int = 93; +pub const ESOCKTNOSUPPORT: ::c_int = 94; +pub const EOPNOTSUPP: ::c_int = 95; +pub const EPFNOSUPPORT: ::c_int = 96; +pub const EAFNOSUPPORT: ::c_int = 97; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const ENETDOWN: ::c_int = 100; +pub const ENETUNREACH: ::c_int = 101; +pub const ENETRESET: ::c_int = 102; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNRESET: ::c_int = 104; +pub const ENOBUFS: ::c_int = 105; +pub const EISCONN: ::c_int = 106; +pub const ENOTCONN: ::c_int = 107; +pub const ESHUTDOWN: ::c_int = 108; +pub const ETOOMANYREFS: ::c_int = 109; +pub const ETIMEDOUT: ::c_int = 110; +pub const ECONNREFUSED: ::c_int = 111; +pub const EHOSTDOWN: ::c_int = 112; +pub const EHOSTUNREACH: ::c_int = 113; +pub const EALREADY: ::c_int = 114; +pub const EINPROGRESS: ::c_int = 115; +pub const ESTALE: ::c_int = 116; +pub const EDQUOT: ::c_int = 122; +pub const ENOMEDIUM: ::c_int = 123; +pub const EMEDIUMTYPE: ::c_int = 124; +pub const ECANCELED: ::c_int = 125; +pub const ENOKEY: ::c_int = 126; +pub const EKEYEXPIRED: ::c_int = 127; +pub const EKEYREVOKED: ::c_int = 128; +pub const EKEYREJECTED: ::c_int = 129; +pub const EOWNERDEAD: ::c_int = 130; +pub const ENOTRECOVERABLE: ::c_int = 131; +pub const EHWPOISON: ::c_int = 133; +pub const ERFKILL: ::c_int = 132; + +pub const SO_REUSEADDR: ::c_int = 2; +pub const SO_TYPE: ::c_int = 3; +pub const SO_ERROR: ::c_int = 4; +pub const SO_DONTROUTE: ::c_int = 5; +pub const SO_BROADCAST: ::c_int = 6; +pub const SO_SNDBUF: ::c_int = 7; +pub const SO_RCVBUF: ::c_int = 8; +pub const SO_KEEPALIVE: ::c_int = 9; +pub const SO_OOBINLINE: ::c_int = 10; +pub const SO_LINGER: ::c_int = 13; +pub const SO_REUSEPORT: ::c_int = 15; +pub const SO_ACCEPTCONN: ::c_int = 30; +pub const SO_PROTOCOL: ::c_int = 38; +pub const SO_DOMAIN: ::c_int = 39; +pub const SO_SNDBUFFORCE: ::c_int = 32; +pub const SO_RCVBUFFORCE: ::c_int = 33; +pub const SO_NO_CHECK: ::c_int = 11; +pub const SO_RCVLOWAT: ::c_int = 16; +pub const SO_SNDLOWAT: ::c_int = 17; +pub const SO_RCVTIMEO: ::c_int = 18; +pub const SO_SNDTIMEO: ::c_int = 19; +pub const SO_PASSCRED: ::c_int = 20; +pub const SO_PEERCRED: ::c_int = 21; + +pub const SA_SIGINFO: ::c_int = 0x00000004; +pub const SA_NOCLDWAIT: ::c_int = 0x00000002; + +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; + +pub const FIOCLEX: ::c_ulong = 0x20006601; +pub const FIONCLEX: ::c_ulong = 0x20006602; +pub const FIONBIO: ::c_ulong = 0x8004667e; + +pub const MCL_CURRENT: ::c_int = 0x2000; +pub const MCL_FUTURE: ::c_int = 0x4000; + +pub const POLLWRNORM: ::c_short = 0x100; +pub const POLLWRBAND: ::c_short = 0x200; + +pub const F_GETLK: ::c_int = 5; +pub const F_GETOWN: ::c_int = 9; +pub const F_SETOWN: ::c_int = 8; + +pub const EFD_NONBLOCK: ::c_int = 0x800; +pub const SFD_NONBLOCK: ::c_int = 0x0800; + +pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; +pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; +pub const TIOCEXCL: ::c_ulong = 0x540C; +pub const TIOCNXCL: ::c_ulong = 0x540D; +pub const TIOCSCTTY: ::c_ulong = 0x540E; +pub const TIOCSTI: ::c_ulong = 0x5412; +pub const TIOCMGET: ::c_ulong = 0x5415; +pub const TIOCMBIS: ::c_ulong = 0x5416; +pub const TIOCMBIC: ::c_ulong = 0x5417; +pub const TIOCMSET: ::c_ulong = 0x5418; +pub const TIOCCONS: ::c_ulong = 0x541D; + +pub const SIGCHLD: ::c_int = 17; +pub const SIGBUS: ::c_int = 7; +pub const SIGUSR1: ::c_int = 10; +pub const SIGUSR2: ::c_int = 12; +pub const SIGCONT: ::c_int = 18; +pub const SIGSTOP: ::c_int = 19; +pub const SIGTSTP: ::c_int = 20; +pub const SIGURG: ::c_int = 23; +pub const SIGIO: ::c_int = 29; +pub const SIGSYS: ::c_int = 31; +pub const SIGSTKFLT: ::c_int = 16; +#[deprecated( + since = "0.2.55", + note = "Use SIGSYS instead" +)] +pub const SIGUNUSED: ::c_int = 31; +pub const SIGPOLL: ::c_int = 29; +pub const SIGPWR: ::c_int = 30; +pub const SIG_SETMASK: ::c_int = 2; +pub const SIG_BLOCK: ::c_int = 0x000000; +pub const SIG_UNBLOCK: ::c_int = 0x01; +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; +pub const SIGSTKSZ: ::size_t = 0x4000; +pub const MINSIGSTKSZ: ::size_t = 4096; +pub const CBAUD: ::tcflag_t = 0xff; +pub const TAB1: ::tcflag_t = 0x400; +pub const TAB2: ::tcflag_t = 0x800; +pub const TAB3: ::tcflag_t = 0xc00; +pub const CR1: ::tcflag_t = 0x1000; +pub const CR2: ::tcflag_t = 0x2000; +pub const CR3: ::tcflag_t = 0x3000; +pub const FF1: ::tcflag_t = 0x4000; +pub const BS1: ::tcflag_t = 0x8000; +pub const VT1: ::tcflag_t = 0x10000; +pub const VWERASE: usize = 0xa; +pub const VREPRINT: usize = 0xb; +pub const VSUSP: usize = 0xc; +pub const VSTART: usize = 0xd; +pub const VSTOP: usize = 0xe; +pub const VDISCARD: usize = 0x10; +pub const VTIME: usize = 0x7; +pub const IXON: ::tcflag_t = 0x200; +pub const IXOFF: ::tcflag_t = 0x400; +pub const ONLCR: ::tcflag_t = 0x2; +pub const CSIZE: ::tcflag_t = 0x300; +pub const CS6: ::tcflag_t = 0x100; +pub const CS7: ::tcflag_t = 0x200; +pub const CS8: ::tcflag_t = 0x300; +pub const CSTOPB: ::tcflag_t = 0x400; +pub const CREAD: ::tcflag_t = 0x800; +pub const PARENB: ::tcflag_t = 0x1000; +pub const PARODD: ::tcflag_t = 0x2000; +pub const HUPCL: ::tcflag_t = 0x4000; +pub const CLOCAL: ::tcflag_t = 0x8000; +pub const ECHOKE: ::tcflag_t = 0x1; +pub const ECHOE: ::tcflag_t = 0x2; +pub const ECHOK: ::tcflag_t = 0x4; +pub const ECHONL: ::tcflag_t = 0x10; +pub const ECHOPRT: ::tcflag_t = 0x20; +pub const ECHOCTL: ::tcflag_t = 0x40; +pub const ISIG: ::tcflag_t = 0x80; +pub const ICANON: ::tcflag_t = 0x100; +pub const PENDIN: ::tcflag_t = 0x20000000; +pub const NOFLSH: ::tcflag_t = 0x80000000; +pub const VSWTC: usize = 9; +pub const OLCUC: ::tcflag_t = 0o000004; +pub const NLDLY: ::tcflag_t = 0o001400; +pub const CRDLY: ::tcflag_t = 0o030000; +pub const TABDLY: ::tcflag_t = 0o006000; +pub const BSDLY: ::tcflag_t = 0o100000; +pub const FFDLY: ::tcflag_t = 0o040000; +pub const VTDLY: ::tcflag_t = 0o200000; +pub const XTABS: ::tcflag_t = 0o006000; + +pub const B0: ::speed_t = 0o000000; +pub const B50: ::speed_t = 0o000001; +pub const B75: ::speed_t = 0o000002; +pub const B110: ::speed_t = 0o000003; +pub const B134: ::speed_t = 0o000004; +pub const B150: ::speed_t = 0o000005; +pub const B200: ::speed_t = 0o000006; +pub const B300: ::speed_t = 0o000007; +pub const B600: ::speed_t = 0o000010; +pub const B1200: ::speed_t = 0o000011; +pub const B1800: ::speed_t = 0o000012; +pub const B2400: ::speed_t = 0o000013; +pub const B4800: ::speed_t = 0o000014; +pub const B9600: ::speed_t = 0o000015; +pub const B19200: ::speed_t = 0o000016; +pub const B38400: ::speed_t = 0o000017; +pub const EXTA: ::speed_t = B19200; +pub const EXTB: ::speed_t = B38400; +pub const CBAUDEX: ::speed_t = 0o000020; +pub const B57600: ::speed_t = 0o0020; +pub const B115200: ::speed_t = 0o0021; +pub const B230400: ::speed_t = 0o0022; +pub const B460800: ::speed_t = 0o0023; +pub const B500000: ::speed_t = 0o0024; +pub const B576000: ::speed_t = 0o0025; +pub const B921600: ::speed_t = 0o0026; +pub const B1000000: ::speed_t = 0o0027; +pub const B1152000: ::speed_t = 0o0030; +pub const B1500000: ::speed_t = 0o0031; +pub const B2000000: ::speed_t = 0o0032; +pub const B2500000: ::speed_t = 0o0033; +pub const B3000000: ::speed_t = 0o0034; +pub const B3500000: ::speed_t = 0o0035; +pub const B4000000: ::speed_t = 0o0036; +pub const BOTHER: ::speed_t = 0o0037; + +pub const VEOL: usize = 6; +pub const VEOL2: usize = 8; +pub const VMIN: usize = 5; +pub const IEXTEN: ::tcflag_t = 0x400; +pub const TOSTOP: ::tcflag_t = 0x400000; +pub const FLUSHO: ::tcflag_t = 0x800000; +pub const EXTPROC: ::tcflag_t = 0x10000000; +pub const TCGETS: ::c_ulong = 0x403c7413; +pub const TCSETS: ::c_ulong = 0x803c7414; +pub const TCSETSW: ::c_ulong = 0x803c7415; +pub const TCSETSF: ::c_ulong = 0x803c7416; +pub const TCGETA: ::c_ulong = 0x40147417; +pub const TCSETA: ::c_ulong = 0x80147418; +pub const TCSETAW: ::c_ulong = 0x80147419; +pub const TCSETAF: ::c_ulong = 0x8014741c; +pub const TCSBRK: ::c_ulong = 0x2000741d; +pub const TCXONC: ::c_ulong = 0x2000741e; +pub const TCFLSH: ::c_ulong = 0x2000741f; +pub const TIOCINQ: ::c_ulong = 0x4004667f; +pub const TIOCGPGRP: ::c_ulong = 0x40047477; +pub const TIOCSPGRP: ::c_ulong = 0x80047476; +pub const TIOCOUTQ: ::c_ulong = 0x40047473; +pub const TIOCGWINSZ: ::c_ulong = 0x40087468; +pub const TIOCSWINSZ: ::c_ulong = 0x80087467; +pub const TIOCGRS485: ::c_int = 0x542e; +pub const TIOCSRS485: ::c_int = 0x542f; +pub const FIONREAD: ::c_ulong = 0x4004667f; + +pub const SYS_restart_syscall: ::c_long = 0; +pub const SYS_exit: ::c_long = 1; +pub const SYS_fork: ::c_long = 2; +pub const SYS_read: ::c_long = 3; +pub const SYS_write: ::c_long = 4; +pub const SYS_open: ::c_long = 5; +pub const SYS_close: ::c_long = 6; +pub const SYS_waitpid: ::c_long = 7; +pub const SYS_creat: ::c_long = 8; +pub const SYS_link: ::c_long = 9; +pub const SYS_unlink: ::c_long = 10; +pub const SYS_execve: ::c_long = 11; +pub const SYS_chdir: ::c_long = 12; +pub const SYS_time: ::c_long = 13; +pub const SYS_mknod: ::c_long = 14; +pub const SYS_chmod: ::c_long = 15; +pub const SYS_lchown: ::c_long = 16; +pub const SYS_break: ::c_long = 17; +pub const SYS_oldstat: ::c_long = 18; +pub const SYS_lseek: ::c_long = 19; +pub const SYS_getpid: ::c_long = 20; +pub const SYS_mount: ::c_long = 21; +pub const SYS_umount: ::c_long = 22; +pub const SYS_setuid: ::c_long = 23; +pub const SYS_getuid: ::c_long = 24; +pub const SYS_stime: ::c_long = 25; +pub const SYS_ptrace: ::c_long = 26; +pub const SYS_alarm: ::c_long = 27; +pub const SYS_oldfstat: ::c_long = 28; +pub const SYS_pause: ::c_long = 29; +pub const SYS_utime: ::c_long = 30; +pub const SYS_stty: ::c_long = 31; +pub const SYS_gtty: ::c_long = 32; +pub const SYS_access: ::c_long = 33; +pub const SYS_nice: ::c_long = 34; +pub const SYS_ftime: ::c_long = 35; +pub const SYS_sync: ::c_long = 36; +pub const SYS_kill: ::c_long = 37; +pub const SYS_rename: ::c_long = 38; +pub const SYS_mkdir: ::c_long = 39; +pub const SYS_rmdir: ::c_long = 40; +pub const SYS_dup: ::c_long = 41; +pub const SYS_pipe: ::c_long = 42; +pub const SYS_times: ::c_long = 43; +pub const SYS_prof: ::c_long = 44; +pub const SYS_brk: ::c_long = 45; +pub const SYS_setgid: ::c_long = 46; +pub const SYS_getgid: ::c_long = 47; +pub const SYS_signal: ::c_long = 48; +pub const SYS_geteuid: ::c_long = 49; +pub const SYS_getegid: ::c_long = 50; +pub const SYS_acct: ::c_long = 51; +pub const SYS_umount2: ::c_long = 52; +pub const SYS_lock: ::c_long = 53; +pub const SYS_ioctl: ::c_long = 54; +pub const SYS_fcntl: ::c_long = 55; +pub const SYS_mpx: ::c_long = 56; +pub const SYS_setpgid: ::c_long = 57; +pub const SYS_ulimit: ::c_long = 58; +pub const SYS_oldolduname: ::c_long = 59; +pub const SYS_umask: ::c_long = 60; +pub const SYS_chroot: ::c_long = 61; +pub const SYS_ustat: ::c_long = 62; +pub const SYS_dup2: ::c_long = 63; +pub const SYS_getppid: ::c_long = 64; +pub const SYS_getpgrp: ::c_long = 65; +pub const SYS_setsid: ::c_long = 66; +pub const SYS_sigaction: ::c_long = 67; +pub const SYS_sgetmask: ::c_long = 68; +pub const SYS_ssetmask: ::c_long = 69; +pub const SYS_setreuid: ::c_long = 70; +pub const SYS_setregid: ::c_long = 71; +pub const SYS_sigsuspend: ::c_long = 72; +pub const SYS_sigpending: ::c_long = 73; +pub const SYS_sethostname: ::c_long = 74; +pub const SYS_setrlimit: ::c_long = 75; +pub const SYS_getrlimit: ::c_long = 76; +pub const SYS_getrusage: ::c_long = 77; +pub const SYS_gettimeofday: ::c_long = 78; +pub const SYS_settimeofday: ::c_long = 79; +pub const SYS_getgroups: ::c_long = 80; +pub const SYS_setgroups: ::c_long = 81; +pub const SYS_select: ::c_long = 82; +pub const SYS_symlink: ::c_long = 83; +pub const SYS_oldlstat: ::c_long = 84; +pub const SYS_readlink: ::c_long = 85; +pub const SYS_uselib: ::c_long = 86; +pub const SYS_swapon: ::c_long = 87; +pub const SYS_reboot: ::c_long = 88; +pub const SYS_readdir: ::c_long = 89; +pub const SYS_mmap: ::c_long = 90; +pub const SYS_munmap: ::c_long = 91; +pub const SYS_truncate: ::c_long = 92; +pub const SYS_ftruncate: ::c_long = 93; +pub const SYS_fchmod: ::c_long = 94; +pub const SYS_fchown: ::c_long = 95; +pub const SYS_getpriority: ::c_long = 96; +pub const SYS_setpriority: ::c_long = 97; +pub const SYS_profil: ::c_long = 98; +pub const SYS_statfs: ::c_long = 99; +pub const SYS_fstatfs: ::c_long = 100; +pub const SYS_ioperm: ::c_long = 101; +pub const SYS_socketcall: ::c_long = 102; +pub const SYS_syslog: ::c_long = 103; +pub const SYS_setitimer: ::c_long = 104; +pub const SYS_getitimer: ::c_long = 105; +pub const SYS_stat: ::c_long = 106; +pub const SYS_lstat: ::c_long = 107; +pub const SYS_fstat: ::c_long = 108; +pub const SYS_olduname: ::c_long = 109; +pub const SYS_iopl: ::c_long = 110; +pub const SYS_vhangup: ::c_long = 111; +pub const SYS_idle: ::c_long = 112; +pub const SYS_vm86: ::c_long = 113; +pub const SYS_wait4: ::c_long = 114; +pub const SYS_swapoff: ::c_long = 115; +pub const SYS_sysinfo: ::c_long = 116; +pub const SYS_ipc: ::c_long = 117; +pub const SYS_fsync: ::c_long = 118; +pub const SYS_sigreturn: ::c_long = 119; +pub const SYS_clone: ::c_long = 120; +pub const SYS_setdomainname: ::c_long = 121; +pub const SYS_uname: ::c_long = 122; +pub const SYS_modify_ldt: ::c_long = 123; +pub const SYS_adjtimex: ::c_long = 124; +pub const SYS_mprotect: ::c_long = 125; +pub const SYS_sigprocmask: ::c_long = 126; +pub const SYS_create_module: ::c_long = 127; +pub const SYS_init_module: ::c_long = 128; +pub const SYS_delete_module: ::c_long = 129; +pub const SYS_get_kernel_syms: ::c_long = 130; +pub const SYS_quotactl: ::c_long = 131; +pub const SYS_getpgid: ::c_long = 132; +pub const SYS_fchdir: ::c_long = 133; +pub const SYS_bdflush: ::c_long = 134; +pub const SYS_sysfs: ::c_long = 135; +pub const SYS_personality: ::c_long = 136; +pub const SYS_afs_syscall: ::c_long = 137; /* Syscall for Andrew File System */ +pub const SYS_setfsuid: ::c_long = 138; +pub const SYS_setfsgid: ::c_long = 139; +pub const SYS__llseek: ::c_long = 140; +pub const SYS_getdents: ::c_long = 141; +pub const SYS__newselect: ::c_long = 142; +pub const SYS_flock: ::c_long = 143; +pub const SYS_msync: ::c_long = 144; +pub const SYS_readv: ::c_long = 145; +pub const SYS_writev: ::c_long = 146; +pub const SYS_getsid: ::c_long = 147; +pub const SYS_fdatasync: ::c_long = 148; +pub const SYS__sysctl: ::c_long = 149; +pub const SYS_mlock: ::c_long = 150; +pub const SYS_munlock: ::c_long = 151; +pub const SYS_mlockall: ::c_long = 152; +pub const SYS_munlockall: ::c_long = 153; +pub const SYS_sched_setparam: ::c_long = 154; +pub const SYS_sched_getparam: ::c_long = 155; +pub const SYS_sched_setscheduler: ::c_long = 156; +pub const SYS_sched_getscheduler: ::c_long = 157; +pub const SYS_sched_yield: ::c_long = 158; +pub const SYS_sched_get_priority_max: ::c_long = 159; +pub const SYS_sched_get_priority_min: ::c_long = 160; +pub const SYS_sched_rr_get_interval: ::c_long = 161; +pub const SYS_nanosleep: ::c_long = 162; +pub const SYS_mremap: ::c_long = 163; +pub const SYS_setresuid: ::c_long = 164; +pub const SYS_getresuid: ::c_long = 165; +pub const SYS_query_module: ::c_long = 166; +pub const SYS_poll: ::c_long = 167; +pub const SYS_nfsservctl: ::c_long = 168; +pub const SYS_setresgid: ::c_long = 169; +pub const SYS_getresgid: ::c_long = 170; +pub const SYS_prctl: ::c_long = 171; +pub const SYS_rt_sigreturn: ::c_long = 172; +pub const SYS_rt_sigaction: ::c_long = 173; +pub const SYS_rt_sigprocmask: ::c_long = 174; +pub const SYS_rt_sigpending: ::c_long = 175; +pub const SYS_rt_sigtimedwait: ::c_long = 176; +pub const SYS_rt_sigqueueinfo: ::c_long = 177; +pub const SYS_rt_sigsuspend: ::c_long = 178; +pub const SYS_pread64: ::c_long = 179; +pub const SYS_pwrite64: ::c_long = 180; +pub const SYS_chown: ::c_long = 181; +pub const SYS_getcwd: ::c_long = 182; +pub const SYS_capget: ::c_long = 183; +pub const SYS_capset: ::c_long = 184; +pub const SYS_sigaltstack: ::c_long = 185; +pub const SYS_sendfile: ::c_long = 186; +pub const SYS_getpmsg: ::c_long = 187; /* some people actually want streams */ +pub const SYS_putpmsg: ::c_long = 188; /* some people actually want streams */ +pub const SYS_vfork: ::c_long = 189; +pub const SYS_ugetrlimit: ::c_long = 190; /* SuS compliant getrlimit */ +pub const SYS_readahead: ::c_long = 191; +pub const SYS_mmap2: ::c_long = 192; +pub const SYS_truncate64: ::c_long = 193; +pub const SYS_ftruncate64: ::c_long = 194; +pub const SYS_stat64: ::c_long = 195; +pub const SYS_lstat64: ::c_long = 196; +pub const SYS_fstat64: ::c_long = 197; +pub const SYS_pciconfig_read: ::c_long = 198; +pub const SYS_pciconfig_write: ::c_long = 199; +pub const SYS_pciconfig_iobase: ::c_long = 200; +pub const SYS_multiplexer: ::c_long = 201; +pub const SYS_getdents64: ::c_long = 202; +pub const SYS_pivot_root: ::c_long = 203; +pub const SYS_fcntl64: ::c_long = 204; +pub const SYS_madvise: ::c_long = 205; +pub const SYS_mincore: ::c_long = 206; +pub const SYS_gettid: ::c_long = 207; +pub const SYS_tkill: ::c_long = 208; +pub const SYS_setxattr: ::c_long = 209; +pub const SYS_lsetxattr: ::c_long = 210; +pub const SYS_fsetxattr: ::c_long = 211; +pub const SYS_getxattr: ::c_long = 212; +pub const SYS_lgetxattr: ::c_long = 213; +pub const SYS_fgetxattr: ::c_long = 214; +pub const SYS_listxattr: ::c_long = 215; +pub const SYS_llistxattr: ::c_long = 216; +pub const SYS_flistxattr: ::c_long = 217; +pub const SYS_removexattr: ::c_long = 218; +pub const SYS_lremovexattr: ::c_long = 219; +pub const SYS_fremovexattr: ::c_long = 220; +pub const SYS_futex: ::c_long = 221; +pub const SYS_sched_setaffinity: ::c_long = 222; +pub const SYS_sched_getaffinity: ::c_long = 223; +pub const SYS_tuxcall: ::c_long = 225; +pub const SYS_sendfile64: ::c_long = 226; +pub const SYS_io_setup: ::c_long = 227; +pub const SYS_io_destroy: ::c_long = 228; +pub const SYS_io_getevents: ::c_long = 229; +pub const SYS_io_submit: ::c_long = 230; +pub const SYS_io_cancel: ::c_long = 231; +pub const SYS_set_tid_address: ::c_long = 232; +pub const SYS_fadvise64: ::c_long = 233; +pub const SYS_exit_group: ::c_long = 234; +pub const SYS_lookup_dcookie: ::c_long = 235; +pub const SYS_epoll_create: ::c_long = 236; +pub const SYS_epoll_ctl: ::c_long = 237; +pub const SYS_epoll_wait: ::c_long = 238; +pub const SYS_remap_file_pages: ::c_long = 239; +pub const SYS_timer_create: ::c_long = 240; +pub const SYS_timer_settime: ::c_long = 241; +pub const SYS_timer_gettime: ::c_long = 242; +pub const SYS_timer_getoverrun: ::c_long = 243; +pub const SYS_timer_delete: ::c_long = 244; +pub const SYS_clock_settime: ::c_long = 245; +pub const SYS_clock_gettime: ::c_long = 246; +pub const SYS_clock_getres: ::c_long = 247; +pub const SYS_clock_nanosleep: ::c_long = 248; +pub const SYS_swapcontext: ::c_long = 249; +pub const SYS_tgkill: ::c_long = 250; +pub const SYS_utimes: ::c_long = 251; +pub const SYS_statfs64: ::c_long = 252; +pub const SYS_fstatfs64: ::c_long = 253; +pub const SYS_fadvise64_64: ::c_long = 254; +pub const SYS_rtas: ::c_long = 255; +pub const SYS_sys_debug_setcontext: ::c_long = 256; +pub const SYS_migrate_pages: ::c_long = 258; +pub const SYS_mbind: ::c_long = 259; +pub const SYS_get_mempolicy: ::c_long = 260; +pub const SYS_set_mempolicy: ::c_long = 261; +pub const SYS_mq_open: ::c_long = 262; +pub const SYS_mq_unlink: ::c_long = 263; +pub const SYS_mq_timedsend: ::c_long = 264; +pub const SYS_mq_timedreceive: ::c_long = 265; +pub const SYS_mq_notify: ::c_long = 266; +pub const SYS_mq_getsetattr: ::c_long = 267; +pub const SYS_kexec_load: ::c_long = 268; +pub const SYS_add_key: ::c_long = 269; +pub const SYS_request_key: ::c_long = 270; +pub const SYS_keyctl: ::c_long = 271; +pub const SYS_waitid: ::c_long = 272; +pub const SYS_ioprio_set: ::c_long = 273; +pub const SYS_ioprio_get: ::c_long = 274; +pub const SYS_inotify_init: ::c_long = 275; +pub const SYS_inotify_add_watch: ::c_long = 276; +pub const SYS_inotify_rm_watch: ::c_long = 277; +pub const SYS_spu_run: ::c_long = 278; +pub const SYS_spu_create: ::c_long = 279; +pub const SYS_pselect6: ::c_long = 280; +pub const SYS_ppoll: ::c_long = 281; +pub const SYS_unshare: ::c_long = 282; +pub const SYS_splice: ::c_long = 283; +pub const SYS_tee: ::c_long = 284; +pub const SYS_vmsplice: ::c_long = 285; +pub const SYS_openat: ::c_long = 286; +pub const SYS_mkdirat: ::c_long = 287; +pub const SYS_mknodat: ::c_long = 288; +pub const SYS_fchownat: ::c_long = 289; +pub const SYS_futimesat: ::c_long = 290; +pub const SYS_fstatat64: ::c_long = 291; +pub const SYS_unlinkat: ::c_long = 292; +pub const SYS_renameat: ::c_long = 293; +pub const SYS_linkat: ::c_long = 294; +pub const SYS_symlinkat: ::c_long = 295; +pub const SYS_readlinkat: ::c_long = 296; +pub const SYS_fchmodat: ::c_long = 297; +pub const SYS_faccessat: ::c_long = 298; +pub const SYS_get_robust_list: ::c_long = 299; +pub const SYS_set_robust_list: ::c_long = 300; +pub const SYS_move_pages: ::c_long = 301; +pub const SYS_getcpu: ::c_long = 302; +pub const SYS_epoll_pwait: ::c_long = 303; +pub const SYS_utimensat: ::c_long = 304; +pub const SYS_signalfd: ::c_long = 305; +pub const SYS_timerfd_create: ::c_long = 306; +pub const SYS_eventfd: ::c_long = 307; +pub const SYS_sync_file_range2: ::c_long = 308; +pub const SYS_fallocate: ::c_long = 309; +pub const SYS_subpage_prot: ::c_long = 310; +pub const SYS_timerfd_settime: ::c_long = 311; +pub const SYS_timerfd_gettime: ::c_long = 312; +pub const SYS_signalfd4: ::c_long = 313; +pub const SYS_eventfd2: ::c_long = 314; +pub const SYS_epoll_create1: ::c_long = 315; +pub const SYS_dup3: ::c_long = 316; +pub const SYS_pipe2: ::c_long = 317; +pub const SYS_inotify_init1: ::c_long = 318; +pub const SYS_perf_event_open: ::c_long = 319; +pub const SYS_preadv: ::c_long = 320; +pub const SYS_pwritev: ::c_long = 321; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 322; +pub const SYS_fanotify_init: ::c_long = 323; +pub const SYS_fanotify_mark: ::c_long = 324; +pub const SYS_prlimit64: ::c_long = 325; +pub const SYS_socket: ::c_long = 326; +pub const SYS_bind: ::c_long = 327; +pub const SYS_connect: ::c_long = 328; +pub const SYS_listen: ::c_long = 329; +pub const SYS_accept: ::c_long = 330; +pub const SYS_getsockname: ::c_long = 331; +pub const SYS_getpeername: ::c_long = 332; +pub const SYS_socketpair: ::c_long = 333; +pub const SYS_send: ::c_long = 334; +pub const SYS_sendto: ::c_long = 335; +pub const SYS_recv: ::c_long = 336; +pub const SYS_recvfrom: ::c_long = 337; +pub const SYS_shutdown: ::c_long = 338; +pub const SYS_setsockopt: ::c_long = 339; +pub const SYS_getsockopt: ::c_long = 340; +pub const SYS_sendmsg: ::c_long = 341; +pub const SYS_recvmsg: ::c_long = 342; +pub const SYS_recvmmsg: ::c_long = 343; +pub const SYS_accept4: ::c_long = 344; +pub const SYS_name_to_handle_at: ::c_long = 345; +pub const SYS_open_by_handle_at: ::c_long = 346; +pub const SYS_clock_adjtime: ::c_long = 347; +pub const SYS_syncfs: ::c_long = 348; +pub const SYS_sendmmsg: ::c_long = 349; +pub const SYS_setns: ::c_long = 350; +pub const SYS_process_vm_readv: ::c_long = 351; +pub const SYS_process_vm_writev: ::c_long = 352; +pub const SYS_finit_module: ::c_long = 353; +pub const SYS_kcmp: ::c_long = 354; +pub const SYS_sched_setattr: ::c_long = 355; +pub const SYS_sched_getattr: ::c_long = 356; +pub const SYS_renameat2: ::c_long = 357; +pub const SYS_seccomp: ::c_long = 358; +pub const SYS_getrandom: ::c_long = 359; +pub const SYS_memfd_create: ::c_long = 360; +pub const SYS_bpf: ::c_long = 361; +pub const SYS_execveat: ::c_long = 362; +pub const SYS_switch_endian: ::c_long = 363; +pub const SYS_userfaultfd: ::c_long = 364; +pub const SYS_membarrier: ::c_long = 365; +pub const SYS_mlock2: ::c_long = 378; +pub const SYS_copy_file_range: ::c_long = 379; +pub const SYS_preadv2: ::c_long = 380; +pub const SYS_pwritev2: ::c_long = 381; +pub const SYS_kexec_file_load: ::c_long = 382; +pub const SYS_statx: ::c_long = 383; diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/x86.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/x86.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/x86.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b32/x86.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,1147 @@ +pub type c_char = i8; +pub type wchar_t = i32; +pub type greg_t = i32; + +s! { + pub struct sigaction { + pub sa_sigaction: ::sighandler_t, + pub sa_mask: ::sigset_t, + pub sa_flags: ::c_int, + pub sa_restorer: ::Option, + } + + pub struct statfs { + pub f_type: ::__fsword_t, + pub f_bsize: ::__fsword_t, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + + pub f_namelen: ::__fsword_t, + pub f_frsize: ::__fsword_t, + f_spare: [::__fsword_t; 5], + } + + pub struct flock { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off_t, + pub l_len: ::off_t, + pub l_pid: ::pid_t, + } + + pub struct _libc_fpreg { + pub significand: [u16; 4], + pub exponent: u16, + } + + pub struct _libc_fpstate { + pub cw: ::c_ulong, + pub sw: ::c_ulong, + pub tag: ::c_ulong, + pub ipoff: ::c_ulong, + pub cssel: ::c_ulong, + pub dataoff: ::c_ulong, + pub datasel: ::c_ulong, + pub _st: [_libc_fpreg; 8], + pub status: ::c_ulong, + } + + pub struct user_fpregs_struct { + pub cwd: ::c_long, + pub swd: ::c_long, + pub twd: ::c_long, + pub fip: ::c_long, + pub fcs: ::c_long, + pub foo: ::c_long, + pub fos: ::c_long, + pub st_space: [::c_long; 20], + } + + pub struct user_regs_struct { + pub ebx: ::c_long, + pub ecx: ::c_long, + pub edx: ::c_long, + pub esi: ::c_long, + pub edi: ::c_long, + pub ebp: ::c_long, + pub eax: ::c_long, + pub xds: ::c_long, + pub xes: ::c_long, + pub xfs: ::c_long, + pub xgs: ::c_long, + pub orig_eax: ::c_long, + pub eip: ::c_long, + pub xcs: ::c_long, + pub eflags: ::c_long, + pub esp: ::c_long, + pub xss: ::c_long, + } + + pub struct user { + pub regs: user_regs_struct, + pub u_fpvalid: ::c_int, + pub i387: user_fpregs_struct, + pub u_tsize: ::c_ulong, + pub u_dsize: ::c_ulong, + pub u_ssize: ::c_ulong, + pub start_code: ::c_ulong, + pub start_stack: ::c_ulong, + pub signal: ::c_long, + __reserved: ::c_int, + pub u_ar0: *mut user_regs_struct, + pub u_fpstate: *mut user_fpregs_struct, + pub magic: ::c_ulong, + pub u_comm: [c_char; 32], + pub u_debugreg: [::c_int; 8], + } + + pub struct mcontext_t { + pub gregs: [greg_t; 19], + pub fpregs: *mut _libc_fpstate, + pub oldmask: ::c_ulong, + pub cr2: ::c_ulong, + } + + pub struct ipc_perm { + pub __key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::c_ushort, + __pad1: ::c_ushort, + pub __seq: ::c_ushort, + __pad2: ::c_ushort, + __unused1: ::c_ulong, + __unused2: ::c_ulong + } + + pub struct stat64 { + pub st_dev: ::dev_t, + __pad1: ::c_uint, + __st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __pad2: ::c_uint, + pub st_size: ::off64_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt64_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_ino: ::ino64_t, + } + + pub struct statfs64 { + pub f_type: ::__fsword_t, + pub f_bsize: ::__fsword_t, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_fsid: ::fsid_t, + pub f_namelen: ::__fsword_t, + pub f_frsize: ::__fsword_t, + pub f_flags: ::__fsword_t, + pub f_spare: [::__fsword_t; 4], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: u64, + pub f_fsid: ::c_ulong, + __f_unused: ::c_int, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_atime: ::time_t, + __unused1: ::c_ulong, + pub shm_dtime: ::time_t, + __unused2: ::c_ulong, + pub shm_ctime: ::time_t, + __unused3: ::c_ulong, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, + pub shm_nattch: ::shmatt_t, + __unused4: ::c_ulong, + __unused5: ::c_ulong + } + + pub struct msqid_ds { + pub msg_perm: ::ipc_perm, + pub msg_stime: ::time_t, + __glibc_reserved1: ::c_ulong, + pub msg_rtime: ::time_t, + __glibc_reserved2: ::c_ulong, + pub msg_ctime: ::time_t, + __glibc_reserved3: ::c_ulong, + __msg_cbytes: ::c_ulong, + pub msg_qnum: ::msgqnum_t, + pub msg_qbytes: ::msglen_t, + pub msg_lspid: ::pid_t, + pub msg_lrpid: ::pid_t, + __glibc_reserved4: ::c_ulong, + __glibc_reserved5: ::c_ulong, + } + + pub struct termios2 { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; 19], + pub c_ispeed: ::speed_t, + pub c_ospeed: ::speed_t, + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + #[doc(hidden)] + #[deprecated( + since="0.2.54", + note="Please leave a comment on \ + https://github.com/rust-lang/libc/pull/1316 if you're using \ + this field" + )] + pub _pad: [::c_int; 29], + _align: [usize; 0], + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_flags: ::c_int, + pub ss_size: ::size_t + } +} + +s_no_extra_traits!{ + pub struct user_fpxregs_struct { + pub cwd: ::c_ushort, + pub swd: ::c_ushort, + pub twd: ::c_ushort, + pub fop: ::c_ushort, + pub fip: ::c_long, + pub fcs: ::c_long, + pub foo: ::c_long, + pub fos: ::c_long, + pub mxcsr: ::c_long, + __reserved: ::c_long, + pub st_space: [::c_long; 32], + pub xmm_space: [::c_long; 32], + padding: [::c_long; 56], + } + + pub struct ucontext_t { + pub uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_mcontext: mcontext_t, + pub uc_sigmask: ::sigset_t, + __private: [u8; 112], + __ssp: [::c_ulong; 4], + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for user_fpxregs_struct { + fn eq(&self, other: &user_fpxregs_struct) -> bool { + self.cwd == other.cwd + && self.swd == other.swd + && self.twd == other.twd + && self.fop == other.fop + && self.fip == other.fip + && self.fcs == other.fcs + && self.foo == other.foo + && self.fos == other.fos + && self.mxcsr == other.mxcsr + // Ignore __reserved field + && self.st_space == other.st_space + && self.xmm_space == other.xmm_space + // Ignore padding field + } + } + + impl Eq for user_fpxregs_struct {} + + impl ::fmt::Debug for user_fpxregs_struct { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("user_fpxregs_struct") + .field("cwd", &self.cwd) + .field("swd", &self.swd) + .field("twd", &self.twd) + .field("fop", &self.fop) + .field("fip", &self.fip) + .field("fcs", &self.fcs) + .field("foo", &self.foo) + .field("fos", &self.fos) + .field("mxcsr", &self.mxcsr) + // Ignore __reserved field + .field("st_space", &self.st_space) + .field("xmm_space", &self.xmm_space) + // Ignore padding field + .finish() + } + } + + impl ::hash::Hash for user_fpxregs_struct { + fn hash(&self, state: &mut H) { + self.cwd.hash(state); + self.swd.hash(state); + self.twd.hash(state); + self.fop.hash(state); + self.fip.hash(state); + self.fcs.hash(state); + self.foo.hash(state); + self.fos.hash(state); + self.mxcsr.hash(state); + // Ignore __reserved field + self.st_space.hash(state); + self.xmm_space.hash(state); + // Ignore padding field + } + } + + impl PartialEq for ucontext_t { + fn eq(&self, other: &ucontext_t) -> bool { + self.uc_flags == other.uc_flags + && self.uc_link == other.uc_link + && self.uc_stack == other.uc_stack + && self.uc_mcontext == other.uc_mcontext + && self.uc_sigmask == other.uc_sigmask + // Ignore __private field + } + } + + impl Eq for ucontext_t {} + + impl ::fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ucontext_t") + .field("uc_flags", &self.uc_flags) + .field("uc_link", &self.uc_link) + .field("uc_stack", &self.uc_stack) + .field("uc_mcontext", &self.uc_mcontext) + .field("uc_sigmask", &self.uc_sigmask) + // Ignore __private field + .finish() + } + } + + impl ::hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { + self.uc_flags.hash(state); + self.uc_link.hash(state); + self.uc_stack.hash(state); + self.uc_mcontext.hash(state); + self.uc_sigmask.hash(state); + // Ignore __private field + } + } + } +} + +pub const RLIM_INFINITY: ::rlim_t = !0; +pub const VEOF: usize = 4; +pub const RTLD_DEEPBIND: ::c_int = 0x8; +pub const RTLD_GLOBAL: ::c_int = 0x100; +pub const RTLD_NOLOAD: ::c_int = 0x4; +pub const O_DIRECT: ::c_int = 0x4000; +pub const O_DIRECTORY: ::c_int = 0x10000; +pub const O_NOFOLLOW: ::c_int = 0x20000; +pub const O_LARGEFILE: ::c_int = 0o0100000; +pub const O_APPEND: ::c_int = 1024; +pub const O_CREAT: ::c_int = 64; +pub const O_EXCL: ::c_int = 128; +pub const O_NOCTTY: ::c_int = 256; +pub const O_NONBLOCK: ::c_int = 2048; +pub const O_SYNC: ::c_int = 1052672; +pub const O_RSYNC: ::c_int = 1052672; +pub const O_DSYNC: ::c_int = 4096; +pub const O_FSYNC: ::c_int = 0x101000; +pub const O_ASYNC: ::c_int = 0x2000; +pub const O_NDELAY: ::c_int = 0x800; +pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7; +pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6; +pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; +pub const RLIMIT_AS: ::__rlimit_resource_t = 9; +pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; + +pub const SOL_SOCKET: ::c_int = 1; + +pub const MADV_SOFT_OFFLINE: ::c_int = 101; +pub const MAP_LOCKED: ::c_int = 0x02000; +pub const MAP_NORESERVE: ::c_int = 0x04000; +pub const MAP_32BIT: ::c_int = 0x0040; +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_ANONYMOUS: ::c_int = 0x0020; +pub const MAP_DENYWRITE: ::c_int = 0x0800; +pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_POPULATE: ::c_int = 0x08000; +pub const MAP_NONBLOCK: ::c_int = 0x010000; +pub const MAP_STACK: ::c_int = 0x020000; +pub const MAP_HUGETLB: ::c_int = 0x040000; +pub const MAP_GROWSDOWN: ::c_int = 0x0100; + +pub const EDEADLOCK: ::c_int = 35; +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; +pub const EDEADLK: ::c_int = 35; +pub const ENAMETOOLONG: ::c_int = 36; +pub const ENOLCK: ::c_int = 37; +pub const ENOSYS: ::c_int = 38; +pub const ENOTEMPTY: ::c_int = 39; +pub const ELOOP: ::c_int = 40; +pub const ENOMSG: ::c_int = 42; +pub const EIDRM: ::c_int = 43; +pub const ECHRNG: ::c_int = 44; +pub const EL2NSYNC: ::c_int = 45; +pub const EL3HLT: ::c_int = 46; +pub const EL3RST: ::c_int = 47; +pub const ELNRNG: ::c_int = 48; +pub const EUNATCH: ::c_int = 49; +pub const ENOCSI: ::c_int = 50; +pub const EL2HLT: ::c_int = 51; +pub const EBADE: ::c_int = 52; +pub const EBADR: ::c_int = 53; +pub const EXFULL: ::c_int = 54; +pub const ENOANO: ::c_int = 55; +pub const EBADRQC: ::c_int = 56; +pub const EBADSLT: ::c_int = 57; +pub const EMULTIHOP: ::c_int = 72; +pub const EOVERFLOW: ::c_int = 75; +pub const ENOTUNIQ: ::c_int = 76; +pub const EBADFD: ::c_int = 77; +pub const EBADMSG: ::c_int = 74; +pub const EREMCHG: ::c_int = 78; +pub const ELIBACC: ::c_int = 79; +pub const ELIBBAD: ::c_int = 80; +pub const ELIBSCN: ::c_int = 81; +pub const ELIBMAX: ::c_int = 82; +pub const ELIBEXEC: ::c_int = 83; +pub const EILSEQ: ::c_int = 84; +pub const ERESTART: ::c_int = 85; +pub const ESTRPIPE: ::c_int = 86; +pub const EUSERS: ::c_int = 87; +pub const ENOTSOCK: ::c_int = 88; +pub const EDESTADDRREQ: ::c_int = 89; +pub const EMSGSIZE: ::c_int = 90; +pub const EPROTOTYPE: ::c_int = 91; +pub const ENOPROTOOPT: ::c_int = 92; +pub const EPROTONOSUPPORT: ::c_int = 93; +pub const ESOCKTNOSUPPORT: ::c_int = 94; +pub const EOPNOTSUPP: ::c_int = 95; +pub const EPFNOSUPPORT: ::c_int = 96; +pub const EAFNOSUPPORT: ::c_int = 97; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const ENETDOWN: ::c_int = 100; +pub const ENETUNREACH: ::c_int = 101; +pub const ENETRESET: ::c_int = 102; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNRESET: ::c_int = 104; +pub const ENOBUFS: ::c_int = 105; +pub const EISCONN: ::c_int = 106; +pub const ENOTCONN: ::c_int = 107; +pub const ESHUTDOWN: ::c_int = 108; +pub const ETOOMANYREFS: ::c_int = 109; +pub const ETIMEDOUT: ::c_int = 110; +pub const ECONNREFUSED: ::c_int = 111; +pub const EHOSTDOWN: ::c_int = 112; +pub const EHOSTUNREACH: ::c_int = 113; +pub const EALREADY: ::c_int = 114; +pub const EINPROGRESS: ::c_int = 115; +pub const ESTALE: ::c_int = 116; +pub const EDQUOT: ::c_int = 122; +pub const ENOMEDIUM: ::c_int = 123; +pub const EMEDIUMTYPE: ::c_int = 124; +pub const ECANCELED: ::c_int = 125; +pub const ENOKEY: ::c_int = 126; +pub const EKEYEXPIRED: ::c_int = 127; +pub const EKEYREVOKED: ::c_int = 128; +pub const EKEYREJECTED: ::c_int = 129; +pub const EOWNERDEAD: ::c_int = 130; +pub const ENOTRECOVERABLE: ::c_int = 131; +pub const EHWPOISON: ::c_int = 133; +pub const ERFKILL: ::c_int = 132; + +pub const SO_REUSEADDR: ::c_int = 2; +pub const SO_TYPE: ::c_int = 3; +pub const SO_ERROR: ::c_int = 4; +pub const SO_DONTROUTE: ::c_int = 5; +pub const SO_BROADCAST: ::c_int = 6; +pub const SO_SNDBUF: ::c_int = 7; +pub const SO_RCVBUF: ::c_int = 8; +pub const SO_KEEPALIVE: ::c_int = 9; +pub const SO_OOBINLINE: ::c_int = 10; +pub const SO_LINGER: ::c_int = 13; +pub const SO_REUSEPORT: ::c_int = 15; +pub const SO_ACCEPTCONN: ::c_int = 30; +pub const SO_PROTOCOL: ::c_int = 38; +pub const SO_DOMAIN: ::c_int = 39; +pub const SO_SNDBUFFORCE: ::c_int = 32; +pub const SO_RCVBUFFORCE: ::c_int = 33; +pub const SO_NO_CHECK: ::c_int = 11; +pub const SO_PASSCRED: ::c_int = 16; +pub const SO_PEERCRED: ::c_int = 17; +pub const SO_RCVLOWAT: ::c_int = 18; +pub const SO_SNDLOWAT: ::c_int = 19; +pub const SO_RCVTIMEO: ::c_int = 20; +pub const SO_SNDTIMEO: ::c_int = 21; + +pub const SA_SIGINFO: ::c_int = 0x00000004; +pub const SA_NOCLDWAIT: ::c_int = 0x00000002; + +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; + +pub const F_GETLK: ::c_int = 5; +pub const F_GETOWN: ::c_int = 9; +pub const F_SETOWN: ::c_int = 8; + +pub const FIOCLEX: ::c_ulong = 0x5451; +pub const FIONCLEX: ::c_ulong = 0x5450; +pub const FIONBIO: ::c_ulong = 0x5421; + +pub const PTRACE_GETFPXREGS: ::c_uint = 18; +pub const PTRACE_SETFPXREGS: ::c_uint = 19; + +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; + +pub const POLLWRNORM: ::c_short = 0x100; +pub const POLLWRBAND: ::c_short = 0x200; + +pub const EFD_NONBLOCK: ::c_int = 0x800; +pub const SFD_NONBLOCK: ::c_int = 0x0800; + +pub const SIGCHLD: ::c_int = 17; +pub const SIGBUS: ::c_int = 7; +pub const SIGUSR1: ::c_int = 10; +pub const SIGUSR2: ::c_int = 12; +pub const SIGCONT: ::c_int = 18; +pub const SIGSTOP: ::c_int = 19; +pub const SIGTSTP: ::c_int = 20; +pub const SIGURG: ::c_int = 23; +pub const SIGIO: ::c_int = 29; +pub const SIGSYS: ::c_int = 31; +pub const SIGSTKFLT: ::c_int = 16; +#[deprecated( + since = "0.2.55", + note = "Use SIGSYS instead" +)] +pub const SIGUNUSED: ::c_int = 31; +pub const SIGPOLL: ::c_int = 29; +pub const SIGPWR: ::c_int = 30; +pub const SIG_SETMASK: ::c_int = 2; +pub const SIG_BLOCK: ::c_int = 0x000000; +pub const SIG_UNBLOCK: ::c_int = 0x01; +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; +pub const SIGSTKSZ: ::size_t = 8192; +pub const MINSIGSTKSZ: ::size_t = 2048; +pub const CBAUD: ::tcflag_t = 0o0010017; +pub const TAB1: ::tcflag_t = 0x00000800; +pub const TAB2: ::tcflag_t = 0x00001000; +pub const TAB3: ::tcflag_t = 0x00001800; +pub const CR1: ::tcflag_t = 0x00000200; +pub const CR2: ::tcflag_t = 0x00000400; +pub const CR3: ::tcflag_t = 0x00000600; +pub const FF1: ::tcflag_t = 0x00008000; +pub const BS1: ::tcflag_t = 0x00002000; +pub const VT1: ::tcflag_t = 0x00004000; +pub const VWERASE: usize = 14; +pub const VREPRINT: usize = 12; +pub const VSUSP: usize = 10; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VDISCARD: usize = 13; +pub const VTIME: usize = 5; +pub const IXON: ::tcflag_t = 0x00000400; +pub const IXOFF: ::tcflag_t = 0x00001000; +pub const ONLCR: ::tcflag_t = 0x4; +pub const CSIZE: ::tcflag_t = 0x00000030; +pub const CS6: ::tcflag_t = 0x00000010; +pub const CS7: ::tcflag_t = 0x00000020; +pub const CS8: ::tcflag_t = 0x00000030; +pub const CSTOPB: ::tcflag_t = 0x00000040; +pub const CREAD: ::tcflag_t = 0x00000080; +pub const PARENB: ::tcflag_t = 0x00000100; +pub const PARODD: ::tcflag_t = 0x00000200; +pub const HUPCL: ::tcflag_t = 0x00000400; +pub const CLOCAL: ::tcflag_t = 0x00000800; +pub const ECHOKE: ::tcflag_t = 0x00000800; +pub const ECHOE: ::tcflag_t = 0x00000010; +pub const ECHOK: ::tcflag_t = 0x00000020; +pub const ECHONL: ::tcflag_t = 0x00000040; +pub const ECHOPRT: ::tcflag_t = 0x00000400; +pub const ECHOCTL: ::tcflag_t = 0x00000200; +pub const ISIG: ::tcflag_t = 0x00000001; +pub const ICANON: ::tcflag_t = 0x00000002; +pub const PENDIN: ::tcflag_t = 0x00004000; +pub const NOFLSH: ::tcflag_t = 0x00000080; +pub const CIBAUD: ::tcflag_t = 0o02003600000; +pub const CBAUDEX: ::tcflag_t = 0o010000; +pub const VSWTC: usize = 7; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const XTABS: ::tcflag_t = 0o014000; + +pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; +pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; +pub const TIOCEXCL: ::c_ulong = 0x540C; +pub const TIOCNXCL: ::c_ulong = 0x540D; +pub const TIOCSCTTY: ::c_ulong = 0x540E; +pub const TIOCSTI: ::c_ulong = 0x5412; +pub const TIOCMGET: ::c_ulong = 0x5415; +pub const TIOCMBIS: ::c_ulong = 0x5416; +pub const TIOCMBIC: ::c_ulong = 0x5417; +pub const TIOCMSET: ::c_ulong = 0x5418; +pub const TIOCCONS: ::c_ulong = 0x541D; + +pub const B0: ::speed_t = 0o000000; +pub const B50: ::speed_t = 0o000001; +pub const B75: ::speed_t = 0o000002; +pub const B110: ::speed_t = 0o000003; +pub const B134: ::speed_t = 0o000004; +pub const B150: ::speed_t = 0o000005; +pub const B200: ::speed_t = 0o000006; +pub const B300: ::speed_t = 0o000007; +pub const B600: ::speed_t = 0o000010; +pub const B1200: ::speed_t = 0o000011; +pub const B1800: ::speed_t = 0o000012; +pub const B2400: ::speed_t = 0o000013; +pub const B4800: ::speed_t = 0o000014; +pub const B9600: ::speed_t = 0o000015; +pub const B19200: ::speed_t = 0o000016; +pub const B38400: ::speed_t = 0o000017; +pub const EXTA: ::speed_t = B19200; +pub const EXTB: ::speed_t = B38400; +pub const BOTHER: ::speed_t = 0o010000; +pub const B57600: ::speed_t = 0o010001; +pub const B115200: ::speed_t = 0o010002; +pub const B230400: ::speed_t = 0o010003; +pub const B460800: ::speed_t = 0o010004; +pub const B500000: ::speed_t = 0o010005; +pub const B576000: ::speed_t = 0o010006; +pub const B921600: ::speed_t = 0o010007; +pub const B1000000: ::speed_t = 0o010010; +pub const B1152000: ::speed_t = 0o010011; +pub const B1500000: ::speed_t = 0o010012; +pub const B2000000: ::speed_t = 0o010013; +pub const B2500000: ::speed_t = 0o010014; +pub const B3000000: ::speed_t = 0o010015; +pub const B3500000: ::speed_t = 0o010016; +pub const B4000000: ::speed_t = 0o010017; + +pub const VEOL: usize = 11; +pub const VEOL2: usize = 16; +pub const VMIN: usize = 6; +pub const IEXTEN: ::tcflag_t = 0x00008000; +pub const TOSTOP: ::tcflag_t = 0x00000100; +pub const FLUSHO: ::tcflag_t = 0x00001000; +pub const EXTPROC: ::tcflag_t = 0x00010000; +pub const TCGETS: ::c_ulong = 0x5401; +pub const TCSETS: ::c_ulong = 0x5402; +pub const TCSETSW: ::c_ulong = 0x5403; +pub const TCSETSF: ::c_ulong = 0x5404; +pub const TCGETA: ::c_ulong = 0x5405; +pub const TCSETA: ::c_ulong = 0x5406; +pub const TCSETAW: ::c_ulong = 0x5407; +pub const TCSETAF: ::c_ulong = 0x5408; +pub const TCSBRK: ::c_ulong = 0x5409; +pub const TCXONC: ::c_ulong = 0x540A; +pub const TCFLSH: ::c_ulong = 0x540B; +pub const TIOCINQ: ::c_ulong = 0x541B; +pub const TIOCGPGRP: ::c_ulong = 0x540F; +pub const TIOCSPGRP: ::c_ulong = 0x5410; +pub const TIOCOUTQ: ::c_ulong = 0x5411; +pub const TIOCGWINSZ: ::c_ulong = 0x5413; +pub const TIOCSWINSZ: ::c_ulong = 0x5414; +pub const TIOCGRS485: ::c_int = 0x542E; +pub const TIOCSRS485: ::c_int = 0x542F; +pub const FIONREAD: ::c_ulong = 0x541B; + +pub const TCSANOW: ::c_int = 0; +pub const TCSADRAIN: ::c_int = 1; +pub const TCSAFLUSH: ::c_int = 2; + +pub const TIOCLINUX: ::c_ulong = 0x541C; +pub const TIOCGSERIAL: ::c_ulong = 0x541E; +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; + +// Syscall table +pub const SYS_restart_syscall: ::c_long = 0; +pub const SYS_exit: ::c_long = 1; +pub const SYS_fork: ::c_long = 2; +pub const SYS_read: ::c_long = 3; +pub const SYS_write: ::c_long = 4; +pub const SYS_open: ::c_long = 5; +pub const SYS_close: ::c_long = 6; +pub const SYS_waitpid: ::c_long = 7; +pub const SYS_creat: ::c_long = 8; +pub const SYS_link: ::c_long = 9; +pub const SYS_unlink: ::c_long = 10; +pub const SYS_execve: ::c_long = 11; +pub const SYS_chdir: ::c_long = 12; +pub const SYS_time: ::c_long = 13; +pub const SYS_mknod: ::c_long = 14; +pub const SYS_chmod: ::c_long = 15; +pub const SYS_lchown: ::c_long = 16; +pub const SYS_break: ::c_long = 17; +pub const SYS_oldstat: ::c_long = 18; +pub const SYS_lseek: ::c_long = 19; +pub const SYS_getpid: ::c_long = 20; +pub const SYS_mount: ::c_long = 21; +pub const SYS_umount: ::c_long = 22; +pub const SYS_setuid: ::c_long = 23; +pub const SYS_getuid: ::c_long = 24; +pub const SYS_stime: ::c_long = 25; +pub const SYS_ptrace: ::c_long = 26; +pub const SYS_alarm: ::c_long = 27; +pub const SYS_oldfstat: ::c_long = 28; +pub const SYS_pause: ::c_long = 29; +pub const SYS_utime: ::c_long = 30; +pub const SYS_stty: ::c_long = 31; +pub const SYS_gtty: ::c_long = 32; +pub const SYS_access: ::c_long = 33; +pub const SYS_nice: ::c_long = 34; +pub const SYS_ftime: ::c_long = 35; +pub const SYS_sync: ::c_long = 36; +pub const SYS_kill: ::c_long = 37; +pub const SYS_rename: ::c_long = 38; +pub const SYS_mkdir: ::c_long = 39; +pub const SYS_rmdir: ::c_long = 40; +pub const SYS_dup: ::c_long = 41; +pub const SYS_pipe: ::c_long = 42; +pub const SYS_times: ::c_long = 43; +pub const SYS_prof: ::c_long = 44; +pub const SYS_brk: ::c_long = 45; +pub const SYS_setgid: ::c_long = 46; +pub const SYS_getgid: ::c_long = 47; +pub const SYS_signal: ::c_long = 48; +pub const SYS_geteuid: ::c_long = 49; +pub const SYS_getegid: ::c_long = 50; +pub const SYS_acct: ::c_long = 51; +pub const SYS_umount2: ::c_long = 52; +pub const SYS_lock: ::c_long = 53; +pub const SYS_ioctl: ::c_long = 54; +pub const SYS_fcntl: ::c_long = 55; +pub const SYS_mpx: ::c_long = 56; +pub const SYS_setpgid: ::c_long = 57; +pub const SYS_ulimit: ::c_long = 58; +pub const SYS_oldolduname: ::c_long = 59; +pub const SYS_umask: ::c_long = 60; +pub const SYS_chroot: ::c_long = 61; +pub const SYS_ustat: ::c_long = 62; +pub const SYS_dup2: ::c_long = 63; +pub const SYS_getppid: ::c_long = 64; +pub const SYS_getpgrp: ::c_long = 65; +pub const SYS_setsid: ::c_long = 66; +pub const SYS_sigaction: ::c_long = 67; +pub const SYS_sgetmask: ::c_long = 68; +pub const SYS_ssetmask: ::c_long = 69; +pub const SYS_setreuid: ::c_long = 70; +pub const SYS_setregid: ::c_long = 71; +pub const SYS_sigsuspend: ::c_long = 72; +pub const SYS_sigpending: ::c_long = 73; +pub const SYS_sethostname: ::c_long = 74; +pub const SYS_setrlimit: ::c_long = 75; +pub const SYS_getrlimit: ::c_long = 76; +pub const SYS_getrusage: ::c_long = 77; +pub const SYS_gettimeofday: ::c_long = 78; +pub const SYS_settimeofday: ::c_long = 79; +pub const SYS_getgroups: ::c_long = 80; +pub const SYS_setgroups: ::c_long = 81; +pub const SYS_select: ::c_long = 82; +pub const SYS_symlink: ::c_long = 83; +pub const SYS_oldlstat: ::c_long = 84; +pub const SYS_readlink: ::c_long = 85; +pub const SYS_uselib: ::c_long = 86; +pub const SYS_swapon: ::c_long = 87; +pub const SYS_reboot: ::c_long = 88; +pub const SYS_readdir: ::c_long = 89; +pub const SYS_mmap: ::c_long = 90; +pub const SYS_munmap: ::c_long = 91; +pub const SYS_truncate: ::c_long = 92; +pub const SYS_ftruncate: ::c_long = 93; +pub const SYS_fchmod: ::c_long = 94; +pub const SYS_fchown: ::c_long = 95; +pub const SYS_getpriority: ::c_long = 96; +pub const SYS_setpriority: ::c_long = 97; +pub const SYS_profil: ::c_long = 98; +pub const SYS_statfs: ::c_long = 99; +pub const SYS_fstatfs: ::c_long = 100; +pub const SYS_ioperm: ::c_long = 101; +pub const SYS_socketcall: ::c_long = 102; +pub const SYS_syslog: ::c_long = 103; +pub const SYS_setitimer: ::c_long = 104; +pub const SYS_getitimer: ::c_long = 105; +pub const SYS_stat: ::c_long = 106; +pub const SYS_lstat: ::c_long = 107; +pub const SYS_fstat: ::c_long = 108; +pub const SYS_olduname: ::c_long = 109; +pub const SYS_iopl: ::c_long = 110; +pub const SYS_vhangup: ::c_long = 111; +pub const SYS_idle: ::c_long = 112; +pub const SYS_vm86old: ::c_long = 113; +pub const SYS_wait4: ::c_long = 114; +pub const SYS_swapoff: ::c_long = 115; +pub const SYS_sysinfo: ::c_long = 116; +pub const SYS_ipc: ::c_long = 117; +pub const SYS_fsync: ::c_long = 118; +pub const SYS_sigreturn: ::c_long = 119; +pub const SYS_clone: ::c_long = 120; +pub const SYS_setdomainname: ::c_long = 121; +pub const SYS_uname: ::c_long = 122; +pub const SYS_modify_ldt: ::c_long = 123; +pub const SYS_adjtimex: ::c_long = 124; +pub const SYS_mprotect: ::c_long = 125; +pub const SYS_sigprocmask: ::c_long = 126; +pub const SYS_create_module: ::c_long = 127; +pub const SYS_init_module: ::c_long = 128; +pub const SYS_delete_module: ::c_long = 129; +pub const SYS_get_kernel_syms: ::c_long = 130; +pub const SYS_quotactl: ::c_long = 131; +pub const SYS_getpgid: ::c_long = 132; +pub const SYS_fchdir: ::c_long = 133; +pub const SYS_bdflush: ::c_long = 134; +pub const SYS_sysfs: ::c_long = 135; +pub const SYS_personality: ::c_long = 136; +pub const SYS_afs_syscall: ::c_long = 137; +pub const SYS_setfsuid: ::c_long = 138; +pub const SYS_setfsgid: ::c_long = 139; +pub const SYS__llseek: ::c_long = 140; +pub const SYS_getdents: ::c_long = 141; +pub const SYS__newselect: ::c_long = 142; +pub const SYS_flock: ::c_long = 143; +pub const SYS_msync: ::c_long = 144; +pub const SYS_readv: ::c_long = 145; +pub const SYS_writev: ::c_long = 146; +pub const SYS_getsid: ::c_long = 147; +pub const SYS_fdatasync: ::c_long = 148; +pub const SYS__sysctl: ::c_long = 149; +pub const SYS_mlock: ::c_long = 150; +pub const SYS_munlock: ::c_long = 151; +pub const SYS_mlockall: ::c_long = 152; +pub const SYS_munlockall: ::c_long = 153; +pub const SYS_sched_setparam: ::c_long = 154; +pub const SYS_sched_getparam: ::c_long = 155; +pub const SYS_sched_setscheduler: ::c_long = 156; +pub const SYS_sched_getscheduler: ::c_long = 157; +pub const SYS_sched_yield: ::c_long = 158; +pub const SYS_sched_get_priority_max: ::c_long = 159; +pub const SYS_sched_get_priority_min: ::c_long = 160; +pub const SYS_sched_rr_get_interval: ::c_long = 161; +pub const SYS_nanosleep: ::c_long = 162; +pub const SYS_mremap: ::c_long = 163; +pub const SYS_setresuid: ::c_long = 164; +pub const SYS_getresuid: ::c_long = 165; +pub const SYS_vm86: ::c_long = 166; +pub const SYS_query_module: ::c_long = 167; +pub const SYS_poll: ::c_long = 168; +pub const SYS_nfsservctl: ::c_long = 169; +pub const SYS_setresgid: ::c_long = 170; +pub const SYS_getresgid: ::c_long = 171; +pub const SYS_prctl: ::c_long = 172; +pub const SYS_rt_sigreturn: ::c_long = 173; +pub const SYS_rt_sigaction: ::c_long = 174; +pub const SYS_rt_sigprocmask: ::c_long = 175; +pub const SYS_rt_sigpending: ::c_long = 176; +pub const SYS_rt_sigtimedwait: ::c_long = 177; +pub const SYS_rt_sigqueueinfo: ::c_long = 178; +pub const SYS_rt_sigsuspend: ::c_long = 179; +pub const SYS_pread64: ::c_long = 180; +pub const SYS_pwrite64: ::c_long = 181; +pub const SYS_chown: ::c_long = 182; +pub const SYS_getcwd: ::c_long = 183; +pub const SYS_capget: ::c_long = 184; +pub const SYS_capset: ::c_long = 185; +pub const SYS_sigaltstack: ::c_long = 186; +pub const SYS_sendfile: ::c_long = 187; +pub const SYS_getpmsg: ::c_long = 188; +pub const SYS_putpmsg: ::c_long = 189; +pub const SYS_vfork: ::c_long = 190; +pub const SYS_ugetrlimit: ::c_long = 191; +pub const SYS_mmap2: ::c_long = 192; +pub const SYS_truncate64: ::c_long = 193; +pub const SYS_ftruncate64: ::c_long = 194; +pub const SYS_stat64: ::c_long = 195; +pub const SYS_lstat64: ::c_long = 196; +pub const SYS_fstat64: ::c_long = 197; +pub const SYS_lchown32: ::c_long = 198; +pub const SYS_getuid32: ::c_long = 199; +pub const SYS_getgid32: ::c_long = 200; +pub const SYS_geteuid32: ::c_long = 201; +pub const SYS_getegid32: ::c_long = 202; +pub const SYS_setreuid32: ::c_long = 203; +pub const SYS_setregid32: ::c_long = 204; +pub const SYS_getgroups32: ::c_long = 205; +pub const SYS_setgroups32: ::c_long = 206; +pub const SYS_fchown32: ::c_long = 207; +pub const SYS_setresuid32: ::c_long = 208; +pub const SYS_getresuid32: ::c_long = 209; +pub const SYS_setresgid32: ::c_long = 210; +pub const SYS_getresgid32: ::c_long = 211; +pub const SYS_chown32: ::c_long = 212; +pub const SYS_setuid32: ::c_long = 213; +pub const SYS_setgid32: ::c_long = 214; +pub const SYS_setfsuid32: ::c_long = 215; +pub const SYS_setfsgid32: ::c_long = 216; +pub const SYS_pivot_root: ::c_long = 217; +pub const SYS_mincore: ::c_long = 218; +pub const SYS_madvise: ::c_long = 219; +pub const SYS_getdents64: ::c_long = 220; +pub const SYS_fcntl64: ::c_long = 221; +pub const SYS_gettid: ::c_long = 224; +pub const SYS_readahead: ::c_long = 225; +pub const SYS_setxattr: ::c_long = 226; +pub const SYS_lsetxattr: ::c_long = 227; +pub const SYS_fsetxattr: ::c_long = 228; +pub const SYS_getxattr: ::c_long = 229; +pub const SYS_lgetxattr: ::c_long = 230; +pub const SYS_fgetxattr: ::c_long = 231; +pub const SYS_listxattr: ::c_long = 232; +pub const SYS_llistxattr: ::c_long = 233; +pub const SYS_flistxattr: ::c_long = 234; +pub const SYS_removexattr: ::c_long = 235; +pub const SYS_lremovexattr: ::c_long = 236; +pub const SYS_fremovexattr: ::c_long = 237; +pub const SYS_tkill: ::c_long = 238; +pub const SYS_sendfile64: ::c_long = 239; +pub const SYS_futex: ::c_long = 240; +pub const SYS_sched_setaffinity: ::c_long = 241; +pub const SYS_sched_getaffinity: ::c_long = 242; +pub const SYS_set_thread_area: ::c_long = 243; +pub const SYS_get_thread_area: ::c_long = 244; +pub const SYS_io_setup: ::c_long = 245; +pub const SYS_io_destroy: ::c_long = 246; +pub const SYS_io_getevents: ::c_long = 247; +pub const SYS_io_submit: ::c_long = 248; +pub const SYS_io_cancel: ::c_long = 249; +pub const SYS_fadvise64: ::c_long = 250; +pub const SYS_exit_group: ::c_long = 252; +pub const SYS_lookup_dcookie: ::c_long = 253; +pub const SYS_epoll_create: ::c_long = 254; +pub const SYS_epoll_ctl: ::c_long = 255; +pub const SYS_epoll_wait: ::c_long = 256; +pub const SYS_remap_file_pages: ::c_long = 257; +pub const SYS_set_tid_address: ::c_long = 258; +pub const SYS_timer_create: ::c_long = 259; +pub const SYS_timer_settime: ::c_long = 260; +pub const SYS_timer_gettime: ::c_long = 261; +pub const SYS_timer_getoverrun: ::c_long = 262; +pub const SYS_timer_delete: ::c_long = 263; +pub const SYS_clock_settime: ::c_long = 264; +pub const SYS_clock_gettime: ::c_long = 265; +pub const SYS_clock_getres: ::c_long = 266; +pub const SYS_clock_nanosleep: ::c_long = 267; +pub const SYS_statfs64: ::c_long = 268; +pub const SYS_fstatfs64: ::c_long = 269; +pub const SYS_tgkill: ::c_long = 270; +pub const SYS_utimes: ::c_long = 271; +pub const SYS_fadvise64_64: ::c_long = 272; +pub const SYS_vserver: ::c_long = 273; +pub const SYS_mbind: ::c_long = 274; +pub const SYS_get_mempolicy: ::c_long = 275; +pub const SYS_set_mempolicy: ::c_long = 276; +pub const SYS_mq_open: ::c_long = 277; +pub const SYS_mq_unlink: ::c_long = 278; +pub const SYS_mq_timedsend: ::c_long = 279; +pub const SYS_mq_timedreceive: ::c_long = 280; +pub const SYS_mq_notify: ::c_long = 281; +pub const SYS_mq_getsetattr: ::c_long = 282; +pub const SYS_kexec_load: ::c_long = 283; +pub const SYS_waitid: ::c_long = 284; +pub const SYS_add_key: ::c_long = 286; +pub const SYS_request_key: ::c_long = 287; +pub const SYS_keyctl: ::c_long = 288; +pub const SYS_ioprio_set: ::c_long = 289; +pub const SYS_ioprio_get: ::c_long = 290; +pub const SYS_inotify_init: ::c_long = 291; +pub const SYS_inotify_add_watch: ::c_long = 292; +pub const SYS_inotify_rm_watch: ::c_long = 293; +pub const SYS_migrate_pages: ::c_long = 294; +pub const SYS_openat: ::c_long = 295; +pub const SYS_mkdirat: ::c_long = 296; +pub const SYS_mknodat: ::c_long = 297; +pub const SYS_fchownat: ::c_long = 298; +pub const SYS_futimesat: ::c_long = 299; +pub const SYS_fstatat64: ::c_long = 300; +pub const SYS_unlinkat: ::c_long = 301; +pub const SYS_renameat: ::c_long = 302; +pub const SYS_linkat: ::c_long = 303; +pub const SYS_symlinkat: ::c_long = 304; +pub const SYS_readlinkat: ::c_long = 305; +pub const SYS_fchmodat: ::c_long = 306; +pub const SYS_faccessat: ::c_long = 307; +pub const SYS_pselect6: ::c_long = 308; +pub const SYS_ppoll: ::c_long = 309; +pub const SYS_unshare: ::c_long = 310; +pub const SYS_set_robust_list: ::c_long = 311; +pub const SYS_get_robust_list: ::c_long = 312; +pub const SYS_splice: ::c_long = 313; +pub const SYS_sync_file_range: ::c_long = 314; +pub const SYS_tee: ::c_long = 315; +pub const SYS_vmsplice: ::c_long = 316; +pub const SYS_move_pages: ::c_long = 317; +pub const SYS_getcpu: ::c_long = 318; +pub const SYS_epoll_pwait: ::c_long = 319; +pub const SYS_utimensat: ::c_long = 320; +pub const SYS_signalfd: ::c_long = 321; +pub const SYS_timerfd_create: ::c_long = 322; +pub const SYS_eventfd: ::c_long = 323; +pub const SYS_fallocate: ::c_long = 324; +pub const SYS_timerfd_settime: ::c_long = 325; +pub const SYS_timerfd_gettime: ::c_long = 326; +pub const SYS_signalfd4: ::c_long = 327; +pub const SYS_eventfd2: ::c_long = 328; +pub const SYS_epoll_create1: ::c_long = 329; +pub const SYS_dup3: ::c_long = 330; +pub const SYS_pipe2: ::c_long = 331; +pub const SYS_inotify_init1: ::c_long = 332; +pub const SYS_preadv: ::c_long = 333; +pub const SYS_pwritev: ::c_long = 334; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 335; +pub const SYS_perf_event_open: ::c_long = 336; +pub const SYS_recvmmsg: ::c_long = 337; +pub const SYS_fanotify_init: ::c_long = 338; +pub const SYS_fanotify_mark: ::c_long = 339; +pub const SYS_prlimit64: ::c_long = 340; +pub const SYS_name_to_handle_at: ::c_long = 341; +pub const SYS_open_by_handle_at: ::c_long = 342; +pub const SYS_clock_adjtime: ::c_long = 343; +pub const SYS_syncfs: ::c_long = 344; +pub const SYS_sendmmsg: ::c_long = 345; +pub const SYS_setns: ::c_long = 346; +pub const SYS_process_vm_readv: ::c_long = 347; +pub const SYS_process_vm_writev: ::c_long = 348; +pub const SYS_kcmp: ::c_long = 349; +pub const SYS_finit_module: ::c_long = 350; +pub const SYS_sched_setattr: ::c_long = 351; +pub const SYS_sched_getattr: ::c_long = 352; +pub const SYS_renameat2: ::c_long = 353; +pub const SYS_seccomp: ::c_long = 354; +pub const SYS_getrandom: ::c_long = 355; +pub const SYS_memfd_create: ::c_long = 356; +pub const SYS_bpf: ::c_long = 357; +pub const SYS_execveat: ::c_long = 358; +pub const SYS_socket: ::c_long = 359; +pub const SYS_socketpair: ::c_long = 360; +pub const SYS_bind: ::c_long = 361; +pub const SYS_connect: ::c_long = 362; +pub const SYS_listen: ::c_long = 363; +pub const SYS_accept4: ::c_long = 364; +pub const SYS_getsockopt: ::c_long = 365; +pub const SYS_setsockopt: ::c_long = 366; +pub const SYS_getsockname: ::c_long = 367; +pub const SYS_getpeername: ::c_long = 368; +pub const SYS_sendto: ::c_long = 369; +pub const SYS_sendmsg: ::c_long = 370; +pub const SYS_recvfrom: ::c_long = 371; +pub const SYS_recvmsg: ::c_long = 372; +pub const SYS_shutdown: ::c_long = 373; +pub const SYS_userfaultfd: ::c_long = 374; +pub const SYS_membarrier: ::c_long = 375; +pub const SYS_mlock2: ::c_long = 376; +pub const SYS_copy_file_range: ::c_long = 377; +pub const SYS_preadv2: ::c_long = 378; +pub const SYS_pwritev2: ::c_long = 379; +pub const SYS_pkey_mprotect: ::c_long = 380; +pub const SYS_pkey_alloc: ::c_long = 381; +pub const SYS_pkey_free: ::c_long = 382; +pub const SYS_statx: ::c_long = 383; + +// offsets in user_regs_structs, from sys/reg.h +pub const EBX: ::c_int = 0; +pub const ECX: ::c_int = 1; +pub const EDX: ::c_int = 2; +pub const ESI: ::c_int = 3; +pub const EDI: ::c_int = 4; +pub const EBP: ::c_int = 5; +pub const EAX: ::c_int = 6; +pub const DS: ::c_int = 7; +pub const ES: ::c_int = 8; +pub const FS: ::c_int = 9; +pub const GS: ::c_int = 10; +pub const ORIG_EAX: ::c_int = 11; +pub const EIP: ::c_int = 12; +pub const CS: ::c_int = 13; +pub const EFL: ::c_int = 14; +pub const UESP: ::c_int = 15; +pub const SS: ::c_int = 16; + +// offsets in mcontext_t.gregs from sys/ucontext.h +pub const REG_GS: ::c_int = 0; +pub const REG_FS: ::c_int = 1; +pub const REG_ES: ::c_int = 2; +pub const REG_DS: ::c_int = 3; +pub const REG_EDI: ::c_int = 4; +pub const REG_ESI: ::c_int = 5; +pub const REG_EBP: ::c_int = 6; +pub const REG_ESP: ::c_int = 7; +pub const REG_EBX: ::c_int = 8; +pub const REG_EDX: ::c_int = 9; +pub const REG_ECX: ::c_int = 10; +pub const REG_EAX: ::c_int = 11; +pub const REG_TRAPNO: ::c_int = 12; +pub const REG_ERR: ::c_int = 13; +pub const REG_EIP: ::c_int = 14; +pub const REG_CS: ::c_int = 15; +pub const REG_EFL: ::c_int = 16; +pub const REG_UESP: ::c_int = 17; +pub const REG_SS: ::c_int = 18; + +extern { + pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int; + pub fn setcontext(ucp: *const ucontext_t) -> ::c_int; + pub fn makecontext(ucp: *mut ucontext_t, + func: extern fn (), + argc: ::c_int, ...); + pub fn swapcontext(uocp: *mut ucontext_t, + ucp: *const ucontext_t) -> ::c_int; +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,940 @@ +//! AArch64-specific definitions for 64-bit linux-like values + +use pthread_mutex_t; + +pub type c_long = i64; +pub type c_ulong = u64; +pub type c_char = u8; +pub type wchar_t = u32; +pub type nlink_t = u32; +pub type blksize_t = i32; +pub type suseconds_t = i64; +pub type __u64 = ::c_ulonglong; + +s! { + pub struct sigaction { + pub sa_sigaction: ::sighandler_t, + pub sa_mask: ::sigset_t, + #[cfg(target_arch = "sparc64")] + __reserved0: ::c_int, + pub sa_flags: ::c_int, + pub sa_restorer: ::Option, + } + + pub struct statfs { + pub f_type: ::__fsword_t, + pub f_bsize: ::__fsword_t, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + + pub f_namelen: ::__fsword_t, + pub f_frsize: ::__fsword_t, + f_spare: [::__fsword_t; 5], + } + + pub struct flock { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off_t, + pub l_len: ::off_t, + pub l_pid: ::pid_t, + } + + pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __pad1: ::dev_t, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + __pad2: ::c_int, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused: [::c_int; 2], + } + + pub struct stat64 { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __pad1: ::dev_t, + pub st_size: ::off64_t, + pub st_blksize: ::blksize_t, + __pad2: ::c_int, + pub st_blocks: ::blkcnt64_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused: [::c_int; 2], + } + + pub struct statfs64 { + pub f_type: ::__fsword_t, + pub f_bsize: ::__fsword_t, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_fsid: ::fsid_t, + pub f_namelen: ::__fsword_t, + pub f_frsize: ::__fsword_t, + pub f_flags: ::__fsword_t, + pub f_spare: [::__fsword_t; 4], + } + + pub struct statvfs { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_favail: ::fsfilcnt_t, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: u64, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct pthread_attr_t { + __size: [u64; 8] + } + + pub struct ipc_perm { + pub __key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::c_uint, + pub __seq: ::c_ushort, + __pad1: ::c_ushort, + __unused1: ::c_ulong, + __unused2: ::c_ulong + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_atime: ::time_t, + pub shm_dtime: ::time_t, + pub shm_ctime: ::time_t, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, + pub shm_nattch: ::shmatt_t, + __unused4: ::c_ulong, + __unused5: ::c_ulong + } + + pub struct termios2 { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; 19], + pub c_ispeed: ::speed_t, + pub c_ospeed: ::speed_t, + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + #[doc(hidden)] + #[deprecated( + since="0.2.54", + note="Please leave a comment on \ + https://github.com/rust-lang/libc/pull/1316 if you're using \ + this field" + )] + pub _pad: [::c_int; 29], + _align: [usize; 0], + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_flags: ::c_int, + pub ss_size: ::size_t + } +} + +pub const VEOF: usize = 4; +pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; + +pub const RTLD_DEEPBIND: ::c_int = 0x8; +pub const RTLD_GLOBAL: ::c_int = 0x100; +pub const RTLD_NOLOAD: ::c_int = 0x4; + +pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; +pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; +pub const TIOCGRS485: ::c_int = 0x542E; +pub const TIOCSRS485: ::c_int = 0x542F; + +pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; +pub const RLIMIT_AS: ::__rlimit_resource_t = 9; +pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; +pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7; +pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6; + +pub const O_APPEND: ::c_int = 1024; +pub const O_CREAT: ::c_int = 64; +pub const O_EXCL: ::c_int = 128; +pub const O_NOCTTY: ::c_int = 256; +pub const O_NONBLOCK: ::c_int = 2048; +pub const O_SYNC: ::c_int = 1052672; +pub const O_RSYNC: ::c_int = 1052672; +pub const O_DSYNC: ::c_int = 4096; +pub const O_FSYNC: ::c_int = 0x101000; +pub const O_NOATIME: ::c_int = 0o1000000; +pub const O_PATH: ::c_int = 0o10000000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; + +pub const MADV_SOFT_OFFLINE: ::c_int = 101; +pub const MAP_GROWSDOWN: ::c_int = 0x0100; + +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; +pub const EDEADLK: ::c_int = 35; +pub const ENAMETOOLONG: ::c_int = 36; +pub const ENOLCK: ::c_int = 37; +pub const ENOSYS: ::c_int = 38; +pub const ENOTEMPTY: ::c_int = 39; +pub const ELOOP: ::c_int = 40; +pub const ENOMSG: ::c_int = 42; +pub const EIDRM: ::c_int = 43; +pub const ECHRNG: ::c_int = 44; +pub const EL2NSYNC: ::c_int = 45; +pub const EL3HLT: ::c_int = 46; +pub const EL3RST: ::c_int = 47; +pub const ELNRNG: ::c_int = 48; +pub const EUNATCH: ::c_int = 49; +pub const ENOCSI: ::c_int = 50; +pub const EL2HLT: ::c_int = 51; +pub const EBADE: ::c_int = 52; +pub const EBADR: ::c_int = 53; +pub const EXFULL: ::c_int = 54; +pub const ENOANO: ::c_int = 55; +pub const EBADRQC: ::c_int = 56; +pub const EBADSLT: ::c_int = 57; +pub const EMULTIHOP: ::c_int = 72; +pub const EOVERFLOW: ::c_int = 75; +pub const ENOTUNIQ: ::c_int = 76; +pub const EBADFD: ::c_int = 77; +pub const EBADMSG: ::c_int = 74; +pub const EREMCHG: ::c_int = 78; +pub const ELIBACC: ::c_int = 79; +pub const ELIBBAD: ::c_int = 80; +pub const ELIBSCN: ::c_int = 81; +pub const ELIBMAX: ::c_int = 82; +pub const ELIBEXEC: ::c_int = 83; +pub const EILSEQ: ::c_int = 84; +pub const ERESTART: ::c_int = 85; +pub const ESTRPIPE: ::c_int = 86; +pub const EUSERS: ::c_int = 87; +pub const ENOTSOCK: ::c_int = 88; +pub const EDESTADDRREQ: ::c_int = 89; +pub const EMSGSIZE: ::c_int = 90; +pub const EPROTOTYPE: ::c_int = 91; +pub const ENOPROTOOPT: ::c_int = 92; +pub const EPROTONOSUPPORT: ::c_int = 93; +pub const ESOCKTNOSUPPORT: ::c_int = 94; +pub const EOPNOTSUPP: ::c_int = 95; +pub const EPFNOSUPPORT: ::c_int = 96; +pub const EAFNOSUPPORT: ::c_int = 97; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const ENETDOWN: ::c_int = 100; +pub const ENETUNREACH: ::c_int = 101; +pub const ENETRESET: ::c_int = 102; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNRESET: ::c_int = 104; +pub const ENOBUFS: ::c_int = 105; +pub const EISCONN: ::c_int = 106; +pub const ENOTCONN: ::c_int = 107; +pub const ESHUTDOWN: ::c_int = 108; +pub const ETOOMANYREFS: ::c_int = 109; +pub const ETIMEDOUT: ::c_int = 110; +pub const ECONNREFUSED: ::c_int = 111; +pub const EHOSTDOWN: ::c_int = 112; +pub const EHOSTUNREACH: ::c_int = 113; +pub const EALREADY: ::c_int = 114; +pub const EINPROGRESS: ::c_int = 115; +pub const ESTALE: ::c_int = 116; +pub const EDQUOT: ::c_int = 122; +pub const ENOMEDIUM: ::c_int = 123; +pub const EMEDIUMTYPE: ::c_int = 124; +pub const ECANCELED: ::c_int = 125; +pub const ENOKEY: ::c_int = 126; +pub const EKEYEXPIRED: ::c_int = 127; +pub const EKEYREVOKED: ::c_int = 128; +pub const EKEYREJECTED: ::c_int = 129; +pub const EOWNERDEAD: ::c_int = 130; +pub const ENOTRECOVERABLE: ::c_int = 131; +pub const EHWPOISON: ::c_int = 133; +pub const ERFKILL: ::c_int = 132; + +pub const POSIX_FADV_DONTNEED: ::c_int = 4; +pub const POSIX_FADV_NOREUSE: ::c_int = 5; + +pub const SOL_SOCKET: ::c_int = 1; + +pub const SO_REUSEADDR: ::c_int = 2; +pub const SO_TYPE: ::c_int = 3; +pub const SO_ERROR: ::c_int = 4; +pub const SO_DONTROUTE: ::c_int = 5; +pub const SO_BROADCAST: ::c_int = 6; +pub const SO_SNDBUF: ::c_int = 7; +pub const SO_RCVBUF: ::c_int = 8; +pub const SO_SNDBUFFORCE: ::c_int = 32; +pub const SO_RCVBUFFORCE: ::c_int = 33; +pub const SO_KEEPALIVE: ::c_int = 9; +pub const SO_OOBINLINE: ::c_int = 10; +pub const SO_NO_CHECK: ::c_int = 11; +pub const SO_PRIORITY: ::c_int = 12; +pub const SO_LINGER: ::c_int = 13; +pub const SO_BSDCOMPAT: ::c_int = 14; +pub const SO_REUSEPORT: ::c_int = 15; +pub const SO_PASSCRED: ::c_int = 16; +pub const SO_PEERCRED: ::c_int = 17; +pub const SO_RCVLOWAT: ::c_int = 18; +pub const SO_SNDLOWAT: ::c_int = 19; +pub const SO_RCVTIMEO: ::c_int = 20; +pub const SO_SNDTIMEO: ::c_int = 21; +pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22; +pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23; +pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24; +pub const SO_BINDTODEVICE: ::c_int = 25; +pub const SO_ATTACH_FILTER: ::c_int = 26; +pub const SO_DETACH_FILTER: ::c_int = 27; +pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER; +pub const SO_PEERNAME: ::c_int = 28; +pub const SO_TIMESTAMP: ::c_int = 29; +pub const SO_ACCEPTCONN: ::c_int = 30; +pub const SO_PEERSEC: ::c_int = 31; +pub const SO_PASSSEC: ::c_int = 34; +pub const SO_TIMESTAMPNS: ::c_int = 35; +pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS; +pub const SO_MARK: ::c_int = 36; +pub const SO_PROTOCOL: ::c_int = 38; +pub const SO_DOMAIN: ::c_int = 39; +pub const SO_RXQ_OVFL: ::c_int = 40; +pub const SO_WIFI_STATUS: ::c_int = 41; +pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS; +pub const SO_PEEK_OFF: ::c_int = 42; +pub const SO_NOFCS: ::c_int = 43; +pub const SO_LOCK_FILTER: ::c_int = 44; +pub const SO_SELECT_ERR_QUEUE: ::c_int = 45; +pub const SO_BUSY_POLL: ::c_int = 46; +pub const SO_MAX_PACING_RATE: ::c_int = 47; +pub const SO_BPF_EXTENSIONS: ::c_int = 48; +pub const SO_INCOMING_CPU: ::c_int = 49; +pub const SO_ATTACH_BPF: ::c_int = 50; +pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER; + +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; + +pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_SIGINFO: ::c_int = 0x00000004; +pub const SA_NOCLDWAIT: ::c_int = 0x00000002; + +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; +pub const SIGCHLD: ::c_int = 17; +pub const SIGBUS: ::c_int = 7; +pub const SIGUSR1: ::c_int = 10; +pub const SIGUSR2: ::c_int = 12; +pub const SIGCONT: ::c_int = 18; +pub const SIGSTOP: ::c_int = 19; +pub const SIGTSTP: ::c_int = 20; +pub const SIGURG: ::c_int = 23; +pub const SIGIO: ::c_int = 29; +pub const SIGSYS: ::c_int = 31; +pub const SIGSTKFLT: ::c_int = 16; +#[deprecated( + since = "0.2.55", + note = "Use SIGSYS instead" +)] +pub const SIGUNUSED: ::c_int = 31; +pub const SIGPOLL: ::c_int = 29; +pub const SIGPWR: ::c_int = 30; +pub const SIG_SETMASK: ::c_int = 2; +pub const SIG_BLOCK: ::c_int = 0x000000; +pub const SIG_UNBLOCK: ::c_int = 0x01; + +pub const POLLWRNORM: ::c_short = 0x100; +pub const POLLWRBAND: ::c_short = 0x200; + +pub const O_ASYNC: ::c_int = 0x2000; +pub const O_NDELAY: ::c_int = 0x800; + +pub const PTRACE_DETACH: ::c_uint = 17; + +pub const EFD_NONBLOCK: ::c_int = 0x800; + +pub const F_GETLK: ::c_int = 5; +pub const F_GETOWN: ::c_int = 9; +pub const F_SETOWN: ::c_int = 8; +pub const F_SETLK: ::c_int = 6; +pub const F_SETLKW: ::c_int = 7; + +pub const F_RDLCK: ::c_int = 0; +pub const F_WRLCK: ::c_int = 1; +pub const F_UNLCK: ::c_int = 2; + +pub const SFD_NONBLOCK: ::c_int = 0x0800; + +pub const TIOCEXCL: ::c_ulong = 0x540C; +pub const TIOCNXCL: ::c_ulong = 0x540D; +pub const TIOCSCTTY: ::c_ulong = 0x540E; +pub const TIOCSTI: ::c_ulong = 0x5412; +pub const TIOCMGET: ::c_ulong = 0x5415; +pub const TIOCMBIS: ::c_ulong = 0x5416; +pub const TIOCMBIC: ::c_ulong = 0x5417; +pub const TIOCMSET: ::c_ulong = 0x5418; +pub const TIOCCONS: ::c_ulong = 0x541D; + +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; + +pub const SFD_CLOEXEC: ::c_int = 0x080000; + +pub const NCCS: usize = 32; + +pub const O_TRUNC: ::c_int = 512; + +pub const O_CLOEXEC: ::c_int = 0x80000; + +pub const EBFONT: ::c_int = 59; +pub const ENOSTR: ::c_int = 60; +pub const ENODATA: ::c_int = 61; +pub const ETIME: ::c_int = 62; +pub const ENOSR: ::c_int = 63; +pub const ENONET: ::c_int = 64; +pub const ENOPKG: ::c_int = 65; +pub const EREMOTE: ::c_int = 66; +pub const ENOLINK: ::c_int = 67; +pub const EADV: ::c_int = 68; +pub const ESRMNT: ::c_int = 69; +pub const ECOMM: ::c_int = 70; +pub const EPROTO: ::c_int = 71; +pub const EDOTDOT: ::c_int = 73; + +pub const SA_NODEFER: ::c_int = 0x40000000; +pub const SA_RESETHAND: ::c_int = 0x80000000; +pub const SA_RESTART: ::c_int = 0x10000000; +pub const SA_NOCLDSTOP: ::c_int = 0x00000001; + +pub const EPOLL_CLOEXEC: ::c_int = 0x80000; + +pub const EFD_CLOEXEC: ::c_int = 0x80000; + +pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 8; +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 48; +pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 8; + +align_const! { + pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 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, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + ], + }; + pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 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, + ], + }; + pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 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, + ], + }; +} + +pub const O_DIRECT: ::c_int = 0x10000; +pub const O_DIRECTORY: ::c_int = 0x4000; +pub const O_NOFOLLOW: ::c_int = 0x8000; + +pub const MAP_LOCKED: ::c_int = 0x02000; +pub const MAP_NORESERVE: ::c_int = 0x04000; +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_ANONYMOUS: ::c_int = 0x0020; +pub const MAP_DENYWRITE: ::c_int = 0x0800; +pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_POPULATE: ::c_int = 0x08000; +pub const MAP_NONBLOCK: ::c_int = 0x010000; +pub const MAP_STACK: ::c_int = 0x020000; +pub const MAP_HUGETLB: ::c_int = 0x040000; + +pub const EDEADLOCK: ::c_int = 35; + +pub const FIOCLEX: ::c_ulong = 0x5451; +pub const FIONCLEX: ::c_ulong = 0x5450; +pub const FIONBIO: ::c_ulong = 0x5421; + +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; + +pub const SIGSTKSZ: ::size_t = 16384; +pub const MINSIGSTKSZ: ::size_t = 5120; +pub const CBAUD: ::tcflag_t = 0o0010017; +pub const TAB1: ::tcflag_t = 0x00000800; +pub const TAB2: ::tcflag_t = 0x00001000; +pub const TAB3: ::tcflag_t = 0x00001800; +pub const CR1: ::tcflag_t = 0x00000200; +pub const CR2: ::tcflag_t = 0x00000400; +pub const CR3: ::tcflag_t = 0x00000600; +pub const FF1: ::tcflag_t = 0x00008000; +pub const BS1: ::tcflag_t = 0x00002000; +pub const VT1: ::tcflag_t = 0x00004000; +pub const VWERASE: usize = 14; +pub const VREPRINT: usize = 12; +pub const VSUSP: usize = 10; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VDISCARD: usize = 13; +pub const VTIME: usize = 5; +pub const IXON: ::tcflag_t = 0x00000400; +pub const IXOFF: ::tcflag_t = 0x00001000; +pub const ONLCR: ::tcflag_t = 0x4; +pub const CSIZE: ::tcflag_t = 0x00000030; +pub const CS6: ::tcflag_t = 0x00000010; +pub const CS7: ::tcflag_t = 0x00000020; +pub const CS8: ::tcflag_t = 0x00000030; +pub const CSTOPB: ::tcflag_t = 0x00000040; +pub const CREAD: ::tcflag_t = 0x00000080; +pub const PARENB: ::tcflag_t = 0x00000100; +pub const PARODD: ::tcflag_t = 0x00000200; +pub const HUPCL: ::tcflag_t = 0x00000400; +pub const CLOCAL: ::tcflag_t = 0x00000800; +pub const ECHOKE: ::tcflag_t = 0x00000800; +pub const ECHOE: ::tcflag_t = 0x00000010; +pub const ECHOK: ::tcflag_t = 0x00000020; +pub const ECHONL: ::tcflag_t = 0x00000040; +pub const ECHOPRT: ::tcflag_t = 0x00000400; +pub const ECHOCTL: ::tcflag_t = 0x00000200; +pub const ISIG: ::tcflag_t = 0x00000001; +pub const ICANON: ::tcflag_t = 0x00000002; +pub const PENDIN: ::tcflag_t = 0x00004000; +pub const NOFLSH: ::tcflag_t = 0x00000080; +pub const CIBAUD: ::tcflag_t = 0o02003600000; +pub const CBAUDEX: ::tcflag_t = 0o010000; +pub const VSWTC: usize = 7; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const XTABS: ::tcflag_t = 0o014000; + +pub const B0: ::speed_t = 0o000000; +pub const B50: ::speed_t = 0o000001; +pub const B75: ::speed_t = 0o000002; +pub const B110: ::speed_t = 0o000003; +pub const B134: ::speed_t = 0o000004; +pub const B150: ::speed_t = 0o000005; +pub const B200: ::speed_t = 0o000006; +pub const B300: ::speed_t = 0o000007; +pub const B600: ::speed_t = 0o000010; +pub const B1200: ::speed_t = 0o000011; +pub const B1800: ::speed_t = 0o000012; +pub const B2400: ::speed_t = 0o000013; +pub const B4800: ::speed_t = 0o000014; +pub const B9600: ::speed_t = 0o000015; +pub const B19200: ::speed_t = 0o000016; +pub const B38400: ::speed_t = 0o000017; +pub const EXTA: ::speed_t = B19200; +pub const EXTB: ::speed_t = B38400; +pub const BOTHER: ::speed_t = 0o010000; +pub const B57600: ::speed_t = 0o010001; +pub const B115200: ::speed_t = 0o010002; +pub const B230400: ::speed_t = 0o010003; +pub const B460800: ::speed_t = 0o010004; +pub const B500000: ::speed_t = 0o010005; +pub const B576000: ::speed_t = 0o010006; +pub const B921600: ::speed_t = 0o010007; +pub const B1000000: ::speed_t = 0o010010; +pub const B1152000: ::speed_t = 0o010011; +pub const B1500000: ::speed_t = 0o010012; +pub const B2000000: ::speed_t = 0o010013; +pub const B2500000: ::speed_t = 0o010014; +pub const B3000000: ::speed_t = 0o010015; +pub const B3500000: ::speed_t = 0o010016; +pub const B4000000: ::speed_t = 0o010017; + +pub const VEOL: usize = 11; +pub const VEOL2: usize = 16; +pub const VMIN: usize = 6; +pub const IEXTEN: ::tcflag_t = 0x00008000; +pub const TOSTOP: ::tcflag_t = 0x00000100; +pub const FLUSHO: ::tcflag_t = 0x00001000; +pub const EXTPROC: ::tcflag_t = 0x00010000; +pub const TCGETS: ::c_ulong = 0x5401; +pub const TCSETS: ::c_ulong = 0x5402; +pub const TCSETSW: ::c_ulong = 0x5403; +pub const TCSETSF: ::c_ulong = 0x5404; +pub const TCGETA: ::c_ulong = 0x5405; +pub const TCSETA: ::c_ulong = 0x5406; +pub const TCSETAW: ::c_ulong = 0x5407; +pub const TCSETAF: ::c_ulong = 0x5408; +pub const TCSBRK: ::c_ulong = 0x5409; +pub const TCXONC: ::c_ulong = 0x540A; +pub const TCFLSH: ::c_ulong = 0x540B; +pub const TIOCINQ: ::c_ulong = 0x541B; +pub const TIOCGPGRP: ::c_ulong = 0x540F; +pub const TIOCSPGRP: ::c_ulong = 0x5410; +pub const TIOCOUTQ: ::c_ulong = 0x5411; +pub const TIOCGWINSZ: ::c_ulong = 0x5413; +pub const TIOCSWINSZ: ::c_ulong = 0x5414; +pub const FIONREAD: ::c_ulong = 0x541B; + +pub const TCSANOW: ::c_int = 0; +pub const TCSADRAIN: ::c_int = 1; +pub const TCSAFLUSH: ::c_int = 2; + +pub const TIOCLINUX: ::c_ulong = 0x541C; +pub const TIOCGSERIAL: ::c_ulong = 0x541E; + +// Syscall table +pub const SYS_io_setup: ::c_long = 0; +pub const SYS_io_destroy: ::c_long = 1; +pub const SYS_io_submit: ::c_long = 2; +pub const SYS_io_cancel: ::c_long = 3; +pub const SYS_io_getevents: ::c_long = 4; +pub const SYS_setxattr: ::c_long = 5; +pub const SYS_lsetxattr: ::c_long = 6; +pub const SYS_fsetxattr: ::c_long = 7; +pub const SYS_getxattr: ::c_long = 8; +pub const SYS_lgetxattr: ::c_long = 9; +pub const SYS_fgetxattr: ::c_long = 10; +pub const SYS_listxattr: ::c_long = 11; +pub const SYS_llistxattr: ::c_long = 12; +pub const SYS_flistxattr: ::c_long = 13; +pub const SYS_removexattr: ::c_long = 14; +pub const SYS_lremovexattr: ::c_long = 15; +pub const SYS_fremovexattr: ::c_long = 16; +pub const SYS_getcwd: ::c_long = 17; +pub const SYS_lookup_dcookie: ::c_long = 18; +pub const SYS_eventfd2: ::c_long = 19; +pub const SYS_epoll_create1: ::c_long = 20; +pub const SYS_epoll_ctl: ::c_long = 21; +pub const SYS_epoll_pwait: ::c_long = 22; +pub const SYS_dup: ::c_long = 23; +pub const SYS_dup3: ::c_long = 24; +pub const SYS_fcntl: ::c_long = 25; +pub const SYS_inotify_init1: ::c_long = 26; +pub const SYS_inotify_add_watch: ::c_long = 27; +pub const SYS_inotify_rm_watch: ::c_long = 28; +pub const SYS_ioctl: ::c_long = 29; +pub const SYS_ioprio_set: ::c_long = 30; +pub const SYS_ioprio_get: ::c_long = 31; +pub const SYS_flock: ::c_long = 32; +pub const SYS_mknodat: ::c_long = 33; +pub const SYS_mkdirat: ::c_long = 34; +pub const SYS_unlinkat: ::c_long = 35; +pub const SYS_symlinkat: ::c_long = 36; +pub const SYS_linkat: ::c_long = 37; +pub const SYS_renameat: ::c_long = 38; +pub const SYS_umount2: ::c_long = 39; +pub const SYS_mount: ::c_long = 40; +pub const SYS_pivot_root: ::c_long = 41; +pub const SYS_nfsservctl: ::c_long = 42; +pub const SYS_fallocate: ::c_long = 47; +pub const SYS_faccessat: ::c_long = 48; +pub const SYS_chdir: ::c_long = 49; +pub const SYS_fchdir: ::c_long = 50; +pub const SYS_chroot: ::c_long = 51; +pub const SYS_fchmod: ::c_long = 52; +pub const SYS_fchmodat: ::c_long = 53; +pub const SYS_fchownat: ::c_long = 54; +pub const SYS_fchown: ::c_long = 55; +pub const SYS_openat: ::c_long = 56; +pub const SYS_close: ::c_long = 57; +pub const SYS_vhangup: ::c_long = 58; +pub const SYS_pipe2: ::c_long = 59; +pub const SYS_quotactl: ::c_long = 60; +pub const SYS_getdents64: ::c_long = 61; +pub const SYS_lseek: ::c_long = 62; +pub const SYS_read: ::c_long = 63; +pub const SYS_write: ::c_long = 64; +pub const SYS_readv: ::c_long = 65; +pub const SYS_writev: ::c_long = 66; +pub const SYS_pread64: ::c_long = 67; +pub const SYS_pwrite64: ::c_long = 68; +pub const SYS_preadv: ::c_long = 69; +pub const SYS_pwritev: ::c_long = 70; +pub const SYS_pselect6: ::c_long = 72; +pub const SYS_ppoll: ::c_long = 73; +pub const SYS_signalfd4: ::c_long = 74; +pub const SYS_vmsplice: ::c_long = 75; +pub const SYS_splice: ::c_long = 76; +pub const SYS_tee: ::c_long = 77; +pub const SYS_readlinkat: ::c_long = 78; +pub const SYS_newfstatat: ::c_long = 79; +pub const SYS_fstat: ::c_long = 80; +pub const SYS_sync: ::c_long = 81; +pub const SYS_fsync: ::c_long = 82; +pub const SYS_fdatasync: ::c_long = 83; +pub const SYS_sync_file_range: ::c_long = 84; +pub const SYS_timerfd_create: ::c_long = 85; +pub const SYS_timerfd_settime: ::c_long = 86; +pub const SYS_timerfd_gettime: ::c_long = 87; +pub const SYS_utimensat: ::c_long = 88; +pub const SYS_acct: ::c_long = 89; +pub const SYS_capget: ::c_long = 90; +pub const SYS_capset: ::c_long = 91; +pub const SYS_personality: ::c_long = 92; +pub const SYS_exit: ::c_long = 93; +pub const SYS_exit_group: ::c_long = 94; +pub const SYS_waitid: ::c_long = 95; +pub const SYS_set_tid_address: ::c_long = 96; +pub const SYS_unshare: ::c_long = 97; +pub const SYS_futex: ::c_long = 98; +pub const SYS_set_robust_list: ::c_long = 99; +pub const SYS_get_robust_list: ::c_long = 100; +pub const SYS_nanosleep: ::c_long = 101; +pub const SYS_getitimer: ::c_long = 102; +pub const SYS_setitimer: ::c_long = 103; +pub const SYS_kexec_load: ::c_long = 104; +pub const SYS_init_module: ::c_long = 105; +pub const SYS_delete_module: ::c_long = 106; +pub const SYS_timer_create: ::c_long = 107; +pub const SYS_timer_gettime: ::c_long = 108; +pub const SYS_timer_getoverrun: ::c_long = 109; +pub const SYS_timer_settime: ::c_long = 110; +pub const SYS_timer_delete: ::c_long = 111; +pub const SYS_clock_settime: ::c_long = 112; +pub const SYS_clock_gettime: ::c_long = 113; +pub const SYS_clock_getres: ::c_long = 114; +pub const SYS_clock_nanosleep: ::c_long = 115; +pub const SYS_syslog: ::c_long = 116; +pub const SYS_ptrace: ::c_long = 117; +pub const SYS_sched_setparam: ::c_long = 118; +pub const SYS_sched_setscheduler: ::c_long = 119; +pub const SYS_sched_getscheduler: ::c_long = 120; +pub const SYS_sched_getparam: ::c_long = 121; +pub const SYS_sched_setaffinity: ::c_long = 122; +pub const SYS_sched_getaffinity: ::c_long = 123; +pub const SYS_sched_yield: ::c_long = 124; +pub const SYS_sched_get_priority_max: ::c_long = 125; +pub const SYS_sched_get_priority_min: ::c_long = 126; +pub const SYS_sched_rr_get_interval: ::c_long = 127; +pub const SYS_restart_syscall: ::c_long = 128; +pub const SYS_kill: ::c_long = 129; +pub const SYS_tkill: ::c_long = 130; +pub const SYS_tgkill: ::c_long = 131; +pub const SYS_sigaltstack: ::c_long = 132; +pub const SYS_rt_sigsuspend: ::c_long = 133; +pub const SYS_rt_sigaction: ::c_long = 134; +pub const SYS_rt_sigprocmask: ::c_long = 135; +pub const SYS_rt_sigpending: ::c_long = 136; +pub const SYS_rt_sigtimedwait: ::c_long = 137; +pub const SYS_rt_sigqueueinfo: ::c_long = 138; +pub const SYS_rt_sigreturn: ::c_long = 139; +pub const SYS_setpriority: ::c_long = 140; +pub const SYS_getpriority: ::c_long = 141; +pub const SYS_reboot: ::c_long = 142; +pub const SYS_setregid: ::c_long = 143; +pub const SYS_setgid: ::c_long = 144; +pub const SYS_setreuid: ::c_long = 145; +pub const SYS_setuid: ::c_long = 146; +pub const SYS_setresuid: ::c_long = 147; +pub const SYS_getresuid: ::c_long = 148; +pub const SYS_setresgid: ::c_long = 149; +pub const SYS_getresgid: ::c_long = 150; +pub const SYS_setfsuid: ::c_long = 151; +pub const SYS_setfsgid: ::c_long = 152; +pub const SYS_times: ::c_long = 153; +pub const SYS_setpgid: ::c_long = 154; +pub const SYS_getpgid: ::c_long = 155; +pub const SYS_getsid: ::c_long = 156; +pub const SYS_setsid: ::c_long = 157; +pub const SYS_getgroups: ::c_long = 158; +pub const SYS_setgroups: ::c_long = 159; +pub const SYS_uname: ::c_long = 160; +pub const SYS_sethostname: ::c_long = 161; +pub const SYS_setdomainname: ::c_long = 162; +pub const SYS_getrlimit: ::c_long = 163; +pub const SYS_setrlimit: ::c_long = 164; +pub const SYS_getrusage: ::c_long = 165; +pub const SYS_umask: ::c_long = 166; +pub const SYS_prctl: ::c_long = 167; +pub const SYS_getcpu: ::c_long = 168; +pub const SYS_gettimeofday: ::c_long = 169; +pub const SYS_settimeofday: ::c_long = 170; +pub const SYS_adjtimex: ::c_long = 171; +pub const SYS_getpid: ::c_long = 172; +pub const SYS_getppid: ::c_long = 173; +pub const SYS_getuid: ::c_long = 174; +pub const SYS_geteuid: ::c_long = 175; +pub const SYS_getgid: ::c_long = 176; +pub const SYS_getegid: ::c_long = 177; +pub const SYS_gettid: ::c_long = 178; +pub const SYS_sysinfo: ::c_long = 179; +pub const SYS_mq_open: ::c_long = 180; +pub const SYS_mq_unlink: ::c_long = 181; +pub const SYS_mq_timedsend: ::c_long = 182; +pub const SYS_mq_timedreceive: ::c_long = 183; +pub const SYS_mq_notify: ::c_long = 184; +pub const SYS_mq_getsetattr: ::c_long = 185; +pub const SYS_msgget: ::c_long = 186; +pub const SYS_msgctl: ::c_long = 187; +pub const SYS_msgrcv: ::c_long = 188; +pub const SYS_msgsnd: ::c_long = 189; +pub const SYS_semget: ::c_long = 190; +pub const SYS_semctl: ::c_long = 191; +pub const SYS_semtimedop: ::c_long = 192; +pub const SYS_semop: ::c_long = 193; +pub const SYS_shmget: ::c_long = 194; +pub const SYS_shmctl: ::c_long = 195; +pub const SYS_shmat: ::c_long = 196; +pub const SYS_shmdt: ::c_long = 197; +pub const SYS_socket: ::c_long = 198; +pub const SYS_socketpair: ::c_long = 199; +pub const SYS_bind: ::c_long = 200; +pub const SYS_listen: ::c_long = 201; +pub const SYS_accept: ::c_long = 202; +pub const SYS_connect: ::c_long = 203; +pub const SYS_getsockname: ::c_long = 204; +pub const SYS_getpeername: ::c_long = 205; +pub const SYS_sendto: ::c_long = 206; +pub const SYS_recvfrom: ::c_long = 207; +pub const SYS_setsockopt: ::c_long = 208; +pub const SYS_getsockopt: ::c_long = 209; +pub const SYS_shutdown: ::c_long = 210; +pub const SYS_sendmsg: ::c_long = 211; +pub const SYS_recvmsg: ::c_long = 212; +pub const SYS_readahead: ::c_long = 213; +pub const SYS_brk: ::c_long = 214; +pub const SYS_munmap: ::c_long = 215; +pub const SYS_mremap: ::c_long = 216; +pub const SYS_add_key: ::c_long = 217; +pub const SYS_request_key: ::c_long = 218; +pub const SYS_keyctl: ::c_long = 219; +pub const SYS_clone: ::c_long = 220; +pub const SYS_execve: ::c_long = 221; +pub const SYS_mmap: ::c_long = 222; +pub const SYS_swapon: ::c_long = 224; +pub const SYS_swapoff: ::c_long = 225; +pub const SYS_mprotect: ::c_long = 226; +pub const SYS_msync: ::c_long = 227; +pub const SYS_mlock: ::c_long = 228; +pub const SYS_munlock: ::c_long = 229; +pub const SYS_mlockall: ::c_long = 230; +pub const SYS_munlockall: ::c_long = 231; +pub const SYS_mincore: ::c_long = 232; +pub const SYS_madvise: ::c_long = 233; +pub const SYS_remap_file_pages: ::c_long = 234; +pub const SYS_mbind: ::c_long = 235; +pub const SYS_get_mempolicy: ::c_long = 236; +pub const SYS_set_mempolicy: ::c_long = 237; +pub const SYS_migrate_pages: ::c_long = 238; +pub const SYS_move_pages: ::c_long = 239; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 240; +pub const SYS_perf_event_open: ::c_long = 241; +pub const SYS_accept4: ::c_long = 242; +pub const SYS_recvmmsg: ::c_long = 243; +pub const SYS_wait4: ::c_long = 260; +pub const SYS_prlimit64: ::c_long = 261; +pub const SYS_fanotify_init: ::c_long = 262; +pub const SYS_fanotify_mark: ::c_long = 263; +pub const SYS_name_to_handle_at: ::c_long = 264; +pub const SYS_open_by_handle_at: ::c_long = 265; +pub const SYS_clock_adjtime: ::c_long = 266; +pub const SYS_syncfs: ::c_long = 267; +pub const SYS_setns: ::c_long = 268; +pub const SYS_sendmmsg: ::c_long = 269; +pub const SYS_process_vm_readv: ::c_long = 270; +pub const SYS_process_vm_writev: ::c_long = 271; +pub const SYS_kcmp: ::c_long = 272; +pub const SYS_finit_module: ::c_long = 273; +pub const SYS_sched_setattr: ::c_long = 274; +pub const SYS_sched_getattr: ::c_long = 275; +pub const SYS_renameat2: ::c_long = 276; +pub const SYS_seccomp: ::c_long = 277; +pub const SYS_getrandom: ::c_long = 278; +pub const SYS_memfd_create: ::c_long = 279; +pub const SYS_bpf: ::c_long = 280; +pub const SYS_execveat: ::c_long = 281; +pub const SYS_userfaultfd: ::c_long = 282; +pub const SYS_membarrier: ::c_long = 283; +pub const SYS_mlock2: ::c_long = 284; +pub const SYS_copy_file_range: ::c_long = 285; +pub const SYS_preadv2: ::c_long = 286; +pub const SYS_pwritev2: ::c_long = 287; +pub const SYS_pkey_mprotect: ::c_long = 288; +pub const SYS_pkey_alloc: ::c_long = 289; +pub const SYS_pkey_free: ::c_long = 290; + +#[link(name = "util")] +extern { + pub fn sysctl(name: *mut ::c_int, + namelen: ::c_int, + oldp: *mut ::c_void, + oldlenp: *mut ::size_t, + newp: *mut ::c_void, + newlen: ::size_t) + -> ::c_int; +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/mips64.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/mips64.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/mips64.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/mips64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,1000 @@ +use pthread_mutex_t; + +pub type blksize_t = i64; +pub type c_char = i8; +pub type c_long = i64; +pub type c_ulong = u64; +pub type nlink_t = u64; +pub type suseconds_t = i64; +pub type wchar_t = i32; +pub type __u64 = ::c_ulong; + +s! { + pub struct stat { + pub st_dev: ::c_ulong, + st_pad1: [::c_long; 2], + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::c_ulong, + st_pad2: [::c_ulong; 1], + pub st_size: ::off_t, + st_pad3: ::c_long, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_blksize: ::blksize_t, + st_pad4: ::c_long, + pub st_blocks: ::blkcnt_t, + st_pad5: [::c_long; 7], + } + + pub struct statfs { + pub f_type: ::c_long, + pub f_bsize: ::c_long, + pub f_frsize: ::c_long, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_files: ::fsblkcnt_t, + pub f_ffree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_fsid: ::fsid_t, + + pub f_namelen: ::c_long, + f_spare: [::c_long; 6], + } + + pub struct flock { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off_t, + pub l_len: ::off_t, + pub l_pid: ::pid_t, + } + + pub struct stat64 { + pub st_dev: ::c_ulong, + st_pad1: [::c_long; 2], + pub st_ino: ::ino64_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::c_ulong, + st_pad2: [::c_long; 2], + pub st_size: ::off64_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_blksize: ::blksize_t, + st_pad3: ::c_long, + pub st_blocks: ::blkcnt64_t, + st_pad5: [::c_long; 7], + } + + pub struct statfs64 { + pub f_type: ::c_long, + pub f_bsize: ::c_long, + pub f_frsize: ::c_long, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_bavail: u64, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_long, + pub f_flags: ::c_long, + pub f_spare: [::c_long; 5], + } + + pub struct statvfs { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_favail: ::fsfilcnt_t, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: u64, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct pthread_attr_t { + __size: [::c_ulong; 7] + } + + pub struct sigaction { + pub sa_flags: ::c_int, + pub sa_sigaction: ::sighandler_t, + pub sa_mask: ::sigset_t, + pub sa_restorer: ::Option, + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_size: ::size_t, + pub ss_flags: ::c_int, + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_code: ::c_int, + pub si_errno: ::c_int, + _pad: ::c_int, + _pad2: [::c_long; 14], + } + + pub struct ipc_perm { + pub __key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::c_uint, + pub __seq: ::c_ushort, + __pad1: ::c_ushort, + __unused1: ::c_ulong, + __unused2: ::c_ulong + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_atime: ::time_t, + pub shm_dtime: ::time_t, + pub shm_ctime: ::time_t, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, + pub shm_nattch: ::shmatt_t, + __unused4: ::c_ulong, + __unused5: ::c_ulong + } + + pub struct termios2 { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; 23], + pub c_ispeed: ::speed_t, + pub c_ospeed: ::speed_t, + } +} + +pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; +pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; +pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; + +align_const! { + #[cfg(target_endian = "little")] + pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 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, 0, + ], + }; + #[cfg(target_endian = "little")] + pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + #[cfg(target_endian = "little")] + pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + #[cfg(target_endian = "big")] + pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 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, + ], + }; + #[cfg(target_endian = "big")] + pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + #[cfg(target_endian = "big")] + pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; +} + +pub const SYS_read: ::c_long = 5000 + 0; +pub const SYS_write: ::c_long = 5000 + 1; +pub const SYS_open: ::c_long = 5000 + 2; +pub const SYS_close: ::c_long = 5000 + 3; +pub const SYS_stat: ::c_long = 5000 + 4; +pub const SYS_fstat: ::c_long = 5000 + 5; +pub const SYS_lstat: ::c_long = 5000 + 6; +pub const SYS_poll: ::c_long = 5000 + 7; +pub const SYS_lseek: ::c_long = 5000 + 8; +pub const SYS_mmap: ::c_long = 5000 + 9; +pub const SYS_mprotect: ::c_long = 5000 + 10; +pub const SYS_munmap: ::c_long = 5000 + 11; +pub const SYS_brk: ::c_long = 5000 + 12; +pub const SYS_rt_sigaction: ::c_long = 5000 + 13; +pub const SYS_rt_sigprocmask: ::c_long = 5000 + 14; +pub const SYS_ioctl: ::c_long = 5000 + 15; +pub const SYS_pread64: ::c_long = 5000 + 16; +pub const SYS_pwrite64: ::c_long = 5000 + 17; +pub const SYS_readv: ::c_long = 5000 + 18; +pub const SYS_writev: ::c_long = 5000 + 19; +pub const SYS_access: ::c_long = 5000 + 20; +pub const SYS_pipe: ::c_long = 5000 + 21; +pub const SYS__newselect: ::c_long = 5000 + 22; +pub const SYS_sched_yield: ::c_long = 5000 + 23; +pub const SYS_mremap: ::c_long = 5000 + 24; +pub const SYS_msync: ::c_long = 5000 + 25; +pub const SYS_mincore: ::c_long = 5000 + 26; +pub const SYS_madvise: ::c_long = 5000 + 27; +pub const SYS_shmget: ::c_long = 5000 + 28; +pub const SYS_shmat: ::c_long = 5000 + 29; +pub const SYS_shmctl: ::c_long = 5000 + 30; +pub const SYS_dup: ::c_long = 5000 + 31; +pub const SYS_dup2: ::c_long = 5000 + 32; +pub const SYS_pause: ::c_long = 5000 + 33; +pub const SYS_nanosleep: ::c_long = 5000 + 34; +pub const SYS_getitimer: ::c_long = 5000 + 35; +pub const SYS_setitimer: ::c_long = 5000 + 36; +pub const SYS_alarm: ::c_long = 5000 + 37; +pub const SYS_getpid: ::c_long = 5000 + 38; +pub const SYS_sendfile: ::c_long = 5000 + 39; +pub const SYS_socket: ::c_long = 5000 + 40; +pub const SYS_connect: ::c_long = 5000 + 41; +pub const SYS_accept: ::c_long = 5000 + 42; +pub const SYS_sendto: ::c_long = 5000 + 43; +pub const SYS_recvfrom: ::c_long = 5000 + 44; +pub const SYS_sendmsg: ::c_long = 5000 + 45; +pub const SYS_recvmsg: ::c_long = 5000 + 46; +pub const SYS_shutdown: ::c_long = 5000 + 47; +pub const SYS_bind: ::c_long = 5000 + 48; +pub const SYS_listen: ::c_long = 5000 + 49; +pub const SYS_getsockname: ::c_long = 5000 + 50; +pub const SYS_getpeername: ::c_long = 5000 + 51; +pub const SYS_socketpair: ::c_long = 5000 + 52; +pub const SYS_setsockopt: ::c_long = 5000 + 53; +pub const SYS_getsockopt: ::c_long = 5000 + 54; +pub const SYS_clone: ::c_long = 5000 + 55; +pub const SYS_fork: ::c_long = 5000 + 56; +pub const SYS_execve: ::c_long = 5000 + 57; +pub const SYS_exit: ::c_long = 5000 + 58; +pub const SYS_wait4: ::c_long = 5000 + 59; +pub const SYS_kill: ::c_long = 5000 + 60; +pub const SYS_uname: ::c_long = 5000 + 61; +pub const SYS_semget: ::c_long = 5000 + 62; +pub const SYS_semop: ::c_long = 5000 + 63; +pub const SYS_semctl: ::c_long = 5000 + 64; +pub const SYS_shmdt: ::c_long = 5000 + 65; +pub const SYS_msgget: ::c_long = 5000 + 66; +pub const SYS_msgsnd: ::c_long = 5000 + 67; +pub const SYS_msgrcv: ::c_long = 5000 + 68; +pub const SYS_msgctl: ::c_long = 5000 + 69; +pub const SYS_fcntl: ::c_long = 5000 + 70; +pub const SYS_flock: ::c_long = 5000 + 71; +pub const SYS_fsync: ::c_long = 5000 + 72; +pub const SYS_fdatasync: ::c_long = 5000 + 73; +pub const SYS_truncate: ::c_long = 5000 + 74; +pub const SYS_ftruncate: ::c_long = 5000 + 75; +pub const SYS_getdents: ::c_long = 5000 + 76; +pub const SYS_getcwd: ::c_long = 5000 + 77; +pub const SYS_chdir: ::c_long = 5000 + 78; +pub const SYS_fchdir: ::c_long = 5000 + 79; +pub const SYS_rename: ::c_long = 5000 + 80; +pub const SYS_mkdir: ::c_long = 5000 + 81; +pub const SYS_rmdir: ::c_long = 5000 + 82; +pub const SYS_creat: ::c_long = 5000 + 83; +pub const SYS_link: ::c_long = 5000 + 84; +pub const SYS_unlink: ::c_long = 5000 + 85; +pub const SYS_symlink: ::c_long = 5000 + 86; +pub const SYS_readlink: ::c_long = 5000 + 87; +pub const SYS_chmod: ::c_long = 5000 + 88; +pub const SYS_fchmod: ::c_long = 5000 + 89; +pub const SYS_chown: ::c_long = 5000 + 90; +pub const SYS_fchown: ::c_long = 5000 + 91; +pub const SYS_lchown: ::c_long = 5000 + 92; +pub const SYS_umask: ::c_long = 5000 + 93; +pub const SYS_gettimeofday: ::c_long = 5000 + 94; +pub const SYS_getrlimit: ::c_long = 5000 + 95; +pub const SYS_getrusage: ::c_long = 5000 + 96; +pub const SYS_sysinfo: ::c_long = 5000 + 97; +pub const SYS_times: ::c_long = 5000 + 98; +pub const SYS_ptrace: ::c_long = 5000 + 99; +pub const SYS_getuid: ::c_long = 5000 + 100; +pub const SYS_syslog: ::c_long = 5000 + 101; +pub const SYS_getgid: ::c_long = 5000 + 102; +pub const SYS_setuid: ::c_long = 5000 + 103; +pub const SYS_setgid: ::c_long = 5000 + 104; +pub const SYS_geteuid: ::c_long = 5000 + 105; +pub const SYS_getegid: ::c_long = 5000 + 106; +pub const SYS_setpgid: ::c_long = 5000 + 107; +pub const SYS_getppid: ::c_long = 5000 + 108; +pub const SYS_getpgrp: ::c_long = 5000 + 109; +pub const SYS_setsid: ::c_long = 5000 + 110; +pub const SYS_setreuid: ::c_long = 5000 + 111; +pub const SYS_setregid: ::c_long = 5000 + 112; +pub const SYS_getgroups: ::c_long = 5000 + 113; +pub const SYS_setgroups: ::c_long = 5000 + 114; +pub const SYS_setresuid: ::c_long = 5000 + 115; +pub const SYS_getresuid: ::c_long = 5000 + 116; +pub const SYS_setresgid: ::c_long = 5000 + 117; +pub const SYS_getresgid: ::c_long = 5000 + 118; +pub const SYS_getpgid: ::c_long = 5000 + 119; +pub const SYS_setfsuid: ::c_long = 5000 + 120; +pub const SYS_setfsgid: ::c_long = 5000 + 121; +pub const SYS_getsid: ::c_long = 5000 + 122; +pub const SYS_capget: ::c_long = 5000 + 123; +pub const SYS_capset: ::c_long = 5000 + 124; +pub const SYS_rt_sigpending: ::c_long = 5000 + 125; +pub const SYS_rt_sigtimedwait: ::c_long = 5000 + 126; +pub const SYS_rt_sigqueueinfo: ::c_long = 5000 + 127; +pub const SYS_rt_sigsuspend: ::c_long = 5000 + 128; +pub const SYS_sigaltstack: ::c_long = 5000 + 129; +pub const SYS_utime: ::c_long = 5000 + 130; +pub const SYS_mknod: ::c_long = 5000 + 131; +pub const SYS_personality: ::c_long = 5000 + 132; +pub const SYS_ustat: ::c_long = 5000 + 133; +pub const SYS_statfs: ::c_long = 5000 + 134; +pub const SYS_fstatfs: ::c_long = 5000 + 135; +pub const SYS_sysfs: ::c_long = 5000 + 136; +pub const SYS_getpriority: ::c_long = 5000 + 137; +pub const SYS_setpriority: ::c_long = 5000 + 138; +pub const SYS_sched_setparam: ::c_long = 5000 + 139; +pub const SYS_sched_getparam: ::c_long = 5000 + 140; +pub const SYS_sched_setscheduler: ::c_long = 5000 + 141; +pub const SYS_sched_getscheduler: ::c_long = 5000 + 142; +pub const SYS_sched_get_priority_max: ::c_long = 5000 + 143; +pub const SYS_sched_get_priority_min: ::c_long = 5000 + 144; +pub const SYS_sched_rr_get_interval: ::c_long = 5000 + 145; +pub const SYS_mlock: ::c_long = 5000 + 146; +pub const SYS_munlock: ::c_long = 5000 + 147; +pub const SYS_mlockall: ::c_long = 5000 + 148; +pub const SYS_munlockall: ::c_long = 5000 + 149; +pub const SYS_vhangup: ::c_long = 5000 + 150; +pub const SYS_pivot_root: ::c_long = 5000 + 151; +pub const SYS__sysctl: ::c_long = 5000 + 152; +pub const SYS_prctl: ::c_long = 5000 + 153; +pub const SYS_adjtimex: ::c_long = 5000 + 154; +pub const SYS_setrlimit: ::c_long = 5000 + 155; +pub const SYS_chroot: ::c_long = 5000 + 156; +pub const SYS_sync: ::c_long = 5000 + 157; +pub const SYS_acct: ::c_long = 5000 + 158; +pub const SYS_settimeofday: ::c_long = 5000 + 159; +pub const SYS_mount: ::c_long = 5000 + 160; +pub const SYS_umount2: ::c_long = 5000 + 161; +pub const SYS_swapon: ::c_long = 5000 + 162; +pub const SYS_swapoff: ::c_long = 5000 + 163; +pub const SYS_reboot: ::c_long = 5000 + 164; +pub const SYS_sethostname: ::c_long = 5000 + 165; +pub const SYS_setdomainname: ::c_long = 5000 + 166; +pub const SYS_create_module: ::c_long = 5000 + 167; +pub const SYS_init_module: ::c_long = 5000 + 168; +pub const SYS_delete_module: ::c_long = 5000 + 169; +pub const SYS_get_kernel_syms: ::c_long = 5000 + 170; +pub const SYS_query_module: ::c_long = 5000 + 171; +pub const SYS_quotactl: ::c_long = 5000 + 172; +pub const SYS_nfsservctl: ::c_long = 5000 + 173; +pub const SYS_getpmsg: ::c_long = 5000 + 174; +pub const SYS_putpmsg: ::c_long = 5000 + 175; +pub const SYS_afs_syscall: ::c_long = 5000 + 176; +pub const SYS_gettid: ::c_long = 5000 + 178; +pub const SYS_readahead: ::c_long = 5000 + 179; +pub const SYS_setxattr: ::c_long = 5000 + 180; +pub const SYS_lsetxattr: ::c_long = 5000 + 181; +pub const SYS_fsetxattr: ::c_long = 5000 + 182; +pub const SYS_getxattr: ::c_long = 5000 + 183; +pub const SYS_lgetxattr: ::c_long = 5000 + 184; +pub const SYS_fgetxattr: ::c_long = 5000 + 185; +pub const SYS_listxattr: ::c_long = 5000 + 186; +pub const SYS_llistxattr: ::c_long = 5000 + 187; +pub const SYS_flistxattr: ::c_long = 5000 + 188; +pub const SYS_removexattr: ::c_long = 5000 + 189; +pub const SYS_lremovexattr: ::c_long = 5000 + 190; +pub const SYS_fremovexattr: ::c_long = 5000 + 191; +pub const SYS_tkill: ::c_long = 5000 + 192; +pub const SYS_futex: ::c_long = 5000 + 194; +pub const SYS_sched_setaffinity: ::c_long = 5000 + 195; +pub const SYS_sched_getaffinity: ::c_long = 5000 + 196; +pub const SYS_cacheflush: ::c_long = 5000 + 197; +pub const SYS_cachectl: ::c_long = 5000 + 198; +pub const SYS_sysmips: ::c_long = 5000 + 199; +pub const SYS_io_setup: ::c_long = 5000 + 200; +pub const SYS_io_destroy: ::c_long = 5000 + 201; +pub const SYS_io_getevents: ::c_long = 5000 + 202; +pub const SYS_io_submit: ::c_long = 5000 + 203; +pub const SYS_io_cancel: ::c_long = 5000 + 204; +pub const SYS_exit_group: ::c_long = 5000 + 205; +pub const SYS_lookup_dcookie: ::c_long = 5000 + 206; +pub const SYS_epoll_create: ::c_long = 5000 + 207; +pub const SYS_epoll_ctl: ::c_long = 5000 + 208; +pub const SYS_epoll_wait: ::c_long = 5000 + 209; +pub const SYS_remap_file_pages: ::c_long = 5000 + 210; +pub const SYS_rt_sigreturn: ::c_long = 5000 + 211; +pub const SYS_set_tid_address: ::c_long = 5000 + 212; +pub const SYS_restart_syscall: ::c_long = 5000 + 213; +pub const SYS_semtimedop: ::c_long = 5000 + 214; +pub const SYS_fadvise64: ::c_long = 5000 + 215; +pub const SYS_timer_create: ::c_long = 5000 + 216; +pub const SYS_timer_settime: ::c_long = 5000 + 217; +pub const SYS_timer_gettime: ::c_long = 5000 + 218; +pub const SYS_timer_getoverrun: ::c_long = 5000 + 219; +pub const SYS_timer_delete: ::c_long = 5000 + 220; +pub const SYS_clock_settime: ::c_long = 5000 + 221; +pub const SYS_clock_gettime: ::c_long = 5000 + 222; +pub const SYS_clock_getres: ::c_long = 5000 + 223; +pub const SYS_clock_nanosleep: ::c_long = 5000 + 224; +pub const SYS_tgkill: ::c_long = 5000 + 225; +pub const SYS_utimes: ::c_long = 5000 + 226; +pub const SYS_mbind: ::c_long = 5000 + 227; +pub const SYS_get_mempolicy: ::c_long = 5000 + 228; +pub const SYS_set_mempolicy: ::c_long = 5000 + 229; +pub const SYS_mq_open: ::c_long = 5000 + 230; +pub const SYS_mq_unlink: ::c_long = 5000 + 231; +pub const SYS_mq_timedsend: ::c_long = 5000 + 232; +pub const SYS_mq_timedreceive: ::c_long = 5000 + 233; +pub const SYS_mq_notify: ::c_long = 5000 + 234; +pub const SYS_mq_getsetattr: ::c_long = 5000 + 235; +pub const SYS_vserver: ::c_long = 5000 + 236; +pub const SYS_waitid: ::c_long = 5000 + 237; +/* pub const SYS_sys_setaltroot: ::c_long = 5000 + 238; */ +pub const SYS_add_key: ::c_long = 5000 + 239; +pub const SYS_request_key: ::c_long = 5000 + 240; +pub const SYS_keyctl: ::c_long = 5000 + 241; +pub const SYS_set_thread_area: ::c_long = 5000 + 242; +pub const SYS_inotify_init: ::c_long = 5000 + 243; +pub const SYS_inotify_add_watch: ::c_long = 5000 + 244; +pub const SYS_inotify_rm_watch: ::c_long = 5000 + 245; +pub const SYS_migrate_pages: ::c_long = 5000 + 246; +pub const SYS_openat: ::c_long = 5000 + 247; +pub const SYS_mkdirat: ::c_long = 5000 + 248; +pub const SYS_mknodat: ::c_long = 5000 + 249; +pub const SYS_fchownat: ::c_long = 5000 + 250; +pub const SYS_futimesat: ::c_long = 5000 + 251; +pub const SYS_newfstatat: ::c_long = 5000 + 252; +pub const SYS_unlinkat: ::c_long = 5000 + 253; +pub const SYS_renameat: ::c_long = 5000 + 254; +pub const SYS_linkat: ::c_long = 5000 + 255; +pub const SYS_symlinkat: ::c_long = 5000 + 256; +pub const SYS_readlinkat: ::c_long = 5000 + 257; +pub const SYS_fchmodat: ::c_long = 5000 + 258; +pub const SYS_faccessat: ::c_long = 5000 + 259; +pub const SYS_pselect6: ::c_long = 5000 + 260; +pub const SYS_ppoll: ::c_long = 5000 + 261; +pub const SYS_unshare: ::c_long = 5000 + 262; +pub const SYS_splice: ::c_long = 5000 + 263; +pub const SYS_sync_file_range: ::c_long = 5000 + 264; +pub const SYS_tee: ::c_long = 5000 + 265; +pub const SYS_vmsplice: ::c_long = 5000 + 266; +pub const SYS_move_pages: ::c_long = 5000 + 267; +pub const SYS_set_robust_list: ::c_long = 5000 + 268; +pub const SYS_get_robust_list: ::c_long = 5000 + 269; +pub const SYS_kexec_load: ::c_long = 5000 + 270; +pub const SYS_getcpu: ::c_long = 5000 + 271; +pub const SYS_epoll_pwait: ::c_long = 5000 + 272; +pub const SYS_ioprio_set: ::c_long = 5000 + 273; +pub const SYS_ioprio_get: ::c_long = 5000 + 274; +pub const SYS_utimensat: ::c_long = 5000 + 275; +pub const SYS_signalfd: ::c_long = 5000 + 276; +pub const SYS_timerfd: ::c_long = 5000 + 277; +pub const SYS_eventfd: ::c_long = 5000 + 278; +pub const SYS_fallocate: ::c_long = 5000 + 279; +pub const SYS_timerfd_create: ::c_long = 5000 + 280; +pub const SYS_timerfd_gettime: ::c_long = 5000 + 281; +pub const SYS_timerfd_settime: ::c_long = 5000 + 282; +pub const SYS_signalfd4: ::c_long = 5000 + 283; +pub const SYS_eventfd2: ::c_long = 5000 + 284; +pub const SYS_epoll_create1: ::c_long = 5000 + 285; +pub const SYS_dup3: ::c_long = 5000 + 286; +pub const SYS_pipe2: ::c_long = 5000 + 287; +pub const SYS_inotify_init1: ::c_long = 5000 + 288; +pub const SYS_preadv: ::c_long = 5000 + 289; +pub const SYS_pwritev: ::c_long = 5000 + 290; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 5000 + 291; +pub const SYS_perf_event_open: ::c_long = 5000 + 292; +pub const SYS_accept4: ::c_long = 5000 + 293; +pub const SYS_recvmmsg: ::c_long = 5000 + 294; +pub const SYS_fanotify_init: ::c_long = 5000 + 295; +pub const SYS_fanotify_mark: ::c_long = 5000 + 296; +pub const SYS_prlimit64: ::c_long = 5000 + 297; +pub const SYS_name_to_handle_at: ::c_long = 5000 + 298; +pub const SYS_open_by_handle_at: ::c_long = 5000 + 299; +pub const SYS_clock_adjtime: ::c_long = 5000 + 300; +pub const SYS_syncfs: ::c_long = 5000 + 301; +pub const SYS_sendmmsg: ::c_long = 5000 + 302; +pub const SYS_setns: ::c_long = 5000 + 303; +pub const SYS_process_vm_readv: ::c_long = 5000 + 304; +pub const SYS_process_vm_writev: ::c_long = 5000 + 305; +pub const SYS_kcmp: ::c_long = 5000 + 306; +pub const SYS_finit_module: ::c_long = 5000 + 307; +pub const SYS_getdents64: ::c_long = 5000 + 308; +pub const SYS_sched_setattr: ::c_long = 5000 + 309; +pub const SYS_sched_getattr: ::c_long = 5000 + 310; +pub const SYS_renameat2: ::c_long = 5000 + 311; +pub const SYS_seccomp: ::c_long = 5000 + 312; +pub const SYS_getrandom: ::c_long = 5000 + 313; +pub const SYS_memfd_create: ::c_long = 5000 + 314; +pub const SYS_bpf: ::c_long = 5000 + 315; +pub const SYS_execveat: ::c_long = 5000 + 316; +pub const SYS_userfaultfd: ::c_long = 5000 + 317; +pub const SYS_membarrier: ::c_long = 5000 + 318; +pub const SYS_mlock2: ::c_long = 5000 + 319; +pub const SYS_copy_file_range: ::c_long = 5000 + 320; +pub const SYS_preadv2: ::c_long = 5000 + 321; +pub const SYS_pwritev2: ::c_long = 5000 + 322; +pub const SYS_pkey_mprotect: ::c_long = 5000 + 323; +pub const SYS_pkey_alloc: ::c_long = 5000 + 324; +pub const SYS_pkey_free: ::c_long = 5000 + 325; + +pub const SFD_CLOEXEC: ::c_int = 0x080000; + +pub const NCCS: usize = 32; + +pub const O_TRUNC: ::c_int = 512; + +pub const O_NOATIME: ::c_int = 0o1000000; +pub const O_CLOEXEC: ::c_int = 0x80000; +pub const O_PATH: ::c_int = 0o10000000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; + +pub const EBFONT: ::c_int = 59; +pub const ENOSTR: ::c_int = 60; +pub const ENODATA: ::c_int = 61; +pub const ETIME: ::c_int = 62; +pub const ENOSR: ::c_int = 63; +pub const ENONET: ::c_int = 64; +pub const ENOPKG: ::c_int = 65; +pub const EREMOTE: ::c_int = 66; +pub const ENOLINK: ::c_int = 67; +pub const EADV: ::c_int = 68; +pub const ESRMNT: ::c_int = 69; +pub const ECOMM: ::c_int = 70; +pub const EPROTO: ::c_int = 71; +pub const EDOTDOT: ::c_int = 73; + +pub const SA_NODEFER: ::c_int = 0x40000000; +pub const SA_RESETHAND: ::c_int = 0x80000000; +pub const SA_RESTART: ::c_int = 0x10000000; +pub const SA_NOCLDSTOP: ::c_int = 0x00000001; + +pub const POSIX_FADV_DONTNEED: ::c_int = 4; +pub const POSIX_FADV_NOREUSE: ::c_int = 5; + +pub const EPOLL_CLOEXEC: ::c_int = 0x80000; + +pub const EFD_CLOEXEC: ::c_int = 0x80000; + +pub const O_DIRECT: ::c_int = 0x8000; +pub const O_DIRECTORY: ::c_int = 0x10000; +pub const O_NOFOLLOW: ::c_int = 0x20000; + +pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 5; +pub const RLIMIT_AS: ::__rlimit_resource_t = 6; +pub const RLIMIT_RSS: ::__rlimit_resource_t = 7; +pub const RLIMIT_NPROC: ::__rlimit_resource_t = 8; +pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 9; + +pub const O_APPEND: ::c_int = 8; +pub const O_CREAT: ::c_int = 256; +pub const O_EXCL: ::c_int = 1024; +pub const O_NOCTTY: ::c_int = 2048; +pub const O_NONBLOCK: ::c_int = 128; +pub const O_SYNC: ::c_int = 0x4010; +pub const O_RSYNC: ::c_int = 0x4010; +pub const O_DSYNC: ::c_int = 0x10; +pub const O_FSYNC: ::c_int = 0x4010; +pub const O_ASYNC: ::c_int = 0x1000; +pub const O_NDELAY: ::c_int = 0x80; + +pub const EDEADLK: ::c_int = 45; +pub const ENAMETOOLONG: ::c_int = 78; +pub const ENOLCK: ::c_int = 46; +pub const ENOSYS: ::c_int = 89; +pub const ENOTEMPTY: ::c_int = 93; +pub const ELOOP: ::c_int = 90; +pub const ENOMSG: ::c_int = 35; +pub const EIDRM: ::c_int = 36; +pub const ECHRNG: ::c_int = 37; +pub const EL2NSYNC: ::c_int = 38; +pub const EL3HLT: ::c_int = 39; +pub const EL3RST: ::c_int = 40; +pub const ELNRNG: ::c_int = 41; +pub const EUNATCH: ::c_int = 42; +pub const ENOCSI: ::c_int = 43; +pub const EL2HLT: ::c_int = 44; +pub const EBADE: ::c_int = 50; +pub const EBADR: ::c_int = 51; +pub const EXFULL: ::c_int = 52; +pub const ENOANO: ::c_int = 53; +pub const EBADRQC: ::c_int = 54; +pub const EBADSLT: ::c_int = 55; +pub const EDEADLOCK: ::c_int = 56; +pub const EMULTIHOP: ::c_int = 74; +pub const EOVERFLOW: ::c_int = 79; +pub const ENOTUNIQ: ::c_int = 80; +pub const EBADFD: ::c_int = 81; +pub const EBADMSG: ::c_int = 77; +pub const EREMCHG: ::c_int = 82; +pub const ELIBACC: ::c_int = 83; +pub const ELIBBAD: ::c_int = 84; +pub const ELIBSCN: ::c_int = 85; +pub const ELIBMAX: ::c_int = 86; +pub const ELIBEXEC: ::c_int = 87; +pub const EILSEQ: ::c_int = 88; +pub const ERESTART: ::c_int = 91; +pub const ESTRPIPE: ::c_int = 92; +pub const EUSERS: ::c_int = 94; +pub const ENOTSOCK: ::c_int = 95; +pub const EDESTADDRREQ: ::c_int = 96; +pub const EMSGSIZE: ::c_int = 97; +pub const EPROTOTYPE: ::c_int = 98; +pub const ENOPROTOOPT: ::c_int = 99; +pub const EPROTONOSUPPORT: ::c_int = 120; +pub const ESOCKTNOSUPPORT: ::c_int = 121; +pub const EOPNOTSUPP: ::c_int = 122; +pub const EPFNOSUPPORT: ::c_int = 123; +pub const EAFNOSUPPORT: ::c_int = 124; +pub const EADDRINUSE: ::c_int = 125; +pub const EADDRNOTAVAIL: ::c_int = 126; +pub const ENETDOWN: ::c_int = 127; +pub const ENETUNREACH: ::c_int = 128; +pub const ENETRESET: ::c_int = 129; +pub const ECONNABORTED: ::c_int = 130; +pub const ECONNRESET: ::c_int = 131; +pub const ENOBUFS: ::c_int = 132; +pub const EISCONN: ::c_int = 133; +pub const ENOTCONN: ::c_int = 134; +pub const ESHUTDOWN: ::c_int = 143; +pub const ETOOMANYREFS: ::c_int = 144; +pub const ETIMEDOUT: ::c_int = 145; +pub const ECONNREFUSED: ::c_int = 146; +pub const EHOSTDOWN: ::c_int = 147; +pub const EHOSTUNREACH: ::c_int = 148; +pub const EALREADY: ::c_int = 149; +pub const EINPROGRESS: ::c_int = 150; +pub const ESTALE: ::c_int = 151; +pub const EUCLEAN: ::c_int = 135; +pub const ENOTNAM: ::c_int = 137; +pub const ENAVAIL: ::c_int = 138; +pub const EISNAM: ::c_int = 139; +pub const EREMOTEIO: ::c_int = 140; +pub const EDQUOT: ::c_int = 1133; +pub const ENOMEDIUM: ::c_int = 159; +pub const EMEDIUMTYPE: ::c_int = 160; +pub const ECANCELED: ::c_int = 158; +pub const ENOKEY: ::c_int = 161; +pub const EKEYEXPIRED: ::c_int = 162; +pub const EKEYREVOKED: ::c_int = 163; +pub const EKEYREJECTED: ::c_int = 164; +pub const EOWNERDEAD: ::c_int = 165; +pub const ENOTRECOVERABLE: ::c_int = 166; +pub const ERFKILL: ::c_int = 167; + +pub const MAP_NORESERVE: ::c_int = 0x400; +pub const MAP_ANON: ::c_int = 0x800; +pub const MAP_ANONYMOUS: ::c_int = 0x800; +pub const MAP_GROWSDOWN: ::c_int = 0x1000; +pub const MAP_DENYWRITE: ::c_int = 0x2000; +pub const MAP_EXECUTABLE: ::c_int = 0x4000; +pub const MAP_LOCKED: ::c_int = 0x8000; +pub const MAP_POPULATE: ::c_int = 0x10000; +pub const MAP_NONBLOCK: ::c_int = 0x20000; +pub const MAP_STACK: ::c_int = 0x40000; +pub const MAP_HUGETLB: ::c_int = 0x080000; + +pub const SOCK_STREAM: ::c_int = 2; +pub const SOCK_DGRAM: ::c_int = 1; + +pub const SOL_SOCKET: ::c_int = 0xffff; + +pub const SO_REUSEADDR: ::c_int = 0x0004; +pub const SO_KEEPALIVE: ::c_int = 0x0008; +pub const SO_DONTROUTE: ::c_int = 0x0010; +pub const SO_BROADCAST: ::c_int = 0x0020; +pub const SO_LINGER: ::c_int = 0x0080; +pub const SO_OOBINLINE: ::c_int = 0x0100; +pub const SO_REUSEPORT: ::c_int = 0x0200; +pub const SO_TYPE: ::c_int = 0x1008; +pub const SO_STYLE: ::c_int = SO_TYPE; +pub const SO_ERROR: ::c_int = 0x1007; +pub const SO_SNDBUF: ::c_int = 0x1001; +pub const SO_RCVBUF: ::c_int = 0x1002; +pub const SO_SNDLOWAT: ::c_int = 0x1003; +pub const SO_RCVLOWAT: ::c_int = 0x1004; +pub const SO_SNDTIMEO: ::c_int = 0x1005; +pub const SO_RCVTIMEO: ::c_int = 0x1006; +pub const SO_ACCEPTCONN: ::c_int = 0x1009; +pub const SO_PROTOCOL: ::c_int = 0x1028; +pub const SO_DOMAIN: ::c_int = 0x1029; +pub const SO_NO_CHECK: ::c_int = 11; +pub const SO_PRIORITY: ::c_int = 12; +pub const SO_BSDCOMPAT: ::c_int = 14; +pub const SO_PASSCRED: ::c_int = 17; +pub const SO_PEERCRED: ::c_int = 18; +pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22; +pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23; +pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24; +pub const SO_BINDTODEVICE: ::c_int = 25; +pub const SO_ATTACH_FILTER: ::c_int = 26; +pub const SO_DETACH_FILTER: ::c_int = 27; +pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER; +pub const SO_PEERNAME: ::c_int = 28; +pub const SO_TIMESTAMP: ::c_int = 29; +pub const SO_PEERSEC: ::c_int = 30; +pub const SO_SNDBUFFORCE: ::c_int = 31; +pub const SO_RCVBUFFORCE: ::c_int = 33; +pub const SO_PASSSEC: ::c_int = 34; +pub const SO_TIMESTAMPNS: ::c_int = 35; +pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS; +pub const SO_MARK: ::c_int = 36; +pub const SO_RXQ_OVFL: ::c_int = 40; +pub const SO_WIFI_STATUS: ::c_int = 41; +pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS; +pub const SO_PEEK_OFF: ::c_int = 42; +pub const SO_NOFCS: ::c_int = 43; +pub const SO_LOCK_FILTER: ::c_int = 44; +pub const SO_SELECT_ERR_QUEUE: ::c_int = 45; +pub const SO_BUSY_POLL: ::c_int = 46; +pub const SO_MAX_PACING_RATE: ::c_int = 47; +pub const SO_BPF_EXTENSIONS: ::c_int = 48; +pub const SO_INCOMING_CPU: ::c_int = 49; +pub const SO_ATTACH_BPF: ::c_int = 50; +pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER; + +pub const FIOCLEX: ::c_ulong = 0x6601; +pub const FIONCLEX: ::c_ulong = 0x6602; +pub const FIONBIO: ::c_ulong = 0x667e; + +pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_SIGINFO: ::c_int = 0x00000008; +pub const SA_NOCLDWAIT: ::c_int = 0x00010000; + +pub const SIGCHLD: ::c_int = 18; +pub const SIGBUS: ::c_int = 10; +pub const SIGTTIN: ::c_int = 26; +pub const SIGTTOU: ::c_int = 27; +pub const SIGXCPU: ::c_int = 30; +pub const SIGXFSZ: ::c_int = 31; +pub const SIGVTALRM: ::c_int = 28; +pub const SIGPROF: ::c_int = 29; +pub const SIGWINCH: ::c_int = 20; +pub const SIGUSR1: ::c_int = 16; +pub const SIGUSR2: ::c_int = 17; +pub const SIGCONT: ::c_int = 25; +pub const SIGSTOP: ::c_int = 23; +pub const SIGTSTP: ::c_int = 24; +pub const SIGURG: ::c_int = 21; +pub const SIGIO: ::c_int = 22; +pub const SIGSYS: ::c_int = 12; +pub const SIGPOLL: ::c_int = 22; +pub const SIGPWR: ::c_int = 19; +pub const SIG_SETMASK: ::c_int = 3; +pub const SIG_BLOCK: ::c_int = 0x1; +pub const SIG_UNBLOCK: ::c_int = 0x2; + +pub const POLLWRNORM: ::c_short = 0x004; +pub const POLLWRBAND: ::c_short = 0x100; + +pub const VEOF: usize = 16; +pub const VEOL: usize = 17; +pub const VEOL2: usize = 6; +pub const VMIN: usize = 4; +pub const IEXTEN: ::tcflag_t = 0x00000100; +pub const TOSTOP: ::tcflag_t = 0x00008000; +pub const FLUSHO: ::tcflag_t = 0x00002000; +pub const EXTPROC: ::tcflag_t = 0o200000; +pub const TCSANOW: ::c_int = 0x540e; +pub const TCSADRAIN: ::c_int = 0x540f; +pub const TCSAFLUSH: ::c_int = 0x5410; + +pub const PTRACE_GETFPREGS: ::c_uint = 14; +pub const PTRACE_SETFPREGS: ::c_uint = 15; +pub const PTRACE_DETACH: ::c_uint = 17; +pub const PTRACE_GETFPXREGS: ::c_uint = 18; +pub const PTRACE_SETFPXREGS: ::c_uint = 19; +pub const PTRACE_GETREGS: ::c_uint = 12; +pub const PTRACE_SETREGS: ::c_uint = 13; + +pub const EFD_NONBLOCK: ::c_int = 0x80; + +pub const F_RDLCK: ::c_int = 0; +pub const F_WRLCK: ::c_int = 1; +pub const F_UNLCK: ::c_int = 2; +pub const F_GETLK: ::c_int = 14; +pub const F_GETOWN: ::c_int = 23; +pub const F_SETOWN: ::c_int = 24; +pub const F_SETLK: ::c_int = 6; +pub const F_SETLKW: ::c_int = 7; + +pub const SFD_NONBLOCK: ::c_int = 0x80; + +pub const TCGETS: ::c_ulong = 0x540d; +pub const TCSETS: ::c_ulong = 0x540e; +pub const TCSETSW: ::c_ulong = 0x540f; +pub const TCSETSF: ::c_ulong = 0x5410; +pub const TCGETA: ::c_ulong = 0x5401; +pub const TCSETA: ::c_ulong = 0x5402; +pub const TCSETAW: ::c_ulong = 0x5403; +pub const TCSETAF: ::c_ulong = 0x5404; +pub const TCSBRK: ::c_ulong = 0x5405; +pub const TCXONC: ::c_ulong = 0x5406; +pub const TCFLSH: ::c_ulong = 0x5407; +pub const TIOCGSOFTCAR: ::c_ulong = 0x5481; +pub const TIOCSSOFTCAR: ::c_ulong = 0x5482; +pub const TIOCINQ: ::c_ulong = 0x467f; +pub const TIOCLINUX: ::c_ulong = 0x5483; +pub const TIOCGSERIAL: ::c_ulong = 0x5484; +pub const TIOCEXCL: ::c_ulong = 0x740d; +pub const TIOCNXCL: ::c_ulong = 0x740e; +pub const TIOCSCTTY: ::c_ulong = 0x5480; +pub const TIOCGPGRP: ::c_ulong = 0x40047477; +pub const TIOCSPGRP: ::c_ulong = 0x80047476; +pub const TIOCOUTQ: ::c_ulong = 0x7472; +pub const TIOCSTI: ::c_ulong = 0x5472; +pub const TIOCGWINSZ: ::c_ulong = 0x40087468; +pub const TIOCSWINSZ: ::c_ulong = 0x80087467; +pub const TIOCMGET: ::c_ulong = 0x741d; +pub const TIOCMBIS: ::c_ulong = 0x741b; +pub const TIOCMBIC: ::c_ulong = 0x741c; +pub const TIOCMSET: ::c_ulong = 0x741a; +pub const FIONREAD: ::c_ulong = 0x467f; +pub const TIOCCONS: ::c_ulong = 0x80047478; + +pub const RTLD_DEEPBIND: ::c_int = 0x10; +pub const RTLD_GLOBAL: ::c_int = 0x4; +pub const RTLD_NOLOAD: ::c_int = 0x8; + +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; + +pub const SIGSTKSZ: ::size_t = 8192; +pub const MINSIGSTKSZ: ::size_t = 2048; +pub const CBAUD: ::tcflag_t = 0o0010017; +pub const TAB1: ::tcflag_t = 0x00000800; +pub const TAB2: ::tcflag_t = 0x00001000; +pub const TAB3: ::tcflag_t = 0x00001800; +pub const CR1: ::tcflag_t = 0x00000200; +pub const CR2: ::tcflag_t = 0x00000400; +pub const CR3: ::tcflag_t = 0x00000600; +pub const FF1: ::tcflag_t = 0x00008000; +pub const BS1: ::tcflag_t = 0x00002000; +pub const VT1: ::tcflag_t = 0x00004000; +pub const VWERASE: usize = 14; +pub const VREPRINT: usize = 12; +pub const VSUSP: usize = 10; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VDISCARD: usize = 13; +pub const VTIME: usize = 5; +pub const IXON: ::tcflag_t = 0x00000400; +pub const IXOFF: ::tcflag_t = 0x00001000; +pub const ONLCR: ::tcflag_t = 0x4; +pub const CSIZE: ::tcflag_t = 0x00000030; +pub const CS6: ::tcflag_t = 0x00000010; +pub const CS7: ::tcflag_t = 0x00000020; +pub const CS8: ::tcflag_t = 0x00000030; +pub const CSTOPB: ::tcflag_t = 0x00000040; +pub const CREAD: ::tcflag_t = 0x00000080; +pub const PARENB: ::tcflag_t = 0x00000100; +pub const PARODD: ::tcflag_t = 0x00000200; +pub const HUPCL: ::tcflag_t = 0x00000400; +pub const CLOCAL: ::tcflag_t = 0x00000800; +pub const ECHOKE: ::tcflag_t = 0x00000800; +pub const ECHOE: ::tcflag_t = 0x00000010; +pub const ECHOK: ::tcflag_t = 0x00000020; +pub const ECHONL: ::tcflag_t = 0x00000040; +pub const ECHOPRT: ::tcflag_t = 0x00000400; +pub const ECHOCTL: ::tcflag_t = 0x00000200; +pub const ISIG: ::tcflag_t = 0x00000001; +pub const ICANON: ::tcflag_t = 0x00000002; +pub const PENDIN: ::tcflag_t = 0x00004000; +pub const NOFLSH: ::tcflag_t = 0x00000080; +pub const CIBAUD: ::tcflag_t = 0o02003600000; +pub const CBAUDEX: ::tcflag_t = 0o010000; +pub const VSWTC: usize = 7; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const XTABS: ::tcflag_t = 0o014000; + +pub const B0: ::speed_t = 0o000000; +pub const B50: ::speed_t = 0o000001; +pub const B75: ::speed_t = 0o000002; +pub const B110: ::speed_t = 0o000003; +pub const B134: ::speed_t = 0o000004; +pub const B150: ::speed_t = 0o000005; +pub const B200: ::speed_t = 0o000006; +pub const B300: ::speed_t = 0o000007; +pub const B600: ::speed_t = 0o000010; +pub const B1200: ::speed_t = 0o000011; +pub const B1800: ::speed_t = 0o000012; +pub const B2400: ::speed_t = 0o000013; +pub const B4800: ::speed_t = 0o000014; +pub const B9600: ::speed_t = 0o000015; +pub const B19200: ::speed_t = 0o000016; +pub const B38400: ::speed_t = 0o000017; +pub const EXTA: ::speed_t = B19200; +pub const EXTB: ::speed_t = B38400; +pub const BOTHER: ::speed_t = 0o010000; +pub const B57600: ::speed_t = 0o010001; +pub const B115200: ::speed_t = 0o010002; +pub const B230400: ::speed_t = 0o010003; +pub const B460800: ::speed_t = 0o010004; +pub const B500000: ::speed_t = 0o010005; +pub const B576000: ::speed_t = 0o010006; +pub const B921600: ::speed_t = 0o010007; +pub const B1000000: ::speed_t = 0o010010; +pub const B1152000: ::speed_t = 0o010011; +pub const B1500000: ::speed_t = 0o010012; +pub const B2000000: ::speed_t = 0o010013; +pub const B2500000: ::speed_t = 0o010014; +pub const B3000000: ::speed_t = 0o010015; +pub const B3500000: ::speed_t = 0o010016; +pub const B4000000: ::speed_t = 0o010017; + +pub const TIOCM_ST: ::c_int = 0x010; +pub const TIOCM_SR: ::c_int = 0x020; +pub const TIOCM_CTS: ::c_int = 0x040; +pub const TIOCM_CAR: ::c_int = 0x100; +pub const TIOCM_RNG: ::c_int = 0x200; +pub const TIOCM_DSR: ::c_int = 0x400; + +pub const EHWPOISON: ::c_int = 168; + +#[link(name = "util")] +extern { + pub fn sysctl(name: *mut ::c_int, + namelen: ::c_int, + oldp: *mut ::c_void, + oldlenp: *mut ::size_t, + newp: *mut ::c_void, + newlen: ::size_t) + -> ::c_int; +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/mod.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,84 @@ +//! 64-bit specific definitions for linux-like values + +pub type clock_t = i64; +pub type time_t = i64; +pub type ino_t = u64; +pub type off_t = i64; +pub type blkcnt_t = i64; +pub type shmatt_t = u64; +pub type msgqnum_t = u64; +pub type msglen_t = u64; +pub type fsblkcnt_t = u64; +pub type fsfilcnt_t = u64; +pub type rlim_t = u64; +pub type __fsword_t = i64; + +s! { + pub struct sigset_t { + #[cfg(target_pointer_width = "32")] + __val: [u32; 32], + #[cfg(target_pointer_width = "64")] + __val: [u64; 16], + } + + pub struct sysinfo { + pub uptime: i64, + pub loads: [u64; 3], + pub totalram: u64, + pub freeram: u64, + pub sharedram: u64, + pub bufferram: u64, + pub totalswap: u64, + pub freeswap: u64, + pub procs: ::c_ushort, + pub pad: ::c_ushort, + pub totalhigh: u64, + pub freehigh: u64, + pub mem_unit: ::c_uint, + pub _f: [::c_char; 0], + } + + pub struct msqid_ds { + pub msg_perm: ::ipc_perm, + pub msg_stime: ::time_t, + pub msg_rtime: ::time_t, + pub msg_ctime: ::time_t, + __msg_cbytes: u64, + pub msg_qnum: ::msgqnum_t, + pub msg_qbytes: ::msglen_t, + pub msg_lspid: ::pid_t, + pub msg_lrpid: ::pid_t, + __glibc_reserved4: u64, + __glibc_reserved5: u64, + } + +} + +pub const RLIM_INFINITY: ::rlim_t = !0; +pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; + +pub const O_LARGEFILE: ::c_int = 0; + +cfg_if! { + if #[cfg(target_arch = "aarch64")] { + mod aarch64; + pub use self::aarch64::*; + } else if #[cfg(any(target_arch = "powerpc64"))] { + mod powerpc64; + pub use self::powerpc64::*; + } else if #[cfg(any(target_arch = "sparc64"))] { + mod sparc64; + pub use self::sparc64::*; + } else if #[cfg(any(target_arch = "mips64"))] { + mod mips64; + pub use self::mips64::*; + } else if #[cfg(any(target_arch = "s390x"))] { + mod s390x; + pub use self::s390x::*; + } else if #[cfg(any(target_arch = "x86_64"))] { + mod x86_64; + pub use self::x86_64::*; + } else { + // Unknown target_arch + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/powerpc64.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/powerpc64.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/powerpc64.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/powerpc64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,1039 @@ +//! PowerPC64-specific definitions for 64-bit linux-like values + +use pthread_mutex_t; + +pub type c_long = i64; +pub type c_ulong = u64; +pub type c_char = u8; +pub type wchar_t = i32; +pub type nlink_t = u64; +pub type blksize_t = i64; +pub type suseconds_t = i64; +pub type __u64 = ::c_ulong; + +s! { + pub struct sigaction { + pub sa_sigaction: ::sighandler_t, + pub sa_mask: ::sigset_t, + #[cfg(target_arch = "sparc64")] + __reserved0: ::c_int, + pub sa_flags: ::c_int, + pub sa_restorer: ::Option, + } + + pub struct statfs { + pub f_type: ::__fsword_t, + pub f_bsize: ::__fsword_t, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + + pub f_namelen: ::__fsword_t, + pub f_frsize: ::__fsword_t, + f_spare: [::__fsword_t; 5], + } + + pub struct flock { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off_t, + pub l_len: ::off_t, + pub l_pid: ::pid_t, + } + + pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_nlink: ::nlink_t, + pub st_mode: ::mode_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + __pad0: ::c_int, + pub st_rdev: ::dev_t, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused: [::c_long; 3], + } + + pub struct stat64 { + pub st_dev: ::dev_t, + pub st_ino: ::ino64_t, + pub st_nlink: ::nlink_t, + pub st_mode: ::mode_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + __pad0: ::c_int, + pub st_rdev: ::dev_t, + pub st_size: ::off64_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt64_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __reserved: [::c_long; 3], + } + + pub struct statfs64 { + pub f_type: ::__fsword_t, + pub f_bsize: ::__fsword_t, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_fsid: ::fsid_t, + pub f_namelen: ::__fsword_t, + pub f_frsize: ::__fsword_t, + pub f_flags: ::__fsword_t, + pub f_spare: [::__fsword_t; 4], + } + + pub struct statvfs { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_favail: ::fsfilcnt_t, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: u64, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct pthread_attr_t { + __size: [u64; 7] + } + + pub struct ipc_perm { + pub __key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::mode_t, + pub __seq: u32, + __pad1: u32, + __unused1: u64, + __unused2: ::c_ulong, + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_atime: ::time_t, + pub shm_dtime: ::time_t, + pub shm_ctime: ::time_t, + pub shm_segsz: ::size_t, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, + pub shm_nattch: ::shmatt_t, + __unused4: ::c_ulong, + __unused5: ::c_ulong + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + #[doc(hidden)] + #[deprecated( + since="0.2.54", + note="Please leave a comment on \ + https://github.com/rust-lang/libc/pull/1316 if you're using \ + this field" + )] + pub _pad: [::c_int; 29], + _align: [usize; 0], + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_flags: ::c_int, + pub ss_size: ::size_t + } +} + +pub const POSIX_FADV_DONTNEED: ::c_int = 4; +pub const POSIX_FADV_NOREUSE: ::c_int = 5; + +pub const RTLD_DEEPBIND: ::c_int = 0x8; +pub const RTLD_GLOBAL: ::c_int = 0x100; +pub const RTLD_NOLOAD: ::c_int = 0x4; +pub const VEOF: usize = 4; +pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; + +pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; +pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; + +pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; +pub const RLIMIT_AS: ::__rlimit_resource_t = 9; +pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; +pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7; +pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6; + +pub const O_APPEND: ::c_int = 1024; +pub const O_CREAT: ::c_int = 64; +pub const O_EXCL: ::c_int = 128; +pub const O_NOCTTY: ::c_int = 256; +pub const O_NONBLOCK: ::c_int = 2048; +pub const O_SYNC: ::c_int = 1052672; +pub const O_RSYNC: ::c_int = 1052672; +pub const O_DSYNC: ::c_int = 4096; +pub const O_FSYNC: ::c_int = 0x101000; +pub const O_NOATIME: ::c_int = 0o1000000; +pub const O_PATH: ::c_int = 0o10000000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; + +pub const MADV_SOFT_OFFLINE: ::c_int = 101; +pub const MAP_GROWSDOWN: ::c_int = 0x0100; +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_ANONYMOUS: ::c_int = 0x0020; +pub const MAP_DENYWRITE: ::c_int = 0x0800; +pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_POPULATE: ::c_int = 0x08000; +pub const MAP_NONBLOCK: ::c_int = 0x010000; +pub const MAP_STACK: ::c_int = 0x020000; +pub const MAP_HUGETLB: ::c_int = 0x040000; + +pub const EDEADLK: ::c_int = 35; +pub const ENAMETOOLONG: ::c_int = 36; +pub const ENOLCK: ::c_int = 37; +pub const ENOSYS: ::c_int = 38; +pub const ENOTEMPTY: ::c_int = 39; +pub const ELOOP: ::c_int = 40; +pub const ENOMSG: ::c_int = 42; +pub const EIDRM: ::c_int = 43; +pub const ECHRNG: ::c_int = 44; +pub const EL2NSYNC: ::c_int = 45; +pub const EL3HLT: ::c_int = 46; +pub const EL3RST: ::c_int = 47; +pub const ELNRNG: ::c_int = 48; +pub const EUNATCH: ::c_int = 49; +pub const ENOCSI: ::c_int = 50; +pub const EL2HLT: ::c_int = 51; +pub const EBADE: ::c_int = 52; +pub const EBADR: ::c_int = 53; +pub const EXFULL: ::c_int = 54; +pub const ENOANO: ::c_int = 55; +pub const EBADRQC: ::c_int = 56; +pub const EBADSLT: ::c_int = 57; +pub const EMULTIHOP: ::c_int = 72; +pub const EOVERFLOW: ::c_int = 75; +pub const ENOTUNIQ: ::c_int = 76; +pub const EBADFD: ::c_int = 77; +pub const EBADMSG: ::c_int = 74; +pub const EREMCHG: ::c_int = 78; +pub const ELIBACC: ::c_int = 79; +pub const ELIBBAD: ::c_int = 80; +pub const ELIBSCN: ::c_int = 81; +pub const ELIBMAX: ::c_int = 82; +pub const ELIBEXEC: ::c_int = 83; +pub const EILSEQ: ::c_int = 84; +pub const ERESTART: ::c_int = 85; +pub const ESTRPIPE: ::c_int = 86; +pub const EUSERS: ::c_int = 87; +pub const ENOTSOCK: ::c_int = 88; +pub const EDESTADDRREQ: ::c_int = 89; +pub const EMSGSIZE: ::c_int = 90; +pub const EPROTOTYPE: ::c_int = 91; +pub const ENOPROTOOPT: ::c_int = 92; +pub const EPROTONOSUPPORT: ::c_int = 93; +pub const ESOCKTNOSUPPORT: ::c_int = 94; +pub const EOPNOTSUPP: ::c_int = 95; +pub const EPFNOSUPPORT: ::c_int = 96; +pub const EAFNOSUPPORT: ::c_int = 97; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const ENETDOWN: ::c_int = 100; +pub const ENETUNREACH: ::c_int = 101; +pub const ENETRESET: ::c_int = 102; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNRESET: ::c_int = 104; +pub const ENOBUFS: ::c_int = 105; +pub const EISCONN: ::c_int = 106; +pub const ENOTCONN: ::c_int = 107; +pub const ESHUTDOWN: ::c_int = 108; +pub const ETOOMANYREFS: ::c_int = 109; +pub const ETIMEDOUT: ::c_int = 110; +pub const ECONNREFUSED: ::c_int = 111; +pub const EHOSTDOWN: ::c_int = 112; +pub const EHOSTUNREACH: ::c_int = 113; +pub const EALREADY: ::c_int = 114; +pub const EINPROGRESS: ::c_int = 115; +pub const ESTALE: ::c_int = 116; +pub const EDQUOT: ::c_int = 122; +pub const ENOMEDIUM: ::c_int = 123; +pub const EMEDIUMTYPE: ::c_int = 124; +pub const ECANCELED: ::c_int = 125; +pub const ENOKEY: ::c_int = 126; +pub const EKEYEXPIRED: ::c_int = 127; +pub const EKEYREVOKED: ::c_int = 128; +pub const EKEYREJECTED: ::c_int = 129; +pub const EOWNERDEAD: ::c_int = 130; +pub const ENOTRECOVERABLE: ::c_int = 131; +pub const EHWPOISON: ::c_int = 133; +pub const ERFKILL: ::c_int = 132; + +pub const SOL_SOCKET: ::c_int = 1; + +pub const SO_REUSEADDR: ::c_int = 2; +pub const SO_TYPE: ::c_int = 3; +pub const SO_ERROR: ::c_int = 4; +pub const SO_DONTROUTE: ::c_int = 5; +pub const SO_BROADCAST: ::c_int = 6; +pub const SO_SNDBUF: ::c_int = 7; +pub const SO_RCVBUF: ::c_int = 8; +pub const SO_SNDBUFFORCE: ::c_int = 32; +pub const SO_RCVBUFFORCE: ::c_int = 33; +pub const SO_KEEPALIVE: ::c_int = 9; +pub const SO_OOBINLINE: ::c_int = 10; +pub const SO_NO_CHECK: ::c_int = 11; +pub const SO_PRIORITY: ::c_int = 12; +pub const SO_LINGER: ::c_int = 13; +pub const SO_BSDCOMPAT: ::c_int = 14; +pub const SO_REUSEPORT: ::c_int = 15; +pub const SO_PASSCRED: ::c_int = 20; +pub const SO_PEERCRED: ::c_int = 21; +pub const SO_RCVLOWAT: ::c_int = 16; +pub const SO_SNDLOWAT: ::c_int = 17; +pub const SO_RCVTIMEO: ::c_int = 18; +pub const SO_SNDTIMEO: ::c_int = 19; +pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22; +pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23; +pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24; +pub const SO_BINDTODEVICE: ::c_int = 25; +pub const SO_ATTACH_FILTER: ::c_int = 26; +pub const SO_DETACH_FILTER: ::c_int = 27; +pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER; +pub const SO_PEERNAME: ::c_int = 28; +pub const SO_TIMESTAMP: ::c_int = 29; +pub const SO_ACCEPTCONN: ::c_int = 30; +pub const SO_PEERSEC: ::c_int = 31; +pub const SO_PASSSEC: ::c_int = 34; +pub const SO_TIMESTAMPNS: ::c_int = 35; +pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS; +pub const SO_MARK: ::c_int = 36; +pub const SO_PROTOCOL: ::c_int = 38; +pub const SO_DOMAIN: ::c_int = 39; +pub const SO_RXQ_OVFL: ::c_int = 40; +pub const SO_WIFI_STATUS: ::c_int = 41; +pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS; +pub const SO_PEEK_OFF: ::c_int = 42; +pub const SO_NOFCS: ::c_int = 43; +pub const SO_LOCK_FILTER: ::c_int = 44; +pub const SO_SELECT_ERR_QUEUE: ::c_int = 45; +pub const SO_BUSY_POLL: ::c_int = 46; +pub const SO_MAX_PACING_RATE: ::c_int = 47; +pub const SO_BPF_EXTENSIONS: ::c_int = 48; +pub const SO_INCOMING_CPU: ::c_int = 49; +pub const SO_ATTACH_BPF: ::c_int = 50; +pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER; + +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; + +pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_SIGINFO: ::c_int = 0x00000004; +pub const SA_NOCLDWAIT: ::c_int = 0x00000002; + +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; +pub const SIGCHLD: ::c_int = 17; +pub const SIGBUS: ::c_int = 7; +pub const SIGUSR1: ::c_int = 10; +pub const SIGUSR2: ::c_int = 12; +pub const SIGCONT: ::c_int = 18; +pub const SIGSTOP: ::c_int = 19; +pub const SIGTSTP: ::c_int = 20; +pub const SIGURG: ::c_int = 23; +pub const SIGIO: ::c_int = 29; +pub const SIGSYS: ::c_int = 31; +pub const SIGSTKFLT: ::c_int = 16; +#[deprecated( + since = "0.2.55", + note = "Use SIGSYS instead" +)] +pub const SIGUNUSED: ::c_int = 31; +pub const SIGPOLL: ::c_int = 29; +pub const SIGPWR: ::c_int = 30; +pub const SIG_SETMASK: ::c_int = 2; +pub const SIG_BLOCK: ::c_int = 0x000000; +pub const SIG_UNBLOCK: ::c_int = 0x01; + +pub const POLLWRNORM: ::c_short = 0x100; +pub const POLLWRBAND: ::c_short = 0x200; + +pub const O_ASYNC: ::c_int = 0x2000; +pub const O_NDELAY: ::c_int = 0x800; + +pub const PTRACE_DETACH: ::c_uint = 17; + +pub const EFD_NONBLOCK: ::c_int = 0x800; + +pub const F_GETLK: ::c_int = 5; +pub const F_GETOWN: ::c_int = 9; +pub const F_SETOWN: ::c_int = 8; +pub const F_SETLK: ::c_int = 6; +pub const F_SETLKW: ::c_int = 7; + +pub const F_RDLCK: ::c_int = 0; +pub const F_WRLCK: ::c_int = 1; +pub const F_UNLCK: ::c_int = 2; + +pub const SFD_NONBLOCK: ::c_int = 0x0800; + +pub const TCSANOW: ::c_int = 0; +pub const TCSADRAIN: ::c_int = 1; +pub const TCSAFLUSH: ::c_int = 2; + +pub const TIOCLINUX: ::c_ulong = 0x541C; +pub const TIOCGSERIAL: ::c_ulong = 0x541E; +pub const TIOCEXCL: ::c_ulong = 0x540C; +pub const TIOCNXCL: ::c_ulong = 0x540D; +pub const TIOCSCTTY: ::c_ulong = 0x540E; +pub const TIOCSTI: ::c_ulong = 0x5412; +pub const TIOCMGET: ::c_ulong = 0x5415; +pub const TIOCMBIS: ::c_ulong = 0x5416; +pub const TIOCMBIC: ::c_ulong = 0x5417; +pub const TIOCMSET: ::c_ulong = 0x5418; +pub const TIOCCONS: ::c_ulong = 0x541D; +pub const TIOCGRS485: ::c_int = 0x542E; +pub const TIOCSRS485: ::c_int = 0x542F; + +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; + +pub const SFD_CLOEXEC: ::c_int = 0x080000; + +pub const NCCS: usize = 32; + +pub const O_TRUNC: ::c_int = 512; + +pub const O_CLOEXEC: ::c_int = 0x80000; + +pub const EBFONT: ::c_int = 59; +pub const ENOSTR: ::c_int = 60; +pub const ENODATA: ::c_int = 61; +pub const ETIME: ::c_int = 62; +pub const ENOSR: ::c_int = 63; +pub const ENONET: ::c_int = 64; +pub const ENOPKG: ::c_int = 65; +pub const EREMOTE: ::c_int = 66; +pub const ENOLINK: ::c_int = 67; +pub const EADV: ::c_int = 68; +pub const ESRMNT: ::c_int = 69; +pub const ECOMM: ::c_int = 70; +pub const EPROTO: ::c_int = 71; +pub const EDOTDOT: ::c_int = 73; + +pub const SA_NODEFER: ::c_int = 0x40000000; +pub const SA_RESETHAND: ::c_int = 0x80000000; +pub const SA_RESTART: ::c_int = 0x10000000; +pub const SA_NOCLDSTOP: ::c_int = 0x00000001; + +pub const EPOLL_CLOEXEC: ::c_int = 0x80000; + +pub const EFD_CLOEXEC: ::c_int = 0x80000; + +pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; +pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; + +align_const! { + #[cfg(target_endian = "little")] + pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 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, 0, + ], + }; + #[cfg(target_endian = "little")] + pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + #[cfg(target_endian = "little")] + pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + #[cfg(target_endian = "big")] + pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 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, + ], + }; + #[cfg(target_endian = "big")] + pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + #[cfg(target_endian = "big")] + pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; +} + +pub const O_DIRECTORY: ::c_int = 0x4000; +pub const O_NOFOLLOW: ::c_int = 0x8000; +pub const O_DIRECT: ::c_int = 0x20000; + +pub const MAP_LOCKED: ::c_int = 0x00080; +pub const MAP_NORESERVE: ::c_int = 0x00040; + +pub const EDEADLOCK: ::c_int = 58; +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; + +pub const FIOCLEX: ::c_ulong = 0x20006601; +pub const FIONCLEX: ::c_ulong = 0x20006602; +pub const FIONBIO: ::c_ulong = 0x8004667e; + +pub const MCL_CURRENT: ::c_int = 0x2000; +pub const MCL_FUTURE: ::c_int = 0x4000; + +pub const SIGSTKSZ: ::size_t = 0x4000; +pub const MINSIGSTKSZ: ::size_t = 4096; +pub const CBAUD: ::tcflag_t = 0xff; +pub const TAB1: ::tcflag_t = 0x400; +pub const TAB2: ::tcflag_t = 0x800; +pub const TAB3: ::tcflag_t = 0xc00; +pub const CR1: ::tcflag_t = 0x1000; +pub const CR2: ::tcflag_t = 0x2000; +pub const CR3: ::tcflag_t = 0x3000; +pub const FF1: ::tcflag_t = 0x4000; +pub const BS1: ::tcflag_t = 0x8000; +pub const VT1: ::tcflag_t = 0x10000; +pub const VWERASE: usize = 0xa; +pub const VREPRINT: usize = 0xb; +pub const VSUSP: usize = 0xc; +pub const VSTART: usize = 0xd; +pub const VSTOP: usize = 0xe; +pub const VDISCARD: usize = 0x10; +pub const VTIME: usize = 0x7; +pub const IXON: ::tcflag_t = 0x200; +pub const IXOFF: ::tcflag_t = 0x400; +pub const ONLCR: ::tcflag_t = 0x2; +pub const CSIZE: ::tcflag_t = 0x300; +pub const CS6: ::tcflag_t = 0x100; +pub const CS7: ::tcflag_t = 0x200; +pub const CS8: ::tcflag_t = 0x300; +pub const CSTOPB: ::tcflag_t = 0x400; +pub const CREAD: ::tcflag_t = 0x800; +pub const PARENB: ::tcflag_t = 0x1000; +pub const PARODD: ::tcflag_t = 0x2000; +pub const HUPCL: ::tcflag_t = 0x4000; +pub const CLOCAL: ::tcflag_t = 0x8000; +pub const ECHOKE: ::tcflag_t = 0x1; +pub const ECHOE: ::tcflag_t = 0x2; +pub const ECHOK: ::tcflag_t = 0x4; +pub const ECHONL: ::tcflag_t = 0x10; +pub const ECHOPRT: ::tcflag_t = 0x20; +pub const ECHOCTL: ::tcflag_t = 0x40; +pub const ISIG: ::tcflag_t = 0x80; +pub const ICANON: ::tcflag_t = 0x100; +pub const PENDIN: ::tcflag_t = 0x20000000; +pub const NOFLSH: ::tcflag_t = 0x80000000; +pub const VSWTC: usize = 9; +pub const OLCUC: ::tcflag_t = 0o000004; +pub const NLDLY: ::tcflag_t = 0o001400; +pub const CRDLY: ::tcflag_t = 0o030000; +pub const TABDLY: ::tcflag_t = 0o006000; +pub const BSDLY: ::tcflag_t = 0o100000; +pub const FFDLY: ::tcflag_t = 0o040000; +pub const VTDLY: ::tcflag_t = 0o200000; +pub const XTABS: ::tcflag_t = 0o006000; + +pub const B0: ::speed_t = 0o000000; +pub const B50: ::speed_t = 0o000001; +pub const B75: ::speed_t = 0o000002; +pub const B110: ::speed_t = 0o000003; +pub const B134: ::speed_t = 0o000004; +pub const B150: ::speed_t = 0o000005; +pub const B200: ::speed_t = 0o000006; +pub const B300: ::speed_t = 0o000007; +pub const B600: ::speed_t = 0o000010; +pub const B1200: ::speed_t = 0o000011; +pub const B1800: ::speed_t = 0o000012; +pub const B2400: ::speed_t = 0o000013; +pub const B4800: ::speed_t = 0o000014; +pub const B9600: ::speed_t = 0o000015; +pub const B19200: ::speed_t = 0o000016; +pub const B38400: ::speed_t = 0o000017; +pub const EXTA: ::speed_t = B19200; +pub const EXTB: ::speed_t = B38400; +pub const CBAUDEX: ::speed_t = 0o000020; +pub const B57600: ::speed_t = 0o0020; +pub const B115200: ::speed_t = 0o0021; +pub const B230400: ::speed_t = 0o0022; +pub const B460800: ::speed_t = 0o0023; +pub const B500000: ::speed_t = 0o0024; +pub const B576000: ::speed_t = 0o0025; +pub const B921600: ::speed_t = 0o0026; +pub const B1000000: ::speed_t = 0o0027; +pub const B1152000: ::speed_t = 0o0030; +pub const B1500000: ::speed_t = 0o0031; +pub const B2000000: ::speed_t = 0o0032; +pub const B2500000: ::speed_t = 0o0033; +pub const B3000000: ::speed_t = 0o0034; +pub const B3500000: ::speed_t = 0o0035; +pub const B4000000: ::speed_t = 0o0036; +pub const BOTHER: ::speed_t = 0o0037; + +pub const VEOL: usize = 6; +pub const VEOL2: usize = 8; +pub const VMIN: usize = 5; +pub const IEXTEN: ::tcflag_t = 0x400; +pub const TOSTOP: ::tcflag_t = 0x400000; +pub const FLUSHO: ::tcflag_t = 0x800000; +pub const EXTPROC: ::tcflag_t = 0x10000000; +pub const TCGETS: ::c_ulong = 0x403c7413; +pub const TCSETS: ::c_ulong = 0x803c7414; +pub const TCSETSW: ::c_ulong = 0x803c7415; +pub const TCSETSF: ::c_ulong = 0x803c7416; +pub const TCGETA: ::c_ulong = 0x40147417; +pub const TCSETA: ::c_ulong = 0x80147418; +pub const TCSETAW: ::c_ulong = 0x80147419; +pub const TCSETAF: ::c_ulong = 0x8014741c; +pub const TCSBRK: ::c_ulong = 0x2000741d; +pub const TCXONC: ::c_ulong = 0x2000741e; +pub const TCFLSH: ::c_ulong = 0x2000741f; +pub const TIOCINQ: ::c_ulong = 0x4004667f; +pub const TIOCGPGRP: ::c_ulong = 0x40047477; +pub const TIOCSPGRP: ::c_ulong = 0x80047476; +pub const TIOCOUTQ: ::c_ulong = 0x40047473; +pub const TIOCGWINSZ: ::c_ulong = 0x40087468; +pub const TIOCSWINSZ: ::c_ulong = 0x80087467; +pub const FIONREAD: ::c_ulong = 0x4004667f; + +// Syscall table +pub const SYS_restart_syscall: ::c_long = 0; +pub const SYS_exit: ::c_long = 1; +pub const SYS_fork: ::c_long = 2; +pub const SYS_read: ::c_long = 3; +pub const SYS_write: ::c_long = 4; +pub const SYS_open: ::c_long = 5; +pub const SYS_close: ::c_long = 6; +pub const SYS_waitpid: ::c_long = 7; +pub const SYS_creat: ::c_long = 8; +pub const SYS_link: ::c_long = 9; +pub const SYS_unlink: ::c_long = 10; +pub const SYS_execve: ::c_long = 11; +pub const SYS_chdir: ::c_long = 12; +pub const SYS_time: ::c_long = 13; +pub const SYS_mknod: ::c_long = 14; +pub const SYS_chmod: ::c_long = 15; +pub const SYS_lchown: ::c_long = 16; +pub const SYS_break: ::c_long = 17; +pub const SYS_oldstat: ::c_long = 18; +pub const SYS_lseek: ::c_long = 19; +pub const SYS_getpid: ::c_long = 20; +pub const SYS_mount: ::c_long = 21; +pub const SYS_umount: ::c_long = 22; +pub const SYS_setuid: ::c_long = 23; +pub const SYS_getuid: ::c_long = 24; +pub const SYS_stime: ::c_long = 25; +pub const SYS_ptrace: ::c_long = 26; +pub const SYS_alarm: ::c_long = 27; +pub const SYS_oldfstat: ::c_long = 28; +pub const SYS_pause: ::c_long = 29; +pub const SYS_utime: ::c_long = 30; +pub const SYS_stty: ::c_long = 31; +pub const SYS_gtty: ::c_long = 32; +pub const SYS_access: ::c_long = 33; +pub const SYS_nice: ::c_long = 34; +pub const SYS_ftime: ::c_long = 35; +pub const SYS_sync: ::c_long = 36; +pub const SYS_kill: ::c_long = 37; +pub const SYS_rename: ::c_long = 38; +pub const SYS_mkdir: ::c_long = 39; +pub const SYS_rmdir: ::c_long = 40; +pub const SYS_dup: ::c_long = 41; +pub const SYS_pipe: ::c_long = 42; +pub const SYS_times: ::c_long = 43; +pub const SYS_prof: ::c_long = 44; +pub const SYS_brk: ::c_long = 45; +pub const SYS_setgid: ::c_long = 46; +pub const SYS_getgid: ::c_long = 47; +pub const SYS_signal: ::c_long = 48; +pub const SYS_geteuid: ::c_long = 49; +pub const SYS_getegid: ::c_long = 50; +pub const SYS_acct: ::c_long = 51; +pub const SYS_umount2: ::c_long = 52; +pub const SYS_lock: ::c_long = 53; +pub const SYS_ioctl: ::c_long = 54; +pub const SYS_fcntl: ::c_long = 55; +pub const SYS_mpx: ::c_long = 56; +pub const SYS_setpgid: ::c_long = 57; +pub const SYS_ulimit: ::c_long = 58; +pub const SYS_oldolduname: ::c_long = 59; +pub const SYS_umask: ::c_long = 60; +pub const SYS_chroot: ::c_long = 61; +pub const SYS_ustat: ::c_long = 62; +pub const SYS_dup2: ::c_long = 63; +pub const SYS_getppid: ::c_long = 64; +pub const SYS_getpgrp: ::c_long = 65; +pub const SYS_setsid: ::c_long = 66; +pub const SYS_sigaction: ::c_long = 67; +pub const SYS_sgetmask: ::c_long = 68; +pub const SYS_ssetmask: ::c_long = 69; +pub const SYS_setreuid: ::c_long = 70; +pub const SYS_setregid: ::c_long = 71; +pub const SYS_sigsuspend: ::c_long = 72; +pub const SYS_sigpending: ::c_long = 73; +pub const SYS_sethostname: ::c_long = 74; +pub const SYS_setrlimit: ::c_long = 75; +pub const SYS_getrlimit: ::c_long = 76; +pub const SYS_getrusage: ::c_long = 77; +pub const SYS_gettimeofday: ::c_long = 78; +pub const SYS_settimeofday: ::c_long = 79; +pub const SYS_getgroups: ::c_long = 80; +pub const SYS_setgroups: ::c_long = 81; +pub const SYS_select: ::c_long = 82; +pub const SYS_symlink: ::c_long = 83; +pub const SYS_oldlstat: ::c_long = 84; +pub const SYS_readlink: ::c_long = 85; +pub const SYS_uselib: ::c_long = 86; +pub const SYS_swapon: ::c_long = 87; +pub const SYS_reboot: ::c_long = 88; +pub const SYS_readdir: ::c_long = 89; +pub const SYS_mmap: ::c_long = 90; +pub const SYS_munmap: ::c_long = 91; +pub const SYS_truncate: ::c_long = 92; +pub const SYS_ftruncate: ::c_long = 93; +pub const SYS_fchmod: ::c_long = 94; +pub const SYS_fchown: ::c_long = 95; +pub const SYS_getpriority: ::c_long = 96; +pub const SYS_setpriority: ::c_long = 97; +pub const SYS_profil: ::c_long = 98; +pub const SYS_statfs: ::c_long = 99; +pub const SYS_fstatfs: ::c_long = 100; +pub const SYS_ioperm: ::c_long = 101; +pub const SYS_socketcall: ::c_long = 102; +pub const SYS_syslog: ::c_long = 103; +pub const SYS_setitimer: ::c_long = 104; +pub const SYS_getitimer: ::c_long = 105; +pub const SYS_stat: ::c_long = 106; +pub const SYS_lstat: ::c_long = 107; +pub const SYS_fstat: ::c_long = 108; +pub const SYS_olduname: ::c_long = 109; +pub const SYS_iopl: ::c_long = 110; +pub const SYS_vhangup: ::c_long = 111; +pub const SYS_idle: ::c_long = 112; +pub const SYS_vm86: ::c_long = 113; +pub const SYS_wait4: ::c_long = 114; +pub const SYS_swapoff: ::c_long = 115; +pub const SYS_sysinfo: ::c_long = 116; +pub const SYS_ipc: ::c_long = 117; +pub const SYS_fsync: ::c_long = 118; +pub const SYS_sigreturn: ::c_long = 119; +pub const SYS_clone: ::c_long = 120; +pub const SYS_setdomainname: ::c_long = 121; +pub const SYS_uname: ::c_long = 122; +pub const SYS_modify_ldt: ::c_long = 123; +pub const SYS_adjtimex: ::c_long = 124; +pub const SYS_mprotect: ::c_long = 125; +pub const SYS_sigprocmask: ::c_long = 126; +pub const SYS_create_module: ::c_long = 127; +pub const SYS_init_module: ::c_long = 128; +pub const SYS_delete_module: ::c_long = 129; +pub const SYS_get_kernel_syms: ::c_long = 130; +pub const SYS_quotactl: ::c_long = 131; +pub const SYS_getpgid: ::c_long = 132; +pub const SYS_fchdir: ::c_long = 133; +pub const SYS_bdflush: ::c_long = 134; +pub const SYS_sysfs: ::c_long = 135; +pub const SYS_personality: ::c_long = 136; +pub const SYS_afs_syscall: ::c_long = 137; /* Syscall for Andrew File System */ +pub const SYS_setfsuid: ::c_long = 138; +pub const SYS_setfsgid: ::c_long = 139; +pub const SYS__llseek: ::c_long = 140; +pub const SYS_getdents: ::c_long = 141; +pub const SYS__newselect: ::c_long = 142; +pub const SYS_flock: ::c_long = 143; +pub const SYS_msync: ::c_long = 144; +pub const SYS_readv: ::c_long = 145; +pub const SYS_writev: ::c_long = 146; +pub const SYS_getsid: ::c_long = 147; +pub const SYS_fdatasync: ::c_long = 148; +pub const SYS__sysctl: ::c_long = 149; +pub const SYS_mlock: ::c_long = 150; +pub const SYS_munlock: ::c_long = 151; +pub const SYS_mlockall: ::c_long = 152; +pub const SYS_munlockall: ::c_long = 153; +pub const SYS_sched_setparam: ::c_long = 154; +pub const SYS_sched_getparam: ::c_long = 155; +pub const SYS_sched_setscheduler: ::c_long = 156; +pub const SYS_sched_getscheduler: ::c_long = 157; +pub const SYS_sched_yield: ::c_long = 158; +pub const SYS_sched_get_priority_max: ::c_long = 159; +pub const SYS_sched_get_priority_min: ::c_long = 160; +pub const SYS_sched_rr_get_interval: ::c_long = 161; +pub const SYS_nanosleep: ::c_long = 162; +pub const SYS_mremap: ::c_long = 163; +pub const SYS_setresuid: ::c_long = 164; +pub const SYS_getresuid: ::c_long = 165; +pub const SYS_query_module: ::c_long = 166; +pub const SYS_poll: ::c_long = 167; +pub const SYS_nfsservctl: ::c_long = 168; +pub const SYS_setresgid: ::c_long = 169; +pub const SYS_getresgid: ::c_long = 170; +pub const SYS_prctl: ::c_long = 171; +pub const SYS_rt_sigreturn: ::c_long = 172; +pub const SYS_rt_sigaction: ::c_long = 173; +pub const SYS_rt_sigprocmask: ::c_long = 174; +pub const SYS_rt_sigpending: ::c_long = 175; +pub const SYS_rt_sigtimedwait: ::c_long = 176; +pub const SYS_rt_sigqueueinfo: ::c_long = 177; +pub const SYS_rt_sigsuspend: ::c_long = 178; +pub const SYS_pread64: ::c_long = 179; +pub const SYS_pwrite64: ::c_long = 180; +pub const SYS_chown: ::c_long = 181; +pub const SYS_getcwd: ::c_long = 182; +pub const SYS_capget: ::c_long = 183; +pub const SYS_capset: ::c_long = 184; +pub const SYS_sigaltstack: ::c_long = 185; +pub const SYS_sendfile: ::c_long = 186; +pub const SYS_getpmsg: ::c_long = 187; /* some people actually want streams */ +pub const SYS_putpmsg: ::c_long = 188; /* some people actually want streams */ +pub const SYS_vfork: ::c_long = 189; +pub const SYS_ugetrlimit: ::c_long = 190; /* SuS compliant getrlimit */ +pub const SYS_readahead: ::c_long = 191; +pub const SYS_pciconfig_read: ::c_long = 198; +pub const SYS_pciconfig_write: ::c_long = 199; +pub const SYS_pciconfig_iobase: ::c_long = 200; +pub const SYS_multiplexer: ::c_long = 201; +pub const SYS_getdents64: ::c_long = 202; +pub const SYS_pivot_root: ::c_long = 203; +pub const SYS_madvise: ::c_long = 205; +pub const SYS_mincore: ::c_long = 206; +pub const SYS_gettid: ::c_long = 207; +pub const SYS_tkill: ::c_long = 208; +pub const SYS_setxattr: ::c_long = 209; +pub const SYS_lsetxattr: ::c_long = 210; +pub const SYS_fsetxattr: ::c_long = 211; +pub const SYS_getxattr: ::c_long = 212; +pub const SYS_lgetxattr: ::c_long = 213; +pub const SYS_fgetxattr: ::c_long = 214; +pub const SYS_listxattr: ::c_long = 215; +pub const SYS_llistxattr: ::c_long = 216; +pub const SYS_flistxattr: ::c_long = 217; +pub const SYS_removexattr: ::c_long = 218; +pub const SYS_lremovexattr: ::c_long = 219; +pub const SYS_fremovexattr: ::c_long = 220; +pub const SYS_futex: ::c_long = 221; +pub const SYS_sched_setaffinity: ::c_long = 222; +pub const SYS_sched_getaffinity: ::c_long = 223; +pub const SYS_tuxcall: ::c_long = 225; +pub const SYS_io_setup: ::c_long = 227; +pub const SYS_io_destroy: ::c_long = 228; +pub const SYS_io_getevents: ::c_long = 229; +pub const SYS_io_submit: ::c_long = 230; +pub const SYS_io_cancel: ::c_long = 231; +pub const SYS_set_tid_address: ::c_long = 232; +pub const SYS_exit_group: ::c_long = 234; +pub const SYS_lookup_dcookie: ::c_long = 235; +pub const SYS_epoll_create: ::c_long = 236; +pub const SYS_epoll_ctl: ::c_long = 237; +pub const SYS_epoll_wait: ::c_long = 238; +pub const SYS_remap_file_pages: ::c_long = 239; +pub const SYS_timer_create: ::c_long = 240; +pub const SYS_timer_settime: ::c_long = 241; +pub const SYS_timer_gettime: ::c_long = 242; +pub const SYS_timer_getoverrun: ::c_long = 243; +pub const SYS_timer_delete: ::c_long = 244; +pub const SYS_clock_settime: ::c_long = 245; +pub const SYS_clock_gettime: ::c_long = 246; +pub const SYS_clock_getres: ::c_long = 247; +pub const SYS_clock_nanosleep: ::c_long = 248; +pub const SYS_swapcontext: ::c_long = 249; +pub const SYS_tgkill: ::c_long = 250; +pub const SYS_utimes: ::c_long = 251; +pub const SYS_statfs64: ::c_long = 252; +pub const SYS_fstatfs64: ::c_long = 253; +pub const SYS_rtas: ::c_long = 255; +pub const SYS_sys_debug_setcontext: ::c_long = 256; +pub const SYS_migrate_pages: ::c_long = 258; +pub const SYS_mbind: ::c_long = 259; +pub const SYS_get_mempolicy: ::c_long = 260; +pub const SYS_set_mempolicy: ::c_long = 261; +pub const SYS_mq_open: ::c_long = 262; +pub const SYS_mq_unlink: ::c_long = 263; +pub const SYS_mq_timedsend: ::c_long = 264; +pub const SYS_mq_timedreceive: ::c_long = 265; +pub const SYS_mq_notify: ::c_long = 266; +pub const SYS_mq_getsetattr: ::c_long = 267; +pub const SYS_kexec_load: ::c_long = 268; +pub const SYS_add_key: ::c_long = 269; +pub const SYS_request_key: ::c_long = 270; +pub const SYS_keyctl: ::c_long = 271; +pub const SYS_waitid: ::c_long = 272; +pub const SYS_ioprio_set: ::c_long = 273; +pub const SYS_ioprio_get: ::c_long = 274; +pub const SYS_inotify_init: ::c_long = 275; +pub const SYS_inotify_add_watch: ::c_long = 276; +pub const SYS_inotify_rm_watch: ::c_long = 277; +pub const SYS_spu_run: ::c_long = 278; +pub const SYS_spu_create: ::c_long = 279; +pub const SYS_pselect6: ::c_long = 280; +pub const SYS_ppoll: ::c_long = 281; +pub const SYS_unshare: ::c_long = 282; +pub const SYS_splice: ::c_long = 283; +pub const SYS_tee: ::c_long = 284; +pub const SYS_vmsplice: ::c_long = 285; +pub const SYS_openat: ::c_long = 286; +pub const SYS_mkdirat: ::c_long = 287; +pub const SYS_mknodat: ::c_long = 288; +pub const SYS_fchownat: ::c_long = 289; +pub const SYS_futimesat: ::c_long = 290; +pub const SYS_newfstatat: ::c_long = 291; +pub const SYS_unlinkat: ::c_long = 292; +pub const SYS_renameat: ::c_long = 293; +pub const SYS_linkat: ::c_long = 294; +pub const SYS_symlinkat: ::c_long = 295; +pub const SYS_readlinkat: ::c_long = 296; +pub const SYS_fchmodat: ::c_long = 297; +pub const SYS_faccessat: ::c_long = 298; +pub const SYS_get_robust_list: ::c_long = 299; +pub const SYS_set_robust_list: ::c_long = 300; +pub const SYS_move_pages: ::c_long = 301; +pub const SYS_getcpu: ::c_long = 302; +pub const SYS_epoll_pwait: ::c_long = 303; +pub const SYS_utimensat: ::c_long = 304; +pub const SYS_signalfd: ::c_long = 305; +pub const SYS_timerfd_create: ::c_long = 306; +pub const SYS_eventfd: ::c_long = 307; +pub const SYS_sync_file_range2: ::c_long = 308; +pub const SYS_fallocate: ::c_long = 309; +pub const SYS_subpage_prot: ::c_long = 310; +pub const SYS_timerfd_settime: ::c_long = 311; +pub const SYS_timerfd_gettime: ::c_long = 312; +pub const SYS_signalfd4: ::c_long = 313; +pub const SYS_eventfd2: ::c_long = 314; +pub const SYS_epoll_create1: ::c_long = 315; +pub const SYS_dup3: ::c_long = 316; +pub const SYS_pipe2: ::c_long = 317; +pub const SYS_inotify_init1: ::c_long = 318; +pub const SYS_perf_event_open: ::c_long = 319; +pub const SYS_preadv: ::c_long = 320; +pub const SYS_pwritev: ::c_long = 321; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 322; +pub const SYS_fanotify_init: ::c_long = 323; +pub const SYS_fanotify_mark: ::c_long = 324; +pub const SYS_prlimit64: ::c_long = 325; +pub const SYS_socket: ::c_long = 326; +pub const SYS_bind: ::c_long = 327; +pub const SYS_connect: ::c_long = 328; +pub const SYS_listen: ::c_long = 329; +pub const SYS_accept: ::c_long = 330; +pub const SYS_getsockname: ::c_long = 331; +pub const SYS_getpeername: ::c_long = 332; +pub const SYS_socketpair: ::c_long = 333; +pub const SYS_send: ::c_long = 334; +pub const SYS_sendto: ::c_long = 335; +pub const SYS_recv: ::c_long = 336; +pub const SYS_recvfrom: ::c_long = 337; +pub const SYS_shutdown: ::c_long = 338; +pub const SYS_setsockopt: ::c_long = 339; +pub const SYS_getsockopt: ::c_long = 340; +pub const SYS_sendmsg: ::c_long = 341; +pub const SYS_recvmsg: ::c_long = 342; +pub const SYS_recvmmsg: ::c_long = 343; +pub const SYS_accept4: ::c_long = 344; +pub const SYS_name_to_handle_at: ::c_long = 345; +pub const SYS_open_by_handle_at: ::c_long = 346; +pub const SYS_clock_adjtime: ::c_long = 347; +pub const SYS_syncfs: ::c_long = 348; +pub const SYS_sendmmsg: ::c_long = 349; +pub const SYS_setns: ::c_long = 350; +pub const SYS_process_vm_readv: ::c_long = 351; +pub const SYS_process_vm_writev: ::c_long = 352; +pub const SYS_finit_module: ::c_long = 353; +pub const SYS_kcmp: ::c_long = 354; +pub const SYS_sched_setattr: ::c_long = 355; +pub const SYS_sched_getattr: ::c_long = 356; +pub const SYS_renameat2: ::c_long = 357; +pub const SYS_seccomp: ::c_long = 358; +pub const SYS_getrandom: ::c_long = 359; +pub const SYS_memfd_create: ::c_long = 360; +pub const SYS_bpf: ::c_long = 361; +pub const SYS_execveat: ::c_long = 362; +pub const SYS_switch_endian: ::c_long = 363; +pub const SYS_userfaultfd: ::c_long = 364; +pub const SYS_membarrier: ::c_long = 365; +pub const SYS_mlock2: ::c_long = 378; +pub const SYS_copy_file_range: ::c_long = 379; +pub const SYS_preadv2: ::c_long = 380; +pub const SYS_pwritev2: ::c_long = 381; +pub const SYS_kexec_file_load: ::c_long = 382; +pub const SYS_statx: ::c_long = 383; + +#[link(name = "util")] +extern { + pub fn sysctl(name: *mut ::c_int, + namelen: ::c_int, + oldp: *mut ::c_void, + oldlenp: *mut ::size_t, + newp: *mut ::c_void, + newlen: ::size_t) + -> ::c_int; +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/s390x.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/s390x.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/s390x.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/s390x.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,1018 @@ +//! s390x + +use pthread_mutex_t; + +pub type blksize_t = i64; +pub type c_char = u8; +pub type c_long = i64; +pub type c_ulong = u64; +pub type nlink_t = u64; +pub type suseconds_t = i64; +pub type wchar_t = i32; +pub type greg_t = u64; +pub type __u64 = u64; + +s! { + pub struct sigaction { + pub sa_sigaction: ::sighandler_t, + __glibc_reserved0: ::c_int, + pub sa_flags: ::c_int, + pub sa_restorer: ::Option, + pub sa_mask: ::sigset_t, + } + + pub struct statfs { + pub f_type: ::c_uint, + pub f_bsize: ::c_uint, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_uint, + pub f_frsize: ::c_uint, + pub f_flags: ::c_uint, + f_spare: [::c_uint; 4], + } + + pub struct flock { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off_t, + pub l_len: ::off_t, + pub l_pid: ::pid_t, + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + _pad: ::c_int, + _pad2: [::c_long; 14], + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_flags: ::c_int, + pub ss_size: ::size_t + } + + pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_nlink: ::nlink_t, + pub st_mode: ::mode_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + st_pad0: ::c_int, + pub st_rdev: ::dev_t, + pub st_size: ::off_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + __glibc_reserved: [::c_long; 3], + } + + pub struct stat64 { + pub st_dev: ::dev_t, + pub st_ino: ::ino64_t, + pub st_nlink: ::nlink_t, + pub st_mode: ::mode_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + st_pad0: ::c_int, + pub st_rdev: ::dev_t, + pub st_size: ::off_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt64_t, + __glibc_reserved: [::c_long; 3], + } + + pub struct pthread_attr_t { + __size: [::c_ulong; 7] + } + + pub struct ipc_perm { + pub __key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::mode_t, + pub __seq: ::c_ushort, + __pad1: ::c_ushort, + __unused1: ::c_ulong, + __unused2: ::c_ulong + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_atime: ::time_t, + pub shm_dtime: ::time_t, + pub shm_ctime: ::time_t, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, + pub shm_nattch: ::shmatt_t, + __unused4: ::c_ulong, + __unused5: ::c_ulong + } + + pub struct statvfs { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_favail: ::fsfilcnt_t, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct termios2 { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; 19], + pub c_ispeed: ::speed_t, + pub c_ospeed: ::speed_t, + } + + pub struct __psw_t { + pub mask: u64, + pub addr: u64, + } + + pub struct fpregset_t { + pub fpc: u32, + __pad: u32, + pub fprs: [fpreg_t; 16], + } + + pub struct mcontext_t { + pub psw: __psw_t, + pub gregs: [u64; 16], + pub aregs: [u32; 16], + pub fpregs: fpregset_t, + } + + pub struct ucontext_t { + pub uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_mcontext: mcontext_t, + pub uc_sigmask: ::sigset_t, + } + + pub struct statfs64 { + pub f_type: ::c_uint, + pub f_bsize: ::c_uint, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_uint, + pub f_frsize: ::c_uint, + pub f_flags: ::c_uint, + pub f_spare: [::c_uint; 4], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: u64, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } +} + +s_no_extra_traits!{ + // FIXME: This is actually a union. + pub struct fpreg_t { + pub d: ::c_double, + // f: ::c_float, + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for fpreg_t { + fn eq(&self, other: &fpreg_t) -> bool { + self.d == other.d + } + } + + impl Eq for fpreg_t {} + + impl ::fmt::Debug for fpreg_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("fpreg_t") + .field("d", &self.d) + .finish() + } + } + + impl ::hash::Hash for fpreg_t { + fn hash(&self, state: &mut H) { + let d: u64 = unsafe { ::mem::transmute(self.d) }; + d.hash(state); + } + } + } +} + +pub const POSIX_FADV_DONTNEED: ::c_int = 6; +pub const POSIX_FADV_NOREUSE: ::c_int = 7; + +pub const VEOF: usize = 4; +pub const RTLD_DEEPBIND: ::c_int = 0x8; +pub const RTLD_GLOBAL: ::c_int = 0x100; +pub const RTLD_NOLOAD: ::c_int = 0x4; +pub const SFD_CLOEXEC: ::c_int = 0x080000; + +pub const NCCS: usize = 32; + +pub const O_TRUNC: ::c_int = 512; +pub const O_NOATIME: ::c_int = 0o1000000; +pub const O_CLOEXEC: ::c_int = 0x80000; +pub const O_PATH: ::c_int = 0o10000000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; + +pub const EBFONT: ::c_int = 59; +pub const ENOSTR: ::c_int = 60; +pub const ENODATA: ::c_int = 61; +pub const ETIME: ::c_int = 62; +pub const ENOSR: ::c_int = 63; +pub const ENONET: ::c_int = 64; +pub const ENOPKG: ::c_int = 65; +pub const EREMOTE: ::c_int = 66; +pub const ENOLINK: ::c_int = 67; +pub const EADV: ::c_int = 68; +pub const ESRMNT: ::c_int = 69; +pub const ECOMM: ::c_int = 70; +pub const EPROTO: ::c_int = 71; +pub const EDOTDOT: ::c_int = 73; + +pub const SA_NODEFER: ::c_int = 0x40000000; +pub const SA_RESETHAND: ::c_int = 0x80000000; +pub const SA_RESTART: ::c_int = 0x10000000; +pub const SA_NOCLDSTOP: ::c_int = 0x00000001; + +pub const EPOLL_CLOEXEC: ::c_int = 0x80000; + +pub const EFD_CLOEXEC: ::c_int = 0x80000; + +pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; +pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; +pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; + +align_const! { + pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 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, + ], + }; + pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; +} + +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNREFUSED: ::c_int = 111; +pub const ECONNRESET: ::c_int = 104; +pub const EDEADLK: ::c_int = 35; +pub const ENOSYS: ::c_int = 38; +pub const ENOTCONN: ::c_int = 107; +pub const ETIMEDOUT: ::c_int = 110; +pub const FIOCLEX: ::c_ulong = 0x5451; +pub const FIONCLEX: ::c_ulong = 0x5450; +pub const FIONBIO: ::c_ulong = 0x5421; +pub const O_APPEND: ::c_int = 1024; +pub const O_CREAT: ::c_int = 64; +pub const O_EXCL: ::c_int = 128; +pub const O_NONBLOCK: ::c_int = 2048; +pub const SA_NOCLDWAIT: ::c_int = 2; +pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_SIGINFO: ::c_int = 4; +pub const SIGBUS: ::c_int = 7; +pub const SIGSTKSZ: ::size_t = 0x2000; +pub const MINSIGSTKSZ: ::size_t = 2048; +pub const SIG_SETMASK: ::c_int = 2; +pub const SOL_SOCKET: ::c_int = 1; +pub const SO_BROADCAST: ::c_int = 6; +pub const SO_ERROR: ::c_int = 4; +pub const SO_RCVTIMEO: ::c_int = 20; +pub const SO_REUSEADDR: ::c_int = 2; +pub const SO_SNDTIMEO: ::c_int = 21; +pub const SO_BINDTODEVICE: ::c_int = 25; +pub const SO_TIMESTAMP: ::c_int = 29; +pub const SO_MARK: ::c_int = 36; +pub const SO_PROTOCOL: ::c_int = 38; +pub const SO_DOMAIN: ::c_int = 39; +pub const SO_RXQ_OVFL: ::c_int = 40; +pub const SO_PEEK_OFF: ::c_int = 42; +pub const SO_BUSY_POLL: ::c_int = 46; + +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; + +pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; +pub const RLIMIT_AS: ::__rlimit_resource_t = 9; +pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; +pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7; +pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6; + +pub const O_NOCTTY: ::c_int = 256; +pub const O_SYNC: ::c_int = 1052672; +pub const O_RSYNC: ::c_int = 1052672; +pub const O_DSYNC: ::c_int = 4096; +pub const O_FSYNC: ::c_int = 0x101000; +pub const O_DIRECT: ::c_int = 0x4000; +pub const O_DIRECTORY: ::c_int = 0x10000; +pub const O_NOFOLLOW: ::c_int = 0x20000; + +pub const MADV_SOFT_OFFLINE: ::c_int = 101; +pub const MAP_GROWSDOWN: ::c_int = 0x0100; +pub const MAP_LOCKED: ::c_int = 0x02000; +pub const MAP_NORESERVE: ::c_int = 0x04000; +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_ANONYMOUS: ::c_int = 0x0020; +pub const MAP_DENYWRITE: ::c_int = 0x0800; +pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_POPULATE: ::c_int = 0x08000; +pub const MAP_NONBLOCK: ::c_int = 0x010000; +pub const MAP_STACK: ::c_int = 0x020000; +pub const MAP_HUGETLB: ::c_int = 0x040000; + +pub const EDEADLOCK: ::c_int = 35; +pub const ENAMETOOLONG: ::c_int = 36; +pub const ENOLCK: ::c_int = 37; +pub const ENOTEMPTY: ::c_int = 39; +pub const ELOOP: ::c_int = 40; +pub const ENOMSG: ::c_int = 42; +pub const EIDRM: ::c_int = 43; +pub const ECHRNG: ::c_int = 44; +pub const EL2NSYNC: ::c_int = 45; +pub const EL3HLT: ::c_int = 46; +pub const EL3RST: ::c_int = 47; +pub const ELNRNG: ::c_int = 48; +pub const EUNATCH: ::c_int = 49; +pub const ENOCSI: ::c_int = 50; +pub const EL2HLT: ::c_int = 51; +pub const EBADE: ::c_int = 52; +pub const EBADR: ::c_int = 53; +pub const EXFULL: ::c_int = 54; +pub const ENOANO: ::c_int = 55; +pub const EBADRQC: ::c_int = 56; +pub const EBADSLT: ::c_int = 57; +pub const EMULTIHOP: ::c_int = 72; +pub const EOVERFLOW: ::c_int = 75; +pub const ENOTUNIQ: ::c_int = 76; +pub const EBADFD: ::c_int = 77; +pub const EBADMSG: ::c_int = 74; +pub const EREMCHG: ::c_int = 78; +pub const ELIBACC: ::c_int = 79; +pub const ELIBBAD: ::c_int = 80; +pub const ELIBSCN: ::c_int = 81; +pub const ELIBMAX: ::c_int = 82; +pub const ELIBEXEC: ::c_int = 83; +pub const EILSEQ: ::c_int = 84; +pub const ERESTART: ::c_int = 85; +pub const ESTRPIPE: ::c_int = 86; +pub const EUSERS: ::c_int = 87; +pub const ENOTSOCK: ::c_int = 88; +pub const EDESTADDRREQ: ::c_int = 89; +pub const EMSGSIZE: ::c_int = 90; +pub const EPROTOTYPE: ::c_int = 91; +pub const ENOPROTOOPT: ::c_int = 92; +pub const EPROTONOSUPPORT: ::c_int = 93; +pub const ESOCKTNOSUPPORT: ::c_int = 94; +pub const EOPNOTSUPP: ::c_int = 95; +pub const EPFNOSUPPORT: ::c_int = 96; +pub const EAFNOSUPPORT: ::c_int = 97; +pub const ENETDOWN: ::c_int = 100; +pub const ENETUNREACH: ::c_int = 101; +pub const ENETRESET: ::c_int = 102; +pub const ENOBUFS: ::c_int = 105; +pub const EISCONN: ::c_int = 106; +pub const ESHUTDOWN: ::c_int = 108; +pub const ETOOMANYREFS: ::c_int = 109; +pub const EHOSTDOWN: ::c_int = 112; +pub const EHOSTUNREACH: ::c_int = 113; +pub const EALREADY: ::c_int = 114; +pub const EINPROGRESS: ::c_int = 115; +pub const ESTALE: ::c_int = 116; +pub const EDQUOT: ::c_int = 122; +pub const ENOMEDIUM: ::c_int = 123; +pub const EMEDIUMTYPE: ::c_int = 124; +pub const ECANCELED: ::c_int = 125; +pub const ENOKEY: ::c_int = 126; +pub const EKEYEXPIRED: ::c_int = 127; +pub const EKEYREVOKED: ::c_int = 128; +pub const EKEYREJECTED: ::c_int = 129; +pub const EOWNERDEAD: ::c_int = 130; +pub const ENOTRECOVERABLE: ::c_int = 131; +pub const EHWPOISON: ::c_int = 133; +pub const ERFKILL: ::c_int = 132; + +pub const SO_TYPE: ::c_int = 3; +pub const SO_DONTROUTE: ::c_int = 5; +pub const SO_SNDBUF: ::c_int = 7; +pub const SO_RCVBUF: ::c_int = 8; +pub const SO_KEEPALIVE: ::c_int = 9; +pub const SO_OOBINLINE: ::c_int = 10; +pub const SO_PRIORITY: ::c_int = 12; +pub const SO_LINGER: ::c_int = 13; +pub const SO_BSDCOMPAT: ::c_int = 14; +pub const SO_REUSEPORT: ::c_int = 15; +pub const SO_PASSCRED: ::c_int = 16; +pub const SO_PEERCRED: ::c_int = 17; +pub const SO_RCVLOWAT: ::c_int = 18; +pub const SO_SNDLOWAT: ::c_int = 19; +pub const SO_ACCEPTCONN: ::c_int = 30; +pub const SO_SNDBUFFORCE: ::c_int = 32; +pub const SO_RCVBUFFORCE: ::c_int = 33; + +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; +pub const SIGCHLD: ::c_int = 17; +pub const SIGUSR1: ::c_int = 10; +pub const SIGUSR2: ::c_int = 12; +pub const SIGCONT: ::c_int = 18; +pub const SIGSTOP: ::c_int = 19; +pub const SIGTSTP: ::c_int = 20; +pub const SIGURG: ::c_int = 23; +pub const SIGIO: ::c_int = 29; +pub const SIGSYS: ::c_int = 31; +pub const SIGSTKFLT: ::c_int = 16; +#[deprecated( + since = "0.2.55", + note = "Use SIGSYS instead" +)] +pub const SIGUNUSED: ::c_int = 31; +pub const SIGPOLL: ::c_int = 29; +pub const SIGPWR: ::c_int = 30; +pub const SIG_BLOCK: ::c_int = 0x000000; +pub const SIG_UNBLOCK: ::c_int = 0x01; + +pub const O_ASYNC: ::c_int = 0x2000; +pub const O_NDELAY: ::c_int = 0x800; + +pub const VEOL: usize = 11; +pub const VEOL2: usize = 16; +pub const VMIN: usize = 6; +pub const IEXTEN: ::tcflag_t = 0x00008000; +pub const TOSTOP: ::tcflag_t = 0x00000100; +pub const FLUSHO: ::tcflag_t = 0x00001000; + +pub const EXTPROC: ::tcflag_t = 0x00010000; + +pub const PTRACE_DETACH: ::c_uint = 17; + +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; + +pub const EFD_NONBLOCK: ::c_int = 0x800; + +pub const F_RDLCK: ::c_int = 0; +pub const F_WRLCK: ::c_int = 1; +pub const F_UNLCK: ::c_int = 2; +pub const F_GETLK: ::c_int = 5; +pub const F_GETOWN: ::c_int = 9; +pub const F_SETOWN: ::c_int = 8; +pub const F_SETLK: ::c_int = 6; +pub const F_SETLKW: ::c_int = 7; + +pub const SFD_NONBLOCK: ::c_int = 0x0800; + +pub const TCGETS: ::c_ulong = 0x5401; +pub const TCSETS: ::c_ulong = 0x5402; +pub const TCSETSW: ::c_ulong = 0x5403; +pub const TCSETSF: ::c_ulong = 0x5404; +pub const TCGETA: ::c_ulong = 0x5405; +pub const TCSETA: ::c_ulong = 0x5406; +pub const TCSETAW: ::c_ulong = 0x5407; +pub const TCSETAF: ::c_ulong = 0x5408; +pub const TCSBRK: ::c_ulong = 0x5409; +pub const TCXONC: ::c_ulong = 0x540A; +pub const TCFLSH: ::c_ulong = 0x540B; +pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; +pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; +pub const TIOCINQ: ::c_ulong = 0x541B; +pub const TIOCEXCL: ::c_ulong = 0x540C; +pub const TIOCNXCL: ::c_ulong = 0x540D; +pub const TIOCSCTTY: ::c_ulong = 0x540E; +pub const TIOCGPGRP: ::c_ulong = 0x540F; +pub const TIOCSPGRP: ::c_ulong = 0x5410; +pub const TIOCOUTQ: ::c_ulong = 0x5411; +pub const TIOCSTI: ::c_ulong = 0x5412; +pub const TIOCGWINSZ: ::c_ulong = 0x5413; +pub const TIOCSWINSZ: ::c_ulong = 0x5414; +pub const TIOCMGET: ::c_ulong = 0x5415; +pub const TIOCMBIS: ::c_ulong = 0x5416; +pub const TIOCMBIC: ::c_ulong = 0x5417; +pub const TIOCMSET: ::c_ulong = 0x5418; +pub const FIONREAD: ::c_ulong = 0x541B; +pub const TIOCCONS: ::c_ulong = 0x541D; + +pub const TCSANOW: ::c_int = 0; +pub const TCSADRAIN: ::c_int = 1; +pub const TCSAFLUSH: ::c_int = 2; + +pub const TIOCLINUX: ::c_ulong = 0x541C; +pub const TIOCGSERIAL: ::c_ulong = 0x541E; +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; + +pub const VTIME: usize = 5; +pub const VSWTC: usize = 7; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VSUSP: usize = 10; +pub const VREPRINT: usize = 12; +pub const VDISCARD: usize = 13; +pub const VWERASE: usize = 14; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const ONLCR: ::tcflag_t = 0o000004; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const CR1: ::tcflag_t = 0x00000200; +pub const CR2: ::tcflag_t = 0x00000400; +pub const CR3: ::tcflag_t = 0x00000600; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const TAB1: ::tcflag_t = 0x00000800; +pub const TAB2: ::tcflag_t = 0x00001000; +pub const TAB3: ::tcflag_t = 0x00001800; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const BS1: ::tcflag_t = 0x00002000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const FF1: ::tcflag_t = 0x00008000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const VT1: ::tcflag_t = 0x00004000; +pub const XTABS: ::tcflag_t = 0o014000; + +pub const CBAUD: ::speed_t = 0o010017; +pub const B0: ::speed_t = 0o000000; +pub const B50: ::speed_t = 0o000001; +pub const B75: ::speed_t = 0o000002; +pub const B110: ::speed_t = 0o000003; +pub const B134: ::speed_t = 0o000004; +pub const B150: ::speed_t = 0o000005; +pub const B200: ::speed_t = 0o000006; +pub const B300: ::speed_t = 0o000007; +pub const B600: ::speed_t = 0o000010; +pub const B1200: ::speed_t = 0o000011; +pub const B1800: ::speed_t = 0o000012; +pub const B2400: ::speed_t = 0o000013; +pub const B4800: ::speed_t = 0o000014; +pub const B9600: ::speed_t = 0o000015; +pub const B19200: ::speed_t = 0o000016; +pub const B38400: ::speed_t = 0o000017; +pub const EXTA: ::speed_t = B19200; +pub const EXTB: ::speed_t = B38400; +pub const CSIZE: ::tcflag_t = 0o000060; +pub const CS6: ::tcflag_t = 0o000020; +pub const CS7: ::tcflag_t = 0o000040; +pub const CS8: ::tcflag_t = 0o000060; +pub const CSTOPB: ::tcflag_t = 0o000100; +pub const CREAD: ::tcflag_t = 0o000200; +pub const PARENB: ::tcflag_t = 0o000400; +pub const PARODD: ::tcflag_t = 0o001000; +pub const HUPCL: ::tcflag_t = 0o002000; +pub const CLOCAL: ::tcflag_t = 0o004000; +pub const CBAUDEX: ::tcflag_t = 0o010000; +pub const BOTHER: ::speed_t = 0o010000; +pub const B57600: ::speed_t = 0o010001; +pub const B115200: ::speed_t = 0o010002; +pub const B230400: ::speed_t = 0o010003; +pub const B460800: ::speed_t = 0o010004; +pub const B500000: ::speed_t = 0o010005; +pub const B576000: ::speed_t = 0o010006; +pub const B921600: ::speed_t = 0o010007; +pub const B1000000: ::speed_t = 0o010010; +pub const B1152000: ::speed_t = 0o010011; +pub const B1500000: ::speed_t = 0o010012; +pub const B2000000: ::speed_t = 0o010013; +pub const B2500000: ::speed_t = 0o010014; +pub const B3000000: ::speed_t = 0o010015; +pub const B3500000: ::speed_t = 0o010016; +pub const B4000000: ::speed_t = 0o010017; +pub const CIBAUD: ::tcflag_t = 0o02003600000; + +pub const ISIG: ::tcflag_t = 0o000001; +pub const ICANON: ::tcflag_t = 0o000002; +pub const XCASE: ::tcflag_t = 0o000004; +pub const ECHOE: ::tcflag_t = 0o000020; +pub const ECHOK: ::tcflag_t = 0o000040; +pub const ECHONL: ::tcflag_t = 0o000100; +pub const NOFLSH: ::tcflag_t = 0o000200; +pub const ECHOCTL: ::tcflag_t = 0o001000; +pub const ECHOPRT: ::tcflag_t = 0o002000; +pub const ECHOKE: ::tcflag_t = 0o004000; +pub const PENDIN: ::tcflag_t = 0o040000; + +pub const POLLWRNORM: ::c_short = 0x100; +pub const POLLWRBAND: ::c_short = 0x200; + +pub const IXON: ::tcflag_t = 0o002000; +pub const IXOFF: ::tcflag_t = 0o010000; + +pub const SYS_exit: ::c_long = 1; +pub const SYS_fork: ::c_long = 2; +pub const SYS_read: ::c_long = 3; +pub const SYS_write: ::c_long = 4; +pub const SYS_open: ::c_long = 5; +pub const SYS_close: ::c_long = 6; +pub const SYS_restart_syscall: ::c_long = 7; +pub const SYS_creat: ::c_long = 8; +pub const SYS_link: ::c_long = 9; +pub const SYS_unlink: ::c_long = 10; +pub const SYS_execve: ::c_long = 11; +pub const SYS_chdir: ::c_long = 12; +pub const SYS_mknod: ::c_long = 14; +pub const SYS_chmod: ::c_long = 15; +pub const SYS_lseek: ::c_long = 19; +pub const SYS_getpid: ::c_long = 20; +pub const SYS_mount: ::c_long = 21; +pub const SYS_umount: ::c_long = 22; +pub const SYS_ptrace: ::c_long = 26; +pub const SYS_alarm: ::c_long = 27; +pub const SYS_pause: ::c_long = 29; +pub const SYS_utime: ::c_long = 30; +pub const SYS_access: ::c_long = 33; +pub const SYS_nice: ::c_long = 34; +pub const SYS_sync: ::c_long = 36; +pub const SYS_kill: ::c_long = 37; +pub const SYS_rename: ::c_long = 38; +pub const SYS_mkdir: ::c_long = 39; +pub const SYS_rmdir: ::c_long = 40; +pub const SYS_dup: ::c_long = 41; +pub const SYS_pipe: ::c_long = 42; +pub const SYS_times: ::c_long = 43; +pub const SYS_brk: ::c_long = 45; +pub const SYS_signal: ::c_long = 48; +pub const SYS_acct: ::c_long = 51; +pub const SYS_umount2: ::c_long = 52; +pub const SYS_ioctl: ::c_long = 54; +pub const SYS_fcntl: ::c_long = 55; +pub const SYS_setpgid: ::c_long = 57; +pub const SYS_umask: ::c_long = 60; +pub const SYS_chroot: ::c_long = 61; +pub const SYS_ustat: ::c_long = 62; +pub const SYS_dup2: ::c_long = 63; +pub const SYS_getppid: ::c_long = 64; +pub const SYS_getpgrp: ::c_long = 65; +pub const SYS_setsid: ::c_long = 66; +pub const SYS_sigaction: ::c_long = 67; +pub const SYS_sigsuspend: ::c_long = 72; +pub const SYS_sigpending: ::c_long = 73; +pub const SYS_sethostname: ::c_long = 74; +pub const SYS_setrlimit: ::c_long = 75; +pub const SYS_getrusage: ::c_long = 77; +pub const SYS_gettimeofday: ::c_long = 78; +pub const SYS_settimeofday: ::c_long = 79; +pub const SYS_symlink: ::c_long = 83; +pub const SYS_readlink: ::c_long = 85; +pub const SYS_uselib: ::c_long = 86; +pub const SYS_swapon: ::c_long = 87; +pub const SYS_reboot: ::c_long = 88; +pub const SYS_readdir: ::c_long = 89; +pub const SYS_mmap: ::c_long = 90; +pub const SYS_munmap: ::c_long = 91; +pub const SYS_truncate: ::c_long = 92; +pub const SYS_ftruncate: ::c_long = 93; +pub const SYS_fchmod: ::c_long = 94; +pub const SYS_getpriority: ::c_long = 96; +pub const SYS_setpriority: ::c_long = 97; +pub const SYS_statfs: ::c_long = 99; +pub const SYS_fstatfs: ::c_long = 100; +pub const SYS_socketcall: ::c_long = 102; +pub const SYS_syslog: ::c_long = 103; +pub const SYS_setitimer: ::c_long = 104; +pub const SYS_getitimer: ::c_long = 105; +pub const SYS_stat: ::c_long = 106; +pub const SYS_lstat: ::c_long = 107; +pub const SYS_fstat: ::c_long = 108; +pub const SYS_lookup_dcookie: ::c_long = 110; +pub const SYS_vhangup: ::c_long = 111; +pub const SYS_idle: ::c_long = 112; +pub const SYS_wait4: ::c_long = 114; +pub const SYS_swapoff: ::c_long = 115; +pub const SYS_sysinfo: ::c_long = 116; +pub const SYS_ipc: ::c_long = 117; +pub const SYS_fsync: ::c_long = 118; +pub const SYS_sigreturn: ::c_long = 119; +pub const SYS_clone: ::c_long = 120; +pub const SYS_setdomainname: ::c_long = 121; +pub const SYS_uname: ::c_long = 122; +pub const SYS_adjtimex: ::c_long = 124; +pub const SYS_mprotect: ::c_long = 125; +pub const SYS_sigprocmask: ::c_long = 126; +pub const SYS_create_module: ::c_long = 127; +pub const SYS_init_module: ::c_long = 128; +pub const SYS_delete_module: ::c_long = 129; +pub const SYS_get_kernel_syms: ::c_long = 130; +pub const SYS_quotactl: ::c_long = 131; +pub const SYS_getpgid: ::c_long = 132; +pub const SYS_fchdir: ::c_long = 133; +pub const SYS_bdflush: ::c_long = 134; +pub const SYS_sysfs: ::c_long = 135; +pub const SYS_personality: ::c_long = 136; +pub const SYS_afs_syscall: ::c_long = 137; /* Syscall for Andrew File System */ +pub const SYS_getdents: ::c_long = 141; +pub const SYS_flock: ::c_long = 143; +pub const SYS_msync: ::c_long = 144; +pub const SYS_readv: ::c_long = 145; +pub const SYS_writev: ::c_long = 146; +pub const SYS_getsid: ::c_long = 147; +pub const SYS_fdatasync: ::c_long = 148; +pub const SYS__sysctl: ::c_long = 149; +pub const SYS_mlock: ::c_long = 150; +pub const SYS_munlock: ::c_long = 151; +pub const SYS_mlockall: ::c_long = 152; +pub const SYS_munlockall: ::c_long = 153; +pub const SYS_sched_setparam: ::c_long = 154; +pub const SYS_sched_getparam: ::c_long = 155; +pub const SYS_sched_setscheduler: ::c_long = 156; +pub const SYS_sched_getscheduler: ::c_long = 157; +pub const SYS_sched_yield: ::c_long = 158; +pub const SYS_sched_get_priority_max: ::c_long = 159; +pub const SYS_sched_get_priority_min: ::c_long = 160; +pub const SYS_sched_rr_get_interval: ::c_long = 161; +pub const SYS_nanosleep: ::c_long = 162; +pub const SYS_mremap: ::c_long = 163; +pub const SYS_query_module: ::c_long = 167; +pub const SYS_poll: ::c_long = 168; +pub const SYS_nfsservctl: ::c_long = 169; +pub const SYS_prctl: ::c_long = 172; +pub const SYS_rt_sigreturn: ::c_long = 173; +pub const SYS_rt_sigaction: ::c_long = 174; +pub const SYS_rt_sigprocmask: ::c_long = 175; +pub const SYS_rt_sigpending: ::c_long = 176; +pub const SYS_rt_sigtimedwait: ::c_long = 177; +pub const SYS_rt_sigqueueinfo: ::c_long = 178; +pub const SYS_rt_sigsuspend: ::c_long = 179; +pub const SYS_pread64: ::c_long = 180; +pub const SYS_pwrite64: ::c_long = 181; +pub const SYS_getcwd: ::c_long = 183; +pub const SYS_capget: ::c_long = 184; +pub const SYS_capset: ::c_long = 185; +pub const SYS_sigaltstack: ::c_long = 186; +pub const SYS_sendfile: ::c_long = 187; +pub const SYS_getpmsg: ::c_long = 188; +pub const SYS_putpmsg: ::c_long = 189; +pub const SYS_vfork: ::c_long = 190; +pub const SYS_pivot_root: ::c_long = 217; +pub const SYS_mincore: ::c_long = 218; +pub const SYS_madvise: ::c_long = 219; +pub const SYS_getdents64: ::c_long = 220; +pub const SYS_readahead: ::c_long = 222; +pub const SYS_setxattr: ::c_long = 224; +pub const SYS_lsetxattr: ::c_long = 225; +pub const SYS_fsetxattr: ::c_long = 226; +pub const SYS_getxattr: ::c_long = 227; +pub const SYS_lgetxattr: ::c_long = 228; +pub const SYS_fgetxattr: ::c_long = 229; +pub const SYS_listxattr: ::c_long = 230; +pub const SYS_llistxattr: ::c_long = 231; +pub const SYS_flistxattr: ::c_long = 232; +pub const SYS_removexattr: ::c_long = 233; +pub const SYS_lremovexattr: ::c_long = 234; +pub const SYS_fremovexattr: ::c_long = 235; +pub const SYS_gettid: ::c_long = 236; +pub const SYS_tkill: ::c_long = 237; +pub const SYS_futex: ::c_long = 238; +pub const SYS_sched_setaffinity: ::c_long = 239; +pub const SYS_sched_getaffinity: ::c_long = 240; +pub const SYS_tgkill: ::c_long = 241; +pub const SYS_io_setup: ::c_long = 243; +pub const SYS_io_destroy: ::c_long = 244; +pub const SYS_io_getevents: ::c_long = 245; +pub const SYS_io_submit: ::c_long = 246; +pub const SYS_io_cancel: ::c_long = 247; +pub const SYS_exit_group: ::c_long = 248; +pub const SYS_epoll_create: ::c_long = 249; +pub const SYS_epoll_ctl: ::c_long = 250; +pub const SYS_epoll_wait: ::c_long = 251; +pub const SYS_set_tid_address: ::c_long = 252; +pub const SYS_fadvise64: ::c_long = 253; +pub const SYS_timer_create: ::c_long = 254; +pub const SYS_timer_settime: ::c_long = 255; +pub const SYS_timer_gettime: ::c_long = 256; +pub const SYS_timer_getoverrun: ::c_long = 257; +pub const SYS_timer_delete: ::c_long = 258; +pub const SYS_clock_settime: ::c_long = 259; +pub const SYS_clock_gettime: ::c_long = 260; +pub const SYS_clock_getres: ::c_long = 261; +pub const SYS_clock_nanosleep: ::c_long = 262; +pub const SYS_statfs64: ::c_long = 265; +pub const SYS_fstatfs64: ::c_long = 266; +pub const SYS_remap_file_pages: ::c_long = 267; +pub const SYS_mbind: ::c_long = 268; +pub const SYS_get_mempolicy: ::c_long = 269; +pub const SYS_set_mempolicy: ::c_long = 270; +pub const SYS_mq_open: ::c_long = 271; +pub const SYS_mq_unlink: ::c_long = 272; +pub const SYS_mq_timedsend: ::c_long = 273; +pub const SYS_mq_timedreceive: ::c_long = 274; +pub const SYS_mq_notify: ::c_long = 275; +pub const SYS_mq_getsetattr: ::c_long = 276; +pub const SYS_kexec_load: ::c_long = 277; +pub const SYS_add_key: ::c_long = 278; +pub const SYS_request_key: ::c_long = 279; +pub const SYS_keyctl: ::c_long = 280; +pub const SYS_waitid: ::c_long = 281; +pub const SYS_ioprio_set: ::c_long = 282; +pub const SYS_ioprio_get: ::c_long = 283; +pub const SYS_inotify_init: ::c_long = 284; +pub const SYS_inotify_add_watch: ::c_long = 285; +pub const SYS_inotify_rm_watch: ::c_long = 286; +pub const SYS_migrate_pages: ::c_long = 287; +pub const SYS_openat: ::c_long = 288; +pub const SYS_mkdirat: ::c_long = 289; +pub const SYS_mknodat: ::c_long = 290; +pub const SYS_fchownat: ::c_long = 291; +pub const SYS_futimesat: ::c_long = 292; +pub const SYS_unlinkat: ::c_long = 294; +pub const SYS_renameat: ::c_long = 295; +pub const SYS_linkat: ::c_long = 296; +pub const SYS_symlinkat: ::c_long = 297; +pub const SYS_readlinkat: ::c_long = 298; +pub const SYS_fchmodat: ::c_long = 299; +pub const SYS_faccessat: ::c_long = 300; +pub const SYS_pselect6: ::c_long = 301; +pub const SYS_ppoll: ::c_long = 302; +pub const SYS_unshare: ::c_long = 303; +pub const SYS_set_robust_list: ::c_long = 304; +pub const SYS_get_robust_list: ::c_long = 305; +pub const SYS_splice: ::c_long = 306; +pub const SYS_sync_file_range: ::c_long = 307; +pub const SYS_tee: ::c_long = 308; +pub const SYS_vmsplice: ::c_long = 309; +pub const SYS_move_pages: ::c_long = 310; +pub const SYS_getcpu: ::c_long = 311; +pub const SYS_epoll_pwait: ::c_long = 312; +pub const SYS_utimes: ::c_long = 313; +pub const SYS_fallocate: ::c_long = 314; +pub const SYS_utimensat: ::c_long = 315; +pub const SYS_signalfd: ::c_long = 316; +pub const SYS_timerfd: ::c_long = 317; +pub const SYS_eventfd: ::c_long = 318; +pub const SYS_timerfd_create: ::c_long = 319; +pub const SYS_timerfd_settime: ::c_long = 320; +pub const SYS_timerfd_gettime: ::c_long = 321; +pub const SYS_signalfd4: ::c_long = 322; +pub const SYS_eventfd2: ::c_long = 323; +pub const SYS_inotify_init1: ::c_long = 324; +pub const SYS_pipe2: ::c_long = 325; +pub const SYS_dup3: ::c_long = 326; +pub const SYS_epoll_create1: ::c_long = 327; +pub const SYS_preadv: ::c_long = 328; +pub const SYS_pwritev: ::c_long = 329; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 330; +pub const SYS_perf_event_open: ::c_long = 331; +pub const SYS_fanotify_init: ::c_long = 332; +pub const SYS_fanotify_mark: ::c_long = 333; +pub const SYS_prlimit64: ::c_long = 334; +pub const SYS_name_to_handle_at: ::c_long = 335; +pub const SYS_open_by_handle_at: ::c_long = 336; +pub const SYS_clock_adjtime: ::c_long = 337; +pub const SYS_syncfs: ::c_long = 338; +pub const SYS_setns: ::c_long = 339; +pub const SYS_process_vm_readv: ::c_long = 340; +pub const SYS_process_vm_writev: ::c_long = 341; +pub const SYS_s390_runtime_instr: ::c_long = 342; +pub const SYS_kcmp: ::c_long = 343; +pub const SYS_finit_module: ::c_long = 344; +pub const SYS_sched_setattr: ::c_long = 345; +pub const SYS_sched_getattr: ::c_long = 346; +pub const SYS_renameat2: ::c_long = 347; +pub const SYS_seccomp: ::c_long = 348; +pub const SYS_getrandom: ::c_long = 349; +pub const SYS_memfd_create: ::c_long = 350; +pub const SYS_bpf: ::c_long = 351; +pub const SYS_s390_pci_mmio_write: ::c_long = 352; +pub const SYS_s390_pci_mmio_read: ::c_long = 353; +pub const SYS_execveat: ::c_long = 354; +pub const SYS_userfaultfd: ::c_long = 355; +pub const SYS_membarrier: ::c_long = 356; +pub const SYS_recvmmsg: ::c_long = 357; +pub const SYS_sendmmsg: ::c_long = 358; +pub const SYS_socket: ::c_long = 359; +pub const SYS_socketpair: ::c_long = 360; +pub const SYS_bind: ::c_long = 361; +pub const SYS_connect: ::c_long = 362; +pub const SYS_listen: ::c_long = 363; +pub const SYS_accept4: ::c_long = 364; +pub const SYS_getsockopt: ::c_long = 365; +pub const SYS_setsockopt: ::c_long = 366; +pub const SYS_getsockname: ::c_long = 367; +pub const SYS_getpeername: ::c_long = 368; +pub const SYS_sendto: ::c_long = 369; +pub const SYS_sendmsg: ::c_long = 370; +pub const SYS_recvfrom: ::c_long = 371; +pub const SYS_recvmsg: ::c_long = 372; +pub const SYS_shutdown: ::c_long = 373; +pub const SYS_mlock2: ::c_long = 374; +pub const SYS_copy_file_range: ::c_long = 375; +pub const SYS_preadv2: ::c_long = 376; +pub const SYS_pwritev2: ::c_long = 377; +pub const SYS_lchown: ::c_long = 198; +pub const SYS_setuid: ::c_long = 213; +pub const SYS_getuid: ::c_long = 199; +pub const SYS_setgid: ::c_long = 214; +pub const SYS_getgid: ::c_long = 200; +pub const SYS_geteuid: ::c_long = 201; +pub const SYS_setreuid: ::c_long = 203; +pub const SYS_setregid: ::c_long = 204; +pub const SYS_getrlimit: ::c_long = 191; +pub const SYS_getgroups: ::c_long = 205; +pub const SYS_fchown: ::c_long = 207; +pub const SYS_setresuid: ::c_long = 208; +pub const SYS_setresgid: ::c_long = 210; +pub const SYS_getresgid: ::c_long = 211; +pub const SYS_select: ::c_long = 142; +pub const SYS_getegid: ::c_long = 202; +pub const SYS_setgroups: ::c_long = 206; +pub const SYS_getresuid: ::c_long = 209; +pub const SYS_chown: ::c_long = 212; +pub const SYS_setfsuid: ::c_long = 215; +pub const SYS_setfsgid: ::c_long = 216; +pub const SYS_newfstatat: ::c_long = 293; + +#[link(name = "util")] +extern { + + pub fn sysctl(name: *mut ::c_int, + namelen: ::c_int, + oldp: *mut ::c_void, + oldlenp: *mut ::size_t, + newp: *mut ::c_void, + newlen: ::size_t) + -> ::c_int; + pub fn getcontext(ucp: *mut ::ucontext_t) -> ::c_int; + pub fn setcontext(ucp: *const ::ucontext_t) -> ::c_int; + pub fn makecontext(ucp: *mut ::ucontext_t, + func: extern fn (), + argc: ::c_int, ...); + pub fn swapcontext(uocp: *mut ::ucontext_t, + ucp: *const ::ucontext_t) -> ::c_int; +} + diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,971 @@ +//! SPARC64-specific definitions for 64-bit linux-like values + +use pthread_mutex_t; + +pub type c_long = i64; +pub type c_ulong = u64; +pub type c_char = i8; +pub type wchar_t = i32; +pub type nlink_t = u32; +pub type blksize_t = i64; +pub type suseconds_t = i32; +pub type __u64 = ::c_ulonglong; + +s! { + pub struct sigaction { + pub sa_sigaction: ::sighandler_t, + pub sa_mask: ::sigset_t, + #[cfg(target_arch = "sparc64")] + __reserved0: ::c_int, + pub sa_flags: ::c_int, + pub sa_restorer: ::Option, + } + + pub struct statfs { + pub f_type: ::__fsword_t, + pub f_bsize: ::__fsword_t, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + + pub f_namelen: ::__fsword_t, + pub f_frsize: ::__fsword_t, + f_spare: [::__fsword_t; 5], + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + #[doc(hidden)] + #[deprecated( + since="0.2.54", + note="Please leave a comment on \ + https://github.com/rust-lang/libc/pull/1316 if you're using \ + this field" + )] + pub _pad: [::c_int; 29], + _align: [usize; 0], + } + + pub struct flock { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off_t, + pub l_len: ::off_t, + pub l_pid: ::pid_t, + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_flags: ::c_int, + pub ss_size: ::size_t + } + + pub struct stat { + pub st_dev: ::dev_t, + __pad0: u64, + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __pad1: u64, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused: [::c_long; 2], + } + + pub struct stat64 { + pub st_dev: ::dev_t, + __pad0: u64, + pub st_ino: ::ino64_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __pad2: ::c_int, + pub st_size: ::off64_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt64_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __reserved: [::c_long; 2], + } + + pub struct statfs64 { + pub f_type: ::__fsword_t, + pub f_bsize: ::__fsword_t, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_fsid: ::fsid_t, + pub f_namelen: ::__fsword_t, + pub f_frsize: ::__fsword_t, + pub f_flags: ::__fsword_t, + pub f_spare: [::__fsword_t; 4], + } + + pub struct statvfs { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_favail: ::fsfilcnt_t, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: u64, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct pthread_attr_t { + __size: [u64; 7] + } + + pub struct ipc_perm { + pub __key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::mode_t, + __pad0: u16, + pub __seq: ::c_ushort, + __unused1: ::c_ulonglong, + __unused2: ::c_ulonglong, + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_atime: ::time_t, + pub shm_dtime: ::time_t, + pub shm_ctime: ::time_t, + pub shm_segsz: ::size_t, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, + pub shm_nattch: ::shmatt_t, + __reserved1: ::c_ulong, + __reserved2: ::c_ulong + } + + pub struct termios2 { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; 19], + pub c_ispeed: ::speed_t, + pub c_ospeed: ::speed_t, + } +} + +pub const POSIX_FADV_DONTNEED: ::c_int = 4; +pub const POSIX_FADV_NOREUSE: ::c_int = 5; + +pub const VEOF: usize = 4; +pub const RTLD_DEEPBIND: ::c_int = 0x8; +pub const RTLD_GLOBAL: ::c_int = 0x100; +pub const RTLD_NOLOAD: ::c_int = 0x4; +pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; + +pub const TIOCGSOFTCAR: ::c_ulong = 0x40047464; +pub const TIOCSSOFTCAR: ::c_ulong = 0x80047465; + +pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; +pub const RLIMIT_AS: ::__rlimit_resource_t = 9; +pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; +pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 6; +pub const RLIMIT_NPROC: ::__rlimit_resource_t = 7; + +pub const O_APPEND: ::c_int = 0x8; +pub const O_CREAT: ::c_int = 0x200; +pub const O_EXCL: ::c_int = 0x800; +pub const O_NOCTTY: ::c_int = 0x8000; +pub const O_NONBLOCK: ::c_int = 0x4000; +pub const O_SYNC: ::c_int = 0x802000; +pub const O_RSYNC: ::c_int = 0x802000; +pub const O_DSYNC: ::c_int = 0x2000; +pub const O_FSYNC: ::c_int = 0x802000; +pub const O_NOATIME: ::c_int = 0x200000; +pub const O_PATH: ::c_int = 0x1000000; +pub const O_TMPFILE: ::c_int = 0x2000000 | O_DIRECTORY; + +pub const MADV_SOFT_OFFLINE: ::c_int = 101; +pub const MAP_GROWSDOWN: ::c_int = 0x0200; +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_ANONYMOUS: ::c_int = 0x0020; +pub const MAP_DENYWRITE: ::c_int = 0x0800; +pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_POPULATE: ::c_int = 0x08000; +pub const MAP_NONBLOCK: ::c_int = 0x010000; +pub const MAP_STACK: ::c_int = 0x020000; +pub const MAP_HUGETLB: ::c_int = 0x040000; + +pub const EDEADLK: ::c_int = 78; +pub const ENAMETOOLONG: ::c_int = 63; +pub const ENOLCK: ::c_int = 79; +pub const ENOSYS: ::c_int = 90; +pub const ENOTEMPTY: ::c_int = 66; +pub const ELOOP: ::c_int = 62; +pub const ENOMSG: ::c_int = 75; +pub const EIDRM: ::c_int = 77; +pub const ECHRNG: ::c_int = 94; +pub const EL2NSYNC: ::c_int = 95; +pub const EL3HLT: ::c_int = 96; +pub const EL3RST: ::c_int = 97; +pub const ELNRNG: ::c_int = 98; +pub const EUNATCH: ::c_int = 99; +pub const ENOCSI: ::c_int = 100; +pub const EL2HLT: ::c_int = 101; +pub const EBADE: ::c_int = 102; +pub const EBADR: ::c_int = 103; +pub const EXFULL: ::c_int = 104; +pub const ENOANO: ::c_int = 105; +pub const EBADRQC: ::c_int = 106; +pub const EBADSLT: ::c_int = 107; +pub const EMULTIHOP: ::c_int = 87; +pub const EOVERFLOW: ::c_int = 92; +pub const ENOTUNIQ: ::c_int = 115; +pub const EBADFD: ::c_int = 93; +pub const EBADMSG: ::c_int = 76; +pub const EREMCHG: ::c_int = 89; +pub const ELIBACC: ::c_int = 114; +pub const ELIBBAD: ::c_int = 112; +pub const ELIBSCN: ::c_int = 124; +pub const ELIBMAX: ::c_int = 123; +pub const ELIBEXEC: ::c_int = 110; +pub const EILSEQ: ::c_int = 122; +pub const ERESTART: ::c_int = 116; +pub const ESTRPIPE: ::c_int = 91; +pub const EUSERS: ::c_int = 68; +pub const ENOTSOCK: ::c_int = 38; +pub const EDESTADDRREQ: ::c_int = 39; +pub const EMSGSIZE: ::c_int = 40; +pub const EPROTOTYPE: ::c_int = 41; +pub const ENOPROTOOPT: ::c_int = 42; +pub const EPROTONOSUPPORT: ::c_int = 43; +pub const ESOCKTNOSUPPORT: ::c_int = 44; +pub const EOPNOTSUPP: ::c_int = 45; +pub const EPFNOSUPPORT: ::c_int = 46; +pub const EAFNOSUPPORT: ::c_int = 47; +pub const EADDRINUSE: ::c_int = 48; +pub const EADDRNOTAVAIL: ::c_int = 49; +pub const ENETDOWN: ::c_int = 50; +pub const ENETUNREACH: ::c_int = 51; +pub const ENETRESET: ::c_int = 52; +pub const ECONNABORTED: ::c_int = 53; +pub const ECONNRESET: ::c_int = 54; +pub const ENOBUFS: ::c_int = 55; +pub const EISCONN: ::c_int = 56; +pub const ENOTCONN: ::c_int = 57; +pub const ESHUTDOWN: ::c_int = 58; +pub const ETOOMANYREFS: ::c_int = 59; +pub const ETIMEDOUT: ::c_int = 60; +pub const ECONNREFUSED: ::c_int = 61; +pub const EHOSTDOWN: ::c_int = 64; +pub const EHOSTUNREACH: ::c_int = 65; +pub const EALREADY: ::c_int = 37; +pub const EINPROGRESS: ::c_int = 36; +pub const ESTALE: ::c_int = 70; +pub const EDQUOT: ::c_int = 69; +pub const ENOMEDIUM: ::c_int = 125; +pub const EMEDIUMTYPE: ::c_int = 126; +pub const ECANCELED: ::c_int = 127; +pub const ENOKEY: ::c_int = 128; +pub const EKEYEXPIRED: ::c_int = 129; +pub const EKEYREVOKED: ::c_int = 130; +pub const EKEYREJECTED: ::c_int = 131; +pub const EOWNERDEAD: ::c_int = 132; +pub const ENOTRECOVERABLE: ::c_int = 133; +pub const EHWPOISON: ::c_int = 135; +pub const ERFKILL: ::c_int = 134; + +pub const SOL_SOCKET: ::c_int = 0xffff; + +pub const SO_PASSCRED: ::c_int = 2; +pub const SO_REUSEADDR: ::c_int = 4; +pub const SO_BINDTODEVICE: ::c_int = 0x000d; +pub const SO_TIMESTAMP: ::c_int = 0x001d; +pub const SO_MARK: ::c_int = 0x0022; +pub const SO_RXQ_OVFL: ::c_int = 0x0024; +pub const SO_PEEK_OFF: ::c_int = 0x0026; +pub const SO_BUSY_POLL: ::c_int = 0x0030; +pub const SO_TYPE: ::c_int = 0x1008; +pub const SO_ERROR: ::c_int = 0x1007; +pub const SO_DONTROUTE: ::c_int = 16; +pub const SO_BROADCAST: ::c_int = 32; +pub const SO_SNDBUF: ::c_int = 0x1001; +pub const SO_RCVBUF: ::c_int = 0x1002; +pub const SO_SNDBUFFORCE: ::c_int = 0x100a; +pub const SO_RCVBUFFORCE: ::c_int = 0x100b; +pub const SO_DOMAIN: ::c_int = 0x1029; +pub const SO_KEEPALIVE: ::c_int = 8; +pub const SO_OOBINLINE: ::c_int = 0x100; +pub const SO_LINGER: ::c_int = 128; +pub const SO_REUSEPORT: ::c_int = 0x200; +pub const SO_ACCEPTCONN: ::c_int = 0x8000; + +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; + +pub const SA_ONSTACK: ::c_int = 1; +pub const SA_SIGINFO: ::c_int = 0x200; +pub const SA_NOCLDWAIT: ::c_int = 0x100; + +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; +pub const SIGCHLD: ::c_int = 20; +pub const SIGBUS: ::c_int = 10; +pub const SIGUSR1: ::c_int = 30; +pub const SIGUSR2: ::c_int = 31; +pub const SIGCONT: ::c_int = 19; +pub const SIGSTOP: ::c_int = 17; +pub const SIGTSTP: ::c_int = 18; +pub const SIGURG: ::c_int = 16; +pub const SIGIO: ::c_int = 23; +pub const SIGSYS: ::c_int = 12; +pub const SIGPOLL: ::c_int = 23; +pub const SIGPWR: ::c_int = 29; +pub const SIG_SETMASK: ::c_int = 4; +pub const SIG_BLOCK: ::c_int = 1; +pub const SIG_UNBLOCK: ::c_int = 2; + +pub const POLLWRNORM: ::c_short = 4; +pub const POLLWRBAND: ::c_short = 0x100; + +pub const O_ASYNC: ::c_int = 0x40; +pub const O_NDELAY: ::c_int = 0x4004; + +pub const PTRACE_DETACH: ::c_uint = 11; + +pub const EFD_NONBLOCK: ::c_int = 0x4000; + +pub const F_GETLK: ::c_int = 7; +pub const F_GETOWN: ::c_int = 5; +pub const F_SETOWN: ::c_int = 6; +pub const F_SETLK: ::c_int = 8; +pub const F_SETLKW: ::c_int = 9; + +pub const F_RDLCK: ::c_int = 1; +pub const F_WRLCK: ::c_int = 2; +pub const F_UNLCK: ::c_int = 3; + +pub const SFD_NONBLOCK: ::c_int = 0x4000; + +pub const TCSANOW: ::c_int = 0; +pub const TCSADRAIN: ::c_int = 1; +pub const TCSAFLUSH: ::c_int = 2; + +pub const TIOCLINUX: ::c_ulong = 0x541C; +pub const TIOCGSERIAL: ::c_ulong = 0x541E; +pub const TIOCEXCL: ::c_ulong = 0x2000740d; +pub const TIOCNXCL: ::c_ulong = 0x2000740e; +pub const TIOCSCTTY: ::c_ulong = 0x20007484; +pub const TIOCSTI: ::c_ulong = 0x80017472; +pub const TIOCMGET: ::c_ulong = 0x4004746a; +pub const TIOCMBIS: ::c_ulong = 0x8004746c; +pub const TIOCMBIC: ::c_ulong = 0x8004746b; +pub const TIOCMSET: ::c_ulong = 0x8004746d; +pub const TIOCCONS: ::c_ulong = 0x20007424; + +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; + +pub const SFD_CLOEXEC: ::c_int = 0x400000; + +pub const NCCS: usize = 17; +pub const O_TRUNC: ::c_int = 0x400; + +pub const O_CLOEXEC: ::c_int = 0x400000; + +pub const EBFONT: ::c_int = 109; +pub const ENOSTR: ::c_int = 72; +pub const ENODATA: ::c_int = 111; +pub const ETIME: ::c_int = 73; +pub const ENOSR: ::c_int = 74; +pub const ENONET: ::c_int = 80; +pub const ENOPKG: ::c_int = 113; +pub const EREMOTE: ::c_int = 71; +pub const ENOLINK: ::c_int = 82; +pub const EADV: ::c_int = 83; +pub const ESRMNT: ::c_int = 84; +pub const ECOMM: ::c_int = 85; +pub const EPROTO: ::c_int = 86; +pub const EDOTDOT: ::c_int = 88; + +pub const SA_NODEFER: ::c_int = 0x20; +pub const SA_RESETHAND: ::c_int = 0x4; +pub const SA_RESTART: ::c_int = 0x2; +pub const SA_NOCLDSTOP: ::c_int = 0x00000008; + +pub const EPOLL_CLOEXEC: ::c_int = 0x400000; + +pub const EFD_CLOEXEC: ::c_int = 0x400000; +pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; +pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; + +align_const! { + pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 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, + ], + }; + pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; +} + +pub const O_DIRECTORY: ::c_int = 0o200000; +pub const O_NOFOLLOW: ::c_int = 0o400000; +pub const O_DIRECT: ::c_int = 0x100000; + +pub const MAP_LOCKED: ::c_int = 0x0100; +pub const MAP_NORESERVE: ::c_int = 0x00040; + +pub const EDEADLOCK: ::c_int = 108; +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; + +pub const SO_PEERCRED: ::c_int = 0x40; +pub const SO_RCVLOWAT: ::c_int = 0x800; +pub const SO_SNDLOWAT: ::c_int = 0x1000; +pub const SO_RCVTIMEO: ::c_int = 0x2000; +pub const SO_SNDTIMEO: ::c_int = 0x4000; + +pub const FIOCLEX: ::c_ulong = 0x20006601; +pub const FIONCLEX: ::c_ulong = 0x20006602; +pub const FIONBIO: ::c_ulong = 0x8004667e; + +pub const MCL_CURRENT: ::c_int = 0x2000; +pub const MCL_FUTURE: ::c_int = 0x4000; + +pub const SIGSTKSZ: ::size_t = 16384; +pub const MINSIGSTKSZ: ::size_t = 4096; +pub const CBAUD: ::tcflag_t = 0x0000100f; +pub const TAB1: ::tcflag_t = 0x800; +pub const TAB2: ::tcflag_t = 0x1000; +pub const TAB3: ::tcflag_t = 0x1800; +pub const CR1: ::tcflag_t = 0x200; +pub const CR2: ::tcflag_t = 0x400; +pub const CR3: ::tcflag_t = 0x600; +pub const FF1: ::tcflag_t = 0x8000; +pub const BS1: ::tcflag_t = 0x2000; +pub const VT1: ::tcflag_t = 0x4000; +pub const VWERASE: usize = 0xe; +pub const VREPRINT: usize = 0xc; +pub const VSUSP: usize = 0xa; +pub const VSTART: usize = 0x8; +pub const VSTOP: usize = 0x9; +pub const VDISCARD: usize = 0xd; +pub const VTIME: usize = 0x5; +pub const IXON: ::tcflag_t = 0x400; +pub const IXOFF: ::tcflag_t = 0x1000; +pub const ONLCR: ::tcflag_t = 0x4; +pub const CSIZE: ::tcflag_t = 0x30; +pub const CS6: ::tcflag_t = 0x10; +pub const CS7: ::tcflag_t = 0x20; +pub const CS8: ::tcflag_t = 0x30; +pub const CSTOPB: ::tcflag_t = 0x40; +pub const CREAD: ::tcflag_t = 0x80; +pub const PARENB: ::tcflag_t = 0x100; +pub const PARODD: ::tcflag_t = 0x200; +pub const HUPCL: ::tcflag_t = 0x400; +pub const CLOCAL: ::tcflag_t = 0x800; +pub const ECHOKE: ::tcflag_t = 0x800; +pub const ECHOE: ::tcflag_t = 0x10; +pub const ECHOK: ::tcflag_t = 0x20; +pub const ECHONL: ::tcflag_t = 0x40; +pub const ECHOPRT: ::tcflag_t = 0x400; +pub const ECHOCTL: ::tcflag_t = 0x200; +pub const ISIG: ::tcflag_t = 0x1; +pub const ICANON: ::tcflag_t = 0x2; +pub const PENDIN: ::tcflag_t = 0x4000; +pub const NOFLSH: ::tcflag_t = 0x80; +pub const CIBAUD: ::tcflag_t = 0o02003600000; +pub const CBAUDEX: ::tcflag_t = 0x00001000; +pub const VSWTC: usize = 7; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const XTABS: ::tcflag_t = 0o014000; + +pub const B0: ::speed_t = 0o000000; +pub const B50: ::speed_t = 0o000001; +pub const B75: ::speed_t = 0o000002; +pub const B110: ::speed_t = 0o000003; +pub const B134: ::speed_t = 0o000004; +pub const B150: ::speed_t = 0o000005; +pub const B200: ::speed_t = 0o000006; +pub const B300: ::speed_t = 0o000007; +pub const B600: ::speed_t = 0o000010; +pub const B1200: ::speed_t = 0o000011; +pub const B1800: ::speed_t = 0o000012; +pub const B2400: ::speed_t = 0o000013; +pub const B4800: ::speed_t = 0o000014; +pub const B9600: ::speed_t = 0o000015; +pub const B19200: ::speed_t = 0o000016; +pub const B38400: ::speed_t = 0o000017; +pub const EXTA: ::speed_t = B19200; +pub const EXTB: ::speed_t = B38400; +pub const BOTHER: ::speed_t = 0x1000; +pub const B57600: ::speed_t = 0x1001; +pub const B115200: ::speed_t = 0x1002; +pub const B230400: ::speed_t = 0x1003; +pub const B460800: ::speed_t = 0x1004; +pub const B76800: ::speed_t = 0x1005; +pub const B153600: ::speed_t = 0x1006; +pub const B307200: ::speed_t = 0x1007; +pub const B614400: ::speed_t = 0x1008; +pub const B921600: ::speed_t = 0x1009; +pub const B500000: ::speed_t = 0x100a; +pub const B576000: ::speed_t = 0x100b; +pub const B1000000: ::speed_t = 0x100c; +pub const B1152000: ::speed_t = 0x100d; +pub const B1500000: ::speed_t = 0x100e; +pub const B2000000: ::speed_t = 0x100f; + +pub const VEOL: usize = 5; +pub const VEOL2: usize = 6; +pub const VMIN: usize = 4; +pub const IEXTEN: ::tcflag_t = 0x8000; +pub const TOSTOP: ::tcflag_t = 0x100; +pub const FLUSHO: ::tcflag_t = 0x1000; +pub const EXTPROC: ::tcflag_t = 0x10000; +pub const TCGETS: ::c_ulong = 0x40245408; +pub const TCSETS: ::c_ulong = 0x80245409; +pub const TCSETSW: ::c_ulong = 0x8024540a; +pub const TCSETSF: ::c_ulong = 0x8024540b; +pub const TCGETA: ::c_ulong = 0x40125401; +pub const TCSETA: ::c_ulong = 0x80125402; +pub const TCSETAW: ::c_ulong = 0x80125403; +pub const TCSETAF: ::c_ulong = 0x80125404; +pub const TCSBRK: ::c_ulong = 0x20005405; +pub const TCXONC: ::c_ulong = 0x20005406; +pub const TCFLSH: ::c_ulong = 0x20005407; +pub const TIOCINQ: ::c_ulong = 0x4004667f; +pub const TIOCGPGRP: ::c_ulong = 0x40047483; +pub const TIOCSPGRP: ::c_ulong = 0x80047482; +pub const TIOCOUTQ: ::c_ulong = 0x40047473; +pub const TIOCGWINSZ: ::c_ulong = 0x40087468; +pub const TIOCSWINSZ: ::c_ulong = 0x80087467; +pub const FIONREAD: ::c_ulong = 0x4004667f; + +pub const SYS_restart_syscall: ::c_long = 0; +pub const SYS_exit: ::c_long = 1; +pub const SYS_fork: ::c_long = 2; +pub const SYS_read: ::c_long = 3; +pub const SYS_write: ::c_long = 4; +pub const SYS_open: ::c_long = 5; +pub const SYS_close: ::c_long = 6; +pub const SYS_wait4: ::c_long = 7; +pub const SYS_creat: ::c_long = 8; +pub const SYS_link: ::c_long = 9; +pub const SYS_unlink: ::c_long = 10; +pub const SYS_execv: ::c_long = 11; +pub const SYS_chdir: ::c_long = 12; +pub const SYS_chown: ::c_long = 13; +pub const SYS_mknod: ::c_long = 14; +pub const SYS_chmod: ::c_long = 15; +pub const SYS_lchown: ::c_long = 16; +pub const SYS_brk: ::c_long = 17; +pub const SYS_perfctr: ::c_long = 18; +pub const SYS_lseek: ::c_long = 19; +pub const SYS_getpid: ::c_long = 20; +pub const SYS_capget: ::c_long = 21; +pub const SYS_capset: ::c_long = 22; +pub const SYS_setuid: ::c_long = 23; +pub const SYS_getuid: ::c_long = 24; +pub const SYS_vmsplice: ::c_long = 25; +pub const SYS_ptrace: ::c_long = 26; +pub const SYS_alarm: ::c_long = 27; +pub const SYS_sigaltstack: ::c_long = 28; +pub const SYS_pause: ::c_long = 29; +pub const SYS_utime: ::c_long = 30; +pub const SYS_access: ::c_long = 33; +pub const SYS_nice: ::c_long = 34; +pub const SYS_sync: ::c_long = 36; +pub const SYS_kill: ::c_long = 37; +pub const SYS_stat: ::c_long = 38; +pub const SYS_sendfile: ::c_long = 39; +pub const SYS_lstat: ::c_long = 40; +pub const SYS_dup: ::c_long = 41; +pub const SYS_pipe: ::c_long = 42; +pub const SYS_times: ::c_long = 43; +pub const SYS_umount2: ::c_long = 45; +pub const SYS_setgid: ::c_long = 46; +pub const SYS_getgid: ::c_long = 47; +pub const SYS_signal: ::c_long = 48; +pub const SYS_geteuid: ::c_long = 49; +pub const SYS_getegid: ::c_long = 50; +pub const SYS_acct: ::c_long = 51; +pub const SYS_memory_ordering: ::c_long = 52; +pub const SYS_ioctl: ::c_long = 54; +pub const SYS_reboot: ::c_long = 55; +pub const SYS_symlink: ::c_long = 57; +pub const SYS_readlink: ::c_long = 58; +pub const SYS_execve: ::c_long = 59; +pub const SYS_umask: ::c_long = 60; +pub const SYS_chroot: ::c_long = 61; +pub const SYS_fstat: ::c_long = 62; +pub const SYS_fstat64: ::c_long = 63; +pub const SYS_getpagesize: ::c_long = 64; +pub const SYS_msync: ::c_long = 65; +pub const SYS_vfork: ::c_long = 66; +pub const SYS_pread64: ::c_long = 67; +pub const SYS_pwrite64: ::c_long = 68; +pub const SYS_mmap: ::c_long = 71; +pub const SYS_munmap: ::c_long = 73; +pub const SYS_mprotect: ::c_long = 74; +pub const SYS_madvise: ::c_long = 75; +pub const SYS_vhangup: ::c_long = 76; +pub const SYS_mincore: ::c_long = 78; +pub const SYS_getgroups: ::c_long = 79; +pub const SYS_setgroups: ::c_long = 80; +pub const SYS_getpgrp: ::c_long = 81; +pub const SYS_setitimer: ::c_long = 83; +pub const SYS_swapon: ::c_long = 85; +pub const SYS_getitimer: ::c_long = 86; +pub const SYS_sethostname: ::c_long = 88; +pub const SYS_dup2: ::c_long = 90; +pub const SYS_fcntl: ::c_long = 92; +pub const SYS_select: ::c_long = 93; +pub const SYS_fsync: ::c_long = 95; +pub const SYS_setpriority: ::c_long = 96; +pub const SYS_socket: ::c_long = 97; +pub const SYS_connect: ::c_long = 98; +pub const SYS_accept: ::c_long = 99; +pub const SYS_getpriority: ::c_long = 100; +pub const SYS_rt_sigreturn: ::c_long = 101; +pub const SYS_rt_sigaction: ::c_long = 102; +pub const SYS_rt_sigprocmask: ::c_long = 103; +pub const SYS_rt_sigpending: ::c_long = 104; +pub const SYS_rt_sigtimedwait: ::c_long = 105; +pub const SYS_rt_sigqueueinfo: ::c_long = 106; +pub const SYS_rt_sigsuspend: ::c_long = 107; +pub const SYS_setresuid: ::c_long = 108; +pub const SYS_getresuid: ::c_long = 109; +pub const SYS_setresgid: ::c_long = 110; +pub const SYS_getresgid: ::c_long = 111; +pub const SYS_recvmsg: ::c_long = 113; +pub const SYS_sendmsg: ::c_long = 114; +pub const SYS_gettimeofday: ::c_long = 116; +pub const SYS_getrusage: ::c_long = 117; +pub const SYS_getsockopt: ::c_long = 118; +pub const SYS_getcwd: ::c_long = 119; +pub const SYS_readv: ::c_long = 120; +pub const SYS_writev: ::c_long = 121; +pub const SYS_settimeofday: ::c_long = 122; +pub const SYS_fchown: ::c_long = 123; +pub const SYS_fchmod: ::c_long = 124; +pub const SYS_recvfrom: ::c_long = 125; +pub const SYS_setreuid: ::c_long = 126; +pub const SYS_setregid: ::c_long = 127; +pub const SYS_rename: ::c_long = 128; +pub const SYS_truncate: ::c_long = 129; +pub const SYS_ftruncate: ::c_long = 130; +pub const SYS_flock: ::c_long = 131; +pub const SYS_lstat64: ::c_long = 132; +pub const SYS_sendto: ::c_long = 133; +pub const SYS_shutdown: ::c_long = 134; +pub const SYS_socketpair: ::c_long = 135; +pub const SYS_mkdir: ::c_long = 136; +pub const SYS_rmdir: ::c_long = 137; +pub const SYS_utimes: ::c_long = 138; +pub const SYS_stat64: ::c_long = 139; +pub const SYS_sendfile64: ::c_long = 140; +pub const SYS_getpeername: ::c_long = 141; +pub const SYS_futex: ::c_long = 142; +pub const SYS_gettid: ::c_long = 143; +pub const SYS_getrlimit: ::c_long = 144; +pub const SYS_setrlimit: ::c_long = 145; +pub const SYS_pivot_root: ::c_long = 146; +pub const SYS_prctl: ::c_long = 147; +pub const SYS_pciconfig_read: ::c_long = 148; +pub const SYS_pciconfig_write: ::c_long = 149; +pub const SYS_getsockname: ::c_long = 150; +pub const SYS_inotify_init: ::c_long = 151; +pub const SYS_inotify_add_watch: ::c_long = 152; +pub const SYS_poll: ::c_long = 153; +pub const SYS_getdents64: ::c_long = 154; +pub const SYS_inotify_rm_watch: ::c_long = 156; +pub const SYS_statfs: ::c_long = 157; +pub const SYS_fstatfs: ::c_long = 158; +pub const SYS_umount: ::c_long = 159; +pub const SYS_sched_set_affinity: ::c_long = 160; +pub const SYS_sched_get_affinity: ::c_long = 161; +pub const SYS_getdomainname: ::c_long = 162; +pub const SYS_setdomainname: ::c_long = 163; +pub const SYS_utrap_install: ::c_long = 164; +pub const SYS_quotactl: ::c_long = 165; +pub const SYS_set_tid_address: ::c_long = 166; +pub const SYS_mount: ::c_long = 167; +pub const SYS_ustat: ::c_long = 168; +pub const SYS_setxattr: ::c_long = 169; +pub const SYS_lsetxattr: ::c_long = 170; +pub const SYS_fsetxattr: ::c_long = 171; +pub const SYS_getxattr: ::c_long = 172; +pub const SYS_lgetxattr: ::c_long = 173; +pub const SYS_getdents: ::c_long = 174; +pub const SYS_setsid: ::c_long = 175; +pub const SYS_fchdir: ::c_long = 176; +pub const SYS_fgetxattr: ::c_long = 177; +pub const SYS_listxattr: ::c_long = 178; +pub const SYS_llistxattr: ::c_long = 179; +pub const SYS_flistxattr: ::c_long = 180; +pub const SYS_removexattr: ::c_long = 181; +pub const SYS_lremovexattr: ::c_long = 182; +pub const SYS_sigpending: ::c_long = 183; +pub const SYS_query_module: ::c_long = 184; +pub const SYS_setpgid: ::c_long = 185; +pub const SYS_fremovexattr: ::c_long = 186; +pub const SYS_tkill: ::c_long = 187; +pub const SYS_exit_group: ::c_long = 188; +pub const SYS_uname: ::c_long = 189; +pub const SYS_init_module: ::c_long = 190; +pub const SYS_personality: ::c_long = 191; +pub const SYS_remap_file_pages: ::c_long = 192; +pub const SYS_epoll_create: ::c_long = 193; +pub const SYS_epoll_ctl: ::c_long = 194; +pub const SYS_epoll_wait: ::c_long = 195; +pub const SYS_ioprio_set: ::c_long = 196; +pub const SYS_getppid: ::c_long = 197; +pub const SYS_sigaction: ::c_long = 198; +pub const SYS_sgetmask: ::c_long = 199; +pub const SYS_ssetmask: ::c_long = 200; +pub const SYS_sigsuspend: ::c_long = 201; +pub const SYS_oldlstat: ::c_long = 202; +pub const SYS_uselib: ::c_long = 203; +pub const SYS_readdir: ::c_long = 204; +pub const SYS_readahead: ::c_long = 205; +pub const SYS_socketcall: ::c_long = 206; +pub const SYS_syslog: ::c_long = 207; +pub const SYS_lookup_dcookie: ::c_long = 208; +pub const SYS_fadvise64: ::c_long = 209; +pub const SYS_fadvise64_64: ::c_long = 210; +pub const SYS_tgkill: ::c_long = 211; +pub const SYS_waitpid: ::c_long = 212; +pub const SYS_swapoff: ::c_long = 213; +pub const SYS_sysinfo: ::c_long = 214; +pub const SYS_ipc: ::c_long = 215; +pub const SYS_sigreturn: ::c_long = 216; +pub const SYS_clone: ::c_long = 217; +pub const SYS_ioprio_get: ::c_long = 218; +pub const SYS_adjtimex: ::c_long = 219; +pub const SYS_sigprocmask: ::c_long = 220; +pub const SYS_create_module: ::c_long = 221; +pub const SYS_delete_module: ::c_long = 222; +pub const SYS_get_kernel_syms: ::c_long = 223; +pub const SYS_getpgid: ::c_long = 224; +pub const SYS_bdflush: ::c_long = 225; +pub const SYS_sysfs: ::c_long = 226; +pub const SYS_afs_syscall: ::c_long = 227; +pub const SYS_setfsuid: ::c_long = 228; +pub const SYS_setfsgid: ::c_long = 229; +pub const SYS__newselect: ::c_long = 230; +pub const SYS_splice: ::c_long = 232; +pub const SYS_stime: ::c_long = 233; +pub const SYS_statfs64: ::c_long = 234; +pub const SYS_fstatfs64: ::c_long = 235; +pub const SYS__llseek: ::c_long = 236; +pub const SYS_mlock: ::c_long = 237; +pub const SYS_munlock: ::c_long = 238; +pub const SYS_mlockall: ::c_long = 239; +pub const SYS_munlockall: ::c_long = 240; +pub const SYS_sched_setparam: ::c_long = 241; +pub const SYS_sched_getparam: ::c_long = 242; +pub const SYS_sched_setscheduler: ::c_long =243; +pub const SYS_sched_getscheduler: ::c_long =244; +pub const SYS_sched_yield: ::c_long = 245; +pub const SYS_sched_get_priority_max: ::c_long =246; +pub const SYS_sched_get_priority_min: ::c_long =247; +pub const SYS_sched_rr_get_interval: ::c_long = 248; +pub const SYS_nanosleep: ::c_long = 249; +pub const SYS_mremap: ::c_long = 250; +pub const SYS__sysctl: ::c_long = 251; +pub const SYS_getsid: ::c_long = 252; +pub const SYS_fdatasync: ::c_long = 253; +pub const SYS_nfsservctl: ::c_long = 254; +pub const SYS_sync_file_range: ::c_long = 255; +pub const SYS_clock_settime: ::c_long = 256; +pub const SYS_clock_gettime: ::c_long = 257; +pub const SYS_clock_getres: ::c_long = 258; +pub const SYS_clock_nanosleep: ::c_long = 259; +pub const SYS_sched_getaffinity: ::c_long = 260; +pub const SYS_sched_setaffinity: ::c_long = 261; +pub const SYS_timer_settime: ::c_long = 262; +pub const SYS_timer_gettime: ::c_long = 263; +pub const SYS_timer_getoverrun: ::c_long = 264; +pub const SYS_timer_delete: ::c_long = 265; +pub const SYS_timer_create: ::c_long = 266; +pub const SYS_io_setup: ::c_long = 268; +pub const SYS_io_destroy: ::c_long = 269; +pub const SYS_io_submit: ::c_long = 270; +pub const SYS_io_cancel: ::c_long = 271; +pub const SYS_io_getevents: ::c_long = 272; +pub const SYS_mq_open: ::c_long = 273; +pub const SYS_mq_unlink: ::c_long = 274; +pub const SYS_mq_timedsend: ::c_long = 275; +pub const SYS_mq_timedreceive: ::c_long = 276; +pub const SYS_mq_notify: ::c_long = 277; +pub const SYS_mq_getsetattr: ::c_long = 278; +pub const SYS_waitid: ::c_long = 279; +pub const SYS_tee: ::c_long = 280; +pub const SYS_add_key: ::c_long = 281; +pub const SYS_request_key: ::c_long = 282; +pub const SYS_keyctl: ::c_long = 283; +pub const SYS_openat: ::c_long = 284; +pub const SYS_mkdirat: ::c_long = 285; +pub const SYS_mknodat: ::c_long = 286; +pub const SYS_fchownat: ::c_long = 287; +pub const SYS_futimesat: ::c_long = 288; +pub const SYS_fstatat64: ::c_long = 289; +pub const SYS_unlinkat: ::c_long = 290; +pub const SYS_renameat: ::c_long = 291; +pub const SYS_linkat: ::c_long = 292; +pub const SYS_symlinkat: ::c_long = 293; +pub const SYS_readlinkat: ::c_long = 294; +pub const SYS_fchmodat: ::c_long = 295; +pub const SYS_faccessat: ::c_long = 296; +pub const SYS_pselect6: ::c_long = 297; +pub const SYS_ppoll: ::c_long = 298; +pub const SYS_unshare: ::c_long = 299; +pub const SYS_set_robust_list: ::c_long = 300; +pub const SYS_get_robust_list: ::c_long = 301; +pub const SYS_migrate_pages: ::c_long =302; +pub const SYS_mbind: ::c_long = 303; +pub const SYS_get_mempolicy: ::c_long = 304; +pub const SYS_set_mempolicy: ::c_long = 305; +pub const SYS_kexec_load: ::c_long = 306; +pub const SYS_move_pages: ::c_long = 307; +pub const SYS_getcpu: ::c_long = 308; +pub const SYS_epoll_pwait: ::c_long = 309; +pub const SYS_utimensat: ::c_long = 310; +pub const SYS_signalfd: ::c_long = 311; +pub const SYS_timerfd_create: ::c_long = 312; +pub const SYS_eventfd: ::c_long = 313; +pub const SYS_fallocate: ::c_long = 314; +pub const SYS_timerfd_settime: ::c_long = 315; +pub const SYS_timerfd_gettime: ::c_long = 316; +pub const SYS_signalfd4: ::c_long = 317; +pub const SYS_eventfd2: ::c_long = 318; +pub const SYS_epoll_create1: ::c_long = 319; +pub const SYS_dup3: ::c_long = 320; +pub const SYS_pipe2: ::c_long = 321; +pub const SYS_inotify_init1: ::c_long = 322; +pub const SYS_accept4: ::c_long = 323; +pub const SYS_preadv: ::c_long = 324; +pub const SYS_pwritev: ::c_long = 325; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 326; +pub const SYS_perf_event_open: ::c_long = 327; +pub const SYS_recvmmsg: ::c_long = 328; +pub const SYS_fanotify_init: ::c_long = 329; +pub const SYS_fanotify_mark: ::c_long = 330; +pub const SYS_prlimit64: ::c_long = 331; +pub const SYS_name_to_handle_at: ::c_long = 332; +pub const SYS_open_by_handle_at: ::c_long = 333; +pub const SYS_clock_adjtime: ::c_long = 334; +pub const SYS_syncfs: ::c_long = 335; +pub const SYS_sendmmsg: ::c_long = 336; +pub const SYS_setns: ::c_long = 337; +pub const SYS_process_vm_readv: ::c_long = 338; +pub const SYS_process_vm_writev: ::c_long = 339; +pub const SYS_kern_features: ::c_long = 340; +pub const SYS_kcmp: ::c_long = 341; +pub const SYS_finit_module: ::c_long = 342; +pub const SYS_sched_setattr: ::c_long = 343; +pub const SYS_sched_getattr: ::c_long = 344; +pub const SYS_renameat2: ::c_long = 345; +pub const SYS_seccomp: ::c_long = 346; +pub const SYS_getrandom: ::c_long = 347; +pub const SYS_memfd_create: ::c_long = 348; +pub const SYS_bpf: ::c_long = 349; +pub const SYS_execveat: ::c_long = 350; +pub const SYS_membarrier: ::c_long = 351; +pub const SYS_userfaultfd: ::c_long = 352; +pub const SYS_bind: ::c_long = 353; +pub const SYS_listen: ::c_long = 354; +pub const SYS_setsockopt: ::c_long = 355; +pub const SYS_mlock2: ::c_long = 356; +pub const SYS_copy_file_range: ::c_long = 357; +pub const SYS_preadv2: ::c_long = 358; +pub const SYS_pwritev2: ::c_long = 359; +pub const SYS_statx: ::c_long = 360; + +#[link(name = "util")] +extern { + pub fn sysctl(name: *mut ::c_int, + namelen: ::c_int, + oldp: *mut ::c_void, + oldlenp: *mut ::size_t, + newp: *mut ::c_void, + newlen: ::size_t) + -> ::c_int; +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,903 @@ +//! x86_64-specific definitions for 64-bit linux-like values + +pub type c_char = i8; +pub type wchar_t = i32; +pub type nlink_t = u64; +pub type blksize_t = i64; +pub type greg_t = i64; +pub type suseconds_t = i64; +pub type __u64 = ::c_ulonglong; + +s! { + pub struct sigaction { + pub sa_sigaction: ::sighandler_t, + pub sa_mask: ::sigset_t, + #[cfg(target_arch = "sparc64")] + __reserved0: ::c_int, + pub sa_flags: ::c_int, + pub sa_restorer: ::Option, + } + + pub struct statfs { + pub f_type: ::__fsword_t, + pub f_bsize: ::__fsword_t, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + + pub f_namelen: ::__fsword_t, + pub f_frsize: ::__fsword_t, + f_spare: [::__fsword_t; 5], + } + + pub struct flock { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off_t, + pub l_len: ::off_t, + pub l_pid: ::pid_t, + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + #[doc(hidden)] + #[deprecated( + since="0.2.54", + note="Please leave a comment on \ + https://github.com/rust-lang/libc/pull/1316 if you're using \ + this field" + )] + pub _pad: [::c_int; 29], + _align: [u64; 0], + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_flags: ::c_int, + pub ss_size: ::size_t + } + + pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_nlink: ::nlink_t, + pub st_mode: ::mode_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + __pad0: ::c_int, + pub st_rdev: ::dev_t, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: i64, + pub st_mtime: ::time_t, + pub st_mtime_nsec: i64, + pub st_ctime: ::time_t, + pub st_ctime_nsec: i64, + __unused: [i64; 3], + } + + pub struct stat64 { + pub st_dev: ::dev_t, + pub st_ino: ::ino64_t, + pub st_nlink: ::nlink_t, + pub st_mode: ::mode_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + __pad0: ::c_int, + pub st_rdev: ::dev_t, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt64_t, + pub st_atime: ::time_t, + pub st_atime_nsec: i64, + pub st_mtime: ::time_t, + pub st_mtime_nsec: i64, + pub st_ctime: ::time_t, + pub st_ctime_nsec: i64, + __reserved: [i64; 3], + } + + pub struct statfs64 { + pub f_type: ::__fsword_t, + pub f_bsize: ::__fsword_t, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_fsid: ::fsid_t, + pub f_namelen: ::__fsword_t, + pub f_frsize: ::__fsword_t, + pub f_flags: ::__fsword_t, + pub f_spare: [::__fsword_t; 4], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: u64, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct pthread_attr_t { + #[cfg(target_pointer_width = "32")] + __size: [u32; 8], + #[cfg(target_pointer_width = "64")] + __size: [u64; 7] + } + + pub struct _libc_fpxreg { + pub significand: [u16; 4], + pub exponent: u16, + __private: [u16; 3], + } + + pub struct _libc_xmmreg { + pub element: [u32; 4], + } + + pub struct _libc_fpstate { + pub cwd: u16, + pub swd: u16, + pub ftw: u16, + pub fop: u16, + pub rip: u64, + pub rdp: u64, + pub mxcsr: u32, + pub mxcr_mask: u32, + pub _st: [_libc_fpxreg; 8], + pub _xmm: [_libc_xmmreg; 16], + __private: [u64; 12], + } + + pub struct user_regs_struct { + pub r15: ::c_ulonglong, + pub r14: ::c_ulonglong, + pub r13: ::c_ulonglong, + pub r12: ::c_ulonglong, + pub rbp: ::c_ulonglong, + pub rbx: ::c_ulonglong, + pub r11: ::c_ulonglong, + pub r10: ::c_ulonglong, + pub r9: ::c_ulonglong, + pub r8: ::c_ulonglong, + pub rax: ::c_ulonglong, + pub rcx: ::c_ulonglong, + pub rdx: ::c_ulonglong, + pub rsi: ::c_ulonglong, + pub rdi: ::c_ulonglong, + pub orig_rax: ::c_ulonglong, + pub rip: ::c_ulonglong, + pub cs: ::c_ulonglong, + pub eflags: ::c_ulonglong, + pub rsp: ::c_ulonglong, + pub ss: ::c_ulonglong, + pub fs_base: ::c_ulonglong, + pub gs_base: ::c_ulonglong, + pub ds: ::c_ulonglong, + pub es: ::c_ulonglong, + pub fs: ::c_ulonglong, + pub gs: ::c_ulonglong, + } + + pub struct user { + pub regs: user_regs_struct, + pub u_fpvalid: ::c_int, + pub i387: user_fpregs_struct, + pub u_tsize: ::c_ulonglong, + pub u_dsize: ::c_ulonglong, + pub u_ssize: ::c_ulonglong, + pub start_code: ::c_ulonglong, + pub start_stack: ::c_ulonglong, + pub signal: ::c_longlong, + __reserved: ::c_int, + #[cfg(target_pointer_width = "32")] + __pad1: u32, + pub u_ar0: *mut user_regs_struct, + #[cfg(target_pointer_width = "32")] + __pad2: u32, + pub u_fpstate: *mut user_fpregs_struct, + pub magic: ::c_ulonglong, + pub u_comm: [::c_char; 32], + pub u_debugreg: [::c_ulonglong; 8], + } + + pub struct mcontext_t { + pub gregs: [greg_t; 23], + pub fpregs: *mut _libc_fpstate, + __private: [u64; 8], + } + + pub struct ipc_perm { + pub __key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::c_ushort, + __pad1: ::c_ushort, + pub __seq: ::c_ushort, + __pad2: ::c_ushort, + __unused1: u64, + __unused2: u64 + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_atime: ::time_t, + pub shm_dtime: ::time_t, + pub shm_ctime: ::time_t, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, + pub shm_nattch: ::shmatt_t, + __unused4: u64, + __unused5: u64 + } + + pub struct termios2 { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; 19], + pub c_ispeed: ::speed_t, + pub c_ospeed: ::speed_t, + } +} + +s_no_extra_traits! { + pub struct user_fpregs_struct { + pub cwd: ::c_ushort, + pub swd: ::c_ushort, + pub ftw: ::c_ushort, + pub fop: ::c_ushort, + pub rip: ::c_ulonglong, + pub rdp: ::c_ulonglong, + pub mxcsr: ::c_uint, + pub mxcr_mask: ::c_uint, + pub st_space: [::c_uint; 32], + pub xmm_space: [::c_uint; 64], + padding: [::c_uint; 24], + } + + pub struct ucontext_t { + pub uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_mcontext: mcontext_t, + pub uc_sigmask: ::sigset_t, + __private: [u8; 512], + // FIXME: the shadow stack field requires glibc >= 2.28. + // Re-add once we drop compatibility with glibc versions older than + // 2.28. + // + // __ssp: [::c_ulonglong; 4], + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for user_fpregs_struct { + fn eq(&self, other: &user_fpregs_struct) -> bool { + self.cwd == other.cwd + && self.swd == other.swd + && self.ftw == other.ftw + && self.fop == other.fop + && self.rip == other.rip + && self.rdp == other.rdp + && self.mxcsr == other.mxcsr + && self.mxcr_mask == other.mxcr_mask + && self.st_space == other.st_space + && self + .xmm_space + .iter() + .zip(other.xmm_space.iter()) + .all(|(a,b)| a == b) + // Ignore padding field + } + } + + impl Eq for user_fpregs_struct {} + + impl ::fmt::Debug for user_fpregs_struct { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("user_fpregs_struct") + .field("cwd", &self.cwd) + .field("ftw", &self.ftw) + .field("fop", &self.fop) + .field("rip", &self.rip) + .field("rdp", &self.rdp) + .field("mxcsr", &self.mxcsr) + .field("mxcr_mask", &self.mxcr_mask) + .field("st_space", &self.st_space) + // FIXME: .field("xmm_space", &self.xmm_space) + // Ignore padding field + .finish() + } + } + + impl ::hash::Hash for user_fpregs_struct { + fn hash(&self, state: &mut H) { + self.cwd.hash(state); + self.ftw.hash(state); + self.fop.hash(state); + self.rip.hash(state); + self.rdp.hash(state); + self.mxcsr.hash(state); + self.mxcr_mask.hash(state); + self.st_space.hash(state); + self.xmm_space.hash(state); + // Ignore padding field + } + } + + impl PartialEq for ucontext_t { + fn eq(&self, other: &ucontext_t) -> bool { + self.uc_flags == other.uc_flags + && self.uc_link == other.uc_link + && self.uc_stack == other.uc_stack + && self.uc_mcontext == other.uc_mcontext + && self.uc_sigmask == other.uc_sigmask + // Ignore __private field + } + } + + impl Eq for ucontext_t {} + + impl ::fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ucontext_t") + .field("uc_flags", &self.uc_flags) + .field("uc_link", &self.uc_link) + .field("uc_stack", &self.uc_stack) + .field("uc_mcontext", &self.uc_mcontext) + .field("uc_sigmask", &self.uc_sigmask) + // Ignore __private field + .finish() + } + } + + impl ::hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { + self.uc_flags.hash(state); + self.uc_link.hash(state); + self.uc_stack.hash(state); + self.uc_mcontext.hash(state); + self.uc_sigmask.hash(state); + // Ignore __private field + } + } + } +} + +pub const POSIX_FADV_DONTNEED: ::c_int = 4; +pub const POSIX_FADV_NOREUSE: ::c_int = 5; + +pub const VEOF: usize = 4; +pub const RTLD_DEEPBIND: ::c_int = 0x8; +pub const RTLD_GLOBAL: ::c_int = 0x100; +pub const RTLD_NOLOAD: ::c_int = 0x4; +pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; +pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; +pub const TIOCGRS485: ::c_int = 0x542E; +pub const TIOCSRS485: ::c_int = 0x542F; + +pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; +pub const RLIMIT_AS: ::__rlimit_resource_t = 9; +pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; +pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7; +pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6; + +pub const O_APPEND: ::c_int = 1024; +pub const O_CREAT: ::c_int = 64; +pub const O_EXCL: ::c_int = 128; +pub const O_NOCTTY: ::c_int = 256; +pub const O_NONBLOCK: ::c_int = 2048; +pub const O_SYNC: ::c_int = 1052672; +pub const O_RSYNC: ::c_int = 1052672; +pub const O_DSYNC: ::c_int = 4096; +pub const O_FSYNC: ::c_int = 0x101000; +pub const O_NOATIME: ::c_int = 0o1000000; +pub const O_PATH: ::c_int = 0o10000000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; + +pub const MADV_SOFT_OFFLINE: ::c_int = 101; +pub const MAP_GROWSDOWN: ::c_int = 0x0100; + +pub const EDEADLK: ::c_int = 35; +pub const ENAMETOOLONG: ::c_int = 36; +pub const ENOLCK: ::c_int = 37; +pub const ENOSYS: ::c_int = 38; +pub const ENOTEMPTY: ::c_int = 39; +pub const ELOOP: ::c_int = 40; +pub const ENOMSG: ::c_int = 42; +pub const EIDRM: ::c_int = 43; +pub const ECHRNG: ::c_int = 44; +pub const EL2NSYNC: ::c_int = 45; +pub const EL3HLT: ::c_int = 46; +pub const EL3RST: ::c_int = 47; +pub const ELNRNG: ::c_int = 48; +pub const EUNATCH: ::c_int = 49; +pub const ENOCSI: ::c_int = 50; +pub const EL2HLT: ::c_int = 51; +pub const EBADE: ::c_int = 52; +pub const EBADR: ::c_int = 53; +pub const EXFULL: ::c_int = 54; +pub const ENOANO: ::c_int = 55; +pub const EBADRQC: ::c_int = 56; +pub const EBADSLT: ::c_int = 57; +pub const EMULTIHOP: ::c_int = 72; +pub const EOVERFLOW: ::c_int = 75; +pub const ENOTUNIQ: ::c_int = 76; +pub const EBADFD: ::c_int = 77; +pub const EBADMSG: ::c_int = 74; +pub const EREMCHG: ::c_int = 78; +pub const ELIBACC: ::c_int = 79; +pub const ELIBBAD: ::c_int = 80; +pub const ELIBSCN: ::c_int = 81; +pub const ELIBMAX: ::c_int = 82; +pub const ELIBEXEC: ::c_int = 83; +pub const EILSEQ: ::c_int = 84; +pub const ERESTART: ::c_int = 85; +pub const ESTRPIPE: ::c_int = 86; +pub const EUSERS: ::c_int = 87; +pub const ENOTSOCK: ::c_int = 88; +pub const EDESTADDRREQ: ::c_int = 89; +pub const EMSGSIZE: ::c_int = 90; +pub const EPROTOTYPE: ::c_int = 91; +pub const ENOPROTOOPT: ::c_int = 92; +pub const EPROTONOSUPPORT: ::c_int = 93; +pub const ESOCKTNOSUPPORT: ::c_int = 94; +pub const EOPNOTSUPP: ::c_int = 95; +pub const EPFNOSUPPORT: ::c_int = 96; +pub const EAFNOSUPPORT: ::c_int = 97; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const ENETDOWN: ::c_int = 100; +pub const ENETUNREACH: ::c_int = 101; +pub const ENETRESET: ::c_int = 102; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNRESET: ::c_int = 104; +pub const ENOBUFS: ::c_int = 105; +pub const EISCONN: ::c_int = 106; +pub const ENOTCONN: ::c_int = 107; +pub const ESHUTDOWN: ::c_int = 108; +pub const ETOOMANYREFS: ::c_int = 109; +pub const ETIMEDOUT: ::c_int = 110; +pub const ECONNREFUSED: ::c_int = 111; +pub const EHOSTDOWN: ::c_int = 112; +pub const EHOSTUNREACH: ::c_int = 113; +pub const EALREADY: ::c_int = 114; +pub const EINPROGRESS: ::c_int = 115; +pub const ESTALE: ::c_int = 116; +pub const EDQUOT: ::c_int = 122; +pub const ENOMEDIUM: ::c_int = 123; +pub const EMEDIUMTYPE: ::c_int = 124; +pub const ECANCELED: ::c_int = 125; +pub const ENOKEY: ::c_int = 126; +pub const EKEYEXPIRED: ::c_int = 127; +pub const EKEYREVOKED: ::c_int = 128; +pub const EKEYREJECTED: ::c_int = 129; +pub const EOWNERDEAD: ::c_int = 130; +pub const ENOTRECOVERABLE: ::c_int = 131; +pub const EHWPOISON: ::c_int = 133; +pub const ERFKILL: ::c_int = 132; + +pub const SOL_SOCKET: ::c_int = 1; + +pub const SO_REUSEADDR: ::c_int = 2; +pub const SO_TYPE: ::c_int = 3; +pub const SO_ERROR: ::c_int = 4; +pub const SO_DONTROUTE: ::c_int = 5; +pub const SO_BROADCAST: ::c_int = 6; +pub const SO_SNDBUF: ::c_int = 7; +pub const SO_RCVBUF: ::c_int = 8; +pub const SO_SNDBUFFORCE: ::c_int = 32; +pub const SO_RCVBUFFORCE: ::c_int = 33; +pub const SO_KEEPALIVE: ::c_int = 9; +pub const SO_OOBINLINE: ::c_int = 10; +pub const SO_NO_CHECK: ::c_int = 11; +pub const SO_PRIORITY: ::c_int = 12; +pub const SO_LINGER: ::c_int = 13; +pub const SO_BSDCOMPAT: ::c_int = 14; +pub const SO_REUSEPORT: ::c_int = 15; +pub const SO_PASSCRED: ::c_int = 16; +pub const SO_PEERCRED: ::c_int = 17; +pub const SO_RCVLOWAT: ::c_int = 18; +pub const SO_SNDLOWAT: ::c_int = 19; +pub const SO_RCVTIMEO: ::c_int = 20; +pub const SO_SNDTIMEO: ::c_int = 21; +pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22; +pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23; +pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24; +pub const SO_BINDTODEVICE: ::c_int = 25; +pub const SO_ATTACH_FILTER: ::c_int = 26; +pub const SO_DETACH_FILTER: ::c_int = 27; +pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER; +pub const SO_PEERNAME: ::c_int = 28; +pub const SO_TIMESTAMP: ::c_int = 29; +pub const SO_ACCEPTCONN: ::c_int = 30; +pub const SO_PEERSEC: ::c_int = 31; +pub const SO_PASSSEC: ::c_int = 34; +pub const SO_TIMESTAMPNS: ::c_int = 35; +pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS; +pub const SO_MARK: ::c_int = 36; +pub const SO_PROTOCOL: ::c_int = 38; +pub const SO_DOMAIN: ::c_int = 39; +pub const SO_RXQ_OVFL: ::c_int = 40; +pub const SO_WIFI_STATUS: ::c_int = 41; +pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS; +pub const SO_PEEK_OFF: ::c_int = 42; +pub const SO_NOFCS: ::c_int = 43; +pub const SO_LOCK_FILTER: ::c_int = 44; +pub const SO_SELECT_ERR_QUEUE: ::c_int = 45; +pub const SO_BUSY_POLL: ::c_int = 46; +pub const SO_MAX_PACING_RATE: ::c_int = 47; +pub const SO_BPF_EXTENSIONS: ::c_int = 48; +pub const SO_INCOMING_CPU: ::c_int = 49; +pub const SO_ATTACH_BPF: ::c_int = 50; +pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER; + +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; + +pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_SIGINFO: ::c_int = 0x00000004; +pub const SA_NOCLDWAIT: ::c_int = 0x00000002; + +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; +pub const SIGCHLD: ::c_int = 17; +pub const SIGBUS: ::c_int = 7; +pub const SIGUSR1: ::c_int = 10; +pub const SIGUSR2: ::c_int = 12; +pub const SIGCONT: ::c_int = 18; +pub const SIGSTOP: ::c_int = 19; +pub const SIGTSTP: ::c_int = 20; +pub const SIGURG: ::c_int = 23; +pub const SIGIO: ::c_int = 29; +pub const SIGSYS: ::c_int = 31; +pub const SIGSTKFLT: ::c_int = 16; +#[deprecated( + since = "0.2.55", + note = "Use SIGSYS instead" +)] +pub const SIGUNUSED: ::c_int = 31; +pub const SIGPOLL: ::c_int = 29; +pub const SIGPWR: ::c_int = 30; +pub const SIG_SETMASK: ::c_int = 2; +pub const SIG_BLOCK: ::c_int = 0x000000; +pub const SIG_UNBLOCK: ::c_int = 0x01; + +pub const POLLWRNORM: ::c_short = 0x100; +pub const POLLWRBAND: ::c_short = 0x200; + +pub const O_ASYNC: ::c_int = 0x2000; +pub const O_NDELAY: ::c_int = 0x800; + +pub const PTRACE_DETACH: ::c_uint = 17; + +pub const EFD_NONBLOCK: ::c_int = 0x800; + +pub const F_GETLK: ::c_int = 5; +pub const F_GETOWN: ::c_int = 9; +pub const F_SETOWN: ::c_int = 8; +pub const F_SETLK: ::c_int = 6; +pub const F_SETLKW: ::c_int = 7; + +pub const F_RDLCK: ::c_int = 0; +pub const F_WRLCK: ::c_int = 1; +pub const F_UNLCK: ::c_int = 2; + +pub const SFD_NONBLOCK: ::c_int = 0x0800; + +pub const TCSANOW: ::c_int = 0; +pub const TCSADRAIN: ::c_int = 1; +pub const TCSAFLUSH: ::c_int = 2; + +pub const TIOCLINUX: ::c_ulong = 0x541C; +pub const TIOCGSERIAL: ::c_ulong = 0x541E; +pub const TIOCEXCL: ::c_ulong = 0x540C; +pub const TIOCNXCL: ::c_ulong = 0x540D; +pub const TIOCSCTTY: ::c_ulong = 0x540E; +pub const TIOCSTI: ::c_ulong = 0x5412; +pub const TIOCMGET: ::c_ulong = 0x5415; +pub const TIOCMBIS: ::c_ulong = 0x5416; +pub const TIOCMBIC: ::c_ulong = 0x5417; +pub const TIOCMSET: ::c_ulong = 0x5418; +pub const TIOCCONS: ::c_ulong = 0x541D; + +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; + +pub const SFD_CLOEXEC: ::c_int = 0x080000; + +pub const NCCS: usize = 32; + +pub const O_TRUNC: ::c_int = 512; + +pub const O_CLOEXEC: ::c_int = 0x80000; + +pub const EBFONT: ::c_int = 59; +pub const ENOSTR: ::c_int = 60; +pub const ENODATA: ::c_int = 61; +pub const ETIME: ::c_int = 62; +pub const ENOSR: ::c_int = 63; +pub const ENONET: ::c_int = 64; +pub const ENOPKG: ::c_int = 65; +pub const EREMOTE: ::c_int = 66; +pub const ENOLINK: ::c_int = 67; +pub const EADV: ::c_int = 68; +pub const ESRMNT: ::c_int = 69; +pub const ECOMM: ::c_int = 70; +pub const EPROTO: ::c_int = 71; +pub const EDOTDOT: ::c_int = 73; + +pub const SA_NODEFER: ::c_int = 0x40000000; +pub const SA_RESETHAND: ::c_int = 0x80000000; +pub const SA_RESTART: ::c_int = 0x10000000; +pub const SA_NOCLDSTOP: ::c_int = 0x00000001; + +pub const EPOLL_CLOEXEC: ::c_int = 0x80000; + +pub const EFD_CLOEXEC: ::c_int = 0x80000; + +pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; +pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; + +pub const O_DIRECT: ::c_int = 0x4000; +pub const O_DIRECTORY: ::c_int = 0x10000; +pub const O_NOFOLLOW: ::c_int = 0x20000; + +pub const MAP_HUGETLB: ::c_int = 0x040000; +pub const MAP_LOCKED: ::c_int = 0x02000; +pub const MAP_NORESERVE: ::c_int = 0x04000; +pub const MAP_32BIT: ::c_int = 0x0040; +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_ANONYMOUS: ::c_int = 0x0020; +pub const MAP_DENYWRITE: ::c_int = 0x0800; +pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_POPULATE: ::c_int = 0x08000; +pub const MAP_NONBLOCK: ::c_int = 0x010000; +pub const MAP_STACK: ::c_int = 0x020000; + +pub const EDEADLOCK: ::c_int = 35; +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; + +pub const FIOCLEX: ::c_ulong = 0x5451; +pub const FIONCLEX: ::c_ulong = 0x5450; +pub const FIONBIO: ::c_ulong = 0x5421; + +pub const PTRACE_GETFPREGS: ::c_uint = 14; +pub const PTRACE_SETFPREGS: ::c_uint = 15; +pub const PTRACE_GETFPXREGS: ::c_uint = 18; +pub const PTRACE_SETFPXREGS: ::c_uint = 19; +pub const PTRACE_GETREGS: ::c_uint = 12; +pub const PTRACE_SETREGS: ::c_uint = 13; +pub const PTRACE_PEEKSIGINFO_SHARED: ::c_uint = 1; + +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; + +pub const SIGSTKSZ: ::size_t = 8192; +pub const MINSIGSTKSZ: ::size_t = 2048; +pub const CBAUD: ::tcflag_t = 0o0010017; +pub const TAB1: ::tcflag_t = 0x00000800; +pub const TAB2: ::tcflag_t = 0x00001000; +pub const TAB3: ::tcflag_t = 0x00001800; +pub const CR1: ::tcflag_t = 0x00000200; +pub const CR2: ::tcflag_t = 0x00000400; +pub const CR3: ::tcflag_t = 0x00000600; +pub const FF1: ::tcflag_t = 0x00008000; +pub const BS1: ::tcflag_t = 0x00002000; +pub const VT1: ::tcflag_t = 0x00004000; +pub const VWERASE: usize = 14; +pub const VREPRINT: usize = 12; +pub const VSUSP: usize = 10; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VDISCARD: usize = 13; +pub const VTIME: usize = 5; +pub const IXON: ::tcflag_t = 0x00000400; +pub const IXOFF: ::tcflag_t = 0x00001000; +pub const ONLCR: ::tcflag_t = 0x4; +pub const CSIZE: ::tcflag_t = 0x00000030; +pub const CS6: ::tcflag_t = 0x00000010; +pub const CS7: ::tcflag_t = 0x00000020; +pub const CS8: ::tcflag_t = 0x00000030; +pub const CSTOPB: ::tcflag_t = 0x00000040; +pub const CREAD: ::tcflag_t = 0x00000080; +pub const PARENB: ::tcflag_t = 0x00000100; +pub const PARODD: ::tcflag_t = 0x00000200; +pub const HUPCL: ::tcflag_t = 0x00000400; +pub const CLOCAL: ::tcflag_t = 0x00000800; +pub const ECHOKE: ::tcflag_t = 0x00000800; +pub const ECHOE: ::tcflag_t = 0x00000010; +pub const ECHOK: ::tcflag_t = 0x00000020; +pub const ECHONL: ::tcflag_t = 0x00000040; +pub const ECHOPRT: ::tcflag_t = 0x00000400; +pub const ECHOCTL: ::tcflag_t = 0x00000200; +pub const ISIG: ::tcflag_t = 0x00000001; +pub const ICANON: ::tcflag_t = 0x00000002; +pub const PENDIN: ::tcflag_t = 0x00004000; +pub const NOFLSH: ::tcflag_t = 0x00000080; +pub const CIBAUD: ::tcflag_t = 0o02003600000; +pub const CBAUDEX: ::tcflag_t = 0o010000; +pub const VSWTC: usize = 7; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const XTABS: ::tcflag_t = 0o014000; + +pub const B0: ::speed_t = 0o000000; +pub const B50: ::speed_t = 0o000001; +pub const B75: ::speed_t = 0o000002; +pub const B110: ::speed_t = 0o000003; +pub const B134: ::speed_t = 0o000004; +pub const B150: ::speed_t = 0o000005; +pub const B200: ::speed_t = 0o000006; +pub const B300: ::speed_t = 0o000007; +pub const B600: ::speed_t = 0o000010; +pub const B1200: ::speed_t = 0o000011; +pub const B1800: ::speed_t = 0o000012; +pub const B2400: ::speed_t = 0o000013; +pub const B4800: ::speed_t = 0o000014; +pub const B9600: ::speed_t = 0o000015; +pub const B19200: ::speed_t = 0o000016; +pub const B38400: ::speed_t = 0o000017; +pub const EXTA: ::speed_t = B19200; +pub const EXTB: ::speed_t = B38400; +pub const BOTHER: ::speed_t = 0o010000; +pub const B57600: ::speed_t = 0o010001; +pub const B115200: ::speed_t = 0o010002; +pub const B230400: ::speed_t = 0o010003; +pub const B460800: ::speed_t = 0o010004; +pub const B500000: ::speed_t = 0o010005; +pub const B576000: ::speed_t = 0o010006; +pub const B921600: ::speed_t = 0o010007; +pub const B1000000: ::speed_t = 0o010010; +pub const B1152000: ::speed_t = 0o010011; +pub const B1500000: ::speed_t = 0o010012; +pub const B2000000: ::speed_t = 0o010013; +pub const B2500000: ::speed_t = 0o010014; +pub const B3000000: ::speed_t = 0o010015; +pub const B3500000: ::speed_t = 0o010016; +pub const B4000000: ::speed_t = 0o010017; + +pub const VEOL: usize = 11; +pub const VEOL2: usize = 16; +pub const VMIN: usize = 6; +pub const IEXTEN: ::tcflag_t = 0x00008000; +pub const TOSTOP: ::tcflag_t = 0x00000100; +pub const FLUSHO: ::tcflag_t = 0x00001000; +pub const EXTPROC: ::tcflag_t = 0x00010000; +pub const TCGETS: ::c_ulong = 0x5401; +pub const TCSETS: ::c_ulong = 0x5402; +pub const TCSETSW: ::c_ulong = 0x5403; +pub const TCSETSF: ::c_ulong = 0x5404; +pub const TCGETA: ::c_ulong = 0x5405; +pub const TCSETA: ::c_ulong = 0x5406; +pub const TCSETAW: ::c_ulong = 0x5407; +pub const TCSETAF: ::c_ulong = 0x5408; +pub const TCSBRK: ::c_ulong = 0x5409; +pub const TCXONC: ::c_ulong = 0x540A; +pub const TCFLSH: ::c_ulong = 0x540B; +pub const TIOCINQ: ::c_ulong = 0x541B; +pub const TIOCGPGRP: ::c_ulong = 0x540F; +pub const TIOCSPGRP: ::c_ulong = 0x5410; +pub const TIOCOUTQ: ::c_ulong = 0x5411; +pub const TIOCGWINSZ: ::c_ulong = 0x5413; +pub const TIOCSWINSZ: ::c_ulong = 0x5414; +pub const FIONREAD: ::c_ulong = 0x541B; + +// offsets in user_regs_structs, from sys/reg.h +pub const R15: ::c_int = 0; +pub const R14: ::c_int = 1; +pub const R13: ::c_int = 2; +pub const R12: ::c_int = 3; +pub const RBP: ::c_int = 4; +pub const RBX: ::c_int = 5; +pub const R11: ::c_int = 6; +pub const R10: ::c_int = 7; +pub const R9: ::c_int = 8; +pub const R8: ::c_int = 9; +pub const RAX: ::c_int = 10; +pub const RCX: ::c_int = 11; +pub const RDX: ::c_int = 12; +pub const RSI: ::c_int = 13; +pub const RDI: ::c_int = 14; +pub const ORIG_RAX: ::c_int = 15; +pub const RIP: ::c_int = 16; +pub const CS: ::c_int = 17; +pub const EFLAGS: ::c_int = 18; +pub const RSP: ::c_int = 19; +pub const SS: ::c_int = 20; +pub const FS_BASE: ::c_int = 21; +pub const GS_BASE: ::c_int = 22; +pub const DS: ::c_int = 23; +pub const ES: ::c_int = 24; +pub const FS: ::c_int = 25; +pub const GS: ::c_int = 26; + +// offsets in mcontext_t.gregs from sys/ucontext.h +pub const REG_R8: ::c_int = 0; +pub const REG_R9: ::c_int = 1; +pub const REG_R10: ::c_int = 2; +pub const REG_R11: ::c_int = 3; +pub const REG_R12: ::c_int = 4; +pub const REG_R13: ::c_int = 5; +pub const REG_R14: ::c_int = 6; +pub const REG_R15: ::c_int = 7; +pub const REG_RDI: ::c_int = 8; +pub const REG_RSI: ::c_int = 9; +pub const REG_RBP: ::c_int = 10; +pub const REG_RBX: ::c_int = 11; +pub const REG_RDX: ::c_int = 12; +pub const REG_RAX: ::c_int = 13; +pub const REG_RCX: ::c_int = 14; +pub const REG_RSP: ::c_int = 15; +pub const REG_RIP: ::c_int = 16; +pub const REG_EFL: ::c_int = 17; +pub const REG_CSGSFS: ::c_int = 18; +pub const REG_ERR: ::c_int = 19; +pub const REG_TRAPNO: ::c_int = 20; +pub const REG_OLDMASK: ::c_int = 21; +pub const REG_CR2: ::c_int = 22; + +extern { + pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int; + pub fn setcontext(ucp: *const ucontext_t) -> ::c_int; + pub fn makecontext(ucp: *mut ucontext_t, + func: extern fn (), + argc: ::c_int, ...); + pub fn swapcontext(uocp: *mut ucontext_t, + ucp: *const ucontext_t) -> ::c_int; + pub fn iopl(level: ::c_int) -> ::c_int; + pub fn ioperm(from: ::c_ulong, num: ::c_ulong, + turn_on: ::c_int) -> ::c_int; +} + +cfg_if! { + if #[cfg(target_pointer_width = "32")] { + mod x32; + pub use self::x32::*; + } else { + mod not_x32; + pub use self::not_x32::*; + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,422 @@ +use pthread_mutex_t; + +pub type c_long = i64; +pub type c_ulong = u64; + +s! { + pub struct statvfs { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_favail: ::fsfilcnt_t, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } +} + +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; +pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; + +align_const! { + #[cfg(target_endian = "little")] + pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 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, 0, + ], + }; + #[cfg(target_endian = "little")] + pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + #[cfg(target_endian = "little")] + pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + #[cfg(target_endian = "big")] + pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 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, + ], + }; + #[cfg(target_endian = "big")] + pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + #[cfg(target_endian = "big")] + pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; +} + +// Syscall table + +pub const SYS_read: ::c_long = 0; +pub const SYS_write: ::c_long = 1; +pub const SYS_open: ::c_long = 2; +pub const SYS_close: ::c_long = 3; +pub const SYS_stat: ::c_long = 4; +pub const SYS_fstat: ::c_long = 5; +pub const SYS_lstat: ::c_long = 6; +pub const SYS_poll: ::c_long = 7; +pub const SYS_lseek: ::c_long = 8; +pub const SYS_mmap: ::c_long = 9; +pub const SYS_mprotect: ::c_long = 10; +pub const SYS_munmap: ::c_long = 11; +pub const SYS_brk: ::c_long = 12; +pub const SYS_rt_sigaction: ::c_long = 13; +pub const SYS_rt_sigprocmask: ::c_long = 14; +pub const SYS_rt_sigreturn: ::c_long = 15; +pub const SYS_ioctl: ::c_long = 16; +pub const SYS_pread64: ::c_long = 17; +pub const SYS_pwrite64: ::c_long = 18; +pub const SYS_readv: ::c_long = 19; +pub const SYS_writev: ::c_long = 20; +pub const SYS_access: ::c_long = 21; +pub const SYS_pipe: ::c_long = 22; +pub const SYS_select: ::c_long = 23; +pub const SYS_sched_yield: ::c_long = 24; +pub const SYS_mremap: ::c_long = 25; +pub const SYS_msync: ::c_long = 26; +pub const SYS_mincore: ::c_long = 27; +pub const SYS_madvise: ::c_long = 28; +pub const SYS_shmget: ::c_long = 29; +pub const SYS_shmat: ::c_long = 30; +pub const SYS_shmctl: ::c_long = 31; +pub const SYS_dup: ::c_long = 32; +pub const SYS_dup2: ::c_long = 33; +pub const SYS_pause: ::c_long = 34; +pub const SYS_nanosleep: ::c_long = 35; +pub const SYS_getitimer: ::c_long = 36; +pub const SYS_alarm: ::c_long = 37; +pub const SYS_setitimer: ::c_long = 38; +pub const SYS_getpid: ::c_long = 39; +pub const SYS_sendfile: ::c_long = 40; +pub const SYS_socket: ::c_long = 41; +pub const SYS_connect: ::c_long = 42; +pub const SYS_accept: ::c_long = 43; +pub const SYS_sendto: ::c_long = 44; +pub const SYS_recvfrom: ::c_long = 45; +pub const SYS_sendmsg: ::c_long = 46; +pub const SYS_recvmsg: ::c_long = 47; +pub const SYS_shutdown: ::c_long = 48; +pub const SYS_bind: ::c_long = 49; +pub const SYS_listen: ::c_long = 50; +pub const SYS_getsockname: ::c_long = 51; +pub const SYS_getpeername: ::c_long = 52; +pub const SYS_socketpair: ::c_long = 53; +pub const SYS_setsockopt: ::c_long = 54; +pub const SYS_getsockopt: ::c_long = 55; +pub const SYS_clone: ::c_long = 56; +pub const SYS_fork: ::c_long = 57; +pub const SYS_vfork: ::c_long = 58; +pub const SYS_execve: ::c_long = 59; +pub const SYS_exit: ::c_long = 60; +pub const SYS_wait4: ::c_long = 61; +pub const SYS_kill: ::c_long = 62; +pub const SYS_uname: ::c_long = 63; +pub const SYS_semget: ::c_long = 64; +pub const SYS_semop: ::c_long = 65; +pub const SYS_semctl: ::c_long = 66; +pub const SYS_shmdt: ::c_long = 67; +pub const SYS_msgget: ::c_long = 68; +pub const SYS_msgsnd: ::c_long = 69; +pub const SYS_msgrcv: ::c_long = 70; +pub const SYS_msgctl: ::c_long = 71; +pub const SYS_fcntl: ::c_long = 72; +pub const SYS_flock: ::c_long = 73; +pub const SYS_fsync: ::c_long = 74; +pub const SYS_fdatasync: ::c_long = 75; +pub const SYS_truncate: ::c_long = 76; +pub const SYS_ftruncate: ::c_long = 77; +pub const SYS_getdents: ::c_long = 78; +pub const SYS_getcwd: ::c_long = 79; +pub const SYS_chdir: ::c_long = 80; +pub const SYS_fchdir: ::c_long = 81; +pub const SYS_rename: ::c_long = 82; +pub const SYS_mkdir: ::c_long = 83; +pub const SYS_rmdir: ::c_long = 84; +pub const SYS_creat: ::c_long = 85; +pub const SYS_link: ::c_long = 86; +pub const SYS_unlink: ::c_long = 87; +pub const SYS_symlink: ::c_long = 88; +pub const SYS_readlink: ::c_long = 89; +pub const SYS_chmod: ::c_long = 90; +pub const SYS_fchmod: ::c_long = 91; +pub const SYS_chown: ::c_long = 92; +pub const SYS_fchown: ::c_long = 93; +pub const SYS_lchown: ::c_long = 94; +pub const SYS_umask: ::c_long = 95; +pub const SYS_gettimeofday: ::c_long = 96; +pub const SYS_getrlimit: ::c_long = 97; +pub const SYS_getrusage: ::c_long = 98; +pub const SYS_sysinfo: ::c_long = 99; +pub const SYS_times: ::c_long = 100; +pub const SYS_ptrace: ::c_long = 101; +pub const SYS_getuid: ::c_long = 102; +pub const SYS_syslog: ::c_long = 103; +pub const SYS_getgid: ::c_long = 104; +pub const SYS_setuid: ::c_long = 105; +pub const SYS_setgid: ::c_long = 106; +pub const SYS_geteuid: ::c_long = 107; +pub const SYS_getegid: ::c_long = 108; +pub const SYS_setpgid: ::c_long = 109; +pub const SYS_getppid: ::c_long = 110; +pub const SYS_getpgrp: ::c_long = 111; +pub const SYS_setsid: ::c_long = 112; +pub const SYS_setreuid: ::c_long = 113; +pub const SYS_setregid: ::c_long = 114; +pub const SYS_getgroups: ::c_long = 115; +pub const SYS_setgroups: ::c_long = 116; +pub const SYS_setresuid: ::c_long = 117; +pub const SYS_getresuid: ::c_long = 118; +pub const SYS_setresgid: ::c_long = 119; +pub const SYS_getresgid: ::c_long = 120; +pub const SYS_getpgid: ::c_long = 121; +pub const SYS_setfsuid: ::c_long = 122; +pub const SYS_setfsgid: ::c_long = 123; +pub const SYS_getsid: ::c_long = 124; +pub const SYS_capget: ::c_long = 125; +pub const SYS_capset: ::c_long = 126; +pub const SYS_rt_sigpending: ::c_long = 127; +pub const SYS_rt_sigtimedwait: ::c_long = 128; +pub const SYS_rt_sigqueueinfo: ::c_long = 129; +pub const SYS_rt_sigsuspend: ::c_long = 130; +pub const SYS_sigaltstack: ::c_long = 131; +pub const SYS_utime: ::c_long = 132; +pub const SYS_mknod: ::c_long = 133; +pub const SYS_uselib: ::c_long = 134; +pub const SYS_personality: ::c_long = 135; +pub const SYS_ustat: ::c_long = 136; +pub const SYS_statfs: ::c_long = 137; +pub const SYS_fstatfs: ::c_long = 138; +pub const SYS_sysfs: ::c_long = 139; +pub const SYS_getpriority: ::c_long = 140; +pub const SYS_setpriority: ::c_long = 141; +pub const SYS_sched_setparam: ::c_long = 142; +pub const SYS_sched_getparam: ::c_long = 143; +pub const SYS_sched_setscheduler: ::c_long = 144; +pub const SYS_sched_getscheduler: ::c_long = 145; +pub const SYS_sched_get_priority_max: ::c_long = 146; +pub const SYS_sched_get_priority_min: ::c_long = 147; +pub const SYS_sched_rr_get_interval: ::c_long = 148; +pub const SYS_mlock: ::c_long = 149; +pub const SYS_munlock: ::c_long = 150; +pub const SYS_mlockall: ::c_long = 151; +pub const SYS_munlockall: ::c_long = 152; +pub const SYS_vhangup: ::c_long = 153; +pub const SYS_modify_ldt: ::c_long = 154; +pub const SYS_pivot_root: ::c_long = 155; +pub const SYS__sysctl: ::c_long = 156; +pub const SYS_prctl: ::c_long = 157; +pub const SYS_arch_prctl: ::c_long = 158; +pub const SYS_adjtimex: ::c_long = 159; +pub const SYS_setrlimit: ::c_long = 160; +pub const SYS_chroot: ::c_long = 161; +pub const SYS_sync: ::c_long = 162; +pub const SYS_acct: ::c_long = 163; +pub const SYS_settimeofday: ::c_long = 164; +pub const SYS_mount: ::c_long = 165; +pub const SYS_umount2: ::c_long = 166; +pub const SYS_swapon: ::c_long = 167; +pub const SYS_swapoff: ::c_long = 168; +pub const SYS_reboot: ::c_long = 169; +pub const SYS_sethostname: ::c_long = 170; +pub const SYS_setdomainname: ::c_long = 171; +pub const SYS_iopl: ::c_long = 172; +pub const SYS_ioperm: ::c_long = 173; +pub const SYS_create_module: ::c_long = 174; +pub const SYS_init_module: ::c_long = 175; +pub const SYS_delete_module: ::c_long = 176; +pub const SYS_get_kernel_syms: ::c_long = 177; +pub const SYS_query_module: ::c_long = 178; +pub const SYS_quotactl: ::c_long = 179; +pub const SYS_nfsservctl: ::c_long = 180; +pub const SYS_getpmsg: ::c_long = 181; +pub const SYS_putpmsg: ::c_long = 182; +pub const SYS_afs_syscall: ::c_long = 183; +pub const SYS_tuxcall: ::c_long = 184; +pub const SYS_security: ::c_long = 185; +pub const SYS_gettid: ::c_long = 186; +pub const SYS_readahead: ::c_long = 187; +pub const SYS_setxattr: ::c_long = 188; +pub const SYS_lsetxattr: ::c_long = 189; +pub const SYS_fsetxattr: ::c_long = 190; +pub const SYS_getxattr: ::c_long = 191; +pub const SYS_lgetxattr: ::c_long = 192; +pub const SYS_fgetxattr: ::c_long = 193; +pub const SYS_listxattr: ::c_long = 194; +pub const SYS_llistxattr: ::c_long = 195; +pub const SYS_flistxattr: ::c_long = 196; +pub const SYS_removexattr: ::c_long = 197; +pub const SYS_lremovexattr: ::c_long = 198; +pub const SYS_fremovexattr: ::c_long = 199; +pub const SYS_tkill: ::c_long = 200; +pub const SYS_time: ::c_long = 201; +pub const SYS_futex: ::c_long = 202; +pub const SYS_sched_setaffinity: ::c_long = 203; +pub const SYS_sched_getaffinity: ::c_long = 204; +pub const SYS_set_thread_area: ::c_long = 205; +pub const SYS_io_setup: ::c_long = 206; +pub const SYS_io_destroy: ::c_long = 207; +pub const SYS_io_getevents: ::c_long = 208; +pub const SYS_io_submit: ::c_long = 209; +pub const SYS_io_cancel: ::c_long = 210; +pub const SYS_get_thread_area: ::c_long = 211; +pub const SYS_lookup_dcookie: ::c_long = 212; +pub const SYS_epoll_create: ::c_long = 213; +pub const SYS_epoll_ctl_old: ::c_long = 214; +pub const SYS_epoll_wait_old: ::c_long = 215; +pub const SYS_remap_file_pages: ::c_long = 216; +pub const SYS_getdents64: ::c_long = 217; +pub const SYS_set_tid_address: ::c_long = 218; +pub const SYS_restart_syscall: ::c_long = 219; +pub const SYS_semtimedop: ::c_long = 220; +pub const SYS_fadvise64: ::c_long = 221; +pub const SYS_timer_create: ::c_long = 222; +pub const SYS_timer_settime: ::c_long = 223; +pub const SYS_timer_gettime: ::c_long = 224; +pub const SYS_timer_getoverrun: ::c_long = 225; +pub const SYS_timer_delete: ::c_long = 226; +pub const SYS_clock_settime: ::c_long = 227; +pub const SYS_clock_gettime: ::c_long = 228; +pub const SYS_clock_getres: ::c_long = 229; +pub const SYS_clock_nanosleep: ::c_long = 230; +pub const SYS_exit_group: ::c_long = 231; +pub const SYS_epoll_wait: ::c_long = 232; +pub const SYS_epoll_ctl: ::c_long = 233; +pub const SYS_tgkill: ::c_long = 234; +pub const SYS_utimes: ::c_long = 235; +pub const SYS_vserver: ::c_long = 236; +pub const SYS_mbind: ::c_long = 237; +pub const SYS_set_mempolicy: ::c_long = 238; +pub const SYS_get_mempolicy: ::c_long = 239; +pub const SYS_mq_open: ::c_long = 240; +pub const SYS_mq_unlink: ::c_long = 241; +pub const SYS_mq_timedsend: ::c_long = 242; +pub const SYS_mq_timedreceive: ::c_long = 243; +pub const SYS_mq_notify: ::c_long = 244; +pub const SYS_mq_getsetattr: ::c_long = 245; +pub const SYS_kexec_load: ::c_long = 246; +pub const SYS_waitid: ::c_long = 247; +pub const SYS_add_key: ::c_long = 248; +pub const SYS_request_key: ::c_long = 249; +pub const SYS_keyctl: ::c_long = 250; +pub const SYS_ioprio_set: ::c_long = 251; +pub const SYS_ioprio_get: ::c_long = 252; +pub const SYS_inotify_init: ::c_long = 253; +pub const SYS_inotify_add_watch: ::c_long = 254; +pub const SYS_inotify_rm_watch: ::c_long = 255; +pub const SYS_migrate_pages: ::c_long = 256; +pub const SYS_openat: ::c_long = 257; +pub const SYS_mkdirat: ::c_long = 258; +pub const SYS_mknodat: ::c_long = 259; +pub const SYS_fchownat: ::c_long = 260; +pub const SYS_futimesat: ::c_long = 261; +pub const SYS_newfstatat: ::c_long = 262; +pub const SYS_unlinkat: ::c_long = 263; +pub const SYS_renameat: ::c_long = 264; +pub const SYS_linkat: ::c_long = 265; +pub const SYS_symlinkat: ::c_long = 266; +pub const SYS_readlinkat: ::c_long = 267; +pub const SYS_fchmodat: ::c_long = 268; +pub const SYS_faccessat: ::c_long = 269; +pub const SYS_pselect6: ::c_long = 270; +pub const SYS_ppoll: ::c_long = 271; +pub const SYS_unshare: ::c_long = 272; +pub const SYS_set_robust_list: ::c_long = 273; +pub const SYS_get_robust_list: ::c_long = 274; +pub const SYS_splice: ::c_long = 275; +pub const SYS_tee: ::c_long = 276; +pub const SYS_sync_file_range: ::c_long = 277; +pub const SYS_vmsplice: ::c_long = 278; +pub const SYS_move_pages: ::c_long = 279; +pub const SYS_utimensat: ::c_long = 280; +pub const SYS_epoll_pwait: ::c_long = 281; +pub const SYS_signalfd: ::c_long = 282; +pub const SYS_timerfd_create: ::c_long = 283; +pub const SYS_eventfd: ::c_long = 284; +pub const SYS_fallocate: ::c_long = 285; +pub const SYS_timerfd_settime: ::c_long = 286; +pub const SYS_timerfd_gettime: ::c_long = 287; +pub const SYS_accept4: ::c_long = 288; +pub const SYS_signalfd4: ::c_long = 289; +pub const SYS_eventfd2: ::c_long = 290; +pub const SYS_epoll_create1: ::c_long = 291; +pub const SYS_dup3: ::c_long = 292; +pub const SYS_pipe2: ::c_long = 293; +pub const SYS_inotify_init1: ::c_long = 294; +pub const SYS_preadv: ::c_long = 295; +pub const SYS_pwritev: ::c_long = 296; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 297; +pub const SYS_perf_event_open: ::c_long = 298; +pub const SYS_recvmmsg: ::c_long = 299; +pub const SYS_fanotify_init: ::c_long = 300; +pub const SYS_fanotify_mark: ::c_long = 301; +pub const SYS_prlimit64: ::c_long = 302; +pub const SYS_name_to_handle_at: ::c_long = 303; +pub const SYS_open_by_handle_at: ::c_long = 304; +pub const SYS_clock_adjtime: ::c_long = 305; +pub const SYS_syncfs: ::c_long = 306; +pub const SYS_sendmmsg: ::c_long = 307; +pub const SYS_setns: ::c_long = 308; +pub const SYS_getcpu: ::c_long = 309; +pub const SYS_process_vm_readv: ::c_long = 310; +pub const SYS_process_vm_writev: ::c_long = 311; +pub const SYS_kcmp: ::c_long = 312; +pub const SYS_finit_module: ::c_long = 313; +pub const SYS_sched_setattr: ::c_long = 314; +pub const SYS_sched_getattr: ::c_long = 315; +pub const SYS_renameat2: ::c_long = 316; +pub const SYS_seccomp: ::c_long = 317; +pub const SYS_getrandom: ::c_long = 318; +pub const SYS_memfd_create: ::c_long = 319; +pub const SYS_kexec_file_load: ::c_long = 320; +pub const SYS_bpf: ::c_long = 321; +pub const SYS_execveat: ::c_long = 322; +pub const SYS_userfaultfd: ::c_long = 323; +pub const SYS_membarrier: ::c_long = 324; +pub const SYS_mlock2: ::c_long = 325; +pub const SYS_copy_file_range: ::c_long = 326; +pub const SYS_preadv2: ::c_long = 327; +pub const SYS_pwritev2: ::c_long = 328; +pub const SYS_pkey_mprotect: ::c_long = 329; +pub const SYS_pkey_alloc: ::c_long = 330; +pub const SYS_pkey_free: ::c_long = 331; +pub const SYS_statx: ::c_long = 332; + +#[link(name = "util")] +extern { + pub fn sysctl(name: *mut ::c_int, + namelen: ::c_int, + oldp: *mut ::c_void, + oldlenp: *mut ::size_t, + newp: *mut ::c_void, + newlen: ::size_t) + -> ::c_int; +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,375 @@ +use pthread_mutex_t; + +pub type c_long = i32; +pub type c_ulong = u32; + +s! { + pub struct statvfs { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_favail: ::fsfilcnt_t, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } +} + +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 32; +pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 44; + +align_const! { + pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 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, + ], + }; + pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; +} + +// Syscall table + +pub const __X32_SYSCALL_BIT: ::c_long = 0x40000000; + +pub const SYS_read: ::c_long = __X32_SYSCALL_BIT + 0; +pub const SYS_write: ::c_long = __X32_SYSCALL_BIT + 1; +pub const SYS_open: ::c_long = __X32_SYSCALL_BIT + 2; +pub const SYS_close: ::c_long = __X32_SYSCALL_BIT + 3; +pub const SYS_stat: ::c_long = __X32_SYSCALL_BIT + 4; +pub const SYS_fstat: ::c_long = __X32_SYSCALL_BIT + 5; +pub const SYS_lstat: ::c_long = __X32_SYSCALL_BIT + 6; +pub const SYS_poll: ::c_long = __X32_SYSCALL_BIT + 7; +pub const SYS_lseek: ::c_long = __X32_SYSCALL_BIT + 8; +pub const SYS_mmap: ::c_long = __X32_SYSCALL_BIT + 9; +pub const SYS_mprotect: ::c_long = __X32_SYSCALL_BIT + 10; +pub const SYS_munmap: ::c_long = __X32_SYSCALL_BIT + 11; +pub const SYS_brk: ::c_long = __X32_SYSCALL_BIT + 12; +pub const SYS_rt_sigprocmask: ::c_long = __X32_SYSCALL_BIT + 14; +pub const SYS_pread64: ::c_long = __X32_SYSCALL_BIT + 17; +pub const SYS_pwrite64: ::c_long = __X32_SYSCALL_BIT + 18; +pub const SYS_access: ::c_long = __X32_SYSCALL_BIT + 21; +pub const SYS_pipe: ::c_long = __X32_SYSCALL_BIT + 22; +pub const SYS_select: ::c_long = __X32_SYSCALL_BIT + 23; +pub const SYS_sched_yield: ::c_long = __X32_SYSCALL_BIT + 24; +pub const SYS_mremap: ::c_long = __X32_SYSCALL_BIT + 25; +pub const SYS_msync: ::c_long = __X32_SYSCALL_BIT + 26; +pub const SYS_mincore: ::c_long = __X32_SYSCALL_BIT + 27; +pub const SYS_madvise: ::c_long = __X32_SYSCALL_BIT + 28; +pub const SYS_shmget: ::c_long = __X32_SYSCALL_BIT + 29; +pub const SYS_shmat: ::c_long = __X32_SYSCALL_BIT + 30; +pub const SYS_shmctl: ::c_long = __X32_SYSCALL_BIT + 31; +pub const SYS_dup: ::c_long = __X32_SYSCALL_BIT + 32; +pub const SYS_dup2: ::c_long = __X32_SYSCALL_BIT + 33; +pub const SYS_pause: ::c_long = __X32_SYSCALL_BIT + 34; +pub const SYS_nanosleep: ::c_long = __X32_SYSCALL_BIT + 35; +pub const SYS_getitimer: ::c_long = __X32_SYSCALL_BIT + 36; +pub const SYS_alarm: ::c_long = __X32_SYSCALL_BIT + 37; +pub const SYS_setitimer: ::c_long = __X32_SYSCALL_BIT + 38; +pub const SYS_getpid: ::c_long = __X32_SYSCALL_BIT + 39; +pub const SYS_sendfile: ::c_long = __X32_SYSCALL_BIT + 40; +pub const SYS_socket: ::c_long = __X32_SYSCALL_BIT + 41; +pub const SYS_connect: ::c_long = __X32_SYSCALL_BIT + 42; +pub const SYS_accept: ::c_long = __X32_SYSCALL_BIT + 43; +pub const SYS_sendto: ::c_long = __X32_SYSCALL_BIT + 44; +pub const SYS_shutdown: ::c_long = __X32_SYSCALL_BIT + 48; +pub const SYS_bind: ::c_long = __X32_SYSCALL_BIT + 49; +pub const SYS_listen: ::c_long = __X32_SYSCALL_BIT + 50; +pub const SYS_getsockname: ::c_long = __X32_SYSCALL_BIT + 51; +pub const SYS_getpeername: ::c_long = __X32_SYSCALL_BIT + 52; +pub const SYS_socketpair: ::c_long = __X32_SYSCALL_BIT + 53; +pub const SYS_clone: ::c_long = __X32_SYSCALL_BIT + 56; +pub const SYS_fork: ::c_long = __X32_SYSCALL_BIT + 57; +pub const SYS_vfork: ::c_long = __X32_SYSCALL_BIT + 58; +pub const SYS_exit: ::c_long = __X32_SYSCALL_BIT + 60; +pub const SYS_wait4: ::c_long = __X32_SYSCALL_BIT + 61; +pub const SYS_kill: ::c_long = __X32_SYSCALL_BIT + 62; +pub const SYS_uname: ::c_long = __X32_SYSCALL_BIT + 63; +pub const SYS_semget: ::c_long = __X32_SYSCALL_BIT + 64; +pub const SYS_semop: ::c_long = __X32_SYSCALL_BIT + 65; +pub const SYS_semctl: ::c_long = __X32_SYSCALL_BIT + 66; +pub const SYS_shmdt: ::c_long = __X32_SYSCALL_BIT + 67; +pub const SYS_msgget: ::c_long = __X32_SYSCALL_BIT + 68; +pub const SYS_msgsnd: ::c_long = __X32_SYSCALL_BIT + 69; +pub const SYS_msgrcv: ::c_long = __X32_SYSCALL_BIT + 70; +pub const SYS_msgctl: ::c_long = __X32_SYSCALL_BIT + 71; +pub const SYS_fcntl: ::c_long = __X32_SYSCALL_BIT + 72; +pub const SYS_flock: ::c_long = __X32_SYSCALL_BIT + 73; +pub const SYS_fsync: ::c_long = __X32_SYSCALL_BIT + 74; +pub const SYS_fdatasync: ::c_long = __X32_SYSCALL_BIT + 75; +pub const SYS_truncate: ::c_long = __X32_SYSCALL_BIT + 76; +pub const SYS_ftruncate: ::c_long = __X32_SYSCALL_BIT + 77; +pub const SYS_getdents: ::c_long = __X32_SYSCALL_BIT + 78; +pub const SYS_getcwd: ::c_long = __X32_SYSCALL_BIT + 79; +pub const SYS_chdir: ::c_long = __X32_SYSCALL_BIT + 80; +pub const SYS_fchdir: ::c_long = __X32_SYSCALL_BIT + 81; +pub const SYS_rename: ::c_long = __X32_SYSCALL_BIT + 82; +pub const SYS_mkdir: ::c_long = __X32_SYSCALL_BIT + 83; +pub const SYS_rmdir: ::c_long = __X32_SYSCALL_BIT + 84; +pub const SYS_creat: ::c_long = __X32_SYSCALL_BIT + 85; +pub const SYS_link: ::c_long = __X32_SYSCALL_BIT + 86; +pub const SYS_unlink: ::c_long = __X32_SYSCALL_BIT + 87; +pub const SYS_symlink: ::c_long = __X32_SYSCALL_BIT + 88; +pub const SYS_readlink: ::c_long = __X32_SYSCALL_BIT + 89; +pub const SYS_chmod: ::c_long = __X32_SYSCALL_BIT + 90; +pub const SYS_fchmod: ::c_long = __X32_SYSCALL_BIT + 91; +pub const SYS_chown: ::c_long = __X32_SYSCALL_BIT + 92; +pub const SYS_fchown: ::c_long = __X32_SYSCALL_BIT + 93; +pub const SYS_lchown: ::c_long = __X32_SYSCALL_BIT + 94; +pub const SYS_umask: ::c_long = __X32_SYSCALL_BIT + 95; +pub const SYS_gettimeofday: ::c_long = __X32_SYSCALL_BIT + 96; +pub const SYS_getrlimit: ::c_long = __X32_SYSCALL_BIT + 97; +pub const SYS_getrusage: ::c_long = __X32_SYSCALL_BIT + 98; +pub const SYS_sysinfo: ::c_long = __X32_SYSCALL_BIT + 99; +pub const SYS_times: ::c_long = __X32_SYSCALL_BIT + 100; +pub const SYS_getuid: ::c_long = __X32_SYSCALL_BIT + 102; +pub const SYS_syslog: ::c_long = __X32_SYSCALL_BIT + 103; +pub const SYS_getgid: ::c_long = __X32_SYSCALL_BIT + 104; +pub const SYS_setuid: ::c_long = __X32_SYSCALL_BIT + 105; +pub const SYS_setgid: ::c_long = __X32_SYSCALL_BIT + 106; +pub const SYS_geteuid: ::c_long = __X32_SYSCALL_BIT + 107; +pub const SYS_getegid: ::c_long = __X32_SYSCALL_BIT + 108; +pub const SYS_setpgid: ::c_long = __X32_SYSCALL_BIT + 109; +pub const SYS_getppid: ::c_long = __X32_SYSCALL_BIT + 110; +pub const SYS_getpgrp: ::c_long = __X32_SYSCALL_BIT + 111; +pub const SYS_setsid: ::c_long = __X32_SYSCALL_BIT + 112; +pub const SYS_setreuid: ::c_long = __X32_SYSCALL_BIT + 113; +pub const SYS_setregid: ::c_long = __X32_SYSCALL_BIT + 114; +pub const SYS_getgroups: ::c_long = __X32_SYSCALL_BIT + 115; +pub const SYS_setgroups: ::c_long = __X32_SYSCALL_BIT + 116; +pub const SYS_setresuid: ::c_long = __X32_SYSCALL_BIT + 117; +pub const SYS_getresuid: ::c_long = __X32_SYSCALL_BIT + 118; +pub const SYS_setresgid: ::c_long = __X32_SYSCALL_BIT + 119; +pub const SYS_getresgid: ::c_long = __X32_SYSCALL_BIT + 120; +pub const SYS_getpgid: ::c_long = __X32_SYSCALL_BIT + 121; +pub const SYS_setfsuid: ::c_long = __X32_SYSCALL_BIT + 122; +pub const SYS_setfsgid: ::c_long = __X32_SYSCALL_BIT + 123; +pub const SYS_getsid: ::c_long = __X32_SYSCALL_BIT + 124; +pub const SYS_capget: ::c_long = __X32_SYSCALL_BIT + 125; +pub const SYS_capset: ::c_long = __X32_SYSCALL_BIT + 126; +pub const SYS_rt_sigsuspend: ::c_long = __X32_SYSCALL_BIT + 130; +pub const SYS_utime: ::c_long = __X32_SYSCALL_BIT + 132; +pub const SYS_mknod: ::c_long = __X32_SYSCALL_BIT + 133; +pub const SYS_personality: ::c_long = __X32_SYSCALL_BIT + 135; +pub const SYS_ustat: ::c_long = __X32_SYSCALL_BIT + 136; +pub const SYS_statfs: ::c_long = __X32_SYSCALL_BIT + 137; +pub const SYS_fstatfs: ::c_long = __X32_SYSCALL_BIT + 138; +pub const SYS_sysfs: ::c_long = __X32_SYSCALL_BIT + 139; +pub const SYS_getpriority: ::c_long = __X32_SYSCALL_BIT + 140; +pub const SYS_setpriority: ::c_long = __X32_SYSCALL_BIT + 141; +pub const SYS_sched_setparam: ::c_long = __X32_SYSCALL_BIT + 142; +pub const SYS_sched_getparam: ::c_long = __X32_SYSCALL_BIT + 143; +pub const SYS_sched_setscheduler: ::c_long = __X32_SYSCALL_BIT + 144; +pub const SYS_sched_getscheduler: ::c_long = __X32_SYSCALL_BIT + 145; +pub const SYS_sched_get_priority_max: ::c_long = __X32_SYSCALL_BIT + 146; +pub const SYS_sched_get_priority_min: ::c_long = __X32_SYSCALL_BIT + 147; +pub const SYS_sched_rr_get_interval: ::c_long = __X32_SYSCALL_BIT + 148; +pub const SYS_mlock: ::c_long = __X32_SYSCALL_BIT + 149; +pub const SYS_munlock: ::c_long = __X32_SYSCALL_BIT + 150; +pub const SYS_mlockall: ::c_long = __X32_SYSCALL_BIT + 151; +pub const SYS_munlockall: ::c_long = __X32_SYSCALL_BIT + 152; +pub const SYS_vhangup: ::c_long = __X32_SYSCALL_BIT + 153; +pub const SYS_modify_ldt: ::c_long = __X32_SYSCALL_BIT + 154; +pub const SYS_pivot_root: ::c_long = __X32_SYSCALL_BIT + 155; +pub const SYS_prctl: ::c_long = __X32_SYSCALL_BIT + 157; +pub const SYS_arch_prctl: ::c_long = __X32_SYSCALL_BIT + 158; +pub const SYS_adjtimex: ::c_long = __X32_SYSCALL_BIT + 159; +pub const SYS_setrlimit: ::c_long = __X32_SYSCALL_BIT + 160; +pub const SYS_chroot: ::c_long = __X32_SYSCALL_BIT + 161; +pub const SYS_sync: ::c_long = __X32_SYSCALL_BIT + 162; +pub const SYS_acct: ::c_long = __X32_SYSCALL_BIT + 163; +pub const SYS_settimeofday: ::c_long = __X32_SYSCALL_BIT + 164; +pub const SYS_mount: ::c_long = __X32_SYSCALL_BIT + 165; +pub const SYS_umount2: ::c_long = __X32_SYSCALL_BIT + 166; +pub const SYS_swapon: ::c_long = __X32_SYSCALL_BIT + 167; +pub const SYS_swapoff: ::c_long = __X32_SYSCALL_BIT + 168; +pub const SYS_reboot: ::c_long = __X32_SYSCALL_BIT + 169; +pub const SYS_sethostname: ::c_long = __X32_SYSCALL_BIT + 170; +pub const SYS_setdomainname: ::c_long = __X32_SYSCALL_BIT + 171; +pub const SYS_iopl: ::c_long = __X32_SYSCALL_BIT + 172; +pub const SYS_ioperm: ::c_long = __X32_SYSCALL_BIT + 173; +pub const SYS_init_module: ::c_long = __X32_SYSCALL_BIT + 175; +pub const SYS_delete_module: ::c_long = __X32_SYSCALL_BIT + 176; +pub const SYS_quotactl: ::c_long = __X32_SYSCALL_BIT + 179; +pub const SYS_getpmsg: ::c_long = __X32_SYSCALL_BIT + 181; +pub const SYS_putpmsg: ::c_long = __X32_SYSCALL_BIT + 182; +pub const SYS_afs_syscall: ::c_long = __X32_SYSCALL_BIT + 183; +pub const SYS_tuxcall: ::c_long = __X32_SYSCALL_BIT + 184; +pub const SYS_security: ::c_long = __X32_SYSCALL_BIT + 185; +pub const SYS_gettid: ::c_long = __X32_SYSCALL_BIT + 186; +pub const SYS_readahead: ::c_long = __X32_SYSCALL_BIT + 187; +pub const SYS_setxattr: ::c_long = __X32_SYSCALL_BIT + 188; +pub const SYS_lsetxattr: ::c_long = __X32_SYSCALL_BIT + 189; +pub const SYS_fsetxattr: ::c_long = __X32_SYSCALL_BIT + 190; +pub const SYS_getxattr: ::c_long = __X32_SYSCALL_BIT + 191; +pub const SYS_lgetxattr: ::c_long = __X32_SYSCALL_BIT + 192; +pub const SYS_fgetxattr: ::c_long = __X32_SYSCALL_BIT + 193; +pub const SYS_listxattr: ::c_long = __X32_SYSCALL_BIT + 194; +pub const SYS_llistxattr: ::c_long = __X32_SYSCALL_BIT + 195; +pub const SYS_flistxattr: ::c_long = __X32_SYSCALL_BIT + 196; +pub const SYS_removexattr: ::c_long = __X32_SYSCALL_BIT + 197; +pub const SYS_lremovexattr: ::c_long = __X32_SYSCALL_BIT + 198; +pub const SYS_fremovexattr: ::c_long = __X32_SYSCALL_BIT + 199; +pub const SYS_tkill: ::c_long = __X32_SYSCALL_BIT + 200; +pub const SYS_time: ::c_long = __X32_SYSCALL_BIT + 201; +pub const SYS_futex: ::c_long = __X32_SYSCALL_BIT + 202; +pub const SYS_sched_setaffinity: ::c_long = __X32_SYSCALL_BIT + 203; +pub const SYS_sched_getaffinity: ::c_long = __X32_SYSCALL_BIT + 204; +pub const SYS_io_destroy: ::c_long = __X32_SYSCALL_BIT + 207; +pub const SYS_io_getevents: ::c_long = __X32_SYSCALL_BIT + 208; +pub const SYS_io_cancel: ::c_long = __X32_SYSCALL_BIT + 210; +pub const SYS_lookup_dcookie: ::c_long = __X32_SYSCALL_BIT + 212; +pub const SYS_epoll_create: ::c_long = __X32_SYSCALL_BIT + 213; +pub const SYS_remap_file_pages: ::c_long = __X32_SYSCALL_BIT + 216; +pub const SYS_getdents64: ::c_long = __X32_SYSCALL_BIT + 217; +pub const SYS_set_tid_address: ::c_long = __X32_SYSCALL_BIT + 218; +pub const SYS_restart_syscall: ::c_long = __X32_SYSCALL_BIT + 219; +pub const SYS_semtimedop: ::c_long = __X32_SYSCALL_BIT + 220; +pub const SYS_fadvise64: ::c_long = __X32_SYSCALL_BIT + 221; +pub const SYS_timer_settime: ::c_long = __X32_SYSCALL_BIT + 223; +pub const SYS_timer_gettime: ::c_long = __X32_SYSCALL_BIT + 224; +pub const SYS_timer_getoverrun: ::c_long = __X32_SYSCALL_BIT + 225; +pub const SYS_timer_delete: ::c_long = __X32_SYSCALL_BIT + 226; +pub const SYS_clock_settime: ::c_long = __X32_SYSCALL_BIT + 227; +pub const SYS_clock_gettime: ::c_long = __X32_SYSCALL_BIT + 228; +pub const SYS_clock_getres: ::c_long = __X32_SYSCALL_BIT + 229; +pub const SYS_clock_nanosleep: ::c_long = __X32_SYSCALL_BIT + 230; +pub const SYS_exit_group: ::c_long = __X32_SYSCALL_BIT + 231; +pub const SYS_epoll_wait: ::c_long = __X32_SYSCALL_BIT + 232; +pub const SYS_epoll_ctl: ::c_long = __X32_SYSCALL_BIT + 233; +pub const SYS_tgkill: ::c_long = __X32_SYSCALL_BIT + 234; +pub const SYS_utimes: ::c_long = __X32_SYSCALL_BIT + 235; +pub const SYS_mbind: ::c_long = __X32_SYSCALL_BIT + 237; +pub const SYS_set_mempolicy: ::c_long = __X32_SYSCALL_BIT + 238; +pub const SYS_get_mempolicy: ::c_long = __X32_SYSCALL_BIT + 239; +pub const SYS_mq_open: ::c_long = __X32_SYSCALL_BIT + 240; +pub const SYS_mq_unlink: ::c_long = __X32_SYSCALL_BIT + 241; +pub const SYS_mq_timedsend: ::c_long = __X32_SYSCALL_BIT + 242; +pub const SYS_mq_timedreceive: ::c_long = __X32_SYSCALL_BIT + 243; +pub const SYS_mq_getsetattr: ::c_long = __X32_SYSCALL_BIT + 245; +pub const SYS_add_key: ::c_long = __X32_SYSCALL_BIT + 248; +pub const SYS_request_key: ::c_long = __X32_SYSCALL_BIT + 249; +pub const SYS_keyctl: ::c_long = __X32_SYSCALL_BIT + 250; +pub const SYS_ioprio_set: ::c_long = __X32_SYSCALL_BIT + 251; +pub const SYS_ioprio_get: ::c_long = __X32_SYSCALL_BIT + 252; +pub const SYS_inotify_init: ::c_long = __X32_SYSCALL_BIT + 253; +pub const SYS_inotify_add_watch: ::c_long = __X32_SYSCALL_BIT + 254; +pub const SYS_inotify_rm_watch: ::c_long = __X32_SYSCALL_BIT + 255; +pub const SYS_migrate_pages: ::c_long = __X32_SYSCALL_BIT + 256; +pub const SYS_openat: ::c_long = __X32_SYSCALL_BIT + 257; +pub const SYS_mkdirat: ::c_long = __X32_SYSCALL_BIT + 258; +pub const SYS_mknodat: ::c_long = __X32_SYSCALL_BIT + 259; +pub const SYS_fchownat: ::c_long = __X32_SYSCALL_BIT + 260; +pub const SYS_futimesat: ::c_long = __X32_SYSCALL_BIT + 261; +pub const SYS_newfstatat: ::c_long = __X32_SYSCALL_BIT + 262; +pub const SYS_unlinkat: ::c_long = __X32_SYSCALL_BIT + 263; +pub const SYS_renameat: ::c_long = __X32_SYSCALL_BIT + 264; +pub const SYS_linkat: ::c_long = __X32_SYSCALL_BIT + 265; +pub const SYS_symlinkat: ::c_long = __X32_SYSCALL_BIT + 266; +pub const SYS_readlinkat: ::c_long = __X32_SYSCALL_BIT + 267; +pub const SYS_fchmodat: ::c_long = __X32_SYSCALL_BIT + 268; +pub const SYS_faccessat: ::c_long = __X32_SYSCALL_BIT + 269; +pub const SYS_pselect6: ::c_long = __X32_SYSCALL_BIT + 270; +pub const SYS_ppoll: ::c_long = __X32_SYSCALL_BIT + 271; +pub const SYS_unshare: ::c_long = __X32_SYSCALL_BIT + 272; +pub const SYS_splice: ::c_long = __X32_SYSCALL_BIT + 275; +pub const SYS_tee: ::c_long = __X32_SYSCALL_BIT + 276; +pub const SYS_sync_file_range: ::c_long = __X32_SYSCALL_BIT + 277; +pub const SYS_utimensat: ::c_long = __X32_SYSCALL_BIT + 280; +pub const SYS_epoll_pwait: ::c_long = __X32_SYSCALL_BIT + 281; +pub const SYS_signalfd: ::c_long = __X32_SYSCALL_BIT + 282; +pub const SYS_timerfd_create: ::c_long = __X32_SYSCALL_BIT + 283; +pub const SYS_eventfd: ::c_long = __X32_SYSCALL_BIT + 284; +pub const SYS_fallocate: ::c_long = __X32_SYSCALL_BIT + 285; +pub const SYS_timerfd_settime: ::c_long = __X32_SYSCALL_BIT + 286; +pub const SYS_timerfd_gettime: ::c_long = __X32_SYSCALL_BIT + 287; +pub const SYS_accept4: ::c_long = __X32_SYSCALL_BIT + 288; +pub const SYS_signalfd4: ::c_long = __X32_SYSCALL_BIT + 289; +pub const SYS_eventfd2: ::c_long = __X32_SYSCALL_BIT + 290; +pub const SYS_epoll_create1: ::c_long = __X32_SYSCALL_BIT + 291; +pub const SYS_dup3: ::c_long = __X32_SYSCALL_BIT + 292; +pub const SYS_pipe2: ::c_long = __X32_SYSCALL_BIT + 293; +pub const SYS_inotify_init1: ::c_long = __X32_SYSCALL_BIT + 294; +pub const SYS_perf_event_open: ::c_long = __X32_SYSCALL_BIT + 298; +pub const SYS_fanotify_init: ::c_long = __X32_SYSCALL_BIT + 300; +pub const SYS_fanotify_mark: ::c_long = __X32_SYSCALL_BIT + 301; +pub const SYS_prlimit64: ::c_long = __X32_SYSCALL_BIT + 302; +pub const SYS_name_to_handle_at: ::c_long = __X32_SYSCALL_BIT + 303; +pub const SYS_open_by_handle_at: ::c_long = __X32_SYSCALL_BIT + 304; +pub const SYS_clock_adjtime: ::c_long = __X32_SYSCALL_BIT + 305; +pub const SYS_syncfs: ::c_long = __X32_SYSCALL_BIT + 306; +pub const SYS_setns: ::c_long = __X32_SYSCALL_BIT + 308; +pub const SYS_getcpu: ::c_long = __X32_SYSCALL_BIT + 309; +pub const SYS_kcmp: ::c_long = __X32_SYSCALL_BIT + 312; +pub const SYS_finit_module: ::c_long = __X32_SYSCALL_BIT + 313; +pub const SYS_sched_setattr: ::c_long = __X32_SYSCALL_BIT + 314; +pub const SYS_sched_getattr: ::c_long = __X32_SYSCALL_BIT + 315; +pub const SYS_renameat2: ::c_long = __X32_SYSCALL_BIT + 316; +pub const SYS_seccomp: ::c_long = __X32_SYSCALL_BIT + 317; +pub const SYS_getrandom: ::c_long = __X32_SYSCALL_BIT + 318; +pub const SYS_memfd_create: ::c_long = __X32_SYSCALL_BIT + 319; +pub const SYS_kexec_file_load: ::c_long = __X32_SYSCALL_BIT + 320; +pub const SYS_bpf: ::c_long = __X32_SYSCALL_BIT + 321; +pub const SYS_userfaultfd: ::c_long = __X32_SYSCALL_BIT + 323; +pub const SYS_membarrier: ::c_long = __X32_SYSCALL_BIT + 324; +pub const SYS_mlock2: ::c_long = __X32_SYSCALL_BIT + 325; +pub const SYS_copy_file_range: ::c_long = __X32_SYSCALL_BIT + 326; +pub const SYS_pkey_mprotect: ::c_long = __X32_SYSCALL_BIT + 329; +pub const SYS_pkey_alloc: ::c_long = __X32_SYSCALL_BIT + 330; +pub const SYS_pkey_free: ::c_long = __X32_SYSCALL_BIT + 331; +pub const SYS_statx: ::c_long = __X32_SYSCALL_BIT + 332; +pub const SYS_rt_sigaction: ::c_long = __X32_SYSCALL_BIT + 512; +pub const SYS_rt_sigreturn: ::c_long = __X32_SYSCALL_BIT + 513; +pub const SYS_ioctl: ::c_long = __X32_SYSCALL_BIT + 514; +pub const SYS_readv: ::c_long = __X32_SYSCALL_BIT + 515; +pub const SYS_writev: ::c_long = __X32_SYSCALL_BIT + 516; +pub const SYS_recvfrom: ::c_long = __X32_SYSCALL_BIT + 517; +pub const SYS_sendmsg: ::c_long = __X32_SYSCALL_BIT + 518; +pub const SYS_recvmsg: ::c_long = __X32_SYSCALL_BIT + 519; +pub const SYS_execve: ::c_long = __X32_SYSCALL_BIT + 520; +pub const SYS_ptrace: ::c_long = __X32_SYSCALL_BIT + 521; +pub const SYS_rt_sigpending: ::c_long = __X32_SYSCALL_BIT + 522; +pub const SYS_rt_sigtimedwait: ::c_long = __X32_SYSCALL_BIT + 523; +pub const SYS_rt_sigqueueinfo: ::c_long = __X32_SYSCALL_BIT + 524; +pub const SYS_sigaltstack: ::c_long = __X32_SYSCALL_BIT + 525; +pub const SYS_timer_create: ::c_long = __X32_SYSCALL_BIT + 526; +pub const SYS_mq_notify: ::c_long = __X32_SYSCALL_BIT + 527; +pub const SYS_kexec_load: ::c_long = __X32_SYSCALL_BIT + 528; +pub const SYS_waitid: ::c_long = __X32_SYSCALL_BIT + 529; +pub const SYS_set_robust_list: ::c_long = __X32_SYSCALL_BIT + 530; +pub const SYS_get_robust_list: ::c_long = __X32_SYSCALL_BIT + 531; +pub const SYS_vmsplice: ::c_long = __X32_SYSCALL_BIT + 532; +pub const SYS_move_pages: ::c_long = __X32_SYSCALL_BIT + 533; +pub const SYS_preadv: ::c_long = __X32_SYSCALL_BIT + 534; +pub const SYS_pwritev: ::c_long = __X32_SYSCALL_BIT + 535; +pub const SYS_rt_tgsigqueueinfo: ::c_long = __X32_SYSCALL_BIT + 536; +pub const SYS_recvmmsg: ::c_long = __X32_SYSCALL_BIT + 537; +pub const SYS_sendmmsg: ::c_long = __X32_SYSCALL_BIT + 538; +pub const SYS_process_vm_readv: ::c_long = __X32_SYSCALL_BIT + 539; +pub const SYS_process_vm_writev: ::c_long = __X32_SYSCALL_BIT + 540; +pub const SYS_setsockopt: ::c_long = __X32_SYSCALL_BIT + 541; +pub const SYS_getsockopt: ::c_long = __X32_SYSCALL_BIT + 542; +pub const SYS_io_setup: ::c_long = __X32_SYSCALL_BIT + 543; +pub const SYS_io_submit: ::c_long = __X32_SYSCALL_BIT + 544; +pub const SYS_execveat: ::c_long = __X32_SYSCALL_BIT + 545; +pub const SYS_preadv2: ::c_long = __X32_SYSCALL_BIT + 546; +pub const SYS_pwritev2: ::c_long = __X32_SYSCALL_BIT + 547; diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/mod.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,1062 @@ +pub type pthread_t = c_ulong; +pub type __priority_which_t = ::c_uint; +pub type __rlimit_resource_t = ::c_uint; + +s! { + pub struct statx { + pub stx_mask: u32, + pub stx_blksize: u32, + pub stx_attributes: u64, + pub stx_nlink: u32, + pub stx_uid: u32, + pub stx_gid: u32, + pub stx_mode: u16, + pub __statx_pad1: [u16; 1], + pub stx_ino: u64, + pub stx_size: u64, + pub stx_blocks: u64, + pub stx_attributes_mask: u64, + pub stx_atime: ::statx_timestamp, + pub stx_btime: ::statx_timestamp, + pub stx_ctime: ::statx_timestamp, + pub stx_mtime: ::statx_timestamp, + pub stx_rdev_major: u32, + pub stx_rdev_minor: u32, + pub stx_dev_major: u32, + pub stx_dev_minor: u32, + pub __statx_pad2: [u64; 14], + } + + pub struct statx_timestamp { + pub tv_sec: i64, + pub tv_nsec: u32, + pub __statx_timestamp_pad1: [i32; 1], + } + + pub struct aiocb { + pub aio_fildes: ::c_int, + pub aio_lio_opcode: ::c_int, + pub aio_reqprio: ::c_int, + pub aio_buf: *mut ::c_void, + pub aio_nbytes: ::size_t, + pub aio_sigevent: ::sigevent, + __next_prio: *mut aiocb, + __abs_prio: ::c_int, + __policy: ::c_int, + __error_code: ::c_int, + __return_value: ::ssize_t, + pub aio_offset: off_t, + #[cfg(all(not(target_arch = "x86_64"), target_pointer_width = "32"))] + __unused1: [::c_char; 4], + __glibc_reserved: [::c_char; 32] + } + + pub struct __exit_status { + pub e_termination: ::c_short, + pub e_exit: ::c_short, + } + + pub struct __timeval { + pub tv_sec: i32, + pub tv_usec: i32, + } + + pub struct glob64_t { + pub gl_pathc: ::size_t, + pub gl_pathv: *mut *mut ::c_char, + pub gl_offs: ::size_t, + pub gl_flags: ::c_int, + + __unused1: *mut ::c_void, + __unused2: *mut ::c_void, + __unused3: *mut ::c_void, + __unused4: *mut ::c_void, + __unused5: *mut ::c_void, + } + + pub struct msghdr { + pub msg_name: *mut ::c_void, + pub msg_namelen: ::socklen_t, + pub msg_iov: *mut ::iovec, + pub msg_iovlen: ::size_t, + pub msg_control: *mut ::c_void, + pub msg_controllen: ::size_t, + pub msg_flags: ::c_int, + } + + pub struct cmsghdr { + pub cmsg_len: ::size_t, + pub cmsg_level: ::c_int, + pub cmsg_type: ::c_int, + } + + pub struct termios { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; ::NCCS], + #[cfg(not(any( + target_arch = "sparc64", + target_arch = "mips", + target_arch = "mips64")))] + pub c_ispeed: ::speed_t, + #[cfg(not(any( + target_arch = "sparc64", + target_arch = "mips", + target_arch = "mips64")))] + pub c_ospeed: ::speed_t, + } + + pub struct mallinfo { + pub arena: ::c_int, + pub ordblks: ::c_int, + pub smblks: ::c_int, + pub hblks: ::c_int, + pub hblkhd: ::c_int, + pub usmblks: ::c_int, + pub fsmblks: ::c_int, + pub uordblks: ::c_int, + pub fordblks: ::c_int, + pub keepcost: ::c_int, + } + + pub struct nlmsghdr { + pub nlmsg_len: u32, + pub nlmsg_type: u16, + pub nlmsg_flags: u16, + pub nlmsg_seq: u32, + pub nlmsg_pid: u32, + } + + pub struct nlmsgerr { + pub error: ::c_int, + pub msg: nlmsghdr, + } + + pub struct nl_pktinfo { + pub group: u32, + } + + pub struct nl_mmap_req { + pub nm_block_size: ::c_uint, + pub nm_block_nr: ::c_uint, + pub nm_frame_size: ::c_uint, + pub nm_frame_nr: ::c_uint, + } + + pub struct nl_mmap_hdr { + pub nm_status: ::c_uint, + pub nm_len: ::c_uint, + pub nm_group: u32, + pub nm_pid: u32, + pub nm_uid: u32, + pub nm_gid: u32, + } + + pub struct nlattr { + pub nla_len: u16, + pub nla_type: u16, + } + + pub struct rtentry { + pub rt_pad1: ::c_ulong, + pub rt_dst: ::sockaddr, + pub rt_gateway: ::sockaddr, + pub rt_genmask: ::sockaddr, + pub rt_flags: ::c_ushort, + pub rt_pad2: ::c_short, + pub rt_pad3: ::c_ulong, + pub rt_tos: ::c_uchar, + pub rt_class: ::c_uchar, + #[cfg(target_pointer_width = "64")] + pub rt_pad4: [::c_short; 3usize], + #[cfg(not(target_pointer_width = "64"))] + pub rt_pad4: ::c_short, + pub rt_metric: ::c_short, + pub rt_dev: *mut ::c_char, + pub rt_mtu: ::c_ulong, + pub rt_window: ::c_ulong, + pub rt_irtt: ::c_ushort, + } +} + +impl siginfo_t { + pub unsafe fn si_addr(&self) -> *mut ::c_void { + #[repr(C)] + struct siginfo_sigfault { + _si_signo: ::c_int, + _si_errno: ::c_int, + _si_code: ::c_int, + si_addr: *mut ::c_void + } + (*(self as *const siginfo_t as *const siginfo_sigfault)).si_addr + } + + pub unsafe fn si_value(&self) -> ::sigval { + #[repr(C)] + struct siginfo_timer { + _si_signo: ::c_int, + _si_errno: ::c_int, + _si_code: ::c_int, + _si_tid: ::c_int, + _si_overrun: ::c_int, + si_sigval: ::sigval, + } + (*(self as *const siginfo_t as *const siginfo_timer)).si_sigval + } +} + +s_no_extra_traits! { + pub struct utmpx { + pub ut_type: ::c_short, + pub ut_pid: ::pid_t, + pub ut_line: [::c_char; __UT_LINESIZE], + pub ut_id: [::c_char; 4], + + pub ut_user: [::c_char; __UT_NAMESIZE], + pub ut_host: [::c_char; __UT_HOSTSIZE], + pub ut_exit: __exit_status, + + #[cfg(any(target_arch = "aarch64", + target_arch = "s390x", + all(target_pointer_width = "32", + not(target_arch = "x86_64"))))] + pub ut_session: ::c_long, + #[cfg(any(target_arch = "aarch64", + target_arch = "s390x", + all(target_pointer_width = "32", + not(target_arch = "x86_64"))))] + pub ut_tv: ::timeval, + + #[cfg(not(any(target_arch = "aarch64", + target_arch = "s390x", + all(target_pointer_width = "32", + not(target_arch = "x86_64")))))] + pub ut_session: i32, + #[cfg(not(any(target_arch = "aarch64", + target_arch = "s390x", + all(target_pointer_width = "32", + not(target_arch = "x86_64")))))] + pub ut_tv: __timeval, + + pub ut_addr_v6: [i32; 4], + __glibc_reserved: [::c_char; 20], + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for utmpx { + fn eq(&self, other: &utmpx) -> bool { + self.ut_type == other.ut_type + && self.ut_pid == other.ut_pid + && self.ut_line == other.ut_line + && self.ut_id == other.ut_id + && self.ut_user == other.ut_user + && self + .ut_host + .iter() + .zip(other.ut_host.iter()) + .all(|(a,b)| a == b) + && self.ut_exit == other.ut_exit + && self.ut_session == other.ut_session + && self.ut_tv == other.ut_tv + && self.ut_addr_v6 == other.ut_addr_v6 + && self.__glibc_reserved == other.__glibc_reserved + } + } + + impl Eq for utmpx {} + + impl ::fmt::Debug for utmpx { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("utmpx") + .field("ut_type", &self.ut_type) + .field("ut_pid", &self.ut_pid) + .field("ut_line", &self.ut_line) + .field("ut_id", &self.ut_id) + .field("ut_user", &self.ut_user) + // FIXME: .field("ut_host", &self.ut_host) + .field("ut_exit", &self.ut_exit) + .field("ut_session", &self.ut_session) + .field("ut_tv", &self.ut_tv) + .field("ut_addr_v6", &self.ut_addr_v6) + .field("__glibc_reserved", &self.__glibc_reserved) + .finish() + } + } + + impl ::hash::Hash for utmpx { + fn hash(&self, state: &mut H) { + self.ut_type.hash(state); + self.ut_pid.hash(state); + self.ut_line.hash(state); + self.ut_id.hash(state); + self.ut_user.hash(state); + self.ut_host.hash(state); + self.ut_exit.hash(state); + self.ut_session.hash(state); + self.ut_tv.hash(state); + self.ut_addr_v6.hash(state); + self.__glibc_reserved.hash(state); + } + } + } +} + +pub const RLIMIT_CPU: ::__rlimit_resource_t = 0; +pub const RLIMIT_FSIZE: ::__rlimit_resource_t = 1; +pub const RLIMIT_DATA: ::__rlimit_resource_t = 2; +pub const RLIMIT_STACK: ::__rlimit_resource_t = 3; +pub const RLIMIT_CORE: ::__rlimit_resource_t = 4; +pub const RLIMIT_LOCKS: ::__rlimit_resource_t = 10; +pub const RLIMIT_SIGPENDING: ::__rlimit_resource_t = 11; +pub const RLIMIT_MSGQUEUE: ::__rlimit_resource_t = 12; +pub const RLIMIT_NICE: ::__rlimit_resource_t = 13; +pub const RLIMIT_RTPRIO: ::__rlimit_resource_t = 14; +pub const RLIMIT_RTTIME: ::__rlimit_resource_t = 15; +pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = 16; + +pub const MS_RMT_MASK: ::c_ulong = 0x02800051; + +pub const __UT_LINESIZE: usize = 32; +pub const __UT_NAMESIZE: usize = 32; +pub const __UT_HOSTSIZE: usize = 256; +pub const EMPTY: ::c_short = 0; +pub const RUN_LVL: ::c_short = 1; +pub const BOOT_TIME: ::c_short = 2; +pub const NEW_TIME: ::c_short = 3; +pub const OLD_TIME: ::c_short = 4; +pub const INIT_PROCESS: ::c_short = 5; +pub const LOGIN_PROCESS: ::c_short = 6; +pub const USER_PROCESS: ::c_short = 7; +pub const DEAD_PROCESS: ::c_short = 8; +pub const ACCOUNTING: ::c_short = 9; + +pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK; + +pub const SOL_RXRPC: ::c_int = 272; +pub const SOL_PPPOL2TP: ::c_int = 273; +pub const SOL_PNPIPE: ::c_int = 275; +pub const SOL_RDS: ::c_int = 276; +pub const SOL_IUCV: ::c_int = 277; +pub const SOL_CAIF: ::c_int = 278; +pub const SOL_NFC: ::c_int = 280; +pub const SOL_XDP: ::c_int = 283; + +pub const MSG_TRYHARD: ::c_int = 4; + +pub const LC_PAPER: ::c_int = 7; +pub const LC_NAME: ::c_int = 8; +pub const LC_ADDRESS: ::c_int = 9; +pub const LC_TELEPHONE: ::c_int = 10; +pub const LC_MEASUREMENT: ::c_int = 11; +pub const LC_IDENTIFICATION: ::c_int = 12; +pub const LC_PAPER_MASK: ::c_int = (1 << LC_PAPER); +pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME); +pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS); +pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE); +pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT); +pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION); +pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK + | ::LC_NUMERIC_MASK + | ::LC_TIME_MASK + | ::LC_COLLATE_MASK + | ::LC_MONETARY_MASK + | ::LC_MESSAGES_MASK + | LC_PAPER_MASK + | LC_NAME_MASK + | LC_ADDRESS_MASK + | LC_TELEPHONE_MASK + | LC_MEASUREMENT_MASK + | LC_IDENTIFICATION_MASK; + +pub const MAP_SHARED_VALIDATE: ::c_int = 0x3; +pub const MAP_FIXED_NOREPLACE: ::c_int = 0x100000; + +pub const ENOTSUP: ::c_int = EOPNOTSUPP; + +pub const SOCK_SEQPACKET: ::c_int = 5; +pub const SOCK_DCCP: ::c_int = 6; +pub const SOCK_PACKET: ::c_int = 10; + +pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15; +pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16; +pub const TCP_THIN_DUPACK: ::c_int = 17; +pub const TCP_USER_TIMEOUT: ::c_int = 18; +pub const TCP_REPAIR: ::c_int = 19; +pub const TCP_REPAIR_QUEUE: ::c_int = 20; +pub const TCP_QUEUE_SEQ: ::c_int = 21; +pub const TCP_REPAIR_OPTIONS: ::c_int = 22; +pub const TCP_FASTOPEN: ::c_int = 23; +pub const TCP_TIMESTAMP: ::c_int = 24; + +/* DCCP socket options */ +pub const DCCP_SOCKOPT_PACKET_SIZE: ::c_int = 1; +pub const DCCP_SOCKOPT_SERVICE: ::c_int = 2; +pub const DCCP_SOCKOPT_CHANGE_L: ::c_int = 3; +pub const DCCP_SOCKOPT_CHANGE_R: ::c_int = 4; +pub const DCCP_SOCKOPT_GET_CUR_MPS: ::c_int = 5; +pub const DCCP_SOCKOPT_SERVER_TIMEWAIT: ::c_int = 6; +pub const DCCP_SOCKOPT_SEND_CSCOV: ::c_int = 10; +pub const DCCP_SOCKOPT_RECV_CSCOV: ::c_int = 11; +pub const DCCP_SOCKOPT_AVAILABLE_CCIDS: ::c_int = 12; +pub const DCCP_SOCKOPT_CCID: ::c_int = 13; +pub const DCCP_SOCKOPT_TX_CCID: ::c_int = 14; +pub const DCCP_SOCKOPT_RX_CCID: ::c_int = 15; +pub const DCCP_SOCKOPT_QPOLICY_ID: ::c_int = 16; +pub const DCCP_SOCKOPT_QPOLICY_TXQLEN: ::c_int = 17; +pub const DCCP_SOCKOPT_CCID_RX_INFO: ::c_int = 128; +pub const DCCP_SOCKOPT_CCID_TX_INFO: ::c_int = 192; + +/// maximum number of services provided on the same listening port +pub const DCCP_SERVICE_LIST_MAX_LEN: ::c_int = 32; + +pub const SIGEV_THREAD_ID: ::c_int = 4; + +pub const BUFSIZ: ::c_uint = 8192; +pub const TMP_MAX: ::c_uint = 238328; +pub const FOPEN_MAX: ::c_uint = 16; +pub const POSIX_MADV_DONTNEED: ::c_int = 4; +pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41; +pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45; +pub const _SC_PII: ::c_int = 53; +pub const _SC_PII_XTI: ::c_int = 54; +pub const _SC_PII_SOCKET: ::c_int = 55; +pub const _SC_PII_INTERNET: ::c_int = 56; +pub const _SC_PII_OSI: ::c_int = 57; +pub const _SC_POLL: ::c_int = 58; +pub const _SC_SELECT: ::c_int = 59; +pub const _SC_PII_INTERNET_STREAM: ::c_int = 61; +pub const _SC_PII_INTERNET_DGRAM: ::c_int = 62; +pub const _SC_PII_OSI_COTS: ::c_int = 63; +pub const _SC_PII_OSI_CLTS: ::c_int = 64; +pub const _SC_PII_OSI_M: ::c_int = 65; +pub const _SC_T_IOV_MAX: ::c_int = 66; +pub const _SC_2_C_VERSION: ::c_int = 96; +pub const _SC_CHAR_BIT: ::c_int = 101; +pub const _SC_CHAR_MAX: ::c_int = 102; +pub const _SC_CHAR_MIN: ::c_int = 103; +pub const _SC_INT_MAX: ::c_int = 104; +pub const _SC_INT_MIN: ::c_int = 105; +pub const _SC_LONG_BIT: ::c_int = 106; +pub const _SC_WORD_BIT: ::c_int = 107; +pub const _SC_MB_LEN_MAX: ::c_int = 108; +pub const _SC_SSIZE_MAX: ::c_int = 110; +pub const _SC_SCHAR_MAX: ::c_int = 111; +pub const _SC_SCHAR_MIN: ::c_int = 112; +pub const _SC_SHRT_MAX: ::c_int = 113; +pub const _SC_SHRT_MIN: ::c_int = 114; +pub const _SC_UCHAR_MAX: ::c_int = 115; +pub const _SC_UINT_MAX: ::c_int = 116; +pub const _SC_ULONG_MAX: ::c_int = 117; +pub const _SC_USHRT_MAX: ::c_int = 118; +pub const _SC_NL_ARGMAX: ::c_int = 119; +pub const _SC_NL_LANGMAX: ::c_int = 120; +pub const _SC_NL_MSGMAX: ::c_int = 121; +pub const _SC_NL_NMAX: ::c_int = 122; +pub const _SC_NL_SETMAX: ::c_int = 123; +pub const _SC_NL_TEXTMAX: ::c_int = 124; +pub const _SC_BASE: ::c_int = 134; +pub const _SC_C_LANG_SUPPORT: ::c_int = 135; +pub const _SC_C_LANG_SUPPORT_R: ::c_int = 136; +pub const _SC_DEVICE_IO: ::c_int = 140; +pub const _SC_DEVICE_SPECIFIC: ::c_int = 141; +pub const _SC_DEVICE_SPECIFIC_R: ::c_int = 142; +pub const _SC_FD_MGMT: ::c_int = 143; +pub const _SC_FIFO: ::c_int = 144; +pub const _SC_PIPE: ::c_int = 145; +pub const _SC_FILE_ATTRIBUTES: ::c_int = 146; +pub const _SC_FILE_LOCKING: ::c_int = 147; +pub const _SC_FILE_SYSTEM: ::c_int = 148; +pub const _SC_MULTI_PROCESS: ::c_int = 150; +pub const _SC_SINGLE_PROCESS: ::c_int = 151; +pub const _SC_NETWORKING: ::c_int = 152; +pub const _SC_REGEX_VERSION: ::c_int = 156; +pub const _SC_SIGNALS: ::c_int = 158; +pub const _SC_SYSTEM_DATABASE: ::c_int = 162; +pub const _SC_SYSTEM_DATABASE_R: ::c_int = 163; +pub const _SC_USER_GROUPS: ::c_int = 166; +pub const _SC_USER_GROUPS_R: ::c_int = 167; +pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 185; +pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 186; +pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 187; +pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 188; +pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 189; +pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 190; +pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 191; +pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 192; +pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 193; +pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 194; +pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 195; +pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 196; +pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 197; +pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 198; +pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 199; +pub const O_ACCMODE: ::c_int = 3; +pub const ST_RELATIME: ::c_ulong = 4096; +pub const NI_MAXHOST: ::socklen_t = 1025; + +pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5; +pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff; +pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245; +pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45; +pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53; +pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53; +pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53; +pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53; +pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849; +pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6; +pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660; +pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6; +pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f; +pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f; +pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468; +pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478; +pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44; +pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c; +pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969; +pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1; +pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0; +pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f; +pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973; +pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b; +pub const TMPFS_MAGIC: ::c_long = 0x01021994; +pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2; + +pub const CPU_SETSIZE: ::c_int = 0x400; + +pub const PTRACE_TRACEME: ::c_uint = 0; +pub const PTRACE_PEEKTEXT: ::c_uint = 1; +pub const PTRACE_PEEKDATA: ::c_uint = 2; +pub const PTRACE_PEEKUSER: ::c_uint = 3; +pub const PTRACE_POKETEXT: ::c_uint = 4; +pub const PTRACE_POKEDATA: ::c_uint = 5; +pub const PTRACE_POKEUSER: ::c_uint = 6; +pub const PTRACE_CONT: ::c_uint = 7; +pub const PTRACE_KILL: ::c_uint = 8; +pub const PTRACE_SINGLESTEP: ::c_uint = 9; +pub const PTRACE_ATTACH: ::c_uint = 16; +pub const PTRACE_SYSCALL: ::c_uint = 24; +pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200; +pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201; +pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202; +pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203; +pub const PTRACE_GETREGSET: ::c_uint = 0x4204; +pub const PTRACE_SETREGSET: ::c_uint = 0x4205; +pub const PTRACE_SEIZE: ::c_uint = 0x4206; +pub const PTRACE_INTERRUPT: ::c_uint = 0x4207; +pub const PTRACE_LISTEN: ::c_uint = 0x4208; +pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209; + +pub const EPOLLWAKEUP: ::c_int = 0x20000000; + +pub const SEEK_DATA: ::c_int = 3; +pub const SEEK_HOLE: ::c_int = 4; + +pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead; +pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793; +pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278; +pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448; +pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216; + +pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567; +pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123; +pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF; +pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000; +pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC; +pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4; +pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2; +pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543; + +// linux/rtnetlink.h +pub const TCA_PAD: ::c_ushort = 9; +pub const TCA_DUMP_INVISIBLE: ::c_ushort = 10; +pub const TCA_CHAIN: ::c_ushort = 11; +pub const TCA_HW_OFFLOAD: ::c_ushort = 12; + +pub const RTM_DELNETCONF: u16 = 81; +pub const RTM_NEWSTATS: u16 = 92; +pub const RTM_GETSTATS: u16 = 94; +pub const RTM_NEWCACHEREPORT: u16 = 96; + +pub const RTM_F_LOOKUP_TABLE: ::c_uint = 0x1000; +pub const RTM_F_FIB_MATCH: ::c_uint = 0x2000; + +pub const RTA_VIA: ::c_ushort = 18; +pub const RTA_NEWDST: ::c_ushort = 19; +pub const RTA_PREF: ::c_ushort = 20; +pub const RTA_ENCAP_TYPE: ::c_ushort = 21; +pub const RTA_ENCAP: ::c_ushort = 22; +pub const RTA_EXPIRES: ::c_ushort = 23; +pub const RTA_PAD: ::c_ushort = 24; +pub const RTA_UID: ::c_ushort = 25; +pub const RTA_TTL_PROPAGATE: ::c_ushort = 26; + +// linux/neighbor.h +pub const NTF_EXT_LEARNED: u8 = 0x10; +pub const NTF_OFFLOADED: u8 = 0x20; + +pub const NDA_MASTER: ::c_ushort = 9; +pub const NDA_LINK_NETNSID: ::c_ushort = 10; +pub const NDA_SRC_VNI: ::c_ushort = 11; + +// linux/if_addr.h +pub const IFA_FLAGS: ::c_ushort = 8; + +pub const IFA_F_MANAGETEMPADDR: u32 = 0x100; +pub const IFA_F_NOPREFIXROUTE: u32 = 0x200; +pub const IFA_F_MCAUTOJOIN: u32 = 0x400; +pub const IFA_F_STABLE_PRIVACY: u32 = 0x800; + +pub const NETLINK_ROUTE: ::c_int = 0; +pub const NETLINK_UNUSED: ::c_int = 1; +pub const NETLINK_USERSOCK: ::c_int = 2; +pub const NETLINK_FIREWALL: ::c_int = 3; +pub const NETLINK_SOCK_DIAG: ::c_int = 4; +pub const NETLINK_NFLOG: ::c_int = 5; +pub const NETLINK_XFRM: ::c_int = 6; +pub const NETLINK_SELINUX: ::c_int = 7; +pub const NETLINK_ISCSI: ::c_int = 8; +pub const NETLINK_AUDIT: ::c_int = 9; +pub const NETLINK_FIB_LOOKUP: ::c_int = 10; +pub const NETLINK_CONNECTOR: ::c_int = 11; +pub const NETLINK_NETFILTER: ::c_int = 12; +pub const NETLINK_IP6_FW: ::c_int = 13; +pub const NETLINK_DNRTMSG: ::c_int = 14; +pub const NETLINK_KOBJECT_UEVENT: ::c_int = 15; +pub const NETLINK_GENERIC: ::c_int = 16; +pub const NETLINK_SCSITRANSPORT: ::c_int = 18; +pub const NETLINK_ECRYPTFS: ::c_int = 19; +pub const NETLINK_RDMA: ::c_int = 20; +pub const NETLINK_CRYPTO: ::c_int = 21; +pub const NETLINK_INET_DIAG: ::c_int = NETLINK_SOCK_DIAG; + +pub const MAX_LINKS: ::c_int = 32; + +pub const NLM_F_REQUEST: ::c_int = 1; +pub const NLM_F_MULTI: ::c_int = 2; +pub const NLM_F_ACK: ::c_int = 4; +pub const NLM_F_ECHO: ::c_int = 8; +pub const NLM_F_DUMP_INTR: ::c_int = 16; +pub const NLM_F_DUMP_FILTERED: ::c_int = 32; + +pub const NLM_F_ROOT: ::c_int = 0x100; +pub const NLM_F_MATCH: ::c_int = 0x200; +pub const NLM_F_ATOMIC: ::c_int = 0x400; +pub const NLM_F_DUMP: ::c_int = NLM_F_ROOT | NLM_F_MATCH; + +pub const NLM_F_REPLACE: ::c_int = 0x100; +pub const NLM_F_EXCL: ::c_int = 0x200; +pub const NLM_F_CREATE: ::c_int = 0x400; +pub const NLM_F_APPEND: ::c_int = 0x800; + +pub const NETLINK_ADD_MEMBERSHIP: ::c_int = 1; +pub const NETLINK_DROP_MEMBERSHIP: ::c_int = 2; +pub const NETLINK_PKTINFO: ::c_int = 3; +pub const NETLINK_BROADCAST_ERROR: ::c_int = 4; +pub const NETLINK_NO_ENOBUFS: ::c_int = 5; +pub const NETLINK_RX_RING: ::c_int = 6; +pub const NETLINK_TX_RING: ::c_int = 7; +pub const NETLINK_LISTEN_ALL_NSID: ::c_int = 8; +pub const NETLINK_LIST_MEMBERSHIPS: ::c_int = 9; +pub const NETLINK_CAP_ACK: ::c_int = 10; + +pub const NLA_F_NESTED: ::c_int = 1 << 15; +pub const NLA_F_NET_BYTEORDER: ::c_int = 1 << 14; +pub const NLA_TYPE_MASK: ::c_int = !(NLA_F_NESTED | NLA_F_NET_BYTEORDER); + +pub const NLA_ALIGNTO: ::c_int = 4; + +pub const GENL_UNS_ADMIN_PERM: ::c_int = 0x10; + +pub const GENL_ID_VFS_DQUOT: ::c_int = ::NLMSG_MIN_TYPE + 1; +pub const GENL_ID_PMCRAID: ::c_int = ::NLMSG_MIN_TYPE + 2; + +pub const TIOCM_LE: ::c_int = 0x001; +pub const TIOCM_DTR: ::c_int = 0x002; +pub const TIOCM_RTS: ::c_int = 0x004; +pub const TIOCM_CD: ::c_int = TIOCM_CAR; +pub const TIOCM_RI: ::c_int = TIOCM_RNG; + +pub const NF_NETDEV_INGRESS: ::c_int = 0; +pub const NF_NETDEV_NUMHOOKS: ::c_int = 1; + +pub const NFPROTO_INET: ::c_int = 1; +pub const NFPROTO_NETDEV: ::c_int = 5; + +// linux/netfilter/nf_tables.h +pub const NFT_TABLE_MAXNAMELEN: ::c_int = 256; +pub const NFT_CHAIN_MAXNAMELEN: ::c_int = 256; +pub const NFT_SET_MAXNAMELEN: ::c_int = 256; +pub const NFT_OBJ_MAXNAMELEN: ::c_int = 256; +pub const NFT_USERDATA_MAXLEN: ::c_int = 256; + +pub const NFT_REG_VERDICT: ::c_int = 0; +pub const NFT_REG_1: ::c_int = 1; +pub const NFT_REG_2: ::c_int = 2; +pub const NFT_REG_3: ::c_int = 3; +pub const NFT_REG_4: ::c_int = 4; +pub const __NFT_REG_MAX: ::c_int = 5; +pub const NFT_REG32_00: ::c_int = 8; +pub const NFT_REG32_01: ::c_int = 9; +pub const NFT_REG32_02: ::c_int = 10; +pub const NFT_REG32_03: ::c_int = 11; +pub const NFT_REG32_04: ::c_int = 12; +pub const NFT_REG32_05: ::c_int = 13; +pub const NFT_REG32_06: ::c_int = 14; +pub const NFT_REG32_07: ::c_int = 15; +pub const NFT_REG32_08: ::c_int = 16; +pub const NFT_REG32_09: ::c_int = 17; +pub const NFT_REG32_10: ::c_int = 18; +pub const NFT_REG32_11: ::c_int = 19; +pub const NFT_REG32_12: ::c_int = 20; +pub const NFT_REG32_13: ::c_int = 21; +pub const NFT_REG32_14: ::c_int = 22; +pub const NFT_REG32_15: ::c_int = 23; + +pub const NFT_REG_SIZE: ::c_int = 16; +pub const NFT_REG32_SIZE: ::c_int = 4; + +pub const NFT_CONTINUE: ::c_int = -1; +pub const NFT_BREAK: ::c_int = -2; +pub const NFT_JUMP: ::c_int = -3; +pub const NFT_GOTO: ::c_int = -4; +pub const NFT_RETURN: ::c_int = -5; + +pub const NFT_MSG_NEWTABLE: ::c_int = 0; +pub const NFT_MSG_GETTABLE: ::c_int = 1; +pub const NFT_MSG_DELTABLE: ::c_int = 2; +pub const NFT_MSG_NEWCHAIN: ::c_int = 3; +pub const NFT_MSG_GETCHAIN: ::c_int = 4; +pub const NFT_MSG_DELCHAIN: ::c_int = 5; +pub const NFT_MSG_NEWRULE: ::c_int = 6; +pub const NFT_MSG_GETRULE: ::c_int = 7; +pub const NFT_MSG_DELRULE: ::c_int = 8; +pub const NFT_MSG_NEWSET: ::c_int = 9; +pub const NFT_MSG_GETSET: ::c_int = 10; +pub const NFT_MSG_DELSET: ::c_int = 11; +pub const NFT_MSG_NEWSETELEM: ::c_int = 12; +pub const NFT_MSG_GETSETELEM: ::c_int = 13; +pub const NFT_MSG_DELSETELEM: ::c_int = 14; +pub const NFT_MSG_NEWGEN: ::c_int = 15; +pub const NFT_MSG_GETGEN: ::c_int = 16; +pub const NFT_MSG_TRACE: ::c_int = 17; +cfg_if! { + if #[cfg(not(target_arch = "sparc64"))] { + pub const NFT_MSG_NEWOBJ: ::c_int = 18; + pub const NFT_MSG_GETOBJ: ::c_int = 19; + pub const NFT_MSG_DELOBJ: ::c_int = 20; + pub const NFT_MSG_GETOBJ_RESET: ::c_int = 21; + } +} +pub const NFT_MSG_MAX: ::c_int = 25; + +pub const NFT_SET_ANONYMOUS: ::c_int = 0x1; +pub const NFT_SET_CONSTANT: ::c_int = 0x2; +pub const NFT_SET_INTERVAL: ::c_int = 0x4; +pub const NFT_SET_MAP: ::c_int = 0x8; +pub const NFT_SET_TIMEOUT: ::c_int = 0x10; +pub const NFT_SET_EVAL: ::c_int = 0x20; + +pub const NFT_SET_POL_PERFORMANCE: ::c_int = 0; +pub const NFT_SET_POL_MEMORY: ::c_int = 1; + +pub const NFT_SET_ELEM_INTERVAL_END: ::c_int = 0x1; + +pub const NFT_DATA_VALUE: ::c_uint = 0; +pub const NFT_DATA_VERDICT: ::c_uint = 0xffffff00; + +pub const NFT_DATA_RESERVED_MASK: ::c_uint = 0xffffff00; + +pub const NFT_DATA_VALUE_MAXLEN: ::c_int = 64; + +pub const NFT_BYTEORDER_NTOH: ::c_int = 0; +pub const NFT_BYTEORDER_HTON: ::c_int = 1; + +pub const NFT_CMP_EQ: ::c_int = 0; +pub const NFT_CMP_NEQ: ::c_int = 1; +pub const NFT_CMP_LT: ::c_int = 2; +pub const NFT_CMP_LTE: ::c_int = 3; +pub const NFT_CMP_GT: ::c_int = 4; +pub const NFT_CMP_GTE: ::c_int = 5; + +pub const NFT_RANGE_EQ: ::c_int = 0; +pub const NFT_RANGE_NEQ: ::c_int = 1; + +pub const NFT_LOOKUP_F_INV: ::c_int = (1 << 0); + +pub const NFT_DYNSET_OP_ADD: ::c_int = 0; +pub const NFT_DYNSET_OP_UPDATE: ::c_int = 1; + +pub const NFT_DYNSET_F_INV: ::c_int = (1 << 0); + +pub const NFT_PAYLOAD_LL_HEADER: ::c_int = 0; +pub const NFT_PAYLOAD_NETWORK_HEADER: ::c_int = 1; +pub const NFT_PAYLOAD_TRANSPORT_HEADER: ::c_int = 2; + +pub const NFT_PAYLOAD_CSUM_NONE: ::c_int = 0; +pub const NFT_PAYLOAD_CSUM_INET: ::c_int = 1; + +pub const NFT_META_LEN: ::c_int = 0; +pub const NFT_META_PROTOCOL: ::c_int = 1; +pub const NFT_META_PRIORITY: ::c_int = 2; +pub const NFT_META_MARK: ::c_int = 3; +pub const NFT_META_IIF: ::c_int = 4; +pub const NFT_META_OIF: ::c_int = 5; +pub const NFT_META_IIFNAME: ::c_int = 6; +pub const NFT_META_OIFNAME: ::c_int = 7; +pub const NFT_META_IIFTYPE: ::c_int = 8; +pub const NFT_META_OIFTYPE: ::c_int = 9; +pub const NFT_META_SKUID: ::c_int = 10; +pub const NFT_META_SKGID: ::c_int = 11; +pub const NFT_META_NFTRACE: ::c_int = 12; +pub const NFT_META_RTCLASSID: ::c_int = 13; +pub const NFT_META_SECMARK: ::c_int = 14; +pub const NFT_META_NFPROTO: ::c_int = 15; +pub const NFT_META_L4PROTO: ::c_int = 16; +pub const NFT_META_BRI_IIFNAME: ::c_int = 17; +pub const NFT_META_BRI_OIFNAME: ::c_int = 18; +pub const NFT_META_PKTTYPE: ::c_int = 19; +pub const NFT_META_CPU: ::c_int = 20; +pub const NFT_META_IIFGROUP: ::c_int = 21; +pub const NFT_META_OIFGROUP: ::c_int = 22; +pub const NFT_META_CGROUP: ::c_int = 23; +pub const NFT_META_PRANDOM: ::c_int = 24; + +pub const NFT_CT_STATE: ::c_int = 0; +pub const NFT_CT_DIRECTION: ::c_int = 1; +pub const NFT_CT_STATUS: ::c_int = 2; +pub const NFT_CT_MARK: ::c_int = 3; +pub const NFT_CT_SECMARK: ::c_int = 4; +pub const NFT_CT_EXPIRATION: ::c_int = 5; +pub const NFT_CT_HELPER: ::c_int = 6; +pub const NFT_CT_L3PROTOCOL: ::c_int = 7; +pub const NFT_CT_SRC: ::c_int = 8; +pub const NFT_CT_DST: ::c_int = 9; +pub const NFT_CT_PROTOCOL: ::c_int = 10; +pub const NFT_CT_PROTO_SRC: ::c_int = 11; +pub const NFT_CT_PROTO_DST: ::c_int = 12; +pub const NFT_CT_LABELS: ::c_int = 13; +pub const NFT_CT_PKTS: ::c_int = 14; +pub const NFT_CT_BYTES: ::c_int = 15; + +pub const NFT_LIMIT_PKTS: ::c_int = 0; +pub const NFT_LIMIT_PKT_BYTES: ::c_int = 1; + +pub const NFT_LIMIT_F_INV: ::c_int = (1 << 0); + +pub const NFT_QUEUE_FLAG_BYPASS: ::c_int = 0x01; +pub const NFT_QUEUE_FLAG_CPU_FANOUT: ::c_int = 0x02; +pub const NFT_QUEUE_FLAG_MASK: ::c_int = 0x03; + +pub const NFT_QUOTA_F_INV: ::c_int = (1 << 0); + +pub const NFT_REJECT_ICMP_UNREACH: ::c_int = 0; +pub const NFT_REJECT_TCP_RST: ::c_int = 1; +pub const NFT_REJECT_ICMPX_UNREACH: ::c_int = 2; + +pub const NFT_REJECT_ICMPX_NO_ROUTE: ::c_int = 0; +pub const NFT_REJECT_ICMPX_PORT_UNREACH: ::c_int = 1; +pub const NFT_REJECT_ICMPX_HOST_UNREACH: ::c_int = 2; +pub const NFT_REJECT_ICMPX_ADMIN_PROHIBITED: ::c_int = 3; + +pub const NFT_NAT_SNAT: ::c_int = 0; +pub const NFT_NAT_DNAT: ::c_int = 1; + +pub const NFT_TRACETYPE_UNSPEC: ::c_int = 0; +pub const NFT_TRACETYPE_POLICY: ::c_int = 1; +pub const NFT_TRACETYPE_RETURN: ::c_int = 2; +pub const NFT_TRACETYPE_RULE: ::c_int = 3; + +pub const NFT_NG_INCREMENTAL: ::c_int = 0; +pub const NFT_NG_RANDOM: ::c_int = 1; + +pub const M_MXFAST: ::c_int = 1; +pub const M_NLBLKS: ::c_int = 2; +pub const M_GRAIN: ::c_int = 3; +pub const M_KEEP: ::c_int = 4; +pub const M_TRIM_THRESHOLD: ::c_int = -1; +pub const M_TOP_PAD: ::c_int = -2; +pub const M_MMAP_THRESHOLD: ::c_int = -3; +pub const M_MMAP_MAX: ::c_int = -4; +pub const M_CHECK_ACTION: ::c_int = -5; +pub const M_PERTURB: ::c_int = -6; +pub const M_ARENA_TEST: ::c_int = -7; +pub const M_ARENA_MAX: ::c_int = -8; + +pub const AT_STATX_SYNC_TYPE: ::c_int = 0x6000; +pub const AT_STATX_SYNC_AS_STAT: ::c_int = 0x0000; +pub const AT_STATX_FORCE_SYNC: ::c_int = 0x2000; +pub const AT_STATX_DONT_SYNC: ::c_int = 0x4000; +pub const STATX_TYPE: ::c_uint = 0x0001; +pub const STATX_MODE: ::c_uint = 0x0002; +pub const STATX_NLINK: ::c_uint = 0x0004; +pub const STATX_UID: ::c_uint = 0x0008; +pub const STATX_GID: ::c_uint = 0x0010; +pub const STATX_ATIME: ::c_uint = 0x0020; +pub const STATX_MTIME: ::c_uint = 0x0040; +pub const STATX_CTIME: ::c_uint = 0x0080; +pub const STATX_INO: ::c_uint = 0x0100; +pub const STATX_SIZE: ::c_uint = 0x0200; +pub const STATX_BLOCKS: ::c_uint = 0x0400; +pub const STATX_BASIC_STATS: ::c_uint = 0x07ff; +pub const STATX_BTIME: ::c_uint = 0x0800; +pub const STATX_ALL: ::c_uint = 0x0fff; +pub const STATX__RESERVED: ::c_int = 0x80000000; +pub const STATX_ATTR_COMPRESSED: ::c_int = 0x0004; +pub const STATX_ATTR_IMMUTABLE: ::c_int = 0x0010; +pub const STATX_ATTR_APPEND: ::c_int = 0x0020; +pub const STATX_ATTR_NODUMP: ::c_int = 0x0040; +pub const STATX_ATTR_ENCRYPTED: ::c_int = 0x0800; +pub const STATX_ATTR_AUTOMOUNT: ::c_int = 0x1000; + +cfg_if! { + if #[cfg(any( + target_arch = "arm", + target_arch = "x86", + target_arch = "x86_64", + target_arch = "s390x" + ))] { + pub const PTHREAD_STACK_MIN: ::size_t = 16384; + } else if #[cfg(target_arch = "sparc64")] { + pub const PTHREAD_STACK_MIN: ::size_t = 0x6000; + } else { + pub const PTHREAD_STACK_MIN: ::size_t = 131072; + } +} +pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 3; + +f! { + pub fn NLA_ALIGN(len: ::c_int) -> ::c_int { + return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1) + } +} + +extern { + pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, + flags: ::c_int) -> ::c_int; + pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, + flags: ::c_int, timeout: *mut ::timespec) -> ::c_int; + + pub fn getrlimit64(resource: ::__rlimit_resource_t, + rlim: *mut ::rlimit64) -> ::c_int; + pub fn setrlimit64(resource: ::__rlimit_resource_t, + rlim: *const ::rlimit64) -> ::c_int; + pub fn getrlimit(resource: ::__rlimit_resource_t, + rlim: *mut ::rlimit) -> ::c_int; + pub fn setrlimit(resource: ::__rlimit_resource_t, + rlim: *const ::rlimit) -> ::c_int; + pub fn prlimit(pid: ::pid_t, + resource: ::__rlimit_resource_t, new_limit: *const ::rlimit, + old_limit: *mut ::rlimit) -> ::c_int; + pub fn prlimit64(pid: ::pid_t, + resource: ::__rlimit_resource_t, + new_limit: *const ::rlimit64, + old_limit: *mut ::rlimit64) -> ::c_int; + pub fn utmpxname(file: *const ::c_char) -> ::c_int; + pub fn getutxent() -> *mut utmpx; + pub fn getutxid(ut: *const utmpx) -> *mut utmpx; + pub fn getutxline(ut: *const utmpx) -> *mut utmpx; + pub fn pututxline(ut: *const utmpx) -> *mut utmpx; + pub fn setutxent(); + pub fn endutxent(); + pub fn getpt() -> ::c_int; + pub fn mallopt(param: ::c_int, value: ::c_int) -> ::c_int; + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::timezone) -> ::c_int; + pub fn statx(dirfd: ::c_int, pathname: *const c_char, flags: ::c_int, + mask: ::c_uint, statxbuf: *mut statx) -> ::c_int; + pub fn getrandom( + buf: *mut ::c_void, + buflen: ::size_t, + flags: ::c_uint, + ) -> ::ssize_t; +} + +#[link(name = "util")] +extern { + pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; + pub fn backtrace(buf: *mut *mut ::c_void, + sz: ::c_int) -> ::c_int; + pub fn glob64(pattern: *const ::c_char, + flags: ::c_int, + errfunc: ::Option ::c_int>, + pglob: *mut glob64_t) -> ::c_int; + pub fn globfree64(pglob: *mut glob64_t); + pub fn ptrace(request: ::c_uint, ...) -> ::c_long; + pub fn pthread_attr_getaffinity_np(attr: *const ::pthread_attr_t, + cpusetsize: ::size_t, + cpuset: *mut ::cpu_set_t) -> ::c_int; + pub fn pthread_attr_setaffinity_np(attr: *mut ::pthread_attr_t, + cpusetsize: ::size_t, + cpuset: *const ::cpu_set_t) -> ::c_int; + pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int; + pub fn setpriority(which: ::__priority_which_t, who: ::id_t, + prio: ::c_int) -> ::c_int; + pub fn pthread_getaffinity_np(thread: ::pthread_t, + cpusetsize: ::size_t, + cpuset: *mut ::cpu_set_t) -> ::c_int; + pub fn pthread_setaffinity_np(thread: ::pthread_t, + cpusetsize: ::size_t, + cpuset: *const ::cpu_set_t) -> ::c_int; + pub fn pthread_rwlockattr_getkind_np(attr: *const ::pthread_rwlockattr_t, + val: *mut ::c_int) -> ::c_int; + pub fn pthread_rwlockattr_setkind_np(attr: *mut ::pthread_rwlockattr_t, + val: ::c_int) -> ::c_int; + pub fn sched_getcpu() -> ::c_int; + pub fn mallinfo() -> ::mallinfo; + pub fn malloc_usable_size(ptr: *mut ::c_void) -> ::size_t; + pub fn getauxval(type_: ::c_ulong) -> ::c_ulong; + #[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")] + #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwent_r")] + pub fn getpwent_r(pwd: *mut ::passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::passwd) -> ::c_int; + #[cfg_attr(target_os = "netbsd", link_name = "__getgrent_r50")] + #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrent_r")] + pub fn getgrent_r(grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group) -> ::c_int; + pub fn pthread_getname_np(thread: ::pthread_t, + name: *mut ::c_char, + len: ::size_t) -> ::c_int; + pub fn pthread_setname_np(thread: ::pthread_t, + name: *const ::c_char) -> ::c_int; +} + +cfg_if! { + if #[cfg(any(target_arch = "x86", + target_arch = "arm", + target_arch = "mips", + target_arch = "powerpc"))] { + mod b32; + pub use self::b32::*; + } else if #[cfg(any(target_arch = "x86_64", + target_arch = "aarch64", + target_arch = "powerpc64", + target_arch = "mips64", + target_arch = "s390x", + target_arch = "sparc64"))] { + mod b64; + pub use self::b64::*; + } else { + // Unknown target_arch + } +} + +cfg_if! { + if #[cfg(libc_align)] { + mod align; + pub use self::align::*; + } else { + mod no_align; + pub use self::no_align::*; + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/no_align.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/no_align.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/gnu/no_align.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/gnu/no_align.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,10 @@ +s! { + // FIXME this is actually a union + pub struct sem_t { + #[cfg(target_pointer_width = "32")] + __size: [::c_char; 16], + #[cfg(target_pointer_width = "64")] + __size: [::c_char; 32], + __align: [::c_long; 0], + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/mod.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,2739 @@ +//! Linux-specific definitions for linux-like values + +pub type useconds_t = u32; +pub type dev_t = u64; +pub type socklen_t = u32; +pub type mode_t = u32; +pub type ino64_t = u64; +pub type off64_t = i64; +pub type blkcnt64_t = i64; +pub type rlim64_t = u64; +pub type mqd_t = ::c_int; +pub type nfds_t = ::c_ulong; +pub type nl_item = ::c_int; +pub type idtype_t = ::c_uint; +pub type loff_t = ::c_longlong; +pub type pthread_key_t = ::c_uint; + +pub type __u8 = ::c_uchar; +pub type __u16 = ::c_ushort; +pub type __s16 = ::c_short; +pub type __u32 = ::c_uint; +pub type __s32 = ::c_int; + +pub type Elf32_Half = u16; +pub type Elf32_Word = u32; +pub type Elf32_Off = u32; +pub type Elf32_Addr = u32; + +pub type Elf64_Half = u16; +pub type Elf64_Word = u32; +pub type Elf64_Off = u64; +pub type Elf64_Addr = u64; +pub type Elf64_Xword = u64; +pub type Elf64_Sxword = i64; + +pub type Elf32_Section = u16; +pub type Elf64_Section = u16; + +#[cfg_attr(feature = "extra_traits", derive(Debug))] +pub enum fpos64_t {} // TODO: fill this out with a struct +impl ::Copy for fpos64_t {} +impl ::Clone for fpos64_t { + fn clone(&self) -> fpos64_t { *self } +} + +s! { + pub struct rlimit64 { + pub rlim_cur: rlim64_t, + pub rlim_max: rlim64_t, + } + + pub struct glob_t { + pub gl_pathc: ::size_t, + pub gl_pathv: *mut *mut c_char, + pub gl_offs: ::size_t, + pub gl_flags: ::c_int, + + __unused1: *mut ::c_void, + __unused2: *mut ::c_void, + __unused3: *mut ::c_void, + __unused4: *mut ::c_void, + __unused5: *mut ::c_void, + } + + pub struct passwd { + pub pw_name: *mut ::c_char, + pub pw_passwd: *mut ::c_char, + pub pw_uid: ::uid_t, + pub pw_gid: ::gid_t, + pub pw_gecos: *mut ::c_char, + pub pw_dir: *mut ::c_char, + pub pw_shell: *mut ::c_char, + } + + pub struct spwd { + pub sp_namp: *mut ::c_char, + pub sp_pwdp: *mut ::c_char, + pub sp_lstchg: ::c_long, + pub sp_min: ::c_long, + pub sp_max: ::c_long, + pub sp_warn: ::c_long, + pub sp_inact: ::c_long, + pub sp_expire: ::c_long, + pub sp_flag: ::c_ulong, + } + + pub struct dqblk { + pub dqb_bhardlimit: u64, + pub dqb_bsoftlimit: u64, + pub dqb_curspace: u64, + pub dqb_ihardlimit: u64, + pub dqb_isoftlimit: u64, + pub dqb_curinodes: u64, + pub dqb_btime: u64, + pub dqb_itime: u64, + pub dqb_valid: u32, + } + + pub struct signalfd_siginfo { + pub ssi_signo: u32, + pub ssi_errno: i32, + pub ssi_code: i32, + pub ssi_pid: u32, + pub ssi_uid: u32, + pub ssi_fd: i32, + pub ssi_tid: u32, + pub ssi_band: u32, + pub ssi_overrun: u32, + pub ssi_trapno: u32, + pub ssi_status: i32, + pub ssi_int: i32, + pub ssi_ptr: u64, + pub ssi_utime: u64, + pub ssi_stime: u64, + pub ssi_addr: u64, + pub ssi_addr_lsb: u16, + _pad2: u16, + pub ssi_syscall: i32, + pub ssi_call_addr: u64, + pub ssi_arch: u32, + _pad: [u8; 28], + } + + pub struct itimerspec { + pub it_interval: ::timespec, + pub it_value: ::timespec, + } + + pub struct fsid_t { + __val: [::c_int; 2], + } + + pub struct packet_mreq { + pub mr_ifindex: ::c_int, + pub mr_type: ::c_ushort, + pub mr_alen: ::c_ushort, + pub mr_address: [::c_uchar; 8], + } + + pub struct cpu_set_t { + #[cfg(all(target_pointer_width = "32", + not(target_arch = "x86_64")))] + bits: [u32; 32], + #[cfg(not(all(target_pointer_width = "32", + not(target_arch = "x86_64"))))] + bits: [u64; 16], + } + + pub struct if_nameindex { + pub if_index: ::c_uint, + pub if_name: *mut ::c_char, + } + + // System V IPC + pub struct msginfo { + pub msgpool: ::c_int, + pub msgmap: ::c_int, + pub msgmax: ::c_int, + pub msgmnb: ::c_int, + pub msgmni: ::c_int, + pub msgssz: ::c_int, + pub msgtql: ::c_int, + pub msgseg: ::c_ushort, + } + + pub struct sembuf { + pub sem_num: ::c_ushort, + pub sem_op: ::c_short, + pub sem_flg: ::c_short, + } + + pub struct input_event { + pub time: ::timeval, + pub type_: ::__u16, + pub code: ::__u16, + pub value: ::__s32, + } + + pub struct input_id { + pub bustype: ::__u16, + pub vendor: ::__u16, + pub product: ::__u16, + pub version: ::__u16, + } + + pub struct input_absinfo { + pub value: ::__s32, + pub minimum: ::__s32, + pub maximum: ::__s32, + pub fuzz: ::__s32, + pub flat: ::__s32, + pub resolution: ::__s32, + } + + pub struct input_keymap_entry { + pub flags: ::__u8, + pub len: ::__u8, + pub index: ::__u16, + pub keycode: ::__u32, + pub scancode: [::__u8; 32], + } + + pub struct input_mask { + pub type_: ::__u32, + pub codes_size: ::__u32, + pub codes_ptr: ::__u64, + } + + pub struct ff_replay { + pub length: ::__u16, + pub delay: ::__u16, + } + + pub struct ff_trigger { + pub button: ::__u16, + pub interval: ::__u16, + } + + pub struct ff_envelope { + pub attack_length: ::__u16, + pub attack_level: ::__u16, + pub fade_length: ::__u16, + pub fade_level: ::__u16, + } + + pub struct ff_constant_effect { + pub level: ::__s16, + pub envelope: ff_envelope, + } + + pub struct ff_ramp_effect { + pub start_level: ::__s16, + pub end_level: ::__s16, + pub envelope: ff_envelope, + } + + pub struct ff_condition_effect { + pub right_saturation: ::__u16, + pub left_saturation: ::__u16, + + pub right_coeff: ::__s16, + pub left_coeff: ::__s16, + + pub deadband: ::__u16, + pub center: ::__s16, + } + + pub struct ff_periodic_effect { + pub waveform: ::__u16, + pub period: ::__u16, + pub magnitude: ::__s16, + pub offset: ::__s16, + pub phase: ::__u16, + + pub envelope: ff_envelope, + + pub custom_len: ::__u32, + pub custom_data: *mut ::__s16, + } + + pub struct ff_rumble_effect { + pub strong_magnitude: ::__u16, + pub weak_magnitude: ::__u16, + } + + pub struct ff_effect { + pub type_: ::__u16, + pub id: ::__s16, + pub direction: ::__u16, + pub trigger: ff_trigger, + pub replay: ff_replay, + // FIXME this is actually a union + #[cfg(target_pointer_width = "64")] + pub u: [u64; 4], + #[cfg(target_pointer_width = "32")] + pub u: [u32; 7], + } + + pub struct dl_phdr_info { + #[cfg(target_pointer_width = "64")] + pub dlpi_addr: Elf64_Addr, + #[cfg(target_pointer_width = "32")] + pub dlpi_addr: Elf32_Addr, + + pub dlpi_name: *const ::c_char, + + #[cfg(target_pointer_width = "64")] + pub dlpi_phdr: *const Elf64_Phdr, + #[cfg(target_pointer_width = "32")] + pub dlpi_phdr: *const Elf32_Phdr, + + #[cfg(target_pointer_width = "64")] + pub dlpi_phnum: Elf64_Half, + #[cfg(target_pointer_width = "32")] + pub dlpi_phnum: Elf32_Half, + + pub dlpi_adds: ::c_ulonglong, + pub dlpi_subs: ::c_ulonglong, + pub dlpi_tls_modid: ::size_t, + pub dlpi_tls_data: *mut ::c_void, + } + + pub struct Elf32_Ehdr { + pub e_ident: [::c_uchar; 16], + pub e_type: Elf32_Half, + pub e_machine: Elf32_Half, + pub e_version: Elf32_Word, + pub e_entry: Elf32_Addr, + pub e_phoff: Elf32_Off, + pub e_shoff: Elf32_Off, + pub e_flags: Elf32_Word, + pub e_ehsize: Elf32_Half, + pub e_phentsize: Elf32_Half, + pub e_phnum: Elf32_Half, + pub e_shentsize: Elf32_Half, + pub e_shnum: Elf32_Half, + pub e_shstrndx: Elf32_Half, + } + + pub struct Elf64_Ehdr { + pub e_ident: [::c_uchar; 16], + pub e_type: Elf64_Half, + pub e_machine: Elf64_Half, + pub e_version: Elf64_Word, + pub e_entry: Elf64_Addr, + pub e_phoff: Elf64_Off, + pub e_shoff: Elf64_Off, + pub e_flags: Elf64_Word, + pub e_ehsize: Elf64_Half, + pub e_phentsize: Elf64_Half, + pub e_phnum: Elf64_Half, + pub e_shentsize: Elf64_Half, + pub e_shnum: Elf64_Half, + pub e_shstrndx: Elf64_Half, + } + + pub struct Elf32_Sym { + pub st_name: Elf32_Word, + pub st_value: Elf32_Addr, + pub st_size: Elf32_Word, + pub st_info: ::c_uchar, + pub st_other: ::c_uchar, + pub st_shndx: Elf32_Section, + } + + pub struct Elf64_Sym { + pub st_name: Elf64_Word, + pub st_info: ::c_uchar, + pub st_other: ::c_uchar, + pub st_shndx: Elf64_Section, + pub st_value: Elf64_Addr, + pub st_size: Elf64_Xword, + } + + pub struct Elf32_Phdr { + pub p_type: Elf32_Word, + pub p_offset: Elf32_Off, + pub p_vaddr: Elf32_Addr, + pub p_paddr: Elf32_Addr, + pub p_filesz: Elf32_Word, + pub p_memsz: Elf32_Word, + pub p_flags: Elf32_Word, + pub p_align: Elf32_Word, + } + + pub struct Elf64_Phdr { + pub p_type: Elf64_Word, + pub p_flags: Elf64_Word, + pub p_offset: Elf64_Off, + pub p_vaddr: Elf64_Addr, + pub p_paddr: Elf64_Addr, + pub p_filesz: Elf64_Xword, + pub p_memsz: Elf64_Xword, + pub p_align: Elf64_Xword, + } + + pub struct Elf32_Shdr { + pub sh_name: Elf32_Word, + pub sh_type: Elf32_Word, + pub sh_flags: Elf32_Word, + pub sh_addr: Elf32_Addr, + pub sh_offset: Elf32_Off, + pub sh_size: Elf32_Word, + pub sh_link: Elf32_Word, + pub sh_info: Elf32_Word, + pub sh_addralign: Elf32_Word, + pub sh_entsize: Elf32_Word, + } + + pub struct Elf64_Shdr { + pub sh_name: Elf64_Word, + pub sh_type: Elf64_Word, + pub sh_flags: Elf64_Xword, + pub sh_addr: Elf64_Addr, + pub sh_offset: Elf64_Off, + pub sh_size: Elf64_Xword, + pub sh_link: Elf64_Word, + pub sh_info: Elf64_Word, + pub sh_addralign: Elf64_Xword, + pub sh_entsize: Elf64_Xword, + } + + pub struct Elf32_Chdr { + pub ch_type: Elf32_Word, + pub ch_size: Elf32_Word, + pub ch_addralign: Elf32_Word, + } + + pub struct Elf64_Chdr { + pub ch_type: Elf64_Word, + pub ch_reserved: Elf64_Word, + pub ch_size: Elf64_Xword, + pub ch_addralign: Elf64_Xword, + } + + pub struct ucred { + pub pid: ::pid_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + } + + pub struct mntent { + pub mnt_fsname: *mut ::c_char, + pub mnt_dir: *mut ::c_char, + pub mnt_type: *mut ::c_char, + pub mnt_opts: *mut ::c_char, + pub mnt_freq: ::c_int, + pub mnt_passno: ::c_int, + } + + pub struct posix_spawn_file_actions_t { + __allocated: ::c_int, + __used: ::c_int, + __actions: *mut ::c_int, + __pad: [::c_int; 16], + } + + pub struct posix_spawnattr_t { + __flags: ::c_short, + __pgrp: ::pid_t, + __sd: ::sigset_t, + __ss: ::sigset_t, + #[cfg(target_env = "musl")] + __prio: ::c_int, + #[cfg(not(target_env = "musl"))] + __sp: ::sched_param, + __policy: ::c_int, + __pad: [::c_int; 16], + } + + pub struct genlmsghdr { + pub cmd: u8, + pub version: u8, + pub reserved: u16, + } + + pub struct in6_pktinfo { + pub ipi6_addr: ::in6_addr, + pub ipi6_ifindex: ::c_uint, + } + + pub struct arpd_request { + pub req: ::c_ushort, + pub ip: u32, + pub dev: ::c_ulong, + pub stamp: ::c_ulong, + pub updated: ::c_ulong, + pub ha: [::c_uchar; ::MAX_ADDR_LEN], + } + + pub struct inotify_event { + pub wd: ::c_int, + pub mask: u32, + pub cookie: u32, + pub len: u32 + } + + pub struct sockaddr_vm { + pub svm_family: ::sa_family_t, + pub svm_reserved1: ::c_ushort, + pub svm_port: ::c_uint, + pub svm_cid: ::c_uint, + pub svm_zero: [u8; 4] + } +} + +s_no_extra_traits!{ + pub struct sockaddr_nl { + pub nl_family: ::sa_family_t, + nl_pad: ::c_ushort, + pub nl_pid: u32, + pub nl_groups: u32 + } + + pub struct dirent { + pub d_ino: ::ino_t, + pub d_off: ::off_t, + pub d_reclen: ::c_ushort, + pub d_type: ::c_uchar, + pub d_name: [::c_char; 256], + } + + pub struct dirent64 { + pub d_ino: ::ino64_t, + pub d_off: ::off64_t, + pub d_reclen: ::c_ushort, + pub d_type: ::c_uchar, + pub d_name: [::c_char; 256], + } + + pub struct sockaddr_alg { + pub salg_family: ::sa_family_t, + pub salg_type: [::c_uchar; 14], + pub salg_feat: u32, + pub salg_mask: u32, + pub salg_name: [::c_uchar; 64], + } + + pub struct af_alg_iv { + pub ivlen: u32, + pub iv: [::c_uchar; 0], + } + + // x32 compatibility + // See https://sourceware.org/bugzilla/show_bug.cgi?id=21279 + pub struct mq_attr { + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub mq_flags: i64, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub mq_maxmsg: i64, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub mq_msgsize: i64, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub mq_curmsgs: i64, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pad: [i64; 4], + + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub mq_flags: ::c_long, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub mq_maxmsg: ::c_long, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub mq_msgsize: ::c_long, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub mq_curmsgs: ::c_long, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pad: [::c_long; 4], + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for sockaddr_nl { + fn eq(&self, other: &sockaddr_nl) -> bool { + self.nl_family == other.nl_family && + self.nl_pid == other.nl_pid && + self.nl_groups == other.nl_groups + } + } + impl Eq for sockaddr_nl {} + impl ::fmt::Debug for sockaddr_nl { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sockaddr_nl") + .field("nl_family", &self.nl_family) + .field("nl_pid", &self.nl_pid) + .field("nl_groups", &self.nl_groups) + .finish() + } + } + impl ::hash::Hash for sockaddr_nl { + fn hash(&self, state: &mut H) { + self.nl_family.hash(state); + self.nl_pid.hash(state); + self.nl_groups.hash(state); + } + } + + impl PartialEq for dirent { + fn eq(&self, other: &dirent) -> bool { + self.d_ino == other.d_ino + && self.d_off == other.d_off + && self.d_reclen == other.d_reclen + && self.d_type == other.d_type + && self + .d_name + .iter() + .zip(other.d_name.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for dirent {} + + impl ::fmt::Debug for dirent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("dirent") + .field("d_ino", &self.d_ino) + .field("d_off", &self.d_off) + .field("d_reclen", &self.d_reclen) + .field("d_type", &self.d_type) + // FIXME: .field("d_name", &self.d_name) + .finish() + } + } + + impl ::hash::Hash for dirent { + fn hash(&self, state: &mut H) { + self.d_ino.hash(state); + self.d_off.hash(state); + self.d_reclen.hash(state); + self.d_type.hash(state); + self.d_name.hash(state); + } + } + + impl PartialEq for dirent64 { + fn eq(&self, other: &dirent64) -> bool { + self.d_ino == other.d_ino + && self.d_off == other.d_off + && self.d_reclen == other.d_reclen + && self.d_type == other.d_type + && self + .d_name + .iter() + .zip(other.d_name.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for dirent64 {} + + impl ::fmt::Debug for dirent64 { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("dirent64") + .field("d_ino", &self.d_ino) + .field("d_off", &self.d_off) + .field("d_reclen", &self.d_reclen) + .field("d_type", &self.d_type) + // FIXME: .field("d_name", &self.d_name) + .finish() + } + } + + impl ::hash::Hash for dirent64 { + fn hash(&self, state: &mut H) { + self.d_ino.hash(state); + self.d_off.hash(state); + self.d_reclen.hash(state); + self.d_type.hash(state); + self.d_name.hash(state); + } + } + + impl PartialEq for pthread_cond_t { + fn eq(&self, other: &pthread_cond_t) -> bool { + self.size.iter().zip(other.size.iter()).all(|(a,b)| a == b) + } + } + + impl Eq for pthread_cond_t {} + + impl ::fmt::Debug for pthread_cond_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("pthread_cond_t") + // FIXME: .field("size", &self.size) + .finish() + } + } + + impl ::hash::Hash for pthread_cond_t { + fn hash(&self, state: &mut H) { + self.size.hash(state); + } + } + + impl PartialEq for pthread_mutex_t { + fn eq(&self, other: &pthread_mutex_t) -> bool { + self.size.iter().zip(other.size.iter()).all(|(a,b)| a == b) + } + } + + impl Eq for pthread_mutex_t {} + + impl ::fmt::Debug for pthread_mutex_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("pthread_mutex_t") + // FIXME: .field("size", &self.size) + .finish() + } + } + + impl ::hash::Hash for pthread_mutex_t { + fn hash(&self, state: &mut H) { + self.size.hash(state); + } + } + + impl PartialEq for pthread_rwlock_t { + fn eq(&self, other: &pthread_rwlock_t) -> bool { + self.size.iter().zip(other.size.iter()).all(|(a,b)| a == b) + } + } + + impl Eq for pthread_rwlock_t {} + + impl ::fmt::Debug for pthread_rwlock_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("pthread_rwlock_t") + // FIXME: .field("size", &self.size) + .finish() + } + } + + impl ::hash::Hash for pthread_rwlock_t { + fn hash(&self, state: &mut H) { + self.size.hash(state); + } + } + + impl PartialEq for sockaddr_alg { + fn eq(&self, other: &sockaddr_alg) -> bool { + self.salg_family == other.salg_family + && self + .salg_type + .iter() + .zip(other.salg_type.iter()) + .all(|(a, b)| a == b) + && self.salg_feat == other.salg_feat + && self.salg_mask == other.salg_mask + && self + .salg_name + .iter() + .zip(other.salg_name.iter()) + .all(|(a, b)| a == b) + } + } + + impl Eq for sockaddr_alg {} + + impl ::fmt::Debug for sockaddr_alg { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sockaddr_alg") + .field("salg_family", &self.salg_family) + .field("salg_type", &self.salg_type) + .field("salg_feat", &self.salg_feat) + .field("salg_mask", &self.salg_mask) + .field("salg_name", &&self.salg_name[..]) + .finish() + } + } + + impl ::hash::Hash for sockaddr_alg { + fn hash(&self, state: &mut H) { + self.salg_family.hash(state); + self.salg_type.hash(state); + self.salg_feat.hash(state); + self.salg_mask.hash(state); + self.salg_name.hash(state); + } + } + + impl af_alg_iv { + fn as_slice(&self) -> &[u8] { + unsafe { + ::core::slice::from_raw_parts( + self.iv.as_ptr(), + self.ivlen as usize + ) + } + } + } + + impl PartialEq for af_alg_iv { + fn eq(&self, other: &af_alg_iv) -> bool { + *self.as_slice() == *other.as_slice() + } + } + + impl Eq for af_alg_iv {} + + impl ::fmt::Debug for af_alg_iv { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("af_alg_iv") + .field("iv", &self.as_slice()) + .finish() + } + } + + impl ::hash::Hash for af_alg_iv { + fn hash(&self, state: &mut H) { + self.as_slice().hash(state); + } + } + + impl PartialEq for mq_attr { + fn eq(&self, other: &mq_attr) -> bool { + self.mq_flags == other.mq_flags && + self.mq_maxmsg == other.mq_maxmsg && + self.mq_msgsize == other.mq_msgsize && + self.mq_curmsgs == other.mq_curmsgs + } + } + impl Eq for mq_attr {} + impl ::fmt::Debug for mq_attr { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("mq_attr") + .field("mq_flags", &self.mq_flags) + .field("mq_maxmsg", &self.mq_maxmsg) + .field("mq_msgsize", &self.mq_msgsize) + .field("mq_curmsgs", &self.mq_curmsgs) + .finish() + } + } + impl ::hash::Hash for mq_attr { + fn hash(&self, state: &mut H) { + self.mq_flags.hash(state); + self.mq_maxmsg.hash(state); + self.mq_msgsize.hash(state); + self.mq_curmsgs.hash(state); + } + } + } +} + +pub const ABDAY_1: ::nl_item = 0x20000; +pub const ABDAY_2: ::nl_item = 0x20001; +pub const ABDAY_3: ::nl_item = 0x20002; +pub const ABDAY_4: ::nl_item = 0x20003; +pub const ABDAY_5: ::nl_item = 0x20004; +pub const ABDAY_6: ::nl_item = 0x20005; +pub const ABDAY_7: ::nl_item = 0x20006; + +pub const DAY_1: ::nl_item = 0x20007; +pub const DAY_2: ::nl_item = 0x20008; +pub const DAY_3: ::nl_item = 0x20009; +pub const DAY_4: ::nl_item = 0x2000A; +pub const DAY_5: ::nl_item = 0x2000B; +pub const DAY_6: ::nl_item = 0x2000C; +pub const DAY_7: ::nl_item = 0x2000D; + +pub const ABMON_1: ::nl_item = 0x2000E; +pub const ABMON_2: ::nl_item = 0x2000F; +pub const ABMON_3: ::nl_item = 0x20010; +pub const ABMON_4: ::nl_item = 0x20011; +pub const ABMON_5: ::nl_item = 0x20012; +pub const ABMON_6: ::nl_item = 0x20013; +pub const ABMON_7: ::nl_item = 0x20014; +pub const ABMON_8: ::nl_item = 0x20015; +pub const ABMON_9: ::nl_item = 0x20016; +pub const ABMON_10: ::nl_item = 0x20017; +pub const ABMON_11: ::nl_item = 0x20018; +pub const ABMON_12: ::nl_item = 0x20019; + +pub const MON_1: ::nl_item = 0x2001A; +pub const MON_2: ::nl_item = 0x2001B; +pub const MON_3: ::nl_item = 0x2001C; +pub const MON_4: ::nl_item = 0x2001D; +pub const MON_5: ::nl_item = 0x2001E; +pub const MON_6: ::nl_item = 0x2001F; +pub const MON_7: ::nl_item = 0x20020; +pub const MON_8: ::nl_item = 0x20021; +pub const MON_9: ::nl_item = 0x20022; +pub const MON_10: ::nl_item = 0x20023; +pub const MON_11: ::nl_item = 0x20024; +pub const MON_12: ::nl_item = 0x20025; + +pub const AM_STR: ::nl_item = 0x20026; +pub const PM_STR: ::nl_item = 0x20027; + +pub const D_T_FMT: ::nl_item = 0x20028; +pub const D_FMT: ::nl_item = 0x20029; +pub const T_FMT: ::nl_item = 0x2002A; +pub const T_FMT_AMPM: ::nl_item = 0x2002B; + +pub const ERA: ::nl_item = 0x2002C; +pub const ERA_D_FMT: ::nl_item = 0x2002E; +pub const ALT_DIGITS: ::nl_item = 0x2002F; +pub const ERA_D_T_FMT: ::nl_item = 0x20030; +pub const ERA_T_FMT: ::nl_item = 0x20031; + +pub const CODESET: ::nl_item = 14; + +pub const CRNCYSTR: ::nl_item = 0x4000F; + +pub const RUSAGE_THREAD: ::c_int = 1; +pub const RUSAGE_CHILDREN: ::c_int = -1; + +pub const RADIXCHAR: ::nl_item = 0x10000; +pub const THOUSEP: ::nl_item = 0x10001; + +pub const YESEXPR: ::nl_item = 0x50000; +pub const NOEXPR: ::nl_item = 0x50001; +pub const YESSTR: ::nl_item = 0x50002; +pub const NOSTR: ::nl_item = 0x50003; + +pub const FILENAME_MAX: ::c_uint = 4096; +pub const L_tmpnam: ::c_uint = 20; +pub const _PC_LINK_MAX: ::c_int = 0; +pub const _PC_MAX_CANON: ::c_int = 1; +pub const _PC_MAX_INPUT: ::c_int = 2; +pub const _PC_NAME_MAX: ::c_int = 3; +pub const _PC_PATH_MAX: ::c_int = 4; +pub const _PC_PIPE_BUF: ::c_int = 5; +pub const _PC_CHOWN_RESTRICTED: ::c_int = 6; +pub const _PC_NO_TRUNC: ::c_int = 7; +pub const _PC_VDISABLE: ::c_int = 8; +pub const _PC_SYNC_IO: ::c_int = 9; +pub const _PC_ASYNC_IO: ::c_int = 10; +pub const _PC_PRIO_IO: ::c_int = 11; +pub const _PC_SOCK_MAXBUF: ::c_int = 12; +pub const _PC_FILESIZEBITS: ::c_int = 13; +pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14; +pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15; +pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16; +pub const _PC_REC_XFER_ALIGN: ::c_int = 17; +pub const _PC_ALLOC_SIZE_MIN: ::c_int = 18; +pub const _PC_SYMLINK_MAX: ::c_int = 19; +pub const _PC_2_SYMLINKS: ::c_int = 20; + +pub const MS_NOUSER: ::c_ulong = 0xffffffff80000000; + +pub const _SC_ARG_MAX: ::c_int = 0; +pub const _SC_CHILD_MAX: ::c_int = 1; +pub const _SC_CLK_TCK: ::c_int = 2; +pub const _SC_NGROUPS_MAX: ::c_int = 3; +pub const _SC_OPEN_MAX: ::c_int = 4; +pub const _SC_STREAM_MAX: ::c_int = 5; +pub const _SC_TZNAME_MAX: ::c_int = 6; +pub const _SC_JOB_CONTROL: ::c_int = 7; +pub const _SC_SAVED_IDS: ::c_int = 8; +pub const _SC_REALTIME_SIGNALS: ::c_int = 9; +pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10; +pub const _SC_TIMERS: ::c_int = 11; +pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12; +pub const _SC_PRIORITIZED_IO: ::c_int = 13; +pub const _SC_SYNCHRONIZED_IO: ::c_int = 14; +pub const _SC_FSYNC: ::c_int = 15; +pub const _SC_MAPPED_FILES: ::c_int = 16; +pub const _SC_MEMLOCK: ::c_int = 17; +pub const _SC_MEMLOCK_RANGE: ::c_int = 18; +pub const _SC_MEMORY_PROTECTION: ::c_int = 19; +pub const _SC_MESSAGE_PASSING: ::c_int = 20; +pub const _SC_SEMAPHORES: ::c_int = 21; +pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22; +pub const _SC_AIO_LISTIO_MAX: ::c_int = 23; +pub const _SC_AIO_MAX: ::c_int = 24; +pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25; +pub const _SC_DELAYTIMER_MAX: ::c_int = 26; +pub const _SC_MQ_OPEN_MAX: ::c_int = 27; +pub const _SC_MQ_PRIO_MAX: ::c_int = 28; +pub const _SC_VERSION: ::c_int = 29; +pub const _SC_PAGESIZE: ::c_int = 30; +pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE; +pub const _SC_RTSIG_MAX: ::c_int = 31; +pub const _SC_SEM_NSEMS_MAX: ::c_int = 32; +pub const _SC_SEM_VALUE_MAX: ::c_int = 33; +pub const _SC_SIGQUEUE_MAX: ::c_int = 34; +pub const _SC_TIMER_MAX: ::c_int = 35; +pub const _SC_BC_BASE_MAX: ::c_int = 36; +pub const _SC_BC_DIM_MAX: ::c_int = 37; +pub const _SC_BC_SCALE_MAX: ::c_int = 38; +pub const _SC_BC_STRING_MAX: ::c_int = 39; +pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40; +pub const _SC_EXPR_NEST_MAX: ::c_int = 42; +pub const _SC_LINE_MAX: ::c_int = 43; +pub const _SC_RE_DUP_MAX: ::c_int = 44; +pub const _SC_2_VERSION: ::c_int = 46; +pub const _SC_2_C_BIND: ::c_int = 47; +pub const _SC_2_C_DEV: ::c_int = 48; +pub const _SC_2_FORT_DEV: ::c_int = 49; +pub const _SC_2_FORT_RUN: ::c_int = 50; +pub const _SC_2_SW_DEV: ::c_int = 51; +pub const _SC_2_LOCALEDEF: ::c_int = 52; +pub const _SC_UIO_MAXIOV: ::c_int = 60; +pub const _SC_IOV_MAX: ::c_int = 60; +pub const _SC_THREADS: ::c_int = 67; +pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68; +pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69; +pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70; +pub const _SC_LOGIN_NAME_MAX: ::c_int = 71; +pub const _SC_TTY_NAME_MAX: ::c_int = 72; +pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73; +pub const _SC_THREAD_KEYS_MAX: ::c_int = 74; +pub const _SC_THREAD_STACK_MIN: ::c_int = 75; +pub const _SC_THREAD_THREADS_MAX: ::c_int = 76; +pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77; +pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78; +pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79; +pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80; +pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81; +pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 82; +pub const _SC_NPROCESSORS_CONF: ::c_int = 83; +pub const _SC_NPROCESSORS_ONLN: ::c_int = 84; +pub const _SC_PHYS_PAGES: ::c_int = 85; +pub const _SC_AVPHYS_PAGES: ::c_int = 86; +pub const _SC_ATEXIT_MAX: ::c_int = 87; +pub const _SC_PASS_MAX: ::c_int = 88; +pub const _SC_XOPEN_VERSION: ::c_int = 89; +pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90; +pub const _SC_XOPEN_UNIX: ::c_int = 91; +pub const _SC_XOPEN_CRYPT: ::c_int = 92; +pub const _SC_XOPEN_ENH_I18N: ::c_int = 93; +pub const _SC_XOPEN_SHM: ::c_int = 94; +pub const _SC_2_CHAR_TERM: ::c_int = 95; +pub const _SC_2_UPE: ::c_int = 97; +pub const _SC_XOPEN_XPG2: ::c_int = 98; +pub const _SC_XOPEN_XPG3: ::c_int = 99; +pub const _SC_XOPEN_XPG4: ::c_int = 100; +pub const _SC_NZERO: ::c_int = 109; +pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125; +pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126; +pub const _SC_XBS5_LP64_OFF64: ::c_int = 127; +pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128; +pub const _SC_XOPEN_LEGACY: ::c_int = 129; +pub const _SC_XOPEN_REALTIME: ::c_int = 130; +pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131; +pub const _SC_ADVISORY_INFO: ::c_int = 132; +pub const _SC_BARRIERS: ::c_int = 133; +pub const _SC_CLOCK_SELECTION: ::c_int = 137; +pub const _SC_CPUTIME: ::c_int = 138; +pub const _SC_THREAD_CPUTIME: ::c_int = 139; +pub const _SC_MONOTONIC_CLOCK: ::c_int = 149; +pub const _SC_READER_WRITER_LOCKS: ::c_int = 153; +pub const _SC_SPIN_LOCKS: ::c_int = 154; +pub const _SC_REGEXP: ::c_int = 155; +pub const _SC_SHELL: ::c_int = 157; +pub const _SC_SPAWN: ::c_int = 159; +pub const _SC_SPORADIC_SERVER: ::c_int = 160; +pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 161; +pub const _SC_TIMEOUTS: ::c_int = 164; +pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 165; +pub const _SC_2_PBS: ::c_int = 168; +pub const _SC_2_PBS_ACCOUNTING: ::c_int = 169; +pub const _SC_2_PBS_LOCATE: ::c_int = 170; +pub const _SC_2_PBS_MESSAGE: ::c_int = 171; +pub const _SC_2_PBS_TRACK: ::c_int = 172; +pub const _SC_SYMLOOP_MAX: ::c_int = 173; +pub const _SC_STREAMS: ::c_int = 174; +pub const _SC_2_PBS_CHECKPOINT: ::c_int = 175; +pub const _SC_V6_ILP32_OFF32: ::c_int = 176; +pub const _SC_V6_ILP32_OFFBIG: ::c_int = 177; +pub const _SC_V6_LP64_OFF64: ::c_int = 178; +pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 179; +pub const _SC_HOST_NAME_MAX: ::c_int = 180; +pub const _SC_TRACE: ::c_int = 181; +pub const _SC_TRACE_EVENT_FILTER: ::c_int = 182; +pub const _SC_TRACE_INHERIT: ::c_int = 183; +pub const _SC_TRACE_LOG: ::c_int = 184; +pub const _SC_IPV6: ::c_int = 235; +pub const _SC_RAW_SOCKETS: ::c_int = 236; +pub const _SC_V7_ILP32_OFF32: ::c_int = 237; +pub const _SC_V7_ILP32_OFFBIG: ::c_int = 238; +pub const _SC_V7_LP64_OFF64: ::c_int = 239; +pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 240; +pub const _SC_SS_REPL_MAX: ::c_int = 241; +pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 242; +pub const _SC_TRACE_NAME_MAX: ::c_int = 243; +pub const _SC_TRACE_SYS_MAX: ::c_int = 244; +pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 245; +pub const _SC_XOPEN_STREAMS: ::c_int = 246; +pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 247; +pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 248; + +pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY; +pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY; + +pub const GLOB_ERR: ::c_int = 1 << 0; +pub const GLOB_MARK: ::c_int = 1 << 1; +pub const GLOB_NOSORT: ::c_int = 1 << 2; +pub const GLOB_DOOFFS: ::c_int = 1 << 3; +pub const GLOB_NOCHECK: ::c_int = 1 << 4; +pub const GLOB_APPEND: ::c_int = 1 << 5; +pub const GLOB_NOESCAPE: ::c_int = 1 << 6; + +pub const GLOB_NOSPACE: ::c_int = 1; +pub const GLOB_ABORTED: ::c_int = 2; +pub const GLOB_NOMATCH: ::c_int = 3; + +pub const POSIX_MADV_NORMAL: ::c_int = 0; +pub const POSIX_MADV_RANDOM: ::c_int = 1; +pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2; +pub const POSIX_MADV_WILLNEED: ::c_int = 3; + +pub const S_IEXEC: mode_t = 64; +pub const S_IWRITE: mode_t = 128; +pub const S_IREAD: mode_t = 256; + +pub const F_LOCK: ::c_int = 1; +pub const F_TEST: ::c_int = 3; +pub const F_TLOCK: ::c_int = 2; +pub const F_ULOCK: ::c_int = 0; + +pub const F_SEAL_FUTURE_WRITE: ::c_int = 0x0010; + +pub const IFF_LOWER_UP: ::c_int = 0x10000; +pub const IFF_DORMANT: ::c_int = 0x20000; +pub const IFF_ECHO: ::c_int = 0x40000; + +// linux/if_addr.h +pub const IFA_UNSPEC: ::c_ushort = 0; +pub const IFA_ADDRESS: ::c_ushort = 1; +pub const IFA_LOCAL: ::c_ushort = 2; +pub const IFA_LABEL: ::c_ushort = 3; +pub const IFA_BROADCAST: ::c_ushort = 4; +pub const IFA_ANYCAST: ::c_ushort = 5; +pub const IFA_CACHEINFO: ::c_ushort = 6; +pub const IFA_MULTICAST: ::c_ushort = 7; + +pub const IFA_F_SECONDARY: u32 = 0x01; +pub const IFA_F_TEMPORARY: u32 = 0x01; +pub const IFA_F_NODAD: u32 = 0x02; +pub const IFA_F_OPTIMISTIC: u32 = 0x04; +pub const IFA_F_DADFAILED: u32 = 0x08; +pub const IFA_F_HOMEADDRESS: u32 = 0x10; +pub const IFA_F_DEPRECATED: u32 = 0x20; +pub const IFA_F_TENTATIVE: u32 = 0x40; +pub const IFA_F_PERMANENT: u32 = 0x80; + +// linux/if_link.h +pub const IFLA_UNSPEC: ::c_ushort = 0; +pub const IFLA_ADDRESS: ::c_ushort = 1; +pub const IFLA_BROADCAST: ::c_ushort = 2; +pub const IFLA_IFNAME: ::c_ushort = 3; +pub const IFLA_MTU: ::c_ushort = 4; +pub const IFLA_LINK: ::c_ushort = 5; +pub const IFLA_QDISC: ::c_ushort = 6; +pub const IFLA_STATS: ::c_ushort = 7; + +// linux/if_tun.h +pub const IFF_TUN: ::c_int = 0x0001; +pub const IFF_TAP: ::c_int = 0x0002; +pub const IFF_NO_PI: ::c_int = 0x1000; +// Read queue size +pub const TUN_READQ_SIZE: ::c_short = 500; +// TUN device type flags: deprecated. Use IFF_TUN/IFF_TAP instead. +pub const TUN_TUN_DEV: ::c_short = ::IFF_TUN as ::c_short; +pub const TUN_TAP_DEV: ::c_short = ::IFF_TAP as ::c_short; +pub const TUN_TYPE_MASK: ::c_short = 0x000f; +// This flag has no real effect +pub const IFF_ONE_QUEUE: ::c_int = 0x2000; +pub const IFF_VNET_HDR: ::c_int = 0x4000; +pub const IFF_TUN_EXCL: ::c_int = 0x8000; +pub const IFF_MULTI_QUEUE: ::c_int = 0x0100; +pub const IFF_ATTACH_QUEUE: ::c_int = 0x0200; +pub const IFF_DETACH_QUEUE: ::c_int = 0x0400; +// read-only flag +pub const IFF_PERSIST: ::c_int = 0x0800; +pub const IFF_NOFILTER: ::c_int = 0x1000; + +pub const ST_RDONLY: ::c_ulong = 1; +pub const ST_NOSUID: ::c_ulong = 2; +pub const ST_NODEV: ::c_ulong = 4; +pub const ST_NOEXEC: ::c_ulong = 8; +pub const ST_SYNCHRONOUS: ::c_ulong = 16; +pub const ST_MANDLOCK: ::c_ulong = 64; +pub const ST_WRITE: ::c_ulong = 128; +pub const ST_APPEND: ::c_ulong = 256; +pub const ST_IMMUTABLE: ::c_ulong = 512; +pub const ST_NOATIME: ::c_ulong = 1024; +pub const ST_NODIRATIME: ::c_ulong = 2048; + +pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void; +pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; +pub const RTLD_NODELETE: ::c_int = 0x1000; +pub const RTLD_NOW: ::c_int = 0x2; + +pub const TCP_MD5SIG: ::c_int = 14; + +align_const! { + pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { + size: [0; __SIZEOF_PTHREAD_MUTEX_T], + }; + pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { + size: [0; __SIZEOF_PTHREAD_COND_T], + }; + pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { + size: [0; __SIZEOF_PTHREAD_RWLOCK_T], + }; +} +pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; +pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; +pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; +pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; +pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0; +pub const PTHREAD_PROCESS_SHARED: ::c_int = 1; +pub const __SIZEOF_PTHREAD_COND_T: usize = 48; + +pub const RENAME_NOREPLACE: ::c_int = 1; +pub const RENAME_EXCHANGE: ::c_int = 2; +pub const RENAME_WHITEOUT: ::c_int = 4; + +pub const SCHED_OTHER: ::c_int = 0; +pub const SCHED_FIFO: ::c_int = 1; +pub const SCHED_RR: ::c_int = 2; +pub const SCHED_BATCH: ::c_int = 3; +pub const SCHED_IDLE: ::c_int = 5; + +// netinet/in.h +// NOTE: These are in addition to the constants defined in src/unix/mod.rs + +// IPPROTO_IP defined in src/unix/mod.rs +/// Hop-by-hop option header +pub const IPPROTO_HOPOPTS: ::c_int = 0; +// IPPROTO_ICMP defined in src/unix/mod.rs +/// group mgmt protocol +pub const IPPROTO_IGMP: ::c_int = 2; +/// for compatibility +pub const IPPROTO_IPIP: ::c_int = 4; +// IPPROTO_TCP defined in src/unix/mod.rs +/// exterior gateway protocol +pub const IPPROTO_EGP: ::c_int = 8; +/// pup +pub const IPPROTO_PUP: ::c_int = 12; +// IPPROTO_UDP defined in src/unix/mod.rs +/// xns idp +pub const IPPROTO_IDP: ::c_int = 22; +/// tp-4 w/ class negotiation +pub const IPPROTO_TP: ::c_int = 29; +/// DCCP +pub const IPPROTO_DCCP: ::c_int = 33; +// IPPROTO_IPV6 defined in src/unix/mod.rs +/// IP6 routing header +pub const IPPROTO_ROUTING: ::c_int = 43; +/// IP6 fragmentation header +pub const IPPROTO_FRAGMENT: ::c_int = 44; +/// resource reservation +pub const IPPROTO_RSVP: ::c_int = 46; +/// General Routing Encap. +pub const IPPROTO_GRE: ::c_int = 47; +/// IP6 Encap Sec. Payload +pub const IPPROTO_ESP: ::c_int = 50; +/// IP6 Auth Header +pub const IPPROTO_AH: ::c_int = 51; +// IPPROTO_ICMPV6 defined in src/unix/mod.rs +/// IP6 no next header +pub const IPPROTO_NONE: ::c_int = 59; +/// IP6 destination option +pub const IPPROTO_DSTOPTS: ::c_int = 60; +pub const IPPROTO_MTP: ::c_int = 92; +pub const IPPROTO_BEETPH: ::c_int = 94; +/// encapsulation header +pub const IPPROTO_ENCAP: ::c_int = 98; +/// Protocol indep. multicast +pub const IPPROTO_PIM: ::c_int = 103; +/// IP Payload Comp. Protocol +pub const IPPROTO_COMP: ::c_int = 108; +/// SCTP +pub const IPPROTO_SCTP: ::c_int = 132; +pub const IPPROTO_MH: ::c_int = 135; +pub const IPPROTO_UDPLITE: ::c_int = 136; +pub const IPPROTO_MPLS: ::c_int = 137; +/// raw IP packet +pub const IPPROTO_RAW: ::c_int = 255; +pub const IPPROTO_MAX: ::c_int = 256; + +pub const AF_IB: ::c_int = 27; +pub const AF_MPLS: ::c_int = 28; +pub const AF_NFC: ::c_int = 39; +pub const AF_VSOCK: ::c_int = 40; +pub const AF_XDP: ::c_int = 44; +pub const PF_IB: ::c_int = AF_IB; +pub const PF_MPLS: ::c_int = AF_MPLS; +pub const PF_NFC: ::c_int = AF_NFC; +pub const PF_VSOCK: ::c_int = AF_VSOCK; +pub const PF_XDP: ::c_int = AF_XDP; + +// System V IPC +pub const IPC_PRIVATE: ::key_t = 0; + +pub const IPC_CREAT: ::c_int = 0o1000; +pub const IPC_EXCL: ::c_int = 0o2000; +pub const IPC_NOWAIT: ::c_int = 0o4000; + +pub const IPC_RMID: ::c_int = 0; +pub const IPC_SET: ::c_int = 1; +pub const IPC_STAT: ::c_int = 2; +pub const IPC_INFO: ::c_int = 3; +pub const MSG_STAT: ::c_int = 11; +pub const MSG_INFO: ::c_int = 12; + +pub const MSG_NOERROR: ::c_int = 0o10000; +pub const MSG_EXCEPT: ::c_int = 0o20000; +pub const MSG_COPY: ::c_int = 0o40000; + +pub const SHM_R: ::c_int = 0o400; +pub const SHM_W: ::c_int = 0o200; + +pub const SHM_RDONLY: ::c_int = 0o10000; +pub const SHM_RND: ::c_int = 0o20000; +pub const SHM_REMAP: ::c_int = 0o40000; +pub const SHM_EXEC: ::c_int = 0o100000; + +pub const SHM_LOCK: ::c_int = 11; +pub const SHM_UNLOCK: ::c_int = 12; + +pub const SHM_HUGETLB: ::c_int = 0o4000; +pub const SHM_NORESERVE: ::c_int = 0o10000; + +pub const EPOLLRDHUP: ::c_int = 0x2000; +pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000; +pub const EPOLLONESHOT: ::c_int = 0x40000000; + +pub const QFMT_VFS_OLD: ::c_int = 1; +pub const QFMT_VFS_V0: ::c_int = 2; +pub const QFMT_VFS_V1: ::c_int = 4; + +pub const EFD_SEMAPHORE: ::c_int = 0x1; + +pub const LOG_NFACILITIES: ::c_int = 24; + +pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t; + +pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32; +pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32; +pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32; +pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32; +pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32; +pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32; +pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32; + +pub const AI_PASSIVE: ::c_int = 0x0001; +pub const AI_CANONNAME: ::c_int = 0x0002; +pub const AI_NUMERICHOST: ::c_int = 0x0004; +pub const AI_V4MAPPED: ::c_int = 0x0008; +pub const AI_ALL: ::c_int = 0x0010; +pub const AI_ADDRCONFIG: ::c_int = 0x0020; + +pub const AI_NUMERICSERV: ::c_int = 0x0400; + +pub const EAI_BADFLAGS: ::c_int = -1; +pub const EAI_NONAME: ::c_int = -2; +pub const EAI_AGAIN: ::c_int = -3; +pub const EAI_FAIL: ::c_int = -4; +pub const EAI_NODATA: ::c_int = -5; +pub const EAI_FAMILY: ::c_int = -6; +pub const EAI_SOCKTYPE: ::c_int = -7; +pub const EAI_SERVICE: ::c_int = -8; +pub const EAI_MEMORY: ::c_int = -10; +pub const EAI_SYSTEM: ::c_int = -11; +pub const EAI_OVERFLOW: ::c_int = -12; + +pub const NI_NUMERICHOST: ::c_int = 1; +pub const NI_NUMERICSERV: ::c_int = 2; +pub const NI_NOFQDN: ::c_int = 4; +pub const NI_NAMEREQD: ::c_int = 8; +pub const NI_DGRAM: ::c_int = 16; + +pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1; +pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2; +pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4; + +pub const AIO_CANCELED: ::c_int = 0; +pub const AIO_NOTCANCELED: ::c_int = 1; +pub const AIO_ALLDONE: ::c_int = 2; +pub const LIO_READ: ::c_int = 0; +pub const LIO_WRITE: ::c_int = 1; +pub const LIO_NOP: ::c_int = 2; +pub const LIO_WAIT: ::c_int = 0; +pub const LIO_NOWAIT: ::c_int = 1; + +pub const MREMAP_MAYMOVE: ::c_int = 1; +pub const MREMAP_FIXED: ::c_int = 2; + +pub const PR_SET_PDEATHSIG: ::c_int = 1; +pub const PR_GET_PDEATHSIG: ::c_int = 2; + +pub const PR_GET_DUMPABLE: ::c_int = 3; +pub const PR_SET_DUMPABLE: ::c_int = 4; + +pub const PR_GET_UNALIGN: ::c_int = 5; +pub const PR_SET_UNALIGN: ::c_int = 6; +pub const PR_UNALIGN_NOPRINT: ::c_int = 1; +pub const PR_UNALIGN_SIGBUS: ::c_int = 2; + +pub const PR_GET_KEEPCAPS: ::c_int = 7; +pub const PR_SET_KEEPCAPS: ::c_int = 8; + +pub const PR_GET_FPEMU: ::c_int = 9; +pub const PR_SET_FPEMU: ::c_int = 10; +pub const PR_FPEMU_NOPRINT: ::c_int = 1; +pub const PR_FPEMU_SIGFPE: ::c_int = 2; + +pub const PR_GET_FPEXC: ::c_int = 11; +pub const PR_SET_FPEXC: ::c_int = 12; +pub const PR_FP_EXC_SW_ENABLE: ::c_int = 0x80; +pub const PR_FP_EXC_DIV: ::c_int = 0x010000; +pub const PR_FP_EXC_OVF: ::c_int = 0x020000; +pub const PR_FP_EXC_UND: ::c_int = 0x040000; +pub const PR_FP_EXC_RES: ::c_int = 0x080000; +pub const PR_FP_EXC_INV: ::c_int = 0x100000; +pub const PR_FP_EXC_DISABLED: ::c_int = 0; +pub const PR_FP_EXC_NONRECOV: ::c_int = 1; +pub const PR_FP_EXC_ASYNC: ::c_int = 2; +pub const PR_FP_EXC_PRECISE: ::c_int = 3; + +pub const PR_GET_TIMING: ::c_int = 13; +pub const PR_SET_TIMING: ::c_int = 14; +pub const PR_TIMING_STATISTICAL: ::c_int = 0; +pub const PR_TIMING_TIMESTAMP: ::c_int = 1; + +pub const PR_SET_NAME: ::c_int = 15; +pub const PR_GET_NAME: ::c_int = 16; + +pub const PR_GET_ENDIAN: ::c_int = 19; +pub const PR_SET_ENDIAN: ::c_int = 20; +pub const PR_ENDIAN_BIG: ::c_int = 0; +pub const PR_ENDIAN_LITTLE: ::c_int = 1; +pub const PR_ENDIAN_PPC_LITTLE: ::c_int = 2; + +pub const PR_GET_SECCOMP: ::c_int = 21; +pub const PR_SET_SECCOMP: ::c_int = 22; + +pub const PR_CAPBSET_READ: ::c_int = 23; +pub const PR_CAPBSET_DROP: ::c_int = 24; + +pub const PR_GET_TSC: ::c_int = 25; +pub const PR_SET_TSC: ::c_int = 26; +pub const PR_TSC_ENABLE: ::c_int = 1; +pub const PR_TSC_SIGSEGV: ::c_int = 2; + +pub const PR_GET_SECUREBITS: ::c_int = 27; +pub const PR_SET_SECUREBITS: ::c_int = 28; + +pub const PR_SET_TIMERSLACK: ::c_int = 29; +pub const PR_GET_TIMERSLACK: ::c_int = 30; + +pub const PR_TASK_PERF_EVENTS_DISABLE: ::c_int = 31; +pub const PR_TASK_PERF_EVENTS_ENABLE: ::c_int = 32; + +pub const PR_MCE_KILL: ::c_int = 33; +pub const PR_MCE_KILL_CLEAR: ::c_int = 0; +pub const PR_MCE_KILL_SET: ::c_int = 1; + +pub const PR_MCE_KILL_LATE: ::c_int = 0; +pub const PR_MCE_KILL_EARLY: ::c_int = 1; +pub const PR_MCE_KILL_DEFAULT: ::c_int = 2; + +pub const PR_MCE_KILL_GET: ::c_int = 34; + +pub const PR_SET_MM: ::c_int = 35; +pub const PR_SET_MM_START_CODE: ::c_int = 1; +pub const PR_SET_MM_END_CODE: ::c_int = 2; +pub const PR_SET_MM_START_DATA: ::c_int = 3; +pub const PR_SET_MM_END_DATA: ::c_int = 4; +pub const PR_SET_MM_START_STACK: ::c_int = 5; +pub const PR_SET_MM_START_BRK: ::c_int = 6; +pub const PR_SET_MM_BRK: ::c_int = 7; +pub const PR_SET_MM_ARG_START: ::c_int = 8; +pub const PR_SET_MM_ARG_END: ::c_int = 9; +pub const PR_SET_MM_ENV_START: ::c_int = 10; +pub const PR_SET_MM_ENV_END: ::c_int = 11; +pub const PR_SET_MM_AUXV: ::c_int = 12; +pub const PR_SET_MM_EXE_FILE: ::c_int = 13; +pub const PR_SET_MM_MAP: ::c_int = 14; +pub const PR_SET_MM_MAP_SIZE: ::c_int = 15; + +pub const PR_SET_PTRACER: ::c_int = 0x59616d61; + +pub const PR_SET_CHILD_SUBREAPER: ::c_int = 36; +pub const PR_GET_CHILD_SUBREAPER: ::c_int = 37; + +pub const PR_SET_NO_NEW_PRIVS: ::c_int = 38; +pub const PR_GET_NO_NEW_PRIVS: ::c_int = 39; + +pub const PR_GET_TID_ADDRESS: ::c_int = 40; + +pub const PR_SET_THP_DISABLE: ::c_int = 41; +pub const PR_GET_THP_DISABLE: ::c_int = 42; + +pub const PR_MPX_ENABLE_MANAGEMENT: ::c_int = 43; +pub const PR_MPX_DISABLE_MANAGEMENT: ::c_int = 44; + +pub const PR_SET_FP_MODE: ::c_int = 45; +pub const PR_GET_FP_MODE: ::c_int = 46; +pub const PR_FP_MODE_FR: ::c_int = 1 << 0; +pub const PR_FP_MODE_FRE: ::c_int = 1 << 1; + +pub const PR_CAP_AMBIENT: ::c_int = 47; +pub const PR_CAP_AMBIENT_IS_SET: ::c_int = 1; +pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2; +pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3; +pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4; + +pub const GRND_NONBLOCK: ::c_uint = 0x0001; +pub const GRND_RANDOM: ::c_uint = 0x0002; + +pub const SECCOMP_MODE_DISABLED: ::c_uint = 0; +pub const SECCOMP_MODE_STRICT: ::c_uint = 1; +pub const SECCOMP_MODE_FILTER: ::c_uint = 2; + +pub const ITIMER_REAL: ::c_int = 0; +pub const ITIMER_VIRTUAL: ::c_int = 1; +pub const ITIMER_PROF: ::c_int = 2; + +pub const TFD_CLOEXEC: ::c_int = O_CLOEXEC; +pub const TFD_NONBLOCK: ::c_int = O_NONBLOCK; +pub const TFD_TIMER_ABSTIME: ::c_int = 1; + +pub const XATTR_CREATE: ::c_int = 0x1; +pub const XATTR_REPLACE: ::c_int = 0x2; + +pub const _POSIX_VDISABLE: ::cc_t = 0; + +pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01; +pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02; +pub const FALLOC_FL_COLLAPSE_RANGE: ::c_int = 0x08; +pub const FALLOC_FL_ZERO_RANGE: ::c_int = 0x10; +pub const FALLOC_FL_INSERT_RANGE: ::c_int = 0x20; +pub const FALLOC_FL_UNSHARE_RANGE: ::c_int = 0x40; + +#[deprecated( + since = "0.2.55", + note = "ENOATTR is not available on Linux; use ENODATA instead" +)] +pub const ENOATTR: ::c_int = ::ENODATA; + +pub const SO_ORIGINAL_DST: ::c_int = 80; +pub const IP_ORIGDSTADDR : ::c_int = 20; +pub const IP_RECVORIGDSTADDR : ::c_int = IP_ORIGDSTADDR; +pub const IPV6_ORIGDSTADDR : ::c_int = 74; +pub const IPV6_RECVORIGDSTADDR : ::c_int = IPV6_ORIGDSTADDR; +pub const IPV6_FLOWINFO: ::c_int = 11; +pub const IPV6_FLOWLABEL_MGR: ::c_int = 32; +pub const IPV6_FLOWINFO_SEND: ::c_int = 33; +pub const IPV6_FLOWINFO_FLOWLABEL: ::c_int = 0x000fffff; +pub const IPV6_FLOWINFO_PRIORITY: ::c_int = 0x0ff00000; +pub const IUTF8: ::tcflag_t = 0x00004000; +pub const CMSPAR: ::tcflag_t = 0o10000000000; + +pub const MFD_CLOEXEC: ::c_uint = 0x0001; +pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002; +pub const MFD_HUGETLB: ::c_uint = 0x0004; + +// these are used in the p_type field of Elf32_Phdr and Elf64_Phdr, which has +// the type Elf32Word and Elf64Word respectively. Luckily, both of those are u32 +// so we can use that type here to avoid having to cast. +pub const PT_NULL: u32 = 0; +pub const PT_LOAD: u32 = 1; +pub const PT_DYNAMIC: u32 = 2; +pub const PT_INTERP: u32 = 3; +pub const PT_NOTE: u32 = 4; +pub const PT_SHLIB: u32 = 5; +pub const PT_PHDR: u32 = 6; +pub const PT_TLS: u32 = 7; +pub const PT_NUM: u32 = 8; +pub const PT_LOOS: u32 = 0x60000000; +pub const PT_GNU_EH_FRAME: u32 = 0x6474e550; +pub const PT_GNU_STACK: u32 = 0x6474e551; +pub const PT_GNU_RELRO: u32 = 0x6474e552; + +// linux/if_ether.h +pub const ETH_ALEN: ::c_int = 6; +pub const ETH_HLEN: ::c_int = 14; +pub const ETH_ZLEN: ::c_int = 60; +pub const ETH_DATA_LEN: ::c_int = 1500; +pub const ETH_FRAME_LEN: ::c_int = 1514; +pub const ETH_FCS_LEN: ::c_int = 4; + +// These are the defined Ethernet Protocol ID's. +pub const ETH_P_LOOP: ::c_int = 0x0060; +pub const ETH_P_PUP: ::c_int = 0x0200; +pub const ETH_P_PUPAT: ::c_int = 0x0201; +pub const ETH_P_IP: ::c_int = 0x0800; +pub const ETH_P_X25: ::c_int = 0x0805; +pub const ETH_P_ARP: ::c_int = 0x0806; +pub const ETH_P_BPQ: ::c_int = 0x08FF; +pub const ETH_P_IEEEPUP: ::c_int = 0x0a00; +pub const ETH_P_IEEEPUPAT: ::c_int = 0x0a01; +pub const ETH_P_BATMAN: ::c_int = 0x4305; +pub const ETH_P_DEC: ::c_int = 0x6000; +pub const ETH_P_DNA_DL: ::c_int = 0x6001; +pub const ETH_P_DNA_RC: ::c_int = 0x6002; +pub const ETH_P_DNA_RT: ::c_int = 0x6003; +pub const ETH_P_LAT: ::c_int = 0x6004; +pub const ETH_P_DIAG: ::c_int = 0x6005; +pub const ETH_P_CUST: ::c_int = 0x6006; +pub const ETH_P_SCA: ::c_int = 0x6007; +pub const ETH_P_TEB: ::c_int = 0x6558; +pub const ETH_P_RARP: ::c_int = 0x8035; +pub const ETH_P_ATALK: ::c_int = 0x809B; +pub const ETH_P_AARP: ::c_int = 0x80F3; +pub const ETH_P_8021Q: ::c_int = 0x8100; +pub const ETH_P_IPX: ::c_int = 0x8137; +pub const ETH_P_IPV6: ::c_int = 0x86DD; +pub const ETH_P_PAUSE: ::c_int = 0x8808; +pub const ETH_P_SLOW: ::c_int = 0x8809; +pub const ETH_P_WCCP: ::c_int = 0x883E; +pub const ETH_P_MPLS_UC: ::c_int = 0x8847; +pub const ETH_P_MPLS_MC: ::c_int = 0x8848; +pub const ETH_P_ATMMPOA: ::c_int = 0x884c; +pub const ETH_P_PPP_DISC: ::c_int = 0x8863; +pub const ETH_P_PPP_SES: ::c_int = 0x8864; +pub const ETH_P_LINK_CTL: ::c_int = 0x886c; +pub const ETH_P_ATMFATE: ::c_int = 0x8884; +pub const ETH_P_PAE: ::c_int = 0x888E; +pub const ETH_P_AOE: ::c_int = 0x88A2; +pub const ETH_P_8021AD: ::c_int = 0x88A8; +pub const ETH_P_802_EX1: ::c_int = 0x88B5; +pub const ETH_P_TIPC: ::c_int = 0x88CA; +pub const ETH_P_MACSEC: ::c_int = 0x88E5; +pub const ETH_P_8021AH: ::c_int = 0x88E7; +pub const ETH_P_MVRP: ::c_int = 0x88F5; +pub const ETH_P_1588: ::c_int = 0x88F7; +pub const ETH_P_PRP: ::c_int = 0x88FB; +pub const ETH_P_FCOE: ::c_int = 0x8906; +pub const ETH_P_TDLS: ::c_int = 0x890D; +pub const ETH_P_FIP: ::c_int = 0x8914; +pub const ETH_P_80221: ::c_int = 0x8917; +pub const ETH_P_LOOPBACK: ::c_int = 0x9000; +pub const ETH_P_QINQ1: ::c_int = 0x9100; +pub const ETH_P_QINQ2: ::c_int = 0x9200; +pub const ETH_P_QINQ3: ::c_int = 0x9300; +pub const ETH_P_EDSA: ::c_int = 0xDADA; +pub const ETH_P_AF_IUCV: ::c_int = 0xFBFB; + +pub const ETH_P_802_3_MIN: ::c_int = 0x0600; + +// Non DIX types. Won't clash for 1500 types. +pub const ETH_P_802_3: ::c_int = 0x0001; +pub const ETH_P_AX25: ::c_int = 0x0002; +pub const ETH_P_ALL: ::c_int = 0x0003; +pub const ETH_P_802_2: ::c_int = 0x0004; +pub const ETH_P_SNAP: ::c_int = 0x0005; +pub const ETH_P_DDCMP: ::c_int = 0x0006; +pub const ETH_P_WAN_PPP: ::c_int = 0x0007; +pub const ETH_P_PPP_MP: ::c_int = 0x0008; +pub const ETH_P_LOCALTALK: ::c_int = 0x0009; +pub const ETH_P_CANFD: ::c_int = 0x000D; +pub const ETH_P_PPPTALK: ::c_int = 0x0010; +pub const ETH_P_TR_802_2: ::c_int = 0x0011; +pub const ETH_P_MOBITEX: ::c_int = 0x0015; +pub const ETH_P_CONTROL: ::c_int = 0x0016; +pub const ETH_P_IRDA: ::c_int = 0x0017; +pub const ETH_P_ECONET: ::c_int = 0x0018; +pub const ETH_P_HDLC: ::c_int = 0x0019; +pub const ETH_P_ARCNET: ::c_int = 0x001A; +pub const ETH_P_DSA: ::c_int = 0x001B; +pub const ETH_P_TRAILER: ::c_int = 0x001C; +pub const ETH_P_PHONET: ::c_int = 0x00F5; +pub const ETH_P_IEEE802154: ::c_int = 0x00F6; +pub const ETH_P_CAIF: ::c_int = 0x00F7; + +pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01; +pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02; +pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x04; +pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x08; +pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_int = 0x10; +pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x20; + +pub const NLMSG_NOOP: ::c_int = 0x1; +pub const NLMSG_ERROR: ::c_int = 0x2; +pub const NLMSG_DONE: ::c_int = 0x3; +pub const NLMSG_OVERRUN: ::c_int = 0x4; +pub const NLMSG_MIN_TYPE: ::c_int = 0x10; + +pub const GENL_NAMSIZ: ::c_int = 16; + +pub const GENL_MIN_ID: ::c_int = NLMSG_MIN_TYPE; +pub const GENL_MAX_ID: ::c_int = 1023; + +pub const GENL_ADMIN_PERM: ::c_int = 0x01; +pub const GENL_CMD_CAP_DO: ::c_int = 0x02; +pub const GENL_CMD_CAP_DUMP: ::c_int = 0x04; +pub const GENL_CMD_CAP_HASPOL: ::c_int = 0x08; + +pub const GENL_ID_CTRL: ::c_int = NLMSG_MIN_TYPE; + +pub const CTRL_CMD_UNSPEC: ::c_int = 0; +pub const CTRL_CMD_NEWFAMILY: ::c_int = 1; +pub const CTRL_CMD_DELFAMILY: ::c_int = 2; +pub const CTRL_CMD_GETFAMILY: ::c_int = 3; +pub const CTRL_CMD_NEWOPS: ::c_int = 4; +pub const CTRL_CMD_DELOPS: ::c_int = 5; +pub const CTRL_CMD_GETOPS: ::c_int = 6; +pub const CTRL_CMD_NEWMCAST_GRP: ::c_int = 7; +pub const CTRL_CMD_DELMCAST_GRP: ::c_int = 8; +pub const CTRL_CMD_GETMCAST_GRP: ::c_int = 9; + +pub const CTRL_ATTR_UNSPEC: ::c_int = 0; +pub const CTRL_ATTR_FAMILY_ID: ::c_int = 1; +pub const CTRL_ATTR_FAMILY_NAME: ::c_int = 2; +pub const CTRL_ATTR_VERSION: ::c_int = 3; +pub const CTRL_ATTR_HDRSIZE: ::c_int = 4; +pub const CTRL_ATTR_MAXATTR: ::c_int = 5; +pub const CTRL_ATTR_OPS: ::c_int = 6; +pub const CTRL_ATTR_MCAST_GROUPS: ::c_int = 7; + +pub const CTRL_ATTR_OP_UNSPEC: ::c_int = 0; +pub const CTRL_ATTR_OP_ID: ::c_int = 1; +pub const CTRL_ATTR_OP_FLAGS: ::c_int = 2; + +pub const CTRL_ATTR_MCAST_GRP_UNSPEC: ::c_int = 0; +pub const CTRL_ATTR_MCAST_GRP_NAME: ::c_int = 1; +pub const CTRL_ATTR_MCAST_GRP_ID: ::c_int = 2; + +// linux/if_packet.h +pub const PACKET_ADD_MEMBERSHIP: ::c_int = 1; +pub const PACKET_DROP_MEMBERSHIP: ::c_int = 2; + +pub const PACKET_MR_MULTICAST: ::c_int = 0; +pub const PACKET_MR_PROMISC: ::c_int = 1; +pub const PACKET_MR_ALLMULTI: ::c_int = 2; +pub const PACKET_MR_UNICAST: ::c_int = 3; + +// linux/netfilter.h +pub const NF_DROP: ::c_int = 0; +pub const NF_ACCEPT: ::c_int = 1; +pub const NF_STOLEN: ::c_int = 2; +pub const NF_QUEUE: ::c_int = 3; +pub const NF_REPEAT: ::c_int = 4; +pub const NF_STOP: ::c_int = 5; +pub const NF_MAX_VERDICT: ::c_int = NF_STOP; + +pub const NF_VERDICT_MASK: ::c_int = 0x000000ff; +pub const NF_VERDICT_FLAG_QUEUE_BYPASS: ::c_int = 0x00008000; + +pub const NF_VERDICT_QMASK: ::c_int = 0xffff0000; +pub const NF_VERDICT_QBITS: ::c_int = 16; + +pub const NF_VERDICT_BITS: ::c_int = 16; + +pub const NF_INET_PRE_ROUTING: ::c_int = 0; +pub const NF_INET_LOCAL_IN: ::c_int = 1; +pub const NF_INET_FORWARD: ::c_int = 2; +pub const NF_INET_LOCAL_OUT: ::c_int = 3; +pub const NF_INET_POST_ROUTING: ::c_int = 4; +pub const NF_INET_NUMHOOKS: ::c_int = 5; + +// Some NFPROTO are not compatible with musl and are defined in submodules. +pub const NFPROTO_UNSPEC: ::c_int = 0; +pub const NFPROTO_IPV4: ::c_int = 2; +pub const NFPROTO_ARP: ::c_int = 3; +pub const NFPROTO_BRIDGE: ::c_int = 7; +pub const NFPROTO_IPV6: ::c_int = 10; +pub const NFPROTO_DECNET: ::c_int = 12; +pub const NFPROTO_NUMPROTO: ::c_int = 13; + +// linux/netfilter_ipv4.h +pub const NF_IP_PRE_ROUTING: ::c_int = 0; +pub const NF_IP_LOCAL_IN: ::c_int = 1; +pub const NF_IP_FORWARD: ::c_int = 2; +pub const NF_IP_LOCAL_OUT: ::c_int = 3; +pub const NF_IP_POST_ROUTING: ::c_int = 4; +pub const NF_IP_NUMHOOKS: ::c_int = 5; + +pub const NF_IP_PRI_FIRST: ::c_int = ::INT_MIN; +pub const NF_IP_PRI_CONNTRACK_DEFRAG: ::c_int = -400; +pub const NF_IP_PRI_RAW: ::c_int = -300; +pub const NF_IP_PRI_SELINUX_FIRST: ::c_int = -225; +pub const NF_IP_PRI_CONNTRACK: ::c_int = -200; +pub const NF_IP_PRI_MANGLE: ::c_int = -150; +pub const NF_IP_PRI_NAT_DST: ::c_int = -100; +pub const NF_IP_PRI_FILTER: ::c_int = 0; +pub const NF_IP_PRI_SECURITY: ::c_int = 50; +pub const NF_IP_PRI_NAT_SRC: ::c_int = 100; +pub const NF_IP_PRI_SELINUX_LAST: ::c_int = 225; +pub const NF_IP_PRI_CONNTRACK_HELPER: ::c_int = 300; +pub const NF_IP_PRI_CONNTRACK_CONFIRM: ::c_int = ::INT_MAX; +pub const NF_IP_PRI_LAST: ::c_int = ::INT_MAX; + +// linux/netfilter_ipv6.h +pub const NF_IP6_PRE_ROUTING: ::c_int = 0; +pub const NF_IP6_LOCAL_IN: ::c_int = 1; +pub const NF_IP6_FORWARD: ::c_int = 2; +pub const NF_IP6_LOCAL_OUT: ::c_int = 3; +pub const NF_IP6_POST_ROUTING: ::c_int = 4; +pub const NF_IP6_NUMHOOKS: ::c_int = 5; + +pub const NF_IP6_PRI_FIRST: ::c_int = ::INT_MIN; +pub const NF_IP6_PRI_CONNTRACK_DEFRAG: ::c_int = -400; +pub const NF_IP6_PRI_RAW: ::c_int = -300; +pub const NF_IP6_PRI_SELINUX_FIRST: ::c_int = -225; +pub const NF_IP6_PRI_CONNTRACK: ::c_int = -200; +pub const NF_IP6_PRI_MANGLE: ::c_int = -150; +pub const NF_IP6_PRI_NAT_DST: ::c_int = -100; +pub const NF_IP6_PRI_FILTER: ::c_int = 0; +pub const NF_IP6_PRI_SECURITY: ::c_int = 50; +pub const NF_IP6_PRI_NAT_SRC: ::c_int = 100; +pub const NF_IP6_PRI_SELINUX_LAST: ::c_int = 225; +pub const NF_IP6_PRI_CONNTRACK_HELPER: ::c_int = 300; +pub const NF_IP6_PRI_LAST: ::c_int = ::INT_MAX; + +pub const SIOCADDRT: ::c_ulong = 0x0000890B; +pub const SIOCDELRT: ::c_ulong = 0x0000890C; +pub const SIOCGIFNAME: ::c_ulong = 0x00008910; +pub const SIOCSIFLINK: ::c_ulong = 0x00008911; +pub const SIOCGIFCONF: ::c_ulong = 0x00008912; +pub const SIOCGIFFLAGS: ::c_ulong = 0x00008913; +pub const SIOCSIFFLAGS: ::c_ulong = 0x00008914; +pub const SIOCGIFADDR: ::c_ulong = 0x00008915; +pub const SIOCSIFADDR: ::c_ulong = 0x00008916; +pub const SIOCGIFDSTADDR: ::c_ulong = 0x00008917; +pub const SIOCSIFDSTADDR: ::c_ulong = 0x00008918; +pub const SIOCGIFBRDADDR: ::c_ulong = 0x00008919; +pub const SIOCSIFBRDADDR: ::c_ulong = 0x0000891A; +pub const SIOCGIFNETMASK: ::c_ulong = 0x0000891B; +pub const SIOCSIFNETMASK: ::c_ulong = 0x0000891C; +pub const SIOCGIFMETRIC: ::c_ulong = 0x0000891D; +pub const SIOCSIFMETRIC: ::c_ulong = 0x0000891E; +pub const SIOCGIFMEM: ::c_ulong = 0x0000891F; +pub const SIOCSIFMEM: ::c_ulong = 0x00008920; +pub const SIOCGIFMTU: ::c_ulong = 0x00008921; +pub const SIOCSIFMTU: ::c_ulong = 0x00008922; +pub const SIOCSIFHWADDR: ::c_ulong = 0x00008924; +pub const SIOCGIFENCAP: ::c_ulong = 0x00008925; +pub const SIOCSIFENCAP: ::c_ulong = 0x00008926; +pub const SIOCGIFHWADDR: ::c_ulong = 0x00008927; +pub const SIOCGIFSLAVE: ::c_ulong = 0x00008929; +pub const SIOCSIFSLAVE: ::c_ulong = 0x00008930; +pub const SIOCADDMULTI: ::c_ulong = 0x00008931; +pub const SIOCDELMULTI: ::c_ulong = 0x00008932; +pub const SIOCDARP: ::c_ulong = 0x00008953; +pub const SIOCGARP: ::c_ulong = 0x00008954; +pub const SIOCSARP: ::c_ulong = 0x00008955; +pub const SIOCDRARP: ::c_ulong = 0x00008960; +pub const SIOCGRARP: ::c_ulong = 0x00008961; +pub const SIOCSRARP: ::c_ulong = 0x00008962; +pub const SIOCGIFMAP: ::c_ulong = 0x00008970; +pub const SIOCSIFMAP: ::c_ulong = 0x00008971; + +pub const IPTOS_TOS_MASK: u8 = 0x1E; +pub const IPTOS_PREC_MASK: u8 = 0xE0; + +pub const IPTOS_ECN_NOT_ECT: u8 = 0x00; + +pub const RTF_UP: ::c_ushort = 0x0001; +pub const RTF_GATEWAY: ::c_ushort = 0x0002; + +pub const RTF_HOST: ::c_ushort = 0x0004; +pub const RTF_REINSTATE: ::c_ushort = 0x0008; +pub const RTF_DYNAMIC: ::c_ushort = 0x0010; +pub const RTF_MODIFIED: ::c_ushort = 0x0020; +pub const RTF_MTU: ::c_ushort = 0x0040; +pub const RTF_MSS: ::c_ushort = RTF_MTU; +pub const RTF_WINDOW: ::c_ushort = 0x0080; +pub const RTF_IRTT: ::c_ushort = 0x0100; +pub const RTF_REJECT: ::c_ushort = 0x0200; +pub const RTF_STATIC: ::c_ushort = 0x0400; +pub const RTF_XRESOLVE: ::c_ushort = 0x0800; +pub const RTF_NOFORWARD: ::c_ushort = 0x1000; +pub const RTF_THROW: ::c_ushort = 0x2000; +pub const RTF_NOPMTUDISC: ::c_ushort = 0x4000; + +pub const RTF_DEFAULT: u32 = 0x00010000; +pub const RTF_ALLONLINK: u32 = 0x00020000; +pub const RTF_ADDRCONF: u32 = 0x00040000; +pub const RTF_LINKRT: u32 = 0x00100000; +pub const RTF_NONEXTHOP: u32 = 0x00200000; +pub const RTF_CACHE: u32 = 0x01000000; +pub const RTF_FLOW: u32 = 0x02000000; +pub const RTF_POLICY: u32 = 0x04000000; + +pub const RTCF_VALVE: u32 = 0x00200000; +pub const RTCF_MASQ: u32 = 0x00400000; +pub const RTCF_NAT: u32 = 0x00800000; +pub const RTCF_DOREDIRECT: u32 = 0x01000000; +pub const RTCF_LOG: u32 = 0x02000000; +pub const RTCF_DIRECTSRC: u32 = 0x04000000; + +pub const RTF_LOCAL: u32 = 0x80000000; +pub const RTF_INTERFACE: u32 = 0x40000000; +pub const RTF_MULTICAST: u32 = 0x20000000; +pub const RTF_BROADCAST: u32 = 0x10000000; +pub const RTF_NAT: u32 = 0x08000000; +pub const RTF_ADDRCLASSMASK: u32 = 0xF8000000; + +pub const RT_CLASS_UNSPEC: u8 = 0; +pub const RT_CLASS_DEFAULT: u8 = 253; +pub const RT_CLASS_MAIN: u8 = 254; +pub const RT_CLASS_LOCAL: u8 = 255; +pub const RT_CLASS_MAX: u8 = 255; + +// linux/neighbor.h +pub const NUD_NONE: u16 = 0x00; +pub const NUD_INCOMPLETE: u16 = 0x01; +pub const NUD_REACHABLE: u16 = 0x02; +pub const NUD_STALE: u16 = 0x04; +pub const NUD_DELAY: u16 = 0x08; +pub const NUD_PROBE: u16 = 0x10; +pub const NUD_FAILED: u16 = 0x20; +pub const NUD_NOARP: u16 = 0x40; +pub const NUD_PERMANENT: u16 = 0x80; + +pub const NTF_USE: u8 = 0x01; +pub const NTF_SELF: u8 = 0x02; +pub const NTF_MASTER: u8 = 0x04; +pub const NTF_PROXY: u8 = 0x08; +pub const NTF_ROUTER: u8 = 0x80; + +pub const NDA_UNSPEC: ::c_ushort = 0; +pub const NDA_DST: ::c_ushort = 1; +pub const NDA_LLADDR: ::c_ushort = 2; +pub const NDA_CACHEINFO: ::c_ushort = 3; +pub const NDA_PROBES: ::c_ushort = 4; +pub const NDA_VLAN: ::c_ushort = 5; +pub const NDA_PORT: ::c_ushort = 6; +pub const NDA_VNI: ::c_ushort = 7; +pub const NDA_IFINDEX: ::c_ushort = 8; + +// linux/rtnetlink.h +pub const TCA_UNSPEC: ::c_ushort = 0; +pub const TCA_KIND: ::c_ushort = 1; +pub const TCA_OPTIONS: ::c_ushort = 2; +pub const TCA_STATS: ::c_ushort = 3; +pub const TCA_XSTATS: ::c_ushort = 4; +pub const TCA_RATE: ::c_ushort = 5; +pub const TCA_FCNT: ::c_ushort = 6; +pub const TCA_STATS2: ::c_ushort = 7; +pub const TCA_STAB: ::c_ushort = 8; + +pub const RTM_NEWLINK: u16 = 16; +pub const RTM_DELLINK: u16 = 17; +pub const RTM_GETLINK: u16 = 18; +pub const RTM_SETLINK: u16 = 19; +pub const RTM_NEWADDR: u16 = 20; +pub const RTM_DELADDR: u16 = 21; +pub const RTM_GETADDR: u16 = 22; +pub const RTM_NEWROUTE: u16 = 24; +pub const RTM_DELROUTE: u16 = 25; +pub const RTM_GETROUTE: u16 = 26; +pub const RTM_NEWNEIGH: u16 = 28; +pub const RTM_DELNEIGH: u16 = 29; +pub const RTM_GETNEIGH: u16 = 30; +pub const RTM_NEWRULE: u16 = 32; +pub const RTM_DELRULE: u16 = 33; +pub const RTM_GETRULE: u16 = 34; +pub const RTM_NEWQDISC: u16 = 36; +pub const RTM_DELQDISC: u16 = 37; +pub const RTM_GETQDISC: u16 = 38; +pub const RTM_NEWTCLASS: u16 = 40; +pub const RTM_DELTCLASS: u16 = 41; +pub const RTM_GETTCLASS: u16 = 42; +pub const RTM_NEWTFILTER: u16 = 44; +pub const RTM_DELTFILTER: u16 = 45; +pub const RTM_GETTFILTER: u16 = 46; +pub const RTM_NEWACTION: u16 = 48; +pub const RTM_DELACTION: u16 = 49; +pub const RTM_GETACTION: u16 = 50; +pub const RTM_NEWPREFIX: u16 = 52; +pub const RTM_GETMULTICAST: u16 = 58; +pub const RTM_GETANYCAST: u16 = 62; +pub const RTM_NEWNEIGHTBL: u16 = 64; +pub const RTM_GETNEIGHTBL: u16 = 66; +pub const RTM_SETNEIGHTBL: u16 = 67; +pub const RTM_NEWNDUSEROPT: u16 = 68; +pub const RTM_NEWADDRLABEL: u16 = 72; +pub const RTM_DELADDRLABEL: u16 = 73; +pub const RTM_GETADDRLABEL: u16 = 74; +pub const RTM_GETDCB: u16 = 78; +pub const RTM_SETDCB: u16 = 79; +pub const RTM_NEWNETCONF: u16 = 80; +pub const RTM_GETNETCONF: u16 = 82; +pub const RTM_NEWMDB: u16 = 84; +pub const RTM_DELMDB: u16 = 85; +pub const RTM_GETMDB: u16 = 86; +pub const RTM_NEWNSID: u16 = 88; +pub const RTM_DELNSID: u16 = 89; +pub const RTM_GETNSID: u16 = 90; + +pub const RTM_F_NOTIFY: ::c_uint = 0x100; +pub const RTM_F_CLONED: ::c_uint = 0x200; +pub const RTM_F_EQUALIZE: ::c_uint = 0x400; +pub const RTM_F_PREFIX: ::c_uint = 0x800; + +pub const RTA_UNSPEC: ::c_ushort = 0; +pub const RTA_DST: ::c_ushort = 1; +pub const RTA_SRC: ::c_ushort = 2; +pub const RTA_IIF: ::c_ushort = 3; +pub const RTA_OIF: ::c_ushort = 4; +pub const RTA_GATEWAY: ::c_ushort = 5; +pub const RTA_PRIORITY: ::c_ushort = 6; +pub const RTA_PREFSRC: ::c_ushort = 7; +pub const RTA_METRICS: ::c_ushort = 8; +pub const RTA_MULTIPATH: ::c_ushort = 9; +pub const RTA_PROTOINFO: ::c_ushort = 10; // No longer used +pub const RTA_FLOW: ::c_ushort = 11; +pub const RTA_CACHEINFO: ::c_ushort = 12; +pub const RTA_SESSION: ::c_ushort = 13; // No longer used +pub const RTA_MP_ALGO: ::c_ushort = 14; // No longer used +pub const RTA_TABLE: ::c_ushort = 15; +pub const RTA_MARK: ::c_ushort = 16; +pub const RTA_MFC_STATS: ::c_ushort = 17; + +pub const RTN_UNSPEC: ::c_uchar = 0; +pub const RTN_UNICAST: ::c_uchar = 1; +pub const RTN_LOCAL: ::c_uchar = 2; +pub const RTN_BROADCAST: ::c_uchar = 3; +pub const RTN_ANYCAST: ::c_uchar = 4; +pub const RTN_MULTICAST: ::c_uchar = 5; +pub const RTN_BLACKHOLE: ::c_uchar = 6; +pub const RTN_UNREACHABLE: ::c_uchar = 7; +pub const RTN_PROHIBIT: ::c_uchar = 8; +pub const RTN_THROW: ::c_uchar = 9; +pub const RTN_NAT: ::c_uchar = 10; +pub const RTN_XRESOLVE: ::c_uchar = 11; + +pub const RTPROT_UNSPEC: ::c_uchar = 0; +pub const RTPROT_REDIRECT: ::c_uchar = 1; +pub const RTPROT_KERNEL: ::c_uchar = 2; +pub const RTPROT_BOOT: ::c_uchar = 3; +pub const RTPROT_STATIC: ::c_uchar = 4; + +pub const RT_SCOPE_UNIVERSE: ::c_uchar = 0; +pub const RT_SCOPE_SITE: ::c_uchar = 200; +pub const RT_SCOPE_LINK: ::c_uchar = 253; +pub const RT_SCOPE_HOST: ::c_uchar = 254; +pub const RT_SCOPE_NOWHERE: ::c_uchar = 255; + +pub const RT_TABLE_UNSPEC: ::c_uchar = 0; +pub const RT_TABLE_COMPAT: ::c_uchar = 252; +pub const RT_TABLE_DEFAULT: ::c_uchar = 253; +pub const RT_TABLE_MAIN: ::c_uchar = 254; +pub const RT_TABLE_LOCAL: ::c_uchar = 255; + +pub const RTMSG_OVERRUN: u32 = ::NLMSG_OVERRUN as u32; +pub const RTMSG_NEWDEVICE: u32 = 0x11; +pub const RTMSG_DELDEVICE: u32 = 0x12; +pub const RTMSG_NEWROUTE: u32 = 0x21; +pub const RTMSG_DELROUTE: u32 = 0x22; +pub const RTMSG_NEWRULE: u32 = 0x31; +pub const RTMSG_DELRULE: u32 = 0x32; +pub const RTMSG_CONTROL: u32 = 0x40; +pub const RTMSG_AR_FAILED: u32 = 0x51; + +pub const MAX_ADDR_LEN: usize = 7; +pub const ARPD_UPDATE: ::c_ushort = 0x01; +pub const ARPD_LOOKUP: ::c_ushort = 0x02; +pub const ARPD_FLUSH: ::c_ushort = 0x03; +pub const ATF_MAGIC: ::c_int = 0x80; + +#[cfg(not(target_arch = "sparc64"))] +pub const SO_TIMESTAMPING: ::c_int = 37; +#[cfg(target_arch = "sparc64")] +pub const SO_TIMESTAMPING: ::c_int = 35; +pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING; + +// linux/module.h +pub const MODULE_INIT_IGNORE_MODVERSIONS: ::c_uint = 0x0001; +pub const MODULE_INIT_IGNORE_VERMAGIC: ::c_uint = 0x0002; + +// linux/net_tstamp.h +pub const SOF_TIMESTAMPING_TX_HARDWARE: ::c_uint = 1 << 0; +pub const SOF_TIMESTAMPING_TX_SOFTWARE: ::c_uint = 1 << 1; +pub const SOF_TIMESTAMPING_RX_HARDWARE: ::c_uint = 1 << 2; +pub const SOF_TIMESTAMPING_RX_SOFTWARE: ::c_uint = 1 << 3; +pub const SOF_TIMESTAMPING_SOFTWARE: ::c_uint = 1 << 4; +pub const SOF_TIMESTAMPING_SYS_HARDWARE: ::c_uint = 1 << 5; +pub const SOF_TIMESTAMPING_RAW_HARDWARE: ::c_uint = 1 << 6; + +// linux/if_alg.h +pub const ALG_SET_KEY: ::c_int = 1; +pub const ALG_SET_IV: ::c_int = 2; +pub const ALG_SET_OP: ::c_int = 3; +pub const ALG_SET_AEAD_ASSOCLEN: ::c_int = 4; +pub const ALG_SET_AEAD_AUTHSIZE: ::c_int = 5; + +pub const ALG_OP_DECRYPT: ::c_int = 0; +pub const ALG_OP_ENCRYPT: ::c_int = 1; + +// uapi/linux/vm_sockets.h +pub const VMADDR_CID_ANY: ::c_uint = 0xFFFFFFFF; +pub const VMADDR_CID_HYPERVISOR: ::c_uint = 0; +pub const VMADDR_CID_RESERVED: ::c_uint = 1; +pub const VMADDR_CID_HOST: ::c_uint = 2; +pub const VMADDR_PORT_ANY: ::c_uint = 0xFFFFFFFF; + +// uapi/linux/inotify.h +pub const IN_ACCESS: u32 = 0x0000_0001; +pub const IN_MODIFY: u32 = 0x0000_0002; +pub const IN_ATTRIB: u32 = 0x0000_0004; +pub const IN_CLOSE_WRITE: u32 = 0x0000_0008; +pub const IN_CLOSE_NOWRITE: u32 = 0x0000_0010; +pub const IN_CLOSE: u32 = (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE); +pub const IN_OPEN: u32 = 0x0000_0020; +pub const IN_MOVED_FROM: u32 = 0x0000_0040; +pub const IN_MOVED_TO: u32 = 0x0000_0080; +pub const IN_MOVE: u32 = (IN_MOVED_FROM | IN_MOVED_TO); +pub const IN_CREATE: u32 = 0x0000_0100; +pub const IN_DELETE: u32 = 0x0000_0200; +pub const IN_DELETE_SELF: u32 = 0x0000_0400; +pub const IN_MOVE_SELF: u32 = 0x0000_0800; +pub const IN_UNMOUNT: u32 = 0x0000_2000; +pub const IN_Q_OVERFLOW: u32 = 0x0000_4000; +pub const IN_IGNORED: u32 = 0x0000_8000; +pub const IN_ONLYDIR: u32 = 0x0100_0000; +pub const IN_DONT_FOLLOW: u32 = 0x0200_0000; +// pub const IN_EXCL_UNLINK: u32 = 0x0400_0000; + +// pub const IN_MASK_CREATE: u32 = 0x1000_0000; +// pub const IN_MASK_ADD: u32 = 0x2000_0000; +pub const IN_ISDIR: u32 = 0x4000_0000; +pub const IN_ONESHOT: u32 = 0x8000_0000; + +pub const IN_ALL_EVENTS: u32 = ( + IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | + IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | + IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | + IN_MOVE_SELF +); + +pub const IN_CLOEXEC: ::c_int = O_CLOEXEC; +pub const IN_NONBLOCK: ::c_int = O_NONBLOCK; + +pub const FUTEX_WAIT: ::c_int = 0; +pub const FUTEX_WAKE: ::c_int = 1; +pub const FUTEX_FD: ::c_int = 2; +pub const FUTEX_REQUEUE: ::c_int = 3; +pub const FUTEX_CMP_REQUEUE: ::c_int = 4; +pub const FUTEX_WAKE_OP: ::c_int = 5; +pub const FUTEX_LOCK_PI: ::c_int = 6; +pub const FUTEX_UNLOCK_PI: ::c_int = 7; +pub const FUTEX_TRYLOCK_PI: ::c_int = 8; +pub const FUTEX_WAIT_BITSET: ::c_int = 9; +pub const FUTEX_WAKE_BITSET: ::c_int = 10; +pub const FUTEX_WAIT_REQUEUE_PI: ::c_int = 11; +pub const FUTEX_CMP_REQUEUE_PI: ::c_int = 12; + +pub const FUTEX_PRIVATE_FLAG: ::c_int = 128; +pub const FUTEX_CLOCK_REALTIME: ::c_int = 256; +pub const FUTEX_CMD_MASK: ::c_int = + !(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME); + +f! { + pub fn CMSG_NXTHDR(mhdr: *const msghdr, + cmsg: *const cmsghdr) -> *mut cmsghdr { + if ((*cmsg).cmsg_len as usize) < ::mem::size_of::() { + return 0 as *mut cmsghdr; + }; + let next = (cmsg as usize + + super::CMSG_ALIGN((*cmsg).cmsg_len as usize)) + as *mut cmsghdr; + let max = (*mhdr).msg_control as usize + + (*mhdr).msg_controllen as usize; + if (next.offset(1)) as usize > max || + next as usize + super::CMSG_ALIGN((*next).cmsg_len as usize) > max + { + 0 as *mut cmsghdr + } else { + next as *mut cmsghdr + } + } + + pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { + for slot in cpuset.bits.iter_mut() { + *slot = 0; + } + } + + pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { + let size_in_bits + = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); + cpuset.bits[idx] |= 1 << offset; + () + } + + pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { + let size_in_bits + = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); + cpuset.bits[idx] &= !(1 << offset); + () + } + + pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { + let size_in_bits = 8 * ::mem::size_of_val(&cpuset.bits[0]); + let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); + 0 != (cpuset.bits[idx] & (1 << offset)) + } + + pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { + set1.bits == set2.bits + } + + pub fn major(dev: ::dev_t) -> ::c_uint { + let mut major = 0; + major |= (dev & 0x00000000000fff00) >> 8; + major |= (dev & 0xfffff00000000000) >> 32; + major as ::c_uint + } + + pub fn minor(dev: ::dev_t) -> ::c_uint { + let mut minor = 0; + minor |= (dev & 0x00000000000000ff) >> 0; + minor |= (dev & 0x00000ffffff00000) >> 12; + minor as ::c_uint + } + + pub fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t { + let major = major as ::dev_t; + let minor = minor as ::dev_t; + let mut dev = 0; + dev |= (major & 0x00000fff) << 8; + dev |= (major & 0xfffff000) << 32; + dev |= (minor & 0x000000ff) << 0; + dev |= (minor & 0xffffff00) << 12; + dev + } + + pub fn IPTOS_TOS(tos: u8) -> u8 { + tos & IPTOS_TOS_MASK + } + + pub fn IPTOS_PREC(tos: u8) -> u8 { + tos & IPTOS_PREC_MASK + } + + pub fn RT_TOS(tos: u8) -> u8 { + tos & ::IPTOS_TOS_MASK + } + + pub fn RT_ADDRCLASS(flags: u32) -> u32 { + flags >> 23 + } + + pub fn RT_LOCALADDR(flags: u32) -> bool { + (flags & RTF_ADDRCLASSMASK) == (RTF_LOCAL | RTF_INTERFACE) + } +} + +extern { + #[cfg_attr(not(target_env = "musl"), + link_name = "__xpg_strerror_r")] + pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, + buflen: ::size_t) -> ::c_int; + + pub fn abs(i: ::c_int) -> ::c_int; + pub fn atof(s: *const ::c_char) -> ::c_double; + pub fn labs(i: ::c_long) -> ::c_long; + pub fn rand() -> ::c_int; + pub fn srand(seed: ::c_uint); + + pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int; + pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int; + pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int; + pub fn aio_error(aiocbp: *const aiocb) -> ::c_int; + pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t; + pub fn aio_suspend(aiocb_list: *const *const aiocb, nitems: ::c_int, + timeout: *const ::timespec) -> ::c_int; + pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int; + pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb, + nitems: ::c_int, sevp: *mut ::sigevent) -> ::c_int; + + pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int; + + pub fn setpwent(); + pub fn endpwent(); + pub fn getpwent() -> *mut passwd; + pub fn setgrent(); + pub fn endgrent(); + pub fn getgrent() -> *mut ::group; + pub fn setspent(); + pub fn endspent(); + pub fn getspent() -> *mut spwd; + + pub fn getspnam(__name: *const ::c_char) -> *mut spwd; + + pub fn shm_open(name: *const c_char, oflag: ::c_int, + mode: mode_t) -> ::c_int; + + // System V IPC + pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int; + pub fn shmat(shmid: ::c_int, + shmaddr: *const ::c_void, + shmflg: ::c_int) -> *mut ::c_void; + pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int; + pub fn shmctl(shmid: ::c_int, + cmd: ::c_int, + buf: *mut ::shmid_ds) -> ::c_int; + pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t; + pub fn semget(key: ::key_t, nsems: ::c_int, semflag: ::c_int) -> ::c_int; + pub fn semop(semid: ::c_int, + sops: *mut ::sembuf, nsops: ::size_t) -> ::c_int; + pub fn semctl(semid: ::c_int, + semnum: ::c_int, cmd: ::c_int, ...) -> ::c_int; + pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds) -> ::c_int; + pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int; + pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t, + msgtyp: ::c_long, msgflg: ::c_int) -> ::ssize_t; + pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t, + msgflg: ::c_int) -> ::c_int; + + pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) + -> ::c_int; + pub fn __errno_location() -> *mut ::c_int; + + pub fn fopen64(filename: *const c_char, + mode: *const c_char) -> *mut ::FILE; + pub fn freopen64(filename: *const c_char, mode: *const c_char, + file: *mut ::FILE) -> *mut ::FILE; + pub fn tmpfile64() -> *mut ::FILE; + pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int; + pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int; + pub fn fseeko64(stream: *mut ::FILE, + offset: ::off64_t, + whence: ::c_int) -> ::c_int; + pub fn ftello64(stream: *mut ::FILE) -> ::off64_t; + pub fn fallocate(fd: ::c_int, mode: ::c_int, + offset: ::off_t, len: ::off_t) -> ::c_int; + pub fn fallocate64(fd: ::c_int, mode: ::c_int, + offset: ::off64_t, len: ::off64_t) -> ::c_int; + pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, + len: ::off_t) -> ::c_int; + pub fn posix_fallocate64(fd: ::c_int, offset: ::off64_t, + len: ::off64_t) -> ::c_int; + pub fn readahead(fd: ::c_int, offset: ::off64_t, + count: ::size_t) -> ::ssize_t; + pub fn getxattr(path: *const c_char, name: *const c_char, + value: *mut ::c_void, size: ::size_t) -> ::ssize_t; + pub fn lgetxattr(path: *const c_char, name: *const c_char, + value: *mut ::c_void, size: ::size_t) -> ::ssize_t; + pub fn fgetxattr(filedes: ::c_int, name: *const c_char, + value: *mut ::c_void, size: ::size_t) -> ::ssize_t; + pub fn setxattr(path: *const c_char, name: *const c_char, + value: *const ::c_void, size: ::size_t, + flags: ::c_int) -> ::c_int; + pub fn lsetxattr(path: *const c_char, name: *const c_char, + value: *const ::c_void, size: ::size_t, + flags: ::c_int) -> ::c_int; + pub fn fsetxattr(filedes: ::c_int, name: *const c_char, + value: *const ::c_void, size: ::size_t, + flags: ::c_int) -> ::c_int; + pub fn listxattr(path: *const c_char, list: *mut c_char, + size: ::size_t) -> ::ssize_t; + pub fn llistxattr(path: *const c_char, list: *mut c_char, + size: ::size_t) -> ::ssize_t; + pub fn flistxattr(filedes: ::c_int, list: *mut c_char, + size: ::size_t) -> ::ssize_t; + pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int; + pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int; + pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int; + pub fn signalfd(fd: ::c_int, + mask: *const ::sigset_t, + flags: ::c_int) -> ::c_int; + pub fn timerfd_create(clockid: ::c_int, flags: ::c_int) -> ::c_int; + pub fn timerfd_gettime(fd: ::c_int, + curr_value: *mut itimerspec) -> ::c_int; + pub fn timerfd_settime(fd: ::c_int, + flags: ::c_int, + new_value: *const itimerspec, + old_value: *mut itimerspec) -> ::c_int; + pub fn pwritev(fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + offset: ::off_t) -> ::ssize_t; + pub fn preadv(fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + offset: ::off_t) -> ::ssize_t; + pub fn quotactl(cmd: ::c_int, + special: *const ::c_char, + id: ::c_int, + data: *mut ::c_char) -> ::c_int; + pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t; + pub fn mq_close(mqd: ::mqd_t) -> ::c_int; + pub fn mq_unlink(name: *const ::c_char) -> ::c_int; + pub fn mq_receive(mqd: ::mqd_t, + msg_ptr: *mut ::c_char, + msg_len: ::size_t, + msq_prio: *mut ::c_uint) -> ::ssize_t; + pub fn mq_timedreceive(mqd: ::mqd_t, + msg_ptr: *mut ::c_char, + msg_len: ::size_t, + msq_prio: *mut ::c_uint, + abs_timeout: *const ::timespec) -> ::ssize_t; + pub fn mq_send(mqd: ::mqd_t, + msg_ptr: *const ::c_char, + msg_len: ::size_t, + msq_prio: ::c_uint) -> ::c_int; + pub fn mq_timedsend(mqd: ::mqd_t, + msg_ptr: *const ::c_char, + msg_len: ::size_t, + msq_prio: ::c_uint, + abs_timeout: *const ::timespec) -> ::c_int; + pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int; + pub fn mq_setattr(mqd: ::mqd_t, + newattr: *const ::mq_attr, + oldattr: *mut ::mq_attr) -> ::c_int; + pub fn epoll_pwait(epfd: ::c_int, + events: *mut ::epoll_event, + maxevents: ::c_int, + timeout: ::c_int, + sigmask: *const ::sigset_t) -> ::c_int; + pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int; + pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int; + pub fn mkostemps(template: *mut ::c_char, + suffixlen: ::c_int, + flags: ::c_int) -> ::c_int; + pub fn sigtimedwait(set: *const sigset_t, + info: *mut siginfo_t, + timeout: *const ::timespec) -> ::c_int; + pub fn sigwaitinfo(set: *const sigset_t, + info: *mut siginfo_t) -> ::c_int; + pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; + pub fn getnameinfo(sa: *const ::sockaddr, + salen: ::socklen_t, + host: *mut ::c_char, + hostlen: ::socklen_t, + serv: *mut ::c_char, + sevlen: ::socklen_t, + flags: ::c_int) -> ::c_int; + pub fn pthread_setschedprio(native: ::pthread_t, + priority: ::c_int) -> ::c_int; + pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int; + pub fn process_vm_readv(pid: ::pid_t, + local_iov: *const ::iovec, + liovcnt: ::c_ulong, + remote_iov: *const ::iovec, + riovcnt: ::c_ulong, + flags: ::c_ulong) -> isize; + pub fn process_vm_writev(pid: ::pid_t, + local_iov: *const ::iovec, + liovcnt: ::c_ulong, + remote_iov: *const ::iovec, + riovcnt: ::c_ulong, + flags: ::c_ulong) -> isize; + pub fn reboot(how_to: ::c_int) -> ::c_int; + pub fn setfsgid(gid: ::gid_t) -> ::c_int; + pub fn setfsuid(uid: ::uid_t) -> ::c_int; + + // Not available now on Android + pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, + mode: ::mode_t) -> ::c_int; + pub fn if_nameindex() -> *mut if_nameindex; + pub fn if_freenameindex(ptr: *mut if_nameindex); + pub fn sync_file_range(fd: ::c_int, offset: ::off64_t, + nbytes: ::off64_t, flags: ::c_uint) -> ::c_int; + pub fn mremap(addr: *mut ::c_void, + len: ::size_t, + new_len: ::size_t, + flags: ::c_int, + ...) -> *mut ::c_void; + + pub fn glob(pattern: *const c_char, + flags: ::c_int, + errfunc: ::Option ::c_int>, + pglob: *mut ::glob_t) -> ::c_int; + pub fn globfree(pglob: *mut ::glob_t); + + pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) + -> ::c_int; + + pub fn shm_unlink(name: *const ::c_char) -> ::c_int; + + pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long); + + pub fn telldir(dirp: *mut ::DIR) -> ::c_long; + pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) + -> ::c_int; + + pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int; + pub fn remap_file_pages(addr: *mut ::c_void, size: ::size_t, prot: ::c_int, + pgoff: ::size_t, flags: ::c_int) -> ::c_int; + pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, + flags: ::c_int, addr: *mut ::sockaddr, + addrlen: *mut ::socklen_t) -> ::ssize_t; + pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; + pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int; + pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; + + pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int; + pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int; + pub fn vhangup() -> ::c_int; + pub fn sync(); + pub fn syscall(num: ::c_long, ...) -> ::c_long; + pub fn sched_getaffinity(pid: ::pid_t, + cpusetsize: ::size_t, + cpuset: *mut cpu_set_t) -> ::c_int; + pub fn sched_setaffinity(pid: ::pid_t, + cpusetsize: ::size_t, + cpuset: *const cpu_set_t) -> ::c_int; + pub fn epoll_create(size: ::c_int) -> ::c_int; + pub fn epoll_create1(flags: ::c_int) -> ::c_int; + pub fn epoll_wait(epfd: ::c_int, + events: *mut ::epoll_event, + maxevents: ::c_int, + timeout: ::c_int) -> ::c_int; + pub fn epoll_ctl(epfd: ::c_int, + op: ::c_int, + fd: ::c_int, + event: *mut ::epoll_event) -> ::c_int; + pub fn pthread_getschedparam(native: ::pthread_t, + policy: *mut ::c_int, + param: *mut ::sched_param) -> ::c_int; + pub fn unshare(flags: ::c_int) -> ::c_int; + pub fn umount(target: *const ::c_char) -> ::c_int; + pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int; + pub fn tee(fd_in: ::c_int, + fd_out: ::c_int, + len: ::size_t, + flags: ::c_uint) -> ::ssize_t; + pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int; + pub fn splice(fd_in: ::c_int, + off_in: *mut ::loff_t, + fd_out: ::c_int, + off_out: *mut ::loff_t, + len: ::size_t, + flags: ::c_uint) -> ::ssize_t; + pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; + pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int; + pub fn sem_timedwait(sem: *mut sem_t, + abstime: *const ::timespec) -> ::c_int; + pub fn sem_getvalue(sem: *mut sem_t, + sval: *mut ::c_int) -> ::c_int; + pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int; + pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int; + pub fn swapoff(puath: *const ::c_char) -> ::c_int; + pub fn vmsplice(fd: ::c_int, + iov: *const ::iovec, + nr_segs: ::size_t, + flags: ::c_uint) -> ::ssize_t; + pub fn mount(src: *const ::c_char, + target: *const ::c_char, + fstype: *const ::c_char, + flags: ::c_ulong, + data: *const ::c_void) -> ::c_int; + pub fn personality(persona: ::c_ulong) -> ::c_int; + pub fn prctl(option: ::c_int, ...) -> ::c_int; + pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int; + pub fn ppoll(fds: *mut ::pollfd, + nfds: nfds_t, + timeout: *const ::timespec, + sigmask: *const sigset_t) -> ::c_int; + pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t, + abstime: *const ::timespec) -> ::c_int; + pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int, + child_stack: *mut ::c_void, + flags: ::c_int, + arg: *mut ::c_void, ...) -> ::c_int; + pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int; + pub fn clock_nanosleep(clk_id: ::clockid_t, + flags: ::c_int, + rqtp: *const ::timespec, + rmtp: *mut ::timespec) -> ::c_int; + pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t, + guardsize: *mut ::size_t) -> ::c_int; + pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int; + pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int; + pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t, + pshared: *mut ::c_int) -> ::c_int; + pub fn sysinfo(info: *mut ::sysinfo) -> ::c_int; + pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int; + pub fn pthread_setschedparam(native: ::pthread_t, + policy: ::c_int, + param: *const ::sched_param) -> ::c_int; + pub fn swapon(path: *const ::c_char, swapflags: ::c_int) -> ::c_int; + pub fn sched_setscheduler(pid: ::pid_t, + policy: ::c_int, + param: *const ::sched_param) -> ::c_int; + pub fn sendfile(out_fd: ::c_int, + in_fd: ::c_int, + offset: *mut off_t, + count: ::size_t) -> ::ssize_t; + pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int; + #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")] + pub fn getgrgid_r(gid: ::gid_t, + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group) -> ::c_int; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "sigaltstack$UNIX2003")] + #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")] + pub fn sigaltstack(ss: *const stack_t, + oss: *mut stack_t) -> ::c_int; + pub fn sem_close(sem: *mut sem_t) -> ::c_int; + pub fn getdtablesize() -> ::c_int; + #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")] + pub fn getgrnam_r(name: *const ::c_char, + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group) -> ::c_int; + pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "pthread_sigmask$UNIX2003")] + pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, + oldset: *mut sigset_t) -> ::c_int; + pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t; + pub fn getgrnam(name: *const ::c_char) -> *mut ::group; + pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int; + pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; + pub fn sem_unlink(name: *const ::c_char) -> ::c_int; + pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; + #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")] + #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")] + pub fn getpwnam_r(name: *const ::c_char, + pwd: *mut passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut passwd) -> ::c_int; + #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")] + #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")] + pub fn getpwuid_r(uid: ::uid_t, + pwd: *mut passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut passwd) -> ::c_int; + #[cfg_attr(all(target_os = "macos", target_arch ="x86"), + link_name = "sigwait$UNIX2003")] + #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] + pub fn sigwait(set: *const sigset_t, + sig: *mut ::c_int) -> ::c_int; + pub fn pthread_atfork(prepare: ::Option, + parent: ::Option, + child: ::Option) -> ::c_int; + pub fn getgrgid(gid: ::gid_t) -> *mut ::group; + pub fn getgrouplist(user: *const ::c_char, + group: ::gid_t, + groups: *mut ::gid_t, + ngroups: *mut ::c_int) -> ::c_int; + pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t, + pshared: *mut ::c_int) -> ::c_int; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "popen$UNIX2003")] + pub fn popen(command: *const c_char, + mode: *const c_char) -> *mut ::FILE; + pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char, + mode: ::c_int, flags: ::c_int) -> ::c_int; + pub fn pthread_create(native: *mut ::pthread_t, + attr: *const ::pthread_attr_t, + f: extern fn(*mut ::c_void) -> *mut ::c_void, + value: *mut ::c_void) -> ::c_int; + pub fn dl_iterate_phdr( + callback: ::Option ::c_int>, + data: *mut ::c_void + ) -> ::c_int; + + pub fn setmntent(filename: *const ::c_char, + ty: *const ::c_char) -> *mut ::FILE; + pub fn getmntent(stream: *mut ::FILE) -> *mut ::mntent; + pub fn addmntent(stream: *mut ::FILE, mnt: *const ::mntent) -> ::c_int; + pub fn endmntent(streamp: *mut ::FILE) -> ::c_int; + pub fn hasmntopt(mnt: *const ::mntent, + opt: *const ::c_char) -> *mut ::c_char; + + pub fn posix_spawn(pid: *mut ::pid_t, + path: *const ::c_char, + file_actions: *const ::posix_spawn_file_actions_t, + attrp: *const ::posix_spawnattr_t, + argv: *const *mut ::c_char, + envp: *const *mut ::c_char) -> ::c_int; + pub fn posix_spawnp(pid: *mut ::pid_t, + file: *const ::c_char, + file_actions: *const ::posix_spawn_file_actions_t, + attrp: *const ::posix_spawnattr_t, + argv: *const *mut ::c_char, + envp: *const *mut ::c_char) -> ::c_int; + pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int; + pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int; + pub fn posix_spawnattr_getsigdefault(attr: *const posix_spawnattr_t, + default: *mut ::sigset_t) -> ::c_int; + pub fn posix_spawnattr_setsigdefault(attr: *mut posix_spawnattr_t, + default: *const ::sigset_t) -> ::c_int; + pub fn posix_spawnattr_getsigmask(attr: *const posix_spawnattr_t, + default: *mut ::sigset_t) -> ::c_int; + pub fn posix_spawnattr_setsigmask(attr: *mut posix_spawnattr_t, + default: *const ::sigset_t) -> ::c_int; + pub fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t, + flags: *mut ::c_short) -> ::c_int; + pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, + flags: ::c_short) -> ::c_int; + pub fn posix_spawnattr_getpgroup(attr: *const posix_spawnattr_t, + flags: *mut ::pid_t) -> ::c_int; + pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, + flags: ::pid_t) -> ::c_int; + pub fn posix_spawnattr_getschedpolicy(attr: *const posix_spawnattr_t, + flags: *mut ::c_int) -> ::c_int; + pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, + flags: ::c_int) -> ::c_int; + pub fn posix_spawnattr_getschedparam( + attr: *const posix_spawnattr_t, + param: *mut ::sched_param, + ) -> ::c_int; + pub fn posix_spawnattr_setschedparam( + attr: *mut posix_spawnattr_t, + param: *const ::sched_param, + ) -> ::c_int; + + pub fn posix_spawn_file_actions_init( + actions: *mut posix_spawn_file_actions_t, + ) -> ::c_int; + pub fn posix_spawn_file_actions_destroy( + actions: *mut posix_spawn_file_actions_t, + ) -> ::c_int; + pub fn posix_spawn_file_actions_addopen( + actions: *mut posix_spawn_file_actions_t, + fd: ::c_int, + path: *const ::c_char, + oflag: ::c_int, + mode: ::mode_t, + ) -> ::c_int; + pub fn posix_spawn_file_actions_addclose( + actions: *mut posix_spawn_file_actions_t, + fd: ::c_int, + ) -> ::c_int; + pub fn posix_spawn_file_actions_adddup2( + actions: *mut posix_spawn_file_actions_t, + fd: ::c_int, + newfd: ::c_int, + ) -> ::c_int; + pub fn fread_unlocked(ptr: *mut ::c_void, + size: ::size_t, + nobj: ::size_t, + stream: *mut ::FILE + ) -> ::size_t; + pub fn inotify_rm_watch(fd: ::c_int, wd: ::c_int) -> ::c_int; + pub fn inotify_init() -> ::c_int; + pub fn inotify_init1(flags: ::c_int) -> ::c_int; + pub fn inotify_add_watch(fd: ::c_int, + path: *const ::c_char, + mask: u32) -> ::c_int; +} + +cfg_if! { + if #[cfg(target_env = "musl")] { + mod musl; + pub use self::musl::*; + } else if #[cfg(target_env = "gnu")] { + mod gnu; + pub use self::gnu::*; + } +} + +cfg_if! { + if #[cfg(libc_align)] { + #[macro_use] + mod align; + } else { + #[macro_use] + mod no_align; + } +} +expand_align!(); diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/b32/arm.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/b32/arm.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/b32/arm.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/b32/arm.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,837 @@ +pub type c_char = u8; +pub type wchar_t = u32; + +s! { + pub struct stat { + pub st_dev: ::dev_t, + __st_dev_padding: ::c_int, + __st_ino_truncated: ::c_long, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __st_rdev_padding: ::c_int, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_ino: ::ino_t, + } + + pub struct stat64 { + pub st_dev: ::dev_t, + __st_dev_padding: ::c_int, + __st_ino_truncated: ::c_long, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __st_rdev_padding: ::c_int, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_ino: ::ino_t, + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_flags: ::c_int, + pub ss_size: ::size_t + } + + pub struct ipc_perm { + pub __ipc_perm_key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::mode_t, + pub __seq: ::c_int, + __unused1: ::c_long, + __unused2: ::c_long + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_atime: ::time_t, + __unused1: ::c_int, + pub shm_dtime: ::time_t, + __unused2: ::c_int, + pub shm_ctime: ::time_t, + __unused3: ::c_int, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, + pub shm_nattch: ::c_ulong, + __pad1: ::c_ulong, + __pad2: ::c_ulong, + } + + pub struct msqid_ds { + pub msg_perm: ::ipc_perm, + pub msg_stime: ::time_t, + __unused1: ::c_int, + pub msg_rtime: ::time_t, + __unused2: ::c_int, + pub msg_ctime: ::time_t, + __unused3: ::c_int, + __msg_cbytes: ::c_ulong, + pub msg_qnum: ::msgqnum_t, + pub msg_qbytes: ::msglen_t, + pub msg_lspid: ::pid_t, + pub msg_lrpid: ::pid_t, + __pad1: ::c_ulong, + __pad2: ::c_ulong, + } + + pub struct statfs { + pub f_type: ::c_ulong, + pub f_bsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_flags: ::c_ulong, + pub f_spare: [::c_ulong; 4], + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + pub _pad: [::c_int; 29], + _align: [usize; 0], + } + + pub struct statfs64 { + pub f_type: ::c_ulong, + pub f_bsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_flags: ::c_ulong, + pub f_spare: [::c_ulong; 4], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: u64, + pub f_fsid: ::c_ulong, + __f_unused: ::c_int, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } +} + +pub const SIGSTKSZ: ::size_t = 8192; +pub const MINSIGSTKSZ: ::size_t = 2048; + +pub const O_DIRECT: ::c_int = 0x10000; +pub const O_DIRECTORY: ::c_int = 0x4000; +pub const O_NOFOLLOW: ::c_int = 0x8000; +pub const O_ASYNC: ::c_int = 0x2000; +pub const O_LARGEFILE: ::c_int = 0o400000; + +pub const FIOCLEX: ::c_int = 0x5451; +pub const FIONCLEX: ::c_int = 0x5450; +pub const FIONBIO: ::c_int = 0x5421; + +pub const RLIMIT_RSS: ::c_int = 5; +pub const RLIMIT_NOFILE: ::c_int = 7; +pub const RLIMIT_AS: ::c_int = 9; +pub const RLIMIT_NPROC: ::c_int = 6; +pub const RLIMIT_MEMLOCK: ::c_int = 8; +pub const RLIMIT_NLIMITS: ::c_int = 15; + +pub const MADV_SOFT_OFFLINE: ::c_int = 101; +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; +pub const CBAUD: ::tcflag_t = 0o0010017; +pub const TAB1: ::c_int = 0x00000800; +pub const TAB2: ::c_int = 0x00001000; +pub const TAB3: ::c_int = 0x00001800; +pub const CR1: ::c_int = 0x00000200; +pub const CR2: ::c_int = 0x00000400; +pub const CR3: ::c_int = 0x00000600; +pub const FF1: ::c_int = 0x00008000; +pub const BS1: ::c_int = 0x00002000; +pub const VT1: ::c_int = 0x00004000; +pub const VWERASE: usize = 14; +pub const VREPRINT: usize = 12; +pub const VSUSP: usize = 10; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VDISCARD: usize = 13; +pub const VTIME: usize = 5; +pub const IXON: ::tcflag_t = 0x00000400; +pub const IXOFF: ::tcflag_t = 0x00001000; +pub const ONLCR: ::tcflag_t = 0x4; +pub const CSIZE: ::tcflag_t = 0x00000030; +pub const CS6: ::tcflag_t = 0x00000010; +pub const CS7: ::tcflag_t = 0x00000020; +pub const CS8: ::tcflag_t = 0x00000030; +pub const CSTOPB: ::tcflag_t = 0x00000040; +pub const CREAD: ::tcflag_t = 0x00000080; +pub const PARENB: ::tcflag_t = 0x00000100; +pub const PARODD: ::tcflag_t = 0x00000200; +pub const HUPCL: ::tcflag_t = 0x00000400; +pub const CLOCAL: ::tcflag_t = 0x00000800; +pub const ECHOKE: ::tcflag_t = 0x00000800; +pub const ECHOE: ::tcflag_t = 0x00000010; +pub const ECHOK: ::tcflag_t = 0x00000020; +pub const ECHONL: ::tcflag_t = 0x00000040; +pub const ECHOPRT: ::tcflag_t = 0x00000400; +pub const ECHOCTL: ::tcflag_t = 0x00000200; +pub const ISIG: ::tcflag_t = 0x00000001; +pub const ICANON: ::tcflag_t = 0x00000002; +pub const PENDIN: ::tcflag_t = 0x00004000; +pub const NOFLSH: ::tcflag_t = 0x00000080; +pub const CIBAUD: ::tcflag_t = 0o02003600000; +pub const CBAUDEX: ::tcflag_t = 0o010000; +pub const VSWTC: usize = 7; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const XTABS: ::tcflag_t = 0o014000; +pub const B57600: ::speed_t = 0o010001; +pub const B115200: ::speed_t = 0o010002; +pub const B230400: ::speed_t = 0o010003; +pub const B460800: ::speed_t = 0o010004; +pub const B500000: ::speed_t = 0o010005; +pub const B576000: ::speed_t = 0o010006; +pub const B921600: ::speed_t = 0o010007; +pub const B1000000: ::speed_t = 0o010010; +pub const B1152000: ::speed_t = 0o010011; +pub const B1500000: ::speed_t = 0o010012; +pub const B2000000: ::speed_t = 0o010013; +pub const B2500000: ::speed_t = 0o010014; +pub const B3000000: ::speed_t = 0o010015; +pub const B3500000: ::speed_t = 0o010016; +pub const B4000000: ::speed_t = 0o010017; + +pub const O_APPEND: ::c_int = 1024; +pub const O_CREAT: ::c_int = 64; +pub const O_EXCL: ::c_int = 128; +pub const O_NOCTTY: ::c_int = 256; +pub const O_NONBLOCK: ::c_int = 2048; +pub const O_SYNC: ::c_int = 1052672; +pub const O_RSYNC: ::c_int = 1052672; +pub const O_DSYNC: ::c_int = 4096; + +pub const SOCK_NONBLOCK: ::c_int = 2048; + +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_GROWSDOWN: ::c_int = 0x0100; +pub const MAP_DENYWRITE: ::c_int = 0x0800; +pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_LOCKED: ::c_int = 0x02000; +pub const MAP_NORESERVE: ::c_int = 0x04000; +pub const MAP_POPULATE: ::c_int = 0x08000; +pub const MAP_NONBLOCK: ::c_int = 0x010000; +pub const MAP_STACK: ::c_int = 0x020000; + +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; +pub const SOCK_SEQPACKET: ::c_int = 5; + +pub const SOL_SOCKET: ::c_int = 1; + +pub const EDEADLK: ::c_int = 35; +pub const ENAMETOOLONG: ::c_int = 36; +pub const ENOLCK: ::c_int = 37; +pub const ENOSYS: ::c_int = 38; +pub const ENOTEMPTY: ::c_int = 39; +pub const ELOOP: ::c_int = 40; +pub const ENOMSG: ::c_int = 42; +pub const EIDRM: ::c_int = 43; +pub const ECHRNG: ::c_int = 44; +pub const EL2NSYNC: ::c_int = 45; +pub const EL3HLT: ::c_int = 46; +pub const EL3RST: ::c_int = 47; +pub const ELNRNG: ::c_int = 48; +pub const EUNATCH: ::c_int = 49; +pub const ENOCSI: ::c_int = 50; +pub const EL2HLT: ::c_int = 51; +pub const EBADE: ::c_int = 52; +pub const EBADR: ::c_int = 53; +pub const EXFULL: ::c_int = 54; +pub const ENOANO: ::c_int = 55; +pub const EBADRQC: ::c_int = 56; +pub const EBADSLT: ::c_int = 57; +pub const EDEADLOCK: ::c_int = EDEADLK; +pub const EMULTIHOP: ::c_int = 72; +pub const EBADMSG: ::c_int = 74; +pub const EOVERFLOW: ::c_int = 75; +pub const ENOTUNIQ: ::c_int = 76; +pub const EBADFD: ::c_int = 77; +pub const EREMCHG: ::c_int = 78; +pub const ELIBACC: ::c_int = 79; +pub const ELIBBAD: ::c_int = 80; +pub const ELIBSCN: ::c_int = 81; +pub const ELIBMAX: ::c_int = 82; +pub const ELIBEXEC: ::c_int = 83; +pub const EILSEQ: ::c_int = 84; +pub const ERESTART: ::c_int = 85; +pub const ESTRPIPE: ::c_int = 86; +pub const EUSERS: ::c_int = 87; +pub const ENOTSOCK: ::c_int = 88; +pub const EDESTADDRREQ: ::c_int = 89; +pub const EMSGSIZE: ::c_int = 90; +pub const EPROTOTYPE: ::c_int = 91; +pub const ENOPROTOOPT: ::c_int = 92; +pub const EPROTONOSUPPORT: ::c_int = 93; +pub const ESOCKTNOSUPPORT: ::c_int = 94; +pub const EOPNOTSUPP: ::c_int = 95; +pub const ENOTSUP: ::c_int = EOPNOTSUPP; +pub const EPFNOSUPPORT: ::c_int = 96; +pub const EAFNOSUPPORT: ::c_int = 97; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const ENETDOWN: ::c_int = 100; +pub const ENETUNREACH: ::c_int = 101; +pub const ENETRESET: ::c_int = 102; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNRESET: ::c_int = 104; +pub const ENOBUFS: ::c_int = 105; +pub const EISCONN: ::c_int = 106; +pub const ENOTCONN: ::c_int = 107; +pub const ESHUTDOWN: ::c_int = 108; +pub const ETOOMANYREFS: ::c_int = 109; +pub const ETIMEDOUT: ::c_int = 110; +pub const ECONNREFUSED: ::c_int = 111; +pub const EHOSTDOWN: ::c_int = 112; +pub const EHOSTUNREACH: ::c_int = 113; +pub const EALREADY: ::c_int = 114; +pub const EINPROGRESS: ::c_int = 115; +pub const ESTALE: ::c_int = 116; +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; +pub const EDQUOT: ::c_int = 122; +pub const ENOMEDIUM: ::c_int = 123; +pub const EMEDIUMTYPE: ::c_int = 124; +pub const ECANCELED: ::c_int = 125; +pub const ENOKEY: ::c_int = 126; +pub const EKEYEXPIRED: ::c_int = 127; +pub const EKEYREVOKED: ::c_int = 128; +pub const EKEYREJECTED: ::c_int = 129; +pub const EOWNERDEAD: ::c_int = 130; +pub const ENOTRECOVERABLE: ::c_int = 131; +pub const ERFKILL: ::c_int = 132; +pub const EHWPOISON: ::c_int = 133; + +pub const SO_REUSEADDR: ::c_int = 2; +pub const SO_TYPE: ::c_int = 3; +pub const SO_ERROR: ::c_int = 4; +pub const SO_DONTROUTE: ::c_int = 5; +pub const SO_BROADCAST: ::c_int = 6; +pub const SO_SNDBUF: ::c_int = 7; +pub const SO_RCVBUF: ::c_int = 8; +pub const SO_KEEPALIVE: ::c_int = 9; +pub const SO_OOBINLINE: ::c_int = 10; +pub const SO_NO_CHECK: ::c_int = 11; +pub const SO_PRIORITY: ::c_int = 12; +pub const SO_LINGER: ::c_int = 13; +pub const SO_BSDCOMPAT: ::c_int = 14; +pub const SO_REUSEPORT: ::c_int = 15; +pub const SO_PASSCRED: ::c_int = 16; +pub const SO_PEERCRED: ::c_int = 17; +pub const SO_RCVLOWAT: ::c_int = 18; +pub const SO_SNDLOWAT: ::c_int = 19; +pub const SO_RCVTIMEO: ::c_int = 20; +pub const SO_SNDTIMEO: ::c_int = 21; +pub const SO_ACCEPTCONN: ::c_int = 30; +pub const SO_SNDBUFFORCE: ::c_int = 32; +pub const SO_RCVBUFFORCE: ::c_int = 33; +pub const SO_PROTOCOL: ::c_int = 38; +pub const SO_DOMAIN: ::c_int = 39; + +pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_SIGINFO: ::c_int = 0x00000004; +pub const SA_NOCLDWAIT: ::c_int = 0x00000002; + +pub const SIGCHLD: ::c_int = 17; +pub const SIGBUS: ::c_int = 7; +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; +pub const SIGUSR1: ::c_int = 10; +pub const SIGUSR2: ::c_int = 12; +pub const SIGCONT: ::c_int = 18; +pub const SIGSTOP: ::c_int = 19; +pub const SIGTSTP: ::c_int = 20; +pub const SIGURG: ::c_int = 23; +pub const SIGIO: ::c_int = 29; +pub const SIGSYS: ::c_int = 31; +pub const SIGSTKFLT: ::c_int = 16; +pub const SIGPOLL: ::c_int = 29; +pub const SIGPWR: ::c_int = 30; +pub const SIG_SETMASK: ::c_int = 2; +pub const SIG_BLOCK: ::c_int = 0x000000; +pub const SIG_UNBLOCK: ::c_int = 0x01; + +pub const EXTPROC: ::tcflag_t = 0x00010000; + +pub const MAP_HUGETLB: ::c_int = 0x040000; + +pub const F_GETLK: ::c_int = 12; +pub const F_GETOWN: ::c_int = 9; +pub const F_SETLK: ::c_int = 13; +pub const F_SETLKW: ::c_int = 14; +pub const F_SETOWN: ::c_int = 8; + +pub const VEOF: usize = 4; +pub const VEOL: usize = 11; +pub const VEOL2: usize = 16; +pub const VMIN: usize = 6; +pub const IEXTEN: ::tcflag_t = 0x00008000; +pub const TOSTOP: ::tcflag_t = 0x00000100; +pub const FLUSHO: ::tcflag_t = 0x00001000; + +pub const TCGETS: ::c_int = 0x5401; +pub const TCSETS: ::c_int = 0x5402; +pub const TCSETSW: ::c_int = 0x5403; +pub const TCSETSF: ::c_int = 0x5404; +pub const TCGETA: ::c_int = 0x5405; +pub const TCSETA: ::c_int = 0x5406; +pub const TCSETAW: ::c_int = 0x5407; +pub const TCSETAF: ::c_int = 0x5408; +pub const TCSBRK: ::c_int = 0x5409; +pub const TCXONC: ::c_int = 0x540A; +pub const TCFLSH: ::c_int = 0x540B; +pub const TIOCGSOFTCAR: ::c_int = 0x5419; +pub const TIOCSSOFTCAR: ::c_int = 0x541A; +pub const TIOCLINUX: ::c_int = 0x541C; +pub const TIOCGSERIAL: ::c_int = 0x541E; +pub const TIOCEXCL: ::c_int = 0x540C; +pub const TIOCNXCL: ::c_int = 0x540D; +pub const TIOCSCTTY: ::c_int = 0x540E; +pub const TIOCGPGRP: ::c_int = 0x540F; +pub const TIOCSPGRP: ::c_int = 0x5410; +pub const TIOCOUTQ: ::c_int = 0x5411; +pub const TIOCSTI: ::c_int = 0x5412; +pub const TIOCGWINSZ: ::c_int = 0x5413; +pub const TIOCSWINSZ: ::c_int = 0x5414; +pub const TIOCMGET: ::c_int = 0x5415; +pub const TIOCMBIS: ::c_int = 0x5416; +pub const TIOCMBIC: ::c_int = 0x5417; +pub const TIOCMSET: ::c_int = 0x5418; +pub const FIONREAD: ::c_int = 0x541B; +pub const TIOCCONS: ::c_int = 0x541D; + +pub const TIOCGRS485: ::c_int = 0x542E; +pub const TIOCSRS485: ::c_int = 0x542F; + +pub const POLLWRNORM: ::c_short = 0x100; +pub const POLLWRBAND: ::c_short = 0x200; + +pub const TIOCM_LE: ::c_int = 0x001; +pub const TIOCM_DTR: ::c_int = 0x002; +pub const TIOCM_RTS: ::c_int = 0x004; +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; +pub const TIOCM_CD: ::c_int = TIOCM_CAR; +pub const TIOCM_RI: ::c_int = TIOCM_RNG; + +// Syscall table +pub const SYS_restart_syscall: ::c_long = 0; +pub const SYS_exit: ::c_long = 1; +pub const SYS_fork: ::c_long = 2; +pub const SYS_read: ::c_long = 3; +pub const SYS_write: ::c_long = 4; +pub const SYS_open: ::c_long = 5; +pub const SYS_close: ::c_long = 6; +pub const SYS_creat: ::c_long = 8; +pub const SYS_link: ::c_long = 9; +pub const SYS_unlink: ::c_long = 10; +pub const SYS_execve: ::c_long = 11; +pub const SYS_chdir: ::c_long = 12; +pub const SYS_mknod: ::c_long = 14; +pub const SYS_chmod: ::c_long = 15; +pub const SYS_lchown: ::c_long = 16; +pub const SYS_lseek: ::c_long = 19; +pub const SYS_getpid: ::c_long = 20; +pub const SYS_mount: ::c_long = 21; +pub const SYS_setuid: ::c_long = 23; +pub const SYS_getuid: ::c_long = 24; +pub const SYS_ptrace: ::c_long = 26; +pub const SYS_pause: ::c_long = 29; +pub const SYS_access: ::c_long = 33; +pub const SYS_nice: ::c_long = 34; +pub const SYS_sync: ::c_long = 36; +pub const SYS_kill: ::c_long = 37; +pub const SYS_rename: ::c_long = 38; +pub const SYS_mkdir: ::c_long = 39; +pub const SYS_rmdir: ::c_long = 40; +pub const SYS_dup: ::c_long = 41; +pub const SYS_pipe: ::c_long = 42; +pub const SYS_times: ::c_long = 43; +pub const SYS_brk: ::c_long = 45; +pub const SYS_setgid: ::c_long = 46; +pub const SYS_getgid: ::c_long = 47; +pub const SYS_geteuid: ::c_long = 49; +pub const SYS_getegid: ::c_long = 50; +pub const SYS_acct: ::c_long = 51; +pub const SYS_umount2: ::c_long = 52; +pub const SYS_ioctl: ::c_long = 54; +pub const SYS_fcntl: ::c_long = 55; +pub const SYS_setpgid: ::c_long = 57; +pub const SYS_umask: ::c_long = 60; +pub const SYS_chroot: ::c_long = 61; +pub const SYS_ustat: ::c_long = 62; +pub const SYS_dup2: ::c_long = 63; +pub const SYS_getppid: ::c_long = 64; +pub const SYS_getpgrp: ::c_long = 65; +pub const SYS_setsid: ::c_long = 66; +pub const SYS_sigaction: ::c_long = 67; +pub const SYS_setreuid: ::c_long = 70; +pub const SYS_setregid: ::c_long = 71; +pub const SYS_sigsuspend: ::c_long = 72; +pub const SYS_sigpending: ::c_long = 73; +pub const SYS_sethostname: ::c_long = 74; +pub const SYS_setrlimit: ::c_long = 75; +pub const SYS_getrusage: ::c_long = 77; +pub const SYS_gettimeofday: ::c_long = 78; +pub const SYS_settimeofday: ::c_long = 79; +pub const SYS_getgroups: ::c_long = 80; +pub const SYS_setgroups: ::c_long = 81; +pub const SYS_symlink: ::c_long = 83; +pub const SYS_readlink: ::c_long = 85; +pub const SYS_uselib: ::c_long = 86; +pub const SYS_swapon: ::c_long = 87; +pub const SYS_reboot: ::c_long = 88; +pub const SYS_munmap: ::c_long = 91; +pub const SYS_truncate: ::c_long = 92; +pub const SYS_ftruncate: ::c_long = 93; +pub const SYS_fchmod: ::c_long = 94; +pub const SYS_fchown: ::c_long = 95; +pub const SYS_getpriority: ::c_long = 96; +pub const SYS_setpriority: ::c_long = 97; +pub const SYS_statfs: ::c_long = 99; +pub const SYS_fstatfs: ::c_long = 100; +pub const SYS_syslog: ::c_long = 103; +pub const SYS_setitimer: ::c_long = 104; +pub const SYS_getitimer: ::c_long = 105; +pub const SYS_stat: ::c_long = 106; +pub const SYS_lstat: ::c_long = 107; +pub const SYS_fstat: ::c_long = 108; +pub const SYS_vhangup: ::c_long = 111; +pub const SYS_wait4: ::c_long = 114; +pub const SYS_swapoff: ::c_long = 115; +pub const SYS_sysinfo: ::c_long = 116; +pub const SYS_fsync: ::c_long = 118; +pub const SYS_sigreturn: ::c_long = 119; +pub const SYS_clone: ::c_long = 120; +pub const SYS_setdomainname: ::c_long = 121; +pub const SYS_uname: ::c_long = 122; +pub const SYS_adjtimex: ::c_long = 124; +pub const SYS_mprotect: ::c_long = 125; +pub const SYS_sigprocmask: ::c_long = 126; +pub const SYS_init_module: ::c_long = 128; +pub const SYS_delete_module: ::c_long = 129; +pub const SYS_quotactl: ::c_long = 131; +pub const SYS_getpgid: ::c_long = 132; +pub const SYS_fchdir: ::c_long = 133; +pub const SYS_bdflush: ::c_long = 134; +pub const SYS_sysfs: ::c_long = 135; +pub const SYS_personality: ::c_long = 136; +pub const SYS_setfsuid: ::c_long = 138; +pub const SYS_setfsgid: ::c_long = 139; +pub const SYS__llseek: ::c_long = 140; +pub const SYS_getdents: ::c_long = 141; +pub const SYS__newselect: ::c_long = 142; +pub const SYS_flock: ::c_long = 143; +pub const SYS_msync: ::c_long = 144; +pub const SYS_readv: ::c_long = 145; +pub const SYS_writev: ::c_long = 146; +pub const SYS_getsid: ::c_long = 147; +pub const SYS_fdatasync: ::c_long = 148; +pub const SYS__sysctl: ::c_long = 149; +pub const SYS_mlock: ::c_long = 150; +pub const SYS_munlock: ::c_long = 151; +pub const SYS_mlockall: ::c_long = 152; +pub const SYS_munlockall: ::c_long = 153; +pub const SYS_sched_setparam: ::c_long = 154; +pub const SYS_sched_getparam: ::c_long = 155; +pub const SYS_sched_setscheduler: ::c_long = 156; +pub const SYS_sched_getscheduler: ::c_long = 157; +pub const SYS_sched_yield: ::c_long = 158; +pub const SYS_sched_get_priority_max: ::c_long = 159; +pub const SYS_sched_get_priority_min: ::c_long = 160; +pub const SYS_sched_rr_get_interval: ::c_long = 161; +pub const SYS_nanosleep: ::c_long = 162; +pub const SYS_mremap: ::c_long = 163; +pub const SYS_setresuid: ::c_long = 164; +pub const SYS_getresuid: ::c_long = 165; +pub const SYS_poll: ::c_long = 168; +pub const SYS_nfsservctl: ::c_long = 169; +pub const SYS_setresgid: ::c_long = 170; +pub const SYS_getresgid: ::c_long = 171; +pub const SYS_prctl: ::c_long = 172; +pub const SYS_rt_sigreturn: ::c_long = 173; +pub const SYS_rt_sigaction: ::c_long = 174; +pub const SYS_rt_sigprocmask: ::c_long = 175; +pub const SYS_rt_sigpending: ::c_long = 176; +pub const SYS_rt_sigtimedwait: ::c_long = 177; +pub const SYS_rt_sigqueueinfo: ::c_long = 178; +pub const SYS_rt_sigsuspend: ::c_long = 179; +pub const SYS_pread64: ::c_long = 180; +pub const SYS_pwrite64: ::c_long = 181; +pub const SYS_chown: ::c_long = 182; +pub const SYS_getcwd: ::c_long = 183; +pub const SYS_capget: ::c_long = 184; +pub const SYS_capset: ::c_long = 185; +pub const SYS_sigaltstack: ::c_long = 186; +pub const SYS_sendfile: ::c_long = 187; +pub const SYS_vfork: ::c_long = 190; +pub const SYS_ugetrlimit: ::c_long = 191; +pub const SYS_mmap2: ::c_long = 192; +pub const SYS_truncate64: ::c_long = 193; +pub const SYS_ftruncate64: ::c_long = 194; +pub const SYS_stat64: ::c_long = 195; +pub const SYS_lstat64: ::c_long = 196; +pub const SYS_fstat64: ::c_long = 197; +pub const SYS_lchown32: ::c_long = 198; +pub const SYS_getuid32: ::c_long = 199; +pub const SYS_getgid32: ::c_long = 200; +pub const SYS_geteuid32: ::c_long = 201; +pub const SYS_getegid32: ::c_long = 202; +pub const SYS_setreuid32: ::c_long = 203; +pub const SYS_setregid32: ::c_long = 204; +pub const SYS_getgroups32: ::c_long = 205; +pub const SYS_setgroups32: ::c_long = 206; +pub const SYS_fchown32: ::c_long = 207; +pub const SYS_setresuid32: ::c_long = 208; +pub const SYS_getresuid32: ::c_long = 209; +pub const SYS_setresgid32: ::c_long = 210; +pub const SYS_getresgid32: ::c_long = 211; +pub const SYS_chown32: ::c_long = 212; +pub const SYS_setuid32: ::c_long = 213; +pub const SYS_setgid32: ::c_long = 214; +pub const SYS_setfsuid32: ::c_long = 215; +pub const SYS_setfsgid32: ::c_long = 216; +pub const SYS_getdents64: ::c_long = 217; +pub const SYS_pivot_root: ::c_long = 218; +pub const SYS_mincore: ::c_long = 219; +pub const SYS_madvise: ::c_long = 220; +pub const SYS_fcntl64: ::c_long = 221; +pub const SYS_gettid: ::c_long = 224; +pub const SYS_readahead: ::c_long = 225; +pub const SYS_setxattr: ::c_long = 226; +pub const SYS_lsetxattr: ::c_long = 227; +pub const SYS_fsetxattr: ::c_long = 228; +pub const SYS_getxattr: ::c_long = 229; +pub const SYS_lgetxattr: ::c_long = 230; +pub const SYS_fgetxattr: ::c_long = 231; +pub const SYS_listxattr: ::c_long = 232; +pub const SYS_llistxattr: ::c_long = 233; +pub const SYS_flistxattr: ::c_long = 234; +pub const SYS_removexattr: ::c_long = 235; +pub const SYS_lremovexattr: ::c_long = 236; +pub const SYS_fremovexattr: ::c_long = 237; +pub const SYS_tkill: ::c_long = 238; +pub const SYS_sendfile64: ::c_long = 239; +pub const SYS_futex: ::c_long = 240; +pub const SYS_sched_setaffinity: ::c_long = 241; +pub const SYS_sched_getaffinity: ::c_long = 242; +pub const SYS_io_setup: ::c_long = 243; +pub const SYS_io_destroy: ::c_long = 244; +pub const SYS_io_getevents: ::c_long = 245; +pub const SYS_io_submit: ::c_long = 246; +pub const SYS_io_cancel: ::c_long = 247; +pub const SYS_exit_group: ::c_long = 248; +pub const SYS_lookup_dcookie: ::c_long = 249; +pub const SYS_epoll_create: ::c_long = 250; +pub const SYS_epoll_ctl: ::c_long = 251; +pub const SYS_epoll_wait: ::c_long = 252; +pub const SYS_remap_file_pages: ::c_long = 253; +pub const SYS_set_tid_address: ::c_long = 256; +pub const SYS_timer_create: ::c_long = 257; +pub const SYS_timer_settime: ::c_long = 258; +pub const SYS_timer_gettime: ::c_long = 259; +pub const SYS_timer_getoverrun: ::c_long = 260; +pub const SYS_timer_delete: ::c_long = 261; +pub const SYS_clock_settime: ::c_long = 262; +pub const SYS_clock_gettime: ::c_long = 263; +pub const SYS_clock_getres: ::c_long = 264; +pub const SYS_clock_nanosleep: ::c_long = 265; +pub const SYS_statfs64: ::c_long = 266; +pub const SYS_fstatfs64: ::c_long = 267; +pub const SYS_tgkill: ::c_long = 268; +pub const SYS_utimes: ::c_long = 269; +pub const SYS_pciconfig_iobase: ::c_long = 271; +pub const SYS_pciconfig_read: ::c_long = 272; +pub const SYS_pciconfig_write: ::c_long = 273; +pub const SYS_mq_open: ::c_long = 274; +pub const SYS_mq_unlink: ::c_long = 275; +pub const SYS_mq_timedsend: ::c_long = 276; +pub const SYS_mq_timedreceive: ::c_long = 277; +pub const SYS_mq_notify: ::c_long = 278; +pub const SYS_mq_getsetattr: ::c_long = 279; +pub const SYS_waitid: ::c_long = 280; +pub const SYS_socket: ::c_long = 281; +pub const SYS_bind: ::c_long = 282; +pub const SYS_connect: ::c_long = 283; +pub const SYS_listen: ::c_long = 284; +pub const SYS_accept: ::c_long = 285; +pub const SYS_getsockname: ::c_long = 286; +pub const SYS_getpeername: ::c_long = 287; +pub const SYS_socketpair: ::c_long = 288; +pub const SYS_send: ::c_long = 289; +pub const SYS_sendto: ::c_long = 290; +pub const SYS_recv: ::c_long = 291; +pub const SYS_recvfrom: ::c_long = 292; +pub const SYS_shutdown: ::c_long = 293; +pub const SYS_setsockopt: ::c_long = 294; +pub const SYS_getsockopt: ::c_long = 295; +pub const SYS_sendmsg: ::c_long = 296; +pub const SYS_recvmsg: ::c_long = 297; +pub const SYS_semop: ::c_long = 298; +pub const SYS_semget: ::c_long = 299; +pub const SYS_semctl: ::c_long = 300; +pub const SYS_msgsnd: ::c_long = 301; +pub const SYS_msgrcv: ::c_long = 302; +pub const SYS_msgget: ::c_long = 303; +pub const SYS_msgctl: ::c_long = 304; +pub const SYS_shmat: ::c_long = 305; +pub const SYS_shmdt: ::c_long = 306; +pub const SYS_shmget: ::c_long = 307; +pub const SYS_shmctl: ::c_long = 308; +pub const SYS_add_key: ::c_long = 309; +pub const SYS_request_key: ::c_long = 310; +pub const SYS_keyctl: ::c_long = 311; +pub const SYS_semtimedop: ::c_long = 312; +pub const SYS_vserver: ::c_long = 313; +pub const SYS_ioprio_set: ::c_long = 314; +pub const SYS_ioprio_get: ::c_long = 315; +pub const SYS_inotify_init: ::c_long = 316; +pub const SYS_inotify_add_watch: ::c_long = 317; +pub const SYS_inotify_rm_watch: ::c_long = 318; +pub const SYS_mbind: ::c_long = 319; +pub const SYS_get_mempolicy: ::c_long = 320; +pub const SYS_set_mempolicy: ::c_long = 321; +pub const SYS_openat: ::c_long = 322; +pub const SYS_mkdirat: ::c_long = 323; +pub const SYS_mknodat: ::c_long = 324; +pub const SYS_fchownat: ::c_long = 325; +pub const SYS_futimesat: ::c_long = 326; +pub const SYS_fstatat64: ::c_long = 327; +pub const SYS_unlinkat: ::c_long = 328; +pub const SYS_renameat: ::c_long = 329; +pub const SYS_linkat: ::c_long = 330; +pub const SYS_symlinkat: ::c_long = 331; +pub const SYS_readlinkat: ::c_long = 332; +pub const SYS_fchmodat: ::c_long = 333; +pub const SYS_faccessat: ::c_long = 334; +pub const SYS_pselect6: ::c_long = 335; +pub const SYS_ppoll: ::c_long = 336; +pub const SYS_unshare: ::c_long = 337; +pub const SYS_set_robust_list: ::c_long = 338; +pub const SYS_get_robust_list: ::c_long = 339; +pub const SYS_splice: ::c_long = 340; +pub const SYS_tee: ::c_long = 342; +pub const SYS_vmsplice: ::c_long = 343; +pub const SYS_move_pages: ::c_long = 344; +pub const SYS_getcpu: ::c_long = 345; +pub const SYS_epoll_pwait: ::c_long = 346; +pub const SYS_kexec_load: ::c_long = 347; +pub const SYS_utimensat: ::c_long = 348; +pub const SYS_signalfd: ::c_long = 349; +pub const SYS_timerfd_create: ::c_long = 350; +pub const SYS_eventfd: ::c_long = 351; +pub const SYS_fallocate: ::c_long = 352; +pub const SYS_timerfd_settime: ::c_long = 353; +pub const SYS_timerfd_gettime: ::c_long = 354; +pub const SYS_signalfd4: ::c_long = 355; +pub const SYS_eventfd2: ::c_long = 356; +pub const SYS_epoll_create1: ::c_long = 357; +pub const SYS_dup3: ::c_long = 358; +pub const SYS_pipe2: ::c_long = 359; +pub const SYS_inotify_init1: ::c_long = 360; +pub const SYS_preadv: ::c_long = 361; +pub const SYS_pwritev: ::c_long = 362; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 363; +pub const SYS_perf_event_open: ::c_long = 364; +pub const SYS_recvmmsg: ::c_long = 365; +pub const SYS_accept4: ::c_long = 366; +pub const SYS_fanotify_init: ::c_long = 367; +pub const SYS_fanotify_mark: ::c_long = 368; +pub const SYS_prlimit64: ::c_long = 369; +pub const SYS_name_to_handle_at: ::c_long = 370; +pub const SYS_open_by_handle_at: ::c_long = 371; +pub const SYS_clock_adjtime: ::c_long = 372; +pub const SYS_syncfs: ::c_long = 373; +pub const SYS_sendmmsg: ::c_long = 374; +pub const SYS_setns: ::c_long = 375; +pub const SYS_process_vm_readv: ::c_long = 376; +pub const SYS_process_vm_writev: ::c_long = 377; +pub const SYS_kcmp: ::c_long = 378; +pub const SYS_finit_module: ::c_long = 379; +pub const SYS_sched_setattr: ::c_long = 380; +pub const SYS_sched_getattr: ::c_long = 381; +pub const SYS_renameat2: ::c_long = 382; +pub const SYS_seccomp: ::c_long = 383; +pub const SYS_getrandom: ::c_long = 384; +pub const SYS_memfd_create: ::c_long = 385; +pub const SYS_bpf: ::c_long = 386; +pub const SYS_execveat: ::c_long = 387; +pub const SYS_userfaultfd: ::c_long = 388; +pub const SYS_membarrier: ::c_long = 389; +pub const SYS_mlock2: ::c_long = 390; +pub const SYS_copy_file_range: ::c_long = 391; +pub const SYS_preadv2: ::c_long = 392; +pub const SYS_pwritev2: ::c_long = 393; +pub const SYS_pkey_mprotect: ::c_long = 394; +pub const SYS_pkey_alloc: ::c_long = 395; +pub const SYS_pkey_free: ::c_long = 396; + +extern { + pub fn getrandom( + buf: *mut ::c_void, + buflen: ::size_t, + flags: ::c_uint, + ) -> ::ssize_t; +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/b32/mips.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/b32/mips.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/b32/mips.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/b32/mips.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,838 @@ +pub type c_char = i8; +pub type wchar_t = ::c_int; + +s! { + pub struct stat { + pub st_dev: ::dev_t, + __st_padding1: [::c_long; 2], + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __st_padding2: [::c_long; 2], + pub st_size: ::off_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_blksize: ::blksize_t, + __st_padding3: ::c_long, + pub st_blocks: ::blkcnt_t, + __st_padding4: [::c_long; 14], + } + + pub struct stat64 { + pub st_dev: ::dev_t, + __st_padding1: [::c_long; 2], + pub st_ino: ::ino64_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __st_padding2: [::c_long; 2], + pub st_size: ::off_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_blksize: ::blksize_t, + __st_padding3: ::c_long, + pub st_blocks: ::blkcnt64_t, + __st_padding4: [::c_long; 14], + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_size: ::size_t, + pub ss_flags: ::c_int, + } + + pub struct ipc_perm { + pub __ipc_perm_key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::mode_t, + pub __seq: ::c_int, + __unused1: ::c_long, + __unused2: ::c_long + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_atime: ::time_t, + pub shm_dtime: ::time_t, + pub shm_ctime: ::time_t, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, + pub shm_nattch: ::c_ulong, + __pad1: ::c_ulong, + __pad2: ::c_ulong, + } + + pub struct msqid_ds { + pub msg_perm: ::ipc_perm, + #[cfg(target_endian = "big")] + __unused1: ::c_int, + pub msg_stime: ::time_t, + #[cfg(target_endian = "little")] + __unused1: ::c_int, + #[cfg(target_endian = "big")] + __unused2: ::c_int, + pub msg_rtime: ::time_t, + #[cfg(target_endian = "little")] + __unused2: ::c_int, + #[cfg(target_endian = "big")] + __unused3: ::c_int, + pub msg_ctime: ::time_t, + #[cfg(target_endian = "little")] + __unused3: ::c_int, + __msg_cbytes: ::c_ulong, + pub msg_qnum: ::msgqnum_t, + pub msg_qbytes: ::msglen_t, + pub msg_lspid: ::pid_t, + pub msg_lrpid: ::pid_t, + __pad1: ::c_ulong, + __pad2: ::c_ulong, + } + + pub struct statfs { + pub f_type: ::c_ulong, + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_ulong, + pub f_flags: ::c_ulong, + pub f_spare: [::c_ulong; 5], + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_code: ::c_int, + pub si_errno: ::c_int, + pub _pad: [::c_int; 29], + _align: [usize; 0], + } + + pub struct statfs64 { + pub f_type: ::c_ulong, + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_ulong, + pub f_flags: ::c_ulong, + pub f_spare: [::c_ulong; 5], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: u64, + #[cfg(target_endian = "little")] + pub f_fsid: ::c_ulong, + __f_unused: ::c_int, + #[cfg(target_endian = "big")] + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } +} + +pub const SIGSTKSZ: ::size_t = 8192; +pub const MINSIGSTKSZ: ::size_t = 2048; + +pub const O_DIRECT: ::c_int = 0o100000; +pub const O_DIRECTORY: ::c_int = 0o200000; +pub const O_NOFOLLOW: ::c_int = 0o400000; +pub const O_ASYNC: ::c_int = 0o10000; +pub const O_LARGEFILE: ::c_int = 0x2000; + +pub const FIOCLEX: ::c_int = 0x6601; +pub const FIONCLEX: ::c_int = 0x6602; +pub const FIONBIO: ::c_int = 0x667E; + +pub const RLIMIT_RSS: ::c_int = 7; +pub const RLIMIT_NOFILE: ::c_int = 5; +pub const RLIMIT_AS: ::c_int = 6; +pub const RLIMIT_NPROC: ::c_int = 8; +pub const RLIMIT_MEMLOCK: ::c_int = 9; +pub const RLIMIT_NLIMITS: ::c_int = 15; + +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; +pub const CBAUD: ::tcflag_t = 0o0010017; +pub const TAB1: ::c_int = 0x00000800; +pub const TAB2: ::c_int = 0x00001000; +pub const TAB3: ::c_int = 0x00001800; +pub const CR1: ::c_int = 0x00000200; +pub const CR2: ::c_int = 0x00000400; +pub const CR3: ::c_int = 0x00000600; +pub const FF1: ::c_int = 0x00008000; +pub const BS1: ::c_int = 0x00002000; +pub const VT1: ::c_int = 0x00004000; +pub const VWERASE: usize = 14; +pub const VREPRINT: usize = 12; +pub const VSUSP: usize = 10; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VDISCARD: usize = 13; +pub const VTIME: usize = 5; +pub const IXON: ::tcflag_t = 0x00000400; +pub const IXOFF: ::tcflag_t = 0x00001000; +pub const ONLCR: ::tcflag_t = 0x4; +pub const CSIZE: ::tcflag_t = 0x00000030; +pub const CS6: ::tcflag_t = 0x00000010; +pub const CS7: ::tcflag_t = 0x00000020; +pub const CS8: ::tcflag_t = 0x00000030; +pub const CSTOPB: ::tcflag_t = 0x00000040; +pub const CREAD: ::tcflag_t = 0x00000080; +pub const PARENB: ::tcflag_t = 0x00000100; +pub const PARODD: ::tcflag_t = 0x00000200; +pub const HUPCL: ::tcflag_t = 0x00000400; +pub const CLOCAL: ::tcflag_t = 0x00000800; +pub const ECHOKE: ::tcflag_t = 0x00000800; +pub const ECHOE: ::tcflag_t = 0x00000010; +pub const ECHOK: ::tcflag_t = 0x00000020; +pub const ECHONL: ::tcflag_t = 0x00000040; +pub const ECHOPRT: ::tcflag_t = 0x00000400; +pub const ECHOCTL: ::tcflag_t = 0x00000200; +pub const ISIG: ::tcflag_t = 0x00000001; +pub const ICANON: ::tcflag_t = 0x00000002; +pub const PENDIN: ::tcflag_t = 0x00004000; +pub const NOFLSH: ::tcflag_t = 0x00000080; +pub const CIBAUD: ::tcflag_t = 0o02003600000; +pub const CBAUDEX: ::tcflag_t = 0o010000; +pub const VSWTC: usize = 7; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const XTABS: ::tcflag_t = 0o014000; +pub const B57600: ::speed_t = 0o010001; +pub const B115200: ::speed_t = 0o010002; +pub const B230400: ::speed_t = 0o010003; +pub const B460800: ::speed_t = 0o010004; +pub const B500000: ::speed_t = 0o010005; +pub const B576000: ::speed_t = 0o010006; +pub const B921600: ::speed_t = 0o010007; +pub const B1000000: ::speed_t = 0o010010; +pub const B1152000: ::speed_t = 0o010011; +pub const B1500000: ::speed_t = 0o010012; +pub const B2000000: ::speed_t = 0o010013; +pub const B2500000: ::speed_t = 0o010014; +pub const B3000000: ::speed_t = 0o010015; +pub const B3500000: ::speed_t = 0o010016; +pub const B4000000: ::speed_t = 0o010017; + +pub const O_APPEND: ::c_int = 0o010; +pub const O_CREAT: ::c_int = 0o400; +pub const O_EXCL: ::c_int = 0o2000; +pub const O_NOCTTY: ::c_int = 0o4000; +pub const O_NONBLOCK: ::c_int = 0o200; +pub const O_SYNC: ::c_int = 0o40020; +pub const O_RSYNC: ::c_int = 0o40020; +pub const O_DSYNC: ::c_int = 0o020; + +pub const SOCK_NONBLOCK: ::c_int = 0o200; + +pub const MAP_ANON: ::c_int = 0x800; +pub const MAP_GROWSDOWN: ::c_int = 0x1000; +pub const MAP_DENYWRITE: ::c_int = 0x2000; +pub const MAP_EXECUTABLE: ::c_int = 0x4000; +pub const MAP_LOCKED: ::c_int = 0x8000; +pub const MAP_NORESERVE: ::c_int = 0x0400; +pub const MAP_POPULATE: ::c_int = 0x10000; +pub const MAP_NONBLOCK: ::c_int = 0x20000; +pub const MAP_STACK: ::c_int = 0x40000; + +pub const EDEADLK: ::c_int = 45; +pub const ENAMETOOLONG: ::c_int = 78; +pub const ENOLCK: ::c_int = 46; +pub const ENOSYS: ::c_int = 89; +pub const ENOTEMPTY: ::c_int = 93; +pub const ELOOP: ::c_int = 90; +pub const ENOMSG: ::c_int = 35; +pub const EIDRM: ::c_int = 36; +pub const ECHRNG: ::c_int = 37; +pub const EL2NSYNC: ::c_int = 38; +pub const EL3HLT: ::c_int = 39; +pub const EL3RST: ::c_int = 40; +pub const ELNRNG: ::c_int = 41; +pub const EUNATCH: ::c_int = 42; +pub const ENOCSI: ::c_int = 43; +pub const EL2HLT: ::c_int = 44; +pub const EBADE: ::c_int = 50; +pub const EBADR: ::c_int = 51; +pub const EXFULL: ::c_int = 52; +pub const ENOANO: ::c_int = 53; +pub const EBADRQC: ::c_int = 54; +pub const EBADSLT: ::c_int = 55; +pub const EDEADLOCK: ::c_int = 56; +pub const EMULTIHOP: ::c_int = 74; +pub const EOVERFLOW: ::c_int = 79; +pub const ENOTUNIQ: ::c_int = 80; +pub const EBADFD: ::c_int = 81; +pub const EBADMSG: ::c_int = 77; +pub const EREMCHG: ::c_int = 82; +pub const ELIBACC: ::c_int = 83; +pub const ELIBBAD: ::c_int = 84; +pub const ELIBSCN: ::c_int = 85; +pub const ELIBMAX: ::c_int = 86; +pub const ELIBEXEC: ::c_int = 87; +pub const EILSEQ: ::c_int = 88; +pub const ERESTART: ::c_int = 91; +pub const ESTRPIPE: ::c_int = 92; +pub const EUSERS: ::c_int = 94; +pub const ENOTSOCK: ::c_int = 95; +pub const EDESTADDRREQ: ::c_int = 96; +pub const EMSGSIZE: ::c_int = 97; +pub const EPROTOTYPE: ::c_int = 98; +pub const ENOPROTOOPT: ::c_int = 99; +pub const EPROTONOSUPPORT: ::c_int = 120; +pub const ESOCKTNOSUPPORT: ::c_int = 121; +pub const EOPNOTSUPP: ::c_int = 122; +pub const ENOTSUP: ::c_int = EOPNOTSUPP; +pub const EPFNOSUPPORT: ::c_int = 123; +pub const EAFNOSUPPORT: ::c_int = 124; +pub const EADDRINUSE: ::c_int = 125; +pub const EADDRNOTAVAIL: ::c_int = 126; +pub const ENETDOWN: ::c_int = 127; +pub const ENETUNREACH: ::c_int = 128; +pub const ENETRESET: ::c_int = 129; +pub const ECONNABORTED: ::c_int = 130; +pub const ECONNRESET: ::c_int = 131; +pub const ENOBUFS: ::c_int = 132; +pub const EISCONN: ::c_int = 133; +pub const ENOTCONN: ::c_int = 134; +pub const ESHUTDOWN: ::c_int = 143; +pub const ETOOMANYREFS: ::c_int = 144; +pub const ETIMEDOUT: ::c_int = 145; +pub const ECONNREFUSED: ::c_int = 146; +pub const EHOSTDOWN: ::c_int = 147; +pub const EHOSTUNREACH: ::c_int = 148; +pub const EALREADY: ::c_int = 149; +pub const EINPROGRESS: ::c_int = 150; +pub const ESTALE: ::c_int = 151; +pub const EUCLEAN: ::c_int = 135; +pub const ENOTNAM: ::c_int = 137; +pub const ENAVAIL: ::c_int = 138; +pub const EISNAM: ::c_int = 139; +pub const EREMOTEIO: ::c_int = 140; +pub const EDQUOT: ::c_int = 1133; +pub const ENOMEDIUM: ::c_int = 159; +pub const EMEDIUMTYPE: ::c_int = 160; +pub const ECANCELED: ::c_int = 158; +pub const ENOKEY: ::c_int = 161; +pub const EKEYEXPIRED: ::c_int = 162; +pub const EKEYREVOKED: ::c_int = 163; +pub const EKEYREJECTED: ::c_int = 164; +pub const EOWNERDEAD: ::c_int = 165; +pub const ENOTRECOVERABLE: ::c_int = 166; +pub const EHWPOISON: ::c_int = 168; +pub const ERFKILL: ::c_int = 167; + +pub const SOCK_STREAM: ::c_int = 2; +pub const SOCK_DGRAM: ::c_int = 1; +pub const SOCK_SEQPACKET: ::c_int = 5; + +pub const SOL_SOCKET: ::c_int = 65535; + +pub const SO_REUSEADDR: ::c_int = 0x0004; +pub const SO_KEEPALIVE: ::c_int = 0x0008; +pub const SO_DONTROUTE: ::c_int = 0x0010; +pub const SO_BROADCAST: ::c_int = 0x0020; +pub const SO_LINGER: ::c_int = 0x0080; +pub const SO_OOBINLINE: ::c_int = 0x0100; +pub const SO_REUSEPORT: ::c_int = 0x0200; +pub const SO_SNDBUF: ::c_int = 0x1001; +pub const SO_RCVBUF: ::c_int = 0x1002; +pub const SO_SNDLOWAT: ::c_int = 0x1003; +pub const SO_RCVLOWAT: ::c_int = 0x1004; +pub const SO_RCVTIMEO: ::c_int = 0x1006; +pub const SO_SNDTIMEO: ::c_int = 0x1005; +pub const SO_ERROR: ::c_int = 0x1007; +pub const SO_TYPE: ::c_int = 0x1008; +pub const SO_ACCEPTCONN: ::c_int = 0x1009; +pub const SO_PROTOCOL: ::c_int = 0x1028; +pub const SO_DOMAIN: ::c_int = 0x1029; +pub const SO_NO_CHECK: ::c_int = 11; +pub const SO_PRIORITY: ::c_int = 12; +pub const SO_BSDCOMPAT: ::c_int = 14; +pub const SO_PASSCRED: ::c_int = 17; +pub const SO_PEERCRED: ::c_int = 18; +pub const SO_SNDBUFFORCE: ::c_int = 31; +pub const SO_RCVBUFFORCE: ::c_int = 33; + +pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_SIGINFO: ::c_int = 8; +pub const SA_NOCLDWAIT: ::c_int = 0x10000; + +pub const SIGCHLD: ::c_int = 18; +pub const SIGBUS: ::c_int = 10; +pub const SIGTTIN: ::c_int = 26; +pub const SIGTTOU: ::c_int = 27; +pub const SIGXCPU: ::c_int = 30; +pub const SIGXFSZ: ::c_int = 31; +pub const SIGVTALRM: ::c_int = 28; +pub const SIGPROF: ::c_int = 29; +pub const SIGWINCH: ::c_int = 20; +pub const SIGUSR1: ::c_int = 16; +pub const SIGUSR2: ::c_int = 17; +pub const SIGCONT: ::c_int = 25; +pub const SIGSTOP: ::c_int = 23; +pub const SIGTSTP: ::c_int = 24; +pub const SIGURG: ::c_int = 21; +pub const SIGIO: ::c_int = 22; +pub const SIGSYS: ::c_int = 12; +pub const SIGSTKFLT: ::c_int = 7; +pub const SIGPOLL: ::c_int = ::SIGIO; +pub const SIGPWR: ::c_int = 19; +pub const SIG_SETMASK: ::c_int = 3; +pub const SIG_BLOCK: ::c_int = 1; +pub const SIG_UNBLOCK: ::c_int = 2; + +pub const EXTPROC: ::tcflag_t = 0o200000; + +pub const MAP_HUGETLB: ::c_int = 0x80000; + +pub const F_GETLK: ::c_int = 33; +pub const F_GETOWN: ::c_int = 23; +pub const F_SETLK: ::c_int = 34; +pub const F_SETLKW: ::c_int = 35; +pub const F_SETOWN: ::c_int = 24; + +pub const VEOF: usize = 16; +pub const VEOL: usize = 17; +pub const VEOL2: usize = 6; +pub const VMIN: usize = 4; +pub const IEXTEN: ::tcflag_t = 0o000400; +pub const TOSTOP: ::tcflag_t = 0o100000; +pub const FLUSHO: ::tcflag_t = 0o020000; + +pub const TCGETS: ::c_int = 0x540D; +pub const TCSETS: ::c_int = 0x540E; +pub const TCSETSW: ::c_int = 0x540F; +pub const TCSETSF: ::c_int = 0x5410; +pub const TCGETA: ::c_int = 0x5401; +pub const TCSETA: ::c_int = 0x5402; +pub const TCSETAW: ::c_int = 0x5403; +pub const TCSETAF: ::c_int = 0x5404; +pub const TCSBRK: ::c_int = 0x5405; +pub const TCXONC: ::c_int = 0x5406; +pub const TCFLSH: ::c_int = 0x5407; +pub const TIOCGSOFTCAR: ::c_int = 0x5481; +pub const TIOCSSOFTCAR: ::c_int = 0x5482; +pub const TIOCLINUX: ::c_int = 0x5483; +pub const TIOCGSERIAL: ::c_int = 0x5484; +pub const TIOCEXCL: ::c_int = 0x740D; +pub const TIOCNXCL: ::c_int = 0x740E; +pub const TIOCSCTTY: ::c_int = 0x5480; +pub const TIOCGPGRP: ::c_int = 0x40047477; +pub const TIOCSPGRP: ::c_int = 0x80047476; +pub const TIOCOUTQ: ::c_int = 0x7472; +pub const TIOCSTI: ::c_int = 0x5472; +pub const TIOCGWINSZ: ::c_int = 0x40087468; +pub const TIOCSWINSZ: ::c_int = 0x80087467; +pub const TIOCMGET: ::c_int = 0x741D; +pub const TIOCMBIS: ::c_int = 0x741B; +pub const TIOCMBIC: ::c_int = 0x741C; +pub const TIOCMSET: ::c_int = 0x741A; +pub const FIONREAD: ::c_int = 0x467F; +pub const TIOCCONS: ::c_int = 0x80047478; + +pub const TIOCGRS485: ::c_int = 0x4020542E; +pub const TIOCSRS485: ::c_int = 0xC020542F; + +pub const POLLWRNORM: ::c_short = 0x4; +pub const POLLWRBAND: ::c_short = 0x100; + +pub const TIOCM_LE: ::c_int = 0x001; +pub const TIOCM_DTR: ::c_int = 0x002; +pub const TIOCM_RTS: ::c_int = 0x004; +pub const TIOCM_ST: ::c_int = 0x010; +pub const TIOCM_SR: ::c_int = 0x020; +pub const TIOCM_CTS: ::c_int = 0x040; +pub const TIOCM_CAR: ::c_int = 0x100; +pub const TIOCM_CD: ::c_int = TIOCM_CAR; +pub const TIOCM_RNG: ::c_int = 0x200; +pub const TIOCM_RI: ::c_int = TIOCM_RNG; +pub const TIOCM_DSR: ::c_int = 0x400; + +pub const SYS_syscall: ::c_long = 4000 + 0; +pub const SYS_exit: ::c_long = 4000 + 1; +pub const SYS_fork: ::c_long = 4000 + 2; +pub const SYS_read: ::c_long = 4000 + 3; +pub const SYS_write: ::c_long = 4000 + 4; +pub const SYS_open: ::c_long = 4000 + 5; +pub const SYS_close: ::c_long = 4000 + 6; +pub const SYS_waitpid: ::c_long = 4000 + 7; +pub const SYS_creat: ::c_long = 4000 + 8; +pub const SYS_link: ::c_long = 4000 + 9; +pub const SYS_unlink: ::c_long = 4000 + 10; +pub const SYS_execve: ::c_long = 4000 + 11; +pub const SYS_chdir: ::c_long = 4000 + 12; +pub const SYS_time: ::c_long = 4000 + 13; +pub const SYS_mknod: ::c_long = 4000 + 14; +pub const SYS_chmod: ::c_long = 4000 + 15; +pub const SYS_lchown: ::c_long = 4000 + 16; +pub const SYS_break: ::c_long = 4000 + 17; +pub const SYS_lseek: ::c_long = 4000 + 19; +pub const SYS_getpid: ::c_long = 4000 + 20; +pub const SYS_mount: ::c_long = 4000 + 21; +pub const SYS_umount: ::c_long = 4000 + 22; +pub const SYS_setuid: ::c_long = 4000 + 23; +pub const SYS_getuid: ::c_long = 4000 + 24; +pub const SYS_stime: ::c_long = 4000 + 25; +pub const SYS_ptrace: ::c_long = 4000 + 26; +pub const SYS_alarm: ::c_long = 4000 + 27; +pub const SYS_pause: ::c_long = 4000 + 29; +pub const SYS_utime: ::c_long = 4000 + 30; +pub const SYS_stty: ::c_long = 4000 + 31; +pub const SYS_gtty: ::c_long = 4000 + 32; +pub const SYS_access: ::c_long = 4000 + 33; +pub const SYS_nice: ::c_long = 4000 + 34; +pub const SYS_ftime: ::c_long = 4000 + 35; +pub const SYS_sync: ::c_long = 4000 + 36; +pub const SYS_kill: ::c_long = 4000 + 37; +pub const SYS_rename: ::c_long = 4000 + 38; +pub const SYS_mkdir: ::c_long = 4000 + 39; +pub const SYS_rmdir: ::c_long = 4000 + 40; +pub const SYS_dup: ::c_long = 4000 + 41; +pub const SYS_pipe: ::c_long = 4000 + 42; +pub const SYS_times: ::c_long = 4000 + 43; +pub const SYS_prof: ::c_long = 4000 + 44; +pub const SYS_brk: ::c_long = 4000 + 45; +pub const SYS_setgid: ::c_long = 4000 + 46; +pub const SYS_getgid: ::c_long = 4000 + 47; +pub const SYS_signal: ::c_long = 4000 + 48; +pub const SYS_geteuid: ::c_long = 4000 + 49; +pub const SYS_getegid: ::c_long = 4000 + 50; +pub const SYS_acct: ::c_long = 4000 + 51; +pub const SYS_umount2: ::c_long = 4000 + 52; +pub const SYS_lock: ::c_long = 4000 + 53; +pub const SYS_ioctl: ::c_long = 4000 + 54; +pub const SYS_fcntl: ::c_long = 4000 + 55; +pub const SYS_mpx: ::c_long = 4000 + 56; +pub const SYS_setpgid: ::c_long = 4000 + 57; +pub const SYS_ulimit: ::c_long = 4000 + 58; +pub const SYS_umask: ::c_long = 4000 + 60; +pub const SYS_chroot: ::c_long = 4000 + 61; +pub const SYS_ustat: ::c_long = 4000 + 62; +pub const SYS_dup2: ::c_long = 4000 + 63; +pub const SYS_getppid: ::c_long = 4000 + 64; +pub const SYS_getpgrp: ::c_long = 4000 + 65; +pub const SYS_setsid: ::c_long = 4000 + 66; +pub const SYS_sigaction: ::c_long = 4000 + 67; +pub const SYS_sgetmask: ::c_long = 4000 + 68; +pub const SYS_ssetmask: ::c_long = 4000 + 69; +pub const SYS_setreuid: ::c_long = 4000 + 70; +pub const SYS_setregid: ::c_long = 4000 + 71; +pub const SYS_sigsuspend: ::c_long = 4000 + 72; +pub const SYS_sigpending: ::c_long = 4000 + 73; +pub const SYS_sethostname: ::c_long = 4000 + 74; +pub const SYS_setrlimit: ::c_long = 4000 + 75; +pub const SYS_getrlimit: ::c_long = 4000 + 76; +pub const SYS_getrusage: ::c_long = 4000 + 77; +pub const SYS_gettimeofday: ::c_long = 4000 + 78; +pub const SYS_settimeofday: ::c_long = 4000 + 79; +pub const SYS_getgroups: ::c_long = 4000 + 80; +pub const SYS_setgroups: ::c_long = 4000 + 81; +pub const SYS_symlink: ::c_long = 4000 + 83; +pub const SYS_readlink: ::c_long = 4000 + 85; +pub const SYS_uselib: ::c_long = 4000 + 86; +pub const SYS_swapon: ::c_long = 4000 + 87; +pub const SYS_reboot: ::c_long = 4000 + 88; +pub const SYS_readdir: ::c_long = 4000 + 89; +pub const SYS_mmap: ::c_long = 4000 + 90; +pub const SYS_munmap: ::c_long = 4000 + 91; +pub const SYS_truncate: ::c_long = 4000 + 92; +pub const SYS_ftruncate: ::c_long = 4000 + 93; +pub const SYS_fchmod: ::c_long = 4000 + 94; +pub const SYS_fchown: ::c_long = 4000 + 95; +pub const SYS_getpriority: ::c_long = 4000 + 96; +pub const SYS_setpriority: ::c_long = 4000 + 97; +pub const SYS_profil: ::c_long = 4000 + 98; +pub const SYS_statfs: ::c_long = 4000 + 99; +pub const SYS_fstatfs: ::c_long = 4000 + 100; +pub const SYS_ioperm: ::c_long = 4000 + 101; +pub const SYS_socketcall: ::c_long = 4000 + 102; +pub const SYS_syslog: ::c_long = 4000 + 103; +pub const SYS_setitimer: ::c_long = 4000 + 104; +pub const SYS_getitimer: ::c_long = 4000 + 105; +pub const SYS_stat: ::c_long = 4000 + 106; +pub const SYS_lstat: ::c_long = 4000 + 107; +pub const SYS_fstat: ::c_long = 4000 + 108; +pub const SYS_iopl: ::c_long = 4000 + 110; +pub const SYS_vhangup: ::c_long = 4000 + 111; +pub const SYS_idle: ::c_long = 4000 + 112; +pub const SYS_vm86: ::c_long = 4000 + 113; +pub const SYS_wait4: ::c_long = 4000 + 114; +pub const SYS_swapoff: ::c_long = 4000 + 115; +pub const SYS_sysinfo: ::c_long = 4000 + 116; +pub const SYS_ipc: ::c_long = 4000 + 117; +pub const SYS_fsync: ::c_long = 4000 + 118; +pub const SYS_sigreturn: ::c_long = 4000 + 119; +pub const SYS_clone: ::c_long = 4000 + 120; +pub const SYS_setdomainname: ::c_long = 4000 + 121; +pub const SYS_uname: ::c_long = 4000 + 122; +pub const SYS_modify_ldt: ::c_long = 4000 + 123; +pub const SYS_adjtimex: ::c_long = 4000 + 124; +pub const SYS_mprotect: ::c_long = 4000 + 125; +pub const SYS_sigprocmask: ::c_long = 4000 + 126; +pub const SYS_create_module: ::c_long = 4000 + 127; +pub const SYS_init_module: ::c_long = 4000 + 128; +pub const SYS_delete_module: ::c_long = 4000 + 129; +pub const SYS_get_kernel_syms: ::c_long = 4000 + 130; +pub const SYS_quotactl: ::c_long = 4000 + 131; +pub const SYS_getpgid: ::c_long = 4000 + 132; +pub const SYS_fchdir: ::c_long = 4000 + 133; +pub const SYS_bdflush: ::c_long = 4000 + 134; +pub const SYS_sysfs: ::c_long = 4000 + 135; +pub const SYS_personality: ::c_long = 4000 + 136; +pub const SYS_afs_syscall: ::c_long = 4000 + 137; +pub const SYS_setfsuid: ::c_long = 4000 + 138; +pub const SYS_setfsgid: ::c_long = 4000 + 139; +pub const SYS__llseek: ::c_long = 4000 + 140; +pub const SYS_getdents: ::c_long = 4000 + 141; +pub const SYS_flock: ::c_long = 4000 + 143; +pub const SYS_msync: ::c_long = 4000 + 144; +pub const SYS_readv: ::c_long = 4000 + 145; +pub const SYS_writev: ::c_long = 4000 + 146; +pub const SYS_cacheflush: ::c_long = 4000 + 147; +pub const SYS_cachectl: ::c_long = 4000 + 148; +pub const SYS_sysmips: ::c_long = 4000 + 149; +pub const SYS_getsid: ::c_long = 4000 + 151; +pub const SYS_fdatasync: ::c_long = 4000 + 152; +pub const SYS__sysctl: ::c_long = 4000 + 153; +pub const SYS_mlock: ::c_long = 4000 + 154; +pub const SYS_munlock: ::c_long = 4000 + 155; +pub const SYS_mlockall: ::c_long = 4000 + 156; +pub const SYS_munlockall: ::c_long = 4000 + 157; +pub const SYS_sched_setparam: ::c_long = 4000 + 158; +pub const SYS_sched_getparam: ::c_long = 4000 + 159; +pub const SYS_sched_setscheduler: ::c_long = 4000 + 160; +pub const SYS_sched_getscheduler: ::c_long = 4000 + 161; +pub const SYS_sched_yield: ::c_long = 4000 + 162; +pub const SYS_sched_get_priority_max: ::c_long = 4000 + 163; +pub const SYS_sched_get_priority_min: ::c_long = 4000 + 164; +pub const SYS_sched_rr_get_interval: ::c_long = 4000 + 165; +pub const SYS_nanosleep: ::c_long = 4000 + 166; +pub const SYS_mremap: ::c_long = 4000 + 167; +pub const SYS_accept: ::c_long = 4000 + 168; +pub const SYS_bind: ::c_long = 4000 + 169; +pub const SYS_connect: ::c_long = 4000 + 170; +pub const SYS_getpeername: ::c_long = 4000 + 171; +pub const SYS_getsockname: ::c_long = 4000 + 172; +pub const SYS_getsockopt: ::c_long = 4000 + 173; +pub const SYS_listen: ::c_long = 4000 + 174; +pub const SYS_recv: ::c_long = 4000 + 175; +pub const SYS_recvfrom: ::c_long = 4000 + 176; +pub const SYS_recvmsg: ::c_long = 4000 + 177; +pub const SYS_send: ::c_long = 4000 + 178; +pub const SYS_sendmsg: ::c_long = 4000 + 179; +pub const SYS_sendto: ::c_long = 4000 + 180; +pub const SYS_setsockopt: ::c_long = 4000 + 181; +pub const SYS_shutdown: ::c_long = 4000 + 182; +pub const SYS_socket: ::c_long = 4000 + 183; +pub const SYS_socketpair: ::c_long = 4000 + 184; +pub const SYS_setresuid: ::c_long = 4000 + 185; +pub const SYS_getresuid: ::c_long = 4000 + 186; +pub const SYS_query_module: ::c_long = 4000 + 187; +pub const SYS_poll: ::c_long = 4000 + 188; +pub const SYS_nfsservctl: ::c_long = 4000 + 189; +pub const SYS_setresgid: ::c_long = 4000 + 190; +pub const SYS_getresgid: ::c_long = 4000 + 191; +pub const SYS_prctl: ::c_long = 4000 + 192; +pub const SYS_rt_sigreturn: ::c_long = 4000 + 193; +pub const SYS_rt_sigaction: ::c_long = 4000 + 194; +pub const SYS_rt_sigprocmask: ::c_long = 4000 + 195; +pub const SYS_rt_sigpending: ::c_long = 4000 + 196; +pub const SYS_rt_sigtimedwait: ::c_long = 4000 + 197; +pub const SYS_rt_sigqueueinfo: ::c_long = 4000 + 198; +pub const SYS_rt_sigsuspend: ::c_long = 4000 + 199; +pub const SYS_chown: ::c_long = 4000 + 202; +pub const SYS_getcwd: ::c_long = 4000 + 203; +pub const SYS_capget: ::c_long = 4000 + 204; +pub const SYS_capset: ::c_long = 4000 + 205; +pub const SYS_sigaltstack: ::c_long = 4000 + 206; +pub const SYS_sendfile: ::c_long = 4000 + 207; +pub const SYS_getpmsg: ::c_long = 4000 + 208; +pub const SYS_putpmsg: ::c_long = 4000 + 209; +pub const SYS_mmap2: ::c_long = 4000 + 210; +pub const SYS_truncate64: ::c_long = 4000 + 211; +pub const SYS_ftruncate64: ::c_long = 4000 + 212; +pub const SYS_stat64: ::c_long = 4000 + 213; +pub const SYS_lstat64: ::c_long = 4000 + 214; +pub const SYS_fstat64: ::c_long = 4000 + 215; +pub const SYS_pivot_root: ::c_long = 4000 + 216; +pub const SYS_mincore: ::c_long = 4000 + 217; +pub const SYS_madvise: ::c_long = 4000 + 218; +pub const SYS_getdents64: ::c_long = 4000 + 219; +pub const SYS_fcntl64: ::c_long = 4000 + 220; +pub const SYS_gettid: ::c_long = 4000 + 222; +pub const SYS_readahead: ::c_long = 4000 + 223; +pub const SYS_setxattr: ::c_long = 4000 + 224; +pub const SYS_lsetxattr: ::c_long = 4000 + 225; +pub const SYS_fsetxattr: ::c_long = 4000 + 226; +pub const SYS_getxattr: ::c_long = 4000 + 227; +pub const SYS_lgetxattr: ::c_long = 4000 + 228; +pub const SYS_fgetxattr: ::c_long = 4000 + 229; +pub const SYS_listxattr: ::c_long = 4000 + 230; +pub const SYS_llistxattr: ::c_long = 4000 + 231; +pub const SYS_flistxattr: ::c_long = 4000 + 232; +pub const SYS_removexattr: ::c_long = 4000 + 233; +pub const SYS_lremovexattr: ::c_long = 4000 + 234; +pub const SYS_fremovexattr: ::c_long = 4000 + 235; +pub const SYS_tkill: ::c_long = 4000 + 236; +pub const SYS_sendfile64: ::c_long = 4000 + 237; +pub const SYS_futex: ::c_long = 4000 + 238; +pub const SYS_sched_setaffinity: ::c_long = 4000 + 239; +pub const SYS_sched_getaffinity: ::c_long = 4000 + 240; +pub const SYS_io_setup: ::c_long = 4000 + 241; +pub const SYS_io_destroy: ::c_long = 4000 + 242; +pub const SYS_io_getevents: ::c_long = 4000 + 243; +pub const SYS_io_submit: ::c_long = 4000 + 244; +pub const SYS_io_cancel: ::c_long = 4000 + 245; +pub const SYS_exit_group: ::c_long = 4000 + 246; +pub const SYS_lookup_dcookie: ::c_long = 4000 + 247; +pub const SYS_epoll_create: ::c_long = 4000 + 248; +pub const SYS_epoll_ctl: ::c_long = 4000 + 249; +pub const SYS_epoll_wait: ::c_long = 4000 + 250; +pub const SYS_remap_file_pages: ::c_long = 4000 + 251; +pub const SYS_set_tid_address: ::c_long = 4000 + 252; +pub const SYS_restart_syscall: ::c_long = 4000 + 253; +pub const SYS_statfs64: ::c_long = 4000 + 255; +pub const SYS_fstatfs64: ::c_long = 4000 + 256; +pub const SYS_timer_create: ::c_long = 4000 + 257; +pub const SYS_timer_settime: ::c_long = 4000 + 258; +pub const SYS_timer_gettime: ::c_long = 4000 + 259; +pub const SYS_timer_getoverrun: ::c_long = 4000 + 260; +pub const SYS_timer_delete: ::c_long = 4000 + 261; +pub const SYS_clock_settime: ::c_long = 4000 + 262; +pub const SYS_clock_gettime: ::c_long = 4000 + 263; +pub const SYS_clock_getres: ::c_long = 4000 + 264; +pub const SYS_clock_nanosleep: ::c_long = 4000 + 265; +pub const SYS_tgkill: ::c_long = 4000 + 266; +pub const SYS_utimes: ::c_long = 4000 + 267; +pub const SYS_mbind: ::c_long = 4000 + 268; +pub const SYS_get_mempolicy: ::c_long = 4000 + 269; +pub const SYS_set_mempolicy: ::c_long = 4000 + 270; +pub const SYS_mq_open: ::c_long = 4000 + 271; +pub const SYS_mq_unlink: ::c_long = 4000 + 272; +pub const SYS_mq_timedsend: ::c_long = 4000 + 273; +pub const SYS_mq_timedreceive: ::c_long = 4000 + 274; +pub const SYS_mq_notify: ::c_long = 4000 + 275; +pub const SYS_mq_getsetattr: ::c_long = 4000 + 276; +pub const SYS_vserver: ::c_long = 4000 + 277; +pub const SYS_waitid: ::c_long = 4000 + 278; +/* pub const SYS_sys_setaltroot: ::c_long = 4000 + 279; */ +pub const SYS_add_key: ::c_long = 4000 + 280; +pub const SYS_request_key: ::c_long = 4000 + 281; +pub const SYS_keyctl: ::c_long = 4000 + 282; +pub const SYS_set_thread_area: ::c_long = 4000 + 283; +pub const SYS_inotify_init: ::c_long = 4000 + 284; +pub const SYS_inotify_add_watch: ::c_long = 4000 + 285; +pub const SYS_inotify_rm_watch: ::c_long = 4000 + 286; +pub const SYS_migrate_pages: ::c_long = 4000 + 287; +pub const SYS_openat: ::c_long = 4000 + 288; +pub const SYS_mkdirat: ::c_long = 4000 + 289; +pub const SYS_mknodat: ::c_long = 4000 + 290; +pub const SYS_fchownat: ::c_long = 4000 + 291; +pub const SYS_futimesat: ::c_long = 4000 + 292; +pub const SYS_unlinkat: ::c_long = 4000 + 294; +pub const SYS_renameat: ::c_long = 4000 + 295; +pub const SYS_linkat: ::c_long = 4000 + 296; +pub const SYS_symlinkat: ::c_long = 4000 + 297; +pub const SYS_readlinkat: ::c_long = 4000 + 298; +pub const SYS_fchmodat: ::c_long = 4000 + 299; +pub const SYS_faccessat: ::c_long = 4000 + 300; +pub const SYS_pselect6: ::c_long = 4000 + 301; +pub const SYS_ppoll: ::c_long = 4000 + 302; +pub const SYS_unshare: ::c_long = 4000 + 303; +pub const SYS_splice: ::c_long = 4000 + 304; +pub const SYS_sync_file_range: ::c_long = 4000 + 305; +pub const SYS_tee: ::c_long = 4000 + 306; +pub const SYS_vmsplice: ::c_long = 4000 + 307; +pub const SYS_move_pages: ::c_long = 4000 + 308; +pub const SYS_set_robust_list: ::c_long = 4000 + 309; +pub const SYS_get_robust_list: ::c_long = 4000 + 310; +pub const SYS_kexec_load: ::c_long = 4000 + 311; +pub const SYS_getcpu: ::c_long = 4000 + 312; +pub const SYS_epoll_pwait: ::c_long = 4000 + 313; +pub const SYS_ioprio_set: ::c_long = 4000 + 314; +pub const SYS_ioprio_get: ::c_long = 4000 + 315; +pub const SYS_utimensat: ::c_long = 4000 + 316; +pub const SYS_signalfd: ::c_long = 4000 + 317; +pub const SYS_timerfd: ::c_long = 4000 + 318; +pub const SYS_eventfd: ::c_long = 4000 + 319; +pub const SYS_fallocate: ::c_long = 4000 + 320; +pub const SYS_timerfd_create: ::c_long = 4000 + 321; +pub const SYS_timerfd_gettime: ::c_long = 4000 + 322; +pub const SYS_timerfd_settime: ::c_long = 4000 + 323; +pub const SYS_signalfd4: ::c_long = 4000 + 324; +pub const SYS_eventfd2: ::c_long = 4000 + 325; +pub const SYS_epoll_create1: ::c_long = 4000 + 326; +pub const SYS_dup3: ::c_long = 4000 + 327; +pub const SYS_pipe2: ::c_long = 4000 + 328; +pub const SYS_inotify_init1: ::c_long = 4000 + 329; +pub const SYS_preadv: ::c_long = 4000 + 330; +pub const SYS_pwritev: ::c_long = 4000 + 331; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 4000 + 332; +pub const SYS_perf_event_open: ::c_long = 4000 + 333; +pub const SYS_accept4: ::c_long = 4000 + 334; +pub const SYS_recvmmsg: ::c_long = 4000 + 335; +pub const SYS_fanotify_init: ::c_long = 4000 + 336; +pub const SYS_fanotify_mark: ::c_long = 4000 + 337; +pub const SYS_prlimit64: ::c_long = 4000 + 338; +pub const SYS_name_to_handle_at: ::c_long = 4000 + 339; +pub const SYS_open_by_handle_at: ::c_long = 4000 + 340; +pub const SYS_clock_adjtime: ::c_long = 4000 + 341; +pub const SYS_syncfs: ::c_long = 4000 + 342; +pub const SYS_sendmmsg: ::c_long = 4000 + 343; +pub const SYS_setns: ::c_long = 4000 + 344; +pub const SYS_process_vm_readv: ::c_long = 4000 + 345; +pub const SYS_process_vm_writev: ::c_long = 4000 + 346; +pub const SYS_kcmp: ::c_long = 4000 + 347; +pub const SYS_finit_module: ::c_long = 4000 + 348; +pub const SYS_sched_setattr: ::c_long = 4000 + 349; +pub const SYS_sched_getattr: ::c_long = 4000 + 350; +pub const SYS_renameat2: ::c_long = 4000 + 351; +pub const SYS_seccomp: ::c_long = 4000 + 352; +pub const SYS_getrandom: ::c_long = 4000 + 353; +pub const SYS_memfd_create: ::c_long = 4000 + 354; +pub const SYS_bpf: ::c_long = 4000 + 355; +pub const SYS_execveat: ::c_long = 4000 + 356; +pub const SYS_userfaultfd: ::c_long = 4000 + 357; +pub const SYS_membarrier: ::c_long = 4000 + 358; +pub const SYS_mlock2: ::c_long = 4000 + 359; +pub const SYS_copy_file_range: ::c_long = 4000 + 360; +pub const SYS_preadv2: ::c_long = 4000 + 361; +pub const SYS_pwritev2: ::c_long = 4000 + 362; diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/b32/mod.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/b32/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/b32/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/b32/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,62 @@ +pub type c_long = i32; +pub type c_ulong = u32; +pub type nlink_t = u32; +pub type blksize_t = ::c_long; +pub type __u64 = ::c_ulonglong; + +s! { + pub struct pthread_attr_t { + __size: [u32; 9] + } + + pub struct sigset_t { + __val: [::c_ulong; 32], + } + + pub struct msghdr { + pub msg_name: *mut ::c_void, + pub msg_namelen: ::socklen_t, + pub msg_iov: *mut ::iovec, + pub msg_iovlen: ::c_int, + pub msg_control: *mut ::c_void, + pub msg_controllen: ::socklen_t, + pub msg_flags: ::c_int, + } + + pub struct cmsghdr { + pub cmsg_len: ::socklen_t, + pub cmsg_level: ::c_int, + pub cmsg_type: ::c_int, + } + + pub struct sem_t { + __val: [::c_int; 4], + } +} + +pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32; +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; + +pub const TIOCINQ: ::c_int = ::FIONREAD; + +extern { + pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; +} + +cfg_if! { + if #[cfg(any(target_arch = "x86"))] { + mod x86; + pub use self::x86::*; + } else if #[cfg(any(target_arch = "mips"))] { + mod mips; + pub use self::mips::*; + } else if #[cfg(any(target_arch = "arm"))] { + mod arm; + pub use self::arm::*; + } else if #[cfg(any(target_arch = "powerpc"))] { + mod powerpc; + pub use self::powerpc::*; + } else { + // Unknown target_arch + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/b32/powerpc.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/b32/powerpc.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/b32/powerpc.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/b32/powerpc.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,863 @@ +pub type c_char = u8; +pub type wchar_t = i32; + +s! { + pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __st_rdev_padding: ::c_short, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused: [::c_long; 2], + } + + pub struct stat64 { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __st_rdev_padding: ::c_short, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused: [::c_long; 2], + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_flags: ::c_int, + pub ss_size: ::size_t + } + + pub struct ipc_perm { + pub __ipc_perm_key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::mode_t, + pub __seq: ::c_int, + __pad1: ::c_int, + __pad2: ::c_longlong, + __pad3: ::c_longlong + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + __unused1: ::c_int, + pub shm_atime: ::time_t, + __unused2: ::c_int, + pub shm_dtime: ::time_t, + __unused3: ::c_int, + pub shm_ctime: ::time_t, + __unused4: ::c_int, + pub shm_segsz: ::size_t, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, + pub shm_nattch: ::c_ulong, + __pad1: ::c_ulong, + __pad2: ::c_ulong, + } + + pub struct msqid_ds { + pub msg_perm: ::ipc_perm, + __unused1: ::c_int, + pub msg_stime: ::time_t, + __unused2: ::c_int, + pub msg_rtime: ::time_t, + __unused3: ::c_int, + pub msg_ctime: ::time_t, + __msg_cbytes: ::c_ulong, + pub msg_qnum: ::msgqnum_t, + pub msg_qbytes: ::msglen_t, + pub msg_lspid: ::pid_t, + pub msg_lrpid: ::pid_t, + __pad1: ::c_ulong, + __pad2: ::c_ulong, + } + + pub struct statfs { + pub f_type: ::c_ulong, + pub f_bsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_flags: ::c_ulong, + pub f_spare: [::c_ulong; 4], + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + pub _pad: [::c_int; 29], + _align: [usize; 0], + } + + pub struct statfs64 { + pub f_type: ::c_ulong, + pub f_bsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_flags: ::c_ulong, + pub f_spare: [::c_ulong; 4], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: u64, + #[cfg(target_endian = "little")] + pub f_fsid: ::c_ulong, + __f_unused: ::c_int, + #[cfg(target_endian = "big")] + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } +} + +pub const MADV_SOFT_OFFLINE: ::c_int = 101; +pub const SIGSTKSZ: ::size_t = 10240; +pub const MINSIGSTKSZ: ::size_t = 4096; + +pub const O_DIRECT: ::c_int = 0x20000; +pub const O_DIRECTORY: ::c_int = 0x4000; +pub const O_NOFOLLOW: ::c_int = 0x8000; +pub const O_ASYNC: ::c_int = 0x2000; +pub const O_LARGEFILE: ::c_int = 0x10000; + +pub const FIOCLEX: ::c_int = 0x20006601; +pub const FIONCLEX: ::c_int = 0x20006602; +pub const FIONBIO: ::c_int = 0x8004667E; + +pub const RLIMIT_RSS: ::c_int = 5; +pub const RLIMIT_NOFILE: ::c_int = 7; +pub const RLIMIT_AS: ::c_int = 9; +pub const RLIMIT_NPROC: ::c_int = 6; +pub const RLIMIT_MEMLOCK: ::c_int = 8; +pub const RLIMIT_NLIMITS: ::c_int = 15; + +pub const MCL_CURRENT: ::c_int = 0x2000; +pub const MCL_FUTURE: ::c_int = 0x4000; +pub const CBAUD: ::tcflag_t = 0o0000377; +pub const TAB1: ::c_int = 0x00000400; +pub const TAB2: ::c_int = 0x00000800; +pub const TAB3: ::c_int = 0x00000C00; +pub const CR1: ::c_int = 0x00001000; +pub const CR2: ::c_int = 0x00002000; +pub const CR3: ::c_int = 0x00003000; +pub const FF1: ::c_int = 0x00004000; +pub const BS1: ::c_int = 0x00008000; +pub const VT1: ::c_int = 0x00010000; +pub const VWERASE: usize = 10; +pub const VREPRINT: usize = 11; +pub const VSUSP: usize = 12; +pub const VSTART: usize = 13; +pub const VSTOP: usize = 14; +pub const VDISCARD: usize = 16; +pub const VTIME: usize = 7; +pub const IXON: ::tcflag_t = 0x00000200; +pub const IXOFF: ::tcflag_t = 0x00000400; +pub const ONLCR: ::tcflag_t = 0x00000002; +pub const CSIZE: ::tcflag_t = 0x00000300; +pub const CS6: ::tcflag_t = 0x00000100; +pub const CS7: ::tcflag_t = 0x00000200; +pub const CS8: ::tcflag_t = 0x00000300; +pub const CSTOPB: ::tcflag_t = 0x00000400; +pub const CREAD: ::tcflag_t = 0x00000800; +pub const PARENB: ::tcflag_t = 0x00001000; +pub const PARODD: ::tcflag_t = 0x00002000; +pub const HUPCL: ::tcflag_t = 0x00004000; +pub const CLOCAL: ::tcflag_t = 0x00008000; +pub const ECHOKE: ::tcflag_t = 0x00000001; +pub const ECHOE: ::tcflag_t = 0x00000002; +pub const ECHOK: ::tcflag_t = 0x00000004; +pub const ECHONL: ::tcflag_t = 0x00000010; +pub const ECHOPRT: ::tcflag_t = 0x00000020; +pub const ECHOCTL: ::tcflag_t = 0x00000040; +pub const ISIG: ::tcflag_t = 0x00000080; +pub const ICANON: ::tcflag_t = 0x00000100; +pub const PENDIN: ::tcflag_t = 0x20000000; +pub const NOFLSH: ::tcflag_t = 0x80000000; +pub const CIBAUD: ::tcflag_t = 0o00077600000; +pub const CBAUDEX: ::tcflag_t = 0o000020; +pub const VSWTC: usize = 9; +pub const OLCUC: ::tcflag_t = 0o000004; +pub const NLDLY: ::tcflag_t = 0o001400; +pub const CRDLY: ::tcflag_t = 0o030000; +pub const TABDLY: ::tcflag_t = 0o006000; +pub const BSDLY: ::tcflag_t = 0o100000; +pub const FFDLY: ::tcflag_t = 0o040000; +pub const VTDLY: ::tcflag_t = 0o200000; +pub const XTABS: ::tcflag_t = 0o006000; +pub const B57600: ::speed_t = 0o000020; +pub const B115200: ::speed_t = 0o000021; +pub const B230400: ::speed_t = 0o000022; +pub const B460800: ::speed_t = 0o000023; +pub const B500000: ::speed_t = 0o000024; +pub const B576000: ::speed_t = 0o000025; +pub const B921600: ::speed_t = 0o000026; +pub const B1000000: ::speed_t = 0o000027; +pub const B1152000: ::speed_t = 0o000030; +pub const B1500000: ::speed_t = 0o000031; +pub const B2000000: ::speed_t = 0o000032; +pub const B2500000: ::speed_t = 0o000033; +pub const B3000000: ::speed_t = 0o000034; +pub const B3500000: ::speed_t = 0o000035; +pub const B4000000: ::speed_t = 0o000036; + +pub const O_APPEND: ::c_int = 1024; +pub const O_CREAT: ::c_int = 64; +pub const O_EXCL: ::c_int = 128; +pub const O_NOCTTY: ::c_int = 256; +pub const O_NONBLOCK: ::c_int = 2048; +pub const O_SYNC: ::c_int = 1052672; +pub const O_RSYNC: ::c_int = 1052672; +pub const O_DSYNC: ::c_int = 4096; + +pub const SOCK_NONBLOCK: ::c_int = 2048; + +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_GROWSDOWN: ::c_int = 0x0100; +pub const MAP_DENYWRITE: ::c_int = 0x0800; +pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_LOCKED: ::c_int = 0x00080; +pub const MAP_NORESERVE: ::c_int = 0x00040; +pub const MAP_POPULATE: ::c_int = 0x08000; +pub const MAP_NONBLOCK: ::c_int = 0x010000; +pub const MAP_STACK: ::c_int = 0x020000; + +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; +pub const SOCK_SEQPACKET: ::c_int = 5; + +pub const SOL_SOCKET: ::c_int = 1; + +pub const EDEADLK: ::c_int = 35; +pub const ENAMETOOLONG: ::c_int = 36; +pub const ENOLCK: ::c_int = 37; +pub const ENOSYS: ::c_int = 38; +pub const ENOTEMPTY: ::c_int = 39; +pub const ELOOP: ::c_int = 40; +pub const ENOMSG: ::c_int = 42; +pub const EIDRM: ::c_int = 43; +pub const ECHRNG: ::c_int = 44; +pub const EL2NSYNC: ::c_int = 45; +pub const EL3HLT: ::c_int = 46; +pub const EL3RST: ::c_int = 47; +pub const ELNRNG: ::c_int = 48; +pub const EUNATCH: ::c_int = 49; +pub const ENOCSI: ::c_int = 50; +pub const EL2HLT: ::c_int = 51; +pub const EBADE: ::c_int = 52; +pub const EBADR: ::c_int = 53; +pub const EXFULL: ::c_int = 54; +pub const ENOANO: ::c_int = 55; +pub const EBADRQC: ::c_int = 56; +pub const EBADSLT: ::c_int = 57; +pub const EDEADLOCK: ::c_int = 58; +pub const EMULTIHOP: ::c_int = 72; +pub const EBADMSG: ::c_int = 74; +pub const EOVERFLOW: ::c_int = 75; +pub const ENOTUNIQ: ::c_int = 76; +pub const EBADFD: ::c_int = 77; +pub const EREMCHG: ::c_int = 78; +pub const ELIBACC: ::c_int = 79; +pub const ELIBBAD: ::c_int = 80; +pub const ELIBSCN: ::c_int = 81; +pub const ELIBMAX: ::c_int = 82; +pub const ELIBEXEC: ::c_int = 83; +pub const EILSEQ: ::c_int = 84; +pub const ERESTART: ::c_int = 85; +pub const ESTRPIPE: ::c_int = 86; +pub const EUSERS: ::c_int = 87; +pub const ENOTSOCK: ::c_int = 88; +pub const EDESTADDRREQ: ::c_int = 89; +pub const EMSGSIZE: ::c_int = 90; +pub const EPROTOTYPE: ::c_int = 91; +pub const ENOPROTOOPT: ::c_int = 92; +pub const EPROTONOSUPPORT: ::c_int = 93; +pub const ESOCKTNOSUPPORT: ::c_int = 94; +pub const EOPNOTSUPP: ::c_int = 95; +pub const ENOTSUP: ::c_int = EOPNOTSUPP; +pub const EPFNOSUPPORT: ::c_int = 96; +pub const EAFNOSUPPORT: ::c_int = 97; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const ENETDOWN: ::c_int = 100; +pub const ENETUNREACH: ::c_int = 101; +pub const ENETRESET: ::c_int = 102; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNRESET: ::c_int = 104; +pub const ENOBUFS: ::c_int = 105; +pub const EISCONN: ::c_int = 106; +pub const ENOTCONN: ::c_int = 107; +pub const ESHUTDOWN: ::c_int = 108; +pub const ETOOMANYREFS: ::c_int = 109; +pub const ETIMEDOUT: ::c_int = 110; +pub const ECONNREFUSED: ::c_int = 111; +pub const EHOSTDOWN: ::c_int = 112; +pub const EHOSTUNREACH: ::c_int = 113; +pub const EALREADY: ::c_int = 114; +pub const EINPROGRESS: ::c_int = 115; +pub const ESTALE: ::c_int = 116; +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; +pub const EDQUOT: ::c_int = 122; +pub const ENOMEDIUM: ::c_int = 123; +pub const EMEDIUMTYPE: ::c_int = 124; +pub const ECANCELED: ::c_int = 125; +pub const ENOKEY: ::c_int = 126; +pub const EKEYEXPIRED: ::c_int = 127; +pub const EKEYREVOKED: ::c_int = 128; +pub const EKEYREJECTED: ::c_int = 129; +pub const EOWNERDEAD: ::c_int = 130; +pub const ENOTRECOVERABLE: ::c_int = 131; +pub const ERFKILL: ::c_int = 132; +pub const EHWPOISON: ::c_int = 133; + +pub const SO_REUSEADDR: ::c_int = 2; +pub const SO_TYPE: ::c_int = 3; +pub const SO_ERROR: ::c_int = 4; +pub const SO_DONTROUTE: ::c_int = 5; +pub const SO_BROADCAST: ::c_int = 6; +pub const SO_SNDBUF: ::c_int = 7; +pub const SO_RCVBUF: ::c_int = 8; +pub const SO_KEEPALIVE: ::c_int = 9; +pub const SO_OOBINLINE: ::c_int = 10; +pub const SO_NO_CHECK: ::c_int = 11; +pub const SO_PRIORITY: ::c_int = 12; +pub const SO_LINGER: ::c_int = 13; +pub const SO_BSDCOMPAT: ::c_int = 14; +pub const SO_REUSEPORT: ::c_int = 15; +pub const SO_RCVLOWAT: ::c_int = 16; +pub const SO_SNDLOWAT: ::c_int = 17; +pub const SO_RCVTIMEO: ::c_int = 18; +pub const SO_SNDTIMEO: ::c_int = 19; +pub const SO_PASSCRED: ::c_int = 20; +pub const SO_PEERCRED: ::c_int = 21; +pub const SO_ACCEPTCONN: ::c_int = 30; +pub const SO_SNDBUFFORCE: ::c_int = 32; +pub const SO_RCVBUFFORCE: ::c_int = 33; +pub const SO_PROTOCOL: ::c_int = 38; +pub const SO_DOMAIN: ::c_int = 39; + +pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_SIGINFO: ::c_int = 0x00000004; +pub const SA_NOCLDWAIT: ::c_int = 0x00000002; + +pub const SIGCHLD: ::c_int = 17; +pub const SIGBUS: ::c_int = 7; +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; +pub const SIGUSR1: ::c_int = 10; +pub const SIGUSR2: ::c_int = 12; +pub const SIGCONT: ::c_int = 18; +pub const SIGSTOP: ::c_int = 19; +pub const SIGTSTP: ::c_int = 20; +pub const SIGURG: ::c_int = 23; +pub const SIGIO: ::c_int = 29; +pub const SIGSYS: ::c_int = 31; +pub const SIGSTKFLT: ::c_int = 16; +pub const SIGPOLL: ::c_int = 29; +pub const SIGPWR: ::c_int = 30; +pub const SIG_SETMASK: ::c_int = 2; +pub const SIG_BLOCK: ::c_int = 0x000000; +pub const SIG_UNBLOCK: ::c_int = 0x01; + +pub const EXTPROC: ::tcflag_t = 0x10000000; + +pub const MAP_HUGETLB: ::c_int = 0x040000; + +pub const F_GETLK: ::c_int = 12; +pub const F_GETOWN: ::c_int = 9; +pub const F_SETLK: ::c_int = 13; +pub const F_SETLKW: ::c_int = 14; +pub const F_SETOWN: ::c_int = 8; + +pub const VEOF: usize = 4; +pub const VEOL: usize = 6; +pub const VEOL2: usize = 8; +pub const VMIN: usize = 5; +pub const IEXTEN: ::tcflag_t = 0x00000400; +pub const TOSTOP: ::tcflag_t = 0x00400000; +pub const FLUSHO: ::tcflag_t = 0x00800000; + +pub const TCGETS: ::c_int = 0x402C7413; +pub const TCSETS: ::c_int = 0x802C7414; +pub const TCSETSW: ::c_int = 0x802C7415; +pub const TCSETSF: ::c_int = 0x802C7416; +pub const TCGETA: ::c_int = 0x40147417; +pub const TCSETA: ::c_int = 0x80147418; +pub const TCSETAW: ::c_int = 0x80147419; +pub const TCSETAF: ::c_int = 0x8014741C; +pub const TCSBRK: ::c_int = 0x2000741D; +pub const TCXONC: ::c_int = 0x2000741E; +pub const TCFLSH: ::c_int = 0x2000741F; +pub const TIOCGSOFTCAR: ::c_int = 0x5419; +pub const TIOCSSOFTCAR: ::c_int = 0x541A; +pub const TIOCLINUX: ::c_int = 0x541C; +pub const TIOCGSERIAL: ::c_int = 0x541E; +pub const TIOCEXCL: ::c_int = 0x540C; +pub const TIOCNXCL: ::c_int = 0x540D; +pub const TIOCSCTTY: ::c_int = 0x540E; +pub const TIOCGPGRP: ::c_int = 0x40047477; +pub const TIOCSPGRP: ::c_int = 0x80047476; +pub const TIOCOUTQ: ::c_int = 0x40047473; +pub const TIOCSTI: ::c_int = 0x5412; +pub const TIOCGWINSZ: ::c_int = 0x40087468; +pub const TIOCSWINSZ: ::c_int = 0x80087467; +pub const TIOCMGET: ::c_int = 0x5415; +pub const TIOCMBIS: ::c_int = 0x5416; +pub const TIOCMBIC: ::c_int = 0x5417; +pub const TIOCMSET: ::c_int = 0x5418; +pub const FIONREAD: ::c_int = 0x4004667F; +pub const TIOCCONS: ::c_int = 0x541D; + +pub const TIOCGRS485: ::c_int = 0x542e; +pub const TIOCSRS485: ::c_int = 0x542f; + +pub const POLLWRNORM: ::c_short = 0x100; +pub const POLLWRBAND: ::c_short = 0x200; + +pub const TIOCM_LE: ::c_int = 0x001; +pub const TIOCM_DTR: ::c_int = 0x002; +pub const TIOCM_RTS: ::c_int = 0x004; +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; +pub const TIOCM_CD: ::c_int = TIOCM_CAR; +pub const TIOCM_RI: ::c_int = TIOCM_RNG; + +// Syscall table +pub const SYS_restart_syscall: ::c_long = 0; +pub const SYS_exit: ::c_long = 1; +pub const SYS_fork: ::c_long = 2; +pub const SYS_read: ::c_long = 3; +pub const SYS_write: ::c_long = 4; +pub const SYS_open: ::c_long = 5; +pub const SYS_close: ::c_long = 6; +pub const SYS_waitpid: ::c_long = 7; +pub const SYS_creat: ::c_long = 8; +pub const SYS_link: ::c_long = 9; +pub const SYS_unlink: ::c_long = 10; +pub const SYS_execve: ::c_long = 11; +pub const SYS_chdir: ::c_long = 12; +pub const SYS_time: ::c_long = 13; +pub const SYS_mknod: ::c_long = 14; +pub const SYS_chmod: ::c_long = 15; +pub const SYS_lchown: ::c_long = 16; +pub const SYS_break: ::c_long = 17; +pub const SYS_oldstat: ::c_long = 18; +pub const SYS_lseek: ::c_long = 19; +pub const SYS_getpid: ::c_long = 20; +pub const SYS_mount: ::c_long = 21; +pub const SYS_umount: ::c_long = 22; +pub const SYS_setuid: ::c_long = 23; +pub const SYS_getuid: ::c_long = 24; +pub const SYS_stime: ::c_long = 25; +pub const SYS_ptrace: ::c_long = 26; +pub const SYS_alarm: ::c_long = 27; +pub const SYS_oldfstat: ::c_long = 28; +pub const SYS_pause: ::c_long = 29; +pub const SYS_utime: ::c_long = 30; +pub const SYS_stty: ::c_long = 31; +pub const SYS_gtty: ::c_long = 32; +pub const SYS_access: ::c_long = 33; +pub const SYS_nice: ::c_long = 34; +pub const SYS_ftime: ::c_long = 35; +pub const SYS_sync: ::c_long = 36; +pub const SYS_kill: ::c_long = 37; +pub const SYS_rename: ::c_long = 38; +pub const SYS_mkdir: ::c_long = 39; +pub const SYS_rmdir: ::c_long = 40; +pub const SYS_dup: ::c_long = 41; +pub const SYS_pipe: ::c_long = 42; +pub const SYS_times: ::c_long = 43; +pub const SYS_prof: ::c_long = 44; +pub const SYS_brk: ::c_long = 45; +pub const SYS_setgid: ::c_long = 46; +pub const SYS_getgid: ::c_long = 47; +pub const SYS_signal: ::c_long = 48; +pub const SYS_geteuid: ::c_long = 49; +pub const SYS_getegid: ::c_long = 50; +pub const SYS_acct: ::c_long = 51; +pub const SYS_umount2: ::c_long = 52; +pub const SYS_lock: ::c_long = 53; +pub const SYS_ioctl: ::c_long = 54; +pub const SYS_fcntl: ::c_long = 55; +pub const SYS_mpx: ::c_long = 56; +pub const SYS_setpgid: ::c_long = 57; +pub const SYS_ulimit: ::c_long = 58; +pub const SYS_oldolduname: ::c_long = 59; +pub const SYS_umask: ::c_long = 60; +pub const SYS_chroot: ::c_long = 61; +pub const SYS_ustat: ::c_long = 62; +pub const SYS_dup2: ::c_long = 63; +pub const SYS_getppid: ::c_long = 64; +pub const SYS_getpgrp: ::c_long = 65; +pub const SYS_setsid: ::c_long = 66; +pub const SYS_sigaction: ::c_long = 67; +pub const SYS_sgetmask: ::c_long = 68; +pub const SYS_ssetmask: ::c_long = 69; +pub const SYS_setreuid: ::c_long = 70; +pub const SYS_setregid: ::c_long = 71; +pub const SYS_sigsuspend: ::c_long = 72; +pub const SYS_sigpending: ::c_long = 73; +pub const SYS_sethostname: ::c_long = 74; +pub const SYS_setrlimit: ::c_long = 75; +pub const SYS_getrlimit: ::c_long = 76; +pub const SYS_getrusage: ::c_long = 77; +pub const SYS_gettimeofday: ::c_long = 78; +pub const SYS_settimeofday: ::c_long = 79; +pub const SYS_getgroups: ::c_long = 80; +pub const SYS_setgroups: ::c_long = 81; +pub const SYS_select: ::c_long = 82; +pub const SYS_symlink: ::c_long = 83; +pub const SYS_oldlstat: ::c_long = 84; +pub const SYS_readlink: ::c_long = 85; +pub const SYS_uselib: ::c_long = 86; +pub const SYS_swapon: ::c_long = 87; +pub const SYS_reboot: ::c_long = 88; +pub const SYS_readdir: ::c_long = 89; +pub const SYS_mmap: ::c_long = 90; +pub const SYS_munmap: ::c_long = 91; +pub const SYS_truncate: ::c_long = 92; +pub const SYS_ftruncate: ::c_long = 93; +pub const SYS_fchmod: ::c_long = 94; +pub const SYS_fchown: ::c_long = 95; +pub const SYS_getpriority: ::c_long = 96; +pub const SYS_setpriority: ::c_long = 97; +pub const SYS_profil: ::c_long = 98; +pub const SYS_statfs: ::c_long = 99; +pub const SYS_fstatfs: ::c_long = 100; +pub const SYS_ioperm: ::c_long = 101; +pub const SYS_socketcall: ::c_long = 102; +pub const SYS_syslog: ::c_long = 103; +pub const SYS_setitimer: ::c_long = 104; +pub const SYS_getitimer: ::c_long = 105; +pub const SYS_stat: ::c_long = 106; +pub const SYS_lstat: ::c_long = 107; +pub const SYS_fstat: ::c_long = 108; +pub const SYS_olduname: ::c_long = 109; +pub const SYS_iopl: ::c_long = 110; +pub const SYS_vhangup: ::c_long = 111; +pub const SYS_idle: ::c_long = 112; +pub const SYS_vm86: ::c_long = 113; +pub const SYS_wait4: ::c_long = 114; +pub const SYS_swapoff: ::c_long = 115; +pub const SYS_sysinfo: ::c_long = 116; +pub const SYS_ipc: ::c_long = 117; +pub const SYS_fsync: ::c_long = 118; +pub const SYS_sigreturn: ::c_long = 119; +pub const SYS_clone: ::c_long = 120; +pub const SYS_setdomainname: ::c_long = 121; +pub const SYS_uname: ::c_long = 122; +pub const SYS_modify_ldt: ::c_long = 123; +pub const SYS_adjtimex: ::c_long = 124; +pub const SYS_mprotect: ::c_long = 125; +pub const SYS_sigprocmask: ::c_long = 126; +pub const SYS_create_module: ::c_long = 127; +pub const SYS_init_module: ::c_long = 128; +pub const SYS_delete_module: ::c_long = 129; +pub const SYS_get_kernel_syms: ::c_long = 130; +pub const SYS_quotactl: ::c_long = 131; +pub const SYS_getpgid: ::c_long = 132; +pub const SYS_fchdir: ::c_long = 133; +pub const SYS_bdflush: ::c_long = 134; +pub const SYS_sysfs: ::c_long = 135; +pub const SYS_personality: ::c_long = 136; +pub const SYS_afs_syscall: ::c_long = 137; +pub const SYS_setfsuid: ::c_long = 138; +pub const SYS_setfsgid: ::c_long = 139; +pub const SYS__llseek: ::c_long = 140; +pub const SYS_getdents: ::c_long = 141; +pub const SYS__newselect: ::c_long = 142; +pub const SYS_flock: ::c_long = 143; +pub const SYS_msync: ::c_long = 144; +pub const SYS_readv: ::c_long = 145; +pub const SYS_writev: ::c_long = 146; +pub const SYS_getsid: ::c_long = 147; +pub const SYS_fdatasync: ::c_long = 148; +pub const SYS__sysctl: ::c_long = 149; +pub const SYS_mlock: ::c_long = 150; +pub const SYS_munlock: ::c_long = 151; +pub const SYS_mlockall: ::c_long = 152; +pub const SYS_munlockall: ::c_long = 153; +pub const SYS_sched_setparam: ::c_long = 154; +pub const SYS_sched_getparam: ::c_long = 155; +pub const SYS_sched_setscheduler: ::c_long = 156; +pub const SYS_sched_getscheduler: ::c_long = 157; +pub const SYS_sched_yield: ::c_long = 158; +pub const SYS_sched_get_priority_max: ::c_long = 159; +pub const SYS_sched_get_priority_min: ::c_long = 160; +pub const SYS_sched_rr_get_interval: ::c_long = 161; +pub const SYS_nanosleep: ::c_long = 162; +pub const SYS_mremap: ::c_long = 163; +pub const SYS_setresuid: ::c_long = 164; +pub const SYS_getresuid: ::c_long = 165; +pub const SYS_query_module: ::c_long = 166; +pub const SYS_poll: ::c_long = 167; +pub const SYS_nfsservctl: ::c_long = 168; +pub const SYS_setresgid: ::c_long = 169; +pub const SYS_getresgid: ::c_long = 170; +pub const SYS_prctl: ::c_long = 171; +pub const SYS_rt_sigreturn: ::c_long = 172; +pub const SYS_rt_sigaction: ::c_long = 173; +pub const SYS_rt_sigprocmask: ::c_long = 174; +pub const SYS_rt_sigpending: ::c_long = 175; +pub const SYS_rt_sigtimedwait: ::c_long = 176; +pub const SYS_rt_sigqueueinfo: ::c_long = 177; +pub const SYS_rt_sigsuspend: ::c_long = 178; +pub const SYS_pread64: ::c_long = 179; +pub const SYS_pwrite64: ::c_long = 180; +pub const SYS_chown: ::c_long = 181; +pub const SYS_getcwd: ::c_long = 182; +pub const SYS_capget: ::c_long = 183; +pub const SYS_capset: ::c_long = 184; +pub const SYS_sigaltstack: ::c_long = 185; +pub const SYS_sendfile: ::c_long = 186; +pub const SYS_getpmsg: ::c_long = 187; +pub const SYS_putpmsg: ::c_long = 188; +pub const SYS_vfork: ::c_long = 189; +pub const SYS_ugetrlimit: ::c_long = 190; +pub const SYS_readahead: ::c_long = 191; +pub const SYS_mmap2: ::c_long = 192; +pub const SYS_truncate64: ::c_long = 193; +pub const SYS_ftruncate64: ::c_long = 194; +pub const SYS_stat64: ::c_long = 195; +pub const SYS_lstat64: ::c_long = 196; +pub const SYS_fstat64: ::c_long = 197; +pub const SYS_pciconfig_read: ::c_long = 198; +pub const SYS_pciconfig_write: ::c_long = 199; +pub const SYS_pciconfig_iobase: ::c_long = 200; +pub const SYS_multiplexer: ::c_long = 201; +pub const SYS_getdents64: ::c_long = 202; +pub const SYS_pivot_root: ::c_long = 203; +pub const SYS_fcntl64: ::c_long = 204; +pub const SYS_madvise: ::c_long = 205; +pub const SYS_mincore: ::c_long = 206; +pub const SYS_gettid: ::c_long = 207; +pub const SYS_tkill: ::c_long = 208; +pub const SYS_setxattr: ::c_long = 209; +pub const SYS_lsetxattr: ::c_long = 210; +pub const SYS_fsetxattr: ::c_long = 211; +pub const SYS_getxattr: ::c_long = 212; +pub const SYS_lgetxattr: ::c_long = 213; +pub const SYS_fgetxattr: ::c_long = 214; +pub const SYS_listxattr: ::c_long = 215; +pub const SYS_llistxattr: ::c_long = 216; +pub const SYS_flistxattr: ::c_long = 217; +pub const SYS_removexattr: ::c_long = 218; +pub const SYS_lremovexattr: ::c_long = 219; +pub const SYS_fremovexattr: ::c_long = 220; +pub const SYS_futex: ::c_long = 221; +pub const SYS_sched_setaffinity: ::c_long = 222; +pub const SYS_sched_getaffinity: ::c_long = 223; +pub const SYS_tuxcall: ::c_long = 225; +pub const SYS_sendfile64: ::c_long = 226; +pub const SYS_io_setup: ::c_long = 227; +pub const SYS_io_destroy: ::c_long = 228; +pub const SYS_io_getevents: ::c_long = 229; +pub const SYS_io_submit: ::c_long = 230; +pub const SYS_io_cancel: ::c_long = 231; +pub const SYS_set_tid_address: ::c_long = 232; +pub const SYS_fadvise64: ::c_long = 233; +pub const SYS_exit_group: ::c_long = 234; +pub const SYS_lookup_dcookie: ::c_long = 235; +pub const SYS_epoll_create: ::c_long = 236; +pub const SYS_epoll_ctl: ::c_long = 237; +pub const SYS_epoll_wait: ::c_long = 238; +pub const SYS_remap_file_pages: ::c_long = 239; +pub const SYS_timer_create: ::c_long = 240; +pub const SYS_timer_settime: ::c_long = 241; +pub const SYS_timer_gettime: ::c_long = 242; +pub const SYS_timer_getoverrun: ::c_long = 243; +pub const SYS_timer_delete: ::c_long = 244; +pub const SYS_clock_settime: ::c_long = 245; +pub const SYS_clock_gettime: ::c_long = 246; +pub const SYS_clock_getres: ::c_long = 247; +pub const SYS_clock_nanosleep: ::c_long = 248; +pub const SYS_swapcontext: ::c_long = 249; +pub const SYS_tgkill: ::c_long = 250; +pub const SYS_utimes: ::c_long = 251; +pub const SYS_statfs64: ::c_long = 252; +pub const SYS_fstatfs64: ::c_long = 253; +pub const SYS_fadvise64_64: ::c_long = 254; +pub const SYS_rtas: ::c_long = 255; +pub const SYS_sys_debug_setcontext: ::c_long = 256; +pub const SYS_migrate_pages: ::c_long = 258; +pub const SYS_mbind: ::c_long = 259; +pub const SYS_get_mempolicy: ::c_long = 260; +pub const SYS_set_mempolicy: ::c_long = 261; +pub const SYS_mq_open: ::c_long = 262; +pub const SYS_mq_unlink: ::c_long = 263; +pub const SYS_mq_timedsend: ::c_long = 264; +pub const SYS_mq_timedreceive: ::c_long = 265; +pub const SYS_mq_notify: ::c_long = 266; +pub const SYS_mq_getsetattr: ::c_long = 267; +pub const SYS_kexec_load: ::c_long = 268; +pub const SYS_add_key: ::c_long = 269; +pub const SYS_request_key: ::c_long = 270; +pub const SYS_keyctl: ::c_long = 271; +pub const SYS_waitid: ::c_long = 272; +pub const SYS_ioprio_set: ::c_long = 273; +pub const SYS_ioprio_get: ::c_long = 274; +pub const SYS_inotify_init: ::c_long = 275; +pub const SYS_inotify_add_watch: ::c_long = 276; +pub const SYS_inotify_rm_watch: ::c_long = 277; +pub const SYS_spu_run: ::c_long = 278; +pub const SYS_spu_create: ::c_long = 279; +pub const SYS_pselect6: ::c_long = 280; +pub const SYS_ppoll: ::c_long = 281; +pub const SYS_unshare: ::c_long = 282; +pub const SYS_splice: ::c_long = 283; +pub const SYS_tee: ::c_long = 284; +pub const SYS_vmsplice: ::c_long = 285; +pub const SYS_openat: ::c_long = 286; +pub const SYS_mkdirat: ::c_long = 287; +pub const SYS_mknodat: ::c_long = 288; +pub const SYS_fchownat: ::c_long = 289; +pub const SYS_futimesat: ::c_long = 290; +pub const SYS_fstatat64: ::c_long = 291; +pub const SYS_unlinkat: ::c_long = 292; +pub const SYS_renameat: ::c_long = 293; +pub const SYS_linkat: ::c_long = 294; +pub const SYS_symlinkat: ::c_long = 295; +pub const SYS_readlinkat: ::c_long = 296; +pub const SYS_fchmodat: ::c_long = 297; +pub const SYS_faccessat: ::c_long = 298; +pub const SYS_get_robust_list: ::c_long = 299; +pub const SYS_set_robust_list: ::c_long = 300; +pub const SYS_move_pages: ::c_long = 301; +pub const SYS_getcpu: ::c_long = 302; +pub const SYS_epoll_pwait: ::c_long = 303; +pub const SYS_utimensat: ::c_long = 304; +pub const SYS_signalfd: ::c_long = 305; +pub const SYS_timerfd_create: ::c_long = 306; +pub const SYS_eventfd: ::c_long = 307; +pub const SYS_sync_file_range2: ::c_long = 308; +pub const SYS_fallocate: ::c_long = 309; +pub const SYS_subpage_prot: ::c_long = 310; +pub const SYS_timerfd_settime: ::c_long = 311; +pub const SYS_timerfd_gettime: ::c_long = 312; +pub const SYS_signalfd4: ::c_long = 313; +pub const SYS_eventfd2: ::c_long = 314; +pub const SYS_epoll_create1: ::c_long = 315; +pub const SYS_dup3: ::c_long = 316; +pub const SYS_pipe2: ::c_long = 317; +pub const SYS_inotify_init1: ::c_long = 318; +pub const SYS_perf_event_open: ::c_long = 319; +pub const SYS_preadv: ::c_long = 320; +pub const SYS_pwritev: ::c_long = 321; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 322; +pub const SYS_fanotify_init: ::c_long = 323; +pub const SYS_fanotify_mark: ::c_long = 324; +pub const SYS_prlimit64: ::c_long = 325; +pub const SYS_socket: ::c_long = 326; +pub const SYS_bind: ::c_long = 327; +pub const SYS_connect: ::c_long = 328; +pub const SYS_listen: ::c_long = 329; +pub const SYS_accept: ::c_long = 330; +pub const SYS_getsockname: ::c_long = 331; +pub const SYS_getpeername: ::c_long = 332; +pub const SYS_socketpair: ::c_long = 333; +pub const SYS_send: ::c_long = 334; +pub const SYS_sendto: ::c_long = 335; +pub const SYS_recv: ::c_long = 336; +pub const SYS_recvfrom: ::c_long = 337; +pub const SYS_shutdown: ::c_long = 338; +pub const SYS_setsockopt: ::c_long = 339; +pub const SYS_getsockopt: ::c_long = 340; +pub const SYS_sendmsg: ::c_long = 341; +pub const SYS_recvmsg: ::c_long = 342; +pub const SYS_recvmmsg: ::c_long = 343; +pub const SYS_accept4: ::c_long = 344; +pub const SYS_name_to_handle_at: ::c_long = 345; +pub const SYS_open_by_handle_at: ::c_long = 346; +pub const SYS_clock_adjtime: ::c_long = 347; +pub const SYS_syncfs: ::c_long = 348; +pub const SYS_sendmmsg: ::c_long = 349; +pub const SYS_setns: ::c_long = 350; +pub const SYS_process_vm_readv: ::c_long = 351; +pub const SYS_process_vm_writev: ::c_long = 352; +pub const SYS_finit_module: ::c_long = 353; +pub const SYS_kcmp: ::c_long = 354; +pub const SYS_sched_setattr: ::c_long = 355; +pub const SYS_sched_getattr: ::c_long = 356; +pub const SYS_renameat2: ::c_long = 357; +pub const SYS_seccomp: ::c_long = 358; +pub const SYS_getrandom: ::c_long = 359; +pub const SYS_memfd_create: ::c_long = 360; +pub const SYS_bpf: ::c_long = 361; +pub const SYS_execveat: ::c_long = 362; +pub const SYS_switch_endian: ::c_long = 363; +pub const SYS_userfaultfd: ::c_long = 364; +pub const SYS_membarrier: ::c_long = 365; +pub const SYS_mlock2: ::c_long = 378; +pub const SYS_copy_file_range: ::c_long = 379; +pub const SYS_preadv2: ::c_long = 380; +pub const SYS_pwritev2: ::c_long = 381; +pub const SYS_kexec_file_load: ::c_long = 382; +pub const SYS_statx: ::c_long = 383; +pub const SYS_pkey_alloc: ::c_long = 384; +pub const SYS_pkey_free: ::c_long = 385; +pub const SYS_pkey_mprotect: ::c_long = 386; + +extern { + pub fn getrandom( + buf: *mut ::c_void, + buflen: ::size_t, + flags: ::c_uint, + ) -> ::ssize_t; +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/b32/x86.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/b32/x86.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/b32/x86.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/b32/x86.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,945 @@ +pub type c_char = i8; +pub type wchar_t = i32; + +s! { + pub struct stat { + pub st_dev: ::dev_t, + __st_dev_padding: ::c_int, + __st_ino_truncated: ::c_long, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __st_rdev_padding: ::c_int, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_ino: ::ino_t, + } + + pub struct stat64 { + pub st_dev: ::dev_t, + __st_dev_padding: ::c_int, + __st_ino_truncated: ::c_long, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __st_rdev_padding: ::c_int, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_ino: ::ino_t, + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_flags: ::c_int, + pub ss_size: ::size_t + } + + pub struct ipc_perm { + pub __ipc_perm_key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::mode_t, + pub __seq: ::c_int, + __unused1: ::c_long, + __unused2: ::c_long + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_atime: ::time_t, + __unused1: ::c_int, + pub shm_dtime: ::time_t, + __unused2: ::c_int, + pub shm_ctime: ::time_t, + __unused3: ::c_int, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, + pub shm_nattch: ::c_ulong, + __pad1: ::c_ulong, + __pad2: ::c_ulong, + } + + pub struct msqid_ds { + pub msg_perm: ::ipc_perm, + pub msg_stime: ::time_t, + __unused1: ::c_int, + pub msg_rtime: ::time_t, + __unused2: ::c_int, + pub msg_ctime: ::time_t, + __unused3: ::c_int, + __msg_cbytes: ::c_ulong, + pub msg_qnum: ::msgqnum_t, + pub msg_qbytes: ::msglen_t, + pub msg_lspid: ::pid_t, + pub msg_lrpid: ::pid_t, + __pad1: ::c_ulong, + __pad2: ::c_ulong, + } + + pub struct statfs { + pub f_type: ::c_ulong, + pub f_bsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_flags: ::c_ulong, + pub f_spare: [::c_ulong; 4], + } + + pub struct mcontext_t { + __private: [u32; 22] + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + pub _pad: [::c_int; 29], + _align: [usize; 0], + } + + pub struct statfs64 { + pub f_type: ::c_ulong, + pub f_bsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_flags: ::c_ulong, + pub f_spare: [::c_ulong; 4], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: u64, + pub f_fsid: ::c_ulong, + __f_unused: ::c_int, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } +} + +s_no_extra_traits!{ + pub struct ucontext_t { + pub uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_mcontext: mcontext_t, + pub uc_sigmask: ::sigset_t, + __private: [u8; 112], + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for ucontext_t { + fn eq(&self, other: &ucontext_t) -> bool { + self.uc_flags == other.uc_flags + && self.uc_link == other.uc_link + && self.uc_stack == other.uc_stack + && self.uc_mcontext == other.uc_mcontext + && self.uc_sigmask == other.uc_sigmask + && self + .__private + .iter() + .zip(other.__private.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for ucontext_t {} + + impl ::fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ucontext_t") + .field("uc_flags", &self.uc_flags) + .field("uc_link", &self.uc_link) + .field("uc_stack", &self.uc_stack) + .field("uc_mcontext", &self.uc_mcontext) + .field("uc_sigmask", &self.uc_sigmask) + // Ignore __private field + .finish() + } + } + + impl ::hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { + self.uc_flags.hash(state); + self.uc_link.hash(state); + self.uc_stack.hash(state); + self.uc_mcontext.hash(state); + self.uc_sigmask.hash(state); + self.__private.hash(state); + } + } + } +} + +pub const SIGSTKSZ: ::size_t = 8192; +pub const MINSIGSTKSZ: ::size_t = 2048; + +pub const O_DIRECT: ::c_int = 0x4000; +pub const O_DIRECTORY: ::c_int = 0x10000; +pub const O_NOFOLLOW: ::c_int = 0x20000; +pub const O_ASYNC: ::c_int = 0x2000; +pub const O_LARGEFILE: ::c_int = 0o0100000; + +pub const FIOCLEX: ::c_int = 0x5451; +pub const FIONCLEX: ::c_int = 0x5450; +pub const FIONBIO: ::c_int = 0x5421; + +pub const RLIMIT_RSS: ::c_int = 5; +pub const RLIMIT_NOFILE: ::c_int = 7; +pub const RLIMIT_AS: ::c_int = 9; +pub const RLIMIT_NPROC: ::c_int = 6; +pub const RLIMIT_MEMLOCK: ::c_int = 8; +pub const RLIMIT_NLIMITS: ::c_int = 15; + +pub const MADV_SOFT_OFFLINE: ::c_int = 101; +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; +pub const CBAUD: ::tcflag_t = 0o0010017; +pub const TAB1: ::c_int = 0x00000800; +pub const TAB2: ::c_int = 0x00001000; +pub const TAB3: ::c_int = 0x00001800; +pub const CR1: ::c_int = 0x00000200; +pub const CR2: ::c_int = 0x00000400; +pub const CR3: ::c_int = 0x00000600; +pub const FF1: ::c_int = 0x00008000; +pub const BS1: ::c_int = 0x00002000; +pub const VT1: ::c_int = 0x00004000; +pub const VWERASE: usize = 14; +pub const VREPRINT: usize = 12; +pub const VSUSP: usize = 10; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VDISCARD: usize = 13; +pub const VTIME: usize = 5; +pub const IXON: ::tcflag_t = 0x00000400; +pub const IXOFF: ::tcflag_t = 0x00001000; +pub const ONLCR: ::tcflag_t = 0x4; +pub const CSIZE: ::tcflag_t = 0x00000030; +pub const CS6: ::tcflag_t = 0x00000010; +pub const CS7: ::tcflag_t = 0x00000020; +pub const CS8: ::tcflag_t = 0x00000030; +pub const CSTOPB: ::tcflag_t = 0x00000040; +pub const CREAD: ::tcflag_t = 0x00000080; +pub const PARENB: ::tcflag_t = 0x00000100; +pub const PARODD: ::tcflag_t = 0x00000200; +pub const HUPCL: ::tcflag_t = 0x00000400; +pub const CLOCAL: ::tcflag_t = 0x00000800; +pub const ECHOKE: ::tcflag_t = 0x00000800; +pub const ECHOE: ::tcflag_t = 0x00000010; +pub const ECHOK: ::tcflag_t = 0x00000020; +pub const ECHONL: ::tcflag_t = 0x00000040; +pub const ECHOPRT: ::tcflag_t = 0x00000400; +pub const ECHOCTL: ::tcflag_t = 0x00000200; +pub const ISIG: ::tcflag_t = 0x00000001; +pub const ICANON: ::tcflag_t = 0x00000002; +pub const PENDIN: ::tcflag_t = 0x00004000; +pub const NOFLSH: ::tcflag_t = 0x00000080; +pub const CIBAUD: ::tcflag_t = 0o02003600000; +pub const CBAUDEX: ::tcflag_t = 0o010000; +pub const VSWTC: usize = 7; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const XTABS: ::tcflag_t = 0o014000; +pub const B57600: ::speed_t = 0o010001; +pub const B115200: ::speed_t = 0o010002; +pub const B230400: ::speed_t = 0o010003; +pub const B460800: ::speed_t = 0o010004; +pub const B500000: ::speed_t = 0o010005; +pub const B576000: ::speed_t = 0o010006; +pub const B921600: ::speed_t = 0o010007; +pub const B1000000: ::speed_t = 0o010010; +pub const B1152000: ::speed_t = 0o010011; +pub const B1500000: ::speed_t = 0o010012; +pub const B2000000: ::speed_t = 0o010013; +pub const B2500000: ::speed_t = 0o010014; +pub const B3000000: ::speed_t = 0o010015; +pub const B3500000: ::speed_t = 0o010016; +pub const B4000000: ::speed_t = 0o010017; + +pub const O_APPEND: ::c_int = 1024; +pub const O_CREAT: ::c_int = 64; +pub const O_EXCL: ::c_int = 128; +pub const O_NOCTTY: ::c_int = 256; +pub const O_NONBLOCK: ::c_int = 2048; +pub const O_SYNC: ::c_int = 1052672; +pub const O_RSYNC: ::c_int = 1052672; +pub const O_DSYNC: ::c_int = 4096; + +pub const SOCK_NONBLOCK: ::c_int = 2048; + +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_GROWSDOWN: ::c_int = 0x0100; +pub const MAP_DENYWRITE: ::c_int = 0x0800; +pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_LOCKED: ::c_int = 0x02000; +pub const MAP_NORESERVE: ::c_int = 0x04000; +pub const MAP_POPULATE: ::c_int = 0x08000; +pub const MAP_NONBLOCK: ::c_int = 0x010000; +pub const MAP_STACK: ::c_int = 0x020000; + +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; +pub const SOCK_SEQPACKET: ::c_int = 5; + +pub const SOL_SOCKET: ::c_int = 1; + +pub const EDEADLK: ::c_int = 35; +pub const ENAMETOOLONG: ::c_int = 36; +pub const ENOLCK: ::c_int = 37; +pub const ENOSYS: ::c_int = 38; +pub const ENOTEMPTY: ::c_int = 39; +pub const ELOOP: ::c_int = 40; +pub const ENOMSG: ::c_int = 42; +pub const EIDRM: ::c_int = 43; +pub const ECHRNG: ::c_int = 44; +pub const EL2NSYNC: ::c_int = 45; +pub const EL3HLT: ::c_int = 46; +pub const EL3RST: ::c_int = 47; +pub const ELNRNG: ::c_int = 48; +pub const EUNATCH: ::c_int = 49; +pub const ENOCSI: ::c_int = 50; +pub const EL2HLT: ::c_int = 51; +pub const EBADE: ::c_int = 52; +pub const EBADR: ::c_int = 53; +pub const EXFULL: ::c_int = 54; +pub const ENOANO: ::c_int = 55; +pub const EBADRQC: ::c_int = 56; +pub const EBADSLT: ::c_int = 57; +pub const EDEADLOCK: ::c_int = EDEADLK; +pub const EMULTIHOP: ::c_int = 72; +pub const EBADMSG: ::c_int = 74; +pub const EOVERFLOW: ::c_int = 75; +pub const ENOTUNIQ: ::c_int = 76; +pub const EBADFD: ::c_int = 77; +pub const EREMCHG: ::c_int = 78; +pub const ELIBACC: ::c_int = 79; +pub const ELIBBAD: ::c_int = 80; +pub const ELIBSCN: ::c_int = 81; +pub const ELIBMAX: ::c_int = 82; +pub const ELIBEXEC: ::c_int = 83; +pub const EILSEQ: ::c_int = 84; +pub const ERESTART: ::c_int = 85; +pub const ESTRPIPE: ::c_int = 86; +pub const EUSERS: ::c_int = 87; +pub const ENOTSOCK: ::c_int = 88; +pub const EDESTADDRREQ: ::c_int = 89; +pub const EMSGSIZE: ::c_int = 90; +pub const EPROTOTYPE: ::c_int = 91; +pub const ENOPROTOOPT: ::c_int = 92; +pub const EPROTONOSUPPORT: ::c_int = 93; +pub const ESOCKTNOSUPPORT: ::c_int = 94; +pub const EOPNOTSUPP: ::c_int = 95; +pub const ENOTSUP: ::c_int = EOPNOTSUPP; +pub const EPFNOSUPPORT: ::c_int = 96; +pub const EAFNOSUPPORT: ::c_int = 97; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const ENETDOWN: ::c_int = 100; +pub const ENETUNREACH: ::c_int = 101; +pub const ENETRESET: ::c_int = 102; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNRESET: ::c_int = 104; +pub const ENOBUFS: ::c_int = 105; +pub const EISCONN: ::c_int = 106; +pub const ENOTCONN: ::c_int = 107; +pub const ESHUTDOWN: ::c_int = 108; +pub const ETOOMANYREFS: ::c_int = 109; +pub const ETIMEDOUT: ::c_int = 110; +pub const ECONNREFUSED: ::c_int = 111; +pub const EHOSTDOWN: ::c_int = 112; +pub const EHOSTUNREACH: ::c_int = 113; +pub const EALREADY: ::c_int = 114; +pub const EINPROGRESS: ::c_int = 115; +pub const ESTALE: ::c_int = 116; +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; +pub const EDQUOT: ::c_int = 122; +pub const ENOMEDIUM: ::c_int = 123; +pub const EMEDIUMTYPE: ::c_int = 124; +pub const ECANCELED: ::c_int = 125; +pub const ENOKEY: ::c_int = 126; +pub const EKEYEXPIRED: ::c_int = 127; +pub const EKEYREVOKED: ::c_int = 128; +pub const EKEYREJECTED: ::c_int = 129; +pub const EOWNERDEAD: ::c_int = 130; +pub const ENOTRECOVERABLE: ::c_int = 131; +pub const ERFKILL: ::c_int = 132; +pub const EHWPOISON: ::c_int = 133; + +pub const SO_REUSEADDR: ::c_int = 2; +pub const SO_TYPE: ::c_int = 3; +pub const SO_ERROR: ::c_int = 4; +pub const SO_DONTROUTE: ::c_int = 5; +pub const SO_BROADCAST: ::c_int = 6; +pub const SO_SNDBUF: ::c_int = 7; +pub const SO_RCVBUF: ::c_int = 8; +pub const SO_KEEPALIVE: ::c_int = 9; +pub const SO_OOBINLINE: ::c_int = 10; +pub const SO_NO_CHECK: ::c_int = 11; +pub const SO_PRIORITY: ::c_int = 12; +pub const SO_LINGER: ::c_int = 13; +pub const SO_BSDCOMPAT: ::c_int = 14; +pub const SO_REUSEPORT: ::c_int = 15; +pub const SO_PASSCRED: ::c_int = 16; +pub const SO_PEERCRED: ::c_int = 17; +pub const SO_RCVLOWAT: ::c_int = 18; +pub const SO_SNDLOWAT: ::c_int = 19; +pub const SO_RCVTIMEO: ::c_int = 20; +pub const SO_SNDTIMEO: ::c_int = 21; +pub const SO_ACCEPTCONN: ::c_int = 30; +pub const SO_SNDBUFFORCE: ::c_int = 32; +pub const SO_RCVBUFFORCE: ::c_int = 33; +pub const SO_PROTOCOL: ::c_int = 38; +pub const SO_DOMAIN: ::c_int = 39; + +pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_SIGINFO: ::c_int = 0x00000004; +pub const SA_NOCLDWAIT: ::c_int = 0x00000002; + +pub const SIGCHLD: ::c_int = 17; +pub const SIGBUS: ::c_int = 7; +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; +pub const SIGUSR1: ::c_int = 10; +pub const SIGUSR2: ::c_int = 12; +pub const SIGCONT: ::c_int = 18; +pub const SIGSTOP: ::c_int = 19; +pub const SIGTSTP: ::c_int = 20; +pub const SIGURG: ::c_int = 23; +pub const SIGIO: ::c_int = 29; +pub const SIGSYS: ::c_int = 31; +pub const SIGSTKFLT: ::c_int = 16; +pub const SIGPOLL: ::c_int = 29; +pub const SIGPWR: ::c_int = 30; +pub const SIG_SETMASK: ::c_int = 2; +pub const SIG_BLOCK: ::c_int = 0x000000; +pub const SIG_UNBLOCK: ::c_int = 0x01; + +pub const EXTPROC: ::tcflag_t = 0x00010000; + +pub const MAP_HUGETLB: ::c_int = 0x040000; +pub const MAP_32BIT: ::c_int = 0x0040; + +pub const F_GETLK: ::c_int = 12; +pub const F_GETOWN: ::c_int = 9; +pub const F_SETLK: ::c_int = 13; +pub const F_SETLKW: ::c_int = 14; +pub const F_SETOWN: ::c_int = 8; + +pub const VEOF: usize = 4; +pub const VEOL: usize = 11; +pub const VEOL2: usize = 16; +pub const VMIN: usize = 6; +pub const IEXTEN: ::tcflag_t = 0x00008000; +pub const TOSTOP: ::tcflag_t = 0x00000100; +pub const FLUSHO: ::tcflag_t = 0x00001000; + +pub const TCGETS: ::c_int = 0x5401; +pub const TCSETS: ::c_int = 0x5402; +pub const TCSETSW: ::c_int = 0x5403; +pub const TCSETSF: ::c_int = 0x5404; +pub const TCGETA: ::c_int = 0x5405; +pub const TCSETA: ::c_int = 0x5406; +pub const TCSETAW: ::c_int = 0x5407; +pub const TCSETAF: ::c_int = 0x5408; +pub const TCSBRK: ::c_int = 0x5409; +pub const TCXONC: ::c_int = 0x540A; +pub const TCFLSH: ::c_int = 0x540B; +pub const TIOCGSOFTCAR: ::c_int = 0x5419; +pub const TIOCSSOFTCAR: ::c_int = 0x541A; +pub const TIOCLINUX: ::c_int = 0x541C; +pub const TIOCGSERIAL: ::c_int = 0x541E; +pub const TIOCEXCL: ::c_int = 0x540C; +pub const TIOCNXCL: ::c_int = 0x540D; +pub const TIOCSCTTY: ::c_int = 0x540E; +pub const TIOCGPGRP: ::c_int = 0x540F; +pub const TIOCSPGRP: ::c_int = 0x5410; +pub const TIOCOUTQ: ::c_int = 0x5411; +pub const TIOCSTI: ::c_int = 0x5412; +pub const TIOCGWINSZ: ::c_int = 0x5413; +pub const TIOCSWINSZ: ::c_int = 0x5414; +pub const TIOCMGET: ::c_int = 0x5415; +pub const TIOCMBIS: ::c_int = 0x5416; +pub const TIOCMBIC: ::c_int = 0x5417; +pub const TIOCMSET: ::c_int = 0x5418; +pub const FIONREAD: ::c_int = 0x541B; +pub const TIOCCONS: ::c_int = 0x541D; + +pub const TIOCGRS485: ::c_int = 0x542E; +pub const TIOCSRS485: ::c_int = 0x542F; + +pub const POLLWRNORM: ::c_short = 0x100; +pub const POLLWRBAND: ::c_short = 0x200; + +pub const TIOCM_LE: ::c_int = 0x001; +pub const TIOCM_DTR: ::c_int = 0x002; +pub const TIOCM_RTS: ::c_int = 0x004; +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; +pub const TIOCM_CD: ::c_int = TIOCM_CAR; +pub const TIOCM_RI: ::c_int = TIOCM_RNG; + +// Syscall table +pub const SYS_restart_syscall: ::c_long = 0; +pub const SYS_exit: ::c_long = 1; +pub const SYS_fork: ::c_long = 2; +pub const SYS_read: ::c_long = 3; +pub const SYS_write: ::c_long = 4; +pub const SYS_open: ::c_long = 5; +pub const SYS_close: ::c_long = 6; +pub const SYS_waitpid: ::c_long = 7; +pub const SYS_creat: ::c_long = 8; +pub const SYS_link: ::c_long = 9; +pub const SYS_unlink: ::c_long = 10; +pub const SYS_execve: ::c_long = 11; +pub const SYS_chdir: ::c_long = 12; +pub const SYS_time: ::c_long = 13; +pub const SYS_mknod: ::c_long = 14; +pub const SYS_chmod: ::c_long = 15; +pub const SYS_lchown: ::c_long = 16; +pub const SYS_break: ::c_long = 17; +pub const SYS_oldstat: ::c_long = 18; +pub const SYS_lseek: ::c_long = 19; +pub const SYS_getpid: ::c_long = 20; +pub const SYS_mount: ::c_long = 21; +pub const SYS_umount: ::c_long = 22; +pub const SYS_setuid: ::c_long = 23; +pub const SYS_getuid: ::c_long = 24; +pub const SYS_stime: ::c_long = 25; +pub const SYS_ptrace: ::c_long = 26; +pub const SYS_alarm: ::c_long = 27; +pub const SYS_oldfstat: ::c_long = 28; +pub const SYS_pause: ::c_long = 29; +pub const SYS_utime: ::c_long = 30; +pub const SYS_stty: ::c_long = 31; +pub const SYS_gtty: ::c_long = 32; +pub const SYS_access: ::c_long = 33; +pub const SYS_nice: ::c_long = 34; +pub const SYS_ftime: ::c_long = 35; +pub const SYS_sync: ::c_long = 36; +pub const SYS_kill: ::c_long = 37; +pub const SYS_rename: ::c_long = 38; +pub const SYS_mkdir: ::c_long = 39; +pub const SYS_rmdir: ::c_long = 40; +pub const SYS_dup: ::c_long = 41; +pub const SYS_pipe: ::c_long = 42; +pub const SYS_times: ::c_long = 43; +pub const SYS_prof: ::c_long = 44; +pub const SYS_brk: ::c_long = 45; +pub const SYS_setgid: ::c_long = 46; +pub const SYS_getgid: ::c_long = 47; +pub const SYS_signal: ::c_long = 48; +pub const SYS_geteuid: ::c_long = 49; +pub const SYS_getegid: ::c_long = 50; +pub const SYS_acct: ::c_long = 51; +pub const SYS_umount2: ::c_long = 52; +pub const SYS_lock: ::c_long = 53; +pub const SYS_ioctl: ::c_long = 54; +pub const SYS_fcntl: ::c_long = 55; +pub const SYS_mpx: ::c_long = 56; +pub const SYS_setpgid: ::c_long = 57; +pub const SYS_ulimit: ::c_long = 58; +pub const SYS_oldolduname: ::c_long = 59; +pub const SYS_umask: ::c_long = 60; +pub const SYS_chroot: ::c_long = 61; +pub const SYS_ustat: ::c_long = 62; +pub const SYS_dup2: ::c_long = 63; +pub const SYS_getppid: ::c_long = 64; +pub const SYS_getpgrp: ::c_long = 65; +pub const SYS_setsid: ::c_long = 66; +pub const SYS_sigaction: ::c_long = 67; +pub const SYS_sgetmask: ::c_long = 68; +pub const SYS_ssetmask: ::c_long = 69; +pub const SYS_setreuid: ::c_long = 70; +pub const SYS_setregid: ::c_long = 71; +pub const SYS_sigsuspend: ::c_long = 72; +pub const SYS_sigpending: ::c_long = 73; +pub const SYS_sethostname: ::c_long = 74; +pub const SYS_setrlimit: ::c_long = 75; +pub const SYS_getrlimit: ::c_long = 76; +pub const SYS_getrusage: ::c_long = 77; +pub const SYS_gettimeofday: ::c_long = 78; +pub const SYS_settimeofday: ::c_long = 79; +pub const SYS_getgroups: ::c_long = 80; +pub const SYS_setgroups: ::c_long = 81; +pub const SYS_select: ::c_long = 82; +pub const SYS_symlink: ::c_long = 83; +pub const SYS_oldlstat: ::c_long = 84; +pub const SYS_readlink: ::c_long = 85; +pub const SYS_uselib: ::c_long = 86; +pub const SYS_swapon: ::c_long = 87; +pub const SYS_reboot: ::c_long = 88; +pub const SYS_readdir: ::c_long = 89; +pub const SYS_mmap: ::c_long = 90; +pub const SYS_munmap: ::c_long = 91; +pub const SYS_truncate: ::c_long = 92; +pub const SYS_ftruncate: ::c_long = 93; +pub const SYS_fchmod: ::c_long = 94; +pub const SYS_fchown: ::c_long = 95; +pub const SYS_getpriority: ::c_long = 96; +pub const SYS_setpriority: ::c_long = 97; +pub const SYS_profil: ::c_long = 98; +pub const SYS_statfs: ::c_long = 99; +pub const SYS_fstatfs: ::c_long = 100; +pub const SYS_ioperm: ::c_long = 101; +pub const SYS_socketcall: ::c_long = 102; +pub const SYS_syslog: ::c_long = 103; +pub const SYS_setitimer: ::c_long = 104; +pub const SYS_getitimer: ::c_long = 105; +pub const SYS_stat: ::c_long = 106; +pub const SYS_lstat: ::c_long = 107; +pub const SYS_fstat: ::c_long = 108; +pub const SYS_olduname: ::c_long = 109; +pub const SYS_iopl: ::c_long = 110; +pub const SYS_vhangup: ::c_long = 111; +pub const SYS_idle: ::c_long = 112; +pub const SYS_vm86old: ::c_long = 113; +pub const SYS_wait4: ::c_long = 114; +pub const SYS_swapoff: ::c_long = 115; +pub const SYS_sysinfo: ::c_long = 116; +pub const SYS_ipc: ::c_long = 117; +pub const SYS_fsync: ::c_long = 118; +pub const SYS_sigreturn: ::c_long = 119; +pub const SYS_clone: ::c_long = 120; +pub const SYS_setdomainname: ::c_long = 121; +pub const SYS_uname: ::c_long = 122; +pub const SYS_modify_ldt: ::c_long = 123; +pub const SYS_adjtimex: ::c_long = 124; +pub const SYS_mprotect: ::c_long = 125; +pub const SYS_sigprocmask: ::c_long = 126; +pub const SYS_create_module: ::c_long = 127; +pub const SYS_init_module: ::c_long = 128; +pub const SYS_delete_module: ::c_long = 129; +pub const SYS_get_kernel_syms: ::c_long = 130; +pub const SYS_quotactl: ::c_long = 131; +pub const SYS_getpgid: ::c_long = 132; +pub const SYS_fchdir: ::c_long = 133; +pub const SYS_bdflush: ::c_long = 134; +pub const SYS_sysfs: ::c_long = 135; +pub const SYS_personality: ::c_long = 136; +pub const SYS_afs_syscall: ::c_long = 137; +pub const SYS_setfsuid: ::c_long = 138; +pub const SYS_setfsgid: ::c_long = 139; +pub const SYS__llseek: ::c_long = 140; +pub const SYS_getdents: ::c_long = 141; +pub const SYS__newselect: ::c_long = 142; +pub const SYS_flock: ::c_long = 143; +pub const SYS_msync: ::c_long = 144; +pub const SYS_readv: ::c_long = 145; +pub const SYS_writev: ::c_long = 146; +pub const SYS_getsid: ::c_long = 147; +pub const SYS_fdatasync: ::c_long = 148; +pub const SYS__sysctl: ::c_long = 149; +pub const SYS_mlock: ::c_long = 150; +pub const SYS_munlock: ::c_long = 151; +pub const SYS_mlockall: ::c_long = 152; +pub const SYS_munlockall: ::c_long = 153; +pub const SYS_sched_setparam: ::c_long = 154; +pub const SYS_sched_getparam: ::c_long = 155; +pub const SYS_sched_setscheduler: ::c_long = 156; +pub const SYS_sched_getscheduler: ::c_long = 157; +pub const SYS_sched_yield: ::c_long = 158; +pub const SYS_sched_get_priority_max: ::c_long = 159; +pub const SYS_sched_get_priority_min: ::c_long = 160; +pub const SYS_sched_rr_get_interval: ::c_long = 161; +pub const SYS_nanosleep: ::c_long = 162; +pub const SYS_mremap: ::c_long = 163; +pub const SYS_setresuid: ::c_long = 164; +pub const SYS_getresuid: ::c_long = 165; +pub const SYS_vm86: ::c_long = 166; +pub const SYS_query_module: ::c_long = 167; +pub const SYS_poll: ::c_long = 168; +pub const SYS_nfsservctl: ::c_long = 169; +pub const SYS_setresgid: ::c_long = 170; +pub const SYS_getresgid: ::c_long = 171; +pub const SYS_prctl: ::c_long = 172; +pub const SYS_rt_sigreturn: ::c_long = 173; +pub const SYS_rt_sigaction: ::c_long = 174; +pub const SYS_rt_sigprocmask: ::c_long = 175; +pub const SYS_rt_sigpending: ::c_long = 176; +pub const SYS_rt_sigtimedwait: ::c_long = 177; +pub const SYS_rt_sigqueueinfo: ::c_long = 178; +pub const SYS_rt_sigsuspend: ::c_long = 179; +pub const SYS_pread64: ::c_long = 180; +pub const SYS_pwrite64: ::c_long = 181; +pub const SYS_chown: ::c_long = 182; +pub const SYS_getcwd: ::c_long = 183; +pub const SYS_capget: ::c_long = 184; +pub const SYS_capset: ::c_long = 185; +pub const SYS_sigaltstack: ::c_long = 186; +pub const SYS_sendfile: ::c_long = 187; +pub const SYS_getpmsg: ::c_long = 188; +pub const SYS_putpmsg: ::c_long = 189; +pub const SYS_vfork: ::c_long = 190; +pub const SYS_ugetrlimit: ::c_long = 191; +pub const SYS_mmap2: ::c_long = 192; +pub const SYS_truncate64: ::c_long = 193; +pub const SYS_ftruncate64: ::c_long = 194; +pub const SYS_stat64: ::c_long = 195; +pub const SYS_lstat64: ::c_long = 196; +pub const SYS_fstat64: ::c_long = 197; +pub const SYS_lchown32: ::c_long = 198; +pub const SYS_getuid32: ::c_long = 199; +pub const SYS_getgid32: ::c_long = 200; +pub const SYS_geteuid32: ::c_long = 201; +pub const SYS_getegid32: ::c_long = 202; +pub const SYS_setreuid32: ::c_long = 203; +pub const SYS_setregid32: ::c_long = 204; +pub const SYS_getgroups32: ::c_long = 205; +pub const SYS_setgroups32: ::c_long = 206; +pub const SYS_fchown32: ::c_long = 207; +pub const SYS_setresuid32: ::c_long = 208; +pub const SYS_getresuid32: ::c_long = 209; +pub const SYS_setresgid32: ::c_long = 210; +pub const SYS_getresgid32: ::c_long = 211; +pub const SYS_chown32: ::c_long = 212; +pub const SYS_setuid32: ::c_long = 213; +pub const SYS_setgid32: ::c_long = 214; +pub const SYS_setfsuid32: ::c_long = 215; +pub const SYS_setfsgid32: ::c_long = 216; +pub const SYS_pivot_root: ::c_long = 217; +pub const SYS_mincore: ::c_long = 218; +pub const SYS_madvise: ::c_long = 219; +pub const SYS_getdents64: ::c_long = 220; +pub const SYS_fcntl64: ::c_long = 221; +pub const SYS_gettid: ::c_long = 224; +pub const SYS_readahead: ::c_long = 225; +pub const SYS_setxattr: ::c_long = 226; +pub const SYS_lsetxattr: ::c_long = 227; +pub const SYS_fsetxattr: ::c_long = 228; +pub const SYS_getxattr: ::c_long = 229; +pub const SYS_lgetxattr: ::c_long = 230; +pub const SYS_fgetxattr: ::c_long = 231; +pub const SYS_listxattr: ::c_long = 232; +pub const SYS_llistxattr: ::c_long = 233; +pub const SYS_flistxattr: ::c_long = 234; +pub const SYS_removexattr: ::c_long = 235; +pub const SYS_lremovexattr: ::c_long = 236; +pub const SYS_fremovexattr: ::c_long = 237; +pub const SYS_tkill: ::c_long = 238; +pub const SYS_sendfile64: ::c_long = 239; +pub const SYS_futex: ::c_long = 240; +pub const SYS_sched_setaffinity: ::c_long = 241; +pub const SYS_sched_getaffinity: ::c_long = 242; +pub const SYS_set_thread_area: ::c_long = 243; +pub const SYS_get_thread_area: ::c_long = 244; +pub const SYS_io_setup: ::c_long = 245; +pub const SYS_io_destroy: ::c_long = 246; +pub const SYS_io_getevents: ::c_long = 247; +pub const SYS_io_submit: ::c_long = 248; +pub const SYS_io_cancel: ::c_long = 249; +pub const SYS_fadvise64: ::c_long = 250; +pub const SYS_exit_group: ::c_long = 252; +pub const SYS_lookup_dcookie: ::c_long = 253; +pub const SYS_epoll_create: ::c_long = 254; +pub const SYS_epoll_ctl: ::c_long = 255; +pub const SYS_epoll_wait: ::c_long = 256; +pub const SYS_remap_file_pages: ::c_long = 257; +pub const SYS_set_tid_address: ::c_long = 258; +pub const SYS_timer_create: ::c_long = 259; +pub const SYS_timer_settime: ::c_long = 260; +pub const SYS_timer_gettime: ::c_long = 261; +pub const SYS_timer_getoverrun: ::c_long = 262; +pub const SYS_timer_delete: ::c_long = 263; +pub const SYS_clock_settime: ::c_long = 264; +pub const SYS_clock_gettime: ::c_long = 265; +pub const SYS_clock_getres: ::c_long = 266; +pub const SYS_clock_nanosleep: ::c_long = 267; +pub const SYS_statfs64: ::c_long = 268; +pub const SYS_fstatfs64: ::c_long = 269; +pub const SYS_tgkill: ::c_long = 270; +pub const SYS_utimes: ::c_long = 271; +pub const SYS_fadvise64_64: ::c_long = 272; +pub const SYS_vserver: ::c_long = 273; +pub const SYS_mbind: ::c_long = 274; +pub const SYS_get_mempolicy: ::c_long = 275; +pub const SYS_set_mempolicy: ::c_long = 276; +pub const SYS_mq_open: ::c_long = 277; +pub const SYS_mq_unlink: ::c_long = 278; +pub const SYS_mq_timedsend: ::c_long = 279; +pub const SYS_mq_timedreceive: ::c_long = 280; +pub const SYS_mq_notify: ::c_long = 281; +pub const SYS_mq_getsetattr: ::c_long = 282; +pub const SYS_kexec_load: ::c_long = 283; +pub const SYS_waitid: ::c_long = 284; +pub const SYS_add_key: ::c_long = 286; +pub const SYS_request_key: ::c_long = 287; +pub const SYS_keyctl: ::c_long = 288; +pub const SYS_ioprio_set: ::c_long = 289; +pub const SYS_ioprio_get: ::c_long = 290; +pub const SYS_inotify_init: ::c_long = 291; +pub const SYS_inotify_add_watch: ::c_long = 292; +pub const SYS_inotify_rm_watch: ::c_long = 293; +pub const SYS_migrate_pages: ::c_long = 294; +pub const SYS_openat: ::c_long = 295; +pub const SYS_mkdirat: ::c_long = 296; +pub const SYS_mknodat: ::c_long = 297; +pub const SYS_fchownat: ::c_long = 298; +pub const SYS_futimesat: ::c_long = 299; +pub const SYS_fstatat64: ::c_long = 300; +pub const SYS_unlinkat: ::c_long = 301; +pub const SYS_renameat: ::c_long = 302; +pub const SYS_linkat: ::c_long = 303; +pub const SYS_symlinkat: ::c_long = 304; +pub const SYS_readlinkat: ::c_long = 305; +pub const SYS_fchmodat: ::c_long = 306; +pub const SYS_faccessat: ::c_long = 307; +pub const SYS_pselect6: ::c_long = 308; +pub const SYS_ppoll: ::c_long = 309; +pub const SYS_unshare: ::c_long = 310; +pub const SYS_set_robust_list: ::c_long = 311; +pub const SYS_get_robust_list: ::c_long = 312; +pub const SYS_splice: ::c_long = 313; +pub const SYS_sync_file_range: ::c_long = 314; +pub const SYS_tee: ::c_long = 315; +pub const SYS_vmsplice: ::c_long = 316; +pub const SYS_move_pages: ::c_long = 317; +pub const SYS_getcpu: ::c_long = 318; +pub const SYS_epoll_pwait: ::c_long = 319; +pub const SYS_utimensat: ::c_long = 320; +pub const SYS_signalfd: ::c_long = 321; +pub const SYS_timerfd_create: ::c_long = 322; +pub const SYS_eventfd: ::c_long = 323; +pub const SYS_fallocate: ::c_long = 324; +pub const SYS_timerfd_settime: ::c_long = 325; +pub const SYS_timerfd_gettime: ::c_long = 326; +pub const SYS_signalfd4: ::c_long = 327; +pub const SYS_eventfd2: ::c_long = 328; +pub const SYS_epoll_create1: ::c_long = 329; +pub const SYS_dup3: ::c_long = 330; +pub const SYS_pipe2: ::c_long = 331; +pub const SYS_inotify_init1: ::c_long = 332; +pub const SYS_preadv: ::c_long = 333; +pub const SYS_pwritev: ::c_long = 334; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 335; +pub const SYS_perf_event_open: ::c_long = 336; +pub const SYS_recvmmsg: ::c_long = 337; +pub const SYS_fanotify_init: ::c_long = 338; +pub const SYS_fanotify_mark: ::c_long = 339; +pub const SYS_prlimit64: ::c_long = 340; +pub const SYS_name_to_handle_at: ::c_long = 341; +pub const SYS_open_by_handle_at: ::c_long = 342; +pub const SYS_clock_adjtime: ::c_long = 343; +pub const SYS_syncfs: ::c_long = 344; +pub const SYS_sendmmsg: ::c_long = 345; +pub const SYS_setns: ::c_long = 346; +pub const SYS_process_vm_readv: ::c_long = 347; +pub const SYS_process_vm_writev: ::c_long = 348; +pub const SYS_kcmp: ::c_long = 349; +pub const SYS_finit_module: ::c_long = 350; +pub const SYS_sched_setattr: ::c_long = 351; +pub const SYS_sched_getattr: ::c_long = 352; +pub const SYS_renameat2: ::c_long = 353; +pub const SYS_seccomp: ::c_long = 354; +pub const SYS_getrandom: ::c_long = 355; +pub const SYS_memfd_create: ::c_long = 356; +pub const SYS_bpf: ::c_long = 357; +pub const SYS_execveat: ::c_long = 358; +pub const SYS_socket: ::c_long = 359; +pub const SYS_socketpair: ::c_long = 360; +pub const SYS_bind: ::c_long = 361; +pub const SYS_connect: ::c_long = 362; +pub const SYS_listen: ::c_long = 363; +pub const SYS_accept4: ::c_long = 364; +pub const SYS_getsockopt: ::c_long = 365; +pub const SYS_setsockopt: ::c_long = 366; +pub const SYS_getsockname: ::c_long = 367; +pub const SYS_getpeername: ::c_long = 368; +pub const SYS_sendto: ::c_long = 369; +pub const SYS_sendmsg: ::c_long = 370; +pub const SYS_recvfrom: ::c_long = 371; +pub const SYS_recvmsg: ::c_long = 372; +pub const SYS_shutdown: ::c_long = 373; +pub const SYS_userfaultfd: ::c_long = 374; +pub const SYS_membarrier: ::c_long = 375; +pub const SYS_mlock2: ::c_long = 376; +pub const SYS_copy_file_range: ::c_long = 377; +pub const SYS_preadv2: ::c_long = 378; +pub const SYS_pwritev2: ::c_long = 379; +// FIXME syscalls 380-382 have been added in musl 1.16 +// See discussion https://github.com/rust-lang/libc/pull/699 + +// offsets in user_regs_structs, from sys/reg.h +pub const EBX: ::c_int = 0; +pub const ECX: ::c_int = 1; +pub const EDX: ::c_int = 2; +pub const ESI: ::c_int = 3; +pub const EDI: ::c_int = 4; +pub const EBP: ::c_int = 5; +pub const EAX: ::c_int = 6; +pub const DS: ::c_int = 7; +pub const ES: ::c_int = 8; +pub const FS: ::c_int = 9; +pub const GS: ::c_int = 10; +pub const ORIG_EAX: ::c_int = 11; +pub const EIP: ::c_int = 12; +pub const CS: ::c_int = 13; +pub const EFL: ::c_int = 14; +pub const UESP: ::c_int = 15; +pub const SS: ::c_int = 16; + +extern { + pub fn getrandom( + buf: *mut ::c_void, + buflen: ::size_t, + flags: ::c_uint, + ) -> ::ssize_t; +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,481 @@ +pub type c_char = u8; +pub type __u64 = ::c_ulonglong; +pub type wchar_t = u32; +pub type nlink_t = u32; +pub type blksize_t = ::c_int; + +s! { + pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __pad0: ::c_ulong, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + __pad1: ::c_int, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused: [::c_uint; 2], + } + + pub struct stat64 { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __pad0: ::c_ulong, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + __pad1: ::c_int, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused: [::c_uint; 2], + } + + pub struct ipc_perm { + pub __ipc_perm_key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::mode_t, + pub __seq: ::c_ushort, + __unused1: ::c_ulong, + __unused2: ::c_ulong, + } +} + +pub const O_DIRECT: ::c_int = 0x10000; +pub const O_DIRECTORY: ::c_int = 0x4000; +pub const O_LARGEFILE: ::c_int = 0x20000; +pub const O_NOFOLLOW: ::c_int = 0x8000; + +pub const MINSIGSTKSZ: ::size_t = 6144; +pub const SIGSTKSZ: ::size_t = 12288; + +pub const MADV_SOFT_OFFLINE: ::c_int = 101; +pub const SYS_io_setup: ::c_long = 0; +pub const SYS_io_destroy: ::c_long = 1; +pub const SYS_io_submit: ::c_long = 2; +pub const SYS_io_cancel: ::c_long = 3; +pub const SYS_io_getevents: ::c_long = 4; +pub const SYS_setxattr: ::c_long = 5; +pub const SYS_lsetxattr: ::c_long = 6; +pub const SYS_fsetxattr: ::c_long = 7; +pub const SYS_getxattr: ::c_long = 8; +pub const SYS_lgetxattr: ::c_long = 9; +pub const SYS_fgetxattr: ::c_long = 10; +pub const SYS_listxattr: ::c_long = 11; +pub const SYS_llistxattr: ::c_long = 12; +pub const SYS_flistxattr: ::c_long = 13; +pub const SYS_removexattr: ::c_long = 14; +pub const SYS_lremovexattr: ::c_long = 15; +pub const SYS_fremovexattr: ::c_long = 16; +pub const SYS_getcwd: ::c_long = 17; +pub const SYS_lookup_dcookie: ::c_long = 18; +pub const SYS_eventfd2: ::c_long = 19; +pub const SYS_epoll_create1: ::c_long = 20; +pub const SYS_epoll_ctl: ::c_long = 21; +pub const SYS_epoll_pwait: ::c_long = 22; +pub const SYS_dup: ::c_long = 23; +pub const SYS_dup3: ::c_long = 24; +pub const SYS_fcntl: ::c_long = 25; +pub const SYS_inotify_init1: ::c_long = 26; +pub const SYS_inotify_add_watch: ::c_long = 27; +pub const SYS_inotify_rm_watch: ::c_long = 28; +pub const SYS_ioctl: ::c_long = 29; +pub const SYS_ioprio_set: ::c_long = 30; +pub const SYS_ioprio_get: ::c_long = 31; +pub const SYS_flock: ::c_long = 32; +pub const SYS_mknodat: ::c_long = 33; +pub const SYS_mkdirat: ::c_long = 34; +pub const SYS_unlinkat: ::c_long = 35; +pub const SYS_symlinkat: ::c_long = 36; +pub const SYS_linkat: ::c_long = 37; +pub const SYS_renameat: ::c_long = 38; +pub const SYS_umount2: ::c_long = 39; +pub const SYS_mount: ::c_long = 40; +pub const SYS_pivot_root: ::c_long = 41; +pub const SYS_nfsservctl: ::c_long = 42; +pub const SYS_fallocate: ::c_long = 47; +pub const SYS_faccessat: ::c_long = 48; +pub const SYS_chdir: ::c_long = 49; +pub const SYS_fchdir: ::c_long = 50; +pub const SYS_chroot: ::c_long = 51; +pub const SYS_fchmod: ::c_long = 52; +pub const SYS_fchmodat: ::c_long = 53; +pub const SYS_fchownat: ::c_long = 54; +pub const SYS_fchown: ::c_long = 55; +pub const SYS_openat: ::c_long = 56; +pub const SYS_close: ::c_long = 57; +pub const SYS_vhangup: ::c_long = 58; +pub const SYS_pipe2: ::c_long = 59; +pub const SYS_quotactl: ::c_long = 60; +pub const SYS_getdents64: ::c_long = 61; +pub const SYS_lseek: ::c_long = 62; +pub const SYS_read: ::c_long = 63; +pub const SYS_write: ::c_long = 64; +pub const SYS_readv: ::c_long = 65; +pub const SYS_writev: ::c_long = 66; +pub const SYS_pread64: ::c_long = 67; +pub const SYS_pwrite64: ::c_long = 68; +pub const SYS_preadv: ::c_long = 69; +pub const SYS_pwritev: ::c_long = 70; +pub const SYS_pselect6: ::c_long = 72; +pub const SYS_ppoll: ::c_long = 73; +pub const SYS_signalfd4: ::c_long = 74; +pub const SYS_vmsplice: ::c_long = 75; +pub const SYS_splice: ::c_long = 76; +pub const SYS_tee: ::c_long = 77; +pub const SYS_readlinkat: ::c_long = 78; +pub const SYS_newfstatat: ::c_long = 79; +pub const SYS_fstat: ::c_long = 80; +pub const SYS_sync: ::c_long = 81; +pub const SYS_fsync: ::c_long = 82; +pub const SYS_fdatasync: ::c_long = 83; +pub const SYS_sync_file_range: ::c_long = 84; +pub const SYS_timerfd_create: ::c_long = 85; +pub const SYS_timerfd_settime: ::c_long = 86; +pub const SYS_timerfd_gettime: ::c_long = 87; +pub const SYS_utimensat: ::c_long = 88; +pub const SYS_acct: ::c_long = 89; +pub const SYS_capget: ::c_long = 90; +pub const SYS_capset: ::c_long = 91; +pub const SYS_personality: ::c_long = 92; +pub const SYS_exit: ::c_long = 93; +pub const SYS_exit_group: ::c_long = 94; +pub const SYS_waitid: ::c_long = 95; +pub const SYS_set_tid_address: ::c_long = 96; +pub const SYS_unshare: ::c_long = 97; +pub const SYS_futex: ::c_long = 98; +pub const SYS_set_robust_list: ::c_long = 99; +pub const SYS_get_robust_list: ::c_long = 100; +pub const SYS_nanosleep: ::c_long = 101; +pub const SYS_getitimer: ::c_long = 102; +pub const SYS_setitimer: ::c_long = 103; +pub const SYS_kexec_load: ::c_long = 104; +pub const SYS_init_module: ::c_long = 105; +pub const SYS_delete_module: ::c_long = 106; +pub const SYS_timer_create: ::c_long = 107; +pub const SYS_timer_gettime: ::c_long = 108; +pub const SYS_timer_getoverrun: ::c_long = 109; +pub const SYS_timer_settime: ::c_long = 110; +pub const SYS_timer_delete: ::c_long = 111; +pub const SYS_clock_settime: ::c_long = 112; +pub const SYS_clock_gettime: ::c_long = 113; +pub const SYS_clock_getres: ::c_long = 114; +pub const SYS_clock_nanosleep: ::c_long = 115; +pub const SYS_syslog: ::c_long = 116; +pub const SYS_ptrace: ::c_long = 117; +pub const SYS_sched_setparam: ::c_long = 118; +pub const SYS_sched_setscheduler: ::c_long = 119; +pub const SYS_sched_getscheduler: ::c_long = 120; +pub const SYS_sched_getparam: ::c_long = 121; +pub const SYS_sched_setaffinity: ::c_long = 122; +pub const SYS_sched_getaffinity: ::c_long = 123; +pub const SYS_sched_yield: ::c_long = 124; +pub const SYS_sched_get_priority_max: ::c_long = 125; +pub const SYS_sched_get_priority_min: ::c_long = 126; +pub const SYS_sched_rr_get_interval: ::c_long = 127; +pub const SYS_restart_syscall: ::c_long = 128; +pub const SYS_kill: ::c_long = 129; +pub const SYS_tkill: ::c_long = 130; +pub const SYS_tgkill: ::c_long = 131; +pub const SYS_sigaltstack: ::c_long = 132; +pub const SYS_rt_sigsuspend: ::c_long = 133; +pub const SYS_rt_sigaction: ::c_long = 134; +pub const SYS_rt_sigprocmask: ::c_long = 135; +pub const SYS_rt_sigpending: ::c_long = 136; +pub const SYS_rt_sigtimedwait: ::c_long = 137; +pub const SYS_rt_sigqueueinfo: ::c_long = 138; +pub const SYS_rt_sigreturn: ::c_long = 139; +pub const SYS_setpriority: ::c_long = 140; +pub const SYS_getpriority: ::c_long = 141; +pub const SYS_reboot: ::c_long = 142; +pub const SYS_setregid: ::c_long = 143; +pub const SYS_setgid: ::c_long = 144; +pub const SYS_setreuid: ::c_long = 145; +pub const SYS_setuid: ::c_long = 146; +pub const SYS_setresuid: ::c_long = 147; +pub const SYS_getresuid: ::c_long = 148; +pub const SYS_setresgid: ::c_long = 149; +pub const SYS_getresgid: ::c_long = 150; +pub const SYS_setfsuid: ::c_long = 151; +pub const SYS_setfsgid: ::c_long = 152; +pub const SYS_times: ::c_long = 153; +pub const SYS_setpgid: ::c_long = 154; +pub const SYS_getpgid: ::c_long = 155; +pub const SYS_getsid: ::c_long = 156; +pub const SYS_setsid: ::c_long = 157; +pub const SYS_getgroups: ::c_long = 158; +pub const SYS_setgroups: ::c_long = 159; +pub const SYS_uname: ::c_long = 160; +pub const SYS_sethostname: ::c_long = 161; +pub const SYS_setdomainname: ::c_long = 162; +pub const SYS_getrlimit: ::c_long = 163; +pub const SYS_setrlimit: ::c_long = 164; +pub const SYS_getrusage: ::c_long = 165; +pub const SYS_umask: ::c_long = 166; +pub const SYS_prctl: ::c_long = 167; +pub const SYS_getcpu: ::c_long = 168; +pub const SYS_gettimeofday: ::c_long = 169; +pub const SYS_settimeofday: ::c_long = 170; +pub const SYS_adjtimex: ::c_long = 171; +pub const SYS_getpid: ::c_long = 172; +pub const SYS_getppid: ::c_long = 173; +pub const SYS_getuid: ::c_long = 174; +pub const SYS_geteuid: ::c_long = 175; +pub const SYS_getgid: ::c_long = 176; +pub const SYS_getegid: ::c_long = 177; +pub const SYS_gettid: ::c_long = 178; +pub const SYS_sysinfo: ::c_long = 179; +pub const SYS_mq_open: ::c_long = 180; +pub const SYS_mq_unlink: ::c_long = 181; +pub const SYS_mq_timedsend: ::c_long = 182; +pub const SYS_mq_timedreceive: ::c_long = 183; +pub const SYS_mq_notify: ::c_long = 184; +pub const SYS_mq_getsetattr: ::c_long = 185; +pub const SYS_msgget: ::c_long = 186; +pub const SYS_msgctl: ::c_long = 187; +pub const SYS_msgrcv: ::c_long = 188; +pub const SYS_msgsnd: ::c_long = 189; +pub const SYS_semget: ::c_long = 190; +pub const SYS_semctl: ::c_long = 191; +pub const SYS_semtimedop: ::c_long = 192; +pub const SYS_semop: ::c_long = 193; +pub const SYS_shmget: ::c_long = 194; +pub const SYS_shmctl: ::c_long = 195; +pub const SYS_shmat: ::c_long = 196; +pub const SYS_shmdt: ::c_long = 197; +pub const SYS_socket: ::c_long = 198; +pub const SYS_socketpair: ::c_long = 199; +pub const SYS_bind: ::c_long = 200; +pub const SYS_listen: ::c_long = 201; +pub const SYS_accept: ::c_long = 202; +pub const SYS_connect: ::c_long = 203; +pub const SYS_getsockname: ::c_long = 204; +pub const SYS_getpeername: ::c_long = 205; +pub const SYS_sendto: ::c_long = 206; +pub const SYS_recvfrom: ::c_long = 207; +pub const SYS_setsockopt: ::c_long = 208; +pub const SYS_getsockopt: ::c_long = 209; +pub const SYS_shutdown: ::c_long = 210; +pub const SYS_sendmsg: ::c_long = 211; +pub const SYS_recvmsg: ::c_long = 212; +pub const SYS_readahead: ::c_long = 213; +pub const SYS_brk: ::c_long = 214; +pub const SYS_munmap: ::c_long = 215; +pub const SYS_mremap: ::c_long = 216; +pub const SYS_add_key: ::c_long = 217; +pub const SYS_request_key: ::c_long = 218; +pub const SYS_keyctl: ::c_long = 219; +pub const SYS_clone: ::c_long = 220; +pub const SYS_execve: ::c_long = 221; +pub const SYS_mmap: ::c_long = 222; +pub const SYS_swapon: ::c_long = 224; +pub const SYS_swapoff: ::c_long = 225; +pub const SYS_mprotect: ::c_long = 226; +pub const SYS_msync: ::c_long = 227; +pub const SYS_mlock: ::c_long = 228; +pub const SYS_munlock: ::c_long = 229; +pub const SYS_mlockall: ::c_long = 230; +pub const SYS_munlockall: ::c_long = 231; +pub const SYS_mincore: ::c_long = 232; +pub const SYS_madvise: ::c_long = 233; +pub const SYS_remap_file_pages: ::c_long = 234; +pub const SYS_mbind: ::c_long = 235; +pub const SYS_get_mempolicy: ::c_long = 236; +pub const SYS_set_mempolicy: ::c_long = 237; +pub const SYS_migrate_pages: ::c_long = 238; +pub const SYS_move_pages: ::c_long = 239; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 240; +pub const SYS_perf_event_open: ::c_long = 241; +pub const SYS_accept4: ::c_long = 242; +pub const SYS_recvmmsg: ::c_long = 243; +pub const SYS_wait4: ::c_long = 260; +pub const SYS_prlimit64: ::c_long = 261; +pub const SYS_fanotify_init: ::c_long = 262; +pub const SYS_fanotify_mark: ::c_long = 263; +pub const SYS_name_to_handle_at: ::c_long = 264; +pub const SYS_open_by_handle_at: ::c_long = 265; +pub const SYS_clock_adjtime: ::c_long = 266; +pub const SYS_syncfs: ::c_long = 267; +pub const SYS_setns: ::c_long = 268; +pub const SYS_sendmmsg: ::c_long = 269; +pub const SYS_process_vm_readv: ::c_long = 270; +pub const SYS_process_vm_writev: ::c_long = 271; +pub const SYS_kcmp: ::c_long = 272; +pub const SYS_finit_module: ::c_long = 273; +pub const SYS_sched_setattr: ::c_long = 274; +pub const SYS_sched_getattr: ::c_long = 275; +pub const SYS_renameat2: ::c_long = 276; +pub const SYS_seccomp: ::c_long = 277; +pub const SYS_getrandom: ::c_long = 278; +pub const SYS_memfd_create: ::c_long = 279; +pub const SYS_bpf: ::c_long = 280; +pub const SYS_execveat: ::c_long = 281; +pub const SYS_userfaultfd: ::c_long = 282; +pub const SYS_membarrier: ::c_long = 283; +pub const SYS_mlock2: ::c_long = 284; +pub const SYS_copy_file_range: ::c_long = 285; +pub const SYS_preadv2: ::c_long = 286; +pub const SYS_pwritev2: ::c_long = 287; +pub const SYS_pkey_mprotect: ::c_long = 288; +pub const SYS_pkey_alloc: ::c_long = 289; +pub const SYS_pkey_free: ::c_long = 290; + +pub const RLIMIT_NLIMITS: ::c_int = 15; +pub const TIOCINQ: ::c_int = ::FIONREAD; +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; +pub const CBAUD: ::tcflag_t = 0o0010017; +pub const TAB1: ::c_int = 0x00000800; +pub const TAB2: ::c_int = 0x00001000; +pub const TAB3: ::c_int = 0x00001800; +pub const CR1: ::c_int = 0x00000200; +pub const CR2: ::c_int = 0x00000400; +pub const CR3: ::c_int = 0x00000600; +pub const FF1: ::c_int = 0x00008000; +pub const BS1: ::c_int = 0x00002000; +pub const VT1: ::c_int = 0x00004000; +pub const VWERASE: usize = 14; +pub const VREPRINT: usize = 12; +pub const VSUSP: usize = 10; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VDISCARD: usize = 13; +pub const VTIME: usize = 5; +pub const IXON: ::tcflag_t = 0x00000400; +pub const IXOFF: ::tcflag_t = 0x00001000; +pub const ONLCR: ::tcflag_t = 0x4; +pub const CSIZE: ::tcflag_t = 0x00000030; +pub const CS6: ::tcflag_t = 0x00000010; +pub const CS7: ::tcflag_t = 0x00000020; +pub const CS8: ::tcflag_t = 0x00000030; +pub const CSTOPB: ::tcflag_t = 0x00000040; +pub const CREAD: ::tcflag_t = 0x00000080; +pub const PARENB: ::tcflag_t = 0x00000100; +pub const PARODD: ::tcflag_t = 0x00000200; +pub const HUPCL: ::tcflag_t = 0x00000400; +pub const CLOCAL: ::tcflag_t = 0x00000800; +pub const ECHOKE: ::tcflag_t = 0x00000800; +pub const ECHOE: ::tcflag_t = 0x00000010; +pub const ECHOK: ::tcflag_t = 0x00000020; +pub const ECHONL: ::tcflag_t = 0x00000040; +pub const ECHOPRT: ::tcflag_t = 0x00000400; +pub const ECHOCTL: ::tcflag_t = 0x00000200; +pub const ISIG: ::tcflag_t = 0x00000001; +pub const ICANON: ::tcflag_t = 0x00000002; +pub const PENDIN: ::tcflag_t = 0x00004000; +pub const NOFLSH: ::tcflag_t = 0x00000080; +pub const CIBAUD: ::tcflag_t = 0o02003600000; +pub const CBAUDEX: ::tcflag_t = 0o010000; +pub const VSWTC: usize = 7; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const XTABS: ::tcflag_t = 0o014000; +pub const B57600: ::speed_t = 0o010001; +pub const B115200: ::speed_t = 0o010002; +pub const B230400: ::speed_t = 0o010003; +pub const B460800: ::speed_t = 0o010004; +pub const B500000: ::speed_t = 0o010005; +pub const B576000: ::speed_t = 0o010006; +pub const B921600: ::speed_t = 0o010007; +pub const B1000000: ::speed_t = 0o010010; +pub const B1152000: ::speed_t = 0o010011; +pub const B1500000: ::speed_t = 0o010012; +pub const B2000000: ::speed_t = 0o010013; +pub const B2500000: ::speed_t = 0o010014; +pub const B3000000: ::speed_t = 0o010015; +pub const B3500000: ::speed_t = 0o010016; +pub const B4000000: ::speed_t = 0o010017; + +pub const FIOCLEX: ::c_int = 0x5451; +pub const FIONCLEX: ::c_int = 0x5450; +pub const FIONBIO: ::c_int = 0x5421; +pub const EDEADLK: ::c_int = 35; +pub const EDEADLOCK: ::c_int = EDEADLK; +pub const SO_PASSCRED: ::c_int = 16; +pub const SO_PEERCRED: ::c_int = 17; +pub const SO_RCVLOWAT: ::c_int = 18; +pub const SO_SNDLOWAT: ::c_int = 19; +pub const SO_RCVTIMEO: ::c_int = 20; +pub const SO_SNDTIMEO: ::c_int = 21; +pub const EXTPROC: ::tcflag_t = 0x00010000; +pub const VEOL: usize = 11; +pub const VEOL2: usize = 16; +pub const VMIN: usize = 6; +pub const IEXTEN: ::tcflag_t = 0x00008000; +pub const TOSTOP: ::tcflag_t = 0x00000100; +pub const FLUSHO: ::tcflag_t = 0x00001000; +pub const TCGETS: ::c_int = 0x5401; +pub const TCSETS: ::c_int = 0x5402; +pub const TCSETSW: ::c_int = 0x5403; +pub const TCSETSF: ::c_int = 0x5404; +pub const TCGETA: ::c_int = 0x5405; +pub const TCSETA: ::c_int = 0x5406; +pub const TCSETAW: ::c_int = 0x5407; +pub const TCSETAF: ::c_int = 0x5408; +pub const TCSBRK: ::c_int = 0x5409; +pub const TCXONC: ::c_int = 0x540A; +pub const TCFLSH: ::c_int = 0x540B; +pub const TIOCGSOFTCAR: ::c_int = 0x5419; +pub const TIOCSSOFTCAR: ::c_int = 0x541A; +pub const TIOCLINUX: ::c_int = 0x541C; +pub const TIOCGSERIAL: ::c_int = 0x541E; +pub const TIOCEXCL: ::c_int = 0x540C; +pub const TIOCNXCL: ::c_int = 0x540D; +pub const TIOCSCTTY: ::c_int = 0x540E; +pub const TIOCGPGRP: ::c_int = 0x540F; +pub const TIOCSPGRP: ::c_int = 0x5410; +pub const TIOCOUTQ: ::c_int = 0x5411; +pub const TIOCSTI: ::c_int = 0x5412; +pub const TIOCGWINSZ: ::c_int = 0x5413; +pub const TIOCSWINSZ: ::c_int = 0x5414; +pub const TIOCMGET: ::c_int = 0x5415; +pub const TIOCMBIS: ::c_int = 0x5416; +pub const TIOCMBIC: ::c_int = 0x5417; +pub const TIOCMSET: ::c_int = 0x5418; +pub const FIONREAD: ::c_int = 0x541B; +pub const TIOCCONS: ::c_int = 0x541D; + +pub const TIOCGRS485: ::c_int = 0x542E; +pub const TIOCSRS485: ::c_int = 0x542F; + +pub const TIOCM_LE: ::c_int = 0x001; +pub const TIOCM_DTR: ::c_int = 0x002; +pub const TIOCM_RTS: ::c_int = 0x004; +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; +pub const TIOCM_CD: ::c_int = TIOCM_CAR; +pub const TIOCM_RI: ::c_int = TIOCM_RNG; + +extern { + pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/b64/mod.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/b64/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/b64/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/b64/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,336 @@ +pub type c_long = i64; +pub type c_ulong = u64; + +s! { + pub struct statfs64 { + pub f_type: ::c_ulong, + pub f_bsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_flags: ::c_ulong, + pub f_spare: [::c_ulong; 4], + } + + pub struct statvfs64 { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_favail: u64, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_flags: ::c_int, + pub ss_size: ::size_t + } + + pub struct pthread_attr_t { + __size: [u64; 7] + } + + pub struct sigset_t { + __val: [::c_ulong; 16], + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_atime: ::time_t, + pub shm_dtime: ::time_t, + pub shm_ctime: ::time_t, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, + pub shm_nattch: ::c_ulong, + __pad1: ::c_ulong, + __pad2: ::c_ulong, + } + + pub struct msqid_ds { + pub msg_perm: ::ipc_perm, + pub msg_stime: ::time_t, + pub msg_rtime: ::time_t, + pub msg_ctime: ::time_t, + __msg_cbytes: ::c_ulong, + pub msg_qnum: ::msgqnum_t, + pub msg_qbytes: ::msglen_t, + pub msg_lspid: ::pid_t, + pub msg_lrpid: ::pid_t, + __pad1: ::c_ulong, + __pad2: ::c_ulong, + } + + pub struct statfs { + pub f_type: ::c_ulong, + pub f_bsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_flags: ::c_ulong, + pub f_spare: [::c_ulong; 4], + } + + pub struct msghdr { + pub msg_name: *mut ::c_void, + pub msg_namelen: ::socklen_t, + pub msg_iov: *mut ::iovec, + #[cfg(target_endian = "big")] + __pad1: ::c_int, + pub msg_iovlen: ::c_int, + #[cfg(target_endian = "little")] + __pad1: ::c_int, + pub msg_control: *mut ::c_void, + #[cfg(target_endian = "big")] + __pad2: ::c_int, + pub msg_controllen: ::socklen_t, + #[cfg(target_endian = "little")] + __pad2: ::c_int, + pub msg_flags: ::c_int, + } + + pub struct cmsghdr { + #[cfg(target_endian = "big")] + pub __pad1: ::c_int, + pub cmsg_len: ::socklen_t, + #[cfg(target_endian = "little")] + pub __pad1: ::c_int, + pub cmsg_level: ::c_int, + pub cmsg_type: ::c_int, + } + + pub struct sem_t { + __val: [::c_int; 8], + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + pub _pad: [::c_int; 29], + _align: [usize; 0], + } +} + +pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; + +pub const O_ASYNC: ::c_int = 0x2000; + +pub const RLIMIT_RSS: ::c_int = 5; +pub const RLIMIT_NOFILE: ::c_int = 7; +pub const RLIMIT_AS: ::c_int = 9; +pub const RLIMIT_NPROC: ::c_int = 6; +pub const RLIMIT_MEMLOCK: ::c_int = 8; + +pub const O_APPEND: ::c_int = 1024; +pub const O_CREAT: ::c_int = 64; +pub const O_EXCL: ::c_int = 128; +pub const O_NOCTTY: ::c_int = 256; +pub const O_NONBLOCK: ::c_int = 2048; +pub const O_SYNC: ::c_int = 1052672; +pub const O_RSYNC: ::c_int = 1052672; +pub const O_DSYNC: ::c_int = 4096; + +pub const SOCK_NONBLOCK: ::c_int = 2048; + +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_GROWSDOWN: ::c_int = 0x0100; +pub const MAP_DENYWRITE: ::c_int = 0x0800; +pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_LOCKED: ::c_int = 0x02000; +pub const MAP_NORESERVE: ::c_int = 0x04000; +pub const MAP_POPULATE: ::c_int = 0x08000; +pub const MAP_NONBLOCK: ::c_int = 0x010000; +pub const MAP_STACK: ::c_int = 0x020000; + +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; +pub const SOCK_SEQPACKET: ::c_int = 5; + +pub const SOL_SOCKET: ::c_int = 1; + +pub const ENAMETOOLONG: ::c_int = 36; +pub const ENOLCK: ::c_int = 37; +pub const ENOSYS: ::c_int = 38; +pub const ENOTEMPTY: ::c_int = 39; +pub const ELOOP: ::c_int = 40; +pub const ENOMSG: ::c_int = 42; +pub const EIDRM: ::c_int = 43; +pub const ECHRNG: ::c_int = 44; +pub const EL2NSYNC: ::c_int = 45; +pub const EL3HLT: ::c_int = 46; +pub const EL3RST: ::c_int = 47; +pub const ELNRNG: ::c_int = 48; +pub const EUNATCH: ::c_int = 49; +pub const ENOCSI: ::c_int = 50; +pub const EL2HLT: ::c_int = 51; +pub const EBADE: ::c_int = 52; +pub const EBADR: ::c_int = 53; +pub const EXFULL: ::c_int = 54; +pub const ENOANO: ::c_int = 55; +pub const EBADRQC: ::c_int = 56; +pub const EBADSLT: ::c_int = 57; +pub const EMULTIHOP: ::c_int = 72; +pub const EBADMSG: ::c_int = 74; +pub const EOVERFLOW: ::c_int = 75; +pub const ENOTUNIQ: ::c_int = 76; +pub const EBADFD: ::c_int = 77; +pub const EREMCHG: ::c_int = 78; +pub const ELIBACC: ::c_int = 79; +pub const ELIBBAD: ::c_int = 80; +pub const ELIBSCN: ::c_int = 81; +pub const ELIBMAX: ::c_int = 82; +pub const ELIBEXEC: ::c_int = 83; +pub const EILSEQ: ::c_int = 84; +pub const ERESTART: ::c_int = 85; +pub const ESTRPIPE: ::c_int = 86; +pub const EUSERS: ::c_int = 87; +pub const ENOTSOCK: ::c_int = 88; +pub const EDESTADDRREQ: ::c_int = 89; +pub const EMSGSIZE: ::c_int = 90; +pub const EPROTOTYPE: ::c_int = 91; +pub const ENOPROTOOPT: ::c_int = 92; +pub const EPROTONOSUPPORT: ::c_int = 93; +pub const ESOCKTNOSUPPORT: ::c_int = 94; +pub const EOPNOTSUPP: ::c_int = 95; +pub const ENOTSUP: ::c_int = EOPNOTSUPP; +pub const EPFNOSUPPORT: ::c_int = 96; +pub const EAFNOSUPPORT: ::c_int = 97; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const ENETDOWN: ::c_int = 100; +pub const ENETUNREACH: ::c_int = 101; +pub const ENETRESET: ::c_int = 102; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNRESET: ::c_int = 104; +pub const ENOBUFS: ::c_int = 105; +pub const EISCONN: ::c_int = 106; +pub const ENOTCONN: ::c_int = 107; +pub const ESHUTDOWN: ::c_int = 108; +pub const ETOOMANYREFS: ::c_int = 109; +pub const ETIMEDOUT: ::c_int = 110; +pub const ECONNREFUSED: ::c_int = 111; +pub const EHOSTDOWN: ::c_int = 112; +pub const EHOSTUNREACH: ::c_int = 113; +pub const EALREADY: ::c_int = 114; +pub const EINPROGRESS: ::c_int = 115; +pub const ESTALE: ::c_int = 116; +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; +pub const EDQUOT: ::c_int = 122; +pub const ENOMEDIUM: ::c_int = 123; +pub const EMEDIUMTYPE: ::c_int = 124; +pub const ECANCELED: ::c_int = 125; +pub const ENOKEY: ::c_int = 126; +pub const EKEYEXPIRED: ::c_int = 127; +pub const EKEYREVOKED: ::c_int = 128; +pub const EKEYREJECTED: ::c_int = 129; +pub const EOWNERDEAD: ::c_int = 130; +pub const ENOTRECOVERABLE: ::c_int = 131; +pub const ERFKILL: ::c_int = 132; +pub const EHWPOISON: ::c_int = 133; + +pub const SO_REUSEADDR: ::c_int = 2; +pub const SO_TYPE: ::c_int = 3; +pub const SO_ERROR: ::c_int = 4; +pub const SO_DONTROUTE: ::c_int = 5; +pub const SO_BROADCAST: ::c_int = 6; +pub const SO_SNDBUF: ::c_int = 7; +pub const SO_RCVBUF: ::c_int = 8; +pub const SO_KEEPALIVE: ::c_int = 9; +pub const SO_OOBINLINE: ::c_int = 10; +pub const SO_NO_CHECK: ::c_int = 11; +pub const SO_PRIORITY: ::c_int = 12; +pub const SO_LINGER: ::c_int = 13; +pub const SO_BSDCOMPAT: ::c_int = 14; +pub const SO_REUSEPORT: ::c_int = 15; +pub const SO_ACCEPTCONN: ::c_int = 30; +pub const SO_SNDBUFFORCE: ::c_int = 32; +pub const SO_RCVBUFFORCE: ::c_int = 33; +pub const SO_PROTOCOL: ::c_int = 38; +pub const SO_DOMAIN: ::c_int = 39; + +pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_SIGINFO: ::c_int = 0x00000004; +pub const SA_NOCLDWAIT: ::c_int = 0x00000002; + +pub const SIGCHLD: ::c_int = 17; +pub const SIGBUS: ::c_int = 7; +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; +pub const SIGUSR1: ::c_int = 10; +pub const SIGUSR2: ::c_int = 12; +pub const SIGCONT: ::c_int = 18; +pub const SIGSTOP: ::c_int = 19; +pub const SIGTSTP: ::c_int = 20; +pub const SIGURG: ::c_int = 23; +pub const SIGIO: ::c_int = 29; +pub const SIGSYS: ::c_int = 31; +pub const SIGSTKFLT: ::c_int = 16; +pub const SIGPOLL: ::c_int = 29; +pub const SIGPWR: ::c_int = 30; +pub const SIG_SETMASK: ::c_int = 2; +pub const SIG_BLOCK: ::c_int = 0x000000; +pub const SIG_UNBLOCK: ::c_int = 0x01; + +pub const MAP_HUGETLB: ::c_int = 0x040000; + +pub const F_GETLK: ::c_int = 5; +pub const F_GETOWN: ::c_int = 9; +pub const F_SETLK: ::c_int = 6; +pub const F_SETLKW: ::c_int = 7; +pub const F_SETOWN: ::c_int = 8; + +pub const VEOF: usize = 4; + +pub const POLLWRNORM: ::c_short = 0x100; +pub const POLLWRBAND: ::c_short = 0x200; + +extern { + pub fn getrandom( + buf: *mut ::c_void, + buflen: ::size_t, + flags: ::c_uint, + ) -> ::ssize_t; +} + +cfg_if! { + if #[cfg(target_arch = "aarch64")] { + mod aarch64; + pub use self::aarch64::*; + } else if #[cfg(any(target_arch = "powerpc64"))] { + mod powerpc64; + pub use self::powerpc64::*; + } else if #[cfg(any(target_arch = "x86_64"))] { + mod x86_64; + pub use self::x86_64::*; + } else { + // Unknown target_arch + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/b64/powerpc64.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/b64/powerpc64.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/b64/powerpc64.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/b64/powerpc64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,572 @@ +pub type c_char = u8; +pub type wchar_t = i32; +pub type __u64 = ::c_ulong; +pub type nlink_t = u64; +pub type blksize_t = ::c_long; + +s! { + pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_nlink: ::nlink_t, + pub st_mode: ::mode_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + __pad0: ::c_int, + pub st_rdev: ::dev_t, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused: [::c_long; 3], + } + + pub struct stat64 { + pub st_dev: ::dev_t, + pub st_ino: ::ino64_t, + pub st_nlink: ::nlink_t, + pub st_mode: ::mode_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + __pad0: ::c_int, + pub st_rdev: ::dev_t, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt64_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __reserved: [::c_long; 3], + } + + pub struct ipc_perm { + pub __ipc_perm_key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::mode_t, + pub __seq: ::c_int, + __unused1: ::c_long, + __unused2: ::c_long + } +} + +pub const MADV_SOFT_OFFLINE: ::c_int = 101; +pub const MAP_32BIT: ::c_int = 0x0040; +pub const O_DIRECT: ::c_int = 0x20000; +pub const O_DIRECTORY: ::c_int = 0x4000; +pub const O_LARGEFILE: ::c_int = 0x10000; +pub const O_NOFOLLOW: ::c_int = 0x8000; + +pub const SIGSTKSZ: ::size_t = 10240; +pub const MINSIGSTKSZ: ::size_t = 4096; + +// Syscall table +pub const SYS_restart_syscall: ::c_long = 0; +pub const SYS_exit: ::c_long = 1; +pub const SYS_fork: ::c_long = 2; +pub const SYS_read: ::c_long = 3; +pub const SYS_write: ::c_long = 4; +pub const SYS_open: ::c_long = 5; +pub const SYS_close: ::c_long = 6; +pub const SYS_waitpid: ::c_long = 7; +pub const SYS_creat: ::c_long = 8; +pub const SYS_link: ::c_long = 9; +pub const SYS_unlink: ::c_long = 10; +pub const SYS_execve: ::c_long = 11; +pub const SYS_chdir: ::c_long = 12; +pub const SYS_time: ::c_long = 13; +pub const SYS_mknod: ::c_long = 14; +pub const SYS_chmod: ::c_long = 15; +pub const SYS_lchown: ::c_long = 16; +pub const SYS_break: ::c_long = 17; +pub const SYS_oldstat: ::c_long = 18; +pub const SYS_lseek: ::c_long = 19; +pub const SYS_getpid: ::c_long = 20; +pub const SYS_mount: ::c_long = 21; +pub const SYS_umount: ::c_long = 22; +pub const SYS_setuid: ::c_long = 23; +pub const SYS_getuid: ::c_long = 24; +pub const SYS_stime: ::c_long = 25; +pub const SYS_ptrace: ::c_long = 26; +pub const SYS_alarm: ::c_long = 27; +pub const SYS_oldfstat: ::c_long = 28; +pub const SYS_pause: ::c_long = 29; +pub const SYS_utime: ::c_long = 30; +pub const SYS_stty: ::c_long = 31; +pub const SYS_gtty: ::c_long = 32; +pub const SYS_access: ::c_long = 33; +pub const SYS_nice: ::c_long = 34; +pub const SYS_ftime: ::c_long = 35; +pub const SYS_sync: ::c_long = 36; +pub const SYS_kill: ::c_long = 37; +pub const SYS_rename: ::c_long = 38; +pub const SYS_mkdir: ::c_long = 39; +pub const SYS_rmdir: ::c_long = 40; +pub const SYS_dup: ::c_long = 41; +pub const SYS_pipe: ::c_long = 42; +pub const SYS_times: ::c_long = 43; +pub const SYS_prof: ::c_long = 44; +pub const SYS_brk: ::c_long = 45; +pub const SYS_setgid: ::c_long = 46; +pub const SYS_getgid: ::c_long = 47; +pub const SYS_signal: ::c_long = 48; +pub const SYS_geteuid: ::c_long = 49; +pub const SYS_getegid: ::c_long = 50; +pub const SYS_acct: ::c_long = 51; +pub const SYS_umount2: ::c_long = 52; +pub const SYS_lock: ::c_long = 53; +pub const SYS_ioctl: ::c_long = 54; +pub const SYS_fcntl: ::c_long = 55; +pub const SYS_mpx: ::c_long = 56; +pub const SYS_setpgid: ::c_long = 57; +pub const SYS_ulimit: ::c_long = 58; +pub const SYS_oldolduname: ::c_long = 59; +pub const SYS_umask: ::c_long = 60; +pub const SYS_chroot: ::c_long = 61; +pub const SYS_ustat: ::c_long = 62; +pub const SYS_dup2: ::c_long = 63; +pub const SYS_getppid: ::c_long = 64; +pub const SYS_getpgrp: ::c_long = 65; +pub const SYS_setsid: ::c_long = 66; +pub const SYS_sigaction: ::c_long = 67; +pub const SYS_sgetmask: ::c_long = 68; +pub const SYS_ssetmask: ::c_long = 69; +pub const SYS_setreuid: ::c_long = 70; +pub const SYS_setregid: ::c_long = 71; +pub const SYS_sigsuspend: ::c_long = 72; +pub const SYS_sigpending: ::c_long = 73; +pub const SYS_sethostname: ::c_long = 74; +pub const SYS_setrlimit: ::c_long = 75; +pub const SYS_getrlimit: ::c_long = 76; +pub const SYS_getrusage: ::c_long = 77; +pub const SYS_gettimeofday: ::c_long = 78; +pub const SYS_settimeofday: ::c_long = 79; +pub const SYS_getgroups: ::c_long = 80; +pub const SYS_setgroups: ::c_long = 81; +pub const SYS_select: ::c_long = 82; +pub const SYS_symlink: ::c_long = 83; +pub const SYS_oldlstat: ::c_long = 84; +pub const SYS_readlink: ::c_long = 85; +pub const SYS_uselib: ::c_long = 86; +pub const SYS_swapon: ::c_long = 87; +pub const SYS_reboot: ::c_long = 88; +pub const SYS_readdir: ::c_long = 89; +pub const SYS_mmap: ::c_long = 90; +pub const SYS_munmap: ::c_long = 91; +pub const SYS_truncate: ::c_long = 92; +pub const SYS_ftruncate: ::c_long = 93; +pub const SYS_fchmod: ::c_long = 94; +pub const SYS_fchown: ::c_long = 95; +pub const SYS_getpriority: ::c_long = 96; +pub const SYS_setpriority: ::c_long = 97; +pub const SYS_profil: ::c_long = 98; +pub const SYS_statfs: ::c_long = 99; +pub const SYS_fstatfs: ::c_long = 100; +pub const SYS_ioperm: ::c_long = 101; +pub const SYS_socketcall: ::c_long = 102; +pub const SYS_syslog: ::c_long = 103; +pub const SYS_setitimer: ::c_long = 104; +pub const SYS_getitimer: ::c_long = 105; +pub const SYS_stat: ::c_long = 106; +pub const SYS_lstat: ::c_long = 107; +pub const SYS_fstat: ::c_long = 108; +pub const SYS_olduname: ::c_long = 109; +pub const SYS_iopl: ::c_long = 110; +pub const SYS_vhangup: ::c_long = 111; +pub const SYS_idle: ::c_long = 112; +pub const SYS_vm86: ::c_long = 113; +pub const SYS_wait4: ::c_long = 114; +pub const SYS_swapoff: ::c_long = 115; +pub const SYS_sysinfo: ::c_long = 116; +pub const SYS_ipc: ::c_long = 117; +pub const SYS_fsync: ::c_long = 118; +pub const SYS_sigreturn: ::c_long = 119; +pub const SYS_clone: ::c_long = 120; +pub const SYS_setdomainname: ::c_long = 121; +pub const SYS_uname: ::c_long = 122; +pub const SYS_modify_ldt: ::c_long = 123; +pub const SYS_adjtimex: ::c_long = 124; +pub const SYS_mprotect: ::c_long = 125; +pub const SYS_sigprocmask: ::c_long = 126; +pub const SYS_create_module: ::c_long = 127; +pub const SYS_init_module: ::c_long = 128; +pub const SYS_delete_module: ::c_long = 129; +pub const SYS_get_kernel_syms: ::c_long = 130; +pub const SYS_quotactl: ::c_long = 131; +pub const SYS_getpgid: ::c_long = 132; +pub const SYS_fchdir: ::c_long = 133; +pub const SYS_bdflush: ::c_long = 134; +pub const SYS_sysfs: ::c_long = 135; +pub const SYS_personality: ::c_long = 136; +pub const SYS_afs_syscall: ::c_long = 137; /* Syscall for Andrew File System */ +pub const SYS_setfsuid: ::c_long = 138; +pub const SYS_setfsgid: ::c_long = 139; +pub const SYS__llseek: ::c_long = 140; +pub const SYS_getdents: ::c_long = 141; +pub const SYS__newselect: ::c_long = 142; +pub const SYS_flock: ::c_long = 143; +pub const SYS_msync: ::c_long = 144; +pub const SYS_readv: ::c_long = 145; +pub const SYS_writev: ::c_long = 146; +pub const SYS_getsid: ::c_long = 147; +pub const SYS_fdatasync: ::c_long = 148; +pub const SYS__sysctl: ::c_long = 149; +pub const SYS_mlock: ::c_long = 150; +pub const SYS_munlock: ::c_long = 151; +pub const SYS_mlockall: ::c_long = 152; +pub const SYS_munlockall: ::c_long = 153; +pub const SYS_sched_setparam: ::c_long = 154; +pub const SYS_sched_getparam: ::c_long = 155; +pub const SYS_sched_setscheduler: ::c_long = 156; +pub const SYS_sched_getscheduler: ::c_long = 157; +pub const SYS_sched_yield: ::c_long = 158; +pub const SYS_sched_get_priority_max: ::c_long = 159; +pub const SYS_sched_get_priority_min: ::c_long = 160; +pub const SYS_sched_rr_get_interval: ::c_long = 161; +pub const SYS_nanosleep: ::c_long = 162; +pub const SYS_mremap: ::c_long = 163; +pub const SYS_setresuid: ::c_long = 164; +pub const SYS_getresuid: ::c_long = 165; +pub const SYS_query_module: ::c_long = 166; +pub const SYS_poll: ::c_long = 167; +pub const SYS_nfsservctl: ::c_long = 168; +pub const SYS_setresgid: ::c_long = 169; +pub const SYS_getresgid: ::c_long = 170; +pub const SYS_prctl: ::c_long = 171; +pub const SYS_rt_sigreturn: ::c_long = 172; +pub const SYS_rt_sigaction: ::c_long = 173; +pub const SYS_rt_sigprocmask: ::c_long = 174; +pub const SYS_rt_sigpending: ::c_long = 175; +pub const SYS_rt_sigtimedwait: ::c_long = 176; +pub const SYS_rt_sigqueueinfo: ::c_long = 177; +pub const SYS_rt_sigsuspend: ::c_long = 178; +pub const SYS_pread64: ::c_long = 179; +pub const SYS_pwrite64: ::c_long = 180; +pub const SYS_chown: ::c_long = 181; +pub const SYS_getcwd: ::c_long = 182; +pub const SYS_capget: ::c_long = 183; +pub const SYS_capset: ::c_long = 184; +pub const SYS_sigaltstack: ::c_long = 185; +pub const SYS_sendfile: ::c_long = 186; +pub const SYS_getpmsg: ::c_long = 187; /* some people actually want streams */ +pub const SYS_putpmsg: ::c_long = 188; /* some people actually want streams */ +pub const SYS_vfork: ::c_long = 189; +pub const SYS_ugetrlimit: ::c_long = 190; /* SuS compliant getrlimit */ +pub const SYS_readahead: ::c_long = 191; +pub const SYS_pciconfig_read: ::c_long = 198; +pub const SYS_pciconfig_write: ::c_long = 199; +pub const SYS_pciconfig_iobase: ::c_long = 200; +pub const SYS_multiplexer: ::c_long = 201; +pub const SYS_getdents64: ::c_long = 202; +pub const SYS_pivot_root: ::c_long = 203; +pub const SYS_madvise: ::c_long = 205; +pub const SYS_mincore: ::c_long = 206; +pub const SYS_gettid: ::c_long = 207; +pub const SYS_tkill: ::c_long = 208; +pub const SYS_setxattr: ::c_long = 209; +pub const SYS_lsetxattr: ::c_long = 210; +pub const SYS_fsetxattr: ::c_long = 211; +pub const SYS_getxattr: ::c_long = 212; +pub const SYS_lgetxattr: ::c_long = 213; +pub const SYS_fgetxattr: ::c_long = 214; +pub const SYS_listxattr: ::c_long = 215; +pub const SYS_llistxattr: ::c_long = 216; +pub const SYS_flistxattr: ::c_long = 217; +pub const SYS_removexattr: ::c_long = 218; +pub const SYS_lremovexattr: ::c_long = 219; +pub const SYS_fremovexattr: ::c_long = 220; +pub const SYS_futex: ::c_long = 221; +pub const SYS_sched_setaffinity: ::c_long = 222; +pub const SYS_sched_getaffinity: ::c_long = 223; +pub const SYS_tuxcall: ::c_long = 225; +pub const SYS_io_setup: ::c_long = 227; +pub const SYS_io_destroy: ::c_long = 228; +pub const SYS_io_getevents: ::c_long = 229; +pub const SYS_io_submit: ::c_long = 230; +pub const SYS_io_cancel: ::c_long = 231; +pub const SYS_set_tid_address: ::c_long = 232; +pub const SYS_exit_group: ::c_long = 234; +pub const SYS_lookup_dcookie: ::c_long = 235; +pub const SYS_epoll_create: ::c_long = 236; +pub const SYS_epoll_ctl: ::c_long = 237; +pub const SYS_epoll_wait: ::c_long = 238; +pub const SYS_remap_file_pages: ::c_long = 239; +pub const SYS_timer_create: ::c_long = 240; +pub const SYS_timer_settime: ::c_long = 241; +pub const SYS_timer_gettime: ::c_long = 242; +pub const SYS_timer_getoverrun: ::c_long = 243; +pub const SYS_timer_delete: ::c_long = 244; +pub const SYS_clock_settime: ::c_long = 245; +pub const SYS_clock_gettime: ::c_long = 246; +pub const SYS_clock_getres: ::c_long = 247; +pub const SYS_clock_nanosleep: ::c_long = 248; +pub const SYS_swapcontext: ::c_long = 249; +pub const SYS_tgkill: ::c_long = 250; +pub const SYS_utimes: ::c_long = 251; +pub const SYS_statfs64: ::c_long = 252; +pub const SYS_fstatfs64: ::c_long = 253; +pub const SYS_rtas: ::c_long = 255; +pub const SYS_sys_debug_setcontext: ::c_long = 256; +pub const SYS_migrate_pages: ::c_long = 258; +pub const SYS_mbind: ::c_long = 259; +pub const SYS_get_mempolicy: ::c_long = 260; +pub const SYS_set_mempolicy: ::c_long = 261; +pub const SYS_mq_open: ::c_long = 262; +pub const SYS_mq_unlink: ::c_long = 263; +pub const SYS_mq_timedsend: ::c_long = 264; +pub const SYS_mq_timedreceive: ::c_long = 265; +pub const SYS_mq_notify: ::c_long = 266; +pub const SYS_mq_getsetattr: ::c_long = 267; +pub const SYS_kexec_load: ::c_long = 268; +pub const SYS_add_key: ::c_long = 269; +pub const SYS_request_key: ::c_long = 270; +pub const SYS_keyctl: ::c_long = 271; +pub const SYS_waitid: ::c_long = 272; +pub const SYS_ioprio_set: ::c_long = 273; +pub const SYS_ioprio_get: ::c_long = 274; +pub const SYS_inotify_init: ::c_long = 275; +pub const SYS_inotify_add_watch: ::c_long = 276; +pub const SYS_inotify_rm_watch: ::c_long = 277; +pub const SYS_spu_run: ::c_long = 278; +pub const SYS_spu_create: ::c_long = 279; +pub const SYS_pselect6: ::c_long = 280; +pub const SYS_ppoll: ::c_long = 281; +pub const SYS_unshare: ::c_long = 282; +pub const SYS_splice: ::c_long = 283; +pub const SYS_tee: ::c_long = 284; +pub const SYS_vmsplice: ::c_long = 285; +pub const SYS_openat: ::c_long = 286; +pub const SYS_mkdirat: ::c_long = 287; +pub const SYS_mknodat: ::c_long = 288; +pub const SYS_fchownat: ::c_long = 289; +pub const SYS_futimesat: ::c_long = 290; +pub const SYS_newfstatat: ::c_long = 291; +pub const SYS_unlinkat: ::c_long = 292; +pub const SYS_renameat: ::c_long = 293; +pub const SYS_linkat: ::c_long = 294; +pub const SYS_symlinkat: ::c_long = 295; +pub const SYS_readlinkat: ::c_long = 296; +pub const SYS_fchmodat: ::c_long = 297; +pub const SYS_faccessat: ::c_long = 298; +pub const SYS_get_robust_list: ::c_long = 299; +pub const SYS_set_robust_list: ::c_long = 300; +pub const SYS_move_pages: ::c_long = 301; +pub const SYS_getcpu: ::c_long = 302; +pub const SYS_epoll_pwait: ::c_long = 303; +pub const SYS_utimensat: ::c_long = 304; +pub const SYS_signalfd: ::c_long = 305; +pub const SYS_timerfd_create: ::c_long = 306; +pub const SYS_eventfd: ::c_long = 307; +pub const SYS_sync_file_range2: ::c_long = 308; +pub const SYS_fallocate: ::c_long = 309; +pub const SYS_subpage_prot: ::c_long = 310; +pub const SYS_timerfd_settime: ::c_long = 311; +pub const SYS_timerfd_gettime: ::c_long = 312; +pub const SYS_signalfd4: ::c_long = 313; +pub const SYS_eventfd2: ::c_long = 314; +pub const SYS_epoll_create1: ::c_long = 315; +pub const SYS_dup3: ::c_long = 316; +pub const SYS_pipe2: ::c_long = 317; +pub const SYS_inotify_init1: ::c_long = 318; +pub const SYS_perf_event_open: ::c_long = 319; +pub const SYS_preadv: ::c_long = 320; +pub const SYS_pwritev: ::c_long = 321; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 322; +pub const SYS_fanotify_init: ::c_long = 323; +pub const SYS_fanotify_mark: ::c_long = 324; +pub const SYS_prlimit64: ::c_long = 325; +pub const SYS_socket: ::c_long = 326; +pub const SYS_bind: ::c_long = 327; +pub const SYS_connect: ::c_long = 328; +pub const SYS_listen: ::c_long = 329; +pub const SYS_accept: ::c_long = 330; +pub const SYS_getsockname: ::c_long = 331; +pub const SYS_getpeername: ::c_long = 332; +pub const SYS_socketpair: ::c_long = 333; +pub const SYS_send: ::c_long = 334; +pub const SYS_sendto: ::c_long = 335; +pub const SYS_recv: ::c_long = 336; +pub const SYS_recvfrom: ::c_long = 337; +pub const SYS_shutdown: ::c_long = 338; +pub const SYS_setsockopt: ::c_long = 339; +pub const SYS_getsockopt: ::c_long = 340; +pub const SYS_sendmsg: ::c_long = 341; +pub const SYS_recvmsg: ::c_long = 342; +pub const SYS_recvmmsg: ::c_long = 343; +pub const SYS_accept4: ::c_long = 344; +pub const SYS_name_to_handle_at: ::c_long = 345; +pub const SYS_open_by_handle_at: ::c_long = 346; +pub const SYS_clock_adjtime: ::c_long = 347; +pub const SYS_syncfs: ::c_long = 348; +pub const SYS_sendmmsg: ::c_long = 349; +pub const SYS_setns: ::c_long = 350; +pub const SYS_process_vm_readv: ::c_long = 351; +pub const SYS_process_vm_writev: ::c_long = 352; +pub const SYS_finit_module: ::c_long = 353; +pub const SYS_kcmp: ::c_long = 354; +pub const SYS_sched_setattr: ::c_long = 355; +pub const SYS_sched_getattr: ::c_long = 356; +pub const SYS_renameat2: ::c_long = 357; +pub const SYS_seccomp: ::c_long = 358; +pub const SYS_getrandom: ::c_long = 359; +pub const SYS_memfd_create: ::c_long = 360; +pub const SYS_bpf: ::c_long = 361; +pub const SYS_execveat: ::c_long = 362; +pub const SYS_switch_endian: ::c_long = 363; +pub const SYS_userfaultfd: ::c_long = 364; +pub const SYS_membarrier: ::c_long = 365; +pub const SYS_mlock2: ::c_long = 378; +pub const SYS_copy_file_range: ::c_long = 379; +pub const SYS_preadv2: ::c_long = 380; +pub const SYS_pwritev2: ::c_long = 381; +pub const SYS_kexec_file_load: ::c_long = 382; + +pub const FIOCLEX: ::c_int = 0x20006601; +pub const FIONCLEX: ::c_int = 0x20006602; +pub const FIONBIO: ::c_int = 0x8004667e; +pub const EDEADLK: ::c_int = 58; +pub const EDEADLOCK: ::c_int = EDEADLK; +pub const SO_PASSCRED: ::c_int = 20; +pub const SO_PEERCRED: ::c_int = 21; +pub const SO_RCVLOWAT: ::c_int = 16; +pub const SO_SNDLOWAT: ::c_int = 17; +pub const SO_RCVTIMEO: ::c_int = 18; +pub const SO_SNDTIMEO: ::c_int = 19; +pub const EXTPROC: ::tcflag_t = 0x10000000; +pub const VEOL: usize = 6; +pub const VEOL2: usize = 8; +pub const VMIN: usize = 5; +pub const IEXTEN: ::tcflag_t = 0x00000400; +pub const TOSTOP: ::tcflag_t = 0x00400000; +pub const FLUSHO: ::tcflag_t = 0x00800000; +pub const TCGETS: ::c_int = 0x403c7413; +pub const TCSETS: ::c_int = 0x803c7414; +pub const TCSETSW: ::c_int = 0x803c7415; +pub const TCSETSF: ::c_int = 0x803c7416; +pub const TCGETA: ::c_int = 0x40147417; +pub const TCSETA: ::c_int = 0x80147418; +pub const TCSETAW: ::c_int = 0x80147419; +pub const TCSETAF: ::c_int = 0x8014741c; +pub const TCSBRK: ::c_int = 0x2000741d; +pub const TCXONC: ::c_int = 0x2000741e; +pub const TCFLSH: ::c_int = 0x2000741f; +pub const TIOCGSOFTCAR: ::c_int = 0x5419; +pub const TIOCSSOFTCAR: ::c_int = 0x541A; +pub const TIOCLINUX: ::c_int = 0x541C; +pub const TIOCGSERIAL: ::c_int = 0x541E; +pub const TIOCEXCL: ::c_int = 0x540C; +pub const TIOCNXCL: ::c_int = 0x540D; +pub const TIOCSCTTY: ::c_int = 0x540E; +pub const TIOCGPGRP: ::c_int = 0x40047477; +pub const TIOCSPGRP: ::c_int = 0x80047476; +pub const TIOCOUTQ: ::c_int = 0x40047473; +pub const TIOCGWINSZ: ::c_int = 0x40087468; +pub const TIOCSWINSZ: ::c_int = 0x80087467; +pub const TIOCMGET: ::c_int = 0x5415; +pub const TIOCMBIS: ::c_int = 0x5416; +pub const TIOCMBIC: ::c_int = 0x5417; +pub const TIOCMSET: ::c_int = 0x5418; +pub const FIONREAD: ::c_int = 0x4004667f; +pub const TIOCCONS: ::c_int = 0x541D; +pub const TIOCM_LE: ::c_int = 0x001; +pub const TIOCM_DTR: ::c_int = 0x002; +pub const TIOCM_RTS: ::c_int = 0x004; +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; +pub const TIOCM_CD: ::c_int = TIOCM_CAR; +pub const TIOCM_RI: ::c_int = TIOCM_RNG; + +pub const TIOCGRS485: ::c_int = 0x542E; +pub const TIOCSRS485: ::c_int = 0x542F; + +pub const RLIMIT_NLIMITS: ::c_int = 15; +pub const TIOCINQ: ::c_int = ::FIONREAD; +pub const MCL_CURRENT: ::c_int = 0x2000; +pub const MCL_FUTURE: ::c_int = 0x4000; +pub const CBAUD: ::tcflag_t = 0xff; +pub const TAB1: ::c_int = 0x400; +pub const TAB2: ::c_int = 0x800; +pub const TAB3: ::c_int = 0xc00; +pub const CR1: ::c_int = 0x1000; +pub const CR2: ::c_int = 0x2000; +pub const CR3: ::c_int = 0x3000; +pub const FF1: ::c_int = 0x4000; +pub const BS1: ::c_int = 0x8000; +pub const VT1: ::c_int = 0x10000; +pub const VWERASE: usize = 10; +pub const VREPRINT: usize = 11; +pub const VSUSP: usize = 12; +pub const VSTART: usize = 13; +pub const VSTOP: usize = 14; +pub const VDISCARD: usize = 16; +pub const VTIME: usize = 7; +pub const IXON: ::tcflag_t = 0x00000200; +pub const IXOFF: ::tcflag_t = 0x00000400; +pub const ONLCR: ::tcflag_t = 0x2; +pub const CSIZE: ::tcflag_t = 0x00000300; + +pub const CS6: ::tcflag_t = 0x00000100; +pub const CS7: ::tcflag_t = 0x00000200; +pub const CS8: ::tcflag_t = 0x00000300; +pub const CSTOPB: ::tcflag_t = 0x00000400; +pub const CREAD: ::tcflag_t = 0x00000800; +pub const PARENB: ::tcflag_t = 0x00001000; +pub const PARODD: ::tcflag_t = 0x00002000; +pub const HUPCL: ::tcflag_t = 0x00004000; +pub const CLOCAL: ::tcflag_t = 0x00008000; +pub const ECHOKE: ::tcflag_t = 0x00000001; +pub const ECHOE: ::tcflag_t = 0x00000002; +pub const ECHOK: ::tcflag_t = 0x00000004; +pub const ECHONL: ::tcflag_t = 0x00000010; +pub const ECHOPRT: ::tcflag_t = 0x00000020; +pub const ECHOCTL: ::tcflag_t = 0x00000040; +pub const ISIG: ::tcflag_t = 0x00000080; +pub const ICANON: ::tcflag_t = 0x00000100; +pub const PENDIN: ::tcflag_t = 0x20000000; +pub const NOFLSH: ::tcflag_t = 0x80000000; + +pub const CIBAUD: ::tcflag_t = 0o77600000; +pub const CBAUDEX: ::tcflag_t = 0o0000020; +pub const VSWTC: usize = 9; +pub const OLCUC: ::tcflag_t = 0o000004; +pub const NLDLY: ::tcflag_t = 0o0001400; +pub const CRDLY: ::tcflag_t = 0o0030000; +pub const TABDLY: ::tcflag_t = 0o0006000; +pub const BSDLY: ::tcflag_t = 0o0100000; +pub const FFDLY: ::tcflag_t = 0o0040000; +pub const VTDLY: ::tcflag_t = 0o0200000; +pub const XTABS: ::tcflag_t = 0o00006000; + +pub const B57600: ::speed_t = 0o00020; +pub const B115200: ::speed_t = 0o00021; +pub const B230400: ::speed_t = 0o00022; +pub const B460800: ::speed_t = 0o00023; +pub const B500000: ::speed_t = 0o00024; +pub const B576000: ::speed_t = 0o00025; +pub const B921600: ::speed_t = 0o00026; +pub const B1000000: ::speed_t = 0o00027; +pub const B1152000: ::speed_t = 0o00030; +pub const B1500000: ::speed_t = 0o00031; +pub const B2000000: ::speed_t = 0o00032; +pub const B2500000: ::speed_t = 0o00033; +pub const B3000000: ::speed_t = 0o00034; +pub const B3500000: ::speed_t = 0o00035; +pub const B4000000: ::speed_t = 0o00036; + +extern { + pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,634 @@ +pub type c_char = i8; +pub type wchar_t = i32; +pub type nlink_t = u64; +pub type blksize_t = ::c_long; +pub type __u64 = ::c_ulonglong; + +s! { + pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_nlink: ::nlink_t, + pub st_mode: ::mode_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + __pad0: ::c_int, + pub st_rdev: ::dev_t, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused: [::c_long; 3], + } + + pub struct stat64 { + pub st_dev: ::dev_t, + pub st_ino: ::ino64_t, + pub st_nlink: ::nlink_t, + pub st_mode: ::mode_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + __pad0: ::c_int, + pub st_rdev: ::dev_t, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt64_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __reserved: [::c_long; 3], + } + + pub struct mcontext_t { + __private: [u64; 32], + } + + pub struct ipc_perm { + pub __ipc_perm_key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::mode_t, + pub __seq: ::c_int, + __unused1: ::c_long, + __unused2: ::c_long + } +} + +s_no_extra_traits!{ + pub struct ucontext_t { + pub uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_mcontext: mcontext_t, + pub uc_sigmask: ::sigset_t, + __private: [u8; 512], + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for ucontext_t { + fn eq(&self, other: &ucontext_t) -> bool { + self.uc_flags == other.uc_flags + && self.uc_link == other.uc_link + && self.uc_stack == other.uc_stack + && self.uc_mcontext == other.uc_mcontext + && self.uc_sigmask == other.uc_sigmask + && self + .__private + .iter() + .zip(other.__private.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for ucontext_t {} + + impl ::fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ucontext_t") + .field("uc_flags", &self.uc_flags) + .field("uc_link", &self.uc_link) + .field("uc_stack", &self.uc_stack) + .field("uc_mcontext", &self.uc_mcontext) + .field("uc_sigmask", &self.uc_sigmask) + // Ignore __private field + .finish() + } + } + + impl ::hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { + self.uc_flags.hash(state); + self.uc_link.hash(state); + self.uc_stack.hash(state); + self.uc_mcontext.hash(state); + self.uc_sigmask.hash(state); + self.__private.hash(state); + } + } + } +} + +// Syscall table + +pub const SYS_read: ::c_long = 0; +pub const SYS_write: ::c_long = 1; +pub const SYS_open: ::c_long = 2; +pub const SYS_close: ::c_long = 3; +pub const SYS_stat: ::c_long = 4; +pub const SYS_fstat: ::c_long = 5; +pub const SYS_lstat: ::c_long = 6; +pub const SYS_poll: ::c_long = 7; +pub const SYS_lseek: ::c_long = 8; +pub const SYS_mmap: ::c_long = 9; +pub const SYS_mprotect: ::c_long = 10; +pub const SYS_munmap: ::c_long = 11; +pub const SYS_brk: ::c_long = 12; +pub const SYS_rt_sigaction: ::c_long = 13; +pub const SYS_rt_sigprocmask: ::c_long = 14; +pub const SYS_rt_sigreturn: ::c_long = 15; +pub const SYS_ioctl: ::c_long = 16; +pub const SYS_pread64: ::c_long = 17; +pub const SYS_pwrite64: ::c_long = 18; +pub const SYS_readv: ::c_long = 19; +pub const SYS_writev: ::c_long = 20; +pub const SYS_access: ::c_long = 21; +pub const SYS_pipe: ::c_long = 22; +pub const SYS_select: ::c_long = 23; +pub const SYS_sched_yield: ::c_long = 24; +pub const SYS_mremap: ::c_long = 25; +pub const SYS_msync: ::c_long = 26; +pub const SYS_mincore: ::c_long = 27; +pub const SYS_madvise: ::c_long = 28; +pub const SYS_shmget: ::c_long = 29; +pub const SYS_shmat: ::c_long = 30; +pub const SYS_shmctl: ::c_long = 31; +pub const SYS_dup: ::c_long = 32; +pub const SYS_dup2: ::c_long = 33; +pub const SYS_pause: ::c_long = 34; +pub const SYS_nanosleep: ::c_long = 35; +pub const SYS_getitimer: ::c_long = 36; +pub const SYS_alarm: ::c_long = 37; +pub const SYS_setitimer: ::c_long = 38; +pub const SYS_getpid: ::c_long = 39; +pub const SYS_sendfile: ::c_long = 40; +pub const SYS_socket: ::c_long = 41; +pub const SYS_connect: ::c_long = 42; +pub const SYS_accept: ::c_long = 43; +pub const SYS_sendto: ::c_long = 44; +pub const SYS_recvfrom: ::c_long = 45; +pub const SYS_sendmsg: ::c_long = 46; +pub const SYS_recvmsg: ::c_long = 47; +pub const SYS_shutdown: ::c_long = 48; +pub const SYS_bind: ::c_long = 49; +pub const SYS_listen: ::c_long = 50; +pub const SYS_getsockname: ::c_long = 51; +pub const SYS_getpeername: ::c_long = 52; +pub const SYS_socketpair: ::c_long = 53; +pub const SYS_setsockopt: ::c_long = 54; +pub const SYS_getsockopt: ::c_long = 55; +pub const SYS_clone: ::c_long = 56; +pub const SYS_fork: ::c_long = 57; +pub const SYS_vfork: ::c_long = 58; +pub const SYS_execve: ::c_long = 59; +pub const SYS_exit: ::c_long = 60; +pub const SYS_wait4: ::c_long = 61; +pub const SYS_kill: ::c_long = 62; +pub const SYS_uname: ::c_long = 63; +pub const SYS_semget: ::c_long = 64; +pub const SYS_semop: ::c_long = 65; +pub const SYS_semctl: ::c_long = 66; +pub const SYS_shmdt: ::c_long = 67; +pub const SYS_msgget: ::c_long = 68; +pub const SYS_msgsnd: ::c_long = 69; +pub const SYS_msgrcv: ::c_long = 70; +pub const SYS_msgctl: ::c_long = 71; +pub const SYS_fcntl: ::c_long = 72; +pub const SYS_flock: ::c_long = 73; +pub const SYS_fsync: ::c_long = 74; +pub const SYS_fdatasync: ::c_long = 75; +pub const SYS_truncate: ::c_long = 76; +pub const SYS_ftruncate: ::c_long = 77; +pub const SYS_getdents: ::c_long = 78; +pub const SYS_getcwd: ::c_long = 79; +pub const SYS_chdir: ::c_long = 80; +pub const SYS_fchdir: ::c_long = 81; +pub const SYS_rename: ::c_long = 82; +pub const SYS_mkdir: ::c_long = 83; +pub const SYS_rmdir: ::c_long = 84; +pub const SYS_creat: ::c_long = 85; +pub const SYS_link: ::c_long = 86; +pub const SYS_unlink: ::c_long = 87; +pub const SYS_symlink: ::c_long = 88; +pub const SYS_readlink: ::c_long = 89; +pub const SYS_chmod: ::c_long = 90; +pub const SYS_fchmod: ::c_long = 91; +pub const SYS_chown: ::c_long = 92; +pub const SYS_fchown: ::c_long = 93; +pub const SYS_lchown: ::c_long = 94; +pub const SYS_umask: ::c_long = 95; +pub const SYS_gettimeofday: ::c_long = 96; +pub const SYS_getrlimit: ::c_long = 97; +pub const SYS_getrusage: ::c_long = 98; +pub const SYS_sysinfo: ::c_long = 99; +pub const SYS_times: ::c_long = 100; +pub const SYS_ptrace: ::c_long = 101; +pub const SYS_getuid: ::c_long = 102; +pub const SYS_syslog: ::c_long = 103; +pub const SYS_getgid: ::c_long = 104; +pub const SYS_setuid: ::c_long = 105; +pub const SYS_setgid: ::c_long = 106; +pub const SYS_geteuid: ::c_long = 107; +pub const SYS_getegid: ::c_long = 108; +pub const SYS_setpgid: ::c_long = 109; +pub const SYS_getppid: ::c_long = 110; +pub const SYS_getpgrp: ::c_long = 111; +pub const SYS_setsid: ::c_long = 112; +pub const SYS_setreuid: ::c_long = 113; +pub const SYS_setregid: ::c_long = 114; +pub const SYS_getgroups: ::c_long = 115; +pub const SYS_setgroups: ::c_long = 116; +pub const SYS_setresuid: ::c_long = 117; +pub const SYS_getresuid: ::c_long = 118; +pub const SYS_setresgid: ::c_long = 119; +pub const SYS_getresgid: ::c_long = 120; +pub const SYS_getpgid: ::c_long = 121; +pub const SYS_setfsuid: ::c_long = 122; +pub const SYS_setfsgid: ::c_long = 123; +pub const SYS_getsid: ::c_long = 124; +pub const SYS_capget: ::c_long = 125; +pub const SYS_capset: ::c_long = 126; +pub const SYS_rt_sigpending: ::c_long = 127; +pub const SYS_rt_sigtimedwait: ::c_long = 128; +pub const SYS_rt_sigqueueinfo: ::c_long = 129; +pub const SYS_rt_sigsuspend: ::c_long = 130; +pub const SYS_sigaltstack: ::c_long = 131; +pub const SYS_utime: ::c_long = 132; +pub const SYS_mknod: ::c_long = 133; +pub const SYS_uselib: ::c_long = 134; +pub const SYS_personality: ::c_long = 135; +pub const SYS_ustat: ::c_long = 136; +pub const SYS_statfs: ::c_long = 137; +pub const SYS_fstatfs: ::c_long = 138; +pub const SYS_sysfs: ::c_long = 139; +pub const SYS_getpriority: ::c_long = 140; +pub const SYS_setpriority: ::c_long = 141; +pub const SYS_sched_setparam: ::c_long = 142; +pub const SYS_sched_getparam: ::c_long = 143; +pub const SYS_sched_setscheduler: ::c_long = 144; +pub const SYS_sched_getscheduler: ::c_long = 145; +pub const SYS_sched_get_priority_max: ::c_long = 146; +pub const SYS_sched_get_priority_min: ::c_long = 147; +pub const SYS_sched_rr_get_interval: ::c_long = 148; +pub const SYS_mlock: ::c_long = 149; +pub const SYS_munlock: ::c_long = 150; +pub const SYS_mlockall: ::c_long = 151; +pub const SYS_munlockall: ::c_long = 152; +pub const SYS_vhangup: ::c_long = 153; +pub const SYS_modify_ldt: ::c_long = 154; +pub const SYS_pivot_root: ::c_long = 155; +pub const SYS__sysctl: ::c_long = 156; +pub const SYS_prctl: ::c_long = 157; +pub const SYS_arch_prctl: ::c_long = 158; +pub const SYS_adjtimex: ::c_long = 159; +pub const SYS_setrlimit: ::c_long = 160; +pub const SYS_chroot: ::c_long = 161; +pub const SYS_sync: ::c_long = 162; +pub const SYS_acct: ::c_long = 163; +pub const SYS_settimeofday: ::c_long = 164; +pub const SYS_mount: ::c_long = 165; +pub const SYS_umount2: ::c_long = 166; +pub const SYS_swapon: ::c_long = 167; +pub const SYS_swapoff: ::c_long = 168; +pub const SYS_reboot: ::c_long = 169; +pub const SYS_sethostname: ::c_long = 170; +pub const SYS_setdomainname: ::c_long = 171; +pub const SYS_iopl: ::c_long = 172; +pub const SYS_ioperm: ::c_long = 173; +pub const SYS_create_module: ::c_long = 174; +pub const SYS_init_module: ::c_long = 175; +pub const SYS_delete_module: ::c_long = 176; +pub const SYS_get_kernel_syms: ::c_long = 177; +pub const SYS_query_module: ::c_long = 178; +pub const SYS_quotactl: ::c_long = 179; +pub const SYS_nfsservctl: ::c_long = 180; +pub const SYS_getpmsg: ::c_long = 181; +pub const SYS_putpmsg: ::c_long = 182; +pub const SYS_afs_syscall: ::c_long = 183; +pub const SYS_tuxcall: ::c_long = 184; +pub const SYS_security: ::c_long = 185; +pub const SYS_gettid: ::c_long = 186; +pub const SYS_readahead: ::c_long = 187; +pub const SYS_setxattr: ::c_long = 188; +pub const SYS_lsetxattr: ::c_long = 189; +pub const SYS_fsetxattr: ::c_long = 190; +pub const SYS_getxattr: ::c_long = 191; +pub const SYS_lgetxattr: ::c_long = 192; +pub const SYS_fgetxattr: ::c_long = 193; +pub const SYS_listxattr: ::c_long = 194; +pub const SYS_llistxattr: ::c_long = 195; +pub const SYS_flistxattr: ::c_long = 196; +pub const SYS_removexattr: ::c_long = 197; +pub const SYS_lremovexattr: ::c_long = 198; +pub const SYS_fremovexattr: ::c_long = 199; +pub const SYS_tkill: ::c_long = 200; +pub const SYS_time: ::c_long = 201; +pub const SYS_futex: ::c_long = 202; +pub const SYS_sched_setaffinity: ::c_long = 203; +pub const SYS_sched_getaffinity: ::c_long = 204; +pub const SYS_set_thread_area: ::c_long = 205; +pub const SYS_io_setup: ::c_long = 206; +pub const SYS_io_destroy: ::c_long = 207; +pub const SYS_io_getevents: ::c_long = 208; +pub const SYS_io_submit: ::c_long = 209; +pub const SYS_io_cancel: ::c_long = 210; +pub const SYS_get_thread_area: ::c_long = 211; +pub const SYS_lookup_dcookie: ::c_long = 212; +pub const SYS_epoll_create: ::c_long = 213; +pub const SYS_epoll_ctl_old: ::c_long = 214; +pub const SYS_epoll_wait_old: ::c_long = 215; +pub const SYS_remap_file_pages: ::c_long = 216; +pub const SYS_getdents64: ::c_long = 217; +pub const SYS_set_tid_address: ::c_long = 218; +pub const SYS_restart_syscall: ::c_long = 219; +pub const SYS_semtimedop: ::c_long = 220; +pub const SYS_fadvise64: ::c_long = 221; +pub const SYS_timer_create: ::c_long = 222; +pub const SYS_timer_settime: ::c_long = 223; +pub const SYS_timer_gettime: ::c_long = 224; +pub const SYS_timer_getoverrun: ::c_long = 225; +pub const SYS_timer_delete: ::c_long = 226; +pub const SYS_clock_settime: ::c_long = 227; +pub const SYS_clock_gettime: ::c_long = 228; +pub const SYS_clock_getres: ::c_long = 229; +pub const SYS_clock_nanosleep: ::c_long = 230; +pub const SYS_exit_group: ::c_long = 231; +pub const SYS_epoll_wait: ::c_long = 232; +pub const SYS_epoll_ctl: ::c_long = 233; +pub const SYS_tgkill: ::c_long = 234; +pub const SYS_utimes: ::c_long = 235; +pub const SYS_vserver: ::c_long = 236; +pub const SYS_mbind: ::c_long = 237; +pub const SYS_set_mempolicy: ::c_long = 238; +pub const SYS_get_mempolicy: ::c_long = 239; +pub const SYS_mq_open: ::c_long = 240; +pub const SYS_mq_unlink: ::c_long = 241; +pub const SYS_mq_timedsend: ::c_long = 242; +pub const SYS_mq_timedreceive: ::c_long = 243; +pub const SYS_mq_notify: ::c_long = 244; +pub const SYS_mq_getsetattr: ::c_long = 245; +pub const SYS_kexec_load: ::c_long = 246; +pub const SYS_waitid: ::c_long = 247; +pub const SYS_add_key: ::c_long = 248; +pub const SYS_request_key: ::c_long = 249; +pub const SYS_keyctl: ::c_long = 250; +pub const SYS_ioprio_set: ::c_long = 251; +pub const SYS_ioprio_get: ::c_long = 252; +pub const SYS_inotify_init: ::c_long = 253; +pub const SYS_inotify_add_watch: ::c_long = 254; +pub const SYS_inotify_rm_watch: ::c_long = 255; +pub const SYS_migrate_pages: ::c_long = 256; +pub const SYS_openat: ::c_long = 257; +pub const SYS_mkdirat: ::c_long = 258; +pub const SYS_mknodat: ::c_long = 259; +pub const SYS_fchownat: ::c_long = 260; +pub const SYS_futimesat: ::c_long = 261; +pub const SYS_newfstatat: ::c_long = 262; +pub const SYS_unlinkat: ::c_long = 263; +pub const SYS_renameat: ::c_long = 264; +pub const SYS_linkat: ::c_long = 265; +pub const SYS_symlinkat: ::c_long = 266; +pub const SYS_readlinkat: ::c_long = 267; +pub const SYS_fchmodat: ::c_long = 268; +pub const SYS_faccessat: ::c_long = 269; +pub const SYS_pselect6: ::c_long = 270; +pub const SYS_ppoll: ::c_long = 271; +pub const SYS_unshare: ::c_long = 272; +pub const SYS_set_robust_list: ::c_long = 273; +pub const SYS_get_robust_list: ::c_long = 274; +pub const SYS_splice: ::c_long = 275; +pub const SYS_tee: ::c_long = 276; +pub const SYS_sync_file_range: ::c_long = 277; +pub const SYS_vmsplice: ::c_long = 278; +pub const SYS_move_pages: ::c_long = 279; +pub const SYS_utimensat: ::c_long = 280; +pub const SYS_epoll_pwait: ::c_long = 281; +pub const SYS_signalfd: ::c_long = 282; +pub const SYS_timerfd_create: ::c_long = 283; +pub const SYS_eventfd: ::c_long = 284; +pub const SYS_fallocate: ::c_long = 285; +pub const SYS_timerfd_settime: ::c_long = 286; +pub const SYS_timerfd_gettime: ::c_long = 287; +pub const SYS_accept4: ::c_long = 288; +pub const SYS_signalfd4: ::c_long = 289; +pub const SYS_eventfd2: ::c_long = 290; +pub const SYS_epoll_create1: ::c_long = 291; +pub const SYS_dup3: ::c_long = 292; +pub const SYS_pipe2: ::c_long = 293; +pub const SYS_inotify_init1: ::c_long = 294; +pub const SYS_preadv: ::c_long = 295; +pub const SYS_pwritev: ::c_long = 296; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 297; +pub const SYS_perf_event_open: ::c_long = 298; +pub const SYS_recvmmsg: ::c_long = 299; +pub const SYS_fanotify_init: ::c_long = 300; +pub const SYS_fanotify_mark: ::c_long = 301; +pub const SYS_prlimit64: ::c_long = 302; +pub const SYS_name_to_handle_at: ::c_long = 303; +pub const SYS_open_by_handle_at: ::c_long = 304; +pub const SYS_clock_adjtime: ::c_long = 305; +pub const SYS_syncfs: ::c_long = 306; +pub const SYS_sendmmsg: ::c_long = 307; +pub const SYS_setns: ::c_long = 308; +pub const SYS_getcpu: ::c_long = 309; +pub const SYS_process_vm_readv: ::c_long = 310; +pub const SYS_process_vm_writev: ::c_long = 311; +pub const SYS_kcmp: ::c_long = 312; +pub const SYS_finit_module: ::c_long = 313; +pub const SYS_sched_setattr: ::c_long = 314; +pub const SYS_sched_getattr: ::c_long = 315; +pub const SYS_renameat2: ::c_long = 316; +pub const SYS_seccomp: ::c_long = 317; +pub const SYS_getrandom: ::c_long = 318; +pub const SYS_memfd_create: ::c_long = 319; +pub const SYS_kexec_file_load: ::c_long = 320; +pub const SYS_bpf: ::c_long = 321; +pub const SYS_execveat: ::c_long = 322; +pub const SYS_userfaultfd: ::c_long = 323; +pub const SYS_membarrier: ::c_long = 324; +pub const SYS_mlock2: ::c_long = 325; +pub const SYS_copy_file_range: ::c_long = 326; +pub const SYS_preadv2: ::c_long = 327; +pub const SYS_pwritev2: ::c_long = 328; +// FIXME syscalls 329-331 have been added in musl 1.16 +// See discussion https://github.com/rust-lang/libc/pull/699 + +// offsets in user_regs_structs, from sys/reg.h +pub const R15: ::c_int = 0; +pub const R14: ::c_int = 1; +pub const R13: ::c_int = 2; +pub const R12: ::c_int = 3; +pub const RBP: ::c_int = 4; +pub const RBX: ::c_int = 5; +pub const R11: ::c_int = 6; +pub const R10: ::c_int = 7; +pub const R9: ::c_int = 8; +pub const R8: ::c_int = 9; +pub const RAX: ::c_int = 10; +pub const RCX: ::c_int = 11; +pub const RDX: ::c_int = 12; +pub const RSI: ::c_int = 13; +pub const RDI: ::c_int = 14; +pub const ORIG_RAX: ::c_int = 15; +pub const RIP: ::c_int = 16; +pub const CS: ::c_int = 17; +pub const EFLAGS: ::c_int = 18; +pub const RSP: ::c_int = 19; +pub const SS: ::c_int = 20; +pub const FS_BASE: ::c_int = 21; +pub const GS_BASE: ::c_int = 22; +pub const DS: ::c_int = 23; +pub const ES: ::c_int = 24; +pub const FS: ::c_int = 25; +pub const GS: ::c_int = 26; + +pub const MADV_SOFT_OFFLINE: ::c_int = 101; +pub const MAP_32BIT: ::c_int = 0x0040; +pub const O_DIRECT: ::c_int = 0x4000; +pub const O_DIRECTORY: ::c_int = 0x10000; +pub const O_LARGEFILE: ::c_int = 0; +pub const O_NOFOLLOW: ::c_int = 0x20000; + +pub const TIOCGRS485: ::c_int = 0x542E; +pub const TIOCSRS485: ::c_int = 0x542F; + +pub const SIGSTKSZ: ::size_t = 8192; +pub const MINSIGSTKSZ: ::size_t = 2048; + +pub const RLIMIT_NLIMITS: ::c_int = 15; +pub const TIOCINQ: ::c_int = ::FIONREAD; +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; +pub const CBAUD: ::tcflag_t = 0o0010017; +pub const TAB1: ::c_int = 0x00000800; +pub const TAB2: ::c_int = 0x00001000; +pub const TAB3: ::c_int = 0x00001800; +pub const CR1: ::c_int = 0x00000200; +pub const CR2: ::c_int = 0x00000400; +pub const CR3: ::c_int = 0x00000600; +pub const FF1: ::c_int = 0x00008000; +pub const BS1: ::c_int = 0x00002000; +pub const VT1: ::c_int = 0x00004000; +pub const VWERASE: usize = 14; +pub const VREPRINT: usize = 12; +pub const VSUSP: usize = 10; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VDISCARD: usize = 13; +pub const VTIME: usize = 5; +pub const IXON: ::tcflag_t = 0x00000400; +pub const IXOFF: ::tcflag_t = 0x00001000; +pub const ONLCR: ::tcflag_t = 0x4; +pub const CSIZE: ::tcflag_t = 0x00000030; +pub const CS6: ::tcflag_t = 0x00000010; +pub const CS7: ::tcflag_t = 0x00000020; +pub const CS8: ::tcflag_t = 0x00000030; +pub const CSTOPB: ::tcflag_t = 0x00000040; +pub const CREAD: ::tcflag_t = 0x00000080; +pub const PARENB: ::tcflag_t = 0x00000100; +pub const PARODD: ::tcflag_t = 0x00000200; +pub const HUPCL: ::tcflag_t = 0x00000400; +pub const CLOCAL: ::tcflag_t = 0x00000800; +pub const ECHOKE: ::tcflag_t = 0x00000800; +pub const ECHOE: ::tcflag_t = 0x00000010; +pub const ECHOK: ::tcflag_t = 0x00000020; +pub const ECHONL: ::tcflag_t = 0x00000040; +pub const ECHOPRT: ::tcflag_t = 0x00000400; +pub const ECHOCTL: ::tcflag_t = 0x00000200; +pub const ISIG: ::tcflag_t = 0x00000001; +pub const ICANON: ::tcflag_t = 0x00000002; +pub const PENDIN: ::tcflag_t = 0x00004000; +pub const NOFLSH: ::tcflag_t = 0x00000080; +pub const CIBAUD: ::tcflag_t = 0o02003600000; +pub const CBAUDEX: ::tcflag_t = 0o010000; +pub const VSWTC: usize = 7; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const XTABS: ::tcflag_t = 0o014000; +pub const B57600: ::speed_t = 0o010001; +pub const B115200: ::speed_t = 0o010002; +pub const B230400: ::speed_t = 0o010003; +pub const B460800: ::speed_t = 0o010004; +pub const B500000: ::speed_t = 0o010005; +pub const B576000: ::speed_t = 0o010006; +pub const B921600: ::speed_t = 0o010007; +pub const B1000000: ::speed_t = 0o010010; +pub const B1152000: ::speed_t = 0o010011; +pub const B1500000: ::speed_t = 0o010012; +pub const B2000000: ::speed_t = 0o010013; +pub const B2500000: ::speed_t = 0o010014; +pub const B3000000: ::speed_t = 0o010015; +pub const B3500000: ::speed_t = 0o010016; +pub const B4000000: ::speed_t = 0o010017; + +pub const FIOCLEX: ::c_int = 0x5451; +pub const FIONCLEX: ::c_int = 0x5450; +pub const FIONBIO: ::c_int = 0x5421; +pub const EDEADLK: ::c_int = 35; +pub const EDEADLOCK: ::c_int = EDEADLK; +pub const SO_PASSCRED: ::c_int = 16; +pub const SO_PEERCRED: ::c_int = 17; +pub const SO_RCVLOWAT: ::c_int = 18; +pub const SO_SNDLOWAT: ::c_int = 19; +pub const SO_RCVTIMEO: ::c_int = 20; +pub const SO_SNDTIMEO: ::c_int = 21; +pub const EXTPROC: ::tcflag_t = 0x00010000; +pub const VEOL: usize = 11; +pub const VEOL2: usize = 16; +pub const VMIN: usize = 6; +pub const IEXTEN: ::tcflag_t = 0x00008000; +pub const TOSTOP: ::tcflag_t = 0x00000100; +pub const FLUSHO: ::tcflag_t = 0x00001000; +pub const TCGETS: ::c_int = 0x5401; +pub const TCSETS: ::c_int = 0x5402; +pub const TCSETSW: ::c_int = 0x5403; +pub const TCSETSF: ::c_int = 0x5404; +pub const TCGETA: ::c_int = 0x5405; +pub const TCSETA: ::c_int = 0x5406; +pub const TCSETAW: ::c_int = 0x5407; +pub const TCSETAF: ::c_int = 0x5408; +pub const TCSBRK: ::c_int = 0x5409; +pub const TCXONC: ::c_int = 0x540A; +pub const TCFLSH: ::c_int = 0x540B; +pub const TIOCGSOFTCAR: ::c_int = 0x5419; +pub const TIOCSSOFTCAR: ::c_int = 0x541A; +pub const TIOCLINUX: ::c_int = 0x541C; +pub const TIOCGSERIAL: ::c_int = 0x541E; +pub const TIOCEXCL: ::c_int = 0x540C; +pub const TIOCNXCL: ::c_int = 0x540D; +pub const TIOCSCTTY: ::c_int = 0x540E; +pub const TIOCGPGRP: ::c_int = 0x540F; +pub const TIOCSPGRP: ::c_int = 0x5410; +pub const TIOCOUTQ: ::c_int = 0x5411; +pub const TIOCSTI: ::c_int = 0x5412; +pub const TIOCGWINSZ: ::c_int = 0x5413; +pub const TIOCSWINSZ: ::c_int = 0x5414; +pub const TIOCMGET: ::c_int = 0x5415; +pub const TIOCMBIS: ::c_int = 0x5416; +pub const TIOCMBIC: ::c_int = 0x5417; +pub const TIOCMSET: ::c_int = 0x5418; +pub const FIONREAD: ::c_int = 0x541B; +pub const TIOCCONS: ::c_int = 0x541D; + +pub const TIOCM_LE: ::c_int = 0x001; +pub const TIOCM_DTR: ::c_int = 0x002; +pub const TIOCM_RTS: ::c_int = 0x004; +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; +pub const TIOCM_CD: ::c_int = TIOCM_CAR; +pub const TIOCM_RI: ::c_int = TIOCM_RNG; + +extern { + pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; +} + diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/mod.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/musl/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/musl/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,422 @@ +pub type pthread_t = *mut ::c_void; +pub type clock_t = c_long; +pub type time_t = c_long; +pub type suseconds_t = c_long; +pub type ino_t = u64; +pub type off_t = i64; +pub type blkcnt_t = i64; + +pub type shmatt_t = ::c_ulong; +pub type msgqnum_t = ::c_ulong; +pub type msglen_t = ::c_ulong; +pub type fsblkcnt_t = ::c_ulonglong; +pub type fsfilcnt_t = ::c_ulonglong; +pub type rlim_t = ::c_ulonglong; + +impl siginfo_t { + pub unsafe fn si_addr(&self) -> *mut ::c_void { + #[repr(C)] + struct siginfo_sigfault { + _si_signo: ::c_int, + _si_errno: ::c_int, + _si_code: ::c_int, + si_addr: *mut ::c_void + } + + (*(self as *const siginfo_t as *const siginfo_sigfault)).si_addr + } + + pub unsafe fn si_value(&self) -> ::sigval { + #[repr(C)] + struct siginfo_si_value { + _si_signo: ::c_int, + _si_errno: ::c_int, + _si_code: ::c_int, + _si_timerid: ::c_int, + _si_overrun: ::c_int, + si_value: ::sigval, + } + + (*(self as *const siginfo_t as *const siginfo_si_value)).si_value + } +} + +s! { + pub struct aiocb { + pub aio_fildes: ::c_int, + pub aio_lio_opcode: ::c_int, + pub aio_reqprio: ::c_int, + pub aio_buf: *mut ::c_void, + pub aio_nbytes: ::size_t, + pub aio_sigevent: ::sigevent, + __td: *mut ::c_void, + __lock: [::c_int; 2], + __err: ::c_int, + __ret: ::ssize_t, + pub aio_offset: off_t, + __next: *mut ::c_void, + __prev: *mut ::c_void, + #[cfg(target_pointer_width = "32")] + __dummy4: [::c_char; 24], + #[cfg(target_pointer_width = "64")] + __dummy4: [::c_char; 16], + } + + pub struct sigaction { + pub sa_sigaction: ::sighandler_t, + pub sa_mask: ::sigset_t, + pub sa_flags: ::c_int, + pub sa_restorer: ::Option, + } + + pub struct statvfs { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_favail: ::fsfilcnt_t, + #[cfg(target_endian = "little")] + pub f_fsid: ::c_ulong, + #[cfg(target_pointer_width = "32")] + __f_unused: ::c_int, + #[cfg(target_endian = "big")] + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + + pub struct termios { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; ::NCCS], + pub __c_ispeed: ::speed_t, + pub __c_ospeed: ::speed_t, + } + + pub struct flock { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off_t, + pub l_len: ::off_t, + pub l_pid: ::pid_t, + } +} + +s_no_extra_traits!{ + pub struct sysinfo { + pub uptime: ::c_ulong, + pub loads: [::c_ulong; 3], + pub totalram: ::c_ulong, + pub freeram: ::c_ulong, + pub sharedram: ::c_ulong, + pub bufferram: ::c_ulong, + pub totalswap: ::c_ulong, + pub freeswap: ::c_ulong, + pub procs: ::c_ushort, + pub pad: ::c_ushort, + pub totalhigh: ::c_ulong, + pub freehigh: ::c_ulong, + pub mem_unit: ::c_uint, + pub __reserved: [::c_char; 256], + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for sysinfo { + fn eq(&self, other: &sysinfo) -> bool { + self.uptime == other.uptime + && self.loads == other.loads + && self.totalram == other.totalram + && self.freeram == other.freeram + && self.sharedram == other.sharedram + && self.bufferram == other.bufferram + && self.totalswap == other.totalswap + && self.freeswap == other.freeswap + && self.procs == other.procs + && self.pad == other.pad + && self.totalhigh == other.totalhigh + && self.freehigh == other.freehigh + && self.mem_unit == other.mem_unit + && self + .__reserved + .iter() + .zip(other.__reserved.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for sysinfo {} + + impl ::fmt::Debug for sysinfo { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sysinfo") + .field("uptime", &self.uptime) + .field("loads", &self.loads) + .field("totalram", &self.totalram) + .field("freeram", &self.freeram) + .field("sharedram", &self.sharedram) + .field("bufferram", &self.bufferram) + .field("totalswap", &self.totalswap) + .field("freeswap", &self.freeswap) + .field("procs", &self.procs) + .field("pad", &self.pad) + .field("totalhigh", &self.totalhigh) + .field("freehigh", &self.freehigh) + .field("mem_unit", &self.mem_unit) + // FIXME: .field("__reserved", &self.__reserved) + .finish() + } + } + + impl ::hash::Hash for sysinfo { + fn hash(&self, state: &mut H) { + self.uptime.hash(state); + self.loads.hash(state); + self.totalram.hash(state); + self.freeram.hash(state); + self.sharedram.hash(state); + self.bufferram.hash(state); + self.totalswap.hash(state); + self.freeswap.hash(state); + self.procs.hash(state); + self.pad.hash(state); + self.totalhigh.hash(state); + self.freehigh.hash(state); + self.mem_unit.hash(state); + self.__reserved.hash(state); + } + } + } +} + +pub const MS_RMT_MASK: ::c_ulong = 0x02800051; + +pub const SFD_CLOEXEC: ::c_int = 0x080000; + +pub const NCCS: usize = 32; + +pub const O_TRUNC: ::c_int = 512; +pub const O_NOATIME: ::c_int = 0o1000000; +pub const O_CLOEXEC: ::c_int = 0x80000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; + +pub const EBFONT: ::c_int = 59; +pub const ENOSTR: ::c_int = 60; +pub const ENODATA: ::c_int = 61; +pub const ETIME: ::c_int = 62; +pub const ENOSR: ::c_int = 63; +pub const ENONET: ::c_int = 64; +pub const ENOPKG: ::c_int = 65; +pub const EREMOTE: ::c_int = 66; +pub const ENOLINK: ::c_int = 67; +pub const EADV: ::c_int = 68; +pub const ESRMNT: ::c_int = 69; +pub const ECOMM: ::c_int = 70; +pub const EPROTO: ::c_int = 71; +pub const EDOTDOT: ::c_int = 73; + +pub const F_RDLCK: ::c_int = 0; +pub const F_WRLCK: ::c_int = 1; +pub const F_UNLCK: ::c_int = 2; + +pub const SA_NODEFER: ::c_int = 0x40000000; +pub const SA_RESETHAND: ::c_int = 0x80000000; +pub const SA_RESTART: ::c_int = 0x10000000; +pub const SA_NOCLDSTOP: ::c_int = 0x00000001; + +pub const EPOLL_CLOEXEC: ::c_int = 0x80000; + +pub const EFD_CLOEXEC: ::c_int = 0x80000; + +pub const BUFSIZ: ::c_uint = 1024; +pub const TMP_MAX: ::c_uint = 10000; +pub const FOPEN_MAX: ::c_uint = 1000; +pub const O_PATH: ::c_int = 0o10000000; +pub const O_EXEC: ::c_int = 0o10000000; +pub const O_SEARCH: ::c_int = 0o10000000; +pub const O_ACCMODE: ::c_int = 0o10000003; +pub const O_NDELAY: ::c_int = O_NONBLOCK; +pub const NI_MAXHOST: ::socklen_t = 255; +pub const PTHREAD_STACK_MIN: ::size_t = 2048; +pub const POSIX_FADV_DONTNEED: ::c_int = 4; +pub const POSIX_FADV_NOREUSE: ::c_int = 5; + +pub const POSIX_MADV_DONTNEED: ::c_int = 4; + +pub const RLIM_INFINITY: ::rlim_t = !0; +pub const RLIMIT_RTTIME: ::c_int = 15; + +pub const MAP_ANONYMOUS: ::c_int = MAP_ANON; + +pub const SOCK_DCCP: ::c_int = 6; +pub const SOCK_PACKET: ::c_int = 10; + +pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15; +pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16; +pub const TCP_THIN_DUPACK: ::c_int = 17; +pub const TCP_USER_TIMEOUT: ::c_int = 18; +pub const TCP_REPAIR: ::c_int = 19; +pub const TCP_REPAIR_QUEUE: ::c_int = 20; +pub const TCP_QUEUE_SEQ: ::c_int = 21; +pub const TCP_REPAIR_OPTIONS: ::c_int = 22; +pub const TCP_FASTOPEN: ::c_int = 23; +pub const TCP_TIMESTAMP: ::c_int = 24; + +#[deprecated( + since = "0.2.55", + note = "Use SIGSYS instead" +)] +pub const SIGUNUSED: ::c_int = ::SIGSYS; + +pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; +pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; +pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; + +pub const CPU_SETSIZE: ::c_int = 128; + +pub const PTRACE_TRACEME: ::c_int = 0; +pub const PTRACE_PEEKTEXT: ::c_int = 1; +pub const PTRACE_PEEKDATA: ::c_int = 2; +pub const PTRACE_PEEKUSER: ::c_int = 3; +pub const PTRACE_POKETEXT: ::c_int = 4; +pub const PTRACE_POKEDATA: ::c_int = 5; +pub const PTRACE_POKEUSER: ::c_int = 6; +pub const PTRACE_CONT: ::c_int = 7; +pub const PTRACE_KILL: ::c_int = 8; +pub const PTRACE_SINGLESTEP: ::c_int = 9; +pub const PTRACE_GETREGS: ::c_int = 12; +pub const PTRACE_SETREGS: ::c_int = 13; +pub const PTRACE_GETFPREGS: ::c_int = 14; +pub const PTRACE_SETFPREGS: ::c_int = 15; +pub const PTRACE_ATTACH: ::c_int = 16; +pub const PTRACE_DETACH: ::c_int = 17; +pub const PTRACE_GETFPXREGS: ::c_int = 18; +pub const PTRACE_SETFPXREGS: ::c_int = 19; +pub const PTRACE_SYSCALL: ::c_int = 24; +pub const PTRACE_SETOPTIONS: ::c_int = 0x4200; +pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201; +pub const PTRACE_GETSIGINFO: ::c_int = 0x4202; +pub const PTRACE_SETSIGINFO: ::c_int = 0x4203; +pub const PTRACE_GETREGSET: ::c_int = 0x4204; +pub const PTRACE_SETREGSET: ::c_int = 0x4205; +pub const PTRACE_SEIZE: ::c_int = 0x4206; +pub const PTRACE_INTERRUPT: ::c_int = 0x4207; +pub const PTRACE_LISTEN: ::c_int = 0x4208; +pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209; + +pub const EPOLLWAKEUP: ::c_int = 0x20000000; + +pub const SEEK_DATA: ::c_int = 3; +pub const SEEK_HOLE: ::c_int = 4; + +pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK; + +pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK; + +pub const TCSANOW: ::c_int = 0; +pub const TCSADRAIN: ::c_int = 1; +pub const TCSAFLUSH: ::c_int = 2; + +pub const RTLD_GLOBAL: ::c_int = 0x100; +pub const RTLD_NOLOAD: ::c_int = 0x4; + +// TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux +// kernel 3.10). See also linux_like/mod.rs +pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; +pub const CLOCK_TAI: ::clockid_t = 11; + +pub const B0: ::speed_t = 0o000000; +pub const B50: ::speed_t = 0o000001; +pub const B75: ::speed_t = 0o000002; +pub const B110: ::speed_t = 0o000003; +pub const B134: ::speed_t = 0o000004; +pub const B150: ::speed_t = 0o000005; +pub const B200: ::speed_t = 0o000006; +pub const B300: ::speed_t = 0o000007; +pub const B600: ::speed_t = 0o000010; +pub const B1200: ::speed_t = 0o000011; +pub const B1800: ::speed_t = 0o000012; +pub const B2400: ::speed_t = 0o000013; +pub const B4800: ::speed_t = 0o000014; +pub const B9600: ::speed_t = 0o000015; +pub const B19200: ::speed_t = 0o000016; +pub const B38400: ::speed_t = 0o000017; +pub const EXTA: ::speed_t = B19200; +pub const EXTB: ::speed_t = B38400; + +pub const SO_BINDTODEVICE: ::c_int = 25; +pub const SO_TIMESTAMP: ::c_int = 29; +pub const SO_MARK: ::c_int = 36; +pub const SO_RXQ_OVFL: ::c_int = 40; +pub const SO_PEEK_OFF: ::c_int = 42; +pub const SO_BUSY_POLL: ::c_int = 46; + +pub const RLIMIT_CPU: ::c_int = 0; +pub const RLIMIT_FSIZE: ::c_int = 1; +pub const RLIMIT_DATA: ::c_int = 2; +pub const RLIMIT_STACK: ::c_int = 3; +pub const RLIMIT_CORE: ::c_int = 4; +pub const RLIMIT_LOCKS: ::c_int = 10; +pub const RLIMIT_SIGPENDING: ::c_int = 11; +pub const RLIMIT_MSGQUEUE: ::c_int = 12; +pub const RLIMIT_NICE: ::c_int = 13; +pub const RLIMIT_RTPRIO: ::c_int = 14; + +extern { + pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, + flags: ::c_uint) -> ::c_int; + pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, + flags: ::c_uint, timeout: *mut ::timespec) -> ::c_int; + + pub fn getrlimit64(resource: ::c_int, + rlim: *mut ::rlimit64) -> ::c_int; + pub fn setrlimit64(resource: ::c_int, + rlim: *const ::rlimit64) -> ::c_int; + pub fn getrlimit(resource: ::c_int, + rlim: *mut ::rlimit) -> ::c_int; + pub fn setrlimit(resource: ::c_int, + rlim: *const ::rlimit) -> ::c_int; + pub fn prlimit(pid: ::pid_t, + resource: ::c_int, new_limit: *const ::rlimit, + old_limit: *mut ::rlimit) -> ::c_int; + pub fn prlimit64(pid: ::pid_t, + resource: ::c_int, + new_limit: *const ::rlimit64, + old_limit: *mut ::rlimit64) -> ::c_int; + + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::c_void) -> ::c_int; + pub fn ptrace(request: ::c_int, ...) -> ::c_long; + pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; + pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; + pub fn pthread_getaffinity_np(thread: ::pthread_t, + cpusetsize: ::size_t, + cpuset: *mut ::cpu_set_t) -> ::c_int; + pub fn pthread_setaffinity_np(thread: ::pthread_t, + cpusetsize: ::size_t, + cpuset: *const ::cpu_set_t) -> ::c_int; + pub fn sched_getcpu() -> ::c_int; +} + +cfg_if! { + if #[cfg(any(target_arch = "x86_64", + target_arch = "aarch64", + target_arch = "powerpc64"))] { + mod b64; + pub use self::b64::*; + } else if #[cfg(any(target_arch = "x86", + target_arch = "mips", + target_arch = "arm", + target_arch = "powerpc"))] { + mod b32; + pub use self::b32::*; + } else { } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/no_align.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/no_align.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/linux/no_align.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/linux/no_align.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,80 @@ +macro_rules! expand_align { + () => { + s! { + pub struct pthread_mutexattr_t { + #[cfg(any(target_arch = "x86_64", + target_arch = "powerpc64", + target_arch = "mips64", + target_arch = "s390x", + target_arch = "sparc64", + all(target_arch = "aarch64", + target_env = "musl")))] + __align: [::c_int; 0], + #[cfg(not(any(target_arch = "x86_64", + target_arch = "powerpc64", + target_arch = "mips64", + target_arch = "s390x", + target_arch = "sparc64", + all(target_arch = "aarch64", + target_env = "musl"))))] + __align: [::c_long; 0], + size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], + } + + pub struct pthread_rwlockattr_t { + #[cfg(target_env = "musl")] + __align: [::c_int; 0], + #[cfg(not(target_env = "musl"))] + __align: [::c_long; 0], + size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T], + } + + pub struct pthread_condattr_t { + __align: [::c_int; 0], + size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], + } + } + + s_no_extra_traits! { + pub struct pthread_cond_t { + #[cfg(target_env = "musl")] + __align: [*const ::c_void; 0], + #[cfg(not(target_env = "musl"))] + __align: [::c_longlong; 0], + size: [u8; ::__SIZEOF_PTHREAD_COND_T], + } + + pub struct pthread_mutex_t { + #[cfg(any(target_arch = "mips", + target_arch = "arm", + target_arch = "powerpc", + all(target_arch = "x86_64", + target_pointer_width = "32")))] + __align: [::c_long; 0], + #[cfg(not(any(target_arch = "mips", + target_arch = "arm", + target_arch = "powerpc", + all(target_arch = "x86_64", + target_pointer_width = "32"))))] + __align: [::c_longlong; 0], + size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], + } + + pub struct pthread_rwlock_t { + #[cfg(any(target_arch = "mips", + target_arch = "arm", + target_arch = "powerpc", + all(target_arch = "x86_64", + target_pointer_width = "32")))] + __align: [::c_long; 0], + #[cfg(not(any(target_arch = "mips", + target_arch = "arm", + target_arch = "powerpc", + all(target_arch = "x86_64", + target_pointer_width = "32"))))] + __align: [::c_longlong; 0], + size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], + } + } + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/linux_like/mod.rs cargo-0.37.0/vendor/libc/src/unix/linux_like/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/linux_like/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/linux_like/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,1434 @@ +pub type sa_family_t = u16; +pub type speed_t = ::c_uint; +pub type tcflag_t = ::c_uint; +pub type clockid_t = ::c_int; +pub type key_t = ::c_int; +pub type id_t = ::c_uint; + +#[cfg_attr(feature = "extra_traits", derive(Debug))] +pub enum timezone {} +impl ::Copy for timezone {} +impl ::Clone for timezone { + fn clone(&self) -> timezone { *self } +} + +s! { + pub struct in_addr { + pub s_addr: ::in_addr_t, + } + + pub struct ip_mreq { + pub imr_multiaddr: in_addr, + pub imr_interface: in_addr, + } + + pub struct sockaddr { + pub sa_family: sa_family_t, + pub sa_data: [::c_char; 14], + } + + pub struct sockaddr_in { + pub sin_family: sa_family_t, + pub sin_port: ::in_port_t, + pub sin_addr: ::in_addr, + pub sin_zero: [u8; 8], + } + + pub struct sockaddr_in6 { + pub sin6_family: sa_family_t, + pub sin6_port: ::in_port_t, + pub sin6_flowinfo: u32, + pub sin6_addr: ::in6_addr, + pub sin6_scope_id: u32, + } + + pub struct addrinfo { + pub ai_flags: ::c_int, + pub ai_family: ::c_int, + pub ai_socktype: ::c_int, + pub ai_protocol: ::c_int, + pub ai_addrlen: socklen_t, + + #[cfg(any(target_os = "linux", + target_os = "emscripten"))] + pub ai_addr: *mut ::sockaddr, + + pub ai_canonname: *mut c_char, + + #[cfg(target_os = "android")] + pub ai_addr: *mut ::sockaddr, + + pub ai_next: *mut addrinfo, + } + + pub struct sockaddr_ll { + pub sll_family: ::c_ushort, + pub sll_protocol: ::c_ushort, + pub sll_ifindex: ::c_int, + pub sll_hatype: ::c_ushort, + pub sll_pkttype: ::c_uchar, + pub sll_halen: ::c_uchar, + pub sll_addr: [::c_uchar; 8] + } + + pub struct fd_set { + fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE], + } + + pub struct tm { + pub tm_sec: ::c_int, + pub tm_min: ::c_int, + pub tm_hour: ::c_int, + pub tm_mday: ::c_int, + pub tm_mon: ::c_int, + pub tm_year: ::c_int, + pub tm_wday: ::c_int, + pub tm_yday: ::c_int, + pub tm_isdst: ::c_int, + pub tm_gmtoff: ::c_long, + pub tm_zone: *const ::c_char, + } + + pub struct sched_param { + pub sched_priority: ::c_int, + #[cfg(any(target_env = "musl", target_os = "emscripten"))] + pub sched_ss_low_priority: ::c_int, + #[cfg(any(target_env = "musl", target_os = "emscripten"))] + pub sched_ss_repl_period: ::timespec, + #[cfg(any(target_env = "musl", target_os = "emscripten"))] + pub sched_ss_init_budget: ::timespec, + #[cfg(any(target_env = "musl", target_os = "emscripten"))] + pub sched_ss_max_repl: ::c_int, + } + + pub struct Dl_info { + pub dli_fname: *const ::c_char, + pub dli_fbase: *mut ::c_void, + pub dli_sname: *const ::c_char, + pub dli_saddr: *mut ::c_void, + } + + pub struct lconv { + pub decimal_point: *mut ::c_char, + pub thousands_sep: *mut ::c_char, + pub grouping: *mut ::c_char, + pub int_curr_symbol: *mut ::c_char, + pub currency_symbol: *mut ::c_char, + pub mon_decimal_point: *mut ::c_char, + pub mon_thousands_sep: *mut ::c_char, + pub mon_grouping: *mut ::c_char, + pub positive_sign: *mut ::c_char, + pub negative_sign: *mut ::c_char, + pub int_frac_digits: ::c_char, + pub frac_digits: ::c_char, + pub p_cs_precedes: ::c_char, + pub p_sep_by_space: ::c_char, + pub n_cs_precedes: ::c_char, + pub n_sep_by_space: ::c_char, + pub p_sign_posn: ::c_char, + pub n_sign_posn: ::c_char, + pub int_p_cs_precedes: ::c_char, + pub int_p_sep_by_space: ::c_char, + pub int_n_cs_precedes: ::c_char, + pub int_n_sep_by_space: ::c_char, + pub int_p_sign_posn: ::c_char, + pub int_n_sign_posn: ::c_char, + } + + pub struct in_pktinfo { + pub ipi_ifindex: ::c_int, + pub ipi_spec_dst: ::in_addr, + pub ipi_addr: ::in_addr, + } + + pub struct ifaddrs { + pub ifa_next: *mut ifaddrs, + pub ifa_name: *mut c_char, + pub ifa_flags: ::c_uint, + pub ifa_addr: *mut ::sockaddr, + pub ifa_netmask: *mut ::sockaddr, + pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union + pub ifa_data: *mut ::c_void + } + + pub struct in6_rtmsg { + rtmsg_dst: ::in6_addr, + rtmsg_src: ::in6_addr, + rtmsg_gateway: ::in6_addr, + rtmsg_type: u32, + rtmsg_dst_len: u16, + rtmsg_src_len: u16, + rtmsg_metric: u32, + rtmsg_info: ::c_ulong, + rtmsg_flags: u32, + rtmsg_ifindex: ::c_int, + } + + pub struct arpreq { + pub arp_pa: ::sockaddr, + pub arp_ha: ::sockaddr, + pub arp_flags: ::c_int, + pub arp_netmask: ::sockaddr, + pub arp_dev: [::c_char; 16], + } + + pub struct arpreq_old { + pub arp_pa: ::sockaddr, + pub arp_ha: ::sockaddr, + pub arp_flags: ::c_int, + pub arp_netmask: ::sockaddr, + } + + pub struct arphdr { + pub ar_hrd: u16, + pub ar_pro: u16, + pub ar_hln: u8, + pub ar_pln: u8, + pub ar_op: u16, + } + + pub struct mmsghdr { + pub msg_hdr: ::msghdr, + pub msg_len: ::c_uint, + } +} + +s_no_extra_traits!{ + #[cfg_attr( + any( + all( + target_arch = "x86", + not(target_env = "musl"), + not(target_os = "android")), + target_arch = "x86_64"), + repr(packed))] + pub struct epoll_event { + pub events: u32, + pub u64: u64, + } + + pub struct sockaddr_un { + pub sun_family: sa_family_t, + pub sun_path: [::c_char; 108] + } + + pub struct sockaddr_storage { + pub ss_family: sa_family_t, + __ss_align: ::size_t, + #[cfg(target_pointer_width = "32")] + __ss_pad2: [u8; 128 - 2 * 4], + #[cfg(target_pointer_width = "64")] + __ss_pad2: [u8; 128 - 2 * 8], + } + + pub struct utsname { + pub sysname: [::c_char; 65], + pub nodename: [::c_char; 65], + pub release: [::c_char; 65], + pub version: [::c_char; 65], + pub machine: [::c_char; 65], + pub domainname: [::c_char; 65] + } + + pub struct sigevent { + pub sigev_value: ::sigval, + pub sigev_signo: ::c_int, + pub sigev_notify: ::c_int, + // Actually a union. We only expose sigev_notify_thread_id because it's + // the most useful member + pub sigev_notify_thread_id: ::c_int, + #[cfg(target_pointer_width = "64")] + __unused1: [::c_int; 11], + #[cfg(target_pointer_width = "32")] + __unused1: [::c_int; 12] + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for epoll_event { + fn eq(&self, other: &epoll_event) -> bool { + self.events == other.events + && self.u64 == other.u64 + } + } + impl Eq for epoll_event {} + impl ::fmt::Debug for epoll_event { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + let events = self.events; + let u64 = self.u64; + f.debug_struct("epoll_event") + .field("events", &events) + .field("u64", &u64) + .finish() + } + } + impl ::hash::Hash for epoll_event { + fn hash(&self, state: &mut H) { + let events = self.events; + let u64 = self.u64; + events.hash(state); + u64.hash(state); + } + } + + impl PartialEq for sockaddr_un { + fn eq(&self, other: &sockaddr_un) -> bool { + self.sun_family == other.sun_family + && self + .sun_path + .iter() + .zip(other.sun_path.iter()) + .all(|(a, b)| a == b) + } + } + impl Eq for sockaddr_un {} + impl ::fmt::Debug for sockaddr_un { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sockaddr_un") + .field("sun_family", &self.sun_family) + // FIXME: .field("sun_path", &self.sun_path) + .finish() + } + } + impl ::hash::Hash for sockaddr_un { + fn hash(&self, state: &mut H) { + self.sun_family.hash(state); + self.sun_path.hash(state); + } + } + + impl PartialEq for sockaddr_storage { + fn eq(&self, other: &sockaddr_storage) -> bool { + self.ss_family == other.ss_family + && self + .__ss_pad2 + .iter() + .zip(other.__ss_pad2.iter()) + .all(|(a, b)| a == b) + } + } + + impl Eq for sockaddr_storage {} + + impl ::fmt::Debug for sockaddr_storage { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sockaddr_storage") + .field("ss_family", &self.ss_family) + .field("__ss_align", &self.__ss_align) + // FIXME: .field("__ss_pad2", &self.__ss_pad2) + .finish() + } + } + + impl ::hash::Hash for sockaddr_storage { + fn hash(&self, state: &mut H) { + self.ss_family.hash(state); + self.__ss_pad2.hash(state); + } + } + + impl PartialEq for utsname { + fn eq(&self, other: &utsname) -> bool { + self.sysname + .iter() + .zip(other.sysname.iter()) + .all(|(a, b)| a == b) + && self + .nodename + .iter() + .zip(other.nodename.iter()) + .all(|(a, b)| a == b) + && self + .release + .iter() + .zip(other.release.iter()) + .all(|(a, b)| a == b) + && self + .version + .iter() + .zip(other.version.iter()) + .all(|(a, b)| a == b) + && self + .machine + .iter() + .zip(other.machine.iter()) + .all(|(a, b)| a == b) + && self + .domainname + .iter() + .zip(other.domainname.iter()) + .all(|(a, b)| a == b) + } + } + + impl Eq for utsname {} + + impl ::fmt::Debug for utsname { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("utsname") + // FIXME: .field("sysname", &self.sysname) + // FIXME: .field("nodename", &self.nodename) + // FIXME: .field("release", &self.release) + // FIXME: .field("version", &self.version) + // FIXME: .field("machine", &self.machine) + // FIXME: .field("domainname", &self.domainname) + .finish() + } + } + + impl ::hash::Hash for utsname { + fn hash(&self, state: &mut H) { + self.sysname.hash(state); + self.nodename.hash(state); + self.release.hash(state); + self.version.hash(state); + self.machine.hash(state); + self.domainname.hash(state); + } + } + + impl PartialEq for sigevent { + fn eq(&self, other: &sigevent) -> bool { + self.sigev_value == other.sigev_value + && self.sigev_signo == other.sigev_signo + && self.sigev_notify == other.sigev_notify + && self.sigev_notify_thread_id + == other.sigev_notify_thread_id + } + } + impl Eq for sigevent {} + impl ::fmt::Debug for sigevent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sigevent") + .field("sigev_value", &self.sigev_value) + .field("sigev_signo", &self.sigev_signo) + .field("sigev_notify", &self.sigev_notify) + .field("sigev_notify_thread_id", + &self.sigev_notify_thread_id) + .finish() + } + } + impl ::hash::Hash for sigevent { + fn hash(&self, state: &mut H) { + self.sigev_value.hash(state); + self.sigev_signo.hash(state); + self.sigev_notify.hash(state); + self.sigev_notify_thread_id.hash(state); + } + } + } +} + +// intentionally not public, only used for fd_set +cfg_if! { + if #[cfg(target_pointer_width = "32")] { + const ULONG_SIZE: usize = 32; + } else if #[cfg(target_pointer_width = "64")] { + const ULONG_SIZE: usize = 64; + } else { + // Unknown target_pointer_width + } +} + +pub const EXIT_FAILURE: ::c_int = 1; +pub const EXIT_SUCCESS: ::c_int = 0; +pub const RAND_MAX: ::c_int = 2147483647; +pub const EOF: ::c_int = -1; +pub const SEEK_SET: ::c_int = 0; +pub const SEEK_CUR: ::c_int = 1; +pub const SEEK_END: ::c_int = 2; +pub const _IOFBF: ::c_int = 0; +pub const _IONBF: ::c_int = 2; +pub const _IOLBF: ::c_int = 1; + +pub const F_DUPFD: ::c_int = 0; +pub const F_GETFD: ::c_int = 1; +pub const F_SETFD: ::c_int = 2; +pub const F_GETFL: ::c_int = 3; +pub const F_SETFL: ::c_int = 4; + +// Linux-specific fcntls +pub const F_SETLEASE: ::c_int = 1024; +pub const F_GETLEASE: ::c_int = 1025; +pub const F_NOTIFY: ::c_int = 1026; +pub const F_CANCELLK: ::c_int = 1029; +pub const F_DUPFD_CLOEXEC: ::c_int = 1030; +pub const F_SETPIPE_SZ: ::c_int = 1031; +pub const F_GETPIPE_SZ: ::c_int = 1032; +pub const F_ADD_SEALS: ::c_int = 1033; +pub const F_GET_SEALS: ::c_int = 1034; + +pub const F_SEAL_SEAL: ::c_int = 0x0001; +pub const F_SEAL_SHRINK: ::c_int = 0x0002; +pub const F_SEAL_GROW: ::c_int = 0x0004; +pub const F_SEAL_WRITE: ::c_int = 0x0008; + +// TODO(#235): Include file sealing fcntls once we have a way to verify them. + +pub const SIGTRAP: ::c_int = 5; + +pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0; +pub const PTHREAD_CREATE_DETACHED: ::c_int = 1; + +pub const CLOCK_REALTIME: ::clockid_t = 0; +pub const CLOCK_MONOTONIC: ::clockid_t = 1; +pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2; +pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3; +pub const CLOCK_MONOTONIC_RAW: ::clockid_t = 4; +pub const CLOCK_REALTIME_COARSE: ::clockid_t = 5; +pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6; +pub const CLOCK_BOOTTIME: ::clockid_t = 7; +pub const CLOCK_REALTIME_ALARM: ::clockid_t = 8; +pub const CLOCK_BOOTTIME_ALARM: ::clockid_t = 9; +// TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep +// 2014.) See also musl/mod.rs +// pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; +// pub const CLOCK_TAI: ::clockid_t = 11; +pub const TIMER_ABSTIME: ::c_int = 1; + +pub const RUSAGE_SELF: ::c_int = 0; + +pub const O_RDONLY: ::c_int = 0; +pub const O_WRONLY: ::c_int = 1; +pub const O_RDWR: ::c_int = 2; + +pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC; + +pub const S_IFIFO: ::mode_t = 4096; +pub const S_IFCHR: ::mode_t = 8192; +pub const S_IFBLK: ::mode_t = 24576; +pub const S_IFDIR: ::mode_t = 16384; +pub const S_IFREG: ::mode_t = 32768; +pub const S_IFLNK: ::mode_t = 40960; +pub const S_IFSOCK: ::mode_t = 49152; +pub const S_IFMT: ::mode_t = 61440; +pub const S_IRWXU: ::mode_t = 448; +pub const S_IXUSR: ::mode_t = 64; +pub const S_IWUSR: ::mode_t = 128; +pub const S_IRUSR: ::mode_t = 256; +pub const S_IRWXG: ::mode_t = 56; +pub const S_IXGRP: ::mode_t = 8; +pub const S_IWGRP: ::mode_t = 16; +pub const S_IRGRP: ::mode_t = 32; +pub const S_IRWXO: ::mode_t = 7; +pub const S_IXOTH: ::mode_t = 1; +pub const S_IWOTH: ::mode_t = 2; +pub const S_IROTH: ::mode_t = 4; +pub const F_OK: ::c_int = 0; +pub const R_OK: ::c_int = 4; +pub const W_OK: ::c_int = 2; +pub const X_OK: ::c_int = 1; +pub const STDIN_FILENO: ::c_int = 0; +pub const STDOUT_FILENO: ::c_int = 1; +pub const STDERR_FILENO: ::c_int = 2; +pub const SIGHUP: ::c_int = 1; +pub const SIGINT: ::c_int = 2; +pub const SIGQUIT: ::c_int = 3; +pub const SIGILL: ::c_int = 4; +pub const SIGABRT: ::c_int = 6; +pub const SIGFPE: ::c_int = 8; +pub const SIGKILL: ::c_int = 9; +pub const SIGSEGV: ::c_int = 11; +pub const SIGPIPE: ::c_int = 13; +pub const SIGALRM: ::c_int = 14; +pub const SIGTERM: ::c_int = 15; + +pub const PROT_NONE: ::c_int = 0; +pub const PROT_READ: ::c_int = 1; +pub const PROT_WRITE: ::c_int = 2; +pub const PROT_EXEC: ::c_int = 4; + +pub const LC_CTYPE: ::c_int = 0; +pub const LC_NUMERIC: ::c_int = 1; +pub const LC_TIME: ::c_int = 2; +pub const LC_COLLATE: ::c_int = 3; +pub const LC_MONETARY: ::c_int = 4; +pub const LC_MESSAGES: ::c_int = 5; +pub const LC_ALL: ::c_int = 6; +pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE); +pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC); +pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME); +pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE); +pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY); +pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES); +// LC_ALL_MASK defined per platform + +pub const MAP_FILE: ::c_int = 0x0000; +pub const MAP_SHARED: ::c_int = 0x0001; +pub const MAP_PRIVATE: ::c_int = 0x0002; +pub const MAP_FIXED: ::c_int = 0x0010; + +pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; + +// MS_ flags for msync(2) +pub const MS_ASYNC: ::c_int = 0x0001; +pub const MS_INVALIDATE: ::c_int = 0x0002; +pub const MS_SYNC: ::c_int = 0x0004; + +// MS_ flags for mount(2) +pub const MS_RDONLY: ::c_ulong = 0x01; +pub const MS_NOSUID: ::c_ulong = 0x02; +pub const MS_NODEV: ::c_ulong = 0x04; +pub const MS_NOEXEC: ::c_ulong = 0x08; +pub const MS_SYNCHRONOUS: ::c_ulong = 0x10; +pub const MS_REMOUNT: ::c_ulong = 0x20; +pub const MS_MANDLOCK: ::c_ulong = 0x40; +pub const MS_DIRSYNC: ::c_ulong = 0x80; +pub const MS_NOATIME: ::c_ulong = 0x0400; +pub const MS_NODIRATIME: ::c_ulong = 0x0800; +pub const MS_BIND: ::c_ulong = 0x1000; +pub const MS_MOVE: ::c_ulong = 0x2000; +pub const MS_REC: ::c_ulong = 0x4000; +pub const MS_SILENT: ::c_ulong = 0x8000; +pub const MS_POSIXACL: ::c_ulong = 0x010000; +pub const MS_UNBINDABLE: ::c_ulong = 0x020000; +pub const MS_PRIVATE: ::c_ulong = 0x040000; +pub const MS_SLAVE: ::c_ulong = 0x080000; +pub const MS_SHARED: ::c_ulong = 0x100000; +pub const MS_RELATIME: ::c_ulong = 0x200000; +pub const MS_KERNMOUNT: ::c_ulong = 0x400000; +pub const MS_I_VERSION: ::c_ulong = 0x800000; +pub const MS_STRICTATIME: ::c_ulong = 0x1000000; +pub const MS_ACTIVE: ::c_ulong = 0x40000000; +pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000; +pub const MS_MGC_MSK: ::c_ulong = 0xffff0000; + +pub const EPERM: ::c_int = 1; +pub const ENOENT: ::c_int = 2; +pub const ESRCH: ::c_int = 3; +pub const EINTR: ::c_int = 4; +pub const EIO: ::c_int = 5; +pub const ENXIO: ::c_int = 6; +pub const E2BIG: ::c_int = 7; +pub const ENOEXEC: ::c_int = 8; +pub const EBADF: ::c_int = 9; +pub const ECHILD: ::c_int = 10; +pub const EAGAIN: ::c_int = 11; +pub const ENOMEM: ::c_int = 12; +pub const EACCES: ::c_int = 13; +pub const EFAULT: ::c_int = 14; +pub const ENOTBLK: ::c_int = 15; +pub const EBUSY: ::c_int = 16; +pub const EEXIST: ::c_int = 17; +pub const EXDEV: ::c_int = 18; +pub const ENODEV: ::c_int = 19; +pub const ENOTDIR: ::c_int = 20; +pub const EISDIR: ::c_int = 21; +pub const EINVAL: ::c_int = 22; +pub const ENFILE: ::c_int = 23; +pub const EMFILE: ::c_int = 24; +pub const ENOTTY: ::c_int = 25; +pub const ETXTBSY: ::c_int = 26; +pub const EFBIG: ::c_int = 27; +pub const ENOSPC: ::c_int = 28; +pub const ESPIPE: ::c_int = 29; +pub const EROFS: ::c_int = 30; +pub const EMLINK: ::c_int = 31; +pub const EPIPE: ::c_int = 32; +pub const EDOM: ::c_int = 33; +pub const ERANGE: ::c_int = 34; +pub const EWOULDBLOCK: ::c_int = EAGAIN; + +pub const SCM_RIGHTS: ::c_int = 0x01; +pub const SCM_CREDENTIALS: ::c_int = 0x02; + +pub const PROT_GROWSDOWN: ::c_int = 0x1000000; +pub const PROT_GROWSUP: ::c_int = 0x2000000; + +pub const MAP_TYPE: ::c_int = 0x000f; + +pub const MADV_NORMAL: ::c_int = 0; +pub const MADV_RANDOM: ::c_int = 1; +pub const MADV_SEQUENTIAL: ::c_int = 2; +pub const MADV_WILLNEED: ::c_int = 3; +pub const MADV_DONTNEED: ::c_int = 4; +pub const MADV_FREE: ::c_int = 8; +pub const MADV_REMOVE: ::c_int = 9; +pub const MADV_DONTFORK: ::c_int = 10; +pub const MADV_DOFORK: ::c_int = 11; +pub const MADV_MERGEABLE: ::c_int = 12; +pub const MADV_UNMERGEABLE: ::c_int = 13; +pub const MADV_HUGEPAGE: ::c_int = 14; +pub const MADV_NOHUGEPAGE: ::c_int = 15; +pub const MADV_DONTDUMP: ::c_int = 16; +pub const MADV_DODUMP: ::c_int = 17; +pub const MADV_HWPOISON: ::c_int = 100; + +pub const IFF_UP: ::c_int = 0x1; +pub const IFF_BROADCAST: ::c_int = 0x2; +pub const IFF_DEBUG: ::c_int = 0x4; +pub const IFF_LOOPBACK: ::c_int = 0x8; +pub const IFF_POINTOPOINT: ::c_int = 0x10; +pub const IFF_NOTRAILERS: ::c_int = 0x20; +pub const IFF_RUNNING: ::c_int = 0x40; +pub const IFF_NOARP: ::c_int = 0x80; +pub const IFF_PROMISC: ::c_int = 0x100; +pub const IFF_ALLMULTI: ::c_int = 0x200; +pub const IFF_MASTER: ::c_int = 0x400; +pub const IFF_SLAVE: ::c_int = 0x800; +pub const IFF_MULTICAST: ::c_int = 0x1000; +pub const IFF_PORTSEL: ::c_int = 0x2000; +pub const IFF_AUTOMEDIA: ::c_int = 0x4000; +pub const IFF_DYNAMIC: ::c_int = 0x8000; + +pub const SOL_IP: ::c_int = 0; +pub const SOL_TCP: ::c_int = 6; +pub const SOL_UDP: ::c_int = 17; +pub const SOL_IPV6: ::c_int = 41; +pub const SOL_ICMPV6: ::c_int = 58; +pub const SOL_RAW: ::c_int = 255; +pub const SOL_DECNET: ::c_int = 261; +pub const SOL_X25: ::c_int = 262; +pub const SOL_PACKET: ::c_int = 263; +pub const SOL_ATM: ::c_int = 264; +pub const SOL_AAL: ::c_int = 265; +pub const SOL_IRDA: ::c_int = 266; +pub const SOL_NETBEUI: ::c_int = 267; +pub const SOL_LLC: ::c_int = 268; +pub const SOL_DCCP: ::c_int = 269; +pub const SOL_NETLINK: ::c_int = 270; +pub const SOL_TIPC: ::c_int = 271; +pub const SOL_BLUETOOTH: ::c_int = 274; +pub const SOL_ALG: ::c_int = 279; + +pub const AF_UNSPEC: ::c_int = 0; +pub const AF_UNIX: ::c_int = 1; +pub const AF_LOCAL: ::c_int = 1; +pub const AF_INET: ::c_int = 2; +pub const AF_AX25: ::c_int = 3; +pub const AF_IPX: ::c_int = 4; +pub const AF_APPLETALK: ::c_int = 5; +pub const AF_NETROM: ::c_int = 6; +pub const AF_BRIDGE: ::c_int = 7; +pub const AF_ATMPVC: ::c_int = 8; +pub const AF_X25: ::c_int = 9; +pub const AF_INET6: ::c_int = 10; +pub const AF_ROSE: ::c_int = 11; +pub const AF_DECnet: ::c_int = 12; +pub const AF_NETBEUI: ::c_int = 13; +pub const AF_SECURITY: ::c_int = 14; +pub const AF_KEY: ::c_int = 15; +pub const AF_NETLINK: ::c_int = 16; +pub const AF_ROUTE: ::c_int = AF_NETLINK; +pub const AF_PACKET: ::c_int = 17; +pub const AF_ASH: ::c_int = 18; +pub const AF_ECONET: ::c_int = 19; +pub const AF_ATMSVC: ::c_int = 20; +pub const AF_RDS: ::c_int = 21; +pub const AF_SNA: ::c_int = 22; +pub const AF_IRDA: ::c_int = 23; +pub const AF_PPPOX: ::c_int = 24; +pub const AF_WANPIPE: ::c_int = 25; +pub const AF_LLC: ::c_int = 26; +pub const AF_CAN: ::c_int = 29; +pub const AF_TIPC: ::c_int = 30; +pub const AF_BLUETOOTH: ::c_int = 31; +pub const AF_IUCV: ::c_int = 32; +pub const AF_RXRPC: ::c_int = 33; +pub const AF_ISDN: ::c_int = 34; +pub const AF_PHONET: ::c_int = 35; +pub const AF_IEEE802154: ::c_int = 36; +pub const AF_CAIF: ::c_int = 37; +pub const AF_ALG: ::c_int = 38; + +pub const PF_UNSPEC: ::c_int = AF_UNSPEC; +pub const PF_UNIX: ::c_int = AF_UNIX; +pub const PF_LOCAL: ::c_int = AF_LOCAL; +pub const PF_INET: ::c_int = AF_INET; +pub const PF_AX25: ::c_int = AF_AX25; +pub const PF_IPX: ::c_int = AF_IPX; +pub const PF_APPLETALK: ::c_int = AF_APPLETALK; +pub const PF_NETROM: ::c_int = AF_NETROM; +pub const PF_BRIDGE: ::c_int = AF_BRIDGE; +pub const PF_ATMPVC: ::c_int = AF_ATMPVC; +pub const PF_X25: ::c_int = AF_X25; +pub const PF_INET6: ::c_int = AF_INET6; +pub const PF_ROSE: ::c_int = AF_ROSE; +pub const PF_DECnet: ::c_int = AF_DECnet; +pub const PF_NETBEUI: ::c_int = AF_NETBEUI; +pub const PF_SECURITY: ::c_int = AF_SECURITY; +pub const PF_KEY: ::c_int = AF_KEY; +pub const PF_NETLINK: ::c_int = AF_NETLINK; +pub const PF_ROUTE: ::c_int = AF_ROUTE; +pub const PF_PACKET: ::c_int = AF_PACKET; +pub const PF_ASH: ::c_int = AF_ASH; +pub const PF_ECONET: ::c_int = AF_ECONET; +pub const PF_ATMSVC: ::c_int = AF_ATMSVC; +pub const PF_RDS: ::c_int = AF_RDS; +pub const PF_SNA: ::c_int = AF_SNA; +pub const PF_IRDA: ::c_int = AF_IRDA; +pub const PF_PPPOX: ::c_int = AF_PPPOX; +pub const PF_WANPIPE: ::c_int = AF_WANPIPE; +pub const PF_LLC: ::c_int = AF_LLC; +pub const PF_CAN: ::c_int = AF_CAN; +pub const PF_TIPC: ::c_int = AF_TIPC; +pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH; +pub const PF_IUCV: ::c_int = AF_IUCV; +pub const PF_RXRPC: ::c_int = AF_RXRPC; +pub const PF_ISDN: ::c_int = AF_ISDN; +pub const PF_PHONET: ::c_int = AF_PHONET; +pub const PF_IEEE802154: ::c_int = AF_IEEE802154; +pub const PF_CAIF: ::c_int = AF_CAIF; +pub const PF_ALG: ::c_int = AF_ALG; + +pub const SOMAXCONN: ::c_int = 128; + +pub const MSG_OOB: ::c_int = 1; +pub const MSG_PEEK: ::c_int = 2; +pub const MSG_DONTROUTE: ::c_int = 4; +pub const MSG_CTRUNC: ::c_int = 8; +pub const MSG_TRUNC: ::c_int = 0x20; +pub const MSG_DONTWAIT: ::c_int = 0x40; +pub const MSG_EOR: ::c_int = 0x80; +pub const MSG_WAITALL: ::c_int = 0x100; +pub const MSG_FIN: ::c_int = 0x200; +pub const MSG_SYN: ::c_int = 0x400; +pub const MSG_CONFIRM: ::c_int = 0x800; +pub const MSG_RST: ::c_int = 0x1000; +pub const MSG_ERRQUEUE: ::c_int = 0x2000; +pub const MSG_NOSIGNAL: ::c_int = 0x4000; +pub const MSG_MORE: ::c_int = 0x8000; +pub const MSG_WAITFORONE: ::c_int = 0x10000; +pub const MSG_FASTOPEN: ::c_int = 0x20000000; +pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000; + +pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP; + +pub const SOCK_RAW: ::c_int = 3; +pub const SOCK_RDM: ::c_int = 4; +pub const IP_MULTICAST_IF: ::c_int = 32; +pub const IP_MULTICAST_TTL: ::c_int = 33; +pub const IP_MULTICAST_LOOP: ::c_int = 34; +pub const IP_TOS: ::c_int = 1; +pub const IP_TTL: ::c_int = 2; +pub const IP_HDRINCL: ::c_int = 3; +pub const IP_PKTINFO: ::c_int = 8; +pub const IP_RECVTOS: ::c_int = 13; +pub const IP_ADD_MEMBERSHIP: ::c_int = 35; +pub const IP_DROP_MEMBERSHIP: ::c_int = 36; +pub const IP_TRANSPARENT: ::c_int = 19; +pub const IPV6_UNICAST_HOPS: ::c_int = 16; +pub const IPV6_MULTICAST_IF: ::c_int = 17; +pub const IPV6_MULTICAST_HOPS: ::c_int = 18; +pub const IPV6_MULTICAST_LOOP: ::c_int = 19; +pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20; +pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21; +pub const IPV6_V6ONLY: ::c_int = 26; +pub const IPV6_RECVPKTINFO: ::c_int = 49; +pub const IPV6_PKTINFO: ::c_int = 50; +pub const IPV6_RECVTCLASS: ::c_int = 66; +pub const IPV6_TCLASS: ::c_int = 67; + +pub const TCP_NODELAY: ::c_int = 1; +pub const TCP_MAXSEG: ::c_int = 2; +pub const TCP_CORK: ::c_int = 3; +pub const TCP_KEEPIDLE: ::c_int = 4; +pub const TCP_KEEPINTVL: ::c_int = 5; +pub const TCP_KEEPCNT: ::c_int = 6; +pub const TCP_SYNCNT: ::c_int = 7; +pub const TCP_LINGER2: ::c_int = 8; +pub const TCP_DEFER_ACCEPT: ::c_int = 9; +pub const TCP_WINDOW_CLAMP: ::c_int = 10; +pub const TCP_INFO: ::c_int = 11; +pub const TCP_QUICKACK: ::c_int = 12; +pub const TCP_CONGESTION: ::c_int = 13; + +pub const SO_DEBUG: ::c_int = 1; + +pub const SHUT_RD: ::c_int = 0; +pub const SHUT_WR: ::c_int = 1; +pub const SHUT_RDWR: ::c_int = 2; + +pub const LOCK_SH: ::c_int = 1; +pub const LOCK_EX: ::c_int = 2; +pub const LOCK_NB: ::c_int = 4; +pub const LOCK_UN: ::c_int = 8; + +pub const SS_ONSTACK: ::c_int = 1; +pub const SS_DISABLE: ::c_int = 2; + +pub const PATH_MAX: ::c_int = 4096; + +pub const FD_SETSIZE: usize = 1024; + +pub const EPOLLIN: ::c_int = 0x1; +pub const EPOLLPRI: ::c_int = 0x2; +pub const EPOLLOUT: ::c_int = 0x4; +pub const EPOLLRDNORM: ::c_int = 0x40; +pub const EPOLLRDBAND: ::c_int = 0x80; +pub const EPOLLWRNORM: ::c_int = 0x100; +pub const EPOLLWRBAND: ::c_int = 0x200; +pub const EPOLLMSG: ::c_int = 0x400; +pub const EPOLLERR: ::c_int = 0x8; +pub const EPOLLHUP: ::c_int = 0x10; +pub const EPOLLET: ::c_int = 0x80000000; + +pub const EPOLL_CTL_ADD: ::c_int = 1; +pub const EPOLL_CTL_MOD: ::c_int = 3; +pub const EPOLL_CTL_DEL: ::c_int = 2; + +pub const MNT_DETACH: ::c_int = 0x2; +pub const MNT_EXPIRE: ::c_int = 0x4; + +pub const Q_GETFMT: ::c_int = 0x800004; +pub const Q_GETINFO: ::c_int = 0x800005; +pub const Q_SETINFO: ::c_int = 0x800006; +pub const QIF_BLIMITS: u32 = 1; +pub const QIF_SPACE: u32 = 2; +pub const QIF_ILIMITS: u32 = 4; +pub const QIF_INODES: u32 = 8; +pub const QIF_BTIME: u32 = 16; +pub const QIF_ITIME: u32 = 32; +pub const QIF_LIMITS: u32 = 5; +pub const QIF_USAGE: u32 = 10; +pub const QIF_TIMES: u32 = 48; +pub const QIF_ALL: u32 = 63; + +pub const MNT_FORCE: ::c_int = 0x1; + +pub const Q_SYNC: ::c_int = 0x800001; +pub const Q_QUOTAON: ::c_int = 0x800002; +pub const Q_QUOTAOFF: ::c_int = 0x800003; +pub const Q_GETQUOTA: ::c_int = 0x800007; +pub const Q_SETQUOTA: ::c_int = 0x800008; + +pub const TCIOFF: ::c_int = 2; +pub const TCION: ::c_int = 3; +pub const TCOOFF: ::c_int = 0; +pub const TCOON: ::c_int = 1; +pub const TCIFLUSH: ::c_int = 0; +pub const TCOFLUSH: ::c_int = 1; +pub const TCIOFLUSH: ::c_int = 2; +pub const NL0: ::tcflag_t = 0x00000000; +pub const NL1: ::tcflag_t = 0x00000100; +pub const TAB0: ::tcflag_t = 0x00000000; +pub const CR0: ::tcflag_t = 0x00000000; +pub const FF0: ::tcflag_t = 0x00000000; +pub const BS0: ::tcflag_t = 0x00000000; +pub const VT0: ::tcflag_t = 0x00000000; +pub const VERASE: usize = 2; +pub const VKILL: usize = 3; +pub const VINTR: usize = 0; +pub const VQUIT: usize = 1; +pub const VLNEXT: usize = 15; +pub const IGNBRK: ::tcflag_t = 0x00000001; +pub const BRKINT: ::tcflag_t = 0x00000002; +pub const IGNPAR: ::tcflag_t = 0x00000004; +pub const PARMRK: ::tcflag_t = 0x00000008; +pub const INPCK: ::tcflag_t = 0x00000010; +pub const ISTRIP: ::tcflag_t = 0x00000020; +pub const INLCR: ::tcflag_t = 0x00000040; +pub const IGNCR: ::tcflag_t = 0x00000080; +pub const ICRNL: ::tcflag_t = 0x00000100; +pub const IXANY: ::tcflag_t = 0x00000800; +pub const IMAXBEL: ::tcflag_t = 0x00002000; +pub const OPOST: ::tcflag_t = 0x1; +pub const CS5: ::tcflag_t = 0x00000000; +pub const CRTSCTS: ::tcflag_t = 0x80000000; +pub const ECHO: ::tcflag_t = 0x00000008; +pub const OCRNL: ::tcflag_t = 0o000010; +pub const ONOCR: ::tcflag_t = 0o000020; +pub const ONLRET: ::tcflag_t = 0o000040; +pub const OFILL: ::tcflag_t = 0o000100; +pub const OFDEL: ::tcflag_t = 0o000200; + +pub const CLONE_VM: ::c_int = 0x100; +pub const CLONE_FS: ::c_int = 0x200; +pub const CLONE_FILES: ::c_int = 0x400; +pub const CLONE_SIGHAND: ::c_int = 0x800; +pub const CLONE_PTRACE: ::c_int = 0x2000; +pub const CLONE_VFORK: ::c_int = 0x4000; +pub const CLONE_PARENT: ::c_int = 0x8000; +pub const CLONE_THREAD: ::c_int = 0x10000; +pub const CLONE_NEWNS: ::c_int = 0x20000; +pub const CLONE_SYSVSEM: ::c_int = 0x40000; +pub const CLONE_SETTLS: ::c_int = 0x80000; +pub const CLONE_PARENT_SETTID: ::c_int = 0x100000; +pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000; +pub const CLONE_DETACHED: ::c_int = 0x400000; +pub const CLONE_UNTRACED: ::c_int = 0x800000; +pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000; +pub const CLONE_NEWUTS: ::c_int = 0x04000000; +pub const CLONE_NEWIPC: ::c_int = 0x08000000; +pub const CLONE_NEWUSER: ::c_int = 0x10000000; +pub const CLONE_NEWPID: ::c_int = 0x20000000; +pub const CLONE_NEWNET: ::c_int = 0x40000000; +pub const CLONE_IO: ::c_int = 0x80000000; +pub const CLONE_NEWCGROUP: ::c_int = 0x02000000; + +pub const WNOHANG: ::c_int = 0x00000001; +pub const WUNTRACED: ::c_int = 0x00000002; +pub const WSTOPPED: ::c_int = WUNTRACED; +pub const WEXITED: ::c_int = 0x00000004; +pub const WCONTINUED: ::c_int = 0x00000008; +pub const WNOWAIT: ::c_int = 0x01000000; + +// Options set using PTRACE_SETOPTIONS. +pub const PTRACE_O_TRACESYSGOOD: ::c_int = 0x00000001; +pub const PTRACE_O_TRACEFORK: ::c_int = 0x00000002; +pub const PTRACE_O_TRACEVFORK: ::c_int = 0x00000004; +pub const PTRACE_O_TRACECLONE: ::c_int = 0x00000008; +pub const PTRACE_O_TRACEEXEC: ::c_int = 0x00000010; +pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 0x00000020; +pub const PTRACE_O_TRACEEXIT: ::c_int = 0x00000040; +pub const PTRACE_O_TRACESECCOMP: ::c_int = 0x00000080; +pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000; +pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000; +pub const PTRACE_O_MASK: ::c_int = 0x003000ff; + +// Wait extended result codes for the above trace options. +pub const PTRACE_EVENT_FORK: ::c_int = 1; +pub const PTRACE_EVENT_VFORK: ::c_int = 2; +pub const PTRACE_EVENT_CLONE: ::c_int = 3; +pub const PTRACE_EVENT_EXEC: ::c_int = 4; +pub const PTRACE_EVENT_VFORK_DONE: ::c_int = 5; +pub const PTRACE_EVENT_EXIT: ::c_int = 6; +pub const PTRACE_EVENT_SECCOMP: ::c_int = 7; +// PTRACE_EVENT_STOP was added to glibc in 2.26 +// pub const PTRACE_EVENT_STOP: ::c_int = 128; + +pub const __WNOTHREAD: ::c_int = 0x20000000; +pub const __WALL: ::c_int = 0x40000000; +pub const __WCLONE: ::c_int = 0x80000000; + +pub const SPLICE_F_MOVE: ::c_uint = 0x01; +pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02; +pub const SPLICE_F_MORE: ::c_uint = 0x04; +pub const SPLICE_F_GIFT: ::c_uint = 0x08; + +pub const RTLD_LOCAL: ::c_int = 0; +pub const RTLD_LAZY: ::c_int = 1; + +pub const POSIX_FADV_NORMAL: ::c_int = 0; +pub const POSIX_FADV_RANDOM: ::c_int = 1; +pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2; +pub const POSIX_FADV_WILLNEED: ::c_int = 3; + +pub const AT_FDCWD: ::c_int = -100; +pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100; +pub const AT_REMOVEDIR: ::c_int = 0x200; +pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400; +pub const AT_NO_AUTOMOUNT: ::c_int = 0x800; +pub const AT_EMPTY_PATH: ::c_int = 0x1000; + +pub const LOG_CRON: ::c_int = 9 << 3; +pub const LOG_AUTHPRIV: ::c_int = 10 << 3; +pub const LOG_FTP: ::c_int = 11 << 3; +pub const LOG_PERROR: ::c_int = 0x20; + +pub const PIPE_BUF: usize = 4096; + +pub const SI_LOAD_SHIFT: ::c_uint = 16; + +pub const SIGEV_SIGNAL: ::c_int = 0; +pub const SIGEV_NONE: ::c_int = 1; +pub const SIGEV_THREAD: ::c_int = 2; + +pub const P_ALL: idtype_t = 0; +pub const P_PID: idtype_t = 1; +pub const P_PGID: idtype_t = 2; + +pub const UTIME_OMIT: c_long = 1073741822; +pub const UTIME_NOW: c_long = 1073741823; + +pub const POLLIN: ::c_short = 0x1; +pub const POLLPRI: ::c_short = 0x2; +pub const POLLOUT: ::c_short = 0x4; +pub const POLLERR: ::c_short = 0x8; +pub const POLLHUP: ::c_short = 0x10; +pub const POLLNVAL: ::c_short = 0x20; +pub const POLLRDNORM: ::c_short = 0x040; +pub const POLLRDBAND: ::c_short = 0x080; + +pub const IPTOS_LOWDELAY: u8 = 0x10; +pub const IPTOS_THROUGHPUT: u8 = 0x08; +pub const IPTOS_RELIABILITY: u8 = 0x04; +pub const IPTOS_MINCOST: u8 = 0x02; + +pub const IPTOS_PREC_NETCONTROL: u8 = 0xe0; +pub const IPTOS_PREC_INTERNETCONTROL: u8 = 0xc0; +pub const IPTOS_PREC_CRITIC_ECP: u8 = 0xa0; +pub const IPTOS_PREC_FLASHOVERRIDE: u8 = 0x80; +pub const IPTOS_PREC_FLASH: u8 = 0x60; +pub const IPTOS_PREC_IMMEDIATE: u8 = 0x40; +pub const IPTOS_PREC_PRIORITY: u8 = 0x20; +pub const IPTOS_PREC_ROUTINE: u8 = 0x00; + +pub const IPTOS_ECN_MASK: u8 = 0x03; +pub const IPTOS_ECN_ECT1: u8 = 0x01; +pub const IPTOS_ECN_ECT0: u8 = 0x02; +pub const IPTOS_ECN_CE: u8 = 0x03; + +pub const IPOPT_COPY: u8 = 0x80; +pub const IPOPT_CLASS_MASK: u8 = 0x60; +pub const IPOPT_NUMBER_MASK: u8 = 0x1f; + +pub const IPOPT_CONTROL: u8 = 0x00; +pub const IPOPT_RESERVED1: u8 = 0x20; +pub const IPOPT_MEASUREMENT: u8 = 0x40; +pub const IPOPT_RESERVED2: u8 = 0x60; +pub const IPOPT_END: u8 = (0 |IPOPT_CONTROL); +pub const IPOPT_NOOP: u8 = (1 |IPOPT_CONTROL); +pub const IPOPT_SEC: u8 = (2 |IPOPT_CONTROL|IPOPT_COPY); +pub const IPOPT_LSRR: u8 = (3 |IPOPT_CONTROL|IPOPT_COPY); +pub const IPOPT_TIMESTAMP: u8 = (4 |IPOPT_MEASUREMENT); +pub const IPOPT_RR: u8 = (7 |IPOPT_CONTROL); +pub const IPOPT_SID: u8 = (8 |IPOPT_CONTROL|IPOPT_COPY); +pub const IPOPT_SSRR: u8 = (9 |IPOPT_CONTROL|IPOPT_COPY); +pub const IPOPT_RA: u8 = (20|IPOPT_CONTROL|IPOPT_COPY); +pub const IPVERSION: u8 = 4; +pub const MAXTTL: u8 = 255; +pub const IPDEFTTL: u8 = 64; +pub const IPOPT_OPTVAL: u8 = 0; +pub const IPOPT_OLEN: u8 = 1; +pub const IPOPT_OFFSET: u8 = 2; +pub const IPOPT_MINOFF: u8 = 4; +pub const MAX_IPOPTLEN: u8 = 40; +pub const IPOPT_NOP: u8 = IPOPT_NOOP; +pub const IPOPT_EOL: u8 = IPOPT_END; +pub const IPOPT_TS: u8 = IPOPT_TIMESTAMP; +pub const IPOPT_TS_TSONLY: u8 = 0; +pub const IPOPT_TS_TSANDADDR: u8 = 1; +pub const IPOPT_TS_PRESPEC: u8 = 3; + +pub const ARPOP_RREQUEST: u16 = 3; +pub const ARPOP_RREPLY: u16 = 4; +pub const ARPOP_InREQUEST: u16 = 8; +pub const ARPOP_InREPLY: u16 = 9; +pub const ARPOP_NAK: u16 = 10; + +pub const ATF_NETMASK: ::c_int = 0x20; +pub const ATF_DONTPUB: ::c_int = 0x40; + +pub const ARPHRD_NETROM: u16 = 0; +pub const ARPHRD_ETHER: u16 = 1; +pub const ARPHRD_EETHER: u16 = 2; +pub const ARPHRD_AX25: u16 = 3; +pub const ARPHRD_PRONET: u16 = 4; +pub const ARPHRD_CHAOS: u16 = 5; +pub const ARPHRD_IEEE802: u16 = 6; +pub const ARPHRD_ARCNET: u16 = 7; +pub const ARPHRD_APPLETLK: u16 = 8; +pub const ARPHRD_DLCI: u16 = 15; +pub const ARPHRD_ATM: u16 = 19; +pub const ARPHRD_METRICOM: u16 = 23; +pub const ARPHRD_IEEE1394: u16 = 24; +pub const ARPHRD_EUI64: u16 = 27; +pub const ARPHRD_INFINIBAND: u16 = 32; + +pub const ARPHRD_SLIP: u16 = 256; +pub const ARPHRD_CSLIP: u16 = 257; +pub const ARPHRD_SLIP6: u16 = 258; +pub const ARPHRD_CSLIP6: u16 = 259; +pub const ARPHRD_RSRVD: u16 = 260; +pub const ARPHRD_ADAPT: u16 = 264; +pub const ARPHRD_ROSE: u16 = 270; +pub const ARPHRD_X25: u16 = 271; +pub const ARPHRD_HWX25: u16 = 272; +pub const ARPHRD_PPP: u16 = 512; +pub const ARPHRD_CISCO: u16 = 513; +pub const ARPHRD_HDLC: u16 = ARPHRD_CISCO; +pub const ARPHRD_LAPB: u16 = 516; +pub const ARPHRD_DDCMP: u16 = 517; +pub const ARPHRD_RAWHDLC: u16 = 518; + +pub const ARPHRD_TUNNEL: u16 = 768; +pub const ARPHRD_TUNNEL6: u16 = 769; +pub const ARPHRD_FRAD: u16 = 770; +pub const ARPHRD_SKIP: u16 = 771; +pub const ARPHRD_LOOPBACK: u16 = 772; +pub const ARPHRD_LOCALTLK: u16 = 773; +pub const ARPHRD_FDDI: u16 = 774; +pub const ARPHRD_BIF: u16 = 775; +pub const ARPHRD_SIT: u16 = 776; +pub const ARPHRD_IPDDP: u16 = 777; +pub const ARPHRD_IPGRE: u16 = 778; +pub const ARPHRD_PIMREG: u16 = 779; +pub const ARPHRD_HIPPI: u16 = 780; +pub const ARPHRD_ASH: u16 = 781; +pub const ARPHRD_ECONET: u16 = 782; +pub const ARPHRD_IRDA: u16 = 783; +pub const ARPHRD_FCPP: u16 = 784; +pub const ARPHRD_FCAL: u16 = 785; +pub const ARPHRD_FCPL: u16 = 786; +pub const ARPHRD_FCFABRIC: u16 = 787; +pub const ARPHRD_IEEE802_TR: u16 = 800; +pub const ARPHRD_IEEE80211: u16 = 801; +pub const ARPHRD_IEEE80211_PRISM: u16 = 802; +pub const ARPHRD_IEEE80211_RADIOTAP: u16 = 803; +pub const ARPHRD_IEEE802154: u16 = 804; + +pub const ARPHRD_VOID: u16 = 0xFFFF; +pub const ARPHRD_NONE: u16 = 0xFFFE; + +fn CMSG_ALIGN(len: usize) -> usize { + len + ::mem::size_of::() - 1 & !(::mem::size_of::() - 1) +} + +f! { + pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { + if (*mhdr).msg_controllen as usize >= ::mem::size_of::() { + (*mhdr).msg_control as *mut cmsghdr + } else { + 0 as *mut cmsghdr + } + } + + pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut ::c_uchar { + cmsg.offset(1) as *mut ::c_uchar + } + + pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { + (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::())) + as ::c_uint + } + + pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint { + CMSG_ALIGN(::mem::size_of::()) as ::c_uint + length + } + + pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { + let fd = fd as usize; + let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; + (*set).fds_bits[fd / size] &= !(1 << (fd % size)); + return + } + + pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool { + let fd = fd as usize; + let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; + return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0 + } + + pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { + let fd = fd as usize; + let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; + (*set).fds_bits[fd / size] |= 1 << (fd % size); + return + } + + pub fn FD_ZERO(set: *mut fd_set) -> () { + for slot in (*set).fds_bits.iter_mut() { + *slot = 0; + } + } + + pub fn WIFSTOPPED(status: ::c_int) -> bool { + (status & 0xff) == 0x7f + } + + pub fn WSTOPSIG(status: ::c_int) -> ::c_int { + (status >> 8) & 0xff + } + + pub fn WIFCONTINUED(status: ::c_int) -> bool { + status == 0xffff + } + + pub fn WIFSIGNALED(status: ::c_int) -> bool { + ((status & 0x7f) + 1) as i8 >= 2 + } + + pub fn WTERMSIG(status: ::c_int) -> ::c_int { + status & 0x7f + } + + pub fn WIFEXITED(status: ::c_int) -> bool { + (status & 0x7f) == 0 + } + + pub fn WEXITSTATUS(status: ::c_int) -> ::c_int { + (status >> 8) & 0xff + } + + pub fn WCOREDUMP(status: ::c_int) -> bool { + (status & 0x80) != 0 + } + + pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int { + (cmd << 8) | (type_ & 0x00ff) + } + + pub fn IPOPT_COPIED(o: u8) -> u8 { + o & IPOPT_COPY + } + + pub fn IPOPT_CLASS(o: u8) -> u8 { + o & IPOPT_CLASS_MASK + } + + pub fn IPOPT_NUMBER(o: u8) -> u8 { + o & IPOPT_NUMBER_MASK + } + + pub fn IPTOS_ECN(x: u8) -> u8 { + x & ::IPTOS_ECN_MASK + } +} + +extern { + pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; + pub fn sem_init(sem: *mut sem_t, + pshared: ::c_int, + value: ::c_uint) + -> ::c_int; + pub fn fdatasync(fd: ::c_int) -> ::c_int; + pub fn mincore(addr: *mut ::c_void, len: ::size_t, + vec: *mut ::c_uchar) -> ::c_int; + pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; + pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; + pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int; + pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; + + pub fn pthread_getattr_np(native: ::pthread_t, + attr: *mut ::pthread_attr_t) -> ::c_int; + pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t, + stackaddr: *mut *mut ::c_void, + stacksize: *mut ::size_t) -> ::c_int; + pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; + pub fn setgroups(ngroups: ::size_t, + ptr: *const ::gid_t) -> ::c_int; + pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; + pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; + pub fn statfs64(path: *const ::c_char, buf: *mut statfs64) -> ::c_int; + pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; + pub fn fstatfs64(fd: ::c_int, buf: *mut statfs64) -> ::c_int; + pub fn statvfs64(path: *const ::c_char, buf: *mut statvfs64) -> ::c_int; + pub fn fstatvfs64(fd: ::c_int, buf: *mut statvfs64) -> ::c_int; + pub fn memrchr(cx: *const ::c_void, + c: ::c_int, + n: ::size_t) -> *mut ::c_void; + + pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, + advise: ::c_int) -> ::c_int; + pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; + pub fn utimensat(dirfd: ::c_int, path: *const ::c_char, + times: *const ::timespec, flag: ::c_int) -> ::c_int; + pub fn duplocale(base: ::locale_t) -> ::locale_t; + pub fn freelocale(loc: ::locale_t); + pub fn newlocale(mask: ::c_int, + locale: *const ::c_char, + base: ::locale_t) -> ::locale_t; + pub fn uselocale(loc: ::locale_t) -> ::locale_t; + pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int; + pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int; + pub fn fstatat64(dirfd: ::c_int, pathname: *const c_char, + buf: *mut stat64, flags: ::c_int) -> ::c_int; + pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int; + pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t; + pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int; + pub fn mmap64(addr: *mut ::c_void, + len: ::size_t, + prot: ::c_int, + flags: ::c_int, + fd: ::c_int, + offset: off64_t) + -> *mut ::c_void; + pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; + pub fn openat64(fd: ::c_int, + path: *const c_char, + oflag: ::c_int, ...) -> ::c_int; + pub fn pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, + offset: off64_t) -> ::ssize_t; + pub fn preadv64(fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + offset: ::off64_t) -> ::ssize_t; + pub fn pwrite64(fd: ::c_int, buf: *const ::c_void, count: ::size_t, + offset: off64_t) -> ::ssize_t; + pub fn pwritev64(fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + offset: ::off64_t) -> ::ssize_t; + pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64; + pub fn readdir64_r(dirp: *mut ::DIR, entry: *mut ::dirent64, + result: *mut *mut ::dirent64) -> ::c_int; + pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int; + pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int; + + pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, + mode: ::mode_t, dev: dev_t) -> ::c_int; + pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t, + clock_id: *mut clockid_t) -> ::c_int; + pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t, + clock_id: ::clockid_t) -> ::c_int; + pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, + pshared: ::c_int) -> ::c_int; + pub fn accept4(fd: ::c_int, addr: *mut ::sockaddr, len: *mut ::socklen_t, + flg: ::c_int) -> ::c_int; + pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, + pshared: ::c_int) -> ::c_int; + pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t, + val: *mut ::c_int) -> ::c_int; + pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, + val: ::c_int) -> ::c_int; + pub fn ptsname_r(fd: ::c_int, + buf: *mut ::c_char, + buflen: ::size_t) -> ::c_int; + pub fn clearenv() -> ::c_int; + pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, + options: ::c_int) -> ::c_int; + pub fn setreuid(ruid: ::uid_t, euid: ::uid_t) -> ::c_int; + pub fn setregid(rgid: ::gid_t, egid: ::gid_t) -> ::c_int; + pub fn getresuid(ruid: *mut ::uid_t, euid: *mut ::uid_t, + suid: *mut ::uid_t) -> ::c_int; + pub fn getresgid(rgid: *mut ::gid_t, egid: *mut ::gid_t, + sgid: *mut ::gid_t) -> ::c_int; + pub fn acct(filename: *const ::c_char) -> ::c_int; + pub fn brk(addr: *mut ::c_void) -> ::c_int; + pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void; + pub fn vfork() -> ::pid_t; + pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int; + pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int; + pub fn wait4(pid: ::pid_t, status: *mut ::c_int, options: ::c_int, + rusage: *mut ::rusage) -> ::pid_t; + pub fn openpty(amaster: *mut ::c_int, + aslave: *mut ::c_int, + name: *mut ::c_char, + termp: *const termios, + winp: *const ::winsize) -> ::c_int; + pub fn forkpty(amaster: *mut ::c_int, + name: *mut ::c_char, + termp: *const termios, + winp: *const ::winsize) -> ::pid_t; + pub fn login_tty(fd: ::c_int) -> ::c_int; + pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char, + envp: *const *const ::c_char) -> ::c_int; + pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char, + envp: *const *const ::c_char) + -> ::c_int; + pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; + pub fn freeifaddrs(ifa: *mut ::ifaddrs); + pub fn bind(socket: ::c_int, address: *const ::sockaddr, + address_len: ::socklen_t) -> ::c_int; + + pub fn writev(fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int) -> ::ssize_t; + pub fn readv(fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int) -> ::ssize_t; + + pub fn sendmsg(fd: ::c_int, + msg: *const ::msghdr, + flags: ::c_int) -> ::ssize_t; + pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) + -> ::ssize_t; + pub fn uname(buf: *mut ::utsname) -> ::c_int; +} + +cfg_if! { + if #[cfg(target_os = "emscripten")] { + mod emscripten; + pub use self::emscripten::*; + } else if #[cfg(target_os = "linux")] { + mod linux; + pub use self::linux::*; + } else if #[cfg(target_os = "android")] { + mod android; + pub use self::android::*; + } else { + // Unknown target_os + } +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/mod.rs cargo-0.37.0/vendor/libc/src/unix/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -3,15 +3,6 @@ //! More functions and definitions can be found in the more specific modules //! according to the platform in question. -pub type int8_t = i8; -pub type int16_t = i16; -pub type int32_t = i32; -pub type int64_t = i64; -pub type uint8_t = u8; -pub type uint16_t = u16; -pub type uint32_t = u32; -pub type uint64_t = u64; - pub type c_schar = i8; pub type c_uchar = u8; pub type c_short = i16; @@ -45,12 +36,7 @@ impl ::Clone for DIR { fn clone(&self) -> DIR { *self } } -#[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum locale_t {} -impl ::Copy for locale_t {} -impl ::Clone for locale_t { - fn clone(&self) -> locale_t { *self } -} +pub type locale_t = *mut :: c_void; s! { pub struct group { @@ -223,16 +209,20 @@ pub const DT_LNK: u8 = 10; pub const DT_SOCK: u8 = 12; -pub const FD_CLOEXEC: ::c_int = 0x1; +cfg_if! { + if #[cfg(not(target_os = "redox"))] { + pub const FD_CLOEXEC: ::c_int = 0x1; + } +} pub const USRQUOTA: ::c_int = 0; pub const GRPQUOTA: ::c_int = 1; pub const SIGIOT: ::c_int = 6; -pub const S_ISUID: ::c_int = 0x800; -pub const S_ISGID: ::c_int = 0x400; -pub const S_ISVTX: ::c_int = 0x200; +pub const S_ISUID: ::mode_t = 0x800; +pub const S_ISGID: ::mode_t = 0x400; +pub const S_ISVTX: ::mode_t = 0x200; pub const IF_NAMESIZE: ::size_t = 16; pub const IFNAMSIZ: ::size_t = IF_NAMESIZE; @@ -303,7 +293,7 @@ cfg_if! { if #[cfg(target_os = "l4re")] { // required libraries for L4Re are linked externally, ATM - } else if #[cfg(feature = "use_std")] { + } else if #[cfg(feature = "std")] { // cargo build, don't pull in anything extra as the libstd dep // already pulls in all libs. } else if #[cfg(target_env = "musl")] { @@ -327,8 +317,7 @@ } else if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "android", - target_os = "openbsd", - target_os = "bitrig"))] { + target_os = "openbsd"))] { #[link(name = "c")] #[link(name = "m")] extern {} @@ -349,6 +338,13 @@ #[link(name = "c")] #[link(name = "m")] extern {} + } else if #[cfg(target_os = "redox")] { + #[cfg_attr(feature = "rustc-dep-of-std", + link(name = "c", kind = "static-nobundle", + cfg(target_feature = "crt-static")))] + #[cfg_attr(feature = "rustc-dep-of-std", + link(name = "c", cfg(not(target_feature = "crt-static"))))] + extern {} } else { #[link(name = "c")] #[link(name = "m")] @@ -512,8 +508,11 @@ pub fn snprintf(s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ...) -> ::c_int; pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int; + #[cfg_attr(target_os = "linux", link_name = "__isoc99_fscanf")] pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int; + #[cfg_attr(target_os = "linux", link_name = "__isoc99_scanf")] pub fn scanf(format: *const ::c_char, ...) -> ::c_int; + #[cfg_attr(target_os = "linux", link_name = "__isoc99_sscanf")] pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int; pub fn getchar_unlocked() -> ::c_int; pub fn putchar_unlocked(c: ::c_int) -> ::c_int; @@ -567,14 +566,20 @@ #[cfg_attr(target_os = "macos", link_name = "fstat$INODE64")] #[cfg_attr(target_os = "netbsd", link_name = "__fstat50")] - #[cfg_attr(target_os = "freebsd", link_name = "fstat@FBSD_1.0")] + #[cfg_attr( + all(target_os = "freebsd", not(freebsd12)), + link_name = "fstat@FBSD_1.0" + )] pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int; pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int; #[cfg_attr(target_os = "macos", link_name = "stat$INODE64")] #[cfg_attr(target_os = "netbsd", link_name = "__stat50")] - #[cfg_attr(target_os = "freebsd", link_name = "stat@FBSD_1.0")] + #[cfg_attr( + all(target_os = "freebsd", not(freebsd12)), + link_name = "stat@FBSD_1.0" + )] pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int; pub fn pclose(stream: *mut ::FILE) -> ::c_int; @@ -608,11 +613,17 @@ #[cfg_attr(target_os = "macos", link_name = "readdir$INODE64")] #[cfg_attr(target_os = "netbsd", link_name = "__readdir30")] - #[cfg_attr(target_os = "freebsd", link_name = "readdir@FBSD_1.0")] + #[cfg_attr( + all(target_os = "freebsd", not(freebsd12)), + link_name = "readdir@FBSD_1.0" + )] pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent; #[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")] #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")] - #[cfg_attr(target_os = "freebsd", link_name = "readdir_r@FBSD_1.0")] + #[cfg_attr( + all(target_os = "freebsd", not(freebsd12)), + link_name = "readdir_r@FBSD_1.0" + )] /// The 64-bit libc on Solaris and illumos only has readdir_r. If a /// 32-bit Solaris or illumos target is ever created, it should use /// __posix_readdir_r. See libc(3LIB) on Solaris or illumos: @@ -641,7 +652,10 @@ owner: ::uid_t, group: ::gid_t, flags: ::c_int) -> ::c_int; #[cfg_attr(target_os = "macos", link_name = "fstatat$INODE64")] - #[cfg_attr(target_os = "freebsd", link_name = "fstatat@FBSD_1.1")] + #[cfg_attr( + all(target_os = "freebsd", not(freebsd12)), + link_name = "fstatat@FBSD_1.1" + )] pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char, buf: *mut stat, flags: ::c_int) -> ::c_int; pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char, @@ -740,6 +754,10 @@ pub fn tcgetpgrp(fd: ::c_int) -> pid_t; pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int; pub fn ttyname(fd: ::c_int) -> *mut c_char; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "ttyname_r$UNIX2003")] + pub fn ttyname_r(fd: ::c_int, + buf: *mut c_char, buflen: ::size_t) -> ::c_int; pub fn unlink(c: *const c_char) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "wait$UNIX2003")] @@ -796,7 +814,10 @@ #[cfg_attr(target_os = "macos", link_name = "lstat$INODE64")] #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")] - #[cfg_attr(target_os = "freebsd", link_name = "lstat@FBSD_1.0")] + #[cfg_attr( + all(target_os = "freebsd", not(freebsd12)), + link_name = "lstat@FBSD_1.0" + )] pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), @@ -820,12 +841,6 @@ pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "getrlimit$UNIX2003")] - pub fn getrlimit(resource: ::c_int, rlim: *mut rlimit) -> ::c_int; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "setrlimit$UNIX2003")] - pub fn setrlimit(resource: ::c_int, rlim: *const rlimit) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")] pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int; @@ -836,9 +851,6 @@ pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__gettimeofday50")] - pub fn gettimeofday(tp: *mut ::timeval, - tz: *mut ::c_void) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__times13")] pub fn times(buf: *mut ::tms) -> ::clock_t; @@ -921,10 +933,6 @@ pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int; pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int; - #[cfg_attr(all(target_os = "linux", not(target_env = "musl")), - link_name = "__xpg_strerror_r")] - pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, - buflen: ::size_t) -> ::c_int; #[cfg_attr(target_os = "illumos", link_name = "__xnet_getsockopt")] pub fn getsockopt(sockfd: ::c_int, @@ -983,7 +991,10 @@ pub fn difftime(time1: time_t, time0: time_t) -> ::c_double; #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")] - #[cfg_attr(target_os = "freebsd", link_name = "mknod@FBSD_1.0")] + #[cfg_attr( + all(target_os = "freebsd", not(freebsd12)), + link_name = "mknod@FBSD_1.0" + )] pub fn mknod(pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t) -> ::c_int; pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int; @@ -1140,15 +1151,14 @@ } else if #[cfg(any(target_os = "linux", target_os = "android", target_os = "emscripten"))] { - mod notbsd; - pub use self::notbsd::*; + mod linux_like; + pub use self::linux_like::*; } else if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", - target_os = "netbsd", - target_os = "bitrig"))] { + target_os = "netbsd"))] { mod bsd; pub use self::bsd::*; } else if #[cfg(any(target_os = "solaris", @@ -1161,6 +1171,9 @@ } else if #[cfg(target_os = "hermit")] { mod hermit; pub use self::hermit::*; + } else if #[cfg(target_os = "redox")] { + mod redox; + pub use self::redox::*; } else { // Unknown target_os } diff -Nru cargo-0.35.0/vendor/libc/src/unix/newlib/mod.rs cargo-0.37.0/vendor/libc/src/unix/newlib/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/newlib/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/newlib/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -406,7 +406,9 @@ pub const SEEK_CUR: ::c_int = 1; pub const SEEK_END: ::c_int = 2; -pub const FIONBIO: ::c_int = 1; +pub const FIONBIO: ::c_ulong = 1; +pub const FIOCLEX: ::c_ulong = 0x20006601; +pub const FIONCLEX: ::c_ulong = 0x20006602; pub const S_BLKSIZE: ::mode_t = 1024; pub const S_IREAD: ::mode_t = 256; @@ -457,15 +459,41 @@ pub const SHUT_WR: ::c_int = 1; pub const SHUT_RDWR: ::c_int = 2; -pub const SO_REUSEADDR: ::c_int = 4; -pub const SO_LINGER: ::c_int = 128; -pub const SO_OOBINLINE: ::c_int = 256; -pub const SO_SNDBUF: ::c_int = 4097; -pub const SO_RCVBUF: ::c_int = 4098; -pub const SO_SNDLOWAT: ::c_int = 4099; -pub const SO_RCVLOWAT: ::c_int = 4100; -pub const SO_TYPE: ::c_int = 4104; -pub const SO_ERROR: ::c_int = 4105; +pub const SO_BINTIME: ::c_int = 0x2000; +pub const SO_NO_OFFLOAD: ::c_int = 0x4000; +pub const SO_NO_DDP: ::c_int = 0x8000; +pub const SO_REUSEPORT_LB: ::c_int = 0x10000; +pub const SO_LABEL: ::c_int = 0x1009; +pub const SO_PEERLABEL: ::c_int = 0x1010; +pub const SO_LISTENQLIMIT: ::c_int = 0x1011; +pub const SO_LISTENQLEN: ::c_int = 0x1012; +pub const SO_LISTENINCQLEN: ::c_int = 0x1013; +pub const SO_SETFIB: ::c_int = 0x1014; +pub const SO_USER_COOKIE: ::c_int = 0x1015; +pub const SO_PROTOCOL: ::c_int = 0x1016; +pub const SO_PROTOTYPE: ::c_int = SO_PROTOCOL; +pub const SO_VENDOR: ::c_int = 0x80000000; +pub const SO_DEBUG: ::c_int = 0x01; +pub const SO_ACCEPTCONN: ::c_int = 0x0002; +pub const SO_REUSEADDR: ::c_int = 0x0004; +pub const SO_KEEPALIVE: ::c_int = 0x0008; +pub const SO_DONTROUTE: ::c_int = 0x0010; +pub const SO_BROADCAST: ::c_int = 0x0020; +pub const SO_USELOOPBACK: ::c_int = 0x0040; +pub const SO_LINGER: ::c_int = 0x0080; +pub const SO_OOBINLINE: ::c_int = 0x0100; +pub const SO_REUSEPORT: ::c_int = 0x0200; +pub const SO_TIMESTAMP: ::c_int = 0x0400; +pub const SO_NOSIGPIPE: ::c_int = 0x0800; +pub const SO_ACCEPTFILTER: ::c_int = 0x1000; +pub const SO_SNDBUF: ::c_int = 0x1001; +pub const SO_RCVBUF: ::c_int = 0x1002; +pub const SO_SNDLOWAT: ::c_int = 0x1003; +pub const SO_RCVLOWAT: ::c_int = 0x1004; +pub const SO_SNDTIMEO: ::c_int = 0x1005; +pub const SO_RCVTIMEO: ::c_int = 0x1006; +pub const SO_ERROR: ::c_int = 0x1007; +pub const SO_TYPE: ::c_int = 0x1008; pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC; @@ -493,14 +521,30 @@ pub const TCP_NODELAY: ::c_int = 8193; pub const TCP_MAXSEG: ::c_int = 8194; +pub const TCP_NOPUSH: ::c_int = 4; +pub const TCP_NOOPT: ::c_int = 8; +pub const TCP_KEEPIDLE: ::c_int = 256; +pub const TCP_KEEPINTVL: ::c_int = 512; +pub const TCP_KEEPCNT: ::c_int = 1024; -pub const IP_TOS: ::c_int = 7; +pub const IP_TOS: ::c_int = 3; pub const IP_TTL: ::c_int = 8; -pub const IP_MULTICAST_LOOP: ::c_int = 9; +pub const IP_MULTICAST_IF: ::c_int = 9; pub const IP_MULTICAST_TTL: ::c_int = 10; +pub const IP_MULTICAST_LOOP: ::c_int = 11; pub const IP_ADD_MEMBERSHIP: ::c_int = 11; pub const IP_DROP_MEMBERSHIP: ::c_int = 12; +pub const IPV6_UNICAST_HOPS: ::c_int = 4; +pub const IPV6_MULTICAST_IF: ::c_int = 9; +pub const IPV6_MULTICAST_HOPS: ::c_int = 10; +pub const IPV6_MULTICAST_LOOP: ::c_int = 11; +pub const IPV6_V6ONLY: ::c_int = 27; +pub const IPV6_JOIN_GROUP: ::c_int = 12; +pub const IPV6_LEAVE_GROUP: ::c_int = 13; +pub const IPV6_ADD_MEMBERSHIP: ::c_int = 12; +pub const IPV6_DROP_MEMBERSHIP: ::c_int = 13; + pub const HOST_NOT_FOUND: ::c_int = 1; pub const NO_DATA: ::c_int = 2; pub const NO_ADDRESS: ::c_int = 2; @@ -555,6 +599,14 @@ } extern { + pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; + pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; + + #[cfg_attr(target_os = "linux", + link_name = "__xpg_strerror_r")] + pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, + buflen: ::size_t) -> ::c_int; + pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, @@ -580,6 +632,8 @@ pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char, envp: *const *const ::c_char) -> ::c_int; + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::c_void) -> ::c_int; #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")] pub fn getgrgid_r(gid: ::gid_t, grp: *mut ::group, diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/android/b32/arm.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/android/b32/arm.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/android/b32/arm.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/android/b32/arm.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,357 +0,0 @@ -pub type c_char = u8; -pub type wchar_t = u32; - -pub const O_DIRECT: ::c_int = 0x10000; -pub const O_DIRECTORY: ::c_int = 0x4000; -pub const O_NOFOLLOW: ::c_int = 0x8000; -pub const O_LARGEFILE: ::c_int = 0o400000; - -pub const SYS_restart_syscall: ::c_long = 0; -pub const SYS_exit: ::c_long = 1; -pub const SYS_fork: ::c_long = 2; -pub const SYS_read: ::c_long = 3; -pub const SYS_write: ::c_long = 4; -pub const SYS_open: ::c_long = 5; -pub const SYS_close: ::c_long = 6; -pub const SYS_creat: ::c_long = 8; -pub const SYS_link: ::c_long = 9; -pub const SYS_unlink: ::c_long = 10; -pub const SYS_execve: ::c_long = 11; -pub const SYS_chdir: ::c_long = 12; -pub const SYS_mknod: ::c_long = 14; -pub const SYS_chmod: ::c_long = 15; -pub const SYS_lchown: ::c_long = 16; -pub const SYS_lseek: ::c_long = 19; -pub const SYS_getpid: ::c_long = 20; -pub const SYS_mount: ::c_long = 21; -pub const SYS_setuid: ::c_long = 23; -pub const SYS_getuid: ::c_long = 24; -pub const SYS_ptrace: ::c_long = 26; -pub const SYS_pause: ::c_long = 29; -pub const SYS_access: ::c_long = 33; -pub const SYS_nice: ::c_long = 34; -pub const SYS_sync: ::c_long = 36; -pub const SYS_kill: ::c_long = 37; -pub const SYS_rename: ::c_long = 38; -pub const SYS_mkdir: ::c_long = 39; -pub const SYS_rmdir: ::c_long = 40; -pub const SYS_dup: ::c_long = 41; -pub const SYS_pipe: ::c_long = 42; -pub const SYS_times: ::c_long = 43; -pub const SYS_brk: ::c_long = 45; -pub const SYS_setgid: ::c_long = 46; -pub const SYS_getgid: ::c_long = 47; -pub const SYS_geteuid: ::c_long = 49; -pub const SYS_getegid: ::c_long = 50; -pub const SYS_acct: ::c_long = 51; -pub const SYS_umount2: ::c_long = 52; -pub const SYS_ioctl: ::c_long = 54; -pub const SYS_fcntl: ::c_long = 55; -pub const SYS_setpgid: ::c_long = 57; -pub const SYS_umask: ::c_long = 60; -pub const SYS_chroot: ::c_long = 61; -pub const SYS_ustat: ::c_long = 62; -pub const SYS_dup2: ::c_long = 63; -pub const SYS_getppid: ::c_long = 64; -pub const SYS_getpgrp: ::c_long = 65; -pub const SYS_setsid: ::c_long = 66; -pub const SYS_sigaction: ::c_long = 67; -pub const SYS_setreuid: ::c_long = 70; -pub const SYS_setregid: ::c_long = 71; -pub const SYS_sigsuspend: ::c_long = 72; -pub const SYS_sigpending: ::c_long = 73; -pub const SYS_sethostname: ::c_long = 74; -pub const SYS_setrlimit: ::c_long = 75; -pub const SYS_getrusage: ::c_long = 77; -pub const SYS_gettimeofday: ::c_long = 78; -pub const SYS_settimeofday: ::c_long = 79; -pub const SYS_getgroups: ::c_long = 80; -pub const SYS_setgroups: ::c_long = 81; -pub const SYS_symlink: ::c_long = 83; -pub const SYS_readlink: ::c_long = 85; -pub const SYS_uselib: ::c_long = 86; -pub const SYS_swapon: ::c_long = 87; -pub const SYS_reboot: ::c_long = 88; -pub const SYS_munmap: ::c_long = 91; -pub const SYS_truncate: ::c_long = 92; -pub const SYS_ftruncate: ::c_long = 93; -pub const SYS_fchmod: ::c_long = 94; -pub const SYS_fchown: ::c_long = 95; -pub const SYS_getpriority: ::c_long = 96; -pub const SYS_setpriority: ::c_long = 97; -pub const SYS_statfs: ::c_long = 99; -pub const SYS_fstatfs: ::c_long = 100; -pub const SYS_syslog: ::c_long = 103; -pub const SYS_setitimer: ::c_long = 104; -pub const SYS_getitimer: ::c_long = 105; -pub const SYS_stat: ::c_long = 106; -pub const SYS_lstat: ::c_long = 107; -pub const SYS_fstat: ::c_long = 108; -pub const SYS_vhangup: ::c_long = 111; -pub const SYS_wait4: ::c_long = 114; -pub const SYS_swapoff: ::c_long = 115; -pub const SYS_sysinfo: ::c_long = 116; -pub const SYS_fsync: ::c_long = 118; -pub const SYS_sigreturn: ::c_long = 119; -pub const SYS_clone: ::c_long = 120; -pub const SYS_setdomainname: ::c_long = 121; -pub const SYS_uname: ::c_long = 122; -pub const SYS_adjtimex: ::c_long = 124; -pub const SYS_mprotect: ::c_long = 125; -pub const SYS_sigprocmask: ::c_long = 126; -pub const SYS_init_module: ::c_long = 128; -pub const SYS_delete_module: ::c_long = 129; -pub const SYS_quotactl: ::c_long = 131; -pub const SYS_getpgid: ::c_long = 132; -pub const SYS_fchdir: ::c_long = 133; -pub const SYS_bdflush: ::c_long = 134; -pub const SYS_sysfs: ::c_long = 135; -pub const SYS_personality: ::c_long = 136; -pub const SYS_setfsuid: ::c_long = 138; -pub const SYS_setfsgid: ::c_long = 139; -pub const SYS_getdents: ::c_long = 141; -pub const SYS_flock: ::c_long = 143; -pub const SYS_msync: ::c_long = 144; -pub const SYS_readv: ::c_long = 145; -pub const SYS_writev: ::c_long = 146; -pub const SYS_getsid: ::c_long = 147; -pub const SYS_fdatasync: ::c_long = 148; -pub const SYS_mlock: ::c_long = 150; -pub const SYS_munlock: ::c_long = 151; -pub const SYS_mlockall: ::c_long = 152; -pub const SYS_munlockall: ::c_long = 153; -pub const SYS_sched_setparam: ::c_long = 154; -pub const SYS_sched_getparam: ::c_long = 155; -pub const SYS_sched_setscheduler: ::c_long = 156; -pub const SYS_sched_getscheduler: ::c_long = 157; -pub const SYS_sched_yield: ::c_long = 158; -pub const SYS_sched_get_priority_max: ::c_long = 159; -pub const SYS_sched_get_priority_min: ::c_long = 160; -pub const SYS_sched_rr_get_interval: ::c_long = 161; -pub const SYS_nanosleep: ::c_long = 162; -pub const SYS_mremap: ::c_long = 163; -pub const SYS_setresuid: ::c_long = 164; -pub const SYS_getresuid: ::c_long = 165; -pub const SYS_poll: ::c_long = 168; -pub const SYS_nfsservctl: ::c_long = 169; -pub const SYS_setresgid: ::c_long = 170; -pub const SYS_getresgid: ::c_long = 171; -pub const SYS_prctl: ::c_long = 172; -pub const SYS_rt_sigreturn: ::c_long = 173; -pub const SYS_rt_sigaction: ::c_long = 174; -pub const SYS_rt_sigprocmask: ::c_long = 175; -pub const SYS_rt_sigpending: ::c_long = 176; -pub const SYS_rt_sigtimedwait: ::c_long = 177; -pub const SYS_rt_sigqueueinfo: ::c_long = 178; -pub const SYS_rt_sigsuspend: ::c_long = 179; -pub const SYS_pread64: ::c_long = 180; -pub const SYS_pwrite64: ::c_long = 181; -pub const SYS_chown: ::c_long = 182; -pub const SYS_getcwd: ::c_long = 183; -pub const SYS_capget: ::c_long = 184; -pub const SYS_capset: ::c_long = 185; -pub const SYS_sigaltstack: ::c_long = 186; -pub const SYS_sendfile: ::c_long = 187; -pub const SYS_vfork: ::c_long = 190; -pub const SYS_ugetrlimit: ::c_long = 191; -pub const SYS_mmap2: ::c_long = 192; -pub const SYS_truncate64: ::c_long = 193; -pub const SYS_ftruncate64: ::c_long = 194; -pub const SYS_stat64: ::c_long = 195; -pub const SYS_lstat64: ::c_long = 196; -pub const SYS_fstat64: ::c_long = 197; -pub const SYS_lchown32: ::c_long = 198; -pub const SYS_getuid32: ::c_long = 199; -pub const SYS_getgid32: ::c_long = 200; -pub const SYS_geteuid32: ::c_long = 201; -pub const SYS_getegid32: ::c_long = 202; -pub const SYS_setreuid32: ::c_long = 203; -pub const SYS_setregid32: ::c_long = 204; -pub const SYS_getgroups32: ::c_long = 205; -pub const SYS_setgroups32: ::c_long = 206; -pub const SYS_fchown32: ::c_long = 207; -pub const SYS_setresuid32: ::c_long = 208; -pub const SYS_getresuid32: ::c_long = 209; -pub const SYS_setresgid32: ::c_long = 210; -pub const SYS_getresgid32: ::c_long = 211; -pub const SYS_chown32: ::c_long = 212; -pub const SYS_setuid32: ::c_long = 213; -pub const SYS_setgid32: ::c_long = 214; -pub const SYS_setfsuid32: ::c_long = 215; -pub const SYS_setfsgid32: ::c_long = 216; -pub const SYS_getdents64: ::c_long = 217; -pub const SYS_pivot_root: ::c_long = 218; -pub const SYS_mincore: ::c_long = 219; -pub const SYS_madvise: ::c_long = 220; -pub const SYS_fcntl64: ::c_long = 221; -pub const SYS_gettid: ::c_long = 224; -pub const SYS_readahead: ::c_long = 225; -pub const SYS_setxattr: ::c_long = 226; -pub const SYS_lsetxattr: ::c_long = 227; -pub const SYS_fsetxattr: ::c_long = 228; -pub const SYS_getxattr: ::c_long = 229; -pub const SYS_lgetxattr: ::c_long = 230; -pub const SYS_fgetxattr: ::c_long = 231; -pub const SYS_listxattr: ::c_long = 232; -pub const SYS_llistxattr: ::c_long = 233; -pub const SYS_flistxattr: ::c_long = 234; -pub const SYS_removexattr: ::c_long = 235; -pub const SYS_lremovexattr: ::c_long = 236; -pub const SYS_fremovexattr: ::c_long = 237; -pub const SYS_tkill: ::c_long = 238; -pub const SYS_sendfile64: ::c_long = 239; -pub const SYS_futex: ::c_long = 240; -pub const SYS_sched_setaffinity: ::c_long = 241; -pub const SYS_sched_getaffinity: ::c_long = 242; -pub const SYS_io_setup: ::c_long = 243; -pub const SYS_io_destroy: ::c_long = 244; -pub const SYS_io_getevents: ::c_long = 245; -pub const SYS_io_submit: ::c_long = 246; -pub const SYS_io_cancel: ::c_long = 247; -pub const SYS_exit_group: ::c_long = 248; -pub const SYS_lookup_dcookie: ::c_long = 249; -pub const SYS_epoll_create: ::c_long = 250; -pub const SYS_epoll_ctl: ::c_long = 251; -pub const SYS_epoll_wait: ::c_long = 252; -pub const SYS_remap_file_pages: ::c_long = 253; -pub const SYS_set_tid_address: ::c_long = 256; -pub const SYS_timer_create: ::c_long = 257; -pub const SYS_timer_settime: ::c_long = 258; -pub const SYS_timer_gettime: ::c_long = 259; -pub const SYS_timer_getoverrun: ::c_long = 260; -pub const SYS_timer_delete: ::c_long = 261; -pub const SYS_clock_settime: ::c_long = 262; -pub const SYS_clock_gettime: ::c_long = 263; -pub const SYS_clock_getres: ::c_long = 264; -pub const SYS_clock_nanosleep: ::c_long = 265; -pub const SYS_statfs64: ::c_long = 266; -pub const SYS_fstatfs64: ::c_long = 267; -pub const SYS_tgkill: ::c_long = 268; -pub const SYS_utimes: ::c_long = 269; -pub const SYS_arm_fadvise64_64: ::c_long = 270; -pub const SYS_pciconfig_iobase: ::c_long = 271; -pub const SYS_pciconfig_read: ::c_long = 272; -pub const SYS_pciconfig_write: ::c_long = 273; -pub const SYS_mq_open: ::c_long = 274; -pub const SYS_mq_unlink: ::c_long = 275; -pub const SYS_mq_timedsend: ::c_long = 276; -pub const SYS_mq_timedreceive: ::c_long = 277; -pub const SYS_mq_notify: ::c_long = 278; -pub const SYS_mq_getsetattr: ::c_long = 279; -pub const SYS_waitid: ::c_long = 280; -pub const SYS_socket: ::c_long = 281; -pub const SYS_bind: ::c_long = 282; -pub const SYS_connect: ::c_long = 283; -pub const SYS_listen: ::c_long = 284; -pub const SYS_accept: ::c_long = 285; -pub const SYS_getsockname: ::c_long = 286; -pub const SYS_getpeername: ::c_long = 287; -pub const SYS_socketpair: ::c_long = 288; -pub const SYS_send: ::c_long = 289; -pub const SYS_sendto: ::c_long = 290; -pub const SYS_recv: ::c_long = 291; -pub const SYS_recvfrom: ::c_long = 292; -pub const SYS_shutdown: ::c_long = 293; -pub const SYS_setsockopt: ::c_long = 294; -pub const SYS_getsockopt: ::c_long = 295; -pub const SYS_sendmsg: ::c_long = 296; -pub const SYS_recvmsg: ::c_long = 297; -pub const SYS_semop: ::c_long = 298; -pub const SYS_semget: ::c_long = 299; -pub const SYS_semctl: ::c_long = 300; -pub const SYS_msgsnd: ::c_long = 301; -pub const SYS_msgrcv: ::c_long = 302; -pub const SYS_msgget: ::c_long = 303; -pub const SYS_msgctl: ::c_long = 304; -pub const SYS_shmat: ::c_long = 305; -pub const SYS_shmdt: ::c_long = 306; -pub const SYS_shmget: ::c_long = 307; -pub const SYS_shmctl: ::c_long = 308; -pub const SYS_add_key: ::c_long = 309; -pub const SYS_request_key: ::c_long = 310; -pub const SYS_keyctl: ::c_long = 311; -pub const SYS_semtimedop: ::c_long = 312; -pub const SYS_vserver: ::c_long = 313; -pub const SYS_ioprio_set: ::c_long = 314; -pub const SYS_ioprio_get: ::c_long = 315; -pub const SYS_inotify_init: ::c_long = 316; -pub const SYS_inotify_add_watch: ::c_long = 317; -pub const SYS_inotify_rm_watch: ::c_long = 318; -pub const SYS_mbind: ::c_long = 319; -pub const SYS_get_mempolicy: ::c_long = 320; -pub const SYS_set_mempolicy: ::c_long = 321; -pub const SYS_openat: ::c_long = 322; -pub const SYS_mkdirat: ::c_long = 323; -pub const SYS_mknodat: ::c_long = 324; -pub const SYS_fchownat: ::c_long = 325; -pub const SYS_futimesat: ::c_long = 326; -pub const SYS_fstatat64: ::c_long = 327; -pub const SYS_unlinkat: ::c_long = 328; -pub const SYS_renameat: ::c_long = 329; -pub const SYS_linkat: ::c_long = 330; -pub const SYS_symlinkat: ::c_long = 331; -pub const SYS_readlinkat: ::c_long = 332; -pub const SYS_fchmodat: ::c_long = 333; -pub const SYS_faccessat: ::c_long = 334; -pub const SYS_pselect6: ::c_long = 335; -pub const SYS_ppoll: ::c_long = 336; -pub const SYS_unshare: ::c_long = 337; -pub const SYS_set_robust_list: ::c_long = 338; -pub const SYS_get_robust_list: ::c_long = 339; -pub const SYS_splice: ::c_long = 340; -pub const SYS_arm_sync_file_range: ::c_long = 341; -pub const SYS_tee: ::c_long = 342; -pub const SYS_vmsplice: ::c_long = 343; -pub const SYS_move_pages: ::c_long = 344; -pub const SYS_getcpu: ::c_long = 345; -pub const SYS_epoll_pwait: ::c_long = 346; -pub const SYS_kexec_load: ::c_long = 347; -pub const SYS_utimensat: ::c_long = 348; -pub const SYS_signalfd: ::c_long = 349; -pub const SYS_timerfd_create: ::c_long = 350; -pub const SYS_eventfd: ::c_long = 351; -pub const SYS_fallocate: ::c_long = 352; -pub const SYS_timerfd_settime: ::c_long = 353; -pub const SYS_timerfd_gettime: ::c_long = 354; -pub const SYS_signalfd4: ::c_long = 355; -pub const SYS_eventfd2: ::c_long = 356; -pub const SYS_epoll_create1: ::c_long = 357; -pub const SYS_dup3: ::c_long = 358; -pub const SYS_pipe2: ::c_long = 359; -pub const SYS_inotify_init1: ::c_long = 360; -pub const SYS_preadv: ::c_long = 361; -pub const SYS_pwritev: ::c_long = 362; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 363; -pub const SYS_perf_event_open: ::c_long = 364; -pub const SYS_recvmmsg: ::c_long = 365; -pub const SYS_accept4: ::c_long = 366; -pub const SYS_fanotify_init: ::c_long = 367; -pub const SYS_fanotify_mark: ::c_long = 368; -pub const SYS_prlimit64: ::c_long = 369; -pub const SYS_name_to_handle_at: ::c_long = 370; -pub const SYS_open_by_handle_at: ::c_long = 371; -pub const SYS_clock_adjtime: ::c_long = 372; -pub const SYS_syncfs: ::c_long = 373; -pub const SYS_sendmmsg: ::c_long = 374; -pub const SYS_setns: ::c_long = 375; -pub const SYS_process_vm_readv: ::c_long = 376; -pub const SYS_process_vm_writev: ::c_long = 377; -pub const SYS_kcmp: ::c_long = 378; -pub const SYS_finit_module: ::c_long = 379; -pub const SYS_sched_setattr: ::c_long = 380; -pub const SYS_sched_getattr: ::c_long = 381; -pub const SYS_renameat2: ::c_long = 382; -pub const SYS_seccomp: ::c_long = 383; -pub const SYS_getrandom: ::c_long = 384; -pub const SYS_memfd_create: ::c_long = 385; -pub const SYS_bpf: ::c_long = 386; -pub const SYS_execveat: ::c_long = 387; -pub const SYS_userfaultfd: ::c_long = 388; -pub const SYS_membarrier: ::c_long = 389; -pub const SYS_mlock2: ::c_long = 390; -pub const SYS_copy_file_range: ::c_long = 391; -pub const SYS_preadv2: ::c_long = 392; -pub const SYS_pwritev2: ::c_long = 393; -pub const SYS_pkey_mprotect: ::c_long = 394; -pub const SYS_pkey_alloc: ::c_long = 395; -pub const SYS_pkey_free: ::c_long = 396; diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/android/b32/mod.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/android/b32/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/android/b32/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/android/b32/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,214 +0,0 @@ -// The following definitions are correct for arm and i686, -// but may be wrong for mips - -pub type c_long = i32; -pub type c_ulong = u32; -pub type mode_t = u16; -pub type off64_t = ::c_longlong; -pub type sigset_t = ::c_ulong; -pub type socklen_t = i32; -pub type time64_t = i64; - -s! { - pub struct sigaction { - pub sa_sigaction: ::sighandler_t, - pub sa_mask: ::sigset_t, - pub sa_flags: ::c_ulong, - pub sa_restorer: ::Option, - } - - pub struct rlimit64 { - pub rlim_cur: u64, - pub rlim_max: u64, - } - - pub struct stat { - pub st_dev: ::c_ulonglong, - __pad0: [::c_uchar; 4], - __st_ino: ::ino_t, - pub st_mode: ::c_uint, - pub st_nlink: ::c_uint, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::c_ulonglong, - __pad3: [::c_uchar; 4], - pub st_size: ::c_longlong, - pub st_blksize: ::blksize_t, - pub st_blocks: ::c_ulonglong, - pub st_atime: ::c_ulong, - pub st_atime_nsec: ::c_ulong, - pub st_mtime: ::c_ulong, - pub st_mtime_nsec: ::c_ulong, - pub st_ctime: ::c_ulong, - pub st_ctime_nsec: ::c_ulong, - pub st_ino: ::c_ulonglong, - } - - pub struct stat64 { - pub st_dev: ::c_ulonglong, - __pad0: [::c_uchar; 4], - __st_ino: ::ino_t, - pub st_mode: ::c_uint, - pub st_nlink: ::c_uint, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::c_ulonglong, - __pad3: [::c_uchar; 4], - pub st_size: ::c_longlong, - pub st_blksize: ::blksize_t, - pub st_blocks: ::c_ulonglong, - pub st_atime: ::c_ulong, - pub st_atime_nsec: ::c_ulong, - pub st_mtime: ::c_ulong, - pub st_mtime_nsec: ::c_ulong, - pub st_ctime: ::c_ulong, - pub st_ctime_nsec: ::c_ulong, - pub st_ino: ::c_ulonglong, - } - - pub struct statfs64 { - pub f_type: u32, - pub f_bsize: u32, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - f_fsid: [u32; 2], - pub f_namelen: u32, - pub f_frsize: u32, - pub f_flags: u32, - pub f_spare: [u32; 4], - } - - pub struct statvfs64 { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: ::c_ulong, - pub f_bfree: ::c_ulong, - pub f_bavail: ::c_ulong, - pub f_files: ::c_ulong, - pub f_ffree: ::c_ulong, - pub f_favail: ::c_ulong, - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - } - - pub struct pthread_attr_t { - pub flags: ::uint32_t, - pub stack_base: *mut ::c_void, - pub stack_size: ::size_t, - pub guard_size: ::size_t, - pub sched_policy: ::int32_t, - pub sched_priority: ::int32_t, - } - - pub struct pthread_mutex_t { value: ::c_int } - - pub struct pthread_cond_t { value: ::c_int } - - pub struct pthread_rwlock_t { - lock: pthread_mutex_t, - cond: pthread_cond_t, - numLocks: ::c_int, - writerThreadId: ::c_int, - pendingReaders: ::c_int, - pendingWriters: ::c_int, - attr: i32, - __reserved: [::c_char; 12], - } - - pub struct passwd { - pub pw_name: *mut ::c_char, - pub pw_passwd: *mut ::c_char, - pub pw_uid: ::uid_t, - pub pw_gid: ::gid_t, - pub pw_dir: *mut ::c_char, - pub pw_shell: *mut ::c_char, - } - - pub struct statfs { - pub f_type: ::uint32_t, - pub f_bsize: ::uint32_t, - pub f_blocks: ::uint64_t, - pub f_bfree: ::uint64_t, - pub f_bavail: ::uint64_t, - pub f_files: ::uint64_t, - pub f_ffree: ::uint64_t, - pub f_fsid: ::__fsid_t, - pub f_namelen: ::uint32_t, - pub f_frsize: ::uint32_t, - pub f_flags: ::uint32_t, - pub f_spare: [::uint32_t; 4], - } - - pub struct sysinfo { - pub uptime: ::c_long, - pub loads: [::c_ulong; 3], - pub totalram: ::c_ulong, - pub freeram: ::c_ulong, - pub sharedram: ::c_ulong, - pub bufferram: ::c_ulong, - pub totalswap: ::c_ulong, - pub freeswap: ::c_ulong, - pub procs: ::c_ushort, - pub pad: ::c_ushort, - pub totalhigh: ::c_ulong, - pub freehigh: ::c_ulong, - pub mem_unit: ::c_uint, - pub _f: [::c_char; 8], - } -} - -pub const RTLD_GLOBAL: ::c_int = 2; -pub const RTLD_NOW: ::c_int = 0; -pub const RTLD_DEFAULT: *mut ::c_void = -1isize as *mut ::c_void; - -pub const PTRACE_GETFPREGS: ::c_int = 14; -pub const PTRACE_SETFPREGS: ::c_int = 15; -pub const PTRACE_GETREGS: ::c_int = 12; -pub const PTRACE_SETREGS: ::c_int = 13; - -pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { - value: 0, -}; -pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { - value: 0, -}; -pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { - lock: PTHREAD_MUTEX_INITIALIZER, - cond: PTHREAD_COND_INITIALIZER, - numLocks: 0, - writerThreadId: 0, - pendingReaders: 0, - pendingWriters: 0, - attr: 0, - __reserved: [0; 12], -}; -pub const PTHREAD_STACK_MIN: ::size_t = 4096 * 2; -pub const CPU_SETSIZE: ::size_t = 32; -pub const __CPU_BITS: ::size_t = 32; - -pub const UT_LINESIZE: usize = 8; -pub const UT_NAMESIZE: usize = 8; -pub const UT_HOSTSIZE: usize = 16; - -pub const SIGSTKSZ: ::size_t = 8192; -pub const MINSIGSTKSZ: ::size_t = 2048; - -extern { - pub fn timegm64(tm: *const ::tm) -> ::time64_t; -} - -cfg_if! { - if #[cfg(target_arch = "x86")] { - mod x86; - pub use self::x86::*; - } else if #[cfg(target_arch = "arm")] { - mod arm; - pub use self::arm::*; - } else { - // Unknown target_arch - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/android/b32/x86.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/android/b32/x86.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/android/b32/x86.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/android/b32/x86.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,415 +0,0 @@ -pub type c_char = i8; -pub type wchar_t = i32; - -pub const O_DIRECT: ::c_int = 0x4000; -pub const O_DIRECTORY: ::c_int = 0x10000; -pub const O_NOFOLLOW: ::c_int = 0x20000; -pub const O_LARGEFILE: ::c_int = 0o0100000; - -pub const MAP_32BIT: ::c_int = 0x40; - -// Syscall table -pub const SYS_restart_syscall: ::c_long = 0; -pub const SYS_exit: ::c_long = 1; -pub const SYS_fork: ::c_long = 2; -pub const SYS_read: ::c_long = 3; -pub const SYS_write: ::c_long = 4; -pub const SYS_open: ::c_long = 5; -pub const SYS_close: ::c_long = 6; -pub const SYS_waitpid: ::c_long = 7; -pub const SYS_creat: ::c_long = 8; -pub const SYS_link: ::c_long = 9; -pub const SYS_unlink: ::c_long = 10; -pub const SYS_execve: ::c_long = 11; -pub const SYS_chdir: ::c_long = 12; -pub const SYS_time: ::c_long = 13; -pub const SYS_mknod: ::c_long = 14; -pub const SYS_chmod: ::c_long = 15; -pub const SYS_lchown: ::c_long = 16; -pub const SYS_break: ::c_long = 17; -pub const SYS_oldstat: ::c_long = 18; -pub const SYS_lseek: ::c_long = 19; -pub const SYS_getpid: ::c_long = 20; -pub const SYS_mount: ::c_long = 21; -pub const SYS_umount: ::c_long = 22; -pub const SYS_setuid: ::c_long = 23; -pub const SYS_getuid: ::c_long = 24; -pub const SYS_stime: ::c_long = 25; -pub const SYS_ptrace: ::c_long = 26; -pub const SYS_alarm: ::c_long = 27; -pub const SYS_oldfstat: ::c_long = 28; -pub const SYS_pause: ::c_long = 29; -pub const SYS_utime: ::c_long = 30; -pub const SYS_stty: ::c_long = 31; -pub const SYS_gtty: ::c_long = 32; -pub const SYS_access: ::c_long = 33; -pub const SYS_nice: ::c_long = 34; -pub const SYS_ftime: ::c_long = 35; -pub const SYS_sync: ::c_long = 36; -pub const SYS_kill: ::c_long = 37; -pub const SYS_rename: ::c_long = 38; -pub const SYS_mkdir: ::c_long = 39; -pub const SYS_rmdir: ::c_long = 40; -pub const SYS_dup: ::c_long = 41; -pub const SYS_pipe: ::c_long = 42; -pub const SYS_times: ::c_long = 43; -pub const SYS_prof: ::c_long = 44; -pub const SYS_brk: ::c_long = 45; -pub const SYS_setgid: ::c_long = 46; -pub const SYS_getgid: ::c_long = 47; -pub const SYS_signal: ::c_long = 48; -pub const SYS_geteuid: ::c_long = 49; -pub const SYS_getegid: ::c_long = 50; -pub const SYS_acct: ::c_long = 51; -pub const SYS_umount2: ::c_long = 52; -pub const SYS_lock: ::c_long = 53; -pub const SYS_ioctl: ::c_long = 54; -pub const SYS_fcntl: ::c_long = 55; -pub const SYS_mpx: ::c_long = 56; -pub const SYS_setpgid: ::c_long = 57; -pub const SYS_ulimit: ::c_long = 58; -pub const SYS_oldolduname: ::c_long = 59; -pub const SYS_umask: ::c_long = 60; -pub const SYS_chroot: ::c_long = 61; -pub const SYS_ustat: ::c_long = 62; -pub const SYS_dup2: ::c_long = 63; -pub const SYS_getppid: ::c_long = 64; -pub const SYS_getpgrp: ::c_long = 65; -pub const SYS_setsid: ::c_long = 66; -pub const SYS_sigaction: ::c_long = 67; -pub const SYS_sgetmask: ::c_long = 68; -pub const SYS_ssetmask: ::c_long = 69; -pub const SYS_setreuid: ::c_long = 70; -pub const SYS_setregid: ::c_long = 71; -pub const SYS_sigsuspend: ::c_long = 72; -pub const SYS_sigpending: ::c_long = 73; -pub const SYS_sethostname: ::c_long = 74; -pub const SYS_setrlimit: ::c_long = 75; -pub const SYS_getrlimit: ::c_long = 76; -pub const SYS_getrusage: ::c_long = 77; -pub const SYS_gettimeofday: ::c_long = 78; -pub const SYS_settimeofday: ::c_long = 79; -pub const SYS_getgroups: ::c_long = 80; -pub const SYS_setgroups: ::c_long = 81; -pub const SYS_select: ::c_long = 82; -pub const SYS_symlink: ::c_long = 83; -pub const SYS_oldlstat: ::c_long = 84; -pub const SYS_readlink: ::c_long = 85; -pub const SYS_uselib: ::c_long = 86; -pub const SYS_swapon: ::c_long = 87; -pub const SYS_reboot: ::c_long = 88; -pub const SYS_readdir: ::c_long = 89; -pub const SYS_mmap: ::c_long = 90; -pub const SYS_munmap: ::c_long = 91; -pub const SYS_truncate: ::c_long = 92; -pub const SYS_ftruncate: ::c_long = 93; -pub const SYS_fchmod: ::c_long = 94; -pub const SYS_fchown: ::c_long = 95; -pub const SYS_getpriority: ::c_long = 96; -pub const SYS_setpriority: ::c_long = 97; -pub const SYS_profil: ::c_long = 98; -pub const SYS_statfs: ::c_long = 99; -pub const SYS_fstatfs: ::c_long = 100; -pub const SYS_ioperm: ::c_long = 101; -pub const SYS_socketcall: ::c_long = 102; -pub const SYS_syslog: ::c_long = 103; -pub const SYS_setitimer: ::c_long = 104; -pub const SYS_getitimer: ::c_long = 105; -pub const SYS_stat: ::c_long = 106; -pub const SYS_lstat: ::c_long = 107; -pub const SYS_fstat: ::c_long = 108; -pub const SYS_olduname: ::c_long = 109; -pub const SYS_iopl: ::c_long = 110; -pub const SYS_vhangup: ::c_long = 111; -pub const SYS_idle: ::c_long = 112; -pub const SYS_vm86old: ::c_long = 113; -pub const SYS_wait4: ::c_long = 114; -pub const SYS_swapoff: ::c_long = 115; -pub const SYS_sysinfo: ::c_long = 116; -pub const SYS_ipc: ::c_long = 117; -pub const SYS_fsync: ::c_long = 118; -pub const SYS_sigreturn: ::c_long = 119; -pub const SYS_clone: ::c_long = 120; -pub const SYS_setdomainname: ::c_long = 121; -pub const SYS_uname: ::c_long = 122; -pub const SYS_modify_ldt: ::c_long = 123; -pub const SYS_adjtimex: ::c_long = 124; -pub const SYS_mprotect: ::c_long = 125; -pub const SYS_sigprocmask: ::c_long = 126; -pub const SYS_create_module: ::c_long = 127; -pub const SYS_init_module: ::c_long = 128; -pub const SYS_delete_module: ::c_long = 129; -pub const SYS_get_kernel_syms: ::c_long = 130; -pub const SYS_quotactl: ::c_long = 131; -pub const SYS_getpgid: ::c_long = 132; -pub const SYS_fchdir: ::c_long = 133; -pub const SYS_bdflush: ::c_long = 134; -pub const SYS_sysfs: ::c_long = 135; -pub const SYS_personality: ::c_long = 136; -pub const SYS_afs_syscall: ::c_long = 137; -pub const SYS_setfsuid: ::c_long = 138; -pub const SYS_setfsgid: ::c_long = 139; -// FIXME: SYS__llseek is in the NDK sources but for some reason is -// not available in the tests -// pub const SYS__llseek: ::c_long = 140; -pub const SYS_getdents: ::c_long = 141; -// FIXME: SYS__newselect is in the NDK sources but for some reason is -// not available in the tests -// pub const SYS__newselect: ::c_long = 142; -pub const SYS_flock: ::c_long = 143; -pub const SYS_msync: ::c_long = 144; -pub const SYS_readv: ::c_long = 145; -pub const SYS_writev: ::c_long = 146; -pub const SYS_getsid: ::c_long = 147; -pub const SYS_fdatasync: ::c_long = 148; -// FIXME: SYS__llseek is in the NDK sources but for some reason is -// not available in the tests -// pub const SYS__sysctl: ::c_long = 149; -pub const SYS_mlock: ::c_long = 150; -pub const SYS_munlock: ::c_long = 151; -pub const SYS_mlockall: ::c_long = 152; -pub const SYS_munlockall: ::c_long = 153; -pub const SYS_sched_setparam: ::c_long = 154; -pub const SYS_sched_getparam: ::c_long = 155; -pub const SYS_sched_setscheduler: ::c_long = 156; -pub const SYS_sched_getscheduler: ::c_long = 157; -pub const SYS_sched_yield: ::c_long = 158; -pub const SYS_sched_get_priority_max: ::c_long = 159; -pub const SYS_sched_get_priority_min: ::c_long = 160; -pub const SYS_sched_rr_get_interval: ::c_long = 161; -pub const SYS_nanosleep: ::c_long = 162; -pub const SYS_mremap: ::c_long = 163; -pub const SYS_setresuid: ::c_long = 164; -pub const SYS_getresuid: ::c_long = 165; -pub const SYS_vm86: ::c_long = 166; -pub const SYS_query_module: ::c_long = 167; -pub const SYS_poll: ::c_long = 168; -pub const SYS_nfsservctl: ::c_long = 169; -pub const SYS_setresgid: ::c_long = 170; -pub const SYS_getresgid: ::c_long = 171; -pub const SYS_prctl: ::c_long = 172; -pub const SYS_rt_sigreturn: ::c_long = 173; -pub const SYS_rt_sigaction: ::c_long = 174; -pub const SYS_rt_sigprocmask: ::c_long = 175; -pub const SYS_rt_sigpending: ::c_long = 176; -pub const SYS_rt_sigtimedwait: ::c_long = 177; -pub const SYS_rt_sigqueueinfo: ::c_long = 178; -pub const SYS_rt_sigsuspend: ::c_long = 179; -pub const SYS_pread64: ::c_long = 180; -pub const SYS_pwrite64: ::c_long = 181; -pub const SYS_chown: ::c_long = 182; -pub const SYS_getcwd: ::c_long = 183; -pub const SYS_capget: ::c_long = 184; -pub const SYS_capset: ::c_long = 185; -pub const SYS_sigaltstack: ::c_long = 186; -pub const SYS_sendfile: ::c_long = 187; -pub const SYS_getpmsg: ::c_long = 188; -pub const SYS_putpmsg: ::c_long = 189; -pub const SYS_vfork: ::c_long = 190; -pub const SYS_ugetrlimit: ::c_long = 191; -pub const SYS_mmap2: ::c_long = 192; -pub const SYS_truncate64: ::c_long = 193; -pub const SYS_ftruncate64: ::c_long = 194; -pub const SYS_stat64: ::c_long = 195; -pub const SYS_lstat64: ::c_long = 196; -pub const SYS_fstat64: ::c_long = 197; -pub const SYS_lchown32: ::c_long = 198; -pub const SYS_getuid32: ::c_long = 199; -pub const SYS_getgid32: ::c_long = 200; -pub const SYS_geteuid32: ::c_long = 201; -pub const SYS_getegid32: ::c_long = 202; -pub const SYS_setreuid32: ::c_long = 203; -pub const SYS_setregid32: ::c_long = 204; -pub const SYS_getgroups32: ::c_long = 205; -pub const SYS_setgroups32: ::c_long = 206; -pub const SYS_fchown32: ::c_long = 207; -pub const SYS_setresuid32: ::c_long = 208; -pub const SYS_getresuid32: ::c_long = 209; -pub const SYS_setresgid32: ::c_long = 210; -pub const SYS_getresgid32: ::c_long = 211; -pub const SYS_chown32: ::c_long = 212; -pub const SYS_setuid32: ::c_long = 213; -pub const SYS_setgid32: ::c_long = 214; -pub const SYS_setfsuid32: ::c_long = 215; -pub const SYS_setfsgid32: ::c_long = 216; -pub const SYS_pivot_root: ::c_long = 217; -pub const SYS_mincore: ::c_long = 218; -pub const SYS_madvise: ::c_long = 219; -pub const SYS_getdents64: ::c_long = 220; -pub const SYS_fcntl64: ::c_long = 221; -pub const SYS_gettid: ::c_long = 224; -pub const SYS_readahead: ::c_long = 225; -pub const SYS_setxattr: ::c_long = 226; -pub const SYS_lsetxattr: ::c_long = 227; -pub const SYS_fsetxattr: ::c_long = 228; -pub const SYS_getxattr: ::c_long = 229; -pub const SYS_lgetxattr: ::c_long = 230; -pub const SYS_fgetxattr: ::c_long = 231; -pub const SYS_listxattr: ::c_long = 232; -pub const SYS_llistxattr: ::c_long = 233; -pub const SYS_flistxattr: ::c_long = 234; -pub const SYS_removexattr: ::c_long = 235; -pub const SYS_lremovexattr: ::c_long = 236; -pub const SYS_fremovexattr: ::c_long = 237; -pub const SYS_tkill: ::c_long = 238; -pub const SYS_sendfile64: ::c_long = 239; -pub const SYS_futex: ::c_long = 240; -pub const SYS_sched_setaffinity: ::c_long = 241; -pub const SYS_sched_getaffinity: ::c_long = 242; -pub const SYS_set_thread_area: ::c_long = 243; -pub const SYS_get_thread_area: ::c_long = 244; -pub const SYS_io_setup: ::c_long = 245; -pub const SYS_io_destroy: ::c_long = 246; -pub const SYS_io_getevents: ::c_long = 247; -pub const SYS_io_submit: ::c_long = 248; -pub const SYS_io_cancel: ::c_long = 249; -pub const SYS_fadvise64: ::c_long = 250; -pub const SYS_exit_group: ::c_long = 252; -pub const SYS_lookup_dcookie: ::c_long = 253; -pub const SYS_epoll_create: ::c_long = 254; -pub const SYS_epoll_ctl: ::c_long = 255; -pub const SYS_epoll_wait: ::c_long = 256; -pub const SYS_remap_file_pages: ::c_long = 257; -pub const SYS_set_tid_address: ::c_long = 258; -pub const SYS_timer_create: ::c_long = 259; -pub const SYS_timer_settime: ::c_long = 260; -pub const SYS_timer_gettime: ::c_long = 261; -pub const SYS_timer_getoverrun: ::c_long = 262; -pub const SYS_timer_delete: ::c_long = 263; -pub const SYS_clock_settime: ::c_long = 264; -pub const SYS_clock_gettime: ::c_long = 265; -pub const SYS_clock_getres: ::c_long = 266; -pub const SYS_clock_nanosleep: ::c_long = 267; -pub const SYS_statfs64: ::c_long = 268; -pub const SYS_fstatfs64: ::c_long = 269; -pub const SYS_tgkill: ::c_long = 270; -pub const SYS_utimes: ::c_long = 271; -pub const SYS_fadvise64_64: ::c_long = 272; -pub const SYS_vserver: ::c_long = 273; -pub const SYS_mbind: ::c_long = 274; -pub const SYS_get_mempolicy: ::c_long = 275; -pub const SYS_set_mempolicy: ::c_long = 276; -pub const SYS_mq_open: ::c_long = 277; -pub const SYS_mq_unlink: ::c_long = 278; -pub const SYS_mq_timedsend: ::c_long = 279; -pub const SYS_mq_timedreceive: ::c_long = 280; -pub const SYS_mq_notify: ::c_long = 281; -pub const SYS_mq_getsetattr: ::c_long = 282; -pub const SYS_kexec_load: ::c_long = 283; -pub const SYS_waitid: ::c_long = 284; -pub const SYS_add_key: ::c_long = 286; -pub const SYS_request_key: ::c_long = 287; -pub const SYS_keyctl: ::c_long = 288; -pub const SYS_ioprio_set: ::c_long = 289; -pub const SYS_ioprio_get: ::c_long = 290; -pub const SYS_inotify_init: ::c_long = 291; -pub const SYS_inotify_add_watch: ::c_long = 292; -pub const SYS_inotify_rm_watch: ::c_long = 293; -pub const SYS_migrate_pages: ::c_long = 294; -pub const SYS_openat: ::c_long = 295; -pub const SYS_mkdirat: ::c_long = 296; -pub const SYS_mknodat: ::c_long = 297; -pub const SYS_fchownat: ::c_long = 298; -pub const SYS_futimesat: ::c_long = 299; -pub const SYS_fstatat64: ::c_long = 300; -pub const SYS_unlinkat: ::c_long = 301; -pub const SYS_renameat: ::c_long = 302; -pub const SYS_linkat: ::c_long = 303; -pub const SYS_symlinkat: ::c_long = 304; -pub const SYS_readlinkat: ::c_long = 305; -pub const SYS_fchmodat: ::c_long = 306; -pub const SYS_faccessat: ::c_long = 307; -pub const SYS_pselect6: ::c_long = 308; -pub const SYS_ppoll: ::c_long = 309; -pub const SYS_unshare: ::c_long = 310; -pub const SYS_set_robust_list: ::c_long = 311; -pub const SYS_get_robust_list: ::c_long = 312; -pub const SYS_splice: ::c_long = 313; -pub const SYS_sync_file_range: ::c_long = 314; -pub const SYS_tee: ::c_long = 315; -pub const SYS_vmsplice: ::c_long = 316; -pub const SYS_move_pages: ::c_long = 317; -pub const SYS_getcpu: ::c_long = 318; -pub const SYS_epoll_pwait: ::c_long = 319; -pub const SYS_utimensat: ::c_long = 320; -pub const SYS_signalfd: ::c_long = 321; -pub const SYS_timerfd_create: ::c_long = 322; -pub const SYS_eventfd: ::c_long = 323; -pub const SYS_fallocate: ::c_long = 324; -pub const SYS_timerfd_settime: ::c_long = 325; -pub const SYS_timerfd_gettime: ::c_long = 326; -pub const SYS_signalfd4: ::c_long = 327; -pub const SYS_eventfd2: ::c_long = 328; -pub const SYS_epoll_create1: ::c_long = 329; -pub const SYS_dup3: ::c_long = 330; -pub const SYS_pipe2: ::c_long = 331; -pub const SYS_inotify_init1: ::c_long = 332; -pub const SYS_preadv: ::c_long = 333; -pub const SYS_pwritev: ::c_long = 334; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 335; -pub const SYS_perf_event_open: ::c_long = 336; -pub const SYS_recvmmsg: ::c_long = 337; -pub const SYS_fanotify_init: ::c_long = 338; -pub const SYS_fanotify_mark: ::c_long = 339; -pub const SYS_prlimit64: ::c_long = 340; -pub const SYS_name_to_handle_at: ::c_long = 341; -pub const SYS_open_by_handle_at: ::c_long = 342; -pub const SYS_clock_adjtime: ::c_long = 343; -pub const SYS_syncfs: ::c_long = 344; -pub const SYS_sendmmsg: ::c_long = 345; -pub const SYS_setns: ::c_long = 346; -pub const SYS_process_vm_readv: ::c_long = 347; -pub const SYS_process_vm_writev: ::c_long = 348; -pub const SYS_kcmp: ::c_long = 349; -pub const SYS_finit_module: ::c_long = 350; -pub const SYS_sched_setattr: ::c_long = 351; -pub const SYS_sched_getattr: ::c_long = 352; -pub const SYS_renameat2: ::c_long = 353; -pub const SYS_seccomp: ::c_long = 354; -pub const SYS_getrandom: ::c_long = 355; -pub const SYS_memfd_create: ::c_long = 356; -pub const SYS_bpf: ::c_long = 357; -pub const SYS_execveat: ::c_long = 358; -pub const SYS_socket: ::c_long = 359; -pub const SYS_socketpair: ::c_long = 360; -pub const SYS_bind: ::c_long = 361; -pub const SYS_connect: ::c_long = 362; -pub const SYS_listen: ::c_long = 363; -pub const SYS_accept4: ::c_long = 364; -pub const SYS_getsockopt: ::c_long = 365; -pub const SYS_setsockopt: ::c_long = 366; -pub const SYS_getsockname: ::c_long = 367; -pub const SYS_getpeername: ::c_long = 368; -pub const SYS_sendto: ::c_long = 369; -pub const SYS_sendmsg: ::c_long = 370; -pub const SYS_recvfrom: ::c_long = 371; -pub const SYS_recvmsg: ::c_long = 372; -pub const SYS_shutdown: ::c_long = 373; -pub const SYS_userfaultfd: ::c_long = 374; -pub const SYS_membarrier: ::c_long = 375; -pub const SYS_mlock2: ::c_long = 376; -pub const SYS_copy_file_range: ::c_long = 377; -pub const SYS_preadv2: ::c_long = 378; -pub const SYS_pwritev2: ::c_long = 379; -pub const SYS_pkey_mprotect: ::c_long = 380; -pub const SYS_pkey_alloc: ::c_long = 381; -pub const SYS_pkey_free: ::c_long = 382; - -// offsets in user_regs_structs, from sys/reg.h -pub const EBX: ::c_int = 0; -pub const ECX: ::c_int = 1; -pub const EDX: ::c_int = 2; -pub const ESI: ::c_int = 3; -pub const EDI: ::c_int = 4; -pub const EBP: ::c_int = 5; -pub const EAX: ::c_int = 6; -pub const DS: ::c_int = 7; -pub const ES: ::c_int = 8; -pub const FS: ::c_int = 9; -pub const GS: ::c_int = 10; -pub const ORIG_EAX: ::c_int = 11; -pub const EIP: ::c_int = 12; -pub const CS: ::c_int = 13; -pub const EFL: ::c_int = 14; -pub const UESP: ::c_int = 15; -pub const SS: ::c_int = 16; diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/android/b64/aarch64.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/android/b64/aarch64.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/android/b64/aarch64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/android/b64/aarch64.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,325 +0,0 @@ -pub type c_char = u8; -pub type wchar_t = u32; - -s! { - pub struct stat { - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_mode: ::c_uint, - pub st_nlink: ::c_uint, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __pad1: ::c_ulong, - pub st_size: ::off64_t, - pub st_blksize: ::c_int, - __pad2: ::c_int, - pub st_blocks: ::c_long, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_ulong, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_ulong, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_ulong, - __unused4: ::c_uint, - __unused5: ::c_uint, - } - - pub struct stat64 { - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_mode: ::c_uint, - pub st_nlink: ::c_uint, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __pad1: ::c_ulong, - pub st_size: ::off64_t, - pub st_blksize: ::c_int, - __pad2: ::c_int, - pub st_blocks: ::c_long, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_ulong, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_ulong, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_ulong, - __unused4: ::c_uint, - __unused5: ::c_uint, - } -} - -pub const O_DIRECT: ::c_int = 0x10000; -pub const O_DIRECTORY: ::c_int = 0x4000; -pub const O_NOFOLLOW: ::c_int = 0x8000; -pub const O_LARGEFILE: ::c_int = 0o400000; - -pub const SIGSTKSZ: ::size_t = 16384; -pub const MINSIGSTKSZ: ::size_t = 5120; - -pub const SYS_io_setup: ::c_long = 0; -pub const SYS_io_destroy: ::c_long = 1; -pub const SYS_io_submit: ::c_long = 2; -pub const SYS_io_cancel: ::c_long = 3; -pub const SYS_io_getevents: ::c_long = 4; -pub const SYS_setxattr: ::c_long = 5; -pub const SYS_lsetxattr: ::c_long = 6; -pub const SYS_fsetxattr: ::c_long = 7; -pub const SYS_getxattr: ::c_long = 8; -pub const SYS_lgetxattr: ::c_long = 9; -pub const SYS_fgetxattr: ::c_long = 10; -pub const SYS_listxattr: ::c_long = 11; -pub const SYS_llistxattr: ::c_long = 12; -pub const SYS_flistxattr: ::c_long = 13; -pub const SYS_removexattr: ::c_long = 14; -pub const SYS_lremovexattr: ::c_long = 15; -pub const SYS_fremovexattr: ::c_long = 16; -pub const SYS_getcwd: ::c_long = 17; -pub const SYS_lookup_dcookie: ::c_long = 18; -pub const SYS_eventfd2: ::c_long = 19; -pub const SYS_epoll_create1: ::c_long = 20; -pub const SYS_epoll_ctl: ::c_long = 21; -pub const SYS_epoll_pwait: ::c_long = 22; -pub const SYS_dup: ::c_long = 23; -pub const SYS_dup3: ::c_long = 24; -pub const SYS_inotify_init1: ::c_long = 26; -pub const SYS_inotify_add_watch: ::c_long = 27; -pub const SYS_inotify_rm_watch: ::c_long = 28; -pub const SYS_ioctl: ::c_long = 29; -pub const SYS_ioprio_set: ::c_long = 30; -pub const SYS_ioprio_get: ::c_long = 31; -pub const SYS_flock: ::c_long = 32; -pub const SYS_mknodat: ::c_long = 33; -pub const SYS_mkdirat: ::c_long = 34; -pub const SYS_unlinkat: ::c_long = 35; -pub const SYS_symlinkat: ::c_long = 36; -pub const SYS_linkat: ::c_long = 37; -pub const SYS_renameat: ::c_long = 38; -pub const SYS_umount2: ::c_long = 39; -pub const SYS_mount: ::c_long = 40; -pub const SYS_pivot_root: ::c_long = 41; -pub const SYS_nfsservctl: ::c_long = 42; -pub const SYS_fallocate: ::c_long = 47; -pub const SYS_faccessat: ::c_long = 48; -pub const SYS_chdir: ::c_long = 49; -pub const SYS_fchdir: ::c_long = 50; -pub const SYS_chroot: ::c_long = 51; -pub const SYS_fchmod: ::c_long = 52; -pub const SYS_fchmodat: ::c_long = 53; -pub const SYS_fchownat: ::c_long = 54; -pub const SYS_fchown: ::c_long = 55; -pub const SYS_openat: ::c_long = 56; -pub const SYS_close: ::c_long = 57; -pub const SYS_vhangup: ::c_long = 58; -pub const SYS_pipe2: ::c_long = 59; -pub const SYS_quotactl: ::c_long = 60; -pub const SYS_getdents64: ::c_long = 61; -pub const SYS_read: ::c_long = 63; -pub const SYS_write: ::c_long = 64; -pub const SYS_readv: ::c_long = 65; -pub const SYS_writev: ::c_long = 66; -pub const SYS_pread64: ::c_long = 67; -pub const SYS_pwrite64: ::c_long = 68; -pub const SYS_preadv: ::c_long = 69; -pub const SYS_pwritev: ::c_long = 70; -pub const SYS_pselect6: ::c_long = 72; -pub const SYS_ppoll: ::c_long = 73; -pub const SYS_signalfd4: ::c_long = 74; -pub const SYS_vmsplice: ::c_long = 75; -pub const SYS_splice: ::c_long = 76; -pub const SYS_tee: ::c_long = 77; -pub const SYS_readlinkat: ::c_long = 78; -pub const SYS_sync: ::c_long = 81; -pub const SYS_fsync: ::c_long = 82; -pub const SYS_fdatasync: ::c_long = 83; -pub const SYS_sync_file_range: ::c_long = 84; -pub const SYS_timerfd_create: ::c_long = 85; -pub const SYS_timerfd_settime: ::c_long = 86; -pub const SYS_timerfd_gettime: ::c_long = 87; -pub const SYS_utimensat: ::c_long = 88; -pub const SYS_acct: ::c_long = 89; -pub const SYS_capget: ::c_long = 90; -pub const SYS_capset: ::c_long = 91; -pub const SYS_personality: ::c_long = 92; -pub const SYS_exit: ::c_long = 93; -pub const SYS_exit_group: ::c_long = 94; -pub const SYS_waitid: ::c_long = 95; -pub const SYS_set_tid_address: ::c_long = 96; -pub const SYS_unshare: ::c_long = 97; -pub const SYS_futex: ::c_long = 98; -pub const SYS_set_robust_list: ::c_long = 99; -pub const SYS_get_robust_list: ::c_long = 100; -pub const SYS_nanosleep: ::c_long = 101; -pub const SYS_getitimer: ::c_long = 102; -pub const SYS_setitimer: ::c_long = 103; -pub const SYS_kexec_load: ::c_long = 104; -pub const SYS_init_module: ::c_long = 105; -pub const SYS_delete_module: ::c_long = 106; -pub const SYS_timer_create: ::c_long = 107; -pub const SYS_timer_gettime: ::c_long = 108; -pub const SYS_timer_getoverrun: ::c_long = 109; -pub const SYS_timer_settime: ::c_long = 110; -pub const SYS_timer_delete: ::c_long = 111; -pub const SYS_clock_settime: ::c_long = 112; -pub const SYS_clock_gettime: ::c_long = 113; -pub const SYS_clock_getres: ::c_long = 114; -pub const SYS_clock_nanosleep: ::c_long = 115; -pub const SYS_syslog: ::c_long = 116; -pub const SYS_ptrace: ::c_long = 117; -pub const SYS_sched_setparam: ::c_long = 118; -pub const SYS_sched_setscheduler: ::c_long = 119; -pub const SYS_sched_getscheduler: ::c_long = 120; -pub const SYS_sched_getparam: ::c_long = 121; -pub const SYS_sched_setaffinity: ::c_long = 122; -pub const SYS_sched_getaffinity: ::c_long = 123; -pub const SYS_sched_yield: ::c_long = 124; -pub const SYS_sched_get_priority_max: ::c_long = 125; -pub const SYS_sched_get_priority_min: ::c_long = 126; -pub const SYS_sched_rr_get_interval: ::c_long = 127; -pub const SYS_restart_syscall: ::c_long = 128; -pub const SYS_kill: ::c_long = 129; -pub const SYS_tkill: ::c_long = 130; -pub const SYS_tgkill: ::c_long = 131; -pub const SYS_sigaltstack: ::c_long = 132; -pub const SYS_rt_sigsuspend: ::c_long = 133; -pub const SYS_rt_sigaction: ::c_long = 134; -pub const SYS_rt_sigprocmask: ::c_long = 135; -pub const SYS_rt_sigpending: ::c_long = 136; -pub const SYS_rt_sigtimedwait: ::c_long = 137; -pub const SYS_rt_sigqueueinfo: ::c_long = 138; -pub const SYS_rt_sigreturn: ::c_long = 139; -pub const SYS_setpriority: ::c_long = 140; -pub const SYS_getpriority: ::c_long = 141; -pub const SYS_reboot: ::c_long = 142; -pub const SYS_setregid: ::c_long = 143; -pub const SYS_setgid: ::c_long = 144; -pub const SYS_setreuid: ::c_long = 145; -pub const SYS_setuid: ::c_long = 146; -pub const SYS_setresuid: ::c_long = 147; -pub const SYS_getresuid: ::c_long = 148; -pub const SYS_setresgid: ::c_long = 149; -pub const SYS_getresgid: ::c_long = 150; -pub const SYS_setfsuid: ::c_long = 151; -pub const SYS_setfsgid: ::c_long = 152; -pub const SYS_times: ::c_long = 153; -pub const SYS_setpgid: ::c_long = 154; -pub const SYS_getpgid: ::c_long = 155; -pub const SYS_getsid: ::c_long = 156; -pub const SYS_setsid: ::c_long = 157; -pub const SYS_getgroups: ::c_long = 158; -pub const SYS_setgroups: ::c_long = 159; -pub const SYS_uname: ::c_long = 160; -pub const SYS_sethostname: ::c_long = 161; -pub const SYS_setdomainname: ::c_long = 162; -pub const SYS_getrlimit: ::c_long = 163; -pub const SYS_setrlimit: ::c_long = 164; -pub const SYS_getrusage: ::c_long = 165; -pub const SYS_umask: ::c_long = 166; -pub const SYS_prctl: ::c_long = 167; -pub const SYS_getcpu: ::c_long = 168; -pub const SYS_gettimeofday: ::c_long = 169; -pub const SYS_settimeofday: ::c_long = 170; -pub const SYS_adjtimex: ::c_long = 171; -pub const SYS_getpid: ::c_long = 172; -pub const SYS_getppid: ::c_long = 173; -pub const SYS_getuid: ::c_long = 174; -pub const SYS_geteuid: ::c_long = 175; -pub const SYS_getgid: ::c_long = 176; -pub const SYS_getegid: ::c_long = 177; -pub const SYS_gettid: ::c_long = 178; -pub const SYS_sysinfo: ::c_long = 179; -pub const SYS_mq_open: ::c_long = 180; -pub const SYS_mq_unlink: ::c_long = 181; -pub const SYS_mq_timedsend: ::c_long = 182; -pub const SYS_mq_timedreceive: ::c_long = 183; -pub const SYS_mq_notify: ::c_long = 184; -pub const SYS_mq_getsetattr: ::c_long = 185; -pub const SYS_msgget: ::c_long = 186; -pub const SYS_msgctl: ::c_long = 187; -pub const SYS_msgrcv: ::c_long = 188; -pub const SYS_msgsnd: ::c_long = 189; -pub const SYS_semget: ::c_long = 190; -pub const SYS_semctl: ::c_long = 191; -pub const SYS_semtimedop: ::c_long = 192; -pub const SYS_semop: ::c_long = 193; -pub const SYS_shmget: ::c_long = 194; -pub const SYS_shmctl: ::c_long = 195; -pub const SYS_shmat: ::c_long = 196; -pub const SYS_shmdt: ::c_long = 197; -pub const SYS_socket: ::c_long = 198; -pub const SYS_socketpair: ::c_long = 199; -pub const SYS_bind: ::c_long = 200; -pub const SYS_listen: ::c_long = 201; -pub const SYS_accept: ::c_long = 202; -pub const SYS_connect: ::c_long = 203; -pub const SYS_getsockname: ::c_long = 204; -pub const SYS_getpeername: ::c_long = 205; -pub const SYS_sendto: ::c_long = 206; -pub const SYS_recvfrom: ::c_long = 207; -pub const SYS_setsockopt: ::c_long = 208; -pub const SYS_getsockopt: ::c_long = 209; -pub const SYS_shutdown: ::c_long = 210; -pub const SYS_sendmsg: ::c_long = 211; -pub const SYS_recvmsg: ::c_long = 212; -pub const SYS_readahead: ::c_long = 213; -pub const SYS_brk: ::c_long = 214; -pub const SYS_munmap: ::c_long = 215; -pub const SYS_mremap: ::c_long = 216; -pub const SYS_add_key: ::c_long = 217; -pub const SYS_request_key: ::c_long = 218; -pub const SYS_keyctl: ::c_long = 219; -pub const SYS_clone: ::c_long = 220; -pub const SYS_execve: ::c_long = 221; -pub const SYS_swapon: ::c_long = 224; -pub const SYS_swapoff: ::c_long = 225; -pub const SYS_mprotect: ::c_long = 226; -pub const SYS_msync: ::c_long = 227; -pub const SYS_mlock: ::c_long = 228; -pub const SYS_munlock: ::c_long = 229; -pub const SYS_mlockall: ::c_long = 230; -pub const SYS_munlockall: ::c_long = 231; -pub const SYS_mincore: ::c_long = 232; -pub const SYS_madvise: ::c_long = 233; -pub const SYS_remap_file_pages: ::c_long = 234; -pub const SYS_mbind: ::c_long = 235; -pub const SYS_get_mempolicy: ::c_long = 236; -pub const SYS_set_mempolicy: ::c_long = 237; -pub const SYS_migrate_pages: ::c_long = 238; -pub const SYS_move_pages: ::c_long = 239; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 240; -pub const SYS_perf_event_open: ::c_long = 241; -pub const SYS_accept4: ::c_long = 242; -pub const SYS_recvmmsg: ::c_long = 243; -pub const SYS_arch_specific_syscall: ::c_long = 244; -pub const SYS_wait4: ::c_long = 260; -pub const SYS_prlimit64: ::c_long = 261; -pub const SYS_fanotify_init: ::c_long = 262; -pub const SYS_fanotify_mark: ::c_long = 263; -pub const SYS_name_to_handle_at: ::c_long = 264; -pub const SYS_open_by_handle_at: ::c_long = 265; -pub const SYS_clock_adjtime: ::c_long = 266; -pub const SYS_syncfs: ::c_long = 267; -pub const SYS_setns: ::c_long = 268; -pub const SYS_sendmmsg: ::c_long = 269; -pub const SYS_process_vm_readv: ::c_long = 270; -pub const SYS_process_vm_writev: ::c_long = 271; -pub const SYS_kcmp: ::c_long = 272; -pub const SYS_finit_module: ::c_long = 273; -pub const SYS_sched_setattr: ::c_long = 274; -pub const SYS_sched_getattr: ::c_long = 275; -pub const SYS_renameat2: ::c_long = 276; -pub const SYS_seccomp: ::c_long = 277; -pub const SYS_getrandom: ::c_long = 278; -pub const SYS_memfd_create: ::c_long = 279; -pub const SYS_bpf: ::c_long = 280; -pub const SYS_execveat: ::c_long = 281; -pub const SYS_userfaultfd: ::c_long = 282; -pub const SYS_membarrier: ::c_long = 283; -pub const SYS_mlock2: ::c_long = 284; -pub const SYS_copy_file_range: ::c_long = 285; -pub const SYS_preadv2: ::c_long = 286; -pub const SYS_pwritev2: ::c_long = 287; -pub const SYS_pkey_mprotect: ::c_long = 288; -pub const SYS_pkey_alloc: ::c_long = 289; -pub const SYS_pkey_free: ::c_long = 290; -pub const SYS_syscalls: ::c_long = 291; diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/android/b64/mod.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/android/b64/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/android/b64/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/android/b64/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,272 +0,0 @@ -// The following definitions are correct for aarch64 and x86_64, -// but may be wrong for mips64 - -pub type c_long = i64; -pub type c_ulong = u64; -pub type mode_t = u32; -pub type off64_t = i64; -pub type socklen_t = u32; - -s! { - pub struct sigset_t { - __val: [::c_ulong; 1], - } - - pub struct sigaction { - pub sa_flags: ::c_uint, - pub sa_sigaction: ::sighandler_t, - pub sa_mask: ::sigset_t, - pub sa_restorer: ::Option, - } - - pub struct rlimit64 { - pub rlim_cur: ::c_ulonglong, - pub rlim_max: ::c_ulonglong, - } - - pub struct pthread_attr_t { - pub flags: ::uint32_t, - pub stack_base: *mut ::c_void, - pub stack_size: ::size_t, - pub guard_size: ::size_t, - pub sched_policy: ::int32_t, - pub sched_priority: ::int32_t, - __reserved: [::c_char; 16], - } - - pub struct passwd { - pub pw_name: *mut ::c_char, - pub pw_passwd: *mut ::c_char, - pub pw_uid: ::uid_t, - pub pw_gid: ::gid_t, - pub pw_gecos: *mut ::c_char, - pub pw_dir: *mut ::c_char, - pub pw_shell: *mut ::c_char, - } - - pub struct statfs { - pub f_type: ::uint64_t, - pub f_bsize: ::uint64_t, - pub f_blocks: ::uint64_t, - pub f_bfree: ::uint64_t, - pub f_bavail: ::uint64_t, - pub f_files: ::uint64_t, - pub f_ffree: ::uint64_t, - pub f_fsid: ::__fsid_t, - pub f_namelen: ::uint64_t, - pub f_frsize: ::uint64_t, - pub f_flags: ::uint64_t, - pub f_spare: [::uint64_t; 4], - } - - pub struct sysinfo { - pub uptime: ::c_long, - pub loads: [::c_ulong; 3], - pub totalram: ::c_ulong, - pub freeram: ::c_ulong, - pub sharedram: ::c_ulong, - pub bufferram: ::c_ulong, - pub totalswap: ::c_ulong, - pub freeswap: ::c_ulong, - pub procs: ::c_ushort, - pub pad: ::c_ushort, - pub totalhigh: ::c_ulong, - pub freehigh: ::c_ulong, - pub mem_unit: ::c_uint, - pub _f: [::c_char; 0], - } - - pub struct statfs64 { - pub f_type: u64, - pub f_bsize: u64, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - f_fsid: [u32; 2], - pub f_namelen: u64, - pub f_frsize: u64, - pub f_flags: u64, - pub f_spare: [u64; 4], - } - - pub struct statvfs64 { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_favail: u64, - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } -} - -s_no_extra_traits!{ - pub struct pthread_mutex_t { - value: ::c_int, - __reserved: [::c_char; 36], - } - - pub struct pthread_cond_t { - value: ::c_int, - __reserved: [::c_char; 44], - } - - pub struct pthread_rwlock_t { - numLocks: ::c_int, - writerThreadId: ::c_int, - pendingReaders: ::c_int, - pendingWriters: ::c_int, - attr: i32, - __reserved: [::c_char; 36], - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for pthread_mutex_t { - fn eq(&self, other: &pthread_mutex_t) -> bool { - self.value == other.value - && self - .__reserved - .iter() - .zip(other.__reserved.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for pthread_mutex_t {} - - impl ::fmt::Debug for pthread_mutex_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_mutex_t") - .field("value", &self.value) - // FIXME: .field("__reserved", &self.__reserved) - .finish() - } - } - - impl ::hash::Hash for pthread_mutex_t { - fn hash(&self, state: &mut H) { - self.value.hash(state); - self.__reserved.hash(state); - } - } - - impl PartialEq for pthread_cond_t { - fn eq(&self, other: &pthread_cond_t) -> bool { - self.value == other.value - && self - .__reserved - .iter() - .zip(other.__reserved.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for pthread_cond_t {} - - impl ::fmt::Debug for pthread_cond_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_cond_t") - .field("value", &self.value) - // FIXME: .field("__reserved", &self.__reserved) - .finish() - } - } - - impl ::hash::Hash for pthread_cond_t { - fn hash(&self, state: &mut H) { - self.value.hash(state); - self.__reserved.hash(state); - } - } - - impl PartialEq for pthread_rwlock_t { - fn eq(&self, other: &pthread_rwlock_t) -> bool { - self.numLocks == other.numLocks - && self.writerThreadId == other.writerThreadId - && self.pendingReaders == other.pendingReaders - && self.pendingWriters == other.pendingWriters - && self.attr == other.attr - && self - .__reserved - .iter() - .zip(other.__reserved.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for pthread_rwlock_t {} - - impl ::fmt::Debug for pthread_rwlock_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_rwlock_t") - .field("numLocks", &self.numLocks) - .field("writerThreadId", &self.writerThreadId) - .field("pendingReaders", &self.pendingReaders) - .field("pendingWriters", &self.pendingWriters) - .field("attr", &self.attr) - // FIXME: .field("__reserved", &self.__reserved) - .finish() - } - } - - impl ::hash::Hash for pthread_rwlock_t { - fn hash(&self, state: &mut H) { - self.numLocks.hash(state); - self.writerThreadId.hash(state); - self.pendingReaders.hash(state); - self.pendingWriters.hash(state); - self.attr.hash(state); - self.__reserved.hash(state); - } - } - } -} - -pub const RTLD_GLOBAL: ::c_int = 0x00100; -pub const RTLD_NOW: ::c_int = 2; -pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; - -pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { - value: 0, - __reserved: [0; 36], -}; -pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { - value: 0, - __reserved: [0; 44], -}; -pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { - numLocks: 0, - writerThreadId: 0, - pendingReaders: 0, - pendingWriters: 0, - attr: 0, - __reserved: [0; 36], -}; -pub const PTHREAD_STACK_MIN: ::size_t = 4096 * 4; -pub const CPU_SETSIZE: ::size_t = 1024; -pub const __CPU_BITS: ::size_t = 64; - -pub const UT_LINESIZE: usize = 32; -pub const UT_NAMESIZE: usize = 32; -pub const UT_HOSTSIZE: usize = 256; - -cfg_if! { - if #[cfg(target_arch = "x86_64")] { - mod x86_64; - pub use self::x86_64::*; - } else if #[cfg(target_arch = "aarch64")] { - mod aarch64; - pub use self::aarch64::*; - } else { - // Unknown target_arch - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/android/b64/x86_64.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/android/b64/x86_64.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/android/b64/x86_64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/android/b64/x86_64.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,420 +0,0 @@ -pub type c_char = i8; -pub type wchar_t = i32; - -s! { - pub struct stat { - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_nlink: ::c_ulong, - pub st_mode: ::c_uint, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - pub st_size: ::off64_t, - pub st_blksize: ::c_long, - pub st_blocks: ::c_long, - pub st_atime: ::c_ulong, - pub st_atime_nsec: ::c_ulong, - pub st_mtime: ::c_ulong, - pub st_mtime_nsec: ::c_ulong, - pub st_ctime: ::c_ulong, - pub st_ctime_nsec: ::c_ulong, - __unused: [::c_long; 3], - } - - pub struct stat64 { - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_nlink: ::c_ulong, - pub st_mode: ::c_uint, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - pub st_size: ::off64_t, - pub st_blksize: ::c_long, - pub st_blocks: ::c_long, - pub st_atime: ::c_ulong, - pub st_atime_nsec: ::c_ulong, - pub st_mtime: ::c_ulong, - pub st_mtime_nsec: ::c_ulong, - pub st_ctime: ::c_ulong, - pub st_ctime_nsec: ::c_ulong, - __unused: [::c_long; 3], - } -} - -pub const O_DIRECT: ::c_int = 0x4000; -pub const O_DIRECTORY: ::c_int = 0x10000; -pub const O_NOFOLLOW: ::c_int = 0x20000; -pub const O_LARGEFILE: ::c_int = 0o0100000; - -pub const SIGSTKSZ: ::size_t = 8192; -pub const MINSIGSTKSZ: ::size_t = 2048; - -pub const MAP_32BIT: ::c_int = 0x40; - -// Syscall table - -pub const SYS_read: ::c_long = 0; -pub const SYS_write: ::c_long = 1; -pub const SYS_open: ::c_long = 2; -pub const SYS_close: ::c_long = 3; -pub const SYS_stat: ::c_long = 4; -pub const SYS_fstat: ::c_long = 5; -pub const SYS_lstat: ::c_long = 6; -pub const SYS_poll: ::c_long = 7; -pub const SYS_lseek: ::c_long = 8; -pub const SYS_mmap: ::c_long = 9; -pub const SYS_mprotect: ::c_long = 10; -pub const SYS_munmap: ::c_long = 11; -pub const SYS_brk: ::c_long = 12; -pub const SYS_rt_sigaction: ::c_long = 13; -pub const SYS_rt_sigprocmask: ::c_long = 14; -pub const SYS_rt_sigreturn: ::c_long = 15; -pub const SYS_ioctl: ::c_long = 16; -pub const SYS_pread64: ::c_long = 17; -pub const SYS_pwrite64: ::c_long = 18; -pub const SYS_readv: ::c_long = 19; -pub const SYS_writev: ::c_long = 20; -pub const SYS_access: ::c_long = 21; -pub const SYS_pipe: ::c_long = 22; -pub const SYS_select: ::c_long = 23; -pub const SYS_sched_yield: ::c_long = 24; -pub const SYS_mremap: ::c_long = 25; -pub const SYS_msync: ::c_long = 26; -pub const SYS_mincore: ::c_long = 27; -pub const SYS_madvise: ::c_long = 28; -pub const SYS_shmget: ::c_long = 29; -pub const SYS_shmat: ::c_long = 30; -pub const SYS_shmctl: ::c_long = 31; -pub const SYS_dup: ::c_long = 32; -pub const SYS_dup2: ::c_long = 33; -pub const SYS_pause: ::c_long = 34; -pub const SYS_nanosleep: ::c_long = 35; -pub const SYS_getitimer: ::c_long = 36; -pub const SYS_alarm: ::c_long = 37; -pub const SYS_setitimer: ::c_long = 38; -pub const SYS_getpid: ::c_long = 39; -pub const SYS_sendfile: ::c_long = 40; -pub const SYS_socket: ::c_long = 41; -pub const SYS_connect: ::c_long = 42; -pub const SYS_accept: ::c_long = 43; -pub const SYS_sendto: ::c_long = 44; -pub const SYS_recvfrom: ::c_long = 45; -pub const SYS_sendmsg: ::c_long = 46; -pub const SYS_recvmsg: ::c_long = 47; -pub const SYS_shutdown: ::c_long = 48; -pub const SYS_bind: ::c_long = 49; -pub const SYS_listen: ::c_long = 50; -pub const SYS_getsockname: ::c_long = 51; -pub const SYS_getpeername: ::c_long = 52; -pub const SYS_socketpair: ::c_long = 53; -pub const SYS_setsockopt: ::c_long = 54; -pub const SYS_getsockopt: ::c_long = 55; -pub const SYS_clone: ::c_long = 56; -pub const SYS_fork: ::c_long = 57; -pub const SYS_vfork: ::c_long = 58; -pub const SYS_execve: ::c_long = 59; -pub const SYS_exit: ::c_long = 60; -pub const SYS_wait4: ::c_long = 61; -pub const SYS_kill: ::c_long = 62; -pub const SYS_uname: ::c_long = 63; -pub const SYS_semget: ::c_long = 64; -pub const SYS_semop: ::c_long = 65; -pub const SYS_semctl: ::c_long = 66; -pub const SYS_shmdt: ::c_long = 67; -pub const SYS_msgget: ::c_long = 68; -pub const SYS_msgsnd: ::c_long = 69; -pub const SYS_msgrcv: ::c_long = 70; -pub const SYS_msgctl: ::c_long = 71; -pub const SYS_fcntl: ::c_long = 72; -pub const SYS_flock: ::c_long = 73; -pub const SYS_fsync: ::c_long = 74; -pub const SYS_fdatasync: ::c_long = 75; -pub const SYS_truncate: ::c_long = 76; -pub const SYS_ftruncate: ::c_long = 77; -pub const SYS_getdents: ::c_long = 78; -pub const SYS_getcwd: ::c_long = 79; -pub const SYS_chdir: ::c_long = 80; -pub const SYS_fchdir: ::c_long = 81; -pub const SYS_rename: ::c_long = 82; -pub const SYS_mkdir: ::c_long = 83; -pub const SYS_rmdir: ::c_long = 84; -pub const SYS_creat: ::c_long = 85; -pub const SYS_link: ::c_long = 86; -pub const SYS_unlink: ::c_long = 87; -pub const SYS_symlink: ::c_long = 88; -pub const SYS_readlink: ::c_long = 89; -pub const SYS_chmod: ::c_long = 90; -pub const SYS_fchmod: ::c_long = 91; -pub const SYS_chown: ::c_long = 92; -pub const SYS_fchown: ::c_long = 93; -pub const SYS_lchown: ::c_long = 94; -pub const SYS_umask: ::c_long = 95; -pub const SYS_gettimeofday: ::c_long = 96; -pub const SYS_getrlimit: ::c_long = 97; -pub const SYS_getrusage: ::c_long = 98; -pub const SYS_sysinfo: ::c_long = 99; -pub const SYS_times: ::c_long = 100; -pub const SYS_ptrace: ::c_long = 101; -pub const SYS_getuid: ::c_long = 102; -pub const SYS_syslog: ::c_long = 103; -pub const SYS_getgid: ::c_long = 104; -pub const SYS_setuid: ::c_long = 105; -pub const SYS_setgid: ::c_long = 106; -pub const SYS_geteuid: ::c_long = 107; -pub const SYS_getegid: ::c_long = 108; -pub const SYS_setpgid: ::c_long = 109; -pub const SYS_getppid: ::c_long = 110; -pub const SYS_getpgrp: ::c_long = 111; -pub const SYS_setsid: ::c_long = 112; -pub const SYS_setreuid: ::c_long = 113; -pub const SYS_setregid: ::c_long = 114; -pub const SYS_getgroups: ::c_long = 115; -pub const SYS_setgroups: ::c_long = 116; -pub const SYS_setresuid: ::c_long = 117; -pub const SYS_getresuid: ::c_long = 118; -pub const SYS_setresgid: ::c_long = 119; -pub const SYS_getresgid: ::c_long = 120; -pub const SYS_getpgid: ::c_long = 121; -pub const SYS_setfsuid: ::c_long = 122; -pub const SYS_setfsgid: ::c_long = 123; -pub const SYS_getsid: ::c_long = 124; -pub const SYS_capget: ::c_long = 125; -pub const SYS_capset: ::c_long = 126; -pub const SYS_rt_sigpending: ::c_long = 127; -pub const SYS_rt_sigtimedwait: ::c_long = 128; -pub const SYS_rt_sigqueueinfo: ::c_long = 129; -pub const SYS_rt_sigsuspend: ::c_long = 130; -pub const SYS_sigaltstack: ::c_long = 131; -pub const SYS_utime: ::c_long = 132; -pub const SYS_mknod: ::c_long = 133; -pub const SYS_uselib: ::c_long = 134; -pub const SYS_personality: ::c_long = 135; -pub const SYS_ustat: ::c_long = 136; -pub const SYS_statfs: ::c_long = 137; -pub const SYS_fstatfs: ::c_long = 138; -pub const SYS_sysfs: ::c_long = 139; -pub const SYS_getpriority: ::c_long = 140; -pub const SYS_setpriority: ::c_long = 141; -pub const SYS_sched_setparam: ::c_long = 142; -pub const SYS_sched_getparam: ::c_long = 143; -pub const SYS_sched_setscheduler: ::c_long = 144; -pub const SYS_sched_getscheduler: ::c_long = 145; -pub const SYS_sched_get_priority_max: ::c_long = 146; -pub const SYS_sched_get_priority_min: ::c_long = 147; -pub const SYS_sched_rr_get_interval: ::c_long = 148; -pub const SYS_mlock: ::c_long = 149; -pub const SYS_munlock: ::c_long = 150; -pub const SYS_mlockall: ::c_long = 151; -pub const SYS_munlockall: ::c_long = 152; -pub const SYS_vhangup: ::c_long = 153; -pub const SYS_modify_ldt: ::c_long = 154; -pub const SYS_pivot_root: ::c_long = 155; -// FIXME: SYS__sysctl is in the NDK sources but for some reason is -// not available in the tests -// pub const SYS__sysctl: ::c_long = 156; -pub const SYS_prctl: ::c_long = 157; -pub const SYS_arch_prctl: ::c_long = 158; -pub const SYS_adjtimex: ::c_long = 159; -pub const SYS_setrlimit: ::c_long = 160; -pub const SYS_chroot: ::c_long = 161; -pub const SYS_sync: ::c_long = 162; -pub const SYS_acct: ::c_long = 163; -pub const SYS_settimeofday: ::c_long = 164; -pub const SYS_mount: ::c_long = 165; -pub const SYS_umount2: ::c_long = 166; -pub const SYS_swapon: ::c_long = 167; -pub const SYS_swapoff: ::c_long = 168; -pub const SYS_reboot: ::c_long = 169; -pub const SYS_sethostname: ::c_long = 170; -pub const SYS_setdomainname: ::c_long = 171; -pub const SYS_iopl: ::c_long = 172; -pub const SYS_ioperm: ::c_long = 173; -pub const SYS_create_module: ::c_long = 174; -pub const SYS_init_module: ::c_long = 175; -pub const SYS_delete_module: ::c_long = 176; -pub const SYS_get_kernel_syms: ::c_long = 177; -pub const SYS_query_module: ::c_long = 178; -pub const SYS_quotactl: ::c_long = 179; -pub const SYS_nfsservctl: ::c_long = 180; -pub const SYS_getpmsg: ::c_long = 181; -pub const SYS_putpmsg: ::c_long = 182; -pub const SYS_afs_syscall: ::c_long = 183; -pub const SYS_tuxcall: ::c_long = 184; -pub const SYS_security: ::c_long = 185; -pub const SYS_gettid: ::c_long = 186; -pub const SYS_readahead: ::c_long = 187; -pub const SYS_setxattr: ::c_long = 188; -pub const SYS_lsetxattr: ::c_long = 189; -pub const SYS_fsetxattr: ::c_long = 190; -pub const SYS_getxattr: ::c_long = 191; -pub const SYS_lgetxattr: ::c_long = 192; -pub const SYS_fgetxattr: ::c_long = 193; -pub const SYS_listxattr: ::c_long = 194; -pub const SYS_llistxattr: ::c_long = 195; -pub const SYS_flistxattr: ::c_long = 196; -pub const SYS_removexattr: ::c_long = 197; -pub const SYS_lremovexattr: ::c_long = 198; -pub const SYS_fremovexattr: ::c_long = 199; -pub const SYS_tkill: ::c_long = 200; -pub const SYS_time: ::c_long = 201; -pub const SYS_futex: ::c_long = 202; -pub const SYS_sched_setaffinity: ::c_long = 203; -pub const SYS_sched_getaffinity: ::c_long = 204; -pub const SYS_set_thread_area: ::c_long = 205; -pub const SYS_io_setup: ::c_long = 206; -pub const SYS_io_destroy: ::c_long = 207; -pub const SYS_io_getevents: ::c_long = 208; -pub const SYS_io_submit: ::c_long = 209; -pub const SYS_io_cancel: ::c_long = 210; -pub const SYS_get_thread_area: ::c_long = 211; -pub const SYS_lookup_dcookie: ::c_long = 212; -pub const SYS_epoll_create: ::c_long = 213; -pub const SYS_epoll_ctl_old: ::c_long = 214; -pub const SYS_epoll_wait_old: ::c_long = 215; -pub const SYS_remap_file_pages: ::c_long = 216; -pub const SYS_getdents64: ::c_long = 217; -pub const SYS_set_tid_address: ::c_long = 218; -pub const SYS_restart_syscall: ::c_long = 219; -pub const SYS_semtimedop: ::c_long = 220; -pub const SYS_fadvise64: ::c_long = 221; -pub const SYS_timer_create: ::c_long = 222; -pub const SYS_timer_settime: ::c_long = 223; -pub const SYS_timer_gettime: ::c_long = 224; -pub const SYS_timer_getoverrun: ::c_long = 225; -pub const SYS_timer_delete: ::c_long = 226; -pub const SYS_clock_settime: ::c_long = 227; -pub const SYS_clock_gettime: ::c_long = 228; -pub const SYS_clock_getres: ::c_long = 229; -pub const SYS_clock_nanosleep: ::c_long = 230; -pub const SYS_exit_group: ::c_long = 231; -pub const SYS_epoll_wait: ::c_long = 232; -pub const SYS_epoll_ctl: ::c_long = 233; -pub const SYS_tgkill: ::c_long = 234; -pub const SYS_utimes: ::c_long = 235; -pub const SYS_vserver: ::c_long = 236; -pub const SYS_mbind: ::c_long = 237; -pub const SYS_set_mempolicy: ::c_long = 238; -pub const SYS_get_mempolicy: ::c_long = 239; -pub const SYS_mq_open: ::c_long = 240; -pub const SYS_mq_unlink: ::c_long = 241; -pub const SYS_mq_timedsend: ::c_long = 242; -pub const SYS_mq_timedreceive: ::c_long = 243; -pub const SYS_mq_notify: ::c_long = 244; -pub const SYS_mq_getsetattr: ::c_long = 245; -pub const SYS_kexec_load: ::c_long = 246; -pub const SYS_waitid: ::c_long = 247; -pub const SYS_add_key: ::c_long = 248; -pub const SYS_request_key: ::c_long = 249; -pub const SYS_keyctl: ::c_long = 250; -pub const SYS_ioprio_set: ::c_long = 251; -pub const SYS_ioprio_get: ::c_long = 252; -pub const SYS_inotify_init: ::c_long = 253; -pub const SYS_inotify_add_watch: ::c_long = 254; -pub const SYS_inotify_rm_watch: ::c_long = 255; -pub const SYS_migrate_pages: ::c_long = 256; -pub const SYS_openat: ::c_long = 257; -pub const SYS_mkdirat: ::c_long = 258; -pub const SYS_mknodat: ::c_long = 259; -pub const SYS_fchownat: ::c_long = 260; -pub const SYS_futimesat: ::c_long = 261; -pub const SYS_newfstatat: ::c_long = 262; -pub const SYS_unlinkat: ::c_long = 263; -pub const SYS_renameat: ::c_long = 264; -pub const SYS_linkat: ::c_long = 265; -pub const SYS_symlinkat: ::c_long = 266; -pub const SYS_readlinkat: ::c_long = 267; -pub const SYS_fchmodat: ::c_long = 268; -pub const SYS_faccessat: ::c_long = 269; -pub const SYS_pselect6: ::c_long = 270; -pub const SYS_ppoll: ::c_long = 271; -pub const SYS_unshare: ::c_long = 272; -pub const SYS_set_robust_list: ::c_long = 273; -pub const SYS_get_robust_list: ::c_long = 274; -pub const SYS_splice: ::c_long = 275; -pub const SYS_tee: ::c_long = 276; -pub const SYS_sync_file_range: ::c_long = 277; -pub const SYS_vmsplice: ::c_long = 278; -pub const SYS_move_pages: ::c_long = 279; -pub const SYS_utimensat: ::c_long = 280; -pub const SYS_epoll_pwait: ::c_long = 281; -pub const SYS_signalfd: ::c_long = 282; -pub const SYS_timerfd_create: ::c_long = 283; -pub const SYS_eventfd: ::c_long = 284; -pub const SYS_fallocate: ::c_long = 285; -pub const SYS_timerfd_settime: ::c_long = 286; -pub const SYS_timerfd_gettime: ::c_long = 287; -pub const SYS_accept4: ::c_long = 288; -pub const SYS_signalfd4: ::c_long = 289; -pub const SYS_eventfd2: ::c_long = 290; -pub const SYS_epoll_create1: ::c_long = 291; -pub const SYS_dup3: ::c_long = 292; -pub const SYS_pipe2: ::c_long = 293; -pub const SYS_inotify_init1: ::c_long = 294; -pub const SYS_preadv: ::c_long = 295; -pub const SYS_pwritev: ::c_long = 296; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 297; -pub const SYS_perf_event_open: ::c_long = 298; -pub const SYS_recvmmsg: ::c_long = 299; -pub const SYS_fanotify_init: ::c_long = 300; -pub const SYS_fanotify_mark: ::c_long = 301; -pub const SYS_prlimit64: ::c_long = 302; -pub const SYS_name_to_handle_at: ::c_long = 303; -pub const SYS_open_by_handle_at: ::c_long = 304; -pub const SYS_clock_adjtime: ::c_long = 305; -pub const SYS_syncfs: ::c_long = 306; -pub const SYS_sendmmsg: ::c_long = 307; -pub const SYS_setns: ::c_long = 308; -pub const SYS_getcpu: ::c_long = 309; -pub const SYS_process_vm_readv: ::c_long = 310; -pub const SYS_process_vm_writev: ::c_long = 311; -pub const SYS_kcmp: ::c_long = 312; -pub const SYS_finit_module: ::c_long = 313; -pub const SYS_sched_setattr: ::c_long = 314; -pub const SYS_sched_getattr: ::c_long = 315; -pub const SYS_renameat2: ::c_long = 316; -pub const SYS_seccomp: ::c_long = 317; -pub const SYS_getrandom: ::c_long = 318; -pub const SYS_memfd_create: ::c_long = 319; -pub const SYS_kexec_file_load: ::c_long = 320; -pub const SYS_bpf: ::c_long = 321; -pub const SYS_execveat: ::c_long = 322; -pub const SYS_userfaultfd: ::c_long = 323; -pub const SYS_membarrier: ::c_long = 324; -pub const SYS_mlock2: ::c_long = 325; -pub const SYS_copy_file_range: ::c_long = 326; -pub const SYS_preadv2: ::c_long = 327; -pub const SYS_pwritev2: ::c_long = 328; -pub const SYS_pkey_mprotect: ::c_long = 329; -pub const SYS_pkey_alloc: ::c_long = 330; -pub const SYS_pkey_free: ::c_long = 331; - -// offsets in user_regs_structs, from sys/reg.h -pub const R15: ::c_int = 0; -pub const R14: ::c_int = 1; -pub const R13: ::c_int = 2; -pub const R12: ::c_int = 3; -pub const RBP: ::c_int = 4; -pub const RBX: ::c_int = 5; -pub const R11: ::c_int = 6; -pub const R10: ::c_int = 7; -pub const R9: ::c_int = 8; -pub const R8: ::c_int = 9; -pub const RAX: ::c_int = 10; -pub const RCX: ::c_int = 11; -pub const RDX: ::c_int = 12; -pub const RSI: ::c_int = 13; -pub const RDI: ::c_int = 14; -pub const ORIG_RAX: ::c_int = 15; -pub const RIP: ::c_int = 16; -pub const CS: ::c_int = 17; -pub const EFLAGS: ::c_int = 18; -pub const RSP: ::c_int = 19; -pub const SS: ::c_int = 20; -pub const FS_BASE: ::c_int = 21; -pub const GS_BASE: ::c_int = 22; -pub const DS: ::c_int = 23; -pub const ES: ::c_int = 24; -pub const FS: ::c_int = 25; -pub const GS: ::c_int = 26; diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/android/mod.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/android/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/android/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/android/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,2124 +0,0 @@ -//! Android-specific definitions for linux-like values - -pub type clock_t = ::c_long; -pub type time_t = ::c_long; -pub type suseconds_t = ::c_long; -pub type off_t = ::c_long; -pub type blkcnt_t = ::c_ulong; -pub type blksize_t = ::c_ulong; -pub type nlink_t = u32; -pub type useconds_t = u32; -pub type pthread_t = ::c_long; -pub type pthread_mutexattr_t = ::c_long; -pub type pthread_rwlockattr_t = ::c_long; -pub type pthread_condattr_t = ::c_long; -pub type fsfilcnt_t = ::c_ulong; -pub type fsblkcnt_t = ::c_ulong; -pub type nfds_t = ::c_uint; -pub type rlim_t = ::c_ulong; -pub type dev_t = ::c_ulong; -pub type ino_t = ::c_ulong; -pub type __CPU_BITTYPE = ::c_ulong; -pub type idtype_t = ::c_int; -pub type loff_t = ::c_longlong; - -s! { - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_flags: ::c_int, - pub ss_size: ::size_t - } - - pub struct __fsid_t { - __val: [::c_int; 2], - } - - pub struct msghdr { - pub msg_name: *mut ::c_void, - pub msg_namelen: ::socklen_t, - pub msg_iov: *mut ::iovec, - pub msg_iovlen: ::size_t, - pub msg_control: *mut ::c_void, - pub msg_controllen: ::size_t, - pub msg_flags: ::c_int, - } - - pub struct cmsghdr { - pub cmsg_len: ::size_t, - pub cmsg_level: ::c_int, - pub cmsg_type: ::c_int, - } - - pub struct termios { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; ::NCCS], - } - - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 19], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } - - pub struct flock { - pub l_type: ::c_short, - pub l_whence: ::c_short, - pub l_start: ::off_t, - pub l_len: ::off_t, - pub l_pid: ::pid_t, - } - - pub struct cpu_set_t { - #[cfg(target_pointer_width = "64")] - __bits: [__CPU_BITTYPE; 16], - #[cfg(target_pointer_width = "32")] - __bits: [__CPU_BITTYPE; 1], - } - - pub struct sem_t { - count: ::c_uint, - #[cfg(target_pointer_width = "64")] - __reserved: [::c_int; 3], - } - - pub struct exit_status { - pub e_termination: ::c_short, - pub e_exit: ::c_short, - } - - pub struct statvfs { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_favail: ::fsfilcnt_t, - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - #[cfg(target_pointer_width = "64")] - __f_reserved: [u32; 6], - } - - pub struct signalfd_siginfo { - pub ssi_signo: ::uint32_t, - pub ssi_errno: ::int32_t, - pub ssi_code: ::int32_t, - pub ssi_pid: ::uint32_t, - pub ssi_uid: ::uint32_t, - pub ssi_fd: ::int32_t, - pub ssi_tid: ::uint32_t, - pub ssi_band: ::uint32_t, - pub ssi_overrun: ::uint32_t, - pub ssi_trapno: ::uint32_t, - pub ssi_status: ::int32_t, - pub ssi_int: ::int32_t, - pub ssi_ptr: ::c_ulonglong, - pub ssi_utime: ::c_ulonglong, - pub ssi_stime: ::c_ulonglong, - pub ssi_addr: ::c_ulonglong, - pub ssi_addr_lsb: ::uint16_t, - _pad2: ::uint16_t, - pub ssi_syscall: ::int32_t, - pub ssi_call_addr: ::uint64_t, - pub ssi_arch: ::uint32_t, - _pad: [::uint8_t; 28], - } - - pub struct ucred { - pub pid: ::pid_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - } - - pub struct genlmsghdr { - pub cmd: u8, - pub version: u8, - pub reserved: u16, - } - - pub struct nlmsghdr { - pub nlmsg_len: u32, - pub nlmsg_type: u16, - pub nlmsg_flags: u16, - pub nlmsg_seq: u32, - pub nlmsg_pid: u32, - } - - pub struct nlmsgerr { - pub error: ::c_int, - pub msg: nlmsghdr, - } - - pub struct nl_pktinfo { - pub group: u32, - } - - pub struct nl_mmap_req { - pub nm_block_size: ::c_uint, - pub nm_block_nr: ::c_uint, - pub nm_frame_size: ::c_uint, - pub nm_frame_nr: ::c_uint, - } - - pub struct nl_mmap_hdr { - pub nm_status: ::c_uint, - pub nm_len: ::c_uint, - pub nm_group: u32, - pub nm_pid: u32, - pub nm_uid: u32, - pub nm_gid: u32, - } - - pub struct nlattr { - pub nla_len: u16, - pub nla_type: u16, - } - - pub struct in6_pktinfo { - pub ipi6_addr: ::in6_addr, - pub ipi6_ifindex: ::c_int, - } - - pub struct inotify_event { - pub wd: ::c_int, - pub mask: ::uint32_t, - pub cookie: ::uint32_t, - pub len: ::uint32_t - } -} - -s_no_extra_traits!{ - pub struct dirent { - pub d_ino: u64, - pub d_off: i64, - pub d_reclen: ::c_ushort, - pub d_type: ::c_uchar, - pub d_name: [::c_char; 256], - } - - pub struct dirent64 { - pub d_ino: u64, - pub d_off: i64, - pub d_reclen: ::c_ushort, - pub d_type: ::c_uchar, - pub d_name: [::c_char; 256], - } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_errno: ::c_int, - pub si_code: ::c_int, - pub _pad: [::c_int; 29], - _align: [usize; 0], - } - - pub struct lastlog { - ll_time: ::time_t, - ll_line: [::c_char; UT_LINESIZE], - ll_host: [::c_char; UT_HOSTSIZE], - } - - pub struct utmp { - pub ut_type: ::c_short, - pub ut_pid: ::pid_t, - pub ut_line: [::c_char; UT_LINESIZE], - pub ut_id: [::c_char; 4], - pub ut_user: [::c_char; UT_NAMESIZE], - pub ut_host: [::c_char; UT_HOSTSIZE], - pub ut_exit: exit_status, - pub ut_session: ::c_long, - pub ut_tv: ::timeval, - pub ut_addr_v6: [::int32_t; 4], - unused: [::c_char; 20], - } - - pub struct sockaddr_alg { - pub salg_family: ::sa_family_t, - pub salg_type: [::c_uchar; 14], - pub salg_feat: u32, - pub salg_mask: u32, - pub salg_name: [::c_uchar; 64], - } - - pub struct af_alg_iv { - pub ivlen: u32, - pub iv: [::c_uchar; 0], - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_ino == other.d_ino - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for dirent {} - - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_ino", &self.d_ino) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_ino.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for dirent64 { - fn eq(&self, other: &dirent64) -> bool { - self.d_ino == other.d_ino - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for dirent64 {} - - impl ::fmt::Debug for dirent64 { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent64") - .field("d_ino", &self.d_ino) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - - impl ::hash::Hash for dirent64 { - fn hash(&self, state: &mut H) { - self.d_ino.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for siginfo_t { - fn eq(&self, other: &siginfo_t) -> bool { - self.si_signo == other.si_signo - && self.si_errno == other.si_errno - && self.si_code == other.si_code - // Ignore _pad - // Ignore _align - } - } - - impl Eq for siginfo_t {} - - impl ::fmt::Debug for siginfo_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("siginfo_t") - .field("si_signo", &self.si_signo) - .field("si_errno", &self.si_errno) - .field("si_code", &self.si_code) - // Ignore _pad - // Ignore _align - .finish() - } - } - - impl ::hash::Hash for siginfo_t { - fn hash(&self, state: &mut H) { - self.si_signo.hash(state); - self.si_errno.hash(state); - self.si_code.hash(state); - // Ignore _pad - // Ignore _align - } - } - - impl PartialEq for lastlog { - fn eq(&self, other: &lastlog) -> bool { - self.ll_time == other.ll_time - && self - .ll_line - .iter() - .zip(other.ll_line.iter()) - .all(|(a,b)| a == b) - && self - .ll_host - .iter() - .zip(other.ll_host.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for lastlog {} - - impl ::fmt::Debug for lastlog { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("lastlog") - .field("ll_time", &self.ll_time) - .field("ll_line", &self.ll_line) - // FIXME: .field("ll_host", &self.ll_host) - .finish() - } - } - - impl ::hash::Hash for lastlog { - fn hash(&self, state: &mut H) { - self.ll_time.hash(state); - self.ll_line.hash(state); - self.ll_host.hash(state); - } - } - - impl PartialEq for utmp { - fn eq(&self, other: &utmp) -> bool { - self.ut_type == other.ut_type - && self.ut_pid == other.ut_pid - && self - .ut_line - .iter() - .zip(other.ut_line.iter()) - .all(|(a,b)| a == b) - && self.ut_id == other.ut_id - && self - .ut_user - .iter() - .zip(other.ut_user.iter()) - .all(|(a,b)| a == b) - && self - .ut_host - .iter() - .zip(other.ut_host.iter()) - .all(|(a,b)| a == b) - && self.ut_exit == other.ut_exit - && self.ut_session == other.ut_session - && self.ut_tv == other.ut_tv - && self.ut_addr_v6 == other.ut_addr_v6 - && self.unused == other.unused - } - } - - impl Eq for utmp {} - - impl ::fmt::Debug for utmp { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utmp") - .field("ut_type", &self.ut_type) - .field("ut_pid", &self.ut_pid) - .field("ut_line", &self.ut_line) - .field("ut_id", &self.ut_id) - .field("ut_user", &self.ut_user) - // FIXME: .field("ut_host", &self.ut_host) - .field("ut_exit", &self.ut_exit) - .field("ut_session", &self.ut_session) - .field("ut_tv", &self.ut_tv) - .field("ut_addr_v6", &self.ut_addr_v6) - .field("unused", &self.unused) - .finish() - } - } - - impl ::hash::Hash for utmp { - fn hash(&self, state: &mut H) { - self.ut_type.hash(state); - self.ut_pid.hash(state); - self.ut_line.hash(state); - self.ut_id.hash(state); - self.ut_user.hash(state); - self.ut_host.hash(state); - self.ut_exit.hash(state); - self.ut_session.hash(state); - self.ut_tv.hash(state); - self.ut_addr_v6.hash(state); - self.unused.hash(state); - } - } - - impl PartialEq for sockaddr_alg { - fn eq(&self, other: &sockaddr_alg) -> bool { - self.salg_family == other.salg_family - && self - .salg_type - .iter() - .zip(other.salg_type.iter()) - .all(|(a, b)| a == b) - && self.salg_feat == other.salg_feat - && self.salg_mask == other.salg_mask - && self - .salg_name - .iter() - .zip(other.salg_name.iter()) - .all(|(a, b)| a == b) - } - } - - impl Eq for sockaddr_alg {} - - impl ::fmt::Debug for sockaddr_alg { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_alg") - .field("salg_family", &self.salg_family) - .field("salg_type", &self.salg_type) - .field("salg_feat", &self.salg_feat) - .field("salg_mask", &self.salg_mask) - .field("salg_name", &&self.salg_name[..]) - .finish() - } - } - - impl ::hash::Hash for sockaddr_alg { - fn hash(&self, state: &mut H) { - self.salg_family.hash(state); - self.salg_type.hash(state); - self.salg_feat.hash(state); - self.salg_mask.hash(state); - self.salg_name.hash(state); - } - } - - impl af_alg_iv { - fn as_slice(&self) -> &[u8] { - unsafe { - ::core::slice::from_raw_parts( - self.iv.as_ptr(), - self.ivlen as usize - ) - } - } - } - - impl PartialEq for af_alg_iv { - fn eq(&self, other: &af_alg_iv) -> bool { - *self.as_slice() == *other.as_slice() - } - } - - impl Eq for af_alg_iv {} - - impl ::fmt::Debug for af_alg_iv { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("af_alg_iv") - .field("iv", &self.as_slice()) - .finish() - } - } - - impl ::hash::Hash for af_alg_iv { - fn hash(&self, state: &mut H) { - self.as_slice().hash(state); - } - } - } -} - -pub const O_TRUNC: ::c_int = 512; -pub const O_CLOEXEC: ::c_int = 0x80000; -pub const O_PATH: ::c_int = 0o10000000; -pub const O_NOATIME: ::c_int = 0o1000000; - -pub const EBFONT: ::c_int = 59; -pub const ENOSTR: ::c_int = 60; -pub const ENODATA: ::c_int = 61; -pub const ETIME: ::c_int = 62; -pub const ENOSR: ::c_int = 63; -pub const ENONET: ::c_int = 64; -pub const ENOPKG: ::c_int = 65; -pub const EREMOTE: ::c_int = 66; -pub const ENOLINK: ::c_int = 67; -pub const EADV: ::c_int = 68; -pub const ESRMNT: ::c_int = 69; -pub const ECOMM: ::c_int = 70; -pub const EPROTO: ::c_int = 71; -pub const EDOTDOT: ::c_int = 73; - -pub const SA_NODEFER: ::c_int = 0x40000000; -pub const SA_RESETHAND: ::c_int = 0x80000000; -pub const SA_RESTART: ::c_int = 0x10000000; -pub const SA_NOCLDSTOP: ::c_int = 0x00000001; - -pub const EPOLL_CLOEXEC: ::c_int = 0x80000; -pub const EPOLLONESHOT: ::c_int = 0x40000000; -pub const EPOLLRDHUP: ::c_int = 0x00002000; -pub const EPOLLWAKEUP: ::c_int = 0x20000000; - -pub const EFD_CLOEXEC: ::c_int = 0x80000; - -pub const USER_PROCESS: ::c_short = 7; - -pub const BUFSIZ: ::c_uint = 1024; -pub const FILENAME_MAX: ::c_uint = 1024; -pub const FOPEN_MAX: ::c_uint = 20; -pub const POSIX_FADV_DONTNEED: ::c_int = 4; -pub const POSIX_FADV_NOREUSE: ::c_int = 5; -pub const L_tmpnam: ::c_uint = 1024; -pub const TMP_MAX: ::c_uint = 308915776; -pub const _PC_LINK_MAX: ::c_int = 1; -pub const _PC_MAX_CANON: ::c_int = 2; -pub const _PC_MAX_INPUT: ::c_int = 3; -pub const _PC_NAME_MAX: ::c_int = 4; -pub const _PC_PATH_MAX: ::c_int = 5; -pub const _PC_PIPE_BUF: ::c_int = 6; -pub const _PC_2_SYMLINKS: ::c_int = 7; -pub const _PC_ALLOC_SIZE_MIN: ::c_int = 8; -pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 9; -pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 10; -pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 11; -pub const _PC_REC_XFER_ALIGN: ::c_int = 12; -pub const _PC_SYMLINK_MAX: ::c_int = 13; -pub const _PC_CHOWN_RESTRICTED: ::c_int = 14; -pub const _PC_NO_TRUNC: ::c_int = 15; -pub const _PC_VDISABLE: ::c_int = 16; -pub const _PC_ASYNC_IO: ::c_int = 17; -pub const _PC_PRIO_IO: ::c_int = 18; -pub const _PC_SYNC_IO: ::c_int = 19; - -pub const FIONBIO: ::c_int = 0x5421; - -pub const _SC_ARG_MAX: ::c_int = 0; -pub const _SC_BC_BASE_MAX: ::c_int = 1; -pub const _SC_BC_DIM_MAX: ::c_int = 2; -pub const _SC_BC_SCALE_MAX: ::c_int = 3; -pub const _SC_BC_STRING_MAX: ::c_int = 4; -pub const _SC_CHILD_MAX: ::c_int = 5; -pub const _SC_CLK_TCK: ::c_int = 6; -pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 7; -pub const _SC_EXPR_NEST_MAX: ::c_int = 8; -pub const _SC_LINE_MAX: ::c_int = 9; -pub const _SC_NGROUPS_MAX: ::c_int = 10; -pub const _SC_OPEN_MAX: ::c_int = 11; -pub const _SC_PASS_MAX: ::c_int = 12; -pub const _SC_2_C_BIND: ::c_int = 13; -pub const _SC_2_C_DEV: ::c_int = 14; -pub const _SC_2_C_VERSION: ::c_int = 15; -pub const _SC_2_CHAR_TERM: ::c_int = 16; -pub const _SC_2_FORT_DEV: ::c_int = 17; -pub const _SC_2_FORT_RUN: ::c_int = 18; -pub const _SC_2_LOCALEDEF: ::c_int = 19; -pub const _SC_2_SW_DEV: ::c_int = 20; -pub const _SC_2_UPE: ::c_int = 21; -pub const _SC_2_VERSION: ::c_int = 22; -pub const _SC_JOB_CONTROL: ::c_int = 23; -pub const _SC_SAVED_IDS: ::c_int = 24; -pub const _SC_VERSION: ::c_int = 25; -pub const _SC_RE_DUP_MAX: ::c_int = 26; -pub const _SC_STREAM_MAX: ::c_int = 27; -pub const _SC_TZNAME_MAX: ::c_int = 28; -pub const _SC_XOPEN_CRYPT: ::c_int = 29; -pub const _SC_XOPEN_ENH_I18N: ::c_int = 30; -pub const _SC_XOPEN_SHM: ::c_int = 31; -pub const _SC_XOPEN_VERSION: ::c_int = 32; -pub const _SC_XOPEN_XCU_VERSION: ::c_int = 33; -pub const _SC_XOPEN_REALTIME: ::c_int = 34; -pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 35; -pub const _SC_XOPEN_LEGACY: ::c_int = 36; -pub const _SC_ATEXIT_MAX: ::c_int = 37; -pub const _SC_IOV_MAX: ::c_int = 38; -pub const _SC_PAGESIZE: ::c_int = 39; -pub const _SC_PAGE_SIZE: ::c_int = 40; -pub const _SC_XOPEN_UNIX: ::c_int = 41; -pub const _SC_XBS5_ILP32_OFF32: ::c_int = 42; -pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 43; -pub const _SC_XBS5_LP64_OFF64: ::c_int = 44; -pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 45; -pub const _SC_AIO_LISTIO_MAX: ::c_int = 46; -pub const _SC_AIO_MAX: ::c_int = 47; -pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 48; -pub const _SC_DELAYTIMER_MAX: ::c_int = 49; -pub const _SC_MQ_OPEN_MAX: ::c_int = 50; -pub const _SC_MQ_PRIO_MAX: ::c_int = 51; -pub const _SC_RTSIG_MAX: ::c_int = 52; -pub const _SC_SEM_NSEMS_MAX: ::c_int = 53; -pub const _SC_SEM_VALUE_MAX: ::c_int = 54; -pub const _SC_SIGQUEUE_MAX: ::c_int = 55; -pub const _SC_TIMER_MAX: ::c_int = 56; -pub const _SC_ASYNCHRONOUS_IO: ::c_int = 57; -pub const _SC_FSYNC: ::c_int = 58; -pub const _SC_MAPPED_FILES: ::c_int = 59; -pub const _SC_MEMLOCK: ::c_int = 60; -pub const _SC_MEMLOCK_RANGE: ::c_int = 61; -pub const _SC_MEMORY_PROTECTION: ::c_int = 62; -pub const _SC_MESSAGE_PASSING: ::c_int = 63; -pub const _SC_PRIORITIZED_IO: ::c_int = 64; -pub const _SC_PRIORITY_SCHEDULING: ::c_int = 65; -pub const _SC_REALTIME_SIGNALS: ::c_int = 66; -pub const _SC_SEMAPHORES: ::c_int = 67; -pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 68; -pub const _SC_SYNCHRONIZED_IO: ::c_int = 69; -pub const _SC_TIMERS: ::c_int = 70; -pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 71; -pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 72; -pub const _SC_LOGIN_NAME_MAX: ::c_int = 73; -pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 74; -pub const _SC_THREAD_KEYS_MAX: ::c_int = 75; -pub const _SC_THREAD_STACK_MIN: ::c_int = 76; -pub const _SC_THREAD_THREADS_MAX: ::c_int = 77; -pub const _SC_TTY_NAME_MAX: ::c_int = 78; -pub const _SC_THREADS: ::c_int = 79; -pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 80; -pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 81; -pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 82; -pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 83; -pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 84; -pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 85; -pub const _SC_NPROCESSORS_CONF: ::c_int = 96; -pub const _SC_NPROCESSORS_ONLN: ::c_int = 97; -pub const _SC_PHYS_PAGES: ::c_int = 98; -pub const _SC_AVPHYS_PAGES: ::c_int = 99; -pub const _SC_MONOTONIC_CLOCK: ::c_int = 100; - -pub const _SC_2_PBS: ::c_int = 101; -pub const _SC_2_PBS_ACCOUNTING: ::c_int = 102; -pub const _SC_2_PBS_CHECKPOINT: ::c_int = 103; -pub const _SC_2_PBS_LOCATE: ::c_int = 104; -pub const _SC_2_PBS_MESSAGE: ::c_int = 105; -pub const _SC_2_PBS_TRACK: ::c_int = 106; -pub const _SC_ADVISORY_INFO: ::c_int = 107; -pub const _SC_BARRIERS: ::c_int = 108; -pub const _SC_CLOCK_SELECTION: ::c_int = 109; -pub const _SC_CPUTIME: ::c_int = 110; -pub const _SC_HOST_NAME_MAX: ::c_int = 111; -pub const _SC_IPV6: ::c_int = 112; -pub const _SC_RAW_SOCKETS: ::c_int = 113; -pub const _SC_READER_WRITER_LOCKS: ::c_int = 114; -pub const _SC_REGEXP: ::c_int = 115; -pub const _SC_SHELL: ::c_int = 116; -pub const _SC_SPAWN: ::c_int = 117; -pub const _SC_SPIN_LOCKS: ::c_int = 118; -pub const _SC_SPORADIC_SERVER: ::c_int = 119; -pub const _SC_SS_REPL_MAX: ::c_int = 120; -pub const _SC_SYMLOOP_MAX: ::c_int = 121; -pub const _SC_THREAD_CPUTIME: ::c_int = 122; -pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 123; -pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 124; -pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 125; -pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 126; -pub const _SC_TIMEOUTS: ::c_int = 127; -pub const _SC_TRACE: ::c_int = 128; -pub const _SC_TRACE_EVENT_FILTER: ::c_int = 129; -pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 130; -pub const _SC_TRACE_INHERIT: ::c_int = 131; -pub const _SC_TRACE_LOG: ::c_int = 132; -pub const _SC_TRACE_NAME_MAX: ::c_int = 133; -pub const _SC_TRACE_SYS_MAX: ::c_int = 134; -pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 135; -pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 136; -pub const _SC_V7_ILP32_OFF32: ::c_int = 137; -pub const _SC_V7_ILP32_OFFBIG: ::c_int = 138; -pub const _SC_V7_LP64_OFF64: ::c_int = 139; -pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 140; -pub const _SC_XOPEN_STREAMS: ::c_int = 141; -pub const _SC_XOPEN_UUCP: ::c_int = 142; - -pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; -pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; -pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; -pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; - -pub const FIOCLEX: ::c_int = 0x5451; - -pub const SA_ONSTACK: ::c_ulong = 0x08000000; -pub const SA_SIGINFO: ::c_ulong = 0x00000004; -pub const SA_NOCLDWAIT: ::c_ulong = 0x00000002; -pub const SIGCHLD: ::c_int = 17; -pub const SIGBUS: ::c_int = 7; -pub const SIGUSR1: ::c_int = 10; -pub const SIGUSR2: ::c_int = 12; -pub const SIGCONT: ::c_int = 18; -pub const SIGSTOP: ::c_int = 19; -pub const SIGTSTP: ::c_int = 20; -pub const SIGURG: ::c_int = 23; -pub const SIGIO: ::c_int = 29; -pub const SIGSYS: ::c_int = 31; -pub const SIGSTKFLT: ::c_int = 16; -pub const SIGUNUSED: ::c_int = 31; -pub const SIGTTIN: ::c_int = 21; -pub const SIGTTOU: ::c_int = 22; -pub const SIGXCPU: ::c_int = 24; -pub const SIGXFSZ: ::c_int = 25; -pub const SIGVTALRM: ::c_int = 26; -pub const SIGPROF: ::c_int = 27; -pub const SIGWINCH: ::c_int = 28; -pub const SIGPOLL: ::c_int = 29; -pub const SIGPWR: ::c_int = 30; -pub const SIG_SETMASK: ::c_int = 2; -pub const SIG_BLOCK: ::c_int = 0x000000; -pub const SIG_UNBLOCK: ::c_int = 0x01; - -pub const RUSAGE_CHILDREN: ::c_int = -1; - -pub const LC_PAPER: ::c_int = 7; -pub const LC_NAME: ::c_int = 8; -pub const LC_ADDRESS: ::c_int = 9; -pub const LC_TELEPHONE: ::c_int = 10; -pub const LC_MEASUREMENT: ::c_int = 11; -pub const LC_IDENTIFICATION: ::c_int = 12; -pub const LC_PAPER_MASK: ::c_int = (1 << LC_PAPER); -pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME); -pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS); -pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE); -pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT); -pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION); -pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK - | ::LC_NUMERIC_MASK - | ::LC_TIME_MASK - | ::LC_COLLATE_MASK - | ::LC_MONETARY_MASK - | ::LC_MESSAGES_MASK - | LC_PAPER_MASK - | LC_NAME_MASK - | LC_ADDRESS_MASK - | LC_TELEPHONE_MASK - | LC_MEASUREMENT_MASK - | LC_IDENTIFICATION_MASK; - -pub const MAP_ANON: ::c_int = 0x0020; -pub const MAP_ANONYMOUS: ::c_int = 0x0020; -pub const MAP_GROWSDOWN: ::c_int = 0x0100; -pub const MAP_DENYWRITE: ::c_int = 0x0800; -pub const MAP_EXECUTABLE: ::c_int = 0x01000; -pub const MAP_LOCKED: ::c_int = 0x02000; -pub const MAP_NORESERVE: ::c_int = 0x04000; -pub const MAP_POPULATE: ::c_int = 0x08000; -pub const MAP_NONBLOCK: ::c_int = 0x010000; -pub const MAP_STACK: ::c_int = 0x020000; - -pub const EDEADLK: ::c_int = 35; -pub const ENAMETOOLONG: ::c_int = 36; -pub const ENOLCK: ::c_int = 37; -pub const ENOSYS: ::c_int = 38; -pub const ENOTEMPTY: ::c_int = 39; -pub const ELOOP: ::c_int = 40; -pub const ENOMSG: ::c_int = 42; -pub const EIDRM: ::c_int = 43; -pub const ECHRNG: ::c_int = 44; -pub const EL2NSYNC: ::c_int = 45; -pub const EL3HLT: ::c_int = 46; -pub const EL3RST: ::c_int = 47; -pub const ELNRNG: ::c_int = 48; -pub const EUNATCH: ::c_int = 49; -pub const ENOCSI: ::c_int = 50; -pub const EL2HLT: ::c_int = 51; -pub const EBADE: ::c_int = 52; -pub const EBADR: ::c_int = 53; -pub const EXFULL: ::c_int = 54; -pub const ENOANO: ::c_int = 55; -pub const EBADRQC: ::c_int = 56; -pub const EBADSLT: ::c_int = 57; - -pub const EMULTIHOP: ::c_int = 72; -pub const EBADMSG: ::c_int = 74; -pub const EOVERFLOW: ::c_int = 75; -pub const ENOTUNIQ: ::c_int = 76; -pub const EBADFD: ::c_int = 77; -pub const EREMCHG: ::c_int = 78; -pub const ELIBACC: ::c_int = 79; -pub const ELIBBAD: ::c_int = 80; -pub const ELIBSCN: ::c_int = 81; -pub const ELIBMAX: ::c_int = 82; -pub const ELIBEXEC: ::c_int = 83; -pub const EILSEQ: ::c_int = 84; -pub const ERESTART: ::c_int = 85; -pub const ESTRPIPE: ::c_int = 86; -pub const EUSERS: ::c_int = 87; -pub const ENOTSOCK: ::c_int = 88; -pub const EDESTADDRREQ: ::c_int = 89; -pub const EMSGSIZE: ::c_int = 90; -pub const EPROTOTYPE: ::c_int = 91; -pub const ENOPROTOOPT: ::c_int = 92; -pub const EPROTONOSUPPORT: ::c_int = 93; -pub const ESOCKTNOSUPPORT: ::c_int = 94; -pub const EOPNOTSUPP: ::c_int = 95; -pub const ENOTSUP: ::c_int = EOPNOTSUPP; -pub const EPFNOSUPPORT: ::c_int = 96; -pub const EAFNOSUPPORT: ::c_int = 97; -pub const EADDRINUSE: ::c_int = 98; -pub const EADDRNOTAVAIL: ::c_int = 99; -pub const ENETDOWN: ::c_int = 100; -pub const ENETUNREACH: ::c_int = 101; -pub const ENETRESET: ::c_int = 102; -pub const ECONNABORTED: ::c_int = 103; -pub const ECONNRESET: ::c_int = 104; -pub const ENOBUFS: ::c_int = 105; -pub const EISCONN: ::c_int = 106; -pub const ENOTCONN: ::c_int = 107; -pub const ESHUTDOWN: ::c_int = 108; -pub const ETOOMANYREFS: ::c_int = 109; -pub const ETIMEDOUT: ::c_int = 110; -pub const ECONNREFUSED: ::c_int = 111; -pub const EHOSTDOWN: ::c_int = 112; -pub const EHOSTUNREACH: ::c_int = 113; -pub const EALREADY: ::c_int = 114; -pub const EINPROGRESS: ::c_int = 115; -pub const ESTALE: ::c_int = 116; -pub const EUCLEAN: ::c_int = 117; -pub const ENOTNAM: ::c_int = 118; -pub const ENAVAIL: ::c_int = 119; -pub const EISNAM: ::c_int = 120; -pub const EREMOTEIO: ::c_int = 121; -pub const EDQUOT: ::c_int = 122; -pub const ENOMEDIUM: ::c_int = 123; -pub const EMEDIUMTYPE: ::c_int = 124; -pub const ECANCELED: ::c_int = 125; -pub const ENOKEY: ::c_int = 126; -pub const EKEYEXPIRED: ::c_int = 127; -pub const EKEYREVOKED: ::c_int = 128; -pub const EKEYREJECTED: ::c_int = 129; -pub const EOWNERDEAD: ::c_int = 130; -pub const ENOTRECOVERABLE: ::c_int = 131; - -pub const SOCK_STREAM: ::c_int = 1; -pub const SOCK_DGRAM: ::c_int = 2; -pub const SOCK_SEQPACKET: ::c_int = 5; -pub const SOCK_DCCP: ::c_int = 6; -pub const SOCK_PACKET: ::c_int = 10; - -pub const SOL_SOCKET: ::c_int = 1; -pub const SOL_SCTP: ::c_int = 132; -pub const SOL_IPX: ::c_int = 256; -pub const SOL_AX25: ::c_int = 257; -pub const SOL_ATALK: ::c_int = 258; -pub const SOL_NETROM: ::c_int = 259; -pub const SOL_ROSE: ::c_int = 260; - -#[doc(hidden)] -pub const AF_MAX: ::c_int = 43; -#[doc(hidden)] -pub const PF_MAX: ::c_int = AF_MAX; - -/* DCCP socket options */ -pub const DCCP_SOCKOPT_PACKET_SIZE: ::c_int = 1; -pub const DCCP_SOCKOPT_SERVICE: ::c_int = 2; -pub const DCCP_SOCKOPT_CHANGE_L: ::c_int = 3; -pub const DCCP_SOCKOPT_CHANGE_R: ::c_int = 4; -pub const DCCP_SOCKOPT_GET_CUR_MPS: ::c_int = 5; -pub const DCCP_SOCKOPT_SERVER_TIMEWAIT: ::c_int = 6; -pub const DCCP_SOCKOPT_SEND_CSCOV: ::c_int = 10; -pub const DCCP_SOCKOPT_RECV_CSCOV: ::c_int = 11; -pub const DCCP_SOCKOPT_AVAILABLE_CCIDS: ::c_int = 12; -pub const DCCP_SOCKOPT_CCID: ::c_int = 13; -pub const DCCP_SOCKOPT_TX_CCID: ::c_int = 14; -pub const DCCP_SOCKOPT_RX_CCID: ::c_int = 15; -pub const DCCP_SOCKOPT_QPOLICY_ID: ::c_int = 16; -pub const DCCP_SOCKOPT_QPOLICY_TXQLEN: ::c_int = 17; -pub const DCCP_SOCKOPT_CCID_RX_INFO: ::c_int = 128; -pub const DCCP_SOCKOPT_CCID_TX_INFO: ::c_int = 192; - -/// maximum number of services provided on the same listening port -pub const DCCP_SERVICE_LIST_MAX_LEN: ::c_int = 32; - -pub const SO_REUSEADDR: ::c_int = 2; -pub const SO_TYPE: ::c_int = 3; -pub const SO_ERROR: ::c_int = 4; -pub const SO_DONTROUTE: ::c_int = 5; -pub const SO_BROADCAST: ::c_int = 6; -pub const SO_SNDBUF: ::c_int = 7; -pub const SO_RCVBUF: ::c_int = 8; -pub const SO_KEEPALIVE: ::c_int = 9; -pub const SO_OOBINLINE: ::c_int = 10; -pub const SO_PRIORITY: ::c_int = 12; -pub const SO_LINGER: ::c_int = 13; -pub const SO_BSDCOMPAT: ::c_int = 14; -pub const SO_REUSEPORT: ::c_int = 15; -pub const SO_PASSCRED: ::c_int = 16; -pub const SO_PEERCRED: ::c_int = 17; -pub const SO_RCVLOWAT: ::c_int = 18; -pub const SO_SNDLOWAT: ::c_int = 19; -pub const SO_RCVTIMEO: ::c_int = 20; -pub const SO_SNDTIMEO: ::c_int = 21; -pub const SO_BINDTODEVICE: ::c_int = 25; -pub const SO_TIMESTAMP: ::c_int = 29; -pub const SO_ACCEPTCONN: ::c_int = 30; -pub const SO_SNDBUFFORCE: ::c_int = 32; -pub const SO_RCVBUFFORCE: ::c_int = 33; -pub const SO_MARK: ::c_int = 36; -pub const SO_PROTOCOL: ::c_int = 38; -pub const SO_DOMAIN: ::c_int = 39; -pub const SO_RXQ_OVFL: ::c_int = 40; -pub const SO_PEEK_OFF: ::c_int = 42; -pub const SO_BUSY_POLL: ::c_int = 46; - -pub const IPTOS_ECN_NOTECT: u8 = 0x00; - -pub const O_ACCMODE: ::c_int = 3; -pub const O_APPEND: ::c_int = 1024; -pub const O_CREAT: ::c_int = 64; -pub const O_EXCL: ::c_int = 128; -pub const O_NOCTTY: ::c_int = 256; -pub const O_NONBLOCK: ::c_int = 2048; -pub const O_SYNC: ::c_int = 0x101000; -pub const O_ASYNC: ::c_int = 0x2000; -pub const O_NDELAY: ::c_int = 0x800; -pub const O_DSYNC: ::c_int = 4096; - -pub const NI_MAXHOST: ::size_t = 1025; - -pub const NCCS: usize = 19; -pub const TCSBRKP: ::c_int = 0x5425; -pub const TCSANOW: ::c_int = 0; -pub const TCSADRAIN: ::c_int = 0x1; -pub const TCSAFLUSH: ::c_int = 0x2; -pub const VEOF: usize = 4; -pub const VEOL: usize = 11; -pub const VEOL2: usize = 16; -pub const VMIN: usize = 6; -pub const IEXTEN: ::tcflag_t = 0x00008000; -pub const TOSTOP: ::tcflag_t = 0x00000100; -pub const FLUSHO: ::tcflag_t = 0x00001000; -pub const EXTPROC: ::tcflag_t = 0o200000; - -pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5; -pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff; -pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245; -pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45; -pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53; -pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53; -pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53; -pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53; -pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849; -pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6; -pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660; -pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6; -pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f; -pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f; -pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468; -pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478; -pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44; -pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c; -pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969; -pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1; -pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0; -pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f; -pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973; -pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b; -pub const TMPFS_MAGIC: ::c_long = 0x01021994; -pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2; - -pub const MAP_HUGETLB: ::c_int = 0x040000; - -pub const PTRACE_TRACEME: ::c_int = 0; -pub const PTRACE_PEEKTEXT: ::c_int = 1; -pub const PTRACE_PEEKDATA: ::c_int = 2; -pub const PTRACE_PEEKUSER: ::c_int = 3; -pub const PTRACE_POKETEXT: ::c_int = 4; -pub const PTRACE_POKEDATA: ::c_int = 5; -pub const PTRACE_POKEUSER: ::c_int = 6; -pub const PTRACE_CONT: ::c_int = 7; -pub const PTRACE_KILL: ::c_int = 8; -pub const PTRACE_SINGLESTEP: ::c_int = 9; -pub const PTRACE_ATTACH: ::c_int = 16; -pub const PTRACE_DETACH: ::c_int = 17; -pub const PTRACE_SYSCALL: ::c_int = 24; -pub const PTRACE_SETOPTIONS: ::c_int = 0x4200; -pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201; -pub const PTRACE_GETSIGINFO: ::c_int = 0x4202; -pub const PTRACE_SETSIGINFO: ::c_int = 0x4203; - -pub const EFD_NONBLOCK: ::c_int = 0x800; - -pub const F_GETLK: ::c_int = 5; -pub const F_GETOWN: ::c_int = 9; -pub const F_SETOWN: ::c_int = 8; -pub const F_SETLK: ::c_int = 6; -pub const F_SETLKW: ::c_int = 7; - -pub const F_RDLCK: ::c_int = 0; -pub const F_WRLCK: ::c_int = 1; -pub const F_UNLCK: ::c_int = 2; - -pub const TCGETS: ::c_int = 0x5401; -pub const TCSETS: ::c_int = 0x5402; -pub const TCSETSW: ::c_int = 0x5403; -pub const TCSETSF: ::c_int = 0x5404; -pub const TCGETA: ::c_int = 0x5405; -pub const TCSETA: ::c_int = 0x5406; -pub const TCSETAW: ::c_int = 0x5407; -pub const TCSETAF: ::c_int = 0x5408; -pub const TCSBRK: ::c_int = 0x5409; -pub const TCXONC: ::c_int = 0x540A; -pub const TCFLSH: ::c_int = 0x540B; -pub const TIOCGSOFTCAR: ::c_int = 0x5419; -pub const TIOCSSOFTCAR: ::c_int = 0x541A; -pub const TIOCINQ: ::c_int = 0x541B; -pub const TIOCLINUX: ::c_int = 0x541C; -pub const TIOCGSERIAL: ::c_int = 0x541E; -pub const TIOCEXCL: ::c_int = 0x540C; -pub const TIOCNXCL: ::c_int = 0x540D; -pub const TIOCSCTTY: ::c_int = 0x540E; -pub const TIOCGPGRP: ::c_int = 0x540F; -pub const TIOCSPGRP: ::c_int = 0x5410; -pub const TIOCOUTQ: ::c_int = 0x5411; -pub const TIOCSTI: ::c_int = 0x5412; -pub const TIOCGWINSZ: ::c_int = 0x5413; -pub const TIOCSWINSZ: ::c_int = 0x5414; -pub const TIOCMGET: ::c_int = 0x5415; -pub const TIOCMBIS: ::c_int = 0x5416; -pub const TIOCMBIC: ::c_int = 0x5417; -pub const TIOCMSET: ::c_int = 0x5418; -pub const FIONREAD: ::c_int = 0x541B; -pub const TIOCCONS: ::c_int = 0x541D; - -pub const ST_RDONLY: ::c_ulong = 1; -pub const ST_NOSUID: ::c_ulong = 2; -pub const ST_NODEV: ::c_ulong = 4; -pub const ST_NOEXEC: ::c_ulong = 8; -pub const ST_SYNCHRONOUS: ::c_ulong = 16; -pub const ST_MANDLOCK: ::c_ulong = 64; -pub const ST_NOATIME: ::c_ulong = 1024; -pub const ST_NODIRATIME: ::c_ulong = 2048; -pub const ST_RELATIME: ::c_ulong = 4096; - -pub const RTLD_NOLOAD: ::c_int = 0x4; - -pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t; - -pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead; -pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793; -pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278; -pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448; -pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216; - -pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567; -pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123; -pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF; -pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000; -pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC; -pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4; -pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2; -pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543; - -pub const MCL_CURRENT: ::c_int = 0x0001; -pub const MCL_FUTURE: ::c_int = 0x0002; - -pub const CBAUD: ::tcflag_t = 0o0010017; -pub const TAB1: ::c_int = 0x00000800; -pub const TAB2: ::c_int = 0x00001000; -pub const TAB3: ::c_int = 0x00001800; -pub const CR1: ::c_int = 0x00000200; -pub const CR2: ::c_int = 0x00000400; -pub const CR3: ::c_int = 0x00000600; -pub const FF1: ::c_int = 0x00008000; -pub const BS1: ::c_int = 0x00002000; -pub const VT1: ::c_int = 0x00004000; -pub const VWERASE: usize = 14; -pub const VREPRINT: usize = 12; -pub const VSUSP: usize = 10; -pub const VSTART: usize = 8; -pub const VSTOP: usize = 9; -pub const VDISCARD: usize = 13; -pub const VTIME: usize = 5; -pub const IXON: ::tcflag_t = 0x00000400; -pub const IXOFF: ::tcflag_t = 0x00001000; -pub const ONLCR: ::tcflag_t = 0x4; -pub const CSIZE: ::tcflag_t = 0x00000030; -pub const CS6: ::tcflag_t = 0x00000010; -pub const CS7: ::tcflag_t = 0x00000020; -pub const CS8: ::tcflag_t = 0x00000030; -pub const CSTOPB: ::tcflag_t = 0x00000040; -pub const CREAD: ::tcflag_t = 0x00000080; -pub const PARENB: ::tcflag_t = 0x00000100; -pub const PARODD: ::tcflag_t = 0x00000200; -pub const HUPCL: ::tcflag_t = 0x00000400; -pub const CLOCAL: ::tcflag_t = 0x00000800; -pub const ECHOKE: ::tcflag_t = 0x00000800; -pub const ECHOE: ::tcflag_t = 0x00000010; -pub const ECHOK: ::tcflag_t = 0x00000020; -pub const ECHONL: ::tcflag_t = 0x00000040; -pub const ECHOPRT: ::tcflag_t = 0x00000400; -pub const ECHOCTL: ::tcflag_t = 0x00000200; -pub const ISIG: ::tcflag_t = 0x00000001; -pub const ICANON: ::tcflag_t = 0x00000002; -pub const PENDIN: ::tcflag_t = 0x00004000; -pub const NOFLSH: ::tcflag_t = 0x00000080; -pub const VSWTC: usize = 7; -pub const OLCUC: ::tcflag_t = 0o000002; -pub const NLDLY: ::tcflag_t = 0o000400; -pub const CRDLY: ::tcflag_t = 0o003000; -pub const TABDLY: ::tcflag_t = 0o014000; -pub const BSDLY: ::tcflag_t = 0o020000; -pub const FFDLY: ::tcflag_t = 0o100000; -pub const VTDLY: ::tcflag_t = 0o040000; -pub const XTABS: ::tcflag_t = 0o014000; - -pub const B0: ::speed_t = 0o000000; -pub const B50: ::speed_t = 0o000001; -pub const B75: ::speed_t = 0o000002; -pub const B110: ::speed_t = 0o000003; -pub const B134: ::speed_t = 0o000004; -pub const B150: ::speed_t = 0o000005; -pub const B200: ::speed_t = 0o000006; -pub const B300: ::speed_t = 0o000007; -pub const B600: ::speed_t = 0o000010; -pub const B1200: ::speed_t = 0o000011; -pub const B1800: ::speed_t = 0o000012; -pub const B2400: ::speed_t = 0o000013; -pub const B4800: ::speed_t = 0o000014; -pub const B9600: ::speed_t = 0o000015; -pub const B19200: ::speed_t = 0o000016; -pub const B38400: ::speed_t = 0o000017; -pub const EXTA: ::speed_t = B19200; -pub const EXTB: ::speed_t = B38400; -pub const BOTHER: ::speed_t = 0o010000; -pub const B57600: ::speed_t = 0o010001; -pub const B115200: ::speed_t = 0o010002; -pub const B230400: ::speed_t = 0o010003; -pub const B460800: ::speed_t = 0o010004; -pub const B500000: ::speed_t = 0o010005; -pub const B576000: ::speed_t = 0o010006; -pub const B921600: ::speed_t = 0o010007; -pub const B1000000: ::speed_t = 0o010010; -pub const B1152000: ::speed_t = 0o010011; -pub const B1500000: ::speed_t = 0o010012; -pub const B2000000: ::speed_t = 0o010013; -pub const B2500000: ::speed_t = 0o010014; -pub const B3000000: ::speed_t = 0o010015; -pub const B3500000: ::speed_t = 0o010016; -pub const B4000000: ::speed_t = 0o010017; - -pub const EAI_AGAIN: ::c_int = 2; -pub const EAI_BADFLAGS: ::c_int = 3; -pub const EAI_FAIL: ::c_int = 4; -pub const EAI_FAMILY: ::c_int = 5; -pub const EAI_MEMORY: ::c_int = 6; -pub const EAI_NODATA: ::c_int = 7; -pub const EAI_NONAME: ::c_int = 8; -pub const EAI_SERVICE: ::c_int = 9; -pub const EAI_SOCKTYPE: ::c_int = 10; -pub const EAI_SYSTEM: ::c_int = 11; -pub const EAI_OVERFLOW: ::c_int = 14; - -pub const NETLINK_ROUTE: ::c_int = 0; -pub const NETLINK_UNUSED: ::c_int = 1; -pub const NETLINK_USERSOCK: ::c_int = 2; -pub const NETLINK_FIREWALL: ::c_int = 3; -pub const NETLINK_SOCK_DIAG: ::c_int = 4; -pub const NETLINK_NFLOG: ::c_int = 5; -pub const NETLINK_XFRM: ::c_int = 6; -pub const NETLINK_SELINUX: ::c_int = 7; -pub const NETLINK_ISCSI: ::c_int = 8; -pub const NETLINK_AUDIT: ::c_int = 9; -pub const NETLINK_FIB_LOOKUP: ::c_int = 10; -pub const NETLINK_CONNECTOR: ::c_int = 11; -pub const NETLINK_NETFILTER: ::c_int = 12; -pub const NETLINK_IP6_FW: ::c_int = 13; -pub const NETLINK_DNRTMSG: ::c_int = 14; -pub const NETLINK_KOBJECT_UEVENT: ::c_int = 15; -pub const NETLINK_GENERIC: ::c_int = 16; -pub const NETLINK_SCSITRANSPORT: ::c_int = 18; -pub const NETLINK_ECRYPTFS: ::c_int = 19; -pub const NETLINK_RDMA: ::c_int = 20; -pub const NETLINK_CRYPTO: ::c_int = 21; -pub const NETLINK_INET_DIAG: ::c_int = NETLINK_SOCK_DIAG; - -pub const MAX_LINKS: ::c_int = 32; - -pub const NLM_F_REQUEST: ::c_int = 1; -pub const NLM_F_MULTI: ::c_int = 2; -pub const NLM_F_ACK: ::c_int = 4; -pub const NLM_F_ECHO: ::c_int = 8; -pub const NLM_F_DUMP_INTR: ::c_int = 16; - -pub const NLM_F_ROOT: ::c_int = 0x100; -pub const NLM_F_MATCH: ::c_int = 0x200; -pub const NLM_F_ATOMIC: ::c_int = 0x400; -pub const NLM_F_DUMP: ::c_int = NLM_F_ROOT | NLM_F_MATCH; - -pub const NLM_F_REPLACE: ::c_int = 0x100; -pub const NLM_F_EXCL: ::c_int = 0x200; -pub const NLM_F_CREATE: ::c_int = 0x400; -pub const NLM_F_APPEND: ::c_int = 0x800; - -pub const NLMSG_NOOP: ::c_int = 0x1; -pub const NLMSG_ERROR: ::c_int = 0x2; -pub const NLMSG_DONE: ::c_int = 0x3; -pub const NLMSG_OVERRUN: ::c_int = 0x4; -pub const NLMSG_MIN_TYPE: ::c_int = 0x10; - -pub const GENL_NAMSIZ: ::c_int = 16; - -pub const GENL_MIN_ID: ::c_int = NLMSG_MIN_TYPE; -pub const GENL_MAX_ID: ::c_int = 1023; - -pub const GENL_ADMIN_PERM: ::c_int = 0x01; -pub const GENL_CMD_CAP_DO: ::c_int = 0x02; -pub const GENL_CMD_CAP_DUMP: ::c_int = 0x04; -pub const GENL_CMD_CAP_HASPOL: ::c_int = 0x08; -pub const GENL_UNS_ADMIN_PERM: ::c_int = 0x10; - -pub const GENL_ID_CTRL: ::c_int = NLMSG_MIN_TYPE; -pub const GENL_ID_VFS_DQUOT: ::c_int = NLMSG_MIN_TYPE + 1; -pub const GENL_ID_PMCRAID: ::c_int = NLMSG_MIN_TYPE + 2; - -pub const CTRL_CMD_UNSPEC: ::c_int = 0; -pub const CTRL_CMD_NEWFAMILY: ::c_int = 1; -pub const CTRL_CMD_DELFAMILY: ::c_int = 2; -pub const CTRL_CMD_GETFAMILY: ::c_int = 3; -pub const CTRL_CMD_NEWOPS: ::c_int = 4; -pub const CTRL_CMD_DELOPS: ::c_int = 5; -pub const CTRL_CMD_GETOPS: ::c_int = 6; -pub const CTRL_CMD_NEWMCAST_GRP: ::c_int = 7; -pub const CTRL_CMD_DELMCAST_GRP: ::c_int = 8; -pub const CTRL_CMD_GETMCAST_GRP: ::c_int = 9; - -pub const CTRL_ATTR_UNSPEC: ::c_int = 0; -pub const CTRL_ATTR_FAMILY_ID: ::c_int = 1; -pub const CTRL_ATTR_FAMILY_NAME: ::c_int = 2; -pub const CTRL_ATTR_VERSION: ::c_int = 3; -pub const CTRL_ATTR_HDRSIZE: ::c_int = 4; -pub const CTRL_ATTR_MAXATTR: ::c_int = 5; -pub const CTRL_ATTR_OPS: ::c_int = 6; -pub const CTRL_ATTR_MCAST_GROUPS: ::c_int = 7; - -pub const CTRL_ATTR_OP_UNSPEC: ::c_int = 0; -pub const CTRL_ATTR_OP_ID: ::c_int = 1; -pub const CTRL_ATTR_OP_FLAGS: ::c_int = 2; - -pub const CTRL_ATTR_MCAST_GRP_UNSPEC: ::c_int = 0; -pub const CTRL_ATTR_MCAST_GRP_NAME: ::c_int = 1; -pub const CTRL_ATTR_MCAST_GRP_ID: ::c_int = 2; - -pub const NETLINK_ADD_MEMBERSHIP: ::c_int = 1; -pub const NETLINK_DROP_MEMBERSHIP: ::c_int = 2; -pub const NETLINK_PKTINFO: ::c_int = 3; -pub const NETLINK_BROADCAST_ERROR: ::c_int = 4; -pub const NETLINK_NO_ENOBUFS: ::c_int = 5; -pub const NETLINK_RX_RING: ::c_int = 6; -pub const NETLINK_TX_RING: ::c_int = 7; - -pub const GRND_NONBLOCK: ::c_uint = 0x0001; -pub const GRND_RANDOM: ::c_uint = 0x0002; - -pub const SECCOMP_MODE_DISABLED: ::c_uint = 0; -pub const SECCOMP_MODE_STRICT: ::c_uint = 1; -pub const SECCOMP_MODE_FILTER: ::c_uint = 2; - -pub const NLA_F_NESTED: ::c_int = 1 << 15; -pub const NLA_F_NET_BYTEORDER: ::c_int = 1 << 14; -pub const NLA_TYPE_MASK: ::c_int = !(NLA_F_NESTED | NLA_F_NET_BYTEORDER); - -pub const NLA_ALIGNTO: ::c_int = 4; - -pub const SIGEV_THREAD_ID: ::c_int = 4; - -pub const CIBAUD: ::tcflag_t = 0o02003600000; -pub const CBAUDEX: ::tcflag_t = 0o010000; - -pub const TIOCM_LE: ::c_int = 0x001; -pub const TIOCM_DTR: ::c_int = 0x002; -pub const TIOCM_RTS: ::c_int = 0x004; -pub const TIOCM_ST: ::c_int = 0x008; -pub const TIOCM_SR: ::c_int = 0x010; -pub const TIOCM_CTS: ::c_int = 0x020; -pub const TIOCM_CAR: ::c_int = 0x040; -pub const TIOCM_RNG: ::c_int = 0x080; -pub const TIOCM_DSR: ::c_int = 0x100; -pub const TIOCM_CD: ::c_int = TIOCM_CAR; -pub const TIOCM_RI: ::c_int = TIOCM_RNG; - -pub const POLLWRNORM: ::c_short = 0x100; -pub const POLLWRBAND: ::c_short = 0x200; - -pub const SFD_CLOEXEC: ::c_int = O_CLOEXEC; -pub const SFD_NONBLOCK: ::c_int = O_NONBLOCK; - -pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK; - -pub const SO_ORIGINAL_DST: ::c_int = 80; -pub const IP_ORIGDSTADDR : ::c_int = 20; -pub const IP_RECVORIGDSTADDR : ::c_int = IP_ORIGDSTADDR; -pub const IPV6_ORIGDSTADDR : ::c_int = 74; -pub const IPV6_RECVORIGDSTADDR : ::c_int = IPV6_ORIGDSTADDR; -pub const IPV6_FLOWINFO: ::c_int = 11; -pub const IPV6_FLOWLABEL_MGR: ::c_int = 32; -pub const IPV6_FLOWINFO_SEND: ::c_int = 33; -pub const IPV6_FLOWINFO_FLOWLABEL: ::c_int = 0x000fffff; -pub const IPV6_FLOWINFO_PRIORITY: ::c_int = 0x0ff00000; -pub const IUTF8: ::tcflag_t = 0x00004000; -pub const CMSPAR: ::tcflag_t = 0o10000000000; -pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; - -pub const MFD_CLOEXEC: ::c_uint = 0x0001; -pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002; -pub const MFD_HUGETLB: ::c_uint = 0x0004; - -// linux/netfilter.h -pub const NF_DROP: ::c_int = 0; -pub const NF_ACCEPT: ::c_int = 1; -pub const NF_STOLEN: ::c_int = 2; -pub const NF_QUEUE: ::c_int = 3; -pub const NF_REPEAT: ::c_int = 4; -pub const NF_STOP: ::c_int = 5; -pub const NF_MAX_VERDICT: ::c_int = NF_STOP; - -pub const NF_VERDICT_MASK: ::c_int = 0x000000ff; -pub const NF_VERDICT_FLAG_QUEUE_BYPASS: ::c_int = 0x00008000; - -pub const NF_VERDICT_QMASK: ::c_int = 0xffff0000; -pub const NF_VERDICT_QBITS: ::c_int = 16; - -pub const NF_VERDICT_BITS: ::c_int = 16; - -pub const NF_INET_PRE_ROUTING: ::c_int = 0; -pub const NF_INET_LOCAL_IN: ::c_int = 1; -pub const NF_INET_FORWARD: ::c_int = 2; -pub const NF_INET_LOCAL_OUT: ::c_int = 3; -pub const NF_INET_POST_ROUTING: ::c_int = 4; -pub const NF_INET_NUMHOOKS: ::c_int = 5; - -pub const NF_NETDEV_INGRESS: ::c_int = 0; -pub const NF_NETDEV_NUMHOOKS: ::c_int = 1; - -pub const NFPROTO_UNSPEC: ::c_int = 0; -pub const NFPROTO_INET: ::c_int = 1; -pub const NFPROTO_IPV4: ::c_int = 2; -pub const NFPROTO_ARP: ::c_int = 3; -pub const NFPROTO_NETDEV: ::c_int = 5; -pub const NFPROTO_BRIDGE: ::c_int = 7; -pub const NFPROTO_IPV6: ::c_int = 10; -pub const NFPROTO_DECNET: ::c_int = 12; -pub const NFPROTO_NUMPROTO: ::c_int = 13; - -// linux/netfilter_ipv4.h -pub const NF_IP_PRE_ROUTING: ::c_int = 0; -pub const NF_IP_LOCAL_IN: ::c_int = 1; -pub const NF_IP_FORWARD: ::c_int = 2; -pub const NF_IP_LOCAL_OUT: ::c_int = 3; -pub const NF_IP_POST_ROUTING: ::c_int = 4; -pub const NF_IP_NUMHOOKS: ::c_int = 5; - -pub const NF_IP_PRI_FIRST: ::c_int = ::INT_MIN; -pub const NF_IP_PRI_CONNTRACK_DEFRAG: ::c_int = -400; -pub const NF_IP_PRI_RAW: ::c_int = -300; -pub const NF_IP_PRI_SELINUX_FIRST: ::c_int = -225; -pub const NF_IP_PRI_CONNTRACK: ::c_int = -200; -pub const NF_IP_PRI_MANGLE: ::c_int = -150; -pub const NF_IP_PRI_NAT_DST: ::c_int = -100; -pub const NF_IP_PRI_FILTER: ::c_int = 0; -pub const NF_IP_PRI_SECURITY: ::c_int = 50; -pub const NF_IP_PRI_NAT_SRC: ::c_int = 100; -pub const NF_IP_PRI_SELINUX_LAST: ::c_int = 225; -pub const NF_IP_PRI_CONNTRACK_HELPER: ::c_int = 300; -pub const NF_IP_PRI_CONNTRACK_CONFIRM: ::c_int = ::INT_MAX; -pub const NF_IP_PRI_LAST: ::c_int = ::INT_MAX; - -// linux/netfilter_ipv6.h -pub const NF_IP6_PRE_ROUTING: ::c_int = 0; -pub const NF_IP6_LOCAL_IN: ::c_int = 1; -pub const NF_IP6_FORWARD: ::c_int = 2; -pub const NF_IP6_LOCAL_OUT: ::c_int = 3; -pub const NF_IP6_POST_ROUTING: ::c_int = 4; -pub const NF_IP6_NUMHOOKS: ::c_int = 5; - -pub const NF_IP6_PRI_FIRST: ::c_int = ::INT_MIN; -pub const NF_IP6_PRI_CONNTRACK_DEFRAG: ::c_int = -400; -pub const NF_IP6_PRI_RAW: ::c_int = -300; -pub const NF_IP6_PRI_SELINUX_FIRST: ::c_int = -225; -pub const NF_IP6_PRI_CONNTRACK: ::c_int = -200; -pub const NF_IP6_PRI_MANGLE: ::c_int = -150; -pub const NF_IP6_PRI_NAT_DST: ::c_int = -100; -pub const NF_IP6_PRI_FILTER: ::c_int = 0; -pub const NF_IP6_PRI_SECURITY: ::c_int = 50; -pub const NF_IP6_PRI_NAT_SRC: ::c_int = 100; -pub const NF_IP6_PRI_SELINUX_LAST: ::c_int = 225; -pub const NF_IP6_PRI_CONNTRACK_HELPER: ::c_int = 300; -pub const NF_IP6_PRI_LAST: ::c_int = ::INT_MAX; - -// linux/netfilter/nf_tables.h -pub const NFT_TABLE_MAXNAMELEN: ::c_int = 32; -pub const NFT_CHAIN_MAXNAMELEN: ::c_int = 32; -pub const NFT_SET_MAXNAMELEN: ::c_int = 32; -pub const NFT_OBJ_MAXNAMELEN: ::c_int = 32; -pub const NFT_USERDATA_MAXLEN: ::c_int = 256; - -pub const NFT_REG_VERDICT: ::c_int = 0; -pub const NFT_REG_1: ::c_int = 1; -pub const NFT_REG_2: ::c_int = 2; -pub const NFT_REG_3: ::c_int = 3; -pub const NFT_REG_4: ::c_int = 4; -pub const __NFT_REG_MAX: ::c_int = 5; -pub const NFT_REG32_00: ::c_int = 8; -pub const NFT_REG32_01: ::c_int = 9; -pub const NFT_REG32_02: ::c_int = 10; -pub const NFT_REG32_03: ::c_int = 11; -pub const NFT_REG32_04: ::c_int = 12; -pub const NFT_REG32_05: ::c_int = 13; -pub const NFT_REG32_06: ::c_int = 14; -pub const NFT_REG32_07: ::c_int = 15; -pub const NFT_REG32_08: ::c_int = 16; -pub const NFT_REG32_09: ::c_int = 17; -pub const NFT_REG32_10: ::c_int = 18; -pub const NFT_REG32_11: ::c_int = 19; -pub const NFT_REG32_12: ::c_int = 20; -pub const NFT_REG32_13: ::c_int = 21; -pub const NFT_REG32_14: ::c_int = 22; -pub const NFT_REG32_15: ::c_int = 23; - -pub const NFT_REG_SIZE: ::c_int = 16; -pub const NFT_REG32_SIZE: ::c_int = 4; - -pub const NFT_CONTINUE: ::c_int = -1; -pub const NFT_BREAK: ::c_int = -2; -pub const NFT_JUMP: ::c_int = -3; -pub const NFT_GOTO: ::c_int = -4; -pub const NFT_RETURN: ::c_int = -5; - -pub const NFT_MSG_NEWTABLE: ::c_int = 0; -pub const NFT_MSG_GETTABLE: ::c_int = 1; -pub const NFT_MSG_DELTABLE: ::c_int = 2; -pub const NFT_MSG_NEWCHAIN: ::c_int = 3; -pub const NFT_MSG_GETCHAIN: ::c_int = 4; -pub const NFT_MSG_DELCHAIN: ::c_int = 5; -pub const NFT_MSG_NEWRULE: ::c_int = 6; -pub const NFT_MSG_GETRULE: ::c_int = 7; -pub const NFT_MSG_DELRULE: ::c_int = 8; -pub const NFT_MSG_NEWSET: ::c_int = 9; -pub const NFT_MSG_GETSET: ::c_int = 10; -pub const NFT_MSG_DELSET: ::c_int = 11; -pub const NFT_MSG_NEWSETELEM: ::c_int = 12; -pub const NFT_MSG_GETSETELEM: ::c_int = 13; -pub const NFT_MSG_DELSETELEM: ::c_int = 14; -pub const NFT_MSG_NEWGEN: ::c_int = 15; -pub const NFT_MSG_GETGEN: ::c_int = 16; -pub const NFT_MSG_TRACE: ::c_int = 17; -pub const NFT_MSG_NEWOBJ: ::c_int = 18; -pub const NFT_MSG_GETOBJ: ::c_int = 19; -pub const NFT_MSG_DELOBJ: ::c_int = 20; -pub const NFT_MSG_GETOBJ_RESET: ::c_int = 21; -pub const NFT_MSG_MAX: ::c_int = 22; - -pub const NFT_SET_ANONYMOUS: ::c_int = 0x1; -pub const NFT_SET_CONSTANT: ::c_int = 0x2; -pub const NFT_SET_INTERVAL: ::c_int = 0x4; -pub const NFT_SET_MAP: ::c_int = 0x8; -pub const NFT_SET_TIMEOUT: ::c_int = 0x10; -pub const NFT_SET_EVAL: ::c_int = 0x20; - -pub const NFT_SET_POL_PERFORMANCE: ::c_int = 0; -pub const NFT_SET_POL_MEMORY: ::c_int = 1; - -pub const NFT_SET_ELEM_INTERVAL_END: ::c_int = 0x1; - -pub const NFT_DATA_VALUE: ::c_uint = 0; -pub const NFT_DATA_VERDICT: ::c_uint = 0xffffff00; - -pub const NFT_DATA_RESERVED_MASK: ::c_uint = 0xffffff00; - -pub const NFT_DATA_VALUE_MAXLEN: ::c_int = 64; - -pub const NFT_BYTEORDER_NTOH: ::c_int = 0; -pub const NFT_BYTEORDER_HTON: ::c_int = 1; - -pub const NFT_CMP_EQ: ::c_int = 0; -pub const NFT_CMP_NEQ: ::c_int = 1; -pub const NFT_CMP_LT: ::c_int = 2; -pub const NFT_CMP_LTE: ::c_int = 3; -pub const NFT_CMP_GT: ::c_int = 4; -pub const NFT_CMP_GTE: ::c_int = 5; - -pub const NFT_RANGE_EQ: ::c_int = 0; -pub const NFT_RANGE_NEQ: ::c_int = 1; - -pub const NFT_LOOKUP_F_INV: ::c_int = (1 << 0); - -pub const NFT_DYNSET_OP_ADD: ::c_int = 0; -pub const NFT_DYNSET_OP_UPDATE: ::c_int = 1; - -pub const NFT_DYNSET_F_INV: ::c_int = (1 << 0); - -pub const NFT_PAYLOAD_LL_HEADER: ::c_int = 0; -pub const NFT_PAYLOAD_NETWORK_HEADER: ::c_int = 1; -pub const NFT_PAYLOAD_TRANSPORT_HEADER: ::c_int = 2; - -pub const NFT_PAYLOAD_CSUM_NONE: ::c_int = 0; -pub const NFT_PAYLOAD_CSUM_INET: ::c_int = 1; - -pub const NFT_META_LEN: ::c_int = 0; -pub const NFT_META_PROTOCOL: ::c_int = 1; -pub const NFT_META_PRIORITY: ::c_int = 2; -pub const NFT_META_MARK: ::c_int = 3; -pub const NFT_META_IIF: ::c_int = 4; -pub const NFT_META_OIF: ::c_int = 5; -pub const NFT_META_IIFNAME: ::c_int = 6; -pub const NFT_META_OIFNAME: ::c_int = 7; -pub const NFT_META_IIFTYPE: ::c_int = 8; -pub const NFT_META_OIFTYPE: ::c_int = 9; -pub const NFT_META_SKUID: ::c_int = 10; -pub const NFT_META_SKGID: ::c_int = 11; -pub const NFT_META_NFTRACE: ::c_int = 12; -pub const NFT_META_RTCLASSID: ::c_int = 13; -pub const NFT_META_SECMARK: ::c_int = 14; -pub const NFT_META_NFPROTO: ::c_int = 15; -pub const NFT_META_L4PROTO: ::c_int = 16; -pub const NFT_META_BRI_IIFNAME: ::c_int = 17; -pub const NFT_META_BRI_OIFNAME: ::c_int = 18; -pub const NFT_META_PKTTYPE: ::c_int = 19; -pub const NFT_META_CPU: ::c_int = 20; -pub const NFT_META_IIFGROUP: ::c_int = 21; -pub const NFT_META_OIFGROUP: ::c_int = 22; -pub const NFT_META_CGROUP: ::c_int = 23; -pub const NFT_META_PRANDOM: ::c_int = 24; - -pub const NFT_CT_STATE: ::c_int = 0; -pub const NFT_CT_DIRECTION: ::c_int = 1; -pub const NFT_CT_STATUS: ::c_int = 2; -pub const NFT_CT_MARK: ::c_int = 3; -pub const NFT_CT_SECMARK: ::c_int = 4; -pub const NFT_CT_EXPIRATION: ::c_int = 5; -pub const NFT_CT_HELPER: ::c_int = 6; -pub const NFT_CT_L3PROTOCOL: ::c_int = 7; -pub const NFT_CT_SRC: ::c_int = 8; -pub const NFT_CT_DST: ::c_int = 9; -pub const NFT_CT_PROTOCOL: ::c_int = 10; -pub const NFT_CT_PROTO_SRC: ::c_int = 11; -pub const NFT_CT_PROTO_DST: ::c_int = 12; -pub const NFT_CT_LABELS: ::c_int = 13; -pub const NFT_CT_PKTS: ::c_int = 14; -pub const NFT_CT_BYTES: ::c_int = 15; - -pub const NFT_LIMIT_PKTS: ::c_int = 0; -pub const NFT_LIMIT_PKT_BYTES: ::c_int = 1; - -pub const NFT_LIMIT_F_INV: ::c_int = (1 << 0); - -pub const NFT_QUEUE_FLAG_BYPASS: ::c_int = 0x01; -pub const NFT_QUEUE_FLAG_CPU_FANOUT: ::c_int = 0x02; -pub const NFT_QUEUE_FLAG_MASK: ::c_int = 0x03; - -pub const NFT_QUOTA_F_INV: ::c_int = (1 << 0); - -pub const NFT_REJECT_ICMP_UNREACH: ::c_int = 0; -pub const NFT_REJECT_TCP_RST: ::c_int = 1; -pub const NFT_REJECT_ICMPX_UNREACH: ::c_int = 2; - -pub const NFT_REJECT_ICMPX_NO_ROUTE: ::c_int = 0; -pub const NFT_REJECT_ICMPX_PORT_UNREACH: ::c_int = 1; -pub const NFT_REJECT_ICMPX_HOST_UNREACH: ::c_int = 2; -pub const NFT_REJECT_ICMPX_ADMIN_PROHIBITED: ::c_int = 3; - -pub const NFT_NAT_SNAT: ::c_int = 0; -pub const NFT_NAT_DNAT: ::c_int = 1; - -pub const NFT_TRACETYPE_UNSPEC: ::c_int = 0; -pub const NFT_TRACETYPE_POLICY: ::c_int = 1; -pub const NFT_TRACETYPE_RETURN: ::c_int = 2; -pub const NFT_TRACETYPE_RULE: ::c_int = 3; - -pub const NFT_NG_INCREMENTAL: ::c_int = 0; -pub const NFT_NG_RANDOM: ::c_int = 1; - -pub const IFF_TUN: ::c_int = 0x0001; -pub const IFF_TAP: ::c_int = 0x0002; -pub const IFF_NO_PI: ::c_int = 0x1000; - -// start android/platform/bionic/libc/kernel/uapi/linux/if_ether.h -// from https://android.googlesource.com/ -// platform/bionic/+/master/libc/kernel/uapi/linux/if_ether.h -pub const ETH_ALEN: ::c_int = 6; -pub const ETH_HLEN: ::c_int = 14; -pub const ETH_ZLEN: ::c_int = 60; -pub const ETH_DATA_LEN: ::c_int = 1500; -pub const ETH_FRAME_LEN: ::c_int = 1514; -pub const ETH_FCS_LEN: ::c_int = 4; -pub const ETH_MIN_MTU: ::c_int = 68; -pub const ETH_MAX_MTU: ::c_int = 0xFFFF; -pub const ETH_P_LOOP: ::c_int = 0x0060; -pub const ETH_P_PUP: ::c_int = 0x0200; -pub const ETH_P_PUPAT: ::c_int = 0x0201; -pub const ETH_P_TSN: ::c_int = 0x22F0; -pub const ETH_P_IP: ::c_int = 0x0800; -pub const ETH_P_X25: ::c_int = 0x0805; -pub const ETH_P_ARP: ::c_int = 0x0806; -pub const ETH_P_BPQ: ::c_int = 0x08FF; -pub const ETH_P_IEEEPUP: ::c_int = 0x0a00; -pub const ETH_P_IEEEPUPAT: ::c_int = 0x0a01; -pub const ETH_P_BATMAN: ::c_int = 0x4305; -pub const ETH_P_DEC: ::c_int = 0x6000; -pub const ETH_P_DNA_DL: ::c_int = 0x6001; -pub const ETH_P_DNA_RC: ::c_int = 0x6002; -pub const ETH_P_DNA_RT: ::c_int = 0x6003; -pub const ETH_P_LAT: ::c_int = 0x6004; -pub const ETH_P_DIAG: ::c_int = 0x6005; -pub const ETH_P_CUST: ::c_int = 0x6006; -pub const ETH_P_SCA: ::c_int = 0x6007; -pub const ETH_P_TEB: ::c_int = 0x6558; -pub const ETH_P_RARP: ::c_int = 0x8035; -pub const ETH_P_ATALK: ::c_int = 0x809B; -pub const ETH_P_AARP: ::c_int = 0x80F3; -pub const ETH_P_8021Q: ::c_int = 0x8100; -/* see rust-lang/libc#924 pub const ETH_P_ERSPAN: ::c_int = 0x88BE;*/ -pub const ETH_P_IPX: ::c_int = 0x8137; -pub const ETH_P_IPV6: ::c_int = 0x86DD; -pub const ETH_P_PAUSE: ::c_int = 0x8808; -pub const ETH_P_SLOW: ::c_int = 0x8809; -pub const ETH_P_WCCP: ::c_int = 0x883E; -pub const ETH_P_MPLS_UC: ::c_int = 0x8847; -pub const ETH_P_MPLS_MC: ::c_int = 0x8848; -pub const ETH_P_ATMMPOA: ::c_int = 0x884c; -pub const ETH_P_PPP_DISC: ::c_int = 0x8863; -pub const ETH_P_PPP_SES: ::c_int = 0x8864; -pub const ETH_P_LINK_CTL: ::c_int = 0x886c; -pub const ETH_P_ATMFATE: ::c_int = 0x8884; -pub const ETH_P_PAE: ::c_int = 0x888E; -pub const ETH_P_AOE: ::c_int = 0x88A2; -pub const ETH_P_8021AD: ::c_int = 0x88A8; -pub const ETH_P_802_EX1: ::c_int = 0x88B5; -pub const ETH_P_TIPC: ::c_int = 0x88CA; -pub const ETH_P_MACSEC: ::c_int = 0x88E5; -pub const ETH_P_8021AH: ::c_int = 0x88E7; -pub const ETH_P_MVRP: ::c_int = 0x88F5; -pub const ETH_P_1588: ::c_int = 0x88F7; -pub const ETH_P_NCSI: ::c_int = 0x88F8; -pub const ETH_P_PRP: ::c_int = 0x88FB; -pub const ETH_P_FCOE: ::c_int = 0x8906; -/* see rust-lang/libc#924 pub const ETH_P_IBOE: ::c_int = 0x8915;*/ -pub const ETH_P_TDLS: ::c_int = 0x890D; -pub const ETH_P_FIP: ::c_int = 0x8914; -pub const ETH_P_80221: ::c_int = 0x8917; -pub const ETH_P_HSR: ::c_int = 0x892F; -/* see rust-lang/libc#924 pub const ETH_P_NSH: ::c_int = 0x894F;*/ -pub const ETH_P_LOOPBACK: ::c_int = 0x9000; -pub const ETH_P_QINQ1: ::c_int = 0x9100; -pub const ETH_P_QINQ2: ::c_int = 0x9200; -pub const ETH_P_QINQ3: ::c_int = 0x9300; -pub const ETH_P_EDSA: ::c_int = 0xDADA; -/* see rust-lang/libc#924 pub const ETH_P_IFE: ::c_int = 0xED3E;*/ -pub const ETH_P_AF_IUCV: ::c_int = 0xFBFB; -pub const ETH_P_802_3_MIN: ::c_int = 0x0600; -pub const ETH_P_802_3: ::c_int = 0x0001; -pub const ETH_P_AX25: ::c_int = 0x0002; -pub const ETH_P_ALL: ::c_int = 0x0003; -pub const ETH_P_802_2: ::c_int = 0x0004; -pub const ETH_P_SNAP: ::c_int = 0x0005; -pub const ETH_P_DDCMP: ::c_int = 0x0006; -pub const ETH_P_WAN_PPP: ::c_int = 0x0007; -pub const ETH_P_PPP_MP: ::c_int = 0x0008; -pub const ETH_P_LOCALTALK: ::c_int = 0x0009; -pub const ETH_P_CAN: ::c_int = 0x000C; -pub const ETH_P_CANFD: ::c_int = 0x000D; -pub const ETH_P_PPPTALK: ::c_int = 0x0010; -pub const ETH_P_TR_802_2: ::c_int = 0x0011; -pub const ETH_P_MOBITEX: ::c_int = 0x0015; -pub const ETH_P_CONTROL: ::c_int = 0x0016; -pub const ETH_P_IRDA: ::c_int = 0x0017; -pub const ETH_P_ECONET: ::c_int = 0x0018; -pub const ETH_P_HDLC: ::c_int = 0x0019; -pub const ETH_P_ARCNET: ::c_int = 0x001A; -pub const ETH_P_DSA: ::c_int = 0x001B; -pub const ETH_P_TRAILER: ::c_int = 0x001C; -pub const ETH_P_PHONET: ::c_int = 0x00F5; -pub const ETH_P_IEEE802154: ::c_int = 0x00F6; -pub const ETH_P_CAIF: ::c_int = 0x00F7; -pub const ETH_P_XDSA: ::c_int = 0x00F8; -/* see rust-lang/libc#924 pub const ETH_P_MAP: ::c_int = 0x00F9;*/ -// end android/platform/bionic/libc/kernel/uapi/linux/if_ether.h - -pub const SIOCADDRT: ::c_ulong = 0x0000890B; -pub const SIOCDELRT: ::c_ulong = 0x0000890C; -pub const SIOCGIFNAME: ::c_ulong = 0x00008910; -pub const SIOCSIFLINK: ::c_ulong = 0x00008911; -pub const SIOCGIFCONF: ::c_ulong = 0x00008912; -pub const SIOCGIFFLAGS: ::c_ulong = 0x00008913; -pub const SIOCSIFFLAGS: ::c_ulong = 0x00008914; -pub const SIOCGIFADDR: ::c_ulong = 0x00008915; -pub const SIOCSIFADDR: ::c_ulong = 0x00008916; -pub const SIOCGIFDSTADDR: ::c_ulong = 0x00008917; -pub const SIOCSIFDSTADDR: ::c_ulong = 0x00008918; -pub const SIOCGIFBRDADDR: ::c_ulong = 0x00008919; -pub const SIOCSIFBRDADDR: ::c_ulong = 0x0000891A; -pub const SIOCGIFNETMASK: ::c_ulong = 0x0000891B; -pub const SIOCSIFNETMASK: ::c_ulong = 0x0000891C; -pub const SIOCGIFMETRIC: ::c_ulong = 0x0000891D; -pub const SIOCSIFMETRIC: ::c_ulong = 0x0000891E; -pub const SIOCGIFMEM: ::c_ulong = 0x0000891F; -pub const SIOCSIFMEM: ::c_ulong = 0x00008920; -pub const SIOCGIFMTU: ::c_ulong = 0x00008921; -pub const SIOCSIFMTU: ::c_ulong = 0x00008922; -pub const SIOCSIFHWADDR: ::c_ulong = 0x00008924; -pub const SIOCGIFENCAP: ::c_ulong = 0x00008925; -pub const SIOCSIFENCAP: ::c_ulong = 0x00008926; -pub const SIOCGIFHWADDR: ::c_ulong = 0x00008927; -pub const SIOCGIFSLAVE: ::c_ulong = 0x00008929; -pub const SIOCSIFSLAVE: ::c_ulong = 0x00008930; -pub const SIOCADDMULTI: ::c_ulong = 0x00008931; -pub const SIOCDELMULTI: ::c_ulong = 0x00008932; -pub const SIOCDARP: ::c_ulong = 0x00008953; -pub const SIOCGARP: ::c_ulong = 0x00008954; -pub const SIOCSARP: ::c_ulong = 0x00008955; -pub const SIOCDRARP: ::c_ulong = 0x00008960; -pub const SIOCGRARP: ::c_ulong = 0x00008961; -pub const SIOCSRARP: ::c_ulong = 0x00008962; -pub const SIOCGIFMAP: ::c_ulong = 0x00008970; -pub const SIOCSIFMAP: ::c_ulong = 0x00008971; - -// linux/module.h -pub const MODULE_INIT_IGNORE_MODVERSIONS: ::c_uint = 0x0001; -pub const MODULE_INIT_IGNORE_VERMAGIC: ::c_uint = 0x0002; - -// Similarity to Linux it's not used but defined for compatibility. -pub const ENOATTR: ::c_int = ::ENODATA; - -// linux/if_alg.h -pub const ALG_SET_KEY: ::c_int = 1; -pub const ALG_SET_IV: ::c_int = 2; -pub const ALG_SET_OP: ::c_int = 3; -pub const ALG_SET_AEAD_ASSOCLEN: ::c_int = 4; -pub const ALG_SET_AEAD_AUTHSIZE: ::c_int = 5; - -pub const ALG_OP_DECRYPT: ::c_int = 0; -pub const ALG_OP_ENCRYPT: ::c_int = 1; - -// uapi/linux/inotify.h -pub const IN_ACCESS: ::uint32_t = 0x0000_0001; -pub const IN_MODIFY: ::uint32_t = 0x0000_0002; -pub const IN_ATTRIB: ::uint32_t = 0x0000_0004; -pub const IN_CLOSE_WRITE: ::uint32_t = 0x0000_0008; -pub const IN_CLOSE_NOWRITE: ::uint32_t = 0x0000_0010; -pub const IN_CLOSE: ::uint32_t = (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE); -pub const IN_OPEN: ::uint32_t = 0x0000_0020; -pub const IN_MOVED_FROM: ::uint32_t = 0x0000_0040; -pub const IN_MOVED_TO: ::uint32_t = 0x0000_0080; -pub const IN_MOVE: ::uint32_t = (IN_MOVED_FROM | IN_MOVED_TO); -pub const IN_CREATE: ::uint32_t = 0x0000_0100; -pub const IN_DELETE: ::uint32_t = 0x0000_0200; -pub const IN_DELETE_SELF: ::uint32_t = 0x0000_0400; -pub const IN_MOVE_SELF: ::uint32_t = 0x0000_0800; -pub const IN_UNMOUNT: ::uint32_t = 0x0000_2000; -pub const IN_Q_OVERFLOW: ::uint32_t = 0x0000_4000; -pub const IN_IGNORED: ::uint32_t = 0x0000_8000; -pub const IN_ONLYDIR: ::uint32_t = 0x0100_0000; -pub const IN_DONT_FOLLOW: ::uint32_t = 0x0200_0000; -// pub const IN_EXCL_UNLINK: ::uint32_t = 0x0400_0000; - -// pub const IN_MASK_CREATE: ::uint32_t = 0x1000_0000; -// pub const IN_MASK_ADD: ::uint32_t = 0x2000_0000; -pub const IN_ISDIR: ::uint32_t = 0x4000_0000; -pub const IN_ONESHOT: ::uint32_t = 0x8000_0000; - -pub const IN_ALL_EVENTS: ::uint32_t = ( - IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | - IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | - IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | - IN_MOVE_SELF -); - -pub const IN_CLOEXEC: ::c_int = O_CLOEXEC; -pub const IN_NONBLOCK: ::c_int = O_NONBLOCK; - -f! { - pub fn CMSG_NXTHDR(mhdr: *const msghdr, - cmsg: *const cmsghdr) -> *mut cmsghdr { - let next = (cmsg as usize - + super::CMSG_ALIGN((*cmsg).cmsg_len as usize)) - as *mut cmsghdr; - let max = (*mhdr).msg_control as usize - + (*mhdr).msg_controllen as usize; - if (next.offset(1)) as usize > max { - 0 as *mut cmsghdr - } else { - next as *mut cmsghdr - } - } - - pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { - for slot in cpuset.__bits.iter_mut() { - *slot = 0; - } - } - - pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in___bits = 8 * ::mem::size_of_val(&cpuset.__bits[0]); - let (idx, offset) = (cpu / size_in___bits, cpu % size_in___bits); - cpuset.__bits[idx] |= 1 << offset; - () - } - - pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in___bits = 8 * ::mem::size_of_val(&cpuset.__bits[0]); - let (idx, offset) = (cpu / size_in___bits, cpu % size_in___bits); - cpuset.__bits[idx] &= !(1 << offset); - () - } - - pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { - let size_in___bits = 8 * ::mem::size_of_val(&cpuset.__bits[0]); - let (idx, offset) = (cpu / size_in___bits, cpu % size_in___bits); - 0 != (cpuset.__bits[idx] & (1 << offset)) - } - - pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { - set1.__bits == set2.__bits - } - pub fn major(dev: ::dev_t) -> ::c_int { - ((dev >> 8) & 0xfff) as ::c_int - } - pub fn minor(dev: ::dev_t) -> ::c_int { - ((dev & 0xff) | ((dev >> 12) & 0xfff00)) as ::c_int - } - pub fn makedev(ma: ::c_int, mi: ::c_int) -> ::dev_t { - let ma = ma as ::dev_t; - let mi = mi as ::dev_t; - ((ma & 0xfff) << 8) | (mi & 0xff) | ((mi & 0xfff00) << 12) - } - - pub fn NLA_ALIGN(len: ::c_int) -> ::c_int { - return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1) - } -} - -extern { - static mut __progname: *mut ::c_char; -} - -extern { - pub fn madvise(addr: *const ::c_void, len: ::size_t, advice: ::c_int) - -> ::c_int; - pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; - pub fn msync(addr: *const ::c_void, len: ::size_t, - flags: ::c_int) -> ::c_int; - pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int) - -> ::c_int; - pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, - flags: ::c_int, addr: *const ::sockaddr, - addrlen: *mut ::socklen_t) -> ::ssize_t; - pub fn getnameinfo(sa: *const ::sockaddr, - salen: ::socklen_t, - host: *mut ::c_char, - hostlen: ::size_t, - serv: *mut ::c_char, - sevlen: ::size_t, - flags: ::c_int) -> ::c_int; - pub fn ptrace(request: ::c_int, ...) -> ::c_long; - pub fn getpriority(which: ::c_int, who: ::c_int) -> ::c_int; - pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int; - pub fn __sched_cpualloc(count: ::size_t) -> *mut ::cpu_set_t; - pub fn __sched_cpufree(set: *mut ::cpu_set_t); - pub fn __sched_cpucount(setsize: ::size_t, set: *mut cpu_set_t) -> ::c_int; - pub fn sched_getcpu() -> ::c_int; - - pub fn utmpname(name: *const ::c_char) -> ::c_int; - pub fn setutent(); - pub fn getutent() -> *mut utmp; - - pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, - len: ::off_t) -> ::c_int; - pub fn signalfd(fd: ::c_int, mask: *const ::sigset_t, flags: ::c_int) - -> ::c_int; - pub fn syscall(num: ::c_long, ...) -> ::c_long; - pub fn sched_getaffinity(pid: ::pid_t, - cpusetsize: ::size_t, - cpuset: *mut cpu_set_t) -> ::c_int; - pub fn sched_setaffinity(pid: ::pid_t, - cpusetsize: ::size_t, - cpuset: *const cpu_set_t) -> ::c_int; - pub fn epoll_create(size: ::c_int) -> ::c_int; - pub fn epoll_create1(flags: ::c_int) -> ::c_int; - pub fn epoll_wait(epfd: ::c_int, - events: *mut ::epoll_event, - maxevents: ::c_int, - timeout: ::c_int) -> ::c_int; - pub fn epoll_ctl(epfd: ::c_int, - op: ::c_int, - fd: ::c_int, - event: *mut ::epoll_event) -> ::c_int; - pub fn pthread_getschedparam(native: ::pthread_t, - policy: *mut ::c_int, - param: *mut ::sched_param) -> ::c_int; - pub fn unshare(flags: ::c_int) -> ::c_int; - pub fn umount(target: *const ::c_char) -> ::c_int; - pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int; - pub fn tee(fd_in: ::c_int, - fd_out: ::c_int, - len: ::size_t, - flags: ::c_uint) -> ::ssize_t; - pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int; - pub fn splice(fd_in: ::c_int, - off_in: *mut ::loff_t, - fd_out: ::c_int, - off_out: *mut ::loff_t, - len: ::size_t, - flags: ::c_uint) -> ::ssize_t; - pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; - pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int; - pub fn sem_timedwait(sem: *mut sem_t, - abstime: *const ::timespec) -> ::c_int; - pub fn sem_getvalue(sem: *mut sem_t, - sval: *mut ::c_int) -> ::c_int; - pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int; - pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int; - pub fn swapoff(puath: *const ::c_char) -> ::c_int; - pub fn vmsplice(fd: ::c_int, - iov: *const ::iovec, - nr_segs: ::size_t, - flags: ::c_uint) -> ::ssize_t; - pub fn mount(src: *const ::c_char, - target: *const ::c_char, - fstype: *const ::c_char, - flags: ::c_ulong, - data: *const ::c_void) -> ::c_int; - pub fn personality(persona: ::c_ulong) -> ::c_int; - pub fn prctl(option: ::c_int, ...) -> ::c_int; - pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int; - pub fn ppoll(fds: *mut ::pollfd, - nfds: nfds_t, - timeout: *const ::timespec, - sigmask: *const sigset_t) -> ::c_int; - pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t, - abstime: *const ::timespec) -> ::c_int; - pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int, - child_stack: *mut ::c_void, - flags: ::c_int, - arg: *mut ::c_void, ...) -> ::c_int; - pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int; - pub fn clock_nanosleep(clk_id: ::clockid_t, - flags: ::c_int, - rqtp: *const ::timespec, - rmtp: *mut ::timespec) -> ::c_int; - pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t, - guardsize: *mut ::size_t) -> ::c_int; - pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int; - pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int; - pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t, - pshared: *mut ::c_int) -> ::c_int; - pub fn sysinfo(info: *mut ::sysinfo) -> ::c_int; - pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int; - pub fn pthread_setschedparam(native: ::pthread_t, - policy: ::c_int, - param: *const ::sched_param) -> ::c_int; - pub fn swapon(path: *const ::c_char, swapflags: ::c_int) -> ::c_int; - pub fn sched_setscheduler(pid: ::pid_t, - policy: ::c_int, - param: *const ::sched_param) -> ::c_int; - pub fn sendfile(out_fd: ::c_int, - in_fd: ::c_int, - offset: *mut off_t, - count: ::size_t) -> ::ssize_t; - pub fn setfsgid(gid: ::gid_t) -> ::c_int; - pub fn setfsuid(uid: ::uid_t) -> ::c_int; - pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int; - #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")] - pub fn getgrgid_r(gid: ::gid_t, - grp: *mut ::group, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut ::group) -> ::c_int; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "sigaltstack$UNIX2003")] - #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")] - pub fn sigaltstack(ss: *const stack_t, - oss: *mut stack_t) -> ::c_int; - pub fn sem_close(sem: *mut sem_t) -> ::c_int; - pub fn getdtablesize() -> ::c_int; - #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")] - pub fn getgrnam_r(name: *const ::c_char, - grp: *mut ::group, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut ::group) -> ::c_int; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "pthread_sigmask$UNIX2003")] - pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, - oldset: *mut sigset_t) -> ::c_int; - pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t; - pub fn getgrnam(name: *const ::c_char) -> *mut ::group; - pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; - pub fn sem_unlink(name: *const ::c_char) -> ::c_int; - pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")] - pub fn getpwnam_r(name: *const ::c_char, - pwd: *mut passwd, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut passwd) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")] - pub fn getpwuid_r(uid: ::uid_t, - pwd: *mut passwd, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut passwd) -> ::c_int; - #[cfg_attr(all(target_os = "macos", target_arch ="x86"), - link_name = "sigwait$UNIX2003")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] - pub fn sigwait(set: *const sigset_t, - sig: *mut ::c_int) -> ::c_int; - pub fn pthread_atfork(prepare: ::Option, - parent: ::Option, - child: ::Option) -> ::c_int; - pub fn getgrgid(gid: ::gid_t) -> *mut ::group; - pub fn getgrouplist(user: *const ::c_char, - group: ::gid_t, - groups: *mut ::gid_t, - ngroups: *mut ::c_int) -> ::c_int; - pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int; - pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t, - pshared: *mut ::c_int) -> ::c_int; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "popen$UNIX2003")] - pub fn popen(command: *const c_char, - mode: *const c_char) -> *mut ::FILE; - pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char, - mode: ::c_int, flags: ::c_int) -> ::c_int; - pub fn pthread_create(native: *mut ::pthread_t, - attr: *const ::pthread_attr_t, - f: extern fn(*mut ::c_void) -> *mut ::c_void, - value: *mut ::c_void) -> ::c_int; - pub fn __errno() -> *mut ::c_int; - pub fn inotify_rm_watch(fd: ::c_int, wd: ::uint32_t) -> ::c_int; - pub fn sendmmsg(sockfd: ::c_int, msgvec: *const ::mmsghdr, vlen: ::c_uint, - flags: ::c_int) -> ::c_int; - pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, - flags: ::c_int, timeout: *const ::timespec) -> ::c_int; - pub fn inotify_init() -> ::c_int; - pub fn inotify_init1(flags: ::c_int) -> ::c_int; - pub fn inotify_add_watch(fd: ::c_int, - path: *const ::c_char, - mask: ::uint32_t) -> ::c_int; -} - -cfg_if! { - if #[cfg(target_pointer_width = "32")] { - mod b32; - pub use self::b32::*; - } else if #[cfg(target_pointer_width = "64")] { - mod b64; - pub use self::b64::*; - } else { - // Unknown target_pointer_width - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/emscripten/align.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/emscripten/align.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/emscripten/align.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/emscripten/align.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -macro_rules! expand_align { - () => { - s! { - #[repr(align(4))] - pub struct pthread_mutex_t { - size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], - } - - #[repr(align(4))] - pub struct pthread_rwlock_t { - size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], - } - - #[repr(align(4))] - pub struct pthread_mutexattr_t { - size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], - } - - #[repr(align(4))] - pub struct pthread_rwlockattr_t { - size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T], - } - - #[repr(align(4))] - pub struct pthread_condattr_t { - size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], - } - } - - s_no_extra_traits! { - #[cfg_attr(target_pointer_width = "32", - repr(align(4)))] - #[cfg_attr(target_pointer_width = "64", - repr(align(8)))] - pub struct pthread_cond_t { - size: [u8; ::__SIZEOF_PTHREAD_COND_T], - } - } - - cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for pthread_cond_t { - fn eq(&self, other: &pthread_cond_t) -> bool { - self.size - .iter() - .zip(other.size.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for pthread_cond_t {} - impl ::fmt::Debug for pthread_cond_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_cond_t") - // FIXME: .field("size", &self.size) - .finish() - } - } - impl ::hash::Hash for pthread_cond_t { - fn hash(&self, state: &mut H) { - self.size.hash(state); - } - } - } - } - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/emscripten/mod.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/emscripten/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/emscripten/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/emscripten/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,1802 +0,0 @@ -pub type c_char = i8; -pub type wchar_t = i32; -pub type useconds_t = u32; -pub type dev_t = u32; -pub type socklen_t = u32; -pub type pthread_t = c_ulong; -pub type mode_t = u32; -pub type ino64_t = u32; -pub type off64_t = i32; -pub type blkcnt64_t = i32; -pub type rlim64_t = u64; -pub type shmatt_t = ::c_ulong; -pub type mqd_t = ::c_int; -pub type msgqnum_t = ::c_ulong; -pub type msglen_t = ::c_ulong; -pub type nfds_t = ::c_ulong; -pub type nl_item = ::c_int; -pub type idtype_t = ::c_uint; -pub type loff_t = i32; - -pub type clock_t = c_long; -pub type time_t = c_long; -pub type suseconds_t = c_long; -pub type ino_t = u32; -pub type off_t = i32; -pub type blkcnt_t = i32; - -pub type blksize_t = c_long; -pub type fsblkcnt_t = u32; -pub type fsfilcnt_t = u32; -pub type rlim_t = ::c_ulonglong; -pub type c_long = i32; -pub type c_ulong = u32; -pub type nlink_t = u32; - -#[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum fpos64_t {} // TODO: fill this out with a struct -impl ::Copy for fpos64_t {} -impl ::Clone for fpos64_t { - fn clone(&self) -> fpos64_t { *self } -} - -s! { - pub struct rlimit64 { - pub rlim_cur: rlim64_t, - pub rlim_max: rlim64_t, - } - - pub struct glob_t { - pub gl_pathc: ::size_t, - pub gl_pathv: *mut *mut c_char, - pub gl_offs: ::size_t, - pub gl_flags: ::c_int, - - __unused1: *mut ::c_void, - __unused2: *mut ::c_void, - __unused3: *mut ::c_void, - __unused4: *mut ::c_void, - __unused5: *mut ::c_void, - } - - pub struct passwd { - pub pw_name: *mut ::c_char, - pub pw_passwd: *mut ::c_char, - pub pw_uid: ::uid_t, - pub pw_gid: ::gid_t, - pub pw_gecos: *mut ::c_char, - pub pw_dir: *mut ::c_char, - pub pw_shell: *mut ::c_char, - } - - pub struct spwd { - pub sp_namp: *mut ::c_char, - pub sp_pwdp: *mut ::c_char, - pub sp_lstchg: ::c_long, - pub sp_min: ::c_long, - pub sp_max: ::c_long, - pub sp_warn: ::c_long, - pub sp_inact: ::c_long, - pub sp_expire: ::c_long, - pub sp_flag: ::c_ulong, - } - - pub struct statvfs { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_favail: ::fsfilcnt_t, - pub f_fsid: ::c_ulong, - __f_unused: ::c_int, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct dqblk { - pub dqb_bhardlimit: ::uint64_t, - pub dqb_bsoftlimit: ::uint64_t, - pub dqb_curspace: ::uint64_t, - pub dqb_ihardlimit: ::uint64_t, - pub dqb_isoftlimit: ::uint64_t, - pub dqb_curinodes: ::uint64_t, - pub dqb_btime: ::uint64_t, - pub dqb_itime: ::uint64_t, - pub dqb_valid: ::uint32_t, - } - - pub struct signalfd_siginfo { - pub ssi_signo: ::uint32_t, - pub ssi_errno: ::int32_t, - pub ssi_code: ::int32_t, - pub ssi_pid: ::uint32_t, - pub ssi_uid: ::uint32_t, - pub ssi_fd: ::int32_t, - pub ssi_tid: ::uint32_t, - pub ssi_band: ::uint32_t, - pub ssi_overrun: ::uint32_t, - pub ssi_trapno: ::uint32_t, - pub ssi_status: ::int32_t, - pub ssi_int: ::int32_t, - pub ssi_ptr: ::uint64_t, - pub ssi_utime: ::uint64_t, - pub ssi_stime: ::uint64_t, - pub ssi_addr: ::uint64_t, - pub ssi_addr_lsb: ::uint16_t, - _pad2: ::uint16_t, - pub ssi_syscall: ::int32_t, - pub ssi_call_addr: ::uint64_t, - pub ssi_arch: ::uint32_t, - _pad: [::uint8_t; 28], - } - - pub struct fsid_t { - __val: [::c_int; 2], - } - - pub struct mq_attr { - pub mq_flags: ::c_long, - pub mq_maxmsg: ::c_long, - pub mq_msgsize: ::c_long, - pub mq_curmsgs: ::c_long, - pad: [::c_long; 4] - } - - pub struct cpu_set_t { - bits: [u32; 32], - } - - pub struct if_nameindex { - pub if_index: ::c_uint, - pub if_name: *mut ::c_char, - } - - // System V IPC - pub struct msginfo { - pub msgpool: ::c_int, - pub msgmap: ::c_int, - pub msgmax: ::c_int, - pub msgmnb: ::c_int, - pub msgmni: ::c_int, - pub msgssz: ::c_int, - pub msgtql: ::c_int, - pub msgseg: ::c_ushort, - } - - pub struct sembuf { - pub sem_num: ::c_ushort, - pub sem_op: ::c_short, - pub sem_flg: ::c_short, - } - - pub struct aiocb { - pub aio_fildes: ::c_int, - pub aio_lio_opcode: ::c_int, - pub aio_reqprio: ::c_int, - pub aio_buf: *mut ::c_void, - pub aio_nbytes: ::size_t, - pub aio_sigevent: ::sigevent, - __td: *mut ::c_void, - __lock: [::c_int; 2], - __err: ::c_int, - __ret: ::ssize_t, - pub aio_offset: off_t, - __next: *mut ::c_void, - __prev: *mut ::c_void, - __dummy4: [::c_char; 24], - } - - pub struct sigaction { - pub sa_sigaction: ::sighandler_t, - pub sa_mask: ::sigset_t, - pub sa_flags: ::c_int, - pub sa_restorer: ::Option, - } - - pub struct ipc_perm { - pub __ipc_perm_key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::mode_t, - pub __seq: ::c_int, - __unused1: ::c_long, - __unused2: ::c_long - } - - pub struct termios { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; ::NCCS], - pub __c_ispeed: ::speed_t, - pub __c_ospeed: ::speed_t, - } - - pub struct flock { - pub l_type: ::c_short, - pub l_whence: ::c_short, - pub l_start: ::off_t, - pub l_len: ::off_t, - pub l_pid: ::pid_t, - } - - pub struct pthread_attr_t { - __size: [u32; 11] - } - - pub struct sigset_t { - __val: [::c_ulong; 32], - } - - pub struct msghdr { - pub msg_name: *mut ::c_void, - pub msg_namelen: ::socklen_t, - pub msg_iov: *mut ::iovec, - pub msg_iovlen: ::c_int, - pub msg_control: *mut ::c_void, - pub msg_controllen: ::socklen_t, - pub msg_flags: ::c_int, - } - - pub struct cmsghdr { - pub cmsg_len: ::socklen_t, - pub cmsg_level: ::c_int, - pub cmsg_type: ::c_int, - } - - pub struct sem_t { - __val: [::c_int; 4], - } - pub struct stat { - pub st_dev: ::dev_t, - __st_dev_padding: ::c_int, - __st_ino_truncated: ::c_long, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __st_rdev_padding: ::c_int, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_ino: ::ino_t, - } - - pub struct stat64 { - pub st_dev: ::dev_t, - __st_dev_padding: ::c_int, - __st_ino_truncated: ::c_long, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __st_rdev_padding: ::c_int, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_ino: ::ino_t, - } - - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_flags: ::c_int, - pub ss_size: ::size_t - } - - pub struct shmid_ds { - pub shm_perm: ::ipc_perm, - pub shm_segsz: ::size_t, - pub shm_atime: ::time_t, - __unused1: ::c_int, - pub shm_dtime: ::time_t, - __unused2: ::c_int, - pub shm_ctime: ::time_t, - __unused3: ::c_int, - pub shm_cpid: ::pid_t, - pub shm_lpid: ::pid_t, - pub shm_nattch: ::c_ulong, - __pad1: ::c_ulong, - __pad2: ::c_ulong, - } - - pub struct msqid_ds { - pub msg_perm: ::ipc_perm, - pub msg_stime: ::time_t, - __unused1: ::c_int, - pub msg_rtime: ::time_t, - __unused2: ::c_int, - pub msg_ctime: ::time_t, - __unused3: ::c_int, - __msg_cbytes: ::c_ulong, - pub msg_qnum: ::msgqnum_t, - pub msg_qbytes: ::msglen_t, - pub msg_lspid: ::pid_t, - pub msg_lrpid: ::pid_t, - __pad1: ::c_ulong, - __pad2: ::c_ulong, - } - - pub struct statfs { - pub f_type: ::c_ulong, - pub f_bsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - pub f_namelen: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_flags: ::c_ulong, - pub f_spare: [::c_ulong; 4], - } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_errno: ::c_int, - pub si_code: ::c_int, - pub _pad: [::c_int; 29], - _align: [usize; 0], - } - - pub struct statfs64 { - pub f_type: ::c_ulong, - pub f_bsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - pub f_namelen: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_flags: ::c_ulong, - pub f_spare: [::c_ulong; 4], - } - - pub struct statvfs64 { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: u32, - pub f_bfree: u32, - pub f_bavail: u32, - pub f_files: u32, - pub f_ffree: u32, - pub f_favail: u32, - pub f_fsid: ::c_ulong, - __f_unused: ::c_int, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct arpd_request { - pub req: ::c_ushort, - pub ip: u32, - pub dev: ::c_ulong, - pub stamp: ::c_ulong, - pub updated: ::c_ulong, - pub ha: [::c_uchar; ::MAX_ADDR_LEN], - } -} - -s_no_extra_traits! { - pub struct dirent { - pub d_ino: ::ino_t, - pub d_off: ::off_t, - pub d_reclen: ::c_ushort, - pub d_type: ::c_uchar, - pub d_name: [::c_char; 256], - } - - pub struct dirent64 { - pub d_ino: ::ino64_t, - pub d_off: ::off64_t, - pub d_reclen: ::c_ushort, - pub d_type: ::c_uchar, - pub d_name: [::c_char; 256], - } - - pub struct sysinfo { - pub uptime: ::c_ulong, - pub loads: [::c_ulong; 3], - pub totalram: ::c_ulong, - pub freeram: ::c_ulong, - pub sharedram: ::c_ulong, - pub bufferram: ::c_ulong, - pub totalswap: ::c_ulong, - pub freeswap: ::c_ulong, - pub procs: ::c_ushort, - pub pad: ::c_ushort, - pub totalhigh: ::c_ulong, - pub freehigh: ::c_ulong, - pub mem_unit: ::c_uint, - pub __reserved: [::c_char; 256], - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_ino == other.d_ino - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for dirent {} - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_ino", &self.d_ino) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_ino.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for dirent64 { - fn eq(&self, other: &dirent64) -> bool { - self.d_ino == other.d_ino - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for dirent64 {} - impl ::fmt::Debug for dirent64 { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent64") - .field("d_ino", &self.d_ino) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - impl ::hash::Hash for dirent64 { - fn hash(&self, state: &mut H) { - self.d_ino.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for sysinfo { - fn eq(&self, other: &sysinfo) -> bool { - self.uptime == other.uptime - && self.loads == other.loads - && self.totalram == other.totalram - && self.freeram == other.freeram - && self.sharedram == other.sharedram - && self.bufferram == other.bufferram - && self.totalswap == other.totalswap - && self.freeswap == other.freeswap - && self.procs == other.procs - && self.pad == other.pad - && self.totalhigh == other.totalhigh - && self.freehigh == other.freehigh - && self.mem_unit == other.mem_unit - && self - .__reserved - .iter() - .zip(other.__reserved.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for sysinfo {} - impl ::fmt::Debug for sysinfo { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sysinfo") - .field("uptime", &self.uptime) - .field("loads", &self.loads) - .field("totalram", &self.totalram) - .field("freeram", &self.freeram) - .field("sharedram", &self.sharedram) - .field("bufferram", &self.bufferram) - .field("totalswap", &self.totalswap) - .field("freeswap", &self.freeswap) - .field("procs", &self.procs) - .field("pad", &self.pad) - .field("totalhigh", &self.totalhigh) - .field("freehigh", &self.freehigh) - .field("mem_unit", &self.mem_unit) - // FIXME: .field("__reserved", &self.__reserved) - .finish() - } - } - impl ::hash::Hash for sysinfo { - fn hash(&self, state: &mut H) { - self.uptime.hash(state); - self.loads.hash(state); - self.totalram.hash(state); - self.freeram.hash(state); - self.sharedram.hash(state); - self.bufferram.hash(state); - self.totalswap.hash(state); - self.freeswap.hash(state); - self.procs.hash(state); - self.pad.hash(state); - self.totalhigh.hash(state); - self.freehigh.hash(state); - self.mem_unit.hash(state); - self.__reserved.hash(state); - } - } - } -} - -pub const ABDAY_1: ::nl_item = 0x20000; -pub const ABDAY_2: ::nl_item = 0x20001; -pub const ABDAY_3: ::nl_item = 0x20002; -pub const ABDAY_4: ::nl_item = 0x20003; -pub const ABDAY_5: ::nl_item = 0x20004; -pub const ABDAY_6: ::nl_item = 0x20005; -pub const ABDAY_7: ::nl_item = 0x20006; - -pub const DAY_1: ::nl_item = 0x20007; -pub const DAY_2: ::nl_item = 0x20008; -pub const DAY_3: ::nl_item = 0x20009; -pub const DAY_4: ::nl_item = 0x2000A; -pub const DAY_5: ::nl_item = 0x2000B; -pub const DAY_6: ::nl_item = 0x2000C; -pub const DAY_7: ::nl_item = 0x2000D; - -pub const ABMON_1: ::nl_item = 0x2000E; -pub const ABMON_2: ::nl_item = 0x2000F; -pub const ABMON_3: ::nl_item = 0x20010; -pub const ABMON_4: ::nl_item = 0x20011; -pub const ABMON_5: ::nl_item = 0x20012; -pub const ABMON_6: ::nl_item = 0x20013; -pub const ABMON_7: ::nl_item = 0x20014; -pub const ABMON_8: ::nl_item = 0x20015; -pub const ABMON_9: ::nl_item = 0x20016; -pub const ABMON_10: ::nl_item = 0x20017; -pub const ABMON_11: ::nl_item = 0x20018; -pub const ABMON_12: ::nl_item = 0x20019; - -pub const MON_1: ::nl_item = 0x2001A; -pub const MON_2: ::nl_item = 0x2001B; -pub const MON_3: ::nl_item = 0x2001C; -pub const MON_4: ::nl_item = 0x2001D; -pub const MON_5: ::nl_item = 0x2001E; -pub const MON_6: ::nl_item = 0x2001F; -pub const MON_7: ::nl_item = 0x20020; -pub const MON_8: ::nl_item = 0x20021; -pub const MON_9: ::nl_item = 0x20022; -pub const MON_10: ::nl_item = 0x20023; -pub const MON_11: ::nl_item = 0x20024; -pub const MON_12: ::nl_item = 0x20025; - -pub const AM_STR: ::nl_item = 0x20026; -pub const PM_STR: ::nl_item = 0x20027; - -pub const D_T_FMT: ::nl_item = 0x20028; -pub const D_FMT: ::nl_item = 0x20029; -pub const T_FMT: ::nl_item = 0x2002A; -pub const T_FMT_AMPM: ::nl_item = 0x2002B; - -pub const ERA: ::nl_item = 0x2002C; -pub const ERA_D_FMT: ::nl_item = 0x2002E; -pub const ALT_DIGITS: ::nl_item = 0x2002F; -pub const ERA_D_T_FMT: ::nl_item = 0x20030; -pub const ERA_T_FMT: ::nl_item = 0x20031; - -pub const CODESET: ::nl_item = 14; - -pub const CRNCYSTR: ::nl_item = 0x4000F; - -pub const RUSAGE_THREAD: ::c_int = 1; -pub const RUSAGE_CHILDREN: ::c_int = -1; - -pub const RADIXCHAR: ::nl_item = 0x10000; -pub const THOUSEP: ::nl_item = 0x10001; - -pub const YESEXPR: ::nl_item = 0x50000; -pub const NOEXPR: ::nl_item = 0x50001; -pub const YESSTR: ::nl_item = 0x50002; -pub const NOSTR: ::nl_item = 0x50003; - -pub const FILENAME_MAX: ::c_uint = 4096; -pub const L_tmpnam: ::c_uint = 20; -pub const _PC_LINK_MAX: ::c_int = 0; -pub const _PC_MAX_CANON: ::c_int = 1; -pub const _PC_MAX_INPUT: ::c_int = 2; -pub const _PC_NAME_MAX: ::c_int = 3; -pub const _PC_PATH_MAX: ::c_int = 4; -pub const _PC_PIPE_BUF: ::c_int = 5; -pub const _PC_CHOWN_RESTRICTED: ::c_int = 6; -pub const _PC_NO_TRUNC: ::c_int = 7; -pub const _PC_VDISABLE: ::c_int = 8; -pub const _PC_SYNC_IO: ::c_int = 9; -pub const _PC_ASYNC_IO: ::c_int = 10; -pub const _PC_PRIO_IO: ::c_int = 11; -pub const _PC_SOCK_MAXBUF: ::c_int = 12; -pub const _PC_FILESIZEBITS: ::c_int = 13; -pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14; -pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15; -pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16; -pub const _PC_REC_XFER_ALIGN: ::c_int = 17; -pub const _PC_ALLOC_SIZE_MIN: ::c_int = 18; -pub const _PC_SYMLINK_MAX: ::c_int = 19; -pub const _PC_2_SYMLINKS: ::c_int = 20; - -pub const _SC_ARG_MAX: ::c_int = 0; -pub const _SC_CHILD_MAX: ::c_int = 1; -pub const _SC_CLK_TCK: ::c_int = 2; -pub const _SC_NGROUPS_MAX: ::c_int = 3; -pub const _SC_OPEN_MAX: ::c_int = 4; -pub const _SC_STREAM_MAX: ::c_int = 5; -pub const _SC_TZNAME_MAX: ::c_int = 6; -pub const _SC_JOB_CONTROL: ::c_int = 7; -pub const _SC_SAVED_IDS: ::c_int = 8; -pub const _SC_REALTIME_SIGNALS: ::c_int = 9; -pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10; -pub const _SC_TIMERS: ::c_int = 11; -pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12; -pub const _SC_PRIORITIZED_IO: ::c_int = 13; -pub const _SC_SYNCHRONIZED_IO: ::c_int = 14; -pub const _SC_FSYNC: ::c_int = 15; -pub const _SC_MAPPED_FILES: ::c_int = 16; -pub const _SC_MEMLOCK: ::c_int = 17; -pub const _SC_MEMLOCK_RANGE: ::c_int = 18; -pub const _SC_MEMORY_PROTECTION: ::c_int = 19; -pub const _SC_MESSAGE_PASSING: ::c_int = 20; -pub const _SC_SEMAPHORES: ::c_int = 21; -pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22; -pub const _SC_AIO_LISTIO_MAX: ::c_int = 23; -pub const _SC_AIO_MAX: ::c_int = 24; -pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25; -pub const _SC_DELAYTIMER_MAX: ::c_int = 26; -pub const _SC_MQ_OPEN_MAX: ::c_int = 27; -pub const _SC_MQ_PRIO_MAX: ::c_int = 28; -pub const _SC_VERSION: ::c_int = 29; -pub const _SC_PAGESIZE: ::c_int = 30; -pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE; -pub const _SC_RTSIG_MAX: ::c_int = 31; -pub const _SC_SEM_NSEMS_MAX: ::c_int = 32; -pub const _SC_SEM_VALUE_MAX: ::c_int = 33; -pub const _SC_SIGQUEUE_MAX: ::c_int = 34; -pub const _SC_TIMER_MAX: ::c_int = 35; -pub const _SC_BC_BASE_MAX: ::c_int = 36; -pub const _SC_BC_DIM_MAX: ::c_int = 37; -pub const _SC_BC_SCALE_MAX: ::c_int = 38; -pub const _SC_BC_STRING_MAX: ::c_int = 39; -pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40; -pub const _SC_EXPR_NEST_MAX: ::c_int = 42; -pub const _SC_LINE_MAX: ::c_int = 43; -pub const _SC_RE_DUP_MAX: ::c_int = 44; -pub const _SC_2_VERSION: ::c_int = 46; -pub const _SC_2_C_BIND: ::c_int = 47; -pub const _SC_2_C_DEV: ::c_int = 48; -pub const _SC_2_FORT_DEV: ::c_int = 49; -pub const _SC_2_FORT_RUN: ::c_int = 50; -pub const _SC_2_SW_DEV: ::c_int = 51; -pub const _SC_2_LOCALEDEF: ::c_int = 52; -pub const _SC_UIO_MAXIOV: ::c_int = 60; -pub const _SC_IOV_MAX: ::c_int = 60; -pub const _SC_THREADS: ::c_int = 67; -pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68; -pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69; -pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70; -pub const _SC_LOGIN_NAME_MAX: ::c_int = 71; -pub const _SC_TTY_NAME_MAX: ::c_int = 72; -pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73; -pub const _SC_THREAD_KEYS_MAX: ::c_int = 74; -pub const _SC_THREAD_STACK_MIN: ::c_int = 75; -pub const _SC_THREAD_THREADS_MAX: ::c_int = 76; -pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77; -pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78; -pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79; -pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80; -pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81; -pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 82; -pub const _SC_NPROCESSORS_CONF: ::c_int = 83; -pub const _SC_NPROCESSORS_ONLN: ::c_int = 84; -pub const _SC_PHYS_PAGES: ::c_int = 85; -pub const _SC_AVPHYS_PAGES: ::c_int = 86; -pub const _SC_ATEXIT_MAX: ::c_int = 87; -pub const _SC_PASS_MAX: ::c_int = 88; -pub const _SC_XOPEN_VERSION: ::c_int = 89; -pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90; -pub const _SC_XOPEN_UNIX: ::c_int = 91; -pub const _SC_XOPEN_CRYPT: ::c_int = 92; -pub const _SC_XOPEN_ENH_I18N: ::c_int = 93; -pub const _SC_XOPEN_SHM: ::c_int = 94; -pub const _SC_2_CHAR_TERM: ::c_int = 95; -pub const _SC_2_UPE: ::c_int = 97; -pub const _SC_XOPEN_XPG2: ::c_int = 98; -pub const _SC_XOPEN_XPG3: ::c_int = 99; -pub const _SC_XOPEN_XPG4: ::c_int = 100; -pub const _SC_NZERO: ::c_int = 109; -pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125; -pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126; -pub const _SC_XBS5_LP64_OFF64: ::c_int = 127; -pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128; -pub const _SC_XOPEN_LEGACY: ::c_int = 129; -pub const _SC_XOPEN_REALTIME: ::c_int = 130; -pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131; -pub const _SC_ADVISORY_INFO: ::c_int = 132; -pub const _SC_BARRIERS: ::c_int = 133; -pub const _SC_CLOCK_SELECTION: ::c_int = 137; -pub const _SC_CPUTIME: ::c_int = 138; -pub const _SC_THREAD_CPUTIME: ::c_int = 139; -pub const _SC_MONOTONIC_CLOCK: ::c_int = 149; -pub const _SC_READER_WRITER_LOCKS: ::c_int = 153; -pub const _SC_SPIN_LOCKS: ::c_int = 154; -pub const _SC_REGEXP: ::c_int = 155; -pub const _SC_SHELL: ::c_int = 157; -pub const _SC_SPAWN: ::c_int = 159; -pub const _SC_SPORADIC_SERVER: ::c_int = 160; -pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 161; -pub const _SC_TIMEOUTS: ::c_int = 164; -pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 165; -pub const _SC_2_PBS: ::c_int = 168; -pub const _SC_2_PBS_ACCOUNTING: ::c_int = 169; -pub const _SC_2_PBS_LOCATE: ::c_int = 170; -pub const _SC_2_PBS_MESSAGE: ::c_int = 171; -pub const _SC_2_PBS_TRACK: ::c_int = 172; -pub const _SC_SYMLOOP_MAX: ::c_int = 173; -pub const _SC_STREAMS: ::c_int = 174; -pub const _SC_2_PBS_CHECKPOINT: ::c_int = 175; -pub const _SC_V6_ILP32_OFF32: ::c_int = 176; -pub const _SC_V6_ILP32_OFFBIG: ::c_int = 177; -pub const _SC_V6_LP64_OFF64: ::c_int = 178; -pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 179; -pub const _SC_HOST_NAME_MAX: ::c_int = 180; -pub const _SC_TRACE: ::c_int = 181; -pub const _SC_TRACE_EVENT_FILTER: ::c_int = 182; -pub const _SC_TRACE_INHERIT: ::c_int = 183; -pub const _SC_TRACE_LOG: ::c_int = 184; -pub const _SC_IPV6: ::c_int = 235; -pub const _SC_RAW_SOCKETS: ::c_int = 236; -pub const _SC_V7_ILP32_OFF32: ::c_int = 237; -pub const _SC_V7_ILP32_OFFBIG: ::c_int = 238; -pub const _SC_V7_LP64_OFF64: ::c_int = 239; -pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 240; -pub const _SC_SS_REPL_MAX: ::c_int = 241; -pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 242; -pub const _SC_TRACE_NAME_MAX: ::c_int = 243; -pub const _SC_TRACE_SYS_MAX: ::c_int = 244; -pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 245; -pub const _SC_XOPEN_STREAMS: ::c_int = 246; -pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 247; -pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 248; - -pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY; -pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY; - -pub const GLOB_ERR: ::c_int = 1 << 0; -pub const GLOB_MARK: ::c_int = 1 << 1; -pub const GLOB_NOSORT: ::c_int = 1 << 2; -pub const GLOB_DOOFFS: ::c_int = 1 << 3; -pub const GLOB_NOCHECK: ::c_int = 1 << 4; -pub const GLOB_APPEND: ::c_int = 1 << 5; -pub const GLOB_NOESCAPE: ::c_int = 1 << 6; - -pub const GLOB_NOSPACE: ::c_int = 1; -pub const GLOB_ABORTED: ::c_int = 2; -pub const GLOB_NOMATCH: ::c_int = 3; - -pub const POSIX_MADV_NORMAL: ::c_int = 0; -pub const POSIX_MADV_RANDOM: ::c_int = 1; -pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2; -pub const POSIX_MADV_WILLNEED: ::c_int = 3; - -pub const S_IEXEC: mode_t = 64; -pub const S_IWRITE: mode_t = 128; -pub const S_IREAD: mode_t = 256; - -pub const F_LOCK: ::c_int = 1; -pub const F_TEST: ::c_int = 3; -pub const F_TLOCK: ::c_int = 2; -pub const F_ULOCK: ::c_int = 0; - -pub const ST_RDONLY: ::c_ulong = 1; -pub const ST_NOSUID: ::c_ulong = 2; -pub const ST_NODEV: ::c_ulong = 4; -pub const ST_NOEXEC: ::c_ulong = 8; -pub const ST_SYNCHRONOUS: ::c_ulong = 16; -pub const ST_MANDLOCK: ::c_ulong = 64; -pub const ST_WRITE: ::c_ulong = 128; -pub const ST_APPEND: ::c_ulong = 256; -pub const ST_IMMUTABLE: ::c_ulong = 512; -pub const ST_NOATIME: ::c_ulong = 1024; -pub const ST_NODIRATIME: ::c_ulong = 2048; - -pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void; -pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; -pub const RTLD_NODELETE: ::c_int = 0x1000; -pub const RTLD_NOW: ::c_int = 0x2; - -pub const TCP_MD5SIG: ::c_int = 14; - -align_const! { - pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { - size: [0; __SIZEOF_PTHREAD_MUTEX_T], - }; - pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { - size: [0; __SIZEOF_PTHREAD_COND_T], - }; - pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { - size: [0; __SIZEOF_PTHREAD_RWLOCK_T], - }; -} - -pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; -pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; -pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; -pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; -pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0; -pub const PTHREAD_PROCESS_SHARED: ::c_int = 1; -pub const __SIZEOF_PTHREAD_COND_T: usize = 48; - -pub const SCHED_OTHER: ::c_int = 0; -pub const SCHED_FIFO: ::c_int = 1; -pub const SCHED_RR: ::c_int = 2; -pub const SCHED_BATCH: ::c_int = 3; -pub const SCHED_IDLE: ::c_int = 5; - -pub const AF_IB: ::c_int = 27; -pub const AF_MPLS: ::c_int = 28; -pub const AF_NFC: ::c_int = 39; -pub const AF_VSOCK: ::c_int = 40; -#[doc(hidden)] -pub const AF_MAX: ::c_int = 42; -pub const PF_IB: ::c_int = AF_IB; -pub const PF_MPLS: ::c_int = AF_MPLS; -pub const PF_NFC: ::c_int = AF_NFC; -pub const PF_VSOCK: ::c_int = AF_VSOCK; -#[doc(hidden)] -pub const PF_MAX: ::c_int = AF_MAX; - -// System V IPC -pub const IPC_PRIVATE: ::key_t = 0; - -pub const IPC_CREAT: ::c_int = 0o1000; -pub const IPC_EXCL: ::c_int = 0o2000; -pub const IPC_NOWAIT: ::c_int = 0o4000; - -pub const IPC_RMID: ::c_int = 0; -pub const IPC_SET: ::c_int = 1; -pub const IPC_STAT: ::c_int = 2; -pub const IPC_INFO: ::c_int = 3; -pub const MSG_STAT: ::c_int = 11; -pub const MSG_INFO: ::c_int = 12; - -pub const MSG_NOERROR: ::c_int = 0o10000; -pub const MSG_EXCEPT: ::c_int = 0o20000; -pub const MSG_COPY: ::c_int = 0o40000; - -pub const SHM_R: ::c_int = 0o400; -pub const SHM_W: ::c_int = 0o200; - -pub const SHM_RDONLY: ::c_int = 0o10000; -pub const SHM_RND: ::c_int = 0o20000; -pub const SHM_REMAP: ::c_int = 0o40000; -pub const SHM_EXEC: ::c_int = 0o100000; - -pub const SHM_LOCK: ::c_int = 11; -pub const SHM_UNLOCK: ::c_int = 12; - -pub const SHM_HUGETLB: ::c_int = 0o4000; -pub const SHM_NORESERVE: ::c_int = 0o10000; - -pub const EPOLLRDHUP: ::c_int = 0x2000; -pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000; -pub const EPOLLONESHOT: ::c_int = 0x40000000; - -pub const QFMT_VFS_OLD: ::c_int = 1; -pub const QFMT_VFS_V0: ::c_int = 2; - -pub const EFD_SEMAPHORE: ::c_int = 0x1; - -pub const LOG_NFACILITIES: ::c_int = 24; - -pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t; - -pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32; -pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32; -pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32; -pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32; -pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32; -pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32; -pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32; - -pub const AI_PASSIVE: ::c_int = 0x0001; -pub const AI_CANONNAME: ::c_int = 0x0002; -pub const AI_NUMERICHOST: ::c_int = 0x0004; -pub const AI_V4MAPPED: ::c_int = 0x0008; -pub const AI_ALL: ::c_int = 0x0010; -pub const AI_ADDRCONFIG: ::c_int = 0x0020; - -pub const AI_NUMERICSERV: ::c_int = 0x0400; - -pub const EAI_BADFLAGS: ::c_int = -1; -pub const EAI_NONAME: ::c_int = -2; -pub const EAI_AGAIN: ::c_int = -3; -pub const EAI_FAIL: ::c_int = -4; -pub const EAI_FAMILY: ::c_int = -6; -pub const EAI_SOCKTYPE: ::c_int = -7; -pub const EAI_SERVICE: ::c_int = -8; -pub const EAI_MEMORY: ::c_int = -10; -pub const EAI_OVERFLOW: ::c_int = -12; - -pub const NI_NUMERICHOST: ::c_int = 1; -pub const NI_NUMERICSERV: ::c_int = 2; -pub const NI_NOFQDN: ::c_int = 4; -pub const NI_NAMEREQD: ::c_int = 8; -pub const NI_DGRAM: ::c_int = 16; - -pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1; -pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2; -pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4; - -pub const EAI_SYSTEM: ::c_int = -11; - -pub const AIO_CANCELED: ::c_int = 0; -pub const AIO_NOTCANCELED: ::c_int = 1; -pub const AIO_ALLDONE: ::c_int = 2; -pub const LIO_READ: ::c_int = 0; -pub const LIO_WRITE: ::c_int = 1; -pub const LIO_NOP: ::c_int = 2; -pub const LIO_WAIT: ::c_int = 0; -pub const LIO_NOWAIT: ::c_int = 1; - -pub const MREMAP_MAYMOVE: ::c_int = 1; -pub const MREMAP_FIXED: ::c_int = 2; - -pub const PR_SET_PDEATHSIG: ::c_int = 1; -pub const PR_GET_PDEATHSIG: ::c_int = 2; - -pub const PR_GET_DUMPABLE: ::c_int = 3; -pub const PR_SET_DUMPABLE: ::c_int = 4; - -pub const PR_GET_UNALIGN: ::c_int = 5; -pub const PR_SET_UNALIGN: ::c_int = 6; -pub const PR_UNALIGN_NOPRINT: ::c_int = 1; -pub const PR_UNALIGN_SIGBUS: ::c_int = 2; - -pub const PR_GET_KEEPCAPS: ::c_int = 7; -pub const PR_SET_KEEPCAPS: ::c_int = 8; - -pub const PR_GET_FPEMU: ::c_int = 9; -pub const PR_SET_FPEMU: ::c_int = 10; -pub const PR_FPEMU_NOPRINT: ::c_int = 1; -pub const PR_FPEMU_SIGFPE: ::c_int = 2; - -pub const PR_GET_FPEXC: ::c_int = 11; -pub const PR_SET_FPEXC: ::c_int = 12; -pub const PR_FP_EXC_SW_ENABLE: ::c_int = 0x80; -pub const PR_FP_EXC_DIV: ::c_int = 0x010000; -pub const PR_FP_EXC_OVF: ::c_int = 0x020000; -pub const PR_FP_EXC_UND: ::c_int = 0x040000; -pub const PR_FP_EXC_RES: ::c_int = 0x080000; -pub const PR_FP_EXC_INV: ::c_int = 0x100000; -pub const PR_FP_EXC_DISABLED: ::c_int = 0; -pub const PR_FP_EXC_NONRECOV: ::c_int = 1; -pub const PR_FP_EXC_ASYNC: ::c_int = 2; -pub const PR_FP_EXC_PRECISE: ::c_int = 3; - -pub const PR_GET_TIMING: ::c_int = 13; -pub const PR_SET_TIMING: ::c_int = 14; -pub const PR_TIMING_STATISTICAL: ::c_int = 0; -pub const PR_TIMING_TIMESTAMP: ::c_int = 1; - -pub const PR_SET_NAME: ::c_int = 15; -pub const PR_GET_NAME: ::c_int = 16; - -pub const PR_GET_ENDIAN: ::c_int = 19; -pub const PR_SET_ENDIAN: ::c_int = 20; -pub const PR_ENDIAN_BIG: ::c_int = 0; -pub const PR_ENDIAN_LITTLE: ::c_int = 1; -pub const PR_ENDIAN_PPC_LITTLE: ::c_int = 2; - -pub const PR_GET_SECCOMP: ::c_int = 21; -pub const PR_SET_SECCOMP: ::c_int = 22; - -pub const PR_CAPBSET_READ: ::c_int = 23; -pub const PR_CAPBSET_DROP: ::c_int = 24; - -pub const PR_GET_TSC: ::c_int = 25; -pub const PR_SET_TSC: ::c_int = 26; -pub const PR_TSC_ENABLE: ::c_int = 1; -pub const PR_TSC_SIGSEGV: ::c_int = 2; - -pub const PR_GET_SECUREBITS: ::c_int = 27; -pub const PR_SET_SECUREBITS: ::c_int = 28; - -pub const PR_SET_TIMERSLACK: ::c_int = 29; -pub const PR_GET_TIMERSLACK: ::c_int = 30; - -pub const PR_TASK_PERF_EVENTS_DISABLE: ::c_int = 31; -pub const PR_TASK_PERF_EVENTS_ENABLE: ::c_int = 32; - -pub const PR_MCE_KILL: ::c_int = 33; -pub const PR_MCE_KILL_CLEAR: ::c_int = 0; -pub const PR_MCE_KILL_SET: ::c_int = 1; - -pub const PR_MCE_KILL_LATE: ::c_int = 0; -pub const PR_MCE_KILL_EARLY: ::c_int = 1; -pub const PR_MCE_KILL_DEFAULT: ::c_int = 2; - -pub const PR_MCE_KILL_GET: ::c_int = 34; - -pub const PR_SET_MM: ::c_int = 35; -pub const PR_SET_MM_START_CODE: ::c_int = 1; -pub const PR_SET_MM_END_CODE: ::c_int = 2; -pub const PR_SET_MM_START_DATA: ::c_int = 3; -pub const PR_SET_MM_END_DATA: ::c_int = 4; -pub const PR_SET_MM_START_STACK: ::c_int = 5; -pub const PR_SET_MM_START_BRK: ::c_int = 6; -pub const PR_SET_MM_BRK: ::c_int = 7; -pub const PR_SET_MM_ARG_START: ::c_int = 8; -pub const PR_SET_MM_ARG_END: ::c_int = 9; -pub const PR_SET_MM_ENV_START: ::c_int = 10; -pub const PR_SET_MM_ENV_END: ::c_int = 11; -pub const PR_SET_MM_AUXV: ::c_int = 12; -pub const PR_SET_MM_EXE_FILE: ::c_int = 13; -pub const PR_SET_MM_MAP: ::c_int = 14; -pub const PR_SET_MM_MAP_SIZE: ::c_int = 15; - -pub const PR_SET_PTRACER: ::c_int = 0x59616d61; - -pub const PR_SET_CHILD_SUBREAPER: ::c_int = 36; -pub const PR_GET_CHILD_SUBREAPER: ::c_int = 37; - -pub const PR_SET_NO_NEW_PRIVS: ::c_int = 38; -pub const PR_GET_NO_NEW_PRIVS: ::c_int = 39; - -pub const PR_GET_TID_ADDRESS: ::c_int = 40; - -pub const PR_SET_THP_DISABLE: ::c_int = 41; -pub const PR_GET_THP_DISABLE: ::c_int = 42; - -pub const PR_MPX_ENABLE_MANAGEMENT: ::c_int = 43; -pub const PR_MPX_DISABLE_MANAGEMENT: ::c_int = 44; - -pub const PR_SET_FP_MODE: ::c_int = 45; -pub const PR_GET_FP_MODE: ::c_int = 46; -pub const PR_FP_MODE_FR: ::c_int = 1 << 0; -pub const PR_FP_MODE_FRE: ::c_int = 1 << 1; - -pub const PR_CAP_AMBIENT: ::c_int = 47; -pub const PR_CAP_AMBIENT_IS_SET: ::c_int = 1; -pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2; -pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3; -pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4; - -pub const ITIMER_REAL: ::c_int = 0; -pub const ITIMER_VIRTUAL: ::c_int = 1; -pub const ITIMER_PROF: ::c_int = 2; - -pub const XATTR_CREATE: ::c_int = 0x1; -pub const XATTR_REPLACE: ::c_int = 0x2; - -pub const _POSIX_VDISABLE: ::cc_t = 0; - -pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01; -pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02; -pub const FALLOC_FL_COLLAPSE_RANGE: ::c_int = 0x08; -pub const FALLOC_FL_ZERO_RANGE: ::c_int = 0x10; -pub const FALLOC_FL_INSERT_RANGE: ::c_int = 0x20; -pub const FALLOC_FL_UNSHARE_RANGE: ::c_int = 0x40; - -// On Linux, libc doesn't define this constant, libattr does instead. -// We still define it for Linux as it's defined by libc on other platforms, -// and it's mentioned in the man pages for getxattr and setxattr. -pub const SFD_CLOEXEC: ::c_int = 0x080000; - -pub const NCCS: usize = 32; - -pub const O_TRUNC: ::c_int = 512; -pub const O_NOATIME: ::c_int = 0o1000000; -pub const O_CLOEXEC: ::c_int = 0x80000; - -pub const EBFONT: ::c_int = 59; -pub const ENOSTR: ::c_int = 60; -pub const ENODATA: ::c_int = 61; -pub const ETIME: ::c_int = 62; -pub const ENOSR: ::c_int = 63; -pub const ENONET: ::c_int = 64; -pub const ENOPKG: ::c_int = 65; -pub const EREMOTE: ::c_int = 66; -pub const ENOLINK: ::c_int = 67; -pub const EADV: ::c_int = 68; -pub const ESRMNT: ::c_int = 69; -pub const ECOMM: ::c_int = 70; -pub const EPROTO: ::c_int = 71; -pub const EDOTDOT: ::c_int = 73; - -pub const SA_NODEFER: ::c_int = 0x40000000; -pub const SA_RESETHAND: ::c_int = 0x80000000; -pub const SA_RESTART: ::c_int = 0x10000000; -pub const SA_NOCLDSTOP: ::c_int = 0x00000001; - -pub const EPOLL_CLOEXEC: ::c_int = 0x80000; - -pub const EFD_CLOEXEC: ::c_int = 0x80000; - -pub const BUFSIZ: ::c_uint = 1024; -pub const TMP_MAX: ::c_uint = 10000; -pub const FOPEN_MAX: ::c_uint = 1000; -pub const O_PATH: ::c_int = 0o10000000; -pub const O_EXEC: ::c_int = 0o10000000; -pub const O_SEARCH: ::c_int = 0o10000000; -pub const O_ACCMODE: ::c_int = 0o10000003; -pub const O_NDELAY: ::c_int = O_NONBLOCK; -pub const NI_MAXHOST: ::socklen_t = 255; -pub const PTHREAD_STACK_MIN: ::size_t = 2048; -pub const POSIX_FADV_DONTNEED: ::c_int = 4; -pub const POSIX_FADV_NOREUSE: ::c_int = 5; - -pub const POSIX_MADV_DONTNEED: ::c_int = 0; - -pub const RLIM_INFINITY: ::rlim_t = !0; -pub const RLIMIT_RTTIME: ::c_int = 15; -pub const RLIMIT_NLIMITS: ::c_int = 16; - -pub const MAP_ANONYMOUS: ::c_int = MAP_ANON; - -pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15; -pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16; -pub const TCP_THIN_DUPACK: ::c_int = 17; -pub const TCP_USER_TIMEOUT: ::c_int = 18; -pub const TCP_REPAIR: ::c_int = 19; -pub const TCP_REPAIR_QUEUE: ::c_int = 20; -pub const TCP_QUEUE_SEQ: ::c_int = 21; -pub const TCP_REPAIR_OPTIONS: ::c_int = 22; -pub const TCP_FASTOPEN: ::c_int = 23; -pub const TCP_TIMESTAMP: ::c_int = 24; - -pub const SIGUNUSED: ::c_int = ::SIGSYS; - -pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; -pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; -pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; - -pub const CPU_SETSIZE: ::c_int = 128; - -pub const QFMT_VFS_V1: ::c_int = 4; - -pub const PTRACE_TRACEME: ::c_int = 0; -pub const PTRACE_PEEKTEXT: ::c_int = 1; -pub const PTRACE_PEEKDATA: ::c_int = 2; -pub const PTRACE_PEEKUSER: ::c_int = 3; -pub const PTRACE_POKETEXT: ::c_int = 4; -pub const PTRACE_POKEDATA: ::c_int = 5; -pub const PTRACE_POKEUSER: ::c_int = 6; -pub const PTRACE_CONT: ::c_int = 7; -pub const PTRACE_KILL: ::c_int = 8; -pub const PTRACE_SINGLESTEP: ::c_int = 9; -pub const PTRACE_ATTACH: ::c_int = 16; -pub const PTRACE_DETACH: ::c_int = 17; -pub const PTRACE_SYSCALL: ::c_int = 24; -pub const PTRACE_SETOPTIONS: ::c_int = 0x4200; -pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201; -pub const PTRACE_GETSIGINFO: ::c_int = 0x4202; -pub const PTRACE_SETSIGINFO: ::c_int = 0x4203; -pub const PTRACE_GETREGSET: ::c_int = 0x4204; -pub const PTRACE_SETREGSET: ::c_int = 0x4205; -pub const PTRACE_SEIZE: ::c_int = 0x4206; -pub const PTRACE_INTERRUPT: ::c_int = 0x4207; -pub const PTRACE_LISTEN: ::c_int = 0x4208; -pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209; - -pub const EPOLLWAKEUP: ::c_int = 0x20000000; - -pub const PTRACE_GETFPREGS: ::c_uint = 14; -pub const PTRACE_SETFPREGS: ::c_uint = 15; -pub const PTRACE_GETFPXREGS: ::c_uint = 18; -pub const PTRACE_SETFPXREGS: ::c_uint = 19; -pub const PTRACE_GETREGS: ::c_uint = 12; -pub const PTRACE_SETREGS: ::c_uint = 13; - -pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK; - -pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK; - -pub const TCSANOW: ::c_int = 0; -pub const TCSADRAIN: ::c_int = 1; -pub const TCSAFLUSH: ::c_int = 2; - -pub const TIOCINQ: ::c_int = ::FIONREAD; - -pub const RTLD_GLOBAL: ::c_int = 0x100; -pub const RTLD_NOLOAD: ::c_int = 0x4; - -// TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux -// kernel 3.10). See also notbsd/mod.rs -pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; -pub const CLOCK_TAI: ::clockid_t = 11; - -pub const MCL_CURRENT: ::c_int = 0x0001; -pub const MCL_FUTURE: ::c_int = 0x0002; - -pub const SIGSTKSZ: ::size_t = 8192; -pub const MINSIGSTKSZ: ::size_t = 2048; -pub const CBAUD: ::tcflag_t = 0o0010017; -pub const TAB1: ::c_int = 0x00000800; -pub const TAB2: ::c_int = 0x00001000; -pub const TAB3: ::c_int = 0x00001800; -pub const CR1: ::c_int = 0x00000200; -pub const CR2: ::c_int = 0x00000400; -pub const CR3: ::c_int = 0x00000600; -pub const FF1: ::c_int = 0x00008000; -pub const BS1: ::c_int = 0x00002000; -pub const VT1: ::c_int = 0x00004000; -pub const VWERASE: usize = 14; -pub const VREPRINT: usize = 12; -pub const VSUSP: usize = 10; -pub const VSTART: usize = 8; -pub const VSTOP: usize = 9; -pub const VDISCARD: usize = 13; -pub const VTIME: usize = 5; -pub const IXON: ::tcflag_t = 0x00000400; -pub const IXOFF: ::tcflag_t = 0x00001000; -pub const ONLCR: ::tcflag_t = 0x4; -pub const CSIZE: ::tcflag_t = 0x00000030; -pub const CS6: ::tcflag_t = 0x00000010; -pub const CS7: ::tcflag_t = 0x00000020; -pub const CS8: ::tcflag_t = 0x00000030; -pub const CSTOPB: ::tcflag_t = 0x00000040; -pub const CREAD: ::tcflag_t = 0x00000080; -pub const PARENB: ::tcflag_t = 0x00000100; -pub const PARODD: ::tcflag_t = 0x00000200; -pub const HUPCL: ::tcflag_t = 0x00000400; -pub const CLOCAL: ::tcflag_t = 0x00000800; -pub const ECHOKE: ::tcflag_t = 0x00000800; -pub const ECHOE: ::tcflag_t = 0x00000010; -pub const ECHOK: ::tcflag_t = 0x00000020; -pub const ECHONL: ::tcflag_t = 0x00000040; -pub const ECHOPRT: ::tcflag_t = 0x00000400; -pub const ECHOCTL: ::tcflag_t = 0x00000200; -pub const ISIG: ::tcflag_t = 0x00000001; -pub const ICANON: ::tcflag_t = 0x00000002; -pub const PENDIN: ::tcflag_t = 0x00004000; -pub const NOFLSH: ::tcflag_t = 0x00000080; -pub const CBAUDEX: ::tcflag_t = 0o010000; -pub const VSWTC: usize = 7; -pub const OLCUC: ::tcflag_t = 0o000002; -pub const NLDLY: ::tcflag_t = 0o000400; -pub const CRDLY: ::tcflag_t = 0o003000; -pub const TABDLY: ::tcflag_t = 0o014000; -pub const BSDLY: ::tcflag_t = 0o020000; -pub const FFDLY: ::tcflag_t = 0o100000; -pub const VTDLY: ::tcflag_t = 0o040000; -pub const XTABS: ::tcflag_t = 0o014000; - -pub const B0: ::speed_t = 0o000000; -pub const B50: ::speed_t = 0o000001; -pub const B75: ::speed_t = 0o000002; -pub const B110: ::speed_t = 0o000003; -pub const B134: ::speed_t = 0o000004; -pub const B150: ::speed_t = 0o000005; -pub const B200: ::speed_t = 0o000006; -pub const B300: ::speed_t = 0o000007; -pub const B600: ::speed_t = 0o000010; -pub const B1200: ::speed_t = 0o000011; -pub const B1800: ::speed_t = 0o000012; -pub const B2400: ::speed_t = 0o000013; -pub const B4800: ::speed_t = 0o000014; -pub const B9600: ::speed_t = 0o000015; -pub const B19200: ::speed_t = 0o000016; -pub const B38400: ::speed_t = 0o000017; -pub const B57600: ::speed_t = 0o010001; -pub const B115200: ::speed_t = 0o010002; -pub const B230400: ::speed_t = 0o010003; -pub const B460800: ::speed_t = 0o010004; -pub const B500000: ::speed_t = 0o010005; -pub const B576000: ::speed_t = 0o010006; -pub const B921600: ::speed_t = 0o010007; -pub const B1000000: ::speed_t = 0o010010; -pub const B1152000: ::speed_t = 0o010011; -pub const B1500000: ::speed_t = 0o010012; -pub const B2000000: ::speed_t = 0o010013; -pub const B2500000: ::speed_t = 0o010014; -pub const B3000000: ::speed_t = 0o010015; -pub const B3500000: ::speed_t = 0o010016; -pub const B4000000: ::speed_t = 0o010017; - -pub const SO_BINDTODEVICE: ::c_int = 25; -pub const SO_TIMESTAMP: ::c_int = 29; -pub const SO_MARK: ::c_int = 36; -pub const SO_RXQ_OVFL: ::c_int = 40; -pub const SO_PEEK_OFF: ::c_int = 42; -pub const SO_BUSY_POLL: ::c_int = 46; - -pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32; -pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 28; - -pub const O_DIRECT: ::c_int = 0x4000; -pub const O_DIRECTORY: ::c_int = 0x10000; -pub const O_NOFOLLOW: ::c_int = 0x20000; -pub const O_ASYNC: ::c_int = 0x2000; - -pub const FIOCLEX: ::c_int = 0x5451; -pub const FIONBIO: ::c_int = 0x5421; - -pub const RLIMIT_RSS: ::c_int = 5; -pub const RLIMIT_NOFILE: ::c_int = 7; -pub const RLIMIT_AS: ::c_int = 9; -pub const RLIMIT_NPROC: ::c_int = 6; -pub const RLIMIT_MEMLOCK: ::c_int = 8; - -pub const O_APPEND: ::c_int = 1024; -pub const O_CREAT: ::c_int = 64; -pub const O_EXCL: ::c_int = 128; -pub const O_NOCTTY: ::c_int = 256; -pub const O_NONBLOCK: ::c_int = 2048; -pub const O_SYNC: ::c_int = 1052672; -pub const O_RSYNC: ::c_int = 1052672; -pub const O_DSYNC: ::c_int = 4096; - -pub const SOCK_NONBLOCK: ::c_int = 2048; - -pub const MAP_ANON: ::c_int = 0x0020; -pub const MAP_GROWSDOWN: ::c_int = 0x0100; -pub const MAP_DENYWRITE: ::c_int = 0x0800; -pub const MAP_EXECUTABLE: ::c_int = 0x01000; -pub const MAP_LOCKED: ::c_int = 0x02000; -pub const MAP_NORESERVE: ::c_int = 0x04000; -pub const MAP_POPULATE: ::c_int = 0x08000; -pub const MAP_NONBLOCK: ::c_int = 0x010000; -pub const MAP_STACK: ::c_int = 0x020000; - -pub const SOCK_STREAM: ::c_int = 1; -pub const SOCK_DGRAM: ::c_int = 2; -pub const SOCK_SEQPACKET: ::c_int = 5; - -pub const SOL_SOCKET: ::c_int = 1; - -pub const EDEADLK: ::c_int = 35; -pub const ENAMETOOLONG: ::c_int = 36; -pub const ENOLCK: ::c_int = 37; -pub const ENOSYS: ::c_int = 38; -pub const ENOTEMPTY: ::c_int = 39; -pub const ELOOP: ::c_int = 40; -pub const ENOMSG: ::c_int = 42; -pub const EIDRM: ::c_int = 43; -pub const ECHRNG: ::c_int = 44; -pub const EL2NSYNC: ::c_int = 45; -pub const EL3HLT: ::c_int = 46; -pub const EL3RST: ::c_int = 47; -pub const ELNRNG: ::c_int = 48; -pub const EUNATCH: ::c_int = 49; -pub const ENOCSI: ::c_int = 50; -pub const EL2HLT: ::c_int = 51; -pub const EBADE: ::c_int = 52; -pub const EBADR: ::c_int = 53; -pub const EXFULL: ::c_int = 54; -pub const ENOANO: ::c_int = 55; -pub const EBADRQC: ::c_int = 56; -pub const EBADSLT: ::c_int = 57; -pub const EDEADLOCK: ::c_int = EDEADLK; -pub const EMULTIHOP: ::c_int = 72; -pub const EBADMSG: ::c_int = 74; -pub const EOVERFLOW: ::c_int = 75; -pub const ENOTUNIQ: ::c_int = 76; -pub const EBADFD: ::c_int = 77; -pub const EREMCHG: ::c_int = 78; -pub const ELIBACC: ::c_int = 79; -pub const ELIBBAD: ::c_int = 80; -pub const ELIBSCN: ::c_int = 81; -pub const ELIBMAX: ::c_int = 82; -pub const ELIBEXEC: ::c_int = 83; -pub const EILSEQ: ::c_int = 84; -pub const ERESTART: ::c_int = 85; -pub const ESTRPIPE: ::c_int = 86; -pub const EUSERS: ::c_int = 87; -pub const ENOTSOCK: ::c_int = 88; -pub const EDESTADDRREQ: ::c_int = 89; -pub const EMSGSIZE: ::c_int = 90; -pub const EPROTOTYPE: ::c_int = 91; -pub const ENOPROTOOPT: ::c_int = 92; -pub const EPROTONOSUPPORT: ::c_int = 93; -pub const ESOCKTNOSUPPORT: ::c_int = 94; -pub const EOPNOTSUPP: ::c_int = 95; -pub const ENOTSUP: ::c_int = EOPNOTSUPP; -pub const EPFNOSUPPORT: ::c_int = 96; -pub const EAFNOSUPPORT: ::c_int = 97; -pub const EADDRINUSE: ::c_int = 98; -pub const EADDRNOTAVAIL: ::c_int = 99; -pub const ENETDOWN: ::c_int = 100; -pub const ENETUNREACH: ::c_int = 101; -pub const ENETRESET: ::c_int = 102; -pub const ECONNABORTED: ::c_int = 103; -pub const ECONNRESET: ::c_int = 104; -pub const ENOBUFS: ::c_int = 105; -pub const EISCONN: ::c_int = 106; -pub const ENOTCONN: ::c_int = 107; -pub const ESHUTDOWN: ::c_int = 108; -pub const ETOOMANYREFS: ::c_int = 109; -pub const ETIMEDOUT: ::c_int = 110; -pub const ECONNREFUSED: ::c_int = 111; -pub const EHOSTDOWN: ::c_int = 112; -pub const EHOSTUNREACH: ::c_int = 113; -pub const EALREADY: ::c_int = 114; -pub const EINPROGRESS: ::c_int = 115; -pub const ESTALE: ::c_int = 116; -pub const EUCLEAN: ::c_int = 117; -pub const ENOTNAM: ::c_int = 118; -pub const ENAVAIL: ::c_int = 119; -pub const EISNAM: ::c_int = 120; -pub const EREMOTEIO: ::c_int = 121; -pub const EDQUOT: ::c_int = 122; -pub const ENOMEDIUM: ::c_int = 123; -pub const EMEDIUMTYPE: ::c_int = 124; -pub const ECANCELED: ::c_int = 125; -pub const ENOKEY: ::c_int = 126; -pub const EKEYEXPIRED: ::c_int = 127; -pub const EKEYREVOKED: ::c_int = 128; -pub const EKEYREJECTED: ::c_int = 129; -pub const EOWNERDEAD: ::c_int = 130; -pub const ENOTRECOVERABLE: ::c_int = 131; -pub const ERFKILL: ::c_int = 132; -pub const EHWPOISON: ::c_int = 133; - -pub const SO_REUSEADDR: ::c_int = 2; -pub const SO_TYPE: ::c_int = 3; -pub const SO_ERROR: ::c_int = 4; -pub const SO_DONTROUTE: ::c_int = 5; -pub const SO_BROADCAST: ::c_int = 6; -pub const SO_SNDBUF: ::c_int = 7; -pub const SO_RCVBUF: ::c_int = 8; -pub const SO_KEEPALIVE: ::c_int = 9; -pub const SO_OOBINLINE: ::c_int = 10; -pub const SO_LINGER: ::c_int = 13; -pub const SO_REUSEPORT: ::c_int = 15; -pub const SO_RCVLOWAT: ::c_int = 18; -pub const SO_SNDLOWAT: ::c_int = 19; -pub const SO_RCVTIMEO: ::c_int = 20; -pub const SO_SNDTIMEO: ::c_int = 21; -pub const SO_ACCEPTCONN: ::c_int = 30; - -pub const SA_ONSTACK: ::c_int = 0x08000000; -pub const SA_SIGINFO: ::c_int = 0x00000004; -pub const SA_NOCLDWAIT: ::c_int = 0x00000002; - -pub const SIGCHLD: ::c_int = 17; -pub const SIGBUS: ::c_int = 7; -pub const SIGTTIN: ::c_int = 21; -pub const SIGTTOU: ::c_int = 22; -pub const SIGXCPU: ::c_int = 24; -pub const SIGXFSZ: ::c_int = 25; -pub const SIGVTALRM: ::c_int = 26; -pub const SIGPROF: ::c_int = 27; -pub const SIGWINCH: ::c_int = 28; -pub const SIGUSR1: ::c_int = 10; -pub const SIGUSR2: ::c_int = 12; -pub const SIGCONT: ::c_int = 18; -pub const SIGSTOP: ::c_int = 19; -pub const SIGTSTP: ::c_int = 20; -pub const SIGURG: ::c_int = 23; -pub const SIGIO: ::c_int = 29; -pub const SIGSYS: ::c_int = 31; -pub const SIGSTKFLT: ::c_int = 16; -pub const SIGPOLL: ::c_int = 29; -pub const SIGPWR: ::c_int = 30; -pub const SIG_SETMASK: ::c_int = 2; -pub const SIG_BLOCK: ::c_int = 0x000000; -pub const SIG_UNBLOCK: ::c_int = 0x01; - -pub const EXTPROC: ::tcflag_t = 0x00010000; - -pub const MAP_HUGETLB: ::c_int = 0x040000; - -pub const F_GETLK: ::c_int = 12; -pub const F_GETOWN: ::c_int = 9; -pub const F_SETLK: ::c_int = 13; -pub const F_SETLKW: ::c_int = 14; -pub const F_SETOWN: ::c_int = 8; - -pub const VEOF: usize = 4; -pub const VEOL: usize = 11; -pub const VEOL2: usize = 16; -pub const VMIN: usize = 6; -pub const IEXTEN: ::tcflag_t = 0x00008000; -pub const TOSTOP: ::tcflag_t = 0x00000100; -pub const FLUSHO: ::tcflag_t = 0x00001000; - -pub const TCGETS: ::c_int = 0x5401; -pub const TCSETS: ::c_int = 0x5402; -pub const TCSETSW: ::c_int = 0x5403; -pub const TCSETSF: ::c_int = 0x5404; -pub const TCGETA: ::c_int = 0x5405; -pub const TCSETA: ::c_int = 0x5406; -pub const TCSETAW: ::c_int = 0x5407; -pub const TCSETAF: ::c_int = 0x5408; -pub const TCSBRK: ::c_int = 0x5409; -pub const TCXONC: ::c_int = 0x540A; -pub const TCFLSH: ::c_int = 0x540B; -pub const TIOCGSOFTCAR: ::c_int = 0x5419; -pub const TIOCSSOFTCAR: ::c_int = 0x541A; -pub const TIOCLINUX: ::c_int = 0x541C; -pub const TIOCGSERIAL: ::c_int = 0x541E; -pub const TIOCEXCL: ::c_int = 0x540C; -pub const TIOCNXCL: ::c_int = 0x540D; -pub const TIOCSCTTY: ::c_int = 0x540E; -pub const TIOCGPGRP: ::c_int = 0x540F; -pub const TIOCSPGRP: ::c_int = 0x5410; -pub const TIOCOUTQ: ::c_int = 0x5411; -pub const TIOCSTI: ::c_int = 0x5412; -pub const TIOCGWINSZ: ::c_int = 0x5413; -pub const TIOCSWINSZ: ::c_int = 0x5414; -pub const TIOCMGET: ::c_int = 0x5415; -pub const TIOCMBIS: ::c_int = 0x5416; -pub const TIOCMBIC: ::c_int = 0x5417; -pub const TIOCMSET: ::c_int = 0x5418; -pub const FIONREAD: ::c_int = 0x541B; -pub const TIOCCONS: ::c_int = 0x541D; - -pub const SYS_gettid: ::c_long = 224; // Valid for arm (32-bit) and x86 (32-bit) - -pub const POLLWRNORM: ::c_short = 0x100; -pub const POLLWRBAND: ::c_short = 0x200; - -pub const TIOCM_LE: ::c_int = 0x001; -pub const TIOCM_DTR: ::c_int = 0x002; -pub const TIOCM_RTS: ::c_int = 0x004; -pub const TIOCM_ST: ::c_int = 0x008; -pub const TIOCM_SR: ::c_int = 0x010; -pub const TIOCM_CTS: ::c_int = 0x020; -pub const TIOCM_CAR: ::c_int = 0x040; -pub const TIOCM_RNG: ::c_int = 0x080; -pub const TIOCM_DSR: ::c_int = 0x100; -pub const TIOCM_CD: ::c_int = TIOCM_CAR; -pub const TIOCM_RI: ::c_int = TIOCM_RNG; -pub const O_TMPFILE: ::c_int = 0x400000; - -pub const MAX_ADDR_LEN: usize = 7; -pub const ARPD_UPDATE: ::c_ushort = 0x01; -pub const ARPD_LOOKUP: ::c_ushort = 0x02; -pub const ARPD_FLUSH: ::c_ushort = 0x03; -pub const ATF_MAGIC: ::c_int = 0x80; - -f! { - pub fn CMSG_NXTHDR(mhdr: *const msghdr, - cmsg: *const cmsghdr) -> *mut cmsghdr { - if ((*cmsg).cmsg_len as usize) < ::mem::size_of::() { - return 0 as *mut cmsghdr; - }; - let next = (cmsg as usize + - super::CMSG_ALIGN((*cmsg).cmsg_len as usize)) - as *mut cmsghdr; - let max = (*mhdr).msg_control as usize - + (*mhdr).msg_controllen as usize; - if (next.offset(1)) as usize > max { - 0 as *mut cmsghdr - } else { - next as *mut cmsghdr - } - } - - pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { - for slot in cpuset.bits.iter_mut() { - *slot = 0; - } - } - - pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits - = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc - let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); - cpuset.bits[idx] |= 1 << offset; - () - } - - pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits - = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc - let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); - cpuset.bits[idx] &= !(1 << offset); - () - } - - pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { - let size_in_bits = 8 * ::mem::size_of_val(&cpuset.bits[0]); - let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); - 0 != (cpuset.bits[idx] & (1 << offset)) - } - - pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { - set1.bits == set2.bits - } - - pub fn major(dev: ::dev_t) -> ::c_uint { - // see - // https://github.com/kripken/emscripten/blob/ - // master/system/include/libc/sys/sysmacros.h - let mut major = 0; - major |= (dev & 0x00000fff) >> 8; - major |= (dev & 0xfffff000) >> 31 >> 1; - major as ::c_uint - } - - pub fn minor(dev: ::dev_t) -> ::c_uint { - // see - // https://github.com/kripken/emscripten/blob/ - // master/system/include/libc/sys/sysmacros.h - let mut minor = 0; - minor |= (dev & 0x000000ff) >> 0; - minor |= (dev & 0xffffff00) >> 12; - minor as ::c_uint - } - - pub fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t { - let major = major as ::dev_t; - let minor = minor as ::dev_t; - let mut dev = 0; - dev |= (major & 0x00000fff) << 8; - dev |= (major & 0xfffff000) << 31 << 1; - dev |= (minor & 0x000000ff) << 0; - dev |= (minor & 0xffffff00) << 12; - dev - } -} - -extern { - pub fn abs(i: ::c_int) -> ::c_int; - pub fn atof(s: *const ::c_char) -> ::c_double; - pub fn labs(i: ::c_long) -> ::c_long; - pub fn rand() -> ::c_int; - pub fn srand(seed: ::c_uint); - - pub fn setpwent(); - pub fn endpwent(); - pub fn getpwent() -> *mut passwd; - - pub fn shm_open(name: *const c_char, oflag: ::c_int, - mode: mode_t) -> ::c_int; - - pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) - -> ::c_int; - pub fn __errno_location() -> *mut ::c_int; - - pub fn fopen64(filename: *const c_char, - mode: *const c_char) -> *mut ::FILE; - pub fn freopen64(filename: *const c_char, mode: *const c_char, - file: *mut ::FILE) -> *mut ::FILE; - pub fn tmpfile64() -> *mut ::FILE; - pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int; - pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int; - pub fn fseeko64(stream: *mut ::FILE, - offset: ::off64_t, - whence: ::c_int) -> ::c_int; - pub fn ftello64(stream: *mut ::FILE) -> ::off64_t; - pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, - len: ::off_t) -> ::c_int; - pub fn pwritev(fd: ::c_int, - iov: *const ::iovec, - iovcnt: ::c_int, - offset: ::off_t) -> ::ssize_t; - pub fn preadv(fd: ::c_int, - iov: *const ::iovec, - iovcnt: ::c_int, - offset: ::off_t) -> ::ssize_t; - pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int; - pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int; - pub fn mkostemps(template: *mut ::c_char, - suffixlen: ::c_int, - flags: ::c_int) -> ::c_int; - pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; - pub fn getnameinfo(sa: *const ::sockaddr, - salen: ::socklen_t, - host: *mut ::c_char, - hostlen: ::socklen_t, - serv: *mut ::c_char, - sevlen: ::socklen_t, - flags: ::c_int) -> ::c_int; - pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int; - - // Not available now on Android - pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, - mode: ::mode_t) -> ::c_int; - pub fn if_nameindex() -> *mut if_nameindex; - pub fn if_freenameindex(ptr: *mut if_nameindex); - - pub fn mremap(addr: *mut ::c_void, - len: ::size_t, - new_len: ::size_t, - flags: ::c_int, - ...) -> *mut ::c_void; - - pub fn glob(pattern: *const c_char, - flags: ::c_int, - errfunc: ::Option ::c_int>, - pglob: *mut ::glob_t) -> ::c_int; - pub fn globfree(pglob: *mut ::glob_t); - - pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) - -> ::c_int; - - pub fn shm_unlink(name: *const ::c_char) -> ::c_int; - - pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long); - - pub fn telldir(dirp: *mut ::DIR) -> ::c_long; - pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) - -> ::c_int; - - pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int; - - pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, - flags: ::c_int, addr: *mut ::sockaddr, - addrlen: *mut ::socklen_t) -> ::ssize_t; - pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; - pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; - - pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int; - pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int; - pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, - flags: ::c_int) -> ::c_int; - pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, - flags: ::c_int, timeout: *mut ::timespec) -> ::c_int; - pub fn sync(); - pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; - pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; - pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; - pub fn pthread_create(native: *mut ::pthread_t, - attr: *const ::pthread_attr_t, - f: extern fn(*mut ::c_void) -> *mut ::c_void, - value: *mut ::c_void) -> ::c_int; -} - -cfg_if! { - if #[cfg(libc_align)] { - #[macro_use] - mod align; - } else { - #[macro_use] - mod no_align; - } -} -expand_align!(); diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/emscripten/no_align.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/emscripten/no_align.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/emscripten/no_align.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/emscripten/no_align.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -macro_rules! expand_align { - () => { - s! { - pub struct pthread_mutex_t { - __align: [::c_long; 0], - size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], - } - - pub struct pthread_rwlock_t { - __align: [::c_long; 0], - size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], - } - - pub struct pthread_mutexattr_t { - __align: [::c_int; 0], - size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], - } - - pub struct pthread_rwlockattr_t { - __align: [::c_int; 0], - size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T], - } - - pub struct pthread_condattr_t { - __align: [::c_int; 0], - size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], - } - } - - s_no_extra_traits! { - pub struct pthread_cond_t { - __align: [*const ::c_void; 0], - size: [u8; ::__SIZEOF_PTHREAD_COND_T], - } - } - - cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for pthread_cond_t { - fn eq(&self, other: &pthread_cond_t) -> bool { - self.size - .iter() - .zip(other.size.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for pthread_cond_t {} - impl ::fmt::Debug for pthread_cond_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_cond_t") - // FIXME: .field("size", &self.size) - .finish() - } - } - impl ::hash::Hash for pthread_cond_t { - fn hash(&self, state: &mut H) { - self.size.hash(state); - } - } - } - } - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/align.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/align.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/align.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/align.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,100 +0,0 @@ -macro_rules! expand_align { - () => { - s! { - #[cfg_attr(any(target_pointer_width = "32", - target_arch = "x86_64", - target_arch = "powerpc64", - target_arch = "mips64", - target_arch = "s390x", - target_arch = "sparc64", - all(target_arch = "aarch64", - target_env = "musl")), - repr(align(4)))] - #[cfg_attr(not(any(target_pointer_width = "32", - target_arch = "x86_64", - target_arch = "powerpc64", - target_arch = "mips64", - target_arch = "s390x", - target_arch = "sparc64", - all(target_arch = "aarch64", - target_env = "musl"))), - repr(align(8)))] - pub struct pthread_mutexattr_t { - #[doc(hidden)] - size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], - } - - #[cfg_attr(any(target_env = "musl", target_pointer_width = "32"), - repr(align(4)))] - #[cfg_attr(all(not(target_env = "musl"), - target_pointer_width = "64"), - repr(align(8)))] - pub struct pthread_rwlockattr_t { - #[doc(hidden)] - size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T], - } - - #[repr(align(4))] - pub struct pthread_condattr_t { - #[doc(hidden)] - size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], - } - } - - s_no_extra_traits! { - #[cfg_attr(all(target_env = "musl", - target_pointer_width = "32"), - repr(align(4)))] - #[cfg_attr(all(target_env = "musl", - target_pointer_width = "64"), - repr(align(8)))] - #[cfg_attr(all(not(target_env = "musl"), - target_arch = "x86"), - repr(align(4)))] - #[cfg_attr(all(not(target_env = "musl"), - not(target_arch = "x86")), - repr(align(8)))] - pub struct pthread_cond_t { - #[doc(hidden)] - size: [u8; ::__SIZEOF_PTHREAD_COND_T], - } - - #[cfg_attr(all(target_pointer_width = "32", - any(target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc", - target_arch = "x86_64", - target_arch = "x86")), - repr(align(4)))] - #[cfg_attr(any(target_pointer_width = "64", - not(any(target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc", - target_arch = "x86_64", - target_arch = "x86"))), - repr(align(8)))] - pub struct pthread_mutex_t { - #[doc(hidden)] - size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], - } - - #[cfg_attr(all(target_pointer_width = "32", - any(target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc", - target_arch = "x86_64", - target_arch = "x86")), - repr(align(4)))] - #[cfg_attr(any(target_pointer_width = "64", - not(any(target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc", - target_arch = "x86_64", - target_arch = "x86"))), - repr(align(8)))] - pub struct pthread_rwlock_t { - size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], - } - } - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/mips/align.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/mips/align.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/mips/align.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/mips/align.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -s! { - // FIXME this is actually a union - #[cfg_attr(target_pointer_width = "32", - repr(align(4)))] - #[cfg_attr(target_pointer_width = "64", - repr(align(8)))] - pub struct sem_t { - #[cfg(target_pointer_width = "32")] - __size: [::c_char; 16], - #[cfg(target_pointer_width = "64")] - __size: [::c_char; 32], - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/mips/mips32.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/mips/mips32.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/mips/mips32.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/mips/mips32.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,703 +0,0 @@ -use pthread_mutex_t; - -pub type c_char = i8; -pub type c_long = i32; -pub type c_ulong = u32; -pub type clock_t = i32; -pub type time_t = i32; -pub type suseconds_t = i32; -pub type wchar_t = i32; -pub type off_t = i32; -pub type ino_t = u32; -pub type blkcnt_t = i32; -pub type blksize_t = i32; -pub type nlink_t = u32; -pub type __u64 = ::c_ulonglong; - -s! { - pub struct aiocb { - pub aio_fildes: ::c_int, - pub aio_lio_opcode: ::c_int, - pub aio_reqprio: ::c_int, - pub aio_buf: *mut ::c_void, - pub aio_nbytes: ::size_t, - pub aio_sigevent: ::sigevent, - __next_prio: *mut aiocb, - __abs_prio: ::c_int, - __policy: ::c_int, - __error_code: ::c_int, - __return_value: ::ssize_t, - pub aio_offset: off_t, - __unused1: [::c_char; 4], - __glibc_reserved: [::c_char; 32] - } - - pub struct stat { - pub st_dev: ::c_ulong, - st_pad1: [::c_long; 3], - pub st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::c_ulong, - pub st_pad2: [::c_long; 2], - pub st_size: ::off_t, - st_pad3: ::c_long, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt_t, - st_pad5: [::c_long; 14], - } - - pub struct stat64 { - pub st_dev: ::c_ulong, - st_pad1: [::c_long; 3], - pub st_ino: ::ino64_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::c_ulong, - st_pad2: [::c_long; 2], - pub st_size: ::off64_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_blksize: ::blksize_t, - st_pad3: ::c_long, - pub st_blocks: ::blkcnt64_t, - st_pad5: [::c_long; 14], - } - - pub struct statfs64 { - pub f_type: ::c_long, - pub f_bsize: ::c_long, - pub f_frsize: ::c_long, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_bavail: u64, - pub f_fsid: ::fsid_t, - pub f_namelen: ::c_long, - pub f_flags: ::c_long, - pub f_spare: [::c_long; 5], - } - - pub struct statvfs { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_favail: ::fsfilcnt_t, - pub f_fsid: ::c_ulong, - __f_unused: ::c_int, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct statvfs64 { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_favail: u64, - pub f_fsid: ::c_ulong, - __f_unused: ::c_int, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct pthread_attr_t { - __size: [u32; 9] - } - - pub struct sigaction { - pub sa_flags: ::c_int, - pub sa_sigaction: ::sighandler_t, - pub sa_mask: sigset_t, - pub sa_restorer: ::Option, - _resv: [::c_int; 1], - } - - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_size: ::size_t, - pub ss_flags: ::c_int, - } - - pub struct sigset_t { - __val: [::c_ulong; 32], - } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_code: ::c_int, - pub si_errno: ::c_int, - pub _pad: [::c_int; 29], - } - - pub struct ipc_perm { - pub __key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::c_uint, - pub __seq: ::c_ushort, - __pad1: ::c_ushort, - __unused1: ::c_ulong, - __unused2: ::c_ulong - } - - pub struct shmid_ds { - pub shm_perm: ::ipc_perm, - pub shm_segsz: ::size_t, - pub shm_atime: ::time_t, - pub shm_dtime: ::time_t, - pub shm_ctime: ::time_t, - pub shm_cpid: ::pid_t, - pub shm_lpid: ::pid_t, - pub shm_nattch: ::shmatt_t, - __unused4: ::c_ulong, - __unused5: ::c_ulong - } - - pub struct msqid_ds { - pub msg_perm: ::ipc_perm, - #[cfg(target_endian = "big")] - __glibc_reserved1: ::c_ulong, - pub msg_stime: ::time_t, - #[cfg(target_endian = "little")] - __glibc_reserved1: ::c_ulong, - #[cfg(target_endian = "big")] - __glibc_reserved2: ::c_ulong, - pub msg_rtime: ::time_t, - #[cfg(target_endian = "little")] - __glibc_reserved2: ::c_ulong, - #[cfg(target_endian = "big")] - __glibc_reserved3: ::c_ulong, - pub msg_ctime: ::time_t, - #[cfg(target_endian = "little")] - __glibc_reserved3: ::c_ulong, - __msg_cbytes: ::c_ulong, - pub msg_qnum: ::msgqnum_t, - pub msg_qbytes: ::msglen_t, - pub msg_lspid: ::pid_t, - pub msg_lrpid: ::pid_t, - __glibc_reserved4: ::c_ulong, - __glibc_reserved5: ::c_ulong, - } - - pub struct statfs { - pub f_type: ::c_long, - pub f_bsize: ::c_long, - pub f_frsize: ::c_long, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_files: ::fsblkcnt_t, - pub f_ffree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_fsid: ::fsid_t, - - pub f_namelen: ::c_long, - f_spare: [::c_long; 6], - } - - pub struct msghdr { - pub msg_name: *mut ::c_void, - pub msg_namelen: ::socklen_t, - pub msg_iov: *mut ::iovec, - pub msg_iovlen: ::size_t, - pub msg_control: *mut ::c_void, - pub msg_controllen: ::size_t, - pub msg_flags: ::c_int, - } - - pub struct cmsghdr { - pub cmsg_len: ::size_t, - pub cmsg_level: ::c_int, - pub cmsg_type: ::c_int, - } - - pub struct termios { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; ::NCCS], - } - - pub struct flock { - pub l_type: ::c_short, - pub l_whence: ::c_short, - pub l_start: ::off_t, - pub l_len: ::off_t, - pub l_sysid: ::c_long, - pub l_pid: ::pid_t, - pad: [::c_long; 4], - } - - pub struct sysinfo { - pub uptime: ::c_long, - pub loads: [::c_ulong; 3], - pub totalram: ::c_ulong, - pub freeram: ::c_ulong, - pub sharedram: ::c_ulong, - pub bufferram: ::c_ulong, - pub totalswap: ::c_ulong, - pub freeswap: ::c_ulong, - pub procs: ::c_ushort, - pub pad: ::c_ushort, - pub totalhigh: ::c_ulong, - pub freehigh: ::c_ulong, - pub mem_unit: ::c_uint, - pub _f: [::c_char; 8], - } -} - -pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; -pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; -pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32; -pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; -pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; - -align_const! { - #[cfg(target_endian = "little")] - pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, - ], - }; - #[cfg(target_endian = "little")] - pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, - ], - }; - #[cfg(target_endian = "little")] - pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, - ], - }; - #[cfg(target_endian = "big")] - pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, - ], - }; - #[cfg(target_endian = "big")] - pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, - 0, 0, 0, - ], - }; - #[cfg(target_endian = "big")] - pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 0, - ], - }; -} - -pub const O_LARGEFILE: ::c_int = 0x2000; - -pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff; - -pub const SYS_syscall: ::c_long = 4000 + 0; -pub const SYS_exit: ::c_long = 4000 + 1; -pub const SYS_fork: ::c_long = 4000 + 2; -pub const SYS_read: ::c_long = 4000 + 3; -pub const SYS_write: ::c_long = 4000 + 4; -pub const SYS_open: ::c_long = 4000 + 5; -pub const SYS_close: ::c_long = 4000 + 6; -pub const SYS_waitpid: ::c_long = 4000 + 7; -pub const SYS_creat: ::c_long = 4000 + 8; -pub const SYS_link: ::c_long = 4000 + 9; -pub const SYS_unlink: ::c_long = 4000 + 10; -pub const SYS_execve: ::c_long = 4000 + 11; -pub const SYS_chdir: ::c_long = 4000 + 12; -pub const SYS_time: ::c_long = 4000 + 13; -pub const SYS_mknod: ::c_long = 4000 + 14; -pub const SYS_chmod: ::c_long = 4000 + 15; -pub const SYS_lchown: ::c_long = 4000 + 16; -pub const SYS_break: ::c_long = 4000 + 17; -pub const SYS_unused18: ::c_long = 4000 + 18; -pub const SYS_lseek: ::c_long = 4000 + 19; -pub const SYS_getpid: ::c_long = 4000 + 20; -pub const SYS_mount: ::c_long = 4000 + 21; -pub const SYS_umount: ::c_long = 4000 + 22; -pub const SYS_setuid: ::c_long = 4000 + 23; -pub const SYS_getuid: ::c_long = 4000 + 24; -pub const SYS_stime: ::c_long = 4000 + 25; -pub const SYS_ptrace: ::c_long = 4000 + 26; -pub const SYS_alarm: ::c_long = 4000 + 27; -pub const SYS_unused28: ::c_long = 4000 + 28; -pub const SYS_pause: ::c_long = 4000 + 29; -pub const SYS_utime: ::c_long = 4000 + 30; -pub const SYS_stty: ::c_long = 4000 + 31; -pub const SYS_gtty: ::c_long = 4000 + 32; -pub const SYS_access: ::c_long = 4000 + 33; -pub const SYS_nice: ::c_long = 4000 + 34; -pub const SYS_ftime: ::c_long = 4000 + 35; -pub const SYS_sync: ::c_long = 4000 + 36; -pub const SYS_kill: ::c_long = 4000 + 37; -pub const SYS_rename: ::c_long = 4000 + 38; -pub const SYS_mkdir: ::c_long = 4000 + 39; -pub const SYS_rmdir: ::c_long = 4000 + 40; -pub const SYS_dup: ::c_long = 4000 + 41; -pub const SYS_pipe: ::c_long = 4000 + 42; -pub const SYS_times: ::c_long = 4000 + 43; -pub const SYS_prof: ::c_long = 4000 + 44; -pub const SYS_brk: ::c_long = 4000 + 45; -pub const SYS_setgid: ::c_long = 4000 + 46; -pub const SYS_getgid: ::c_long = 4000 + 47; -pub const SYS_signal: ::c_long = 4000 + 48; -pub const SYS_geteuid: ::c_long = 4000 + 49; -pub const SYS_getegid: ::c_long = 4000 + 50; -pub const SYS_acct: ::c_long = 4000 + 51; -pub const SYS_umount2: ::c_long = 4000 + 52; -pub const SYS_lock: ::c_long = 4000 + 53; -pub const SYS_ioctl: ::c_long = 4000 + 54; -pub const SYS_fcntl: ::c_long = 4000 + 55; -pub const SYS_mpx: ::c_long = 4000 + 56; -pub const SYS_setpgid: ::c_long = 4000 + 57; -pub const SYS_ulimit: ::c_long = 4000 + 58; -pub const SYS_unused59: ::c_long = 4000 + 59; -pub const SYS_umask: ::c_long = 4000 + 60; -pub const SYS_chroot: ::c_long = 4000 + 61; -pub const SYS_ustat: ::c_long = 4000 + 62; -pub const SYS_dup2: ::c_long = 4000 + 63; -pub const SYS_getppid: ::c_long = 4000 + 64; -pub const SYS_getpgrp: ::c_long = 4000 + 65; -pub const SYS_setsid: ::c_long = 4000 + 66; -pub const SYS_sigaction: ::c_long = 4000 + 67; -pub const SYS_sgetmask: ::c_long = 4000 + 68; -pub const SYS_ssetmask: ::c_long = 4000 + 69; -pub const SYS_setreuid: ::c_long = 4000 + 70; -pub const SYS_setregid: ::c_long = 4000 + 71; -pub const SYS_sigsuspend: ::c_long = 4000 + 72; -pub const SYS_sigpending: ::c_long = 4000 + 73; -pub const SYS_sethostname: ::c_long = 4000 + 74; -pub const SYS_setrlimit: ::c_long = 4000 + 75; -pub const SYS_getrlimit: ::c_long = 4000 + 76; -pub const SYS_getrusage: ::c_long = 4000 + 77; -pub const SYS_gettimeofday: ::c_long = 4000 + 78; -pub const SYS_settimeofday: ::c_long = 4000 + 79; -pub const SYS_getgroups: ::c_long = 4000 + 80; -pub const SYS_setgroups: ::c_long = 4000 + 81; -pub const SYS_reserved82: ::c_long = 4000 + 82; -pub const SYS_symlink: ::c_long = 4000 + 83; -pub const SYS_unused84: ::c_long = 4000 + 84; -pub const SYS_readlink: ::c_long = 4000 + 85; -pub const SYS_uselib: ::c_long = 4000 + 86; -pub const SYS_swapon: ::c_long = 4000 + 87; -pub const SYS_reboot: ::c_long = 4000 + 88; -pub const SYS_readdir: ::c_long = 4000 + 89; -pub const SYS_mmap: ::c_long = 4000 + 90; -pub const SYS_munmap: ::c_long = 4000 + 91; -pub const SYS_truncate: ::c_long = 4000 + 92; -pub const SYS_ftruncate: ::c_long = 4000 + 93; -pub const SYS_fchmod: ::c_long = 4000 + 94; -pub const SYS_fchown: ::c_long = 4000 + 95; -pub const SYS_getpriority: ::c_long = 4000 + 96; -pub const SYS_setpriority: ::c_long = 4000 + 97; -pub const SYS_profil: ::c_long = 4000 + 98; -pub const SYS_statfs: ::c_long = 4000 + 99; -pub const SYS_fstatfs: ::c_long = 4000 + 100; -pub const SYS_ioperm: ::c_long = 4000 + 101; -pub const SYS_socketcall: ::c_long = 4000 + 102; -pub const SYS_syslog: ::c_long = 4000 + 103; -pub const SYS_setitimer: ::c_long = 4000 + 104; -pub const SYS_getitimer: ::c_long = 4000 + 105; -pub const SYS_stat: ::c_long = 4000 + 106; -pub const SYS_lstat: ::c_long = 4000 + 107; -pub const SYS_fstat: ::c_long = 4000 + 108; -pub const SYS_unused109: ::c_long = 4000 + 109; -pub const SYS_iopl: ::c_long = 4000 + 110; -pub const SYS_vhangup: ::c_long = 4000 + 111; -pub const SYS_idle: ::c_long = 4000 + 112; -pub const SYS_vm86: ::c_long = 4000 + 113; -pub const SYS_wait4: ::c_long = 4000 + 114; -pub const SYS_swapoff: ::c_long = 4000 + 115; -pub const SYS_sysinfo: ::c_long = 4000 + 116; -pub const SYS_ipc: ::c_long = 4000 + 117; -pub const SYS_fsync: ::c_long = 4000 + 118; -pub const SYS_sigreturn: ::c_long = 4000 + 119; -pub const SYS_clone: ::c_long = 4000 + 120; -pub const SYS_setdomainname: ::c_long = 4000 + 121; -pub const SYS_uname: ::c_long = 4000 + 122; -pub const SYS_modify_ldt: ::c_long = 4000 + 123; -pub const SYS_adjtimex: ::c_long = 4000 + 124; -pub const SYS_mprotect: ::c_long = 4000 + 125; -pub const SYS_sigprocmask: ::c_long = 4000 + 126; -pub const SYS_create_module: ::c_long = 4000 + 127; -pub const SYS_init_module: ::c_long = 4000 + 128; -pub const SYS_delete_module: ::c_long = 4000 + 129; -pub const SYS_get_kernel_syms: ::c_long = 4000 + 130; -pub const SYS_quotactl: ::c_long = 4000 + 131; -pub const SYS_getpgid: ::c_long = 4000 + 132; -pub const SYS_fchdir: ::c_long = 4000 + 133; -pub const SYS_bdflush: ::c_long = 4000 + 134; -pub const SYS_sysfs: ::c_long = 4000 + 135; -pub const SYS_personality: ::c_long = 4000 + 136; -pub const SYS_afs_syscall: ::c_long = 4000 + 137; -pub const SYS_setfsuid: ::c_long = 4000 + 138; -pub const SYS_setfsgid: ::c_long = 4000 + 139; -pub const SYS__llseek: ::c_long = 4000 + 140; -pub const SYS_getdents: ::c_long = 4000 + 141; -pub const SYS__newselect: ::c_long = 4000 + 142; -pub const SYS_flock: ::c_long = 4000 + 143; -pub const SYS_msync: ::c_long = 4000 + 144; -pub const SYS_readv: ::c_long = 4000 + 145; -pub const SYS_writev: ::c_long = 4000 + 146; -pub const SYS_cacheflush: ::c_long = 4000 + 147; -pub const SYS_cachectl: ::c_long = 4000 + 148; -pub const SYS_sysmips: ::c_long = 4000 + 149; -pub const SYS_unused150: ::c_long = 4000 + 150; -pub const SYS_getsid: ::c_long = 4000 + 151; -pub const SYS_fdatasync: ::c_long = 4000 + 152; -pub const SYS__sysctl: ::c_long = 4000 + 153; -pub const SYS_mlock: ::c_long = 4000 + 154; -pub const SYS_munlock: ::c_long = 4000 + 155; -pub const SYS_mlockall: ::c_long = 4000 + 156; -pub const SYS_munlockall: ::c_long = 4000 + 157; -pub const SYS_sched_setparam: ::c_long = 4000 + 158; -pub const SYS_sched_getparam: ::c_long = 4000 + 159; -pub const SYS_sched_setscheduler: ::c_long = 4000 + 160; -pub const SYS_sched_getscheduler: ::c_long = 4000 + 161; -pub const SYS_sched_yield: ::c_long = 4000 + 162; -pub const SYS_sched_get_priority_max: ::c_long = 4000 + 163; -pub const SYS_sched_get_priority_min: ::c_long = 4000 + 164; -pub const SYS_sched_rr_get_interval: ::c_long = 4000 + 165; -pub const SYS_nanosleep: ::c_long = 4000 + 166; -pub const SYS_mremap: ::c_long = 4000 + 167; -pub const SYS_accept: ::c_long = 4000 + 168; -pub const SYS_bind: ::c_long = 4000 + 169; -pub const SYS_connect: ::c_long = 4000 + 170; -pub const SYS_getpeername: ::c_long = 4000 + 171; -pub const SYS_getsockname: ::c_long = 4000 + 172; -pub const SYS_getsockopt: ::c_long = 4000 + 173; -pub const SYS_listen: ::c_long = 4000 + 174; -pub const SYS_recv: ::c_long = 4000 + 175; -pub const SYS_recvfrom: ::c_long = 4000 + 176; -pub const SYS_recvmsg: ::c_long = 4000 + 177; -pub const SYS_send: ::c_long = 4000 + 178; -pub const SYS_sendmsg: ::c_long = 4000 + 179; -pub const SYS_sendto: ::c_long = 4000 + 180; -pub const SYS_setsockopt: ::c_long = 4000 + 181; -pub const SYS_shutdown: ::c_long = 4000 + 182; -pub const SYS_socket: ::c_long = 4000 + 183; -pub const SYS_socketpair: ::c_long = 4000 + 184; -pub const SYS_setresuid: ::c_long = 4000 + 185; -pub const SYS_getresuid: ::c_long = 4000 + 186; -pub const SYS_query_module: ::c_long = 4000 + 187; -pub const SYS_poll: ::c_long = 4000 + 188; -pub const SYS_nfsservctl: ::c_long = 4000 + 189; -pub const SYS_setresgid: ::c_long = 4000 + 190; -pub const SYS_getresgid: ::c_long = 4000 + 191; -pub const SYS_prctl: ::c_long = 4000 + 192; -pub const SYS_rt_sigreturn: ::c_long = 4000 + 193; -pub const SYS_rt_sigaction: ::c_long = 4000 + 194; -pub const SYS_rt_sigprocmask: ::c_long = 4000 + 195; -pub const SYS_rt_sigpending: ::c_long = 4000 + 196; -pub const SYS_rt_sigtimedwait: ::c_long = 4000 + 197; -pub const SYS_rt_sigqueueinfo: ::c_long = 4000 + 198; -pub const SYS_rt_sigsuspend: ::c_long = 4000 + 199; -pub const SYS_pread64: ::c_long = 4000 + 200; -pub const SYS_pwrite64: ::c_long = 4000 + 201; -pub const SYS_chown: ::c_long = 4000 + 202; -pub const SYS_getcwd: ::c_long = 4000 + 203; -pub const SYS_capget: ::c_long = 4000 + 204; -pub const SYS_capset: ::c_long = 4000 + 205; -pub const SYS_sigaltstack: ::c_long = 4000 + 206; -pub const SYS_sendfile: ::c_long = 4000 + 207; -pub const SYS_getpmsg: ::c_long = 4000 + 208; -pub const SYS_putpmsg: ::c_long = 4000 + 209; -pub const SYS_mmap2: ::c_long = 4000 + 210; -pub const SYS_truncate64: ::c_long = 4000 + 211; -pub const SYS_ftruncate64: ::c_long = 4000 + 212; -pub const SYS_stat64: ::c_long = 4000 + 213; -pub const SYS_lstat64: ::c_long = 4000 + 214; -pub const SYS_fstat64: ::c_long = 4000 + 215; -pub const SYS_pivot_root: ::c_long = 4000 + 216; -pub const SYS_mincore: ::c_long = 4000 + 217; -pub const SYS_madvise: ::c_long = 4000 + 218; -pub const SYS_getdents64: ::c_long = 4000 + 219; -pub const SYS_fcntl64: ::c_long = 4000 + 220; -pub const SYS_reserved221: ::c_long = 4000 + 221; -pub const SYS_gettid: ::c_long = 4000 + 222; -pub const SYS_readahead: ::c_long = 4000 + 223; -pub const SYS_setxattr: ::c_long = 4000 + 224; -pub const SYS_lsetxattr: ::c_long = 4000 + 225; -pub const SYS_fsetxattr: ::c_long = 4000 + 226; -pub const SYS_getxattr: ::c_long = 4000 + 227; -pub const SYS_lgetxattr: ::c_long = 4000 + 228; -pub const SYS_fgetxattr: ::c_long = 4000 + 229; -pub const SYS_listxattr: ::c_long = 4000 + 230; -pub const SYS_llistxattr: ::c_long = 4000 + 231; -pub const SYS_flistxattr: ::c_long = 4000 + 232; -pub const SYS_removexattr: ::c_long = 4000 + 233; -pub const SYS_lremovexattr: ::c_long = 4000 + 234; -pub const SYS_fremovexattr: ::c_long = 4000 + 235; -pub const SYS_tkill: ::c_long = 4000 + 236; -pub const SYS_sendfile64: ::c_long = 4000 + 237; -pub const SYS_futex: ::c_long = 4000 + 238; -pub const SYS_sched_setaffinity: ::c_long = 4000 + 239; -pub const SYS_sched_getaffinity: ::c_long = 4000 + 240; -pub const SYS_io_setup: ::c_long = 4000 + 241; -pub const SYS_io_destroy: ::c_long = 4000 + 242; -pub const SYS_io_getevents: ::c_long = 4000 + 243; -pub const SYS_io_submit: ::c_long = 4000 + 244; -pub const SYS_io_cancel: ::c_long = 4000 + 245; -pub const SYS_exit_group: ::c_long = 4000 + 246; -pub const SYS_lookup_dcookie: ::c_long = 4000 + 247; -pub const SYS_epoll_create: ::c_long = 4000 + 248; -pub const SYS_epoll_ctl: ::c_long = 4000 + 249; -pub const SYS_epoll_wait: ::c_long = 4000 + 250; -pub const SYS_remap_file_pages: ::c_long = 4000 + 251; -pub const SYS_set_tid_address: ::c_long = 4000 + 252; -pub const SYS_restart_syscall: ::c_long = 4000 + 253; -pub const SYS_fadvise64: ::c_long = 4000 + 254; -pub const SYS_statfs64: ::c_long = 4000 + 255; -pub const SYS_fstatfs64: ::c_long = 4000 + 256; -pub const SYS_timer_create: ::c_long = 4000 + 257; -pub const SYS_timer_settime: ::c_long = 4000 + 258; -pub const SYS_timer_gettime: ::c_long = 4000 + 259; -pub const SYS_timer_getoverrun: ::c_long = 4000 + 260; -pub const SYS_timer_delete: ::c_long = 4000 + 261; -pub const SYS_clock_settime: ::c_long = 4000 + 262; -pub const SYS_clock_gettime: ::c_long = 4000 + 263; -pub const SYS_clock_getres: ::c_long = 4000 + 264; -pub const SYS_clock_nanosleep: ::c_long = 4000 + 265; -pub const SYS_tgkill: ::c_long = 4000 + 266; -pub const SYS_utimes: ::c_long = 4000 + 267; -pub const SYS_mbind: ::c_long = 4000 + 268; -pub const SYS_get_mempolicy: ::c_long = 4000 + 269; -pub const SYS_set_mempolicy: ::c_long = 4000 + 270; -pub const SYS_mq_open: ::c_long = 4000 + 271; -pub const SYS_mq_unlink: ::c_long = 4000 + 272; -pub const SYS_mq_timedsend: ::c_long = 4000 + 273; -pub const SYS_mq_timedreceive: ::c_long = 4000 + 274; -pub const SYS_mq_notify: ::c_long = 4000 + 275; -pub const SYS_mq_getsetattr: ::c_long = 4000 + 276; -pub const SYS_vserver: ::c_long = 4000 + 277; -pub const SYS_waitid: ::c_long = 4000 + 278; -/* pub const SYS_sys_setaltroot: ::c_long = 4000 + 279; */ -pub const SYS_add_key: ::c_long = 4000 + 280; -pub const SYS_request_key: ::c_long = 4000 + 281; -pub const SYS_keyctl: ::c_long = 4000 + 282; -pub const SYS_set_thread_area: ::c_long = 4000 + 283; -pub const SYS_inotify_init: ::c_long = 4000 + 284; -pub const SYS_inotify_add_watch: ::c_long = 4000 + 285; -pub const SYS_inotify_rm_watch: ::c_long = 4000 + 286; -pub const SYS_migrate_pages: ::c_long = 4000 + 287; -pub const SYS_openat: ::c_long = 4000 + 288; -pub const SYS_mkdirat: ::c_long = 4000 + 289; -pub const SYS_mknodat: ::c_long = 4000 + 290; -pub const SYS_fchownat: ::c_long = 4000 + 291; -pub const SYS_futimesat: ::c_long = 4000 + 292; -pub const SYS_fstatat64: ::c_long = 4000 + 293; -pub const SYS_unlinkat: ::c_long = 4000 + 294; -pub const SYS_renameat: ::c_long = 4000 + 295; -pub const SYS_linkat: ::c_long = 4000 + 296; -pub const SYS_symlinkat: ::c_long = 4000 + 297; -pub const SYS_readlinkat: ::c_long = 4000 + 298; -pub const SYS_fchmodat: ::c_long = 4000 + 299; -pub const SYS_faccessat: ::c_long = 4000 + 300; -pub const SYS_pselect6: ::c_long = 4000 + 301; -pub const SYS_ppoll: ::c_long = 4000 + 302; -pub const SYS_unshare: ::c_long = 4000 + 303; -pub const SYS_splice: ::c_long = 4000 + 304; -pub const SYS_sync_file_range: ::c_long = 4000 + 305; -pub const SYS_tee: ::c_long = 4000 + 306; -pub const SYS_vmsplice: ::c_long = 4000 + 307; -pub const SYS_move_pages: ::c_long = 4000 + 308; -pub const SYS_set_robust_list: ::c_long = 4000 + 309; -pub const SYS_get_robust_list: ::c_long = 4000 + 310; -pub const SYS_kexec_load: ::c_long = 4000 + 311; -pub const SYS_getcpu: ::c_long = 4000 + 312; -pub const SYS_epoll_pwait: ::c_long = 4000 + 313; -pub const SYS_ioprio_set: ::c_long = 4000 + 314; -pub const SYS_ioprio_get: ::c_long = 4000 + 315; -pub const SYS_utimensat: ::c_long = 4000 + 316; -pub const SYS_signalfd: ::c_long = 4000 + 317; -pub const SYS_timerfd: ::c_long = 4000 + 318; -pub const SYS_eventfd: ::c_long = 4000 + 319; -pub const SYS_fallocate: ::c_long = 4000 + 320; -pub const SYS_timerfd_create: ::c_long = 4000 + 321; -pub const SYS_timerfd_gettime: ::c_long = 4000 + 322; -pub const SYS_timerfd_settime: ::c_long = 4000 + 323; -pub const SYS_signalfd4: ::c_long = 4000 + 324; -pub const SYS_eventfd2: ::c_long = 4000 + 325; -pub const SYS_epoll_create1: ::c_long = 4000 + 326; -pub const SYS_dup3: ::c_long = 4000 + 327; -pub const SYS_pipe2: ::c_long = 4000 + 328; -pub const SYS_inotify_init1: ::c_long = 4000 + 329; -pub const SYS_preadv: ::c_long = 4000 + 330; -pub const SYS_pwritev: ::c_long = 4000 + 331; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 4000 + 332; -pub const SYS_perf_event_open: ::c_long = 4000 + 333; -pub const SYS_accept4: ::c_long = 4000 + 334; -pub const SYS_recvmmsg: ::c_long = 4000 + 335; -pub const SYS_fanotify_init: ::c_long = 4000 + 336; -pub const SYS_fanotify_mark: ::c_long = 4000 + 337; -pub const SYS_prlimit64: ::c_long = 4000 + 338; -pub const SYS_name_to_handle_at: ::c_long = 4000 + 339; -pub const SYS_open_by_handle_at: ::c_long = 4000 + 340; -pub const SYS_clock_adjtime: ::c_long = 4000 + 341; -pub const SYS_syncfs: ::c_long = 4000 + 342; -pub const SYS_sendmmsg: ::c_long = 4000 + 343; -pub const SYS_setns: ::c_long = 4000 + 344; -pub const SYS_process_vm_readv: ::c_long = 4000 + 345; -pub const SYS_process_vm_writev: ::c_long = 4000 + 346; -pub const SYS_kcmp: ::c_long = 4000 + 347; -pub const SYS_finit_module: ::c_long = 4000 + 348; -pub const SYS_sched_setattr: ::c_long = 4000 + 349; -pub const SYS_sched_getattr: ::c_long = 4000 + 350; -pub const SYS_renameat2: ::c_long = 4000 + 351; -pub const SYS_seccomp: ::c_long = 4000 + 352; -pub const SYS_getrandom: ::c_long = 4000 + 353; -pub const SYS_memfd_create: ::c_long = 4000 + 354; -pub const SYS_bpf: ::c_long = 4000 + 355; -pub const SYS_execveat: ::c_long = 4000 + 356; -pub const SYS_userfaultfd: ::c_long = 4000 + 357; -pub const SYS_membarrier: ::c_long = 4000 + 358; -pub const SYS_mlock2: ::c_long = 4000 + 359; -pub const SYS_copy_file_range: ::c_long = 4000 + 360; -pub const SYS_preadv2: ::c_long = 4000 + 361; -pub const SYS_pwritev2: ::c_long = 4000 + 362; -pub const SYS_pkey_mprotect: ::c_long = 4000 + 363; -pub const SYS_pkey_alloc: ::c_long = 4000 + 364; -pub const SYS_pkey_free: ::c_long = 4000 + 365; diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/mips/mips64.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/mips/mips64.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/mips/mips64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/mips/mips64.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,647 +0,0 @@ -use pthread_mutex_t; - -pub type blkcnt_t = i64; -pub type blksize_t = i64; -pub type c_char = i8; -pub type c_long = i64; -pub type c_ulong = u64; -pub type ino_t = u64; -pub type nlink_t = u64; -pub type off_t = i64; -pub type suseconds_t = i64; -pub type time_t = i64; -pub type wchar_t = i32; -pub type clock_t = i64; -pub type __u64 = ::c_ulong; - -s! { - pub struct aiocb { - pub aio_fildes: ::c_int, - pub aio_lio_opcode: ::c_int, - pub aio_reqprio: ::c_int, - pub aio_buf: *mut ::c_void, - pub aio_nbytes: ::size_t, - pub aio_sigevent: ::sigevent, - __next_prio: *mut aiocb, - __abs_prio: ::c_int, - __policy: ::c_int, - __error_code: ::c_int, - __return_value: ::ssize_t, - pub aio_offset: off_t, - __glibc_reserved: [::c_char; 32] - } - - pub struct stat { - pub st_dev: ::c_ulong, - st_pad1: [::c_long; 2], - pub st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::c_ulong, - st_pad2: [::c_ulong; 1], - pub st_size: ::off_t, - st_pad3: ::c_long, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_blksize: ::blksize_t, - st_pad4: ::c_long, - pub st_blocks: ::blkcnt_t, - st_pad5: [::c_long; 7], - } - - pub struct stat64 { - pub st_dev: ::c_ulong, - st_pad1: [::c_long; 2], - pub st_ino: ::ino64_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::c_ulong, - st_pad2: [::c_long; 2], - pub st_size: ::off64_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_blksize: ::blksize_t, - st_pad3: ::c_long, - pub st_blocks: ::blkcnt64_t, - st_pad5: [::c_long; 7], - } - - pub struct statfs64 { - pub f_type: ::c_long, - pub f_bsize: ::c_long, - pub f_frsize: ::c_long, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_bavail: u64, - pub f_fsid: ::fsid_t, - pub f_namelen: ::c_long, - pub f_flags: ::c_long, - pub f_spare: [::c_long; 5], - } - - pub struct statvfs { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_favail: ::fsfilcnt_t, - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct statvfs64 { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_favail: u64, - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct pthread_attr_t { - __size: [::c_ulong; 7] - } - - pub struct sigaction { - pub sa_flags: ::c_int, - pub sa_sigaction: ::sighandler_t, - pub sa_mask: sigset_t, - pub sa_restorer: ::Option, - } - - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_size: ::size_t, - pub ss_flags: ::c_int, - } - - pub struct sigset_t { - __size: [::c_ulong; 16], - } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_code: ::c_int, - pub si_errno: ::c_int, - _pad: ::c_int, - _pad2: [::c_long; 14], - } - - pub struct ipc_perm { - pub __key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::c_uint, - pub __seq: ::c_ushort, - __pad1: ::c_ushort, - __unused1: ::c_ulong, - __unused2: ::c_ulong - } - - pub struct shmid_ds { - pub shm_perm: ::ipc_perm, - pub shm_segsz: ::size_t, - pub shm_atime: ::time_t, - pub shm_dtime: ::time_t, - pub shm_ctime: ::time_t, - pub shm_cpid: ::pid_t, - pub shm_lpid: ::pid_t, - pub shm_nattch: ::shmatt_t, - __unused4: ::c_ulong, - __unused5: ::c_ulong - } - - pub struct msqid_ds { - pub msg_perm: ::ipc_perm, - pub msg_stime: ::time_t, - pub msg_rtime: ::time_t, - pub msg_ctime: ::time_t, - __msg_cbytes: ::c_ulong, - pub msg_qnum: ::msgqnum_t, - pub msg_qbytes: ::msglen_t, - pub msg_lspid: ::pid_t, - pub msg_lrpid: ::pid_t, - __glibc_reserved4: ::c_ulong, - __glibc_reserved5: ::c_ulong, - } - - pub struct statfs { - pub f_type: ::c_long, - pub f_bsize: ::c_long, - pub f_frsize: ::c_long, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_files: ::fsblkcnt_t, - pub f_ffree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_fsid: ::fsid_t, - - pub f_namelen: ::c_long, - f_spare: [::c_long; 6], - } - - pub struct msghdr { - pub msg_name: *mut ::c_void, - pub msg_namelen: ::socklen_t, - pub msg_iov: *mut ::iovec, - pub msg_iovlen: ::size_t, - pub msg_control: *mut ::c_void, - pub msg_controllen: ::size_t, - pub msg_flags: ::c_int, - } - - pub struct cmsghdr { - pub cmsg_len: ::size_t, - pub cmsg_level: ::c_int, - pub cmsg_type: ::c_int, - } - - pub struct termios { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; ::NCCS], - } - - pub struct flock { - pub l_type: ::c_short, - pub l_whence: ::c_short, - pub l_start: ::off_t, - pub l_len: ::off_t, - pub l_pid: ::pid_t, - } - - pub struct sysinfo { - pub uptime: ::c_long, - pub loads: [::c_ulong; 3], - pub totalram: ::c_ulong, - pub freeram: ::c_ulong, - pub sharedram: ::c_ulong, - pub bufferram: ::c_ulong, - pub totalswap: ::c_ulong, - pub freeswap: ::c_ulong, - pub procs: ::c_ushort, - pub pad: ::c_ushort, - pub totalhigh: ::c_ulong, - pub freehigh: ::c_ulong, - pub mem_unit: ::c_uint, - pub _f: [::c_char; 0], - } -} - -pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; -pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; -pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; -pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; -pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; - -align_const! { - #[cfg(target_endian = "little")] - pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 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, 0, - ], - }; - #[cfg(target_endian = "little")] - pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }; - #[cfg(target_endian = "little")] - pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }; - #[cfg(target_endian = "big")] - pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 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, - ], - }; - #[cfg(target_endian = "big")] - pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }; - #[cfg(target_endian = "big")] - pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }; -} - -pub const O_LARGEFILE: ::c_int = 0; - -pub const RLIM_INFINITY: ::rlim_t = 0xffff_ffff_ffff_ffff; - -pub const SYS_read: ::c_long = 5000 + 0; -pub const SYS_write: ::c_long = 5000 + 1; -pub const SYS_open: ::c_long = 5000 + 2; -pub const SYS_close: ::c_long = 5000 + 3; -pub const SYS_stat: ::c_long = 5000 + 4; -pub const SYS_fstat: ::c_long = 5000 + 5; -pub const SYS_lstat: ::c_long = 5000 + 6; -pub const SYS_poll: ::c_long = 5000 + 7; -pub const SYS_lseek: ::c_long = 5000 + 8; -pub const SYS_mmap: ::c_long = 5000 + 9; -pub const SYS_mprotect: ::c_long = 5000 + 10; -pub const SYS_munmap: ::c_long = 5000 + 11; -pub const SYS_brk: ::c_long = 5000 + 12; -pub const SYS_rt_sigaction: ::c_long = 5000 + 13; -pub const SYS_rt_sigprocmask: ::c_long = 5000 + 14; -pub const SYS_ioctl: ::c_long = 5000 + 15; -pub const SYS_pread64: ::c_long = 5000 + 16; -pub const SYS_pwrite64: ::c_long = 5000 + 17; -pub const SYS_readv: ::c_long = 5000 + 18; -pub const SYS_writev: ::c_long = 5000 + 19; -pub const SYS_access: ::c_long = 5000 + 20; -pub const SYS_pipe: ::c_long = 5000 + 21; -pub const SYS__newselect: ::c_long = 5000 + 22; -pub const SYS_sched_yield: ::c_long = 5000 + 23; -pub const SYS_mremap: ::c_long = 5000 + 24; -pub const SYS_msync: ::c_long = 5000 + 25; -pub const SYS_mincore: ::c_long = 5000 + 26; -pub const SYS_madvise: ::c_long = 5000 + 27; -pub const SYS_shmget: ::c_long = 5000 + 28; -pub const SYS_shmat: ::c_long = 5000 + 29; -pub const SYS_shmctl: ::c_long = 5000 + 30; -pub const SYS_dup: ::c_long = 5000 + 31; -pub const SYS_dup2: ::c_long = 5000 + 32; -pub const SYS_pause: ::c_long = 5000 + 33; -pub const SYS_nanosleep: ::c_long = 5000 + 34; -pub const SYS_getitimer: ::c_long = 5000 + 35; -pub const SYS_setitimer: ::c_long = 5000 + 36; -pub const SYS_alarm: ::c_long = 5000 + 37; -pub const SYS_getpid: ::c_long = 5000 + 38; -pub const SYS_sendfile: ::c_long = 5000 + 39; -pub const SYS_socket: ::c_long = 5000 + 40; -pub const SYS_connect: ::c_long = 5000 + 41; -pub const SYS_accept: ::c_long = 5000 + 42; -pub const SYS_sendto: ::c_long = 5000 + 43; -pub const SYS_recvfrom: ::c_long = 5000 + 44; -pub const SYS_sendmsg: ::c_long = 5000 + 45; -pub const SYS_recvmsg: ::c_long = 5000 + 46; -pub const SYS_shutdown: ::c_long = 5000 + 47; -pub const SYS_bind: ::c_long = 5000 + 48; -pub const SYS_listen: ::c_long = 5000 + 49; -pub const SYS_getsockname: ::c_long = 5000 + 50; -pub const SYS_getpeername: ::c_long = 5000 + 51; -pub const SYS_socketpair: ::c_long = 5000 + 52; -pub const SYS_setsockopt: ::c_long = 5000 + 53; -pub const SYS_getsockopt: ::c_long = 5000 + 54; -pub const SYS_clone: ::c_long = 5000 + 55; -pub const SYS_fork: ::c_long = 5000 + 56; -pub const SYS_execve: ::c_long = 5000 + 57; -pub const SYS_exit: ::c_long = 5000 + 58; -pub const SYS_wait4: ::c_long = 5000 + 59; -pub const SYS_kill: ::c_long = 5000 + 60; -pub const SYS_uname: ::c_long = 5000 + 61; -pub const SYS_semget: ::c_long = 5000 + 62; -pub const SYS_semop: ::c_long = 5000 + 63; -pub const SYS_semctl: ::c_long = 5000 + 64; -pub const SYS_shmdt: ::c_long = 5000 + 65; -pub const SYS_msgget: ::c_long = 5000 + 66; -pub const SYS_msgsnd: ::c_long = 5000 + 67; -pub const SYS_msgrcv: ::c_long = 5000 + 68; -pub const SYS_msgctl: ::c_long = 5000 + 69; -pub const SYS_fcntl: ::c_long = 5000 + 70; -pub const SYS_flock: ::c_long = 5000 + 71; -pub const SYS_fsync: ::c_long = 5000 + 72; -pub const SYS_fdatasync: ::c_long = 5000 + 73; -pub const SYS_truncate: ::c_long = 5000 + 74; -pub const SYS_ftruncate: ::c_long = 5000 + 75; -pub const SYS_getdents: ::c_long = 5000 + 76; -pub const SYS_getcwd: ::c_long = 5000 + 77; -pub const SYS_chdir: ::c_long = 5000 + 78; -pub const SYS_fchdir: ::c_long = 5000 + 79; -pub const SYS_rename: ::c_long = 5000 + 80; -pub const SYS_mkdir: ::c_long = 5000 + 81; -pub const SYS_rmdir: ::c_long = 5000 + 82; -pub const SYS_creat: ::c_long = 5000 + 83; -pub const SYS_link: ::c_long = 5000 + 84; -pub const SYS_unlink: ::c_long = 5000 + 85; -pub const SYS_symlink: ::c_long = 5000 + 86; -pub const SYS_readlink: ::c_long = 5000 + 87; -pub const SYS_chmod: ::c_long = 5000 + 88; -pub const SYS_fchmod: ::c_long = 5000 + 89; -pub const SYS_chown: ::c_long = 5000 + 90; -pub const SYS_fchown: ::c_long = 5000 + 91; -pub const SYS_lchown: ::c_long = 5000 + 92; -pub const SYS_umask: ::c_long = 5000 + 93; -pub const SYS_gettimeofday: ::c_long = 5000 + 94; -pub const SYS_getrlimit: ::c_long = 5000 + 95; -pub const SYS_getrusage: ::c_long = 5000 + 96; -pub const SYS_sysinfo: ::c_long = 5000 + 97; -pub const SYS_times: ::c_long = 5000 + 98; -pub const SYS_ptrace: ::c_long = 5000 + 99; -pub const SYS_getuid: ::c_long = 5000 + 100; -pub const SYS_syslog: ::c_long = 5000 + 101; -pub const SYS_getgid: ::c_long = 5000 + 102; -pub const SYS_setuid: ::c_long = 5000 + 103; -pub const SYS_setgid: ::c_long = 5000 + 104; -pub const SYS_geteuid: ::c_long = 5000 + 105; -pub const SYS_getegid: ::c_long = 5000 + 106; -pub const SYS_setpgid: ::c_long = 5000 + 107; -pub const SYS_getppid: ::c_long = 5000 + 108; -pub const SYS_getpgrp: ::c_long = 5000 + 109; -pub const SYS_setsid: ::c_long = 5000 + 110; -pub const SYS_setreuid: ::c_long = 5000 + 111; -pub const SYS_setregid: ::c_long = 5000 + 112; -pub const SYS_getgroups: ::c_long = 5000 + 113; -pub const SYS_setgroups: ::c_long = 5000 + 114; -pub const SYS_setresuid: ::c_long = 5000 + 115; -pub const SYS_getresuid: ::c_long = 5000 + 116; -pub const SYS_setresgid: ::c_long = 5000 + 117; -pub const SYS_getresgid: ::c_long = 5000 + 118; -pub const SYS_getpgid: ::c_long = 5000 + 119; -pub const SYS_setfsuid: ::c_long = 5000 + 120; -pub const SYS_setfsgid: ::c_long = 5000 + 121; -pub const SYS_getsid: ::c_long = 5000 + 122; -pub const SYS_capget: ::c_long = 5000 + 123; -pub const SYS_capset: ::c_long = 5000 + 124; -pub const SYS_rt_sigpending: ::c_long = 5000 + 125; -pub const SYS_rt_sigtimedwait: ::c_long = 5000 + 126; -pub const SYS_rt_sigqueueinfo: ::c_long = 5000 + 127; -pub const SYS_rt_sigsuspend: ::c_long = 5000 + 128; -pub const SYS_sigaltstack: ::c_long = 5000 + 129; -pub const SYS_utime: ::c_long = 5000 + 130; -pub const SYS_mknod: ::c_long = 5000 + 131; -pub const SYS_personality: ::c_long = 5000 + 132; -pub const SYS_ustat: ::c_long = 5000 + 133; -pub const SYS_statfs: ::c_long = 5000 + 134; -pub const SYS_fstatfs: ::c_long = 5000 + 135; -pub const SYS_sysfs: ::c_long = 5000 + 136; -pub const SYS_getpriority: ::c_long = 5000 + 137; -pub const SYS_setpriority: ::c_long = 5000 + 138; -pub const SYS_sched_setparam: ::c_long = 5000 + 139; -pub const SYS_sched_getparam: ::c_long = 5000 + 140; -pub const SYS_sched_setscheduler: ::c_long = 5000 + 141; -pub const SYS_sched_getscheduler: ::c_long = 5000 + 142; -pub const SYS_sched_get_priority_max: ::c_long = 5000 + 143; -pub const SYS_sched_get_priority_min: ::c_long = 5000 + 144; -pub const SYS_sched_rr_get_interval: ::c_long = 5000 + 145; -pub const SYS_mlock: ::c_long = 5000 + 146; -pub const SYS_munlock: ::c_long = 5000 + 147; -pub const SYS_mlockall: ::c_long = 5000 + 148; -pub const SYS_munlockall: ::c_long = 5000 + 149; -pub const SYS_vhangup: ::c_long = 5000 + 150; -pub const SYS_pivot_root: ::c_long = 5000 + 151; -pub const SYS__sysctl: ::c_long = 5000 + 152; -pub const SYS_prctl: ::c_long = 5000 + 153; -pub const SYS_adjtimex: ::c_long = 5000 + 154; -pub const SYS_setrlimit: ::c_long = 5000 + 155; -pub const SYS_chroot: ::c_long = 5000 + 156; -pub const SYS_sync: ::c_long = 5000 + 157; -pub const SYS_acct: ::c_long = 5000 + 158; -pub const SYS_settimeofday: ::c_long = 5000 + 159; -pub const SYS_mount: ::c_long = 5000 + 160; -pub const SYS_umount2: ::c_long = 5000 + 161; -pub const SYS_swapon: ::c_long = 5000 + 162; -pub const SYS_swapoff: ::c_long = 5000 + 163; -pub const SYS_reboot: ::c_long = 5000 + 164; -pub const SYS_sethostname: ::c_long = 5000 + 165; -pub const SYS_setdomainname: ::c_long = 5000 + 166; -pub const SYS_create_module: ::c_long = 5000 + 167; -pub const SYS_init_module: ::c_long = 5000 + 168; -pub const SYS_delete_module: ::c_long = 5000 + 169; -pub const SYS_get_kernel_syms: ::c_long = 5000 + 170; -pub const SYS_query_module: ::c_long = 5000 + 171; -pub const SYS_quotactl: ::c_long = 5000 + 172; -pub const SYS_nfsservctl: ::c_long = 5000 + 173; -pub const SYS_getpmsg: ::c_long = 5000 + 174; -pub const SYS_putpmsg: ::c_long = 5000 + 175; -pub const SYS_afs_syscall: ::c_long = 5000 + 176; -pub const SYS_reserved177: ::c_long = 5000 + 177; -pub const SYS_gettid: ::c_long = 5000 + 178; -pub const SYS_readahead: ::c_long = 5000 + 179; -pub const SYS_setxattr: ::c_long = 5000 + 180; -pub const SYS_lsetxattr: ::c_long = 5000 + 181; -pub const SYS_fsetxattr: ::c_long = 5000 + 182; -pub const SYS_getxattr: ::c_long = 5000 + 183; -pub const SYS_lgetxattr: ::c_long = 5000 + 184; -pub const SYS_fgetxattr: ::c_long = 5000 + 185; -pub const SYS_listxattr: ::c_long = 5000 + 186; -pub const SYS_llistxattr: ::c_long = 5000 + 187; -pub const SYS_flistxattr: ::c_long = 5000 + 188; -pub const SYS_removexattr: ::c_long = 5000 + 189; -pub const SYS_lremovexattr: ::c_long = 5000 + 190; -pub const SYS_fremovexattr: ::c_long = 5000 + 191; -pub const SYS_tkill: ::c_long = 5000 + 192; -pub const SYS_reserved193: ::c_long = 5000 + 193; -pub const SYS_futex: ::c_long = 5000 + 194; -pub const SYS_sched_setaffinity: ::c_long = 5000 + 195; -pub const SYS_sched_getaffinity: ::c_long = 5000 + 196; -pub const SYS_cacheflush: ::c_long = 5000 + 197; -pub const SYS_cachectl: ::c_long = 5000 + 198; -pub const SYS_sysmips: ::c_long = 5000 + 199; -pub const SYS_io_setup: ::c_long = 5000 + 200; -pub const SYS_io_destroy: ::c_long = 5000 + 201; -pub const SYS_io_getevents: ::c_long = 5000 + 202; -pub const SYS_io_submit: ::c_long = 5000 + 203; -pub const SYS_io_cancel: ::c_long = 5000 + 204; -pub const SYS_exit_group: ::c_long = 5000 + 205; -pub const SYS_lookup_dcookie: ::c_long = 5000 + 206; -pub const SYS_epoll_create: ::c_long = 5000 + 207; -pub const SYS_epoll_ctl: ::c_long = 5000 + 208; -pub const SYS_epoll_wait: ::c_long = 5000 + 209; -pub const SYS_remap_file_pages: ::c_long = 5000 + 210; -pub const SYS_rt_sigreturn: ::c_long = 5000 + 211; -pub const SYS_set_tid_address: ::c_long = 5000 + 212; -pub const SYS_restart_syscall: ::c_long = 5000 + 213; -pub const SYS_semtimedop: ::c_long = 5000 + 214; -pub const SYS_fadvise64: ::c_long = 5000 + 215; -pub const SYS_timer_create: ::c_long = 5000 + 216; -pub const SYS_timer_settime: ::c_long = 5000 + 217; -pub const SYS_timer_gettime: ::c_long = 5000 + 218; -pub const SYS_timer_getoverrun: ::c_long = 5000 + 219; -pub const SYS_timer_delete: ::c_long = 5000 + 220; -pub const SYS_clock_settime: ::c_long = 5000 + 221; -pub const SYS_clock_gettime: ::c_long = 5000 + 222; -pub const SYS_clock_getres: ::c_long = 5000 + 223; -pub const SYS_clock_nanosleep: ::c_long = 5000 + 224; -pub const SYS_tgkill: ::c_long = 5000 + 225; -pub const SYS_utimes: ::c_long = 5000 + 226; -pub const SYS_mbind: ::c_long = 5000 + 227; -pub const SYS_get_mempolicy: ::c_long = 5000 + 228; -pub const SYS_set_mempolicy: ::c_long = 5000 + 229; -pub const SYS_mq_open: ::c_long = 5000 + 230; -pub const SYS_mq_unlink: ::c_long = 5000 + 231; -pub const SYS_mq_timedsend: ::c_long = 5000 + 232; -pub const SYS_mq_timedreceive: ::c_long = 5000 + 233; -pub const SYS_mq_notify: ::c_long = 5000 + 234; -pub const SYS_mq_getsetattr: ::c_long = 5000 + 235; -pub const SYS_vserver: ::c_long = 5000 + 236; -pub const SYS_waitid: ::c_long = 5000 + 237; -/* pub const SYS_sys_setaltroot: ::c_long = 5000 + 238; */ -pub const SYS_add_key: ::c_long = 5000 + 239; -pub const SYS_request_key: ::c_long = 5000 + 240; -pub const SYS_keyctl: ::c_long = 5000 + 241; -pub const SYS_set_thread_area: ::c_long = 5000 + 242; -pub const SYS_inotify_init: ::c_long = 5000 + 243; -pub const SYS_inotify_add_watch: ::c_long = 5000 + 244; -pub const SYS_inotify_rm_watch: ::c_long = 5000 + 245; -pub const SYS_migrate_pages: ::c_long = 5000 + 246; -pub const SYS_openat: ::c_long = 5000 + 247; -pub const SYS_mkdirat: ::c_long = 5000 + 248; -pub const SYS_mknodat: ::c_long = 5000 + 249; -pub const SYS_fchownat: ::c_long = 5000 + 250; -pub const SYS_futimesat: ::c_long = 5000 + 251; -pub const SYS_newfstatat: ::c_long = 5000 + 252; -pub const SYS_unlinkat: ::c_long = 5000 + 253; -pub const SYS_renameat: ::c_long = 5000 + 254; -pub const SYS_linkat: ::c_long = 5000 + 255; -pub const SYS_symlinkat: ::c_long = 5000 + 256; -pub const SYS_readlinkat: ::c_long = 5000 + 257; -pub const SYS_fchmodat: ::c_long = 5000 + 258; -pub const SYS_faccessat: ::c_long = 5000 + 259; -pub const SYS_pselect6: ::c_long = 5000 + 260; -pub const SYS_ppoll: ::c_long = 5000 + 261; -pub const SYS_unshare: ::c_long = 5000 + 262; -pub const SYS_splice: ::c_long = 5000 + 263; -pub const SYS_sync_file_range: ::c_long = 5000 + 264; -pub const SYS_tee: ::c_long = 5000 + 265; -pub const SYS_vmsplice: ::c_long = 5000 + 266; -pub const SYS_move_pages: ::c_long = 5000 + 267; -pub const SYS_set_robust_list: ::c_long = 5000 + 268; -pub const SYS_get_robust_list: ::c_long = 5000 + 269; -pub const SYS_kexec_load: ::c_long = 5000 + 270; -pub const SYS_getcpu: ::c_long = 5000 + 271; -pub const SYS_epoll_pwait: ::c_long = 5000 + 272; -pub const SYS_ioprio_set: ::c_long = 5000 + 273; -pub const SYS_ioprio_get: ::c_long = 5000 + 274; -pub const SYS_utimensat: ::c_long = 5000 + 275; -pub const SYS_signalfd: ::c_long = 5000 + 276; -pub const SYS_timerfd: ::c_long = 5000 + 277; -pub const SYS_eventfd: ::c_long = 5000 + 278; -pub const SYS_fallocate: ::c_long = 5000 + 279; -pub const SYS_timerfd_create: ::c_long = 5000 + 280; -pub const SYS_timerfd_gettime: ::c_long = 5000 + 281; -pub const SYS_timerfd_settime: ::c_long = 5000 + 282; -pub const SYS_signalfd4: ::c_long = 5000 + 283; -pub const SYS_eventfd2: ::c_long = 5000 + 284; -pub const SYS_epoll_create1: ::c_long = 5000 + 285; -pub const SYS_dup3: ::c_long = 5000 + 286; -pub const SYS_pipe2: ::c_long = 5000 + 287; -pub const SYS_inotify_init1: ::c_long = 5000 + 288; -pub const SYS_preadv: ::c_long = 5000 + 289; -pub const SYS_pwritev: ::c_long = 5000 + 290; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 5000 + 291; -pub const SYS_perf_event_open: ::c_long = 5000 + 292; -pub const SYS_accept4: ::c_long = 5000 + 293; -pub const SYS_recvmmsg: ::c_long = 5000 + 294; -pub const SYS_fanotify_init: ::c_long = 5000 + 295; -pub const SYS_fanotify_mark: ::c_long = 5000 + 296; -pub const SYS_prlimit64: ::c_long = 5000 + 297; -pub const SYS_name_to_handle_at: ::c_long = 5000 + 298; -pub const SYS_open_by_handle_at: ::c_long = 5000 + 299; -pub const SYS_clock_adjtime: ::c_long = 5000 + 300; -pub const SYS_syncfs: ::c_long = 5000 + 301; -pub const SYS_sendmmsg: ::c_long = 5000 + 302; -pub const SYS_setns: ::c_long = 5000 + 303; -pub const SYS_process_vm_readv: ::c_long = 5000 + 304; -pub const SYS_process_vm_writev: ::c_long = 5000 + 305; -pub const SYS_kcmp: ::c_long = 5000 + 306; -pub const SYS_finit_module: ::c_long = 5000 + 307; -pub const SYS_getdents64: ::c_long = 5000 + 308; -pub const SYS_sched_setattr: ::c_long = 5000 + 309; -pub const SYS_sched_getattr: ::c_long = 5000 + 310; -pub const SYS_renameat2: ::c_long = 5000 + 311; -pub const SYS_seccomp: ::c_long = 5000 + 312; -pub const SYS_getrandom: ::c_long = 5000 + 313; -pub const SYS_memfd_create: ::c_long = 5000 + 314; -pub const SYS_bpf: ::c_long = 5000 + 315; -pub const SYS_execveat: ::c_long = 5000 + 316; -pub const SYS_userfaultfd: ::c_long = 5000 + 317; -pub const SYS_membarrier: ::c_long = 5000 + 318; -pub const SYS_mlock2: ::c_long = 5000 + 319; -pub const SYS_copy_file_range: ::c_long = 5000 + 320; -pub const SYS_preadv2: ::c_long = 5000 + 321; -pub const SYS_pwritev2: ::c_long = 5000 + 322; -pub const SYS_pkey_mprotect: ::c_long = 5000 + 323; -pub const SYS_pkey_alloc: ::c_long = 5000 + 324; -pub const SYS_pkey_free: ::c_long = 5000 + 325; diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/mips/mod.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/mips/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/mips/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/mips/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,960 +0,0 @@ -pub type shmatt_t = ::c_ulong; -pub type msgqnum_t = ::c_ulong; -pub type msglen_t = ::c_ulong; -pub type fsblkcnt_t = ::c_ulong; -pub type fsfilcnt_t = ::c_ulong; -pub type rlim_t = c_ulong; -pub type __priority_which_t = ::c_uint; - -s! { - pub struct glob64_t { - pub gl_pathc: ::size_t, - pub gl_pathv: *mut *mut ::c_char, - pub gl_offs: ::size_t, - pub gl_flags: ::c_int, - - __unused1: *mut ::c_void, - __unused2: *mut ::c_void, - __unused3: *mut ::c_void, - __unused4: *mut ::c_void, - __unused5: *mut ::c_void, - } - - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 23], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } - - pub struct nlmsghdr { - pub nlmsg_len: u32, - pub nlmsg_type: u16, - pub nlmsg_flags: u16, - pub nlmsg_seq: u32, - pub nlmsg_pid: u32, - } - - pub struct nlmsgerr { - pub error: ::c_int, - pub msg: nlmsghdr, - } - - pub struct nl_pktinfo { - pub group: u32, - } - - pub struct nl_mmap_req { - pub nm_block_size: ::c_uint, - pub nm_block_nr: ::c_uint, - pub nm_frame_size: ::c_uint, - pub nm_frame_nr: ::c_uint, - } - - pub struct nl_mmap_hdr { - pub nm_status: ::c_uint, - pub nm_len: ::c_uint, - pub nm_group: u32, - pub nm_pid: u32, - pub nm_uid: u32, - pub nm_gid: u32, - } - - pub struct nlattr { - pub nla_len: u16, - pub nla_type: u16, - } -} - -pub const SFD_CLOEXEC: ::c_int = 0x080000; - -pub const NCCS: usize = 32; - -pub const O_TRUNC: ::c_int = 512; - -pub const O_NOATIME: ::c_int = 0o1000000; -pub const O_CLOEXEC: ::c_int = 0x80000; -pub const O_PATH: ::c_int = 0o10000000; -pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; - -pub const EBFONT: ::c_int = 59; -pub const ENOSTR: ::c_int = 60; -pub const ENODATA: ::c_int = 61; -pub const ETIME: ::c_int = 62; -pub const ENOSR: ::c_int = 63; -pub const ENONET: ::c_int = 64; -pub const ENOPKG: ::c_int = 65; -pub const EREMOTE: ::c_int = 66; -pub const ENOLINK: ::c_int = 67; -pub const EADV: ::c_int = 68; -pub const ESRMNT: ::c_int = 69; -pub const ECOMM: ::c_int = 70; -pub const EPROTO: ::c_int = 71; -pub const EDOTDOT: ::c_int = 73; - -pub const SA_NODEFER: ::c_int = 0x40000000; -pub const SA_RESETHAND: ::c_int = 0x80000000; -pub const SA_RESTART: ::c_int = 0x10000000; -pub const SA_NOCLDSTOP: ::c_int = 0x00000001; - -pub const EPOLL_CLOEXEC: ::c_int = 0x80000; - -pub const EFD_CLOEXEC: ::c_int = 0x80000; - -pub const BUFSIZ: ::c_uint = 8192; -pub const TMP_MAX: ::c_uint = 238328; -pub const FOPEN_MAX: ::c_uint = 16; -pub const POSIX_FADV_DONTNEED: ::c_int = 4; -pub const POSIX_FADV_NOREUSE: ::c_int = 5; -pub const POSIX_MADV_DONTNEED: ::c_int = 4; -pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41; -pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45; -pub const _SC_PII: ::c_int = 53; -pub const _SC_PII_XTI: ::c_int = 54; -pub const _SC_PII_SOCKET: ::c_int = 55; -pub const _SC_PII_INTERNET: ::c_int = 56; -pub const _SC_PII_OSI: ::c_int = 57; -pub const _SC_POLL: ::c_int = 58; -pub const _SC_SELECT: ::c_int = 59; -pub const _SC_PII_INTERNET_STREAM: ::c_int = 61; -pub const _SC_PII_INTERNET_DGRAM: ::c_int = 62; -pub const _SC_PII_OSI_COTS: ::c_int = 63; -pub const _SC_PII_OSI_CLTS: ::c_int = 64; -pub const _SC_PII_OSI_M: ::c_int = 65; -pub const _SC_T_IOV_MAX: ::c_int = 66; -pub const _SC_2_C_VERSION: ::c_int = 96; -pub const _SC_CHAR_BIT: ::c_int = 101; -pub const _SC_CHAR_MAX: ::c_int = 102; -pub const _SC_CHAR_MIN: ::c_int = 103; -pub const _SC_INT_MAX: ::c_int = 104; -pub const _SC_INT_MIN: ::c_int = 105; -pub const _SC_LONG_BIT: ::c_int = 106; -pub const _SC_WORD_BIT: ::c_int = 107; -pub const _SC_MB_LEN_MAX: ::c_int = 108; -pub const _SC_SSIZE_MAX: ::c_int = 110; -pub const _SC_SCHAR_MAX: ::c_int = 111; -pub const _SC_SCHAR_MIN: ::c_int = 112; -pub const _SC_SHRT_MAX: ::c_int = 113; -pub const _SC_SHRT_MIN: ::c_int = 114; -pub const _SC_UCHAR_MAX: ::c_int = 115; -pub const _SC_UINT_MAX: ::c_int = 116; -pub const _SC_ULONG_MAX: ::c_int = 117; -pub const _SC_USHRT_MAX: ::c_int = 118; -pub const _SC_NL_ARGMAX: ::c_int = 119; -pub const _SC_NL_LANGMAX: ::c_int = 120; -pub const _SC_NL_MSGMAX: ::c_int = 121; -pub const _SC_NL_NMAX: ::c_int = 122; -pub const _SC_NL_SETMAX: ::c_int = 123; -pub const _SC_NL_TEXTMAX: ::c_int = 124; -pub const _SC_BASE: ::c_int = 134; -pub const _SC_C_LANG_SUPPORT: ::c_int = 135; -pub const _SC_C_LANG_SUPPORT_R: ::c_int = 136; -pub const _SC_DEVICE_IO: ::c_int = 140; -pub const _SC_DEVICE_SPECIFIC: ::c_int = 141; -pub const _SC_DEVICE_SPECIFIC_R: ::c_int = 142; -pub const _SC_FD_MGMT: ::c_int = 143; -pub const _SC_FIFO: ::c_int = 144; -pub const _SC_PIPE: ::c_int = 145; -pub const _SC_FILE_ATTRIBUTES: ::c_int = 146; -pub const _SC_FILE_LOCKING: ::c_int = 147; -pub const _SC_FILE_SYSTEM: ::c_int = 148; -pub const _SC_MULTI_PROCESS: ::c_int = 150; -pub const _SC_SINGLE_PROCESS: ::c_int = 151; -pub const _SC_NETWORKING: ::c_int = 152; -pub const _SC_REGEX_VERSION: ::c_int = 156; -pub const _SC_SIGNALS: ::c_int = 158; -pub const _SC_SYSTEM_DATABASE: ::c_int = 162; -pub const _SC_SYSTEM_DATABASE_R: ::c_int = 163; -pub const _SC_USER_GROUPS: ::c_int = 166; -pub const _SC_USER_GROUPS_R: ::c_int = 167; -pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 185; -pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 186; -pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 187; -pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 188; -pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 189; -pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 190; -pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 191; -pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 192; -pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 193; -pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 194; -pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 195; -pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 196; -pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 197; -pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 198; -pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 199; -pub const O_ACCMODE: ::c_int = 3; -pub const O_DIRECT: ::c_int = 0x8000; -pub const O_DIRECTORY: ::c_int = 0x10000; -pub const O_NOFOLLOW: ::c_int = 0x20000; -pub const ST_RELATIME: ::c_ulong = 4096; -pub const NI_MAXHOST: ::socklen_t = 1025; - -pub const RLIMIT_NOFILE: ::c_int = 5; -pub const RLIMIT_AS: ::c_int = 6; -pub const RLIMIT_RSS: ::c_int = 7; -pub const RLIMIT_NPROC: ::c_int = 8; -pub const RLIMIT_MEMLOCK: ::c_int = 9; -pub const RLIMIT_NLIMITS: ::c_int = 16; - -pub const O_APPEND: ::c_int = 8; -pub const O_CREAT: ::c_int = 256; -pub const O_EXCL: ::c_int = 1024; -pub const O_NOCTTY: ::c_int = 2048; -pub const O_NONBLOCK: ::c_int = 128; -pub const O_SYNC: ::c_int = 0x4010; -pub const O_RSYNC: ::c_int = 0x4010; -pub const O_DSYNC: ::c_int = 0x10; -pub const O_FSYNC: ::c_int = 0x4010; -pub const O_ASYNC: ::c_int = 0x1000; -pub const O_NDELAY: ::c_int = 0x80; - -pub const SOCK_NONBLOCK: ::c_int = 128; - -pub const EDEADLK: ::c_int = 45; -pub const ENAMETOOLONG: ::c_int = 78; -pub const ENOLCK: ::c_int = 46; -pub const ENOSYS: ::c_int = 89; -pub const ENOTEMPTY: ::c_int = 93; -pub const ELOOP: ::c_int = 90; -pub const ENOMSG: ::c_int = 35; -pub const EIDRM: ::c_int = 36; -pub const ECHRNG: ::c_int = 37; -pub const EL2NSYNC: ::c_int = 38; -pub const EL3HLT: ::c_int = 39; -pub const EL3RST: ::c_int = 40; -pub const ELNRNG: ::c_int = 41; -pub const EUNATCH: ::c_int = 42; -pub const ENOCSI: ::c_int = 43; -pub const EL2HLT: ::c_int = 44; -pub const EBADE: ::c_int = 50; -pub const EBADR: ::c_int = 51; -pub const EXFULL: ::c_int = 52; -pub const ENOANO: ::c_int = 53; -pub const EBADRQC: ::c_int = 54; -pub const EBADSLT: ::c_int = 55; -pub const EDEADLOCK: ::c_int = 56; -pub const EMULTIHOP: ::c_int = 74; -pub const EOVERFLOW: ::c_int = 79; -pub const ENOTUNIQ: ::c_int = 80; -pub const EBADFD: ::c_int = 81; -pub const EBADMSG: ::c_int = 77; -pub const EREMCHG: ::c_int = 82; -pub const ELIBACC: ::c_int = 83; -pub const ELIBBAD: ::c_int = 84; -pub const ELIBSCN: ::c_int = 85; -pub const ELIBMAX: ::c_int = 86; -pub const ELIBEXEC: ::c_int = 87; -pub const EILSEQ: ::c_int = 88; -pub const ERESTART: ::c_int = 91; -pub const ESTRPIPE: ::c_int = 92; -pub const EUSERS: ::c_int = 94; -pub const ENOTSOCK: ::c_int = 95; -pub const EDESTADDRREQ: ::c_int = 96; -pub const EMSGSIZE: ::c_int = 97; -pub const EPROTOTYPE: ::c_int = 98; -pub const ENOPROTOOPT: ::c_int = 99; -pub const EPROTONOSUPPORT: ::c_int = 120; -pub const ESOCKTNOSUPPORT: ::c_int = 121; -pub const EOPNOTSUPP: ::c_int = 122; -pub const ENOTSUP: ::c_int = EOPNOTSUPP; -pub const EPFNOSUPPORT: ::c_int = 123; -pub const EAFNOSUPPORT: ::c_int = 124; -pub const EADDRINUSE: ::c_int = 125; -pub const EADDRNOTAVAIL: ::c_int = 126; -pub const ENETDOWN: ::c_int = 127; -pub const ENETUNREACH: ::c_int = 128; -pub const ENETRESET: ::c_int = 129; -pub const ECONNABORTED: ::c_int = 130; -pub const ECONNRESET: ::c_int = 131; -pub const ENOBUFS: ::c_int = 132; -pub const EISCONN: ::c_int = 133; -pub const ENOTCONN: ::c_int = 134; -pub const ESHUTDOWN: ::c_int = 143; -pub const ETOOMANYREFS: ::c_int = 144; -pub const ETIMEDOUT: ::c_int = 145; -pub const ECONNREFUSED: ::c_int = 146; -pub const EHOSTDOWN: ::c_int = 147; -pub const EHOSTUNREACH: ::c_int = 148; -pub const EALREADY: ::c_int = 149; -pub const EINPROGRESS: ::c_int = 150; -pub const ESTALE: ::c_int = 151; -pub const EUCLEAN: ::c_int = 135; -pub const ENOTNAM: ::c_int = 137; -pub const ENAVAIL: ::c_int = 138; -pub const EISNAM: ::c_int = 139; -pub const EREMOTEIO: ::c_int = 140; -pub const EDQUOT: ::c_int = 1133; -pub const ENOMEDIUM: ::c_int = 159; -pub const EMEDIUMTYPE: ::c_int = 160; -pub const ECANCELED: ::c_int = 158; -pub const ENOKEY: ::c_int = 161; -pub const EKEYEXPIRED: ::c_int = 162; -pub const EKEYREVOKED: ::c_int = 163; -pub const EKEYREJECTED: ::c_int = 164; -pub const EOWNERDEAD: ::c_int = 165; -pub const ENOTRECOVERABLE: ::c_int = 166; -pub const ERFKILL: ::c_int = 167; - -pub const LC_PAPER: ::c_int = 7; -pub const LC_NAME: ::c_int = 8; -pub const LC_ADDRESS: ::c_int = 9; -pub const LC_TELEPHONE: ::c_int = 10; -pub const LC_MEASUREMENT: ::c_int = 11; -pub const LC_IDENTIFICATION: ::c_int = 12; -pub const LC_PAPER_MASK: ::c_int = (1 << LC_PAPER); -pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME); -pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS); -pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE); -pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT); -pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION); -pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK - | ::LC_NUMERIC_MASK - | ::LC_TIME_MASK - | ::LC_COLLATE_MASK - | ::LC_MONETARY_MASK - | ::LC_MESSAGES_MASK - | LC_PAPER_MASK - | LC_NAME_MASK - | LC_ADDRESS_MASK - | LC_TELEPHONE_MASK - | LC_MEASUREMENT_MASK - | LC_IDENTIFICATION_MASK; - -pub const MAP_NORESERVE: ::c_int = 0x400; -pub const MAP_ANON: ::c_int = 0x800; -pub const MAP_ANONYMOUS: ::c_int = 0x800; -pub const MAP_GROWSDOWN: ::c_int = 0x1000; -pub const MAP_DENYWRITE: ::c_int = 0x2000; -pub const MAP_EXECUTABLE: ::c_int = 0x4000; -pub const MAP_LOCKED: ::c_int = 0x8000; -pub const MAP_POPULATE: ::c_int = 0x10000; -pub const MAP_NONBLOCK: ::c_int = 0x20000; -pub const MAP_STACK: ::c_int = 0x40000; - -pub const SOCK_STREAM: ::c_int = 2; -pub const SOCK_DGRAM: ::c_int = 1; -pub const SOCK_SEQPACKET: ::c_int = 5; -pub const SOCK_DCCP: ::c_int = 6; -pub const SOCK_PACKET: ::c_int = 10; - -pub const SOL_SOCKET: ::c_int = 0xffff; - -pub const SO_REUSEADDR: ::c_int = 0x0004; -pub const SO_KEEPALIVE: ::c_int = 0x0008; -pub const SO_DONTROUTE: ::c_int = 0x0010; -pub const SO_BROADCAST: ::c_int = 0x0020; -pub const SO_LINGER: ::c_int = 0x0080; -pub const SO_OOBINLINE: ::c_int = 0x0100; -pub const SO_REUSEPORT: ::c_int = 0x0200; -pub const SO_TYPE: ::c_int = 0x1008; -pub const SO_STYLE: ::c_int = SO_TYPE; -pub const SO_ERROR: ::c_int = 0x1007; -pub const SO_SNDBUF: ::c_int = 0x1001; -pub const SO_RCVBUF: ::c_int = 0x1002; -pub const SO_SNDLOWAT: ::c_int = 0x1003; -pub const SO_RCVLOWAT: ::c_int = 0x1004; -pub const SO_SNDTIMEO: ::c_int = 0x1005; -pub const SO_RCVTIMEO: ::c_int = 0x1006; -pub const SO_ACCEPTCONN: ::c_int = 0x1009; -pub const SO_PROTOCOL: ::c_int = 0x1028; -pub const SO_DOMAIN: ::c_int = 0x1029; -pub const SO_NO_CHECK: ::c_int = 11; -pub const SO_PRIORITY: ::c_int = 12; -pub const SO_BSDCOMPAT: ::c_int = 14; -pub const SO_PASSCRED: ::c_int = 17; -pub const SO_PEERCRED: ::c_int = 18; -pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22; -pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23; -pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24; -pub const SO_BINDTODEVICE: ::c_int = 25; -pub const SO_ATTACH_FILTER: ::c_int = 26; -pub const SO_DETACH_FILTER: ::c_int = 27; -pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER; -pub const SO_PEERNAME: ::c_int = 28; -pub const SO_TIMESTAMP: ::c_int = 29; -pub const SO_PEERSEC: ::c_int = 30; -pub const SO_SNDBUFFORCE: ::c_int = 31; -pub const SO_RCVBUFFORCE: ::c_int = 33; -pub const SO_PASSSEC: ::c_int = 34; -pub const SO_TIMESTAMPNS: ::c_int = 35; -pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS; -pub const SO_MARK: ::c_int = 36; -pub const SO_RXQ_OVFL: ::c_int = 40; -pub const SO_WIFI_STATUS: ::c_int = 41; -pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS; -pub const SO_PEEK_OFF: ::c_int = 42; -pub const SO_NOFCS: ::c_int = 43; -pub const SO_LOCK_FILTER: ::c_int = 44; -pub const SO_SELECT_ERR_QUEUE: ::c_int = 45; -pub const SO_BUSY_POLL: ::c_int = 46; -pub const SO_MAX_PACING_RATE: ::c_int = 47; -pub const SO_BPF_EXTENSIONS: ::c_int = 48; -pub const SO_INCOMING_CPU: ::c_int = 49; -pub const SO_ATTACH_BPF: ::c_int = 50; -pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER; - -/* DCCP socket options */ -pub const DCCP_SOCKOPT_PACKET_SIZE: ::c_int = 1; -pub const DCCP_SOCKOPT_SERVICE: ::c_int = 2; -pub const DCCP_SOCKOPT_CHANGE_L: ::c_int = 3; -pub const DCCP_SOCKOPT_CHANGE_R: ::c_int = 4; -pub const DCCP_SOCKOPT_GET_CUR_MPS: ::c_int = 5; -pub const DCCP_SOCKOPT_SERVER_TIMEWAIT: ::c_int = 6; -pub const DCCP_SOCKOPT_SEND_CSCOV: ::c_int = 10; -pub const DCCP_SOCKOPT_RECV_CSCOV: ::c_int = 11; -pub const DCCP_SOCKOPT_AVAILABLE_CCIDS: ::c_int = 12; -pub const DCCP_SOCKOPT_CCID: ::c_int = 13; -pub const DCCP_SOCKOPT_TX_CCID: ::c_int = 14; -pub const DCCP_SOCKOPT_RX_CCID: ::c_int = 15; -pub const DCCP_SOCKOPT_QPOLICY_ID: ::c_int = 16; -pub const DCCP_SOCKOPT_QPOLICY_TXQLEN: ::c_int = 17; -pub const DCCP_SOCKOPT_CCID_RX_INFO: ::c_int = 128; -pub const DCCP_SOCKOPT_CCID_TX_INFO: ::c_int = 192; - -/// maximum number of services provided on the same listening port -pub const DCCP_SERVICE_LIST_MAX_LEN: ::c_int = 32; - -pub const FIOCLEX: ::c_ulong = 0x6601; -pub const FIONBIO: ::c_ulong = 0x667e; - -pub const SA_ONSTACK: ::c_int = 0x08000000; -pub const SA_SIGINFO: ::c_int = 0x00000008; -pub const SA_NOCLDWAIT: ::c_int = 0x00010000; - -pub const SIGCHLD: ::c_int = 18; -pub const SIGBUS: ::c_int = 10; -pub const SIGTTIN: ::c_int = 26; -pub const SIGTTOU: ::c_int = 27; -pub const SIGXCPU: ::c_int = 30; -pub const SIGXFSZ: ::c_int = 31; -pub const SIGVTALRM: ::c_int = 28; -pub const SIGPROF: ::c_int = 29; -pub const SIGWINCH: ::c_int = 20; -pub const SIGUSR1: ::c_int = 16; -pub const SIGUSR2: ::c_int = 17; -pub const SIGCONT: ::c_int = 25; -pub const SIGSTOP: ::c_int = 23; -pub const SIGTSTP: ::c_int = 24; -pub const SIGURG: ::c_int = 21; -pub const SIGIO: ::c_int = 22; -pub const SIGSYS: ::c_int = 12; -pub const SIGPOLL: ::c_int = 22; -pub const SIGPWR: ::c_int = 19; -pub const SIG_SETMASK: ::c_int = 3; -pub const SIG_BLOCK: ::c_int = 0x1; -pub const SIG_UNBLOCK: ::c_int = 0x2; - -pub const POLLWRNORM: ::c_short = 0x004; -pub const POLLWRBAND: ::c_short = 0x100; - -pub const PTHREAD_STACK_MIN: ::size_t = 131072; -pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 3; - -pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5; -pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff; -pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245; -pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45; -pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53; -pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53; -pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53; -pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53; -pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849; -pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6; -pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660; -pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6; -pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f; -pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f; -pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468; -pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478; -pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44; -pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c; -pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969; -pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1; -pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0; -pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f; -pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973; -pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b; -pub const TMPFS_MAGIC: ::c_long = 0x01021994; -pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2; - -pub const VEOF: usize = 16; -pub const VEOL: usize = 17; -pub const VEOL2: usize = 6; -pub const VMIN: usize = 4; -pub const IEXTEN: ::tcflag_t = 0x00000100; -pub const TOSTOP: ::tcflag_t = 0x00008000; -pub const FLUSHO: ::tcflag_t = 0x00002000; -pub const EXTPROC: ::tcflag_t = 0o200000; -pub const TCSANOW: ::c_int = 0x540e; -pub const TCSADRAIN: ::c_int = 0x540f; -pub const TCSAFLUSH: ::c_int = 0x5410; - -pub const CPU_SETSIZE: ::c_int = 0x400; - -pub const PTRACE_TRACEME: ::c_uint = 0; -pub const PTRACE_PEEKTEXT: ::c_uint = 1; -pub const PTRACE_PEEKDATA: ::c_uint = 2; -pub const PTRACE_PEEKUSER: ::c_uint = 3; -pub const PTRACE_POKETEXT: ::c_uint = 4; -pub const PTRACE_POKEDATA: ::c_uint = 5; -pub const PTRACE_POKEUSER: ::c_uint = 6; -pub const PTRACE_CONT: ::c_uint = 7; -pub const PTRACE_KILL: ::c_uint = 8; -pub const PTRACE_SINGLESTEP: ::c_uint = 9; -pub const PTRACE_ATTACH: ::c_uint = 16; -pub const PTRACE_DETACH: ::c_uint = 17; -pub const PTRACE_SYSCALL: ::c_uint = 24; -pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200; -pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201; -pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202; -pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203; -pub const PTRACE_GETFPREGS: ::c_uint = 14; -pub const PTRACE_SETFPREGS: ::c_uint = 15; -pub const PTRACE_GETFPXREGS: ::c_uint = 18; -pub const PTRACE_SETFPXREGS: ::c_uint = 19; -pub const PTRACE_GETREGS: ::c_uint = 12; -pub const PTRACE_SETREGS: ::c_uint = 13; - -pub const MAP_HUGETLB: ::c_int = 0x080000; - -pub const EFD_NONBLOCK: ::c_int = 0x80; - -pub const F_RDLCK: ::c_int = 0; -pub const F_WRLCK: ::c_int = 1; -pub const F_UNLCK: ::c_int = 2; -pub const F_GETLK: ::c_int = 14; -pub const F_GETOWN: ::c_int = 23; -pub const F_SETOWN: ::c_int = 24; -pub const F_SETLK: ::c_int = 6; -pub const F_SETLKW: ::c_int = 7; - -pub const SFD_NONBLOCK: ::c_int = 0x80; - -pub const TCGETS: ::c_ulong = 0x540d; -pub const TCSETS: ::c_ulong = 0x540e; -pub const TCSETSW: ::c_ulong = 0x540f; -pub const TCSETSF: ::c_ulong = 0x5410; -pub const TCGETA: ::c_ulong = 0x5401; -pub const TCSETA: ::c_ulong = 0x5402; -pub const TCSETAW: ::c_ulong = 0x5403; -pub const TCSETAF: ::c_ulong = 0x5404; -pub const TCSBRK: ::c_ulong = 0x5405; -pub const TCXONC: ::c_ulong = 0x5406; -pub const TCFLSH: ::c_ulong = 0x5407; -pub const TIOCGSOFTCAR: ::c_ulong = 0x5481; -pub const TIOCSSOFTCAR: ::c_ulong = 0x5482; -pub const TIOCINQ: ::c_ulong = 0x467f; -pub const TIOCLINUX: ::c_ulong = 0x5483; -pub const TIOCGSERIAL: ::c_ulong = 0x5484; -pub const TIOCEXCL: ::c_ulong = 0x740d; -pub const TIOCNXCL: ::c_ulong = 0x740e; -pub const TIOCSCTTY: ::c_ulong = 0x5480; -pub const TIOCGPGRP: ::c_ulong = 0x40047477; -pub const TIOCSPGRP: ::c_ulong = 0x80047476; -pub const TIOCOUTQ: ::c_ulong = 0x7472; -pub const TIOCSTI: ::c_ulong = 0x5472; -pub const TIOCGWINSZ: ::c_ulong = 0x40087468; -pub const TIOCSWINSZ: ::c_ulong = 0x80087467; -pub const TIOCMGET: ::c_ulong = 0x741d; -pub const TIOCMBIS: ::c_ulong = 0x741b; -pub const TIOCMBIC: ::c_ulong = 0x741c; -pub const TIOCMSET: ::c_ulong = 0x741a; -pub const FIONREAD: ::c_ulong = 0x467f; -pub const TIOCCONS: ::c_ulong = 0x80047478; - -pub const RTLD_DEEPBIND: ::c_int = 0x10; -pub const RTLD_GLOBAL: ::c_int = 0x4; -pub const RTLD_NOLOAD: ::c_int = 0x8; - -pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead; -pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793; -pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278; -pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448; -pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216; - -pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567; -pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123; -pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF; -pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000; -pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC; -pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4; -pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2; -pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543; - -pub const MCL_CURRENT: ::c_int = 0x0001; -pub const MCL_FUTURE: ::c_int = 0x0002; - -pub const SIGSTKSZ: ::size_t = 8192; -pub const MINSIGSTKSZ: ::size_t = 2048; -pub const CBAUD: ::tcflag_t = 0o0010017; -pub const TAB1: ::c_int = 0x00000800; -pub const TAB2: ::c_int = 0x00001000; -pub const TAB3: ::c_int = 0x00001800; -pub const CR1: ::c_int = 0x00000200; -pub const CR2: ::c_int = 0x00000400; -pub const CR3: ::c_int = 0x00000600; -pub const FF1: ::c_int = 0x00008000; -pub const BS1: ::c_int = 0x00002000; -pub const VT1: ::c_int = 0x00004000; -pub const VWERASE: usize = 14; -pub const VREPRINT: usize = 12; -pub const VSUSP: usize = 10; -pub const VSTART: usize = 8; -pub const VSTOP: usize = 9; -pub const VDISCARD: usize = 13; -pub const VTIME: usize = 5; -pub const IXON: ::tcflag_t = 0x00000400; -pub const IXOFF: ::tcflag_t = 0x00001000; -pub const ONLCR: ::tcflag_t = 0x4; -pub const CSIZE: ::tcflag_t = 0x00000030; -pub const CS6: ::tcflag_t = 0x00000010; -pub const CS7: ::tcflag_t = 0x00000020; -pub const CS8: ::tcflag_t = 0x00000030; -pub const CSTOPB: ::tcflag_t = 0x00000040; -pub const CREAD: ::tcflag_t = 0x00000080; -pub const PARENB: ::tcflag_t = 0x00000100; -pub const PARODD: ::tcflag_t = 0x00000200; -pub const HUPCL: ::tcflag_t = 0x00000400; -pub const CLOCAL: ::tcflag_t = 0x00000800; -pub const ECHOKE: ::tcflag_t = 0x00000800; -pub const ECHOE: ::tcflag_t = 0x00000010; -pub const ECHOK: ::tcflag_t = 0x00000020; -pub const ECHONL: ::tcflag_t = 0x00000040; -pub const ECHOPRT: ::tcflag_t = 0x00000400; -pub const ECHOCTL: ::tcflag_t = 0x00000200; -pub const ISIG: ::tcflag_t = 0x00000001; -pub const ICANON: ::tcflag_t = 0x00000002; -pub const PENDIN: ::tcflag_t = 0x00004000; -pub const NOFLSH: ::tcflag_t = 0x00000080; -pub const CIBAUD: ::tcflag_t = 0o02003600000; -pub const CBAUDEX: ::tcflag_t = 0o010000; -pub const VSWTC: usize = 7; -pub const OLCUC: ::tcflag_t = 0o000002; -pub const NLDLY: ::tcflag_t = 0o000400; -pub const CRDLY: ::tcflag_t = 0o003000; -pub const TABDLY: ::tcflag_t = 0o014000; -pub const BSDLY: ::tcflag_t = 0o020000; -pub const FFDLY: ::tcflag_t = 0o100000; -pub const VTDLY: ::tcflag_t = 0o040000; -pub const XTABS: ::tcflag_t = 0o014000; - -pub const B0: ::speed_t = 0o000000; -pub const B50: ::speed_t = 0o000001; -pub const B75: ::speed_t = 0o000002; -pub const B110: ::speed_t = 0o000003; -pub const B134: ::speed_t = 0o000004; -pub const B150: ::speed_t = 0o000005; -pub const B200: ::speed_t = 0o000006; -pub const B300: ::speed_t = 0o000007; -pub const B600: ::speed_t = 0o000010; -pub const B1200: ::speed_t = 0o000011; -pub const B1800: ::speed_t = 0o000012; -pub const B2400: ::speed_t = 0o000013; -pub const B4800: ::speed_t = 0o000014; -pub const B9600: ::speed_t = 0o000015; -pub const B19200: ::speed_t = 0o000016; -pub const B38400: ::speed_t = 0o000017; -pub const EXTA: ::speed_t = B19200; -pub const EXTB: ::speed_t = B38400; -pub const BOTHER: ::speed_t = 0o010000; -pub const B57600: ::speed_t = 0o010001; -pub const B115200: ::speed_t = 0o010002; -pub const B230400: ::speed_t = 0o010003; -pub const B460800: ::speed_t = 0o010004; -pub const B500000: ::speed_t = 0o010005; -pub const B576000: ::speed_t = 0o010006; -pub const B921600: ::speed_t = 0o010007; -pub const B1000000: ::speed_t = 0o010010; -pub const B1152000: ::speed_t = 0o010011; -pub const B1500000: ::speed_t = 0o010012; -pub const B2000000: ::speed_t = 0o010013; -pub const B2500000: ::speed_t = 0o010014; -pub const B3000000: ::speed_t = 0o010015; -pub const B3500000: ::speed_t = 0o010016; -pub const B4000000: ::speed_t = 0o010017; - -pub const TIOCM_LE: ::c_int = 0x001; -pub const TIOCM_DTR: ::c_int = 0x002; -pub const TIOCM_RTS: ::c_int = 0x004; -pub const TIOCM_ST: ::c_int = 0x010; -pub const TIOCM_SR: ::c_int = 0x020; -pub const TIOCM_CTS: ::c_int = 0x040; -pub const TIOCM_CAR: ::c_int = 0x100; -pub const TIOCM_CD: ::c_int = TIOCM_CAR; -pub const TIOCM_RNG: ::c_int = 0x200; -pub const TIOCM_RI: ::c_int = TIOCM_RNG; -pub const TIOCM_DSR: ::c_int = 0x400; - -pub const EHWPOISON: ::c_int = 168; -pub const SIGEV_THREAD_ID: ::c_int = 4; -pub const EPOLLWAKEUP: ::c_int = 0x20000000; - -pub const NF_NETDEV_INGRESS: ::c_int = 0; -pub const NF_NETDEV_NUMHOOKS: ::c_int = 1; - -pub const NFPROTO_INET: ::c_int = 1; -pub const NFPROTO_NETDEV: ::c_int = 5; - -pub const NLA_ALIGNTO: ::c_int = 4; - -pub const GENL_UNS_ADMIN_PERM: ::c_int = 0x10; - -pub const GENL_ID_VFS_DQUOT: ::c_int = ::NLMSG_MIN_TYPE + 1; -pub const GENL_ID_PMCRAID: ::c_int = ::NLMSG_MIN_TYPE + 2; - -pub const NFT_TABLE_MAXNAMELEN: ::c_int = 32; -pub const NFT_CHAIN_MAXNAMELEN: ::c_int = 32; -pub const NFT_SET_MAXNAMELEN: ::c_int = 32; -pub const NFT_OBJ_MAXNAMELEN: ::c_int = 32; -pub const NFT_USERDATA_MAXLEN: ::c_int = 256; - -pub const NFT_REG_VERDICT: ::c_int = 0; -pub const NFT_REG_1: ::c_int = 1; -pub const NFT_REG_2: ::c_int = 2; -pub const NFT_REG_3: ::c_int = 3; -pub const NFT_REG_4: ::c_int = 4; -pub const __NFT_REG_MAX: ::c_int = 5; -pub const NFT_REG32_00: ::c_int = 8; -pub const NFT_REG32_01: ::c_int = 9; -pub const NFT_REG32_02: ::c_int = 10; -pub const NFT_REG32_03: ::c_int = 11; -pub const NFT_REG32_04: ::c_int = 12; -pub const NFT_REG32_05: ::c_int = 13; -pub const NFT_REG32_06: ::c_int = 14; -pub const NFT_REG32_07: ::c_int = 15; -pub const NFT_REG32_08: ::c_int = 16; -pub const NFT_REG32_09: ::c_int = 17; -pub const NFT_REG32_10: ::c_int = 18; -pub const NFT_REG32_11: ::c_int = 19; -pub const NFT_REG32_12: ::c_int = 20; -pub const NFT_REG32_13: ::c_int = 21; -pub const NFT_REG32_14: ::c_int = 22; -pub const NFT_REG32_15: ::c_int = 23; - -pub const NFT_REG_SIZE: ::c_int = 16; -pub const NFT_REG32_SIZE: ::c_int = 4; - -pub const NFT_CONTINUE: ::c_int = -1; -pub const NFT_BREAK: ::c_int = -2; -pub const NFT_JUMP: ::c_int = -3; -pub const NFT_GOTO: ::c_int = -4; -pub const NFT_RETURN: ::c_int = -5; - -pub const NFT_MSG_NEWTABLE: ::c_int = 0; -pub const NFT_MSG_GETTABLE: ::c_int = 1; -pub const NFT_MSG_DELTABLE: ::c_int = 2; -pub const NFT_MSG_NEWCHAIN: ::c_int = 3; -pub const NFT_MSG_GETCHAIN: ::c_int = 4; -pub const NFT_MSG_DELCHAIN: ::c_int = 5; -pub const NFT_MSG_NEWRULE: ::c_int = 6; -pub const NFT_MSG_GETRULE: ::c_int = 7; -pub const NFT_MSG_DELRULE: ::c_int = 8; -pub const NFT_MSG_NEWSET: ::c_int = 9; -pub const NFT_MSG_GETSET: ::c_int = 10; -pub const NFT_MSG_DELSET: ::c_int = 11; -pub const NFT_MSG_NEWSETELEM: ::c_int = 12; -pub const NFT_MSG_GETSETELEM: ::c_int = 13; -pub const NFT_MSG_DELSETELEM: ::c_int = 14; -pub const NFT_MSG_NEWGEN: ::c_int = 15; -pub const NFT_MSG_GETGEN: ::c_int = 16; -pub const NFT_MSG_TRACE: ::c_int = 17; -pub const NFT_MSG_NEWOBJ: ::c_int = 18; -pub const NFT_MSG_GETOBJ: ::c_int = 19; -pub const NFT_MSG_DELOBJ: ::c_int = 20; -pub const NFT_MSG_GETOBJ_RESET: ::c_int = 21; -pub const NFT_MSG_MAX: ::c_int = 22; - -pub const NFT_SET_ANONYMOUS: ::c_int = 0x1; -pub const NFT_SET_CONSTANT: ::c_int = 0x2; -pub const NFT_SET_INTERVAL: ::c_int = 0x4; -pub const NFT_SET_MAP: ::c_int = 0x8; -pub const NFT_SET_TIMEOUT: ::c_int = 0x10; -pub const NFT_SET_EVAL: ::c_int = 0x20; - -pub const NFT_SET_POL_PERFORMANCE: ::c_int = 0; -pub const NFT_SET_POL_MEMORY: ::c_int = 1; - -pub const NFT_SET_ELEM_INTERVAL_END: ::c_int = 0x1; - -pub const NFT_DATA_VALUE: ::c_uint = 0; -pub const NFT_DATA_VERDICT: ::c_uint = 0xffffff00; - -pub const NFT_DATA_RESERVED_MASK: ::c_uint = 0xffffff00; - -pub const NFT_DATA_VALUE_MAXLEN: ::c_int = 64; - -pub const NFT_BYTEORDER_NTOH: ::c_int = 0; -pub const NFT_BYTEORDER_HTON: ::c_int = 1; - -pub const NFT_CMP_EQ: ::c_int = 0; -pub const NFT_CMP_NEQ: ::c_int = 1; -pub const NFT_CMP_LT: ::c_int = 2; -pub const NFT_CMP_LTE: ::c_int = 3; -pub const NFT_CMP_GT: ::c_int = 4; -pub const NFT_CMP_GTE: ::c_int = 5; - -pub const NFT_RANGE_EQ: ::c_int = 0; -pub const NFT_RANGE_NEQ: ::c_int = 1; - -pub const NFT_LOOKUP_F_INV: ::c_int = (1 << 0); - -pub const NFT_DYNSET_OP_ADD: ::c_int = 0; -pub const NFT_DYNSET_OP_UPDATE: ::c_int = 1; - -pub const NFT_DYNSET_F_INV: ::c_int = (1 << 0); - -pub const NFT_PAYLOAD_LL_HEADER: ::c_int = 0; -pub const NFT_PAYLOAD_NETWORK_HEADER: ::c_int = 1; -pub const NFT_PAYLOAD_TRANSPORT_HEADER: ::c_int = 2; - -pub const NFT_PAYLOAD_CSUM_NONE: ::c_int = 0; -pub const NFT_PAYLOAD_CSUM_INET: ::c_int = 1; - -pub const NFT_META_LEN: ::c_int = 0; -pub const NFT_META_PROTOCOL: ::c_int = 1; -pub const NFT_META_PRIORITY: ::c_int = 2; -pub const NFT_META_MARK: ::c_int = 3; -pub const NFT_META_IIF: ::c_int = 4; -pub const NFT_META_OIF: ::c_int = 5; -pub const NFT_META_IIFNAME: ::c_int = 6; -pub const NFT_META_OIFNAME: ::c_int = 7; -pub const NFT_META_IIFTYPE: ::c_int = 8; -pub const NFT_META_OIFTYPE: ::c_int = 9; -pub const NFT_META_SKUID: ::c_int = 10; -pub const NFT_META_SKGID: ::c_int = 11; -pub const NFT_META_NFTRACE: ::c_int = 12; -pub const NFT_META_RTCLASSID: ::c_int = 13; -pub const NFT_META_SECMARK: ::c_int = 14; -pub const NFT_META_NFPROTO: ::c_int = 15; -pub const NFT_META_L4PROTO: ::c_int = 16; -pub const NFT_META_BRI_IIFNAME: ::c_int = 17; -pub const NFT_META_BRI_OIFNAME: ::c_int = 18; -pub const NFT_META_PKTTYPE: ::c_int = 19; -pub const NFT_META_CPU: ::c_int = 20; -pub const NFT_META_IIFGROUP: ::c_int = 21; -pub const NFT_META_OIFGROUP: ::c_int = 22; -pub const NFT_META_CGROUP: ::c_int = 23; -pub const NFT_META_PRANDOM: ::c_int = 24; - -pub const NFT_CT_STATE: ::c_int = 0; -pub const NFT_CT_DIRECTION: ::c_int = 1; -pub const NFT_CT_STATUS: ::c_int = 2; -pub const NFT_CT_MARK: ::c_int = 3; -pub const NFT_CT_SECMARK: ::c_int = 4; -pub const NFT_CT_EXPIRATION: ::c_int = 5; -pub const NFT_CT_HELPER: ::c_int = 6; -pub const NFT_CT_L3PROTOCOL: ::c_int = 7; -pub const NFT_CT_SRC: ::c_int = 8; -pub const NFT_CT_DST: ::c_int = 9; -pub const NFT_CT_PROTOCOL: ::c_int = 10; -pub const NFT_CT_PROTO_SRC: ::c_int = 11; -pub const NFT_CT_PROTO_DST: ::c_int = 12; -pub const NFT_CT_LABELS: ::c_int = 13; -pub const NFT_CT_PKTS: ::c_int = 14; -pub const NFT_CT_BYTES: ::c_int = 15; - -pub const NFT_LIMIT_PKTS: ::c_int = 0; -pub const NFT_LIMIT_PKT_BYTES: ::c_int = 1; - -pub const NFT_LIMIT_F_INV: ::c_int = (1 << 0); - -pub const NFT_QUEUE_FLAG_BYPASS: ::c_int = 0x01; -pub const NFT_QUEUE_FLAG_CPU_FANOUT: ::c_int = 0x02; -pub const NFT_QUEUE_FLAG_MASK: ::c_int = 0x03; - -pub const NFT_QUOTA_F_INV: ::c_int = (1 << 0); - -pub const NFT_REJECT_ICMP_UNREACH: ::c_int = 0; -pub const NFT_REJECT_TCP_RST: ::c_int = 1; -pub const NFT_REJECT_ICMPX_UNREACH: ::c_int = 2; - -pub const NFT_REJECT_ICMPX_NO_ROUTE: ::c_int = 0; -pub const NFT_REJECT_ICMPX_PORT_UNREACH: ::c_int = 1; -pub const NFT_REJECT_ICMPX_HOST_UNREACH: ::c_int = 2; -pub const NFT_REJECT_ICMPX_ADMIN_PROHIBITED: ::c_int = 3; - -pub const NFT_NAT_SNAT: ::c_int = 0; -pub const NFT_NAT_DNAT: ::c_int = 1; - -pub const NFT_TRACETYPE_UNSPEC: ::c_int = 0; -pub const NFT_TRACETYPE_POLICY: ::c_int = 1; -pub const NFT_TRACETYPE_RETURN: ::c_int = 2; -pub const NFT_TRACETYPE_RULE: ::c_int = 3; - -pub const NFT_NG_INCREMENTAL: ::c_int = 0; -pub const NFT_NG_RANDOM: ::c_int = 1; - -#[doc(hidden)] -pub const AF_MAX: ::c_int = 42; -#[doc(hidden)] -pub const PF_MAX: ::c_int = AF_MAX; - -f! { - pub fn NLA_ALIGN(len: ::c_int) -> ::c_int { - return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1) - } -} - -#[link(name = "util")] -extern { - pub fn sysctl(name: *mut ::c_int, - namelen: ::c_int, - oldp: *mut ::c_void, - oldlenp: *mut ::size_t, - newp: *mut ::c_void, - newlen: ::size_t) - -> ::c_int; - pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; - pub fn backtrace(buf: *mut *mut ::c_void, - sz: ::c_int) -> ::c_int; - pub fn glob64(pattern: *const ::c_char, - flags: ::c_int, - errfunc: ::Option ::c_int>, - pglob: *mut glob64_t) -> ::c_int; - pub fn globfree64(pglob: *mut glob64_t); - pub fn ptrace(request: ::c_uint, ...) -> ::c_long; - pub fn pthread_attr_getaffinity_np(attr: *const ::pthread_attr_t, - cpusetsize: ::size_t, - cpuset: *mut ::cpu_set_t) -> ::c_int; - pub fn pthread_attr_setaffinity_np(attr: *mut ::pthread_attr_t, - cpusetsize: ::size_t, - cpuset: *const ::cpu_set_t) -> ::c_int; - pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int; - pub fn setpriority(which: ::__priority_which_t, who: ::id_t, - prio: ::c_int) -> ::c_int; - pub fn pthread_getaffinity_np(thread: ::pthread_t, - cpusetsize: ::size_t, - cpuset: *mut ::cpu_set_t) -> ::c_int; - pub fn pthread_setaffinity_np(thread: ::pthread_t, - cpusetsize: ::size_t, - cpuset: *const ::cpu_set_t) -> ::c_int; - pub fn sched_getcpu() -> ::c_int; -} - -cfg_if! { - if #[cfg(target_arch = "mips")] { - mod mips32; - pub use self::mips32::*; - } else if #[cfg(target_arch = "mips64")] { - mod mips64; - pub use self::mips64::*; - } else { - // Unknown target_arch - } -} - -cfg_if! { - if #[cfg(libc_align)] { - mod align; - pub use self::align::*; - } else { - mod no_align; - pub use self::no_align::*; - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/mips/no_align.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/mips/no_align.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/mips/no_align.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/mips/no_align.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -s! { - // FIXME this is actually a union - pub struct sem_t { - #[cfg(target_pointer_width = "32")] - __size: [::c_char; 16], - #[cfg(target_pointer_width = "64")] - __size: [::c_char; 32], - __align: [::c_long; 0], - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/mod.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,2470 +0,0 @@ -//! Linux-specific definitions for linux-like values - -pub type useconds_t = u32; -pub type dev_t = u64; -pub type socklen_t = u32; -pub type pthread_t = c_ulong; -pub type mode_t = u32; -pub type ino64_t = u64; -pub type off64_t = i64; -pub type blkcnt64_t = i64; -pub type rlim64_t = u64; -pub type mqd_t = ::c_int; -pub type nfds_t = ::c_ulong; -pub type nl_item = ::c_int; -pub type idtype_t = ::c_uint; -pub type loff_t = ::c_longlong; - -pub type __u8 = ::c_uchar; -pub type __u16 = ::c_ushort; -pub type __s16 = ::c_short; -pub type __u32 = ::c_uint; -pub type __s32 = ::c_int; - -pub type Elf32_Half = u16; -pub type Elf32_Word = u32; -pub type Elf32_Off = u32; -pub type Elf32_Addr = u32; - -pub type Elf64_Half = u16; -pub type Elf64_Word = u32; -pub type Elf64_Off = u64; -pub type Elf64_Addr = u64; -pub type Elf64_Xword = u64; -pub type Elf64_Sxword = i64; - -pub type Elf32_Section = u16; -pub type Elf64_Section = u16; - -#[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum fpos64_t {} // TODO: fill this out with a struct -impl ::Copy for fpos64_t {} -impl ::Clone for fpos64_t { - fn clone(&self) -> fpos64_t { *self } -} - -s! { - pub struct rlimit64 { - pub rlim_cur: rlim64_t, - pub rlim_max: rlim64_t, - } - - pub struct glob_t { - pub gl_pathc: ::size_t, - pub gl_pathv: *mut *mut c_char, - pub gl_offs: ::size_t, - pub gl_flags: ::c_int, - - __unused1: *mut ::c_void, - __unused2: *mut ::c_void, - __unused3: *mut ::c_void, - __unused4: *mut ::c_void, - __unused5: *mut ::c_void, - } - - pub struct passwd { - pub pw_name: *mut ::c_char, - pub pw_passwd: *mut ::c_char, - pub pw_uid: ::uid_t, - pub pw_gid: ::gid_t, - pub pw_gecos: *mut ::c_char, - pub pw_dir: *mut ::c_char, - pub pw_shell: *mut ::c_char, - } - - pub struct spwd { - pub sp_namp: *mut ::c_char, - pub sp_pwdp: *mut ::c_char, - pub sp_lstchg: ::c_long, - pub sp_min: ::c_long, - pub sp_max: ::c_long, - pub sp_warn: ::c_long, - pub sp_inact: ::c_long, - pub sp_expire: ::c_long, - pub sp_flag: ::c_ulong, - } - - pub struct dqblk { - pub dqb_bhardlimit: ::uint64_t, - pub dqb_bsoftlimit: ::uint64_t, - pub dqb_curspace: ::uint64_t, - pub dqb_ihardlimit: ::uint64_t, - pub dqb_isoftlimit: ::uint64_t, - pub dqb_curinodes: ::uint64_t, - pub dqb_btime: ::uint64_t, - pub dqb_itime: ::uint64_t, - pub dqb_valid: ::uint32_t, - } - - pub struct signalfd_siginfo { - pub ssi_signo: ::uint32_t, - pub ssi_errno: ::int32_t, - pub ssi_code: ::int32_t, - pub ssi_pid: ::uint32_t, - pub ssi_uid: ::uint32_t, - pub ssi_fd: ::int32_t, - pub ssi_tid: ::uint32_t, - pub ssi_band: ::uint32_t, - pub ssi_overrun: ::uint32_t, - pub ssi_trapno: ::uint32_t, - pub ssi_status: ::int32_t, - pub ssi_int: ::int32_t, - pub ssi_ptr: ::uint64_t, - pub ssi_utime: ::uint64_t, - pub ssi_stime: ::uint64_t, - pub ssi_addr: ::uint64_t, - pub ssi_addr_lsb: ::uint16_t, - _pad2: ::uint16_t, - pub ssi_syscall: ::int32_t, - pub ssi_call_addr: ::uint64_t, - pub ssi_arch: ::uint32_t, - _pad: [::uint8_t; 28], - } - - pub struct itimerspec { - pub it_interval: ::timespec, - pub it_value: ::timespec, - } - - pub struct fsid_t { - __val: [::c_int; 2], - } - - // x32 compatibility - // See https://sourceware.org/bugzilla/show_bug.cgi?id=21279 - pub struct mq_attr { - #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] - pub mq_flags: i64, - #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] - pub mq_maxmsg: i64, - #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] - pub mq_msgsize: i64, - #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] - pub mq_curmsgs: i64, - #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] - pad: [i64; 4], - - #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] - pub mq_flags: ::c_long, - #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] - pub mq_maxmsg: ::c_long, - #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] - pub mq_msgsize: ::c_long, - #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] - pub mq_curmsgs: ::c_long, - #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] - pad: [::c_long; 4], - } - - pub struct packet_mreq { - pub mr_ifindex: ::c_int, - pub mr_type: ::c_ushort, - pub mr_alen: ::c_ushort, - pub mr_address: [::c_uchar; 8], - } - - pub struct cpu_set_t { - #[cfg(all(target_pointer_width = "32", - not(target_arch = "x86_64")))] - bits: [u32; 32], - #[cfg(not(all(target_pointer_width = "32", - not(target_arch = "x86_64"))))] - bits: [u64; 16], - } - - pub struct if_nameindex { - pub if_index: ::c_uint, - pub if_name: *mut ::c_char, - } - - // System V IPC - pub struct msginfo { - pub msgpool: ::c_int, - pub msgmap: ::c_int, - pub msgmax: ::c_int, - pub msgmnb: ::c_int, - pub msgmni: ::c_int, - pub msgssz: ::c_int, - pub msgtql: ::c_int, - pub msgseg: ::c_ushort, - } - - pub struct sembuf { - pub sem_num: ::c_ushort, - pub sem_op: ::c_short, - pub sem_flg: ::c_short, - } - - pub struct input_event { - pub time: ::timeval, - pub type_: ::__u16, - pub code: ::__u16, - pub value: ::__s32, - } - - pub struct input_id { - pub bustype: ::__u16, - pub vendor: ::__u16, - pub product: ::__u16, - pub version: ::__u16, - } - - pub struct input_absinfo { - pub value: ::__s32, - pub minimum: ::__s32, - pub maximum: ::__s32, - pub fuzz: ::__s32, - pub flat: ::__s32, - pub resolution: ::__s32, - } - - pub struct input_keymap_entry { - pub flags: ::__u8, - pub len: ::__u8, - pub index: ::__u16, - pub keycode: ::__u32, - pub scancode: [::__u8; 32], - } - - pub struct input_mask { - pub type_: ::__u32, - pub codes_size: ::__u32, - pub codes_ptr: ::__u64, - } - - pub struct ff_replay { - pub length: ::__u16, - pub delay: ::__u16, - } - - pub struct ff_trigger { - pub button: ::__u16, - pub interval: ::__u16, - } - - pub struct ff_envelope { - pub attack_length: ::__u16, - pub attack_level: ::__u16, - pub fade_length: ::__u16, - pub fade_level: ::__u16, - } - - pub struct ff_constant_effect { - pub level: ::__s16, - pub envelope: ff_envelope, - } - - pub struct ff_ramp_effect { - pub start_level: ::__s16, - pub end_level: ::__s16, - pub envelope: ff_envelope, - } - - pub struct ff_condition_effect { - pub right_saturation: ::__u16, - pub left_saturation: ::__u16, - - pub right_coeff: ::__s16, - pub left_coeff: ::__s16, - - pub deadband: ::__u16, - pub center: ::__s16, - } - - pub struct ff_periodic_effect { - pub waveform: ::__u16, - pub period: ::__u16, - pub magnitude: ::__s16, - pub offset: ::__s16, - pub phase: ::__u16, - - pub envelope: ff_envelope, - - pub custom_len: ::__u32, - pub custom_data: *mut ::__s16, - } - - pub struct ff_rumble_effect { - pub strong_magnitude: ::__u16, - pub weak_magnitude: ::__u16, - } - - pub struct ff_effect { - pub type_: ::__u16, - pub id: ::__s16, - pub direction: ::__u16, - pub trigger: ff_trigger, - pub replay: ff_replay, - // FIXME this is actually a union - #[cfg(target_pointer_width = "64")] - pub u: [u64; 4], - #[cfg(target_pointer_width = "32")] - pub u: [u32; 7], - } - - pub struct dl_phdr_info { - #[cfg(target_pointer_width = "64")] - pub dlpi_addr: Elf64_Addr, - #[cfg(target_pointer_width = "32")] - pub dlpi_addr: Elf32_Addr, - - pub dlpi_name: *const ::c_char, - - #[cfg(target_pointer_width = "64")] - pub dlpi_phdr: *const Elf64_Phdr, - #[cfg(target_pointer_width = "32")] - pub dlpi_phdr: *const Elf32_Phdr, - - #[cfg(target_pointer_width = "64")] - pub dlpi_phnum: Elf64_Half, - #[cfg(target_pointer_width = "32")] - pub dlpi_phnum: Elf32_Half, - - pub dlpi_adds: ::c_ulonglong, - pub dlpi_subs: ::c_ulonglong, - pub dlpi_tls_modid: ::size_t, - pub dlpi_tls_data: *mut ::c_void, - } - - pub struct Elf32_Ehdr { - pub e_ident: [::c_uchar; 16], - pub e_type: Elf32_Half, - pub e_machine: Elf32_Half, - pub e_version: Elf32_Word, - pub e_entry: Elf32_Addr, - pub e_phoff: Elf32_Off, - pub e_shoff: Elf32_Off, - pub e_flags: Elf32_Word, - pub e_ehsize: Elf32_Half, - pub e_phentsize: Elf32_Half, - pub e_phnum: Elf32_Half, - pub e_shentsize: Elf32_Half, - pub e_shnum: Elf32_Half, - pub e_shstrndx: Elf32_Half, - } - - pub struct Elf64_Ehdr { - pub e_ident: [::c_uchar; 16], - pub e_type: Elf64_Half, - pub e_machine: Elf64_Half, - pub e_version: Elf64_Word, - pub e_entry: Elf64_Addr, - pub e_phoff: Elf64_Off, - pub e_shoff: Elf64_Off, - pub e_flags: Elf64_Word, - pub e_ehsize: Elf64_Half, - pub e_phentsize: Elf64_Half, - pub e_phnum: Elf64_Half, - pub e_shentsize: Elf64_Half, - pub e_shnum: Elf64_Half, - pub e_shstrndx: Elf64_Half, - } - - pub struct Elf32_Sym { - pub st_name: Elf32_Word, - pub st_value: Elf32_Addr, - pub st_size: Elf32_Word, - pub st_info: ::c_uchar, - pub st_other: ::c_uchar, - pub st_shndx: Elf32_Section, - } - - pub struct Elf64_Sym { - pub st_name: Elf64_Word, - pub st_info: ::c_uchar, - pub st_other: ::c_uchar, - pub st_shndx: Elf64_Section, - pub st_value: Elf64_Addr, - pub st_size: Elf64_Xword, - } - - pub struct Elf32_Phdr { - pub p_type: Elf32_Word, - pub p_offset: Elf32_Off, - pub p_vaddr: Elf32_Addr, - pub p_paddr: Elf32_Addr, - pub p_filesz: Elf32_Word, - pub p_memsz: Elf32_Word, - pub p_flags: Elf32_Word, - pub p_align: Elf32_Word, - } - - pub struct Elf64_Phdr { - pub p_type: Elf64_Word, - pub p_flags: Elf64_Word, - pub p_offset: Elf64_Off, - pub p_vaddr: Elf64_Addr, - pub p_paddr: Elf64_Addr, - pub p_filesz: Elf64_Xword, - pub p_memsz: Elf64_Xword, - pub p_align: Elf64_Xword, - } - - pub struct Elf32_Shdr { - pub sh_name: Elf32_Word, - pub sh_type: Elf32_Word, - pub sh_flags: Elf32_Word, - pub sh_addr: Elf32_Addr, - pub sh_offset: Elf32_Off, - pub sh_size: Elf32_Word, - pub sh_link: Elf32_Word, - pub sh_info: Elf32_Word, - pub sh_addralign: Elf32_Word, - pub sh_entsize: Elf32_Word, - } - - pub struct Elf64_Shdr { - pub sh_name: Elf64_Word, - pub sh_type: Elf64_Word, - pub sh_flags: Elf64_Xword, - pub sh_addr: Elf64_Addr, - pub sh_offset: Elf64_Off, - pub sh_size: Elf64_Xword, - pub sh_link: Elf64_Word, - pub sh_info: Elf64_Word, - pub sh_addralign: Elf64_Xword, - pub sh_entsize: Elf64_Xword, - } - - pub struct Elf32_Chdr { - pub ch_type: Elf32_Word, - pub ch_size: Elf32_Word, - pub ch_addralign: Elf32_Word, - } - - pub struct Elf64_Chdr { - pub ch_type: Elf64_Word, - pub ch_reserved: Elf64_Word, - pub ch_size: Elf64_Xword, - pub ch_addralign: Elf64_Xword, - } - - pub struct ucred { - pub pid: ::pid_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - } - - pub struct mntent { - pub mnt_fsname: *mut ::c_char, - pub mnt_dir: *mut ::c_char, - pub mnt_type: *mut ::c_char, - pub mnt_opts: *mut ::c_char, - pub mnt_freq: ::c_int, - pub mnt_passno: ::c_int, - } - - pub struct posix_spawn_file_actions_t { - __allocated: ::c_int, - __used: ::c_int, - __actions: *mut ::c_int, - __pad: [::c_int; 16], - } - - pub struct posix_spawnattr_t { - __flags: ::c_short, - __pgrp: ::pid_t, - __sd: ::sigset_t, - __ss: ::sigset_t, - #[cfg(target_env = "musl")] - __prio: ::c_int, - #[cfg(not(target_env = "musl"))] - __sp: ::sched_param, - __policy: ::c_int, - __pad: [::c_int; 16], - } - - pub struct genlmsghdr { - pub cmd: u8, - pub version: u8, - pub reserved: u16, - } - - pub struct in6_pktinfo { - pub ipi6_addr: ::in6_addr, - pub ipi6_ifindex: ::c_uint, - } - - pub struct arpd_request { - pub req: ::c_ushort, - pub ip: u32, - pub dev: ::c_ulong, - pub stamp: ::c_ulong, - pub updated: ::c_ulong, - pub ha: [::c_uchar; ::MAX_ADDR_LEN], - } - - pub struct inotify_event { - pub wd: ::c_int, - pub mask: ::uint32_t, - pub cookie: ::uint32_t, - pub len: ::uint32_t - } -} - -s_no_extra_traits!{ - pub struct dirent { - pub d_ino: ::ino_t, - pub d_off: ::off_t, - pub d_reclen: ::c_ushort, - pub d_type: ::c_uchar, - pub d_name: [::c_char; 256], - } - - pub struct dirent64 { - pub d_ino: ::ino64_t, - pub d_off: ::off64_t, - pub d_reclen: ::c_ushort, - pub d_type: ::c_uchar, - pub d_name: [::c_char; 256], - } - - pub struct sockaddr_alg { - pub salg_family: ::sa_family_t, - pub salg_type: [::c_uchar; 14], - pub salg_feat: u32, - pub salg_mask: u32, - pub salg_name: [::c_uchar; 64], - } - - pub struct af_alg_iv { - pub ivlen: u32, - pub iv: [::c_uchar; 0], - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_ino == other.d_ino - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for dirent {} - - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_ino", &self.d_ino) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_ino.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for dirent64 { - fn eq(&self, other: &dirent64) -> bool { - self.d_ino == other.d_ino - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for dirent64 {} - - impl ::fmt::Debug for dirent64 { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent64") - .field("d_ino", &self.d_ino) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - - impl ::hash::Hash for dirent64 { - fn hash(&self, state: &mut H) { - self.d_ino.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for pthread_cond_t { - fn eq(&self, other: &pthread_cond_t) -> bool { - self.size.iter().zip(other.size.iter()).all(|(a,b)| a == b) - } - } - - impl Eq for pthread_cond_t {} - - impl ::fmt::Debug for pthread_cond_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_cond_t") - // FIXME: .field("size", &self.size) - .finish() - } - } - - impl ::hash::Hash for pthread_cond_t { - fn hash(&self, state: &mut H) { - self.size.hash(state); - } - } - - impl PartialEq for pthread_mutex_t { - fn eq(&self, other: &pthread_mutex_t) -> bool { - self.size.iter().zip(other.size.iter()).all(|(a,b)| a == b) - } - } - - impl Eq for pthread_mutex_t {} - - impl ::fmt::Debug for pthread_mutex_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_mutex_t") - // FIXME: .field("size", &self.size) - .finish() - } - } - - impl ::hash::Hash for pthread_mutex_t { - fn hash(&self, state: &mut H) { - self.size.hash(state); - } - } - - impl PartialEq for pthread_rwlock_t { - fn eq(&self, other: &pthread_rwlock_t) -> bool { - self.size.iter().zip(other.size.iter()).all(|(a,b)| a == b) - } - } - - impl Eq for pthread_rwlock_t {} - - impl ::fmt::Debug for pthread_rwlock_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_rwlock_t") - // FIXME: .field("size", &self.size) - .finish() - } - } - - impl ::hash::Hash for pthread_rwlock_t { - fn hash(&self, state: &mut H) { - self.size.hash(state); - } - } - - impl PartialEq for sockaddr_alg { - fn eq(&self, other: &sockaddr_alg) -> bool { - self.salg_family == other.salg_family - && self - .salg_type - .iter() - .zip(other.salg_type.iter()) - .all(|(a, b)| a == b) - && self.salg_feat == other.salg_feat - && self.salg_mask == other.salg_mask - && self - .salg_name - .iter() - .zip(other.salg_name.iter()) - .all(|(a, b)| a == b) - } - } - - impl Eq for sockaddr_alg {} - - impl ::fmt::Debug for sockaddr_alg { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_alg") - .field("salg_family", &self.salg_family) - .field("salg_type", &self.salg_type) - .field("salg_feat", &self.salg_feat) - .field("salg_mask", &self.salg_mask) - .field("salg_name", &&self.salg_name[..]) - .finish() - } - } - - impl ::hash::Hash for sockaddr_alg { - fn hash(&self, state: &mut H) { - self.salg_family.hash(state); - self.salg_type.hash(state); - self.salg_feat.hash(state); - self.salg_mask.hash(state); - self.salg_name.hash(state); - } - } - - impl af_alg_iv { - fn as_slice(&self) -> &[u8] { - unsafe { - ::core::slice::from_raw_parts( - self.iv.as_ptr(), - self.ivlen as usize - ) - } - } - } - - impl PartialEq for af_alg_iv { - fn eq(&self, other: &af_alg_iv) -> bool { - *self.as_slice() == *other.as_slice() - } - } - - impl Eq for af_alg_iv {} - - impl ::fmt::Debug for af_alg_iv { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("af_alg_iv") - .field("iv", &self.as_slice()) - .finish() - } - } - - impl ::hash::Hash for af_alg_iv { - fn hash(&self, state: &mut H) { - self.as_slice().hash(state); - } - } - } -} - -pub const ABDAY_1: ::nl_item = 0x20000; -pub const ABDAY_2: ::nl_item = 0x20001; -pub const ABDAY_3: ::nl_item = 0x20002; -pub const ABDAY_4: ::nl_item = 0x20003; -pub const ABDAY_5: ::nl_item = 0x20004; -pub const ABDAY_6: ::nl_item = 0x20005; -pub const ABDAY_7: ::nl_item = 0x20006; - -pub const DAY_1: ::nl_item = 0x20007; -pub const DAY_2: ::nl_item = 0x20008; -pub const DAY_3: ::nl_item = 0x20009; -pub const DAY_4: ::nl_item = 0x2000A; -pub const DAY_5: ::nl_item = 0x2000B; -pub const DAY_6: ::nl_item = 0x2000C; -pub const DAY_7: ::nl_item = 0x2000D; - -pub const ABMON_1: ::nl_item = 0x2000E; -pub const ABMON_2: ::nl_item = 0x2000F; -pub const ABMON_3: ::nl_item = 0x20010; -pub const ABMON_4: ::nl_item = 0x20011; -pub const ABMON_5: ::nl_item = 0x20012; -pub const ABMON_6: ::nl_item = 0x20013; -pub const ABMON_7: ::nl_item = 0x20014; -pub const ABMON_8: ::nl_item = 0x20015; -pub const ABMON_9: ::nl_item = 0x20016; -pub const ABMON_10: ::nl_item = 0x20017; -pub const ABMON_11: ::nl_item = 0x20018; -pub const ABMON_12: ::nl_item = 0x20019; - -pub const MON_1: ::nl_item = 0x2001A; -pub const MON_2: ::nl_item = 0x2001B; -pub const MON_3: ::nl_item = 0x2001C; -pub const MON_4: ::nl_item = 0x2001D; -pub const MON_5: ::nl_item = 0x2001E; -pub const MON_6: ::nl_item = 0x2001F; -pub const MON_7: ::nl_item = 0x20020; -pub const MON_8: ::nl_item = 0x20021; -pub const MON_9: ::nl_item = 0x20022; -pub const MON_10: ::nl_item = 0x20023; -pub const MON_11: ::nl_item = 0x20024; -pub const MON_12: ::nl_item = 0x20025; - -pub const AM_STR: ::nl_item = 0x20026; -pub const PM_STR: ::nl_item = 0x20027; - -pub const D_T_FMT: ::nl_item = 0x20028; -pub const D_FMT: ::nl_item = 0x20029; -pub const T_FMT: ::nl_item = 0x2002A; -pub const T_FMT_AMPM: ::nl_item = 0x2002B; - -pub const ERA: ::nl_item = 0x2002C; -pub const ERA_D_FMT: ::nl_item = 0x2002E; -pub const ALT_DIGITS: ::nl_item = 0x2002F; -pub const ERA_D_T_FMT: ::nl_item = 0x20030; -pub const ERA_T_FMT: ::nl_item = 0x20031; - -pub const CODESET: ::nl_item = 14; - -pub const CRNCYSTR: ::nl_item = 0x4000F; - -pub const RUSAGE_THREAD: ::c_int = 1; -pub const RUSAGE_CHILDREN: ::c_int = -1; - -pub const RADIXCHAR: ::nl_item = 0x10000; -pub const THOUSEP: ::nl_item = 0x10001; - -pub const YESEXPR: ::nl_item = 0x50000; -pub const NOEXPR: ::nl_item = 0x50001; -pub const YESSTR: ::nl_item = 0x50002; -pub const NOSTR: ::nl_item = 0x50003; - -pub const FILENAME_MAX: ::c_uint = 4096; -pub const L_tmpnam: ::c_uint = 20; -pub const _PC_LINK_MAX: ::c_int = 0; -pub const _PC_MAX_CANON: ::c_int = 1; -pub const _PC_MAX_INPUT: ::c_int = 2; -pub const _PC_NAME_MAX: ::c_int = 3; -pub const _PC_PATH_MAX: ::c_int = 4; -pub const _PC_PIPE_BUF: ::c_int = 5; -pub const _PC_CHOWN_RESTRICTED: ::c_int = 6; -pub const _PC_NO_TRUNC: ::c_int = 7; -pub const _PC_VDISABLE: ::c_int = 8; -pub const _PC_SYNC_IO: ::c_int = 9; -pub const _PC_ASYNC_IO: ::c_int = 10; -pub const _PC_PRIO_IO: ::c_int = 11; -pub const _PC_SOCK_MAXBUF: ::c_int = 12; -pub const _PC_FILESIZEBITS: ::c_int = 13; -pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14; -pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15; -pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16; -pub const _PC_REC_XFER_ALIGN: ::c_int = 17; -pub const _PC_ALLOC_SIZE_MIN: ::c_int = 18; -pub const _PC_SYMLINK_MAX: ::c_int = 19; -pub const _PC_2_SYMLINKS: ::c_int = 20; - -pub const _SC_ARG_MAX: ::c_int = 0; -pub const _SC_CHILD_MAX: ::c_int = 1; -pub const _SC_CLK_TCK: ::c_int = 2; -pub const _SC_NGROUPS_MAX: ::c_int = 3; -pub const _SC_OPEN_MAX: ::c_int = 4; -pub const _SC_STREAM_MAX: ::c_int = 5; -pub const _SC_TZNAME_MAX: ::c_int = 6; -pub const _SC_JOB_CONTROL: ::c_int = 7; -pub const _SC_SAVED_IDS: ::c_int = 8; -pub const _SC_REALTIME_SIGNALS: ::c_int = 9; -pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10; -pub const _SC_TIMERS: ::c_int = 11; -pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12; -pub const _SC_PRIORITIZED_IO: ::c_int = 13; -pub const _SC_SYNCHRONIZED_IO: ::c_int = 14; -pub const _SC_FSYNC: ::c_int = 15; -pub const _SC_MAPPED_FILES: ::c_int = 16; -pub const _SC_MEMLOCK: ::c_int = 17; -pub const _SC_MEMLOCK_RANGE: ::c_int = 18; -pub const _SC_MEMORY_PROTECTION: ::c_int = 19; -pub const _SC_MESSAGE_PASSING: ::c_int = 20; -pub const _SC_SEMAPHORES: ::c_int = 21; -pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22; -pub const _SC_AIO_LISTIO_MAX: ::c_int = 23; -pub const _SC_AIO_MAX: ::c_int = 24; -pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25; -pub const _SC_DELAYTIMER_MAX: ::c_int = 26; -pub const _SC_MQ_OPEN_MAX: ::c_int = 27; -pub const _SC_MQ_PRIO_MAX: ::c_int = 28; -pub const _SC_VERSION: ::c_int = 29; -pub const _SC_PAGESIZE: ::c_int = 30; -pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE; -pub const _SC_RTSIG_MAX: ::c_int = 31; -pub const _SC_SEM_NSEMS_MAX: ::c_int = 32; -pub const _SC_SEM_VALUE_MAX: ::c_int = 33; -pub const _SC_SIGQUEUE_MAX: ::c_int = 34; -pub const _SC_TIMER_MAX: ::c_int = 35; -pub const _SC_BC_BASE_MAX: ::c_int = 36; -pub const _SC_BC_DIM_MAX: ::c_int = 37; -pub const _SC_BC_SCALE_MAX: ::c_int = 38; -pub const _SC_BC_STRING_MAX: ::c_int = 39; -pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40; -pub const _SC_EXPR_NEST_MAX: ::c_int = 42; -pub const _SC_LINE_MAX: ::c_int = 43; -pub const _SC_RE_DUP_MAX: ::c_int = 44; -pub const _SC_2_VERSION: ::c_int = 46; -pub const _SC_2_C_BIND: ::c_int = 47; -pub const _SC_2_C_DEV: ::c_int = 48; -pub const _SC_2_FORT_DEV: ::c_int = 49; -pub const _SC_2_FORT_RUN: ::c_int = 50; -pub const _SC_2_SW_DEV: ::c_int = 51; -pub const _SC_2_LOCALEDEF: ::c_int = 52; -pub const _SC_UIO_MAXIOV: ::c_int = 60; -pub const _SC_IOV_MAX: ::c_int = 60; -pub const _SC_THREADS: ::c_int = 67; -pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68; -pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69; -pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70; -pub const _SC_LOGIN_NAME_MAX: ::c_int = 71; -pub const _SC_TTY_NAME_MAX: ::c_int = 72; -pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73; -pub const _SC_THREAD_KEYS_MAX: ::c_int = 74; -pub const _SC_THREAD_STACK_MIN: ::c_int = 75; -pub const _SC_THREAD_THREADS_MAX: ::c_int = 76; -pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77; -pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78; -pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79; -pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80; -pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81; -pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 82; -pub const _SC_NPROCESSORS_CONF: ::c_int = 83; -pub const _SC_NPROCESSORS_ONLN: ::c_int = 84; -pub const _SC_PHYS_PAGES: ::c_int = 85; -pub const _SC_AVPHYS_PAGES: ::c_int = 86; -pub const _SC_ATEXIT_MAX: ::c_int = 87; -pub const _SC_PASS_MAX: ::c_int = 88; -pub const _SC_XOPEN_VERSION: ::c_int = 89; -pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90; -pub const _SC_XOPEN_UNIX: ::c_int = 91; -pub const _SC_XOPEN_CRYPT: ::c_int = 92; -pub const _SC_XOPEN_ENH_I18N: ::c_int = 93; -pub const _SC_XOPEN_SHM: ::c_int = 94; -pub const _SC_2_CHAR_TERM: ::c_int = 95; -pub const _SC_2_UPE: ::c_int = 97; -pub const _SC_XOPEN_XPG2: ::c_int = 98; -pub const _SC_XOPEN_XPG3: ::c_int = 99; -pub const _SC_XOPEN_XPG4: ::c_int = 100; -pub const _SC_NZERO: ::c_int = 109; -pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125; -pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126; -pub const _SC_XBS5_LP64_OFF64: ::c_int = 127; -pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128; -pub const _SC_XOPEN_LEGACY: ::c_int = 129; -pub const _SC_XOPEN_REALTIME: ::c_int = 130; -pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131; -pub const _SC_ADVISORY_INFO: ::c_int = 132; -pub const _SC_BARRIERS: ::c_int = 133; -pub const _SC_CLOCK_SELECTION: ::c_int = 137; -pub const _SC_CPUTIME: ::c_int = 138; -pub const _SC_THREAD_CPUTIME: ::c_int = 139; -pub const _SC_MONOTONIC_CLOCK: ::c_int = 149; -pub const _SC_READER_WRITER_LOCKS: ::c_int = 153; -pub const _SC_SPIN_LOCKS: ::c_int = 154; -pub const _SC_REGEXP: ::c_int = 155; -pub const _SC_SHELL: ::c_int = 157; -pub const _SC_SPAWN: ::c_int = 159; -pub const _SC_SPORADIC_SERVER: ::c_int = 160; -pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 161; -pub const _SC_TIMEOUTS: ::c_int = 164; -pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 165; -pub const _SC_2_PBS: ::c_int = 168; -pub const _SC_2_PBS_ACCOUNTING: ::c_int = 169; -pub const _SC_2_PBS_LOCATE: ::c_int = 170; -pub const _SC_2_PBS_MESSAGE: ::c_int = 171; -pub const _SC_2_PBS_TRACK: ::c_int = 172; -pub const _SC_SYMLOOP_MAX: ::c_int = 173; -pub const _SC_STREAMS: ::c_int = 174; -pub const _SC_2_PBS_CHECKPOINT: ::c_int = 175; -pub const _SC_V6_ILP32_OFF32: ::c_int = 176; -pub const _SC_V6_ILP32_OFFBIG: ::c_int = 177; -pub const _SC_V6_LP64_OFF64: ::c_int = 178; -pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 179; -pub const _SC_HOST_NAME_MAX: ::c_int = 180; -pub const _SC_TRACE: ::c_int = 181; -pub const _SC_TRACE_EVENT_FILTER: ::c_int = 182; -pub const _SC_TRACE_INHERIT: ::c_int = 183; -pub const _SC_TRACE_LOG: ::c_int = 184; -pub const _SC_IPV6: ::c_int = 235; -pub const _SC_RAW_SOCKETS: ::c_int = 236; -pub const _SC_V7_ILP32_OFF32: ::c_int = 237; -pub const _SC_V7_ILP32_OFFBIG: ::c_int = 238; -pub const _SC_V7_LP64_OFF64: ::c_int = 239; -pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 240; -pub const _SC_SS_REPL_MAX: ::c_int = 241; -pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 242; -pub const _SC_TRACE_NAME_MAX: ::c_int = 243; -pub const _SC_TRACE_SYS_MAX: ::c_int = 244; -pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 245; -pub const _SC_XOPEN_STREAMS: ::c_int = 246; -pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 247; -pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 248; - -pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY; -pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY; - -pub const GLOB_ERR: ::c_int = 1 << 0; -pub const GLOB_MARK: ::c_int = 1 << 1; -pub const GLOB_NOSORT: ::c_int = 1 << 2; -pub const GLOB_DOOFFS: ::c_int = 1 << 3; -pub const GLOB_NOCHECK: ::c_int = 1 << 4; -pub const GLOB_APPEND: ::c_int = 1 << 5; -pub const GLOB_NOESCAPE: ::c_int = 1 << 6; - -pub const GLOB_NOSPACE: ::c_int = 1; -pub const GLOB_ABORTED: ::c_int = 2; -pub const GLOB_NOMATCH: ::c_int = 3; - -pub const POSIX_MADV_NORMAL: ::c_int = 0; -pub const POSIX_MADV_RANDOM: ::c_int = 1; -pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2; -pub const POSIX_MADV_WILLNEED: ::c_int = 3; - -pub const S_IEXEC: mode_t = 64; -pub const S_IWRITE: mode_t = 128; -pub const S_IREAD: mode_t = 256; - -pub const F_LOCK: ::c_int = 1; -pub const F_TEST: ::c_int = 3; -pub const F_TLOCK: ::c_int = 2; -pub const F_ULOCK: ::c_int = 0; - -pub const IFF_LOWER_UP: ::c_int = 0x10000; -pub const IFF_DORMANT: ::c_int = 0x20000; -pub const IFF_ECHO: ::c_int = 0x40000; - -// linux/if_tun.h -pub const IFF_TUN: ::c_short = 0x0001; -pub const IFF_TAP: ::c_short = 0x0002; -pub const IFF_NO_PI: ::c_short = 0x1000; -// Read queue size -pub const TUN_READQ_SIZE: ::c_short = 500; -// TUN device type flags: deprecated. Use IFF_TUN/IFF_TAP instead. -pub const TUN_TUN_DEV: ::c_short = ::IFF_TUN; -pub const TUN_TAP_DEV: ::c_short = ::IFF_TAP; -pub const TUN_TYPE_MASK: ::c_short = 0x000f; -// This flag has no real effect -pub const IFF_ONE_QUEUE: ::c_short = 0x2000; -pub const IFF_VNET_HDR: ::c_short = 0x4000; -pub const IFF_TUN_EXCL: ::c_short = 0x8000; -pub const IFF_MULTI_QUEUE: ::c_short = 0x0100; -pub const IFF_ATTACH_QUEUE: ::c_short = 0x0200; -pub const IFF_DETACH_QUEUE: ::c_short = 0x0400; -// read-only flag -pub const IFF_PERSIST: ::c_short = 0x0800; -pub const IFF_NOFILTER: ::c_short = 0x1000; - -pub const ST_RDONLY: ::c_ulong = 1; -pub const ST_NOSUID: ::c_ulong = 2; -pub const ST_NODEV: ::c_ulong = 4; -pub const ST_NOEXEC: ::c_ulong = 8; -pub const ST_SYNCHRONOUS: ::c_ulong = 16; -pub const ST_MANDLOCK: ::c_ulong = 64; -pub const ST_WRITE: ::c_ulong = 128; -pub const ST_APPEND: ::c_ulong = 256; -pub const ST_IMMUTABLE: ::c_ulong = 512; -pub const ST_NOATIME: ::c_ulong = 1024; -pub const ST_NODIRATIME: ::c_ulong = 2048; - -pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void; -pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; -pub const RTLD_NODELETE: ::c_int = 0x1000; -pub const RTLD_NOW: ::c_int = 0x2; - -pub const TCP_MD5SIG: ::c_int = 14; - -align_const! { - pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { - size: [0; __SIZEOF_PTHREAD_MUTEX_T], - }; - pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { - size: [0; __SIZEOF_PTHREAD_COND_T], - }; - pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { - size: [0; __SIZEOF_PTHREAD_RWLOCK_T], - }; -} -pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; -pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; -pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; -pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; -pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0; -pub const PTHREAD_PROCESS_SHARED: ::c_int = 1; -pub const __SIZEOF_PTHREAD_COND_T: usize = 48; - -pub const RENAME_NOREPLACE: ::c_int = 1; -pub const RENAME_EXCHANGE: ::c_int = 2; -pub const RENAME_WHITEOUT: ::c_int = 4; - -pub const SCHED_OTHER: ::c_int = 0; -pub const SCHED_FIFO: ::c_int = 1; -pub const SCHED_RR: ::c_int = 2; -pub const SCHED_BATCH: ::c_int = 3; -pub const SCHED_IDLE: ::c_int = 5; - -// netinet/in.h -// NOTE: These are in addition to the constants defined in src/unix/mod.rs - -// IPPROTO_IP defined in src/unix/mod.rs -/// Hop-by-hop option header -pub const IPPROTO_HOPOPTS: ::c_int = 0; -// IPPROTO_ICMP defined in src/unix/mod.rs -/// group mgmt protocol -pub const IPPROTO_IGMP: ::c_int = 2; -/// for compatibility -pub const IPPROTO_IPIP: ::c_int = 4; -// IPPROTO_TCP defined in src/unix/mod.rs -/// exterior gateway protocol -pub const IPPROTO_EGP: ::c_int = 8; -/// pup -pub const IPPROTO_PUP: ::c_int = 12; -// IPPROTO_UDP defined in src/unix/mod.rs -/// xns idp -pub const IPPROTO_IDP: ::c_int = 22; -/// tp-4 w/ class negotiation -pub const IPPROTO_TP: ::c_int = 29; -/// DCCP -pub const IPPROTO_DCCP: ::c_int = 33; -// IPPROTO_IPV6 defined in src/unix/mod.rs -/// IP6 routing header -pub const IPPROTO_ROUTING: ::c_int = 43; -/// IP6 fragmentation header -pub const IPPROTO_FRAGMENT: ::c_int = 44; -/// resource reservation -pub const IPPROTO_RSVP: ::c_int = 46; -/// General Routing Encap. -pub const IPPROTO_GRE: ::c_int = 47; -/// IP6 Encap Sec. Payload -pub const IPPROTO_ESP: ::c_int = 50; -/// IP6 Auth Header -pub const IPPROTO_AH: ::c_int = 51; -// IPPROTO_ICMPV6 defined in src/unix/mod.rs -/// IP6 no next header -pub const IPPROTO_NONE: ::c_int = 59; -/// IP6 destination option -pub const IPPROTO_DSTOPTS: ::c_int = 60; -pub const IPPROTO_MTP: ::c_int = 92; -pub const IPPROTO_BEETPH: ::c_int = 94; -/// encapsulation header -pub const IPPROTO_ENCAP: ::c_int = 98; -/// Protocol indep. multicast -pub const IPPROTO_PIM: ::c_int = 103; -/// IP Payload Comp. Protocol -pub const IPPROTO_COMP: ::c_int = 108; -/// SCTP -pub const IPPROTO_SCTP: ::c_int = 132; -pub const IPPROTO_MH: ::c_int = 135; -pub const IPPROTO_UDPLITE: ::c_int = 136; -pub const IPPROTO_MPLS: ::c_int = 137; -/// raw IP packet -pub const IPPROTO_RAW: ::c_int = 255; -pub const IPPROTO_MAX: ::c_int = 256; - -pub const AF_IB: ::c_int = 27; -pub const AF_MPLS: ::c_int = 28; -pub const AF_NFC: ::c_int = 39; -pub const AF_VSOCK: ::c_int = 40; -pub const AF_XDP: ::c_int = 44; -pub const PF_IB: ::c_int = AF_IB; -pub const PF_MPLS: ::c_int = AF_MPLS; -pub const PF_NFC: ::c_int = AF_NFC; -pub const PF_VSOCK: ::c_int = AF_VSOCK; -pub const PF_XDP: ::c_int = AF_XDP; - -// System V IPC -pub const IPC_PRIVATE: ::key_t = 0; - -pub const IPC_CREAT: ::c_int = 0o1000; -pub const IPC_EXCL: ::c_int = 0o2000; -pub const IPC_NOWAIT: ::c_int = 0o4000; - -pub const IPC_RMID: ::c_int = 0; -pub const IPC_SET: ::c_int = 1; -pub const IPC_STAT: ::c_int = 2; -pub const IPC_INFO: ::c_int = 3; -pub const MSG_STAT: ::c_int = 11; -pub const MSG_INFO: ::c_int = 12; - -pub const MSG_NOERROR: ::c_int = 0o10000; -pub const MSG_EXCEPT: ::c_int = 0o20000; -pub const MSG_COPY: ::c_int = 0o40000; - -pub const SHM_R: ::c_int = 0o400; -pub const SHM_W: ::c_int = 0o200; - -pub const SHM_RDONLY: ::c_int = 0o10000; -pub const SHM_RND: ::c_int = 0o20000; -pub const SHM_REMAP: ::c_int = 0o40000; -pub const SHM_EXEC: ::c_int = 0o100000; - -pub const SHM_LOCK: ::c_int = 11; -pub const SHM_UNLOCK: ::c_int = 12; - -pub const SHM_HUGETLB: ::c_int = 0o4000; -pub const SHM_NORESERVE: ::c_int = 0o10000; - -pub const EPOLLRDHUP: ::c_int = 0x2000; -pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000; -pub const EPOLLONESHOT: ::c_int = 0x40000000; - -pub const QFMT_VFS_OLD: ::c_int = 1; -pub const QFMT_VFS_V0: ::c_int = 2; -pub const QFMT_VFS_V1: ::c_int = 4; - -pub const EFD_SEMAPHORE: ::c_int = 0x1; - -pub const LOG_NFACILITIES: ::c_int = 24; - -pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t; - -pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32; -pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32; -pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32; -pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32; -pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32; -pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32; -pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32; - -pub const AI_PASSIVE: ::c_int = 0x0001; -pub const AI_CANONNAME: ::c_int = 0x0002; -pub const AI_NUMERICHOST: ::c_int = 0x0004; -pub const AI_V4MAPPED: ::c_int = 0x0008; -pub const AI_ALL: ::c_int = 0x0010; -pub const AI_ADDRCONFIG: ::c_int = 0x0020; - -pub const AI_NUMERICSERV: ::c_int = 0x0400; - -pub const EAI_BADFLAGS: ::c_int = -1; -pub const EAI_NONAME: ::c_int = -2; -pub const EAI_AGAIN: ::c_int = -3; -pub const EAI_FAIL: ::c_int = -4; -pub const EAI_NODATA: ::c_int = -5; -pub const EAI_FAMILY: ::c_int = -6; -pub const EAI_SOCKTYPE: ::c_int = -7; -pub const EAI_SERVICE: ::c_int = -8; -pub const EAI_MEMORY: ::c_int = -10; -pub const EAI_SYSTEM: ::c_int = -11; -pub const EAI_OVERFLOW: ::c_int = -12; - -pub const NI_NUMERICHOST: ::c_int = 1; -pub const NI_NUMERICSERV: ::c_int = 2; -pub const NI_NOFQDN: ::c_int = 4; -pub const NI_NAMEREQD: ::c_int = 8; -pub const NI_DGRAM: ::c_int = 16; - -pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1; -pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2; -pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4; - -pub const AIO_CANCELED: ::c_int = 0; -pub const AIO_NOTCANCELED: ::c_int = 1; -pub const AIO_ALLDONE: ::c_int = 2; -pub const LIO_READ: ::c_int = 0; -pub const LIO_WRITE: ::c_int = 1; -pub const LIO_NOP: ::c_int = 2; -pub const LIO_WAIT: ::c_int = 0; -pub const LIO_NOWAIT: ::c_int = 1; - -pub const MREMAP_MAYMOVE: ::c_int = 1; -pub const MREMAP_FIXED: ::c_int = 2; - -pub const PR_SET_PDEATHSIG: ::c_int = 1; -pub const PR_GET_PDEATHSIG: ::c_int = 2; - -pub const PR_GET_DUMPABLE: ::c_int = 3; -pub const PR_SET_DUMPABLE: ::c_int = 4; - -pub const PR_GET_UNALIGN: ::c_int = 5; -pub const PR_SET_UNALIGN: ::c_int = 6; -pub const PR_UNALIGN_NOPRINT: ::c_int = 1; -pub const PR_UNALIGN_SIGBUS: ::c_int = 2; - -pub const PR_GET_KEEPCAPS: ::c_int = 7; -pub const PR_SET_KEEPCAPS: ::c_int = 8; - -pub const PR_GET_FPEMU: ::c_int = 9; -pub const PR_SET_FPEMU: ::c_int = 10; -pub const PR_FPEMU_NOPRINT: ::c_int = 1; -pub const PR_FPEMU_SIGFPE: ::c_int = 2; - -pub const PR_GET_FPEXC: ::c_int = 11; -pub const PR_SET_FPEXC: ::c_int = 12; -pub const PR_FP_EXC_SW_ENABLE: ::c_int = 0x80; -pub const PR_FP_EXC_DIV: ::c_int = 0x010000; -pub const PR_FP_EXC_OVF: ::c_int = 0x020000; -pub const PR_FP_EXC_UND: ::c_int = 0x040000; -pub const PR_FP_EXC_RES: ::c_int = 0x080000; -pub const PR_FP_EXC_INV: ::c_int = 0x100000; -pub const PR_FP_EXC_DISABLED: ::c_int = 0; -pub const PR_FP_EXC_NONRECOV: ::c_int = 1; -pub const PR_FP_EXC_ASYNC: ::c_int = 2; -pub const PR_FP_EXC_PRECISE: ::c_int = 3; - -pub const PR_GET_TIMING: ::c_int = 13; -pub const PR_SET_TIMING: ::c_int = 14; -pub const PR_TIMING_STATISTICAL: ::c_int = 0; -pub const PR_TIMING_TIMESTAMP: ::c_int = 1; - -pub const PR_SET_NAME: ::c_int = 15; -pub const PR_GET_NAME: ::c_int = 16; - -pub const PR_GET_ENDIAN: ::c_int = 19; -pub const PR_SET_ENDIAN: ::c_int = 20; -pub const PR_ENDIAN_BIG: ::c_int = 0; -pub const PR_ENDIAN_LITTLE: ::c_int = 1; -pub const PR_ENDIAN_PPC_LITTLE: ::c_int = 2; - -pub const PR_GET_SECCOMP: ::c_int = 21; -pub const PR_SET_SECCOMP: ::c_int = 22; - -pub const PR_CAPBSET_READ: ::c_int = 23; -pub const PR_CAPBSET_DROP: ::c_int = 24; - -pub const PR_GET_TSC: ::c_int = 25; -pub const PR_SET_TSC: ::c_int = 26; -pub const PR_TSC_ENABLE: ::c_int = 1; -pub const PR_TSC_SIGSEGV: ::c_int = 2; - -pub const PR_GET_SECUREBITS: ::c_int = 27; -pub const PR_SET_SECUREBITS: ::c_int = 28; - -pub const PR_SET_TIMERSLACK: ::c_int = 29; -pub const PR_GET_TIMERSLACK: ::c_int = 30; - -pub const PR_TASK_PERF_EVENTS_DISABLE: ::c_int = 31; -pub const PR_TASK_PERF_EVENTS_ENABLE: ::c_int = 32; - -pub const PR_MCE_KILL: ::c_int = 33; -pub const PR_MCE_KILL_CLEAR: ::c_int = 0; -pub const PR_MCE_KILL_SET: ::c_int = 1; - -pub const PR_MCE_KILL_LATE: ::c_int = 0; -pub const PR_MCE_KILL_EARLY: ::c_int = 1; -pub const PR_MCE_KILL_DEFAULT: ::c_int = 2; - -pub const PR_MCE_KILL_GET: ::c_int = 34; - -pub const PR_SET_MM: ::c_int = 35; -pub const PR_SET_MM_START_CODE: ::c_int = 1; -pub const PR_SET_MM_END_CODE: ::c_int = 2; -pub const PR_SET_MM_START_DATA: ::c_int = 3; -pub const PR_SET_MM_END_DATA: ::c_int = 4; -pub const PR_SET_MM_START_STACK: ::c_int = 5; -pub const PR_SET_MM_START_BRK: ::c_int = 6; -pub const PR_SET_MM_BRK: ::c_int = 7; -pub const PR_SET_MM_ARG_START: ::c_int = 8; -pub const PR_SET_MM_ARG_END: ::c_int = 9; -pub const PR_SET_MM_ENV_START: ::c_int = 10; -pub const PR_SET_MM_ENV_END: ::c_int = 11; -pub const PR_SET_MM_AUXV: ::c_int = 12; -pub const PR_SET_MM_EXE_FILE: ::c_int = 13; -pub const PR_SET_MM_MAP: ::c_int = 14; -pub const PR_SET_MM_MAP_SIZE: ::c_int = 15; - -pub const PR_SET_PTRACER: ::c_int = 0x59616d61; - -pub const PR_SET_CHILD_SUBREAPER: ::c_int = 36; -pub const PR_GET_CHILD_SUBREAPER: ::c_int = 37; - -pub const PR_SET_NO_NEW_PRIVS: ::c_int = 38; -pub const PR_GET_NO_NEW_PRIVS: ::c_int = 39; - -pub const PR_GET_TID_ADDRESS: ::c_int = 40; - -pub const PR_SET_THP_DISABLE: ::c_int = 41; -pub const PR_GET_THP_DISABLE: ::c_int = 42; - -pub const PR_MPX_ENABLE_MANAGEMENT: ::c_int = 43; -pub const PR_MPX_DISABLE_MANAGEMENT: ::c_int = 44; - -pub const PR_SET_FP_MODE: ::c_int = 45; -pub const PR_GET_FP_MODE: ::c_int = 46; -pub const PR_FP_MODE_FR: ::c_int = 1 << 0; -pub const PR_FP_MODE_FRE: ::c_int = 1 << 1; - -pub const PR_CAP_AMBIENT: ::c_int = 47; -pub const PR_CAP_AMBIENT_IS_SET: ::c_int = 1; -pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2; -pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3; -pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4; - -pub const GRND_NONBLOCK: ::c_uint = 0x0001; -pub const GRND_RANDOM: ::c_uint = 0x0002; - -pub const SECCOMP_MODE_DISABLED: ::c_uint = 0; -pub const SECCOMP_MODE_STRICT: ::c_uint = 1; -pub const SECCOMP_MODE_FILTER: ::c_uint = 2; - -pub const ITIMER_REAL: ::c_int = 0; -pub const ITIMER_VIRTUAL: ::c_int = 1; -pub const ITIMER_PROF: ::c_int = 2; - -pub const TFD_CLOEXEC: ::c_int = O_CLOEXEC; -pub const TFD_NONBLOCK: ::c_int = O_NONBLOCK; -pub const TFD_TIMER_ABSTIME: ::c_int = 1; - -pub const XATTR_CREATE: ::c_int = 0x1; -pub const XATTR_REPLACE: ::c_int = 0x2; - -pub const _POSIX_VDISABLE: ::cc_t = 0; - -pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01; -pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02; -pub const FALLOC_FL_COLLAPSE_RANGE: ::c_int = 0x08; -pub const FALLOC_FL_ZERO_RANGE: ::c_int = 0x10; -pub const FALLOC_FL_INSERT_RANGE: ::c_int = 0x20; -pub const FALLOC_FL_UNSHARE_RANGE: ::c_int = 0x40; - -// On Linux, libc doesn't define this constant, libattr does instead. -// We still define it for Linux as it's defined by libc on other platforms, -// and it's mentioned in the man pages for getxattr and setxattr. -pub const ENOATTR: ::c_int = ::ENODATA; - -pub const SO_ORIGINAL_DST: ::c_int = 80; -pub const IP_ORIGDSTADDR : ::c_int = 20; -pub const IP_RECVORIGDSTADDR : ::c_int = IP_ORIGDSTADDR; -pub const IPV6_ORIGDSTADDR : ::c_int = 74; -pub const IPV6_RECVORIGDSTADDR : ::c_int = IPV6_ORIGDSTADDR; -pub const IPV6_FLOWINFO: ::c_int = 11; -pub const IPV6_FLOWLABEL_MGR: ::c_int = 32; -pub const IPV6_FLOWINFO_SEND: ::c_int = 33; -pub const IPV6_FLOWINFO_FLOWLABEL: ::c_int = 0x000fffff; -pub const IPV6_FLOWINFO_PRIORITY: ::c_int = 0x0ff00000; -pub const IUTF8: ::tcflag_t = 0x00004000; -pub const CMSPAR: ::tcflag_t = 0o10000000000; - -pub const MFD_CLOEXEC: ::c_uint = 0x0001; -pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002; -pub const MFD_HUGETLB: ::c_uint = 0x0004; - -// these are used in the p_type field of Elf32_Phdr and Elf64_Phdr, which has -// the type Elf32Word and Elf64Word respectively. Luckily, both of those are u32 -// so we can use that type here to avoid having to cast. -pub const PT_NULL: u32 = 0; -pub const PT_LOAD: u32 = 1; -pub const PT_DYNAMIC: u32 = 2; -pub const PT_INTERP: u32 = 3; -pub const PT_NOTE: u32 = 4; -pub const PT_SHLIB: u32 = 5; -pub const PT_PHDR: u32 = 6; -pub const PT_TLS: u32 = 7; -pub const PT_NUM: u32 = 8; -pub const PT_LOOS: u32 = 0x60000000; -pub const PT_GNU_EH_FRAME: u32 = 0x6474e550; -pub const PT_GNU_STACK: u32 = 0x6474e551; -pub const PT_GNU_RELRO: u32 = 0x6474e552; - -// linux/if_ether.h -pub const ETH_ALEN: ::c_int = 6; -pub const ETH_HLEN: ::c_int = 14; -pub const ETH_ZLEN: ::c_int = 60; -pub const ETH_DATA_LEN: ::c_int = 1500; -pub const ETH_FRAME_LEN: ::c_int = 1514; -pub const ETH_FCS_LEN: ::c_int = 4; - -// These are the defined Ethernet Protocol ID's. -pub const ETH_P_LOOP: ::c_int = 0x0060; -pub const ETH_P_PUP: ::c_int = 0x0200; -pub const ETH_P_PUPAT: ::c_int = 0x0201; -pub const ETH_P_IP: ::c_int = 0x0800; -pub const ETH_P_X25: ::c_int = 0x0805; -pub const ETH_P_ARP: ::c_int = 0x0806; -pub const ETH_P_BPQ: ::c_int = 0x08FF; -pub const ETH_P_IEEEPUP: ::c_int = 0x0a00; -pub const ETH_P_IEEEPUPAT: ::c_int = 0x0a01; -pub const ETH_P_BATMAN: ::c_int = 0x4305; -pub const ETH_P_DEC: ::c_int = 0x6000; -pub const ETH_P_DNA_DL: ::c_int = 0x6001; -pub const ETH_P_DNA_RC: ::c_int = 0x6002; -pub const ETH_P_DNA_RT: ::c_int = 0x6003; -pub const ETH_P_LAT: ::c_int = 0x6004; -pub const ETH_P_DIAG: ::c_int = 0x6005; -pub const ETH_P_CUST: ::c_int = 0x6006; -pub const ETH_P_SCA: ::c_int = 0x6007; -pub const ETH_P_TEB: ::c_int = 0x6558; -pub const ETH_P_RARP: ::c_int = 0x8035; -pub const ETH_P_ATALK: ::c_int = 0x809B; -pub const ETH_P_AARP: ::c_int = 0x80F3; -pub const ETH_P_8021Q: ::c_int = 0x8100; -pub const ETH_P_IPX: ::c_int = 0x8137; -pub const ETH_P_IPV6: ::c_int = 0x86DD; -pub const ETH_P_PAUSE: ::c_int = 0x8808; -pub const ETH_P_SLOW: ::c_int = 0x8809; -pub const ETH_P_WCCP: ::c_int = 0x883E; -pub const ETH_P_MPLS_UC: ::c_int = 0x8847; -pub const ETH_P_MPLS_MC: ::c_int = 0x8848; -pub const ETH_P_ATMMPOA: ::c_int = 0x884c; -pub const ETH_P_PPP_DISC: ::c_int = 0x8863; -pub const ETH_P_PPP_SES: ::c_int = 0x8864; -pub const ETH_P_LINK_CTL: ::c_int = 0x886c; -pub const ETH_P_ATMFATE: ::c_int = 0x8884; -pub const ETH_P_PAE: ::c_int = 0x888E; -pub const ETH_P_AOE: ::c_int = 0x88A2; -pub const ETH_P_8021AD: ::c_int = 0x88A8; -pub const ETH_P_802_EX1: ::c_int = 0x88B5; -pub const ETH_P_TIPC: ::c_int = 0x88CA; -pub const ETH_P_MACSEC: ::c_int = 0x88E5; -pub const ETH_P_8021AH: ::c_int = 0x88E7; -pub const ETH_P_MVRP: ::c_int = 0x88F5; -pub const ETH_P_1588: ::c_int = 0x88F7; -pub const ETH_P_PRP: ::c_int = 0x88FB; -pub const ETH_P_FCOE: ::c_int = 0x8906; -pub const ETH_P_TDLS: ::c_int = 0x890D; -pub const ETH_P_FIP: ::c_int = 0x8914; -pub const ETH_P_80221: ::c_int = 0x8917; -pub const ETH_P_LOOPBACK: ::c_int = 0x9000; -pub const ETH_P_QINQ1: ::c_int = 0x9100; -pub const ETH_P_QINQ2: ::c_int = 0x9200; -pub const ETH_P_QINQ3: ::c_int = 0x9300; -pub const ETH_P_EDSA: ::c_int = 0xDADA; -pub const ETH_P_AF_IUCV: ::c_int = 0xFBFB; - -pub const ETH_P_802_3_MIN: ::c_int = 0x0600; - -// Non DIX types. Won't clash for 1500 types. -pub const ETH_P_802_3: ::c_int = 0x0001; -pub const ETH_P_AX25: ::c_int = 0x0002; -pub const ETH_P_ALL: ::c_int = 0x0003; -pub const ETH_P_802_2: ::c_int = 0x0004; -pub const ETH_P_SNAP: ::c_int = 0x0005; -pub const ETH_P_DDCMP: ::c_int = 0x0006; -pub const ETH_P_WAN_PPP: ::c_int = 0x0007; -pub const ETH_P_PPP_MP: ::c_int = 0x0008; -pub const ETH_P_LOCALTALK: ::c_int = 0x0009; -pub const ETH_P_CANFD: ::c_int = 0x000D; -pub const ETH_P_PPPTALK: ::c_int = 0x0010; -pub const ETH_P_TR_802_2: ::c_int = 0x0011; -pub const ETH_P_MOBITEX: ::c_int = 0x0015; -pub const ETH_P_CONTROL: ::c_int = 0x0016; -pub const ETH_P_IRDA: ::c_int = 0x0017; -pub const ETH_P_ECONET: ::c_int = 0x0018; -pub const ETH_P_HDLC: ::c_int = 0x0019; -pub const ETH_P_ARCNET: ::c_int = 0x001A; -pub const ETH_P_DSA: ::c_int = 0x001B; -pub const ETH_P_TRAILER: ::c_int = 0x001C; -pub const ETH_P_PHONET: ::c_int = 0x00F5; -pub const ETH_P_IEEE802154: ::c_int = 0x00F6; -pub const ETH_P_CAIF: ::c_int = 0x00F7; - -pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01; -pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02; -pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x04; -pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x08; -pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_int = 0x10; -pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x20; - -pub const NLMSG_NOOP: ::c_int = 0x1; -pub const NLMSG_ERROR: ::c_int = 0x2; -pub const NLMSG_DONE: ::c_int = 0x3; -pub const NLMSG_OVERRUN: ::c_int = 0x4; -pub const NLMSG_MIN_TYPE: ::c_int = 0x10; - -pub const GENL_NAMSIZ: ::c_int = 16; - -pub const GENL_MIN_ID: ::c_int = NLMSG_MIN_TYPE; -pub const GENL_MAX_ID: ::c_int = 1023; - -pub const GENL_ADMIN_PERM: ::c_int = 0x01; -pub const GENL_CMD_CAP_DO: ::c_int = 0x02; -pub const GENL_CMD_CAP_DUMP: ::c_int = 0x04; -pub const GENL_CMD_CAP_HASPOL: ::c_int = 0x08; - -pub const GENL_ID_CTRL: ::c_int = NLMSG_MIN_TYPE; - -pub const CTRL_CMD_UNSPEC: ::c_int = 0; -pub const CTRL_CMD_NEWFAMILY: ::c_int = 1; -pub const CTRL_CMD_DELFAMILY: ::c_int = 2; -pub const CTRL_CMD_GETFAMILY: ::c_int = 3; -pub const CTRL_CMD_NEWOPS: ::c_int = 4; -pub const CTRL_CMD_DELOPS: ::c_int = 5; -pub const CTRL_CMD_GETOPS: ::c_int = 6; -pub const CTRL_CMD_NEWMCAST_GRP: ::c_int = 7; -pub const CTRL_CMD_DELMCAST_GRP: ::c_int = 8; -pub const CTRL_CMD_GETMCAST_GRP: ::c_int = 9; - -pub const CTRL_ATTR_UNSPEC: ::c_int = 0; -pub const CTRL_ATTR_FAMILY_ID: ::c_int = 1; -pub const CTRL_ATTR_FAMILY_NAME: ::c_int = 2; -pub const CTRL_ATTR_VERSION: ::c_int = 3; -pub const CTRL_ATTR_HDRSIZE: ::c_int = 4; -pub const CTRL_ATTR_MAXATTR: ::c_int = 5; -pub const CTRL_ATTR_OPS: ::c_int = 6; -pub const CTRL_ATTR_MCAST_GROUPS: ::c_int = 7; - -pub const CTRL_ATTR_OP_UNSPEC: ::c_int = 0; -pub const CTRL_ATTR_OP_ID: ::c_int = 1; -pub const CTRL_ATTR_OP_FLAGS: ::c_int = 2; - -pub const CTRL_ATTR_MCAST_GRP_UNSPEC: ::c_int = 0; -pub const CTRL_ATTR_MCAST_GRP_NAME: ::c_int = 1; -pub const CTRL_ATTR_MCAST_GRP_ID: ::c_int = 2; - -// linux/if_packet.h -pub const PACKET_ADD_MEMBERSHIP: ::c_int = 1; -pub const PACKET_DROP_MEMBERSHIP: ::c_int = 2; - -pub const PACKET_MR_MULTICAST: ::c_int = 0; -pub const PACKET_MR_PROMISC: ::c_int = 1; -pub const PACKET_MR_ALLMULTI: ::c_int = 2; -pub const PACKET_MR_UNICAST: ::c_int = 3; - -// linux/netfilter.h -pub const NF_DROP: ::c_int = 0; -pub const NF_ACCEPT: ::c_int = 1; -pub const NF_STOLEN: ::c_int = 2; -pub const NF_QUEUE: ::c_int = 3; -pub const NF_REPEAT: ::c_int = 4; -pub const NF_STOP: ::c_int = 5; -pub const NF_MAX_VERDICT: ::c_int = NF_STOP; - -pub const NF_VERDICT_MASK: ::c_int = 0x000000ff; -pub const NF_VERDICT_FLAG_QUEUE_BYPASS: ::c_int = 0x00008000; - -pub const NF_VERDICT_QMASK: ::c_int = 0xffff0000; -pub const NF_VERDICT_QBITS: ::c_int = 16; - -pub const NF_VERDICT_BITS: ::c_int = 16; - -pub const NF_INET_PRE_ROUTING: ::c_int = 0; -pub const NF_INET_LOCAL_IN: ::c_int = 1; -pub const NF_INET_FORWARD: ::c_int = 2; -pub const NF_INET_LOCAL_OUT: ::c_int = 3; -pub const NF_INET_POST_ROUTING: ::c_int = 4; -pub const NF_INET_NUMHOOKS: ::c_int = 5; - -// Some NFPROTO are not compatible with musl and are defined in submodules. -pub const NFPROTO_UNSPEC: ::c_int = 0; -pub const NFPROTO_IPV4: ::c_int = 2; -pub const NFPROTO_ARP: ::c_int = 3; -pub const NFPROTO_BRIDGE: ::c_int = 7; -pub const NFPROTO_IPV6: ::c_int = 10; -pub const NFPROTO_DECNET: ::c_int = 12; -pub const NFPROTO_NUMPROTO: ::c_int = 13; - -// linux/netfilter_ipv4.h -pub const NF_IP_PRE_ROUTING: ::c_int = 0; -pub const NF_IP_LOCAL_IN: ::c_int = 1; -pub const NF_IP_FORWARD: ::c_int = 2; -pub const NF_IP_LOCAL_OUT: ::c_int = 3; -pub const NF_IP_POST_ROUTING: ::c_int = 4; -pub const NF_IP_NUMHOOKS: ::c_int = 5; - -pub const NF_IP_PRI_FIRST: ::c_int = ::INT_MIN; -pub const NF_IP_PRI_CONNTRACK_DEFRAG: ::c_int = -400; -pub const NF_IP_PRI_RAW: ::c_int = -300; -pub const NF_IP_PRI_SELINUX_FIRST: ::c_int = -225; -pub const NF_IP_PRI_CONNTRACK: ::c_int = -200; -pub const NF_IP_PRI_MANGLE: ::c_int = -150; -pub const NF_IP_PRI_NAT_DST: ::c_int = -100; -pub const NF_IP_PRI_FILTER: ::c_int = 0; -pub const NF_IP_PRI_SECURITY: ::c_int = 50; -pub const NF_IP_PRI_NAT_SRC: ::c_int = 100; -pub const NF_IP_PRI_SELINUX_LAST: ::c_int = 225; -pub const NF_IP_PRI_CONNTRACK_HELPER: ::c_int = 300; -pub const NF_IP_PRI_CONNTRACK_CONFIRM: ::c_int = ::INT_MAX; -pub const NF_IP_PRI_LAST: ::c_int = ::INT_MAX; - -// linux/netfilter_ipv6.h -pub const NF_IP6_PRE_ROUTING: ::c_int = 0; -pub const NF_IP6_LOCAL_IN: ::c_int = 1; -pub const NF_IP6_FORWARD: ::c_int = 2; -pub const NF_IP6_LOCAL_OUT: ::c_int = 3; -pub const NF_IP6_POST_ROUTING: ::c_int = 4; -pub const NF_IP6_NUMHOOKS: ::c_int = 5; - -pub const NF_IP6_PRI_FIRST: ::c_int = ::INT_MIN; -pub const NF_IP6_PRI_CONNTRACK_DEFRAG: ::c_int = -400; -pub const NF_IP6_PRI_RAW: ::c_int = -300; -pub const NF_IP6_PRI_SELINUX_FIRST: ::c_int = -225; -pub const NF_IP6_PRI_CONNTRACK: ::c_int = -200; -pub const NF_IP6_PRI_MANGLE: ::c_int = -150; -pub const NF_IP6_PRI_NAT_DST: ::c_int = -100; -pub const NF_IP6_PRI_FILTER: ::c_int = 0; -pub const NF_IP6_PRI_SECURITY: ::c_int = 50; -pub const NF_IP6_PRI_NAT_SRC: ::c_int = 100; -pub const NF_IP6_PRI_SELINUX_LAST: ::c_int = 225; -pub const NF_IP6_PRI_CONNTRACK_HELPER: ::c_int = 300; -pub const NF_IP6_PRI_LAST: ::c_int = ::INT_MAX; - -pub const SIOCADDRT: ::c_ulong = 0x0000890B; -pub const SIOCDELRT: ::c_ulong = 0x0000890C; -pub const SIOCGIFNAME: ::c_ulong = 0x00008910; -pub const SIOCSIFLINK: ::c_ulong = 0x00008911; -pub const SIOCGIFCONF: ::c_ulong = 0x00008912; -pub const SIOCGIFFLAGS: ::c_ulong = 0x00008913; -pub const SIOCSIFFLAGS: ::c_ulong = 0x00008914; -pub const SIOCGIFADDR: ::c_ulong = 0x00008915; -pub const SIOCSIFADDR: ::c_ulong = 0x00008916; -pub const SIOCGIFDSTADDR: ::c_ulong = 0x00008917; -pub const SIOCSIFDSTADDR: ::c_ulong = 0x00008918; -pub const SIOCGIFBRDADDR: ::c_ulong = 0x00008919; -pub const SIOCSIFBRDADDR: ::c_ulong = 0x0000891A; -pub const SIOCGIFNETMASK: ::c_ulong = 0x0000891B; -pub const SIOCSIFNETMASK: ::c_ulong = 0x0000891C; -pub const SIOCGIFMETRIC: ::c_ulong = 0x0000891D; -pub const SIOCSIFMETRIC: ::c_ulong = 0x0000891E; -pub const SIOCGIFMEM: ::c_ulong = 0x0000891F; -pub const SIOCSIFMEM: ::c_ulong = 0x00008920; -pub const SIOCGIFMTU: ::c_ulong = 0x00008921; -pub const SIOCSIFMTU: ::c_ulong = 0x00008922; -pub const SIOCSIFHWADDR: ::c_ulong = 0x00008924; -pub const SIOCGIFENCAP: ::c_ulong = 0x00008925; -pub const SIOCSIFENCAP: ::c_ulong = 0x00008926; -pub const SIOCGIFHWADDR: ::c_ulong = 0x00008927; -pub const SIOCGIFSLAVE: ::c_ulong = 0x00008929; -pub const SIOCSIFSLAVE: ::c_ulong = 0x00008930; -pub const SIOCADDMULTI: ::c_ulong = 0x00008931; -pub const SIOCDELMULTI: ::c_ulong = 0x00008932; -pub const SIOCDARP: ::c_ulong = 0x00008953; -pub const SIOCGARP: ::c_ulong = 0x00008954; -pub const SIOCSARP: ::c_ulong = 0x00008955; -pub const SIOCDRARP: ::c_ulong = 0x00008960; -pub const SIOCGRARP: ::c_ulong = 0x00008961; -pub const SIOCSRARP: ::c_ulong = 0x00008962; -pub const SIOCGIFMAP: ::c_ulong = 0x00008970; -pub const SIOCSIFMAP: ::c_ulong = 0x00008971; - -pub const IPTOS_TOS_MASK: u8 = 0x1E; -pub const IPTOS_PREC_MASK: u8 = 0xE0; - -pub const IPTOS_ECN_NOT_ECT: u8 = 0x00; - -pub const RTF_UP: ::c_ushort = 0x0001; -pub const RTF_GATEWAY: ::c_ushort = 0x0002; - -pub const RTF_HOST: ::c_ushort = 0x0004; -pub const RTF_REINSTATE: ::c_ushort = 0x0008; -pub const RTF_DYNAMIC: ::c_ushort = 0x0010; -pub const RTF_MODIFIED: ::c_ushort = 0x0020; -pub const RTF_MTU: ::c_ushort = 0x0040; -pub const RTF_MSS: ::c_ushort = RTF_MTU; -pub const RTF_WINDOW: ::c_ushort = 0x0080; -pub const RTF_IRTT: ::c_ushort = 0x0100; -pub const RTF_REJECT: ::c_ushort = 0x0200; -pub const RTF_STATIC: ::c_ushort = 0x0400; -pub const RTF_XRESOLVE: ::c_ushort = 0x0800; -pub const RTF_NOFORWARD: ::c_ushort = 0x1000; -pub const RTF_THROW: ::c_ushort = 0x2000; -pub const RTF_NOPMTUDISC: ::c_ushort = 0x4000; - -pub const RTF_DEFAULT: u32 = 0x00010000; -pub const RTF_ALLONLINK: u32 = 0x00020000; -pub const RTF_ADDRCONF: u32 = 0x00040000; -pub const RTF_LINKRT: u32 = 0x00100000; -pub const RTF_NONEXTHOP: u32 = 0x00200000; -pub const RTF_CACHE: u32 = 0x01000000; -pub const RTF_FLOW: u32 = 0x02000000; -pub const RTF_POLICY: u32 = 0x04000000; - -pub const RTCF_VALVE: u32 = 0x00200000; -pub const RTCF_MASQ: u32 = 0x00400000; -pub const RTCF_NAT: u32 = 0x00800000; -pub const RTCF_DOREDIRECT: u32 = 0x01000000; -pub const RTCF_LOG: u32 = 0x02000000; -pub const RTCF_DIRECTSRC: u32 = 0x04000000; - -pub const RTF_LOCAL: u32 = 0x80000000; -pub const RTF_INTERFACE: u32 = 0x40000000; -pub const RTF_MULTICAST: u32 = 0x20000000; -pub const RTF_BROADCAST: u32 = 0x10000000; -pub const RTF_NAT: u32 = 0x08000000; -pub const RTF_ADDRCLASSMASK: u32 = 0xF8000000; - -pub const RT_CLASS_UNSPEC: u8 = 0; -pub const RT_CLASS_DEFAULT: u8 = 253; -pub const RT_CLASS_MAIN: u8 = 254; -pub const RT_CLASS_LOCAL: u8 = 255; -pub const RT_CLASS_MAX: u8 = 255; - -pub const RTMSG_OVERRUN: u32 = ::NLMSG_OVERRUN as u32; -pub const RTMSG_NEWDEVICE: u32 = 0x11; -pub const RTMSG_DELDEVICE: u32 = 0x12; -pub const RTMSG_NEWROUTE: u32 = 0x21; -pub const RTMSG_DELROUTE: u32 = 0x22; -pub const RTMSG_NEWRULE: u32 = 0x31; -pub const RTMSG_DELRULE: u32 = 0x32; -pub const RTMSG_CONTROL: u32 = 0x40; -pub const RTMSG_AR_FAILED: u32 = 0x51; - -pub const MAX_ADDR_LEN: usize = 7; -pub const ARPD_UPDATE: ::c_ushort = 0x01; -pub const ARPD_LOOKUP: ::c_ushort = 0x02; -pub const ARPD_FLUSH: ::c_ushort = 0x03; -pub const ATF_MAGIC: ::c_int = 0x80; - -#[cfg(not(target_arch = "sparc64"))] -pub const SO_TIMESTAMPING: ::c_int = 37; -#[cfg(target_arch = "sparc64")] -pub const SO_TIMESTAMPING: ::c_int = 35; -pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING; - -// linux/module.h -pub const MODULE_INIT_IGNORE_MODVERSIONS: ::c_uint = 0x0001; -pub const MODULE_INIT_IGNORE_VERMAGIC: ::c_uint = 0x0002; - -// linux/net_tstamp.h -pub const SOF_TIMESTAMPING_TX_HARDWARE: ::c_uint = 1 << 0; -pub const SOF_TIMESTAMPING_TX_SOFTWARE: ::c_uint = 1 << 1; -pub const SOF_TIMESTAMPING_RX_HARDWARE: ::c_uint = 1 << 2; -pub const SOF_TIMESTAMPING_RX_SOFTWARE: ::c_uint = 1 << 3; -pub const SOF_TIMESTAMPING_SOFTWARE: ::c_uint = 1 << 4; -pub const SOF_TIMESTAMPING_SYS_HARDWARE: ::c_uint = 1 << 5; -pub const SOF_TIMESTAMPING_RAW_HARDWARE: ::c_uint = 1 << 6; - -// linux/if_alg.h -pub const ALG_SET_KEY: ::c_int = 1; -pub const ALG_SET_IV: ::c_int = 2; -pub const ALG_SET_OP: ::c_int = 3; -pub const ALG_SET_AEAD_ASSOCLEN: ::c_int = 4; -pub const ALG_SET_AEAD_AUTHSIZE: ::c_int = 5; - -pub const ALG_OP_DECRYPT: ::c_int = 0; -pub const ALG_OP_ENCRYPT: ::c_int = 1; - -// uapi/linux/inotify.h -pub const IN_ACCESS: ::uint32_t = 0x0000_0001; -pub const IN_MODIFY: ::uint32_t = 0x0000_0002; -pub const IN_ATTRIB: ::uint32_t = 0x0000_0004; -pub const IN_CLOSE_WRITE: ::uint32_t = 0x0000_0008; -pub const IN_CLOSE_NOWRITE: ::uint32_t = 0x0000_0010; -pub const IN_CLOSE: ::uint32_t = (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE); -pub const IN_OPEN: ::uint32_t = 0x0000_0020; -pub const IN_MOVED_FROM: ::uint32_t = 0x0000_0040; -pub const IN_MOVED_TO: ::uint32_t = 0x0000_0080; -pub const IN_MOVE: ::uint32_t = (IN_MOVED_FROM | IN_MOVED_TO); -pub const IN_CREATE: ::uint32_t = 0x0000_0100; -pub const IN_DELETE: ::uint32_t = 0x0000_0200; -pub const IN_DELETE_SELF: ::uint32_t = 0x0000_0400; -pub const IN_MOVE_SELF: ::uint32_t = 0x0000_0800; -pub const IN_UNMOUNT: ::uint32_t = 0x0000_2000; -pub const IN_Q_OVERFLOW: ::uint32_t = 0x0000_4000; -pub const IN_IGNORED: ::uint32_t = 0x0000_8000; -pub const IN_ONLYDIR: ::uint32_t = 0x0100_0000; -pub const IN_DONT_FOLLOW: ::uint32_t = 0x0200_0000; -// pub const IN_EXCL_UNLINK: ::uint32_t = 0x0400_0000; - -// pub const IN_MASK_CREATE: ::uint32_t = 0x1000_0000; -// pub const IN_MASK_ADD: ::uint32_t = 0x2000_0000; -pub const IN_ISDIR: ::uint32_t = 0x4000_0000; -pub const IN_ONESHOT: ::uint32_t = 0x8000_0000; - -pub const IN_ALL_EVENTS: ::uint32_t = ( - IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | - IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | - IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | - IN_MOVE_SELF -); - -pub const IN_CLOEXEC: ::c_int = O_CLOEXEC; -pub const IN_NONBLOCK: ::c_int = O_NONBLOCK; - -f! { - pub fn CMSG_NXTHDR(mhdr: *const msghdr, - cmsg: *const cmsghdr) -> *mut cmsghdr { - if ((*cmsg).cmsg_len as usize) < ::mem::size_of::() { - return 0 as *mut cmsghdr; - }; - let next = (cmsg as usize + - super::CMSG_ALIGN((*cmsg).cmsg_len as usize)) - as *mut cmsghdr; - let max = (*mhdr).msg_control as usize - + (*mhdr).msg_controllen as usize; - if (next.offset(1)) as usize > max || - next as usize + super::CMSG_ALIGN((*next).cmsg_len as usize) > max - { - 0 as *mut cmsghdr - } else { - next as *mut cmsghdr - } - } - - pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { - for slot in cpuset.bits.iter_mut() { - *slot = 0; - } - } - - pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits - = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc - let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); - cpuset.bits[idx] |= 1 << offset; - () - } - - pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits - = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc - let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); - cpuset.bits[idx] &= !(1 << offset); - () - } - - pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { - let size_in_bits = 8 * ::mem::size_of_val(&cpuset.bits[0]); - let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); - 0 != (cpuset.bits[idx] & (1 << offset)) - } - - pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { - set1.bits == set2.bits - } - - pub fn major(dev: ::dev_t) -> ::c_uint { - let mut major = 0; - major |= (dev & 0x00000000000fff00) >> 8; - major |= (dev & 0xfffff00000000000) >> 32; - major as ::c_uint - } - - pub fn minor(dev: ::dev_t) -> ::c_uint { - let mut minor = 0; - minor |= (dev & 0x00000000000000ff) >> 0; - minor |= (dev & 0x00000ffffff00000) >> 12; - minor as ::c_uint - } - - pub fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t { - let major = major as ::dev_t; - let minor = minor as ::dev_t; - let mut dev = 0; - dev |= (major & 0x00000fff) << 8; - dev |= (major & 0xfffff000) << 32; - dev |= (minor & 0x000000ff) << 0; - dev |= (minor & 0xffffff00) << 12; - dev - } - - pub fn IPTOS_TOS(tos: u8) -> u8 { - tos & IPTOS_TOS_MASK - } - - pub fn IPTOS_PREC(tos: u8) -> u8 { - tos & IPTOS_PREC_MASK - } - - pub fn RT_TOS(tos: u8) -> u8 { - tos & ::IPTOS_TOS_MASK - } - - pub fn RT_ADDRCLASS(flags: u32) -> u32 { - flags >> 23 - } - - pub fn RT_LOCALADDR(flags: u32) -> bool { - (flags & RTF_ADDRCLASSMASK) == (RTF_LOCAL | RTF_INTERFACE) - } -} - -extern { - pub fn abs(i: ::c_int) -> ::c_int; - pub fn atof(s: *const ::c_char) -> ::c_double; - pub fn labs(i: ::c_long) -> ::c_long; - pub fn rand() -> ::c_int; - pub fn srand(seed: ::c_uint); - - pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int; - pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int; - pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int; - pub fn aio_error(aiocbp: *const aiocb) -> ::c_int; - pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t; - pub fn aio_suspend(aiocb_list: *const *const aiocb, nitems: ::c_int, - timeout: *const ::timespec) -> ::c_int; - pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int; - pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb, - nitems: ::c_int, sevp: *mut ::sigevent) -> ::c_int; - - pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int; - - pub fn setpwent(); - pub fn endpwent(); - pub fn getpwent() -> *mut passwd; - pub fn setgrent(); - pub fn endgrent(); - pub fn getgrent() -> *mut ::group; - pub fn setspent(); - pub fn endspent(); - pub fn getspent() -> *mut spwd; - - pub fn getspnam(__name: *const ::c_char) -> *mut spwd; - - pub fn shm_open(name: *const c_char, oflag: ::c_int, - mode: mode_t) -> ::c_int; - - // System V IPC - pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int; - pub fn shmat(shmid: ::c_int, - shmaddr: *const ::c_void, - shmflg: ::c_int) -> *mut ::c_void; - pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int; - pub fn shmctl(shmid: ::c_int, - cmd: ::c_int, - buf: *mut ::shmid_ds) -> ::c_int; - pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t; - pub fn semget(key: ::key_t, nsems: ::c_int, semflag: ::c_int) -> ::c_int; - pub fn semop(semid: ::c_int, - sops: *mut ::sembuf, nsops: ::size_t) -> ::c_int; - pub fn semctl(semid: ::c_int, - semnum: ::c_int, cmd: ::c_int, ...) -> ::c_int; - pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds) -> ::c_int; - pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int; - pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t, - msgtyp: ::c_long, msgflg: ::c_int) -> ::ssize_t; - pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t, - msgflg: ::c_int) -> ::c_int; - - pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) - -> ::c_int; - pub fn __errno_location() -> *mut ::c_int; - - pub fn fopen64(filename: *const c_char, - mode: *const c_char) -> *mut ::FILE; - pub fn freopen64(filename: *const c_char, mode: *const c_char, - file: *mut ::FILE) -> *mut ::FILE; - pub fn tmpfile64() -> *mut ::FILE; - pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int; - pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int; - pub fn fseeko64(stream: *mut ::FILE, - offset: ::off64_t, - whence: ::c_int) -> ::c_int; - pub fn ftello64(stream: *mut ::FILE) -> ::off64_t; - pub fn fallocate(fd: ::c_int, mode: ::c_int, - offset: ::off_t, len: ::off_t) -> ::c_int; - pub fn fallocate64(fd: ::c_int, mode: ::c_int, - offset: ::off64_t, len: ::off64_t) -> ::c_int; - pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, - len: ::off_t) -> ::c_int; - pub fn posix_fallocate64(fd: ::c_int, offset: ::off64_t, - len: ::off64_t) -> ::c_int; - pub fn readahead(fd: ::c_int, offset: ::off64_t, - count: ::size_t) -> ::ssize_t; - pub fn getxattr(path: *const c_char, name: *const c_char, - value: *mut ::c_void, size: ::size_t) -> ::ssize_t; - pub fn lgetxattr(path: *const c_char, name: *const c_char, - value: *mut ::c_void, size: ::size_t) -> ::ssize_t; - pub fn fgetxattr(filedes: ::c_int, name: *const c_char, - value: *mut ::c_void, size: ::size_t) -> ::ssize_t; - pub fn setxattr(path: *const c_char, name: *const c_char, - value: *const ::c_void, size: ::size_t, - flags: ::c_int) -> ::c_int; - pub fn lsetxattr(path: *const c_char, name: *const c_char, - value: *const ::c_void, size: ::size_t, - flags: ::c_int) -> ::c_int; - pub fn fsetxattr(filedes: ::c_int, name: *const c_char, - value: *const ::c_void, size: ::size_t, - flags: ::c_int) -> ::c_int; - pub fn listxattr(path: *const c_char, list: *mut c_char, - size: ::size_t) -> ::ssize_t; - pub fn llistxattr(path: *const c_char, list: *mut c_char, - size: ::size_t) -> ::ssize_t; - pub fn flistxattr(filedes: ::c_int, list: *mut c_char, - size: ::size_t) -> ::ssize_t; - pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int; - pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int; - pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int; - pub fn signalfd(fd: ::c_int, - mask: *const ::sigset_t, - flags: ::c_int) -> ::c_int; - pub fn timerfd_create(clockid: ::c_int, flags: ::c_int) -> ::c_int; - pub fn timerfd_gettime(fd: ::c_int, - curr_value: *mut itimerspec) -> ::c_int; - pub fn timerfd_settime(fd: ::c_int, - flags: ::c_int, - new_value: *const itimerspec, - old_value: *mut itimerspec) -> ::c_int; - pub fn pwritev(fd: ::c_int, - iov: *const ::iovec, - iovcnt: ::c_int, - offset: ::off_t) -> ::ssize_t; - pub fn preadv(fd: ::c_int, - iov: *const ::iovec, - iovcnt: ::c_int, - offset: ::off_t) -> ::ssize_t; - pub fn quotactl(cmd: ::c_int, - special: *const ::c_char, - id: ::c_int, - data: *mut ::c_char) -> ::c_int; - pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t; - pub fn mq_close(mqd: ::mqd_t) -> ::c_int; - pub fn mq_unlink(name: *const ::c_char) -> ::c_int; - pub fn mq_receive(mqd: ::mqd_t, - msg_ptr: *mut ::c_char, - msg_len: ::size_t, - msq_prio: *mut ::c_uint) -> ::ssize_t; - pub fn mq_send(mqd: ::mqd_t, - msg_ptr: *const ::c_char, - msg_len: ::size_t, - msq_prio: ::c_uint) -> ::c_int; - pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int; - pub fn mq_setattr(mqd: ::mqd_t, - newattr: *const ::mq_attr, - oldattr: *mut ::mq_attr) -> ::c_int; - pub fn epoll_pwait(epfd: ::c_int, - events: *mut ::epoll_event, - maxevents: ::c_int, - timeout: ::c_int, - sigmask: *const ::sigset_t) -> ::c_int; - pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int; - pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int; - pub fn mkostemps(template: *mut ::c_char, - suffixlen: ::c_int, - flags: ::c_int) -> ::c_int; - pub fn sigtimedwait(set: *const sigset_t, - info: *mut siginfo_t, - timeout: *const ::timespec) -> ::c_int; - pub fn sigwaitinfo(set: *const sigset_t, - info: *mut siginfo_t) -> ::c_int; - pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; - pub fn getnameinfo(sa: *const ::sockaddr, - salen: ::socklen_t, - host: *mut ::c_char, - hostlen: ::socklen_t, - serv: *mut ::c_char, - sevlen: ::socklen_t, - flags: ::c_int) -> ::c_int; - pub fn pthread_setschedprio(native: ::pthread_t, - priority: ::c_int) -> ::c_int; - pub fn prlimit(pid: ::pid_t, resource: ::c_int, new_limit: *const ::rlimit, - old_limit: *mut ::rlimit) -> ::c_int; - pub fn prlimit64(pid: ::pid_t, - resource: ::c_int, - new_limit: *const ::rlimit64, - old_limit: *mut ::rlimit64) -> ::c_int; - pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int; - pub fn process_vm_readv(pid: ::pid_t, - local_iov: *const ::iovec, - liovcnt: ::c_ulong, - remote_iov: *const ::iovec, - riovcnt: ::c_ulong, - flags: ::c_ulong) -> isize; - pub fn process_vm_writev(pid: ::pid_t, - local_iov: *const ::iovec, - liovcnt: ::c_ulong, - remote_iov: *const ::iovec, - riovcnt: ::c_ulong, - flags: ::c_ulong) -> isize; - pub fn reboot(how_to: ::c_int) -> ::c_int; - pub fn setfsgid(gid: ::gid_t) -> ::c_int; - pub fn setfsuid(uid: ::uid_t) -> ::c_int; - - // Not available now on Android - pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, - mode: ::mode_t) -> ::c_int; - pub fn if_nameindex() -> *mut if_nameindex; - pub fn if_freenameindex(ptr: *mut if_nameindex); - pub fn sync_file_range(fd: ::c_int, offset: ::off64_t, - nbytes: ::off64_t, flags: ::c_uint) -> ::c_int; - pub fn mremap(addr: *mut ::c_void, - len: ::size_t, - new_len: ::size_t, - flags: ::c_int, - ...) -> *mut ::c_void; - - pub fn glob(pattern: *const c_char, - flags: ::c_int, - errfunc: ::Option ::c_int>, - pglob: *mut ::glob_t) -> ::c_int; - pub fn globfree(pglob: *mut ::glob_t); - - pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) - -> ::c_int; - - pub fn shm_unlink(name: *const ::c_char) -> ::c_int; - - pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long); - - pub fn telldir(dirp: *mut ::DIR) -> ::c_long; - pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) - -> ::c_int; - - pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int; - pub fn remap_file_pages(addr: *mut ::c_void, size: ::size_t, prot: ::c_int, - pgoff: ::size_t, flags: ::c_int) -> ::c_int; - pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, - flags: ::c_int, addr: *mut ::sockaddr, - addrlen: *mut ::socklen_t) -> ::ssize_t; - pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; - pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int; - pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; - - pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int; - pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int; - pub fn vhangup() -> ::c_int; - pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, - flags: ::c_int) -> ::c_int; - pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, - flags: ::c_int, timeout: *mut ::timespec) -> ::c_int; - pub fn sync(); - pub fn syscall(num: ::c_long, ...) -> ::c_long; - pub fn sched_getaffinity(pid: ::pid_t, - cpusetsize: ::size_t, - cpuset: *mut cpu_set_t) -> ::c_int; - pub fn sched_setaffinity(pid: ::pid_t, - cpusetsize: ::size_t, - cpuset: *const cpu_set_t) -> ::c_int; - pub fn epoll_create(size: ::c_int) -> ::c_int; - pub fn epoll_create1(flags: ::c_int) -> ::c_int; - pub fn epoll_wait(epfd: ::c_int, - events: *mut ::epoll_event, - maxevents: ::c_int, - timeout: ::c_int) -> ::c_int; - pub fn epoll_ctl(epfd: ::c_int, - op: ::c_int, - fd: ::c_int, - event: *mut ::epoll_event) -> ::c_int; - pub fn pthread_getschedparam(native: ::pthread_t, - policy: *mut ::c_int, - param: *mut ::sched_param) -> ::c_int; - pub fn unshare(flags: ::c_int) -> ::c_int; - pub fn umount(target: *const ::c_char) -> ::c_int; - pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int; - pub fn tee(fd_in: ::c_int, - fd_out: ::c_int, - len: ::size_t, - flags: ::c_uint) -> ::ssize_t; - pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int; - pub fn splice(fd_in: ::c_int, - off_in: *mut ::loff_t, - fd_out: ::c_int, - off_out: *mut ::loff_t, - len: ::size_t, - flags: ::c_uint) -> ::ssize_t; - pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; - pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int; - pub fn sem_timedwait(sem: *mut sem_t, - abstime: *const ::timespec) -> ::c_int; - pub fn sem_getvalue(sem: *mut sem_t, - sval: *mut ::c_int) -> ::c_int; - pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int; - pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int; - pub fn swapoff(puath: *const ::c_char) -> ::c_int; - pub fn vmsplice(fd: ::c_int, - iov: *const ::iovec, - nr_segs: ::size_t, - flags: ::c_uint) -> ::ssize_t; - pub fn mount(src: *const ::c_char, - target: *const ::c_char, - fstype: *const ::c_char, - flags: ::c_ulong, - data: *const ::c_void) -> ::c_int; - pub fn personality(persona: ::c_ulong) -> ::c_int; - pub fn prctl(option: ::c_int, ...) -> ::c_int; - pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int; - pub fn ppoll(fds: *mut ::pollfd, - nfds: nfds_t, - timeout: *const ::timespec, - sigmask: *const sigset_t) -> ::c_int; - pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t, - abstime: *const ::timespec) -> ::c_int; - pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int, - child_stack: *mut ::c_void, - flags: ::c_int, - arg: *mut ::c_void, ...) -> ::c_int; - pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int; - pub fn clock_nanosleep(clk_id: ::clockid_t, - flags: ::c_int, - rqtp: *const ::timespec, - rmtp: *mut ::timespec) -> ::c_int; - pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t, - guardsize: *mut ::size_t) -> ::c_int; - pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int; - pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int; - pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t, - pshared: *mut ::c_int) -> ::c_int; - pub fn sysinfo(info: *mut ::sysinfo) -> ::c_int; - pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int; - pub fn pthread_setschedparam(native: ::pthread_t, - policy: ::c_int, - param: *const ::sched_param) -> ::c_int; - pub fn swapon(path: *const ::c_char, swapflags: ::c_int) -> ::c_int; - pub fn sched_setscheduler(pid: ::pid_t, - policy: ::c_int, - param: *const ::sched_param) -> ::c_int; - pub fn sendfile(out_fd: ::c_int, - in_fd: ::c_int, - offset: *mut off_t, - count: ::size_t) -> ::ssize_t; - pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int; - #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")] - pub fn getgrgid_r(gid: ::gid_t, - grp: *mut ::group, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut ::group) -> ::c_int; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "sigaltstack$UNIX2003")] - #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")] - pub fn sigaltstack(ss: *const stack_t, - oss: *mut stack_t) -> ::c_int; - pub fn sem_close(sem: *mut sem_t) -> ::c_int; - pub fn getdtablesize() -> ::c_int; - #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")] - pub fn getgrnam_r(name: *const ::c_char, - grp: *mut ::group, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut ::group) -> ::c_int; - pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "pthread_sigmask$UNIX2003")] - pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, - oldset: *mut sigset_t) -> ::c_int; - pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t; - pub fn getgrnam(name: *const ::c_char) -> *mut ::group; - pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int; - pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; - pub fn sem_unlink(name: *const ::c_char) -> ::c_int; - pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")] - pub fn getpwnam_r(name: *const ::c_char, - pwd: *mut passwd, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut passwd) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")] - pub fn getpwuid_r(uid: ::uid_t, - pwd: *mut passwd, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut passwd) -> ::c_int; - #[cfg_attr(all(target_os = "macos", target_arch ="x86"), - link_name = "sigwait$UNIX2003")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] - pub fn sigwait(set: *const sigset_t, - sig: *mut ::c_int) -> ::c_int; - pub fn pthread_atfork(prepare: ::Option, - parent: ::Option, - child: ::Option) -> ::c_int; - pub fn getgrgid(gid: ::gid_t) -> *mut ::group; - pub fn getgrouplist(user: *const ::c_char, - group: ::gid_t, - groups: *mut ::gid_t, - ngroups: *mut ::c_int) -> ::c_int; - pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t, - pshared: *mut ::c_int) -> ::c_int; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "popen$UNIX2003")] - pub fn popen(command: *const c_char, - mode: *const c_char) -> *mut ::FILE; - pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char, - mode: ::c_int, flags: ::c_int) -> ::c_int; - pub fn pthread_create(native: *mut ::pthread_t, - attr: *const ::pthread_attr_t, - f: extern fn(*mut ::c_void) -> *mut ::c_void, - value: *mut ::c_void) -> ::c_int; - pub fn dl_iterate_phdr( - callback: ::Option ::c_int>, - data: *mut ::c_void - ) -> ::c_int; - - pub fn setmntent(filename: *const ::c_char, - ty: *const ::c_char) -> *mut ::FILE; - pub fn getmntent(stream: *mut ::FILE) -> *mut ::mntent; - pub fn addmntent(stream: *mut ::FILE, mnt: *const ::mntent) -> ::c_int; - pub fn endmntent(streamp: *mut ::FILE) -> ::c_int; - pub fn hasmntopt(mnt: *const ::mntent, - opt: *const ::c_char) -> *mut ::c_char; - - pub fn posix_spawn(pid: *mut ::pid_t, - path: *const ::c_char, - file_actions: *const ::posix_spawn_file_actions_t, - attrp: *const ::posix_spawnattr_t, - argv: *const *mut ::c_char, - envp: *const *mut ::c_char) -> ::c_int; - pub fn posix_spawnp(pid: *mut ::pid_t, - file: *const ::c_char, - file_actions: *const ::posix_spawn_file_actions_t, - attrp: *const ::posix_spawnattr_t, - argv: *const *mut ::c_char, - envp: *const *mut ::c_char) -> ::c_int; - pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int; - pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int; - pub fn posix_spawnattr_getsigdefault(attr: *const posix_spawnattr_t, - default: *mut ::sigset_t) -> ::c_int; - pub fn posix_spawnattr_setsigdefault(attr: *mut posix_spawnattr_t, - default: *const ::sigset_t) -> ::c_int; - pub fn posix_spawnattr_getsigmask(attr: *const posix_spawnattr_t, - default: *mut ::sigset_t) -> ::c_int; - pub fn posix_spawnattr_setsigmask(attr: *mut posix_spawnattr_t, - default: *const ::sigset_t) -> ::c_int; - pub fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t, - flags: *mut ::c_short) -> ::c_int; - pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, - flags: ::c_short) -> ::c_int; - pub fn posix_spawnattr_getpgroup(attr: *const posix_spawnattr_t, - flags: *mut ::pid_t) -> ::c_int; - pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, - flags: ::pid_t) -> ::c_int; - pub fn posix_spawnattr_getschedpolicy(attr: *const posix_spawnattr_t, - flags: *mut ::c_int) -> ::c_int; - pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, - flags: ::c_int) -> ::c_int; - pub fn posix_spawnattr_getschedparam( - attr: *const posix_spawnattr_t, - param: *mut ::sched_param, - ) -> ::c_int; - pub fn posix_spawnattr_setschedparam( - attr: *mut posix_spawnattr_t, - param: *const ::sched_param, - ) -> ::c_int; - - pub fn posix_spawn_file_actions_init( - actions: *mut posix_spawn_file_actions_t, - ) -> ::c_int; - pub fn posix_spawn_file_actions_destroy( - actions: *mut posix_spawn_file_actions_t, - ) -> ::c_int; - pub fn posix_spawn_file_actions_addopen( - actions: *mut posix_spawn_file_actions_t, - fd: ::c_int, - path: *const ::c_char, - oflag: ::c_int, - mode: ::mode_t, - ) -> ::c_int; - pub fn posix_spawn_file_actions_addclose( - actions: *mut posix_spawn_file_actions_t, - fd: ::c_int, - ) -> ::c_int; - pub fn posix_spawn_file_actions_adddup2( - actions: *mut posix_spawn_file_actions_t, - fd: ::c_int, - newfd: ::c_int, - ) -> ::c_int; - pub fn fread_unlocked(ptr: *mut ::c_void, - size: ::size_t, - nobj: ::size_t, - stream: *mut ::FILE - ) -> ::size_t; - pub fn inotify_rm_watch(fd: ::c_int, wd: ::c_int) -> ::c_int; - pub fn inotify_init() -> ::c_int; - pub fn inotify_init1(flags: ::c_int) -> ::c_int; - pub fn inotify_add_watch(fd: ::c_int, - path: *const ::c_char, - mask: ::uint32_t) -> ::c_int; -} - -cfg_if! { - if #[cfg(target_env = "musl")] { - mod musl; - pub use self::musl::*; - } else if #[cfg(any(target_arch = "mips", - target_arch = "mips64"))] { - mod mips; - pub use self::mips::*; - } else if #[cfg(any(target_arch = "s390x"))] { - mod s390x; - pub use self::s390x::*; - } else { - mod other; - pub use self::other::*; - } -} - -cfg_if! { - if #[cfg(libc_align)] { - #[macro_use] - mod align; - } else { - #[macro_use] - mod no_align; - } -} -expand_align!(); diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/b32/arm.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/b32/arm.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/b32/arm.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/b32/arm.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,843 +0,0 @@ -pub type c_char = u8; -pub type wchar_t = u32; - -s! { - pub struct stat { - pub st_dev: ::dev_t, - __st_dev_padding: ::c_int, - __st_ino_truncated: ::c_long, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __st_rdev_padding: ::c_int, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_ino: ::ino_t, - } - - pub struct stat64 { - pub st_dev: ::dev_t, - __st_dev_padding: ::c_int, - __st_ino_truncated: ::c_long, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __st_rdev_padding: ::c_int, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_ino: ::ino_t, - } - - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_flags: ::c_int, - pub ss_size: ::size_t - } - - pub struct ipc_perm { - pub __ipc_perm_key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::mode_t, - pub __seq: ::c_int, - __unused1: ::c_long, - __unused2: ::c_long - } - - pub struct shmid_ds { - pub shm_perm: ::ipc_perm, - pub shm_segsz: ::size_t, - pub shm_atime: ::time_t, - __unused1: ::c_int, - pub shm_dtime: ::time_t, - __unused2: ::c_int, - pub shm_ctime: ::time_t, - __unused3: ::c_int, - pub shm_cpid: ::pid_t, - pub shm_lpid: ::pid_t, - pub shm_nattch: ::c_ulong, - __pad1: ::c_ulong, - __pad2: ::c_ulong, - } - - pub struct msqid_ds { - pub msg_perm: ::ipc_perm, - pub msg_stime: ::time_t, - __unused1: ::c_int, - pub msg_rtime: ::time_t, - __unused2: ::c_int, - pub msg_ctime: ::time_t, - __unused3: ::c_int, - __msg_cbytes: ::c_ulong, - pub msg_qnum: ::msgqnum_t, - pub msg_qbytes: ::msglen_t, - pub msg_lspid: ::pid_t, - pub msg_lrpid: ::pid_t, - __pad1: ::c_ulong, - __pad2: ::c_ulong, - } - - pub struct statfs { - pub f_type: ::c_ulong, - pub f_bsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - pub f_namelen: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_flags: ::c_ulong, - pub f_spare: [::c_ulong; 4], - } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_errno: ::c_int, - pub si_code: ::c_int, - pub _pad: [::c_int; 29], - _align: [usize; 0], - } - - pub struct statfs64 { - pub f_type: ::c_ulong, - pub f_bsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - pub f_namelen: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_flags: ::c_ulong, - pub f_spare: [::c_ulong; 4], - } - - pub struct statvfs64 { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_favail: u64, - pub f_fsid: ::c_ulong, - __f_unused: ::c_int, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 19], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } -} - -pub const SIGSTKSZ: ::size_t = 8192; -pub const MINSIGSTKSZ: ::size_t = 2048; - -pub const O_DIRECT: ::c_int = 0x10000; -pub const O_DIRECTORY: ::c_int = 0x4000; -pub const O_NOFOLLOW: ::c_int = 0x8000; -pub const O_ASYNC: ::c_int = 0x2000; -pub const O_LARGEFILE: ::c_int = 0o400000; - -pub const FIOCLEX: ::c_int = 0x5451; -pub const FIONBIO: ::c_int = 0x5421; - -pub const RLIMIT_RSS: ::c_int = 5; -pub const RLIMIT_NOFILE: ::c_int = 7; -pub const RLIMIT_AS: ::c_int = 9; -pub const RLIMIT_NPROC: ::c_int = 6; -pub const RLIMIT_MEMLOCK: ::c_int = 8; -pub const RLIMIT_NLIMITS: ::c_int = 16; - -pub const MCL_CURRENT: ::c_int = 0x0001; -pub const MCL_FUTURE: ::c_int = 0x0002; -pub const CBAUD: ::tcflag_t = 0o0010017; -pub const TAB1: ::c_int = 0x00000800; -pub const TAB2: ::c_int = 0x00001000; -pub const TAB3: ::c_int = 0x00001800; -pub const CR1: ::c_int = 0x00000200; -pub const CR2: ::c_int = 0x00000400; -pub const CR3: ::c_int = 0x00000600; -pub const FF1: ::c_int = 0x00008000; -pub const BS1: ::c_int = 0x00002000; -pub const VT1: ::c_int = 0x00004000; -pub const VWERASE: usize = 14; -pub const VREPRINT: usize = 12; -pub const VSUSP: usize = 10; -pub const VSTART: usize = 8; -pub const VSTOP: usize = 9; -pub const VDISCARD: usize = 13; -pub const VTIME: usize = 5; -pub const IXON: ::tcflag_t = 0x00000400; -pub const IXOFF: ::tcflag_t = 0x00001000; -pub const ONLCR: ::tcflag_t = 0x4; -pub const CSIZE: ::tcflag_t = 0x00000030; -pub const CS6: ::tcflag_t = 0x00000010; -pub const CS7: ::tcflag_t = 0x00000020; -pub const CS8: ::tcflag_t = 0x00000030; -pub const CSTOPB: ::tcflag_t = 0x00000040; -pub const CREAD: ::tcflag_t = 0x00000080; -pub const PARENB: ::tcflag_t = 0x00000100; -pub const PARODD: ::tcflag_t = 0x00000200; -pub const HUPCL: ::tcflag_t = 0x00000400; -pub const CLOCAL: ::tcflag_t = 0x00000800; -pub const ECHOKE: ::tcflag_t = 0x00000800; -pub const ECHOE: ::tcflag_t = 0x00000010; -pub const ECHOK: ::tcflag_t = 0x00000020; -pub const ECHONL: ::tcflag_t = 0x00000040; -pub const ECHOPRT: ::tcflag_t = 0x00000400; -pub const ECHOCTL: ::tcflag_t = 0x00000200; -pub const ISIG: ::tcflag_t = 0x00000001; -pub const ICANON: ::tcflag_t = 0x00000002; -pub const PENDIN: ::tcflag_t = 0x00004000; -pub const NOFLSH: ::tcflag_t = 0x00000080; -pub const CIBAUD: ::tcflag_t = 0o02003600000; -pub const CBAUDEX: ::tcflag_t = 0o010000; -pub const VSWTC: usize = 7; -pub const OLCUC: ::tcflag_t = 0o000002; -pub const NLDLY: ::tcflag_t = 0o000400; -pub const CRDLY: ::tcflag_t = 0o003000; -pub const TABDLY: ::tcflag_t = 0o014000; -pub const BSDLY: ::tcflag_t = 0o020000; -pub const FFDLY: ::tcflag_t = 0o100000; -pub const VTDLY: ::tcflag_t = 0o040000; -pub const XTABS: ::tcflag_t = 0o014000; -pub const B57600: ::speed_t = 0o010001; -pub const B115200: ::speed_t = 0o010002; -pub const B230400: ::speed_t = 0o010003; -pub const B460800: ::speed_t = 0o010004; -pub const B500000: ::speed_t = 0o010005; -pub const B576000: ::speed_t = 0o010006; -pub const B921600: ::speed_t = 0o010007; -pub const B1000000: ::speed_t = 0o010010; -pub const B1152000: ::speed_t = 0o010011; -pub const B1500000: ::speed_t = 0o010012; -pub const B2000000: ::speed_t = 0o010013; -pub const B2500000: ::speed_t = 0o010014; -pub const B3000000: ::speed_t = 0o010015; -pub const B3500000: ::speed_t = 0o010016; -pub const B4000000: ::speed_t = 0o010017; - -pub const O_APPEND: ::c_int = 1024; -pub const O_CREAT: ::c_int = 64; -pub const O_EXCL: ::c_int = 128; -pub const O_NOCTTY: ::c_int = 256; -pub const O_NONBLOCK: ::c_int = 2048; -pub const O_SYNC: ::c_int = 1052672; -pub const O_RSYNC: ::c_int = 1052672; -pub const O_DSYNC: ::c_int = 4096; - -pub const SOCK_NONBLOCK: ::c_int = 2048; - -pub const MAP_ANON: ::c_int = 0x0020; -pub const MAP_GROWSDOWN: ::c_int = 0x0100; -pub const MAP_DENYWRITE: ::c_int = 0x0800; -pub const MAP_EXECUTABLE: ::c_int = 0x01000; -pub const MAP_LOCKED: ::c_int = 0x02000; -pub const MAP_NORESERVE: ::c_int = 0x04000; -pub const MAP_POPULATE: ::c_int = 0x08000; -pub const MAP_NONBLOCK: ::c_int = 0x010000; -pub const MAP_STACK: ::c_int = 0x020000; - -pub const SOCK_STREAM: ::c_int = 1; -pub const SOCK_DGRAM: ::c_int = 2; -pub const SOCK_SEQPACKET: ::c_int = 5; - -pub const SOL_SOCKET: ::c_int = 1; - -pub const EDEADLK: ::c_int = 35; -pub const ENAMETOOLONG: ::c_int = 36; -pub const ENOLCK: ::c_int = 37; -pub const ENOSYS: ::c_int = 38; -pub const ENOTEMPTY: ::c_int = 39; -pub const ELOOP: ::c_int = 40; -pub const ENOMSG: ::c_int = 42; -pub const EIDRM: ::c_int = 43; -pub const ECHRNG: ::c_int = 44; -pub const EL2NSYNC: ::c_int = 45; -pub const EL3HLT: ::c_int = 46; -pub const EL3RST: ::c_int = 47; -pub const ELNRNG: ::c_int = 48; -pub const EUNATCH: ::c_int = 49; -pub const ENOCSI: ::c_int = 50; -pub const EL2HLT: ::c_int = 51; -pub const EBADE: ::c_int = 52; -pub const EBADR: ::c_int = 53; -pub const EXFULL: ::c_int = 54; -pub const ENOANO: ::c_int = 55; -pub const EBADRQC: ::c_int = 56; -pub const EBADSLT: ::c_int = 57; -pub const EDEADLOCK: ::c_int = EDEADLK; -pub const EMULTIHOP: ::c_int = 72; -pub const EBADMSG: ::c_int = 74; -pub const EOVERFLOW: ::c_int = 75; -pub const ENOTUNIQ: ::c_int = 76; -pub const EBADFD: ::c_int = 77; -pub const EREMCHG: ::c_int = 78; -pub const ELIBACC: ::c_int = 79; -pub const ELIBBAD: ::c_int = 80; -pub const ELIBSCN: ::c_int = 81; -pub const ELIBMAX: ::c_int = 82; -pub const ELIBEXEC: ::c_int = 83; -pub const EILSEQ: ::c_int = 84; -pub const ERESTART: ::c_int = 85; -pub const ESTRPIPE: ::c_int = 86; -pub const EUSERS: ::c_int = 87; -pub const ENOTSOCK: ::c_int = 88; -pub const EDESTADDRREQ: ::c_int = 89; -pub const EMSGSIZE: ::c_int = 90; -pub const EPROTOTYPE: ::c_int = 91; -pub const ENOPROTOOPT: ::c_int = 92; -pub const EPROTONOSUPPORT: ::c_int = 93; -pub const ESOCKTNOSUPPORT: ::c_int = 94; -pub const EOPNOTSUPP: ::c_int = 95; -pub const ENOTSUP: ::c_int = EOPNOTSUPP; -pub const EPFNOSUPPORT: ::c_int = 96; -pub const EAFNOSUPPORT: ::c_int = 97; -pub const EADDRINUSE: ::c_int = 98; -pub const EADDRNOTAVAIL: ::c_int = 99; -pub const ENETDOWN: ::c_int = 100; -pub const ENETUNREACH: ::c_int = 101; -pub const ENETRESET: ::c_int = 102; -pub const ECONNABORTED: ::c_int = 103; -pub const ECONNRESET: ::c_int = 104; -pub const ENOBUFS: ::c_int = 105; -pub const EISCONN: ::c_int = 106; -pub const ENOTCONN: ::c_int = 107; -pub const ESHUTDOWN: ::c_int = 108; -pub const ETOOMANYREFS: ::c_int = 109; -pub const ETIMEDOUT: ::c_int = 110; -pub const ECONNREFUSED: ::c_int = 111; -pub const EHOSTDOWN: ::c_int = 112; -pub const EHOSTUNREACH: ::c_int = 113; -pub const EALREADY: ::c_int = 114; -pub const EINPROGRESS: ::c_int = 115; -pub const ESTALE: ::c_int = 116; -pub const EUCLEAN: ::c_int = 117; -pub const ENOTNAM: ::c_int = 118; -pub const ENAVAIL: ::c_int = 119; -pub const EISNAM: ::c_int = 120; -pub const EREMOTEIO: ::c_int = 121; -pub const EDQUOT: ::c_int = 122; -pub const ENOMEDIUM: ::c_int = 123; -pub const EMEDIUMTYPE: ::c_int = 124; -pub const ECANCELED: ::c_int = 125; -pub const ENOKEY: ::c_int = 126; -pub const EKEYEXPIRED: ::c_int = 127; -pub const EKEYREVOKED: ::c_int = 128; -pub const EKEYREJECTED: ::c_int = 129; -pub const EOWNERDEAD: ::c_int = 130; -pub const ENOTRECOVERABLE: ::c_int = 131; -pub const ERFKILL: ::c_int = 132; -pub const EHWPOISON: ::c_int = 133; - -pub const SO_REUSEADDR: ::c_int = 2; -pub const SO_TYPE: ::c_int = 3; -pub const SO_ERROR: ::c_int = 4; -pub const SO_DONTROUTE: ::c_int = 5; -pub const SO_BROADCAST: ::c_int = 6; -pub const SO_SNDBUF: ::c_int = 7; -pub const SO_RCVBUF: ::c_int = 8; -pub const SO_KEEPALIVE: ::c_int = 9; -pub const SO_OOBINLINE: ::c_int = 10; -pub const SO_NO_CHECK: ::c_int = 11; -pub const SO_PRIORITY: ::c_int = 12; -pub const SO_LINGER: ::c_int = 13; -pub const SO_BSDCOMPAT: ::c_int = 14; -pub const SO_REUSEPORT: ::c_int = 15; -pub const SO_PASSCRED: ::c_int = 16; -pub const SO_PEERCRED: ::c_int = 17; -pub const SO_RCVLOWAT: ::c_int = 18; -pub const SO_SNDLOWAT: ::c_int = 19; -pub const SO_RCVTIMEO: ::c_int = 20; -pub const SO_SNDTIMEO: ::c_int = 21; -pub const SO_ACCEPTCONN: ::c_int = 30; -pub const SO_SNDBUFFORCE: ::c_int = 32; -pub const SO_RCVBUFFORCE: ::c_int = 33; -pub const SO_PROTOCOL: ::c_int = 38; -pub const SO_DOMAIN: ::c_int = 39; - -pub const SA_ONSTACK: ::c_int = 0x08000000; -pub const SA_SIGINFO: ::c_int = 0x00000004; -pub const SA_NOCLDWAIT: ::c_int = 0x00000002; - -pub const SIGCHLD: ::c_int = 17; -pub const SIGBUS: ::c_int = 7; -pub const SIGTTIN: ::c_int = 21; -pub const SIGTTOU: ::c_int = 22; -pub const SIGXCPU: ::c_int = 24; -pub const SIGXFSZ: ::c_int = 25; -pub const SIGVTALRM: ::c_int = 26; -pub const SIGPROF: ::c_int = 27; -pub const SIGWINCH: ::c_int = 28; -pub const SIGUSR1: ::c_int = 10; -pub const SIGUSR2: ::c_int = 12; -pub const SIGCONT: ::c_int = 18; -pub const SIGSTOP: ::c_int = 19; -pub const SIGTSTP: ::c_int = 20; -pub const SIGURG: ::c_int = 23; -pub const SIGIO: ::c_int = 29; -pub const SIGSYS: ::c_int = 31; -pub const SIGSTKFLT: ::c_int = 16; -pub const SIGPOLL: ::c_int = 29; -pub const SIGPWR: ::c_int = 30; -pub const SIG_SETMASK: ::c_int = 2; -pub const SIG_BLOCK: ::c_int = 0x000000; -pub const SIG_UNBLOCK: ::c_int = 0x01; - -pub const EXTPROC: ::tcflag_t = 0x00010000; - -pub const MAP_HUGETLB: ::c_int = 0x040000; - -pub const F_GETLK: ::c_int = 12; -pub const F_GETOWN: ::c_int = 9; -pub const F_SETLK: ::c_int = 13; -pub const F_SETLKW: ::c_int = 14; -pub const F_SETOWN: ::c_int = 8; - -pub const VEOF: usize = 4; -pub const VEOL: usize = 11; -pub const VEOL2: usize = 16; -pub const VMIN: usize = 6; -pub const IEXTEN: ::tcflag_t = 0x00008000; -pub const TOSTOP: ::tcflag_t = 0x00000100; -pub const FLUSHO: ::tcflag_t = 0x00001000; - -pub const TCGETS: ::c_int = 0x5401; -pub const TCSETS: ::c_int = 0x5402; -pub const TCSETSW: ::c_int = 0x5403; -pub const TCSETSF: ::c_int = 0x5404; -pub const TCGETA: ::c_int = 0x5405; -pub const TCSETA: ::c_int = 0x5406; -pub const TCSETAW: ::c_int = 0x5407; -pub const TCSETAF: ::c_int = 0x5408; -pub const TCSBRK: ::c_int = 0x5409; -pub const TCXONC: ::c_int = 0x540A; -pub const TCFLSH: ::c_int = 0x540B; -pub const TIOCGSOFTCAR: ::c_int = 0x5419; -pub const TIOCSSOFTCAR: ::c_int = 0x541A; -pub const TIOCLINUX: ::c_int = 0x541C; -pub const TIOCGSERIAL: ::c_int = 0x541E; -pub const TIOCEXCL: ::c_int = 0x540C; -pub const TIOCNXCL: ::c_int = 0x540D; -pub const TIOCSCTTY: ::c_int = 0x540E; -pub const TIOCGPGRP: ::c_int = 0x540F; -pub const TIOCSPGRP: ::c_int = 0x5410; -pub const TIOCOUTQ: ::c_int = 0x5411; -pub const TIOCSTI: ::c_int = 0x5412; -pub const TIOCGWINSZ: ::c_int = 0x5413; -pub const TIOCSWINSZ: ::c_int = 0x5414; -pub const TIOCMGET: ::c_int = 0x5415; -pub const TIOCMBIS: ::c_int = 0x5416; -pub const TIOCMBIC: ::c_int = 0x5417; -pub const TIOCMSET: ::c_int = 0x5418; -pub const FIONREAD: ::c_int = 0x541B; -pub const TIOCCONS: ::c_int = 0x541D; - -pub const TIOCGRS485: ::c_int = 0x542E; -pub const TIOCSRS485: ::c_int = 0x542F; - -pub const POLLWRNORM: ::c_short = 0x100; -pub const POLLWRBAND: ::c_short = 0x200; - -pub const TIOCM_LE: ::c_int = 0x001; -pub const TIOCM_DTR: ::c_int = 0x002; -pub const TIOCM_RTS: ::c_int = 0x004; -pub const TIOCM_ST: ::c_int = 0x008; -pub const TIOCM_SR: ::c_int = 0x010; -pub const TIOCM_CTS: ::c_int = 0x020; -pub const TIOCM_CAR: ::c_int = 0x040; -pub const TIOCM_RNG: ::c_int = 0x080; -pub const TIOCM_DSR: ::c_int = 0x100; -pub const TIOCM_CD: ::c_int = TIOCM_CAR; -pub const TIOCM_RI: ::c_int = TIOCM_RNG; - -// Syscall table -pub const SYS_restart_syscall: ::c_long = 0; -pub const SYS_exit: ::c_long = 1; -pub const SYS_fork: ::c_long = 2; -pub const SYS_read: ::c_long = 3; -pub const SYS_write: ::c_long = 4; -pub const SYS_open: ::c_long = 5; -pub const SYS_close: ::c_long = 6; -pub const SYS_creat: ::c_long = 8; -pub const SYS_link: ::c_long = 9; -pub const SYS_unlink: ::c_long = 10; -pub const SYS_execve: ::c_long = 11; -pub const SYS_chdir: ::c_long = 12; -pub const SYS_mknod: ::c_long = 14; -pub const SYS_chmod: ::c_long = 15; -pub const SYS_lchown: ::c_long = 16; -pub const SYS_lseek: ::c_long = 19; -pub const SYS_getpid: ::c_long = 20; -pub const SYS_mount: ::c_long = 21; -pub const SYS_setuid: ::c_long = 23; -pub const SYS_getuid: ::c_long = 24; -pub const SYS_ptrace: ::c_long = 26; -pub const SYS_pause: ::c_long = 29; -pub const SYS_access: ::c_long = 33; -pub const SYS_nice: ::c_long = 34; -pub const SYS_sync: ::c_long = 36; -pub const SYS_kill: ::c_long = 37; -pub const SYS_rename: ::c_long = 38; -pub const SYS_mkdir: ::c_long = 39; -pub const SYS_rmdir: ::c_long = 40; -pub const SYS_dup: ::c_long = 41; -pub const SYS_pipe: ::c_long = 42; -pub const SYS_times: ::c_long = 43; -pub const SYS_brk: ::c_long = 45; -pub const SYS_setgid: ::c_long = 46; -pub const SYS_getgid: ::c_long = 47; -pub const SYS_geteuid: ::c_long = 49; -pub const SYS_getegid: ::c_long = 50; -pub const SYS_acct: ::c_long = 51; -pub const SYS_umount2: ::c_long = 52; -pub const SYS_ioctl: ::c_long = 54; -pub const SYS_fcntl: ::c_long = 55; -pub const SYS_setpgid: ::c_long = 57; -pub const SYS_umask: ::c_long = 60; -pub const SYS_chroot: ::c_long = 61; -pub const SYS_ustat: ::c_long = 62; -pub const SYS_dup2: ::c_long = 63; -pub const SYS_getppid: ::c_long = 64; -pub const SYS_getpgrp: ::c_long = 65; -pub const SYS_setsid: ::c_long = 66; -pub const SYS_sigaction: ::c_long = 67; -pub const SYS_setreuid: ::c_long = 70; -pub const SYS_setregid: ::c_long = 71; -pub const SYS_sigsuspend: ::c_long = 72; -pub const SYS_sigpending: ::c_long = 73; -pub const SYS_sethostname: ::c_long = 74; -pub const SYS_setrlimit: ::c_long = 75; -pub const SYS_getrusage: ::c_long = 77; -pub const SYS_gettimeofday: ::c_long = 78; -pub const SYS_settimeofday: ::c_long = 79; -pub const SYS_getgroups: ::c_long = 80; -pub const SYS_setgroups: ::c_long = 81; -pub const SYS_symlink: ::c_long = 83; -pub const SYS_readlink: ::c_long = 85; -pub const SYS_uselib: ::c_long = 86; -pub const SYS_swapon: ::c_long = 87; -pub const SYS_reboot: ::c_long = 88; -pub const SYS_munmap: ::c_long = 91; -pub const SYS_truncate: ::c_long = 92; -pub const SYS_ftruncate: ::c_long = 93; -pub const SYS_fchmod: ::c_long = 94; -pub const SYS_fchown: ::c_long = 95; -pub const SYS_getpriority: ::c_long = 96; -pub const SYS_setpriority: ::c_long = 97; -pub const SYS_statfs: ::c_long = 99; -pub const SYS_fstatfs: ::c_long = 100; -pub const SYS_syslog: ::c_long = 103; -pub const SYS_setitimer: ::c_long = 104; -pub const SYS_getitimer: ::c_long = 105; -pub const SYS_stat: ::c_long = 106; -pub const SYS_lstat: ::c_long = 107; -pub const SYS_fstat: ::c_long = 108; -pub const SYS_vhangup: ::c_long = 111; -pub const SYS_wait4: ::c_long = 114; -pub const SYS_swapoff: ::c_long = 115; -pub const SYS_sysinfo: ::c_long = 116; -pub const SYS_fsync: ::c_long = 118; -pub const SYS_sigreturn: ::c_long = 119; -pub const SYS_clone: ::c_long = 120; -pub const SYS_setdomainname: ::c_long = 121; -pub const SYS_uname: ::c_long = 122; -pub const SYS_adjtimex: ::c_long = 124; -pub const SYS_mprotect: ::c_long = 125; -pub const SYS_sigprocmask: ::c_long = 126; -pub const SYS_init_module: ::c_long = 128; -pub const SYS_delete_module: ::c_long = 129; -pub const SYS_quotactl: ::c_long = 131; -pub const SYS_getpgid: ::c_long = 132; -pub const SYS_fchdir: ::c_long = 133; -pub const SYS_bdflush: ::c_long = 134; -pub const SYS_sysfs: ::c_long = 135; -pub const SYS_personality: ::c_long = 136; -pub const SYS_setfsuid: ::c_long = 138; -pub const SYS_setfsgid: ::c_long = 139; -pub const SYS__llseek: ::c_long = 140; -pub const SYS_getdents: ::c_long = 141; -pub const SYS__newselect: ::c_long = 142; -pub const SYS_flock: ::c_long = 143; -pub const SYS_msync: ::c_long = 144; -pub const SYS_readv: ::c_long = 145; -pub const SYS_writev: ::c_long = 146; -pub const SYS_getsid: ::c_long = 147; -pub const SYS_fdatasync: ::c_long = 148; -pub const SYS__sysctl: ::c_long = 149; -pub const SYS_mlock: ::c_long = 150; -pub const SYS_munlock: ::c_long = 151; -pub const SYS_mlockall: ::c_long = 152; -pub const SYS_munlockall: ::c_long = 153; -pub const SYS_sched_setparam: ::c_long = 154; -pub const SYS_sched_getparam: ::c_long = 155; -pub const SYS_sched_setscheduler: ::c_long = 156; -pub const SYS_sched_getscheduler: ::c_long = 157; -pub const SYS_sched_yield: ::c_long = 158; -pub const SYS_sched_get_priority_max: ::c_long = 159; -pub const SYS_sched_get_priority_min: ::c_long = 160; -pub const SYS_sched_rr_get_interval: ::c_long = 161; -pub const SYS_nanosleep: ::c_long = 162; -pub const SYS_mremap: ::c_long = 163; -pub const SYS_setresuid: ::c_long = 164; -pub const SYS_getresuid: ::c_long = 165; -pub const SYS_poll: ::c_long = 168; -pub const SYS_nfsservctl: ::c_long = 169; -pub const SYS_setresgid: ::c_long = 170; -pub const SYS_getresgid: ::c_long = 171; -pub const SYS_prctl: ::c_long = 172; -pub const SYS_rt_sigreturn: ::c_long = 173; -pub const SYS_rt_sigaction: ::c_long = 174; -pub const SYS_rt_sigprocmask: ::c_long = 175; -pub const SYS_rt_sigpending: ::c_long = 176; -pub const SYS_rt_sigtimedwait: ::c_long = 177; -pub const SYS_rt_sigqueueinfo: ::c_long = 178; -pub const SYS_rt_sigsuspend: ::c_long = 179; -pub const SYS_pread64: ::c_long = 180; -pub const SYS_pwrite64: ::c_long = 181; -pub const SYS_chown: ::c_long = 182; -pub const SYS_getcwd: ::c_long = 183; -pub const SYS_capget: ::c_long = 184; -pub const SYS_capset: ::c_long = 185; -pub const SYS_sigaltstack: ::c_long = 186; -pub const SYS_sendfile: ::c_long = 187; -pub const SYS_vfork: ::c_long = 190; -pub const SYS_ugetrlimit: ::c_long = 191; -pub const SYS_mmap2: ::c_long = 192; -pub const SYS_truncate64: ::c_long = 193; -pub const SYS_ftruncate64: ::c_long = 194; -pub const SYS_stat64: ::c_long = 195; -pub const SYS_lstat64: ::c_long = 196; -pub const SYS_fstat64: ::c_long = 197; -pub const SYS_lchown32: ::c_long = 198; -pub const SYS_getuid32: ::c_long = 199; -pub const SYS_getgid32: ::c_long = 200; -pub const SYS_geteuid32: ::c_long = 201; -pub const SYS_getegid32: ::c_long = 202; -pub const SYS_setreuid32: ::c_long = 203; -pub const SYS_setregid32: ::c_long = 204; -pub const SYS_getgroups32: ::c_long = 205; -pub const SYS_setgroups32: ::c_long = 206; -pub const SYS_fchown32: ::c_long = 207; -pub const SYS_setresuid32: ::c_long = 208; -pub const SYS_getresuid32: ::c_long = 209; -pub const SYS_setresgid32: ::c_long = 210; -pub const SYS_getresgid32: ::c_long = 211; -pub const SYS_chown32: ::c_long = 212; -pub const SYS_setuid32: ::c_long = 213; -pub const SYS_setgid32: ::c_long = 214; -pub const SYS_setfsuid32: ::c_long = 215; -pub const SYS_setfsgid32: ::c_long = 216; -pub const SYS_getdents64: ::c_long = 217; -pub const SYS_pivot_root: ::c_long = 218; -pub const SYS_mincore: ::c_long = 219; -pub const SYS_madvise: ::c_long = 220; -pub const SYS_fcntl64: ::c_long = 221; -pub const SYS_gettid: ::c_long = 224; -pub const SYS_readahead: ::c_long = 225; -pub const SYS_setxattr: ::c_long = 226; -pub const SYS_lsetxattr: ::c_long = 227; -pub const SYS_fsetxattr: ::c_long = 228; -pub const SYS_getxattr: ::c_long = 229; -pub const SYS_lgetxattr: ::c_long = 230; -pub const SYS_fgetxattr: ::c_long = 231; -pub const SYS_listxattr: ::c_long = 232; -pub const SYS_llistxattr: ::c_long = 233; -pub const SYS_flistxattr: ::c_long = 234; -pub const SYS_removexattr: ::c_long = 235; -pub const SYS_lremovexattr: ::c_long = 236; -pub const SYS_fremovexattr: ::c_long = 237; -pub const SYS_tkill: ::c_long = 238; -pub const SYS_sendfile64: ::c_long = 239; -pub const SYS_futex: ::c_long = 240; -pub const SYS_sched_setaffinity: ::c_long = 241; -pub const SYS_sched_getaffinity: ::c_long = 242; -pub const SYS_io_setup: ::c_long = 243; -pub const SYS_io_destroy: ::c_long = 244; -pub const SYS_io_getevents: ::c_long = 245; -pub const SYS_io_submit: ::c_long = 246; -pub const SYS_io_cancel: ::c_long = 247; -pub const SYS_exit_group: ::c_long = 248; -pub const SYS_lookup_dcookie: ::c_long = 249; -pub const SYS_epoll_create: ::c_long = 250; -pub const SYS_epoll_ctl: ::c_long = 251; -pub const SYS_epoll_wait: ::c_long = 252; -pub const SYS_remap_file_pages: ::c_long = 253; -pub const SYS_set_tid_address: ::c_long = 256; -pub const SYS_timer_create: ::c_long = 257; -pub const SYS_timer_settime: ::c_long = 258; -pub const SYS_timer_gettime: ::c_long = 259; -pub const SYS_timer_getoverrun: ::c_long = 260; -pub const SYS_timer_delete: ::c_long = 261; -pub const SYS_clock_settime: ::c_long = 262; -pub const SYS_clock_gettime: ::c_long = 263; -pub const SYS_clock_getres: ::c_long = 264; -pub const SYS_clock_nanosleep: ::c_long = 265; -pub const SYS_statfs64: ::c_long = 266; -pub const SYS_fstatfs64: ::c_long = 267; -pub const SYS_tgkill: ::c_long = 268; -pub const SYS_utimes: ::c_long = 269; -pub const SYS_pciconfig_iobase: ::c_long = 271; -pub const SYS_pciconfig_read: ::c_long = 272; -pub const SYS_pciconfig_write: ::c_long = 273; -pub const SYS_mq_open: ::c_long = 274; -pub const SYS_mq_unlink: ::c_long = 275; -pub const SYS_mq_timedsend: ::c_long = 276; -pub const SYS_mq_timedreceive: ::c_long = 277; -pub const SYS_mq_notify: ::c_long = 278; -pub const SYS_mq_getsetattr: ::c_long = 279; -pub const SYS_waitid: ::c_long = 280; -pub const SYS_socket: ::c_long = 281; -pub const SYS_bind: ::c_long = 282; -pub const SYS_connect: ::c_long = 283; -pub const SYS_listen: ::c_long = 284; -pub const SYS_accept: ::c_long = 285; -pub const SYS_getsockname: ::c_long = 286; -pub const SYS_getpeername: ::c_long = 287; -pub const SYS_socketpair: ::c_long = 288; -pub const SYS_send: ::c_long = 289; -pub const SYS_sendto: ::c_long = 290; -pub const SYS_recv: ::c_long = 291; -pub const SYS_recvfrom: ::c_long = 292; -pub const SYS_shutdown: ::c_long = 293; -pub const SYS_setsockopt: ::c_long = 294; -pub const SYS_getsockopt: ::c_long = 295; -pub const SYS_sendmsg: ::c_long = 296; -pub const SYS_recvmsg: ::c_long = 297; -pub const SYS_semop: ::c_long = 298; -pub const SYS_semget: ::c_long = 299; -pub const SYS_semctl: ::c_long = 300; -pub const SYS_msgsnd: ::c_long = 301; -pub const SYS_msgrcv: ::c_long = 302; -pub const SYS_msgget: ::c_long = 303; -pub const SYS_msgctl: ::c_long = 304; -pub const SYS_shmat: ::c_long = 305; -pub const SYS_shmdt: ::c_long = 306; -pub const SYS_shmget: ::c_long = 307; -pub const SYS_shmctl: ::c_long = 308; -pub const SYS_add_key: ::c_long = 309; -pub const SYS_request_key: ::c_long = 310; -pub const SYS_keyctl: ::c_long = 311; -pub const SYS_semtimedop: ::c_long = 312; -pub const SYS_vserver: ::c_long = 313; -pub const SYS_ioprio_set: ::c_long = 314; -pub const SYS_ioprio_get: ::c_long = 315; -pub const SYS_inotify_init: ::c_long = 316; -pub const SYS_inotify_add_watch: ::c_long = 317; -pub const SYS_inotify_rm_watch: ::c_long = 318; -pub const SYS_mbind: ::c_long = 319; -pub const SYS_get_mempolicy: ::c_long = 320; -pub const SYS_set_mempolicy: ::c_long = 321; -pub const SYS_openat: ::c_long = 322; -pub const SYS_mkdirat: ::c_long = 323; -pub const SYS_mknodat: ::c_long = 324; -pub const SYS_fchownat: ::c_long = 325; -pub const SYS_futimesat: ::c_long = 326; -pub const SYS_fstatat64: ::c_long = 327; -pub const SYS_unlinkat: ::c_long = 328; -pub const SYS_renameat: ::c_long = 329; -pub const SYS_linkat: ::c_long = 330; -pub const SYS_symlinkat: ::c_long = 331; -pub const SYS_readlinkat: ::c_long = 332; -pub const SYS_fchmodat: ::c_long = 333; -pub const SYS_faccessat: ::c_long = 334; -pub const SYS_pselect6: ::c_long = 335; -pub const SYS_ppoll: ::c_long = 336; -pub const SYS_unshare: ::c_long = 337; -pub const SYS_set_robust_list: ::c_long = 338; -pub const SYS_get_robust_list: ::c_long = 339; -pub const SYS_splice: ::c_long = 340; -pub const SYS_tee: ::c_long = 342; -pub const SYS_vmsplice: ::c_long = 343; -pub const SYS_move_pages: ::c_long = 344; -pub const SYS_getcpu: ::c_long = 345; -pub const SYS_epoll_pwait: ::c_long = 346; -pub const SYS_kexec_load: ::c_long = 347; -pub const SYS_utimensat: ::c_long = 348; -pub const SYS_signalfd: ::c_long = 349; -pub const SYS_timerfd_create: ::c_long = 350; -pub const SYS_eventfd: ::c_long = 351; -pub const SYS_fallocate: ::c_long = 352; -pub const SYS_timerfd_settime: ::c_long = 353; -pub const SYS_timerfd_gettime: ::c_long = 354; -pub const SYS_signalfd4: ::c_long = 355; -pub const SYS_eventfd2: ::c_long = 356; -pub const SYS_epoll_create1: ::c_long = 357; -pub const SYS_dup3: ::c_long = 358; -pub const SYS_pipe2: ::c_long = 359; -pub const SYS_inotify_init1: ::c_long = 360; -pub const SYS_preadv: ::c_long = 361; -pub const SYS_pwritev: ::c_long = 362; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 363; -pub const SYS_perf_event_open: ::c_long = 364; -pub const SYS_recvmmsg: ::c_long = 365; -pub const SYS_accept4: ::c_long = 366; -pub const SYS_fanotify_init: ::c_long = 367; -pub const SYS_fanotify_mark: ::c_long = 368; -pub const SYS_prlimit64: ::c_long = 369; -pub const SYS_name_to_handle_at: ::c_long = 370; -pub const SYS_open_by_handle_at: ::c_long = 371; -pub const SYS_clock_adjtime: ::c_long = 372; -pub const SYS_syncfs: ::c_long = 373; -pub const SYS_sendmmsg: ::c_long = 374; -pub const SYS_setns: ::c_long = 375; -pub const SYS_process_vm_readv: ::c_long = 376; -pub const SYS_process_vm_writev: ::c_long = 377; -pub const SYS_kcmp: ::c_long = 378; -pub const SYS_finit_module: ::c_long = 379; -pub const SYS_sched_setattr: ::c_long = 380; -pub const SYS_sched_getattr: ::c_long = 381; -pub const SYS_renameat2: ::c_long = 382; -pub const SYS_seccomp: ::c_long = 383; -pub const SYS_getrandom: ::c_long = 384; -pub const SYS_memfd_create: ::c_long = 385; -pub const SYS_bpf: ::c_long = 386; -pub const SYS_execveat: ::c_long = 387; -pub const SYS_userfaultfd: ::c_long = 388; -pub const SYS_membarrier: ::c_long = 389; -pub const SYS_mlock2: ::c_long = 390; -pub const SYS_copy_file_range: ::c_long = 391; -pub const SYS_preadv2: ::c_long = 392; -pub const SYS_pwritev2: ::c_long = 393; -pub const SYS_pkey_mprotect: ::c_long = 394; -pub const SYS_pkey_alloc: ::c_long = 395; -pub const SYS_pkey_free: ::c_long = 396; - -#[doc(hidden)] -pub const AF_MAX: ::c_int = 43; -#[doc(hidden)] -pub const PF_MAX: ::c_int = AF_MAX; diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/b32/mips.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/b32/mips.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/b32/mips.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/b32/mips.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,861 +0,0 @@ -pub type c_char = i8; -pub type wchar_t = ::c_int; - -s! { - pub struct stat { - pub st_dev: ::dev_t, - __st_padding1: [::c_long; 2], - pub st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __st_padding2: [::c_long; 2], - pub st_size: ::off_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_blksize: ::blksize_t, - __st_padding3: ::c_long, - pub st_blocks: ::blkcnt_t, - __st_padding4: [::c_long; 14], - } - - pub struct stat64 { - pub st_dev: ::dev_t, - __st_padding1: [::c_long; 2], - pub st_ino: ::ino64_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __st_padding2: [::c_long; 2], - pub st_size: ::off_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_blksize: ::blksize_t, - __st_padding3: ::c_long, - pub st_blocks: ::blkcnt64_t, - __st_padding4: [::c_long; 14], - } - - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_size: ::size_t, - pub ss_flags: ::c_int, - } - - pub struct ipc_perm { - pub __ipc_perm_key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::mode_t, - pub __seq: ::c_int, - __unused1: ::c_long, - __unused2: ::c_long - } - - pub struct shmid_ds { - pub shm_perm: ::ipc_perm, - pub shm_segsz: ::size_t, - pub shm_atime: ::time_t, - pub shm_dtime: ::time_t, - pub shm_ctime: ::time_t, - pub shm_cpid: ::pid_t, - pub shm_lpid: ::pid_t, - pub shm_nattch: ::c_ulong, - __pad1: ::c_ulong, - __pad2: ::c_ulong, - } - - pub struct msqid_ds { - pub msg_perm: ::ipc_perm, - #[cfg(target_endian = "big")] - __unused1: ::c_int, - pub msg_stime: ::time_t, - #[cfg(target_endian = "little")] - __unused1: ::c_int, - #[cfg(target_endian = "big")] - __unused2: ::c_int, - pub msg_rtime: ::time_t, - #[cfg(target_endian = "little")] - __unused2: ::c_int, - #[cfg(target_endian = "big")] - __unused3: ::c_int, - pub msg_ctime: ::time_t, - #[cfg(target_endian = "little")] - __unused3: ::c_int, - __msg_cbytes: ::c_ulong, - pub msg_qnum: ::msgqnum_t, - pub msg_qbytes: ::msglen_t, - pub msg_lspid: ::pid_t, - pub msg_lrpid: ::pid_t, - __pad1: ::c_ulong, - __pad2: ::c_ulong, - } - - pub struct statfs { - pub f_type: ::c_ulong, - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_fsid: ::fsid_t, - pub f_namelen: ::c_ulong, - pub f_flags: ::c_ulong, - pub f_spare: [::c_ulong; 5], - } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_code: ::c_int, - pub si_errno: ::c_int, - pub _pad: [::c_int; 29], - _align: [usize; 0], - } - - pub struct statfs64 { - pub f_type: ::c_ulong, - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_fsid: ::fsid_t, - pub f_namelen: ::c_ulong, - pub f_flags: ::c_ulong, - pub f_spare: [::c_ulong; 5], - } - - pub struct statvfs64 { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_favail: u64, - #[cfg(target_endian = "little")] - pub f_fsid: ::c_ulong, - __f_unused: ::c_int, - #[cfg(target_endian = "big")] - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 23], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } -} - -pub const SIGSTKSZ: ::size_t = 8192; -pub const MINSIGSTKSZ: ::size_t = 2048; - -pub const O_DIRECT: ::c_int = 0o100000; -pub const O_DIRECTORY: ::c_int = 0o200000; -pub const O_NOFOLLOW: ::c_int = 0o400000; -pub const O_ASYNC: ::c_int = 0o10000; -pub const O_LARGEFILE: ::c_int = 0x2000; - -pub const FIOCLEX: ::c_int = 0x6601; -pub const FIONBIO: ::c_int = 0x667E; - -pub const RLIMIT_RSS: ::c_int = 7; -pub const RLIMIT_NOFILE: ::c_int = 5; -pub const RLIMIT_AS: ::c_int = 6; -pub const RLIMIT_NPROC: ::c_int = 8; -pub const RLIMIT_MEMLOCK: ::c_int = 9; -pub const RLIMIT_NLIMITS: ::c_int = 16; - -pub const MCL_CURRENT: ::c_int = 0x0001; -pub const MCL_FUTURE: ::c_int = 0x0002; -pub const CBAUD: ::tcflag_t = 0o0010017; -pub const TAB1: ::c_int = 0x00000800; -pub const TAB2: ::c_int = 0x00001000; -pub const TAB3: ::c_int = 0x00001800; -pub const CR1: ::c_int = 0x00000200; -pub const CR2: ::c_int = 0x00000400; -pub const CR3: ::c_int = 0x00000600; -pub const FF1: ::c_int = 0x00008000; -pub const BS1: ::c_int = 0x00002000; -pub const VT1: ::c_int = 0x00004000; -pub const VWERASE: usize = 14; -pub const VREPRINT: usize = 12; -pub const VSUSP: usize = 10; -pub const VSTART: usize = 8; -pub const VSTOP: usize = 9; -pub const VDISCARD: usize = 13; -pub const VTIME: usize = 5; -pub const IXON: ::tcflag_t = 0x00000400; -pub const IXOFF: ::tcflag_t = 0x00001000; -pub const ONLCR: ::tcflag_t = 0x4; -pub const CSIZE: ::tcflag_t = 0x00000030; -pub const CS6: ::tcflag_t = 0x00000010; -pub const CS7: ::tcflag_t = 0x00000020; -pub const CS8: ::tcflag_t = 0x00000030; -pub const CSTOPB: ::tcflag_t = 0x00000040; -pub const CREAD: ::tcflag_t = 0x00000080; -pub const PARENB: ::tcflag_t = 0x00000100; -pub const PARODD: ::tcflag_t = 0x00000200; -pub const HUPCL: ::tcflag_t = 0x00000400; -pub const CLOCAL: ::tcflag_t = 0x00000800; -pub const ECHOKE: ::tcflag_t = 0x00000800; -pub const ECHOE: ::tcflag_t = 0x00000010; -pub const ECHOK: ::tcflag_t = 0x00000020; -pub const ECHONL: ::tcflag_t = 0x00000040; -pub const ECHOPRT: ::tcflag_t = 0x00000400; -pub const ECHOCTL: ::tcflag_t = 0x00000200; -pub const ISIG: ::tcflag_t = 0x00000001; -pub const ICANON: ::tcflag_t = 0x00000002; -pub const PENDIN: ::tcflag_t = 0x00004000; -pub const NOFLSH: ::tcflag_t = 0x00000080; -pub const CIBAUD: ::tcflag_t = 0o02003600000; -pub const CBAUDEX: ::tcflag_t = 0o010000; -pub const VSWTC: usize = 7; -pub const OLCUC: ::tcflag_t = 0o000002; -pub const NLDLY: ::tcflag_t = 0o000400; -pub const CRDLY: ::tcflag_t = 0o003000; -pub const TABDLY: ::tcflag_t = 0o014000; -pub const BSDLY: ::tcflag_t = 0o020000; -pub const FFDLY: ::tcflag_t = 0o100000; -pub const VTDLY: ::tcflag_t = 0o040000; -pub const XTABS: ::tcflag_t = 0o014000; -pub const B57600: ::speed_t = 0o010001; -pub const B115200: ::speed_t = 0o010002; -pub const B230400: ::speed_t = 0o010003; -pub const B460800: ::speed_t = 0o010004; -pub const B500000: ::speed_t = 0o010005; -pub const B576000: ::speed_t = 0o010006; -pub const B921600: ::speed_t = 0o010007; -pub const B1000000: ::speed_t = 0o010010; -pub const B1152000: ::speed_t = 0o010011; -pub const B1500000: ::speed_t = 0o010012; -pub const B2000000: ::speed_t = 0o010013; -pub const B2500000: ::speed_t = 0o010014; -pub const B3000000: ::speed_t = 0o010015; -pub const B3500000: ::speed_t = 0o010016; -pub const B4000000: ::speed_t = 0o010017; - -pub const O_APPEND: ::c_int = 0o010; -pub const O_CREAT: ::c_int = 0o400; -pub const O_EXCL: ::c_int = 0o2000; -pub const O_NOCTTY: ::c_int = 0o4000; -pub const O_NONBLOCK: ::c_int = 0o200; -pub const O_SYNC: ::c_int = 0o40020; -pub const O_RSYNC: ::c_int = 0o40020; -pub const O_DSYNC: ::c_int = 0o020; - -pub const SOCK_NONBLOCK: ::c_int = 0o200; - -pub const MAP_ANON: ::c_int = 0x800; -pub const MAP_GROWSDOWN: ::c_int = 0x1000; -pub const MAP_DENYWRITE: ::c_int = 0x2000; -pub const MAP_EXECUTABLE: ::c_int = 0x4000; -pub const MAP_LOCKED: ::c_int = 0x8000; -pub const MAP_NORESERVE: ::c_int = 0x0400; -pub const MAP_POPULATE: ::c_int = 0x10000; -pub const MAP_NONBLOCK: ::c_int = 0x20000; -pub const MAP_STACK: ::c_int = 0x40000; - -pub const EDEADLK: ::c_int = 45; -pub const ENAMETOOLONG: ::c_int = 78; -pub const ENOLCK: ::c_int = 46; -pub const ENOSYS: ::c_int = 89; -pub const ENOTEMPTY: ::c_int = 93; -pub const ELOOP: ::c_int = 90; -pub const ENOMSG: ::c_int = 35; -pub const EIDRM: ::c_int = 36; -pub const ECHRNG: ::c_int = 37; -pub const EL2NSYNC: ::c_int = 38; -pub const EL3HLT: ::c_int = 39; -pub const EL3RST: ::c_int = 40; -pub const ELNRNG: ::c_int = 41; -pub const EUNATCH: ::c_int = 42; -pub const ENOCSI: ::c_int = 43; -pub const EL2HLT: ::c_int = 44; -pub const EBADE: ::c_int = 50; -pub const EBADR: ::c_int = 51; -pub const EXFULL: ::c_int = 52; -pub const ENOANO: ::c_int = 53; -pub const EBADRQC: ::c_int = 54; -pub const EBADSLT: ::c_int = 55; -pub const EDEADLOCK: ::c_int = 56; -pub const EMULTIHOP: ::c_int = 74; -pub const EOVERFLOW: ::c_int = 79; -pub const ENOTUNIQ: ::c_int = 80; -pub const EBADFD: ::c_int = 81; -pub const EBADMSG: ::c_int = 77; -pub const EREMCHG: ::c_int = 82; -pub const ELIBACC: ::c_int = 83; -pub const ELIBBAD: ::c_int = 84; -pub const ELIBSCN: ::c_int = 85; -pub const ELIBMAX: ::c_int = 86; -pub const ELIBEXEC: ::c_int = 87; -pub const EILSEQ: ::c_int = 88; -pub const ERESTART: ::c_int = 91; -pub const ESTRPIPE: ::c_int = 92; -pub const EUSERS: ::c_int = 94; -pub const ENOTSOCK: ::c_int = 95; -pub const EDESTADDRREQ: ::c_int = 96; -pub const EMSGSIZE: ::c_int = 97; -pub const EPROTOTYPE: ::c_int = 98; -pub const ENOPROTOOPT: ::c_int = 99; -pub const EPROTONOSUPPORT: ::c_int = 120; -pub const ESOCKTNOSUPPORT: ::c_int = 121; -pub const EOPNOTSUPP: ::c_int = 122; -pub const ENOTSUP: ::c_int = EOPNOTSUPP; -pub const EPFNOSUPPORT: ::c_int = 123; -pub const EAFNOSUPPORT: ::c_int = 124; -pub const EADDRINUSE: ::c_int = 125; -pub const EADDRNOTAVAIL: ::c_int = 126; -pub const ENETDOWN: ::c_int = 127; -pub const ENETUNREACH: ::c_int = 128; -pub const ENETRESET: ::c_int = 129; -pub const ECONNABORTED: ::c_int = 130; -pub const ECONNRESET: ::c_int = 131; -pub const ENOBUFS: ::c_int = 132; -pub const EISCONN: ::c_int = 133; -pub const ENOTCONN: ::c_int = 134; -pub const ESHUTDOWN: ::c_int = 143; -pub const ETOOMANYREFS: ::c_int = 144; -pub const ETIMEDOUT: ::c_int = 145; -pub const ECONNREFUSED: ::c_int = 146; -pub const EHOSTDOWN: ::c_int = 147; -pub const EHOSTUNREACH: ::c_int = 148; -pub const EALREADY: ::c_int = 149; -pub const EINPROGRESS: ::c_int = 150; -pub const ESTALE: ::c_int = 151; -pub const EUCLEAN: ::c_int = 135; -pub const ENOTNAM: ::c_int = 137; -pub const ENAVAIL: ::c_int = 138; -pub const EISNAM: ::c_int = 139; -pub const EREMOTEIO: ::c_int = 140; -pub const EDQUOT: ::c_int = 1133; -pub const ENOMEDIUM: ::c_int = 159; -pub const EMEDIUMTYPE: ::c_int = 160; -pub const ECANCELED: ::c_int = 158; -pub const ENOKEY: ::c_int = 161; -pub const EKEYEXPIRED: ::c_int = 162; -pub const EKEYREVOKED: ::c_int = 163; -pub const EKEYREJECTED: ::c_int = 164; -pub const EOWNERDEAD: ::c_int = 165; -pub const ENOTRECOVERABLE: ::c_int = 166; -pub const EHWPOISON: ::c_int = 168; -pub const ERFKILL: ::c_int = 167; - -pub const SOCK_STREAM: ::c_int = 2; -pub const SOCK_DGRAM: ::c_int = 1; -pub const SOCK_SEQPACKET: ::c_int = 5; - -pub const SOL_SOCKET: ::c_int = 65535; - -pub const SO_REUSEADDR: ::c_int = 0x0004; -pub const SO_KEEPALIVE: ::c_int = 0x0008; -pub const SO_DONTROUTE: ::c_int = 0x0010; -pub const SO_BROADCAST: ::c_int = 0x0020; -pub const SO_LINGER: ::c_int = 0x0080; -pub const SO_OOBINLINE: ::c_int = 0x0100; -pub const SO_REUSEPORT: ::c_int = 0x0200; -pub const SO_SNDBUF: ::c_int = 0x1001; -pub const SO_RCVBUF: ::c_int = 0x1002; -pub const SO_SNDLOWAT: ::c_int = 0x1003; -pub const SO_RCVLOWAT: ::c_int = 0x1004; -pub const SO_RCVTIMEO: ::c_int = 0x1006; -pub const SO_SNDTIMEO: ::c_int = 0x1005; -pub const SO_ERROR: ::c_int = 0x1007; -pub const SO_TYPE: ::c_int = 0x1008; -pub const SO_ACCEPTCONN: ::c_int = 0x1009; -pub const SO_PROTOCOL: ::c_int = 0x1028; -pub const SO_DOMAIN: ::c_int = 0x1029; -pub const SO_NO_CHECK: ::c_int = 11; -pub const SO_PRIORITY: ::c_int = 12; -pub const SO_BSDCOMPAT: ::c_int = 14; -pub const SO_PASSCRED: ::c_int = 17; -pub const SO_PEERCRED: ::c_int = 18; -pub const SO_SNDBUFFORCE: ::c_int = 31; -pub const SO_RCVBUFFORCE: ::c_int = 33; - -pub const SA_ONSTACK: ::c_int = 0x08000000; -pub const SA_SIGINFO: ::c_int = 8; -pub const SA_NOCLDWAIT: ::c_int = 0x10000; - -pub const SIGCHLD: ::c_int = 18; -pub const SIGBUS: ::c_int = 10; -pub const SIGTTIN: ::c_int = 26; -pub const SIGTTOU: ::c_int = 27; -pub const SIGXCPU: ::c_int = 30; -pub const SIGXFSZ: ::c_int = 31; -pub const SIGVTALRM: ::c_int = 28; -pub const SIGPROF: ::c_int = 29; -pub const SIGWINCH: ::c_int = 20; -pub const SIGUSR1: ::c_int = 16; -pub const SIGUSR2: ::c_int = 17; -pub const SIGCONT: ::c_int = 25; -pub const SIGSTOP: ::c_int = 23; -pub const SIGTSTP: ::c_int = 24; -pub const SIGURG: ::c_int = 21; -pub const SIGIO: ::c_int = 22; -pub const SIGSYS: ::c_int = 12; -pub const SIGSTKFLT: ::c_int = 7; -pub const SIGPOLL: ::c_int = ::SIGIO; -pub const SIGPWR: ::c_int = 19; -pub const SIG_SETMASK: ::c_int = 3; -pub const SIG_BLOCK: ::c_int = 1; -pub const SIG_UNBLOCK: ::c_int = 2; - -pub const EXTPROC: ::tcflag_t = 0o200000; - -pub const MAP_HUGETLB: ::c_int = 0x80000; - -pub const F_GETLK: ::c_int = 33; -pub const F_GETOWN: ::c_int = 23; -pub const F_SETLK: ::c_int = 34; -pub const F_SETLKW: ::c_int = 35; -pub const F_SETOWN: ::c_int = 24; - -pub const VEOF: usize = 16; -pub const VEOL: usize = 17; -pub const VEOL2: usize = 6; -pub const VMIN: usize = 4; -pub const IEXTEN: ::tcflag_t = 0o000400; -pub const TOSTOP: ::tcflag_t = 0o100000; -pub const FLUSHO: ::tcflag_t = 0o020000; - -pub const TCGETS: ::c_int = 0x540D; -pub const TCSETS: ::c_int = 0x540E; -pub const TCSETSW: ::c_int = 0x540F; -pub const TCSETSF: ::c_int = 0x5410; -pub const TCGETA: ::c_int = 0x5401; -pub const TCSETA: ::c_int = 0x5402; -pub const TCSETAW: ::c_int = 0x5403; -pub const TCSETAF: ::c_int = 0x5404; -pub const TCSBRK: ::c_int = 0x5405; -pub const TCXONC: ::c_int = 0x5406; -pub const TCFLSH: ::c_int = 0x5407; -pub const TIOCGSOFTCAR: ::c_int = 0x5481; -pub const TIOCSSOFTCAR: ::c_int = 0x5482; -pub const TIOCLINUX: ::c_int = 0x5483; -pub const TIOCGSERIAL: ::c_int = 0x5484; -pub const TIOCEXCL: ::c_int = 0x740D; -pub const TIOCNXCL: ::c_int = 0x740E; -pub const TIOCSCTTY: ::c_int = 0x5480; -pub const TIOCGPGRP: ::c_int = 0x40047477; -pub const TIOCSPGRP: ::c_int = 0x80047476; -pub const TIOCOUTQ: ::c_int = 0x7472; -pub const TIOCSTI: ::c_int = 0x5472; -pub const TIOCGWINSZ: ::c_int = 0x40087468; -pub const TIOCSWINSZ: ::c_int = 0x80087467; -pub const TIOCMGET: ::c_int = 0x741D; -pub const TIOCMBIS: ::c_int = 0x741B; -pub const TIOCMBIC: ::c_int = 0x741C; -pub const TIOCMSET: ::c_int = 0x741A; -pub const FIONREAD: ::c_int = 0x467F; -pub const TIOCCONS: ::c_int = 0x80047478; - -pub const TIOCGRS485: ::c_int = 0x4020542E; -pub const TIOCSRS485: ::c_int = 0xC020542F; - -pub const POLLWRNORM: ::c_short = 0x4; -pub const POLLWRBAND: ::c_short = 0x100; - -pub const TIOCM_LE: ::c_int = 0x001; -pub const TIOCM_DTR: ::c_int = 0x002; -pub const TIOCM_RTS: ::c_int = 0x004; -pub const TIOCM_ST: ::c_int = 0x010; -pub const TIOCM_SR: ::c_int = 0x020; -pub const TIOCM_CTS: ::c_int = 0x040; -pub const TIOCM_CAR: ::c_int = 0x100; -pub const TIOCM_CD: ::c_int = TIOCM_CAR; -pub const TIOCM_RNG: ::c_int = 0x200; -pub const TIOCM_RI: ::c_int = TIOCM_RNG; -pub const TIOCM_DSR: ::c_int = 0x400; - -pub const SYS_syscall: ::c_long = 4000 + 0; -pub const SYS_exit: ::c_long = 4000 + 1; -pub const SYS_fork: ::c_long = 4000 + 2; -pub const SYS_read: ::c_long = 4000 + 3; -pub const SYS_write: ::c_long = 4000 + 4; -pub const SYS_open: ::c_long = 4000 + 5; -pub const SYS_close: ::c_long = 4000 + 6; -pub const SYS_waitpid: ::c_long = 4000 + 7; -pub const SYS_creat: ::c_long = 4000 + 8; -pub const SYS_link: ::c_long = 4000 + 9; -pub const SYS_unlink: ::c_long = 4000 + 10; -pub const SYS_execve: ::c_long = 4000 + 11; -pub const SYS_chdir: ::c_long = 4000 + 12; -pub const SYS_time: ::c_long = 4000 + 13; -pub const SYS_mknod: ::c_long = 4000 + 14; -pub const SYS_chmod: ::c_long = 4000 + 15; -pub const SYS_lchown: ::c_long = 4000 + 16; -pub const SYS_break: ::c_long = 4000 + 17; -pub const SYS_unused18: ::c_long = 4000 + 18; -pub const SYS_lseek: ::c_long = 4000 + 19; -pub const SYS_getpid: ::c_long = 4000 + 20; -pub const SYS_mount: ::c_long = 4000 + 21; -pub const SYS_umount: ::c_long = 4000 + 22; -pub const SYS_setuid: ::c_long = 4000 + 23; -pub const SYS_getuid: ::c_long = 4000 + 24; -pub const SYS_stime: ::c_long = 4000 + 25; -pub const SYS_ptrace: ::c_long = 4000 + 26; -pub const SYS_alarm: ::c_long = 4000 + 27; -pub const SYS_unused28: ::c_long = 4000 + 28; -pub const SYS_pause: ::c_long = 4000 + 29; -pub const SYS_utime: ::c_long = 4000 + 30; -pub const SYS_stty: ::c_long = 4000 + 31; -pub const SYS_gtty: ::c_long = 4000 + 32; -pub const SYS_access: ::c_long = 4000 + 33; -pub const SYS_nice: ::c_long = 4000 + 34; -pub const SYS_ftime: ::c_long = 4000 + 35; -pub const SYS_sync: ::c_long = 4000 + 36; -pub const SYS_kill: ::c_long = 4000 + 37; -pub const SYS_rename: ::c_long = 4000 + 38; -pub const SYS_mkdir: ::c_long = 4000 + 39; -pub const SYS_rmdir: ::c_long = 4000 + 40; -pub const SYS_dup: ::c_long = 4000 + 41; -pub const SYS_pipe: ::c_long = 4000 + 42; -pub const SYS_times: ::c_long = 4000 + 43; -pub const SYS_prof: ::c_long = 4000 + 44; -pub const SYS_brk: ::c_long = 4000 + 45; -pub const SYS_setgid: ::c_long = 4000 + 46; -pub const SYS_getgid: ::c_long = 4000 + 47; -pub const SYS_signal: ::c_long = 4000 + 48; -pub const SYS_geteuid: ::c_long = 4000 + 49; -pub const SYS_getegid: ::c_long = 4000 + 50; -pub const SYS_acct: ::c_long = 4000 + 51; -pub const SYS_umount2: ::c_long = 4000 + 52; -pub const SYS_lock: ::c_long = 4000 + 53; -pub const SYS_ioctl: ::c_long = 4000 + 54; -pub const SYS_fcntl: ::c_long = 4000 + 55; -pub const SYS_mpx: ::c_long = 4000 + 56; -pub const SYS_setpgid: ::c_long = 4000 + 57; -pub const SYS_ulimit: ::c_long = 4000 + 58; -pub const SYS_unused59: ::c_long = 4000 + 59; -pub const SYS_umask: ::c_long = 4000 + 60; -pub const SYS_chroot: ::c_long = 4000 + 61; -pub const SYS_ustat: ::c_long = 4000 + 62; -pub const SYS_dup2: ::c_long = 4000 + 63; -pub const SYS_getppid: ::c_long = 4000 + 64; -pub const SYS_getpgrp: ::c_long = 4000 + 65; -pub const SYS_setsid: ::c_long = 4000 + 66; -pub const SYS_sigaction: ::c_long = 4000 + 67; -pub const SYS_sgetmask: ::c_long = 4000 + 68; -pub const SYS_ssetmask: ::c_long = 4000 + 69; -pub const SYS_setreuid: ::c_long = 4000 + 70; -pub const SYS_setregid: ::c_long = 4000 + 71; -pub const SYS_sigsuspend: ::c_long = 4000 + 72; -pub const SYS_sigpending: ::c_long = 4000 + 73; -pub const SYS_sethostname: ::c_long = 4000 + 74; -pub const SYS_setrlimit: ::c_long = 4000 + 75; -pub const SYS_getrlimit: ::c_long = 4000 + 76; -pub const SYS_getrusage: ::c_long = 4000 + 77; -pub const SYS_gettimeofday: ::c_long = 4000 + 78; -pub const SYS_settimeofday: ::c_long = 4000 + 79; -pub const SYS_getgroups: ::c_long = 4000 + 80; -pub const SYS_setgroups: ::c_long = 4000 + 81; -pub const SYS_reserved82: ::c_long = 4000 + 82; -pub const SYS_symlink: ::c_long = 4000 + 83; -pub const SYS_unused84: ::c_long = 4000 + 84; -pub const SYS_readlink: ::c_long = 4000 + 85; -pub const SYS_uselib: ::c_long = 4000 + 86; -pub const SYS_swapon: ::c_long = 4000 + 87; -pub const SYS_reboot: ::c_long = 4000 + 88; -pub const SYS_readdir: ::c_long = 4000 + 89; -pub const SYS_mmap: ::c_long = 4000 + 90; -pub const SYS_munmap: ::c_long = 4000 + 91; -pub const SYS_truncate: ::c_long = 4000 + 92; -pub const SYS_ftruncate: ::c_long = 4000 + 93; -pub const SYS_fchmod: ::c_long = 4000 + 94; -pub const SYS_fchown: ::c_long = 4000 + 95; -pub const SYS_getpriority: ::c_long = 4000 + 96; -pub const SYS_setpriority: ::c_long = 4000 + 97; -pub const SYS_profil: ::c_long = 4000 + 98; -pub const SYS_statfs: ::c_long = 4000 + 99; -pub const SYS_fstatfs: ::c_long = 4000 + 100; -pub const SYS_ioperm: ::c_long = 4000 + 101; -pub const SYS_socketcall: ::c_long = 4000 + 102; -pub const SYS_syslog: ::c_long = 4000 + 103; -pub const SYS_setitimer: ::c_long = 4000 + 104; -pub const SYS_getitimer: ::c_long = 4000 + 105; -pub const SYS_stat: ::c_long = 4000 + 106; -pub const SYS_lstat: ::c_long = 4000 + 107; -pub const SYS_fstat: ::c_long = 4000 + 108; -pub const SYS_unused109: ::c_long = 4000 + 109; -pub const SYS_iopl: ::c_long = 4000 + 110; -pub const SYS_vhangup: ::c_long = 4000 + 111; -pub const SYS_idle: ::c_long = 4000 + 112; -pub const SYS_vm86: ::c_long = 4000 + 113; -pub const SYS_wait4: ::c_long = 4000 + 114; -pub const SYS_swapoff: ::c_long = 4000 + 115; -pub const SYS_sysinfo: ::c_long = 4000 + 116; -pub const SYS_ipc: ::c_long = 4000 + 117; -pub const SYS_fsync: ::c_long = 4000 + 118; -pub const SYS_sigreturn: ::c_long = 4000 + 119; -pub const SYS_clone: ::c_long = 4000 + 120; -pub const SYS_setdomainname: ::c_long = 4000 + 121; -pub const SYS_uname: ::c_long = 4000 + 122; -pub const SYS_modify_ldt: ::c_long = 4000 + 123; -pub const SYS_adjtimex: ::c_long = 4000 + 124; -pub const SYS_mprotect: ::c_long = 4000 + 125; -pub const SYS_sigprocmask: ::c_long = 4000 + 126; -pub const SYS_create_module: ::c_long = 4000 + 127; -pub const SYS_init_module: ::c_long = 4000 + 128; -pub const SYS_delete_module: ::c_long = 4000 + 129; -pub const SYS_get_kernel_syms: ::c_long = 4000 + 130; -pub const SYS_quotactl: ::c_long = 4000 + 131; -pub const SYS_getpgid: ::c_long = 4000 + 132; -pub const SYS_fchdir: ::c_long = 4000 + 133; -pub const SYS_bdflush: ::c_long = 4000 + 134; -pub const SYS_sysfs: ::c_long = 4000 + 135; -pub const SYS_personality: ::c_long = 4000 + 136; -pub const SYS_afs_syscall: ::c_long = 4000 + 137; -pub const SYS_setfsuid: ::c_long = 4000 + 138; -pub const SYS_setfsgid: ::c_long = 4000 + 139; -pub const SYS__llseek: ::c_long = 4000 + 140; -pub const SYS_getdents: ::c_long = 4000 + 141; -pub const SYS_flock: ::c_long = 4000 + 143; -pub const SYS_msync: ::c_long = 4000 + 144; -pub const SYS_readv: ::c_long = 4000 + 145; -pub const SYS_writev: ::c_long = 4000 + 146; -pub const SYS_cacheflush: ::c_long = 4000 + 147; -pub const SYS_cachectl: ::c_long = 4000 + 148; -pub const SYS_sysmips: ::c_long = 4000 + 149; -pub const SYS_unused150: ::c_long = 4000 + 150; -pub const SYS_getsid: ::c_long = 4000 + 151; -pub const SYS_fdatasync: ::c_long = 4000 + 152; -pub const SYS__sysctl: ::c_long = 4000 + 153; -pub const SYS_mlock: ::c_long = 4000 + 154; -pub const SYS_munlock: ::c_long = 4000 + 155; -pub const SYS_mlockall: ::c_long = 4000 + 156; -pub const SYS_munlockall: ::c_long = 4000 + 157; -pub const SYS_sched_setparam: ::c_long = 4000 + 158; -pub const SYS_sched_getparam: ::c_long = 4000 + 159; -pub const SYS_sched_setscheduler: ::c_long = 4000 + 160; -pub const SYS_sched_getscheduler: ::c_long = 4000 + 161; -pub const SYS_sched_yield: ::c_long = 4000 + 162; -pub const SYS_sched_get_priority_max: ::c_long = 4000 + 163; -pub const SYS_sched_get_priority_min: ::c_long = 4000 + 164; -pub const SYS_sched_rr_get_interval: ::c_long = 4000 + 165; -pub const SYS_nanosleep: ::c_long = 4000 + 166; -pub const SYS_mremap: ::c_long = 4000 + 167; -pub const SYS_accept: ::c_long = 4000 + 168; -pub const SYS_bind: ::c_long = 4000 + 169; -pub const SYS_connect: ::c_long = 4000 + 170; -pub const SYS_getpeername: ::c_long = 4000 + 171; -pub const SYS_getsockname: ::c_long = 4000 + 172; -pub const SYS_getsockopt: ::c_long = 4000 + 173; -pub const SYS_listen: ::c_long = 4000 + 174; -pub const SYS_recv: ::c_long = 4000 + 175; -pub const SYS_recvfrom: ::c_long = 4000 + 176; -pub const SYS_recvmsg: ::c_long = 4000 + 177; -pub const SYS_send: ::c_long = 4000 + 178; -pub const SYS_sendmsg: ::c_long = 4000 + 179; -pub const SYS_sendto: ::c_long = 4000 + 180; -pub const SYS_setsockopt: ::c_long = 4000 + 181; -pub const SYS_shutdown: ::c_long = 4000 + 182; -pub const SYS_socket: ::c_long = 4000 + 183; -pub const SYS_socketpair: ::c_long = 4000 + 184; -pub const SYS_setresuid: ::c_long = 4000 + 185; -pub const SYS_getresuid: ::c_long = 4000 + 186; -pub const SYS_query_module: ::c_long = 4000 + 187; -pub const SYS_poll: ::c_long = 4000 + 188; -pub const SYS_nfsservctl: ::c_long = 4000 + 189; -pub const SYS_setresgid: ::c_long = 4000 + 190; -pub const SYS_getresgid: ::c_long = 4000 + 191; -pub const SYS_prctl: ::c_long = 4000 + 192; -pub const SYS_rt_sigreturn: ::c_long = 4000 + 193; -pub const SYS_rt_sigaction: ::c_long = 4000 + 194; -pub const SYS_rt_sigprocmask: ::c_long = 4000 + 195; -pub const SYS_rt_sigpending: ::c_long = 4000 + 196; -pub const SYS_rt_sigtimedwait: ::c_long = 4000 + 197; -pub const SYS_rt_sigqueueinfo: ::c_long = 4000 + 198; -pub const SYS_rt_sigsuspend: ::c_long = 4000 + 199; -pub const SYS_chown: ::c_long = 4000 + 202; -pub const SYS_getcwd: ::c_long = 4000 + 203; -pub const SYS_capget: ::c_long = 4000 + 204; -pub const SYS_capset: ::c_long = 4000 + 205; -pub const SYS_sigaltstack: ::c_long = 4000 + 206; -pub const SYS_sendfile: ::c_long = 4000 + 207; -pub const SYS_getpmsg: ::c_long = 4000 + 208; -pub const SYS_putpmsg: ::c_long = 4000 + 209; -pub const SYS_mmap2: ::c_long = 4000 + 210; -pub const SYS_truncate64: ::c_long = 4000 + 211; -pub const SYS_ftruncate64: ::c_long = 4000 + 212; -pub const SYS_stat64: ::c_long = 4000 + 213; -pub const SYS_lstat64: ::c_long = 4000 + 214; -pub const SYS_fstat64: ::c_long = 4000 + 215; -pub const SYS_pivot_root: ::c_long = 4000 + 216; -pub const SYS_mincore: ::c_long = 4000 + 217; -pub const SYS_madvise: ::c_long = 4000 + 218; -pub const SYS_getdents64: ::c_long = 4000 + 219; -pub const SYS_fcntl64: ::c_long = 4000 + 220; -pub const SYS_reserved221: ::c_long = 4000 + 221; -pub const SYS_gettid: ::c_long = 4000 + 222; -pub const SYS_readahead: ::c_long = 4000 + 223; -pub const SYS_setxattr: ::c_long = 4000 + 224; -pub const SYS_lsetxattr: ::c_long = 4000 + 225; -pub const SYS_fsetxattr: ::c_long = 4000 + 226; -pub const SYS_getxattr: ::c_long = 4000 + 227; -pub const SYS_lgetxattr: ::c_long = 4000 + 228; -pub const SYS_fgetxattr: ::c_long = 4000 + 229; -pub const SYS_listxattr: ::c_long = 4000 + 230; -pub const SYS_llistxattr: ::c_long = 4000 + 231; -pub const SYS_flistxattr: ::c_long = 4000 + 232; -pub const SYS_removexattr: ::c_long = 4000 + 233; -pub const SYS_lremovexattr: ::c_long = 4000 + 234; -pub const SYS_fremovexattr: ::c_long = 4000 + 235; -pub const SYS_tkill: ::c_long = 4000 + 236; -pub const SYS_sendfile64: ::c_long = 4000 + 237; -pub const SYS_futex: ::c_long = 4000 + 238; -pub const SYS_sched_setaffinity: ::c_long = 4000 + 239; -pub const SYS_sched_getaffinity: ::c_long = 4000 + 240; -pub const SYS_io_setup: ::c_long = 4000 + 241; -pub const SYS_io_destroy: ::c_long = 4000 + 242; -pub const SYS_io_getevents: ::c_long = 4000 + 243; -pub const SYS_io_submit: ::c_long = 4000 + 244; -pub const SYS_io_cancel: ::c_long = 4000 + 245; -pub const SYS_exit_group: ::c_long = 4000 + 246; -pub const SYS_lookup_dcookie: ::c_long = 4000 + 247; -pub const SYS_epoll_create: ::c_long = 4000 + 248; -pub const SYS_epoll_ctl: ::c_long = 4000 + 249; -pub const SYS_epoll_wait: ::c_long = 4000 + 250; -pub const SYS_remap_file_pages: ::c_long = 4000 + 251; -pub const SYS_set_tid_address: ::c_long = 4000 + 252; -pub const SYS_restart_syscall: ::c_long = 4000 + 253; -pub const SYS_statfs64: ::c_long = 4000 + 255; -pub const SYS_fstatfs64: ::c_long = 4000 + 256; -pub const SYS_timer_create: ::c_long = 4000 + 257; -pub const SYS_timer_settime: ::c_long = 4000 + 258; -pub const SYS_timer_gettime: ::c_long = 4000 + 259; -pub const SYS_timer_getoverrun: ::c_long = 4000 + 260; -pub const SYS_timer_delete: ::c_long = 4000 + 261; -pub const SYS_clock_settime: ::c_long = 4000 + 262; -pub const SYS_clock_gettime: ::c_long = 4000 + 263; -pub const SYS_clock_getres: ::c_long = 4000 + 264; -pub const SYS_clock_nanosleep: ::c_long = 4000 + 265; -pub const SYS_tgkill: ::c_long = 4000 + 266; -pub const SYS_utimes: ::c_long = 4000 + 267; -pub const SYS_mbind: ::c_long = 4000 + 268; -pub const SYS_get_mempolicy: ::c_long = 4000 + 269; -pub const SYS_set_mempolicy: ::c_long = 4000 + 270; -pub const SYS_mq_open: ::c_long = 4000 + 271; -pub const SYS_mq_unlink: ::c_long = 4000 + 272; -pub const SYS_mq_timedsend: ::c_long = 4000 + 273; -pub const SYS_mq_timedreceive: ::c_long = 4000 + 274; -pub const SYS_mq_notify: ::c_long = 4000 + 275; -pub const SYS_mq_getsetattr: ::c_long = 4000 + 276; -pub const SYS_vserver: ::c_long = 4000 + 277; -pub const SYS_waitid: ::c_long = 4000 + 278; -/* pub const SYS_sys_setaltroot: ::c_long = 4000 + 279; */ -pub const SYS_add_key: ::c_long = 4000 + 280; -pub const SYS_request_key: ::c_long = 4000 + 281; -pub const SYS_keyctl: ::c_long = 4000 + 282; -pub const SYS_set_thread_area: ::c_long = 4000 + 283; -pub const SYS_inotify_init: ::c_long = 4000 + 284; -pub const SYS_inotify_add_watch: ::c_long = 4000 + 285; -pub const SYS_inotify_rm_watch: ::c_long = 4000 + 286; -pub const SYS_migrate_pages: ::c_long = 4000 + 287; -pub const SYS_openat: ::c_long = 4000 + 288; -pub const SYS_mkdirat: ::c_long = 4000 + 289; -pub const SYS_mknodat: ::c_long = 4000 + 290; -pub const SYS_fchownat: ::c_long = 4000 + 291; -pub const SYS_futimesat: ::c_long = 4000 + 292; -pub const SYS_unlinkat: ::c_long = 4000 + 294; -pub const SYS_renameat: ::c_long = 4000 + 295; -pub const SYS_linkat: ::c_long = 4000 + 296; -pub const SYS_symlinkat: ::c_long = 4000 + 297; -pub const SYS_readlinkat: ::c_long = 4000 + 298; -pub const SYS_fchmodat: ::c_long = 4000 + 299; -pub const SYS_faccessat: ::c_long = 4000 + 300; -pub const SYS_pselect6: ::c_long = 4000 + 301; -pub const SYS_ppoll: ::c_long = 4000 + 302; -pub const SYS_unshare: ::c_long = 4000 + 303; -pub const SYS_splice: ::c_long = 4000 + 304; -pub const SYS_sync_file_range: ::c_long = 4000 + 305; -pub const SYS_tee: ::c_long = 4000 + 306; -pub const SYS_vmsplice: ::c_long = 4000 + 307; -pub const SYS_move_pages: ::c_long = 4000 + 308; -pub const SYS_set_robust_list: ::c_long = 4000 + 309; -pub const SYS_get_robust_list: ::c_long = 4000 + 310; -pub const SYS_kexec_load: ::c_long = 4000 + 311; -pub const SYS_getcpu: ::c_long = 4000 + 312; -pub const SYS_epoll_pwait: ::c_long = 4000 + 313; -pub const SYS_ioprio_set: ::c_long = 4000 + 314; -pub const SYS_ioprio_get: ::c_long = 4000 + 315; -pub const SYS_utimensat: ::c_long = 4000 + 316; -pub const SYS_signalfd: ::c_long = 4000 + 317; -pub const SYS_timerfd: ::c_long = 4000 + 318; -pub const SYS_eventfd: ::c_long = 4000 + 319; -pub const SYS_fallocate: ::c_long = 4000 + 320; -pub const SYS_timerfd_create: ::c_long = 4000 + 321; -pub const SYS_timerfd_gettime: ::c_long = 4000 + 322; -pub const SYS_timerfd_settime: ::c_long = 4000 + 323; -pub const SYS_signalfd4: ::c_long = 4000 + 324; -pub const SYS_eventfd2: ::c_long = 4000 + 325; -pub const SYS_epoll_create1: ::c_long = 4000 + 326; -pub const SYS_dup3: ::c_long = 4000 + 327; -pub const SYS_pipe2: ::c_long = 4000 + 328; -pub const SYS_inotify_init1: ::c_long = 4000 + 329; -pub const SYS_preadv: ::c_long = 4000 + 330; -pub const SYS_pwritev: ::c_long = 4000 + 331; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 4000 + 332; -pub const SYS_perf_event_open: ::c_long = 4000 + 333; -pub const SYS_accept4: ::c_long = 4000 + 334; -pub const SYS_recvmmsg: ::c_long = 4000 + 335; -pub const SYS_fanotify_init: ::c_long = 4000 + 336; -pub const SYS_fanotify_mark: ::c_long = 4000 + 337; -pub const SYS_prlimit64: ::c_long = 4000 + 338; -pub const SYS_name_to_handle_at: ::c_long = 4000 + 339; -pub const SYS_open_by_handle_at: ::c_long = 4000 + 340; -pub const SYS_clock_adjtime: ::c_long = 4000 + 341; -pub const SYS_syncfs: ::c_long = 4000 + 342; -pub const SYS_sendmmsg: ::c_long = 4000 + 343; -pub const SYS_setns: ::c_long = 4000 + 344; -pub const SYS_process_vm_readv: ::c_long = 4000 + 345; -pub const SYS_process_vm_writev: ::c_long = 4000 + 346; -pub const SYS_kcmp: ::c_long = 4000 + 347; -pub const SYS_finit_module: ::c_long = 4000 + 348; -pub const SYS_sched_setattr: ::c_long = 4000 + 349; -pub const SYS_sched_getattr: ::c_long = 4000 + 350; -pub const SYS_renameat2: ::c_long = 4000 + 351; -pub const SYS_seccomp: ::c_long = 4000 + 352; -pub const SYS_getrandom: ::c_long = 4000 + 353; -pub const SYS_memfd_create: ::c_long = 4000 + 354; -pub const SYS_bpf: ::c_long = 4000 + 355; -pub const SYS_execveat: ::c_long = 4000 + 356; -pub const SYS_userfaultfd: ::c_long = 4000 + 357; -pub const SYS_membarrier: ::c_long = 4000 + 358; -pub const SYS_mlock2: ::c_long = 4000 + 359; -pub const SYS_copy_file_range: ::c_long = 4000 + 360; -pub const SYS_preadv2: ::c_long = 4000 + 361; -pub const SYS_pwritev2: ::c_long = 4000 + 362; - -#[doc(hidden)] -pub const AF_MAX: ::c_int = 42; -#[doc(hidden)] -pub const PF_MAX: ::c_int = AF_MAX; diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/b32/mod.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/b32/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/b32/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/b32/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -pub type c_long = i32; -pub type c_ulong = u32; -pub type nlink_t = u32; -pub type blksize_t = ::c_long; -pub type __u64 = ::c_ulonglong; - -s! { - pub struct pthread_attr_t { - __size: [u32; 9] - } - - pub struct sigset_t { - __val: [::c_ulong; 32], - } - - pub struct msghdr { - pub msg_name: *mut ::c_void, - pub msg_namelen: ::socklen_t, - pub msg_iov: *mut ::iovec, - pub msg_iovlen: ::c_int, - pub msg_control: *mut ::c_void, - pub msg_controllen: ::socklen_t, - pub msg_flags: ::c_int, - } - - pub struct cmsghdr { - pub cmsg_len: ::socklen_t, - pub cmsg_level: ::c_int, - pub cmsg_type: ::c_int, - } - - pub struct sem_t { - __val: [::c_int; 4], - } -} - -pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32; -pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; - -pub const TIOCINQ: ::c_int = ::FIONREAD; - -extern { - pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; -} - -cfg_if! { - if #[cfg(any(target_arch = "x86"))] { - mod x86; - pub use self::x86::*; - } else if #[cfg(any(target_arch = "mips"))] { - mod mips; - pub use self::mips::*; - } else if #[cfg(any(target_arch = "arm"))] { - mod arm; - pub use self::arm::*; - } else if #[cfg(any(target_arch = "powerpc"))] { - mod powerpc; - pub use self::powerpc::*; - } else { - // Unknown target_arch - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/b32/powerpc.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/b32/powerpc.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/b32/powerpc.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/b32/powerpc.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,869 +0,0 @@ -pub type c_char = u8; -pub type wchar_t = i32; - -s! { - pub struct stat { - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __st_rdev_padding: ::c_short, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - __unused: [::c_long; 2], - } - - pub struct stat64 { - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __st_rdev_padding: ::c_short, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - __unused: [::c_long; 2], - } - - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_flags: ::c_int, - pub ss_size: ::size_t - } - - pub struct ipc_perm { - pub __ipc_perm_key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::mode_t, - pub __seq: ::c_int, - __pad1: ::c_int, - __pad2: ::c_longlong, - __pad3: ::c_longlong - } - - pub struct shmid_ds { - pub shm_perm: ::ipc_perm, - __unused1: ::c_int, - pub shm_atime: ::time_t, - __unused2: ::c_int, - pub shm_dtime: ::time_t, - __unused3: ::c_int, - pub shm_ctime: ::time_t, - __unused4: ::c_int, - pub shm_segsz: ::size_t, - pub shm_cpid: ::pid_t, - pub shm_lpid: ::pid_t, - pub shm_nattch: ::c_ulong, - __pad1: ::c_ulong, - __pad2: ::c_ulong, - } - - pub struct msqid_ds { - pub msg_perm: ::ipc_perm, - __unused1: ::c_int, - pub msg_stime: ::time_t, - __unused2: ::c_int, - pub msg_rtime: ::time_t, - __unused3: ::c_int, - pub msg_ctime: ::time_t, - __msg_cbytes: ::c_ulong, - pub msg_qnum: ::msgqnum_t, - pub msg_qbytes: ::msglen_t, - pub msg_lspid: ::pid_t, - pub msg_lrpid: ::pid_t, - __pad1: ::c_ulong, - __pad2: ::c_ulong, - } - - pub struct statfs { - pub f_type: ::c_ulong, - pub f_bsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - pub f_namelen: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_flags: ::c_ulong, - pub f_spare: [::c_ulong; 4], - } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_errno: ::c_int, - pub si_code: ::c_int, - pub _pad: [::c_int; 29], - _align: [usize; 0], - } - - pub struct statfs64 { - pub f_type: ::c_ulong, - pub f_bsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - pub f_namelen: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_flags: ::c_ulong, - pub f_spare: [::c_ulong; 4], - } - - pub struct statvfs64 { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_favail: u64, - #[cfg(target_endian = "little")] - pub f_fsid: ::c_ulong, - __f_unused: ::c_int, - #[cfg(target_endian = "big")] - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_cc: [::cc_t; 19], - pub c_line: ::cc_t, - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } -} - -pub const SIGSTKSZ: ::size_t = 10240; -pub const MINSIGSTKSZ: ::size_t = 4096; - -pub const O_DIRECT: ::c_int = 0x20000; -pub const O_DIRECTORY: ::c_int = 0x4000; -pub const O_NOFOLLOW: ::c_int = 0x8000; -pub const O_ASYNC: ::c_int = 0x2000; -pub const O_LARGEFILE: ::c_int = 0x10000; - -pub const FIOCLEX: ::c_int = 0x20006601; -pub const FIONBIO: ::c_int = 0x8004667E; - -pub const RLIMIT_RSS: ::c_int = 5; -pub const RLIMIT_NOFILE: ::c_int = 7; -pub const RLIMIT_AS: ::c_int = 9; -pub const RLIMIT_NPROC: ::c_int = 6; -pub const RLIMIT_MEMLOCK: ::c_int = 8; -pub const RLIMIT_NLIMITS: ::c_int = 15; - -pub const MCL_CURRENT: ::c_int = 0x2000; -pub const MCL_FUTURE: ::c_int = 0x4000; -pub const CBAUD: ::tcflag_t = 0o0000377; -pub const TAB1: ::c_int = 0x00000400; -pub const TAB2: ::c_int = 0x00000800; -pub const TAB3: ::c_int = 0x00000C00; -pub const CR1: ::c_int = 0x00001000; -pub const CR2: ::c_int = 0x00002000; -pub const CR3: ::c_int = 0x00003000; -pub const FF1: ::c_int = 0x00004000; -pub const BS1: ::c_int = 0x00008000; -pub const VT1: ::c_int = 0x00010000; -pub const VWERASE: usize = 10; -pub const VREPRINT: usize = 11; -pub const VSUSP: usize = 12; -pub const VSTART: usize = 13; -pub const VSTOP: usize = 14; -pub const VDISCARD: usize = 16; -pub const VTIME: usize = 7; -pub const IXON: ::tcflag_t = 0x00000200; -pub const IXOFF: ::tcflag_t = 0x00000400; -pub const ONLCR: ::tcflag_t = 0x00000002; -pub const CSIZE: ::tcflag_t = 0x00000300; -pub const CS6: ::tcflag_t = 0x00000100; -pub const CS7: ::tcflag_t = 0x00000200; -pub const CS8: ::tcflag_t = 0x00000300; -pub const CSTOPB: ::tcflag_t = 0x00000400; -pub const CREAD: ::tcflag_t = 0x00000800; -pub const PARENB: ::tcflag_t = 0x00001000; -pub const PARODD: ::tcflag_t = 0x00002000; -pub const HUPCL: ::tcflag_t = 0x00004000; -pub const CLOCAL: ::tcflag_t = 0x00008000; -pub const ECHOKE: ::tcflag_t = 0x00000001; -pub const ECHOE: ::tcflag_t = 0x00000002; -pub const ECHOK: ::tcflag_t = 0x00000004; -pub const ECHONL: ::tcflag_t = 0x00000010; -pub const ECHOPRT: ::tcflag_t = 0x00000020; -pub const ECHOCTL: ::tcflag_t = 0x00000040; -pub const ISIG: ::tcflag_t = 0x00000080; -pub const ICANON: ::tcflag_t = 0x00000100; -pub const PENDIN: ::tcflag_t = 0x20000000; -pub const NOFLSH: ::tcflag_t = 0x80000000; -pub const CIBAUD: ::tcflag_t = 0o00077600000; -pub const CBAUDEX: ::tcflag_t = 0o000020; -pub const VSWTC: usize = 9; -pub const OLCUC: ::tcflag_t = 0o000004; -pub const NLDLY: ::tcflag_t = 0o001400; -pub const CRDLY: ::tcflag_t = 0o030000; -pub const TABDLY: ::tcflag_t = 0o006000; -pub const BSDLY: ::tcflag_t = 0o100000; -pub const FFDLY: ::tcflag_t = 0o040000; -pub const VTDLY: ::tcflag_t = 0o200000; -pub const XTABS: ::tcflag_t = 0o006000; -pub const B57600: ::speed_t = 0o000020; -pub const B115200: ::speed_t = 0o000021; -pub const B230400: ::speed_t = 0o000022; -pub const B460800: ::speed_t = 0o000023; -pub const B500000: ::speed_t = 0o000024; -pub const B576000: ::speed_t = 0o000025; -pub const B921600: ::speed_t = 0o000026; -pub const B1000000: ::speed_t = 0o000027; -pub const B1152000: ::speed_t = 0o000030; -pub const B1500000: ::speed_t = 0o000031; -pub const B2000000: ::speed_t = 0o000032; -pub const B2500000: ::speed_t = 0o000033; -pub const B3000000: ::speed_t = 0o000034; -pub const B3500000: ::speed_t = 0o000035; -pub const B4000000: ::speed_t = 0o000036; - -pub const O_APPEND: ::c_int = 1024; -pub const O_CREAT: ::c_int = 64; -pub const O_EXCL: ::c_int = 128; -pub const O_NOCTTY: ::c_int = 256; -pub const O_NONBLOCK: ::c_int = 2048; -pub const O_SYNC: ::c_int = 1052672; -pub const O_RSYNC: ::c_int = 1052672; -pub const O_DSYNC: ::c_int = 4096; - -pub const SOCK_NONBLOCK: ::c_int = 2048; - -pub const MAP_ANON: ::c_int = 0x0020; -pub const MAP_GROWSDOWN: ::c_int = 0x0100; -pub const MAP_DENYWRITE: ::c_int = 0x0800; -pub const MAP_EXECUTABLE: ::c_int = 0x01000; -pub const MAP_LOCKED: ::c_int = 0x00080; -pub const MAP_NORESERVE: ::c_int = 0x00040; -pub const MAP_POPULATE: ::c_int = 0x08000; -pub const MAP_NONBLOCK: ::c_int = 0x010000; -pub const MAP_STACK: ::c_int = 0x020000; - -pub const SOCK_STREAM: ::c_int = 1; -pub const SOCK_DGRAM: ::c_int = 2; -pub const SOCK_SEQPACKET: ::c_int = 5; - -pub const SOL_SOCKET: ::c_int = 1; - -pub const EDEADLK: ::c_int = 35; -pub const ENAMETOOLONG: ::c_int = 36; -pub const ENOLCK: ::c_int = 37; -pub const ENOSYS: ::c_int = 38; -pub const ENOTEMPTY: ::c_int = 39; -pub const ELOOP: ::c_int = 40; -pub const ENOMSG: ::c_int = 42; -pub const EIDRM: ::c_int = 43; -pub const ECHRNG: ::c_int = 44; -pub const EL2NSYNC: ::c_int = 45; -pub const EL3HLT: ::c_int = 46; -pub const EL3RST: ::c_int = 47; -pub const ELNRNG: ::c_int = 48; -pub const EUNATCH: ::c_int = 49; -pub const ENOCSI: ::c_int = 50; -pub const EL2HLT: ::c_int = 51; -pub const EBADE: ::c_int = 52; -pub const EBADR: ::c_int = 53; -pub const EXFULL: ::c_int = 54; -pub const ENOANO: ::c_int = 55; -pub const EBADRQC: ::c_int = 56; -pub const EBADSLT: ::c_int = 57; -pub const EDEADLOCK: ::c_int = 58; -pub const EMULTIHOP: ::c_int = 72; -pub const EBADMSG: ::c_int = 74; -pub const EOVERFLOW: ::c_int = 75; -pub const ENOTUNIQ: ::c_int = 76; -pub const EBADFD: ::c_int = 77; -pub const EREMCHG: ::c_int = 78; -pub const ELIBACC: ::c_int = 79; -pub const ELIBBAD: ::c_int = 80; -pub const ELIBSCN: ::c_int = 81; -pub const ELIBMAX: ::c_int = 82; -pub const ELIBEXEC: ::c_int = 83; -pub const EILSEQ: ::c_int = 84; -pub const ERESTART: ::c_int = 85; -pub const ESTRPIPE: ::c_int = 86; -pub const EUSERS: ::c_int = 87; -pub const ENOTSOCK: ::c_int = 88; -pub const EDESTADDRREQ: ::c_int = 89; -pub const EMSGSIZE: ::c_int = 90; -pub const EPROTOTYPE: ::c_int = 91; -pub const ENOPROTOOPT: ::c_int = 92; -pub const EPROTONOSUPPORT: ::c_int = 93; -pub const ESOCKTNOSUPPORT: ::c_int = 94; -pub const EOPNOTSUPP: ::c_int = 95; -pub const ENOTSUP: ::c_int = EOPNOTSUPP; -pub const EPFNOSUPPORT: ::c_int = 96; -pub const EAFNOSUPPORT: ::c_int = 97; -pub const EADDRINUSE: ::c_int = 98; -pub const EADDRNOTAVAIL: ::c_int = 99; -pub const ENETDOWN: ::c_int = 100; -pub const ENETUNREACH: ::c_int = 101; -pub const ENETRESET: ::c_int = 102; -pub const ECONNABORTED: ::c_int = 103; -pub const ECONNRESET: ::c_int = 104; -pub const ENOBUFS: ::c_int = 105; -pub const EISCONN: ::c_int = 106; -pub const ENOTCONN: ::c_int = 107; -pub const ESHUTDOWN: ::c_int = 108; -pub const ETOOMANYREFS: ::c_int = 109; -pub const ETIMEDOUT: ::c_int = 110; -pub const ECONNREFUSED: ::c_int = 111; -pub const EHOSTDOWN: ::c_int = 112; -pub const EHOSTUNREACH: ::c_int = 113; -pub const EALREADY: ::c_int = 114; -pub const EINPROGRESS: ::c_int = 115; -pub const ESTALE: ::c_int = 116; -pub const EUCLEAN: ::c_int = 117; -pub const ENOTNAM: ::c_int = 118; -pub const ENAVAIL: ::c_int = 119; -pub const EISNAM: ::c_int = 120; -pub const EREMOTEIO: ::c_int = 121; -pub const EDQUOT: ::c_int = 122; -pub const ENOMEDIUM: ::c_int = 123; -pub const EMEDIUMTYPE: ::c_int = 124; -pub const ECANCELED: ::c_int = 125; -pub const ENOKEY: ::c_int = 126; -pub const EKEYEXPIRED: ::c_int = 127; -pub const EKEYREVOKED: ::c_int = 128; -pub const EKEYREJECTED: ::c_int = 129; -pub const EOWNERDEAD: ::c_int = 130; -pub const ENOTRECOVERABLE: ::c_int = 131; -pub const ERFKILL: ::c_int = 132; -pub const EHWPOISON: ::c_int = 133; - -pub const SO_REUSEADDR: ::c_int = 2; -pub const SO_TYPE: ::c_int = 3; -pub const SO_ERROR: ::c_int = 4; -pub const SO_DONTROUTE: ::c_int = 5; -pub const SO_BROADCAST: ::c_int = 6; -pub const SO_SNDBUF: ::c_int = 7; -pub const SO_RCVBUF: ::c_int = 8; -pub const SO_KEEPALIVE: ::c_int = 9; -pub const SO_OOBINLINE: ::c_int = 10; -pub const SO_NO_CHECK: ::c_int = 11; -pub const SO_PRIORITY: ::c_int = 12; -pub const SO_LINGER: ::c_int = 13; -pub const SO_BSDCOMPAT: ::c_int = 14; -pub const SO_REUSEPORT: ::c_int = 15; -pub const SO_RCVLOWAT: ::c_int = 16; -pub const SO_SNDLOWAT: ::c_int = 17; -pub const SO_RCVTIMEO: ::c_int = 18; -pub const SO_SNDTIMEO: ::c_int = 19; -pub const SO_PASSCRED: ::c_int = 20; -pub const SO_PEERCRED: ::c_int = 21; -pub const SO_ACCEPTCONN: ::c_int = 30; -pub const SO_SNDBUFFORCE: ::c_int = 32; -pub const SO_RCVBUFFORCE: ::c_int = 33; -pub const SO_PROTOCOL: ::c_int = 38; -pub const SO_DOMAIN: ::c_int = 39; - -pub const SA_ONSTACK: ::c_int = 0x08000000; -pub const SA_SIGINFO: ::c_int = 0x00000004; -pub const SA_NOCLDWAIT: ::c_int = 0x00000002; - -pub const SIGCHLD: ::c_int = 17; -pub const SIGBUS: ::c_int = 7; -pub const SIGTTIN: ::c_int = 21; -pub const SIGTTOU: ::c_int = 22; -pub const SIGXCPU: ::c_int = 24; -pub const SIGXFSZ: ::c_int = 25; -pub const SIGVTALRM: ::c_int = 26; -pub const SIGPROF: ::c_int = 27; -pub const SIGWINCH: ::c_int = 28; -pub const SIGUSR1: ::c_int = 10; -pub const SIGUSR2: ::c_int = 12; -pub const SIGCONT: ::c_int = 18; -pub const SIGSTOP: ::c_int = 19; -pub const SIGTSTP: ::c_int = 20; -pub const SIGURG: ::c_int = 23; -pub const SIGIO: ::c_int = 29; -pub const SIGSYS: ::c_int = 31; -pub const SIGSTKFLT: ::c_int = 16; -pub const SIGPOLL: ::c_int = 29; -pub const SIGPWR: ::c_int = 30; -pub const SIG_SETMASK: ::c_int = 2; -pub const SIG_BLOCK: ::c_int = 0x000000; -pub const SIG_UNBLOCK: ::c_int = 0x01; - -pub const EXTPROC: ::tcflag_t = 0x10000000; - -pub const MAP_HUGETLB: ::c_int = 0x040000; - -pub const F_GETLK: ::c_int = 12; -pub const F_GETOWN: ::c_int = 9; -pub const F_SETLK: ::c_int = 13; -pub const F_SETLKW: ::c_int = 14; -pub const F_SETOWN: ::c_int = 8; - -pub const VEOF: usize = 4; -pub const VEOL: usize = 6; -pub const VEOL2: usize = 8; -pub const VMIN: usize = 5; -pub const IEXTEN: ::tcflag_t = 0x00000400; -pub const TOSTOP: ::tcflag_t = 0x00400000; -pub const FLUSHO: ::tcflag_t = 0x00800000; - -pub const TCGETS: ::c_int = 0x402C7413; -pub const TCSETS: ::c_int = 0x802C7414; -pub const TCSETSW: ::c_int = 0x802C7415; -pub const TCSETSF: ::c_int = 0x802C7416; -pub const TCGETA: ::c_int = 0x40147417; -pub const TCSETA: ::c_int = 0x80147418; -pub const TCSETAW: ::c_int = 0x80147419; -pub const TCSETAF: ::c_int = 0x8014741C; -pub const TCSBRK: ::c_int = 0x2000741D; -pub const TCXONC: ::c_int = 0x2000741E; -pub const TCFLSH: ::c_int = 0x2000741F; -pub const TIOCGSOFTCAR: ::c_int = 0x5419; -pub const TIOCSSOFTCAR: ::c_int = 0x541A; -pub const TIOCLINUX: ::c_int = 0x541C; -pub const TIOCGSERIAL: ::c_int = 0x541E; -pub const TIOCEXCL: ::c_int = 0x540C; -pub const TIOCNXCL: ::c_int = 0x540D; -pub const TIOCSCTTY: ::c_int = 0x540E; -pub const TIOCGPGRP: ::c_int = 0x40047477; -pub const TIOCSPGRP: ::c_int = 0x80047476; -pub const TIOCOUTQ: ::c_int = 0x40047473; -pub const TIOCSTI: ::c_int = 0x5412; -pub const TIOCGWINSZ: ::c_int = 0x40087468; -pub const TIOCSWINSZ: ::c_int = 0x80087467; -pub const TIOCMGET: ::c_int = 0x5415; -pub const TIOCMBIS: ::c_int = 0x5416; -pub const TIOCMBIC: ::c_int = 0x5417; -pub const TIOCMSET: ::c_int = 0x5418; -pub const FIONREAD: ::c_int = 0x4004667F; -pub const TIOCCONS: ::c_int = 0x541D; - -pub const TIOCGRS485: ::c_int = 0x542e; -pub const TIOCSRS485: ::c_int = 0x542f; - -pub const POLLWRNORM: ::c_short = 0x100; -pub const POLLWRBAND: ::c_short = 0x200; - -pub const TIOCM_LE: ::c_int = 0x001; -pub const TIOCM_DTR: ::c_int = 0x002; -pub const TIOCM_RTS: ::c_int = 0x004; -pub const TIOCM_ST: ::c_int = 0x008; -pub const TIOCM_SR: ::c_int = 0x010; -pub const TIOCM_CTS: ::c_int = 0x020; -pub const TIOCM_CAR: ::c_int = 0x040; -pub const TIOCM_RNG: ::c_int = 0x080; -pub const TIOCM_DSR: ::c_int = 0x100; -pub const TIOCM_CD: ::c_int = TIOCM_CAR; -pub const TIOCM_RI: ::c_int = TIOCM_RNG; - -// Syscall table -pub const SYS_restart_syscall: ::c_long = 0; -pub const SYS_exit: ::c_long = 1; -pub const SYS_fork: ::c_long = 2; -pub const SYS_read: ::c_long = 3; -pub const SYS_write: ::c_long = 4; -pub const SYS_open: ::c_long = 5; -pub const SYS_close: ::c_long = 6; -pub const SYS_waitpid: ::c_long = 7; -pub const SYS_creat: ::c_long = 8; -pub const SYS_link: ::c_long = 9; -pub const SYS_unlink: ::c_long = 10; -pub const SYS_execve: ::c_long = 11; -pub const SYS_chdir: ::c_long = 12; -pub const SYS_time: ::c_long = 13; -pub const SYS_mknod: ::c_long = 14; -pub const SYS_chmod: ::c_long = 15; -pub const SYS_lchown: ::c_long = 16; -pub const SYS_break: ::c_long = 17; -pub const SYS_oldstat: ::c_long = 18; -pub const SYS_lseek: ::c_long = 19; -pub const SYS_getpid: ::c_long = 20; -pub const SYS_mount: ::c_long = 21; -pub const SYS_umount: ::c_long = 22; -pub const SYS_setuid: ::c_long = 23; -pub const SYS_getuid: ::c_long = 24; -pub const SYS_stime: ::c_long = 25; -pub const SYS_ptrace: ::c_long = 26; -pub const SYS_alarm: ::c_long = 27; -pub const SYS_oldfstat: ::c_long = 28; -pub const SYS_pause: ::c_long = 29; -pub const SYS_utime: ::c_long = 30; -pub const SYS_stty: ::c_long = 31; -pub const SYS_gtty: ::c_long = 32; -pub const SYS_access: ::c_long = 33; -pub const SYS_nice: ::c_long = 34; -pub const SYS_ftime: ::c_long = 35; -pub const SYS_sync: ::c_long = 36; -pub const SYS_kill: ::c_long = 37; -pub const SYS_rename: ::c_long = 38; -pub const SYS_mkdir: ::c_long = 39; -pub const SYS_rmdir: ::c_long = 40; -pub const SYS_dup: ::c_long = 41; -pub const SYS_pipe: ::c_long = 42; -pub const SYS_times: ::c_long = 43; -pub const SYS_prof: ::c_long = 44; -pub const SYS_brk: ::c_long = 45; -pub const SYS_setgid: ::c_long = 46; -pub const SYS_getgid: ::c_long = 47; -pub const SYS_signal: ::c_long = 48; -pub const SYS_geteuid: ::c_long = 49; -pub const SYS_getegid: ::c_long = 50; -pub const SYS_acct: ::c_long = 51; -pub const SYS_umount2: ::c_long = 52; -pub const SYS_lock: ::c_long = 53; -pub const SYS_ioctl: ::c_long = 54; -pub const SYS_fcntl: ::c_long = 55; -pub const SYS_mpx: ::c_long = 56; -pub const SYS_setpgid: ::c_long = 57; -pub const SYS_ulimit: ::c_long = 58; -pub const SYS_oldolduname: ::c_long = 59; -pub const SYS_umask: ::c_long = 60; -pub const SYS_chroot: ::c_long = 61; -pub const SYS_ustat: ::c_long = 62; -pub const SYS_dup2: ::c_long = 63; -pub const SYS_getppid: ::c_long = 64; -pub const SYS_getpgrp: ::c_long = 65; -pub const SYS_setsid: ::c_long = 66; -pub const SYS_sigaction: ::c_long = 67; -pub const SYS_sgetmask: ::c_long = 68; -pub const SYS_ssetmask: ::c_long = 69; -pub const SYS_setreuid: ::c_long = 70; -pub const SYS_setregid: ::c_long = 71; -pub const SYS_sigsuspend: ::c_long = 72; -pub const SYS_sigpending: ::c_long = 73; -pub const SYS_sethostname: ::c_long = 74; -pub const SYS_setrlimit: ::c_long = 75; -pub const SYS_getrlimit: ::c_long = 76; -pub const SYS_getrusage: ::c_long = 77; -pub const SYS_gettimeofday: ::c_long = 78; -pub const SYS_settimeofday: ::c_long = 79; -pub const SYS_getgroups: ::c_long = 80; -pub const SYS_setgroups: ::c_long = 81; -pub const SYS_select: ::c_long = 82; -pub const SYS_symlink: ::c_long = 83; -pub const SYS_oldlstat: ::c_long = 84; -pub const SYS_readlink: ::c_long = 85; -pub const SYS_uselib: ::c_long = 86; -pub const SYS_swapon: ::c_long = 87; -pub const SYS_reboot: ::c_long = 88; -pub const SYS_readdir: ::c_long = 89; -pub const SYS_mmap: ::c_long = 90; -pub const SYS_munmap: ::c_long = 91; -pub const SYS_truncate: ::c_long = 92; -pub const SYS_ftruncate: ::c_long = 93; -pub const SYS_fchmod: ::c_long = 94; -pub const SYS_fchown: ::c_long = 95; -pub const SYS_getpriority: ::c_long = 96; -pub const SYS_setpriority: ::c_long = 97; -pub const SYS_profil: ::c_long = 98; -pub const SYS_statfs: ::c_long = 99; -pub const SYS_fstatfs: ::c_long = 100; -pub const SYS_ioperm: ::c_long = 101; -pub const SYS_socketcall: ::c_long = 102; -pub const SYS_syslog: ::c_long = 103; -pub const SYS_setitimer: ::c_long = 104; -pub const SYS_getitimer: ::c_long = 105; -pub const SYS_stat: ::c_long = 106; -pub const SYS_lstat: ::c_long = 107; -pub const SYS_fstat: ::c_long = 108; -pub const SYS_olduname: ::c_long = 109; -pub const SYS_iopl: ::c_long = 110; -pub const SYS_vhangup: ::c_long = 111; -pub const SYS_idle: ::c_long = 112; -pub const SYS_vm86: ::c_long = 113; -pub const SYS_wait4: ::c_long = 114; -pub const SYS_swapoff: ::c_long = 115; -pub const SYS_sysinfo: ::c_long = 116; -pub const SYS_ipc: ::c_long = 117; -pub const SYS_fsync: ::c_long = 118; -pub const SYS_sigreturn: ::c_long = 119; -pub const SYS_clone: ::c_long = 120; -pub const SYS_setdomainname: ::c_long = 121; -pub const SYS_uname: ::c_long = 122; -pub const SYS_modify_ldt: ::c_long = 123; -pub const SYS_adjtimex: ::c_long = 124; -pub const SYS_mprotect: ::c_long = 125; -pub const SYS_sigprocmask: ::c_long = 126; -pub const SYS_create_module: ::c_long = 127; -pub const SYS_init_module: ::c_long = 128; -pub const SYS_delete_module: ::c_long = 129; -pub const SYS_get_kernel_syms: ::c_long = 130; -pub const SYS_quotactl: ::c_long = 131; -pub const SYS_getpgid: ::c_long = 132; -pub const SYS_fchdir: ::c_long = 133; -pub const SYS_bdflush: ::c_long = 134; -pub const SYS_sysfs: ::c_long = 135; -pub const SYS_personality: ::c_long = 136; -pub const SYS_afs_syscall: ::c_long = 137; -pub const SYS_setfsuid: ::c_long = 138; -pub const SYS_setfsgid: ::c_long = 139; -pub const SYS__llseek: ::c_long = 140; -pub const SYS_getdents: ::c_long = 141; -pub const SYS__newselect: ::c_long = 142; -pub const SYS_flock: ::c_long = 143; -pub const SYS_msync: ::c_long = 144; -pub const SYS_readv: ::c_long = 145; -pub const SYS_writev: ::c_long = 146; -pub const SYS_getsid: ::c_long = 147; -pub const SYS_fdatasync: ::c_long = 148; -pub const SYS__sysctl: ::c_long = 149; -pub const SYS_mlock: ::c_long = 150; -pub const SYS_munlock: ::c_long = 151; -pub const SYS_mlockall: ::c_long = 152; -pub const SYS_munlockall: ::c_long = 153; -pub const SYS_sched_setparam: ::c_long = 154; -pub const SYS_sched_getparam: ::c_long = 155; -pub const SYS_sched_setscheduler: ::c_long = 156; -pub const SYS_sched_getscheduler: ::c_long = 157; -pub const SYS_sched_yield: ::c_long = 158; -pub const SYS_sched_get_priority_max: ::c_long = 159; -pub const SYS_sched_get_priority_min: ::c_long = 160; -pub const SYS_sched_rr_get_interval: ::c_long = 161; -pub const SYS_nanosleep: ::c_long = 162; -pub const SYS_mremap: ::c_long = 163; -pub const SYS_setresuid: ::c_long = 164; -pub const SYS_getresuid: ::c_long = 165; -pub const SYS_query_module: ::c_long = 166; -pub const SYS_poll: ::c_long = 167; -pub const SYS_nfsservctl: ::c_long = 168; -pub const SYS_setresgid: ::c_long = 169; -pub const SYS_getresgid: ::c_long = 170; -pub const SYS_prctl: ::c_long = 171; -pub const SYS_rt_sigreturn: ::c_long = 172; -pub const SYS_rt_sigaction: ::c_long = 173; -pub const SYS_rt_sigprocmask: ::c_long = 174; -pub const SYS_rt_sigpending: ::c_long = 175; -pub const SYS_rt_sigtimedwait: ::c_long = 176; -pub const SYS_rt_sigqueueinfo: ::c_long = 177; -pub const SYS_rt_sigsuspend: ::c_long = 178; -pub const SYS_pread64: ::c_long = 179; -pub const SYS_pwrite64: ::c_long = 180; -pub const SYS_chown: ::c_long = 181; -pub const SYS_getcwd: ::c_long = 182; -pub const SYS_capget: ::c_long = 183; -pub const SYS_capset: ::c_long = 184; -pub const SYS_sigaltstack: ::c_long = 185; -pub const SYS_sendfile: ::c_long = 186; -pub const SYS_getpmsg: ::c_long = 187; -pub const SYS_putpmsg: ::c_long = 188; -pub const SYS_vfork: ::c_long = 189; -pub const SYS_ugetrlimit: ::c_long = 190; -pub const SYS_readahead: ::c_long = 191; -pub const SYS_mmap2: ::c_long = 192; -pub const SYS_truncate64: ::c_long = 193; -pub const SYS_ftruncate64: ::c_long = 194; -pub const SYS_stat64: ::c_long = 195; -pub const SYS_lstat64: ::c_long = 196; -pub const SYS_fstat64: ::c_long = 197; -pub const SYS_pciconfig_read: ::c_long = 198; -pub const SYS_pciconfig_write: ::c_long = 199; -pub const SYS_pciconfig_iobase: ::c_long = 200; -pub const SYS_multiplexer: ::c_long = 201; -pub const SYS_getdents64: ::c_long = 202; -pub const SYS_pivot_root: ::c_long = 203; -pub const SYS_fcntl64: ::c_long = 204; -pub const SYS_madvise: ::c_long = 205; -pub const SYS_mincore: ::c_long = 206; -pub const SYS_gettid: ::c_long = 207; -pub const SYS_tkill: ::c_long = 208; -pub const SYS_setxattr: ::c_long = 209; -pub const SYS_lsetxattr: ::c_long = 210; -pub const SYS_fsetxattr: ::c_long = 211; -pub const SYS_getxattr: ::c_long = 212; -pub const SYS_lgetxattr: ::c_long = 213; -pub const SYS_fgetxattr: ::c_long = 214; -pub const SYS_listxattr: ::c_long = 215; -pub const SYS_llistxattr: ::c_long = 216; -pub const SYS_flistxattr: ::c_long = 217; -pub const SYS_removexattr: ::c_long = 218; -pub const SYS_lremovexattr: ::c_long = 219; -pub const SYS_fremovexattr: ::c_long = 220; -pub const SYS_futex: ::c_long = 221; -pub const SYS_sched_setaffinity: ::c_long = 222; -pub const SYS_sched_getaffinity: ::c_long = 223; -pub const SYS_tuxcall: ::c_long = 225; -pub const SYS_sendfile64: ::c_long = 226; -pub const SYS_io_setup: ::c_long = 227; -pub const SYS_io_destroy: ::c_long = 228; -pub const SYS_io_getevents: ::c_long = 229; -pub const SYS_io_submit: ::c_long = 230; -pub const SYS_io_cancel: ::c_long = 231; -pub const SYS_set_tid_address: ::c_long = 232; -pub const SYS_fadvise64: ::c_long = 233; -pub const SYS_exit_group: ::c_long = 234; -pub const SYS_lookup_dcookie: ::c_long = 235; -pub const SYS_epoll_create: ::c_long = 236; -pub const SYS_epoll_ctl: ::c_long = 237; -pub const SYS_epoll_wait: ::c_long = 238; -pub const SYS_remap_file_pages: ::c_long = 239; -pub const SYS_timer_create: ::c_long = 240; -pub const SYS_timer_settime: ::c_long = 241; -pub const SYS_timer_gettime: ::c_long = 242; -pub const SYS_timer_getoverrun: ::c_long = 243; -pub const SYS_timer_delete: ::c_long = 244; -pub const SYS_clock_settime: ::c_long = 245; -pub const SYS_clock_gettime: ::c_long = 246; -pub const SYS_clock_getres: ::c_long = 247; -pub const SYS_clock_nanosleep: ::c_long = 248; -pub const SYS_swapcontext: ::c_long = 249; -pub const SYS_tgkill: ::c_long = 250; -pub const SYS_utimes: ::c_long = 251; -pub const SYS_statfs64: ::c_long = 252; -pub const SYS_fstatfs64: ::c_long = 253; -pub const SYS_fadvise64_64: ::c_long = 254; -pub const SYS_rtas: ::c_long = 255; -pub const SYS_sys_debug_setcontext: ::c_long = 256; -pub const SYS_migrate_pages: ::c_long = 258; -pub const SYS_mbind: ::c_long = 259; -pub const SYS_get_mempolicy: ::c_long = 260; -pub const SYS_set_mempolicy: ::c_long = 261; -pub const SYS_mq_open: ::c_long = 262; -pub const SYS_mq_unlink: ::c_long = 263; -pub const SYS_mq_timedsend: ::c_long = 264; -pub const SYS_mq_timedreceive: ::c_long = 265; -pub const SYS_mq_notify: ::c_long = 266; -pub const SYS_mq_getsetattr: ::c_long = 267; -pub const SYS_kexec_load: ::c_long = 268; -pub const SYS_add_key: ::c_long = 269; -pub const SYS_request_key: ::c_long = 270; -pub const SYS_keyctl: ::c_long = 271; -pub const SYS_waitid: ::c_long = 272; -pub const SYS_ioprio_set: ::c_long = 273; -pub const SYS_ioprio_get: ::c_long = 274; -pub const SYS_inotify_init: ::c_long = 275; -pub const SYS_inotify_add_watch: ::c_long = 276; -pub const SYS_inotify_rm_watch: ::c_long = 277; -pub const SYS_spu_run: ::c_long = 278; -pub const SYS_spu_create: ::c_long = 279; -pub const SYS_pselect6: ::c_long = 280; -pub const SYS_ppoll: ::c_long = 281; -pub const SYS_unshare: ::c_long = 282; -pub const SYS_splice: ::c_long = 283; -pub const SYS_tee: ::c_long = 284; -pub const SYS_vmsplice: ::c_long = 285; -pub const SYS_openat: ::c_long = 286; -pub const SYS_mkdirat: ::c_long = 287; -pub const SYS_mknodat: ::c_long = 288; -pub const SYS_fchownat: ::c_long = 289; -pub const SYS_futimesat: ::c_long = 290; -pub const SYS_fstatat64: ::c_long = 291; -pub const SYS_unlinkat: ::c_long = 292; -pub const SYS_renameat: ::c_long = 293; -pub const SYS_linkat: ::c_long = 294; -pub const SYS_symlinkat: ::c_long = 295; -pub const SYS_readlinkat: ::c_long = 296; -pub const SYS_fchmodat: ::c_long = 297; -pub const SYS_faccessat: ::c_long = 298; -pub const SYS_get_robust_list: ::c_long = 299; -pub const SYS_set_robust_list: ::c_long = 300; -pub const SYS_move_pages: ::c_long = 301; -pub const SYS_getcpu: ::c_long = 302; -pub const SYS_epoll_pwait: ::c_long = 303; -pub const SYS_utimensat: ::c_long = 304; -pub const SYS_signalfd: ::c_long = 305; -pub const SYS_timerfd_create: ::c_long = 306; -pub const SYS_eventfd: ::c_long = 307; -pub const SYS_sync_file_range2: ::c_long = 308; -pub const SYS_fallocate: ::c_long = 309; -pub const SYS_subpage_prot: ::c_long = 310; -pub const SYS_timerfd_settime: ::c_long = 311; -pub const SYS_timerfd_gettime: ::c_long = 312; -pub const SYS_signalfd4: ::c_long = 313; -pub const SYS_eventfd2: ::c_long = 314; -pub const SYS_epoll_create1: ::c_long = 315; -pub const SYS_dup3: ::c_long = 316; -pub const SYS_pipe2: ::c_long = 317; -pub const SYS_inotify_init1: ::c_long = 318; -pub const SYS_perf_event_open: ::c_long = 319; -pub const SYS_preadv: ::c_long = 320; -pub const SYS_pwritev: ::c_long = 321; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 322; -pub const SYS_fanotify_init: ::c_long = 323; -pub const SYS_fanotify_mark: ::c_long = 324; -pub const SYS_prlimit64: ::c_long = 325; -pub const SYS_socket: ::c_long = 326; -pub const SYS_bind: ::c_long = 327; -pub const SYS_connect: ::c_long = 328; -pub const SYS_listen: ::c_long = 329; -pub const SYS_accept: ::c_long = 330; -pub const SYS_getsockname: ::c_long = 331; -pub const SYS_getpeername: ::c_long = 332; -pub const SYS_socketpair: ::c_long = 333; -pub const SYS_send: ::c_long = 334; -pub const SYS_sendto: ::c_long = 335; -pub const SYS_recv: ::c_long = 336; -pub const SYS_recvfrom: ::c_long = 337; -pub const SYS_shutdown: ::c_long = 338; -pub const SYS_setsockopt: ::c_long = 339; -pub const SYS_getsockopt: ::c_long = 340; -pub const SYS_sendmsg: ::c_long = 341; -pub const SYS_recvmsg: ::c_long = 342; -pub const SYS_recvmmsg: ::c_long = 343; -pub const SYS_accept4: ::c_long = 344; -pub const SYS_name_to_handle_at: ::c_long = 345; -pub const SYS_open_by_handle_at: ::c_long = 346; -pub const SYS_clock_adjtime: ::c_long = 347; -pub const SYS_syncfs: ::c_long = 348; -pub const SYS_sendmmsg: ::c_long = 349; -pub const SYS_setns: ::c_long = 350; -pub const SYS_process_vm_readv: ::c_long = 351; -pub const SYS_process_vm_writev: ::c_long = 352; -pub const SYS_finit_module: ::c_long = 353; -pub const SYS_kcmp: ::c_long = 354; -pub const SYS_sched_setattr: ::c_long = 355; -pub const SYS_sched_getattr: ::c_long = 356; -pub const SYS_renameat2: ::c_long = 357; -pub const SYS_seccomp: ::c_long = 358; -pub const SYS_getrandom: ::c_long = 359; -pub const SYS_memfd_create: ::c_long = 360; -pub const SYS_bpf: ::c_long = 361; -pub const SYS_execveat: ::c_long = 362; -pub const SYS_switch_endian: ::c_long = 363; -pub const SYS_userfaultfd: ::c_long = 364; -pub const SYS_membarrier: ::c_long = 365; -pub const SYS_mlock2: ::c_long = 378; -pub const SYS_copy_file_range: ::c_long = 379; -pub const SYS_preadv2: ::c_long = 380; -pub const SYS_pwritev2: ::c_long = 381; -pub const SYS_kexec_file_load: ::c_long = 382; -pub const SYS_statx: ::c_long = 383; -pub const SYS_pkey_alloc: ::c_long = 384; -pub const SYS_pkey_free: ::c_long = 385; -pub const SYS_pkey_mprotect: ::c_long = 386; - -#[doc(hidden)] -pub const AF_MAX: ::c_int = 43; -#[doc(hidden)] -pub const PF_MAX: ::c_int = AF_MAX; diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/b32/x86.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/b32/x86.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/b32/x86.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/b32/x86.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,951 +0,0 @@ -pub type c_char = i8; -pub type wchar_t = i32; - -s! { - pub struct stat { - pub st_dev: ::dev_t, - __st_dev_padding: ::c_int, - __st_ino_truncated: ::c_long, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __st_rdev_padding: ::c_int, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_ino: ::ino_t, - } - - pub struct stat64 { - pub st_dev: ::dev_t, - __st_dev_padding: ::c_int, - __st_ino_truncated: ::c_long, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __st_rdev_padding: ::c_int, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_ino: ::ino_t, - } - - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_flags: ::c_int, - pub ss_size: ::size_t - } - - pub struct ipc_perm { - pub __ipc_perm_key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::mode_t, - pub __seq: ::c_int, - __unused1: ::c_long, - __unused2: ::c_long - } - - pub struct shmid_ds { - pub shm_perm: ::ipc_perm, - pub shm_segsz: ::size_t, - pub shm_atime: ::time_t, - __unused1: ::c_int, - pub shm_dtime: ::time_t, - __unused2: ::c_int, - pub shm_ctime: ::time_t, - __unused3: ::c_int, - pub shm_cpid: ::pid_t, - pub shm_lpid: ::pid_t, - pub shm_nattch: ::c_ulong, - __pad1: ::c_ulong, - __pad2: ::c_ulong, - } - - pub struct msqid_ds { - pub msg_perm: ::ipc_perm, - pub msg_stime: ::time_t, - __unused1: ::c_int, - pub msg_rtime: ::time_t, - __unused2: ::c_int, - pub msg_ctime: ::time_t, - __unused3: ::c_int, - __msg_cbytes: ::c_ulong, - pub msg_qnum: ::msgqnum_t, - pub msg_qbytes: ::msglen_t, - pub msg_lspid: ::pid_t, - pub msg_lrpid: ::pid_t, - __pad1: ::c_ulong, - __pad2: ::c_ulong, - } - - pub struct statfs { - pub f_type: ::c_ulong, - pub f_bsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - pub f_namelen: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_flags: ::c_ulong, - pub f_spare: [::c_ulong; 4], - } - - pub struct mcontext_t { - __private: [u32; 22] - } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_errno: ::c_int, - pub si_code: ::c_int, - pub _pad: [::c_int; 29], - _align: [usize; 0], - } - - pub struct statfs64 { - pub f_type: ::c_ulong, - pub f_bsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - pub f_namelen: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_flags: ::c_ulong, - pub f_spare: [::c_ulong; 4], - } - - pub struct statvfs64 { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_favail: u64, - pub f_fsid: ::c_ulong, - __f_unused: ::c_int, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 19], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } -} - -s_no_extra_traits!{ - pub struct ucontext_t { - pub uc_flags: ::c_ulong, - pub uc_link: *mut ucontext_t, - pub uc_stack: ::stack_t, - pub uc_mcontext: mcontext_t, - pub uc_sigmask: ::sigset_t, - __private: [u8; 112], - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for ucontext_t { - fn eq(&self, other: &ucontext_t) -> bool { - self.uc_flags == other.uc_flags - && self.uc_link == other.uc_link - && self.uc_stack == other.uc_stack - && self.uc_mcontext == other.uc_mcontext - && self.uc_sigmask == other.uc_sigmask - && self - .__private - .iter() - .zip(other.__private.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for ucontext_t {} - - impl ::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ucontext_t") - .field("uc_flags", &self.uc_flags) - .field("uc_link", &self.uc_link) - .field("uc_stack", &self.uc_stack) - .field("uc_mcontext", &self.uc_mcontext) - .field("uc_sigmask", &self.uc_sigmask) - // Ignore __private field - .finish() - } - } - - impl ::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { - self.uc_flags.hash(state); - self.uc_link.hash(state); - self.uc_stack.hash(state); - self.uc_mcontext.hash(state); - self.uc_sigmask.hash(state); - self.__private.hash(state); - } - } - } -} - -pub const SIGSTKSZ: ::size_t = 8192; -pub const MINSIGSTKSZ: ::size_t = 2048; - -pub const O_DIRECT: ::c_int = 0x4000; -pub const O_DIRECTORY: ::c_int = 0x10000; -pub const O_NOFOLLOW: ::c_int = 0x20000; -pub const O_ASYNC: ::c_int = 0x2000; -pub const O_LARGEFILE: ::c_int = 0o0100000; - -pub const FIOCLEX: ::c_int = 0x5451; -pub const FIONBIO: ::c_int = 0x5421; - -pub const RLIMIT_RSS: ::c_int = 5; -pub const RLIMIT_NOFILE: ::c_int = 7; -pub const RLIMIT_AS: ::c_int = 9; -pub const RLIMIT_NPROC: ::c_int = 6; -pub const RLIMIT_MEMLOCK: ::c_int = 8; -pub const RLIMIT_NLIMITS: ::c_int = 16; - -pub const MCL_CURRENT: ::c_int = 0x0001; -pub const MCL_FUTURE: ::c_int = 0x0002; -pub const CBAUD: ::tcflag_t = 0o0010017; -pub const TAB1: ::c_int = 0x00000800; -pub const TAB2: ::c_int = 0x00001000; -pub const TAB3: ::c_int = 0x00001800; -pub const CR1: ::c_int = 0x00000200; -pub const CR2: ::c_int = 0x00000400; -pub const CR3: ::c_int = 0x00000600; -pub const FF1: ::c_int = 0x00008000; -pub const BS1: ::c_int = 0x00002000; -pub const VT1: ::c_int = 0x00004000; -pub const VWERASE: usize = 14; -pub const VREPRINT: usize = 12; -pub const VSUSP: usize = 10; -pub const VSTART: usize = 8; -pub const VSTOP: usize = 9; -pub const VDISCARD: usize = 13; -pub const VTIME: usize = 5; -pub const IXON: ::tcflag_t = 0x00000400; -pub const IXOFF: ::tcflag_t = 0x00001000; -pub const ONLCR: ::tcflag_t = 0x4; -pub const CSIZE: ::tcflag_t = 0x00000030; -pub const CS6: ::tcflag_t = 0x00000010; -pub const CS7: ::tcflag_t = 0x00000020; -pub const CS8: ::tcflag_t = 0x00000030; -pub const CSTOPB: ::tcflag_t = 0x00000040; -pub const CREAD: ::tcflag_t = 0x00000080; -pub const PARENB: ::tcflag_t = 0x00000100; -pub const PARODD: ::tcflag_t = 0x00000200; -pub const HUPCL: ::tcflag_t = 0x00000400; -pub const CLOCAL: ::tcflag_t = 0x00000800; -pub const ECHOKE: ::tcflag_t = 0x00000800; -pub const ECHOE: ::tcflag_t = 0x00000010; -pub const ECHOK: ::tcflag_t = 0x00000020; -pub const ECHONL: ::tcflag_t = 0x00000040; -pub const ECHOPRT: ::tcflag_t = 0x00000400; -pub const ECHOCTL: ::tcflag_t = 0x00000200; -pub const ISIG: ::tcflag_t = 0x00000001; -pub const ICANON: ::tcflag_t = 0x00000002; -pub const PENDIN: ::tcflag_t = 0x00004000; -pub const NOFLSH: ::tcflag_t = 0x00000080; -pub const CIBAUD: ::tcflag_t = 0o02003600000; -pub const CBAUDEX: ::tcflag_t = 0o010000; -pub const VSWTC: usize = 7; -pub const OLCUC: ::tcflag_t = 0o000002; -pub const NLDLY: ::tcflag_t = 0o000400; -pub const CRDLY: ::tcflag_t = 0o003000; -pub const TABDLY: ::tcflag_t = 0o014000; -pub const BSDLY: ::tcflag_t = 0o020000; -pub const FFDLY: ::tcflag_t = 0o100000; -pub const VTDLY: ::tcflag_t = 0o040000; -pub const XTABS: ::tcflag_t = 0o014000; -pub const B57600: ::speed_t = 0o010001; -pub const B115200: ::speed_t = 0o010002; -pub const B230400: ::speed_t = 0o010003; -pub const B460800: ::speed_t = 0o010004; -pub const B500000: ::speed_t = 0o010005; -pub const B576000: ::speed_t = 0o010006; -pub const B921600: ::speed_t = 0o010007; -pub const B1000000: ::speed_t = 0o010010; -pub const B1152000: ::speed_t = 0o010011; -pub const B1500000: ::speed_t = 0o010012; -pub const B2000000: ::speed_t = 0o010013; -pub const B2500000: ::speed_t = 0o010014; -pub const B3000000: ::speed_t = 0o010015; -pub const B3500000: ::speed_t = 0o010016; -pub const B4000000: ::speed_t = 0o010017; - -pub const O_APPEND: ::c_int = 1024; -pub const O_CREAT: ::c_int = 64; -pub const O_EXCL: ::c_int = 128; -pub const O_NOCTTY: ::c_int = 256; -pub const O_NONBLOCK: ::c_int = 2048; -pub const O_SYNC: ::c_int = 1052672; -pub const O_RSYNC: ::c_int = 1052672; -pub const O_DSYNC: ::c_int = 4096; - -pub const SOCK_NONBLOCK: ::c_int = 2048; - -pub const MAP_ANON: ::c_int = 0x0020; -pub const MAP_GROWSDOWN: ::c_int = 0x0100; -pub const MAP_DENYWRITE: ::c_int = 0x0800; -pub const MAP_EXECUTABLE: ::c_int = 0x01000; -pub const MAP_LOCKED: ::c_int = 0x02000; -pub const MAP_NORESERVE: ::c_int = 0x04000; -pub const MAP_POPULATE: ::c_int = 0x08000; -pub const MAP_NONBLOCK: ::c_int = 0x010000; -pub const MAP_STACK: ::c_int = 0x020000; - -pub const SOCK_STREAM: ::c_int = 1; -pub const SOCK_DGRAM: ::c_int = 2; -pub const SOCK_SEQPACKET: ::c_int = 5; - -pub const SOL_SOCKET: ::c_int = 1; - -pub const EDEADLK: ::c_int = 35; -pub const ENAMETOOLONG: ::c_int = 36; -pub const ENOLCK: ::c_int = 37; -pub const ENOSYS: ::c_int = 38; -pub const ENOTEMPTY: ::c_int = 39; -pub const ELOOP: ::c_int = 40; -pub const ENOMSG: ::c_int = 42; -pub const EIDRM: ::c_int = 43; -pub const ECHRNG: ::c_int = 44; -pub const EL2NSYNC: ::c_int = 45; -pub const EL3HLT: ::c_int = 46; -pub const EL3RST: ::c_int = 47; -pub const ELNRNG: ::c_int = 48; -pub const EUNATCH: ::c_int = 49; -pub const ENOCSI: ::c_int = 50; -pub const EL2HLT: ::c_int = 51; -pub const EBADE: ::c_int = 52; -pub const EBADR: ::c_int = 53; -pub const EXFULL: ::c_int = 54; -pub const ENOANO: ::c_int = 55; -pub const EBADRQC: ::c_int = 56; -pub const EBADSLT: ::c_int = 57; -pub const EDEADLOCK: ::c_int = EDEADLK; -pub const EMULTIHOP: ::c_int = 72; -pub const EBADMSG: ::c_int = 74; -pub const EOVERFLOW: ::c_int = 75; -pub const ENOTUNIQ: ::c_int = 76; -pub const EBADFD: ::c_int = 77; -pub const EREMCHG: ::c_int = 78; -pub const ELIBACC: ::c_int = 79; -pub const ELIBBAD: ::c_int = 80; -pub const ELIBSCN: ::c_int = 81; -pub const ELIBMAX: ::c_int = 82; -pub const ELIBEXEC: ::c_int = 83; -pub const EILSEQ: ::c_int = 84; -pub const ERESTART: ::c_int = 85; -pub const ESTRPIPE: ::c_int = 86; -pub const EUSERS: ::c_int = 87; -pub const ENOTSOCK: ::c_int = 88; -pub const EDESTADDRREQ: ::c_int = 89; -pub const EMSGSIZE: ::c_int = 90; -pub const EPROTOTYPE: ::c_int = 91; -pub const ENOPROTOOPT: ::c_int = 92; -pub const EPROTONOSUPPORT: ::c_int = 93; -pub const ESOCKTNOSUPPORT: ::c_int = 94; -pub const EOPNOTSUPP: ::c_int = 95; -pub const ENOTSUP: ::c_int = EOPNOTSUPP; -pub const EPFNOSUPPORT: ::c_int = 96; -pub const EAFNOSUPPORT: ::c_int = 97; -pub const EADDRINUSE: ::c_int = 98; -pub const EADDRNOTAVAIL: ::c_int = 99; -pub const ENETDOWN: ::c_int = 100; -pub const ENETUNREACH: ::c_int = 101; -pub const ENETRESET: ::c_int = 102; -pub const ECONNABORTED: ::c_int = 103; -pub const ECONNRESET: ::c_int = 104; -pub const ENOBUFS: ::c_int = 105; -pub const EISCONN: ::c_int = 106; -pub const ENOTCONN: ::c_int = 107; -pub const ESHUTDOWN: ::c_int = 108; -pub const ETOOMANYREFS: ::c_int = 109; -pub const ETIMEDOUT: ::c_int = 110; -pub const ECONNREFUSED: ::c_int = 111; -pub const EHOSTDOWN: ::c_int = 112; -pub const EHOSTUNREACH: ::c_int = 113; -pub const EALREADY: ::c_int = 114; -pub const EINPROGRESS: ::c_int = 115; -pub const ESTALE: ::c_int = 116; -pub const EUCLEAN: ::c_int = 117; -pub const ENOTNAM: ::c_int = 118; -pub const ENAVAIL: ::c_int = 119; -pub const EISNAM: ::c_int = 120; -pub const EREMOTEIO: ::c_int = 121; -pub const EDQUOT: ::c_int = 122; -pub const ENOMEDIUM: ::c_int = 123; -pub const EMEDIUMTYPE: ::c_int = 124; -pub const ECANCELED: ::c_int = 125; -pub const ENOKEY: ::c_int = 126; -pub const EKEYEXPIRED: ::c_int = 127; -pub const EKEYREVOKED: ::c_int = 128; -pub const EKEYREJECTED: ::c_int = 129; -pub const EOWNERDEAD: ::c_int = 130; -pub const ENOTRECOVERABLE: ::c_int = 131; -pub const ERFKILL: ::c_int = 132; -pub const EHWPOISON: ::c_int = 133; - -pub const SO_REUSEADDR: ::c_int = 2; -pub const SO_TYPE: ::c_int = 3; -pub const SO_ERROR: ::c_int = 4; -pub const SO_DONTROUTE: ::c_int = 5; -pub const SO_BROADCAST: ::c_int = 6; -pub const SO_SNDBUF: ::c_int = 7; -pub const SO_RCVBUF: ::c_int = 8; -pub const SO_KEEPALIVE: ::c_int = 9; -pub const SO_OOBINLINE: ::c_int = 10; -pub const SO_NO_CHECK: ::c_int = 11; -pub const SO_PRIORITY: ::c_int = 12; -pub const SO_LINGER: ::c_int = 13; -pub const SO_BSDCOMPAT: ::c_int = 14; -pub const SO_REUSEPORT: ::c_int = 15; -pub const SO_PASSCRED: ::c_int = 16; -pub const SO_PEERCRED: ::c_int = 17; -pub const SO_RCVLOWAT: ::c_int = 18; -pub const SO_SNDLOWAT: ::c_int = 19; -pub const SO_RCVTIMEO: ::c_int = 20; -pub const SO_SNDTIMEO: ::c_int = 21; -pub const SO_ACCEPTCONN: ::c_int = 30; -pub const SO_SNDBUFFORCE: ::c_int = 32; -pub const SO_RCVBUFFORCE: ::c_int = 33; -pub const SO_PROTOCOL: ::c_int = 38; -pub const SO_DOMAIN: ::c_int = 39; - -pub const SA_ONSTACK: ::c_int = 0x08000000; -pub const SA_SIGINFO: ::c_int = 0x00000004; -pub const SA_NOCLDWAIT: ::c_int = 0x00000002; - -pub const SIGCHLD: ::c_int = 17; -pub const SIGBUS: ::c_int = 7; -pub const SIGTTIN: ::c_int = 21; -pub const SIGTTOU: ::c_int = 22; -pub const SIGXCPU: ::c_int = 24; -pub const SIGXFSZ: ::c_int = 25; -pub const SIGVTALRM: ::c_int = 26; -pub const SIGPROF: ::c_int = 27; -pub const SIGWINCH: ::c_int = 28; -pub const SIGUSR1: ::c_int = 10; -pub const SIGUSR2: ::c_int = 12; -pub const SIGCONT: ::c_int = 18; -pub const SIGSTOP: ::c_int = 19; -pub const SIGTSTP: ::c_int = 20; -pub const SIGURG: ::c_int = 23; -pub const SIGIO: ::c_int = 29; -pub const SIGSYS: ::c_int = 31; -pub const SIGSTKFLT: ::c_int = 16; -pub const SIGPOLL: ::c_int = 29; -pub const SIGPWR: ::c_int = 30; -pub const SIG_SETMASK: ::c_int = 2; -pub const SIG_BLOCK: ::c_int = 0x000000; -pub const SIG_UNBLOCK: ::c_int = 0x01; - -pub const EXTPROC: ::tcflag_t = 0x00010000; - -pub const MAP_HUGETLB: ::c_int = 0x040000; -pub const MAP_32BIT: ::c_int = 0x0040; - -pub const F_GETLK: ::c_int = 12; -pub const F_GETOWN: ::c_int = 9; -pub const F_SETLK: ::c_int = 13; -pub const F_SETLKW: ::c_int = 14; -pub const F_SETOWN: ::c_int = 8; - -pub const VEOF: usize = 4; -pub const VEOL: usize = 11; -pub const VEOL2: usize = 16; -pub const VMIN: usize = 6; -pub const IEXTEN: ::tcflag_t = 0x00008000; -pub const TOSTOP: ::tcflag_t = 0x00000100; -pub const FLUSHO: ::tcflag_t = 0x00001000; - -pub const TCGETS: ::c_int = 0x5401; -pub const TCSETS: ::c_int = 0x5402; -pub const TCSETSW: ::c_int = 0x5403; -pub const TCSETSF: ::c_int = 0x5404; -pub const TCGETA: ::c_int = 0x5405; -pub const TCSETA: ::c_int = 0x5406; -pub const TCSETAW: ::c_int = 0x5407; -pub const TCSETAF: ::c_int = 0x5408; -pub const TCSBRK: ::c_int = 0x5409; -pub const TCXONC: ::c_int = 0x540A; -pub const TCFLSH: ::c_int = 0x540B; -pub const TIOCGSOFTCAR: ::c_int = 0x5419; -pub const TIOCSSOFTCAR: ::c_int = 0x541A; -pub const TIOCLINUX: ::c_int = 0x541C; -pub const TIOCGSERIAL: ::c_int = 0x541E; -pub const TIOCEXCL: ::c_int = 0x540C; -pub const TIOCNXCL: ::c_int = 0x540D; -pub const TIOCSCTTY: ::c_int = 0x540E; -pub const TIOCGPGRP: ::c_int = 0x540F; -pub const TIOCSPGRP: ::c_int = 0x5410; -pub const TIOCOUTQ: ::c_int = 0x5411; -pub const TIOCSTI: ::c_int = 0x5412; -pub const TIOCGWINSZ: ::c_int = 0x5413; -pub const TIOCSWINSZ: ::c_int = 0x5414; -pub const TIOCMGET: ::c_int = 0x5415; -pub const TIOCMBIS: ::c_int = 0x5416; -pub const TIOCMBIC: ::c_int = 0x5417; -pub const TIOCMSET: ::c_int = 0x5418; -pub const FIONREAD: ::c_int = 0x541B; -pub const TIOCCONS: ::c_int = 0x541D; - -pub const TIOCGRS485: ::c_int = 0x542E; -pub const TIOCSRS485: ::c_int = 0x542F; - -pub const POLLWRNORM: ::c_short = 0x100; -pub const POLLWRBAND: ::c_short = 0x200; - -pub const TIOCM_LE: ::c_int = 0x001; -pub const TIOCM_DTR: ::c_int = 0x002; -pub const TIOCM_RTS: ::c_int = 0x004; -pub const TIOCM_ST: ::c_int = 0x008; -pub const TIOCM_SR: ::c_int = 0x010; -pub const TIOCM_CTS: ::c_int = 0x020; -pub const TIOCM_CAR: ::c_int = 0x040; -pub const TIOCM_RNG: ::c_int = 0x080; -pub const TIOCM_DSR: ::c_int = 0x100; -pub const TIOCM_CD: ::c_int = TIOCM_CAR; -pub const TIOCM_RI: ::c_int = TIOCM_RNG; - -// Syscall table -pub const SYS_restart_syscall: ::c_long = 0; -pub const SYS_exit: ::c_long = 1; -pub const SYS_fork: ::c_long = 2; -pub const SYS_read: ::c_long = 3; -pub const SYS_write: ::c_long = 4; -pub const SYS_open: ::c_long = 5; -pub const SYS_close: ::c_long = 6; -pub const SYS_waitpid: ::c_long = 7; -pub const SYS_creat: ::c_long = 8; -pub const SYS_link: ::c_long = 9; -pub const SYS_unlink: ::c_long = 10; -pub const SYS_execve: ::c_long = 11; -pub const SYS_chdir: ::c_long = 12; -pub const SYS_time: ::c_long = 13; -pub const SYS_mknod: ::c_long = 14; -pub const SYS_chmod: ::c_long = 15; -pub const SYS_lchown: ::c_long = 16; -pub const SYS_break: ::c_long = 17; -pub const SYS_oldstat: ::c_long = 18; -pub const SYS_lseek: ::c_long = 19; -pub const SYS_getpid: ::c_long = 20; -pub const SYS_mount: ::c_long = 21; -pub const SYS_umount: ::c_long = 22; -pub const SYS_setuid: ::c_long = 23; -pub const SYS_getuid: ::c_long = 24; -pub const SYS_stime: ::c_long = 25; -pub const SYS_ptrace: ::c_long = 26; -pub const SYS_alarm: ::c_long = 27; -pub const SYS_oldfstat: ::c_long = 28; -pub const SYS_pause: ::c_long = 29; -pub const SYS_utime: ::c_long = 30; -pub const SYS_stty: ::c_long = 31; -pub const SYS_gtty: ::c_long = 32; -pub const SYS_access: ::c_long = 33; -pub const SYS_nice: ::c_long = 34; -pub const SYS_ftime: ::c_long = 35; -pub const SYS_sync: ::c_long = 36; -pub const SYS_kill: ::c_long = 37; -pub const SYS_rename: ::c_long = 38; -pub const SYS_mkdir: ::c_long = 39; -pub const SYS_rmdir: ::c_long = 40; -pub const SYS_dup: ::c_long = 41; -pub const SYS_pipe: ::c_long = 42; -pub const SYS_times: ::c_long = 43; -pub const SYS_prof: ::c_long = 44; -pub const SYS_brk: ::c_long = 45; -pub const SYS_setgid: ::c_long = 46; -pub const SYS_getgid: ::c_long = 47; -pub const SYS_signal: ::c_long = 48; -pub const SYS_geteuid: ::c_long = 49; -pub const SYS_getegid: ::c_long = 50; -pub const SYS_acct: ::c_long = 51; -pub const SYS_umount2: ::c_long = 52; -pub const SYS_lock: ::c_long = 53; -pub const SYS_ioctl: ::c_long = 54; -pub const SYS_fcntl: ::c_long = 55; -pub const SYS_mpx: ::c_long = 56; -pub const SYS_setpgid: ::c_long = 57; -pub const SYS_ulimit: ::c_long = 58; -pub const SYS_oldolduname: ::c_long = 59; -pub const SYS_umask: ::c_long = 60; -pub const SYS_chroot: ::c_long = 61; -pub const SYS_ustat: ::c_long = 62; -pub const SYS_dup2: ::c_long = 63; -pub const SYS_getppid: ::c_long = 64; -pub const SYS_getpgrp: ::c_long = 65; -pub const SYS_setsid: ::c_long = 66; -pub const SYS_sigaction: ::c_long = 67; -pub const SYS_sgetmask: ::c_long = 68; -pub const SYS_ssetmask: ::c_long = 69; -pub const SYS_setreuid: ::c_long = 70; -pub const SYS_setregid: ::c_long = 71; -pub const SYS_sigsuspend: ::c_long = 72; -pub const SYS_sigpending: ::c_long = 73; -pub const SYS_sethostname: ::c_long = 74; -pub const SYS_setrlimit: ::c_long = 75; -pub const SYS_getrlimit: ::c_long = 76; -pub const SYS_getrusage: ::c_long = 77; -pub const SYS_gettimeofday: ::c_long = 78; -pub const SYS_settimeofday: ::c_long = 79; -pub const SYS_getgroups: ::c_long = 80; -pub const SYS_setgroups: ::c_long = 81; -pub const SYS_select: ::c_long = 82; -pub const SYS_symlink: ::c_long = 83; -pub const SYS_oldlstat: ::c_long = 84; -pub const SYS_readlink: ::c_long = 85; -pub const SYS_uselib: ::c_long = 86; -pub const SYS_swapon: ::c_long = 87; -pub const SYS_reboot: ::c_long = 88; -pub const SYS_readdir: ::c_long = 89; -pub const SYS_mmap: ::c_long = 90; -pub const SYS_munmap: ::c_long = 91; -pub const SYS_truncate: ::c_long = 92; -pub const SYS_ftruncate: ::c_long = 93; -pub const SYS_fchmod: ::c_long = 94; -pub const SYS_fchown: ::c_long = 95; -pub const SYS_getpriority: ::c_long = 96; -pub const SYS_setpriority: ::c_long = 97; -pub const SYS_profil: ::c_long = 98; -pub const SYS_statfs: ::c_long = 99; -pub const SYS_fstatfs: ::c_long = 100; -pub const SYS_ioperm: ::c_long = 101; -pub const SYS_socketcall: ::c_long = 102; -pub const SYS_syslog: ::c_long = 103; -pub const SYS_setitimer: ::c_long = 104; -pub const SYS_getitimer: ::c_long = 105; -pub const SYS_stat: ::c_long = 106; -pub const SYS_lstat: ::c_long = 107; -pub const SYS_fstat: ::c_long = 108; -pub const SYS_olduname: ::c_long = 109; -pub const SYS_iopl: ::c_long = 110; -pub const SYS_vhangup: ::c_long = 111; -pub const SYS_idle: ::c_long = 112; -pub const SYS_vm86old: ::c_long = 113; -pub const SYS_wait4: ::c_long = 114; -pub const SYS_swapoff: ::c_long = 115; -pub const SYS_sysinfo: ::c_long = 116; -pub const SYS_ipc: ::c_long = 117; -pub const SYS_fsync: ::c_long = 118; -pub const SYS_sigreturn: ::c_long = 119; -pub const SYS_clone: ::c_long = 120; -pub const SYS_setdomainname: ::c_long = 121; -pub const SYS_uname: ::c_long = 122; -pub const SYS_modify_ldt: ::c_long = 123; -pub const SYS_adjtimex: ::c_long = 124; -pub const SYS_mprotect: ::c_long = 125; -pub const SYS_sigprocmask: ::c_long = 126; -pub const SYS_create_module: ::c_long = 127; -pub const SYS_init_module: ::c_long = 128; -pub const SYS_delete_module: ::c_long = 129; -pub const SYS_get_kernel_syms: ::c_long = 130; -pub const SYS_quotactl: ::c_long = 131; -pub const SYS_getpgid: ::c_long = 132; -pub const SYS_fchdir: ::c_long = 133; -pub const SYS_bdflush: ::c_long = 134; -pub const SYS_sysfs: ::c_long = 135; -pub const SYS_personality: ::c_long = 136; -pub const SYS_afs_syscall: ::c_long = 137; -pub const SYS_setfsuid: ::c_long = 138; -pub const SYS_setfsgid: ::c_long = 139; -pub const SYS__llseek: ::c_long = 140; -pub const SYS_getdents: ::c_long = 141; -pub const SYS__newselect: ::c_long = 142; -pub const SYS_flock: ::c_long = 143; -pub const SYS_msync: ::c_long = 144; -pub const SYS_readv: ::c_long = 145; -pub const SYS_writev: ::c_long = 146; -pub const SYS_getsid: ::c_long = 147; -pub const SYS_fdatasync: ::c_long = 148; -pub const SYS__sysctl: ::c_long = 149; -pub const SYS_mlock: ::c_long = 150; -pub const SYS_munlock: ::c_long = 151; -pub const SYS_mlockall: ::c_long = 152; -pub const SYS_munlockall: ::c_long = 153; -pub const SYS_sched_setparam: ::c_long = 154; -pub const SYS_sched_getparam: ::c_long = 155; -pub const SYS_sched_setscheduler: ::c_long = 156; -pub const SYS_sched_getscheduler: ::c_long = 157; -pub const SYS_sched_yield: ::c_long = 158; -pub const SYS_sched_get_priority_max: ::c_long = 159; -pub const SYS_sched_get_priority_min: ::c_long = 160; -pub const SYS_sched_rr_get_interval: ::c_long = 161; -pub const SYS_nanosleep: ::c_long = 162; -pub const SYS_mremap: ::c_long = 163; -pub const SYS_setresuid: ::c_long = 164; -pub const SYS_getresuid: ::c_long = 165; -pub const SYS_vm86: ::c_long = 166; -pub const SYS_query_module: ::c_long = 167; -pub const SYS_poll: ::c_long = 168; -pub const SYS_nfsservctl: ::c_long = 169; -pub const SYS_setresgid: ::c_long = 170; -pub const SYS_getresgid: ::c_long = 171; -pub const SYS_prctl: ::c_long = 172; -pub const SYS_rt_sigreturn: ::c_long = 173; -pub const SYS_rt_sigaction: ::c_long = 174; -pub const SYS_rt_sigprocmask: ::c_long = 175; -pub const SYS_rt_sigpending: ::c_long = 176; -pub const SYS_rt_sigtimedwait: ::c_long = 177; -pub const SYS_rt_sigqueueinfo: ::c_long = 178; -pub const SYS_rt_sigsuspend: ::c_long = 179; -pub const SYS_pread64: ::c_long = 180; -pub const SYS_pwrite64: ::c_long = 181; -pub const SYS_chown: ::c_long = 182; -pub const SYS_getcwd: ::c_long = 183; -pub const SYS_capget: ::c_long = 184; -pub const SYS_capset: ::c_long = 185; -pub const SYS_sigaltstack: ::c_long = 186; -pub const SYS_sendfile: ::c_long = 187; -pub const SYS_getpmsg: ::c_long = 188; -pub const SYS_putpmsg: ::c_long = 189; -pub const SYS_vfork: ::c_long = 190; -pub const SYS_ugetrlimit: ::c_long = 191; -pub const SYS_mmap2: ::c_long = 192; -pub const SYS_truncate64: ::c_long = 193; -pub const SYS_ftruncate64: ::c_long = 194; -pub const SYS_stat64: ::c_long = 195; -pub const SYS_lstat64: ::c_long = 196; -pub const SYS_fstat64: ::c_long = 197; -pub const SYS_lchown32: ::c_long = 198; -pub const SYS_getuid32: ::c_long = 199; -pub const SYS_getgid32: ::c_long = 200; -pub const SYS_geteuid32: ::c_long = 201; -pub const SYS_getegid32: ::c_long = 202; -pub const SYS_setreuid32: ::c_long = 203; -pub const SYS_setregid32: ::c_long = 204; -pub const SYS_getgroups32: ::c_long = 205; -pub const SYS_setgroups32: ::c_long = 206; -pub const SYS_fchown32: ::c_long = 207; -pub const SYS_setresuid32: ::c_long = 208; -pub const SYS_getresuid32: ::c_long = 209; -pub const SYS_setresgid32: ::c_long = 210; -pub const SYS_getresgid32: ::c_long = 211; -pub const SYS_chown32: ::c_long = 212; -pub const SYS_setuid32: ::c_long = 213; -pub const SYS_setgid32: ::c_long = 214; -pub const SYS_setfsuid32: ::c_long = 215; -pub const SYS_setfsgid32: ::c_long = 216; -pub const SYS_pivot_root: ::c_long = 217; -pub const SYS_mincore: ::c_long = 218; -pub const SYS_madvise: ::c_long = 219; -pub const SYS_getdents64: ::c_long = 220; -pub const SYS_fcntl64: ::c_long = 221; -pub const SYS_gettid: ::c_long = 224; -pub const SYS_readahead: ::c_long = 225; -pub const SYS_setxattr: ::c_long = 226; -pub const SYS_lsetxattr: ::c_long = 227; -pub const SYS_fsetxattr: ::c_long = 228; -pub const SYS_getxattr: ::c_long = 229; -pub const SYS_lgetxattr: ::c_long = 230; -pub const SYS_fgetxattr: ::c_long = 231; -pub const SYS_listxattr: ::c_long = 232; -pub const SYS_llistxattr: ::c_long = 233; -pub const SYS_flistxattr: ::c_long = 234; -pub const SYS_removexattr: ::c_long = 235; -pub const SYS_lremovexattr: ::c_long = 236; -pub const SYS_fremovexattr: ::c_long = 237; -pub const SYS_tkill: ::c_long = 238; -pub const SYS_sendfile64: ::c_long = 239; -pub const SYS_futex: ::c_long = 240; -pub const SYS_sched_setaffinity: ::c_long = 241; -pub const SYS_sched_getaffinity: ::c_long = 242; -pub const SYS_set_thread_area: ::c_long = 243; -pub const SYS_get_thread_area: ::c_long = 244; -pub const SYS_io_setup: ::c_long = 245; -pub const SYS_io_destroy: ::c_long = 246; -pub const SYS_io_getevents: ::c_long = 247; -pub const SYS_io_submit: ::c_long = 248; -pub const SYS_io_cancel: ::c_long = 249; -pub const SYS_fadvise64: ::c_long = 250; -pub const SYS_exit_group: ::c_long = 252; -pub const SYS_lookup_dcookie: ::c_long = 253; -pub const SYS_epoll_create: ::c_long = 254; -pub const SYS_epoll_ctl: ::c_long = 255; -pub const SYS_epoll_wait: ::c_long = 256; -pub const SYS_remap_file_pages: ::c_long = 257; -pub const SYS_set_tid_address: ::c_long = 258; -pub const SYS_timer_create: ::c_long = 259; -pub const SYS_timer_settime: ::c_long = 260; -pub const SYS_timer_gettime: ::c_long = 261; -pub const SYS_timer_getoverrun: ::c_long = 262; -pub const SYS_timer_delete: ::c_long = 263; -pub const SYS_clock_settime: ::c_long = 264; -pub const SYS_clock_gettime: ::c_long = 265; -pub const SYS_clock_getres: ::c_long = 266; -pub const SYS_clock_nanosleep: ::c_long = 267; -pub const SYS_statfs64: ::c_long = 268; -pub const SYS_fstatfs64: ::c_long = 269; -pub const SYS_tgkill: ::c_long = 270; -pub const SYS_utimes: ::c_long = 271; -pub const SYS_fadvise64_64: ::c_long = 272; -pub const SYS_vserver: ::c_long = 273; -pub const SYS_mbind: ::c_long = 274; -pub const SYS_get_mempolicy: ::c_long = 275; -pub const SYS_set_mempolicy: ::c_long = 276; -pub const SYS_mq_open: ::c_long = 277; -pub const SYS_mq_unlink: ::c_long = 278; -pub const SYS_mq_timedsend: ::c_long = 279; -pub const SYS_mq_timedreceive: ::c_long = 280; -pub const SYS_mq_notify: ::c_long = 281; -pub const SYS_mq_getsetattr: ::c_long = 282; -pub const SYS_kexec_load: ::c_long = 283; -pub const SYS_waitid: ::c_long = 284; -pub const SYS_add_key: ::c_long = 286; -pub const SYS_request_key: ::c_long = 287; -pub const SYS_keyctl: ::c_long = 288; -pub const SYS_ioprio_set: ::c_long = 289; -pub const SYS_ioprio_get: ::c_long = 290; -pub const SYS_inotify_init: ::c_long = 291; -pub const SYS_inotify_add_watch: ::c_long = 292; -pub const SYS_inotify_rm_watch: ::c_long = 293; -pub const SYS_migrate_pages: ::c_long = 294; -pub const SYS_openat: ::c_long = 295; -pub const SYS_mkdirat: ::c_long = 296; -pub const SYS_mknodat: ::c_long = 297; -pub const SYS_fchownat: ::c_long = 298; -pub const SYS_futimesat: ::c_long = 299; -pub const SYS_fstatat64: ::c_long = 300; -pub const SYS_unlinkat: ::c_long = 301; -pub const SYS_renameat: ::c_long = 302; -pub const SYS_linkat: ::c_long = 303; -pub const SYS_symlinkat: ::c_long = 304; -pub const SYS_readlinkat: ::c_long = 305; -pub const SYS_fchmodat: ::c_long = 306; -pub const SYS_faccessat: ::c_long = 307; -pub const SYS_pselect6: ::c_long = 308; -pub const SYS_ppoll: ::c_long = 309; -pub const SYS_unshare: ::c_long = 310; -pub const SYS_set_robust_list: ::c_long = 311; -pub const SYS_get_robust_list: ::c_long = 312; -pub const SYS_splice: ::c_long = 313; -pub const SYS_sync_file_range: ::c_long = 314; -pub const SYS_tee: ::c_long = 315; -pub const SYS_vmsplice: ::c_long = 316; -pub const SYS_move_pages: ::c_long = 317; -pub const SYS_getcpu: ::c_long = 318; -pub const SYS_epoll_pwait: ::c_long = 319; -pub const SYS_utimensat: ::c_long = 320; -pub const SYS_signalfd: ::c_long = 321; -pub const SYS_timerfd_create: ::c_long = 322; -pub const SYS_eventfd: ::c_long = 323; -pub const SYS_fallocate: ::c_long = 324; -pub const SYS_timerfd_settime: ::c_long = 325; -pub const SYS_timerfd_gettime: ::c_long = 326; -pub const SYS_signalfd4: ::c_long = 327; -pub const SYS_eventfd2: ::c_long = 328; -pub const SYS_epoll_create1: ::c_long = 329; -pub const SYS_dup3: ::c_long = 330; -pub const SYS_pipe2: ::c_long = 331; -pub const SYS_inotify_init1: ::c_long = 332; -pub const SYS_preadv: ::c_long = 333; -pub const SYS_pwritev: ::c_long = 334; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 335; -pub const SYS_perf_event_open: ::c_long = 336; -pub const SYS_recvmmsg: ::c_long = 337; -pub const SYS_fanotify_init: ::c_long = 338; -pub const SYS_fanotify_mark: ::c_long = 339; -pub const SYS_prlimit64: ::c_long = 340; -pub const SYS_name_to_handle_at: ::c_long = 341; -pub const SYS_open_by_handle_at: ::c_long = 342; -pub const SYS_clock_adjtime: ::c_long = 343; -pub const SYS_syncfs: ::c_long = 344; -pub const SYS_sendmmsg: ::c_long = 345; -pub const SYS_setns: ::c_long = 346; -pub const SYS_process_vm_readv: ::c_long = 347; -pub const SYS_process_vm_writev: ::c_long = 348; -pub const SYS_kcmp: ::c_long = 349; -pub const SYS_finit_module: ::c_long = 350; -pub const SYS_sched_setattr: ::c_long = 351; -pub const SYS_sched_getattr: ::c_long = 352; -pub const SYS_renameat2: ::c_long = 353; -pub const SYS_seccomp: ::c_long = 354; -pub const SYS_getrandom: ::c_long = 355; -pub const SYS_memfd_create: ::c_long = 356; -pub const SYS_bpf: ::c_long = 357; -pub const SYS_execveat: ::c_long = 358; -pub const SYS_socket: ::c_long = 359; -pub const SYS_socketpair: ::c_long = 360; -pub const SYS_bind: ::c_long = 361; -pub const SYS_connect: ::c_long = 362; -pub const SYS_listen: ::c_long = 363; -pub const SYS_accept4: ::c_long = 364; -pub const SYS_getsockopt: ::c_long = 365; -pub const SYS_setsockopt: ::c_long = 366; -pub const SYS_getsockname: ::c_long = 367; -pub const SYS_getpeername: ::c_long = 368; -pub const SYS_sendto: ::c_long = 369; -pub const SYS_sendmsg: ::c_long = 370; -pub const SYS_recvfrom: ::c_long = 371; -pub const SYS_recvmsg: ::c_long = 372; -pub const SYS_shutdown: ::c_long = 373; -pub const SYS_userfaultfd: ::c_long = 374; -pub const SYS_membarrier: ::c_long = 375; -pub const SYS_mlock2: ::c_long = 376; -pub const SYS_copy_file_range: ::c_long = 377; -pub const SYS_preadv2: ::c_long = 378; -pub const SYS_pwritev2: ::c_long = 379; -// FIXME syscalls 380-382 have been added in musl 1.16 -// See discussion https://github.com/rust-lang/libc/pull/699 - -// offsets in user_regs_structs, from sys/reg.h -pub const EBX: ::c_int = 0; -pub const ECX: ::c_int = 1; -pub const EDX: ::c_int = 2; -pub const ESI: ::c_int = 3; -pub const EDI: ::c_int = 4; -pub const EBP: ::c_int = 5; -pub const EAX: ::c_int = 6; -pub const DS: ::c_int = 7; -pub const ES: ::c_int = 8; -pub const FS: ::c_int = 9; -pub const GS: ::c_int = 10; -pub const ORIG_EAX: ::c_int = 11; -pub const EIP: ::c_int = 12; -pub const CS: ::c_int = 13; -pub const EFL: ::c_int = 14; -pub const UESP: ::c_int = 15; -pub const SS: ::c_int = 16; - -#[doc(hidden)] -pub const AF_MAX: ::c_int = 42; -#[doc(hidden)] -pub const PF_MAX: ::c_int = AF_MAX; diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,479 +0,0 @@ -pub type c_char = u8; -pub type __u64 = ::c_ulonglong; -pub type wchar_t = u32; -pub type nlink_t = u32; -pub type blksize_t = ::c_int; - -s! { - pub struct stat { - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __pad0: ::c_ulong, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - __pad1: ::c_int, - pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - __unused: [::c_uint; 2], - } - - pub struct stat64 { - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __pad0: ::c_ulong, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - __pad1: ::c_int, - pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - __unused: [::c_uint; 2], - } - - pub struct ipc_perm { - pub __ipc_perm_key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::mode_t, - pub __seq: ::c_ushort, - __unused1: ::c_ulong, - __unused2: ::c_ulong, - } -} - -pub const O_DIRECT: ::c_int = 0x10000; -pub const O_DIRECTORY: ::c_int = 0x4000; -pub const O_LARGEFILE: ::c_int = 0x20000; -pub const O_NOFOLLOW: ::c_int = 0x8000; - -pub const MINSIGSTKSZ: ::size_t = 6144; -pub const SIGSTKSZ: ::size_t = 12288; - -#[doc(hidden)] -pub const PF_MAX: ::c_int = 43; -#[doc(hidden)] -pub const AF_MAX: ::c_int = PF_MAX; - -pub const SYS_io_setup: ::c_long = 0; -pub const SYS_io_destroy: ::c_long = 1; -pub const SYS_io_submit: ::c_long = 2; -pub const SYS_io_cancel: ::c_long = 3; -pub const SYS_io_getevents: ::c_long = 4; -pub const SYS_setxattr: ::c_long = 5; -pub const SYS_lsetxattr: ::c_long = 6; -pub const SYS_fsetxattr: ::c_long = 7; -pub const SYS_getxattr: ::c_long = 8; -pub const SYS_lgetxattr: ::c_long = 9; -pub const SYS_fgetxattr: ::c_long = 10; -pub const SYS_listxattr: ::c_long = 11; -pub const SYS_llistxattr: ::c_long = 12; -pub const SYS_flistxattr: ::c_long = 13; -pub const SYS_removexattr: ::c_long = 14; -pub const SYS_lremovexattr: ::c_long = 15; -pub const SYS_fremovexattr: ::c_long = 16; -pub const SYS_getcwd: ::c_long = 17; -pub const SYS_lookup_dcookie: ::c_long = 18; -pub const SYS_eventfd2: ::c_long = 19; -pub const SYS_epoll_create1: ::c_long = 20; -pub const SYS_epoll_ctl: ::c_long = 21; -pub const SYS_epoll_pwait: ::c_long = 22; -pub const SYS_dup: ::c_long = 23; -pub const SYS_dup3: ::c_long = 24; -pub const SYS_inotify_init1: ::c_long = 26; -pub const SYS_inotify_add_watch: ::c_long = 27; -pub const SYS_inotify_rm_watch: ::c_long = 28; -pub const SYS_ioctl: ::c_long = 29; -pub const SYS_ioprio_set: ::c_long = 30; -pub const SYS_ioprio_get: ::c_long = 31; -pub const SYS_flock: ::c_long = 32; -pub const SYS_mknodat: ::c_long = 33; -pub const SYS_mkdirat: ::c_long = 34; -pub const SYS_unlinkat: ::c_long = 35; -pub const SYS_symlinkat: ::c_long = 36; -pub const SYS_linkat: ::c_long = 37; -pub const SYS_renameat: ::c_long = 38; -pub const SYS_umount2: ::c_long = 39; -pub const SYS_mount: ::c_long = 40; -pub const SYS_pivot_root: ::c_long = 41; -pub const SYS_nfsservctl: ::c_long = 42; -pub const SYS_fallocate: ::c_long = 47; -pub const SYS_faccessat: ::c_long = 48; -pub const SYS_chdir: ::c_long = 49; -pub const SYS_fchdir: ::c_long = 50; -pub const SYS_chroot: ::c_long = 51; -pub const SYS_fchmod: ::c_long = 52; -pub const SYS_fchmodat: ::c_long = 53; -pub const SYS_fchownat: ::c_long = 54; -pub const SYS_fchown: ::c_long = 55; -pub const SYS_openat: ::c_long = 56; -pub const SYS_close: ::c_long = 57; -pub const SYS_vhangup: ::c_long = 58; -pub const SYS_pipe2: ::c_long = 59; -pub const SYS_quotactl: ::c_long = 60; -pub const SYS_getdents64: ::c_long = 61; -pub const SYS_read: ::c_long = 63; -pub const SYS_write: ::c_long = 64; -pub const SYS_readv: ::c_long = 65; -pub const SYS_writev: ::c_long = 66; -pub const SYS_pread64: ::c_long = 67; -pub const SYS_pwrite64: ::c_long = 68; -pub const SYS_preadv: ::c_long = 69; -pub const SYS_pwritev: ::c_long = 70; -pub const SYS_pselect6: ::c_long = 72; -pub const SYS_ppoll: ::c_long = 73; -pub const SYS_signalfd4: ::c_long = 74; -pub const SYS_vmsplice: ::c_long = 75; -pub const SYS_splice: ::c_long = 76; -pub const SYS_tee: ::c_long = 77; -pub const SYS_readlinkat: ::c_long = 78; -pub const SYS_sync: ::c_long = 81; -pub const SYS_fsync: ::c_long = 82; -pub const SYS_fdatasync: ::c_long = 83; -pub const SYS_sync_file_range: ::c_long = 84; -pub const SYS_timerfd_create: ::c_long = 85; -pub const SYS_timerfd_settime: ::c_long = 86; -pub const SYS_timerfd_gettime: ::c_long = 87; -pub const SYS_utimensat: ::c_long = 88; -pub const SYS_acct: ::c_long = 89; -pub const SYS_capget: ::c_long = 90; -pub const SYS_capset: ::c_long = 91; -pub const SYS_personality: ::c_long = 92; -pub const SYS_exit: ::c_long = 93; -pub const SYS_exit_group: ::c_long = 94; -pub const SYS_waitid: ::c_long = 95; -pub const SYS_set_tid_address: ::c_long = 96; -pub const SYS_unshare: ::c_long = 97; -pub const SYS_futex: ::c_long = 98; -pub const SYS_set_robust_list: ::c_long = 99; -pub const SYS_get_robust_list: ::c_long = 100; -pub const SYS_nanosleep: ::c_long = 101; -pub const SYS_getitimer: ::c_long = 102; -pub const SYS_setitimer: ::c_long = 103; -pub const SYS_kexec_load: ::c_long = 104; -pub const SYS_init_module: ::c_long = 105; -pub const SYS_delete_module: ::c_long = 106; -pub const SYS_timer_create: ::c_long = 107; -pub const SYS_timer_gettime: ::c_long = 108; -pub const SYS_timer_getoverrun: ::c_long = 109; -pub const SYS_timer_settime: ::c_long = 110; -pub const SYS_timer_delete: ::c_long = 111; -pub const SYS_clock_settime: ::c_long = 112; -pub const SYS_clock_gettime: ::c_long = 113; -pub const SYS_clock_getres: ::c_long = 114; -pub const SYS_clock_nanosleep: ::c_long = 115; -pub const SYS_syslog: ::c_long = 116; -pub const SYS_ptrace: ::c_long = 117; -pub const SYS_sched_setparam: ::c_long = 118; -pub const SYS_sched_setscheduler: ::c_long = 119; -pub const SYS_sched_getscheduler: ::c_long = 120; -pub const SYS_sched_getparam: ::c_long = 121; -pub const SYS_sched_setaffinity: ::c_long = 122; -pub const SYS_sched_getaffinity: ::c_long = 123; -pub const SYS_sched_yield: ::c_long = 124; -pub const SYS_sched_get_priority_max: ::c_long = 125; -pub const SYS_sched_get_priority_min: ::c_long = 126; -pub const SYS_sched_rr_get_interval: ::c_long = 127; -pub const SYS_restart_syscall: ::c_long = 128; -pub const SYS_kill: ::c_long = 129; -pub const SYS_tkill: ::c_long = 130; -pub const SYS_tgkill: ::c_long = 131; -pub const SYS_sigaltstack: ::c_long = 132; -pub const SYS_rt_sigsuspend: ::c_long = 133; -pub const SYS_rt_sigaction: ::c_long = 134; -pub const SYS_rt_sigprocmask: ::c_long = 135; -pub const SYS_rt_sigpending: ::c_long = 136; -pub const SYS_rt_sigtimedwait: ::c_long = 137; -pub const SYS_rt_sigqueueinfo: ::c_long = 138; -pub const SYS_rt_sigreturn: ::c_long = 139; -pub const SYS_setpriority: ::c_long = 140; -pub const SYS_getpriority: ::c_long = 141; -pub const SYS_reboot: ::c_long = 142; -pub const SYS_setregid: ::c_long = 143; -pub const SYS_setgid: ::c_long = 144; -pub const SYS_setreuid: ::c_long = 145; -pub const SYS_setuid: ::c_long = 146; -pub const SYS_setresuid: ::c_long = 147; -pub const SYS_getresuid: ::c_long = 148; -pub const SYS_setresgid: ::c_long = 149; -pub const SYS_getresgid: ::c_long = 150; -pub const SYS_setfsuid: ::c_long = 151; -pub const SYS_setfsgid: ::c_long = 152; -pub const SYS_times: ::c_long = 153; -pub const SYS_setpgid: ::c_long = 154; -pub const SYS_getpgid: ::c_long = 155; -pub const SYS_getsid: ::c_long = 156; -pub const SYS_setsid: ::c_long = 157; -pub const SYS_getgroups: ::c_long = 158; -pub const SYS_setgroups: ::c_long = 159; -pub const SYS_uname: ::c_long = 160; -pub const SYS_sethostname: ::c_long = 161; -pub const SYS_setdomainname: ::c_long = 162; -pub const SYS_getrlimit: ::c_long = 163; -pub const SYS_setrlimit: ::c_long = 164; -pub const SYS_getrusage: ::c_long = 165; -pub const SYS_umask: ::c_long = 166; -pub const SYS_prctl: ::c_long = 167; -pub const SYS_getcpu: ::c_long = 168; -pub const SYS_gettimeofday: ::c_long = 169; -pub const SYS_settimeofday: ::c_long = 170; -pub const SYS_adjtimex: ::c_long = 171; -pub const SYS_getpid: ::c_long = 172; -pub const SYS_getppid: ::c_long = 173; -pub const SYS_getuid: ::c_long = 174; -pub const SYS_geteuid: ::c_long = 175; -pub const SYS_getgid: ::c_long = 176; -pub const SYS_getegid: ::c_long = 177; -pub const SYS_gettid: ::c_long = 178; -pub const SYS_sysinfo: ::c_long = 179; -pub const SYS_mq_open: ::c_long = 180; -pub const SYS_mq_unlink: ::c_long = 181; -pub const SYS_mq_timedsend: ::c_long = 182; -pub const SYS_mq_timedreceive: ::c_long = 183; -pub const SYS_mq_notify: ::c_long = 184; -pub const SYS_mq_getsetattr: ::c_long = 185; -pub const SYS_msgget: ::c_long = 186; -pub const SYS_msgctl: ::c_long = 187; -pub const SYS_msgrcv: ::c_long = 188; -pub const SYS_msgsnd: ::c_long = 189; -pub const SYS_semget: ::c_long = 190; -pub const SYS_semctl: ::c_long = 191; -pub const SYS_semtimedop: ::c_long = 192; -pub const SYS_semop: ::c_long = 193; -pub const SYS_shmget: ::c_long = 194; -pub const SYS_shmctl: ::c_long = 195; -pub const SYS_shmat: ::c_long = 196; -pub const SYS_shmdt: ::c_long = 197; -pub const SYS_socket: ::c_long = 198; -pub const SYS_socketpair: ::c_long = 199; -pub const SYS_bind: ::c_long = 200; -pub const SYS_listen: ::c_long = 201; -pub const SYS_accept: ::c_long = 202; -pub const SYS_connect: ::c_long = 203; -pub const SYS_getsockname: ::c_long = 204; -pub const SYS_getpeername: ::c_long = 205; -pub const SYS_sendto: ::c_long = 206; -pub const SYS_recvfrom: ::c_long = 207; -pub const SYS_setsockopt: ::c_long = 208; -pub const SYS_getsockopt: ::c_long = 209; -pub const SYS_shutdown: ::c_long = 210; -pub const SYS_sendmsg: ::c_long = 211; -pub const SYS_recvmsg: ::c_long = 212; -pub const SYS_readahead: ::c_long = 213; -pub const SYS_brk: ::c_long = 214; -pub const SYS_munmap: ::c_long = 215; -pub const SYS_mremap: ::c_long = 216; -pub const SYS_add_key: ::c_long = 217; -pub const SYS_request_key: ::c_long = 218; -pub const SYS_keyctl: ::c_long = 219; -pub const SYS_clone: ::c_long = 220; -pub const SYS_execve: ::c_long = 221; -pub const SYS_swapon: ::c_long = 224; -pub const SYS_swapoff: ::c_long = 225; -pub const SYS_mprotect: ::c_long = 226; -pub const SYS_msync: ::c_long = 227; -pub const SYS_mlock: ::c_long = 228; -pub const SYS_munlock: ::c_long = 229; -pub const SYS_mlockall: ::c_long = 230; -pub const SYS_munlockall: ::c_long = 231; -pub const SYS_mincore: ::c_long = 232; -pub const SYS_madvise: ::c_long = 233; -pub const SYS_remap_file_pages: ::c_long = 234; -pub const SYS_mbind: ::c_long = 235; -pub const SYS_get_mempolicy: ::c_long = 236; -pub const SYS_set_mempolicy: ::c_long = 237; -pub const SYS_migrate_pages: ::c_long = 238; -pub const SYS_move_pages: ::c_long = 239; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 240; -pub const SYS_perf_event_open: ::c_long = 241; -pub const SYS_accept4: ::c_long = 242; -pub const SYS_recvmmsg: ::c_long = 243; -pub const SYS_wait4: ::c_long = 260; -pub const SYS_prlimit64: ::c_long = 261; -pub const SYS_fanotify_init: ::c_long = 262; -pub const SYS_fanotify_mark: ::c_long = 263; -pub const SYS_name_to_handle_at: ::c_long = 264; -pub const SYS_open_by_handle_at: ::c_long = 265; -pub const SYS_clock_adjtime: ::c_long = 266; -pub const SYS_syncfs: ::c_long = 267; -pub const SYS_setns: ::c_long = 268; -pub const SYS_sendmmsg: ::c_long = 269; -pub const SYS_process_vm_readv: ::c_long = 270; -pub const SYS_process_vm_writev: ::c_long = 271; -pub const SYS_kcmp: ::c_long = 272; -pub const SYS_finit_module: ::c_long = 273; -pub const SYS_sched_setattr: ::c_long = 274; -pub const SYS_sched_getattr: ::c_long = 275; -pub const SYS_renameat2: ::c_long = 276; -pub const SYS_seccomp: ::c_long = 277; -pub const SYS_getrandom: ::c_long = 278; -pub const SYS_memfd_create: ::c_long = 279; -pub const SYS_bpf: ::c_long = 280; -pub const SYS_execveat: ::c_long = 281; -pub const SYS_userfaultfd: ::c_long = 282; -pub const SYS_membarrier: ::c_long = 283; -pub const SYS_mlock2: ::c_long = 284; -pub const SYS_copy_file_range: ::c_long = 285; -pub const SYS_preadv2: ::c_long = 286; -pub const SYS_pwritev2: ::c_long = 287; -pub const SYS_pkey_mprotect: ::c_long = 288; -pub const SYS_pkey_alloc: ::c_long = 289; -pub const SYS_pkey_free: ::c_long = 290; - -pub const RLIMIT_NLIMITS: ::c_int = 16; -pub const TIOCINQ: ::c_int = ::FIONREAD; -pub const MCL_CURRENT: ::c_int = 0x0001; -pub const MCL_FUTURE: ::c_int = 0x0002; -pub const CBAUD: ::tcflag_t = 0o0010017; -pub const TAB1: ::c_int = 0x00000800; -pub const TAB2: ::c_int = 0x00001000; -pub const TAB3: ::c_int = 0x00001800; -pub const CR1: ::c_int = 0x00000200; -pub const CR2: ::c_int = 0x00000400; -pub const CR3: ::c_int = 0x00000600; -pub const FF1: ::c_int = 0x00008000; -pub const BS1: ::c_int = 0x00002000; -pub const VT1: ::c_int = 0x00004000; -pub const VWERASE: usize = 14; -pub const VREPRINT: usize = 12; -pub const VSUSP: usize = 10; -pub const VSTART: usize = 8; -pub const VSTOP: usize = 9; -pub const VDISCARD: usize = 13; -pub const VTIME: usize = 5; -pub const IXON: ::tcflag_t = 0x00000400; -pub const IXOFF: ::tcflag_t = 0x00001000; -pub const ONLCR: ::tcflag_t = 0x4; -pub const CSIZE: ::tcflag_t = 0x00000030; -pub const CS6: ::tcflag_t = 0x00000010; -pub const CS7: ::tcflag_t = 0x00000020; -pub const CS8: ::tcflag_t = 0x00000030; -pub const CSTOPB: ::tcflag_t = 0x00000040; -pub const CREAD: ::tcflag_t = 0x00000080; -pub const PARENB: ::tcflag_t = 0x00000100; -pub const PARODD: ::tcflag_t = 0x00000200; -pub const HUPCL: ::tcflag_t = 0x00000400; -pub const CLOCAL: ::tcflag_t = 0x00000800; -pub const ECHOKE: ::tcflag_t = 0x00000800; -pub const ECHOE: ::tcflag_t = 0x00000010; -pub const ECHOK: ::tcflag_t = 0x00000020; -pub const ECHONL: ::tcflag_t = 0x00000040; -pub const ECHOPRT: ::tcflag_t = 0x00000400; -pub const ECHOCTL: ::tcflag_t = 0x00000200; -pub const ISIG: ::tcflag_t = 0x00000001; -pub const ICANON: ::tcflag_t = 0x00000002; -pub const PENDIN: ::tcflag_t = 0x00004000; -pub const NOFLSH: ::tcflag_t = 0x00000080; -pub const CIBAUD: ::tcflag_t = 0o02003600000; -pub const CBAUDEX: ::tcflag_t = 0o010000; -pub const VSWTC: usize = 7; -pub const OLCUC: ::tcflag_t = 0o000002; -pub const NLDLY: ::tcflag_t = 0o000400; -pub const CRDLY: ::tcflag_t = 0o003000; -pub const TABDLY: ::tcflag_t = 0o014000; -pub const BSDLY: ::tcflag_t = 0o020000; -pub const FFDLY: ::tcflag_t = 0o100000; -pub const VTDLY: ::tcflag_t = 0o040000; -pub const XTABS: ::tcflag_t = 0o014000; -pub const B57600: ::speed_t = 0o010001; -pub const B115200: ::speed_t = 0o010002; -pub const B230400: ::speed_t = 0o010003; -pub const B460800: ::speed_t = 0o010004; -pub const B500000: ::speed_t = 0o010005; -pub const B576000: ::speed_t = 0o010006; -pub const B921600: ::speed_t = 0o010007; -pub const B1000000: ::speed_t = 0o010010; -pub const B1152000: ::speed_t = 0o010011; -pub const B1500000: ::speed_t = 0o010012; -pub const B2000000: ::speed_t = 0o010013; -pub const B2500000: ::speed_t = 0o010014; -pub const B3000000: ::speed_t = 0o010015; -pub const B3500000: ::speed_t = 0o010016; -pub const B4000000: ::speed_t = 0o010017; - -pub const FIOCLEX: ::c_int = 0x5451; -pub const FIONBIO: ::c_int = 0x5421; -pub const EDEADLK: ::c_int = 35; -pub const EDEADLOCK: ::c_int = EDEADLK; -pub const SO_PASSCRED: ::c_int = 16; -pub const SO_PEERCRED: ::c_int = 17; -pub const SO_RCVLOWAT: ::c_int = 18; -pub const SO_SNDLOWAT: ::c_int = 19; -pub const SO_RCVTIMEO: ::c_int = 20; -pub const SO_SNDTIMEO: ::c_int = 21; -pub const EXTPROC: ::tcflag_t = 0x00010000; -pub const VEOL: usize = 11; -pub const VEOL2: usize = 16; -pub const VMIN: usize = 6; -pub const IEXTEN: ::tcflag_t = 0x00008000; -pub const TOSTOP: ::tcflag_t = 0x00000100; -pub const FLUSHO: ::tcflag_t = 0x00001000; -pub const TCGETS: ::c_int = 0x5401; -pub const TCSETS: ::c_int = 0x5402; -pub const TCSETSW: ::c_int = 0x5403; -pub const TCSETSF: ::c_int = 0x5404; -pub const TCGETA: ::c_int = 0x5405; -pub const TCSETA: ::c_int = 0x5406; -pub const TCSETAW: ::c_int = 0x5407; -pub const TCSETAF: ::c_int = 0x5408; -pub const TCSBRK: ::c_int = 0x5409; -pub const TCXONC: ::c_int = 0x540A; -pub const TCFLSH: ::c_int = 0x540B; -pub const TIOCGSOFTCAR: ::c_int = 0x5419; -pub const TIOCSSOFTCAR: ::c_int = 0x541A; -pub const TIOCLINUX: ::c_int = 0x541C; -pub const TIOCGSERIAL: ::c_int = 0x541E; -pub const TIOCEXCL: ::c_int = 0x540C; -pub const TIOCNXCL: ::c_int = 0x540D; -pub const TIOCSCTTY: ::c_int = 0x540E; -pub const TIOCGPGRP: ::c_int = 0x540F; -pub const TIOCSPGRP: ::c_int = 0x5410; -pub const TIOCOUTQ: ::c_int = 0x5411; -pub const TIOCSTI: ::c_int = 0x5412; -pub const TIOCGWINSZ: ::c_int = 0x5413; -pub const TIOCSWINSZ: ::c_int = 0x5414; -pub const TIOCMGET: ::c_int = 0x5415; -pub const TIOCMBIS: ::c_int = 0x5416; -pub const TIOCMBIC: ::c_int = 0x5417; -pub const TIOCMSET: ::c_int = 0x5418; -pub const FIONREAD: ::c_int = 0x541B; -pub const TIOCCONS: ::c_int = 0x541D; - -pub const TIOCGRS485: ::c_int = 0x542E; -pub const TIOCSRS485: ::c_int = 0x542F; - -pub const TIOCM_LE: ::c_int = 0x001; -pub const TIOCM_DTR: ::c_int = 0x002; -pub const TIOCM_RTS: ::c_int = 0x004; -pub const TIOCM_ST: ::c_int = 0x008; -pub const TIOCM_SR: ::c_int = 0x010; -pub const TIOCM_CTS: ::c_int = 0x020; -pub const TIOCM_CAR: ::c_int = 0x040; -pub const TIOCM_RNG: ::c_int = 0x080; -pub const TIOCM_DSR: ::c_int = 0x100; -pub const TIOCM_CD: ::c_int = TIOCM_CAR; -pub const TIOCM_RI: ::c_int = TIOCM_RNG; - -extern { - pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/b64/mod.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/b64/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/b64/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/b64/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,339 +0,0 @@ -pub type c_long = i64; -pub type c_ulong = u64; - -s! { - pub struct statfs64 { - pub f_type: ::c_ulong, - pub f_bsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - pub f_namelen: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_flags: ::c_ulong, - pub f_spare: [::c_ulong; 4], - } - - pub struct statvfs64 { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_favail: u64, - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_flags: ::c_int, - pub ss_size: ::size_t - } - - pub struct pthread_attr_t { - __size: [u64; 7] - } - - pub struct sigset_t { - __val: [::c_ulong; 16], - } - - pub struct shmid_ds { - pub shm_perm: ::ipc_perm, - pub shm_segsz: ::size_t, - pub shm_atime: ::time_t, - pub shm_dtime: ::time_t, - pub shm_ctime: ::time_t, - pub shm_cpid: ::pid_t, - pub shm_lpid: ::pid_t, - pub shm_nattch: ::c_ulong, - __pad1: ::c_ulong, - __pad2: ::c_ulong, - } - - pub struct msqid_ds { - pub msg_perm: ::ipc_perm, - pub msg_stime: ::time_t, - pub msg_rtime: ::time_t, - pub msg_ctime: ::time_t, - __msg_cbytes: ::c_ulong, - pub msg_qnum: ::msgqnum_t, - pub msg_qbytes: ::msglen_t, - pub msg_lspid: ::pid_t, - pub msg_lrpid: ::pid_t, - __pad1: ::c_ulong, - __pad2: ::c_ulong, - } - - pub struct statfs { - pub f_type: ::c_ulong, - pub f_bsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - pub f_namelen: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_flags: ::c_ulong, - pub f_spare: [::c_ulong; 4], - } - - pub struct msghdr { - pub msg_name: *mut ::c_void, - pub msg_namelen: ::socklen_t, - pub msg_iov: *mut ::iovec, - #[cfg(target_endian = "big")] - __pad1: ::c_int, - pub msg_iovlen: ::c_int, - #[cfg(target_endian = "little")] - __pad1: ::c_int, - pub msg_control: *mut ::c_void, - #[cfg(target_endian = "big")] - __pad2: ::c_int, - pub msg_controllen: ::socklen_t, - #[cfg(target_endian = "little")] - __pad2: ::c_int, - pub msg_flags: ::c_int, - } - - pub struct cmsghdr { - #[cfg(target_endian = "big")] - pub __pad1: ::c_int, - pub cmsg_len: ::socklen_t, - #[cfg(target_endian = "little")] - pub __pad1: ::c_int, - pub cmsg_level: ::c_int, - pub cmsg_type: ::c_int, - } - - pub struct sem_t { - __val: [::c_int; 8], - } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_errno: ::c_int, - pub si_code: ::c_int, - pub _pad: [::c_int; 29], - _align: [usize; 0], - } - - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 19], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } -} - -pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; -pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; - -pub const O_ASYNC: ::c_int = 0x2000; - -pub const RLIMIT_RSS: ::c_int = 5; -pub const RLIMIT_NOFILE: ::c_int = 7; -pub const RLIMIT_AS: ::c_int = 9; -pub const RLIMIT_NPROC: ::c_int = 6; -pub const RLIMIT_MEMLOCK: ::c_int = 8; - -pub const O_APPEND: ::c_int = 1024; -pub const O_CREAT: ::c_int = 64; -pub const O_EXCL: ::c_int = 128; -pub const O_NOCTTY: ::c_int = 256; -pub const O_NONBLOCK: ::c_int = 2048; -pub const O_SYNC: ::c_int = 1052672; -pub const O_RSYNC: ::c_int = 1052672; -pub const O_DSYNC: ::c_int = 4096; - -pub const SOCK_NONBLOCK: ::c_int = 2048; - -pub const MAP_ANON: ::c_int = 0x0020; -pub const MAP_GROWSDOWN: ::c_int = 0x0100; -pub const MAP_DENYWRITE: ::c_int = 0x0800; -pub const MAP_EXECUTABLE: ::c_int = 0x01000; -pub const MAP_LOCKED: ::c_int = 0x02000; -pub const MAP_NORESERVE: ::c_int = 0x04000; -pub const MAP_POPULATE: ::c_int = 0x08000; -pub const MAP_NONBLOCK: ::c_int = 0x010000; -pub const MAP_STACK: ::c_int = 0x020000; - -pub const SOCK_STREAM: ::c_int = 1; -pub const SOCK_DGRAM: ::c_int = 2; -pub const SOCK_SEQPACKET: ::c_int = 5; - -pub const SOL_SOCKET: ::c_int = 1; - -pub const ENAMETOOLONG: ::c_int = 36; -pub const ENOLCK: ::c_int = 37; -pub const ENOSYS: ::c_int = 38; -pub const ENOTEMPTY: ::c_int = 39; -pub const ELOOP: ::c_int = 40; -pub const ENOMSG: ::c_int = 42; -pub const EIDRM: ::c_int = 43; -pub const ECHRNG: ::c_int = 44; -pub const EL2NSYNC: ::c_int = 45; -pub const EL3HLT: ::c_int = 46; -pub const EL3RST: ::c_int = 47; -pub const ELNRNG: ::c_int = 48; -pub const EUNATCH: ::c_int = 49; -pub const ENOCSI: ::c_int = 50; -pub const EL2HLT: ::c_int = 51; -pub const EBADE: ::c_int = 52; -pub const EBADR: ::c_int = 53; -pub const EXFULL: ::c_int = 54; -pub const ENOANO: ::c_int = 55; -pub const EBADRQC: ::c_int = 56; -pub const EBADSLT: ::c_int = 57; -pub const EMULTIHOP: ::c_int = 72; -pub const EBADMSG: ::c_int = 74; -pub const EOVERFLOW: ::c_int = 75; -pub const ENOTUNIQ: ::c_int = 76; -pub const EBADFD: ::c_int = 77; -pub const EREMCHG: ::c_int = 78; -pub const ELIBACC: ::c_int = 79; -pub const ELIBBAD: ::c_int = 80; -pub const ELIBSCN: ::c_int = 81; -pub const ELIBMAX: ::c_int = 82; -pub const ELIBEXEC: ::c_int = 83; -pub const EILSEQ: ::c_int = 84; -pub const ERESTART: ::c_int = 85; -pub const ESTRPIPE: ::c_int = 86; -pub const EUSERS: ::c_int = 87; -pub const ENOTSOCK: ::c_int = 88; -pub const EDESTADDRREQ: ::c_int = 89; -pub const EMSGSIZE: ::c_int = 90; -pub const EPROTOTYPE: ::c_int = 91; -pub const ENOPROTOOPT: ::c_int = 92; -pub const EPROTONOSUPPORT: ::c_int = 93; -pub const ESOCKTNOSUPPORT: ::c_int = 94; -pub const EOPNOTSUPP: ::c_int = 95; -pub const ENOTSUP: ::c_int = EOPNOTSUPP; -pub const EPFNOSUPPORT: ::c_int = 96; -pub const EAFNOSUPPORT: ::c_int = 97; -pub const EADDRINUSE: ::c_int = 98; -pub const EADDRNOTAVAIL: ::c_int = 99; -pub const ENETDOWN: ::c_int = 100; -pub const ENETUNREACH: ::c_int = 101; -pub const ENETRESET: ::c_int = 102; -pub const ECONNABORTED: ::c_int = 103; -pub const ECONNRESET: ::c_int = 104; -pub const ENOBUFS: ::c_int = 105; -pub const EISCONN: ::c_int = 106; -pub const ENOTCONN: ::c_int = 107; -pub const ESHUTDOWN: ::c_int = 108; -pub const ETOOMANYREFS: ::c_int = 109; -pub const ETIMEDOUT: ::c_int = 110; -pub const ECONNREFUSED: ::c_int = 111; -pub const EHOSTDOWN: ::c_int = 112; -pub const EHOSTUNREACH: ::c_int = 113; -pub const EALREADY: ::c_int = 114; -pub const EINPROGRESS: ::c_int = 115; -pub const ESTALE: ::c_int = 116; -pub const EUCLEAN: ::c_int = 117; -pub const ENOTNAM: ::c_int = 118; -pub const ENAVAIL: ::c_int = 119; -pub const EISNAM: ::c_int = 120; -pub const EREMOTEIO: ::c_int = 121; -pub const EDQUOT: ::c_int = 122; -pub const ENOMEDIUM: ::c_int = 123; -pub const EMEDIUMTYPE: ::c_int = 124; -pub const ECANCELED: ::c_int = 125; -pub const ENOKEY: ::c_int = 126; -pub const EKEYEXPIRED: ::c_int = 127; -pub const EKEYREVOKED: ::c_int = 128; -pub const EKEYREJECTED: ::c_int = 129; -pub const EOWNERDEAD: ::c_int = 130; -pub const ENOTRECOVERABLE: ::c_int = 131; -pub const ERFKILL: ::c_int = 132; -pub const EHWPOISON: ::c_int = 133; - -pub const SO_REUSEADDR: ::c_int = 2; -pub const SO_TYPE: ::c_int = 3; -pub const SO_ERROR: ::c_int = 4; -pub const SO_DONTROUTE: ::c_int = 5; -pub const SO_BROADCAST: ::c_int = 6; -pub const SO_SNDBUF: ::c_int = 7; -pub const SO_RCVBUF: ::c_int = 8; -pub const SO_KEEPALIVE: ::c_int = 9; -pub const SO_OOBINLINE: ::c_int = 10; -pub const SO_NO_CHECK: ::c_int = 11; -pub const SO_PRIORITY: ::c_int = 12; -pub const SO_LINGER: ::c_int = 13; -pub const SO_BSDCOMPAT: ::c_int = 14; -pub const SO_REUSEPORT: ::c_int = 15; -pub const SO_ACCEPTCONN: ::c_int = 30; -pub const SO_SNDBUFFORCE: ::c_int = 32; -pub const SO_RCVBUFFORCE: ::c_int = 33; -pub const SO_PROTOCOL: ::c_int = 38; -pub const SO_DOMAIN: ::c_int = 39; - -pub const SA_ONSTACK: ::c_int = 0x08000000; -pub const SA_SIGINFO: ::c_int = 0x00000004; -pub const SA_NOCLDWAIT: ::c_int = 0x00000002; - -pub const SIGCHLD: ::c_int = 17; -pub const SIGBUS: ::c_int = 7; -pub const SIGTTIN: ::c_int = 21; -pub const SIGTTOU: ::c_int = 22; -pub const SIGXCPU: ::c_int = 24; -pub const SIGXFSZ: ::c_int = 25; -pub const SIGVTALRM: ::c_int = 26; -pub const SIGPROF: ::c_int = 27; -pub const SIGWINCH: ::c_int = 28; -pub const SIGUSR1: ::c_int = 10; -pub const SIGUSR2: ::c_int = 12; -pub const SIGCONT: ::c_int = 18; -pub const SIGSTOP: ::c_int = 19; -pub const SIGTSTP: ::c_int = 20; -pub const SIGURG: ::c_int = 23; -pub const SIGIO: ::c_int = 29; -pub const SIGSYS: ::c_int = 31; -pub const SIGSTKFLT: ::c_int = 16; -pub const SIGPOLL: ::c_int = 29; -pub const SIGPWR: ::c_int = 30; -pub const SIG_SETMASK: ::c_int = 2; -pub const SIG_BLOCK: ::c_int = 0x000000; -pub const SIG_UNBLOCK: ::c_int = 0x01; - -pub const MAP_HUGETLB: ::c_int = 0x040000; - -pub const F_GETLK: ::c_int = 5; -pub const F_GETOWN: ::c_int = 9; -pub const F_SETLK: ::c_int = 6; -pub const F_SETLKW: ::c_int = 7; -pub const F_SETOWN: ::c_int = 8; - -pub const VEOF: usize = 4; - -pub const POLLWRNORM: ::c_short = 0x100; -pub const POLLWRBAND: ::c_short = 0x200; - -cfg_if! { - if #[cfg(target_arch = "aarch64")] { - mod aarch64; - pub use self::aarch64::*; - } else if #[cfg(any(target_arch = "powerpc64"))] { - mod powerpc64; - pub use self::powerpc64::*; - } else if #[cfg(any(target_arch = "x86_64"))] { - mod x86_64; - pub use self::x86_64::*; - } else { - // Unknown target_arch - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,575 +0,0 @@ -pub type c_char = u8; -pub type wchar_t = i32; -pub type __u64 = ::c_ulong; -pub type nlink_t = u64; -pub type blksize_t = ::c_long; - -s! { - pub struct stat { - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_nlink: ::nlink_t, - pub st_mode: ::mode_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - __pad0: ::c_int, - pub st_rdev: ::dev_t, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - __unused: [::c_long; 3], - } - - pub struct stat64 { - pub st_dev: ::dev_t, - pub st_ino: ::ino64_t, - pub st_nlink: ::nlink_t, - pub st_mode: ::mode_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - __pad0: ::c_int, - pub st_rdev: ::dev_t, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt64_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - __reserved: [::c_long; 3], - } - - pub struct ipc_perm { - pub __ipc_perm_key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::mode_t, - pub __seq: ::c_int, - __unused1: ::c_long, - __unused2: ::c_long - } -} - -pub const MAP_32BIT: ::c_int = 0x0040; -pub const O_DIRECT: ::c_int = 0x20000; -pub const O_DIRECTORY: ::c_int = 0x4000; -pub const O_LARGEFILE: ::c_int = 0x10000; -pub const O_NOFOLLOW: ::c_int = 0x8000; - -pub const SIGSTKSZ: ::size_t = 10240; -pub const MINSIGSTKSZ: ::size_t = 4096; - -#[doc(hidden)] -pub const AF_MAX: ::c_int = 43; -#[doc(hidden)] -pub const PF_MAX: ::c_int = AF_MAX; - -// Syscall table -pub const SYS_restart_syscall: ::c_long = 0; -pub const SYS_exit: ::c_long = 1; -pub const SYS_fork: ::c_long = 2; -pub const SYS_read: ::c_long = 3; -pub const SYS_write: ::c_long = 4; -pub const SYS_open: ::c_long = 5; -pub const SYS_close: ::c_long = 6; -pub const SYS_waitpid: ::c_long = 7; -pub const SYS_creat: ::c_long = 8; -pub const SYS_link: ::c_long = 9; -pub const SYS_unlink: ::c_long = 10; -pub const SYS_execve: ::c_long = 11; -pub const SYS_chdir: ::c_long = 12; -pub const SYS_time: ::c_long = 13; -pub const SYS_mknod: ::c_long = 14; -pub const SYS_chmod: ::c_long = 15; -pub const SYS_lchown: ::c_long = 16; -pub const SYS_break: ::c_long = 17; -pub const SYS_oldstat: ::c_long = 18; -pub const SYS_lseek: ::c_long = 19; -pub const SYS_getpid: ::c_long = 20; -pub const SYS_mount: ::c_long = 21; -pub const SYS_umount: ::c_long = 22; -pub const SYS_setuid: ::c_long = 23; -pub const SYS_getuid: ::c_long = 24; -pub const SYS_stime: ::c_long = 25; -pub const SYS_ptrace: ::c_long = 26; -pub const SYS_alarm: ::c_long = 27; -pub const SYS_oldfstat: ::c_long = 28; -pub const SYS_pause: ::c_long = 29; -pub const SYS_utime: ::c_long = 30; -pub const SYS_stty: ::c_long = 31; -pub const SYS_gtty: ::c_long = 32; -pub const SYS_access: ::c_long = 33; -pub const SYS_nice: ::c_long = 34; -pub const SYS_ftime: ::c_long = 35; -pub const SYS_sync: ::c_long = 36; -pub const SYS_kill: ::c_long = 37; -pub const SYS_rename: ::c_long = 38; -pub const SYS_mkdir: ::c_long = 39; -pub const SYS_rmdir: ::c_long = 40; -pub const SYS_dup: ::c_long = 41; -pub const SYS_pipe: ::c_long = 42; -pub const SYS_times: ::c_long = 43; -pub const SYS_prof: ::c_long = 44; -pub const SYS_brk: ::c_long = 45; -pub const SYS_setgid: ::c_long = 46; -pub const SYS_getgid: ::c_long = 47; -pub const SYS_signal: ::c_long = 48; -pub const SYS_geteuid: ::c_long = 49; -pub const SYS_getegid: ::c_long = 50; -pub const SYS_acct: ::c_long = 51; -pub const SYS_umount2: ::c_long = 52; -pub const SYS_lock: ::c_long = 53; -pub const SYS_ioctl: ::c_long = 54; -pub const SYS_fcntl: ::c_long = 55; -pub const SYS_mpx: ::c_long = 56; -pub const SYS_setpgid: ::c_long = 57; -pub const SYS_ulimit: ::c_long = 58; -pub const SYS_oldolduname: ::c_long = 59; -pub const SYS_umask: ::c_long = 60; -pub const SYS_chroot: ::c_long = 61; -pub const SYS_ustat: ::c_long = 62; -pub const SYS_dup2: ::c_long = 63; -pub const SYS_getppid: ::c_long = 64; -pub const SYS_getpgrp: ::c_long = 65; -pub const SYS_setsid: ::c_long = 66; -pub const SYS_sigaction: ::c_long = 67; -pub const SYS_sgetmask: ::c_long = 68; -pub const SYS_ssetmask: ::c_long = 69; -pub const SYS_setreuid: ::c_long = 70; -pub const SYS_setregid: ::c_long = 71; -pub const SYS_sigsuspend: ::c_long = 72; -pub const SYS_sigpending: ::c_long = 73; -pub const SYS_sethostname: ::c_long = 74; -pub const SYS_setrlimit: ::c_long = 75; -pub const SYS_getrlimit: ::c_long = 76; -pub const SYS_getrusage: ::c_long = 77; -pub const SYS_gettimeofday: ::c_long = 78; -pub const SYS_settimeofday: ::c_long = 79; -pub const SYS_getgroups: ::c_long = 80; -pub const SYS_setgroups: ::c_long = 81; -pub const SYS_select: ::c_long = 82; -pub const SYS_symlink: ::c_long = 83; -pub const SYS_oldlstat: ::c_long = 84; -pub const SYS_readlink: ::c_long = 85; -pub const SYS_uselib: ::c_long = 86; -pub const SYS_swapon: ::c_long = 87; -pub const SYS_reboot: ::c_long = 88; -pub const SYS_readdir: ::c_long = 89; -pub const SYS_mmap: ::c_long = 90; -pub const SYS_munmap: ::c_long = 91; -pub const SYS_truncate: ::c_long = 92; -pub const SYS_ftruncate: ::c_long = 93; -pub const SYS_fchmod: ::c_long = 94; -pub const SYS_fchown: ::c_long = 95; -pub const SYS_getpriority: ::c_long = 96; -pub const SYS_setpriority: ::c_long = 97; -pub const SYS_profil: ::c_long = 98; -pub const SYS_statfs: ::c_long = 99; -pub const SYS_fstatfs: ::c_long = 100; -pub const SYS_ioperm: ::c_long = 101; -pub const SYS_socketcall: ::c_long = 102; -pub const SYS_syslog: ::c_long = 103; -pub const SYS_setitimer: ::c_long = 104; -pub const SYS_getitimer: ::c_long = 105; -pub const SYS_stat: ::c_long = 106; -pub const SYS_lstat: ::c_long = 107; -pub const SYS_fstat: ::c_long = 108; -pub const SYS_olduname: ::c_long = 109; -pub const SYS_iopl: ::c_long = 110; -pub const SYS_vhangup: ::c_long = 111; -pub const SYS_idle: ::c_long = 112; -pub const SYS_vm86: ::c_long = 113; -pub const SYS_wait4: ::c_long = 114; -pub const SYS_swapoff: ::c_long = 115; -pub const SYS_sysinfo: ::c_long = 116; -pub const SYS_ipc: ::c_long = 117; -pub const SYS_fsync: ::c_long = 118; -pub const SYS_sigreturn: ::c_long = 119; -pub const SYS_clone: ::c_long = 120; -pub const SYS_setdomainname: ::c_long = 121; -pub const SYS_uname: ::c_long = 122; -pub const SYS_modify_ldt: ::c_long = 123; -pub const SYS_adjtimex: ::c_long = 124; -pub const SYS_mprotect: ::c_long = 125; -pub const SYS_sigprocmask: ::c_long = 126; -pub const SYS_create_module: ::c_long = 127; -pub const SYS_init_module: ::c_long = 128; -pub const SYS_delete_module: ::c_long = 129; -pub const SYS_get_kernel_syms: ::c_long = 130; -pub const SYS_quotactl: ::c_long = 131; -pub const SYS_getpgid: ::c_long = 132; -pub const SYS_fchdir: ::c_long = 133; -pub const SYS_bdflush: ::c_long = 134; -pub const SYS_sysfs: ::c_long = 135; -pub const SYS_personality: ::c_long = 136; -pub const SYS_afs_syscall: ::c_long = 137; /* Syscall for Andrew File System */ -pub const SYS_setfsuid: ::c_long = 138; -pub const SYS_setfsgid: ::c_long = 139; -pub const SYS__llseek: ::c_long = 140; -pub const SYS_getdents: ::c_long = 141; -pub const SYS__newselect: ::c_long = 142; -pub const SYS_flock: ::c_long = 143; -pub const SYS_msync: ::c_long = 144; -pub const SYS_readv: ::c_long = 145; -pub const SYS_writev: ::c_long = 146; -pub const SYS_getsid: ::c_long = 147; -pub const SYS_fdatasync: ::c_long = 148; -pub const SYS__sysctl: ::c_long = 149; -pub const SYS_mlock: ::c_long = 150; -pub const SYS_munlock: ::c_long = 151; -pub const SYS_mlockall: ::c_long = 152; -pub const SYS_munlockall: ::c_long = 153; -pub const SYS_sched_setparam: ::c_long = 154; -pub const SYS_sched_getparam: ::c_long = 155; -pub const SYS_sched_setscheduler: ::c_long = 156; -pub const SYS_sched_getscheduler: ::c_long = 157; -pub const SYS_sched_yield: ::c_long = 158; -pub const SYS_sched_get_priority_max: ::c_long = 159; -pub const SYS_sched_get_priority_min: ::c_long = 160; -pub const SYS_sched_rr_get_interval: ::c_long = 161; -pub const SYS_nanosleep: ::c_long = 162; -pub const SYS_mremap: ::c_long = 163; -pub const SYS_setresuid: ::c_long = 164; -pub const SYS_getresuid: ::c_long = 165; -pub const SYS_query_module: ::c_long = 166; -pub const SYS_poll: ::c_long = 167; -pub const SYS_nfsservctl: ::c_long = 168; -pub const SYS_setresgid: ::c_long = 169; -pub const SYS_getresgid: ::c_long = 170; -pub const SYS_prctl: ::c_long = 171; -pub const SYS_rt_sigreturn: ::c_long = 172; -pub const SYS_rt_sigaction: ::c_long = 173; -pub const SYS_rt_sigprocmask: ::c_long = 174; -pub const SYS_rt_sigpending: ::c_long = 175; -pub const SYS_rt_sigtimedwait: ::c_long = 176; -pub const SYS_rt_sigqueueinfo: ::c_long = 177; -pub const SYS_rt_sigsuspend: ::c_long = 178; -pub const SYS_pread64: ::c_long = 179; -pub const SYS_pwrite64: ::c_long = 180; -pub const SYS_chown: ::c_long = 181; -pub const SYS_getcwd: ::c_long = 182; -pub const SYS_capget: ::c_long = 183; -pub const SYS_capset: ::c_long = 184; -pub const SYS_sigaltstack: ::c_long = 185; -pub const SYS_sendfile: ::c_long = 186; -pub const SYS_getpmsg: ::c_long = 187; /* some people actually want streams */ -pub const SYS_putpmsg: ::c_long = 188; /* some people actually want streams */ -pub const SYS_vfork: ::c_long = 189; -pub const SYS_ugetrlimit: ::c_long = 190; /* SuS compliant getrlimit */ -pub const SYS_readahead: ::c_long = 191; -pub const SYS_pciconfig_read: ::c_long = 198; -pub const SYS_pciconfig_write: ::c_long = 199; -pub const SYS_pciconfig_iobase: ::c_long = 200; -pub const SYS_multiplexer: ::c_long = 201; -pub const SYS_getdents64: ::c_long = 202; -pub const SYS_pivot_root: ::c_long = 203; -pub const SYS_madvise: ::c_long = 205; -pub const SYS_mincore: ::c_long = 206; -pub const SYS_gettid: ::c_long = 207; -pub const SYS_tkill: ::c_long = 208; -pub const SYS_setxattr: ::c_long = 209; -pub const SYS_lsetxattr: ::c_long = 210; -pub const SYS_fsetxattr: ::c_long = 211; -pub const SYS_getxattr: ::c_long = 212; -pub const SYS_lgetxattr: ::c_long = 213; -pub const SYS_fgetxattr: ::c_long = 214; -pub const SYS_listxattr: ::c_long = 215; -pub const SYS_llistxattr: ::c_long = 216; -pub const SYS_flistxattr: ::c_long = 217; -pub const SYS_removexattr: ::c_long = 218; -pub const SYS_lremovexattr: ::c_long = 219; -pub const SYS_fremovexattr: ::c_long = 220; -pub const SYS_futex: ::c_long = 221; -pub const SYS_sched_setaffinity: ::c_long = 222; -pub const SYS_sched_getaffinity: ::c_long = 223; -pub const SYS_tuxcall: ::c_long = 225; -pub const SYS_io_setup: ::c_long = 227; -pub const SYS_io_destroy: ::c_long = 228; -pub const SYS_io_getevents: ::c_long = 229; -pub const SYS_io_submit: ::c_long = 230; -pub const SYS_io_cancel: ::c_long = 231; -pub const SYS_set_tid_address: ::c_long = 232; -pub const SYS_exit_group: ::c_long = 234; -pub const SYS_lookup_dcookie: ::c_long = 235; -pub const SYS_epoll_create: ::c_long = 236; -pub const SYS_epoll_ctl: ::c_long = 237; -pub const SYS_epoll_wait: ::c_long = 238; -pub const SYS_remap_file_pages: ::c_long = 239; -pub const SYS_timer_create: ::c_long = 240; -pub const SYS_timer_settime: ::c_long = 241; -pub const SYS_timer_gettime: ::c_long = 242; -pub const SYS_timer_getoverrun: ::c_long = 243; -pub const SYS_timer_delete: ::c_long = 244; -pub const SYS_clock_settime: ::c_long = 245; -pub const SYS_clock_gettime: ::c_long = 246; -pub const SYS_clock_getres: ::c_long = 247; -pub const SYS_clock_nanosleep: ::c_long = 248; -pub const SYS_swapcontext: ::c_long = 249; -pub const SYS_tgkill: ::c_long = 250; -pub const SYS_utimes: ::c_long = 251; -pub const SYS_statfs64: ::c_long = 252; -pub const SYS_fstatfs64: ::c_long = 253; -pub const SYS_rtas: ::c_long = 255; -pub const SYS_sys_debug_setcontext: ::c_long = 256; -pub const SYS_migrate_pages: ::c_long = 258; -pub const SYS_mbind: ::c_long = 259; -pub const SYS_get_mempolicy: ::c_long = 260; -pub const SYS_set_mempolicy: ::c_long = 261; -pub const SYS_mq_open: ::c_long = 262; -pub const SYS_mq_unlink: ::c_long = 263; -pub const SYS_mq_timedsend: ::c_long = 264; -pub const SYS_mq_timedreceive: ::c_long = 265; -pub const SYS_mq_notify: ::c_long = 266; -pub const SYS_mq_getsetattr: ::c_long = 267; -pub const SYS_kexec_load: ::c_long = 268; -pub const SYS_add_key: ::c_long = 269; -pub const SYS_request_key: ::c_long = 270; -pub const SYS_keyctl: ::c_long = 271; -pub const SYS_waitid: ::c_long = 272; -pub const SYS_ioprio_set: ::c_long = 273; -pub const SYS_ioprio_get: ::c_long = 274; -pub const SYS_inotify_init: ::c_long = 275; -pub const SYS_inotify_add_watch: ::c_long = 276; -pub const SYS_inotify_rm_watch: ::c_long = 277; -pub const SYS_spu_run: ::c_long = 278; -pub const SYS_spu_create: ::c_long = 279; -pub const SYS_pselect6: ::c_long = 280; -pub const SYS_ppoll: ::c_long = 281; -pub const SYS_unshare: ::c_long = 282; -pub const SYS_splice: ::c_long = 283; -pub const SYS_tee: ::c_long = 284; -pub const SYS_vmsplice: ::c_long = 285; -pub const SYS_openat: ::c_long = 286; -pub const SYS_mkdirat: ::c_long = 287; -pub const SYS_mknodat: ::c_long = 288; -pub const SYS_fchownat: ::c_long = 289; -pub const SYS_futimesat: ::c_long = 290; -pub const SYS_newfstatat: ::c_long = 291; -pub const SYS_unlinkat: ::c_long = 292; -pub const SYS_renameat: ::c_long = 293; -pub const SYS_linkat: ::c_long = 294; -pub const SYS_symlinkat: ::c_long = 295; -pub const SYS_readlinkat: ::c_long = 296; -pub const SYS_fchmodat: ::c_long = 297; -pub const SYS_faccessat: ::c_long = 298; -pub const SYS_get_robust_list: ::c_long = 299; -pub const SYS_set_robust_list: ::c_long = 300; -pub const SYS_move_pages: ::c_long = 301; -pub const SYS_getcpu: ::c_long = 302; -pub const SYS_epoll_pwait: ::c_long = 303; -pub const SYS_utimensat: ::c_long = 304; -pub const SYS_signalfd: ::c_long = 305; -pub const SYS_timerfd_create: ::c_long = 306; -pub const SYS_eventfd: ::c_long = 307; -pub const SYS_sync_file_range2: ::c_long = 308; -pub const SYS_fallocate: ::c_long = 309; -pub const SYS_subpage_prot: ::c_long = 310; -pub const SYS_timerfd_settime: ::c_long = 311; -pub const SYS_timerfd_gettime: ::c_long = 312; -pub const SYS_signalfd4: ::c_long = 313; -pub const SYS_eventfd2: ::c_long = 314; -pub const SYS_epoll_create1: ::c_long = 315; -pub const SYS_dup3: ::c_long = 316; -pub const SYS_pipe2: ::c_long = 317; -pub const SYS_inotify_init1: ::c_long = 318; -pub const SYS_perf_event_open: ::c_long = 319; -pub const SYS_preadv: ::c_long = 320; -pub const SYS_pwritev: ::c_long = 321; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 322; -pub const SYS_fanotify_init: ::c_long = 323; -pub const SYS_fanotify_mark: ::c_long = 324; -pub const SYS_prlimit64: ::c_long = 325; -pub const SYS_socket: ::c_long = 326; -pub const SYS_bind: ::c_long = 327; -pub const SYS_connect: ::c_long = 328; -pub const SYS_listen: ::c_long = 329; -pub const SYS_accept: ::c_long = 330; -pub const SYS_getsockname: ::c_long = 331; -pub const SYS_getpeername: ::c_long = 332; -pub const SYS_socketpair: ::c_long = 333; -pub const SYS_send: ::c_long = 334; -pub const SYS_sendto: ::c_long = 335; -pub const SYS_recv: ::c_long = 336; -pub const SYS_recvfrom: ::c_long = 337; -pub const SYS_shutdown: ::c_long = 338; -pub const SYS_setsockopt: ::c_long = 339; -pub const SYS_getsockopt: ::c_long = 340; -pub const SYS_sendmsg: ::c_long = 341; -pub const SYS_recvmsg: ::c_long = 342; -pub const SYS_recvmmsg: ::c_long = 343; -pub const SYS_accept4: ::c_long = 344; -pub const SYS_name_to_handle_at: ::c_long = 345; -pub const SYS_open_by_handle_at: ::c_long = 346; -pub const SYS_clock_adjtime: ::c_long = 347; -pub const SYS_syncfs: ::c_long = 348; -pub const SYS_sendmmsg: ::c_long = 349; -pub const SYS_setns: ::c_long = 350; -pub const SYS_process_vm_readv: ::c_long = 351; -pub const SYS_process_vm_writev: ::c_long = 352; -pub const SYS_finit_module: ::c_long = 353; -pub const SYS_kcmp: ::c_long = 354; -pub const SYS_sched_setattr: ::c_long = 355; -pub const SYS_sched_getattr: ::c_long = 356; -pub const SYS_renameat2: ::c_long = 357; -pub const SYS_seccomp: ::c_long = 358; -pub const SYS_getrandom: ::c_long = 359; -pub const SYS_memfd_create: ::c_long = 360; -pub const SYS_bpf: ::c_long = 361; -pub const SYS_execveat: ::c_long = 362; -pub const SYS_switch_endian: ::c_long = 363; -pub const SYS_userfaultfd: ::c_long = 364; -pub const SYS_membarrier: ::c_long = 365; -pub const SYS_mlock2: ::c_long = 378; -pub const SYS_copy_file_range: ::c_long = 379; -pub const SYS_preadv2: ::c_long = 380; -pub const SYS_pwritev2: ::c_long = 381; -pub const SYS_kexec_file_load: ::c_long = 382; - -pub const FIOCLEX: ::c_int = 0x20006601; -pub const FIONBIO: ::c_int = 0x8004667e; -pub const EDEADLK: ::c_int = 58; -pub const EDEADLOCK: ::c_int = EDEADLK; -pub const SO_PASSCRED: ::c_int = 20; -pub const SO_PEERCRED: ::c_int = 21; -pub const SO_RCVLOWAT: ::c_int = 16; -pub const SO_SNDLOWAT: ::c_int = 17; -pub const SO_RCVTIMEO: ::c_int = 18; -pub const SO_SNDTIMEO: ::c_int = 19; -pub const EXTPROC: ::tcflag_t = 0x10000000; -pub const VEOL: usize = 6; -pub const VEOL2: usize = 8; -pub const VMIN: usize = 5; -pub const IEXTEN: ::tcflag_t = 0x00000400; -pub const TOSTOP: ::tcflag_t = 0x00400000; -pub const FLUSHO: ::tcflag_t = 0x00800000; -pub const TCGETS: ::c_int = 0x403c7413; -pub const TCSETS: ::c_int = 0x803c7414; -pub const TCSETSW: ::c_int = 0x803c7415; -pub const TCSETSF: ::c_int = 0x803c7416; -pub const TCGETA: ::c_int = 0x40147417; -pub const TCSETA: ::c_int = 0x80147418; -pub const TCSETAW: ::c_int = 0x80147419; -pub const TCSETAF: ::c_int = 0x8014741c; -pub const TCSBRK: ::c_int = 0x2000741d; -pub const TCXONC: ::c_int = 0x2000741e; -pub const TCFLSH: ::c_int = 0x2000741f; -pub const TIOCGSOFTCAR: ::c_int = 0x5419; -pub const TIOCSSOFTCAR: ::c_int = 0x541A; -pub const TIOCLINUX: ::c_int = 0x541C; -pub const TIOCGSERIAL: ::c_int = 0x541E; -pub const TIOCEXCL: ::c_int = 0x540C; -pub const TIOCNXCL: ::c_int = 0x540D; -pub const TIOCSCTTY: ::c_int = 0x540E; -pub const TIOCGPGRP: ::c_int = 0x40047477; -pub const TIOCSPGRP: ::c_int = 0x80047476; -pub const TIOCOUTQ: ::c_int = 0x40047473; -pub const TIOCGWINSZ: ::c_int = 0x40087468; -pub const TIOCSWINSZ: ::c_int = 0x80087467; -pub const TIOCMGET: ::c_int = 0x5415; -pub const TIOCMBIS: ::c_int = 0x5416; -pub const TIOCMBIC: ::c_int = 0x5417; -pub const TIOCMSET: ::c_int = 0x5418; -pub const FIONREAD: ::c_int = 0x4004667f; -pub const TIOCCONS: ::c_int = 0x541D; -pub const TIOCM_LE: ::c_int = 0x001; -pub const TIOCM_DTR: ::c_int = 0x002; -pub const TIOCM_RTS: ::c_int = 0x004; -pub const TIOCM_ST: ::c_int = 0x008; -pub const TIOCM_SR: ::c_int = 0x010; -pub const TIOCM_CTS: ::c_int = 0x020; -pub const TIOCM_CAR: ::c_int = 0x040; -pub const TIOCM_RNG: ::c_int = 0x080; -pub const TIOCM_DSR: ::c_int = 0x100; -pub const TIOCM_CD: ::c_int = TIOCM_CAR; -pub const TIOCM_RI: ::c_int = TIOCM_RNG; - -pub const TIOCGRS485: ::c_int = 0x542E; -pub const TIOCSRS485: ::c_int = 0x542F; - -pub const RLIMIT_NLIMITS: ::c_int = 15; -pub const TIOCINQ: ::c_int = ::FIONREAD; -pub const MCL_CURRENT: ::c_int = 0x2000; -pub const MCL_FUTURE: ::c_int = 0x4000; -pub const CBAUD: ::tcflag_t = 0xff; -pub const TAB1: ::c_int = 0x400; -pub const TAB2: ::c_int = 0x800; -pub const TAB3: ::c_int = 0xc00; -pub const CR1: ::c_int = 0x1000; -pub const CR2: ::c_int = 0x2000; -pub const CR3: ::c_int = 0x3000; -pub const FF1: ::c_int = 0x4000; -pub const BS1: ::c_int = 0x8000; -pub const VT1: ::c_int = 0x10000; -pub const VWERASE: usize = 10; -pub const VREPRINT: usize = 11; -pub const VSUSP: usize = 12; -pub const VSTART: usize = 13; -pub const VSTOP: usize = 14; -pub const VDISCARD: usize = 16; -pub const VTIME: usize = 7; -pub const IXON: ::tcflag_t = 0x00000200; -pub const IXOFF: ::tcflag_t = 0x00000400; -pub const ONLCR: ::tcflag_t = 0x2; -pub const CSIZE: ::tcflag_t = 0x00000300; - -pub const CS6: ::tcflag_t = 0x00000100; -pub const CS7: ::tcflag_t = 0x00000200; -pub const CS8: ::tcflag_t = 0x00000300; -pub const CSTOPB: ::tcflag_t = 0x00000400; -pub const CREAD: ::tcflag_t = 0x00000800; -pub const PARENB: ::tcflag_t = 0x00001000; -pub const PARODD: ::tcflag_t = 0x00002000; -pub const HUPCL: ::tcflag_t = 0x00004000; -pub const CLOCAL: ::tcflag_t = 0x00008000; -pub const ECHOKE: ::tcflag_t = 0x00000001; -pub const ECHOE: ::tcflag_t = 0x00000002; -pub const ECHOK: ::tcflag_t = 0x00000004; -pub const ECHONL: ::tcflag_t = 0x00000010; -pub const ECHOPRT: ::tcflag_t = 0x00000020; -pub const ECHOCTL: ::tcflag_t = 0x00000040; -pub const ISIG: ::tcflag_t = 0x00000080; -pub const ICANON: ::tcflag_t = 0x00000100; -pub const PENDIN: ::tcflag_t = 0x20000000; -pub const NOFLSH: ::tcflag_t = 0x80000000; - -pub const CIBAUD: ::tcflag_t = 0o77600000; -pub const CBAUDEX: ::tcflag_t = 0o0000020; -pub const VSWTC: usize = 9; -pub const OLCUC: ::tcflag_t = 0o000004; -pub const NLDLY: ::tcflag_t = 0o0001400; -pub const CRDLY: ::tcflag_t = 0o0030000; -pub const TABDLY: ::tcflag_t = 0o0006000; -pub const BSDLY: ::tcflag_t = 0o0100000; -pub const FFDLY: ::tcflag_t = 0o0040000; -pub const VTDLY: ::tcflag_t = 0o0200000; -pub const XTABS: ::tcflag_t = 0o00006000; - -pub const B57600: ::speed_t = 0o00020; -pub const B115200: ::speed_t = 0o00021; -pub const B230400: ::speed_t = 0o00022; -pub const B460800: ::speed_t = 0o00023; -pub const B500000: ::speed_t = 0o00024; -pub const B576000: ::speed_t = 0o00025; -pub const B921600: ::speed_t = 0o00026; -pub const B1000000: ::speed_t = 0o00027; -pub const B1152000: ::speed_t = 0o00030; -pub const B1500000: ::speed_t = 0o00031; -pub const B2000000: ::speed_t = 0o00032; -pub const B2500000: ::speed_t = 0o00033; -pub const B3000000: ::speed_t = 0o00034; -pub const B3500000: ::speed_t = 0o00035; -pub const B4000000: ::speed_t = 0o00036; - -extern { - pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/b64/x86_64.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/b64/x86_64.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/b64/x86_64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/b64/x86_64.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,634 +0,0 @@ -pub type c_char = i8; -pub type wchar_t = i32; -pub type nlink_t = u64; -pub type blksize_t = ::c_long; -pub type __u64 = ::c_ulonglong; - -s! { - pub struct stat { - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_nlink: ::nlink_t, - pub st_mode: ::mode_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - __pad0: ::c_int, - pub st_rdev: ::dev_t, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - __unused: [::c_long; 3], - } - - pub struct stat64 { - pub st_dev: ::dev_t, - pub st_ino: ::ino64_t, - pub st_nlink: ::nlink_t, - pub st_mode: ::mode_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - __pad0: ::c_int, - pub st_rdev: ::dev_t, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt64_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - __reserved: [::c_long; 3], - } - - pub struct mcontext_t { - __private: [u64; 32], - } - - pub struct ipc_perm { - pub __ipc_perm_key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::mode_t, - pub __seq: ::c_int, - __unused1: ::c_long, - __unused2: ::c_long - } -} - -s_no_extra_traits!{ - pub struct ucontext_t { - pub uc_flags: ::c_ulong, - pub uc_link: *mut ucontext_t, - pub uc_stack: ::stack_t, - pub uc_mcontext: mcontext_t, - pub uc_sigmask: ::sigset_t, - __private: [u8; 512], - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for ucontext_t { - fn eq(&self, other: &ucontext_t) -> bool { - self.uc_flags == other.uc_flags - && self.uc_link == other.uc_link - && self.uc_stack == other.uc_stack - && self.uc_mcontext == other.uc_mcontext - && self.uc_sigmask == other.uc_sigmask - && self - .__private - .iter() - .zip(other.__private.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for ucontext_t {} - - impl ::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ucontext_t") - .field("uc_flags", &self.uc_flags) - .field("uc_link", &self.uc_link) - .field("uc_stack", &self.uc_stack) - .field("uc_mcontext", &self.uc_mcontext) - .field("uc_sigmask", &self.uc_sigmask) - // Ignore __private field - .finish() - } - } - - impl ::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { - self.uc_flags.hash(state); - self.uc_link.hash(state); - self.uc_stack.hash(state); - self.uc_mcontext.hash(state); - self.uc_sigmask.hash(state); - self.__private.hash(state); - } - } - } -} - -// Syscall table - -pub const SYS_read: ::c_long = 0; -pub const SYS_write: ::c_long = 1; -pub const SYS_open: ::c_long = 2; -pub const SYS_close: ::c_long = 3; -pub const SYS_stat: ::c_long = 4; -pub const SYS_fstat: ::c_long = 5; -pub const SYS_lstat: ::c_long = 6; -pub const SYS_poll: ::c_long = 7; -pub const SYS_lseek: ::c_long = 8; -pub const SYS_mmap: ::c_long = 9; -pub const SYS_mprotect: ::c_long = 10; -pub const SYS_munmap: ::c_long = 11; -pub const SYS_brk: ::c_long = 12; -pub const SYS_rt_sigaction: ::c_long = 13; -pub const SYS_rt_sigprocmask: ::c_long = 14; -pub const SYS_rt_sigreturn: ::c_long = 15; -pub const SYS_ioctl: ::c_long = 16; -pub const SYS_pread64: ::c_long = 17; -pub const SYS_pwrite64: ::c_long = 18; -pub const SYS_readv: ::c_long = 19; -pub const SYS_writev: ::c_long = 20; -pub const SYS_access: ::c_long = 21; -pub const SYS_pipe: ::c_long = 22; -pub const SYS_select: ::c_long = 23; -pub const SYS_sched_yield: ::c_long = 24; -pub const SYS_mremap: ::c_long = 25; -pub const SYS_msync: ::c_long = 26; -pub const SYS_mincore: ::c_long = 27; -pub const SYS_madvise: ::c_long = 28; -pub const SYS_shmget: ::c_long = 29; -pub const SYS_shmat: ::c_long = 30; -pub const SYS_shmctl: ::c_long = 31; -pub const SYS_dup: ::c_long = 32; -pub const SYS_dup2: ::c_long = 33; -pub const SYS_pause: ::c_long = 34; -pub const SYS_nanosleep: ::c_long = 35; -pub const SYS_getitimer: ::c_long = 36; -pub const SYS_alarm: ::c_long = 37; -pub const SYS_setitimer: ::c_long = 38; -pub const SYS_getpid: ::c_long = 39; -pub const SYS_sendfile: ::c_long = 40; -pub const SYS_socket: ::c_long = 41; -pub const SYS_connect: ::c_long = 42; -pub const SYS_accept: ::c_long = 43; -pub const SYS_sendto: ::c_long = 44; -pub const SYS_recvfrom: ::c_long = 45; -pub const SYS_sendmsg: ::c_long = 46; -pub const SYS_recvmsg: ::c_long = 47; -pub const SYS_shutdown: ::c_long = 48; -pub const SYS_bind: ::c_long = 49; -pub const SYS_listen: ::c_long = 50; -pub const SYS_getsockname: ::c_long = 51; -pub const SYS_getpeername: ::c_long = 52; -pub const SYS_socketpair: ::c_long = 53; -pub const SYS_setsockopt: ::c_long = 54; -pub const SYS_getsockopt: ::c_long = 55; -pub const SYS_clone: ::c_long = 56; -pub const SYS_fork: ::c_long = 57; -pub const SYS_vfork: ::c_long = 58; -pub const SYS_execve: ::c_long = 59; -pub const SYS_exit: ::c_long = 60; -pub const SYS_wait4: ::c_long = 61; -pub const SYS_kill: ::c_long = 62; -pub const SYS_uname: ::c_long = 63; -pub const SYS_semget: ::c_long = 64; -pub const SYS_semop: ::c_long = 65; -pub const SYS_semctl: ::c_long = 66; -pub const SYS_shmdt: ::c_long = 67; -pub const SYS_msgget: ::c_long = 68; -pub const SYS_msgsnd: ::c_long = 69; -pub const SYS_msgrcv: ::c_long = 70; -pub const SYS_msgctl: ::c_long = 71; -pub const SYS_fcntl: ::c_long = 72; -pub const SYS_flock: ::c_long = 73; -pub const SYS_fsync: ::c_long = 74; -pub const SYS_fdatasync: ::c_long = 75; -pub const SYS_truncate: ::c_long = 76; -pub const SYS_ftruncate: ::c_long = 77; -pub const SYS_getdents: ::c_long = 78; -pub const SYS_getcwd: ::c_long = 79; -pub const SYS_chdir: ::c_long = 80; -pub const SYS_fchdir: ::c_long = 81; -pub const SYS_rename: ::c_long = 82; -pub const SYS_mkdir: ::c_long = 83; -pub const SYS_rmdir: ::c_long = 84; -pub const SYS_creat: ::c_long = 85; -pub const SYS_link: ::c_long = 86; -pub const SYS_unlink: ::c_long = 87; -pub const SYS_symlink: ::c_long = 88; -pub const SYS_readlink: ::c_long = 89; -pub const SYS_chmod: ::c_long = 90; -pub const SYS_fchmod: ::c_long = 91; -pub const SYS_chown: ::c_long = 92; -pub const SYS_fchown: ::c_long = 93; -pub const SYS_lchown: ::c_long = 94; -pub const SYS_umask: ::c_long = 95; -pub const SYS_gettimeofday: ::c_long = 96; -pub const SYS_getrlimit: ::c_long = 97; -pub const SYS_getrusage: ::c_long = 98; -pub const SYS_sysinfo: ::c_long = 99; -pub const SYS_times: ::c_long = 100; -pub const SYS_ptrace: ::c_long = 101; -pub const SYS_getuid: ::c_long = 102; -pub const SYS_syslog: ::c_long = 103; -pub const SYS_getgid: ::c_long = 104; -pub const SYS_setuid: ::c_long = 105; -pub const SYS_setgid: ::c_long = 106; -pub const SYS_geteuid: ::c_long = 107; -pub const SYS_getegid: ::c_long = 108; -pub const SYS_setpgid: ::c_long = 109; -pub const SYS_getppid: ::c_long = 110; -pub const SYS_getpgrp: ::c_long = 111; -pub const SYS_setsid: ::c_long = 112; -pub const SYS_setreuid: ::c_long = 113; -pub const SYS_setregid: ::c_long = 114; -pub const SYS_getgroups: ::c_long = 115; -pub const SYS_setgroups: ::c_long = 116; -pub const SYS_setresuid: ::c_long = 117; -pub const SYS_getresuid: ::c_long = 118; -pub const SYS_setresgid: ::c_long = 119; -pub const SYS_getresgid: ::c_long = 120; -pub const SYS_getpgid: ::c_long = 121; -pub const SYS_setfsuid: ::c_long = 122; -pub const SYS_setfsgid: ::c_long = 123; -pub const SYS_getsid: ::c_long = 124; -pub const SYS_capget: ::c_long = 125; -pub const SYS_capset: ::c_long = 126; -pub const SYS_rt_sigpending: ::c_long = 127; -pub const SYS_rt_sigtimedwait: ::c_long = 128; -pub const SYS_rt_sigqueueinfo: ::c_long = 129; -pub const SYS_rt_sigsuspend: ::c_long = 130; -pub const SYS_sigaltstack: ::c_long = 131; -pub const SYS_utime: ::c_long = 132; -pub const SYS_mknod: ::c_long = 133; -pub const SYS_uselib: ::c_long = 134; -pub const SYS_personality: ::c_long = 135; -pub const SYS_ustat: ::c_long = 136; -pub const SYS_statfs: ::c_long = 137; -pub const SYS_fstatfs: ::c_long = 138; -pub const SYS_sysfs: ::c_long = 139; -pub const SYS_getpriority: ::c_long = 140; -pub const SYS_setpriority: ::c_long = 141; -pub const SYS_sched_setparam: ::c_long = 142; -pub const SYS_sched_getparam: ::c_long = 143; -pub const SYS_sched_setscheduler: ::c_long = 144; -pub const SYS_sched_getscheduler: ::c_long = 145; -pub const SYS_sched_get_priority_max: ::c_long = 146; -pub const SYS_sched_get_priority_min: ::c_long = 147; -pub const SYS_sched_rr_get_interval: ::c_long = 148; -pub const SYS_mlock: ::c_long = 149; -pub const SYS_munlock: ::c_long = 150; -pub const SYS_mlockall: ::c_long = 151; -pub const SYS_munlockall: ::c_long = 152; -pub const SYS_vhangup: ::c_long = 153; -pub const SYS_modify_ldt: ::c_long = 154; -pub const SYS_pivot_root: ::c_long = 155; -pub const SYS__sysctl: ::c_long = 156; -pub const SYS_prctl: ::c_long = 157; -pub const SYS_arch_prctl: ::c_long = 158; -pub const SYS_adjtimex: ::c_long = 159; -pub const SYS_setrlimit: ::c_long = 160; -pub const SYS_chroot: ::c_long = 161; -pub const SYS_sync: ::c_long = 162; -pub const SYS_acct: ::c_long = 163; -pub const SYS_settimeofday: ::c_long = 164; -pub const SYS_mount: ::c_long = 165; -pub const SYS_umount2: ::c_long = 166; -pub const SYS_swapon: ::c_long = 167; -pub const SYS_swapoff: ::c_long = 168; -pub const SYS_reboot: ::c_long = 169; -pub const SYS_sethostname: ::c_long = 170; -pub const SYS_setdomainname: ::c_long = 171; -pub const SYS_iopl: ::c_long = 172; -pub const SYS_ioperm: ::c_long = 173; -pub const SYS_create_module: ::c_long = 174; -pub const SYS_init_module: ::c_long = 175; -pub const SYS_delete_module: ::c_long = 176; -pub const SYS_get_kernel_syms: ::c_long = 177; -pub const SYS_query_module: ::c_long = 178; -pub const SYS_quotactl: ::c_long = 179; -pub const SYS_nfsservctl: ::c_long = 180; -pub const SYS_getpmsg: ::c_long = 181; -pub const SYS_putpmsg: ::c_long = 182; -pub const SYS_afs_syscall: ::c_long = 183; -pub const SYS_tuxcall: ::c_long = 184; -pub const SYS_security: ::c_long = 185; -pub const SYS_gettid: ::c_long = 186; -pub const SYS_readahead: ::c_long = 187; -pub const SYS_setxattr: ::c_long = 188; -pub const SYS_lsetxattr: ::c_long = 189; -pub const SYS_fsetxattr: ::c_long = 190; -pub const SYS_getxattr: ::c_long = 191; -pub const SYS_lgetxattr: ::c_long = 192; -pub const SYS_fgetxattr: ::c_long = 193; -pub const SYS_listxattr: ::c_long = 194; -pub const SYS_llistxattr: ::c_long = 195; -pub const SYS_flistxattr: ::c_long = 196; -pub const SYS_removexattr: ::c_long = 197; -pub const SYS_lremovexattr: ::c_long = 198; -pub const SYS_fremovexattr: ::c_long = 199; -pub const SYS_tkill: ::c_long = 200; -pub const SYS_time: ::c_long = 201; -pub const SYS_futex: ::c_long = 202; -pub const SYS_sched_setaffinity: ::c_long = 203; -pub const SYS_sched_getaffinity: ::c_long = 204; -pub const SYS_set_thread_area: ::c_long = 205; -pub const SYS_io_setup: ::c_long = 206; -pub const SYS_io_destroy: ::c_long = 207; -pub const SYS_io_getevents: ::c_long = 208; -pub const SYS_io_submit: ::c_long = 209; -pub const SYS_io_cancel: ::c_long = 210; -pub const SYS_get_thread_area: ::c_long = 211; -pub const SYS_lookup_dcookie: ::c_long = 212; -pub const SYS_epoll_create: ::c_long = 213; -pub const SYS_epoll_ctl_old: ::c_long = 214; -pub const SYS_epoll_wait_old: ::c_long = 215; -pub const SYS_remap_file_pages: ::c_long = 216; -pub const SYS_getdents64: ::c_long = 217; -pub const SYS_set_tid_address: ::c_long = 218; -pub const SYS_restart_syscall: ::c_long = 219; -pub const SYS_semtimedop: ::c_long = 220; -pub const SYS_fadvise64: ::c_long = 221; -pub const SYS_timer_create: ::c_long = 222; -pub const SYS_timer_settime: ::c_long = 223; -pub const SYS_timer_gettime: ::c_long = 224; -pub const SYS_timer_getoverrun: ::c_long = 225; -pub const SYS_timer_delete: ::c_long = 226; -pub const SYS_clock_settime: ::c_long = 227; -pub const SYS_clock_gettime: ::c_long = 228; -pub const SYS_clock_getres: ::c_long = 229; -pub const SYS_clock_nanosleep: ::c_long = 230; -pub const SYS_exit_group: ::c_long = 231; -pub const SYS_epoll_wait: ::c_long = 232; -pub const SYS_epoll_ctl: ::c_long = 233; -pub const SYS_tgkill: ::c_long = 234; -pub const SYS_utimes: ::c_long = 235; -pub const SYS_vserver: ::c_long = 236; -pub const SYS_mbind: ::c_long = 237; -pub const SYS_set_mempolicy: ::c_long = 238; -pub const SYS_get_mempolicy: ::c_long = 239; -pub const SYS_mq_open: ::c_long = 240; -pub const SYS_mq_unlink: ::c_long = 241; -pub const SYS_mq_timedsend: ::c_long = 242; -pub const SYS_mq_timedreceive: ::c_long = 243; -pub const SYS_mq_notify: ::c_long = 244; -pub const SYS_mq_getsetattr: ::c_long = 245; -pub const SYS_kexec_load: ::c_long = 246; -pub const SYS_waitid: ::c_long = 247; -pub const SYS_add_key: ::c_long = 248; -pub const SYS_request_key: ::c_long = 249; -pub const SYS_keyctl: ::c_long = 250; -pub const SYS_ioprio_set: ::c_long = 251; -pub const SYS_ioprio_get: ::c_long = 252; -pub const SYS_inotify_init: ::c_long = 253; -pub const SYS_inotify_add_watch: ::c_long = 254; -pub const SYS_inotify_rm_watch: ::c_long = 255; -pub const SYS_migrate_pages: ::c_long = 256; -pub const SYS_openat: ::c_long = 257; -pub const SYS_mkdirat: ::c_long = 258; -pub const SYS_mknodat: ::c_long = 259; -pub const SYS_fchownat: ::c_long = 260; -pub const SYS_futimesat: ::c_long = 261; -pub const SYS_newfstatat: ::c_long = 262; -pub const SYS_unlinkat: ::c_long = 263; -pub const SYS_renameat: ::c_long = 264; -pub const SYS_linkat: ::c_long = 265; -pub const SYS_symlinkat: ::c_long = 266; -pub const SYS_readlinkat: ::c_long = 267; -pub const SYS_fchmodat: ::c_long = 268; -pub const SYS_faccessat: ::c_long = 269; -pub const SYS_pselect6: ::c_long = 270; -pub const SYS_ppoll: ::c_long = 271; -pub const SYS_unshare: ::c_long = 272; -pub const SYS_set_robust_list: ::c_long = 273; -pub const SYS_get_robust_list: ::c_long = 274; -pub const SYS_splice: ::c_long = 275; -pub const SYS_tee: ::c_long = 276; -pub const SYS_sync_file_range: ::c_long = 277; -pub const SYS_vmsplice: ::c_long = 278; -pub const SYS_move_pages: ::c_long = 279; -pub const SYS_utimensat: ::c_long = 280; -pub const SYS_epoll_pwait: ::c_long = 281; -pub const SYS_signalfd: ::c_long = 282; -pub const SYS_timerfd_create: ::c_long = 283; -pub const SYS_eventfd: ::c_long = 284; -pub const SYS_fallocate: ::c_long = 285; -pub const SYS_timerfd_settime: ::c_long = 286; -pub const SYS_timerfd_gettime: ::c_long = 287; -pub const SYS_accept4: ::c_long = 288; -pub const SYS_signalfd4: ::c_long = 289; -pub const SYS_eventfd2: ::c_long = 290; -pub const SYS_epoll_create1: ::c_long = 291; -pub const SYS_dup3: ::c_long = 292; -pub const SYS_pipe2: ::c_long = 293; -pub const SYS_inotify_init1: ::c_long = 294; -pub const SYS_preadv: ::c_long = 295; -pub const SYS_pwritev: ::c_long = 296; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 297; -pub const SYS_perf_event_open: ::c_long = 298; -pub const SYS_recvmmsg: ::c_long = 299; -pub const SYS_fanotify_init: ::c_long = 300; -pub const SYS_fanotify_mark: ::c_long = 301; -pub const SYS_prlimit64: ::c_long = 302; -pub const SYS_name_to_handle_at: ::c_long = 303; -pub const SYS_open_by_handle_at: ::c_long = 304; -pub const SYS_clock_adjtime: ::c_long = 305; -pub const SYS_syncfs: ::c_long = 306; -pub const SYS_sendmmsg: ::c_long = 307; -pub const SYS_setns: ::c_long = 308; -pub const SYS_getcpu: ::c_long = 309; -pub const SYS_process_vm_readv: ::c_long = 310; -pub const SYS_process_vm_writev: ::c_long = 311; -pub const SYS_kcmp: ::c_long = 312; -pub const SYS_finit_module: ::c_long = 313; -pub const SYS_sched_setattr: ::c_long = 314; -pub const SYS_sched_getattr: ::c_long = 315; -pub const SYS_renameat2: ::c_long = 316; -pub const SYS_seccomp: ::c_long = 317; -pub const SYS_getrandom: ::c_long = 318; -pub const SYS_memfd_create: ::c_long = 319; -pub const SYS_kexec_file_load: ::c_long = 320; -pub const SYS_bpf: ::c_long = 321; -pub const SYS_execveat: ::c_long = 322; -pub const SYS_userfaultfd: ::c_long = 323; -pub const SYS_membarrier: ::c_long = 324; -pub const SYS_mlock2: ::c_long = 325; -pub const SYS_copy_file_range: ::c_long = 326; -pub const SYS_preadv2: ::c_long = 327; -pub const SYS_pwritev2: ::c_long = 328; -// FIXME syscalls 329-331 have been added in musl 1.16 -// See discussion https://github.com/rust-lang/libc/pull/699 - -// offsets in user_regs_structs, from sys/reg.h -pub const R15: ::c_int = 0; -pub const R14: ::c_int = 1; -pub const R13: ::c_int = 2; -pub const R12: ::c_int = 3; -pub const RBP: ::c_int = 4; -pub const RBX: ::c_int = 5; -pub const R11: ::c_int = 6; -pub const R10: ::c_int = 7; -pub const R9: ::c_int = 8; -pub const R8: ::c_int = 9; -pub const RAX: ::c_int = 10; -pub const RCX: ::c_int = 11; -pub const RDX: ::c_int = 12; -pub const RSI: ::c_int = 13; -pub const RDI: ::c_int = 14; -pub const ORIG_RAX: ::c_int = 15; -pub const RIP: ::c_int = 16; -pub const CS: ::c_int = 17; -pub const EFLAGS: ::c_int = 18; -pub const RSP: ::c_int = 19; -pub const SS: ::c_int = 20; -pub const FS_BASE: ::c_int = 21; -pub const GS_BASE: ::c_int = 22; -pub const DS: ::c_int = 23; -pub const ES: ::c_int = 24; -pub const FS: ::c_int = 25; -pub const GS: ::c_int = 26; - -pub const MAP_32BIT: ::c_int = 0x0040; -pub const O_DIRECT: ::c_int = 0x4000; -pub const O_DIRECTORY: ::c_int = 0x10000; -pub const O_LARGEFILE: ::c_int = 0; -pub const O_NOFOLLOW: ::c_int = 0x20000; - -pub const SIGSTKSZ: ::size_t = 8192; -pub const MINSIGSTKSZ: ::size_t = 2048; - -#[doc(hidden)] -pub const AF_MAX: ::c_int = 42; -#[doc(hidden)] -pub const PF_MAX: ::c_int = AF_MAX; - -pub const RLIMIT_NLIMITS: ::c_int = 16; -pub const TIOCINQ: ::c_int = ::FIONREAD; -pub const MCL_CURRENT: ::c_int = 0x0001; -pub const MCL_FUTURE: ::c_int = 0x0002; -pub const CBAUD: ::tcflag_t = 0o0010017; -pub const TAB1: ::c_int = 0x00000800; -pub const TAB2: ::c_int = 0x00001000; -pub const TAB3: ::c_int = 0x00001800; -pub const CR1: ::c_int = 0x00000200; -pub const CR2: ::c_int = 0x00000400; -pub const CR3: ::c_int = 0x00000600; -pub const FF1: ::c_int = 0x00008000; -pub const BS1: ::c_int = 0x00002000; -pub const VT1: ::c_int = 0x00004000; -pub const VWERASE: usize = 14; -pub const VREPRINT: usize = 12; -pub const VSUSP: usize = 10; -pub const VSTART: usize = 8; -pub const VSTOP: usize = 9; -pub const VDISCARD: usize = 13; -pub const VTIME: usize = 5; -pub const IXON: ::tcflag_t = 0x00000400; -pub const IXOFF: ::tcflag_t = 0x00001000; -pub const ONLCR: ::tcflag_t = 0x4; -pub const CSIZE: ::tcflag_t = 0x00000030; -pub const CS6: ::tcflag_t = 0x00000010; -pub const CS7: ::tcflag_t = 0x00000020; -pub const CS8: ::tcflag_t = 0x00000030; -pub const CSTOPB: ::tcflag_t = 0x00000040; -pub const CREAD: ::tcflag_t = 0x00000080; -pub const PARENB: ::tcflag_t = 0x00000100; -pub const PARODD: ::tcflag_t = 0x00000200; -pub const HUPCL: ::tcflag_t = 0x00000400; -pub const CLOCAL: ::tcflag_t = 0x00000800; -pub const ECHOKE: ::tcflag_t = 0x00000800; -pub const ECHOE: ::tcflag_t = 0x00000010; -pub const ECHOK: ::tcflag_t = 0x00000020; -pub const ECHONL: ::tcflag_t = 0x00000040; -pub const ECHOPRT: ::tcflag_t = 0x00000400; -pub const ECHOCTL: ::tcflag_t = 0x00000200; -pub const ISIG: ::tcflag_t = 0x00000001; -pub const ICANON: ::tcflag_t = 0x00000002; -pub const PENDIN: ::tcflag_t = 0x00004000; -pub const NOFLSH: ::tcflag_t = 0x00000080; -pub const CIBAUD: ::tcflag_t = 0o02003600000; -pub const CBAUDEX: ::tcflag_t = 0o010000; -pub const VSWTC: usize = 7; -pub const OLCUC: ::tcflag_t = 0o000002; -pub const NLDLY: ::tcflag_t = 0o000400; -pub const CRDLY: ::tcflag_t = 0o003000; -pub const TABDLY: ::tcflag_t = 0o014000; -pub const BSDLY: ::tcflag_t = 0o020000; -pub const FFDLY: ::tcflag_t = 0o100000; -pub const VTDLY: ::tcflag_t = 0o040000; -pub const XTABS: ::tcflag_t = 0o014000; -pub const B57600: ::speed_t = 0o010001; -pub const B115200: ::speed_t = 0o010002; -pub const B230400: ::speed_t = 0o010003; -pub const B460800: ::speed_t = 0o010004; -pub const B500000: ::speed_t = 0o010005; -pub const B576000: ::speed_t = 0o010006; -pub const B921600: ::speed_t = 0o010007; -pub const B1000000: ::speed_t = 0o010010; -pub const B1152000: ::speed_t = 0o010011; -pub const B1500000: ::speed_t = 0o010012; -pub const B2000000: ::speed_t = 0o010013; -pub const B2500000: ::speed_t = 0o010014; -pub const B3000000: ::speed_t = 0o010015; -pub const B3500000: ::speed_t = 0o010016; -pub const B4000000: ::speed_t = 0o010017; - -pub const FIOCLEX: ::c_int = 0x5451; -pub const FIONBIO: ::c_int = 0x5421; -pub const EDEADLK: ::c_int = 35; -pub const EDEADLOCK: ::c_int = EDEADLK; -pub const SO_PASSCRED: ::c_int = 16; -pub const SO_PEERCRED: ::c_int = 17; -pub const SO_RCVLOWAT: ::c_int = 18; -pub const SO_SNDLOWAT: ::c_int = 19; -pub const SO_RCVTIMEO: ::c_int = 20; -pub const SO_SNDTIMEO: ::c_int = 21; -pub const EXTPROC: ::tcflag_t = 0x00010000; -pub const VEOL: usize = 11; -pub const VEOL2: usize = 16; -pub const VMIN: usize = 6; -pub const IEXTEN: ::tcflag_t = 0x00008000; -pub const TOSTOP: ::tcflag_t = 0x00000100; -pub const FLUSHO: ::tcflag_t = 0x00001000; -pub const TCGETS: ::c_int = 0x5401; -pub const TCSETS: ::c_int = 0x5402; -pub const TCSETSW: ::c_int = 0x5403; -pub const TCSETSF: ::c_int = 0x5404; -pub const TCGETA: ::c_int = 0x5405; -pub const TCSETA: ::c_int = 0x5406; -pub const TCSETAW: ::c_int = 0x5407; -pub const TCSETAF: ::c_int = 0x5408; -pub const TCSBRK: ::c_int = 0x5409; -pub const TCXONC: ::c_int = 0x540A; -pub const TCFLSH: ::c_int = 0x540B; -pub const TIOCGSOFTCAR: ::c_int = 0x5419; -pub const TIOCSSOFTCAR: ::c_int = 0x541A; -pub const TIOCLINUX: ::c_int = 0x541C; -pub const TIOCGSERIAL: ::c_int = 0x541E; -pub const TIOCEXCL: ::c_int = 0x540C; -pub const TIOCNXCL: ::c_int = 0x540D; -pub const TIOCSCTTY: ::c_int = 0x540E; -pub const TIOCGPGRP: ::c_int = 0x540F; -pub const TIOCSPGRP: ::c_int = 0x5410; -pub const TIOCOUTQ: ::c_int = 0x5411; -pub const TIOCSTI: ::c_int = 0x5412; -pub const TIOCGWINSZ: ::c_int = 0x5413; -pub const TIOCSWINSZ: ::c_int = 0x5414; -pub const TIOCMGET: ::c_int = 0x5415; -pub const TIOCMBIS: ::c_int = 0x5416; -pub const TIOCMBIC: ::c_int = 0x5417; -pub const TIOCMSET: ::c_int = 0x5418; -pub const FIONREAD: ::c_int = 0x541B; -pub const TIOCCONS: ::c_int = 0x541D; - -pub const TIOCM_LE: ::c_int = 0x001; -pub const TIOCM_DTR: ::c_int = 0x002; -pub const TIOCM_RTS: ::c_int = 0x004; -pub const TIOCM_ST: ::c_int = 0x008; -pub const TIOCM_SR: ::c_int = 0x010; -pub const TIOCM_CTS: ::c_int = 0x020; -pub const TIOCM_CAR: ::c_int = 0x040; -pub const TIOCM_RNG: ::c_int = 0x080; -pub const TIOCM_DSR: ::c_int = 0x100; -pub const TIOCM_CD: ::c_int = TIOCM_CAR; -pub const TIOCM_RI: ::c_int = TIOCM_RNG; - -extern { - pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; -} - diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/mod.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/musl/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/musl/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,350 +0,0 @@ -pub type clock_t = c_long; -pub type time_t = c_long; -pub type suseconds_t = c_long; -pub type ino_t = u64; -pub type off_t = i64; -pub type blkcnt_t = i64; - -pub type shmatt_t = ::c_ulong; -pub type msgqnum_t = ::c_ulong; -pub type msglen_t = ::c_ulong; -pub type fsblkcnt_t = ::c_ulonglong; -pub type fsfilcnt_t = ::c_ulonglong; -pub type rlim_t = ::c_ulonglong; - -s! { - pub struct aiocb { - pub aio_fildes: ::c_int, - pub aio_lio_opcode: ::c_int, - pub aio_reqprio: ::c_int, - pub aio_buf: *mut ::c_void, - pub aio_nbytes: ::size_t, - pub aio_sigevent: ::sigevent, - __td: *mut ::c_void, - __lock: [::c_int; 2], - __err: ::c_int, - __ret: ::ssize_t, - pub aio_offset: off_t, - __next: *mut ::c_void, - __prev: *mut ::c_void, - #[cfg(target_pointer_width = "32")] - __dummy4: [::c_char; 24], - #[cfg(target_pointer_width = "64")] - __dummy4: [::c_char; 16], - } - - pub struct sigaction { - pub sa_sigaction: ::sighandler_t, - pub sa_mask: ::sigset_t, - pub sa_flags: ::c_int, - pub sa_restorer: ::Option, - } - - pub struct statvfs { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_favail: ::fsfilcnt_t, - #[cfg(target_endian = "little")] - pub f_fsid: ::c_ulong, - #[cfg(target_pointer_width = "32")] - __f_unused: ::c_int, - #[cfg(target_endian = "big")] - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct termios { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; ::NCCS], - pub __c_ispeed: ::speed_t, - pub __c_ospeed: ::speed_t, - } - - pub struct flock { - pub l_type: ::c_short, - pub l_whence: ::c_short, - pub l_start: ::off_t, - pub l_len: ::off_t, - pub l_pid: ::pid_t, - } -} - -s_no_extra_traits!{ - pub struct sysinfo { - pub uptime: ::c_ulong, - pub loads: [::c_ulong; 3], - pub totalram: ::c_ulong, - pub freeram: ::c_ulong, - pub sharedram: ::c_ulong, - pub bufferram: ::c_ulong, - pub totalswap: ::c_ulong, - pub freeswap: ::c_ulong, - pub procs: ::c_ushort, - pub pad: ::c_ushort, - pub totalhigh: ::c_ulong, - pub freehigh: ::c_ulong, - pub mem_unit: ::c_uint, - pub __reserved: [::c_char; 256], - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for sysinfo { - fn eq(&self, other: &sysinfo) -> bool { - self.uptime == other.uptime - && self.loads == other.loads - && self.totalram == other.totalram - && self.freeram == other.freeram - && self.sharedram == other.sharedram - && self.bufferram == other.bufferram - && self.totalswap == other.totalswap - && self.freeswap == other.freeswap - && self.procs == other.procs - && self.pad == other.pad - && self.totalhigh == other.totalhigh - && self.freehigh == other.freehigh - && self.mem_unit == other.mem_unit - && self - .__reserved - .iter() - .zip(other.__reserved.iter()) - .all(|(a,b)| a == b) - } - } - - impl Eq for sysinfo {} - - impl ::fmt::Debug for sysinfo { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sysinfo") - .field("uptime", &self.uptime) - .field("loads", &self.loads) - .field("totalram", &self.totalram) - .field("freeram", &self.freeram) - .field("sharedram", &self.sharedram) - .field("bufferram", &self.bufferram) - .field("totalswap", &self.totalswap) - .field("freeswap", &self.freeswap) - .field("procs", &self.procs) - .field("pad", &self.pad) - .field("totalhigh", &self.totalhigh) - .field("freehigh", &self.freehigh) - .field("mem_unit", &self.mem_unit) - // FIXME: .field("__reserved", &self.__reserved) - .finish() - } - } - - impl ::hash::Hash for sysinfo { - fn hash(&self, state: &mut H) { - self.uptime.hash(state); - self.loads.hash(state); - self.totalram.hash(state); - self.freeram.hash(state); - self.sharedram.hash(state); - self.bufferram.hash(state); - self.totalswap.hash(state); - self.freeswap.hash(state); - self.procs.hash(state); - self.pad.hash(state); - self.totalhigh.hash(state); - self.freehigh.hash(state); - self.mem_unit.hash(state); - self.__reserved.hash(state); - } - } - } -} - -pub const SFD_CLOEXEC: ::c_int = 0x080000; - -pub const NCCS: usize = 32; - -pub const O_TRUNC: ::c_int = 512; -pub const O_NOATIME: ::c_int = 0o1000000; -pub const O_CLOEXEC: ::c_int = 0x80000; -pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; - -pub const EBFONT: ::c_int = 59; -pub const ENOSTR: ::c_int = 60; -pub const ENODATA: ::c_int = 61; -pub const ETIME: ::c_int = 62; -pub const ENOSR: ::c_int = 63; -pub const ENONET: ::c_int = 64; -pub const ENOPKG: ::c_int = 65; -pub const EREMOTE: ::c_int = 66; -pub const ENOLINK: ::c_int = 67; -pub const EADV: ::c_int = 68; -pub const ESRMNT: ::c_int = 69; -pub const ECOMM: ::c_int = 70; -pub const EPROTO: ::c_int = 71; -pub const EDOTDOT: ::c_int = 73; - -pub const F_RDLCK: ::c_int = 0; -pub const F_WRLCK: ::c_int = 1; -pub const F_UNLCK: ::c_int = 2; - -pub const SA_NODEFER: ::c_int = 0x40000000; -pub const SA_RESETHAND: ::c_int = 0x80000000; -pub const SA_RESTART: ::c_int = 0x10000000; -pub const SA_NOCLDSTOP: ::c_int = 0x00000001; - -pub const EPOLL_CLOEXEC: ::c_int = 0x80000; - -pub const EFD_CLOEXEC: ::c_int = 0x80000; - -pub const BUFSIZ: ::c_uint = 1024; -pub const TMP_MAX: ::c_uint = 10000; -pub const FOPEN_MAX: ::c_uint = 1000; -pub const O_PATH: ::c_int = 0o10000000; -pub const O_EXEC: ::c_int = 0o10000000; -pub const O_SEARCH: ::c_int = 0o10000000; -pub const O_ACCMODE: ::c_int = 0o10000003; -pub const O_NDELAY: ::c_int = O_NONBLOCK; -pub const NI_MAXHOST: ::socklen_t = 255; -pub const PTHREAD_STACK_MIN: ::size_t = 2048; -pub const POSIX_FADV_DONTNEED: ::c_int = 4; -pub const POSIX_FADV_NOREUSE: ::c_int = 5; - -pub const POSIX_MADV_DONTNEED: ::c_int = 4; - -pub const RLIM_INFINITY: ::rlim_t = !0; -pub const RLIMIT_RTTIME: ::c_int = 15; - -pub const MAP_ANONYMOUS: ::c_int = MAP_ANON; - -pub const SOCK_DCCP: ::c_int = 6; -pub const SOCK_PACKET: ::c_int = 10; - -pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15; -pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16; -pub const TCP_THIN_DUPACK: ::c_int = 17; -pub const TCP_USER_TIMEOUT: ::c_int = 18; -pub const TCP_REPAIR: ::c_int = 19; -pub const TCP_REPAIR_QUEUE: ::c_int = 20; -pub const TCP_QUEUE_SEQ: ::c_int = 21; -pub const TCP_REPAIR_OPTIONS: ::c_int = 22; -pub const TCP_FASTOPEN: ::c_int = 23; -pub const TCP_TIMESTAMP: ::c_int = 24; - -pub const SIGUNUSED: ::c_int = ::SIGSYS; - -pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; -pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; -pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; - -pub const CPU_SETSIZE: ::c_int = 128; - -pub const PTRACE_TRACEME: ::c_int = 0; -pub const PTRACE_PEEKTEXT: ::c_int = 1; -pub const PTRACE_PEEKDATA: ::c_int = 2; -pub const PTRACE_PEEKUSER: ::c_int = 3; -pub const PTRACE_POKETEXT: ::c_int = 4; -pub const PTRACE_POKEDATA: ::c_int = 5; -pub const PTRACE_POKEUSER: ::c_int = 6; -pub const PTRACE_CONT: ::c_int = 7; -pub const PTRACE_KILL: ::c_int = 8; -pub const PTRACE_SINGLESTEP: ::c_int = 9; -pub const PTRACE_GETREGS: ::c_int = 12; -pub const PTRACE_SETREGS: ::c_int = 13; -pub const PTRACE_GETFPREGS: ::c_int = 14; -pub const PTRACE_SETFPREGS: ::c_int = 15; -pub const PTRACE_ATTACH: ::c_int = 16; -pub const PTRACE_DETACH: ::c_int = 17; -pub const PTRACE_GETFPXREGS: ::c_int = 18; -pub const PTRACE_SETFPXREGS: ::c_int = 19; -pub const PTRACE_SYSCALL: ::c_int = 24; -pub const PTRACE_SETOPTIONS: ::c_int = 0x4200; -pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201; -pub const PTRACE_GETSIGINFO: ::c_int = 0x4202; -pub const PTRACE_SETSIGINFO: ::c_int = 0x4203; -pub const PTRACE_GETREGSET: ::c_int = 0x4204; -pub const PTRACE_SETREGSET: ::c_int = 0x4205; -pub const PTRACE_SEIZE: ::c_int = 0x4206; -pub const PTRACE_INTERRUPT: ::c_int = 0x4207; -pub const PTRACE_LISTEN: ::c_int = 0x4208; -pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209; - -pub const EPOLLWAKEUP: ::c_int = 0x20000000; - -pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK; - -pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK; - -pub const TCSANOW: ::c_int = 0; -pub const TCSADRAIN: ::c_int = 1; -pub const TCSAFLUSH: ::c_int = 2; - -pub const RTLD_GLOBAL: ::c_int = 0x100; -pub const RTLD_NOLOAD: ::c_int = 0x4; - -// TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux -// kernel 3.10). See also notbsd/mod.rs -pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; -pub const CLOCK_TAI: ::clockid_t = 11; - -pub const B0: ::speed_t = 0o000000; -pub const B50: ::speed_t = 0o000001; -pub const B75: ::speed_t = 0o000002; -pub const B110: ::speed_t = 0o000003; -pub const B134: ::speed_t = 0o000004; -pub const B150: ::speed_t = 0o000005; -pub const B200: ::speed_t = 0o000006; -pub const B300: ::speed_t = 0o000007; -pub const B600: ::speed_t = 0o000010; -pub const B1200: ::speed_t = 0o000011; -pub const B1800: ::speed_t = 0o000012; -pub const B2400: ::speed_t = 0o000013; -pub const B4800: ::speed_t = 0o000014; -pub const B9600: ::speed_t = 0o000015; -pub const B19200: ::speed_t = 0o000016; -pub const B38400: ::speed_t = 0o000017; -pub const EXTA: ::speed_t = B19200; -pub const EXTB: ::speed_t = B38400; - -pub const SO_BINDTODEVICE: ::c_int = 25; -pub const SO_TIMESTAMP: ::c_int = 29; -pub const SO_MARK: ::c_int = 36; -pub const SO_RXQ_OVFL: ::c_int = 40; -pub const SO_PEEK_OFF: ::c_int = 42; -pub const SO_BUSY_POLL: ::c_int = 46; - -extern { - pub fn ptrace(request: ::c_int, ...) -> ::c_long; - pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; - pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; - pub fn pthread_getaffinity_np(thread: ::pthread_t, - cpusetsize: ::size_t, - cpuset: *mut ::cpu_set_t) -> ::c_int; - pub fn pthread_setaffinity_np(thread: ::pthread_t, - cpusetsize: ::size_t, - cpuset: *const ::cpu_set_t) -> ::c_int; - pub fn sched_getcpu() -> ::c_int; -} - -cfg_if! { - if #[cfg(any(target_arch = "x86_64", - target_arch = "aarch64", - target_arch = "powerpc64"))] { - mod b64; - pub use self::b64::*; - } else if #[cfg(any(target_arch = "x86", - target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc"))] { - mod b32; - pub use self::b32::*; - } else { } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/no_align.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/no_align.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/no_align.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/no_align.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -macro_rules! expand_align { - () => { - s! { - pub struct pthread_mutexattr_t { - #[cfg(any(target_arch = "x86_64", - target_arch = "powerpc64", - target_arch = "mips64", - target_arch = "s390x", - target_arch = "sparc64", - all(target_arch = "aarch64", - target_env = "musl")))] - __align: [::c_int; 0], - #[cfg(not(any(target_arch = "x86_64", - target_arch = "powerpc64", - target_arch = "mips64", - target_arch = "s390x", - target_arch = "sparc64", - all(target_arch = "aarch64", - target_env = "musl"))))] - __align: [::c_long; 0], - size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], - } - - pub struct pthread_rwlockattr_t { - #[cfg(target_env = "musl")] - __align: [::c_int; 0], - #[cfg(not(target_env = "musl"))] - __align: [::c_long; 0], - size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T], - } - - pub struct pthread_condattr_t { - __align: [::c_int; 0], - size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], - } - } - - s_no_extra_traits! { - pub struct pthread_cond_t { - #[cfg(target_env = "musl")] - __align: [*const ::c_void; 0], - #[cfg(not(target_env = "musl"))] - __align: [::c_longlong; 0], - size: [u8; ::__SIZEOF_PTHREAD_COND_T], - } - - pub struct pthread_mutex_t { - #[cfg(any(target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc", - all(target_arch = "x86_64", - target_pointer_width = "32")))] - __align: [::c_long; 0], - #[cfg(not(any(target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc", - all(target_arch = "x86_64", - target_pointer_width = "32"))))] - __align: [::c_longlong; 0], - size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], - } - - pub struct pthread_rwlock_t { - #[cfg(any(target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc", - all(target_arch = "x86_64", - target_pointer_width = "32")))] - __align: [::c_long; 0], - #[cfg(not(any(target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc", - all(target_arch = "x86_64", - target_pointer_width = "32"))))] - __align: [::c_longlong; 0], - size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], - } - } - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/align.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/align.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/align.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/align.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -s! { - // FIXME this is actually a union - #[cfg_attr(target_pointer_width = "32", - repr(align(4)))] - #[cfg_attr(target_pointer_width = "64", - repr(align(8)))] - pub struct sem_t { - #[cfg(target_pointer_width = "32")] - __size: [::c_char; 16], - #[cfg(target_pointer_width = "64")] - __size: [::c_char; 32], - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b32/arm.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b32/arm.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b32/arm.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b32/arm.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,612 +0,0 @@ -pub type c_char = u8; -pub type wchar_t = u32; - -s! { - pub struct ipc_perm { - pub __key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::c_ushort, - __pad1: ::c_ushort, - pub __seq: ::c_ushort, - __pad2: ::c_ushort, - __unused1: ::c_ulong, - __unused2: ::c_ulong - } - - pub struct stat64 { - pub st_dev: ::dev_t, - __pad1: ::c_uint, - __st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __pad2: ::c_uint, - pub st_size: ::off64_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt64_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_ino: ::ino64_t, - } - - pub struct statfs64 { - pub f_type: ::__fsword_t, - pub f_bsize: ::__fsword_t, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_fsid: ::fsid_t, - pub f_namelen: ::__fsword_t, - pub f_frsize: ::__fsword_t, - pub f_flags: ::__fsword_t, - pub f_spare: [::__fsword_t; 4], - } - - pub struct statvfs64 { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_favail: u64, - pub f_fsid: ::c_ulong, - __f_unused: ::c_int, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct shmid_ds { - pub shm_perm: ::ipc_perm, - pub shm_segsz: ::size_t, - pub shm_atime: ::time_t, - __unused1: ::c_ulong, - pub shm_dtime: ::time_t, - __unused2: ::c_ulong, - pub shm_ctime: ::time_t, - __unused3: ::c_ulong, - pub shm_cpid: ::pid_t, - pub shm_lpid: ::pid_t, - pub shm_nattch: ::shmatt_t, - __unused4: ::c_ulong, - __unused5: ::c_ulong - } - - pub struct msqid_ds { - pub msg_perm: ::ipc_perm, - pub msg_stime: ::time_t, - __glibc_reserved1: ::c_ulong, - pub msg_rtime: ::time_t, - __glibc_reserved2: ::c_ulong, - pub msg_ctime: ::time_t, - __glibc_reserved3: ::c_ulong, - __msg_cbytes: ::c_ulong, - pub msg_qnum: ::msgqnum_t, - pub msg_qbytes: ::msglen_t, - pub msg_lspid: ::pid_t, - pub msg_lrpid: ::pid_t, - __glibc_reserved4: ::c_ulong, - __glibc_reserved5: ::c_ulong, - } - - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 19], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } -} - -pub const O_DIRECT: ::c_int = 0x10000; -pub const O_DIRECTORY: ::c_int = 0x4000; -pub const O_NOFOLLOW: ::c_int = 0x8000; -pub const O_LARGEFILE: ::c_int = 0o400000; - -pub const MAP_LOCKED: ::c_int = 0x02000; -pub const MAP_NORESERVE: ::c_int = 0x04000; - -pub const EDEADLOCK: ::c_int = 35; - -pub const SO_PASSCRED: ::c_int = 16; -pub const SO_PEERCRED: ::c_int = 17; -pub const SO_RCVLOWAT: ::c_int = 18; -pub const SO_SNDLOWAT: ::c_int = 19; -pub const SO_RCVTIMEO: ::c_int = 20; -pub const SO_SNDTIMEO: ::c_int = 21; -pub const SO_SNDBUFFORCE: ::c_int = 32; -pub const SO_RCVBUFFORCE: ::c_int = 33; - -pub const FIOCLEX: ::c_ulong = 0x5451; -pub const FIONBIO: ::c_ulong = 0x5421; - -pub const PTRACE_GETFPXREGS: ::c_uint = 18; -pub const PTRACE_SETFPXREGS: ::c_uint = 19; - -pub const MCL_CURRENT: ::c_int = 0x0001; -pub const MCL_FUTURE: ::c_int = 0x0002; - -pub const SIGSTKSZ: ::size_t = 8192; -pub const MINSIGSTKSZ: ::size_t = 2048; -pub const CBAUD: ::tcflag_t = 0o0010017; -pub const TAB1: ::c_int = 0x00000800; -pub const TAB2: ::c_int = 0x00001000; -pub const TAB3: ::c_int = 0x00001800; -pub const CR1: ::c_int = 0x00000200; -pub const CR2: ::c_int = 0x00000400; -pub const CR3: ::c_int = 0x00000600; -pub const FF1: ::c_int = 0x00008000; -pub const BS1: ::c_int = 0x00002000; -pub const VT1: ::c_int = 0x00004000; -pub const VWERASE: usize = 14; -pub const VREPRINT: usize = 12; -pub const VSUSP: usize = 10; -pub const VSTART: usize = 8; -pub const VSTOP: usize = 9; -pub const VDISCARD: usize = 13; -pub const VTIME: usize = 5; -pub const IXON: ::tcflag_t = 0x00000400; -pub const IXOFF: ::tcflag_t = 0x00001000; -pub const ONLCR: ::tcflag_t = 0x4; -pub const CSIZE: ::tcflag_t = 0x00000030; -pub const CS6: ::tcflag_t = 0x00000010; -pub const CS7: ::tcflag_t = 0x00000020; -pub const CS8: ::tcflag_t = 0x00000030; -pub const CSTOPB: ::tcflag_t = 0x00000040; -pub const CREAD: ::tcflag_t = 0x00000080; -pub const PARENB: ::tcflag_t = 0x00000100; -pub const PARODD: ::tcflag_t = 0x00000200; -pub const HUPCL: ::tcflag_t = 0x00000400; -pub const CLOCAL: ::tcflag_t = 0x00000800; -pub const ECHOKE: ::tcflag_t = 0x00000800; -pub const ECHOE: ::tcflag_t = 0x00000010; -pub const ECHOK: ::tcflag_t = 0x00000020; -pub const ECHONL: ::tcflag_t = 0x00000040; -pub const ECHOPRT: ::tcflag_t = 0x00000400; -pub const ECHOCTL: ::tcflag_t = 0x00000200; -pub const ISIG: ::tcflag_t = 0x00000001; -pub const ICANON: ::tcflag_t = 0x00000002; -pub const PENDIN: ::tcflag_t = 0x00004000; -pub const NOFLSH: ::tcflag_t = 0x00000080; -pub const CIBAUD: ::tcflag_t = 0o02003600000; -pub const CBAUDEX: ::tcflag_t = 0o010000; -pub const VSWTC: usize = 7; -pub const OLCUC: ::tcflag_t = 0o000002; -pub const NLDLY: ::tcflag_t = 0o000400; -pub const CRDLY: ::tcflag_t = 0o003000; -pub const TABDLY: ::tcflag_t = 0o014000; -pub const BSDLY: ::tcflag_t = 0o020000; -pub const FFDLY: ::tcflag_t = 0o100000; -pub const VTDLY: ::tcflag_t = 0o040000; -pub const XTABS: ::tcflag_t = 0o014000; - -pub const B0: ::speed_t = 0o000000; -pub const B50: ::speed_t = 0o000001; -pub const B75: ::speed_t = 0o000002; -pub const B110: ::speed_t = 0o000003; -pub const B134: ::speed_t = 0o000004; -pub const B150: ::speed_t = 0o000005; -pub const B200: ::speed_t = 0o000006; -pub const B300: ::speed_t = 0o000007; -pub const B600: ::speed_t = 0o000010; -pub const B1200: ::speed_t = 0o000011; -pub const B1800: ::speed_t = 0o000012; -pub const B2400: ::speed_t = 0o000013; -pub const B4800: ::speed_t = 0o000014; -pub const B9600: ::speed_t = 0o000015; -pub const B19200: ::speed_t = 0o000016; -pub const B38400: ::speed_t = 0o000017; -pub const EXTA: ::speed_t = B19200; -pub const EXTB: ::speed_t = B38400; -pub const BOTHER: ::speed_t = 0o010000; -pub const B57600: ::speed_t = 0o010001; -pub const B115200: ::speed_t = 0o010002; -pub const B230400: ::speed_t = 0o010003; -pub const B460800: ::speed_t = 0o010004; -pub const B500000: ::speed_t = 0o010005; -pub const B576000: ::speed_t = 0o010006; -pub const B921600: ::speed_t = 0o010007; -pub const B1000000: ::speed_t = 0o010010; -pub const B1152000: ::speed_t = 0o010011; -pub const B1500000: ::speed_t = 0o010012; -pub const B2000000: ::speed_t = 0o010013; -pub const B2500000: ::speed_t = 0o010014; -pub const B3000000: ::speed_t = 0o010015; -pub const B3500000: ::speed_t = 0o010016; -pub const B4000000: ::speed_t = 0o010017; - -pub const VEOL: usize = 11; -pub const VEOL2: usize = 16; -pub const VMIN: usize = 6; -pub const IEXTEN: ::tcflag_t = 0x00008000; -pub const TOSTOP: ::tcflag_t = 0x00000100; -pub const FLUSHO: ::tcflag_t = 0x00001000; -pub const EXTPROC: ::tcflag_t = 0x00010000; -pub const TCGETS: ::c_ulong = 0x5401; -pub const TCSETS: ::c_ulong = 0x5402; -pub const TCSETSW: ::c_ulong = 0x5403; -pub const TCSETSF: ::c_ulong = 0x5404; -pub const TCGETA: ::c_ulong = 0x5405; -pub const TCSETA: ::c_ulong = 0x5406; -pub const TCSETAW: ::c_ulong = 0x5407; -pub const TCSETAF: ::c_ulong = 0x5408; -pub const TCSBRK: ::c_ulong = 0x5409; -pub const TCXONC: ::c_ulong = 0x540A; -pub const TCFLSH: ::c_ulong = 0x540B; -pub const TIOCINQ: ::c_ulong = 0x541B; -pub const TIOCGPGRP: ::c_ulong = 0x540F; -pub const TIOCSPGRP: ::c_ulong = 0x5410; -pub const TIOCOUTQ: ::c_ulong = 0x5411; -pub const TIOCGWINSZ: ::c_ulong = 0x5413; -pub const TIOCSWINSZ: ::c_ulong = 0x5414; -pub const FIONREAD: ::c_ulong = 0x541B; - -// Syscall table -pub const SYS_restart_syscall: ::c_long = 0; -pub const SYS_exit: ::c_long = 1; -pub const SYS_fork: ::c_long = 2; -pub const SYS_read: ::c_long = 3; -pub const SYS_write: ::c_long = 4; -pub const SYS_open: ::c_long = 5; -pub const SYS_close: ::c_long = 6; -pub const SYS_creat: ::c_long = 8; -pub const SYS_link: ::c_long = 9; -pub const SYS_unlink: ::c_long = 10; -pub const SYS_execve: ::c_long = 11; -pub const SYS_chdir: ::c_long = 12; -pub const SYS_mknod: ::c_long = 14; -pub const SYS_chmod: ::c_long = 15; -pub const SYS_lchown: ::c_long = 16; -pub const SYS_lseek: ::c_long = 19; -pub const SYS_getpid: ::c_long = 20; -pub const SYS_mount: ::c_long = 21; -pub const SYS_setuid: ::c_long = 23; -pub const SYS_getuid: ::c_long = 24; -pub const SYS_ptrace: ::c_long = 26; -pub const SYS_pause: ::c_long = 29; -pub const SYS_access: ::c_long = 33; -pub const SYS_nice: ::c_long = 34; -pub const SYS_sync: ::c_long = 36; -pub const SYS_kill: ::c_long = 37; -pub const SYS_rename: ::c_long = 38; -pub const SYS_mkdir: ::c_long = 39; -pub const SYS_rmdir: ::c_long = 40; -pub const SYS_dup: ::c_long = 41; -pub const SYS_pipe: ::c_long = 42; -pub const SYS_times: ::c_long = 43; -pub const SYS_brk: ::c_long = 45; -pub const SYS_setgid: ::c_long = 46; -pub const SYS_getgid: ::c_long = 47; -pub const SYS_geteuid: ::c_long = 49; -pub const SYS_getegid: ::c_long = 50; -pub const SYS_acct: ::c_long = 51; -pub const SYS_umount2: ::c_long = 52; -pub const SYS_ioctl: ::c_long = 54; -pub const SYS_fcntl: ::c_long = 55; -pub const SYS_setpgid: ::c_long = 57; -pub const SYS_umask: ::c_long = 60; -pub const SYS_chroot: ::c_long = 61; -pub const SYS_ustat: ::c_long = 62; -pub const SYS_dup2: ::c_long = 63; -pub const SYS_getppid: ::c_long = 64; -pub const SYS_getpgrp: ::c_long = 65; -pub const SYS_setsid: ::c_long = 66; -pub const SYS_sigaction: ::c_long = 67; -pub const SYS_setreuid: ::c_long = 70; -pub const SYS_setregid: ::c_long = 71; -pub const SYS_sigsuspend: ::c_long = 72; -pub const SYS_sigpending: ::c_long = 73; -pub const SYS_sethostname: ::c_long = 74; -pub const SYS_setrlimit: ::c_long = 75; -pub const SYS_getrusage: ::c_long = 77; -pub const SYS_gettimeofday: ::c_long = 78; -pub const SYS_settimeofday: ::c_long = 79; -pub const SYS_getgroups: ::c_long = 80; -pub const SYS_setgroups: ::c_long = 81; -pub const SYS_symlink: ::c_long = 83; -pub const SYS_readlink: ::c_long = 85; -pub const SYS_uselib: ::c_long = 86; -pub const SYS_swapon: ::c_long = 87; -pub const SYS_reboot: ::c_long = 88; -pub const SYS_munmap: ::c_long = 91; -pub const SYS_truncate: ::c_long = 92; -pub const SYS_ftruncate: ::c_long = 93; -pub const SYS_fchmod: ::c_long = 94; -pub const SYS_fchown: ::c_long = 95; -pub const SYS_getpriority: ::c_long = 96; -pub const SYS_setpriority: ::c_long = 97; -pub const SYS_statfs: ::c_long = 99; -pub const SYS_fstatfs: ::c_long = 100; -pub const SYS_syslog: ::c_long = 103; -pub const SYS_setitimer: ::c_long = 104; -pub const SYS_getitimer: ::c_long = 105; -pub const SYS_stat: ::c_long = 106; -pub const SYS_lstat: ::c_long = 107; -pub const SYS_fstat: ::c_long = 108; -pub const SYS_vhangup: ::c_long = 111; -pub const SYS_wait4: ::c_long = 114; -pub const SYS_swapoff: ::c_long = 115; -pub const SYS_sysinfo: ::c_long = 116; -pub const SYS_fsync: ::c_long = 118; -pub const SYS_sigreturn: ::c_long = 119; -pub const SYS_clone: ::c_long = 120; -pub const SYS_setdomainname: ::c_long = 121; -pub const SYS_uname: ::c_long = 122; -pub const SYS_adjtimex: ::c_long = 124; -pub const SYS_mprotect: ::c_long = 125; -pub const SYS_sigprocmask: ::c_long = 126; -pub const SYS_init_module: ::c_long = 128; -pub const SYS_delete_module: ::c_long = 129; -pub const SYS_quotactl: ::c_long = 131; -pub const SYS_getpgid: ::c_long = 132; -pub const SYS_fchdir: ::c_long = 133; -pub const SYS_bdflush: ::c_long = 134; -pub const SYS_sysfs: ::c_long = 135; -pub const SYS_personality: ::c_long = 136; -pub const SYS_setfsuid: ::c_long = 138; -pub const SYS_setfsgid: ::c_long = 139; -pub const SYS__llseek: ::c_long = 140; -pub const SYS_getdents: ::c_long = 141; -pub const SYS__newselect: ::c_long = 142; -pub const SYS_flock: ::c_long = 143; -pub const SYS_msync: ::c_long = 144; -pub const SYS_readv: ::c_long = 145; -pub const SYS_writev: ::c_long = 146; -pub const SYS_getsid: ::c_long = 147; -pub const SYS_fdatasync: ::c_long = 148; -pub const SYS__sysctl: ::c_long = 149; -pub const SYS_mlock: ::c_long = 150; -pub const SYS_munlock: ::c_long = 151; -pub const SYS_mlockall: ::c_long = 152; -pub const SYS_munlockall: ::c_long = 153; -pub const SYS_sched_setparam: ::c_long = 154; -pub const SYS_sched_getparam: ::c_long = 155; -pub const SYS_sched_setscheduler: ::c_long = 156; -pub const SYS_sched_getscheduler: ::c_long = 157; -pub const SYS_sched_yield: ::c_long = 158; -pub const SYS_sched_get_priority_max: ::c_long = 159; -pub const SYS_sched_get_priority_min: ::c_long = 160; -pub const SYS_sched_rr_get_interval: ::c_long = 161; -pub const SYS_nanosleep: ::c_long = 162; -pub const SYS_mremap: ::c_long = 163; -pub const SYS_setresuid: ::c_long = 164; -pub const SYS_getresuid: ::c_long = 165; -pub const SYS_poll: ::c_long = 168; -pub const SYS_nfsservctl: ::c_long = 169; -pub const SYS_setresgid: ::c_long = 170; -pub const SYS_getresgid: ::c_long = 171; -pub const SYS_prctl: ::c_long = 172; -pub const SYS_rt_sigreturn: ::c_long = 173; -pub const SYS_rt_sigaction: ::c_long = 174; -pub const SYS_rt_sigprocmask: ::c_long = 175; -pub const SYS_rt_sigpending: ::c_long = 176; -pub const SYS_rt_sigtimedwait: ::c_long = 177; -pub const SYS_rt_sigqueueinfo: ::c_long = 178; -pub const SYS_rt_sigsuspend: ::c_long = 179; -pub const SYS_pread64: ::c_long = 180; -pub const SYS_pwrite64: ::c_long = 181; -pub const SYS_chown: ::c_long = 182; -pub const SYS_getcwd: ::c_long = 183; -pub const SYS_capget: ::c_long = 184; -pub const SYS_capset: ::c_long = 185; -pub const SYS_sigaltstack: ::c_long = 186; -pub const SYS_sendfile: ::c_long = 187; -pub const SYS_vfork: ::c_long = 190; -pub const SYS_ugetrlimit: ::c_long = 191; -pub const SYS_mmap2: ::c_long = 192; -pub const SYS_truncate64: ::c_long = 193; -pub const SYS_ftruncate64: ::c_long = 194; -pub const SYS_stat64: ::c_long = 195; -pub const SYS_lstat64: ::c_long = 196; -pub const SYS_fstat64: ::c_long = 197; -pub const SYS_lchown32: ::c_long = 198; -pub const SYS_getuid32: ::c_long = 199; -pub const SYS_getgid32: ::c_long = 200; -pub const SYS_geteuid32: ::c_long = 201; -pub const SYS_getegid32: ::c_long = 202; -pub const SYS_setreuid32: ::c_long = 203; -pub const SYS_setregid32: ::c_long = 204; -pub const SYS_getgroups32: ::c_long = 205; -pub const SYS_setgroups32: ::c_long = 206; -pub const SYS_fchown32: ::c_long = 207; -pub const SYS_setresuid32: ::c_long = 208; -pub const SYS_getresuid32: ::c_long = 209; -pub const SYS_setresgid32: ::c_long = 210; -pub const SYS_getresgid32: ::c_long = 211; -pub const SYS_chown32: ::c_long = 212; -pub const SYS_setuid32: ::c_long = 213; -pub const SYS_setgid32: ::c_long = 214; -pub const SYS_setfsuid32: ::c_long = 215; -pub const SYS_setfsgid32: ::c_long = 216; -pub const SYS_getdents64: ::c_long = 217; -pub const SYS_pivot_root: ::c_long = 218; -pub const SYS_mincore: ::c_long = 219; -pub const SYS_madvise: ::c_long = 220; -pub const SYS_fcntl64: ::c_long = 221; -pub const SYS_gettid: ::c_long = 224; -pub const SYS_readahead: ::c_long = 225; -pub const SYS_setxattr: ::c_long = 226; -pub const SYS_lsetxattr: ::c_long = 227; -pub const SYS_fsetxattr: ::c_long = 228; -pub const SYS_getxattr: ::c_long = 229; -pub const SYS_lgetxattr: ::c_long = 230; -pub const SYS_fgetxattr: ::c_long = 231; -pub const SYS_listxattr: ::c_long = 232; -pub const SYS_llistxattr: ::c_long = 233; -pub const SYS_flistxattr: ::c_long = 234; -pub const SYS_removexattr: ::c_long = 235; -pub const SYS_lremovexattr: ::c_long = 236; -pub const SYS_fremovexattr: ::c_long = 237; -pub const SYS_tkill: ::c_long = 238; -pub const SYS_sendfile64: ::c_long = 239; -pub const SYS_futex: ::c_long = 240; -pub const SYS_sched_setaffinity: ::c_long = 241; -pub const SYS_sched_getaffinity: ::c_long = 242; -pub const SYS_io_setup: ::c_long = 243; -pub const SYS_io_destroy: ::c_long = 244; -pub const SYS_io_getevents: ::c_long = 245; -pub const SYS_io_submit: ::c_long = 246; -pub const SYS_io_cancel: ::c_long = 247; -pub const SYS_exit_group: ::c_long = 248; -pub const SYS_lookup_dcookie: ::c_long = 249; -pub const SYS_epoll_create: ::c_long = 250; -pub const SYS_epoll_ctl: ::c_long = 251; -pub const SYS_epoll_wait: ::c_long = 252; -pub const SYS_remap_file_pages: ::c_long = 253; -pub const SYS_set_tid_address: ::c_long = 256; -pub const SYS_timer_create: ::c_long = 257; -pub const SYS_timer_settime: ::c_long = 258; -pub const SYS_timer_gettime: ::c_long = 259; -pub const SYS_timer_getoverrun: ::c_long = 260; -pub const SYS_timer_delete: ::c_long = 261; -pub const SYS_clock_settime: ::c_long = 262; -pub const SYS_clock_gettime: ::c_long = 263; -pub const SYS_clock_getres: ::c_long = 264; -pub const SYS_clock_nanosleep: ::c_long = 265; -pub const SYS_statfs64: ::c_long = 266; -pub const SYS_fstatfs64: ::c_long = 267; -pub const SYS_tgkill: ::c_long = 268; -pub const SYS_utimes: ::c_long = 269; -pub const SYS_arm_fadvise64_64: ::c_long = 270; -pub const SYS_pciconfig_iobase: ::c_long = 271; -pub const SYS_pciconfig_read: ::c_long = 272; -pub const SYS_pciconfig_write: ::c_long = 273; -pub const SYS_mq_open: ::c_long = 274; -pub const SYS_mq_unlink: ::c_long = 275; -pub const SYS_mq_timedsend: ::c_long = 276; -pub const SYS_mq_timedreceive: ::c_long = 277; -pub const SYS_mq_notify: ::c_long = 278; -pub const SYS_mq_getsetattr: ::c_long = 279; -pub const SYS_waitid: ::c_long = 280; -pub const SYS_socket: ::c_long = 281; -pub const SYS_bind: ::c_long = 282; -pub const SYS_connect: ::c_long = 283; -pub const SYS_listen: ::c_long = 284; -pub const SYS_accept: ::c_long = 285; -pub const SYS_getsockname: ::c_long = 286; -pub const SYS_getpeername: ::c_long = 287; -pub const SYS_socketpair: ::c_long = 288; -pub const SYS_send: ::c_long = 289; -pub const SYS_sendto: ::c_long = 290; -pub const SYS_recv: ::c_long = 291; -pub const SYS_recvfrom: ::c_long = 292; -pub const SYS_shutdown: ::c_long = 293; -pub const SYS_setsockopt: ::c_long = 294; -pub const SYS_getsockopt: ::c_long = 295; -pub const SYS_sendmsg: ::c_long = 296; -pub const SYS_recvmsg: ::c_long = 297; -pub const SYS_semop: ::c_long = 298; -pub const SYS_semget: ::c_long = 299; -pub const SYS_semctl: ::c_long = 300; -pub const SYS_msgsnd: ::c_long = 301; -pub const SYS_msgrcv: ::c_long = 302; -pub const SYS_msgget: ::c_long = 303; -pub const SYS_msgctl: ::c_long = 304; -pub const SYS_shmat: ::c_long = 305; -pub const SYS_shmdt: ::c_long = 306; -pub const SYS_shmget: ::c_long = 307; -pub const SYS_shmctl: ::c_long = 308; -pub const SYS_add_key: ::c_long = 309; -pub const SYS_request_key: ::c_long = 310; -pub const SYS_keyctl: ::c_long = 311; -pub const SYS_semtimedop: ::c_long = 312; -pub const SYS_vserver: ::c_long = 313; -pub const SYS_ioprio_set: ::c_long = 314; -pub const SYS_ioprio_get: ::c_long = 315; -pub const SYS_inotify_init: ::c_long = 316; -pub const SYS_inotify_add_watch: ::c_long = 317; -pub const SYS_inotify_rm_watch: ::c_long = 318; -pub const SYS_mbind: ::c_long = 319; -pub const SYS_get_mempolicy: ::c_long = 320; -pub const SYS_set_mempolicy: ::c_long = 321; -pub const SYS_openat: ::c_long = 322; -pub const SYS_mkdirat: ::c_long = 323; -pub const SYS_mknodat: ::c_long = 324; -pub const SYS_fchownat: ::c_long = 325; -pub const SYS_futimesat: ::c_long = 326; -pub const SYS_fstatat64: ::c_long = 327; -pub const SYS_unlinkat: ::c_long = 328; -pub const SYS_renameat: ::c_long = 329; -pub const SYS_linkat: ::c_long = 330; -pub const SYS_symlinkat: ::c_long = 331; -pub const SYS_readlinkat: ::c_long = 332; -pub const SYS_fchmodat: ::c_long = 333; -pub const SYS_faccessat: ::c_long = 334; -pub const SYS_pselect6: ::c_long = 335; -pub const SYS_ppoll: ::c_long = 336; -pub const SYS_unshare: ::c_long = 337; -pub const SYS_set_robust_list: ::c_long = 338; -pub const SYS_get_robust_list: ::c_long = 339; -pub const SYS_splice: ::c_long = 340; -pub const SYS_arm_sync_file_range: ::c_long = 341; -pub const SYS_tee: ::c_long = 342; -pub const SYS_vmsplice: ::c_long = 343; -pub const SYS_move_pages: ::c_long = 344; -pub const SYS_getcpu: ::c_long = 345; -pub const SYS_epoll_pwait: ::c_long = 346; -pub const SYS_kexec_load: ::c_long = 347; -pub const SYS_utimensat: ::c_long = 348; -pub const SYS_signalfd: ::c_long = 349; -pub const SYS_timerfd_create: ::c_long = 350; -pub const SYS_eventfd: ::c_long = 351; -pub const SYS_fallocate: ::c_long = 352; -pub const SYS_timerfd_settime: ::c_long = 353; -pub const SYS_timerfd_gettime: ::c_long = 354; -pub const SYS_signalfd4: ::c_long = 355; -pub const SYS_eventfd2: ::c_long = 356; -pub const SYS_epoll_create1: ::c_long = 357; -pub const SYS_dup3: ::c_long = 358; -pub const SYS_pipe2: ::c_long = 359; -pub const SYS_inotify_init1: ::c_long = 360; -pub const SYS_preadv: ::c_long = 361; -pub const SYS_pwritev: ::c_long = 362; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 363; -pub const SYS_perf_event_open: ::c_long = 364; -pub const SYS_recvmmsg: ::c_long = 365; -pub const SYS_accept4: ::c_long = 366; -pub const SYS_fanotify_init: ::c_long = 367; -pub const SYS_fanotify_mark: ::c_long = 368; -pub const SYS_prlimit64: ::c_long = 369; -pub const SYS_name_to_handle_at: ::c_long = 370; -pub const SYS_open_by_handle_at: ::c_long = 371; -pub const SYS_clock_adjtime: ::c_long = 372; -pub const SYS_syncfs: ::c_long = 373; -pub const SYS_sendmmsg: ::c_long = 374; -pub const SYS_setns: ::c_long = 375; -pub const SYS_process_vm_readv: ::c_long = 376; -pub const SYS_process_vm_writev: ::c_long = 377; -pub const SYS_kcmp: ::c_long = 378; -pub const SYS_finit_module: ::c_long = 379; -pub const SYS_sched_setattr: ::c_long = 380; -pub const SYS_sched_getattr: ::c_long = 381; -pub const SYS_renameat2: ::c_long = 382; -pub const SYS_seccomp: ::c_long = 383; -pub const SYS_getrandom: ::c_long = 384; -pub const SYS_memfd_create: ::c_long = 385; -pub const SYS_bpf: ::c_long = 386; -pub const SYS_execveat: ::c_long = 387; -pub const SYS_userfaultfd: ::c_long = 388; -pub const SYS_membarrier: ::c_long = 389; -pub const SYS_mlock2: ::c_long = 390; -pub const SYS_copy_file_range: ::c_long = 391; -pub const SYS_preadv2: ::c_long = 392; -pub const SYS_pwritev2: ::c_long = 393; -pub const SYS_pkey_mprotect: ::c_long = 394; -pub const SYS_pkey_alloc: ::c_long = 395; -pub const SYS_pkey_free: ::c_long = 396; diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b32/mod.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b32/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b32/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b32/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,388 +0,0 @@ -//! 32-bit specific definitions for linux-like values - -use pthread_mutex_t; - -pub type c_long = i32; -pub type c_ulong = u32; -pub type clock_t = i32; -pub type time_t = i32; -pub type suseconds_t = i32; -pub type ino_t = u32; -pub type off_t = i32; -pub type blkcnt_t = i32; -pub type __fsword_t = i32; - -pub type fsblkcnt_t = ::c_ulong; -pub type fsfilcnt_t = ::c_ulong; -pub type rlim_t = c_ulong; -pub type shmatt_t = ::c_ulong; -pub type msgqnum_t = ::c_ulong; -pub type msglen_t = ::c_ulong; -pub type blksize_t = i32; -pub type nlink_t = u32; -pub type __u64 = ::c_ulonglong; - -s! { - pub struct stat { - pub st_dev: ::dev_t, - __pad1: ::c_short, - pub st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __pad2: ::c_short, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - __unused4: ::c_long, - __unused5: ::c_long, - } - - pub struct statvfs { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_favail: ::fsfilcnt_t, - pub f_fsid: ::c_ulong, - __f_unused: ::c_int, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct pthread_attr_t { - __size: [u32; 9] - } - - pub struct sigset_t { - __val: [::c_ulong; 32], - } - - pub struct sysinfo { - pub uptime: ::c_long, - pub loads: [::c_ulong; 3], - pub totalram: ::c_ulong, - pub freeram: ::c_ulong, - pub sharedram: ::c_ulong, - pub bufferram: ::c_ulong, - pub totalswap: ::c_ulong, - pub freeswap: ::c_ulong, - pub procs: ::c_ushort, - pub pad: ::c_ushort, - pub totalhigh: ::c_ulong, - pub freehigh: ::c_ulong, - pub mem_unit: ::c_uint, - pub _f: [::c_char; 8], - } -} - -pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; -pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; - -pub const RLIMIT_NOFILE: ::c_int = 7; -pub const RLIMIT_NPROC: ::c_int = 6; - -pub const O_APPEND: ::c_int = 1024; -pub const O_CREAT: ::c_int = 64; -pub const O_EXCL: ::c_int = 128; -pub const O_NOCTTY: ::c_int = 256; -pub const O_NONBLOCK: ::c_int = 2048; -pub const O_SYNC: ::c_int = 1052672; -pub const O_RSYNC: ::c_int = 1052672; -pub const O_DSYNC: ::c_int = 4096; -pub const O_FSYNC: ::c_int = 0x101000; -pub const O_NOATIME: ::c_int = 0o1000000; -pub const O_PATH: ::c_int = 0o10000000; -pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; - -pub const MAP_GROWSDOWN: ::c_int = 0x0100; - -pub const EDEADLK: ::c_int = 35; -pub const ENAMETOOLONG: ::c_int = 36; -pub const ENOLCK: ::c_int = 37; -pub const ENOSYS: ::c_int = 38; -pub const ENOTEMPTY: ::c_int = 39; -pub const ELOOP: ::c_int = 40; -pub const ENOMSG: ::c_int = 42; -pub const EIDRM: ::c_int = 43; -pub const ECHRNG: ::c_int = 44; -pub const EL2NSYNC: ::c_int = 45; -pub const EL3HLT: ::c_int = 46; -pub const EL3RST: ::c_int = 47; -pub const ELNRNG: ::c_int = 48; -pub const EUNATCH: ::c_int = 49; -pub const ENOCSI: ::c_int = 50; -pub const EL2HLT: ::c_int = 51; -pub const EBADE: ::c_int = 52; -pub const EBADR: ::c_int = 53; -pub const EXFULL: ::c_int = 54; -pub const ENOANO: ::c_int = 55; -pub const EBADRQC: ::c_int = 56; -pub const EBADSLT: ::c_int = 57; -pub const EMULTIHOP: ::c_int = 72; -pub const EOVERFLOW: ::c_int = 75; -pub const ENOTUNIQ: ::c_int = 76; -pub const EBADFD: ::c_int = 77; -pub const EBADMSG: ::c_int = 74; -pub const EREMCHG: ::c_int = 78; -pub const ELIBACC: ::c_int = 79; -pub const ELIBBAD: ::c_int = 80; -pub const ELIBSCN: ::c_int = 81; -pub const ELIBMAX: ::c_int = 82; -pub const ELIBEXEC: ::c_int = 83; -pub const EILSEQ: ::c_int = 84; -pub const ERESTART: ::c_int = 85; -pub const ESTRPIPE: ::c_int = 86; -pub const EUSERS: ::c_int = 87; -pub const ENOTSOCK: ::c_int = 88; -pub const EDESTADDRREQ: ::c_int = 89; -pub const EMSGSIZE: ::c_int = 90; -pub const EPROTOTYPE: ::c_int = 91; -pub const ENOPROTOOPT: ::c_int = 92; -pub const EPROTONOSUPPORT: ::c_int = 93; -pub const ESOCKTNOSUPPORT: ::c_int = 94; -pub const EOPNOTSUPP: ::c_int = 95; -pub const EPFNOSUPPORT: ::c_int = 96; -pub const EAFNOSUPPORT: ::c_int = 97; -pub const EADDRINUSE: ::c_int = 98; -pub const EADDRNOTAVAIL: ::c_int = 99; -pub const ENETDOWN: ::c_int = 100; -pub const ENETUNREACH: ::c_int = 101; -pub const ENETRESET: ::c_int = 102; -pub const ECONNABORTED: ::c_int = 103; -pub const ECONNRESET: ::c_int = 104; -pub const ENOBUFS: ::c_int = 105; -pub const EISCONN: ::c_int = 106; -pub const ENOTCONN: ::c_int = 107; -pub const ESHUTDOWN: ::c_int = 108; -pub const ETOOMANYREFS: ::c_int = 109; -pub const ETIMEDOUT: ::c_int = 110; -pub const ECONNREFUSED: ::c_int = 111; -pub const EHOSTDOWN: ::c_int = 112; -pub const EHOSTUNREACH: ::c_int = 113; -pub const EALREADY: ::c_int = 114; -pub const EINPROGRESS: ::c_int = 115; -pub const ESTALE: ::c_int = 116; -pub const EDQUOT: ::c_int = 122; -pub const ENOMEDIUM: ::c_int = 123; -pub const EMEDIUMTYPE: ::c_int = 124; -pub const ECANCELED: ::c_int = 125; -pub const ENOKEY: ::c_int = 126; -pub const EKEYEXPIRED: ::c_int = 127; -pub const EKEYREVOKED: ::c_int = 128; -pub const EKEYREJECTED: ::c_int = 129; -pub const EOWNERDEAD: ::c_int = 130; -pub const ENOTRECOVERABLE: ::c_int = 131; -pub const EHWPOISON: ::c_int = 133; -pub const ERFKILL: ::c_int = 132; - -pub const SOL_SOCKET: ::c_int = 1; - -pub const SO_REUSEADDR: ::c_int = 2; -pub const SO_TYPE: ::c_int = 3; -pub const SO_ERROR: ::c_int = 4; -pub const SO_DONTROUTE: ::c_int = 5; -pub const SO_BROADCAST: ::c_int = 6; -pub const SO_SNDBUF: ::c_int = 7; -pub const SO_RCVBUF: ::c_int = 8; -pub const SO_KEEPALIVE: ::c_int = 9; -pub const SO_OOBINLINE: ::c_int = 10; -pub const SO_PRIORITY: ::c_int = 12; -pub const SO_LINGER: ::c_int = 13; -pub const SO_BSDCOMPAT: ::c_int = 14; -pub const SO_REUSEPORT: ::c_int = 15; -pub const SO_BINDTODEVICE: ::c_int = 25; -pub const SO_TIMESTAMP: ::c_int = 29; -pub const SO_ACCEPTCONN: ::c_int = 30; -pub const SO_MARK: ::c_int = 36; -pub const SO_PROTOCOL: ::c_int = 38; -pub const SO_DOMAIN: ::c_int = 39; -pub const SO_RXQ_OVFL: ::c_int = 40; -pub const SO_PEEK_OFF: ::c_int = 42; -pub const SO_BUSY_POLL: ::c_int = 46; - -pub const SA_ONSTACK: ::c_int = 0x08000000; -pub const SA_SIGINFO: ::c_int = 0x00000004; -pub const SA_NOCLDWAIT: ::c_int = 0x00000002; - -pub const SIGCHLD: ::c_int = 17; -pub const SIGBUS: ::c_int = 7; -pub const SIGUSR1: ::c_int = 10; -pub const SIGUSR2: ::c_int = 12; -pub const SIGCONT: ::c_int = 18; -pub const SIGSTOP: ::c_int = 19; -pub const SIGTSTP: ::c_int = 20; -pub const SIGURG: ::c_int = 23; -pub const SIGIO: ::c_int = 29; -pub const SIGSYS: ::c_int = 31; -pub const SIGSTKFLT: ::c_int = 16; -pub const SIGUNUSED: ::c_int = 31; -pub const SIGPOLL: ::c_int = 29; -pub const SIGPWR: ::c_int = 30; -pub const SIG_SETMASK: ::c_int = 2; -pub const SIG_BLOCK: ::c_int = 0x000000; -pub const SIG_UNBLOCK: ::c_int = 0x01; - -pub const POLLWRNORM: ::c_short = 0x100; -pub const POLLWRBAND: ::c_short = 0x200; - -pub const O_ASYNC: ::c_int = 0x2000; -pub const O_NDELAY: ::c_int = 0x800; - -pub const PTRACE_DETACH: ::c_uint = 17; - -pub const EFD_NONBLOCK: ::c_int = 0x800; - -pub const F_GETLK: ::c_int = 5; -pub const F_GETOWN: ::c_int = 9; -pub const F_SETOWN: ::c_int = 8; -pub const F_SETLK: ::c_int = 6; -pub const F_SETLKW: ::c_int = 7; - -pub const F_RDLCK: ::c_int = 0; -pub const F_WRLCK: ::c_int = 1; -pub const F_UNLCK: ::c_int = 2; - -pub const SFD_NONBLOCK: ::c_int = 0x0800; - -pub const TIOCEXCL: ::c_ulong = 0x540C; -pub const TIOCNXCL: ::c_ulong = 0x540D; -pub const TIOCSCTTY: ::c_ulong = 0x540E; -pub const TIOCSTI: ::c_ulong = 0x5412; -pub const TIOCMGET: ::c_ulong = 0x5415; -pub const TIOCMBIS: ::c_ulong = 0x5416; -pub const TIOCMBIC: ::c_ulong = 0x5417; -pub const TIOCMSET: ::c_ulong = 0x5418; -pub const TIOCCONS: ::c_ulong = 0x541D; - -pub const SFD_CLOEXEC: ::c_int = 0x080000; - -pub const NCCS: usize = 32; - -pub const O_TRUNC: ::c_int = 512; - -pub const O_CLOEXEC: ::c_int = 0x80000; - -pub const EBFONT: ::c_int = 59; -pub const ENOSTR: ::c_int = 60; -pub const ENODATA: ::c_int = 61; -pub const ETIME: ::c_int = 62; -pub const ENOSR: ::c_int = 63; -pub const ENONET: ::c_int = 64; -pub const ENOPKG: ::c_int = 65; -pub const EREMOTE: ::c_int = 66; -pub const ENOLINK: ::c_int = 67; -pub const EADV: ::c_int = 68; -pub const ESRMNT: ::c_int = 69; -pub const ECOMM: ::c_int = 70; -pub const EPROTO: ::c_int = 71; -pub const EDOTDOT: ::c_int = 73; - -pub const SA_NODEFER: ::c_int = 0x40000000; -pub const SA_RESETHAND: ::c_int = 0x80000000; -pub const SA_RESTART: ::c_int = 0x10000000; -pub const SA_NOCLDSTOP: ::c_int = 0x00000001; - -pub const EPOLL_CLOEXEC: ::c_int = 0x80000; - -pub const EFD_CLOEXEC: ::c_int = 0x80000; - -pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; -pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; -pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32; -pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; -pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; - -align_const! { - #[cfg(target_endian = "little")] - pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, - ], - }; - #[cfg(target_endian = "little")] - pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, - ], - }; - #[cfg(target_endian = "little")] - pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, - ], - }; - #[cfg(target_endian = "big")] - pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, - ], - }; - #[cfg(target_endian = "big")] - pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, - 0, 0, 0, - ], - }; - #[cfg(target_endian = "big")] - pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 0, - ], - }; -} - -pub const PTRACE_GETFPREGS: ::c_uint = 14; -pub const PTRACE_SETFPREGS: ::c_uint = 15; -pub const PTRACE_GETREGS: ::c_uint = 12; -pub const PTRACE_SETREGS: ::c_uint = 13; - -#[link(name = "util")] -extern { - pub fn sysctl(name: *mut ::c_int, - namelen: ::c_int, - oldp: *mut ::c_void, - oldlenp: *mut ::size_t, - newp: *mut ::c_void, - newlen: ::size_t) - -> ::c_int; -} - -cfg_if! { - if #[cfg(target_arch = "x86")] { - mod x86; - pub use self::x86::*; - } else if #[cfg(target_arch = "arm")] { - mod arm; - pub use self::arm::*; - } else if #[cfg(target_arch = "powerpc")] { - mod powerpc; - pub use self::powerpc::*; - } else { - // Unknown target_arch - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b32/powerpc.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b32/powerpc.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b32/powerpc.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b32/powerpc.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,614 +0,0 @@ -pub type c_char = u8; -pub type wchar_t = i32; - -s! { - pub struct ipc_perm { - __key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::mode_t, - __seq: ::uint32_t, - __pad1: ::uint32_t, - __glibc_reserved1: ::uint64_t, - __glibc_reserved2: ::uint64_t, - } - - pub struct stat64 { - pub st_dev: ::dev_t, - pub st_ino: ::ino64_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __pad2: ::c_ushort, - pub st_size: ::off64_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt64_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - __glibc_reserved4: ::c_ulong, - __glibc_reserved5: ::c_ulong, - } - - pub struct statfs64 { - pub f_type: ::__fsword_t, - pub f_bsize: ::__fsword_t, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_fsid: ::fsid_t, - pub f_namelen: ::__fsword_t, - pub f_frsize: ::__fsword_t, - pub f_flags: ::__fsword_t, - pub f_spare: [::__fsword_t; 4], - } - - pub struct statvfs64 { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_favail: u64, - pub f_fsid: ::c_ulong, - __f_unused: ::c_int, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct shmid_ds { - pub shm_perm: ::ipc_perm, - __glibc_reserved1: ::c_uint, - pub shm_atime: ::time_t, - __glibc_reserved2: ::c_uint, - pub shm_dtime: ::time_t, - __glibc_reserved3: ::c_uint, - pub shm_ctime: ::time_t, - __glibc_reserved4: ::c_uint, - pub shm_segsz: ::size_t, - pub shm_cpid: ::pid_t, - pub shm_lpid: ::pid_t, - pub shm_nattch: ::shmatt_t, - __glibc_reserved5: ::c_ulong, - __glibc_reserved6: ::c_ulong, - } - - pub struct msqid_ds { - pub msg_perm: ::ipc_perm, - __glibc_reserved1: ::c_uint, - pub msg_stime: ::time_t, - __glibc_reserved2: ::c_uint, - pub msg_rtime: ::time_t, - __glibc_reserved3: ::c_uint, - pub msg_ctime: ::time_t, - __msg_cbytes: ::c_ulong, - pub msg_qnum: ::msgqnum_t, - pub msg_qbytes: ::msglen_t, - pub msg_lspid: ::pid_t, - pub msg_lrpid: ::pid_t, - __glibc_reserved4: ::c_ulong, - __glibc_reserved5: ::c_ulong, - } -} - -pub const O_DIRECT: ::c_int = 0x20000; -pub const O_DIRECTORY: ::c_int = 0x4000; -pub const O_NOFOLLOW: ::c_int = 0x8000; -pub const O_LARGEFILE: ::c_int = 0o200000; - -pub const MAP_LOCKED: ::c_int = 0x00080; -pub const MAP_NORESERVE: ::c_int = 0x00040; - -pub const EDEADLOCK: ::c_int = 58; - -pub const SO_SNDBUFFORCE: ::c_int = 32; -pub const SO_RCVBUFFORCE: ::c_int = 33; -pub const SO_NO_CHECK: ::c_int = 11; -pub const SO_RCVLOWAT: ::c_int = 16; -pub const SO_SNDLOWAT: ::c_int = 17; -pub const SO_RCVTIMEO: ::c_int = 18; -pub const SO_SNDTIMEO: ::c_int = 19; -pub const SO_PASSCRED: ::c_int = 20; -pub const SO_PEERCRED: ::c_int = 21; - -pub const FIOCLEX: ::c_ulong = 0x20006601; -pub const FIONBIO: ::c_ulong = 0x8004667e; - -pub const MCL_CURRENT: ::c_int = 0x2000; -pub const MCL_FUTURE: ::c_int = 0x4000; - -pub const SIGSTKSZ: ::size_t = 0x4000; -pub const MINSIGSTKSZ: ::size_t = 4096; -pub const CBAUD: ::tcflag_t = 0xff; -pub const TAB1: ::c_int = 0x400; -pub const TAB2: ::c_int = 0x800; -pub const TAB3: ::c_int = 0xc00; -pub const CR1: ::c_int = 0x1000; -pub const CR2: ::c_int = 0x2000; -pub const CR3: ::c_int = 0x3000; -pub const FF1: ::c_int = 0x4000; -pub const BS1: ::c_int = 0x8000; -pub const VT1: ::c_int = 0x10000; -pub const VWERASE: usize = 0xa; -pub const VREPRINT: usize = 0xb; -pub const VSUSP: usize = 0xc; -pub const VSTART: usize = 0xd; -pub const VSTOP: usize = 0xe; -pub const VDISCARD: usize = 0x10; -pub const VTIME: usize = 0x7; -pub const IXON: ::tcflag_t = 0x200; -pub const IXOFF: ::tcflag_t = 0x400; -pub const ONLCR: ::tcflag_t = 0x2; -pub const CSIZE: ::tcflag_t = 0x300; -pub const CS6: ::tcflag_t = 0x100; -pub const CS7: ::tcflag_t = 0x200; -pub const CS8: ::tcflag_t = 0x300; -pub const CSTOPB: ::tcflag_t = 0x400; -pub const CREAD: ::tcflag_t = 0x800; -pub const PARENB: ::tcflag_t = 0x1000; -pub const PARODD: ::tcflag_t = 0x2000; -pub const HUPCL: ::tcflag_t = 0x4000; -pub const CLOCAL: ::tcflag_t = 0x8000; -pub const ECHOKE: ::tcflag_t = 0x1; -pub const ECHOE: ::tcflag_t = 0x2; -pub const ECHOK: ::tcflag_t = 0x4; -pub const ECHONL: ::tcflag_t = 0x10; -pub const ECHOPRT: ::tcflag_t = 0x20; -pub const ECHOCTL: ::tcflag_t = 0x40; -pub const ISIG: ::tcflag_t = 0x80; -pub const ICANON: ::tcflag_t = 0x100; -pub const PENDIN: ::tcflag_t = 0x20000000; -pub const NOFLSH: ::tcflag_t = 0x80000000; -pub const VSWTC: usize = 9; -pub const OLCUC: ::tcflag_t = 0o000004; -pub const NLDLY: ::tcflag_t = 0o001400; -pub const CRDLY: ::tcflag_t = 0o030000; -pub const TABDLY: ::tcflag_t = 0o006000; -pub const BSDLY: ::tcflag_t = 0o100000; -pub const FFDLY: ::tcflag_t = 0o040000; -pub const VTDLY: ::tcflag_t = 0o200000; -pub const XTABS: ::tcflag_t = 0o006000; - -pub const B0: ::speed_t = 0o000000; -pub const B50: ::speed_t = 0o000001; -pub const B75: ::speed_t = 0o000002; -pub const B110: ::speed_t = 0o000003; -pub const B134: ::speed_t = 0o000004; -pub const B150: ::speed_t = 0o000005; -pub const B200: ::speed_t = 0o000006; -pub const B300: ::speed_t = 0o000007; -pub const B600: ::speed_t = 0o000010; -pub const B1200: ::speed_t = 0o000011; -pub const B1800: ::speed_t = 0o000012; -pub const B2400: ::speed_t = 0o000013; -pub const B4800: ::speed_t = 0o000014; -pub const B9600: ::speed_t = 0o000015; -pub const B19200: ::speed_t = 0o000016; -pub const B38400: ::speed_t = 0o000017; -pub const EXTA: ::speed_t = B19200; -pub const EXTB: ::speed_t = B38400; -pub const CBAUDEX: ::speed_t = 0o000020; -pub const B57600: ::speed_t = 0o0020; -pub const B115200: ::speed_t = 0o0021; -pub const B230400: ::speed_t = 0o0022; -pub const B460800: ::speed_t = 0o0023; -pub const B500000: ::speed_t = 0o0024; -pub const B576000: ::speed_t = 0o0025; -pub const B921600: ::speed_t = 0o0026; -pub const B1000000: ::speed_t = 0o0027; -pub const B1152000: ::speed_t = 0o0030; -pub const B1500000: ::speed_t = 0o0031; -pub const B2000000: ::speed_t = 0o0032; -pub const B2500000: ::speed_t = 0o0033; -pub const B3000000: ::speed_t = 0o0034; -pub const B3500000: ::speed_t = 0o0035; -pub const B4000000: ::speed_t = 0o0036; -pub const BOTHER: ::speed_t = 0o0037; - -pub const VEOL: usize = 6; -pub const VEOL2: usize = 8; -pub const VMIN: usize = 5; -pub const IEXTEN: ::tcflag_t = 0x400; -pub const TOSTOP: ::tcflag_t = 0x400000; -pub const FLUSHO: ::tcflag_t = 0x800000; -pub const EXTPROC: ::tcflag_t = 0x10000000; -pub const TCGETS: ::c_ulong = 0x403c7413; -pub const TCSETS: ::c_ulong = 0x803c7414; -pub const TCSETSW: ::c_ulong = 0x803c7415; -pub const TCSETSF: ::c_ulong = 0x803c7416; -pub const TCGETA: ::c_ulong = 0x40147417; -pub const TCSETA: ::c_ulong = 0x80147418; -pub const TCSETAW: ::c_ulong = 0x80147419; -pub const TCSETAF: ::c_ulong = 0x8014741c; -pub const TCSBRK: ::c_ulong = 0x2000741d; -pub const TCXONC: ::c_ulong = 0x2000741e; -pub const TCFLSH: ::c_ulong = 0x2000741f; -pub const TIOCINQ: ::c_ulong = 0x4004667f; -pub const TIOCGPGRP: ::c_ulong = 0x40047477; -pub const TIOCSPGRP: ::c_ulong = 0x80047476; -pub const TIOCOUTQ: ::c_ulong = 0x40047473; -pub const TIOCGWINSZ: ::c_ulong = 0x40087468; -pub const TIOCSWINSZ: ::c_ulong = 0x80087467; -pub const FIONREAD: ::c_ulong = 0x4004667f; - -pub const SYS_restart_syscall: ::c_long = 0; -pub const SYS_exit: ::c_long = 1; -pub const SYS_fork: ::c_long = 2; -pub const SYS_read: ::c_long = 3; -pub const SYS_write: ::c_long = 4; -pub const SYS_open: ::c_long = 5; -pub const SYS_close: ::c_long = 6; -pub const SYS_waitpid: ::c_long = 7; -pub const SYS_creat: ::c_long = 8; -pub const SYS_link: ::c_long = 9; -pub const SYS_unlink: ::c_long = 10; -pub const SYS_execve: ::c_long = 11; -pub const SYS_chdir: ::c_long = 12; -pub const SYS_time: ::c_long = 13; -pub const SYS_mknod: ::c_long = 14; -pub const SYS_chmod: ::c_long = 15; -pub const SYS_lchown: ::c_long = 16; -pub const SYS_break: ::c_long = 17; -pub const SYS_oldstat: ::c_long = 18; -pub const SYS_lseek: ::c_long = 19; -pub const SYS_getpid: ::c_long = 20; -pub const SYS_mount: ::c_long = 21; -pub const SYS_umount: ::c_long = 22; -pub const SYS_setuid: ::c_long = 23; -pub const SYS_getuid: ::c_long = 24; -pub const SYS_stime: ::c_long = 25; -pub const SYS_ptrace: ::c_long = 26; -pub const SYS_alarm: ::c_long = 27; -pub const SYS_oldfstat: ::c_long = 28; -pub const SYS_pause: ::c_long = 29; -pub const SYS_utime: ::c_long = 30; -pub const SYS_stty: ::c_long = 31; -pub const SYS_gtty: ::c_long = 32; -pub const SYS_access: ::c_long = 33; -pub const SYS_nice: ::c_long = 34; -pub const SYS_ftime: ::c_long = 35; -pub const SYS_sync: ::c_long = 36; -pub const SYS_kill: ::c_long = 37; -pub const SYS_rename: ::c_long = 38; -pub const SYS_mkdir: ::c_long = 39; -pub const SYS_rmdir: ::c_long = 40; -pub const SYS_dup: ::c_long = 41; -pub const SYS_pipe: ::c_long = 42; -pub const SYS_times: ::c_long = 43; -pub const SYS_prof: ::c_long = 44; -pub const SYS_brk: ::c_long = 45; -pub const SYS_setgid: ::c_long = 46; -pub const SYS_getgid: ::c_long = 47; -pub const SYS_signal: ::c_long = 48; -pub const SYS_geteuid: ::c_long = 49; -pub const SYS_getegid: ::c_long = 50; -pub const SYS_acct: ::c_long = 51; -pub const SYS_umount2: ::c_long = 52; -pub const SYS_lock: ::c_long = 53; -pub const SYS_ioctl: ::c_long = 54; -pub const SYS_fcntl: ::c_long = 55; -pub const SYS_mpx: ::c_long = 56; -pub const SYS_setpgid: ::c_long = 57; -pub const SYS_ulimit: ::c_long = 58; -pub const SYS_oldolduname: ::c_long = 59; -pub const SYS_umask: ::c_long = 60; -pub const SYS_chroot: ::c_long = 61; -pub const SYS_ustat: ::c_long = 62; -pub const SYS_dup2: ::c_long = 63; -pub const SYS_getppid: ::c_long = 64; -pub const SYS_getpgrp: ::c_long = 65; -pub const SYS_setsid: ::c_long = 66; -pub const SYS_sigaction: ::c_long = 67; -pub const SYS_sgetmask: ::c_long = 68; -pub const SYS_ssetmask: ::c_long = 69; -pub const SYS_setreuid: ::c_long = 70; -pub const SYS_setregid: ::c_long = 71; -pub const SYS_sigsuspend: ::c_long = 72; -pub const SYS_sigpending: ::c_long = 73; -pub const SYS_sethostname: ::c_long = 74; -pub const SYS_setrlimit: ::c_long = 75; -pub const SYS_getrlimit: ::c_long = 76; -pub const SYS_getrusage: ::c_long = 77; -pub const SYS_gettimeofday: ::c_long = 78; -pub const SYS_settimeofday: ::c_long = 79; -pub const SYS_getgroups: ::c_long = 80; -pub const SYS_setgroups: ::c_long = 81; -pub const SYS_select: ::c_long = 82; -pub const SYS_symlink: ::c_long = 83; -pub const SYS_oldlstat: ::c_long = 84; -pub const SYS_readlink: ::c_long = 85; -pub const SYS_uselib: ::c_long = 86; -pub const SYS_swapon: ::c_long = 87; -pub const SYS_reboot: ::c_long = 88; -pub const SYS_readdir: ::c_long = 89; -pub const SYS_mmap: ::c_long = 90; -pub const SYS_munmap: ::c_long = 91; -pub const SYS_truncate: ::c_long = 92; -pub const SYS_ftruncate: ::c_long = 93; -pub const SYS_fchmod: ::c_long = 94; -pub const SYS_fchown: ::c_long = 95; -pub const SYS_getpriority: ::c_long = 96; -pub const SYS_setpriority: ::c_long = 97; -pub const SYS_profil: ::c_long = 98; -pub const SYS_statfs: ::c_long = 99; -pub const SYS_fstatfs: ::c_long = 100; -pub const SYS_ioperm: ::c_long = 101; -pub const SYS_socketcall: ::c_long = 102; -pub const SYS_syslog: ::c_long = 103; -pub const SYS_setitimer: ::c_long = 104; -pub const SYS_getitimer: ::c_long = 105; -pub const SYS_stat: ::c_long = 106; -pub const SYS_lstat: ::c_long = 107; -pub const SYS_fstat: ::c_long = 108; -pub const SYS_olduname: ::c_long = 109; -pub const SYS_iopl: ::c_long = 110; -pub const SYS_vhangup: ::c_long = 111; -pub const SYS_idle: ::c_long = 112; -pub const SYS_vm86: ::c_long = 113; -pub const SYS_wait4: ::c_long = 114; -pub const SYS_swapoff: ::c_long = 115; -pub const SYS_sysinfo: ::c_long = 116; -pub const SYS_ipc: ::c_long = 117; -pub const SYS_fsync: ::c_long = 118; -pub const SYS_sigreturn: ::c_long = 119; -pub const SYS_clone: ::c_long = 120; -pub const SYS_setdomainname: ::c_long = 121; -pub const SYS_uname: ::c_long = 122; -pub const SYS_modify_ldt: ::c_long = 123; -pub const SYS_adjtimex: ::c_long = 124; -pub const SYS_mprotect: ::c_long = 125; -pub const SYS_sigprocmask: ::c_long = 126; -pub const SYS_create_module: ::c_long = 127; -pub const SYS_init_module: ::c_long = 128; -pub const SYS_delete_module: ::c_long = 129; -pub const SYS_get_kernel_syms: ::c_long = 130; -pub const SYS_quotactl: ::c_long = 131; -pub const SYS_getpgid: ::c_long = 132; -pub const SYS_fchdir: ::c_long = 133; -pub const SYS_bdflush: ::c_long = 134; -pub const SYS_sysfs: ::c_long = 135; -pub const SYS_personality: ::c_long = 136; -pub const SYS_afs_syscall: ::c_long = 137; /* Syscall for Andrew File System */ -pub const SYS_setfsuid: ::c_long = 138; -pub const SYS_setfsgid: ::c_long = 139; -pub const SYS__llseek: ::c_long = 140; -pub const SYS_getdents: ::c_long = 141; -pub const SYS__newselect: ::c_long = 142; -pub const SYS_flock: ::c_long = 143; -pub const SYS_msync: ::c_long = 144; -pub const SYS_readv: ::c_long = 145; -pub const SYS_writev: ::c_long = 146; -pub const SYS_getsid: ::c_long = 147; -pub const SYS_fdatasync: ::c_long = 148; -pub const SYS__sysctl: ::c_long = 149; -pub const SYS_mlock: ::c_long = 150; -pub const SYS_munlock: ::c_long = 151; -pub const SYS_mlockall: ::c_long = 152; -pub const SYS_munlockall: ::c_long = 153; -pub const SYS_sched_setparam: ::c_long = 154; -pub const SYS_sched_getparam: ::c_long = 155; -pub const SYS_sched_setscheduler: ::c_long = 156; -pub const SYS_sched_getscheduler: ::c_long = 157; -pub const SYS_sched_yield: ::c_long = 158; -pub const SYS_sched_get_priority_max: ::c_long = 159; -pub const SYS_sched_get_priority_min: ::c_long = 160; -pub const SYS_sched_rr_get_interval: ::c_long = 161; -pub const SYS_nanosleep: ::c_long = 162; -pub const SYS_mremap: ::c_long = 163; -pub const SYS_setresuid: ::c_long = 164; -pub const SYS_getresuid: ::c_long = 165; -pub const SYS_query_module: ::c_long = 166; -pub const SYS_poll: ::c_long = 167; -pub const SYS_nfsservctl: ::c_long = 168; -pub const SYS_setresgid: ::c_long = 169; -pub const SYS_getresgid: ::c_long = 170; -pub const SYS_prctl: ::c_long = 171; -pub const SYS_rt_sigreturn: ::c_long = 172; -pub const SYS_rt_sigaction: ::c_long = 173; -pub const SYS_rt_sigprocmask: ::c_long = 174; -pub const SYS_rt_sigpending: ::c_long = 175; -pub const SYS_rt_sigtimedwait: ::c_long = 176; -pub const SYS_rt_sigqueueinfo: ::c_long = 177; -pub const SYS_rt_sigsuspend: ::c_long = 178; -pub const SYS_pread64: ::c_long = 179; -pub const SYS_pwrite64: ::c_long = 180; -pub const SYS_chown: ::c_long = 181; -pub const SYS_getcwd: ::c_long = 182; -pub const SYS_capget: ::c_long = 183; -pub const SYS_capset: ::c_long = 184; -pub const SYS_sigaltstack: ::c_long = 185; -pub const SYS_sendfile: ::c_long = 186; -pub const SYS_getpmsg: ::c_long = 187; /* some people actually want streams */ -pub const SYS_putpmsg: ::c_long = 188; /* some people actually want streams */ -pub const SYS_vfork: ::c_long = 189; -pub const SYS_ugetrlimit: ::c_long = 190; /* SuS compliant getrlimit */ -pub const SYS_readahead: ::c_long = 191; -pub const SYS_mmap2: ::c_long = 192; -pub const SYS_truncate64: ::c_long = 193; -pub const SYS_ftruncate64: ::c_long = 194; -pub const SYS_stat64: ::c_long = 195; -pub const SYS_lstat64: ::c_long = 196; -pub const SYS_fstat64: ::c_long = 197; -pub const SYS_pciconfig_read: ::c_long = 198; -pub const SYS_pciconfig_write: ::c_long = 199; -pub const SYS_pciconfig_iobase: ::c_long = 200; -pub const SYS_multiplexer: ::c_long = 201; -pub const SYS_getdents64: ::c_long = 202; -pub const SYS_pivot_root: ::c_long = 203; -pub const SYS_fcntl64: ::c_long = 204; -pub const SYS_madvise: ::c_long = 205; -pub const SYS_mincore: ::c_long = 206; -pub const SYS_gettid: ::c_long = 207; -pub const SYS_tkill: ::c_long = 208; -pub const SYS_setxattr: ::c_long = 209; -pub const SYS_lsetxattr: ::c_long = 210; -pub const SYS_fsetxattr: ::c_long = 211; -pub const SYS_getxattr: ::c_long = 212; -pub const SYS_lgetxattr: ::c_long = 213; -pub const SYS_fgetxattr: ::c_long = 214; -pub const SYS_listxattr: ::c_long = 215; -pub const SYS_llistxattr: ::c_long = 216; -pub const SYS_flistxattr: ::c_long = 217; -pub const SYS_removexattr: ::c_long = 218; -pub const SYS_lremovexattr: ::c_long = 219; -pub const SYS_fremovexattr: ::c_long = 220; -pub const SYS_futex: ::c_long = 221; -pub const SYS_sched_setaffinity: ::c_long = 222; -pub const SYS_sched_getaffinity: ::c_long = 223; -pub const SYS_tuxcall: ::c_long = 225; -pub const SYS_sendfile64: ::c_long = 226; -pub const SYS_io_setup: ::c_long = 227; -pub const SYS_io_destroy: ::c_long = 228; -pub const SYS_io_getevents: ::c_long = 229; -pub const SYS_io_submit: ::c_long = 230; -pub const SYS_io_cancel: ::c_long = 231; -pub const SYS_set_tid_address: ::c_long = 232; -pub const SYS_fadvise64: ::c_long = 233; -pub const SYS_exit_group: ::c_long = 234; -pub const SYS_lookup_dcookie: ::c_long = 235; -pub const SYS_epoll_create: ::c_long = 236; -pub const SYS_epoll_ctl: ::c_long = 237; -pub const SYS_epoll_wait: ::c_long = 238; -pub const SYS_remap_file_pages: ::c_long = 239; -pub const SYS_timer_create: ::c_long = 240; -pub const SYS_timer_settime: ::c_long = 241; -pub const SYS_timer_gettime: ::c_long = 242; -pub const SYS_timer_getoverrun: ::c_long = 243; -pub const SYS_timer_delete: ::c_long = 244; -pub const SYS_clock_settime: ::c_long = 245; -pub const SYS_clock_gettime: ::c_long = 246; -pub const SYS_clock_getres: ::c_long = 247; -pub const SYS_clock_nanosleep: ::c_long = 248; -pub const SYS_swapcontext: ::c_long = 249; -pub const SYS_tgkill: ::c_long = 250; -pub const SYS_utimes: ::c_long = 251; -pub const SYS_statfs64: ::c_long = 252; -pub const SYS_fstatfs64: ::c_long = 253; -pub const SYS_fadvise64_64: ::c_long = 254; -pub const SYS_rtas: ::c_long = 255; -pub const SYS_sys_debug_setcontext: ::c_long = 256; -pub const SYS_migrate_pages: ::c_long = 258; -pub const SYS_mbind: ::c_long = 259; -pub const SYS_get_mempolicy: ::c_long = 260; -pub const SYS_set_mempolicy: ::c_long = 261; -pub const SYS_mq_open: ::c_long = 262; -pub const SYS_mq_unlink: ::c_long = 263; -pub const SYS_mq_timedsend: ::c_long = 264; -pub const SYS_mq_timedreceive: ::c_long = 265; -pub const SYS_mq_notify: ::c_long = 266; -pub const SYS_mq_getsetattr: ::c_long = 267; -pub const SYS_kexec_load: ::c_long = 268; -pub const SYS_add_key: ::c_long = 269; -pub const SYS_request_key: ::c_long = 270; -pub const SYS_keyctl: ::c_long = 271; -pub const SYS_waitid: ::c_long = 272; -pub const SYS_ioprio_set: ::c_long = 273; -pub const SYS_ioprio_get: ::c_long = 274; -pub const SYS_inotify_init: ::c_long = 275; -pub const SYS_inotify_add_watch: ::c_long = 276; -pub const SYS_inotify_rm_watch: ::c_long = 277; -pub const SYS_spu_run: ::c_long = 278; -pub const SYS_spu_create: ::c_long = 279; -pub const SYS_pselect6: ::c_long = 280; -pub const SYS_ppoll: ::c_long = 281; -pub const SYS_unshare: ::c_long = 282; -pub const SYS_splice: ::c_long = 283; -pub const SYS_tee: ::c_long = 284; -pub const SYS_vmsplice: ::c_long = 285; -pub const SYS_openat: ::c_long = 286; -pub const SYS_mkdirat: ::c_long = 287; -pub const SYS_mknodat: ::c_long = 288; -pub const SYS_fchownat: ::c_long = 289; -pub const SYS_futimesat: ::c_long = 290; -pub const SYS_fstatat64: ::c_long = 291; -pub const SYS_unlinkat: ::c_long = 292; -pub const SYS_renameat: ::c_long = 293; -pub const SYS_linkat: ::c_long = 294; -pub const SYS_symlinkat: ::c_long = 295; -pub const SYS_readlinkat: ::c_long = 296; -pub const SYS_fchmodat: ::c_long = 297; -pub const SYS_faccessat: ::c_long = 298; -pub const SYS_get_robust_list: ::c_long = 299; -pub const SYS_set_robust_list: ::c_long = 300; -pub const SYS_move_pages: ::c_long = 301; -pub const SYS_getcpu: ::c_long = 302; -pub const SYS_epoll_pwait: ::c_long = 303; -pub const SYS_utimensat: ::c_long = 304; -pub const SYS_signalfd: ::c_long = 305; -pub const SYS_timerfd_create: ::c_long = 306; -pub const SYS_eventfd: ::c_long = 307; -pub const SYS_sync_file_range2: ::c_long = 308; -pub const SYS_fallocate: ::c_long = 309; -pub const SYS_subpage_prot: ::c_long = 310; -pub const SYS_timerfd_settime: ::c_long = 311; -pub const SYS_timerfd_gettime: ::c_long = 312; -pub const SYS_signalfd4: ::c_long = 313; -pub const SYS_eventfd2: ::c_long = 314; -pub const SYS_epoll_create1: ::c_long = 315; -pub const SYS_dup3: ::c_long = 316; -pub const SYS_pipe2: ::c_long = 317; -pub const SYS_inotify_init1: ::c_long = 318; -pub const SYS_perf_event_open: ::c_long = 319; -pub const SYS_preadv: ::c_long = 320; -pub const SYS_pwritev: ::c_long = 321; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 322; -pub const SYS_fanotify_init: ::c_long = 323; -pub const SYS_fanotify_mark: ::c_long = 324; -pub const SYS_prlimit64: ::c_long = 325; -pub const SYS_socket: ::c_long = 326; -pub const SYS_bind: ::c_long = 327; -pub const SYS_connect: ::c_long = 328; -pub const SYS_listen: ::c_long = 329; -pub const SYS_accept: ::c_long = 330; -pub const SYS_getsockname: ::c_long = 331; -pub const SYS_getpeername: ::c_long = 332; -pub const SYS_socketpair: ::c_long = 333; -pub const SYS_send: ::c_long = 334; -pub const SYS_sendto: ::c_long = 335; -pub const SYS_recv: ::c_long = 336; -pub const SYS_recvfrom: ::c_long = 337; -pub const SYS_shutdown: ::c_long = 338; -pub const SYS_setsockopt: ::c_long = 339; -pub const SYS_getsockopt: ::c_long = 340; -pub const SYS_sendmsg: ::c_long = 341; -pub const SYS_recvmsg: ::c_long = 342; -pub const SYS_recvmmsg: ::c_long = 343; -pub const SYS_accept4: ::c_long = 344; -pub const SYS_name_to_handle_at: ::c_long = 345; -pub const SYS_open_by_handle_at: ::c_long = 346; -pub const SYS_clock_adjtime: ::c_long = 347; -pub const SYS_syncfs: ::c_long = 348; -pub const SYS_sendmmsg: ::c_long = 349; -pub const SYS_setns: ::c_long = 350; -pub const SYS_process_vm_readv: ::c_long = 351; -pub const SYS_process_vm_writev: ::c_long = 352; -pub const SYS_finit_module: ::c_long = 353; -pub const SYS_kcmp: ::c_long = 354; -pub const SYS_sched_setattr: ::c_long = 355; -pub const SYS_sched_getattr: ::c_long = 356; -pub const SYS_renameat2: ::c_long = 357; -pub const SYS_seccomp: ::c_long = 358; -pub const SYS_getrandom: ::c_long = 359; -pub const SYS_memfd_create: ::c_long = 360; -pub const SYS_bpf: ::c_long = 361; -pub const SYS_execveat: ::c_long = 362; -pub const SYS_switch_endian: ::c_long = 363; -pub const SYS_userfaultfd: ::c_long = 364; -pub const SYS_membarrier: ::c_long = 365; -pub const SYS_mlock2: ::c_long = 378; -pub const SYS_copy_file_range: ::c_long = 379; -pub const SYS_preadv2: ::c_long = 380; -pub const SYS_pwritev2: ::c_long = 381; -pub const SYS_kexec_file_load: ::c_long = 382; diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b32/x86.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b32/x86.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b32/x86.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b32/x86.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,891 +0,0 @@ -pub type c_char = i8; -pub type wchar_t = i32; -pub type greg_t = i32; - -s! { - pub struct _libc_fpreg { - pub significand: [u16; 4], - pub exponent: u16, - } - - pub struct _libc_fpstate { - pub cw: ::c_ulong, - pub sw: ::c_ulong, - pub tag: ::c_ulong, - pub ipoff: ::c_ulong, - pub cssel: ::c_ulong, - pub dataoff: ::c_ulong, - pub datasel: ::c_ulong, - pub _st: [_libc_fpreg; 8], - pub status: ::c_ulong, - } - - pub struct user_fpregs_struct { - pub cwd: ::c_long, - pub swd: ::c_long, - pub twd: ::c_long, - pub fip: ::c_long, - pub fcs: ::c_long, - pub foo: ::c_long, - pub fos: ::c_long, - pub st_space: [::c_long; 20], - } - - pub struct user_regs_struct { - pub ebx: ::c_long, - pub ecx: ::c_long, - pub edx: ::c_long, - pub esi: ::c_long, - pub edi: ::c_long, - pub ebp: ::c_long, - pub eax: ::c_long, - pub xds: ::c_long, - pub xes: ::c_long, - pub xfs: ::c_long, - pub xgs: ::c_long, - pub orig_eax: ::c_long, - pub eip: ::c_long, - pub xcs: ::c_long, - pub eflags: ::c_long, - pub esp: ::c_long, - pub xss: ::c_long, - } - - pub struct user { - pub regs: user_regs_struct, - pub u_fpvalid: ::c_int, - pub i387: user_fpregs_struct, - pub u_tsize: ::c_ulong, - pub u_dsize: ::c_ulong, - pub u_ssize: ::c_ulong, - pub start_code: ::c_ulong, - pub start_stack: ::c_ulong, - pub signal: ::c_long, - __reserved: ::c_int, - pub u_ar0: *mut user_regs_struct, - pub u_fpstate: *mut user_fpregs_struct, - pub magic: ::c_ulong, - pub u_comm: [c_char; 32], - pub u_debugreg: [::c_int; 8], - } - - pub struct mcontext_t { - pub gregs: [greg_t; 19], - pub fpregs: *mut _libc_fpstate, - pub oldmask: ::c_ulong, - pub cr2: ::c_ulong, - } - - pub struct ipc_perm { - pub __key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::c_ushort, - __pad1: ::c_ushort, - pub __seq: ::c_ushort, - __pad2: ::c_ushort, - __unused1: ::c_ulong, - __unused2: ::c_ulong - } - - pub struct stat64 { - pub st_dev: ::dev_t, - __pad1: ::c_uint, - __st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __pad2: ::c_uint, - pub st_size: ::off64_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt64_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_ino: ::ino64_t, - } - - pub struct statfs64 { - pub f_type: ::__fsword_t, - pub f_bsize: ::__fsword_t, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_fsid: ::fsid_t, - pub f_namelen: ::__fsword_t, - pub f_frsize: ::__fsword_t, - pub f_flags: ::__fsword_t, - pub f_spare: [::__fsword_t; 4], - } - - pub struct statvfs64 { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_favail: u64, - pub f_fsid: ::c_ulong, - __f_unused: ::c_int, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct shmid_ds { - pub shm_perm: ::ipc_perm, - pub shm_segsz: ::size_t, - pub shm_atime: ::time_t, - __unused1: ::c_ulong, - pub shm_dtime: ::time_t, - __unused2: ::c_ulong, - pub shm_ctime: ::time_t, - __unused3: ::c_ulong, - pub shm_cpid: ::pid_t, - pub shm_lpid: ::pid_t, - pub shm_nattch: ::shmatt_t, - __unused4: ::c_ulong, - __unused5: ::c_ulong - } - - pub struct msqid_ds { - pub msg_perm: ::ipc_perm, - pub msg_stime: ::time_t, - __glibc_reserved1: ::c_ulong, - pub msg_rtime: ::time_t, - __glibc_reserved2: ::c_ulong, - pub msg_ctime: ::time_t, - __glibc_reserved3: ::c_ulong, - __msg_cbytes: ::c_ulong, - pub msg_qnum: ::msgqnum_t, - pub msg_qbytes: ::msglen_t, - pub msg_lspid: ::pid_t, - pub msg_lrpid: ::pid_t, - __glibc_reserved4: ::c_ulong, - __glibc_reserved5: ::c_ulong, - } - - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 19], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } -} - -s_no_extra_traits!{ - pub struct user_fpxregs_struct { - pub cwd: ::c_ushort, - pub swd: ::c_ushort, - pub twd: ::c_ushort, - pub fop: ::c_ushort, - pub fip: ::c_long, - pub fcs: ::c_long, - pub foo: ::c_long, - pub fos: ::c_long, - pub mxcsr: ::c_long, - __reserved: ::c_long, - pub st_space: [::c_long; 32], - pub xmm_space: [::c_long; 32], - padding: [::c_long; 56], - } - - pub struct ucontext_t { - pub uc_flags: ::c_ulong, - pub uc_link: *mut ucontext_t, - pub uc_stack: ::stack_t, - pub uc_mcontext: mcontext_t, - pub uc_sigmask: ::sigset_t, - __private: [u8; 112], - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for user_fpxregs_struct { - fn eq(&self, other: &user_fpxregs_struct) -> bool { - self.cwd == other.cwd - && self.swd == other.swd - && self.twd == other.twd - && self.fop == other.fop - && self.fip == other.fip - && self.fcs == other.fcs - && self.foo == other.foo - && self.fos == other.fos - && self.mxcsr == other.mxcsr - // Ignore __reserved field - && self.st_space == other.st_space - && self.xmm_space == other.xmm_space - // Ignore padding field - } - } - - impl Eq for user_fpxregs_struct {} - - impl ::fmt::Debug for user_fpxregs_struct { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("user_fpxregs_struct") - .field("cwd", &self.cwd) - .field("swd", &self.swd) - .field("twd", &self.twd) - .field("fop", &self.fop) - .field("fip", &self.fip) - .field("fcs", &self.fcs) - .field("foo", &self.foo) - .field("fos", &self.fos) - .field("mxcsr", &self.mxcsr) - // Ignore __reserved field - .field("st_space", &self.st_space) - .field("xmm_space", &self.xmm_space) - // Ignore padding field - .finish() - } - } - - impl ::hash::Hash for user_fpxregs_struct { - fn hash(&self, state: &mut H) { - self.cwd.hash(state); - self.swd.hash(state); - self.twd.hash(state); - self.fop.hash(state); - self.fip.hash(state); - self.fcs.hash(state); - self.foo.hash(state); - self.fos.hash(state); - self.mxcsr.hash(state); - // Ignore __reserved field - self.st_space.hash(state); - self.xmm_space.hash(state); - // Ignore padding field - } - } - - impl PartialEq for ucontext_t { - fn eq(&self, other: &ucontext_t) -> bool { - self.uc_flags == other.uc_flags - && self.uc_link == other.uc_link - && self.uc_stack == other.uc_stack - && self.uc_mcontext == other.uc_mcontext - && self.uc_sigmask == other.uc_sigmask - // Ignore __private field - } - } - - impl Eq for ucontext_t {} - - impl ::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ucontext_t") - .field("uc_flags", &self.uc_flags) - .field("uc_link", &self.uc_link) - .field("uc_stack", &self.uc_stack) - .field("uc_mcontext", &self.uc_mcontext) - .field("uc_sigmask", &self.uc_sigmask) - // Ignore __private field - .finish() - } - } - - impl ::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { - self.uc_flags.hash(state); - self.uc_link.hash(state); - self.uc_stack.hash(state); - self.uc_mcontext.hash(state); - self.uc_sigmask.hash(state); - // Ignore __private field - } - } - } -} - -pub const O_DIRECT: ::c_int = 0x4000; -pub const O_DIRECTORY: ::c_int = 0x10000; -pub const O_NOFOLLOW: ::c_int = 0x20000; -pub const O_LARGEFILE: ::c_int = 0o0100000; - -pub const MAP_LOCKED: ::c_int = 0x02000; -pub const MAP_NORESERVE: ::c_int = 0x04000; -pub const MAP_32BIT: ::c_int = 0x0040; - -pub const EDEADLOCK: ::c_int = 35; - -pub const SO_SNDBUFFORCE: ::c_int = 32; -pub const SO_RCVBUFFORCE: ::c_int = 33; -pub const SO_NO_CHECK: ::c_int = 11; -pub const SO_PASSCRED: ::c_int = 16; -pub const SO_PEERCRED: ::c_int = 17; -pub const SO_RCVLOWAT: ::c_int = 18; -pub const SO_SNDLOWAT: ::c_int = 19; -pub const SO_RCVTIMEO: ::c_int = 20; -pub const SO_SNDTIMEO: ::c_int = 21; - -pub const FIOCLEX: ::c_ulong = 0x5451; -pub const FIONBIO: ::c_ulong = 0x5421; - -pub const PTRACE_GETFPXREGS: ::c_uint = 18; -pub const PTRACE_SETFPXREGS: ::c_uint = 19; - -pub const MCL_CURRENT: ::c_int = 0x0001; -pub const MCL_FUTURE: ::c_int = 0x0002; - -pub const SIGSTKSZ: ::size_t = 8192; -pub const MINSIGSTKSZ: ::size_t = 2048; -pub const CBAUD: ::tcflag_t = 0o0010017; -pub const TAB1: ::c_int = 0x00000800; -pub const TAB2: ::c_int = 0x00001000; -pub const TAB3: ::c_int = 0x00001800; -pub const CR1: ::c_int = 0x00000200; -pub const CR2: ::c_int = 0x00000400; -pub const CR3: ::c_int = 0x00000600; -pub const FF1: ::c_int = 0x00008000; -pub const BS1: ::c_int = 0x00002000; -pub const VT1: ::c_int = 0x00004000; -pub const VWERASE: usize = 14; -pub const VREPRINT: usize = 12; -pub const VSUSP: usize = 10; -pub const VSTART: usize = 8; -pub const VSTOP: usize = 9; -pub const VDISCARD: usize = 13; -pub const VTIME: usize = 5; -pub const IXON: ::tcflag_t = 0x00000400; -pub const IXOFF: ::tcflag_t = 0x00001000; -pub const ONLCR: ::tcflag_t = 0x4; -pub const CSIZE: ::tcflag_t = 0x00000030; -pub const CS6: ::tcflag_t = 0x00000010; -pub const CS7: ::tcflag_t = 0x00000020; -pub const CS8: ::tcflag_t = 0x00000030; -pub const CSTOPB: ::tcflag_t = 0x00000040; -pub const CREAD: ::tcflag_t = 0x00000080; -pub const PARENB: ::tcflag_t = 0x00000100; -pub const PARODD: ::tcflag_t = 0x00000200; -pub const HUPCL: ::tcflag_t = 0x00000400; -pub const CLOCAL: ::tcflag_t = 0x00000800; -pub const ECHOKE: ::tcflag_t = 0x00000800; -pub const ECHOE: ::tcflag_t = 0x00000010; -pub const ECHOK: ::tcflag_t = 0x00000020; -pub const ECHONL: ::tcflag_t = 0x00000040; -pub const ECHOPRT: ::tcflag_t = 0x00000400; -pub const ECHOCTL: ::tcflag_t = 0x00000200; -pub const ISIG: ::tcflag_t = 0x00000001; -pub const ICANON: ::tcflag_t = 0x00000002; -pub const PENDIN: ::tcflag_t = 0x00004000; -pub const NOFLSH: ::tcflag_t = 0x00000080; -pub const CIBAUD: ::tcflag_t = 0o02003600000; -pub const CBAUDEX: ::tcflag_t = 0o010000; -pub const VSWTC: usize = 7; -pub const OLCUC: ::tcflag_t = 0o000002; -pub const NLDLY: ::tcflag_t = 0o000400; -pub const CRDLY: ::tcflag_t = 0o003000; -pub const TABDLY: ::tcflag_t = 0o014000; -pub const BSDLY: ::tcflag_t = 0o020000; -pub const FFDLY: ::tcflag_t = 0o100000; -pub const VTDLY: ::tcflag_t = 0o040000; -pub const XTABS: ::tcflag_t = 0o014000; - -pub const B0: ::speed_t = 0o000000; -pub const B50: ::speed_t = 0o000001; -pub const B75: ::speed_t = 0o000002; -pub const B110: ::speed_t = 0o000003; -pub const B134: ::speed_t = 0o000004; -pub const B150: ::speed_t = 0o000005; -pub const B200: ::speed_t = 0o000006; -pub const B300: ::speed_t = 0o000007; -pub const B600: ::speed_t = 0o000010; -pub const B1200: ::speed_t = 0o000011; -pub const B1800: ::speed_t = 0o000012; -pub const B2400: ::speed_t = 0o000013; -pub const B4800: ::speed_t = 0o000014; -pub const B9600: ::speed_t = 0o000015; -pub const B19200: ::speed_t = 0o000016; -pub const B38400: ::speed_t = 0o000017; -pub const EXTA: ::speed_t = B19200; -pub const EXTB: ::speed_t = B38400; -pub const BOTHER: ::speed_t = 0o010000; -pub const B57600: ::speed_t = 0o010001; -pub const B115200: ::speed_t = 0o010002; -pub const B230400: ::speed_t = 0o010003; -pub const B460800: ::speed_t = 0o010004; -pub const B500000: ::speed_t = 0o010005; -pub const B576000: ::speed_t = 0o010006; -pub const B921600: ::speed_t = 0o010007; -pub const B1000000: ::speed_t = 0o010010; -pub const B1152000: ::speed_t = 0o010011; -pub const B1500000: ::speed_t = 0o010012; -pub const B2000000: ::speed_t = 0o010013; -pub const B2500000: ::speed_t = 0o010014; -pub const B3000000: ::speed_t = 0o010015; -pub const B3500000: ::speed_t = 0o010016; -pub const B4000000: ::speed_t = 0o010017; - -pub const VEOL: usize = 11; -pub const VEOL2: usize = 16; -pub const VMIN: usize = 6; -pub const IEXTEN: ::tcflag_t = 0x00008000; -pub const TOSTOP: ::tcflag_t = 0x00000100; -pub const FLUSHO: ::tcflag_t = 0x00001000; -pub const EXTPROC: ::tcflag_t = 0x00010000; -pub const TCGETS: ::c_ulong = 0x5401; -pub const TCSETS: ::c_ulong = 0x5402; -pub const TCSETSW: ::c_ulong = 0x5403; -pub const TCSETSF: ::c_ulong = 0x5404; -pub const TCGETA: ::c_ulong = 0x5405; -pub const TCSETA: ::c_ulong = 0x5406; -pub const TCSETAW: ::c_ulong = 0x5407; -pub const TCSETAF: ::c_ulong = 0x5408; -pub const TCSBRK: ::c_ulong = 0x5409; -pub const TCXONC: ::c_ulong = 0x540A; -pub const TCFLSH: ::c_ulong = 0x540B; -pub const TIOCINQ: ::c_ulong = 0x541B; -pub const TIOCGPGRP: ::c_ulong = 0x540F; -pub const TIOCSPGRP: ::c_ulong = 0x5410; -pub const TIOCOUTQ: ::c_ulong = 0x5411; -pub const TIOCGWINSZ: ::c_ulong = 0x5413; -pub const TIOCSWINSZ: ::c_ulong = 0x5414; -pub const FIONREAD: ::c_ulong = 0x541B; - -// Syscall table -pub const SYS_restart_syscall: ::c_long = 0; -pub const SYS_exit: ::c_long = 1; -pub const SYS_fork: ::c_long = 2; -pub const SYS_read: ::c_long = 3; -pub const SYS_write: ::c_long = 4; -pub const SYS_open: ::c_long = 5; -pub const SYS_close: ::c_long = 6; -pub const SYS_waitpid: ::c_long = 7; -pub const SYS_creat: ::c_long = 8; -pub const SYS_link: ::c_long = 9; -pub const SYS_unlink: ::c_long = 10; -pub const SYS_execve: ::c_long = 11; -pub const SYS_chdir: ::c_long = 12; -pub const SYS_time: ::c_long = 13; -pub const SYS_mknod: ::c_long = 14; -pub const SYS_chmod: ::c_long = 15; -pub const SYS_lchown: ::c_long = 16; -pub const SYS_break: ::c_long = 17; -pub const SYS_oldstat: ::c_long = 18; -pub const SYS_lseek: ::c_long = 19; -pub const SYS_getpid: ::c_long = 20; -pub const SYS_mount: ::c_long = 21; -pub const SYS_umount: ::c_long = 22; -pub const SYS_setuid: ::c_long = 23; -pub const SYS_getuid: ::c_long = 24; -pub const SYS_stime: ::c_long = 25; -pub const SYS_ptrace: ::c_long = 26; -pub const SYS_alarm: ::c_long = 27; -pub const SYS_oldfstat: ::c_long = 28; -pub const SYS_pause: ::c_long = 29; -pub const SYS_utime: ::c_long = 30; -pub const SYS_stty: ::c_long = 31; -pub const SYS_gtty: ::c_long = 32; -pub const SYS_access: ::c_long = 33; -pub const SYS_nice: ::c_long = 34; -pub const SYS_ftime: ::c_long = 35; -pub const SYS_sync: ::c_long = 36; -pub const SYS_kill: ::c_long = 37; -pub const SYS_rename: ::c_long = 38; -pub const SYS_mkdir: ::c_long = 39; -pub const SYS_rmdir: ::c_long = 40; -pub const SYS_dup: ::c_long = 41; -pub const SYS_pipe: ::c_long = 42; -pub const SYS_times: ::c_long = 43; -pub const SYS_prof: ::c_long = 44; -pub const SYS_brk: ::c_long = 45; -pub const SYS_setgid: ::c_long = 46; -pub const SYS_getgid: ::c_long = 47; -pub const SYS_signal: ::c_long = 48; -pub const SYS_geteuid: ::c_long = 49; -pub const SYS_getegid: ::c_long = 50; -pub const SYS_acct: ::c_long = 51; -pub const SYS_umount2: ::c_long = 52; -pub const SYS_lock: ::c_long = 53; -pub const SYS_ioctl: ::c_long = 54; -pub const SYS_fcntl: ::c_long = 55; -pub const SYS_mpx: ::c_long = 56; -pub const SYS_setpgid: ::c_long = 57; -pub const SYS_ulimit: ::c_long = 58; -pub const SYS_oldolduname: ::c_long = 59; -pub const SYS_umask: ::c_long = 60; -pub const SYS_chroot: ::c_long = 61; -pub const SYS_ustat: ::c_long = 62; -pub const SYS_dup2: ::c_long = 63; -pub const SYS_getppid: ::c_long = 64; -pub const SYS_getpgrp: ::c_long = 65; -pub const SYS_setsid: ::c_long = 66; -pub const SYS_sigaction: ::c_long = 67; -pub const SYS_sgetmask: ::c_long = 68; -pub const SYS_ssetmask: ::c_long = 69; -pub const SYS_setreuid: ::c_long = 70; -pub const SYS_setregid: ::c_long = 71; -pub const SYS_sigsuspend: ::c_long = 72; -pub const SYS_sigpending: ::c_long = 73; -pub const SYS_sethostname: ::c_long = 74; -pub const SYS_setrlimit: ::c_long = 75; -pub const SYS_getrlimit: ::c_long = 76; -pub const SYS_getrusage: ::c_long = 77; -pub const SYS_gettimeofday: ::c_long = 78; -pub const SYS_settimeofday: ::c_long = 79; -pub const SYS_getgroups: ::c_long = 80; -pub const SYS_setgroups: ::c_long = 81; -pub const SYS_select: ::c_long = 82; -pub const SYS_symlink: ::c_long = 83; -pub const SYS_oldlstat: ::c_long = 84; -pub const SYS_readlink: ::c_long = 85; -pub const SYS_uselib: ::c_long = 86; -pub const SYS_swapon: ::c_long = 87; -pub const SYS_reboot: ::c_long = 88; -pub const SYS_readdir: ::c_long = 89; -pub const SYS_mmap: ::c_long = 90; -pub const SYS_munmap: ::c_long = 91; -pub const SYS_truncate: ::c_long = 92; -pub const SYS_ftruncate: ::c_long = 93; -pub const SYS_fchmod: ::c_long = 94; -pub const SYS_fchown: ::c_long = 95; -pub const SYS_getpriority: ::c_long = 96; -pub const SYS_setpriority: ::c_long = 97; -pub const SYS_profil: ::c_long = 98; -pub const SYS_statfs: ::c_long = 99; -pub const SYS_fstatfs: ::c_long = 100; -pub const SYS_ioperm: ::c_long = 101; -pub const SYS_socketcall: ::c_long = 102; -pub const SYS_syslog: ::c_long = 103; -pub const SYS_setitimer: ::c_long = 104; -pub const SYS_getitimer: ::c_long = 105; -pub const SYS_stat: ::c_long = 106; -pub const SYS_lstat: ::c_long = 107; -pub const SYS_fstat: ::c_long = 108; -pub const SYS_olduname: ::c_long = 109; -pub const SYS_iopl: ::c_long = 110; -pub const SYS_vhangup: ::c_long = 111; -pub const SYS_idle: ::c_long = 112; -pub const SYS_vm86old: ::c_long = 113; -pub const SYS_wait4: ::c_long = 114; -pub const SYS_swapoff: ::c_long = 115; -pub const SYS_sysinfo: ::c_long = 116; -pub const SYS_ipc: ::c_long = 117; -pub const SYS_fsync: ::c_long = 118; -pub const SYS_sigreturn: ::c_long = 119; -pub const SYS_clone: ::c_long = 120; -pub const SYS_setdomainname: ::c_long = 121; -pub const SYS_uname: ::c_long = 122; -pub const SYS_modify_ldt: ::c_long = 123; -pub const SYS_adjtimex: ::c_long = 124; -pub const SYS_mprotect: ::c_long = 125; -pub const SYS_sigprocmask: ::c_long = 126; -pub const SYS_create_module: ::c_long = 127; -pub const SYS_init_module: ::c_long = 128; -pub const SYS_delete_module: ::c_long = 129; -pub const SYS_get_kernel_syms: ::c_long = 130; -pub const SYS_quotactl: ::c_long = 131; -pub const SYS_getpgid: ::c_long = 132; -pub const SYS_fchdir: ::c_long = 133; -pub const SYS_bdflush: ::c_long = 134; -pub const SYS_sysfs: ::c_long = 135; -pub const SYS_personality: ::c_long = 136; -pub const SYS_afs_syscall: ::c_long = 137; -pub const SYS_setfsuid: ::c_long = 138; -pub const SYS_setfsgid: ::c_long = 139; -pub const SYS__llseek: ::c_long = 140; -pub const SYS_getdents: ::c_long = 141; -pub const SYS__newselect: ::c_long = 142; -pub const SYS_flock: ::c_long = 143; -pub const SYS_msync: ::c_long = 144; -pub const SYS_readv: ::c_long = 145; -pub const SYS_writev: ::c_long = 146; -pub const SYS_getsid: ::c_long = 147; -pub const SYS_fdatasync: ::c_long = 148; -pub const SYS__sysctl: ::c_long = 149; -pub const SYS_mlock: ::c_long = 150; -pub const SYS_munlock: ::c_long = 151; -pub const SYS_mlockall: ::c_long = 152; -pub const SYS_munlockall: ::c_long = 153; -pub const SYS_sched_setparam: ::c_long = 154; -pub const SYS_sched_getparam: ::c_long = 155; -pub const SYS_sched_setscheduler: ::c_long = 156; -pub const SYS_sched_getscheduler: ::c_long = 157; -pub const SYS_sched_yield: ::c_long = 158; -pub const SYS_sched_get_priority_max: ::c_long = 159; -pub const SYS_sched_get_priority_min: ::c_long = 160; -pub const SYS_sched_rr_get_interval: ::c_long = 161; -pub const SYS_nanosleep: ::c_long = 162; -pub const SYS_mremap: ::c_long = 163; -pub const SYS_setresuid: ::c_long = 164; -pub const SYS_getresuid: ::c_long = 165; -pub const SYS_vm86: ::c_long = 166; -pub const SYS_query_module: ::c_long = 167; -pub const SYS_poll: ::c_long = 168; -pub const SYS_nfsservctl: ::c_long = 169; -pub const SYS_setresgid: ::c_long = 170; -pub const SYS_getresgid: ::c_long = 171; -pub const SYS_prctl: ::c_long = 172; -pub const SYS_rt_sigreturn: ::c_long = 173; -pub const SYS_rt_sigaction: ::c_long = 174; -pub const SYS_rt_sigprocmask: ::c_long = 175; -pub const SYS_rt_sigpending: ::c_long = 176; -pub const SYS_rt_sigtimedwait: ::c_long = 177; -pub const SYS_rt_sigqueueinfo: ::c_long = 178; -pub const SYS_rt_sigsuspend: ::c_long = 179; -pub const SYS_pread64: ::c_long = 180; -pub const SYS_pwrite64: ::c_long = 181; -pub const SYS_chown: ::c_long = 182; -pub const SYS_getcwd: ::c_long = 183; -pub const SYS_capget: ::c_long = 184; -pub const SYS_capset: ::c_long = 185; -pub const SYS_sigaltstack: ::c_long = 186; -pub const SYS_sendfile: ::c_long = 187; -pub const SYS_getpmsg: ::c_long = 188; -pub const SYS_putpmsg: ::c_long = 189; -pub const SYS_vfork: ::c_long = 190; -pub const SYS_ugetrlimit: ::c_long = 191; -pub const SYS_mmap2: ::c_long = 192; -pub const SYS_truncate64: ::c_long = 193; -pub const SYS_ftruncate64: ::c_long = 194; -pub const SYS_stat64: ::c_long = 195; -pub const SYS_lstat64: ::c_long = 196; -pub const SYS_fstat64: ::c_long = 197; -pub const SYS_lchown32: ::c_long = 198; -pub const SYS_getuid32: ::c_long = 199; -pub const SYS_getgid32: ::c_long = 200; -pub const SYS_geteuid32: ::c_long = 201; -pub const SYS_getegid32: ::c_long = 202; -pub const SYS_setreuid32: ::c_long = 203; -pub const SYS_setregid32: ::c_long = 204; -pub const SYS_getgroups32: ::c_long = 205; -pub const SYS_setgroups32: ::c_long = 206; -pub const SYS_fchown32: ::c_long = 207; -pub const SYS_setresuid32: ::c_long = 208; -pub const SYS_getresuid32: ::c_long = 209; -pub const SYS_setresgid32: ::c_long = 210; -pub const SYS_getresgid32: ::c_long = 211; -pub const SYS_chown32: ::c_long = 212; -pub const SYS_setuid32: ::c_long = 213; -pub const SYS_setgid32: ::c_long = 214; -pub const SYS_setfsuid32: ::c_long = 215; -pub const SYS_setfsgid32: ::c_long = 216; -pub const SYS_pivot_root: ::c_long = 217; -pub const SYS_mincore: ::c_long = 218; -pub const SYS_madvise: ::c_long = 219; -pub const SYS_getdents64: ::c_long = 220; -pub const SYS_fcntl64: ::c_long = 221; -pub const SYS_gettid: ::c_long = 224; -pub const SYS_readahead: ::c_long = 225; -pub const SYS_setxattr: ::c_long = 226; -pub const SYS_lsetxattr: ::c_long = 227; -pub const SYS_fsetxattr: ::c_long = 228; -pub const SYS_getxattr: ::c_long = 229; -pub const SYS_lgetxattr: ::c_long = 230; -pub const SYS_fgetxattr: ::c_long = 231; -pub const SYS_listxattr: ::c_long = 232; -pub const SYS_llistxattr: ::c_long = 233; -pub const SYS_flistxattr: ::c_long = 234; -pub const SYS_removexattr: ::c_long = 235; -pub const SYS_lremovexattr: ::c_long = 236; -pub const SYS_fremovexattr: ::c_long = 237; -pub const SYS_tkill: ::c_long = 238; -pub const SYS_sendfile64: ::c_long = 239; -pub const SYS_futex: ::c_long = 240; -pub const SYS_sched_setaffinity: ::c_long = 241; -pub const SYS_sched_getaffinity: ::c_long = 242; -pub const SYS_set_thread_area: ::c_long = 243; -pub const SYS_get_thread_area: ::c_long = 244; -pub const SYS_io_setup: ::c_long = 245; -pub const SYS_io_destroy: ::c_long = 246; -pub const SYS_io_getevents: ::c_long = 247; -pub const SYS_io_submit: ::c_long = 248; -pub const SYS_io_cancel: ::c_long = 249; -pub const SYS_fadvise64: ::c_long = 250; -pub const SYS_exit_group: ::c_long = 252; -pub const SYS_lookup_dcookie: ::c_long = 253; -pub const SYS_epoll_create: ::c_long = 254; -pub const SYS_epoll_ctl: ::c_long = 255; -pub const SYS_epoll_wait: ::c_long = 256; -pub const SYS_remap_file_pages: ::c_long = 257; -pub const SYS_set_tid_address: ::c_long = 258; -pub const SYS_timer_create: ::c_long = 259; -pub const SYS_timer_settime: ::c_long = 260; -pub const SYS_timer_gettime: ::c_long = 261; -pub const SYS_timer_getoverrun: ::c_long = 262; -pub const SYS_timer_delete: ::c_long = 263; -pub const SYS_clock_settime: ::c_long = 264; -pub const SYS_clock_gettime: ::c_long = 265; -pub const SYS_clock_getres: ::c_long = 266; -pub const SYS_clock_nanosleep: ::c_long = 267; -pub const SYS_statfs64: ::c_long = 268; -pub const SYS_fstatfs64: ::c_long = 269; -pub const SYS_tgkill: ::c_long = 270; -pub const SYS_utimes: ::c_long = 271; -pub const SYS_fadvise64_64: ::c_long = 272; -pub const SYS_vserver: ::c_long = 273; -pub const SYS_mbind: ::c_long = 274; -pub const SYS_get_mempolicy: ::c_long = 275; -pub const SYS_set_mempolicy: ::c_long = 276; -pub const SYS_mq_open: ::c_long = 277; -pub const SYS_mq_unlink: ::c_long = 278; -pub const SYS_mq_timedsend: ::c_long = 279; -pub const SYS_mq_timedreceive: ::c_long = 280; -pub const SYS_mq_notify: ::c_long = 281; -pub const SYS_mq_getsetattr: ::c_long = 282; -pub const SYS_kexec_load: ::c_long = 283; -pub const SYS_waitid: ::c_long = 284; -pub const SYS_add_key: ::c_long = 286; -pub const SYS_request_key: ::c_long = 287; -pub const SYS_keyctl: ::c_long = 288; -pub const SYS_ioprio_set: ::c_long = 289; -pub const SYS_ioprio_get: ::c_long = 290; -pub const SYS_inotify_init: ::c_long = 291; -pub const SYS_inotify_add_watch: ::c_long = 292; -pub const SYS_inotify_rm_watch: ::c_long = 293; -pub const SYS_migrate_pages: ::c_long = 294; -pub const SYS_openat: ::c_long = 295; -pub const SYS_mkdirat: ::c_long = 296; -pub const SYS_mknodat: ::c_long = 297; -pub const SYS_fchownat: ::c_long = 298; -pub const SYS_futimesat: ::c_long = 299; -pub const SYS_fstatat64: ::c_long = 300; -pub const SYS_unlinkat: ::c_long = 301; -pub const SYS_renameat: ::c_long = 302; -pub const SYS_linkat: ::c_long = 303; -pub const SYS_symlinkat: ::c_long = 304; -pub const SYS_readlinkat: ::c_long = 305; -pub const SYS_fchmodat: ::c_long = 306; -pub const SYS_faccessat: ::c_long = 307; -pub const SYS_pselect6: ::c_long = 308; -pub const SYS_ppoll: ::c_long = 309; -pub const SYS_unshare: ::c_long = 310; -pub const SYS_set_robust_list: ::c_long = 311; -pub const SYS_get_robust_list: ::c_long = 312; -pub const SYS_splice: ::c_long = 313; -pub const SYS_sync_file_range: ::c_long = 314; -pub const SYS_tee: ::c_long = 315; -pub const SYS_vmsplice: ::c_long = 316; -pub const SYS_move_pages: ::c_long = 317; -pub const SYS_getcpu: ::c_long = 318; -pub const SYS_epoll_pwait: ::c_long = 319; -pub const SYS_utimensat: ::c_long = 320; -pub const SYS_signalfd: ::c_long = 321; -pub const SYS_timerfd_create: ::c_long = 322; -pub const SYS_eventfd: ::c_long = 323; -pub const SYS_fallocate: ::c_long = 324; -pub const SYS_timerfd_settime: ::c_long = 325; -pub const SYS_timerfd_gettime: ::c_long = 326; -pub const SYS_signalfd4: ::c_long = 327; -pub const SYS_eventfd2: ::c_long = 328; -pub const SYS_epoll_create1: ::c_long = 329; -pub const SYS_dup3: ::c_long = 330; -pub const SYS_pipe2: ::c_long = 331; -pub const SYS_inotify_init1: ::c_long = 332; -pub const SYS_preadv: ::c_long = 333; -pub const SYS_pwritev: ::c_long = 334; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 335; -pub const SYS_perf_event_open: ::c_long = 336; -pub const SYS_recvmmsg: ::c_long = 337; -pub const SYS_fanotify_init: ::c_long = 338; -pub const SYS_fanotify_mark: ::c_long = 339; -pub const SYS_prlimit64: ::c_long = 340; -pub const SYS_name_to_handle_at: ::c_long = 341; -pub const SYS_open_by_handle_at: ::c_long = 342; -pub const SYS_clock_adjtime: ::c_long = 343; -pub const SYS_syncfs: ::c_long = 344; -pub const SYS_sendmmsg: ::c_long = 345; -pub const SYS_setns: ::c_long = 346; -pub const SYS_process_vm_readv: ::c_long = 347; -pub const SYS_process_vm_writev: ::c_long = 348; -pub const SYS_kcmp: ::c_long = 349; -pub const SYS_finit_module: ::c_long = 350; -pub const SYS_sched_setattr: ::c_long = 351; -pub const SYS_sched_getattr: ::c_long = 352; -pub const SYS_renameat2: ::c_long = 353; -pub const SYS_seccomp: ::c_long = 354; -pub const SYS_getrandom: ::c_long = 355; -pub const SYS_memfd_create: ::c_long = 356; -pub const SYS_bpf: ::c_long = 357; -pub const SYS_execveat: ::c_long = 358; -pub const SYS_socket: ::c_long = 359; -pub const SYS_socketpair: ::c_long = 360; -pub const SYS_bind: ::c_long = 361; -pub const SYS_connect: ::c_long = 362; -pub const SYS_listen: ::c_long = 363; -pub const SYS_accept4: ::c_long = 364; -pub const SYS_getsockopt: ::c_long = 365; -pub const SYS_setsockopt: ::c_long = 366; -pub const SYS_getsockname: ::c_long = 367; -pub const SYS_getpeername: ::c_long = 368; -pub const SYS_sendto: ::c_long = 369; -pub const SYS_sendmsg: ::c_long = 370; -pub const SYS_recvfrom: ::c_long = 371; -pub const SYS_recvmsg: ::c_long = 372; -pub const SYS_shutdown: ::c_long = 373; -pub const SYS_userfaultfd: ::c_long = 374; -pub const SYS_membarrier: ::c_long = 375; -pub const SYS_mlock2: ::c_long = 376; -pub const SYS_copy_file_range: ::c_long = 377; -pub const SYS_preadv2: ::c_long = 378; -pub const SYS_pwritev2: ::c_long = 379; -pub const SYS_pkey_mprotect: ::c_long = 380; -pub const SYS_pkey_alloc: ::c_long = 381; -pub const SYS_pkey_free: ::c_long = 382; - -// offsets in user_regs_structs, from sys/reg.h -pub const EBX: ::c_int = 0; -pub const ECX: ::c_int = 1; -pub const EDX: ::c_int = 2; -pub const ESI: ::c_int = 3; -pub const EDI: ::c_int = 4; -pub const EBP: ::c_int = 5; -pub const EAX: ::c_int = 6; -pub const DS: ::c_int = 7; -pub const ES: ::c_int = 8; -pub const FS: ::c_int = 9; -pub const GS: ::c_int = 10; -pub const ORIG_EAX: ::c_int = 11; -pub const EIP: ::c_int = 12; -pub const CS: ::c_int = 13; -pub const EFL: ::c_int = 14; -pub const UESP: ::c_int = 15; -pub const SS: ::c_int = 16; - -// offsets in mcontext_t.gregs from sys/ucontext.h -pub const REG_GS: ::c_int = 0; -pub const REG_FS: ::c_int = 1; -pub const REG_ES: ::c_int = 2; -pub const REG_DS: ::c_int = 3; -pub const REG_EDI: ::c_int = 4; -pub const REG_ESI: ::c_int = 5; -pub const REG_EBP: ::c_int = 6; -pub const REG_ESP: ::c_int = 7; -pub const REG_EBX: ::c_int = 8; -pub const REG_EDX: ::c_int = 9; -pub const REG_ECX: ::c_int = 10; -pub const REG_EAX: ::c_int = 11; -pub const REG_TRAPNO: ::c_int = 12; -pub const REG_ERR: ::c_int = 13; -pub const REG_EIP: ::c_int = 14; -pub const REG_CS: ::c_int = 15; -pub const REG_EFL: ::c_int = 16; -pub const REG_UESP: ::c_int = 17; -pub const REG_SS: ::c_int = 18; - -extern { - pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int; - pub fn setcontext(ucp: *const ucontext_t) -> ::c_int; - pub fn makecontext(ucp: *mut ucontext_t, - func: extern fn (), - argc: ::c_int, ...); - pub fn swapcontext(uocp: *mut ucontext_t, - ucp: *const ucontext_t) -> ::c_int; -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b64/aarch64.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b64/aarch64.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b64/aarch64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b64/aarch64.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,832 +0,0 @@ -//! AArch64-specific definitions for 64-bit linux-like values - -use pthread_mutex_t; - -pub type c_long = i64; -pub type c_ulong = u64; -pub type c_char = u8; -pub type wchar_t = u32; -pub type nlink_t = u32; -pub type blksize_t = i32; -pub type suseconds_t = i64; -pub type __u64 = ::c_ulonglong; - -s! { - pub struct stat { - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __pad1: ::dev_t, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - __pad2: ::c_int, - pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - __unused: [::c_int; 2], - } - - pub struct stat64 { - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __pad1: ::dev_t, - pub st_size: ::off64_t, - pub st_blksize: ::blksize_t, - __pad2: ::c_int, - pub st_blocks: ::blkcnt64_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - __unused: [::c_int; 2], - } - - pub struct statfs64 { - pub f_type: ::__fsword_t, - pub f_bsize: ::__fsword_t, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_fsid: ::fsid_t, - pub f_namelen: ::__fsword_t, - pub f_frsize: ::__fsword_t, - pub f_flags: ::__fsword_t, - pub f_spare: [::__fsword_t; 4], - } - - pub struct statvfs { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_favail: ::fsfilcnt_t, - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct statvfs64 { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_favail: u64, - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct pthread_attr_t { - __size: [u64; 8] - } - - pub struct ipc_perm { - pub __key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::c_uint, - pub __seq: ::c_ushort, - __pad1: ::c_ushort, - __unused1: ::c_ulong, - __unused2: ::c_ulong - } - - pub struct shmid_ds { - pub shm_perm: ::ipc_perm, - pub shm_segsz: ::size_t, - pub shm_atime: ::time_t, - pub shm_dtime: ::time_t, - pub shm_ctime: ::time_t, - pub shm_cpid: ::pid_t, - pub shm_lpid: ::pid_t, - pub shm_nattch: ::shmatt_t, - __unused4: ::c_ulong, - __unused5: ::c_ulong - } - - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 19], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } -} - -pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; - -pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; -pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; - -pub const RLIMIT_NOFILE: ::c_int = 7; -pub const RLIMIT_NPROC: ::c_int = 6; - -pub const O_APPEND: ::c_int = 1024; -pub const O_CREAT: ::c_int = 64; -pub const O_EXCL: ::c_int = 128; -pub const O_NOCTTY: ::c_int = 256; -pub const O_NONBLOCK: ::c_int = 2048; -pub const O_SYNC: ::c_int = 1052672; -pub const O_RSYNC: ::c_int = 1052672; -pub const O_DSYNC: ::c_int = 4096; -pub const O_FSYNC: ::c_int = 0x101000; -pub const O_NOATIME: ::c_int = 0o1000000; -pub const O_PATH: ::c_int = 0o10000000; -pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; - -pub const MAP_GROWSDOWN: ::c_int = 0x0100; - -pub const EDEADLK: ::c_int = 35; -pub const ENAMETOOLONG: ::c_int = 36; -pub const ENOLCK: ::c_int = 37; -pub const ENOSYS: ::c_int = 38; -pub const ENOTEMPTY: ::c_int = 39; -pub const ELOOP: ::c_int = 40; -pub const ENOMSG: ::c_int = 42; -pub const EIDRM: ::c_int = 43; -pub const ECHRNG: ::c_int = 44; -pub const EL2NSYNC: ::c_int = 45; -pub const EL3HLT: ::c_int = 46; -pub const EL3RST: ::c_int = 47; -pub const ELNRNG: ::c_int = 48; -pub const EUNATCH: ::c_int = 49; -pub const ENOCSI: ::c_int = 50; -pub const EL2HLT: ::c_int = 51; -pub const EBADE: ::c_int = 52; -pub const EBADR: ::c_int = 53; -pub const EXFULL: ::c_int = 54; -pub const ENOANO: ::c_int = 55; -pub const EBADRQC: ::c_int = 56; -pub const EBADSLT: ::c_int = 57; -pub const EMULTIHOP: ::c_int = 72; -pub const EOVERFLOW: ::c_int = 75; -pub const ENOTUNIQ: ::c_int = 76; -pub const EBADFD: ::c_int = 77; -pub const EBADMSG: ::c_int = 74; -pub const EREMCHG: ::c_int = 78; -pub const ELIBACC: ::c_int = 79; -pub const ELIBBAD: ::c_int = 80; -pub const ELIBSCN: ::c_int = 81; -pub const ELIBMAX: ::c_int = 82; -pub const ELIBEXEC: ::c_int = 83; -pub const EILSEQ: ::c_int = 84; -pub const ERESTART: ::c_int = 85; -pub const ESTRPIPE: ::c_int = 86; -pub const EUSERS: ::c_int = 87; -pub const ENOTSOCK: ::c_int = 88; -pub const EDESTADDRREQ: ::c_int = 89; -pub const EMSGSIZE: ::c_int = 90; -pub const EPROTOTYPE: ::c_int = 91; -pub const ENOPROTOOPT: ::c_int = 92; -pub const EPROTONOSUPPORT: ::c_int = 93; -pub const ESOCKTNOSUPPORT: ::c_int = 94; -pub const EOPNOTSUPP: ::c_int = 95; -pub const EPFNOSUPPORT: ::c_int = 96; -pub const EAFNOSUPPORT: ::c_int = 97; -pub const EADDRINUSE: ::c_int = 98; -pub const EADDRNOTAVAIL: ::c_int = 99; -pub const ENETDOWN: ::c_int = 100; -pub const ENETUNREACH: ::c_int = 101; -pub const ENETRESET: ::c_int = 102; -pub const ECONNABORTED: ::c_int = 103; -pub const ECONNRESET: ::c_int = 104; -pub const ENOBUFS: ::c_int = 105; -pub const EISCONN: ::c_int = 106; -pub const ENOTCONN: ::c_int = 107; -pub const ESHUTDOWN: ::c_int = 108; -pub const ETOOMANYREFS: ::c_int = 109; -pub const ETIMEDOUT: ::c_int = 110; -pub const ECONNREFUSED: ::c_int = 111; -pub const EHOSTDOWN: ::c_int = 112; -pub const EHOSTUNREACH: ::c_int = 113; -pub const EALREADY: ::c_int = 114; -pub const EINPROGRESS: ::c_int = 115; -pub const ESTALE: ::c_int = 116; -pub const EDQUOT: ::c_int = 122; -pub const ENOMEDIUM: ::c_int = 123; -pub const EMEDIUMTYPE: ::c_int = 124; -pub const ECANCELED: ::c_int = 125; -pub const ENOKEY: ::c_int = 126; -pub const EKEYEXPIRED: ::c_int = 127; -pub const EKEYREVOKED: ::c_int = 128; -pub const EKEYREJECTED: ::c_int = 129; -pub const EOWNERDEAD: ::c_int = 130; -pub const ENOTRECOVERABLE: ::c_int = 131; -pub const EHWPOISON: ::c_int = 133; -pub const ERFKILL: ::c_int = 132; - -pub const SOL_SOCKET: ::c_int = 1; - -pub const SO_REUSEADDR: ::c_int = 2; -pub const SO_TYPE: ::c_int = 3; -pub const SO_ERROR: ::c_int = 4; -pub const SO_DONTROUTE: ::c_int = 5; -pub const SO_BROADCAST: ::c_int = 6; -pub const SO_SNDBUF: ::c_int = 7; -pub const SO_RCVBUF: ::c_int = 8; -pub const SO_SNDBUFFORCE: ::c_int = 32; -pub const SO_RCVBUFFORCE: ::c_int = 33; -pub const SO_KEEPALIVE: ::c_int = 9; -pub const SO_OOBINLINE: ::c_int = 10; -pub const SO_NO_CHECK: ::c_int = 11; -pub const SO_PRIORITY: ::c_int = 12; -pub const SO_LINGER: ::c_int = 13; -pub const SO_BSDCOMPAT: ::c_int = 14; -pub const SO_REUSEPORT: ::c_int = 15; -pub const SO_PASSCRED: ::c_int = 16; -pub const SO_PEERCRED: ::c_int = 17; -pub const SO_RCVLOWAT: ::c_int = 18; -pub const SO_SNDLOWAT: ::c_int = 19; -pub const SO_RCVTIMEO: ::c_int = 20; -pub const SO_SNDTIMEO: ::c_int = 21; -pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22; -pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23; -pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24; -pub const SO_BINDTODEVICE: ::c_int = 25; -pub const SO_ATTACH_FILTER: ::c_int = 26; -pub const SO_DETACH_FILTER: ::c_int = 27; -pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER; -pub const SO_PEERNAME: ::c_int = 28; -pub const SO_TIMESTAMP: ::c_int = 29; -pub const SO_ACCEPTCONN: ::c_int = 30; -pub const SO_PEERSEC: ::c_int = 31; -pub const SO_PASSSEC: ::c_int = 34; -pub const SO_TIMESTAMPNS: ::c_int = 35; -pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS; -pub const SO_MARK: ::c_int = 36; -pub const SO_PROTOCOL: ::c_int = 38; -pub const SO_DOMAIN: ::c_int = 39; -pub const SO_RXQ_OVFL: ::c_int = 40; -pub const SO_WIFI_STATUS: ::c_int = 41; -pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS; -pub const SO_PEEK_OFF: ::c_int = 42; -pub const SO_NOFCS: ::c_int = 43; -pub const SO_LOCK_FILTER: ::c_int = 44; -pub const SO_SELECT_ERR_QUEUE: ::c_int = 45; -pub const SO_BUSY_POLL: ::c_int = 46; -pub const SO_MAX_PACING_RATE: ::c_int = 47; -pub const SO_BPF_EXTENSIONS: ::c_int = 48; -pub const SO_INCOMING_CPU: ::c_int = 49; -pub const SO_ATTACH_BPF: ::c_int = 50; -pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER; - -pub const SA_ONSTACK: ::c_int = 0x08000000; -pub const SA_SIGINFO: ::c_int = 0x00000004; -pub const SA_NOCLDWAIT: ::c_int = 0x00000002; - -pub const SIGCHLD: ::c_int = 17; -pub const SIGBUS: ::c_int = 7; -pub const SIGUSR1: ::c_int = 10; -pub const SIGUSR2: ::c_int = 12; -pub const SIGCONT: ::c_int = 18; -pub const SIGSTOP: ::c_int = 19; -pub const SIGTSTP: ::c_int = 20; -pub const SIGURG: ::c_int = 23; -pub const SIGIO: ::c_int = 29; -pub const SIGSYS: ::c_int = 31; -pub const SIGSTKFLT: ::c_int = 16; -pub const SIGUNUSED: ::c_int = 31; -pub const SIGPOLL: ::c_int = 29; -pub const SIGPWR: ::c_int = 30; -pub const SIG_SETMASK: ::c_int = 2; -pub const SIG_BLOCK: ::c_int = 0x000000; -pub const SIG_UNBLOCK: ::c_int = 0x01; - -pub const POLLWRNORM: ::c_short = 0x100; -pub const POLLWRBAND: ::c_short = 0x200; - -pub const O_ASYNC: ::c_int = 0x2000; -pub const O_NDELAY: ::c_int = 0x800; - -pub const PTRACE_DETACH: ::c_uint = 17; - -pub const EFD_NONBLOCK: ::c_int = 0x800; - -pub const F_GETLK: ::c_int = 5; -pub const F_GETOWN: ::c_int = 9; -pub const F_SETOWN: ::c_int = 8; -pub const F_SETLK: ::c_int = 6; -pub const F_SETLKW: ::c_int = 7; - -pub const F_RDLCK: ::c_int = 0; -pub const F_WRLCK: ::c_int = 1; -pub const F_UNLCK: ::c_int = 2; - -pub const SFD_NONBLOCK: ::c_int = 0x0800; - -pub const TIOCEXCL: ::c_ulong = 0x540C; -pub const TIOCNXCL: ::c_ulong = 0x540D; -pub const TIOCSCTTY: ::c_ulong = 0x540E; -pub const TIOCSTI: ::c_ulong = 0x5412; -pub const TIOCMGET: ::c_ulong = 0x5415; -pub const TIOCMBIS: ::c_ulong = 0x5416; -pub const TIOCMBIC: ::c_ulong = 0x5417; -pub const TIOCMSET: ::c_ulong = 0x5418; -pub const TIOCCONS: ::c_ulong = 0x541D; - -pub const SFD_CLOEXEC: ::c_int = 0x080000; - -pub const NCCS: usize = 32; - -pub const O_TRUNC: ::c_int = 512; - -pub const O_CLOEXEC: ::c_int = 0x80000; - -pub const EBFONT: ::c_int = 59; -pub const ENOSTR: ::c_int = 60; -pub const ENODATA: ::c_int = 61; -pub const ETIME: ::c_int = 62; -pub const ENOSR: ::c_int = 63; -pub const ENONET: ::c_int = 64; -pub const ENOPKG: ::c_int = 65; -pub const EREMOTE: ::c_int = 66; -pub const ENOLINK: ::c_int = 67; -pub const EADV: ::c_int = 68; -pub const ESRMNT: ::c_int = 69; -pub const ECOMM: ::c_int = 70; -pub const EPROTO: ::c_int = 71; -pub const EDOTDOT: ::c_int = 73; - -pub const SA_NODEFER: ::c_int = 0x40000000; -pub const SA_RESETHAND: ::c_int = 0x80000000; -pub const SA_RESTART: ::c_int = 0x10000000; -pub const SA_NOCLDSTOP: ::c_int = 0x00000001; - -pub const EPOLL_CLOEXEC: ::c_int = 0x80000; - -pub const EFD_CLOEXEC: ::c_int = 0x80000; - -pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 8; -pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 48; -pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 8; - -align_const! { - pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 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, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - ], - }; - pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 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, - ], - }; - pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 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, - ], - }; -} - -pub const O_DIRECT: ::c_int = 0x10000; -pub const O_DIRECTORY: ::c_int = 0x4000; -pub const O_NOFOLLOW: ::c_int = 0x8000; - -pub const MAP_LOCKED: ::c_int = 0x02000; -pub const MAP_NORESERVE: ::c_int = 0x04000; - -pub const EDEADLOCK: ::c_int = 35; - -pub const FIOCLEX: ::c_ulong = 0x5451; -pub const FIONBIO: ::c_ulong = 0x5421; - -pub const MCL_CURRENT: ::c_int = 0x0001; -pub const MCL_FUTURE: ::c_int = 0x0002; - -pub const SIGSTKSZ: ::size_t = 16384; -pub const MINSIGSTKSZ: ::size_t = 5120; -pub const CBAUD: ::tcflag_t = 0o0010017; -pub const TAB1: ::c_int = 0x00000800; -pub const TAB2: ::c_int = 0x00001000; -pub const TAB3: ::c_int = 0x00001800; -pub const CR1: ::c_int = 0x00000200; -pub const CR2: ::c_int = 0x00000400; -pub const CR3: ::c_int = 0x00000600; -pub const FF1: ::c_int = 0x00008000; -pub const BS1: ::c_int = 0x00002000; -pub const VT1: ::c_int = 0x00004000; -pub const VWERASE: usize = 14; -pub const VREPRINT: usize = 12; -pub const VSUSP: usize = 10; -pub const VSTART: usize = 8; -pub const VSTOP: usize = 9; -pub const VDISCARD: usize = 13; -pub const VTIME: usize = 5; -pub const IXON: ::tcflag_t = 0x00000400; -pub const IXOFF: ::tcflag_t = 0x00001000; -pub const ONLCR: ::tcflag_t = 0x4; -pub const CSIZE: ::tcflag_t = 0x00000030; -pub const CS6: ::tcflag_t = 0x00000010; -pub const CS7: ::tcflag_t = 0x00000020; -pub const CS8: ::tcflag_t = 0x00000030; -pub const CSTOPB: ::tcflag_t = 0x00000040; -pub const CREAD: ::tcflag_t = 0x00000080; -pub const PARENB: ::tcflag_t = 0x00000100; -pub const PARODD: ::tcflag_t = 0x00000200; -pub const HUPCL: ::tcflag_t = 0x00000400; -pub const CLOCAL: ::tcflag_t = 0x00000800; -pub const ECHOKE: ::tcflag_t = 0x00000800; -pub const ECHOE: ::tcflag_t = 0x00000010; -pub const ECHOK: ::tcflag_t = 0x00000020; -pub const ECHONL: ::tcflag_t = 0x00000040; -pub const ECHOPRT: ::tcflag_t = 0x00000400; -pub const ECHOCTL: ::tcflag_t = 0x00000200; -pub const ISIG: ::tcflag_t = 0x00000001; -pub const ICANON: ::tcflag_t = 0x00000002; -pub const PENDIN: ::tcflag_t = 0x00004000; -pub const NOFLSH: ::tcflag_t = 0x00000080; -pub const CIBAUD: ::tcflag_t = 0o02003600000; -pub const CBAUDEX: ::tcflag_t = 0o010000; -pub const VSWTC: usize = 7; -pub const OLCUC: ::tcflag_t = 0o000002; -pub const NLDLY: ::tcflag_t = 0o000400; -pub const CRDLY: ::tcflag_t = 0o003000; -pub const TABDLY: ::tcflag_t = 0o014000; -pub const BSDLY: ::tcflag_t = 0o020000; -pub const FFDLY: ::tcflag_t = 0o100000; -pub const VTDLY: ::tcflag_t = 0o040000; -pub const XTABS: ::tcflag_t = 0o014000; - -pub const B0: ::speed_t = 0o000000; -pub const B50: ::speed_t = 0o000001; -pub const B75: ::speed_t = 0o000002; -pub const B110: ::speed_t = 0o000003; -pub const B134: ::speed_t = 0o000004; -pub const B150: ::speed_t = 0o000005; -pub const B200: ::speed_t = 0o000006; -pub const B300: ::speed_t = 0o000007; -pub const B600: ::speed_t = 0o000010; -pub const B1200: ::speed_t = 0o000011; -pub const B1800: ::speed_t = 0o000012; -pub const B2400: ::speed_t = 0o000013; -pub const B4800: ::speed_t = 0o000014; -pub const B9600: ::speed_t = 0o000015; -pub const B19200: ::speed_t = 0o000016; -pub const B38400: ::speed_t = 0o000017; -pub const EXTA: ::speed_t = B19200; -pub const EXTB: ::speed_t = B38400; -pub const BOTHER: ::speed_t = 0o010000; -pub const B57600: ::speed_t = 0o010001; -pub const B115200: ::speed_t = 0o010002; -pub const B230400: ::speed_t = 0o010003; -pub const B460800: ::speed_t = 0o010004; -pub const B500000: ::speed_t = 0o010005; -pub const B576000: ::speed_t = 0o010006; -pub const B921600: ::speed_t = 0o010007; -pub const B1000000: ::speed_t = 0o010010; -pub const B1152000: ::speed_t = 0o010011; -pub const B1500000: ::speed_t = 0o010012; -pub const B2000000: ::speed_t = 0o010013; -pub const B2500000: ::speed_t = 0o010014; -pub const B3000000: ::speed_t = 0o010015; -pub const B3500000: ::speed_t = 0o010016; -pub const B4000000: ::speed_t = 0o010017; - -pub const VEOL: usize = 11; -pub const VEOL2: usize = 16; -pub const VMIN: usize = 6; -pub const IEXTEN: ::tcflag_t = 0x00008000; -pub const TOSTOP: ::tcflag_t = 0x00000100; -pub const FLUSHO: ::tcflag_t = 0x00001000; -pub const EXTPROC: ::tcflag_t = 0x00010000; -pub const TCGETS: ::c_ulong = 0x5401; -pub const TCSETS: ::c_ulong = 0x5402; -pub const TCSETSW: ::c_ulong = 0x5403; -pub const TCSETSF: ::c_ulong = 0x5404; -pub const TCGETA: ::c_ulong = 0x5405; -pub const TCSETA: ::c_ulong = 0x5406; -pub const TCSETAW: ::c_ulong = 0x5407; -pub const TCSETAF: ::c_ulong = 0x5408; -pub const TCSBRK: ::c_ulong = 0x5409; -pub const TCXONC: ::c_ulong = 0x540A; -pub const TCFLSH: ::c_ulong = 0x540B; -pub const TIOCINQ: ::c_ulong = 0x541B; -pub const TIOCGPGRP: ::c_ulong = 0x540F; -pub const TIOCSPGRP: ::c_ulong = 0x5410; -pub const TIOCOUTQ: ::c_ulong = 0x5411; -pub const TIOCGWINSZ: ::c_ulong = 0x5413; -pub const TIOCSWINSZ: ::c_ulong = 0x5414; -pub const FIONREAD: ::c_ulong = 0x541B; - -// Syscall table -pub const SYS_io_setup: ::c_long = 0; -pub const SYS_io_destroy: ::c_long = 1; -pub const SYS_io_submit: ::c_long = 2; -pub const SYS_io_cancel: ::c_long = 3; -pub const SYS_io_getevents: ::c_long = 4; -pub const SYS_setxattr: ::c_long = 5; -pub const SYS_lsetxattr: ::c_long = 6; -pub const SYS_fsetxattr: ::c_long = 7; -pub const SYS_getxattr: ::c_long = 8; -pub const SYS_lgetxattr: ::c_long = 9; -pub const SYS_fgetxattr: ::c_long = 10; -pub const SYS_listxattr: ::c_long = 11; -pub const SYS_llistxattr: ::c_long = 12; -pub const SYS_flistxattr: ::c_long = 13; -pub const SYS_removexattr: ::c_long = 14; -pub const SYS_lremovexattr: ::c_long = 15; -pub const SYS_fremovexattr: ::c_long = 16; -pub const SYS_getcwd: ::c_long = 17; -pub const SYS_lookup_dcookie: ::c_long = 18; -pub const SYS_eventfd2: ::c_long = 19; -pub const SYS_epoll_create1: ::c_long = 20; -pub const SYS_epoll_ctl: ::c_long = 21; -pub const SYS_epoll_pwait: ::c_long = 22; -pub const SYS_dup: ::c_long = 23; -pub const SYS_dup3: ::c_long = 24; -pub const SYS_fcntl: ::c_long = 25; -pub const SYS_inotify_init1: ::c_long = 26; -pub const SYS_inotify_add_watch: ::c_long = 27; -pub const SYS_inotify_rm_watch: ::c_long = 28; -pub const SYS_ioctl: ::c_long = 29; -pub const SYS_ioprio_set: ::c_long = 30; -pub const SYS_ioprio_get: ::c_long = 31; -pub const SYS_flock: ::c_long = 32; -pub const SYS_mknodat: ::c_long = 33; -pub const SYS_mkdirat: ::c_long = 34; -pub const SYS_unlinkat: ::c_long = 35; -pub const SYS_symlinkat: ::c_long = 36; -pub const SYS_linkat: ::c_long = 37; -pub const SYS_renameat: ::c_long = 38; -pub const SYS_umount2: ::c_long = 39; -pub const SYS_mount: ::c_long = 40; -pub const SYS_pivot_root: ::c_long = 41; -pub const SYS_nfsservctl: ::c_long = 42; -pub const SYS_fallocate: ::c_long = 47; -pub const SYS_faccessat: ::c_long = 48; -pub const SYS_chdir: ::c_long = 49; -pub const SYS_fchdir: ::c_long = 50; -pub const SYS_chroot: ::c_long = 51; -pub const SYS_fchmod: ::c_long = 52; -pub const SYS_fchmodat: ::c_long = 53; -pub const SYS_fchownat: ::c_long = 54; -pub const SYS_fchown: ::c_long = 55; -pub const SYS_openat: ::c_long = 56; -pub const SYS_close: ::c_long = 57; -pub const SYS_vhangup: ::c_long = 58; -pub const SYS_pipe2: ::c_long = 59; -pub const SYS_quotactl: ::c_long = 60; -pub const SYS_getdents64: ::c_long = 61; -pub const SYS_lseek: ::c_long = 62; -pub const SYS_read: ::c_long = 63; -pub const SYS_write: ::c_long = 64; -pub const SYS_readv: ::c_long = 65; -pub const SYS_writev: ::c_long = 66; -pub const SYS_pread64: ::c_long = 67; -pub const SYS_pwrite64: ::c_long = 68; -pub const SYS_preadv: ::c_long = 69; -pub const SYS_pwritev: ::c_long = 70; -pub const SYS_pselect6: ::c_long = 72; -pub const SYS_ppoll: ::c_long = 73; -pub const SYS_signalfd4: ::c_long = 74; -pub const SYS_vmsplice: ::c_long = 75; -pub const SYS_splice: ::c_long = 76; -pub const SYS_tee: ::c_long = 77; -pub const SYS_readlinkat: ::c_long = 78; -pub const SYS_newfstatat: ::c_long = 79; -pub const SYS_fstat: ::c_long = 80; -pub const SYS_sync: ::c_long = 81; -pub const SYS_fsync: ::c_long = 82; -pub const SYS_fdatasync: ::c_long = 83; -pub const SYS_sync_file_range: ::c_long = 84; -pub const SYS_timerfd_create: ::c_long = 85; -pub const SYS_timerfd_settime: ::c_long = 86; -pub const SYS_timerfd_gettime: ::c_long = 87; -pub const SYS_utimensat: ::c_long = 88; -pub const SYS_acct: ::c_long = 89; -pub const SYS_capget: ::c_long = 90; -pub const SYS_capset: ::c_long = 91; -pub const SYS_personality: ::c_long = 92; -pub const SYS_exit: ::c_long = 93; -pub const SYS_exit_group: ::c_long = 94; -pub const SYS_waitid: ::c_long = 95; -pub const SYS_set_tid_address: ::c_long = 96; -pub const SYS_unshare: ::c_long = 97; -pub const SYS_futex: ::c_long = 98; -pub const SYS_set_robust_list: ::c_long = 99; -pub const SYS_get_robust_list: ::c_long = 100; -pub const SYS_nanosleep: ::c_long = 101; -pub const SYS_getitimer: ::c_long = 102; -pub const SYS_setitimer: ::c_long = 103; -pub const SYS_kexec_load: ::c_long = 104; -pub const SYS_init_module: ::c_long = 105; -pub const SYS_delete_module: ::c_long = 106; -pub const SYS_timer_create: ::c_long = 107; -pub const SYS_timer_gettime: ::c_long = 108; -pub const SYS_timer_getoverrun: ::c_long = 109; -pub const SYS_timer_settime: ::c_long = 110; -pub const SYS_timer_delete: ::c_long = 111; -pub const SYS_clock_settime: ::c_long = 112; -pub const SYS_clock_gettime: ::c_long = 113; -pub const SYS_clock_getres: ::c_long = 114; -pub const SYS_clock_nanosleep: ::c_long = 115; -pub const SYS_syslog: ::c_long = 116; -pub const SYS_ptrace: ::c_long = 117; -pub const SYS_sched_setparam: ::c_long = 118; -pub const SYS_sched_setscheduler: ::c_long = 119; -pub const SYS_sched_getscheduler: ::c_long = 120; -pub const SYS_sched_getparam: ::c_long = 121; -pub const SYS_sched_setaffinity: ::c_long = 122; -pub const SYS_sched_getaffinity: ::c_long = 123; -pub const SYS_sched_yield: ::c_long = 124; -pub const SYS_sched_get_priority_max: ::c_long = 125; -pub const SYS_sched_get_priority_min: ::c_long = 126; -pub const SYS_sched_rr_get_interval: ::c_long = 127; -pub const SYS_restart_syscall: ::c_long = 128; -pub const SYS_kill: ::c_long = 129; -pub const SYS_tkill: ::c_long = 130; -pub const SYS_tgkill: ::c_long = 131; -pub const SYS_sigaltstack: ::c_long = 132; -pub const SYS_rt_sigsuspend: ::c_long = 133; -pub const SYS_rt_sigaction: ::c_long = 134; -pub const SYS_rt_sigprocmask: ::c_long = 135; -pub const SYS_rt_sigpending: ::c_long = 136; -pub const SYS_rt_sigtimedwait: ::c_long = 137; -pub const SYS_rt_sigqueueinfo: ::c_long = 138; -pub const SYS_rt_sigreturn: ::c_long = 139; -pub const SYS_setpriority: ::c_long = 140; -pub const SYS_getpriority: ::c_long = 141; -pub const SYS_reboot: ::c_long = 142; -pub const SYS_setregid: ::c_long = 143; -pub const SYS_setgid: ::c_long = 144; -pub const SYS_setreuid: ::c_long = 145; -pub const SYS_setuid: ::c_long = 146; -pub const SYS_setresuid: ::c_long = 147; -pub const SYS_getresuid: ::c_long = 148; -pub const SYS_setresgid: ::c_long = 149; -pub const SYS_getresgid: ::c_long = 150; -pub const SYS_setfsuid: ::c_long = 151; -pub const SYS_setfsgid: ::c_long = 152; -pub const SYS_times: ::c_long = 153; -pub const SYS_setpgid: ::c_long = 154; -pub const SYS_getpgid: ::c_long = 155; -pub const SYS_getsid: ::c_long = 156; -pub const SYS_setsid: ::c_long = 157; -pub const SYS_getgroups: ::c_long = 158; -pub const SYS_setgroups: ::c_long = 159; -pub const SYS_uname: ::c_long = 160; -pub const SYS_sethostname: ::c_long = 161; -pub const SYS_setdomainname: ::c_long = 162; -pub const SYS_getrlimit: ::c_long = 163; -pub const SYS_setrlimit: ::c_long = 164; -pub const SYS_getrusage: ::c_long = 165; -pub const SYS_umask: ::c_long = 166; -pub const SYS_prctl: ::c_long = 167; -pub const SYS_getcpu: ::c_long = 168; -pub const SYS_gettimeofday: ::c_long = 169; -pub const SYS_settimeofday: ::c_long = 170; -pub const SYS_adjtimex: ::c_long = 171; -pub const SYS_getpid: ::c_long = 172; -pub const SYS_getppid: ::c_long = 173; -pub const SYS_getuid: ::c_long = 174; -pub const SYS_geteuid: ::c_long = 175; -pub const SYS_getgid: ::c_long = 176; -pub const SYS_getegid: ::c_long = 177; -pub const SYS_gettid: ::c_long = 178; -pub const SYS_sysinfo: ::c_long = 179; -pub const SYS_mq_open: ::c_long = 180; -pub const SYS_mq_unlink: ::c_long = 181; -pub const SYS_mq_timedsend: ::c_long = 182; -pub const SYS_mq_timedreceive: ::c_long = 183; -pub const SYS_mq_notify: ::c_long = 184; -pub const SYS_mq_getsetattr: ::c_long = 185; -pub const SYS_msgget: ::c_long = 186; -pub const SYS_msgctl: ::c_long = 187; -pub const SYS_msgrcv: ::c_long = 188; -pub const SYS_msgsnd: ::c_long = 189; -pub const SYS_semget: ::c_long = 190; -pub const SYS_semctl: ::c_long = 191; -pub const SYS_semtimedop: ::c_long = 192; -pub const SYS_semop: ::c_long = 193; -pub const SYS_shmget: ::c_long = 194; -pub const SYS_shmctl: ::c_long = 195; -pub const SYS_shmat: ::c_long = 196; -pub const SYS_shmdt: ::c_long = 197; -pub const SYS_socket: ::c_long = 198; -pub const SYS_socketpair: ::c_long = 199; -pub const SYS_bind: ::c_long = 200; -pub const SYS_listen: ::c_long = 201; -pub const SYS_accept: ::c_long = 202; -pub const SYS_connect: ::c_long = 203; -pub const SYS_getsockname: ::c_long = 204; -pub const SYS_getpeername: ::c_long = 205; -pub const SYS_sendto: ::c_long = 206; -pub const SYS_recvfrom: ::c_long = 207; -pub const SYS_setsockopt: ::c_long = 208; -pub const SYS_getsockopt: ::c_long = 209; -pub const SYS_shutdown: ::c_long = 210; -pub const SYS_sendmsg: ::c_long = 211; -pub const SYS_recvmsg: ::c_long = 212; -pub const SYS_readahead: ::c_long = 213; -pub const SYS_brk: ::c_long = 214; -pub const SYS_munmap: ::c_long = 215; -pub const SYS_mremap: ::c_long = 216; -pub const SYS_add_key: ::c_long = 217; -pub const SYS_request_key: ::c_long = 218; -pub const SYS_keyctl: ::c_long = 219; -pub const SYS_clone: ::c_long = 220; -pub const SYS_execve: ::c_long = 221; -pub const SYS_mmap: ::c_long = 222; -pub const SYS_swapon: ::c_long = 224; -pub const SYS_swapoff: ::c_long = 225; -pub const SYS_mprotect: ::c_long = 226; -pub const SYS_msync: ::c_long = 227; -pub const SYS_mlock: ::c_long = 228; -pub const SYS_munlock: ::c_long = 229; -pub const SYS_mlockall: ::c_long = 230; -pub const SYS_munlockall: ::c_long = 231; -pub const SYS_mincore: ::c_long = 232; -pub const SYS_madvise: ::c_long = 233; -pub const SYS_remap_file_pages: ::c_long = 234; -pub const SYS_mbind: ::c_long = 235; -pub const SYS_get_mempolicy: ::c_long = 236; -pub const SYS_set_mempolicy: ::c_long = 237; -pub const SYS_migrate_pages: ::c_long = 238; -pub const SYS_move_pages: ::c_long = 239; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 240; -pub const SYS_perf_event_open: ::c_long = 241; -pub const SYS_accept4: ::c_long = 242; -pub const SYS_recvmmsg: ::c_long = 243; -pub const SYS_arch_specific_syscall: ::c_long = 244; -pub const SYS_wait4: ::c_long = 260; -pub const SYS_prlimit64: ::c_long = 261; -pub const SYS_fanotify_init: ::c_long = 262; -pub const SYS_fanotify_mark: ::c_long = 263; -pub const SYS_name_to_handle_at: ::c_long = 264; -pub const SYS_open_by_handle_at: ::c_long = 265; -pub const SYS_clock_adjtime: ::c_long = 266; -pub const SYS_syncfs: ::c_long = 267; -pub const SYS_setns: ::c_long = 268; -pub const SYS_sendmmsg: ::c_long = 269; -pub const SYS_process_vm_readv: ::c_long = 270; -pub const SYS_process_vm_writev: ::c_long = 271; -pub const SYS_kcmp: ::c_long = 272; -pub const SYS_finit_module: ::c_long = 273; -pub const SYS_sched_setattr: ::c_long = 274; -pub const SYS_sched_getattr: ::c_long = 275; -pub const SYS_renameat2: ::c_long = 276; -pub const SYS_seccomp: ::c_long = 277; -pub const SYS_getrandom: ::c_long = 278; -pub const SYS_memfd_create: ::c_long = 279; -pub const SYS_bpf: ::c_long = 280; -pub const SYS_execveat: ::c_long = 281; -pub const SYS_userfaultfd: ::c_long = 282; -pub const SYS_membarrier: ::c_long = 283; -pub const SYS_mlock2: ::c_long = 284; -pub const SYS_copy_file_range: ::c_long = 285; -pub const SYS_preadv2: ::c_long = 286; -pub const SYS_pwritev2: ::c_long = 287; -pub const SYS_pkey_mprotect: ::c_long = 288; -pub const SYS_pkey_alloc: ::c_long = 289; -pub const SYS_pkey_free: ::c_long = 290; -pub const SYS_syscalls: ::c_long = 291; - -#[link(name = "util")] -extern { - pub fn sysctl(name: *mut ::c_int, - namelen: ::c_int, - oldp: *mut ::c_void, - oldlenp: *mut ::size_t, - newp: *mut ::c_void, - newlen: ::size_t) - -> ::c_int; -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b64/mod.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b64/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b64/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b64/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ -//! 64-bit specific definitions for linux-like values - -pub type clock_t = i64; -pub type time_t = i64; -pub type ino_t = u64; -pub type off_t = i64; -pub type blkcnt_t = i64; -pub type __fsword_t = i64; -pub type shmatt_t = u64; -pub type msgqnum_t = u64; -pub type msglen_t = u64; -pub type fsblkcnt_t = u64; -pub type fsfilcnt_t = u64; -pub type rlim_t = u64; - -s! { - pub struct sigset_t { - #[cfg(target_pointer_width = "32")] - __val: [u32; 32], - #[cfg(target_pointer_width = "64")] - __val: [u64; 16], - } - - pub struct sysinfo { - pub uptime: i64, - pub loads: [u64; 3], - pub totalram: u64, - pub freeram: u64, - pub sharedram: u64, - pub bufferram: u64, - pub totalswap: u64, - pub freeswap: u64, - pub procs: ::c_ushort, - pub pad: ::c_ushort, - pub totalhigh: u64, - pub freehigh: u64, - pub mem_unit: ::c_uint, - pub _f: [::c_char; 0], - } - - pub struct msqid_ds { - pub msg_perm: ::ipc_perm, - pub msg_stime: ::time_t, - pub msg_rtime: ::time_t, - pub msg_ctime: ::time_t, - __msg_cbytes: u64, - pub msg_qnum: ::msgqnum_t, - pub msg_qbytes: ::msglen_t, - pub msg_lspid: ::pid_t, - pub msg_lrpid: ::pid_t, - __glibc_reserved4: u64, - __glibc_reserved5: u64, - } -} - -pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; - -pub const O_LARGEFILE: ::c_int = 0; - -cfg_if! { - if #[cfg(target_arch = "aarch64")] { - mod aarch64; - pub use self::aarch64::*; - } else if #[cfg(any(target_arch = "powerpc64"))] { - mod powerpc64; - pub use self::powerpc64::*; - } else if #[cfg(any(target_arch = "sparc64"))] { - mod sparc64; - pub use self::sparc64::*; - } else if #[cfg(any(target_arch = "x86_64"))] { - mod x86_64; - pub use self::x86_64::*; - cfg_if! { - if #[cfg(target_pointer_width = "32")] { - mod x32; - pub use self::x32::*; - } else { - mod not_x32; - pub use self::not_x32::*; - } - } - } else { - // Unknown target_arch - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b64/not_x32.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b64/not_x32.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b64/not_x32.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b64/not_x32.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,421 +0,0 @@ -use pthread_mutex_t; - -pub type c_long = i64; -pub type c_ulong = u64; - -s! { - pub struct statvfs { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_favail: ::fsfilcnt_t, - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } -} - -pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; -pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; - -align_const! { - #[cfg(target_endian = "little")] - pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 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, 0, - ], - }; - #[cfg(target_endian = "little")] - pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }; - #[cfg(target_endian = "little")] - pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }; - #[cfg(target_endian = "big")] - pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 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, - ], - }; - #[cfg(target_endian = "big")] - pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }; - #[cfg(target_endian = "big")] - pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }; -} - -// Syscall table - -pub const SYS_read: ::c_long = 0; -pub const SYS_write: ::c_long = 1; -pub const SYS_open: ::c_long = 2; -pub const SYS_close: ::c_long = 3; -pub const SYS_stat: ::c_long = 4; -pub const SYS_fstat: ::c_long = 5; -pub const SYS_lstat: ::c_long = 6; -pub const SYS_poll: ::c_long = 7; -pub const SYS_lseek: ::c_long = 8; -pub const SYS_mmap: ::c_long = 9; -pub const SYS_mprotect: ::c_long = 10; -pub const SYS_munmap: ::c_long = 11; -pub const SYS_brk: ::c_long = 12; -pub const SYS_rt_sigaction: ::c_long = 13; -pub const SYS_rt_sigprocmask: ::c_long = 14; -pub const SYS_rt_sigreturn: ::c_long = 15; -pub const SYS_ioctl: ::c_long = 16; -pub const SYS_pread64: ::c_long = 17; -pub const SYS_pwrite64: ::c_long = 18; -pub const SYS_readv: ::c_long = 19; -pub const SYS_writev: ::c_long = 20; -pub const SYS_access: ::c_long = 21; -pub const SYS_pipe: ::c_long = 22; -pub const SYS_select: ::c_long = 23; -pub const SYS_sched_yield: ::c_long = 24; -pub const SYS_mremap: ::c_long = 25; -pub const SYS_msync: ::c_long = 26; -pub const SYS_mincore: ::c_long = 27; -pub const SYS_madvise: ::c_long = 28; -pub const SYS_shmget: ::c_long = 29; -pub const SYS_shmat: ::c_long = 30; -pub const SYS_shmctl: ::c_long = 31; -pub const SYS_dup: ::c_long = 32; -pub const SYS_dup2: ::c_long = 33; -pub const SYS_pause: ::c_long = 34; -pub const SYS_nanosleep: ::c_long = 35; -pub const SYS_getitimer: ::c_long = 36; -pub const SYS_alarm: ::c_long = 37; -pub const SYS_setitimer: ::c_long = 38; -pub const SYS_getpid: ::c_long = 39; -pub const SYS_sendfile: ::c_long = 40; -pub const SYS_socket: ::c_long = 41; -pub const SYS_connect: ::c_long = 42; -pub const SYS_accept: ::c_long = 43; -pub const SYS_sendto: ::c_long = 44; -pub const SYS_recvfrom: ::c_long = 45; -pub const SYS_sendmsg: ::c_long = 46; -pub const SYS_recvmsg: ::c_long = 47; -pub const SYS_shutdown: ::c_long = 48; -pub const SYS_bind: ::c_long = 49; -pub const SYS_listen: ::c_long = 50; -pub const SYS_getsockname: ::c_long = 51; -pub const SYS_getpeername: ::c_long = 52; -pub const SYS_socketpair: ::c_long = 53; -pub const SYS_setsockopt: ::c_long = 54; -pub const SYS_getsockopt: ::c_long = 55; -pub const SYS_clone: ::c_long = 56; -pub const SYS_fork: ::c_long = 57; -pub const SYS_vfork: ::c_long = 58; -pub const SYS_execve: ::c_long = 59; -pub const SYS_exit: ::c_long = 60; -pub const SYS_wait4: ::c_long = 61; -pub const SYS_kill: ::c_long = 62; -pub const SYS_uname: ::c_long = 63; -pub const SYS_semget: ::c_long = 64; -pub const SYS_semop: ::c_long = 65; -pub const SYS_semctl: ::c_long = 66; -pub const SYS_shmdt: ::c_long = 67; -pub const SYS_msgget: ::c_long = 68; -pub const SYS_msgsnd: ::c_long = 69; -pub const SYS_msgrcv: ::c_long = 70; -pub const SYS_msgctl: ::c_long = 71; -pub const SYS_fcntl: ::c_long = 72; -pub const SYS_flock: ::c_long = 73; -pub const SYS_fsync: ::c_long = 74; -pub const SYS_fdatasync: ::c_long = 75; -pub const SYS_truncate: ::c_long = 76; -pub const SYS_ftruncate: ::c_long = 77; -pub const SYS_getdents: ::c_long = 78; -pub const SYS_getcwd: ::c_long = 79; -pub const SYS_chdir: ::c_long = 80; -pub const SYS_fchdir: ::c_long = 81; -pub const SYS_rename: ::c_long = 82; -pub const SYS_mkdir: ::c_long = 83; -pub const SYS_rmdir: ::c_long = 84; -pub const SYS_creat: ::c_long = 85; -pub const SYS_link: ::c_long = 86; -pub const SYS_unlink: ::c_long = 87; -pub const SYS_symlink: ::c_long = 88; -pub const SYS_readlink: ::c_long = 89; -pub const SYS_chmod: ::c_long = 90; -pub const SYS_fchmod: ::c_long = 91; -pub const SYS_chown: ::c_long = 92; -pub const SYS_fchown: ::c_long = 93; -pub const SYS_lchown: ::c_long = 94; -pub const SYS_umask: ::c_long = 95; -pub const SYS_gettimeofday: ::c_long = 96; -pub const SYS_getrlimit: ::c_long = 97; -pub const SYS_getrusage: ::c_long = 98; -pub const SYS_sysinfo: ::c_long = 99; -pub const SYS_times: ::c_long = 100; -pub const SYS_ptrace: ::c_long = 101; -pub const SYS_getuid: ::c_long = 102; -pub const SYS_syslog: ::c_long = 103; -pub const SYS_getgid: ::c_long = 104; -pub const SYS_setuid: ::c_long = 105; -pub const SYS_setgid: ::c_long = 106; -pub const SYS_geteuid: ::c_long = 107; -pub const SYS_getegid: ::c_long = 108; -pub const SYS_setpgid: ::c_long = 109; -pub const SYS_getppid: ::c_long = 110; -pub const SYS_getpgrp: ::c_long = 111; -pub const SYS_setsid: ::c_long = 112; -pub const SYS_setreuid: ::c_long = 113; -pub const SYS_setregid: ::c_long = 114; -pub const SYS_getgroups: ::c_long = 115; -pub const SYS_setgroups: ::c_long = 116; -pub const SYS_setresuid: ::c_long = 117; -pub const SYS_getresuid: ::c_long = 118; -pub const SYS_setresgid: ::c_long = 119; -pub const SYS_getresgid: ::c_long = 120; -pub const SYS_getpgid: ::c_long = 121; -pub const SYS_setfsuid: ::c_long = 122; -pub const SYS_setfsgid: ::c_long = 123; -pub const SYS_getsid: ::c_long = 124; -pub const SYS_capget: ::c_long = 125; -pub const SYS_capset: ::c_long = 126; -pub const SYS_rt_sigpending: ::c_long = 127; -pub const SYS_rt_sigtimedwait: ::c_long = 128; -pub const SYS_rt_sigqueueinfo: ::c_long = 129; -pub const SYS_rt_sigsuspend: ::c_long = 130; -pub const SYS_sigaltstack: ::c_long = 131; -pub const SYS_utime: ::c_long = 132; -pub const SYS_mknod: ::c_long = 133; -pub const SYS_uselib: ::c_long = 134; -pub const SYS_personality: ::c_long = 135; -pub const SYS_ustat: ::c_long = 136; -pub const SYS_statfs: ::c_long = 137; -pub const SYS_fstatfs: ::c_long = 138; -pub const SYS_sysfs: ::c_long = 139; -pub const SYS_getpriority: ::c_long = 140; -pub const SYS_setpriority: ::c_long = 141; -pub const SYS_sched_setparam: ::c_long = 142; -pub const SYS_sched_getparam: ::c_long = 143; -pub const SYS_sched_setscheduler: ::c_long = 144; -pub const SYS_sched_getscheduler: ::c_long = 145; -pub const SYS_sched_get_priority_max: ::c_long = 146; -pub const SYS_sched_get_priority_min: ::c_long = 147; -pub const SYS_sched_rr_get_interval: ::c_long = 148; -pub const SYS_mlock: ::c_long = 149; -pub const SYS_munlock: ::c_long = 150; -pub const SYS_mlockall: ::c_long = 151; -pub const SYS_munlockall: ::c_long = 152; -pub const SYS_vhangup: ::c_long = 153; -pub const SYS_modify_ldt: ::c_long = 154; -pub const SYS_pivot_root: ::c_long = 155; -pub const SYS__sysctl: ::c_long = 156; -pub const SYS_prctl: ::c_long = 157; -pub const SYS_arch_prctl: ::c_long = 158; -pub const SYS_adjtimex: ::c_long = 159; -pub const SYS_setrlimit: ::c_long = 160; -pub const SYS_chroot: ::c_long = 161; -pub const SYS_sync: ::c_long = 162; -pub const SYS_acct: ::c_long = 163; -pub const SYS_settimeofday: ::c_long = 164; -pub const SYS_mount: ::c_long = 165; -pub const SYS_umount2: ::c_long = 166; -pub const SYS_swapon: ::c_long = 167; -pub const SYS_swapoff: ::c_long = 168; -pub const SYS_reboot: ::c_long = 169; -pub const SYS_sethostname: ::c_long = 170; -pub const SYS_setdomainname: ::c_long = 171; -pub const SYS_iopl: ::c_long = 172; -pub const SYS_ioperm: ::c_long = 173; -pub const SYS_create_module: ::c_long = 174; -pub const SYS_init_module: ::c_long = 175; -pub const SYS_delete_module: ::c_long = 176; -pub const SYS_get_kernel_syms: ::c_long = 177; -pub const SYS_query_module: ::c_long = 178; -pub const SYS_quotactl: ::c_long = 179; -pub const SYS_nfsservctl: ::c_long = 180; -pub const SYS_getpmsg: ::c_long = 181; -pub const SYS_putpmsg: ::c_long = 182; -pub const SYS_afs_syscall: ::c_long = 183; -pub const SYS_tuxcall: ::c_long = 184; -pub const SYS_security: ::c_long = 185; -pub const SYS_gettid: ::c_long = 186; -pub const SYS_readahead: ::c_long = 187; -pub const SYS_setxattr: ::c_long = 188; -pub const SYS_lsetxattr: ::c_long = 189; -pub const SYS_fsetxattr: ::c_long = 190; -pub const SYS_getxattr: ::c_long = 191; -pub const SYS_lgetxattr: ::c_long = 192; -pub const SYS_fgetxattr: ::c_long = 193; -pub const SYS_listxattr: ::c_long = 194; -pub const SYS_llistxattr: ::c_long = 195; -pub const SYS_flistxattr: ::c_long = 196; -pub const SYS_removexattr: ::c_long = 197; -pub const SYS_lremovexattr: ::c_long = 198; -pub const SYS_fremovexattr: ::c_long = 199; -pub const SYS_tkill: ::c_long = 200; -pub const SYS_time: ::c_long = 201; -pub const SYS_futex: ::c_long = 202; -pub const SYS_sched_setaffinity: ::c_long = 203; -pub const SYS_sched_getaffinity: ::c_long = 204; -pub const SYS_set_thread_area: ::c_long = 205; -pub const SYS_io_setup: ::c_long = 206; -pub const SYS_io_destroy: ::c_long = 207; -pub const SYS_io_getevents: ::c_long = 208; -pub const SYS_io_submit: ::c_long = 209; -pub const SYS_io_cancel: ::c_long = 210; -pub const SYS_get_thread_area: ::c_long = 211; -pub const SYS_lookup_dcookie: ::c_long = 212; -pub const SYS_epoll_create: ::c_long = 213; -pub const SYS_epoll_ctl_old: ::c_long = 214; -pub const SYS_epoll_wait_old: ::c_long = 215; -pub const SYS_remap_file_pages: ::c_long = 216; -pub const SYS_getdents64: ::c_long = 217; -pub const SYS_set_tid_address: ::c_long = 218; -pub const SYS_restart_syscall: ::c_long = 219; -pub const SYS_semtimedop: ::c_long = 220; -pub const SYS_fadvise64: ::c_long = 221; -pub const SYS_timer_create: ::c_long = 222; -pub const SYS_timer_settime: ::c_long = 223; -pub const SYS_timer_gettime: ::c_long = 224; -pub const SYS_timer_getoverrun: ::c_long = 225; -pub const SYS_timer_delete: ::c_long = 226; -pub const SYS_clock_settime: ::c_long = 227; -pub const SYS_clock_gettime: ::c_long = 228; -pub const SYS_clock_getres: ::c_long = 229; -pub const SYS_clock_nanosleep: ::c_long = 230; -pub const SYS_exit_group: ::c_long = 231; -pub const SYS_epoll_wait: ::c_long = 232; -pub const SYS_epoll_ctl: ::c_long = 233; -pub const SYS_tgkill: ::c_long = 234; -pub const SYS_utimes: ::c_long = 235; -pub const SYS_vserver: ::c_long = 236; -pub const SYS_mbind: ::c_long = 237; -pub const SYS_set_mempolicy: ::c_long = 238; -pub const SYS_get_mempolicy: ::c_long = 239; -pub const SYS_mq_open: ::c_long = 240; -pub const SYS_mq_unlink: ::c_long = 241; -pub const SYS_mq_timedsend: ::c_long = 242; -pub const SYS_mq_timedreceive: ::c_long = 243; -pub const SYS_mq_notify: ::c_long = 244; -pub const SYS_mq_getsetattr: ::c_long = 245; -pub const SYS_kexec_load: ::c_long = 246; -pub const SYS_waitid: ::c_long = 247; -pub const SYS_add_key: ::c_long = 248; -pub const SYS_request_key: ::c_long = 249; -pub const SYS_keyctl: ::c_long = 250; -pub const SYS_ioprio_set: ::c_long = 251; -pub const SYS_ioprio_get: ::c_long = 252; -pub const SYS_inotify_init: ::c_long = 253; -pub const SYS_inotify_add_watch: ::c_long = 254; -pub const SYS_inotify_rm_watch: ::c_long = 255; -pub const SYS_migrate_pages: ::c_long = 256; -pub const SYS_openat: ::c_long = 257; -pub const SYS_mkdirat: ::c_long = 258; -pub const SYS_mknodat: ::c_long = 259; -pub const SYS_fchownat: ::c_long = 260; -pub const SYS_futimesat: ::c_long = 261; -pub const SYS_newfstatat: ::c_long = 262; -pub const SYS_unlinkat: ::c_long = 263; -pub const SYS_renameat: ::c_long = 264; -pub const SYS_linkat: ::c_long = 265; -pub const SYS_symlinkat: ::c_long = 266; -pub const SYS_readlinkat: ::c_long = 267; -pub const SYS_fchmodat: ::c_long = 268; -pub const SYS_faccessat: ::c_long = 269; -pub const SYS_pselect6: ::c_long = 270; -pub const SYS_ppoll: ::c_long = 271; -pub const SYS_unshare: ::c_long = 272; -pub const SYS_set_robust_list: ::c_long = 273; -pub const SYS_get_robust_list: ::c_long = 274; -pub const SYS_splice: ::c_long = 275; -pub const SYS_tee: ::c_long = 276; -pub const SYS_sync_file_range: ::c_long = 277; -pub const SYS_vmsplice: ::c_long = 278; -pub const SYS_move_pages: ::c_long = 279; -pub const SYS_utimensat: ::c_long = 280; -pub const SYS_epoll_pwait: ::c_long = 281; -pub const SYS_signalfd: ::c_long = 282; -pub const SYS_timerfd_create: ::c_long = 283; -pub const SYS_eventfd: ::c_long = 284; -pub const SYS_fallocate: ::c_long = 285; -pub const SYS_timerfd_settime: ::c_long = 286; -pub const SYS_timerfd_gettime: ::c_long = 287; -pub const SYS_accept4: ::c_long = 288; -pub const SYS_signalfd4: ::c_long = 289; -pub const SYS_eventfd2: ::c_long = 290; -pub const SYS_epoll_create1: ::c_long = 291; -pub const SYS_dup3: ::c_long = 292; -pub const SYS_pipe2: ::c_long = 293; -pub const SYS_inotify_init1: ::c_long = 294; -pub const SYS_preadv: ::c_long = 295; -pub const SYS_pwritev: ::c_long = 296; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 297; -pub const SYS_perf_event_open: ::c_long = 298; -pub const SYS_recvmmsg: ::c_long = 299; -pub const SYS_fanotify_init: ::c_long = 300; -pub const SYS_fanotify_mark: ::c_long = 301; -pub const SYS_prlimit64: ::c_long = 302; -pub const SYS_name_to_handle_at: ::c_long = 303; -pub const SYS_open_by_handle_at: ::c_long = 304; -pub const SYS_clock_adjtime: ::c_long = 305; -pub const SYS_syncfs: ::c_long = 306; -pub const SYS_sendmmsg: ::c_long = 307; -pub const SYS_setns: ::c_long = 308; -pub const SYS_getcpu: ::c_long = 309; -pub const SYS_process_vm_readv: ::c_long = 310; -pub const SYS_process_vm_writev: ::c_long = 311; -pub const SYS_kcmp: ::c_long = 312; -pub const SYS_finit_module: ::c_long = 313; -pub const SYS_sched_setattr: ::c_long = 314; -pub const SYS_sched_getattr: ::c_long = 315; -pub const SYS_renameat2: ::c_long = 316; -pub const SYS_seccomp: ::c_long = 317; -pub const SYS_getrandom: ::c_long = 318; -pub const SYS_memfd_create: ::c_long = 319; -pub const SYS_kexec_file_load: ::c_long = 320; -pub const SYS_bpf: ::c_long = 321; -pub const SYS_execveat: ::c_long = 322; -pub const SYS_userfaultfd: ::c_long = 323; -pub const SYS_membarrier: ::c_long = 324; -pub const SYS_mlock2: ::c_long = 325; -pub const SYS_copy_file_range: ::c_long = 326; -pub const SYS_preadv2: ::c_long = 327; -pub const SYS_pwritev2: ::c_long = 328; -pub const SYS_pkey_mprotect: ::c_long = 329; -pub const SYS_pkey_alloc: ::c_long = 330; -pub const SYS_pkey_free: ::c_long = 331; - -#[link(name = "util")] -extern { - pub fn sysctl(name: *mut ::c_int, - namelen: ::c_int, - oldp: *mut ::c_void, - oldlenp: *mut ::size_t, - newp: *mut ::c_void, - newlen: ::size_t) - -> ::c_int; -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,930 +0,0 @@ -//! PowerPC64-specific definitions for 64-bit linux-like values - -use pthread_mutex_t; - -pub type c_long = i64; -pub type c_ulong = u64; -pub type c_char = u8; -pub type wchar_t = i32; -pub type nlink_t = u64; -pub type blksize_t = i64; -pub type suseconds_t = i64; -pub type __u64 = ::c_ulong; - -s! { - pub struct stat { - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_nlink: ::nlink_t, - pub st_mode: ::mode_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - __pad0: ::c_int, - pub st_rdev: ::dev_t, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - __unused: [::c_long; 3], - } - - pub struct stat64 { - pub st_dev: ::dev_t, - pub st_ino: ::ino64_t, - pub st_nlink: ::nlink_t, - pub st_mode: ::mode_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - __pad0: ::c_int, - pub st_rdev: ::dev_t, - pub st_size: ::off64_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt64_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - __reserved: [::c_long; 3], - } - - pub struct statfs64 { - pub f_type: ::__fsword_t, - pub f_bsize: ::__fsword_t, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_fsid: ::fsid_t, - pub f_namelen: ::__fsword_t, - pub f_frsize: ::__fsword_t, - pub f_flags: ::__fsword_t, - pub f_spare: [::__fsword_t; 4], - } - - pub struct statvfs { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_favail: ::fsfilcnt_t, - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct statvfs64 { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_favail: u64, - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct pthread_attr_t { - __size: [u64; 7] - } - - pub struct ipc_perm { - pub __key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::mode_t, - pub __seq: ::uint32_t, - __pad1: ::uint32_t, - __unused1: ::uint64_t, - __unused2: ::c_ulong, - } - - pub struct shmid_ds { - pub shm_perm: ::ipc_perm, - pub shm_atime: ::time_t, - pub shm_dtime: ::time_t, - pub shm_ctime: ::time_t, - pub shm_segsz: ::size_t, - pub shm_cpid: ::pid_t, - pub shm_lpid: ::pid_t, - pub shm_nattch: ::shmatt_t, - __unused4: ::c_ulong, - __unused5: ::c_ulong - } -} - -pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; - -pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; -pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; - -pub const RLIMIT_NOFILE: ::c_int = 7; -pub const RLIMIT_NPROC: ::c_int = 6; - -pub const O_APPEND: ::c_int = 1024; -pub const O_CREAT: ::c_int = 64; -pub const O_EXCL: ::c_int = 128; -pub const O_NOCTTY: ::c_int = 256; -pub const O_NONBLOCK: ::c_int = 2048; -pub const O_SYNC: ::c_int = 1052672; -pub const O_RSYNC: ::c_int = 1052672; -pub const O_DSYNC: ::c_int = 4096; -pub const O_FSYNC: ::c_int = 0x101000; -pub const O_NOATIME: ::c_int = 0o1000000; -pub const O_PATH: ::c_int = 0o10000000; -pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; - -pub const MAP_GROWSDOWN: ::c_int = 0x0100; - -pub const EDEADLK: ::c_int = 35; -pub const ENAMETOOLONG: ::c_int = 36; -pub const ENOLCK: ::c_int = 37; -pub const ENOSYS: ::c_int = 38; -pub const ENOTEMPTY: ::c_int = 39; -pub const ELOOP: ::c_int = 40; -pub const ENOMSG: ::c_int = 42; -pub const EIDRM: ::c_int = 43; -pub const ECHRNG: ::c_int = 44; -pub const EL2NSYNC: ::c_int = 45; -pub const EL3HLT: ::c_int = 46; -pub const EL3RST: ::c_int = 47; -pub const ELNRNG: ::c_int = 48; -pub const EUNATCH: ::c_int = 49; -pub const ENOCSI: ::c_int = 50; -pub const EL2HLT: ::c_int = 51; -pub const EBADE: ::c_int = 52; -pub const EBADR: ::c_int = 53; -pub const EXFULL: ::c_int = 54; -pub const ENOANO: ::c_int = 55; -pub const EBADRQC: ::c_int = 56; -pub const EBADSLT: ::c_int = 57; -pub const EMULTIHOP: ::c_int = 72; -pub const EOVERFLOW: ::c_int = 75; -pub const ENOTUNIQ: ::c_int = 76; -pub const EBADFD: ::c_int = 77; -pub const EBADMSG: ::c_int = 74; -pub const EREMCHG: ::c_int = 78; -pub const ELIBACC: ::c_int = 79; -pub const ELIBBAD: ::c_int = 80; -pub const ELIBSCN: ::c_int = 81; -pub const ELIBMAX: ::c_int = 82; -pub const ELIBEXEC: ::c_int = 83; -pub const EILSEQ: ::c_int = 84; -pub const ERESTART: ::c_int = 85; -pub const ESTRPIPE: ::c_int = 86; -pub const EUSERS: ::c_int = 87; -pub const ENOTSOCK: ::c_int = 88; -pub const EDESTADDRREQ: ::c_int = 89; -pub const EMSGSIZE: ::c_int = 90; -pub const EPROTOTYPE: ::c_int = 91; -pub const ENOPROTOOPT: ::c_int = 92; -pub const EPROTONOSUPPORT: ::c_int = 93; -pub const ESOCKTNOSUPPORT: ::c_int = 94; -pub const EOPNOTSUPP: ::c_int = 95; -pub const EPFNOSUPPORT: ::c_int = 96; -pub const EAFNOSUPPORT: ::c_int = 97; -pub const EADDRINUSE: ::c_int = 98; -pub const EADDRNOTAVAIL: ::c_int = 99; -pub const ENETDOWN: ::c_int = 100; -pub const ENETUNREACH: ::c_int = 101; -pub const ENETRESET: ::c_int = 102; -pub const ECONNABORTED: ::c_int = 103; -pub const ECONNRESET: ::c_int = 104; -pub const ENOBUFS: ::c_int = 105; -pub const EISCONN: ::c_int = 106; -pub const ENOTCONN: ::c_int = 107; -pub const ESHUTDOWN: ::c_int = 108; -pub const ETOOMANYREFS: ::c_int = 109; -pub const ETIMEDOUT: ::c_int = 110; -pub const ECONNREFUSED: ::c_int = 111; -pub const EHOSTDOWN: ::c_int = 112; -pub const EHOSTUNREACH: ::c_int = 113; -pub const EALREADY: ::c_int = 114; -pub const EINPROGRESS: ::c_int = 115; -pub const ESTALE: ::c_int = 116; -pub const EDQUOT: ::c_int = 122; -pub const ENOMEDIUM: ::c_int = 123; -pub const EMEDIUMTYPE: ::c_int = 124; -pub const ECANCELED: ::c_int = 125; -pub const ENOKEY: ::c_int = 126; -pub const EKEYEXPIRED: ::c_int = 127; -pub const EKEYREVOKED: ::c_int = 128; -pub const EKEYREJECTED: ::c_int = 129; -pub const EOWNERDEAD: ::c_int = 130; -pub const ENOTRECOVERABLE: ::c_int = 131; -pub const EHWPOISON: ::c_int = 133; -pub const ERFKILL: ::c_int = 132; - -pub const SOL_SOCKET: ::c_int = 1; - -pub const SO_REUSEADDR: ::c_int = 2; -pub const SO_TYPE: ::c_int = 3; -pub const SO_ERROR: ::c_int = 4; -pub const SO_DONTROUTE: ::c_int = 5; -pub const SO_BROADCAST: ::c_int = 6; -pub const SO_SNDBUF: ::c_int = 7; -pub const SO_RCVBUF: ::c_int = 8; -pub const SO_SNDBUFFORCE: ::c_int = 32; -pub const SO_RCVBUFFORCE: ::c_int = 33; -pub const SO_KEEPALIVE: ::c_int = 9; -pub const SO_OOBINLINE: ::c_int = 10; -pub const SO_NO_CHECK: ::c_int = 11; -pub const SO_PRIORITY: ::c_int = 12; -pub const SO_LINGER: ::c_int = 13; -pub const SO_BSDCOMPAT: ::c_int = 14; -pub const SO_REUSEPORT: ::c_int = 15; -pub const SO_PASSCRED: ::c_int = 20; -pub const SO_PEERCRED: ::c_int = 21; -pub const SO_RCVLOWAT: ::c_int = 16; -pub const SO_SNDLOWAT: ::c_int = 17; -pub const SO_RCVTIMEO: ::c_int = 18; -pub const SO_SNDTIMEO: ::c_int = 19; -pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22; -pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23; -pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24; -pub const SO_BINDTODEVICE: ::c_int = 25; -pub const SO_ATTACH_FILTER: ::c_int = 26; -pub const SO_DETACH_FILTER: ::c_int = 27; -pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER; -pub const SO_PEERNAME: ::c_int = 28; -pub const SO_TIMESTAMP: ::c_int = 29; -pub const SO_ACCEPTCONN: ::c_int = 30; -pub const SO_PEERSEC: ::c_int = 31; -pub const SO_PASSSEC: ::c_int = 34; -pub const SO_TIMESTAMPNS: ::c_int = 35; -pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS; -pub const SO_MARK: ::c_int = 36; -pub const SO_PROTOCOL: ::c_int = 38; -pub const SO_DOMAIN: ::c_int = 39; -pub const SO_RXQ_OVFL: ::c_int = 40; -pub const SO_WIFI_STATUS: ::c_int = 41; -pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS; -pub const SO_PEEK_OFF: ::c_int = 42; -pub const SO_NOFCS: ::c_int = 43; -pub const SO_LOCK_FILTER: ::c_int = 44; -pub const SO_SELECT_ERR_QUEUE: ::c_int = 45; -pub const SO_BUSY_POLL: ::c_int = 46; -pub const SO_MAX_PACING_RATE: ::c_int = 47; -pub const SO_BPF_EXTENSIONS: ::c_int = 48; -pub const SO_INCOMING_CPU: ::c_int = 49; -pub const SO_ATTACH_BPF: ::c_int = 50; -pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER; - -pub const SA_ONSTACK: ::c_int = 0x08000000; -pub const SA_SIGINFO: ::c_int = 0x00000004; -pub const SA_NOCLDWAIT: ::c_int = 0x00000002; - -pub const SIGCHLD: ::c_int = 17; -pub const SIGBUS: ::c_int = 7; -pub const SIGUSR1: ::c_int = 10; -pub const SIGUSR2: ::c_int = 12; -pub const SIGCONT: ::c_int = 18; -pub const SIGSTOP: ::c_int = 19; -pub const SIGTSTP: ::c_int = 20; -pub const SIGURG: ::c_int = 23; -pub const SIGIO: ::c_int = 29; -pub const SIGSYS: ::c_int = 31; -pub const SIGSTKFLT: ::c_int = 16; -pub const SIGUNUSED: ::c_int = 31; -pub const SIGPOLL: ::c_int = 29; -pub const SIGPWR: ::c_int = 30; -pub const SIG_SETMASK: ::c_int = 2; -pub const SIG_BLOCK: ::c_int = 0x000000; -pub const SIG_UNBLOCK: ::c_int = 0x01; - -pub const POLLWRNORM: ::c_short = 0x100; -pub const POLLWRBAND: ::c_short = 0x200; - -pub const O_ASYNC: ::c_int = 0x2000; -pub const O_NDELAY: ::c_int = 0x800; - -pub const PTRACE_DETACH: ::c_uint = 17; - -pub const EFD_NONBLOCK: ::c_int = 0x800; - -pub const F_GETLK: ::c_int = 5; -pub const F_GETOWN: ::c_int = 9; -pub const F_SETOWN: ::c_int = 8; -pub const F_SETLK: ::c_int = 6; -pub const F_SETLKW: ::c_int = 7; - -pub const F_RDLCK: ::c_int = 0; -pub const F_WRLCK: ::c_int = 1; -pub const F_UNLCK: ::c_int = 2; - -pub const SFD_NONBLOCK: ::c_int = 0x0800; - -pub const TIOCEXCL: ::c_ulong = 0x540C; -pub const TIOCNXCL: ::c_ulong = 0x540D; -pub const TIOCSCTTY: ::c_ulong = 0x540E; -pub const TIOCSTI: ::c_ulong = 0x5412; -pub const TIOCMGET: ::c_ulong = 0x5415; -pub const TIOCMBIS: ::c_ulong = 0x5416; -pub const TIOCMBIC: ::c_ulong = 0x5417; -pub const TIOCMSET: ::c_ulong = 0x5418; -pub const TIOCCONS: ::c_ulong = 0x541D; - -pub const SFD_CLOEXEC: ::c_int = 0x080000; - -pub const NCCS: usize = 32; - -pub const O_TRUNC: ::c_int = 512; - -pub const O_CLOEXEC: ::c_int = 0x80000; - -pub const EBFONT: ::c_int = 59; -pub const ENOSTR: ::c_int = 60; -pub const ENODATA: ::c_int = 61; -pub const ETIME: ::c_int = 62; -pub const ENOSR: ::c_int = 63; -pub const ENONET: ::c_int = 64; -pub const ENOPKG: ::c_int = 65; -pub const EREMOTE: ::c_int = 66; -pub const ENOLINK: ::c_int = 67; -pub const EADV: ::c_int = 68; -pub const ESRMNT: ::c_int = 69; -pub const ECOMM: ::c_int = 70; -pub const EPROTO: ::c_int = 71; -pub const EDOTDOT: ::c_int = 73; - -pub const SA_NODEFER: ::c_int = 0x40000000; -pub const SA_RESETHAND: ::c_int = 0x80000000; -pub const SA_RESTART: ::c_int = 0x10000000; -pub const SA_NOCLDSTOP: ::c_int = 0x00000001; - -pub const EPOLL_CLOEXEC: ::c_int = 0x80000; - -pub const EFD_CLOEXEC: ::c_int = 0x80000; - -pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; -pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; -pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; - -align_const! { - #[cfg(target_endian = "little")] - pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 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, 0, - ], - }; - #[cfg(target_endian = "little")] - pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }; - #[cfg(target_endian = "little")] - pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }; - #[cfg(target_endian = "big")] - pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 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, - ], - }; - #[cfg(target_endian = "big")] - pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }; - #[cfg(target_endian = "big")] - pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }; -} - -pub const O_DIRECTORY: ::c_int = 0x4000; -pub const O_NOFOLLOW: ::c_int = 0x8000; -pub const O_DIRECT: ::c_int = 0x20000; - -pub const MAP_LOCKED: ::c_int = 0x00080; -pub const MAP_NORESERVE: ::c_int = 0x00040; - -pub const EDEADLOCK: ::c_int = 58; - -pub const FIOCLEX: ::c_ulong = 0x20006601; -pub const FIONBIO: ::c_ulong = 0x8004667e; - -pub const MCL_CURRENT: ::c_int = 0x2000; -pub const MCL_FUTURE: ::c_int = 0x4000; - -pub const SIGSTKSZ: ::size_t = 0x4000; -pub const MINSIGSTKSZ: ::size_t = 4096; -pub const CBAUD: ::tcflag_t = 0xff; -pub const TAB1: ::c_int = 0x400; -pub const TAB2: ::c_int = 0x800; -pub const TAB3: ::c_int = 0xc00; -pub const CR1: ::c_int = 0x1000; -pub const CR2: ::c_int = 0x2000; -pub const CR3: ::c_int = 0x3000; -pub const FF1: ::c_int = 0x4000; -pub const BS1: ::c_int = 0x8000; -pub const VT1: ::c_int = 0x10000; -pub const VWERASE: usize = 0xa; -pub const VREPRINT: usize = 0xb; -pub const VSUSP: usize = 0xc; -pub const VSTART: usize = 0xd; -pub const VSTOP: usize = 0xe; -pub const VDISCARD: usize = 0x10; -pub const VTIME: usize = 0x7; -pub const IXON: ::tcflag_t = 0x200; -pub const IXOFF: ::tcflag_t = 0x400; -pub const ONLCR: ::tcflag_t = 0x2; -pub const CSIZE: ::tcflag_t = 0x300; -pub const CS6: ::tcflag_t = 0x100; -pub const CS7: ::tcflag_t = 0x200; -pub const CS8: ::tcflag_t = 0x300; -pub const CSTOPB: ::tcflag_t = 0x400; -pub const CREAD: ::tcflag_t = 0x800; -pub const PARENB: ::tcflag_t = 0x1000; -pub const PARODD: ::tcflag_t = 0x2000; -pub const HUPCL: ::tcflag_t = 0x4000; -pub const CLOCAL: ::tcflag_t = 0x8000; -pub const ECHOKE: ::tcflag_t = 0x1; -pub const ECHOE: ::tcflag_t = 0x2; -pub const ECHOK: ::tcflag_t = 0x4; -pub const ECHONL: ::tcflag_t = 0x10; -pub const ECHOPRT: ::tcflag_t = 0x20; -pub const ECHOCTL: ::tcflag_t = 0x40; -pub const ISIG: ::tcflag_t = 0x80; -pub const ICANON: ::tcflag_t = 0x100; -pub const PENDIN: ::tcflag_t = 0x20000000; -pub const NOFLSH: ::tcflag_t = 0x80000000; -pub const VSWTC: usize = 9; -pub const OLCUC: ::tcflag_t = 0o000004; -pub const NLDLY: ::tcflag_t = 0o001400; -pub const CRDLY: ::tcflag_t = 0o030000; -pub const TABDLY: ::tcflag_t = 0o006000; -pub const BSDLY: ::tcflag_t = 0o100000; -pub const FFDLY: ::tcflag_t = 0o040000; -pub const VTDLY: ::tcflag_t = 0o200000; -pub const XTABS: ::tcflag_t = 0o006000; - -pub const B0: ::speed_t = 0o000000; -pub const B50: ::speed_t = 0o000001; -pub const B75: ::speed_t = 0o000002; -pub const B110: ::speed_t = 0o000003; -pub const B134: ::speed_t = 0o000004; -pub const B150: ::speed_t = 0o000005; -pub const B200: ::speed_t = 0o000006; -pub const B300: ::speed_t = 0o000007; -pub const B600: ::speed_t = 0o000010; -pub const B1200: ::speed_t = 0o000011; -pub const B1800: ::speed_t = 0o000012; -pub const B2400: ::speed_t = 0o000013; -pub const B4800: ::speed_t = 0o000014; -pub const B9600: ::speed_t = 0o000015; -pub const B19200: ::speed_t = 0o000016; -pub const B38400: ::speed_t = 0o000017; -pub const EXTA: ::speed_t = B19200; -pub const EXTB: ::speed_t = B38400; -pub const CBAUDEX: ::speed_t = 0o000020; -pub const B57600: ::speed_t = 0o0020; -pub const B115200: ::speed_t = 0o0021; -pub const B230400: ::speed_t = 0o0022; -pub const B460800: ::speed_t = 0o0023; -pub const B500000: ::speed_t = 0o0024; -pub const B576000: ::speed_t = 0o0025; -pub const B921600: ::speed_t = 0o0026; -pub const B1000000: ::speed_t = 0o0027; -pub const B1152000: ::speed_t = 0o0030; -pub const B1500000: ::speed_t = 0o0031; -pub const B2000000: ::speed_t = 0o0032; -pub const B2500000: ::speed_t = 0o0033; -pub const B3000000: ::speed_t = 0o0034; -pub const B3500000: ::speed_t = 0o0035; -pub const B4000000: ::speed_t = 0o0036; -pub const BOTHER: ::speed_t = 0o0037; - -pub const VEOL: usize = 6; -pub const VEOL2: usize = 8; -pub const VMIN: usize = 5; -pub const IEXTEN: ::tcflag_t = 0x400; -pub const TOSTOP: ::tcflag_t = 0x400000; -pub const FLUSHO: ::tcflag_t = 0x800000; -pub const EXTPROC: ::tcflag_t = 0x10000000; -pub const TCGETS: ::c_ulong = 0x403c7413; -pub const TCSETS: ::c_ulong = 0x803c7414; -pub const TCSETSW: ::c_ulong = 0x803c7415; -pub const TCSETSF: ::c_ulong = 0x803c7416; -pub const TCGETA: ::c_ulong = 0x40147417; -pub const TCSETA: ::c_ulong = 0x80147418; -pub const TCSETAW: ::c_ulong = 0x80147419; -pub const TCSETAF: ::c_ulong = 0x8014741c; -pub const TCSBRK: ::c_ulong = 0x2000741d; -pub const TCXONC: ::c_ulong = 0x2000741e; -pub const TCFLSH: ::c_ulong = 0x2000741f; -pub const TIOCINQ: ::c_ulong = 0x4004667f; -pub const TIOCGPGRP: ::c_ulong = 0x40047477; -pub const TIOCSPGRP: ::c_ulong = 0x80047476; -pub const TIOCOUTQ: ::c_ulong = 0x40047473; -pub const TIOCGWINSZ: ::c_ulong = 0x40087468; -pub const TIOCSWINSZ: ::c_ulong = 0x80087467; -pub const FIONREAD: ::c_ulong = 0x4004667f; - -// Syscall table -pub const SYS_restart_syscall: ::c_long = 0; -pub const SYS_exit: ::c_long = 1; -pub const SYS_fork: ::c_long = 2; -pub const SYS_read: ::c_long = 3; -pub const SYS_write: ::c_long = 4; -pub const SYS_open: ::c_long = 5; -pub const SYS_close: ::c_long = 6; -pub const SYS_waitpid: ::c_long = 7; -pub const SYS_creat: ::c_long = 8; -pub const SYS_link: ::c_long = 9; -pub const SYS_unlink: ::c_long = 10; -pub const SYS_execve: ::c_long = 11; -pub const SYS_chdir: ::c_long = 12; -pub const SYS_time: ::c_long = 13; -pub const SYS_mknod: ::c_long = 14; -pub const SYS_chmod: ::c_long = 15; -pub const SYS_lchown: ::c_long = 16; -pub const SYS_break: ::c_long = 17; -pub const SYS_oldstat: ::c_long = 18; -pub const SYS_lseek: ::c_long = 19; -pub const SYS_getpid: ::c_long = 20; -pub const SYS_mount: ::c_long = 21; -pub const SYS_umount: ::c_long = 22; -pub const SYS_setuid: ::c_long = 23; -pub const SYS_getuid: ::c_long = 24; -pub const SYS_stime: ::c_long = 25; -pub const SYS_ptrace: ::c_long = 26; -pub const SYS_alarm: ::c_long = 27; -pub const SYS_oldfstat: ::c_long = 28; -pub const SYS_pause: ::c_long = 29; -pub const SYS_utime: ::c_long = 30; -pub const SYS_stty: ::c_long = 31; -pub const SYS_gtty: ::c_long = 32; -pub const SYS_access: ::c_long = 33; -pub const SYS_nice: ::c_long = 34; -pub const SYS_ftime: ::c_long = 35; -pub const SYS_sync: ::c_long = 36; -pub const SYS_kill: ::c_long = 37; -pub const SYS_rename: ::c_long = 38; -pub const SYS_mkdir: ::c_long = 39; -pub const SYS_rmdir: ::c_long = 40; -pub const SYS_dup: ::c_long = 41; -pub const SYS_pipe: ::c_long = 42; -pub const SYS_times: ::c_long = 43; -pub const SYS_prof: ::c_long = 44; -pub const SYS_brk: ::c_long = 45; -pub const SYS_setgid: ::c_long = 46; -pub const SYS_getgid: ::c_long = 47; -pub const SYS_signal: ::c_long = 48; -pub const SYS_geteuid: ::c_long = 49; -pub const SYS_getegid: ::c_long = 50; -pub const SYS_acct: ::c_long = 51; -pub const SYS_umount2: ::c_long = 52; -pub const SYS_lock: ::c_long = 53; -pub const SYS_ioctl: ::c_long = 54; -pub const SYS_fcntl: ::c_long = 55; -pub const SYS_mpx: ::c_long = 56; -pub const SYS_setpgid: ::c_long = 57; -pub const SYS_ulimit: ::c_long = 58; -pub const SYS_oldolduname: ::c_long = 59; -pub const SYS_umask: ::c_long = 60; -pub const SYS_chroot: ::c_long = 61; -pub const SYS_ustat: ::c_long = 62; -pub const SYS_dup2: ::c_long = 63; -pub const SYS_getppid: ::c_long = 64; -pub const SYS_getpgrp: ::c_long = 65; -pub const SYS_setsid: ::c_long = 66; -pub const SYS_sigaction: ::c_long = 67; -pub const SYS_sgetmask: ::c_long = 68; -pub const SYS_ssetmask: ::c_long = 69; -pub const SYS_setreuid: ::c_long = 70; -pub const SYS_setregid: ::c_long = 71; -pub const SYS_sigsuspend: ::c_long = 72; -pub const SYS_sigpending: ::c_long = 73; -pub const SYS_sethostname: ::c_long = 74; -pub const SYS_setrlimit: ::c_long = 75; -pub const SYS_getrlimit: ::c_long = 76; -pub const SYS_getrusage: ::c_long = 77; -pub const SYS_gettimeofday: ::c_long = 78; -pub const SYS_settimeofday: ::c_long = 79; -pub const SYS_getgroups: ::c_long = 80; -pub const SYS_setgroups: ::c_long = 81; -pub const SYS_select: ::c_long = 82; -pub const SYS_symlink: ::c_long = 83; -pub const SYS_oldlstat: ::c_long = 84; -pub const SYS_readlink: ::c_long = 85; -pub const SYS_uselib: ::c_long = 86; -pub const SYS_swapon: ::c_long = 87; -pub const SYS_reboot: ::c_long = 88; -pub const SYS_readdir: ::c_long = 89; -pub const SYS_mmap: ::c_long = 90; -pub const SYS_munmap: ::c_long = 91; -pub const SYS_truncate: ::c_long = 92; -pub const SYS_ftruncate: ::c_long = 93; -pub const SYS_fchmod: ::c_long = 94; -pub const SYS_fchown: ::c_long = 95; -pub const SYS_getpriority: ::c_long = 96; -pub const SYS_setpriority: ::c_long = 97; -pub const SYS_profil: ::c_long = 98; -pub const SYS_statfs: ::c_long = 99; -pub const SYS_fstatfs: ::c_long = 100; -pub const SYS_ioperm: ::c_long = 101; -pub const SYS_socketcall: ::c_long = 102; -pub const SYS_syslog: ::c_long = 103; -pub const SYS_setitimer: ::c_long = 104; -pub const SYS_getitimer: ::c_long = 105; -pub const SYS_stat: ::c_long = 106; -pub const SYS_lstat: ::c_long = 107; -pub const SYS_fstat: ::c_long = 108; -pub const SYS_olduname: ::c_long = 109; -pub const SYS_iopl: ::c_long = 110; -pub const SYS_vhangup: ::c_long = 111; -pub const SYS_idle: ::c_long = 112; -pub const SYS_vm86: ::c_long = 113; -pub const SYS_wait4: ::c_long = 114; -pub const SYS_swapoff: ::c_long = 115; -pub const SYS_sysinfo: ::c_long = 116; -pub const SYS_ipc: ::c_long = 117; -pub const SYS_fsync: ::c_long = 118; -pub const SYS_sigreturn: ::c_long = 119; -pub const SYS_clone: ::c_long = 120; -pub const SYS_setdomainname: ::c_long = 121; -pub const SYS_uname: ::c_long = 122; -pub const SYS_modify_ldt: ::c_long = 123; -pub const SYS_adjtimex: ::c_long = 124; -pub const SYS_mprotect: ::c_long = 125; -pub const SYS_sigprocmask: ::c_long = 126; -pub const SYS_create_module: ::c_long = 127; -pub const SYS_init_module: ::c_long = 128; -pub const SYS_delete_module: ::c_long = 129; -pub const SYS_get_kernel_syms: ::c_long = 130; -pub const SYS_quotactl: ::c_long = 131; -pub const SYS_getpgid: ::c_long = 132; -pub const SYS_fchdir: ::c_long = 133; -pub const SYS_bdflush: ::c_long = 134; -pub const SYS_sysfs: ::c_long = 135; -pub const SYS_personality: ::c_long = 136; -pub const SYS_afs_syscall: ::c_long = 137; /* Syscall for Andrew File System */ -pub const SYS_setfsuid: ::c_long = 138; -pub const SYS_setfsgid: ::c_long = 139; -pub const SYS__llseek: ::c_long = 140; -pub const SYS_getdents: ::c_long = 141; -pub const SYS__newselect: ::c_long = 142; -pub const SYS_flock: ::c_long = 143; -pub const SYS_msync: ::c_long = 144; -pub const SYS_readv: ::c_long = 145; -pub const SYS_writev: ::c_long = 146; -pub const SYS_getsid: ::c_long = 147; -pub const SYS_fdatasync: ::c_long = 148; -pub const SYS__sysctl: ::c_long = 149; -pub const SYS_mlock: ::c_long = 150; -pub const SYS_munlock: ::c_long = 151; -pub const SYS_mlockall: ::c_long = 152; -pub const SYS_munlockall: ::c_long = 153; -pub const SYS_sched_setparam: ::c_long = 154; -pub const SYS_sched_getparam: ::c_long = 155; -pub const SYS_sched_setscheduler: ::c_long = 156; -pub const SYS_sched_getscheduler: ::c_long = 157; -pub const SYS_sched_yield: ::c_long = 158; -pub const SYS_sched_get_priority_max: ::c_long = 159; -pub const SYS_sched_get_priority_min: ::c_long = 160; -pub const SYS_sched_rr_get_interval: ::c_long = 161; -pub const SYS_nanosleep: ::c_long = 162; -pub const SYS_mremap: ::c_long = 163; -pub const SYS_setresuid: ::c_long = 164; -pub const SYS_getresuid: ::c_long = 165; -pub const SYS_query_module: ::c_long = 166; -pub const SYS_poll: ::c_long = 167; -pub const SYS_nfsservctl: ::c_long = 168; -pub const SYS_setresgid: ::c_long = 169; -pub const SYS_getresgid: ::c_long = 170; -pub const SYS_prctl: ::c_long = 171; -pub const SYS_rt_sigreturn: ::c_long = 172; -pub const SYS_rt_sigaction: ::c_long = 173; -pub const SYS_rt_sigprocmask: ::c_long = 174; -pub const SYS_rt_sigpending: ::c_long = 175; -pub const SYS_rt_sigtimedwait: ::c_long = 176; -pub const SYS_rt_sigqueueinfo: ::c_long = 177; -pub const SYS_rt_sigsuspend: ::c_long = 178; -pub const SYS_pread64: ::c_long = 179; -pub const SYS_pwrite64: ::c_long = 180; -pub const SYS_chown: ::c_long = 181; -pub const SYS_getcwd: ::c_long = 182; -pub const SYS_capget: ::c_long = 183; -pub const SYS_capset: ::c_long = 184; -pub const SYS_sigaltstack: ::c_long = 185; -pub const SYS_sendfile: ::c_long = 186; -pub const SYS_getpmsg: ::c_long = 187; /* some people actually want streams */ -pub const SYS_putpmsg: ::c_long = 188; /* some people actually want streams */ -pub const SYS_vfork: ::c_long = 189; -pub const SYS_ugetrlimit: ::c_long = 190; /* SuS compliant getrlimit */ -pub const SYS_readahead: ::c_long = 191; -pub const SYS_pciconfig_read: ::c_long = 198; -pub const SYS_pciconfig_write: ::c_long = 199; -pub const SYS_pciconfig_iobase: ::c_long = 200; -pub const SYS_multiplexer: ::c_long = 201; -pub const SYS_getdents64: ::c_long = 202; -pub const SYS_pivot_root: ::c_long = 203; -pub const SYS_madvise: ::c_long = 205; -pub const SYS_mincore: ::c_long = 206; -pub const SYS_gettid: ::c_long = 207; -pub const SYS_tkill: ::c_long = 208; -pub const SYS_setxattr: ::c_long = 209; -pub const SYS_lsetxattr: ::c_long = 210; -pub const SYS_fsetxattr: ::c_long = 211; -pub const SYS_getxattr: ::c_long = 212; -pub const SYS_lgetxattr: ::c_long = 213; -pub const SYS_fgetxattr: ::c_long = 214; -pub const SYS_listxattr: ::c_long = 215; -pub const SYS_llistxattr: ::c_long = 216; -pub const SYS_flistxattr: ::c_long = 217; -pub const SYS_removexattr: ::c_long = 218; -pub const SYS_lremovexattr: ::c_long = 219; -pub const SYS_fremovexattr: ::c_long = 220; -pub const SYS_futex: ::c_long = 221; -pub const SYS_sched_setaffinity: ::c_long = 222; -pub const SYS_sched_getaffinity: ::c_long = 223; -pub const SYS_tuxcall: ::c_long = 225; -pub const SYS_io_setup: ::c_long = 227; -pub const SYS_io_destroy: ::c_long = 228; -pub const SYS_io_getevents: ::c_long = 229; -pub const SYS_io_submit: ::c_long = 230; -pub const SYS_io_cancel: ::c_long = 231; -pub const SYS_set_tid_address: ::c_long = 232; -pub const SYS_exit_group: ::c_long = 234; -pub const SYS_lookup_dcookie: ::c_long = 235; -pub const SYS_epoll_create: ::c_long = 236; -pub const SYS_epoll_ctl: ::c_long = 237; -pub const SYS_epoll_wait: ::c_long = 238; -pub const SYS_remap_file_pages: ::c_long = 239; -pub const SYS_timer_create: ::c_long = 240; -pub const SYS_timer_settime: ::c_long = 241; -pub const SYS_timer_gettime: ::c_long = 242; -pub const SYS_timer_getoverrun: ::c_long = 243; -pub const SYS_timer_delete: ::c_long = 244; -pub const SYS_clock_settime: ::c_long = 245; -pub const SYS_clock_gettime: ::c_long = 246; -pub const SYS_clock_getres: ::c_long = 247; -pub const SYS_clock_nanosleep: ::c_long = 248; -pub const SYS_swapcontext: ::c_long = 249; -pub const SYS_tgkill: ::c_long = 250; -pub const SYS_utimes: ::c_long = 251; -pub const SYS_statfs64: ::c_long = 252; -pub const SYS_fstatfs64: ::c_long = 253; -pub const SYS_rtas: ::c_long = 255; -pub const SYS_sys_debug_setcontext: ::c_long = 256; -pub const SYS_migrate_pages: ::c_long = 258; -pub const SYS_mbind: ::c_long = 259; -pub const SYS_get_mempolicy: ::c_long = 260; -pub const SYS_set_mempolicy: ::c_long = 261; -pub const SYS_mq_open: ::c_long = 262; -pub const SYS_mq_unlink: ::c_long = 263; -pub const SYS_mq_timedsend: ::c_long = 264; -pub const SYS_mq_timedreceive: ::c_long = 265; -pub const SYS_mq_notify: ::c_long = 266; -pub const SYS_mq_getsetattr: ::c_long = 267; -pub const SYS_kexec_load: ::c_long = 268; -pub const SYS_add_key: ::c_long = 269; -pub const SYS_request_key: ::c_long = 270; -pub const SYS_keyctl: ::c_long = 271; -pub const SYS_waitid: ::c_long = 272; -pub const SYS_ioprio_set: ::c_long = 273; -pub const SYS_ioprio_get: ::c_long = 274; -pub const SYS_inotify_init: ::c_long = 275; -pub const SYS_inotify_add_watch: ::c_long = 276; -pub const SYS_inotify_rm_watch: ::c_long = 277; -pub const SYS_spu_run: ::c_long = 278; -pub const SYS_spu_create: ::c_long = 279; -pub const SYS_pselect6: ::c_long = 280; -pub const SYS_ppoll: ::c_long = 281; -pub const SYS_unshare: ::c_long = 282; -pub const SYS_splice: ::c_long = 283; -pub const SYS_tee: ::c_long = 284; -pub const SYS_vmsplice: ::c_long = 285; -pub const SYS_openat: ::c_long = 286; -pub const SYS_mkdirat: ::c_long = 287; -pub const SYS_mknodat: ::c_long = 288; -pub const SYS_fchownat: ::c_long = 289; -pub const SYS_futimesat: ::c_long = 290; -pub const SYS_newfstatat: ::c_long = 291; -pub const SYS_unlinkat: ::c_long = 292; -pub const SYS_renameat: ::c_long = 293; -pub const SYS_linkat: ::c_long = 294; -pub const SYS_symlinkat: ::c_long = 295; -pub const SYS_readlinkat: ::c_long = 296; -pub const SYS_fchmodat: ::c_long = 297; -pub const SYS_faccessat: ::c_long = 298; -pub const SYS_get_robust_list: ::c_long = 299; -pub const SYS_set_robust_list: ::c_long = 300; -pub const SYS_move_pages: ::c_long = 301; -pub const SYS_getcpu: ::c_long = 302; -pub const SYS_epoll_pwait: ::c_long = 303; -pub const SYS_utimensat: ::c_long = 304; -pub const SYS_signalfd: ::c_long = 305; -pub const SYS_timerfd_create: ::c_long = 306; -pub const SYS_eventfd: ::c_long = 307; -pub const SYS_sync_file_range2: ::c_long = 308; -pub const SYS_fallocate: ::c_long = 309; -pub const SYS_subpage_prot: ::c_long = 310; -pub const SYS_timerfd_settime: ::c_long = 311; -pub const SYS_timerfd_gettime: ::c_long = 312; -pub const SYS_signalfd4: ::c_long = 313; -pub const SYS_eventfd2: ::c_long = 314; -pub const SYS_epoll_create1: ::c_long = 315; -pub const SYS_dup3: ::c_long = 316; -pub const SYS_pipe2: ::c_long = 317; -pub const SYS_inotify_init1: ::c_long = 318; -pub const SYS_perf_event_open: ::c_long = 319; -pub const SYS_preadv: ::c_long = 320; -pub const SYS_pwritev: ::c_long = 321; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 322; -pub const SYS_fanotify_init: ::c_long = 323; -pub const SYS_fanotify_mark: ::c_long = 324; -pub const SYS_prlimit64: ::c_long = 325; -pub const SYS_socket: ::c_long = 326; -pub const SYS_bind: ::c_long = 327; -pub const SYS_connect: ::c_long = 328; -pub const SYS_listen: ::c_long = 329; -pub const SYS_accept: ::c_long = 330; -pub const SYS_getsockname: ::c_long = 331; -pub const SYS_getpeername: ::c_long = 332; -pub const SYS_socketpair: ::c_long = 333; -pub const SYS_send: ::c_long = 334; -pub const SYS_sendto: ::c_long = 335; -pub const SYS_recv: ::c_long = 336; -pub const SYS_recvfrom: ::c_long = 337; -pub const SYS_shutdown: ::c_long = 338; -pub const SYS_setsockopt: ::c_long = 339; -pub const SYS_getsockopt: ::c_long = 340; -pub const SYS_sendmsg: ::c_long = 341; -pub const SYS_recvmsg: ::c_long = 342; -pub const SYS_recvmmsg: ::c_long = 343; -pub const SYS_accept4: ::c_long = 344; -pub const SYS_name_to_handle_at: ::c_long = 345; -pub const SYS_open_by_handle_at: ::c_long = 346; -pub const SYS_clock_adjtime: ::c_long = 347; -pub const SYS_syncfs: ::c_long = 348; -pub const SYS_sendmmsg: ::c_long = 349; -pub const SYS_setns: ::c_long = 350; -pub const SYS_process_vm_readv: ::c_long = 351; -pub const SYS_process_vm_writev: ::c_long = 352; -pub const SYS_finit_module: ::c_long = 353; -pub const SYS_kcmp: ::c_long = 354; -pub const SYS_sched_setattr: ::c_long = 355; -pub const SYS_sched_getattr: ::c_long = 356; -pub const SYS_renameat2: ::c_long = 357; -pub const SYS_seccomp: ::c_long = 358; -pub const SYS_getrandom: ::c_long = 359; -pub const SYS_memfd_create: ::c_long = 360; -pub const SYS_bpf: ::c_long = 361; -pub const SYS_execveat: ::c_long = 362; -pub const SYS_switch_endian: ::c_long = 363; -pub const SYS_userfaultfd: ::c_long = 364; -pub const SYS_membarrier: ::c_long = 365; -pub const SYS_mlock2: ::c_long = 378; -pub const SYS_copy_file_range: ::c_long = 379; -pub const SYS_preadv2: ::c_long = 380; -pub const SYS_pwritev2: ::c_long = 381; -pub const SYS_kexec_file_load: ::c_long = 382; - -#[link(name = "util")] -extern { - pub fn sysctl(name: *mut ::c_int, - namelen: ::c_int, - oldp: *mut ::c_void, - oldlenp: *mut ::size_t, - newp: *mut ::c_void, - newlen: ::size_t) - -> ::c_int; -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b64/sparc64.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b64/sparc64.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b64/sparc64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b64/sparc64.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,868 +0,0 @@ -//! SPARC64-specific definitions for 64-bit linux-like values - -use pthread_mutex_t; - -pub type c_long = i64; -pub type c_ulong = u64; -pub type c_char = i8; -pub type wchar_t = i32; -pub type nlink_t = u32; -pub type blksize_t = i64; -pub type suseconds_t = i32; -pub type __u64 = ::c_ulonglong; - -s! { - pub struct stat { - pub st_dev: ::dev_t, - __pad0: u64, - pub st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __pad1: u64, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - __unused: [::c_long; 2], - } - - pub struct stat64 { - pub st_dev: ::dev_t, - __pad0: u64, - pub st_ino: ::ino64_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __pad2: ::c_int, - pub st_size: ::off64_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt64_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - __reserved: [::c_long; 2], - } - - pub struct statfs64 { - pub f_type: ::__fsword_t, - pub f_bsize: ::__fsword_t, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_fsid: ::fsid_t, - pub f_namelen: ::__fsword_t, - pub f_frsize: ::__fsword_t, - pub f_flags: ::__fsword_t, - pub f_spare: [::__fsword_t; 4], - } - - pub struct statvfs { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_favail: ::fsfilcnt_t, - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct statvfs64 { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_favail: u64, - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct pthread_attr_t { - __size: [u64; 7] - } - - pub struct ipc_perm { - pub __key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::mode_t, - __pad0: u16, - pub __seq: ::c_ushort, - __unused1: ::c_ulonglong, - __unused2: ::c_ulonglong, - } - - pub struct shmid_ds { - pub shm_perm: ::ipc_perm, - pub shm_atime: ::time_t, - pub shm_dtime: ::time_t, - pub shm_ctime: ::time_t, - pub shm_segsz: ::size_t, - pub shm_cpid: ::pid_t, - pub shm_lpid: ::pid_t, - pub shm_nattch: ::shmatt_t, - __reserved1: ::c_ulong, - __reserved2: ::c_ulong - } - - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 19], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } -} - -pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; - -pub const TIOCGSOFTCAR: ::c_ulong = 0x40047464; -pub const TIOCSSOFTCAR: ::c_ulong = 0x80047465; - -pub const RLIMIT_NOFILE: ::c_int = 6; -pub const RLIMIT_NPROC: ::c_int = 7; - -pub const O_APPEND: ::c_int = 0x8; -pub const O_CREAT: ::c_int = 0x200; -pub const O_EXCL: ::c_int = 0x800; -pub const O_NOCTTY: ::c_int = 0x8000; -pub const O_NONBLOCK: ::c_int = 0x4000; -pub const O_SYNC: ::c_int = 0x802000; -pub const O_RSYNC: ::c_int = 0x802000; -pub const O_DSYNC: ::c_int = 0x2000; -pub const O_FSYNC: ::c_int = 0x802000; -pub const O_NOATIME: ::c_int = 0x200000; -pub const O_PATH: ::c_int = 0x1000000; -pub const O_TMPFILE: ::c_int = 0x2000000 | O_DIRECTORY; - -pub const MAP_GROWSDOWN: ::c_int = 0x0200; - -pub const EDEADLK: ::c_int = 78; -pub const ENAMETOOLONG: ::c_int = 63; -pub const ENOLCK: ::c_int = 79; -pub const ENOSYS: ::c_int = 90; -pub const ENOTEMPTY: ::c_int = 66; -pub const ELOOP: ::c_int = 62; -pub const ENOMSG: ::c_int = 75; -pub const EIDRM: ::c_int = 77; -pub const ECHRNG: ::c_int = 94; -pub const EL2NSYNC: ::c_int = 95; -pub const EL3HLT: ::c_int = 96; -pub const EL3RST: ::c_int = 97; -pub const ELNRNG: ::c_int = 98; -pub const EUNATCH: ::c_int = 99; -pub const ENOCSI: ::c_int = 100; -pub const EL2HLT: ::c_int = 101; -pub const EBADE: ::c_int = 102; -pub const EBADR: ::c_int = 103; -pub const EXFULL: ::c_int = 104; -pub const ENOANO: ::c_int = 105; -pub const EBADRQC: ::c_int = 106; -pub const EBADSLT: ::c_int = 107; -pub const EMULTIHOP: ::c_int = 87; -pub const EOVERFLOW: ::c_int = 92; -pub const ENOTUNIQ: ::c_int = 115; -pub const EBADFD: ::c_int = 93; -pub const EBADMSG: ::c_int = 76; -pub const EREMCHG: ::c_int = 89; -pub const ELIBACC: ::c_int = 114; -pub const ELIBBAD: ::c_int = 112; -pub const ELIBSCN: ::c_int = 124; -pub const ELIBMAX: ::c_int = 123; -pub const ELIBEXEC: ::c_int = 110; -pub const EILSEQ: ::c_int = 122; -pub const ERESTART: ::c_int = 116; -pub const ESTRPIPE: ::c_int = 91; -pub const EUSERS: ::c_int = 68; -pub const ENOTSOCK: ::c_int = 38; -pub const EDESTADDRREQ: ::c_int = 39; -pub const EMSGSIZE: ::c_int = 40; -pub const EPROTOTYPE: ::c_int = 41; -pub const ENOPROTOOPT: ::c_int = 42; -pub const EPROTONOSUPPORT: ::c_int = 43; -pub const ESOCKTNOSUPPORT: ::c_int = 44; -pub const EOPNOTSUPP: ::c_int = 45; -pub const EPFNOSUPPORT: ::c_int = 46; -pub const EAFNOSUPPORT: ::c_int = 47; -pub const EADDRINUSE: ::c_int = 48; -pub const EADDRNOTAVAIL: ::c_int = 49; -pub const ENETDOWN: ::c_int = 50; -pub const ENETUNREACH: ::c_int = 51; -pub const ENETRESET: ::c_int = 52; -pub const ECONNABORTED: ::c_int = 53; -pub const ECONNRESET: ::c_int = 54; -pub const ENOBUFS: ::c_int = 55; -pub const EISCONN: ::c_int = 56; -pub const ENOTCONN: ::c_int = 57; -pub const ESHUTDOWN: ::c_int = 58; -pub const ETOOMANYREFS: ::c_int = 59; -pub const ETIMEDOUT: ::c_int = 60; -pub const ECONNREFUSED: ::c_int = 61; -pub const EHOSTDOWN: ::c_int = 64; -pub const EHOSTUNREACH: ::c_int = 65; -pub const EALREADY: ::c_int = 37; -pub const EINPROGRESS: ::c_int = 36; -pub const ESTALE: ::c_int = 70; -pub const EDQUOT: ::c_int = 69; -pub const ENOMEDIUM: ::c_int = 125; -pub const EMEDIUMTYPE: ::c_int = 126; -pub const ECANCELED: ::c_int = 127; -pub const ENOKEY: ::c_int = 128; -pub const EKEYEXPIRED: ::c_int = 129; -pub const EKEYREVOKED: ::c_int = 130; -pub const EKEYREJECTED: ::c_int = 131; -pub const EOWNERDEAD: ::c_int = 132; -pub const ENOTRECOVERABLE: ::c_int = 133; -pub const EHWPOISON: ::c_int = 135; -pub const ERFKILL: ::c_int = 134; - -pub const SOL_SOCKET: ::c_int = 0xffff; - -pub const SO_PASSCRED: ::c_int = 2; -pub const SO_REUSEADDR: ::c_int = 4; -pub const SO_BINDTODEVICE: ::c_int = 0x000d; -pub const SO_TIMESTAMP: ::c_int = 0x001d; -pub const SO_MARK: ::c_int = 0x0022; -pub const SO_RXQ_OVFL: ::c_int = 0x0024; -pub const SO_PEEK_OFF: ::c_int = 0x0026; -pub const SO_BUSY_POLL: ::c_int = 0x0030; -pub const SO_TYPE: ::c_int = 0x1008; -pub const SO_ERROR: ::c_int = 0x1007; -pub const SO_DONTROUTE: ::c_int = 16; -pub const SO_BROADCAST: ::c_int = 32; -pub const SO_SNDBUF: ::c_int = 0x1001; -pub const SO_RCVBUF: ::c_int = 0x1002; -pub const SO_SNDBUFFORCE: ::c_int = 0x100a; -pub const SO_RCVBUFFORCE: ::c_int = 0x100b; -pub const SO_DOMAIN: ::c_int = 0x1029; -pub const SO_KEEPALIVE: ::c_int = 8; -pub const SO_OOBINLINE: ::c_int = 0x100; -pub const SO_LINGER: ::c_int = 128; -pub const SO_REUSEPORT: ::c_int = 0x200; -pub const SO_ACCEPTCONN: ::c_int = 0x8000; - -pub const SA_ONSTACK: ::c_int = 1; -pub const SA_SIGINFO: ::c_int = 0x200; -pub const SA_NOCLDWAIT: ::c_int = 0x100; - -pub const SIGCHLD: ::c_int = 20; -pub const SIGBUS: ::c_int = 10; -pub const SIGUSR1: ::c_int = 30; -pub const SIGUSR2: ::c_int = 31; -pub const SIGCONT: ::c_int = 19; -pub const SIGSTOP: ::c_int = 17; -pub const SIGTSTP: ::c_int = 18; -pub const SIGURG: ::c_int = 16; -pub const SIGIO: ::c_int = 23; -pub const SIGSYS: ::c_int = 12; -pub const SIGPOLL: ::c_int = 23; -pub const SIGPWR: ::c_int = 29; -pub const SIG_SETMASK: ::c_int = 4; -pub const SIG_BLOCK: ::c_int = 1; -pub const SIG_UNBLOCK: ::c_int = 2; - -pub const POLLWRNORM: ::c_short = 4; -pub const POLLWRBAND: ::c_short = 0x100; - -pub const O_ASYNC: ::c_int = 0x40; -pub const O_NDELAY: ::c_int = 0x4004; - -pub const PTRACE_DETACH: ::c_uint = 11; - -pub const EFD_NONBLOCK: ::c_int = 0x4000; - -pub const F_GETLK: ::c_int = 7; -pub const F_GETOWN: ::c_int = 5; -pub const F_SETOWN: ::c_int = 6; -pub const F_SETLK: ::c_int = 8; -pub const F_SETLKW: ::c_int = 9; - -pub const F_RDLCK: ::c_int = 1; -pub const F_WRLCK: ::c_int = 2; -pub const F_UNLCK: ::c_int = 3; - -pub const SFD_NONBLOCK: ::c_int = 0x4000; - -pub const TIOCEXCL: ::c_ulong = 0x2000740d; -pub const TIOCNXCL: ::c_ulong = 0x2000740e; -pub const TIOCSCTTY: ::c_ulong = 0x20007484; -pub const TIOCSTI: ::c_ulong = 0x80017472; -pub const TIOCMGET: ::c_ulong = 0x4004746a; -pub const TIOCMBIS: ::c_ulong = 0x8004746c; -pub const TIOCMBIC: ::c_ulong = 0x8004746b; -pub const TIOCMSET: ::c_ulong = 0x8004746d; -pub const TIOCCONS: ::c_ulong = 0x20007424; - -pub const SFD_CLOEXEC: ::c_int = 0x400000; - -pub const NCCS: usize = 17; -pub const O_TRUNC: ::c_int = 0x400; - -pub const O_CLOEXEC: ::c_int = 0x400000; - -pub const EBFONT: ::c_int = 109; -pub const ENOSTR: ::c_int = 72; -pub const ENODATA: ::c_int = 111; -pub const ETIME: ::c_int = 73; -pub const ENOSR: ::c_int = 74; -pub const ENONET: ::c_int = 80; -pub const ENOPKG: ::c_int = 113; -pub const EREMOTE: ::c_int = 71; -pub const ENOLINK: ::c_int = 82; -pub const EADV: ::c_int = 83; -pub const ESRMNT: ::c_int = 84; -pub const ECOMM: ::c_int = 85; -pub const EPROTO: ::c_int = 86; -pub const EDOTDOT: ::c_int = 88; - -pub const SA_NODEFER: ::c_int = 0x20; -pub const SA_RESETHAND: ::c_int = 0x4; -pub const SA_RESTART: ::c_int = 0x2; -pub const SA_NOCLDSTOP: ::c_int = 0x00000008; - -pub const EPOLL_CLOEXEC: ::c_int = 0x400000; - -pub const EFD_CLOEXEC: ::c_int = 0x400000; -pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; -pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; -pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; - -align_const! { - pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 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, - ], - }; - pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }; - pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }; -} - -pub const O_DIRECTORY: ::c_int = 0o200000; -pub const O_NOFOLLOW: ::c_int = 0o400000; -pub const O_DIRECT: ::c_int = 0x100000; - -pub const MAP_LOCKED: ::c_int = 0x0100; -pub const MAP_NORESERVE: ::c_int = 0x00040; - -pub const EDEADLOCK: ::c_int = 108; - -pub const SO_PEERCRED: ::c_int = 0x40; -pub const SO_RCVLOWAT: ::c_int = 0x800; -pub const SO_SNDLOWAT: ::c_int = 0x1000; -pub const SO_RCVTIMEO: ::c_int = 0x2000; -pub const SO_SNDTIMEO: ::c_int = 0x4000; - -pub const FIOCLEX: ::c_ulong = 0x20006601; -pub const FIONBIO: ::c_ulong = 0x8004667e; - -pub const MCL_CURRENT: ::c_int = 0x2000; -pub const MCL_FUTURE: ::c_int = 0x4000; - -pub const SIGSTKSZ: ::size_t = 16384; -pub const MINSIGSTKSZ: ::size_t = 4096; -pub const CBAUD: ::tcflag_t = 0x0000100f; -pub const TAB1: ::c_int = 0x800; -pub const TAB2: ::c_int = 0x1000; -pub const TAB3: ::c_int = 0x1800; -pub const CR1: ::c_int = 0x200; -pub const CR2: ::c_int = 0x400; -pub const CR3: ::c_int = 0x600; -pub const FF1: ::c_int = 0x8000; -pub const BS1: ::c_int = 0x2000; -pub const VT1: ::c_int = 0x4000; -pub const VWERASE: usize = 0xe; -pub const VREPRINT: usize = 0xc; -pub const VSUSP: usize = 0xa; -pub const VSTART: usize = 0x8; -pub const VSTOP: usize = 0x9; -pub const VDISCARD: usize = 0xd; -pub const VTIME: usize = 0x5; -pub const IXON: ::tcflag_t = 0x400; -pub const IXOFF: ::tcflag_t = 0x1000; -pub const ONLCR: ::tcflag_t = 0x4; -pub const CSIZE: ::tcflag_t = 0x30; -pub const CS6: ::tcflag_t = 0x10; -pub const CS7: ::tcflag_t = 0x20; -pub const CS8: ::tcflag_t = 0x30; -pub const CSTOPB: ::tcflag_t = 0x40; -pub const CREAD: ::tcflag_t = 0x80; -pub const PARENB: ::tcflag_t = 0x100; -pub const PARODD: ::tcflag_t = 0x200; -pub const HUPCL: ::tcflag_t = 0x400; -pub const CLOCAL: ::tcflag_t = 0x800; -pub const ECHOKE: ::tcflag_t = 0x800; -pub const ECHOE: ::tcflag_t = 0x10; -pub const ECHOK: ::tcflag_t = 0x20; -pub const ECHONL: ::tcflag_t = 0x40; -pub const ECHOPRT: ::tcflag_t = 0x400; -pub const ECHOCTL: ::tcflag_t = 0x200; -pub const ISIG: ::tcflag_t = 0x1; -pub const ICANON: ::tcflag_t = 0x2; -pub const PENDIN: ::tcflag_t = 0x4000; -pub const NOFLSH: ::tcflag_t = 0x80; -pub const CIBAUD: ::tcflag_t = 0o02003600000; -pub const CBAUDEX: ::tcflag_t = 0x00001000; -pub const VSWTC: usize = 7; -pub const OLCUC: ::tcflag_t = 0o000002; -pub const NLDLY: ::tcflag_t = 0o000400; -pub const CRDLY: ::tcflag_t = 0o003000; -pub const TABDLY: ::tcflag_t = 0o014000; -pub const BSDLY: ::tcflag_t = 0o020000; -pub const FFDLY: ::tcflag_t = 0o100000; -pub const VTDLY: ::tcflag_t = 0o040000; -pub const XTABS: ::tcflag_t = 0o014000; - -pub const B0: ::speed_t = 0o000000; -pub const B50: ::speed_t = 0o000001; -pub const B75: ::speed_t = 0o000002; -pub const B110: ::speed_t = 0o000003; -pub const B134: ::speed_t = 0o000004; -pub const B150: ::speed_t = 0o000005; -pub const B200: ::speed_t = 0o000006; -pub const B300: ::speed_t = 0o000007; -pub const B600: ::speed_t = 0o000010; -pub const B1200: ::speed_t = 0o000011; -pub const B1800: ::speed_t = 0o000012; -pub const B2400: ::speed_t = 0o000013; -pub const B4800: ::speed_t = 0o000014; -pub const B9600: ::speed_t = 0o000015; -pub const B19200: ::speed_t = 0o000016; -pub const B38400: ::speed_t = 0o000017; -pub const EXTA: ::speed_t = B19200; -pub const EXTB: ::speed_t = B38400; -pub const BOTHER: ::speed_t = 0x1000; -pub const B57600: ::speed_t = 0x1001; -pub const B115200: ::speed_t = 0x1002; -pub const B230400: ::speed_t = 0x1003; -pub const B460800: ::speed_t = 0x1004; -pub const B76800: ::speed_t = 0x1005; -pub const B153600: ::speed_t = 0x1006; -pub const B307200: ::speed_t = 0x1007; -pub const B614400: ::speed_t = 0x1008; -pub const B921600: ::speed_t = 0x1009; -pub const B500000: ::speed_t = 0x100a; -pub const B576000: ::speed_t = 0x100b; -pub const B1000000: ::speed_t = 0x100c; -pub const B1152000: ::speed_t = 0x100d; -pub const B1500000: ::speed_t = 0x100e; -pub const B2000000: ::speed_t = 0x100f; - -pub const VEOL: usize = 5; -pub const VEOL2: usize = 6; -pub const VMIN: usize = 4; -pub const IEXTEN: ::tcflag_t = 0x8000; -pub const TOSTOP: ::tcflag_t = 0x100; -pub const FLUSHO: ::tcflag_t = 0x2000; -pub const EXTPROC: ::tcflag_t = 0x10000; -pub const TCGETS: ::c_ulong = 0x40245408; -pub const TCSETS: ::c_ulong = 0x80245409; -pub const TCSETSW: ::c_ulong = 0x8024540a; -pub const TCSETSF: ::c_ulong = 0x8024540b; -pub const TCGETA: ::c_ulong = 0x40125401; -pub const TCSETA: ::c_ulong = 0x80125402; -pub const TCSETAW: ::c_ulong = 0x80125403; -pub const TCSETAF: ::c_ulong = 0x80125404; -pub const TCSBRK: ::c_ulong = 0x20005405; -pub const TCXONC: ::c_ulong = 0x20005406; -pub const TCFLSH: ::c_ulong = 0x20005407; -pub const TIOCINQ: ::c_ulong = 0x4004667f; -pub const TIOCGPGRP: ::c_ulong = 0x40047483; -pub const TIOCSPGRP: ::c_ulong = 0x80047482; -pub const TIOCOUTQ: ::c_ulong = 0x40047473; -pub const TIOCGWINSZ: ::c_ulong = 0x40087468; -pub const TIOCSWINSZ: ::c_ulong = 0x80087467; -pub const FIONREAD: ::c_ulong = 0x4004667f; - -pub const SYS_restart_syscall: ::c_long = 0; -pub const SYS_exit: ::c_long = 1; -pub const SYS_fork: ::c_long = 2; -pub const SYS_read: ::c_long = 3; -pub const SYS_write: ::c_long = 4; -pub const SYS_open: ::c_long = 5; -pub const SYS_close: ::c_long = 6; -pub const SYS_wait4: ::c_long = 7; -pub const SYS_creat: ::c_long = 8; -pub const SYS_link: ::c_long = 9; -pub const SYS_unlink: ::c_long = 10; -pub const SYS_execv: ::c_long = 11; -pub const SYS_chdir: ::c_long = 12; -pub const SYS_chown: ::c_long = 13; -pub const SYS_mknod: ::c_long = 14; -pub const SYS_chmod: ::c_long = 15; -pub const SYS_lchown: ::c_long = 16; -pub const SYS_brk: ::c_long = 17; -pub const SYS_perfctr: ::c_long = 18; -pub const SYS_lseek: ::c_long = 19; -pub const SYS_getpid: ::c_long = 20; -pub const SYS_capget: ::c_long = 21; -pub const SYS_capset: ::c_long = 22; -pub const SYS_setuid: ::c_long = 23; -pub const SYS_getuid: ::c_long = 24; -pub const SYS_vmsplice: ::c_long = 25; -pub const SYS_ptrace: ::c_long = 26; -pub const SYS_alarm: ::c_long = 27; -pub const SYS_sigaltstack: ::c_long = 28; -pub const SYS_pause: ::c_long = 29; -pub const SYS_utime: ::c_long = 30; -pub const SYS_access: ::c_long = 33; -pub const SYS_nice: ::c_long = 34; -pub const SYS_sync: ::c_long = 36; -pub const SYS_kill: ::c_long = 37; -pub const SYS_stat: ::c_long = 38; -pub const SYS_sendfile: ::c_long = 39; -pub const SYS_lstat: ::c_long = 40; -pub const SYS_dup: ::c_long = 41; -pub const SYS_pipe: ::c_long = 42; -pub const SYS_times: ::c_long = 43; -pub const SYS_umount2: ::c_long = 45; -pub const SYS_setgid: ::c_long = 46; -pub const SYS_getgid: ::c_long = 47; -pub const SYS_signal: ::c_long = 48; -pub const SYS_geteuid: ::c_long = 49; -pub const SYS_getegid: ::c_long = 50; -pub const SYS_acct: ::c_long = 51; -pub const SYS_memory_ordering: ::c_long = 52; -pub const SYS_ioctl: ::c_long = 54; -pub const SYS_reboot: ::c_long = 55; -pub const SYS_symlink: ::c_long = 57; -pub const SYS_readlink: ::c_long = 58; -pub const SYS_execve: ::c_long = 59; -pub const SYS_umask: ::c_long = 60; -pub const SYS_chroot: ::c_long = 61; -pub const SYS_fstat: ::c_long = 62; -pub const SYS_fstat64: ::c_long = 63; -pub const SYS_getpagesize: ::c_long = 64; -pub const SYS_msync: ::c_long = 65; -pub const SYS_vfork: ::c_long = 66; -pub const SYS_pread64: ::c_long = 67; -pub const SYS_pwrite64: ::c_long = 68; -pub const SYS_mmap: ::c_long = 71; -pub const SYS_munmap: ::c_long = 73; -pub const SYS_mprotect: ::c_long = 74; -pub const SYS_madvise: ::c_long = 75; -pub const SYS_vhangup: ::c_long = 76; -pub const SYS_mincore: ::c_long = 78; -pub const SYS_getgroups: ::c_long = 79; -pub const SYS_setgroups: ::c_long = 80; -pub const SYS_getpgrp: ::c_long = 81; -pub const SYS_setitimer: ::c_long = 83; -pub const SYS_swapon: ::c_long = 85; -pub const SYS_getitimer: ::c_long = 86; -pub const SYS_sethostname: ::c_long = 88; -pub const SYS_dup2: ::c_long = 90; -pub const SYS_fcntl: ::c_long = 92; -pub const SYS_select: ::c_long = 93; -pub const SYS_fsync: ::c_long = 95; -pub const SYS_setpriority: ::c_long = 96; -pub const SYS_socket: ::c_long = 97; -pub const SYS_connect: ::c_long = 98; -pub const SYS_accept: ::c_long = 99; -pub const SYS_getpriority: ::c_long = 100; -pub const SYS_rt_sigreturn: ::c_long = 101; -pub const SYS_rt_sigaction: ::c_long = 102; -pub const SYS_rt_sigprocmask: ::c_long = 103; -pub const SYS_rt_sigpending: ::c_long = 104; -pub const SYS_rt_sigtimedwait: ::c_long = 105; -pub const SYS_rt_sigqueueinfo: ::c_long = 106; -pub const SYS_rt_sigsuspend: ::c_long = 107; -pub const SYS_setresuid: ::c_long = 108; -pub const SYS_getresuid: ::c_long = 109; -pub const SYS_setresgid: ::c_long = 110; -pub const SYS_getresgid: ::c_long = 111; -pub const SYS_recvmsg: ::c_long = 113; -pub const SYS_sendmsg: ::c_long = 114; -pub const SYS_gettimeofday: ::c_long = 116; -pub const SYS_getrusage: ::c_long = 117; -pub const SYS_getsockopt: ::c_long = 118; -pub const SYS_getcwd: ::c_long = 119; -pub const SYS_readv: ::c_long = 120; -pub const SYS_writev: ::c_long = 121; -pub const SYS_settimeofday: ::c_long = 122; -pub const SYS_fchown: ::c_long = 123; -pub const SYS_fchmod: ::c_long = 124; -pub const SYS_recvfrom: ::c_long = 125; -pub const SYS_setreuid: ::c_long = 126; -pub const SYS_setregid: ::c_long = 127; -pub const SYS_rename: ::c_long = 128; -pub const SYS_truncate: ::c_long = 129; -pub const SYS_ftruncate: ::c_long = 130; -pub const SYS_flock: ::c_long = 131; -pub const SYS_lstat64: ::c_long = 132; -pub const SYS_sendto: ::c_long = 133; -pub const SYS_shutdown: ::c_long = 134; -pub const SYS_socketpair: ::c_long = 135; -pub const SYS_mkdir: ::c_long = 136; -pub const SYS_rmdir: ::c_long = 137; -pub const SYS_utimes: ::c_long = 138; -pub const SYS_stat64: ::c_long = 139; -pub const SYS_sendfile64: ::c_long = 140; -pub const SYS_getpeername: ::c_long = 141; -pub const SYS_futex: ::c_long = 142; -pub const SYS_gettid: ::c_long = 143; -pub const SYS_getrlimit: ::c_long = 144; -pub const SYS_setrlimit: ::c_long = 145; -pub const SYS_pivot_root: ::c_long = 146; -pub const SYS_prctl: ::c_long = 147; -pub const SYS_pciconfig_read: ::c_long = 148; -pub const SYS_pciconfig_write: ::c_long = 149; -pub const SYS_getsockname: ::c_long = 150; -pub const SYS_inotify_init: ::c_long = 151; -pub const SYS_inotify_add_watch: ::c_long = 152; -pub const SYS_poll: ::c_long = 153; -pub const SYS_getdents64: ::c_long = 154; -pub const SYS_inotify_rm_watch: ::c_long = 156; -pub const SYS_statfs: ::c_long = 157; -pub const SYS_fstatfs: ::c_long = 158; -pub const SYS_umount: ::c_long = 159; -pub const SYS_sched_set_affinity: ::c_long = 160; -pub const SYS_sched_get_affinity: ::c_long = 161; -pub const SYS_getdomainname: ::c_long = 162; -pub const SYS_setdomainname: ::c_long = 163; -pub const SYS_utrap_install: ::c_long = 164; -pub const SYS_quotactl: ::c_long = 165; -pub const SYS_set_tid_address: ::c_long = 166; -pub const SYS_mount: ::c_long = 167; -pub const SYS_ustat: ::c_long = 168; -pub const SYS_setxattr: ::c_long = 169; -pub const SYS_lsetxattr: ::c_long = 170; -pub const SYS_fsetxattr: ::c_long = 171; -pub const SYS_getxattr: ::c_long = 172; -pub const SYS_lgetxattr: ::c_long = 173; -pub const SYS_getdents: ::c_long = 174; -pub const SYS_setsid: ::c_long = 175; -pub const SYS_fchdir: ::c_long = 176; -pub const SYS_fgetxattr: ::c_long = 177; -pub const SYS_listxattr: ::c_long = 178; -pub const SYS_llistxattr: ::c_long = 179; -pub const SYS_flistxattr: ::c_long = 180; -pub const SYS_removexattr: ::c_long = 181; -pub const SYS_lremovexattr: ::c_long = 182; -pub const SYS_sigpending: ::c_long = 183; -pub const SYS_query_module: ::c_long = 184; -pub const SYS_setpgid: ::c_long = 185; -pub const SYS_fremovexattr: ::c_long = 186; -pub const SYS_tkill: ::c_long = 187; -pub const SYS_exit_group: ::c_long = 188; -pub const SYS_uname: ::c_long = 189; -pub const SYS_init_module: ::c_long = 190; -pub const SYS_personality: ::c_long = 191; -pub const SYS_remap_file_pages: ::c_long = 192; -pub const SYS_epoll_create: ::c_long = 193; -pub const SYS_epoll_ctl: ::c_long = 194; -pub const SYS_epoll_wait: ::c_long = 195; -pub const SYS_ioprio_set: ::c_long = 196; -pub const SYS_getppid: ::c_long = 197; -pub const SYS_sigaction: ::c_long = 198; -pub const SYS_sgetmask: ::c_long = 199; -pub const SYS_ssetmask: ::c_long = 200; -pub const SYS_sigsuspend: ::c_long = 201; -pub const SYS_oldlstat: ::c_long = 202; -pub const SYS_uselib: ::c_long = 203; -pub const SYS_readdir: ::c_long = 204; -pub const SYS_readahead: ::c_long = 205; -pub const SYS_socketcall: ::c_long = 206; -pub const SYS_syslog: ::c_long = 207; -pub const SYS_lookup_dcookie: ::c_long = 208; -pub const SYS_fadvise64: ::c_long = 209; -pub const SYS_fadvise64_64: ::c_long = 210; -pub const SYS_tgkill: ::c_long = 211; -pub const SYS_waitpid: ::c_long = 212; -pub const SYS_swapoff: ::c_long = 213; -pub const SYS_sysinfo: ::c_long = 214; -pub const SYS_ipc: ::c_long = 215; -pub const SYS_sigreturn: ::c_long = 216; -pub const SYS_clone: ::c_long = 217; -pub const SYS_ioprio_get: ::c_long = 218; -pub const SYS_adjtimex: ::c_long = 219; -pub const SYS_sigprocmask: ::c_long = 220; -pub const SYS_create_module: ::c_long = 221; -pub const SYS_delete_module: ::c_long = 222; -pub const SYS_get_kernel_syms: ::c_long = 223; -pub const SYS_getpgid: ::c_long = 224; -pub const SYS_bdflush: ::c_long = 225; -pub const SYS_sysfs: ::c_long = 226; -pub const SYS_afs_syscall: ::c_long = 227; -pub const SYS_setfsuid: ::c_long = 228; -pub const SYS_setfsgid: ::c_long = 229; -pub const SYS__newselect: ::c_long = 230; -pub const SYS_splice: ::c_long = 232; -pub const SYS_stime: ::c_long = 233; -pub const SYS_statfs64: ::c_long = 234; -pub const SYS_fstatfs64: ::c_long = 235; -pub const SYS__llseek: ::c_long = 236; -pub const SYS_mlock: ::c_long = 237; -pub const SYS_munlock: ::c_long = 238; -pub const SYS_mlockall: ::c_long = 239; -pub const SYS_munlockall: ::c_long = 240; -pub const SYS_sched_setparam: ::c_long = 241; -pub const SYS_sched_getparam: ::c_long = 242; -pub const SYS_sched_setscheduler: ::c_long =243; -pub const SYS_sched_getscheduler: ::c_long =244; -pub const SYS_sched_yield: ::c_long = 245; -pub const SYS_sched_get_priority_max: ::c_long =246; -pub const SYS_sched_get_priority_min: ::c_long =247; -pub const SYS_sched_rr_get_interval: ::c_long = 248; -pub const SYS_nanosleep: ::c_long = 249; -pub const SYS_mremap: ::c_long = 250; -pub const SYS__sysctl: ::c_long = 251; -pub const SYS_getsid: ::c_long = 252; -pub const SYS_fdatasync: ::c_long = 253; -pub const SYS_nfsservctl: ::c_long = 254; -pub const SYS_sync_file_range: ::c_long = 255; -pub const SYS_clock_settime: ::c_long = 256; -pub const SYS_clock_gettime: ::c_long = 257; -pub const SYS_clock_getres: ::c_long = 258; -pub const SYS_clock_nanosleep: ::c_long = 259; -pub const SYS_sched_getaffinity: ::c_long = 260; -pub const SYS_sched_setaffinity: ::c_long = 261; -pub const SYS_timer_settime: ::c_long = 262; -pub const SYS_timer_gettime: ::c_long = 263; -pub const SYS_timer_getoverrun: ::c_long = 264; -pub const SYS_timer_delete: ::c_long = 265; -pub const SYS_timer_create: ::c_long = 266; -pub const SYS_io_setup: ::c_long = 268; -pub const SYS_io_destroy: ::c_long = 269; -pub const SYS_io_submit: ::c_long = 270; -pub const SYS_io_cancel: ::c_long = 271; -pub const SYS_io_getevents: ::c_long = 272; -pub const SYS_mq_open: ::c_long = 273; -pub const SYS_mq_unlink: ::c_long = 274; -pub const SYS_mq_timedsend: ::c_long = 275; -pub const SYS_mq_timedreceive: ::c_long = 276; -pub const SYS_mq_notify: ::c_long = 277; -pub const SYS_mq_getsetattr: ::c_long = 278; -pub const SYS_waitid: ::c_long = 279; -pub const SYS_tee: ::c_long = 280; -pub const SYS_add_key: ::c_long = 281; -pub const SYS_request_key: ::c_long = 282; -pub const SYS_keyctl: ::c_long = 283; -pub const SYS_openat: ::c_long = 284; -pub const SYS_mkdirat: ::c_long = 285; -pub const SYS_mknodat: ::c_long = 286; -pub const SYS_fchownat: ::c_long = 287; -pub const SYS_futimesat: ::c_long = 288; -pub const SYS_fstatat64: ::c_long = 289; -pub const SYS_unlinkat: ::c_long = 290; -pub const SYS_renameat: ::c_long = 291; -pub const SYS_linkat: ::c_long = 292; -pub const SYS_symlinkat: ::c_long = 293; -pub const SYS_readlinkat: ::c_long = 294; -pub const SYS_fchmodat: ::c_long = 295; -pub const SYS_faccessat: ::c_long = 296; -pub const SYS_pselect6: ::c_long = 297; -pub const SYS_ppoll: ::c_long = 298; -pub const SYS_unshare: ::c_long = 299; -pub const SYS_set_robust_list: ::c_long = 300; -pub const SYS_get_robust_list: ::c_long = 301; -pub const SYS_migrate_pages: ::c_long =302; -pub const SYS_mbind: ::c_long = 303; -pub const SYS_get_mempolicy: ::c_long = 304; -pub const SYS_set_mempolicy: ::c_long = 305; -pub const SYS_kexec_load: ::c_long = 306; -pub const SYS_move_pages: ::c_long = 307; -pub const SYS_getcpu: ::c_long = 308; -pub const SYS_epoll_pwait: ::c_long = 309; -pub const SYS_utimensat: ::c_long = 310; -pub const SYS_signalfd: ::c_long = 311; -pub const SYS_timerfd_create: ::c_long = 312; -pub const SYS_eventfd: ::c_long = 313; -pub const SYS_fallocate: ::c_long = 314; -pub const SYS_timerfd_settime: ::c_long = 315; -pub const SYS_timerfd_gettime: ::c_long = 316; -pub const SYS_signalfd4: ::c_long = 317; -pub const SYS_eventfd2: ::c_long = 318; -pub const SYS_epoll_create1: ::c_long = 319; -pub const SYS_dup3: ::c_long = 320; -pub const SYS_pipe2: ::c_long = 321; -pub const SYS_inotify_init1: ::c_long = 322; -pub const SYS_accept4: ::c_long = 323; -pub const SYS_preadv: ::c_long = 324; -pub const SYS_pwritev: ::c_long = 325; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 326; -pub const SYS_perf_event_open: ::c_long = 327; -pub const SYS_recvmmsg: ::c_long = 328; -pub const SYS_fanotify_init: ::c_long = 329; -pub const SYS_fanotify_mark: ::c_long = 330; -pub const SYS_prlimit64: ::c_long = 331; -pub const SYS_name_to_handle_at: ::c_long = 332; -pub const SYS_open_by_handle_at: ::c_long = 333; -pub const SYS_clock_adjtime: ::c_long = 334; -pub const SYS_syncfs: ::c_long = 335; -pub const SYS_sendmmsg: ::c_long = 336; -pub const SYS_setns: ::c_long = 337; -pub const SYS_process_vm_readv: ::c_long = 338; -pub const SYS_process_vm_writev: ::c_long = 339; -pub const SYS_kern_features: ::c_long = 340; -pub const SYS_kcmp: ::c_long = 341; -pub const SYS_finit_module: ::c_long = 342; -pub const SYS_sched_setattr: ::c_long = 343; -pub const SYS_sched_getattr: ::c_long = 344; -pub const SYS_renameat2: ::c_long = 345; -pub const SYS_seccomp: ::c_long = 346; -pub const SYS_getrandom: ::c_long = 347; -pub const SYS_memfd_create: ::c_long = 348; -pub const SYS_bpf: ::c_long = 349; -pub const SYS_execveat: ::c_long = 350; -pub const SYS_membarrier: ::c_long = 351; -pub const SYS_userfaultfd: ::c_long = 352; -pub const SYS_bind: ::c_long = 353; -pub const SYS_listen: ::c_long = 354; -pub const SYS_setsockopt: ::c_long = 355; -pub const SYS_mlock2: ::c_long = 356; -pub const SYS_copy_file_range: ::c_long = 357; -pub const SYS_preadv2: ::c_long = 358; -pub const SYS_pwritev2: ::c_long = 359; - -#[link(name = "util")] -extern { - pub fn sysctl(name: *mut ::c_int, - namelen: ::c_int, - oldp: *mut ::c_void, - oldlenp: *mut ::size_t, - newp: *mut ::c_void, - newlen: ::size_t) - -> ::c_int; -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b64/x32.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b64/x32.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b64/x32.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b64/x32.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,374 +0,0 @@ -use pthread_mutex_t; - -pub type c_long = i32; -pub type c_ulong = u32; - -s! { - pub struct statvfs { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_favail: ::fsfilcnt_t, - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } -} - -pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 32; -pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 44; - -align_const! { - pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 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, - ], - }; - pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }; - pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }; -} - -// Syscall table - -pub const __X32_SYSCALL_BIT: ::c_long = 0x40000000; - -pub const SYS_read: ::c_long = __X32_SYSCALL_BIT + 0; -pub const SYS_write: ::c_long = __X32_SYSCALL_BIT + 1; -pub const SYS_open: ::c_long = __X32_SYSCALL_BIT + 2; -pub const SYS_close: ::c_long = __X32_SYSCALL_BIT + 3; -pub const SYS_stat: ::c_long = __X32_SYSCALL_BIT + 4; -pub const SYS_fstat: ::c_long = __X32_SYSCALL_BIT + 5; -pub const SYS_lstat: ::c_long = __X32_SYSCALL_BIT + 6; -pub const SYS_poll: ::c_long = __X32_SYSCALL_BIT + 7; -pub const SYS_lseek: ::c_long = __X32_SYSCALL_BIT + 8; -pub const SYS_mmap: ::c_long = __X32_SYSCALL_BIT + 9; -pub const SYS_mprotect: ::c_long = __X32_SYSCALL_BIT + 10; -pub const SYS_munmap: ::c_long = __X32_SYSCALL_BIT + 11; -pub const SYS_brk: ::c_long = __X32_SYSCALL_BIT + 12; -pub const SYS_rt_sigprocmask: ::c_long = __X32_SYSCALL_BIT + 14; -pub const SYS_pread64: ::c_long = __X32_SYSCALL_BIT + 17; -pub const SYS_pwrite64: ::c_long = __X32_SYSCALL_BIT + 18; -pub const SYS_access: ::c_long = __X32_SYSCALL_BIT + 21; -pub const SYS_pipe: ::c_long = __X32_SYSCALL_BIT + 22; -pub const SYS_select: ::c_long = __X32_SYSCALL_BIT + 23; -pub const SYS_sched_yield: ::c_long = __X32_SYSCALL_BIT + 24; -pub const SYS_mremap: ::c_long = __X32_SYSCALL_BIT + 25; -pub const SYS_msync: ::c_long = __X32_SYSCALL_BIT + 26; -pub const SYS_mincore: ::c_long = __X32_SYSCALL_BIT + 27; -pub const SYS_madvise: ::c_long = __X32_SYSCALL_BIT + 28; -pub const SYS_shmget: ::c_long = __X32_SYSCALL_BIT + 29; -pub const SYS_shmat: ::c_long = __X32_SYSCALL_BIT + 30; -pub const SYS_shmctl: ::c_long = __X32_SYSCALL_BIT + 31; -pub const SYS_dup: ::c_long = __X32_SYSCALL_BIT + 32; -pub const SYS_dup2: ::c_long = __X32_SYSCALL_BIT + 33; -pub const SYS_pause: ::c_long = __X32_SYSCALL_BIT + 34; -pub const SYS_nanosleep: ::c_long = __X32_SYSCALL_BIT + 35; -pub const SYS_getitimer: ::c_long = __X32_SYSCALL_BIT + 36; -pub const SYS_alarm: ::c_long = __X32_SYSCALL_BIT + 37; -pub const SYS_setitimer: ::c_long = __X32_SYSCALL_BIT + 38; -pub const SYS_getpid: ::c_long = __X32_SYSCALL_BIT + 39; -pub const SYS_sendfile: ::c_long = __X32_SYSCALL_BIT + 40; -pub const SYS_socket: ::c_long = __X32_SYSCALL_BIT + 41; -pub const SYS_connect: ::c_long = __X32_SYSCALL_BIT + 42; -pub const SYS_accept: ::c_long = __X32_SYSCALL_BIT + 43; -pub const SYS_sendto: ::c_long = __X32_SYSCALL_BIT + 44; -pub const SYS_shutdown: ::c_long = __X32_SYSCALL_BIT + 48; -pub const SYS_bind: ::c_long = __X32_SYSCALL_BIT + 49; -pub const SYS_listen: ::c_long = __X32_SYSCALL_BIT + 50; -pub const SYS_getsockname: ::c_long = __X32_SYSCALL_BIT + 51; -pub const SYS_getpeername: ::c_long = __X32_SYSCALL_BIT + 52; -pub const SYS_socketpair: ::c_long = __X32_SYSCALL_BIT + 53; -pub const SYS_clone: ::c_long = __X32_SYSCALL_BIT + 56; -pub const SYS_fork: ::c_long = __X32_SYSCALL_BIT + 57; -pub const SYS_vfork: ::c_long = __X32_SYSCALL_BIT + 58; -pub const SYS_exit: ::c_long = __X32_SYSCALL_BIT + 60; -pub const SYS_wait4: ::c_long = __X32_SYSCALL_BIT + 61; -pub const SYS_kill: ::c_long = __X32_SYSCALL_BIT + 62; -pub const SYS_uname: ::c_long = __X32_SYSCALL_BIT + 63; -pub const SYS_semget: ::c_long = __X32_SYSCALL_BIT + 64; -pub const SYS_semop: ::c_long = __X32_SYSCALL_BIT + 65; -pub const SYS_semctl: ::c_long = __X32_SYSCALL_BIT + 66; -pub const SYS_shmdt: ::c_long = __X32_SYSCALL_BIT + 67; -pub const SYS_msgget: ::c_long = __X32_SYSCALL_BIT + 68; -pub const SYS_msgsnd: ::c_long = __X32_SYSCALL_BIT + 69; -pub const SYS_msgrcv: ::c_long = __X32_SYSCALL_BIT + 70; -pub const SYS_msgctl: ::c_long = __X32_SYSCALL_BIT + 71; -pub const SYS_fcntl: ::c_long = __X32_SYSCALL_BIT + 72; -pub const SYS_flock: ::c_long = __X32_SYSCALL_BIT + 73; -pub const SYS_fsync: ::c_long = __X32_SYSCALL_BIT + 74; -pub const SYS_fdatasync: ::c_long = __X32_SYSCALL_BIT + 75; -pub const SYS_truncate: ::c_long = __X32_SYSCALL_BIT + 76; -pub const SYS_ftruncate: ::c_long = __X32_SYSCALL_BIT + 77; -pub const SYS_getdents: ::c_long = __X32_SYSCALL_BIT + 78; -pub const SYS_getcwd: ::c_long = __X32_SYSCALL_BIT + 79; -pub const SYS_chdir: ::c_long = __X32_SYSCALL_BIT + 80; -pub const SYS_fchdir: ::c_long = __X32_SYSCALL_BIT + 81; -pub const SYS_rename: ::c_long = __X32_SYSCALL_BIT + 82; -pub const SYS_mkdir: ::c_long = __X32_SYSCALL_BIT + 83; -pub const SYS_rmdir: ::c_long = __X32_SYSCALL_BIT + 84; -pub const SYS_creat: ::c_long = __X32_SYSCALL_BIT + 85; -pub const SYS_link: ::c_long = __X32_SYSCALL_BIT + 86; -pub const SYS_unlink: ::c_long = __X32_SYSCALL_BIT + 87; -pub const SYS_symlink: ::c_long = __X32_SYSCALL_BIT + 88; -pub const SYS_readlink: ::c_long = __X32_SYSCALL_BIT + 89; -pub const SYS_chmod: ::c_long = __X32_SYSCALL_BIT + 90; -pub const SYS_fchmod: ::c_long = __X32_SYSCALL_BIT + 91; -pub const SYS_chown: ::c_long = __X32_SYSCALL_BIT + 92; -pub const SYS_fchown: ::c_long = __X32_SYSCALL_BIT + 93; -pub const SYS_lchown: ::c_long = __X32_SYSCALL_BIT + 94; -pub const SYS_umask: ::c_long = __X32_SYSCALL_BIT + 95; -pub const SYS_gettimeofday: ::c_long = __X32_SYSCALL_BIT + 96; -pub const SYS_getrlimit: ::c_long = __X32_SYSCALL_BIT + 97; -pub const SYS_getrusage: ::c_long = __X32_SYSCALL_BIT + 98; -pub const SYS_sysinfo: ::c_long = __X32_SYSCALL_BIT + 99; -pub const SYS_times: ::c_long = __X32_SYSCALL_BIT + 100; -pub const SYS_getuid: ::c_long = __X32_SYSCALL_BIT + 102; -pub const SYS_syslog: ::c_long = __X32_SYSCALL_BIT + 103; -pub const SYS_getgid: ::c_long = __X32_SYSCALL_BIT + 104; -pub const SYS_setuid: ::c_long = __X32_SYSCALL_BIT + 105; -pub const SYS_setgid: ::c_long = __X32_SYSCALL_BIT + 106; -pub const SYS_geteuid: ::c_long = __X32_SYSCALL_BIT + 107; -pub const SYS_getegid: ::c_long = __X32_SYSCALL_BIT + 108; -pub const SYS_setpgid: ::c_long = __X32_SYSCALL_BIT + 109; -pub const SYS_getppid: ::c_long = __X32_SYSCALL_BIT + 110; -pub const SYS_getpgrp: ::c_long = __X32_SYSCALL_BIT + 111; -pub const SYS_setsid: ::c_long = __X32_SYSCALL_BIT + 112; -pub const SYS_setreuid: ::c_long = __X32_SYSCALL_BIT + 113; -pub const SYS_setregid: ::c_long = __X32_SYSCALL_BIT + 114; -pub const SYS_getgroups: ::c_long = __X32_SYSCALL_BIT + 115; -pub const SYS_setgroups: ::c_long = __X32_SYSCALL_BIT + 116; -pub const SYS_setresuid: ::c_long = __X32_SYSCALL_BIT + 117; -pub const SYS_getresuid: ::c_long = __X32_SYSCALL_BIT + 118; -pub const SYS_setresgid: ::c_long = __X32_SYSCALL_BIT + 119; -pub const SYS_getresgid: ::c_long = __X32_SYSCALL_BIT + 120; -pub const SYS_getpgid: ::c_long = __X32_SYSCALL_BIT + 121; -pub const SYS_setfsuid: ::c_long = __X32_SYSCALL_BIT + 122; -pub const SYS_setfsgid: ::c_long = __X32_SYSCALL_BIT + 123; -pub const SYS_getsid: ::c_long = __X32_SYSCALL_BIT + 124; -pub const SYS_capget: ::c_long = __X32_SYSCALL_BIT + 125; -pub const SYS_capset: ::c_long = __X32_SYSCALL_BIT + 126; -pub const SYS_rt_sigsuspend: ::c_long = __X32_SYSCALL_BIT + 130; -pub const SYS_utime: ::c_long = __X32_SYSCALL_BIT + 132; -pub const SYS_mknod: ::c_long = __X32_SYSCALL_BIT + 133; -pub const SYS_personality: ::c_long = __X32_SYSCALL_BIT + 135; -pub const SYS_ustat: ::c_long = __X32_SYSCALL_BIT + 136; -pub const SYS_statfs: ::c_long = __X32_SYSCALL_BIT + 137; -pub const SYS_fstatfs: ::c_long = __X32_SYSCALL_BIT + 138; -pub const SYS_sysfs: ::c_long = __X32_SYSCALL_BIT + 139; -pub const SYS_getpriority: ::c_long = __X32_SYSCALL_BIT + 140; -pub const SYS_setpriority: ::c_long = __X32_SYSCALL_BIT + 141; -pub const SYS_sched_setparam: ::c_long = __X32_SYSCALL_BIT + 142; -pub const SYS_sched_getparam: ::c_long = __X32_SYSCALL_BIT + 143; -pub const SYS_sched_setscheduler: ::c_long = __X32_SYSCALL_BIT + 144; -pub const SYS_sched_getscheduler: ::c_long = __X32_SYSCALL_BIT + 145; -pub const SYS_sched_get_priority_max: ::c_long = __X32_SYSCALL_BIT + 146; -pub const SYS_sched_get_priority_min: ::c_long = __X32_SYSCALL_BIT + 147; -pub const SYS_sched_rr_get_interval: ::c_long = __X32_SYSCALL_BIT + 148; -pub const SYS_mlock: ::c_long = __X32_SYSCALL_BIT + 149; -pub const SYS_munlock: ::c_long = __X32_SYSCALL_BIT + 150; -pub const SYS_mlockall: ::c_long = __X32_SYSCALL_BIT + 151; -pub const SYS_munlockall: ::c_long = __X32_SYSCALL_BIT + 152; -pub const SYS_vhangup: ::c_long = __X32_SYSCALL_BIT + 153; -pub const SYS_modify_ldt: ::c_long = __X32_SYSCALL_BIT + 154; -pub const SYS_pivot_root: ::c_long = __X32_SYSCALL_BIT + 155; -pub const SYS_prctl: ::c_long = __X32_SYSCALL_BIT + 157; -pub const SYS_arch_prctl: ::c_long = __X32_SYSCALL_BIT + 158; -pub const SYS_adjtimex: ::c_long = __X32_SYSCALL_BIT + 159; -pub const SYS_setrlimit: ::c_long = __X32_SYSCALL_BIT + 160; -pub const SYS_chroot: ::c_long = __X32_SYSCALL_BIT + 161; -pub const SYS_sync: ::c_long = __X32_SYSCALL_BIT + 162; -pub const SYS_acct: ::c_long = __X32_SYSCALL_BIT + 163; -pub const SYS_settimeofday: ::c_long = __X32_SYSCALL_BIT + 164; -pub const SYS_mount: ::c_long = __X32_SYSCALL_BIT + 165; -pub const SYS_umount2: ::c_long = __X32_SYSCALL_BIT + 166; -pub const SYS_swapon: ::c_long = __X32_SYSCALL_BIT + 167; -pub const SYS_swapoff: ::c_long = __X32_SYSCALL_BIT + 168; -pub const SYS_reboot: ::c_long = __X32_SYSCALL_BIT + 169; -pub const SYS_sethostname: ::c_long = __X32_SYSCALL_BIT + 170; -pub const SYS_setdomainname: ::c_long = __X32_SYSCALL_BIT + 171; -pub const SYS_iopl: ::c_long = __X32_SYSCALL_BIT + 172; -pub const SYS_ioperm: ::c_long = __X32_SYSCALL_BIT + 173; -pub const SYS_init_module: ::c_long = __X32_SYSCALL_BIT + 175; -pub const SYS_delete_module: ::c_long = __X32_SYSCALL_BIT + 176; -pub const SYS_quotactl: ::c_long = __X32_SYSCALL_BIT + 179; -pub const SYS_getpmsg: ::c_long = __X32_SYSCALL_BIT + 181; -pub const SYS_putpmsg: ::c_long = __X32_SYSCALL_BIT + 182; -pub const SYS_afs_syscall: ::c_long = __X32_SYSCALL_BIT + 183; -pub const SYS_tuxcall: ::c_long = __X32_SYSCALL_BIT + 184; -pub const SYS_security: ::c_long = __X32_SYSCALL_BIT + 185; -pub const SYS_gettid: ::c_long = __X32_SYSCALL_BIT + 186; -pub const SYS_readahead: ::c_long = __X32_SYSCALL_BIT + 187; -pub const SYS_setxattr: ::c_long = __X32_SYSCALL_BIT + 188; -pub const SYS_lsetxattr: ::c_long = __X32_SYSCALL_BIT + 189; -pub const SYS_fsetxattr: ::c_long = __X32_SYSCALL_BIT + 190; -pub const SYS_getxattr: ::c_long = __X32_SYSCALL_BIT + 191; -pub const SYS_lgetxattr: ::c_long = __X32_SYSCALL_BIT + 192; -pub const SYS_fgetxattr: ::c_long = __X32_SYSCALL_BIT + 193; -pub const SYS_listxattr: ::c_long = __X32_SYSCALL_BIT + 194; -pub const SYS_llistxattr: ::c_long = __X32_SYSCALL_BIT + 195; -pub const SYS_flistxattr: ::c_long = __X32_SYSCALL_BIT + 196; -pub const SYS_removexattr: ::c_long = __X32_SYSCALL_BIT + 197; -pub const SYS_lremovexattr: ::c_long = __X32_SYSCALL_BIT + 198; -pub const SYS_fremovexattr: ::c_long = __X32_SYSCALL_BIT + 199; -pub const SYS_tkill: ::c_long = __X32_SYSCALL_BIT + 200; -pub const SYS_time: ::c_long = __X32_SYSCALL_BIT + 201; -pub const SYS_futex: ::c_long = __X32_SYSCALL_BIT + 202; -pub const SYS_sched_setaffinity: ::c_long = __X32_SYSCALL_BIT + 203; -pub const SYS_sched_getaffinity: ::c_long = __X32_SYSCALL_BIT + 204; -pub const SYS_io_destroy: ::c_long = __X32_SYSCALL_BIT + 207; -pub const SYS_io_getevents: ::c_long = __X32_SYSCALL_BIT + 208; -pub const SYS_io_cancel: ::c_long = __X32_SYSCALL_BIT + 210; -pub const SYS_lookup_dcookie: ::c_long = __X32_SYSCALL_BIT + 212; -pub const SYS_epoll_create: ::c_long = __X32_SYSCALL_BIT + 213; -pub const SYS_remap_file_pages: ::c_long = __X32_SYSCALL_BIT + 216; -pub const SYS_getdents64: ::c_long = __X32_SYSCALL_BIT + 217; -pub const SYS_set_tid_address: ::c_long = __X32_SYSCALL_BIT + 218; -pub const SYS_restart_syscall: ::c_long = __X32_SYSCALL_BIT + 219; -pub const SYS_semtimedop: ::c_long = __X32_SYSCALL_BIT + 220; -pub const SYS_fadvise64: ::c_long = __X32_SYSCALL_BIT + 221; -pub const SYS_timer_settime: ::c_long = __X32_SYSCALL_BIT + 223; -pub const SYS_timer_gettime: ::c_long = __X32_SYSCALL_BIT + 224; -pub const SYS_timer_getoverrun: ::c_long = __X32_SYSCALL_BIT + 225; -pub const SYS_timer_delete: ::c_long = __X32_SYSCALL_BIT + 226; -pub const SYS_clock_settime: ::c_long = __X32_SYSCALL_BIT + 227; -pub const SYS_clock_gettime: ::c_long = __X32_SYSCALL_BIT + 228; -pub const SYS_clock_getres: ::c_long = __X32_SYSCALL_BIT + 229; -pub const SYS_clock_nanosleep: ::c_long = __X32_SYSCALL_BIT + 230; -pub const SYS_exit_group: ::c_long = __X32_SYSCALL_BIT + 231; -pub const SYS_epoll_wait: ::c_long = __X32_SYSCALL_BIT + 232; -pub const SYS_epoll_ctl: ::c_long = __X32_SYSCALL_BIT + 233; -pub const SYS_tgkill: ::c_long = __X32_SYSCALL_BIT + 234; -pub const SYS_utimes: ::c_long = __X32_SYSCALL_BIT + 235; -pub const SYS_mbind: ::c_long = __X32_SYSCALL_BIT + 237; -pub const SYS_set_mempolicy: ::c_long = __X32_SYSCALL_BIT + 238; -pub const SYS_get_mempolicy: ::c_long = __X32_SYSCALL_BIT + 239; -pub const SYS_mq_open: ::c_long = __X32_SYSCALL_BIT + 240; -pub const SYS_mq_unlink: ::c_long = __X32_SYSCALL_BIT + 241; -pub const SYS_mq_timedsend: ::c_long = __X32_SYSCALL_BIT + 242; -pub const SYS_mq_timedreceive: ::c_long = __X32_SYSCALL_BIT + 243; -pub const SYS_mq_getsetattr: ::c_long = __X32_SYSCALL_BIT + 245; -pub const SYS_add_key: ::c_long = __X32_SYSCALL_BIT + 248; -pub const SYS_request_key: ::c_long = __X32_SYSCALL_BIT + 249; -pub const SYS_keyctl: ::c_long = __X32_SYSCALL_BIT + 250; -pub const SYS_ioprio_set: ::c_long = __X32_SYSCALL_BIT + 251; -pub const SYS_ioprio_get: ::c_long = __X32_SYSCALL_BIT + 252; -pub const SYS_inotify_init: ::c_long = __X32_SYSCALL_BIT + 253; -pub const SYS_inotify_add_watch: ::c_long = __X32_SYSCALL_BIT + 254; -pub const SYS_inotify_rm_watch: ::c_long = __X32_SYSCALL_BIT + 255; -pub const SYS_migrate_pages: ::c_long = __X32_SYSCALL_BIT + 256; -pub const SYS_openat: ::c_long = __X32_SYSCALL_BIT + 257; -pub const SYS_mkdirat: ::c_long = __X32_SYSCALL_BIT + 258; -pub const SYS_mknodat: ::c_long = __X32_SYSCALL_BIT + 259; -pub const SYS_fchownat: ::c_long = __X32_SYSCALL_BIT + 260; -pub const SYS_futimesat: ::c_long = __X32_SYSCALL_BIT + 261; -pub const SYS_newfstatat: ::c_long = __X32_SYSCALL_BIT + 262; -pub const SYS_unlinkat: ::c_long = __X32_SYSCALL_BIT + 263; -pub const SYS_renameat: ::c_long = __X32_SYSCALL_BIT + 264; -pub const SYS_linkat: ::c_long = __X32_SYSCALL_BIT + 265; -pub const SYS_symlinkat: ::c_long = __X32_SYSCALL_BIT + 266; -pub const SYS_readlinkat: ::c_long = __X32_SYSCALL_BIT + 267; -pub const SYS_fchmodat: ::c_long = __X32_SYSCALL_BIT + 268; -pub const SYS_faccessat: ::c_long = __X32_SYSCALL_BIT + 269; -pub const SYS_pselect6: ::c_long = __X32_SYSCALL_BIT + 270; -pub const SYS_ppoll: ::c_long = __X32_SYSCALL_BIT + 271; -pub const SYS_unshare: ::c_long = __X32_SYSCALL_BIT + 272; -pub const SYS_splice: ::c_long = __X32_SYSCALL_BIT + 275; -pub const SYS_tee: ::c_long = __X32_SYSCALL_BIT + 276; -pub const SYS_sync_file_range: ::c_long = __X32_SYSCALL_BIT + 277; -pub const SYS_utimensat: ::c_long = __X32_SYSCALL_BIT + 280; -pub const SYS_epoll_pwait: ::c_long = __X32_SYSCALL_BIT + 281; -pub const SYS_signalfd: ::c_long = __X32_SYSCALL_BIT + 282; -pub const SYS_timerfd_create: ::c_long = __X32_SYSCALL_BIT + 283; -pub const SYS_eventfd: ::c_long = __X32_SYSCALL_BIT + 284; -pub const SYS_fallocate: ::c_long = __X32_SYSCALL_BIT + 285; -pub const SYS_timerfd_settime: ::c_long = __X32_SYSCALL_BIT + 286; -pub const SYS_timerfd_gettime: ::c_long = __X32_SYSCALL_BIT + 287; -pub const SYS_accept4: ::c_long = __X32_SYSCALL_BIT + 288; -pub const SYS_signalfd4: ::c_long = __X32_SYSCALL_BIT + 289; -pub const SYS_eventfd2: ::c_long = __X32_SYSCALL_BIT + 290; -pub const SYS_epoll_create1: ::c_long = __X32_SYSCALL_BIT + 291; -pub const SYS_dup3: ::c_long = __X32_SYSCALL_BIT + 292; -pub const SYS_pipe2: ::c_long = __X32_SYSCALL_BIT + 293; -pub const SYS_inotify_init1: ::c_long = __X32_SYSCALL_BIT + 294; -pub const SYS_perf_event_open: ::c_long = __X32_SYSCALL_BIT + 298; -pub const SYS_fanotify_init: ::c_long = __X32_SYSCALL_BIT + 300; -pub const SYS_fanotify_mark: ::c_long = __X32_SYSCALL_BIT + 301; -pub const SYS_prlimit64: ::c_long = __X32_SYSCALL_BIT + 302; -pub const SYS_name_to_handle_at: ::c_long = __X32_SYSCALL_BIT + 303; -pub const SYS_open_by_handle_at: ::c_long = __X32_SYSCALL_BIT + 304; -pub const SYS_clock_adjtime: ::c_long = __X32_SYSCALL_BIT + 305; -pub const SYS_syncfs: ::c_long = __X32_SYSCALL_BIT + 306; -pub const SYS_setns: ::c_long = __X32_SYSCALL_BIT + 308; -pub const SYS_getcpu: ::c_long = __X32_SYSCALL_BIT + 309; -pub const SYS_kcmp: ::c_long = __X32_SYSCALL_BIT + 312; -pub const SYS_finit_module: ::c_long = __X32_SYSCALL_BIT + 313; -pub const SYS_sched_setattr: ::c_long = __X32_SYSCALL_BIT + 314; -pub const SYS_sched_getattr: ::c_long = __X32_SYSCALL_BIT + 315; -pub const SYS_renameat2: ::c_long = __X32_SYSCALL_BIT + 316; -pub const SYS_seccomp: ::c_long = __X32_SYSCALL_BIT + 317; -pub const SYS_getrandom: ::c_long = __X32_SYSCALL_BIT + 318; -pub const SYS_memfd_create: ::c_long = __X32_SYSCALL_BIT + 319; -pub const SYS_kexec_file_load: ::c_long = __X32_SYSCALL_BIT + 320; -pub const SYS_bpf: ::c_long = __X32_SYSCALL_BIT + 321; -pub const SYS_userfaultfd: ::c_long = __X32_SYSCALL_BIT + 323; -pub const SYS_membarrier: ::c_long = __X32_SYSCALL_BIT + 324; -pub const SYS_mlock2: ::c_long = __X32_SYSCALL_BIT + 325; -pub const SYS_copy_file_range: ::c_long = __X32_SYSCALL_BIT + 326; -pub const SYS_pkey_mprotect: ::c_long = __X32_SYSCALL_BIT + 329; -pub const SYS_pkey_alloc: ::c_long = __X32_SYSCALL_BIT + 330; -pub const SYS_pkey_free: ::c_long = __X32_SYSCALL_BIT + 331; -pub const SYS_rt_sigaction: ::c_long = __X32_SYSCALL_BIT + 512; -pub const SYS_rt_sigreturn: ::c_long = __X32_SYSCALL_BIT + 513; -pub const SYS_ioctl: ::c_long = __X32_SYSCALL_BIT + 514; -pub const SYS_readv: ::c_long = __X32_SYSCALL_BIT + 515; -pub const SYS_writev: ::c_long = __X32_SYSCALL_BIT + 516; -pub const SYS_recvfrom: ::c_long = __X32_SYSCALL_BIT + 517; -pub const SYS_sendmsg: ::c_long = __X32_SYSCALL_BIT + 518; -pub const SYS_recvmsg: ::c_long = __X32_SYSCALL_BIT + 519; -pub const SYS_execve: ::c_long = __X32_SYSCALL_BIT + 520; -pub const SYS_ptrace: ::c_long = __X32_SYSCALL_BIT + 521; -pub const SYS_rt_sigpending: ::c_long = __X32_SYSCALL_BIT + 522; -pub const SYS_rt_sigtimedwait: ::c_long = __X32_SYSCALL_BIT + 523; -pub const SYS_rt_sigqueueinfo: ::c_long = __X32_SYSCALL_BIT + 524; -pub const SYS_sigaltstack: ::c_long = __X32_SYSCALL_BIT + 525; -pub const SYS_timer_create: ::c_long = __X32_SYSCALL_BIT + 526; -pub const SYS_mq_notify: ::c_long = __X32_SYSCALL_BIT + 527; -pub const SYS_kexec_load: ::c_long = __X32_SYSCALL_BIT + 528; -pub const SYS_waitid: ::c_long = __X32_SYSCALL_BIT + 529; -pub const SYS_set_robust_list: ::c_long = __X32_SYSCALL_BIT + 530; -pub const SYS_get_robust_list: ::c_long = __X32_SYSCALL_BIT + 531; -pub const SYS_vmsplice: ::c_long = __X32_SYSCALL_BIT + 532; -pub const SYS_move_pages: ::c_long = __X32_SYSCALL_BIT + 533; -pub const SYS_preadv: ::c_long = __X32_SYSCALL_BIT + 534; -pub const SYS_pwritev: ::c_long = __X32_SYSCALL_BIT + 535; -pub const SYS_rt_tgsigqueueinfo: ::c_long = __X32_SYSCALL_BIT + 536; -pub const SYS_recvmmsg: ::c_long = __X32_SYSCALL_BIT + 537; -pub const SYS_sendmmsg: ::c_long = __X32_SYSCALL_BIT + 538; -pub const SYS_process_vm_readv: ::c_long = __X32_SYSCALL_BIT + 539; -pub const SYS_process_vm_writev: ::c_long = __X32_SYSCALL_BIT + 540; -pub const SYS_setsockopt: ::c_long = __X32_SYSCALL_BIT + 541; -pub const SYS_getsockopt: ::c_long = __X32_SYSCALL_BIT + 542; -pub const SYS_io_setup: ::c_long = __X32_SYSCALL_BIT + 543; -pub const SYS_io_submit: ::c_long = __X32_SYSCALL_BIT + 544; -pub const SYS_execveat: ::c_long = __X32_SYSCALL_BIT + 545; -pub const SYS_preadv2: ::c_long = __X32_SYSCALL_BIT + 546; -pub const SYS_pwritev2: ::c_long = __X32_SYSCALL_BIT + 547; diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b64/x86_64.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b64/x86_64.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/b64/x86_64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/b64/x86_64.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,780 +0,0 @@ -//! x86_64-specific definitions for 64-bit linux-like values - -pub type c_char = i8; -pub type wchar_t = i32; -pub type nlink_t = u64; -pub type blksize_t = i64; -pub type greg_t = i64; -pub type suseconds_t = i64; -pub type __u64 = ::c_ulonglong; - -s! { - pub struct stat { - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_nlink: ::nlink_t, - pub st_mode: ::mode_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - __pad0: ::c_int, - pub st_rdev: ::dev_t, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: i64, - pub st_mtime: ::time_t, - pub st_mtime_nsec: i64, - pub st_ctime: ::time_t, - pub st_ctime_nsec: i64, - __unused: [i64; 3], - } - - pub struct stat64 { - pub st_dev: ::dev_t, - pub st_ino: ::ino64_t, - pub st_nlink: ::nlink_t, - pub st_mode: ::mode_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - __pad0: ::c_int, - pub st_rdev: ::dev_t, - pub st_size: ::off_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt64_t, - pub st_atime: ::time_t, - pub st_atime_nsec: i64, - pub st_mtime: ::time_t, - pub st_mtime_nsec: i64, - pub st_ctime: ::time_t, - pub st_ctime_nsec: i64, - __reserved: [i64; 3], - } - - pub struct statfs64 { - pub f_type: ::__fsword_t, - pub f_bsize: ::__fsword_t, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_fsid: ::fsid_t, - pub f_namelen: ::__fsword_t, - pub f_frsize: ::__fsword_t, - pub f_flags: ::__fsword_t, - pub f_spare: [::__fsword_t; 4], - } - - pub struct statvfs64 { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_favail: u64, - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct pthread_attr_t { - #[cfg(target_pointer_width = "32")] - __size: [u32; 8], - #[cfg(target_pointer_width = "64")] - __size: [u64; 7] - } - - pub struct _libc_fpxreg { - pub significand: [u16; 4], - pub exponent: u16, - __private: [u16; 3], - } - - pub struct _libc_xmmreg { - pub element: [u32; 4], - } - - pub struct _libc_fpstate { - pub cwd: u16, - pub swd: u16, - pub ftw: u16, - pub fop: u16, - pub rip: u64, - pub rdp: u64, - pub mxcsr: u32, - pub mxcr_mask: u32, - pub _st: [_libc_fpxreg; 8], - pub _xmm: [_libc_xmmreg; 16], - __private: [u64; 12], - } - - pub struct user_regs_struct { - pub r15: ::c_ulonglong, - pub r14: ::c_ulonglong, - pub r13: ::c_ulonglong, - pub r12: ::c_ulonglong, - pub rbp: ::c_ulonglong, - pub rbx: ::c_ulonglong, - pub r11: ::c_ulonglong, - pub r10: ::c_ulonglong, - pub r9: ::c_ulonglong, - pub r8: ::c_ulonglong, - pub rax: ::c_ulonglong, - pub rcx: ::c_ulonglong, - pub rdx: ::c_ulonglong, - pub rsi: ::c_ulonglong, - pub rdi: ::c_ulonglong, - pub orig_rax: ::c_ulonglong, - pub rip: ::c_ulonglong, - pub cs: ::c_ulonglong, - pub eflags: ::c_ulonglong, - pub rsp: ::c_ulonglong, - pub ss: ::c_ulonglong, - pub fs_base: ::c_ulonglong, - pub gs_base: ::c_ulonglong, - pub ds: ::c_ulonglong, - pub es: ::c_ulonglong, - pub fs: ::c_ulonglong, - pub gs: ::c_ulonglong, - } - - pub struct user { - pub regs: user_regs_struct, - pub u_fpvalid: ::c_int, - pub i387: user_fpregs_struct, - pub u_tsize: ::c_ulonglong, - pub u_dsize: ::c_ulonglong, - pub u_ssize: ::c_ulonglong, - pub start_code: ::c_ulonglong, - pub start_stack: ::c_ulonglong, - pub signal: ::c_longlong, - __reserved: ::c_int, - #[cfg(target_pointer_width = "32")] - __pad1: u32, - pub u_ar0: *mut user_regs_struct, - #[cfg(target_pointer_width = "32")] - __pad2: u32, - pub u_fpstate: *mut user_fpregs_struct, - pub magic: ::c_ulonglong, - pub u_comm: [::c_char; 32], - pub u_debugreg: [::c_ulonglong; 8], - } - - pub struct mcontext_t { - pub gregs: [greg_t; 23], - pub fpregs: *mut _libc_fpstate, - __private: [u64; 8], - } - - pub struct ipc_perm { - pub __key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::c_ushort, - __pad1: ::c_ushort, - pub __seq: ::c_ushort, - __pad2: ::c_ushort, - __unused1: u64, - __unused2: u64 - } - - pub struct shmid_ds { - pub shm_perm: ::ipc_perm, - pub shm_segsz: ::size_t, - pub shm_atime: ::time_t, - pub shm_dtime: ::time_t, - pub shm_ctime: ::time_t, - pub shm_cpid: ::pid_t, - pub shm_lpid: ::pid_t, - pub shm_nattch: ::shmatt_t, - __unused4: u64, - __unused5: u64 - } - - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 19], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } -} - -s_no_extra_traits! { - pub struct user_fpregs_struct { - pub cwd: ::c_ushort, - pub swd: ::c_ushort, - pub ftw: ::c_ushort, - pub fop: ::c_ushort, - pub rip: ::c_ulonglong, - pub rdp: ::c_ulonglong, - pub mxcsr: ::c_uint, - pub mxcr_mask: ::c_uint, - pub st_space: [::c_uint; 32], - pub xmm_space: [::c_uint; 64], - padding: [::c_uint; 24], - } - - pub struct ucontext_t { - pub uc_flags: ::c_ulong, - pub uc_link: *mut ucontext_t, - pub uc_stack: ::stack_t, - pub uc_mcontext: mcontext_t, - pub uc_sigmask: ::sigset_t, - __private: [u8; 512], - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for user_fpregs_struct { - fn eq(&self, other: &user_fpregs_struct) -> bool { - self.cwd == other.cwd - && self.swd == other.swd - && self.ftw == other.ftw - && self.fop == other.fop - && self.rip == other.rip - && self.rdp == other.rdp - && self.mxcsr == other.mxcsr - && self.mxcr_mask == other.mxcr_mask - && self.st_space == other.st_space - && self - .xmm_space - .iter() - .zip(other.xmm_space.iter()) - .all(|(a,b)| a == b) - // Ignore padding field - } - } - - impl Eq for user_fpregs_struct {} - - impl ::fmt::Debug for user_fpregs_struct { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("user_fpregs_struct") - .field("cwd", &self.cwd) - .field("ftw", &self.ftw) - .field("fop", &self.fop) - .field("rip", &self.rip) - .field("rdp", &self.rdp) - .field("mxcsr", &self.mxcsr) - .field("mxcr_mask", &self.mxcr_mask) - .field("st_space", &self.st_space) - // FIXME: .field("xmm_space", &self.xmm_space) - // Ignore padding field - .finish() - } - } - - impl ::hash::Hash for user_fpregs_struct { - fn hash(&self, state: &mut H) { - self.cwd.hash(state); - self.ftw.hash(state); - self.fop.hash(state); - self.rip.hash(state); - self.rdp.hash(state); - self.mxcsr.hash(state); - self.mxcr_mask.hash(state); - self.st_space.hash(state); - self.xmm_space.hash(state); - // Ignore padding field - } - } - - impl PartialEq for ucontext_t { - fn eq(&self, other: &ucontext_t) -> bool { - self.uc_flags == other.uc_flags - && self.uc_link == other.uc_link - && self.uc_stack == other.uc_stack - && self.uc_mcontext == other.uc_mcontext - && self.uc_sigmask == other.uc_sigmask - // Ignore __private field - } - } - - impl Eq for ucontext_t {} - - impl ::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ucontext_t") - .field("uc_flags", &self.uc_flags) - .field("uc_link", &self.uc_link) - .field("uc_stack", &self.uc_stack) - .field("uc_mcontext", &self.uc_mcontext) - .field("uc_sigmask", &self.uc_sigmask) - // Ignore __private field - .finish() - } - } - - impl ::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { - self.uc_flags.hash(state); - self.uc_link.hash(state); - self.uc_stack.hash(state); - self.uc_mcontext.hash(state); - self.uc_sigmask.hash(state); - // Ignore __private field - } - } - } -} - -pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; -pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; - -pub const RLIMIT_NOFILE: ::c_int = 7; -pub const RLIMIT_NPROC: ::c_int = 6; - -pub const O_APPEND: ::c_int = 1024; -pub const O_CREAT: ::c_int = 64; -pub const O_EXCL: ::c_int = 128; -pub const O_NOCTTY: ::c_int = 256; -pub const O_NONBLOCK: ::c_int = 2048; -pub const O_SYNC: ::c_int = 1052672; -pub const O_RSYNC: ::c_int = 1052672; -pub const O_DSYNC: ::c_int = 4096; -pub const O_FSYNC: ::c_int = 0x101000; -pub const O_NOATIME: ::c_int = 0o1000000; -pub const O_PATH: ::c_int = 0o10000000; -pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; - -pub const MAP_GROWSDOWN: ::c_int = 0x0100; - -pub const EDEADLK: ::c_int = 35; -pub const ENAMETOOLONG: ::c_int = 36; -pub const ENOLCK: ::c_int = 37; -pub const ENOSYS: ::c_int = 38; -pub const ENOTEMPTY: ::c_int = 39; -pub const ELOOP: ::c_int = 40; -pub const ENOMSG: ::c_int = 42; -pub const EIDRM: ::c_int = 43; -pub const ECHRNG: ::c_int = 44; -pub const EL2NSYNC: ::c_int = 45; -pub const EL3HLT: ::c_int = 46; -pub const EL3RST: ::c_int = 47; -pub const ELNRNG: ::c_int = 48; -pub const EUNATCH: ::c_int = 49; -pub const ENOCSI: ::c_int = 50; -pub const EL2HLT: ::c_int = 51; -pub const EBADE: ::c_int = 52; -pub const EBADR: ::c_int = 53; -pub const EXFULL: ::c_int = 54; -pub const ENOANO: ::c_int = 55; -pub const EBADRQC: ::c_int = 56; -pub const EBADSLT: ::c_int = 57; -pub const EMULTIHOP: ::c_int = 72; -pub const EOVERFLOW: ::c_int = 75; -pub const ENOTUNIQ: ::c_int = 76; -pub const EBADFD: ::c_int = 77; -pub const EBADMSG: ::c_int = 74; -pub const EREMCHG: ::c_int = 78; -pub const ELIBACC: ::c_int = 79; -pub const ELIBBAD: ::c_int = 80; -pub const ELIBSCN: ::c_int = 81; -pub const ELIBMAX: ::c_int = 82; -pub const ELIBEXEC: ::c_int = 83; -pub const EILSEQ: ::c_int = 84; -pub const ERESTART: ::c_int = 85; -pub const ESTRPIPE: ::c_int = 86; -pub const EUSERS: ::c_int = 87; -pub const ENOTSOCK: ::c_int = 88; -pub const EDESTADDRREQ: ::c_int = 89; -pub const EMSGSIZE: ::c_int = 90; -pub const EPROTOTYPE: ::c_int = 91; -pub const ENOPROTOOPT: ::c_int = 92; -pub const EPROTONOSUPPORT: ::c_int = 93; -pub const ESOCKTNOSUPPORT: ::c_int = 94; -pub const EOPNOTSUPP: ::c_int = 95; -pub const EPFNOSUPPORT: ::c_int = 96; -pub const EAFNOSUPPORT: ::c_int = 97; -pub const EADDRINUSE: ::c_int = 98; -pub const EADDRNOTAVAIL: ::c_int = 99; -pub const ENETDOWN: ::c_int = 100; -pub const ENETUNREACH: ::c_int = 101; -pub const ENETRESET: ::c_int = 102; -pub const ECONNABORTED: ::c_int = 103; -pub const ECONNRESET: ::c_int = 104; -pub const ENOBUFS: ::c_int = 105; -pub const EISCONN: ::c_int = 106; -pub const ENOTCONN: ::c_int = 107; -pub const ESHUTDOWN: ::c_int = 108; -pub const ETOOMANYREFS: ::c_int = 109; -pub const ETIMEDOUT: ::c_int = 110; -pub const ECONNREFUSED: ::c_int = 111; -pub const EHOSTDOWN: ::c_int = 112; -pub const EHOSTUNREACH: ::c_int = 113; -pub const EALREADY: ::c_int = 114; -pub const EINPROGRESS: ::c_int = 115; -pub const ESTALE: ::c_int = 116; -pub const EDQUOT: ::c_int = 122; -pub const ENOMEDIUM: ::c_int = 123; -pub const EMEDIUMTYPE: ::c_int = 124; -pub const ECANCELED: ::c_int = 125; -pub const ENOKEY: ::c_int = 126; -pub const EKEYEXPIRED: ::c_int = 127; -pub const EKEYREVOKED: ::c_int = 128; -pub const EKEYREJECTED: ::c_int = 129; -pub const EOWNERDEAD: ::c_int = 130; -pub const ENOTRECOVERABLE: ::c_int = 131; -pub const EHWPOISON: ::c_int = 133; -pub const ERFKILL: ::c_int = 132; - -pub const SOL_SOCKET: ::c_int = 1; - -pub const SO_REUSEADDR: ::c_int = 2; -pub const SO_TYPE: ::c_int = 3; -pub const SO_ERROR: ::c_int = 4; -pub const SO_DONTROUTE: ::c_int = 5; -pub const SO_BROADCAST: ::c_int = 6; -pub const SO_SNDBUF: ::c_int = 7; -pub const SO_RCVBUF: ::c_int = 8; -pub const SO_SNDBUFFORCE: ::c_int = 32; -pub const SO_RCVBUFFORCE: ::c_int = 33; -pub const SO_KEEPALIVE: ::c_int = 9; -pub const SO_OOBINLINE: ::c_int = 10; -pub const SO_NO_CHECK: ::c_int = 11; -pub const SO_PRIORITY: ::c_int = 12; -pub const SO_LINGER: ::c_int = 13; -pub const SO_BSDCOMPAT: ::c_int = 14; -pub const SO_REUSEPORT: ::c_int = 15; -pub const SO_PASSCRED: ::c_int = 16; -pub const SO_PEERCRED: ::c_int = 17; -pub const SO_RCVLOWAT: ::c_int = 18; -pub const SO_SNDLOWAT: ::c_int = 19; -pub const SO_RCVTIMEO: ::c_int = 20; -pub const SO_SNDTIMEO: ::c_int = 21; -pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22; -pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23; -pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24; -pub const SO_BINDTODEVICE: ::c_int = 25; -pub const SO_ATTACH_FILTER: ::c_int = 26; -pub const SO_DETACH_FILTER: ::c_int = 27; -pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER; -pub const SO_PEERNAME: ::c_int = 28; -pub const SO_TIMESTAMP: ::c_int = 29; -pub const SO_ACCEPTCONN: ::c_int = 30; -pub const SO_PEERSEC: ::c_int = 31; -pub const SO_PASSSEC: ::c_int = 34; -pub const SO_TIMESTAMPNS: ::c_int = 35; -pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS; -pub const SO_MARK: ::c_int = 36; -pub const SO_PROTOCOL: ::c_int = 38; -pub const SO_DOMAIN: ::c_int = 39; -pub const SO_RXQ_OVFL: ::c_int = 40; -pub const SO_WIFI_STATUS: ::c_int = 41; -pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS; -pub const SO_PEEK_OFF: ::c_int = 42; -pub const SO_NOFCS: ::c_int = 43; -pub const SO_LOCK_FILTER: ::c_int = 44; -pub const SO_SELECT_ERR_QUEUE: ::c_int = 45; -pub const SO_BUSY_POLL: ::c_int = 46; -pub const SO_MAX_PACING_RATE: ::c_int = 47; -pub const SO_BPF_EXTENSIONS: ::c_int = 48; -pub const SO_INCOMING_CPU: ::c_int = 49; -pub const SO_ATTACH_BPF: ::c_int = 50; -pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER; - -pub const SA_ONSTACK: ::c_int = 0x08000000; -pub const SA_SIGINFO: ::c_int = 0x00000004; -pub const SA_NOCLDWAIT: ::c_int = 0x00000002; - -pub const SIGCHLD: ::c_int = 17; -pub const SIGBUS: ::c_int = 7; -pub const SIGUSR1: ::c_int = 10; -pub const SIGUSR2: ::c_int = 12; -pub const SIGCONT: ::c_int = 18; -pub const SIGSTOP: ::c_int = 19; -pub const SIGTSTP: ::c_int = 20; -pub const SIGURG: ::c_int = 23; -pub const SIGIO: ::c_int = 29; -pub const SIGSYS: ::c_int = 31; -pub const SIGSTKFLT: ::c_int = 16; -pub const SIGUNUSED: ::c_int = 31; -pub const SIGPOLL: ::c_int = 29; -pub const SIGPWR: ::c_int = 30; -pub const SIG_SETMASK: ::c_int = 2; -pub const SIG_BLOCK: ::c_int = 0x000000; -pub const SIG_UNBLOCK: ::c_int = 0x01; - -pub const POLLWRNORM: ::c_short = 0x100; -pub const POLLWRBAND: ::c_short = 0x200; - -pub const O_ASYNC: ::c_int = 0x2000; -pub const O_NDELAY: ::c_int = 0x800; - -pub const PTRACE_DETACH: ::c_uint = 17; - -pub const EFD_NONBLOCK: ::c_int = 0x800; - -pub const F_GETLK: ::c_int = 5; -pub const F_GETOWN: ::c_int = 9; -pub const F_SETOWN: ::c_int = 8; -pub const F_SETLK: ::c_int = 6; -pub const F_SETLKW: ::c_int = 7; - -pub const F_RDLCK: ::c_int = 0; -pub const F_WRLCK: ::c_int = 1; -pub const F_UNLCK: ::c_int = 2; - -pub const SFD_NONBLOCK: ::c_int = 0x0800; - -pub const TIOCEXCL: ::c_ulong = 0x540C; -pub const TIOCNXCL: ::c_ulong = 0x540D; -pub const TIOCSCTTY: ::c_ulong = 0x540E; -pub const TIOCSTI: ::c_ulong = 0x5412; -pub const TIOCMGET: ::c_ulong = 0x5415; -pub const TIOCMBIS: ::c_ulong = 0x5416; -pub const TIOCMBIC: ::c_ulong = 0x5417; -pub const TIOCMSET: ::c_ulong = 0x5418; -pub const TIOCCONS: ::c_ulong = 0x541D; - -pub const SFD_CLOEXEC: ::c_int = 0x080000; - -pub const NCCS: usize = 32; - -pub const O_TRUNC: ::c_int = 512; - -pub const O_CLOEXEC: ::c_int = 0x80000; - -pub const EBFONT: ::c_int = 59; -pub const ENOSTR: ::c_int = 60; -pub const ENODATA: ::c_int = 61; -pub const ETIME: ::c_int = 62; -pub const ENOSR: ::c_int = 63; -pub const ENONET: ::c_int = 64; -pub const ENOPKG: ::c_int = 65; -pub const EREMOTE: ::c_int = 66; -pub const ENOLINK: ::c_int = 67; -pub const EADV: ::c_int = 68; -pub const ESRMNT: ::c_int = 69; -pub const ECOMM: ::c_int = 70; -pub const EPROTO: ::c_int = 71; -pub const EDOTDOT: ::c_int = 73; - -pub const SA_NODEFER: ::c_int = 0x40000000; -pub const SA_RESETHAND: ::c_int = 0x80000000; -pub const SA_RESTART: ::c_int = 0x10000000; -pub const SA_NOCLDSTOP: ::c_int = 0x00000001; - -pub const EPOLL_CLOEXEC: ::c_int = 0x80000; - -pub const EFD_CLOEXEC: ::c_int = 0x80000; - -pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; -pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; - -pub const O_DIRECT: ::c_int = 0x4000; -pub const O_DIRECTORY: ::c_int = 0x10000; -pub const O_NOFOLLOW: ::c_int = 0x20000; - -pub const MAP_LOCKED: ::c_int = 0x02000; -pub const MAP_NORESERVE: ::c_int = 0x04000; -pub const MAP_32BIT: ::c_int = 0x0040; - -pub const EDEADLOCK: ::c_int = 35; - -pub const FIOCLEX: ::c_ulong = 0x5451; -pub const FIONBIO: ::c_ulong = 0x5421; - -pub const PTRACE_GETFPREGS: ::c_uint = 14; -pub const PTRACE_SETFPREGS: ::c_uint = 15; -pub const PTRACE_GETFPXREGS: ::c_uint = 18; -pub const PTRACE_SETFPXREGS: ::c_uint = 19; -pub const PTRACE_GETREGS: ::c_uint = 12; -pub const PTRACE_SETREGS: ::c_uint = 13; -pub const PTRACE_PEEKSIGINFO_SHARED: ::c_uint = 1; - -pub const MCL_CURRENT: ::c_int = 0x0001; -pub const MCL_FUTURE: ::c_int = 0x0002; - -pub const SIGSTKSZ: ::size_t = 8192; -pub const MINSIGSTKSZ: ::size_t = 2048; -pub const CBAUD: ::tcflag_t = 0o0010017; -pub const TAB1: ::c_int = 0x00000800; -pub const TAB2: ::c_int = 0x00001000; -pub const TAB3: ::c_int = 0x00001800; -pub const CR1: ::c_int = 0x00000200; -pub const CR2: ::c_int = 0x00000400; -pub const CR3: ::c_int = 0x00000600; -pub const FF1: ::c_int = 0x00008000; -pub const BS1: ::c_int = 0x00002000; -pub const VT1: ::c_int = 0x00004000; -pub const VWERASE: usize = 14; -pub const VREPRINT: usize = 12; -pub const VSUSP: usize = 10; -pub const VSTART: usize = 8; -pub const VSTOP: usize = 9; -pub const VDISCARD: usize = 13; -pub const VTIME: usize = 5; -pub const IXON: ::tcflag_t = 0x00000400; -pub const IXOFF: ::tcflag_t = 0x00001000; -pub const ONLCR: ::tcflag_t = 0x4; -pub const CSIZE: ::tcflag_t = 0x00000030; -pub const CS6: ::tcflag_t = 0x00000010; -pub const CS7: ::tcflag_t = 0x00000020; -pub const CS8: ::tcflag_t = 0x00000030; -pub const CSTOPB: ::tcflag_t = 0x00000040; -pub const CREAD: ::tcflag_t = 0x00000080; -pub const PARENB: ::tcflag_t = 0x00000100; -pub const PARODD: ::tcflag_t = 0x00000200; -pub const HUPCL: ::tcflag_t = 0x00000400; -pub const CLOCAL: ::tcflag_t = 0x00000800; -pub const ECHOKE: ::tcflag_t = 0x00000800; -pub const ECHOE: ::tcflag_t = 0x00000010; -pub const ECHOK: ::tcflag_t = 0x00000020; -pub const ECHONL: ::tcflag_t = 0x00000040; -pub const ECHOPRT: ::tcflag_t = 0x00000400; -pub const ECHOCTL: ::tcflag_t = 0x00000200; -pub const ISIG: ::tcflag_t = 0x00000001; -pub const ICANON: ::tcflag_t = 0x00000002; -pub const PENDIN: ::tcflag_t = 0x00004000; -pub const NOFLSH: ::tcflag_t = 0x00000080; -pub const CIBAUD: ::tcflag_t = 0o02003600000; -pub const CBAUDEX: ::tcflag_t = 0o010000; -pub const VSWTC: usize = 7; -pub const OLCUC: ::tcflag_t = 0o000002; -pub const NLDLY: ::tcflag_t = 0o000400; -pub const CRDLY: ::tcflag_t = 0o003000; -pub const TABDLY: ::tcflag_t = 0o014000; -pub const BSDLY: ::tcflag_t = 0o020000; -pub const FFDLY: ::tcflag_t = 0o100000; -pub const VTDLY: ::tcflag_t = 0o040000; -pub const XTABS: ::tcflag_t = 0o014000; - -pub const B0: ::speed_t = 0o000000; -pub const B50: ::speed_t = 0o000001; -pub const B75: ::speed_t = 0o000002; -pub const B110: ::speed_t = 0o000003; -pub const B134: ::speed_t = 0o000004; -pub const B150: ::speed_t = 0o000005; -pub const B200: ::speed_t = 0o000006; -pub const B300: ::speed_t = 0o000007; -pub const B600: ::speed_t = 0o000010; -pub const B1200: ::speed_t = 0o000011; -pub const B1800: ::speed_t = 0o000012; -pub const B2400: ::speed_t = 0o000013; -pub const B4800: ::speed_t = 0o000014; -pub const B9600: ::speed_t = 0o000015; -pub const B19200: ::speed_t = 0o000016; -pub const B38400: ::speed_t = 0o000017; -pub const EXTA: ::speed_t = B19200; -pub const EXTB: ::speed_t = B38400; -pub const BOTHER: ::speed_t = 0o010000; -pub const B57600: ::speed_t = 0o010001; -pub const B115200: ::speed_t = 0o010002; -pub const B230400: ::speed_t = 0o010003; -pub const B460800: ::speed_t = 0o010004; -pub const B500000: ::speed_t = 0o010005; -pub const B576000: ::speed_t = 0o010006; -pub const B921600: ::speed_t = 0o010007; -pub const B1000000: ::speed_t = 0o010010; -pub const B1152000: ::speed_t = 0o010011; -pub const B1500000: ::speed_t = 0o010012; -pub const B2000000: ::speed_t = 0o010013; -pub const B2500000: ::speed_t = 0o010014; -pub const B3000000: ::speed_t = 0o010015; -pub const B3500000: ::speed_t = 0o010016; -pub const B4000000: ::speed_t = 0o010017; - -pub const VEOL: usize = 11; -pub const VEOL2: usize = 16; -pub const VMIN: usize = 6; -pub const IEXTEN: ::tcflag_t = 0x00008000; -pub const TOSTOP: ::tcflag_t = 0x00000100; -pub const FLUSHO: ::tcflag_t = 0x00001000; -pub const EXTPROC: ::tcflag_t = 0x00010000; -pub const TCGETS: ::c_ulong = 0x5401; -pub const TCSETS: ::c_ulong = 0x5402; -pub const TCSETSW: ::c_ulong = 0x5403; -pub const TCSETSF: ::c_ulong = 0x5404; -pub const TCGETA: ::c_ulong = 0x5405; -pub const TCSETA: ::c_ulong = 0x5406; -pub const TCSETAW: ::c_ulong = 0x5407; -pub const TCSETAF: ::c_ulong = 0x5408; -pub const TCSBRK: ::c_ulong = 0x5409; -pub const TCXONC: ::c_ulong = 0x540A; -pub const TCFLSH: ::c_ulong = 0x540B; -pub const TIOCINQ: ::c_ulong = 0x541B; -pub const TIOCGPGRP: ::c_ulong = 0x540F; -pub const TIOCSPGRP: ::c_ulong = 0x5410; -pub const TIOCOUTQ: ::c_ulong = 0x5411; -pub const TIOCGWINSZ: ::c_ulong = 0x5413; -pub const TIOCSWINSZ: ::c_ulong = 0x5414; -pub const FIONREAD: ::c_ulong = 0x541B; - -// offsets in user_regs_structs, from sys/reg.h -pub const R15: ::c_int = 0; -pub const R14: ::c_int = 1; -pub const R13: ::c_int = 2; -pub const R12: ::c_int = 3; -pub const RBP: ::c_int = 4; -pub const RBX: ::c_int = 5; -pub const R11: ::c_int = 6; -pub const R10: ::c_int = 7; -pub const R9: ::c_int = 8; -pub const R8: ::c_int = 9; -pub const RAX: ::c_int = 10; -pub const RCX: ::c_int = 11; -pub const RDX: ::c_int = 12; -pub const RSI: ::c_int = 13; -pub const RDI: ::c_int = 14; -pub const ORIG_RAX: ::c_int = 15; -pub const RIP: ::c_int = 16; -pub const CS: ::c_int = 17; -pub const EFLAGS: ::c_int = 18; -pub const RSP: ::c_int = 19; -pub const SS: ::c_int = 20; -pub const FS_BASE: ::c_int = 21; -pub const GS_BASE: ::c_int = 22; -pub const DS: ::c_int = 23; -pub const ES: ::c_int = 24; -pub const FS: ::c_int = 25; -pub const GS: ::c_int = 26; - -// offsets in mcontext_t.gregs from sys/ucontext.h -pub const REG_R8: ::c_int = 0; -pub const REG_R9: ::c_int = 1; -pub const REG_R10: ::c_int = 2; -pub const REG_R11: ::c_int = 3; -pub const REG_R12: ::c_int = 4; -pub const REG_R13: ::c_int = 5; -pub const REG_R14: ::c_int = 6; -pub const REG_R15: ::c_int = 7; -pub const REG_RDI: ::c_int = 8; -pub const REG_RSI: ::c_int = 9; -pub const REG_RBP: ::c_int = 10; -pub const REG_RBX: ::c_int = 11; -pub const REG_RDX: ::c_int = 12; -pub const REG_RAX: ::c_int = 13; -pub const REG_RCX: ::c_int = 14; -pub const REG_RSP: ::c_int = 15; -pub const REG_RIP: ::c_int = 16; -pub const REG_EFL: ::c_int = 17; -pub const REG_CSGSFS: ::c_int = 18; -pub const REG_ERR: ::c_int = 19; -pub const REG_TRAPNO: ::c_int = 20; -pub const REG_OLDMASK: ::c_int = 21; -pub const REG_CR2: ::c_int = 22; - -extern { - pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int; - pub fn setcontext(ucp: *const ucontext_t) -> ::c_int; - pub fn makecontext(ucp: *mut ucontext_t, - func: extern fn (), - argc: ::c_int, ...); - pub fn swapcontext(uocp: *mut ucontext_t, - ucp: *const ucontext_t) -> ::c_int; - pub fn iopl(level: ::c_int) -> ::c_int; - pub fn ioperm(from: ::c_ulong, num: ::c_ulong, - turn_on: ::c_int) -> ::c_int; -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/mod.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,1016 +0,0 @@ -pub type __priority_which_t = ::c_uint; - -s! { - pub struct aiocb { - pub aio_fildes: ::c_int, - pub aio_lio_opcode: ::c_int, - pub aio_reqprio: ::c_int, - pub aio_buf: *mut ::c_void, - pub aio_nbytes: ::size_t, - pub aio_sigevent: ::sigevent, - __next_prio: *mut aiocb, - __abs_prio: ::c_int, - __policy: ::c_int, - __error_code: ::c_int, - __return_value: ::ssize_t, - pub aio_offset: off_t, - #[cfg(all(not(target_arch = "x86_64"), target_pointer_width = "32"))] - __unused1: [::c_char; 4], - __glibc_reserved: [::c_char; 32] - } - - pub struct __exit_status { - pub e_termination: ::c_short, - pub e_exit: ::c_short, - } - - pub struct __timeval { - pub tv_sec: ::int32_t, - pub tv_usec: ::int32_t, - } - - pub struct sigaction { - pub sa_sigaction: ::sighandler_t, - pub sa_mask: ::sigset_t, - #[cfg(target_arch = "sparc64")] - __reserved0: ::c_int, - pub sa_flags: ::c_int, - pub sa_restorer: ::Option, - } - - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_flags: ::c_int, - pub ss_size: ::size_t - } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_errno: ::c_int, - pub si_code: ::c_int, - #[deprecated( - since="0.2.54", - note="Please leave a comment on \ - https://github.com/rust-lang/libc/pull/1316 if you're using \ - this field" - )] - pub _pad: [::c_int; 29], - #[cfg(target_arch = "x86_64")] - _align: [u64; 0], - #[cfg(not(target_arch = "x86_64"))] - _align: [usize; 0], - } - - pub struct glob64_t { - pub gl_pathc: ::size_t, - pub gl_pathv: *mut *mut ::c_char, - pub gl_offs: ::size_t, - pub gl_flags: ::c_int, - - __unused1: *mut ::c_void, - __unused2: *mut ::c_void, - __unused3: *mut ::c_void, - __unused4: *mut ::c_void, - __unused5: *mut ::c_void, - } - - pub struct statfs { - pub f_type: __fsword_t, - pub f_bsize: __fsword_t, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - - pub f_namelen: __fsword_t, - pub f_frsize: __fsword_t, - f_spare: [__fsword_t; 5], - } - - pub struct msghdr { - pub msg_name: *mut ::c_void, - pub msg_namelen: ::socklen_t, - pub msg_iov: *mut ::iovec, - pub msg_iovlen: ::size_t, - pub msg_control: *mut ::c_void, - pub msg_controllen: ::size_t, - pub msg_flags: ::c_int, - } - - pub struct cmsghdr { - pub cmsg_len: ::size_t, - pub cmsg_level: ::c_int, - pub cmsg_type: ::c_int, - } - - pub struct termios { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; ::NCCS], - #[cfg(not(target_arch = "sparc64"))] - pub c_ispeed: ::speed_t, - #[cfg(not(target_arch = "sparc64"))] - pub c_ospeed: ::speed_t, - } - - pub struct flock { - pub l_type: ::c_short, - pub l_whence: ::c_short, - pub l_start: ::off_t, - pub l_len: ::off_t, - pub l_pid: ::pid_t, - } - - pub struct mallinfo { - pub arena: ::c_int, - pub ordblks: ::c_int, - pub smblks: ::c_int, - pub hblks: ::c_int, - pub hblkhd: ::c_int, - pub usmblks: ::c_int, - pub fsmblks: ::c_int, - pub uordblks: ::c_int, - pub fordblks: ::c_int, - pub keepcost: ::c_int, - } - - pub struct nlmsghdr { - pub nlmsg_len: u32, - pub nlmsg_type: u16, - pub nlmsg_flags: u16, - pub nlmsg_seq: u32, - pub nlmsg_pid: u32, - } - - pub struct nlmsgerr { - pub error: ::c_int, - pub msg: nlmsghdr, - } - - pub struct nl_pktinfo { - pub group: u32, - } - - pub struct nl_mmap_req { - pub nm_block_size: ::c_uint, - pub nm_block_nr: ::c_uint, - pub nm_frame_size: ::c_uint, - pub nm_frame_nr: ::c_uint, - } - - pub struct nl_mmap_hdr { - pub nm_status: ::c_uint, - pub nm_len: ::c_uint, - pub nm_group: u32, - pub nm_pid: u32, - pub nm_uid: u32, - pub nm_gid: u32, - } - - pub struct nlattr { - pub nla_len: u16, - pub nla_type: u16, - } - - pub struct rtentry { - pub rt_pad1: ::c_ulong, - pub rt_dst: ::sockaddr, - pub rt_gateway: ::sockaddr, - pub rt_genmask: ::sockaddr, - pub rt_flags: ::c_ushort, - pub rt_pad2: ::c_short, - pub rt_pad3: ::c_ulong, - pub rt_tos: ::c_uchar, - pub rt_class: ::c_uchar, - #[cfg(target_pointer_width = "64")] - pub rt_pad4: [::c_short; 3usize], - #[cfg(not(target_pointer_width = "64"))] - pub rt_pad4: ::c_short, - pub rt_metric: ::c_short, - pub rt_dev: *mut ::c_char, - pub rt_mtu: ::c_ulong, - pub rt_window: ::c_ulong, - pub rt_irtt: ::c_ushort, - } -} - -impl siginfo_t { - pub unsafe fn si_addr(&self) -> *mut ::c_void { - #[repr(C)] - struct siginfo_sigfault { - _si_signo: ::c_int, - _si_errno: ::c_int, - _si_code: ::c_int, - si_addr: *mut ::c_void - } - (*(self as *const siginfo_t as *const siginfo_sigfault)).si_addr - } -} - -s_no_extra_traits! { - pub struct utmpx { - pub ut_type: ::c_short, - pub ut_pid: ::pid_t, - pub ut_line: [::c_char; __UT_LINESIZE], - pub ut_id: [::c_char; 4], - - pub ut_user: [::c_char; __UT_NAMESIZE], - pub ut_host: [::c_char; __UT_HOSTSIZE], - pub ut_exit: __exit_status, - - #[cfg(any(target_arch = "aarch64", - target_arch = "sparc64", - all(target_pointer_width = "32", - not(target_arch = "x86_64"))))] - pub ut_session: ::c_long, - #[cfg(any(target_arch = "aarch64", - target_arch = "sparc64", - all(target_pointer_width = "32", - not(target_arch = "x86_64"))))] - pub ut_tv: ::timeval, - - #[cfg(not(any(target_arch = "aarch64", - target_arch = "sparc64", - all(target_pointer_width = "32", - not(target_arch = "x86_64")))))] - pub ut_session: ::int32_t, - #[cfg(not(any(target_arch = "aarch64", - target_arch = "sparc64", - all(target_pointer_width = "32", - not(target_arch = "x86_64")))))] - pub ut_tv: __timeval, - - pub ut_addr_v6: [::int32_t; 4], - __glibc_reserved: [::c_char; 20], - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for utmpx { - fn eq(&self, other: &utmpx) -> bool { - self.ut_type == other.ut_type - && self.ut_pid == other.ut_pid - && self.ut_line == other.ut_line - && self.ut_id == other.ut_id - && self.ut_user == other.ut_user - && self - .ut_host - .iter() - .zip(other.ut_host.iter()) - .all(|(a,b)| a == b) - && self.ut_exit == other.ut_exit - && self.ut_session == other.ut_session - && self.ut_tv == other.ut_tv - && self.ut_addr_v6 == other.ut_addr_v6 - && self.__glibc_reserved == other.__glibc_reserved - } - } - - impl Eq for utmpx {} - - impl ::fmt::Debug for utmpx { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utmpx") - .field("ut_type", &self.ut_type) - .field("ut_pid", &self.ut_pid) - .field("ut_line", &self.ut_line) - .field("ut_id", &self.ut_id) - .field("ut_user", &self.ut_user) - // FIXME: .field("ut_host", &self.ut_host) - .field("ut_exit", &self.ut_exit) - .field("ut_session", &self.ut_session) - .field("ut_tv", &self.ut_tv) - .field("ut_addr_v6", &self.ut_addr_v6) - .field("__glibc_reserved", &self.__glibc_reserved) - .finish() - } - } - - impl ::hash::Hash for utmpx { - fn hash(&self, state: &mut H) { - self.ut_type.hash(state); - self.ut_pid.hash(state); - self.ut_line.hash(state); - self.ut_id.hash(state); - self.ut_user.hash(state); - self.ut_host.hash(state); - self.ut_exit.hash(state); - self.ut_session.hash(state); - self.ut_tv.hash(state); - self.ut_addr_v6.hash(state); - self.__glibc_reserved.hash(state); - } - } - } -} - -pub const __UT_LINESIZE: usize = 32; -pub const __UT_NAMESIZE: usize = 32; -pub const __UT_HOSTSIZE: usize = 256; -pub const EMPTY: ::c_short = 0; -pub const RUN_LVL: ::c_short = 1; -pub const BOOT_TIME: ::c_short = 2; -pub const NEW_TIME: ::c_short = 3; -pub const OLD_TIME: ::c_short = 4; -pub const INIT_PROCESS: ::c_short = 5; -pub const LOGIN_PROCESS: ::c_short = 6; -pub const USER_PROCESS: ::c_short = 7; -pub const DEAD_PROCESS: ::c_short = 8; -pub const ACCOUNTING: ::c_short = 9; - -pub const RLIMIT_RSS: ::c_int = 5; -pub const RLIMIT_AS: ::c_int = 9; -pub const RLIMIT_MEMLOCK: ::c_int = 8; -pub const RLIM_INFINITY: ::rlim_t = !0; -pub const RLIMIT_RTTIME: ::c_int = 15; -pub const RLIMIT_NLIMITS: ::c_int = 16; - -pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK; - -pub const SOL_RXRPC: ::c_int = 272; -pub const SOL_PPPOL2TP: ::c_int = 273; -pub const SOL_PNPIPE: ::c_int = 275; -pub const SOL_RDS: ::c_int = 276; -pub const SOL_IUCV: ::c_int = 277; -pub const SOL_CAIF: ::c_int = 278; -pub const SOL_NFC: ::c_int = 280; -pub const SOL_XDP: ::c_int = 283; - -pub const MSG_TRYHARD: ::c_int = 4; - -pub const LC_PAPER: ::c_int = 7; -pub const LC_NAME: ::c_int = 8; -pub const LC_ADDRESS: ::c_int = 9; -pub const LC_TELEPHONE: ::c_int = 10; -pub const LC_MEASUREMENT: ::c_int = 11; -pub const LC_IDENTIFICATION: ::c_int = 12; -pub const LC_PAPER_MASK: ::c_int = (1 << LC_PAPER); -pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME); -pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS); -pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE); -pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT); -pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION); -pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK - | ::LC_NUMERIC_MASK - | ::LC_TIME_MASK - | ::LC_COLLATE_MASK - | ::LC_MONETARY_MASK - | ::LC_MESSAGES_MASK - | LC_PAPER_MASK - | LC_NAME_MASK - | LC_ADDRESS_MASK - | LC_TELEPHONE_MASK - | LC_MEASUREMENT_MASK - | LC_IDENTIFICATION_MASK; - -pub const MAP_ANON: ::c_int = 0x0020; -pub const MAP_ANONYMOUS: ::c_int = 0x0020; -pub const MAP_DENYWRITE: ::c_int = 0x0800; -pub const MAP_EXECUTABLE: ::c_int = 0x01000; -pub const MAP_POPULATE: ::c_int = 0x08000; -pub const MAP_NONBLOCK: ::c_int = 0x010000; -pub const MAP_STACK: ::c_int = 0x020000; - -pub const ENOTSUP: ::c_int = EOPNOTSUPP; -pub const EUCLEAN: ::c_int = 117; -pub const ENOTNAM: ::c_int = 118; -pub const ENAVAIL: ::c_int = 119; -pub const EISNAM: ::c_int = 120; -pub const EREMOTEIO: ::c_int = 121; - -pub const SOCK_STREAM: ::c_int = 1; -pub const SOCK_DGRAM: ::c_int = 2; -pub const SOCK_SEQPACKET: ::c_int = 5; -pub const SOCK_DCCP: ::c_int = 6; -pub const SOCK_PACKET: ::c_int = 10; - -pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15; -pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16; -pub const TCP_THIN_DUPACK: ::c_int = 17; -pub const TCP_USER_TIMEOUT: ::c_int = 18; -pub const TCP_REPAIR: ::c_int = 19; -pub const TCP_REPAIR_QUEUE: ::c_int = 20; -pub const TCP_QUEUE_SEQ: ::c_int = 21; -pub const TCP_REPAIR_OPTIONS: ::c_int = 22; -pub const TCP_FASTOPEN: ::c_int = 23; -pub const TCP_TIMESTAMP: ::c_int = 24; - -/* DCCP socket options */ -pub const DCCP_SOCKOPT_PACKET_SIZE: ::c_int = 1; -pub const DCCP_SOCKOPT_SERVICE: ::c_int = 2; -pub const DCCP_SOCKOPT_CHANGE_L: ::c_int = 3; -pub const DCCP_SOCKOPT_CHANGE_R: ::c_int = 4; -pub const DCCP_SOCKOPT_GET_CUR_MPS: ::c_int = 5; -pub const DCCP_SOCKOPT_SERVER_TIMEWAIT: ::c_int = 6; -pub const DCCP_SOCKOPT_SEND_CSCOV: ::c_int = 10; -pub const DCCP_SOCKOPT_RECV_CSCOV: ::c_int = 11; -pub const DCCP_SOCKOPT_AVAILABLE_CCIDS: ::c_int = 12; -pub const DCCP_SOCKOPT_CCID: ::c_int = 13; -pub const DCCP_SOCKOPT_TX_CCID: ::c_int = 14; -pub const DCCP_SOCKOPT_RX_CCID: ::c_int = 15; -pub const DCCP_SOCKOPT_QPOLICY_ID: ::c_int = 16; -pub const DCCP_SOCKOPT_QPOLICY_TXQLEN: ::c_int = 17; -pub const DCCP_SOCKOPT_CCID_RX_INFO: ::c_int = 128; -pub const DCCP_SOCKOPT_CCID_TX_INFO: ::c_int = 192; - -/// maximum number of services provided on the same listening port -pub const DCCP_SERVICE_LIST_MAX_LEN: ::c_int = 32; - -pub const SIGTTIN: ::c_int = 21; -pub const SIGTTOU: ::c_int = 22; -pub const SIGXCPU: ::c_int = 24; -pub const SIGXFSZ: ::c_int = 25; -pub const SIGVTALRM: ::c_int = 26; -pub const SIGPROF: ::c_int = 27; -pub const SIGWINCH: ::c_int = 28; - -pub const SIGEV_THREAD_ID: ::c_int = 4; - -pub const BUFSIZ: ::c_uint = 8192; -pub const TMP_MAX: ::c_uint = 238328; -pub const FOPEN_MAX: ::c_uint = 16; -pub const POSIX_FADV_DONTNEED: ::c_int = 4; -pub const POSIX_FADV_NOREUSE: ::c_int = 5; -pub const POSIX_MADV_DONTNEED: ::c_int = 4; -pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41; -pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45; -pub const _SC_PII: ::c_int = 53; -pub const _SC_PII_XTI: ::c_int = 54; -pub const _SC_PII_SOCKET: ::c_int = 55; -pub const _SC_PII_INTERNET: ::c_int = 56; -pub const _SC_PII_OSI: ::c_int = 57; -pub const _SC_POLL: ::c_int = 58; -pub const _SC_SELECT: ::c_int = 59; -pub const _SC_PII_INTERNET_STREAM: ::c_int = 61; -pub const _SC_PII_INTERNET_DGRAM: ::c_int = 62; -pub const _SC_PII_OSI_COTS: ::c_int = 63; -pub const _SC_PII_OSI_CLTS: ::c_int = 64; -pub const _SC_PII_OSI_M: ::c_int = 65; -pub const _SC_T_IOV_MAX: ::c_int = 66; -pub const _SC_2_C_VERSION: ::c_int = 96; -pub const _SC_CHAR_BIT: ::c_int = 101; -pub const _SC_CHAR_MAX: ::c_int = 102; -pub const _SC_CHAR_MIN: ::c_int = 103; -pub const _SC_INT_MAX: ::c_int = 104; -pub const _SC_INT_MIN: ::c_int = 105; -pub const _SC_LONG_BIT: ::c_int = 106; -pub const _SC_WORD_BIT: ::c_int = 107; -pub const _SC_MB_LEN_MAX: ::c_int = 108; -pub const _SC_SSIZE_MAX: ::c_int = 110; -pub const _SC_SCHAR_MAX: ::c_int = 111; -pub const _SC_SCHAR_MIN: ::c_int = 112; -pub const _SC_SHRT_MAX: ::c_int = 113; -pub const _SC_SHRT_MIN: ::c_int = 114; -pub const _SC_UCHAR_MAX: ::c_int = 115; -pub const _SC_UINT_MAX: ::c_int = 116; -pub const _SC_ULONG_MAX: ::c_int = 117; -pub const _SC_USHRT_MAX: ::c_int = 118; -pub const _SC_NL_ARGMAX: ::c_int = 119; -pub const _SC_NL_LANGMAX: ::c_int = 120; -pub const _SC_NL_MSGMAX: ::c_int = 121; -pub const _SC_NL_NMAX: ::c_int = 122; -pub const _SC_NL_SETMAX: ::c_int = 123; -pub const _SC_NL_TEXTMAX: ::c_int = 124; -pub const _SC_BASE: ::c_int = 134; -pub const _SC_C_LANG_SUPPORT: ::c_int = 135; -pub const _SC_C_LANG_SUPPORT_R: ::c_int = 136; -pub const _SC_DEVICE_IO: ::c_int = 140; -pub const _SC_DEVICE_SPECIFIC: ::c_int = 141; -pub const _SC_DEVICE_SPECIFIC_R: ::c_int = 142; -pub const _SC_FD_MGMT: ::c_int = 143; -pub const _SC_FIFO: ::c_int = 144; -pub const _SC_PIPE: ::c_int = 145; -pub const _SC_FILE_ATTRIBUTES: ::c_int = 146; -pub const _SC_FILE_LOCKING: ::c_int = 147; -pub const _SC_FILE_SYSTEM: ::c_int = 148; -pub const _SC_MULTI_PROCESS: ::c_int = 150; -pub const _SC_SINGLE_PROCESS: ::c_int = 151; -pub const _SC_NETWORKING: ::c_int = 152; -pub const _SC_REGEX_VERSION: ::c_int = 156; -pub const _SC_SIGNALS: ::c_int = 158; -pub const _SC_SYSTEM_DATABASE: ::c_int = 162; -pub const _SC_SYSTEM_DATABASE_R: ::c_int = 163; -pub const _SC_USER_GROUPS: ::c_int = 166; -pub const _SC_USER_GROUPS_R: ::c_int = 167; -pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 185; -pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 186; -pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 187; -pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 188; -pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 189; -pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 190; -pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 191; -pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 192; -pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 193; -pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 194; -pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 195; -pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 196; -pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 197; -pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 198; -pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 199; -pub const O_ACCMODE: ::c_int = 3; -pub const ST_RELATIME: ::c_ulong = 4096; -pub const NI_MAXHOST: ::socklen_t = 1025; - -pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5; -pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff; -pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245; -pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45; -pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53; -pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53; -pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53; -pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53; -pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849; -pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6; -pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660; -pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6; -pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f; -pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f; -pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468; -pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478; -pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44; -pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c; -pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969; -pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1; -pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0; -pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f; -pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973; -pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b; -pub const TMPFS_MAGIC: ::c_long = 0x01021994; -pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2; - -pub const VEOF: usize = 4; - -pub const CPU_SETSIZE: ::c_int = 0x400; - -pub const PTRACE_TRACEME: ::c_uint = 0; -pub const PTRACE_PEEKTEXT: ::c_uint = 1; -pub const PTRACE_PEEKDATA: ::c_uint = 2; -pub const PTRACE_PEEKUSER: ::c_uint = 3; -pub const PTRACE_POKETEXT: ::c_uint = 4; -pub const PTRACE_POKEDATA: ::c_uint = 5; -pub const PTRACE_POKEUSER: ::c_uint = 6; -pub const PTRACE_CONT: ::c_uint = 7; -pub const PTRACE_KILL: ::c_uint = 8; -pub const PTRACE_SINGLESTEP: ::c_uint = 9; -pub const PTRACE_ATTACH: ::c_uint = 16; -pub const PTRACE_SYSCALL: ::c_uint = 24; -pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200; -pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201; -pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202; -pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203; -pub const PTRACE_GETREGSET: ::c_uint = 0x4204; -pub const PTRACE_SETREGSET: ::c_uint = 0x4205; -pub const PTRACE_SEIZE: ::c_uint = 0x4206; -pub const PTRACE_INTERRUPT: ::c_uint = 0x4207; -pub const PTRACE_LISTEN: ::c_uint = 0x4208; -pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209; - -pub const EPOLLWAKEUP: ::c_int = 0x20000000; - -pub const MAP_HUGETLB: ::c_int = 0x040000; - -pub const SEEK_DATA: ::c_int = 3; -pub const SEEK_HOLE: ::c_int = 4; - -pub const TCSANOW: ::c_int = 0; -pub const TCSADRAIN: ::c_int = 1; -pub const TCSAFLUSH: ::c_int = 2; - -pub const TIOCLINUX: ::c_ulong = 0x541C; -pub const TIOCGSERIAL: ::c_ulong = 0x541E; - -pub const RTLD_DEEPBIND: ::c_int = 0x8; -pub const RTLD_GLOBAL: ::c_int = 0x100; -pub const RTLD_NOLOAD: ::c_int = 0x4; - -pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead; -pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793; -pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278; -pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448; -pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216; - -pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567; -pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123; -pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF; -pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000; -pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC; -pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4; -pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2; -pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543; - -pub const NETLINK_ROUTE: ::c_int = 0; -pub const NETLINK_UNUSED: ::c_int = 1; -pub const NETLINK_USERSOCK: ::c_int = 2; -pub const NETLINK_FIREWALL: ::c_int = 3; -pub const NETLINK_SOCK_DIAG: ::c_int = 4; -pub const NETLINK_NFLOG: ::c_int = 5; -pub const NETLINK_XFRM: ::c_int = 6; -pub const NETLINK_SELINUX: ::c_int = 7; -pub const NETLINK_ISCSI: ::c_int = 8; -pub const NETLINK_AUDIT: ::c_int = 9; -pub const NETLINK_FIB_LOOKUP: ::c_int = 10; -pub const NETLINK_CONNECTOR: ::c_int = 11; -pub const NETLINK_NETFILTER: ::c_int = 12; -pub const NETLINK_IP6_FW: ::c_int = 13; -pub const NETLINK_DNRTMSG: ::c_int = 14; -pub const NETLINK_KOBJECT_UEVENT: ::c_int = 15; -pub const NETLINK_GENERIC: ::c_int = 16; -pub const NETLINK_SCSITRANSPORT: ::c_int = 18; -pub const NETLINK_ECRYPTFS: ::c_int = 19; -pub const NETLINK_RDMA: ::c_int = 20; -pub const NETLINK_CRYPTO: ::c_int = 21; -pub const NETLINK_INET_DIAG: ::c_int = NETLINK_SOCK_DIAG; - -pub const MAX_LINKS: ::c_int = 32; - -pub const NLM_F_REQUEST: ::c_int = 1; -pub const NLM_F_MULTI: ::c_int = 2; -pub const NLM_F_ACK: ::c_int = 4; -pub const NLM_F_ECHO: ::c_int = 8; -pub const NLM_F_DUMP_INTR: ::c_int = 16; -pub const NLM_F_DUMP_FILTERED: ::c_int = 32; - -pub const NLM_F_ROOT: ::c_int = 0x100; -pub const NLM_F_MATCH: ::c_int = 0x200; -pub const NLM_F_ATOMIC: ::c_int = 0x400; -pub const NLM_F_DUMP: ::c_int = NLM_F_ROOT | NLM_F_MATCH; - -pub const NLM_F_REPLACE: ::c_int = 0x100; -pub const NLM_F_EXCL: ::c_int = 0x200; -pub const NLM_F_CREATE: ::c_int = 0x400; -pub const NLM_F_APPEND: ::c_int = 0x800; - -pub const NETLINK_ADD_MEMBERSHIP: ::c_int = 1; -pub const NETLINK_DROP_MEMBERSHIP: ::c_int = 2; -pub const NETLINK_PKTINFO: ::c_int = 3; -pub const NETLINK_BROADCAST_ERROR: ::c_int = 4; -pub const NETLINK_NO_ENOBUFS: ::c_int = 5; -pub const NETLINK_RX_RING: ::c_int = 6; -pub const NETLINK_TX_RING: ::c_int = 7; -pub const NETLINK_LISTEN_ALL_NSID: ::c_int = 8; -pub const NETLINK_LIST_MEMBERSHIPS: ::c_int = 9; -pub const NETLINK_CAP_ACK: ::c_int = 10; - -pub const NLA_F_NESTED: ::c_int = 1 << 15; -pub const NLA_F_NET_BYTEORDER: ::c_int = 1 << 14; -pub const NLA_TYPE_MASK: ::c_int = !(NLA_F_NESTED | NLA_F_NET_BYTEORDER); - -pub const NLA_ALIGNTO: ::c_int = 4; - -pub const GENL_UNS_ADMIN_PERM: ::c_int = 0x10; - -pub const GENL_ID_VFS_DQUOT: ::c_int = ::NLMSG_MIN_TYPE + 1; -pub const GENL_ID_PMCRAID: ::c_int = ::NLMSG_MIN_TYPE + 2; - -pub const TIOCM_LE: ::c_int = 0x001; -pub const TIOCM_DTR: ::c_int = 0x002; -pub const TIOCM_RTS: ::c_int = 0x004; -pub const TIOCM_ST: ::c_int = 0x008; -pub const TIOCM_SR: ::c_int = 0x010; -pub const TIOCM_CTS: ::c_int = 0x020; -pub const TIOCM_CAR: ::c_int = 0x040; -pub const TIOCM_RNG: ::c_int = 0x080; -pub const TIOCM_DSR: ::c_int = 0x100; -pub const TIOCM_CD: ::c_int = TIOCM_CAR; -pub const TIOCM_RI: ::c_int = TIOCM_RNG; - -pub const NF_NETDEV_INGRESS: ::c_int = 0; -pub const NF_NETDEV_NUMHOOKS: ::c_int = 1; - -pub const NFPROTO_INET: ::c_int = 1; -pub const NFPROTO_NETDEV: ::c_int = 5; - -// linux/netfilter/nf_tables.h -cfg_if!{ - if #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] { - pub const NFT_TABLE_MAXNAMELEN: ::c_int = 32; - pub const NFT_CHAIN_MAXNAMELEN: ::c_int = 32; - pub const NFT_SET_MAXNAMELEN: ::c_int = 32; - pub const NFT_OBJ_MAXNAMELEN: ::c_int = 32; - } else if #[cfg(target_arch = "sparc64")] { - pub const NFT_TABLE_MAXNAMELEN: ::c_int = 32; - pub const NFT_CHAIN_MAXNAMELEN: ::c_int = 32; - pub const NFT_SET_MAXNAMELEN: ::c_int = 32; - } else { - pub const NFT_TABLE_MAXNAMELEN: ::c_int = 256; - pub const NFT_CHAIN_MAXNAMELEN: ::c_int = 256; - pub const NFT_SET_MAXNAMELEN: ::c_int = 256; - pub const NFT_OBJ_MAXNAMELEN: ::c_int = 256; - } -} -pub const NFT_USERDATA_MAXLEN: ::c_int = 256; - -pub const NFT_REG_VERDICT: ::c_int = 0; -pub const NFT_REG_1: ::c_int = 1; -pub const NFT_REG_2: ::c_int = 2; -pub const NFT_REG_3: ::c_int = 3; -pub const NFT_REG_4: ::c_int = 4; -pub const __NFT_REG_MAX: ::c_int = 5; -pub const NFT_REG32_00: ::c_int = 8; -pub const NFT_REG32_01: ::c_int = 9; -pub const NFT_REG32_02: ::c_int = 10; -pub const NFT_REG32_03: ::c_int = 11; -pub const NFT_REG32_04: ::c_int = 12; -pub const NFT_REG32_05: ::c_int = 13; -pub const NFT_REG32_06: ::c_int = 14; -pub const NFT_REG32_07: ::c_int = 15; -pub const NFT_REG32_08: ::c_int = 16; -pub const NFT_REG32_09: ::c_int = 17; -pub const NFT_REG32_10: ::c_int = 18; -pub const NFT_REG32_11: ::c_int = 19; -pub const NFT_REG32_12: ::c_int = 20; -pub const NFT_REG32_13: ::c_int = 21; -pub const NFT_REG32_14: ::c_int = 22; -pub const NFT_REG32_15: ::c_int = 23; - -pub const NFT_REG_SIZE: ::c_int = 16; -pub const NFT_REG32_SIZE: ::c_int = 4; - -pub const NFT_CONTINUE: ::c_int = -1; -pub const NFT_BREAK: ::c_int = -2; -pub const NFT_JUMP: ::c_int = -3; -pub const NFT_GOTO: ::c_int = -4; -pub const NFT_RETURN: ::c_int = -5; - -pub const NFT_MSG_NEWTABLE: ::c_int = 0; -pub const NFT_MSG_GETTABLE: ::c_int = 1; -pub const NFT_MSG_DELTABLE: ::c_int = 2; -pub const NFT_MSG_NEWCHAIN: ::c_int = 3; -pub const NFT_MSG_GETCHAIN: ::c_int = 4; -pub const NFT_MSG_DELCHAIN: ::c_int = 5; -pub const NFT_MSG_NEWRULE: ::c_int = 6; -pub const NFT_MSG_GETRULE: ::c_int = 7; -pub const NFT_MSG_DELRULE: ::c_int = 8; -pub const NFT_MSG_NEWSET: ::c_int = 9; -pub const NFT_MSG_GETSET: ::c_int = 10; -pub const NFT_MSG_DELSET: ::c_int = 11; -pub const NFT_MSG_NEWSETELEM: ::c_int = 12; -pub const NFT_MSG_GETSETELEM: ::c_int = 13; -pub const NFT_MSG_DELSETELEM: ::c_int = 14; -pub const NFT_MSG_NEWGEN: ::c_int = 15; -pub const NFT_MSG_GETGEN: ::c_int = 16; -pub const NFT_MSG_TRACE: ::c_int = 17; -cfg_if! { - if #[cfg(not(target_arch = "sparc64"))] { - pub const NFT_MSG_NEWOBJ: ::c_int = 18; - pub const NFT_MSG_GETOBJ: ::c_int = 19; - pub const NFT_MSG_DELOBJ: ::c_int = 20; - pub const NFT_MSG_GETOBJ_RESET: ::c_int = 21; - pub const NFT_MSG_MAX: ::c_int = 22; - } else { - pub const NFT_MSG_MAX: ::c_int = 18; - } -} - -pub const NFT_SET_ANONYMOUS: ::c_int = 0x1; -pub const NFT_SET_CONSTANT: ::c_int = 0x2; -pub const NFT_SET_INTERVAL: ::c_int = 0x4; -pub const NFT_SET_MAP: ::c_int = 0x8; -pub const NFT_SET_TIMEOUT: ::c_int = 0x10; -pub const NFT_SET_EVAL: ::c_int = 0x20; - -pub const NFT_SET_POL_PERFORMANCE: ::c_int = 0; -pub const NFT_SET_POL_MEMORY: ::c_int = 1; - -pub const NFT_SET_ELEM_INTERVAL_END: ::c_int = 0x1; - -pub const NFT_DATA_VALUE: ::c_uint = 0; -pub const NFT_DATA_VERDICT: ::c_uint = 0xffffff00; - -pub const NFT_DATA_RESERVED_MASK: ::c_uint = 0xffffff00; - -pub const NFT_DATA_VALUE_MAXLEN: ::c_int = 64; - -pub const NFT_BYTEORDER_NTOH: ::c_int = 0; -pub const NFT_BYTEORDER_HTON: ::c_int = 1; - -pub const NFT_CMP_EQ: ::c_int = 0; -pub const NFT_CMP_NEQ: ::c_int = 1; -pub const NFT_CMP_LT: ::c_int = 2; -pub const NFT_CMP_LTE: ::c_int = 3; -pub const NFT_CMP_GT: ::c_int = 4; -pub const NFT_CMP_GTE: ::c_int = 5; - -pub const NFT_RANGE_EQ: ::c_int = 0; -pub const NFT_RANGE_NEQ: ::c_int = 1; - -pub const NFT_LOOKUP_F_INV: ::c_int = (1 << 0); - -pub const NFT_DYNSET_OP_ADD: ::c_int = 0; -pub const NFT_DYNSET_OP_UPDATE: ::c_int = 1; - -pub const NFT_DYNSET_F_INV: ::c_int = (1 << 0); - -pub const NFT_PAYLOAD_LL_HEADER: ::c_int = 0; -pub const NFT_PAYLOAD_NETWORK_HEADER: ::c_int = 1; -pub const NFT_PAYLOAD_TRANSPORT_HEADER: ::c_int = 2; - -pub const NFT_PAYLOAD_CSUM_NONE: ::c_int = 0; -pub const NFT_PAYLOAD_CSUM_INET: ::c_int = 1; - -pub const NFT_META_LEN: ::c_int = 0; -pub const NFT_META_PROTOCOL: ::c_int = 1; -pub const NFT_META_PRIORITY: ::c_int = 2; -pub const NFT_META_MARK: ::c_int = 3; -pub const NFT_META_IIF: ::c_int = 4; -pub const NFT_META_OIF: ::c_int = 5; -pub const NFT_META_IIFNAME: ::c_int = 6; -pub const NFT_META_OIFNAME: ::c_int = 7; -pub const NFT_META_IIFTYPE: ::c_int = 8; -pub const NFT_META_OIFTYPE: ::c_int = 9; -pub const NFT_META_SKUID: ::c_int = 10; -pub const NFT_META_SKGID: ::c_int = 11; -pub const NFT_META_NFTRACE: ::c_int = 12; -pub const NFT_META_RTCLASSID: ::c_int = 13; -pub const NFT_META_SECMARK: ::c_int = 14; -pub const NFT_META_NFPROTO: ::c_int = 15; -pub const NFT_META_L4PROTO: ::c_int = 16; -pub const NFT_META_BRI_IIFNAME: ::c_int = 17; -pub const NFT_META_BRI_OIFNAME: ::c_int = 18; -pub const NFT_META_PKTTYPE: ::c_int = 19; -pub const NFT_META_CPU: ::c_int = 20; -pub const NFT_META_IIFGROUP: ::c_int = 21; -pub const NFT_META_OIFGROUP: ::c_int = 22; -pub const NFT_META_CGROUP: ::c_int = 23; -pub const NFT_META_PRANDOM: ::c_int = 24; - -pub const NFT_CT_STATE: ::c_int = 0; -pub const NFT_CT_DIRECTION: ::c_int = 1; -pub const NFT_CT_STATUS: ::c_int = 2; -pub const NFT_CT_MARK: ::c_int = 3; -pub const NFT_CT_SECMARK: ::c_int = 4; -pub const NFT_CT_EXPIRATION: ::c_int = 5; -pub const NFT_CT_HELPER: ::c_int = 6; -pub const NFT_CT_L3PROTOCOL: ::c_int = 7; -pub const NFT_CT_SRC: ::c_int = 8; -pub const NFT_CT_DST: ::c_int = 9; -pub const NFT_CT_PROTOCOL: ::c_int = 10; -pub const NFT_CT_PROTO_SRC: ::c_int = 11; -pub const NFT_CT_PROTO_DST: ::c_int = 12; -pub const NFT_CT_LABELS: ::c_int = 13; -pub const NFT_CT_PKTS: ::c_int = 14; -pub const NFT_CT_BYTES: ::c_int = 15; - -pub const NFT_LIMIT_PKTS: ::c_int = 0; -pub const NFT_LIMIT_PKT_BYTES: ::c_int = 1; - -pub const NFT_LIMIT_F_INV: ::c_int = (1 << 0); - -pub const NFT_QUEUE_FLAG_BYPASS: ::c_int = 0x01; -pub const NFT_QUEUE_FLAG_CPU_FANOUT: ::c_int = 0x02; -pub const NFT_QUEUE_FLAG_MASK: ::c_int = 0x03; - -pub const NFT_QUOTA_F_INV: ::c_int = (1 << 0); - -pub const NFT_REJECT_ICMP_UNREACH: ::c_int = 0; -pub const NFT_REJECT_TCP_RST: ::c_int = 1; -pub const NFT_REJECT_ICMPX_UNREACH: ::c_int = 2; - -pub const NFT_REJECT_ICMPX_NO_ROUTE: ::c_int = 0; -pub const NFT_REJECT_ICMPX_PORT_UNREACH: ::c_int = 1; -pub const NFT_REJECT_ICMPX_HOST_UNREACH: ::c_int = 2; -pub const NFT_REJECT_ICMPX_ADMIN_PROHIBITED: ::c_int = 3; - -pub const NFT_NAT_SNAT: ::c_int = 0; -pub const NFT_NAT_DNAT: ::c_int = 1; - -pub const NFT_TRACETYPE_UNSPEC: ::c_int = 0; -pub const NFT_TRACETYPE_POLICY: ::c_int = 1; -pub const NFT_TRACETYPE_RETURN: ::c_int = 2; -pub const NFT_TRACETYPE_RULE: ::c_int = 3; - -pub const NFT_NG_INCREMENTAL: ::c_int = 0; -pub const NFT_NG_RANDOM: ::c_int = 1; - -pub const M_MXFAST: ::c_int = 1; -pub const M_NLBLKS: ::c_int = 2; -pub const M_GRAIN: ::c_int = 3; -pub const M_KEEP: ::c_int = 4; -pub const M_TRIM_THRESHOLD: ::c_int = -1; -pub const M_TOP_PAD: ::c_int = -2; -pub const M_MMAP_THRESHOLD: ::c_int = -3; -pub const M_MMAP_MAX: ::c_int = -4; -pub const M_CHECK_ACTION: ::c_int = -5; -pub const M_PERTURB: ::c_int = -6; -pub const M_ARENA_TEST: ::c_int = -7; -pub const M_ARENA_MAX: ::c_int = -8; - -#[doc(hidden)] -pub const AF_MAX: ::c_int = 42; -#[doc(hidden)] -pub const PF_MAX: ::c_int = AF_MAX; - -cfg_if! { - if #[cfg(any(target_arch = "arm", target_arch = "x86", - target_arch = "x86_64"))] { - pub const PTHREAD_STACK_MIN: ::size_t = 16384; - } else if #[cfg(target_arch = "sparc64")] { - pub const PTHREAD_STACK_MIN: ::size_t = 0x6000; - } else { - pub const PTHREAD_STACK_MIN: ::size_t = 131072; - } -} -pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 3; - -f! { - pub fn NLA_ALIGN(len: ::c_int) -> ::c_int { - return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1) - } -} - -extern { - pub fn utmpxname(file: *const ::c_char) -> ::c_int; - pub fn getutxent() -> *mut utmpx; - pub fn getutxid(ut: *const utmpx) -> *mut utmpx; - pub fn getutxline(ut: *const utmpx) -> *mut utmpx; - pub fn pututxline(ut: *const utmpx) -> *mut utmpx; - pub fn setutxent(); - pub fn endutxent(); - pub fn getpt() -> ::c_int; - pub fn mallopt(param: ::c_int, value: ::c_int) -> ::c_int; -} - -#[link(name = "util")] -extern { - pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; - pub fn backtrace(buf: *mut *mut ::c_void, - sz: ::c_int) -> ::c_int; - pub fn glob64(pattern: *const ::c_char, - flags: ::c_int, - errfunc: ::Option ::c_int>, - pglob: *mut glob64_t) -> ::c_int; - pub fn globfree64(pglob: *mut glob64_t); - pub fn ptrace(request: ::c_uint, ...) -> ::c_long; - pub fn pthread_attr_getaffinity_np(attr: *const ::pthread_attr_t, - cpusetsize: ::size_t, - cpuset: *mut ::cpu_set_t) -> ::c_int; - pub fn pthread_attr_setaffinity_np(attr: *mut ::pthread_attr_t, - cpusetsize: ::size_t, - cpuset: *const ::cpu_set_t) -> ::c_int; - pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int; - pub fn setpriority(which: ::__priority_which_t, who: ::id_t, - prio: ::c_int) -> ::c_int; - pub fn pthread_getaffinity_np(thread: ::pthread_t, - cpusetsize: ::size_t, - cpuset: *mut ::cpu_set_t) -> ::c_int; - pub fn pthread_setaffinity_np(thread: ::pthread_t, - cpusetsize: ::size_t, - cpuset: *const ::cpu_set_t) -> ::c_int; - pub fn pthread_rwlockattr_getkind_np(attr: *const ::pthread_rwlockattr_t, - val: *mut ::c_int) -> ::c_int; - pub fn pthread_rwlockattr_setkind_np(attr: *mut ::pthread_rwlockattr_t, - val: ::c_int) -> ::c_int; - pub fn sched_getcpu() -> ::c_int; - pub fn mallinfo() -> ::mallinfo; - pub fn malloc_usable_size(ptr: *mut ::c_void) -> ::size_t; - pub fn getauxval(type_: ::c_ulong) -> ::c_ulong; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwent_r")] - pub fn getpwent_r(pwd: *mut ::unix::notbsd::linux::passwd, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut ::unix::notbsd - ::linux::passwd) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getgrent_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrent_r")] - pub fn getgrent_r(grp: *mut ::group, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut ::group) -> ::c_int; -} - -cfg_if! { - if #[cfg(any(target_arch = "x86", - target_arch = "arm", - target_arch = "powerpc"))] { - mod b32; - pub use self::b32::*; - } else if #[cfg(any(target_arch = "x86_64", - target_arch = "aarch64", - target_arch = "powerpc64", - target_arch = "sparc64"))] { - mod b64; - pub use self::b64::*; - } else { - // Unknown target_arch - } -} - -cfg_if! { - if #[cfg(libc_align)] { - mod align; - pub use self::align::*; - } else { - mod no_align; - pub use self::no_align::*; - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/no_align.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/no_align.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/other/no_align.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/other/no_align.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -s! { - // FIXME this is actually a union - pub struct sem_t { - #[cfg(target_pointer_width = "32")] - __size: [::c_char; 16], - #[cfg(target_pointer_width = "64")] - __size: [::c_char; 32], - __align: [::c_long; 0], - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/s390x/align.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/s390x/align.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/s390x/align.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/s390x/align.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -s! { - // FIXME this is actually a union - #[cfg_attr(target_pointer_width = "32", - repr(align(4)))] - #[cfg_attr(target_pointer_width = "64", - repr(align(8)))] - pub struct sem_t { - __size: [::c_char; 32], - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/s390x/mod.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/s390x/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/s390x/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/s390x/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,1364 +0,0 @@ -use ::pthread_mutex_t; - -pub type blkcnt_t = i64; -pub type blksize_t = i64; -pub type c_char = u8; -pub type c_long = i64; -pub type c_ulong = u64; -pub type fsblkcnt_t = u64; -pub type fsfilcnt_t = u64; -pub type ino_t = u64; -pub type nlink_t = u64; -pub type off_t = i64; -pub type rlim_t = u64; -pub type suseconds_t = i64; -pub type time_t = i64; -pub type wchar_t = i32; -pub type greg_t = u64; -pub type clock_t = i64; -pub type shmatt_t = ::c_ulong; -pub type msgqnum_t = ::c_ulong; -pub type msglen_t = ::c_ulong; -pub type __fsword_t = ::c_long; -pub type __priority_which_t = ::c_uint; -pub type __u64 = u64; - -s! { - pub struct aiocb { - pub aio_fildes: ::c_int, - pub aio_lio_opcode: ::c_int, - pub aio_reqprio: ::c_int, - pub aio_buf: *mut ::c_void, - pub aio_nbytes: ::size_t, - pub aio_sigevent: ::sigevent, - __next_prio: *mut aiocb, - __abs_prio: ::c_int, - __policy: ::c_int, - __error_code: ::c_int, - __return_value: ::ssize_t, - pub aio_offset: off_t, - #[cfg(target_pointer_width = "32")] - __unused1: [::c_char; 4], - __glibc_reserved: [::c_char; 32] - } - - pub struct stat { - pub st_dev: ::dev_t, - pub st_ino: ::ino_t, - pub st_nlink: ::nlink_t, - pub st_mode: ::mode_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - st_pad0: ::c_int, - pub st_rdev: ::dev_t, - pub st_size: ::off_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt_t, - __glibc_reserved: [::c_long; 3], - } - - pub struct stat64 { - pub st_dev: ::dev_t, - pub st_ino: ::ino64_t, - pub st_nlink: ::nlink_t, - pub st_mode: ::mode_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - st_pad0: ::c_int, - pub st_rdev: ::dev_t, - pub st_size: ::off_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt64_t, - __glibc_reserved: [::c_long; 3], - } - - pub struct pthread_attr_t { - __size: [::c_ulong; 7] - } - - pub struct sigaction { - pub sa_sigaction: ::sighandler_t, - __glibc_reserved0: ::c_int, - pub sa_flags: ::c_int, - pub sa_restorer: ::Option, - pub sa_mask: sigset_t, - } - - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_flags: ::c_int, - pub ss_size: ::size_t, - } - - pub struct sigset_t { - __size: [::c_ulong; 16], - } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_errno: ::c_int, - pub si_code: ::c_int, - _pad: ::c_int, - _pad2: [::c_long; 14], - } - - pub struct ipc_perm { - pub __key: ::key_t, - pub uid: ::uid_t, - pub gid: ::gid_t, - pub cuid: ::uid_t, - pub cgid: ::gid_t, - pub mode: ::mode_t, - pub __seq: ::c_ushort, - __pad1: ::c_ushort, - __unused1: ::c_ulong, - __unused2: ::c_ulong - } - - pub struct shmid_ds { - pub shm_perm: ::ipc_perm, - pub shm_segsz: ::size_t, - pub shm_atime: ::time_t, - pub shm_dtime: ::time_t, - pub shm_ctime: ::time_t, - pub shm_cpid: ::pid_t, - pub shm_lpid: ::pid_t, - pub shm_nattch: ::shmatt_t, - __unused4: ::c_ulong, - __unused5: ::c_ulong - } - - pub struct statfs { - pub f_type: ::c_uint, - pub f_bsize: ::c_uint, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - pub f_namelen: ::c_uint, - pub f_frsize: ::c_uint, - pub f_flags: ::c_uint, - f_spare: [::c_uint; 4], - } - - pub struct statvfs { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_favail: ::fsfilcnt_t, - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - - pub struct msghdr { - pub msg_name: *mut ::c_void, - pub msg_namelen: ::socklen_t, - pub msg_iov: *mut ::iovec, - pub msg_iovlen: ::size_t, - pub msg_control: *mut ::c_void, - pub msg_controllen: ::size_t, - pub msg_flags: ::c_int, - } - - pub struct cmsghdr { - pub cmsg_len: ::size_t, - pub cmsg_level: ::c_int, - pub cmsg_type: ::c_int, - } - - pub struct termios { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; ::NCCS], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } - - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 19], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } - - pub struct sysinfo { - pub uptime: ::c_long, - pub loads: [::c_ulong; 3], - pub totalram: ::c_ulong, - pub freeram: ::c_ulong, - pub sharedram: ::c_ulong, - pub bufferram: ::c_ulong, - pub totalswap: ::c_ulong, - pub freeswap: ::c_ulong, - pub procs: ::c_ushort, - pub pad: ::c_ushort, - pub totalhigh: ::c_ulong, - pub freehigh: ::c_ulong, - pub mem_unit: ::c_uint, - pub _f: [::c_char; 0], - } - - pub struct glob64_t { - pub gl_pathc: ::size_t, - pub gl_pathv: *mut *mut ::c_char, - pub gl_offs: ::size_t, - pub gl_flags: ::c_int, - - __unused1: *mut ::c_void, - __unused2: *mut ::c_void, - __unused3: *mut ::c_void, - __unused4: *mut ::c_void, - __unused5: *mut ::c_void, - } - - pub struct flock { - pub l_type: ::c_short, - pub l_whence: ::c_short, - pub l_start: ::off_t, - pub l_len: ::off_t, - pub l_pid: ::pid_t, - } - - pub struct __psw_t { - pub mask: u64, - pub addr: u64, - } - - pub struct fpregset_t { - pub fpc: u32, - __pad: u32, - pub fprs: [fpreg_t; 16], - } - - pub struct mcontext_t { - pub psw: __psw_t, - pub gregs: [u64; 16], - pub aregs: [u32; 16], - pub fpregs: fpregset_t, - } - - pub struct ucontext_t { - pub uc_flags: ::c_ulong, - pub uc_link: *mut ucontext_t, - pub uc_stack: ::stack_t, - pub uc_mcontext: mcontext_t, - pub uc_sigmask: ::sigset_t, - } - - pub struct msqid_ds { - pub msg_perm: ::ipc_perm, - pub msg_stime: ::time_t, - pub msg_rtime: ::time_t, - pub msg_ctime: ::time_t, - __msg_cbytes: ::c_ulong, - pub msg_qnum: ::msgqnum_t, - pub msg_qbytes: ::msglen_t, - pub msg_lspid: ::pid_t, - pub msg_lrpid: ::pid_t, - __glibc_reserved4: ::c_ulong, - __glibc_reserved5: ::c_ulong, - } - - pub struct statfs64 { - pub f_type: ::c_uint, - pub f_bsize: ::c_uint, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_fsid: ::fsid_t, - pub f_namelen: ::c_uint, - pub f_frsize: ::c_uint, - pub f_flags: ::c_uint, - pub f_spare: [::c_uint; 4], - } - - pub struct statvfs64 { - pub f_bsize: ::c_ulong, - pub f_frsize: ::c_ulong, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_favail: u64, - pub f_fsid: ::c_ulong, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } -} - -s_no_extra_traits!{ - // FIXME: This is actually a union. - pub struct fpreg_t { - pub d: ::c_double, - // f: ::c_float, - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for fpreg_t { - fn eq(&self, other: &fpreg_t) -> bool { - self.d == other.d - } - } - - impl Eq for fpreg_t {} - - impl ::fmt::Debug for fpreg_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("fpreg_t") - .field("d", &self.d) - .finish() - } - } - - impl ::hash::Hash for fpreg_t { - fn hash(&self, state: &mut H) { - let d: u64 = unsafe { ::mem::transmute(self.d) }; - d.hash(state); - } - } - } -} - -pub const SFD_CLOEXEC: ::c_int = 0x080000; - -pub const NCCS: usize = 32; - -pub const O_TRUNC: ::c_int = 512; -pub const O_LARGEFILE: ::c_int = 0; -pub const O_NOATIME: ::c_int = 0o1000000; -pub const O_CLOEXEC: ::c_int = 0x80000; -pub const O_PATH: ::c_int = 0o10000000; -pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; - -pub const EBFONT: ::c_int = 59; -pub const ENOSTR: ::c_int = 60; -pub const ENODATA: ::c_int = 61; -pub const ETIME: ::c_int = 62; -pub const ENOSR: ::c_int = 63; -pub const ENONET: ::c_int = 64; -pub const ENOPKG: ::c_int = 65; -pub const EREMOTE: ::c_int = 66; -pub const ENOLINK: ::c_int = 67; -pub const EADV: ::c_int = 68; -pub const ESRMNT: ::c_int = 69; -pub const ECOMM: ::c_int = 70; -pub const EPROTO: ::c_int = 71; -pub const EDOTDOT: ::c_int = 73; - -pub const SA_NODEFER: ::c_int = 0x40000000; -pub const SA_RESETHAND: ::c_int = 0x80000000; -pub const SA_RESTART: ::c_int = 0x10000000; -pub const SA_NOCLDSTOP: ::c_int = 0x00000001; - -pub const EPOLL_CLOEXEC: ::c_int = 0x80000; - -pub const EFD_CLOEXEC: ::c_int = 0x80000; - -pub const POSIX_FADV_DONTNEED: ::c_int = 6; -pub const POSIX_FADV_NOREUSE: ::c_int = 7; - -pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; -pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; -pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; -pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; -pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; - -align_const! { - pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 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, - ], - }; - pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }; - pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = - pthread_mutex_t { - size: [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }; -} - -pub const EADDRINUSE: ::c_int = 98; -pub const EADDRNOTAVAIL: ::c_int = 99; -pub const ECONNABORTED: ::c_int = 103; -pub const ECONNREFUSED: ::c_int = 111; -pub const ECONNRESET: ::c_int = 104; -pub const EDEADLK: ::c_int = 35; -pub const ENOSYS: ::c_int = 38; -pub const ENOTCONN: ::c_int = 107; -pub const ETIMEDOUT: ::c_int = 110; -pub const FIOCLEX: ::c_ulong = 0x5451; -pub const FIONBIO: ::c_ulong = 0x5421; -pub const MAP_ANON: ::c_int = 0x20; -pub const O_ACCMODE: ::c_int = 3; -pub const O_APPEND: ::c_int = 1024; -pub const O_CREAT: ::c_int = 64; -pub const O_EXCL: ::c_int = 128; -pub const O_NONBLOCK: ::c_int = 2048; -pub const PTHREAD_STACK_MIN: ::size_t = 16384; -pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 3; -pub const RLIM_INFINITY: ::rlim_t = 0xffffffffffffffff; -pub const SA_NOCLDWAIT: ::c_int = 2; -pub const SA_ONSTACK: ::c_int = 0x08000000; -pub const SA_SIGINFO: ::c_int = 4; -pub const SIGBUS: ::c_int = 7; -pub const SIGSTKSZ: ::size_t = 0x2000; -pub const MINSIGSTKSZ: ::size_t = 2048; -pub const SIG_SETMASK: ::c_int = 2; -pub const SOCK_DGRAM: ::c_int = 2; -pub const SOCK_STREAM: ::c_int = 1; -pub const SOL_SOCKET: ::c_int = 1; -pub const SO_BROADCAST: ::c_int = 6; -pub const SO_ERROR: ::c_int = 4; -pub const SO_RCVTIMEO: ::c_int = 20; -pub const SO_REUSEADDR: ::c_int = 2; -pub const SO_SNDTIMEO: ::c_int = 21; -pub const SO_BINDTODEVICE: ::c_int = 25; -pub const SO_TIMESTAMP: ::c_int = 29; -pub const SO_MARK: ::c_int = 36; -pub const SO_PROTOCOL: ::c_int = 38; -pub const SO_DOMAIN: ::c_int = 39; -pub const SO_RXQ_OVFL: ::c_int = 40; -pub const SO_PEEK_OFF: ::c_int = 42; -pub const SO_BUSY_POLL: ::c_int = 46; - -pub const RLIMIT_RSS: ::c_int = 5; -pub const RLIMIT_NOFILE: ::c_int = 7; -pub const RLIMIT_AS: ::c_int = 9; -pub const RLIMIT_NPROC: ::c_int = 6; -pub const RLIMIT_MEMLOCK: ::c_int = 8; -pub const RLIMIT_RTTIME: ::c_int = 15; -pub const RLIMIT_NLIMITS: ::c_int = 16; - -pub const O_NOCTTY: ::c_int = 256; -pub const O_SYNC: ::c_int = 1052672; -pub const O_RSYNC: ::c_int = 1052672; -pub const O_DSYNC: ::c_int = 4096; -pub const O_FSYNC: ::c_int = 0x101000; -pub const O_DIRECT: ::c_int = 0x4000; -pub const O_DIRECTORY: ::c_int = 0x10000; -pub const O_NOFOLLOW: ::c_int = 0x20000; - -pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK; - -pub const LC_PAPER: ::c_int = 7; -pub const LC_NAME: ::c_int = 8; -pub const LC_ADDRESS: ::c_int = 9; -pub const LC_TELEPHONE: ::c_int = 10; -pub const LC_MEASUREMENT: ::c_int = 11; -pub const LC_IDENTIFICATION: ::c_int = 12; -pub const LC_PAPER_MASK: ::c_int = (1 << LC_PAPER); -pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME); -pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS); -pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE); -pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT); -pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION); -pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK - | ::LC_NUMERIC_MASK - | ::LC_TIME_MASK - | ::LC_COLLATE_MASK - | ::LC_MONETARY_MASK - | ::LC_MESSAGES_MASK - | LC_PAPER_MASK - | LC_NAME_MASK - | LC_ADDRESS_MASK - | LC_TELEPHONE_MASK - | LC_MEASUREMENT_MASK - | LC_IDENTIFICATION_MASK; - -pub const MAP_ANONYMOUS: ::c_int = 0x0020; -pub const MAP_GROWSDOWN: ::c_int = 0x0100; -pub const MAP_DENYWRITE: ::c_int = 0x0800; -pub const MAP_EXECUTABLE: ::c_int = 0x01000; -pub const MAP_LOCKED: ::c_int = 0x02000; -pub const MAP_NORESERVE: ::c_int = 0x04000; -pub const MAP_POPULATE: ::c_int = 0x08000; -pub const MAP_NONBLOCK: ::c_int = 0x010000; -pub const MAP_STACK: ::c_int = 0x020000; - -pub const EDEADLOCK: ::c_int = 35; -pub const ENAMETOOLONG: ::c_int = 36; -pub const ENOLCK: ::c_int = 37; -pub const ENOTEMPTY: ::c_int = 39; -pub const ELOOP: ::c_int = 40; -pub const ENOMSG: ::c_int = 42; -pub const EIDRM: ::c_int = 43; -pub const ECHRNG: ::c_int = 44; -pub const EL2NSYNC: ::c_int = 45; -pub const EL3HLT: ::c_int = 46; -pub const EL3RST: ::c_int = 47; -pub const ELNRNG: ::c_int = 48; -pub const EUNATCH: ::c_int = 49; -pub const ENOCSI: ::c_int = 50; -pub const EL2HLT: ::c_int = 51; -pub const EBADE: ::c_int = 52; -pub const EBADR: ::c_int = 53; -pub const EXFULL: ::c_int = 54; -pub const ENOANO: ::c_int = 55; -pub const EBADRQC: ::c_int = 56; -pub const EBADSLT: ::c_int = 57; -pub const EMULTIHOP: ::c_int = 72; -pub const EOVERFLOW: ::c_int = 75; -pub const ENOTUNIQ: ::c_int = 76; -pub const EBADFD: ::c_int = 77; -pub const EBADMSG: ::c_int = 74; -pub const EREMCHG: ::c_int = 78; -pub const ELIBACC: ::c_int = 79; -pub const ELIBBAD: ::c_int = 80; -pub const ELIBSCN: ::c_int = 81; -pub const ELIBMAX: ::c_int = 82; -pub const ELIBEXEC: ::c_int = 83; -pub const EILSEQ: ::c_int = 84; -pub const ERESTART: ::c_int = 85; -pub const ESTRPIPE: ::c_int = 86; -pub const EUSERS: ::c_int = 87; -pub const ENOTSOCK: ::c_int = 88; -pub const EDESTADDRREQ: ::c_int = 89; -pub const EMSGSIZE: ::c_int = 90; -pub const EPROTOTYPE: ::c_int = 91; -pub const ENOPROTOOPT: ::c_int = 92; -pub const EPROTONOSUPPORT: ::c_int = 93; -pub const ESOCKTNOSUPPORT: ::c_int = 94; -pub const EOPNOTSUPP: ::c_int = 95; -pub const ENOTSUP: ::c_int = EOPNOTSUPP; -pub const EPFNOSUPPORT: ::c_int = 96; -pub const EAFNOSUPPORT: ::c_int = 97; -pub const ENETDOWN: ::c_int = 100; -pub const ENETUNREACH: ::c_int = 101; -pub const ENETRESET: ::c_int = 102; -pub const ENOBUFS: ::c_int = 105; -pub const EISCONN: ::c_int = 106; -pub const ESHUTDOWN: ::c_int = 108; -pub const ETOOMANYREFS: ::c_int = 109; -pub const EHOSTDOWN: ::c_int = 112; -pub const EHOSTUNREACH: ::c_int = 113; -pub const EALREADY: ::c_int = 114; -pub const EINPROGRESS: ::c_int = 115; -pub const ESTALE: ::c_int = 116; -pub const EUCLEAN: ::c_int = 117; -pub const ENOTNAM: ::c_int = 118; -pub const ENAVAIL: ::c_int = 119; -pub const EISNAM: ::c_int = 120; -pub const EREMOTEIO: ::c_int = 121; -pub const EDQUOT: ::c_int = 122; -pub const ENOMEDIUM: ::c_int = 123; -pub const EMEDIUMTYPE: ::c_int = 124; -pub const ECANCELED: ::c_int = 125; -pub const ENOKEY: ::c_int = 126; -pub const EKEYEXPIRED: ::c_int = 127; -pub const EKEYREVOKED: ::c_int = 128; -pub const EKEYREJECTED: ::c_int = 129; -pub const EOWNERDEAD: ::c_int = 130; -pub const ENOTRECOVERABLE: ::c_int = 131; -pub const EHWPOISON: ::c_int = 133; -pub const ERFKILL: ::c_int = 132; - -pub const SOCK_SEQPACKET: ::c_int = 5; - -pub const SO_TYPE: ::c_int = 3; -pub const SO_DONTROUTE: ::c_int = 5; -pub const SO_SNDBUF: ::c_int = 7; -pub const SO_RCVBUF: ::c_int = 8; -pub const SO_KEEPALIVE: ::c_int = 9; -pub const SO_OOBINLINE: ::c_int = 10; -pub const SO_PRIORITY: ::c_int = 12; -pub const SO_LINGER: ::c_int = 13; -pub const SO_BSDCOMPAT: ::c_int = 14; -pub const SO_REUSEPORT: ::c_int = 15; -pub const SO_PASSCRED: ::c_int = 16; -pub const SO_PEERCRED: ::c_int = 17; -pub const SO_RCVLOWAT: ::c_int = 18; -pub const SO_SNDLOWAT: ::c_int = 19; -pub const SO_ACCEPTCONN: ::c_int = 30; -pub const SO_SNDBUFFORCE: ::c_int = 32; -pub const SO_RCVBUFFORCE: ::c_int = 33; - -pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15; -pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16; -pub const TCP_THIN_DUPACK: ::c_int = 17; -pub const TCP_USER_TIMEOUT: ::c_int = 18; -pub const TCP_REPAIR: ::c_int = 19; -pub const TCP_REPAIR_QUEUE: ::c_int = 20; -pub const TCP_QUEUE_SEQ: ::c_int = 21; -pub const TCP_REPAIR_OPTIONS: ::c_int = 22; -pub const TCP_FASTOPEN: ::c_int = 23; -pub const TCP_TIMESTAMP: ::c_int = 24; - -pub const SIGCHLD: ::c_int = 17; -pub const SIGUSR1: ::c_int = 10; -pub const SIGUSR2: ::c_int = 12; -pub const SIGCONT: ::c_int = 18; -pub const SIGSTOP: ::c_int = 19; -pub const SIGTSTP: ::c_int = 20; -pub const SIGURG: ::c_int = 23; -pub const SIGIO: ::c_int = 29; -pub const SIGSYS: ::c_int = 31; -pub const SIGSTKFLT: ::c_int = 16; -pub const SIGUNUSED: ::c_int = 31; -pub const SIGTTIN: ::c_int = 21; -pub const SIGTTOU: ::c_int = 22; -pub const SIGXCPU: ::c_int = 24; -pub const SIGXFSZ: ::c_int = 25; -pub const SIGVTALRM: ::c_int = 26; -pub const SIGPROF: ::c_int = 27; -pub const SIGWINCH: ::c_int = 28; -pub const SIGPOLL: ::c_int = 29; -pub const SIGPWR: ::c_int = 30; -pub const SIG_BLOCK: ::c_int = 0x000000; -pub const SIG_UNBLOCK: ::c_int = 0x01; - -pub const BUFSIZ: ::c_uint = 8192; -pub const TMP_MAX: ::c_uint = 238328; -pub const FOPEN_MAX: ::c_uint = 16; -pub const POSIX_MADV_DONTNEED: ::c_int = 4; -pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41; -pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45; -pub const _SC_PII: ::c_int = 53; -pub const _SC_PII_XTI: ::c_int = 54; -pub const _SC_PII_SOCKET: ::c_int = 55; -pub const _SC_PII_INTERNET: ::c_int = 56; -pub const _SC_PII_OSI: ::c_int = 57; -pub const _SC_POLL: ::c_int = 58; -pub const _SC_SELECT: ::c_int = 59; -pub const _SC_PII_INTERNET_STREAM: ::c_int = 61; -pub const _SC_PII_INTERNET_DGRAM: ::c_int = 62; -pub const _SC_PII_OSI_COTS: ::c_int = 63; -pub const _SC_PII_OSI_CLTS: ::c_int = 64; -pub const _SC_PII_OSI_M: ::c_int = 65; -pub const _SC_T_IOV_MAX: ::c_int = 66; -pub const _SC_2_C_VERSION: ::c_int = 96; -pub const _SC_CHAR_BIT: ::c_int = 101; -pub const _SC_CHAR_MAX: ::c_int = 102; -pub const _SC_CHAR_MIN: ::c_int = 103; -pub const _SC_INT_MAX: ::c_int = 104; -pub const _SC_INT_MIN: ::c_int = 105; -pub const _SC_LONG_BIT: ::c_int = 106; -pub const _SC_WORD_BIT: ::c_int = 107; -pub const _SC_MB_LEN_MAX: ::c_int = 108; -pub const _SC_SSIZE_MAX: ::c_int = 110; -pub const _SC_SCHAR_MAX: ::c_int = 111; -pub const _SC_SCHAR_MIN: ::c_int = 112; -pub const _SC_SHRT_MAX: ::c_int = 113; -pub const _SC_SHRT_MIN: ::c_int = 114; -pub const _SC_UCHAR_MAX: ::c_int = 115; -pub const _SC_UINT_MAX: ::c_int = 116; -pub const _SC_ULONG_MAX: ::c_int = 117; -pub const _SC_USHRT_MAX: ::c_int = 118; -pub const _SC_NL_ARGMAX: ::c_int = 119; -pub const _SC_NL_LANGMAX: ::c_int = 120; -pub const _SC_NL_MSGMAX: ::c_int = 121; -pub const _SC_NL_NMAX: ::c_int = 122; -pub const _SC_NL_SETMAX: ::c_int = 123; -pub const _SC_NL_TEXTMAX: ::c_int = 124; -pub const _SC_BASE: ::c_int = 134; -pub const _SC_C_LANG_SUPPORT: ::c_int = 135; -pub const _SC_C_LANG_SUPPORT_R: ::c_int = 136; -pub const _SC_DEVICE_IO: ::c_int = 140; -pub const _SC_DEVICE_SPECIFIC: ::c_int = 141; -pub const _SC_DEVICE_SPECIFIC_R: ::c_int = 142; -pub const _SC_FD_MGMT: ::c_int = 143; -pub const _SC_FIFO: ::c_int = 144; -pub const _SC_PIPE: ::c_int = 145; -pub const _SC_FILE_ATTRIBUTES: ::c_int = 146; -pub const _SC_FILE_LOCKING: ::c_int = 147; -pub const _SC_FILE_SYSTEM: ::c_int = 148; -pub const _SC_MULTI_PROCESS: ::c_int = 150; -pub const _SC_SINGLE_PROCESS: ::c_int = 151; -pub const _SC_NETWORKING: ::c_int = 152; -pub const _SC_REGEX_VERSION: ::c_int = 156; -pub const _SC_SIGNALS: ::c_int = 158; -pub const _SC_SYSTEM_DATABASE: ::c_int = 162; -pub const _SC_SYSTEM_DATABASE_R: ::c_int = 163; -pub const _SC_USER_GROUPS: ::c_int = 166; -pub const _SC_USER_GROUPS_R: ::c_int = 167; -pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 185; -pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 186; -pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 187; -pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 188; -pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 189; -pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 190; -pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 191; -pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 192; -pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 193; -pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 194; -pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 195; -pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 196; -pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 197; -pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 198; -pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 199; -pub const O_ASYNC: ::c_int = 0x2000; -pub const O_NDELAY: ::c_int = 0x800; -pub const ST_RELATIME: ::c_ulong = 4096; -pub const NI_MAXHOST: ::socklen_t = 1025; - -pub const ADFS_SUPER_MAGIC: ::c_int = 0x0000adf5; -pub const AFFS_SUPER_MAGIC: ::c_int = 0x0000adff; -pub const CODA_SUPER_MAGIC: ::c_int = 0x73757245; -pub const CRAMFS_MAGIC: ::c_int = 0x28cd3d45; -pub const EFS_SUPER_MAGIC: ::c_int = 0x00414a53; -pub const EXT2_SUPER_MAGIC: ::c_int = 0x0000ef53; -pub const EXT3_SUPER_MAGIC: ::c_int = 0x0000ef53; -pub const EXT4_SUPER_MAGIC: ::c_int = 0x0000ef53; -pub const HPFS_SUPER_MAGIC: ::c_int = 0xf995e849; -pub const HUGETLBFS_MAGIC: ::c_int = 0x958458f6; -pub const ISOFS_SUPER_MAGIC: ::c_int = 0x00009660; -pub const JFFS2_SUPER_MAGIC: ::c_int = 0x000072b6; -pub const MINIX_SUPER_MAGIC: ::c_int = 0x0000137f; -pub const MINIX_SUPER_MAGIC2: ::c_int = 0x0000138f; -pub const MINIX2_SUPER_MAGIC: ::c_int = 0x00002468; -pub const MINIX2_SUPER_MAGIC2: ::c_int = 0x00002478; -pub const MSDOS_SUPER_MAGIC: ::c_int = 0x00004d44; -pub const NCP_SUPER_MAGIC: ::c_int = 0x0000564c; -pub const NFS_SUPER_MAGIC: ::c_int = 0x00006969; -pub const OPENPROM_SUPER_MAGIC: ::c_int = 0x00009fa1; -pub const PROC_SUPER_MAGIC: ::c_int = 0x00009fa0; -pub const QNX4_SUPER_MAGIC: ::c_int = 0x0000002f; -pub const REISERFS_SUPER_MAGIC: ::c_int = 0x52654973; -pub const SMB_SUPER_MAGIC: ::c_int = 0x0000517b; -pub const TMPFS_MAGIC: ::c_int = 0x01021994; -pub const USBDEVICE_SUPER_MAGIC: ::c_int = 0x00009fa2; - -pub const VEOF: usize = 4; -pub const VEOL: usize = 11; -pub const VEOL2: usize = 16; -pub const VMIN: usize = 6; -pub const IEXTEN: ::tcflag_t = 0x00008000; -pub const TOSTOP: ::tcflag_t = 0x00000100; -pub const FLUSHO: ::tcflag_t = 0x00001000; - -pub const CPU_SETSIZE: ::c_int = 0x400; - -pub const EXTPROC: ::tcflag_t = 0x00010000; - -pub const PTRACE_TRACEME: ::c_uint = 0; -pub const PTRACE_PEEKTEXT: ::c_uint = 1; -pub const PTRACE_PEEKDATA: ::c_uint = 2; -pub const PTRACE_PEEKUSER: ::c_uint = 3; -pub const PTRACE_POKETEXT: ::c_uint = 4; -pub const PTRACE_POKEDATA: ::c_uint = 5; -pub const PTRACE_POKEUSER: ::c_uint = 6; -pub const PTRACE_CONT: ::c_uint = 7; -pub const PTRACE_KILL: ::c_uint = 8; -pub const PTRACE_SINGLESTEP: ::c_uint = 9; -pub const PTRACE_GETREGS: ::c_uint = 12; -pub const PTRACE_SETREGS: ::c_uint = 13; -pub const PTRACE_GETFPREGS: ::c_uint = 14; -pub const PTRACE_SETFPREGS: ::c_uint = 15; -pub const PTRACE_ATTACH: ::c_uint = 16; -pub const PTRACE_DETACH: ::c_uint = 17; -pub const PTRACE_SYSCALL: ::c_uint = 24; -pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200; -pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201; -pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202; -pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203; -pub const PTRACE_GETREGSET: ::c_uint = 0x4204; -pub const PTRACE_SETREGSET: ::c_uint = 0x4205; -pub const PTRACE_SEIZE: ::c_uint = 0x4206; -pub const PTRACE_INTERRUPT: ::c_uint = 0x4207; -pub const PTRACE_LISTEN: ::c_uint = 0x4208; -pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209; - -pub const MCL_CURRENT: ::c_int = 0x0001; -pub const MCL_FUTURE: ::c_int = 0x0002; - -pub const EPOLLWAKEUP: ::c_int = 0x20000000; - -pub const MAP_HUGETLB: ::c_int = 0x040000; - -pub const EFD_NONBLOCK: ::c_int = 0x800; - -pub const F_RDLCK: ::c_int = 0; -pub const F_WRLCK: ::c_int = 1; -pub const F_UNLCK: ::c_int = 2; -pub const F_GETLK: ::c_int = 5; -pub const F_GETOWN: ::c_int = 9; -pub const F_SETOWN: ::c_int = 8; -pub const F_SETLK: ::c_int = 6; -pub const F_SETLKW: ::c_int = 7; - -pub const SEEK_DATA: ::c_int = 3; -pub const SEEK_HOLE: ::c_int = 4; - -pub const SFD_NONBLOCK: ::c_int = 0x0800; - -pub const TCSANOW: ::c_int = 0; -pub const TCSADRAIN: ::c_int = 1; -pub const TCSAFLUSH: ::c_int = 2; - -pub const TCGETS: ::c_ulong = 0x5401; -pub const TCSETS: ::c_ulong = 0x5402; -pub const TCSETSW: ::c_ulong = 0x5403; -pub const TCSETSF: ::c_ulong = 0x5404; -pub const TCGETA: ::c_ulong = 0x5405; -pub const TCSETA: ::c_ulong = 0x5406; -pub const TCSETAW: ::c_ulong = 0x5407; -pub const TCSETAF: ::c_ulong = 0x5408; -pub const TCSBRK: ::c_ulong = 0x5409; -pub const TCXONC: ::c_ulong = 0x540A; -pub const TCFLSH: ::c_ulong = 0x540B; -pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; -pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; -pub const TIOCINQ: ::c_ulong = 0x541B; -pub const TIOCLINUX: ::c_ulong = 0x541C; -pub const TIOCGSERIAL: ::c_ulong = 0x541E; -pub const TIOCEXCL: ::c_ulong = 0x540C; -pub const TIOCNXCL: ::c_ulong = 0x540D; -pub const TIOCSCTTY: ::c_ulong = 0x540E; -pub const TIOCGPGRP: ::c_ulong = 0x540F; -pub const TIOCSPGRP: ::c_ulong = 0x5410; -pub const TIOCOUTQ: ::c_ulong = 0x5411; -pub const TIOCSTI: ::c_ulong = 0x5412; -pub const TIOCGWINSZ: ::c_ulong = 0x5413; -pub const TIOCSWINSZ: ::c_ulong = 0x5414; -pub const TIOCMGET: ::c_ulong = 0x5415; -pub const TIOCMBIS: ::c_ulong = 0x5416; -pub const TIOCMBIC: ::c_ulong = 0x5417; -pub const TIOCMSET: ::c_ulong = 0x5418; -pub const FIONREAD: ::c_ulong = 0x541B; -pub const TIOCCONS: ::c_ulong = 0x541D; - -pub const RTLD_DEEPBIND: ::c_int = 0x8; -pub const RTLD_GLOBAL: ::c_int = 0x100; -pub const RTLD_NOLOAD: ::c_int = 0x4; - -pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead; -pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793; -pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278; -pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448; -pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216; - -pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567; -pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123; -pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF; -pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000; -pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC; -pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4; -pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2; -pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543; - -pub const VTIME: usize = 5; -pub const VSWTC: usize = 7; -pub const VSTART: usize = 8; -pub const VSTOP: usize = 9; -pub const VSUSP: usize = 10; -pub const VREPRINT: usize = 12; -pub const VDISCARD: usize = 13; -pub const VWERASE: usize = 14; -pub const OLCUC: ::tcflag_t = 0o000002; -pub const ONLCR: ::tcflag_t = 0o000004; -pub const NLDLY: ::tcflag_t = 0o000400; -pub const CRDLY: ::tcflag_t = 0o003000; -pub const CR1: ::tcflag_t = 0x00000200; -pub const CR2: ::tcflag_t = 0x00000400; -pub const CR3: ::tcflag_t = 0x00000600; -pub const TABDLY: ::tcflag_t = 0o014000; -pub const TAB1: ::tcflag_t = 0x00000800; -pub const TAB2: ::tcflag_t = 0x00001000; -pub const TAB3: ::tcflag_t = 0x00001800; -pub const BSDLY: ::tcflag_t = 0o020000; -pub const BS1: ::tcflag_t = 0x00002000; -pub const FFDLY: ::tcflag_t = 0o100000; -pub const FF1: ::tcflag_t = 0x00008000; -pub const VTDLY: ::tcflag_t = 0o040000; -pub const VT1: ::tcflag_t = 0x00004000; -pub const XTABS: ::tcflag_t = 0o014000; - -pub const TIOCM_LE: ::c_int = 0x001; -pub const TIOCM_DTR: ::c_int = 0x002; -pub const TIOCM_RTS: ::c_int = 0x004; -pub const TIOCM_ST: ::c_int = 0x008; -pub const TIOCM_SR: ::c_int = 0x010; -pub const TIOCM_CTS: ::c_int = 0x020; -pub const TIOCM_CAR: ::c_int = 0x040; -pub const TIOCM_RNG: ::c_int = 0x080; -pub const TIOCM_DSR: ::c_int = 0x100; -pub const TIOCM_CD: ::c_int = TIOCM_CAR; -pub const TIOCM_RI: ::c_int = TIOCM_RNG; - -pub const SIGEV_THREAD_ID: ::c_int = 4; - -pub const CBAUD: ::speed_t = 0o010017; -pub const B0: ::speed_t = 0o000000; -pub const B50: ::speed_t = 0o000001; -pub const B75: ::speed_t = 0o000002; -pub const B110: ::speed_t = 0o000003; -pub const B134: ::speed_t = 0o000004; -pub const B150: ::speed_t = 0o000005; -pub const B200: ::speed_t = 0o000006; -pub const B300: ::speed_t = 0o000007; -pub const B600: ::speed_t = 0o000010; -pub const B1200: ::speed_t = 0o000011; -pub const B1800: ::speed_t = 0o000012; -pub const B2400: ::speed_t = 0o000013; -pub const B4800: ::speed_t = 0o000014; -pub const B9600: ::speed_t = 0o000015; -pub const B19200: ::speed_t = 0o000016; -pub const B38400: ::speed_t = 0o000017; -pub const EXTA: ::speed_t = B19200; -pub const EXTB: ::speed_t = B38400; -pub const CSIZE: ::tcflag_t = 0o000060; -pub const CS6: ::tcflag_t = 0o000020; -pub const CS7: ::tcflag_t = 0o000040; -pub const CS8: ::tcflag_t = 0o000060; -pub const CSTOPB: ::tcflag_t = 0o000100; -pub const CREAD: ::tcflag_t = 0o000200; -pub const PARENB: ::tcflag_t = 0o000400; -pub const PARODD: ::tcflag_t = 0o001000; -pub const HUPCL: ::tcflag_t = 0o002000; -pub const CLOCAL: ::tcflag_t = 0o004000; -pub const CBAUDEX: ::tcflag_t = 0o010000; -pub const BOTHER: ::speed_t = 0o010000; -pub const B57600: ::speed_t = 0o010001; -pub const B115200: ::speed_t = 0o010002; -pub const B230400: ::speed_t = 0o010003; -pub const B460800: ::speed_t = 0o010004; -pub const B500000: ::speed_t = 0o010005; -pub const B576000: ::speed_t = 0o010006; -pub const B921600: ::speed_t = 0o010007; -pub const B1000000: ::speed_t = 0o010010; -pub const B1152000: ::speed_t = 0o010011; -pub const B1500000: ::speed_t = 0o010012; -pub const B2000000: ::speed_t = 0o010013; -pub const B2500000: ::speed_t = 0o010014; -pub const B3000000: ::speed_t = 0o010015; -pub const B3500000: ::speed_t = 0o010016; -pub const B4000000: ::speed_t = 0o010017; -pub const CIBAUD: ::tcflag_t = 0o02003600000; - -pub const ISIG: ::tcflag_t = 0o000001; -pub const ICANON: ::tcflag_t = 0o000002; -pub const XCASE: ::tcflag_t = 0o000004; -pub const ECHOE: ::tcflag_t = 0o000020; -pub const ECHOK: ::tcflag_t = 0o000040; -pub const ECHONL: ::tcflag_t = 0o000100; -pub const NOFLSH: ::tcflag_t = 0o000200; -pub const ECHOCTL: ::tcflag_t = 0o001000; -pub const ECHOPRT: ::tcflag_t = 0o002000; -pub const ECHOKE: ::tcflag_t = 0o004000; -pub const PENDIN: ::tcflag_t = 0o040000; - -pub const POLLWRNORM: ::c_short = 0x100; -pub const POLLWRBAND: ::c_short = 0x200; - -pub const IXON: ::tcflag_t = 0o002000; -pub const IXOFF: ::tcflag_t = 0o010000; - -pub const SYS_exit: ::c_long = 1; -pub const SYS_fork: ::c_long = 2; -pub const SYS_read: ::c_long = 3; -pub const SYS_write: ::c_long = 4; -pub const SYS_open: ::c_long = 5; -pub const SYS_close: ::c_long = 6; -pub const SYS_restart_syscall: ::c_long = 7; -pub const SYS_creat: ::c_long = 8; -pub const SYS_link: ::c_long = 9; -pub const SYS_unlink: ::c_long = 10; -pub const SYS_execve: ::c_long = 11; -pub const SYS_chdir: ::c_long = 12; -pub const SYS_mknod: ::c_long = 14; -pub const SYS_chmod: ::c_long = 15; -pub const SYS_lseek: ::c_long = 19; -pub const SYS_getpid: ::c_long = 20; -pub const SYS_mount: ::c_long = 21; -pub const SYS_umount: ::c_long = 22; -pub const SYS_ptrace: ::c_long = 26; -pub const SYS_alarm: ::c_long = 27; -pub const SYS_pause: ::c_long = 29; -pub const SYS_utime: ::c_long = 30; -pub const SYS_access: ::c_long = 33; -pub const SYS_nice: ::c_long = 34; -pub const SYS_sync: ::c_long = 36; -pub const SYS_kill: ::c_long = 37; -pub const SYS_rename: ::c_long = 38; -pub const SYS_mkdir: ::c_long = 39; -pub const SYS_rmdir: ::c_long = 40; -pub const SYS_dup: ::c_long = 41; -pub const SYS_pipe: ::c_long = 42; -pub const SYS_times: ::c_long = 43; -pub const SYS_brk: ::c_long = 45; -pub const SYS_signal: ::c_long = 48; -pub const SYS_acct: ::c_long = 51; -pub const SYS_umount2: ::c_long = 52; -pub const SYS_ioctl: ::c_long = 54; -pub const SYS_fcntl: ::c_long = 55; -pub const SYS_setpgid: ::c_long = 57; -pub const SYS_umask: ::c_long = 60; -pub const SYS_chroot: ::c_long = 61; -pub const SYS_ustat: ::c_long = 62; -pub const SYS_dup2: ::c_long = 63; -pub const SYS_getppid: ::c_long = 64; -pub const SYS_getpgrp: ::c_long = 65; -pub const SYS_setsid: ::c_long = 66; -pub const SYS_sigaction: ::c_long = 67; -pub const SYS_sigsuspend: ::c_long = 72; -pub const SYS_sigpending: ::c_long = 73; -pub const SYS_sethostname: ::c_long = 74; -pub const SYS_setrlimit: ::c_long = 75; -pub const SYS_getrusage: ::c_long = 77; -pub const SYS_gettimeofday: ::c_long = 78; -pub const SYS_settimeofday: ::c_long = 79; -pub const SYS_symlink: ::c_long = 83; -pub const SYS_readlink: ::c_long = 85; -pub const SYS_uselib: ::c_long = 86; -pub const SYS_swapon: ::c_long = 87; -pub const SYS_reboot: ::c_long = 88; -pub const SYS_readdir: ::c_long = 89; -pub const SYS_mmap: ::c_long = 90; -pub const SYS_munmap: ::c_long = 91; -pub const SYS_truncate: ::c_long = 92; -pub const SYS_ftruncate: ::c_long = 93; -pub const SYS_fchmod: ::c_long = 94; -pub const SYS_getpriority: ::c_long = 96; -pub const SYS_setpriority: ::c_long = 97; -pub const SYS_statfs: ::c_long = 99; -pub const SYS_fstatfs: ::c_long = 100; -pub const SYS_socketcall: ::c_long = 102; -pub const SYS_syslog: ::c_long = 103; -pub const SYS_setitimer: ::c_long = 104; -pub const SYS_getitimer: ::c_long = 105; -pub const SYS_stat: ::c_long = 106; -pub const SYS_lstat: ::c_long = 107; -pub const SYS_fstat: ::c_long = 108; -pub const SYS_lookup_dcookie: ::c_long = 110; -pub const SYS_vhangup: ::c_long = 111; -pub const SYS_idle: ::c_long = 112; -pub const SYS_wait4: ::c_long = 114; -pub const SYS_swapoff: ::c_long = 115; -pub const SYS_sysinfo: ::c_long = 116; -pub const SYS_ipc: ::c_long = 117; -pub const SYS_fsync: ::c_long = 118; -pub const SYS_sigreturn: ::c_long = 119; -pub const SYS_clone: ::c_long = 120; -pub const SYS_setdomainname: ::c_long = 121; -pub const SYS_uname: ::c_long = 122; -pub const SYS_adjtimex: ::c_long = 124; -pub const SYS_mprotect: ::c_long = 125; -pub const SYS_sigprocmask: ::c_long = 126; -pub const SYS_create_module: ::c_long = 127; -pub const SYS_init_module: ::c_long = 128; -pub const SYS_delete_module: ::c_long = 129; -pub const SYS_get_kernel_syms: ::c_long = 130; -pub const SYS_quotactl: ::c_long = 131; -pub const SYS_getpgid: ::c_long = 132; -pub const SYS_fchdir: ::c_long = 133; -pub const SYS_bdflush: ::c_long = 134; -pub const SYS_sysfs: ::c_long = 135; -pub const SYS_personality: ::c_long = 136; -pub const SYS_afs_syscall: ::c_long = 137; /* Syscall for Andrew File System */ -pub const SYS_getdents: ::c_long = 141; -pub const SYS_flock: ::c_long = 143; -pub const SYS_msync: ::c_long = 144; -pub const SYS_readv: ::c_long = 145; -pub const SYS_writev: ::c_long = 146; -pub const SYS_getsid: ::c_long = 147; -pub const SYS_fdatasync: ::c_long = 148; -pub const SYS__sysctl: ::c_long = 149; -pub const SYS_mlock: ::c_long = 150; -pub const SYS_munlock: ::c_long = 151; -pub const SYS_mlockall: ::c_long = 152; -pub const SYS_munlockall: ::c_long = 153; -pub const SYS_sched_setparam: ::c_long = 154; -pub const SYS_sched_getparam: ::c_long = 155; -pub const SYS_sched_setscheduler: ::c_long = 156; -pub const SYS_sched_getscheduler: ::c_long = 157; -pub const SYS_sched_yield: ::c_long = 158; -pub const SYS_sched_get_priority_max: ::c_long = 159; -pub const SYS_sched_get_priority_min: ::c_long = 160; -pub const SYS_sched_rr_get_interval: ::c_long = 161; -pub const SYS_nanosleep: ::c_long = 162; -pub const SYS_mremap: ::c_long = 163; -pub const SYS_query_module: ::c_long = 167; -pub const SYS_poll: ::c_long = 168; -pub const SYS_nfsservctl: ::c_long = 169; -pub const SYS_prctl: ::c_long = 172; -pub const SYS_rt_sigreturn: ::c_long = 173; -pub const SYS_rt_sigaction: ::c_long = 174; -pub const SYS_rt_sigprocmask: ::c_long = 175; -pub const SYS_rt_sigpending: ::c_long = 176; -pub const SYS_rt_sigtimedwait: ::c_long = 177; -pub const SYS_rt_sigqueueinfo: ::c_long = 178; -pub const SYS_rt_sigsuspend: ::c_long = 179; -pub const SYS_pread64: ::c_long = 180; -pub const SYS_pwrite64: ::c_long = 181; -pub const SYS_getcwd: ::c_long = 183; -pub const SYS_capget: ::c_long = 184; -pub const SYS_capset: ::c_long = 185; -pub const SYS_sigaltstack: ::c_long = 186; -pub const SYS_sendfile: ::c_long = 187; -pub const SYS_getpmsg: ::c_long = 188; -pub const SYS_putpmsg: ::c_long = 189; -pub const SYS_vfork: ::c_long = 190; -pub const SYS_pivot_root: ::c_long = 217; -pub const SYS_mincore: ::c_long = 218; -pub const SYS_madvise: ::c_long = 219; -pub const SYS_getdents64: ::c_long = 220; -pub const SYS_readahead: ::c_long = 222; -pub const SYS_setxattr: ::c_long = 224; -pub const SYS_lsetxattr: ::c_long = 225; -pub const SYS_fsetxattr: ::c_long = 226; -pub const SYS_getxattr: ::c_long = 227; -pub const SYS_lgetxattr: ::c_long = 228; -pub const SYS_fgetxattr: ::c_long = 229; -pub const SYS_listxattr: ::c_long = 230; -pub const SYS_llistxattr: ::c_long = 231; -pub const SYS_flistxattr: ::c_long = 232; -pub const SYS_removexattr: ::c_long = 233; -pub const SYS_lremovexattr: ::c_long = 234; -pub const SYS_fremovexattr: ::c_long = 235; -pub const SYS_gettid: ::c_long = 236; -pub const SYS_tkill: ::c_long = 237; -pub const SYS_futex: ::c_long = 238; -pub const SYS_sched_setaffinity: ::c_long = 239; -pub const SYS_sched_getaffinity: ::c_long = 240; -pub const SYS_tgkill: ::c_long = 241; -pub const SYS_io_setup: ::c_long = 243; -pub const SYS_io_destroy: ::c_long = 244; -pub const SYS_io_getevents: ::c_long = 245; -pub const SYS_io_submit: ::c_long = 246; -pub const SYS_io_cancel: ::c_long = 247; -pub const SYS_exit_group: ::c_long = 248; -pub const SYS_epoll_create: ::c_long = 249; -pub const SYS_epoll_ctl: ::c_long = 250; -pub const SYS_epoll_wait: ::c_long = 251; -pub const SYS_set_tid_address: ::c_long = 252; -pub const SYS_fadvise64: ::c_long = 253; -pub const SYS_timer_create: ::c_long = 254; -pub const SYS_timer_settime: ::c_long = 255; -pub const SYS_timer_gettime: ::c_long = 256; -pub const SYS_timer_getoverrun: ::c_long = 257; -pub const SYS_timer_delete: ::c_long = 258; -pub const SYS_clock_settime: ::c_long = 259; -pub const SYS_clock_gettime: ::c_long = 260; -pub const SYS_clock_getres: ::c_long = 261; -pub const SYS_clock_nanosleep: ::c_long = 262; -pub const SYS_statfs64: ::c_long = 265; -pub const SYS_fstatfs64: ::c_long = 266; -pub const SYS_remap_file_pages: ::c_long = 267; -pub const SYS_mbind: ::c_long = 268; -pub const SYS_get_mempolicy: ::c_long = 269; -pub const SYS_set_mempolicy: ::c_long = 270; -pub const SYS_mq_open: ::c_long = 271; -pub const SYS_mq_unlink: ::c_long = 272; -pub const SYS_mq_timedsend: ::c_long = 273; -pub const SYS_mq_timedreceive: ::c_long = 274; -pub const SYS_mq_notify: ::c_long = 275; -pub const SYS_mq_getsetattr: ::c_long = 276; -pub const SYS_kexec_load: ::c_long = 277; -pub const SYS_add_key: ::c_long = 278; -pub const SYS_request_key: ::c_long = 279; -pub const SYS_keyctl: ::c_long = 280; -pub const SYS_waitid: ::c_long = 281; -pub const SYS_ioprio_set: ::c_long = 282; -pub const SYS_ioprio_get: ::c_long = 283; -pub const SYS_inotify_init: ::c_long = 284; -pub const SYS_inotify_add_watch: ::c_long = 285; -pub const SYS_inotify_rm_watch: ::c_long = 286; -pub const SYS_migrate_pages: ::c_long = 287; -pub const SYS_openat: ::c_long = 288; -pub const SYS_mkdirat: ::c_long = 289; -pub const SYS_mknodat: ::c_long = 290; -pub const SYS_fchownat: ::c_long = 291; -pub const SYS_futimesat: ::c_long = 292; -pub const SYS_unlinkat: ::c_long = 294; -pub const SYS_renameat: ::c_long = 295; -pub const SYS_linkat: ::c_long = 296; -pub const SYS_symlinkat: ::c_long = 297; -pub const SYS_readlinkat: ::c_long = 298; -pub const SYS_fchmodat: ::c_long = 299; -pub const SYS_faccessat: ::c_long = 300; -pub const SYS_pselect6: ::c_long = 301; -pub const SYS_ppoll: ::c_long = 302; -pub const SYS_unshare: ::c_long = 303; -pub const SYS_set_robust_list: ::c_long = 304; -pub const SYS_get_robust_list: ::c_long = 305; -pub const SYS_splice: ::c_long = 306; -pub const SYS_sync_file_range: ::c_long = 307; -pub const SYS_tee: ::c_long = 308; -pub const SYS_vmsplice: ::c_long = 309; -pub const SYS_move_pages: ::c_long = 310; -pub const SYS_getcpu: ::c_long = 311; -pub const SYS_epoll_pwait: ::c_long = 312; -pub const SYS_utimes: ::c_long = 313; -pub const SYS_fallocate: ::c_long = 314; -pub const SYS_utimensat: ::c_long = 315; -pub const SYS_signalfd: ::c_long = 316; -pub const SYS_timerfd: ::c_long = 317; -pub const SYS_eventfd: ::c_long = 318; -pub const SYS_timerfd_create: ::c_long = 319; -pub const SYS_timerfd_settime: ::c_long = 320; -pub const SYS_timerfd_gettime: ::c_long = 321; -pub const SYS_signalfd4: ::c_long = 322; -pub const SYS_eventfd2: ::c_long = 323; -pub const SYS_inotify_init1: ::c_long = 324; -pub const SYS_pipe2: ::c_long = 325; -pub const SYS_dup3: ::c_long = 326; -pub const SYS_epoll_create1: ::c_long = 327; -pub const SYS_preadv: ::c_long = 328; -pub const SYS_pwritev: ::c_long = 329; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 330; -pub const SYS_perf_event_open: ::c_long = 331; -pub const SYS_fanotify_init: ::c_long = 332; -pub const SYS_fanotify_mark: ::c_long = 333; -pub const SYS_prlimit64: ::c_long = 334; -pub const SYS_name_to_handle_at: ::c_long = 335; -pub const SYS_open_by_handle_at: ::c_long = 336; -pub const SYS_clock_adjtime: ::c_long = 337; -pub const SYS_syncfs: ::c_long = 338; -pub const SYS_setns: ::c_long = 339; -pub const SYS_process_vm_readv: ::c_long = 340; -pub const SYS_process_vm_writev: ::c_long = 341; -pub const SYS_s390_runtime_instr: ::c_long = 342; -pub const SYS_kcmp: ::c_long = 343; -pub const SYS_finit_module: ::c_long = 344; -pub const SYS_sched_setattr: ::c_long = 345; -pub const SYS_sched_getattr: ::c_long = 346; -pub const SYS_renameat2: ::c_long = 347; -pub const SYS_seccomp: ::c_long = 348; -pub const SYS_getrandom: ::c_long = 349; -pub const SYS_memfd_create: ::c_long = 350; -pub const SYS_bpf: ::c_long = 351; -pub const SYS_s390_pci_mmio_write: ::c_long = 352; -pub const SYS_s390_pci_mmio_read: ::c_long = 353; -pub const SYS_execveat: ::c_long = 354; -pub const SYS_userfaultfd: ::c_long = 355; -pub const SYS_membarrier: ::c_long = 356; -pub const SYS_recvmmsg: ::c_long = 357; -pub const SYS_sendmmsg: ::c_long = 358; -pub const SYS_socket: ::c_long = 359; -pub const SYS_socketpair: ::c_long = 360; -pub const SYS_bind: ::c_long = 361; -pub const SYS_connect: ::c_long = 362; -pub const SYS_listen: ::c_long = 363; -pub const SYS_accept4: ::c_long = 364; -pub const SYS_getsockopt: ::c_long = 365; -pub const SYS_setsockopt: ::c_long = 366; -pub const SYS_getsockname: ::c_long = 367; -pub const SYS_getpeername: ::c_long = 368; -pub const SYS_sendto: ::c_long = 369; -pub const SYS_sendmsg: ::c_long = 370; -pub const SYS_recvfrom: ::c_long = 371; -pub const SYS_recvmsg: ::c_long = 372; -pub const SYS_shutdown: ::c_long = 373; -pub const SYS_mlock2: ::c_long = 374; -pub const SYS_copy_file_range: ::c_long = 375; -pub const SYS_preadv2: ::c_long = 376; -pub const SYS_pwritev2: ::c_long = 377; -pub const SYS_lchown: ::c_long = 198; -pub const SYS_setuid: ::c_long = 213; -pub const SYS_getuid: ::c_long = 199; -pub const SYS_setgid: ::c_long = 214; -pub const SYS_getgid: ::c_long = 200; -pub const SYS_geteuid: ::c_long = 201; -pub const SYS_setreuid: ::c_long = 203; -pub const SYS_setregid: ::c_long = 204; -pub const SYS_getrlimit: ::c_long = 191; -pub const SYS_getgroups: ::c_long = 205; -pub const SYS_fchown: ::c_long = 207; -pub const SYS_setresuid: ::c_long = 208; -pub const SYS_setresgid: ::c_long = 210; -pub const SYS_getresgid: ::c_long = 211; -pub const SYS_select: ::c_long = 142; -pub const SYS_getegid: ::c_long = 202; -pub const SYS_setgroups: ::c_long = 206; -pub const SYS_getresuid: ::c_long = 209; -pub const SYS_chown: ::c_long = 212; -pub const SYS_setfsuid: ::c_long = 215; -pub const SYS_setfsgid: ::c_long = 216; -pub const SYS_newfstatat: ::c_long = 293; - -#[link(name = "util")] -extern { - pub fn sysctl(name: *mut ::c_int, - namelen: ::c_int, - oldp: *mut ::c_void, - oldlenp: *mut ::size_t, - newp: *mut ::c_void, - newlen: ::size_t) - -> ::c_int; - pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; - pub fn backtrace(buf: *mut *mut ::c_void, - sz: ::c_int) -> ::c_int; - pub fn glob64(pattern: *const ::c_char, - flags: ::c_int, - errfunc: ::Option ::c_int>, - pglob: *mut glob64_t) -> ::c_int; - pub fn globfree64(pglob: *mut glob64_t); - pub fn ptrace(request: ::c_uint, ...) -> ::c_long; - pub fn pthread_attr_getaffinity_np(attr: *const ::pthread_attr_t, - cpusetsize: ::size_t, - cpuset: *mut ::cpu_set_t) -> ::c_int; - pub fn pthread_attr_setaffinity_np(attr: *mut ::pthread_attr_t, - cpusetsize: ::size_t, - cpuset: *const ::cpu_set_t) -> ::c_int; - pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int; - pub fn setpriority(which: ::__priority_which_t, who: ::id_t, - prio: ::c_int) -> ::c_int; - pub fn pthread_getaffinity_np(thread: ::pthread_t, - cpusetsize: ::size_t, - cpuset: *mut ::cpu_set_t) -> ::c_int; - pub fn pthread_setaffinity_np(thread: ::pthread_t, - cpusetsize: ::size_t, - cpuset: *const ::cpu_set_t) -> ::c_int; - pub fn sched_getcpu() -> ::c_int; - pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int; - pub fn setcontext(ucp: *const ucontext_t) -> ::c_int; - pub fn makecontext(ucp: *mut ucontext_t, - func: extern fn (), - argc: ::c_int, ...); - pub fn swapcontext(uocp: *mut ucontext_t, - ucp: *const ucontext_t) -> ::c_int; -} - -cfg_if! { - if #[cfg(libc_align)] { - mod align; - pub use self::align::*; - } else { - mod no_align; - pub use self::no_align::*; - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/s390x/no_align.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/s390x/no_align.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/linux/s390x/no_align.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/linux/s390x/no_align.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -s! { - // FIXME this is actually a union - pub struct sem_t { - __size: [::c_char; 32], - __align: [::c_long; 0], - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/notbsd/mod.rs cargo-0.37.0/vendor/libc/src/unix/notbsd/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/notbsd/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/notbsd/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,1429 +0,0 @@ -pub type sa_family_t = u16; -pub type pthread_key_t = ::c_uint; -pub type speed_t = ::c_uint; -pub type tcflag_t = ::c_uint; -pub type clockid_t = ::c_int; -pub type key_t = ::c_int; -pub type id_t = ::c_uint; - -#[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum timezone {} -impl ::Copy for timezone {} -impl ::Clone for timezone { - fn clone(&self) -> timezone { *self } -} - -s! { - pub struct in_addr { - pub s_addr: ::in_addr_t, - } - - pub struct ip_mreq { - pub imr_multiaddr: in_addr, - pub imr_interface: in_addr, - } - - pub struct sockaddr { - pub sa_family: sa_family_t, - pub sa_data: [::c_char; 14], - } - - pub struct sockaddr_in { - pub sin_family: sa_family_t, - pub sin_port: ::in_port_t, - pub sin_addr: ::in_addr, - pub sin_zero: [u8; 8], - } - - pub struct sockaddr_in6 { - pub sin6_family: sa_family_t, - pub sin6_port: ::in_port_t, - pub sin6_flowinfo: u32, - pub sin6_addr: ::in6_addr, - pub sin6_scope_id: u32, - } - - pub struct addrinfo { - pub ai_flags: ::c_int, - pub ai_family: ::c_int, - pub ai_socktype: ::c_int, - pub ai_protocol: ::c_int, - pub ai_addrlen: socklen_t, - - #[cfg(any(target_os = "linux", - target_os = "emscripten"))] - pub ai_addr: *mut ::sockaddr, - - pub ai_canonname: *mut c_char, - - #[cfg(target_os = "android")] - pub ai_addr: *mut ::sockaddr, - - pub ai_next: *mut addrinfo, - } - - pub struct sockaddr_nl { - pub nl_family: ::sa_family_t, - nl_pad: ::c_ushort, - pub nl_pid: u32, - pub nl_groups: u32 - } - - pub struct sockaddr_ll { - pub sll_family: ::c_ushort, - pub sll_protocol: ::c_ushort, - pub sll_ifindex: ::c_int, - pub sll_hatype: ::c_ushort, - pub sll_pkttype: ::c_uchar, - pub sll_halen: ::c_uchar, - pub sll_addr: [::c_uchar; 8] - } - - pub struct fd_set { - fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE], - } - - pub struct tm { - pub tm_sec: ::c_int, - pub tm_min: ::c_int, - pub tm_hour: ::c_int, - pub tm_mday: ::c_int, - pub tm_mon: ::c_int, - pub tm_year: ::c_int, - pub tm_wday: ::c_int, - pub tm_yday: ::c_int, - pub tm_isdst: ::c_int, - pub tm_gmtoff: ::c_long, - pub tm_zone: *const ::c_char, - } - - pub struct sched_param { - pub sched_priority: ::c_int, - #[cfg(any(target_env = "musl", target_os = "emscripten"))] - pub sched_ss_low_priority: ::c_int, - #[cfg(any(target_env = "musl", target_os = "emscripten"))] - pub sched_ss_repl_period: ::timespec, - #[cfg(any(target_env = "musl", target_os = "emscripten"))] - pub sched_ss_init_budget: ::timespec, - #[cfg(any(target_env = "musl", target_os = "emscripten"))] - pub sched_ss_max_repl: ::c_int, - } - - pub struct Dl_info { - pub dli_fname: *const ::c_char, - pub dli_fbase: *mut ::c_void, - pub dli_sname: *const ::c_char, - pub dli_saddr: *mut ::c_void, - } - - pub struct lconv { - pub decimal_point: *mut ::c_char, - pub thousands_sep: *mut ::c_char, - pub grouping: *mut ::c_char, - pub int_curr_symbol: *mut ::c_char, - pub currency_symbol: *mut ::c_char, - pub mon_decimal_point: *mut ::c_char, - pub mon_thousands_sep: *mut ::c_char, - pub mon_grouping: *mut ::c_char, - pub positive_sign: *mut ::c_char, - pub negative_sign: *mut ::c_char, - pub int_frac_digits: ::c_char, - pub frac_digits: ::c_char, - pub p_cs_precedes: ::c_char, - pub p_sep_by_space: ::c_char, - pub n_cs_precedes: ::c_char, - pub n_sep_by_space: ::c_char, - pub p_sign_posn: ::c_char, - pub n_sign_posn: ::c_char, - pub int_p_cs_precedes: ::c_char, - pub int_p_sep_by_space: ::c_char, - pub int_n_cs_precedes: ::c_char, - pub int_n_sep_by_space: ::c_char, - pub int_p_sign_posn: ::c_char, - pub int_n_sign_posn: ::c_char, - } - - pub struct sigevent { - pub sigev_value: ::sigval, - pub sigev_signo: ::c_int, - pub sigev_notify: ::c_int, - // Actually a union. We only expose sigev_notify_thread_id because it's - // the most useful member - pub sigev_notify_thread_id: ::c_int, - #[cfg(target_pointer_width = "64")] - __unused1: [::c_int; 11], - #[cfg(target_pointer_width = "32")] - __unused1: [::c_int; 12] - } - - pub struct in_pktinfo { - pub ipi_ifindex: ::c_int, - pub ipi_spec_dst: ::in_addr, - pub ipi_addr: ::in_addr, - } - - pub struct ifaddrs { - pub ifa_next: *mut ifaddrs, - pub ifa_name: *mut c_char, - pub ifa_flags: ::c_uint, - pub ifa_addr: *mut ::sockaddr, - pub ifa_netmask: *mut ::sockaddr, - pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union - pub ifa_data: *mut ::c_void - } - - pub struct in6_rtmsg { - rtmsg_dst: ::in6_addr, - rtmsg_src: ::in6_addr, - rtmsg_gateway: ::in6_addr, - rtmsg_type: u32, - rtmsg_dst_len: u16, - rtmsg_src_len: u16, - rtmsg_metric: u32, - rtmsg_info: ::c_ulong, - rtmsg_flags: u32, - rtmsg_ifindex: ::c_int, - } - - pub struct arpreq { - pub arp_pa: ::sockaddr, - pub arp_ha: ::sockaddr, - pub arp_flags: ::c_int, - pub arp_netmask: ::sockaddr, - pub arp_dev: [::c_char; 16], - } - - pub struct arpreq_old { - pub arp_pa: ::sockaddr, - pub arp_ha: ::sockaddr, - pub arp_flags: ::c_int, - pub arp_netmask: ::sockaddr, - } - - pub struct arphdr { - pub ar_hrd: u16, - pub ar_pro: u16, - pub ar_hln: u8, - pub ar_pln: u8, - pub ar_op: u16, - } - - pub struct mmsghdr { - pub msg_hdr: ::msghdr, - pub msg_len: ::c_uint, - } -} - -s_no_extra_traits!{ - #[cfg_attr( - any( - all( - target_arch = "x86", - not(target_env = "musl"), - not(target_os = "android")), - target_arch = "x86_64"), - repr(packed))] - pub struct epoll_event { - pub events: ::uint32_t, - pub u64: ::uint64_t, - } - - pub struct sockaddr_un { - pub sun_family: sa_family_t, - pub sun_path: [::c_char; 108] - } - - pub struct sockaddr_storage { - pub ss_family: sa_family_t, - __ss_align: ::size_t, - #[cfg(target_pointer_width = "32")] - __ss_pad2: [u8; 128 - 2 * 4], - #[cfg(target_pointer_width = "64")] - __ss_pad2: [u8; 128 - 2 * 8], - } - - pub struct utsname { - pub sysname: [::c_char; 65], - pub nodename: [::c_char; 65], - pub release: [::c_char; 65], - pub version: [::c_char; 65], - pub machine: [::c_char; 65], - pub domainname: [::c_char; 65] - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for epoll_event { - fn eq(&self, other: &epoll_event) -> bool { - self.events == other.events - && self.u64 == other.u64 - } - } - impl Eq for epoll_event {} - impl ::fmt::Debug for epoll_event { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - let events = self.events; - let u64 = self.u64; - f.debug_struct("epoll_event") - .field("events", &events) - .field("u64", &u64) - .finish() - } - } - impl ::hash::Hash for epoll_event { - fn hash(&self, state: &mut H) { - let events = self.events; - let u64 = self.u64; - events.hash(state); - u64.hash(state); - } - } - - impl PartialEq for sockaddr_un { - fn eq(&self, other: &sockaddr_un) -> bool { - self.sun_family == other.sun_family - && self - .sun_path - .iter() - .zip(other.sun_path.iter()) - .all(|(a, b)| a == b) - } - } - impl Eq for sockaddr_un {} - impl ::fmt::Debug for sockaddr_un { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_un") - .field("sun_family", &self.sun_family) - // FIXME: .field("sun_path", &self.sun_path) - .finish() - } - } - impl ::hash::Hash for sockaddr_un { - fn hash(&self, state: &mut H) { - self.sun_family.hash(state); - self.sun_path.hash(state); - } - } - - impl PartialEq for sockaddr_storage { - fn eq(&self, other: &sockaddr_storage) -> bool { - self.ss_family == other.ss_family - && self - .__ss_pad2 - .iter() - .zip(other.__ss_pad2.iter()) - .all(|(a, b)| a == b) - } - } - - impl Eq for sockaddr_storage {} - - impl ::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sockaddr_storage") - .field("ss_family", &self.ss_family) - .field("__ss_align", &self.__ss_align) - // FIXME: .field("__ss_pad2", &self.__ss_pad2) - .finish() - } - } - - impl ::hash::Hash for sockaddr_storage { - fn hash(&self, state: &mut H) { - self.ss_family.hash(state); - self.__ss_pad2.hash(state); - } - } - - impl PartialEq for utsname { - fn eq(&self, other: &utsname) -> bool { - self.sysname - .iter() - .zip(other.sysname.iter()) - .all(|(a, b)| a == b) - && self - .nodename - .iter() - .zip(other.nodename.iter()) - .all(|(a, b)| a == b) - && self - .release - .iter() - .zip(other.release.iter()) - .all(|(a, b)| a == b) - && self - .version - .iter() - .zip(other.version.iter()) - .all(|(a, b)| a == b) - && self - .machine - .iter() - .zip(other.machine.iter()) - .all(|(a, b)| a == b) - && self - .domainname - .iter() - .zip(other.domainname.iter()) - .all(|(a, b)| a == b) - } - } - - impl Eq for utsname {} - - impl ::fmt::Debug for utsname { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("utsname") - // FIXME: .field("sysname", &self.sysname) - // FIXME: .field("nodename", &self.nodename) - // FIXME: .field("release", &self.release) - // FIXME: .field("version", &self.version) - // FIXME: .field("machine", &self.machine) - // FIXME: .field("domainname", &self.domainname) - .finish() - } - } - - impl ::hash::Hash for utsname { - fn hash(&self, state: &mut H) { - self.sysname.hash(state); - self.nodename.hash(state); - self.release.hash(state); - self.version.hash(state); - self.machine.hash(state); - self.domainname.hash(state); - } - } - } -} - -// intentionally not public, only used for fd_set -cfg_if! { - if #[cfg(target_pointer_width = "32")] { - const ULONG_SIZE: usize = 32; - } else if #[cfg(target_pointer_width = "64")] { - const ULONG_SIZE: usize = 64; - } else { - // Unknown target_pointer_width - } -} - -pub const EXIT_FAILURE: ::c_int = 1; -pub const EXIT_SUCCESS: ::c_int = 0; -pub const RAND_MAX: ::c_int = 2147483647; -pub const EOF: ::c_int = -1; -pub const SEEK_SET: ::c_int = 0; -pub const SEEK_CUR: ::c_int = 1; -pub const SEEK_END: ::c_int = 2; -pub const _IOFBF: ::c_int = 0; -pub const _IONBF: ::c_int = 2; -pub const _IOLBF: ::c_int = 1; - -pub const F_DUPFD: ::c_int = 0; -pub const F_GETFD: ::c_int = 1; -pub const F_SETFD: ::c_int = 2; -pub const F_GETFL: ::c_int = 3; -pub const F_SETFL: ::c_int = 4; - -// Linux-specific fcntls -pub const F_SETLEASE: ::c_int = 1024; -pub const F_GETLEASE: ::c_int = 1025; -pub const F_NOTIFY: ::c_int = 1026; -pub const F_CANCELLK: ::c_int = 1029; -pub const F_DUPFD_CLOEXEC: ::c_int = 1030; -pub const F_SETPIPE_SZ: ::c_int = 1031; -pub const F_GETPIPE_SZ: ::c_int = 1032; -pub const F_ADD_SEALS: ::c_int = 1033; -pub const F_GET_SEALS: ::c_int = 1034; - -pub const F_SEAL_SEAL: ::c_int = 0x0001; -pub const F_SEAL_SHRINK: ::c_int = 0x0002; -pub const F_SEAL_GROW: ::c_int = 0x0004; -pub const F_SEAL_WRITE: ::c_int = 0x0008; - -// TODO(#235): Include file sealing fcntls once we have a way to verify them. - -pub const SIGTRAP: ::c_int = 5; - -pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0; -pub const PTHREAD_CREATE_DETACHED: ::c_int = 1; - -pub const CLOCK_REALTIME: ::clockid_t = 0; -pub const CLOCK_MONOTONIC: ::clockid_t = 1; -pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2; -pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3; -pub const CLOCK_MONOTONIC_RAW: ::clockid_t = 4; -pub const CLOCK_REALTIME_COARSE: ::clockid_t = 5; -pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6; -pub const CLOCK_BOOTTIME: ::clockid_t = 7; -pub const CLOCK_REALTIME_ALARM: ::clockid_t = 8; -pub const CLOCK_BOOTTIME_ALARM: ::clockid_t = 9; -// TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep -// 2014.) See also musl/mod.rs -// pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; -// pub const CLOCK_TAI: ::clockid_t = 11; -pub const TIMER_ABSTIME: ::c_int = 1; - -pub const RLIMIT_CPU: ::c_int = 0; -pub const RLIMIT_FSIZE: ::c_int = 1; -pub const RLIMIT_DATA: ::c_int = 2; -pub const RLIMIT_STACK: ::c_int = 3; -pub const RLIMIT_CORE: ::c_int = 4; -pub const RLIMIT_LOCKS: ::c_int = 10; -pub const RLIMIT_SIGPENDING: ::c_int = 11; -pub const RLIMIT_MSGQUEUE: ::c_int = 12; -pub const RLIMIT_NICE: ::c_int = 13; -pub const RLIMIT_RTPRIO: ::c_int = 14; - -pub const RUSAGE_SELF: ::c_int = 0; - -pub const O_RDONLY: ::c_int = 0; -pub const O_WRONLY: ::c_int = 1; -pub const O_RDWR: ::c_int = 2; - -pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC; - -pub const S_IFIFO: ::mode_t = 4096; -pub const S_IFCHR: ::mode_t = 8192; -pub const S_IFBLK: ::mode_t = 24576; -pub const S_IFDIR: ::mode_t = 16384; -pub const S_IFREG: ::mode_t = 32768; -pub const S_IFLNK: ::mode_t = 40960; -pub const S_IFSOCK: ::mode_t = 49152; -pub const S_IFMT: ::mode_t = 61440; -pub const S_IRWXU: ::mode_t = 448; -pub const S_IXUSR: ::mode_t = 64; -pub const S_IWUSR: ::mode_t = 128; -pub const S_IRUSR: ::mode_t = 256; -pub const S_IRWXG: ::mode_t = 56; -pub const S_IXGRP: ::mode_t = 8; -pub const S_IWGRP: ::mode_t = 16; -pub const S_IRGRP: ::mode_t = 32; -pub const S_IRWXO: ::mode_t = 7; -pub const S_IXOTH: ::mode_t = 1; -pub const S_IWOTH: ::mode_t = 2; -pub const S_IROTH: ::mode_t = 4; -pub const F_OK: ::c_int = 0; -pub const R_OK: ::c_int = 4; -pub const W_OK: ::c_int = 2; -pub const X_OK: ::c_int = 1; -pub const STDIN_FILENO: ::c_int = 0; -pub const STDOUT_FILENO: ::c_int = 1; -pub const STDERR_FILENO: ::c_int = 2; -pub const SIGHUP: ::c_int = 1; -pub const SIGINT: ::c_int = 2; -pub const SIGQUIT: ::c_int = 3; -pub const SIGILL: ::c_int = 4; -pub const SIGABRT: ::c_int = 6; -pub const SIGFPE: ::c_int = 8; -pub const SIGKILL: ::c_int = 9; -pub const SIGSEGV: ::c_int = 11; -pub const SIGPIPE: ::c_int = 13; -pub const SIGALRM: ::c_int = 14; -pub const SIGTERM: ::c_int = 15; - -pub const PROT_NONE: ::c_int = 0; -pub const PROT_READ: ::c_int = 1; -pub const PROT_WRITE: ::c_int = 2; -pub const PROT_EXEC: ::c_int = 4; - -pub const LC_CTYPE: ::c_int = 0; -pub const LC_NUMERIC: ::c_int = 1; -pub const LC_TIME: ::c_int = 2; -pub const LC_COLLATE: ::c_int = 3; -pub const LC_MONETARY: ::c_int = 4; -pub const LC_MESSAGES: ::c_int = 5; -pub const LC_ALL: ::c_int = 6; -pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE); -pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC); -pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME); -pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE); -pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY); -pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES); -// LC_ALL_MASK defined per platform - -pub const MAP_FILE: ::c_int = 0x0000; -pub const MAP_SHARED: ::c_int = 0x0001; -pub const MAP_PRIVATE: ::c_int = 0x0002; -pub const MAP_FIXED: ::c_int = 0x0010; - -pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; - -// MS_ flags for msync(2) -pub const MS_ASYNC: ::c_int = 0x0001; -pub const MS_INVALIDATE: ::c_int = 0x0002; -pub const MS_SYNC: ::c_int = 0x0004; - -// MS_ flags for mount(2) -pub const MS_RDONLY: ::c_ulong = 0x01; -pub const MS_NOSUID: ::c_ulong = 0x02; -pub const MS_NODEV: ::c_ulong = 0x04; -pub const MS_NOEXEC: ::c_ulong = 0x08; -pub const MS_SYNCHRONOUS: ::c_ulong = 0x10; -pub const MS_REMOUNT: ::c_ulong = 0x20; -pub const MS_MANDLOCK: ::c_ulong = 0x40; -pub const MS_DIRSYNC: ::c_ulong = 0x80; -pub const MS_NOATIME: ::c_ulong = 0x0400; -pub const MS_NODIRATIME: ::c_ulong = 0x0800; -pub const MS_BIND: ::c_ulong = 0x1000; -pub const MS_MOVE: ::c_ulong = 0x2000; -pub const MS_REC: ::c_ulong = 0x4000; -pub const MS_SILENT: ::c_ulong = 0x8000; -pub const MS_POSIXACL: ::c_ulong = 0x010000; -pub const MS_UNBINDABLE: ::c_ulong = 0x020000; -pub const MS_PRIVATE: ::c_ulong = 0x040000; -pub const MS_SLAVE: ::c_ulong = 0x080000; -pub const MS_SHARED: ::c_ulong = 0x100000; -pub const MS_RELATIME: ::c_ulong = 0x200000; -pub const MS_KERNMOUNT: ::c_ulong = 0x400000; -pub const MS_I_VERSION: ::c_ulong = 0x800000; -pub const MS_STRICTATIME: ::c_ulong = 0x1000000; -pub const MS_ACTIVE: ::c_ulong = 0x40000000; -pub const MS_NOUSER: ::c_ulong = 0x80000000; -pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000; -pub const MS_MGC_MSK: ::c_ulong = 0xffff0000; -pub const MS_RMT_MASK: ::c_ulong = 0x800051; - -pub const EPERM: ::c_int = 1; -pub const ENOENT: ::c_int = 2; -pub const ESRCH: ::c_int = 3; -pub const EINTR: ::c_int = 4; -pub const EIO: ::c_int = 5; -pub const ENXIO: ::c_int = 6; -pub const E2BIG: ::c_int = 7; -pub const ENOEXEC: ::c_int = 8; -pub const EBADF: ::c_int = 9; -pub const ECHILD: ::c_int = 10; -pub const EAGAIN: ::c_int = 11; -pub const ENOMEM: ::c_int = 12; -pub const EACCES: ::c_int = 13; -pub const EFAULT: ::c_int = 14; -pub const ENOTBLK: ::c_int = 15; -pub const EBUSY: ::c_int = 16; -pub const EEXIST: ::c_int = 17; -pub const EXDEV: ::c_int = 18; -pub const ENODEV: ::c_int = 19; -pub const ENOTDIR: ::c_int = 20; -pub const EISDIR: ::c_int = 21; -pub const EINVAL: ::c_int = 22; -pub const ENFILE: ::c_int = 23; -pub const EMFILE: ::c_int = 24; -pub const ENOTTY: ::c_int = 25; -pub const ETXTBSY: ::c_int = 26; -pub const EFBIG: ::c_int = 27; -pub const ENOSPC: ::c_int = 28; -pub const ESPIPE: ::c_int = 29; -pub const EROFS: ::c_int = 30; -pub const EMLINK: ::c_int = 31; -pub const EPIPE: ::c_int = 32; -pub const EDOM: ::c_int = 33; -pub const ERANGE: ::c_int = 34; -pub const EWOULDBLOCK: ::c_int = EAGAIN; - -pub const SCM_RIGHTS: ::c_int = 0x01; -pub const SCM_CREDENTIALS: ::c_int = 0x02; - -pub const PROT_GROWSDOWN: ::c_int = 0x1000000; -pub const PROT_GROWSUP: ::c_int = 0x2000000; - -pub const MAP_TYPE: ::c_int = 0x000f; - -pub const MADV_NORMAL: ::c_int = 0; -pub const MADV_RANDOM: ::c_int = 1; -pub const MADV_SEQUENTIAL: ::c_int = 2; -pub const MADV_WILLNEED: ::c_int = 3; -pub const MADV_DONTNEED: ::c_int = 4; -pub const MADV_FREE: ::c_int = 8; -pub const MADV_REMOVE: ::c_int = 9; -pub const MADV_DONTFORK: ::c_int = 10; -pub const MADV_DOFORK: ::c_int = 11; -pub const MADV_MERGEABLE: ::c_int = 12; -pub const MADV_UNMERGEABLE: ::c_int = 13; -pub const MADV_HUGEPAGE: ::c_int = 14; -pub const MADV_NOHUGEPAGE: ::c_int = 15; -pub const MADV_DONTDUMP: ::c_int = 16; -pub const MADV_DODUMP: ::c_int = 17; -pub const MADV_HWPOISON: ::c_int = 100; -pub const MADV_SOFT_OFFLINE: ::c_int = 101; - -pub const IFF_UP: ::c_int = 0x1; -pub const IFF_BROADCAST: ::c_int = 0x2; -pub const IFF_DEBUG: ::c_int = 0x4; -pub const IFF_LOOPBACK: ::c_int = 0x8; -pub const IFF_POINTOPOINT: ::c_int = 0x10; -pub const IFF_NOTRAILERS: ::c_int = 0x20; -pub const IFF_RUNNING: ::c_int = 0x40; -pub const IFF_NOARP: ::c_int = 0x80; -pub const IFF_PROMISC: ::c_int = 0x100; -pub const IFF_ALLMULTI: ::c_int = 0x200; -pub const IFF_MASTER: ::c_int = 0x400; -pub const IFF_SLAVE: ::c_int = 0x800; -pub const IFF_MULTICAST: ::c_int = 0x1000; -pub const IFF_PORTSEL: ::c_int = 0x2000; -pub const IFF_AUTOMEDIA: ::c_int = 0x4000; -pub const IFF_DYNAMIC: ::c_int = 0x8000; - -pub const SOL_IP: ::c_int = 0; -pub const SOL_TCP: ::c_int = 6; -pub const SOL_UDP: ::c_int = 17; -pub const SOL_IPV6: ::c_int = 41; -pub const SOL_ICMPV6: ::c_int = 58; -pub const SOL_RAW: ::c_int = 255; -pub const SOL_DECNET: ::c_int = 261; -pub const SOL_X25: ::c_int = 262; -pub const SOL_PACKET: ::c_int = 263; -pub const SOL_ATM: ::c_int = 264; -pub const SOL_AAL: ::c_int = 265; -pub const SOL_IRDA: ::c_int = 266; -pub const SOL_NETBEUI: ::c_int = 267; -pub const SOL_LLC: ::c_int = 268; -pub const SOL_DCCP: ::c_int = 269; -pub const SOL_NETLINK: ::c_int = 270; -pub const SOL_TIPC: ::c_int = 271; -pub const SOL_BLUETOOTH: ::c_int = 274; -pub const SOL_ALG: ::c_int = 279; - -pub const AF_UNSPEC: ::c_int = 0; -pub const AF_UNIX: ::c_int = 1; -pub const AF_LOCAL: ::c_int = 1; -pub const AF_INET: ::c_int = 2; -pub const AF_AX25: ::c_int = 3; -pub const AF_IPX: ::c_int = 4; -pub const AF_APPLETALK: ::c_int = 5; -pub const AF_NETROM: ::c_int = 6; -pub const AF_BRIDGE: ::c_int = 7; -pub const AF_ATMPVC: ::c_int = 8; -pub const AF_X25: ::c_int = 9; -pub const AF_INET6: ::c_int = 10; -pub const AF_ROSE: ::c_int = 11; -pub const AF_DECnet: ::c_int = 12; -pub const AF_NETBEUI: ::c_int = 13; -pub const AF_SECURITY: ::c_int = 14; -pub const AF_KEY: ::c_int = 15; -pub const AF_NETLINK: ::c_int = 16; -pub const AF_ROUTE: ::c_int = AF_NETLINK; -pub const AF_PACKET: ::c_int = 17; -pub const AF_ASH: ::c_int = 18; -pub const AF_ECONET: ::c_int = 19; -pub const AF_ATMSVC: ::c_int = 20; -pub const AF_RDS: ::c_int = 21; -pub const AF_SNA: ::c_int = 22; -pub const AF_IRDA: ::c_int = 23; -pub const AF_PPPOX: ::c_int = 24; -pub const AF_WANPIPE: ::c_int = 25; -pub const AF_LLC: ::c_int = 26; -pub const AF_CAN: ::c_int = 29; -pub const AF_TIPC: ::c_int = 30; -pub const AF_BLUETOOTH: ::c_int = 31; -pub const AF_IUCV: ::c_int = 32; -pub const AF_RXRPC: ::c_int = 33; -pub const AF_ISDN: ::c_int = 34; -pub const AF_PHONET: ::c_int = 35; -pub const AF_IEEE802154: ::c_int = 36; -pub const AF_CAIF: ::c_int = 37; -pub const AF_ALG: ::c_int = 38; - -pub const PF_UNSPEC: ::c_int = AF_UNSPEC; -pub const PF_UNIX: ::c_int = AF_UNIX; -pub const PF_LOCAL: ::c_int = AF_LOCAL; -pub const PF_INET: ::c_int = AF_INET; -pub const PF_AX25: ::c_int = AF_AX25; -pub const PF_IPX: ::c_int = AF_IPX; -pub const PF_APPLETALK: ::c_int = AF_APPLETALK; -pub const PF_NETROM: ::c_int = AF_NETROM; -pub const PF_BRIDGE: ::c_int = AF_BRIDGE; -pub const PF_ATMPVC: ::c_int = AF_ATMPVC; -pub const PF_X25: ::c_int = AF_X25; -pub const PF_INET6: ::c_int = AF_INET6; -pub const PF_ROSE: ::c_int = AF_ROSE; -pub const PF_DECnet: ::c_int = AF_DECnet; -pub const PF_NETBEUI: ::c_int = AF_NETBEUI; -pub const PF_SECURITY: ::c_int = AF_SECURITY; -pub const PF_KEY: ::c_int = AF_KEY; -pub const PF_NETLINK: ::c_int = AF_NETLINK; -pub const PF_ROUTE: ::c_int = AF_ROUTE; -pub const PF_PACKET: ::c_int = AF_PACKET; -pub const PF_ASH: ::c_int = AF_ASH; -pub const PF_ECONET: ::c_int = AF_ECONET; -pub const PF_ATMSVC: ::c_int = AF_ATMSVC; -pub const PF_RDS: ::c_int = AF_RDS; -pub const PF_SNA: ::c_int = AF_SNA; -pub const PF_IRDA: ::c_int = AF_IRDA; -pub const PF_PPPOX: ::c_int = AF_PPPOX; -pub const PF_WANPIPE: ::c_int = AF_WANPIPE; -pub const PF_LLC: ::c_int = AF_LLC; -pub const PF_CAN: ::c_int = AF_CAN; -pub const PF_TIPC: ::c_int = AF_TIPC; -pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH; -pub const PF_IUCV: ::c_int = AF_IUCV; -pub const PF_RXRPC: ::c_int = AF_RXRPC; -pub const PF_ISDN: ::c_int = AF_ISDN; -pub const PF_PHONET: ::c_int = AF_PHONET; -pub const PF_IEEE802154: ::c_int = AF_IEEE802154; -pub const PF_CAIF: ::c_int = AF_CAIF; -pub const PF_ALG: ::c_int = AF_ALG; - -pub const SOMAXCONN: ::c_int = 128; - -pub const MSG_OOB: ::c_int = 1; -pub const MSG_PEEK: ::c_int = 2; -pub const MSG_DONTROUTE: ::c_int = 4; -pub const MSG_CTRUNC: ::c_int = 8; -pub const MSG_TRUNC: ::c_int = 0x20; -pub const MSG_DONTWAIT: ::c_int = 0x40; -pub const MSG_EOR: ::c_int = 0x80; -pub const MSG_WAITALL: ::c_int = 0x100; -pub const MSG_FIN: ::c_int = 0x200; -pub const MSG_SYN: ::c_int = 0x400; -pub const MSG_CONFIRM: ::c_int = 0x800; -pub const MSG_RST: ::c_int = 0x1000; -pub const MSG_ERRQUEUE: ::c_int = 0x2000; -pub const MSG_NOSIGNAL: ::c_int = 0x4000; -pub const MSG_MORE: ::c_int = 0x8000; -pub const MSG_WAITFORONE: ::c_int = 0x10000; -pub const MSG_FASTOPEN: ::c_int = 0x20000000; -pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000; - -pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP; - -pub const SOCK_RAW: ::c_int = 3; -pub const SOCK_RDM: ::c_int = 4; -pub const IP_MULTICAST_IF: ::c_int = 32; -pub const IP_MULTICAST_TTL: ::c_int = 33; -pub const IP_MULTICAST_LOOP: ::c_int = 34; -pub const IP_TOS: ::c_int = 1; -pub const IP_TTL: ::c_int = 2; -pub const IP_HDRINCL: ::c_int = 3; -pub const IP_PKTINFO: ::c_int = 8; -pub const IP_RECVTOS: ::c_int = 13; -pub const IP_ADD_MEMBERSHIP: ::c_int = 35; -pub const IP_DROP_MEMBERSHIP: ::c_int = 36; -pub const IP_TRANSPARENT: ::c_int = 19; -pub const IPV6_UNICAST_HOPS: ::c_int = 16; -pub const IPV6_MULTICAST_IF: ::c_int = 17; -pub const IPV6_MULTICAST_HOPS: ::c_int = 18; -pub const IPV6_MULTICAST_LOOP: ::c_int = 19; -pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20; -pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21; -pub const IPV6_V6ONLY: ::c_int = 26; -pub const IPV6_RECVPKTINFO: ::c_int = 49; -pub const IPV6_PKTINFO: ::c_int = 50; -pub const IPV6_RECVTCLASS: ::c_int = 66; -pub const IPV6_TCLASS: ::c_int = 67; - -pub const TCP_NODELAY: ::c_int = 1; -pub const TCP_MAXSEG: ::c_int = 2; -pub const TCP_CORK: ::c_int = 3; -pub const TCP_KEEPIDLE: ::c_int = 4; -pub const TCP_KEEPINTVL: ::c_int = 5; -pub const TCP_KEEPCNT: ::c_int = 6; -pub const TCP_SYNCNT: ::c_int = 7; -pub const TCP_LINGER2: ::c_int = 8; -pub const TCP_DEFER_ACCEPT: ::c_int = 9; -pub const TCP_WINDOW_CLAMP: ::c_int = 10; -pub const TCP_INFO: ::c_int = 11; -pub const TCP_QUICKACK: ::c_int = 12; -pub const TCP_CONGESTION: ::c_int = 13; - -pub const SO_DEBUG: ::c_int = 1; - -pub const SHUT_RD: ::c_int = 0; -pub const SHUT_WR: ::c_int = 1; -pub const SHUT_RDWR: ::c_int = 2; - -pub const LOCK_SH: ::c_int = 1; -pub const LOCK_EX: ::c_int = 2; -pub const LOCK_NB: ::c_int = 4; -pub const LOCK_UN: ::c_int = 8; - -pub const SS_ONSTACK: ::c_int = 1; -pub const SS_DISABLE: ::c_int = 2; - -pub const PATH_MAX: ::c_int = 4096; - -pub const FD_SETSIZE: usize = 1024; - -pub const EPOLLIN: ::c_int = 0x1; -pub const EPOLLPRI: ::c_int = 0x2; -pub const EPOLLOUT: ::c_int = 0x4; -pub const EPOLLRDNORM: ::c_int = 0x40; -pub const EPOLLRDBAND: ::c_int = 0x80; -pub const EPOLLWRNORM: ::c_int = 0x100; -pub const EPOLLWRBAND: ::c_int = 0x200; -pub const EPOLLMSG: ::c_int = 0x400; -pub const EPOLLERR: ::c_int = 0x8; -pub const EPOLLHUP: ::c_int = 0x10; -pub const EPOLLET: ::c_int = 0x80000000; - -pub const EPOLL_CTL_ADD: ::c_int = 1; -pub const EPOLL_CTL_MOD: ::c_int = 3; -pub const EPOLL_CTL_DEL: ::c_int = 2; - -pub const MNT_DETACH: ::c_int = 0x2; -pub const MNT_EXPIRE: ::c_int = 0x4; - -pub const Q_GETFMT: ::c_int = 0x800004; -pub const Q_GETINFO: ::c_int = 0x800005; -pub const Q_SETINFO: ::c_int = 0x800006; -pub const QIF_BLIMITS: ::uint32_t = 1; -pub const QIF_SPACE: ::uint32_t = 2; -pub const QIF_ILIMITS: ::uint32_t = 4; -pub const QIF_INODES: ::uint32_t = 8; -pub const QIF_BTIME: ::uint32_t = 16; -pub const QIF_ITIME: ::uint32_t = 32; -pub const QIF_LIMITS: ::uint32_t = 5; -pub const QIF_USAGE: ::uint32_t = 10; -pub const QIF_TIMES: ::uint32_t = 48; -pub const QIF_ALL: ::uint32_t = 63; - -pub const MNT_FORCE: ::c_int = 0x1; - -pub const Q_SYNC: ::c_int = 0x800001; -pub const Q_QUOTAON: ::c_int = 0x800002; -pub const Q_QUOTAOFF: ::c_int = 0x800003; -pub const Q_GETQUOTA: ::c_int = 0x800007; -pub const Q_SETQUOTA: ::c_int = 0x800008; - -pub const TCIOFF: ::c_int = 2; -pub const TCION: ::c_int = 3; -pub const TCOOFF: ::c_int = 0; -pub const TCOON: ::c_int = 1; -pub const TCIFLUSH: ::c_int = 0; -pub const TCOFLUSH: ::c_int = 1; -pub const TCIOFLUSH: ::c_int = 2; -pub const NL0: ::c_int = 0x00000000; -pub const NL1: ::c_int = 0x00000100; -pub const TAB0: ::c_int = 0x00000000; -pub const CR0: ::c_int = 0x00000000; -pub const FF0: ::c_int = 0x00000000; -pub const BS0: ::c_int = 0x00000000; -pub const VT0: ::c_int = 0x00000000; -pub const VERASE: usize = 2; -pub const VKILL: usize = 3; -pub const VINTR: usize = 0; -pub const VQUIT: usize = 1; -pub const VLNEXT: usize = 15; -pub const IGNBRK: ::tcflag_t = 0x00000001; -pub const BRKINT: ::tcflag_t = 0x00000002; -pub const IGNPAR: ::tcflag_t = 0x00000004; -pub const PARMRK: ::tcflag_t = 0x00000008; -pub const INPCK: ::tcflag_t = 0x00000010; -pub const ISTRIP: ::tcflag_t = 0x00000020; -pub const INLCR: ::tcflag_t = 0x00000040; -pub const IGNCR: ::tcflag_t = 0x00000080; -pub const ICRNL: ::tcflag_t = 0x00000100; -pub const IXANY: ::tcflag_t = 0x00000800; -pub const IMAXBEL: ::tcflag_t = 0x00002000; -pub const OPOST: ::tcflag_t = 0x1; -pub const CS5: ::tcflag_t = 0x00000000; -pub const CRTSCTS: ::tcflag_t = 0x80000000; -pub const ECHO: ::tcflag_t = 0x00000008; -pub const OCRNL: ::tcflag_t = 0o000010; -pub const ONOCR: ::tcflag_t = 0o000020; -pub const ONLRET: ::tcflag_t = 0o000040; -pub const OFILL: ::tcflag_t = 0o000100; -pub const OFDEL: ::tcflag_t = 0o000200; - -pub const CLONE_VM: ::c_int = 0x100; -pub const CLONE_FS: ::c_int = 0x200; -pub const CLONE_FILES: ::c_int = 0x400; -pub const CLONE_SIGHAND: ::c_int = 0x800; -pub const CLONE_PTRACE: ::c_int = 0x2000; -pub const CLONE_VFORK: ::c_int = 0x4000; -pub const CLONE_PARENT: ::c_int = 0x8000; -pub const CLONE_THREAD: ::c_int = 0x10000; -pub const CLONE_NEWNS: ::c_int = 0x20000; -pub const CLONE_SYSVSEM: ::c_int = 0x40000; -pub const CLONE_SETTLS: ::c_int = 0x80000; -pub const CLONE_PARENT_SETTID: ::c_int = 0x100000; -pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000; -pub const CLONE_DETACHED: ::c_int = 0x400000; -pub const CLONE_UNTRACED: ::c_int = 0x800000; -pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000; -pub const CLONE_NEWUTS: ::c_int = 0x04000000; -pub const CLONE_NEWIPC: ::c_int = 0x08000000; -pub const CLONE_NEWUSER: ::c_int = 0x10000000; -pub const CLONE_NEWPID: ::c_int = 0x20000000; -pub const CLONE_NEWNET: ::c_int = 0x40000000; -pub const CLONE_IO: ::c_int = 0x80000000; -pub const CLONE_NEWCGROUP: ::c_int = 0x02000000; - -pub const WNOHANG: ::c_int = 0x00000001; -pub const WUNTRACED: ::c_int = 0x00000002; -pub const WSTOPPED: ::c_int = WUNTRACED; -pub const WEXITED: ::c_int = 0x00000004; -pub const WCONTINUED: ::c_int = 0x00000008; -pub const WNOWAIT: ::c_int = 0x01000000; - -// Options set using PTRACE_SETOPTIONS. -pub const PTRACE_O_TRACESYSGOOD: ::c_int = 0x00000001; -pub const PTRACE_O_TRACEFORK: ::c_int = 0x00000002; -pub const PTRACE_O_TRACEVFORK: ::c_int = 0x00000004; -pub const PTRACE_O_TRACECLONE: ::c_int = 0x00000008; -pub const PTRACE_O_TRACEEXEC: ::c_int = 0x00000010; -pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 0x00000020; -pub const PTRACE_O_TRACEEXIT: ::c_int = 0x00000040; -pub const PTRACE_O_TRACESECCOMP: ::c_int = 0x00000080; -pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000; -pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000; -pub const PTRACE_O_MASK: ::c_int = 0x003000ff; - -// Wait extended result codes for the above trace options. -pub const PTRACE_EVENT_FORK: ::c_int = 1; -pub const PTRACE_EVENT_VFORK: ::c_int = 2; -pub const PTRACE_EVENT_CLONE: ::c_int = 3; -pub const PTRACE_EVENT_EXEC: ::c_int = 4; -pub const PTRACE_EVENT_VFORK_DONE: ::c_int = 5; -pub const PTRACE_EVENT_EXIT: ::c_int = 6; -pub const PTRACE_EVENT_SECCOMP: ::c_int = 7; -// PTRACE_EVENT_STOP was added to glibc in 2.26 -// pub const PTRACE_EVENT_STOP: ::c_int = 128; - -pub const __WNOTHREAD: ::c_int = 0x20000000; -pub const __WALL: ::c_int = 0x40000000; -pub const __WCLONE: ::c_int = 0x80000000; - -pub const SPLICE_F_MOVE: ::c_uint = 0x01; -pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02; -pub const SPLICE_F_MORE: ::c_uint = 0x04; -pub const SPLICE_F_GIFT: ::c_uint = 0x08; - -pub const RTLD_LOCAL: ::c_int = 0; -pub const RTLD_LAZY: ::c_int = 1; - -pub const POSIX_FADV_NORMAL: ::c_int = 0; -pub const POSIX_FADV_RANDOM: ::c_int = 1; -pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2; -pub const POSIX_FADV_WILLNEED: ::c_int = 3; - -pub const AT_FDCWD: ::c_int = -100; -pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100; -pub const AT_REMOVEDIR: ::c_int = 0x200; -pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400; -pub const AT_NO_AUTOMOUNT: ::c_int = 0x800; -pub const AT_EMPTY_PATH: ::c_int = 0x1000; - -pub const LOG_CRON: ::c_int = 9 << 3; -pub const LOG_AUTHPRIV: ::c_int = 10 << 3; -pub const LOG_FTP: ::c_int = 11 << 3; -pub const LOG_PERROR: ::c_int = 0x20; - -pub const PIPE_BUF: usize = 4096; - -pub const SI_LOAD_SHIFT: ::c_uint = 16; - -pub const SIGEV_SIGNAL: ::c_int = 0; -pub const SIGEV_NONE: ::c_int = 1; -pub const SIGEV_THREAD: ::c_int = 2; - -pub const P_ALL: idtype_t = 0; -pub const P_PID: idtype_t = 1; -pub const P_PGID: idtype_t = 2; - -pub const UTIME_OMIT: c_long = 1073741822; -pub const UTIME_NOW: c_long = 1073741823; - -pub const POLLIN: ::c_short = 0x1; -pub const POLLPRI: ::c_short = 0x2; -pub const POLLOUT: ::c_short = 0x4; -pub const POLLERR: ::c_short = 0x8; -pub const POLLHUP: ::c_short = 0x10; -pub const POLLNVAL: ::c_short = 0x20; -pub const POLLRDNORM: ::c_short = 0x040; -pub const POLLRDBAND: ::c_short = 0x080; - -pub const IPTOS_LOWDELAY: u8 = 0x10; -pub const IPTOS_THROUGHPUT: u8 = 0x08; -pub const IPTOS_RELIABILITY: u8 = 0x04; -pub const IPTOS_MINCOST: u8 = 0x02; - -pub const IPTOS_PREC_NETCONTROL: u8 = 0xe0; -pub const IPTOS_PREC_INTERNETCONTROL: u8 = 0xc0; -pub const IPTOS_PREC_CRITIC_ECP: u8 = 0xa0; -pub const IPTOS_PREC_FLASHOVERRIDE: u8 = 0x80; -pub const IPTOS_PREC_FLASH: u8 = 0x60; -pub const IPTOS_PREC_IMMEDIATE: u8 = 0x40; -pub const IPTOS_PREC_PRIORITY: u8 = 0x20; -pub const IPTOS_PREC_ROUTINE: u8 = 0x00; - -pub const IPTOS_ECN_MASK: u8 = 0x03; -pub const IPTOS_ECN_ECT1: u8 = 0x01; -pub const IPTOS_ECN_ECT0: u8 = 0x02; -pub const IPTOS_ECN_CE: u8 = 0x03; - -pub const IPOPT_COPY: u8 = 0x80; -pub const IPOPT_CLASS_MASK: u8 = 0x60; -pub const IPOPT_NUMBER_MASK: u8 = 0x1f; - -pub const IPOPT_CONTROL: u8 = 0x00; -pub const IPOPT_RESERVED1: u8 = 0x20; -pub const IPOPT_MEASUREMENT: u8 = 0x40; -pub const IPOPT_RESERVED2: u8 = 0x60; -pub const IPOPT_END: u8 = (0 |IPOPT_CONTROL); -pub const IPOPT_NOOP: u8 = (1 |IPOPT_CONTROL); -pub const IPOPT_SEC: u8 = (2 |IPOPT_CONTROL|IPOPT_COPY); -pub const IPOPT_LSRR: u8 = (3 |IPOPT_CONTROL|IPOPT_COPY); -pub const IPOPT_TIMESTAMP: u8 = (4 |IPOPT_MEASUREMENT); -pub const IPOPT_RR: u8 = (7 |IPOPT_CONTROL); -pub const IPOPT_SID: u8 = (8 |IPOPT_CONTROL|IPOPT_COPY); -pub const IPOPT_SSRR: u8 = (9 |IPOPT_CONTROL|IPOPT_COPY); -pub const IPOPT_RA: u8 = (20|IPOPT_CONTROL|IPOPT_COPY); -pub const IPVERSION: u8 = 4; -pub const MAXTTL: u8 = 255; -pub const IPDEFTTL: u8 = 64; -pub const IPOPT_OPTVAL: u8 = 0; -pub const IPOPT_OLEN: u8 = 1; -pub const IPOPT_OFFSET: u8 = 2; -pub const IPOPT_MINOFF: u8 = 4; -pub const MAX_IPOPTLEN: u8 = 40; -pub const IPOPT_NOP: u8 = IPOPT_NOOP; -pub const IPOPT_EOL: u8 = IPOPT_END; -pub const IPOPT_TS: u8 = IPOPT_TIMESTAMP; -pub const IPOPT_TS_TSONLY: u8 = 0; -pub const IPOPT_TS_TSANDADDR: u8 = 1; -pub const IPOPT_TS_PRESPEC: u8 = 3; - -pub const ARPOP_RREQUEST: u16 = 3; -pub const ARPOP_RREPLY: u16 = 4; -pub const ARPOP_InREQUEST: u16 = 8; -pub const ARPOP_InREPLY: u16 = 9; -pub const ARPOP_NAK: u16 = 10; - -pub const ATF_NETMASK: ::c_int = 0x20; -pub const ATF_DONTPUB: ::c_int = 0x40; - -pub const ARPHRD_NETROM: u16 = 0; -pub const ARPHRD_ETHER: u16 = 1; -pub const ARPHRD_EETHER: u16 = 2; -pub const ARPHRD_AX25: u16 = 3; -pub const ARPHRD_PRONET: u16 = 4; -pub const ARPHRD_CHAOS: u16 = 5; -pub const ARPHRD_IEEE802: u16 = 6; -pub const ARPHRD_ARCNET: u16 = 7; -pub const ARPHRD_APPLETLK: u16 = 8; -pub const ARPHRD_DLCI: u16 = 15; -pub const ARPHRD_ATM: u16 = 19; -pub const ARPHRD_METRICOM: u16 = 23; -pub const ARPHRD_IEEE1394: u16 = 24; -pub const ARPHRD_EUI64: u16 = 27; -pub const ARPHRD_INFINIBAND: u16 = 32; - -pub const ARPHRD_SLIP: u16 = 256; -pub const ARPHRD_CSLIP: u16 = 257; -pub const ARPHRD_SLIP6: u16 = 258; -pub const ARPHRD_CSLIP6: u16 = 259; -pub const ARPHRD_RSRVD: u16 = 260; -pub const ARPHRD_ADAPT: u16 = 264; -pub const ARPHRD_ROSE: u16 = 270; -pub const ARPHRD_X25: u16 = 271; -pub const ARPHRD_HWX25: u16 = 272; -pub const ARPHRD_PPP: u16 = 512; -pub const ARPHRD_CISCO: u16 = 513; -pub const ARPHRD_HDLC: u16 = ARPHRD_CISCO; -pub const ARPHRD_LAPB: u16 = 516; -pub const ARPHRD_DDCMP: u16 = 517; -pub const ARPHRD_RAWHDLC: u16 = 518; - -pub const ARPHRD_TUNNEL: u16 = 768; -pub const ARPHRD_TUNNEL6: u16 = 769; -pub const ARPHRD_FRAD: u16 = 770; -pub const ARPHRD_SKIP: u16 = 771; -pub const ARPHRD_LOOPBACK: u16 = 772; -pub const ARPHRD_LOCALTLK: u16 = 773; -pub const ARPHRD_FDDI: u16 = 774; -pub const ARPHRD_BIF: u16 = 775; -pub const ARPHRD_SIT: u16 = 776; -pub const ARPHRD_IPDDP: u16 = 777; -pub const ARPHRD_IPGRE: u16 = 778; -pub const ARPHRD_PIMREG: u16 = 779; -pub const ARPHRD_HIPPI: u16 = 780; -pub const ARPHRD_ASH: u16 = 781; -pub const ARPHRD_ECONET: u16 = 782; -pub const ARPHRD_IRDA: u16 = 783; -pub const ARPHRD_FCPP: u16 = 784; -pub const ARPHRD_FCAL: u16 = 785; -pub const ARPHRD_FCPL: u16 = 786; -pub const ARPHRD_FCFABRIC: u16 = 787; -pub const ARPHRD_IEEE802_TR: u16 = 800; -pub const ARPHRD_IEEE80211: u16 = 801; -pub const ARPHRD_IEEE80211_PRISM: u16 = 802; -pub const ARPHRD_IEEE80211_RADIOTAP: u16 = 803; -pub const ARPHRD_IEEE802154: u16 = 804; - -pub const ARPHRD_VOID: u16 = 0xFFFF; -pub const ARPHRD_NONE: u16 = 0xFFFE; - -fn CMSG_ALIGN(len: usize) -> usize { - len + ::mem::size_of::() - 1 & !(::mem::size_of::() - 1) -} - -f! { - pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { - if (*mhdr).msg_controllen as usize >= ::mem::size_of::() { - (*mhdr).msg_control as *mut cmsghdr - } else { - 0 as *mut cmsghdr - } - } - - pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut ::c_uchar { - cmsg.offset(1) as *mut ::c_uchar - } - - pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { - (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::())) - as ::c_uint - } - - pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint { - CMSG_ALIGN(::mem::size_of::()) as ::c_uint + length - } - - pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { - let fd = fd as usize; - let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; - (*set).fds_bits[fd / size] &= !(1 << (fd % size)); - return - } - - pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool { - let fd = fd as usize; - let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; - return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0 - } - - pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { - let fd = fd as usize; - let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; - (*set).fds_bits[fd / size] |= 1 << (fd % size); - return - } - - pub fn FD_ZERO(set: *mut fd_set) -> () { - for slot in (*set).fds_bits.iter_mut() { - *slot = 0; - } - } - - pub fn WIFSTOPPED(status: ::c_int) -> bool { - (status & 0xff) == 0x7f - } - - pub fn WSTOPSIG(status: ::c_int) -> ::c_int { - (status >> 8) & 0xff - } - - pub fn WIFCONTINUED(status: ::c_int) -> bool { - status == 0xffff - } - - pub fn WIFSIGNALED(status: ::c_int) -> bool { - ((status & 0x7f) + 1) as i8 >= 2 - } - - pub fn WTERMSIG(status: ::c_int) -> ::c_int { - status & 0x7f - } - - pub fn WIFEXITED(status: ::c_int) -> bool { - (status & 0x7f) == 0 - } - - pub fn WEXITSTATUS(status: ::c_int) -> ::c_int { - (status >> 8) & 0xff - } - - pub fn WCOREDUMP(status: ::c_int) -> bool { - (status & 0x80) != 0 - } - - pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int { - (cmd << 8) | (type_ & 0x00ff) - } - - pub fn IPOPT_COPIED(o: u8) -> u8 { - o & IPOPT_COPY - } - - pub fn IPOPT_CLASS(o: u8) -> u8 { - o & IPOPT_CLASS_MASK - } - - pub fn IPOPT_NUMBER(o: u8) -> u8 { - o & IPOPT_NUMBER_MASK - } - - pub fn IPTOS_ECN(x: u8) -> u8 { - x & ::IPTOS_ECN_MASK - } -} - -extern { - pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; - pub fn sem_init(sem: *mut sem_t, - pshared: ::c_int, - value: ::c_uint) - -> ::c_int; - - pub fn fdatasync(fd: ::c_int) -> ::c_int; - pub fn mincore(addr: *mut ::c_void, len: ::size_t, - vec: *mut ::c_uchar) -> ::c_int; - pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; - pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; - pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int; - pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; - - pub fn pthread_getattr_np(native: ::pthread_t, - attr: *mut ::pthread_attr_t) -> ::c_int; - pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t, - stackaddr: *mut *mut ::c_void, - stacksize: *mut ::size_t) -> ::c_int; - pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; - pub fn setgroups(ngroups: ::size_t, - ptr: *const ::gid_t) -> ::c_int; - pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; - pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; - pub fn statfs64(path: *const ::c_char, buf: *mut statfs64) -> ::c_int; - pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; - pub fn fstatfs64(fd: ::c_int, buf: *mut statfs64) -> ::c_int; - pub fn statvfs64(path: *const ::c_char, buf: *mut statvfs64) -> ::c_int; - pub fn fstatvfs64(fd: ::c_int, buf: *mut statvfs64) -> ::c_int; - pub fn memrchr(cx: *const ::c_void, - c: ::c_int, - n: ::size_t) -> *mut ::c_void; - - pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, - advise: ::c_int) -> ::c_int; - pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; - pub fn utimensat(dirfd: ::c_int, path: *const ::c_char, - times: *const ::timespec, flag: ::c_int) -> ::c_int; - pub fn duplocale(base: ::locale_t) -> ::locale_t; - pub fn freelocale(loc: ::locale_t); - pub fn newlocale(mask: ::c_int, - locale: *const ::c_char, - base: ::locale_t) -> ::locale_t; - pub fn uselocale(loc: ::locale_t) -> ::locale_t; - pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int; - pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int; - pub fn fstatat64(dirfd: ::c_int, pathname: *const c_char, - buf: *mut stat64, flags: ::c_int) -> ::c_int; - pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int; - pub fn getrlimit64(resource: ::c_int, rlim: *mut rlimit64) -> ::c_int; - pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t; - pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int; - pub fn mmap64(addr: *mut ::c_void, - len: ::size_t, - prot: ::c_int, - flags: ::c_int, - fd: ::c_int, - offset: off64_t) - -> *mut ::c_void; - pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; - pub fn openat64(fd: ::c_int, - path: *const c_char, - oflag: ::c_int, ...) -> ::c_int; - pub fn pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, - offset: off64_t) -> ::ssize_t; - pub fn preadv64(fd: ::c_int, - iov: *const ::iovec, - iovcnt: ::c_int, - offset: ::off64_t) -> ::ssize_t; - pub fn pwrite64(fd: ::c_int, buf: *const ::c_void, count: ::size_t, - offset: off64_t) -> ::ssize_t; - pub fn pwritev64(fd: ::c_int, - iov: *const ::iovec, - iovcnt: ::c_int, - offset: ::off64_t) -> ::ssize_t; - pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64; - pub fn readdir64_r(dirp: *mut ::DIR, entry: *mut ::dirent64, - result: *mut *mut ::dirent64) -> ::c_int; - pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int; - pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int; - pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int; - - pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, - mode: ::mode_t, dev: dev_t) -> ::c_int; - pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t, - clock_id: *mut clockid_t) -> ::c_int; - pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t, - clock_id: ::clockid_t) -> ::c_int; - pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, - pshared: ::c_int) -> ::c_int; - pub fn accept4(fd: ::c_int, addr: *mut ::sockaddr, len: *mut ::socklen_t, - flg: ::c_int) -> ::c_int; - pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, - pshared: ::c_int) -> ::c_int; - pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t, - val: *mut ::c_int) -> ::c_int; - pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, - val: ::c_int) -> ::c_int; - pub fn ptsname_r(fd: ::c_int, - buf: *mut ::c_char, - buflen: ::size_t) -> ::c_int; - pub fn clearenv() -> ::c_int; - pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, - options: ::c_int) -> ::c_int; - pub fn setreuid(ruid: ::uid_t, euid: ::uid_t) -> ::c_int; - pub fn setregid(rgid: ::gid_t, egid: ::gid_t) -> ::c_int; - pub fn getresuid(ruid: *mut ::uid_t, euid: *mut ::uid_t, - suid: *mut ::uid_t) -> ::c_int; - pub fn getresgid(rgid: *mut ::gid_t, egid: *mut ::gid_t, - sgid: *mut ::gid_t) -> ::c_int; - pub fn acct(filename: *const ::c_char) -> ::c_int; - pub fn brk(addr: *mut ::c_void) -> ::c_int; - pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void; - pub fn vfork() -> ::pid_t; - pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int; - pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int; - pub fn wait4(pid: ::pid_t, status: *mut ::c_int, options: ::c_int, - rusage: *mut ::rusage) -> ::pid_t; - pub fn openpty(amaster: *mut ::c_int, - aslave: *mut ::c_int, - name: *mut ::c_char, - termp: *const termios, - winp: *const ::winsize) -> ::c_int; - pub fn forkpty(amaster: *mut ::c_int, - name: *mut ::c_char, - termp: *const termios, - winp: *const ::winsize) -> ::pid_t; - pub fn login_tty(fd: ::c_int) -> ::c_int; - pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char, - envp: *const *const ::c_char) -> ::c_int; - pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char, - envp: *const *const ::c_char) - -> ::c_int; - pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; - pub fn freeifaddrs(ifa: *mut ::ifaddrs); - pub fn bind(socket: ::c_int, address: *const ::sockaddr, - address_len: ::socklen_t) -> ::c_int; - - pub fn writev(fd: ::c_int, - iov: *const ::iovec, - iovcnt: ::c_int) -> ::ssize_t; - pub fn readv(fd: ::c_int, - iov: *const ::iovec, - iovcnt: ::c_int) -> ::ssize_t; - - pub fn sendmsg(fd: ::c_int, - msg: *const ::msghdr, - flags: ::c_int) -> ::ssize_t; - pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) - -> ::ssize_t; - pub fn uname(buf: *mut ::utsname) -> ::c_int; -} - -cfg_if! { - if #[cfg(target_os = "emscripten")] { - mod emscripten; - pub use self::emscripten::*; - } else if #[cfg(target_os = "linux")] { - mod linux; - pub use self::linux::*; - } else if #[cfg(target_os = "android")] { - mod android; - pub use self::android::*; - } else { - // Unknown target_os - } -} diff -Nru cargo-0.35.0/vendor/libc/src/unix/redox/mod.rs cargo-0.37.0/vendor/libc/src/unix/redox/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/redox/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/redox/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,597 @@ +pub type c_char = i8; +pub type c_long = i64; +pub type c_ulong = u64; +pub type wchar_t = i32; + +pub type blkcnt_t = ::c_ulong; +pub type blksize_t = ::c_long; +pub type clock_t = ::c_long; +pub type clockid_t = ::c_int; +pub type dev_t = ::c_long; +pub type fsblkcnt_t = ::c_ulong; +pub type fsfilcnt_t = ::c_ulong; +pub type ino_t = ::c_ulong; +pub type mode_t = ::c_int; +pub type nfds_t = ::c_ulong; +pub type nlink_t = ::c_ulong; +pub type off_t = ::c_long; +pub type pthread_t = *mut ::c_void; +pub type pthread_attr_t = *mut ::c_void; +pub type pthread_cond_t = *mut ::c_void; +pub type pthread_condattr_t = *mut ::c_void; +// Must be usize due to libstd/sys_common/thread_local.rs, +// should technically be *mut ::c_void +pub type pthread_key_t = usize; +pub type pthread_mutex_t = *mut ::c_void; +pub type pthread_mutexattr_t = *mut ::c_void; +pub type pthread_rwlock_t = *mut ::c_void; +pub type pthread_rwlockattr_t = *mut ::c_void; +pub type rlim_t = ::c_ulonglong; +pub type sa_family_t = u16; +pub type sem_t = *mut ::c_void; +pub type sigset_t = ::c_ulong; +pub type socklen_t = u32; +pub type speed_t = u32; +pub type suseconds_t = ::c_int; +pub type tcflag_t = u32; +pub type time_t = ::c_long; + +s! { + pub struct addrinfo { + pub ai_flags: ::c_int, + pub ai_family: ::c_int, + pub ai_socktype: ::c_int, + pub ai_protocol: ::c_int, + pub ai_addrlen: ::size_t, + pub ai_canonname: *mut ::c_char, + pub ai_addr: *mut ::sockaddr, + pub ai_next: *mut ::addrinfo, + } + + pub struct dirent { + pub d_ino: ::ino_t, + pub d_off: ::off_t, + pub d_reclen: ::c_ushort, + pub d_type: ::c_uchar, + pub d_name: [::c_char; 256], + } + + pub struct Dl_info { + pub dli_fname: *const ::c_char, + pub dli_fbase: *mut ::c_void, + pub dli_sname: *const ::c_char, + pub dli_saddr: *mut ::c_void, + } + + pub struct epoll_event { + pub events: u32, + pub u64: u64, + pub _pad: u64, + } + + pub struct fd_set { + fds_bits: [::c_ulong; ::FD_SETSIZE / ULONG_SIZE], + } + + pub struct in_addr { + pub s_addr: ::in_addr_t, + } + + pub struct ip_mreq { + pub imr_multiaddr: ::in_addr, + pub imr_interface: ::in_addr, + } + + pub struct lconv { + pub currency_symbol: *const ::c_char, + pub decimal_point: *const ::c_char, + pub frac_digits: ::c_char, + pub grouping: *const ::c_char, + pub int_curr_symbol: *const ::c_char, + pub int_frac_digits: ::c_char, + pub mon_decimal_point: *const ::c_char, + pub mon_grouping: *const ::c_char, + pub mon_thousands_sep: *const ::c_char, + pub negative_sign: *const ::c_char, + pub n_cs_precedes: ::c_char, + pub n_sep_by_space: ::c_char, + pub n_sign_posn: ::c_char, + pub positive_sign: *const ::c_char, + pub p_cs_precedes: ::c_char, + pub p_sep_by_space: ::c_char, + pub p_sign_posn: ::c_char, + pub thousands_sep: *const ::c_char, + } + + pub struct passwd { + pub pw_name: *mut ::c_char, + pub pw_passwd: *mut ::c_char, + pub pw_uid: ::uid_t, + pub pw_gid: ::gid_t, + pub pw_gecos: *mut ::c_char, + pub pw_dir: *mut ::c_char, + pub pw_shell: *mut ::c_char, + } + + pub struct sigaction { + pub sa_handler: ::sighandler_t, + pub sa_flags: ::c_ulong, + pub sa_restorer: ::Option, + pub sa_mask: ::sigset_t, + } + + pub struct sockaddr { + pub sa_family: ::sa_family_t, + pub sa_data: [::c_char; 14], + } + + pub struct sockaddr_in { + pub sin_family: ::sa_family_t, + pub sin_port: ::in_port_t, + pub sin_addr: ::in_addr, + pub sin_zero: [::c_char; 8], + } + + pub struct sockaddr_in6 { + pub sin6_family: ::sa_family_t, + pub sin6_port: ::in_port_t, + pub sin6_flowinfo: u32, + pub sin6_addr: ::in6_addr, + pub sin6_scope_id: u32, + } + + pub struct sockaddr_storage { + pub ss_family: ::sa_family_t, + __ss_padding: [ + u8; + 128 - + ::core::mem::size_of::() - + ::core::mem::size_of::() + ], + __ss_align: ::c_ulong, + } + + pub struct sockaddr_un { + pub sun_family: ::sa_family_t, + pub sun_path: [::c_char; 108] + } + + pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_nlink: ::nlink_t, + pub st_mode: ::mode_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + _pad: [::c_char; 24], + } + + pub struct statvfs { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_favail: ::fsfilcnt_t, + pub f_fsid: ::c_ulong, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + } + + pub struct termios { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; ::NCCS], + pub c_ispeed: ::speed_t, + pub c_ospeed: ::speed_t, + } + + pub struct tm { + pub tm_sec: ::c_int, + pub tm_min: ::c_int, + pub tm_hour: ::c_int, + pub tm_mday: ::c_int, + pub tm_mon: ::c_int, + pub tm_year: ::c_int, + pub tm_wday: ::c_int, + pub tm_yday: ::c_int, + pub tm_isdst: ::c_int, + pub tm_gmtoff: ::c_long, + pub tm_zone: *const ::c_char, + } +} + +// TODO: relibc { + pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; +// } + +// dlfcn.h + +pub const RTLD_LAZY: ::c_int = 0x0001; +pub const RTLD_NOW: ::c_int = 0x0002; +pub const RTLD_GLOBAL: ::c_int = 0x0100; +pub const RTLD_LOCAL: ::c_int = 0x0000; + +// errno.h +pub const EPERM: ::c_int = 1; +pub const ENOENT: ::c_int = 2; +pub const ESRCH: ::c_int = 3; +pub const EINTR: ::c_int = 4; +pub const EIO: ::c_int = 5; +pub const ENXIO: ::c_int = 6; +pub const E2BIG: ::c_int = 7; +pub const ENOEXEC: ::c_int = 8; +pub const EBADF: ::c_int = 9; +pub const ECHILD: ::c_int = 10; +pub const EAGAIN: ::c_int = 11; +pub const ENOMEM: ::c_int = 12; +pub const EACCES: ::c_int = 13; +pub const EFAULT: ::c_int = 14; +pub const ENOTBLK: ::c_int = 15; +pub const EBUSY: ::c_int = 16; +pub const EEXIST: ::c_int = 17; +pub const EXDEV: ::c_int = 18; +pub const ENODEV: ::c_int = 19; +pub const ENOTDIR: ::c_int = 20; +pub const EISDIR: ::c_int = 21; +pub const EINVAL: ::c_int = 22; +pub const ENFILE: ::c_int = 23; +pub const EMFILE: ::c_int = 24; +pub const ENOTTY: ::c_int = 25; +pub const ETXTBSY: ::c_int = 26; +pub const EFBIG: ::c_int = 27; +pub const ENOSPC: ::c_int = 28; +pub const ESPIPE: ::c_int = 29; +pub const EROFS: ::c_int = 30; +pub const EMLINK: ::c_int = 31; +pub const EPIPE: ::c_int = 32; +pub const EDOM: ::c_int = 33; +pub const ERANGE: ::c_int = 34; +pub const EDEADLK: ::c_int = 35; +pub const ENOSYS: ::c_int = 38; +pub const EWOULDBLOCK: ::c_int = 41; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNRESET: ::c_int = 104; +pub const ENOTCONN: ::c_int = 107; +pub const ETIMEDOUT: ::c_int = 110; +pub const ECONNREFUSED: ::c_int = 111; +pub const EINPROGRESS: ::c_int = 115; + +// fcntl.h +pub const F_DUPFD: ::c_int = 0; +pub const F_GETFD: ::c_int = 1; +pub const F_SETFD: ::c_int = 2; +pub const F_GETFL: ::c_int = 3; +pub const F_SETFL: ::c_int = 4; +// TODO: relibc { + pub const F_DUPFD_CLOEXEC: ::c_int = ::F_DUPFD; +// } +pub const FD_CLOEXEC: ::c_int = 0x0100_0000; +pub const O_RDONLY: ::c_int = 0x0001_0000; +pub const O_WRONLY: ::c_int = 0x0002_0000; +pub const O_RDWR: ::c_int = 0x0003_0000; +pub const O_ACCMODE: ::c_int = 0x0003_0000; +pub const O_NONBLOCK: ::c_int = 0x0004_0000; +pub const O_APPEND: ::c_int = 0x0008_0000; +pub const O_SHLOCK: ::c_int = 0x0010_0000; +pub const O_EXLOCK: ::c_int = 0x0020_0000; +pub const O_ASYNC: ::c_int = 0x0040_0000; +pub const O_FSYNC: ::c_int = 0x0080_0000; +pub const O_CLOEXEC: ::c_int = 0x0100_0000; +pub const O_CREAT: ::c_int = 0x0200_0000; +pub const O_TRUNC: ::c_int = 0x0400_0000; +pub const O_EXCL: ::c_int = 0x0800_0000; +pub const O_DIRECTORY: ::c_int = 0x1000_0000; +pub const O_PATH: ::c_int = 0x2000_0000; +pub const O_SYMLINK: ::c_int = 0x4000_0000; +// Negative to allow it to be used as int +// TODO: Fix negative values missing from includes +pub const O_NOFOLLOW: ::c_int = -0x8000_0000; + +// netdb.h +pub const EAI_SYSTEM: ::c_int = -11; + +// netinet/in.h +// TODO: relibc { + pub const IP_TTL: ::c_int = 2; + pub const IPV6_UNICAST_HOPS: ::c_int = 16; + pub const IPV6_MULTICAST_IF: ::c_int = 17; + pub const IPV6_MULTICAST_HOPS: ::c_int = 18; + pub const IPV6_MULTICAST_LOOP: ::c_int = 19; + pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20; + pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21; + pub const IPV6_V6ONLY: ::c_int = 26; + pub const IP_MULTICAST_IF: ::c_int = 32; + pub const IP_MULTICAST_TTL: ::c_int = 33; + pub const IP_MULTICAST_LOOP: ::c_int = 34; + pub const IP_ADD_MEMBERSHIP: ::c_int = 35; + pub const IP_DROP_MEMBERSHIP: ::c_int = 36; +// } + +// netinet/tcp.h +pub const TCP_NODELAY: ::c_int = 1; +// TODO: relibc { + pub const TCP_KEEPIDLE: ::c_int = 1; +// } + +// poll.h +pub const POLLIN: ::c_short = 0x001; +pub const POLLPRI: ::c_short = 0x002; +pub const POLLOUT: ::c_short = 0x004; +pub const POLLERR: ::c_short = 0x008; +pub const POLLHUP: ::c_short = 0x010; +pub const POLLNVAL: ::c_short = 0x020; + +// pthread.h +pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; +pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; +pub const PTHREAD_MUTEX_INITIALIZER: ::pthread_mutex_t = -1isize as *mut _; +pub const PTHREAD_COND_INITIALIZER: ::pthread_cond_t = -1isize as *mut _; +pub const PTHREAD_RWLOCK_INITIALIZER: ::pthread_rwlock_t = -1isize as *mut _; +pub const PTHREAD_STACK_MIN : ::size_t = 4096; + +// signal.h +pub const SIG_BLOCK: ::c_int = 0; +pub const SIG_UNBLOCK: ::c_int = 1; +pub const SIG_SETMASK: ::c_int = 2; +pub const SIGHUP: ::c_int = 1; +pub const SIGINT: ::c_int = 2; +pub const SIGQUIT: ::c_int = 3; +pub const SIGILL: ::c_int = 4; +pub const SIGTRAP: ::c_int = 5; +pub const SIGABRT: ::c_int = 6; +pub const SIGBUS: ::c_int = 7; +pub const SIGFPE: ::c_int = 8; +pub const SIGKILL: ::c_int = 9; +pub const SIGUSR1: ::c_int = 10; +pub const SIGSEGV: ::c_int = 11; +pub const SIGUSR2: ::c_int = 12; +pub const SIGPIPE: ::c_int = 13; +pub const SIGALRM: ::c_int = 14; +pub const SIGTERM: ::c_int = 15; +pub const SIGSTKFLT: ::c_int = 16; +pub const SIGCHLD: ::c_int = 17; +pub const SIGCONT: ::c_int = 18; +pub const SIGSTOP: ::c_int = 19; +pub const SIGTSTP: ::c_int = 20; +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGURG: ::c_int = 23; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; +pub const SIGIO: ::c_int = 29; +pub const SIGPWR: ::c_int = 30; +pub const SIGSYS: ::c_int = 31; +pub const NSIG: ::c_int = 32; + +// sys/epoll.h +pub const EPOLL_CLOEXEC: ::c_int = 0x0100_0000; +pub const EPOLL_CTL_ADD: ::c_int = 1; +pub const EPOLL_CTL_DEL: ::c_int = 2; +pub const EPOLL_CTL_MOD: ::c_int = 3; +pub const EPOLLIN: ::c_int = 1; +pub const EPOLLPRI: ::c_int = 0; +pub const EPOLLOUT: ::c_int = 2; +pub const EPOLLRDNORM: ::c_int = 0; +pub const EPOLLNVAL: ::c_int = 0; +pub const EPOLLRDBAND: ::c_int = 0; +pub const EPOLLWRNORM: ::c_int = 0; +pub const EPOLLWRBAND: ::c_int = 0; +pub const EPOLLMSG: ::c_int = 0; +pub const EPOLLERR: ::c_int = 0; +pub const EPOLLHUP: ::c_int = 0; +pub const EPOLLRDHUP: ::c_int = 0; +pub const EPOLLEXCLUSIVE: ::c_int = 0; +pub const EPOLLWAKEUP: ::c_int = 0; +pub const EPOLLONESHOT: ::c_int = 0; +pub const EPOLLET: ::c_int = 0; + +// sys/stat.h +pub const S_IFMT: ::c_int = 0o0_170_000; +pub const S_IFDIR: ::c_int = 0o040_000; +pub const S_IFCHR: ::c_int = 0o020_000; +pub const S_IFBLK: ::c_int = 0o060_000; +pub const S_IFREG: ::c_int = 0o100_000; +pub const S_IFIFO: ::c_int = 0o010_000; +pub const S_IFLNK: ::c_int = 0o120_000; +pub const S_IFSOCK: ::c_int = 0o140_000; +pub const S_IRWXU: ::c_int = 0o0_700; +pub const S_IRUSR: ::c_int = 0o0_400; +pub const S_IWUSR: ::c_int = 0o0_200; +pub const S_IXUSR: ::c_int = 0o0_100; +pub const S_IRWXG: ::c_int = 0o0_070; +pub const S_IRGRP: ::c_int = 0o0_040; +pub const S_IWGRP: ::c_int = 0o0_020; +pub const S_IXGRP: ::c_int = 0o0_010; +pub const S_IRWXO: ::c_int = 0o0_007; +pub const S_IROTH: ::c_int = 0o0_004; +pub const S_IWOTH: ::c_int = 0o0_002; +pub const S_IXOTH: ::c_int = 0o0_001; + +// stdlib.h +pub const EXIT_SUCCESS: ::c_int = 0; +pub const EXIT_FAILURE: ::c_int = 1; + +// sys/ioctl.h +// TODO: relibc { + pub const FIONBIO: ::c_ulong = 0x5421; + pub const FIOCLEX: ::c_ulong = 0x5451; +// } +pub const TCGETS: ::c_ulong = 0x5401; +pub const TCSETS: ::c_ulong = 0x5402; +pub const TCFLSH: ::c_ulong = 0x540B; +pub const TIOCGPGRP: ::c_ulong = 0x540F; +pub const TIOCSPGRP: ::c_ulong = 0x5410; +pub const TIOCGWINSZ: ::c_ulong = 0x5413; +pub const TIOCSWINSZ: ::c_ulong = 0x5414; + +// sys/select.h +pub const FD_SETSIZE: usize = 1024; + +// sys/socket.h +pub const AF_UNIX: ::c_int = 1; +pub const AF_INET: ::c_int = 2; +pub const AF_INET6: ::c_int = 10; +pub const MSG_PEEK: ::c_int = 2; +pub const SHUT_RD: ::c_int = 0; +pub const SHUT_WR: ::c_int = 1; +pub const SHUT_RDWR: ::c_int = 2; +pub const SO_REUSEADDR: ::c_int = 2; +pub const SO_ERROR: ::c_int = 4; +pub const SO_BROADCAST: ::c_int = 6; +pub const SO_SNDBUF: ::c_int = 7; +pub const SO_RCVBUF: ::c_int = 8; +pub const SO_KEEPALIVE: ::c_int = 9; +pub const SO_LINGER: ::c_int = 13; +pub const SO_REUSEPORT: ::c_int = 15; +pub const SO_RCVTIMEO: ::c_int = 20; +pub const SO_SNDTIMEO: ::c_int = 21; +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; +pub const SOL_SOCKET: ::c_int = 1; + +// sys/wait.h +pub const WNOHANG: ::c_int = 1; + +// termios.h +pub const NCCS: usize = 32; + +// time.h +pub const CLOCK_REALTIME: ::c_int = 1; +pub const CLOCK_MONOTONIC: ::c_int = 4; + +// unistd.h +pub const _SC_PAGESIZE: ::c_int = 30; +pub const SEEK_SET: ::c_int = 0; +pub const SEEK_CUR: ::c_int = 1; +pub const SEEK_END: ::c_int = 2; +pub const STDIN_FILENO: ::c_int = 0; +pub const STDOUT_FILENO: ::c_int = 1; +pub const STDERR_FILENO: ::c_int = 2; + +// wait.h +pub fn WIFSTOPPED(status: ::c_int) -> bool { + (status & 0xff) == 0x7f +} + +pub fn WSTOPSIG(status: ::c_int) -> ::c_int { + (status >> 8) & 0xff +} + +pub fn WIFCONTINUED(status: ::c_int) -> bool { + status == 0xffff +} + +pub fn WIFSIGNALED(status: ::c_int) -> bool { + ((status & 0x7f) + 1) as i8 >= 2 +} + +pub fn WTERMSIG(status: ::c_int) -> ::c_int { + status & 0x7f +} + +pub fn WIFEXITED(status: ::c_int) -> bool { + (status & 0x7f) == 0 +} + +pub fn WEXITSTATUS(status: ::c_int) -> ::c_int { + (status >> 8) & 0xff +} + +pub fn WCOREDUMP(status: ::c_int) -> bool { + (status & 0x80) != 0 +} + +// intentionally not public, only used for fd_set +cfg_if! { + if #[cfg(target_pointer_width = "32")] { + const ULONG_SIZE: usize = 32; + } else if #[cfg(target_pointer_width = "64")] { + const ULONG_SIZE: usize = 64; + } else { + // Unknown target_pointer_width + } +} + +extern { + pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; + pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; + + pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, + buflen: ::size_t) -> ::c_int; + pub fn __errno_location() -> *mut ::c_int; + + // malloc.h + pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; + + // pthread.h + pub fn pthread_atfork(prepare: ::Option, + parent: ::Option, + child: ::Option) -> ::c_int; + pub fn pthread_create(tid: *mut ::pthread_t, + attr: *const ::pthread_attr_t, + start: extern fn(*mut ::c_void) -> *mut ::c_void, + arg: *mut ::c_void) -> ::c_int; + pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t, + clock_id: ::clockid_t) -> ::c_int; + + // signal.h + pub fn pthread_sigmask(how: ::c_int, + set: *const ::sigset_t, + oldset: *mut ::sigset_t) -> ::c_int; + + // sys/epoll.h + pub fn epoll_create(size: ::c_int) -> ::c_int; + pub fn epoll_create1(flags: ::c_int) -> ::c_int; + pub fn epoll_wait(epfd: ::c_int, + events: *mut ::epoll_event, + maxevents: ::c_int, + timeout: ::c_int) -> ::c_int; + pub fn epoll_ctl(epfd: ::c_int, + op: ::c_int, + fd: ::c_int, + event: *mut ::epoll_event) -> ::c_int; + + // sys/ioctl.h + pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; + + // sys/socket.h + pub fn bind(socket: ::c_int, address: *const ::sockaddr, + address_len: ::socklen_t) -> ::c_int; + pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, + flags: ::c_int, addr: *mut ::sockaddr, + addrlen: *mut ::socklen_t) -> ::ssize_t; + + // sys/uio.h + pub fn readv(fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int) -> ::ssize_t; + pub fn writev(fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int) -> ::ssize_t; + + // time.h + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::timezone) -> ::c_int; + pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; +} diff -Nru cargo-0.35.0/vendor/libc/src/unix/solarish/mod.rs cargo-0.37.0/vendor/libc/src/unix/solarish/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/solarish/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/solarish/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -31,9 +31,13 @@ pub type pthread_key_t = ::c_uint; pub type blksize_t = ::c_int; pub type nl_item = ::c_int; +pub type mqd_t = *mut ::c_void; pub type id_t = ::c_int; pub type idtype_t = ::c_uint; +pub type door_attr_t = ::c_uint; +pub type door_id_t = ::c_ulonglong; + #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} impl ::Copy for timezone {} @@ -210,15 +214,6 @@ pub sa_mask: sigset_t, } - pub struct sigevent { - pub sigev_notify: ::c_int, - pub sigev_signo: ::c_int, - pub sigev_value: ::sigval, - pub ss_sp: *mut ::c_void, - pub sigev_notify_attributes: *const ::pthread_attr_t, - __sigev_pad2: ::c_int, - } - pub struct stack_t { pub ss_sp: *mut ::c_void, pub ss_size: ::size_t, @@ -331,6 +326,14 @@ pub if_name: *mut ::c_char, } + pub struct mq_attr { + pub mq_flags: ::c_long, + pub mq_maxmsg: ::c_long, + pub mq_msgsize: ::c_long, + pub mq_curmsgs: ::c_long, + _pad: [::c_int; 4] + } + pub struct port_event { pub portev_events: ::c_int, pub portev_source: ::c_ushort, @@ -338,13 +341,18 @@ pub portev_object: ::uintptr_t, pub portev_user: *mut ::c_void, } + + pub struct door_desc_t__d_data__d_desc { + pub d_descriptor: ::c_int, + pub d_id: ::door_id_t + } } s_no_extra_traits! { #[cfg_attr(any(target_arch = "x86", target_arch = "x86_64"), repr(packed))] pub struct epoll_event { - pub events: ::uint32_t, - pub u64: ::uint64_t, + pub events: u32, + pub u64: u64, } pub struct sockaddr_un { @@ -392,6 +400,34 @@ pub sdl_slen: ::c_uchar, pub sdl_data: [::c_char; 244], } + + pub struct sigevent { + pub sigev_notify: ::c_int, + pub sigev_signo: ::c_int, + pub sigev_value: ::sigval, + pub ss_sp: *mut ::c_void, + pub sigev_notify_attributes: *const ::pthread_attr_t, + __sigev_pad2: ::c_int, + } + + pub union door_desc_t__d_data { + pub d_desc: door_desc_t__d_data__d_desc, + d_resv: [::c_int; 5], /* Check out /usr/include/sys/door.h */ + } + + pub struct door_desc_t { + pub d_attributes: door_attr_t, + pub d_data: door_desc_t__d_data, + } + + pub struct door_arg_t { + pub data_ptr: *const ::c_char, + pub data_size: ::size_t, + pub desc_ptr: *const door_desc_t, + pub dec_num: ::c_uint, + pub rbuf: *const ::c_char, + pub rsize: ::size_t, + } } cfg_if! { @@ -627,6 +663,40 @@ self.sdl_data.hash(state); } } + + impl PartialEq for sigevent { + fn eq(&self, other: &sigevent) -> bool { + self.sigev_notify == other.sigev_notify + && self.sigev_signo == other.sigev_signo + && self.sigev_value == other.sigev_value + && self.ss_sp == other.ss_sp + && self.sigev_notify_attributes + == other.sigev_notify_attributes + } + } + impl Eq for sigevent {} + impl ::fmt::Debug for sigevent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sigevent") + .field("sigev_notify", &self.sigev_notify) + .field("sigev_signo", &self.sigev_signo) + .field("sigev_value", &self.sigev_value) + .field("ss_sp", &self.ss_sp) + .field("sigev_notify_attributes", + &self.sigev_notify_attributes) + .finish() + } + } + impl ::hash::Hash for sigevent { + fn hash(&self, state: &mut H) { + self.sigev_notify.hash(state); + self.sigev_signo.hash(state); + self.sigev_value.hash(state); + self.ss_sp.hash(state); + self.sigev_notify_attributes.hash(state); + } + } + } } @@ -1175,7 +1245,7 @@ pub const AF_TRILL: ::c_int = 31; pub const AF_PACKET: ::c_int = 32; pub const AF_LX_NETLINK: ::c_int = 33; -pub const AF_MAX: ::c_int = 33; + pub const SOCK_DGRAM: ::c_int = 1; pub const SOCK_STREAM: ::c_int = 2; pub const SOCK_RAW: ::c_int = 4; @@ -1786,6 +1856,12 @@ } extern { + pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; + pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; + + pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, + buflen: ::size_t) -> ::c_int; + pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, @@ -1800,6 +1876,8 @@ pub fn rand() -> ::c_int; pub fn srand(seed: ::c_uint); + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::c_void) -> ::c_int; pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; pub fn freeifaddrs(ifa: *mut ::ifaddrs); @@ -1922,6 +2000,31 @@ pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t; + pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t; + pub fn mq_close(mqd: ::mqd_t) -> ::c_int; + pub fn mq_unlink(name: *const ::c_char) -> ::c_int; + pub fn mq_receive(mqd: ::mqd_t, + msg_ptr: *mut ::c_char, + msg_len: ::size_t, + msq_prio: *mut ::c_uint) -> ::ssize_t; + pub fn mq_timedreceive(mqd: ::mqd_t, + msg_ptr: *mut ::c_char, + msg_len: ::size_t, + msq_prio: *mut ::c_uint, + abs_timeout: *const ::timespec) -> ::ssize_t; + pub fn mq_send(mqd: ::mqd_t, + msg_ptr: *const ::c_char, + msg_len: ::size_t, + msq_prio: ::c_uint) -> ::c_int; + pub fn mq_timedsend(mqd: ::mqd_t, + msg_ptr: *const ::c_char, + msg_len: ::size_t, + msq_prio: ::c_uint, + abs_timeout: *const ::timespec) -> ::c_int; + pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int; + pub fn mq_setattr(mqd: ::mqd_t, + newattr: *const ::mq_attr, + oldattr: *mut ::mq_attr) -> ::c_int; pub fn port_create() -> ::c_int; pub fn port_associate(port: ::c_int, source: ::c_int, object: ::uintptr_t, events: ::c_int, user: *mut ::c_void) -> ::c_int; @@ -2025,6 +2128,19 @@ pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int; pub fn uname(buf: *mut ::utsname) -> ::c_int; pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; + pub fn door_call(d: ::c_int, params: *const door_arg_t) -> ::c_int; + pub fn door_return(data_ptr: *const ::c_char, + data_size: ::size_t, + desc_ptr: *const door_desc_t, + num_desc: ::c_uint); + pub fn door_create(server_procedure: extern fn(cookie: *const ::c_void, + argp: *const ::c_char, + arg_size: ::size_t, + dp: *const door_desc_t, + n_desc: ::c_uint), + cookie: *const ::c_void, + attributes: door_attr_t) -> ::c_int; + pub fn fattach(fildes: ::c_int, path: *const ::c_char) -> ::c_int; } mod compat; diff -Nru cargo-0.35.0/vendor/libc/src/unix/uclibc/arm/mod.rs cargo-0.37.0/vendor/libc/src/unix/uclibc/arm/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/uclibc/arm/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/uclibc/arm/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -51,9 +51,12 @@ pub st_size: ::off_t, pub st_blksize: ::blksize_t, pub st_blocks: ::blkcnt_t, - pub st_atim: ::timespec, - pub st_mtim: ::timespec, - pub st_ctim: ::timespec, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_ulong, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_ulong, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_ulong, pub __unused4: ::c_ulong, pub __unused5: ::c_ulong, } @@ -72,9 +75,12 @@ pub st_size: ::off64_t, pub st_blksize: ::blksize_t, pub st_blocks: ::blkcnt64_t, - pub st_atim: ::timespec, - pub st_mtim: ::timespec, - pub st_ctim: ::timespec, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_ulong, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_ulong, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_ulong, pub st_ino: ::ino64_t, } @@ -134,8 +140,8 @@ pub struct stack_t { pub ss_sp: *mut ::c_void, - ss_flags: ::c_int, - ss_size: ::size_t, + pub ss_flags: ::c_int, + pub ss_size: ::size_t, } pub struct ipc_perm { @@ -215,8 +221,8 @@ pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000; // from linux/mod.rs pub const EPOLLWAKEUP: ::c_int = 0x20000000; // from linux/other/mod.rs pub const EXTPROC: ::tcflag_t = 0o200000; // from asm-generic/termbits.h -pub const F_GETPIPE_SZ: ::c_int = 1032; // from notbsd/mod.rs -pub const F_SETPIPE_SZ: ::c_int = 1031; // from notbsd/mod.rs +pub const F_GETPIPE_SZ: ::c_int = 1032; // from linux_like/mod.rs +pub const F_SETPIPE_SZ: ::c_int = 1031; // from linux_like/mod.rs pub const LIO_NOP: ::c_int = 2; // from linux/mod.rs pub const LIO_NOWAIT: ::c_int = 1; // from linux/mod.rs pub const LIO_READ: ::c_int = 0; // from linux/mod.rs @@ -226,12 +232,12 @@ pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32; // from linux/mod.rs pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32; // from linux/mod.rs -pub const SO_BUSY_POLL: ::c_int = 46; // from src/unix/notbsd/mod.rs -pub const SO_PEEK_OFF: ::c_int = 42; // from src/unix/notbsd/mod.rs -pub const SO_REUSEPORT: ::c_int = 15; // from src/unix/notbsd/mod.rs -pub const SOL_NETLINK: ::c_int = 270; // from src/unix/notbsd/mod.rs +pub const SO_BUSY_POLL: ::c_int = 46; // from src/unix/linux_like/mod.rs +pub const SO_PEEK_OFF: ::c_int = 42; // from src/unix/linux_like/mod.rs +pub const SO_REUSEPORT: ::c_int = 15; // from src/unix/linux_like/mod.rs +pub const SOL_NETLINK: ::c_int = 270; // from src/unix/linux_like/mod.rs pub const _POSIX_VDISABLE: ::cc_t = 0; // from linux/mod.rs -pub const AT_EMPTY_PATH: ::c_int = 0x1000; // from notbsd/mod.rs +pub const AT_EMPTY_PATH: ::c_int = 0x1000; // from linux_like/mod.rs // autogenerated constants with hand tuned types pub const AT_NO_AUTOMOUNT: ::c_int = 0x800; @@ -394,6 +400,7 @@ pub const FFDLY: ::c_int = 0x8000; pub const FIONBIO: ::c_ulong = 0x5421; pub const FIOCLEX: ::c_ulong = 0x5451; +pub const FIONCLEX: ::c_ulong = 0x5450; pub const FLUSHO: ::tcflag_t = 0x1000; pub const F_GETLK: ::c_int = 0x5; pub const F_SETLK: ::c_int = 0x6; @@ -462,16 +469,17 @@ pub const POLLRDNORM: ::c_short = 0x40; pub const POLLWRBAND: ::c_short = 0x200; pub const POLLWRNORM: ::c_short = 0x100; -pub const QIF_ALL: ::uint32_t = 0x3f; -pub const QIF_BLIMITS: ::uint32_t = 0x1; -pub const QIF_BTIME: ::uint32_t = 0x10; -pub const QIF_ILIMITS: ::uint32_t = 0x4; -pub const QIF_INODES: ::uint32_t = 0x8; -pub const QIF_ITIME: ::uint32_t = 0x20; -pub const QIF_LIMITS: ::uint32_t = 0x5; -pub const QIF_SPACE: ::uint32_t = 0x2; -pub const QIF_TIMES: ::uint32_t = 0x30; -pub const QIF_USAGE: ::uint32_t = 0xa; +pub const PTHREAD_STACK_MIN: ::size_t = 16384; +pub const QIF_ALL: u32 = 0x3f; +pub const QIF_BLIMITS: u32 = 0x1; +pub const QIF_BTIME: u32 = 0x10; +pub const QIF_ILIMITS: u32 = 0x4; +pub const QIF_INODES: u32 = 0x8; +pub const QIF_ITIME: u32 = 0x20; +pub const QIF_LIMITS: u32 = 0x5; +pub const QIF_SPACE: u32 = 0x2; +pub const QIF_TIMES: u32 = 0x30; +pub const QIF_USAGE: u32 = 0xa; pub const SA_NOCLDSTOP: ::c_int = 0x1; pub const SA_NOCLDWAIT: ::c_int = 0x2; pub const SA_NODEFER: ::c_int = 0x40000000; @@ -488,6 +496,7 @@ pub const SIGPROF: ::c_int = 0x1b; pub const SIGPWR: ::c_int = 0x1e; pub const SIGSTKFLT: ::c_int = 0x10; +pub const SIGSTKSZ: ::size_t = 8192; pub const SIGSTOP: ::c_int = 0x13; pub const SIGSYS: ::c_int = 0x1f; pub const SIGTSTP: ::c_int = 0x14; @@ -534,7 +543,6 @@ pub const SO_SNDTIMEO: ::c_int = 0x15; pub const SO_TIMESTAMP: ::c_int = 0x1d; pub const SO_TYPE: ::c_int = 0x3; -pub const SYS_gettid: ::c_int = 0xe0; pub const TAB1: ::c_int = 0x800; pub const TAB2: ::c_int = 0x1000; pub const TAB3: ::c_int = 0x1800; @@ -611,6 +619,358 @@ pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 0xb3; pub const _SC_XOPEN_STREAMS: ::c_int = 0xf6; +// Syscall table is copied from src/unix/notbsd/linux/musl/b32/arm.rs +pub const SYS_restart_syscall: ::c_long = 0; +pub const SYS_exit: ::c_long = 1; +pub const SYS_fork: ::c_long = 2; +pub const SYS_read: ::c_long = 3; +pub const SYS_write: ::c_long = 4; +pub const SYS_open: ::c_long = 5; +pub const SYS_close: ::c_long = 6; +pub const SYS_creat: ::c_long = 8; +pub const SYS_link: ::c_long = 9; +pub const SYS_unlink: ::c_long = 10; +pub const SYS_execve: ::c_long = 11; +pub const SYS_chdir: ::c_long = 12; +pub const SYS_mknod: ::c_long = 14; +pub const SYS_chmod: ::c_long = 15; +pub const SYS_lchown: ::c_long = 16; +pub const SYS_lseek: ::c_long = 19; +pub const SYS_getpid: ::c_long = 20; +pub const SYS_mount: ::c_long = 21; +pub const SYS_setuid: ::c_long = 23; +pub const SYS_getuid: ::c_long = 24; +pub const SYS_ptrace: ::c_long = 26; +pub const SYS_pause: ::c_long = 29; +pub const SYS_access: ::c_long = 33; +pub const SYS_nice: ::c_long = 34; +pub const SYS_sync: ::c_long = 36; +pub const SYS_kill: ::c_long = 37; +pub const SYS_rename: ::c_long = 38; +pub const SYS_mkdir: ::c_long = 39; +pub const SYS_rmdir: ::c_long = 40; +pub const SYS_dup: ::c_long = 41; +pub const SYS_pipe: ::c_long = 42; +pub const SYS_times: ::c_long = 43; +pub const SYS_brk: ::c_long = 45; +pub const SYS_setgid: ::c_long = 46; +pub const SYS_getgid: ::c_long = 47; +pub const SYS_geteuid: ::c_long = 49; +pub const SYS_getegid: ::c_long = 50; +pub const SYS_acct: ::c_long = 51; +pub const SYS_umount2: ::c_long = 52; +pub const SYS_ioctl: ::c_long = 54; +pub const SYS_fcntl: ::c_long = 55; +pub const SYS_setpgid: ::c_long = 57; +pub const SYS_umask: ::c_long = 60; +pub const SYS_chroot: ::c_long = 61; +pub const SYS_ustat: ::c_long = 62; +pub const SYS_dup2: ::c_long = 63; +pub const SYS_getppid: ::c_long = 64; +pub const SYS_getpgrp: ::c_long = 65; +pub const SYS_setsid: ::c_long = 66; +pub const SYS_sigaction: ::c_long = 67; +pub const SYS_setreuid: ::c_long = 70; +pub const SYS_setregid: ::c_long = 71; +pub const SYS_sigsuspend: ::c_long = 72; +pub const SYS_sigpending: ::c_long = 73; +pub const SYS_sethostname: ::c_long = 74; +pub const SYS_setrlimit: ::c_long = 75; +pub const SYS_getrusage: ::c_long = 77; +pub const SYS_gettimeofday: ::c_long = 78; +pub const SYS_settimeofday: ::c_long = 79; +pub const SYS_getgroups: ::c_long = 80; +pub const SYS_setgroups: ::c_long = 81; +pub const SYS_symlink: ::c_long = 83; +pub const SYS_readlink: ::c_long = 85; +pub const SYS_uselib: ::c_long = 86; +pub const SYS_swapon: ::c_long = 87; +pub const SYS_reboot: ::c_long = 88; +pub const SYS_munmap: ::c_long = 91; +pub const SYS_truncate: ::c_long = 92; +pub const SYS_ftruncate: ::c_long = 93; +pub const SYS_fchmod: ::c_long = 94; +pub const SYS_fchown: ::c_long = 95; +pub const SYS_getpriority: ::c_long = 96; +pub const SYS_setpriority: ::c_long = 97; +pub const SYS_statfs: ::c_long = 99; +pub const SYS_fstatfs: ::c_long = 100; +pub const SYS_syslog: ::c_long = 103; +pub const SYS_setitimer: ::c_long = 104; +pub const SYS_getitimer: ::c_long = 105; +pub const SYS_stat: ::c_long = 106; +pub const SYS_lstat: ::c_long = 107; +pub const SYS_fstat: ::c_long = 108; +pub const SYS_vhangup: ::c_long = 111; +pub const SYS_wait4: ::c_long = 114; +pub const SYS_swapoff: ::c_long = 115; +pub const SYS_sysinfo: ::c_long = 116; +pub const SYS_fsync: ::c_long = 118; +pub const SYS_sigreturn: ::c_long = 119; +pub const SYS_clone: ::c_long = 120; +pub const SYS_setdomainname: ::c_long = 121; +pub const SYS_uname: ::c_long = 122; +pub const SYS_adjtimex: ::c_long = 124; +pub const SYS_mprotect: ::c_long = 125; +pub const SYS_sigprocmask: ::c_long = 126; +pub const SYS_init_module: ::c_long = 128; +pub const SYS_delete_module: ::c_long = 129; +pub const SYS_quotactl: ::c_long = 131; +pub const SYS_getpgid: ::c_long = 132; +pub const SYS_fchdir: ::c_long = 133; +pub const SYS_bdflush: ::c_long = 134; +pub const SYS_sysfs: ::c_long = 135; +pub const SYS_personality: ::c_long = 136; +pub const SYS_setfsuid: ::c_long = 138; +pub const SYS_setfsgid: ::c_long = 139; +pub const SYS__llseek: ::c_long = 140; +pub const SYS_getdents: ::c_long = 141; +pub const SYS__newselect: ::c_long = 142; +pub const SYS_flock: ::c_long = 143; +pub const SYS_msync: ::c_long = 144; +pub const SYS_readv: ::c_long = 145; +pub const SYS_writev: ::c_long = 146; +pub const SYS_getsid: ::c_long = 147; +pub const SYS_fdatasync: ::c_long = 148; +pub const SYS__sysctl: ::c_long = 149; +pub const SYS_mlock: ::c_long = 150; +pub const SYS_munlock: ::c_long = 151; +pub const SYS_mlockall: ::c_long = 152; +pub const SYS_munlockall: ::c_long = 153; +pub const SYS_sched_setparam: ::c_long = 154; +pub const SYS_sched_getparam: ::c_long = 155; +pub const SYS_sched_setscheduler: ::c_long = 156; +pub const SYS_sched_getscheduler: ::c_long = 157; +pub const SYS_sched_yield: ::c_long = 158; +pub const SYS_sched_get_priority_max: ::c_long = 159; +pub const SYS_sched_get_priority_min: ::c_long = 160; +pub const SYS_sched_rr_get_interval: ::c_long = 161; +pub const SYS_nanosleep: ::c_long = 162; +pub const SYS_mremap: ::c_long = 163; +pub const SYS_setresuid: ::c_long = 164; +pub const SYS_getresuid: ::c_long = 165; +pub const SYS_poll: ::c_long = 168; +pub const SYS_nfsservctl: ::c_long = 169; +pub const SYS_setresgid: ::c_long = 170; +pub const SYS_getresgid: ::c_long = 171; +pub const SYS_prctl: ::c_long = 172; +pub const SYS_rt_sigreturn: ::c_long = 173; +pub const SYS_rt_sigaction: ::c_long = 174; +pub const SYS_rt_sigprocmask: ::c_long = 175; +pub const SYS_rt_sigpending: ::c_long = 176; +pub const SYS_rt_sigtimedwait: ::c_long = 177; +pub const SYS_rt_sigqueueinfo: ::c_long = 178; +pub const SYS_rt_sigsuspend: ::c_long = 179; +pub const SYS_pread64: ::c_long = 180; +pub const SYS_pwrite64: ::c_long = 181; +pub const SYS_chown: ::c_long = 182; +pub const SYS_getcwd: ::c_long = 183; +pub const SYS_capget: ::c_long = 184; +pub const SYS_capset: ::c_long = 185; +pub const SYS_sigaltstack: ::c_long = 186; +pub const SYS_sendfile: ::c_long = 187; +pub const SYS_vfork: ::c_long = 190; +pub const SYS_ugetrlimit: ::c_long = 191; +pub const SYS_mmap2: ::c_long = 192; +pub const SYS_truncate64: ::c_long = 193; +pub const SYS_ftruncate64: ::c_long = 194; +pub const SYS_stat64: ::c_long = 195; +pub const SYS_lstat64: ::c_long = 196; +pub const SYS_fstat64: ::c_long = 197; +pub const SYS_lchown32: ::c_long = 198; +pub const SYS_getuid32: ::c_long = 199; +pub const SYS_getgid32: ::c_long = 200; +pub const SYS_geteuid32: ::c_long = 201; +pub const SYS_getegid32: ::c_long = 202; +pub const SYS_setreuid32: ::c_long = 203; +pub const SYS_setregid32: ::c_long = 204; +pub const SYS_getgroups32: ::c_long = 205; +pub const SYS_setgroups32: ::c_long = 206; +pub const SYS_fchown32: ::c_long = 207; +pub const SYS_setresuid32: ::c_long = 208; +pub const SYS_getresuid32: ::c_long = 209; +pub const SYS_setresgid32: ::c_long = 210; +pub const SYS_getresgid32: ::c_long = 211; +pub const SYS_chown32: ::c_long = 212; +pub const SYS_setuid32: ::c_long = 213; +pub const SYS_setgid32: ::c_long = 214; +pub const SYS_setfsuid32: ::c_long = 215; +pub const SYS_setfsgid32: ::c_long = 216; +pub const SYS_getdents64: ::c_long = 217; +pub const SYS_pivot_root: ::c_long = 218; +pub const SYS_mincore: ::c_long = 219; +pub const SYS_madvise: ::c_long = 220; +pub const SYS_fcntl64: ::c_long = 221; +pub const SYS_gettid: ::c_long = 224; +pub const SYS_readahead: ::c_long = 225; +pub const SYS_setxattr: ::c_long = 226; +pub const SYS_lsetxattr: ::c_long = 227; +pub const SYS_fsetxattr: ::c_long = 228; +pub const SYS_getxattr: ::c_long = 229; +pub const SYS_lgetxattr: ::c_long = 230; +pub const SYS_fgetxattr: ::c_long = 231; +pub const SYS_listxattr: ::c_long = 232; +pub const SYS_llistxattr: ::c_long = 233; +pub const SYS_flistxattr: ::c_long = 234; +pub const SYS_removexattr: ::c_long = 235; +pub const SYS_lremovexattr: ::c_long = 236; +pub const SYS_fremovexattr: ::c_long = 237; +pub const SYS_tkill: ::c_long = 238; +pub const SYS_sendfile64: ::c_long = 239; +pub const SYS_futex: ::c_long = 240; +pub const SYS_sched_setaffinity: ::c_long = 241; +pub const SYS_sched_getaffinity: ::c_long = 242; +pub const SYS_io_setup: ::c_long = 243; +pub const SYS_io_destroy: ::c_long = 244; +pub const SYS_io_getevents: ::c_long = 245; +pub const SYS_io_submit: ::c_long = 246; +pub const SYS_io_cancel: ::c_long = 247; +pub const SYS_exit_group: ::c_long = 248; +pub const SYS_lookup_dcookie: ::c_long = 249; +pub const SYS_epoll_create: ::c_long = 250; +pub const SYS_epoll_ctl: ::c_long = 251; +pub const SYS_epoll_wait: ::c_long = 252; +pub const SYS_remap_file_pages: ::c_long = 253; +pub const SYS_set_tid_address: ::c_long = 256; +pub const SYS_timer_create: ::c_long = 257; +pub const SYS_timer_settime: ::c_long = 258; +pub const SYS_timer_gettime: ::c_long = 259; +pub const SYS_timer_getoverrun: ::c_long = 260; +pub const SYS_timer_delete: ::c_long = 261; +pub const SYS_clock_settime: ::c_long = 262; +pub const SYS_clock_gettime: ::c_long = 263; +pub const SYS_clock_getres: ::c_long = 264; +pub const SYS_clock_nanosleep: ::c_long = 265; +pub const SYS_statfs64: ::c_long = 266; +pub const SYS_fstatfs64: ::c_long = 267; +pub const SYS_tgkill: ::c_long = 268; +pub const SYS_utimes: ::c_long = 269; +pub const SYS_pciconfig_iobase: ::c_long = 271; +pub const SYS_pciconfig_read: ::c_long = 272; +pub const SYS_pciconfig_write: ::c_long = 273; +pub const SYS_mq_open: ::c_long = 274; +pub const SYS_mq_unlink: ::c_long = 275; +pub const SYS_mq_timedsend: ::c_long = 276; +pub const SYS_mq_timedreceive: ::c_long = 277; +pub const SYS_mq_notify: ::c_long = 278; +pub const SYS_mq_getsetattr: ::c_long = 279; +pub const SYS_waitid: ::c_long = 280; +pub const SYS_socket: ::c_long = 281; +pub const SYS_bind: ::c_long = 282; +pub const SYS_connect: ::c_long = 283; +pub const SYS_listen: ::c_long = 284; +pub const SYS_accept: ::c_long = 285; +pub const SYS_getsockname: ::c_long = 286; +pub const SYS_getpeername: ::c_long = 287; +pub const SYS_socketpair: ::c_long = 288; +pub const SYS_send: ::c_long = 289; +pub const SYS_sendto: ::c_long = 290; +pub const SYS_recv: ::c_long = 291; +pub const SYS_recvfrom: ::c_long = 292; +pub const SYS_shutdown: ::c_long = 293; +pub const SYS_setsockopt: ::c_long = 294; +pub const SYS_getsockopt: ::c_long = 295; +pub const SYS_sendmsg: ::c_long = 296; +pub const SYS_recvmsg: ::c_long = 297; +pub const SYS_semop: ::c_long = 298; +pub const SYS_semget: ::c_long = 299; +pub const SYS_semctl: ::c_long = 300; +pub const SYS_msgsnd: ::c_long = 301; +pub const SYS_msgrcv: ::c_long = 302; +pub const SYS_msgget: ::c_long = 303; +pub const SYS_msgctl: ::c_long = 304; +pub const SYS_shmat: ::c_long = 305; +pub const SYS_shmdt: ::c_long = 306; +pub const SYS_shmget: ::c_long = 307; +pub const SYS_shmctl: ::c_long = 308; +pub const SYS_add_key: ::c_long = 309; +pub const SYS_request_key: ::c_long = 310; +pub const SYS_keyctl: ::c_long = 311; +pub const SYS_semtimedop: ::c_long = 312; +pub const SYS_vserver: ::c_long = 313; +pub const SYS_ioprio_set: ::c_long = 314; +pub const SYS_ioprio_get: ::c_long = 315; +pub const SYS_inotify_init: ::c_long = 316; +pub const SYS_inotify_add_watch: ::c_long = 317; +pub const SYS_inotify_rm_watch: ::c_long = 318; +pub const SYS_mbind: ::c_long = 319; +pub const SYS_get_mempolicy: ::c_long = 320; +pub const SYS_set_mempolicy: ::c_long = 321; +pub const SYS_openat: ::c_long = 322; +pub const SYS_mkdirat: ::c_long = 323; +pub const SYS_mknodat: ::c_long = 324; +pub const SYS_fchownat: ::c_long = 325; +pub const SYS_futimesat: ::c_long = 326; +pub const SYS_fstatat64: ::c_long = 327; +pub const SYS_unlinkat: ::c_long = 328; +pub const SYS_renameat: ::c_long = 329; +pub const SYS_linkat: ::c_long = 330; +pub const SYS_symlinkat: ::c_long = 331; +pub const SYS_readlinkat: ::c_long = 332; +pub const SYS_fchmodat: ::c_long = 333; +pub const SYS_faccessat: ::c_long = 334; +pub const SYS_pselect6: ::c_long = 335; +pub const SYS_ppoll: ::c_long = 336; +pub const SYS_unshare: ::c_long = 337; +pub const SYS_set_robust_list: ::c_long = 338; +pub const SYS_get_robust_list: ::c_long = 339; +pub const SYS_splice: ::c_long = 340; +pub const SYS_tee: ::c_long = 342; +pub const SYS_vmsplice: ::c_long = 343; +pub const SYS_move_pages: ::c_long = 344; +pub const SYS_getcpu: ::c_long = 345; +pub const SYS_epoll_pwait: ::c_long = 346; +pub const SYS_kexec_load: ::c_long = 347; +pub const SYS_utimensat: ::c_long = 348; +pub const SYS_signalfd: ::c_long = 349; +pub const SYS_timerfd_create: ::c_long = 350; +pub const SYS_eventfd: ::c_long = 351; +pub const SYS_fallocate: ::c_long = 352; +pub const SYS_timerfd_settime: ::c_long = 353; +pub const SYS_timerfd_gettime: ::c_long = 354; +pub const SYS_signalfd4: ::c_long = 355; +pub const SYS_eventfd2: ::c_long = 356; +pub const SYS_epoll_create1: ::c_long = 357; +pub const SYS_dup3: ::c_long = 358; +pub const SYS_pipe2: ::c_long = 359; +pub const SYS_inotify_init1: ::c_long = 360; +pub const SYS_preadv: ::c_long = 361; +pub const SYS_pwritev: ::c_long = 362; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 363; +pub const SYS_perf_event_open: ::c_long = 364; +pub const SYS_recvmmsg: ::c_long = 365; +pub const SYS_accept4: ::c_long = 366; +pub const SYS_fanotify_init: ::c_long = 367; +pub const SYS_fanotify_mark: ::c_long = 368; +pub const SYS_prlimit64: ::c_long = 369; +pub const SYS_name_to_handle_at: ::c_long = 370; +pub const SYS_open_by_handle_at: ::c_long = 371; +pub const SYS_clock_adjtime: ::c_long = 372; +pub const SYS_syncfs: ::c_long = 373; +pub const SYS_sendmmsg: ::c_long = 374; +pub const SYS_setns: ::c_long = 375; +pub const SYS_process_vm_readv: ::c_long = 376; +pub const SYS_process_vm_writev: ::c_long = 377; +pub const SYS_kcmp: ::c_long = 378; +pub const SYS_finit_module: ::c_long = 379; +pub const SYS_sched_setattr: ::c_long = 380; +pub const SYS_sched_getattr: ::c_long = 381; +pub const SYS_renameat2: ::c_long = 382; +pub const SYS_seccomp: ::c_long = 383; +pub const SYS_getrandom: ::c_long = 384; +pub const SYS_memfd_create: ::c_long = 385; +pub const SYS_bpf: ::c_long = 386; +pub const SYS_execveat: ::c_long = 387; +pub const SYS_userfaultfd: ::c_long = 388; +pub const SYS_membarrier: ::c_long = 389; +pub const SYS_mlock2: ::c_long = 390; +pub const SYS_copy_file_range: ::c_long = 391; +pub const SYS_preadv2: ::c_long = 392; +pub const SYS_pwritev2: ::c_long = 393; +pub const SYS_pkey_mprotect: ::c_long = 394; +pub const SYS_pkey_alloc: ::c_long = 395; +pub const SYS_pkey_free: ::c_long = 396; + fn CMSG_ALIGN(len: usize) -> usize { len + ::mem::size_of::() - 1 & !(::mem::size_of::() - 1) } diff -Nru cargo-0.35.0/vendor/libc/src/unix/uclibc/mips/mips32/mod.rs cargo-0.37.0/vendor/libc/src/unix/uclibc/mips/mips32/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/uclibc/mips/mips32/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/uclibc/mips/mips32/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -247,7 +247,6 @@ pub const SYS_chmod: ::c_long = 4000 + 15; pub const SYS_lchown: ::c_long = 4000 + 16; pub const SYS_break: ::c_long = 4000 + 17; -pub const SYS_unused18: ::c_long = 4000 + 18; pub const SYS_lseek: ::c_long = 4000 + 19; pub const SYS_getpid: ::c_long = 4000 + 20; pub const SYS_mount: ::c_long = 4000 + 21; @@ -257,7 +256,6 @@ pub const SYS_stime: ::c_long = 4000 + 25; pub const SYS_ptrace: ::c_long = 4000 + 26; pub const SYS_alarm: ::c_long = 4000 + 27; -pub const SYS_unused28: ::c_long = 4000 + 28; pub const SYS_pause: ::c_long = 4000 + 29; pub const SYS_utime: ::c_long = 4000 + 30; pub const SYS_stty: ::c_long = 4000 + 31; @@ -288,7 +286,6 @@ pub const SYS_mpx: ::c_long = 4000 + 56; pub const SYS_setpgid: ::c_long = 4000 + 57; pub const SYS_ulimit: ::c_long = 4000 + 58; -pub const SYS_unused59: ::c_long = 4000 + 59; pub const SYS_umask: ::c_long = 4000 + 60; pub const SYS_chroot: ::c_long = 4000 + 61; pub const SYS_ustat: ::c_long = 4000 + 62; @@ -311,9 +308,7 @@ pub const SYS_settimeofday: ::c_long = 4000 + 79; pub const SYS_getgroups: ::c_long = 4000 + 80; pub const SYS_setgroups: ::c_long = 4000 + 81; -pub const SYS_reserved82: ::c_long = 4000 + 82; pub const SYS_symlink: ::c_long = 4000 + 83; -pub const SYS_unused84: ::c_long = 4000 + 84; pub const SYS_readlink: ::c_long = 4000 + 85; pub const SYS_uselib: ::c_long = 4000 + 86; pub const SYS_swapon: ::c_long = 4000 + 87; @@ -338,7 +333,6 @@ pub const SYS_stat: ::c_long = 4000 + 106; pub const SYS_lstat: ::c_long = 4000 + 107; pub const SYS_fstat: ::c_long = 4000 + 108; -pub const SYS_unused109: ::c_long = 4000 + 109; pub const SYS_iopl: ::c_long = 4000 + 110; pub const SYS_vhangup: ::c_long = 4000 + 111; pub const SYS_idle: ::c_long = 4000 + 112; @@ -379,7 +373,6 @@ pub const SYS_cacheflush: ::c_long = 4000 + 147; pub const SYS_cachectl: ::c_long = 4000 + 148; pub const SYS_sysmips: ::c_long = 4000 + 149; -pub const SYS_unused150: ::c_long = 4000 + 150; pub const SYS_getsid: ::c_long = 4000 + 151; pub const SYS_fdatasync: ::c_long = 4000 + 152; pub const SYS__sysctl: ::c_long = 4000 + 153; @@ -450,7 +443,6 @@ pub const SYS_madvise: ::c_long = 4000 + 218; pub const SYS_getdents64: ::c_long = 4000 + 219; pub const SYS_fcntl64: ::c_long = 4000 + 220; -pub const SYS_reserved221: ::c_long = 4000 + 221; pub const SYS_gettid: ::c_long = 4000 + 222; pub const SYS_readahead: ::c_long = 4000 + 223; pub const SYS_setxattr: ::c_long = 4000 + 224; diff -Nru cargo-0.35.0/vendor/libc/src/unix/uclibc/mips/mod.rs cargo-0.37.0/vendor/libc/src/unix/uclibc/mips/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/uclibc/mips/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/uclibc/mips/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -224,6 +224,7 @@ pub const SO_BPF_EXTENSIONS: ::c_int = 48; pub const FIOCLEX: ::c_ulong = 0x6601; +pub const FIONCLEX: ::c_ulong = 0x6602; pub const FIONBIO: ::c_ulong = 0x667e; pub const SA_ONSTACK: ::c_uint = 0x08000000; @@ -391,15 +392,15 @@ pub const SIGSTKSZ: ::size_t = 8192; pub const CBAUD: ::tcflag_t = 0o0010017; -pub const TAB1: ::c_int = 0x00000800; -pub const TAB2: ::c_int = 0x00001000; -pub const TAB3: ::c_int = 0x00001800; -pub const CR1: ::c_int = 0x00000200; -pub const CR2: ::c_int = 0x00000400; -pub const CR3: ::c_int = 0x00000600; -pub const FF1: ::c_int = 0x00008000; -pub const BS1: ::c_int = 0x00002000; -pub const VT1: ::c_int = 0x00004000; +pub const TAB1: ::tcflag_t = 0x00000800; +pub const TAB2: ::tcflag_t = 0x00001000; +pub const TAB3: ::tcflag_t = 0x00001800; +pub const CR1: ::tcflag_t = 0x00000200; +pub const CR2: ::tcflag_t = 0x00000400; +pub const CR3: ::tcflag_t = 0x00000600; +pub const FF1: ::tcflag_t = 0x00008000; +pub const BS1: ::tcflag_t = 0x00002000; +pub const VT1: ::tcflag_t = 0x00004000; pub const VWERASE: usize = 14; pub const VREPRINT: usize = 12; pub const VSUSP: usize = 10; diff -Nru cargo-0.35.0/vendor/libc/src/unix/uclibc/mod.rs cargo-0.37.0/vendor/libc/src/unix/uclibc/mod.rs --- cargo-0.35.0/vendor/libc/src/unix/uclibc/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/unix/uclibc/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -80,13 +80,6 @@ pub ai_next: *mut addrinfo, } - pub struct sockaddr_nl { - pub nl_family: ::sa_family_t, - nl_pad: ::c_ushort, - pub nl_pid: u32, - pub nl_groups: u32 - } - pub struct sockaddr_ll { pub sll_family: ::c_ushort, pub sll_protocol: ::c_ushort, @@ -153,19 +146,6 @@ pub int_n_sign_posn: ::c_char, } - pub struct sigevent { - pub sigev_value: ::sigval, - pub sigev_signo: ::c_int, - pub sigev_notify: ::c_int, - // Actually a union. We only expose sigev_notify_thread_id because it's - // the most useful member - pub sigev_notify_thread_id: ::c_int, - #[cfg(target_pointer_width = "64")] - __unused1: [::c_int; 11], - #[cfg(target_pointer_width = "32")] - __unused1: [::c_int; 12] - } - pub struct rlimit64 { pub rlim_cur: rlim64_t, pub rlim_max: rlim64_t, @@ -242,53 +222,45 @@ } pub struct dqblk { - pub dqb_bhardlimit: ::uint32_t, - pub dqb_bsoftlimit: ::uint32_t, - pub dqb_curblocks: ::uint32_t, - pub dqb_ihardlimit: ::uint32_t, - pub dqb_isoftlimit: ::uint32_t, - pub dqb_curinodes: ::uint32_t, + pub dqb_bhardlimit: u32, + pub dqb_bsoftlimit: u32, + pub dqb_curblocks: u32, + pub dqb_ihardlimit: u32, + pub dqb_isoftlimit: u32, + pub dqb_curinodes: u32, pub dqb_btime: ::time_t, pub dqb_itime: ::time_t, } pub struct signalfd_siginfo { - pub ssi_signo: ::uint32_t, - pub ssi_errno: ::int32_t, - pub ssi_code: ::int32_t, - pub ssi_pid: ::uint32_t, - pub ssi_uid: ::uint32_t, - pub ssi_fd: ::int32_t, - pub ssi_tid: ::uint32_t, - pub ssi_band: ::uint32_t, - pub ssi_overrun: ::uint32_t, - pub ssi_trapno: ::uint32_t, - pub ssi_status: ::int32_t, - pub ssi_int: ::int32_t, - pub ssi_ptr: ::uint64_t, - pub ssi_utime: ::uint64_t, - pub ssi_stime: ::uint64_t, - pub ssi_addr: ::uint64_t, - pub ssi_addr_lsb: ::uint16_t, - _pad2: ::uint16_t, - pub ssi_syscall: ::int32_t, - pub ssi_call_addr: ::uint64_t, - pub ssi_arch: ::uint32_t, - _pad: [::uint8_t; 28], + pub ssi_signo: u32, + pub ssi_errno: i32, + pub ssi_code: i32, + pub ssi_pid: u32, + pub ssi_uid: u32, + pub ssi_fd: i32, + pub ssi_tid: u32, + pub ssi_band: u32, + pub ssi_overrun: u32, + pub ssi_trapno: u32, + pub ssi_status: i32, + pub ssi_int: i32, + pub ssi_ptr: u64, + pub ssi_utime: u64, + pub ssi_stime: u64, + pub ssi_addr: u64, + pub ssi_addr_lsb: u16, + _pad2: u16, + pub ssi_syscall: i32, + pub ssi_call_addr: u64, + pub ssi_arch: u32, + _pad: [u8; 28], } pub struct fsid_t { __val: [::c_int; 2], } - pub struct mq_attr { - pub mq_flags: ::c_long, - pub mq_maxmsg: ::c_long, - pub mq_msgsize: ::c_long, - pub mq_curmsgs: ::c_long, - pad: [::c_long; 4] - } - pub struct cpu_set_t { #[cfg(target_pointer_width = "32")] bits: [u32; 32], @@ -321,8 +293,8 @@ )] #[allow(missing_debug_implementations)] pub struct epoll_event { - pub events: ::uint32_t, - pub u64: ::uint64_t, + pub events: u32, + pub u64: u64, } #[allow(missing_debug_implementations)] @@ -368,6 +340,121 @@ pub d_type: ::c_uchar, pub d_name: [::c_char; 256], } + + pub struct mq_attr { + pub mq_flags: ::c_long, + pub mq_maxmsg: ::c_long, + pub mq_msgsize: ::c_long, + pub mq_curmsgs: ::c_long, + pad: [::c_long; 4] + } + + pub struct sockaddr_nl { + pub nl_family: ::sa_family_t, + nl_pad: ::c_ushort, + pub nl_pid: u32, + pub nl_groups: u32 + } + + pub struct sigevent { + pub sigev_value: ::sigval, + pub sigev_signo: ::c_int, + pub sigev_notify: ::c_int, + // Actually a union. We only expose sigev_notify_thread_id because it's + // the most useful member + pub sigev_notify_thread_id: ::c_int, + #[cfg(target_pointer_width = "64")] + __unused1: [::c_int; 11], + #[cfg(target_pointer_width = "32")] + __unused1: [::c_int; 12] + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for mq_attr { + fn eq(&self, other: &mq_attr) -> bool { + self.mq_flags == other.mq_flags && + self.mq_maxmsg == other.mq_maxmsg && + self.mq_msgsize == other.mq_msgsize && + self.mq_curmsgs == other.mq_curmsgs + } + } + impl Eq for mq_attr {} + impl ::fmt::Debug for mq_attr { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("mq_attr") + .field("mq_flags", &self.mq_flags) + .field("mq_maxmsg", &self.mq_maxmsg) + .field("mq_msgsize", &self.mq_msgsize) + .field("mq_curmsgs", &self.mq_curmsgs) + .finish() + } + } + impl ::hash::Hash for mq_attr { + fn hash(&self, state: &mut H) { + self.mq_flags.hash(state); + self.mq_maxmsg.hash(state); + self.mq_msgsize.hash(state); + self.mq_curmsgs.hash(state); + } + } + + impl PartialEq for sockaddr_nl { + fn eq(&self, other: &sockaddr_nl) -> bool { + self.nl_family == other.nl_family && + self.nl_pid == other.nl_pid && + self.nl_groups == other.nl_groups + } + } + impl Eq for sockaddr_nl {} + impl ::fmt::Debug for sockaddr_nl { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sockaddr_nl") + .field("nl_family", &self.nl_family) + .field("nl_pid", &self.nl_pid) + .field("nl_groups", &self.nl_groups) + .finish() + } + } + impl ::hash::Hash for sockaddr_nl { + fn hash(&self, state: &mut H) { + self.nl_family.hash(state); + self.nl_pid.hash(state); + self.nl_groups.hash(state); + } + } + + impl PartialEq for sigevent { + fn eq(&self, other: &sigevent) -> bool { + self.sigev_value == other.sigev_value + && self.sigev_signo == other.sigev_signo + && self.sigev_notify == other.sigev_notify + && self.sigev_notify_thread_id + == other.sigev_notify_thread_id + } + } + impl Eq for sigevent {} + impl ::fmt::Debug for sigevent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sigevent") + .field("sigev_value", &self.sigev_value) + .field("sigev_signo", &self.sigev_signo) + .field("sigev_notify", &self.sigev_notify) + .field("sigev_notify_thread_id", + &self.sigev_notify_thread_id) + .finish() + } + } + impl ::hash::Hash for sigevent { + fn hash(&self, state: &mut H) { + self.sigev_value.hash(state); + self.sigev_signo.hash(state); + self.sigev_notify.hash(state); + self.sigev_notify_thread_id.hash(state); + } + } + } } // intentionally not public, only used for fd_set @@ -853,13 +940,13 @@ pub const TCIFLUSH: ::c_int = 0; pub const TCOFLUSH: ::c_int = 1; pub const TCIOFLUSH: ::c_int = 2; -pub const NL0: ::c_int = 0x00000000; -pub const NL1: ::c_int = 0x00000100; -pub const TAB0: ::c_int = 0x00000000; -pub const CR0: ::c_int = 0x00000000; -pub const FF0: ::c_int = 0x00000000; -pub const BS0: ::c_int = 0x00000000; -pub const VT0: ::c_int = 0x00000000; +pub const NL0: ::tcflag_t = 0x00000000; +pub const NL1: ::tcflag_t = 0x00000100; +pub const TAB0: ::tcflag_t = 0x00000000; +pub const CR0: ::tcflag_t = 0x00000000; +pub const FF0: ::tcflag_t = 0x00000000; +pub const BS0: ::tcflag_t = 0x00000000; +pub const VT0: ::tcflag_t = 0x00000000; pub const VERASE: usize = 2; pub const VKILL: usize = 3; pub const VINTR: usize = 0; @@ -1388,8 +1475,6 @@ pub const FILENAME_MAX: ::c_uint = 4095; -pub const AF_MAX: ::c_int = 39; - f! { pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { let fd = fd as usize; @@ -1487,6 +1572,11 @@ } extern { + #[cfg_attr(target_os = "linux", + link_name = "__xpg_strerror_r")] + pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, + buflen: ::size_t) -> ::c_int; + pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, @@ -1500,6 +1590,8 @@ pub fn srand(seed: ::c_uint); pub fn fdatasync(fd: ::c_int) -> ::c_int; + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::timezone) -> ::c_int; pub fn mincore(addr: *mut ::c_void, len: ::size_t, vec: *mut ::c_uchar) -> ::c_int; pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; @@ -1576,6 +1668,8 @@ pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, advise: ::c_int) -> ::c_int; + pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; + pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; pub fn utimensat(dirfd: ::c_int, path: *const ::c_char, times: *const ::timespec, flag: ::c_int) -> ::c_int; diff -Nru cargo-0.35.0/vendor/libc/src/wasi.rs cargo-0.37.0/vendor/libc/src/wasi.rs --- cargo-0.35.0/vendor/libc/src/wasi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/wasi.rs 2019-07-17 05:42:23.000000000 +0000 @@ -2,6 +2,7 @@ pub type c_char = i8; pub type c_uchar = u8; +pub type c_schar = i8; pub type c_int = i32; pub type c_uint = u32; pub type c_short = i16; @@ -10,18 +11,15 @@ pub type c_ulong = u32; pub type c_longlong = i64; pub type c_ulonglong = u64; +pub type intmax_t = i64; +pub type uintmax_t = u64; pub type size_t = usize; pub type ssize_t = isize; +pub type ptrdiff_t = isize; +pub type intptr_t = isize; +pub type uintptr_t = usize; pub type off_t = i64; pub type pid_t = i32; -pub type int8_t = i8; -pub type uint8_t = u8; -pub type int16_t = i16; -pub type uint16_t = u16; -pub type int32_t = i32; -pub type uint32_t = u32; -pub type int64_t = i64; -pub type uint64_t = u64; pub type clock_t = c_longlong; pub type time_t = c_longlong; pub type c_double = f64; @@ -619,11 +617,13 @@ pub fn getenv(s: *const c_char) -> *mut c_char; pub fn malloc(amt: size_t) -> *mut c_void; pub fn malloc_usable_size(ptr: *mut c_void) -> size_t; + pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void; pub fn rand() -> c_int; pub fn read(fd: c_int, ptr: *mut c_void, size: size_t) -> ssize_t; pub fn realloc(ptr: *mut c_void, amt: size_t) -> *mut c_void; pub fn setenv(k: *const c_char, v: *const c_char, a: c_int) -> c_int; pub fn unsetenv(k: *const c_char) -> c_int; + pub fn clearenv() -> ::c_int; pub fn write(fd: c_int, ptr: *const c_void, size: size_t) -> ssize_t; pub static mut environ: *mut *mut c_char; pub fn fopen(a: *const c_char, b: *const c_char) -> *mut FILE; @@ -724,6 +724,7 @@ pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char; pub fn atoi(s: *const c_char) -> c_int; + pub fn atof(s: *const c_char) -> c_double; pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; pub fn strtol( s: *const c_char, @@ -822,6 +823,7 @@ pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent; pub fn closedir(dirp: *mut ::DIR) -> ::c_int; pub fn rewinddir(dirp: *mut ::DIR); + pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; pub fn openat( dirfd: ::c_int, @@ -902,9 +904,11 @@ pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int; pub fn fsync(fd: ::c_int) -> ::c_int; + pub fn fdatasync(fd: ::c_int) -> ::c_int; pub fn symlink(path1: *const c_char, path2: *const c_char) -> ::c_int; + pub fn truncate(path: *const c_char, length: off_t) -> ::c_int; pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int; pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int; @@ -954,6 +958,11 @@ whence: ::c_int, ) -> ::c_int; pub fn ftello(stream: *mut ::FILE) -> ::off_t; + pub fn posix_fallocate( + fd: ::c_int, + offset: ::off_t, + len: ::off_t, + ) -> ::c_int; pub fn strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char; pub fn getline( @@ -1019,13 +1028,14 @@ base: ::locale_t, ) -> ::locale_t; pub fn uselocale(loc: ::locale_t) -> ::locale_t; + pub fn sched_yield() -> ::c_int; pub fn __wasilibc_register_preopened_fd( fd: c_int, path: *const c_char, ) -> c_int; pub fn __wasilibc_fd_renumber(fd: c_int, newfd: c_int) -> c_int; - pub fn __wasilibc_rmfileat(fd: c_int, path: *const c_char) -> c_int; + pub fn __wasilibc_unlinkat(fd: c_int, path: *const c_char) -> c_int; pub fn __wasilibc_rmdirat(fd: c_int, path: *const c_char) -> c_int; pub fn __wasilibc_init_preopen(); pub fn __wasilibc_find_relpath( @@ -1034,6 +1044,7 @@ rights_inheriting: __wasi_rights_t, relative_path: *mut *const c_char, ) -> c_int; + pub fn __wasilibc_tell(fd: c_int) -> ::off_t; pub fn arc4random() -> u32; pub fn arc4random_buf(a: *mut c_void, b: size_t); diff -Nru cargo-0.35.0/vendor/libc/src/windows/mod.rs cargo-0.37.0/vendor/libc/src/windows/mod.rs --- cargo-0.35.0/vendor/libc/src/windows/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libc/src/windows/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,14 +1,5 @@ //! Windows CRT definitions -pub type int8_t = i8; -pub type int16_t = i16; -pub type int32_t = i32; -pub type int64_t = i64; -pub type uint8_t = u8; -pub type uint16_t = u16; -pub type uint32_t = u32; -pub type uint64_t = u64; - pub type c_schar = i8; pub type c_uchar = u8; pub type c_short = i16; diff -Nru cargo-0.35.0/vendor/libnghttp2-sys/build.rs.orig cargo-0.37.0/vendor/libnghttp2-sys/build.rs.orig --- cargo-0.35.0/vendor/libnghttp2-sys/build.rs.orig 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/libnghttp2-sys/build.rs.orig 2019-07-17 05:42:23.000000000 +0000 @@ -1,7 +1,83 @@ -extern crate pkg_config; +extern crate cc; -pub fn main() { - if pkg_config::probe_library("libnghttp2").is_ok() { - return; +use std::env; +use std::fs; +use std::path::PathBuf; + +const VERSION: &str = "1.33.90"; + +fn main() { + let target = env::var("TARGET").unwrap(); + let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); + let ver = fs::read_to_string("nghttp2/lib/includes/nghttp2/nghttp2ver.h.in") + .unwrap() + .replace("@PACKAGE_VERSION@", VERSION) + .replace("@PACKAGE_VERSION_NUM@", "0x01214a"); + + let install = out_dir.join("i"); + let include = install.join("include"); + let lib = install.join("lib"); + let pkgconfig = lib.join("pkgconfig"); + fs::create_dir_all(include.join("nghttp2")).unwrap(); + fs::create_dir_all(&pkgconfig).unwrap(); + fs::write(include.join("nghttp2/nghttp2ver.h"), ver).unwrap(); + + let mut cfg = cc::Build::new(); + cfg.include("nghttp2/lib/includes") + .include(&include) + .file("nghttp2/lib/nghttp2_buf.c") + .file("nghttp2/lib/nghttp2_callbacks.c") + .file("nghttp2/lib/nghttp2_debug.c") + .file("nghttp2/lib/nghttp2_frame.c") + .file("nghttp2/lib/nghttp2_hd.c") + .file("nghttp2/lib/nghttp2_hd_huffman.c") + .file("nghttp2/lib/nghttp2_hd_huffman_data.c") + .file("nghttp2/lib/nghttp2_helper.c") + .file("nghttp2/lib/nghttp2_http.c") + .file("nghttp2/lib/nghttp2_map.c") + .file("nghttp2/lib/nghttp2_mem.c") + .file("nghttp2/lib/nghttp2_npn.c") + .file("nghttp2/lib/nghttp2_option.c") + .file("nghttp2/lib/nghttp2_outbound_item.c") + .file("nghttp2/lib/nghttp2_pq.c") + .file("nghttp2/lib/nghttp2_priority_spec.c") + .file("nghttp2/lib/nghttp2_queue.c") + .file("nghttp2/lib/nghttp2_rcbuf.c") + .file("nghttp2/lib/nghttp2_session.c") + .file("nghttp2/lib/nghttp2_stream.c") + .file("nghttp2/lib/nghttp2_submit.c") + .file("nghttp2/lib/nghttp2_version.c") + .warnings(false) + .define("NGHTTP2_STATICLIB", None) + .define("HAVE_NETINET_IN", None) + .out_dir(&lib); + + if target.contains("windows") { + // Apparently MSVC doesn't have `ssize_t` defined as a type + if target.contains("msvc") { + match &env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap()[..] { + "64" => { cfg.define("ssize_t", "int64_t"); } + "32" => { cfg.define("ssize_t", "int32_t"); } + s => panic!("unknown pointer size: {}", s), + } + } + } else { + cfg.define("HAVE_ARPA_INET_H", None); } + cfg.compile("nghttp2"); + + println!("cargo:root={}", install.display()); + + let pc = fs::read_to_string("nghttp2/lib/libnghttp2.pc.in") + .unwrap() + .replace("@prefix@", install.to_str().unwrap()) + .replace("@exec_prefix@", "") + .replace("@libdir@", lib.to_str().unwrap()) + .replace("@includedir@", include.to_str().unwrap()) + .replace("@VERSION@", VERSION); + fs::write(pkgconfig.join("libnghttp2.pc"), pc).unwrap(); + fs::copy( + "nghttp2/lib/includes/nghttp2/nghttp2.h", + include.join("nghttp2/nghttp2.h"), + ).unwrap(); } diff -Nru cargo-0.35.0/vendor/log/appveyor.yml cargo-0.37.0/vendor/log/appveyor.yml --- cargo-0.35.0/vendor/log/appveyor.yml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/log/appveyor.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -environment: - matrix: - - TARGET: x86_64-pc-windows-msvc - - TARGET: i686-pc-windows-msvc - - TARGET: i686-pc-windows-gnu -install: - - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.exe" - - rust-nightly-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust" - - SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin - - SET PATH=%PATH%;C:\MinGW\bin - - rustc -V - - cargo -V - -build: false - -test_script: - - cargo test --verbose - - cargo test --verbose --features serde - - cargo test --verbose --features std diff -Nru cargo-0.35.0/vendor/log/build.rs cargo-0.37.0/vendor/log/build.rs --- cargo-0.35.0/vendor/log/build.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/log/build.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,14 @@ +//! This build script detects target platforms that lack proper support for +//! atomics and sets `cfg` flags accordingly. + +use std::env; + +fn main() { + let target = env::var("TARGET").unwrap(); + + if !target.starts_with("thumbv6") { + println!("cargo:rustc-cfg=atomic_cas"); + } + + println!("cargo:rerun-if-changed=build.rs"); +} diff -Nru cargo-0.35.0/vendor/log/.cargo-checksum.json cargo-0.37.0/vendor/log/.cargo-checksum.json --- cargo-0.35.0/vendor/log/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/log/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"} \ No newline at end of file +{"files":{},"package":"c275b6ad54070ac2d665eef9197db647b32239c9d244bfb6f041a766d00da5b3"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/log/Cargo.toml cargo-0.37.0/vendor/log/Cargo.toml --- cargo-0.35.0/vendor/log/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/log/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,48 +12,50 @@ [package] name = "log" -version = "0.4.6" +version = "0.4.7" authors = ["The Rust Project Developers"] +build = "build.rs" +exclude = ["rfcs/**/*", "/.travis.yml", "/appveyor.yml"] description = "A lightweight logging facade for Rust\n" -homepage = "https://github.com/rust-lang/log" documentation = "https://docs.rs/log" readme = "README.md" keywords = ["logging"] categories = ["development-tools::debugging"] -license = "MIT/Apache-2.0" +license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/log" [package.metadata.docs.rs] -features = ["std", "serde"] +features = ["std", "serde", "kv_unstable"] [[test]] name = "filters" harness = false -[dependencies.cfg-if] -version = "0.1.2" - [dependencies.serde] version = "1.0" optional = true default-features = false + +[dependencies.cfg-if] +version = "0.1.2" [dev-dependencies.serde_test] version = "1.0" [features] -max_level_debug = [] max_level_error = [] max_level_info = [] -max_level_off = [] -max_level_trace = [] -max_level_warn = [] release_max_level_debug = [] release_max_level_error = [] +release_max_level_warn = [] +max_level_warn = [] release_max_level_info = [] +max_level_debug = [] +std = [] +kv_unstable = [] +max_level_off = [] release_max_level_off = [] +max_level_trace = [] release_max_level_trace = [] -release_max_level_warn = [] -std = [] -[badges.appveyor] -repository = "alexcrichton/log" - [badges.travis-ci] repository = "rust-lang-nursery/log" + +[badges.appveyor] +repository = "alexcrichton/log" diff -Nru cargo-0.35.0/vendor/log/CHANGELOG.md cargo-0.37.0/vendor/log/CHANGELOG.md --- cargo-0.35.0/vendor/log/CHANGELOG.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/log/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -2,6 +2,20 @@ ## [Unreleased] +## [0.4.7] - 2019-07-06 + +### New + +* Support for embedded environments with thread-unsafe initialization. +* Initial unstable support for capturing structured data under the `kv_unstable` +feature gate. This new API doesn't affect existing users and may change in future +patches (so those changes may not appear in the changelog until it stabilizes). + +### Improved + +* Docs for using `log` with the 2018 edition. +* Error messages for macros missing arguments. + ## [0.4.6] - 2018-10-27 ### Improved @@ -112,7 +126,8 @@ Look at the [release tags] for information about older releases. -[Unreleased]: https://github.com/rust-lang-nursery/log/compare/0.4.6...HEAD +[Unreleased]: https://github.com/rust-lang-nursery/log/compare/0.4.7...HEAD +[0.4.7]: https://github.com/rust-lang-nursery/log/compare/0.4.6...0.4.7 [0.4.6]: https://github.com/rust-lang-nursery/log/compare/0.4.5...0.4.6 [0.4.5]: https://github.com/rust-lang-nursery/log/compare/0.4.4...0.4.5 [0.4.4]: https://github.com/rust-lang-nursery/log/compare/0.4.3...0.4.4 diff -Nru cargo-0.35.0/vendor/log/README.md cargo-0.37.0/vendor/log/README.md --- cargo-0.35.0/vendor/log/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/log/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -16,6 +16,13 @@ crate, and the consumer of those libraries can choose the logging implementation that is most suitable for its use case. + +## Minimum supported `rustc` + +`1.16.0+` + +This version is explicitly tested in CI and may be bumped in any release as needed. Maintaining compatibility with older compilers is a priority though, so the bar for bumping the minimum supported version is set very high. Any changes to the supported minimum version will be called out in the release notes. + ## Usage ## In libraries @@ -29,8 +36,7 @@ ``` ```rust -#[macro_use] -extern crate log; +use log::{info, trace, warn}; pub fn shave_the_yak(yak: &mut Yak) { trace!("Commencing yak shaving"); @@ -50,19 +56,9 @@ } ``` -If you use Rust 2018, you can use instead the following code to import the crate macros: - -```rust -use log::{info, trace, warn}; - -pub fn shave_the_yak(yak: &mut Yak) { - // … -} -``` - ## In executables -In order to produce log output executables have to use a logger implementation compatible with the facade. +In order to produce log output, executables have to use a logger implementation compatible with the facade. There are many available implementations to chose from, here are some of the most popular ones: * Simple minimal loggers: @@ -79,6 +75,8 @@ * [`syslog`](https://docs.rs/syslog/*/syslog/) * [`slog-stdlog`](https://docs.rs/slog-stdlog/*/slog_stdlog/) * [`android_log`](https://docs.rs/android_log/*/android_log/) +* For WebAssembly binaries: + * [`console_log`](https://docs.rs/console_log/*/console_log/) Executables should choose a logger implementation and initialize it early in the runtime of the program. Logger implementations will typically include a diff -Nru cargo-0.35.0/vendor/log/src/kv/error.rs cargo-0.37.0/vendor/log/src/kv/error.rs --- cargo-0.35.0/vendor/log/src/kv/error.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/log/src/kv/error.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,82 @@ +use std::fmt; +#[cfg(feature = "std")] +use std::io; + +/// An error encountered while working with structured data. +#[derive(Debug)] +pub struct Error { + inner: Inner +} + +#[derive(Debug)] +enum Inner { + #[cfg(feature = "std")] + Io(io::Error), + Msg(&'static str), + Fmt, +} + +impl Error { + /// Create an error from the given message. + pub fn msg(msg: &'static str) -> Self { + Error { + inner: Inner::Msg(msg), + } + } +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + use self::Inner::*; + match &self.inner { + #[cfg(feature = "std")] + &Io(ref err) => err.fmt(f), + &Msg(ref msg) => msg.fmt(f), + &Fmt => fmt::Error.fmt(f), + } + } +} + +impl From for Error { + fn from(_: fmt::Error) -> Self { + Error { + inner: Inner::Fmt, + } + } +} + +impl From for fmt::Error { + fn from(_: Error) -> Self { + fmt::Error + } +} + +#[cfg(feature = "std")] +mod std_support { + use super::*; + use std::{error, io}; + + impl error::Error for Error { + fn description(&self) -> &str { + "key values error" + } + } + + impl From for Error { + fn from(err: io::Error) -> Self { + Error { + inner: Inner::Io(err) + } + } + } + + impl From for io::Error { + fn from(err: Error) -> Self { + if let Inner::Io(err) = err.inner { + err + } else { + io::Error::new(io::ErrorKind::Other, err) + } + } + } +} diff -Nru cargo-0.35.0/vendor/log/src/kv/key.rs cargo-0.37.0/vendor/log/src/kv/key.rs --- cargo-0.35.0/vendor/log/src/kv/key.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/log/src/kv/key.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,143 @@ +//! Structured keys. + +use std::fmt; +use std::cmp; +use std::hash; +use std::borrow::Borrow; + +/// A type that can be converted into a [`Key`](struct.Key.html). +pub trait ToKey { + /// Perform the conversion. + fn to_key(&self) -> Key; +} + +impl<'a, T> ToKey for &'a T +where + T: ToKey + ?Sized, +{ + fn to_key(&self) -> Key { + (**self).to_key() + } +} + +impl<'k> ToKey for Key<'k> { + fn to_key(&self) -> Key { + Key { + key: self.key, + } + } +} + +impl ToKey for str { + fn to_key(&self) -> Key { + Key::from_str(self) + } +} + +/// A key in a structured key-value pair. +#[derive(Clone)] +pub struct Key<'k> { + key: &'k str, +} + +impl<'k> Key<'k> { + /// Get a key from a borrowed string. + pub fn from_str(key: &'k str) -> Self { + Key { + key: key, + } + } + + /// Get a borrowed string from this key. + pub fn as_str(&self) -> &str { + self.key + } +} + +impl<'k> fmt::Debug for Key<'k> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.key.fmt(f) + } +} + +impl<'k> fmt::Display for Key<'k> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.key.fmt(f) + } +} + +impl<'k> hash::Hash for Key<'k> { + fn hash(&self, state: &mut H) + where + H: hash::Hasher, + { + self.as_str().hash(state) + } +} + +impl<'k, 'ko> PartialEq> for Key<'k> { + fn eq(&self, other: &Key<'ko>) -> bool { + self.as_str().eq(other.as_str()) + } +} + +impl<'k> Eq for Key<'k> {} + +impl<'k, 'ko> PartialOrd> for Key<'k> { + fn partial_cmp(&self, other: &Key<'ko>) -> Option { + self.as_str().partial_cmp(other.as_str()) + } +} + +impl<'k> Ord for Key<'k> { + fn cmp(&self, other: &Self) -> cmp::Ordering { + self.as_str().cmp(other.as_str()) + } +} + +impl<'k> AsRef for Key<'k> { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl<'k> Borrow for Key<'k> { + fn borrow(&self) -> &str { + self.as_str() + } +} + +impl<'k> From<&'k str> for Key<'k> { + fn from(s: &'k str) -> Self { + Key::from_str(s) + } +} + +#[cfg(feature = "std")] +mod std_support { + use super::*; + + use std::borrow::Cow; + + impl ToKey for String { + fn to_key(&self) -> Key { + Key::from_str(self) + } + } + + impl<'a> ToKey for Cow<'a, str> { + fn to_key(&self) -> Key { + Key::from_str(self) + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn key_from_string() { + assert_eq!("a key", Key::from_str("a key").as_str()); + } +} diff -Nru cargo-0.35.0/vendor/log/src/kv/mod.rs cargo-0.37.0/vendor/log/src/kv/mod.rs --- cargo-0.35.0/vendor/log/src/kv/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/log/src/kv/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,23 @@ +//! **UNSTABLE:** Structured key-value pairs. +//! +//! This module is unstable and breaking changes may be made +//! at any time. See [the tracking issue](https://github.com/rust-lang-nursery/log/issues/328) +//! for more details. +//! +//! Add the `kv_unstable` feature to your `Cargo.toml` to enable +//! this module: +//! +//! ```toml +//! [dependencies.log] +//! features = ["kv_unstable"] +//! ``` + +mod error; +mod source; +mod key; +pub mod value; + +pub use self::error::Error; +pub use self::source::{Source, Visitor}; +pub use self::key::{Key, ToKey}; +pub use self::value::{Value, ToValue}; diff -Nru cargo-0.35.0/vendor/log/src/kv/source.rs cargo-0.37.0/vendor/log/src/kv/source.rs --- cargo-0.35.0/vendor/log/src/kv/source.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/log/src/kv/source.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,396 @@ +//! Sources for key-value pairs. + +use std::fmt; +use kv::{Error, Key, ToKey, Value, ToValue}; + +/// A source of key-value pairs. +/// +/// The source may be a single pair, a set of pairs, or a filter over a set of pairs. +/// Use the [`Visitor`](trait.Visitor.html) trait to inspect the structured data +/// in a source. +pub trait Source { + /// Visit key-value pairs. + /// + /// A source doesn't have to guarantee any ordering or uniqueness of key-value pairs. + /// If the given visitor returns an error then the source may early-return with it, + /// even if there are more key-value pairs. + /// + /// # Implementation notes + /// + /// A source should yield the same key-value pairs to a subsequent visitor unless + /// that visitor itself fails. + fn visit<'kvs>(&'kvs self, visitor: &mut Visitor<'kvs>) -> Result<(), Error>; + + /// Get the value for a given key. + /// + /// If the key appears multiple times in the source then which key is returned + /// is implementation specific. + /// + /// # Implementation notes + /// + /// A source that can provide a more efficient implementation of this method + /// should override it. + fn get<'v>(&'v self, key: Key) -> Option> { + struct Get<'k, 'v> { + key: Key<'k>, + found: Option>, + } + + impl<'k, 'kvs> Visitor<'kvs> for Get<'k, 'kvs> { + fn visit_pair(&mut self, key: Key<'kvs>, value: Value<'kvs>) -> Result<(), Error> { + if self.key == key { + self.found = Some(value); + } + + Ok(()) + } + } + + let mut get = Get { + key, + found: None, + }; + + let _ = self.visit(&mut get); + get.found + } + + /// Count the number of key-value pairs that can be visited. + /// + /// # Implementation notes + /// + /// A source that knows the number of key-value pairs upfront may provide a more + /// efficient implementation. + /// + /// A subsequent call to `visit` should yield the same number of key-value pairs + /// to the visitor, unless that visitor fails part way through. + fn count(&self) -> usize { + struct Count(usize); + + impl<'kvs> Visitor<'kvs> for Count { + fn visit_pair(&mut self, _: Key<'kvs>, _: Value<'kvs>) -> Result<(), Error> { + self.0 += 1; + + Ok(()) + } + } + + let mut count = Count(0); + let _ = self.visit(&mut count); + count.0 + } +} + +impl<'a, T> Source for &'a T +where + T: Source + ?Sized, +{ + fn visit<'kvs>(&'kvs self, visitor: &mut Visitor<'kvs>) -> Result<(), Error> { + Source::visit(&**self, visitor) + } + + fn get<'v>(&'v self, key: Key) -> Option> { + Source::get(&**self, key) + } + + fn count(&self) -> usize { + Source::count(&**self) + } +} + +impl Source for (K, V) +where + K: ToKey, + V: ToValue, +{ + fn visit<'kvs>(&'kvs self, visitor: &mut Visitor<'kvs>) -> Result<(), Error> { + visitor.visit_pair(self.0.to_key(), self.1.to_value()) + } + + fn get<'v>(&'v self, key: Key) -> Option> { + if self.0.to_key() == key { + Some(self.1.to_value()) + } else { + None + } + } + + fn count(&self) -> usize { + 1 + } +} + +impl Source for [S] +where + S: Source, +{ + fn visit<'kvs>(&'kvs self, visitor: &mut Visitor<'kvs>) -> Result<(), Error> { + for source in self { + source.visit(visitor)?; + } + + Ok(()) + } + + fn count(&self) -> usize { + self.len() + } +} + +impl Source for Option +where + S: Source, +{ + fn visit<'kvs>(&'kvs self, visitor: &mut Visitor<'kvs>) -> Result<(), Error> { + if let Some(ref source) = *self { + source.visit(visitor)?; + } + + Ok(()) + } + + fn count(&self) -> usize { + self.as_ref().map(Source::count).unwrap_or(0) + } +} + +/// A visitor for the key-value pairs in a [`Source`](trait.Source.html). +pub trait Visitor<'kvs> { + /// Visit a key-value pair. + fn visit_pair(&mut self, key: Key<'kvs>, value: Value<'kvs>) -> Result<(), Error>; +} + +impl<'a, 'kvs, T> Visitor<'kvs> for &'a mut T +where + T: Visitor<'kvs> + ?Sized, +{ + fn visit_pair(&mut self, key: Key<'kvs>, value: Value<'kvs>) -> Result<(), Error> { + (**self).visit_pair(key, value) + } +} + +impl<'a, 'b: 'a, 'kvs> Visitor<'kvs> for fmt::DebugMap<'a, 'b> { + fn visit_pair(&mut self, key: Key<'kvs>, value: Value<'kvs>) -> Result<(), Error> { + self.entry(&key, &value); + Ok(()) + } +} + +impl<'a, 'b: 'a, 'kvs> Visitor<'kvs> for fmt::DebugList<'a, 'b> { + fn visit_pair(&mut self, key: Key<'kvs>, value: Value<'kvs>) -> Result<(), Error> { + self.entry(&(key, value)); + Ok(()) + } +} + +impl<'a, 'b: 'a, 'kvs> Visitor<'kvs> for fmt::DebugSet<'a, 'b> { + fn visit_pair(&mut self, key: Key<'kvs>, value: Value<'kvs>) -> Result<(), Error> { + self.entry(&(key, value)); + Ok(()) + } +} + +impl<'a, 'b: 'a, 'kvs> Visitor<'kvs> for fmt::DebugTuple<'a, 'b> { + fn visit_pair(&mut self, key: Key<'kvs>, value: Value<'kvs>) -> Result<(), Error> { + self.field(&key); + self.field(&value); + Ok(()) + } +} + +#[cfg(feature = "std")] +mod std_support { + use super::*; + use std::borrow::Borrow; + use std::collections::{BTreeMap, HashMap}; + use std::hash::{BuildHasher, Hash}; + + impl Source for Box + where + S: Source + ?Sized, + { + fn visit<'kvs>(&'kvs self, visitor: &mut Visitor<'kvs>) -> Result<(), Error> { + Source::visit(&**self, visitor) + } + + fn get<'v>(&'v self, key: Key) -> Option> { + Source::get(&**self, key) + } + + fn count(&self) -> usize { + Source::count(&**self) + } + } + + impl Source for Vec + where + S: Source, + { + fn visit<'kvs>(&'kvs self, visitor: &mut Visitor<'kvs>) -> Result<(), Error> { + Source::visit(&**self, visitor) + } + + fn get<'v>(&'v self, key: Key) -> Option> { + Source::get(&**self, key) + } + + fn count(&self) -> usize { + Source::count(&**self) + } + } + + impl<'kvs, V> Visitor<'kvs> for Box + where + V: Visitor<'kvs> + ?Sized, + { + fn visit_pair(&mut self, key: Key<'kvs>, value: Value<'kvs>) -> Result<(), Error> { + (**self).visit_pair(key, value) + } + } + + impl Source for HashMap + where + K: ToKey + Borrow + Eq + Hash, + V: ToValue, + S: BuildHasher, + { + fn visit<'kvs>(&'kvs self, visitor: &mut Visitor<'kvs>) -> Result<(), Error> { + for (key, value) in self { + visitor.visit_pair(key.to_key(), value.to_value())?; + } + Ok(()) + } + + fn get<'v>(&'v self, key: Key) -> Option> { + HashMap::get(self, key.as_str()).map(|v| v.to_value()) + } + + fn count(&self) -> usize { + self.len() + } + } + + impl Source for BTreeMap + where + K: ToKey + Borrow + Ord, + V: ToValue, + { + fn visit<'kvs>(&'kvs self, visitor: &mut Visitor<'kvs>) -> Result<(), Error> { + for (key, value) in self { + visitor.visit_pair(key.to_key(), value.to_value())?; + } + Ok(()) + } + + fn get<'v>(&'v self, key: Key) -> Option> { + BTreeMap::get(self, key.as_str()).map(|v| v.to_value()) + } + + fn count(&self) -> usize { + self.len() + } + } + + #[cfg(test)] + mod tests { + use super::*; + use kv::value::test::Token; + use std::collections::{BTreeMap, HashMap}; + + #[test] + fn count() { + assert_eq!(1, Source::count(&Box::new(("a", 1)))); + assert_eq!(2, Source::count(&vec![("a", 1), ("b", 2)])); + } + + #[test] + fn get() { + let source = vec![("a", 1), ("b", 2), ("a", 1)]; + assert_eq!( + Token::I64(1), + Source::get(&source, Key::from_str("a")).unwrap().to_token() + ); + + let source = Box::new(Option::None::<(&str, i32)>); + assert!(Source::get(&source, Key::from_str("a")).is_none()); + } + + #[test] + fn hash_map() { + let mut map = HashMap::new(); + map.insert("a", 1); + map.insert("b", 2); + + assert_eq!(2, Source::count(&map)); + assert_eq!( + Token::I64(1), + Source::get(&map, Key::from_str("a")).unwrap().to_token() + ); + } + + #[test] + fn btree_map() { + let mut map = BTreeMap::new(); + map.insert("a", 1); + map.insert("b", 2); + + assert_eq!(2, Source::count(&map)); + assert_eq!( + Token::I64(1), + Source::get(&map, Key::from_str("a")).unwrap().to_token() + ); + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use kv::value::test::Token; + + #[test] + fn source_is_object_safe() { + fn _check(_: &Source) {} + } + + #[test] + fn visitor_is_object_safe() { + fn _check(_: &Visitor) {} + } + + #[test] + fn count() { + struct OnePair { + key: &'static str, + value: i32, + } + + impl Source for OnePair { + fn visit<'kvs>(&'kvs self, visitor: &mut Visitor<'kvs>) -> Result<(), Error> { + visitor.visit_pair(self.key.to_key(), self.value.to_value()) + } + } + + assert_eq!(1, Source::count(&("a", 1))); + assert_eq!(2, Source::count(&[("a", 1), ("b", 2)] as &[_])); + assert_eq!(0, Source::count(&Option::None::<(&str, i32)>)); + assert_eq!(1, Source::count(&OnePair { key: "a", value: 1 })); + } + + #[test] + fn get() { + let source = &[("a", 1), ("b", 2), ("a", 1)] as &[_]; + assert_eq!( + Token::I64(1), + Source::get(source, Key::from_str("a")).unwrap().to_token() + ); + assert_eq!( + Token::I64(2), + Source::get(source, Key::from_str("b")).unwrap().to_token() + ); + assert!(Source::get(&source, Key::from_str("c")).is_none()); + + let source = Option::None::<(&str, i32)>; + assert!(Source::get(&source, Key::from_str("a")).is_none()); + } +} diff -Nru cargo-0.35.0/vendor/log/src/kv/value/impls.rs cargo-0.37.0/vendor/log/src/kv/value/impls.rs --- cargo-0.35.0/vendor/log/src/kv/value/impls.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/log/src/kv/value/impls.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,269 @@ +use std::fmt; + +use super::{ToValue, Value, Primitive}; + +impl ToValue for usize { + fn to_value(&self) -> Value { + Value::from(*self) + } +} + +impl<'v> From for Value<'v> { + fn from(value: usize) -> Self { + Value::from_primitive(Primitive::Unsigned(value as u64)) + } +} + +impl ToValue for isize { + fn to_value(&self) -> Value { + Value::from(*self) + } +} + +impl<'v> From for Value<'v> { + fn from(value: isize) -> Self { + Value::from_primitive(Primitive::Signed(value as i64)) + } +} + +impl ToValue for u8 { + fn to_value(&self) -> Value { + Value::from(*self) + } +} + +impl<'v> From for Value<'v> { + fn from(value: u8) -> Self { + Value::from_primitive(Primitive::Unsigned(value as u64)) + } +} + +impl ToValue for u16 { + fn to_value(&self) -> Value { + Value::from(*self) + } +} + +impl<'v> From for Value<'v> { + fn from(value: u16) -> Self { + Value::from_primitive(Primitive::Unsigned(value as u64)) + } +} + +impl ToValue for u32 { + fn to_value(&self) -> Value { + Value::from(*self) + } +} + +impl<'v> From for Value<'v> { + fn from(value: u32) -> Self { + Value::from_primitive(Primitive::Unsigned(value as u64)) + } +} + +impl ToValue for u64 { + fn to_value(&self) -> Value { + Value::from(*self) + } +} + +impl<'v> From for Value<'v> { + fn from(value: u64) -> Self { + Value::from_primitive(Primitive::Unsigned(value)) + } +} + +impl ToValue for i8 { + fn to_value(&self) -> Value { + Value::from(*self) + } +} + +impl<'v> From for Value<'v> { + fn from(value: i8) -> Self { + Value::from_primitive(Primitive::Signed(value as i64)) + } +} + +impl ToValue for i16 { + fn to_value(&self) -> Value { + Value::from(*self) + } +} + +impl<'v> From for Value<'v> { + fn from(value: i16) -> Self { + Value::from_primitive(Primitive::Signed(value as i64)) + } +} + +impl ToValue for i32 { + fn to_value(&self) -> Value { + Value::from(*self) + } +} + +impl<'v> From for Value<'v> { + fn from(value: i32) -> Self { + Value::from_primitive(Primitive::Signed(value as i64)) + } +} + +impl ToValue for i64 { + fn to_value(&self) -> Value { + Value::from(*self) + } +} + +impl<'v> From for Value<'v> { + fn from(value: i64) -> Self { + Value::from_primitive(Primitive::Signed(value)) + } +} + +impl ToValue for f32 { + fn to_value(&self) -> Value { + Value::from(*self) + } +} + +impl<'v> From for Value<'v> { + fn from(value: f32) -> Self { + Value::from_primitive(Primitive::Float(value as f64)) + } +} + +impl ToValue for f64 { + fn to_value(&self) -> Value { + Value::from(*self) + } +} + +impl<'v> From for Value<'v> { + fn from(value: f64) -> Self { + Value::from_primitive(Primitive::Float(value)) + } +} + +impl ToValue for bool { + fn to_value(&self) -> Value { + Value::from(*self) + } +} + +impl<'v> From for Value<'v> { + fn from(value: bool) -> Self { + Value::from_primitive(Primitive::Bool(value)) + } +} + +impl ToValue for char { + fn to_value(&self) -> Value { + Value::from(*self) + } +} + +impl<'v> From for Value<'v> { + fn from(value: char) -> Self { + Value::from_primitive(Primitive::Char(value)) + } +} + +impl<'v> ToValue for &'v str { + fn to_value(&self) -> Value { + Value::from(*self) + } +} + +impl<'v> From<&'v str> for Value<'v> { + fn from(value: &'v str) -> Self { + Value::from_primitive(Primitive::Str(value)) + } +} + +impl ToValue for () { + fn to_value(&self) -> Value { + Value::from_primitive(Primitive::None) + } +} + +impl ToValue for Option +where + T: ToValue, +{ + fn to_value(&self) -> Value { + match *self { + Some(ref value) => value.to_value(), + None => Value::from_primitive(Primitive::None), + } + } +} + +impl<'v> ToValue for fmt::Arguments<'v> { + fn to_value(&self) -> Value { + Value::from_debug(self) + } +} + +#[cfg(feature = "std")] +mod std_support { + use super::*; + + use std::borrow::Cow; + + impl ToValue for Box + where + T: ToValue + ?Sized, + { + fn to_value(&self) -> Value { + (**self).to_value() + } + } + + impl ToValue for String { + fn to_value(&self) -> Value { + Value::from_primitive(Primitive::Str(&*self)) + } + } + + impl<'v> ToValue for Cow<'v, str> { + fn to_value(&self) -> Value { + Value::from_primitive(Primitive::Str(&*self)) + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use kv::value::test::Token; + + #[test] + fn test_to_value_display() { + assert_eq!(42u64.to_value().to_str_buf(), "42"); + assert_eq!(42i64.to_value().to_str_buf(), "42"); + assert_eq!(42.01f64.to_value().to_str_buf(), "42.01"); + assert_eq!(true.to_value().to_str_buf(), "true"); + assert_eq!('a'.to_value().to_str_buf(), "'a'"); + assert_eq!(format_args!("a {}", "value").to_value().to_str_buf(), "a value"); + assert_eq!("a loong string".to_value().to_str_buf(), "\"a loong string\""); + assert_eq!(Some(true).to_value().to_str_buf(), "true"); + assert_eq!(().to_value().to_str_buf(), "None"); + assert_eq!(Option::None::.to_value().to_str_buf(), "None"); + } + + #[test] + fn test_to_value_structured() { + assert_eq!(42u64.to_value().to_token(), Token::U64(42)); + assert_eq!(42i64.to_value().to_token(), Token::I64(42)); + assert_eq!(42.01f64.to_value().to_token(), Token::F64(42.01)); + assert_eq!(true.to_value().to_token(), Token::Bool(true)); + assert_eq!('a'.to_value().to_token(), Token::Char('a')); + assert_eq!(format_args!("a {}", "value").to_value().to_token(), Token::Str("a value".into())); + assert_eq!("a loong string".to_value().to_token(), Token::Str("a loong string".into())); + assert_eq!(Some(true).to_value().to_token(), Token::Bool(true)); + assert_eq!(().to_value().to_token(), Token::None); + assert_eq!(Option::None::.to_value().to_token(), Token::None); + } +} diff -Nru cargo-0.35.0/vendor/log/src/kv/value/internal.rs cargo-0.37.0/vendor/log/src/kv/value/internal.rs --- cargo-0.35.0/vendor/log/src/kv/value/internal.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/log/src/kv/value/internal.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,108 @@ +use std::fmt; + +use super::{Fill, Slot, Error}; + +// `Visit` and `Visitor` is an internal API for visiting the structure of a value. +// It's not intended to be public (at this stage). +// +// Right now we only have an implementation for `std::fmt`, but +// this trait makes it possible to add more structured backends like +// `serde` that can retain that original structure. + +/// A container for a structured value for a specific kind of visitor. +#[derive(Clone, Copy)] +pub(super) enum Inner<'v> { + /// A simple primitive value that can be copied without allocating. + Primitive(Primitive<'v>), + /// A value that can be filled. + Fill(&'v Fill), + /// A debuggable value. + Debug(&'v fmt::Debug), + /// A displayable value. + Display(&'v fmt::Display), +} + +impl<'v> Inner<'v> { + pub(super) fn visit(&self, visitor: &mut Visitor) -> Result<(), Error> { + match *self { + Inner::Primitive(value) => match value { + Primitive::Signed(value) => visitor.i64(value), + Primitive::Unsigned(value) => visitor.u64(value), + Primitive::Float(value) => visitor.f64(value), + Primitive::Bool(value) => visitor.bool(value), + Primitive::Char(value) => visitor.char(value), + Primitive::Str(value) => visitor.str(value), + Primitive::None => visitor.none(), + }, + Inner::Fill(value) => value.fill(&mut Slot::new(visitor)), + Inner::Debug(value) => visitor.debug(value), + Inner::Display(value) => visitor.display(value), + } + } +} + +/// The internal serialization contract. +pub(super) trait Visitor { + fn debug(&mut self, v: &fmt::Debug) -> Result<(), Error>; + fn display(&mut self, v: &fmt::Display) -> Result<(), Error> { + self.debug(&format_args!("{}", v)) + } + + fn u64(&mut self, v: u64) -> Result<(), Error>; + fn i64(&mut self, v: i64) -> Result<(), Error>; + fn f64(&mut self, v: f64) -> Result<(), Error>; + fn bool(&mut self, v: bool) -> Result<(), Error>; + fn char(&mut self, v: char) -> Result<(), Error>; + fn str(&mut self, v: &str) -> Result<(), Error>; + fn none(&mut self) -> Result<(), Error>; +} + +#[derive(Clone, Copy)] +pub(super) enum Primitive<'v> { + Signed(i64), + Unsigned(u64), + Float(f64), + Bool(bool), + Char(char), + Str(&'v str), + None, +} + +/// A visitor for `std::fmt`. +pub(super) struct FmtVisitor<'a, 'b: 'a>(pub(super) &'a mut fmt::Formatter<'b>); + +impl<'a, 'b: 'a> Visitor for FmtVisitor<'a, 'b> { + fn debug(&mut self, v: &fmt::Debug) -> Result<(), Error> { + v.fmt(self.0)?; + + Ok(()) + } + + fn u64(&mut self, v: u64) -> Result<(), Error> { + self.debug(&format_args!("{:?}", v)) + } + + fn i64(&mut self, v: i64) -> Result<(), Error> { + self.debug(&format_args!("{:?}", v)) + } + + fn f64(&mut self, v: f64) -> Result<(), Error> { + self.debug(&format_args!("{:?}", v)) + } + + fn bool(&mut self, v: bool) -> Result<(), Error> { + self.debug(&format_args!("{:?}", v)) + } + + fn char(&mut self, v: char) -> Result<(), Error> { + self.debug(&format_args!("{:?}", v)) + } + + fn str(&mut self, v: &str) -> Result<(), Error> { + self.debug(&format_args!("{:?}", v)) + } + + fn none(&mut self) -> Result<(), Error> { + self.debug(&format_args!("None")) + } +} diff -Nru cargo-0.35.0/vendor/log/src/kv/value/mod.rs cargo-0.37.0/vendor/log/src/kv/value/mod.rs --- cargo-0.35.0/vendor/log/src/kv/value/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/log/src/kv/value/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,191 @@ +//! Structured values. + +use std::fmt; + +mod internal; +mod impls; + +#[cfg(test)] +pub(in kv) mod test; + +pub use kv::Error; + +use self::internal::{Inner, Visitor, Primitive}; + +/// A type that can be converted into a [`Value`](struct.Value.html). +pub trait ToValue { + /// Perform the conversion. + fn to_value(&self) -> Value; +} + +impl<'a, T> ToValue for &'a T +where + T: ToValue + ?Sized, +{ + fn to_value(&self) -> Value { + (**self).to_value() + } +} + +impl<'v> ToValue for Value<'v> { + fn to_value(&self) -> Value { + Value { + inner: self.inner, + } + } +} + +/// A type that requires extra work to convert into a [`Value`](struct.Value.html). +/// +/// This trait is a more advanced initialization API than [`ToValue`](trait.ToValue.html). +/// It's intended for erased values coming from other logging frameworks that may need +/// to perform extra work to determine the concrete type to use. +pub trait Fill { + /// Fill a value. + fn fill(&self, slot: &mut Slot) -> Result<(), Error>; +} + +impl<'a, T> Fill for &'a T +where + T: Fill + ?Sized, +{ + fn fill(&self, slot: &mut Slot) -> Result<(), Error> { + (**self).fill(slot) + } +} + +/// A value slot to fill using the [`Fill`](trait.Fill.html) trait. +pub struct Slot<'a> { + filled: bool, + visitor: &'a mut Visitor, +} + +impl<'a> fmt::Debug for Slot<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Slot").finish() + } +} + +impl<'a> Slot<'a> { + fn new(visitor: &'a mut Visitor) -> Self { + Slot { + visitor, + filled: false, + } + } + + /// Fill the slot with a value. + /// + /// The given value doesn't need to satisfy any particular lifetime constraints. + /// + /// # Panics + /// + /// Calling `fill` more than once will panic. + pub fn fill(&mut self, value: Value) -> Result<(), Error> { + assert!(!self.filled, "the slot has already been filled"); + self.filled = true; + + value.visit(self.visitor) + } +} + +/// A value in a structured key-value pair. +pub struct Value<'v> { + inner: Inner<'v>, +} + +impl<'v> Value<'v> { + /// Get a value from an internal `Visit`. + fn from_primitive(value: Primitive<'v>) -> Self { + Value { + inner: Inner::Primitive(value), + } + } + + /// Get a value from a debuggable type. + pub fn from_debug(value: &'v T) -> Self + where + T: fmt::Debug, + { + Value { + inner: Inner::Debug(value), + } + } + + /// Get a value from a displayable type. + pub fn from_display(value: &'v T) -> Self + where + T: fmt::Display, + { + Value { + inner: Inner::Display(value), + } + } + + /// Get a value from a fillable slot. + pub fn from_fill(value: &'v T) -> Self + where + T: Fill, + { + Value { + inner: Inner::Fill(value), + } + } + + fn visit(&self, visitor: &mut Visitor) -> Result<(), Error> { + self.inner.visit(visitor) + } +} + +impl<'v> fmt::Debug for Value<'v> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.visit(&mut self::internal::FmtVisitor(f))?; + + Ok(()) + } +} + +impl<'v> fmt::Display for Value<'v> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.visit(&mut self::internal::FmtVisitor(f))?; + + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn fill_value() { + struct TestFill; + + impl Fill for TestFill { + fn fill(&self, slot: &mut Slot) -> Result<(), Error> { + let dbg: &fmt::Debug = &1; + + slot.fill(Value::from_debug(&dbg)) + } + } + + assert_eq!("1", Value::from_fill(&TestFill).to_str_buf()); + } + + #[test] + #[should_panic] + fn fill_multiple_times_panics() { + struct BadFill; + + impl Fill for BadFill { + fn fill(&self, slot: &mut Slot) -> Result<(), Error> { + slot.fill(42.into())?; + slot.fill(6789.into())?; + + Ok(()) + } + } + + let _ = Value::from_fill(&BadFill).to_str_buf(); + } +} diff -Nru cargo-0.35.0/vendor/log/src/kv/value/test.rs cargo-0.37.0/vendor/log/src/kv/value/test.rs --- cargo-0.35.0/vendor/log/src/kv/value/test.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/log/src/kv/value/test.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,162 @@ +// Test support for inspecting Values + +use std::fmt::{self, Write}; +use std::str; + +use super::{Value, Error}; +use super::internal::Visitor; + +#[derive(Debug, PartialEq)] +pub(in kv) enum Token { + U64(u64), + I64(i64), + F64(f64), + Char(char), + Bool(bool), + Str(StrBuf), + None, +} + +#[derive(Debug, PartialEq)] +pub(in kv) struct StrBuf { + buf: [u8; 16], + len: usize, +} + +impl<'a> From<&'a str> for StrBuf { + fn from(s: &'a str) -> Self { + let mut buf = Buffer::new(); + write!(&mut buf, "{}", s).unwrap(); + + buf.into_str_buf() + } +} + +impl PartialEq for StrBuf { + fn eq(&self, other: &str) -> bool { + self.as_ref() == other + } +} + +impl<'a> PartialEq<&'a str> for StrBuf { + fn eq(&self, other: &&'a str) -> bool { + self.as_ref() == *other + } +} + +impl<'a> PartialEq for &'a str { + fn eq(&self, other: &StrBuf) -> bool { + *self == other.as_ref() + } +} + +impl AsRef for StrBuf { + fn as_ref(&self) -> &str { + str::from_utf8(&self.buf[0..self.len]).unwrap() + } +} + +#[cfg(test)] +impl<'v> Value<'v> { + pub(in kv) fn to_token(&self) -> Token { + struct TestVisitor(Option); + + impl Visitor for TestVisitor { + fn debug(&mut self, v: &fmt::Debug) -> Result<(), Error> { + let mut buf = Buffer::new(); + write!(&mut buf, "{:?}", v)?; + + self.0 = Some(Token::Str(buf.into_str_buf())); + Ok(()) + } + + fn u64(&mut self, v: u64) -> Result<(), Error> { + self.0 = Some(Token::U64(v)); + Ok(()) + } + + fn i64(&mut self, v: i64) -> Result<(), Error> { + self.0 = Some(Token::I64(v)); + Ok(()) + } + + fn f64(&mut self, v: f64) -> Result<(), Error> { + self.0 = Some(Token::F64(v)); + Ok(()) + } + + fn bool(&mut self, v: bool) -> Result<(), Error> { + self.0 = Some(Token::Bool(v)); + Ok(()) + } + + fn char(&mut self, v: char) -> Result<(), Error> { + self.0 = Some(Token::Char(v)); + Ok(()) + } + + fn str(&mut self, v: &str) -> Result<(), Error> { + self.0 = Some(Token::Str(v.into())); + Ok(()) + } + + fn none(&mut self) -> Result<(), Error> { + self.0 = Some(Token::None); + Ok(()) + } + } + + let mut visitor = TestVisitor(None); + self.visit(&mut visitor).unwrap(); + + visitor.0.unwrap() + } + + pub(in kv) fn to_str_buf(&self) -> StrBuf { + let mut buf = Buffer::new(); + write!(&mut buf, "{}", self).unwrap(); + + buf.into_str_buf() + } +} + +// A quick-and-dirty no-std buffer +// to write strings into +struct Buffer { + buf: [u8; 16], + len: usize, +} + +impl Buffer { + fn new() -> Self { + Buffer { + buf: [0; 16], + len: 0, + } + } + + fn into_str_buf(self) -> StrBuf { + StrBuf { + buf: self.buf, + len: self.len, + } + } +} + +impl Write for Buffer { + fn write_str(&mut self, s: &str) -> fmt::Result { + let bytes = s.as_bytes(); + + let end = self.len + bytes.len(); + + if end > 16 { + panic!("`{}` would overflow", s); + } + + let buf = &mut self.buf[self.len..end]; + buf.copy_from_slice(bytes); + self.len = end; + + Ok(()) + } +} diff -Nru cargo-0.35.0/vendor/log/src/lib.rs cargo-0.37.0/vendor/log/src/lib.rs --- cargo-0.35.0/vendor/log/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/log/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -48,14 +48,12 @@ //! //! ### Examples //! -//! ```rust -//! # #![allow(unstable)] -//! #[macro_use] -//! extern crate log; -//! +//! ```edition2018 //! # #[derive(Debug)] pub struct Yak(String); //! # impl Yak { fn shave(&mut self, _: u32) {} } //! # fn find_a_razor() -> Result { Ok(1) } +//! use log::{info, warn}; +//! //! pub fn shave_the_yak(yak: &mut Yak) { //! info!(target: "yak_events", "Commencing yak shaving for {:?}", yak); //! @@ -115,9 +113,7 @@ //! logs all messages at the [`Error`][level_link], [`Warn`][level_link] or //! [`Info`][level_link] levels to stdout: //! -//! ```rust -//! extern crate log; -//! +//! ```edition2018 //! use log::{Record, Level, Metadata}; //! //! struct SimpleLogger; @@ -150,8 +146,7 @@ //! provide a function that wraps a call to [`set_logger`] and //! [`set_max_level`], handling initialization of the logger: //! -//! ```rust -//! # extern crate log; +//! ```edition2018 //! # use log::{Level, Metadata}; //! # struct SimpleLogger; //! # impl log::Log for SimpleLogger { @@ -181,8 +176,7 @@ //! identical to `set_logger` except that it takes a `Box` rather than a //! `&'static Log`: //! -//! ```rust -//! # extern crate log; +//! ```edition2018 //! # use log::{Level, LevelFilter, Log, SetLoggerError, Metadata}; //! # struct SimpleLogger; //! # impl log::Log for SimpleLogger { @@ -221,6 +215,9 @@ //! These features control the value of the `STATIC_MAX_LEVEL` constant. The logging macros check //! this value before logging a message. By default, no levels are disabled. //! +//! Libraries should avoid using the max level features because they're global and can't be changed +//! once they're set. +//! //! For example, a crate can disable trace level logs in debug builds and trace, debug, and info //! level logs in release builds with the following configuration: //! @@ -270,7 +267,7 @@ #![doc( html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://www.rust-lang.org/favicon.ico", - html_root_url = "https://docs.rs/log/0.4.6" + html_root_url = "https://docs.rs/log/0.4.7" )] #![warn(missing_docs)] #![deny(missing_debug_implementations)] @@ -292,15 +289,26 @@ use std::fmt; use std::mem; use std::str::FromStr; -use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; +use std::sync::atomic::{AtomicUsize, Ordering}; + +// FIXME: ATOMIC_USIZE_INIT was deprecated in rust 1.34. Silence the +// deprecation warning until our MSRV >= 1.24, where we can use the +// replacement const fn `AtomicUsize::new` +#[allow(deprecated)] +use std::sync::atomic::ATOMIC_USIZE_INIT; #[macro_use] mod macros; mod serde; +#[cfg(feature = "kv_unstable")] +pub mod kv; + // The LOGGER static holds a pointer to the global logger. It is protected by // the STATE static which determines whether LOGGER has been initialized yet. static mut LOGGER: &'static Log = &NopLogger; + +#[allow(deprecated)] static STATE: AtomicUsize = ATOMIC_USIZE_INIT; // There are three different states that we care about: the logger's @@ -310,6 +318,7 @@ const INITIALIZING: usize = 1; const INITIALIZED: usize = 2; +#[allow(deprecated)] static MAX_LOG_LEVEL_FILTER: AtomicUsize = ATOMIC_USIZE_INIT; static LOG_LEVEL_NAMES: [&'static str; 6] = ["OFF", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"]; @@ -629,7 +638,7 @@ impl fmt::Display for LevelFilter { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - write!(fmt, "{}", LOG_LEVEL_NAMES[*self as usize]) + fmt.pad(LOG_LEVEL_NAMES[*self as usize]) } } @@ -678,8 +687,7 @@ /// The following example shows a simple logger that displays the level, /// module path, and message of any `Record` that is passed to it. /// -/// ```rust -/// # extern crate log; +/// ```edition2018 /// struct SimpleLogger; /// /// impl log::Log for SimpleLogger { @@ -713,6 +721,25 @@ module_path: Option<&'a str>, file: Option<&'a str>, line: Option, + #[cfg(feature = "kv_unstable")] + key_values: KeyValues<'a>, +} + +// This wrapper type is only needed so we can +// `#[derive(Debug)]` on `Record`. It also +// provides a useful `Debug` implementation for +// the underlying `Source`. +#[cfg(feature = "kv_unstable")] +#[derive(Clone)] +struct KeyValues<'a>(&'a kv::Source); + +#[cfg(feature = "kv_unstable")] +impl<'a> fmt::Debug for KeyValues<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let mut visitor = f.debug_map(); + self.0.visit(&mut visitor)?; + visitor.finish() + } } impl<'a> Record<'a> { @@ -763,6 +790,47 @@ pub fn line(&self) -> Option { self.line } + + /// The structued key-value pairs associated with the message. + #[cfg(feature = "kv_unstable")] + #[inline] + pub fn key_values(&self) -> &kv::Source { + self.key_values.0 + } + + /// Create a new [`Builder`](struct.Builder.html) based on this record. + #[cfg(feature = "kv_unstable")] + #[inline] + pub fn to_builder(&self) -> RecordBuilder { + #[cfg(feature = "kv_unstable")] + return RecordBuilder { + record: Record { + metadata: Metadata { + level: self.metadata.level, + target: self.metadata.target, + }, + args: self.args, + module_path: self.module_path, + file: self.file, + line: self.line, + key_values: self.key_values.clone(), + } + }; + + #[cfg(not(feature = "kv_unstable"))] + return RecordBuilder { + record: Record { + metadata: Metadata { + level: self.metadata.level, + target: self.metadata.target, + }, + args: self.args, + module_path: self.module_path, + file: self.file, + line: self.line, + } + }; + } } /// Builder for [`Record`](struct.Record.html). @@ -774,7 +842,7 @@ /// # Examples /// /// -/// ```rust +/// ```edition2018 /// use log::{Level, Record}; /// /// let record = Record::builder() @@ -789,7 +857,7 @@ /// /// Alternatively, use [`MetadataBuilder`](struct.MetadataBuilder.html): /// -/// ```rust +/// ```edition2018 /// use log::{Record, Level, MetadataBuilder}; /// /// let error_metadata = MetadataBuilder::new() @@ -825,15 +893,28 @@ /// [`Metadata::builder().build()`]: struct.MetadataBuilder.html#method.build #[inline] pub fn new() -> RecordBuilder<'a> { - RecordBuilder { + #[cfg(feature = "kv_unstable")] + return RecordBuilder { record: Record { args: format_args!(""), metadata: Metadata::builder().build(), module_path: None, file: None, line: None, + key_values: KeyValues(&Option::None::<(kv::Key, kv::Value)>), }, - } + }; + + #[cfg(not(feature = "kv_unstable"))] + return RecordBuilder { + record: Record { + args: format_args!(""), + metadata: Metadata::builder().build(), + module_path: None, + file: None, + line: None, + }, + }; } /// Set [`args`](struct.Record.html#method.args). @@ -885,6 +966,14 @@ self } + /// Set [`key_values`](struct.Record.html#method.key_values) + #[cfg(feature = "kv_unstable")] + #[inline] + pub fn key_values(&mut self, kvs: &'a kv::Source) -> &mut RecordBuilder<'a> { + self.record.key_values = KeyValues(kvs); + self + } + /// Invoke the builder and return a `Record` #[inline] pub fn build(&self) -> Record<'a> { @@ -910,10 +999,7 @@ /// /// # Examples /// -/// ```rust -/// # #[macro_use] -/// # extern crate log; -/// # +/// ```edition2018 /// use log::{Record, Level, Metadata}; /// /// struct MyLogger; @@ -967,7 +1053,7 @@ /// /// # Example /// -/// ```rust +/// ```edition2018 /// let target = "myApp"; /// use log::{Level, MetadataBuilder}; /// let metadata = MetadataBuilder::new() @@ -1090,7 +1176,7 @@ /// An error is returned if a logger has already been set. /// /// [`set_logger`]: fn.set_logger.html -#[cfg(feature = "std")] +#[cfg(all(feature = "std", atomic_cas))] pub fn set_boxed_logger(logger: Box) -> Result<(), SetLoggerError> { set_logger_inner(|| unsafe { &*Box::into_raw(logger) }) } @@ -1104,17 +1190,21 @@ /// implementations should provide an initialization method that installs the /// logger internally. /// +/// # Availability +/// +/// This method is available even when the `std` feature is disabled. However, +/// it is currently unavailable on `thumbv6` targets, which lack support for +/// some atomic operations which are used by this function. Even on those +/// targets, [`set_logger_racy`] will be available. +/// /// # Errors /// /// An error is returned if a logger has already been set. /// /// # Examples /// -/// ```rust -/// # #[macro_use] -/// # extern crate log; -/// # -/// use log::{Record, Level, Metadata, LevelFilter}; +/// ```edition2018 +/// use log::{error, info, warn, Record, Level, Metadata, LevelFilter}; /// /// static MY_LOGGER: MyLogger = MyLogger; /// @@ -1142,10 +1232,14 @@ /// error!("oops"); /// # } /// ``` +/// +/// [`set_logger_racy`]: fn.set_logger_racy.html +#[cfg(atomic_cas)] pub fn set_logger(logger: &'static Log) -> Result<(), SetLoggerError> { set_logger_inner(|| logger) } +#[cfg(atomic_cas)] fn set_logger_inner(make_logger: F) -> Result<(), SetLoggerError> where F: FnOnce() -> &'static Log, @@ -1166,6 +1260,40 @@ } } +/// A thread-unsafe version of [`set_logger`]. +/// +/// This function is available on all platforms, even those that do not have +/// support for atomics that is needed by [`set_logger`]. +/// +/// In almost all cases, [`set_logger`] should be preferred. +/// +/// # Safety +/// +/// This function is only safe to call when no other logger initialization +/// function is called while this function still executes. +/// +/// This can be upheld by (for example) making sure that **there are no other +/// threads**, and (on embedded) that **interrupts are disabled**. +/// +/// It is safe to use other logging functions while this function runs +/// (including all logging macros). +/// +/// [`set_logger`]: fn.set_logger.html +pub unsafe fn set_logger_racy(logger: &'static Log) -> Result<(), SetLoggerError> { + match STATE.load(Ordering::SeqCst) { + UNINITIALIZED => { + LOGGER = logger; + STATE.store(INITIALIZED, Ordering::SeqCst); + Ok(()) + } + INITIALIZING => { + // This is just plain UB, since we were racing another initialization function + unreachable!("set_logger_racy must not be used with other initialization functions") + } + _ => Err(SetLoggerError(())), + } +} + /// The type returned by [`set_logger`] if [`set_logger`] has already been called. /// /// [`set_logger`]: fn.set_logger.html @@ -1466,4 +1594,42 @@ assert_eq!(record_test.file(), Some("bar")); assert_eq!(record_test.line(), Some(30)); } + + #[test] + #[cfg(feature = "kv_unstable")] + fn test_record_key_values_builder() { + use super::Record; + use kv::{self, Visitor}; + + struct TestVisitor { + seen_pairs: usize, + } + + impl<'kvs> Visitor<'kvs> for TestVisitor { + fn visit_pair( + &mut self, + _: kv::Key<'kvs>, + _: kv::Value<'kvs> + ) -> Result<(), kv::Error> { + self.seen_pairs += 1; + Ok(()) + } + } + + let kvs: &[(&str, i32)] = &[ + ("a", 1), + ("b", 2) + ]; + let record_test = Record::builder() + .key_values(&kvs) + .build(); + + let mut visitor = TestVisitor { + seen_pairs: 0, + }; + + record_test.key_values().visit(&mut visitor).unwrap(); + + assert_eq!(2, visitor.seen_pairs); + } } diff -Nru cargo-0.35.0/vendor/log/src/macros.rs cargo-0.37.0/vendor/log/src/macros.rs --- cargo-0.35.0/vendor/log/src/macros.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/log/src/macros.rs 2019-07-17 05:42:23.000000000 +0000 @@ -15,10 +15,8 @@ /// /// # Examples /// -/// ```rust -/// # #[macro_use] -/// # extern crate log; -/// use log::Level; +/// ```edition2018 +/// use log::{log, Level}; /// /// # fn main() { /// let data = (42, "Forty-two"); @@ -48,9 +46,9 @@ /// /// # Examples /// -/// ```rust -/// # #[macro_use] -/// # extern crate log; +/// ```edition2018 +/// use log::error; +/// /// # fn main() { /// let (err_info, port) = ("No connection", 22); /// @@ -60,11 +58,11 @@ /// ``` #[macro_export(local_inner_macros)] macro_rules! error { - (target: $target:expr, $($arg:tt)*) => ( - log!(target: $target, $crate::Level::Error, $($arg)*); + (target: $target:expr, $($arg:tt)+) => ( + log!(target: $target, $crate::Level::Error, $($arg)+); ); - ($($arg:tt)*) => ( - log!($crate::Level::Error, $($arg)*); + ($($arg:tt)+) => ( + log!($crate::Level::Error, $($arg)+); ) } @@ -72,9 +70,9 @@ /// /// # Examples /// -/// ```rust -/// # #[macro_use] -/// # extern crate log; +/// ```edition2018 +/// use log::warn; +/// /// # fn main() { /// let warn_description = "Invalid Input"; /// @@ -84,11 +82,11 @@ /// ``` #[macro_export(local_inner_macros)] macro_rules! warn { - (target: $target:expr, $($arg:tt)*) => ( - log!(target: $target, $crate::Level::Warn, $($arg)*); + (target: $target:expr, $($arg:tt)+) => ( + log!(target: $target, $crate::Level::Warn, $($arg)+); ); - ($($arg:tt)*) => ( - log!($crate::Level::Warn, $($arg)*); + ($($arg:tt)+) => ( + log!($crate::Level::Warn, $($arg)+); ) } @@ -96,9 +94,9 @@ /// /// # Examples /// -/// ```rust -/// # #[macro_use] -/// # extern crate log; +/// ```edition2018 +/// use log::info; +/// /// # fn main() { /// # struct Connection { port: u32, speed: f32 } /// let conn_info = Connection { port: 40, speed: 3.20 }; @@ -110,11 +108,11 @@ /// ``` #[macro_export(local_inner_macros)] macro_rules! info { - (target: $target:expr, $($arg:tt)*) => ( - log!(target: $target, $crate::Level::Info, $($arg)*); + (target: $target:expr, $($arg:tt)+) => ( + log!(target: $target, $crate::Level::Info, $($arg)+); ); - ($($arg:tt)*) => ( - log!($crate::Level::Info, $($arg)*); + ($($arg:tt)+) => ( + log!($crate::Level::Info, $($arg)+); ) } @@ -122,9 +120,9 @@ /// /// # Examples /// -/// ```rust -/// # #[macro_use] -/// # extern crate log; +/// ```edition2018 +/// use log::debug; +/// /// # fn main() { /// # struct Position { x: f32, y: f32 } /// let pos = Position { x: 3.234, y: -1.223 }; @@ -135,11 +133,11 @@ /// ``` #[macro_export(local_inner_macros)] macro_rules! debug { - (target: $target:expr, $($arg:tt)*) => ( - log!(target: $target, $crate::Level::Debug, $($arg)*); + (target: $target:expr, $($arg:tt)+) => ( + log!(target: $target, $crate::Level::Debug, $($arg)+); ); - ($($arg:tt)*) => ( - log!($crate::Level::Debug, $($arg)*); + ($($arg:tt)+) => ( + log!($crate::Level::Debug, $($arg)+); ) } @@ -147,9 +145,9 @@ /// /// # Examples /// -/// ```rust -/// # #[macro_use] -/// # extern crate log; +/// ```edition2018 +/// use log::trace; +/// /// # fn main() { /// # struct Position { x: f32, y: f32 } /// let pos = Position { x: 3.234, y: -1.223 }; @@ -162,11 +160,11 @@ /// ``` #[macro_export(local_inner_macros)] macro_rules! trace { - (target: $target:expr, $($arg:tt)*) => ( - log!(target: $target, $crate::Level::Trace, $($arg)*); + (target: $target:expr, $($arg:tt)+) => ( + log!(target: $target, $crate::Level::Trace, $($arg)+); ); - ($($arg:tt)*) => ( - log!($crate::Level::Trace, $($arg)*); + ($($arg:tt)+) => ( + log!($crate::Level::Trace, $($arg)+); ) } @@ -178,10 +176,9 @@ /// /// # Examples /// -/// ```rust -/// # #[macro_use] -/// # extern crate log; +/// ```edition2018 /// use log::Level::Debug; +/// use log::{debug, log_enabled}; /// /// # fn foo() { /// if log_enabled!(Debug) { diff -Nru cargo-0.35.0/vendor/log/src/serde.rs cargo-0.37.0/vendor/log/src/serde.rs --- cargo-0.35.0/vendor/log/src/serde.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/log/src/serde.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,9 +1,11 @@ #![cfg(feature = "serde")] extern crate serde; +use self::serde::de::{ + Deserialize, DeserializeSeed, Deserializer, EnumAccess, Error, Unexpected, VariantAccess, + Visitor, +}; use self::serde::ser::{Serialize, Serializer}; -use self::serde::de::{Deserialize, DeserializeSeed, Deserializer, Visitor, EnumAccess, - Unexpected, VariantAccess, Error}; use {Level, LevelFilter, LOG_LEVEL_NAMES}; diff -Nru cargo-0.35.0/vendor/log/tests/filters.rs cargo-0.37.0/vendor/log/tests/filters.rs --- cargo-0.35.0/vendor/log/tests/filters.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/log/tests/filters.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,8 +1,8 @@ #[macro_use] extern crate log; +use log::{Level, LevelFilter, Log, Metadata, Record}; use std::sync::{Arc, Mutex}; -use log::{Level, LevelFilter, Log, Record, Metadata}; #[cfg(feature = "std")] use log::set_boxed_logger; @@ -30,7 +30,9 @@ } fn main() { - let me = Arc::new(State { last_log: Mutex::new(None) }); + let me = Arc::new(State { + last_log: Mutex::new(None), + }); let a = me.clone(); set_boxed_logger(Box::new(Logger(me))).unwrap(); @@ -56,7 +58,11 @@ last(&a, t(Level::Trace, filter)); fn t(lvl: Level, filter: LevelFilter) -> Option { - if lvl <= filter { Some(lvl) } else { None } + if lvl <= filter { + Some(lvl) + } else { + None + } } } diff -Nru cargo-0.35.0/vendor/memchr/.cargo-checksum.json cargo-0.37.0/vendor/memchr/.cargo-checksum.json --- cargo-0.35.0/vendor/memchr/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/memchr/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39"} \ No newline at end of file +{"files":{},"package":"88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/memchr/Cargo.toml cargo-0.37.0/vendor/memchr/Cargo.toml --- cargo-0.35.0/vendor/memchr/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/memchr/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,7 +12,7 @@ [package] name = "memchr" -version = "2.2.0" +version = "2.2.1" authors = ["Andrew Gallant ", "bluss"] exclude = ["/ci/*", "/.travis.yml", "/Makefile", "/appveyor.yml"] description = "Safe interface to memchr." diff -Nru cargo-0.35.0/vendor/memchr/README.md cargo-0.37.0/vendor/memchr/README.md --- cargo-0.35.0/vendor/memchr/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/memchr/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -48,3 +48,19 @@ implementation of memchr will be used in compilers that support it. When `use_std` is enabled, the AVX implementation of memchr will be used if the CPU is determined to support it at runtime. + +### Using libc + +`memchr` is a routine that is part of libc, although this crate does not use +libc by default. Instead, it uses its own routines, which are either vectorized +or generic fallback routines. In general, these should be competitive with +what's in libc, although this has not been tested for all architectures. If +using `memchr` from libc is desirable and a vectorized routine is not otherwise +available in this crate, then enabling the `libc` feature will use libc's +version of `memchr`. + +The rest of the functions in this crate, e.g., `memchr2` or `memrchr3`, are not +a standard part of libc, so they will always use the implementations in this +crate. One exception to this is `memrchr`, which is an extension commonly found +on Linux. On Linux, `memrchr` is used in precisely the same scenario as +`memchr`, as described above. diff -Nru cargo-0.35.0/vendor/memchr/src/x86/avx.rs cargo-0.37.0/vendor/memchr/src/x86/avx.rs --- cargo-0.35.0/vendor/memchr/src/x86/avx.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/memchr/src/x86/avx.rs 2019-07-17 05:42:23.000000000 +0000 @@ -642,9 +642,7 @@ fn forward_pos2(mask1: i32, mask2: i32) -> usize { debug_assert!(mask1 != 0 || mask2 != 0); - let i1 = forward_pos(mask1); - let i2 = forward_pos(mask2); - if i1 < i2 { i1 } else { i2 } + forward_pos(mask1 | mask2) } /// Compute the position of the first matching byte from the given masks. The @@ -656,16 +654,7 @@ fn forward_pos3(mask1: i32, mask2: i32, mask3: i32) -> usize { debug_assert!(mask1 != 0 || mask2 != 0 || mask3 != 0); - let i1 = forward_pos(mask1); - let i2 = forward_pos(mask2); - let i3 = forward_pos(mask3); - if i1 < i2 && i1 < i3 { - i1 - } else if i2 < i3 { - i2 - } else { - i3 - } + forward_pos(mask1 | mask2 | mask3) } /// Compute the position of the last matching byte from the given mask. The @@ -691,15 +680,7 @@ fn reverse_pos2(mask1: i32, mask2: i32) -> usize { debug_assert!(mask1 != 0 || mask2 != 0); - if mask1 == 0 { - reverse_pos(mask2) - } else if mask2 == 0 { - reverse_pos(mask1) - } else { - let i1 = reverse_pos(mask1); - let i2 = reverse_pos(mask2); - if i1 > i2 { i1 } else { i2 } - } + reverse_pos(mask1 | mask2) } /// Compute the position of the last matching byte from the given masks. The @@ -711,24 +692,7 @@ fn reverse_pos3(mask1: i32, mask2: i32, mask3: i32) -> usize { debug_assert!(mask1 != 0 || mask2 != 0 || mask3 != 0); - if mask1 == 0 { - reverse_pos2(mask2, mask3) - } else if mask2 == 0 { - reverse_pos2(mask1, mask3) - } else if mask3 == 0 { - reverse_pos2(mask1, mask2) - } else { - let i1 = reverse_pos(mask1); - let i2 = reverse_pos(mask2); - let i3 = reverse_pos(mask3); - if i1 > i2 && i1 > i3 { - i1 - } else if i2 > i3 { - i2 - } else { - i3 - } - } + reverse_pos(mask1 | mask2 | mask3) } /// Subtract `b` from `a` and return the difference. `a` should be greater than diff -Nru cargo-0.35.0/vendor/memchr/src/x86/mod.rs cargo-0.37.0/vendor/memchr/src/x86/mod.rs --- cargo-0.35.0/vendor/memchr/src/x86/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/memchr/src/x86/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -59,7 +59,7 @@ }} } -// When std isn't enable (which provides runtime CPU feature detection), or if +// When std isn't available to provide runtime CPU feature detection, or if // runtime CPU feature detection has been explicitly disabled, then just call // our optimized SSE2 routine directly. SSE2 is avalbale on all x86_64 targets, // so no CPU feature detection is necessary. diff -Nru cargo-0.35.0/vendor/memchr/src/x86/sse2.rs cargo-0.37.0/vendor/memchr/src/x86/sse2.rs --- cargo-0.35.0/vendor/memchr/src/x86/sse2.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/memchr/src/x86/sse2.rs 2019-07-17 05:42:23.000000000 +0000 @@ -730,9 +730,7 @@ fn forward_pos2(mask1: i32, mask2: i32) -> usize { debug_assert!(mask1 != 0 || mask2 != 0); - let i1 = forward_pos(mask1); - let i2 = forward_pos(mask2); - if i1 < i2 { i1 } else { i2 } + forward_pos(mask1 | mask2) } /// Compute the position of the first matching byte from the given masks. The @@ -744,16 +742,7 @@ fn forward_pos3(mask1: i32, mask2: i32, mask3: i32) -> usize { debug_assert!(mask1 != 0 || mask2 != 0 || mask3 != 0); - let i1 = forward_pos(mask1); - let i2 = forward_pos(mask2); - let i3 = forward_pos(mask3); - if i1 < i2 && i1 < i3 { - i1 - } else if i2 < i3 { - i2 - } else { - i3 - } + forward_pos(mask1 | mask2 | mask3) } /// Compute the position of the last matching byte from the given mask. The @@ -779,15 +768,7 @@ fn reverse_pos2(mask1: i32, mask2: i32) -> usize { debug_assert!(mask1 != 0 || mask2 != 0); - if mask1 == 0 { - reverse_pos(mask2) - } else if mask2 == 0 { - reverse_pos(mask1) - } else { - let i1 = reverse_pos(mask1); - let i2 = reverse_pos(mask2); - if i1 > i2 { i1 } else { i2 } - } + reverse_pos(mask1 | mask2) } /// Compute the position of the last matching byte from the given masks. The @@ -799,24 +780,7 @@ fn reverse_pos3(mask1: i32, mask2: i32, mask3: i32) -> usize { debug_assert!(mask1 != 0 || mask2 != 0 || mask3 != 0); - if mask1 == 0 { - reverse_pos2(mask2, mask3) - } else if mask2 == 0 { - reverse_pos2(mask1, mask3) - } else if mask3 == 0 { - reverse_pos2(mask1, mask2) - } else { - let i1 = reverse_pos(mask1); - let i2 = reverse_pos(mask2); - let i3 = reverse_pos(mask3); - if i1 > i2 && i1 > i3 { - i1 - } else if i2 > i3 { - i2 - } else { - i3 - } - } + reverse_pos(mask1 | mask2 | mask3) } /// Subtract `b` from `a` and return the difference. `a` should be greater than diff -Nru cargo-0.35.0/vendor/num_cpus/.cargo-checksum.json cargo-0.37.0/vendor/num_cpus/.cargo-checksum.json --- cargo-0.35.0/vendor/num_cpus/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num_cpus/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba"} \ No newline at end of file +{"files":{},"package":"bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/num_cpus/Cargo.toml cargo-0.37.0/vendor/num_cpus/Cargo.toml --- cargo-0.35.0/vendor/num_cpus/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num_cpus/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,7 +12,7 @@ [package] name = "num_cpus" -version = "1.10.0" +version = "1.10.1" authors = ["Sean McArthur "] description = "Get the number of CPUs on a machine." documentation = "https://docs.rs/num_cpus" @@ -23,3 +23,5 @@ repository = "https://github.com/seanmonstar/num_cpus" [dependencies.libc] version = "0.2.26" +[dev-dependencies.doc-comment] +version = "0.3" diff -Nru cargo-0.35.0/vendor/num_cpus/CHANGELOG.md cargo-0.37.0/vendor/num_cpus/CHANGELOG.md --- cargo-0.35.0/vendor/num_cpus/CHANGELOG.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num_cpus/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -1,3 +1,9 @@ +## v1.10.1 + +#### Fixes + +- improve `haiku` CPU detection + ## v1.10.0 #### Features diff -Nru cargo-0.35.0/vendor/num_cpus/examples/values.rs cargo-0.37.0/vendor/num_cpus/examples/values.rs --- cargo-0.35.0/vendor/num_cpus/examples/values.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/num_cpus/examples/values.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,6 @@ +extern crate num_cpus; + +fn main() { + println!("Logical CPUs: {}", num_cpus::get()); + println!("Physical CPUs: {}", num_cpus::get_physical()); +} diff -Nru cargo-0.35.0/vendor/num_cpus/src/lib.rs cargo-0.37.0/vendor/num_cpus/src/lib.rs --- cargo-0.35.0/vendor/num_cpus/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num_cpus/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -10,38 +10,44 @@ //! for example memory access speeds (for all the caches and RAM) and the physical //! architecture of the processor, so the number of CPUs should be used as a rough guide //! only. -//! +//! //! //! ## Examples //! //! Fetch the number of logical CPUs. -//! +//! //! ``` //! let cpus = num_cpus::get(); //! ``` -//! +//! //! See [`rayon::Threadpool`] for an example of where the number of CPUs could be //! used when setting up parallel jobs (Where the threadpool example uses a fixed //! number 8, it could use the number of CPUs). -//! +//! //! [processor tricks]: https://en.wikipedia.org/wiki/Simultaneous_multithreading //! [`rayon::ThreadPool`]: https://docs.rs/rayon/1.*/rayon/struct.ThreadPool.html #![cfg_attr(test, deny(warnings))] #![deny(missing_docs)] -#![doc(html_root_url = "https://docs.rs/num_cpus/1.10.0")] +#![doc(html_root_url = "https://docs.rs/num_cpus/1.10.1")] #![allow(non_snake_case)] #[cfg(not(windows))] extern crate libc; +#[cfg(test)] +#[macro_use] +extern crate doc_comment; + +#[cfg(test)] +doctest!("../README.md"); /// Returns the number of available CPUs of the current system. -/// +/// /// This function will get the number of logical cores. Sometimes this is different from the number /// of physical cores (See [Simultaneous multithreading on Wikipedia][smt]). -/// +/// /// # Examples -/// +/// /// ``` /// let cpus = num_cpus::get(); /// if cpus > 1 { @@ -55,7 +61,7 @@ /// /// This will check [sched affinity] on Linux, showing a lower number of CPUs if the current /// thread does not have access to all the computer's CPUs. -/// +/// /// [smt]: https://en.wikipedia.org/wiki/Simultaneous_multithreading /// [sched affinity]: http://www.gnu.org/software/libc/manual/html_node/CPU-Affinity.html #[inline] @@ -71,9 +77,9 @@ /// On other platforms, or if the physical count fails on supported platforms, /// this function returns the same as [`get()`], which is the number of logical /// CPUS. -/// +/// /// # Examples -/// +/// /// ``` /// let logical_cpus = num_cpus::get(); /// let physical_cpus = num_cpus::get_physical(); @@ -89,7 +95,7 @@ /// some of the CPUs on our system."); /// } /// ``` -/// +/// /// [`get()`]: fn.get.html #[inline] pub fn get_physical() -> usize { @@ -375,6 +381,57 @@ } } +#[cfg(target_os = "haiku")] +fn get_num_cpus() -> usize { + use std::mem; + + #[allow(non_camel_case_types)] + type bigtime_t = i64; + #[allow(non_camel_case_types)] + type status_t = i32; + + #[repr(C)] + pub struct system_info { + pub boot_time: bigtime_t, + pub cpu_count: u32, + pub max_pages: u64, + pub used_pages: u64, + pub cached_pages: u64, + pub block_cache_pages: u64, + pub ignored_pages: u64, + pub needed_memory: u64, + pub free_memory: u64, + pub max_swap_pages: u64, + pub free_swap_pages: u64, + pub page_faults: u32, + pub max_sems: u32, + pub used_sems: u32, + pub max_ports: u32, + pub used_ports: u32, + pub max_threads: u32, + pub used_threads: u32, + pub max_teams: u32, + pub used_teams: u32, + pub kernel_name: [::std::os::raw::c_char; 256usize], + pub kernel_build_date: [::std::os::raw::c_char; 32usize], + pub kernel_build_time: [::std::os::raw::c_char; 32usize], + pub kernel_version: i64, + pub abi: u32, + } + + extern { + fn get_system_info(info: *mut system_info) -> status_t; + } + + let mut info: system_info = unsafe { mem::uninitialized() }; + let status = unsafe { get_system_info(&mut info as *mut _) }; + if status == 0 { + info.cpu_count as usize + } else { + 1 + } +} + #[cfg(not(any( target_os = "nacl", target_os = "macos", @@ -389,6 +446,7 @@ target_os = "dragonfly", target_os = "bitrig", target_os = "netbsd", + target_os = "haiku", windows, )))] fn get_num_cpus() -> usize { diff -Nru cargo-0.35.0/vendor/num-integer/benches/gcd.rs cargo-0.37.0/vendor/num-integer/benches/gcd.rs --- cargo-0.35.0/vendor/num-integer/benches/gcd.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/num-integer/benches/gcd.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,176 @@ +//! Benchmark comparing the current GCD implemtation against an older one. + +#![feature(test)] + +extern crate num_integer; +extern crate num_traits; +extern crate test; + +use num_integer::Integer; +use num_traits::{AsPrimitive, Bounded, Signed}; +use test::{black_box, Bencher}; + +trait GcdOld: Integer { + fn gcd_old(&self, other: &Self) -> Self; +} + +macro_rules! impl_gcd_old_for_isize { + ($T:ty) => { + impl GcdOld for $T { + /// Calculates the Greatest Common Divisor (GCD) of the number and + /// `other`. The result is always positive. + #[inline] + fn gcd_old(&self, other: &Self) -> Self { + // Use Stein's algorithm + let mut m = *self; + let mut n = *other; + if m == 0 || n == 0 { + return (m | n).abs(); + } + + // find common factors of 2 + let shift = (m | n).trailing_zeros(); + + // The algorithm needs positive numbers, but the minimum value + // can't be represented as a positive one. + // It's also a power of two, so the gcd can be + // calculated by bitshifting in that case + + // Assuming two's complement, the number created by the shift + // is positive for all numbers except gcd = abs(min value) + // The call to .abs() causes a panic in debug mode + if m == Self::min_value() || n == Self::min_value() { + return (1 << shift).abs(); + } + + // guaranteed to be positive now, rest like unsigned algorithm + m = m.abs(); + n = n.abs(); + + // divide n and m by 2 until odd + // m inside loop + n >>= n.trailing_zeros(); + + while m != 0 { + m >>= m.trailing_zeros(); + if n > m { + std::mem::swap(&mut n, &mut m) + } + m -= n; + } + + n << shift + } + } + }; +} + +impl_gcd_old_for_isize!(i8); +impl_gcd_old_for_isize!(i16); +impl_gcd_old_for_isize!(i32); +impl_gcd_old_for_isize!(i64); +impl_gcd_old_for_isize!(isize); +impl_gcd_old_for_isize!(i128); + +macro_rules! impl_gcd_old_for_usize { + ($T:ty) => { + impl GcdOld for $T { + /// Calculates the Greatest Common Divisor (GCD) of the number and + /// `other`. The result is always positive. + #[inline] + fn gcd_old(&self, other: &Self) -> Self { + // Use Stein's algorithm + let mut m = *self; + let mut n = *other; + if m == 0 || n == 0 { + return m | n; + } + + // find common factors of 2 + let shift = (m | n).trailing_zeros(); + + // divide n and m by 2 until odd + // m inside loop + n >>= n.trailing_zeros(); + + while m != 0 { + m >>= m.trailing_zeros(); + if n > m { + std::mem::swap(&mut n, &mut m) + } + m -= n; + } + + n << shift + } + } + }; +} + +impl_gcd_old_for_usize!(u8); +impl_gcd_old_for_usize!(u16); +impl_gcd_old_for_usize!(u32); +impl_gcd_old_for_usize!(u64); +impl_gcd_old_for_usize!(usize); +impl_gcd_old_for_usize!(u128); + +/// Return an iterator that yields all Fibonacci numbers fitting into a u128. +fn fibonacci() -> impl Iterator { + (0..185).scan((0, 1), |&mut (ref mut a, ref mut b), _| { + let tmp = *a; + *a = *b; + *b += tmp; + Some(*b) + }) +} + +fn run_bench(b: &mut Bencher, gcd: fn(&T, &T) -> T) +where + T: AsPrimitive, + u128: AsPrimitive, +{ + let max_value: u128 = T::max_value().as_(); + let pairs: Vec<(T, T)> = fibonacci() + .collect::>() + .windows(2) + .filter(|&pair| pair[0] <= max_value && pair[1] <= max_value) + .map(|pair| (pair[0].as_(), pair[1].as_())) + .collect(); + b.iter(|| { + for &(ref m, ref n) in &pairs { + black_box(gcd(m, n)); + } + }); +} + +macro_rules! bench_gcd { + ($T:ident) => { + mod $T { + use crate::{run_bench, GcdOld}; + use num_integer::Integer; + use test::Bencher; + + #[bench] + fn bench_gcd(b: &mut Bencher) { + run_bench(b, $T::gcd); + } + + #[bench] + fn bench_gcd_old(b: &mut Bencher) { + run_bench(b, $T::gcd_old); + } + } + }; +} + +bench_gcd!(u8); +bench_gcd!(u16); +bench_gcd!(u32); +bench_gcd!(u64); +bench_gcd!(u128); + +bench_gcd!(i8); +bench_gcd!(i16); +bench_gcd!(i32); +bench_gcd!(i64); +bench_gcd!(i128); diff -Nru cargo-0.35.0/vendor/num-integer/benches/roots.rs cargo-0.37.0/vendor/num-integer/benches/roots.rs --- cargo-0.35.0/vendor/num-integer/benches/roots.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-integer/benches/roots.rs 2019-07-17 05:42:23.000000000 +0000 @@ -13,11 +13,7 @@ trait BenchInteger: Integer + PrimInt + WrappingAdd + WrappingMul + 'static {} -impl BenchInteger for T -where - T: Integer + PrimInt + WrappingAdd + WrappingMul + 'static, -{ -} +impl BenchInteger for T where T: Integer + PrimInt + WrappingAdd + WrappingMul + 'static {} fn bench(b: &mut Bencher, v: &[T], f: F, n: u32) where diff -Nru cargo-0.35.0/vendor/num-integer/bors.toml cargo-0.37.0/vendor/num-integer/bors.toml --- cargo-0.35.0/vendor/num-integer/bors.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-integer/bors.toml 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -status = [ - "continuous-integration/travis-ci/push", -] diff -Nru cargo-0.35.0/vendor/num-integer/build.rs cargo-0.37.0/vendor/num-integer/build.rs --- cargo-0.35.0/vendor/num-integer/build.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-integer/build.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,35 +1,14 @@ +extern crate autocfg; + use std::env; -use std::io::Write; -use std::process::{Command, Stdio}; fn main() { - if probe("fn main() { 0i128; }") { + let ac = autocfg::new(); + if ac.probe_type("i128") { println!("cargo:rustc-cfg=has_i128"); } else if env::var_os("CARGO_FEATURE_I128").is_some() { panic!("i128 support was not detected!"); } -} - -/// Test if a code snippet can be compiled -fn probe(code: &str) -> bool { - let rustc = env::var_os("RUSTC").unwrap_or_else(|| "rustc".into()); - let out_dir = env::var_os("OUT_DIR").expect("environment variable OUT_DIR"); - - let mut child = Command::new(rustc) - .arg("--out-dir") - .arg(out_dir) - .arg("--emit=obj") - .arg("-") - .stdin(Stdio::piped()) - .spawn() - .expect("rustc probe"); - - child - .stdin - .as_mut() - .expect("rustc stdin") - .write_all(code.as_bytes()) - .expect("write rustc stdin"); - child.wait().expect("rustc probe").success() + autocfg::rerun_path(file!()); } diff -Nru cargo-0.35.0/vendor/num-integer/.cargo-checksum.json cargo-0.37.0/vendor/num-integer/.cargo-checksum.json --- cargo-0.35.0/vendor/num-integer/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-integer/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea"} \ No newline at end of file +{"files":{},"package":"b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/num-integer/Cargo.toml cargo-0.37.0/vendor/num-integer/Cargo.toml --- cargo-0.35.0/vendor/num-integer/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-integer/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,9 +12,10 @@ [package] name = "num-integer" -version = "0.1.39" +version = "0.1.41" authors = ["The Rust Project Developers"] build = "build.rs" +exclude = ["/ci/*", "/.travis.yml", "/bors.toml"] description = "Integer traits and functions" homepage = "https://github.com/rust-num/num-integer" documentation = "https://docs.rs/num-integer" @@ -28,6 +29,8 @@ [dependencies.num-traits] version = "0.2.4" default-features = false +[build-dependencies.autocfg] +version = "0.1.3" [features] default = ["std"] diff -Nru cargo-0.35.0/vendor/num-integer/ci/rustup.sh cargo-0.37.0/vendor/num-integer/ci/rustup.sh --- cargo-0.35.0/vendor/num-integer/ci/rustup.sh 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-integer/ci/rustup.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -#!/bin/sh -# Use rustup to locally run the same suite of tests as .travis.yml. -# (You should first install/update 1.8.0, stable, beta, and nightly.) - -set -ex - -export TRAVIS_RUST_VERSION -for TRAVIS_RUST_VERSION in 1.8.0 1.15.0 1.20.0 stable beta nightly; do - run="rustup run $TRAVIS_RUST_VERSION" - $run cargo build --verbose - $run $PWD/ci/test_full.sh -done diff -Nru cargo-0.35.0/vendor/num-integer/ci/test_full.sh cargo-0.37.0/vendor/num-integer/ci/test_full.sh --- cargo-0.35.0/vendor/num-integer/ci/test_full.sh 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-integer/ci/test_full.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -#!/bin/bash - -set -ex - -echo Testing num-integer on rustc ${TRAVIS_RUST_VERSION} - -# num-integer should build and test everywhere. -cargo build --verbose -cargo test --verbose - -# test `no_std` -cargo build --verbose --no-default-features -cargo test --verbose --no-default-features - -# test `i128` -if [[ "$TRAVIS_RUST_VERSION" =~ ^(nightly|beta|stable)$ ]]; then - cargo build --verbose --features=i128 - cargo test --verbose --features=i128 -fi - -if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then - cargo test --verbose --all-features --benches -fi diff -Nru cargo-0.35.0/vendor/num-integer/RELEASES.md cargo-0.37.0/vendor/num-integer/RELEASES.md --- cargo-0.35.0/vendor/num-integer/RELEASES.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-integer/RELEASES.md 2019-07-17 05:42:23.000000000 +0000 @@ -1,4 +1,26 @@ -# Release 0.1.39 +# Release 0.1.41 (2019-05-21) + +- [Fixed feature detection on `no_std` targets][25]. + +**Contributors**: @cuviper + +[25]: https://github.com/rust-num/num-integer/pull/25 + +# Release 0.1.40 (2019-05-20) + +- [Optimized primitive `gcd` by avoiding memory swaps][11]. +- [Fixed `lcm(0, 0)` to return `0`, rather than panicking][18]. +- [Added `Integer::div_ceil`, `next_multiple_of`, and `prev_multiple_of`][16]. +- [Added `Integer::gcd_lcm`, `extended_gcd`, and `extended_gcd_lcm`][19]. + +**Contributors**: @cuviper, @ignatenkobrain, @smarnach, @strake + +[11]: https://github.com/rust-num/num-integer/pull/11 +[16]: https://github.com/rust-num/num-integer/pull/16 +[18]: https://github.com/rust-num/num-integer/pull/18 +[19]: https://github.com/rust-num/num-integer/pull/19 + +# Release 0.1.39 (2018-06-20) - [The new `Roots` trait provides `sqrt`, `cbrt`, and `nth_root` methods][9], calculating an `Integer`'s principal roots rounded toward zero. @@ -7,7 +29,7 @@ [9]: https://github.com/rust-num/num-integer/pull/9 -# Release 0.1.38 +# Release 0.1.38 (2018-05-11) - [Support for 128-bit integers is now automatically detected and enabled.][8] Setting the `i128` crate feature now causes the build script to panic if such @@ -17,7 +39,7 @@ [8]: https://github.com/rust-num/num-integer/pull/8 -# Release 0.1.37 +# Release 0.1.37 (2018-05-10) - [`Integer` is now implemented for `i128` and `u128`][7] starting with Rust 1.26, enabled by the new `i128` crate feature. @@ -26,7 +48,7 @@ [7]: https://github.com/rust-num/num-integer/pull/7 -# Release 0.1.36 +# Release 0.1.36 (2018-02-06) - [num-integer now has its own source repository][num-356] at [rust-num/num-integer][home]. - [Corrected the argument order documented in `Integer::is_multiple_of`][1] diff -Nru cargo-0.35.0/vendor/num-integer/src/lib.rs cargo-0.37.0/vendor/num-integer/src/lib.rs --- cargo-0.35.0/vendor/num-integer/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-integer/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -15,21 +15,20 @@ //! The `num-integer` crate is tested for rustc 1.8 and greater. #![doc(html_root_url = "https://docs.rs/num-integer/0.1")] - #![no_std] #[cfg(feature = "std")] extern crate std; extern crate num_traits as traits; -use core::ops::Add; use core::mem; +use core::ops::Add; -use traits::{Num, Signed}; +use traits::{Num, Signed, Zero}; mod roots; pub use roots::Roots; -pub use roots::{sqrt, cbrt, nth_root}; +pub use roots::{cbrt, nth_root, sqrt}; pub trait Integer: Sized + Num + PartialOrd + Ord + Eq { /// Floored integer division. @@ -74,6 +73,31 @@ /// ~~~ fn mod_floor(&self, other: &Self) -> Self; + /// Ceiled integer division. + /// + /// # Examples + /// + /// ~~~ + /// # use num_integer::Integer; + /// assert_eq!(( 8).div_ceil( &3), 3); + /// assert_eq!(( 8).div_ceil(&-3), -2); + /// assert_eq!((-8).div_ceil( &3), -2); + /// assert_eq!((-8).div_ceil(&-3), 3); + /// + /// assert_eq!(( 1).div_ceil( &2), 1); + /// assert_eq!(( 1).div_ceil(&-2), 0); + /// assert_eq!((-1).div_ceil( &2), 0); + /// assert_eq!((-1).div_ceil(&-2), 1); + /// ~~~ + fn div_ceil(&self, other: &Self) -> Self { + let (q, r) = self.div_mod_floor(other); + if r.is_zero() { + q + } else { + q + Self::one() + } + } + /// Greatest Common Divisor (GCD). /// /// # Examples @@ -93,9 +117,93 @@ /// # use num_integer::Integer; /// assert_eq!(7.lcm(&3), 21); /// assert_eq!(2.lcm(&4), 4); + /// assert_eq!(0.lcm(&0), 0); /// ~~~ fn lcm(&self, other: &Self) -> Self; + /// Greatest Common Divisor (GCD) and + /// Lowest Common Multiple (LCM) together. + /// + /// Potentially more efficient than calling `gcd` and `lcm` + /// individually for identical inputs. + /// + /// # Examples + /// + /// ~~~ + /// # use num_integer::Integer; + /// assert_eq!(10.gcd_lcm(&4), (2, 20)); + /// assert_eq!(8.gcd_lcm(&9), (1, 72)); + /// ~~~ + #[inline] + fn gcd_lcm(&self, other: &Self) -> (Self, Self) { + (self.gcd(other), self.lcm(other)) + } + + /// Greatest common divisor and Bézout coefficients. + /// + /// # Examples + /// + /// ~~~ + /// # extern crate num_integer; + /// # extern crate num_traits; + /// # fn main() { + /// # use num_integer::{ExtendedGcd, Integer}; + /// # use num_traits::NumAssign; + /// fn check(a: A, b: A) -> bool { + /// let ExtendedGcd { gcd, x, y, .. } = a.extended_gcd(&b); + /// gcd == x * a + y * b + /// } + /// assert!(check(10isize, 4isize)); + /// assert!(check(8isize, 9isize)); + /// # } + /// ~~~ + #[inline] + fn extended_gcd(&self, other: &Self) -> ExtendedGcd + where + Self: Clone, + { + let mut s = (Self::zero(), Self::one()); + let mut t = (Self::one(), Self::zero()); + let mut r = (other.clone(), self.clone()); + + while !r.0.is_zero() { + let q = r.1.clone() / r.0.clone(); + let f = |mut r: (Self, Self)| { + mem::swap(&mut r.0, &mut r.1); + r.0 = r.0 - q.clone() * r.1.clone(); + r + }; + r = f(r); + s = f(s); + t = f(t); + } + + if r.1 >= Self::zero() { + ExtendedGcd { + gcd: r.1, + x: s.1, + y: t.1, + _hidden: (), + } + } else { + ExtendedGcd { + gcd: Self::zero() - r.1, + x: Self::zero() - s.1, + y: Self::zero() - t.1, + _hidden: (), + } + } + } + + /// Greatest common divisor, least common multiple, and Bézout coefficients. + #[inline] + fn extended_gcd_lcm(&self, other: &Self) -> (ExtendedGcd, Self) + where + Self: Clone + Signed, + { + (self.extended_gcd(other), self.lcm(other)) + } + /// Deprecated, use `is_multiple_of` instead. fn divides(&self, other: &Self) -> bool; @@ -172,6 +280,80 @@ fn div_mod_floor(&self, other: &Self) -> (Self, Self) { (self.div_floor(other), self.mod_floor(other)) } + + /// Rounds up to nearest multiple of argument. + /// + /// # Notes + /// + /// For signed types, `a.next_multiple_of(b) = a.prev_multiple_of(b.neg())`. + /// + /// # Examples + /// + /// ~~~ + /// # use num_integer::Integer; + /// assert_eq!(( 16).next_multiple_of(& 8), 16); + /// assert_eq!(( 23).next_multiple_of(& 8), 24); + /// assert_eq!(( 16).next_multiple_of(&-8), 16); + /// assert_eq!(( 23).next_multiple_of(&-8), 16); + /// assert_eq!((-16).next_multiple_of(& 8), -16); + /// assert_eq!((-23).next_multiple_of(& 8), -16); + /// assert_eq!((-16).next_multiple_of(&-8), -16); + /// assert_eq!((-23).next_multiple_of(&-8), -24); + /// ~~~ + #[inline] + fn next_multiple_of(&self, other: &Self) -> Self + where + Self: Clone, + { + let m = self.mod_floor(other); + self.clone() + + if m.is_zero() { + Self::zero() + } else { + other.clone() - m + } + } + + /// Rounds down to nearest multiple of argument. + /// + /// # Notes + /// + /// For signed types, `a.prev_multiple_of(b) = a.next_multiple_of(b.neg())`. + /// + /// # Examples + /// + /// ~~~ + /// # use num_integer::Integer; + /// assert_eq!(( 16).prev_multiple_of(& 8), 16); + /// assert_eq!(( 23).prev_multiple_of(& 8), 16); + /// assert_eq!(( 16).prev_multiple_of(&-8), 16); + /// assert_eq!(( 23).prev_multiple_of(&-8), 24); + /// assert_eq!((-16).prev_multiple_of(& 8), -16); + /// assert_eq!((-23).prev_multiple_of(& 8), -24); + /// assert_eq!((-16).prev_multiple_of(&-8), -16); + /// assert_eq!((-23).prev_multiple_of(&-8), -16); + /// ~~~ + #[inline] + fn prev_multiple_of(&self, other: &Self) -> Self + where + Self: Clone, + { + self.clone() - self.mod_floor(other) + } +} + +/// Greatest common divisor and Bézout coefficients +/// +/// ```no_build +/// let e = isize::extended_gcd(a, b); +/// assert_eq!(e.gcd, e.x*a + e.y*b); +/// ``` +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct ExtendedGcd { + pub gcd: A, + pub x: A, + pub y: A, + _hidden: (), } /// Simultaneous integer division and modulus @@ -194,6 +376,11 @@ pub fn div_mod_floor(x: T, y: T) -> (T, T) { x.div_mod_floor(&y) } +/// Ceiled integer division +#[inline] +pub fn div_ceil(x: T, y: T) -> T { + x.div_ceil(&y) +} /// Calculates the Greatest Common Divisor (GCD) of the number and `other`. The /// result is always positive. @@ -207,18 +394,26 @@ x.lcm(&y) } +/// Calculates the Greatest Common Divisor (GCD) and +/// Lowest Common Multiple (LCM) of the number and `other`. +#[inline(always)] +pub fn gcd_lcm(x: T, y: T) -> (T, T) { + x.gcd_lcm(&y) +} + macro_rules! impl_integer_for_isize { - ($T:ty, $test_mod:ident) => ( + ($T:ty, $test_mod:ident) => { impl Integer for $T { /// Floored integer division #[inline] fn div_floor(&self, other: &Self) -> Self { // Algorithm from [Daan Leijen. _Division and Modulus for Computer Scientists_, // December 2001](http://research.microsoft.com/pubs/151917/divmodnote-letter.pdf) - match self.div_rem(other) { - (d, r) if (r > 0 && *other < 0) - || (r < 0 && *other > 0) => d - 1, - (d, _) => d, + let (d, r) = self.div_rem(other); + if (r > 0 && *other < 0) || (r < 0 && *other > 0) { + d - 1 + } else { + d } } @@ -227,10 +422,11 @@ fn mod_floor(&self, other: &Self) -> Self { // Algorithm from [Daan Leijen. _Division and Modulus for Computer Scientists_, // December 2001](http://research.microsoft.com/pubs/151917/divmodnote-letter.pdf) - match *self % *other { - r if (r > 0 && *other < 0) - || (r < 0 && *other > 0) => r + *other, - r => r, + let r = *self % *other; + if (r > 0 && *other < 0) || (r < 0 && *other > 0) { + r + *other + } else { + r } } @@ -239,10 +435,21 @@ fn div_mod_floor(&self, other: &Self) -> (Self, Self) { // Algorithm from [Daan Leijen. _Division and Modulus for Computer Scientists_, // December 2001](http://research.microsoft.com/pubs/151917/divmodnote-letter.pdf) - match self.div_rem(other) { - (d, r) if (r > 0 && *other < 0) - || (r < 0 && *other > 0) => (d - 1, r + *other), - (d, r) => (d, r), + let (d, r) = self.div_rem(other); + if (r > 0 && *other < 0) || (r < 0 && *other > 0) { + (d - 1, r + *other) + } else { + (d, r) + } + } + + #[inline] + fn div_ceil(&self, other: &Self) -> Self { + let (d, r) = self.div_rem(other); + if (r > 0 && *other > 0) || (r < 0 && *other < 0) { + d + 1 + } else { + d } } @@ -253,7 +460,9 @@ // Use Stein's algorithm let mut m = *self; let mut n = *other; - if m == 0 || n == 0 { return (m | n).abs() } + if m == 0 || n == 0 { + return (m | n).abs(); + } // find common factors of 2 let shift = (m | n).trailing_zeros(); @@ -267,7 +476,7 @@ // is positive for all numbers except gcd = abs(min value) // The call to .abs() causes a panic in debug mode if m == Self::min_value() || n == Self::min_value() { - return (1 << shift).abs() + return (1 << shift).abs(); } // guaranteed to be positive now, rest like unsigned algorithm @@ -275,24 +484,51 @@ n = n.abs(); // divide n and m by 2 until odd - // m inside loop + m >>= m.trailing_zeros(); n >>= n.trailing_zeros(); - while m != 0 { - m >>= m.trailing_zeros(); - if n > m { mem::swap(&mut n, &mut m) } - m -= n; + while m != n { + if m > n { + m -= n; + m >>= m.trailing_zeros(); + } else { + n -= m; + n >>= n.trailing_zeros(); + } } + m << shift + } - n << shift + #[inline] + fn extended_gcd_lcm(&self, other: &Self) -> (ExtendedGcd, Self) { + let egcd = self.extended_gcd(other); + // should not have to recalculate abs + let lcm = if egcd.gcd.is_zero() { + Self::zero() + } else { + (*self * (*other / egcd.gcd)).abs() + }; + (egcd, lcm) } /// Calculates the Lowest Common Multiple (LCM) of the number and /// `other`. #[inline] fn lcm(&self, other: &Self) -> Self { + self.gcd_lcm(other).1 + } + + /// Calculates the Greatest Common Divisor (GCD) and + /// Lowest Common Multiple (LCM) of the number and `other`. + #[inline] + fn gcd_lcm(&self, other: &Self) -> (Self, Self) { + if self.is_zero() && other.is_zero() { + return (Self::zero(), Self::zero()); + } + let gcd = self.gcd(other); // should not have to recalculate abs - (*self * (*other / self.gcd(other))).abs() + let lcm = (*self * (*other / gcd)).abs(); + (gcd, lcm) } /// Deprecated, use `is_multiple_of` instead. @@ -309,11 +545,15 @@ /// Returns `true` if the number is divisible by `2` #[inline] - fn is_even(&self) -> bool { (*self) & 1 == 0 } + fn is_even(&self) -> bool { + (*self) & 1 == 0 + } /// Returns `true` if the number is not divisible by `2` #[inline] - fn is_odd(&self) -> bool { !self.is_even() } + fn is_odd(&self) -> bool { + !self.is_even() + } /// Simultaneous truncated integer division and modulus. #[inline] @@ -324,8 +564,8 @@ #[cfg(test)] mod $test_mod { - use Integer; use core::mem; + use Integer; /// Checks that the division rule holds for: /// @@ -333,14 +573,14 @@ /// - `d`: denominator (divisor) /// - `qr`: quotient and remainder #[cfg(test)] - fn test_division_rule((n,d): ($T, $T), (q,r): ($T, $T)) { + fn test_division_rule((n, d): ($T, $T), (q, r): ($T, $T)) { assert_eq!(d * q + r, n); } #[test] fn test_div_rem() { - fn test_nd_dr(nd: ($T,$T), qr: ($T,$T)) { - let (n,d) = nd; + fn test_nd_dr(nd: ($T, $T), qr: ($T, $T)) { + let (n, d) = nd; let separate_div_rem = (n / d, n % d); let combined_div_rem = n.div_rem(&d); @@ -351,21 +591,21 @@ test_division_rule(nd, combined_div_rem); } - test_nd_dr(( 8, 3), ( 2, 2)); - test_nd_dr(( 8, -3), (-2, 2)); - test_nd_dr((-8, 3), (-2, -2)); - test_nd_dr((-8, -3), ( 2, -2)); - - test_nd_dr(( 1, 2), ( 0, 1)); - test_nd_dr(( 1, -2), ( 0, 1)); - test_nd_dr((-1, 2), ( 0, -1)); - test_nd_dr((-1, -2), ( 0, -1)); + test_nd_dr((8, 3), (2, 2)); + test_nd_dr((8, -3), (-2, 2)); + test_nd_dr((-8, 3), (-2, -2)); + test_nd_dr((-8, -3), (2, -2)); + + test_nd_dr((1, 2), (0, 1)); + test_nd_dr((1, -2), (0, 1)); + test_nd_dr((-1, 2), (0, -1)); + test_nd_dr((-1, -2), (0, -1)); } #[test] fn test_div_mod_floor() { - fn test_nd_dm(nd: ($T,$T), dm: ($T,$T)) { - let (n,d) = nd; + fn test_nd_dm(nd: ($T, $T), dm: ($T, $T)) { + let (n, d) = nd; let separate_div_mod_floor = (n.div_floor(&d), n.mod_floor(&d)); let combined_div_mod_floor = n.div_mod_floor(&d); @@ -376,15 +616,15 @@ test_division_rule(nd, combined_div_mod_floor); } - test_nd_dm(( 8, 3), ( 2, 2)); - test_nd_dm(( 8, -3), (-3, -1)); - test_nd_dm((-8, 3), (-3, 1)); - test_nd_dm((-8, -3), ( 2, -2)); - - test_nd_dm(( 1, 2), ( 0, 1)); - test_nd_dm(( 1, -2), (-1, -1)); - test_nd_dm((-1, 2), (-1, 1)); - test_nd_dm((-1, -2), ( 0, -1)); + test_nd_dm((8, 3), (2, 2)); + test_nd_dm((8, -3), (-3, -1)); + test_nd_dm((-8, 3), (-3, 1)); + test_nd_dm((-8, -3), (2, -2)); + + test_nd_dm((1, 2), (0, 1)); + test_nd_dm((1, -2), (-1, -1)); + test_nd_dm((-1, 2), (-1, 1)); + test_nd_dm((-1, -2), (0, -1)); } #[test] @@ -414,7 +654,7 @@ // for i8 for i in -127..127 { for j in -127..127 { - assert_eq!(euclidean_gcd(i,j), i.gcd(&j)); + assert_eq!(euclidean_gcd(i, j), i.gcd(&j)); } } @@ -422,7 +662,7 @@ // FIXME: Use inclusive ranges for above loop when implemented let i = 127; for j in -127..127 { - assert_eq!(euclidean_gcd(i,j), i.gcd(&j)); + assert_eq!(euclidean_gcd(i, j), i.gcd(&j)); } assert_eq!(127.gcd(&127), 127); } @@ -474,6 +714,49 @@ } #[test] + fn test_gcd_lcm() { + use core::iter::once; + for i in once(0) + .chain((1..).take(127).flat_map(|a| once(a).chain(once(-a)))) + .chain(once(-128)) + { + for j in once(0) + .chain((1..).take(127).flat_map(|a| once(a).chain(once(-a)))) + .chain(once(-128)) + { + assert_eq!(i.gcd_lcm(&j), (i.gcd(&j), i.lcm(&j))); + } + } + } + + #[test] + fn test_extended_gcd_lcm() { + use core::fmt::Debug; + use traits::NumAssign; + use ExtendedGcd; + + fn check(a: A, b: A) { + let ExtendedGcd { gcd, x, y, .. } = a.extended_gcd(&b); + assert_eq!(gcd, x * a + y * b); + } + + use core::iter::once; + for i in once(0) + .chain((1..).take(127).flat_map(|a| once(a).chain(once(-a)))) + .chain(once(-128)) + { + for j in once(0) + .chain((1..).take(127).flat_map(|a| once(a).chain(once(-a)))) + .chain(once(-128)) + { + check(i, j); + let (ExtendedGcd { gcd, .. }, lcm) = i.extended_gcd_lcm(&j); + assert_eq!((gcd, lcm), (i.gcd(&j), i.lcm(&j))); + } + } + } + + #[test] fn test_even() { assert_eq!((-4 as $T).is_even(), true); assert_eq!((-3 as $T).is_even(), false); @@ -499,7 +782,7 @@ assert_eq!((4 as $T).is_odd(), false); } } - ) + }; } impl_integer_for_isize!(i8, test_integer_i8); @@ -511,7 +794,7 @@ impl_integer_for_isize!(i128, test_integer_i128); macro_rules! impl_integer_for_usize { - ($T:ty, $test_mod:ident) => ( + ($T:ty, $test_mod:ident) => { impl Integer for $T { /// Unsigned integer division. Returns the same result as `div` (`/`). #[inline] @@ -525,34 +808,68 @@ *self % *other } + #[inline] + fn div_ceil(&self, other: &Self) -> Self { + *self / *other + (0 != *self % *other) as Self + } + /// Calculates the Greatest Common Divisor (GCD) of the number and `other` #[inline] fn gcd(&self, other: &Self) -> Self { // Use Stein's algorithm let mut m = *self; let mut n = *other; - if m == 0 || n == 0 { return m | n } + if m == 0 || n == 0 { + return m | n; + } // find common factors of 2 let shift = (m | n).trailing_zeros(); // divide n and m by 2 until odd - // m inside loop + m >>= m.trailing_zeros(); n >>= n.trailing_zeros(); - while m != 0 { - m >>= m.trailing_zeros(); - if n > m { mem::swap(&mut n, &mut m) } - m -= n; + while m != n { + if m > n { + m -= n; + m >>= m.trailing_zeros(); + } else { + n -= m; + n >>= n.trailing_zeros(); + } } + m << shift + } - n << shift + #[inline] + fn extended_gcd_lcm(&self, other: &Self) -> (ExtendedGcd, Self) { + let egcd = self.extended_gcd(other); + // should not have to recalculate abs + let lcm = if egcd.gcd.is_zero() { + Self::zero() + } else { + *self * (*other / egcd.gcd) + }; + (egcd, lcm) } /// Calculates the Lowest Common Multiple (LCM) of the number and `other`. #[inline] fn lcm(&self, other: &Self) -> Self { - *self * (*other / self.gcd(other)) + self.gcd_lcm(other).1 + } + + /// Calculates the Greatest Common Divisor (GCD) and + /// Lowest Common Multiple (LCM) of the number and `other`. + #[inline] + fn gcd_lcm(&self, other: &Self) -> (Self, Self) { + if self.is_zero() && other.is_zero() { + return (Self::zero(), Self::zero()); + } + let gcd = self.gcd(other); + let lcm = *self * (*other / gcd); + (gcd, lcm) } /// Deprecated, use `is_multiple_of` instead. @@ -588,8 +905,8 @@ #[cfg(test)] mod $test_mod { - use Integer; use core::mem; + use Integer; #[test] fn test_div_mod_floor() { @@ -625,7 +942,7 @@ for i in 0..255 { for j in 0..255 { - assert_eq!(euclidean_gcd(i,j), i.gcd(&j)); + assert_eq!(euclidean_gcd(i, j), i.gcd(&j)); } } @@ -633,7 +950,7 @@ // FIXME: Use inclusive ranges for above loop when implemented let i = 255; for j in 0..255 { - assert_eq!(euclidean_gcd(i,j), i.gcd(&j)); + assert_eq!(euclidean_gcd(i, j), i.gcd(&j)); } assert_eq!(255.gcd(&255), 255); } @@ -649,6 +966,15 @@ } #[test] + fn test_gcd_lcm() { + for i in (0..).take(256) { + for j in (0..).take(256) { + assert_eq!(i.gcd_lcm(&j), (i.gcd(&j), i.lcm(&j))); + } + } + } + + #[test] fn test_is_multiple_of() { assert!((6 as $T).is_multiple_of(&(6 as $T))); assert!((6 as $T).is_multiple_of(&(3 as $T))); @@ -673,7 +999,7 @@ assert_eq!((4 as $T).is_odd(), false); } } - ) + }; } impl_integer_for_usize!(u8, test_integer_u8); @@ -692,7 +1018,8 @@ } impl IterBinomial - where T: Integer, +where + T: Integer, { /// For a given n, iterate over all binomial coefficients binomial(n, k), for k=0...n. /// @@ -714,13 +1041,16 @@ /// For larger n, `T` should be a bigint type. pub fn new(n: T) -> IterBinomial { IterBinomial { - k: T::zero(), a: T::one(), n: n + k: T::zero(), + a: T::one(), + n: n, } } } impl Iterator for IterBinomial - where T: Integer + Clone +where + T: Integer + Clone, { type Item = T; @@ -732,7 +1062,7 @@ multiply_and_divide( self.a.clone(), self.n.clone() - self.k.clone() + T::one(), - self.k.clone() + self.k.clone(), ) } else { T::one() @@ -748,7 +1078,7 @@ fn multiply_and_divide(r: T, a: T, b: T) -> T { // See http://blog.plover.com/math/choose-2.html for the idea. let g = gcd(r.clone(), b.clone()); - r/g.clone() * (a / (b/g)) + r / g.clone() * (a / (b / g)) } /// Calculate the binomial coefficient. @@ -792,7 +1122,8 @@ /// Calculate the multinomial coefficient. pub fn multinomial(k: &[T]) -> T - where for<'a> T: Add<&'a T, Output = T> +where + for<'a> T: Add<&'a T, Output = T>, { let mut r = T::one(); let mut p = T::zero(); @@ -806,16 +1137,20 @@ #[test] fn test_lcm_overflow() { macro_rules! check { - ($t:ty, $x:expr, $y:expr, $r:expr) => { { + ($t:ty, $x:expr, $y:expr, $r:expr) => {{ let x: $t = $x; let y: $t = $y; let o = x.checked_mul(y); - assert!(o.is_none(), - "sanity checking that {} input {} * {} overflows", - stringify!($t), x, y); + assert!( + o.is_none(), + "sanity checking that {} input {} * {} overflows", + stringify!($t), + x, + y + ); assert_eq!(x.lcm(&y), $r); assert_eq!(y.lcm(&x), $r); - } } + }}; } // Original bug (Issue #166) @@ -834,13 +1169,13 @@ #[test] fn test_iter_binomial() { macro_rules! check_simple { - ($t:ty) => { { + ($t:ty) => {{ let n: $t = 3; let expected = [1, 3, 3, 1]; for (b, &e) in IterBinomial::new(n).zip(&expected) { assert_eq!(b, e); } - } } + }}; } check_simple!(u8); @@ -853,14 +1188,14 @@ check_simple!(i64); macro_rules! check_binomial { - ($t:ty, $n:expr) => { { + ($t:ty, $n:expr) => {{ let n: $t = $n; let mut k: $t = 0; for b in IterBinomial::new(n) { assert_eq!(b, binomial(n, k)); k += 1; } - } } + }}; } // Check the largest n for which there is no overflow. @@ -877,7 +1212,7 @@ #[test] fn test_binomial() { macro_rules! check { - ($t:ty, $x:expr, $y:expr, $r:expr) => { { + ($t:ty, $x:expr, $y:expr, $r:expr) => {{ let x: $t = $x; let y: $t = $y; let expected: $t = $r; @@ -885,7 +1220,7 @@ if y <= x { assert_eq!(binomial(x, x - y), expected); } - } } + }}; } check!(u8, 9, 4, 126); check!(u8, 0, 0, 1); @@ -933,12 +1268,12 @@ #[test] fn test_multinomial() { macro_rules! check_binomial { - ($t:ty, $k:expr) => { { + ($t:ty, $k:expr) => {{ let n: $t = $k.iter().fold(0, |acc, &x| acc + x); let k: &[$t] = $k; assert_eq!(k.len(), 2); assert_eq!(multinomial(k), binomial(n, k[0])); - } } + }}; } check_binomial!(u8, &[4, 5]); @@ -968,11 +1303,11 @@ check_binomial!(i64, &[4, 10]); macro_rules! check_multinomial { - ($t:ty, $k:expr, $r:expr) => { { + ($t:ty, $k:expr, $r:expr) => {{ let k: &[$t] = $k; let expected: $t = $r; assert_eq!(multinomial(k), expected); - } } + }}; } check_multinomial!(u8, &[2, 1, 2], 30); diff -Nru cargo-0.35.0/vendor/num-integer/src/roots.rs cargo-0.37.0/vendor/num-integer/src/roots.rs --- cargo-0.35.0/vendor/num-integer/src/roots.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-integer/src/roots.rs 2019-07-17 05:42:23.000000000 +0000 @@ -202,170 +202,181 @@ macro_rules! unsigned_roots { ($T:ident) => { impl Roots for $T { + #[inline] fn nth_root(&self, n: u32) -> Self { - // Specialize small roots - match n { - 0 => panic!("can't find a root of degree 0!"), - 1 => return *self, - 2 => return self.sqrt(), - 3 => return self.cbrt(), - _ => (), - } + fn go(a: $T, n: u32) -> $T { + // Specialize small roots + match n { + 0 => panic!("can't find a root of degree 0!"), + 1 => return a, + 2 => return a.sqrt(), + 3 => return a.cbrt(), + _ => (), + } - // The root of values less than 2ⁿ can only be 0 or 1. - if bits::<$T>() <= n || *self < (1 << n) { - return (*self > 0) as $T; - } + // The root of values less than 2ⁿ can only be 0 or 1. + if bits::<$T>() <= n || a < (1 << n) { + return (a > 0) as $T; + } - if bits::<$T>() > 64 { - // 128-bit division is slow, so do a bitwise `nth_root` until it's small enough. - return if *self <= core::u64::MAX as $T { - (*self as u64).nth_root(n) as $T - } else { - let lo = (self >> n).nth_root(n) << 1; - let hi = lo + 1; - // 128-bit `checked_mul` also involves division, but we can't always - // compute `hiⁿ` without risking overflow. Try to avoid it though... - if hi.next_power_of_two().trailing_zeros() * n >= bits::<$T>() { - match checked_pow(hi, n as usize) { - Some(x) if x <= *self => hi, - _ => lo, - } + if bits::<$T>() > 64 { + // 128-bit division is slow, so do a bitwise `nth_root` until it's small enough. + return if a <= core::u64::MAX as $T { + (a as u64).nth_root(n) as $T } else { - if hi.pow(n) <= *self { - hi + let lo = (a >> n).nth_root(n) << 1; + let hi = lo + 1; + // 128-bit `checked_mul` also involves division, but we can't always + // compute `hiⁿ` without risking overflow. Try to avoid it though... + if hi.next_power_of_two().trailing_zeros() * n >= bits::<$T>() { + match checked_pow(hi, n as usize) { + Some(x) if x <= a => hi, + _ => lo, + } } else { - lo + if hi.pow(n) <= a { + hi + } else { + lo + } } + }; + } + + #[cfg(feature = "std")] + #[inline] + fn guess(x: $T, n: u32) -> $T { + // for smaller inputs, `f64` doesn't justify its cost. + if bits::<$T>() <= 32 || x <= core::u32::MAX as $T { + 1 << ((log2(x) + n - 1) / n) + } else { + ((x as f64).ln() / f64::from(n)).exp() as $T } - }; - } + } - #[cfg(feature = "std")] - #[inline] - fn guess(x: $T, n: u32) -> $T { - // for smaller inputs, `f64` doesn't justify its cost. - if bits::<$T>() <= 32 || x <= core::u32::MAX as $T { + #[cfg(not(feature = "std"))] + #[inline] + fn guess(x: $T, n: u32) -> $T { 1 << ((log2(x) + n - 1) / n) - } else { - ((x as f64).ln() / f64::from(n)).exp() as $T } - } - - #[cfg(not(feature = "std"))] - #[inline] - fn guess(x: $T, n: u32) -> $T { - 1 << ((log2(x) + n - 1) / n) - } - // https://en.wikipedia.org/wiki/Nth_root_algorithm - let n1 = n - 1; - let next = |x: $T| { - let y = match checked_pow(x, n1 as usize) { - Some(ax) => self / ax, - None => 0, + // https://en.wikipedia.org/wiki/Nth_root_algorithm + let n1 = n - 1; + let next = |x: $T| { + let y = match checked_pow(x, n1 as usize) { + Some(ax) => a / ax, + None => 0, + }; + (y + x * n1 as $T) / n as $T }; - (y + x * n1 as $T) / n as $T - }; - fixpoint(guess(*self, n), next) + fixpoint(guess(a, n), next) + } + go(*self, n) } + #[inline] fn sqrt(&self) -> Self { - if bits::<$T>() > 64 { - // 128-bit division is slow, so do a bitwise `sqrt` until it's small enough. - // https://en.wikipedia.org/wiki/Integer_square_root#Using_bitwise_operations - return if *self <= core::u64::MAX as $T { - (*self as u64).sqrt() as $T - } else { - let lo = (self >> 2u32).sqrt() << 1; - let hi = lo + 1; - if hi * hi <= *self { - hi + fn go(a: $T) -> $T { + if bits::<$T>() > 64 { + // 128-bit division is slow, so do a bitwise `sqrt` until it's small enough. + return if a <= core::u64::MAX as $T { + (a as u64).sqrt() as $T } else { - lo - } - }; - } + let lo = (a >> 2u32).sqrt() << 1; + let hi = lo + 1; + if hi * hi <= a { + hi + } else { + lo + } + }; + } - if *self < 4 { - return (*self > 0) as Self; - } + if a < 4 { + return (a > 0) as $T; + } - #[cfg(feature = "std")] - #[inline] - fn guess(x: $T) -> $T { - (x as f64).sqrt() as $T - } + #[cfg(feature = "std")] + #[inline] + fn guess(x: $T) -> $T { + (x as f64).sqrt() as $T + } - #[cfg(not(feature = "std"))] - #[inline] - fn guess(x: $T) -> $T { - 1 << ((log2(x) + 1) / 2) - } + #[cfg(not(feature = "std"))] + #[inline] + fn guess(x: $T) -> $T { + 1 << ((log2(x) + 1) / 2) + } - // https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method - let next = |x: $T| (self / x + x) >> 1; - fixpoint(guess(*self), next) + // https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method + let next = |x: $T| (a / x + x) >> 1; + fixpoint(guess(a), next) + } + go(*self) } + #[inline] fn cbrt(&self) -> Self { - if bits::<$T>() > 64 { - // 128-bit division is slow, so do a bitwise `cbrt` until it's small enough. - return if *self <= core::u64::MAX as $T { - (*self as u64).cbrt() as $T - } else { - let lo = (self >> 3u32).cbrt() << 1; - let hi = lo + 1; - if hi * hi * hi <= *self { - hi + fn go(a: $T) -> $T { + if bits::<$T>() > 64 { + // 128-bit division is slow, so do a bitwise `cbrt` until it's small enough. + return if a <= core::u64::MAX as $T { + (a as u64).cbrt() as $T } else { - lo - } - }; - } + let lo = (a >> 3u32).cbrt() << 1; + let hi = lo + 1; + if hi * hi * hi <= a { + hi + } else { + lo + } + }; + } - if bits::<$T>() <= 32 { - // Implementation based on Hacker's Delight `icbrt2` - let mut x = *self; - let mut y2 = 0; - let mut y = 0; - let smax = bits::<$T>() / 3; - for s in (0..smax + 1).rev() { - let s = s * 3; - y2 *= 4; - y *= 2; - let b = 3 * (y2 + y) + 1; - if x >> s >= b { - x -= b << s; - y2 += 2 * y + 1; - y += 1; + if bits::<$T>() <= 32 { + // Implementation based on Hacker's Delight `icbrt2` + let mut x = a; + let mut y2 = 0; + let mut y = 0; + let smax = bits::<$T>() / 3; + for s in (0..smax + 1).rev() { + let s = s * 3; + y2 *= 4; + y *= 2; + let b = 3 * (y2 + y) + 1; + if x >> s >= b { + x -= b << s; + y2 += 2 * y + 1; + y += 1; + } } + return y; } - return y; - } - if *self < 8 { - return (*self > 0) as Self; - } - if *self <= core::u32::MAX as $T { - return (*self as u32).cbrt() as $T; - } + if a < 8 { + return (a > 0) as $T; + } + if a <= core::u32::MAX as $T { + return (a as u32).cbrt() as $T; + } - #[cfg(feature = "std")] - #[inline] - fn guess(x: $T) -> $T { - (x as f64).cbrt() as $T - } + #[cfg(feature = "std")] + #[inline] + fn guess(x: $T) -> $T { + (x as f64).cbrt() as $T + } - #[cfg(not(feature = "std"))] - #[inline] - fn guess(x: $T) -> $T { - 1 << ((log2(x) + 2) / 3) - } + #[cfg(not(feature = "std"))] + #[inline] + fn guess(x: $T) -> $T { + 1 << ((log2(x) + 2) / 3) + } - // https://en.wikipedia.org/wiki/Cube_root#Numerical_methods - let next = |x: $T| (self / (x * x) + x * 2) / 3; - fixpoint(guess(*self), next) + // https://en.wikipedia.org/wiki/Cube_root#Numerical_methods + let next = |x: $T| (a / (x * x) + x * 2) / 3; + fixpoint(guess(a), next) + } + go(*self) } } }; diff -Nru cargo-0.35.0/vendor/num-integer/tests/roots.rs cargo-0.37.0/vendor/num-integer/tests/roots.rs --- cargo-0.35.0/vendor/num-integer/tests/roots.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-integer/tests/roots.rs 2019-07-17 05:42:23.000000000 +0000 @@ -10,11 +10,7 @@ trait TestInteger: Roots + PrimInt + Debug + AsPrimitive + 'static {} -impl TestInteger for T -where - T: Roots + PrimInt + Debug + AsPrimitive + 'static, -{ -} +impl TestInteger for T where T: Roots + PrimInt + Debug + AsPrimitive + 'static {} /// Check that each root is correct /// diff -Nru cargo-0.35.0/vendor/numtoa/.cargo-checksum.json cargo-0.37.0/vendor/numtoa/.cargo-checksum.json --- cargo-0.35.0/vendor/numtoa/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/numtoa/.cargo-checksum.json 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"files":{},"package":"b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/numtoa/Cargo.toml cargo-0.37.0/vendor/numtoa/Cargo.toml --- cargo-0.35.0/vendor/numtoa/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/numtoa/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO -# -# When uploading crates to the registry Cargo will automatically -# "normalize" Cargo.toml files for maximal compatibility -# with all versions of Cargo and also rewrite `path` dependencies -# 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 = "numtoa" -version = "0.1.0" -authors = ["Michael Aaron Murphy "] -description = "Convert numbers into stack-allocated byte arrays" -documentation = "https://docs.rs/numtoa" -readme = "README.md" -keywords = ["numbers", "convert", "numtoa", "itoa", "no_std"] -categories = ["value-formatting"] -license = "MIT OR Apache-2.0" -repository = "https://gitlab.com/mmstick/numtoa" - -[features] -std = [] diff -Nru cargo-0.35.0/vendor/numtoa/LICENSE-APACHE cargo-0.37.0/vendor/numtoa/LICENSE-APACHE --- cargo-0.35.0/vendor/numtoa/LICENSE-APACHE 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/numtoa/LICENSE-APACHE 1970-01-01 00:00:00.000000000 +0000 @@ -1,202 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor 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, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff -Nru cargo-0.35.0/vendor/numtoa/LICENSE-MIT cargo-0.37.0/vendor/numtoa/LICENSE-MIT --- cargo-0.35.0/vendor/numtoa/LICENSE-MIT 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/numtoa/LICENSE-MIT 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 Michael Aaron Murphy - -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 is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff -Nru cargo-0.35.0/vendor/numtoa/README.md cargo-0.37.0/vendor/numtoa/README.md --- cargo-0.35.0/vendor/numtoa/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/numtoa/README.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -# NumToA - -## `#![no_std]` Compatible with Zero Heap Allocations - -The standard library provides a convenient method of converting numbers into strings, but these strings are -heap-allocated. If you have an application which needs to convert large volumes of numbers into strings, but don't -want to pay the price of heap allocation, this crate provides an efficient `no_std`-compatible method of heaplessly converting numbers -into their string representations, storing the representation within a reusable byte array. - -## Supports Multiple Bases - -In addition to supporting the standard base 10 conversion, this implementation allows you to select the base of -your choice. Therefore, if you want a binary representation, set the base to 2. If you want hexadecimal, set the -base to 16. - -## No Unsafe - -Both the standard library and itoa crate rely on unsafe functions, but this implementation has been able to avoid -the use of unsafe entirely. - -## Fast - -Performance is roughly identical to that of the `itoa` crate when performing base 10 conversions. Below is a benchmark -of printing 0 through 5,000,000 to `/dev/null` - -``` -std: 1150615048 ns -itoa: 838556714 ns -numtoa: 825544518 ns -``` - -## Base 10 Example - -```rust -use numtoa::NumToA; -use std::io::{self, Write}; - -let stdout = io::stdout(); -let mut stdout = stdout.lock(); -let mut buffer = [0u8; 20]; - -let number: u32 = 162392; -let mut start_index = number.numtoa(10, &mut buffer); -let _ = stdout.write(&buffer[start_index..]); -let _ = stdout.write(b"\n"); -assert_eq!(&buffer[start_index..], b"162392"); - -let other_number: i32 = -6235; -start_index = other_number.numtoa(10, &mut buffer); -let _ = stdout.write(&buffer[start_index..]); -let _ = stdout.write(b"\n"); -assert_eq!(&buffer[start_index..], b"-6235"); - -let large_num: u64 = 35320842; -start_index = large_num.numtoa(10, &mut buffer); -let _ = stdout.write(&buffer[start_index..]); -let _ = stdout.write(b"\n"); -assert_eq!(&buffer[start_index..], b"35320842"); - -let max_u64: u64 = 18446744073709551615; -start_index = max_u64.numtoa(10, &mut buffer); -let _ = stdout.write(&buffer[start_index..]); -let _ = stdout.write(b"\n"); -assert_eq!(&buffer[start_index..], b"18446744073709551615"); -``` diff -Nru cargo-0.35.0/vendor/numtoa/src/lib.rs cargo-0.37.0/vendor/numtoa/src/lib.rs --- cargo-0.35.0/vendor/numtoa/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/numtoa/src/lib.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,540 +0,0 @@ -//! The standard library provides a convenient method of converting numbers into strings, but these strings are -//! heap-allocated. If you have an application which needs to convert large volumes of numbers into strings, but don't -//! want to pay the price of heap allocation, this crate provides an efficient `no_std`-compatible method of heaplessly converting numbers -//! into their string representations, storing the representation within a reusable byte array. -//! -//! In addition to supporting the standard base 10 conversion, this implementation allows you to select the base of -//! your choice. Therefore, if you want a binary representation, set the base to 2. If you want hexadecimal, set the -//! base to 16. -//! -//! # Convenience Example -//! -//! ``` -//! use numtoa::NumToA; -//! -//! let mut buf = [0u8; 20]; -//! let mut string = String::new(); -//! -//! for number in (1..10) { -//! string.push_str(number.numtoa_str(10, &mut buf)); -//! string.push('\n'); -//! } -//! -//! println!("{}", string); -//! ``` -//! -//! ## Base 10 Example -//! ``` -//! use numtoa::NumToA; -//! use std::io::{self, Write}; -//! -//! let stdout = io::stdout(); -//! let mut stdout = stdout.lock(); -//! let mut buffer = [0u8; 20]; -//! -//! let number: u32 = 162392; -//! let mut start_indice = number.numtoa(10, &mut buffer); -//! let _ = stdout.write(&buffer[start_indice..]); -//! let _ = stdout.write(b"\n"); -//! assert_eq!(&buffer[start_indice..], b"162392"); -//! -//! let other_number: i32 = -6235; -//! start_indice = other_number.numtoa(10, &mut buffer); -//! let _ = stdout.write(&buffer[start_indice..]); -//! let _ = stdout.write(b"\n"); -//! assert_eq!(&buffer[start_indice..], b"-6235"); -//! -//! let other_number: i8 = -128; -//! start_indice = other_number.numtoa(10, &mut buffer); -//! let _ = stdout.write(&buffer[start_indice..]); -//! let _ = stdout.write(b"\n"); -//! assert_eq!(&buffer[start_indice..], b"-128"); -//! -//! let other_number: i8 = 53; -//! start_indice = other_number.numtoa(10, &mut buffer); -//! let _ = stdout.write(&buffer[start_indice..]); -//! let _ = stdout.write(b"\n"); -//! assert_eq!(&buffer[start_indice..], b"53"); -//! -//! let other_number: i16 = -256; -//! start_indice = other_number.numtoa(10, &mut buffer); -//! let _ = stdout.write(&buffer[start_indice..]); -//! let _ = stdout.write(b"\n"); -//! assert_eq!(&buffer[start_indice..], b"-256"); -//! -//! let other_number: i16 = -32768; -//! start_indice = other_number.numtoa(10, &mut buffer); -//! let _ = stdout.write(&buffer[start_indice..]); -//! let _ = stdout.write(b"\n"); -//! assert_eq!(&buffer[start_indice..], b"-32768"); -//! -//! let large_num: u64 = 35320842; -//! start_indice = large_num.numtoa(10, &mut buffer); -//! let _ = stdout.write(&buffer[start_indice..]); -//! let _ = stdout.write(b"\n"); -//! assert_eq!(&buffer[start_indice..], b"35320842"); -//! -//! let max_u64: u64 = 18446744073709551615; -//! start_indice = max_u64.numtoa(10, &mut buffer); -//! let _ = stdout.write(&buffer[start_indice..]); -//! let _ = stdout.write(b"\n"); -//! assert_eq!(&buffer[start_indice..], b"18446744073709551615"); -//! ``` - -#![no_std] -use core::mem::size_of; - -#[cfg(feature = "std")] -extern crate std; -#[cfg(feature = "std")] -use std::str; - -/// Converts a number into a string representation, storing the conversion into a mutable byte slice. -pub trait NumToA { - /// Given a base for encoding and a mutable byte slice, write the number into the byte slice and return the - /// indice where the inner string begins. The inner string can be extracted by slicing the byte slice from - /// that indice. - /// - /// # Panics - /// If the supplied buffer is smaller than the number of bytes needed to write the integer, this will panic. - /// On debug builds, this function will perform a check on base 10 conversions to ensure that the input array - /// is large enough to hold the largest possible value in digits. - /// - /// # Example - /// ``` - /// use numtoa::NumToA; - /// use std::io::{self, Write}; - /// - /// let stdout = io::stdout(); - /// let stdout = &mut io::stdout(); - /// - /// let mut buffer = [0u8; 20]; - /// let number = 15325; - /// let start_indice = number.numtoa(10, &mut buffer); - /// let _ = stdout.write(&buffer[start_indice..]); - /// assert_eq!(&buffer[start_indice..], b"15325"); - /// ``` - fn numtoa(self, base: T, string: &mut [u8]) -> usize; - - #[cfg(feature = "std")] - /// Convenience method for quickly getting a string from the input's array buffer. - fn numtoa_str(self, base: T, buf: &mut [u8; 20]) -> &str; -} - -// A lookup table to prevent the need for conditional branching -// The value of the remainder of each step will be used as the index -const LOOKUP: &[u8] = b"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - -// A lookup table optimized for decimal lookups. Each two indices represents one possible number. -const DEC_LOOKUP: &[u8; 200] = b"0001020304050607080910111213141516171819\ - 2021222324252627282930313233343536373839\ - 4041424344454647484950515253545556575859\ - 6061626364656667686970717273747576777879\ - 8081828384858687888990919293949596979899"; - -macro_rules! base_10 { - ($number:ident, $index:ident, $string:ident) => { - // Decode four characters at the same time - while $number > 9999 { - let rem = ($number % 10000) as u16; - let (frst, scnd) = ((rem / 100) * 2, (rem % 100) * 2); - $string[$index-3..$index-1].copy_from_slice(&DEC_LOOKUP[frst as usize..frst as usize+2]); - $string[$index-1..$index+1].copy_from_slice(&DEC_LOOKUP[scnd as usize..scnd as usize+2]); - $index = $index.wrapping_sub(4); - $number /= 10000; - } - - if $number > 999 { - let (frst, scnd) = (($number / 100) * 2, ($number % 100) * 2); - $string[$index-3..$index-1].copy_from_slice(&DEC_LOOKUP[frst as usize..frst as usize+2]); - $string[$index-1..$index+1].copy_from_slice(&DEC_LOOKUP[scnd as usize..scnd as usize+2]); - $index = $index.wrapping_sub(4); - } else if $number > 99 { - let section = ($number as u16 / 10) * 2; - $string[$index-2..$index].copy_from_slice(&DEC_LOOKUP[section as usize..section as usize+2]); - $string[$index] = LOOKUP[($number % 10) as usize]; - $index = $index.wrapping_sub(3); - } else if $number > 9 { - $number *= 2; - $string[$index-1..$index+1].copy_from_slice(&DEC_LOOKUP[$number as usize..$number as usize+2]); - $index = $index.wrapping_sub(2); - } else { - $string[$index] = LOOKUP[$number as usize]; - $index = $index.wrapping_sub(1); - } - } -} - -macro_rules! impl_unsized_numtoa_for { - ($t:ty) => { - impl NumToA<$t> for $t { - fn numtoa(mut self, base: $t, string: &mut [u8]) -> usize { - // Check if the buffer is large enough and panic on debug builds if it isn't - if cfg!(debug_assertions) { - if base == 10 { - match size_of::<$t>() { - 2 => debug_assert!(string.len() >= 5, "u16 base 10 conversions require at least 5 bytes"), - 4 => debug_assert!(string.len() >= 10, "u32 base 10 conversions require at least 10 bytes"), - 8 => debug_assert!(string.len() >= 20, "u64 base 10 conversions require at least 20 bytes"), - _ => unreachable!() - } - } - } - - let mut index = string.len() - 1; - if self == 0 { - string[index] = b'0'; - return index; - } - - if base == 10 { - // Convert using optimized base 10 algorithm - base_10!(self, index, string); - } else { - while self != 0 { - let rem = self % base; - string[index] = LOOKUP[rem as usize]; - index = index.wrapping_sub(1); - self /= base; - } - } - - index.wrapping_add(1) - } - - #[cfg(feature = "std")] - fn numtoa_str(self, base: $t, buf: &mut [u8; 20]) -> &str { - let s = self.numtoa(base, buf); - unsafe { str::from_utf8_unchecked(&buf[s..]) } - } - } - } -} - -macro_rules! impl_sized_numtoa_for { - ($t:ty) => { - impl NumToA<$t> for $t { - fn numtoa(mut self, base: $t, string: &mut [u8]) -> usize { - if cfg!(debug_assertions) { - if base == 10 { - match size_of::<$t>() { - 2 => debug_assert!(string.len() >= 6, "i16 base 10 conversions require at least 6 bytes"), - 4 => debug_assert!(string.len() >= 11, "i32 base 10 conversions require at least 11 bytes"), - 8 => debug_assert!(string.len() >= 20, "i64 base 10 conversions require at least 20 bytes"), - _ => unreachable!() - } - } - } - - let mut index = string.len() - 1; - let mut is_negative = false; - - if self < 0 { - is_negative = true; - self = match self.checked_abs() { - Some(value) => value, - None => { - let value = <$t>::max_value(); - string[index] = LOOKUP[((value % base + 1) % base) as usize]; - index -= 1; - value / base + ((value % base == base - 1) as $t) - } - }; - } else if self == 0 { - string[index] = b'0'; - return index; - } - - if base == 10 { - // Convert using optimized base 10 algorithm - base_10!(self, index, string); - } else { - while self != 0 { - let rem = self % base; - string[index] = LOOKUP[rem as usize]; - index = index.wrapping_sub(1); - self /= base; - } - } - - if is_negative { - string[index] = b'-'; - index = index.wrapping_sub(1); - } - - index.wrapping_add(1) - } - - #[cfg(feature = "std")] - fn numtoa_str(self, base: $t, buf: &mut [u8; 20]) -> &str { - let s = self.numtoa(base, buf); - unsafe { str::from_utf8_unchecked(&buf[s..]) } - } - } - } -} - -impl_sized_numtoa_for!(i16); -impl_sized_numtoa_for!(i32); -impl_sized_numtoa_for!(i64); -impl_sized_numtoa_for!(isize); -impl_unsized_numtoa_for!(u16); -impl_unsized_numtoa_for!(u32); -impl_unsized_numtoa_for!(u64); -impl_unsized_numtoa_for!(usize); - -impl NumToA for i8 { - fn numtoa(mut self, base: i8, string: &mut [u8]) -> usize { - if cfg!(debug_assertions) { - if base == 10 { - debug_assert!(string.len() >= 4, "i8 conversions need at least 4 bytes"); - } - } - - let mut index = string.len() - 1; - let mut is_negative = false; - - if self < 0 { - is_negative = true; - self = match self.checked_abs() { - Some(value) => value, - None => { - let value = ::max_value(); - string[index] = LOOKUP[((value % base + 1) % base) as usize]; - index -= 1; - value / base + ((value % base == base - 1) as i8) - } - }; - } else if self == 0 { - string[index] = b'0'; - return index; - } - - if base == 10 { - if self > 99 { - let section = (self / 10) * 2; - string[index-2..index].copy_from_slice(&DEC_LOOKUP[section as usize..section as usize+2]); - string[index] = LOOKUP[(self % 10) as usize]; - index = index.wrapping_sub(3); - } else if self > 9 { - self *= 2; - string[index-1..index+1].copy_from_slice(&DEC_LOOKUP[self as usize..self as usize+2]); - index = index.wrapping_sub(2); - } else { - string[index] = LOOKUP[self as usize]; - index = index.wrapping_sub(1); - } - } else { - while self != 0 { - let rem = self % base; - string[index] = LOOKUP[rem as usize]; - index = index.wrapping_sub(1); - self /= base; - } - } - - if is_negative { - string[index] = b'-'; - index = index.wrapping_sub(1); - } - - index.wrapping_add(1) - } - - #[cfg(feature = "std")] - fn numtoa_str(self, base: Self, buf: &mut [u8; 20]) -> &str { - let s = self.numtoa(base, buf); - unsafe { str::from_utf8_unchecked(&buf[s..]) } - } -} - -impl NumToA for u8 { - fn numtoa(mut self, base: u8, string: &mut [u8]) -> usize { - if cfg!(debug_assertions) { - if base == 10 { - debug_assert!(string.len() >= 3, "u8 conversions need at least 3 bytes"); - } - } - - let mut index = string.len() - 1; - if self == 0 { - string[index] = b'0'; - return index; - } - - if base == 10 { - if self > 99 { - let section = (self / 10) * 2; - string[index-2..index].copy_from_slice(&DEC_LOOKUP[section as usize..section as usize+2]); - string[index] = LOOKUP[(self % 10) as usize]; - index = index.wrapping_sub(3); - } else if self > 9 { - self *= 2; - string[index-1..index+1].copy_from_slice(&DEC_LOOKUP[self as usize..self as usize+2]); - index = index.wrapping_sub(2); - } else { - string[index] = LOOKUP[self as usize]; - index = index.wrapping_sub(1); - } - } else { - while self != 0 { - let rem = self % base; - string[index] = LOOKUP[rem as usize]; - index = index.wrapping_sub(1); - self /= base; - } - } - - index.wrapping_add(1) - } - - #[cfg(feature = "std")] - fn numtoa_str(self, base: Self, buf: &mut [u8; 20]) -> &str { - let s = self.numtoa(base, buf); - unsafe { str::from_utf8_unchecked(&buf[s..]) } - } -} - -#[test] -fn str_convenience() { - let mut buffer = [0u8; 20]; - assert_eq!("256123", 256123.numtoa_str(10, &mut buffer)); -} - -#[test] -#[should_panic] -fn base10_u8_array_too_small() { - let mut buffer = [0u8; 2]; - let _ = 0u8.numtoa(10, &mut buffer); -} - -#[test] -fn base10_u8_array_just_right() { - let mut buffer = [0u8; 3]; - let _ = 0u8.numtoa(10, &mut buffer); -} - -#[test] -#[should_panic] -fn base10_i8_array_too_small() { - let mut buffer = [0u8; 3]; - let _ = 0i8.numtoa(10, &mut buffer); -} - -#[test] -fn base10_i8_array_just_right() { - let mut buffer = [0u8; 4]; - let i = (-127i8).numtoa(10, &mut buffer); - assert_eq!(&buffer[i..], b"-127"); -} - -#[test] -#[should_panic] -fn base10_i16_array_too_small() { - let mut buffer = [0u8; 5]; - let _ = 0i16.numtoa(10, &mut buffer); -} - -#[test] -fn base10_i16_array_just_right() { - let mut buffer = [0u8; 6]; - let i = (-12768i16).numtoa(10, &mut buffer); - assert_eq!(&buffer[i..], b"-12768"); -} - -#[test] -#[should_panic] -fn base10_u16_array_too_small() { - let mut buffer = [0u8; 4]; - let _ = 0u16.numtoa(10, &mut buffer); -} - -#[test] -fn base10_u16_array_just_right() { - let mut buffer = [0u8; 5]; - let _ = 0u16.numtoa(10, &mut buffer); -} - -#[test] -#[should_panic] -fn base10_i32_array_too_small() { - let mut buffer = [0u8; 10]; - let _ = 0i32.numtoa(10, &mut buffer); -} - -#[test] -fn base10_i32_array_just_right() { - let mut buffer = [0u8; 11]; - let _ = 0i32.numtoa(10, &mut buffer); -} - -#[test] -#[should_panic] -fn base10_u32_array_too_small() { - let mut buffer = [0u8; 9]; - let _ = 0u32.numtoa(10, &mut buffer); -} - -#[test] -fn base10_u32_array_just_right() { - let mut buffer = [0u8; 10]; - let _ = 0u32.numtoa(10, &mut buffer); -} - -#[test] -#[should_panic] -fn base10_i64_array_too_small() { - let mut buffer = [0u8; 19]; - let _ = 0i64.numtoa(10, &mut buffer); -} - -#[test] -fn base10_i64_array_just_right() { - let mut buffer = [0u8; 20]; - let _ = 0i64.numtoa(10, &mut buffer); -} - -#[test] -#[should_panic] -fn base10_u64_array_too_small() { - let mut buffer = [0u8; 19]; - let _ = 0u64.numtoa(10, &mut buffer); -} - -#[test] -fn base10_u64_array_just_right() { - let mut buffer = [0u8; 20]; - let _ = 0u64.numtoa(10, &mut buffer); -} - -#[test] -fn base8_min_signed_number() { - let mut buffer = [0u8; 30]; - let i = (-128i8).numtoa(8, &mut buffer); - assert_eq!(&buffer[i..], b"-200"); - - let i = (-32768i16).numtoa(8, &mut buffer); - assert_eq!(&buffer[i..], b"-100000"); - - let i = (-2147483648i32).numtoa(8, &mut buffer); - assert_eq!(&buffer[i..], b"-20000000000"); - - let i = (-9223372036854775808i64).numtoa(8, &mut buffer); - assert_eq!(&buffer[i..], b"-1000000000000000000000"); -} - -#[test] -fn base16_min_signed_number() { - let mut buffer = [0u8; 20]; - let i = (-128i8).numtoa(16, &mut buffer); - assert_eq!(&buffer[i..], b"-80"); - - let i = (-32768i16).numtoa(16, &mut buffer); - assert_eq!(&buffer[i..], b"-8000"); - - let i = (-2147483648i32).numtoa(16, &mut buffer); - assert_eq!(&buffer[i..], b"-80000000"); - - let i = (-9223372036854775808i64).numtoa(16, &mut buffer); - assert_eq!(&buffer[i..], b"-8000000000000000"); -} diff -Nru cargo-0.35.0/vendor/num-traits/bors.toml cargo-0.37.0/vendor/num-traits/bors.toml --- cargo-0.35.0/vendor/num-traits/bors.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-traits/bors.toml 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -status = [ - "continuous-integration/travis-ci/push", -] diff -Nru cargo-0.35.0/vendor/num-traits/build.rs cargo-0.37.0/vendor/num-traits/build.rs --- cargo-0.35.0/vendor/num-traits/build.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-traits/build.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,35 +1,14 @@ +extern crate autocfg; + use std::env; -use std::io::Write; -use std::process::{Command, Stdio}; fn main() { - if probe("fn main() { 0i128; }") { + let ac = autocfg::new(); + if ac.probe_type("i128") { println!("cargo:rustc-cfg=has_i128"); } else if env::var_os("CARGO_FEATURE_I128").is_some() { panic!("i128 support was not detected!"); } -} - -/// Test if a code snippet can be compiled -fn probe(code: &str) -> bool { - let rustc = env::var_os("RUSTC").unwrap_or_else(|| "rustc".into()); - let out_dir = env::var_os("OUT_DIR").expect("environment variable OUT_DIR"); - - let mut child = Command::new(rustc) - .arg("--out-dir") - .arg(out_dir) - .arg("--emit=obj") - .arg("-") - .stdin(Stdio::piped()) - .spawn() - .expect("rustc probe"); - - child - .stdin - .as_mut() - .expect("rustc stdin") - .write_all(code.as_bytes()) - .expect("write rustc stdin"); - child.wait().expect("rustc probe").success() + autocfg::rerun_path(file!()); } diff -Nru cargo-0.35.0/vendor/num-traits/.cargo-checksum.json cargo-0.37.0/vendor/num-traits/.cargo-checksum.json --- cargo-0.35.0/vendor/num-traits/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-traits/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1"} \ No newline at end of file +{"files":{},"package":"6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/num-traits/Cargo.toml cargo-0.37.0/vendor/num-traits/Cargo.toml --- cargo-0.35.0/vendor/num-traits/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-traits/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,9 +12,10 @@ [package] name = "num-traits" -version = "0.2.6" +version = "0.2.8" authors = ["The Rust Project Developers"] build = "build.rs" +exclude = ["/ci/*", "/.travis.yml", "/bors.toml"] description = "Numeric traits for generic mathematics" homepage = "https://github.com/rust-num/num-traits" documentation = "https://docs.rs/num-traits" @@ -27,6 +28,8 @@ features = ["std"] [dependencies] +[build-dependencies.autocfg] +version = "0.1.3" [features] default = ["std"] diff -Nru cargo-0.35.0/vendor/num-traits/ci/rustup.sh cargo-0.37.0/vendor/num-traits/ci/rustup.sh --- cargo-0.35.0/vendor/num-traits/ci/rustup.sh 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-traits/ci/rustup.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -#!/bin/sh -# Use rustup to locally run the same suite of tests as .travis.yml. -# (You should first install/update 1.8.0, stable, beta, and nightly.) - -set -ex - -export TRAVIS_RUST_VERSION -for TRAVIS_RUST_VERSION in 1.8.0 1.15.0 1.20.0 stable beta nightly; do - run="rustup run $TRAVIS_RUST_VERSION" - $run $PWD/ci/test_full.sh -done diff -Nru cargo-0.35.0/vendor/num-traits/ci/test_full.sh cargo-0.37.0/vendor/num-traits/ci/test_full.sh --- cargo-0.35.0/vendor/num-traits/ci/test_full.sh 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-traits/ci/test_full.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -#!/bin/bash - -set -ex - -echo Testing num-traits on rustc ${TRAVIS_RUST_VERSION} - -# num-traits should build and test everywhere. -cargo build --verbose -cargo test --verbose - -# test `no_std` -cargo build --verbose --no-default-features -cargo test --verbose --no-default-features - -# test `i128` -if [[ "$TRAVIS_RUST_VERSION" =~ ^(nightly|beta|stable)$ ]]; then - cargo build --verbose --features=i128 - cargo test --verbose --features=i128 -fi diff -Nru cargo-0.35.0/vendor/num-traits/RELEASES.md cargo-0.37.0/vendor/num-traits/RELEASES.md --- cargo-0.35.0/vendor/num-traits/RELEASES.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-traits/RELEASES.md 2019-07-17 05:42:23.000000000 +0000 @@ -1,3 +1,24 @@ +# Release 0.2.8 (2019-05-21) + +- [Fixed feature detection on `no_std` targets][116]. + +**Contributors**: @cuviper + +[116]: https://github.com/rust-num/num-traits/pull/116 + +# Release 0.2.7 (2019-05-20) + +- [Documented when `CheckedShl` and `CheckedShr` return `None`][90]. +- [The new `Zero::set_zero` and `One::set_one`][104] will set values to their + identities in place, possibly optimized better than direct assignment. +- [Documented general features and intentions of `PrimInt`][108]. + +**Contributors**: @cuviper, @dvdhrm, @ignatenkobrain, @lcnr, @samueltardieu + +[90]: https://github.com/rust-num/num-traits/pull/90 +[104]: https://github.com/rust-num/num-traits/pull/104 +[108]: https://github.com/rust-num/num-traits/pull/108 + # Release 0.2.6 (2018-09-13) - [Documented that `pow(0, 0)` returns `1`][79]. Mathematically, this is not diff -Nru cargo-0.35.0/vendor/num-traits/src/identities.rs cargo-0.37.0/vendor/num-traits/src/identities.rs --- cargo-0.35.0/vendor/num-traits/src/identities.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-traits/src/identities.rs 2019-07-17 05:42:23.000000000 +0000 @@ -2,16 +2,15 @@ use core::ops::{Add, Mul}; /// Defines an additive identity element for `Self`. +/// +/// # Laws +/// +/// ```{.text} +/// a + 0 = a ∀ a ∈ Self +/// 0 + a = a ∀ a ∈ Self +/// ``` pub trait Zero: Sized + Add { /// Returns the additive identity element of `Self`, `0`. - /// - /// # Laws - /// - /// ```{.text} - /// a + 0 = a ∀ a ∈ Self - /// 0 + a = a ∀ a ∈ Self - /// ``` - /// /// # Purity /// /// This function should return the same result at all times regardless of @@ -20,6 +19,11 @@ // This cannot be an associated constant, because of bignums. fn zero() -> Self; + /// Sets `self` to the additive identity element of `Self`, `0`. + fn set_zero(&mut self) { + *self = Zero::zero(); + } + /// Returns `true` if `self` is equal to the additive identity. #[inline] fn is_zero(&self) -> bool; @@ -66,22 +70,27 @@ fn is_zero(&self) -> bool { self.0.is_zero() } + + fn set_zero(&mut self) { + self.0.set_zero(); + } + fn zero() -> Self { Wrapping(T::zero()) } } /// Defines a multiplicative identity element for `Self`. +/// +/// # Laws +/// +/// ```{.text} +/// a * 1 = a ∀ a ∈ Self +/// 1 * a = a ∀ a ∈ Self +/// ``` pub trait One: Sized + Mul { /// Returns the multiplicative identity element of `Self`, `1`. /// - /// # Laws - /// - /// ```{.text} - /// a * 1 = a ∀ a ∈ Self - /// 1 * a = a ∀ a ∈ Self - /// ``` - /// /// # Purity /// /// This function should return the same result at all times regardless of @@ -90,6 +99,11 @@ // This cannot be an associated constant, because of bignums. fn one() -> Self; + /// Sets `self` to the multiplicative identity element of `Self`, `1`. + fn set_one(&mut self) { + *self = One::one(); + } + /// Returns `true` if `self` is equal to the multiplicative identity. /// /// For performance reasons, it's best to implement this manually. @@ -111,6 +125,10 @@ fn one() -> $t { $v } + #[inline] + fn is_one(&self) -> bool { + *self == $v + } } }; } @@ -138,6 +156,10 @@ where Wrapping: Mul>, { + fn set_one(&mut self) { + self.0.set_one(); + } + fn one() -> Self { Wrapping(T::one()) } diff -Nru cargo-0.35.0/vendor/num-traits/src/int.rs cargo-0.37.0/vendor/num-traits/src/int.rs --- cargo-0.35.0/vendor/num-traits/src/int.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-traits/src/int.rs 2019-07-17 05:42:23.000000000 +0000 @@ -5,6 +5,32 @@ use ops::saturating::Saturating; use {Num, NumCast}; +/// Generic trait for primitive integers. +/// +/// The `PrimInt` trait is an abstraction over the builtin primitive integer types (e.g., `u8`, +/// `u32`, `isize`, `i128`, ...). It inherits the basic numeric traits and extends them with +/// bitwise operators and non-wrapping arithmetic. +/// +/// The trait explicitly inherits `Copy`, `Eq`, `Ord`, and `Sized`. The intention is that all +/// types implementing this trait behave like primitive types that are passed by value by default +/// and behave like builtin integers. Furthermore, the types are expected to expose the integer +/// value in binary representation and support bitwise operators. The standard bitwise operations +/// (e.g., bitwise-and, bitwise-or, right-shift, left-shift) are inherited and the trait extends +/// these with introspective queries (e.g., `PrimInt::count_ones()`, `PrimInt::leading_zeros()`), +/// bitwise combinators (e.g., `PrimInt::rotate_left()`), and endianness converters (e.g., +/// `PrimInt::to_be()`). +/// +/// All `PrimInt` types are expected to be fixed-width binary integers. The width can be queried +/// via `T::zero().count_zeros()`. The trait currently lacks a way to query the width at +/// compile-time. +/// +/// While a default implementation for all builtin primitive integers is provided, the trait is in +/// no way restricted to these. Other integer types that fulfil the requirements are free to +/// implement the trait was well. +/// +/// This trait and many of the method names originate in the unstable `core::num::Int` trait from +/// the rust standard library. The original trait was never stabilized and thus removed from the +/// standard library. pub trait PrimInt: Sized + Copy @@ -171,10 +197,10 @@ /// ``` /// use num_traits::PrimInt; /// - /// let n = 0xFEDCBA9876543210i64; - /// let m = 0x000FEDCBA9876543i64; + /// let n = -8i8; // 0b11111000 + /// let m = 62i8; // 0b00111110 /// - /// assert_eq!(n.unsigned_shr(12), m); + /// assert_eq!(n.unsigned_shr(2), m); /// ``` fn unsigned_shr(self, n: u32) -> Self; diff -Nru cargo-0.35.0/vendor/num-traits/src/lib.rs cargo-0.37.0/vendor/num-traits/src/lib.rs --- cargo-0.35.0/vendor/num-traits/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-traits/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -90,13 +90,12 @@ { } -impl NumOps for T -where +impl NumOps for T where T: Add + Sub + Mul + Div - + Rem, + + Rem { } @@ -105,22 +104,14 @@ /// /// This is automatically implemented for types which implement the operators. pub trait NumRef: Num + for<'r> NumOps<&'r Self> {} -impl NumRef for T -where - T: Num + for<'r> NumOps<&'r T>, -{ -} +impl NumRef for T where T: Num + for<'r> NumOps<&'r T> {} /// The trait for references which implement numeric operations, taking the /// second operand either by value or by reference. /// /// This is automatically implemented for types which implement the operators. pub trait RefNum: NumOps + for<'r> NumOps<&'r Base, Base> {} -impl RefNum for T -where - T: NumOps + for<'r> NumOps<&'r Base, Base>, -{ -} +impl RefNum for T where T: NumOps + for<'r> NumOps<&'r Base, Base> {} /// The trait for types implementing numeric assignment operators (like `+=`). /// @@ -130,9 +121,8 @@ { } -impl NumAssignOps for T -where - T: AddAssign + SubAssign + MulAssign + DivAssign + RemAssign, +impl NumAssignOps for T where + T: AddAssign + SubAssign + MulAssign + DivAssign + RemAssign { } @@ -140,22 +130,14 @@ /// /// This is automatically implemented for types which implement the operators. pub trait NumAssign: Num + NumAssignOps {} -impl NumAssign for T -where - T: Num + NumAssignOps, -{ -} +impl NumAssign for T where T: Num + NumAssignOps {} /// The trait for `NumAssign` types which also implement assignment operations /// taking the second operand by reference. /// /// This is automatically implemented for types which implement the operators. pub trait NumAssignRef: NumAssign + for<'r> NumAssignOps<&'r Self> {} -impl NumAssignRef for T -where - T: NumAssign + for<'r> NumAssignOps<&'r T>, -{ -} +impl NumAssignRef for T where T: NumAssign + for<'r> NumAssignOps<&'r T> {} macro_rules! int_trait_impl { ($name:ident for $($t:ty)*) => ($( diff -Nru cargo-0.35.0/vendor/num-traits/src/ops/checked.rs cargo-0.37.0/vendor/num-traits/src/ops/checked.rs --- cargo-0.35.0/vendor/num-traits/src/ops/checked.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-traits/src/ops/checked.rs 2019-07-17 05:42:23.000000000 +0000 @@ -195,10 +195,11 @@ #[cfg(has_i128)] checked_impl_unary!(CheckedNeg, checked_neg, i128); -/// Performs a left shift that returns `None` on overflow. +/// Performs a left shift that returns `None` on shifts larger than +/// the type width. pub trait CheckedShl: Sized + Shl { - /// Shifts a number to the left, checking for overflow. If overflow happens, - /// `None` is returned. + /// Checked shift left. Computes `self << rhs`, returning `None` + /// if `rhs` is larger than or equal to the number of bits in `self`. /// /// ``` /// use num_traits::CheckedShl; @@ -240,10 +241,11 @@ #[cfg(has_i128)] checked_shift_impl!(CheckedShl, checked_shl, i128); -/// Performs a right shift that returns `None` on overflow. +/// Performs a right shift that returns `None` on shifts larger than +/// the type width. pub trait CheckedShr: Sized + Shr { - /// Shifts a number to the left, checking for overflow. If overflow happens, - /// `None` is returned. + /// Checked shift right. Computes `self >> rhs`, returning `None` + /// if `rhs` is larger than or equal to the number of bits in `self`. /// /// ``` /// use num_traits::CheckedShr; diff -Nru cargo-0.35.0/vendor/num-traits/src/sign.rs cargo-0.37.0/vendor/num-traits/src/sign.rs --- cargo-0.35.0/vendor/num-traits/src/sign.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/num-traits/src/sign.rs 2019-07-17 05:42:23.000000000 +0000 @@ -206,11 +206,7 @@ #[cfg(has_i128)] empty_trait_impl!(Unsigned for u128); -impl Unsigned for Wrapping -where - Wrapping: Num, -{ -} +impl Unsigned for Wrapping where Wrapping: Num {} #[test] fn unsigned_wrapping_is_unsigned() { diff -Nru cargo-0.35.0/vendor/opener/.cargo-checksum.json cargo-0.37.0/vendor/opener/.cargo-checksum.json --- cargo-0.35.0/vendor/opener/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/opener/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"04b1d6b086d9b3009550f9b6f81b10ad9428cf14f404b8e1a3a06f6f012c8ec9"} \ No newline at end of file +{"files":{},"package":"998c59e83d9474c01127a96e023b7a04bb061dd286bf8bb939d31dc8d31a7448"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/opener/Cargo.toml cargo-0.37.0/vendor/opener/Cargo.toml --- cargo-0.35.0/vendor/opener/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/opener/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,18 +12,15 @@ [package] name = "opener" -version = "0.3.2" +version = "0.4.0" authors = ["Brian Bowman "] description = "Open a file or link using the system default program." readme = "../README.md" keywords = ["open", "default", "launcher", "browser"] license = "MIT OR Apache-2.0" repository = "https://github.com/Seeker14491/opener" -[dependencies.failure] -version = "0.1.2" -[dependencies.failure_derive] -version = "0.1.2" +[dependencies] [target."cfg(windows)".dependencies.winapi] version = "0.3" features = ["shellapi"] diff -Nru cargo-0.35.0/vendor/opener/LICENSE-APACHE cargo-0.37.0/vendor/opener/LICENSE-APACHE --- cargo-0.35.0/vendor/opener/LICENSE-APACHE 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/opener/LICENSE-APACHE 2019-07-17 05:42:23.000000000 +0000 @@ -1,199 +1 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor 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, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file +../LICENSE-APACHE \ No newline at end of file diff -Nru cargo-0.35.0/vendor/opener/LICENSE-MIT cargo-0.37.0/vendor/opener/LICENSE-MIT --- cargo-0.35.0/vendor/opener/LICENSE-MIT 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/opener/LICENSE-MIT 2019-07-17 05:42:23.000000000 +0000 @@ -1,19 +1 @@ -MIT License - -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 is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +../LICENSE-MIT \ No newline at end of file diff -Nru cargo-0.35.0/vendor/opener/LICENSE-THIRD-PARTY cargo-0.37.0/vendor/opener/LICENSE-THIRD-PARTY --- cargo-0.35.0/vendor/opener/LICENSE-THIRD-PARTY 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/opener/LICENSE-THIRD-PARTY 2019-07-17 05:42:23.000000000 +0000 @@ -1,19 +1 @@ -- xdg-utils: https://cgit.freedesktop.org/xdg/xdg-utils/plain/LICENSE - - 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 is furnished to do so, subject to the following conditions: - # - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - # - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +../LICENSE-THIRD-PARTY \ No newline at end of file diff -Nru cargo-0.35.0/vendor/opener/.pc/disable-vendor.patch/src/lib.rs cargo-0.37.0/vendor/opener/.pc/disable-vendor.patch/src/lib.rs --- cargo-0.35.0/vendor/opener/.pc/disable-vendor.patch/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/opener/.pc/disable-vendor.patch/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -16,9 +16,6 @@ //! On Windows the `ShellExecuteW` Windows API function is used. On Mac the system `open` command is //! used. On other platforms, the `xdg-open` script is used. The system `xdg-open` is not used; //! instead a version is embedded within this library. -extern crate failure; -#[macro_use] -extern crate failure_derive; #[cfg(target_os = "windows")] extern crate winapi; @@ -27,6 +24,7 @@ use windows::open_sys; use std::{ + error::Error, ffi::OsStr, fmt::{self, Display, Formatter}, io, @@ -37,10 +35,9 @@ /// function. /// /// The `ExitStatus` variant will never be returned on Windows. -#[derive(Debug, Fail)] +#[derive(Debug)] pub enum OpenError { /// An IO error occurred. - #[cause] Io(io::Error), /// The command exited with a non-zero exit status. @@ -84,6 +81,15 @@ } } +impl Error for OpenError { + fn source(&self) -> Option<&(dyn Error + 'static)> { + match self { + OpenError::Io(inner) => Some(inner), + OpenError::ExitStatus { .. } => None, + } + } +} + impl From for OpenError { fn from(err: io::Error) -> Self { OpenError::Io(err) diff -Nru cargo-0.35.0/vendor/opener/src/lib.rs cargo-0.37.0/vendor/opener/src/lib.rs --- cargo-0.35.0/vendor/opener/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/opener/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -16,9 +16,6 @@ //! On Windows the `ShellExecuteW` Windows API function is used. On Mac the system `open` command is //! used. On other platforms, the system `xdg-open` script is used. //! instead a version is embedded within this library. -extern crate failure; -#[macro_use] -extern crate failure_derive; #[cfg(target_os = "windows")] extern crate winapi; @@ -27,6 +24,7 @@ use windows::open_sys; use std::{ + error::Error, ffi::OsStr, fmt::{self, Display, Formatter}, io, @@ -37,10 +35,9 @@ /// function. /// /// The `ExitStatus` variant will never be returned on Windows. -#[derive(Debug, Fail)] +#[derive(Debug)] pub enum OpenError { /// An IO error occurred. - #[cause] Io(io::Error), /// The command exited with a non-zero exit status. @@ -84,6 +81,15 @@ } } +impl Error for OpenError { + fn source(&self) -> Option<&(dyn Error + 'static)> { + match self { + OpenError::Io(inner) => Some(inner), + OpenError::ExitStatus { .. } => None, + } + } +} + impl From for OpenError { fn from(err: io::Error) -> Self { OpenError::Io(err) diff -Nru cargo-0.35.0/vendor/openssl/.cargo-checksum.json cargo-0.37.0/vendor/openssl/.cargo-checksum.json --- cargo-0.35.0/vendor/openssl/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/openssl/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"a51f452b82d622fc8dd973d7266e9055ac64af25b957d9ced3989142dc61cb6b"} \ No newline at end of file +{"files":{},"package":"97c140cbb82f3b3468193dd14c1b88def39f341f68257f8a7fe8ed9ed3f628a5"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/openssl/Cargo.toml cargo-0.37.0/vendor/openssl/Cargo.toml --- cargo-0.35.0/vendor/openssl/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/openssl/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "openssl" -version = "0.10.22" +version = "0.10.23" authors = ["Steven Fackler "] description = "OpenSSL bindings" readme = "README.md" @@ -36,7 +36,7 @@ version = "0.2" [dependencies.openssl-sys] -version = "0.9.45" +version = "0.9.47" [dev-dependencies.hex] version = "0.3" diff -Nru cargo-0.35.0/vendor/openssl/CHANGELOG.md cargo-0.37.0/vendor/openssl/CHANGELOG.md --- cargo-0.35.0/vendor/openssl/CHANGELOG.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/openssl/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -2,6 +2,16 @@ ## [Unreleased] +## [v0.10.23] + +### Fixed + +* Fixed session callbacks when an `Ssl`'s context is replaced. + +### Added + +* Added `SslContextBuilder::add_client_ca`. + ## [v0.10.22] ### Added @@ -359,7 +369,8 @@ Look at the [release tags] for information about older releases. -[Unreleased]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.22...master +[Unreleased]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.23...master +[v0.10.23]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.22...openssl-v0.10.23 [v0.10.22]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.21...openssl-v0.10.22 [v0.10.21]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.20...openssl-v0.10.21 [v0.10.20]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.19...openssl-v0.10.20 diff -Nru cargo-0.35.0/vendor/openssl/.pc/disable-vendor.patch/Cargo.toml cargo-0.37.0/vendor/openssl/.pc/disable-vendor.patch/Cargo.toml --- cargo-0.35.0/vendor/openssl/.pc/disable-vendor.patch/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/openssl/.pc/disable-vendor.patch/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "openssl" -version = "0.10.22" +version = "0.10.23" authors = ["Steven Fackler "] description = "OpenSSL bindings" readme = "README.md" @@ -36,7 +36,7 @@ version = "0.2" [dependencies.openssl-sys] -version = "0.9.45" +version = "0.9.47" [dev-dependencies.hex] version = "0.3" diff -Nru cargo-0.35.0/vendor/openssl/src/ssl/callbacks.rs cargo-0.37.0/vendor/openssl/src/ssl/callbacks.rs --- cargo-0.35.0/vendor/openssl/src/ssl/callbacks.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/openssl/src/ssl/callbacks.rs 2019-07-17 05:42:23.000000000 +0000 @@ -24,7 +24,7 @@ use ssl::AlpnError; #[cfg(ossl111)] use ssl::{ClientHelloResponse, ExtensionContext}; -use ssl::{SniError, Ssl, SslAlert, SslContext, SslContextRef, SslRef, SslSession, SslSessionRef}; +use ssl::{SniError, Ssl, SslAlert, SslContext, SslContextRef, SslRef, SslSession, SslSessionRef, SESSION_CTX_INDEX}; #[cfg(ossl111)] use x509::X509Ref; use x509::{X509StoreContext, X509StoreContextRef}; @@ -353,7 +353,8 @@ { let ssl = SslRef::from_ptr_mut(ssl); let callback = ssl - .ssl_context() + .ex_data(*SESSION_CTX_INDEX) + .expect("BUG: session context missing") .ex_data(SslContext::cached_ex_index::()) .expect("BUG: new session callback missing") as *const F; let session = SslSession::from_ptr(session); @@ -398,7 +399,8 @@ { let ssl = SslRef::from_ptr_mut(ssl); let callback = ssl - .ssl_context() + .ex_data(*SESSION_CTX_INDEX) + .expect("BUG: session context missing") .ex_data(SslContext::cached_ex_index::()) .expect("BUG: get session callback missing") as *const F; let data = slice::from_raw_parts(data as *const u8, len as usize); diff -Nru cargo-0.35.0/vendor/openssl/src/ssl/mod.rs cargo-0.37.0/vendor/openssl/src/ssl/mod.rs --- cargo-0.35.0/vendor/openssl/src/ssl/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/openssl/src/ssl/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -486,6 +486,8 @@ lazy_static! { static ref INDEXES: Mutex> = Mutex::new(HashMap::new()); static ref SSL_INDEXES: Mutex> = Mutex::new(HashMap::new()); + + static ref SESSION_CTX_INDEX: Index = Ssl::new_ex_index().unwrap(); } unsafe extern "C" fn free_data_box( @@ -870,6 +872,23 @@ } } + /// Add the provided CA certificate to the list sent by the server to the client when + /// requesting client-side TLS authentication. + /// + /// This corresponds to [`SSL_CTX_add_client_CA`]. + /// + /// [`SSL_CTX_add_client_CA`]: https://www.openssl.org/docs/man1.0.2/man3/SSL_CTX_set_client_CA_list.html + #[cfg(not(libressl))] + pub fn add_client_ca(&mut self, cacert: &X509Ref) -> Result<(), ErrorStack> { + unsafe { + cvt(ffi::SSL_CTX_add_client_CA( + self.as_ptr(), + cacert.as_ptr() + )) + .map(|_| ()) + } + } + /// Set the context identifier for sessions. /// /// This value identifies the server's session cache to clients, telling them when they're @@ -2261,10 +2280,14 @@ /// This corresponds to [`SSL_new`]. /// /// [`SSL_new`]: https://www.openssl.org/docs/man1.0.2/ssl/SSL_new.html + // FIXME should take &SslContextRef pub fn new(ctx: &SslContext) -> Result { unsafe { - let ssl = cvt_p(ffi::SSL_new(ctx.as_ptr()))?; - Ok(Ssl::from_ptr(ssl)) + let ptr = cvt_p(ffi::SSL_new(ctx.as_ptr()))?; + let mut ssl = Ssl::from_ptr(ptr); + ssl.set_ex_data(*SESSION_CTX_INDEX, ctx.clone()); + + Ok(ssl) } } diff -Nru cargo-0.35.0/vendor/openssl/src/ssl/test/mod.rs cargo-0.37.0/vendor/openssl/src/ssl/test/mod.rs --- cargo-0.35.0/vendor/openssl/src/ssl/test/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/openssl/src/ssl/test/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -30,7 +30,7 @@ use ssl::{ Error, HandshakeError, MidHandshakeSslStream, ShutdownResult, ShutdownState, Ssl, SslAcceptor, SslConnector, SslContext, SslFiletype, SslMethod, SslOptions, SslSessionCacheMode, SslStream, - SslVerifyMode, StatusType, + SslVerifyMode, StatusType, SslContextBuilder }; #[cfg(ossl102)] use x509::store::X509StoreBuilder; @@ -1021,6 +1021,34 @@ client.connect(); + assert!(CALLED_BACK.load(Ordering::SeqCst)); +} + +#[test] +fn new_session_callback_swapped_ctx() { + static CALLED_BACK: AtomicBool = AtomicBool::new(false); + + let mut server = Server::builder(); + server.ctx().set_session_id_context(b"foo").unwrap(); + + let server = server.build(); + + let mut client = server.client(); + + client + .ctx() + .set_session_cache_mode(SslSessionCacheMode::CLIENT | SslSessionCacheMode::NO_INTERNAL); + client + .ctx() + .set_new_session_callback(|_, _| CALLED_BACK.store(true, Ordering::SeqCst)); + + let mut client = client.build().builder(); + + let ctx = SslContextBuilder::new(SslMethod::tls()).unwrap().build(); + client.ssl().set_ssl_context(&ctx).unwrap(); + + client.connect(); + assert!(CALLED_BACK.load(Ordering::SeqCst)); } diff -Nru cargo-0.35.0/vendor/openssl-sys/.cargo-checksum.json cargo-0.37.0/vendor/openssl-sys/.cargo-checksum.json --- cargo-0.35.0/vendor/openssl-sys/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/openssl-sys/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"05636e06b4f8762d4b81d24a351f3966f38bd25ccbcfd235606c91fdb82cc60f"} \ No newline at end of file +{"files":{},"package":"75bdd6dbbb4958d38e47a1d2348847ad1eb4dc205dc5d37473ae504391865acc"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/openssl-sys/Cargo.toml cargo-0.37.0/vendor/openssl-sys/Cargo.toml --- cargo-0.35.0/vendor/openssl-sys/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/openssl-sys/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "openssl-sys" -version = "0.9.46" +version = "0.9.47" authors = ["Alex Crichton ", "Steven Fackler "] build = "build/main.rs" links = "openssl" diff -Nru cargo-0.35.0/vendor/openssl-sys/CHANGELOG.md cargo-0.37.0/vendor/openssl-sys/CHANGELOG.md --- cargo-0.35.0/vendor/openssl-sys/CHANGELOG.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/openssl-sys/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -2,6 +2,12 @@ ## [Unreleased] +## [v0.9.47] - 2019-05-18 + +### Added + +* Added `SSL_CTX_add_client_CA`. + ## [v0.9.46] - 2019-05-08 ### Added @@ -34,7 +40,8 @@ * Added `X509_verify` and `X509_REQ_verify`. * Added `EVP_MD_type` and `EVP_GROUP_get_curve_name`. -[Unreleased]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.46...master +[Unreleased]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.47...master +[v0.9.47]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.46...openssl-sys-v0.9.47 [v0.9.46]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.45...openssl-sys-v0.9.46 [v0.9.45]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.44...openssl-sys-v0.9.45 [v0.9.44]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.43...openssl-sys-v0.9.44 diff -Nru cargo-0.35.0/vendor/openssl-sys/.pc/disable-vendor.patch/Cargo.toml cargo-0.37.0/vendor/openssl-sys/.pc/disable-vendor.patch/Cargo.toml --- cargo-0.35.0/vendor/openssl-sys/.pc/disable-vendor.patch/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/openssl-sys/.pc/disable-vendor.patch/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "openssl-sys" -version = "0.9.46" +version = "0.9.47" authors = ["Alex Crichton ", "Steven Fackler "] build = "build/main.rs" links = "openssl" diff -Nru cargo-0.35.0/vendor/openssl-sys/src/ssl.rs cargo-0.37.0/vendor/openssl-sys/src/ssl.rs --- cargo-0.35.0/vendor/openssl-sys/src/ssl.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/openssl-sys/src/ssl.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1093,6 +1093,9 @@ pub fn SSL_CTX_set_client_CA_list(ctx: *mut SSL_CTX, list: *mut stack_st_X509_NAME); + #[cfg(not(libressl))] + pub fn SSL_CTX_add_client_CA(ctx: *mut SSL_CTX, cacert: *mut X509) -> c_int; + pub fn SSL_CTX_set_default_verify_paths(ctx: *mut SSL_CTX) -> c_int; pub fn SSL_CTX_load_verify_locations( ctx: *mut SSL_CTX, diff -Nru cargo-0.35.0/vendor/ppv-lite86/.cargo-checksum.json cargo-0.37.0/vendor/ppv-lite86/.cargo-checksum.json --- cargo-0.35.0/vendor/ppv-lite86/.cargo-checksum.json 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/ppv-lite86/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +{"files":{},"package":"e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/ppv-lite86/Cargo.toml cargo-0.37.0/vendor/ppv-lite86/Cargo.toml --- cargo-0.35.0/vendor/ppv-lite86/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/ppv-lite86/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,31 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# 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] +edition = "2018" +name = "ppv-lite86" +version = "0.2.5" +authors = ["The CryptoCorrosion Contributors"] +description = "Implementation of the crypto-simd API for x86" +keywords = ["crypto", "simd", "x86"] +categories = ["cryptography", "no-std"] +license = "MIT/Apache-2.0" +repository = "https://github.com/cryptocorrosion/cryptocorrosion" + +[dependencies] + +[features] +default = ["std", "simd"] +simd = [] +std = [] +[badges.travis-ci] +repository = "cryptocorrosion/cryptocorrosion" diff -Nru cargo-0.35.0/vendor/ppv-lite86/LICENSE-APACHE cargo-0.37.0/vendor/ppv-lite86/LICENSE-APACHE --- cargo-0.35.0/vendor/ppv-lite86/LICENSE-APACHE 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/ppv-lite86/LICENSE-APACHE 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor 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, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2019 The CryptoCorrosion Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff -Nru cargo-0.35.0/vendor/ppv-lite86/LICENSE-MIT cargo-0.37.0/vendor/ppv-lite86/LICENSE-MIT --- cargo-0.35.0/vendor/ppv-lite86/LICENSE-MIT 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/ppv-lite86/LICENSE-MIT 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,25 @@ +Copyright (c) 2019 The CryptoCorrosion Contributors + +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 +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff -Nru cargo-0.35.0/vendor/ppv-lite86/src/generic.rs cargo-0.37.0/vendor/ppv-lite86/src/generic.rs --- cargo-0.35.0/vendor/ppv-lite86/src/generic.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/ppv-lite86/src/generic.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,786 @@ +#![allow(non_camel_case_types)] + +use core::ops::*; +use crate::soft::{x2, x4}; +use crate::types::*; + +#[derive(Clone, Copy)] +pub union vec128_storage { + d: [u32; 4], + q: [u64; 2], + o: [u128; 1], +} +impl From<[u32; 4]> for vec128_storage { + #[inline] + fn from(d: [u32; 4]) -> Self { + Self { d } + } +} +#[derive(Clone, Copy)] +pub struct vec256_storage { + v128: [vec128_storage; 2], +} +impl vec256_storage { + #[inline(always)] + pub fn new128(v128: [vec128_storage; 2]) -> Self { + Self { v128 } + } + #[inline(always)] + pub fn split128(self) -> [vec128_storage; 2] { + self.v128 + } +} +#[derive(Clone, Copy)] +pub struct vec512_storage { + v128: [vec128_storage; 4], +} +impl vec512_storage { + #[inline(always)] + pub fn new128(v128: [vec128_storage; 4]) -> Self { + Self { v128 } + } + #[inline(always)] + pub fn split128(self) -> [vec128_storage; 4] { + self.v128 + } +} + +fn dmap(t: T, f: F) -> T +where + T: Store + Into, + F: Fn(u32) -> u32, +{ + let t: vec128_storage = t.into(); + let d = unsafe { t.d }; + let d = vec128_storage { + d: [f(d[0]), f(d[1]), f(d[2]), f(d[3])], + }; + unsafe { T::unpack(d) } +} + +fn dmap2(a: T, b: T, f: F) -> T +where + T: Store + Into, + F: Fn(u32, u32) -> u32, +{ + let a: vec128_storage = a.into(); + let b: vec128_storage = b.into(); + let ao = unsafe { a.d }; + let bo = unsafe { b.d }; + let d = vec128_storage { + d: [ + f(ao[0], bo[0]), + f(ao[1], bo[1]), + f(ao[2], bo[2]), + f(ao[3], bo[3]), + ], + }; + unsafe { T::unpack(d) } +} + +fn qmap(t: T, f: F) -> T +where + T: Store + Into, + F: Fn(u64) -> u64, +{ + let t: vec128_storage = t.into(); + let q = unsafe { t.q }; + let q = vec128_storage { + q: [f(q[0]), f(q[1])], + }; + unsafe { T::unpack(q) } +} + +fn qmap2(a: T, b: T, f: F) -> T +where + T: Store + Into, + F: Fn(u64, u64) -> u64, +{ + let a: vec128_storage = a.into(); + let b: vec128_storage = b.into(); + let ao = unsafe { a.q }; + let bo = unsafe { b.q }; + let q = vec128_storage { + q: [f(ao[0], bo[0]), f(ao[1], bo[1])], + }; + unsafe { T::unpack(q) } +} + +fn omap(a: T, f: F) -> T +where + T: Store + Into, + F: Fn(u128) -> u128, +{ + let a: vec128_storage = a.into(); + let ao = unsafe { a.o }; + let o = vec128_storage { o: [f(ao[0])] }; + unsafe { T::unpack(o) } +} + +fn omap2(a: T, b: T, f: F) -> T +where + T: Store + Into, + F: Fn(u128, u128) -> u128, +{ + let a: vec128_storage = a.into(); + let b: vec128_storage = b.into(); + let ao = unsafe { a.o }; + let bo = unsafe { b.o }; + let o = vec128_storage { + o: [f(ao[0], bo[0])], + }; + unsafe { T::unpack(o) } +} + +impl RotateEachWord128 for u128x1_generic {} +impl BitOps128 for u128x1_generic {} +impl BitOps64 for u128x1_generic {} +impl BitOps64 for u64x2_generic {} +impl BitOps32 for u128x1_generic {} +impl BitOps32 for u64x2_generic {} +impl BitOps32 for u32x4_generic {} +impl BitOps0 for u128x1_generic {} +impl BitOps0 for u64x2_generic {} +impl BitOps0 for u32x4_generic {} + +macro_rules! impl_bitops { + ($vec:ident) => { + impl Not for $vec { + type Output = Self; + #[inline(always)] + fn not(self) -> Self::Output { + omap(self, |x| !x) + } + } + impl BitAnd for $vec { + type Output = Self; + #[inline(always)] + fn bitand(self, rhs: Self) -> Self::Output { + omap2(self, rhs, |x, y| x & y) + } + } + impl BitOr for $vec { + type Output = Self; + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + omap2(self, rhs, |x, y| x | y) + } + } + impl BitXor for $vec { + type Output = Self; + #[inline(always)] + fn bitxor(self, rhs: Self) -> Self::Output { + omap2(self, rhs, |x, y| x ^ y) + } + } + impl AndNot for $vec { + type Output = Self; + #[inline(always)] + fn andnot(self, rhs: Self) -> Self::Output { + omap2(self, rhs, |x, y| !x & y) + } + } + impl BitAndAssign for $vec { + #[inline(always)] + fn bitand_assign(&mut self, rhs: Self) { + *self = *self & rhs + } + } + impl BitOrAssign for $vec { + #[inline(always)] + fn bitor_assign(&mut self, rhs: Self) { + *self = *self | rhs + } + } + impl BitXorAssign for $vec { + #[inline(always)] + fn bitxor_assign(&mut self, rhs: Self) { + *self = *self ^ rhs + } + } + + impl Swap64 for $vec { + #[inline] + fn swap1(self) -> Self { + qmap(self, |x| { + ((x & 0x5555555555555555) << 1) | ((x & 0xaaaaaaaaaaaaaaaa) >> 1) + }) + } + #[inline] + fn swap2(self) -> Self { + qmap(self, |x| { + ((x & 0x3333333333333333) << 2) | ((x & 0xcccccccccccccccc) >> 2) + }) + } + #[inline] + fn swap4(self) -> Self { + qmap(self, |x| { + ((x & 0x0f0f0f0f0f0f0f0f) << 4) | ((x & 0xf0f0f0f0f0f0f0f0) >> 4) + }) + } + #[inline] + fn swap8(self) -> Self { + qmap(self, |x| { + ((x & 0x00ff00ff00ff00ff) << 8) | ((x & 0xff00ff00ff00ff00) >> 8) + }) + } + #[inline] + fn swap16(self) -> Self { + dmap(self, |x| x.rotate_left(16)) + } + #[inline] + fn swap32(self) -> Self { + qmap(self, |x| x.rotate_left(32)) + } + #[inline] + fn swap64(self) -> Self { + omap(self, |x| (x << 64) | (x >> 64)) + } + } + }; +} +impl_bitops!(u32x4_generic); +impl_bitops!(u64x2_generic); +impl_bitops!(u128x1_generic); + +impl RotateEachWord32 for u32x4_generic { + #[inline] + fn rotate_each_word_right7(self) -> Self { + dmap(self, |x| x.rotate_right(7)) + } + #[inline] + fn rotate_each_word_right8(self) -> Self { + dmap(self, |x| x.rotate_right(8)) + } + #[inline] + fn rotate_each_word_right11(self) -> Self { + dmap(self, |x| x.rotate_right(11)) + } + #[inline] + fn rotate_each_word_right12(self) -> Self { + dmap(self, |x| x.rotate_right(12)) + } + #[inline] + fn rotate_each_word_right16(self) -> Self { + dmap(self, |x| x.rotate_right(16)) + } + #[inline] + fn rotate_each_word_right20(self) -> Self { + dmap(self, |x| x.rotate_right(20)) + } + #[inline] + fn rotate_each_word_right24(self) -> Self { + dmap(self, |x| x.rotate_right(24)) + } + #[inline] + fn rotate_each_word_right25(self) -> Self { + dmap(self, |x| x.rotate_right(25)) + } +} + +impl RotateEachWord32 for u64x2_generic { + #[inline] + fn rotate_each_word_right7(self) -> Self { + qmap(self, |x| x.rotate_right(7)) + } + #[inline] + fn rotate_each_word_right8(self) -> Self { + qmap(self, |x| x.rotate_right(8)) + } + #[inline] + fn rotate_each_word_right11(self) -> Self { + qmap(self, |x| x.rotate_right(11)) + } + #[inline] + fn rotate_each_word_right12(self) -> Self { + qmap(self, |x| x.rotate_right(12)) + } + #[inline] + fn rotate_each_word_right16(self) -> Self { + qmap(self, |x| x.rotate_right(16)) + } + #[inline] + fn rotate_each_word_right20(self) -> Self { + qmap(self, |x| x.rotate_right(20)) + } + #[inline] + fn rotate_each_word_right24(self) -> Self { + qmap(self, |x| x.rotate_right(24)) + } + #[inline] + fn rotate_each_word_right25(self) -> Self { + qmap(self, |x| x.rotate_right(25)) + } +} +impl RotateEachWord64 for u64x2_generic { + #[inline] + fn rotate_each_word_right32(self) -> Self { + qmap(self, |x| x.rotate_right(32)) + } +} + +// workaround for koute/cargo-web#52 (u128::rotate_* broken with cargo web) +fn rotate_u128_right(x: u128, i: u32) -> u128 { + (x >> i) | (x << (128 - i)) +} +#[test] +fn test_rotate_u128() { + const X: u128 = 0x0001_0203_0405_0607_0809_0a0b_0c0d_0e0f; + assert_eq!(rotate_u128_right(X, 17), X.rotate_right(17)); +} + +impl RotateEachWord32 for u128x1_generic { + #[inline] + fn rotate_each_word_right7(self) -> Self { + Self([rotate_u128_right(self.0[0], 7)]) + } + #[inline] + fn rotate_each_word_right8(self) -> Self { + Self([rotate_u128_right(self.0[0], 8)]) + } + #[inline] + fn rotate_each_word_right11(self) -> Self { + Self([rotate_u128_right(self.0[0], 11)]) + } + #[inline] + fn rotate_each_word_right12(self) -> Self { + Self([rotate_u128_right(self.0[0], 12)]) + } + #[inline] + fn rotate_each_word_right16(self) -> Self { + Self([rotate_u128_right(self.0[0], 16)]) + } + #[inline] + fn rotate_each_word_right20(self) -> Self { + Self([rotate_u128_right(self.0[0], 20)]) + } + #[inline] + fn rotate_each_word_right24(self) -> Self { + Self([rotate_u128_right(self.0[0], 24)]) + } + #[inline] + fn rotate_each_word_right25(self) -> Self { + Self([rotate_u128_right(self.0[0], 25)]) + } +} +impl RotateEachWord64 for u128x1_generic { + #[inline] + fn rotate_each_word_right32(self) -> Self { + Self([rotate_u128_right(self.0[0], 32)]) + } +} + +#[derive(Copy, Clone)] +pub struct GenericMachine; +impl Machine for GenericMachine { + type u32x4 = u32x4_generic; + type u64x2 = u64x2_generic; + type u128x1 = u128x1_generic; + type u32x4x2 = u32x4x2_generic; + type u64x2x2 = u64x2x2_generic; + type u64x4 = u64x4_generic; + type u128x2 = u128x2_generic; + type u32x4x4 = u32x4x4_generic; + type u64x2x4 = u64x2x4_generic; + type u128x4 = u128x4_generic; + #[inline] + unsafe fn instance() -> Self { + Self + } +} + +#[derive(Copy, Clone, Debug, PartialEq)] +pub struct u32x4_generic([u32; 4]); +#[derive(Copy, Clone, Debug, PartialEq)] +pub struct u64x2_generic([u64; 2]); +#[derive(Copy, Clone, Debug, PartialEq)] +pub struct u128x1_generic([u128; 1]); + +impl From for vec128_storage { + #[inline(always)] + fn from(d: u32x4_generic) -> Self { + Self { d: d.0 } + } +} +impl From for vec128_storage { + #[inline(always)] + fn from(q: u64x2_generic) -> Self { + Self { q: q.0 } + } +} +impl From for vec128_storage { + #[inline(always)] + fn from(o: u128x1_generic) -> Self { + Self { o: o.0 } + } +} + +impl Store for u32x4_generic { + #[inline(always)] + unsafe fn unpack(s: vec128_storage) -> Self { + Self(s.d) + } +} +impl Store for u64x2_generic { + #[inline(always)] + unsafe fn unpack(s: vec128_storage) -> Self { + Self(s.q) + } +} +impl Store for u128x1_generic { + #[inline(always)] + unsafe fn unpack(s: vec128_storage) -> Self { + Self(s.o) + } +} + +impl ArithOps for u32x4_generic {} +impl ArithOps for u64x2_generic {} +impl ArithOps for u128x1_generic {} + +impl Add for u32x4_generic { + type Output = Self; + #[inline(always)] + fn add(self, rhs: Self) -> Self::Output { + dmap2(self, rhs, |x, y| x.wrapping_add(y)) + } +} +impl Add for u64x2_generic { + type Output = Self; + #[inline(always)] + fn add(self, rhs: Self) -> Self::Output { + qmap2(self, rhs, |x, y| x.wrapping_add(y)) + } +} +impl Add for u128x1_generic { + type Output = Self; + #[inline(always)] + fn add(self, rhs: Self) -> Self::Output { + omap2(self, rhs, |x, y| x.wrapping_add(y)) + } +} +impl AddAssign for u32x4_generic { + #[inline(always)] + fn add_assign(&mut self, rhs: Self) { + *self = *self + rhs + } +} +impl AddAssign for u64x2_generic { + #[inline(always)] + fn add_assign(&mut self, rhs: Self) { + *self = *self + rhs + } +} +impl AddAssign for u128x1_generic { + #[inline(always)] + fn add_assign(&mut self, rhs: Self) { + *self = *self + rhs + } +} +impl BSwap for u32x4_generic { + #[inline(always)] + fn bswap(self) -> Self { + dmap(self, |x| x.swap_bytes()) + } +} +impl BSwap for u64x2_generic { + #[inline(always)] + fn bswap(self) -> Self { + qmap(self, |x| x.swap_bytes()) + } +} +impl BSwap for u128x1_generic { + #[inline(always)] + fn bswap(self) -> Self { + omap(self, |x| x.swap_bytes()) + } +} +impl StoreBytes for u32x4_generic { + #[inline(always)] + unsafe fn unsafe_read_le(input: &[u8]) -> Self { + assert_eq!(input.len(), 16); + let x = core::mem::transmute(core::ptr::read(input as *const _ as *const [u8; 16])); + dmap(x, |x| x.to_le()) + } + #[inline(always)] + unsafe fn unsafe_read_be(input: &[u8]) -> Self { + assert_eq!(input.len(), 16); + let x = core::mem::transmute(core::ptr::read(input as *const _ as *const [u8; 16])); + dmap(x, |x| x.to_be()) + } + #[inline(always)] + fn write_le(self, out: &mut [u8]) { + assert_eq!(out.len(), 16); + let x = dmap(self, |x| x.to_le()); + unsafe { core::ptr::write(out as *mut _ as *mut [u8; 16], core::mem::transmute(x)) } + } + #[inline(always)] + fn write_be(self, out: &mut [u8]) { + assert_eq!(out.len(), 16); + let x = dmap(self, |x| x.to_be()); + unsafe { core::ptr::write(out as *mut _ as *mut [u8; 16], core::mem::transmute(x)) } + } +} +impl StoreBytes for u64x2_generic { + #[inline(always)] + unsafe fn unsafe_read_le(input: &[u8]) -> Self { + assert_eq!(input.len(), 16); + let x = core::mem::transmute(core::ptr::read(input as *const _ as *const [u8; 16])); + qmap(x, |x| x.to_le()) + } + #[inline(always)] + unsafe fn unsafe_read_be(input: &[u8]) -> Self { + assert_eq!(input.len(), 16); + let x = core::mem::transmute(core::ptr::read(input as *const _ as *const [u8; 16])); + qmap(x, |x| x.to_be()) + } + #[inline(always)] + fn write_le(self, out: &mut [u8]) { + assert_eq!(out.len(), 16); + let x = qmap(self, |x| x.to_le()); + unsafe { core::ptr::write(out as *mut _ as *mut [u8; 16], core::mem::transmute(x)) } + } + #[inline(always)] + fn write_be(self, out: &mut [u8]) { + assert_eq!(out.len(), 16); + let x = qmap(self, |x| x.to_be()); + unsafe { core::ptr::write(out as *mut _ as *mut [u8; 16], core::mem::transmute(x)) } + } +} + +#[derive(Copy, Clone)] +pub struct G0; +#[derive(Copy, Clone)] +pub struct G1; +pub type u32x4x2_generic = x2; +pub type u64x2x2_generic = x2; +pub type u64x4_generic = x2; +pub type u128x2_generic = x2; +pub type u32x4x4_generic = x4; +pub type u64x2x4_generic = x4; +pub type u128x4_generic = x4; + +impl MultiLane<[u32; 4]> for u32x4_generic { + #[inline(always)] + fn to_lanes(self) -> [u32; 4] { + self.0 + } + #[inline(always)] + fn from_lanes(xs: [u32; 4]) -> Self { + Self(xs) + } +} +impl MultiLane<[u64; 2]> for u64x2_generic { + #[inline(always)] + fn to_lanes(self) -> [u64; 2] { + self.0 + } + #[inline(always)] + fn from_lanes(xs: [u64; 2]) -> Self { + Self(xs) + } +} +impl MultiLane<[u64; 4]> for u64x4_generic { + #[inline(always)] + fn to_lanes(self) -> [u64; 4] { + let (a, b) = (self.0[0].to_lanes(), self.0[1].to_lanes()); + [a[0], a[1], b[0], b[1]] + } + #[inline(always)] + fn from_lanes(xs: [u64; 4]) -> Self { + let (a, b) = ( + u64x2_generic::from_lanes([xs[0], xs[1]]), + u64x2_generic::from_lanes([xs[2], xs[3]]), + ); + x2::new([a, b]) + } +} +impl MultiLane<[u128; 1]> for u128x1_generic { + #[inline(always)] + fn to_lanes(self) -> [u128; 1] { + self.0 + } + #[inline(always)] + fn from_lanes(xs: [u128; 1]) -> Self { + Self(xs) + } +} +impl Vec4 for u32x4_generic { + #[inline(always)] + fn extract(self, i: u32) -> u32 { + self.0[i as usize] + } + #[inline(always)] + fn insert(mut self, v: u32, i: u32) -> Self { + self.0[i as usize] = v; + self + } +} +impl Vec4 for u64x4_generic { + #[inline(always)] + fn extract(self, i: u32) -> u64 { + let d: [u64; 4] = self.to_lanes(); + d[i as usize] + } + #[inline(always)] + fn insert(self, v: u64, i: u32) -> Self { + self.0[(i / 2) as usize].insert(v, i % 2); + self + } +} +impl Vec2 for u64x2_generic { + #[inline(always)] + fn extract(self, i: u32) -> u64 { + self.0[i as usize] + } + #[inline(always)] + fn insert(mut self, v: u64, i: u32) -> Self { + self.0[i as usize] = v; + self + } +} + +impl Words4 for u32x4_generic { + #[inline(always)] + fn shuffle2301(self) -> Self { + self.swap64() + } + #[inline(always)] + fn shuffle1230(self) -> Self { + let x = self.0; + Self([x[3], x[0], x[1], x[2]]) + } + #[inline(always)] + fn shuffle3012(self) -> Self { + let x = self.0; + Self([x[1], x[2], x[3], x[0]]) + } +} +impl LaneWords4 for u32x4_generic { + #[inline(always)] + fn shuffle_lane_words2301(self) -> Self { + self.shuffle2301() + } + #[inline(always)] + fn shuffle_lane_words1230(self) -> Self { + self.shuffle1230() + } + #[inline(always)] + fn shuffle_lane_words3012(self) -> Self { + self.shuffle3012() + } +} + +impl Words4 for u64x4_generic { + #[inline(always)] + fn shuffle2301(self) -> Self { + x2::new([self.0[1], self.0[0]]) + } + #[inline(always)] + fn shuffle1230(self) -> Self { + unimplemented!() + } + #[inline(always)] + fn shuffle3012(self) -> Self { + unimplemented!() + } +} + +impl u32x4 for u32x4_generic {} +impl u64x2 for u64x2_generic {} +impl u128x1 for u128x1_generic {} +impl u32x4x2 for u32x4x2_generic {} +impl u64x2x2 for u64x2x2_generic {} +impl u64x4 for u64x4_generic {} +impl u128x2 for u128x2_generic {} +impl u32x4x4 for u32x4x4_generic {} +impl u64x2x4 for u64x2x4_generic {} +impl u128x4 for u128x4_generic {} + +#[macro_export] +macro_rules! dispatch { + ($mach:ident, $MTy:ident, { $([$pub:tt$(($krate:tt))*])* fn $name:ident($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty $body:block }) => { + #[inline] + $($pub$(($krate))*)* fn $name($($arg: $argty),*) -> $ret { + let $mach = unsafe { $crate::generic::GenericMachine::instance() }; + #[inline(always)] + fn fn_impl<$MTy: $crate::Machine>($mach: $MTy, $($arg: $argty),*) -> $ret $body + fn_impl($mach, $($arg),*) + } + }; + ($mach:ident, $MTy:ident, { $([$pub:tt $(($krate:tt))*])* fn $name:ident($($arg:ident: $argty:ty),* $(,)*) $body:block }) => { + dispatch!($mach, $MTy, { + $([$pub $(($krate))*])* fn $name($($arg: $argty),*) -> () $body + }); + } +} +#[macro_export] +macro_rules! dispatch_light128 { + ($mach:ident, $MTy:ident, { $([$pub:tt$(($krate:tt))*])* fn $name:ident($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty $body:block }) => { + #[inline] + $($pub$(($krate))*)* fn $name($($arg: $argty),*) -> $ret { + let $mach = unsafe { $crate::generic::GenericMachine::instance() }; + #[inline(always)] + fn fn_impl<$MTy: $crate::Machine>($mach: $MTy, $($arg: $argty),*) -> $ret $body + fn_impl($mach, $($arg),*) + } + }; + ($mach:ident, $MTy:ident, { $([$pub:tt $(($krate:tt))*])* fn $name:ident($($arg:ident: $argty:ty),* $(,)*) $body:block }) => { + dispatch!($mach, $MTy, { + $([$pub $(($krate))*])* fn $name($($arg: $argty),*) -> () $body + }); + } +} +#[macro_export] +macro_rules! dispatch_light256 { + ($mach:ident, $MTy:ident, { $([$pub:tt$(($krate:tt))*])* fn $name:ident($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty $body:block }) => { + #[inline] + $($pub$(($krate))*)* fn $name($($arg: $argty),*) -> $ret { + let $mach = unsafe { $crate::generic::GenericMachine::instance() }; + #[inline(always)] + fn fn_impl<$MTy: $crate::Machine>($mach: $MTy, $($arg: $argty),*) -> $ret $body + fn_impl($mach, $($arg),*) + } + }; + ($mach:ident, $MTy:ident, { $([$pub:tt $(($krate:tt))*])* fn $name:ident($($arg:ident: $argty:ty),* $(,)*) $body:block }) => { + dispatch!($mach, $MTy, { + $([$pub $(($krate))*])* fn $name($($arg: $argty),*) -> () $body + }); + } +} +#[macro_export] +macro_rules! dispatch_light512 { + ($mach:ident, $MTy:ident, { $([$pub:tt$(($krate:tt))*])* fn $name:ident($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty $body:block }) => { + #[inline] + $($pub$(($krate))*)* fn $name($($arg: $argty),*) -> $ret { + let $mach = unsafe { $crate::generic::GenericMachine::instance() }; + #[inline(always)] + fn fn_impl<$MTy: $crate::Machine>($mach: $MTy, $($arg: $argty),*) -> $ret $body + fn_impl($mach, $($arg),*) + } + }; + ($mach:ident, $MTy:ident, { $([$pub:tt $(($krate:tt))*])* fn $name:ident($($arg:ident: $argty:ty),* $(,)*) $body:block }) => { + dispatch!($mach, $MTy, { + $([$pub $(($krate))*])* fn $name($($arg: $argty),*) -> () $body + }); + } +} + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_bswap32() { + let xs = [0x0f0e_0d0c, 0x0b0a_0908, 0x0706_0504, 0x0302_0100]; + let ys = [0x0c0d_0e0f, 0x0809_0a0b, 0x0405_0607, 0x0001_0203]; + + let m = unsafe { GenericMachine::instance() }; + + let x: ::u32x4 = m.vec(xs); + let x = x.bswap(); + + let y = m.vec(ys); + assert_eq!(x, y); + } +} diff -Nru cargo-0.35.0/vendor/ppv-lite86/src/lib.rs cargo-0.37.0/vendor/ppv-lite86/src/lib.rs --- cargo-0.35.0/vendor/ppv-lite86/src/lib.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/ppv-lite86/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,22 @@ +#![no_std] + +// Design: +// - safety: safe creation of any machine type is done only by instance methods of a +// Machine (which is a ZST + Copy type), which can only by created unsafely or safely +// through feature detection (e.g. fn AVX2::try_get() -> Option). + +mod soft; +mod types; +pub use self::types::*; + +#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri)))] +pub mod x86_64; +#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri)))] +use self::x86_64 as arch; + +#[cfg(any(miri, not(all(feature = "simd", any(target_arch = "x86_64")))))] +pub mod generic; +#[cfg(any(miri, not(all(feature = "simd", any(target_arch = "x86_64")))))] +use self::generic as arch; + +pub use self::arch::{vec128_storage, vec256_storage, vec512_storage}; diff -Nru cargo-0.35.0/vendor/ppv-lite86/src/soft.rs cargo-0.37.0/vendor/ppv-lite86/src/soft.rs --- cargo-0.35.0/vendor/ppv-lite86/src/soft.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/ppv-lite86/src/soft.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,420 @@ +//! Implement 256- and 512- bit in terms of 128-bit, for machines without native wide SIMD. + +use core::marker::PhantomData; +use core::ops::*; +use crate::types::*; +use crate::{vec128_storage, vec256_storage, vec512_storage}; + +#[derive(Copy, Clone, Default)] +#[allow(non_camel_case_types)] +pub struct x2(pub [W; 2], PhantomData); +impl x2 { + #[inline(always)] + pub fn new(xs: [W; 2]) -> Self { + x2(xs, PhantomData) + } +} +macro_rules! fwd_binop_x2 { + ($trait:ident, $fn:ident) => { + impl $trait for x2 { + type Output = x2; + #[inline(always)] + fn $fn(self, rhs: Self) -> Self::Output { + x2::new([self.0[0].$fn(rhs.0[0]), self.0[1].$fn(rhs.0[1])]) + } + } + }; +} +macro_rules! fwd_binop_assign_x2 { + ($trait:ident, $fn_assign:ident) => { + impl $trait for x2 { + #[inline(always)] + fn $fn_assign(&mut self, rhs: Self) { + (self.0[0]).$fn_assign(rhs.0[0]); + (self.0[1]).$fn_assign(rhs.0[1]); + } + } + }; +} +macro_rules! fwd_unop_x2 { + ($fn:ident) => { + #[inline(always)] + fn $fn(self) -> Self { + x2::new([self.0[0].$fn(), self.0[1].$fn()]) + } + }; +} +impl RotateEachWord32 for x2 +where + W: Copy + RotateEachWord32, +{ + fwd_unop_x2!(rotate_each_word_right7); + fwd_unop_x2!(rotate_each_word_right8); + fwd_unop_x2!(rotate_each_word_right11); + fwd_unop_x2!(rotate_each_word_right12); + fwd_unop_x2!(rotate_each_word_right16); + fwd_unop_x2!(rotate_each_word_right20); + fwd_unop_x2!(rotate_each_word_right24); + fwd_unop_x2!(rotate_each_word_right25); +} +impl RotateEachWord64 for x2 +where + W: Copy + RotateEachWord64, +{ + fwd_unop_x2!(rotate_each_word_right32); +} +impl RotateEachWord128 for x2 where W: RotateEachWord128 {} +impl BitOps0 for x2 +where + W: BitOps0, + G: Copy, +{ +} +impl BitOps32 for x2 +where + W: BitOps32 + BitOps0, + G: Copy, +{ +} +impl BitOps64 for x2 +where + W: BitOps64 + BitOps0, + G: Copy, +{ +} +impl BitOps128 for x2 +where + W: BitOps128 + BitOps0, + G: Copy, +{ +} +fwd_binop_x2!(BitAnd, bitand); +fwd_binop_x2!(BitOr, bitor); +fwd_binop_x2!(BitXor, bitxor); +fwd_binop_x2!(AndNot, andnot); +fwd_binop_assign_x2!(BitAndAssign, bitand_assign); +fwd_binop_assign_x2!(BitOrAssign, bitor_assign); +fwd_binop_assign_x2!(BitXorAssign, bitxor_assign); +impl ArithOps for x2 +where + W: ArithOps, + G: Copy, +{ +} +fwd_binop_x2!(Add, add); +fwd_binop_assign_x2!(AddAssign, add_assign); +impl Not for x2 { + type Output = x2; + #[inline(always)] + fn not(self) -> Self::Output { + x2::new([self.0[0].not(), self.0[1].not()]) + } +} +impl UnsafeFrom<[W; 2]> for x2 { + #[inline(always)] + unsafe fn unsafe_from(xs: [W; 2]) -> Self { + x2::new(xs) + } +} +impl Vec2 for x2 { + #[inline(always)] + fn extract(self, i: u32) -> W { + self.0[i as usize] + } + #[inline(always)] + fn insert(mut self, w: W, i: u32) -> Self { + self.0[i as usize] = w; + self + } +} +impl, G> Store for x2 { + #[inline(always)] + unsafe fn unpack(p: vec256_storage) -> Self { + let p = p.split128(); + x2::new([W::unpack(p[0]), W::unpack(p[1])]) + } +} +impl From> for vec256_storage +where + W: Copy, + vec128_storage: From, +{ + #[inline(always)] + fn from(x: x2) -> Self { + vec256_storage::new128([x.0[0].into(), x.0[1].into()]) + } +} +impl Swap64 for x2 +where + W: Swap64 + Copy, +{ + fwd_unop_x2!(swap1); + fwd_unop_x2!(swap2); + fwd_unop_x2!(swap4); + fwd_unop_x2!(swap8); + fwd_unop_x2!(swap16); + fwd_unop_x2!(swap32); + fwd_unop_x2!(swap64); +} +impl MultiLane<[W; 2]> for x2 { + #[inline(always)] + fn to_lanes(self) -> [W; 2] { + self.0 + } + #[inline(always)] + fn from_lanes(lanes: [W; 2]) -> Self { + x2::new(lanes) + } +} +impl BSwap for x2 { + #[inline(always)] + fn bswap(self) -> Self { + x2::new([self.0[0].bswap(), self.0[1].bswap()]) + } +} +impl StoreBytes for x2 { + #[inline(always)] + unsafe fn unsafe_read_le(input: &[u8]) -> Self { + let input = input.split_at(16); + x2::new([W::unsafe_read_le(input.0), W::unsafe_read_le(input.1)]) + } + #[inline(always)] + unsafe fn unsafe_read_be(input: &[u8]) -> Self { + x2::unsafe_read_le(input).bswap() + } + #[inline(always)] + fn write_le(self, out: &mut [u8]) { + let out = out.split_at_mut(16); + self.0[0].write_le(out.0); + self.0[1].write_le(out.1); + } + #[inline(always)] + fn write_be(self, out: &mut [u8]) { + let out = out.split_at_mut(16); + self.0[0].write_be(out.0); + self.0[1].write_be(out.1); + } +} + +#[derive(Copy, Clone, Default)] +#[allow(non_camel_case_types)] +pub struct x4(pub [W; 4]); +impl x4 { + #[inline(always)] + pub fn new(xs: [W; 4]) -> Self { + x4(xs) + } +} +macro_rules! fwd_binop_x4 { + ($trait:ident, $fn:ident) => { + impl $trait for x4 { + type Output = x4; + #[inline(always)] + fn $fn(self, rhs: Self) -> Self::Output { + x4([ + self.0[0].$fn(rhs.0[0]), + self.0[1].$fn(rhs.0[1]), + self.0[2].$fn(rhs.0[2]), + self.0[3].$fn(rhs.0[3]), + ]) + } + } + }; +} +macro_rules! fwd_binop_assign_x4 { + ($trait:ident, $fn_assign:ident) => { + impl $trait for x4 { + #[inline(always)] + fn $fn_assign(&mut self, rhs: Self) { + self.0[0].$fn_assign(rhs.0[0]); + self.0[1].$fn_assign(rhs.0[1]); + self.0[2].$fn_assign(rhs.0[2]); + self.0[3].$fn_assign(rhs.0[3]); + } + } + }; +} +macro_rules! fwd_unop_x4 { + ($fn:ident) => { + #[inline(always)] + fn $fn(self) -> Self { + x4([self.0[0].$fn(), self.0[1].$fn(), self.0[2].$fn(), self.0[3].$fn()]) + } + }; +} +impl RotateEachWord32 for x4 +where + W: Copy + RotateEachWord32, +{ + fwd_unop_x4!(rotate_each_word_right7); + fwd_unop_x4!(rotate_each_word_right8); + fwd_unop_x4!(rotate_each_word_right11); + fwd_unop_x4!(rotate_each_word_right12); + fwd_unop_x4!(rotate_each_word_right16); + fwd_unop_x4!(rotate_each_word_right20); + fwd_unop_x4!(rotate_each_word_right24); + fwd_unop_x4!(rotate_each_word_right25); +} +impl RotateEachWord64 for x4 +where + W: Copy + RotateEachWord64, +{ + fwd_unop_x4!(rotate_each_word_right32); +} +impl RotateEachWord128 for x4 where W: RotateEachWord128 {} +impl BitOps0 for x4 where W: BitOps0 {} +impl BitOps32 for x4 where W: BitOps32 + BitOps0 {} +impl BitOps64 for x4 where W: BitOps64 + BitOps0 {} +impl BitOps128 for x4 where W: BitOps128 + BitOps0 {} +fwd_binop_x4!(BitAnd, bitand); +fwd_binop_x4!(BitOr, bitor); +fwd_binop_x4!(BitXor, bitxor); +fwd_binop_x4!(AndNot, andnot); +fwd_binop_assign_x4!(BitAndAssign, bitand_assign); +fwd_binop_assign_x4!(BitOrAssign, bitor_assign); +fwd_binop_assign_x4!(BitXorAssign, bitxor_assign); +impl ArithOps for x4 where W: ArithOps {} +fwd_binop_x4!(Add, add); +fwd_binop_assign_x4!(AddAssign, add_assign); +impl Not for x4 { + type Output = x4; + #[inline(always)] + fn not(self) -> Self::Output { + x4([ + self.0[0].not(), + self.0[1].not(), + self.0[2].not(), + self.0[3].not(), + ]) + } +} +impl UnsafeFrom<[W; 4]> for x4 { + #[inline(always)] + unsafe fn unsafe_from(xs: [W; 4]) -> Self { + x4(xs) + } +} +impl Vec4 for x4 { + #[inline(always)] + fn extract(self, i: u32) -> W { + self.0[i as usize] + } + #[inline(always)] + fn insert(mut self, w: W, i: u32) -> Self { + self.0[i as usize] = w; + self + } +} +impl> Store for x4 { + #[inline(always)] + unsafe fn unpack(p: vec512_storage) -> Self { + let p = p.split128(); + x4([ + W::unpack(p[0]), + W::unpack(p[1]), + W::unpack(p[2]), + W::unpack(p[3]), + ]) + } +} +impl From> for vec512_storage +where + W: Copy, + vec128_storage: From, +{ + #[inline(always)] + fn from(x: x4) -> Self { + vec512_storage::new128([x.0[0].into(), x.0[1].into(), x.0[2].into(), x.0[3].into()]) + } +} +impl Swap64 for x4 +where + W: Swap64 + Copy, +{ + fwd_unop_x4!(swap1); + fwd_unop_x4!(swap2); + fwd_unop_x4!(swap4); + fwd_unop_x4!(swap8); + fwd_unop_x4!(swap16); + fwd_unop_x4!(swap32); + fwd_unop_x4!(swap64); +} +impl MultiLane<[W; 4]> for x4 { + #[inline(always)] + fn to_lanes(self) -> [W; 4] { + self.0 + } + #[inline(always)] + fn from_lanes(lanes: [W; 4]) -> Self { + x4(lanes) + } +} +impl BSwap for x4 { + #[inline(always)] + fn bswap(self) -> Self { + x4([ + self.0[0].bswap(), + self.0[1].bswap(), + self.0[2].bswap(), + self.0[3].bswap(), + ]) + } +} +impl StoreBytes for x4 { + #[inline(always)] + unsafe fn unsafe_read_le(input: &[u8]) -> Self { + x4([ + W::unsafe_read_le(&input[0..16]), + W::unsafe_read_le(&input[16..32]), + W::unsafe_read_le(&input[32..48]), + W::unsafe_read_le(&input[48..64]), + ]) + } + #[inline(always)] + unsafe fn unsafe_read_be(input: &[u8]) -> Self { + x4::unsafe_read_le(input).bswap() + } + #[inline(always)] + fn write_le(self, out: &mut [u8]) { + self.0[0].write_le(&mut out[0..16]); + self.0[1].write_le(&mut out[16..32]); + self.0[2].write_le(&mut out[32..48]); + self.0[3].write_le(&mut out[48..64]); + } + #[inline(always)] + fn write_be(self, out: &mut [u8]) { + self.0[0].write_be(&mut out[0..16]); + self.0[1].write_be(&mut out[16..32]); + self.0[2].write_be(&mut out[32..48]); + self.0[3].write_be(&mut out[48..64]); + } +} +impl LaneWords4 for x4 { + #[inline(always)] + fn shuffle_lane_words2301(self) -> Self { + x4([ + self.0[0].shuffle_lane_words2301(), + self.0[1].shuffle_lane_words2301(), + self.0[2].shuffle_lane_words2301(), + self.0[3].shuffle_lane_words2301(), + ]) + } + #[inline(always)] + fn shuffle_lane_words1230(self) -> Self { + x4([ + self.0[0].shuffle_lane_words1230(), + self.0[1].shuffle_lane_words1230(), + self.0[2].shuffle_lane_words1230(), + self.0[3].shuffle_lane_words1230(), + ]) + } + #[inline(always)] + fn shuffle_lane_words3012(self) -> Self { + x4([ + self.0[0].shuffle_lane_words3012(), + self.0[1].shuffle_lane_words3012(), + self.0[2].shuffle_lane_words3012(), + self.0[3].shuffle_lane_words3012(), + ]) + } +} diff -Nru cargo-0.35.0/vendor/ppv-lite86/src/types.rs cargo-0.37.0/vendor/ppv-lite86/src/types.rs --- cargo-0.35.0/vendor/ppv-lite86/src/types.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/ppv-lite86/src/types.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,279 @@ +use core::ops::{Add, AddAssign, BitAnd, BitOr, BitXor, BitXorAssign, Not}; + +pub trait AndNot { + type Output; + fn andnot(self, rhs: Self) -> Self::Output; +} +pub trait BSwap { + fn bswap(self) -> Self; +} +/// Ops that depend on word size +pub trait ArithOps: Add + AddAssign + Sized + Copy + Clone + BSwap {} +/// Ops that are independent of word size and endian +pub trait BitOps0: + BitAnd + + BitOr + + BitXor + + BitXorAssign + + Not + + AndNot + + Sized + + Copy + + Clone +{ +} + +pub trait BitOps32: BitOps0 + RotateEachWord32 {} +pub trait BitOps64: BitOps32 + RotateEachWord64 {} +pub trait BitOps128: BitOps64 + RotateEachWord128 {} + +pub trait RotateEachWord32 { + fn rotate_each_word_right7(self) -> Self; + fn rotate_each_word_right8(self) -> Self; + fn rotate_each_word_right11(self) -> Self; + fn rotate_each_word_right12(self) -> Self; + fn rotate_each_word_right16(self) -> Self; + fn rotate_each_word_right20(self) -> Self; + fn rotate_each_word_right24(self) -> Self; + fn rotate_each_word_right25(self) -> Self; +} + +pub trait RotateEachWord64 { + fn rotate_each_word_right32(self) -> Self; +} + +pub trait RotateEachWord128 {} + +#[allow(non_camel_case_types)] +mod types { + //! Vector type naming scheme: + //! uN[xP]xL + //! Unsigned; N-bit words * P bits per lane * L lanes + //! + //! A lane is always 128-bits, chosen because common SIMD architectures treat 128-bit units of + //! wide vectors specially (supporting e.g. intra-lane shuffles), and tend to have limited and + //! slow inter-lane operations. + + use crate::arch::{vec128_storage, vec256_storage, vec512_storage}; + use crate::{ArithOps, BitOps128, BitOps32, BitOps64, Machine, Store, StoreBytes}; + + pub trait UnsafeFrom { + unsafe fn unsafe_from(t: T) -> Self; + } + + /// A vector composed of two elements, which may be words or themselves vectors. + pub trait Vec2 { + fn extract(self, i: u32) -> W; + fn insert(self, w: W, i: u32) -> Self; + } + + /// A vector composed of four elements, which may be words or themselves vectors. + pub trait Vec4 { + fn extract(self, i: u32) -> W; + fn insert(self, w: W, i: u32) -> Self; + } + + // TODO: multiples of 4 should inherit this + /// A vector composed of four words; depending on their size, operations may cross lanes. + pub trait Words4 { + fn shuffle1230(self) -> Self; + fn shuffle2301(self) -> Self; + fn shuffle3012(self) -> Self; + } + + /// A vector composed one or more lanes each composed of four words. + pub trait LaneWords4 { + fn shuffle_lane_words1230(self) -> Self; + fn shuffle_lane_words2301(self) -> Self; + fn shuffle_lane_words3012(self) -> Self; + } + + // TODO: make this a part of BitOps + /// Exchange neigboring ranges of bits of the specified size + pub trait Swap64 { + fn swap1(self) -> Self; + fn swap2(self) -> Self; + fn swap4(self) -> Self; + fn swap8(self) -> Self; + fn swap16(self) -> Self; + fn swap32(self) -> Self; + fn swap64(self) -> Self; + } + + pub trait u32x4: + BitOps32 + + Store + + ArithOps + + Vec4 + + Words4 + + LaneWords4 + + StoreBytes + + MultiLane<[u32; 4]> + + Into + { +} + pub trait u64x2: + BitOps64 + + Store + + ArithOps + + Vec2 + + MultiLane<[u64; 2]> + + Into + { +} + pub trait u128x1: + BitOps128 + Store + Swap64 + MultiLane<[u128; 1]> + Into + { +} + + pub trait u32x4x2: + BitOps32 + + Store + + Vec2 + + MultiLane<[M::u32x4; 2]> + + ArithOps + + Into + { +} + pub trait u64x2x2: + BitOps64 + + Store + + Vec2 + + MultiLane<[M::u64x2; 2]> + + ArithOps + + StoreBytes + + Into + { +} + pub trait u64x4: + BitOps64 + + Store + + Vec4 + + MultiLane<[u64; 4]> + + ArithOps + + Words4 + + StoreBytes + + Into + { +} + pub trait u128x2: + BitOps128 + + Store + + Vec2 + + MultiLane<[M::u128x1; 2]> + + Swap64 + + Into + { +} + + pub trait u32x4x4: + BitOps32 + + Store + + Vec4 + + MultiLane<[M::u32x4; 4]> + + ArithOps + + LaneWords4 + + Into + { +} + pub trait u64x2x4: + BitOps64 + + Store + + Vec4 + + MultiLane<[M::u64x2; 4]> + + ArithOps + + Into + { +} + // TODO: Words4 + pub trait u128x4: + BitOps128 + + Store + + Vec4 + + MultiLane<[M::u128x1; 4]> + + Swap64 + + Into + { +} + + /// A vector composed of multiple 128-bit lanes. + pub trait MultiLane { + /// Split a multi-lane vector into single-lane vectors. + fn to_lanes(self) -> Lanes; + /// Build a multi-lane vector from individual lanes. + fn from_lanes(lanes: Lanes) -> Self; + } + + /// Combine single vectors into a multi-lane vector. + pub trait VZip { + fn vzip(self) -> V; + } + + impl VZip for T + where + V: MultiLane, + { + #[inline(always)] + fn vzip(self) -> V { + V::from_lanes(self) + } + } +} +pub use self::types::*; + +pub trait Machine: Sized + Copy { + type u32x4: u32x4; + type u64x2: u64x2; + type u128x1: u128x1; + + type u32x4x2: u32x4x2; + type u64x2x2: u64x2x2; + type u64x4: u64x4; + type u128x2: u128x2; + + type u32x4x4: u32x4x4; + type u64x2x4: u64x2x4; + type u128x4: u128x4; + + #[inline(always)] + fn unpack>(self, s: S) -> V { + unsafe { V::unpack(s) } + } + + #[inline(always)] + fn vec(self, a: A) -> V + where + V: MultiLane, + { + V::from_lanes(a) + } + + #[inline(always)] + fn read_le(self, input: &[u8]) -> V + where + V: StoreBytes, + { + unsafe { V::unsafe_read_le(input) } + } + + #[inline(always)] + fn read_be(self, input: &[u8]) -> V + where + V: StoreBytes, + { + unsafe { V::unsafe_read_be(input) } + } + + unsafe fn instance() -> Self; +} + +pub trait Store { + unsafe fn unpack(p: S) -> Self; +} + +pub trait StoreBytes { + unsafe fn unsafe_read_le(input: &[u8]) -> Self; + unsafe fn unsafe_read_be(input: &[u8]) -> Self; + fn write_le(self, out: &mut [u8]); + fn write_be(self, out: &mut [u8]); +} diff -Nru cargo-0.35.0/vendor/ppv-lite86/src/x86_64/mod.rs cargo-0.37.0/vendor/ppv-lite86/src/x86_64/mod.rs --- cargo-0.35.0/vendor/ppv-lite86/src/x86_64/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/ppv-lite86/src/x86_64/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,433 @@ +// crate minimums: sse2, x86_64 + +use crate::types::*; +use core::arch::x86_64::{__m128i, __m256i}; + +mod sse2; + +#[derive(Copy, Clone)] +pub struct YesS3; +#[derive(Copy, Clone)] +pub struct NoS3; + +#[derive(Copy, Clone)] +pub struct YesS4; +#[derive(Copy, Clone)] +pub struct NoS4; + +#[derive(Copy, Clone)] +pub struct YesA1; +#[derive(Copy, Clone)] +pub struct NoA1; + +#[derive(Copy, Clone)] +pub struct YesA2; +#[derive(Copy, Clone)] +pub struct NoA2; + +#[derive(Copy, Clone)] +pub struct YesNI; +#[derive(Copy, Clone)] +pub struct NoNI; + +use core::marker::PhantomData; + +#[derive(Copy, Clone)] +pub struct SseMachine(PhantomData<(S3, S4, NI)>); +impl Machine for SseMachine +where + sse2::u128x1_sse2: Swap64, + sse2::u64x2_sse2: BSwap + RotateEachWord32 + MultiLane<[u64; 2]> + Vec2, + sse2::u32x4_sse2: BSwap + RotateEachWord32 + MultiLane<[u32; 4]> + Vec4, + sse2::u64x4_sse2: BSwap + Words4, + sse2::u128x1_sse2: BSwap, + sse2::u128x2_sse2: Into>, + sse2::u128x2_sse2: Into>, + sse2::u128x2_sse2: Into>, + sse2::u128x4_sse2: Into>, + sse2::u128x4_sse2: Into>, +{ + type u32x4 = sse2::u32x4_sse2; + type u64x2 = sse2::u64x2_sse2; + type u128x1 = sse2::u128x1_sse2; + + type u32x4x2 = sse2::u32x4x2_sse2; + type u64x2x2 = sse2::u64x2x2_sse2; + type u64x4 = sse2::u64x4_sse2; + type u128x2 = sse2::u128x2_sse2; + + type u32x4x4 = sse2::u32x4x4_sse2; + type u64x2x4 = sse2::u64x2x4_sse2; + type u128x4 = sse2::u128x4_sse2; + + #[inline(always)] + unsafe fn instance() -> Self { + SseMachine(PhantomData) + } +} + +#[derive(Copy, Clone)] +pub struct Avx2Machine(PhantomData); +impl Machine for Avx2Machine +where + sse2::u128x1_sse2: BSwap + Swap64, + sse2::u64x2_sse2: BSwap + RotateEachWord32 + MultiLane<[u64; 2]> + Vec2, + sse2::u32x4_sse2: BSwap + RotateEachWord32 + MultiLane<[u32; 4]> + Vec4, + sse2::u64x4_sse2: BSwap + Words4, +{ + type u32x4 = sse2::u32x4_sse2; + type u64x2 = sse2::u64x2_sse2; + type u128x1 = sse2::u128x1_sse2; + + type u32x4x2 = sse2::u32x4x2_sse2; + type u64x2x2 = sse2::u64x2x2_sse2; + type u64x4 = sse2::u64x4_sse2; + type u128x2 = sse2::u128x2_sse2; + + type u32x4x4 = sse2::avx2::u32x4x4_avx2; + type u64x2x4 = sse2::u64x2x4_sse2; + type u128x4 = sse2::u128x4_sse2; + + #[inline(always)] + unsafe fn instance() -> Self { + Avx2Machine(PhantomData) + } +} + +pub type SSE2 = SseMachine; +pub type SSSE3 = SseMachine; +pub type SSE41 = SseMachine; +/// AVX but not AVX2: only 128-bit integer operations, but use VEX versions of everything +/// to avoid expensive SSE/VEX conflicts. +pub type AVX = SseMachine; +pub type AVX2 = Avx2Machine; + +/// Generic wrapper for unparameterized storage of any of the possible impls. +/// Converting into and out of this type should be essentially free, although it may be more +/// aligned than a particular impl requires. +#[allow(non_camel_case_types)] +#[derive(Copy, Clone)] +pub union vec128_storage { + u32x4: [u32; 4], + u64x2: [u64; 2], + u128x1: [u128; 1], + sse2: __m128i, +} +impl Store for vec128_storage { + #[inline(always)] + unsafe fn unpack(p: vec128_storage) -> Self { + p + } +} +impl<'a> Into<&'a [u32; 4]> for &'a vec128_storage { + #[inline(always)] + fn into(self) -> &'a [u32; 4] { + unsafe { &self.u32x4 } + } +} +impl Into for [u32; 4] { + #[inline(always)] + fn into(self) -> vec128_storage { + vec128_storage { u32x4: self } + } +} +impl Default for vec128_storage { + #[inline(always)] + fn default() -> Self { + vec128_storage { u128x1: [0] } + } +} + +#[allow(non_camel_case_types)] +#[derive(Copy, Clone)] +pub union vec256_storage { + u32x8: [u32; 8], + u64x4: [u64; 4], + u128x2: [u128; 2], + sse2: [vec128_storage; 2], + avx: __m256i, +} +impl Into for [u64; 4] { + #[inline(always)] + fn into(self) -> vec256_storage { + vec256_storage { u64x4: self } + } +} +impl Default for vec256_storage { + #[inline(always)] + fn default() -> Self { + vec256_storage { u128x2: [0, 0] } + } +} +impl vec256_storage { + pub fn new128(xs: [vec128_storage; 2]) -> Self { + Self { sse2: xs } + } + pub fn split128(self) -> [vec128_storage; 2] { + unsafe { self.sse2 } + } +} + +#[allow(non_camel_case_types)] +#[derive(Copy, Clone)] +pub union vec512_storage { + u32x16: [u32; 16], + u64x8: [u64; 8], + u128x4: [u128; 4], + sse2: [vec128_storage; 4], + avx: [vec256_storage; 2], +} +impl Default for vec512_storage { + #[inline(always)] + fn default() -> Self { + vec512_storage { + u128x4: [0, 0, 0, 0], + } + } +} +impl vec512_storage { + pub fn new128(xs: [vec128_storage; 4]) -> Self { + Self { sse2: xs } + } + pub fn split128(self) -> [vec128_storage; 4] { + unsafe { self.sse2 } + } +} + +macro_rules! impl_into { + ($storage:ident, $array:ty, $name:ident) => { + impl Into<$array> for $storage { + #[inline(always)] + fn into(self) -> $array { + unsafe { self.$name } + } + } + }; +} +impl_into!(vec128_storage, [u32; 4], u32x4); +impl_into!(vec128_storage, [u64; 2], u64x2); +impl_into!(vec128_storage, [u128; 1], u128x1); +impl_into!(vec256_storage, [u32; 8], u32x8); +impl_into!(vec256_storage, [u64; 4], u64x4); +impl_into!(vec256_storage, [u128; 2], u128x2); +impl_into!(vec512_storage, [u32; 16], u32x16); +impl_into!(vec512_storage, [u64; 8], u64x8); +impl_into!(vec512_storage, [u128; 4], u128x4); + +/// Generate the full set of optimized implementations to take advantage of the most important +/// hardware feature sets. +/// +/// This dispatcher is suitable for maximizing throughput. +#[macro_export] +macro_rules! dispatch { + ($mach:ident, $MTy:ident, { $([$pub:tt$(($krate:tt))*])* fn $name:ident($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty $body:block }) => { + #[cfg(feature = "std")] + #[inline(always)] + $($pub$(($krate))*)* fn $name($($arg: $argty),*) -> $ret { + #[inline(always)] + fn fn_impl<$MTy: $crate::Machine>($mach: $MTy, $($arg: $argty),*) -> $ret $body + type FnTy = unsafe fn($($arg: $argty),*) -> $ret; + lazy_static! { + static ref IMPL: FnTy = { dispatch_init() }; + } + #[cold] + fn dispatch_init() -> FnTy { + use std::arch::x86_64::*; + if is_x86_feature_detected!("avx2") { + #[target_feature(enable = "avx2")] + unsafe fn impl_avx2($($arg: $argty),*) -> $ret { + let ret = fn_impl($crate::x86_64::AVX2::instance(), $($arg),*); + _mm256_zeroupper(); + ret + } + impl_avx2 + } else if is_x86_feature_detected!("avx") { + #[target_feature(enable = "avx")] + #[target_feature(enable = "sse4.1")] + #[target_feature(enable = "ssse3")] + unsafe fn impl_avx($($arg: $argty),*) -> $ret { + let ret = fn_impl($crate::x86_64::AVX::instance(), $($arg),*); + _mm256_zeroupper(); + ret + } + impl_avx + } else if is_x86_feature_detected!("sse4.1") { + #[target_feature(enable = "sse4.1")] + #[target_feature(enable = "ssse3")] + unsafe fn impl_sse41($($arg: $argty),*) -> $ret { + fn_impl($crate::x86_64::SSE41::instance(), $($arg),*) + } + impl_sse41 + } else if is_x86_feature_detected!("ssse3") { + #[target_feature(enable = "ssse3")] + unsafe fn impl_ssse3($($arg: $argty),*) -> $ret { + fn_impl($crate::x86_64::SSSE3::instance(), $($arg),*) + } + impl_ssse3 + } else if is_x86_feature_detected!("sse2") { + #[target_feature(enable = "sse2")] + unsafe fn impl_sse2($($arg: $argty),*) -> $ret { + fn_impl($crate::x86_64::SSE2::instance(), $($arg),*) + } + impl_sse2 + } else { + unimplemented!() + } + } + unsafe { IMPL($($arg),*) } + } + #[cfg(not(feature = "std"))] + #[inline(always)] + $($pub$(($krate))*)* fn $name($($arg: $argty),*) -> $ret { + unsafe fn fn_impl<$MTy: $crate::Machine>($mach: $MTy, $($arg: $argty),*) -> $ret $body + unsafe { + if cfg!(target_feature = "avx2") { + fn_impl($crate::x86_64::AVX2::instance(), $($arg),*) + } else if cfg!(target_feature = "avx") { + fn_impl($crate::x86_64::AVX::instance(), $($arg),*) + } else if cfg!(target_feature = "sse4.1") { + fn_impl($crate::x86_64::SSE41::instance(), $($arg),*) + } else if cfg!(target_feature = "ssse3") { + fn_impl($crate::x86_64::SSSE3::instance(), $($arg),*) + } else { + fn_impl($crate::x86_64::SSE2::instance(), $($arg),*) + } + } + } + }; + ($mach:ident, $MTy:ident, { $([$pub:tt $(($krate:tt))*])* fn $name:ident($($arg:ident: $argty:ty),* $(,)*) $body:block }) => { + dispatch!($mach, $MTy, { + $([$pub $(($krate))*])* fn $name($($arg: $argty),*) -> () $body + }); + } +} + +/// Generate only the basic implementations necessary to be able to operate efficiently on 128-bit +/// vectors on this platfrom. For x86-64, that would mean SSE2 and AVX. +/// +/// This dispatcher is suitable for vector operations that do not benefit from advanced hardware +/// features (e.g. because they are done infrequently), so minimizing their contribution to code +/// size is more important. +#[macro_export] +macro_rules! dispatch_light128 { + ($mach:ident, $MTy:ident, { $([$pub:tt$(($krate:tt))*])* fn $name:ident($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty $body:block }) => { + #[cfg(feature = "std")] + #[inline(always)] + $($pub $(($krate))*)* fn $name($($arg: $argty),*) -> $ret { + #[inline(always)] + fn fn_impl<$MTy: $crate::Machine>($mach: $MTy, $($arg: $argty),*) -> $ret $body + type FnTy = unsafe fn($($arg: $argty),*) -> $ret; + lazy_static! { + static ref IMPL: FnTy = { dispatch_init() }; + } + #[cold] + fn dispatch_init() -> FnTy { + use std::arch::x86_64::*; + if is_x86_feature_detected!("avx") { + #[target_feature(enable = "avx")] + unsafe fn impl_avx($($arg: $argty),*) -> $ret { + fn_impl($crate::x86_64::AVX::instance(), $($arg),*) + } + impl_avx + } else if is_x86_feature_detected!("sse2") { + #[target_feature(enable = "sse2")] + unsafe fn impl_sse2($($arg: $argty),*) -> $ret { + fn_impl($crate::x86_64::SSE2::instance(), $($arg),*) + } + impl_sse2 + } else { + unimplemented!() + } + } + unsafe { IMPL($($arg),*) } + } + #[cfg(not(feature = "std"))] + #[inline(always)] + $($pub$(($krate))*)* fn $name($($arg: $argty),*) -> $ret { + unsafe fn fn_impl<$MTy: $crate::Machine>($mach: $MTy, $($arg: $argty),*) -> $ret $body + unsafe { + if cfg!(target_feature = "avx2") { + fn_impl($crate::x86_64::AVX2::instance(), $($arg),*) + } else if cfg!(target_feature = "avx") { + fn_impl($crate::x86_64::AVX::instance(), $($arg),*) + } else if cfg!(target_feature = "sse4.1") { + fn_impl($crate::x86_64::SSE41::instance(), $($arg),*) + } else if cfg!(target_feature = "ssse3") { + fn_impl($crate::x86_64::SSSE3::instance(), $($arg),*) + } else { + fn_impl($crate::x86_64::SSE2::instance(), $($arg),*) + } + } + } + }; + ($mach:ident, $MTy:ident, { $([$pub:tt$(($krate:tt))*])* fn $name:ident($($arg:ident: $argty:ty),* $(,)*) $body:block }) => { + dispatch_light128!($mach, $MTy, { + $([$pub $(($krate))*])* fn $name($($arg: $argty),*) -> () $body + }); + } +} + +/// Generate only the basic implementations necessary to be able to operate efficiently on 256-bit +/// vectors on this platfrom. For x86-64, that would mean SSE2, AVX, and AVX2. +/// +/// This dispatcher is suitable for vector operations that do not benefit from advanced hardware +/// features (e.g. because they are done infrequently), so minimizing their contribution to code +/// size is more important. +#[macro_export] +macro_rules! dispatch_light256 { + ($mach:ident, $MTy:ident, { $([$pub:tt$(($krate:tt))*])* fn $name:ident($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty $body:block }) => { + #[cfg(feature = "std")] + #[inline(always)] + $([$pub $(($krate))*])* fn $name($($arg: $argty),*) -> $ret { + #[inline(always)] + fn fn_impl<$MTy: $crate::Machine>($mach: $MTy, $($arg: $argty),*) -> $ret $body + type FnTy = unsafe fn($($arg: $argty),*) -> $ret; + lazy_static! { + static ref IMPL: FnTy = { dispatch_init() }; + } + #[cold] + fn dispatch_init() -> FnTy { + use std::arch::x86_64::*; + if is_x86_feature_detected!("avx") { + #[target_feature(enable = "avx")] + unsafe fn impl_avx($($arg: $argty),*) -> $ret { + fn_impl($crate::x86_64::AVX::instance(), $($arg),*) + } + impl_avx + } else if is_x86_feature_detected!("sse2") { + #[target_feature(enable = "sse2")] + unsafe fn impl_sse2($($arg: $argty),*) -> $ret { + fn_impl($crate::x86_64::SSE2::instance(), $($arg),*) + } + impl_sse2 + } else { + unimplemented!() + } + } + unsafe { IMPL($($arg),*) } + } + #[cfg(not(feature = "std"))] + #[inline(always)] + $($pub$(($krate))*)* fn $name($($arg: $argty),*) -> $ret { + unsafe fn fn_impl<$MTy: $crate::Machine>($mach: $MTy, $($arg: $argty),*) -> $ret $body + unsafe { + if cfg!(target_feature = "avx2") { + fn_impl($crate::x86_64::AVX2::instance(), $($arg),*) + } else if cfg!(target_feature = "avx") { + fn_impl($crate::x86_64::AVX::instance(), $($arg),*) + } else if cfg!(target_feature = "sse4.1") { + fn_impl($crate::x86_64::SSE41::instance(), $($arg),*) + } else if cfg!(target_feature = "ssse3") { + fn_impl($crate::x86_64::SSSE3::instance(), $($arg),*) + } else { + fn_impl($crate::x86_64::SSE2::instance(), $($arg),*) + } + } + } + }; + ($mach:ident, $MTy:ident, { $([$pub:tt$(($krate:tt))*])* fn $name:ident($($arg:ident: $argty:ty),* $(,)*) $body:block }) => { + dispatch_light128!($mach, $MTy, { + $([$pub $(($krate))*])* fn $name($($arg: $argty),*) -> () $body + }); + } +} diff -Nru cargo-0.35.0/vendor/ppv-lite86/src/x86_64/sse2.rs cargo-0.37.0/vendor/ppv-lite86/src/x86_64/sse2.rs --- cargo-0.35.0/vendor/ppv-lite86/src/x86_64/sse2.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/ppv-lite86/src/x86_64/sse2.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,1633 @@ +use crate::soft::{x2, x4}; +use crate::types::*; +use crate::vec128_storage; +use crate::x86_64::Avx2Machine; +use crate::x86_64::SseMachine as Machine86; +use crate::x86_64::{NoS3, NoS4, YesS3, YesS4}; +use core::arch::x86_64::*; +use core::marker::PhantomData; +use core::ops::{ + Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Not, +}; + +macro_rules! impl_binop { + ($vec:ident, $trait:ident, $fn:ident, $impl_fn:ident) => { + impl $trait for $vec { + type Output = Self; + #[inline(always)] + fn $fn(self, rhs: Self) -> Self::Output { + Self::new(unsafe { $impl_fn(self.x, rhs.x) }) + } + } + }; +} + +macro_rules! impl_binop_assign { + ($vec:ident, $trait:ident, $fn_assign:ident, $fn:ident) => { + impl $trait for $vec + where + $vec: Copy, + { + #[inline(always)] + fn $fn_assign(&mut self, rhs: Self) { + *self = self.$fn(rhs); + } + } + }; +} + +macro_rules! def_vec { + ($vec:ident, $word:ident) => { + #[allow(non_camel_case_types)] + #[derive(Copy, Clone)] + pub struct $vec { + x: __m128i, + s3: PhantomData, + s4: PhantomData, + ni: PhantomData, + } + + impl Store for $vec { + #[inline(always)] + unsafe fn unpack(x: vec128_storage) -> Self { + Self::new(x.sse2) + } + } + impl From<$vec> for vec128_storage { + #[inline(always)] + fn from(x: $vec) -> Self { + vec128_storage { sse2: x.x } + } + } + impl $vec { + #[inline(always)] + fn new(x: __m128i) -> Self { + $vec { + x, + s3: PhantomData, + s4: PhantomData, + ni: PhantomData, + } + } + } + + impl StoreBytes for $vec + where + Self: BSwap, + { + #[inline(always)] + unsafe fn unsafe_read_le(input: &[u8]) -> Self { + assert_eq!(input.len(), 16); + Self::new(_mm_loadu_si128(input.as_ptr() as *const _)) + } + #[inline(always)] + unsafe fn unsafe_read_be(input: &[u8]) -> Self { + assert_eq!(input.len(), 16); + Self::new(_mm_loadu_si128(input.as_ptr() as *const _)).bswap() + } + #[inline(always)] + fn write_le(self, out: &mut [u8]) { + assert_eq!(out.len(), 16); + unsafe { _mm_storeu_si128(out.as_mut_ptr() as *mut _, self.x) } + } + #[inline(always)] + fn write_be(self, out: &mut [u8]) { + assert_eq!(out.len(), 16); + let x = self.bswap().x; + unsafe { + _mm_storeu_si128(out.as_mut_ptr() as *mut _, x); + } + } + } + + impl Default for $vec { + #[inline(always)] + fn default() -> Self { + Self::new(unsafe { _mm_setzero_si128() }) + } + } + + impl Not for $vec { + type Output = Self; + #[inline(always)] + fn not(self) -> Self::Output { + unsafe { + let ff = _mm_set1_epi64x(-1i64); + self ^ Self::new(ff) + } + } + } + + impl BitOps0 for $vec {} + impl_binop!($vec, BitAnd, bitand, _mm_and_si128); + impl_binop!($vec, BitOr, bitor, _mm_or_si128); + impl_binop!($vec, BitXor, bitxor, _mm_xor_si128); + impl_binop_assign!($vec, BitAndAssign, bitand_assign, bitand); + impl_binop_assign!($vec, BitOrAssign, bitor_assign, bitor); + impl_binop_assign!($vec, BitXorAssign, bitxor_assign, bitxor); + impl AndNot for $vec { + type Output = Self; + #[inline(always)] + fn andnot(self, rhs: Self) -> Self { + Self::new(unsafe { _mm_andnot_si128(self.x, rhs.x) }) + } + } + }; +} + +macro_rules! impl_bitops32 { + ($vec:ident) => { + impl BitOps32 for $vec where + $vec: RotateEachWord32 + { + } + }; +} + +macro_rules! impl_bitops64 { + ($vec:ident) => { + impl_bitops32!($vec); + impl BitOps64 for $vec where + $vec: RotateEachWord64 + RotateEachWord32 + { + } + }; +} + +macro_rules! impl_bitops128 { + ($vec:ident) => { + impl_bitops64!($vec); + impl BitOps128 for $vec where + $vec: RotateEachWord128 + { + } + }; +} + +macro_rules! rotr_32_s3 { + ($name:ident, $k0:expr, $k1:expr) => { + #[inline(always)] + fn $name(self) -> Self { + Self::new(unsafe { + _mm_shuffle_epi8( + self.x, + _mm_set_epi64x($k0, $k1), + ) + }) + } + }; +} +macro_rules! rotr_32 { + ($name:ident, $i:expr) => { + #[inline(always)] + fn $name(self) -> Self { + Self::new(unsafe { + _mm_or_si128( + _mm_srli_epi32(self.x, $i as i32), + _mm_slli_epi32(self.x, 32 - $i as i32), + ) + }) + } + }; +} +impl RotateEachWord32 for u32x4_sse2 { + rotr_32!(rotate_each_word_right7, 7); + rotr_32_s3!( + rotate_each_word_right8, + 0x0c0f0e0d_080b0a09, + 0x04070605_00030201 + ); + rotr_32!(rotate_each_word_right11, 11); + rotr_32!(rotate_each_word_right12, 12); + rotr_32_s3!( + rotate_each_word_right16, + 0x0d0c0f0e_09080b0a, + 0x05040706_01000302 + ); + rotr_32!(rotate_each_word_right20, 20); + rotr_32_s3!( + rotate_each_word_right24, + 0x0e0d0c0f_0a09080b, + 0x06050407_02010003 + ); + rotr_32!(rotate_each_word_right25, 25); +} +impl RotateEachWord32 for u32x4_sse2 { + rotr_32!(rotate_each_word_right7, 7); + rotr_32!(rotate_each_word_right8, 8); + rotr_32!(rotate_each_word_right11, 11); + rotr_32!(rotate_each_word_right12, 12); + #[inline(always)] + fn rotate_each_word_right16(self) -> Self { + Self::new(swap16_s2(self.x)) + } + rotr_32!(rotate_each_word_right20, 20); + rotr_32!(rotate_each_word_right24, 24); + rotr_32!(rotate_each_word_right25, 25); +} + +macro_rules! rotr_64_s3 { + ($name:ident, $k0:expr, $k1:expr) => { + #[inline(always)] + fn $name(self) -> Self { + Self::new(unsafe { + _mm_shuffle_epi8( + self.x, + _mm_set_epi64x($k0, $k1), + ) + }) + } + }; +} +macro_rules! rotr_64 { + ($name:ident, $i:expr) => { + #[inline(always)] + fn $name(self) -> Self { + Self::new(unsafe { + _mm_or_si128( + _mm_srli_epi64(self.x, $i as i32), + _mm_slli_epi64(self.x, 64 - $i as i32), + ) + }) + } + }; +} +impl RotateEachWord32 for u64x2_sse2 { + rotr_64!(rotate_each_word_right7, 7); + rotr_64_s3!( + rotate_each_word_right8, + 0x080f_0e0d_0c0b_0a09, + 0x0007_0605_0403_0201 + ); + rotr_64!(rotate_each_word_right11, 11); + rotr_64!(rotate_each_word_right12, 12); + rotr_64_s3!( + rotate_each_word_right16, + 0x0908_0f0e_0d0c_0b0a, + 0x0100_0706_0504_0302 + ); + rotr_64!(rotate_each_word_right20, 20); + rotr_64_s3!( + rotate_each_word_right24, + 0x0a09_080f_0e0d_0c0b, + 0x0201_0007_0605_0403 + ); + rotr_64!(rotate_each_word_right25, 25); +} +impl RotateEachWord32 for u64x2_sse2 { + rotr_64!(rotate_each_word_right7, 7); + rotr_64!(rotate_each_word_right8, 8); + rotr_64!(rotate_each_word_right11, 11); + rotr_64!(rotate_each_word_right12, 12); + #[inline(always)] + fn rotate_each_word_right16(self) -> Self { + Self::new(swap16_s2(self.x)) + } + rotr_64!(rotate_each_word_right20, 20); + rotr_64!(rotate_each_word_right24, 24); + rotr_64!(rotate_each_word_right25, 25); +} +impl RotateEachWord64 for u64x2_sse2 { + #[inline(always)] + fn rotate_each_word_right32(self) -> Self { + Self::new(unsafe { _mm_shuffle_epi32(self.x, 0b10110001) }) + } +} + +macro_rules! rotr_128 { + ($name:ident, $i:expr) => { + #[inline(always)] + fn $name(self) -> Self { + Self::new(unsafe { + _mm_or_si128( + _mm_srli_si128(self.x, $i as i32), + _mm_slli_si128(self.x, 128 - $i as i32), + ) + }) + } + }; +} +// TODO: completely unoptimized +impl RotateEachWord32 for u128x1_sse2 { + rotr_128!(rotate_each_word_right7, 7); + rotr_128!(rotate_each_word_right8, 8); + rotr_128!(rotate_each_word_right11, 11); + rotr_128!(rotate_each_word_right12, 12); + rotr_128!(rotate_each_word_right16, 16); + rotr_128!(rotate_each_word_right20, 20); + rotr_128!(rotate_each_word_right24, 24); + rotr_128!(rotate_each_word_right25, 25); +} +// TODO: completely unoptimized +impl RotateEachWord64 for u128x1_sse2 { + rotr_128!(rotate_each_word_right32, 32); +} +impl RotateEachWord128 for u128x1_sse2 {} + +def_vec!(u32x4_sse2, u32); +def_vec!(u64x2_sse2, u64); +def_vec!(u128x1_sse2, u128); + +impl MultiLane<[u32; 4]> for u32x4_sse2 { + #[inline(always)] + fn to_lanes(self) -> [u32; 4] { + unsafe { + let x = _mm_cvtsi128_si64(self.x) as u64; + let y = _mm_extract_epi64(self.x, 1) as u64; + [x as u32, (x >> 32) as u32, y as u32, (y >> 32) as u32] + } + } + #[inline(always)] + fn from_lanes(xs: [u32; 4]) -> Self { + unsafe { + let mut x = _mm_cvtsi64_si128((xs[0] as u64 | ((xs[1] as u64) << 32)) as i64); + x = _mm_insert_epi64(x, (xs[2] as u64 | ((xs[3] as u64) << 32)) as i64, 1); + Self::new(x) + } + } +} +impl MultiLane<[u32; 4]> for u32x4_sse2 { + #[inline(always)] + fn to_lanes(self) -> [u32; 4] { + unsafe { + let x = _mm_cvtsi128_si64(self.x) as u64; + let y = _mm_cvtsi128_si64(_mm_shuffle_epi32(self.x, 0b11101110)) as u64; + [x as u32, (x >> 32) as u32, y as u32, (y >> 32) as u32] + } + } + #[inline(always)] + fn from_lanes(xs: [u32; 4]) -> Self { + unsafe { + let x = (xs[0] as u64 | ((xs[1] as u64) << 32)) as i64; + let y = (xs[2] as u64 | ((xs[3] as u64) << 32)) as i64; + let x = _mm_cvtsi64_si128(x); + let y = _mm_slli_si128(_mm_cvtsi64_si128(y), 8); + Self::new(_mm_or_si128(x, y)) + } + } +} +impl MultiLane<[u64; 2]> for u64x2_sse2 { + #[inline(always)] + fn to_lanes(self) -> [u64; 2] { + unsafe { + [ + _mm_cvtsi128_si64(self.x) as u64, + _mm_extract_epi64(self.x, 1) as u64, + ] + } + } + #[inline(always)] + fn from_lanes(xs: [u64; 2]) -> Self { + unsafe { + let mut x = _mm_cvtsi64_si128(xs[0] as i64); + x = _mm_insert_epi64(x, xs[1] as i64, 1); + Self::new(x) + } + } +} +impl MultiLane<[u64; 2]> for u64x2_sse2 { + #[inline(always)] + fn to_lanes(self) -> [u64; 2] { + unsafe { + [ + _mm_cvtsi128_si64(self.x) as u64, + _mm_cvtsi128_si64(_mm_srli_si128(self.x, 8)) as u64, + ] + } + } + #[inline(always)] + fn from_lanes(xs: [u64; 2]) -> Self { + unsafe { + let x = _mm_cvtsi64_si128(xs[0] as i64); + let y = _mm_slli_si128(_mm_cvtsi64_si128(xs[1] as i64), 8); + Self::new(_mm_or_si128(x, y)) + } + } +} +impl MultiLane<[u128; 1]> for u128x1_sse2 { + #[inline(always)] + fn to_lanes(self) -> [u128; 1] { + unimplemented!() + } + #[inline(always)] + fn from_lanes(xs: [u128; 1]) -> Self { + unimplemented!() + } +} + +impl MultiLane<[u64; 4]> for u64x4_sse2 +where + u64x2_sse2: MultiLane<[u64; 2]> + Copy, +{ + #[inline(always)] + fn to_lanes(self) -> [u64; 4] { + let (a, b) = (self.0[0].to_lanes(), self.0[1].to_lanes()); + [a[0], a[1], b[0], b[1]] + } + #[inline(always)] + fn from_lanes(xs: [u64; 4]) -> Self { + let (a, b) = ( + u64x2_sse2::from_lanes([xs[0], xs[1]]), + u64x2_sse2::from_lanes([xs[2], xs[3]]), + ); + x2::new([a, b]) + } +} + +macro_rules! impl_into { + ($from:ident, $to:ident) => { + impl From<$from> for $to { + #[inline(always)] + fn from(x: $from) -> Self { + $to::new(x.x) + } + } + }; +} + +impl_into!(u128x1_sse2, u32x4_sse2); +impl_into!(u128x1_sse2, u64x2_sse2); + +impl_bitops32!(u32x4_sse2); +impl_bitops64!(u64x2_sse2); +impl_bitops128!(u128x1_sse2); + +impl ArithOps for u32x4_sse2 where + u32x4_sse2: BSwap +{ +} +impl ArithOps for u64x2_sse2 where + u64x2_sse2: BSwap +{ +} +impl_binop!(u32x4_sse2, Add, add, _mm_add_epi32); +impl_binop!(u64x2_sse2, Add, add, _mm_add_epi64); +impl_binop_assign!(u32x4_sse2, AddAssign, add_assign, add); +impl_binop_assign!(u64x2_sse2, AddAssign, add_assign, add); + +impl u32x4> for u32x4_sse2 +where + u32x4_sse2: RotateEachWord32 + BSwap + MultiLane<[u32; 4]> + Vec4, + Machine86: Machine, +{ +} +impl u64x2> for u64x2_sse2 +where + u64x2_sse2: + RotateEachWord64 + RotateEachWord32 + BSwap + MultiLane<[u64; 2]> + Vec2, + Machine86: Machine, +{ +} +impl u128x1> for u128x1_sse2 +where + u128x1_sse2: Swap64 + RotateEachWord64 + RotateEachWord32 + BSwap, + Machine86: Machine, + u128x1_sse2: Into< as Machine>::u32x4>, + u128x1_sse2: Into< as Machine>::u64x2>, +{ +} + +impl u32x4> for u32x4_sse2 +where + u32x4_sse2: RotateEachWord32 + BSwap + MultiLane<[u32; 4]> + Vec4, + Machine86: Machine, +{ +} +impl u64x2> for u64x2_sse2 +where + u64x2_sse2: + RotateEachWord64 + RotateEachWord32 + BSwap + MultiLane<[u64; 2]> + Vec2, + Machine86: Machine, +{ +} +impl u128x1> for u128x1_sse2 +where + u128x1_sse2: Swap64 + RotateEachWord64 + RotateEachWord32 + BSwap, + Machine86: Machine, + u128x1_sse2: Into< as Machine>::u32x4>, + u128x1_sse2: Into< as Machine>::u64x2>, +{ +} + +impl UnsafeFrom<[u32; 4]> for u32x4_sse2 { + #[inline(always)] + unsafe fn unsafe_from(xs: [u32; 4]) -> Self { + Self::new(_mm_set_epi32( + xs[3] as i32, + xs[2] as i32, + xs[1] as i32, + xs[0] as i32, + )) + } +} + +impl Vec4 for u32x4_sse2 +where + Self: MultiLane<[u32; 4]>, +{ + #[inline(always)] + fn extract(self, i: u32) -> u32 { + self.to_lanes()[i as usize] + } + #[inline(always)] + fn insert(self, v: u32, i: u32) -> Self { + Self::new(unsafe { + match i { + 0 => _mm_insert_epi32(self.x, v as i32, 0), + 1 => _mm_insert_epi32(self.x, v as i32, 1), + 2 => _mm_insert_epi32(self.x, v as i32, 2), + 3 => _mm_insert_epi32(self.x, v as i32, 3), + _ => unreachable!(), + } + }) + } +} +impl Vec4 for u32x4_sse2 +where + Self: MultiLane<[u32; 4]>, +{ + #[inline(always)] + fn extract(self, i: u32) -> u32 { + self.to_lanes()[i as usize] + } + #[inline(always)] + fn insert(self, v: u32, i: u32) -> Self { + Self::new(unsafe { + match i { + 0 => { + let x = _mm_andnot_si128(_mm_cvtsi32_si128(-1), self.x); + _mm_or_si128(x, _mm_cvtsi32_si128(v as i32)) + } + 1 => { + let mut x = _mm_shuffle_epi32(self.x, 0b0111_1000); + x = _mm_slli_si128(x, 4); + x = _mm_or_si128(x, _mm_cvtsi32_si128(v as i32)); + _mm_shuffle_epi32(x, 0b1110_0001) + } + 2 => { + let mut x = _mm_shuffle_epi32(self.x, 0b1011_0100); + x = _mm_slli_si128(x, 4); + x = _mm_or_si128(x, _mm_cvtsi32_si128(v as i32)); + _mm_shuffle_epi32(x, 0b1100_1001) + } + 3 => { + let mut x = _mm_slli_si128(self.x, 4); + x = _mm_or_si128(x, _mm_cvtsi32_si128(v as i32)); + _mm_shuffle_epi32(x, 0b0011_1001) + } + _ => unreachable!(), + } + }) + } +} + +impl LaneWords4 for u32x4_sse2 { + #[inline(always)] + fn shuffle_lane_words2301(self) -> Self { + self.shuffle2301() + } + #[inline(always)] + fn shuffle_lane_words1230(self) -> Self { + self.shuffle1230() + } + #[inline(always)] + fn shuffle_lane_words3012(self) -> Self { + self.shuffle3012() + } +} + +impl Words4 for u32x4_sse2 { + #[inline(always)] + fn shuffle2301(self) -> Self { + Self::new(unsafe { _mm_shuffle_epi32(self.x, 0b0100_1110) }) + } + #[inline(always)] + fn shuffle1230(self) -> Self { + Self::new(unsafe { _mm_shuffle_epi32(self.x, 0b1001_0011) }) + } + #[inline(always)] + fn shuffle3012(self) -> Self { + Self::new(unsafe { _mm_shuffle_epi32(self.x, 0b0011_1001) }) + } +} + +impl Words4 for u64x4_sse2 { + #[inline(always)] + fn shuffle2301(self) -> Self { + x2::new([u64x2_sse2::new(self.0[1].x), u64x2_sse2::new(self.0[0].x)]) + } + #[inline(always)] + fn shuffle3012(self) -> Self { + unsafe { + x2::new([ + u64x2_sse2::new(_mm_alignr_epi8(self.0[1].x, self.0[0].x, 8)), + u64x2_sse2::new(_mm_alignr_epi8(self.0[0].x, self.0[1].x, 8)), + ]) + } + } + #[inline(always)] + fn shuffle1230(self) -> Self { + unsafe { + x2::new([ + u64x2_sse2::new(_mm_alignr_epi8(self.0[0].x, self.0[1].x, 8)), + u64x2_sse2::new(_mm_alignr_epi8(self.0[1].x, self.0[0].x, 8)), + ]) + } + } +} +impl Words4 for u64x4_sse2 { + #[inline(always)] + fn shuffle2301(self) -> Self { + x2::new([u64x2_sse2::new(self.0[1].x), u64x2_sse2::new(self.0[0].x)]) + } + #[inline(always)] + fn shuffle3012(self) -> Self { + unsafe { + let a = _mm_srli_si128(self.0[0].x, 8); + let b = _mm_slli_si128(self.0[0].x, 8); + let c = _mm_srli_si128(self.0[1].x, 8); + let d = _mm_slli_si128(self.0[1].x, 8); + let da = _mm_or_si128(d, a); + let bc = _mm_or_si128(b, c); + x2::new([u64x2_sse2::new(da), u64x2_sse2::new(bc)]) + } + } + #[inline(always)] + fn shuffle1230(self) -> Self { + unsafe { + let a = _mm_srli_si128(self.0[0].x, 8); + let b = _mm_slli_si128(self.0[0].x, 8); + let c = _mm_srli_si128(self.0[1].x, 8); + let d = _mm_slli_si128(self.0[1].x, 8); + let da = _mm_or_si128(d, a); + let bc = _mm_or_si128(b, c); + x2::new([u64x2_sse2::new(bc), u64x2_sse2::new(da)]) + } + } +} + +impl UnsafeFrom<[u64; 2]> for u64x2_sse2 { + #[inline(always)] + unsafe fn unsafe_from(xs: [u64; 2]) -> Self { + Self::new(_mm_set_epi64x(xs[1] as i64, xs[0] as i64)) + } +} + +impl Vec2 for u64x2_sse2 { + #[inline(always)] + fn extract(self, i: u32) -> u64 { + unsafe { + match i { + 0 => _mm_cvtsi128_si64(self.x) as u64, + 1 => _mm_extract_epi64(self.x, 1) as u64, + _ => unreachable!(), + } + } + } + #[inline(always)] + fn insert(self, x: u64, i: u32) -> Self { + Self::new(unsafe { + match i { + 0 => _mm_insert_epi64(self.x, x as i64, 0), + 1 => _mm_insert_epi64(self.x, x as i64, 1), + _ => unreachable!(), + } + }) + } +} +impl Vec2 for u64x2_sse2 { + #[inline(always)] + fn extract(self, i: u32) -> u64 { + unsafe { + match i { + 0 => _mm_cvtsi128_si64(self.x) as u64, + 1 => _mm_cvtsi128_si64(_mm_shuffle_epi32(self.x, 0b11101110)) as u64, + _ => unreachable!(), + } + } + } + #[inline(always)] + fn insert(self, x: u64, i: u32) -> Self { + Self::new(unsafe { + match i { + 0 => _mm_or_si128( + _mm_andnot_si128(_mm_cvtsi64_si128(-1), self.x), + _mm_cvtsi64_si128(x as i64), + ), + 1 => _mm_or_si128( + _mm_move_epi64(self.x), + _mm_slli_si128(_mm_cvtsi64_si128(x as i64), 8), + ), + _ => unreachable!(), + } + }) + } +} + +impl BSwap for u32x4_sse2 { + #[inline(always)] + fn bswap(self) -> Self { + Self::new(unsafe { + let k = _mm_set_epi64x(0x0c0d_0e0f_0809_0a0b, 0x0405_0607_0001_0203); + _mm_shuffle_epi8(self.x, k) + }) + } +} +#[inline(always)] +fn bswap32_s2(x: __m128i) -> __m128i { + unsafe { + let mut y = _mm_unpacklo_epi8(x, _mm_setzero_si128()); + y = _mm_shufflehi_epi16(y, 0b0001_1011); + y = _mm_shufflelo_epi16(y, 0b0001_1011); + let mut z = _mm_unpackhi_epi8(x, _mm_setzero_si128()); + z = _mm_shufflehi_epi16(z, 0b0001_1011); + z = _mm_shufflelo_epi16(z, 0b0001_1011); + _mm_packus_epi16(y, z) + } +} +impl BSwap for u32x4_sse2 { + #[inline(always)] + fn bswap(self) -> Self { + Self::new(bswap32_s2(self.x)) + } +} + +impl BSwap for u64x2_sse2 { + #[inline(always)] + fn bswap(self) -> Self { + Self::new(unsafe { + let k = _mm_set_epi64x(0x0809_0a0b_0c0d_0e0f, 0x0001_0203_0405_0607); + _mm_shuffle_epi8(self.x, k) + }) + } +} +impl BSwap for u64x2_sse2 { + #[inline(always)] + fn bswap(self) -> Self { + Self::new(unsafe { bswap32_s2(_mm_shuffle_epi32(self.x, 0b1011_0001)) }) + } +} + +impl BSwap for u128x1_sse2 { + #[inline(always)] + fn bswap(self) -> Self { + Self::new(unsafe { + let k = _mm_set_epi64x(0x0f0e_0d0c_0b0a_0908, 0x0706_0504_0302_0100); + _mm_shuffle_epi8(self.x, k) + }) + } +} +impl BSwap for u128x1_sse2 { + #[inline(always)] + fn bswap(self) -> Self { + Self::new(unsafe { unimplemented!() }) + } +} + +macro_rules! swapi { + ($x:expr, $i:expr, $k:expr) => { + unsafe { + const K: u8 = $k; + let k = _mm_set1_epi8(K as i8); + u128x1_sse2::new(_mm_or_si128( + _mm_srli_epi16(_mm_and_si128($x.x, k), $i), + _mm_and_si128(_mm_slli_epi16($x.x, $i), k), + )) + } + }; +} +#[inline(always)] +fn swap16_s2(x: __m128i) -> __m128i { + unsafe { _mm_shufflehi_epi16(_mm_shufflelo_epi16(x, 0b1011_0001), 0b1011_0001) } +} +impl Swap64 for u128x1_sse2 { + #[inline(always)] + fn swap1(self) -> Self { + swapi!(self, 1, 0xaa) + } + #[inline(always)] + fn swap2(self) -> Self { + swapi!(self, 2, 0xcc) + } + #[inline(always)] + fn swap4(self) -> Self { + swapi!(self, 4, 0xf0) + } + #[inline(always)] + fn swap8(self) -> Self { + u128x1_sse2::new(unsafe { + let k = _mm_set_epi64x(0x0e0f_0c0d_0a0b_0809, 0x0607_0405_0203_0001); + _mm_shuffle_epi8(self.x, k) + }) + } + #[inline(always)] + fn swap16(self) -> Self { + u128x1_sse2::new(unsafe { + let k = _mm_set_epi64x(0x0d0c_0f0e_0908_0b0a, 0x0504_0706_0100_0302); + _mm_shuffle_epi8(self.x, k) + }) + } + #[inline(always)] + fn swap32(self) -> Self { + u128x1_sse2::new(unsafe { _mm_shuffle_epi32(self.x, 0b1011_0001) }) + } + #[inline(always)] + fn swap64(self) -> Self { + u128x1_sse2::new(unsafe { _mm_shuffle_epi32(self.x, 0b0100_1110) }) + } +} +impl Swap64 for u128x1_sse2 { + #[inline(always)] + fn swap1(self) -> Self { + swapi!(self, 1, 0xaa) + } + #[inline(always)] + fn swap2(self) -> Self { + swapi!(self, 2, 0xcc) + } + #[inline(always)] + fn swap4(self) -> Self { + swapi!(self, 4, 0xf0) + } + #[inline(always)] + fn swap8(self) -> Self { + u128x1_sse2::new(unsafe { + _mm_or_si128(_mm_slli_epi16(self.x, 8), _mm_srli_epi16(self.x, 8)) + }) + } + #[inline(always)] + fn swap16(self) -> Self { + u128x1_sse2::new(swap16_s2(self.x)) + } + #[inline(always)] + fn swap32(self) -> Self { + u128x1_sse2::new(unsafe { _mm_shuffle_epi32(self.x, 0b1011_0001) }) + } + #[inline(always)] + fn swap64(self) -> Self { + u128x1_sse2::new(unsafe { _mm_shuffle_epi32(self.x, 0b0100_1110) }) + } +} + +#[derive(Copy, Clone)] +pub struct G0; +#[derive(Copy, Clone)] +pub struct G1; + +#[allow(non_camel_case_types)] +pub type u32x4x2_sse2 = x2, G0>; +#[allow(non_camel_case_types)] +pub type u64x2x2_sse2 = x2, G0>; +#[allow(non_camel_case_types)] +pub type u64x4_sse2 = x2, G1>; +#[allow(non_camel_case_types)] +pub type u128x2_sse2 = x2, G0>; + +#[allow(non_camel_case_types)] +pub type u32x4x4_sse2 = x4>; +#[allow(non_camel_case_types)] +pub type u64x2x4_sse2 = x4>; +#[allow(non_camel_case_types)] +pub type u128x4_sse2 = x4>; + +impl u32x4x2> for u32x4x2_sse2 +where + u32x4_sse2: RotateEachWord32 + BSwap, + Machine86: Machine, + u32x4x2_sse2: MultiLane<[ as Machine>::u32x4; 2]>, + u32x4x2_sse2: Vec2< as Machine>::u32x4>, +{ +} +impl u64x2x2> for u64x2x2_sse2 +where + u64x2_sse2: RotateEachWord64 + RotateEachWord32 + BSwap, + Machine86: Machine, + u64x2x2_sse2: MultiLane<[ as Machine>::u64x2; 2]>, + u64x2x2_sse2: Vec2< as Machine>::u64x2>, +{ +} +impl u64x4> for u64x4_sse2 +where + u64x2_sse2: RotateEachWord64 + RotateEachWord32 + BSwap, + Machine86: Machine, + u64x4_sse2: MultiLane<[u64; 4]> + Vec4 + Words4, +{ +} +impl u128x2> for u128x2_sse2 +where + u128x1_sse2: Swap64 + BSwap, + Machine86: Machine, + u128x2_sse2: MultiLane<[ as Machine>::u128x1; 2]>, + u128x2_sse2: Vec2< as Machine>::u128x1>, + u128x2_sse2: Into< as Machine>::u32x4x2>, + u128x2_sse2: Into< as Machine>::u64x2x2>, + u128x2_sse2: Into< as Machine>::u64x4>, +{ +} + +impl u32x4x2> for u32x4x2_sse2 +where + u32x4_sse2: RotateEachWord32 + BSwap, + Avx2Machine: Machine, + u32x4x2_sse2: MultiLane<[ as Machine>::u32x4; 2]>, + u32x4x2_sse2: Vec2< as Machine>::u32x4>, +{ +} +impl u64x2x2> for u64x2x2_sse2 +where + u64x2_sse2: RotateEachWord64 + RotateEachWord32 + BSwap, + Avx2Machine: Machine, + u64x2x2_sse2: MultiLane<[ as Machine>::u64x2; 2]>, + u64x2x2_sse2: Vec2< as Machine>::u64x2>, +{ +} +impl u64x4> for u64x4_sse2 +where + u64x2_sse2: RotateEachWord64 + RotateEachWord32 + BSwap, + Avx2Machine: Machine, + u64x4_sse2: MultiLane<[u64; 4]> + Vec4 + Words4, +{ +} +impl u128x2> for u128x2_sse2 +where + u128x1_sse2: Swap64 + BSwap, + Avx2Machine: Machine, + u128x2_sse2: MultiLane<[ as Machine>::u128x1; 2]>, + u128x2_sse2: Vec2< as Machine>::u128x1>, + u128x2_sse2: Into< as Machine>::u32x4x2>, + u128x2_sse2: Into< as Machine>::u64x2x2>, + u128x2_sse2: Into< as Machine>::u64x4>, +{ +} + +impl Vec4 for u64x4_sse2 +where + u64x2_sse2: Copy + Vec2, +{ + #[inline(always)] + fn extract(self, i: u32) -> u64 { + match i { + 0 => self.0[0].extract(0), + 1 => self.0[0].extract(1), + 2 => self.0[1].extract(0), + 3 => self.0[1].extract(1), + _ => panic!(), + } + } + #[inline(always)] + fn insert(mut self, w: u64, i: u32) -> Self { + match i { + 0 => self.0[0] = self.0[0].insert(w, 0), + 1 => self.0[0] = self.0[0].insert(w, 1), + 2 => self.0[1] = self.0[1].insert(w, 0), + 3 => self.0[1] = self.0[1].insert(w, 1), + _ => panic!(), + }; + self + } +} + +impl u32x4x4> for u32x4x4_sse2 +where + u32x4_sse2: RotateEachWord32 + BSwap, + Machine86: Machine, + u32x4x4_sse2: MultiLane<[ as Machine>::u32x4; 4]>, + u32x4x4_sse2: Vec4< as Machine>::u32x4>, +{ +} +impl u64x2x4> for u64x2x4_sse2 +where + u64x2_sse2: RotateEachWord64 + RotateEachWord32 + BSwap, + Machine86: Machine, + u64x2x4_sse2: MultiLane<[ as Machine>::u64x2; 4]>, + u64x2x4_sse2: Vec4< as Machine>::u64x2>, +{ +} +impl u128x4> for u128x4_sse2 +where + u128x1_sse2: Swap64 + BSwap, + Machine86: Machine, + u128x4_sse2: MultiLane<[ as Machine>::u128x1; 4]>, + u128x4_sse2: Vec4< as Machine>::u128x1>, + u128x4_sse2: Into< as Machine>::u32x4x4>, + u128x4_sse2: Into< as Machine>::u64x2x4>, +{ +} + +impl u32x4x4> for u32x4x4_sse2 +where + u32x4_sse2: RotateEachWord32 + BSwap, + Avx2Machine: Machine, + u32x4x4_sse2: MultiLane<[ as Machine>::u32x4; 4]>, + u32x4x4_sse2: Vec4< as Machine>::u32x4>, +{ +} +impl u64x2x4> for u64x2x4_sse2 +where + u64x2_sse2: RotateEachWord64 + RotateEachWord32 + BSwap, + Avx2Machine: Machine, + u64x2x4_sse2: MultiLane<[ as Machine>::u64x2; 4]>, + u64x2x4_sse2: Vec4< as Machine>::u64x2>, +{ +} +impl u128x4> for u128x4_sse2 +where + u128x1_sse2: Swap64 + BSwap, + Avx2Machine: Machine, + u128x4_sse2: MultiLane<[ as Machine>::u128x1; 4]>, + u128x4_sse2: Vec4< as Machine>::u128x1>, + u128x4_sse2: Into< as Machine>::u32x4x4>, + u128x4_sse2: Into< as Machine>::u64x2x4>, +{ +} + +macro_rules! impl_into_x { + ($from:ident, $to:ident) => { + impl From, Gf>> + for x2<$to, Gt> + { + #[inline(always)] + fn from(x: x2<$from, Gf>) -> Self { + x2::new([$to::from(x.0[0]), $to::from(x.0[1])]) + } + } + impl From>> for x4<$to> { + #[inline(always)] + fn from(x: x4<$from>) -> Self { + x4::new([ + $to::from(x.0[0]), + $to::from(x.0[1]), + $to::from(x.0[2]), + $to::from(x.0[3]), + ]) + } + } + }; +} +impl_into_x!(u128x1_sse2, u64x2_sse2); +impl_into_x!(u128x1_sse2, u32x4_sse2); + +///// Debugging + +use core::fmt::{Debug, Formatter, Result}; + +impl PartialEq for x2 { + #[inline(always)] + fn eq(&self, rhs: &Self) -> bool { + self.0[0] == rhs.0[0] && self.0[1] == rhs.0[1] + } +} + +#[inline(always)] +unsafe fn eq128_s4(x: __m128i, y: __m128i) -> bool { + let q = _mm_shuffle_epi32(_mm_cmpeq_epi64(x, y), 0b1100_0110); + _mm_cvtsi128_si64(q) == -1 +} + +#[inline(always)] +unsafe fn eq128_s2(x: __m128i, y: __m128i) -> bool { + let q = _mm_cmpeq_epi32(x, y); + let p = _mm_cvtsi128_si64(_mm_srli_si128(q, 8)); + let q = _mm_cvtsi128_si64(q); + (p & q) == -1 +} + +impl PartialEq for u32x4_sse2 { + #[inline(always)] + fn eq(&self, rhs: &Self) -> bool { + unsafe { eq128_s2(self.x, rhs.x) } + } +} +impl Debug for u32x4_sse2 +where + Self: Copy + MultiLane<[u32; 4]>, +{ + #[cold] + fn fmt(&self, fmt: &mut Formatter) -> Result { + fmt.write_fmt(format_args!("{:08x?}", &self.to_lanes())) + } +} + +impl PartialEq for u64x2_sse2 { + #[inline(always)] + fn eq(&self, rhs: &Self) -> bool { + unsafe { eq128_s2(self.x, rhs.x) } + } +} +impl Debug for u64x2_sse2 +where + Self: Copy + MultiLane<[u64; 2]>, +{ + #[cold] + fn fmt(&self, fmt: &mut Formatter) -> Result { + fmt.write_fmt(format_args!("{:016x?}", &self.to_lanes())) + } +} + +impl Debug for u64x4_sse2 +where + u64x2_sse2: Copy + MultiLane<[u64; 2]>, +{ + #[cold] + fn fmt(&self, fmt: &mut Formatter) -> Result { + let (a, b) = (self.0[0].to_lanes(), self.0[1].to_lanes()); + fmt.write_fmt(format_args!("{:016x?}", &[a[0], a[1], b[0], b[1]])) + } +} + +#[cfg(test)] +mod test { + use super::*; + use crate::x86_64::{SSE2, SSE41, SSSE3}; + use crate::Machine; + + #[test] + #[cfg(target_arch = "x86_64")] + fn test_bswap32_s2_vs_s3() { + let xs = [0x0f0e_0d0c, 0x0b0a_0908, 0x0706_0504, 0x0302_0100]; + let ys = [0x0c0d_0e0f, 0x0809_0a0b, 0x0405_0607, 0x0001_0203]; + + let s2 = unsafe { SSE2::instance() }; + let s3 = unsafe { SSSE3::instance() }; + + let x_s2 = { + let x_s2: ::u32x4 = s2.vec(xs); + x_s2.bswap() + }; + + let x_s3 = { + let x_s3: ::u32x4 = s3.vec(xs); + x_s3.bswap() + }; + + assert_eq!(x_s2, unsafe { core::mem::transmute(x_s3) }); + assert_eq!(x_s2, s2.vec(ys)); + } + + #[test] + #[cfg(target_arch = "x86_64")] + fn test_bswap64_s2_vs_s3() { + let xs = [0x0f0e_0d0c_0b0a_0908, 0x0706_0504_0302_0100]; + let ys = [0x0809_0a0b_0c0d_0e0f, 0x0001_0203_0405_0607]; + + let s2 = unsafe { SSE2::instance() }; + let s3 = unsafe { SSSE3::instance() }; + + let x_s2 = { + let x_s2: ::u64x2 = s2.vec(xs); + x_s2.bswap() + }; + + let x_s3 = { + let x_s3: ::u64x2 = s3.vec(xs); + x_s3.bswap() + }; + + assert_eq!(x_s2, s2.vec(ys)); + assert_eq!(x_s3, unsafe { core::mem::transmute(x_s3) }); + } + + #[test] + #[cfg(target_arch = "x86_64")] + fn test_shuffle32_s2_vs_s3() { + let xs = [0x0, 0x1, 0x2, 0x3]; + let ys = [0x2, 0x3, 0x0, 0x1]; + let zs = [0x1, 0x2, 0x3, 0x0]; + + let s2 = unsafe { SSE2::instance() }; + let s3 = unsafe { SSSE3::instance() }; + + let x_s2 = { + let x_s2: ::u32x4 = s2.vec(xs); + x_s2.shuffle2301() + }; + let x_s3 = { + let x_s3: ::u32x4 = s3.vec(xs); + x_s3.shuffle2301() + }; + assert_eq!(x_s2, s2.vec(ys)); + assert_eq!(x_s3, unsafe { core::mem::transmute(x_s3) }); + + let x_s2 = { + let x_s2: ::u32x4 = s2.vec(xs); + x_s2.shuffle3012() + }; + let x_s3 = { + let x_s3: ::u32x4 = s3.vec(xs); + x_s3.shuffle3012() + }; + assert_eq!(x_s2, s2.vec(zs)); + assert_eq!(x_s3, unsafe { core::mem::transmute(x_s3) }); + + let x_s2 = x_s2.shuffle1230(); + let x_s3 = x_s3.shuffle1230(); + assert_eq!(x_s2, s2.vec(xs)); + assert_eq!(x_s3, unsafe { core::mem::transmute(x_s3) }); + } + + #[test] + #[cfg(target_arch = "x86_64")] + fn test_shuffle64_s2_vs_s3() { + let xs = [0x0, 0x1, 0x2, 0x3]; + let ys = [0x2, 0x3, 0x0, 0x1]; + let zs = [0x1, 0x2, 0x3, 0x0]; + + let s2 = unsafe { SSE2::instance() }; + let s3 = unsafe { SSSE3::instance() }; + + let x_s2 = { + let x_s2: ::u64x4 = s2.vec(xs); + x_s2.shuffle2301() + }; + let x_s3 = { + let x_s3: ::u64x4 = s3.vec(xs); + x_s3.shuffle2301() + }; + assert_eq!(x_s2, s2.vec(ys)); + assert_eq!(x_s3, unsafe { core::mem::transmute(x_s3) }); + + let x_s2 = { + let x_s2: ::u64x4 = s2.vec(xs); + x_s2.shuffle3012() + }; + let x_s3 = { + let x_s3: ::u64x4 = s3.vec(xs); + x_s3.shuffle3012() + }; + assert_eq!(x_s2, s2.vec(zs)); + assert_eq!(x_s3, unsafe { core::mem::transmute(x_s3) }); + + let x_s2 = x_s2.shuffle1230(); + let x_s3 = x_s3.shuffle1230(); + assert_eq!(x_s2, s2.vec(xs)); + assert_eq!(x_s3, unsafe { core::mem::transmute(x_s3) }); + } + + #[test] + #[cfg(target_arch = "x86_64")] + fn test_lanes_u32x4() { + let xs = [0x1, 0x2, 0x3, 0x4]; + + let s2 = unsafe { SSE2::instance() }; + let s3 = unsafe { SSSE3::instance() }; + let s4 = unsafe { SSE41::instance() }; + + { + let x_s2: ::u32x4 = s2.vec(xs); + let y_s2 = ::u32x4::from_lanes(xs); + assert_eq!(x_s2, y_s2); + assert_eq!(xs, y_s2.to_lanes()); + } + + { + let x_s3: ::u32x4 = s3.vec(xs); + let y_s3 = ::u32x4::from_lanes(xs); + assert_eq!(x_s3, y_s3); + assert_eq!(xs, y_s3.to_lanes()); + } + + { + let x_s4: ::u32x4 = s4.vec(xs); + let y_s4 = ::u32x4::from_lanes(xs); + assert_eq!(x_s4, y_s4); + assert_eq!(xs, y_s4.to_lanes()); + } + } + + #[test] + #[cfg(target_arch = "x86_64")] + fn test_lanes_u64x2() { + let xs = [0x1, 0x2]; + + let s2 = unsafe { SSE2::instance() }; + let s3 = unsafe { SSSE3::instance() }; + let s4 = unsafe { SSE41::instance() }; + + { + let x_s2: ::u64x2 = s2.vec(xs); + let y_s2 = ::u64x2::from_lanes(xs); + assert_eq!(x_s2, y_s2); + assert_eq!(xs, y_s2.to_lanes()); + } + + { + let x_s3: ::u64x2 = s3.vec(xs); + let y_s3 = ::u64x2::from_lanes(xs); + assert_eq!(x_s3, y_s3); + assert_eq!(xs, y_s3.to_lanes()); + } + + { + let x_s4: ::u64x2 = s4.vec(xs); + let y_s4 = ::u64x2::from_lanes(xs); + assert_eq!(x_s4, y_s4); + assert_eq!(xs, y_s4.to_lanes()); + } + } + + #[test] + #[cfg(target_arch = "x86_64")] + fn test_vec4_u32x4_s2() { + let xs = [1, 2, 3, 4]; + let s2 = unsafe { SSE2::instance() }; + let x_s2: ::u32x4 = s2.vec(xs); + assert_eq!(x_s2.extract(0), 1); + assert_eq!(x_s2.extract(1), 2); + assert_eq!(x_s2.extract(2), 3); + assert_eq!(x_s2.extract(3), 4); + assert_eq!(x_s2.insert(0xf, 0), s2.vec([0xf, 2, 3, 4])); + assert_eq!(x_s2.insert(0xf, 1), s2.vec([1, 0xf, 3, 4])); + assert_eq!(x_s2.insert(0xf, 2), s2.vec([1, 2, 0xf, 4])); + assert_eq!(x_s2.insert(0xf, 3), s2.vec([1, 2, 3, 0xf])); + } + + #[test] + #[cfg(target_arch = "x86_64")] + fn test_vec4_u32x4_s4() { + let xs = [1, 2, 3, 4]; + let s4 = unsafe { SSE41::instance() }; + let x_s4: ::u32x4 = s4.vec(xs); + assert_eq!(x_s4.extract(0), 1); + assert_eq!(x_s4.extract(1), 2); + assert_eq!(x_s4.extract(2), 3); + assert_eq!(x_s4.extract(3), 4); + assert_eq!(x_s4.insert(0xf, 0), s4.vec([0xf, 2, 3, 4])); + assert_eq!(x_s4.insert(0xf, 1), s4.vec([1, 0xf, 3, 4])); + assert_eq!(x_s4.insert(0xf, 2), s4.vec([1, 2, 0xf, 4])); + assert_eq!(x_s4.insert(0xf, 3), s4.vec([1, 2, 3, 0xf])); + } + + #[test] + #[cfg(target_arch = "x86_64")] + fn test_vec2_u64x2_s2() { + let xs = [0x1, 0x2]; + let s2 = unsafe { SSE2::instance() }; + let x_s2: ::u64x2 = s2.vec(xs); + assert_eq!(x_s2.extract(0), 1); + assert_eq!(x_s2.extract(1), 2); + assert_eq!(x_s2.insert(0xf, 0), s2.vec([0xf, 2])); + assert_eq!(x_s2.insert(0xf, 1), s2.vec([1, 0xf])); + } + + #[test] + #[cfg(target_arch = "x86_64")] + fn test_vec4_u64x2_s4() { + let xs = [0x1, 0x2]; + let s4 = unsafe { SSE41::instance() }; + let x_s4: ::u64x2 = s4.vec(xs); + assert_eq!(x_s4.extract(0), 1); + assert_eq!(x_s4.extract(1), 2); + assert_eq!(x_s4.insert(0xf, 0), s4.vec([0xf, 2])); + assert_eq!(x_s4.insert(0xf, 1), s4.vec([1, 0xf])); + } +} + +pub mod avx2 { + #![allow(non_camel_case_types)] + use crate::soft::x4; + use crate::types::*; + use crate::x86_64::sse2::{u128x1_sse2, u32x4_sse2}; + use crate::x86_64::{vec256_storage, vec512_storage, Avx2Machine, YesS3, YesS4}; + use core::arch::x86_64::*; + use core::marker::PhantomData; + use core::ops::*; + + #[derive(Copy, Clone)] + pub struct u32x4x4_avx2 { + x: [__m256i; 2], + ni: PhantomData, + } + + impl u32x4x4_avx2 { + #[inline(always)] + fn new(x: [__m256i; 2]) -> Self { + Self { x, ni: PhantomData } + } + } + + impl u32x4x4> for u32x4x4_avx2 where NI: Copy {} + impl Store for u32x4x4_avx2 { + #[inline(always)] + unsafe fn unpack(p: vec512_storage) -> Self { + Self::new([p.avx[0].avx, p.avx[1].avx]) + } + } + impl MultiLane<[u32x4_sse2; 4]> for u32x4x4_avx2 { + #[inline(always)] + fn to_lanes(self) -> [u32x4_sse2; 4] { + unsafe { + [ + u32x4_sse2::new(_mm256_extracti128_si256(self.x[0], 0)), + u32x4_sse2::new(_mm256_extracti128_si256(self.x[0], 1)), + u32x4_sse2::new(_mm256_extracti128_si256(self.x[1], 0)), + u32x4_sse2::new(_mm256_extracti128_si256(self.x[1], 1)), + ] + } + } + #[inline(always)] + fn from_lanes(x: [u32x4_sse2; 4]) -> Self { + Self::new(unsafe { + [ + _mm256_setr_m128i(x[0].x, x[1].x), + _mm256_setr_m128i(x[2].x, x[3].x), + ] + }) + } + } + impl Vec4> for u32x4x4_avx2 { + #[inline(always)] + fn extract(self, i: u32) -> u32x4_sse2 { + unsafe { + match i { + 0 => u32x4_sse2::new(_mm256_extracti128_si256(self.x[0], 0)), + 1 => u32x4_sse2::new(_mm256_extracti128_si256(self.x[0], 1)), + 2 => u32x4_sse2::new(_mm256_extracti128_si256(self.x[1], 0)), + 3 => u32x4_sse2::new(_mm256_extracti128_si256(self.x[1], 1)), + _ => panic!(), + } + } + } + #[inline(always)] + fn insert(self, w: u32x4_sse2, i: u32) -> Self { + Self::new(unsafe { + match i { + 0 => [_mm256_inserti128_si256(self.x[0], w.x, 0), self.x[1]], + 1 => [_mm256_inserti128_si256(self.x[0], w.x, 1), self.x[1]], + 2 => [self.x[0], _mm256_inserti128_si256(self.x[1], w.x, 0)], + 3 => [self.x[0], _mm256_inserti128_si256(self.x[1], w.x, 1)], + _ => panic!(), + } + }) + } + } + impl LaneWords4 for u32x4x4_avx2 { + #[inline(always)] + fn shuffle_lane_words1230(self) -> Self { + Self::new(unsafe { + [ + _mm256_shuffle_epi32(self.x[0], 0b1001_0011), + _mm256_shuffle_epi32(self.x[1], 0b1001_0011), + ] + }) + } + #[inline(always)] + fn shuffle_lane_words2301(self) -> Self { + Self::new(unsafe { + [ + _mm256_shuffle_epi32(self.x[0], 0b0100_1110), + _mm256_shuffle_epi32(self.x[1], 0b0100_1110), + ] + }) + } + #[inline(always)] + fn shuffle_lane_words3012(self) -> Self { + Self::new(unsafe { + [ + _mm256_shuffle_epi32(self.x[0], 0b0011_1001), + _mm256_shuffle_epi32(self.x[1], 0b0011_1001), + ] + }) + } + } + impl BitOps32 for u32x4x4_avx2 where NI: Copy {} + impl ArithOps for u32x4x4_avx2 where NI: Copy {} + macro_rules! shuf_lane_bytes { + ($name:ident, $k0:expr, $k1:expr) => { + #[inline(always)] + fn $name(self) -> Self { + Self::new(unsafe { + [ + _mm256_shuffle_epi8( + self.x[0], + _mm256_set_epi64x($k0, $k1, $k0, $k1), + ), + _mm256_shuffle_epi8( + self.x[1], + _mm256_set_epi64x($k0, $k1, $k0, $k1), + ) + ] + }) + } + }; + } + macro_rules! rotr_32 { + ($name:ident, $i:expr) => { + #[inline(always)] + fn $name(self) -> Self { + Self::new(unsafe { + [ + _mm256_or_si256( + _mm256_srli_epi32(self.x[0], $i as i32), + _mm256_slli_epi32(self.x[0], 32 - $i as i32), + ), + _mm256_or_si256( + _mm256_srli_epi32(self.x[1], $i as i32), + _mm256_slli_epi32(self.x[1], 32 - $i as i32), + ) + ] + }) + } + }; + } + impl RotateEachWord32 for u32x4x4_avx2 { + rotr_32!(rotate_each_word_right7, 7); + shuf_lane_bytes!( + rotate_each_word_right8, + 0x0c0f0e0d_080b0a09, + 0x04070605_00030201 + ); + rotr_32!(rotate_each_word_right11, 11); + rotr_32!(rotate_each_word_right12, 12); + shuf_lane_bytes!( + rotate_each_word_right16, + 0x0d0c0f0e_09080b0a, + 0x05040706_01000302 + ); + rotr_32!(rotate_each_word_right20, 20); + shuf_lane_bytes!( + rotate_each_word_right24, + 0x0e0d0c0f_0a09080b, + 0x06050407_02010003 + ); + rotr_32!(rotate_each_word_right25, 25); + } + impl BitOps0 for u32x4x4_avx2 where NI: Copy {} + impl From> for vec512_storage { + #[inline(always)] + fn from(x: u32x4x4_avx2) -> Self { + Self { + avx: [ + vec256_storage { avx: x.x[0] }, + vec256_storage { avx: x.x[1] }, + ], + } + } + } + + macro_rules! impl_assign { + ($vec:ident, $Assign:ident, $assign_fn:ident, $bin_fn:ident) => { + impl $Assign for $vec + where + NI: Copy, + { + #[inline(always)] + fn $assign_fn(&mut self, rhs: Self) { + *self = self.$bin_fn(rhs); + } + } + }; + } + impl_assign!(u32x4x4_avx2, BitXorAssign, bitxor_assign, bitxor); + impl_assign!(u32x4x4_avx2, BitOrAssign, bitor_assign, bitor); + impl_assign!(u32x4x4_avx2, BitAndAssign, bitand_assign, bitand); + impl_assign!(u32x4x4_avx2, AddAssign, add_assign, add); + + macro_rules! impl_bitop_x2 { + ($vec:ident, $Op:ident, $op_fn:ident, $impl_fn:ident) => { + impl $Op for $vec { + type Output = Self; + #[inline(always)] + fn $op_fn(self, rhs: Self) -> Self::Output { + Self::new(unsafe { + [$impl_fn(self.x[0], rhs.x[0]), $impl_fn(self.x[1], rhs.x[1])] + }) + } + } + }; + } + impl_bitop_x2!(u32x4x4_avx2, BitXor, bitxor, _mm256_xor_si256); + impl_bitop_x2!(u32x4x4_avx2, BitOr, bitor, _mm256_or_si256); + impl_bitop_x2!(u32x4x4_avx2, BitAnd, bitand, _mm256_and_si256); + impl_bitop_x2!(u32x4x4_avx2, AndNot, andnot, _mm256_andnot_si256); + impl_bitop_x2!(u32x4x4_avx2, Add, add, _mm256_add_epi32); + + impl Not for u32x4x4_avx2 { + type Output = Self; + #[inline(always)] + fn not(self) -> Self::Output { + unsafe { + let f = _mm256_set1_epi8(-0x7f); + Self::new([f, f]) ^ self + } + } + } + + impl BSwap for u32x4x4_avx2 { + shuf_lane_bytes!(bswap, 0x0c0d_0e0f_0809_0a0b, 0x0405_0607_0001_0203); + } + + impl From>> for u32x4x4_avx2 + where + NI: Copy, + { + #[inline(always)] + fn from(x: x4>) -> Self { + Self::new(unsafe { + [ + _mm256_setr_m128i(x.0[0].x, x.0[1].x), + _mm256_setr_m128i(x.0[2].x, x.0[3].x), + ] + }) + } + } +} diff -Nru cargo-0.35.0/vendor/proptest/appveyor.yml cargo-0.37.0/vendor/proptest/appveyor.yml --- cargo-0.35.0/vendor/proptest/appveyor.yml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/appveyor.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -environment: - matrix: - - TARGET: nightly-x86_64-pc-windows-msvc - - TARGET: nightly-i686-pc-windows-msvc - - TARGET: nightly-x86_64-pc-windows-gnu - - TARGET: nightly-i686-pc-windows-gnu - - TARGET: 1.27.0-x86_64-pc-windows-gnu -install: - - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-${env:TARGET}.exe" -FileName "rust-install.exe" - - ps: .\rust-install.exe /VERYSILENT /NORESTART /DIR="C:\rust" | Out-Null - - ps: $env:PATH="$env:PATH;C:\rust\bin" - - rustc -vV - - cargo -vV -build_script: - - cargo build -test_script: - - cargo test - - cd test-persistence-location & run-tests.bat diff -Nru cargo-0.35.0/vendor/proptest/.cargo-checksum.json cargo-0.37.0/vendor/proptest/.cargo-checksum.json --- cargo-0.35.0/vendor/proptest/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"926d0604475349f463fe44130aae73f2294b5309ab2ca0310b998bd334ef191f"} \ No newline at end of file +{"files":{},"package":"cf147e022eacf0c8a054ab864914a7602618adba841d800a9a9868a5237a529f"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/proptest/Cargo.toml cargo-0.37.0/vendor/proptest/Cargo.toml --- cargo-0.35.0/vendor/proptest/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -11,11 +11,14 @@ # will likely look very different (and much more reasonable) [package] +edition = "2018" name = "proptest" -version = "0.8.7" +version = "0.9.4" authors = ["Jason Lingle"] +exclude = ["/gen-*.sh", "/readme-*.md"] description = "Hypothesis-like property-based testing and shrinking.\n" -documentation = "https://altsysrq.github.io/rustdoc/proptest/0.8.7/proptest/" +homepage = "https://altsysrq.github.io/proptest-book/proptest/index.html" +documentation = "https://altsysrq.github.io/rustdoc/proptest/0.9.4/proptest/" readme = "README.md" keywords = ["property", "testing", "quickcheck", "fuzz", "hypothesis"] categories = ["development-tools::testing"] @@ -33,8 +36,8 @@ default-features = false [dependencies.lazy_static] -version = "1.0.0" -default-features = false +version = "1.2" +optional = true [dependencies.num-traits] version = "0.2.2" @@ -45,10 +48,16 @@ optional = true [dependencies.rand] -version = "0.5.0" +version = "0.6" features = ["alloc", "i128_support"] default-features = false +[dependencies.rand_chacha] +version = "0.1" + +[dependencies.rand_xorshift] +version = "0.1" + [dependencies.regex-syntax] version = "0.6.0" optional = true @@ -66,12 +75,14 @@ [features] alloc = [] -default = ["std", "fork", "timeout", "bit-set"] +atomic64bit = [] +break-dead-code = [] +default = ["std", "fork", "timeout", "bit-set", "break-dead-code"] +default-code-coverage = ["std", "fork", "timeout", "bit-set"] fork = ["std", "rusty-fork", "tempfile"] -nightly = ["lazy_static/spin_no_std"] -std = ["rand/std", "byteorder/std", "quick-error", "regex-syntax", "num-traits/std"] +std = ["rand/std", "byteorder/std", "lazy_static", "quick-error", "regex-syntax", "num-traits/std"] timeout = ["fork", "rusty-fork/timeout"] -unstable = ["rand/i128_support"] +unstable = [] [badges.appveyor] branch = "master" repository = "AltSysrq/proptest" diff -Nru cargo-0.35.0/vendor/proptest/CHANGELOG.md cargo-0.37.0/vendor/proptest/CHANGELOG.md --- cargo-0.35.0/vendor/proptest/CHANGELOG.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -1,3 +1,170 @@ +## 0.9.4 + +### Bug Fixes + +- The `unstable` feature one again works against the latest nightly. + +### Performance Improvements + +- Unions and the `prop_oneof!` combinator now generate value trees + lazily. + + In previous versions of `proptest`, if a value tree for a + union variant was generated, so would value trees for earlier + variants -- as a result, union value tree generation was linear in the + number of variants. + + In `proptest` 0.9.4 and above, value trees are only generated for + union variants that are picked. Union value tree generation is now + independent of the number of variants. + +### Deprecations + +- `TupleUnion` has been deprecated, and its implementation will be + replaced by `LazyTupleUnion`'s in 0.10.0. + +### Other Notes + +- The return type of `prop_oneof!` has changed from `TupleUnion` to + `LazyTupleUnion`. `prop_oneof!`'s return type is documented to not be + stable, and that continues to be the case. + +- Shrinking is now limited to four times as many iterations as configured + number of test cases by default. + +- `prop_assert_eq!` and `prop_assert_ne!` produce output more similar to the + `assert_eq!` and `assert_ne!` macros. This should also make it easier to + visually parse out the source location in the resulting messages. + +## 0.9.3 + +This is a minor release to correct some packaging errors. The licence files are +now included in the files published to crates.io, and some unneeded files are +now excluded. + +## 0.9.2 + +### New Additions + +- Closures generated by `prop_compose!` are now `move`. This is not expected to + cause any breakage since there is no way to successfully use a borrowing + closure with that macro. + +- There is now **highly experimental** support for building on Web Assembly. + Refer to [the Proptest + book](https://altsysrq.github.io/proptest-book/proptest/wasm.html) for build + instructions. + +### Other Notes + +- Using proptest with the default `std` feature enabled, the `spin` crate is no + longer brought in as a dependency. + +- Using proptest with the `std` feature disabled, neither `spin` nor + `lazy_static` are brought in as dependencies. + +## 0.9.1 + +### New RNG Algorithm + +Starting in this version, the default RNG algorithm has been changed from +XorShift to ChaCha since it produces higher-quality randomness. This may make +test case generation a bit slower but it avoids certain pathological cases that +the old generator had. + +The old algorithm is still supported, and is used automatically when reading +old failure persistence files. + +Note that this change also affects the internal representation of RNG seeds, +which affects the `FailurePersistence` trait which previously only supported +the seed representation for XorShift. This release maintains source +compatibility with 0.9.0 by providing defaults for the new methods which +delegate (when possible) to the old ones, but be aware that custom failure +persistence implementations using the old API will not function when using an +RNG other than XorShift. + +To keep using the old algorithm, you can set the environment variable +`PROPTEST_RNG_ALGORITHM` to `xs` or set `Config.rng_algorithm` to +`RngAlgorithm::XorShift` in code. + +Besides ChaCha, this version also adds a `PassThrough` RNG "algorithm" which +makes it possible to use an external source of entropy with Proptest. + +### New Additions + +- `TestRng` instances can be created with the `from_seed` function. + +- `TestRunner` instances can be created with user-provided `TestRng`s. + +- `TestRunner` now has a `deterministic()` constructor which uses the same RNG + every time, to facilitate doing statistical tests on strategy outputs. + +- There is now a work-around for a [compiler + bug](https://github.com/rust-lang/rust/issues/52478) which prevents building + with `-C link-dead-code`. Please see this issue for details: + https://github.com/AltSysrq/proptest/issues/124 + +### Deprecations + +- The `load_persisted_failures` and `save_persisted_failure` methods on the + `FailurePersistence` trait have been deprecated and will be removed in + 0.10.0. + +## 0.9.0 + +### Breaking Changes + +- The minimum Rust version has been increased to 1.32.0. + +- The version of the `rand` crate has been increased to 0.6. + +- The `ValueFor` type alias (deprecated in 0.8.0) has been removed. Replace + `ValueFor` with `S::Value` or `::Value` as necessary. + +- `From` implementations converting a `SizeRange` back to various + std types have been removed since they were of limited utility and had + unclear or incorrect conversion properties. + +- Many optional elements (such as trailing commas or function visibility + modifiers) in certain macros could be specified more than once. The macros + now accept at most one occurrence. + +- Visibility modifiers inside `prop_compose` must no longer be enclosed in + brackets. Unless other modifiers (e.g., `unsafe`) are also in use, simply + removing the brackets is sufficient. + +### New Additions + +- Rust 2018 style macro imports are now supported. + +- In a Rust 2018 crate, all the macros can be brought into scope with + `import proptest::prelude::*;`. + +- The proptest macros now accept trailing commas in more locations. + +- Visibility modifiers can now be passed to `prop_compose!` without enclosing + them in brackets. Unfortunately, the old way could not continue to be + supported due to the way the `vis` macro matcher works. + +### Nightly-only breakage + +- The `nightly` feature, which was formerly required for using proptest with + `#[no_std]`, has been removed. References to the feature can simply be + deleted. + +- When using the `unstable` feature and setting `default-features = false`, the + `AtomicI64` and `AtomicU64` types are not supported unless the `atomic64bit` + feature is enabled. This supports `no_std` usage on platforms which do not + support atomic 64-bit operations. + +### Other Notes + +- Generated strings are now much more likely to contain right-to-left override + characters. + +- Most of the crate-level documentation has been relocated to the [Proptest + Book](https://altsysrq.github.io/proptest-book/proptest/index.html). + ## 0.8.7 ### New Additions diff -Nru cargo-0.35.0/vendor/proptest/examples/config-defaults.rs cargo-0.37.0/vendor/proptest/examples/config-defaults.rs --- cargo-0.35.0/vendor/proptest/examples/config-defaults.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/examples/config-defaults.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,8 +7,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate proptest; - use proptest::test_runner::Config; fn main() { diff -Nru cargo-0.35.0/vendor/proptest/examples/dateparser_v1.rs cargo-0.37.0/vendor/proptest/examples/dateparser_v1.rs --- cargo-0.35.0/vendor/proptest/examples/dateparser_v1.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/examples/dateparser_v1.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,8 +7,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[macro_use] -extern crate proptest; +use proptest::prelude::*; fn parse_date(s: &str) -> Option<(u32, u32, u32)> { if 10 != s.len() { @@ -33,8 +32,8 @@ // NB We omit #[test] on these functions so that main() can call them. proptest! { - fn doesnt_crash(ref s in "\\PC*") { - parse_date(s); + fn doesnt_crash(s in "\\PC*") { + parse_date(&s); } } diff -Nru cargo-0.35.0/vendor/proptest/examples/dateparser_v2.rs cargo-0.37.0/vendor/proptest/examples/dateparser_v2.rs --- cargo-0.35.0/vendor/proptest/examples/dateparser_v2.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/examples/dateparser_v2.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,8 +7,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[macro_use] -extern crate proptest; +use proptest::prelude::*; fn parse_date(s: &str) -> Option<(u32, u32, u32)> { if 10 != s.len() { @@ -38,12 +37,12 @@ // NB We omit #[test] on these functions so that main() can call them. proptest! { - fn doesnt_crash(ref s in "\\PC*") { - parse_date(s); + fn doesnt_crash(s in "\\PC*") { + parse_date(&s); } - fn parses_all_valid_dates(ref s in "[0-9]{4}-[0-9]{2}-[0-9]{2}") { - parse_date(s).unwrap(); + fn parses_all_valid_dates(s in "[0-9]{4}-[0-9]{2}-[0-9]{2}") { + parse_date(&s).unwrap(); } fn parses_date_back_to_original(y in 0u32..10_000, diff -Nru cargo-0.35.0/vendor/proptest/examples/fib.rs cargo-0.37.0/vendor/proptest/examples/fib.rs --- cargo-0.35.0/vendor/proptest/examples/fib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/examples/fib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,8 +7,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[macro_use] extern crate proptest; - // This #[cfg] is only here so that CI can test building proptest with the // timeout feature disabled. You do not need it in your code. #[cfg(feature = "timeout")] diff -Nru cargo-0.35.0/vendor/proptest/examples/tutorial-simplify-play.rs cargo-0.37.0/vendor/proptest/examples/tutorial-simplify-play.rs --- cargo-0.35.0/vendor/proptest/examples/tutorial-simplify-play.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/examples/tutorial-simplify-play.rs 2019-07-17 05:42:23.000000000 +0000 @@ -12,8 +12,6 @@ // This is *not* how proptest is normally used; it is simply used to play // around with value generation. -extern crate proptest; - use proptest::strategy::{Strategy, ValueTree}; use proptest::test_runner::TestRunner; diff -Nru cargo-0.35.0/vendor/proptest/examples/tutorial-strategy-play.rs cargo-0.37.0/vendor/proptest/examples/tutorial-strategy-play.rs --- cargo-0.35.0/vendor/proptest/examples/tutorial-strategy-play.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/examples/tutorial-strategy-play.rs 2019-07-17 05:42:23.000000000 +0000 @@ -12,8 +12,6 @@ // This is *not* how proptest is normally used; it is simply used to play // around with value generation. -extern crate proptest; - use proptest::strategy::{Strategy, ValueTree}; use proptest::test_runner::TestRunner; diff -Nru cargo-0.35.0/vendor/proptest/gen-readme.sh cargo-0.37.0/vendor/proptest/gen-readme.sh --- cargo-0.35.0/vendor/proptest/gen-readme.sh 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/gen-readme.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -#! /bin/sh - -# Generate `README.md` from the crate documentation, plus some extra stuff. - -cat readme-prologue.md >README.md ->README.md -cat readme-antelogue.md >>README.md diff -Nru cargo-0.35.0/vendor/proptest/proptest-regressions/test_runner/rng.txt cargo-0.37.0/vendor/proptest/proptest-regressions/test_runner/rng.txt --- cargo-0.35.0/vendor/proptest/proptest-regressions/test_runner/rng.txt 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/proptest-regressions/test_runner/rng.txt 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,8 @@ +# Seeds for failure cases proptest has generated in the past. It is +# automatically read and these particular cases re-run before any +# novel cases are generated. +# +# It is recommended to check this file in to source control so that +# everyone who runs the test benefits from these saved cases. +cc c07e85d05e65b51ff76176b8f3fb2ef318b8590d6e39cc1013d36c32a8f4589c # shrinks to seed = PassThrough(None, [4, 236, 242, 152, 113, 207, 60, 224, 102, 251, 83, 252, 39, 193, 248, 85, 34, 142, 244, 163, 10, 16, 16, 192, 82, 17, 210, 144, 251, 173, 175, 190, 94, 56, 129, 205, 214, 88, 168, 187, 100, 86, 98, 190, 160, 60, 58, 9, 194, 66, 118, 50, 208, 64, 157, 161, 246, 106, 14, 132, 132, 230, 125, 27, 216, 105, 121, 193, 171, 131, 10, 150, 189, 175, 177, 32, 34, 49, 77, 66, 36, 161, 178, 39, 171, 250, 156, 163, 160, 99, 200, 159, 134, 242, 43, 88, 68, 4, 156, 123, 104, 6, 74, 167, 60, 215, 9, 203, 60, 6, 45, 186, 252, 196, 64, 61, 135, 132, 144, 191, 162, 134, 157, 159, 78, 218, 161, 28, 100, 69, 23, 82, 115, 252, 183, 2, 217, 137, 145, 224, 73, 161, 28, 230, 88, 226, 209, 34, 86, 183, 152, 36, 233, 174, 24, 169, 151, 14, 106, 246, 27, 10, 200, 151, 179, 142, 37, 239, 75, 159, 167, 78, 110, 14, 241, 163, 48, 79, 194, 33, 166, 173, 46, 22, 251, 62, 115, 194, 146, 154, 35, 59, 20, 242, 161, 101, 33, 216, 83, 55, 52, 209, 249, 51, 24, 187, 58, 154, 166, 152, 1, 55, 149, 11, 158, 239, 3, 198, 142, 105, 139, 247, 245, 37, 193, 163, 180, 254, 64, 133, 177, 110, 26, 173, 72, 237, 19, 223, 69, 120, 8, 55, 85, 216, 84, 21, 197, 30, 109, 126, 144, 76, 215, 98, 204, 33, 84, 103, 33, 7, 172, 179, 119, 247, 197, 153, 191, 136, 245, 249, 27, 184, 29, 189, 60, 28, 77, 193, 144, 10, 71, 18, 68, 130, 218, 29, 188, 4, 233, 16, 143, 215, 52, 56, 71, 70, 146, 2, 130, 119, 179, 150, 79, 109, 139, 138, 3, 57, 109, 144, 160, 179, 117, 208, 53, 241, 226, 52, 141, 116, 6, 47, 248, 76, 10, 209, 255, 205, 145, 127, 215, 201, 43, 28, 51, 166, 177, 193, 232, 6, 241, 205, 53, 104, 133, 202, 1, 203, 146, 151, 154, 168, 248, 63, 139, 186, 211, 142, 206, 122, 222, 63, 134, 227, 12, 84, 197, 45, 41, 155, 211, 165, 118, 10, 255, 117, 238, 57, 133, 157, 121, 240, 67, 255, 103, 116, 94, 28, 4, 224, 24, 120, 161, 59, 83, 103, 182, 227, 176, 89, 194, 131, 22, 251, 59, 131, 117, 243, 123, 141, 3, 181, 191, 214, 31, 41, 227, 27, 169, 168, 132, 207, 167, 169, 1, 201, 191, 186, 249, 16, 32, 237, 199, 122, 153, 151, 1, 254, 69, 169, 137, 244, 84, 214, 31, 217, 26, 20, 197, 15, 179, 74, 149, 219, 45, 145, 245, 239, 215, 172, 249, 144, 79, 76, 10, 27, 21, 168, 160, 248, 178, 22, 251, 204, 12, 18, 197, 226, 11, 26, 2, 128, 86, 85, 92, 164, 59, 253, 75, 84, 122, 229, 45, 130, 39, 162, 35, 84, 126, 250, 164, 21, 55, 73, 149, 82, 83, 26, 81, 147, 231, 19, 244, 159, 23, 51, 215, 81, 93, 171, 27, 246, 234, 230, 107, 47, 47, 201, 23, 161, 194, 213, 146, 164, 91, 174, 151, 148, 113, 147, 148, 206, 224, 17, 167, 139, 70, 240, 60, 37, 102, 17, 176, 60, 213, 42, 22, 123, 50, 44, 87, 244, 193, 141, 53, 212, 228, 239, 212, 55, 146, 192, 157, 250, 248, 46, 73, 98, 173, 145, 249, 51, 10, 154, 154, 179, 95, 140, 184, 96, 162, 96, 35, 147, 243, 187, 255, 5, 191, 185, 182, 216, 69, 24, 45, 45, 160, 232, 83, 180, 185, 103, 10, 140, 86, 206, 104, 99, 70, 200, 201, 13, 235, 54, 136, 23, 142, 220, 16, 231, 158, 243, 54, 167, 45, 125, 51, 116, 210, 246, 216, 89, 30, 218, 108, 214, 29, 85, 95, 0, 226, 11, 90, 196, 186, 48, 188, 9, 8, 212, 213, 35, 231, 182, 78, 105, 239, 231, 22, 191, 166, 210, 227, 134, 79, 144, 17, 154, 60, 179, 135, 211, 104, 109, 75, 213, 109, 182, 55, 82, 172, 20, 249, 73, 0, 169, 162, 37, 1, 92, 25, 141, 25, 140, 118, 77, 221, 54, 7, 224, 224, 115, 107, 41, 20, 37, 35, 102, 243, 206, 200, 98, 176, 118, 140, 23, 159, 127, 90, 82, 174, 21, 34, 72, 25, 236, 241, 68, 65, 116, 41, 67, 153, 211, 73, 120, 113, 189, 125, 158, 72, 201, 200, 201, 207, 253, 75, 246, 120, 146, 187, 9, 24, 164, 57, 160, 127, 178, 147, 239, 155, 188, 160, 179, 191, 241, 245, 31, 245, 57, 18, 64, 246, 44, 150, 32, 99, 79, 124, 188, 147, 122, 104, 30, 71, 4, 232, 91, 224, 94, 230, 207, 165, 227, 85, 166, 82, 25, 149, 95, 168, 100, 58, 104, 173, 157, 245, 254, 33, 187, 7, 174, 61, 216, 80, 64, 119, 245, 123, 231, 208, 248, 184, 224, 196, 3, 18, 37, 101, 88, 224, 209, 42, 122, 55, 251, 240, 253, 210, 191, 243, 109, 151, 228, 109, 79, 66, 182, 48, 169, 163, 109, 206, 52, 90, 137, 254, 111, 225, 58, 141, 118, 247, 50, 141, 98, 87, 123, 213, 242, 23, 177, 128, 100, 144, 167, 156, 96, 59, 0, 0, 241, 53, 94, 45, 2, 252, 145, 17, 35, 16, 10, 146, 94, 180, 207, 67, 23, 213, 31, 121, 169, 196, 16, 211, 189, 153, 199, 47, 150, 109, 17, 55, 228, 237, 117, 59, 153, 175, 130, 73, 241, 85, 41, 165, 225, 83, 223, 69, 213, 183, 118, 41, 239, 172, 31, 169, 222, 211, 181, 87, 183, 34, 34, 171, 97, 115, 180, 177, 249, 126, 56, 213, 205, 241, 250, 136, 43, 84, 211, 214, 33, 185, 5, 177, 30, 152, 135, 35, 232, 194, 34, 252, 93, 192, 233, 181, 42, 239, 113, 58, 67, 132, 197, 160, 179, 202, 51, 146, 240, 194, 201, 34, 174, 251, 155, 59, 219, 89, 74, 3, 164, 175, 88, 40, 191, 11, 149, 16, 35, 16, 147, 53, 127, 5, 158, 248, 45, 24, 127, 235, 73, 29, 244, 65, 131, 217, 157, 88, 115, 152, 217, 58, 209, 135, 36, 203, 20, 211, 123, 156, 114, 110, 71, 0, 38, 123, 34, 179, 135, 6, 50, 44, 165, 162, 209, 77, 10, 32, 75, 185, 134, 220, 195, 164, 212, 70, 209, 241, 188, 67, 168, 245, 198, 243, 79, 3, 246, 218, 43, 35, 249, 217, 181, 128, 165, 86, 101, 82, 241, 230, 250, 246, 170, 76, 245, 126, 91, 116, 92, 240, 42, 40, 42, 190, 71, 158, 155, 199, 209, 223, 138, 195, 87, 175, 145, 78, 83, 160, 206, 165, 188, 64, 22, 86, 219, 50, 230, 180, 132, 233, 111, 251, 101, 141, 228, 218, 101, 72, 187, 172, 59, 126, 115, 175, 239, 135, 188, 137, 8, 152, 199, 23, 125, 164, 0, 24, 252, 158, 102, 229, 9, 207, 37, 235, 167, 122, 48, 175, 153, 98, 235, 26, 96, 66, 217, 180, 136, 30, 78, 138, 47, 13, 5, 12, 82, 151, 224, 20, 106, 57, 104, 243, 175, 37, 231, 111, 74, 51, 176, 236, 236, 128, 12, 134, 196, 18, 9, 79, 2, 146, 235, 238, 72, 165, 164, 201, 190, 212, 53, 240, 131, 39, 178, 229, 59, 10, 171, 229, 245, 222, 197, 237, 233, 132, 161, 116, 39, 193, 207, 222, 211, 209, 232, 46, 202, 55, 196, 7, 202, 67, 105, 211, 84, 138, 118, 145, 194, 132, 107, 217, 116, 136, 147, 190, 39, 243, 81, 104, 162, 78, 123, 174, 73, 181, 220, 166, 40, 133, 189, 64, 202, 129, 83, 251, 4, 13, 122, 250, 172, 152, 175, 13, 214, 253, 175, 36, 160, 171, 239, 58, 38, 66, 216, 250, 227, 0, 159, 45, 72, 82, 204, 30, 4, 18, 76, 253, 11, 170, 26, 56, 212, 101, 84, 127, 179, 197, 170, 217, 14, 63, 0, 162, 223, 215, 171, 159, 30, 82, 221, 24, 43, 60, 204, 50, 52, 1, 187, 65, 83, 206, 122, 104, 44, 126, 224, 42, 192, 211, 48, 205, 112, 70, 181, 131, 41, 76, 2, 8, 213, 127, 48, 63, 115, 243, 125, 118, 83, 97, 167, 25, 253, 61, 233, 0, 219, 244, 231, 154, 69, 135, 161, 132, 138, 2, 62, 49, 3, 162, 123, 26, 179, 222, 247, 48, 44, 196, 183, 114, 74, 159, 224, 133, 140, 86, 111, 156, 39, 225, 40, 24, 16, 215, 143, 102, 131, 59, 5, 49, 185, 202, 157, 103, 90, 49, 72, 42, 251, 183, 162, 140, 15, 40, 213, 169, 230, 236, 19, 41, 229, 79, 163, 91, 196, 176, 130, 53, 197, 182, 133, 161, 231, 57, 23, 138, 163, 46, 85, 177, 86, 45, 40, 29, 89, 72, 241, 151, 28, 109, 117, 18, 178, 52, 237, 200, 152, 255, 85, 223, 150, 167, 1, 253, 62, 153, 146, 104, 48, 45, 131, 89, 239, 204, 89, 152, 91, 32, 26, 174, 97, 82, 88, 113, 8, 208, 8, 124, 120, 236, 0, 72, 43, 252, 125, 227, 232, 13, 17, 208, 82, 242, 223, 161, 63, 33, 49, 20, 105, 38, 210, 31, 170, 37, 185, 142, 233, 23, 213, 118, 161, 128, 60, 182, 91, 247, 234, 251, 90, 58, 72, 103, 19, 158, 194, 108, 146, 225, 243, 107, 190, 19, 93, 62, 144, 128, 226, 26, 49, 4, 175, 142, 131, 212, 182, 71, 120, 160, 178, 30, 115, 190, 0, 30, 21, 165, 118, 180, 236, 11, 68, 243, 92, 38, 218, 96, 180, 41, 27, 160, 237, 101, 181, 127, 127, 144, 209, 133, 179, 121, 85, 229, 171, 19, 176, 227, 85, 131, 179, 102, 78, 203, 168, 126, 189, 217, 188, 133, 81, 195, 177, 248, 232, 201, 206, 32, 68, 4, 139, 136, 92, 29, 44, 235, 134, 246, 94, 97, 140, 245, 59, 45, 198, 41, 181, 255, 124, 254, 57, 210, 198, 166, 141, 119, 85, 114, 246, 182, 69, 44, 209, 237, 255, 8, 49, 91, 60, 24, 195, 237, 102, 178, 154, 60, 4, 11, 35, 125, 38, 243, 168, 226, 231, 113, 173, 148, 212, 124, 162, 167, 213, 168, 22, 141, 124, 72, 5, 195, 160, 249, 3, 156, 239, 104, 10, 248, 52, 118, 3, 73, 165, 160, 35, 141, 67, 31, 185, 178, 212, 94, 1, 210, 62, 77, 102, 36, 8, 106, 39, 228, 132, 208, 187, 68, 62, 209, 116, 103, 83, 71, 160, 218, 189, 117, 222, 207, 95, 130, 174, 143, 188, 102, 199, 210, 134, 192, 138, 160, 46, 116, 55, 220, 109, 36, 9, 156, 148, 226, 72, 113, 16, 173, 156, 176, 209, 29, 185, 234, 59, 50, 248, 250, 88, 197, 23, 193, 218, 119, 113, 50, 165, 190, 123, 177, 41, 92, 53, 28, 147, 170, 12, 4, 93, 85, 119, 255, 17, 59, 90, 153, 68, 25, 152, 6, 52, 165, 175, 189, 100, 56, 73, 146, 50, 203, 206, 174, 209, 104, 156, 214, 126, 224, 4, 191, 147, 182, 52, 1, 189, 105, 250, 19, 43, 7, 154, 186, 70, 114, 115, 225, 250, 171, 157, 61, 166, 59, 183, 89, 147, 6, 166, 91, 127, 182, 243, 0, 95, 156, 187, 48, 157, 188, 211, 169, 85, 253, 60, 158, 9, 95, 245, 173, 20, 35, 11, 13, 49, 0, 8, 30, 234, 175, 89, 183, 153, 186, 171, 200, 107, 237, 14, 128, 142, 223, 69, 36, 237, 161, 60, 159, 7, 5, 221, 13, 232, 155, 78, 146, 213, 223, 14, 232, 253, 65, 210, 23, 26, 230, 123, 163, 228, 54, 222, 198, 191, 13, 10, 68, 12, 222, 17, 81, 202, 106, 62, 82, 98, 180, 118, 37, 61, 240, 214, 185, 142, 220, 132, 75, 187, 32, 36, 244, 121, 161, 180, 231, 216, 254, 120, 83, 212, 255, 88, 224, 63, 103, 77, 117, 144, 20, 46, 120, 115, 140, 147, 78, 228, 62, 222, 238, 172, 107, 18, 73, 3, 118, 251, 127, 246, 10, 88, 91, 63, 246, 43, 17, 144, 238, 67, 102, 120, 173, 89, 94, 209, 15, 201, 70, 185]) +cc ea20181bc161c5c2b5a2a9f4a684a8afc64b7c4e78242355f117f4bd2d387a3f # shrinks to seed = PassThrough(None, []) diff -Nru cargo-0.35.0/vendor/proptest/readme-antelogue.md cargo-0.37.0/vendor/proptest/readme-antelogue.md --- cargo-0.35.0/vendor/proptest/readme-antelogue.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/readme-antelogue.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ - -# Acknowledgements - -This crate wouldn't have come into existence had it not been for the [Rust port -of QuickCheck](https://github.com/burntsushi/quickcheck) and the -[`regex_generate`](https://github.com/CryptArchy/regex_generate) crate which -gave wonderful examples of what is possible. - -## Contribution - -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in the work by you, as defined in the Apache-2.0 license, shall -be dual licensed as above, without any additional terms or conditions. diff -Nru cargo-0.35.0/vendor/proptest/README.md cargo-0.37.0/vendor/proptest/README.md --- cargo-0.35.0/vendor/proptest/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -4,6 +4,8 @@ [![Build status](https://ci.appveyor.com/api/projects/status/ofe98xfthbx1m608/branch/master?svg=true)](https://ci.appveyor.com/project/AltSysrq/proptest/branch/master) [![](http://meritbadge.herokuapp.com/proptest)](https://crates.io/crates/proptest) +## Introduction + Proptest is a property testing framework (i.e., the QuickCheck family) inspired by the [Hypothesis](http://hypothesis.works/) framework for Python. It allows to test that certain properties of your code hold for @@ -12,24 +14,18 @@ and shrinking is defined on a per-value basis instead of per-type, which makes it more flexible and simplifies composition. -If you have dependencies which provide QuickCheck `Arbitrary` -implementations, see also the related -[`proptest-quickcheck-interop`](https://crates.io/crates/proptest-quickcheck-interop) -crates which enables reusing those implementations with proptest. - -## Status of this crate +### Status of this crate The majority of the functionality offered by proptest is in active use and is known to work well. The API is unlikely to see drastic breaking changes, but there may still be -minor breaking changes here and there, particularly when "impl Trait" -becomes stable and after the upcoming redesign of the `rand` crate. +minor breaking changes here and there, though this is becoming less common. -See the [changelog](https://github.com/AltSysrq/proptest/blob/master/CHANGELOG.md) +See the [changelog](https://github.com/AltSysrq/proptest/blob/master/proptest/CHANGELOG.md) for a full list of substantial historical changes, breaking and otherwise. -## Introduction +### What is property testing? _Property testing_ is a system of testing code by checking that certain properties of its output or behaviour are fulfilled for all inputs. These @@ -41,14 +37,13 @@ known edge cases, simple inputs, and inputs that were known in the past to reveal bugs, whereas property tests will search for more complicated inputs that cause problems. - ## Getting Started Let's say we want to make a function that parses dates of the form `YYYY-MM-DD`. We're not going to worry about _validating_ the date, any triple of integers is fine. So let's bang something out real quick. -```rust +```rust,no_run fn parse_date(s: &str) -> Option<(u32, u32, u32)> { if 10 != s.len() { return None; } if "-" != &s[4..5] || "-" != &s[7..8] { return None; } @@ -66,7 +61,7 @@ It compiles, that means it works, right? Maybe not, let's add some tests. -```rust +```rust,ignore #[test] fn test_parse_date() { assert_eq!(None, parse_date("2017-06-1")); @@ -85,13 +80,7 @@ ```toml [dev-dependencies] -proptest = "0.8.7" -``` - -and at the top of `main.rs` or `lib.rs`: - -```rust -#[macro_use] extern crate proptest; +proptest = "0.9.4" ``` Now we can add some property tests to our date parser. But how do we test @@ -101,11 +90,14 @@ simpler property to test: _The function should not crash._ Let's start there. -```rust +```rust,ignore +// Bring the macros and other important things into scope. +use proptest::prelude::*; + proptest! { #[test] fn doesnt_crash(s in "\\PC*") { - parse_date(s); + parse_date(&s); } } ``` @@ -140,7 +132,7 @@ test since it has exposed a bug not similar to what we've tested in the past. -```rust +```rust,ignore #[test] fn test_unicode_gibberish() { assert_eq!(None, parse_date("aAௗ0㌀0")); @@ -154,7 +146,7 @@ In the interest of making the code changes as small as possible, we'll just check that the string is ASCII and reject anything that isn't. -```rust +```rust,no_run fn parse_date(s: &str) -> Option<(u32, u32, u32)> { if 10 != s.len() { return None; } @@ -180,13 +172,13 @@ Another property we want from our code is that it parses every valid date. We can add another test to the `proptest!` section: -```rust +```rust,ignore proptest! { // snip... #[test] fn parses_all_valid_dates(s in "[0-9]{4}-[0-9]{2}-[0-9]{2}") { - parse_date(s).unwrap(); + parse_date(&s).unwrap(); } } ``` @@ -204,7 +196,7 @@ reimplementing the date parser in the test! Instead, we start from the expected output, generate the string, and check that it gets parsed back. -```rust +```rust,ignore proptest! { // snip... @@ -240,7 +232,7 @@ proptest did to arrive at this value. At the start of our test function, insert -```rust +```rust,ignore println!("y = {}, m = {}, d = {}", y, m, d); ``` @@ -292,10 +284,10 @@ $ git add proptest-regressions ``` -```rust +```rust,ignore #[test] fn test_october_first() { - assert_eq!(Some(0, 10, 1), parse_date("0000-10-01")); + assert_eq!(Some((0, 10, 1)), parse_date("0000-10-01")); } ``` @@ -307,7 +299,7 @@ hold for `9`. In this case, that "special something" is being two digits wide. In our code: -```rust +```rust,ignore let month = &s[6..7]; ``` @@ -318,10 +310,6 @@ configuration for things like the number of test cases to generate. See its [documentation](https://altsysrq.github.io/rustdoc/proptest/latest/proptest/macro.proptest.html) for more details. - -There is a more in-depth tutorial -[in the crate documentation](https://altsysrq.github.io/rustdoc/proptest/latest/proptest/#in-depth-tutorial). - ## Differences between QuickCheck and Proptest QuickCheck and Proptest are similar in many ways: both generate random @@ -332,28 +320,28 @@ based on type alone, whereas Proptest uses explicit `Strategy` objects. The QuickCheck approach has a lot of disadvantages in comparison: -- QuickCheck can only define one generator and shrinker per type. If you -need a custom generation strategy, you need to wrap it in a newtype and -implement traits on that by hand. In Proptest, you can define arbitrarily -many different strategies for the same type, and there are plenty built-in. - -- For the same reason, QuickCheck has a single "size" configuration that -tries to define the range of values generated. If you need an integer -between 0 and 100 and another between 0 and 1000, you probably need to do -another newtype. In Proptest, you can directly just express that you want a -`0..100` integer and a `0..1000` integer. +- QuickCheck can only define one generator and shrinker per type. If you need a + custom generation strategy, you need to wrap it in a newtype and implement + traits on that by hand. In Proptest, you can define arbitrarily many + different strategies for the same type, and there are plenty built-in. + +- For the same reason, QuickCheck has a single "size" configuration that tries + to define the range of values generated. If you need an integer between 0 and + 100 and another between 0 and 1000, you probably need to do another newtype. + In Proptest, you can directly just express that you want a `0..100` integer + and a `0..1000` integer. - Types in QuickCheck are not easily composable. Defining `Arbitrary` and -`Shrink` for a new struct which is simply produced by the composition of -its fields requires implementing both by hand, including a bidirectional -mapping between the struct and a tuple of its fields. In Proptest, you can -make a tuple of the desired components and then `prop_map` it into the -desired form. Shrinking happens automatically in terms of the input types. - -- Because constraints on values cannot be expressed in QuickCheck, -generation and shrinking may lead to a lot of input rejections. Strategies -in Proptest are aware of simple constraints and do not generate or shrink -to values that violate them. + `Shrink` for a new struct which is simply produced by the composition of its + fields requires implementing both by hand, including a bidirectional mapping + between the struct and a tuple of its fields. In Proptest, you can make a + tuple of the desired components and then `prop_map` it into the desired form. + Shrinking happens automatically in terms of the input types. + +- Because constraints on values cannot be expressed in QuickCheck, generation + and shrinking may lead to a lot of input rejections. Strategies in Proptest + are aware of simple constraints and do not generate or shrink to values that + violate them. The author of Hypothesis also has an [article on this topic](http://hypothesis.works/articles/integrated-shrinking/). @@ -362,11 +350,10 @@ Proptest does differently: - Generating complex values in Proptest can be up to an order of magnitude -slower than in QuickCheck. This is because QuickCheck performs stateless -shrinking based on the output value, whereas Proptest must hold on to all -the intermediate states and relationships in order for its richer shrinking -model to work. - + slower than in QuickCheck. This is because QuickCheck performs stateless + shrinking based on the output value, whereas Proptest must hold on to all the + intermediate states and relationships in order for its richer shrinking model + to work. ## Limitations of Property Testing Given infinite time, property testing will eventually explore the whole @@ -376,7 +363,6 @@ large space. For example, the following test will virtually always pass: ```rust -#[macro_use] extern crate proptest; use proptest::prelude::*; proptest! { @@ -397,122 +383,6 @@ great to fuzz a C parser, but is highly unlikely to produce anything that makes it to a code generator. -## Failure Persistence - -By default, when Proptest finds a failing test case, it _persists_ that -failing case in a file named after the source containing the failing test, -but in a separate directory tree rooted at `proptest-regressions`† . Later -runs of tests will replay those test cases before generating novel cases. -This ensures that the test will not fail on one run and then spuriously -pass on the next, and also exposes similar tests to the same -known-problematic input. - -(† If you do not have an obvious source directory, you may instead find -files next to the source files, with a different extension.) - -It is recommended to check these files in to your source control so that -other test runners (e.g., collaborators or a CI system) also replay these -cases. - -Note that, by default, all tests in the same crate will share that one -persistence file. If you have a very large number of tests, it may be -desirable to separate them into smaller groups so the number of extra test -cases that get run is reduced. This can be done by adjusting the -`failure_persistence` flag on `Config`. - -There are two ways this persistence could theoretically be done. - -The immediately obvious option is to persist a representation of the value -itself, for example by using Serde. While this has some advantages, -particularly being resistant to changes like tweaking the input strategy, -it also has a lot of problems. Most importantly, there is no way to -determine whether any given value is actually within the domain of the -strategy that produces it. Thus, some (likely extremely fragile) mechanism -to ensure that the strategy that produced the value exactly matches the one -in use in a test case would be required. - -The other option is to store the _seed_ that was used to produce the -failing test case. This approach requires no support from the strategy or -the produced value. If the strategy in use differs from the one used to -produce failing case that was persisted, the seed may or may not produce -the problematic value, but nonetheless produces a valid value. Due to these -advantages, this is the approach Proptest uses. - -## Forking and Timeouts - -By default, proptest tests are run in-process and are allowed to run for -however long it takes them. This is resource-efficient and produces the -nicest test output, and for many use cases is sufficient. However, problems -like overflowing the stack, aborting the process, or getting stuck in an -infinite will simply break the entire test process and prevent proptest -from determining a minimal reproducible case. - -As of version 0.7.1, proptest has optional "fork" and "timeout" features -(both enabled by default), which make it possible to run your test cases in -a subprocess and limit how long they may run. This is generally slower, -may make using a debugger more difficult, and makes test output harder to -interpret, but allows proptest to find and minimise test cases for these -situations as well. - -To enable these features, simply set the `fork` and/or `timeout` fields on -the `Config`. (Setting `timeout` implies `fork`.) - -Here is a simple example of using both features: - -```rust -#[macro_use] extern crate proptest; -use proptest::prelude::*; - -// The worst possible way to calculate Fibonacci numbers -fn fib(n: u64) -> u64 { - if n <= 1 { - n - } else { - fib(n - 1) + fib(n - 2) - } -} - -proptest! { - #![proptest_config(ProptestConfig { - // Setting both fork and timeout is redundant since timeout implies - // fork, but both are shown for clarity. - fork: true, - timeout: 1000, - .. ProptestConfig::default() - })] - - #[test] - fn test_fib(n: u64) { - // For large n, this will variously run for an extremely long time, - // overflow the stack, or panic due to integer overflow. - assert!(fib(n) >= n); - } -} -``` - -The exact value of the test failure depends heavily on the performance of -the host system, the rust version, and compiler flags, but on the system -where it was originally tested, it found that the maximum value that -`fib()` could handle was 39, despite having dozens of processes dump core -due to stack overflow or time out along the way. - -If you just want to run tests in subprocesses or with a timeout every now -and then, you can do that by setting the `PROPTEST_FORK` or -`PROPTEST_TIMEOUT` environment variables to alter the default -configuration. For example, on Unix, - -```sh -# Run all the proptest tests in subprocesses with no timeout. -# Individual tests can still opt out by setting `fork: false` in their -# own configuration. -PROPTEST_FORK=true cargo test -# Run all the proptest tests in subprocesses with a 1 second timeout. -# Tests can still opt out or use a different timeout by setting `timeout: 0` -# or another timeout in their own configuration. -PROPTEST_TIMEOUT=1000 cargo test -``` - - # Acknowledgements This crate wouldn't have come into existence had it not been for the [Rust port diff -Nru cargo-0.35.0/vendor/proptest/readme-prologue.md cargo-0.37.0/vendor/proptest/readme-prologue.md --- cargo-0.35.0/vendor/proptest/readme-prologue.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/readme-prologue.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -# Proptest - -[![Build Status](https://travis-ci.org/AltSysrq/proptest.svg?branch=master)](https://travis-ci.org/AltSysrq/proptest) -[![Build status](https://ci.appveyor.com/api/projects/status/ofe98xfthbx1m608/branch/master?svg=true)](https://ci.appveyor.com/project/AltSysrq/proptest/branch/master) -[![](http://meritbadge.herokuapp.com/proptest)](https://crates.io/crates/proptest) - diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/alloc.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/alloc.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/alloc.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/alloc.rs 2019-07-17 05:42:23.000000000 +0000 @@ -13,19 +13,19 @@ use core::ops::Range; use core::usize; -multiplex_alloc!(alloc::alloc, ::std::alloc); +multiplex_alloc!(::alloc::alloc, ::std::alloc); -use strategy::*; -use strategy::statics::static_map; -use arbitrary::*; +use crate::arbitrary::*; +use crate::strategy::statics::static_map; +use crate::strategy::*; -arbitrary!(alloc::CannotReallocInPlace; alloc::CannotReallocInPlace); -arbitrary!(alloc::Global; alloc::Global); +arbitrary!(self::alloc::CannotReallocInPlace; self::alloc::CannotReallocInPlace); +arbitrary!(self::alloc::Global; self::alloc::Global); // Not Debug. //lazy_just!(System, || System); -arbitrary!(alloc::Layout, SFnPtrMap<(Range, StrategyFor), Self>; +arbitrary!(self::alloc::Layout, SFnPtrMap<(Range, StrategyFor), Self>; // 1. align must be a power of two and <= (1 << 31): // 2. "when rounded up to the nearest multiple of align, must not overflow". static_map((0u8..32u8, any::()), |(align_power, size)| { @@ -33,24 +33,26 @@ let max_size = 0usize.wrapping_sub(align); // Not quite a uniform distribution due to clamping, // but probably good enough - alloc::Layout::from_size_align(cmp::min(max_size, size), align).unwrap() + self::alloc::Layout::from_size_align(cmp::min(max_size, size), align).unwrap() }) ); -arbitrary!(alloc::AllocErr, Just; Just(alloc::AllocErr)); +arbitrary!(self::alloc::AllocErr, Just; Just(self::alloc::AllocErr)); /* 2018-07-28 CollectionAllocErr is not currently available outside of using * the `alloc` crate, which would require a different nightly feature. For now, * disable. -arbitrary!(alloc::collections::CollectionAllocErr, TupleUnion<(W>, W>)>; +arbitrary!(alloc::collections::CollectionAllocErr, LazyTupleUnion<(WA>, WA>)>; prop_oneof![Just(alloc::collections::CollectionAllocErr::AllocErr), Just(alloc::collections::CollectionAllocErr::CapacityOverflow)]); */ #[cfg(test)] mod test { + multiplex_alloc!(::alloc::alloc, ::std::alloc); + no_panic_test!( - layout => alloc::Layout, - alloc_err => alloc::AllocErr + layout => self::alloc::Layout, + alloc_err => self::alloc::AllocErr //collection_alloc_err => alloc::collections::CollectionAllocErr ); } diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/borrow.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/borrow.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/borrow.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/borrow.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,12 +9,12 @@ //! Arbitrary implementations for std::borrow. +use crate::std_facade::fmt; +use crate::std_facade::{Cow, ToOwned}; use core::borrow::Borrow; -use std_facade::{ToOwned, Cow}; -use std_facade::fmt; -use strategy::statics::static_map; -use arbitrary::{any_with, SMapped, Arbitrary}; +use crate::arbitrary::{any_with, Arbitrary, SMapped}; +use crate::strategy::statics::static_map; arbitrary!( [A: Arbitrary + Borrow, B: ToOwned + fmt::Debug] diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/boxed.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/boxed.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/boxed.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/boxed.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,7 +9,7 @@ //! Arbitrary implementations for `std::boxed`. -use std_facade::Box; +use crate::std_facade::Box; wrap_from!(Box); diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/char.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/char.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/char.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/char.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,12 +9,12 @@ //! Arbitrary implementations for `std::char`. +use crate::std_facade::Vec; use core::char::*; use core::iter::once; use core::ops::Range; -use std_facade::Vec; -use collection::vec; +use crate::collection::vec; multiplex_alloc! { core::char::DecodeUtf16, std::char::DecodeUtf16, @@ -24,9 +24,9 @@ const VEC_MAX: usize = ::core::u16::MAX as usize; -use strategy::*; -use strategy::statics::static_map; -use arbitrary::*; +use crate::arbitrary::*; +use crate::strategy::statics::static_map; +use crate::strategy::*; macro_rules! impl_wrap_char { ($type: ty, $mapper: expr) => { @@ -43,6 +43,7 @@ #[cfg(feature = "unstable")] impl_wrap_char!(ToUppercase, char::to_uppercase); +#[cfg(feature = "break-dead-code")] arbitrary!(DecodeUtf16< as IntoIterator>::IntoIter>, SMapped, Self>; static_map(vec(any::(), ..VEC_MAX), decode_utf16) @@ -71,10 +72,14 @@ escape_default => EscapeDefault, escape_unicode => EscapeUnicode, parse_char_error => ParseCharError, - decode_utf16 => DecodeUtf16< as IntoIterator>::IntoIter>, decode_utf16_error => DecodeUtf16Error ); + #[cfg(feature = "break-dead-code")] + no_panic_test!( + decode_utf16 => DecodeUtf16< as IntoIterator>::IntoIter> + ); + #[cfg(feature = "unstable")] no_panic_test!( to_lowercase => ToLowercase, diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/collections.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/collections.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/collections.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/collections.rs 2019-07-17 05:42:23.000000000 +0000 @@ -15,20 +15,20 @@ // Imports: //============================================================================== -use core::ops::{RangeInclusive, Bound}; -use core::hash::Hash; -use std_facade::{ - fmt, Box, Rc, Arc, Vec, vec, BTreeMap, BTreeSet, btree_map, btree_set, - BinaryHeap, binary_heap, VecDeque, vec_deque, LinkedList, linked_list, +use crate::std_facade::{ + binary_heap, btree_map, btree_set, fmt, linked_list, vec, vec_deque, Arc, + BTreeMap, BTreeSet, BinaryHeap, Box, LinkedList, Rc, Vec, VecDeque, }; +use core::hash::Hash; +use core::ops::{Bound, RangeInclusive}; #[cfg(feature = "std")] -use std_facade::{hash_map, HashMap, hash_set, HashSet}; +use crate::std_facade::{hash_map, hash_set, HashMap, HashSet}; -use strategy::*; -use strategy::statics::static_map; -use collection::*; -use arbitrary::*; +use crate::arbitrary::*; +use crate::collection::*; +use crate::strategy::statics::static_map; +use crate::strategy::*; //============================================================================== // Macros: @@ -146,11 +146,15 @@ #[cfg(feature = "std")] impl functor::ArbitraryF2 -for HashMap { + for HashMap +{ type Parameters = SizeRange; - fn lift2_with(fst: AS, snd: BS, args: Self::Parameters) - -> BoxedStrategy + fn lift2_with( + fst: AS, + snd: BS, + args: Self::Parameters, + ) -> BoxedStrategy where AS: Strategy + 'static, BS: Strategy + 'static, @@ -161,12 +165,15 @@ #[cfg(feature = "std")] impl - functor::ArbitraryF2 -for hash_map::IntoIter { + functor::ArbitraryF2 for hash_map::IntoIter +{ type Parameters = SizeRange; - fn lift2_with(fst: AS, snd: BS, args: Self::Parameters) - -> BoxedStrategy + fn lift2_with( + fst: AS, + snd: BS, + args: Self::Parameters, + ) -> BoxedStrategy where AS: Strategy + 'static, BS: Strategy + 'static, @@ -196,10 +203,14 @@ ); impl functor::ArbitraryF2 -for BTreeMap { + for BTreeMap +{ type Parameters = SizeRange; - fn lift2_with(fst: AS, snd: BS, args: Self::Parameters) - -> BoxedStrategy + fn lift2_with( + fst: AS, + snd: BS, + args: Self::Parameters, + ) -> BoxedStrategy where AS: Strategy + 'static, BS: Strategy + 'static, @@ -214,12 +225,15 @@ args => static_map(any_with::>(args), BTreeMap::into_iter)); impl - functor::ArbitraryF2 -for btree_map::IntoIter { + functor::ArbitraryF2 for btree_map::IntoIter +{ type Parameters = SizeRange; - fn lift2_with(fst: AS, snd: BS, args: Self::Parameters) - -> BoxedStrategy + fn lift2_with( + fst: AS, + snd: BS, + args: Self::Parameters, + ) -> BoxedStrategy where AS: Strategy + 'static, BS: Strategy + 'static, @@ -233,10 +247,10 @@ //============================================================================== arbitrary!([A: Arbitrary] Bound, - TupleUnion<( - W, Self>>, - W, Self>>, - W> + LazyTupleUnion<( + WA, Self>>, + WA, Self>>, + WA> )>, A::Parameters; args => { diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/hash.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/hash.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/hash.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/hash.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,9 +9,9 @@ //! Arbitrary implementations for `std::hash`. -use core::hash::{BuildHasherDefault, Hasher}; #[cfg(feature = "std")] -use std_facade::hash_map::{DefaultHasher, RandomState}; +use crate::std_facade::hash_map::{DefaultHasher, RandomState}; +use core::hash::{BuildHasherDefault, Hasher}; // NOTE: don't impl for std::hash::SipHasher.. since deprecated! diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/ops.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/ops.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/ops.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/ops.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,12 +9,12 @@ //! Arbitrary implementations for `std::ops`. +use crate::std_facade::Arc; use core::ops::*; -use std_facade::Arc; -use strategy::*; -use strategy::statics::static_map; -use arbitrary::*; +use crate::arbitrary::*; +use crate::strategy::statics::static_map; +use crate::strategy::*; arbitrary!(RangeFull; ..); wrap_ctor!(RangeFrom, |a| a..); @@ -49,7 +49,7 @@ #[cfg(feature = "unstable")] arbitrary!( [Y: Arbitrary, R: Arbitrary] GeneratorState, - TupleUnion<(W>, W>)>, + LazyTupleUnion<(WA>, WA>)>, product_type![Y::Parameters, R::Parameters]; args => { let product_unpack![y, r] = args; @@ -65,12 +65,15 @@ #[cfg(feature = "unstable")] impl - functor::ArbitraryF2 -for GeneratorState { + functor::ArbitraryF2 for GeneratorState +{ type Parameters = (); - fn lift2_with(fst: AS, snd: BS, _args: Self::Parameters) - -> BoxedStrategy + fn lift2_with( + fst: AS, + snd: BS, + _args: Self::Parameters, + ) -> BoxedStrategy where AS: Strategy + 'static, BS: Strategy + 'static, @@ -78,7 +81,8 @@ prop_oneof![ fst.prop_map(GeneratorState::Yielded), snd.prop_map(GeneratorState::Complete) - ].boxed() + ] + .boxed() } } diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/rc.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/rc.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/rc.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/rc.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,7 +9,7 @@ //! Arbitrary implementations for `std::rc`. -use std_facade::Rc; +use crate::std_facade::Rc; // Weak would always give None on upgrade since there's no owned Rc. diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/str.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/str.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/str.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/str.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,25 +9,25 @@ //! Arbitrary implementations for `std::str`. +use crate::std_facade::Vec; use core::iter::repeat; -use core::str::{ParseBoolError, Utf8Error, from_utf8}; -use std_facade::Vec; +use core::str::{from_utf8, ParseBoolError, Utf8Error}; -use strategy::*; -use strategy::statics::static_map; -use arbitrary::*; +use crate::arbitrary::*; +use crate::strategy::statics::static_map; +use crate::strategy::*; arbitrary!(ParseBoolError; "".parse::().unwrap_err()); -type ELSeq = W>; -type ELSeqs = TupleUnion<(ELSeq, ELSeq, ELSeq, ELSeq)>; +type ELSeq = WA>; +type ELSeqs = LazyTupleUnion<(ELSeq, ELSeq, ELSeq, ELSeq)>; fn gen_el_seqs() -> ELSeqs { prop_oneof![ - Just(&[0xC2]), // None - Just(&[0x80]), // Some(1) - Just(&[0xE0, 0xA0, 0x00]), // Some(2) - Just(&[0xF0, 0x90, 0x80, 0x00]) // Some(3) + Just(&[0xC2]), // None + Just(&[0x80]), // Some(1) + Just(&[0xE0, 0xA0, 0x00]), // Some(2) + Just(&[0xF0, 0x90, 0x80, 0x00]) // Some(3) ] } diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/sync.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/sync.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_alloc/sync.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_alloc/sync.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,12 +9,12 @@ //! Arbitrary implementations for `std::sync`. +use crate::std_facade::Arc; use core::sync::atomic::*; -use std_facade::Arc; -use strategy::*; -use strategy::statics::static_map; -use arbitrary::*; +use crate::arbitrary::*; +use crate::strategy::statics::static_map; +use crate::strategy::*; wrap_from!(Arc); @@ -30,12 +30,15 @@ atomic!(AtomicBool, bool; AtomicIsize, isize; AtomicUsize, usize); #[cfg(feature = "unstable")] -atomic!(AtomicI8, i8; AtomicI16, i16; AtomicI32, i32; AtomicI64, i64; - AtomicU8, u8; AtomicU16, u16; AtomicU32, u32; AtomicU64, u64); +atomic!(AtomicI8, i8; AtomicI16, i16; AtomicI32, i32; + AtomicU8, u8; AtomicU16, u16; AtomicU32, u32); + +#[cfg(all(feature = "unstable", feature = "atomic64bit"))] +atomic!(AtomicI64, i64; AtomicU64, u64); arbitrary!(Ordering, - TupleUnion<(W>, W>, W>, - W>, W>)>; + LazyTupleUnion<(WA>, WA>, WA>, + WA>, WA>)>; prop_oneof![ Just(Ordering::Relaxed), Just(Ordering::Release), @@ -60,10 +63,14 @@ atomic_i8 => AtomicI8, atomic_i16 => AtomicI16, atomic_i32 => AtomicI32, - atomic_i64 => AtomicI64, atomic_u8 => AtomicU8, atomic_u16 => AtomicU16, - atomic_u32 => AtomicU32, + atomic_u32 => AtomicU32 + ); + + #[cfg(all(feature = "unstable", feature = "atomic64bit"))] + no_panic_test!( + atomic_i64 => AtomicI64, atomic_u64 => AtomicU64 ); } diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/arrays.rs cargo-0.37.0/vendor/proptest/src/arbitrary/arrays.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/arrays.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/arrays.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,8 +9,8 @@ //! Arbitrary implementations for arrays. -use arbitrary::{Arbitrary, any_with}; -use array::UniformArrayStrategy; +use crate::arbitrary::{any_with, Arbitrary}; +use crate::array::UniformArrayStrategy; macro_rules! array { ($($n: expr),*) => { $( @@ -25,8 +25,10 @@ )* }; } -array!(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); +array!( + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 +); #[cfg(test)] mod test { diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_core/ascii.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_core/ascii.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_core/ascii.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_core/ascii.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,10 +9,10 @@ //! Arbitrary implementations for `std::ascii`. -use core::ascii::{EscapeDefault, escape_default}; +use core::ascii::{escape_default, EscapeDefault}; -use strategy::statics::static_map; -use arbitrary::*; +use crate::arbitrary::*; +use crate::strategy::statics::static_map; arbitrary!(EscapeDefault, SMapped; static_map(any::(), escape_default)); diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_core/cell.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_core/cell.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_core/cell.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_core/cell.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,7 +9,7 @@ //! Arbitrary implementations for `std::cell`. -use core::cell::{Cell, RefCell, UnsafeCell, BorrowError, BorrowMutError}; +use core::cell::{BorrowError, BorrowMutError, Cell, RefCell, UnsafeCell}; wrap_from!([Copy] Cell); wrap_from!(RefCell); diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_core/cmp.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_core/cmp.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_core/cmp.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_core/cmp.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,14 +9,14 @@ //! Arbitrary implementations for `std::cmp`. -use core::cmp::{Reverse, Ordering}; +use core::cmp::{Ordering, Reverse}; -use strategy::{Just, TupleUnion, W}; +use crate::strategy::{Just, LazyTupleUnion, WA}; wrap_ctor!(Reverse, Reverse); -type WJO = W>; -arbitrary!(Ordering, TupleUnion<(WJO, WJO, WJO)>; +type WAJO = WA>; +arbitrary!(Ordering, LazyTupleUnion<(WAJO, WAJO, WAJO)>; prop_oneof![ Just(Ordering::Equal), Just(Ordering::Less), diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_core/iter.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_core/iter.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_core/iter.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_core/iter.rs 2019-07-17 05:42:23.000000000 +0000 @@ -10,12 +10,12 @@ //! Arbitrary implementations for `std::iter`. use core::fmt; -use core::iter::*; use core::iter::Fuse; +use core::iter::*; -use strategy::*; -use strategy::statics::static_map; -use arbitrary::*; +use crate::arbitrary::*; +use crate::strategy::statics::static_map; +use crate::strategy::*; // TODO: Filter, FilterMap, FlatMap, Map, Inspect, Scan, SkipWhile // Might be possible with CoArbitrary @@ -32,9 +32,12 @@ Cloned, SMapped, A::Parameters; args => static_map(any_with::(args), Iterator::cloned)); -impl<'a, T: 'static + Clone, A: fmt::Debug + 'static + Iterator> - functor::ArbitraryF1 -for Cloned { +impl< + 'a, + T: 'static + Clone, + A: fmt::Debug + 'static + Iterator, + > functor::ArbitraryF1 for Cloned +{ type Parameters = (); fn lift1_with(base: S, _args: Self::Parameters) -> BoxedStrategy @@ -63,12 +66,15 @@ ); impl - functor::ArbitraryF2 -for Zip { + functor::ArbitraryF2 for Zip +{ type Parameters = (); - fn lift2_with(fst: AS, snd: BS, _args: Self::Parameters) - -> BoxedStrategy + fn lift2_with( + fst: AS, + snd: BS, + _args: Self::Parameters, + ) -> BoxedStrategy where AS: Strategy + 'static, BS: Strategy + 'static, @@ -95,13 +101,19 @@ (any_with::(args), base).prop_map(|(b, a)| b.chain(a)).boxed() ); -impl, B: fmt::Debug + Iterator> - functor::ArbitraryF2 -for Chain { +impl< + T, + A: fmt::Debug + Iterator, + B: fmt::Debug + Iterator, + > functor::ArbitraryF2 for Chain +{ type Parameters = (); - fn lift2_with(fst: AS, snd: BS, _args: Self::Parameters) - -> BoxedStrategy + fn lift2_with( + fst: AS, + snd: BS, + _args: Self::Parameters, + ) -> BoxedStrategy where AS: Strategy + 'static, BS: Strategy + 'static, diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_core/mem.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_core/mem.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_core/mem.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_core/mem.rs 2019-07-17 05:42:23.000000000 +0000 @@ -11,8 +11,8 @@ use core::mem::*; -use strategy::statics::static_map; -use arbitrary::*; +use crate::arbitrary::*; +use crate::strategy::statics::static_map; arbitrary!([A: Arbitrary] Discriminant, SMapped, A::Parameters; diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_core/num.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_core/num.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_core/num.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_core/num.rs 2019-07-17 05:42:23.000000000 +0000 @@ -11,7 +11,7 @@ use core::num::*; -use strategy::*; +use crate::strategy::*; arbitrary!(ParseFloatError; "".parse::().unwrap_err()); arbitrary!(ParseIntError; "".parse::().unwrap_err()); @@ -25,8 +25,8 @@ wrap_ctor!(Wrapping, Wrapping); arbitrary!(FpCategory, - TupleUnion<(W>, W>, W>, - W>, W>)>; + LazyTupleUnion<(WA>, WA>, WA>, + WA>, WA>)>; { use core::num::FpCategory::*; prop_oneof![ diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_core/option.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_core/option.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_core/option.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_core/option.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,14 +9,14 @@ //! Arbitrary implementations for `std::option`. -use core::option as opt; +use crate::std_facade::string; use core::ops::RangeInclusive; -use std_facade::string; +use core::option as opt; -use option::{weighted, OptionStrategy, Probability}; -use strategy::*; -use strategy::statics::static_map; -use arbitrary::*; +use crate::arbitrary::*; +use crate::option::{weighted, OptionStrategy, Probability}; +use crate::strategy::statics::static_map; +use crate::strategy::*; arbitrary!(Probability, MapInto, Self>; (0.0..=1.0).prop_map_into() diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_core/result.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_core/result.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_core/result.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_core/result.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,14 +9,14 @@ //! Arbitrary implementations for `std::result`. +use crate::std_facade::string; use core::fmt; use core::result::IntoIter; -use std_facade::string; -use strategy::*; -use strategy::statics::static_map; -use result::*; -use arbitrary::*; +use crate::arbitrary::*; +use crate::result::*; +use crate::strategy::statics::static_map; +use crate::strategy::*; // These are Result with uninhabited type in some variant: arbitrary!([A: Arbitrary] Result, @@ -57,7 +57,7 @@ impl functor::ArbitraryF1 for Result where - E::Strategy: 'static + E::Strategy: 'static, { type Parameters = product_type![Probability, E::Parameters]; @@ -71,12 +71,14 @@ } } -impl functor::ArbitraryF2 -for Result { +impl functor::ArbitraryF2 for Result { type Parameters = Probability; - fn lift2_with(fst: AS, snd: BS, args: Self::Parameters) - -> BoxedStrategy + fn lift2_with( + fst: AS, + snd: BS, + args: Self::Parameters, + ) -> BoxedStrategy where AS: Strategy + 'static, BS: Strategy + 'static, diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/functor.rs cargo-0.37.0/vendor/proptest/src/arbitrary/functor.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/functor.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/functor.rs 2019-07-17 05:42:23.000000000 +0000 @@ -24,9 +24,9 @@ //! For these reasons, the traits here are deliberatly //! not exported in a convenient way. -use std_facade::fmt; +use crate::std_facade::fmt; -use strategy::{Strategy, BoxedStrategy}; +use crate::strategy::{BoxedStrategy, Strategy}; /// `ArbitraryF1` lets you lift a [`Strategy`] to unary /// type constructors such as `Box`, `Vec`, and `Option`. @@ -92,7 +92,9 @@ /// [`X::lift1_with(base, Default::default())`]: /// trait.ArbitraryF1.html#tymethod.lift1_with fn lift1(base: AS) -> BoxedStrategy - where AS: Strategy + 'static { + where + AS: Strategy + 'static, + { Self::lift1_with(base, Self::Parameters::default()) } @@ -111,7 +113,8 @@ /// [`default()`]: /// https://doc.rust-lang.org/nightly/std/default/trait.Default.html fn lift1_with(base: AS, args: Self::Parameters) -> BoxedStrategy - where AS: Strategy + 'static; + where + AS: Strategy + 'static; } /// `ArbitraryF2` lets you lift [`Strategy`] to binary @@ -124,7 +127,9 @@ /// https://hackage.haskell.org/package/QuickCheck-2.10.1/docs/Test-QuickCheck-Arbitrary.html#t:Arbitrary2 /// /// [`Strategy`]: ../proptest/strategy/trait.Strategy.html -pub trait ArbitraryF2: fmt::Debug + Sized { +pub trait ArbitraryF2: + fmt::Debug + Sized +{ /// The type of parameters that [`lift2_with`] accepts for /// configuration of the lifted and generated [`Strategy`]. Parameters /// must implement [`Default`]. @@ -174,8 +179,11 @@ /// /// [`default()`]: /// https://doc.rust-lang.org/nightly/std/default/trait.Default.html - fn lift2_with(fst: AS, snd: BS, args: Self::Parameters) - -> BoxedStrategy + fn lift2_with( + fst: AS, + snd: BS, + args: Self::Parameters, + ) -> BoxedStrategy where AS: Strategy + 'static, BS: Strategy + 'static; diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/mod.rs cargo-0.37.0/vendor/proptest/src/arbitrary/mod.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,13 +7,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! Defines the [`Arbitrary`] trait and related free functions -//! and type aliases. See the trait for more information. +//! Defines the `Arbitrary` trait and related free functions +//! and type aliases. +//! +//! See the [`Arbitrary`] trait for more information. //! //! [`Arbitrary`]: trait.Arbitrary.html -use strategy::{Map, Strategy}; -use strategy::statics; +use crate::strategy::statics; +use crate::strategy::{Map, Strategy}; //============================================================================== // Trait and impls @@ -21,14 +23,16 @@ mod traits; -#[macro_use] pub mod functor; +#[macro_use] +pub mod functor; -#[macro_use] mod macros; +#[macro_use] +mod macros; -mod primitives; mod arrays; -mod tuples; +mod primitives; mod sample; +mod tuples; mod _core; @@ -44,7 +48,8 @@ // SMapped + Mapped aliases to make documentation clearer. //============================================================================== -pub(crate) type SFnPtrMap = statics::Map::Value) -> O>; +pub(crate) type SFnPtrMap = + statics::Map::Value) -> O>; /// A static map from a strategy of `I` to `O`. /// diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/primitives.rs cargo-0.37.0/vendor/proptest/src/arbitrary/primitives.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/primitives.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/primitives.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,16 +9,18 @@ //! Arbitrary implementations for primitive types. -use bool; -use char; -use num::{isize, usize, f32, f64, i16, i32, i64, i8, u16, u32, u64, u8, - u128, i128}; +use crate::bool; +use crate::char; +use crate::num::{ + f32, f64, i16, i32, i64, i8, isize, u16, u32, u64, u8, usize, +}; +#[cfg(not(target_arch = "wasm32"))] +use crate::num::{i128, u128}; -arbitrary!( - bool, - i8, i16, i32, i64, i128, isize, - u8, u16, u32, u64, u128, usize -); +arbitrary!(bool, i8, i16, i32, i64, isize, u8, u16, u32, u64, usize); + +#[cfg(not(target_arch = "wasm32"))] +arbitrary!(i128, u128); // Note that for floating point types we limit the space since a lot of code // isn't prepared for (and is not intended to be) things like NaN and infinity. diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/sample.rs cargo-0.37.0/vendor/proptest/src/arbitrary/sample.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/sample.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/sample.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,8 +7,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use sample::{Index, IndexStrategy, Selector, SelectorStrategy}; -use arbitrary::Arbitrary; +use crate::arbitrary::Arbitrary; +use crate::sample::{Index, IndexStrategy, Selector, SelectorStrategy}; impl Arbitrary for Index { type Parameters = (); diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_std/env.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_std/env.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_std/env.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_std/env.rs 2019-07-17 05:42:23.000000000 +0000 @@ -10,12 +10,12 @@ //! Arbitrary implementations for `std::env`. use std::env::*; -use std::iter::once; use std::ffi::OsString; +use std::iter::once; -use strategy::*; -use strategy::statics::static_map; -use arbitrary::*; +use crate::arbitrary::*; +use crate::strategy::statics::static_map; +use crate::strategy::*; // FIXME: SplitPaths when lifetimes in strategies are possible. @@ -68,45 +68,52 @@ buf[p] = (buf[p] & !force_bits_mask) | force_bits_value; } -/// Generates the set of `WTF-16 \ UTF-16` and makes -/// an `OsString` that is not a valid String from it. -#[cfg(target_os = "windows")] -fn osstring_invalid_string() -> impl Strategy { - use std::os::windows::ffi::OsStringExt; - let size = 1..::std::u16::MAX as usize; - let vec_gen = ::collection::vec(..::std::u16::MAX, size.clone()); - (size, vec_gen).prop_map(|(p, mut sbuf)| { - // Not quite a uniform distribution due to clamping, - // but probably good enough - let p = ::std::cmp::min(p, sbuf.len() - 1); - make_utf16_invalid(&mut sbuf, p); - OsString::from_wide(sbuf.as_slice()).into_string().unwrap_err() - }) -} +#[cfg(not(target_arch = "wasm32"))] +mod var_error { + use super::*; -#[cfg(not(target_os = "windows"))] -fn osstring_invalid_string() -> impl Strategy { - use std::os::unix::ffi::OsStringExt; - use arbitrary::_std::string::not_utf8_bytes; - static_map(not_utf8_bytes(true), OsString::from_vec) + /// Generates the set of `WTF-16 \ UTF-16` and makes + /// an `OsString` that is not a valid String from it. + #[cfg(target_os = "windows")] + fn osstring_invalid_string() -> impl Strategy { + use std::os::windows::ffi::OsStringExt; + let size = 1..::std::u16::MAX as usize; + let vec_gen = crate::collection::vec(..::std::u16::MAX, size.clone()); + (size, vec_gen).prop_map(|(p, mut sbuf)| { + // Not quite a uniform distribution due to clamping, + // but probably good enough + let p = ::std::cmp::min(p, sbuf.len() - 1); + make_utf16_invalid(&mut sbuf, p); + OsString::from_wide(sbuf.as_slice()) + .into_string() + .unwrap_err() + }) + } + + #[cfg(not(target_os = "windows"))] + fn osstring_invalid_string() -> impl Strategy { + use crate::arbitrary::_std::string::not_utf8_bytes; + use std::os::unix::ffi::OsStringExt; + static_map(not_utf8_bytes(true), OsString::from_vec) + } + + arbitrary!(VarError, + LazyTupleUnion<( + WA>, + WA, Self>> + )>; + prop_oneof![ + Just(VarError::NotPresent), + static_map(osstring_invalid_string().boxed(), VarError::NotUnicode) + ] + ); } -arbitrary!(VarError, - TupleUnion<( - W>, - W, Self>> - )>; - prop_oneof![ - Just(VarError::NotPresent), - static_map(osstring_invalid_string().boxed(), VarError::NotUnicode) - ] -); - #[cfg(test)] mod test { use super::*; - use num; - use test_runner::Config; + use crate::num; + use crate::test_runner::Config; no_panic_test!( args => Args, diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_std/ffi.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_std/ffi.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_std/ffi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_std/ffi.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,14 +9,14 @@ //! Arbitrary implementations for `std::ffi`. +use crate::std_facade::{Box, String, Vec}; use std::ffi::*; use std::ops::RangeInclusive; -use std_facade::{Box, Vec, String}; -use strategy::*; -use strategy::statics::static_map; -use collection::*; -use arbitrary::*; +use crate::arbitrary::*; +use crate::collection::*; +use crate::strategy::statics::static_map; +use crate::strategy::*; use super::string::not_utf8_bytes; diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_std/fs.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_std/fs.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_std/fs.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_std/fs.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,10 +9,10 @@ //! Arbitrary implementations for `std::fs`. -use std::fs::{DirBuilder}; +use std::fs::DirBuilder; -use strategy::statics::static_map; -use arbitrary::{any, SMapped}; +use crate::arbitrary::{any, SMapped}; +use crate::strategy::statics::static_map; // TODO: other parts (figure out workable semantics). diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_std/io.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_std/io.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_std/io.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_std/io.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,15 +9,15 @@ //! Arbitrary implementations for `std::io`. -use std::io::*; -use std::io::ErrorKind::*; +use crate::std_facade::String; #[cfg(test)] -use std_facade::Vec; -use std_facade::String; +use crate::std_facade::Vec; +use std::io::ErrorKind::*; +use std::io::*; -use strategy::*; -use strategy::statics::static_map; -use arbitrary::*; +use crate::arbitrary::*; +use crate::strategy::statics::static_map; +use crate::strategy::*; // TODO: IntoInnerError // Consider: std::io::Initializer @@ -51,8 +51,8 @@ }; } -buffer!(BufReader, Read); -buffer!(BufWriter, Write); +buffer!(BufReader, Read); +buffer!(BufWriter, Write); buffer!(LineWriter, Write); arbitrary!( @@ -121,10 +121,10 @@ arbitrary!( SeekFrom, - TupleUnion<( - W>, - W>, - W>, + LazyTupleUnion<( + WA>, + WA>, + WA>, )>; prop_oneof![ static_map(any::(), SeekFrom::Start), diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_std/net.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_std/net.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_std/net.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_std/net.rs 2019-07-17 05:42:23.000000000 +0000 @@ -11,9 +11,9 @@ use std::net::*; -use strategy::*; -use strategy::statics::static_map; -use arbitrary::*; +use crate::arbitrary::*; +use crate::strategy::statics::static_map; +use crate::strategy::*; // TODO: Can we design a workable semantic for PBT wrt. actual networking // connections? @@ -21,10 +21,10 @@ arbitrary!(AddrParseError; "".parse::().unwrap_err()); arbitrary!(Ipv4Addr, - TupleUnion<( - W>, - W>, - W, Self>> + LazyTupleUnion<( + WA>, + WA>, + WA, Self>> )>; prop_oneof![ 1 => Just(Self::new(0, 0, 0, 0)), @@ -34,9 +34,9 @@ ); arbitrary!(Ipv6Addr, - TupleUnion<( - W>, - W, Self>> + LazyTupleUnion<( + WA>, + WA, Self>> )>; prop_oneof![ 2 => static_map(any::(), |ip| ip.to_ipv6_mapped()), @@ -54,8 +54,8 @@ ); arbitrary!(IpAddr, - TupleUnion<(W, Self>>, - W, Self>>)>; + LazyTupleUnion<(WA, Self>>, + WA, Self>>)>; prop_oneof![ any::().prop_map_into(), any::().prop_map_into() @@ -63,15 +63,15 @@ ); arbitrary!(Shutdown, - TupleUnion<(W>, W>, W>)>; + LazyTupleUnion<(WA>, WA>, WA>)>; { use std::net::Shutdown::*; prop_oneof![Just(Both), Just(Read), Just(Write)] } ); arbitrary!(SocketAddr, - TupleUnion<(W, Self>>, - W, Self>>)>; + LazyTupleUnion<(WA, Self>>, + WA, Self>>)>; prop_oneof![ any::().prop_map_into(), any::().prop_map_into() @@ -80,8 +80,9 @@ #[cfg(feature = "unstable")] arbitrary!(Ipv6MulticastScope, - TupleUnion<( W>, W>, W> - , W>, W>, W>, W>)>; + LazyTupleUnion<(WA>, WA>, WA>, + WA>, WA>, WA>, + WA>)>; { use std::net::Ipv6MulticastScope::*; prop_oneof![ diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_std/string.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_std/string.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_std/string.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_std/string.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,22 +9,22 @@ //! Arbitrary implementations for `std::string`. +use crate::std_facade::{Box, String, Vec}; use std::iter; -use std::slice; use std::rc::Rc; +use std::slice; use std::sync::Arc; -use std_facade::{Box, Vec, String}; multiplex_alloc! { alloc::string::FromUtf8Error, ::std::string::FromUtf8Error, alloc::string::FromUtf16Error, ::std::string::FromUtf16Error } -use strategy::*; -use strategy::statics::static_map; -use collection; -use arbitrary::*; -use string::StringParam; +use crate::arbitrary::*; +use crate::collection; +use crate::strategy::statics::static_map; +use crate::strategy::*; +use crate::string::StringParam; impl Arbitrary for String { type Parameters = StringParam; @@ -49,7 +49,8 @@ dst_wrapped!(Box, Rc, Arc); -lazy_just!(FromUtf16Error, || String::from_utf16(&[0xD800]).unwrap_err()); +lazy_just!(FromUtf16Error, || String::from_utf16(&[0xD800]) + .unwrap_err()); // This is a void-like type, it needs to be handled by the user of // the type by simply never constructing the variant in an enum or for @@ -66,7 +67,9 @@ /// wrt. UTF-8 with the goal of producing a suffix of bytes in the end of /// an otherwise legal UTF-8 string that causes the string to be illegal. /// This is used primarily to generate the `Utf8Error` type and similar. -pub(crate) fn not_utf8_bytes(allow_null: bool) -> impl Strategy> { +pub(crate) fn not_utf8_bytes( + allow_null: bool, +) -> impl Strategy> { let prefix = collection::vec(any::(), ..::std::u16::MAX as usize); let suffix = gen_el_bytes(allow_null); (prefix, suffix).prop_map(move |(prefix_bytes, el_bytes)| { @@ -90,7 +93,7 @@ B1([u8; 1]), B2([u8; 2]), B3([u8; 3]), - B4([u8; 4]) + B4([u8; 4]), } impl<'a> IntoIterator for &'a ELBytes { @@ -103,7 +106,8 @@ B2(ref a) => a.iter(), B3(ref a) => a.iter(), B4(ref a) => a.iter(), - }).cloned() + }) + .cloned() } } @@ -113,9 +117,15 @@ // We represent this with the range [0..4) and generate a valid // sequence from that. fn gen_el_bytes(allow_null: bool) -> impl Strategy { - fn b1(a: u8) -> ELBytes { ELBytes::B1([a]) } - fn b2(a: (u8, u8)) -> ELBytes { ELBytes::B2([a.0, a.1]) } - fn b3(a: ((u8, u8), u8)) -> ELBytes { ELBytes::B3([(a.0).0, (a.0).1, a.1]) } + fn b1(a: u8) -> ELBytes { + ELBytes::B1([a]) + } + fn b2(a: (u8, u8)) -> ELBytes { + ELBytes::B2([a.0, a.1]) + } + fn b3(a: ((u8, u8), u8)) -> ELBytes { + ELBytes::B3([(a.0).0, (a.0).1, a.1]) + } fn b4(a: ((u8, u8), u8, u8)) -> ELBytes { ELBytes::B4([(a.0).0, (a.0).1, a.1, a.2]) } @@ -148,70 +158,90 @@ */ // Continuation byte: - let succ_byte = 0x80u8..0xC0u8; + let succ_byte = 0x80u8..0xC0u8; // Do we allow the nul byte or not? let start_byte = if allow_null { 0x00u8 } else { 0x01u8 }; // Invalid continuation byte: - let fail_byte = prop_oneof![start_byte..0x7Fu8, 0xC1u8..]; + let fail_byte = prop_oneof![start_byte..0x7Fu8, 0xC1u8..]; // Matches zero in the UTF8_CHAR_WIDTH table above. - let byte0_w0 = prop_oneof![0x80u8..0xC0u8, 0xF5u8..]; + let byte0_w0 = prop_oneof![0x80u8..0xC0u8, 0xF5u8..]; // Start of a 3 (width) byte sequence: // Leads here: https://doc.rust-lang.org/1.23.0/src/core/str/mod.rs.html#1479 - let byte0_w2 = 0xC2u8..0xE0u8; + let byte0_w2 = 0xC2u8..0xE0u8; // Start of a 3 (width) byte sequence: // https://doc.rust-lang.org/1.23.0/src/core/str/mod.rs.html#1484 // See the left column in the match. - let byte0_w3 = 0xE0u8..0xF0u8; + let byte0_w3 = 0xE0u8..0xF0u8; // Start of a 4 (width) byte sequence: // https://doc.rust-lang.org/1.23.0/src/core/str/mod.rs.html#1495 // See the left column in the match. - let byte0_w4 = 0xF0u8..0xF5u8; + let byte0_w4 = 0xF0u8..0xF5u8; // The 2 first (valid) bytes of a 3 (width) byte sequence: // The first byte is byte0_w3. The second is the ones produced on the right. - let byte01_w3 = byte0_w3.clone().prop_flat_map(|x| (Just(x), match x { - 0xE0u8 => 0xA0u8..0xC0u8, - 0xE1u8...0xECu8 => 0x80u8..0xC0u8, - 0xEDu8 => 0x80u8..0xA0u8, - 0xEEu8...0xEFu8 => 0x80u8..0xA0u8, - _ => panic!(), - })); + let byte01_w3 = byte0_w3.clone().prop_flat_map(|x| { + ( + Just(x), + match x { + 0xE0u8 => 0xA0u8..0xC0u8, + 0xE1u8..=0xECu8 => 0x80u8..0xC0u8, + 0xEDu8 => 0x80u8..0xA0u8, + 0xEEu8..=0xEFu8 => 0x80u8..0xA0u8, + _ => panic!(), + }, + ) + }); // In a 3 (width) byte sequence, an invalid second byte is chosen such that // it will yield an error length of Some(1). The second byte is on // the right of the match arms. - let byte01_w3_e1 = byte0_w3.clone().prop_flat_map(move |x| (Just(x), match x { - 0xE0u8 => prop_oneof![start_byte..0xA0u8, 0xC0u8..], - 0xE1u8...0xECu8 => prop_oneof![start_byte..0x80u8, 0xC0u8..], - 0xEDu8 => prop_oneof![start_byte..0x80u8, 0xA0u8..], - 0xEEu8...0xEFu8 => prop_oneof![start_byte..0x80u8, 0xA0u8..], - _ => panic!(), - })); + let byte01_w3_e1 = byte0_w3.clone().prop_flat_map(move |x| { + ( + Just(x), + match x { + 0xE0u8 => prop_oneof![start_byte..0xA0u8, 0xC0u8..], + 0xE1u8..=0xECu8 => prop_oneof![start_byte..0x80u8, 0xC0u8..], + 0xEDu8 => prop_oneof![start_byte..0x80u8, 0xA0u8..], + 0xEEu8..=0xEFu8 => prop_oneof![start_byte..0x80u8, 0xA0u8..], + _ => panic!(), + }, + ) + }); // In a 4 (width) byte sequence, an invalid second byte is chosen such that // it will yield an error length of Some(1). The second byte is on // the right of the match arms. - let byte01_w4_e1 = byte0_w4.clone().prop_flat_map(move |x| (Just(x), match x { - 0xF0u8 => prop_oneof![start_byte..0x90u8, 0xA0u8..], - 0xF1u8...0xF3u8 => prop_oneof![start_byte..0x80u8, 0xA0u8..], - 0xF4u8 => prop_oneof![start_byte..0x80u8, 0x90u8..], - _ => panic!() - })); + let byte01_w4_e1 = byte0_w4.clone().prop_flat_map(move |x| { + ( + Just(x), + match x { + 0xF0u8 => prop_oneof![start_byte..0x90u8, 0xA0u8..], + 0xF1u8..=0xF3u8 => prop_oneof![start_byte..0x80u8, 0xA0u8..], + 0xF4u8 => prop_oneof![start_byte..0x80u8, 0x90u8..], + _ => panic!(), + }, + ) + }); // The 2 first (valid) bytes of a 4 (width) byte sequence: // The first byte is byte0_w4. The second is the ones produced on the right. - let byte01_w4 = byte0_w4.clone().prop_flat_map(|x| (Just(x), match x { - 0xF0u8 => 0x90u8..0xA0u8, - 0xF1u8...0xF3u8 => 0x80u8..0xA0u8, - 0xF4u8 => 0x80u8..0x90u8, - _ => panic!() - })); + let byte01_w4 = byte0_w4.clone().prop_flat_map(|x| { + ( + Just(x), + match x { + 0xF0u8 => 0x90u8..0xA0u8, + 0xF1u8..=0xF3u8 => 0x80u8..0xA0u8, + 0xF4u8 => 0x80u8..0x90u8, + _ => panic!(), + }, + ) + }); prop_oneof![ // error_len = None @@ -220,25 +250,19 @@ // width = 2 // lacking 1 bytes: static_map(byte0_w2.clone(), b1), - // width = 3 // lacking 2 bytes: static_map(byte0_w3, b1), - // lacking 1 bytes: static_map(byte01_w3.clone(), b2), - // width = 4 // lacking 3 bytes: static_map(byte0_w4, b1), - // lacking 2 bytes: static_map(byte01_w4.clone(), b2), - // lacking 1 byte: static_map((byte01_w4.clone(), succ_byte.clone()), b3), ], - // error_len = Some(1) prop_oneof![ // width = 1 is not represented. @@ -246,41 +270,39 @@ // path taken: // https://doc.rust-lang.org/1.23.0/src/core/str/mod.rs.html#1508 static_map(byte0_w0, b1), - // width = 2 // path taken: // https://doc.rust-lang.org/1.23.0/src/core/str/mod.rs.html#1480 static_map((byte0_w2, fail_byte.clone()), b2), - // width = 3 // path taken: // https://doc.rust-lang.org/1.23.0/src/core/str/mod.rs.html#1488 static_map(byte01_w3_e1, b2), - // width = 4 // path taken: // https://doc.rust-lang.org/1.23.0/src/core/str/mod.rs.html#1499 static_map(byte01_w4_e1, b2), ], - // error_len = Some(2) - static_map(prop_oneof![ - // width = 3 - // path taken: - // https://doc.rust-lang.org/1.23.0/src/core/str/mod.rs.html#1491 - (byte01_w3, fail_byte.clone()), - - // width = 4 - // path taken: - // https://doc.rust-lang.org/1.23.0/src/core/str/mod.rs.html#1502 - (byte01_w4.clone(), fail_byte.clone()) - ], b3), - + static_map( + prop_oneof![ + // width = 3 + // path taken: + // https://doc.rust-lang.org/1.23.0/src/core/str/mod.rs.html#1491 + (byte01_w3, fail_byte.clone()), + // width = 4 + // path taken: + // https://doc.rust-lang.org/1.23.0/src/core/str/mod.rs.html#1502 + (byte01_w4.clone(), fail_byte.clone()) + ], + b3 + ), // error_len = Some(3), width = 4 // path taken: // https://doc.rust-lang.org/1.23.0/src/core/str/mod.rs.html#1505 static_map((byte01_w4, succ_byte, fail_byte), b4), - ].boxed() + ] + .boxed() } #[cfg(test)] diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_std/sync.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_std/sync.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_std/sync.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_std/sync.rs 2019-07-17 05:42:23.000000000 +0000 @@ -10,14 +10,14 @@ //! Arbitrary implementations for `std::sync`. use std::fmt; -use std::sync::*; use std::sync::mpsc::*; +use std::sync::*; use std::thread; use std::time::Duration; -use strategy::*; -use strategy::statics::static_map; -use arbitrary::*; +use crate::arbitrary::*; +use crate::strategy::statics::static_map; +use crate::strategy::*; // OnceState can not escape Once::call_once_force. // PoisonError depends implicitly on the lifetime on MutexGuard, etc. @@ -40,7 +40,7 @@ ); arbitrary!(BarrierWaitResult, - TupleUnion<(W>, W>)>; + LazyTupleUnion<(WA>, WA>)>; prop_oneof![LazyJust::new(bwr_true), LazyJust::new(bwr_false)] ); @@ -49,7 +49,7 @@ Once, Once::new ); -arbitrary!(WaitTimeoutResult, TupleUnion<(W>, W>)>; +arbitrary!(WaitTimeoutResult, LazyTupleUnion<(WA>, WA>)>; prop_oneof![Just(wtr_true()), Just(wtr_false())] ); @@ -60,16 +60,22 @@ fn bwr_false() -> BarrierWaitResult { let barrier = Arc::new(Barrier::new(2)); let b2 = barrier.clone(); - let jh = thread::spawn(move|| { b2.wait() }); + let jh = thread::spawn(move || b2.wait()); let bwr1 = barrier.wait(); let bwr2 = jh.join().unwrap(); - if bwr1.is_leader() { bwr2 } else { bwr1 } + if bwr1.is_leader() { + bwr2 + } else { + bwr1 + } } fn wtr_false() -> WaitTimeoutResult { let cvar = Arc::new(Condvar::new()); let cvar2 = cvar.clone(); - thread::spawn(move|| { cvar2.notify_one(); }); + thread::spawn(move || { + cvar2.notify_one(); + }); let lock = Mutex::new(()); let wt = cvar.wait_timeout(lock.lock().unwrap(), Duration::from_millis(1)); let (_, wtr) = wt.unwrap(); @@ -90,14 +96,14 @@ args => static_map(any_with::(args), SendError) ); -arbitrary!(RecvTimeoutError, TupleUnion<(W>, W>)>; +arbitrary!(RecvTimeoutError, LazyTupleUnion<(WA>, WA>)>; prop_oneof![ Just(RecvTimeoutError::Disconnected), Just(RecvTimeoutError::Timeout) ] ); -arbitrary!(TryRecvError, TupleUnion<(W>, W>)>; +arbitrary!(TryRecvError, LazyTupleUnion<(WA>, WA>)>; prop_oneof![ Just(TryRecvError::Disconnected), Just(TryRecvError::Empty) @@ -106,16 +112,13 @@ arbitrary!( [P: Clone + Default, T: Arbitrary] TrySendError, - TupleUnion<(W>, W>)>, P; + LazyTupleUnion<(WA>, WA>)>, P; args => prop_oneof![ static_map(any_with::(args.clone()), TrySendError::Disconnected), static_map(any_with::(args), TrySendError::Full), ] ); -#[cfg(feature = "unstable")] -lazy_just!(Select, Select::new); - // If only half of a pair is generated then you will get a hang-up. // Thus the only meaningful impls are in pairs. arbitrary!([A] (Sender, Receiver), LazyJustFn; @@ -160,9 +163,4 @@ syncrx_tx => (SyncSender, Receiver), syncrx_txiter => (SyncSender, IntoIter) ); - - #[cfg(feature = "unstable")] - no_panic_test!( - select => Select - ); } diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_std/thread.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_std/thread.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_std/thread.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_std/thread.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,12 +9,12 @@ //! Arbitrary implementations for `std::thread`. +use crate::std_facade::String; use std::thread::*; -use std_facade::String; -use strategy::statics::static_map; -use option::prob; -use arbitrary::*; +use crate::arbitrary::*; +use crate::option::prob; +use crate::strategy::statics::static_map; arbitrary!(Builder, SMapped<(Option, Option), Self>; { let prob = prob(0.7); @@ -38,7 +38,7 @@ args => { let prob = prob(0.1); let args2 = product_pack![ - args, + args, product_pack![prob, default()], default() ]; diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/_std/time.rs cargo-0.37.0/vendor/proptest/src/arbitrary/_std/time.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/_std/time.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/_std/time.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,12 +9,12 @@ //! Arbitrary implementations for `std::time`. -use std::time::*; use core::ops::Range; +use std::time::*; -use strategy::statics::{self, static_map}; -use arbitrary::*; -use num; +use crate::arbitrary::*; +use crate::num; +use crate::strategy::statics::{self, static_map}; arbitrary!(Duration, SMapped<(u64, u32), Self>; static_map(any::<(u64, u32)>(), |(a, b)| Duration::new(a, b)) diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/traits.rs cargo-0.37.0/vendor/proptest/src/arbitrary/traits.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/traits.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/traits.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,7 +9,7 @@ use core::fmt; -use strategy::Strategy; +use crate::strategy::Strategy; //============================================================================== // Arbitrary trait @@ -137,8 +137,7 @@ /// The function can be used as: /// /// ```rust -/// #[macro_use] extern crate proptest; -/// use proptest::prelude::any; +/// use proptest::prelude::*; /// /// proptest! { /// fn reverse_reverse_is_identity(ref vec in any::>()) { @@ -179,8 +178,7 @@ /// The function can be used as: /// /// ```rust -/// #[macro_use] extern crate proptest; -/// use proptest::prelude::any_with; +/// use proptest::prelude::*; /// use proptest::collection::size_range; /// /// proptest! { diff -Nru cargo-0.35.0/vendor/proptest/src/arbitrary/tuples.rs cargo-0.37.0/vendor/proptest/src/arbitrary/tuples.rs --- cargo-0.35.0/vendor/proptest/src/arbitrary/tuples.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/arbitrary/tuples.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,7 +9,7 @@ //! Arbitrary implementations for tuples. -use arbitrary::{Arbitrary, any_with}; +use crate::arbitrary::{any_with, Arbitrary}; macro_rules! impl_tuple { ($($typ: ident),*) => { diff -Nru cargo-0.35.0/vendor/proptest/src/array.rs cargo-0.37.0/vendor/proptest/src/array.rs --- cargo-0.35.0/vendor/proptest/src/array.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/array.rs 2019-07-17 05:42:23.000000000 +0000 @@ -20,8 +20,8 @@ use core::marker::PhantomData; -use strategy::*; -use test_runner::*; +use crate::strategy::*; +use crate::test_runner::*; /// A `Strategy` which generates fixed-size arrays containing values drawn from /// an inner strategy. @@ -36,7 +36,6 @@ /// ## Example /// /// ``` -/// #[macro_use] extern crate proptest; /// use proptest::prelude::*; /// /// proptest! { @@ -252,24 +251,30 @@ #[test] fn shrinks_fully_ltr() { - fn pass(a: [i32;2]) -> bool { + fn pass(a: [i32; 2]) -> bool { a[0] * a[1] <= 9 } let input = [0..32, 0..32]; - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); let mut cases_tested = 0; for _ in 0..256 { // Find a failing test case let mut case = input.new_tree(&mut runner).unwrap(); - if pass(case.current()) { continue; } + if pass(case.current()) { + continue; + } loop { if pass(case.current()) { - if !case.complicate() { break; } + if !case.complicate() { + break; + } } else { - if !case.simplify() { break; } + if !case.simplify() { + break; + } } } @@ -287,6 +292,6 @@ #[test] fn test_sanity() { - check_strategy_sanity([(0i32..1000),(1i32..1000)], None); + check_strategy_sanity([(0i32..1000), (1i32..1000)], None); } } diff -Nru cargo-0.35.0/vendor/proptest/src/bits.rs cargo-0.37.0/vendor/proptest/src/bits.rs --- cargo-0.35.0/vendor/proptest/src/bits.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/bits.rs 2019-07-17 05:42:23.000000000 +0000 @@ -16,22 +16,22 @@ //! others). For integers treated as numeric values, see the corresponding //! modules of the `num` module instead. +use crate::std_facade::{fmt, Vec}; use core::marker::PhantomData; use core::mem; -use std_facade::{fmt, Vec}; #[cfg(feature = "bit-set")] use bit_set::BitSet; -use rand::{self, Rng}; +use rand::{self, seq::IteratorRandom, Rng}; -use collection::SizeRange; -use num::sample_uniform_incl; -use strategy::*; -use test_runner::*; +use crate::collection::SizeRange; +use crate::num::sample_uniform_incl; +use crate::strategy::*; +use crate::test_runner::*; /// Trait for types which can be handled with `BitSetStrategy`. -#[cfg_attr(feature="cargo-clippy", allow(len_without_is_empty))] -pub trait BitSetLike : Clone + fmt::Debug { +#[cfg_attr(feature = "cargo-clippy", allow(len_without_is_empty))] +pub trait BitSetLike: Clone + fmt::Debug { /// Create a new value of `Self` with space for up to `max` bits, all /// initialised to zero. fn new_bitset(max: usize) -> Self; @@ -62,8 +62,12 @@ macro_rules! int_bitset { ($typ:ty) => { impl BitSetLike for $typ { - fn new_bitset(_: usize) -> Self { 0 } - fn len(&self) -> usize { mem::size_of::<$typ>()*8 } + fn new_bitset(_: usize) -> Self { + 0 + } + fn len(&self) -> usize { + mem::size_of::<$typ>() * 8 + } fn test(&self, ix: usize) -> bool { 0 != (*self & ((1 as $typ) << ix)) } @@ -77,7 +81,7 @@ self.count_ones() as usize } } - } + }; } int_bitset!(u8); int_bitset!(u16); @@ -159,13 +163,13 @@ /// or 1 between the bounds. Shrinking iteratively clears bits. #[must_use = "strategies do nothing unless used"] #[derive(Clone, Copy, Debug)] -pub struct BitSetStrategy { +pub struct BitSetStrategy { min: usize, max: usize, - mask: Option + mask: Option, } -impl BitSetStrategy { +impl BitSetStrategy { /// Create a strategy which generates values where bits between `min` /// (inclusive) and `max` (exclusive) may be set. /// @@ -173,7 +177,9 @@ /// preferable to calling this directly. pub fn new(min: usize, max: usize) -> Self { BitSetStrategy { - min, max, mask: None, + min, + max, + mask: None, } } @@ -183,20 +189,20 @@ BitSetStrategy { min: 0, max: mask.len(), - mask: Some(mask) + mask: Some(mask), } } } -impl Strategy for BitSetStrategy { +impl Strategy for BitSetStrategy { type Tree = BitSetValueTree; type Value = T; fn new_tree(&self, runner: &mut TestRunner) -> NewTree { let mut inner = T::new_bitset(self.max); for bit in self.min..self.max { - if self.mask.as_ref().map_or(true, |mask| mask.test(bit)) && - runner.rng().gen() + if self.mask.as_ref().map_or(true, |mask| mask.test(bit)) + && runner.rng().gen() { inner.set(bit); } @@ -206,7 +212,7 @@ inner, shrink: self.min, prev_shrink: None, - min_count: 0 + min_count: 0, }) } } @@ -220,13 +226,13 @@ /// Shrinking happens as with [`BitSetStrategy`](struct.BitSetStrategy.html). #[derive(Clone, Debug)] #[must_use = "strategies do nothing unless used"] -pub struct SampledBitSetStrategy { +pub struct SampledBitSetStrategy { size: SizeRange, bits: SizeRange, _marker: PhantomData, } -impl SampledBitSetStrategy { +impl SampledBitSetStrategy { /// Create a strategy which generates values where bits within the bounds /// given by `bits` may be set. The number of bits that are set is chosen /// to be in the range given by `size`. @@ -238,35 +244,44 @@ /// /// Panics if `size` includes a value that is greater than the number of /// bits in `bits`. - pub fn new(size: impl Into, bits: impl Into) - -> Self { + pub fn new(size: impl Into, bits: impl Into) -> Self { let size = size.into(); let bits = bits.into(); size.assert_nonempty(); let available_bits = bits.end_excl() - bits.start(); - assert!(size.end_excl() <= available_bits + 1, - "Illegal SampledBitSetStrategy: have {} bits available, \ - but requested size is {}..{}", - available_bits, size.start(), size.end_excl()); + assert!( + size.end_excl() <= available_bits + 1, + "Illegal SampledBitSetStrategy: have {} bits available, \ + but requested size is {}..{}", + available_bits, + size.start(), + size.end_excl() + ); SampledBitSetStrategy { - size, bits, _marker: PhantomData + size, + bits, + _marker: PhantomData, } } } -impl Strategy for SampledBitSetStrategy { +impl Strategy for SampledBitSetStrategy { type Tree = BitSetValueTree; type Value = T; fn new_tree(&self, runner: &mut TestRunner) -> NewTree { let mut bits = T::new_bitset(self.bits.end_excl()); let count = sample_uniform_incl( - runner, self.size.start(), self.size.end_incl()); - for bit in - rand::seq::sample_iter(runner.rng(), self.bits.iter(), count) - .expect("not enough bits to sample") - { + runner, + self.size.start(), + self.size.end_incl(), + ); + if bits.len() < count { + panic!("not enough bits to sample"); + } + + for bit in self.bits.iter().choose_multiple(runner.rng(), count) { bits.set(bit); } @@ -281,14 +296,14 @@ /// Value tree produced by `BitSetStrategy` and `SampledBitSetStrategy`. #[derive(Clone, Copy, Debug)] -pub struct BitSetValueTree { +pub struct BitSetValueTree { inner: T, shrink: usize, prev_shrink: Option, min_count: usize, } -impl ValueTree for BitSetValueTree { +impl ValueTree for BitSetValueTree { type Value = T; fn current(&self) -> T { @@ -300,9 +315,9 @@ return false; } - while self.shrink < self.inner.len() && - !self.inner.test(self.shrink) - { self.shrink += 1; } + while self.shrink < self.inner.len() && !self.inner.test(self.shrink) { + self.shrink += 1; + } if self.shrink >= self.inner.len() { self.prev_shrink = None; @@ -358,12 +373,14 @@ /// /// Panics if `size` includes a value that is greater than the /// number of bits in `bits`. - pub fn sampled(size: impl Into, bits: impl Into) - -> SampledBitSetStrategy<$typ> { + pub fn sampled( + size: impl Into, + bits: impl Into, + ) -> SampledBitSetStrategy<$typ> { SampledBitSetStrategy::new(size, bits) } } - } + }; } int_api!(u8, 8); @@ -401,12 +418,14 @@ /// /// Panics if `size` includes a value that is greater than the /// number of bits in `bits`. - pub fn sampled(size: impl Into, bits: impl Into) - -> SampledBitSetStrategy<$typ> { + pub fn sampled( + size: impl Into, + bits: impl Into, + ) -> SampledBitSetStrategy<$typ> { SampledBitSetStrategy::new(size, bits) } } - } + }; } minimal_api!(usize, usize); minimal_api!(isize, isize); @@ -436,7 +455,6 @@ (0..self.len()).into_iter().filter(move |&ix| self.test(ix)) } - #[cfg(feature = "bit-set")] pub(crate) fn iter<'a>(&'a self) -> impl Iterator + 'a { self.0.iter() @@ -470,7 +488,7 @@ } impl FromIterator for VarBitSet { - fn from_iter>(iter: T) -> Self { + fn from_iter>(iter: T) -> Self { let mut bits = VarBitSet::new_bitset(0); for bit in iter { bits.set(bit); @@ -489,8 +507,10 @@ } */ - pub(crate) fn sampled(size: impl Into, bits: impl Into) - -> SampledBitSetStrategy { + pub(crate) fn sampled( + size: impl Into, + bits: impl Into, + ) -> SampledBitSetStrategy { SampledBitSetStrategy::new(size, bits) } } @@ -508,8 +528,7 @@ let mut runner = TestRunner::default(); for _ in 0..256 { let value = input.new_tree(&mut runner).unwrap().current(); - assert!(0 == value & !0xF0u32, - "Generate value {}", value); + assert!(0 == value & !0xF0u32, "Generate value {}", value); } } @@ -517,7 +536,7 @@ fn generates_values_in_mask() { let mut accum = 0; - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); let input = u32::masked(0xdeadbeef); for _ in 0..1024 { accum |= input.new_tree(&mut runner).unwrap().current(); @@ -536,7 +555,7 @@ mask.insert(0); mask.insert(2); - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); let input = bitset::masked(mask); for _ in 0..32 { let v = input.new_tree(&mut runner).unwrap().current(); @@ -555,7 +574,7 @@ let mask = vec![true, false, true, false]; - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); let input = bool_vec::masked(mask); for _ in 0..32 { let v = input.new_tree(&mut runner).unwrap().current(); @@ -578,8 +597,12 @@ let mut prev = value.current(); while value.simplify() { let v = value.current(); - assert!(1 == (prev & !v).count_ones(), - "Shrank from {} to {}", prev, v); + assert!( + 1 == (prev & !v).count_ones(), + "Shrank from {} to {}", + prev, + v + ); prev = v; } @@ -608,7 +631,7 @@ let mut seen_counts = [0; 32]; let mut seen_bits = [0; 32]; - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); for _ in 0..2048 { let value = input.new_tree(&mut runner).unwrap().current(); let count = value.count_ones() as usize; @@ -641,7 +664,7 @@ let mut runner = TestRunner::default(); for _ in 0..256 { let mut value = input.new_tree(&mut runner).unwrap(); - while value.simplify() { } + while value.simplify() {} assert_eq!(4, value.current().count_ones()); } diff -Nru cargo-0.35.0/vendor/proptest/src/bool.rs cargo-0.37.0/vendor/proptest/src/bool.rs --- cargo-0.35.0/vendor/proptest/src/bool.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/bool.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,8 +9,8 @@ //! Strategies for generating `bool` values. -use strategy::*; -use test_runner::*; +use crate::strategy::*; +use crate::test_runner::*; use rand::Rng; @@ -63,32 +63,40 @@ #[derive(Clone, Copy, Debug, PartialEq)] enum ShrinkState { - Untouched, Simplified, Final + Untouched, + Simplified, + Final, } impl BoolValueTree { fn new(current: bool) -> Self { - BoolValueTree { current, state: ShrinkState::Untouched } + BoolValueTree { + current, + state: ShrinkState::Untouched, + } } } impl ValueTree for BoolValueTree { type Value = bool; - fn current(&self) -> bool { self.current } + fn current(&self) -> bool { + self.current + } fn simplify(&mut self) -> bool { match self.state { ShrinkState::Untouched if self.current => { self.current = false; self.state = ShrinkState::Simplified; true - }, + } - ShrinkState::Untouched | ShrinkState::Simplified | - ShrinkState::Final => { + ShrinkState::Untouched + | ShrinkState::Simplified + | ShrinkState::Final => { self.state = ShrinkState::Final; false - }, + } } } fn complicate(&mut self) -> bool { @@ -96,7 +104,7 @@ ShrinkState::Untouched | ShrinkState::Final => { self.state = ShrinkState::Final; false - }, + } ShrinkState::Simplified => { self.current = true; diff -Nru cargo-0.35.0/vendor/proptest/src/char.rs cargo-0.37.0/vendor/proptest/src/char.rs --- cargo-0.35.0/vendor/proptest/src/char.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/char.rs 2019-07-17 05:42:23.000000000 +0000 @@ -17,14 +17,14 @@ //! characters, and `range()` and `ranges()` to select characters from //! inclusive ranges. +use crate::std_facade::Cow; use core::ops::RangeInclusive; -use std_facade::Cow; use rand::Rng; -use num; -use strategy::*; -use test_runner::*; +use crate::num; +use crate::strategy::*; +use crate::test_runner::*; /// An inclusive char range from fst to snd. type CharRange = RangeInclusive; @@ -44,18 +44,23 @@ '\x00', '\t', '\r', '\n', '\x0B', '\x1B', '\x7F', // ¥ both to test simple Unicode handling and because it has interesting // properties on MS Shift-JIS systems. - '¥', - // No non-Unicode encoding has both ¥ and Ѩ + '¥', // No non-Unicode encoding has both ¥ and Ѩ 'Ѩ', - // More Unicode edge-cases: BOM, replacement character, and non-BMP - '\u{FEFF}', '\u{FFFD}', '🕴', + // In UTF-8, Ⱥ increases in length from 2 to 3 bytes when lowercased + 'Ⱥ', + // More Unicode edge-cases: BOM, replacement character, RTL override, and non-BMP + '\u{FEFF}', '\u{FFFD}', '\u{202E}', '🕴', ]; /// A default sequence of ranges used preferentially when generating random /// characters. pub const DEFAULT_PREFERRED_RANGES: &[CharRange] = &[ // ASCII printable - ' '..='~', ' '..='~', ' '..='~', ' '..='~', ' '..='~', + ' '..='~', + ' '..='~', + ' '..='~', + ' '..='~', + ' '..='~', // Latin-1 '\u{0040}'..='\u{00ff}', ]; @@ -85,43 +90,54 @@ /// particular characters anyway. `ranges` is usually derived from some /// external property, and the fact that a range is small often means it is /// more interesting. -pub fn select_char(rnd: &mut impl Rng, - special: &[char], - preferred: &[CharRange], - ranges: &[CharRange]) -> char { +pub fn select_char( + rnd: &mut impl Rng, + special: &[char], + preferred: &[CharRange], + ranges: &[CharRange], +) -> char { let (base, offset) = select_range_index(rnd, special, preferred, ranges); ::core::char::from_u32(base + offset).expect("bad character selected") } -fn select_range_index(rnd: &mut impl Rng, - special: &[char], - preferred: &[CharRange], - ranges: &[CharRange]) - -> (u32, u32) { +fn select_range_index( + rnd: &mut impl Rng, + special: &[char], + preferred: &[CharRange], + ranges: &[CharRange], +) -> (u32, u32) { fn in_range(ranges: &[CharRange], ch: char) -> Option<(u32, u32)> { - ranges.iter().find(|r| ch >= *r.start() && ch <= *r.end()).map( - |r| (*r.start() as u32, ch as u32 - *r.start() as u32)) + ranges + .iter() + .find(|r| ch >= *r.start() && ch <= *r.end()) + .map(|r| (*r.start() as u32, ch as u32 - *r.start() as u32)) } if !special.is_empty() && rnd.gen() { let s = special[rnd.gen_range(0, special.len())]; - if let Some(ret) = in_range(ranges, s) { return ret; } + if let Some(ret) = in_range(ranges, s) { + return ret; + } } if !preferred.is_empty() && rnd.gen() { let range = preferred[rnd.gen_range(0, preferred.len())].clone(); if let Some(ch) = ::core::char::from_u32( - rnd.gen_range(*range.start() as u32, *range.end() as u32 + 1)) - { - if let Some(ret) = in_range(ranges, ch) { return ret; } + rnd.gen_range(*range.start() as u32, *range.end() as u32 + 1), + ) { + if let Some(ret) = in_range(ranges, ch) { + return ret; + } } } for _ in 0..65_536 { let range = ranges[rnd.gen_range(0, ranges.len())].clone(); if let Some(ch) = ::core::char::from_u32( - rnd.gen_range(*range.start() as u32, *range.end() as u32 + 1)) - { return (*range.start() as u32, ch as u32 - *range.start() as u32); } + rnd.gen_range(*range.start() as u32, *range.end() as u32 + 1), + ) { + return (*range.start() as u32, ch as u32 - *range.start() as u32); + } } // Give up and return a character we at least know is valid. @@ -165,16 +181,24 @@ /// function underlying `select_char()`. /// /// All arguments as per `select_char()`. - pub fn new(special: Cow<'a, [char]>, - preferred: Cow<'a, [CharRange]>, - ranges: Cow<'a, [CharRange]>) -> Self { - CharStrategy { special, preferred, ranges } + pub fn new( + special: Cow<'a, [char]>, + preferred: Cow<'a, [CharRange]>, + ranges: Cow<'a, [CharRange]>, + ) -> Self { + CharStrategy { + special, + preferred, + ranges, + } } /// Same as `CharStrategy::new()` but using `Cow::Borrowed` for all parts. - pub fn new_borrowed(special: &'a [char], - preferred: &'a [CharRange], - ranges: &'a [CharRange]) -> Self { + pub fn new_borrowed( + special: &'a [char], + preferred: &'a [CharRange], + ranges: &'a [CharRange], + ) -> Self { CharStrategy::new( Cow::Borrowed(special), Cow::Borrowed(preferred), @@ -183,9 +207,7 @@ } } -const WHOLE_RANGE: &[CharRange] = &[ - '\x00' ..= ::core::char::MAX -]; +const WHOLE_RANGE: &[CharRange] = &['\x00'..=::core::char::MAX]; /// Creates a `CharStrategy` which picks from literally any character, with the /// default biases. @@ -229,7 +251,11 @@ fn new_tree(&self, runner: &mut TestRunner) -> NewTree { let (base, offset) = select_range_index( - runner.rng(), &self.special, &self.preferred, &self.ranges); + runner.rng(), + &self.special, + &self.preferred, + &self.ranges, + ); // Select a minimum point more convenient than 0 let start = base + offset; @@ -248,7 +274,7 @@ }; Ok(CharValueTree { - value: num::u32::BinarySearch::new_above(bottom, start) + value: num::u32::BinarySearch::new_above(bottom, start), }) } } @@ -267,8 +293,8 @@ type Value = char; fn current(&self) -> char { - ::core::char::from_u32(self.value.current()).expect( - "Generated non-char value") + ::core::char::from_u32(self.value.current()) + .expect("Generated non-char value") } fn simplify(&mut self) -> bool { @@ -292,49 +318,46 @@ #[cfg(test)] mod test { - use std::cmp::{min, max}; + use std::cmp::{max, min}; use std::vec::Vec; use super::*; - use collection; + use crate::collection; - #[test] - fn stays_in_range() { - let meta_input = collection::vec( + proptest! { + #[test] + fn stays_in_range(input_ranges in collection::vec( (0..::std::char::MAX as u32, 0..::std::char::MAX as u32), - 1..5); - TestRunner::default().run( - &meta_input, |input_ranges| { - let input = ranges(Cow::Owned(input_ranges.iter().map( - |&(lo, hi)| ::std::char::from_u32(lo).and_then( - |lo| ::std::char::from_u32(hi).map( - |hi| min(lo, hi) ..= max(lo, hi))) - .ok_or_else(|| TestCaseError::reject("non-char"))) - .collect::,_>>()?)); - - let mut runner = TestRunner::default(); - for _ in 0..256 { - let mut value = input.new_tree(&mut runner).unwrap(); - loop { - let ch = value.current() as u32; - assert!(input_ranges.iter().any( - |&(lo, hi)| ch >= min(lo, hi) && - ch <= max(lo, hi))); + 1..5)) + { + let input = ranges(Cow::Owned(input_ranges.iter().map( + |&(lo, hi)| ::std::char::from_u32(lo).and_then( + |lo| ::std::char::from_u32(hi).map( + |hi| min(lo, hi) ..= max(lo, hi))) + .ok_or_else(|| TestCaseError::reject("non-char"))) + .collect::,_>>()?)); + + let mut runner = TestRunner::default(); + for _ in 0..256 { + let mut value = input.new_tree(&mut runner).unwrap(); + loop { + let ch = value.current() as u32; + assert!(input_ranges.iter().any( + |&(lo, hi)| ch >= min(lo, hi) && + ch <= max(lo, hi))); - if !value.simplify() { break; } - } + if !value.simplify() { break; } } - - Ok(()) - }).unwrap() + } + } } #[test] fn applies_desired_bias() { let mut men_in_business_suits_levitating = 0; let mut ascii_printable = 0; - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); for _ in 0..1024 { let ch = any().new_tree(&mut runner).unwrap().current(); @@ -352,14 +375,16 @@ #[test] fn doesnt_shrink_to_ascii_control() { let mut accepted = 0; - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); for _ in 0..256 { let mut value = any().new_tree(&mut runner).unwrap(); - if value.current() <= ' ' { continue; } + if value.current() <= ' ' { + continue; + } - while value.simplify() { } + while value.simplify() {} assert!(value.current() >= ' '); accepted += 1; @@ -370,12 +395,15 @@ #[test] fn test_sanity() { - check_strategy_sanity(any(), Some(CheckStrategySanityOptions { - // `simplify()` can itself `complicate()` back to the starting - // position, so the overly strict complicate-after-simplify check - // must be disabled. - strict_complicate_after_simplify: false, - .. CheckStrategySanityOptions::default() - })); + check_strategy_sanity( + any(), + Some(CheckStrategySanityOptions { + // `simplify()` can itself `complicate()` back to the starting + // position, so the overly strict complicate-after-simplify check + // must be disabled. + strict_complicate_after_simplify: false, + ..CheckStrategySanityOptions::default() + }), + ); } } diff -Nru cargo-0.35.0/vendor/proptest/src/collection.rs cargo-0.37.0/vendor/proptest/src/collection.rs --- cargo-0.35.0/vendor/proptest/src/collection.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/collection.rs 2019-07-17 05:42:23.000000000 +0000 @@ -11,19 +11,21 @@ use core::cmp::Ord; use core::hash::Hash; -use core::ops::{Add, Range, RangeTo, RangeInclusive, RangeToInclusive}; +use core::ops::{Add, Range, RangeInclusive, RangeTo, RangeToInclusive}; use core::usize; -use std_facade::{fmt, Vec, VecDeque, BinaryHeap, BTreeMap, BTreeSet, LinkedList}; +use crate::std_facade::{ + fmt, BTreeMap, BTreeSet, BinaryHeap, LinkedList, Vec, VecDeque, +}; #[cfg(feature = "std")] -use std_facade::{HashMap, HashSet}; +use crate::std_facade::{HashMap, HashSet}; -use bits::{BitSetLike, VarBitSet}; -use num::sample_uniform_incl; -use strategy::*; -use tuple::TupleValueTree; -use test_runner::*; +use crate::bits::{BitSetLike, VarBitSet}; +use crate::num::sample_uniform_incl; +use crate::strategy::*; +use crate::test_runner::*; +use crate::tuple::TupleValueTree; //============================================================================== // SizeRange @@ -102,10 +104,15 @@ pub(crate) fn assert_nonempty(&self) { if self.is_empty() { - panic!("Invalid use of empty size range. (hint: did you \ - accidentally write {}..{} where you meant {}..={} \ - somewhere?)", self.start(), self.end_excl(), - self.start(), self.end_excl()); + panic!( + "Invalid use of empty size range. (hint: did you \ + accidentally write {}..{} where you meant {}..={} \ + somewhere?)", + self.start(), + self.end_excl(), + self.start(), + self.end_excl() + ); } } } @@ -113,22 +120,30 @@ /// Given `(low: usize, high: usize)`, /// then a size range of `[low..high)` is the result. impl From<(usize, usize)> for SizeRange { - fn from((low, high): (usize, usize)) -> Self { size_range(low..high) } + fn from((low, high): (usize, usize)) -> Self { + size_range(low..high) + } } /// Given `exact`, then a size range of `[exact, exact]` is the result. impl From for SizeRange { - fn from(exact: usize) -> Self { size_range(exact..=exact) } + fn from(exact: usize) -> Self { + size_range(exact..=exact) + } } /// Given `..high`, then a size range `[0, high)` is the result. impl From> for SizeRange { - fn from(high: RangeTo) -> Self { size_range(0..high.end) } + fn from(high: RangeTo) -> Self { + size_range(0..high.end) + } } /// Given `low .. high`, then a size range `[low, high)` is the result. impl From> for SizeRange { - fn from(r: Range) -> Self { SizeRange(r) } + fn from(r: Range) -> Self { + SizeRange(r) + } } /// Given `low ..= high`, then a size range `[low, high]` is the result. @@ -140,29 +155,24 @@ /// Given `..=high`, then a size range `[0, high]` is the result. impl From> for SizeRange { - fn from(high: RangeToInclusive) -> Self { size_range(0..=high.end) } -} - -impl From for Range { - fn from(sr: SizeRange) -> Self { - sr.start()..sr.end_excl() + fn from(high: RangeToInclusive) -> Self { + size_range(0..=high.end) } } -/// Given a size range `[low, high]`, then a range `low..=high` is returned. -impl From for RangeInclusive { - fn from(sr: SizeRange) -> Self { sr.start()..=sr.end_incl() } -} - #[cfg(feature = "frunk")] impl Generic for SizeRange { type Repr = RangeInclusive; /// Converts the `SizeRange` into `Range`. - fn into(self) -> Self::Repr { self.0 } + fn into(self) -> Self::Repr { + self.0 + } /// Converts `RangeInclusive` into `SizeRange`. - fn from(r: Self::Repr) -> Self { r.into() } + fn from(r: Self::Repr) -> Self { + r.into() + } } /// Adds `usize` to both start and end of the bounds. @@ -186,7 +196,7 @@ /// Created by the `vec()` function in the same module. #[must_use = "strategies do nothing unless used"] #[derive(Clone, Debug)] -pub struct VecStrategy { +pub struct VecStrategy { element: T, size: SizeRange, } @@ -196,8 +206,10 @@ /// /// To make a `Vec` with a fixed number of elements, each with its own /// strategy, you can instead make a `Vec` of strategies (boxed if necessary). -pub fn vec(element: T, size: impl Into) - -> VecStrategy { +pub fn vec( + element: T, + size: impl Into, +) -> VecStrategy { let size = size.into(); size.assert_nonempty(); VecStrategy { element, size } @@ -226,9 +238,10 @@ /// Create a strategy to generate `VecDeque`s containing elements drawn from /// `element` and with a size range given by `size`. -pub fn vec_deque(element: T, size: impl Into) - -> VecDequeStrategy -{ +pub fn vec_deque( + element: T, + size: impl Into, +) -> VecDequeStrategy { VecDequeStrategy(statics::Map::new(vec(element, size), VecToDeque)) } @@ -255,9 +268,10 @@ /// Create a strategy to generate `LinkedList`s containing elements drawn from /// `element` and with a size range given by `size`. -pub fn linked_list(element: T, size: impl Into) - -> LinkedListStrategy -{ +pub fn linked_list( + element: T, + size: impl Into, +) -> LinkedListStrategy { LinkedListStrategy(statics::Map::new(vec(element, size), VecToLl)) } @@ -284,9 +298,13 @@ /// Create a strategy to generate `BinaryHeap`s containing elements drawn from /// `element` and with a size range given by `size`. -pub fn binary_heap(element: T, size: impl Into) - -> BinaryHeapStrategy -where T::Value : Ord { +pub fn binary_heap( + element: T, + size: impl Into, +) -> BinaryHeapStrategy +where + T::Value: Ord, +{ BinaryHeapStrategy(statics::Map::new(vec(element, size), VecToBinHeap)) } @@ -302,7 +320,7 @@ struct MinSize(usize); #[cfg(feature = "std")] -impl statics::FilterFn> for MinSize { +impl statics::FilterFn> for MinSize { fn apply(&self, set: &HashSet) -> bool { set.len() >= self.0 } @@ -331,14 +349,19 @@ /// has at least the minimum number of elements, in case `element` should /// produce duplicate values. #[cfg(feature = "std")] -pub fn hash_set(element: T, size: impl Into) - -> HashSetStrategy -where T::Value : Hash + Eq { +pub fn hash_set( + element: T, + size: impl Into, +) -> HashSetStrategy +where + T::Value: Hash + Eq, +{ let size = size.into(); HashSetStrategy(statics::Filter::new( statics::Map::new(vec(element, size.clone()), VecToHashSet), "HashSet minimum size".into(), - MinSize(size.start()))) + MinSize(size.start()), + )) } mapfn! { @@ -348,7 +371,7 @@ } } -impl statics::FilterFn> for MinSize { +impl statics::FilterFn> for MinSize { fn apply(&self, set: &BTreeSet) -> bool { set.len() >= self.0 } @@ -375,14 +398,19 @@ /// This strategy will implicitly do local rejects to ensure that the /// `BTreeSet` has at least the minimum number of elements, in case `element` /// should produce duplicate values. -pub fn btree_set(element: T, size: impl Into) - -> BTreeSetStrategy -where T::Value : Ord { +pub fn btree_set( + element: T, + size: impl Into, +) -> BTreeSetStrategy +where + T::Value: Ord, +{ let size = size.into(); BTreeSetStrategy(statics::Filter::new( statics::Map::new(vec(element, size.clone()), VecToBTreeSet), "BTreeSet minimum size".into(), - MinSize(size.start()))) + MinSize(size.start()), + )) } mapfn! { @@ -395,7 +423,7 @@ } #[cfg(feature = "std")] -impl statics::FilterFn> for MinSize { +impl statics::FilterFn> for MinSize { fn apply(&self, map: &HashMap) -> bool { map.len() >= self.0 } @@ -429,14 +457,20 @@ /// has at least the minimum number of elements, in case `key` should produce /// duplicate values. #[cfg(feature = "std")] -pub fn hash_map - (key: K, value: V, size: impl Into) -> HashMapStrategy -where K::Value : Hash + Eq { +pub fn hash_map( + key: K, + value: V, + size: impl Into, +) -> HashMapStrategy +where + K::Value: Hash + Eq, +{ let size = size.into(); HashMapStrategy(statics::Filter::new( statics::Map::new(vec((key, value), size.clone()), VecToHashMap), "HashMap minimum size".into(), - MinSize(size.start()))) + MinSize(size.start()), + )) } mapfn! { @@ -447,7 +481,7 @@ } } -impl statics::FilterFn> for MinSize { +impl statics::FilterFn> for MinSize { fn apply(&self, map: &BTreeMap) -> bool { map.len() >= self.0 } @@ -479,14 +513,20 @@ /// This strategy will implicitly do local rejects to ensure that the /// `BTreeMap` has at least the minimum number of elements, in case `key` /// should produce duplicate values. -pub fn btree_map - (key: K, value: V, size: impl Into) -> BTreeMapStrategy -where K::Value : Ord { +pub fn btree_map( + key: K, + value: V, + size: impl Into, +) -> BTreeMapStrategy +where + K::Value: Ord, +{ let size = size.into(); BTreeMapStrategy(statics::Filter::new( statics::Map::new(vec((key, value), size.clone()), VecToBTreeMap), "BTreeMap minimum size".into(), - MinSize(size.start()))) + MinSize(size.start()), + )) } #[derive(Clone, Copy, Debug)] @@ -497,7 +537,7 @@ /// `ValueTree` corresponding to `VecStrategy`. #[derive(Clone, Debug)] -pub struct VecValueTree { +pub struct VecValueTree { elements: Vec, included_elements: VarBitSet, min_size: usize, @@ -505,7 +545,7 @@ prev_shrink: Option, } -impl Strategy for VecStrategy { +impl Strategy for VecStrategy { type Tree = VecValueTree; type Value = Vec; @@ -527,14 +567,16 @@ } } -impl Strategy for Vec { +impl Strategy for Vec { type Tree = VecValueTree; type Value = Vec; fn new_tree(&self, runner: &mut TestRunner) -> NewTree { let len = self.len(); - let elements = self.iter().map( - |t| t.new_tree(runner)).collect::, Reason>>()?; + let elements = self + .iter() + .map(|t| t.new_tree(runner)) + .collect::, Reason>>()?; Ok(VecValueTree { elements, @@ -546,11 +588,13 @@ } } -impl ValueTree for VecValueTree { +impl ValueTree for VecValueTree { type Value = Vec; fn current(&self) -> Vec { - self.elements.iter().enumerate() + self.elements + .iter() + .enumerate() .filter(|&(ix, _)| self.included_elements.test(ix)) .map(|(_, element)| element.current()) .collect() @@ -566,8 +610,8 @@ if let Shrink::DeleteElement(ix) = self.shrink { // Can't delete an element if beyond the end of the vec or if it // would put us under the minimum length. - if ix >= self.elements.len() || - self.included_elements.count() == self.min_size + if ix >= self.elements.len() + || self.included_elements.count() == self.min_size { self.shrink = Shrink::ShrinkElement(0); } else { @@ -611,7 +655,7 @@ self.included_elements.set(ix); self.prev_shrink = None; true - }, + } Some(Shrink::ShrinkElement(ix)) => { if self.elements[ix].complicate() { // Don't unset prev_shrink; we may be able to complicate @@ -635,15 +679,15 @@ mod test { use super::*; - use bits; + use crate::bits; #[test] fn test_vec() { let input = vec(1usize..20usize, 5..20); let mut num_successes = 0; + let mut runner = TestRunner::deterministic(); for _ in 0..256 { - let mut runner = TestRunner::default(); let case = input.new_tree(&mut runner).unwrap(); let start = case.current(); // Has correct length @@ -652,8 +696,10 @@ assert!(start.iter().map(|&v| v).collect::().len() >= 2); let result = runner.run_one(case, |v| { - prop_assert!(v.iter().map(|&v| v).sum::() < 9, - "greater than 8"); + prop_assert!( + v.iter().map(|&v| v).sum::() < 9, + "greater than 8" + ); Ok(()) }); @@ -663,10 +709,14 @@ // The minimal case always has between 5 (due to min // length) and 9 (min element value = 1) elements, and // always sums to exactly 9. - assert!(value.len() >= 5 && value.len() <= 9 && - value.iter().map(|&v| v).sum::() == 9, - "Unexpected minimal value: {:?}", value); - }, + assert!( + value.len() >= 5 + && value.len() <= 9 + && value.iter().map(|&v| v).sum::() == 9, + "Unexpected minimal value: {:?}", + value + ); + } e => panic!("Unexpected result: {:?}", e), } } @@ -681,10 +731,8 @@ #[test] fn test_parallel_vec() { - let input = vec![ - (1u32..10).boxed(), - bits::u32::masked(0xF0u32).boxed(), - ]; + let input = + vec![(1u32..10).boxed(), bits::u32::masked(0xF0u32).boxed()]; for _ in 0..256 { let mut runner = TestRunner::default(); @@ -708,7 +756,7 @@ fn test_map() { // Only 8 possible keys let input = hash_map("[ab]{3}", "a", 2..3); - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); for _ in 0..256 { let v = input.new_tree(&mut runner).unwrap().current(); @@ -721,7 +769,7 @@ fn test_set() { // Only 8 possible values let input = hash_set("[ab]{3}", 2..3); - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); for _ in 0..256 { let v = input.new_tree(&mut runner).unwrap().current(); diff -Nru cargo-0.35.0/vendor/proptest/src/lib.rs cargo-0.37.0/vendor/proptest/src/lib.rs --- cargo-0.35.0/vendor/proptest/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,1643 +7,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! Proptest is a property testing framework (i.e., the QuickCheck family) -//! inspired by the [Hypothesis](http://hypothesis.works/) framework for -//! Python. It allows to test that certain properties of your code hold for -//! arbitrary inputs, and if a failure is found, automatically finds the -//! minimal test case to reproduce the problem. Unlike QuickCheck, generation -//! and shrinking is defined on a per-value basis instead of per-type, which -//! makes it more flexible and simplifies composition. +//! # Proptest Reference Documentation //! -//! If you have dependencies which provide QuickCheck `Arbitrary` -//! implementations, see also the related -//! [`proptest-quickcheck-interop`](https://crates.io/crates/proptest-quickcheck-interop) -//! crates which enables reusing those implementations with proptest. +//! This is the reference documentation for the proptest API. //! -//! -//! -//! ## Introduction -//! -//! _Property testing_ is a system of testing code by checking that certain -//! properties of its output or behaviour are fulfilled for all inputs. These -//! inputs are generated automatically, and, critically, when a failing input -//! is found, the input is automatically reduced to a _minimal_ test case. -//! -//! Property testing is best used to compliment traditional unit testing (i.e., -//! using specific inputs chosen by hand). Traditional tests can test specific -//! known edge cases, simple inputs, and inputs that were known in the past to -//! reveal bugs, whereas property tests will search for more complicated inputs -//! that cause problems. -//! -//! ## Getting Started -//! -//! Let's say we want to make a function that parses dates of the form -//! `YYYY-MM-DD`. We're not going to worry about _validating_ the date, any -//! triple of integers is fine. So let's bang something out real quick. -//! -//! ```rust,no_run -//! fn parse_date(s: &str) -> Option<(u32, u32, u32)> { -//! if 10 != s.len() { return None; } -//! if "-" != &s[4..5] || "-" != &s[7..8] { return None; } -//! -//! let year = &s[0..4]; -//! let month = &s[6..7]; -//! let day = &s[8..10]; -//! -//! year.parse::().ok().and_then( -//! |y| month.parse::().ok().and_then( -//! |m| day.parse::().ok().map( -//! |d| (y, m, d)))) -//! } -//! ``` -//! -//! It compiles, that means it works, right? Maybe not, let's add some tests. -//! -//! ```rust,ignore -//! #[test] -//! fn test_parse_date() { -//! assert_eq!(None, parse_date("2017-06-1")); -//! assert_eq!(None, parse_date("2017-06-170")); -//! assert_eq!(None, parse_date("2017006-17")); -//! assert_eq!(None, parse_date("2017-06017")); -//! assert_eq!(Some((2017, 06, 17)), parse_date("2017-06-17")); -//! } -//! ``` -//! -//! Tests pass, deploy to production! But now your application starts crashing, -//! and people are upset that you moved Christmas to February. Maybe we need to -//! be a bit more thorough. -//! -//! In `Cargo.toml`, add -//! -//! ```toml -//! [dev-dependencies] -//! proptest = "0.8.7" -//! ``` -//! -//! and at the top of `main.rs` or `lib.rs`: -//! -//! ```rust,ignore -//! #[macro_use] extern crate proptest; -//! ``` -//! -//! Now we can add some property tests to our date parser. But how do we test -//! the date parser for arbitrary inputs, without making another date parser in -//! the test to validate it? We won't need to as long as we choose our inputs -//! and properties correctly. But before correctness, there's actually an even -//! simpler property to test: _The function should not crash._ Let's start -//! there. -//! -//! ```rust,ignore -//! proptest! { -//! #[test] -//! fn doesnt_crash(s in "\\PC*") { -//! parse_date(s); -//! } -//! } -//! ``` -//! -//! What this does is take a literally random `&String` (ignore `\\PC*` for the -//! moment, we'll get back to that — if you've already figured it out, contain -//! your excitement for a bit) and give it to `parse_date()` and then throw the -//! output away. -//! -//! When we run this, we get a bunch of scary-looking output, eventually ending -//! with -//! -//! ```text -//! thread 'main' panicked at 'Test failed: byte index 4 is not a char boundary; it is inside 'ௗ' (bytes 2..5) of `aAௗ0㌀0`; minimal failing input: s = "aAௗ0㌀0" -//! successes: 102 -//! local rejects: 0 -//! global rejects: 0 -//! ' -//! ``` -//! -//! If we look at the top directory after the test fails, we'll see a new -//! `proptest-regressions` directory, which contains some files corresponding -//! to source files containing failing test cases. These are [_failure -//! persistence_](#failure-persistence) files. The first thing we should do is -//! add these to source control. -//! -//! ```text -//! $ git add proptest-regressions -//! ``` -//! -//! The next thing we should do is copy the failing case to a traditional unit -//! test since it has exposed a bug not similar to what we've tested in the -//! past. -//! -//! ```rust,ignore -//! #[test] -//! fn test_unicode_gibberish() { -//! assert_eq!(None, parse_date("aAௗ0㌀0")); -//! } -//! ``` -//! -//! Now, let's see what happened... we forgot about UTF-8! You can't just -//! blindly slice strings since you could split a character, in this case that -//! Tamil diacritic placed atop other characters in the string. -//! -//! In the interest of making the code changes as small as possible, we'll just -//! check that the string is ASCII and reject anything that isn't. -//! -//! ```rust,no_run -//! # use std::ascii::AsciiExt; //NOREADME -//! # // NOREADME -//! fn parse_date(s: &str) -> Option<(u32, u32, u32)> { -//! if 10 != s.len() { return None; } -//! -//! // NEW: Ignore non-ASCII strings so we don't need to deal with Unicode. -//! if !s.is_ascii() { return None; } -//! -//! if "-" != &s[4..5] || "-" != &s[7..8] { return None; } -//! -//! let year = &s[0..4]; -//! let month = &s[6..7]; -//! let day = &s[8..10]; -//! -//! year.parse::().ok().and_then( -//! |y| month.parse::().ok().and_then( -//! |m| day.parse::().ok().map( -//! |d| (y, m, d)))) -//! } -//! ``` -//! -//! The tests pass now! But we know there are still more problems, so let's -//! test more properties. -//! -//! Another property we want from our code is that it parses every valid date. -//! We can add another test to the `proptest!` section: -//! -//! ```rust,ignore -//! proptest! { -//! // snip... -//! -//! #[test] -//! fn parses_all_valid_dates(s in "[0-9]{4}-[0-9]{2}-[0-9]{2}") { -//! parse_date(s).unwrap(); -//! } -//! } -//! ``` -//! -//! The thing to the right-hand side of `in` is actually a *regular -//! expression*, and `s` is chosen from strings which match it. So in our -//! previous test, `"\\PC*"` was generating arbitrary strings composed of -//! arbitrary non-control characters. Now, we generate things in the YYYY-MM-DD -//! format. -//! -//! The new test passes, so let's move on to something else. -//! -//! The final property we want to check is that the dates are actually parsed -//! _correctly_. Now, we can't do this by generating strings — we'd end up just -//! reimplementing the date parser in the test! Instead, we start from the -//! expected output, generate the string, and check that it gets parsed back. -//! -//! ```rust,ignore -//! proptest! { -//! // snip... -//! -//! #[test] -//! fn parses_date_back_to_original(y in 0u32..10000, -//! m in 1u32..13, d in 1u32..32) { -//! let (y2, m2, d2) = parse_date( -//! &format!("{:04}-{:02}-{:02}", y, m, d)).unwrap(); -//! // prop_assert_eq! is basically the same as assert_eq!, but doesn't -//! // cause a bunch of panic messages to be printed on intermediate -//! // test failures. Which one to use is largely a matter of taste. -//! prop_assert_eq!((y, m, d), (y2, m2, d2)); -//! } -//! } -//! ``` -//! -//! Here, we see that besides regexes, we can use any expression which is a -//! `proptest::strategy::Strategy`, in this case, integer ranges. -//! -//! The test fails when we run it. Though there's not much output this time. -//! -//! ```text -//! thread 'main' panicked at 'Test failed: assertion failed: `(left == right)` (left: `(0, 10, 1)`, right: `(0, 0, 1)`) at examples/dateparser_v2.rs:46; minimal failing input: y = 0, m = 10, d = 1 -//! successes: 2 -//! local rejects: 0 -//! global rejects: 0 -//! ', examples/dateparser_v2.rs:33 -//! note: Run with `RUST_BACKTRACE=1` for a backtrace. -//! ``` -//! -//! The failing input is `(y, m, d) = (0, 10, 1)`, which is a rather specific -//! output. Before thinking about why this breaks the code, let's look at what -//! proptest did to arrive at this value. At the start of our test function, -//! insert -//! -//! ```rust,ignore -//! println!("y = {}, m = {}, d = {}", y, m, d); -//! ``` -//! -//! Running the test again, we get something like this: -//! -//! ```text -//! y = 2497, m = 8, d = 27 -//! y = 9641, m = 8, d = 18 -//! y = 7360, m = 12, d = 20 -//! y = 3680, m = 12, d = 20 -//! y = 1840, m = 12, d = 20 -//! y = 920, m = 12, d = 20 -//! y = 460, m = 12, d = 20 -//! y = 230, m = 12, d = 20 -//! y = 115, m = 12, d = 20 -//! y = 57, m = 12, d = 20 -//! y = 28, m = 12, d = 20 -//! y = 14, m = 12, d = 20 -//! y = 7, m = 12, d = 20 -//! y = 3, m = 12, d = 20 -//! y = 1, m = 12, d = 20 -//! y = 0, m = 12, d = 20 -//! y = 0, m = 6, d = 20 -//! y = 0, m = 9, d = 20 -//! y = 0, m = 11, d = 20 -//! y = 0, m = 10, d = 20 -//! y = 0, m = 10, d = 10 -//! y = 0, m = 10, d = 5 -//! y = 0, m = 10, d = 3 -//! y = 0, m = 10, d = 2 -//! y = 0, m = 10, d = 1 -//! ``` -//! -//! The test failure message said there were two successful cases; we see these -//! at the very top, `2497-08-27` and `9641-08-18`. The next case, -//! `7360-12-20`, failed. There's nothing immediately obviously special about -//! this date. Fortunately, proptest reduced it to a much simpler case. First, -//! it rapidly reduced the `y` input to `0` at the beginning, and similarly -//! reduced the `d` input to the minimum allowable value of `1` at the end. -//! Between those two, though, we see something different: it tried to shrink -//! `12` to `6`, but then ended up raising it back up to `10`. This is because -//! the `0000-06-20` and `0000-09-20` test cases _passed_. -//! -//! In the end, we get the date `0000-10-01`, which apparently gets parsed as -//! `0000-00-01`. Again, this failing case was added to the failure persistence -//! file, and we should add this as its own unit test: -//! -//! ```text -//! $ git add proptest-regressions -//! ``` -//! -//! ```rust,ignore -//! #[test] -//! fn test_october_first() { -//! assert_eq!(Some(0, 10, 1), parse_date("0000-10-01")); -//! } -//! ``` -//! -//! Now to figure out what's broken in the code. Even without the intermediate -//! input, we can say with reasonable confidence that the year and day parts -//! don't come into the picture since both were reduced to the minimum -//! allowable input. The month input was _not_, but was reduced to `10`. This -//! means we can infer that there's something special about `10` that doesn't -//! hold for `9`. In this case, that "special something" is being two digits -//! wide. In our code: -//! -//! ```rust,ignore -//! let month = &s[6..7]; -//! ``` -//! -//! We were off by one, and need to use the range `5..7`. After fixing this, -//! the test passes. -//! -//! The `proptest!` macro has some additional syntax, including for setting -//! configuration for things like the number of test cases to generate. See its -//! [documentation](macro.proptest.html) -//! for more details. -//! -//! There is a more in-depth tutorial -//! [further down](#in-depth-tutorial). -//! -//! ## Differences between QuickCheck and Proptest -//! -//! QuickCheck and Proptest are similar in many ways: both generate random -//! inputs for a function to check certain properties, and automatically shrink -//! inputs to minimal failing cases. -//! -//! The one big difference is that QuickCheck generates and shrinks values -//! based on type alone, whereas Proptest uses explicit `Strategy` objects. The -//! QuickCheck approach has a lot of disadvantages in comparison: -//! -//! - QuickCheck can only define one generator and shrinker per type. If you -//! need a custom generation strategy, you need to wrap it in a newtype and -//! implement traits on that by hand. In Proptest, you can define arbitrarily -//! many different strategies for the same type, and there are plenty built-in. -//! -//! - For the same reason, QuickCheck has a single "size" configuration that -//! tries to define the range of values generated. If you need an integer -//! between 0 and 100 and another between 0 and 1000, you probably need to do -//! another newtype. In Proptest, you can directly just express that you want a -//! `0..100` integer and a `0..1000` integer. -//! -//! - Types in QuickCheck are not easily composable. Defining `Arbitrary` and -//! `Shrink` for a new struct which is simply produced by the composition of -//! its fields requires implementing both by hand, including a bidirectional -//! mapping between the struct and a tuple of its fields. In Proptest, you can -//! make a tuple of the desired components and then `prop_map` it into the -//! desired form. Shrinking happens automatically in terms of the input types. -//! -//! - Because constraints on values cannot be expressed in QuickCheck, -//! generation and shrinking may lead to a lot of input rejections. Strategies -//! in Proptest are aware of simple constraints and do not generate or shrink -//! to values that violate them. -//! -//! The author of Hypothesis also has an [article on this -//! topic](http://hypothesis.works/articles/integrated-shrinking/). -//! -//! Of course, there's also some relative downsides that fall out of what -//! Proptest does differently: -//! -//! - Generating complex values in Proptest can be up to an order of magnitude -//! slower than in QuickCheck. This is because QuickCheck performs stateless -//! shrinking based on the output value, whereas Proptest must hold on to all -//! the intermediate states and relationships in order for its richer shrinking -//! model to work. -//! -//! ## Limitations of Property Testing -//! -//! Given infinite time, property testing will eventually explore the whole -//! input space to a test. However, time is not infinite, so only a randomly -//! sampled portion of the input space can be explored. This means that -//! property testing is extremely unlikely to find single-value edge cases in a -//! large space. For example, the following test will virtually always pass: -//! -//! ```rust -//! #[macro_use] extern crate proptest; -//! use proptest::prelude::*; -//! -//! proptest! { -//! # /* NOREADME -//! #[test] -//! # NOREADME */ -//! fn i64_abs_is_never_negative(a: i64) { -//! // This actually fails if a == i64::MIN, but randomly picking one -//! // specific value out of 2⁶⁴ is overwhelmingly unlikely. -//! assert!(a.abs() >= 0); -//! } -//! } -//! # // NOREADME -//! # fn main() { i64_abs_is_never_negative(); } // NOREADME -//! ``` -//! -//! Because of this, traditional unit testing with intelligently selected cases -//! is still necessary for many kinds of problems. -//! -//! Similarly, in some cases it can be hard or impossible to define a strategy -//! which actually produces useful inputs. A strategy of `.{1,4096}` may be -//! great to fuzz a C parser, but is highly unlikely to produce anything that -//! makes it to a code generator. -//! -//! ## Failure Persistence -//! -//! By default, when Proptest finds a failing test case, it _persists_ that -//! failing case in a file named after the source containing the failing test, -//! but in a separate directory tree rooted at `proptest-regressions`† . Later -//! runs of tests will replay those test cases before generating novel cases. -//! This ensures that the test will not fail on one run and then spuriously -//! pass on the next, and also exposes similar tests to the same -//! known-problematic input. -//! -//! († If you do not have an obvious source directory, you may instead find -//! files next to the source files, with a different extension.) -//! -//! It is recommended to check these files in to your source control so that -//! other test runners (e.g., collaborators or a CI system) also replay these -//! cases. -//! -//! Note that, by default, all tests in the same crate will share that one -//! persistence file. If you have a very large number of tests, it may be -//! desirable to separate them into smaller groups so the number of extra test -//! cases that get run is reduced. This can be done by adjusting the -//! `failure_persistence` flag on `Config`. -//! -//! There are two ways this persistence could theoretically be done. -//! -//! The immediately obvious option is to persist a representation of the value -//! itself, for example by using Serde. While this has some advantages, -//! particularly being resistant to changes like tweaking the input strategy, -//! it also has a lot of problems. Most importantly, there is no way to -//! determine whether any given value is actually within the domain of the -//! strategy that produces it. Thus, some (likely extremely fragile) mechanism -//! to ensure that the strategy that produced the value exactly matches the one -//! in use in a test case would be required. -//! -//! The other option is to store the _seed_ that was used to produce the -//! failing test case. This approach requires no support from the strategy or -//! the produced value. If the strategy in use differs from the one used to -//! produce failing case that was persisted, the seed may or may not produce -//! the problematic value, but nonetheless produces a valid value. Due to these -//! advantages, this is the approach Proptest uses. -//! -//! ## Forking and Timeouts -//! -//! By default, proptest tests are run in-process and are allowed to run for -//! however long it takes them. This is resource-efficient and produces the -//! nicest test output, and for many use cases is sufficient. However, problems -//! like overflowing the stack, aborting the process, or getting stuck in an -//! infinite will simply break the entire test process and prevent proptest -//! from determining a minimal reproducible case. -//! -//! As of version 0.7.1, proptest has optional "fork" and "timeout" features -//! (both enabled by default), which make it possible to run your test cases in -//! a subprocess and limit how long they may run. This is generally slower, -//! may make using a debugger more difficult, and makes test output harder to -//! interpret, but allows proptest to find and minimise test cases for these -//! situations as well. -//! -//! To enable these features, simply set the `fork` and/or `timeout` fields on -//! the `Config`. (Setting `timeout` implies `fork`.) -//! -//! Here is a simple example of using both features: -//! -//! ```rust -//! #[macro_use] extern crate proptest; -//! use proptest::prelude::*; -//! -//! // The worst possible way to calculate Fibonacci numbers -//! fn fib(n: u64) -> u64 { -//! if n <= 1 { -//! n -//! } else { -//! fib(n - 1) + fib(n - 2) -//! } -//! } -//! -//! proptest! { -//! #![proptest_config(ProptestConfig { -//! // Setting both fork and timeout is redundant since timeout implies -//! // fork, but both are shown for clarity. -//! fork: true, -//! timeout: 1000, -//! .. ProptestConfig::default() -//! })] -//! -//! # /* NOREADME -//! #[test] -//! # NOREADME */ -//! fn test_fib(n: u64) { -//! // For large n, this will variously run for an extremely long time, -//! // overflow the stack, or panic due to integer overflow. -//! assert!(fib(n) >= n); -//! } -//! } -//! # //NOREADME -//! # fn main() { } //NOREADME -//! ``` -//! -//! The exact value of the test failure depends heavily on the performance of -//! the host system, the rust version, and compiler flags, but on the system -//! where it was originally tested, it found that the maximum value that -//! `fib()` could handle was 39, despite having dozens of processes dump core -//! due to stack overflow or time out along the way. -//! -//! If you just want to run tests in subprocesses or with a timeout every now -//! and then, you can do that by setting the `PROPTEST_FORK` or -//! `PROPTEST_TIMEOUT` environment variables to alter the default -//! configuration. For example, on Unix, -//! -//! ```sh -//! # Run all the proptest tests in subprocesses with no timeout. -//! # Individual tests can still opt out by setting `fork: false` in their -//! # own configuration. -//! PROPTEST_FORK=true cargo test -//! # Run all the proptest tests in subprocesses with a 1 second timeout. -//! # Tests can still opt out or use a different timeout by setting `timeout: 0` -//! # or another timeout in their own configuration. -//! PROPTEST_TIMEOUT=1000 cargo test -//! ``` -//! -//! -//! -//! ## In-Depth Tutorial -//! -//! This tutorial will introduce proptest from the bottom up, starting from the -//! basic building blocks, in the hopes of making the model as a whole clear. -//! In particular, we'll start off without using the macros so that the macros -//! can later be understood in terms of what they expand into rather than -//! magic. But as a result, the first part is _not_ representative of how -//! proptest is normally used. If bottom-up isn't your style, you may wish to -//! skim the first few sections. -//! -//! Also note that the examples here focus on the usage of proptest itself, and -//! as such generally have trivial test bodies. In real code, you would -//! obviously have assertions and so forth in the test bodies. -//! -//! ### Strategy Basics -//! -//! The [_Strategy_](strategy/trait.Strategy.html) is the most fundamental -//! concept in proptest. A strategy defines two things: -//! -//! - How to generate random values of a particular type from a random number -//! generator. -//! -//! - How to "shrink" such values into "simpler" forms. -//! -//! Proptest ships with a substantial library of strategies. Some of these are -//! defined in terms of built-in types; for example, `0..100i32` is a strategy -//! to generate `i32`s between 0, inclusive, and 100, exclusive. As we've -//! already seen, strings are themselves strategies for generating strings -//! which match the former as a regular expression. -//! -//! Generating a value is a two-step process. First, a `TestRunner` is passed -//! to the `new_tree()` method of the `Strategy`; this returns a `ValueTree`, -//! which we'll look at in more detail momentarily. Calling the `current()` -//! method on the `ValueTree` produces the actual value. Knowing that, we can -//! put the pieces together and generate values. The below is the -//! `tutoral-strategy-play.rs` example: -//! -//! ```rust -//! extern crate proptest; -//! -//! use proptest::test_runner::TestRunner; -//! use proptest::strategy::{Strategy, ValueTree}; -//! -//! fn main() { -//! let mut runner = TestRunner::default(); -//! let int_val = (0..100i32).new_tree(&mut runner).unwrap(); -//! let str_val = "[a-z]{1,4}\\p{Cyrillic}{1,4}\\p{Greek}{1,4}" -//! .new_tree(&mut runner).unwrap(); -//! println!("int_val = {}, str_val = {}", -//! int_val.current(), str_val.current()); -//! } -//! ``` -//! -//! If you run this a few times, you'll get output similar to the following: -//! -//! ```text -//! $ target/debug/examples/tutorial-strategy-play -//! int_val = 99, str_val = vѨͿἕΌ -//! $ target/debug/examples/tutorial-strategy-play -//! int_val = 25, str_val = cwᵸійΉ -//! $ target/debug/examples/tutorial-strategy-play -//! int_val = 5, str_val = oegiᴫᵸӈᵸὛΉ -//! ``` -//! -//! This knowledge is sufficient to build an extremely primitive fuzzing test. -//! -//! ```rust,no_run -//! extern crate proptest; -//! -//! use proptest::test_runner::TestRunner; -//! use proptest::strategy::{Strategy, ValueTree}; -//! -//! fn some_function(v: i32) { -//! // Do a bunch of stuff, but crash if v > 500 -//! assert!(v <= 500); -//! } -//! -//! # /* -//! #[test] -//! # */ -//! fn some_function_doesnt_crash() { -//! let mut runner = TestRunner::default(); -//! for _ in 0..256 { -//! let val = (0..10000i32).new_tree(&mut runner).unwrap(); -//! some_function(val.current()); -//! } -//! } -//! # fn main() { } -//! ``` -//! -//! This _works_, but when the test fails, we don't get much context, and even -//! if we recover the input, we see some arbitrary-looking value like 1771 -//! rather than the boundary condition of 501. For a function taking just an -//! integer, this is probably still good enough, but as inputs get more -//! complex, interpreting completely random values becomes increasingly -//! difficult. -//! -//! ### Shrinking Basics -//! -//! Finding the "simplest" input that causes a test failure is referred to as -//! _shrinking_. This is where the intermediate `ValueTree` type comes in. -//! Besides `current()`, it provides two methods — `simplify()` and -//! `complicate()` — which together allow binary searching over the input -//! space. The `tutorial-simplify-play.rs` example shows how repeated calls to -//! `simplify()` produce incrementally "simpler" outputs, both in terms of size -//! and in characters used. -//! -//! ```rust -//! extern crate proptest; -//! -//! use proptest::test_runner::TestRunner; -//! use proptest::strategy::{Strategy, ValueTree}; -//! -//! fn main() { -//! let mut runner = TestRunner::default(); -//! let mut str_val = "[a-z]{1,4}\\p{Cyrillic}{1,4}\\p{Greek}{1,4}" -//! .new_tree(&mut runner).unwrap(); -//! println!("str_val = {}", str_val.current()); -//! while str_val.simplify() { -//! println!(" = {}", str_val.current()); -//! } -//! } -//! ``` -//! -//! A couple runs: -//! -//! ```text -//! $ target/debug/examples/tutorial-simplify-play -//! str_val = vy꙲ꙈᴫѱΆῨῨ -//! = y꙲ꙈᴫѱΆῨῨ -//! = y꙲ꙈᴫѱΆῨῨ -//! = m꙲ꙈᴫѱΆῨῨ -//! = g꙲ꙈᴫѱΆῨῨ -//! = d꙲ꙈᴫѱΆῨῨ -//! = b꙲ꙈᴫѱΆῨῨ -//! = a꙲ꙈᴫѱΆῨῨ -//! = aꙈᴫѱΆῨῨ -//! = aᴫѱΆῨῨ -//! = aѱΆῨῨ -//! = aѱΆῨῨ -//! = aѱΆῨῨ -//! = aиΆῨῨ -//! = aМΆῨῨ -//! = aЎΆῨῨ -//! = aЇΆῨῨ -//! = aЃΆῨῨ -//! = aЁΆῨῨ -//! = aЀΆῨῨ -//! = aЀῨῨ -//! = aЀῨ -//! = aЀῨ -//! = aЀῢ -//! = aЀ῟ -//! = aЀ῞ -//! = aЀ῝ -//! $ target/debug/examples/tutorial-simplify-play -//! str_val = dyiꙭᾪῇΊ -//! = yiꙭᾪῇΊ -//! = iꙭᾪῇΊ -//! = iꙭᾪῇΊ -//! = iꙭᾪῇΊ -//! = eꙭᾪῇΊ -//! = cꙭᾪῇΊ -//! = bꙭᾪῇΊ -//! = aꙭᾪῇΊ -//! = aꙖᾪῇΊ -//! = aꙋᾪῇΊ -//! = aꙅᾪῇΊ -//! = aꙂᾪῇΊ -//! = aꙁᾪῇΊ -//! = aꙀᾪῇΊ -//! = aꙀῇΊ -//! = aꙀΊ -//! = aꙀΊ -//! = aꙀΊ -//! = aꙀΉ -//! = aꙀΈ -//! ``` -//! -//! Note that shrinking never shrinks a value to something outside the range -//! the strategy describes. Notice the strings in the above example still match -//! the regular expression even in the end. An integer drawn from -//! `100..1000i32` will shrink towards zero, but will stop at 100 since that is -//! the minimum value. -//! -//! `simplify()` and `complicate()` can be used to adapt our primitive fuzz -//! test to actually find the boundary condition. -//! -//! ```rust -//! extern crate proptest; -//! -//! use proptest::test_runner::TestRunner; -//! use proptest::strategy::{Strategy, ValueTree}; -//! -//! fn some_function(v: i32) -> bool { -//! // Do a bunch of stuff, but crash if v > 500 -//! // assert!(v <= 500); -//! // But return a boolean instead of panicking for simplicity -//! v <= 500 -//! } -//! -//! // We know the function is broken, so use a purpose-built main function to -//! // find the breaking point. -//! fn main() { -//! let mut runner = TestRunner::default(); -//! for _ in 0..256 { -//! let mut val = (0..10000i32).new_tree(&mut runner).unwrap(); -//! if some_function(val.current()) { -//! // Test case passed -//! continue; -//! } -//! -//! // We found our failing test case, simplify it as much as possible. -//! loop { -//! if !some_function(val.current()) { -//! // Still failing, find a simpler case -//! if !val.simplify() { -//! // No more simplification possible; we're done -//! break; -//! } -//! } else { -//! // Passed this input, back up a bit -//! if !val.complicate() { -//! break; -//! } -//! } -//! } -//! -//! println!("The minimal failing case is {}", val.current()); -//! assert_eq!(501, val.current()); -//! return; -//! } -//! panic!("Didn't find a failing test case"); -//! } -//! ``` -//! -//! This code reliably finds the boundary of the failure, 501. -//! -//! ### Using the Test Runner -//! -//! The above is quite a bit of code though, and it can't handle things like -//! panics. Fortunately, proptest's -//! [`TestRunner`](test_runner/struct.TestRunner.html) provides this -//! functionality for us. The method we're interested in is `run`. We simply -//! give it the strategy and a function to test inputs and it takes care of the -//! rest. -//! -//! ```rust -//! extern crate proptest; -//! -//! use proptest::test_runner::{Config, FileFailurePersistence, -//! TestError, TestRunner}; -//! -//! fn some_function(v: i32) { -//! // Do a bunch of stuff, but crash if v > 500. -//! // We return to normal `assert!` here since `TestRunner` catches -//! // panics. -//! assert!(v <= 500); -//! } -//! -//! // We know the function is broken, so use a purpose-built main function to -//! // find the breaking point. -//! fn main() { -//! let mut runner = TestRunner::new(Config { -//! // Turn failure persistence off for demonstration -//! failure_persistence: Some(Box::new(FileFailurePersistence::Off)), -//! .. Config::default() -//! }); -//! let result = runner.run(&(0..10000i32), |v| { -//! some_function(v); -//! Ok(()) -//! }); -//! match result { -//! Err(TestError::Fail(_, value)) => { -//! println!("Found minimal failing case: {}", value); -//! assert_eq!(501, value); -//! }, -//! result => panic!("Unexpected result: {:?}", result), -//! } -//! } -//! ``` -//! -//! That's a lot better! Still a bit boilerplatey; the `proptest!` macro will -//! help with that, but it does some other stuff we haven't covered yet, so for -//! the moment we'll keep using `TestRunner` directly. -//! -//! ### Compound Strategies -//! -//! Testing functions that take single arguments of primitive types is nice and -//! all, but is kind of underwhelming. Back when we were writing the whole -//! stack by hand, extending the technique to, say, _two_ integers was clear, -//! if verbose. But `TestRunner` only takes a single `Strategy`; how can we -//! test a function that needs inputs from more than one? -//! -//! ```rust,ignore -//! use proptest::test_runner::TestRunner; -//! -//! fn add(a: i32, b: i32) -> i32 { -//! a + b -//! } -//! -//! # /* -//! #[test] -//! # */ -//! fn test_add() { -//! let mut runner = TestRunner::default(); -//! runner.run(/* uhhm... */).unwrap(); -//! } -//! # -//! # fn main() { test_add(); } -//! ``` -//! -//! The key is that strategies are _composable_. The simplest form of -//! composition is "compound strategies", where we take multiple strategies and -//! combine their values into one value that holds each input separately. There -//! are several of these. The simplest is a tuple; a tuple of strategies is -//! itself a strategy for tuples of the values those strategies produce. For -//! example, `(0..100i32,100..1000i32)` is a strategy for pairs of integers -//! where the first value is between 0 and 100 and the second is between 100 -//! and 1000. -//! -//! So for our two-argument function, our strategy is simply a tuple of ranges. -//! -//! ```rust -//! use proptest::test_runner::TestRunner; -//! -//! fn add(a: i32, b: i32) -> i32 { -//! a + b -//! } -//! -//! # /* -//! #[test] -//! # */ -//! fn test_add() { -//! let mut runner = TestRunner::default(); -//! // Combine our two inputs into a strategy for one tuple. Our test -//! // function then destructures the generated tuples back into separate -//! // `a` and `b` variables to be passed in to `add()`. -//! runner.run(&(0..1000i32, 0..1000i32), |(a, b)| { -//! let sum = add(a, b); -//! assert!(sum >= a); -//! assert!(sum >= b); -//! Ok(()) -//! }).unwrap(); -//! } -//! # -//! # fn main() { test_add(); } -//! ``` -//! -//! Other compound strategies include fixed-sizes arrays of strategies and -//! `Vec`s of strategies (which produce arrays or `Vec`s of values parallel to -//! the strategy collection), as well as the various strategies provided in the -//! [collection](collection/index.html) module. -//! -//! ### Syntax Sugar: `proptest!` -//! -//! Now that we know about compound strategies, we can understand how the -//! [`proptest!`](macro.proptest.html) macro works. Our example from the prior -//! section can be rewritten using that macro like so: -//! -//! ```rust -//! #[macro_use] extern crate proptest; -//! -//! fn add(a: i32, b: i32) -> i32 { -//! a + b -//! } -//! -//! proptest! { -//! # /* -//! #[test] -//! # */ -//! fn test_add(a in 0..1000i32, b in 0..1000i32) { -//! let sum = add(a, b); -//! assert!(sum >= a); -//! assert!(sum >= b); -//! } -//! } -//! # -//! # fn main() { test_add(); } -//! ``` -//! -//! Conceptually, the desugaring process is fairly simple. At the start of the -//! test function, a new `TestRunner` is constructed. The input strategies -//! (after the `in` keyword) are grouped into a tuple. That tuple is passed in -//! to the `TestRunner` as the input strategy. The test body has `Ok(())` added -//! to the end, then is put into a lambda that destructures the generated input -//! tuple back into the named parameters and then runs the body. The end result -//! is extremely similar to what we wrote by hand in the prior section. -//! -//! `proptest!` actually does a few other things in order to make failure -//! output easier to read and to overcome the 10-tuple limit. -//! -//! ### Transforming Strategies -//! -//! Suppose you have a function that takes a string which needs to be the -//! `Display` format of an arbitrary `u32`. A first attempt to providing this -//! argument might be to use a regular expression, like so: -//! -//! ```rust -//! #[macro_use] extern crate proptest; -//! -//! fn do_stuff(v: String) { -//! let i: u32 = v.parse().unwrap(); -//! let s = i.to_string(); -//! assert_eq!(s, v); -//! } -//! -//! proptest! { -//! # /* -//! #[test] -//! # */ -//! fn test_do_stuff(v in "[1-9][0-9]{0,8}") { -//! do_stuff(v); -//! } -//! } -//! # fn main() { test_do_stuff(); } -//! ``` -//! -//! This kind of works, but it has problems. For one, it does not explore the -//! whole `u32` space. It is possible to write a regular expression that does, -//! but such an expression is rather long, and also results in a pretty odd -//! distribution of values. The input also doesn't shrink correctly, since -//! proptest tries to shrink it in terms of a string rather than an integer. -//! -//! What you really want to do is generate a `u32` and then pass in its string -//! representation. One way to do this is to just take `u32` as an input to the -//! test and then transform it to a string within the test code. This approach -//! works fine, but isn't reusable or composable. Ideally, we could get a -//! _strategy_ that does this. -//! -//! The thing we're looking for is the first strategy _combinator_, `prop_map`. -//! We need to ensure `Strategy` is in scope to use it. -//! -//! ```rust -//! #[macro_use] extern crate proptest; -//! // Grab `Strategy` and a shorter namespace prefix -//! use proptest::prelude::*; -//! -//! fn do_stuff(v: String) { -//! let i: u32 = v.parse().unwrap(); -//! let s = i.to_string(); -//! assert_eq!(s, v); -//! } -//! -//! proptest! { -//! # /* -//! #[test] -//! # */ -//! fn test_do_stuff(v in any::().prop_map(|v| v.to_string())) { -//! do_stuff(v); -//! } -//! } -//! # fn main() { test_do_stuff(); } -//! ``` -//! -//! Calling `prop_map` on a `Strategy` creates a new strategy which transforms -//! every generated value using the provided function. Proptest retains the -//! relationship between the original `Strategy` and the transformed one; as a -//! result, shrinking occurs in terms of `u32`, even though we're generating a -//! `String`. -//! -//! `prop_map` is also the principal way to define strategies for new types, -//! since most types are simply composed of other, simpler values. -//! -//! Let's update our code so it takes a more interesting structure. -//! -//! -//! ```rust -//! #[macro_use] extern crate proptest; -//! use proptest::prelude::*; -//! -//! #[derive(Clone, Debug)] -//! struct Order { -//! id: String, -//! // Some other fields, though the test doesn't do anything with them -//! item: String, -//! quantity: u32, -//! } -//! -//! fn do_stuff(order: Order) { -//! let i: u32 = order.id.parse().unwrap(); -//! let s = i.to_string(); -//! assert_eq!(s, order.id); -//! } -//! -//! proptest! { -//! # /* -//! #[test] -//! # */ -//! fn test_do_stuff( -//! order in -//! (any::().prop_map(|v| v.to_string()), -//! "[a-z]*", 1..1000u32).prop_map( -//! |(id, item, quantity)| Order { id, item, quantity }) -//! ) { -//! do_stuff(order); -//! } -//! } -//! # fn main() { test_do_stuff(); } -//! ``` -//! -//! Notice how we were able to take the output from `prop_map` and put it in a -//! tuple, then call `prop_map` on _that_ tuple to produce yet another value. -//! -//! But that's quite a mouthful in the argument list. Fortunately, strategies -//! are normal values, so we can extract it to a function. -//! -//! ```rust -//! #[macro_use] extern crate proptest; -//! use proptest::prelude::*; -//! -//! // snip -//! # -//! # #[derive(Clone, Debug)] -//! # struct Order { -//! # id: String, -//! # // Some other fields, though the test doesn't do anything with them -//! # item: String, -//! # quantity: u32, -//! # } -//! # -//! # fn do_stuff(order: Order) { -//! # let i: u32 = order.id.parse().unwrap(); -//! # let s = i.to_string(); -//! # assert_eq!(s, order.id); -//! # } -//! -//! fn arb_order(max_quantity: u32) -> BoxedStrategy { -//! (any::().prop_map(|v| v.to_string()), -//! "[a-z]*", 1..max_quantity) -//! .prop_map(|(id, item, quantity)| Order { id, item, quantity }) -//! .boxed() -//! } -//! -//! proptest! { -//! # /* -//! #[test] -//! # */ -//! fn test_do_stuff(order in arb_order(1000)) { -//! do_stuff(order); -//! } -//! } -//! # fn main() { test_do_stuff(); } -//! ``` -//! -//! We `boxed()` the strategy in the function since otherwise the type would -//! not be nameable, and even if it were, it would be very hard to read or -//! write. Boxing a `Strategy` turns both it and its `ValueTree`s into trait -//! objects, which both makes the types simpler and can be used to mix -//! heterogeneous `Strategy` types as long as they produce the same value -//! types. -//! -//! The `arb_order()` function is also _parameterised_, which is another -//! advantage of extracting strategies to separate functions. In this case, if -//! we have a test that needs an `Order` with no more than a dozen items, we -//! can simply call `arb_order(12)` rather than needing to write out a whole -//! new strategy. -//! -//! We can also use `-> impl Strategy` instead to avoid the -//! overhead as in the following example. You should use `-> impl Strategy<..>` -//! unless you need the dynamic dispatch. -//! -//! ```rust -//! #[macro_use] extern crate proptest; -//! use proptest::prelude::*; -//! -//! // snip -//! # -//! # #[derive(Clone, Debug)] -//! # struct Order { -//! # id: String, -//! # // Some other fields, though the test doesn't do anything with them -//! # item: String, -//! # quantity: u32, -//! # } -//! # -//! -//! # fn do_stuff(order: Order) { -//! # let i: u32 = order.id.parse().unwrap(); -//! # let s = i.to_string(); -//! # assert_eq!(s, order.id); -//! # } -//! -//! fn arb_order(max_quantity: u32) -> impl Strategy { -//! (any::().prop_map(|v| v.to_string()), -//! "[a-z]*", 1..max_quantity) -//! .prop_map(|(id, item, quantity)| Order { id, item, quantity }) -//! } -//! -//! proptest! { -//! # /* -//! #[test] -//! # */ -//! fn test_do_stuff(order in arb_order(1000)) { -//! do_stuff(order); -//! } -//! } -//! -//! # fn main() { test_do_stuff(); } -//! ``` -//! -//! ### Syntax Sugar: `prop_compose!` -//! -//! Defining strategy-returning functions like this is extremely useful, but -//! the code above is a bit verbose, as well as hard to read for similar -//! reasons to writing test functions by hand. -//! -//! To simplify this task, proptest includes the -//! [`prop_compose!`](macro.prop_compose.html) macro. Before going into -//! details, here's our code from above rewritten to use it. -//! -//! ```rust -//! #[macro_use] extern crate proptest; -//! use proptest::prelude::*; -//! -//! // snip -//! # -//! # #[derive(Clone, Debug)] -//! # struct Order { -//! # id: String, -//! # // Some other fields, though the test doesn't do anything with them -//! # item: String, -//! # quantity: u32, -//! # } -//! # -//! # fn do_stuff(order: Order) { -//! # let i: u32 = order.id.parse().unwrap(); -//! # let s = i.to_string(); -//! # assert_eq!(s, order.id); -//! # } -//! -//! prop_compose! { -//! fn arb_order_id()(id in any::()) -> String { -//! id.to_string() -//! } -//! } -//! prop_compose! { -//! fn arb_order(max_quantity: u32) -//! (id in arb_order_id(), item in "[a-z]*", -//! quantity in 1..max_quantity) -//! -> Order { -//! Order { id, item, quantity } -//! } -//! } -//! -//! proptest! { -//! # /* -//! #[test] -//! # */ -//! fn test_do_stuff(order in arb_order(1000)) { -//! do_stuff(order); -//! } -//! } -//! # fn main() { test_do_stuff(); } -//! ``` -//! -//! We had to extract `arb_order_id()` out into its own function, but otherwise -//! this desugars to almost exactly what we wrote in the previous section. The -//! generated function takes the first parameter list as arguments. These -//! arguments are used to select the strategies in the second argument list. -//! Values are then drawn from those strategies and transformed by the function -//! body. The actual function has a return type of `impl Strategy` -//! where `T` is the declared return type. -//! -//! ### Generating Enums -//! -//! The syntax sugar for defining strategies for `enum`s is currently somewhat -//! limited. Creating such strategies with `prop_compose!` is possible but -//! generally is not very readable, so in most cases defining the function by -//! hand is preferable. -//! -//! The core building block is the [`prop_oneof!`](macro.prop_oneof.html) -//! macro, in which you list one case for each case in your `enum`. For `enum`s -//! which have no data, the strategy for each case is -//! `Just(YourEnum::TheCase)`. Enum cases with data generally require putting -//! the data in a tuple and then using `prop_map` to map it into the enum case. -//! -//! Here is a simple example: -//! -//! ```rust,no_run -//! #[macro_use] extern crate proptest; -//! use proptest::prelude::*; -//! -//! #[derive(Debug, Clone)] -//! enum MyEnum { -//! SimpleCase, -//! CaseWithSingleDatum(u32), -//! CaseWithMultipleData(u32, String), -//! } -//! -//! fn my_enum_strategy() -> impl Strategy { -//! prop_oneof![ -//! // For cases without data, `Just` is all you need -//! Just(MyEnum::SimpleCase), -//! -//! // For cases with data, write a strategy for the interior data, then -//! // map into the actual enum case. -//! any::().prop_map(MyEnum::CaseWithSingleDatum), -//! -//! (any::(), ".*").prop_map( -//! |(a, b)| MyEnum::CaseWithMultipleData(a, b)), -//! ] -//! } -//! # -//! # fn main() { } -//! ``` -//! -//! In general, it is best to list the enum cases in order from "simplest" to -//! "most complex", since shrinking will shrink down toward items earlier in -//! the list. -//! -//! For particularly complex enum cases, it can be helpful to extract the -//! strategy for that case to a separate strategy. Here, -//! [`prop_compose!`](macro.prop_compose.html) can be of use. -//! -//! ```rust,no_run -//! #[macro_use] extern crate proptest; -//! use proptest::prelude::*; -//! -//! #[derive(Debug, Clone)] -//! enum MyComplexEnum { -//! SimpleCase, -//! AnotherSimpleCase, -//! ComplexCase { -//! product_code: String, -//! id: u64, -//! chapter: String, -//! }, -//! } -//! -//! prop_compose! { -//! fn my_complex_enum_complex_case()( -//! product_code in "[0-9A-Z]{10,20}", -//! id in 1u64..10000u64, -//! chapter in "X{0,2}(V?I{1,3}|IV|IX)", -//! ) -> MyComplexEnum { -//! MyComplexEnum::ComplexCase { product_code, id, chapter } -//! } -//! } -//! -//! fn my_enum_strategy() -> BoxedStrategy { -//! prop_oneof![ -//! Just(MyComplexEnum::SimpleCase), -//! Just(MyComplexEnum::AnotherSimpleCase), -//! my_complex_enum_complex_case(), -//! ].boxed() -//! } -//! # -//! # fn main() { } -//! ``` -//! -//! ### Filtering -//! -//! Sometimes, you have a case where your input values have some sort of -//! "irregular" constraint on them. For example, an integer needing to be even, -//! or two values needing to be non-equal. -//! -//! In general, the ideal solution is to find a way to take a seed value and -//! then use `prop_map` to transform it into the desired, irregular domain. For -//! example, to generate even integers, use something like -//! -//! ```rust,no_run -//! # #[macro_use] extern crate proptest; -//! prop_compose! { -//! // Generate arbitrary integers up to half the maximum desired value, -//! // then multiply them by 2, thus producing only even integers in the -//! // desired range. -//! fn even_integer(max: i32)(base in 0..max/2) -> i32 { base * 2 } -//! } -//! # fn main() { } -//! ``` -//! -//! For the cases where this is not viable, it is possible to filter -//! strategies. Proptest actually divides filters into two categories: -//! -//! - "Local" filters apply to a single strategy. If a value is rejected, -//! a new value is drawn from that strategy only. -//! -//! - "Global" filters apply to the whole test case. If the test case is -//! rejected, the whole thing is regenerated. -//! -//! The distinction is somewhat arbitrary, since something like a "global -//! filter" could be created by just putting a "local filter" around the whole -//! input strategy. In practise, the distinction is as to what code performs -//! the rejection. -//! -//! A local filter is created with the `prop_filter` combinator. Besides a -//! function indicating whether to accept the value, it also takes a value of -//! type `&'static str`, `String`, .., which it uses to record where/why the -//! rejection happened. -//! -//! ```rust -//! #[macro_use] extern crate proptest; -//! use proptest::prelude::*; -//! -//! proptest! { -//! # /* -//! #[test] -//! # */ -//! fn some_test( -//! v in (0..1000u32) -//! .prop_filter("Values must not divisible by 7 xor 11", -//! |v| !((0 == v % 7) ^ (0 == v % 11))) -//! ) { -//! assert_eq!(0 == v % 7, 0 == v % 11); -//! } -//! } -//! # fn main() { some_test(); } -//! ``` -//! -//! Global filtering results when a test itself returns -//! `Err(TestCaseError::Reject)`. The [`prop_assume!`](macro.prop_assume.html) -//! macro provides an easy way to do this. -//! -//! ```rust -//! #[macro_use] extern crate proptest; -//! -//! fn frob(a: i32, b: i32) -> (i32, i32) { -//! let d = (a - b).abs(); -//! (a / d, b / d) -//! } -//! -//! proptest! { -//! # /* -//! #[test] -//! # */ -//! fn test_frob(a in -1000..1000, b in -1000..1000) { -//! // Input illegal if a==b. -//! // Equivalent to -//! // if (a == b) { return Err(TestCaseError::Reject(...)); } -//! prop_assume!(a != b); -//! -//! let (a2, b2) = frob(a, b); -//! assert!(a2.abs() <= a.abs()); -//! assert!(b2.abs() <= b.abs()); -//! } -//! } -//! # fn main() { test_frob(); } -//! ``` -//! -//! While useful, filtering has a lot of disadvantages: -//! -//! - Since it is simply rejection sampling, it will slow down generation of -//! test cases since values need to be generated additional times to satisfy -//! the filter. In the case where a filter always returns false, a test could -//! theoretically never generate a result. -//! -//! - Proptest tracks how many local and global rejections have happened, and -//! aborts if they exceed a certain number. This prevents a test taking an -//! extremely long time due to rejections, but means not all filters are viable -//! in the default configuration. The limits for local and global rejections -//! are different; by default, proptest allows a large number of local -//! rejections but a fairly small number of global rejections, on the premise -//! that the former are cheap but potentially common (having been built into -//! the strategy) but the latter are expensive but rare (being an edge case in -//! the particular test). -//! -//! - Shrinking and filtering do not play well together. When shrinking, if a -//! value winds up being rejected, there is no pass/fail information to -//! continue shrinking properly. Instead, proptest treats such a rejection the -//! same way it handles a shrink that results in a passing test: by backing -//! away from simplification with a call to `complicate()`. Thus encountering a -//! filter rejection during shrinking prevents shrinking from continuing to any -//! simpler values, even if there are some that would be accepted by the -//! filter. -//! -//! ### Generating Recursive Data -//! [generating-recursive-data]: #generating-recursive-data -//! -//! Randomly generating recursive data structures is trickier than it sounds. -//! For example, the below is a naïve attempt at generating a JSON AST by using -//! recursion. This also uses the [`prop_oneof!`](macro.prop_oneof.html), which -//! we haven't seen yet but should be self-explanatory. -//! -//! ```rust,no_run -//! #[macro_use] extern crate proptest; -//! -//! use std::collections::HashMap; -//! use proptest::prelude::*; -//! -//! #[derive(Clone, Debug)] -//! enum Json { -//! Null, -//! Bool(bool), -//! Number(f64), -//! String(String), -//! Array(Vec), -//! Map(HashMap), -//! } -//! -//! fn arb_json() -> impl Strategy { -//! prop_oneof![ -//! Just(Json::Null), -//! any::().prop_map(Json::Bool), -//! any::().prop_map(Json::Number), -//! ".*".prop_map(Json::String), -//! prop::collection::vec(arb_json(), 0..10).prop_map(Json::Array), -//! prop::collection::hash_map( -//! ".*", arb_json(), 0..10).prop_map(Json::Map), -//! ] -//! } -//! # fn main() { } -//! ``` -//! -//! Upon closer consideration, this obviously can't work because `arb_json()` -//! recurses unconditionally. -//! -//! A more sophisticated attempt is to define one strategy for each level of -//! nesting up to some maximum. This doesn't overflow the stack, but as defined -//! here, even four levels of nesting will produce trees with _thousands_ of -//! nodes; by eight levels, we get to tens of _millions_. -//! -//! Proptest provides a more reliable solution in the form of the -//! `prop_recursive` combinator. To use this, we create a strategy for the -//! non-recursive case, then give the combinator that strategy, some size -//! parameters, and a function to transform a nested strategy into a recursive -//! strategy. -//! -//! ```rust -//! #[macro_use] extern crate proptest; -//! -//! use std::collections::HashMap; -//! use proptest::prelude::*; -//! -//! #[derive(Clone, Debug)] -//! enum Json { -//! Null, -//! Bool(bool), -//! Number(f64), -//! String(String), -//! Array(Vec), -//! Map(HashMap), -//! } -//! -//! fn arb_json() -> impl Strategy { -//! let leaf = prop_oneof![ -//! Just(Json::Null), -//! any::().prop_map(Json::Bool), -//! any::().prop_map(Json::Number), -//! ".*".prop_map(Json::String), -//! ]; -//! leaf.prop_recursive( -//! 8, // 8 levels deep -//! 256, // Shoot for maximum size of 256 nodes -//! 10, // We put up to 10 items per collection -//! |inner| prop_oneof![ -//! // Take the inner strategy and make the two recursive cases. -//! prop::collection::vec(inner.clone(), 0..10) -//! .prop_map(Json::Array), -//! prop::collection::hash_map(".*", inner, 0..10) -//! .prop_map(Json::Map), -//! ]) -//! } -//! # fn main() { } -//! ``` -//! -//! ### Higher-Order Strategies -//! -//! A _higher-order strategy_ is a strategy which is generated by another -//! strategy. That sounds kind of scary, so let's consider an example first. -//! -//! Say you have a function you want to test that takes a slice and an index -//! into that slice. If we use a fixed size for the slice, it's easy, but maybe -//! we need to test with different slice sizes. We could try something with a -//! filter: -//! -//! ```rust,ignore -//! fn some_function(stuff: &[String], index: usize) { /* do stuff */ } -//! -//! proptest! { -//! #[test] -//! fn test_some_function( -//! stuff in prop::collection::vec(".*", 1..100), -//! index in 0..100usize -//! ) { -//! prop_assume!(index < stuff.len()); -//! some_function(stuff, index); -//! } -//! } -//! ``` -//! -//! This doesn't work very well. First off, you get a lot of global rejections -//! since `index` will be outside of `stuff` 50% of the time. But secondly, it -//! will be rare to actually get a small `stuff` vector, since it would have to -//! randomly choose a small `index` at the same time. -//! -//! The solution is the `prop_flat_map` combinator. This is sort of like -//! `prop_map`, except that the transform returns a _strategy_ instead of a -//! value. This is more easily understood by implementing our example: -//! -//! ```rust -//! #[macro_use] extern crate proptest; -//! use proptest::prelude::*; -//! -//! fn some_function(stuff: Vec, index: usize) { -//! let _ = &stuff[index]; -//! // Do stuff -//! } -//! -//! fn vec_and_index() -> impl Strategy, usize)> { -//! prop::collection::vec(".*", 1..100) -//! .prop_flat_map(|vec| { -//! let len = vec.len(); -//! (Just(vec), 0..len) -//! }) -//! } -//! -//! proptest! { -//! # /* -//! #[test] -//! # */ -//! fn test_some_function((vec, index) in vec_and_index()) { -//! some_function(vec, index); -//! } -//! } -//! # fn main() { test_some_function(); } -//! ``` -//! -//! In `vec_and_index()`, we make a strategy to produce an arbitrary vector. -//! But then we derive a new strategy based on _values_ produced by the first -//! one. The new strategy produces the generated vector unchanged, but also -//! adds a valid index into that vector, which we can do by picking the -//! strategy for that index based on the size of the vector. -//! -//! Even though the new strategy specifies the singleton `Just(vec)` strategy -//! for the vector, proptest still understands the connection to the original -//! strategy and will shrink `vec` as well. All the while, `index` continues to -//! be a valid index into `vec`. -//! -//! `prop_compose!` actually allows making second-order strategies like this by -//! simply providing three argument lists instead of two. The below desugars to -//! something much like what we wrote by hand above, except that the index and -//! vector's positions are internally reversed due to borrowing limitations. -//! -//! ```rust,no_run -//! # #[macro_use] extern crate proptest; -//! # use proptest::prelude::*; -//! prop_compose! { -//! fn vec_and_index()(vec in prop::collection::vec(".*", 1..100)) -//! (index in 0..vec.len(), vec in Just(vec)) -//! -> (Vec, usize) { -//! (vec, index) -//! } -//! } -//! # fn main() { } -//! ``` -//! -//! ### Defining a canonical `Strategy` for a type -//! -//! We previously used the function `any` as in `any::()` to generate a -//! strategy for all `u32`s. This function works with the trait `Arbitrary`, -//! which QuickCheck users may be familiar with. In proptest, this trait -//! is already implemented for most owned types in the standard library, -//! but you can of course implement it for your own types. -//! -//! In some cases, where it makes sense to define a canonical strategy, such -//! as in the [JSON AST example][generating-recursive-data], it is a good -//! idea to implement `Arbitrary`. -//! -//! Stay tuned for more information about this. Soon you will be able to -//! derive `Arbitrary` for a lot of cases. -//! -//! ### Configuring the number of tests cases requried -//! -//! The default number of successful test cases that must execute for a test -//! as a whole to pass is currently 256. If you are not satisfied with this -//! and want to run more or fewer, there are a few ways to do this. -//! -//! The first way is to set the environment-variable `PROPTEST_CASES` to a -//! value that can be successfully parsed as a `u32`. The value you set to this -//! variable is now the new default. -//! -//! Another way is to use `#![proptest_config(expr)]` inside `proptest!` where -//! `expr : Config`. To only change the number of test cases, you can simply -//! write: -//! -//! ```rust -//! #[macro_use] extern crate proptest; -//! use proptest::test_runner::Config; -//! -//! fn add(a: i32, b: i32) -> i32 { a + b } -//! -//! proptest! { -//! // The next line modifies the number of tests. -//! #![proptest_config(Config::with_cases(1000))] -//! # /* -//! #[test] -//! # */ -//! fn test_add(a in 0..1000i32, b in 0..1000i32) { -//! let sum = add(a, b); -//! assert!(sum >= a); -//! assert!(sum >= b); -//! } -//! } -//! # -//! # fn main() { test_add(); } -//! ``` -//! -//! Through the same `proptest_config` mechanism you may fine-tune your -//! configuration through the `Config` type. See its documentation for more -//! information. -//! -//! ### Conclusion -//! -//! That's it for the tutorial, at least for now. There are more details for -//! the features discussed above on their individual documentation pages, and -//! you can find out about all the strategies provided out-of-the-box by -//! perusing the module tree below. +//! For documentation on how to get started with proptest and general usage +//! advice, please refer to the [Proptest Book](https://altsysrq.github.io/proptest-book/intro.html). #![deny(missing_docs, bare_trait_objects)] #![no_std] @@ -1652,29 +21,26 @@ // We have a lot of these lints for associated types... And we don't care. type_complexity ))] -#![cfg_attr(feature = "unstable", feature( - allocator_api, - try_trait, - generator_trait, - try_from, - integer_atomics, - never_type, - try_reserve -))] -#![cfg_attr(all(feature = "std", feature = "unstable"), feature( - mpsc_select, - ip -))] -#![cfg_attr(all(feature = "alloc", not(feature = "std")), feature( - alloc, - core_intrinsics -))] - -// FIXME: remove this after refactoring! -#![allow(renamed_and_removed_lints)] +#![cfg_attr( + feature = "unstable", + feature( + allocator_api, + try_trait, + generator_trait, + never_type, + try_reserve + ) +)] +#![cfg_attr(all(feature = "std", feature = "unstable"), feature(ip))] +#![cfg_attr( + all(feature = "alloc", not(feature = "std")), + feature(alloc, core_intrinsics) +)] +// std_facade is used in a few macros, so it needs to be public. #[macro_use] -mod std_facade; +#[doc(hidden)] +pub mod std_facade; #[cfg(any(feature = "std", test))] #[macro_use] @@ -1684,11 +50,6 @@ #[macro_use] extern crate alloc; -//#[cfg(all(feature = "alloc", not(feature = "std")))] -//extern crate hashmap_core; - -extern crate byteorder; - #[cfg(feature = "frunk")] #[macro_use] extern crate frunk_core; @@ -1705,30 +66,20 @@ extern crate bitflags; #[cfg(feature = "bit-set")] extern crate bit_set; + +#[cfg(feature = "std")] #[macro_use] extern crate lazy_static; -extern crate num_traits; - // Only required for the string module. #[cfg(feature = "std")] #[macro_use] extern crate quick_error; -// Only required for the string module. -#[cfg(feature = "std")] -extern crate regex_syntax; -extern crate rand; #[cfg(feature = "fork")] #[macro_use] extern crate rusty_fork; -#[cfg(feature = "fork")] -extern crate tempfile; - -#[cfg(test)] -extern crate regex; - #[macro_use] mod macros; diff -Nru cargo-0.35.0/vendor/proptest/src/macros.rs cargo-0.37.0/vendor/proptest/src/macros.rs --- cargo-0.35.0/vendor/proptest/src/macros.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/macros.rs 2019-07-17 05:42:23.000000000 +0000 @@ -19,7 +19,7 @@ #[derive(Clone, Copy, Debug)] $($vis)* struct $name; $(#[$allmeta])* - impl $($gen)* ::strategy::statics::MapFn<$input> for $name { + impl $($gen)* $crate::strategy::statics::MapFn<$input> for $name { type Output = $output; fn apply(&self, $parm: $input) -> $output { $($body)* diff -Nru cargo-0.35.0/vendor/proptest/src/num.rs cargo-0.37.0/vendor/proptest/src/num.rs --- cargo-0.35.0/vendor/proptest/src/num.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/num.rs 2019-07-17 05:42:23.000000000 +0000 @@ -12,19 +12,23 @@ //! //! All strategies in this module shrink by binary searching towards 0. -use rand::distributions::{Distribution, Standard}; -use rand::distributions::uniform::{Uniform, SampleUniform}; +use crate::test_runner::TestRunner; use core::ops::Range; -use test_runner::TestRunner; +use rand::distributions::uniform::{SampleUniform, Uniform}; +use rand::distributions::{Distribution, Standard}; -pub(crate) fn sample_uniform - (run: &mut TestRunner, range: Range) -> X { +pub(crate) fn sample_uniform( + run: &mut TestRunner, + range: Range, +) -> X { Uniform::new(range.start, range.end).sample(run.rng()) } -pub(crate) fn sample_uniform_incl - (run: &mut TestRunner, start: X, end: X) -> X -{ +pub(crate) fn sample_uniform_incl( + run: &mut TestRunner, + start: X, + end: X, +) -> X { Uniform::new_inclusive(start, end).sample(run.rng()) } @@ -46,7 +50,7 @@ Ok(BinarySearch::new(runner.rng().gen())) } } - } + }; } macro_rules! numeric_api { @@ -59,7 +63,8 @@ Ok(BinarySearch::new_clamped( self.start, $crate::num::sample_uniform(runner, self.clone()), - self.end - $epsilon)) + self.end - $epsilon, + )) } } @@ -70,8 +75,13 @@ fn new_tree(&self, runner: &mut TestRunner) -> NewTree { Ok(BinarySearch::new_clamped( *self.start(), - $crate::num::sample_uniform_incl(runner, *self.start(), *self.end()), - *self.end())) + $crate::num::sample_uniform_incl( + runner, + *self.start(), + *self.end(), + ), + *self.end(), + )) } } @@ -83,8 +93,12 @@ Ok(BinarySearch::new_clamped( self.start, $crate::num::sample_uniform_incl( - runner, self.start, ::core::$typ::MAX), - ::core::$typ::MAX)) + runner, + self.start, + ::core::$typ::MAX, + ), + ::core::$typ::MAX, + )) } } @@ -96,8 +110,11 @@ Ok(BinarySearch::new_clamped( ::core::$typ::MIN, $crate::num::sample_uniform( - runner, ::core::$typ::MIN..self.end), - self.end)) + runner, + ::core::$typ::MIN..self.end, + ), + self.end, + )) } } @@ -109,12 +126,15 @@ Ok(BinarySearch::new_clamped( ::core::$typ::MIN, $crate::num::sample_uniform_incl( - runner, ::core::$typ::MIN, self.end), - self.end + runner, + ::core::$typ::MIN, + self.end, + ), + self.end, )) } } - } + }; } macro_rules! signed_integer_bin_search { @@ -123,8 +143,8 @@ pub mod $typ { use rand::Rng; - use strategy::*; - use test_runner::TestRunner; + use crate::strategy::*; + use crate::test_runner::TestRunner; int_any!($typ); @@ -150,10 +170,14 @@ /// on the other side of `lo` or `hi` from `start`. `lo` is /// inclusive, `hi` is exclusive. fn new_clamped(lo: $typ, start: $typ, hi: $typ) -> Self { - use core::cmp::{min, max}; + use core::cmp::{max, min}; BinarySearch { - lo: if start < 0 { min(0, hi-1) } else { max(0, lo) }, + lo: if start < 0 { + min(0, hi - 1) + } else { + max(0, lo) + }, hi: start, curr: start, } @@ -163,7 +187,7 @@ // Won't ever overflow since lo starts at 0 and advances // towards hi. let interval = self.hi - self.lo; - let new_mid = self.lo + interval/2; + let new_mid = self.lo + interval / 2; if new_mid == self.curr { false @@ -204,11 +228,7 @@ return false; } - self.lo = self.curr + if self.hi < 0 { - -1 - } else { - 1 - }; + self.lo = self.curr + if self.hi < 0 { -1 } else { 1 }; self.reposition() } @@ -216,7 +236,7 @@ numeric_api!($typ, 1); } - } + }; } macro_rules! unsigned_integer_bin_search { @@ -225,8 +245,8 @@ pub mod $typ { use rand::Rng; - use strategy::*; - use test_runner::TestRunner; + use crate::strategy::*; + use crate::test_runner::TestRunner; int_any!($typ); @@ -266,7 +286,7 @@ fn reposition(&mut self) -> bool { let interval = self.hi - self.lo; - let new_mid = self.lo + interval/2; + let new_mid = self.lo + interval / 2; if new_mid == self.curr { false @@ -284,14 +304,18 @@ } fn simplify(&mut self) -> bool { - if self.hi <= self.lo { return false; } + if self.hi <= self.lo { + return false; + } self.hi = self.curr; self.reposition() } fn complicate(&mut self) -> bool { - if self.hi <= self.lo { return false; } + if self.hi <= self.lo { + return false; + } self.lo = self.curr + 1; self.reposition() @@ -300,19 +324,21 @@ numeric_api!($typ, 1); } - } + }; } signed_integer_bin_search!(i8); signed_integer_bin_search!(i16); signed_integer_bin_search!(i32); signed_integer_bin_search!(i64); +#[cfg(not(target_arch = "wasm32"))] signed_integer_bin_search!(i128); signed_integer_bin_search!(isize); unsigned_integer_bin_search!(u8); unsigned_integer_bin_search!(u16); unsigned_integer_bin_search!(u32); unsigned_integer_bin_search!(u64); +#[cfg(not(target_arch = "wasm32"))] unsigned_integer_bin_search!(u128); unsigned_integer_bin_search!(usize); @@ -343,9 +369,14 @@ self |= FloatTypes::POSITIVE; } - if !self.intersects(FloatTypes::NORMAL | FloatTypes::SUBNORMAL | - FloatTypes::ZERO | FloatTypes::INFINITE | - FloatTypes::QUIET_NAN | FloatTypes::SIGNALING_NAN) { + if !self.intersects( + FloatTypes::NORMAL + | FloatTypes::SUBNORMAL + | FloatTypes::ZERO + | FloatTypes::INFINITE + | FloatTypes::QUIET_NAN + | FloatTypes::SIGNALING_NAN, + ) { self |= FloatTypes::NORMAL; } self @@ -367,19 +398,19 @@ impl FloatLayout for f32 { type Bits = u32; - const SIGN_MASK: u32 = 0x8000_0000; - const EXP_MASK: u32 = 0x7F80_0000; - const EXP_ZERO: u32 = 0x3F80_0000; - const MANTISSA_MASK: u32 = 0x007F_FFFF; + const SIGN_MASK: u32 = 0x8000_0000; + const EXP_MASK: u32 = 0x7F80_0000; + const EXP_ZERO: u32 = 0x3F80_0000; + const MANTISSA_MASK: u32 = 0x007F_FFFF; } impl FloatLayout for f64 { type Bits = u64; - const SIGN_MASK: u64 = 0x8000_0000_0000_0000; - const EXP_MASK: u64 = 0x7FF0_0000_0000_0000; - const EXP_ZERO: u64 = 0x3FF0_0000_0000_0000; - const MANTISSA_MASK: u64 = 0x000F_FFFF_FFFF_FFFF; + const SIGN_MASK: u64 = 0x8000_0000_0000_0000; + const EXP_MASK: u64 = 0x7FF0_0000_0000_0000; + const EXP_ZERO: u64 = 0x3FF0_0000_0000_0000; + const MANTISSA_MASK: u64 = 0x000F_FFFF_FFFF_FFFF; } macro_rules! float_any { @@ -642,9 +673,9 @@ use rand::Rng; - use strategy::*; - use test_runner::TestRunner; - use super::{FloatTypes, FloatLayout}; + use super::{FloatLayout, FloatTypes}; + use crate::strategy::*; + use crate::test_runner::TestRunner; float_any!($typ); @@ -702,15 +733,21 @@ // Don't reposition if the new value is not allowed let class_allowed = match self.curr.classify() { Nan => - // We don't need to inspect whether the - // signallingness of the NaN matches the allowed - // set, as we never try to switch between them, - // instead shrinking to 0. - self.allowed.contains(FloatTypes::QUIET_NAN) || - self.allowed.contains(FloatTypes::SIGNALING_NAN), + // We don't need to inspect whether the + // signallingness of the NaN matches the allowed + // set, as we never try to switch between them, + // instead shrinking to 0. + { + self.allowed.contains(FloatTypes::QUIET_NAN) + || self + .allowed + .contains(FloatTypes::SIGNALING_NAN) + } Infinite => self.allowed.contains(FloatTypes::INFINITE), Zero => self.allowed.contains(FloatTypes::ZERO), - Subnormal => self.allowed.contains(FloatTypes::SUBNORMAL), + Subnormal => { + self.allowed.contains(FloatTypes::SUBNORMAL) + } Normal => self.allowed.contains(FloatTypes::NORMAL), }; let signum = self.curr.signum(); @@ -728,20 +765,19 @@ fn ensure_acceptable(&mut self) { while !self.current_allowed() { if !self.complicate_once() { - panic!("Unable to complicate floating-point back \ - to acceptable value"); + panic!( + "Unable to complicate floating-point back \ + to acceptable value" + ); } } } fn reposition(&mut self) -> bool { let interval = self.hi - self.lo; - let interval = if interval.is_finite() { - interval - } else { - 0.0 - }; - let new_mid = self.lo + interval/2.0; + let interval = + if interval.is_finite() { interval } else { 0.0 }; + let new_mid = self.lo + interval / 2.0; let new_mid = if new_mid == self.curr || 0.0 == interval { new_mid @@ -808,7 +844,7 @@ numeric_api!($typ, 0.0); } - } + }; } float_bin_search!(f32); @@ -816,14 +852,14 @@ #[cfg(test)] mod test { - use strategy::*; - use test_runner::*; + use crate::strategy::*; + use crate::test_runner::*; use super::*; #[test] fn u8_inclusive_end_included() { - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); let mut ok = 0; for _ in 0..20 { let tree = (0..=1).new_tree(&mut runner).unwrap(); @@ -840,7 +876,7 @@ #[test] fn u8_inclusive_to_end_included() { - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); let mut ok = 0; for _ in 0..20 { let tree = (..=1u8).new_tree(&mut runner).unwrap(); @@ -857,7 +893,7 @@ #[test] fn i8_binary_search_always_converges() { - fn assert_converges

bool>(start: i8, pass: P) { + fn assert_converges bool>(start: i8, pass: P) { let mut state = i8::BinarySearch::new(start); loop { if !pass(state.current() as i32) { @@ -872,12 +908,14 @@ } assert!(!pass(state.current() as i32)); - assert!(pass(state.current() as i32 - 1) || - pass(state.current() as i32 + 1)); + assert!( + pass(state.current() as i32 - 1) + || pass(state.current() as i32 + 1) + ); } for start in -128..0 { - for target in start+1..1 { + for target in start + 1..1 { assert_converges(start as i8, |v| v > target); } } @@ -891,7 +929,7 @@ #[test] fn u8_binary_search_always_converges() { - fn assert_converges

bool>(start: u8, pass: P) { + fn assert_converges bool>(start: u8, pass: P) { let mut state = u8::BinarySearch::new(start); loop { if !pass(state.current() as u32) { @@ -942,8 +980,11 @@ assert!(init_value < -42); while state.simplify() { - assert!(state.current() < -42, - "Violated bounds: {}", state.current()); + assert!( + state.current() < -42, + "Violated bounds: {}", + state.current() + ); } assert_eq!(-43, state.current()); @@ -959,8 +1000,11 @@ assert!(init_value >= 42); while state.simplify() { - assert!(state.current() >= 42, - "Violated bounds: {}", state.current()); + assert!( + state.current() >= 42, + "Violated bounds: {}", + state.current() + ); } assert_eq!(42, state.current()); @@ -976,8 +1020,11 @@ assert!(init_value >= 42 && init_value < 56); while state.simplify() { - assert!(state.current() >= 42, - "Violated bounds: {}", state.current()); + assert!( + state.current() >= 42, + "Violated bounds: {}", + state.current() + ); } assert_eq!(42, state.current()); @@ -988,7 +1035,7 @@ macro_rules! contract_sanity { ($t:tt) => { mod $t { - use strategy::check_strategy_sanity; + use crate::strategy::check_strategy_sanity; const FOURTY_TWO: $t = 42 as $t; const FIFTY_SIX: $t = 56 as $t; @@ -1018,7 +1065,7 @@ check_strategy_sanity(FOURTY_TWO.., None); } } - } + }; } contract_sanity!(u8); contract_sanity!(i8); @@ -1051,7 +1098,7 @@ let mut runner = TestRunner::default(); let mut value = (0.0f64..2.0).new_tree(&mut runner).unwrap(); - while value.simplify() { } + while value.simplify() {} assert_eq!(0.0, value.current()); } @@ -1061,7 +1108,7 @@ let mut runner = TestRunner::default(); let mut value = (1.0f64..2.0).new_tree(&mut runner).unwrap(); - while value.simplify() { } + while value.simplify() {} assert_eq!(1.0, value.current()); } @@ -1071,7 +1118,7 @@ let mut runner = TestRunner::default(); let mut value = (-2.0f64..0.0).new_tree(&mut runner).unwrap(); - while value.simplify() { } + while value.simplify() {} assert_eq!(0.0, value.current()); } @@ -1083,7 +1130,7 @@ let orig = value.current(); assert!(value.simplify()); - while value.complicate() { } + while value.complicate() {} assert_eq!(orig, value.current()); } @@ -1128,9 +1175,10 @@ fn float_simplifies_to_smallest_normal() { let mut runner = TestRunner::default(); let mut value = (::std::f64::MIN_POSITIVE..2.0) - .new_tree(&mut runner).unwrap(); + .new_tree(&mut runner) + .unwrap(); - while value.simplify() { } + while value.simplify() {} assert_eq!(::std::f64::MIN_POSITIVE, value.current()); } @@ -1150,7 +1198,7 @@ let mut seen_infinite = 0; let mut seen_quiet_nan = 0; let mut seen_signaling_nan = 0; - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); // Check whether this version of Rust honours the NaN payload in // from_bits @@ -1169,7 +1217,8 @@ if sign < 0.0 { prop_assert!(bits.contains(FloatTypes::NEGATIVE)); seen_negative += increment; - } else if sign > 0.0 { // i.e., not NaN + } else if sign > 0.0 { + // i.e., not NaN prop_assert!(bits.contains(FloatTypes::POSITIVE)); seen_positive += increment; } @@ -1180,33 +1229,39 @@ let is_negative = raw << 1 >> 1 != raw; if is_negative { prop_assert!( - bits.contains(FloatTypes::NEGATIVE)); + bits.contains(FloatTypes::NEGATIVE) + ); seen_negative += increment; } else { prop_assert!( - bits.contains(FloatTypes::POSITIVE)); + bits.contains(FloatTypes::POSITIVE) + ); seen_positive += increment; } - let is_quiet = - raw & ($typ::EXP_MASK >> 1) == - ::std::$typ::NAN.to_bits() & ($typ::EXP_MASK >> 1); + let is_quiet = raw & ($typ::EXP_MASK >> 1) + == ::std::$typ::NAN.to_bits() + & ($typ::EXP_MASK >> 1); if is_quiet { // x86/AMD64 turn signalling NaNs into quiet // NaNs quite aggressively depending on what // registers LLVM decides to use to pass the // value around, so accept either case here. prop_assert!( - bits.contains(FloatTypes::QUIET_NAN) || - bits.contains(FloatTypes::SIGNALING_NAN)); + bits.contains(FloatTypes::QUIET_NAN) + || bits.contains( + FloatTypes::SIGNALING_NAN + ) + ); seen_quiet_nan += increment; seen_signaling_nan += increment; } else { prop_assert!( - bits.contains(FloatTypes::SIGNALING_NAN)); + bits.contains(FloatTypes::SIGNALING_NAN) + ); seen_signaling_nan += increment; } - }, + } FpCategory::Nan => { // Since safe Rust doesn't currently allow @@ -1219,30 +1274,33 @@ seen_quiet_nan += increment; seen_signaling_nan += increment; prop_assert!( - bits.contains(FloatTypes::QUIET_NAN) || - bits.contains(FloatTypes::SIGNALING_NAN)); - }, + bits.contains(FloatTypes::QUIET_NAN) + || bits.contains(FloatTypes::SIGNALING_NAN) + ); + } FpCategory::Infinite => { prop_assert!(bits.contains(FloatTypes::INFINITE)); seen_infinite += increment; - }, + } FpCategory::Zero => { prop_assert!(bits.contains(FloatTypes::ZERO)); seen_zero += increment; - }, + } FpCategory::Subnormal => { prop_assert!(bits.contains(FloatTypes::SUBNORMAL)); seen_subnormal += increment; - }, + } FpCategory::Normal => { prop_assert!(bits.contains(FloatTypes::NORMAL)); seen_normal += increment; - }, + } } // Don't count simplified values towards the counts increment = 0; - if !tree.simplify() { break; } + if !tree.simplify() { + break; + } } } @@ -1270,22 +1328,22 @@ if bits.contains(FloatTypes::SIGNALING_NAN) { prop_assert!(seen_signaling_nan > 0); } - } + }; } proptest! { - #![proptest_config(::test_runner::Config::with_cases(1024))] + #![proptest_config(crate::test_runner::Config::with_cases(1024))] #[test] fn f32_any_generates_desired_values( - strategy in ::bits::u32::ANY.prop_map(f32::Any::from_bits) + strategy in crate::bits::u32::ANY.prop_map(f32::Any::from_bits) ) { float_generation_test_body!(strategy, f32); } #[test] fn f32_any_sanity( - strategy in ::bits::u32::ANY.prop_map(f32::Any::from_bits) + strategy in crate::bits::u32::ANY.prop_map(f32::Any::from_bits) ) { check_strategy_sanity(strategy, Some(CheckStrategySanityOptions { strict_complicate_after_simplify: false, @@ -1295,14 +1353,14 @@ #[test] fn f64_any_generates_desired_values( - strategy in ::bits::u32::ANY.prop_map(f64::Any::from_bits) + strategy in crate::bits::u32::ANY.prop_map(f64::Any::from_bits) ) { float_generation_test_body!(strategy, f64); } #[test] fn f64_any_sanity( - strategy in ::bits::u32::ANY.prop_map(f64::Any::from_bits) + strategy in crate::bits::u32::ANY.prop_map(f64::Any::from_bits) ) { check_strategy_sanity(strategy, Some(CheckStrategySanityOptions { strict_complicate_after_simplify: false, diff -Nru cargo-0.35.0/vendor/proptest/src/option.rs cargo-0.37.0/vendor/proptest/src/option.rs --- cargo-0.35.0/vendor/proptest/src/option.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/option.rs 2019-07-17 05:42:23.000000000 +0000 @@ -14,8 +14,8 @@ use core::fmt; use core::marker::PhantomData; -use strategy::*; -use test_runner::*; +use crate::strategy::*; +use crate::test_runner::*; //============================================================================== // Probability @@ -34,7 +34,9 @@ impl Default for Probability { /// The default probability is 0.5, or 50% chance. - fn default() -> Self { prob(0.5) } + fn default() -> Self { + prob(0.5) + } } impl From for Probability { @@ -86,18 +88,24 @@ type Repr = f64; /// Converts the `Probability` into an `f64`. - fn into(self) -> Self::Repr { self.0 } + fn into(self) -> Self::Repr { + self.0 + } /// Creates a `Probability` from a `f64`. /// /// # Panics /// /// Panics if the probability is outside interval `[0.0, 1.0]`. - fn from(r: Self::Repr) -> Self { r.into() } + fn from(r: Self::Repr) -> Self { + r.into() + } } impl From for f64 { - fn from(p: Probability) -> Self { p.0 } + fn from(p: Probability) -> Self { + p.0 + } } /// A probability in the range `[0.0, 1.0]` with a default of `0.5`. @@ -117,15 +125,17 @@ #[must_use = "strategies do nothing unless used"] struct NoneStrategy(PhantomData); impl Clone for NoneStrategy { - fn clone(&self) -> Self { *self } + fn clone(&self) -> Self { + *self + } } -impl Copy for NoneStrategy { } +impl Copy for NoneStrategy {} impl fmt::Debug for NoneStrategy { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "NoneStrategy") } } -impl Strategy for NoneStrategy { +impl Strategy for NoneStrategy { type Tree = Self; type Value = Option; @@ -133,12 +143,18 @@ Ok(*self) } } -impl ValueTree for NoneStrategy { +impl ValueTree for NoneStrategy { type Value = Option; - fn current(&self) -> Option { None } - fn simplify(&mut self) -> bool { false } - fn complicate(&mut self) -> bool { false } + fn current(&self) -> Option { + None + } + fn simplify(&mut self) -> bool { + false + } + fn complicate(&mut self) -> bool { + false + } } opaque_strategy_wrapper! { @@ -162,7 +178,7 @@ // XXX Unclear why this is necessary; #[derive(Debug)] *should* generate // exactly this, but for some reason it adds a `T::Value : Debug` constraint as // well. -impl fmt::Debug for OptionStrategy { +impl fmt::Debug for OptionStrategy { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "OptionStrategy({:?})", self.0) } @@ -174,7 +190,7 @@ /// `Some` values shrink to `None`. /// /// `Some` and `None` are each chosen with 50% probability. -pub fn of(t: T) -> OptionStrategy { +pub fn of(t: T) -> OptionStrategy { weighted(Probability::default(), t) } @@ -185,9 +201,10 @@ /// /// `Some` is chosen with a probability given by `probability_of_some`, which /// must be between 0.0 and 1.0, both exclusive. -pub fn weighted - (probability_of_some: impl Into, t: T) -> OptionStrategy -{ +pub fn weighted( + probability_of_some: impl Into, + t: T, +) -> OptionStrategy { let prob = probability_of_some.into().into(); let (weight_some, weight_none) = float_to_weight(prob); @@ -202,11 +219,11 @@ use super::*; fn count_some_of_1000(s: OptionStrategy>) -> u32 { - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); let mut count = 0; for _ in 0..1000 { - count += s.new_tree(&mut runner).unwrap() - .current().is_some() as u32; + count += + s.new_tree(&mut runner).unwrap().current().is_some() as u32; } count diff -Nru cargo-0.35.0/vendor/proptest/src/prelude.rs cargo-0.37.0/vendor/proptest/src/prelude.rs --- cargo-0.35.0/vendor/proptest/src/prelude.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/prelude.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,5 +1,5 @@ //- -// Copyright 2017, 2018 The proptest developers +// Copyright 2017, 2018, 2019 The proptest developers // // Licensed under the Apache License, Version 2.0 or the MIT license @@ -20,30 +20,34 @@ //! `rand` crate directly will not provide insulation from the upcoming //! revision to the `rand` crate. -pub use strategy::{BoxedStrategy, Just, SBoxedStrategy, Strategy}; -pub use arbitrary::{Arbitrary, any, any_with}; -pub use test_runner::Config as ProptestConfig; -pub use test_runner::TestCaseError; +pub use crate::arbitrary::{any, any_with, Arbitrary}; +pub use crate::strategy::{BoxedStrategy, Just, SBoxedStrategy, Strategy}; +pub use crate::test_runner::Config as ProptestConfig; +pub use crate::test_runner::TestCaseError; +pub use crate::{ + prop_assert, prop_assert_eq, prop_assert_ne, prop_assume, prop_compose, + prop_oneof, proptest, +}; -pub use rand::{RngCore, Rng}; +pub use rand::{Rng, RngCore}; /// Re-exports the entire public API of proptest so that an import of `prelude` /// allows simply writing, for example, `prop::num::i32::ANY` rather than /// `proptest::num::i32::ANY` plus a separate `use proptest;`. pub mod prop { - pub use test_runner; - pub use strategy; - pub use arbitrary; - pub use bool; - pub use num; - pub use bits; - pub use tuple; - pub use array; - pub use collection; - pub use char; + pub use crate::arbitrary; + pub use crate::array; + pub use crate::bits; + pub use crate::bool; + pub use crate::char; + pub use crate::collection; + pub use crate::num; + pub use crate::option; + pub use crate::result; + pub use crate::sample; + pub use crate::strategy; #[cfg(feature = "std")] - pub use string; - pub use option; - pub use result; - pub use sample; + pub use crate::string; + pub use crate::test_runner; + pub use crate::tuple; } diff -Nru cargo-0.35.0/vendor/proptest/src/result.rs cargo-0.37.0/vendor/proptest/src/result.rs --- cargo-0.35.0/vendor/proptest/src/result.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/result.rs 2019-07-17 05:42:23.000000000 +0000 @@ -31,23 +31,25 @@ use core::fmt; use core::marker::PhantomData; -use strategy::*; -use test_runner::*; +use crate::strategy::*; +use crate::test_runner::*; // Re-export the type for easier usage. -pub use option::{prob, Probability}; +pub use crate::option::{prob, Probability}; struct WrapOk(PhantomData, PhantomData); impl Clone for WrapOk { - fn clone(&self) -> Self { *self } + fn clone(&self) -> Self { + *self + } } -impl Copy for WrapOk { } +impl Copy for WrapOk {} impl fmt::Debug for WrapOk { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "WrapOk") } } -impl statics::MapFn for WrapOk { +impl statics::MapFn for WrapOk { type Output = Result; fn apply(&self, t: T) -> Result { Ok(t) @@ -55,25 +57,27 @@ } struct WrapErr(PhantomData, PhantomData); impl Clone for WrapErr { - fn clone(&self) -> Self { *self } + fn clone(&self) -> Self { + *self + } } -impl Copy for WrapErr { } +impl Copy for WrapErr {} impl fmt::Debug for WrapErr { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "WrapErr") } } -impl statics::MapFn for WrapErr { +impl statics::MapFn for WrapErr { type Output = Result; fn apply(&self, e: E) -> Result { Err(e) } } -type MapErr = statics::Map::Value, ::Value>>; -type MapOk = statics::Map::Value, ::Value>>; +type MapErr = + statics::Map::Value, ::Value>>; +type MapOk = + statics::Map::Value, ::Value>>; opaque_strategy_wrapper! { /// Strategy which generates `Result`s using `Ok` and `Err` values from two @@ -110,14 +114,16 @@ } // These need to exist for the same reason as the one on `OptionStrategy` -impl fmt::Debug -for MaybeOk { +impl fmt::Debug + for MaybeOk +{ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "MaybeOk({:?})", self.0) } } -impl fmt::Debug -for MaybeErr { +impl fmt::Debug + for MaybeErr +{ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "MaybeErr({:?})", self.0) } @@ -129,7 +135,7 @@ /// `Ok` and `Err` are chosen with equal probability. /// /// Generated values shrink to `Err`. -pub fn maybe_ok(t: T, e: E) -> MaybeOk { +pub fn maybe_ok(t: T, e: E) -> MaybeOk { maybe_ok_weighted(0.5, t, e) } @@ -140,15 +146,23 @@ /// that `Ok` is initially chosen. /// /// Generated values shrink to `Err`. -pub fn maybe_ok_weighted( - probability_of_ok: impl Into, t: T, e: E) -> MaybeOk -{ +pub fn maybe_ok_weighted( + probability_of_ok: impl Into, + t: T, + e: E, +) -> MaybeOk { let prob = probability_of_ok.into().into(); let (ok_weight, err_weight) = float_to_weight(prob); MaybeOk(TupleUnion::new(( - (err_weight, statics::Map::new(e, WrapErr(PhantomData, PhantomData))), - (ok_weight, statics::Map::new(t, WrapOk(PhantomData, PhantomData))), + ( + err_weight, + statics::Map::new(e, WrapErr(PhantomData, PhantomData)), + ), + ( + ok_weight, + statics::Map::new(t, WrapOk(PhantomData, PhantomData)), + ), ))) } @@ -158,7 +172,7 @@ /// `Ok` and `Err` are chosen with equal probability. /// /// Generated values shrink to `Ok`. -pub fn maybe_err(t: T, e: E) -> MaybeErr { +pub fn maybe_err(t: T, e: E) -> MaybeErr { maybe_err_weighted(0.5, t, e) } @@ -169,15 +183,23 @@ /// that `Err` is initially chosen. /// /// Generated values shrink to `Ok`. -pub fn maybe_err_weighted( - probability_of_err: impl Into, t: T, e: E) -> MaybeErr -{ +pub fn maybe_err_weighted( + probability_of_err: impl Into, + t: T, + e: E, +) -> MaybeErr { let prob = probability_of_err.into().into(); let (err_weight, ok_weight) = float_to_weight(prob); MaybeErr(TupleUnion::new(( - (ok_weight, statics::Map::new(t, WrapOk(PhantomData, PhantomData))), - (err_weight, statics::Map::new(e, WrapErr(PhantomData, PhantomData))), + ( + ok_weight, + statics::Map::new(t, WrapOk(PhantomData, PhantomData)), + ), + ( + err_weight, + statics::Map::new(e, WrapErr(PhantomData, PhantomData)), + ), ))) } @@ -186,11 +208,10 @@ use super::*; fn count_ok_of_1000(s: impl Strategy>) -> u32 { - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); let mut count = 0; for _ in 0..1000 { - count += s.new_tree(&mut runner).unwrap() - .current().is_ok() as u32; + count += s.new_tree(&mut runner).unwrap().current().is_ok() as u32; } count @@ -206,20 +227,20 @@ #[test] fn probability_handled_correctly() { - let count = count_ok_of_1000(maybe_err_weighted( - 0.1, Just(()), Just(()))); + let count = + count_ok_of_1000(maybe_err_weighted(0.1, Just(()), Just(()))); assert!(count > 800 && count < 950); - let count = count_ok_of_1000(maybe_err_weighted( - 0.9, Just(()), Just(()))); + let count = + count_ok_of_1000(maybe_err_weighted(0.9, Just(()), Just(()))); assert!(count > 50 && count < 150); - let count = count_ok_of_1000(maybe_ok_weighted( - 0.9, Just(()), Just(()))); + let count = + count_ok_of_1000(maybe_ok_weighted(0.9, Just(()), Just(()))); assert!(count > 800 && count < 950); - let count = count_ok_of_1000(maybe_ok_weighted( - 0.1, Just(()), Just(()))); + let count = + count_ok_of_1000(maybe_ok_weighted(0.1, Just(()), Just(()))); assert!(count > 50 && count < 150); } diff -Nru cargo-0.35.0/vendor/proptest/src/sample.rs cargo-0.37.0/vendor/proptest/src/sample.rs --- cargo-0.35.0/vendor/proptest/src/sample.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/sample.rs 2019-07-17 05:42:23.000000000 +0000 @@ -13,21 +13,21 @@ //! is, the input collection is not itself a strategy, but is rather fixed when //! the strategy is created. +use crate::std_facade::{Arc, Cow, Vec}; use core::fmt; use core::mem; use core::ops::Range; use core::u64; -use std_facade::{Cow, Vec, Arc}; use rand::Rng; -use bits::{self, BitSetValueTree, SampledBitSetStrategy, VarBitSet}; -use num; -use strategy::*; -use test_runner::*; +use crate::bits::{self, BitSetValueTree, SampledBitSetStrategy, VarBitSet}; +use crate::num; +use crate::strategy::*; +use crate::test_runner::*; /// Re-exported to make usage more ergonomic. -pub use collection::{SizeRange, size_range}; +pub use crate::collection::{size_range, SizeRange}; /// Sample subsequences whose size are within `size` from the given collection /// `values`. @@ -46,18 +46,21 @@ /// `values`. /// /// Panics if `size` is a zero-length range. -pub fn subsequence - (values: impl Into>, - size: impl Into) -> Subsequence -{ +pub fn subsequence( + values: impl Into>, + size: impl Into, +) -> Subsequence { let values = values.into(); let len = values.len(); let size = size.into(); size.assert_nonempty(); - assert!(size.end_incl() <= len, - "Maximum size of subsequence {} exceeds length of input {}", - size.end_incl(), len); + assert!( + size.end_incl() <= len, + "Maximum size of subsequence {} exceeds length of input {}", + size.end_incl(), + len + ); Subsequence { values: Arc::new(values), bit_strategy: bits::varsize::sampled(size, 0..len), @@ -70,12 +73,12 @@ /// This is created by the `subsequence` function in the same module. #[derive(Debug, Clone)] #[must_use = "strategies do nothing unless used"] -pub struct Subsequence { +pub struct Subsequence { values: Arc>, bit_strategy: SampledBitSetStrategy, } -impl Strategy for Subsequence { +impl Strategy for Subsequence { type Tree = SubsequenceValueTree; type Value = Vec; @@ -89,12 +92,12 @@ /// `ValueTree` type for `Subsequence`. #[derive(Debug, Clone)] -pub struct SubsequenceValueTree { +pub struct SubsequenceValueTree { values: Arc>, inner: BitSetValueTree, } -impl ValueTree for SubsequenceValueTree { +impl ValueTree for SubsequenceValueTree { type Value = Vec; fn current(&self) -> Self::Value { @@ -112,12 +115,10 @@ } } - #[derive(Debug, Clone)] -struct SelectMapFn(Arc>); +struct SelectMapFn(Arc>); -impl statics::MapFn -for SelectMapFn { +impl statics::MapFn for SelectMapFn { type Output = T; fn apply(&self, ix: usize) -> T { @@ -152,13 +153,12 @@ /// If `values` is also to be generated by a strategy, see /// [`Index`](struct.Index.html) for a more efficient way to select values than /// using `prop_flat_map()`. -pub fn select - (values: impl Into>) -> Select -{ +pub fn select( + values: impl Into>, +) -> Select { let cow = values.into(); - Select(statics::Map::new( - 0..cow.len(), SelectMapFn(Arc::new(cow)))) + Select(statics::Map::new(0..cow.len(), SelectMapFn(Arc::new(cow)))) } /// A stand-in for an index into a slice or similar collection or conceptually @@ -187,7 +187,6 @@ /// call to `prop_flat_map()`. /// /// ``` -/// #[macro_use] extern crate proptest; /// use proptest::prelude::*; /// /// proptest! { @@ -225,7 +224,8 @@ // No platforms currently have `usize` wider than 64 bits, so `u128` is // sufficient to hold the result of a full multiply, letting us do a // simple fixed-point multiply. - ((size as u128) * (self.0 as u128) >> (mem::size_of::() * 8)) as usize + ((size as u128) * (self.0 as u128) >> (mem::size_of::() * 8)) + as usize } /// Return a reference to the element in `slice` that this `Index` refers to. @@ -290,7 +290,6 @@ /// Generate a non-indexable collection and a value to pick out of it. /// /// ``` -/// #[macro_use] extern crate proptest; /// use proptest::prelude::*; /// /// proptest! { @@ -331,9 +330,7 @@ impl SelectorStrategy { pub(crate) fn new() -> Self { - SelectorStrategy { - _nonexhaustive: (), - } + SelectorStrategy { _nonexhaustive: () } } } @@ -379,7 +376,7 @@ /// ## Panics /// /// Panics if `it` has no elements. - pub fn select(&self, it: T) -> T::Item { + pub fn select(&self, it: T) -> T::Item { self.try_select(it).expect("select from empty iterator") } @@ -391,7 +388,7 @@ /// dependent only on the actual length of `it`. /// /// `it` is always iterated completely. - pub fn try_select(&self, it: T) -> Option { + pub fn try_select(&self, it: T) -> Option { let mut bias = 0u64; let mut min_score = 0; let mut best = None; @@ -413,10 +410,10 @@ #[cfg(test)] mod test { - use std_facade::BTreeSet; + use crate::std_facade::BTreeSet; use super::*; - use arbitrary::any; + use crate::arbitrary::any; #[test] fn sample_slice() { @@ -424,7 +421,7 @@ let mut size_counts = [0; 8]; let mut value_counts = [0; 8]; - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); let input = subsequence(VALUES, 3..7); for _ in 0..2048 { @@ -432,8 +429,10 @@ // Generated the correct number of items assert!(value.len() >= 3 && value.len() < 7); // Chose distinct items - assert_eq!(value.len(), - value.iter().cloned().collect::>().len()); + assert_eq!( + value.len(), + value.iter().cloned().collect::>().len() + ); // Values are in correct order let mut sorted = value.clone(); sorted.sort(); @@ -447,13 +446,21 @@ } for i in 3..7 { - assert!(size_counts[i] >= 256 && size_counts[i] < 1024, - "size {} was chosen {} times", i, size_counts[i]); + assert!( + size_counts[i] >= 256 && size_counts[i] < 1024, + "size {} was chosen {} times", + i, + size_counts[i] + ); } for (ix, &v) in value_counts.iter().enumerate() { - assert!(v >= 1024 && v < 1500, - "Value {} was chosen {} times", ix, v); + assert!( + v >= 1024 && v < 1500, + "Value {} was chosen {} times", + ix, + v + ); } } @@ -462,7 +469,7 @@ // Just test that the types work out let values = vec![0, 1, 2, 3, 4]; - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); let input = subsequence(values, 1..3); let _ = input.new_tree(&mut runner).unwrap().current(); @@ -473,7 +480,7 @@ let values = vec![0, 1, 2, 3, 4, 5, 6, 7]; let mut counts = [0; 8]; - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); let input = select(values); for _ in 0..1024 { @@ -481,8 +488,12 @@ } for (ix, &count) in counts.iter().enumerate() { - assert!(count >= 64 && count < 256, - "Generated value {} {} times", ix, count); + assert!( + count >= 64 && count < 256, + "Generated value {} {} times", + ix, + count + ); } } @@ -498,22 +509,25 @@ #[test] fn subseq_empty_vec_works() { - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); let input = subsequence(Vec::<()>::new(), 0..1); - assert_eq!(Vec::<()>::new(), input.new_tree(&mut runner).unwrap().current()); + assert_eq!( + Vec::<()>::new(), + input.new_tree(&mut runner).unwrap().current() + ); } #[test] fn subseq_full_vec_works() { let v = vec![1u32, 2u32, 3u32]; - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); let input = subsequence(v.clone(), 3); assert_eq!(v, input.new_tree(&mut runner).unwrap().current()); } #[test] fn index_works() { - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); let input = any::(); let col = vec!["foo", "bar", "baz"]; let mut seen = BTreeSet::new(); @@ -522,7 +536,7 @@ let mut tree = input.new_tree(&mut runner).unwrap(); seen.insert(*tree.current().get(&col)); - while tree.simplify() { } + while tree.simplify() {} assert_eq!("foo", *tree.current().get(&col)); } @@ -532,16 +546,17 @@ #[test] fn selector_works() { - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); let input = any::(); - let col: BTreeSet<&str> = vec!["foo", "bar", "baz"].into_iter().collect(); + let col: BTreeSet<&str> = + vec!["foo", "bar", "baz"].into_iter().collect(); let mut seen = BTreeSet::new(); for _ in 0..16 { let mut tree = input.new_tree(&mut runner).unwrap(); seen.insert(*tree.current().select(&col)); - while tree.simplify() { } + while tree.simplify() {} assert_eq!("bar", *tree.current().select(&col)); } diff -Nru cargo-0.35.0/vendor/proptest/src/std_facade.rs cargo-0.37.0/vendor/proptest/src/std_facade.rs --- cargo-0.35.0/vendor/proptest/src/std_facade.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/std_facade.rs 2019-07-17 05:42:23.000000000 +0000 @@ -13,9 +13,9 @@ ($($alloc: path, $std: path),*) => { $( #[cfg(all(feature = "alloc", not(feature = "std")))] - pub(crate) use $alloc; + pub use $alloc; #[cfg(feature = "std")] - pub(crate) use $std; + pub use $std; )* }; } @@ -24,9 +24,9 @@ ($($core: path, $std: path),*) => { $( #[cfg(not(feature = "std"))] - pub(crate) use $core; + pub use $core; #[cfg(feature = "std")] - pub(crate) use $std; + pub use $std; )* }; } @@ -62,11 +62,11 @@ //#[cfg(not(feature = "std"))] //pub(crate) use hashmap_core::map as hash_map; #[cfg(feature = "std")] -pub(crate) use ::std::collections::hash_map; +pub use ::std::collections::hash_map; //#[cfg(not(feature = "std"))] //pub(crate) use hashmap_core::set as hash_set; #[cfg(feature = "std")] -pub(crate) use ::std::collections::hash_set; +pub use ::std::collections::hash_set; multiplex_core! { core::fmt, ::std::fmt, diff -Nru cargo-0.35.0/vendor/proptest/src/strategy/filter_map.rs cargo-0.37.0/vendor/proptest/src/strategy/filter_map.rs --- cargo-0.35.0/vendor/proptest/src/strategy/filter_map.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/strategy/filter_map.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,10 +7,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std_facade::{fmt, Arc, Cell}; +use crate::std_facade::{fmt, Arc, Cell}; -use strategy::traits::*; -use test_runner::*; +use crate::strategy::traits::*; +use crate::test_runner::*; /// `Strategy` and `ValueTree` filter_map adaptor. /// @@ -23,8 +23,12 @@ } impl FilterMap { - pub (super) fn new(source: S, whence: Reason, fun: F) -> Self { - Self { source, whence, fun: Arc::new(fun) } + pub(super) fn new(source: S, whence: Reason, fun: F) -> Self { + Self { + source, + whence, + fun: Arc::new(fun), + } } } @@ -48,8 +52,9 @@ } } -impl Option, O : fmt::Debug> Strategy -for FilterMap { +impl Option, O: fmt::Debug> Strategy + for FilterMap +{ type Tree = FilterMapValueTree; type Value = O; @@ -57,7 +62,7 @@ loop { let val = self.source.new_tree(runner)?; if let Some(current) = (self.fun)(val.current()) { - return Ok(FilterMapValueTree::new(val, &self.fun, current)) + return Ok(FilterMapValueTree::new(val, &self.fun, current)); } else { runner.reject_local(self.whence.clone())?; } @@ -72,8 +77,9 @@ fun: Arc, } -impl Option, O> Clone -for FilterMapValueTree { +impl Option, O> Clone + for FilterMapValueTree +{ fn clone(&self) -> Self { Self::new(self.source.clone(), &self.fun, self.fresh_current()) } @@ -89,8 +95,9 @@ } } -impl Option, O> -FilterMapValueTree { +impl Option, O> + FilterMapValueTree +{ fn new(source: V, fun: &Arc, current: O) -> Self { Self { source, @@ -111,15 +118,18 @@ self.current = Cell::new(Some(current)); break; } else if !self.source.complicate() { - panic!("Unable to complicate filtered strategy \ - back into acceptable value"); + panic!( + "Unable to complicate filtered strategy \ + back into acceptable value" + ); } } } } -impl Option, O : fmt::Debug> ValueTree -for FilterMapValueTree { +impl Option, O: fmt::Debug> ValueTree + for FilterMapValueTree +{ type Value = O; fn current(&self) -> O { @@ -157,8 +167,13 @@ #[test] fn test_filter_map() { - let input = (0..256).prop_filter_map("%3 + 1", - |v| if 0 == v % 3 { Some(v + 1) } else { None }); + let input = (0..256).prop_filter_map("%3 + 1", |v| { + if 0 == v % 3 { + Some(v + 1) + } else { + None + } + }); for _ in 0..256 { let mut runner = TestRunner::default(); @@ -176,14 +191,19 @@ #[test] fn test_filter_map_sanity() { check_strategy_sanity( - (0..256).prop_filter_map("!%5 * 2", - |v| if 0 != v % 5 { Some(v * 2) } else { None }), - + (0..256).prop_filter_map("!%5 * 2", |v| { + if 0 != v % 5 { + Some(v * 2) + } else { + None + } + }), Some(CheckStrategySanityOptions { // Due to internal rejection sampling, `simplify()` can // converge back to what `complicate()` would do. strict_complicate_after_simplify: false, - .. CheckStrategySanityOptions::default() - })); + ..CheckStrategySanityOptions::default() + }), + ); } } diff -Nru cargo-0.35.0/vendor/proptest/src/strategy/filter.rs cargo-0.37.0/vendor/proptest/src/strategy/filter.rs --- cargo-0.35.0/vendor/proptest/src/strategy/filter.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/strategy/filter.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,10 +7,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std_facade::{fmt, Arc}; +use crate::std_facade::{fmt, Arc}; -use strategy::traits::*; -use test_runner::*; +use crate::strategy::traits::*; +use crate::test_runner::*; /// `Strategy` and `ValueTree` filter adaptor. /// @@ -23,12 +23,16 @@ } impl Filter { - pub (super) fn new(source: S, whence: Reason, fun: F) -> Self { - Self { source, whence, fun: Arc::new(fun) } + pub(super) fn new(source: S, whence: Reason, fun: F) -> Self { + Self { + source, + whence, + fun: Arc::new(fun), + } } } -impl fmt::Debug for Filter { +impl fmt::Debug for Filter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Filter") .field("source", &self.source) @@ -38,7 +42,7 @@ } } -impl Clone for Filter { +impl Clone for Filter { fn clone(&self) -> Self { Filter { source: self.source.clone(), @@ -48,9 +52,7 @@ } } -impl bool> -Strategy for Filter { +impl bool> Strategy for Filter { type Tree = Filter; type Value = S::Value; @@ -64,26 +66,26 @@ source: val, whence: self.whence.clone(), fun: Arc::clone(&self.fun), - }) + }); } } } } -impl bool> -Filter { +impl bool> Filter { fn ensure_acceptable(&mut self) { while !(self.fun)(&self.source.current()) { if !self.source.complicate() { - panic!("Unable to complicate filtered strategy \ - back into acceptable value"); + panic!( + "Unable to complicate filtered strategy \ + back into acceptable value" + ); } } } } -impl bool> -ValueTree for Filter { +impl bool> ValueTree for Filter { type Value = S::Value; fn current(&self) -> S::Value { @@ -138,7 +140,8 @@ // Due to internal rejection sampling, `simplify()` can // converge back to what `complicate()` would do. strict_complicate_after_simplify: false, - .. CheckStrategySanityOptions::default() - })); + ..CheckStrategySanityOptions::default() + }), + ); } } diff -Nru cargo-0.35.0/vendor/proptest/src/strategy/flatten.rs cargo-0.37.0/vendor/proptest/src/strategy/flatten.rs --- cargo-0.35.0/vendor/proptest/src/strategy/flatten.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/strategy/flatten.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,12 +7,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use crate::std_facade::{fmt, Arc}; use core::mem; -use std_facade::{fmt, Arc}; -use strategy::fuse::Fuse; -use strategy::traits::*; -use test_runner::*; +use crate::strategy::fuse::Fuse; +use crate::strategy::traits::*; +use crate::test_runner::*; /// Adaptor that flattens a `Strategy` which produces other `Strategy`s into a /// `Strategy` that picks one of those strategies and then picks values from @@ -23,15 +23,17 @@ source: S, } -impl Flatten { +impl Flatten { /// Wrap `source` to flatten it. pub fn new(source: S) -> Self { Flatten { source } } } -impl Strategy for Flatten -where S::Value : Strategy { +impl Strategy for Flatten +where + S::Value: Strategy, +{ type Tree = FlattenValueTree; type Value = ::Value; @@ -42,7 +44,10 @@ } /// The `ValueTree` produced by `Flatten`. -pub struct FlattenValueTree where S::Value : Strategy { +pub struct FlattenValueTree +where + S::Value: Strategy, +{ meta: Fuse, current: Fuse<::Tree>, // The final value to produce after successive calls to complicate() on the @@ -62,10 +67,12 @@ complicate_regen_remaining: u32, } -impl Clone for FlattenValueTree -where S::Value : Strategy + Clone, - S : Clone, - ::Tree : Clone { +impl Clone for FlattenValueTree +where + S::Value: Strategy + Clone, + S: Clone, + ::Tree: Clone, +{ fn clone(&self) -> Self { FlattenValueTree { meta: self.meta.clone(), @@ -77,21 +84,29 @@ } } -impl fmt::Debug for FlattenValueTree -where S::Value : Strategy, - S : fmt::Debug, ::Tree : fmt::Debug { +impl fmt::Debug for FlattenValueTree +where + S::Value: Strategy, + S: fmt::Debug, + ::Tree: fmt::Debug, +{ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("FlattenValueTree") .field("meta", &self.meta) .field("current", &self.current) .field("final_complication", &self.final_complication) - .field("complicate_regen_remaining", - &self.complicate_regen_remaining) + .field( + "complicate_regen_remaining", + &self.complicate_regen_remaining, + ) .finish() } } -impl FlattenValueTree where S::Value : Strategy { +impl FlattenValueTree +where + S::Value: Strategy, +{ fn new(runner: &mut TestRunner, meta: S) -> Result { let current = meta.current().new_tree(runner)?; Ok(FlattenValueTree { @@ -99,13 +114,15 @@ current: Fuse::new(current), final_complication: None, runner: runner.partial_clone(), - complicate_regen_remaining: 0 + complicate_regen_remaining: 0, }) } } -impl ValueTree for FlattenValueTree -where S::Value : Strategy { +impl ValueTree for FlattenValueTree +where + S::Value: Strategy, +{ type Value = ::Value; fn current(&self) -> Self::Value { @@ -134,8 +151,10 @@ // ourselves. self.current.disallow_complicate(); self.final_complication = Some(Fuse::new(v)); - mem::swap(self.final_complication.as_mut().unwrap(), - &mut self.current); + mem::swap( + self.final_complication.as_mut().unwrap(), + &mut self.current, + ); // Initially complicate by regenerating the chosen value. self.complicate_regen_remaining = self.runner.config().cases; true @@ -183,8 +202,10 @@ #[derive(Clone, Copy, Debug)] pub struct IndFlatten(pub(super) S); -impl Strategy for IndFlatten -where S::Value : Strategy { +impl Strategy for IndFlatten +where + S::Value: Strategy, +{ type Tree = ::Tree; type Value = ::Value; @@ -203,7 +224,7 @@ pub(super) fun: Arc, } -impl fmt::Debug for IndFlattenMap { +impl fmt::Debug for IndFlattenMap { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("IndFlattenMap") .field("source", &self.source) @@ -212,7 +233,7 @@ } } -impl Clone for IndFlattenMap { +impl Clone for IndFlattenMap { fn clone(&self) -> Self { IndFlattenMap { source: self.source.clone(), @@ -221,10 +242,10 @@ } } -impl R> -Strategy for IndFlattenMap { - type Tree = ::tuple::TupleValueTree<(S::Tree, R::Tree)>; +impl R> Strategy + for IndFlattenMap +{ + type Tree = crate::tuple::TupleValueTree<(S::Tree, R::Tree)>; type Value = (S::Value, R::Value); fn new_tree(&self, runner: &mut TestRunner) -> NewTree { @@ -232,26 +253,35 @@ let right_source = (self.fun)(left.current()); let right = right_source.new_tree(runner)?; - Ok(::tuple::TupleValueTree::new((left, right))) + Ok(crate::tuple::TupleValueTree::new((left, right))) } } #[cfg(test)] mod test { - use strategy::just::Just; use super::*; + use std::u32; + + use crate::strategy::just::Just; + use crate::test_runner::Config; + #[test] fn test_flat_map() { // Pick random integer A, then random integer B which is ±5 of A and // assert that B <= A if A > 10000. Shrinking should always converge to // A=10001, B=10002. - let input = (0..65536).prop_flat_map( - |a| (Just(a), (a-5..a+5))); + let input = (0..65536).prop_flat_map(|a| (Just(a), (a - 5..a + 5))); let mut failures = 0; + let mut runner = TestRunner::new_with_rng( + Config { + max_shrink_iters: u32::MAX - 1, + ..Config::default() + }, + TestRng::deterministic_rng(RngAlgorithm::default()), + ); for _ in 0..1000 { - let mut runner = TestRunner::default(); let case = input.new_tree(&mut runner).unwrap(); let result = runner.run_one(case, |(a, b)| { if a <= 10000 || b <= a { @@ -262,11 +292,11 @@ }); match result { - Ok(_) => { }, + Ok(_) => {} Err(TestError::Fail(_, v)) => { failures += 1; assert_eq!((10001, 10002), v); - }, + } result => panic!("Unexpected result: {:?}", result), } } @@ -277,8 +307,9 @@ #[test] fn test_flat_map_sanity() { check_strategy_sanity( - (0..65536).prop_flat_map(|a| (Just(a), (a-5..a+5))), - None); + (0..65536).prop_flat_map(|a| (Just(a), (a - 5..a + 5))), + None, + ); } #[test] @@ -300,7 +331,7 @@ let pass = AtomicBool::new(false); let mut runner = TestRunner::new(Config { max_flat_map_regens: 1000, - .. Config::default() + ..Config::default() }); let case = input.new_tree(&mut runner).unwrap(); let _ = runner.run_one(case, |_| { @@ -313,14 +344,16 @@ #[test] fn test_ind_flat_map_sanity() { check_strategy_sanity( - (0..65536).prop_ind_flat_map(|a| (Just(a), (a-5..a+5))), - None); + (0..65536).prop_ind_flat_map(|a| (Just(a), (a - 5..a + 5))), + None, + ); } #[test] fn test_ind_flat_map2_sanity() { check_strategy_sanity( - (0..65536).prop_ind_flat_map2(|a| a-5..a+5), - None); + (0..65536).prop_ind_flat_map2(|a| a - 5..a + 5), + None, + ); } } diff -Nru cargo-0.35.0/vendor/proptest/src/strategy/fuse.rs cargo-0.37.0/vendor/proptest/src/strategy/fuse.rs --- cargo-0.35.0/vendor/proptest/src/strategy/fuse.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/strategy/fuse.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,8 +7,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use strategy::*; -use test_runner::*; +use crate::strategy::*; +use crate::test_runner::*; /// Adaptor for `Strategy` and `ValueTree` which guards `simplify()` and /// `complicate()` to avoid contract violations. @@ -56,7 +56,7 @@ } } -impl Strategy for Fuse { +impl Strategy for Fuse { type Tree = Fuse; type Value = T::Value; @@ -65,7 +65,7 @@ } } -impl Fuse { +impl Fuse { /// Return whether a call to `simplify()` may be productive. /// /// Formally, this is true if one of the following holds: @@ -108,7 +108,7 @@ } } -impl ValueTree for Fuse { +impl ValueTree for Fuse { type Value = T::Value; fn current(&self) -> T::Value { diff -Nru cargo-0.35.0/vendor/proptest/src/strategy/just.rs cargo-0.37.0/vendor/proptest/src/strategy/just.rs --- cargo-0.35.0/vendor/proptest/src/strategy/just.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/strategy/just.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,10 +7,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std_facade::fmt; +use crate::std_facade::fmt; -use strategy::{Strategy, ValueTree, NewTree}; -use test_runner::TestRunner; +use crate::strategy::{NewTree, Strategy, ValueTree}; +use crate::test_runner::TestRunner; macro_rules! noshrink { () => { @@ -27,11 +27,12 @@ /// simplifies. #[derive(Clone, Copy, Debug)] #[must_use = "strategies do nothing unless used"] -pub struct Just( +pub struct Just( /// The value produced by this strategy. - pub T); + pub T, +); -impl Strategy for Just { +impl Strategy for Just { type Tree = Self; type Value = T; @@ -40,10 +41,12 @@ } } -impl ValueTree for Just { +impl ValueTree for Just { type Value = T; noshrink!(); - fn current(&self) -> T { self.0.clone() } + fn current(&self) -> T { + self.0.clone() + } } //============================================================================== @@ -61,15 +64,15 @@ /// /// **It is important that the function used be pure.** #[must_use = "strategies do nothing unless used"] -pub struct LazyJust T> { +pub struct LazyJust T> { /// The function executed in `.current()`. - function: F + function: F, } /// Shorthand for `LazyJust T>`. -pub type LazyJustFn = LazyJust V>; +pub type LazyJustFn = LazyJust V>; -impl T> LazyJust { +impl T> LazyJust { /// Constructs a `LazyJust` strategy given the function/closure /// that produces the value. /// @@ -79,7 +82,7 @@ } } -impl T> Strategy for LazyJust { +impl T> Strategy for LazyJust { type Tree = Self; type Value = T; @@ -88,25 +91,29 @@ } } -impl T> ValueTree for LazyJust { +impl T> ValueTree for LazyJust { type Value = T; noshrink!(); - fn current(&self) -> Self::Value { (self.function)() } + fn current(&self) -> Self::Value { + (self.function)() + } } -impl T> Copy for LazyJust {} +impl T> Copy for LazyJust {} -impl T> Clone for LazyJust { +impl T> Clone for LazyJust { fn clone(&self) -> Self { - Self { function: self.function.clone() } + Self { + function: self.function.clone(), + } } } -impl T> fmt::Debug for LazyJust { +impl T> fmt::Debug for LazyJust { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_struct("LazyJust") - .field("function", &"") - .finish() + .field("function", &"") + .finish() } } @@ -116,15 +123,19 @@ // TODO: try 'F: Fn () -> T' instead when we've got specialization. -impl Strategy for fn () -> T { +impl Strategy for fn() -> T { type Tree = Self; type Value = T; - fn new_tree(&self, _: &mut TestRunner) -> NewTree { Ok(*self) } + fn new_tree(&self, _: &mut TestRunner) -> NewTree { + Ok(*self) + } } -impl ValueTree for fn () -> T { +impl ValueTree for fn() -> T { type Value = T; noshrink!(); - fn current(&self) -> Self::Value { self() } + fn current(&self) -> Self::Value { + self() + } } diff -Nru cargo-0.35.0/vendor/proptest/src/strategy/lazy.rs cargo-0.37.0/vendor/proptest/src/strategy/lazy.rs --- cargo-0.35.0/vendor/proptest/src/strategy/lazy.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/strategy/lazy.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,175 @@ +//- +// Copyright 2019 The proptest developers +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use crate::std_facade::{fmt, Arc}; +use core::mem; + +use crate::strategy::traits::*; +use crate::test_runner::*; + +/// Represents a value tree that is initialized on the first call to any +/// methods. +/// +/// This is used to defer potentially expensive generation to shrinking time. It +/// is public only to allow APIs to expose it as an intermediate value. +pub struct LazyValueTree { + state: LazyValueTreeState, +} + +enum LazyValueTreeState { + Initialized(S::Tree), + Uninitialized { + strategy: Arc, + runner: TestRunner, + }, + Failed, +} + +impl LazyValueTree { + /// Create a new value tree where initial generation is deferred until + /// `maybe_init` is called. + pub(crate) fn new(strategy: Arc, runner: &mut TestRunner) -> Self { + let runner = runner.partial_clone(); + Self { + state: LazyValueTreeState::Uninitialized { strategy, runner }, + } + } + + /// Create a new value tree that has already been initialized. + pub(crate) fn new_initialized(value_tree: S::Tree) -> Self { + Self { + state: LazyValueTreeState::Initialized(value_tree), + } + } + + /// Returns a reference to the inner value tree if initialized. + pub(crate) fn as_inner(&self) -> Option<&S::Tree> { + match &self.state { + LazyValueTreeState::Initialized(v) => Some(v), + LazyValueTreeState::Uninitialized { .. } + | LazyValueTreeState::Failed => None, + } + } + + /// Returns a mutable reference to the inner value tree if uninitialized. + pub(crate) fn as_inner_mut(&mut self) -> Option<&mut S::Tree> { + match &mut self.state { + LazyValueTreeState::Initialized(v) => Some(v), + LazyValueTreeState::Uninitialized { .. } + | LazyValueTreeState::Failed => None, + } + } + + /// Try initializing the value tree. + pub(crate) fn maybe_init(&mut self) { + if !self.is_uninitialized() { + return; + } + + let state = mem::replace(&mut self.state, LazyValueTreeState::Failed); + match state { + LazyValueTreeState::Uninitialized { + strategy, + mut runner, + } => { + match strategy.new_tree(&mut runner) { + Ok(v) => { + mem::replace( + &mut self.state, + LazyValueTreeState::Initialized(v), + ); + } + Err(_) => { + // self.state is set to Failed above. Keep it that way. + } + } + } + LazyValueTreeState::Initialized(_) | LazyValueTreeState::Failed => { + unreachable!("can only reach here if uninitialized") + } + } + } + + /// Whether this value tree still needs to be initialized. + pub(crate) fn is_uninitialized(&self) -> bool { + match &self.state { + LazyValueTreeState::Uninitialized { .. } => true, + LazyValueTreeState::Initialized(_) | LazyValueTreeState::Failed => { + false + } + } + } + + /// Whether the value tree was successfully initialized. + pub(crate) fn is_initialized(&self) -> bool { + match &self.state { + LazyValueTreeState::Initialized(_) => true, + LazyValueTreeState::Uninitialized { .. } + | LazyValueTreeState::Failed => false, + } + } +} + +impl Clone for LazyValueTree +where + S::Tree: Clone, +{ + fn clone(&self) -> Self { + Self { + state: self.state.clone(), + } + } +} + +impl fmt::Debug for LazyValueTree +where + S::Tree: fmt::Debug, +{ + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("LazyValueTree") + .field("state", &self.state) + .finish() + } +} + +impl Clone for LazyValueTreeState +where + S::Tree: Clone, +{ + fn clone(&self) -> Self { + use LazyValueTreeState::*; + + match self { + Initialized(v) => Initialized(v.clone()), + Uninitialized { strategy, runner } => Uninitialized { + strategy: Arc::clone(strategy), + runner: runner.clone(), + }, + Failed => Failed, + } + } +} + +impl fmt::Debug for LazyValueTreeState +where + S::Tree: fmt::Debug, +{ + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + LazyValueTreeState::Initialized(value_tree) => { + f.debug_tuple("Initialized").field(value_tree).finish() + } + LazyValueTreeState::Uninitialized { strategy, .. } => f + .debug_struct("Uninitialized") + .field("strategy", strategy) + .finish(), + LazyValueTreeState::Failed => write!(f, "Failed"), + } + } +} diff -Nru cargo-0.35.0/vendor/proptest/src/strategy/map.rs cargo-0.37.0/vendor/proptest/src/strategy/map.rs --- cargo-0.35.0/vendor/proptest/src/strategy/map.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/strategy/map.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,12 +7,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use crate::std_facade::Arc; use core::fmt; use core::marker::PhantomData; -use std_facade::Arc; -use strategy::traits::*; -use test_runner::*; +use crate::strategy::traits::*; +use crate::test_runner::*; //============================================================================== // Map @@ -27,7 +27,7 @@ pub(super) fun: Arc, } -impl fmt::Debug for Map { +impl fmt::Debug for Map { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Map") .field("source", &self.source) @@ -36,7 +36,7 @@ } } -impl Clone for Map { +impl Clone for Map { fn clone(&self) -> Self { Map { source: self.source.clone(), @@ -45,20 +45,21 @@ } } -impl O> -Strategy for Map { +impl O> Strategy for Map { type Tree = Map; type Value = O; fn new_tree(&self, runner: &mut TestRunner) -> NewTree { - self.source.new_tree(runner).map( - |v| Map { source: v, fun: Arc::clone(&self.fun) }) + self.source.new_tree(runner).map(|v| Map { + source: v, + fun: Arc::clone(&self.fun), + }) } } -impl O> -ValueTree for Map { +impl O> ValueTree + for Map +{ type Value = O; fn current(&self) -> O { @@ -94,25 +95,30 @@ /// Construct a `MapInto` mapper from an `S` strategy into a strategy /// producing `O`s. pub(super) fn new(source: S) -> Self { - Self { source, output: PhantomData } + Self { + source, + output: PhantomData, + } } } -impl fmt::Debug for MapInto { +impl fmt::Debug for MapInto { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("MapInto").field("source", &self.source).finish() + f.debug_struct("MapInto") + .field("source", &self.source) + .finish() } } -impl Clone for MapInto { +impl Clone for MapInto { fn clone(&self) -> Self { Self::new(self.source.clone()) } } -impl Strategy for MapInto +impl Strategy for MapInto where - S::Value : Into + S::Value: Into, { type Tree = MapInto; type Value = O; @@ -122,9 +128,9 @@ } } -impl ValueTree for MapInto +impl ValueTree for MapInto where - S::Value: Into + S::Value: Into, { type Value = O; @@ -154,7 +160,7 @@ pub(super) fun: Arc, } -impl fmt::Debug for Perturb { +impl fmt::Debug for Perturb { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Perturb") .field("source", &self.source) @@ -163,7 +169,7 @@ } } -impl Clone for Perturb { +impl Clone for Perturb { fn clone(&self) -> Self { Perturb { source: self.source.clone(), @@ -172,18 +178,20 @@ } } -impl O> -Strategy for Perturb { +impl O> Strategy + for Perturb +{ type Tree = PerturbValueTree; type Value = O; fn new_tree(&self, runner: &mut TestRunner) -> NewTree { let rng = runner.new_rng(); - self.source.new_tree(runner).map(|source| - PerturbValueTree { source, rng, fun: Arc::clone(&self.fun) } - ) + self.source.new_tree(runner).map(|source| PerturbValueTree { + source, + rng, + fun: Arc::clone(&self.fun), + }) } } @@ -196,7 +204,7 @@ rng: TestRng, } -impl fmt::Debug for PerturbValueTree { +impl fmt::Debug for PerturbValueTree { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("PerturbValueTree") .field("source", &self.source) @@ -206,7 +214,7 @@ } } -impl Clone for PerturbValueTree { +impl Clone for PerturbValueTree { fn clone(&self) -> Self { PerturbValueTree { source: self.source.clone(), @@ -216,8 +224,9 @@ } } -impl O> -ValueTree for PerturbValueTree { +impl O> ValueTree + for PerturbValueTree +{ type Value = O; fn current(&self) -> O { @@ -243,8 +252,8 @@ use rand::RngCore; - use strategy::just::Just; use super::*; + use crate::strategy::just::Just; #[test] fn test_map() { @@ -252,7 +261,8 @@ .run(&(0..10).prop_map(|v| v * 2), |v| { assert!(0 == v % 2); Ok(()) - }).unwrap(); + }) + .unwrap(); } #[test] @@ -261,7 +271,8 @@ .run(&(0..10u8).prop_map_into::(), |v| { assert!(v < 10); Ok(()) - }).unwrap(); + }) + .unwrap(); } #[test] diff -Nru cargo-0.35.0/vendor/proptest/src/strategy/mod.rs cargo-0.37.0/vendor/proptest/src/strategy/mod.rs --- cargo-0.35.0/vendor/proptest/src/strategy/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/strategy/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,26 +9,29 @@ //! Defines the core traits used by Proptest. -mod traits; -mod just; -mod map; mod filter; mod filter_map; mod flatten; -mod unions; +mod fuse; +mod just; +mod lazy; +mod map; mod recursive; mod shuffle; -mod fuse; +mod traits; +mod unions; -pub use self::traits::*; -pub use self::just::*; -pub use self::map::*; pub use self::filter::*; pub use self::filter_map::*; pub use self::flatten::*; -pub use self::unions::*; +pub use self::fuse::*; +pub use self::just::*; +pub use self::lazy::*; +pub use self::lazy::*; +pub use self::map::*; pub use self::recursive::*; pub use self::shuffle::*; -pub use self::fuse::*; +pub use self::traits::*; +pub use self::unions::*; pub mod statics; diff -Nru cargo-0.35.0/vendor/proptest/src/strategy/recursive.rs cargo-0.37.0/vendor/proptest/src/strategy/recursive.rs --- cargo-0.35.0/vendor/proptest/src/strategy/recursive.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/strategy/recursive.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,11 +7,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std_facade::{fmt, Arc, Box, Vec}; +use crate::std_facade::{fmt, Arc, Box, Vec}; -use strategy::traits::*; -use strategy::unions::float_to_weight; -use test_runner::*; +use crate::strategy::traits::*; +use crate::strategy::unions::float_to_weight; +use crate::test_runner::*; /// Return type from `Strategy::prop_recursive()`. #[must_use = "strategies do nothing unless used"] @@ -47,28 +47,35 @@ } } -impl + 'static, - F : Fn (BoxedStrategy) -> R> -Recursive { - pub(super) fn new - (base: impl Strategy + 'static, - depth: u32, desired_size: u32, expected_branch_size: u32, - recurse: F) - -> Self - { +impl< + T: fmt::Debug + 'static, + R: Strategy + 'static, + F: Fn(BoxedStrategy) -> R, + > Recursive +{ + pub(super) fn new( + base: impl Strategy + 'static, + depth: u32, + desired_size: u32, + expected_branch_size: u32, + recurse: F, + ) -> Self { Self { base: base.boxed(), recurse: Arc::new(recurse), - depth, desired_size, expected_branch_size, + depth, + desired_size, + expected_branch_size, } } } -impl + 'static, - F : Fn (BoxedStrategy) -> R> -Strategy for Recursive { +impl< + T: fmt::Debug + 'static, + R: Strategy + 'static, + F: Fn(BoxedStrategy) -> R, + > Strategy for Recursive +{ type Tree = Box>; type Value = T; @@ -134,8 +141,8 @@ mod test { use std::cmp::max; - use strategy::just::Just; use super::*; + use crate::strategy::just::Just; #[derive(Clone, Debug, PartialEq)] enum Tree { @@ -167,10 +174,11 @@ let mut max_depth = 0; let mut max_count = 0; - let strat = Just(Tree::Leaf).prop_recursive(4, 64, 16, - |element| ::collection::vec(element, 8..16).prop_map(Tree::Branch)); + let strat = Just(Tree::Leaf).prop_recursive(4, 64, 16, |element| { + crate::collection::vec(element, 8..16).prop_map(Tree::Branch) + }); - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); for _ in 0..65536 { let tree = strat.new_tree(&mut runner).unwrap().current(); let (depth, count) = tree.stats(); @@ -186,13 +194,14 @@ #[test] fn simplifies_to_non_recursive() { - let strat = Just(Tree::Leaf).prop_recursive(4, 64, 16, - |element| ::collection::vec(element, 8..16).prop_map(Tree::Branch)); + let strat = Just(Tree::Leaf).prop_recursive(4, 64, 16, |element| { + crate::collection::vec(element, 8..16).prop_map(Tree::Branch) + }); - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); for _ in 0..256 { let mut value = strat.new_tree(&mut runner).unwrap(); - while value.simplify() { } + while value.simplify() {} assert_eq!(Tree::Leaf, value.current()); } diff -Nru cargo-0.35.0/vendor/proptest/src/strategy/shuffle.rs cargo-0.37.0/vendor/proptest/src/strategy/shuffle.rs --- cargo-0.35.0/vendor/proptest/src/strategy/shuffle.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/strategy/shuffle.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,13 +7,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std_facade::{Cell, VecDeque, Vec}; +use crate::std_facade::{Cell, Vec, VecDeque}; use rand::Rng; -use num; -use strategy::traits::*; -use test_runner::*; +use crate::num; +use crate::strategy::traits::*; +use crate::test_runner::*; /// `Strategy` shuffle adaptor. /// @@ -53,42 +53,44 @@ shuffleable!(VecDeque); // Zero- and 1-length arrays aren't usefully shuffleable, but are included to // simplify external macros that may try to use them anyway. -shuffleable!([T;0]); -shuffleable!([T;1]); -shuffleable!([T;2]); -shuffleable!([T;3]); -shuffleable!([T;4]); -shuffleable!([T;5]); -shuffleable!([T;6]); -shuffleable!([T;7]); -shuffleable!([T;8]); -shuffleable!([T;9]); -shuffleable!([T;10]); -shuffleable!([T;11]); -shuffleable!([T;12]); -shuffleable!([T;13]); -shuffleable!([T;14]); -shuffleable!([T;15]); -shuffleable!([T;16]); -shuffleable!([T;17]); -shuffleable!([T;18]); -shuffleable!([T;19]); -shuffleable!([T;20]); -shuffleable!([T;21]); -shuffleable!([T;22]); -shuffleable!([T;23]); -shuffleable!([T;24]); -shuffleable!([T;25]); -shuffleable!([T;26]); -shuffleable!([T;27]); -shuffleable!([T;28]); -shuffleable!([T;29]); -shuffleable!([T;30]); -shuffleable!([T;31]); -shuffleable!([T;32]); - -impl Strategy for Shuffle -where S::Value : Shuffleable { +shuffleable!([T; 0]); +shuffleable!([T; 1]); +shuffleable!([T; 2]); +shuffleable!([T; 3]); +shuffleable!([T; 4]); +shuffleable!([T; 5]); +shuffleable!([T; 6]); +shuffleable!([T; 7]); +shuffleable!([T; 8]); +shuffleable!([T; 9]); +shuffleable!([T; 10]); +shuffleable!([T; 11]); +shuffleable!([T; 12]); +shuffleable!([T; 13]); +shuffleable!([T; 14]); +shuffleable!([T; 15]); +shuffleable!([T; 16]); +shuffleable!([T; 17]); +shuffleable!([T; 18]); +shuffleable!([T; 19]); +shuffleable!([T; 20]); +shuffleable!([T; 21]); +shuffleable!([T; 22]); +shuffleable!([T; 23]); +shuffleable!([T; 24]); +shuffleable!([T; 25]); +shuffleable!([T; 26]); +shuffleable!([T; 27]); +shuffleable!([T; 28]); +shuffleable!([T; 29]); +shuffleable!([T; 30]); +shuffleable!([T; 31]); +shuffleable!([T; 32]); + +impl Strategy for Shuffle +where + S::Value: Shuffleable, +{ type Tree = ShuffleValueTree; type Value = S::Value; @@ -96,7 +98,8 @@ let rng = runner.new_rng(); self.0.new_tree(runner).map(|inner| ShuffleValueTree { - inner, rng, + inner, + rng, dist: Cell::new(None), simplifying_inner: false, }) @@ -122,9 +125,10 @@ simplifying_inner: bool, } - -impl ShuffleValueTree -where V::Value : Shuffleable { +impl ShuffleValueTree +where + V::Value: Shuffleable, +{ fn init_dist(&self, dflt: usize) -> usize { if self.dist.get().is_none() { self.dist.set(Some(num::usize::BinarySearch::new(dflt))); @@ -140,8 +144,10 @@ } } -impl ValueTree for ShuffleValueTree -where V::Value : Shuffleable { +impl ValueTree for ShuffleValueTree +where + V::Value: Shuffleable, +{ type Value = V::Value; fn current(&self) -> V::Value { @@ -154,7 +160,9 @@ // If empty collection or all swaps will be filtered out, there's // nothing to shuffle. - if 0 == len || 0 == max_swap { return value; } + if 0 == len || 0 == max_swap { + return value; + } let mut rng = self.rng.clone(); @@ -204,13 +212,12 @@ use std::collections::HashSet; use std::i32; - use collection; - use strategy::just::Just; use super::*; + use crate::collection; + use crate::strategy::just::Just; static VALUES: &'static [i32] = &[ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ]; #[test] @@ -223,8 +230,11 @@ for _ in 0..1024 { let mut value = input.new_tree(&mut runner).unwrap().current(); - assert!(seen.insert(value.clone()), - "Value {:?} generated more than once", value); + assert!( + seen.insert(value.clone()), + "Value {:?} generated more than once", + value + ); value.sort(); assert_eq!(VALUES, &value[..]); @@ -249,12 +259,16 @@ dist += (nominal - ix as i32).abs(); } - assert!(dist <= prev_dist, - "dist = {}, prev_dist = {}", dist, prev_dist); + assert!( + dist <= prev_dist, + "dist = {}, prev_dist = {}", + dist, + prev_dist + ); prev_dist = dist; if !value.simplify() { - break + break; } } @@ -266,6 +280,8 @@ #[test] fn simplify_complicate_contract_upheld() { check_strategy_sanity( - collection::vec(0i32..1000, 5..10).prop_shuffle(), None); + collection::vec(0i32..1000, 5..10).prop_shuffle(), + None, + ); } } diff -Nru cargo-0.35.0/vendor/proptest/src/strategy/statics.rs cargo-0.37.0/vendor/proptest/src/strategy/statics.rs --- cargo-0.35.0/vendor/proptest/src/strategy/statics.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/strategy/statics.rs 2019-07-17 05:42:23.000000000 +0000 @@ -24,10 +24,10 @@ //! **This module is subject to removal at some point after the language //! features linked above become stable.** -use std_facade::fmt; +use crate::std_facade::fmt; -use strategy::traits::*; -use test_runner::*; +use crate::strategy::traits::*; +use crate::test_runner::*; //============================================================================== // Filter @@ -54,11 +54,15 @@ pub fn new(source: S, whence: Reason, filter: F) -> Self { // NOTE: We don't use universal quantification R: Into // since the module is not conviniently exposed. - Filter { source, whence, fun: filter } + Filter { + source, + whence, + fun: filter, + } } } -impl fmt::Debug for Filter { +impl fmt::Debug for Filter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Filter") .field("source", &self.source) @@ -68,9 +72,7 @@ } } -impl + Clone> -Strategy for Filter { +impl + Clone> Strategy for Filter { type Tree = Filter; type Value = S::Value; @@ -84,24 +86,26 @@ source: val, whence: "unused".into(), fun: self.fun.clone(), - }) + }); } } } } -impl> Filter { +impl> Filter { fn ensure_acceptable(&mut self) { while !self.fun.apply(&self.source.current()) { if !self.source.complicate() { - panic!("Unable to complicate filtered strategy \ - back into acceptable value"); + panic!( + "Unable to complicate filtered strategy \ + back into acceptable value" + ); } } } } -impl> ValueTree for Filter { +impl> ValueTree for Filter { type Value = S::Value; fn current(&self) -> S::Value { @@ -134,7 +138,7 @@ /// Essentially `Fn (T) -> Output`. pub trait MapFn { #[allow(missing_docs)] - type Output : fmt::Debug; + type Output: fmt::Debug; /// Map `T` to `Output`. fn apply(&self, t: T) -> Self::Output; @@ -155,7 +159,7 @@ } } -impl fmt::Debug for Map { +impl fmt::Debug for Map { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Map") .field("source", &self.source) @@ -164,18 +168,19 @@ } } -impl> Strategy for Map { +impl> Strategy for Map { type Tree = Map; type Value = F::Output; fn new_tree(&self, runner: &mut TestRunner) -> NewTree { - self.source.new_tree(runner).map( - |v| Map { source: v, fun: self.fun.clone() }) + self.source.new_tree(runner).map(|v| Map { + source: v, + fun: self.fun.clone(), + }) } } -impl> -ValueTree for Map { +impl> ValueTree for Map { type Value = F::Output; fn current(&self) -> F::Output { @@ -193,12 +198,15 @@ impl MapFn for fn(I) -> O { type Output = O; - fn apply(&self, x: I) -> Self::Output { self(x) } + fn apply(&self, x: I) -> Self::Output { + self(x) + } } -pub(crate) fn static_map - (strat: S, fun: fn(S::Value) -> O) - -> Map O> { +pub(crate) fn static_map( + strat: S, + fun: fn(S::Value) -> O, +) -> Map O> { Map::new(strat, fun) } @@ -215,7 +223,9 @@ #[derive(Clone, Copy, Debug)] struct MyFilter; impl FilterFn for MyFilter { - fn apply(&self, &v: &i32) -> bool { 0 == v % 3 } + fn apply(&self, &v: &i32) -> bool { + 0 == v % 3 + } } let input = Filter::new(0..256, "%3".into(), MyFilter); @@ -239,7 +249,9 @@ struct MyMap; impl MapFn for MyMap { type Output = i32; - fn apply(&self, v: i32) -> i32 { v * 2 } + fn apply(&self, v: i32) -> i32 { + v * 2 + } } let input = Map::new(0..10, MyMap); @@ -248,6 +260,7 @@ .run(&input, |v| { assert!(0 == v % 2); Ok(()) - }).unwrap(); + }) + .unwrap(); } } diff -Nru cargo-0.35.0/vendor/proptest/src/strategy/traits.rs cargo-0.37.0/vendor/proptest/src/strategy/traits.rs --- cargo-0.35.0/vendor/proptest/src/strategy/traits.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/strategy/traits.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,11 +7,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use crate::std_facade::{fmt, Arc, Box, Rc}; use core::cmp; -use std_facade::{fmt, Box, Rc, Arc}; -use strategy::*; -use test_runner::*; +use crate::strategy::*; +use crate::test_runner::*; //============================================================================== // Traits @@ -28,25 +28,22 @@ /// [`Err`]: https://doc.rust-lang.org/nightly/std/result/enum.Result.html#variant.Err pub type NewTree = Result<::Tree, Reason>; -/// The value that functions under test use for a particular `Strategy`. -#[deprecated(since = "0.8.0", note="please use `S::Value` instead")] -pub type ValueFor = <::Tree as ValueTree>::Value; - /// A strategy for producing arbitrary values of a given type. /// /// `fmt::Debug` is a hard requirement for all strategies currently due to /// `prop_flat_map()`. This constraint will be removed when specialisation /// becomes stable. -pub trait Strategy : fmt::Debug { +#[must_use = "strategies do nothing unless used"] +pub trait Strategy: fmt::Debug { /// The value tree generated by this `Strategy`. - type Tree : ValueTree; + type Tree: ValueTree; /// The type of value used by functions under test generated by this Strategy. /// /// This corresponds to the same type as the associated type `Value` /// in `Self::Tree`. It is provided here to simplify usage particularly /// in conjunction with `-> impl Strategy`. - type Value : fmt::Debug; + type Value: fmt::Debug; /// Generate a new value tree from the given runner. /// @@ -68,11 +65,23 @@ /// There is no need (or possibility, for that matter) to define how the /// output is to be shrunken. Shrinking continues to take place in terms of /// the source value. - fn prop_map O> - (self, fun: F) -> Map - where Self : Sized { - Map { source: self, fun: Arc::new(fun) } + /// + /// `fun` should be a deterministic function. That is, for a given input + /// value, it should produce an equivalent output value on every call. + /// Proptest assumes that it can call the function as many times as needed + /// to generate as many identical values as needed. For this reason, `F` is + /// `Fn` rather than `FnMut`. + fn prop_map O>( + self, + fun: F, + ) -> Map + where + Self: Sized, + { + Map { + source: self, + fun: Arc::new(fun), + } } /// Returns a strategy which produces values of type `O` by transforming @@ -84,10 +93,10 @@ /// There is no need (or possibility, for that matter) to define how the /// output is to be shrunken. Shrinking continues to take place in terms of /// the source value. - fn prop_map_into(self) -> MapInto + fn prop_map_into(self) -> MapInto where - Self : Sized, - Self::Value: Into + Self: Sized, + Self::Value: Into, { MapInto::new(self) } @@ -107,7 +116,6 @@ /// ## Example /// /// ``` - /// #[macro_use] extern crate proptest; /// // The prelude also gets us the `Rng` trait. /// use proptest::prelude::*; /// @@ -126,11 +134,17 @@ /// } /// # fn main() { } /// ``` - fn prop_perturb O> - (self, fun: F) -> Perturb - where Self : Sized { - Perturb { source: self, fun: Arc::new(fun) } + fn prop_perturb O>( + self, + fun: F, + ) -> Perturb + where + Self: Sized, + { + Perturb { + source: self, + fun: Arc::new(fun), + } } /// Maps values produced by this strategy into new strategies and picks @@ -161,8 +175,6 @@ /// without using filtering: /// /// ``` - /// #[macro_use] extern crate proptest; - /// /// use proptest::prelude::*; /// /// proptest! { @@ -223,11 +235,17 @@ /// is not expected to be useful. `prop_ind_flat_map2` is useful for using /// related values as starting points while not constraining them to that /// relation. - fn prop_flat_map S> - (self, fun: F) -> Flatten> - where Self : Sized { - Flatten::new(Map { source: self, fun: Arc::new(fun) }) + fn prop_flat_map S>( + self, + fun: F, + ) -> Flatten> + where + Self: Sized, + { + Flatten::new(Map { + source: self, + fun: Arc::new(fun), + }) } /// Maps values produced by this strategy into new strategies and picks @@ -243,11 +261,17 @@ /// /// See `prop_flat_map()` for a more detailed explanation on how the /// three flat-map combinators differ. - fn prop_ind_flat_map S> - (self, fun: F) -> IndFlatten> - where Self : Sized { - IndFlatten(Map { source: self, fun: Arc::new(fun) }) + fn prop_ind_flat_map S>( + self, + fun: F, + ) -> IndFlatten> + where + Self: Sized, + { + IndFlatten(Map { + source: self, + fun: Arc::new(fun), + }) } /// Similar to `prop_ind_flat_map()`, but produces 2-tuples with the input @@ -255,11 +279,17 @@ /// /// See `prop_flat_map()` for a more detailed explanation on how the /// three flat-map combinators differ differ. - fn prop_ind_flat_map2 S> - (self, fun: F) -> IndFlattenMap - where Self : Sized { - IndFlattenMap { source: self, fun: Arc::new(fun) } + fn prop_ind_flat_map2 S>( + self, + fun: F, + ) -> IndFlattenMap + where + Self: Sized, + { + IndFlattenMap { + source: self, + fun: Arc::new(fun), + } } /// Returns a strategy which only produces values accepted by `fun`. @@ -282,9 +312,14 @@ /// whole-input rejections. /// /// `whence` is used to record where and why the rejection occurred. - fn prop_filter, F : Fn (&Self::Value) -> bool> - (self, whence: R, fun: F) -> Filter - where Self : Sized { + fn prop_filter, F: Fn(&Self::Value) -> bool>( + self, + whence: R, + fun: F, + ) -> Filter + where + Self: Sized, + { Filter::new(self, whence.into(), fun) } @@ -311,10 +346,14 @@ /// whole-input rejections. /// /// `whence` is used to record where and why the rejection occurred. - fn prop_filter_map Option, - O : fmt::Debug> - (self, whence: impl Into, fun: F) -> FilterMap - where Self : Sized { + fn prop_filter_map Option, O: fmt::Debug>( + self, + whence: impl Into, + fun: F, + ) -> FilterMap + where + Self: Sized, + { FilterMap::new(self, whence.into(), fun) } @@ -333,7 +372,9 @@ /// heterogeneous strategies, call the `boxed()` method on both `self` and /// `other` to erase the type differences before calling `prop_union()`. fn prop_union(self, other: Self) -> Union - where Self : Sized { + where + Self: Sized, + { Union::new(vec![self, other]) } @@ -366,7 +407,6 @@ /// # #![allow(unused_variables)] /// use std::collections::HashMap; /// - /// #[macro_use] extern crate proptest; /// use proptest::prelude::*; /// /// /// Define our own JSON AST type @@ -405,12 +445,19 @@ /// ]); /// # } /// ``` - fn prop_recursive + 'static, - F : Fn (BoxedStrategy) -> R> - (self, depth: u32, desired_size: u32, expected_branch_size: u32, - recurse: F) - -> Recursive - where Self : Sized + 'static { + fn prop_recursive< + R: Strategy + 'static, + F: Fn(BoxedStrategy) -> R, + >( + self, + depth: u32, + desired_size: u32, + expected_branch_size: u32, + recurse: F, + ) -> Recursive + where + Self: Sized + 'static, + { Recursive::new(self, depth, desired_size, expected_branch_size, recurse) } @@ -428,7 +475,6 @@ /// ## Example /// /// ``` - /// #[macro_use] extern crate proptest; /// use proptest::prelude::*; /// /// static VALUES: &'static [u32] = &[0, 1, 2, 3, 4]; @@ -453,8 +499,8 @@ /// ``` fn prop_shuffle(self) -> Shuffle where - Self : Sized, - Self::Value : Shuffleable + Self: Sized, + Self::Value: Shuffleable, { Shuffle(self) } @@ -468,7 +514,9 @@ /// Strategies of this type afford cheap shallow cloning via reference /// counting by using an `Arc` internally. fn boxed(self) -> BoxedStrategy - where Self : Sized + 'static { + where + Self: Sized + 'static, + { BoxedStrategy(Arc::new(BoxedStrategyWrapper(self))) } @@ -481,7 +529,9 @@ /// Strategies of this type afford cheap shallow cloning via reference /// counting by using an `Arc` internally. fn sboxed(self) -> SBoxedStrategy - where Self : Sized + Send + Sync + 'static { + where + Self: Sized + Send + Sync + 'static, + { SBoxedStrategy(Arc::new(BoxedStrategyWrapper(self))) } @@ -494,7 +544,10 @@ /// far outside of it. Since this makes it harder to see what the actual /// problem is, making the input `NoShrink` allows learning about inputs /// that produce more incorrect results. - fn no_shrink(self) -> NoShrink where Self : Sized { + fn no_shrink(self) -> NoShrink + where + Self: Sized, + { NoShrink(self) } } @@ -526,7 +579,7 @@ /// by their own implementation. pub trait ValueTree { /// The type of the value produced by this `ValueTree`. - type Value : fmt::Debug; + type Value: fmt::Debug; /// Returns the current value. fn current(&self) -> Self::Value; @@ -579,7 +632,7 @@ #[must_use = "strategies do nothing unless used"] pub struct NoShrink(T); -impl Strategy for NoShrink { +impl Strategy for NoShrink { type Tree = NoShrink; type Value = T::Value; @@ -588,15 +641,19 @@ } } -impl ValueTree for NoShrink { +impl ValueTree for NoShrink { type Value = T::Value; fn current(&self) -> T::Value { self.0.current() } - fn simplify(&mut self) -> bool { false } - fn complicate(&mut self) -> bool { false } + fn simplify(&mut self) -> bool { + false + } + fn complicate(&mut self) -> bool { + false + } } //============================================================================== @@ -621,11 +678,17 @@ proxy_strategy!(Rc); proxy_strategy!(Arc); -impl ValueTree for Box { +impl ValueTree for Box { type Value = T::Value; - fn current(&self) -> Self::Value { (**self).current() } - fn simplify(&mut self) -> bool { (**self).simplify() } - fn complicate(&mut self) -> bool { (**self).complicate() } + fn current(&self) -> Self::Value { + (**self).current() + } + fn simplify(&mut self) -> bool { + (**self).simplify() + } + fn complicate(&mut self) -> bool { + (**self).complicate() + } } /// A boxed `ValueTree`. @@ -637,8 +700,7 @@ /// counting by using an `Arc` internally. #[derive(Debug)] #[must_use = "strategies do nothing unless used"] -pub struct BoxedStrategy( - Arc>>); +pub struct BoxedStrategy(Arc>>); /// A boxed `Strategy` trait object which is also `Sync` and /// `Send`, as produced by `Strategy::sboxed()`. @@ -648,7 +710,8 @@ #[derive(Debug)] #[must_use = "strategies do nothing unless used"] pub struct SBoxedStrategy( - Arc> + Sync + Send>); + Arc> + Sync + Send>, +); impl Clone for BoxedStrategy { fn clone(&self) -> Self { @@ -673,7 +736,9 @@ // Optimization: Don't rebox the strategy. fn boxed(self) -> BoxedStrategy - where Self : Sized + 'static { + where + Self: Sized + 'static, + { self } } @@ -689,20 +754,26 @@ // Optimization: Don't rebox the strategy. fn sboxed(self) -> SBoxedStrategy - where Self : Sized + Send + Sync + 'static { + where + Self: Sized + Send + Sync + 'static, + { self } fn boxed(self) -> BoxedStrategy - where Self : Sized + 'static { + where + Self: Sized + 'static, + { BoxedStrategy(self.0) } } #[derive(Debug)] struct BoxedStrategyWrapper(T); -impl Strategy for BoxedStrategyWrapper -where T::Tree : 'static { +impl Strategy for BoxedStrategyWrapper +where + T::Tree: 'static, +{ type Tree = Box>; type Value = T::Value; @@ -725,6 +796,10 @@ /// designed in a way that this is expected to hold. pub strict_complicate_after_simplify: bool, + /// If true, cause local rejects to return an error instead of retrying. + /// Defaults to false. Useful for testing behaviors around error handling. + pub error_on_local_rejects: bool, + // Needs to be public for FRU syntax. #[allow(missing_docs)] #[doc(hidden)] @@ -735,6 +810,7 @@ fn default() -> Self { CheckStrategySanityOptions { strict_complicate_after_simplify: true, + error_on_local_rejects: false, _non_exhaustive: (), } } @@ -754,9 +830,13 @@ /// /// This can work with fallible strategies, but limits how many times it will /// retry failures. -pub fn check_strategy_sanity( - strategy: S, options: Option) -where S::Tree : Clone + fmt::Debug, S::Value : cmp::PartialEq { +pub fn check_strategy_sanity( + strategy: S, + options: Option, +) where + S::Tree: Clone + fmt::Debug, + S::Value: cmp::PartialEq, +{ // Like assert_eq!, but also pass if both values do not equal themselves. // This allows the test to work correctly with things like NaN. macro_rules! assert_same { @@ -770,22 +850,32 @@ } let options = options.unwrap_or_else(CheckStrategySanityOptions::default); - let mut runner = TestRunner::default(); + let mut config = Config::default(); + if options.error_on_local_rejects { + config.max_local_rejects = 0; + } + let mut runner = TestRunner::new(config); for _ in 0..1024 { let mut gen_tries = 0; let mut state; loop { let err = match strategy.new_tree(&mut runner) { - Ok(s) => { state = s; break; }, + Ok(s) => { + state = s; + break; + } Err(e) => e, }; gen_tries += 1; if gen_tries > 100 { - panic!("Strategy passed to check_strategy_sanity failed \ - to generate a value over 100 times in a row; \ - last failure reason: {}", err); + panic!( + "Strategy passed to check_strategy_sanity failed \ + to generate a value over 100 times in a row; \ + last failure reason: {}", + err + ); } } @@ -795,8 +885,10 @@ while state.simplify() || state.complicate() { count += 1; if count > 65536 { - panic!("Failed to converge on any value. State:\n{:#?}", - state); + panic!( + "Failed to converge on any value. State:\n{:#?}", + state + ); } } } @@ -812,16 +904,21 @@ let mut complicated = state.clone(); let before_complicated = state.clone(); if options.strict_complicate_after_simplify { - assert!(complicated.complicate(), - "complicate() returned false immediately after \ - simplify() returned true. internal state after \ - {} calls to simplify():\n\ - {:#?}\n\ - simplified to:\n\ - {:#?}\n\ - complicated to:\n\ - {:#?}", num_simplifies, before_simplified, state, - complicated); + assert!( + complicated.complicate(), + "complicate() returned false immediately after \ + simplify() returned true. internal state after \ + {} calls to simplify():\n\ + {:#?}\n\ + simplified to:\n\ + {:#?}\n\ + complicated to:\n\ + {:#?}", + num_simplifies, + before_simplified, + state, + complicated + ); } let mut prev_complicated = complicated.clone(); @@ -834,90 +931,123 @@ num_complications += 1; if num_complications > 65_536 { - panic!("complicate() returned true over 65536 times in a \ - row; aborting due to possible infinite loop. \ - If this is not an infinite loop, it may be \ - necessary to reconsider how shrinking is \ - implemented or use a simpler test strategy. \ - Internal state:\n{:#?}", state); + panic!( + "complicate() returned true over 65536 times in a \ + row; aborting due to possible infinite loop. \ + If this is not an infinite loop, it may be \ + necessary to reconsider how shrinking is \ + implemented or use a simpler test strategy. \ + Internal state:\n{:#?}", + state + ); } } - assert_same!(before_simplified.current(), complicated.current(), - "Calling simplify(), then complicate() until it \ - returned false, did not return to the value before \ - simplify. Expected:\n\ - {:#?}\n\ - Actual:\n\ - {:#?}\n\ - Internal state after {} calls to simplify():\n\ - {:#?}\n\ - Internal state after another call to simplify():\n\ - {:#?}\n\ - Internal state after {} subsequent calls to \ - complicate():\n\ - {:#?}", - before_simplified.current(), complicated.current(), - num_simplifies, before_simplified, before_complicated, - num_complications + 1, complicated); + assert_same!( + before_simplified.current(), + complicated.current(), + "Calling simplify(), then complicate() until it \ + returned false, did not return to the value before \ + simplify. Expected:\n\ + {:#?}\n\ + Actual:\n\ + {:#?}\n\ + Internal state after {} calls to simplify():\n\ + {:#?}\n\ + Internal state after another call to simplify():\n\ + {:#?}\n\ + Internal state after {} subsequent calls to \ + complicate():\n\ + {:#?}", + before_simplified.current(), + complicated.current(), + num_simplifies, + before_simplified, + before_complicated, + num_complications + 1, + complicated + ); for iter in 1..16 { - assert_same!(prev_complicated.current(), complicated.current(), - "complicate() returned false but changed the output \ - value anyway.\n\ - Old value:\n\ - {:#?}\n\ - New value:\n\ - {:#?}\n\ - Old internal state:\n\ - {:#?}\n\ - New internal state after {} calls to complicate()\ - including the :\n\ - {:#?}", - prev_complicated.current(), - complicated.current(), - prev_complicated, iter, complicated); - - assert!(!complicated.complicate(), - "complicate() returned true after having returned \ - false;\n\ - Internal state before:\n{:#?}\n\ - Internal state after calling complicate() {} times:\n\ - {:#?}", prev_complicated, iter + 1, complicated); + assert_same!( + prev_complicated.current(), + complicated.current(), + "complicate() returned false but changed the output \ + value anyway.\n\ + Old value:\n\ + {:#?}\n\ + New value:\n\ + {:#?}\n\ + Old internal state:\n\ + {:#?}\n\ + New internal state after {} calls to complicate()\ + including the :\n\ + {:#?}", + prev_complicated.current(), + complicated.current(), + prev_complicated, + iter, + complicated + ); + + assert!( + !complicated.complicate(), + "complicate() returned true after having returned \ + false;\n\ + Internal state before:\n{:#?}\n\ + Internal state after calling complicate() {} times:\n\ + {:#?}", + prev_complicated, + iter + 1, + complicated + ); } num_simplifies += 1; if num_simplifies > 65_536 { - panic!("simplify() returned true over 65536 times in a row, \ - aborting due to possible infinite loop. If this is not \ - an infinite loop, it may be necessary to reconsider \ - how shrinking is implemented or use a simpler test \ - strategy. Internal state:\n{:#?}", state); + panic!( + "simplify() returned true over 65536 times in a row, \ + aborting due to possible infinite loop. If this is not \ + an infinite loop, it may be necessary to reconsider \ + how shrinking is implemented or use a simpler test \ + strategy. Internal state:\n{:#?}", + state + ); } } for iter in 0..16 { - assert_same!(before_simplified.current(), state.current(), - "simplify() returned false but changed the output \ - value anyway.\n\ - Old value:\n\ - {:#?}\n\ - New value:\n\ - {:#?}\n\ - Previous internal state:\n\ - {:#?}\n\ - New internal state after calling simplify() {} times:\n\ - {:#?}", - before_simplified.current(), - state.current(), - before_simplified, iter, state); + assert_same!( + before_simplified.current(), + state.current(), + "simplify() returned false but changed the output \ + value anyway.\n\ + Old value:\n\ + {:#?}\n\ + New value:\n\ + {:#?}\n\ + Previous internal state:\n\ + {:#?}\n\ + New internal state after calling simplify() {} times:\n\ + {:#?}", + before_simplified.current(), + state.current(), + before_simplified, + iter, + state + ); if state.simplify() { - panic!("simplify() returned true after having returned false. \ - Previous internal state:\n\ - {:#?}\n\ - New internal state after calling simplify() {} times:\n\ - {:#?}", before_simplified, iter + 1, state); + panic!( + "simplify() returned true after having returned false. \ + Previous internal state:\n\ + {:#?}\n\ + New internal state after calling simplify() {} times:\n\ + {:#?}", + before_simplified, + iter + 1, + state + ); } } } diff -Nru cargo-0.35.0/vendor/proptest/src/strategy/unions.rs cargo-0.37.0/vendor/proptest/src/strategy/unions.rs --- cargo-0.35.0/vendor/proptest/src/strategy/unions.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/strategy/unions.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,31 +7,37 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use crate::std_facade::{fmt, Arc, Vec}; use core::cmp::{max, min}; use core::u32; -use std_facade::Vec; -#[cfg(not(feature="std"))] +#[cfg(not(feature = "std"))] use num_traits::float::FloatCore; -use num::sample_uniform; -use strategy::traits::*; -use test_runner::*; +use crate::num::sample_uniform; +use crate::strategy::{lazy::LazyValueTree, traits::*}; +use crate::test_runner::*; /// A **relative** `weight` of a particular `Strategy` corresponding to `T` /// coupled with `T` itself. The weight is currently given in `u32`. pub type W = (u32, T); +/// A **relative** `weight` of a particular `Strategy` corresponding to `T` +/// coupled with `Arc`. The weight is currently given in `u32`. +pub type WA = (u32, Arc); + /// A `Strategy` which picks from one of several delegate `Stragegy`s. /// /// See `Strategy::prop_union()`. #[derive(Clone, Debug)] #[must_use = "strategies do nothing unless used"] -pub struct Union { - options: Vec>, +pub struct Union { + // In principle T could be any `Strategy + Clone`, but that isn't possible + // for BC reasons with the 0.9 series. + options: Vec>, } -impl Union { +impl Union { /// Create a strategy which selects uniformly from the given delegate /// strategies. /// @@ -43,15 +49,17 @@ /// /// Panics if `options` is empty. pub fn new(options: impl IntoIterator) -> Self { - let options: Vec> = options.into_iter() - .map(|v| (1, v)).collect(); + let options: Vec> = + options.into_iter().map(|v| (1, Arc::new(v))).collect(); assert!(!options.is_empty()); Self { options } } - pub(crate) fn try_new(it: impl Iterator>) - -> Result { - let options: Vec> = it.map(|r| r.map(|v| (1, v))) + pub(crate) fn try_new( + it: impl Iterator>, + ) -> Result { + let options: Vec> = it + .map(|r| r.map(|v| (1, Arc::new(v)))) .collect::>()?; assert!(!options.is_empty()); @@ -72,58 +80,79 @@ /// Panics if the sum of the weights overflows a `u32`. pub fn new_weighted(options: Vec>) -> Self { assert!(!options.is_empty()); - assert!(!options.iter().any(|&(w, _)| 0 == w), - "Union option has a weight of 0"); - assert!(options.iter().map(|&(w, _)| u64::from(w)).sum::() <= - u64::from(u32::MAX), "Union weights overflow u32"); + assert!( + !options.iter().any(|&(w, _)| 0 == w), + "Union option has a weight of 0" + ); + assert!( + options.iter().map(|&(w, _)| u64::from(w)).sum::() + <= u64::from(u32::MAX), + "Union weights overflow u32" + ); + let options = + options.into_iter().map(|(w, v)| (w, Arc::new(v))).collect(); Self { options } } /// Add `other` as an additional alternate strategy with weight 1. pub fn or(mut self, other: T) -> Self { - self.options.push((1, other)); + self.options.push((1, Arc::new(other))); self } } -fn pick_weighted>(runner: &mut TestRunner, - weights1: I, weights2: I) -> usize { +fn pick_weighted>( + runner: &mut TestRunner, + weights1: I, + weights2: I, +) -> usize { let sum = weights1.map(u64::from).sum(); let weighted_pick = sample_uniform(runner, 0..sum); - weights2.scan(0u64, |state, w| { - *state += u64::from(w); - Some(*state) - }).filter(|&v| v <= weighted_pick).count() + weights2 + .scan(0u64, |state, w| { + *state += u64::from(w); + Some(*state) + }) + .filter(|&v| v <= weighted_pick) + .count() } -impl Strategy for Union { - type Tree = UnionValueTree; +impl Strategy for Union { + type Tree = UnionValueTree; type Value = T::Value; fn new_tree(&self, runner: &mut TestRunner) -> NewTree { - fn extract_weight(&(w, _): &W) -> u32 { w } + fn extract_weight(&(w, _): &WA) -> u32 { + w + } let pick = pick_weighted( runner, self.options.iter().map(extract_weight::), - self.options.iter().map(extract_weight::)); + self.options.iter().map(extract_weight::), + ); let mut options = Vec::with_capacity(pick); - for option in &self.options[0..pick+1] { - options.push(option.1.new_tree(runner)?); + + // Delay initialization for all options less than pick. + for option in &self.options[0..pick] { + options.push(LazyValueTree::new(Arc::clone(&option.1), runner)); } - Ok(UnionValueTree { options, pick, min_pick: 0, prev_pick: None }) - } -} + // Initialize the tree at pick so at least one value is available. Note + // that if generation for the value at pick fails, the entire strategy + // will fail. This seems like the right call. + options.push(LazyValueTree::new_initialized( + self.options[pick].1.new_tree(runner)?, + )); -/// `ValueTree` corresponding to `Union`. -#[derive(Clone, Debug)] -pub struct UnionValueTree { - options: Vec, - pick: usize, - min_pick: usize, - prev_pick: Option, + Ok(UnionValueTree { + options, + pick, + min_pick: 0, + prev_pick: None, + }) + } } macro_rules! access_vec { @@ -169,8 +198,129 @@ } } -impl ValueTree for UnionValueTree { - union_value_tree_body!(T::Value, access_vec); +/// `ValueTree corresponding to `Union`. +pub struct UnionValueTree { + options: Vec>, + // This struct maintains the invariant that between function calls, + // `pick` and `prev_pick` (if Some) always point to initialized + // trees. + pick: usize, + min_pick: usize, + prev_pick: Option, +} + +macro_rules! lazy_union_value_tree_body { + ($typ:ty, $access:ident) => { + type Value = $typ; + + fn current(&self) -> Self::Value { + $access!([] opt = self, self.pick, { + opt.as_inner().unwrap_or_else(|| + panic!( + "value tree at self.pick = {} must be initialized", + self.pick, + ) + ).current() + }) + } + + fn simplify(&mut self) -> bool { + let orig_pick = self.pick; + if $access!([mut] opt = self, orig_pick, { + opt.as_inner_mut().unwrap_or_else(|| + panic!( + "value tree at self.pick = {} must be initialized", + orig_pick, + ) + ).simplify() + }) { + self.prev_pick = None; + return true; + } + + assert!( + self.pick >= self.min_pick, + "self.pick = {} should never go below self.min_pick = {}", + self.pick, + self.min_pick, + ); + if self.pick == self.min_pick { + // No more simplification to be done. + return false; + } + + // self.prev_pick is always a valid pick. + self.prev_pick = Some(self.pick); + + let mut next_pick = self.pick; + while next_pick > self.min_pick { + next_pick -= 1; + let initialized = $access!([mut] opt = self, next_pick, { + opt.maybe_init(); + opt.is_initialized() + }); + if initialized { + // next_pick was correctly initialized above. + self.pick = next_pick; + return true; + } + } + + false + } + + fn complicate(&mut self) -> bool { + if let Some(pick) = self.prev_pick { + // simplify() ensures that the previous pick was initialized. + self.pick = pick; + self.min_pick = pick; + self.prev_pick = None; + true + } else { + let pick = self.pick; + $access!([mut] opt = self, pick, { + opt.as_inner_mut().unwrap_or_else(|| + panic!( + "value tree at self.pick = {} must be initialized", + pick, + ) + ).complicate() + }) + } + } + } +} + +impl ValueTree for UnionValueTree { + lazy_union_value_tree_body!(T::Value, access_vec); +} + +impl Clone for UnionValueTree +where + T::Tree: Clone, +{ + fn clone(&self) -> Self { + Self { + options: self.options.clone(), + pick: self.pick, + min_pick: self.min_pick, + prev_pick: self.prev_pick, + } + } +} + +impl fmt::Debug for UnionValueTree +where + T::Tree: fmt::Debug, +{ + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("UnionValueTree") + .field("options", &self.options) + .field("pick", &self.pick) + .field("min_pick", &self.min_pick) + .field("prev_pick", &self.prev_pick) + .finish() + } } macro_rules! def_access_tuple { @@ -218,6 +368,11 @@ /// This allows better performance than vanilla `Union` since one does not need /// to resort to boxing and dynamic dispatch to handle heterogeneous /// strategies. +/// +/// Deprecated in 0.9.4 in favor of `LazyTupleUnion`, which the `prop_oneof!` +/// macro now uses. `TupleUnion` is only kept around to avoid API breakage, +/// and its implementation will be replaced with `LazyTupleUnion` in the next +/// major version. #[must_use = "strategies do nothing unless used"] #[derive(Clone, Copy, Debug)] pub struct TupleUnion(T); @@ -238,6 +393,34 @@ } } +/// Similar to `Union`, but internally uses a tuple to hold the strategies. +/// +/// This allows better performance than vanilla `Union` since one does not need +/// to resort to boxing and dynamic dispatch to handle heterogeneous +/// strategies. +/// +/// The difference between this and `TupleUnion` is that with this, value trees +/// for variants that aren't picked at first are generated lazily. +#[must_use = "strategies do nothing unless used"] +#[derive(Clone, Copy, Debug)] +pub struct LazyTupleUnion(T); + +impl LazyTupleUnion { + /// Wrap `tuple` in a `TupleUnion`. + /// + /// The struct definition allows any `T` for `tuple`, but to be useful, it + /// must be a 2- to 10-tuple of `(u32, Arc)` pairs where all + /// strategies ultimately produce the same value. Each `u32` indicates the + /// relative weight of its corresponding strategy. + /// You may use `WA` as an alias for `(u32, Arc)`. + /// + /// Using this constructor directly is discouraged; prefer to use + /// `prop_oneof!` since it is generally clearer. + pub fn new(tuple: T) -> Self { + LazyTupleUnion(tuple) + } +} + macro_rules! tuple_union { ($($gen:ident $ix:tt)*) => { impl),*> @@ -265,6 +448,43 @@ }) } } + + impl),*> + Strategy for LazyTupleUnion<(WA, $(WA<$gen>),*)> { + type Tree = LazyTupleUnionValueTree< + (LazyValueTree, $(Option>),*)>; + type Value = A::Value; + + fn new_tree(&self, runner: &mut TestRunner) -> NewTree { + let weights = [((self.0).0).0, $(((self.0).$ix).0),*]; + let pick = pick_weighted(runner, weights.iter().cloned(), + weights.iter().cloned()); + + Ok(LazyTupleUnionValueTree { + options: ( + if 0 == pick { + LazyValueTree::new_initialized( + ((self.0).0).1.new_tree(runner)?) + } else { + LazyValueTree::new( + Arc::clone(&((self.0).0).1), runner) + }, + $( + if $ix == pick { + Some(LazyValueTree::new_initialized( + ((self.0).$ix).1.new_tree(runner)?)) + } else if $ix < pick { + Some(LazyValueTree::new( + Arc::clone(&((self.0).$ix).1), runner)) + } else { + None + }),*), + pick: pick, + min_pick: 0, + prev_pick: None, + }) + } + } } } @@ -287,12 +507,28 @@ prev_pick: Option, } +/// `ValueTree` type produced by `LazyTupleUnion`. +#[derive(Clone, Copy, Debug)] +pub struct LazyTupleUnionValueTree { + options: T, + pick: usize, + min_pick: usize, + prev_pick: Option, +} + macro_rules! value_tree_tuple { ($access:ident, $($gen:ident)*) => { impl),*> ValueTree for TupleUnionValueTree<(A, $(Option<$gen>),*)> { union_value_tree_body!(A::Value, $access); } + + impl),*> ValueTree + for LazyTupleUnionValueTree< + (LazyValueTree, $(Option>),*) + > { + lazy_union_value_tree_body!(A::Value, $access); + } } } @@ -326,8 +562,10 @@ assert!(f > 0.0 && f < 1.0, "Invalid probability: {}", f); // Clamp to 1..WEIGHT_BASE-1 so that we never produce a weight of 0. - let pos = max(1, min(WEIGHT_BASE - 1, - (f * f64::from(WEIGHT_BASE)).round() as u32)); + let pos = max( + 1, + min(WEIGHT_BASE - 1, (f * f64::from(WEIGHT_BASE)).round() as u32), + ); let neg = WEIGHT_BASE - pos; (pos, neg) @@ -335,8 +573,8 @@ #[cfg(test)] mod test { - use strategy::just::Just; use super::*; + use crate::strategy::just::Just; // FIXME(2018-06-01): figure out a way to run this test on no_std. // The problem is that the default seed is fixed and does not produce @@ -353,8 +591,8 @@ let mut passed = 0; let mut converged_low = 0; let mut converged_high = 0; + let mut runner = TestRunner::deterministic(); for _ in 0..256 { - let mut runner = TestRunner::default(); let case = input.new_tree(&mut runner).unwrap(); let result = runner.run_one(case, |v| { prop_assert!(v < 15); @@ -369,12 +607,17 @@ } } - assert!(passed >= 32 && passed <= 96, - "Bad passed count: {}", passed); - assert!(converged_low >= 32 && converged_low <= 160, - "Bad converged_low count: {}", converged_low); - assert!(converged_high >= 32 && converged_high <= 160, - "Bad converged_high count: {}", converged_high); + assert!(passed >= 32 && passed <= 96, "Bad passed count: {}", passed); + assert!( + converged_low >= 32 && converged_low <= 160, + "Bad converged_low count: {}", + converged_low + ); + assert!( + converged_high >= 32 && converged_high <= 160, + "Bad converged_high count: {}", + converged_high + ); } #[test] @@ -386,7 +629,7 @@ ]); let mut counts = [0, 0, 0]; - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); for _ in 0..65536 { counts[input.new_tree(&mut runner).unwrap().current()] += 1; } @@ -394,26 +637,27 @@ println!("{:?}", counts); assert!(counts[0] > 0); assert!(counts[2] > 0); - assert!(counts[1] > counts[0] * 3/2); - assert!(counts[1] > counts[2] * 3/2); + assert!(counts[1] > counts[0] * 3 / 2); + assert!(counts[1] > counts[2] * 3 / 2); } #[test] fn test_union_sanity() { - check_strategy_sanity(Union::new_weighted(vec![ - (1, 0i32..100), - (2, 200i32..300), - (1, 400i32..500), - ]), None); + check_strategy_sanity( + Union::new_weighted(vec![ + (1, 0i32..100), + (2, 200i32..300), + (1, 400i32..500), + ]), + None, + ); } // FIXME(2018-06-01): See note on `test_union`. #[cfg(feature = "std")] #[test] fn test_tuple_union() { - let input = TupleUnion::new( - ((1, 10u32..20u32), - (1, 30u32..40u32))); + let input = TupleUnion::new(((1, 10u32..20u32), (1, 30u32..40u32))); // Expect that 25% of cases pass (left input happens to be < 15, and // left is chosen as initial value). Of the 75% that fail, 50% should // converge to 15 and 50% to 30 (the latter because the left is beneath @@ -421,8 +665,8 @@ let mut passed = 0; let mut converged_low = 0; let mut converged_high = 0; + let mut runner = TestRunner::deterministic(); for _ in 0..256 { - let mut runner = TestRunner::default(); let case = input.new_tree(&mut runner).unwrap(); let result = runner.run_one(case, |v| { prop_assert!(v < 15); @@ -437,12 +681,17 @@ } } - assert!(passed >= 32 && passed <= 96, - "Bad passed count: {}", passed); - assert!(converged_low >= 32 && converged_low <= 160, - "Bad converged_low count: {}", converged_low); - assert!(converged_high >= 32 && converged_high <= 160, - "Bad converged_high count: {}", converged_high); + assert!(passed >= 32 && passed <= 96, "Bad passed count: {}", passed); + assert!( + converged_low >= 32 && converged_low <= 160, + "Bad converged_low count: {}", + converged_low + ); + assert!( + converged_high >= 32 && converged_high <= 160, + "Bad converged_high count: {}", + converged_high + ); } #[test] @@ -454,7 +703,7 @@ )); let mut counts = [0, 0, 0]; - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); for _ in 0..65536 { counts[input.new_tree(&mut runner).unwrap().current()] += 1; } @@ -462,13 +711,13 @@ println!("{:?}", counts); assert!(counts[0] > 0); assert!(counts[2] > 0); - assert!(counts[1] > counts[0] * 3/2); - assert!(counts[1] > counts[2] * 3/2); + assert!(counts[1] > counts[0] * 3 / 2); + assert!(counts[1] > counts[2] * 3 / 2); } #[test] fn test_tuple_union_all_sizes() { - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); let r = 1i32..10; macro_rules! test { @@ -504,8 +753,75 @@ #[test] fn test_tuple_union_sanity() { check_strategy_sanity( - TupleUnion::new(((1, 0i32..100i32), (1, 200i32..1000i32), - (1, 2000i32..3000i32))), - None); + TupleUnion::new(( + (1, 0i32..100i32), + (1, 200i32..1000i32), + (1, 2000i32..3000i32), + )), + None, + ); + } + + #[test] + fn test_lazy_tuple_union_sanity() { + check_strategy_sanity( + LazyTupleUnion::new(( + (1, Arc::new(0i32..100i32)), + (1, Arc::new(200i32..1000i32)), + (1, Arc::new(2000i32..3000i32)), + )), + None, + ); + } + + /// Test that unions work even if local filtering causes errors. + #[test] + fn test_filter_union_sanity() { + let filter_strategy = (0u32..256).prop_filter("!%5", |&v| 0 != v % 5); + check_strategy_sanity( + Union::new(vec![filter_strategy; 8]), + Some(filter_sanity_options()), + ); + } + + /// Test that unions work even if local filtering causes errors. + #[test] + fn test_filter_tuple_union_sanity() { + let filter_strategy = (0u32..256).prop_filter("!%5", |&v| 0 != v % 5); + check_strategy_sanity( + TupleUnion::new(( + (1, filter_strategy.clone()), + (1, filter_strategy.clone()), + (1, filter_strategy.clone()), + (1, filter_strategy.clone()), + )), + Some(filter_sanity_options()), + ); + } + + /// Test that lazy tuple unions work even if local filtering causes errors. + #[test] + fn test_filter_lazy_tuple_union_sanity() { + let filter_strategy = (0u32..256).prop_filter("!%5", |&v| 0 != v % 5); + check_strategy_sanity( + LazyTupleUnion::new(( + (1, Arc::new(filter_strategy.clone())), + (1, Arc::new(filter_strategy.clone())), + (1, Arc::new(filter_strategy.clone())), + (1, Arc::new(filter_strategy.clone())), + )), + Some(filter_sanity_options()), + ); + } + + fn filter_sanity_options() -> CheckStrategySanityOptions { + CheckStrategySanityOptions { + // Due to internal rejection sampling, `simplify()` can + // converge back to what `complicate()` would do. + strict_complicate_after_simplify: false, + // Make failed filters return errors to test edge cases. + error_on_local_rejects: true, + ..CheckStrategySanityOptions::default() + } } } diff -Nru cargo-0.35.0/vendor/proptest/src/string.rs cargo-0.37.0/vendor/proptest/src/string.rs --- cargo-0.35.0/vendor/proptest/src/string.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/string.rs 2019-07-17 05:42:23.000000000 +0000 @@ -10,23 +10,26 @@ //! Strategies for generating strings and byte strings from regular //! expressions. -use core::mem; +use crate::std_facade::{Box, Cow, String, ToOwned, Vec}; use core::fmt; +use core::mem; use core::ops::RangeInclusive; use core::u32; -use std_facade::{Cow, Box, String, Vec, ToOwned}; -use regex_syntax::{Parser, Error as ParseError}; use regex_syntax::hir::{ - self, Hir, HirKind::*, Literal::*, - RepetitionKind::{self, *}, RepetitionRange::* + self, Hir, + HirKind::*, + Literal::*, + RepetitionKind::{self, *}, + RepetitionRange::*, }; +use regex_syntax::{Error as ParseError, Parser}; -use bool; -use char; -use collection::{vec, size_range, SizeRange}; -use strategy::*; -use test_runner::*; +use crate::bool; +use crate::char; +use crate::collection::{size_range, vec, SizeRange}; +use crate::strategy::*; +use crate::test_runner::*; /// Wraps the regex that forms the `Strategy` for `String` so that a sensible /// `Default` can be given. The default is a string of non-control characters. @@ -34,11 +37,15 @@ pub struct StringParam(&'static str); impl From for &'static str { - fn from(x: StringParam) -> Self { x.0 } + fn from(x: StringParam) -> Self { + x.0 + } } impl From<&'static str> for StringParam { - fn from(x: &'static str) -> Self { StringParam(x) } + fn from(x: &'static str) -> Self { + StringParam(x) + } } impl Default for StringParam { @@ -100,6 +107,37 @@ type ParseResult = Result, Error>; +#[doc(hidden)] +/// A type which knows how to produce a `Strategy` from a regular expression +/// generating the type. +/// +/// This trait exists for the benefit of `#[proptest(regex = "...")]`. +/// It is semver extempt, so use at your own risk. +/// If you found a use for the trait beyond `Vec` and `String`, +/// please file an issue at https://github.com/AltSysrq/proptest. +pub trait StrategyFromRegex: Sized + fmt::Debug { + type Strategy: Strategy; + + /// Produce a strategy for `Self` from the `regex`. + fn from_regex(regex: &str) -> Self::Strategy; +} + +impl StrategyFromRegex for String { + type Strategy = RegexGeneratorStrategy; + + fn from_regex(regex: &str) -> Self::Strategy { + string_regex(regex).unwrap() + } +} + +impl StrategyFromRegex for Vec { + type Strategy = RegexGeneratorStrategy; + + fn from_regex(regex: &str) -> Self::Strategy { + bytes_regex(regex).unwrap() + } +} + /// Creates a strategy which generates strings matching the given regular /// expression. /// @@ -111,9 +149,14 @@ /// Like `string_regex()`, but allows providing a pre-parsed expression. pub fn string_regex_parsed(expr: &Hir) -> ParseResult { - bytes_regex_parsed(expr).map( - |v| v.prop_map(|bytes| String::from_utf8(bytes).expect( - "non-utf8 string")).sboxed()).map(RegexGeneratorStrategy) + bytes_regex_parsed(expr) + .map(|v| { + v.prop_map(|bytes| { + String::from_utf8(bytes).expect("non-utf8 string") + }) + .sboxed() + }) + .map(RegexGeneratorStrategy) } /// Creates a strategy which generates byte strings matching the given regular @@ -130,50 +173,73 @@ Literal(lit) => Ok(Just(match lit { Unicode(scalar) => to_bytes(*scalar), Byte(byte) => vec![*byte], - }).sboxed()), + }) + .sboxed()), Class(class) => Ok(match class { - hir::Class::Unicode(class) => - unicode_class_strategy(class).prop_map(to_bytes).sboxed(), + hir::Class::Unicode(class) => { + unicode_class_strategy(class).prop_map(to_bytes).sboxed() + } hir::Class::Bytes(class) => { - let subs = class.iter().map(|r| r.start() ..= r.end()); + let subs = class.iter().map(|r| r.start()..=r.end()); Union::new(subs).prop_map(|b| vec![b]).sboxed() } }), - Repetition(rep) => Ok( - vec(bytes_regex_parsed(&rep.hir)?, to_range(rep.kind.clone())?) - .prop_map(|parts| parts.into_iter().fold( - vec![], |mut acc, child| { acc.extend(child); acc })) - .sboxed() - ), + Repetition(rep) => Ok(vec( + bytes_regex_parsed(&rep.hir)?, + to_range(rep.kind.clone())?, + ) + .prop_map(|parts| { + parts.into_iter().fold(vec![], |mut acc, child| { + acc.extend(child); + acc + }) + }) + .sboxed()), Group(group) => bytes_regex_parsed(&group.hir).map(|v| v.0), Concat(subs) => { - let subs = ConcatIter { iter: subs.iter(), buf: vec![], next: None }; + let subs = ConcatIter { + iter: subs.iter(), + buf: vec![], + next: None, + }; let ext = |(mut lhs, rhs): (Vec<_>, _)| { lhs.extend(rhs); lhs }; - Ok(subs.fold(Ok(None), |accum: Result<_, Error>, rhs| Ok(match accum? { - None => Some(rhs?.sboxed()), - Some(accum) => Some((accum, rhs?).prop_map(ext).sboxed()), - }))?.unwrap_or_else(|| Just(vec![]).sboxed())) - }, + Ok(subs + .fold(Ok(None), |accum: Result<_, Error>, rhs| { + Ok(match accum? { + None => Some(rhs?.sboxed()), + Some(accum) => { + Some((accum, rhs?).prop_map(ext).sboxed()) + } + }) + })? + .unwrap_or_else(|| Just(vec![]).sboxed())) + } - Alternation(subs) => - Ok(Union::try_new(subs.iter().map(bytes_regex_parsed))?.sboxed()), + Alternation(subs) => { + Ok(Union::try_new(subs.iter().map(bytes_regex_parsed))?.sboxed()) + } - Anchor(_) => - unsupported("line/text anchors not supported for string generation"), + Anchor(_) => { + unsupported("line/text anchors not supported for string generation") + } - WordBoundary(_) => - unsupported("word boundary tests not supported for string generation"), - }.map(RegexGeneratorStrategy) + WordBoundary(_) => unsupported( + "word boundary tests not supported for string generation", + ), + } + .map(RegexGeneratorStrategy) } -fn unicode_class_strategy(class: &hir::ClassUnicode) -> char::CharStrategy<'static> { +fn unicode_class_strategy( + class: &hir::ClassUnicode, +) -> char::CharStrategy<'static> { static NONL_RANGES: &[RangeInclusive] = &[ '\x00'..='\x09', // Multiple instances of the latter range to partially make up @@ -186,13 +252,16 @@ '\x0B'..=::core::char::MAX, ]; - let dotnnl = |x: &hir::ClassUnicodeRange, y: &hir::ClassUnicodeRange| - x.start() == '\0' && x.end() == '\x09' && - y.start() == '\x0B' && y.end() == '\u{10FFFF}'; + let dotnnl = |x: &hir::ClassUnicodeRange, y: &hir::ClassUnicodeRange| { + x.start() == '\0' + && x.end() == '\x09' + && y.start() == '\x0B' + && y.end() == '\u{10FFFF}' + }; char::ranges(match class.ranges() { [x, y] if dotnnl(x, y) || dotnnl(y, x) => Cow::Borrowed(NONL_RANGES), - _ => Cow::Owned(class.iter().map(|r| r.start() ..= r.end()).collect()), + _ => Cow::Owned(class.iter().map(|r| r.start()..=r.end()).collect()), }) } @@ -202,9 +271,11 @@ next: Option<&'a Hir>, } -fn flush_lit_buf(it: &mut ConcatIter<'_, I>) -> Option>> { +fn flush_lit_buf( + it: &mut ConcatIter<'_, I>, +) -> Option>> { Some(Ok(RegexGeneratorStrategy( - Just(mem::replace(&mut it.buf, vec![])).sboxed() + Just(mem::replace(&mut it.buf, vec![])).sboxed(), ))) } @@ -224,15 +295,17 @@ Literal(Unicode(scalar)) => self.buf.extend(to_bytes(*scalar)), Literal(Byte(byte)) => self.buf.push(*byte), // Ecountered a non-literal. - _ => return if !self.buf.is_empty() { - // We've accumulated a literal from before, flush it out. - // Store this node so we deal with it the next call. - self.next = Some(next); - flush_lit_buf(self) - } else { - // We didn't; just yield this node. - Some(bytes_regex_parsed(next)) - }, + _ => { + return if !self.buf.is_empty() { + // We've accumulated a literal from before, flush it out. + // Store this node so we deal with it the next call. + self.next = Some(next); + flush_lit_buf(self) + } else { + // We didn't; just yield this node. + Some(bytes_regex_parsed(next)) + }; + } } } @@ -251,8 +324,11 @@ ZeroOrMore => size_range(0..=32), OneOrMore => size_range(1..=32), Range(range) => match range { - Exactly(count) if u32::MAX == count => - return unsupported("Cannot have repetition of exactly u32::MAX"), + Exactly(count) if u32::MAX == count => { + return unsupported( + "Cannot have repetition of exactly u32::MAX", + ) + } Exactly(count) => size_range(count as usize), AtLeast(min) => { let max = if min < u32::MAX as u32 / 2 { @@ -261,12 +337,12 @@ u32::MAX as usize }; size_range((min as usize)..max) - }, - Bounded(_, max) if u32::MAX == max => - return unsupported("Cannot have repetition max of u32::MAX"), - Bounded(min, max) => - size_range((min as usize)..(max as usize + 1)) - } + } + Bounded(_, max) if u32::MAX == max => { + return unsupported("Cannot have repetition max of u32::MAX") + } + Bounded(min, max) => size_range((min as usize)..(max as usize + 1)), + }, }) } @@ -291,23 +367,38 @@ use super::*; - fn do_test(pattern: &str, min_distinct: usize, max_distinct: usize, - iterations: usize) { + fn do_test( + pattern: &str, + min_distinct: usize, + max_distinct: usize, + iterations: usize, + ) { let generated = generate_values_matching_regex(pattern, iterations); - assert!(generated.len() >= min_distinct, - "Expected to generate at least {} strings, but only \ - generated {}", min_distinct, generated.len()); - assert!(generated.len() <= max_distinct, - "Expected to generate at most {} strings, but \ - generated {}", max_distinct, generated.len()); - } - - fn generate_values_matching_regex(pattern: &str, iterations: usize) -> HashSet { + assert!( + generated.len() >= min_distinct, + "Expected to generate at least {} strings, but only \ + generated {}", + min_distinct, + generated.len() + ); + assert!( + generated.len() <= max_distinct, + "Expected to generate at most {} strings, but \ + generated {}", + max_distinct, + generated.len() + ); + } + + fn generate_values_matching_regex( + pattern: &str, + iterations: usize, + ) -> HashSet { let rx = Regex::new(pattern).unwrap(); let mut generated = HashSet::new(); let strategy = string_regex(pattern).unwrap(); - let mut runner = TestRunner::default(); + let mut runner = TestRunner::deterministic(); for _ in 0..iterations { let mut value = strategy.new_tree(&mut runner).unwrap(); @@ -319,13 +410,17 @@ false }; if !ok { - panic!("Generated string {:?} which does not match {:?}", - s, pattern); + panic!( + "Generated string {:?} which does not match {:?}", + s, pattern + ); } generated.insert(s); - if !value.simplify() { break; } + if !value.simplify() { + break; + } } } generated @@ -411,7 +506,7 @@ do_test("\\d+", 1, 65536, 256); } - fn assert_send_and_sync(_: T) { } + fn assert_send_and_sync(_: T) {} #[test] fn regex_strategy_is_send_and_sync() { @@ -424,7 +519,7 @@ fn $name() { test_generates_matching_strings($value); } - } + }; } fn test_generates_matching_strings(pattern: &str) { @@ -442,15 +537,22 @@ // No more than 1000 simplify steps to keep test time down for _ in 0..1000 { let s = val.current(); - assert!(rx.is_match(&s), - "Produced string {:?}, which does not match {:?}", - s, pattern); - - if !val.simplify() { break; } + assert!( + rx.is_match(&s), + "Produced string {:?}, which does not match {:?}", + s, + pattern + ); + + if !val.simplify() { + break; + } } // Quietly stop testing if we've run for >10 s - if start.elapsed().as_secs() > 10 { break; } + if start.elapsed().as_secs() > 10 { + break; + } } } } diff -Nru cargo-0.35.0/vendor/proptest/src/sugar.rs cargo-0.37.0/vendor/proptest/src/sugar.rs --- cargo-0.35.0/vendor/proptest/src/sugar.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/sugar.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,5 +1,5 @@ //- -// Copyright 2017 Jason Lingle +// Copyright 2017, 2019 The proptest developers // // Licensed under the Apache License, Version 2.0 or the MIT license @@ -7,7 +7,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std_facade::fmt; +use crate::std_facade::fmt; /// Easily define `proptest` tests. /// @@ -23,7 +23,7 @@ /// ### Example /// /// ``` -/// #[macro_use] extern crate proptest; +/// use proptest::prelude::*; /// /// proptest! { /// # /* @@ -48,7 +48,7 @@ /// You can also use the normal argument syntax `pattern: type` as in: /// /// ```rust -/// #[macro_use] extern crate proptest; +/// use proptest::prelude::*; /// /// proptest! { /// # /* @@ -79,7 +79,6 @@ /// evaluates to a `proptest::test_runner::Config` (or a reference to one). /// /// ``` -/// #[macro_use] extern crate proptest; /// use proptest::prelude::*; /// /// proptest! { @@ -111,7 +110,6 @@ /// ### Example /// /// ``` -/// #[macro_use] extern crate proptest; /// use proptest::prelude::*; /// /// #[derive(Debug)] @@ -154,7 +152,7 @@ (#![proptest_config($config:expr)] $( $(#[$meta:meta])* - fn $test_name:ident($($parm:pat in $strategy:expr),+) $body:block + fn $test_name:ident($($parm:pat in $strategy:expr),+ $(,)?) $body:block )*) => { $( $(#[$meta])* @@ -162,7 +160,7 @@ let mut config = $config.clone(); config.test_name = Some( concat!(module_path!(), "::", stringify!($test_name))); - proptest_helper!(@_BODY config ($($parm in $strategy),+) [] $body); + $crate::proptest_helper!(@_BODY config ($($parm in $strategy),+) [] $body); } )* }; @@ -177,15 +175,15 @@ let mut config = $config.clone(); config.test_name = Some( concat!(module_path!(), "::", stringify!($test_name))); - proptest_helper!(@_BODY2 config ($($arg)+) [] $body); + $crate::proptest_helper!(@_BODY2 config ($($arg)+) [] $body); } )* }; ($( $(#[$meta:meta])* - fn $test_name:ident($($parm:pat in $strategy:expr),+) $body:block - )*) => { proptest! { + fn $test_name:ident($($parm:pat in $strategy:expr),+ $(,)?) $body:block + )*) => { $crate::proptest! { #![proptest_config($crate::test_runner::Config::default())] $($(#[$meta])* fn $test_name($($parm in $strategy),+) $body)* @@ -194,58 +192,58 @@ ($( $(#[$meta:meta])* fn $test_name:ident($($arg:tt)+) $body:block - )*) => { proptest! { + )*) => { $crate::proptest! { #![proptest_config($crate::test_runner::Config::default())] $($(#[$meta])* fn $test_name($($arg)+) $body)* } }; - (|($($parm:pat in $strategy:expr),+)| $body:expr) => { - proptest!( + (|($($parm:pat in $strategy:expr),+ $(,)?)| $body:expr) => { + $crate::proptest!( $crate::test_runner::Config::default(), |($($parm in $strategy),+)| $body) }; - (move |($($parm:pat in $strategy:expr),+)| $body:expr) => { - proptest!( + (move |($($parm:pat in $strategy:expr),+ $(,)?)| $body:expr) => { + $crate::proptest!( $crate::test_runner::Config::default(), move |($($parm in $strategy),+)| $body) }; (|($($arg:tt)+)| $body:expr) => { - proptest!( + $crate::proptest!( $crate::test_runner::Config::default(), |($($arg)+)| $body) }; (move |($($arg:tt)+)| $body:expr) => { - proptest!( + $crate::proptest!( $crate::test_runner::Config::default(), move |($($arg)+)| $body) }; - ($config:expr, |($($parm:pat in $strategy:expr),+)| $body:expr) => { { + ($config:expr, |($($parm:pat in $strategy:expr),+ $(,)?)| $body:expr) => { { let mut config = $config.__sugar_to_owned(); $crate::sugar::force_no_fork(&mut config); - proptest_helper!(@_BODY config ($($parm in $strategy),+) [] $body) + $crate::proptest_helper!(@_BODY config ($($parm in $strategy),+) [] $body) } }; - ($config:expr, move |($($parm:pat in $strategy:expr),+)| $body:expr) => { { + ($config:expr, move |($($parm:pat in $strategy:expr),+ $(,)?)| $body:expr) => { { let mut config = $config.__sugar_to_owned(); $crate::sugar::force_no_fork(&mut config); - proptest_helper!(@_BODY config ($($parm in $strategy),+) [move] $body) + $crate::proptest_helper!(@_BODY config ($($parm in $strategy),+) [move] $body) } }; ($config:expr, |($($arg:tt)+)| $body:expr) => { { let mut config = $config.__sugar_to_owned(); $crate::sugar::force_no_fork(&mut config); - proptest_helper!(@_BODY2 config ($($arg)+) [] $body); + $crate::proptest_helper!(@_BODY2 config ($($arg)+) [] $body); } }; ($config:expr, move |($($arg:tt)+)| $body:expr) => { { let mut config = $config.__sugar_to_owned(); $crate::sugar::force_no_fork(&mut config); - proptest_helper!(@_BODY2 config ($($arg)+) [move] $body); + $crate::proptest_helper!(@_BODY2 config ($($arg)+) [move] $body); } }; } @@ -262,10 +260,10 @@ #[macro_export] macro_rules! prop_assume { ($expr:expr) => { - prop_assume!($expr, "{}", stringify!($expr)) + $crate::prop_assume!($expr, "{}", stringify!($expr)) }; - ($expr:expr, $fmt:tt $(, $fmt_arg:expr),*) => { + ($expr:expr, $fmt:tt $(, $fmt_arg:expr),* $(,)?) => { if !$expr { return ::std::result::Result::Err( $crate::test_runner::TestCaseError::reject( @@ -298,7 +296,6 @@ /// ## Example /// /// ```rust,no_run -/// #[macro_use] extern crate proptest; /// use proptest::prelude::*; /// /// #[derive(Clone, Copy, Debug)] @@ -328,46 +325,52 @@ /// ``` #[macro_export] macro_rules! prop_oneof { - ($($item:expr),+ $(,)*) => { - prop_oneof![ + ($($item:expr),+ $(,)?) => { + $crate::prop_oneof![ $(1 => $item),* ] }; - ($_weight0:expr => $item0:expr $(,)*) => { $item0 }; + ($_weight0:expr => $item0:expr $(,)?) => { $item0 }; ($weight0:expr => $item0:expr, - $weight1:expr => $item1:expr $(,)*) => { - $crate::strategy::TupleUnion::new( - (($weight0, $item0), ($weight1, $item1))) + $weight1:expr => $item1:expr $(,)?) => { + $crate::strategy::LazyTupleUnion::new( + (($weight0, $crate::std_facade::Arc::new($item0)), + ($weight1, $crate::std_facade::Arc::new($item1)))) }; ($weight0:expr => $item0:expr, $weight1:expr => $item1:expr, - $weight2:expr => $item2:expr $(,)*) => { - $crate::strategy::TupleUnion::new( - (($weight0, $item0), ($weight1, $item1), - ($weight2, $item2))) + $weight2:expr => $item2:expr $(,)?) => { + $crate::strategy::LazyTupleUnion::new( + (($weight0, $crate::std_facade::Arc::new($item0)), + ($weight1, $crate::std_facade::Arc::new($item1)), + ($weight2, $crate::std_facade::Arc::new($item2)))) }; ($weight0:expr => $item0:expr, $weight1:expr => $item1:expr, $weight2:expr => $item2:expr, - $weight3:expr => $item3:expr $(,)*) => { - $crate::strategy::TupleUnion::new( - (($weight0, $item0), ($weight1, $item1), - ($weight2, $item2), ($weight3, $item3))) + $weight3:expr => $item3:expr $(,)?) => { + $crate::strategy::LazyTupleUnion::new( + (($weight0, $crate::std_facade::Arc::new($item0)), + ($weight1, $crate::std_facade::Arc::new($item1)), + ($weight2, $crate::std_facade::Arc::new($item2)), + ($weight3, $crate::std_facade::Arc::new($item3)))) }; ($weight0:expr => $item0:expr, $weight1:expr => $item1:expr, $weight2:expr => $item2:expr, $weight3:expr => $item3:expr, - $weight4:expr => $item4:expr $(,)*) => { - $crate::strategy::TupleUnion::new( - (($weight0, $item0), ($weight1, $item1), - ($weight2, $item2), ($weight3, $item3), - ($weight4, $item4))) + $weight4:expr => $item4:expr $(,)?) => { + $crate::strategy::LazyTupleUnion::new( + (($weight0, $crate::std_facade::Arc::new($item0)), + ($weight1, $crate::std_facade::Arc::new($item1)), + ($weight2, $crate::std_facade::Arc::new($item2)), + ($weight3, $crate::std_facade::Arc::new($item3)), + ($weight4, $crate::std_facade::Arc::new($item4)))) }; ($weight0:expr => $item0:expr, @@ -375,11 +378,14 @@ $weight2:expr => $item2:expr, $weight3:expr => $item3:expr, $weight4:expr => $item4:expr, - $weight5:expr => $item5:expr $(,)*) => { - $crate::strategy::TupleUnion::new( - (($weight0, $item0), ($weight1, $item1), - ($weight2, $item2), ($weight3, $item3), - ($weight4, $item4), ($weight5, $item5))) + $weight5:expr => $item5:expr $(,)?) => { + $crate::strategy::LazyTupleUnion::new( + (($weight0, $crate::std_facade::Arc::new($item0)), + ($weight1, $crate::std_facade::Arc::new($item1)), + ($weight2, $crate::std_facade::Arc::new($item2)), + ($weight3, $crate::std_facade::Arc::new($item3)), + ($weight4, $crate::std_facade::Arc::new($item4)), + ($weight5, $crate::std_facade::Arc::new($item5)))) }; ($weight0:expr => $item0:expr, @@ -388,12 +394,15 @@ $weight3:expr => $item3:expr, $weight4:expr => $item4:expr, $weight5:expr => $item5:expr, - $weight6:expr => $item6:expr $(,)*) => { - $crate::strategy::TupleUnion::new( - (($weight0, $item0), ($weight1, $item1), - ($weight2, $item2), ($weight3, $item3), - ($weight4, $item4), ($weight5, $item5), - ($weight6, $item6))) + $weight6:expr => $item6:expr $(,)?) => { + $crate::strategy::LazyTupleUnion::new( + (($weight0, $crate::std_facade::Arc::new($item0)), + ($weight1, $crate::std_facade::Arc::new($item1)), + ($weight2, $crate::std_facade::Arc::new($item2)), + ($weight3, $crate::std_facade::Arc::new($item3)), + ($weight4, $crate::std_facade::Arc::new($item4)), + ($weight5, $crate::std_facade::Arc::new($item5)), + ($weight6, $crate::std_facade::Arc::new($item6)))) }; ($weight0:expr => $item0:expr, @@ -403,12 +412,16 @@ $weight4:expr => $item4:expr, $weight5:expr => $item5:expr, $weight6:expr => $item6:expr, - $weight7:expr => $item7:expr $(,)*) => { - $crate::strategy::TupleUnion::new( - (($weight0, $item0), ($weight1, $item1), - ($weight2, $item2), ($weight3, $item3), - ($weight4, $item4), ($weight5, $item5), - ($weight6, $item6), ($weight7, $item7))) + $weight7:expr => $item7:expr $(,)?) => { + $crate::strategy::LazyTupleUnion::new( + (($weight0, $crate::std_facade::Arc::new($item0)), + ($weight1, $crate::std_facade::Arc::new($item1)), + ($weight2, $crate::std_facade::Arc::new($item2)), + ($weight3, $crate::std_facade::Arc::new($item3)), + ($weight4, $crate::std_facade::Arc::new($item4)), + ($weight5, $crate::std_facade::Arc::new($item5)), + ($weight6, $crate::std_facade::Arc::new($item6)), + ($weight7, $crate::std_facade::Arc::new($item7)))) }; ($weight0:expr => $item0:expr, @@ -419,13 +432,17 @@ $weight5:expr => $item5:expr, $weight6:expr => $item6:expr, $weight7:expr => $item7:expr, - $weight8:expr => $item8:expr $(,)*) => { - $crate::strategy::TupleUnion::new( - (($weight0, $item0), ($weight1, $item1), - ($weight2, $item2), ($weight3, $item3), - ($weight4, $item4), ($weight5, $item5), - ($weight6, $item6), ($weight7, $item7), - ($weight8, $item8))) + $weight8:expr => $item8:expr $(,)?) => { + $crate::strategy::LazyTupleUnion::new( + (($weight0, $crate::std_facade::Arc::new($item0)), + ($weight1, $crate::std_facade::Arc::new($item1)), + ($weight2, $crate::std_facade::Arc::new($item2)), + ($weight3, $crate::std_facade::Arc::new($item3)), + ($weight4, $crate::std_facade::Arc::new($item4)), + ($weight5, $crate::std_facade::Arc::new($item5)), + ($weight6, $crate::std_facade::Arc::new($item6)), + ($weight7, $crate::std_facade::Arc::new($item7)), + ($weight8, $crate::std_facade::Arc::new($item8)))) }; ($weight0:expr => $item0:expr, @@ -437,16 +454,21 @@ $weight6:expr => $item6:expr, $weight7:expr => $item7:expr, $weight8:expr => $item8:expr, - $weight9:expr => $item9:expr $(,)*) => { - $crate::strategy::TupleUnion::new( - (($weight0, $item0), ($weight1, $item1), - ($weight2, $item2), ($weight3, $item3), - ($weight4, $item4), ($weight5, $item5), - ($weight6, $item6), ($weight7, $item7), - ($weight8, $item8), ($weight9, $item9))) + $weight9:expr => $item9:expr $(,)?) => { + $crate::strategy::LazyTupleUnion::new( + (($weight0, $crate::std_facade::Arc::new($item0)), + ($weight1, $crate::std_facade::Arc::new($item1)), + ($weight2, $crate::std_facade::Arc::new($item2)), + ($weight3, $crate::std_facade::Arc::new($item3)), + ($weight4, $crate::std_facade::Arc::new($item4)), + ($weight5, $crate::std_facade::Arc::new($item5)), + ($weight6, $crate::std_facade::Arc::new($item6)), + ($weight7, $crate::std_facade::Arc::new($item7)), + ($weight8, $crate::std_facade::Arc::new($item8)), + ($weight9, $crate::std_facade::Arc::new($item9)))) }; - ($($weight:expr => $item:expr),+ $(,)*) => { + ($($weight:expr => $item:expr),+ $(,)?) => { $crate::strategy::Union::new_weighted(vec![ $(($weight, $crate::strategy::Strategy::boxed($item))),* ]) @@ -466,7 +488,7 @@ /// /// ```rust,no_run /// # #![allow(dead_code)] -/// #[macro_use] extern crate proptest; +/// use proptest::prelude::*; /// /// #[derive(Clone, Debug)] /// struct MyStruct { @@ -490,8 +512,8 @@ /// /// ```rust,no_run /// # #![allow(dead_code)] -/// # #[macro_use] extern crate proptest; -/// +/// # use proptest::prelude::*; +/// # /// # #[derive(Clone, Debug)] /// # struct MyStruct { /// # integer: u32, @@ -515,7 +537,7 @@ /// /// ```rust,no_run /// # #![allow(dead_code)] -/// #[macro_use] extern crate proptest; +/// use proptest::prelude::*; /// /// prop_compose! { /// fn nearby_numbers()(centre in -1000..1000) @@ -535,7 +557,6 @@ /// /// ```rust,no_run /// # #![allow(dead_code)] -/// #[macro_use] extern crate proptest; /// use proptest::prelude::*; /// /// prop_compose! { @@ -554,16 +575,15 @@ /// The second form is sugar around making a strategy tuple, calling /// `prop_flat_map()`, then `prop_map()`. /// -/// To give the function a visibility or unsafe modifier, put it in brackets -/// before the `fn` token. +/// To give the function any modifier which isn't a visibility modifier, put it +/// in brackets before the `fn` token but after any visibility modifier. /// /// ```rust,no_run /// # #![allow(dead_code)] -/// #[macro_use] extern crate proptest; /// use proptest::prelude::*; /// /// prop_compose! { -/// [pub(crate) unsafe] fn pointer()(v in prop::num::usize::ANY) +/// pub(crate) [unsafe] fn pointer()(v in prop::num::usize::ANY) /// -> *const () { /// v as *const () /// } @@ -586,72 +606,80 @@ #[macro_export] macro_rules! prop_compose { ($(#[$meta:meta])* - $([$($vis:tt)*])* fn $name:ident $params:tt - ($($var:pat in $strategy:expr),+ $(,)*) + $vis:vis + $([$($modi:tt)*])? fn $name:ident $params:tt + ($($var:pat in $strategy:expr),+ $(,)?) -> $return_type:ty $body:block) => { #[must_use = "strategies do nothing unless used"] $(#[$meta])* - $($($vis)*)* fn $name $params + $vis + $($($modi)*)? fn $name $params -> impl $crate::strategy::Strategy { - let strat = proptest_helper!(@_WRAP ($($strategy)*)); + let strat = $crate::proptest_helper!(@_WRAP ($($strategy)*)); $crate::strategy::Strategy::prop_map(strat, - |proptest_helper!(@_WRAPPAT ($($var),*))| $body) + move |$crate::proptest_helper!(@_WRAPPAT ($($var),*))| $body) } }; ($(#[$meta:meta])* - $([$($vis:tt)*])* fn $name:ident $params:tt - ($($var:pat in $strategy:expr),+ $(,)*) - ($($var2:pat in $strategy2:expr),+ $(,)*) + $vis:vis + $([$($modi:tt)*])? fn $name:ident $params:tt + ($($var:pat in $strategy:expr),+ $(,)?) + ($($var2:pat in $strategy2:expr),+ $(,)?) -> $return_type:ty $body:block) => { #[must_use = "strategies do nothing unless used"] $(#[$meta])* - $($($vis)*)* fn $name $params + $vis + $($($modi)*)? fn $name $params -> impl $crate::strategy::Strategy { - let strat = proptest_helper!(@_WRAP ($($strategy)*)); + let strat = $crate::proptest_helper!(@_WRAP ($($strategy)*)); let strat = $crate::strategy::Strategy::prop_flat_map( strat, - |proptest_helper!(@_WRAPPAT ($($var),*))| - proptest_helper!(@_WRAP ($($strategy2)*))); + move |$crate::proptest_helper!(@_WRAPPAT ($($var),*))| + $crate::proptest_helper!(@_WRAP ($($strategy2)*))); $crate::strategy::Strategy::prop_map(strat, - |proptest_helper!(@_WRAPPAT ($($var2),*))| $body) + move |$crate::proptest_helper!(@_WRAPPAT ($($var2),*))| $body) } }; ($(#[$meta:meta])* - $([$($vis:tt)*])* fn $name:ident $params:tt + $vis:vis + $([$($modi:tt)*])? fn $name:ident $params:tt ($($arg:tt)+) -> $return_type:ty $body:block) => { #[must_use = "strategies do nothing unless used"] $(#[$meta])* - $($($vis)*)* fn $name $params + $vis + $($($modi)*)? fn $name $params -> impl $crate::strategy::Strategy { - let strat = proptest_helper!(@_EXT _STRAT ($($arg)+)); + let strat = $crate::proptest_helper!(@_EXT _STRAT ($($arg)+)); $crate::strategy::Strategy::prop_map(strat, - |proptest_helper!(@_EXT _PAT ($($arg)+))| $body) + move |$crate::proptest_helper!(@_EXT _PAT ($($arg)+))| $body) } }; ($(#[$meta:meta])* - $([$($vis:tt)*])* fn $name:ident $params:tt - ($($arg:tt)+ $(,)*) - ($($arg2:tt)+ $(,)*) + $vis:vis + $([$($modi:tt)*])? fn $name:ident $params:tt + ($($arg:tt)+ $(,)?) + ($($arg2:tt)+ $(,)?) -> $return_type:ty $body:block) => { #[must_use = "strategies do nothing unless used"] $(#[$meta])* - $($($vis)*)* fn $name $params + $vis + $($($modi)*)? fn $name $params -> impl $crate::strategy::Strategy { - let strat = proptest_helper!(@_WRAP ($($strategy)*)); + let strat = $crate::proptest_helper!(@_WRAP ($($strategy)*)); let strat = $crate::strategy::Strategy::prop_flat_map( strat, - |proptest_helper!(@_EXT _PAT ($($arg)+))| - proptest_helper!(@_EXT _STRAT ($($arg2)*))); + move |$crate::proptest_helper!(@_EXT _PAT ($($arg)+))| + $crate::proptest_helper!(@_EXT _STRAT ($($arg2)*))); $crate::strategy::Strategy::prop_map(strat, - |proptest_helper!(@_EXT _PAT ($($arg2)*))| $body) + move |$crate::proptest_helper!(@_EXT _PAT ($($arg2)*))| $body) } }; } @@ -672,7 +700,6 @@ /// ## Example /// /// ``` -/// #[macro_use] extern crate proptest; /// use proptest::prelude::*; /// /// proptest! { @@ -703,7 +730,7 @@ #[macro_export] macro_rules! prop_assert { ($cond:expr) => { - prop_assert!($cond, concat!("assertion failed: ", stringify!($cond))) + $crate::prop_assert!($cond, concat!("assertion failed: ", stringify!($cond))) }; ($cond:expr, $($fmt:tt)*) => { @@ -724,7 +751,7 @@ /// ## Example /// /// ``` -/// #[macro_use] extern crate proptest; +/// use proptest::prelude::*; /// /// proptest! { /// # /* @@ -748,17 +775,67 @@ ($left:expr, $right:expr) => {{ let left = $left; let right = $right; - prop_assert!(left == right, "assertion failed: `(left == right)` \ - (left: `{:?}`, right: `{:?}`)", + $crate::prop_assert!( + left == right, + "assertion failed: `(left == right)` \ + \n left: `{:?}`,\n right: `{:?}`", + left, right); + }}; + + ($left:expr, $right:expr, $fmt:tt $($args:tt)*) => {{ + let left = $left; + let right = $right; + $crate::prop_assert!( + left == right, + concat!( + "assertion failed: `(left == right)` \ + \n left: `{:?}`, \n right: `{:?}`: ", $fmt), + left, right $($args)*); + }}; +} + +/// Similar to `assert_ne!` from std, but returns a test failure instead of +/// panicking if the condition fails. +/// +/// See `prop_assert!` for a more in-depth discussion. +/// +/// ## Example +/// +/// ``` +/// use proptest::prelude::*; +/// +/// proptest! { +/// # /* +/// #[test] +/// # */ +/// fn test_addition(a in 0i32..100i32, b in 1i32..100i32) { +/// // Use with default message +/// prop_assert_ne!(a, a + b); +/// // Can also provide custom message added after the common message +/// prop_assert_ne!(a, a + b, "a = {}, b = {}", a, b); +/// } +/// } +/// # +/// # fn main() { test_addition(); } +/// ``` +#[macro_export] +macro_rules! prop_assert_ne { + ($left:expr, $right:expr) => {{ + let left = $left; + let right = $right; + prop_assert!( + left != right, + "assertion failed: `(left != right)`\ + \n left: `{:?}`,\n right: `{:?}`", left, right); }}; ($left:expr, $right:expr, $fmt:tt $($args:tt)*) => {{ let left = $left; let right = $right; - prop_assert!(left == right, concat!( - "assertion failed: `(left == right)` \ - (left: `{:?}`, right: `{:?}`): ", $fmt), + prop_assert!(left != right, concat!( + "assertion failed: `(left != right)`\ + \n left: `{:?}`,\n right: `{:?}`: ", $fmt), left, right $($args)*); }}; } @@ -792,7 +869,7 @@ ($a0, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9) }; (@_WRAP ($a:tt $($rest:tt)*)) => { - ($a, proptest_helper!(@_WRAP ($($rest)*))) + ($a, $crate::proptest_helper!(@_WRAP ($($rest)*))) }; (@_WRAPPAT ($item:pat)) => { $item }; (@_WRAPPAT ($a0:pat, $a1:pat)) => { ($a0, $a1) }; @@ -823,7 +900,7 @@ ($a0, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9) }; (@_WRAPPAT ($a:pat, $($rest:pat),*)) => { - ($a, proptest_helper!(@_WRAPPAT ($($rest),*))) + ($a, $crate::proptest_helper!(@_WRAPPAT ($($rest),*))) }; (@_WRAPSTR ($item:pat)) => { stringify!($item) }; (@_WRAPSTR ($a0:pat, $a1:pat)) => { (stringify!($a0), stringify!($a1)) }; @@ -864,19 +941,19 @@ stringify!($a8), stringify!($a9)) }; (@_WRAPSTR ($a:pat, $($rest:pat),*)) => { - (stringify!($a), proptest_helper!(@_WRAPSTR ($($rest),*))) + (stringify!($a), $crate::proptest_helper!(@_WRAPSTR ($($rest),*))) }; // build a property testing block that when executed, executes the full property test. (@_BODY $config:ident ($($parm:pat in $strategy:expr),+) [$($mod:tt)*] $body:expr) => {{ $config.source_file = Some(file!()); let mut runner = $crate::test_runner::TestRunner::new($config); - let names = proptest_helper!(@_WRAPSTR ($($parm),*)); + let names = $crate::proptest_helper!(@_WRAPSTR ($($parm),*)); match runner.run( &$crate::strategy::Strategy::prop_map( - proptest_helper!(@_WRAP ($($strategy)*)), + $crate::proptest_helper!(@_WRAP ($($strategy)*)), |values| $crate::sugar::NamedArguments(names, values)), $($mod)* |$crate::sugar::NamedArguments( - _, proptest_helper!(@_WRAPPAT ($($parm),*)))| + _, $crate::proptest_helper!(@_WRAPPAT ($($parm),*)))| { $body; Ok(()) @@ -890,13 +967,13 @@ (@_BODY2 $config:ident ($($arg:tt)+) [$($mod:tt)*] $body:expr) => {{ $config.source_file = Some(file!()); let mut runner = $crate::test_runner::TestRunner::new($config); - let names = proptest_helper!(@_EXT _STR ($($arg)*)); + let names = $crate::proptest_helper!(@_EXT _STR ($($arg)*)); match runner.run( &$crate::strategy::Strategy::prop_map( - proptest_helper!(@_EXT _STRAT ($($arg)*)), + $crate::proptest_helper!(@_EXT _STRAT ($($arg)*)), |values| $crate::sugar::NamedArguments(names, values)), $($mod)* |$crate::sugar::NamedArguments( - _, proptest_helper!(@_EXT _PAT ($($arg)*)))| + _, $crate::proptest_helper!(@_EXT _PAT ($($arg)*)))| { $body; Ok(()) @@ -921,65 +998,64 @@ // We have to do this because `:` can't FOLLOW(pat). // Note that this is not the full `pat` grammar... // See https://docs.rs/syn/0.14.2/syn/enum.Pat.html for that. - (@_EXT $cmd:ident ($p:pat in $s:expr $(,)*)) => { - proptest_helper!(@$cmd in [$s] [$p]) + (@_EXT $cmd:ident ($p:pat in $s:expr $(,)?)) => { + $crate::proptest_helper!(@$cmd in [$s] [$p]) }; - (@_EXT $cmd:ident (($p:pat) : $s:ty $(,)*)) => { + (@_EXT $cmd:ident (($p:pat) : $s:ty $(,)?)) => { // Users can wrap in parens as a last resort. - proptest_helper!(@$cmd [$s] [$p]) + $crate::proptest_helper!(@$cmd [$s] [$p]) }; - (@_EXT $cmd:ident (_ : $s:ty $(,)*)) => { - proptest_helper!(@$cmd [$s] [_]) + (@_EXT $cmd:ident (_ : $s:ty $(,)?)) => { + $crate::proptest_helper!(@$cmd [$s] [_]) }; - (@_EXT $cmd:ident (ref mut $p:ident : $s:ty $(,)*)) => { - proptest_helper!(@$cmd [$s] [ref mut $p]) + (@_EXT $cmd:ident (ref mut $p:ident : $s:ty $(,)?)) => { + $crate::proptest_helper!(@$cmd [$s] [ref mut $p]) }; - (@_EXT $cmd:ident (ref $p:ident : $s:ty $(,)*)) => { - proptest_helper!(@$cmd [$s] [ref $p]) + (@_EXT $cmd:ident (ref $p:ident : $s:ty $(,)?)) => { + $crate::proptest_helper!(@$cmd [$s] [ref $p]) }; - (@_EXT $cmd:ident (mut $p:ident : $s:ty $(,)*)) => { - proptest_helper!(@$cmd [$s] [mut $p]) + (@_EXT $cmd:ident (mut $p:ident : $s:ty $(,)?)) => { + $crate::proptest_helper!(@$cmd [$s] [mut $p]) }; - (@_EXT $cmd:ident ($p:ident : $s:ty $(,)*)) => { - proptest_helper!(@$cmd [$s] [$p]) + (@_EXT $cmd:ident ($p:ident : $s:ty $(,)?)) => { + $crate::proptest_helper!(@$cmd [$s] [$p]) }; - (@_EXT $cmd:ident ([$($p:tt)*] : $s:ty $(,)*)) => { - proptest_helper!(@$cmd [$s] [[$($p)*]]) + (@_EXT $cmd:ident ([$($p:tt)*] : $s:ty $(,)?)) => { + $crate::proptest_helper!(@$cmd [$s] [[$($p)*]]) }; // Rewrite, Inductive case: (@_EXT $cmd:ident ($p:pat in $s:expr, $($r:tt)*)) => { - (proptest_helper!(@$cmd in [$s] [$p]), proptest_helper!(@_EXT $cmd ($($r)*))) + ($crate::proptest_helper!(@$cmd in [$s] [$p]), $crate::proptest_helper!(@_EXT $cmd ($($r)*))) }; (@_EXT $cmd:ident (($p:pat) : $s:ty, $($r:tt)*)) => { - (proptest_helper!(@$cmd [$s] [$p]), proptest_helper!(@_EXT $cmd ($($r)*))) + ($crate::proptest_helper!(@$cmd [$s] [$p]), $crate::proptest_helper!(@_EXT $cmd ($($r)*))) }; (@_EXT $cmd:ident (_ : $s:ty, $($r:tt)*)) => { - (proptest_helper!(@$cmd [$s] [_]), proptest_helper!(@_EXT $cmd ($($r)*))) + ($crate::proptest_helper!(@$cmd [$s] [_]), $crate::proptest_helper!(@_EXT $cmd ($($r)*))) }; (@_EXT $cmd:ident (ref mut $p:ident : $s:ty, $($r:tt)*)) => { - (proptest_helper!(@$cmd [$s] [ref mut $p]), proptest_helper!(@_EXT $cmd ($($r)*))) + ($crate::proptest_helper!(@$cmd [$s] [ref mut $p]), $crate::proptest_helper!(@_EXT $cmd ($($r)*))) }; (@_EXT $cmd:ident (ref $p:ident : $s:ty, $($r:tt)*)) => { - (proptest_helper!(@$cmd [$s] [ref $p]), proptest_helper!(@_EXT $cmd ($($r)*))) + ($crate::proptest_helper!(@$cmd [$s] [ref $p]), $crate::proptest_helper!(@_EXT $cmd ($($r)*))) }; (@_EXT $cmd:ident (mut $p:ident : $s:ty, $($r:tt)*)) => { - (proptest_helper!(@$cmd [$s] [mut $p]), proptest_helper!(@_EXT $cmd ($($r)*))) + ($crate::proptest_helper!(@$cmd [$s] [mut $p]), $crate::proptest_helper!(@_EXT $cmd ($($r)*))) }; (@_EXT $cmd:ident ($p:ident : $s:ty, $($r:tt)*)) => { - (proptest_helper!(@$cmd [$s] [$p]), proptest_helper!(@_EXT $cmd ($($r)*))) + ($crate::proptest_helper!(@$cmd [$s] [$p]), $crate::proptest_helper!(@_EXT $cmd ($($r)*))) }; (@_EXT $cmd:ident ([$($p:tt)*] : $s:ty, $($r:tt)*)) => { - (proptest_helper!(@$cmd [$s] [[$($p)*]]), proptest_helper!(@_EXT $cmd ($($r)*))) + ($crate::proptest_helper!(@$cmd [$s] [[$($p)*]]), $crate::proptest_helper!(@_EXT $cmd ($($r)*))) }; } #[doc(hidden)] #[derive(Clone, Copy)] -pub struct NamedArguments( - #[doc(hidden)] pub N, #[doc(hidden)] pub V); +pub struct NamedArguments(#[doc(hidden)] pub N, #[doc(hidden)] pub V); -impl fmt::Debug for NamedArguments<&'static str, V> { +impl fmt::Debug for NamedArguments<&'static str, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{} = ", self.0)?; self.1.fmt(f) @@ -1045,61 +1121,21 @@ named_arguments_tuple!(0 AN AV 1 BN BV 2 CN CV 3 DN DV 4 EN EV 5 FN FV 6 GN GV 7 HN HV 8 IN IV 9 JN JV); -/// Similar to `assert_ne!` from std, but returns a test failure instead of -/// panicking if the condition fails. -/// -/// See `prop_assert!` for a more in-depth discussion. -/// -/// ## Example -/// -/// ``` -/// #[macro_use] extern crate proptest; -/// -/// proptest! { -/// # /* -/// #[test] -/// # */ -/// fn test_addition(a in 0i32..100i32, b in 1i32..100i32) { -/// // Use with default message -/// prop_assert_ne!(a, a + b); -/// // Can also provide custom message added after the common message -/// prop_assert_ne!(a, a + b, "a = {}, b = {}", a, b); -/// } -/// } -/// # -/// # fn main() { test_addition(); } -/// ``` -#[macro_export] -macro_rules! prop_assert_ne { - ($left:expr, $right:expr) => {{ - let left = $left; - let right = $right; - prop_assert!(left != right, "assertion failed: `(left != right)` \ - (left: `{:?}`, right: `{:?}`)", - left, right); - }}; - - ($left:expr, $right:expr, $fmt:tt $($args:tt)*) => {{ - let left = $left; - let right = $right; - prop_assert!(left != right, concat!( - "assertion failed: `(left != right)` \ - (left: `{:?}`, right: `{:?}`): ", $fmt), - left, right $($args)*); - }}; -} - #[cfg(feature = "std")] #[doc(hidden)] -pub fn force_no_fork(config: &mut ::test_runner::Config) { +pub fn force_no_fork(config: &mut crate::test_runner::Config) { if config.fork() { - eprintln!("proptest: Forking/timeout not supported in closure-style \ - invocations; ignoring"); + eprintln!( + "proptest: Forking/timeout not supported in closure-style \ + invocations; ignoring" + ); - #[cfg(feature = "fork")] { + #[cfg(feature = "fork")] + { config.fork = false; } - #[cfg(feature = "timeout")] { + #[cfg(feature = "timeout")] + { config.timeout = 0; } assert!(!config.fork()); @@ -1107,11 +1143,11 @@ } #[cfg(not(feature = "std"))] -pub fn force_no_fork(_: &mut ::test_runner::Config) { } +pub fn force_no_fork(_: &mut crate::test_runner::Config) {} #[cfg(test)] mod test { - use ::strategy::Just; + use crate::strategy::Just; prop_compose! { /// These are docs! @@ -1125,13 +1161,36 @@ prop_compose! { /// These are docs! #[allow(dead_code)] - [pub] fn two_ints_pub(relative: i32)(a in 0..relative, b in relative..) - -> (i32, i32) { + pub fn two_ints_pub(relative: i32)(a in 0..relative, b in relative..) + -> (i32, i32) { (a, b) } } prop_compose! { + /// These are docs! + #[allow(dead_code)] + pub [extern "C"] fn two_ints_pub_with_attrs + (relative: i32)(a in 0..relative, b in relative..) + -> (i32, i32) + { + (a, b) + } + } + + prop_compose! { + // The only modifier we can usefully put here is "unsafe", but we want + // to keep this crate unsafe-free, even nominally. "const" may + // eventually work, but is not allowed right now since the generated + // code contains local variables. `extern "C"` is accepted, even though + // the result is useless since the return type isn't C-compatible. + #[allow(dead_code)] + [extern "C"] fn with_modifier(relative: i32)(a in 0..relative) -> i32 { + a + } + } + + prop_compose! { #[allow(dead_code)] fn a_less_than_b()(b in 0..1000)(a in 0..b, b in Just(b)) -> (i32, i32) { @@ -1147,9 +1206,28 @@ } } + prop_compose! { + #[allow(dead_code)] + fn single_closure_is_move(base: u64)(off in 0..10u64) -> u64 { + base + off + } + } + + prop_compose! { + #[allow(dead_code)] + fn double_closure_is_move + (base: u64) + (off1 in 0..10u64) + (off2 in off1..off1+10) + -> u64 + { + base + off2 + } + } + #[allow(unused_variables)] mod test_arg_counts { - use strategy::Just; + use crate::strategy::Just; proptest! { #[test] @@ -1203,32 +1281,59 @@ println!("{:?}", NamedArguments("foo", &"bar")); println!("{:?}", NamedArguments(("foo",), &(1,))); - println!("{:?}", NamedArguments(("foo","bar"), &(1,2))); - println!("{:?}", NamedArguments(("a","b","c"), &(1,2,3))); - println!("{:?}", NamedArguments(("a","b","c","d"), &(1,2,3,4))); - println!("{:?}", NamedArguments(("a","b","c","d","e"), - &(1,2,3,4,5))); - println!("{:?}", NamedArguments(("a","b","c","d","e","f"), - &(1,2,3,4,5,6))); - println!("{:?}", NamedArguments(("a","b","c","d","e","f","g"), - &(1,2,3,4,5,6,7))); - println!("{:?}", NamedArguments(("a","b","c","d","e","f","g","h"), - &(1,2,3,4,5,6,7,8))); - println!("{:?}", NamedArguments(("a","b","c","d","e","f","g","h","i"), - &(1,2,3,4,5,6,7,8,9))); - println!("{:?}", NamedArguments(("a","b","c","d","e","f","g","h","i","j"), - &(1,2,3,4,5,6,7,8,9,10))); - println!("{:?}", NamedArguments((("a","b"),"c","d"), &((1,2),3,4))); + println!("{:?}", NamedArguments(("foo", "bar"), &(1, 2))); + println!("{:?}", NamedArguments(("a", "b", "c"), &(1, 2, 3))); + println!("{:?}", NamedArguments(("a", "b", "c", "d"), &(1, 2, 3, 4))); + println!( + "{:?}", + NamedArguments(("a", "b", "c", "d", "e"), &(1, 2, 3, 4, 5)) + ); + println!( + "{:?}", + NamedArguments(("a", "b", "c", "d", "e", "f"), &(1, 2, 3, 4, 5, 6)) + ); + println!( + "{:?}", + NamedArguments( + ("a", "b", "c", "d", "e", "f", "g"), + &(1, 2, 3, 4, 5, 6, 7) + ) + ); + println!( + "{:?}", + NamedArguments( + ("a", "b", "c", "d", "e", "f", "g", "h"), + &(1, 2, 3, 4, 5, 6, 7, 8) + ) + ); + println!( + "{:?}", + NamedArguments( + ("a", "b", "c", "d", "e", "f", "g", "h", "i"), + &(1, 2, 3, 4, 5, 6, 7, 8, 9) + ) + ); + println!( + "{:?}", + NamedArguments( + ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j"), + &(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) + ) + ); + println!( + "{:?}", + NamedArguments((("a", "b"), "c", "d"), &((1, 2), 3, 4)) + ); } #[test] fn oneof_all_counts() { - use ::strategy::{Strategy, TupleUnion, Union, Just as J}; + use crate::strategy::{Just as J, LazyTupleUnion, Strategy, Union}; fn expect_count(n: usize, s: impl Strategy) { + use crate::strategy::*; + use crate::test_runner::*; use std::collections::HashSet; - use strategy::*; - use test_runner::*; let mut runner = TestRunner::default(); let mut seen = HashSet::new(); @@ -1239,104 +1344,120 @@ assert_eq!(n, seen.len()); } - fn assert_static(v: TupleUnion) -> TupleUnion { v } - fn assert_dynamic(v: Union) -> Union { v } + fn assert_static(v: LazyTupleUnion) -> LazyTupleUnion { + v + } + fn assert_dynamic(v: Union) -> Union { + v + } expect_count(1, prop_oneof![J(0i32)]); - expect_count(2, assert_static(prop_oneof![ - J(0i32), - J(1i32), - ])); - expect_count(3, assert_static(prop_oneof![ - J(0i32), - J(1i32), - J(2i32), - ])); - expect_count(4, assert_static(prop_oneof![ - J(0i32), - J(1i32), - J(2i32), - J(3i32), - ])); - expect_count(5, assert_static(prop_oneof![ - J(0i32), - J(1i32), - J(2i32), - J(3i32), - J(4i32), - ])); - expect_count(6, assert_static(prop_oneof![ - J(0i32), - J(1i32), - J(2i32), - J(3i32), - J(4i32), - J(5i32), - ])); - expect_count(7, assert_static(prop_oneof![ - J(0i32), - J(1i32), - J(2i32), - J(3i32), - J(4i32), - J(5i32), - J(6i32), - ])); - expect_count(8, assert_static(prop_oneof![ - J(0i32), - J(1i32), - J(2i32), - J(3i32), - J(4i32), - J(5i32), - J(6i32), - J(7i32), - ])); - expect_count(9, assert_static(prop_oneof![ - J(0i32), - J(1i32), - J(2i32), - J(3i32), - J(4i32), - J(5i32), - J(6i32), - J(7i32), - J(8i32), - ])); - expect_count(10, assert_static(prop_oneof![ - J(0i32), - J(1i32), - J(2i32), - J(3i32), - J(4i32), - J(5i32), - J(6i32), - J(7i32), - J(8i32), - J(9i32), - ])); - expect_count(11, assert_dynamic(prop_oneof![ - J(0i32), - J(1i32), - J(2i32), - J(3i32), - J(4i32), - J(5i32), - J(6i32), - J(7i32), - J(8i32), - J(9i32), - J(10i32), - ])); + expect_count(2, assert_static(prop_oneof![J(0i32), J(1i32),])); + expect_count(3, assert_static(prop_oneof![J(0i32), J(1i32), J(2i32),])); + expect_count( + 4, + assert_static(prop_oneof![J(0i32), J(1i32), J(2i32), J(3i32),]), + ); + expect_count( + 5, + assert_static(prop_oneof![ + J(0i32), + J(1i32), + J(2i32), + J(3i32), + J(4i32), + ]), + ); + expect_count( + 6, + assert_static(prop_oneof![ + J(0i32), + J(1i32), + J(2i32), + J(3i32), + J(4i32), + J(5i32), + ]), + ); + expect_count( + 7, + assert_static(prop_oneof![ + J(0i32), + J(1i32), + J(2i32), + J(3i32), + J(4i32), + J(5i32), + J(6i32), + ]), + ); + expect_count( + 8, + assert_static(prop_oneof![ + J(0i32), + J(1i32), + J(2i32), + J(3i32), + J(4i32), + J(5i32), + J(6i32), + J(7i32), + ]), + ); + expect_count( + 9, + assert_static(prop_oneof![ + J(0i32), + J(1i32), + J(2i32), + J(3i32), + J(4i32), + J(5i32), + J(6i32), + J(7i32), + J(8i32), + ]), + ); + expect_count( + 10, + assert_static(prop_oneof![ + J(0i32), + J(1i32), + J(2i32), + J(3i32), + J(4i32), + J(5i32), + J(6i32), + J(7i32), + J(8i32), + J(9i32), + ]), + ); + expect_count( + 11, + assert_dynamic(prop_oneof![ + J(0i32), + J(1i32), + J(2i32), + J(3i32), + J(4i32), + J(5i32), + J(6i32), + J(7i32), + J(8i32), + J(9i32), + J(10i32), + ]), + ); } } #[cfg(all(test, feature = "timeout"))] mod test_timeout { proptest! { - #![proptest_config(::test_runner::Config { + #![proptest_config(crate::test_runner::Config { fork: true, - .. ::test_runner::Config::default() + .. crate::test_runner::Config::default() })] // Ensure that the macro sets the test name properly. If it doesn't, @@ -1348,12 +1469,13 @@ #[cfg(test)] mod another_test { - use sugar; + use crate::sugar; // Ensure that we can access the `[pub]` composed function above. #[allow(dead_code)] fn can_access_pub_compose() { let _ = sugar::test::two_ints_pub(42); + let _ = sugar::test::two_ints_pub_with_attrs(42); } } @@ -1363,14 +1485,14 @@ proptest! { #[test] fn accept_ref_arg(ref s in "[0-9]") { - use std_facade::String; + use crate::std_facade::String; fn assert_string(_s: &String) {} assert_string(s); } #[test] fn accept_move_arg(s in "[0-9]") { - use std_facade::String; + use crate::std_facade::String; fn assert_string(_s: String) {} assert_string(s); } @@ -1407,6 +1529,15 @@ println!("{}", y); assert!(x != y); }); + + proptest!(|(y: i32,)| { + assert!(x != y); + }); + + proptest!(|(y in 0..100,)| { + println!("{}", y); + assert!(x != y); + }); } #[test] @@ -1438,17 +1569,25 @@ #[test] fn accepts_unblocked_syntax() { proptest!(|(x in 0u32..10, y in 10u32..20)| assert!(x < y)); + proptest!(|(x in 0u32..10, y in 10u32..20,)| assert!(x < y)); } #[test] fn accepts_custom_config() { - let conf = ::test_runner::Config::default(); + let conf = crate::test_runner::Config::default(); proptest!(conf, |(x in 0u32..10, y in 10u32..20)| assert!(x < y)); proptest!(&conf, |(x in 0u32..10, y in 10u32..20)| assert!(x < y)); proptest!(conf, move |(x in 0u32..10, y in 10u32..20)| assert!(x < y)); proptest!(conf, |(_x: u32, _y: u32)| { }); proptest!(conf, move |(_x: u32, _y: u32)| { }); + + // Same as above, but with extra trailing comma + proptest!(conf, |(x in 0u32..10, y in 10u32..20,)| assert!(x < y)); + proptest!(&conf, |(x in 0u32..10, y in 10u32..20,)| assert!(x < y)); + proptest!(conf, move |(x in 0u32..10, y in 10u32..20,)| assert!(x < y)); + proptest!(conf, |(_x: u32, _y: u32,)| { }); + proptest!(conf, move |(_x: u32, _y: u32,)| { }); } } diff -Nru cargo-0.35.0/vendor/proptest/src/test_runner/config.rs cargo-0.37.0/vendor/proptest/src/test_runner/config.rs --- cargo-0.35.0/vendor/proptest/src/test_runner/config.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/test_runner/config.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,5 +1,5 @@ //- -// Copyright 2017, 2018 The proptest developers +// Copyright 2017, 2018, 2019 The proptest developers // // Licensed under the Apache License, Version 2.0 or the MIT license @@ -7,22 +7,23 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std_facade::Box; +use crate::std_facade::Box; use core::u32; #[cfg(feature = "std")] use std::env; #[cfg(feature = "std")] -use std::fmt; -#[cfg(feature = "std")] use std::ffi::OsString; #[cfg(feature = "std")] +use std::fmt; +#[cfg(feature = "std")] use std::str::FromStr; -use test_runner::FailurePersistence; +use crate::test_runner::result_cache::{noop_result_cache, ResultCache}; +use crate::test_runner::rng::RngAlgorithm; +use crate::test_runner::FailurePersistence; #[cfg(feature = "std")] -use test_runner::FileFailurePersistence; -use test_runner::result_cache::{noop_result_cache, ResultCache}; +use crate::test_runner::FileFailurePersistence; #[cfg(feature = "std")] const CASES: &str = "PROPTEST_CASES"; @@ -42,11 +43,15 @@ const TIMEOUT: &str = "PROPTEST_TIMEOUT"; #[cfg(feature = "std")] const VERBOSE: &str = "PROPTEST_VERBOSE"; +const RNG_ALGORITHM: &str = "PROPTEST_RNG_ALGORITHM"; #[cfg(feature = "std")] fn contextualize_config(mut result: Config) -> Config { - fn parse_or_warn( - src: &OsString, dst: &mut T, typ: &str, var: &str + fn parse_or_warn( + src: &OsString, + dst: &mut T, + typ: &str, + var: &str, ) { if let Some(src) = src.to_str() { if let Ok(value) = src.parse() { @@ -54,44 +59,77 @@ } else { eprintln!( "proptest: The env-var {}={} can't be parsed as {}, \ - using default of {}.", var, src, typ, *dst); + using default of {}.", + var, src, typ, *dst + ); } } else { eprintln!( "proptest: The env-var {} is not valid, using \ - default of {}.", var, *dst); + default of {}.", + var, *dst + ); } } - result.failure_persistence = Some(Box::new(FileFailurePersistence::default())); - for (var, value) in env::vars_os().filter_map( - |(k,v)| k.into_string().ok().map(|k| (k,v))) { + result.failure_persistence = + Some(Box::new(FileFailurePersistence::default())); + for (var, value) in + env::vars_os().filter_map(|(k, v)| k.into_string().ok().map(|k| (k, v))) + { match var.as_str() { CASES => parse_or_warn(&value, &mut result.cases, "u32", CASES), MAX_LOCAL_REJECTS => parse_or_warn( - &value, &mut result.max_local_rejects, - "u32", MAX_LOCAL_REJECTS), + &value, + &mut result.max_local_rejects, + "u32", + MAX_LOCAL_REJECTS, + ), MAX_GLOBAL_REJECTS => parse_or_warn( - &value, &mut result.max_global_rejects, - "u32", MAX_GLOBAL_REJECTS), + &value, + &mut result.max_global_rejects, + "u32", + MAX_GLOBAL_REJECTS, + ), MAX_FLAT_MAP_REGENS => parse_or_warn( - &value, &mut result.max_flat_map_regens, - "u32", MAX_FLAT_MAP_REGENS), + &value, + &mut result.max_flat_map_regens, + "u32", + MAX_FLAT_MAP_REGENS, + ), #[cfg(feature = "fork")] FORK => parse_or_warn(&value, &mut result.fork, "bool", FORK), #[cfg(feature = "timeout")] - TIMEOUT => parse_or_warn( - &value, &mut result.timeout, "timeout", TIMEOUT), + TIMEOUT => { + parse_or_warn(&value, &mut result.timeout, "timeout", TIMEOUT) + } MAX_SHRINK_TIME => parse_or_warn( - &value, &mut result.max_shrink_time, "u32", MAX_SHRINK_TIME), + &value, + &mut result.max_shrink_time, + "u32", + MAX_SHRINK_TIME, + ), MAX_SHRINK_ITERS => parse_or_warn( - &value, &mut result.max_shrink_iters, "u32", MAX_SHRINK_ITERS), - VERBOSE => parse_or_warn( - &value, &mut result.verbose, "u32", VERBOSE), - - _ => if var.starts_with("PROPTEST_") { - eprintln!("proptest: Ignoring unknown env-var {}.", var); - }, + &value, + &mut result.max_shrink_iters, + "u32", + MAX_SHRINK_ITERS, + ), + VERBOSE => { + parse_or_warn(&value, &mut result.verbose, "u32", VERBOSE) + } + RNG_ALGORITHM => parse_or_warn( + &value, + &mut result.rng_algorithm, + "RngAlgorithm", + RNG_ALGORITHM, + ), + + _ => { + if var.starts_with("PROPTEST_") { + eprintln!("proptest: Ignoring unknown env-var {}.", var); + } + } } } @@ -99,35 +137,40 @@ } #[cfg(not(feature = "std"))] -fn contextualize_config(result: Config) -> Config { result } +fn contextualize_config(result: Config) -> Config { + result +} -/// The default config, computed by combining environment variables and -/// defaults. -lazy_static! { - static ref DEFAULT_CONFIG: Config = { - let result = Config { - cases: 256, - max_local_rejects: 65_536, - max_global_rejects: 1024, - max_flat_map_regens: 1_000_000, - failure_persistence: None, - source_file: None, - test_name: None, - #[cfg(feature = "fork")] - fork: false, - #[cfg(feature = "timeout")] - timeout: 0, - #[cfg(feature = "std")] - max_shrink_time: 0, - max_shrink_iters: u32::MAX, - result_cache: noop_result_cache, - #[cfg(feature = "std")] - verbose: 0, - _non_exhaustive: (), - }; +fn default_default_config() -> Config { + Config { + cases: 256, + max_local_rejects: 65_536, + max_global_rejects: 1024, + max_flat_map_regens: 1_000_000, + failure_persistence: None, + source_file: None, + test_name: None, + #[cfg(feature = "fork")] + fork: false, + #[cfg(feature = "timeout")] + timeout: 0, + #[cfg(feature = "std")] + max_shrink_time: 0, + max_shrink_iters: u32::MAX, + result_cache: noop_result_cache, + #[cfg(feature = "std")] + verbose: 0, + rng_algorithm: RngAlgorithm::default(), + _non_exhaustive: (), + } +} - contextualize_config(result) - }; +// The default config, computed by combining environment variables and +// defaults. +#[cfg(feature = "std")] +lazy_static! { + static ref DEFAULT_CONFIG: Config = + { contextualize_config(default_default_config()) }; } /// Configuration for how a proptest test should be run. @@ -248,8 +291,14 @@ /// Give up on shrinking if more than this number of iterations of the test /// code are run. /// + /// Setting this to `std::u32::MAX` causes the actual limit to be four + /// times the number of test cases. + /// /// Setting this value to `0` disables shrinking altogether. /// + /// Note that the type of this field will change in a future version of + /// proptest to better accommodate its special values. + /// /// The default is `std::u32::MAX`, which can be overridden by setting the /// `PROPTEST_MAX_SHRINK_ITERS` environment variable. pub max_shrink_iters: u32, @@ -270,7 +319,7 @@ /// /// Caching incurs its own overhead, and may very well make your test run /// more slowly. - pub result_cache: fn () -> Box, + pub result_cache: fn() -> Box, /// Set to non-zero values to cause proptest to emit human-targeted /// messages to stderr as it runs. @@ -290,6 +339,15 @@ #[cfg(feature = "std")] pub verbose: u32, + /// The RNG algorithm to use when not using a user-provided RNG. + /// + /// The default is `RngAlgorithm::default()`, which can be overridden by + /// setting the `PROPTEST_RNG_ALGORITHM` environment variable to one of the following: + /// + /// - `xs` — `RngAlgorithm::XorShift` + /// - `cc` — `RngAlgorithm::ChaCha` + pub rng_algorithm: RngAlgorithm, + // Needs to be public so FRU syntax can be used. #[doc(hidden)] pub _non_exhaustive: (), @@ -310,7 +368,10 @@ /// ); /// ``` pub fn with_cases(cases: u32) -> Self { - Self { cases, .. Config::default() } + Self { + cases, + ..Config::default() + } } /// Constructs a `Config` only differing from the `default()` in the @@ -327,7 +388,10 @@ /// ); /// ``` pub fn with_source_file(source_file: &'static str) -> Self { - Self { source_file: Some(source_file), .. Config::default() } + Self { + source_file: Some(source_file), + ..Config::default() + } } /// Constructs a `Config` only differing from the provided Config instance, `self`, @@ -391,6 +455,17 @@ 0 } + /// Returns the configured limit on shrinking iterations. + /// + /// This takes into account the special "automatic" behaviour. + pub fn max_shrink_iters(&self) -> u32 { + if u32::MAX == self.max_shrink_iters { + self.cases.saturating_mul(4) + } else { + self.max_shrink_iters + } + } + // Used by macros to force the config to be owned without depending on // certain traits being `use`d. #[allow(missing_docs)] @@ -400,8 +475,16 @@ } } +#[cfg(feature = "std")] impl Default for Config { fn default() -> Self { DEFAULT_CONFIG.clone() } } + +#[cfg(not(feature = "std"))] +impl Default for Config { + fn default() -> Self { + default_default_config() + } +} diff -Nru cargo-0.35.0/vendor/proptest/src/test_runner/errors.rs cargo-0.37.0/vendor/proptest/src/test_runner/errors.rs --- cargo-0.35.0/vendor/proptest/src/test_runner/errors.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/test_runner/errors.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,12 +7,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std_facade::fmt; +use crate::std_facade::fmt; #[cfg(feature = "std")] use std::string::ToString; -use test_runner::Reason; +use crate::test_runner::Reason; /// Errors which can be returned from test cases to indicate non-successful /// completion. @@ -59,16 +59,16 @@ impl fmt::Display for TestCaseError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { - TestCaseError::Reject(ref whence) => - write!(f, "Input rejected at {}", whence), - TestCaseError::Fail(ref why) => - write!(f, "Case failed: {}", why), + TestCaseError::Reject(ref whence) => { + write!(f, "Input rejected at {}", whence) + } + TestCaseError::Fail(ref why) => write!(f, "Case failed: {}", why), } } } #[cfg(feature = "std")] -impl From for TestCaseError { +impl From for TestCaseError { fn from(cause: E) -> Self { TestCaseError::fail(cause.to_string()) } @@ -86,20 +86,21 @@ Fail(Reason, T), } -impl fmt::Display for TestError { +impl fmt::Display for TestError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { - TestError::Abort(ref why) => - write!(f, "Test aborted: {}", why), - TestError::Fail(ref why, ref what) => - write!(f, "Test failed: {}; minimal failing input: {:?}", - why, what), + TestError::Abort(ref why) => write!(f, "Test aborted: {}", why), + TestError::Fail(ref why, ref what) => write!( + f, + "Test failed: {}; minimal failing input: {:?}", + why, what + ), } } } #[cfg(feature = "std")] -impl ::std::error::Error for TestError { +impl ::std::error::Error for TestError { fn description(&self) -> &str { match *self { TestError::Abort(..) => "Abort", diff -Nru cargo-0.35.0/vendor/proptest/src/test_runner/failure_persistence/file.rs cargo-0.37.0/vendor/proptest/src/test_runner/failure_persistence/file.rs --- cargo-0.35.0/vendor/proptest/src/test_runner/failure_persistence/file.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/test_runner/failure_persistence/file.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,5 +1,5 @@ //- -// Copyright 2017, 2018 The proptest developers +// Copyright 2017, 2018, 2019 The proptest developers // // Licensed under the Apache License, Version 2.0 or the MIT license @@ -9,19 +9,20 @@ use core::any::Any; use core::fmt::Debug; -use core::num::ParseIntError; use std::borrow::{Cow, ToOwned}; use std::boxed::Box; use std::env; use std::fs; use std::io::{self, BufRead, Write}; use std::path::{Path, PathBuf}; +use std::string::{String, ToString}; use std::sync::RwLock; use std::vec::Vec; -use std::string::{String, ToString}; -use test_runner::{Seed, failure_persistence::FailurePersistence}; use self::FileFailurePersistence::*; +use crate::test_runner::failure_persistence::{ + FailurePersistence, PersistedSeed, +}; /// Describes how failing test cases are persisted. /// @@ -81,25 +82,31 @@ } impl FailurePersistence for FileFailurePersistence { - fn load_persisted_failures(&self, source_file: Option<&'static str>) - -> Vec { + fn load_persisted_failures2( + &self, + source_file: Option<&'static str>, + ) -> Vec { let p = self.resolve( - source_file.and_then(|s| absolutize_source_file(Path::new(s))) + source_file + .and_then(|s| absolutize_source_file(Path::new(s))) .as_ref() - .map(|cow| &**cow)); + .map(|cow| &**cow), + ); let path: Option<&PathBuf> = p.as_ref(); - let result: io::Result> = path.map_or_else( + let result: io::Result> = path.map_or_else( || Ok(vec![]), |path| { // .ok() instead of .unwrap() so we don't propagate panics here let _lock = PERSISTENCE_LOCK.read().ok(); io::BufReader::new(fs::File::open(path)?) - .lines().enumerate() + .lines() + .enumerate() .filter_map(|(lineno, line)| match line { Err(err) => Some(Err(err)), - Ok(line) => parse_seed_line(line, path, lineno).map(Ok) - }).collect() + Ok(line) => parse_seed_line(line, path, lineno).map(Ok), + }) + .collect() }, ); @@ -117,10 +124,10 @@ }) } - fn save_persisted_failure( + fn save_persisted_failure2( &mut self, source_file: Option<&'static str>, - seed: Seed, + seed: PersistedSeed, shrunken_value: &dyn Debug, ) { let path = self.resolve(source_file.map(Path::new)); @@ -135,11 +142,15 @@ .expect("proptest: couldn't write header."); } - write_seed_line(&mut to_write, seed, shrunken_value) + write_seed_line(&mut to_write, &seed, shrunken_value) .expect("proptest: couldn't write seed line."); if let Err(e) = write_seed_data_to_file(&path, &to_write) { - eprintln!("proptest: failed to append to {}: {}", path.display(), e); + eprintln!( + "proptest: failed to append to {}: {}", + path.display(), + e + ); } else if is_new { eprintln!( "proptest: Saving this and future failures in {}\n\ @@ -148,7 +159,7 @@ {}", path.display(), if is_new { " (You may need to create it.)" } else { "" }, - format_basic_seed_line(seed)); + seed); } } } @@ -158,10 +169,15 @@ } fn eq(&self, other: &dyn FailurePersistence) -> bool { - other.as_any().downcast_ref::().map_or(false, |x| x == self) + other + .as_any() + .downcast_ref::() + .map_or(false, |x| x == self) } - fn as_any(&self) -> &dyn Any { self } + fn as_any(&self) -> &dyn Any { + self + } } /// Ensure that the source file to use for resolving the location of the persisted @@ -184,7 +200,7 @@ } fn absolutize_source_file_with_cwd<'a>( - getcwd: impl FnOnce () -> io::Result, + getcwd: impl FnOnce() -> io::Result, source: &'a Path, ) -> Option> { if source.is_absolute() { @@ -234,82 +250,42 @@ } } -fn parse_seed_line(mut line: String, path: &Path, lineno: usize) - -> Option { +fn parse_seed_line( + mut line: String, + path: &Path, + lineno: usize, +) -> Option { // Remove anything after and including '#': if let Some(comment_start) = line.find('#') { line.truncate(comment_start); } if line.len() > 0 { - // Split by whitespace and ignore empty lines: - let parts = line.trim().split(char::is_whitespace).collect::>(); - let len = parts.len(); - // "xs" stands for "XorShift". - if parts[0] == "xs" && len == 5 { - // Parse using the chosen one: - if let Ok(seed) = parse_seed_old(&parts[1..]) { - return Some(seed); - } else { - eprintln!("proptest: {}:{}: unparsable line, ignoring", - path.display(), lineno + 1); - } - } else { - eprintln!("proptest: {}:{}: unknown case type `{}` \ - (corrupt file or newer proptest version?)", - &path.display(), lineno + 1, parts[0]); + let ret = line.parse::().ok(); + if !ret.is_some() { + eprintln!( + "proptest: {}:{}: unparsable line, ignoring", + path.display(), + lineno + 1 + ); } + return ret; } None } -fn parse_seed_old(parts: &[&str]) -> Result { - let mut ret = [0u32; 4]; - for (src, dst) in parts.iter().zip(ret.iter_mut()) { - *dst = src.parse()?; - } - - Ok(convert_to_new_format(ret)) -} - -fn convert_to_new_format(old_format: [u32; 4]) -> Seed { - use byteorder::{ByteOrder, LittleEndian}; - let mut new_format = [0; 16]; - // rand uses little endian for this conversion on all platforms - LittleEndian::write_u32_into(&old_format[..], &mut new_format); - new_format -} - -fn convert_from_new_format(new_format: Seed) -> [u32; 4] { - use byteorder::{ByteOrder, LittleEndian}; - let mut old_format = [0; 4]; - LittleEndian::read_u32_into(&new_format[..], &mut old_format); - old_format -} - -fn format_basic_seed_line(seed: Seed) -> String { - // Write line start: - let mut buf = "xs ".to_owned(); - - // Write out each part of seed: - for &s in &convert_from_new_format(seed) { - buf.push_str(&s.to_string()); - buf.push(' '); - } - - buf -} - -fn write_seed_line(buf: &mut Vec, seed: Seed, shrunken_value: &dyn Debug) - -> io::Result<()> -{ +fn write_seed_line( + buf: &mut Vec, + seed: &PersistedSeed, + shrunken_value: &dyn Debug, +) -> io::Result<()> { // Write the seed itself - write!(buf, "{}", format_basic_seed_line(seed)); + write!(buf, "{}", seed.to_string())?; // Write out comment: let debug_start = buf.len(); - write!(buf, "# shrinks to {:?}", shrunken_value)?; + write!(buf, " # shrinks to {:?}", shrunken_value)?; // Ensure there are no newlines in the debug output for byte in &mut buf[debug_start..] { @@ -324,8 +300,9 @@ } fn write_header(buf: &mut Vec) -> io::Result<()> { - writeln!(buf, -"\ + writeln!( + buf, + "\ # Seeds for failure cases proptest has generated in the past. It is # automatically read and these particular cases re-run before any # novel cases are generated. @@ -362,8 +339,8 @@ let mut dir = Cow::into_owned(source_path.clone()); let mut found = false; while dir.pop() { - if dir.join("lib.rs").is_file() || - dir.join("main.rs").is_file() + if dir.join("lib.rs").is_file() + || dir.join("main.rs").is_file() { found = true; break; @@ -419,7 +396,9 @@ Direct(path) => Some(Path::new(path).to_owned()), - _NonExhaustive => panic!("FailurePersistence set to _NonExhaustive"), + _NonExhaustive => { + panic!("FailurePersistence set to _NonExhaustive") + } } } } @@ -525,7 +504,8 @@ fn relative_source_files_absolutified() { const TEST_RUNNER_PATH: &[&str] = &["src", "test_runner", "mod.rs"]; lazy_static! { - static ref TEST_RUNNER_RELATIVE: PathBuf = TEST_RUNNER_PATH.iter().collect(); + static ref TEST_RUNNER_RELATIVE: PathBuf = + TEST_RUNNER_PATH.iter().collect(); } const CARGO_DIR: &str = env!("CARGO_MANIFEST_DIR"); @@ -539,7 +519,8 @@ absolutize_source_file_with_cwd( || Ok(Path::new(CARGO_DIR).to_owned()), &TEST_RUNNER_RELATIVE - ).unwrap() + ) + .unwrap() ); // Running from test subdirectory @@ -548,7 +529,8 @@ absolutize_source_file_with_cwd( || Ok(Path::new(CARGO_DIR).join("target")), &TEST_RUNNER_RELATIVE - ).unwrap() + ) + .unwrap() ); } } diff -Nru cargo-0.35.0/vendor/proptest/src/test_runner/failure_persistence/map.rs cargo-0.37.0/vendor/proptest/src/test_runner/failure_persistence/map.rs --- cargo-0.35.0/vendor/proptest/src/test_runner/failure_persistence/map.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/test_runner/failure_persistence/map.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,11 +7,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use crate::std_facade::{fmt, BTreeMap, BTreeSet, Box, Vec}; use core::any::Any; -use std_facade::{fmt, Box, Vec, BTreeMap, BTreeSet}; -use test_runner::failure_persistence::FailurePersistence; -use test_runner::Seed; +use crate::test_runner::failure_persistence::FailurePersistence; +use crate::test_runner::failure_persistence::PersistedSeed; /// Failure persistence option that loads and saves seeds in memory /// on the heap. This may be useful when accumulating test failures @@ -20,27 +20,29 @@ #[derive(Clone, Debug, Default, PartialEq)] pub struct MapFailurePersistence { /// Backing map, keyed by source_file. - pub map: BTreeMap<&'static str, BTreeSet> + pub map: BTreeMap<&'static str, BTreeSet>, } impl FailurePersistence for MapFailurePersistence { - fn load_persisted_failures(&self, source_file: Option<&'static str>) - -> Vec { + fn load_persisted_failures2( + &self, + source_file: Option<&'static str>, + ) -> Vec { source_file .and_then(|source| self.map.get(source)) .map(|seeds| seeds.iter().cloned().collect::>()) .unwrap_or_default() } - fn save_persisted_failure( + fn save_persisted_failure2( &mut self, source_file: Option<&'static str>, - seed: Seed, + seed: PersistedSeed, _shrunken_value: &dyn fmt::Debug, ) { let s = match source_file { Some(sf) => sf, - None => return + None => return, }; let set = self.map.entry(s).or_insert_with(BTreeSet::new); set.insert(seed); @@ -51,41 +53,47 @@ } fn eq(&self, other: &dyn FailurePersistence) -> bool { - other.as_any().downcast_ref::().map_or(false, |x| x == self) + other + .as_any() + .downcast_ref::() + .map_or(false, |x| x == self) } - fn as_any(&self) -> &dyn Any { self } + fn as_any(&self) -> &dyn Any { + self + } } #[cfg(test)] mod tests { use super::*; - use test_runner::failure_persistence::tests::*; + use crate::test_runner::failure_persistence::tests::*; #[test] fn initial_map_is_empty() { assert!(MapFailurePersistence::default() - .load_persisted_failures(HI_PATH).is_empty()) + .load_persisted_failures2(HI_PATH) + .is_empty()) } #[test] fn seeds_recoverable() { let mut p = MapFailurePersistence::default(); - p.save_persisted_failure(HI_PATH, INC_SEED, &""); - let restored = p.load_persisted_failures(HI_PATH); + p.save_persisted_failure2(HI_PATH, INC_SEED, &""); + let restored = p.load_persisted_failures2(HI_PATH); assert_eq!(1, restored.len()); assert_eq!(INC_SEED, *restored.first().unwrap()); - assert!(p.load_persisted_failures(None).is_empty()); - assert!(p.load_persisted_failures(UNREL_PATH).is_empty()); + assert!(p.load_persisted_failures2(None).is_empty()); + assert!(p.load_persisted_failures2(UNREL_PATH).is_empty()); } #[test] fn seeds_deduplicated() { let mut p = MapFailurePersistence::default(); - p.save_persisted_failure(HI_PATH, INC_SEED, &""); - p.save_persisted_failure(HI_PATH, INC_SEED, &""); - let restored = p.load_persisted_failures(HI_PATH); + p.save_persisted_failure2(HI_PATH, INC_SEED, &""); + p.save_persisted_failure2(HI_PATH, INC_SEED, &""); + let restored = p.load_persisted_failures2(HI_PATH); assert_eq!(1, restored.len()); } } diff -Nru cargo-0.35.0/vendor/proptest/src/test_runner/failure_persistence/mod.rs cargo-0.37.0/vendor/proptest/src/test_runner/failure_persistence/mod.rs --- cargo-0.35.0/vendor/proptest/src/test_runner/failure_persistence/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/test_runner/failure_persistence/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,5 +1,5 @@ //- -// Copyright 2017, 2018 The proptest developers +// Copyright 2017, 2018, 2019 The proptest developers // // Licensed under the Apache License, Version 2.0 or the MIT license @@ -7,8 +7,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use crate::std_facade::{fmt, Box, Vec}; use core::any::Any; -use std_facade::{fmt, Box, Vec}; +use core::fmt::Display; +use core::result::Result; +use core::str::FromStr; #[cfg(feature = "std")] mod file; @@ -20,23 +23,100 @@ pub use self::map::*; pub use self::noop::*; -use test_runner::Seed; +use crate::test_runner::Seed; + +/// Opaque struct representing a seed which can be persisted. +/// +/// The `Display` and `FromStr` implementations go to and from the format +/// Proptest uses for its persistence file. +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +pub struct PersistedSeed(pub(crate) Seed); + +impl Display for PersistedSeed { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.0.to_persistence()) + } +} + +impl FromStr for PersistedSeed { + type Err = (); + + fn from_str(s: &str) -> Result { + Seed::from_persistence(s).map(PersistedSeed).ok_or(()) + } +} /// Provides external persistence for historical test failures by storing seeds. -pub trait FailurePersistence: Send + Sync + fmt::Debug { +/// +/// **Note**: Implementing `load_persisted_failures` and +/// `save_persisted_failures` is **deprecated** and these methods will be +/// removed in proptest 0.10.0. Instead, implement `load_persisted_failures2` +/// and `save_persisted_failures2`. +pub trait FailurePersistence: Send + Sync + fmt::Debug { /// Supply seeds associated with the given `source_file` that may be used /// by a `TestRunner`'s random number generator in order to consistently /// recreate a previously-failing `Strategy`-provided value. - fn load_persisted_failures(&self, source_file: Option<&'static str>) - -> Vec; + /// + /// The default implementation is **for backwards compatibility**. It + /// delegates to `load_persisted_failures` and converts the results into + /// XorShift seeds. + #[allow(deprecated)] + fn load_persisted_failures2( + &self, + source_file: Option<&'static str>, + ) -> Vec { + self.load_persisted_failures(source_file) + .into_iter() + .map(|seed| PersistedSeed(Seed::XorShift(seed))) + .collect() + } + + /// Use `load_persisted_failures2` instead. + /// + /// This function inadvertently exposes the implementation of seeds prior + /// to Proptest 0.9.1 and only works with XorShift seeds. + #[deprecated] + #[allow(unused_variables)] + fn load_persisted_failures( + &self, + source_file: Option<&'static str>, + ) -> Vec<[u8; 16]> { + panic!("load_persisted_failures2 not implemented"); + } /// Store a new failure-generating seed associated with the given `source_file`. + /// + /// The default implementation is **for backwards compatibility**. It + /// delegates to `save_persisted_failure` if `seed` is a XorShift seed. + #[allow(deprecated)] + fn save_persisted_failure2( + &mut self, + source_file: Option<&'static str>, + seed: PersistedSeed, + shrunken_value: &dyn fmt::Debug, + ) { + match seed.0 { + Seed::XorShift(seed) => { + self.save_persisted_failure(source_file, seed, shrunken_value) + } + _ => (), + } + } + + /// Use `save_persisted_failures2` instead. + /// + /// This function inadvertently exposes the implementation of seeds prior + /// to Proptest 0.9.1 and only works with XorShift seeds. + #[deprecated] + #[allow(unused_variables)] fn save_persisted_failure( &mut self, source_file: Option<&'static str>, - seed: Seed, + seed: [u8; 16], shrunken_value: &dyn fmt::Debug, - ); + ) { + panic!("save_persisted_failure2 not implemented"); + } /// Delegate method for producing a trait object usable with `Clone` fn box_clone(&self) -> Box; @@ -49,7 +129,8 @@ } impl<'a, 'b> PartialEq -for dyn FailurePersistence + 'a { + for dyn FailurePersistence + 'a +{ fn eq(&self, other: &(dyn FailurePersistence + 'b)) -> bool { FailurePersistence::eq(self, other) } @@ -63,8 +144,12 @@ #[cfg(test)] mod tests { - pub const INC_SEED: [u8; 16] = - [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; + use super::PersistedSeed; + use crate::test_runner::rng::Seed; + + pub const INC_SEED: PersistedSeed = PersistedSeed(Seed::XorShift([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + ])); pub const HI_PATH: Option<&str> = Some("hi"); pub const UNREL_PATH: Option<&str> = Some("unrelated"); diff -Nru cargo-0.35.0/vendor/proptest/src/test_runner/failure_persistence/noop.rs cargo-0.37.0/vendor/proptest/src/test_runner/failure_persistence/noop.rs --- cargo-0.35.0/vendor/proptest/src/test_runner/failure_persistence/noop.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/test_runner/failure_persistence/noop.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,24 +7,29 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use crate::std_facade::{fmt, Box, Vec}; use core::any::Any; -use std_facade::{fmt, Box, Vec}; -use test_runner::failure_persistence::FailurePersistence; -use test_runner::Seed; +use crate::test_runner::failure_persistence::{ + FailurePersistence, PersistedSeed, +}; /// Failure persistence option that loads and saves nothing at all. #[derive(Debug, Default, PartialEq)] struct NoopFailurePersistence; impl FailurePersistence for NoopFailurePersistence { - fn load_persisted_failures(&self, _source_file: Option<&'static str>) -> Vec { + fn load_persisted_failures2( + &self, + _source_file: Option<&'static str>, + ) -> Vec { Vec::new() } - fn save_persisted_failure(&mut self, + fn save_persisted_failure2( + &mut self, _source_file: Option<&'static str>, - _seed: Seed, + _seed: PersistedSeed, _shrunken_value: &dyn fmt::Debug, ) { } @@ -34,31 +39,38 @@ } fn eq(&self, other: &dyn FailurePersistence) -> bool { - other.as_any().downcast_ref::().map_or(false, |x| x == self) + other + .as_any() + .downcast_ref::() + .map_or(false, |x| x == self) } - fn as_any(&self) -> &dyn Any { self } + fn as_any(&self) -> &dyn Any { + self + } } #[cfg(test)] mod tests { use super::*; - use test_runner::failure_persistence::tests::*; + use crate::test_runner::failure_persistence::tests::*; #[test] fn default_load_is_empty() { assert!(NoopFailurePersistence::default() - .load_persisted_failures(None).is_empty()); + .load_persisted_failures2(None) + .is_empty()); assert!(NoopFailurePersistence::default() - .load_persisted_failures(HI_PATH).is_empty()); + .load_persisted_failures2(HI_PATH) + .is_empty()); } #[test] fn seeds_not_recoverable() { let mut p = NoopFailurePersistence::default(); - p.save_persisted_failure(HI_PATH, INC_SEED, &""); - assert!(p.load_persisted_failures(HI_PATH).is_empty()); - assert!(p.load_persisted_failures(None).is_empty()); - assert!(p.load_persisted_failures(UNREL_PATH).is_empty()); + p.save_persisted_failure2(HI_PATH, INC_SEED, &""); + assert!(p.load_persisted_failures2(HI_PATH).is_empty()); + assert!(p.load_persisted_failures2(None).is_empty()); + assert!(p.load_persisted_failures2(UNREL_PATH).is_empty()); } } diff -Nru cargo-0.35.0/vendor/proptest/src/test_runner/mod.rs cargo-0.37.0/vendor/proptest/src/test_runner/mod.rs --- cargo-0.35.0/vendor/proptest/src/test_runner/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/test_runner/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -12,20 +12,20 @@ //! You do not normally need to access things in this module directly except //! when implementing new low-level strategies. -mod rng; -mod failure_persistence; -mod result_cache; mod config; -mod reason; mod errors; +mod failure_persistence; +mod reason; #[cfg(feature = "fork")] mod replay; +mod result_cache; +mod rng; mod runner; -pub use self::rng::*; -pub use self::failure_persistence::*; -pub use self::result_cache::*; pub use self::config::*; -pub use self::reason::*; pub use self::errors::*; +pub use self::failure_persistence::*; +pub use self::reason::*; +pub use self::result_cache::*; +pub use self::rng::*; pub use self::runner::*; diff -Nru cargo-0.35.0/vendor/proptest/src/test_runner/reason.rs cargo-0.37.0/vendor/proptest/src/test_runner/reason.rs --- cargo-0.35.0/vendor/proptest/src/test_runner/reason.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/test_runner/reason.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,7 +7,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std_facade::{fmt, Cow, String, Box}; +use crate::std_facade::{fmt, Box, Cow, String}; /// The reason for why something, such as a generated value, was rejected. /// diff -Nru cargo-0.35.0/vendor/proptest/src/test_runner/replay.rs cargo-0.37.0/vendor/proptest/src/test_runner/replay.rs --- cargo-0.35.0/vendor/proptest/src/test_runner/replay.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/test_runner/replay.rs 2019-07-17 05:42:23.000000000 +0000 @@ -15,7 +15,7 @@ use std::string::String; use std::vec::Vec; -use test_runner::{TestCaseError, TestCaseResult, Seed}; +use crate::test_runner::{Seed, TestCaseError, TestCaseResult}; const SENTINEL: &'static str = "proptest-forkfile"; @@ -40,12 +40,12 @@ /// to the file without having to worry about the possibility of appends being /// non-atomic. #[derive(Clone, Debug)] -pub struct Replay { +pub(crate) struct Replay { /// The seed of the RNG used to start running the test cases. - pub seed: Seed, + pub(crate) seed: Seed, /// A log of whether certain test cases passed or failed. The runner will /// assume the same results occur without actually running the test cases. - pub steps: Vec, + pub(crate) steps: Vec, } impl Replay { @@ -60,7 +60,7 @@ /// Result of loading a replay file. #[derive(Clone, Debug)] -pub enum ReplayFileStatus { +pub(crate) enum ReplayFileStatus { /// The file is valid and represents a currently-in-progress test. InProgress(Replay), /// The file is valid, but indicates that all testing has completed. @@ -70,7 +70,7 @@ } /// Open the file in the usual read+append+create mode. -pub fn open_file(path: impl AsRef) -> io::Result { +pub(crate) fn open_file(path: impl AsRef) -> io::Result { fs::OpenOptions::new() .read(true) .append(true) @@ -88,18 +88,20 @@ } /// Append the given step to the given output. -pub fn append(mut file: impl Write, step: &TestCaseResult) - -> io::Result<()> { +pub(crate) fn append( + mut file: impl Write, + step: &TestCaseResult, +) -> io::Result<()> { write!(file, "{}", step_to_char(step)) } /// Append a no-op step to the given output. -pub fn ping(mut file: impl Write) -> io::Result<()> { +pub(crate) fn ping(mut file: impl Write) -> io::Result<()> { write!(file, " ") } /// Append a termination mark to the given output. -pub fn terminate(mut file: impl Write) -> io::Result<()> { +pub(crate) fn terminate(mut file: impl Write) -> io::Result<()> { write!(file, ".") } @@ -107,10 +109,7 @@ /// Write the full state of this `Replay` to the given output. pub fn init_file(&self, mut file: impl Write) -> io::Result<()> { writeln!(file, "{}", SENTINEL)?; - - for word in &self.seed { - writeln!(file, "{}", word)?; - } + writeln!(file, "{}", self.seed.to_persistence())?; let mut step_data = Vec::::new(); for step in &self.steps { @@ -130,8 +129,9 @@ /// Parse a `Replay` out of the given file. /// /// The reader is implicitly seeked to the beginning before reading. - pub fn parse_from(mut file: impl Read + Seek) - -> io::Result { + pub fn parse_from( + mut file: impl Read + Seek, + ) -> io::Result { file.seek(io::SeekFrom::Start(0))?; let mut reader = io::BufReader::new(&mut file); @@ -154,16 +154,12 @@ return Ok(ReplayFileStatus::Corrupt); } - let mut seed: Seed = [0; 16]; - for word in &mut seed { - line.clear(); - reader.read_line(&mut line)?; - - match line.trim().parse::() { - Ok(w) => *word = w, - Err(_) => return Ok(ReplayFileStatus::Corrupt), - } - } + line.clear(); + reader.read_line(&mut line)?; + let seed = match Seed::from_persistence(&line) { + Some(seed) => seed, + None => return Ok(ReplayFileStatus::Corrupt), + }; line.clear(); reader.read_line(&mut line)?; @@ -172,12 +168,17 @@ for ch in line.chars() { match ch { '+' => steps.push(Ok(())), - '-' => steps.push(Err(TestCaseError::fail( - "failed in other process"))), + '-' => steps + .push(Err(TestCaseError::fail("failed in other process"))), '!' => steps.push(Err(TestCaseError::reject( - "rejected in other process"))), - '.' => return Ok(ReplayFileStatus::Terminated( - Replay { seed, steps })), + "rejected in other process", + ))), + '.' => { + return Ok(ReplayFileStatus::Terminated(Replay { + seed, + steps, + })) + } ' ' => (), _ => return Ok(ReplayFileStatus::Corrupt), } diff -Nru cargo-0.35.0/vendor/proptest/src/test_runner/result_cache.rs cargo-0.37.0/vendor/proptest/src/test_runner/result_cache.rs --- cargo-0.35.0/vendor/proptest/src/test_runner/result_cache.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/test_runner/result_cache.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,11 +7,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std_facade::Box; -use std_facade::fmt; -#[cfg(feature = "std")] use std::collections::HashMap; +use crate::std_facade::fmt; +use crate::std_facade::Box; +#[cfg(feature = "std")] +use std::collections::HashMap; -use test_runner::errors::TestCaseResult; +use crate::test_runner::errors::TestCaseResult; /// A key used for the result cache. /// @@ -63,8 +64,8 @@ impl ResultCache for BasicResultCache { fn key(&self, val: &ResultCacheKey) -> u64 { use std::collections::hash_map::DefaultHasher; - use std::io::{self, Write}; use std::hash::Hasher; + use std::io::{self, Write}; struct HashWriter(DefaultHasher); impl io::Write for HashWriter { @@ -102,9 +103,13 @@ pub(crate) struct NoOpResultCache; impl ResultCache for NoOpResultCache { - fn key(&self, _: &ResultCacheKey) -> u64 { 0 } - fn put(&mut self, _: u64, _: &TestCaseResult) { } - fn get(&self, _: u64) -> Option<&TestCaseResult> { None } + fn key(&self, _: &ResultCacheKey) -> u64 { + 0 + } + fn put(&mut self, _: u64, _: &TestCaseResult) {} + fn get(&self, _: u64) -> Option<&TestCaseResult> { + None + } } /// A result cache that does nothing. diff -Nru cargo-0.35.0/vendor/proptest/src/test_runner/rng.rs cargo-0.37.0/vendor/proptest/src/test_runner/rng.rs --- cargo-0.35.0/vendor/proptest/src/test_runner/rng.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/test_runner/rng.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,5 +1,5 @@ //- -// Copyright 2017, 2018 The proptest developers +// Copyright 2017, 2018, 2019 The proptest developers // // Licensed under the Apache License, Version 2.0 or the MIT license @@ -7,81 +7,558 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use rand::{Error, RngCore, Rng, SeedableRng}; -use rand::prng::XorShiftRng; +use crate::std_facade::{Arc, String, ToOwned, Vec}; +use core::result::Result; +use core::{fmt, str, u8}; + +use byteorder::{ByteOrder, LittleEndian}; +use rand::{self, Rng, RngCore, SeedableRng}; +use rand_chacha::ChaChaRng; +use rand_xorshift::XorShiftRng; -/// Proptest's random number generator. +/// Identifies a particular RNG algorithm supported by proptest. /// -/// Currently, this is just a wrapper around `XorShiftRng`. +/// Proptest supports dynamic configuration of algorithms to allow it to +/// continue operating with persisted regression files and to allow the +/// configuration to be expressed in the `Config` struct. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum RngAlgorithm { + /// The [XorShift](https://rust-random.github.io/rand/rand_xorshift/struct.XorShiftRng.html) + /// algorithm. This was the default up through and including Proptest 0.9.0. + /// + /// It is faster than ChaCha but produces lower quality randomness and has + /// some pathological cases where it may fail to produce outputs that are + /// random even to casual observation. + /// + /// The seed must be exactly 16 bytes. + XorShift, + /// The [ChaCha](https://rust-random.github.io/rand/rand_chacha/struct.ChaChaRng.html) + /// algorithm. This became the default with Proptest 0.9.1. + /// + /// The seed must be exactly 32 bytes. + ChaCha, + /// This is not an actual RNG algorithm, but instead returns data directly + /// from its "seed". + /// + /// This is useful when Proptest is being driven from some other entropy + /// source, such as a fuzzer. + /// + /// It is the user's responsibility to ensure that the seed is "big + /// enough". Proptest makes no guarantees about how much data is consumed + /// from the seed for any particular strategy. If the seed is exhausted, + /// the RNG panics. + /// + /// Note that in cases where a new RNG is to be derived from an existing + /// one, *the data is split evenly between them*, regardless of how much + /// entropy is actually needed. This means that combinators like + /// `prop_perturb` and `prop_flat_map` can require extremely large inputs. + PassThrough, + #[allow(missing_docs)] + #[doc(hidden)] + _NonExhaustive, +} + +impl Default for RngAlgorithm { + fn default() -> Self { + RngAlgorithm::ChaCha + } +} + +impl RngAlgorithm { + pub(crate) fn persistence_key(self) -> &'static str { + match self { + RngAlgorithm::XorShift => "xs", + RngAlgorithm::ChaCha => "cc", + RngAlgorithm::PassThrough => "pt", + RngAlgorithm::_NonExhaustive => unreachable!(), + } + } + + pub(crate) fn from_persistence_key(k: &str) -> Option { + match k { + "xs" => Some(RngAlgorithm::XorShift), + "cc" => Some(RngAlgorithm::ChaCha), + "pt" => Some(RngAlgorithm::PassThrough), + _ => None, + } + } +} + +// These two are only used for parsing the environment variable +// PROPTEST_RNG_ALGORITHM. +impl str::FromStr for RngAlgorithm { + type Err = (); + fn from_str(s: &str) -> Result { + RngAlgorithm::from_persistence_key(s).ok_or(()) + } +} +impl fmt::Display for RngAlgorithm { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.persistence_key()) + } +} + +/// Proptest's random number generator. #[derive(Clone, Debug)] -pub struct TestRng { rng: XorShiftRng } +pub struct TestRng { + rng: TestRngImpl, +} + +#[derive(Clone, Debug)] +enum TestRngImpl { + XorShift(XorShiftRng), + ChaCha(ChaChaRng), + PassThrough { + off: usize, + end: usize, + data: Arc<[u8]>, + }, +} impl RngCore for TestRng { - fn next_u32(&mut self) -> u32 { self.rng.next_u32() } - fn next_u64(&mut self) -> u64 { self.rng.next_u64() } - fn fill_bytes(&mut self, dest: &mut [u8]) { self.rng.fill_bytes(dest) } - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.rng.try_fill_bytes(dest) + fn next_u32(&mut self) -> u32 { + match &mut self.rng { + &mut TestRngImpl::XorShift(ref mut rng) => rng.next_u32(), + + &mut TestRngImpl::ChaCha(ref mut rng) => rng.next_u32(), + + &mut TestRngImpl::PassThrough { .. } => { + let mut buf = [0; 4]; + self.fill_bytes(&mut buf[..]); + LittleEndian::read_u32(&buf[..]) + } + } } + + fn next_u64(&mut self) -> u64 { + match &mut self.rng { + &mut TestRngImpl::XorShift(ref mut rng) => rng.next_u64(), + + &mut TestRngImpl::ChaCha(ref mut rng) => rng.next_u64(), + + &mut TestRngImpl::PassThrough { .. } => { + let mut buf = [0; 8]; + self.fill_bytes(&mut buf[..]); + LittleEndian::read_u64(&buf[..]) + } + } + } + + fn fill_bytes(&mut self, dest: &mut [u8]) { + match &mut self.rng { + &mut TestRngImpl::XorShift(ref mut rng) => rng.fill_bytes(dest), + + &mut TestRngImpl::ChaCha(ref mut rng) => rng.fill_bytes(dest), + + &mut TestRngImpl::PassThrough { + ref mut off, + end, + ref data, + } => { + assert!(*off + dest.len() <= end, "out of PassThrough data"); + dest.copy_from_slice(&data[*off..*off + dest.len()]); + *off += dest.len(); + } + } + } + + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand::Error> { + match self.rng { + TestRngImpl::XorShift(ref mut rng) => rng.try_fill_bytes(dest), + + TestRngImpl::ChaCha(ref mut rng) => rng.try_fill_bytes(dest), + + TestRngImpl::PassThrough { + ref mut off, + end, + ref data, + } => { + if *off + dest.len() > end { + return Err(rand::Error::new( + rand::ErrorKind::Unavailable, + "out of PassThrough data", + )); + } + + dest.copy_from_slice(&data[*off..*off + dest.len()]); + *off += dest.len(); + Ok(()) + } + } + } +} + +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +pub(crate) enum Seed { + XorShift([u8; 16]), + ChaCha([u8; 32]), + PassThrough(Option<(usize, usize)>, Arc<[u8]>), } -pub(crate) type Seed = [u8; 16]; +impl Seed { + pub(crate) fn from_bytes(algorithm: RngAlgorithm, seed: &[u8]) -> Self { + match algorithm { + RngAlgorithm::XorShift => { + assert_eq!(16, seed.len(), "XorShift requires a 16-byte seed"); + let mut buf = [0; 16]; + buf.copy_from_slice(seed); + Seed::XorShift(buf) + } + + RngAlgorithm::ChaCha => { + assert_eq!(32, seed.len(), "ChaCha requires a 32-byte seed"); + let mut buf = [0; 32]; + buf.copy_from_slice(seed); + Seed::ChaCha(buf) + } + + RngAlgorithm::PassThrough => Seed::PassThrough(None, seed.into()), + + RngAlgorithm::_NonExhaustive => unreachable!(), + } + } + + pub(crate) fn from_persistence(string: &str) -> Option { + fn from_base16(dst: &mut [u8], src: &str) -> Option<()> { + if dst.len() * 2 != src.len() { + return None; + } + + for (dst_byte, src_pair) in + dst.into_iter().zip(src.as_bytes().chunks(2)) + { + *dst_byte = + u8::from_str_radix(str::from_utf8(src_pair).ok()?, 16) + .ok()?; + } + + Some(()) + } + + let parts = + string.trim().split(char::is_whitespace).collect::>(); + RngAlgorithm::from_persistence_key(&parts[0]).and_then( + |alg| match alg { + RngAlgorithm::XorShift => { + if 5 != parts.len() { + return None; + } + + let mut dwords = [0u32; 4]; + for (dword, part) in + (&mut dwords[..]).into_iter().zip(&parts[1..]) + { + *dword = part.parse().ok()?; + } + + let mut seed = [0u8; 16]; + LittleEndian::write_u32_into(&dwords[..], &mut seed[..]); + Some(Seed::XorShift(seed)) + } + + RngAlgorithm::ChaCha => { + if 2 != parts.len() { + return None; + } + + let mut seed = [0u8; 32]; + from_base16(&mut seed, &parts[1])?; + Some(Seed::ChaCha(seed)) + } + + RngAlgorithm::PassThrough => { + if 1 == parts.len() { + return Some(Seed::PassThrough(None, vec![].into())); + } + + if 2 != parts.len() { + return None; + } + + let mut seed = vec![0u8; parts[1].len() / 2]; + from_base16(&mut seed, &parts[1])?; + Some(Seed::PassThrough(None, seed.into())) + } + + RngAlgorithm::_NonExhaustive => unreachable!(), + }, + ) + } + + pub(crate) fn to_persistence(&self) -> String { + fn to_base16(dst: &mut String, src: &[u8]) { + for byte in src { + dst.push_str(&format!("{:02x}", byte)); + } + } + + match *self { + Seed::XorShift(ref seed) => { + let mut dwords = [0u32; 4]; + LittleEndian::read_u32_into(seed, &mut dwords[..]); + format!( + "{} {} {} {} {}", + RngAlgorithm::XorShift.persistence_key(), + dwords[0], + dwords[1], + dwords[2], + dwords[3] + ) + } + + Seed::ChaCha(ref seed) => { + let mut string = + RngAlgorithm::ChaCha.persistence_key().to_owned(); + string.push(' '); + to_base16(&mut string, seed); + string + } + + Seed::PassThrough(bounds, ref data) => { + let data = + bounds.map_or(&data[..], |(start, end)| &data[start..end]); + let mut string = + RngAlgorithm::PassThrough.persistence_key().to_owned(); + string.push(' '); + to_base16(&mut string, data); + string + } + } + } +} impl TestRng { + /// Create a new RNG with the given algorithm and seed. + /// + /// Any RNG created with the same algorithm-seed pair will produce the same + /// sequence of values on all systems and all supporting versions of + /// proptest. + /// + /// ## Panics + /// + /// Panics if `seed` is not an appropriate length for `algorithm`. + pub fn from_seed(algorithm: RngAlgorithm, seed: &[u8]) -> Self { + TestRng::from_seed_internal(Seed::from_bytes(algorithm, seed)) + } + /// Construct a default TestRng from entropy. - pub(crate) fn default_rng() -> Self { + pub(crate) fn default_rng(algorithm: RngAlgorithm) -> Self { #[cfg(feature = "std")] { use rand::FromEntropy; - Self { rng: XorShiftRng::from_entropy() } + Self { + rng: match algorithm { + RngAlgorithm::XorShift => { + TestRngImpl::XorShift(XorShiftRng::from_entropy()) + } + RngAlgorithm::ChaCha => { + TestRngImpl::ChaCha(ChaChaRng::from_entropy()) + } + RngAlgorithm::PassThrough => { + panic!("cannot create default instance of PassThrough") + } + RngAlgorithm::_NonExhaustive => unreachable!(), + }, + } } #[cfg(not(feature = "std"))] - Self::from_seed([ - 0x19, 0x3a, 0x67, 0x54, // x - 0x69, 0xd4, 0xa7, 0xa8, // y - 0x05, 0x0e, 0x83, 0x97, // z - 0xbb, 0xa7, 0x3b, 0x11, // w - ]) + Self::deterministic_rng(algorithm) + } + + /// Returns a `TestRng` with a particular hard-coded seed. + /// + /// The seed value will always be the same for a particular version of + /// Proptest and algorithm, but may change across releases. + /// + /// This is useful for testing things like strategy implementations without + /// risking getting "unlucky" RNGs which deviate from average behaviour + /// enough to cause spurious failures. For example, a strategy for `bool` + /// which is supposed to produce `true` 50% of the time might have a test + /// which checks that the distribution is "close enough" to 50%. If every + /// test run starts with a different RNG, occasionally there will be + /// spurious test failures when the RNG happens to produce a very skewed + /// distribution. Using this or `TestRunner::deterministic()` avoids such + /// issues. + pub fn deterministic_rng(algorithm: RngAlgorithm) -> Self { + Self::from_seed_internal(match algorithm { + RngAlgorithm::XorShift => Seed::XorShift([ + 0xf4, 0x16, 0x16, 0x48, 0xc3, 0xac, 0x77, 0xac, 0x72, 0x20, + 0x0b, 0xea, 0x99, 0x67, 0x2d, 0x6d, + ]), + RngAlgorithm::ChaCha => Seed::ChaCha([ + 0xf4, 0x16, 0x16, 0x48, 0xc3, 0xac, 0x77, 0xac, 0x72, 0x20, + 0x0b, 0xea, 0x99, 0x67, 0x2d, 0x6d, 0xca, 0x9f, 0x76, 0xaf, + 0x1b, 0x09, 0x73, 0xa0, 0x59, 0x22, 0x6d, 0xc5, 0x46, 0x39, + 0x1c, 0x4a, + ]), + RngAlgorithm::PassThrough => { + panic!("deterministic RNG not available for PassThrough") + } + RngAlgorithm::_NonExhaustive => unreachable!(), + }) } /// Construct a TestRng by the perturbed randomized seed /// from an existing TestRng. pub(crate) fn gen_rng(&mut self) -> Self { - Self::from_seed(self.new_rng_seed()) + Self::from_seed_internal(self.new_rng_seed()) } /// Overwrite the given TestRng with the provided seed. pub(crate) fn set_seed(&mut self, seed: Seed) { - *self = Self::from_seed(seed); + *self = Self::from_seed_internal(seed); } /// Generate a new randomized seed, set it to this TestRng, /// and return the seed. pub(crate) fn gen_get_seed(&mut self) -> Seed { let seed = self.new_rng_seed(); - self.set_seed(seed); + self.set_seed(seed.clone()); seed } /// Randomize a perturbed randomized seed from the given TestRng. pub(crate) fn new_rng_seed(&mut self) -> Seed { - let mut seed = self.rng.gen::(); - - // Directly using XorShiftRng::from_seed() at this point would result - // in self.rng and the returned value being exactly the same. Perturb - // the seed with some arbitrary values to prevent this. - for word in seed.chunks_mut(4) { - word[3] ^= 0xde; - word[2] ^= 0xad; - word[1] ^= 0xbe; - word[0] ^= 0xef; + match self.rng { + TestRngImpl::XorShift(ref mut rng) => { + let mut seed = rng.gen::<[u8; 16]>(); + + // Directly using XorShiftRng::from_seed() at this point would + // result in rng and the returned value being exactly the same. + // Perturb the seed with some arbitrary values to prevent this. + for word in seed.chunks_mut(4) { + word[3] ^= 0xde; + word[2] ^= 0xad; + word[1] ^= 0xbe; + word[0] ^= 0xef; + } + + Seed::XorShift(seed) + } + + TestRngImpl::ChaCha(ref mut rng) => Seed::ChaCha(rng.gen()), + + TestRngImpl::PassThrough { + ref mut off, + ref mut end, + ref data, + } => { + let len = *end - *off; + let child_start = *off + len / 2; + let child_end = *off + len; + *end = child_start; + Seed::PassThrough( + Some((child_start, child_end)), + Arc::clone(data), + ) + } } - - seed } /// Construct a TestRng from a given seed. - fn from_seed(seed: Seed) -> Self { - Self { rng: XorShiftRng::from_seed(seed) } + fn from_seed_internal(seed: Seed) -> Self { + Self { + rng: match seed { + Seed::XorShift(seed) => { + TestRngImpl::XorShift(XorShiftRng::from_seed(seed)) + } + + Seed::ChaCha(seed) => { + TestRngImpl::ChaCha(ChaChaRng::from_seed(seed)) + } + + Seed::PassThrough(bounds, data) => { + let (start, end) = bounds.unwrap_or((0, data.len())); + TestRngImpl::PassThrough { + off: start, + end, + data, + } + } + }, + } + } +} + +#[cfg(test)] +mod test { + use crate::std_facade::Vec; + + use rand::{Rng, RngCore}; + + use super::{RngAlgorithm, Seed, TestRng}; + use crate::arbitrary::any; + use crate::strategy::*; + + proptest! { + #[test] + fn gen_parse_seeds( + seed in prop_oneof![ + any::<[u8;16]>().prop_map(Seed::XorShift), + any::<[u8;32]>().prop_map(Seed::ChaCha), + any::>().prop_map(|data| Seed::PassThrough(None, data.into())), + ]) + { + assert_eq!(seed, Seed::from_persistence(&seed.to_persistence()).unwrap()); + } + + #[test] + fn rngs_dont_clone_self_on_genrng( + seed in prop_oneof![ + any::<[u8;16]>().prop_map(Seed::XorShift), + any::<[u8;32]>().prop_map(Seed::ChaCha), + Just(()).prop_perturb(|_, mut rng| { + let mut buf = vec![0u8; 2048]; + rng.fill_bytes(&mut buf); + Seed::PassThrough(None, buf.into()) + }), + ]) + { + type Value = [u8;32]; + let orig = TestRng::from_seed_internal(seed); + + { + let mut rng1 = orig.clone(); + let mut rng2 = rng1.gen_rng(); + assert_ne!(rng1.gen::(), rng2.gen::()); + } + + { + let mut rng1 = orig.clone(); + let mut rng2 = rng1.gen_rng(); + let mut rng3 = rng1.gen_rng(); + let mut rng4 = rng2.gen_rng(); + let a = rng1.gen::(); + let b = rng2.gen::(); + let c = rng3.gen::(); + let d = rng4.gen::(); + assert_ne!(a, b); + assert_ne!(a, c); + assert_ne!(a, d); + assert_ne!(b, c); + assert_ne!(b, d); + assert_ne!(c, d); + } + } + } + + #[test] + fn passthrough_rng_behaves_properly() { + let mut rng = TestRng::from_seed( + RngAlgorithm::PassThrough, + &[ + 0xDE, 0xC0, 0x12, 0x34, 0x56, 0x78, 0xFE, 0xCA, 0xEF, 0xBE, + 0xAD, 0xDE, 0x01, 0x02, 0x03, + ], + ); + + assert_eq!(0x3412C0DE, rng.next_u32()); + assert_eq!(0xDEADBEEFCAFE7856, rng.next_u64()); + + let mut buf = [0u8; 4]; + assert!(rng.try_fill_bytes(&mut buf[0..4]).is_err()); + rng.fill_bytes(&mut buf[0..2]); + rng.fill_bytes(&mut buf[2..3]); + assert_eq!([1, 2, 3, 0], buf); } } diff -Nru cargo-0.35.0/vendor/proptest/src/test_runner/runner.rs cargo-0.37.0/vendor/proptest/src/test_runner/runner.rs --- cargo-0.35.0/vendor/proptest/src/test_runner/runner.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/test_runner/runner.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,5 +1,5 @@ //- -// Copyright 2017, 2018 The proptest developers +// Copyright 2017, 2018, 2019 The proptest developers // // Licensed under the Apache License, Version 2.0 or the MIT license @@ -7,32 +7,33 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use crate::std_facade::{Arc, BTreeMap, Box, String, Vec}; +use core::sync::atomic::AtomicUsize; +use core::sync::atomic::Ordering::SeqCst; use core::{fmt, iter}; #[cfg(feature = "std")] use std::panic::{self, AssertUnwindSafe}; -use core::sync::atomic::AtomicUsize; -use core::sync::atomic::Ordering::SeqCst; -use std_facade::{Box, Arc, Vec, BTreeMap, String}; #[cfg(feature = "fork")] -use std::fs; -#[cfg(feature = "fork")] -use std::env; +use rusty_fork; #[cfg(feature = "fork")] use std::cell::{Cell, RefCell}; #[cfg(feature = "fork")] -use rusty_fork; +use std::env; +#[cfg(feature = "fork")] +use std::fs; #[cfg(feature = "fork")] use tempfile; -use test_runner::{TestRng, Seed}; -use test_runner::errors::*; -use test_runner::config::*; -use test_runner::reason::*; -use test_runner::result_cache::*; +use crate::strategy::*; +use crate::test_runner::config::*; +use crate::test_runner::errors::*; +use crate::test_runner::failure_persistence::PersistedSeed; +use crate::test_runner::reason::*; #[cfg(feature = "fork")] -use test_runner::replay; -use strategy::*; +use crate::test_runner::replay; +use crate::test_runner::result_cache::*; +use crate::test_runner::rng::TestRng; #[cfg(feature = "fork")] const ENV_FORK_FILE: &'static str = "_PROPTEST_FORKFILE"; @@ -58,7 +59,7 @@ macro_rules! verbose_message { ($runner:expr, $level:expr, $fmt:tt $($arg:tt)*) => { let _ = $level; - } + }; } type RejectionDetail = BTreeMap; @@ -94,9 +95,12 @@ impl fmt::Display for TestRunner { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "\tsuccesses: {}\n\ - \tlocal rejects: {}\n", - self.successes, self.local_rejects)?; + write!( + f, + "\tsuccesses: {}\n\ + \tlocal rejects: {}\n", + self.successes, self.local_rejects + )?; for (whence, count) in &self.local_reject_detail { writeln!(f, "\t\t{} times at {}", count, whence)?; } @@ -133,15 +137,13 @@ fn ping(&mut self) { if let Some(ref mut file) = self.file { - replay::ping(file) - .expect("Failed to append to replay file"); + replay::ping(file).expect("Failed to append to replay file"); } } fn terminate(&mut self) { if let Some(ref mut file) = self.file { - replay::terminate(file) - .expect("Failed to append to replay file"); + replay::terminate(file).expect("Failed to append to replay file"); } } @@ -160,18 +162,26 @@ #[cfg(not(feature = "fork"))] impl ForkOutput { - fn append(&mut self, _result: &TestCaseResult) { } - fn ping(&mut self) { } - fn terminate(&mut self) { } - fn empty() -> Self { ForkOutput } - fn is_in_fork(&self) -> bool { false } + fn append(&mut self, _result: &TestCaseResult) {} + fn ping(&mut self) {} + fn terminate(&mut self) {} + fn empty() -> Self { + ForkOutput + } + fn is_in_fork(&self) -> bool { + false + } } #[cfg(not(feature = "std"))] -fn call_test - (_runner: &mut TestRunner, - case: V, test: &F, replay: &mut R, - result_cache: &mut dyn ResultCache, _: &mut ForkOutput) -> TestCaseResult +fn call_test( + _runner: &mut TestRunner, + case: V, + test: &F, + replay: &mut R, + result_cache: &mut dyn ResultCache, + _: &mut ForkOutput, +) -> TestCaseResult where V: fmt::Debug, F: Fn(V) -> TestCaseResult, @@ -192,11 +202,14 @@ } #[cfg(feature = "std")] -fn call_test - (runner: &mut TestRunner, - case: V, test: &F, replay: &mut R, - result_cache: &mut dyn ResultCache, fork_output: &mut ForkOutput) - -> TestCaseResult +fn call_test( + runner: &mut TestRunner, + case: V, + test: &F, + replay: &mut R, + result_cache: &mut dyn ResultCache, + fork_output: &mut ForkOutput, +) -> TestCaseResult where V: fmt::Debug, F: Fn(V) -> TestCaseResult, @@ -219,7 +232,11 @@ let cache_key = result_cache.key(&ResultCacheKey::new(&case)); if let Some(result) = result_cache.get(cache_key) { - verbose_message!(runner, TRACE, "Test input hit cache, skipping execution"); + verbose_message!( + runner, + TRACE, + "Test input hit cache, skipping execution" + ); return result.clone(); } @@ -238,13 +255,14 @@ // cases itself.) if timeout > 0 && result.is_ok() { let elapsed = time_start.elapsed(); - let elapsed_millis = elapsed.as_secs() as u32 * 1000 + - elapsed.subsec_nanos() / 1_000_000; + let elapsed_millis = elapsed.as_secs() as u32 * 1000 + + elapsed.subsec_nanos() / 1_000_000; if elapsed_millis > timeout { - result = Err(TestCaseError::fail( - format!("Timeout of {} ms exceeded: test took {} ms", - timeout, elapsed_millis))); + result = Err(TestCaseError::fail(format!( + "Timeout of {} ms exceeded: test took {} ms", + timeout, elapsed_millis + ))); } } @@ -254,9 +272,17 @@ match result { Ok(()) => verbose_message!(runner, TRACE, "Test case passed"), Err(TestCaseError::Reject(ref reason)) => verbose_message!( - runner, SHOW_FALURES, "Test case rejected: {}", reason), + runner, + SHOW_FALURES, + "Test case rejected: {}", + reason + ), Err(TestCaseError::Fail(ref reason)) => verbose_message!( - runner, SHOW_FALURES, "Test case failed: {}", reason), + runner, + SHOW_FALURES, + "Test case failed: {}", + reason + ), } result @@ -266,13 +292,47 @@ impl TestRunner { /// Create a fresh `TestRunner` with the given configuration. + /// + /// The runner will use an RNG with a generated seed and the default + /// algorithm. + /// + /// In `no_std` environments, every `TestRunner` will use the same + /// hard-coded seed. This seed is not contractually guaranteed and may be + /// changed between releases without notice. pub fn new(config: Config) -> Self { + let algorithm = config.rng_algorithm; + TestRunner::new_with_rng(config, TestRng::default_rng(algorithm)) + } + + /// Create a fresh `TestRunner` with the standard deterministic RNG. + /// + /// This is sugar for the following: + /// + /// ```rust + /// # use proptest::test_runner::*; + /// let config = Config::default(); + /// let algorithm = config.rng_algorithm; + /// TestRunner::new_with_rng( + /// config, + /// TestRng::deterministic_rng(algorithm)); + /// ``` + /// + /// Refer to `TestRng::deterministic_rng()` for more information on the + /// properties of the RNG used here. + pub fn deterministic() -> Self { + let config = Config::default(); + let algorithm = config.rng_algorithm; + TestRunner::new_with_rng(config, TestRng::deterministic_rng(algorithm)) + } + + /// Create a fresh `TestRunner` with the given configuration and RNG. + pub fn new_with_rng(config: Config, rng: TestRng) -> Self { TestRunner { config: config, successes: 0, local_rejects: 0, global_rejects: 0, - rng: TestRng::default_rng(), + rng: rng, flat_map_regens: Arc::new(AtomicUsize::new(0)), local_reject_detail: BTreeMap::new(), global_reject_detail: BTreeMap::new(), @@ -322,9 +382,11 @@ /// persisted before returning failure. /// /// Returns success or failure indicating why the test as a whole failed. - pub fn run(&mut self, strategy: &S, - test: impl Fn (S::Value) -> TestCaseResult) - -> TestRunResult { + pub fn run( + &mut self, + strategy: &S, + test: impl Fn(S::Value) -> TestCaseResult, + ) -> TestRunResult { if self.config.fork() { self.run_in_fork(strategy, test) } else { @@ -333,34 +395,42 @@ } #[cfg(not(feature = "fork"))] - fn run_in_fork - (&mut self, _: &S, _: impl Fn (S::Value) -> TestCaseResult) -> TestRunResult - { + fn run_in_fork( + &mut self, + _: &S, + _: impl Fn(S::Value) -> TestCaseResult, + ) -> TestRunResult { unreachable!() } #[cfg(feature = "fork")] - fn run_in_fork(&mut self, strategy: &S, - test: impl Fn (S::Value) -> TestCaseResult) - -> TestRunResult - { + fn run_in_fork( + &mut self, + strategy: &S, + test: impl Fn(S::Value) -> TestCaseResult, + ) -> TestRunResult { let mut test = Some(test); let test_name = rusty_fork::fork_test::fix_module_path( - self.config.test_name.expect( - "Must supply test_name when forking enabled")); + self.config + .test_name + .expect("Must supply test_name when forking enabled"), + ); let forkfile: RefCell> = RefCell::new(None); let init_forkfile_size = Cell::new(0u64); let seed = self.rng.new_rng_seed(); - let mut replay = replay::Replay { seed, steps: vec![] }; + let mut replay = replay::Replay { + seed, + steps: vec![], + }; let mut child_count = 0; let timeout = self.config.timeout(); - fn forkfile_size(forkfile: &Option) - -> u64 { - forkfile.as_ref().map_or( - 0, |ff| ff.as_file().metadata().map(|md| md.len()).unwrap_or(0)) + fn forkfile_size(forkfile: &Option) -> u64 { + forkfile.as_ref().map_or(0, |ff| { + ff.as_file().metadata().map(|md| md.len()).unwrap_or(0) + }) } loop { @@ -372,39 +442,49 @@ if forkfile.is_none() { *forkfile = Some(tempfile::NamedTempFile::new().expect( - "Failed to create temporary file for fork")); - replay.init_file( - forkfile.as_mut().unwrap()).expect( - "Failed to initialise temporary file for fork"); + "Failed to create temporary file for fork", + )); + replay.init_file(forkfile.as_mut().unwrap()).expect( + "Failed to initialise temporary file for fork", + ); } init_forkfile_size.set(forkfile_size(&forkfile)); cmd.env(ENV_FORK_FILE, forkfile.as_ref().unwrap().path()); }, - |child, _| await_child( - child, &mut forkfile.borrow_mut().as_mut().unwrap(), - timeout), + |child, _| { + await_child( + child, + &mut forkfile.borrow_mut().as_mut().unwrap(), + timeout, + ) + }, || match self.run_in_process(strategy, test.take().unwrap()) { Ok(_) => (), - Err(e) => - panic!("Test failed normally in child process.\n{}\n{}", - e, self), - }) - .expect("Fork failed"); + Err(e) => panic!( + "Test failed normally in child process.\n{}\n{}", + e, self + ), + }, + ) + .expect("Fork failed"); let parsed = replay::Replay::parse_from( - &mut forkfile.borrow_mut().as_mut().unwrap()) - .expect("Failed to re-read fork file"); + &mut forkfile.borrow_mut().as_mut().unwrap(), + ) + .expect("Failed to re-read fork file"); match parsed { - replay::ReplayFileStatus::InProgress(new_replay) => - replay = new_replay, + replay::ReplayFileStatus::InProgress(new_replay) => { + replay = new_replay + } replay::ReplayFileStatus::Terminated(new_replay) => { replay = new_replay; break; - }, - replay::ReplayFileStatus::Corrupt => - panic!("Child process corrupted replay file"), + } + replay::ReplayFileStatus::Corrupt => { + panic!("Child process corrupted replay file") + } } let curr_forkfile_size = forkfile_size(&forkfile.borrow()); @@ -415,7 +495,9 @@ if curr_forkfile_size == init_forkfile_size.get() { return Err(TestError::Abort( "Child process crashed or timed out before the first test \ - started running; giving up.".into())); + started running; giving up." + .into(), + )); } // The child only terminates early if it outright crashes or we @@ -428,9 +510,10 @@ if last_fork_file_len.map_or(true, |last_fork_file_len| { last_fork_file_len == curr_forkfile_size }) { - let error = Err(child_error.unwrap_or( - TestCaseError::fail("Child process was terminated abruptly \ - but with successful status"))); + let error = Err(child_error.unwrap_or(TestCaseError::fail( + "Child process was terminated abruptly \ + but with successful status", + ))); replay::append(forkfile.borrow_mut().as_mut().unwrap(), &error) .expect("Failed to append to replay file"); replay.steps.push(error); @@ -441,7 +524,8 @@ child_count += 1; if child_count >= 10000 { return Err(TestError::Abort( - "Giving up after 10000 child processes crashed".into())); + "Giving up after 10000 child processes crashed".into(), + )); } } @@ -450,40 +534,54 @@ // file. self.rng.set_seed(replay.seed); self.run_in_process_with_replay( - strategy, |_| panic!("Ran past the end of the replay"), - replay.steps.into_iter(), ForkOutput::empty()) + strategy, + |_| panic!("Ran past the end of the replay"), + replay.steps.into_iter(), + ForkOutput::empty(), + ) } - fn run_in_process - (&mut self, strategy: &S, test: impl Fn (S::Value) -> TestCaseResult) - -> TestRunResult - { + fn run_in_process( + &mut self, + strategy: &S, + test: impl Fn(S::Value) -> TestCaseResult, + ) -> TestRunResult { let (replay_steps, fork_output) = init_replay(&mut self.rng); self.run_in_process_with_replay( - strategy, test, replay_steps.into_iter(), fork_output) + strategy, + test, + replay_steps.into_iter(), + fork_output, + ) } - fn run_in_process_with_replay - (&mut self, strategy: &S, - test: impl Fn (S::Value) -> TestCaseResult, - mut replay: impl Iterator, - mut fork_output: ForkOutput) - -> TestRunResult - { + fn run_in_process_with_replay( + &mut self, + strategy: &S, + test: impl Fn(S::Value) -> TestCaseResult, + mut replay: impl Iterator, + mut fork_output: ForkOutput, + ) -> TestRunResult { let old_rng = self.rng.clone(); - let persisted_failure_seeds: Vec = - self.config.failure_persistence - .as_ref() - .map(|f| f.load_persisted_failures(self.config.source_file)) - .unwrap_or_default(); + let persisted_failure_seeds: Vec = self + .config + .failure_persistence + .as_ref() + .map(|f| f.load_persisted_failures2(self.config.source_file)) + .unwrap_or_default(); let mut result_cache = self.new_cache(); - for persisted_seed in persisted_failure_seeds { + for PersistedSeed(persisted_seed) in persisted_failure_seeds { self.rng.set_seed(persisted_seed); - self.gen_and_run_case(strategy, &test, &mut replay, - &mut *result_cache, &mut fork_output)?; + self.gen_and_run_case( + strategy, + &test, + &mut replay, + &mut *result_cache, + &mut fork_output, + )?; } self.rng = old_rng; @@ -492,17 +590,27 @@ // what seed to persist if this case fails. let seed = self.rng.gen_get_seed(); let result = self.gen_and_run_case( - strategy, &test, &mut replay, &mut *result_cache, &mut fork_output); + strategy, + &test, + &mut replay, + &mut *result_cache, + &mut fork_output, + ); if let Err(TestError::Fail(_, ref value)) = result { - if let Some(ref mut failure_persistence) = self.config.failure_persistence { + if let Some(ref mut failure_persistence) = + self.config.failure_persistence + { let source_file = &self.config.source_file; // Don't update the persistence file if we're a child // process. The parent relies on it remaining consistent // and will take care of updating it itself. if !fork_output.is_in_fork() { - failure_persistence.save_persisted_failure( - *source_file, seed, value); + failure_persistence.save_persisted_failure2( + *source_file, + PersistedSeed(seed), + value, + ); } } } @@ -517,19 +625,24 @@ Ok(()) } - fn gen_and_run_case - (&mut self, strategy: &S, - f: &impl Fn (S::Value) -> TestCaseResult, - replay: &mut impl Iterator, - result_cache: &mut dyn ResultCache, - fork_output: &mut ForkOutput) - -> TestRunResult - { - let case = - unwrap_or!(strategy.new_tree(self), msg => + fn gen_and_run_case( + &mut self, + strategy: &S, + f: &impl Fn(S::Value) -> TestCaseResult, + replay: &mut impl Iterator, + result_cache: &mut dyn ResultCache, + fork_output: &mut ForkOutput, + ) -> TestRunResult { + let case = unwrap_or!(strategy.new_tree(self), msg => return Err(TestError::Abort(msg))); - if self.run_one_with_replay(case, f, replay, result_cache, fork_output)? { + if self.run_one_with_replay( + case, + f, + replay, + result_cache, + fork_output, + )? { self.successes += 1; } Ok(()) @@ -544,54 +657,61 @@ /// terminate the run if it runs for longer than `timeout`. However, if the /// test function returns but took longer than `timeout`, the test case /// will fail. - pub fn run_one - (&mut self, case: V, - test: impl Fn (V::Value) -> TestCaseResult) - -> Result> - { + pub fn run_one( + &mut self, + case: V, + test: impl Fn(V::Value) -> TestCaseResult, + ) -> Result> { let mut result_cache = self.new_cache(); self.run_one_with_replay( - case, test, + case, + test, &mut iter::empty::().fuse(), &mut *result_cache, - &mut ForkOutput::empty()) + &mut ForkOutput::empty(), + ) } - fn run_one_with_replay - (&mut self, mut case: V, - test: impl Fn (V::Value) -> TestCaseResult, - replay: &mut impl Iterator, - result_cache: &mut dyn ResultCache, - fork_output: &mut ForkOutput) - -> Result> - { + fn run_one_with_replay( + &mut self, + mut case: V, + test: impl Fn(V::Value) -> TestCaseResult, + replay: &mut impl Iterator, + result_cache: &mut dyn ResultCache, + fork_output: &mut ForkOutput, + ) -> Result> { let result = call_test( - self, case.current(), &test, - replay, result_cache, fork_output); + self, + case.current(), + &test, + replay, + result_cache, + fork_output, + ); match result { Ok(_) => Ok(true), Err(TestCaseError::Fail(why)) => { - let why = self.shrink(&mut case, test, replay, - result_cache, fork_output) + let why = self + .shrink(&mut case, test, replay, result_cache, fork_output) .unwrap_or(why); Err(TestError::Fail(why, case.current())) - }, + } Err(TestCaseError::Reject(whence)) => { self.reject_global(whence)?; Ok(false) - }, + } } } - fn shrink - (&mut self, case: &mut V, - test: impl Fn (V::Value) -> TestCaseResult, - replay: &mut impl Iterator, - result_cache: &mut dyn ResultCache, - fork_output: &mut ForkOutput) - -> Option - { + fn shrink( + &mut self, + case: &mut V, + test: impl Fn(V::Value) -> TestCaseResult, + replay: &mut impl Iterator, + result_cache: &mut dyn ResultCache, + fork_output: &mut ForkOutput, + ) -> Option { #[cfg(feature = "std")] use std::time; @@ -605,7 +725,9 @@ #[cfg(feature = "std")] let timed_out = if self.config.max_shrink_time > 0 { let elapsed = start_time.elapsed(); - let elapsed_ms = elapsed.as_secs().saturating_mul(1000) + let elapsed_ms = elapsed + .as_secs() + .saturating_mul(1000) .saturating_add(elapsed.subsec_millis().into()); if elapsed_ms > self.config.max_shrink_time as u64 { Some(elapsed_ms) @@ -618,15 +740,45 @@ #[cfg(not(feature = "std"))] let timed_out: Option = None; - let bail = if iterations >= self.config.max_shrink_iters { + let bail = if iterations >= self.config.max_shrink_iters() { + #[cfg(feature = "std")] + const CONTROLLER: &str = + "the PROPTEST_MAX_SHRINK_ITERS environment \ + variable or ProptestConfig.max_shrink_iters"; + #[cfg(not(feature = "std"))] + const CONTROLLER: &str = "ProptestConfig.max_shrink_iters"; verbose_message!( - self, ALWAYS, - "Aborting shrinking after {} iterations", iterations); + self, + ALWAYS, + "Aborting shrinking after {} iterations (set {} \ + to a large(r) value to shrink more; current \ + configuration: {} iterations)", + CONTROLLER, + self.config.max_shrink_iters(), + iterations + ); true } else if let Some(ms) = timed_out { + #[cfg(feature = "std")] + const CONTROLLER: &str = + "the PROPTEST_MAX_SHRINK_TIME environment \ + variable or ProptestConfig.max_shrink_time"; + #[cfg(feature = "std")] + let current = self.config.max_shrink_time; + #[cfg(not(feature = "std"))] + const CONTROLLER: &str = "(not configurable in no_std)"; + #[cfg(not(feature = "std"))] + let current = 0; verbose_message!( - self, ALWAYS, - "Aborting shrinking after taking too long: {}", ms); + self, + ALWAYS, + "Aborting shrinking after taking too long: {} ms \ + (set {} to a large(r) value to shrink more; current \ + configuration: {} ms)", + ms, + CONTROLLER, + current + ); true } else { false @@ -644,9 +796,12 @@ let result = call_test( self, - case.current(), &test, + case.current(), + &test, replay, - result_cache, fork_output); + result_cache, + fork_output, + ); match result { // Rejections are effectively a pass here, @@ -656,13 +811,13 @@ if !case.complicate() { break; } - }, + } Err(TestCaseError::Fail(why)) => { last_failure = Some(why); if !case.simplify() { break; } - }, + } } } } @@ -672,21 +827,25 @@ /// Update the state to account for a local rejection from `whence`, and /// return `Ok` if the caller should keep going or `Err` to abort. - pub fn reject_local(&mut self, whence: impl Into) - -> Result<(), Reason> { + pub fn reject_local( + &mut self, + whence: impl Into, + ) -> Result<(), Reason> { if self.local_rejects >= self.config.max_local_rejects { Err("Too many local rejects".into()) } else { self.local_rejects += 1; - Self::insert_or_increment(&mut self.local_reject_detail, - whence.into()); + Self::insert_or_increment( + &mut self.local_reject_detail, + whence.into(), + ); Ok(()) } } /// Update the state to account for a global rejection from `whence`, and /// return `Ok` if the caller should keep going or `Err` to abort. - fn reject_global(&mut self, whence: Reason) -> Result<(),TestError> { + fn reject_global(&mut self, whence: Reason) -> Result<(), TestError> { if self.global_rejects >= self.config.max_global_rejects { Err(TestError::Abort("Too many global rejects".into())) } else { @@ -698,14 +857,16 @@ /// Insert 1 or increment the rejection detail at key for whence. fn insert_or_increment(into: &mut RejectionDetail, whence: Reason) { - into.entry(whence).and_modify(|count| { *count += 1 }).or_insert(1); + into.entry(whence) + .and_modify(|count| *count += 1) + .or_insert(1); } /// Increment the counter of flat map regenerations and return whether it /// is still under the configured limit. pub fn flat_map_regen(&self) -> bool { - self.flat_map_regens.fetch_add(1, SeqCst) < - self.config.max_flat_map_regens as usize + self.flat_map_regens.fetch_add(1, SeqCst) + < self.config.max_flat_map_regens as usize } fn new_cache(&self) -> Box { @@ -715,23 +876,23 @@ #[cfg(feature = "fork")] fn init_replay(rng: &mut TestRng) -> (Vec, ForkOutput) { - use test_runner::replay::{open_file, Replay, ReplayFileStatus::*}; + use crate::test_runner::replay::{open_file, Replay, ReplayFileStatus::*}; if let Some(path) = env::var_os(ENV_FORK_FILE) { let mut file = open_file(&path).expect("Failed to open replay file"); - let loaded = Replay::parse_from(&mut file) - .expect("Failed to read replay file"); + let loaded = + Replay::parse_from(&mut file).expect("Failed to read replay file"); match loaded { InProgress(replay) => { rng.set_seed(replay.seed); (replay.steps, ForkOutput { file: Some(file) }) - }, + } - Terminated(_) => - panic!("Replay file for child process is terminated?"), + Terminated(_) => { + panic!("Replay file for child process is terminated?") + } - Corrupt => - panic!("Replay file for child process is corrupt"), + Corrupt => panic!("Replay file for child process is corrupt"), } } else { (vec![], ForkOutput::empty()) @@ -739,36 +900,46 @@ } #[cfg(not(feature = "fork"))] -fn init_replay(_rng: &mut TestRng) -> (iter::Empty, ForkOutput) { +fn init_replay( + _rng: &mut TestRng, +) -> (iter::Empty, ForkOutput) { (iter::empty(), ForkOutput::empty()) } #[cfg(feature = "fork")] -fn await_child_without_timeout(child: &mut rusty_fork::ChildWrapper) - -> (Option, Option) { +fn await_child_without_timeout( + child: &mut rusty_fork::ChildWrapper, +) -> (Option, Option) { let status = child.wait().expect("Failed to wait for child process"); if status.success() { (None, None) } else { - (Some(TestCaseError::fail(format!( - "Child process exited with {}", status))), None) + ( + Some(TestCaseError::fail(format!( + "Child process exited with {}", + status + ))), + None, + ) } } #[cfg(all(feature = "fork", not(feature = "timeout")))] -fn await_child(child: &mut rusty_fork::ChildWrapper, - _: &mut tempfile::NamedTempFile, - _timeout: u32) - -> (Option, Option) { +fn await_child( + child: &mut rusty_fork::ChildWrapper, + _: &mut tempfile::NamedTempFile, + _timeout: u32, +) -> (Option, Option) { await_child_without_timeout(child) } #[cfg(all(feature = "fork", feature = "timeout"))] -fn await_child(child: &mut rusty_fork::ChildWrapper, - forkfile: &mut tempfile::NamedTempFile, - timeout: u32) - -> (Option, Option) { +fn await_child( + child: &mut rusty_fork::ChildWrapper, + forkfile: &mut tempfile::NamedTempFile, + timeout: u32, +) -> (Option, Option) { use std::time::Duration; if 0 == timeout { @@ -779,29 +950,44 @@ // multiple tests. Each time the timeout expires, we check whether the // file has grown larger. If it has, we allow the child to keep running // until the next timeout. - let mut last_forkfile_len = forkfile.as_file().metadata() - .map(|md| md.len()).unwrap_or(0); + let mut last_forkfile_len = forkfile + .as_file() + .metadata() + .map(|md| md.len()) + .unwrap_or(0); loop { - if let Some(status) = - child.wait_timeout(Duration::from_millis(timeout.into())) + if let Some(status) = child + .wait_timeout(Duration::from_millis(timeout.into())) .expect("Failed to wait for child process") { if status.success() { return (None, None); } else { - return (Some(TestCaseError::fail(format!( - "Child process exited with {}", status))), None); + return ( + Some(TestCaseError::fail(format!( + "Child process exited with {}", + status + ))), + None, + ); } } - let current_len = forkfile.as_file().metadata() - .map(|md| md.len()).unwrap_or(0); + let current_len = forkfile + .as_file() + .metadata() + .map(|md| md.len()) + .unwrap_or(0); // If we've gone a full timeout period without the file growing, // fail the test and kill the child. if current_len <= last_forkfile_len { - return (Some(TestCaseError::fail(format!( - "Timed out waiting for child process"))), Some(current_len)); + return ( + Some(TestCaseError::fail(format!( + "Timed out waiting for child process" + ))), + Some(current_len), + ); } else { last_forkfile_len = current_len; } @@ -814,8 +1000,8 @@ use std::fs; use super::*; - use test_runner::FileFailurePersistence; - use strategy::Strategy; + use crate::strategy::Strategy; + use crate::test_runner::FileFailurePersistence; #[test] fn gives_up_after_too_many_rejections() { @@ -836,7 +1022,10 @@ #[test] fn test_pass() { let mut runner = TestRunner::default(); - let result = runner.run(&(1u32..), |v| { assert!(v > 0); Ok(()) }); + let result = runner.run(&(1u32..), |v| { + assert!(v > 0); + Ok(()) + }); assert_eq!(Ok(()), result); } @@ -844,16 +1033,15 @@ fn test_fail_via_result() { let mut runner = TestRunner::new(Config { failure_persistence: None, - .. Config::default() + ..Config::default() + }); + let result = runner.run(&(0u32..10u32), |v| { + if v < 5 { + Ok(()) + } else { + Err(TestCaseError::fail("not less than 5")) + } }); - let result = runner.run( - &(0u32..10u32), |v| { - if v < 5 { - Ok(()) - } else { - Err(TestCaseError::fail("not less than 5")) - } - }); assert_eq!(Err(TestError::Fail("not less than 5".into(), 5)), result); } @@ -862,7 +1050,7 @@ fn test_fail_via_panic() { let mut runner = TestRunner::new(Config { failure_persistence: None, - .. Config::default() + ..Config::default() }); let result = runner.run(&(0u32..10u32), |v| { assert!(v < 5, "not less than 5"); @@ -888,49 +1076,57 @@ let input = (0i32..max).prop_map(PoorlyBehavedDebug); let config = Config { failure_persistence: Some(Box::new( - FileFailurePersistence::Direct(FILE) + FileFailurePersistence::Direct(FILE), )), - .. Config::default() + ..Config::default() }; // First test with cases that fail above half max, and then below half // max, to ensure we can correctly parse both lines of the persistence // file. let first_sub_failure = { - TestRunner::new(config.clone()).run(&input, |v| { - if v.0 < max/2 { - Ok(()) - } else { - Err(TestCaseError::Fail("too big".into())) - } - }).expect_err("didn't fail?") + TestRunner::new(config.clone()) + .run(&input, |v| { + if v.0 < max / 2 { + Ok(()) + } else { + Err(TestCaseError::Fail("too big".into())) + } + }) + .expect_err("didn't fail?") }; let first_super_failure = { - TestRunner::new(config.clone()).run(&input, |v| { - if v.0 >= max/2 { - Ok(()) - } else { - Err(TestCaseError::Fail("too small".into())) - } - }).expect_err("didn't fail?") + TestRunner::new(config.clone()) + .run(&input, |v| { + if v.0 >= max / 2 { + Ok(()) + } else { + Err(TestCaseError::Fail("too small".into())) + } + }) + .expect_err("didn't fail?") }; let second_sub_failure = { - TestRunner::new(config.clone()).run(&input, |v| { - if v.0 < max/2 { - Ok(()) - } else { - Err(TestCaseError::Fail("too big".into())) - } - }).expect_err("didn't fail?") + TestRunner::new(config.clone()) + .run(&input, |v| { + if v.0 < max / 2 { + Ok(()) + } else { + Err(TestCaseError::Fail("too big".into())) + } + }) + .expect_err("didn't fail?") }; let second_super_failure = { - TestRunner::new(config.clone()).run(&input, |v| { - if v.0 >= max/2 { - Ok(()) - } else { - Err(TestCaseError::Fail("too small".into())) - } - }).expect_err("didn't fail?") + TestRunner::new(config.clone()) + .run(&input, |v| { + if v.0 >= max / 2 { + Ok(()) + } else { + Err(TestCaseError::Fail("too small".into())) + } + }) + .expect_err("didn't fail?") }; assert_eq!(first_sub_failure, second_sub_failure); @@ -941,8 +1137,8 @@ fn new_rng_makes_separate_rng() { use rand::Rng; let mut runner = TestRunner::default(); - let from_1 = runner.new_rng().gen::(); - let from_2 = runner.rng().gen::(); + let from_1 = runner.new_rng().gen::<[u8; 16]>(); + let from_2 = runner.rng().gen::<[u8; 16]>(); assert_ne!(from_1, from_2); } @@ -952,8 +1148,10 @@ let mut runner = TestRunner::new(Config { fork: true, test_name: Some(concat!( - module_path!(), "::run_successful_test_in_fork")), - .. Config::default() + module_path!(), + "::run_successful_test_in_fork" + )), + ..Config::default() }); assert!(runner.run(&(0u32..1000), |_| Ok(())).is_ok()); @@ -965,14 +1163,19 @@ let mut runner = TestRunner::new(Config { fork: true, test_name: Some(concat!( - module_path!(), "::normal_failure_in_fork_results_in_correct_failure")), - .. Config::default() + module_path!(), + "::normal_failure_in_fork_results_in_correct_failure" + )), + ..Config::default() }); - let failure = runner.run(&(0u32..1000), |v| { - prop_assert!(v < 500); - Ok(()) - }).err().unwrap(); + let failure = runner + .run(&(0u32..1000), |v| { + prop_assert!(v < 500); + Ok(()) + }) + .err() + .unwrap(); match failure { TestError::Fail(_, value) => assert_eq!(500, value), @@ -986,16 +1189,21 @@ let mut runner = TestRunner::new(Config { fork: true, test_name: Some(concat!( - module_path!(), "::nonsuccessful_exit_finds_correct_failure")), - .. Config::default() + module_path!(), + "::nonsuccessful_exit_finds_correct_failure" + )), + ..Config::default() }); - let failure = runner.run(&(0u32..1000), |v| { - if v >= 500 { - ::std::process::exit(1); - } - Ok(()) - }).err().unwrap(); + let failure = runner + .run(&(0u32..1000), |v| { + if v >= 500 { + ::std::process::exit(1); + } + Ok(()) + }) + .err() + .unwrap(); match failure { TestError::Fail(_, value) => assert_eq!(500, value), @@ -1009,16 +1217,21 @@ let mut runner = TestRunner::new(Config { fork: true, test_name: Some(concat!( - module_path!(), "::spurious_exit_finds_correct_failure")), - .. Config::default() + module_path!(), + "::spurious_exit_finds_correct_failure" + )), + ..Config::default() }); - let failure = runner.run(&(0u32..1000), |v| { - if v >= 500 { - ::std::process::exit(0); - } - Ok(()) - }).err().unwrap(); + let failure = runner + .run(&(0u32..1000), |v| { + if v >= 500 { + ::std::process::exit(0); + } + Ok(()) + }) + .err() + .unwrap(); match failure { TestError::Fail(_, value) => assert_eq!(500, value), @@ -1033,16 +1246,23 @@ fork: true, timeout: 500, test_name: Some(concat!( - module_path!(), "::long_sleep_timeout_finds_correct_failure")), - .. Config::default() + module_path!(), + "::long_sleep_timeout_finds_correct_failure" + )), + ..Config::default() }); - let failure = runner.run(&(0u32..1000), |v| { - if v >= 500 { - ::std::thread::sleep(::std::time::Duration::from_millis(10_000)); - } - Ok(()) - }).err().unwrap(); + let failure = runner + .run(&(0u32..1000), |v| { + if v >= 500 { + ::std::thread::sleep(::std::time::Duration::from_millis( + 10_000, + )); + } + Ok(()) + }) + .err() + .unwrap(); match failure { TestError::Fail(_, value) => assert_eq!(500, value), @@ -1057,24 +1277,33 @@ fork: true, timeout: 500, test_name: Some(concat!( - module_path!(), "::mid_sleep_timeout_finds_correct_failure")), - .. Config::default() + module_path!(), + "::mid_sleep_timeout_finds_correct_failure" + )), + ..Config::default() }); - let failure = runner.run(&(0u32..1000), |v| { - if v >= 500 { - // Sleep a little longer than the timeout. This means that - // sometimes the test case itself will return before the parent - // process has noticed the child is timing out, so it's up to - // the child to mark it as a failure. - ::std::thread::sleep(::std::time::Duration::from_millis(600)); - } else { - // Sleep a bit so that the parent and child timing don't stay - // in sync. - ::std::thread::sleep(::std::time::Duration::from_millis(100)) - } - Ok(()) - }).err().unwrap(); + let failure = runner + .run(&(0u32..1000), |v| { + if v >= 500 { + // Sleep a little longer than the timeout. This means that + // sometimes the test case itself will return before the parent + // process has noticed the child is timing out, so it's up to + // the child to mark it as a failure. + ::std::thread::sleep(::std::time::Duration::from_millis( + 600, + )); + } else { + // Sleep a bit so that the parent and child timing don't stay + // in sync. + ::std::thread::sleep(::std::time::Duration::from_millis( + 100, + )) + } + Ok(()) + }) + .err() + .unwrap(); match failure { TestError::Fail(_, value) => assert_eq!(500, value), @@ -1092,14 +1321,14 @@ for _ in 0..256 { let mut runner = TestRunner::new(Config { failure_persistence: None, - result_cache: ::test_runner::result_cache::basic_result_cache, - .. Config::default() + result_cache: + crate::test_runner::result_cache::basic_result_cache, + ..Config::default() }); let pass = Rc::new(Cell::new(true)); let seen = Rc::new(RefCell::new(HashSet::new())); - let result = runner.run( - &(0u32..65536u32).prop_map(|v| v % 10), - |val| { + let result = + runner.run(&(0u32..65536u32).prop_map(|v| v % 10), |val| { if !seen.borrow_mut().insert(val) { println!("Value {} seen more than once", val); pass.set(false); @@ -1181,7 +1410,7 @@ fn test_shrink_bail(config: Config) { let mut runner = TestRunner::new(config); - let result = runner.run(&::num::u64::ANY, |v| { + let result = runner.run(&crate::num::u64::ANY, |v| { thread::sleep(Duration::from_millis(250)); prop_assert!(v <= u32::MAX as u64); Ok(()) diff -Nru cargo-0.35.0/vendor/proptest/src/tuple.rs cargo-0.37.0/vendor/proptest/src/tuple.rs --- cargo-0.35.0/vendor/proptest/src/tuple.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/proptest/src/tuple.rs 2019-07-17 05:42:23.000000000 +0000 @@ -12,8 +12,8 @@ //! There is no explicit "tuple strategy"; simply make a tuple containing the //! strategy and that tuple is itself a strategy. -use strategy::*; -use test_runner::*; +use crate::strategy::*; +use crate::test_runner::*; /// Common `ValueTree` implementation for all tuple strategies. #[derive(Clone, Copy, Debug)] @@ -102,7 +102,7 @@ #[cfg(test)] mod test { - use strategy::*; + use crate::strategy::*; use super::*; @@ -119,13 +119,19 @@ for _ in 0..256 { // Find a failing test case let mut case = input.new_tree(&mut runner).unwrap(); - if pass(case.current()) { continue; } + if pass(case.current()) { + continue; + } loop { if pass(case.current()) { - if !case.complicate() { break; } + if !case.complicate() { + break; + } } else { - if !case.simplify() { break; } + if !case.simplify() { + break; + } } } diff -Nru cargo-0.35.0/vendor/quote/.cargo-checksum.json cargo-0.37.0/vendor/quote/.cargo-checksum.json --- cargo-0.35.0/vendor/quote/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/quote/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db"} \ No newline at end of file +{"files":{},"package":"6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/quote/Cargo.toml cargo-0.37.0/vendor/quote/Cargo.toml --- cargo-0.35.0/vendor/quote/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/quote/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "quote" -version = "0.6.12" +version = "0.6.13" authors = ["David Tolnay "] include = ["Cargo.toml", "src/**/*.rs", "tests/**/*.rs", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] description = "Quasi-quoting macro quote!(...)" @@ -20,7 +20,7 @@ readme = "README.md" keywords = ["syn"] categories = ["development-tools::procedural-macro-helpers"] -license = "MIT/Apache-2.0" +license = "MIT OR Apache-2.0" repository = "https://github.com/dtolnay/quote" [dependencies.proc-macro2] version = "0.4.21" diff -Nru cargo-0.35.0/vendor/quote/README.md cargo-0.37.0/vendor/quote/README.md --- cargo-0.35.0/vendor/quote/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/quote/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -225,17 +225,19 @@ higher limit may be necessary for especially large invocations. You don't need this unless the compiler tells you that you need it. -## License +
-Licensed under either of +#### License - * 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) + +Licensed under either of
Apache License, Version +2.0 or MIT license at your option. + -at your option. - -### Contribution +
+ Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. + diff -Nru cargo-0.35.0/vendor/quote/src/lib.rs cargo-0.37.0/vendor/quote/src/lib.rs --- cargo-0.35.0/vendor/quote/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/quote/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -81,7 +81,7 @@ //! An even higher limit may be necessary for especially large invocations. // Quote types in rustdoc of other crates get linked to here. -#![doc(html_root_url = "https://docs.rs/quote/0.6.12")] +#![doc(html_root_url = "https://docs.rs/quote/0.6.13")] #[cfg(all( not(all(target_arch = "wasm32", target_os = "unknown")), diff -Nru cargo-0.35.0/vendor/quote/src/runtime.rs cargo-0.37.0/vendor/quote/src/runtime.rs --- cargo-0.35.0/vendor/quote/src/runtime.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/quote/src/runtime.rs 2019-07-17 05:42:23.000000000 +0000 @@ -10,21 +10,10 @@ } fn is_ident(token: &str) -> bool { - if token.bytes().all(|digit| digit >= b'0' && digit <= b'9') { - return false; - } - - let mut bytes = token.bytes(); - let first = bytes.next().unwrap(); - if !is_ident_start(first) { - return false; - } - for ch in bytes { - if !is_ident_continue(ch) { - return false; - } - } - true + let mut iter = token.bytes(); + let first_ok = iter.next().map(is_ident_start).unwrap_or(false); + + first_ok && iter.all(is_ident_continue) } pub fn parse(tokens: &mut TokenStream, span: Span, s: &str) { diff -Nru cargo-0.35.0/vendor/quote/tests/test.rs cargo-0.37.0/vendor/quote/tests/test.rs --- cargo-0.35.0/vendor/quote/tests/test.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/quote/tests/test.rs 2019-07-17 05:42:23.000000000 +0000 @@ -166,7 +166,7 @@ let tokens = quote! { #zero #pound #quote #apost #newline #heart }; - let expected = "'\\u{0}' '#' '\\\"' '\\'' '\\n' '\\u{2764}'"; + let expected = "'\\u{0}' '#' '\"' '\\'' '\\n' '\\u{2764}'"; assert_eq!(expected, tokens.to_string()); } @@ -174,7 +174,7 @@ fn test_str() { let s = "\0 a 'b \" c"; let tokens = quote!(#s); - let expected = "\"\\u{0} a \\'b \\\" c\""; + let expected = "\"\\u{0} a 'b \\\" c\""; assert_eq!(expected, tokens.to_string()); } @@ -182,7 +182,7 @@ fn test_string() { let s = "\0 a 'b \" c".to_string(); let tokens = quote!(#s); - let expected = "\"\\u{0} a \\'b \\\" c\""; + let expected = "\"\\u{0} a 'b \\\" c\""; assert_eq!(expected, tokens.to_string()); } diff -Nru cargo-0.35.0/vendor/rand/benches/distributions.rs cargo-0.37.0/vendor/rand/benches/distributions.rs --- cargo-0.35.0/vendor/rand/benches/distributions.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/benches/distributions.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,259 +0,0 @@ -// Copyright 2018 Developers of the Rand project. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(test)] - -extern crate test; -extern crate rand; - -const RAND_BENCH_N: u64 = 1000; - -use std::mem::size_of; -use test::Bencher; -use std::time::Duration; - -use rand::{Rng, FromEntropy}; -use rand::rngs::SmallRng; -use rand::distributions::*; - -macro_rules! distr_int { - ($fnn:ident, $ty:ty, $distr:expr) => { - #[bench] - fn $fnn(b: &mut Bencher) { - let mut rng = SmallRng::from_entropy(); - let distr = $distr; - - b.iter(|| { - let mut accum = 0 as $ty; - for _ in 0..::RAND_BENCH_N { - let x: $ty = distr.sample(&mut rng); - accum = accum.wrapping_add(x); - } - accum - }); - b.bytes = size_of::<$ty>() as u64 * ::RAND_BENCH_N; - } - } -} - -macro_rules! distr_float { - ($fnn:ident, $ty:ty, $distr:expr) => { - #[bench] - fn $fnn(b: &mut Bencher) { - let mut rng = SmallRng::from_entropy(); - let distr = $distr; - - b.iter(|| { - let mut accum = 0.0; - for _ in 0..::RAND_BENCH_N { - let x: $ty = distr.sample(&mut rng); - accum += x; - } - accum - }); - b.bytes = size_of::<$ty>() as u64 * ::RAND_BENCH_N; - } - } -} - -macro_rules! distr_duration { - ($fnn:ident, $distr:expr) => { - #[bench] - fn $fnn(b: &mut Bencher) { - let mut rng = SmallRng::from_entropy(); - let distr = $distr; - - b.iter(|| { - let mut accum = Duration::new(0, 0); - for _ in 0..::RAND_BENCH_N { - let x: Duration = distr.sample(&mut rng); - accum = accum.checked_add(x).unwrap_or(Duration::new(u64::max_value(), 999_999_999)); - } - accum - }); - b.bytes = size_of::() as u64 * ::RAND_BENCH_N; - } - } -} - -macro_rules! distr { - ($fnn:ident, $ty:ty, $distr:expr) => { - #[bench] - fn $fnn(b: &mut Bencher) { - let mut rng = SmallRng::from_entropy(); - let distr = $distr; - - b.iter(|| { - let mut accum = 0u32; - for _ in 0..::RAND_BENCH_N { - let x: $ty = distr.sample(&mut rng); - accum = accum.wrapping_add(x as u32); - } - accum - }); - b.bytes = size_of::<$ty>() as u64 * ::RAND_BENCH_N; - } - } -} - -macro_rules! distr_arr { - ($fnn:ident, $ty:ty, $distr:expr) => { - #[bench] - fn $fnn(b: &mut Bencher) { - let mut rng = SmallRng::from_entropy(); - let distr = $distr; - - b.iter(|| { - let mut accum = 0u32; - for _ in 0..::RAND_BENCH_N { - let x: $ty = distr.sample(&mut rng); - accum = accum.wrapping_add(x[0] as u32); - } - accum - }); - b.bytes = size_of::<$ty>() as u64 * ::RAND_BENCH_N; - } - } -} - -// uniform -distr_int!(distr_uniform_i8, i8, Uniform::new(20i8, 100)); -distr_int!(distr_uniform_i16, i16, Uniform::new(-500i16, 2000)); -distr_int!(distr_uniform_i32, i32, Uniform::new(-200_000_000i32, 800_000_000)); -distr_int!(distr_uniform_i64, i64, Uniform::new(3i64, 123_456_789_123)); -distr_int!(distr_uniform_i128, i128, Uniform::new(-123_456_789_123i128, 123_456_789_123_456_789)); - -distr_float!(distr_uniform_f32, f32, Uniform::new(2.26f32, 2.319)); -distr_float!(distr_uniform_f64, f64, Uniform::new(2.26f64, 2.319)); - -const LARGE_SEC: u64 = u64::max_value() / 1000; - -distr_duration!(distr_uniform_duration_largest, - Uniform::new_inclusive(Duration::new(0, 0), Duration::new(u64::max_value(), 999_999_999)) -); -distr_duration!(distr_uniform_duration_large, - Uniform::new(Duration::new(0, 0), Duration::new(LARGE_SEC, 1_000_000_000 / 2)) -); -distr_duration!(distr_uniform_duration_one, - Uniform::new(Duration::new(0, 0), Duration::new(1, 0)) -); -distr_duration!(distr_uniform_duration_variety, - Uniform::new(Duration::new(10000, 423423), Duration::new(200000, 6969954)) -); -distr_duration!(distr_uniform_duration_edge, - Uniform::new_inclusive(Duration::new(LARGE_SEC, 999_999_999), Duration::new(LARGE_SEC + 1, 1)) -); - - -// standard -distr_int!(distr_standard_i8, i8, Standard); -distr_int!(distr_standard_i16, i16, Standard); -distr_int!(distr_standard_i32, i32, Standard); -distr_int!(distr_standard_i64, i64, Standard); -distr_int!(distr_standard_i128, i128, Standard); - -distr!(distr_standard_bool, bool, Standard); -distr!(distr_standard_alphanumeric, char, Alphanumeric); -distr!(distr_standard_codepoint, char, Standard); - -distr_float!(distr_standard_f32, f32, Standard); -distr_float!(distr_standard_f64, f64, Standard); -distr_float!(distr_open01_f32, f32, Open01); -distr_float!(distr_open01_f64, f64, Open01); -distr_float!(distr_openclosed01_f32, f32, OpenClosed01); -distr_float!(distr_openclosed01_f64, f64, OpenClosed01); - -// distributions -distr_float!(distr_exp, f64, Exp::new(1.23 * 4.56)); -distr_float!(distr_normal, f64, Normal::new(-1.23, 4.56)); -distr_float!(distr_log_normal, f64, LogNormal::new(-1.23, 4.56)); -distr_float!(distr_gamma_large_shape, f64, Gamma::new(10., 1.0)); -distr_float!(distr_gamma_small_shape, f64, Gamma::new(0.1, 1.0)); -distr_float!(distr_cauchy, f64, Cauchy::new(4.2, 6.9)); -distr_int!(distr_binomial, u64, Binomial::new(20, 0.7)); -distr_int!(distr_poisson, u64, Poisson::new(4.0)); -distr!(distr_bernoulli, bool, Bernoulli::new(0.18)); -distr_arr!(distr_circle, [f64; 2], UnitCircle::new()); -distr_arr!(distr_sphere_surface, [f64; 3], UnitSphereSurface::new()); - -// Weighted -distr_int!(distr_weighted_i8, usize, WeightedIndex::new(&[1i8, 2, 3, 4, 12, 0, 2, 1]).unwrap()); -distr_int!(distr_weighted_u32, usize, WeightedIndex::new(&[1u32, 2, 3, 4, 12, 0, 2, 1]).unwrap()); -distr_int!(distr_weighted_f64, usize, WeightedIndex::new(&[1.0f64, 0.001, 1.0/3.0, 4.01, 0.0, 3.3, 22.0, 0.001]).unwrap()); -distr_int!(distr_weighted_large_set, usize, WeightedIndex::new((0..10000).rev().chain(1..10001)).unwrap()); - -// construct and sample from a range -macro_rules! gen_range_int { - ($fnn:ident, $ty:ident, $low:expr, $high:expr) => { - #[bench] - fn $fnn(b: &mut Bencher) { - let mut rng = SmallRng::from_entropy(); - - b.iter(|| { - let mut high = $high; - let mut accum: $ty = 0; - for _ in 0..::RAND_BENCH_N { - accum = accum.wrapping_add(rng.gen_range($low, high)); - // force recalculation of range each time - high = high.wrapping_add(1) & std::$ty::MAX; - } - accum - }); - b.bytes = size_of::<$ty>() as u64 * ::RAND_BENCH_N; - } - } -} - -gen_range_int!(gen_range_i8, i8, -20i8, 100); -gen_range_int!(gen_range_i16, i16, -500i16, 2000); -gen_range_int!(gen_range_i32, i32, -200_000_000i32, 800_000_000); -gen_range_int!(gen_range_i64, i64, 3i64, 123_456_789_123); -gen_range_int!(gen_range_i128, i128, -12345678901234i128, 123_456_789_123_456_789); - -// construct and sample from a floating-point range -macro_rules! gen_range_float { - ($fnn:ident, $ty:ident, $low:expr, $high:expr) => { - #[bench] - fn $fnn(b: &mut Bencher) { - let mut rng = SmallRng::from_entropy(); - - b.iter(|| { - let mut high = $high; - let mut low = $low; - let mut accum: $ty = 0.0; - for _ in 0..::RAND_BENCH_N { - accum += rng.gen_range(low, high); - // force recalculation of range each time - low += 0.9; - high += 1.1; - } - accum - }); - b.bytes = size_of::<$ty>() as u64 * ::RAND_BENCH_N; - } - } -} - -gen_range_float!(gen_range_f32, f32, -20000.0f32, 100000.0); -gen_range_float!(gen_range_f64, f64, 123.456f64, 7890.12); - -#[bench] -fn dist_iter(b: &mut Bencher) { - let mut rng = SmallRng::from_entropy(); - let distr = Normal::new(-2.71828, 3.14159); - let mut iter = distr.sample_iter(&mut rng); - - b.iter(|| { - let mut accum = 0.0; - for _ in 0..::RAND_BENCH_N { - accum += iter.next().unwrap(); - } - accum - }); - b.bytes = size_of::() as u64 * ::RAND_BENCH_N; -} diff -Nru cargo-0.35.0/vendor/rand/benches/generators.rs cargo-0.37.0/vendor/rand/benches/generators.rs --- cargo-0.35.0/vendor/rand/benches/generators.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/benches/generators.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,15 +7,9 @@ // except according to those terms. #![feature(test)] +#![allow(non_snake_case)] extern crate test; -extern crate rand; -extern crate rand_isaac; -extern crate rand_chacha; -extern crate rand_hc; -extern crate rand_pcg; -extern crate rand_xorshift; -extern crate rand_xoshiro; const RAND_BENCH_N: u64 = 1000; const BYTES_LEN: usize = 1024; @@ -25,11 +19,11 @@ use rand::prelude::*; use rand::rngs::adapter::ReseedingRng; -use rand::rngs::{OsRng, JitterRng, EntropyRng}; +use rand::rngs::{OsRng, mock::StepRng}; use rand_isaac::{IsaacRng, Isaac64Rng}; -use rand_chacha::ChaChaRng; -use rand_hc::{Hc128Rng, Hc128Core}; -use rand_pcg::{Lcg64Xsh32, Mcg128Xsl64}; +use rand_chacha::{ChaCha20Core, ChaCha8Rng, ChaCha12Rng, ChaCha20Rng}; +use rand_hc::{Hc128Rng}; +use rand_pcg::{Pcg32, Pcg64, Pcg64Mcg}; use rand_xorshift::XorShiftRng; use rand_xoshiro::{Xoshiro256StarStar, Xoshiro256Plus, Xoshiro128StarStar, Xoshiro128Plus, Xoroshiro128StarStar, Xoroshiro128Plus, SplitMix64, @@ -52,6 +46,7 @@ } } +gen_bytes!(gen_bytes_step, StepRng::new(0, 1)); gen_bytes!(gen_bytes_xorshift, XorShiftRng::from_entropy()); gen_bytes!(gen_bytes_xoshiro256starstar, Xoshiro256StarStar::from_entropy()); gen_bytes!(gen_bytes_xoshiro256plus, Xoshiro256Plus::from_entropy()); @@ -62,15 +57,19 @@ gen_bytes!(gen_bytes_xoroshiro64starstar, Xoroshiro64StarStar::from_entropy()); gen_bytes!(gen_bytes_xoroshiro64star, Xoroshiro64Star::from_entropy()); gen_bytes!(gen_bytes_splitmix64, SplitMix64::from_entropy()); -gen_bytes!(gen_bytes_lcg64_xsh32, Lcg64Xsh32::from_entropy()); -gen_bytes!(gen_bytes_mcg128_xsh64, Mcg128Xsl64::from_entropy()); -gen_bytes!(gen_bytes_chacha20, ChaChaRng::from_entropy()); +gen_bytes!(gen_bytes_pcg32, Pcg32::from_entropy()); +gen_bytes!(gen_bytes_pcg64, Pcg64::from_entropy()); +gen_bytes!(gen_bytes_pcg64mcg, Pcg64Mcg::from_entropy()); +gen_bytes!(gen_bytes_chacha8, ChaCha8Rng::from_entropy()); +gen_bytes!(gen_bytes_chacha12, ChaCha12Rng::from_entropy()); +gen_bytes!(gen_bytes_chacha20, ChaCha20Rng::from_entropy()); gen_bytes!(gen_bytes_hc128, Hc128Rng::from_entropy()); gen_bytes!(gen_bytes_isaac, IsaacRng::from_entropy()); gen_bytes!(gen_bytes_isaac64, Isaac64Rng::from_entropy()); gen_bytes!(gen_bytes_std, StdRng::from_entropy()); +#[cfg(feature="small_rng")] gen_bytes!(gen_bytes_small, SmallRng::from_entropy()); -gen_bytes!(gen_bytes_os, OsRng::new().unwrap()); +gen_bytes!(gen_bytes_os, OsRng); macro_rules! gen_uint { ($fnn:ident, $ty:ty, $gen:expr) => { @@ -89,6 +88,7 @@ } } +gen_uint!(gen_u32_step, u32, StepRng::new(0, 1)); gen_uint!(gen_u32_xorshift, u32, XorShiftRng::from_entropy()); gen_uint!(gen_u32_xoshiro256starstar, u32, Xoshiro256StarStar::from_entropy()); gen_uint!(gen_u32_xoshiro256plus, u32, Xoshiro256Plus::from_entropy()); @@ -99,16 +99,21 @@ gen_uint!(gen_u32_xoroshiro64starstar, u32, Xoroshiro64StarStar::from_entropy()); gen_uint!(gen_u32_xoroshiro64star, u32, Xoroshiro64Star::from_entropy()); gen_uint!(gen_u32_splitmix64, u32, SplitMix64::from_entropy()); -gen_uint!(gen_u32_lcg64_xsh32, u32, Lcg64Xsh32::from_entropy()); -gen_uint!(gen_u32_mcg128_xsh64, u32, Mcg128Xsl64::from_entropy()); -gen_uint!(gen_u32_chacha20, u32, ChaChaRng::from_entropy()); +gen_uint!(gen_u32_pcg32, u32, Pcg32::from_entropy()); +gen_uint!(gen_u32_pcg64, u32, Pcg64::from_entropy()); +gen_uint!(gen_u32_pcg64mcg, u32, Pcg64Mcg::from_entropy()); +gen_uint!(gen_u32_chacha8, u32, ChaCha8Rng::from_entropy()); +gen_uint!(gen_u32_chacha12, u32, ChaCha12Rng::from_entropy()); +gen_uint!(gen_u32_chacha20, u32, ChaCha20Rng::from_entropy()); gen_uint!(gen_u32_hc128, u32, Hc128Rng::from_entropy()); gen_uint!(gen_u32_isaac, u32, IsaacRng::from_entropy()); gen_uint!(gen_u32_isaac64, u32, Isaac64Rng::from_entropy()); gen_uint!(gen_u32_std, u32, StdRng::from_entropy()); +#[cfg(feature="small_rng")] gen_uint!(gen_u32_small, u32, SmallRng::from_entropy()); -gen_uint!(gen_u32_os, u32, OsRng::new().unwrap()); +gen_uint!(gen_u32_os, u32, OsRng); +gen_uint!(gen_u64_step, u64, StepRng::new(0, 1)); gen_uint!(gen_u64_xorshift, u64, XorShiftRng::from_entropy()); gen_uint!(gen_u64_xoshiro256starstar, u64, Xoshiro256StarStar::from_entropy()); gen_uint!(gen_u64_xoshiro256plus, u64, Xoshiro256Plus::from_entropy()); @@ -119,26 +124,19 @@ gen_uint!(gen_u64_xoroshiro64starstar, u64, Xoroshiro64StarStar::from_entropy()); gen_uint!(gen_u64_xoroshiro64star, u64, Xoroshiro64Star::from_entropy()); gen_uint!(gen_u64_splitmix64, u64, SplitMix64::from_entropy()); -gen_uint!(gen_u64_lcg64_xsh32, u64, Lcg64Xsh32::from_entropy()); -gen_uint!(gen_u64_mcg128_xsh64, u64, Mcg128Xsl64::from_entropy()); -gen_uint!(gen_u64_chacha20, u64, ChaChaRng::from_entropy()); +gen_uint!(gen_u64_pcg32, u64, Pcg32::from_entropy()); +gen_uint!(gen_u64_pcg64, u64, Pcg64::from_entropy()); +gen_uint!(gen_u64_pcg64mcg, u64, Pcg64Mcg::from_entropy()); +gen_uint!(gen_u64_chacha8, u64, ChaCha8Rng::from_entropy()); +gen_uint!(gen_u64_chacha12, u64, ChaCha12Rng::from_entropy()); +gen_uint!(gen_u64_chacha20, u64, ChaCha20Rng::from_entropy()); gen_uint!(gen_u64_hc128, u64, Hc128Rng::from_entropy()); gen_uint!(gen_u64_isaac, u64, IsaacRng::from_entropy()); gen_uint!(gen_u64_isaac64, u64, Isaac64Rng::from_entropy()); gen_uint!(gen_u64_std, u64, StdRng::from_entropy()); +#[cfg(feature="small_rng")] gen_uint!(gen_u64_small, u64, SmallRng::from_entropy()); -gen_uint!(gen_u64_os, u64, OsRng::new().unwrap()); - -// Do not test JitterRng like the others by running it RAND_BENCH_N times per, -// measurement, because it is way too slow. Only run it once. -#[bench] -fn gen_u64_jitter(b: &mut Bencher) { - let mut rng = JitterRng::new().unwrap(); - b.iter(|| { - rng.gen::() - }); - b.bytes = size_of::() as u64; -} +gen_uint!(gen_u64_os, u64, OsRng); macro_rules! init_gen { ($fnn:ident, $gen:ident) => { @@ -163,60 +161,42 @@ init_gen!(init_xoroshiro64starstar, Xoroshiro64StarStar); init_gen!(init_xoroshiro64star, Xoroshiro64Star); init_gen!(init_splitmix64, SplitMix64); -init_gen!(init_lcg64_xsh32, Lcg64Xsh32); -init_gen!(init_mcg128_xsh64, Mcg128Xsl64); +init_gen!(init_pcg32, Pcg32); +init_gen!(init_pcg64, Pcg64); +init_gen!(init_pcg64mcg, Pcg64Mcg); init_gen!(init_hc128, Hc128Rng); init_gen!(init_isaac, IsaacRng); init_gen!(init_isaac64, Isaac64Rng); -init_gen!(init_chacha, ChaChaRng); - -#[bench] -fn init_jitter(b: &mut Bencher) { - b.iter(|| { - JitterRng::new().unwrap() - }); -} +init_gen!(init_chacha, ChaCha20Rng); +const RESEEDING_BYTES_LEN: usize = 1024 * 1024; +const RESEEDING_BENCH_N: u64 = 16; -const RESEEDING_THRESHOLD: u64 = 1024*1024*1024; // something high enough to get - // deterministic measurements - -#[bench] -fn reseeding_hc128_bytes(b: &mut Bencher) { - let mut rng = ReseedingRng::new(Hc128Core::from_entropy(), - RESEEDING_THRESHOLD, - EntropyRng::new()); - let mut buf = [0u8; BYTES_LEN]; - b.iter(|| { - for _ in 0..RAND_BENCH_N { - rng.fill_bytes(&mut buf); - black_box(buf); - } - }); - b.bytes = BYTES_LEN as u64 * RAND_BENCH_N; -} - -macro_rules! reseeding_uint { - ($fnn:ident, $ty:ty) => { +macro_rules! reseeding_bytes { + ($fnn:ident, $thresh:expr) => { #[bench] fn $fnn(b: &mut Bencher) { - let mut rng = ReseedingRng::new(Hc128Core::from_entropy(), - RESEEDING_THRESHOLD, - EntropyRng::new()); + let mut rng = ReseedingRng::new(ChaCha20Core::from_entropy(), + $thresh * 1024, + OsRng); + let mut buf = [0u8; RESEEDING_BYTES_LEN]; b.iter(|| { - let mut accum: $ty = 0; - for _ in 0..RAND_BENCH_N { - accum = accum.wrapping_add(rng.gen::<$ty>()); + for _ in 0..RESEEDING_BENCH_N { + rng.fill_bytes(&mut buf); + black_box(&buf); } - accum }); - b.bytes = size_of::<$ty>() as u64 * RAND_BENCH_N; + b.bytes = RESEEDING_BYTES_LEN as u64 * RESEEDING_BENCH_N; } } } -reseeding_uint!(reseeding_hc128_u32, u32); -reseeding_uint!(reseeding_hc128_u64, u64); +reseeding_bytes!(reseeding_chacha20_4k, 4); +reseeding_bytes!(reseeding_chacha20_16k, 16); +reseeding_bytes!(reseeding_chacha20_32k, 32); +reseeding_bytes!(reseeding_chacha20_64k, 64); +reseeding_bytes!(reseeding_chacha20_256k, 256); +reseeding_bytes!(reseeding_chacha20_1M, 1024); macro_rules! threadrng_uint { diff -Nru cargo-0.35.0/vendor/rand/benches/misc.rs cargo-0.37.0/vendor/rand/benches/misc.rs --- cargo-0.35.0/vendor/rand/benches/misc.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/benches/misc.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,20 +9,21 @@ #![feature(test)] extern crate test; -extern crate rand; const RAND_BENCH_N: u64 = 1000; use test::Bencher; use rand::prelude::*; +use rand::distributions::{Distribution, Standard, Bernoulli}; +use rand_pcg::{Pcg32, Pcg64Mcg}; #[bench] fn misc_gen_bool_const(b: &mut Bencher) { - let mut rng = StdRng::from_rng(&mut thread_rng()).unwrap(); + let mut rng = Pcg32::from_rng(&mut thread_rng()).unwrap(); b.iter(|| { let mut accum = true; - for _ in 0..::RAND_BENCH_N { + for _ in 0..crate::RAND_BENCH_N { accum ^= rng.gen_bool(0.18); } accum @@ -31,11 +32,11 @@ #[bench] fn misc_gen_bool_var(b: &mut Bencher) { - let mut rng = StdRng::from_rng(&mut thread_rng()).unwrap(); + let mut rng = Pcg32::from_rng(&mut thread_rng()).unwrap(); b.iter(|| { let mut accum = true; let mut p = 0.18; - for _ in 0..::RAND_BENCH_N { + for _ in 0..crate::RAND_BENCH_N { accum ^= rng.gen_bool(p); p += 0.0001; } @@ -45,10 +46,10 @@ #[bench] fn misc_gen_ratio_const(b: &mut Bencher) { - let mut rng = StdRng::from_rng(&mut thread_rng()).unwrap(); + let mut rng = Pcg32::from_rng(&mut thread_rng()).unwrap(); b.iter(|| { let mut accum = true; - for _ in 0..::RAND_BENCH_N { + for _ in 0..crate::RAND_BENCH_N { accum ^= rng.gen_ratio(2, 3); } accum @@ -57,10 +58,10 @@ #[bench] fn misc_gen_ratio_var(b: &mut Bencher) { - let mut rng = StdRng::from_rng(&mut thread_rng()).unwrap(); + let mut rng = Pcg32::from_rng(&mut thread_rng()).unwrap(); b.iter(|| { let mut accum = true; - for i in 2..(::RAND_BENCH_N as u32 + 2) { + for i in 2..(crate::RAND_BENCH_N as u32 + 2) { accum ^= rng.gen_ratio(i, i + 1); } accum @@ -69,11 +70,11 @@ #[bench] fn misc_bernoulli_const(b: &mut Bencher) { - let mut rng = StdRng::from_rng(&mut thread_rng()).unwrap(); + let mut rng = Pcg32::from_rng(&mut thread_rng()).unwrap(); b.iter(|| { - let d = rand::distributions::Bernoulli::new(0.18); + let d = rand::distributions::Bernoulli::new(0.18).unwrap(); let mut accum = true; - for _ in 0..::RAND_BENCH_N { + for _ in 0..crate::RAND_BENCH_N { accum ^= rng.sample(d); } accum @@ -82,12 +83,12 @@ #[bench] fn misc_bernoulli_var(b: &mut Bencher) { - let mut rng = StdRng::from_rng(&mut thread_rng()).unwrap(); + let mut rng = Pcg32::from_rng(&mut thread_rng()).unwrap(); b.iter(|| { let mut accum = true; let mut p = 0.18; - for _ in 0..::RAND_BENCH_N { - let d = rand::distributions::Bernoulli::new(p); + for _ in 0..crate::RAND_BENCH_N { + let d = Bernoulli::new(p).unwrap(); accum ^= rng.sample(d); p += 0.0001; } @@ -95,30 +96,10 @@ }) } -macro_rules! sample_binomial { - ($name:ident, $n:expr, $p:expr) => { - #[bench] - fn $name(b: &mut Bencher) { - let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap(); - let (n, p) = ($n, $p); - b.iter(|| { - let d = rand::distributions::Binomial::new(n, p); - rng.sample(d) - }) - } - } -} - -sample_binomial!(misc_binomial_1, 1, 0.9); -sample_binomial!(misc_binomial_10, 10, 0.9); -sample_binomial!(misc_binomial_100, 100, 0.99); -sample_binomial!(misc_binomial_1000, 1000, 0.01); -sample_binomial!(misc_binomial_1e12, 1000_000_000_000, 0.2); - #[bench] fn gen_1k_iter_repeat(b: &mut Bencher) { use std::iter; - let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap(); + let mut rng = Pcg64Mcg::from_rng(&mut thread_rng()).unwrap(); b.iter(|| { let v: Vec = iter::repeat(()).map(|()| rng.gen()).take(128).collect(); v @@ -128,8 +109,7 @@ #[bench] fn gen_1k_sample_iter(b: &mut Bencher) { - use rand::distributions::{Distribution, Standard}; - let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap(); + let mut rng = Pcg64Mcg::from_rng(&mut thread_rng()).unwrap(); b.iter(|| { let v: Vec = Standard.sample_iter(&mut rng).take(128).collect(); v @@ -139,7 +119,7 @@ #[bench] fn gen_1k_gen_array(b: &mut Bencher) { - let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap(); + let mut rng = Pcg64Mcg::from_rng(&mut thread_rng()).unwrap(); b.iter(|| { // max supported array length is 32! let v: [[u64; 32]; 4] = rng.gen(); @@ -150,7 +130,7 @@ #[bench] fn gen_1k_fill(b: &mut Bencher) { - let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap(); + let mut rng = Pcg64Mcg::from_rng(&mut thread_rng()).unwrap(); let mut buf = [0u64; 128]; b.iter(|| { rng.fill(&mut buf[..]); diff -Nru cargo-0.35.0/vendor/rand/benches/seq.rs cargo-0.37.0/vendor/rand/benches/seq.rs --- cargo-0.35.0/vendor/rand/benches/seq.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/benches/seq.rs 2019-07-17 05:42:23.000000000 +0000 @@ -10,7 +10,6 @@ #![allow(non_snake_case)] extern crate test; -extern crate rand; use test::Bencher; @@ -18,6 +17,10 @@ use rand::seq::*; use std::mem::size_of; +// We force use of 32-bit RNG since seq code is optimised for use with 32-bit +// generators on all platforms. +use rand_pcg::Pcg32 as SmallRng; + const RAND_BENCH_N: u64 = 1000; #[bench] @@ -44,7 +47,7 @@ } s }); - b.bytes = size_of::() as u64 * ::RAND_BENCH_N; + b.bytes = size_of::() as u64 * crate::RAND_BENCH_N; } macro_rules! seq_slice_choose_multiple { @@ -86,7 +89,7 @@ } s }); - b.bytes = size_of::() as u64 * ::RAND_BENCH_N; + b.bytes = size_of::() as u64 * crate::RAND_BENCH_N; } #[derive(Clone)] diff -Nru cargo-0.35.0/vendor/rand/build.rs cargo-0.37.0/vendor/rand/build.rs --- cargo-0.35.0/vendor/rand/build.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/build.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -extern crate autocfg; - -fn main() { - println!("cargo:rerun-if-changed=build.rs"); - - let ac = autocfg::new(); - ac.emit_rustc_version(1, 25); - ac.emit_rustc_version(1, 26); - ac.emit_rustc_version(1, 27); -} diff -Nru cargo-0.35.0/vendor/rand/.cargo-checksum.json cargo-0.37.0/vendor/rand/.cargo-checksum.json --- cargo-0.35.0/vendor/rand/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"} \ No newline at end of file +{"files":{},"package":"d47eab0e83d9693d40f825f86948aa16eff6750ead4bdffc4ab95b8b3a7f052c"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/rand/Cargo.toml cargo-0.37.0/vendor/rand/Cargo.toml --- cargo-0.35.0/vendor/rand/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -11,14 +11,15 @@ # will likely look very different (and much more reasonable) [package] +edition = "2018" name = "rand" -version = "0.6.5" +version = "0.7.0" authors = ["The Rand Project Developers", "The Rust Project Developers"] -build = "build.rs" exclude = ["/utils/*", "/.travis.yml", "/appveyor.yml", ".gitignore"] +autobenches = true description = "Random number generators and other randomness functionality.\n" homepage = "https://crates.io/crates/rand" -documentation = "https://rust-random.github.io/rand" +documentation = "https://rust-random.github.io/rand/" readme = "README.md" keywords = ["random", "rng"] categories = ["algorithms", "no-std"] @@ -26,6 +27,11 @@ repository = "https://github.com/rust-random/rand" [package.metadata.docs.rs] all-features = true +[dependencies.getrandom_package] +version = "0.1.1" +optional = true +package = "getrandom" + [dependencies.log] version = "0.4" optional = true @@ -35,54 +41,45 @@ features = ["into_bits"] optional = true -[dependencies.rand_chacha] -version = "0.1" - [dependencies.rand_core] -version = "0.4" - -[dependencies.rand_hc] -version = "0.1" +version = "0.5" -[dependencies.rand_isaac] -version = "0.1" - -[dependencies.rand_jitter] -version = "0.1" - -[dependencies.rand_os] -version = "0.1" +[dependencies.rand_pcg] +version = "0.2" optional = true +[dev-dependencies.rand_hc] +version = "0.2" -[dependencies.rand_pcg] -version = "0.1" +[dev-dependencies.rand_isaac] +version = "0.2" -[dependencies.rand_xorshift] -version = "0.1" -[dev-dependencies.average] -version = "0.9.2" +[dev-dependencies.rand_pcg] +version = "0.2" + +[dev-dependencies.rand_xorshift] +version = "0.2" [dev-dependencies.rand_xoshiro] -version = "0.1" -[build-dependencies.autocfg] -version = "0.1" +version = "0.3" [features] alloc = ["rand_core/alloc"] default = ["std"] -i128_support = [] +getrandom = ["getrandom_package", "rand_core/getrandom"] nightly = ["simd_support"] -serde1 = ["rand_core/serde1", "rand_isaac/serde1", "rand_xorshift/serde1"] +serde1 = [] simd_support = ["packed_simd"] -std = ["rand_core/std", "alloc", "rand_os", "rand_jitter/std"] -stdweb = ["rand_os/stdweb"] -wasm-bindgen = ["rand_os/wasm-bindgen"] -[target."cfg(unix)".dependencies.libc] +small_rng = ["rand_pcg"] +std = ["rand_core/std", "alloc", "getrandom"] +stdweb = ["getrandom_package/stdweb"] +wasm-bindgen = ["getrandom_package/wasm-bindgen"] +[target."cfg(not(target_os = \"emscripten\"))".dependencies.rand_chacha] +version = "0.2" +[target."cfg(target_os = \"emscripten\")".dependencies.rand_hc] version = "0.2" +[target."cfg(unix)".dependencies.libc] +version = "0.2.22" default-features = false -[target."cfg(windows)".dependencies.winapi] -version = "0.3" -features = ["minwindef", "ntsecapi", "profileapi", "winnt"] [badges.appveyor] repository = "rust-random/rand" diff -Nru cargo-0.35.0/vendor/rand/CHANGELOG.md cargo-0.37.0/vendor/rand/CHANGELOG.md --- cargo-0.35.0/vendor/rand/CHANGELOG.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -9,11 +9,53 @@ You may also find the [Upgrade Guide](https://rust-random.github.io/book/update.html) useful. +## [0.7.0] - 2019-06-28 + +### Fixes +- Fix incorrect pointer usages revealed by Miri testing (#780, #781) +- Fix (tiny!) bias in `Uniform` for 8- and 16-bit ints (#809) + +### Crate +- Bumped MSRV (min supported Rust version) to 1.32.0 +- Updated to Rust Edition 2018 (#823, #824) +- Removed dependence on `rand_xorshift`, `rand_isaac`, `rand_jitter` crates (#759, #765) +- Remove dependency on `winapi` (#724) +- Removed all `build.rs` files (#824) +- Removed code already deprecated in version 0.6 (#757) +- Removed the serde1 feature (It's still available for backwards compatibility, but it does not do anything. #830) +- Many documentation changes + +### rand_core +- Updated to `rand_core` 0.5.0 +- `Error` type redesigned with new API (#800) +- Move `from_entropy` method to `SeedableRng` and remove `FromEntropy` (#800) +- `SeedableRng::from_rng` is now expected to be value-stable (#815) + +### Standard RNGs +- OS interface moved from `rand_os` to new `getrandom` crate (#765, [getrandom](https://github.com/rust-random/getrandom)) +- Use ChaCha for `StdRng` and `ThreadRng` (#792) +- Feature-gate `SmallRng` (#792) +- `ThreadRng` now supports `Copy` (#758) +- Deprecated `EntropyRng` (#765) +- Enable fork protection of ReseedingRng without `std` (#724) + +### Distributions +- Many distributions have been moved to `rand_distr` (#761) +- `Bernoulli::new` constructor now returns a `Result` (#803) +- `Distribution::sample_iter` adjusted for more flexibility (#758) +- Added `distributions::weighted::alias_method::WeightedIndex` for `O(1)` sampling (#692) +- Support sampling `NonZeroU*` types with the `Standard` distribution (#728) +- Optimised `Binomial` distribution sampling (#735, #740, #752) +- Optimised SIMD float sampling (#739) + +### Sequences +- Make results portable across 32- and 64-bit by using `u32` samples for `usize` where possible (#809) + ## [0.6.5] - 2019-01-28 ### Crates - Update `rand_core` to 0.4 (#703) - Move `JitterRng` to its own crate (#685) -- Add a warm-bindgen test crate (#696) +- Add a wasm-bindgen test crate (#696) ### Platforms - Fuchsia: Replaced fuchsia-zircon with fuchsia-cprng diff -Nru cargo-0.35.0/vendor/rand/examples/monte-carlo.rs cargo-0.37.0/vendor/rand/examples/monte-carlo.rs --- cargo-0.35.0/vendor/rand/examples/monte-carlo.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/examples/monte-carlo.rs 2019-07-17 05:42:23.000000000 +0000 @@ -11,7 +11,7 @@ //! //! Imagine that we have a square with sides of length 2 and a unit circle //! (radius = 1), both centered at the origin. The areas are: -//! +//! //! ```text //! area of circle = πr² = π * r * r = π //! area of square = 2² = 4 @@ -24,28 +24,25 @@ //! the square at random, calculate the fraction that fall within the circle, //! and multiply this fraction by 4. -#![cfg(feature="std")] - - -extern crate rand; +#![cfg(feature = "std")] use rand::distributions::{Distribution, Uniform}; fn main() { - let range = Uniform::new(-1.0f64, 1.0); - let mut rng = rand::thread_rng(); + let range = Uniform::new(-1.0f64, 1.0); + let mut rng = rand::thread_rng(); - let total = 1_000_000; - let mut in_circle = 0; + let total = 1_000_000; + let mut in_circle = 0; - for _ in 0..total { - let a = range.sample(&mut rng); - let b = range.sample(&mut rng); - if a*a + b*b <= 1.0 { - in_circle += 1; - } - } + for _ in 0..total { + let a = range.sample(&mut rng); + let b = range.sample(&mut rng); + if a*a + b*b <= 1.0 { + in_circle += 1; + } + } - // prints something close to 3.14159... - println!("π is approximately {}", 4. * (in_circle as f64) / (total as f64)); + // prints something close to 3.14159... + println!("π is approximately {}", 4. * (in_circle as f64) / (total as f64)); } diff -Nru cargo-0.35.0/vendor/rand/examples/monty-hall.rs cargo-0.37.0/vendor/rand/examples/monty-hall.rs --- cargo-0.35.0/vendor/rand/examples/monty-hall.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/examples/monty-hall.rs 2019-07-17 05:42:23.000000000 +0000 @@ -26,13 +26,10 @@ //! //! [Monty Hall Problem]: https://en.wikipedia.org/wiki/Monty_Hall_problem -#![cfg(feature="std")] +#![cfg(feature = "std")] - -extern crate rand; - -use rand::Rng; use rand::distributions::{Distribution, Uniform}; +use rand::Rng; struct SimulationResult { win: bool, @@ -40,8 +37,7 @@ } // Run a single simulation of the Monty Hall problem. -fn simulate(random_door: &Uniform, rng: &mut R) - -> SimulationResult { +fn simulate(random_door: &Uniform, rng: &mut R) -> SimulationResult { let car = random_door.sample(rng); // This is our initial choice diff -Nru cargo-0.35.0/vendor/rand/README.md cargo-0.37.0/vendor/rand/README.md --- cargo-0.35.0/vendor/rand/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -6,7 +6,7 @@ [![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) [![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand) [![API](https://docs.rs/rand/badge.svg)](https://docs.rs/rand) -[![Minimum rustc version](https://img.shields.io/badge/rustc-1.22+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements) +[![Minimum rustc version](https://img.shields.io/badge/rustc-1.32+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements) A Rust library for random number generation. @@ -30,7 +30,7 @@ ```toml [dependencies] -rand = "0.6" +rand = "0.7" ``` To get started using Rand, see [The Book](https://rust-random.github.io/book). @@ -38,10 +38,22 @@ ## Versions +Rand libs have inter-dependencies and make use of the +[semver trick](https://github.com/dtolnay/semver-trick/) in order to make traits +compatible across crate versions. (This is especially important for `RngCore` +and `SeedableRng`.) A few crate releases are thus compatibility shims, +depending on the *next* lib version (e.g. `rand_core` versions `0.2.2` and +`0.3.1`). This means, for example, that `rand_core_0_4_0::SeedableRng` and +`rand_core_0_3_0::SeedableRng` are distinct, incompatible traits, which can +cause build errors. Usually, running `cargo update` is enough to fix any issues. + The Rand lib is not yet stable, however we are careful to limit breaking changes and warn via deprecation wherever possible. Patch versions never introduce breaking changes. The following minor versions are supported: +- Version 0.7 was released in June 2019, moving most non-uniform distributions + to an external crate, moving `from_entropy` to `SeedableRng`, and many small + changes and fixes. - Version 0.6 was released in November 2018, redesigning the `seq` module, moving most PRNGs to external crates, and many small changes. - Version 0.5 was released in May 2018, as a major reorganisation @@ -57,8 +69,9 @@ ### Rust version requirements -Since version 0.5, Rand requires **Rustc version 1.22 or greater**. -Rand 0.4 and 0.3 (since approx. June 2017) require Rustc version 1.15 or +Since version 0.7, Rand requires **Rustc version 1.32 or greater**. +Rand 0.5 requires Rustc 1.22 or greater while versions +0.4 and 0.3 (since approx. June 2017) require Rustc version 1.15 or greater. Subsets of the Rand code may work with older Rust versions, but this is not supported. @@ -74,44 +87,33 @@ ## Crate Features -Rand is built with the `std` and `rand_os` features enabled by default: - -- `std` enables functionality dependent on the `std` lib and implies `alloc` - and `rand_os` -- `rand_os` enables the `rand_os` crate, `rngs::OsRng` and enables its usage; - the continued existance of this feature is not guaranteed so users are - encouraged to specify `std` instead - -The following optional features are available: - -- `alloc` can be used instead of `std` to provide `Vec` and `Box`. -- `log` enables some logging via the `log` crate. -- `nightly` enables all unstable features (`simd_support`). -- `serde1` enables serialization for some types, via Serde version 1. -- `simd_support` enables uniform sampling of SIMD types (integers and floats). -- `stdweb` enables support for `OsRng` on `wasm32-unknown-unknown` via `stdweb` - combined with `cargo-web`. -- `wasm-bindgen` enables support for `OsRng` on `wasm32-unknown-unknown` via - [`wasm-bindgen`] - -[`wasm-bindgen`]: https://github.com/rustwasm/wasm-bindgen - -`no_std` mode is activated by setting `default-features = false`; this removes -functionality depending on `std`: - -- `thread_rng()`, and `random()` are not available, as they require thread-local - storage and an entropy source. -- `OsRng` and `EntropyRng` are unavailable. -- `JitterRng` code is still present, but a nanosecond timer must be provided via - `JitterRng::new_with_timer` -- Since no external entropy is available, it is not possible to create - generators with fresh seeds using the `FromEntropy` trait (user must provide - a seed). -- Several non-linear distributions distributions are unavailable since `exp` - and `log` functions are not provided in `core`. -- Large parts of the `seq`-uence module are unavailable, unless the `alloc` - feature is used (several APIs and many implementations require `Vec`). +Rand is built with these features enabled by default: +- `std` enables functionality dependent on the `std` lib +- `alloc` (implied by `std`) enables functionality requiring an allocator +- `getrandom` (implied by `std`) is an optional dependency providing the code + behind `rngs::OsRng` + +Optionally, the following dependencies can be enabled: + +- `log` enables logging via the `log` crate +- `stdweb` implies `getrandom/stdweb` to enable + `getrandom` support on `wasm32-unknown-unknown` +- `wasm-bindgen` implies `getrandom/wasm-bindgen` to enable + `getrandom` support on `wasm32-unknown-unknown` + +Additionally, these features configure Rand: + +- `small_rng` enables inclusion of the `SmallRng` PRNG +- `nightly` enables all experimental features +- `simd_support` (experimental) enables sampling of SIMD values + (uniformly random SIMD integers and floats) + +Rand supports limited functionality in `no_std` mode (enabled via +`default-features = false`). In this case, `OsRng` and `from_entropy` are +unavailable (unless `getrandom` is enabled), large parts of `seq` are +unavailable (unless `alloc` is enabled), and `thread_rng` and `random` are +unavailable. # License diff -Nru cargo-0.35.0/vendor/rand/rustfmt.toml cargo-0.37.0/vendor/rand/rustfmt.toml --- cargo-0.35.0/vendor/rand/rustfmt.toml 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand/rustfmt.toml 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,30 @@ +# This rustfmt file is added for configuration, but in practice much of our +# code is hand-formatted, frequently with more readable results. + +# Comments: +normalize_comments = true +wrap_comments = false +format_doc_comments = true +comment_width = 90 # small excess is okay but prefer 80 + +# Arguments: +use_small_heuristics = "max" +fn_args_density = "compressed" +fn_single_line = false +overflow_delimited_expr = true +where_single_line = true + +# enum_discrim_align_threshold = 20 +# struct_field_align_threshold = 20 + +# Compatibility: +edition = "2018" # we require compatibility back to 1.32.0 + +# Misc: +blank_lines_upper_bound = 2 +reorder_impl_items = true +# report_todo = "Unnumbered" +# report_fixme = "Unnumbered" + +# Ignored files: +ignore = [] diff -Nru cargo-0.35.0/vendor/rand/src/deprecated.rs cargo-0.37.0/vendor/rand/src/deprecated.rs --- cargo-0.35.0/vendor/rand/src/deprecated.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/deprecated.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,544 +0,0 @@ -// Copyright 2018 Developers of the Rand project. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Deprecated re-exports (we can't add deprecation warnings otherwise) - -#![allow(deprecated)] - -use rngs; -use {RngCore, CryptoRng, SeedableRng, Error}; -use rand_core::block::BlockRngCore; -use rand_isaac; -use rand_chacha; -use rand_hc; - -#[cfg(feature="std")] -use std::io::Read; - -#[derive(Clone, Debug)] -#[deprecated(since="0.6.0", - note="import from rand_isaac crate instead, or use the newer Hc128Rng")] -pub struct IsaacRng(rand_isaac::IsaacRng); - -impl RngCore for IsaacRng { - #[inline(always)] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - #[inline(always)] - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest); - } - - #[inline(always)] - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -impl SeedableRng for IsaacRng { - type Seed = ::Seed; - - fn from_seed(seed: Self::Seed) -> Self { - IsaacRng(rand_isaac::IsaacRng::from_seed(seed)) - } - - fn from_rng(rng: R) -> Result { - rand_isaac::IsaacRng::from_rng(rng).map(IsaacRng) - } -} - -impl IsaacRng { - pub fn new_from_u64(seed: u64) -> Self { - IsaacRng(rand_isaac::IsaacRng::new_from_u64(seed)) - } -} - - -#[derive(Clone, Debug)] -#[deprecated(since="0.6.0", - note="import from rand_isaac crate instead, or use newer Hc128Rng")] -pub struct Isaac64Rng(rand_isaac::Isaac64Rng); - -impl RngCore for Isaac64Rng { - #[inline(always)] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - #[inline(always)] - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest); - } - - #[inline(always)] - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -impl SeedableRng for Isaac64Rng { - type Seed = ::Seed; - - fn from_seed(seed: Self::Seed) -> Self { - Isaac64Rng(rand_isaac::Isaac64Rng::from_seed(seed)) - } - - fn from_rng(rng: R) -> Result { - rand_isaac::Isaac64Rng::from_rng(rng).map(Isaac64Rng) - } -} - -impl Isaac64Rng { - pub fn new_from_u64(seed: u64) -> Self { - Isaac64Rng(rand_isaac::Isaac64Rng::new_from_u64(seed)) - } -} - - -#[derive(Clone, Debug)] -#[deprecated(since="0.6.0", note="import from rand_chacha crate instead")] -pub struct ChaChaRng(rand_chacha::ChaChaRng); - -impl RngCore for ChaChaRng { - #[inline(always)] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - #[inline(always)] - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest); - } - - #[inline(always)] - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -impl SeedableRng for ChaChaRng { - type Seed = ::Seed; - - fn from_seed(seed: Self::Seed) -> Self { - ChaChaRng(rand_chacha::ChaChaRng::from_seed(seed)) - } - - fn from_rng(rng: R) -> Result { - rand_chacha::ChaChaRng::from_rng(rng).map(ChaChaRng) - } -} - -impl ChaChaRng { - #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] - pub fn get_word_pos(&self) -> u128 { - self.0.get_word_pos() - } - - #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] - pub fn set_word_pos(&mut self, word_offset: u128) { - self.0.set_word_pos(word_offset) - } - - pub fn set_stream(&mut self, stream: u64) { - self.0.set_stream(stream) - } -} - -impl CryptoRng for ChaChaRng {} - - -#[derive(Clone, Debug)] -#[deprecated(since="0.6.0", note="import from rand_hc crate instead")] -pub struct Hc128Rng(rand_hc::Hc128Rng); - -impl RngCore for Hc128Rng { - #[inline(always)] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - #[inline(always)] - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest); - } - - #[inline(always)] - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -impl SeedableRng for Hc128Rng { - type Seed = ::Seed; - - fn from_seed(seed: Self::Seed) -> Self { - Hc128Rng(rand_hc::Hc128Rng::from_seed(seed)) - } - - fn from_rng(rng: R) -> Result { - rand_hc::Hc128Rng::from_rng(rng).map(Hc128Rng) - } -} - -impl CryptoRng for Hc128Rng {} - - -#[derive(Clone, Debug)] -#[deprecated(since="0.6.0", note="import from rand_xorshift crate instead")] -pub struct XorShiftRng(::rand_xorshift::XorShiftRng); - -impl RngCore for XorShiftRng { - #[inline(always)] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - #[inline(always)] - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest); - } - - #[inline(always)] - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -impl SeedableRng for XorShiftRng { - type Seed = <::rand_xorshift::XorShiftRng as SeedableRng>::Seed; - - fn from_seed(seed: Self::Seed) -> Self { - XorShiftRng(::rand_xorshift::XorShiftRng::from_seed(seed)) - } - - fn from_rng(rng: R) -> Result { - ::rand_xorshift::XorShiftRng::from_rng(rng).map(XorShiftRng) - } -} - - -#[derive(Clone, Debug)] -#[deprecated(since="0.6.0", - note="import with rand::prelude::* or rand::rngs::StdRng instead")] -pub struct StdRng(rngs::StdRng); - -impl RngCore for StdRng { - #[inline(always)] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - #[inline(always)] - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest); - } - - #[inline(always)] - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -impl SeedableRng for StdRng { - type Seed = ::Seed; - - fn from_seed(seed: Self::Seed) -> Self { - StdRng(rngs::StdRng::from_seed(seed)) - } - - fn from_rng(rng: R) -> Result { - rngs::StdRng::from_rng(rng).map(StdRng) - } -} - -impl CryptoRng for StdRng {} - - -#[cfg(feature="rand_os")] -#[derive(Clone, Debug)] -#[deprecated(since="0.6.0", note="import with rand::rngs::OsRng instead")] -pub struct OsRng(rngs::OsRng); - -#[cfg(feature="rand_os")] -impl RngCore for OsRng { - #[inline(always)] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - #[inline(always)] - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest); - } - - #[inline(always)] - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -#[cfg(feature="rand_os")] -impl OsRng { - pub fn new() -> Result { - rngs::OsRng::new().map(OsRng) - } -} - -#[cfg(feature="rand_os")] -impl CryptoRng for OsRng {} - - -#[cfg(feature="std")] -#[derive(Debug)] -#[deprecated(since="0.6.0", note="import with rand::rngs::EntropyRng instead")] -pub struct EntropyRng(rngs::EntropyRng); - -#[cfg(feature="std")] -impl RngCore for EntropyRng { - #[inline(always)] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - #[inline(always)] - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest); - } - - #[inline(always)] - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -#[cfg(feature="std")] -impl EntropyRng { - pub fn new() -> Self { - EntropyRng(rngs::EntropyRng::new()) - } -} - -#[cfg(feature="std")] -impl Default for EntropyRng { - fn default() -> Self { - EntropyRng::new() - } -} - -#[cfg(feature="std")] -impl CryptoRng for EntropyRng {} - - -#[derive(Clone, Debug)] -#[deprecated(since="0.6.0", note="import with rand::rngs::JitterRng instead")] -pub struct JitterRng(rngs::JitterRng); - -impl RngCore for JitterRng { - #[inline(always)] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - #[inline(always)] - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest); - } - - #[inline(always)] - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -impl JitterRng { - #[cfg(all(feature="std", not(target_arch = "wasm32")))] - pub fn new() -> Result { - rngs::JitterRng::new().map(JitterRng) - } - - pub fn new_with_timer(timer: fn() -> u64) -> JitterRng { - JitterRng(rngs::JitterRng::new_with_timer(timer)) - } - - pub fn set_rounds(&mut self, rounds: u8) { - self.0.set_rounds(rounds) - } - - pub fn test_timer(&mut self) -> Result { - self.0.test_timer() - } - - #[cfg(feature="std")] - pub fn timer_stats(&mut self, var_rounds: bool) -> i64 { - self.0.timer_stats(var_rounds) - } -} - -impl CryptoRng for JitterRng {} - - -#[cfg(feature="std")] -#[derive(Clone, Debug)] -#[deprecated(since="0.6.0", - note="import with rand::prelude::* or rand::rngs::ThreadRng instead")] -pub struct ThreadRng(rngs::ThreadRng); - -#[cfg(feature="std")] -impl RngCore for ThreadRng { - #[inline(always)] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - #[inline(always)] - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest); - } - - #[inline(always)] - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -#[cfg(feature="std")] -impl CryptoRng for ThreadRng {} - - -#[cfg(feature="std")] -#[derive(Debug)] -#[deprecated(since="0.6.0", note="import with rand::rngs::adapter::ReadRng instead")] -pub struct ReadRng(rngs::adapter::ReadRng); - -#[cfg(feature="std")] -impl RngCore for ReadRng { - #[inline(always)] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - #[inline(always)] - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest); - } - - #[inline(always)] - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -#[cfg(feature="std")] -impl ReadRng { - pub fn new(r: R) -> ReadRng { - ReadRng(rngs::adapter::ReadRng::new(r)) - } -} - - -#[derive(Clone, Debug)] -pub struct ReseedingRng(rngs::adapter::ReseedingRng) -where R: BlockRngCore + SeedableRng, - Rsdr: RngCore; - -impl RngCore for ReseedingRng -where R: BlockRngCore + SeedableRng, - ::Results: AsRef<[u32]> + AsMut<[u32]> -{ - #[inline(always)] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest) - } - - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -impl ReseedingRng -where R: BlockRngCore + SeedableRng, - Rsdr: RngCore -{ - pub fn new(rng: R, threshold: u64, reseeder: Rsdr) -> Self { - ReseedingRng(rngs::adapter::ReseedingRng::new(rng, threshold, reseeder)) - } - - pub fn reseed(&mut self) -> Result<(), Error> { - self.0.reseed() - } -} - -impl CryptoRng for ReseedingRng -where R: BlockRngCore + SeedableRng + CryptoRng, - Rsdr: RngCore + CryptoRng {} diff -Nru cargo-0.35.0/vendor/rand/src/distributions/bernoulli.rs cargo-0.37.0/vendor/rand/src/distributions/bernoulli.rs --- cargo-0.35.0/vendor/rand/src/distributions/bernoulli.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/bernoulli.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,8 +8,8 @@ //! The Bernoulli distribution. -use Rng; -use distributions::Distribution; +use crate::Rng; +use crate::distributions::Distribution; /// The Bernoulli distribution. /// @@ -20,7 +20,7 @@ /// ```rust /// use rand::distributions::{Bernoulli, Distribution}; /// -/// let d = Bernoulli::new(0.3); +/// let d = Bernoulli::new(0.3).unwrap(); /// let v = d.sample(&mut rand::thread_rng()); /// println!("{} is from a Bernoulli distribution", v); /// ``` @@ -61,13 +61,16 @@ // in `no_std` mode. const SCALE: f64 = 2.0 * (1u64 << 63) as f64; +/// Error type returned from `Bernoulli::new`. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum BernoulliError { + /// `p < 0` or `p > 1`. + InvalidProbability, +} + impl Bernoulli { /// Construct a new `Bernoulli` with the given probability of success `p`. /// - /// # Panics - /// - /// If `p < 0` or `p > 1`. - /// /// # Precision /// /// For `p = 1.0`, the resulting distribution will always generate true. @@ -77,12 +80,12 @@ /// a multiple of 2-64. (Note that not all multiples of /// 2-64 in `[0, 1]` can be represented as a `f64`.) #[inline] - pub fn new(p: f64) -> Bernoulli { + pub fn new(p: f64) -> Result { if p < 0.0 || p >= 1.0 { - if p == 1.0 { return Bernoulli { p_int: ALWAYS_TRUE } } - panic!("Bernoulli::new not called with 0.0 <= p <= 1.0"); + if p == 1.0 { return Ok(Bernoulli { p_int: ALWAYS_TRUE }) } + return Err(BernoulliError::InvalidProbability); } - Bernoulli { p_int: (p * SCALE) as u64 } + Ok(Bernoulli { p_int: (p * SCALE) as u64 }) } /// Construct a new `Bernoulli` with the probability of success of @@ -91,19 +94,16 @@ /// /// If `numerator == denominator` then the returned `Bernoulli` will always /// return `true`. If `numerator == 0` it will always return `false`. - /// - /// # Panics - /// - /// If `denominator == 0` or `numerator > denominator`. - /// #[inline] - pub fn from_ratio(numerator: u32, denominator: u32) -> Bernoulli { - assert!(numerator <= denominator); + pub fn from_ratio(numerator: u32, denominator: u32) -> Result { + if !(numerator <= denominator) { + return Err(BernoulliError::InvalidProbability); + } if numerator == denominator { - return Bernoulli { p_int: ::core::u64::MAX } + return Ok(Bernoulli { p_int: ALWAYS_TRUE }) } let p_int = ((numerator as f64 / denominator as f64) * SCALE) as u64; - Bernoulli { p_int } + Ok(Bernoulli { p_int }) } } @@ -119,15 +119,15 @@ #[cfg(test)] mod test { - use Rng; - use distributions::Distribution; + use crate::Rng; + use crate::distributions::Distribution; use super::Bernoulli; #[test] fn test_trivial() { - let mut r = ::test::rng(1); - let always_false = Bernoulli::new(0.0); - let always_true = Bernoulli::new(1.0); + let mut r = crate::test::rng(1); + let always_false = Bernoulli::new(0.0).unwrap(); + let always_true = Bernoulli::new(1.0).unwrap(); for _ in 0..5 { assert_eq!(r.sample::(&always_false), false); assert_eq!(r.sample::(&always_true), true); @@ -137,17 +137,18 @@ } #[test] + #[cfg(not(miri))] // Miri is too slow fn test_average() { const P: f64 = 0.3; const NUM: u32 = 3; const DENOM: u32 = 10; - let d1 = Bernoulli::new(P); - let d2 = Bernoulli::from_ratio(NUM, DENOM); + let d1 = Bernoulli::new(P).unwrap(); + let d2 = Bernoulli::from_ratio(NUM, DENOM).unwrap(); const N: u32 = 100_000; let mut sum1: u32 = 0; let mut sum2: u32 = 0; - let mut rng = ::test::rng(2); + let mut rng = crate::test::rng(2); for _ in 0..N { if d1.sample(&mut rng) { sum1 += 1; diff -Nru cargo-0.35.0/vendor/rand/src/distributions/binomial.rs cargo-0.37.0/vendor/rand/src/distributions/binomial.rs --- cargo-0.35.0/vendor/rand/src/distributions/binomial.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/binomial.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,25 +8,16 @@ // except according to those terms. //! The binomial distribution. +#![allow(deprecated)] -use Rng; -use distributions::{Distribution, Bernoulli, Cauchy}; -use distributions::utils::log_gamma; +use crate::Rng; +use crate::distributions::{Distribution, Uniform}; /// The binomial distribution `Binomial(n, p)`. /// /// This distribution has density function: /// `f(k) = n!/(k! (n-k)!) p^k (1-p)^(n-k)` for `k >= 0`. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{Binomial, Distribution}; -/// -/// let bin = Binomial::new(20, 0.3); -/// let v = bin.sample(&mut rand::thread_rng()); -/// println!("{} is from a binomial distribution", v); -/// ``` +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Copy, Debug)] pub struct Binomial { /// Number of trials. @@ -47,6 +38,13 @@ } } +/// Convert a `f64` to an `i64`, panicing on overflow. +// In the future (Rust 1.34), this might be replaced with `TryFrom`. +fn f64_to_i64(x: f64) -> i64 { + assert!(x < (::std::i64::MAX as f64)); + x as i64 +} + impl Distribution for Binomial { fn sample(&self, rng: &mut R) -> u64 { // Handle these values directly. @@ -55,83 +53,217 @@ } else if self.p == 1.0 { return self.n; } - - // For low n, it is faster to sample directly. For both methods, - // performance is independent of p. On Intel Haswell CPU this method - // appears to be faster for approx n < 300. - if self.n < 300 { - let mut result = 0; - let d = Bernoulli::new(self.p); - for _ in 0 .. self.n { - result += rng.sample(d) as u32; - } - return result as u64; - } - - // binomial distribution is symmetrical with respect to p -> 1-p, k -> n-k - // switch p so that it is less than 0.5 - this allows for lower expected values - // we will just invert the result at the end + + // The binomial distribution is symmetrical with respect to p -> 1-p, + // k -> n-k switch p so that it is less than 0.5 - this allows for lower + // expected values we will just invert the result at the end let p = if self.p <= 0.5 { self.p } else { 1.0 - self.p }; - // prepare some cached values - let float_n = self.n as f64; - let ln_fact_n = log_gamma(float_n + 1.0); - let pc = 1.0 - p; - let log_p = p.ln(); - let log_pc = pc.ln(); - let expected = self.n as f64 * p; - let sq = (expected * (2.0 * pc)).sqrt(); - - let mut lresult; - - // we use the Cauchy distribution as the comparison distribution - // f(x) ~ 1/(1+x^2) - let cauchy = Cauchy::new(0.0, 1.0); - loop { - let mut comp_dev: f64; + let result; + let q = 1. - p; + + // For small n * min(p, 1 - p), the BINV algorithm based on the inverse + // transformation of the binomial distribution is efficient. Otherwise, + // the BTPE algorithm is used. + // + // Voratas Kachitvichyanukul and Bruce W. Schmeiser. 1988. Binomial + // random variate generation. Commun. ACM 31, 2 (February 1988), + // 216-222. http://dx.doi.org/10.1145/42372.42381 + + // Threshold for prefering the BINV algorithm. The paper suggests 10, + // Ranlib uses 30, and GSL uses 14. + const BINV_THRESHOLD: f64 = 10.; + + if (self.n as f64) * p < BINV_THRESHOLD && + self.n <= (::std::i32::MAX as u64) { + // Use the BINV algorithm. + let s = p / q; + let a = ((self.n + 1) as f64) * s; + let mut r = q.powi(self.n as i32); + let mut u: f64 = rng.gen(); + let mut x = 0; + while u > r as f64 { + u -= r; + x += 1; + r *= a / (x as f64) - s; + } + result = x; + } else { + // Use the BTPE algorithm. + + // Threshold for using the squeeze algorithm. This can be freely + // chosen based on performance. Ranlib and GSL use 20. + const SQUEEZE_THRESHOLD: i64 = 20; + + // Step 0: Calculate constants as functions of `n` and `p`. + let n = self.n as f64; + let np = n * p; + let npq = np * q; + let f_m = np + p; + let m = f64_to_i64(f_m); + // radius of triangle region, since height=1 also area of region + let p1 = (2.195 * npq.sqrt() - 4.6 * q).floor() + 0.5; + // tip of triangle + let x_m = (m as f64) + 0.5; + // left edge of triangle + let x_l = x_m - p1; + // right edge of triangle + let x_r = x_m + p1; + let c = 0.134 + 20.5 / (15.3 + (m as f64)); + // p1 + area of parallelogram region + let p2 = p1 * (1. + 2. * c); + + fn lambda(a: f64) -> f64 { + a * (1. + 0.5 * a) + } + + let lambda_l = lambda((f_m - x_l) / (f_m - x_l * p)); + let lambda_r = lambda((x_r - f_m) / (x_r * q)); + // p1 + area of left tail + let p3 = p2 + c / lambda_l; + // p1 + area of right tail + let p4 = p3 + c / lambda_r; + + // return value + let mut y: i64; + + let gen_u = Uniform::new(0., p4); + let gen_v = Uniform::new(0., 1.); + loop { - // draw from the Cauchy distribution - comp_dev = rng.sample(cauchy); - // shift the peak of the comparison ditribution - lresult = expected + sq * comp_dev; - // repeat the drawing until we are in the range of possible values - if lresult >= 0.0 && lresult < float_n + 1.0 { + // Step 1: Generate `u` for selecting the region. If region 1 is + // selected, generate a triangularly distributed variate. + let u = gen_u.sample(rng); + let mut v = gen_v.sample(rng); + if !(u > p1) { + y = f64_to_i64(x_m - p1 * v + u); break; } - } - // the result should be discrete - lresult = lresult.floor(); + if !(u > p2) { + // Step 2: Region 2, parallelograms. Check if region 2 is + // used. If so, generate `y`. + let x = x_l + (u - p1) / c; + v = v * c + 1.0 - (x - x_m).abs() / p1; + if v > 1. { + continue; + } else { + y = f64_to_i64(x); + } + } else if !(u > p3) { + // Step 3: Region 3, left exponential tail. + y = f64_to_i64(x_l + v.ln() / lambda_l); + if y < 0 { + continue; + } else { + v *= (u - p2) * lambda_l; + } + } else { + // Step 4: Region 4, right exponential tail. + y = f64_to_i64(x_r - v.ln() / lambda_r); + if y > 0 && (y as u64) > self.n { + continue; + } else { + v *= (u - p3) * lambda_r; + } + } + + // Step 5: Acceptance/rejection comparison. + + // Step 5.0: Test for appropriate method of evaluating f(y). + let k = (y - m).abs(); + if !(k > SQUEEZE_THRESHOLD && (k as f64) < 0.5 * npq - 1.) { + // Step 5.1: Evaluate f(y) via the recursive relationship. Start the + // search from the mode. + let s = p / q; + let a = s * (n + 1.); + let mut f = 1.0; + if m < y { + let mut i = m; + loop { + i += 1; + f *= a / (i as f64) - s; + if i == y { + break; + } + } + } else if m > y { + let mut i = y; + loop { + i += 1; + f /= a / (i as f64) - s; + if i == m { + break; + } + } + } + if v > f { + continue; + } else { + break; + } + } - let log_binomial_dist = ln_fact_n - log_gamma(lresult+1.0) - - log_gamma(float_n - lresult + 1.0) + lresult*log_p + (float_n - lresult)*log_pc; - // this is the binomial probability divided by the comparison probability - // we will generate a uniform random value and if it is larger than this, - // we interpret it as a value falling out of the distribution and repeat - let comparison_coeff = (log_binomial_dist.exp() * sq) * (1.2 * (1.0 + comp_dev*comp_dev)); + // Step 5.2: Squeezing. Check the value of ln(v) againts upper and + // lower bound of ln(f(y)). + let k = k as f64; + let rho = (k / npq) * ((k * (k / 3. + 0.625) + 1./6.) / npq + 0.5); + let t = -0.5 * k*k / npq; + let alpha = v.ln(); + if alpha < t - rho { + break; + } + if alpha > t + rho { + continue; + } + + // Step 5.3: Final acceptance/rejection test. + let x1 = (y + 1) as f64; + let f1 = (m + 1) as f64; + let z = (f64_to_i64(n) + 1 - m) as f64; + let w = (f64_to_i64(n) - y + 1) as f64; + + fn stirling(a: f64) -> f64 { + let a2 = a * a; + (13860. - (462. - (132. - (99. - 140. / a2) / a2) / a2) / a2) / a / 166320. + } + + if alpha > x_m * (f1 / x1).ln() + + (n - (m as f64) + 0.5) * (z / w).ln() + + ((y - m) as f64) * (w * p / (x1 * q)).ln() + // We use the signs from the GSL implementation, which are + // different than the ones in the reference. According to + // the GSL authors, the new signs were verified to be + // correct by one of the original designers of the + // algorithm. + + stirling(f1) + stirling(z) - stirling(x1) - stirling(w) + { + continue; + } - if comparison_coeff >= rng.gen() { break; } + assert!(y >= 0); + result = y as u64; } - // invert the result for p < 0.5 + // Invert the result for p < 0.5. if p != self.p { - self.n - lresult as u64 + self.n - result } else { - lresult as u64 + result } } } #[cfg(test)] mod test { - use Rng; - use distributions::Distribution; + use crate::Rng; + use crate::distributions::Distribution; use super::Binomial; fn test_binomial_mean_and_variance(n: u64, p: f64, rng: &mut R) { @@ -144,17 +276,20 @@ for i in results.iter_mut() { *i = binomial.sample(rng) as f64; } let mean = results.iter().sum::() / results.len() as f64; - assert!((mean as f64 - expected_mean).abs() < expected_mean / 50.0); + assert!((mean as f64 - expected_mean).abs() < expected_mean / 50.0, + "mean: {}, expected_mean: {}", mean, expected_mean); let variance = results.iter().map(|x| (x - mean) * (x - mean)).sum::() / results.len() as f64; - assert!((variance - expected_variance).abs() < expected_variance / 10.0); + assert!((variance - expected_variance).abs() < expected_variance / 10.0, + "variance: {}, expected_variance: {}", variance, expected_variance); } #[test] + #[cfg(not(miri))] // Miri is too slow fn test_binomial() { - let mut rng = ::test::rng(351); + let mut rng = crate::test::rng(351); test_binomial_mean_and_variance(150, 0.1, &mut rng); test_binomial_mean_and_variance(70, 0.6, &mut rng); test_binomial_mean_and_variance(40, 0.5, &mut rng); @@ -164,7 +299,7 @@ #[test] fn test_binomial_end_points() { - let mut rng = ::test::rng(352); + let mut rng = crate::test::rng(352); assert_eq!(rng.sample(Binomial::new(20, 0.0)), 0); assert_eq!(rng.sample(Binomial::new(20, 1.0)), 20); } diff -Nru cargo-0.35.0/vendor/rand/src/distributions/cauchy.rs cargo-0.37.0/vendor/rand/src/distributions/cauchy.rs --- cargo-0.35.0/vendor/rand/src/distributions/cauchy.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/cauchy.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,25 +8,17 @@ // except according to those terms. //! The Cauchy distribution. +#![allow(deprecated)] -use Rng; -use distributions::Distribution; +use crate::Rng; +use crate::distributions::Distribution; use std::f64::consts::PI; /// The Cauchy distribution `Cauchy(median, scale)`. /// /// This distribution has a density function: /// `f(x) = 1 / (pi * scale * (1 + ((x - median) / scale)^2))` -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{Cauchy, Distribution}; -/// -/// let cau = Cauchy::new(2.0, 5.0); -/// let v = cau.sample(&mut rand::thread_rng()); -/// println!("{} is from a Cauchy(2, 5) distribution", v); -/// ``` +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Copy, Debug)] pub struct Cauchy { median: f64, @@ -61,7 +53,7 @@ #[cfg(test)] mod test { - use distributions::Distribution; + use crate::distributions::Distribution; use super::Cauchy; fn median(mut numbers: &mut [f64]) -> f64 { @@ -75,30 +67,25 @@ } #[test] - fn test_cauchy_median() { + #[cfg(not(miri))] // Miri doesn't support transcendental functions + fn test_cauchy_averages() { + // NOTE: given that the variance and mean are undefined, + // this test does not have any rigorous statistical meaning. let cauchy = Cauchy::new(10.0, 5.0); - let mut rng = ::test::rng(123); + let mut rng = crate::test::rng(123); let mut numbers: [f64; 1000] = [0.0; 1000]; + let mut sum = 0.0; for i in 0..1000 { numbers[i] = cauchy.sample(&mut rng); + sum += numbers[i]; } let median = median(&mut numbers); println!("Cauchy median: {}", median); - assert!((median - 10.0).abs() < 0.5); // not 100% certain, but probable enough - } - - #[test] - fn test_cauchy_mean() { - let cauchy = Cauchy::new(10.0, 5.0); - let mut rng = ::test::rng(123); - let mut sum = 0.0; - for _ in 0..1000 { - sum += cauchy.sample(&mut rng); - } + assert!((median - 10.0).abs() < 0.4); // not 100% certain, but probable enough let mean = sum / 1000.0; println!("Cauchy mean: {}", mean); // for a Cauchy distribution the mean should not converge - assert!((mean - 10.0).abs() > 0.5); // not 100% certain, but probable enough + assert!((mean - 10.0).abs() > 0.4); // not 100% certain, but probable enough } #[test] diff -Nru cargo-0.35.0/vendor/rand/src/distributions/dirichlet.rs cargo-0.37.0/vendor/rand/src/distributions/dirichlet.rs --- cargo-0.35.0/vendor/rand/src/distributions/dirichlet.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/dirichlet.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,28 +8,18 @@ // except according to those terms. //! The dirichlet distribution. +#![allow(deprecated)] -use Rng; -use distributions::Distribution; -use distributions::gamma::Gamma; +use crate::Rng; +use crate::distributions::Distribution; +use crate::distributions::gamma::Gamma; /// The dirichelet distribution `Dirichlet(alpha)`. /// /// The Dirichlet distribution is a family of continuous multivariate /// probability distributions parameterized by a vector alpha of positive reals. /// It is a multivariate generalization of the beta distribution. -/// -/// # Example -/// -/// ``` -/// use rand::prelude::*; -/// use rand::distributions::Dirichlet; -/// -/// let dirichlet = Dirichlet::new(vec![1.0, 2.0, 3.0]); -/// let samples = dirichlet.sample(&mut rand::thread_rng()); -/// println!("{:?} is from a Dirichlet([1.0, 2.0, 3.0]) distribution", samples); -/// ``` - +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Debug)] pub struct Dirichlet { /// Concentration parameters (alpha) @@ -91,12 +81,12 @@ #[cfg(test)] mod test { use super::Dirichlet; - use distributions::Distribution; + use crate::distributions::Distribution; #[test] fn test_dirichlet() { let d = Dirichlet::new(vec![1.0, 2.0, 3.0]); - let mut rng = ::test::rng(221); + let mut rng = crate::test::rng(221); let samples = d.sample(&mut rng); let _: Vec = samples .into_iter() @@ -112,7 +102,7 @@ let alpha = 0.5f64; let size = 2; let d = Dirichlet::new_with_param(alpha, size); - let mut rng = ::test::rng(221); + let mut rng = crate::test::rng(221); let samples = d.sample(&mut rng); let _: Vec = samples .into_iter() diff -Nru cargo-0.35.0/vendor/rand/src/distributions/exponential.rs cargo-0.37.0/vendor/rand/src/distributions/exponential.rs --- cargo-0.35.0/vendor/rand/src/distributions/exponential.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/exponential.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,10 +8,11 @@ // except according to those terms. //! The exponential distribution. +#![allow(deprecated)] -use {Rng}; -use distributions::{ziggurat_tables, Distribution}; -use distributions::utils::ziggurat; +use crate::{Rng}; +use crate::distributions::{ziggurat_tables, Distribution}; +use crate::distributions::utils::ziggurat; /// Samples floating-point numbers according to the exponential distribution, /// with rate parameter `λ = 1`. This is equivalent to `Exp::new(1.0)` or @@ -27,15 +28,7 @@ /// Generate Normal Random Samples*]( /// https://www.doornik.com/research/ziggurat.pdf). /// Nuffield College, Oxford -/// -/// # Example -/// ``` -/// use rand::prelude::*; -/// use rand::distributions::Exp1; -/// -/// let val: f64 = SmallRng::from_entropy().sample(Exp1); -/// println!("{}", val); -/// ``` +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Copy, Debug)] pub struct Exp1; @@ -65,16 +58,7 @@ /// for `x > 0`. /// /// Note that [`Exp1`][crate::distributions::Exp1] is an optimised implementation for `lambda = 1`. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{Exp, Distribution}; -/// -/// let exp = Exp::new(2.0); -/// let v = exp.sample(&mut rand::thread_rng()); -/// println!("{} is from a Exp(2) distribution", v); -/// ``` +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Copy, Debug)] pub struct Exp { /// `lambda` stored as `1/lambda`, since this is what we scale by. @@ -100,13 +84,13 @@ #[cfg(test)] mod test { - use distributions::Distribution; + use crate::distributions::Distribution; use super::Exp; #[test] fn test_exp() { let exp = Exp::new(10.0); - let mut rng = ::test::rng(221); + let mut rng = crate::test::rng(221); for _ in 0..1000 { assert!(exp.sample(&mut rng) >= 0.0); } diff -Nru cargo-0.35.0/vendor/rand/src/distributions/float.rs cargo-0.37.0/vendor/rand/src/distributions/float.rs --- cargo-0.35.0/vendor/rand/src/distributions/float.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/float.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,9 +9,9 @@ //! Basic floating-point number distributions use core::mem; -use Rng; -use distributions::{Distribution, Standard}; -use distributions::utils::FloatSIMDUtils; +use crate::Rng; +use crate::distributions::{Distribution, Standard}; +use crate::distributions::utils::FloatSIMDUtils; #[cfg(feature="simd_support")] use packed_simd::*; @@ -69,7 +69,9 @@ pub struct Open01; -pub(crate) trait IntoFloat { +// This trait is needed by both this lib and rand_distr hence is a hidden export +#[doc(hidden)] +pub trait IntoFloat { type F; /// Helper method to combine the fraction and a contant exponent into a @@ -168,9 +170,9 @@ #[cfg(test)] mod tests { - use Rng; - use distributions::{Open01, OpenClosed01}; - use rngs::mock::StepRng; + use crate::Rng; + use crate::distributions::{Open01, OpenClosed01}; + use crate::rngs::mock::StepRng; #[cfg(feature="simd_support")] use packed_simd::*; diff -Nru cargo-0.35.0/vendor/rand/src/distributions/gamma.rs cargo-0.37.0/vendor/rand/src/distributions/gamma.rs --- cargo-0.35.0/vendor/rand/src/distributions/gamma.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/gamma.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,13 +8,14 @@ // except according to those terms. //! The Gamma and derived distributions. +#![allow(deprecated)] use self::GammaRepr::*; use self::ChiSquaredRepr::*; -use Rng; -use distributions::normal::StandardNormal; -use distributions::{Distribution, Exp, Open01}; +use crate::Rng; +use crate::distributions::normal::StandardNormal; +use crate::distributions::{Distribution, Exp, Open01}; /// The Gamma distribution `Gamma(shape, scale)` distribution. /// @@ -32,20 +33,11 @@ /// == 1`, and using the boosting technique described in that paper for /// `shape < 1`. /// -/// # Example -/// -/// ``` -/// use rand::distributions::{Distribution, Gamma}; -/// -/// let gamma = Gamma::new(2.0, 5.0); -/// let v = gamma.sample(&mut rand::thread_rng()); -/// println!("{} is from a Gamma(2, 5) distribution", v); -/// ``` -/// /// [^1]: George Marsaglia and Wai Wan Tsang. 2000. "A Simple Method for /// Generating Gamma Variables" *ACM Trans. Math. Softw.* 26, 3 /// (September 2000), 363-372. /// DOI:[10.1145/358407.358414](https://doi.acm.org/10.1145/358407.358414) +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Copy, Debug)] pub struct Gamma { repr: GammaRepr, @@ -174,16 +166,7 @@ /// of `k` independent standard normal random variables. For other /// `k`, this uses the equivalent characterisation /// `χ²(k) = Gamma(k/2, 2)`. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{ChiSquared, Distribution}; -/// -/// let chi = ChiSquared::new(11.0); -/// let v = chi.sample(&mut rand::thread_rng()); -/// println!("{} is from a χ²(11) distribution", v) -/// ``` +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Copy, Debug)] pub struct ChiSquared { repr: ChiSquaredRepr, @@ -229,16 +212,7 @@ /// This distribution is equivalent to the ratio of two normalised /// chi-squared distributions, that is, `F(m,n) = (χ²(m)/m) / /// (χ²(n)/n)`. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{FisherF, Distribution}; -/// -/// let f = FisherF::new(2.0, 32.0); -/// let v = f.sample(&mut rand::thread_rng()); -/// println!("{} is from an F(2, 32) distribution", v) -/// ``` +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Copy, Debug)] pub struct FisherF { numer: ChiSquared, @@ -270,16 +244,7 @@ /// The Student t distribution, `t(nu)`, where `nu` is the degrees of /// freedom. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{StudentT, Distribution}; -/// -/// let t = StudentT::new(11.0); -/// let v = t.sample(&mut rand::thread_rng()); -/// println!("{} is from a t(11) distribution", v) -/// ``` +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Copy, Debug)] pub struct StudentT { chi: ChiSquared, @@ -305,16 +270,7 @@ } /// The Beta distribution with shape parameters `alpha` and `beta`. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{Distribution, Beta}; -/// -/// let beta = Beta::new(2.0, 5.0); -/// let v = beta.sample(&mut rand::thread_rng()); -/// println!("{} is from a Beta(2, 5) distribution", v); -/// ``` +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Copy, Debug)] pub struct Beta { gamma_a: Gamma, @@ -345,30 +301,32 @@ #[cfg(test)] mod test { - use distributions::Distribution; + use crate::distributions::Distribution; use super::{Beta, ChiSquared, StudentT, FisherF}; + const N: u32 = 100; + #[test] fn test_chi_squared_one() { let chi = ChiSquared::new(1.0); - let mut rng = ::test::rng(201); - for _ in 0..1000 { + let mut rng = crate::test::rng(201); + for _ in 0..N { chi.sample(&mut rng); } } #[test] fn test_chi_squared_small() { let chi = ChiSquared::new(0.5); - let mut rng = ::test::rng(202); - for _ in 0..1000 { + let mut rng = crate::test::rng(202); + for _ in 0..N { chi.sample(&mut rng); } } #[test] fn test_chi_squared_large() { let chi = ChiSquared::new(30.0); - let mut rng = ::test::rng(203); - for _ in 0..1000 { + let mut rng = crate::test::rng(203); + for _ in 0..N { chi.sample(&mut rng); } } @@ -381,8 +339,8 @@ #[test] fn test_f() { let f = FisherF::new(2.0, 32.0); - let mut rng = ::test::rng(204); - for _ in 0..1000 { + let mut rng = crate::test::rng(204); + for _ in 0..N { f.sample(&mut rng); } } @@ -390,8 +348,8 @@ #[test] fn test_t() { let t = StudentT::new(11.0); - let mut rng = ::test::rng(205); - for _ in 0..1000 { + let mut rng = crate::test::rng(205); + for _ in 0..N { t.sample(&mut rng); } } @@ -399,8 +357,8 @@ #[test] fn test_beta() { let beta = Beta::new(1.0, 2.0); - let mut rng = ::test::rng(201); - for _ in 0..1000 { + let mut rng = crate::test::rng(201); + for _ in 0..N { beta.sample(&mut rng); } } diff -Nru cargo-0.35.0/vendor/rand/src/distributions/integer.rs cargo-0.37.0/vendor/rand/src/distributions/integer.rs --- cargo-0.35.0/vendor/rand/src/distributions/integer.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/integer.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,8 +8,10 @@ //! The implementations of the `Standard` distribution for integer types. -use {Rng}; -use distributions::{Distribution, Standard}; +use crate::{Rng}; +use crate::distributions::{Distribution, Standard}; +use core::num::{NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroUsize}; +#[cfg(not(target_os = "emscripten"))] use core::num::NonZeroU128; #[cfg(feature="simd_support")] use packed_simd::*; #[cfg(all(target_arch = "x86", feature="nightly"))] @@ -45,7 +47,7 @@ } } -#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] +#[cfg(not(target_os = "emscripten"))] impl Distribution for Standard { #[inline] fn sample(&self, rng: &mut R) -> u128 { @@ -85,9 +87,30 @@ impl_int_from_uint! { i16, u16 } impl_int_from_uint! { i32, u32 } impl_int_from_uint! { i64, u64 } -#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] impl_int_from_uint! { i128, u128 } +#[cfg(not(target_os = "emscripten"))] impl_int_from_uint! { i128, u128 } impl_int_from_uint! { isize, usize } +macro_rules! impl_nzint { + ($ty:ty, $new:path) => { + impl Distribution<$ty> for Standard { + fn sample(&self, rng: &mut R) -> $ty { + loop { + if let Some(nz) = $new(rng.gen()) { + break nz; + } + } + } + } + } +} + +impl_nzint!(NonZeroU8, NonZeroU8::new); +impl_nzint!(NonZeroU16, NonZeroU16::new); +impl_nzint!(NonZeroU32, NonZeroU32::new); +impl_nzint!(NonZeroU64, NonZeroU64::new); +#[cfg(not(target_os = "emscripten"))] impl_nzint!(NonZeroU128, NonZeroU128::new); +impl_nzint!(NonZeroUsize, NonZeroUsize::new); + #[cfg(feature="simd_support")] macro_rules! simd_impl { ($(($intrinsic:ident, $vec:ty),)+) => {$( @@ -135,19 +158,19 @@ #[cfg(test)] mod tests { - use Rng; - use distributions::{Standard}; + use crate::Rng; + use crate::distributions::{Standard}; #[test] fn test_integers() { - let mut rng = ::test::rng(806); + let mut rng = crate::test::rng(806); rng.sample::(Standard); rng.sample::(Standard); rng.sample::(Standard); rng.sample::(Standard); rng.sample::(Standard); - #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] + #[cfg(not(target_os = "emscripten"))] rng.sample::(Standard); rng.sample::(Standard); @@ -155,7 +178,7 @@ rng.sample::(Standard); rng.sample::(Standard); rng.sample::(Standard); - #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] + #[cfg(not(target_os = "emscripten"))] rng.sample::(Standard); } } diff -Nru cargo-0.35.0/vendor/rand/src/distributions/mod.rs cargo-0.37.0/vendor/rand/src/distributions/mod.rs --- cargo-0.35.0/vendor/rand/src/distributions/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,12 +7,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! Generating random samples from probability distributions. +//! Generating random samples from probability distributions //! //! This module is the home of the [`Distribution`] trait and several of its //! implementations. It is the workhorse behind some of the convenient -//! functionality of the [`Rng`] trait, including [`gen`], [`gen_range`] and -//! of course [`sample`]. +//! functionality of the [`Rng`] trait, e.g. [`Rng::gen`], [`Rng::gen_range`] and +//! of course [`Rng::sample`]. //! //! Abstractly, a [probability distribution] describes the probability of //! occurance of each value in its sample space. @@ -40,8 +40,14 @@ //! possible to generate type `T` with [`Rng::gen()`], and by extension also //! with the [`random()`] function. //! +//! ## Random characters +//! +//! [`Alphanumeric`] is a simple distribution to sample random letters and +//! numbers of the `char` type; in contrast [`Standard`] may sample any valid +//! `char`. //! -//! # Distribution to sample from a `Uniform` range +//! +//! # Uniform numeric ranges //! //! The [`Uniform`] distribution is more flexible than [`Standard`], but also //! more specialised: it supports fewer target types, but allows the sample @@ -59,8 +65,7 @@ //! documentation in the [`uniform`] module. Doing so enables generation of //! values of type `T` with [`Rng::gen_range`]. //! -//! -//! # Other distributions +//! ## Open and half-open ranges //! //! There are surprisingly many ways to uniformly generate random floats. A //! range between 0 and 1 is standard, but the exact bounds (open vs closed) @@ -68,137 +73,73 @@ //! [`Open01`] and [`OpenClosed01`]. See "Floating point implementation" section of //! [`Standard`] documentation for more details. //! -//! [`Alphanumeric`] is a simple distribution to sample random letters and -//! numbers of the `char` type; in contrast [`Standard`] may sample any valid -//! `char`. +//! # Non-uniform sampling //! -//! [`WeightedIndex`] can be used to do weighted sampling from a set of items, -//! such as from an array. +//! Sampling a simple true/false outcome with a given probability has a name: +//! the [`Bernoulli`] distribution (this is used by [`Rng::gen_bool`]). //! -//! # Non-uniform probability distributions +//! For weighted sampling from a sequence of discrete values, use the +//! [`weighted`] module. //! -//! Rand currently provides the following probability distributions: -//! -//! - Related to real-valued quantities that grow linearly -//! (e.g. errors, offsets): -//! - [`Normal`] distribution, and [`StandardNormal`] as a primitive -//! - [`Cauchy`] distribution -//! - Related to Bernoulli trials (yes/no events, with a given probability): -//! - [`Binomial`] distribution -//! - [`Bernoulli`] distribution, similar to [`Rng::gen_bool`]. -//! - Related to positive real-valued quantities that grow exponentially -//! (e.g. prices, incomes, populations): -//! - [`LogNormal`] distribution -//! - Related to the occurrence of independent events at a given rate: -//! - [`Pareto`] distribution -//! - [`Poisson`] distribution -//! - [`Exp`]onential distribution, and [`Exp1`] as a primitive -//! - [`Weibull`] distribution -//! - Gamma and derived distributions: -//! - [`Gamma`] distribution -//! - [`ChiSquared`] distribution -//! - [`StudentT`] distribution -//! - [`FisherF`] distribution -//! - Triangular distribution: -//! - [`Beta`] distribution -//! - [`Triangular`] distribution -//! - Multivariate probability distributions -//! - [`Dirichlet`] distribution -//! - [`UnitSphereSurface`] distribution -//! - [`UnitCircle`] distribution -//! -//! # Examples -//! -//! Sampling from a distribution: -//! -//! ``` -//! use rand::{thread_rng, Rng}; -//! use rand::distributions::Exp; -//! -//! let exp = Exp::new(2.0); -//! let v = thread_rng().sample(exp); -//! println!("{} is from an Exp(2) distribution", v); -//! ``` -//! -//! Implementing the [`Standard`] distribution for a user type: -//! -//! ``` -//! # #![allow(dead_code)] -//! use rand::Rng; -//! use rand::distributions::{Distribution, Standard}; -//! -//! struct MyF32 { -//! x: f32, -//! } -//! -//! impl Distribution for Standard { -//! fn sample(&self, rng: &mut R) -> MyF32 { -//! MyF32 { x: rng.gen() } -//! } -//! } -//! ``` +//! This crate no longer includes other non-uniform distributions; instead +//! it is recommended that you use either [`rand_distr`] or [`statrs`]. //! //! //! [probability distribution]: https://en.wikipedia.org/wiki/Probability_distribution -//! [`gen_range`]: Rng::gen_range -//! [`gen`]: Rng::gen -//! [`sample`]: Rng::sample -//! [`new_inclusive`]: Uniform::new_inclusive +//! [`rand_distr`]: https://crates.io/crates/rand_distr +//! [`statrs`]: https://crates.io/crates/statrs + //! [`Alphanumeric`]: distributions::Alphanumeric //! [`Bernoulli`]: distributions::Bernoulli -//! [`Beta`]: distributions::Beta -//! [`Binomial`]: distributions::Binomial -//! [`Cauchy`]: distributions::Cauchy -//! [`ChiSquared`]: distributions::ChiSquared -//! [`Dirichlet`]: distributions::Dirichlet -//! [`Exp`]: distributions::Exp -//! [`Exp1`]: distributions::Exp1 -//! [`FisherF`]: distributions::FisherF -//! [`Gamma`]: distributions::Gamma -//! [`LogNormal`]: distributions::LogNormal -//! [`Normal`]: distributions::Normal //! [`Open01`]: distributions::Open01 //! [`OpenClosed01`]: distributions::OpenClosed01 -//! [`Pareto`]: distributions::Pareto -//! [`Poisson`]: distributions::Poisson //! [`Standard`]: distributions::Standard -//! [`StandardNormal`]: distributions::StandardNormal -//! [`StudentT`]: distributions::StudentT -//! [`Triangular`]: distributions::Triangular //! [`Uniform`]: distributions::Uniform //! [`Uniform::new`]: distributions::Uniform::new //! [`Uniform::new_inclusive`]: distributions::Uniform::new_inclusive -//! [`UnitSphereSurface`]: distributions::UnitSphereSurface -//! [`UnitCircle`]: distributions::UnitCircle -//! [`Weibull`]: distributions::Weibull -//! [`WeightedIndex`]: distributions::WeightedIndex +//! [`weighted`]: distributions::weighted +//! [`rand_distr`]: https://crates.io/crates/rand_distr +//! [`statrs`]: https://crates.io/crates/statrs -#[cfg(any(rustc_1_26, features="nightly"))] use core::iter; -use Rng; +use crate::Rng; pub use self::other::Alphanumeric; #[doc(inline)] pub use self::uniform::Uniform; pub use self::float::{OpenClosed01, Open01}; -pub use self::bernoulli::Bernoulli; +pub use self::bernoulli::{Bernoulli, BernoulliError}; #[cfg(feature="alloc")] pub use self::weighted::{WeightedIndex, WeightedError}; + +// The following are all deprecated after being moved to rand_distr +#[allow(deprecated)] #[cfg(feature="std")] pub use self::unit_sphere::UnitSphereSurface; +#[allow(deprecated)] #[cfg(feature="std")] pub use self::unit_circle::UnitCircle; +#[allow(deprecated)] #[cfg(feature="std")] pub use self::gamma::{Gamma, ChiSquared, FisherF, StudentT, Beta}; +#[allow(deprecated)] #[cfg(feature="std")] pub use self::normal::{Normal, LogNormal, StandardNormal}; +#[allow(deprecated)] #[cfg(feature="std")] pub use self::exponential::{Exp, Exp1}; +#[allow(deprecated)] #[cfg(feature="std")] pub use self::pareto::Pareto; +#[allow(deprecated)] #[cfg(feature="std")] pub use self::poisson::Poisson; +#[allow(deprecated)] #[cfg(feature="std")] pub use self::binomial::Binomial; +#[allow(deprecated)] #[cfg(feature="std")] pub use self::cauchy::Cauchy; +#[allow(deprecated)] #[cfg(feature="std")] pub use self::dirichlet::Dirichlet; +#[allow(deprecated)] #[cfg(feature="std")] pub use self::triangular::Triangular; +#[allow(deprecated)] #[cfg(feature="std")] pub use self::weibull::Weibull; pub mod uniform; mod bernoulli; -#[cfg(feature="alloc")] mod weighted; +#[cfg(feature="alloc")] pub mod weighted; #[cfg(feature="std")] mod unit_sphere; #[cfg(feature="std")] mod unit_circle; #[cfg(feature="std")] mod gamma; @@ -213,6 +154,9 @@ #[cfg(feature="std")] mod weibull; mod float; +#[doc(hidden)] pub mod hidden_export { + pub use super::float::IntoFloat; // used by rand_distr +} mod integer; mod other; mod utils; @@ -237,29 +181,35 @@ /// Create an iterator that generates random values of `T`, using `rng` as /// the source of randomness. /// + /// Note that this function takes `self` by value. This works since + /// `Distribution` is impl'd for `&D` where `D: Distribution`, + /// however borrowing is not automatic hence `distr.sample_iter(...)` may + /// need to be replaced with `(&distr).sample_iter(...)` to borrow or + /// `(&*distr).sample_iter(...)` to reborrow an existing reference. + /// /// # Example /// /// ``` /// use rand::thread_rng; /// use rand::distributions::{Distribution, Alphanumeric, Uniform, Standard}; /// - /// let mut rng = thread_rng(); + /// let rng = thread_rng(); /// /// // Vec of 16 x f32: - /// let v: Vec = Standard.sample_iter(&mut rng).take(16).collect(); + /// let v: Vec = Standard.sample_iter(rng).take(16).collect(); /// /// // String: - /// let s: String = Alphanumeric.sample_iter(&mut rng).take(7).collect(); + /// let s: String = Alphanumeric.sample_iter(rng).take(7).collect(); /// /// // Dice-rolling: /// let die_range = Uniform::new_inclusive(1, 6); - /// let mut roll_die = die_range.sample_iter(&mut rng); + /// let mut roll_die = die_range.sample_iter(rng); /// while roll_die.next().unwrap() != 6 { /// println!("Not a 6; rolling again!"); /// } /// ``` - fn sample_iter<'a, R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T> - where Self: Sized, R: Rng + fn sample_iter(self, rng: R) -> DistIter + where R: Rng, Self: Sized { DistIter { distr: self, @@ -284,20 +234,23 @@ /// /// [`sample_iter`]: Distribution::sample_iter #[derive(Debug)] -pub struct DistIter<'a, D: 'a, R: 'a, T> { - distr: &'a D, - rng: &'a mut R, +pub struct DistIter { + distr: D, + rng: R, phantom: ::core::marker::PhantomData, } -impl<'a, D, R, T> Iterator for DistIter<'a, D, R, T> - where D: Distribution, R: Rng + 'a +impl Iterator for DistIter + where D: Distribution, R: Rng { type Item = T; #[inline(always)] fn next(&mut self) -> Option { - Some(self.distr.sample(self.rng)) + // Here, self.rng may be a reference, but we must take &mut anyway. + // Even if sample could take an R: Rng by value, we would need to do this + // since Rng is not copyable and we cannot enforce that this is "reborrowable". + Some(self.distr.sample(&mut self.rng)) } fn size_hint(&self) -> (usize, Option) { @@ -305,20 +258,19 @@ } } -#[cfg(rustc_1_26)] -impl<'a, D, R, T> iter::FusedIterator for DistIter<'a, D, R, T> - where D: Distribution, R: Rng + 'a {} +impl iter::FusedIterator for DistIter + where D: Distribution, R: Rng {} #[cfg(features = "nightly")] -impl<'a, D, R, T> iter::TrustedLen for DistIter<'a, D, R, T> - where D: Distribution, R: Rng + 'a {} +impl iter::TrustedLen for DistIter + where D: Distribution, R: Rng {} /// A generic random value distribution, implemented for many primitive types. /// Usually generates values with a numerically uniform distribution, and with a /// range appropriate to the type. /// -/// ## Built-in Implementations +/// ## Provided implementations /// /// Assuming the provided `Rng` is well-behaved, these implementations /// generate values with the following ranges and distributions: @@ -335,20 +287,42 @@ /// * Wrapping integers (`Wrapping`), besides the type identical to their /// normal integer variants. /// -/// The following aggregate types also implement the distribution `Standard` as -/// long as their component types implement it: +/// The `Standard` distribution also supports generation of the following +/// compound types where all component types are supported: /// -/// * Tuples and arrays: Each element of the tuple or array is generated -/// independently, using the `Standard` distribution recursively. -/// * `Option` where `Standard` is implemented for `T`: Returns `None` with -/// probability 0.5; otherwise generates a random `x: T` and returns `Some(x)`. +/// * Tuples (up to 12 elements): each element is generated sequentially. +/// * Arrays (up to 32 elements): each element is generated sequentially; +/// see also [`Rng::fill`] which supports arbitrary array length for integer +/// types and tends to be faster for `u32` and smaller types. +/// * `Option` first generates a `bool`, and if true generates and returns +/// `Some(value)` where `value: T`, otherwise returning `None`. +/// +/// ## Custom implementations +/// +/// The [`Standard`] distribution may be implemented for user types as follows: +/// +/// ``` +/// # #![allow(dead_code)] +/// use rand::Rng; +/// use rand::distributions::{Distribution, Standard}; +/// +/// struct MyF32 { +/// x: f32, +/// } +/// +/// impl Distribution for Standard { +/// fn sample(&self, rng: &mut R) -> MyF32 { +/// MyF32 { x: rng.gen() } +/// } +/// } +/// ``` /// -/// # Example +/// ## Example usage /// ``` /// use rand::prelude::*; /// use rand::distributions::Standard; /// -/// let val: f32 = SmallRng::from_entropy().sample(Standard); +/// let val: f32 = StdRng::from_entropy().sample(Standard); /// println!("f32 from [0, 1): {}", val); /// ``` /// @@ -373,236 +347,35 @@ pub struct Standard; -/// A value with a particular weight for use with `WeightedChoice`. -#[deprecated(since="0.6.0", note="use WeightedIndex instead")] -#[allow(deprecated)] -#[derive(Copy, Clone, Debug)] -pub struct Weighted { - /// The numerical weight of this item - pub weight: u32, - /// The actual item which is being weighted - pub item: T, -} - -/// A distribution that selects from a finite collection of weighted items. -/// -/// Deprecated: use [`WeightedIndex`] instead. -/// -/// [`WeightedIndex`]: WeightedIndex -#[deprecated(since="0.6.0", note="use WeightedIndex instead")] -#[allow(deprecated)] -#[derive(Debug)] -pub struct WeightedChoice<'a, T:'a> { - items: &'a mut [Weighted], - weight_range: Uniform, -} - -#[deprecated(since="0.6.0", note="use WeightedIndex instead")] -#[allow(deprecated)] -impl<'a, T: Clone> WeightedChoice<'a, T> { - /// Create a new `WeightedChoice`. - /// - /// Panics if: - /// - /// - `items` is empty - /// - the total weight is 0 - /// - the total weight is larger than a `u32` can contain. - pub fn new(items: &'a mut [Weighted]) -> WeightedChoice<'a, T> { - // strictly speaking, this is subsumed by the total weight == 0 case - assert!(!items.is_empty(), "WeightedChoice::new called with no items"); - - let mut running_total: u32 = 0; - - // we convert the list from individual weights to cumulative - // weights so we can binary search. This *could* drop elements - // with weight == 0 as an optimisation. - for item in items.iter_mut() { - running_total = match running_total.checked_add(item.weight) { - Some(n) => n, - None => panic!("WeightedChoice::new called with a total weight \ - larger than a u32 can contain") - }; - - item.weight = running_total; - } - assert!(running_total != 0, "WeightedChoice::new called with a total weight of 0"); - - WeightedChoice { - items, - // we're likely to be generating numbers in this range - // relatively often, so might as well cache it - weight_range: Uniform::new(0, running_total) - } - } -} - -#[deprecated(since="0.6.0", note="use WeightedIndex instead")] -#[allow(deprecated)] -impl<'a, T: Clone> Distribution for WeightedChoice<'a, T> { - fn sample(&self, rng: &mut R) -> T { - // we want to find the first element that has cumulative - // weight > sample_weight, which we do by binary since the - // cumulative weights of self.items are sorted. - - // choose a weight in [0, total_weight) - let sample_weight = self.weight_range.sample(rng); - - // short circuit when it's the first item - if sample_weight < self.items[0].weight { - return self.items[0].item.clone(); - } - - let mut idx = 0; - let mut modifier = self.items.len(); - - // now we know that every possibility has an element to the - // left, so we can just search for the last element that has - // cumulative weight <= sample_weight, then the next one will - // be "it". (Note that this greatest element will never be the - // last element of the vector, since sample_weight is chosen - // in [0, total_weight) and the cumulative weight of the last - // one is exactly the total weight.) - while modifier > 1 { - let i = idx + modifier / 2; - if self.items[i].weight <= sample_weight { - // we're small, so look to the right, but allow this - // exact element still. - idx = i; - // we need the `/ 2` to round up otherwise we'll drop - // the trailing elements when `modifier` is odd. - modifier += 1; - } else { - // otherwise we're too big, so go left. (i.e. do - // nothing) - } - modifier /= 2; - } - self.items[idx + 1].item.clone() - } -} - -#[cfg(test)] +#[cfg(all(test, feature = "std"))] mod tests { - use rngs::mock::StepRng; - #[allow(deprecated)] - use super::{WeightedChoice, Weighted, Distribution}; - - #[test] - #[allow(deprecated)] - fn test_weighted_choice() { - // this makes assumptions about the internal implementation of - // WeightedChoice. It may fail when the implementation in - // `distributions::uniform::UniformInt` changes. - - macro_rules! t { - ($items:expr, $expected:expr) => {{ - let mut items = $items; - let mut total_weight = 0; - for item in &items { total_weight += item.weight; } - - let wc = WeightedChoice::new(&mut items); - let expected = $expected; - - // Use extremely large steps between the random numbers, because - // we test with small ranges and `UniformInt` is designed to prefer - // the most significant bits. - let mut rng = StepRng::new(0, !0 / (total_weight as u64)); - - for &val in expected.iter() { - assert_eq!(wc.sample(&mut rng), val) - } - }} - } - - t!([Weighted { weight: 1, item: 10}], [10]); - - // skip some - t!([Weighted { weight: 0, item: 20}, - Weighted { weight: 2, item: 21}, - Weighted { weight: 0, item: 22}, - Weighted { weight: 1, item: 23}], - [21, 21, 23]); - - // different weights - t!([Weighted { weight: 4, item: 30}, - Weighted { weight: 3, item: 31}], - [30, 31, 30, 31, 30, 31, 30]); - - // check that we're binary searching - // correctly with some vectors of odd - // length. - t!([Weighted { weight: 1, item: 40}, - Weighted { weight: 1, item: 41}, - Weighted { weight: 1, item: 42}, - Weighted { weight: 1, item: 43}, - Weighted { weight: 1, item: 44}], - [40, 41, 42, 43, 44]); - t!([Weighted { weight: 1, item: 50}, - Weighted { weight: 1, item: 51}, - Weighted { weight: 1, item: 52}, - Weighted { weight: 1, item: 53}, - Weighted { weight: 1, item: 54}, - Weighted { weight: 1, item: 55}, - Weighted { weight: 1, item: 56}], - [50, 54, 51, 55, 52, 56, 53]); - } - - #[test] - #[allow(deprecated)] - fn test_weighted_clone_initialization() { - let initial : Weighted = Weighted {weight: 1, item: 1}; - let clone = initial.clone(); - assert_eq!(initial.weight, clone.weight); - assert_eq!(initial.item, clone.item); - } - - #[test] #[should_panic] - #[allow(deprecated)] - fn test_weighted_clone_change_weight() { - let initial : Weighted = Weighted {weight: 1, item: 1}; - let mut clone = initial.clone(); - clone.weight = 5; - assert_eq!(initial.weight, clone.weight); - } - - #[test] #[should_panic] - #[allow(deprecated)] - fn test_weighted_clone_change_item() { - let initial : Weighted = Weighted {weight: 1, item: 1}; - let mut clone = initial.clone(); - clone.item = 5; - assert_eq!(initial.item, clone.item); + use crate::Rng; + use super::{Distribution, Uniform}; - } - - #[test] #[should_panic] - #[allow(deprecated)] - fn test_weighted_choice_no_items() { - WeightedChoice::::new(&mut []); - } - #[test] #[should_panic] - #[allow(deprecated)] - fn test_weighted_choice_zero_weight() { - WeightedChoice::new(&mut [Weighted { weight: 0, item: 0}, - Weighted { weight: 0, item: 1}]); - } - #[test] #[should_panic] - #[allow(deprecated)] - fn test_weighted_choice_weight_overflows() { - let x = ::core::u32::MAX / 2; // x + x + 2 is the overflow - WeightedChoice::new(&mut [Weighted { weight: x, item: 0 }, - Weighted { weight: 1, item: 1 }, - Weighted { weight: x, item: 2 }, - Weighted { weight: 1, item: 3 }]); - } - - #[cfg(feature="std")] #[test] fn test_distributions_iter() { - use distributions::Normal; - let mut rng = ::test::rng(210); - let distr = Normal::new(10.0, 10.0); - let results: Vec<_> = distr.sample_iter(&mut rng).take(100).collect(); + use crate::distributions::Open01; + let mut rng = crate::test::rng(210); + let distr = Open01; + let results: Vec = distr.sample_iter(&mut rng).take(100).collect(); println!("{:?}", results); } + + #[test] + fn test_make_an_iter() { + fn ten_dice_rolls_other_than_five<'a, R: Rng>(rng: &'a mut R) -> impl Iterator + 'a { + Uniform::new_inclusive(1, 6) + .sample_iter(rng) + .filter(|x| *x != 5) + .take(10) + } + + let mut rng = crate::test::rng(211); + let mut count = 0; + for val in ten_dice_rolls_other_than_five(&mut rng) { + assert!(val >= 1 && val <= 6 && val != 5); + count += 1; + } + assert_eq!(count, 10); + } } diff -Nru cargo-0.35.0/vendor/rand/src/distributions/normal.rs cargo-0.37.0/vendor/rand/src/distributions/normal.rs --- cargo-0.35.0/vendor/rand/src/distributions/normal.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/normal.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,10 +8,11 @@ // except according to those terms. //! The normal and derived distributions. +#![allow(deprecated)] -use Rng; -use distributions::{ziggurat_tables, Distribution, Open01}; -use distributions::utils::ziggurat; +use crate::Rng; +use crate::distributions::{ziggurat_tables, Distribution, Open01}; +use crate::distributions::utils::ziggurat; /// Samples floating-point numbers according to the normal distribution /// `N(0, 1)` (a.k.a. a standard normal, or Gaussian). This is equivalent to @@ -25,15 +26,7 @@ /// Generate Normal Random Samples*]( /// https://www.doornik.com/research/ziggurat.pdf). /// Nuffield College, Oxford -/// -/// # Example -/// ``` -/// use rand::prelude::*; -/// use rand::distributions::StandardNormal; -/// -/// let val: f64 = SmallRng::from_entropy().sample(StandardNormal); -/// println!("{}", val); -/// ``` +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Copy, Debug)] pub struct StandardNormal; @@ -80,18 +73,8 @@ /// Note that [`StandardNormal`] is an optimised implementation for mean 0, and /// standard deviation 1. /// -/// # Example -/// -/// ``` -/// use rand::distributions::{Normal, Distribution}; -/// -/// // mean 2, standard deviation 3 -/// let normal = Normal::new(2.0, 3.0); -/// let v = normal.sample(&mut rand::thread_rng()); -/// println!("{} is from a N(2, 9) distribution", v) -/// ``` -/// /// [`StandardNormal`]: crate::distributions::StandardNormal +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Copy, Debug)] pub struct Normal { mean: f64, @@ -126,17 +109,7 @@ /// /// If `X` is log-normal distributed, then `ln(X)` is `N(mean, std_dev**2)` /// distributed. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{LogNormal, Distribution}; -/// -/// // mean 2, standard deviation 3 -/// let log_normal = LogNormal::new(2.0, 3.0); -/// let v = log_normal.sample(&mut rand::thread_rng()); -/// println!("{} is from an ln N(2, 9) distribution", v) -/// ``` +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Copy, Debug)] pub struct LogNormal { norm: Normal @@ -163,13 +136,13 @@ #[cfg(test)] mod tests { - use distributions::Distribution; + use crate::distributions::Distribution; use super::{Normal, LogNormal}; #[test] fn test_normal() { let norm = Normal::new(10.0, 10.0); - let mut rng = ::test::rng(210); + let mut rng = crate::test::rng(210); for _ in 0..1000 { norm.sample(&mut rng); } @@ -184,7 +157,7 @@ #[test] fn test_log_normal() { let lnorm = LogNormal::new(10.0, 10.0); - let mut rng = ::test::rng(211); + let mut rng = crate::test::rng(211); for _ in 0..1000 { lnorm.sample(&mut rng); } diff -Nru cargo-0.35.0/vendor/rand/src/distributions/other.rs cargo-0.37.0/vendor/rand/src/distributions/other.rs --- cargo-0.35.0/vendor/rand/src/distributions/other.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/other.rs 2019-07-17 05:42:23.000000000 +0000 @@ -11,8 +11,8 @@ use core::char; use core::num::Wrapping; -use {Rng}; -use distributions::{Distribution, Standard, Uniform}; +use crate::{Rng}; +use crate::distributions::{Distribution, Standard, Uniform}; // ----- Sampling distributions ----- @@ -176,13 +176,13 @@ #[cfg(test)] mod tests { - use {Rng, RngCore, Standard}; - use distributions::Alphanumeric; + use crate::{Rng, RngCore, Standard}; + use crate::distributions::Alphanumeric; #[cfg(all(not(feature="std"), feature="alloc"))] use alloc::string::String; #[test] fn test_misc() { - let rng: &mut RngCore = &mut ::test::rng(820); + let rng: &mut dyn RngCore = &mut crate::test::rng(820); rng.sample::(Standard); rng.sample::(Standard); @@ -192,7 +192,7 @@ #[test] fn test_chars() { use core::iter; - let mut rng = ::test::rng(805); + let mut rng = crate::test::rng(805); // Test by generating a relatively large number of chars, so we also // take the rejection sampling path. @@ -203,7 +203,7 @@ #[test] fn test_alphanumeric() { - let mut rng = ::test::rng(806); + let mut rng = crate::test::rng(806); // Test by generating a relatively large number of chars, so we also // take the rejection sampling path. diff -Nru cargo-0.35.0/vendor/rand/src/distributions/pareto.rs cargo-0.37.0/vendor/rand/src/distributions/pareto.rs --- cargo-0.35.0/vendor/rand/src/distributions/pareto.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/pareto.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,20 +7,13 @@ // except according to those terms. //! The Pareto distribution. +#![allow(deprecated)] -use Rng; -use distributions::{Distribution, OpenClosed01}; +use crate::Rng; +use crate::distributions::{Distribution, OpenClosed01}; /// Samples floating-point numbers according to the Pareto distribution -/// -/// # Example -/// ``` -/// use rand::prelude::*; -/// use rand::distributions::Pareto; -/// -/// let val: f64 = SmallRng::from_entropy().sample(Pareto::new(1., 2.)); -/// println!("{}", val); -/// ``` +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Copy, Debug)] pub struct Pareto { scale: f64, @@ -51,7 +44,7 @@ #[cfg(test)] mod tests { - use distributions::Distribution; + use crate::distributions::Distribution; use super::Pareto; #[test] @@ -65,7 +58,7 @@ let scale = 1.0; let shape = 2.0; let d = Pareto::new(scale, shape); - let mut rng = ::test::rng(1); + let mut rng = crate::test::rng(1); for _ in 0..1000 { let r = d.sample(&mut rng); assert!(r >= scale); diff -Nru cargo-0.35.0/vendor/rand/src/distributions/poisson.rs cargo-0.37.0/vendor/rand/src/distributions/poisson.rs --- cargo-0.35.0/vendor/rand/src/distributions/poisson.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/poisson.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,25 +8,17 @@ // except according to those terms. //! The Poisson distribution. +#![allow(deprecated)] -use Rng; -use distributions::{Distribution, Cauchy}; -use distributions::utils::log_gamma; +use crate::Rng; +use crate::distributions::{Distribution, Cauchy}; +use crate::distributions::utils::log_gamma; /// The Poisson distribution `Poisson(lambda)`. /// /// This distribution has a density function: /// `f(k) = lambda^k * exp(-lambda) / k!` for `k >= 0`. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{Poisson, Distribution}; -/// -/// let poi = Poisson::new(2.0); -/// let v = poi.sample(&mut rand::thread_rng()); -/// println!("{} is from a Poisson(2) distribution", v); -/// ``` +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Copy, Debug)] pub struct Poisson { lambda: f64, @@ -113,13 +105,14 @@ #[cfg(test)] mod test { - use distributions::Distribution; + use crate::distributions::Distribution; use super::Poisson; #[test] + #[cfg(not(miri))] // Miri is too slow fn test_poisson_10() { let poisson = Poisson::new(10.0); - let mut rng = ::test::rng(123); + let mut rng = crate::test::rng(123); let mut sum = 0; for _ in 0..1000 { sum += poisson.sample(&mut rng); @@ -130,10 +123,11 @@ } #[test] + #[cfg(not(miri))] // Miri doesn't support transcendental functions fn test_poisson_15() { // Take the 'high expected values' path let poisson = Poisson::new(15.0); - let mut rng = ::test::rng(123); + let mut rng = crate::test::rng(123); let mut sum = 0; for _ in 0..1000 { sum += poisson.sample(&mut rng); diff -Nru cargo-0.35.0/vendor/rand/src/distributions/triangular.rs cargo-0.37.0/vendor/rand/src/distributions/triangular.rs --- cargo-0.35.0/vendor/rand/src/distributions/triangular.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/triangular.rs 2019-07-17 05:42:23.000000000 +0000 @@ -5,22 +5,15 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. + //! The triangular distribution. +#![allow(deprecated)] -use Rng; -use distributions::{Distribution, Standard}; +use crate::Rng; +use crate::distributions::{Distribution, Standard}; /// The triangular distribution. -/// -/// # Example -/// -/// ```rust -/// use rand::distributions::{Triangular, Distribution}; -/// -/// let d = Triangular::new(0., 5., 2.5); -/// let v = d.sample(&mut rand::thread_rng()); -/// println!("{} is from a triangular distribution", v); -/// ``` +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Copy, Debug)] pub struct Triangular { min: f64, @@ -61,7 +54,7 @@ #[cfg(test)] mod test { - use distributions::Distribution; + use crate::distributions::Distribution; use super::Triangular; #[test] @@ -78,7 +71,7 @@ #[test] fn test_sample() { let norm = Triangular::new(0., 1., 0.5); - let mut rng = ::test::rng(1); + let mut rng = crate::test::rng(1); for _ in 0..1000 { norm.sample(&mut rng); } diff -Nru cargo-0.35.0/vendor/rand/src/distributions/uniform.rs cargo-0.37.0/vendor/rand/src/distributions/uniform.rs --- cargo-0.35.0/vendor/rand/src/distributions/uniform.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/uniform.rs 2019-07-17 05:42:23.000000000 +0000 @@ -109,17 +109,17 @@ #[cfg(feature = "std")] use std::time::Duration; -#[cfg(all(not(feature = "std"), rustc_1_25))] +#[cfg(not(feature = "std"))] use core::time::Duration; -use Rng; -use distributions::Distribution; -use distributions::float::IntoFloat; -use distributions::utils::{WideningMultiply, FloatSIMDUtils, FloatAsSIMD, BoolAsSIMD}; +use crate::Rng; +use crate::distributions::Distribution; +use crate::distributions::float::IntoFloat; +use crate::distributions::utils::{WideningMultiply, FloatSIMDUtils, FloatAsSIMD, BoolAsSIMD}; #[cfg(not(feature = "std"))] #[allow(unused_imports)] // rustc doesn't detect that this is actually used -use distributions::utils::Float; +use crate::distributions::utils::Float; #[cfg(feature="simd_support")] @@ -246,14 +246,11 @@ /// Sample a single value uniformly from a range with inclusive lower bound /// and exclusive upper bound `[low, high)`. /// - /// Usually users should not call this directly but instead use - /// `Uniform::sample_single`, which asserts that `low < high` before calling - /// this. - /// - /// Via this method, implementations can provide a method optimized for - /// sampling only a single value from the specified range. The default - /// implementation simply calls `UniformSampler::new` then `sample` on the - /// result. + /// By default this is implemented using + /// `UniformSampler::new(low, high).sample(rng)`. However, for some types + /// more optimal implementations for single usage may be provided via this + /// method (which is the case for integers and floats). + /// Results may not be identical. fn sample_single(low: B1, high: B2, rng: &mut R) -> Self::X where B1: SampleBorrow + Sized, @@ -270,7 +267,6 @@ } } -#[cfg(rustc_1_27)] impl From<::core::ops::RangeInclusive> for Uniform { fn from(r: ::core::ops::RangeInclusive) -> Uniform { Uniform::new_inclusive(r.start(), r.end()) @@ -309,31 +305,29 @@ /// /// # Implementation notes /// +/// For simplicity, we use the same generic struct `UniformInt` for all +/// integer types `X`. This gives us only one field type, `X`; to store unsigned +/// values of this size, we take use the fact that these conversions are no-ops. +/// /// For a closed range, the number of possible numbers we should generate is -/// `range = (high - low + 1)`. It is not possible to end up with a uniform -/// distribution if we map *all* the random integers that can be generated to -/// this range. We have to map integers from a `zone` that is a multiple of the -/// range. The rest of the integers, that cause a bias, are rejected. -/// -/// The problem with `range` is that to cover the full range of the type, it has -/// to store `unsigned_max + 1`, which can't be represented. But if the range -/// covers the full range of the type, no modulus is needed. A range of size 0 -/// can't exist, so we use that to represent this special case. Wrapping -/// arithmetic even makes representing `unsigned_max + 1` as 0 simple. -/// -/// We don't calculate `zone` directly, but first calculate the number of -/// integers to reject. To handle `unsigned_max + 1` not fitting in the type, -/// we use: -/// `ints_to_reject = (unsigned_max + 1) % range;` -/// `ints_to_reject = (unsigned_max - range + 1) % range;` -/// -/// The smallest integer PRNGs generate is `u32`. That is why for small integer -/// sizes (`i8`/`u8` and `i16`/`u16`) there is an optimization: don't pick the -/// largest zone that can fit in the small type, but pick the largest zone that -/// can fit in an `u32`. `ints_to_reject` is always less than half the size of -/// the small integer. This means the first bit of `zone` is always 1, and so -/// are all the other preceding bits of a larger integer. The easiest way to -/// grow the `zone` for the larger type is to simply sign extend it. +/// `range = (high - low + 1)`. To avoid bias, we must ensure that the size of +/// our sample space, `zone`, is a multiple of `range`; other values must be +/// rejected (by replacing with a new random sample). +/// +/// As a special case, we use `range = 0` to represent the full range of the +/// result type (i.e. for `new_inclusive($ty::MIN, $ty::MAX)`). +/// +/// The optimum `zone` is the largest product of `range` which fits in our +/// (unsigned) target type. We calculate this by calculating how many numbers we +/// must reject: `reject = (MAX + 1) % range = (MAX - range + 1) % range`. Any (large) +/// product of `range` will suffice, thus in `sample_single` we multiply by a +/// power of 2 via bit-shifting (faster but may cause more rejections). +/// +/// The smallest integer PRNGs generate is `u32`. For 8- and 16-bit outputs we +/// use `u32` for our `zone` and samples (because it's not slower and because +/// it reduces the chance of having to reject a sample). In this case we cannot +/// store `zone` in the target type since it is too large, however we know +/// `ints_to_reject < range <= $unsigned::MAX`. /// /// An alternative to using a modulus is widening multiply: After a widening /// multiply by `range`, the result is in the high word. Then comparing the low @@ -342,12 +336,11 @@ pub struct UniformInt { low: X, range: X, - zone: X, + z: X, // either ints_to_reject or zone depending on implementation } macro_rules! uniform_int_impl { - ($ty:ty, $signed:ty, $unsigned:ident, - $i_large:ident, $u_large:ident) => { + ($ty:ty, $unsigned:ident, $u_large:ident) => { impl SampleUniform for $ty { type Sampler = UniformInt<$ty>; } @@ -382,34 +375,30 @@ let high = *high_b.borrow(); assert!(low <= high, "Uniform::new_inclusive called with `low > high`"); - let unsigned_max = ::core::$unsigned::MAX; + let unsigned_max = ::core::$u_large::MAX; let range = high.wrapping_sub(low).wrapping_add(1) as $unsigned; let ints_to_reject = if range > 0 { + let range = range as $u_large; (unsigned_max - range + 1) % range } else { 0 }; - let zone = unsigned_max - ints_to_reject; UniformInt { low: low, // These are really $unsigned values, but store as $ty: range: range as $ty, - zone: zone as $ty + z: ints_to_reject as $unsigned as $ty } } fn sample(&self, rng: &mut R) -> Self::X { let range = self.range as $unsigned as $u_large; if range > 0 { - // Grow `zone` to fit a type of at least 32 bits, by - // sign-extending it (the first bit is always 1, so are all - // the preceding bits of the larger type). - // For types that already have the right size, all the - // casting is a no-op. - let zone = self.zone as $signed as $i_large as $u_large; + let unsigned_max = ::core::$u_large::MAX; + let zone = unsigned_max - (self.z as $unsigned as $u_large); loop { let v: $u_large = rng.gen(); let (hi, lo) = v.wmul(range); @@ -431,7 +420,7 @@ let low = *low_b.borrow(); let high = *high_b.borrow(); assert!(low < high, - "Uniform::sample_single called with low >= high"); + "UniformSampler::sample_single: low >= high"); let range = high.wrapping_sub(low) as $unsigned as $u_large; let zone = if ::core::$unsigned::MAX <= ::core::u16::MAX as $unsigned { @@ -459,20 +448,20 @@ } } -uniform_int_impl! { i8, i8, u8, i32, u32 } -uniform_int_impl! { i16, i16, u16, i32, u32 } -uniform_int_impl! { i32, i32, u32, i32, u32 } -uniform_int_impl! { i64, i64, u64, i64, u64 } -#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] -uniform_int_impl! { i128, i128, u128, u128, u128 } -uniform_int_impl! { isize, isize, usize, isize, usize } -uniform_int_impl! { u8, i8, u8, i32, u32 } -uniform_int_impl! { u16, i16, u16, i32, u32 } -uniform_int_impl! { u32, i32, u32, i32, u32 } -uniform_int_impl! { u64, i64, u64, i64, u64 } -uniform_int_impl! { usize, isize, usize, isize, usize } -#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] -uniform_int_impl! { u128, u128, u128, i128, u128 } +uniform_int_impl! { i8, u8, u32 } +uniform_int_impl! { i16, u16, u32 } +uniform_int_impl! { i32, u32, u32 } +uniform_int_impl! { i64, u64, u64 } +#[cfg(not(target_os = "emscripten"))] +uniform_int_impl! { i128, u128, u128 } +uniform_int_impl! { isize, usize, usize } +uniform_int_impl! { u8, u8, u32 } +uniform_int_impl! { u16, u16, u32 } +uniform_int_impl! { u32, u32, u32 } +uniform_int_impl! { u64, u64, u64 } +uniform_int_impl! { usize, usize, usize } +#[cfg(not(target_os = "emscripten"))] +uniform_int_impl! { u128, u128, u128 } #[cfg(all(feature = "simd_support", feature = "nightly"))] macro_rules! uniform_simd_int_impl { @@ -534,13 +523,13 @@ low: low, // These are really $unsigned values, but store as $ty: range: range.cast(), - zone: zone.cast(), + z: zone.cast(), } } fn sample(&self, rng: &mut R) -> Self::X { let range: $unsigned = self.range.cast(); - let zone: $unsigned = self.zone.cast(); + let zone: $unsigned = self.z.cast(); // This might seem very slow, generating a whole new // SIMD vector for every sample rejection. For most uses @@ -736,7 +725,7 @@ let low = *low_b.borrow(); let high = *high_b.borrow(); assert!(low.all_lt(high), - "Uniform::sample_single called with low >= high"); + "UniformSampler::sample_single: low >= high"); let mut scale = high - low; loop { @@ -787,7 +776,7 @@ let mask = !scale.finite_mask(); if mask.any() { assert!(low.all_finite() && high.all_finite(), - "Uniform::sample_single called with non-finite boundaries"); + "Uniform::sample_single: low and high must be finite"); scale = scale.decrease_masked(mask); } } @@ -821,14 +810,12 @@ /// /// Unless you are implementing [`UniformSampler`] for your own types, this type /// should not be used directly, use [`Uniform`] instead. -#[cfg(any(feature = "std", rustc_1_25))] #[derive(Clone, Copy, Debug)] pub struct UniformDuration { mode: UniformDurationMode, offset: u32, } -#[cfg(any(feature = "std", rustc_1_25))] #[derive(Debug, Copy, Clone)] enum UniformDurationMode { Small { @@ -845,12 +832,10 @@ } } -#[cfg(any(feature = "std", rustc_1_25))] impl SampleUniform for Duration { type Sampler = UniformDuration; } -#[cfg(any(feature = "std", rustc_1_25))] impl UniformSampler for UniformDuration { type X = Duration; @@ -944,10 +929,10 @@ #[cfg(test)] mod tests { - use Rng; - use rngs::mock::StepRng; - use distributions::uniform::Uniform; - use distributions::utils::FloatAsSIMD; + use crate::Rng; + use crate::rngs::mock::StepRng; + use crate::distributions::uniform::Uniform; + use crate::distributions::utils::FloatAsSIMD; #[cfg(feature="simd_support")] use packed_simd::*; #[should_panic] @@ -958,7 +943,7 @@ #[test] fn test_uniform_good_limits_equal_int() { - let mut rng = ::test::rng(804); + let mut rng = crate::test::rng(804); let dist = Uniform::new_inclusive(10, 10); for _ in 0..20 { assert_eq!(rng.sample(dist), 10); @@ -972,13 +957,14 @@ } #[test] + #[cfg(not(miri))] // Miri is too slow fn test_integers() { use core::{i8, i16, i32, i64, isize}; use core::{u8, u16, u32, u64, usize}; - #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] + #[cfg(not(target_os = "emscripten"))] use core::{i128, u128}; - let mut rng = ::test::rng(251); + let mut rng = crate::test::rng(251); macro_rules! t { ($ty:ident, $v:expr, $le:expr, $lt:expr) => {{ for &(low, high) in $v.iter() { @@ -1039,7 +1025,7 @@ } t!(i8, i16, i32, i64, isize, u8, u16, u32, u64, usize); - #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] + #[cfg(not(target_os = "emscripten"))] t!(i128, u128); #[cfg(all(feature = "simd_support", feature = "nightly"))] @@ -1056,8 +1042,9 @@ } #[test] + #[cfg(not(miri))] // Miri is too slow fn test_floats() { - let mut rng = ::test::rng(252); + let mut rng = crate::test::rng(252); let mut zero_rng = StepRng::new(0, 0); let mut max_rng = StepRng::new(0xffff_ffff_ffff_ffff, 0); macro_rules! t { @@ -1140,11 +1127,12 @@ #[cfg(all(feature="std", not(target_arch = "wasm32"), not(target_arch = "asmjs")))] + #[cfg(not(miri))] // Miri does not support catching panics fn test_float_assertions() { use std::panic::catch_unwind; use super::SampleUniform; fn range(low: T, high: T) { - let mut rng = ::test::rng(253); + let mut rng = crate::test::rng(253); rng.gen_range(low, high); } @@ -1194,14 +1182,14 @@ #[test] - #[cfg(any(feature = "std", rustc_1_25))] + #[cfg(not(miri))] // Miri is too slow fn test_durations() { #[cfg(feature = "std")] use std::time::Duration; - #[cfg(all(not(feature = "std"), rustc_1_25))] + #[cfg(not(feature = "std"))] use core::time::Duration; - let mut rng = ::test::rng(253); + let mut rng = crate::test::rng(253); let v = &[(Duration::new(10, 50000), Duration::new(100, 1234)), (Duration::new(0, 100), Duration::new(1, 50)), @@ -1217,7 +1205,7 @@ #[test] fn test_custom_uniform() { - use distributions::uniform::{UniformSampler, UniformFloat, SampleUniform, SampleBorrow}; + use crate::distributions::uniform::{UniformSampler, UniformFloat, SampleUniform, SampleBorrow}; #[derive(Clone, Copy, PartialEq, PartialOrd)] struct MyF32 { x: f32, @@ -1252,7 +1240,7 @@ let (low, high) = (MyF32{ x: 17.0f32 }, MyF32{ x: 22.0f32 }); let uniform = Uniform::new(low, high); - let mut rng = ::test::rng(804); + let mut rng = crate::test::rng(804); for _ in 0..100 { let x: MyF32 = rng.sample(uniform); assert!(low <= x && x < high); @@ -1269,7 +1257,6 @@ assert_eq!(r.inner.scale, 5.0); } - #[cfg(rustc_1_27)] #[test] fn test_uniform_from_std_range_inclusive() { let r = Uniform::from(2u32..=6); diff -Nru cargo-0.35.0/vendor/rand/src/distributions/unit_circle.rs cargo-0.37.0/vendor/rand/src/distributions/unit_circle.rs --- cargo-0.35.0/vendor/rand/src/distributions/unit_circle.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/unit_circle.rs 2019-07-17 05:42:23.000000000 +0000 @@ -6,28 +6,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use Rng; -use distributions::{Distribution, Uniform}; +#![allow(deprecated)] + +use crate::Rng; +use crate::distributions::{Distribution, Uniform}; /// Samples uniformly from the edge of the unit circle in two dimensions. /// /// Implemented via a method by von Neumann[^1]. /// -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{UnitCircle, Distribution}; -/// -/// let circle = UnitCircle::new(); -/// let v = circle.sample(&mut rand::thread_rng()); -/// println!("{:?} is from the unit circle.", v) -/// ``` -/// /// [^1]: von Neumann, J. (1951) [*Various Techniques Used in Connection with /// Random Digits.*](https://mcnp.lanl.gov/pdf_files/nbs_vonneumann.pdf) /// NBS Appl. Math. Ser., No. 12. Washington, DC: U.S. Government Printing /// Office, pp. 36-38. +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Copy, Debug)] pub struct UnitCircle; @@ -61,7 +53,7 @@ #[cfg(test)] mod tests { - use distributions::Distribution; + use crate::distributions::Distribution; use super::UnitCircle; /// Assert that two numbers are almost equal to each other. @@ -82,7 +74,7 @@ #[test] fn norm() { - let mut rng = ::test::rng(1); + let mut rng = crate::test::rng(1); let dist = UnitCircle::new(); for _ in 0..1000 { let x = dist.sample(&mut rng); @@ -92,10 +84,17 @@ #[test] fn value_stability() { - let mut rng = ::test::rng(2); - let dist = UnitCircle::new(); - assert_eq!(dist.sample(&mut rng), [-0.8032118336637037, 0.5956935036263119]); - assert_eq!(dist.sample(&mut rng), [-0.4742919588505423, -0.880367615130018]); - assert_eq!(dist.sample(&mut rng), [0.9297328981467168, 0.368234623716601]); + let mut rng = crate::test::rng(2); + let expected = [ + [-0.9965658683520504, -0.08280380447614634], + [-0.9790853270389644, -0.20345004884984505], + [-0.8449189758898707, 0.5348943112253227], + ]; + let samples = [ + UnitCircle.sample(&mut rng), + UnitCircle.sample(&mut rng), + UnitCircle.sample(&mut rng), + ]; + assert_eq!(samples, expected); } } diff -Nru cargo-0.35.0/vendor/rand/src/distributions/unit_sphere.rs cargo-0.37.0/vendor/rand/src/distributions/unit_sphere.rs --- cargo-0.35.0/vendor/rand/src/distributions/unit_sphere.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/unit_sphere.rs 2019-07-17 05:42:23.000000000 +0000 @@ -6,27 +6,19 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use Rng; -use distributions::{Distribution, Uniform}; +#![allow(deprecated)] + +use crate::Rng; +use crate::distributions::{Distribution, Uniform}; /// Samples uniformly from the surface of the unit sphere in three dimensions. /// /// Implemented via a method by Marsaglia[^1]. /// -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{UnitSphereSurface, Distribution}; -/// -/// let sphere = UnitSphereSurface::new(); -/// let v = sphere.sample(&mut rand::thread_rng()); -/// println!("{:?} is from the unit sphere surface.", v) -/// ``` -/// /// [^1]: Marsaglia, George (1972). [*Choosing a Point from the Surface of a /// Sphere.*](https://doi.org/10.1214/aoms/1177692644) /// Ann. Math. Statist. 43, no. 2, 645--646. +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Copy, Debug)] pub struct UnitSphereSurface; @@ -56,7 +48,7 @@ #[cfg(test)] mod tests { - use distributions::Distribution; + use crate::distributions::Distribution; use super::UnitSphereSurface; /// Assert that two numbers are almost equal to each other. @@ -77,7 +69,7 @@ #[test] fn norm() { - let mut rng = ::test::rng(1); + let mut rng = crate::test::rng(1); let dist = UnitSphereSurface::new(); for _ in 0..1000 { let x = dist.sample(&mut rng); @@ -87,13 +79,17 @@ #[test] fn value_stability() { - let mut rng = ::test::rng(2); - let dist = UnitSphereSurface::new(); - assert_eq!(dist.sample(&mut rng), - [-0.24950027180862533, -0.7552572587896719, 0.6060825747478084]); - assert_eq!(dist.sample(&mut rng), - [0.47604534507233487, -0.797200864987207, -0.3712837328763685]); - assert_eq!(dist.sample(&mut rng), - [0.9795722330927367, 0.18692349236651176, 0.07414747571708524]); + let mut rng = crate::test::rng(2); + let expected = [ + [0.03247542860231647, -0.7830477442152738, 0.6211131755296027], + [-0.09978440840914075, 0.9706650829833128, -0.21875184231323952], + [0.2735582468624679, 0.9435374242279655, -0.1868234852870203], + ]; + let samples = [ + UnitSphereSurface.sample(&mut rng), + UnitSphereSurface.sample(&mut rng), + UnitSphereSurface.sample(&mut rng), + ]; + assert_eq!(samples, expected); } } diff -Nru cargo-0.35.0/vendor/rand/src/distributions/utils.rs cargo-0.37.0/vendor/rand/src/distributions/utils.rs --- cargo-0.35.0/vendor/rand/src/distributions/utils.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/utils.rs 2019-07-17 05:42:23.000000000 +0000 @@ -11,9 +11,9 @@ #[cfg(feature="simd_support")] use packed_simd::*; #[cfg(feature="std")] -use distributions::ziggurat_tables; +use crate::distributions::ziggurat_tables; #[cfg(feature="std")] -use Rng; +use crate::Rng; pub trait WideningMultiply { @@ -61,7 +61,7 @@ wmul_impl! { u8, u16, 8 } wmul_impl! { u16, u32, 16 } wmul_impl! { u32, u64, 32 } -#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] +#[cfg(not(target_os = "emscripten"))] wmul_impl! { u64, u128, 64 } // This code is a translation of the __mulddi3 function in LLVM's @@ -125,9 +125,9 @@ )+ }; } -#[cfg(not(all(rustc_1_26, not(target_os = "emscripten"))))] +#[cfg(target_os = "emscripten")] wmul_impl_large! { u64, 32 } -#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] +#[cfg(not(target_os = "emscripten"))] wmul_impl_large! { u128, 64 } macro_rules! wmul_impl_usize { @@ -383,6 +383,7 @@ <$ty>::from_bits(<$uty>::from_bits(self) + <$uty>::from_bits(mask)) } type UInt = $uty; + #[inline] fn cast_from_int(i: Self::UInt) -> Self { i.cast() } } } @@ -464,7 +465,7 @@ mut pdf: P, mut zero_case: Z) -> f64 where P: FnMut(f64) -> f64, Z: FnMut(&mut R, f64) -> f64 { - use distributions::float::IntoFloat; + use crate::distributions::float::IntoFloat; loop { // As an optimisation we re-implement the conversion to a f64. // From the remaining 12 most significant bits we use 8 to construct `i`. diff -Nru cargo-0.35.0/vendor/rand/src/distributions/weibull.rs cargo-0.37.0/vendor/rand/src/distributions/weibull.rs --- cargo-0.35.0/vendor/rand/src/distributions/weibull.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/weibull.rs 2019-07-17 05:42:23.000000000 +0000 @@ -7,20 +7,13 @@ // except according to those terms. //! The Weibull distribution. +#![allow(deprecated)] -use Rng; -use distributions::{Distribution, OpenClosed01}; +use crate::Rng; +use crate::distributions::{Distribution, OpenClosed01}; /// Samples floating-point numbers according to the Weibull distribution -/// -/// # Example -/// ``` -/// use rand::prelude::*; -/// use rand::distributions::Weibull; -/// -/// let val: f64 = SmallRng::from_entropy().sample(Weibull::new(1., 10.)); -/// println!("{}", val); -/// ``` +#[deprecated(since="0.7.0", note="moved to rand_distr crate")] #[derive(Clone, Copy, Debug)] pub struct Weibull { inv_shape: f64, @@ -48,7 +41,7 @@ #[cfg(test)] mod tests { - use distributions::Distribution; + use crate::distributions::Distribution; use super::Weibull; #[test] @@ -62,7 +55,7 @@ let scale = 1.0; let shape = 2.0; let d = Weibull::new(scale, shape); - let mut rng = ::test::rng(1); + let mut rng = crate::test::rng(1); for _ in 0..1000 { let r = d.sample(&mut rng); assert!(r >= 0.); diff -Nru cargo-0.35.0/vendor/rand/src/distributions/weighted/alias_method.rs cargo-0.37.0/vendor/rand/src/distributions/weighted/alias_method.rs --- cargo-0.35.0/vendor/rand/src/distributions/weighted/alias_method.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/weighted/alias_method.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,499 @@ +//! This module contains an implementation of alias method for sampling random +//! indices with probabilities proportional to a collection of weights. + +use super::WeightedError; +#[cfg(not(feature = "std"))] +use crate::alloc::vec::Vec; +#[cfg(not(feature = "std"))] +use crate::alloc::vec; +use core::fmt; +use core::iter::Sum; +use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign}; +use crate::distributions::uniform::SampleUniform; +use crate::distributions::Distribution; +use crate::distributions::Uniform; +use crate::Rng; + +/// A distribution using weighted sampling to pick a discretely selected item. +/// +/// Sampling a [`WeightedIndex`] distribution returns the index of a randomly +/// selected element from the vector used to create the [`WeightedIndex`]. +/// The chance of a given element being picked is proportional to the value of +/// the element. The weights can have any type `W` for which a implementation of +/// [`Weight`] exists. +/// +/// # Performance +/// +/// Given that `n` is the number of items in the vector used to create an +/// [`WeightedIndex`], [`WeightedIndex`] will require `O(n)` amount of +/// memory. More specifically it takes up some constant amount of memory plus +/// the vector used to create it and a [`Vec`] with capacity `n`. +/// +/// Time complexity for the creation of a [`WeightedIndex`] is `O(n)`. +/// Sampling is `O(1)`, it makes a call to [`Uniform::sample`] and a call +/// to [`Uniform::sample`]. +/// +/// # Example +/// +/// ``` +/// use rand::distributions::weighted::alias_method::WeightedIndex; +/// use rand::prelude::*; +/// +/// let choices = vec!['a', 'b', 'c']; +/// let weights = vec![2, 1, 1]; +/// let dist = WeightedIndex::new(weights).unwrap(); +/// let mut rng = thread_rng(); +/// for _ in 0..100 { +/// // 50% chance to print 'a', 25% chance to print 'b', 25% chance to print 'c' +/// println!("{}", choices[dist.sample(&mut rng)]); +/// } +/// +/// let items = [('a', 0), ('b', 3), ('c', 7)]; +/// let dist2 = WeightedIndex::new(items.iter().map(|item| item.1).collect()).unwrap(); +/// for _ in 0..100 { +/// // 0% chance to print 'a', 30% chance to print 'b', 70% chance to print 'c' +/// println!("{}", items[dist2.sample(&mut rng)].0); +/// } +/// ``` +/// +/// [`WeightedIndex`]: crate::distributions::weighted::alias_method::WeightedIndex +/// [`Weight`]: crate::distributions::weighted::alias_method::Weight +/// [`Vec`]: Vec +/// [`Uniform::sample`]: Distribution::sample +/// [`Uniform::sample`]: Distribution::sample +pub struct WeightedIndex { + aliases: Vec, + no_alias_odds: Vec, + uniform_index: Uniform, + uniform_within_weight_sum: Uniform, +} + +impl WeightedIndex { + /// Creates a new [`WeightedIndex`]. + /// + /// Returns an error if: + /// - The vector is empty. + /// - The vector is longer than `u32::MAX`. + /// - For any weight `w`: `w < 0` or `w > max` where `max = W::MAX / + /// weights.len()`. + /// - The sum of weights is zero. + pub fn new(weights: Vec) -> Result { + let n = weights.len(); + if n == 0 { + return Err(WeightedError::NoItem); + } else if n > ::core::u32::MAX as usize { + return Err(WeightedError::TooMany); + } + let n = n as u32; + + let max_weight_size = W::try_from_u32_lossy(n) + .map(|n| W::MAX / n) + .unwrap_or(W::ZERO); + if !weights + .iter() + .all(|&w| W::ZERO <= w && w <= max_weight_size) + { + return Err(WeightedError::InvalidWeight); + } + + // The sum of weights will represent 100% of no alias odds. + let weight_sum = Weight::sum(weights.as_slice()); + // Prevent floating point overflow due to rounding errors. + let weight_sum = if weight_sum > W::MAX { + W::MAX + } else { + weight_sum + }; + if weight_sum == W::ZERO { + return Err(WeightedError::AllWeightsZero); + } + + // `weight_sum` would have been zero if `try_from_lossy` causes an error here. + let n_converted = W::try_from_u32_lossy(n).unwrap(); + + let mut no_alias_odds = weights; + for odds in no_alias_odds.iter_mut() { + *odds *= n_converted; + // Prevent floating point overflow due to rounding errors. + *odds = if *odds > W::MAX { W::MAX } else { *odds }; + } + + /// This struct is designed to contain three data structures at once, + /// sharing the same memory. More precisely it contains two linked lists + /// and an alias map, which will be the output of this method. To keep + /// the three data structures from getting in each other's way, it must + /// be ensured that a single index is only ever in one of them at the + /// same time. + struct Aliases { + aliases: Vec, + smalls_head: u32, + bigs_head: u32, + } + + impl Aliases { + fn new(size: u32) -> Self { + Aliases { + aliases: vec![0; size as usize], + smalls_head: ::core::u32::MAX, + bigs_head: ::core::u32::MAX, + } + } + + fn push_small(&mut self, idx: u32) { + self.aliases[idx as usize] = self.smalls_head; + self.smalls_head = idx; + } + + fn push_big(&mut self, idx: u32) { + self.aliases[idx as usize] = self.bigs_head; + self.bigs_head = idx; + } + + fn pop_small(&mut self) -> u32 { + let popped = self.smalls_head; + self.smalls_head = self.aliases[popped as usize]; + popped + } + + fn pop_big(&mut self) -> u32 { + let popped = self.bigs_head; + self.bigs_head = self.aliases[popped as usize]; + popped + } + + fn smalls_is_empty(&self) -> bool { + self.smalls_head == ::core::u32::MAX + } + + fn bigs_is_empty(&self) -> bool { + self.bigs_head == ::core::u32::MAX + } + + fn set_alias(&mut self, idx: u32, alias: u32) { + self.aliases[idx as usize] = alias; + } + } + + let mut aliases = Aliases::new(n); + + // Split indices into those with small weights and those with big weights. + for (index, &odds) in no_alias_odds.iter().enumerate() { + if odds < weight_sum { + aliases.push_small(index as u32); + } else { + aliases.push_big(index as u32); + } + } + + // Build the alias map by finding an alias with big weight for each index with + // small weight. + while !aliases.smalls_is_empty() && !aliases.bigs_is_empty() { + let s = aliases.pop_small(); + let b = aliases.pop_big(); + + aliases.set_alias(s, b); + no_alias_odds[b as usize] = no_alias_odds[b as usize] + - weight_sum + + no_alias_odds[s as usize]; + + if no_alias_odds[b as usize] < weight_sum { + aliases.push_small(b); + } else { + aliases.push_big(b); + } + } + + // The remaining indices should have no alias odds of about 100%. This is due to + // numeric accuracy. Otherwise they would be exactly 100%. + while !aliases.smalls_is_empty() { + no_alias_odds[aliases.pop_small() as usize] = weight_sum; + } + while !aliases.bigs_is_empty() { + no_alias_odds[aliases.pop_big() as usize] = weight_sum; + } + + // Prepare distributions for sampling. Creating them beforehand improves + // sampling performance. + let uniform_index = Uniform::new(0, n); + let uniform_within_weight_sum = Uniform::new(W::ZERO, weight_sum); + + Ok(Self { + aliases: aliases.aliases, + no_alias_odds, + uniform_index, + uniform_within_weight_sum, + }) + } +} + +impl Distribution for WeightedIndex { + fn sample(&self, rng: &mut R) -> usize { + let candidate = rng.sample(self.uniform_index); + if rng.sample(&self.uniform_within_weight_sum) < self.no_alias_odds[candidate as usize] { + candidate as usize + } else { + self.aliases[candidate as usize] as usize + } + } +} + +impl fmt::Debug for WeightedIndex +where + W: fmt::Debug, + Uniform: fmt::Debug, +{ + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("WeightedIndex") + .field("aliases", &self.aliases) + .field("no_alias_odds", &self.no_alias_odds) + .field("uniform_index", &self.uniform_index) + .field("uniform_within_weight_sum", &self.uniform_within_weight_sum) + .finish() + } +} + +impl Clone for WeightedIndex +where + Uniform: Clone, +{ + fn clone(&self) -> Self { + Self { + aliases: self.aliases.clone(), + no_alias_odds: self.no_alias_odds.clone(), + uniform_index: self.uniform_index.clone(), + uniform_within_weight_sum: self.uniform_within_weight_sum.clone(), + } + } +} + +/// Trait that must be implemented for weights, that are used with +/// [`WeightedIndex`]. Currently no guarantees on the correctness of +/// [`WeightedIndex`] are given for custom implementations of this trait. +pub trait Weight: + Sized + + Copy + + SampleUniform + + PartialOrd + + Add + + AddAssign + + Sub + + SubAssign + + Mul + + MulAssign + + Div + + DivAssign + + Sum +{ + /// Maximum number representable by `Self`. + const MAX: Self; + + /// Element of `Self` equivalent to 0. + const ZERO: Self; + + /// Produce an instance of `Self` from a `u32` value, or return `None` if + /// out of range. Loss of precision (where `Self` is a floating point type) + /// is acceptable. + fn try_from_u32_lossy(n: u32) -> Option; + + /// Sums all values in slice `values`. + fn sum(values: &[Self]) -> Self { + values.iter().map(|x| *x).sum() + } +} + +macro_rules! impl_weight_for_float { + ($T: ident) => { + impl Weight for $T { + const MAX: Self = ::core::$T::MAX; + const ZERO: Self = 0.0; + + fn try_from_u32_lossy(n: u32) -> Option { + Some(n as $T) + } + + fn sum(values: &[Self]) -> Self { + pairwise_sum(values) + } + } + }; +} + +/// In comparison to naive accumulation, the pairwise sum algorithm reduces +/// rounding errors when there are many floating point values. +fn pairwise_sum(values: &[T]) -> T { + if values.len() <= 32 { + values.iter().map(|x| *x).sum() + } else { + let mid = values.len() / 2; + let (a, b) = values.split_at(mid); + pairwise_sum(a) + pairwise_sum(b) + } +} + +macro_rules! impl_weight_for_int { + ($T: ident) => { + impl Weight for $T { + const MAX: Self = ::core::$T::MAX; + const ZERO: Self = 0; + + fn try_from_u32_lossy(n: u32) -> Option { + let n_converted = n as Self; + if n_converted >= Self::ZERO && n_converted as u32 == n { + Some(n_converted) + } else { + None + } + } + } + }; +} + +impl_weight_for_float!(f64); +impl_weight_for_float!(f32); +impl_weight_for_int!(usize); +#[cfg(not(target_os = "emscripten"))] +impl_weight_for_int!(u128); +impl_weight_for_int!(u64); +impl_weight_for_int!(u32); +impl_weight_for_int!(u16); +impl_weight_for_int!(u8); +impl_weight_for_int!(isize); +#[cfg(not(target_os = "emscripten"))] +impl_weight_for_int!(i128); +impl_weight_for_int!(i64); +impl_weight_for_int!(i32); +impl_weight_for_int!(i16); +impl_weight_for_int!(i8); + +#[cfg(test)] +mod test { + use super::*; + + #[test] + #[cfg(not(miri))] // Miri is too slow + fn test_weighted_index_f32() { + test_weighted_index(f32::into); + + // Floating point special cases + assert_eq!( + WeightedIndex::new(vec![::core::f32::INFINITY]).unwrap_err(), + WeightedError::InvalidWeight + ); + assert_eq!( + WeightedIndex::new(vec![-0_f32]).unwrap_err(), + WeightedError::AllWeightsZero + ); + assert_eq!( + WeightedIndex::new(vec![-1_f32]).unwrap_err(), + WeightedError::InvalidWeight + ); + assert_eq!( + WeightedIndex::new(vec![-::core::f32::INFINITY]).unwrap_err(), + WeightedError::InvalidWeight + ); + assert_eq!( + WeightedIndex::new(vec![::core::f32::NAN]).unwrap_err(), + WeightedError::InvalidWeight + ); + } + + #[cfg(not(target_os = "emscripten"))] + #[test] + #[cfg(not(miri))] // Miri is too slow + fn test_weighted_index_u128() { + test_weighted_index(|x: u128| x as f64); + } + + #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] + #[test] + #[cfg(not(miri))] // Miri is too slow + fn test_weighted_index_i128() { + test_weighted_index(|x: i128| x as f64); + + // Signed integer special cases + assert_eq!( + WeightedIndex::new(vec![-1_i128]).unwrap_err(), + WeightedError::InvalidWeight + ); + assert_eq!( + WeightedIndex::new(vec![::core::i128::MIN]).unwrap_err(), + WeightedError::InvalidWeight + ); + } + + #[test] + #[cfg(not(miri))] // Miri is too slow + fn test_weighted_index_u8() { + test_weighted_index(u8::into); + } + + #[test] + #[cfg(not(miri))] // Miri is too slow + fn test_weighted_index_i8() { + test_weighted_index(i8::into); + + // Signed integer special cases + assert_eq!( + WeightedIndex::new(vec![-1_i8]).unwrap_err(), + WeightedError::InvalidWeight + ); + assert_eq!( + WeightedIndex::new(vec![::core::i8::MIN]).unwrap_err(), + WeightedError::InvalidWeight + ); + } + + fn test_weighted_index f64>(w_to_f64: F) + where + WeightedIndex: fmt::Debug, + { + const NUM_WEIGHTS: u32 = 10; + const ZERO_WEIGHT_INDEX: u32 = 3; + const NUM_SAMPLES: u32 = 15000; + let mut rng = crate::test::rng(0x9c9fa0b0580a7031); + + let weights = { + let mut weights = Vec::with_capacity(NUM_WEIGHTS as usize); + let random_weight_distribution = crate::distributions::Uniform::new_inclusive( + W::ZERO, + W::MAX / W::try_from_u32_lossy(NUM_WEIGHTS).unwrap(), + ); + for _ in 0..NUM_WEIGHTS { + weights.push(rng.sample(&random_weight_distribution)); + } + weights[ZERO_WEIGHT_INDEX as usize] = W::ZERO; + weights + }; + let weight_sum = weights.iter().map(|w| *w).sum::(); + let expected_counts = weights + .iter() + .map(|&w| w_to_f64(w) / w_to_f64(weight_sum) * NUM_SAMPLES as f64) + .collect::>(); + let weight_distribution = WeightedIndex::new(weights).unwrap(); + + let mut counts = vec![0; NUM_WEIGHTS as usize]; + for _ in 0..NUM_SAMPLES { + counts[rng.sample(&weight_distribution)] += 1; + } + + assert_eq!(counts[ZERO_WEIGHT_INDEX as usize], 0); + for (count, expected_count) in counts.into_iter().zip(expected_counts) { + let difference = (count as f64 - expected_count).abs(); + let max_allowed_difference = NUM_SAMPLES as f64 / NUM_WEIGHTS as f64 * 0.1; + assert!(difference <= max_allowed_difference); + } + + assert_eq!( + WeightedIndex::::new(vec![]).unwrap_err(), + WeightedError::NoItem + ); + assert_eq!( + WeightedIndex::new(vec![W::ZERO]).unwrap_err(), + WeightedError::AllWeightsZero + ); + assert_eq!( + WeightedIndex::new(vec![W::MAX, W::MAX]).unwrap_err(), + WeightedError::InvalidWeight + ); + } +} diff -Nru cargo-0.35.0/vendor/rand/src/distributions/weighted/mod.rs cargo-0.37.0/vendor/rand/src/distributions/weighted/mod.rs --- cargo-0.35.0/vendor/rand/src/distributions/weighted/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/weighted/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,248 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Weighted index sampling +//! +//! This module provides two implementations for sampling indices: +//! +//! * [`WeightedIndex`] allows `O(log N)` sampling +//! * [`alias_method::WeightedIndex`] allows `O(1)` sampling, but with +//! much greater set-up cost +//! +//! [`alias_method::WeightedIndex`]: alias_method/struct.WeightedIndex.html + +pub mod alias_method; + +use crate::Rng; +use crate::distributions::Distribution; +use crate::distributions::uniform::{UniformSampler, SampleUniform, SampleBorrow}; +use core::cmp::PartialOrd; +use core::fmt; + +// Note that this whole module is only imported if feature="alloc" is enabled. +#[cfg(not(feature="std"))] use crate::alloc::vec::Vec; + +/// A distribution using weighted sampling to pick a discretely selected +/// item. +/// +/// Sampling a `WeightedIndex` distribution returns the index of a randomly +/// selected element from the iterator used when the `WeightedIndex` was +/// created. The chance of a given element being picked is proportional to the +/// value of the element. The weights can use any type `X` for which an +/// implementation of [`Uniform`] exists. +/// +/// # Performance +/// +/// A `WeightedIndex` contains a `Vec` and a [`Uniform`] and so its +/// size is the sum of the size of those objects, possibly plus some alignment. +/// +/// Creating a `WeightedIndex` will allocate enough space to hold `N - 1` +/// weights of type `X`, where `N` is the number of weights. However, since +/// `Vec` doesn't guarantee a particular growth strategy, additional memory +/// might be allocated but not used. Since the `WeightedIndex` object also +/// contains, this might cause additional allocations, though for primitive +/// types, ['Uniform`] doesn't allocate any memory. +/// +/// Time complexity of sampling from `WeightedIndex` is `O(log N)` where +/// `N` is the number of weights. +/// +/// Sampling from `WeightedIndex` will result in a single call to +/// `Uniform::sample` (method of the [`Distribution`] trait), which typically +/// will request a single value from the underlying [`RngCore`], though the +/// exact number depends on the implementaiton of `Uniform::sample`. +/// +/// # Example +/// +/// ``` +/// use rand::prelude::*; +/// use rand::distributions::WeightedIndex; +/// +/// let choices = ['a', 'b', 'c']; +/// let weights = [2, 1, 1]; +/// let dist = WeightedIndex::new(&weights).unwrap(); +/// let mut rng = thread_rng(); +/// for _ in 0..100 { +/// // 50% chance to print 'a', 25% chance to print 'b', 25% chance to print 'c' +/// println!("{}", choices[dist.sample(&mut rng)]); +/// } +/// +/// let items = [('a', 0), ('b', 3), ('c', 7)]; +/// let dist2 = WeightedIndex::new(items.iter().map(|item| item.1)).unwrap(); +/// for _ in 0..100 { +/// // 0% chance to print 'a', 30% chance to print 'b', 70% chance to print 'c' +/// println!("{}", items[dist2.sample(&mut rng)].0); +/// } +/// ``` +/// +/// [`Uniform`]: crate::distributions::uniform::Uniform +/// [`RngCore`]: crate::RngCore +#[derive(Debug, Clone)] +pub struct WeightedIndex { + cumulative_weights: Vec, + weight_distribution: X::Sampler, +} + +impl WeightedIndex { + /// Creates a new a `WeightedIndex` [`Distribution`] using the values + /// in `weights`. The weights can use any type `X` for which an + /// implementation of [`Uniform`] exists. + /// + /// Returns an error if the iterator is empty, if any weight is `< 0`, or + /// if its total value is 0. + /// + /// [`Uniform`]: crate::distributions::uniform::Uniform + pub fn new(weights: I) -> Result, WeightedError> + where I: IntoIterator, + I::Item: SampleBorrow, + X: for<'a> ::core::ops::AddAssign<&'a X> + + Clone + + Default { + let mut iter = weights.into_iter(); + let mut total_weight: X = iter.next() + .ok_or(WeightedError::NoItem)? + .borrow() + .clone(); + + let zero = ::default(); + if total_weight < zero { + return Err(WeightedError::InvalidWeight); + } + + let mut weights = Vec::::with_capacity(iter.size_hint().0); + for w in iter { + if *w.borrow() < zero { + return Err(WeightedError::InvalidWeight); + } + weights.push(total_weight.clone()); + total_weight += w.borrow(); + } + + if total_weight == zero { + return Err(WeightedError::AllWeightsZero); + } + let distr = X::Sampler::new(zero, total_weight); + + Ok(WeightedIndex { cumulative_weights: weights, weight_distribution: distr }) + } +} + +impl Distribution for WeightedIndex where + X: SampleUniform + PartialOrd { + fn sample(&self, rng: &mut R) -> usize { + use ::core::cmp::Ordering; + let chosen_weight = self.weight_distribution.sample(rng); + // Find the first item which has a weight *higher* than the chosen weight. + self.cumulative_weights.binary_search_by( + |w| if *w <= chosen_weight { Ordering::Less } else { Ordering::Greater }).unwrap_err() + } +} + +#[cfg(test)] +mod test { + use super::*; + + #[test] + #[cfg(not(miri))] // Miri is too slow + fn test_weightedindex() { + let mut r = crate::test::rng(700); + const N_REPS: u32 = 5000; + let weights = [1u32, 2, 3, 0, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7]; + let total_weight = weights.iter().sum::() as f32; + + let verify = |result: [i32; 14]| { + for (i, count) in result.iter().enumerate() { + let exp = (weights[i] * N_REPS) as f32 / total_weight; + let mut err = (*count as f32 - exp).abs(); + if err != 0.0 { + err /= exp; + } + assert!(err <= 0.25); + } + }; + + // WeightedIndex from vec + let mut chosen = [0i32; 14]; + let distr = WeightedIndex::new(weights.to_vec()).unwrap(); + for _ in 0..N_REPS { + chosen[distr.sample(&mut r)] += 1; + } + verify(chosen); + + // WeightedIndex from slice + chosen = [0i32; 14]; + let distr = WeightedIndex::new(&weights[..]).unwrap(); + for _ in 0..N_REPS { + chosen[distr.sample(&mut r)] += 1; + } + verify(chosen); + + // WeightedIndex from iterator + chosen = [0i32; 14]; + let distr = WeightedIndex::new(weights.iter()).unwrap(); + for _ in 0..N_REPS { + chosen[distr.sample(&mut r)] += 1; + } + verify(chosen); + + for _ in 0..5 { + assert_eq!(WeightedIndex::new(&[0, 1]).unwrap().sample(&mut r), 1); + assert_eq!(WeightedIndex::new(&[1, 0]).unwrap().sample(&mut r), 0); + assert_eq!(WeightedIndex::new(&[0, 0, 0, 0, 10, 0]).unwrap().sample(&mut r), 4); + } + + assert_eq!(WeightedIndex::new(&[10][0..0]).unwrap_err(), WeightedError::NoItem); + assert_eq!(WeightedIndex::new(&[0]).unwrap_err(), WeightedError::AllWeightsZero); + assert_eq!(WeightedIndex::new(&[10, 20, -1, 30]).unwrap_err(), WeightedError::InvalidWeight); + assert_eq!(WeightedIndex::new(&[-10, 20, 1, 30]).unwrap_err(), WeightedError::InvalidWeight); + assert_eq!(WeightedIndex::new(&[-10]).unwrap_err(), WeightedError::InvalidWeight); + } +} + +/// Error type returned from `WeightedIndex::new`. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum WeightedError { + /// The provided weight collection contains no items. + NoItem, + + /// A weight is either less than zero, greater than the supported maximum or + /// otherwise invalid. + InvalidWeight, + + /// All items in the provided weight collection are zero. + AllWeightsZero, + + /// Too many weights are provided (length greater than `u32::MAX`) + TooMany, +} + +impl WeightedError { + fn msg(&self) -> &str { + match *self { + WeightedError::NoItem => "No weights provided.", + WeightedError::InvalidWeight => "A weight is invalid.", + WeightedError::AllWeightsZero => "All weights are zero.", + WeightedError::TooMany => "Too many weights (hit u32::MAX)", + } + } +} + +#[cfg(feature="std")] +impl ::std::error::Error for WeightedError { + fn description(&self) -> &str { + self.msg() + } + fn cause(&self) -> Option<&dyn (::std::error::Error)> { + None + } +} + +impl fmt::Display for WeightedError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.msg()) + } +} diff -Nru cargo-0.35.0/vendor/rand/src/distributions/weighted.rs cargo-0.37.0/vendor/rand/src/distributions/weighted.rs --- cargo-0.35.0/vendor/rand/src/distributions/weighted.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/distributions/weighted.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,230 +0,0 @@ -// Copyright 2018 Developers of the Rand project. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use Rng; -use distributions::Distribution; -use distributions::uniform::{UniformSampler, SampleUniform, SampleBorrow}; -use ::core::cmp::PartialOrd; -use core::fmt; - -// Note that this whole module is only imported if feature="alloc" is enabled. -#[cfg(not(feature="std"))] use alloc::vec::Vec; - -/// A distribution using weighted sampling to pick a discretely selected -/// item. -/// -/// Sampling a `WeightedIndex` distribution returns the index of a randomly -/// selected element from the iterator used when the `WeightedIndex` was -/// created. The chance of a given element being picked is proportional to the -/// value of the element. The weights can use any type `X` for which an -/// implementation of [`Uniform`] exists. -/// -/// # Performance -/// -/// A `WeightedIndex` contains a `Vec` and a [`Uniform`] and so its -/// size is the sum of the size of those objects, possibly plus some alignment. -/// -/// Creating a `WeightedIndex` will allocate enough space to hold `N - 1` -/// weights of type `X`, where `N` is the number of weights. However, since -/// `Vec` doesn't guarantee a particular growth strategy, additional memory -/// might be allocated but not used. Since the `WeightedIndex` object also -/// contains, this might cause additional allocations, though for primitive -/// types, ['Uniform`] doesn't allocate any memory. -/// -/// Time complexity of sampling from `WeightedIndex` is `O(log N)` where -/// `N` is the number of weights. -/// -/// Sampling from `WeightedIndex` will result in a single call to -/// `Uniform::sample` (method of the [`Distribution`] trait), which typically -/// will request a single value from the underlying [`RngCore`], though the -/// exact number depends on the implementaiton of `Uniform::sample`. -/// -/// # Example -/// -/// ``` -/// use rand::prelude::*; -/// use rand::distributions::WeightedIndex; -/// -/// let choices = ['a', 'b', 'c']; -/// let weights = [2, 1, 1]; -/// let dist = WeightedIndex::new(&weights).unwrap(); -/// let mut rng = thread_rng(); -/// for _ in 0..100 { -/// // 50% chance to print 'a', 25% chance to print 'b', 25% chance to print 'c' -/// println!("{}", choices[dist.sample(&mut rng)]); -/// } -/// -/// let items = [('a', 0), ('b', 3), ('c', 7)]; -/// let dist2 = WeightedIndex::new(items.iter().map(|item| item.1)).unwrap(); -/// for _ in 0..100 { -/// // 0% chance to print 'a', 30% chance to print 'b', 70% chance to print 'c' -/// println!("{}", items[dist2.sample(&mut rng)].0); -/// } -/// ``` -/// -/// [`Uniform`]: crate::distributions::uniform::Uniform -/// [`RngCore`]: rand_core::RngCore -#[derive(Debug, Clone)] -pub struct WeightedIndex { - cumulative_weights: Vec, - weight_distribution: X::Sampler, -} - -impl WeightedIndex { - /// Creates a new a `WeightedIndex` [`Distribution`] using the values - /// in `weights`. The weights can use any type `X` for which an - /// implementation of [`Uniform`] exists. - /// - /// Returns an error if the iterator is empty, if any weight is `< 0`, or - /// if its total value is 0. - /// - /// [`Uniform`]: crate::distributions::uniform::Uniform - pub fn new(weights: I) -> Result, WeightedError> - where I: IntoIterator, - I::Item: SampleBorrow, - X: for<'a> ::core::ops::AddAssign<&'a X> + - Clone + - Default { - let mut iter = weights.into_iter(); - let mut total_weight: X = iter.next() - .ok_or(WeightedError::NoItem)? - .borrow() - .clone(); - - let zero = ::default(); - if total_weight < zero { - return Err(WeightedError::NegativeWeight); - } - - let mut weights = Vec::::with_capacity(iter.size_hint().0); - for w in iter { - if *w.borrow() < zero { - return Err(WeightedError::NegativeWeight); - } - weights.push(total_weight.clone()); - total_weight += w.borrow(); - } - - if total_weight == zero { - return Err(WeightedError::AllWeightsZero); - } - let distr = X::Sampler::new(zero, total_weight); - - Ok(WeightedIndex { cumulative_weights: weights, weight_distribution: distr }) - } -} - -impl Distribution for WeightedIndex where - X: SampleUniform + PartialOrd { - fn sample(&self, rng: &mut R) -> usize { - use ::core::cmp::Ordering; - let chosen_weight = self.weight_distribution.sample(rng); - // Find the first item which has a weight *higher* than the chosen weight. - self.cumulative_weights.binary_search_by( - |w| if *w <= chosen_weight { Ordering::Less } else { Ordering::Greater }).unwrap_err() - } -} - -#[cfg(test)] -mod test { - use super::*; - - #[test] - fn test_weightedindex() { - let mut r = ::test::rng(700); - const N_REPS: u32 = 5000; - let weights = [1u32, 2, 3, 0, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7]; - let total_weight = weights.iter().sum::() as f32; - - let verify = |result: [i32; 14]| { - for (i, count) in result.iter().enumerate() { - let exp = (weights[i] * N_REPS) as f32 / total_weight; - let mut err = (*count as f32 - exp).abs(); - if err != 0.0 { - err /= exp; - } - assert!(err <= 0.25); - } - }; - - // WeightedIndex from vec - let mut chosen = [0i32; 14]; - let distr = WeightedIndex::new(weights.to_vec()).unwrap(); - for _ in 0..N_REPS { - chosen[distr.sample(&mut r)] += 1; - } - verify(chosen); - - // WeightedIndex from slice - chosen = [0i32; 14]; - let distr = WeightedIndex::new(&weights[..]).unwrap(); - for _ in 0..N_REPS { - chosen[distr.sample(&mut r)] += 1; - } - verify(chosen); - - // WeightedIndex from iterator - chosen = [0i32; 14]; - let distr = WeightedIndex::new(weights.iter()).unwrap(); - for _ in 0..N_REPS { - chosen[distr.sample(&mut r)] += 1; - } - verify(chosen); - - for _ in 0..5 { - assert_eq!(WeightedIndex::new(&[0, 1]).unwrap().sample(&mut r), 1); - assert_eq!(WeightedIndex::new(&[1, 0]).unwrap().sample(&mut r), 0); - assert_eq!(WeightedIndex::new(&[0, 0, 0, 0, 10, 0]).unwrap().sample(&mut r), 4); - } - - assert_eq!(WeightedIndex::new(&[10][0..0]).unwrap_err(), WeightedError::NoItem); - assert_eq!(WeightedIndex::new(&[0]).unwrap_err(), WeightedError::AllWeightsZero); - assert_eq!(WeightedIndex::new(&[10, 20, -1, 30]).unwrap_err(), WeightedError::NegativeWeight); - assert_eq!(WeightedIndex::new(&[-10, 20, 1, 30]).unwrap_err(), WeightedError::NegativeWeight); - assert_eq!(WeightedIndex::new(&[-10]).unwrap_err(), WeightedError::NegativeWeight); - } -} - -/// Error type returned from `WeightedIndex::new`. -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum WeightedError { - /// The provided iterator contained no items. - NoItem, - - /// A weight lower than zero was used. - NegativeWeight, - - /// All items in the provided iterator had a weight of zero. - AllWeightsZero, -} - -impl WeightedError { - fn msg(&self) -> &str { - match *self { - WeightedError::NoItem => "No items found", - WeightedError::NegativeWeight => "Item has negative weight", - WeightedError::AllWeightsZero => "All items had weight zero", - } - } -} - -#[cfg(feature="std")] -impl ::std::error::Error for WeightedError { - fn description(&self) -> &str { - self.msg() - } - fn cause(&self) -> Option<&::std::error::Error> { - None - } -} - -impl fmt::Display for WeightedError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", self.msg()) - } -} diff -Nru cargo-0.35.0/vendor/rand/src/lib.rs cargo-0.37.0/vendor/rand/src/lib.rs --- cargo-0.35.0/vendor/rand/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -53,110 +53,60 @@ #![cfg_attr(all(feature="alloc", not(feature="std")), feature(alloc))] #![cfg_attr(all(feature="simd_support", feature="nightly"), feature(stdsimd))] -#[cfg(feature = "std")] extern crate core; -#[cfg(all(feature = "alloc", not(feature="std")))] #[macro_use] extern crate alloc; +#[cfg(all(feature="alloc", not(feature="std")))] +extern crate alloc; -#[cfg(feature="simd_support")] extern crate packed_simd; +#[cfg(feature = "getrandom")] +use getrandom_package as getrandom; -extern crate rand_jitter; -#[cfg(feature = "rand_os")] -extern crate rand_os; - -extern crate rand_core; -extern crate rand_isaac; // only for deprecations -extern crate rand_chacha; // only for deprecations -extern crate rand_hc; -extern crate rand_pcg; -extern crate rand_xorshift; - -#[cfg(feature = "log")] #[macro_use] extern crate log; #[allow(unused)] -#[cfg(not(feature = "log"))] macro_rules! trace { ($($x:tt)*) => () } +macro_rules! trace { ($($x:tt)*) => ( + #[cfg(feature = "log")] { + log::trace!($($x)*) + } +) } #[allow(unused)] -#[cfg(not(feature = "log"))] macro_rules! debug { ($($x:tt)*) => () } +macro_rules! debug { ($($x:tt)*) => ( + #[cfg(feature = "log")] { + log::debug!($($x)*) + } +) } #[allow(unused)] -#[cfg(not(feature = "log"))] macro_rules! info { ($($x:tt)*) => () } +macro_rules! info { ($($x:tt)*) => ( + #[cfg(feature = "log")] { + log::info!($($x)*) + } +) } #[allow(unused)] -#[cfg(not(feature = "log"))] macro_rules! warn { ($($x:tt)*) => () } +macro_rules! warn { ($($x:tt)*) => ( + #[cfg(feature = "log")] { + log::warn!($($x)*) + } +) } #[allow(unused)] -#[cfg(not(feature = "log"))] macro_rules! error { ($($x:tt)*) => () } - +macro_rules! error { ($($x:tt)*) => ( + #[cfg(feature = "log")] { + log::error!($($x)*) + } +) } // Re-exports from rand_core -pub use rand_core::{RngCore, CryptoRng, SeedableRng}; -pub use rand_core::{ErrorKind, Error}; +pub use rand_core::{RngCore, CryptoRng, SeedableRng, Error}; // Public exports -#[cfg(feature="std")] pub use rngs::thread::thread_rng; +#[cfg(feature="std")] pub use crate::rngs::thread::thread_rng; // Public modules pub mod distributions; pub mod prelude; -#[deprecated(since="0.6.0")] -pub mod prng; pub mod rngs; pub mod seq; -//////////////////////////////////////////////////////////////////////////////// -// Compatibility re-exports. Documentation is hidden; will be removed eventually. - -#[doc(hidden)] mod deprecated; - -#[allow(deprecated)] -#[doc(hidden)] pub use deprecated::ReseedingRng; - -#[allow(deprecated)] -#[cfg(feature="std")] #[doc(hidden)] pub use deprecated::EntropyRng; - -#[allow(deprecated)] -#[cfg(feature="rand_os")] -#[doc(hidden)] -pub use deprecated::OsRng; - -#[allow(deprecated)] -#[doc(hidden)] pub use deprecated::{ChaChaRng, IsaacRng, Isaac64Rng, XorShiftRng}; -#[allow(deprecated)] -#[doc(hidden)] pub use deprecated::StdRng; - - -#[allow(deprecated)] -#[doc(hidden)] -pub mod jitter { - pub use deprecated::JitterRng; - pub use rngs::TimerError; -} -#[allow(deprecated)] -#[cfg(feature="rand_os")] -#[doc(hidden)] -pub mod os { - pub use deprecated::OsRng; -} -#[allow(deprecated)] -#[doc(hidden)] -pub mod chacha { - pub use deprecated::ChaChaRng; -} -#[allow(deprecated)] -#[doc(hidden)] -pub mod isaac { - pub use deprecated::{IsaacRng, Isaac64Rng}; -} -#[allow(deprecated)] -#[cfg(feature="std")] -#[doc(hidden)] -pub mod read { - pub use deprecated::ReadRng; -} - -#[allow(deprecated)] -#[cfg(feature="std")] #[doc(hidden)] pub use deprecated::ThreadRng; - -//////////////////////////////////////////////////////////////////////////////// - use core::{mem, slice}; -use distributions::{Distribution, Standard}; -use distributions::uniform::{SampleUniform, UniformSampler, SampleBorrow}; +use core::num::Wrapping; +use crate::distributions::{Distribution, Standard}; +use crate::distributions::uniform::{SampleUniform, UniformSampler, SampleBorrow}; /// An automatically-implemented extension trait on [`RngCore`] providing high-level /// generic methods for sampling values and other convenience methods. @@ -198,8 +148,6 @@ pub trait Rng: RngCore { /// Return a random value supporting the [`Standard`] distribution. /// - /// [`Standard`]: distributions::Standard - /// /// # Example /// /// ``` @@ -210,8 +158,31 @@ /// println!("{}", x); /// println!("{:?}", rng.gen::<(f64, bool)>()); /// ``` + /// + /// # Arrays and tuples + /// + /// The `rng.gen()` method is able to generate arrays (up to 32 elements) + /// and tuples (up to 12 elements), so long as all element types can be + /// generated. + /// + /// For arrays of integers, especially for those with small element types + /// (< 64 bit), it will likely be faster to instead use [`Rng::fill`]. + /// + /// ``` + /// use rand::{thread_rng, Rng}; + /// + /// let mut rng = thread_rng(); + /// let tuple: (u8, i32, char) = rng.gen(); // arbitrary tuple support + /// + /// let arr1: [f32; 32] = rng.gen(); // array construction + /// let mut arr2 = [0u8; 128]; + /// rng.fill(&mut arr2); // array fill + /// ``` + /// + /// [`Standard`]: distributions::Standard #[inline] - fn gen(&mut self) -> T where Standard: Distribution { + fn gen(&mut self) -> T + where Standard: Distribution { Standard.sample(self) } @@ -240,8 +211,10 @@ /// /// [`Uniform`]: distributions::uniform::Uniform fn gen_range(&mut self, low: B1, high: B2) -> T - where B1: SampleBorrow + Sized, - B2: SampleBorrow + Sized { + where + B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized, + { T::Sampler::sample_single(low, high, self) } @@ -265,34 +238,39 @@ /// Create an iterator that generates values using the given distribution. /// + /// Note that this function takes its arguments by value. This works since + /// `(&mut R): Rng where R: Rng` and + /// `(&D): Distribution where D: Distribution`, + /// however borrowing is not automatic hence `rng.sample_iter(...)` may + /// need to be replaced with `(&mut rng).sample_iter(...)`. + /// /// # Example /// /// ``` /// use rand::{thread_rng, Rng}; /// use rand::distributions::{Alphanumeric, Uniform, Standard}; /// - /// let mut rng = thread_rng(); + /// let rng = thread_rng(); /// /// // Vec of 16 x f32: - /// let v: Vec = thread_rng().sample_iter(&Standard).take(16).collect(); + /// let v: Vec = rng.sample_iter(Standard).take(16).collect(); /// /// // String: - /// let s: String = rng.sample_iter(&Alphanumeric).take(7).collect(); + /// let s: String = rng.sample_iter(Alphanumeric).take(7).collect(); /// /// // Combined values - /// println!("{:?}", thread_rng().sample_iter(&Standard).take(5) + /// println!("{:?}", rng.sample_iter(Standard).take(5) /// .collect::>()); /// /// // Dice-rolling: /// let die_range = Uniform::new_inclusive(1, 6); - /// let mut roll_die = rng.sample_iter(&die_range); + /// let mut roll_die = rng.sample_iter(die_range); /// while roll_die.next().unwrap() != 6 { /// println!("Not a 6; rolling again!"); /// } /// ``` - fn sample_iter<'a, T, D: Distribution>(&'a mut self, distr: &'a D) - -> distributions::DistIter<'a, D, Self, T> where Self: Sized - { + fn sample_iter(self, distr: D) -> distributions::DistIter + where D: Distribution, Self: Sized { distr.sample_iter(self) } @@ -330,10 +308,8 @@ /// On big-endian platforms this performs byte-swapping to ensure /// portability of results from reproducible generators. /// - /// This uses [`try_fill_bytes`] internally and forwards all RNG errors. In - /// some cases errors may be resolvable; see [`ErrorKind`] and - /// documentation for the RNG in use. If you do not plan to handle these - /// errors you may prefer to use [`fill`]. + /// This is identical to [`fill`] except that it uses [`try_fill_bytes`] + /// internally and forwards RNG errors. /// /// # Example /// @@ -379,7 +355,7 @@ /// [`Bernoulli`]: distributions::bernoulli::Bernoulli #[inline] fn gen_bool(&mut self, p: f64) -> bool { - let d = distributions::Bernoulli::new(p); + let d = distributions::Bernoulli::new(p).unwrap(); self.sample(d) } @@ -408,36 +384,9 @@ /// [`Bernoulli`]: distributions::bernoulli::Bernoulli #[inline] fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool { - let d = distributions::Bernoulli::from_ratio(numerator, denominator); + let d = distributions::Bernoulli::from_ratio(numerator, denominator).unwrap(); self.sample(d) } - - /// Return a random element from `values`. - /// - /// Deprecated: use [`seq::SliceRandom::choose`] instead. - #[deprecated(since="0.6.0", note="use SliceRandom::choose instead")] - fn choose<'a, T>(&mut self, values: &'a [T]) -> Option<&'a T> { - use seq::SliceRandom; - values.choose(self) - } - - /// Return a mutable pointer to a random element from `values`. - /// - /// Deprecated: use [`seq::SliceRandom::choose_mut`] instead. - #[deprecated(since="0.6.0", note="use SliceRandom::choose_mut instead")] - fn choose_mut<'a, T>(&mut self, values: &'a mut [T]) -> Option<&'a mut T> { - use seq::SliceRandom; - values.choose_mut(self) - } - - /// Shuffle a mutable slice in place. - /// - /// Deprecated: use [`seq::SliceRandom::shuffle`] instead. - #[deprecated(since="0.6.0", note="use SliceRandom::shuffle instead")] - fn shuffle(&mut self, values: &mut [T]) { - use seq::SliceRandom; - values.shuffle(self) - } } impl Rng for R {} @@ -462,6 +411,7 @@ } macro_rules! impl_as_byte_slice { + () => {}; ($t:ty) => { impl AsByteSliceMut for [$t] { fn as_byte_slice_mut(&mut self) -> &mut [u8] { @@ -472,8 +422,7 @@ } } else { unsafe { - slice::from_raw_parts_mut(&mut self[0] - as *mut $t + slice::from_raw_parts_mut(self.as_mut_ptr() as *mut u8, self.len() * mem::size_of::<$t>() ) @@ -487,26 +436,47 @@ } } } + + impl AsByteSliceMut for [Wrapping<$t>] { + fn as_byte_slice_mut(&mut self) -> &mut [u8] { + if self.len() == 0 { + unsafe { + // must not use null pointer + slice::from_raw_parts_mut(0x1 as *mut u8, 0) + } + } else { + unsafe { + slice::from_raw_parts_mut(self.as_mut_ptr() + as *mut u8, + self.len() * mem::size_of::<$t>() + ) + } + } + } + + fn to_le(&mut self) { + for x in self { + *x = Wrapping(x.0.to_le()); + } + } + } + }; + ($t:ty, $($tt:ty,)*) => { + impl_as_byte_slice!($t); + // TODO: this could replace above impl once Rust #32463 is fixed + // impl_as_byte_slice!(Wrapping<$t>); + impl_as_byte_slice!($($tt,)*); } } -impl_as_byte_slice!(u16); -impl_as_byte_slice!(u32); -impl_as_byte_slice!(u64); -#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] impl_as_byte_slice!(u128); -impl_as_byte_slice!(usize); -impl_as_byte_slice!(i8); -impl_as_byte_slice!(i16); -impl_as_byte_slice!(i32); -impl_as_byte_slice!(i64); -#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] impl_as_byte_slice!(i128); -impl_as_byte_slice!(isize); +impl_as_byte_slice!(u16, u32, u64, usize,); +#[cfg(not(target_os = "emscripten"))] impl_as_byte_slice!(u128); +impl_as_byte_slice!(i8, i16, i32, i64, isize,); +#[cfg(not(target_os = "emscripten"))] impl_as_byte_slice!(i128); macro_rules! impl_as_byte_slice_arrays { ($n:expr,) => {}; - ($n:expr, $N:ident, $($NN:ident,)*) => { - impl_as_byte_slice_arrays!($n - 1, $($NN,)*); - + ($n:expr, $N:ident) => { impl AsByteSliceMut for [T; $n] where [T]: AsByteSliceMut { fn as_byte_slice_mut(&mut self) -> &mut [u8] { self[..].as_byte_slice_mut() @@ -517,94 +487,19 @@ } } }; + ($n:expr, $N:ident, $($NN:ident,)*) => { + impl_as_byte_slice_arrays!($n, $N); + impl_as_byte_slice_arrays!($n - 1, $($NN,)*); + }; (!div $n:expr,) => {}; (!div $n:expr, $N:ident, $($NN:ident,)*) => { + impl_as_byte_slice_arrays!($n, $N); impl_as_byte_slice_arrays!(!div $n / 2, $($NN,)*); - - impl AsByteSliceMut for [T; $n] where [T]: AsByteSliceMut { - fn as_byte_slice_mut(&mut self) -> &mut [u8] { - self[..].as_byte_slice_mut() - } - - fn to_le(&mut self) { - self[..].to_le() - } - } }; } impl_as_byte_slice_arrays!(32, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,); impl_as_byte_slice_arrays!(!div 4096, N,N,N,N,N,N,N,); - -/// A convenience extension to [`SeedableRng`] allowing construction from fresh -/// entropy. This trait is automatically implemented for any PRNG implementing -/// [`SeedableRng`] and is not intended to be implemented by users. -/// -/// This is equivalent to using `SeedableRng::from_rng(EntropyRng::new())` then -/// unwrapping the result. -/// -/// Since this is convenient and secure, it is the recommended way to create -/// PRNGs, though two alternatives may be considered: -/// -/// * Deterministic creation using [`SeedableRng::from_seed`] with a fixed seed -/// * Seeding from `thread_rng`: `SeedableRng::from_rng(thread_rng())?`; -/// this will usually be faster and should also be secure, but requires -/// trusting one extra component. -/// -/// ## Example -/// -/// ``` -/// use rand::{Rng, FromEntropy}; -/// use rand::rngs::StdRng; -/// -/// let mut rng = StdRng::from_entropy(); -/// println!("Random die roll: {}", rng.gen_range(1, 7)); -/// ``` -/// -/// [`EntropyRng`]: rngs::EntropyRng -#[cfg(feature="std")] -pub trait FromEntropy: SeedableRng { - /// Creates a new instance, automatically seeded with fresh entropy. - /// - /// Normally this will use `OsRng`, but if that fails `JitterRng` will be - /// used instead. Both should be suitable for cryptography. It is possible - /// that both entropy sources will fail though unlikely; failures would - /// almost certainly be platform limitations or build issues, i.e. most - /// applications targetting PC/mobile platforms should not need to worry - /// about this failing. - /// - /// # Panics - /// - /// If all entropy sources fail this will panic. If you need to handle - /// errors, use the following code, equivalent aside from error handling: - /// - /// ``` - /// # use rand::Error; - /// use rand::prelude::*; - /// use rand::rngs::EntropyRng; - /// - /// # fn try_inner() -> Result<(), Error> { - /// // This uses StdRng, but is valid for any R: SeedableRng - /// let mut rng = StdRng::from_rng(EntropyRng::new())?; - /// - /// println!("random number: {}", rng.gen_range(1, 10)); - /// # Ok(()) - /// # } - /// - /// # try_inner().unwrap() - /// ``` - fn from_entropy() -> Self; -} - -#[cfg(feature="std")] -impl FromEntropy for R { - fn from_entropy() -> R { - R::from_rng(rngs::EntropyRng::new()).unwrap_or_else(|err| - panic!("FromEntropy::from_entropy() failed: {}", err)) - } -} - - /// Generates a random value using the thread-local random number generator. /// /// This is simply a shortcut for `thread_rng().gen()`. See [`thread_rng`] for @@ -649,36 +544,23 @@ /// [`Standard`]: distributions::Standard #[cfg(feature="std")] #[inline] -pub fn random() -> T where Standard: Distribution { +pub fn random() -> T +where Standard: Distribution { thread_rng().gen() } #[cfg(test)] mod test { - use rngs::mock::StepRng; - use rngs::StdRng; + use crate::rngs::mock::StepRng; use super::*; #[cfg(all(not(feature="std"), feature="alloc"))] use alloc::boxed::Box; - pub struct TestRng { inner: R } - - impl RngCore for TestRng { - fn next_u32(&mut self) -> u32 { - self.inner.next_u32() - } - fn next_u64(&mut self) -> u64 { - self.inner.next_u64() - } - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.inner.fill_bytes(dest) - } - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.inner.try_fill_bytes(dest) - } - } - - pub fn rng(seed: u64) -> TestRng { - TestRng { inner: StdRng::seed_from_u64(seed) } + /// Construct a deterministic RNG with the given seed + pub fn rng(seed: u64) -> impl RngCore { + // For tests, we want a statistically good, fast, reproducible RNG. + // PCG32 will do fine, and will be easy to embed if we ever need to. + const INC: u64 = 11634580027462260723; + rand_pcg::Pcg32::new(seed, INC) } #[test] @@ -718,6 +600,12 @@ rng.fill(&mut array[..]); assert_eq!(array, [x as u32, (x >> 32) as u32]); assert_eq!(rng.next_u32(), x as u32); + + // Check equivalence using wrapped arrays + let mut warray = [Wrapping(0u32); 2]; + rng.fill(&mut warray[..]); + assert_eq!(array[0], warray[0].0); + assert_eq!(array[1], warray[1].0); } #[test] @@ -774,9 +662,9 @@ #[test] fn test_rng_trait_object() { - use distributions::{Distribution, Standard}; + use crate::distributions::{Distribution, Standard}; let mut rng = rng(109); - let mut r = &mut rng as &mut RngCore; + let mut r = &mut rng as &mut dyn RngCore; r.next_u32(); r.gen::(); assert_eq!(r.gen_range(0, 1), 0); @@ -786,9 +674,9 @@ #[test] #[cfg(feature="alloc")] fn test_rng_boxed_trait() { - use distributions::{Distribution, Standard}; + use crate::distributions::{Distribution, Standard}; let rng = rng(110); - let mut r = Box::new(rng) as Box; + let mut r = Box::new(rng) as Box; r.next_u32(); r.gen::(); assert_eq!(r.gen_range(0, 1), 0); @@ -811,6 +699,7 @@ } #[test] + #[cfg(not(miri))] // Miri is too slow fn test_gen_ratio_average() { const NUM: u32 = 3; const DENOM: u32 = 10; diff -Nru cargo-0.35.0/vendor/rand/src/prelude.rs cargo-0.37.0/vendor/rand/src/prelude.rs --- cargo-0.35.0/vendor/rand/src/prelude.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/prelude.rs 2019-07-17 05:42:23.000000000 +0000 @@ -14,14 +14,15 @@ //! //! ``` //! use rand::prelude::*; -//! # let _ = StdRng::from_entropy(); -//! # let mut r = SmallRng::from_rng(thread_rng()).unwrap(); +//! # let mut r = StdRng::from_rng(thread_rng()).unwrap(); //! # let _: f32 = r.gen(); //! ``` -#[doc(no_inline)] pub use distributions::Distribution; -#[doc(no_inline)] pub use rngs::{SmallRng, StdRng}; -#[doc(no_inline)] #[cfg(feature="std")] pub use rngs::ThreadRng; -#[doc(no_inline)] pub use {Rng, RngCore, CryptoRng, SeedableRng}; -#[doc(no_inline)] #[cfg(feature="std")] pub use {FromEntropy, random, thread_rng}; -#[doc(no_inline)] pub use seq::{SliceRandom, IteratorRandom}; +#[doc(no_inline)] pub use crate::distributions::Distribution; +#[doc(no_inline)] pub use crate::rngs::StdRng; +#[cfg(feature="small_rng")] +#[doc(no_inline)] pub use crate::rngs::SmallRng; +#[doc(no_inline)] #[cfg(feature="std")] pub use crate::rngs::ThreadRng; +#[doc(no_inline)] pub use crate::{Rng, RngCore, CryptoRng, SeedableRng}; +#[doc(no_inline)] #[cfg(feature="std")] pub use crate::{random, thread_rng}; +#[doc(no_inline)] pub use crate::seq::{SliceRandom, IteratorRandom}; diff -Nru cargo-0.35.0/vendor/rand/src/prng/mod.rs cargo-0.37.0/vendor/rand/src/prng/mod.rs --- cargo-0.35.0/vendor/rand/src/prng/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/prng/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -// Copyright 2018 Developers of the Rand project. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Pseudo-random number generators. -//! -//! This module is deprecated: -//! -//! - documentation has moved to -//! [The Book](https://rust-random.github.io/book/guide-rngs.html), -//! - PRNGs have moved to other `rand_*` crates. - -// Deprecations (to be removed in 0.7) -#[doc(hidden)] #[allow(deprecated)] -pub use deprecated::XorShiftRng; -#[doc(hidden)] pub mod isaac { - // Note: we miss `IsaacCore` here but probably unimportant. - #[allow(deprecated)] pub use deprecated::IsaacRng; -} -#[doc(hidden)] pub mod isaac64 { - #[allow(deprecated)] pub use deprecated::Isaac64Rng; -} -#[doc(hidden)] #[allow(deprecated)] pub use deprecated::{IsaacRng, Isaac64Rng}; -#[doc(hidden)] pub mod chacha { - // Note: we miss `ChaChaCore` here but probably unimportant. - #[allow(deprecated)] pub use deprecated::ChaChaRng; -} -#[doc(hidden)] #[allow(deprecated)] pub use deprecated::ChaChaRng; -#[doc(hidden)] pub mod hc128 { - // Note: we miss `Hc128Core` here but probably unimportant. - #[allow(deprecated)] pub use deprecated::Hc128Rng; -} -#[doc(hidden)] #[allow(deprecated)] pub use deprecated::Hc128Rng; diff -Nru cargo-0.35.0/vendor/rand/src/rngs/adapter/mod.rs cargo-0.37.0/vendor/rand/src/rngs/adapter/mod.rs --- cargo-0.35.0/vendor/rand/src/rngs/adapter/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/rngs/adapter/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,8 +8,8 @@ //! Wrappers / adapters forming RNGs -#[cfg(feature="std")] #[doc(hidden)] pub mod read; +#[cfg(feature="std")] mod read; mod reseeding; -#[cfg(feature="std")] pub use self::read::ReadRng; +#[cfg(feature="std")] pub use self::read::{ReadRng, ReadError}; pub use self::reseeding::ReseedingRng; diff -Nru cargo-0.35.0/vendor/rand/src/rngs/adapter/read.rs cargo-0.37.0/vendor/rand/src/rngs/adapter/read.rs --- cargo-0.35.0/vendor/rand/src/rngs/adapter/read.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/rngs/adapter/read.rs 2019-07-17 05:42:23.000000000 +0000 @@ -10,8 +10,9 @@ //! A wrapper around any Read to treat it as an RNG. use std::io::Read; +use std::fmt; -use rand_core::{RngCore, Error, ErrorKind, impls}; +use rand_core::{RngCore, Error, impls}; /// An RNG that reads random bytes straight from any type supporting @@ -40,7 +41,7 @@ /// println!("{:x}", rng.gen::()); /// ``` /// -/// [`OsRng`]: rand_os::OsRng +/// [`OsRng`]: crate::rngs::OsRng /// [`try_fill_bytes`]: RngCore::try_fill_bytes #[derive(Debug)] pub struct ReadRng { @@ -73,22 +74,31 @@ fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { if dest.len() == 0 { return Ok(()); } // Use `std::io::read_exact`, which retries on `ErrorKind::Interrupted`. - self.reader.read_exact(dest).map_err(|err| { - match err.kind() { - ::std::io::ErrorKind::UnexpectedEof => Error::with_cause( - ErrorKind::Unavailable, - "not enough bytes available, reached end of source", err), - _ => Error::with_cause(ErrorKind::Unavailable, - "error reading from Read source", err) - } - }) + self.reader.read_exact(dest).map_err(|e| Error::new(ReadError(e))) } } +/// `ReadRng` error type +#[derive(Debug)] +pub struct ReadError(std::io::Error); + +impl fmt::Display for ReadError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "ReadError: {}", self.0) + } +} + +impl std::error::Error for ReadError { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + Some(&self.0) + } +} + + #[cfg(test)] mod test { use super::ReadRng; - use {RngCore, ErrorKind}; + use crate::RngCore; #[test] fn test_reader_rng_u64() { @@ -131,6 +141,8 @@ let mut rng = ReadRng::new(&v[..]); - assert!(rng.try_fill_bytes(&mut w).err().unwrap().kind == ErrorKind::Unavailable); + let result = rng.try_fill_bytes(&mut w); + assert!(result.is_err()); + println!("Error: {}", result.unwrap_err()); } } diff -Nru cargo-0.35.0/vendor/rand/src/rngs/adapter/reseeding.rs cargo-0.37.0/vendor/rand/src/rngs/adapter/reseeding.rs --- cargo-0.35.0/vendor/rand/src/rngs/adapter/reseeding.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/rngs/adapter/reseeding.rs 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ use core::mem::size_of; -use rand_core::{RngCore, CryptoRng, SeedableRng, Error, ErrorKind}; +use rand_core::{RngCore, CryptoRng, SeedableRng, Error}; use rand_core::block::{BlockRngCore, BlockRng}; /// A wrapper around any PRNG that implements [`BlockRngCore`], that adds the @@ -24,7 +24,7 @@ /// - After `clone()`, the clone will be reseeded on first use. /// - After a process is forked, the RNG in the child process is reseeded within /// the next few generated values, depending on the block size of the -/// underlying PRNG. For [`ChaChaCore`] and [`Hc128Core`] this is a maximum of +/// underlying PRNG. For ChaCha and Hc128 this is a maximum of /// 15 `u32` values before reseeding. /// - After the PRNG has generated a configurable number of random bytes. /// @@ -57,30 +57,21 @@ /// # Example /// /// ``` -/// # extern crate rand; -/// # extern crate rand_chacha; -/// # fn main() { /// use rand::prelude::*; -/// use rand_chacha::ChaChaCore; // Internal part of ChaChaRng that +/// use rand_chacha::ChaCha20Core; // Internal part of ChaChaRng that /// // implements BlockRngCore /// use rand::rngs::OsRng; /// use rand::rngs::adapter::ReseedingRng; /// -/// let prng = ChaChaCore::from_entropy(); -// FIXME: it is better to use EntropyRng as reseeder, but that doesn't implement -// clone yet. -/// let reseeder = OsRng::new().unwrap(); -/// let mut reseeding_rng = ReseedingRng::new(prng, 0, reseeder); +/// let prng = ChaCha20Core::from_entropy(); +/// let mut reseeding_rng = ReseedingRng::new(prng, 0, OsRng); /// /// println!("{}", reseeding_rng.gen::()); /// /// let mut cloned_rng = reseeding_rng.clone(); /// assert!(reseeding_rng.gen::() != cloned_rng.gen::()); -/// # } /// ``` /// -/// [`ChaChaCore`]: rand_chacha::ChaChaCore -/// [`Hc128Core`]: rand_hc::Hc128Core /// [`BlockRngCore`]: rand_core::block::BlockRngCore /// [`ReseedingRng::new`]: ReseedingRng::new /// [`reseed()`]: ReseedingRng::reseed @@ -243,21 +234,13 @@ let num_bytes = results.as_ref().len() * size_of::<::Item>(); - let threshold = if let Err(e) = self.reseed() { - let delay = match e.kind { - ErrorKind::Transient => num_bytes as i64, - kind @ _ if kind.should_retry() => self.threshold >> 8, - _ => self.threshold, - }; - warn!("Reseeding RNG delayed reseeding by {} bytes due to \ - error from source: {}", delay, e); - delay - } else { - self.fork_counter = global_fork_counter; - self.threshold - }; + if let Err(e) = self.reseed() { + warn!("Reseeding RNG failed: {}", e); + let _ = e; + } + self.fork_counter = global_fork_counter; - self.bytes_until_reseed = threshold - num_bytes as i64; + self.bytes_until_reseed = self.threshold - num_bytes as i64; self.inner.generate(results); } } @@ -282,12 +265,11 @@ Rsdr: RngCore + CryptoRng {} -#[cfg(all(feature="std", unix, not(target_os="emscripten")))] +#[cfg(all(unix, not(target_os="emscripten")))] mod fork { - extern crate libc; - - use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; - use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT}; + use core::sync::atomic::{AtomicUsize, AtomicBool, Ordering}; + #[allow(deprecated)] // Required for compatibility with Rust < 1.24. + use core::sync::atomic::{ATOMIC_USIZE_INIT, ATOMIC_BOOL_INIT}; // Fork protection // @@ -301,12 +283,14 @@ // don't update `fork_counter`, so a reseed is attempted as soon as // possible. + #[allow(deprecated)] static RESEEDING_RNG_FORK_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT; pub fn get_fork_counter() -> usize { RESEEDING_RNG_FORK_COUNTER.load(Ordering::Relaxed) } + #[allow(deprecated)] static FORK_HANDLER_REGISTERED: AtomicBool = ATOMIC_BOOL_INIT; extern fn fork_handler() { @@ -323,7 +307,7 @@ } } -#[cfg(not(all(feature="std", unix, not(target_os="emscripten"))))] +#[cfg(not(all(unix, not(target_os="emscripten"))))] mod fork { pub fn get_fork_counter() -> usize { 0 } pub fn register_fork_handler() {} @@ -332,25 +316,27 @@ #[cfg(test)] mod test { - use {Rng, SeedableRng}; - use rand_chacha::ChaChaCore; - use rngs::mock::StepRng; + use crate::{Rng, SeedableRng}; + use crate::rngs::std::Core; + use crate::rngs::mock::StepRng; use super::ReseedingRng; #[test] fn test_reseeding() { let mut zero = StepRng::new(0, 0); - let rng = ChaChaCore::from_rng(&mut zero).unwrap(); - let mut reseeding = ReseedingRng::new(rng, 32*4, zero); - - // Currently we only support for arrays up to length 32. - // TODO: cannot generate seq via Rng::gen because it uses different alg - let mut buf = [0u32; 32]; // Needs to be a multiple of the RNGs result - // size to test exactly. - reseeding.fill(&mut buf); + let rng = Core::from_rng(&mut zero).unwrap(); + let thresh = 1; // reseed every time the buffer is exhausted + let mut reseeding = ReseedingRng::new(rng, thresh, zero); + + // RNG buffer size is [u32; 64] + // Debug is only implemented up to length 32 so use two arrays + let mut buf = ([0u32; 32], [0u32; 32]); + reseeding.fill(&mut buf.0); + reseeding.fill(&mut buf.1); let seq = buf; for _ in 0..10 { - reseeding.fill(&mut buf); + reseeding.fill(&mut buf.0); + reseeding.fill(&mut buf.1); assert_eq!(buf, seq); } } @@ -358,7 +344,7 @@ #[test] fn test_clone_reseeding() { let mut zero = StepRng::new(0, 0); - let rng = ChaChaCore::from_rng(&mut zero).unwrap(); + let rng = Core::from_rng(&mut zero).unwrap(); let mut rng1 = ReseedingRng::new(rng, 32*4, zero); let first: u32 = rng1.gen(); diff -Nru cargo-0.35.0/vendor/rand/src/rngs/entropy.rs cargo-0.37.0/vendor/rand/src/rngs/entropy.rs --- cargo-0.35.0/vendor/rand/src/rngs/entropy.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/rngs/entropy.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,51 +8,22 @@ //! Entropy generator, or wrapper around external generators -use rand_core::{RngCore, CryptoRng, Error, ErrorKind, impls}; +#![allow(deprecated)] // whole module is deprecated + +use rand_core::{RngCore, CryptoRng, Error}; #[allow(unused)] -use rngs; +use crate::rngs::OsRng; /// An interface returning random data from external source(s), provided /// specifically for securely seeding algorithmic generators (PRNGs). /// -/// Where possible, `EntropyRng` retrieves random data from the operating -/// system's interface for random numbers ([`OsRng`]); if that fails it will -/// fall back to the [`JitterRng`] entropy collector. In the latter case it will -/// still try to use [`OsRng`] on the next usage. -/// -/// If no secure source of entropy is available `EntropyRng` will panic on use; -/// i.e. it should never output predictable data. -/// -/// This is either a little slow ([`OsRng`] requires a system call) or extremely -/// slow ([`JitterRng`] must use significant CPU time to generate sufficient -/// jitter); for better performance it is common to seed a local PRNG from -/// external entropy then primarily use the local PRNG ([`thread_rng`] is -/// provided as a convenient, local, automatically-seeded CSPRNG). -/// -/// # Panics -/// -/// On most systems, like Windows, Linux, macOS and *BSD on common hardware, it -/// is highly unlikely for both [`OsRng`] and [`JitterRng`] to fail. But on -/// combinations like webassembly without Emscripten or stdweb both sources are -/// unavailable. If both sources fail, only [`try_fill_bytes`] is able to -/// report the error, and only the one from `OsRng`. The other [`RngCore`] -/// methods will panic in case of an error. -/// -/// [`OsRng`]: rand_os::OsRng -/// [`thread_rng`]: crate::thread_rng -/// [`JitterRng`]: crate::rngs::JitterRng -/// [`try_fill_bytes`]: RngCore::try_fill_bytes +/// This is deprecated. It is suggested you use [`rngs::OsRng`] instead. +/// +/// [`rngs::OsRng`]: crate::rngs::OsRng #[derive(Debug)] +#[deprecated(since="0.7.0", note="use rngs::OsRng instead")] pub struct EntropyRng { - source: Source, -} - -#[derive(Debug)] -enum Source { - Os(Os), - Custom(Custom), - Jitter(Jitter), - None, + source: OsRng, } impl EntropyRng { @@ -62,7 +33,7 @@ /// those are done on first use. This is done to make `new` infallible, /// and `try_fill_bytes` the only place to report errors. pub fn new() -> Self { - EntropyRng { source: Source::None } + EntropyRng { source: OsRng } } } @@ -74,167 +45,25 @@ impl RngCore for EntropyRng { fn next_u32(&mut self) -> u32 { - impls::next_u32_via_fill(self) + self.source.next_u32() } fn next_u64(&mut self) -> u64 { - impls::next_u64_via_fill(self) + self.source.next_u64() } fn fill_bytes(&mut self, dest: &mut [u8]) { - self.try_fill_bytes(dest).unwrap_or_else(|err| - panic!("all entropy sources failed; first error: {}", err)) + self.source.fill_bytes(dest) } fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - let mut reported_error = None; - - if let Source::Os(ref mut os_rng) = self.source { - match os_rng.fill(dest) { - Ok(()) => return Ok(()), - Err(err) => { - warn!("EntropyRng: OsRng failed \ - [trying other entropy sources]: {}", err); - reported_error = Some(err); - }, - } - } else if Os::is_supported() { - match Os::new_and_fill(dest) { - Ok(os_rng) => { - debug!("EntropyRng: using OsRng"); - self.source = Source::Os(os_rng); - return Ok(()); - }, - Err(err) => { reported_error = reported_error.or(Some(err)) }, - } - } - - if let Source::Custom(ref mut rng) = self.source { - match rng.fill(dest) { - Ok(()) => return Ok(()), - Err(err) => { - warn!("EntropyRng: custom entropy source failed \ - [trying other entropy sources]: {}", err); - reported_error = Some(err); - }, - } - } else if Custom::is_supported() { - match Custom::new_and_fill(dest) { - Ok(custom) => { - debug!("EntropyRng: using custom entropy source"); - self.source = Source::Custom(custom); - return Ok(()); - }, - Err(err) => { reported_error = reported_error.or(Some(err)) }, - } - } - - if let Source::Jitter(ref mut jitter_rng) = self.source { - match jitter_rng.fill(dest) { - Ok(()) => return Ok(()), - Err(err) => { - warn!("EntropyRng: JitterRng failed: {}", err); - reported_error = Some(err); - }, - } - } else if Jitter::is_supported() { - match Jitter::new_and_fill(dest) { - Ok(jitter_rng) => { - debug!("EntropyRng: using JitterRng"); - self.source = Source::Jitter(jitter_rng); - return Ok(()); - }, - Err(err) => { reported_error = reported_error.or(Some(err)) }, - } - } - - if let Some(err) = reported_error { - Err(Error::with_cause(ErrorKind::Unavailable, - "All entropy sources failed", - err)) - } else { - Err(Error::new(ErrorKind::Unavailable, - "No entropy sources available")) - } + self.source.try_fill_bytes(dest) } } impl CryptoRng for EntropyRng {} - -trait EntropySource { - fn new_and_fill(dest: &mut [u8]) -> Result - where Self: Sized; - - fn fill(&mut self, dest: &mut [u8]) -> Result<(), Error>; - - fn is_supported() -> bool { true } -} - -#[allow(unused)] -#[derive(Clone, Debug)] -struct NoSource; - -#[allow(unused)] -impl EntropySource for NoSource { - fn new_and_fill(dest: &mut [u8]) -> Result { - Err(Error::new(ErrorKind::Unavailable, "Source not supported")) - } - - fn fill(&mut self, dest: &mut [u8]) -> Result<(), Error> { - unreachable!() - } - - fn is_supported() -> bool { false } -} - - -#[cfg(feature="rand_os")] -#[derive(Clone, Debug)] -pub struct Os(rngs::OsRng); - -#[cfg(feature="rand_os")] -impl EntropySource for Os { - fn new_and_fill(dest: &mut [u8]) -> Result { - let mut rng = rngs::OsRng::new()?; - rng.try_fill_bytes(dest)?; - Ok(Os(rng)) - } - - fn fill(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -#[cfg(not(feature="std"))] -type Os = NoSource; - - -type Custom = NoSource; - - -#[cfg(not(target_arch = "wasm32"))] -#[derive(Clone, Debug)] -pub struct Jitter(rngs::JitterRng); - -#[cfg(not(target_arch = "wasm32"))] -impl EntropySource for Jitter { - fn new_and_fill(dest: &mut [u8]) -> Result { - let mut rng = rngs::JitterRng::new()?; - rng.try_fill_bytes(dest)?; - Ok(Jitter(rng)) - } - - fn fill(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -#[cfg(target_arch = "wasm32")] -type Jitter = NoSource; - - #[cfg(test)] mod test { use super::*; diff -Nru cargo-0.35.0/vendor/rand/src/rngs/mock.rs cargo-0.37.0/vendor/rand/src/rngs/mock.rs --- cargo-0.35.0/vendor/rand/src/rngs/mock.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/rngs/mock.rs 2019-07-17 05:42:23.000000000 +0000 @@ -39,20 +39,24 @@ } impl RngCore for StepRng { + #[inline] fn next_u32(&mut self) -> u32 { self.next_u64() as u32 } + #[inline] fn next_u64(&mut self) -> u64 { let result = self.v; self.v = self.v.wrapping_add(self.a); result } + #[inline] fn fill_bytes(&mut self, dest: &mut [u8]) { impls::fill_bytes_via_next(self, dest); } + #[inline] fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { Ok(self.fill_bytes(dest)) } diff -Nru cargo-0.35.0/vendor/rand/src/rngs/mod.rs cargo-0.37.0/vendor/rand/src/rngs/mod.rs --- cargo-0.35.0/vendor/rand/src/rngs/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/rngs/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -6,162 +6,115 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! Random number generators and adapters for common usage: +//! Random number generators and adapters //! -//! - [`ThreadRng`], a fast, secure, auto-seeded thread-local generator -//! - [`StdRng`] and [`SmallRng`], algorithms to cover typical usage -//! - [`EntropyRng`], [`OsRng`] and [`JitterRng`] as entropy sources -//! - [`mock::StepRng`] as a simple counter for tests -//! - [`adapter::ReadRng`] to read from a file/stream -//! - [`adapter::ReseedingRng`] to reseed a PRNG on clone / process fork etc. -//! -//! # Background — Random number generators (RNGs) -//! -//! Computers are inherently deterministic, so to get *random* numbers one -//! either has to use a hardware generator or collect bits of *entropy* from -//! various sources (e.g. event timestamps, or jitter). This is a relatively -//! slow and complicated operation. -//! -//! Generally the operating system will collect some entropy, remove bias, and -//! use that to seed its own PRNG; [`OsRng`] provides an interface to this. -//! [`JitterRng`] is an entropy collector included with Rand that measures -//! jitter in the CPU execution time, and jitter in memory access time. -//! [`EntropyRng`] is a wrapper that uses the best entropy source that is -//! available. -//! -//! ## Pseudo-random number generators -//! -//! What is commonly used instead of "true" random number renerators, are -//! *pseudo-random number generators* (PRNGs), deterministic algorithms that -//! produce an infinite stream of pseudo-random numbers from a small random -//! seed. PRNGs are faster, and have better provable properties. The numbers -//! produced can be statistically of very high quality and can be impossible to -//! predict. (They can also have obvious correlations and be trivial to predict; -//! quality varies.) -//! -//! There are two different types of PRNGs: those developed for simulations -//! and statistics, and those developed for use in cryptography; the latter are -//! called Cryptographically Secure PRNGs (CSPRNG or CPRNG). Both types can -//! have good statistical quality but the latter also have to be impossible to -//! predict, even after seeing many previous output values. Rand provides a good -//! default algorithm from each class: -//! -//! - [`SmallRng`] is a PRNG chosen for low memory usage, high performance and -//! good statistical quality. -//! - [`StdRng`] is a CSPRNG chosen for good performance and trust of security -//! (based on reviews, maturity and usage). The current algorithm is HC-128, -//! which is one of the recommendations by ECRYPT's eSTREAM project. -//! -//! The above PRNGs do not cover all use-cases; more algorithms can be found in -//! the [`prng`][crate::prng] module, as well as in several other crates. For example, you -//! may wish a CSPRNG with significantly lower memory usage than [`StdRng`] -//! while being less concerned about performance, in which case [`ChaChaRng`] -//! is a good choice. -//! -//! One complexity is that the internal state of a PRNG must change with every -//! generated number. For APIs this generally means a mutable reference to the -//! state of the PRNG has to be passed around. -//! -//! A solution is [`ThreadRng`]. This is a thread-local implementation of -//! [`StdRng`] with automatic seeding on first use. It is the best choice if you -//! "just" want a convenient, secure, fast random number source. Use via the -//! [`thread_rng`] function, which gets a reference to the current thread's -//! local instance. -//! -//! ## Seeding -//! -//! As mentioned above, PRNGs require a random seed in order to produce random -//! output. This is especially important for CSPRNGs, which are still -//! deterministic algorithms, thus can only be secure if their seed value is -//! also secure. To seed a PRNG, use one of: -//! -//! - [`FromEntropy::from_entropy`]; this is the most convenient way to seed -//! with fresh, secure random data. -//! - [`SeedableRng::from_rng`]; this allows seeding from another PRNG or -//! from an entropy source such as [`EntropyRng`]. -//! - [`SeedableRng::from_seed`]; this is mostly useful if you wish to be able -//! to reproduce the output sequence by using a fixed seed. (Don't use -//! [`StdRng`] or [`SmallRng`] in this case since different algorithms may be -//! used by future versions of Rand; use an algorithm from the -//! [`prng`] module.) -//! -//! ## Conclusion -//! -//! - [`thread_rng`] is what you often want to use. -//! - If you want more control, flexibility, or better performance, use -//! [`StdRng`], [`SmallRng`] or an algorithm from the [`prng`] module. -//! - Use [`FromEntropy::from_entropy`] to seed new PRNGs. -//! - If you need reproducibility, use [`SeedableRng::from_seed`] combined with -//! a named PRNG. -//! -//! More information and notes on cryptographic security can be found -//! in the [`prng`] module. -//! -//! ## Examples -//! -//! Examples of seeding PRNGs: -//! -//! ``` -//! use rand::prelude::*; -//! # use rand::Error; -//! -//! // StdRng seeded securely by the OS or local entropy collector: -//! let mut rng = StdRng::from_entropy(); -//! # let v: u32 = rng.gen(); -//! -//! // SmallRng seeded from thread_rng: -//! # fn try_inner() -> Result<(), Error> { -//! let mut rng = SmallRng::from_rng(thread_rng())?; -//! # let v: u32 = rng.gen(); -//! # Ok(()) -//! # } -//! # try_inner().unwrap(); -//! -//! // SmallRng seeded by a constant, for deterministic results: -//! let seed = [1,2,3,4, 5,6,7,8, 9,10,11,12, 13,14,15,16]; // byte array -//! let mut rng = SmallRng::from_seed(seed); -//! # let v: u32 = rng.gen(); -//! ``` -//! -//! -//! # Implementing custom RNGs -//! -//! If you want to implement custom RNG, see the [`rand_core`] crate. The RNG -//! will have to implement the [`RngCore`] trait, where the [`Rng`] trait is -//! build on top of. +//! ## Background: Random number generators (RNGs) //! -//! If the RNG needs seeding, also implement the [`SeedableRng`] trait. +//! Computers cannot produce random numbers from nowhere. We classify +//! random number generators as follows: //! -//! [`CryptoRng`] is a marker trait cryptographically secure PRNGs can -//! implement. +//! - "True" random number generators (TRNGs) use hard-to-predict data sources +//! (e.g. the high-resolution parts of event timings and sensor jitter) to +//! harvest random bit-sequences, apply algorithms to remove bias and +//! estimate available entropy, then combine these bits into a byte-sequence +//! or an entropy pool. This job is usually done by the operating system or +//! a hardware generator (HRNG). +//! - "Pseudo"-random number generators (PRNGs) use algorithms to transform a +//! seed into a sequence of pseudo-random numbers. These generators can be +//! fast and produce well-distributed unpredictable random numbers (or not). +//! They are usually deterministic: given algorithm and seed, the output +//! sequence can be reproduced. They have finite period and eventually loop; +//! with many algorithms this period is fixed and can be proven sufficiently +//! long, while others are chaotic and the period depends on the seed. +//! - "Cryptographically secure" pseudo-random number generators (CSPRNGs) +//! are the sub-set of PRNGs which are secure. Security of the generator +//! relies both on hiding the internal state and using a strong algorithm. +//! +//! ## Traits and functionality +//! +//! All RNGs implement the [`RngCore`] trait, as a consequence of which the +//! [`Rng`] extension trait is automatically implemented. Secure RNGs may +//! additionally implement the [`CryptoRng`] trait. +//! +//! All PRNGs require a seed to produce their random number sequence. The +//! [`SeedableRng`] trait provides three ways of constructing PRNGs: +//! +//! - `from_seed` accepts a type specific to the PRNG +//! - `from_rng` allows a PRNG to be seeded from any other RNG +//! - `seed_from_u64` allows any PRNG to be seeded from a `u64` insecurely +//! - `from_entropy` securely seeds a PRNG from fresh entropy +//! +//! Use the [`rand_core`] crate when implementing your own RNGs. +//! +//! ## Our generators +//! +//! This crate provides several random number generators: +//! +//! - [`OsRng`] is an interface to the operating system's random number +//! source. Typically the operating system uses a CSPRNG with entropy +//! provided by a TRNG and some type of on-going re-seeding. +//! - [`ThreadRng`], provided by the [`thread_rng`] function, is a handle to a +//! thread-local CSPRNG with periodic seeding from [`OsRng`]. Because this +//! is local, it is typically much faster than [`OsRng`]. It should be +//! secure, though the paranoid may prefer [`OsRng`]. +//! - [`StdRng`] is a CSPRNG chosen for good performance and trust of security +//! (based on reviews, maturity and usage). The current algorithm is ChaCha20, +//! which is well established and rigorously analysed. +//! [`StdRng`] provides the algorithm used by [`ThreadRng`] but without +//! periodic reseeding. +//! - [`SmallRng`] is an **insecure** PRNG designed to be fast, simple, require +//! little memory, and have good output quality. +//! +//! The algorithms selected for [`StdRng`] and [`SmallRng`] may change in any +//! release and may be platform-dependent, therefore they should be considered +//! **not reproducible**. +//! +//! ## Additional generators +//! +//! **TRNGs**: The [`rdrand`] crate provides an interface to the RDRAND and +//! RDSEED instructions available in modern Intel and AMD CPUs. +//! The [`rand_jitter`] crate provides a user-space implementation of +//! entropy harvesting from CPU timer jitter, but is very slow and has +//! [security issues](https://github.com/rust-random/rand/issues/699). +//! +//! **PRNGs**: Several companion crates are available, providing individual or +//! families of PRNG algorithms. These provide the implementations behind +//! [`StdRng`] and [`SmallRng`] but can also be used directly, indeed *should* +//! be used directly when **reproducibility** matters. +//! Some suggestions are: [`rand_chacha`], [`rand_pcg`], [`rand_xoshiro`]. +//! A full list can be found by searching for crates with the [`rng` tag]. //! -//! [`OsRng`]: rand_os::OsRng //! [`SmallRng`]: rngs::SmallRng //! [`StdRng`]: rngs::StdRng +//! [`OsRng`]: rngs::OsRng //! [`ThreadRng`]: rngs::ThreadRng -//! [`EntropyRng`]: rngs::EntropyRng -//! [`JitterRng`]: rngs::JitterRng //! [`mock::StepRng`]: rngs::mock::StepRng //! [`adapter::ReadRng`]: rngs::adapter::ReadRng //! [`adapter::ReseedingRng`]: rngs::adapter::ReseedingRng -//! [`ChaChaRng`]: rand_chacha::ChaChaRng +//! [`rdrand`]: https://crates.io/crates/rdrand +//! [`rand_jitter`]: https://crates.io/crates/rand_jitter +//! [`rand_chacha`]: https://crates.io/crates/rand_chacha +//! [`rand_pcg`]: https://crates.io/crates/rand_pcg +//! [`rand_xoshiro`]: https://crates.io/crates/rand_xoshiro +//! [`rng` tag]: https://crates.io/keywords/rng pub mod adapter; #[cfg(feature="std")] mod entropy; pub mod mock; // Public so we don't export `StepRng` directly, making it a bit // more clear it is intended for testing. +#[cfg(feature="small_rng")] mod small; mod std; #[cfg(feature="std")] pub(crate) mod thread; - -pub use rand_jitter::{JitterRng, TimerError}; +#[allow(deprecated)] #[cfg(feature="std")] pub use self::entropy::EntropyRng; +#[cfg(feature="small_rng")] pub use self::small::SmallRng; pub use self::std::StdRng; #[cfg(feature="std")] pub use self::thread::ThreadRng; -#[cfg(feature="rand_os")] -pub use rand_os::OsRng; +#[cfg(feature="getrandom")] mod os; +#[cfg(feature="getrandom")] pub use self::os::OsRng; diff -Nru cargo-0.35.0/vendor/rand/src/rngs/os.rs cargo-0.37.0/vendor/rand/src/rngs/os.rs --- cargo-0.35.0/vendor/rand/src/rngs/os.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/rngs/os.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,95 @@ +// Copyright 2019 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Interface to the random number generator of the operating system. +// Note: keep this code in sync with the rand_os crate! + +use crate::getrandom::getrandom; +use rand_core::{CryptoRng, RngCore, Error, impls}; + +/// A random number generator that retrieves randomness from from the +/// operating system. +/// +/// This is a zero-sized struct. It can be freely constructed with `OsRng`. +/// +/// The implementation is provided by the [getrandom] crate. Refer to +/// [getrandom] documentation for details. +/// +/// # Blocking and error handling +/// +/// It is possible that when used during early boot the first call to `OsRng` +/// will block until the system's RNG is initialised. It is also possible +/// (though highly unlikely) for `OsRng` to fail on some platforms, most +/// likely due to system mis-configuration. +/// +/// After the first successful call, it is highly unlikely that failures or +/// significant delays will occur (although performance should be expected to +/// be much slower than a user-space PRNG). +/// +/// # Usage example +/// ``` +/// use rand::rngs::{StdRng, OsRng}; +/// use rand::{RngCore, SeedableRng}; +/// +/// let mut key = [0u8; 16]; +/// OsRng.fill_bytes(&mut key); +/// let random_u64 = OsRng.next_u64(); +/// +/// // OsRng is especially useful for seeding other RNGs (see also from_entropy) +/// let mut rng = StdRng::from_rng(OsRng).unwrap(); +/// let _ = rng.next_u32(); +/// ``` +/// +/// [getrandom]: https://crates.io/crates/getrandom +#[derive(Clone, Copy, Debug, Default)] +pub struct OsRng; + +impl OsRng { + /// Create a new `OsRng`. + #[deprecated(since="0.7.0", note="replace OsRng::new().unwrap() with just OsRng")] + pub fn new() -> Result { + Ok(OsRng) + } +} + +impl CryptoRng for OsRng {} + +impl RngCore for OsRng { + fn next_u32(&mut self) -> u32 { + impls::next_u32_via_fill(self) + } + + fn next_u64(&mut self) -> u64 { + impls::next_u64_via_fill(self) + } + + fn fill_bytes(&mut self, dest: &mut [u8]) { + if let Err(e) = self.try_fill_bytes(dest) { + panic!("Error: {}", e); + } + } + + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + getrandom(dest)?; + Ok(()) + } +} + +#[test] +fn test_os_rng() { + let x = OsRng.next_u64(); + let y = OsRng.next_u64(); + assert!(x != 0); + assert!(x != y); +} + +#[test] +fn test_construction() { + let mut rng = OsRng::default(); + assert!(rng.next_u64() != 0); +} diff -Nru cargo-0.35.0/vendor/rand/src/rngs/small.rs cargo-0.37.0/vendor/rand/src/rngs/small.rs --- cargo-0.35.0/vendor/rand/src/rngs/small.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/rngs/small.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,37 +8,42 @@ //! A small fast RNG -use {RngCore, SeedableRng, Error}; +use rand_core::{RngCore, SeedableRng, Error}; -#[cfg(all(all(rustc_1_26, not(target_os = "emscripten")), target_pointer_width = "64"))] -type Rng = ::rand_pcg::Pcg64Mcg; -#[cfg(not(all(all(rustc_1_26, not(target_os = "emscripten")), target_pointer_width = "64")))] -type Rng = ::rand_pcg::Pcg32; - -/// An RNG recommended when small state, cheap initialization and good -/// performance are required. The PRNG algorithm in `SmallRng` is chosen to be -/// efficient on the current platform, **without consideration for cryptography -/// or security**. The size of its state is much smaller than for [`StdRng`]. -/// -/// Reproducibility of output from this generator is however not required, thus -/// future library versions may use a different internal generator with -/// different output. Further, this generator may not be portable and can -/// produce different output depending on the architecture. If you require -/// reproducible output, use a named RNG. -/// Refer to [The Book](https://rust-random.github.io/book/guide-rngs.html). -/// -/// -/// The current algorithm is [`Pcg64Mcg`][rand_pcg::Pcg64Mcg] on 64-bit platforms with Rust version -/// 1.26 and later, or [`Pcg32`][rand_pcg::Pcg32] otherwise. Both are found in -/// the [rand_pcg] crate. +#[cfg(all(not(target_os = "emscripten"), target_pointer_width = "64"))] +type Rng = rand_pcg::Pcg64Mcg; +#[cfg(not(all(not(target_os = "emscripten"), target_pointer_width = "64")))] +type Rng = rand_pcg::Pcg32; + +/// A small-state, fast non-crypto PRNG +/// +/// `SmallRng` may be a good choice when a PRNG with small state, cheap +/// initialization, good statistical quality and good performance are required. +/// It is **not** a good choice when security against prediction or +/// reproducibility are important. +/// +/// This PRNG is **feature-gated**: to use, you must enable the crate feature +/// `small_rng`. +/// +/// The algorithm is deterministic but should not be considered reproducible +/// due to dependence on platform and possible replacement in future +/// library versions. For a reproducible generator, use a named PRNG from an +/// external crate, e.g. [rand_pcg] or [rand_chacha]. +/// Refer also to [The Book](https://rust-random.github.io/book/guide-rngs.html). +/// +/// The PRNG algorithm in `SmallRng` is chosen to be +/// efficient on the current platform, without consideration for cryptography +/// or security. The size of its state is much smaller than [`StdRng`]. +/// The current algorithm is [`Pcg64Mcg`][rand_pcg::Pcg64Mcg] on 64-bit +/// platforms and [`Pcg32`][rand_pcg::Pcg32] on 32-bit platforms. Both are +/// implemented by the [rand_pcg] crate. /// /// # Examples /// -/// Initializing `SmallRng` with a random seed can be done using [`FromEntropy`]: +/// Initializing `SmallRng` with a random seed can be done using [`SeedableRng::from_entropy`]: /// /// ``` -/// # use rand::Rng; -/// use rand::FromEntropy; +/// use rand::{Rng, SeedableRng}; /// use rand::rngs::SmallRng; /// /// // Create small, cheap to initialize and fast RNG with a random seed. @@ -66,9 +71,9 @@ /// .collect(); /// ``` /// -/// [`FromEntropy`]: crate::FromEntropy /// [`StdRng`]: crate::rngs::StdRng /// [`thread_rng`]: crate::thread_rng +/// [rand_chacha]: https://crates.io/crates/rand_chacha /// [rand_pcg]: https://crates.io/crates/rand_pcg #[derive(Clone, Debug)] pub struct SmallRng(Rng); @@ -84,10 +89,12 @@ self.0.next_u64() } + #[inline(always)] fn fill_bytes(&mut self, dest: &mut [u8]) { self.0.fill_bytes(dest); } + #[inline(always)] fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { self.0.try_fill_bytes(dest) } @@ -96,10 +103,12 @@ impl SeedableRng for SmallRng { type Seed = ::Seed; + #[inline(always)] fn from_seed(seed: Self::Seed) -> Self { SmallRng(Rng::from_seed(seed)) } + #[inline(always)] fn from_rng(rng: R) -> Result { Rng::from_rng(rng).map(SmallRng) } diff -Nru cargo-0.35.0/vendor/rand/src/rngs/std.rs cargo-0.37.0/vendor/rand/src/rngs/std.rs --- cargo-0.35.0/vendor/rand/src/rngs/std.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/rngs/std.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,29 +8,30 @@ //! The standard RNG -use {RngCore, CryptoRng, Error, SeedableRng}; -use rand_hc::Hc128Rng; +use crate::{RngCore, CryptoRng, Error, SeedableRng}; + +#[cfg(target_os = "emscripten")] pub(crate) use rand_hc::Hc128Core as Core; +#[cfg(not(target_os = "emscripten"))] pub(crate) use rand_chacha::ChaCha20Core as Core; +#[cfg(target_os = "emscripten")] use rand_hc::Hc128Rng as Rng; +#[cfg(not(target_os = "emscripten"))] use rand_chacha::ChaCha20Rng as Rng; /// The standard RNG. The PRNG algorithm in `StdRng` is chosen to be efficient /// on the current platform, to be statistically strong and unpredictable /// (meaning a cryptographically secure PRNG). /// -/// The current algorithm used on all platforms is [HC-128], found in the -/// [rand_hc] crate. +/// The current algorithm used is the ChaCha block cipher with either 20 or 12 +/// rounds (see the `stdrng_*` feature flags, documented in the README). +/// This may change as new evidence of cipher security and performance +/// becomes available. /// -/// Reproducibility of output from this generator is however not required, thus -/// future library versions may use a different internal generator with -/// different output. Further, this generator may not be portable and can -/// produce different output depending on the architecture. If you require -/// reproducible output, use a named RNG, for example [`ChaChaRng`] from the -/// [rand_chacha] crate. +/// The algorithm is deterministic but should not be considered reproducible +/// due to dependence on configuration and possible replacement in future +/// library versions. For a secure reproducible generator, we recommend use of +/// the [rand_chacha] crate directly. /// -/// [HC-128]: rand_hc::Hc128Rng -/// [`ChaChaRng`]: rand_chacha::ChaChaRng -/// [rand_hc]: https://crates.io/crates/rand_hc /// [rand_chacha]: https://crates.io/crates/rand_chacha #[derive(Clone, Debug)] -pub struct StdRng(Hc128Rng); +pub struct StdRng(Rng); impl RngCore for StdRng { #[inline(always)] @@ -43,24 +44,28 @@ self.0.next_u64() } + #[inline(always)] fn fill_bytes(&mut self, dest: &mut [u8]) { self.0.fill_bytes(dest); } + #[inline(always)] fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { self.0.try_fill_bytes(dest) } } impl SeedableRng for StdRng { - type Seed = ::Seed; + type Seed = ::Seed; + #[inline(always)] fn from_seed(seed: Self::Seed) -> Self { - StdRng(Hc128Rng::from_seed(seed)) + StdRng(Rng::from_seed(seed)) } + #[inline(always)] fn from_rng(rng: R) -> Result { - Hc128Rng::from_rng(rng).map(StdRng) + Rng::from_rng(rng).map(StdRng) } } @@ -69,17 +74,27 @@ #[cfg(test)] mod test { - use {RngCore, SeedableRng}; - use rngs::StdRng; + use crate::{RngCore, SeedableRng}; + use crate::rngs::StdRng; #[test] fn test_stdrng_construction() { + // Test value-stability of StdRng. This is expected to break any time + // the algorithm is changed. let seed = [1,0,0,0, 23,0,0,0, 200,1,0,0, 210,30,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; - let mut rng1 = StdRng::from_seed(seed); - assert_eq!(rng1.next_u64(), 15759097995037006553); - let mut rng2 = StdRng::from_rng(rng1).unwrap(); - assert_eq!(rng2.next_u64(), 6766915756997287454); + #[cfg(any(feature="stdrng_strong", not(feature="stdrng_fast")))] + let target = [3950704604716924505, 5573172343717151650]; + #[cfg(all(not(feature="stdrng_strong"), feature="stdrng_fast"))] + let target = [10719222850664546238, 14064965282130556830]; + + let mut rng0 = StdRng::from_seed(seed); + let x0 = rng0.next_u64(); + + let mut rng1 = StdRng::from_rng(rng0).unwrap(); + let x1 = rng1.next_u64(); + + assert_eq!([x0, x1], target); } } diff -Nru cargo-0.35.0/vendor/rand/src/rngs/thread.rs cargo-0.37.0/vendor/rand/src/rngs/thread.rs --- cargo-0.35.0/vendor/rand/src/rngs/thread.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/rngs/thread.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,11 +9,12 @@ //! Thread-local random number generator use std::cell::UnsafeCell; +use std::ptr::NonNull; -use {RngCore, CryptoRng, SeedableRng, Error}; -use rngs::adapter::ReseedingRng; -use rngs::EntropyRng; -use rand_hc::Hc128Core; +use crate::{RngCore, CryptoRng, SeedableRng, Error}; +use crate::rngs::adapter::ReseedingRng; +use crate::rngs::OsRng; +use super::std::Core; // Rationale for using `UnsafeCell` in `ThreadRng`: // @@ -28,59 +29,43 @@ // completely under our control. We just have to ensure none of them use // `ThreadRng` internally, which is nonsensical anyway. We should also never run // `ThreadRng` in destructors of its implementation, which is also nonsensical. -// -// The additional `Rc` is not strictly neccesary, and could be removed. For now -// it ensures `ThreadRng` stays `!Send` and `!Sync`, and implements `Clone`. -// Number of generated bytes after which to reseed `TreadRng`. -// -// The time it takes to reseed HC-128 is roughly equivalent to generating 7 KiB. -// We pick a treshold here that is large enough to not reduce the average -// performance too much, but also small enough to not make reseeding something -// that basically never happens. -const THREAD_RNG_RESEED_THRESHOLD: u64 = 32*1024*1024; // 32 MiB +// Number of generated bytes after which to reseed `ThreadRng`. +// According to benchmarks, reseeding has a noticable impact with thresholds +// of 32 kB and less. We choose 64 kB to avoid significant overhead. +const THREAD_RNG_RESEED_THRESHOLD: u64 = 1024 * 64; /// The type returned by [`thread_rng`], essentially just a reference to the /// PRNG in thread-local memory. /// -/// `ThreadRng` uses [`ReseedingRng`] wrapping the same PRNG as [`StdRng`], -/// which is reseeded after generating 32 MiB of random data. A single instance -/// is cached per thread and the returned `ThreadRng` is a reference to this -/// instance — hence `ThreadRng` is neither `Send` nor `Sync` but is safe to use -/// within a single thread. This RNG is seeded and reseeded via [`EntropyRng`] -/// as required. +/// `ThreadRng` uses the same PRNG as [`StdRng`] for security and performance. +/// As hinted by the name, the generator is thread-local. `ThreadRng` is a +/// handle to this generator and thus supports `Copy`, but not `Send` or `Sync`. /// -/// Note that the reseeding is done as an extra precaution against entropy -/// leaks and is in theory unnecessary — to predict `ThreadRng`'s output, an -/// attacker would have to either determine most of the RNG's seed or internal -/// state, or crack the algorithm used. +/// Unlike `StdRng`, `ThreadRng` uses the [`ReseedingRng`] wrapper to reseed +/// the PRNG from fresh entropy every 64 kiB of random data. +/// [`OsRng`] is used to provide seed data. /// -/// Like [`StdRng`], `ThreadRng` is a cryptographically secure PRNG. The current -/// algorithm used is [HC-128], which is an array-based PRNG that trades memory -/// usage for better performance. This makes it similar to ISAAC, the algorithm -/// used in `ThreadRng` before rand 0.5. +/// Note that the reseeding is done as an extra precaution against side-channel +/// attacks and mis-use (e.g. if somehow weak entropy were supplied initially). +/// The PRNG algorithms used are assumed to be secure. /// -/// Cloning this handle just produces a new reference to the same thread-local -/// generator. -/// /// [`ReseedingRng`]: crate::rngs::adapter::ReseedingRng /// [`StdRng`]: crate::rngs::StdRng -/// [HC-128]: rand_hc::Hc128Rng -#[derive(Clone, Debug)] +#[derive(Copy, Clone, Debug)] pub struct ThreadRng { - // use of raw pointer implies type is neither Send nor Sync - rng: *mut ReseedingRng, + // inner raw pointer implies type is neither Send nor Sync + rng: NonNull>, } thread_local!( - static THREAD_RNG_KEY: UnsafeCell> = { - let mut entropy_source = EntropyRng::new(); - let r = Hc128Core::from_rng(&mut entropy_source).unwrap_or_else(|err| + static THREAD_RNG_KEY: UnsafeCell> = { + let r = Core::from_rng(OsRng).unwrap_or_else(|err| panic!("could not initialize thread_rng: {}", err)); let rng = ReseedingRng::new(r, THREAD_RNG_RESEED_THRESHOLD, - entropy_source); + OsRng); UnsafeCell::new(rng) } ); @@ -89,36 +74,38 @@ /// seeded by the system. Intended to be used in method chaining style, /// e.g. `thread_rng().gen::()`, or cached locally, e.g. /// `let mut rng = thread_rng();`. Invoked by the `Default` trait, making -/// `ThreadRng::default()` equivelent. +/// `ThreadRng::default()` equivalent. /// /// For more information see [`ThreadRng`]. pub fn thread_rng() -> ThreadRng { - ThreadRng { rng: THREAD_RNG_KEY.with(|t| t.get()) } + let raw = THREAD_RNG_KEY.with(|t| t.get()); + let nn = NonNull::new(raw).unwrap(); + ThreadRng { rng: nn } } impl Default for ThreadRng { fn default() -> ThreadRng { - ::prelude::thread_rng() + crate::prelude::thread_rng() } } impl RngCore for ThreadRng { #[inline(always)] fn next_u32(&mut self) -> u32 { - unsafe { (*self.rng).next_u32() } + unsafe { self.rng.as_mut().next_u32() } } #[inline(always)] fn next_u64(&mut self) -> u64 { - unsafe { (*self.rng).next_u64() } + unsafe { self.rng.as_mut().next_u64() } } fn fill_bytes(&mut self, dest: &mut [u8]) { - unsafe { (*self.rng).fill_bytes(dest) } + unsafe { self.rng.as_mut().fill_bytes(dest) } } fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - unsafe { (*self.rng).try_fill_bytes(dest) } + unsafe { self.rng.as_mut().try_fill_bytes(dest) } } } @@ -129,8 +116,8 @@ mod test { #[test] fn test_thread_rng() { - use Rng; - let mut r = ::thread_rng(); + use crate::Rng; + let mut r = crate::thread_rng(); r.gen::(); assert_eq!(r.gen_range(0, 1), 0); } diff -Nru cargo-0.35.0/vendor/rand/src/seq/index.rs cargo-0.37.0/vendor/rand/src/seq/index.rs --- cargo-0.35.0/vendor/rand/src/seq/index.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/seq/index.rs 2019-07-17 05:42:23.000000000 +0000 @@ -6,18 +6,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! Index sampling +//! Low-level API for sampling indices #[cfg(feature="alloc")] use core::slice; #[cfg(feature="std")] use std::vec; -#[cfg(all(feature="alloc", not(feature="std")))] use alloc::vec::{self, Vec}; +#[cfg(all(feature="alloc", not(feature="std")))] use crate::alloc::vec::{self, Vec}; // BTreeMap is not as fast in tests, but better than nothing. #[cfg(feature="std")] use std::collections::{HashSet}; -#[cfg(all(feature="alloc", not(feature="std")))] use alloc::collections::BTreeSet; +#[cfg(all(feature="alloc", not(feature="std")))] use crate::alloc::collections::BTreeSet; -#[cfg(feature="alloc")] use distributions::{Distribution, Uniform}; -use Rng; +#[cfg(feature="alloc")] use crate::distributions::{Distribution, Uniform, uniform::SampleUniform}; +use crate::Rng; /// A vector of indices. /// @@ -173,14 +173,13 @@ /// Note that performance is significantly better over `u32` indices than over /// `u64` indices. Because of this we hide the underlying type behind an /// abstraction, `IndexVec`. -/// +/// /// If an allocation-free `no_std` function is required, it is suggested /// to adapt the internal `sample_floyd` implementation. /// /// Panics if `amount > length`. pub fn sample(rng: &mut R, length: usize, amount: usize) -> IndexVec - where R: Rng + ?Sized, -{ +where R: Rng + ?Sized { if amount > length { panic!("`amount` of samples must be less than or equal to `length`"); } @@ -213,9 +212,7 @@ if (length as f32) < C[j] * (amount as f32) { sample_inplace(rng, length, amount) } else { - // note: could have a specific u32 impl, but I'm lazy and - // generics don't have usable conversions - sample_rejection(rng, length as usize, amount as usize) + sample_rejection(rng, length, amount) } } } @@ -227,8 +224,7 @@ /// /// This implementation uses `O(amount)` memory and `O(amount^2)` time. fn sample_floyd(rng: &mut R, length: u32, amount: u32) -> IndexVec - where R: Rng + ?Sized, -{ +where R: Rng + ?Sized { // For small amount we use Floyd's fully-shuffled variant. For larger // amounts this is slow due to Vec::insert performance, so we shuffle // afterwards. Benchmarks show little overhead from extra logic. @@ -274,8 +270,7 @@ /// /// Set-up is `O(length)` time and memory and shuffling is `O(amount)` time. fn sample_inplace(rng: &mut R, length: u32, amount: u32) -> IndexVec - where R: Rng + ?Sized, -{ +where R: Rng + ?Sized { debug_assert!(amount <= length); let mut indices: Vec = Vec::with_capacity(length as usize); indices.extend(0..length); @@ -288,21 +283,36 @@ IndexVec::from(indices) } +trait UInt: Copy + PartialOrd + Ord + PartialEq + Eq + SampleUniform + core::hash::Hash { + fn zero() -> Self; + fn as_usize(self) -> usize; +} +impl UInt for u32 { + #[inline] fn zero() -> Self { 0 } + #[inline] fn as_usize(self) -> usize { self as usize } +} +impl UInt for usize { + #[inline] fn zero() -> Self { 0 } + #[inline] fn as_usize(self) -> usize { self } +} + /// Randomly sample exactly `amount` indices from `0..length`, using rejection /// sampling. -/// +/// /// Since `amount <<< length` there is a low chance of a random sample in /// `0..length` being a duplicate. We test for duplicates and resample where /// necessary. The algorithm is `O(amount)` time and memory. -fn sample_rejection(rng: &mut R, length: usize, amount: usize) -> IndexVec - where R: Rng + ?Sized, -{ +/// +/// This function is generic over X primarily so that results are value-stable +/// over 32-bit and 64-bit platforms. +fn sample_rejection(rng: &mut R, length: X, amount: X) -> IndexVec +where R: Rng + ?Sized, IndexVec: From> { debug_assert!(amount < length); - #[cfg(feature="std")] let mut cache = HashSet::with_capacity(amount); + #[cfg(feature="std")] let mut cache = HashSet::with_capacity(amount.as_usize()); #[cfg(not(feature="std"))] let mut cache = BTreeSet::new(); - let distr = Uniform::new(0, length); - let mut indices = Vec::with_capacity(amount); - for _ in 0..amount { + let distr = Uniform::new(X::zero(), length); + let mut indices = Vec::with_capacity(amount.as_usize()); + for _ in 0..amount.as_usize() { let mut pos = distr.sample(rng); while !cache.insert(pos) { pos = distr.sample(rng); @@ -310,30 +320,32 @@ indices.push(pos); } - debug_assert_eq!(indices.len(), amount); + debug_assert_eq!(indices.len(), amount.as_usize()); IndexVec::from(indices) } #[cfg(test)] mod test { + #[cfg(feature="std")] use std::vec; + #[cfg(all(feature="alloc", not(feature="std")))] use crate::alloc::vec; use super::*; #[test] fn test_sample_boundaries() { - let mut r = ::test::rng(404); + let mut r = crate::test::rng(404); assert_eq!(sample_inplace(&mut r, 0, 0).len(), 0); assert_eq!(sample_inplace(&mut r, 1, 0).len(), 0); assert_eq!(sample_inplace(&mut r, 1, 1).into_vec(), vec![0]); - assert_eq!(sample_rejection(&mut r, 1, 0).len(), 0); + assert_eq!(sample_rejection(&mut r, 1u32, 0).len(), 0); assert_eq!(sample_floyd(&mut r, 0, 0).len(), 0); assert_eq!(sample_floyd(&mut r, 1, 0).len(), 0); assert_eq!(sample_floyd(&mut r, 1, 1).into_vec(), vec![0]); // These algorithms should be fast with big numbers. Test average. - let sum: usize = sample_rejection(&mut r, 1 << 25, 10) + let sum: usize = sample_rejection(&mut r, 1 << 25, 10u32) .into_iter().sum(); assert!(1 << 25 < sum && sum < (1 << 25) * 25); @@ -343,8 +355,9 @@ } #[test] + #[cfg(not(miri))] // Miri is too slow fn test_sample_alg() { - let seed_rng = ::test::rng; + let seed_rng = crate::test::rng; // We can't test which algorithm is used directly, but Floyd's alg // should produce different results from the others. (Also, `inplace` @@ -371,7 +384,7 @@ // A large length and larger amount should use cache let (length, amount): (usize, usize) = (1<<20, 600); let v1 = sample(&mut seed_rng(422), length, amount); - let v2 = sample_rejection(&mut seed_rng(422), length, amount); + let v2 = sample_rejection(&mut seed_rng(422), length as u32, amount as u32); assert!(v1.iter().all(|e| e < length)); assert_eq!(v1, v2); } diff -Nru cargo-0.35.0/vendor/rand/src/seq/mod.rs cargo-0.37.0/vendor/rand/src/seq/mod.rs --- cargo-0.35.0/vendor/rand/src/seq/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/src/seq/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -6,25 +6,55 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! Functions for randomly accessing and sampling sequences. +//! Sequence-related functionality //! -//! TODO: module doc +//! This module provides: +//! +//! * [`seq::SliceRandom`] slice sampling and mutation +//! * [`seq::IteratorRandom`] iterator sampling +//! * [`seq::index::sample`] low-level API to choose multiple indices from +//! `0..length` +//! +//! Also see: +//! +//! * [`distributions::weighted`] module which provides implementations of +//! weighted index sampling. +//! +//! In order to make results reproducible across 32-64 bit architectures, all +//! `usize` indices are sampled as a `u32` where possible (also providing a +//! small performance boost in some cases). #[cfg(feature="alloc")] pub mod index; #[cfg(feature="alloc")] use core::ops::Index; -#[cfg(all(feature="alloc", not(feature="std")))] use alloc::vec::Vec; +#[cfg(all(feature="alloc", not(feature="std")))] use crate::alloc::vec::Vec; -use Rng; -#[cfg(feature="alloc")] use distributions::WeightedError; -#[cfg(feature="alloc")] use distributions::uniform::{SampleUniform, SampleBorrow}; +use crate::Rng; +#[cfg(feature="alloc")] use crate::distributions::WeightedError; +#[cfg(feature="alloc")] use crate::distributions::uniform::{SampleUniform, SampleBorrow}; /// Extension trait on slices, providing random mutation and sampling methods. /// -/// An implementation is provided for slices. This may also be implementable for -/// other types. +/// This trait is implemented on all `[T]` slice types, providing several +/// methods for choosing and shuffling elements. You must `use` this trait: +/// +/// ``` +/// use rand::seq::SliceRandom; +/// +/// fn main() { +/// let mut rng = rand::thread_rng(); +/// let mut bytes = "Hello, random!".to_string().into_bytes(); +/// bytes.shuffle(&mut rng); +/// let str = String::from_utf8(bytes).unwrap(); +/// println!("{}", str); +/// } +/// ``` +/// Example output (non-deterministic): +/// ```none +/// l,nmroHado !le +/// ``` pub trait SliceRandom { /// The element type. type Item; @@ -32,7 +62,7 @@ /// Returns a reference to one random element of the slice, or `None` if the /// slice is empty. /// - /// Depending on the implementation, complexity is expected to be `O(1)`. + /// For slices, complexity is `O(1)`. /// /// # Example /// @@ -46,33 +76,33 @@ /// assert_eq!(choices[..0].choose(&mut rng), None); /// ``` fn choose(&self, rng: &mut R) -> Option<&Self::Item> - where R: Rng + ?Sized; + where R: Rng + ?Sized; /// Returns a mutable reference to one random element of the slice, or /// `None` if the slice is empty. - /// - /// Depending on the implementation, complexity is expected to be `O(1)`. + /// + /// For slices, complexity is `O(1)`. fn choose_mut(&mut self, rng: &mut R) -> Option<&mut Self::Item> - where R: Rng + ?Sized; + where R: Rng + ?Sized; - /// Produces an iterator that chooses `amount` elements from the slice at - /// random without repeating any, and returns them in random order. - /// - /// In case this API is not sufficiently flexible, use `index::sample` then - /// apply the indices to the slice. - /// - /// Complexity is expected to be the same as `index::sample`. - /// + /// Chooses `amount` elements from the slice at random, without repetition, + /// and in random order. The returned iterator is appropriate both for + /// collection into a `Vec` and filling an existing buffer (see example). + /// + /// In case this API is not sufficiently flexible, use [`index::sample`]. + /// + /// For slices, complexity is the same as [`index::sample`]. + /// /// # Example /// ``` /// use rand::seq::SliceRandom; - /// + /// /// let mut rng = &mut rand::thread_rng(); /// let sample = "Hello, audience!".as_bytes(); - /// + /// /// // collect the results into a vector: /// let v: Vec = sample.choose_multiple(&mut rng, 3).cloned().collect(); - /// + /// /// // store in a buffer: /// let mut buf = [0u8; 5]; /// for (b, slot) in sample.choose_multiple(&mut rng, buf.len()).zip(buf.iter_mut()) { @@ -81,13 +111,18 @@ /// ``` #[cfg(feature = "alloc")] fn choose_multiple(&self, rng: &mut R, amount: usize) -> SliceChooseIter - where R: Rng + ?Sized; + where R: Rng + ?Sized; - /// Similar to [`choose`], where the likelihood of each outcome may be - /// specified. The specified function `weight` maps items `x` to a relative + /// Similar to [`choose`], but where the likelihood of each outcome may be + /// specified. + /// + /// The specified function `weight` maps each item `x` to a relative /// likelihood `weight(x)`. The probability of each item being selected is /// therefore `weight(x) / s`, where `s` is the sum of all `weight(x)`. /// + /// For slices of length `n`, complexity is `O(n)`. + /// See also [`choose_weighted_mut`], [`distributions::weighted`]. + /// /// # Example /// /// ``` @@ -99,46 +134,58 @@ /// println!("{:?}", choices.choose_weighted(&mut rng, |item| item.1).unwrap().0); /// ``` /// [`choose`]: SliceRandom::choose + /// [`choose_weighted_mut`]: SliceRandom::choose_weighted_mut + /// [`distributions::weighted`]: crate::distributions::weighted #[cfg(feature = "alloc")] - fn choose_weighted(&self, rng: &mut R, weight: F) -> Result<&Self::Item, WeightedError> - where R: Rng + ?Sized, - F: Fn(&Self::Item) -> B, - B: SampleBorrow, - X: SampleUniform + - for<'a> ::core::ops::AddAssign<&'a X> + - ::core::cmp::PartialOrd + - Clone + - Default; + fn choose_weighted( + &self, rng: &mut R, weight: F, + ) -> Result<&Self::Item, WeightedError> + where + R: Rng + ?Sized, + F: Fn(&Self::Item) -> B, + B: SampleBorrow, + X: SampleUniform + + for<'a> ::core::ops::AddAssign<&'a X> + + ::core::cmp::PartialOrd + + Clone + + Default; - /// Similar to [`choose_mut`], where the likelihood of each outcome may be - /// specified. The specified function `weight` maps items `x` to a relative + /// Similar to [`choose_mut`], but where the likelihood of each outcome may + /// be specified. + /// + /// The specified function `weight` maps each item `x` to a relative /// likelihood `weight(x)`. The probability of each item being selected is /// therefore `weight(x) / s`, where `s` is the sum of all `weight(x)`. /// - /// See also [`choose_weighted`]. + /// For slices of length `n`, complexity is `O(n)`. + /// See also [`choose_weighted`], [`distributions::weighted`]. /// /// [`choose_mut`]: SliceRandom::choose_mut /// [`choose_weighted`]: SliceRandom::choose_weighted + /// [`distributions::weighted`]: crate::distributions::weighted #[cfg(feature = "alloc")] - fn choose_weighted_mut(&mut self, rng: &mut R, weight: F) -> Result<&mut Self::Item, WeightedError> - where R: Rng + ?Sized, - F: Fn(&Self::Item) -> B, - B: SampleBorrow, - X: SampleUniform + - for<'a> ::core::ops::AddAssign<&'a X> + - ::core::cmp::PartialOrd + - Clone + - Default; + fn choose_weighted_mut( + &mut self, rng: &mut R, weight: F, + ) -> Result<&mut Self::Item, WeightedError> + where + R: Rng + ?Sized, + F: Fn(&Self::Item) -> B, + B: SampleBorrow, + X: SampleUniform + + for<'a> ::core::ops::AddAssign<&'a X> + + ::core::cmp::PartialOrd + + Clone + + Default; /// Shuffle a mutable slice in place. - /// - /// Depending on the implementation, complexity is expected to be `O(1)`. + /// + /// For slices of length `n`, complexity is `O(n)`. /// /// # Example /// /// ``` - /// use rand::thread_rng; /// use rand::seq::SliceRandom; + /// use rand::thread_rng; /// /// let mut rng = thread_rng(); /// let mut y = [1, 2, 3, 4, 5]; @@ -146,7 +193,8 @@ /// y.shuffle(&mut rng); /// println!("Shuffled: {:?}", y); /// ``` - fn shuffle(&mut self, rng: &mut R) where R: Rng + ?Sized; + fn shuffle(&mut self, rng: &mut R) + where R: Rng + ?Sized; /// Shuffle a slice in place, but exit early. /// @@ -164,40 +212,59 @@ /// If `amount` is greater than the number of elements in the slice, this /// will perform a full shuffle. /// - /// Complexity is expected to be `O(m)` where `m = amount`. - fn partial_shuffle(&mut self, rng: &mut R, amount: usize) - -> (&mut [Self::Item], &mut [Self::Item]) where R: Rng + ?Sized; + /// For slices, complexity is `O(m)` where `m = amount`. + fn partial_shuffle( + &mut self, rng: &mut R, amount: usize, + ) -> (&mut [Self::Item], &mut [Self::Item]) + where R: Rng + ?Sized; } /// Extension trait on iterators, providing random sampling methods. +/// +/// This trait is implemented on all sized iterators, providing methods for +/// choosing one or more elements. You must `use` this trait: +/// +/// ``` +/// use rand::seq::IteratorRandom; +/// +/// fn main() { +/// let mut rng = rand::thread_rng(); +/// +/// let faces = "😀😎😐😕😠😢"; +/// println!("I am {}!", faces.chars().choose(&mut rng).unwrap()); +/// } +/// ``` +/// Example output (non-deterministic): +/// ```none +/// I am 😀! +/// ``` pub trait IteratorRandom: Iterator + Sized { - /// Choose one element at random from the iterator. If you have a slice, - /// it's significantly faster to call the [`choose`] or [`choose_mut`] - /// functions using the slice instead. - /// - /// Returns `None` if and only if the iterator is empty. + /// Choose one element at random from the iterator. /// - /// Complexity is `O(n)`, where `n` is the length of the iterator. - /// This likely consumes multiple random numbers, but the exact number - /// is unspecified. + /// Returns `None` if and only if the iterator is empty. /// - /// [`choose`]: SliceRandom::method.choose - /// [`choose_mut`]: SliceRandom::choose_mut + /// This method uses [`Iterator::size_hint`] for optimisation. With an + /// accurate hint and where [`Iterator::nth`] is a constant-time operation + /// this method can offer `O(1)` performance. Where no size hint is + /// available, complexity is `O(n)` where `n` is the iterator length. + /// Partial hints (where `lower > 0`) also improve performance. + /// + /// For slices, prefer [`SliceRandom::choose`] which guarantees `O(1)` + /// performance. fn choose(mut self, rng: &mut R) -> Option - where R: Rng + ?Sized - { + where R: Rng + ?Sized { let (mut lower, mut upper) = self.size_hint(); let mut consumed = 0; let mut result = None; if upper == Some(lower) { - return if lower == 0 { None } else { self.nth(rng.gen_range(0, lower)) }; + return if lower == 0 { None } else { self.nth(gen_index(rng, lower)) }; } // Continue until the iterator is exhausted loop { if lower > 1 { - let ix = rng.gen_range(0, lower + consumed); + let ix = gen_index(rng, lower + consumed); let skip; if ix < lower { result = self.nth(ix); @@ -230,21 +297,21 @@ } } - /// Collects `amount` values at random from the iterator into a supplied - /// buffer. - /// + /// Collects values at random from the iterator into a supplied buffer + /// until that buffer is filled. + /// /// Although the elements are selected randomly, the order of elements in /// the buffer is neither stable nor fully random. If random ordering is /// desired, shuffle the result. - /// - /// Returns the number of elements added to the buffer. This equals `amount` - /// unless the iterator contains insufficient elements, in which case this - /// equals the number of elements available. - /// + /// + /// Returns the number of elements added to the buffer. This equals the length + /// of the buffer unless the iterator contains insufficient elements, in which + /// case this equals the number of elements available. + /// /// Complexity is `O(n)` where `n` is the length of the iterator. - fn choose_multiple_fill(mut self, rng: &mut R, buf: &mut [Self::Item]) - -> usize where R: Rng + ?Sized - { + /// For slices, prefer [`SliceRandom::choose_multiple`]. + fn choose_multiple_fill(mut self, rng: &mut R, buf: &mut [Self::Item]) -> usize + where R: Rng + ?Sized { let amount = buf.len(); let mut len = 0; while len < amount { @@ -259,7 +326,7 @@ // Continue, since the iterator was not exhausted for (i, elem) in self.enumerate() { - let k = rng.gen_range(0, i + 1 + amount); + let k = gen_index(rng, i + 1 + amount); if let Some(slot) = buf.get_mut(k) { *slot = elem; } @@ -274,16 +341,16 @@ /// Although the elements are selected randomly, the order of elements in /// the buffer is neither stable nor fully random. If random ordering is /// desired, shuffle the result. - /// + /// /// The length of the returned vector equals `amount` unless the iterator /// contains insufficient elements, in which case it equals the number of /// elements available. - /// + /// /// Complexity is `O(n)` where `n` is the length of the iterator. + /// For slices, prefer [`SliceRandom::choose_multiple`]. #[cfg(feature = "alloc")] fn choose_multiple(mut self, rng: &mut R, amount: usize) -> Vec - where R: Rng + ?Sized - { + where R: Rng + ?Sized { let mut reservoir = Vec::with_capacity(amount); reservoir.extend(self.by_ref().take(amount)); @@ -293,7 +360,7 @@ // If the iterator stops once, then so do we. if reservoir.len() == amount { for (i, elem) in self.enumerate() { - let k = rng.gen_range(0, i + 1 + amount); + let k = gen_index(rng, i + 1 + amount); if let Some(slot) = reservoir.get_mut(k) { *slot = elem; } @@ -312,31 +379,27 @@ type Item = T; fn choose(&self, rng: &mut R) -> Option<&Self::Item> - where R: Rng + ?Sized - { + where R: Rng + ?Sized { if self.is_empty() { None } else { - Some(&self[rng.gen_range(0, self.len())]) + Some(&self[gen_index(rng, self.len())]) } } fn choose_mut(&mut self, rng: &mut R) -> Option<&mut Self::Item> - where R: Rng + ?Sized - { + where R: Rng + ?Sized { if self.is_empty() { None } else { let len = self.len(); - Some(&mut self[rng.gen_range(0, len)]) + Some(&mut self[gen_index(rng, len)]) } } #[cfg(feature = "alloc")] - fn choose_multiple(&self, rng: &mut R, amount: usize) - -> SliceChooseIter - where R: Rng + ?Sized - { + fn choose_multiple(&self, rng: &mut R, amount: usize) -> SliceChooseIter + where R: Rng + ?Sized { let amount = ::core::cmp::min(amount, self.len()); SliceChooseIter { slice: self, @@ -346,57 +409,66 @@ } #[cfg(feature = "alloc")] - fn choose_weighted(&self, rng: &mut R, weight: F) -> Result<&Self::Item, WeightedError> - where R: Rng + ?Sized, - F: Fn(&Self::Item) -> B, - B: SampleBorrow, - X: SampleUniform + - for<'a> ::core::ops::AddAssign<&'a X> + - ::core::cmp::PartialOrd + - Clone + - Default { - use distributions::{Distribution, WeightedIndex}; + fn choose_weighted( + &self, rng: &mut R, weight: F, + ) -> Result<&Self::Item, WeightedError> + where + R: Rng + ?Sized, + F: Fn(&Self::Item) -> B, + B: SampleBorrow, + X: SampleUniform + + for<'a> ::core::ops::AddAssign<&'a X> + + ::core::cmp::PartialOrd + + Clone + + Default, + { + use crate::distributions::{Distribution, WeightedIndex}; let distr = WeightedIndex::new(self.iter().map(weight))?; Ok(&self[distr.sample(rng)]) } #[cfg(feature = "alloc")] - fn choose_weighted_mut(&mut self, rng: &mut R, weight: F) -> Result<&mut Self::Item, WeightedError> - where R: Rng + ?Sized, - F: Fn(&Self::Item) -> B, - B: SampleBorrow, - X: SampleUniform + - for<'a> ::core::ops::AddAssign<&'a X> + - ::core::cmp::PartialOrd + - Clone + - Default { - use distributions::{Distribution, WeightedIndex}; + fn choose_weighted_mut( + &mut self, rng: &mut R, weight: F, + ) -> Result<&mut Self::Item, WeightedError> + where + R: Rng + ?Sized, + F: Fn(&Self::Item) -> B, + B: SampleBorrow, + X: SampleUniform + + for<'a> ::core::ops::AddAssign<&'a X> + + ::core::cmp::PartialOrd + + Clone + + Default, + { + use crate::distributions::{Distribution, WeightedIndex}; let distr = WeightedIndex::new(self.iter().map(weight))?; Ok(&mut self[distr.sample(rng)]) } - fn shuffle(&mut self, rng: &mut R) where R: Rng + ?Sized - { + fn shuffle(&mut self, rng: &mut R) + where R: Rng + ?Sized { for i in (1..self.len()).rev() { // invariant: elements with index > i have been locked in place. - self.swap(i, rng.gen_range(0, i + 1)); + self.swap(i, gen_index(rng, i + 1)); } } - fn partial_shuffle(&mut self, rng: &mut R, amount: usize) - -> (&mut [Self::Item], &mut [Self::Item]) where R: Rng + ?Sized - { + fn partial_shuffle( + &mut self, rng: &mut R, amount: usize, + ) -> (&mut [Self::Item], &mut [Self::Item]) + where R: Rng + ?Sized { // This applies Durstenfeld's algorithm for the // [Fisher–Yates shuffle](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm) // for an unbiased permutation, but exits early after choosing `amount` // elements. - + let len = self.len(); let end = if amount >= len { 0 } else { len - amount }; - + for i in (end..len).rev() { // invariant: elements with index > i have been locked in place. - self.swap(i, rng.gen_range(0, i + 1)); + self.swap(i, gen_index(rng, i + 1)); } let r = self.split_at_mut(end); (r.1, r.0) @@ -406,7 +478,10 @@ impl IteratorRandom for I where I: Iterator + Sized {} -/// Iterator over multiple choices, as returned by [`SliceRandom::choose_multiple] +/// An iterator over multiple slice elements. +/// +/// This struct is created by +/// [`SliceRandom::choose_multiple`](trait.SliceRandom.html#tymethod.choose_multiple). #[cfg(feature = "alloc")] #[derive(Debug)] pub struct SliceChooseIter<'a, S: ?Sized + 'a, T: 'a> { @@ -423,7 +498,7 @@ // TODO: investigate using SliceIndex::get_unchecked when stable self.indices.next().map(|i| &self.slice[i as usize]) } - + fn size_hint(&self) -> (usize, Option) { (self.indices.len(), Some(self.indices.len())) } @@ -439,88 +514,39 @@ } -/// Randomly sample `amount` elements from a finite iterator. -/// -/// Deprecated: use [`IteratorRandom::choose_multiple`] instead. -#[cfg(feature = "alloc")] -#[deprecated(since="0.6.0", note="use IteratorRandom::choose_multiple instead")] -pub fn sample_iter(rng: &mut R, iterable: I, amount: usize) -> Result, Vec> - where I: IntoIterator, - R: Rng + ?Sized, -{ - use seq::IteratorRandom; - let iter = iterable.into_iter(); - let result = iter.choose_multiple(rng, amount); - if result.len() == amount { - Ok(result) +// Sample a number uniformly between 0 and `ubound`. Uses 32-bit sampling where +// possible, primarily in order to produce the same output on 32-bit and 64-bit +// platforms. +#[inline] +fn gen_index(rng: &mut R, ubound: usize) -> usize { + if ubound <= (core::u32::MAX as usize) { + rng.gen_range(0, ubound as u32) as usize } else { - Err(result) + rng.gen_range(0, ubound) } } -/// Randomly sample exactly `amount` values from `slice`. -/// -/// The values are non-repeating and in random order. -/// -/// This implementation uses `O(amount)` time and memory. -/// -/// Panics if `amount > slice.len()` -/// -/// Deprecated: use [`SliceRandom::choose_multiple`] instead. -#[cfg(feature = "alloc")] -#[deprecated(since="0.6.0", note="use SliceRandom::choose_multiple instead")] -pub fn sample_slice(rng: &mut R, slice: &[T], amount: usize) -> Vec - where R: Rng + ?Sized, - T: Clone -{ - let indices = index::sample(rng, slice.len(), amount).into_iter(); - - let mut out = Vec::with_capacity(amount); - out.extend(indices.map(|i| slice[i].clone())); - out -} - -/// Randomly sample exactly `amount` references from `slice`. -/// -/// The references are non-repeating and in random order. -/// -/// This implementation uses `O(amount)` time and memory. -/// -/// Panics if `amount > slice.len()` -/// -/// Deprecated: use [`SliceRandom::choose_multiple`] instead. -#[cfg(feature = "alloc")] -#[deprecated(since="0.6.0", note="use SliceRandom::choose_multiple instead")] -pub fn sample_slice_ref<'a, R, T>(rng: &mut R, slice: &'a [T], amount: usize) -> Vec<&'a T> - where R: Rng + ?Sized -{ - let indices = index::sample(rng, slice.len(), amount).into_iter(); - - let mut out = Vec::with_capacity(amount); - out.extend(indices.map(|i| &slice[i])); - out -} #[cfg(test)] mod test { use super::*; - #[cfg(feature = "alloc")] use {Rng, SeedableRng}; - #[cfg(feature = "alloc")] use rngs::SmallRng; + #[cfg(feature = "alloc")] use crate::Rng; #[cfg(all(feature="alloc", not(feature="std")))] use alloc::vec::Vec; #[test] fn test_slice_choose() { - let mut r = ::test::rng(107); + let mut r = crate::test::rng(107); let chars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n']; let mut chosen = [0i32; 14]; + // The below all use a binomial distribution with n=1000, p=1/14. + // binocdf(40, 1000, 1/14) ~= 2e-5; 1-binocdf(106, ..) ~= 2e-5 for _ in 0..1000 { let picked = *chars.choose(&mut r).unwrap(); chosen[(picked as usize) - ('a' as usize)] += 1; } for count in chosen.iter() { - let err = *count - (1000 / (chars.len() as i32)); - assert!(-20 <= err && err <= 20); + assert!(40 < *count && *count < 106); } chosen.iter_mut().for_each(|x| *x = 0); @@ -528,8 +554,7 @@ *chosen.choose_mut(&mut r).unwrap() += 1; } for count in chosen.iter() { - let err = *count - (1000 / (chosen.len() as i32)); - assert!(-20 <= err && err <= 20); + assert!(40 < *count && *count < 106); } let mut v: [isize; 0] = []; @@ -590,8 +615,9 @@ } #[test] + #[cfg(not(miri))] // Miri is too slow fn test_iterator_choose() { - let r = &mut ::test::rng(109); + let r = &mut crate::test::rng(109); fn test_iter + Clone>(r: &mut R, iter: Iter) { let mut chosen = [0i32; 9]; for _ in 0..1000 { @@ -621,8 +647,9 @@ } #[test] + #[cfg(not(miri))] // Miri is too slow fn test_shuffle() { - let mut r = ::test::rng(108); + let mut r = crate::test::rng(108); let empty: &mut [isize] = &mut []; empty.shuffle(&mut r); let mut one = [1]; @@ -662,14 +689,16 @@ counts[permutation] += 1; } for count in counts.iter() { - let err = *count - 10000i32 / 24; - assert!(-50 <= err && err <= 50); + // Binomial(10000, 1/24) with average 416.667 + // Octave: binocdf(n, 10000, 1/24) + // 99.9% chance samples lie within this range: + assert!(352 <= *count && *count <= 483, "count: {}", count); } } #[test] fn test_partial_shuffle() { - let mut r = ::test::rng(118); + let mut r = crate::test::rng(118); let mut empty: [u32; 0] = []; let res = empty.partial_shuffle(&mut r, 10); @@ -689,7 +718,7 @@ let min_val = 1; let max_val = 100; - let mut r = ::test::rng(401); + let mut r = crate::test::rng(401); let vals = (min_val..max_val).collect::>(); let small_sample = vals.iter().choose_multiple(&mut r, 5); let large_sample = vals.iter().choose_multiple(&mut r, vals.len() + 5); @@ -706,75 +735,9 @@ #[test] #[cfg(feature = "alloc")] - #[allow(deprecated)] - fn test_sample_slice_boundaries() { - let empty: &[u8] = &[]; - - let mut r = ::test::rng(402); - - // sample 0 items - assert_eq!(&sample_slice(&mut r, empty, 0)[..], [0u8; 0]); - assert_eq!(&sample_slice(&mut r, &[42, 2, 42], 0)[..], [0u8; 0]); - - // sample 1 item - assert_eq!(&sample_slice(&mut r, &[42], 1)[..], [42]); - let v = sample_slice(&mut r, &[1, 42], 1)[0]; - assert!(v == 1 || v == 42); - - // sample "all" the items - let v = sample_slice(&mut r, &[42, 133], 2); - assert!(&v[..] == [42, 133] || v[..] == [133, 42]); - - // Make sure lucky 777's aren't lucky - let slice = &[42, 777]; - let mut num_42 = 0; - let total = 1000; - for _ in 0..total { - let v = sample_slice(&mut r, slice, 1); - assert_eq!(v.len(), 1); - let v = v[0]; - assert!(v == 42 || v == 777); - if v == 42 { - num_42 += 1; - } - } - let ratio_42 = num_42 as f64 / 1000 as f64; - assert!(0.4 <= ratio_42 || ratio_42 <= 0.6, "{}", ratio_42); - } - - #[test] - #[cfg(feature = "alloc")] - #[allow(deprecated)] - fn test_sample_slice() { - let seeded_rng = SmallRng::from_seed; - - let mut r = ::test::rng(403); - - for n in 1..20 { - let length = 5*n - 4; // 1, 6, ... - let amount = r.gen_range(0, length); - let mut seed = [0u8; 16]; - r.fill(&mut seed); - - // assert the basics work - let regular = index::sample(&mut seeded_rng(seed), length, amount); - assert_eq!(regular.len(), amount); - assert!(regular.iter().all(|e| e < length)); - - // also test that sampling the slice works - let vec: Vec = (0..(length as u32)).collect(); - let result = sample_slice(&mut seeded_rng(seed), &vec, amount); - assert_eq!(result, regular.iter().map(|i| i as u32).collect::>()); - - let result = sample_slice_ref(&mut seeded_rng(seed), &vec, amount); - assert!(result.iter().zip(regular.iter()).all(|(i,j)| **i == j as u32)); - } - } - - #[test] - #[cfg(feature = "alloc")] + #[cfg(not(miri))] // Miri is too slow fn test_weighted() { - let mut r = ::test::rng(406); + let mut r = crate::test::rng(406); const N_REPS: u32 = 3000; let weights = [1u32, 2, 3, 0, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7]; let total_weight = weights.iter().sum::() as f32; @@ -823,7 +786,7 @@ assert_eq!(empty_slice.choose_weighted(&mut r, |_| 1), Err(WeightedError::NoItem)); assert_eq!(empty_slice.choose_weighted_mut(&mut r, |_| 1), Err(WeightedError::NoItem)); assert_eq!(['x'].choose_weighted_mut(&mut r, |_| 0), Err(WeightedError::AllWeightsZero)); - assert_eq!([0, -1].choose_weighted_mut(&mut r, |x| *x), Err(WeightedError::NegativeWeight)); - assert_eq!([-1, 0].choose_weighted_mut(&mut r, |x| *x), Err(WeightedError::NegativeWeight)); + assert_eq!([0, -1].choose_weighted_mut(&mut r, |x| *x), Err(WeightedError::InvalidWeight)); + assert_eq!([-1, 0].choose_weighted_mut(&mut r, |x| *x), Err(WeightedError::InvalidWeight)); } } diff -Nru cargo-0.35.0/vendor/rand/tests/uniformity.rs cargo-0.37.0/vendor/rand/tests/uniformity.rs --- cargo-0.35.0/vendor/rand/tests/uniformity.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand/tests/uniformity.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -// Copyright 2018 Developers of the Rand project. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![cfg(feature = "std")] - -#[macro_use] -extern crate average; -extern crate rand; - -use std as core; -use rand::FromEntropy; -use rand::distributions::Distribution; -use average::Histogram; - -const N_BINS: usize = 100; -const N_SAMPLES: u32 = 1_000_000; -const TOL: f64 = 1e-3; -define_histogram!(hist, 100); -use hist::Histogram as Histogram100; - -#[test] -fn unit_sphere() { - const N_DIM: usize = 3; - let h = Histogram100::with_const_width(-1., 1.); - let mut histograms = [h.clone(), h.clone(), h]; - let dist = rand::distributions::UnitSphereSurface::new(); - let mut rng = rand::rngs::SmallRng::from_entropy(); - for _ in 0..N_SAMPLES { - let v = dist.sample(&mut rng); - for i in 0..N_DIM { - histograms[i].add(v[i]).map_err( - |e| { println!("v: {}", v[i]); e } - ).unwrap(); - } - } - for h in &histograms { - let sum: u64 = h.bins().iter().sum(); - println!("{:?}", h); - for &b in h.bins() { - let p = (b as f64) / (sum as f64); - assert!((p - 1.0 / (N_BINS as f64)).abs() < TOL, "{}", p); - } - } -} - -#[test] -fn unit_circle() { - use ::std::f64::consts::PI; - let mut h = Histogram100::with_const_width(-PI, PI); - let dist = rand::distributions::UnitCircle::new(); - let mut rng = rand::rngs::SmallRng::from_entropy(); - for _ in 0..N_SAMPLES { - let v = dist.sample(&mut rng); - h.add(v[0].atan2(v[1])).unwrap(); - } - let sum: u64 = h.bins().iter().sum(); - println!("{:?}", h); - for &b in h.bins() { - let p = (b as f64) / (sum as f64); - assert!((p - 1.0 / (N_BINS as f64)).abs() < TOL, "{}", p); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/appveyor.yml cargo-0.37.0/vendor/rand-0.5.6/appveyor.yml --- cargo-0.35.0/vendor/rand-0.5.6/appveyor.yml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/appveyor.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -environment: - - # At the time this was added AppVeyor was having troubles with checking - # revocation of SSL certificates of sites like static.rust-lang.org and what - # we think is crates.io. The libcurl HTTP client by default checks for - # revocation on Windows and according to a mailing list [1] this can be - # disabled. - # - # The `CARGO_HTTP_CHECK_REVOKE` env var here tells cargo to disable SSL - # revocation checking on Windows in libcurl. Note, though, that rustup, which - # we're using to download Rust here, also uses libcurl as the default backend. - # Unlike Cargo, however, rustup doesn't have a mechanism to disable revocation - # checking. To get rustup working we set `RUSTUP_USE_HYPER` which forces it to - # use the Hyper instead of libcurl backend. Both Hyper and libcurl use - # schannel on Windows but it appears that Hyper configures it slightly - # differently such that revocation checking isn't turned on by default. - # - # [1]: https://curl.haxx.se/mail/lib-2016-03/0202.html - RUSTUP_USE_HYPER: 1 - CARGO_HTTP_CHECK_REVOKE: false - - matrix: - - TARGET: x86_64-pc-windows-msvc - - TARGET: i686-pc-windows-msvc -install: - - appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - - rustup-init.exe -y --default-host %TARGET% --default-toolchain nightly - - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - - rustc -V - - cargo -V - -build: false - -test_script: - - cargo test --all # cannot use --all and --features together - - cargo test --all --benches - - cargo test --features serde1,log,nightly - - cargo test --tests --no-default-features --features=alloc,serde1 - - cargo test --package rand_core --no-default-features --features=alloc,serde1 diff -Nru cargo-0.35.0/vendor/rand-0.5.6/benches/distributions.rs cargo-0.37.0/vendor/rand-0.5.6/benches/distributions.rs --- cargo-0.35.0/vendor/rand-0.5.6/benches/distributions.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/benches/distributions.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,161 +0,0 @@ -#![feature(test)] -#![cfg_attr(all(feature="i128_support", feature="nightly"), allow(stable_features))] // stable since 2018-03-27 -#![cfg_attr(all(feature="i128_support", feature="nightly"), feature(i128_type, i128))] - -extern crate test; -extern crate rand; - -const RAND_BENCH_N: u64 = 1000; - -use std::mem::size_of; -use test::Bencher; - -use rand::{Rng, FromEntropy, XorShiftRng}; -use rand::distributions::*; - -macro_rules! distr_int { - ($fnn:ident, $ty:ty, $distr:expr) => { - #[bench] - fn $fnn(b: &mut Bencher) { - let mut rng = XorShiftRng::from_entropy(); - let distr = $distr; - - b.iter(|| { - let mut accum = 0 as $ty; - for _ in 0..::RAND_BENCH_N { - let x: $ty = distr.sample(&mut rng); - accum = accum.wrapping_add(x); - } - accum - }); - b.bytes = size_of::<$ty>() as u64 * ::RAND_BENCH_N; - } - } -} - -macro_rules! distr_float { - ($fnn:ident, $ty:ty, $distr:expr) => { - #[bench] - fn $fnn(b: &mut Bencher) { - let mut rng = XorShiftRng::from_entropy(); - let distr = $distr; - - b.iter(|| { - let mut accum = 0.0; - for _ in 0..::RAND_BENCH_N { - let x: $ty = distr.sample(&mut rng); - accum += x; - } - accum - }); - b.bytes = size_of::<$ty>() as u64 * ::RAND_BENCH_N; - } - } -} - -macro_rules! distr { - ($fnn:ident, $ty:ty, $distr:expr) => { - #[bench] - fn $fnn(b: &mut Bencher) { - let mut rng = XorShiftRng::from_entropy(); - let distr = $distr; - - b.iter(|| { - let mut accum = 0u32; - for _ in 0..::RAND_BENCH_N { - let x: $ty = distr.sample(&mut rng); - accum = accum.wrapping_add(x as u32); - } - accum - }); - b.bytes = size_of::<$ty>() as u64 * ::RAND_BENCH_N; - } - } -} - -// uniform -distr_int!(distr_uniform_i8, i8, Uniform::new(20i8, 100)); -distr_int!(distr_uniform_i16, i16, Uniform::new(-500i16, 2000)); -distr_int!(distr_uniform_i32, i32, Uniform::new(-200_000_000i32, 800_000_000)); -distr_int!(distr_uniform_i64, i64, Uniform::new(3i64, 123_456_789_123)); -#[cfg(feature = "i128_support")] -distr_int!(distr_uniform_i128, i128, Uniform::new(-123_456_789_123i128, 123_456_789_123_456_789)); - -distr_float!(distr_uniform_f32, f32, Uniform::new(2.26f32, 2.319)); -distr_float!(distr_uniform_f64, f64, Uniform::new(2.26f64, 2.319)); - -// standard -distr_int!(distr_standard_i8, i8, Standard); -distr_int!(distr_standard_i16, i16, Standard); -distr_int!(distr_standard_i32, i32, Standard); -distr_int!(distr_standard_i64, i64, Standard); -#[cfg(feature = "i128_support")] -distr_int!(distr_standard_i128, i128, Standard); - -distr!(distr_standard_bool, bool, Standard); -distr!(distr_standard_alphanumeric, char, Alphanumeric); -distr!(distr_standard_codepoint, char, Standard); - -distr_float!(distr_standard_f32, f32, Standard); -distr_float!(distr_standard_f64, f64, Standard); -distr_float!(distr_open01_f32, f32, Open01); -distr_float!(distr_open01_f64, f64, Open01); -distr_float!(distr_openclosed01_f32, f32, OpenClosed01); -distr_float!(distr_openclosed01_f64, f64, OpenClosed01); - -// distributions -distr_float!(distr_exp, f64, Exp::new(1.23 * 4.56)); -distr_float!(distr_normal, f64, Normal::new(-1.23, 4.56)); -distr_float!(distr_log_normal, f64, LogNormal::new(-1.23, 4.56)); -distr_float!(distr_gamma_large_shape, f64, Gamma::new(10., 1.0)); -distr_float!(distr_gamma_small_shape, f64, Gamma::new(0.1, 1.0)); -distr_float!(distr_cauchy, f64, Cauchy::new(4.2, 6.9)); -distr_int!(distr_binomial, u64, Binomial::new(20, 0.7)); -distr_int!(distr_poisson, u64, Poisson::new(4.0)); -distr!(distr_bernoulli, bool, Bernoulli::new(0.18)); - - -// construct and sample from a range -macro_rules! gen_range_int { - ($fnn:ident, $ty:ident, $low:expr, $high:expr) => { - #[bench] - fn $fnn(b: &mut Bencher) { - let mut rng = XorShiftRng::from_entropy(); - - b.iter(|| { - let mut high = $high; - let mut accum: $ty = 0; - for _ in 0..::RAND_BENCH_N { - accum = accum.wrapping_add(rng.gen_range($low, high)); - // force recalculation of range each time - high = high.wrapping_add(1) & std::$ty::MAX; - } - accum - }); - b.bytes = size_of::<$ty>() as u64 * ::RAND_BENCH_N; - } - } -} - -gen_range_int!(gen_range_i8, i8, -20i8, 100); -gen_range_int!(gen_range_i16, i16, -500i16, 2000); -gen_range_int!(gen_range_i32, i32, -200_000_000i32, 800_000_000); -gen_range_int!(gen_range_i64, i64, 3i64, 123_456_789_123); -#[cfg(feature = "i128_support")] -gen_range_int!(gen_range_i128, i128, -12345678901234i128, 123_456_789_123_456_789); - -#[bench] -fn dist_iter(b: &mut Bencher) { - let mut rng = XorShiftRng::from_entropy(); - let distr = Normal::new(-2.71828, 3.14159); - let mut iter = distr.sample_iter(&mut rng); - - b.iter(|| { - let mut accum = 0.0; - for _ in 0..::RAND_BENCH_N { - accum += iter.next().unwrap(); - } - accum - }); - b.bytes = size_of::() as u64 * ::RAND_BENCH_N; -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/benches/generators.rs cargo-0.37.0/vendor/rand-0.5.6/benches/generators.rs --- cargo-0.35.0/vendor/rand-0.5.6/benches/generators.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/benches/generators.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,176 +0,0 @@ -#![feature(test)] - -extern crate test; -extern crate rand; - -const RAND_BENCH_N: u64 = 1000; -const BYTES_LEN: usize = 1024; - -use std::mem::size_of; -use test::{black_box, Bencher}; - -use rand::prelude::*; -use rand::prng::{XorShiftRng, Hc128Rng, IsaacRng, Isaac64Rng, ChaChaRng}; -use rand::prng::hc128::Hc128Core; -use rand::rngs::adapter::ReseedingRng; -use rand::rngs::{OsRng, JitterRng, EntropyRng}; - -macro_rules! gen_bytes { - ($fnn:ident, $gen:expr) => { - #[bench] - fn $fnn(b: &mut Bencher) { - let mut rng = $gen; - let mut buf = [0u8; BYTES_LEN]; - b.iter(|| { - for _ in 0..RAND_BENCH_N { - rng.fill_bytes(&mut buf); - black_box(buf); - } - }); - b.bytes = BYTES_LEN as u64 * RAND_BENCH_N; - } - } -} - -gen_bytes!(gen_bytes_xorshift, XorShiftRng::from_entropy()); -gen_bytes!(gen_bytes_chacha20, ChaChaRng::from_entropy()); -gen_bytes!(gen_bytes_hc128, Hc128Rng::from_entropy()); -gen_bytes!(gen_bytes_isaac, IsaacRng::from_entropy()); -gen_bytes!(gen_bytes_isaac64, Isaac64Rng::from_entropy()); -gen_bytes!(gen_bytes_std, StdRng::from_entropy()); -gen_bytes!(gen_bytes_small, SmallRng::from_entropy()); -gen_bytes!(gen_bytes_os, OsRng::new().unwrap()); - -macro_rules! gen_uint { - ($fnn:ident, $ty:ty, $gen:expr) => { - #[bench] - fn $fnn(b: &mut Bencher) { - let mut rng = $gen; - b.iter(|| { - let mut accum: $ty = 0; - for _ in 0..RAND_BENCH_N { - accum = accum.wrapping_add(rng.gen::<$ty>()); - } - accum - }); - b.bytes = size_of::<$ty>() as u64 * RAND_BENCH_N; - } - } -} - -gen_uint!(gen_u32_xorshift, u32, XorShiftRng::from_entropy()); -gen_uint!(gen_u32_chacha20, u32, ChaChaRng::from_entropy()); -gen_uint!(gen_u32_hc128, u32, Hc128Rng::from_entropy()); -gen_uint!(gen_u32_isaac, u32, IsaacRng::from_entropy()); -gen_uint!(gen_u32_isaac64, u32, Isaac64Rng::from_entropy()); -gen_uint!(gen_u32_std, u32, StdRng::from_entropy()); -gen_uint!(gen_u32_small, u32, SmallRng::from_entropy()); -gen_uint!(gen_u32_os, u32, OsRng::new().unwrap()); - -gen_uint!(gen_u64_xorshift, u64, XorShiftRng::from_entropy()); -gen_uint!(gen_u64_chacha20, u64, ChaChaRng::from_entropy()); -gen_uint!(gen_u64_hc128, u64, Hc128Rng::from_entropy()); -gen_uint!(gen_u64_isaac, u64, IsaacRng::from_entropy()); -gen_uint!(gen_u64_isaac64, u64, Isaac64Rng::from_entropy()); -gen_uint!(gen_u64_std, u64, StdRng::from_entropy()); -gen_uint!(gen_u64_small, u64, SmallRng::from_entropy()); -gen_uint!(gen_u64_os, u64, OsRng::new().unwrap()); - -// Do not test JitterRng like the others by running it RAND_BENCH_N times per, -// measurement, because it is way too slow. Only run it once. -#[bench] -fn gen_u64_jitter(b: &mut Bencher) { - let mut rng = JitterRng::new().unwrap(); - b.iter(|| { - rng.gen::() - }); - b.bytes = size_of::() as u64; -} - -macro_rules! init_gen { - ($fnn:ident, $gen:ident) => { - #[bench] - fn $fnn(b: &mut Bencher) { - let mut rng = XorShiftRng::from_entropy(); - b.iter(|| { - let r2 = $gen::from_rng(&mut rng).unwrap(); - r2 - }); - } - } -} - -init_gen!(init_xorshift, XorShiftRng); -init_gen!(init_hc128, Hc128Rng); -init_gen!(init_isaac, IsaacRng); -init_gen!(init_isaac64, Isaac64Rng); -init_gen!(init_chacha, ChaChaRng); - -#[bench] -fn init_jitter(b: &mut Bencher) { - b.iter(|| { - JitterRng::new().unwrap() - }); -} - - -const RESEEDING_THRESHOLD: u64 = 1024*1024*1024; // something high enough to get - // deterministic measurements - -#[bench] -fn reseeding_hc128_bytes(b: &mut Bencher) { - let mut rng = ReseedingRng::new(Hc128Core::from_entropy(), - RESEEDING_THRESHOLD, - EntropyRng::new()); - let mut buf = [0u8; BYTES_LEN]; - b.iter(|| { - for _ in 0..RAND_BENCH_N { - rng.fill_bytes(&mut buf); - black_box(buf); - } - }); - b.bytes = BYTES_LEN as u64 * RAND_BENCH_N; -} - -macro_rules! reseeding_uint { - ($fnn:ident, $ty:ty) => { - #[bench] - fn $fnn(b: &mut Bencher) { - let mut rng = ReseedingRng::new(Hc128Core::from_entropy(), - RESEEDING_THRESHOLD, - EntropyRng::new()); - b.iter(|| { - let mut accum: $ty = 0; - for _ in 0..RAND_BENCH_N { - accum = accum.wrapping_add(rng.gen::<$ty>()); - } - accum - }); - b.bytes = size_of::<$ty>() as u64 * RAND_BENCH_N; - } - } -} - -reseeding_uint!(reseeding_hc128_u32, u32); -reseeding_uint!(reseeding_hc128_u64, u64); - - -macro_rules! threadrng_uint { - ($fnn:ident, $ty:ty) => { - #[bench] - fn $fnn(b: &mut Bencher) { - let mut rng = thread_rng(); - b.iter(|| { - let mut accum: $ty = 0; - for _ in 0..RAND_BENCH_N { - accum = accum.wrapping_add(rng.gen::<$ty>()); - } - accum - }); - b.bytes = size_of::<$ty>() as u64 * RAND_BENCH_N; - } - } -} - -threadrng_uint!(thread_rng_u32, u32); -threadrng_uint!(thread_rng_u64, u64); diff -Nru cargo-0.35.0/vendor/rand-0.5.6/benches/misc.rs cargo-0.37.0/vendor/rand-0.5.6/benches/misc.rs --- cargo-0.35.0/vendor/rand-0.5.6/benches/misc.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/benches/misc.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,194 +0,0 @@ -#![feature(test)] - -extern crate test; -extern crate rand; - -const RAND_BENCH_N: u64 = 1000; - -use test::Bencher; - -use rand::prelude::*; -use rand::seq::*; - -#[bench] -fn misc_gen_bool_const(b: &mut Bencher) { - let mut rng = StdRng::from_rng(&mut thread_rng()).unwrap(); - b.iter(|| { - let mut accum = true; - for _ in 0..::RAND_BENCH_N { - accum ^= rng.gen_bool(0.18); - } - accum - }) -} - -#[bench] -fn misc_gen_bool_var(b: &mut Bencher) { - let mut rng = StdRng::from_rng(&mut thread_rng()).unwrap(); - b.iter(|| { - let mut accum = true; - let mut p = 0.18; - for _ in 0..::RAND_BENCH_N { - accum ^= rng.gen_bool(p); - p += 0.0001; - } - accum - }) -} - -#[bench] -fn misc_bernoulli_const(b: &mut Bencher) { - let mut rng = StdRng::from_rng(&mut thread_rng()).unwrap(); - let d = rand::distributions::Bernoulli::new(0.18); - b.iter(|| { - // Can be evaluated at compile time. - let mut accum = true; - for _ in 0..::RAND_BENCH_N { - accum ^= rng.sample(d); - } - accum - }) -} - -#[bench] -fn misc_bernoulli_var(b: &mut Bencher) { - let mut rng = StdRng::from_rng(&mut thread_rng()).unwrap(); - b.iter(|| { - let mut accum = true; - let mut p = 0.18; - for _ in 0..::RAND_BENCH_N { - let d = rand::distributions::Bernoulli::new(p); - accum ^= rng.sample(d); - p += 0.0001; - } - accum - }) -} - -macro_rules! sample_binomial { - ($name:ident, $n:expr, $p:expr) => { - #[bench] - fn $name(b: &mut Bencher) { - let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap(); - let (n, p) = ($n, $p); - b.iter(|| { - let d = rand::distributions::Binomial::new(n, p); - rng.sample(d) - }) - } - } -} - -sample_binomial!(misc_binomial_1, 1, 0.9); -sample_binomial!(misc_binomial_10, 10, 0.9); -sample_binomial!(misc_binomial_100, 100, 0.99); -sample_binomial!(misc_binomial_1000, 1000, 0.01); -sample_binomial!(misc_binomial_1e12, 1000_000_000_000, 0.2); - -#[bench] -fn misc_shuffle_100(b: &mut Bencher) { - let mut rng = SmallRng::from_rng(thread_rng()).unwrap(); - let x : &mut [usize] = &mut [1; 100]; - b.iter(|| { - rng.shuffle(x); - x[0] - }) -} - -#[bench] -fn misc_sample_iter_10_of_100(b: &mut Bencher) { - let mut rng = SmallRng::from_rng(thread_rng()).unwrap(); - let x : &[usize] = &[1; 100]; - b.iter(|| { - sample_iter(&mut rng, x, 10).unwrap_or_else(|e| e) - }) -} - -#[bench] -fn misc_sample_slice_10_of_100(b: &mut Bencher) { - let mut rng = SmallRng::from_rng(thread_rng()).unwrap(); - let x : &[usize] = &[1; 100]; - b.iter(|| { - sample_slice(&mut rng, x, 10) - }) -} - -#[bench] -fn misc_sample_slice_ref_10_of_100(b: &mut Bencher) { - let mut rng = SmallRng::from_rng(thread_rng()).unwrap(); - let x : &[usize] = &[1; 100]; - b.iter(|| { - sample_slice_ref(&mut rng, x, 10) - }) -} - -macro_rules! sample_indices { - ($name:ident, $amount:expr, $length:expr) => { - #[bench] - fn $name(b: &mut Bencher) { - let mut rng = SmallRng::from_rng(thread_rng()).unwrap(); - b.iter(|| { - sample_indices(&mut rng, $length, $amount) - }) - } - } -} - -sample_indices!(misc_sample_indices_10_of_1k, 10, 1000); -sample_indices!(misc_sample_indices_50_of_1k, 50, 1000); -sample_indices!(misc_sample_indices_100_of_1k, 100, 1000); - -#[bench] -fn gen_1k_iter_repeat(b: &mut Bencher) { - use std::iter; - let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap(); - b.iter(|| { - let v: Vec = iter::repeat(()).map(|()| rng.gen()).take(128).collect(); - v - }); - b.bytes = 1024; -} - -#[bench] -#[allow(deprecated)] -fn gen_1k_gen_iter(b: &mut Bencher) { - let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap(); - b.iter(|| { - let v: Vec = rng.gen_iter().take(128).collect(); - v - }); - b.bytes = 1024; -} - -#[bench] -fn gen_1k_sample_iter(b: &mut Bencher) { - use rand::distributions::{Distribution, Standard}; - let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap(); - b.iter(|| { - let v: Vec = Standard.sample_iter(&mut rng).take(128).collect(); - v - }); - b.bytes = 1024; -} - -#[bench] -fn gen_1k_gen_array(b: &mut Bencher) { - let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap(); - b.iter(|| { - // max supported array length is 32! - let v: [[u64; 32]; 4] = rng.gen(); - v - }); - b.bytes = 1024; -} - -#[bench] -fn gen_1k_fill(b: &mut Bencher) { - let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap(); - let mut buf = [0u64; 128]; - b.iter(|| { - rng.fill(&mut buf[..]); - buf - }); - b.bytes = 1024; -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/.cargo-checksum.json cargo-0.37.0/vendor/rand-0.5.6/.cargo-checksum.json --- cargo-0.35.0/vendor/rand-0.5.6/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/.cargo-checksum.json 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"files":{},"package":"c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/rand-0.5.6/Cargo.toml cargo-0.37.0/vendor/rand-0.5.6/Cargo.toml --- cargo-0.35.0/vendor/rand-0.5.6/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ -# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO -# -# When uploading crates to the registry Cargo will automatically -# "normalize" Cargo.toml files for maximal compatibility -# with all versions of Cargo and also rewrite `path` dependencies -# 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 = "rand" -version = "0.5.6" -authors = ["The Rust Project Developers"] -description = "Random number generators and other randomness functionality.\n" -homepage = "https://crates.io/crates/rand" -documentation = "https://docs.rs/rand" -readme = "README.md" -keywords = ["random", "rng"] -categories = ["algorithms", "no-std"] -license = "MIT/Apache-2.0" -repository = "https://github.com/rust-lang-nursery/rand" -[package.metadata.docs.rs] -all-features = true -[dependencies.log] -version = "0.4" -optional = true - -[dependencies.rand_core] -version = "0.3" -default-features = false - -[dependencies.serde] -version = "1" -optional = true - -[dependencies.serde_derive] -version = "1" -optional = true -[dev-dependencies.bincode] -version = "1.0" - -[features] -alloc = ["rand_core/alloc"] -default = ["std"] -i128_support = [] -nightly = ["i128_support"] -serde1 = ["serde", "serde_derive", "rand_core/serde1"] -std = ["rand_core/std", "alloc", "libc", "winapi", "cloudabi", "fuchsia-cprng"] -[target."cfg(target_os = \"cloudabi\")".dependencies.cloudabi] -version = "0.0.3" -optional = true -[target."cfg(target_os = \"fuchsia\")".dependencies.fuchsia-cprng] -version = "0.1.0" -optional = true -[target."cfg(unix)".dependencies.libc] -version = "0.2" -optional = true -[target."cfg(windows)".dependencies.winapi] -version = "0.3" -features = ["minwindef", "ntsecapi", "profileapi", "winnt"] -optional = true -[target.wasm32-unknown-unknown.dependencies.stdweb] -version = "0.4" -optional = true -[badges.appveyor] -repository = "alexcrichton/rand" - -[badges.travis-ci] -repository = "rust-lang-nursery/rand" diff -Nru cargo-0.35.0/vendor/rand-0.5.6/CHANGELOG.md cargo-0.37.0/vendor/rand-0.5.6/CHANGELOG.md --- cargo-0.35.0/vendor/rand-0.5.6/CHANGELOG.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/CHANGELOG.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,422 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -A [separate changelog is kept for rand_core](rand_core/CHANGELOG.md). - -You may also find the [Update Guide](UPDATING.md) useful. - - -## [0.5.6] - 2019-01-25 -### Platforms -- Fuchsia: Replaced fuchsia-zircon with fuchsia-cprng - - -## [0.5.5] - 2018-08-07 -### Documentation -- Fix links in documentation (#582) - - -## [0.5.4] - 2018-07-11 -### Platform support -- Make `OsRng` work via WASM/stdweb for WebWorkers - - -## [0.5.3] - 2018-06-26 -### Platform support -- OpenBSD, Bitrig: fix compilation (broken in 0.5.1) (#530) - - -## [0.5.2] - 2018-06-18 -### Platform support -- Hide `OsRng` and `JitterRng` on unsupported platforms (#512; fixes #503). - - -## [0.5.1] - 2018-06-08 - -### New distributions -- Added Cauchy distribution. (#474, #486) -- Added Pareto distribution. (#495) - -### Platform support and `OsRng` -- Remove blanket Unix implementation. (#484) -- Remove Wasm unimplemented stub. (#484) -- Dragonfly BSD: read from `/dev/random`. (#484) -- Bitrig: use `getentropy` like OpenBSD. (#484) -- Solaris: (untested) use `getrandom` if available, otherwise `/dev/random`. (#484) -- Emscripten, `stdweb`: split the read up in chunks. (#484) -- Emscripten, Haiku: don't do an extra blocking read from `/dev/random`. (#484) -- Linux, NetBSD, Solaris: read in blocking mode on first use in `fill_bytes`. (#484) -- Fuchsia, CloudABI: fix compilation (broken in Rand 0.5). (#484) - - -## [0.5.0] - 2018-05-21 - -### Crate features and organisation -- Minimum Rust version update: 1.22.0. (#239) -- Create a separate `rand_core` crate. (#288) -- Deprecate `rand_derive`. (#256) -- Add `prelude` (and module reorganisation). (#435) -- Add `log` feature. Logging is now available in `JitterRng`, `OsRng`, `EntropyRng` and `ReseedingRng`. (#246) -- Add `serde1` feature for some PRNGs. (#189) -- `stdweb` feature for `OsRng` support on WASM via stdweb. (#272, #336) - -### `Rng` trait -- Split `Rng` in `RngCore` and `Rng` extension trait. - `next_u32`, `next_u64` and `fill_bytes` are now part of `RngCore`. (#265) -- Add `Rng::sample`. (#256) -- Deprecate `Rng::gen_weighted_bool`. (#308) -- Add `Rng::gen_bool`. (#308) -- Remove `Rng::next_f32` and `Rng::next_f64`. (#273) -- Add optimized `Rng::fill` and `Rng::try_fill` methods. (#247) -- Deprecate `Rng::gen_iter`. (#286) -- Deprecate `Rng::gen_ascii_chars`. (#279) - -### `rand_core` crate -- `rand` now depends on new `rand_core` crate (#288) -- `RngCore` and `SeedableRng` are now part of `rand_core`. (#288) -- Add modules to help implementing RNGs `impl` and `le`. (#209, #228) -- Add `Error` and `ErrorKind`. (#225) -- Add `CryptoRng` marker trait. (#273) -- Add `BlockRngCore` trait. (#281) -- Add `BlockRng` and `BlockRng64` wrappers to help implementations. (#281, #325) -- Revise the `SeedableRng` trait. (#233) -- Remove default implementations for `RngCore::next_u64` and `RngCore::fill_bytes`. (#288) -- Add `RngCore::try_fill_bytes`. (#225) - -### Other traits and types -- Add `FromEntropy` trait. (#233, #375) -- Add `SmallRng` wrapper. (#296) -- Rewrite `ReseedingRng` to only work with `BlockRngCore` (substantial performance improvement). (#281) -- Deprecate `weak_rng`. Use `SmallRng` instead. (#296) -- Deprecate `AsciiGenerator`. (#279) - -### Random number generators -- Switch `StdRng` and `thread_rng` to HC-128. (#277) -- `StdRng` must now be created with `from_entropy` instead of `new` -- Change `thread_rng` reseeding threshold to 32 MiB. (#277) -- PRNGs no longer implement `Copy`. (#209) -- `Debug` implementations no longer show internals. (#209) -- Implement `Clone` for `ReseedingRng`, `JitterRng`, OsRng`. (#383, #384) -- Implement serialization for `XorShiftRng`, `IsaacRng` and `Isaac64Rng` under the `serde1` feature. (#189) -- Implement `BlockRngCore` for `ChaChaCore` and `Hc128Core`. (#281) -- All PRNGs are now portable across big- and little-endian architectures. (#209) -- `Isaac64Rng::next_u32` no longer throws away half the results. (#209) -- Add `IsaacRng::new_from_u64` and `Isaac64Rng::new_from_u64`. (#209) -- Add the HC-128 CSPRNG `Hc128Rng`. (#210) -- Change ChaCha20 to have 64-bit counter and 64-bit stream. (#349) -- Changes to `JitterRng` to get its size down from 2112 to 24 bytes. (#251) -- Various performance improvements to all PRNGs. - -### Platform support and `OsRng` -- Add support for CloudABI. (#224) -- Remove support for NaCl. (#225) -- WASM support for `OsRng` via stdweb, behind the `stdweb` feature. (#272, #336) -- Use `getrandom` on more platforms for Linux, and on Android. (#338) -- Use the `SecRandomCopyBytes` interface on macOS. (#322) -- On systems that do not have a syscall interface, only keep a single file descriptor open for `OsRng`. (#239) -- On Unix, first try a single read from `/dev/random`, then `/dev/urandom`. (#338) -- Better error handling and reporting in `OsRng` (using new error type). (#225) -- `OsRng` now uses non-blocking when available. (#225) -- Add `EntropyRng`, which provides `OsRng`, but has `JitterRng` as a fallback. (#235) - -### Distributions -- New `Distribution` trait. (#256) -- Add `Distribution::sample_iter` and `Rng::::sample_iter`. (#361) -- Deprecate `Rand`, `Sample` and `IndependentSample` traits. (#256) -- Add a `Standard` distribution (replaces most `Rand` implementations). (#256) -- Add `Binomial` and `Poisson` distributions. (#96) -- Add `Bernoulli` dsitribution. (#411) -- Add `Alphanumeric` distribution. (#279) -- Remove `Closed01` distribution, add `OpenClosed01`. (#274, #420) -- Rework `Range` type, making it possible to implement it for user types. (#274) -- Rename `Range` to `Uniform`. (#395) -- Add `Uniform::new_inclusive` for inclusive ranges. (#274) -- Use widening multiply method for much faster integer range reduction. (#274) -- `Standard` distribution for `char` uses `Uniform` internally. (#274) -- `Standard` distribution for `bool` uses sign test. (#274) -- Implement `Standard` distribution for `Wrapping`. (#436) -- Implement `Uniform` distribution for `Duration`. (#427) - - -## [0.4.3] - 2018-08-16 -### Fixed -- Use correct syscall number for PowerPC (#589) - - -## [0.4.2] - 2018-01-06 -### Changed -- Use `winapi` on Windows -- Update for Fuchsia OS -- Remove dev-dependency on `log` - - -## [0.4.1] - 2017-12-17 -### Added -- `no_std` support - - -## [0.4.0-pre.0] - 2017-12-11 -### Added -- `JitterRng` added as a high-quality alternative entropy source using the - system timer -- new `seq` module with `sample_iter`, `sample_slice`, etc. -- WASM support via dummy implementations (fail at run-time) -- Additional benchmarks, covering generators and new seq code - -### Changed -- `thread_rng` uses `JitterRng` if seeding from system time fails - (slower but more secure than previous method) - -### Deprecated - - `sample` function deprecated (replaced by `sample_iter`) - - -## [0.3.20] - 2018-01-06 -### Changed -- Remove dev-dependency on `log` -- Update `fuchsia-zircon` dependency to 0.3.2 - - -## [0.3.19] - 2017-12-27 -### Changed -- Require `log <= 0.3.8` for dev builds -- Update `fuchsia-zircon` dependency to 0.3 -- Fix broken links in docs (to unblock compiler docs testing CI) - - -## [0.3.18] - 2017-11-06 -### Changed -- `thread_rng` is seeded from the system time if `OsRng` fails -- `weak_rng` now uses `thread_rng` internally - - -## [0.3.17] - 2017-10-07 -### Changed - - Fuchsia: Magenta was renamed Zircon - -## [0.3.16] - 2017-07-27 -### Added -- Implement Debug for mote non-public types -- implement `Rand` for (i|u)i128 -- Support for Fuchsia - -### Changed -- Add inline attribute to SampleRange::construct_range. - This improves the benchmark for sample in 11% and for shuffle in 16%. -- Use `RtlGenRandom` instead of `CryptGenRandom` - - -## [0.3.15] - 2016-11-26 -### Added -- Add `Rng` trait method `choose_mut` -- Redox support - -### Changed -- Use `arc4rand` for `OsRng` on FreeBSD. -- Use `arc4random(3)` for `OsRng` on OpenBSD. - -### Fixed -- Fix filling buffers 4 GiB or larger with `OsRng::fill_bytes` on Windows - - -## [0.3.14] - 2016-02-13 -### Fixed -- Inline definitions from winapi/advapi32, wich decreases build times - - -## [0.3.13] - 2016-01-09 -### Fixed -- Compatible with Rust 1.7.0-nightly (needed some extra type annotations) - - -## [0.3.12] - 2015-11-09 -### Changed -- Replaced the methods in `next_f32` and `next_f64` with the technique described - Saito & Matsumoto at MCQMC'08. The new method should exhibit a slightly more - uniform distribution. -- Depend on libc 0.2 - -### Fixed -- Fix iterator protocol issue in `rand::sample` - - -## [0.3.11] - 2015-08-31 -### Added -- Implement `Rand` for arrays with n <= 32 - - -## [0.3.10] - 2015-08-17 -### Added -- Support for NaCl platforms - -### Changed -- Allow `Rng` to be `?Sized`, impl for `&mut R` and `Box` where `R: ?Sized + Rng` - - -## [0.3.9] - 2015-06-18 -### Changed -- Use `winapi` for Windows API things - -### Fixed -- Fixed test on stable/nightly -- Fix `getrandom` syscall number for aarch64-unknown-linux-gnu - - -## [0.3.8] - 2015-04-23 -### Changed -- `log` is a dev dependency - -### Fixed -- Fix race condition of atomics in `is_getrandom_available` - - -## [0.3.7] - 2015-04-03 -### Fixed -- Derive Copy/Clone changes - - -## [0.3.6] - 2015-04-02 -### Changed -- Move to stable Rust! - - -## [0.3.5] - 2015-04-01 -### Fixed -- Compatible with Rust master - - -## [0.3.4] - 2015-03-31 -### Added -- Implement Clone for `Weighted` - -### Fixed -- Compatible with Rust master - - -## [0.3.3] - 2015-03-26 -### Fixed -- Fix compile on Windows - - -## [0.3.2] - 2015-03-26 - - -## [0.3.1] - 2015-03-26 -### Fixed -- Fix compile on Windows - - -## [0.3.0] - 2015-03-25 -### Changed -- Update to use log version 0.3.x - - -## [0.2.1] - 2015-03-22 -### Fixed -- Compatible with Rust master -- Fixed iOS compilation - - -## [0.2.0] - 2015-03-06 -### Fixed -- Compatible with Rust master (move from `old_io` to `std::io`) - - -## [0.1.4] - 2015-03-04 -### Fixed -- Compatible with Rust master (use wrapping ops) - - -## [0.1.3] - 2015-02-20 -### Fixed -- Compatible with Rust master - -### Removed -- Removed Copy implementations from RNGs - - -## [0.1.2] - 2015-02-03 -### Added -- Imported functionality from `std::rand`, including: - - `StdRng`, `SeedableRng`, `TreadRng`, `weak_rng()` - - `ReaderRng`: A wrapper around any Reader to treat it as an RNG. -- Imported documentation from `std::rand` -- Imported tests from `std::rand` - - -## [0.1.1] - 2015-02-03 -### Added -- Migrate to a cargo-compatible directory structure. - -### Fixed -- Do not use entropy during `gen_weighted_bool(1)` - - -## [Rust 0.12.0] - 2014-10-09 -### Added -- Impl Rand for tuples of arity 11 and 12 -- Include ChaCha pseudorandom generator -- Add `next_f64` and `next_f32` to Rng -- Implement Clone for PRNGs - -### Changed -- Rename `TaskRng` to `ThreadRng` and `task_rng` to `thread_rng` (since a - runtime is removed from Rust). - -### Fixed -- Improved performance of ISAAC and ISAAC64 by 30% and 12 % respectively, by - informing the optimiser that indexing is never out-of-bounds. - -### Removed -- Removed the Deprecated `choose_option` - - -## [Rust 0.11.0] - 2014-07-02 -### Added -- document when to use `OSRng` in cryptographic context, and explain why we use `/dev/urandom` instead of `/dev/random` -- `Rng::gen_iter()` which will return an infinite stream of random values -- `Rng::gen_ascii_chars()` which will return an infinite stream of random ascii characters - -### Changed -- Now only depends on libcore! -- Remove `Rng.choose()`, rename `Rng.choose_option()` to `.choose()` -- Rename OSRng to OsRng -- The WeightedChoice structure is no longer built with a `Vec>`, - but rather a `&mut [Weighted]`. This means that the WeightedChoice - structure now has a lifetime associated with it. -- The `sample` method on `Rng` has been moved to a top-level function in the - `rand` module due to its dependence on `Vec`. - -### Removed -- `Rng::gen_vec()` was removed. Previous behavior can be regained with - `rng.gen_iter().take(n).collect()` -- `Rng::gen_ascii_str()` was removed. Previous behavior can be regained with - `rng.gen_ascii_chars().take(n).collect()` -- {IsaacRng, Isaac64Rng, XorShiftRng}::new() have all been removed. These all - relied on being able to use an OSRng for seeding, but this is no longer - available in librand (where these types are defined). To retain the same - functionality, these types now implement the `Rand` trait so they can be - generated with a random seed from another random number generator. This allows - the stdlib to use an OSRng to create seeded instances of these RNGs. -- Rand implementations for `Box` and `@T` were removed. These seemed to be - pretty rare in the codebase, and it allows for librand to not depend on - liballoc. Additionally, other pointer types like Rc and Arc were not - supported. -- Remove a slew of old deprecated functions - - -## [Rust 0.10] - 2014-04-03 -### Changed -- replace `Rng.shuffle's` functionality with `.shuffle_mut` -- bubble up IO errors when creating an OSRng - -### Fixed -- Use `fill()` instead of `read()` -- Rewrite OsRng in Rust for windows - -## [0.10-pre] - 2014-03-02 -### Added -- Seperate `rand` out of the standard library diff -Nru cargo-0.35.0/vendor/rand-0.5.6/CONTRIBUTING.md cargo-0.37.0/vendor/rand-0.5.6/CONTRIBUTING.md --- cargo-0.35.0/vendor/rand-0.5.6/CONTRIBUTING.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/CONTRIBUTING.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -# Contributing to Rand - -Thank you for your interest in contributing to Rand! - -The following is a list of notes and tips for when you want to contribute to -Rand with a pull request. - -If you want to make major changes, it is usually best to open an issue to -discuss the idea first. - -Rand doesn't (yet) use rustfmt. It is best to follow the style of the -surrounding code, and try to keep an 80 character line limit. - - -## Documentation - -We especially welcome documentation PRs. - -As of Rust 1.25 there are differences in how stable and nightly render -documentation links. Make sure it works on stable, then nightly should be good -too. One Travis CI build checks for dead links using `cargo-deadlinks`. If you -want to run the check locally: -```sh -cargo install cargo-deadlinks -# It is recommended to remove left-over files from previous compilations -rm -rf /target/doc -cargo doc --no-deps -cargo deadlinks --dir target/doc -``` - -When making changes to code examples in the documentation, make sure they build -with: -```sh -cargo test --doc -``` - -A helpful command to rebuild documentation automatically on save (only works on -Linux): -``` -while inotifywait -r -e close_write src/ rand_core/; do cargo doc; done -``` - - -## Testing - -Rand already contains a number of unit tests, but could use more. Also the -existing ones could use clean-up. Any work on the tests is appreciated. - -Not every change or new bit of functionality requires tests, but if you can -think of a test that adds value, please add it. - -Depending on the code you change, test with one of: -```sh -cargo test -cargo test --package rand_core -# Test log, serde and 128-bit support -cargo test --features serde1,log,nightly -``` - -We want to be able to not only run the unit tests with `std` available, but also -without. Because `thread_rng()` and `FromEntropy` are not available without the -`std` feature, you may have to disable a new test with `#[cfg(feature="std")]`. -In other cases using `::test::rng` with a constant seed is a good option: -```rust -let mut rng = ::test::rng(528); // just pick some number -``` - -Only the unit tests should work in `no_std` mode, we don't want to complicate -the doc-tests. Run the tests with: -```sh -# Test no_std support -cargo test --lib --no-default-features -cargo test --package rand_core --no-default-features - -# Test no_std+alloc support; requires nightly -cargo test --lib --no-default-features --features alloc -``` - - -## Benchmarking - -A lot of code in Rand is performance-sensitive, most of it is expected to be -used in hot loops in some libraries/applications. If you change code in the -`rngs`, `prngs` or `distributions` modules, especially when you see an 'obvious -cleanup', make sure the benchmarks do not regress. It is nice to report the -benchmark results in the PR (or to report nothing's changed). - -```sh -# Benchmarks (requires nightly) -cargo bench -# Some benchmarks have a faster path with i128_support -cargo bench --features=nightly -``` diff -Nru cargo-0.35.0/vendor/rand-0.5.6/examples/monte-carlo.rs cargo-0.37.0/vendor/rand-0.5.6/examples/monte-carlo.rs --- cargo-0.35.0/vendor/rand-0.5.6/examples/monte-carlo.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/examples/monte-carlo.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -// Copyright 2013-2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! # Monte Carlo estimation of π -//! -//! Imagine that we have a square with sides of length 2 and a unit circle -//! (radius = 1), both centered at the origin. The areas are: -//! -//! ```text -//! area of circle = πr² = π * r * r = π -//! area of square = 2² = 4 -//! ``` -//! -//! The circle is entirely within the square, so if we sample many points -//! randomly from the square, roughly π / 4 of them should be inside the circle. -//! -//! We can use the above fact to estimate the value of π: pick many points in -//! the square at random, calculate the fraction that fall within the circle, -//! and multiply this fraction by 4. - -#![cfg(feature="std")] - - -extern crate rand; - -use rand::distributions::{Distribution, Uniform}; - -fn main() { - let range = Uniform::new(-1.0f64, 1.0); - let mut rng = rand::thread_rng(); - - let total = 1_000_000; - let mut in_circle = 0; - - for _ in 0..total { - let a = range.sample(&mut rng); - let b = range.sample(&mut rng); - if a*a + b*b <= 1.0 { - in_circle += 1; - } - } - - // prints something close to 3.14159... - println!("π is approximately {}", 4. * (in_circle as f64) / (total as f64)); -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/examples/monty-hall.rs cargo-0.37.0/vendor/rand-0.5.6/examples/monty-hall.rs --- cargo-0.35.0/vendor/rand-0.5.6/examples/monty-hall.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/examples/monty-hall.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ -// Copyright 2013-2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! ## Monty Hall Problem -//! -//! This is a simulation of the [Monty Hall Problem][]: -//! -//! > Suppose you're on a game show, and you're given the choice of three doors: -//! > Behind one door is a car; behind the others, goats. You pick a door, say -//! > No. 1, and the host, who knows what's behind the doors, opens another -//! > door, say No. 3, which has a goat. He then says to you, "Do you want to -//! > pick door No. 2?" Is it to your advantage to switch your choice? -//! -//! The rather unintuitive answer is that you will have a 2/3 chance of winning -//! if you switch and a 1/3 chance of winning if you don't, so it's better to -//! switch. -//! -//! This program will simulate the game show and with large enough simulation -//! steps it will indeed confirm that it is better to switch. -//! -//! [Monty Hall Problem]: https://en.wikipedia.org/wiki/Monty_Hall_problem - -#![cfg(feature="std")] - - -extern crate rand; - -use rand::Rng; -use rand::distributions::{Distribution, Uniform}; - -struct SimulationResult { - win: bool, - switch: bool, -} - -// Run a single simulation of the Monty Hall problem. -fn simulate(random_door: &Uniform, rng: &mut R) - -> SimulationResult { - let car = random_door.sample(rng); - - // This is our initial choice - let mut choice = random_door.sample(rng); - - // The game host opens a door - let open = game_host_open(car, choice, rng); - - // Shall we switch? - let switch = rng.gen(); - if switch { - choice = switch_door(choice, open); - } - - SimulationResult { win: choice == car, switch } -} - -// Returns the door the game host opens given our choice and knowledge of -// where the car is. The game host will never open the door with the car. -fn game_host_open(car: u32, choice: u32, rng: &mut R) -> u32 { - let choices = free_doors(&[car, choice]); - rand::seq::sample_slice(rng, &choices, 1)[0] -} - -// Returns the door we switch to, given our current choice and -// the open door. There will only be one valid door. -fn switch_door(choice: u32, open: u32) -> u32 { - free_doors(&[choice, open])[0] -} - -fn free_doors(blocked: &[u32]) -> Vec { - (0..3).filter(|x| !blocked.contains(x)).collect() -} - -fn main() { - // The estimation will be more accurate with more simulations - let num_simulations = 10000; - - let mut rng = rand::thread_rng(); - let random_door = Uniform::new(0u32, 3); - - let (mut switch_wins, mut switch_losses) = (0, 0); - let (mut keep_wins, mut keep_losses) = (0, 0); - - println!("Running {} simulations...", num_simulations); - for _ in 0..num_simulations { - let result = simulate(&random_door, &mut rng); - - match (result.win, result.switch) { - (true, true) => switch_wins += 1, - (true, false) => keep_wins += 1, - (false, true) => switch_losses += 1, - (false, false) => keep_losses += 1, - } - } - - let total_switches = switch_wins + switch_losses; - let total_keeps = keep_wins + keep_losses; - - println!("Switched door {} times with {} wins and {} losses", - total_switches, switch_wins, switch_losses); - - println!("Kept our choice {} times with {} wins and {} losses", - total_keeps, keep_wins, keep_losses); - - // With a large number of simulations, the values should converge to - // 0.667 and 0.333 respectively. - println!("Estimated chance to win if we switch: {}", - switch_wins as f32 / total_switches as f32); - println!("Estimated chance to win if we don't: {}", - keep_wins as f32 / total_keeps as f32); -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/LICENSE-APACHE cargo-0.37.0/vendor/rand-0.5.6/LICENSE-APACHE --- cargo-0.35.0/vendor/rand-0.5.6/LICENSE-APACHE 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/LICENSE-APACHE 1970-01-01 00:00:00.000000000 +0000 @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - https://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor 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, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff -Nru cargo-0.35.0/vendor/rand-0.5.6/LICENSE-MIT cargo-0.37.0/vendor/rand-0.5.6/LICENSE-MIT --- cargo-0.35.0/vendor/rand-0.5.6/LICENSE-MIT 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/LICENSE-MIT 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -Copyright (c) 2014 The Rust Project Developers - -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 -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff -Nru cargo-0.35.0/vendor/rand-0.5.6/README.md cargo-0.37.0/vendor/rand-0.5.6/README.md --- cargo-0.35.0/vendor/rand-0.5.6/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/README.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,143 +0,0 @@ -# Rand - -[![Build Status](https://travis-ci.org/rust-lang-nursery/rand.svg?branch=master)](https://travis-ci.org/rust-lang-nursery/rand) -[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-lang-nursery/rand?svg=true)](https://ci.appveyor.com/project/alexcrichton/rand) -[![Latest version](https://img.shields.io/crates/v/rand.svg)](https://crates.io/crates/rand) -[![Documentation](https://docs.rs/rand/badge.svg)](https://docs.rs/rand) -[![Minimum rustc version](https://img.shields.io/badge/rustc-1.22+-yellow.svg)](https://github.com/rust-lang-nursery/rand#rust-version-requirements) - -A Rust library for random number generation. - -Rand provides utilities to generate random numbers, to convert them to useful -types and distributions, and some randomness-related algorithms. - -The core random number generation traits of Rand live in the [rand_core]( -https://crates.io/crates/rand_core) crate; this crate is most useful when -implementing RNGs. - -API reference: -[master branch](https://rust-lang-nursery.github.io/rand/rand/index.html), -[by release](https://docs.rs/rand/0.5). - -## Usage - -Add this to your `Cargo.toml`: - -```toml -[dependencies] -rand = "0.5" -``` - -and this to your crate root: - -```rust -extern crate rand; - -use rand::prelude::*; - -fn main() { - // basic usage with random(): - let x: u8 = random(); - println!("{}", x); - - let y = random::(); - println!("{}", y); - - if random() { // generates a boolean - println!("Heads!"); - } - - // normal usage needs both an RNG and a function to generate the appropriate - // type, range, distribution, etc. - let mut rng = thread_rng(); - if rng.gen() { // random bool - let x: f64 = rng.gen(); // random number in range [0, 1) - println!("x is: {}", x); - let ch = rng.gen::(); // Sometimes you need type annotation - println!("char is: {}", ch); - println!("Number from 0 to 9: {}", rng.gen_range(0, 10)); - } -} -``` - -## Functionality - -The Rand crate provides: - -- A convenient to use default RNG, `thread_rng`: an automatically seeded, - crypto-grade generator stored in thread-local memory. -- Pseudo-random number generators: `StdRng`, `SmallRng`, `prng` module. -- Functionality for seeding PRNGs: the `FromEntropy` trait, and as sources of - external randomness `EntropyRng`, `OsRng` and `JitterRng`. -- Most content from [`rand_core`](https://crates.io/crates/rand_core) - (re-exported): base random number generator traits and error-reporting types. -- 'Distributions' producing many different types of random values: - - A `Standard` distribution for integers, floats, and derived types including - tuples, arrays and `Option` - - Unbiased sampling from specified `Uniform` ranges. - - Sampling from exponential/normal/gamma distributions. - - Sampling from binomial/poisson distributions. - - `gen_bool` aka Bernoulli distribution. -- `seq`-uence related functionality: - - Sampling a subset of elements. - - Randomly shuffling a list. - - -## Versions - -Version 0.5 is the latest version and contains many breaking changes. -See [the Upgrade Guide](UPDATING.md) for guidance on updating from previous -versions. - -Version 0.4 was released in December 2017. It contains almost no breaking -changes since the 0.3 series. - -For more details, see the [changelog](CHANGELOG.md). - -### Rust version requirements - -The 0.5 release of Rand requires **Rustc version 1.22 or greater**. -Rand 0.4 and 0.3 (since approx. June 2017) require Rustc version 1.15 or -greater. Subsets of the Rand code may work with older Rust versions, but this -is not supported. - -Travis CI always has a build with a pinned version of Rustc matching the oldest -supported Rust release. The current policy is that this can be updated in any -Rand release if required, but the change must be noted in the changelog. - - -## Crate Features - -Rand is built with only the `std` feature enabled by default. The following -optional features are available: - -- `alloc` can be used instead of `std` to provide `Vec` and `Box`. -- `i128_support` enables support for generating `u128` and `i128` values. -- `log` enables some logging via the `log` crate. -- `nightly` enables all unstable features (`i128_support`). -- `serde1` enables serialization for some types, via Serde version 1. -- `stdweb` enables support for `OsRng` on `wasm-unknown-unknown` via `stdweb` - combined with `cargo-web`. - -`no_std` mode is activated by setting `default-features = false`; this removes -functionality depending on `std`: - -- `thread_rng()`, and `random()` are not available, as they require thread-local - storage and an entropy source. -- `OsRng` and `EntropyRng` are unavailable. -- `JitterRng` code is still present, but a nanosecond timer must be provided via - `JitterRng::new_with_timer` -- Since no external entropy is available, it is not possible to create - generators with fresh seeds using the `FromEntropy` trait (user must provide - a seed). -- Exponential, normal and gamma type distributions are unavailable since `exp` - and `log` functions are not provided in `core`. -- The `seq`-uence module is unavailable, as it requires `Vec`. - - -# License - -Rand is distributed under the terms of both the MIT license and the -Apache License (Version 2.0). - -See [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) for details. diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/distributions/bernoulli.rs cargo-0.37.0/vendor/rand-0.5.6/src/distributions/bernoulli.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/distributions/bernoulli.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/distributions/bernoulli.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,120 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -//! The Bernoulli distribution. - -use Rng; -use distributions::Distribution; - -/// The Bernoulli distribution. -/// -/// This is a special case of the Binomial distribution where `n = 1`. -/// -/// # Example -/// -/// ```rust -/// use rand::distributions::{Bernoulli, Distribution}; -/// -/// let d = Bernoulli::new(0.3); -/// let v = d.sample(&mut rand::thread_rng()); -/// println!("{} is from a Bernoulli distribution", v); -/// ``` -/// -/// # Precision -/// -/// This `Bernoulli` distribution uses 64 bits from the RNG (a `u64`), -/// so only probabilities that are multiples of 2-64 can be -/// represented. -#[derive(Clone, Copy, Debug)] -pub struct Bernoulli { - /// Probability of success, relative to the maximal integer. - p_int: u64, -} - -impl Bernoulli { - /// Construct a new `Bernoulli` with the given probability of success `p`. - /// - /// # Panics - /// - /// If `p < 0` or `p > 1`. - /// - /// # Precision - /// - /// For `p = 1.0`, the resulting distribution will always generate true. - /// For `p = 0.0`, the resulting distribution will always generate false. - /// - /// This method is accurate for any input `p` in the range `[0, 1]` which is - /// a multiple of 2-64. (Note that not all multiples of - /// 2-64 in `[0, 1]` can be represented as a `f64`.) - #[inline] - pub fn new(p: f64) -> Bernoulli { - assert!((p >= 0.0) & (p <= 1.0), "Bernoulli::new not called with 0 <= p <= 0"); - // Technically, this should be 2^64 or `u64::MAX + 1` because we compare - // using `<` when sampling. However, `u64::MAX` rounds to an `f64` - // larger than `u64::MAX` anyway. - const MAX_P_INT: f64 = ::core::u64::MAX as f64; - let p_int = if p < 1.0 { - (p * MAX_P_INT) as u64 - } else { - // Avoid overflow: `MAX_P_INT` cannot be represented as u64. - ::core::u64::MAX - }; - Bernoulli { p_int } - } -} - -impl Distribution for Bernoulli { - #[inline] - fn sample(&self, rng: &mut R) -> bool { - // Make sure to always return true for p = 1.0. - if self.p_int == ::core::u64::MAX { - return true; - } - let r: u64 = rng.gen(); - r < self.p_int - } -} - -#[cfg(test)] -mod test { - use Rng; - use distributions::Distribution; - use super::Bernoulli; - - #[test] - fn test_trivial() { - let mut r = ::test::rng(1); - let always_false = Bernoulli::new(0.0); - let always_true = Bernoulli::new(1.0); - for _ in 0..5 { - assert_eq!(r.sample::(&always_false), false); - assert_eq!(r.sample::(&always_true), true); - assert_eq!(Distribution::::sample(&always_false, &mut r), false); - assert_eq!(Distribution::::sample(&always_true, &mut r), true); - } - } - - #[test] - fn test_average() { - const P: f64 = 0.3; - let d = Bernoulli::new(P); - const N: u32 = 10_000_000; - - let mut sum: u32 = 0; - let mut rng = ::test::rng(2); - for _ in 0..N { - if d.sample(&mut rng) { - sum += 1; - } - } - let avg = (sum as f64) / (N as f64); - - assert!((avg - P).abs() < 1e-3); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/distributions/binomial.rs cargo-0.37.0/vendor/rand-0.5.6/src/distributions/binomial.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/distributions/binomial.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/distributions/binomial.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,178 +0,0 @@ -// Copyright 2016-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The binomial distribution. - -use Rng; -use distributions::{Distribution, Bernoulli, Cauchy}; -use distributions::log_gamma::log_gamma; - -/// The binomial distribution `Binomial(n, p)`. -/// -/// This distribution has density function: -/// `f(k) = n!/(k! (n-k)!) p^k (1-p)^(n-k)` for `k >= 0`. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{Binomial, Distribution}; -/// -/// let bin = Binomial::new(20, 0.3); -/// let v = bin.sample(&mut rand::thread_rng()); -/// println!("{} is from a binomial distribution", v); -/// ``` -#[derive(Clone, Copy, Debug)] -pub struct Binomial { - /// Number of trials. - n: u64, - /// Probability of success. - p: f64, -} - -impl Binomial { - /// Construct a new `Binomial` with the given shape parameters `n` (number - /// of trials) and `p` (probability of success). - /// - /// Panics if `p < 0` or `p > 1`. - pub fn new(n: u64, p: f64) -> Binomial { - assert!(p >= 0.0, "Binomial::new called with p < 0"); - assert!(p <= 1.0, "Binomial::new called with p > 1"); - Binomial { n, p } - } -} - -impl Distribution for Binomial { - fn sample(&self, rng: &mut R) -> u64 { - // Handle these values directly. - if self.p == 0.0 { - return 0; - } else if self.p == 1.0 { - return self.n; - } - - // For low n, it is faster to sample directly. For both methods, - // performance is independent of p. On Intel Haswell CPU this method - // appears to be faster for approx n < 300. - if self.n < 300 { - let mut result = 0; - let d = Bernoulli::new(self.p); - for _ in 0 .. self.n { - result += rng.sample(d) as u32; - } - return result as u64; - } - - // binomial distribution is symmetrical with respect to p -> 1-p, k -> n-k - // switch p so that it is less than 0.5 - this allows for lower expected values - // we will just invert the result at the end - let p = if self.p <= 0.5 { - self.p - } else { - 1.0 - self.p - }; - - // prepare some cached values - let float_n = self.n as f64; - let ln_fact_n = log_gamma(float_n + 1.0); - let pc = 1.0 - p; - let log_p = p.ln(); - let log_pc = pc.ln(); - let expected = self.n as f64 * p; - let sq = (expected * (2.0 * pc)).sqrt(); - - let mut lresult; - - // we use the Cauchy distribution as the comparison distribution - // f(x) ~ 1/(1+x^2) - let cauchy = Cauchy::new(0.0, 1.0); - loop { - let mut comp_dev: f64; - loop { - // draw from the Cauchy distribution - comp_dev = rng.sample(cauchy); - // shift the peak of the comparison ditribution - lresult = expected + sq * comp_dev; - // repeat the drawing until we are in the range of possible values - if lresult >= 0.0 && lresult < float_n + 1.0 { - break; - } - } - - // the result should be discrete - lresult = lresult.floor(); - - let log_binomial_dist = ln_fact_n - log_gamma(lresult+1.0) - - log_gamma(float_n - lresult + 1.0) + lresult*log_p + (float_n - lresult)*log_pc; - // this is the binomial probability divided by the comparison probability - // we will generate a uniform random value and if it is larger than this, - // we interpret it as a value falling out of the distribution and repeat - let comparison_coeff = (log_binomial_dist.exp() * sq) * (1.2 * (1.0 + comp_dev*comp_dev)); - - if comparison_coeff >= rng.gen() { - break; - } - } - - // invert the result for p < 0.5 - if p != self.p { - self.n - lresult as u64 - } else { - lresult as u64 - } - } -} - -#[cfg(test)] -mod test { - use Rng; - use distributions::Distribution; - use super::Binomial; - - fn test_binomial_mean_and_variance(n: u64, p: f64, rng: &mut R) { - let binomial = Binomial::new(n, p); - - let expected_mean = n as f64 * p; - let expected_variance = n as f64 * p * (1.0 - p); - - let mut results = [0.0; 1000]; - for i in results.iter_mut() { *i = binomial.sample(rng) as f64; } - - let mean = results.iter().sum::() / results.len() as f64; - assert!((mean as f64 - expected_mean).abs() < expected_mean / 50.0); - - let variance = - results.iter().map(|x| (x - mean) * (x - mean)).sum::() - / results.len() as f64; - assert!((variance - expected_variance).abs() < expected_variance / 10.0); - } - - #[test] - fn test_binomial() { - let mut rng = ::test::rng(351); - test_binomial_mean_and_variance(150, 0.1, &mut rng); - test_binomial_mean_and_variance(70, 0.6, &mut rng); - test_binomial_mean_and_variance(40, 0.5, &mut rng); - test_binomial_mean_and_variance(20, 0.7, &mut rng); - test_binomial_mean_and_variance(20, 0.5, &mut rng); - } - - #[test] - fn test_binomial_end_points() { - let mut rng = ::test::rng(352); - assert_eq!(rng.sample(Binomial::new(20, 0.0)), 0); - assert_eq!(rng.sample(Binomial::new(20, 1.0)), 20); - } - - #[test] - #[should_panic] - fn test_binomial_invalid_lambda_neg() { - Binomial::new(20, -10.0); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/distributions/cauchy.rs cargo-0.37.0/vendor/rand-0.5.6/src/distributions/cauchy.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/distributions/cauchy.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/distributions/cauchy.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,116 +0,0 @@ -// Copyright 2016-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The Cauchy distribution. - -use Rng; -use distributions::Distribution; -use std::f64::consts::PI; - -/// The Cauchy distribution `Cauchy(median, scale)`. -/// -/// This distribution has a density function: -/// `f(x) = 1 / (pi * scale * (1 + ((x - median) / scale)^2))` -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{Cauchy, Distribution}; -/// -/// let cau = Cauchy::new(2.0, 5.0); -/// let v = cau.sample(&mut rand::thread_rng()); -/// println!("{} is from a Cauchy(2, 5) distribution", v); -/// ``` -#[derive(Clone, Copy, Debug)] -pub struct Cauchy { - median: f64, - scale: f64 -} - -impl Cauchy { - /// Construct a new `Cauchy` with the given shape parameters - /// `median` the peak location and `scale` the scale factor. - /// Panics if `scale <= 0`. - pub fn new(median: f64, scale: f64) -> Cauchy { - assert!(scale > 0.0, "Cauchy::new called with scale factor <= 0"); - Cauchy { - median, - scale - } - } -} - -impl Distribution for Cauchy { - fn sample(&self, rng: &mut R) -> f64 { - // sample from [0, 1) - let x = rng.gen::(); - // get standard cauchy random number - // note that π/2 is not exactly representable, even if x=0.5 the result is finite - let comp_dev = (PI * x).tan(); - // shift and scale according to parameters - let result = self.median + self.scale * comp_dev; - result - } -} - -#[cfg(test)] -mod test { - use distributions::Distribution; - use super::Cauchy; - - fn median(mut numbers: &mut [f64]) -> f64 { - sort(&mut numbers); - let mid = numbers.len() / 2; - numbers[mid] - } - - fn sort(numbers: &mut [f64]) { - numbers.sort_by(|a, b| a.partial_cmp(b).unwrap()); - } - - #[test] - fn test_cauchy_median() { - let cauchy = Cauchy::new(10.0, 5.0); - let mut rng = ::test::rng(123); - let mut numbers: [f64; 1000] = [0.0; 1000]; - for i in 0..1000 { - numbers[i] = cauchy.sample(&mut rng); - } - let median = median(&mut numbers); - println!("Cauchy median: {}", median); - assert!((median - 10.0).abs() < 0.5); // not 100% certain, but probable enough - } - - #[test] - fn test_cauchy_mean() { - let cauchy = Cauchy::new(10.0, 5.0); - let mut rng = ::test::rng(123); - let mut sum = 0.0; - for _ in 0..1000 { - sum += cauchy.sample(&mut rng); - } - let mean = sum / 1000.0; - println!("Cauchy mean: {}", mean); - // for a Cauchy distribution the mean should not converge - assert!((mean - 10.0).abs() > 0.5); // not 100% certain, but probable enough - } - - #[test] - #[should_panic] - fn test_cauchy_invalid_scale_zero() { - Cauchy::new(0.0, 0.0); - } - - #[test] - #[should_panic] - fn test_cauchy_invalid_scale_neg() { - Cauchy::new(0.0, -10.0); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/distributions/exponential.rs cargo-0.37.0/vendor/rand-0.5.6/src/distributions/exponential.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/distributions/exponential.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/distributions/exponential.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,122 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The exponential distribution. - -use {Rng}; -use distributions::{ziggurat, ziggurat_tables, Distribution}; - -/// Samples floating-point numbers according to the exponential distribution, -/// with rate parameter `λ = 1`. This is equivalent to `Exp::new(1.0)` or -/// sampling with `-rng.gen::().ln()`, but faster. -/// -/// See `Exp` for the general exponential distribution. -/// -/// Implemented via the ZIGNOR variant[^1] of the Ziggurat method. The exact -/// description in the paper was adjusted to use tables for the exponential -/// distribution rather than normal. -/// -/// [^1]: Jurgen A. Doornik (2005). [*An Improved Ziggurat Method to -/// Generate Normal Random Samples*]( -/// https://www.doornik.com/research/ziggurat.pdf). -/// Nuffield College, Oxford -/// -/// # Example -/// ``` -/// use rand::prelude::*; -/// use rand::distributions::Exp1; -/// -/// let val: f64 = SmallRng::from_entropy().sample(Exp1); -/// println!("{}", val); -/// ``` -#[derive(Clone, Copy, Debug)] -pub struct Exp1; - -// This could be done via `-rng.gen::().ln()` but that is slower. -impl Distribution for Exp1 { - #[inline] - fn sample(&self, rng: &mut R) -> f64 { - #[inline] - fn pdf(x: f64) -> f64 { - (-x).exp() - } - #[inline] - fn zero_case(rng: &mut R, _u: f64) -> f64 { - ziggurat_tables::ZIG_EXP_R - rng.gen::().ln() - } - - ziggurat(rng, false, - &ziggurat_tables::ZIG_EXP_X, - &ziggurat_tables::ZIG_EXP_F, - pdf, zero_case) - } -} - -/// The exponential distribution `Exp(lambda)`. -/// -/// This distribution has density function: `f(x) = lambda * exp(-lambda * x)` -/// for `x > 0`. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{Exp, Distribution}; -/// -/// let exp = Exp::new(2.0); -/// let v = exp.sample(&mut rand::thread_rng()); -/// println!("{} is from a Exp(2) distribution", v); -/// ``` -#[derive(Clone, Copy, Debug)] -pub struct Exp { - /// `lambda` stored as `1/lambda`, since this is what we scale by. - lambda_inverse: f64 -} - -impl Exp { - /// Construct a new `Exp` with the given shape parameter - /// `lambda`. Panics if `lambda <= 0`. - #[inline] - pub fn new(lambda: f64) -> Exp { - assert!(lambda > 0.0, "Exp::new called with `lambda` <= 0"); - Exp { lambda_inverse: 1.0 / lambda } - } -} - -impl Distribution for Exp { - fn sample(&self, rng: &mut R) -> f64 { - let n: f64 = rng.sample(Exp1); - n * self.lambda_inverse - } -} - -#[cfg(test)] -mod test { - use distributions::Distribution; - use super::Exp; - - #[test] - fn test_exp() { - let exp = Exp::new(10.0); - let mut rng = ::test::rng(221); - for _ in 0..1000 { - assert!(exp.sample(&mut rng) >= 0.0); - } - } - #[test] - #[should_panic] - fn test_exp_invalid_lambda_zero() { - Exp::new(0.0); - } - #[test] - #[should_panic] - fn test_exp_invalid_lambda_neg() { - Exp::new(-10.0); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/distributions/float.rs cargo-0.37.0/vendor/rand-0.5.6/src/distributions/float.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/distributions/float.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/distributions/float.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,206 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Basic floating-point number distributions - -use core::mem; -use Rng; -use distributions::{Distribution, Standard}; - -/// A distribution to sample floating point numbers uniformly in the half-open -/// interval `(0, 1]`, i.e. including 1 but not 0. -/// -/// All values that can be generated are of the form `n * ε/2`. For `f32` -/// the 23 most significant random bits of a `u32` are used and for `f64` the -/// 53 most significant bits of a `u64` are used. The conversion uses the -/// multiplicative method. -/// -/// See also: [`Standard`] which samples from `[0, 1)`, [`Open01`] -/// which samples from `(0, 1)` and [`Uniform`] which samples from arbitrary -/// ranges. -/// -/// # Example -/// ``` -/// use rand::{thread_rng, Rng}; -/// use rand::distributions::OpenClosed01; -/// -/// let val: f32 = thread_rng().sample(OpenClosed01); -/// println!("f32 from (0, 1): {}", val); -/// ``` -/// -/// [`Standard`]: struct.Standard.html -/// [`Open01`]: struct.Open01.html -/// [`Uniform`]: uniform/struct.Uniform.html -#[derive(Clone, Copy, Debug)] -pub struct OpenClosed01; - -/// A distribution to sample floating point numbers uniformly in the open -/// interval `(0, 1)`, i.e. not including either endpoint. -/// -/// All values that can be generated are of the form `n * ε + ε/2`. For `f32` -/// the 22 most significant random bits of an `u32` are used, for `f64` 52 from -/// an `u64`. The conversion uses a transmute-based method. -/// -/// See also: [`Standard`] which samples from `[0, 1)`, [`OpenClosed01`] -/// which samples from `(0, 1]` and [`Uniform`] which samples from arbitrary -/// ranges. -/// -/// # Example -/// ``` -/// use rand::{thread_rng, Rng}; -/// use rand::distributions::Open01; -/// -/// let val: f32 = thread_rng().sample(Open01); -/// println!("f32 from (0, 1): {}", val); -/// ``` -/// -/// [`Standard`]: struct.Standard.html -/// [`OpenClosed01`]: struct.OpenClosed01.html -/// [`Uniform`]: uniform/struct.Uniform.html -#[derive(Clone, Copy, Debug)] -pub struct Open01; - - -pub(crate) trait IntoFloat { - type F; - - /// Helper method to combine the fraction and a contant exponent into a - /// float. - /// - /// Only the least significant bits of `self` may be set, 23 for `f32` and - /// 52 for `f64`. - /// The resulting value will fall in a range that depends on the exponent. - /// As an example the range with exponent 0 will be - /// [20..21), which is [1..2). - fn into_float_with_exponent(self, exponent: i32) -> Self::F; -} - -macro_rules! float_impls { - ($ty:ty, $uty:ty, $fraction_bits:expr, $exponent_bias:expr) => { - impl IntoFloat for $uty { - type F = $ty; - #[inline(always)] - fn into_float_with_exponent(self, exponent: i32) -> $ty { - // The exponent is encoded using an offset-binary representation - let exponent_bits = - (($exponent_bias + exponent) as $uty) << $fraction_bits; - unsafe { mem::transmute(self | exponent_bits) } - } - } - - impl Distribution<$ty> for Standard { - fn sample(&self, rng: &mut R) -> $ty { - // Multiply-based method; 24/53 random bits; [0, 1) interval. - // We use the most significant bits because for simple RNGs - // those are usually more random. - let float_size = mem::size_of::<$ty>() * 8; - let precision = $fraction_bits + 1; - let scale = 1.0 / ((1 as $uty << precision) as $ty); - - let value: $uty = rng.gen(); - scale * (value >> (float_size - precision)) as $ty - } - } - - impl Distribution<$ty> for OpenClosed01 { - fn sample(&self, rng: &mut R) -> $ty { - // Multiply-based method; 24/53 random bits; (0, 1] interval. - // We use the most significant bits because for simple RNGs - // those are usually more random. - let float_size = mem::size_of::<$ty>() * 8; - let precision = $fraction_bits + 1; - let scale = 1.0 / ((1 as $uty << precision) as $ty); - - let value: $uty = rng.gen(); - let value = value >> (float_size - precision); - // Add 1 to shift up; will not overflow because of right-shift: - scale * (value + 1) as $ty - } - } - - impl Distribution<$ty> for Open01 { - fn sample(&self, rng: &mut R) -> $ty { - // Transmute-based method; 23/52 random bits; (0, 1) interval. - // We use the most significant bits because for simple RNGs - // those are usually more random. - const EPSILON: $ty = 1.0 / (1u64 << $fraction_bits) as $ty; - let float_size = mem::size_of::<$ty>() * 8; - - let value: $uty = rng.gen(); - let fraction = value >> (float_size - $fraction_bits); - fraction.into_float_with_exponent(0) - (1.0 - EPSILON / 2.0) - } - } - } -} -float_impls! { f32, u32, 23, 127 } -float_impls! { f64, u64, 52, 1023 } - - -#[cfg(test)] -mod tests { - use Rng; - use distributions::{Open01, OpenClosed01}; - use rngs::mock::StepRng; - - const EPSILON32: f32 = ::core::f32::EPSILON; - const EPSILON64: f64 = ::core::f64::EPSILON; - - #[test] - fn standard_fp_edge_cases() { - let mut zeros = StepRng::new(0, 0); - assert_eq!(zeros.gen::(), 0.0); - assert_eq!(zeros.gen::(), 0.0); - - let mut one32 = StepRng::new(1 << 8, 0); - assert_eq!(one32.gen::(), EPSILON32 / 2.0); - - let mut one64 = StepRng::new(1 << 11, 0); - assert_eq!(one64.gen::(), EPSILON64 / 2.0); - - let mut max = StepRng::new(!0, 0); - assert_eq!(max.gen::(), 1.0 - EPSILON32 / 2.0); - assert_eq!(max.gen::(), 1.0 - EPSILON64 / 2.0); - } - - #[test] - fn openclosed01_edge_cases() { - let mut zeros = StepRng::new(0, 0); - assert_eq!(zeros.sample::(OpenClosed01), 0.0 + EPSILON32 / 2.0); - assert_eq!(zeros.sample::(OpenClosed01), 0.0 + EPSILON64 / 2.0); - - let mut one32 = StepRng::new(1 << 8, 0); - assert_eq!(one32.sample::(OpenClosed01), EPSILON32); - - let mut one64 = StepRng::new(1 << 11, 0); - assert_eq!(one64.sample::(OpenClosed01), EPSILON64); - - let mut max = StepRng::new(!0, 0); - assert_eq!(max.sample::(OpenClosed01), 1.0); - assert_eq!(max.sample::(OpenClosed01), 1.0); - } - - #[test] - fn open01_edge_cases() { - let mut zeros = StepRng::new(0, 0); - assert_eq!(zeros.sample::(Open01), 0.0 + EPSILON32 / 2.0); - assert_eq!(zeros.sample::(Open01), 0.0 + EPSILON64 / 2.0); - - let mut one32 = StepRng::new(1 << 9, 0); - assert_eq!(one32.sample::(Open01), EPSILON32 / 2.0 * 3.0); - - let mut one64 = StepRng::new(1 << 12, 0); - assert_eq!(one64.sample::(Open01), EPSILON64 / 2.0 * 3.0); - - let mut max = StepRng::new(!0, 0); - assert_eq!(max.sample::(Open01), 1.0 - EPSILON32 / 2.0); - assert_eq!(max.sample::(Open01), 1.0 - EPSILON64 / 2.0); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/distributions/gamma.rs cargo-0.37.0/vendor/rand-0.5.6/src/distributions/gamma.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/distributions/gamma.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/distributions/gamma.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,360 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The Gamma and derived distributions. - -use self::GammaRepr::*; -use self::ChiSquaredRepr::*; - -use Rng; -use distributions::normal::StandardNormal; -use distributions::{Distribution, Exp, Open01}; - -/// The Gamma distribution `Gamma(shape, scale)` distribution. -/// -/// The density function of this distribution is -/// -/// ```text -/// f(x) = x^(k - 1) * exp(-x / θ) / (Γ(k) * θ^k) -/// ``` -/// -/// where `Γ` is the Gamma function, `k` is the shape and `θ` is the -/// scale and both `k` and `θ` are strictly positive. -/// -/// The algorithm used is that described by Marsaglia & Tsang 2000[^1], -/// falling back to directly sampling from an Exponential for `shape -/// == 1`, and using the boosting technique described in that paper for -/// `shape < 1`. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{Distribution, Gamma}; -/// -/// let gamma = Gamma::new(2.0, 5.0); -/// let v = gamma.sample(&mut rand::thread_rng()); -/// println!("{} is from a Gamma(2, 5) distribution", v); -/// ``` -/// -/// [^1]: George Marsaglia and Wai Wan Tsang. 2000. "A Simple Method for -/// Generating Gamma Variables" *ACM Trans. Math. Softw.* 26, 3 -/// (September 2000), 363-372. -/// DOI:[10.1145/358407.358414](https://doi.acm.org/10.1145/358407.358414) -#[derive(Clone, Copy, Debug)] -pub struct Gamma { - repr: GammaRepr, -} - -#[derive(Clone, Copy, Debug)] -enum GammaRepr { - Large(GammaLargeShape), - One(Exp), - Small(GammaSmallShape) -} - -// These two helpers could be made public, but saving the -// match-on-Gamma-enum branch from using them directly (e.g. if one -// knows that the shape is always > 1) doesn't appear to be much -// faster. - -/// Gamma distribution where the shape parameter is less than 1. -/// -/// Note, samples from this require a compulsory floating-point `pow` -/// call, which makes it significantly slower than sampling from a -/// gamma distribution where the shape parameter is greater than or -/// equal to 1. -/// -/// See `Gamma` for sampling from a Gamma distribution with general -/// shape parameters. -#[derive(Clone, Copy, Debug)] -struct GammaSmallShape { - inv_shape: f64, - large_shape: GammaLargeShape -} - -/// Gamma distribution where the shape parameter is larger than 1. -/// -/// See `Gamma` for sampling from a Gamma distribution with general -/// shape parameters. -#[derive(Clone, Copy, Debug)] -struct GammaLargeShape { - scale: f64, - c: f64, - d: f64 -} - -impl Gamma { - /// Construct an object representing the `Gamma(shape, scale)` - /// distribution. - /// - /// Panics if `shape <= 0` or `scale <= 0`. - #[inline] - pub fn new(shape: f64, scale: f64) -> Gamma { - assert!(shape > 0.0, "Gamma::new called with shape <= 0"); - assert!(scale > 0.0, "Gamma::new called with scale <= 0"); - - let repr = if shape == 1.0 { - One(Exp::new(1.0 / scale)) - } else if shape < 1.0 { - Small(GammaSmallShape::new_raw(shape, scale)) - } else { - Large(GammaLargeShape::new_raw(shape, scale)) - }; - Gamma { repr } - } -} - -impl GammaSmallShape { - fn new_raw(shape: f64, scale: f64) -> GammaSmallShape { - GammaSmallShape { - inv_shape: 1. / shape, - large_shape: GammaLargeShape::new_raw(shape + 1.0, scale) - } - } -} - -impl GammaLargeShape { - fn new_raw(shape: f64, scale: f64) -> GammaLargeShape { - let d = shape - 1. / 3.; - GammaLargeShape { - scale, - c: 1. / (9. * d).sqrt(), - d - } - } -} - -impl Distribution for Gamma { - fn sample(&self, rng: &mut R) -> f64 { - match self.repr { - Small(ref g) => g.sample(rng), - One(ref g) => g.sample(rng), - Large(ref g) => g.sample(rng), - } - } -} -impl Distribution for GammaSmallShape { - fn sample(&self, rng: &mut R) -> f64 { - let u: f64 = rng.sample(Open01); - - self.large_shape.sample(rng) * u.powf(self.inv_shape) - } -} -impl Distribution for GammaLargeShape { - fn sample(&self, rng: &mut R) -> f64 { - loop { - let x = rng.sample(StandardNormal); - let v_cbrt = 1.0 + self.c * x; - if v_cbrt <= 0.0 { // a^3 <= 0 iff a <= 0 - continue - } - - let v = v_cbrt * v_cbrt * v_cbrt; - let u: f64 = rng.sample(Open01); - - let x_sqr = x * x; - if u < 1.0 - 0.0331 * x_sqr * x_sqr || - u.ln() < 0.5 * x_sqr + self.d * (1.0 - v + v.ln()) { - return self.d * v * self.scale - } - } - } -} - -/// The chi-squared distribution `χ²(k)`, where `k` is the degrees of -/// freedom. -/// -/// For `k > 0` integral, this distribution is the sum of the squares -/// of `k` independent standard normal random variables. For other -/// `k`, this uses the equivalent characterisation -/// `χ²(k) = Gamma(k/2, 2)`. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{ChiSquared, Distribution}; -/// -/// let chi = ChiSquared::new(11.0); -/// let v = chi.sample(&mut rand::thread_rng()); -/// println!("{} is from a χ²(11) distribution", v) -/// ``` -#[derive(Clone, Copy, Debug)] -pub struct ChiSquared { - repr: ChiSquaredRepr, -} - -#[derive(Clone, Copy, Debug)] -enum ChiSquaredRepr { - // k == 1, Gamma(alpha, ..) is particularly slow for alpha < 1, - // e.g. when alpha = 1/2 as it would be for this case, so special- - // casing and using the definition of N(0,1)^2 is faster. - DoFExactlyOne, - DoFAnythingElse(Gamma), -} - -impl ChiSquared { - /// Create a new chi-squared distribution with degrees-of-freedom - /// `k`. Panics if `k < 0`. - pub fn new(k: f64) -> ChiSquared { - let repr = if k == 1.0 { - DoFExactlyOne - } else { - assert!(k > 0.0, "ChiSquared::new called with `k` < 0"); - DoFAnythingElse(Gamma::new(0.5 * k, 2.0)) - }; - ChiSquared { repr } - } -} -impl Distribution for ChiSquared { - fn sample(&self, rng: &mut R) -> f64 { - match self.repr { - DoFExactlyOne => { - // k == 1 => N(0,1)^2 - let norm = rng.sample(StandardNormal); - norm * norm - } - DoFAnythingElse(ref g) => g.sample(rng) - } - } -} - -/// The Fisher F distribution `F(m, n)`. -/// -/// This distribution is equivalent to the ratio of two normalised -/// chi-squared distributions, that is, `F(m,n) = (χ²(m)/m) / -/// (χ²(n)/n)`. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{FisherF, Distribution}; -/// -/// let f = FisherF::new(2.0, 32.0); -/// let v = f.sample(&mut rand::thread_rng()); -/// println!("{} is from an F(2, 32) distribution", v) -/// ``` -#[derive(Clone, Copy, Debug)] -pub struct FisherF { - numer: ChiSquared, - denom: ChiSquared, - // denom_dof / numer_dof so that this can just be a straight - // multiplication, rather than a division. - dof_ratio: f64, -} - -impl FisherF { - /// Create a new `FisherF` distribution, with the given - /// parameter. Panics if either `m` or `n` are not positive. - pub fn new(m: f64, n: f64) -> FisherF { - assert!(m > 0.0, "FisherF::new called with `m < 0`"); - assert!(n > 0.0, "FisherF::new called with `n < 0`"); - - FisherF { - numer: ChiSquared::new(m), - denom: ChiSquared::new(n), - dof_ratio: n / m - } - } -} -impl Distribution for FisherF { - fn sample(&self, rng: &mut R) -> f64 { - self.numer.sample(rng) / self.denom.sample(rng) * self.dof_ratio - } -} - -/// The Student t distribution, `t(nu)`, where `nu` is the degrees of -/// freedom. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{StudentT, Distribution}; -/// -/// let t = StudentT::new(11.0); -/// let v = t.sample(&mut rand::thread_rng()); -/// println!("{} is from a t(11) distribution", v) -/// ``` -#[derive(Clone, Copy, Debug)] -pub struct StudentT { - chi: ChiSquared, - dof: f64 -} - -impl StudentT { - /// Create a new Student t distribution with `n` degrees of - /// freedom. Panics if `n <= 0`. - pub fn new(n: f64) -> StudentT { - assert!(n > 0.0, "StudentT::new called with `n <= 0`"); - StudentT { - chi: ChiSquared::new(n), - dof: n - } - } -} -impl Distribution for StudentT { - fn sample(&self, rng: &mut R) -> f64 { - let norm = rng.sample(StandardNormal); - norm * (self.dof / self.chi.sample(rng)).sqrt() - } -} - -#[cfg(test)] -mod test { - use distributions::Distribution; - use super::{ChiSquared, StudentT, FisherF}; - - #[test] - fn test_chi_squared_one() { - let chi = ChiSquared::new(1.0); - let mut rng = ::test::rng(201); - for _ in 0..1000 { - chi.sample(&mut rng); - } - } - #[test] - fn test_chi_squared_small() { - let chi = ChiSquared::new(0.5); - let mut rng = ::test::rng(202); - for _ in 0..1000 { - chi.sample(&mut rng); - } - } - #[test] - fn test_chi_squared_large() { - let chi = ChiSquared::new(30.0); - let mut rng = ::test::rng(203); - for _ in 0..1000 { - chi.sample(&mut rng); - } - } - #[test] - #[should_panic] - fn test_chi_squared_invalid_dof() { - ChiSquared::new(-1.0); - } - - #[test] - fn test_f() { - let f = FisherF::new(2.0, 32.0); - let mut rng = ::test::rng(204); - for _ in 0..1000 { - f.sample(&mut rng); - } - } - - #[test] - fn test_t() { - let t = StudentT::new(11.0); - let mut rng = ::test::rng(205); - for _ in 0..1000 { - t.sample(&mut rng); - } - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/distributions/integer.rs cargo-0.37.0/vendor/rand-0.5.6/src/distributions/integer.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/distributions/integer.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/distributions/integer.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,113 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The implementations of the `Standard` distribution for integer types. - -use {Rng}; -use distributions::{Distribution, Standard}; - -impl Distribution for Standard { - #[inline] - fn sample(&self, rng: &mut R) -> u8 { - rng.next_u32() as u8 - } -} - -impl Distribution for Standard { - #[inline] - fn sample(&self, rng: &mut R) -> u16 { - rng.next_u32() as u16 - } -} - -impl Distribution for Standard { - #[inline] - fn sample(&self, rng: &mut R) -> u32 { - rng.next_u32() - } -} - -impl Distribution for Standard { - #[inline] - fn sample(&self, rng: &mut R) -> u64 { - rng.next_u64() - } -} - -#[cfg(feature = "i128_support")] -impl Distribution for Standard { - #[inline] - fn sample(&self, rng: &mut R) -> u128 { - // Use LE; we explicitly generate one value before the next. - let x = rng.next_u64() as u128; - let y = rng.next_u64() as u128; - (y << 64) | x - } -} - -impl Distribution for Standard { - #[inline] - #[cfg(any(target_pointer_width = "32", target_pointer_width = "16"))] - fn sample(&self, rng: &mut R) -> usize { - rng.next_u32() as usize - } - - #[inline] - #[cfg(target_pointer_width = "64")] - fn sample(&self, rng: &mut R) -> usize { - rng.next_u64() as usize - } -} - -macro_rules! impl_int_from_uint { - ($ty:ty, $uty:ty) => { - impl Distribution<$ty> for Standard { - #[inline] - fn sample(&self, rng: &mut R) -> $ty { - rng.gen::<$uty>() as $ty - } - } - } -} - -impl_int_from_uint! { i8, u8 } -impl_int_from_uint! { i16, u16 } -impl_int_from_uint! { i32, u32 } -impl_int_from_uint! { i64, u64 } -#[cfg(feature = "i128_support")] impl_int_from_uint! { i128, u128 } -impl_int_from_uint! { isize, usize } - - -#[cfg(test)] -mod tests { - use Rng; - use distributions::{Standard}; - - #[test] - fn test_integers() { - let mut rng = ::test::rng(806); - - rng.sample::(Standard); - rng.sample::(Standard); - rng.sample::(Standard); - rng.sample::(Standard); - rng.sample::(Standard); - #[cfg(feature = "i128_support")] - rng.sample::(Standard); - - rng.sample::(Standard); - rng.sample::(Standard); - rng.sample::(Standard); - rng.sample::(Standard); - rng.sample::(Standard); - #[cfg(feature = "i128_support")] - rng.sample::(Standard); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/distributions/log_gamma.rs cargo-0.37.0/vendor/rand-0.5.6/src/distributions/log_gamma.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/distributions/log_gamma.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/distributions/log_gamma.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -// Copyright 2016-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -/// Calculates ln(gamma(x)) (natural logarithm of the gamma -/// function) using the Lanczos approximation. -/// -/// The approximation expresses the gamma function as: -/// `gamma(z+1) = sqrt(2*pi)*(z+g+0.5)^(z+0.5)*exp(-z-g-0.5)*Ag(z)` -/// `g` is an arbitrary constant; we use the approximation with `g=5`. -/// -/// Noting that `gamma(z+1) = z*gamma(z)` and applying `ln` to both sides: -/// `ln(gamma(z)) = (z+0.5)*ln(z+g+0.5)-(z+g+0.5) + ln(sqrt(2*pi)*Ag(z)/z)` -/// -/// `Ag(z)` is an infinite series with coefficients that can be calculated -/// ahead of time - we use just the first 6 terms, which is good enough -/// for most purposes. -pub fn log_gamma(x: f64) -> f64 { - // precalculated 6 coefficients for the first 6 terms of the series - let coefficients: [f64; 6] = [ - 76.18009172947146, - -86.50532032941677, - 24.01409824083091, - -1.231739572450155, - 0.1208650973866179e-2, - -0.5395239384953e-5, - ]; - - // (x+0.5)*ln(x+g+0.5)-(x+g+0.5) - let tmp = x + 5.5; - let log = (x + 0.5) * tmp.ln() - tmp; - - // the first few terms of the series for Ag(x) - let mut a = 1.000000000190015; - let mut denom = x; - for coeff in &coefficients { - denom += 1.0; - a += coeff / denom; - } - - // get everything together - // a is Ag(x) - // 2.5066... is sqrt(2pi) - log + (2.5066282746310005 * a / x).ln() -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/distributions/mod.rs cargo-0.37.0/vendor/rand-0.5.6/src/distributions/mod.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/distributions/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/distributions/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,784 +0,0 @@ -// Copyright 2013-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Generating random samples from probability distributions. -//! -//! This module is the home of the [`Distribution`] trait and several of its -//! implementations. It is the workhorse behind some of the convenient -//! functionality of the [`Rng`] trait, including [`gen`], [`gen_range`] and -//! of course [`sample`]. -//! -//! Abstractly, a [probability distribution] describes the probability of -//! occurance of each value in its sample space. -//! -//! More concretely, an implementation of `Distribution` for type `X` is an -//! algorithm for choosing values from the sample space (a subset of `T`) -//! according to the distribution `X` represents, using an external source of -//! randomness (an RNG supplied to the `sample` function). -//! -//! A type `X` may implement `Distribution` for multiple types `T`. -//! Any type implementing [`Distribution`] is stateless (i.e. immutable), -//! but it may have internal parameters set at construction time (for example, -//! [`Uniform`] allows specification of its sample space as a range within `T`). -//! -//! -//! # The `Standard` distribution -//! -//! The [`Standard`] distribution is important to mention. This is the -//! distribution used by [`Rng::gen()`] and represents the "default" way to -//! produce a random value for many different types, including most primitive -//! types, tuples, arrays, and a few derived types. See the documentation of -//! [`Standard`] for more details. -//! -//! Implementing `Distribution` for [`Standard`] for user types `T` makes it -//! possible to generate type `T` with [`Rng::gen()`], and by extension also -//! with the [`random()`] function. -//! -//! -//! # Distribution to sample from a `Uniform` range -//! -//! The [`Uniform`] distribution is more flexible than [`Standard`], but also -//! more specialised: it supports fewer target types, but allows the sample -//! space to be specified as an arbitrary range within its target type `T`. -//! Both [`Standard`] and [`Uniform`] are in some sense uniform distributions. -//! -//! Values may be sampled from this distribution using [`Rng::gen_range`] or -//! by creating a distribution object with [`Uniform::new`], -//! [`Uniform::new_inclusive`] or `From`. When the range limits are not -//! known at compile time it is typically faster to reuse an existing -//! distribution object than to call [`Rng::gen_range`]. -//! -//! User types `T` may also implement `Distribution` for [`Uniform`], -//! although this is less straightforward than for [`Standard`] (see the -//! documentation in the [`uniform` module]. Doing so enables generation of -//! values of type `T` with [`Rng::gen_range`]. -//! -//! -//! # Other distributions -//! -//! There are surprisingly many ways to uniformly generate random floats. A -//! range between 0 and 1 is standard, but the exact bounds (open vs closed) -//! and accuracy differ. In addition to the [`Standard`] distribution Rand offers -//! [`Open01`] and [`OpenClosed01`]. See [Floating point implementation] for -//! more details. -//! -//! [`Alphanumeric`] is a simple distribution to sample random letters and -//! numbers of the `char` type; in contrast [`Standard`] may sample any valid -//! `char`. -//! -//! -//! # Non-uniform probability distributions -//! -//! Rand currently provides the following probability distributions: -//! -//! - Related to real-valued quantities that grow linearly -//! (e.g. errors, offsets): -//! - [`Normal`] distribution, and [`StandardNormal`] as a primitive -//! - [`Cauchy`] distribution -//! - Related to Bernoulli trials (yes/no events, with a given probability): -//! - [`Binomial`] distribution -//! - [`Bernoulli`] distribution, similar to [`Rng::gen_bool`]. -//! - Related to positive real-valued quantities that grow exponentially -//! (e.g. prices, incomes, populations): -//! - [`LogNormal`] distribution -//! - Related to the occurrence of independent events at a given rate: -//! - [`Poisson`] distribution -//! - [`Exp`]onential distribution, and [`Exp1`] as a primitive -//! - Gamma and derived distributions: -//! - [`Gamma`] distribution -//! - [`ChiSquared`] distribution -//! - [`StudentT`] distribution -//! - [`FisherF`] distribution -//! -//! -//! # Examples -//! -//! Sampling from a distribution: -//! -//! ``` -//! use rand::{thread_rng, Rng}; -//! use rand::distributions::Exp; -//! -//! let exp = Exp::new(2.0); -//! let v = thread_rng().sample(exp); -//! println!("{} is from an Exp(2) distribution", v); -//! ``` -//! -//! Implementing the [`Standard`] distribution for a user type: -//! -//! ``` -//! # #![allow(dead_code)] -//! use rand::Rng; -//! use rand::distributions::{Distribution, Standard}; -//! -//! struct MyF32 { -//! x: f32, -//! } -//! -//! impl Distribution for Standard { -//! fn sample(&self, rng: &mut R) -> MyF32 { -//! MyF32 { x: rng.gen() } -//! } -//! } -//! ``` -//! -//! -//! [probability distribution]: https://en.wikipedia.org/wiki/Probability_distribution -//! [`Distribution`]: trait.Distribution.html -//! [`gen_range`]: ../trait.Rng.html#method.gen_range -//! [`gen`]: ../trait.Rng.html#method.gen -//! [`sample`]: ../trait.Rng.html#method.sample -//! [`new_inclusive`]: struct.Uniform.html#method.new_inclusive -//! [`random()`]: ../fn.random.html -//! [`Rng::gen_bool`]: ../trait.Rng.html#method.gen_bool -//! [`Rng::gen_range`]: ../trait.Rng.html#method.gen_range -//! [`Rng::gen()`]: ../trait.Rng.html#method.gen -//! [`Rng`]: ../trait.Rng.html -//! [`uniform` module]: uniform/index.html -//! [Floating point implementation]: struct.Standard.html#floating-point-implementation -// distributions -//! [`Alphanumeric`]: struct.Alphanumeric.html -//! [`Bernoulli`]: struct.Bernoulli.html -//! [`Binomial`]: struct.Binomial.html -//! [`Cauchy`]: struct.Cauchy.html -//! [`ChiSquared`]: struct.ChiSquared.html -//! [`Exp`]: struct.Exp.html -//! [`Exp1`]: struct.Exp1.html -//! [`FisherF`]: struct.FisherF.html -//! [`Gamma`]: struct.Gamma.html -//! [`LogNormal`]: struct.LogNormal.html -//! [`Normal`]: struct.Normal.html -//! [`Open01`]: struct.Open01.html -//! [`OpenClosed01`]: struct.OpenClosed01.html -//! [`Pareto`]: struct.Pareto.html -//! [`Poisson`]: struct.Poisson.html -//! [`Standard`]: struct.Standard.html -//! [`StandardNormal`]: struct.StandardNormal.html -//! [`StudentT`]: struct.StudentT.html -//! [`Uniform`]: struct.Uniform.html -//! [`Uniform::new`]: struct.Uniform.html#method.new -//! [`Uniform::new_inclusive`]: struct.Uniform.html#method.new_inclusive - -use Rng; - -#[doc(inline)] pub use self::other::Alphanumeric; -#[doc(inline)] pub use self::uniform::Uniform; -#[doc(inline)] pub use self::float::{OpenClosed01, Open01}; -#[deprecated(since="0.5.0", note="use Uniform instead")] -pub use self::uniform::Uniform as Range; -#[cfg(feature="std")] -#[doc(inline)] pub use self::gamma::{Gamma, ChiSquared, FisherF, StudentT}; -#[cfg(feature="std")] -#[doc(inline)] pub use self::normal::{Normal, LogNormal, StandardNormal}; -#[cfg(feature="std")] -#[doc(inline)] pub use self::exponential::{Exp, Exp1}; -#[cfg(feature="std")] -#[doc(inline)] pub use self::pareto::Pareto; -#[cfg(feature = "std")] -#[doc(inline)] pub use self::poisson::Poisson; -#[cfg(feature = "std")] -#[doc(inline)] pub use self::binomial::Binomial; -#[doc(inline)] pub use self::bernoulli::Bernoulli; -#[cfg(feature = "std")] -#[doc(inline)] pub use self::cauchy::Cauchy; - -pub mod uniform; -#[cfg(feature="std")] -#[doc(hidden)] pub mod gamma; -#[cfg(feature="std")] -#[doc(hidden)] pub mod normal; -#[cfg(feature="std")] -#[doc(hidden)] pub mod exponential; -#[cfg(feature="std")] -#[doc(hidden)] pub mod pareto; -#[cfg(feature = "std")] -#[doc(hidden)] pub mod poisson; -#[cfg(feature = "std")] -#[doc(hidden)] pub mod binomial; -#[doc(hidden)] pub mod bernoulli; -#[cfg(feature = "std")] -#[doc(hidden)] pub mod cauchy; - -mod float; -mod integer; -#[cfg(feature="std")] -mod log_gamma; -mod other; -#[cfg(feature="std")] -mod ziggurat_tables; -#[cfg(feature="std")] -use distributions::float::IntoFloat; - -/// Types that can be used to create a random instance of `Support`. -#[deprecated(since="0.5.0", note="use Distribution instead")] -pub trait Sample { - /// Generate a random value of `Support`, using `rng` as the - /// source of randomness. - fn sample(&mut self, rng: &mut R) -> Support; -} - -/// `Sample`s that do not require keeping track of state. -/// -/// Since no state is recorded, each sample is (statistically) -/// independent of all others, assuming the `Rng` used has this -/// property. -#[allow(deprecated)] -#[deprecated(since="0.5.0", note="use Distribution instead")] -pub trait IndependentSample: Sample { - /// Generate a random value. - fn ind_sample(&self, &mut R) -> Support; -} - -/// DEPRECATED: Use `distributions::uniform` instead. -#[deprecated(since="0.5.0", note="use uniform instead")] -pub mod range { - pub use distributions::uniform::Uniform as Range; - pub use distributions::uniform::SampleUniform as SampleRange; -} - -#[allow(deprecated)] -mod impls { - use Rng; - use distributions::{Distribution, Sample, IndependentSample, - WeightedChoice}; - #[cfg(feature="std")] - use distributions::exponential::Exp; - #[cfg(feature="std")] - use distributions::gamma::{Gamma, ChiSquared, FisherF, StudentT}; - #[cfg(feature="std")] - use distributions::normal::{Normal, LogNormal}; - use distributions::range::{Range, SampleRange}; - - impl<'a, T: Clone> Sample for WeightedChoice<'a, T> { - fn sample(&mut self, rng: &mut R) -> T { - Distribution::sample(self, rng) - } - } - impl<'a, T: Clone> IndependentSample for WeightedChoice<'a, T> { - fn ind_sample(&self, rng: &mut R) -> T { - Distribution::sample(self, rng) - } - } - - impl Sample for Range { - fn sample(&mut self, rng: &mut R) -> T { - Distribution::sample(self, rng) - } - } - impl IndependentSample for Range { - fn ind_sample(&self, rng: &mut R) -> T { - Distribution::sample(self, rng) - } - } - - #[cfg(feature="std")] - macro_rules! impl_f64 { - ($($name: ident), *) => { - $( - impl Sample for $name { - fn sample(&mut self, rng: &mut R) -> f64 { - Distribution::sample(self, rng) - } - } - impl IndependentSample for $name { - fn ind_sample(&self, rng: &mut R) -> f64 { - Distribution::sample(self, rng) - } - } - )* - } - } - #[cfg(feature="std")] - impl_f64!(Exp, Gamma, ChiSquared, FisherF, StudentT, Normal, LogNormal); -} - -/// Types (distributions) that can be used to create a random instance of `T`. -/// -/// It is possible to sample from a distribution through both the -/// `Distribution` and [`Rng`] traits, via `distr.sample(&mut rng)` and -/// `rng.sample(distr)`. They also both offer the [`sample_iter`] method, which -/// produces an iterator that samples from the distribution. -/// -/// All implementations are expected to be immutable; this has the significant -/// advantage of not needing to consider thread safety, and for most -/// distributions efficient state-less sampling algorithms are available. -/// -/// [`Rng`]: ../trait.Rng.html -/// [`sample_iter`]: trait.Distribution.html#method.sample_iter -pub trait Distribution { - /// Generate a random value of `T`, using `rng` as the source of randomness. - fn sample(&self, rng: &mut R) -> T; - - /// Create an iterator that generates random values of `T`, using `rng` as - /// the source of randomness. - /// - /// # Example - /// - /// ``` - /// use rand::thread_rng; - /// use rand::distributions::{Distribution, Alphanumeric, Uniform, Standard}; - /// - /// let mut rng = thread_rng(); - /// - /// // Vec of 16 x f32: - /// let v: Vec = Standard.sample_iter(&mut rng).take(16).collect(); - /// - /// // String: - /// let s: String = Alphanumeric.sample_iter(&mut rng).take(7).collect(); - /// - /// // Dice-rolling: - /// let die_range = Uniform::new_inclusive(1, 6); - /// let mut roll_die = die_range.sample_iter(&mut rng); - /// while roll_die.next().unwrap() != 6 { - /// println!("Not a 6; rolling again!"); - /// } - /// ``` - fn sample_iter<'a, R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T> - where Self: Sized, R: Rng - { - DistIter { - distr: self, - rng: rng, - phantom: ::core::marker::PhantomData, - } - } -} - -impl<'a, T, D: Distribution> Distribution for &'a D { - fn sample(&self, rng: &mut R) -> T { - (*self).sample(rng) - } -} - - -/// An iterator that generates random values of `T` with distribution `D`, -/// using `R` as the source of randomness. -/// -/// This `struct` is created by the [`sample_iter`] method on [`Distribution`]. -/// See its documentation for more. -/// -/// [`Distribution`]: trait.Distribution.html -/// [`sample_iter`]: trait.Distribution.html#method.sample_iter -#[derive(Debug)] -pub struct DistIter<'a, D: 'a, R: 'a, T> { - distr: &'a D, - rng: &'a mut R, - phantom: ::core::marker::PhantomData, -} - -impl<'a, D, R, T> Iterator for DistIter<'a, D, R, T> - where D: Distribution, R: Rng + 'a -{ - type Item = T; - - #[inline(always)] - fn next(&mut self) -> Option { - Some(self.distr.sample(self.rng)) - } - - fn size_hint(&self) -> (usize, Option) { - (usize::max_value(), None) - } -} - - -/// A generic random value distribution, implemented for many primitive types. -/// Usually generates values with a numerically uniform distribution, and with a -/// range appropriate to the type. -/// -/// ## Built-in Implementations -/// -/// Assuming the provided `Rng` is well-behaved, these implementations -/// generate values with the following ranges and distributions: -/// -/// * Integers (`i32`, `u32`, `isize`, `usize`, etc.): Uniformly distributed -/// over all values of the type. -/// * `char`: Uniformly distributed over all Unicode scalar values, i.e. all -/// code points in the range `0...0x10_FFFF`, except for the range -/// `0xD800...0xDFFF` (the surrogate code points). This includes -/// unassigned/reserved code points. -/// * `bool`: Generates `false` or `true`, each with probability 0.5. -/// * Floating point types (`f32` and `f64`): Uniformly distributed in the -/// half-open range `[0, 1)`. See notes below. -/// * Wrapping integers (`Wrapping`), besides the type identical to their -/// normal integer variants. -/// -/// The following aggregate types also implement the distribution `Standard` as -/// long as their component types implement it: -/// -/// * Tuples and arrays: Each element of the tuple or array is generated -/// independently, using the `Standard` distribution recursively. -/// * `Option` where `Standard` is implemented for `T`: Returns `None` with -/// probability 0.5; otherwise generates a random `x: T` and returns `Some(x)`. -/// -/// # Example -/// ``` -/// use rand::prelude::*; -/// use rand::distributions::Standard; -/// -/// let val: f32 = SmallRng::from_entropy().sample(Standard); -/// println!("f32 from [0, 1): {}", val); -/// ``` -/// -/// # Floating point implementation -/// The floating point implementations for `Standard` generate a random value in -/// the half-open interval `[0, 1)`, i.e. including 0 but not 1. -/// -/// All values that can be generated are of the form `n * ε/2`. For `f32` -/// the 23 most significant random bits of a `u32` are used and for `f64` the -/// 53 most significant bits of a `u64` are used. The conversion uses the -/// multiplicative method: `(rng.gen::<$uty>() >> N) as $ty * (ε/2)`. -/// -/// See also: [`Open01`] which samples from `(0, 1)`, [`OpenClosed01`] which -/// samples from `(0, 1]` and `Rng::gen_range(0, 1)` which also samples from -/// `[0, 1)`. Note that `Open01` and `gen_range` (which uses [`Uniform`]) use -/// transmute-based methods which yield 1 bit less precision but may perform -/// faster on some architectures (on modern Intel CPUs all methods have -/// approximately equal performance). -/// -/// [`Open01`]: struct.Open01.html -/// [`OpenClosed01`]: struct.OpenClosed01.html -/// [`Uniform`]: uniform/struct.Uniform.html -#[derive(Clone, Copy, Debug)] -pub struct Standard; - -#[allow(deprecated)] -impl ::Rand for T where Standard: Distribution { - fn rand(rng: &mut R) -> Self { - Standard.sample(rng) - } -} - - -/// A value with a particular weight for use with `WeightedChoice`. -#[derive(Copy, Clone, Debug)] -pub struct Weighted { - /// The numerical weight of this item - pub weight: u32, - /// The actual item which is being weighted - pub item: T, -} - -/// A distribution that selects from a finite collection of weighted items. -/// -/// Each item has an associated weight that influences how likely it -/// is to be chosen: higher weight is more likely. -/// -/// The `Clone` restriction is a limitation of the `Distribution` trait. -/// Note that `&T` is (cheaply) `Clone` for all `T`, as is `u32`, so one can -/// store references or indices into another vector. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{Weighted, WeightedChoice, Distribution}; -/// -/// let mut items = vec!(Weighted { weight: 2, item: 'a' }, -/// Weighted { weight: 4, item: 'b' }, -/// Weighted { weight: 1, item: 'c' }); -/// let wc = WeightedChoice::new(&mut items); -/// let mut rng = rand::thread_rng(); -/// for _ in 0..16 { -/// // on average prints 'a' 4 times, 'b' 8 and 'c' twice. -/// println!("{}", wc.sample(&mut rng)); -/// } -/// ``` -#[derive(Debug)] -pub struct WeightedChoice<'a, T:'a> { - items: &'a mut [Weighted], - weight_range: Uniform, -} - -impl<'a, T: Clone> WeightedChoice<'a, T> { - /// Create a new `WeightedChoice`. - /// - /// Panics if: - /// - /// - `items` is empty - /// - the total weight is 0 - /// - the total weight is larger than a `u32` can contain. - pub fn new(items: &'a mut [Weighted]) -> WeightedChoice<'a, T> { - // strictly speaking, this is subsumed by the total weight == 0 case - assert!(!items.is_empty(), "WeightedChoice::new called with no items"); - - let mut running_total: u32 = 0; - - // we convert the list from individual weights to cumulative - // weights so we can binary search. This *could* drop elements - // with weight == 0 as an optimisation. - for item in items.iter_mut() { - running_total = match running_total.checked_add(item.weight) { - Some(n) => n, - None => panic!("WeightedChoice::new called with a total weight \ - larger than a u32 can contain") - }; - - item.weight = running_total; - } - assert!(running_total != 0, "WeightedChoice::new called with a total weight of 0"); - - WeightedChoice { - items, - // we're likely to be generating numbers in this range - // relatively often, so might as well cache it - weight_range: Uniform::new(0, running_total) - } - } -} - -impl<'a, T: Clone> Distribution for WeightedChoice<'a, T> { - fn sample(&self, rng: &mut R) -> T { - // we want to find the first element that has cumulative - // weight > sample_weight, which we do by binary since the - // cumulative weights of self.items are sorted. - - // choose a weight in [0, total_weight) - let sample_weight = self.weight_range.sample(rng); - - // short circuit when it's the first item - if sample_weight < self.items[0].weight { - return self.items[0].item.clone(); - } - - let mut idx = 0; - let mut modifier = self.items.len(); - - // now we know that every possibility has an element to the - // left, so we can just search for the last element that has - // cumulative weight <= sample_weight, then the next one will - // be "it". (Note that this greatest element will never be the - // last element of the vector, since sample_weight is chosen - // in [0, total_weight) and the cumulative weight of the last - // one is exactly the total weight.) - while modifier > 1 { - let i = idx + modifier / 2; - if self.items[i].weight <= sample_weight { - // we're small, so look to the right, but allow this - // exact element still. - idx = i; - // we need the `/ 2` to round up otherwise we'll drop - // the trailing elements when `modifier` is odd. - modifier += 1; - } else { - // otherwise we're too big, so go left. (i.e. do - // nothing) - } - modifier /= 2; - } - self.items[idx + 1].item.clone() - } -} - -/// Sample a random number using the Ziggurat method (specifically the -/// ZIGNOR variant from Doornik 2005). Most of the arguments are -/// directly from the paper: -/// -/// * `rng`: source of randomness -/// * `symmetric`: whether this is a symmetric distribution, or one-sided with P(x < 0) = 0. -/// * `X`: the $x_i$ abscissae. -/// * `F`: precomputed values of the PDF at the $x_i$, (i.e. $f(x_i)$) -/// * `F_DIFF`: precomputed values of $f(x_i) - f(x_{i+1})$ -/// * `pdf`: the probability density function -/// * `zero_case`: manual sampling from the tail when we chose the -/// bottom box (i.e. i == 0) - -// the perf improvement (25-50%) is definitely worth the extra code -// size from force-inlining. -#[cfg(feature="std")] -#[inline(always)] -fn ziggurat( - rng: &mut R, - symmetric: bool, - x_tab: ziggurat_tables::ZigTable, - f_tab: ziggurat_tables::ZigTable, - mut pdf: P, - mut zero_case: Z) - -> f64 where P: FnMut(f64) -> f64, Z: FnMut(&mut R, f64) -> f64 { - loop { - // As an optimisation we re-implement the conversion to a f64. - // From the remaining 12 most significant bits we use 8 to construct `i`. - // This saves us generating a whole extra random number, while the added - // precision of using 64 bits for f64 does not buy us much. - let bits = rng.next_u64(); - let i = bits as usize & 0xff; - - let u = if symmetric { - // Convert to a value in the range [2,4) and substract to get [-1,1) - // We can't convert to an open range directly, that would require - // substracting `3.0 - EPSILON`, which is not representable. - // It is possible with an extra step, but an open range does not - // seem neccesary for the ziggurat algorithm anyway. - (bits >> 12).into_float_with_exponent(1) - 3.0 - } else { - // Convert to a value in the range [1,2) and substract to get (0,1) - (bits >> 12).into_float_with_exponent(0) - - (1.0 - ::core::f64::EPSILON / 2.0) - }; - let x = u * x_tab[i]; - - let test_x = if symmetric { x.abs() } else {x}; - - // algebraically equivalent to |u| < x_tab[i+1]/x_tab[i] (or u < x_tab[i+1]/x_tab[i]) - if test_x < x_tab[i + 1] { - return x; - } - if i == 0 { - return zero_case(rng, u); - } - // algebraically equivalent to f1 + DRanU()*(f0 - f1) < 1 - if f_tab[i + 1] + (f_tab[i] - f_tab[i + 1]) * rng.gen::() < pdf(x) { - return x; - } - } -} - -#[cfg(test)] -mod tests { - use Rng; - use rngs::mock::StepRng; - use super::{WeightedChoice, Weighted, Distribution}; - - #[test] - fn test_weighted_choice() { - // this makes assumptions about the internal implementation of - // WeightedChoice. It may fail when the implementation in - // `distributions::uniform::UniformInt` changes. - - macro_rules! t { - ($items:expr, $expected:expr) => {{ - let mut items = $items; - let mut total_weight = 0; - for item in &items { total_weight += item.weight; } - - let wc = WeightedChoice::new(&mut items); - let expected = $expected; - - // Use extremely large steps between the random numbers, because - // we test with small ranges and `UniformInt` is designed to prefer - // the most significant bits. - let mut rng = StepRng::new(0, !0 / (total_weight as u64)); - - for &val in expected.iter() { - assert_eq!(wc.sample(&mut rng), val) - } - }} - } - - t!([Weighted { weight: 1, item: 10}], [10]); - - // skip some - t!([Weighted { weight: 0, item: 20}, - Weighted { weight: 2, item: 21}, - Weighted { weight: 0, item: 22}, - Weighted { weight: 1, item: 23}], - [21, 21, 23]); - - // different weights - t!([Weighted { weight: 4, item: 30}, - Weighted { weight: 3, item: 31}], - [30, 31, 30, 31, 30, 31, 30]); - - // check that we're binary searching - // correctly with some vectors of odd - // length. - t!([Weighted { weight: 1, item: 40}, - Weighted { weight: 1, item: 41}, - Weighted { weight: 1, item: 42}, - Weighted { weight: 1, item: 43}, - Weighted { weight: 1, item: 44}], - [40, 41, 42, 43, 44]); - t!([Weighted { weight: 1, item: 50}, - Weighted { weight: 1, item: 51}, - Weighted { weight: 1, item: 52}, - Weighted { weight: 1, item: 53}, - Weighted { weight: 1, item: 54}, - Weighted { weight: 1, item: 55}, - Weighted { weight: 1, item: 56}], - [50, 54, 51, 55, 52, 56, 53]); - } - - #[test] - fn test_weighted_clone_initialization() { - let initial : Weighted = Weighted {weight: 1, item: 1}; - let clone = initial.clone(); - assert_eq!(initial.weight, clone.weight); - assert_eq!(initial.item, clone.item); - } - - #[test] #[should_panic] - fn test_weighted_clone_change_weight() { - let initial : Weighted = Weighted {weight: 1, item: 1}; - let mut clone = initial.clone(); - clone.weight = 5; - assert_eq!(initial.weight, clone.weight); - } - - #[test] #[should_panic] - fn test_weighted_clone_change_item() { - let initial : Weighted = Weighted {weight: 1, item: 1}; - let mut clone = initial.clone(); - clone.item = 5; - assert_eq!(initial.item, clone.item); - - } - - #[test] #[should_panic] - fn test_weighted_choice_no_items() { - WeightedChoice::::new(&mut []); - } - #[test] #[should_panic] - fn test_weighted_choice_zero_weight() { - WeightedChoice::new(&mut [Weighted { weight: 0, item: 0}, - Weighted { weight: 0, item: 1}]); - } - #[test] #[should_panic] - fn test_weighted_choice_weight_overflows() { - let x = ::core::u32::MAX / 2; // x + x + 2 is the overflow - WeightedChoice::new(&mut [Weighted { weight: x, item: 0 }, - Weighted { weight: 1, item: 1 }, - Weighted { weight: x, item: 2 }, - Weighted { weight: 1, item: 3 }]); - } - - #[test] #[allow(deprecated)] - fn test_backwards_compat_sample() { - use distributions::{Sample, IndependentSample}; - - struct Constant { val: T } - impl Sample for Constant { - fn sample(&mut self, _: &mut R) -> T { self.val } - } - impl IndependentSample for Constant { - fn ind_sample(&self, _: &mut R) -> T { self.val } - } - - let mut sampler = Constant{ val: 293 }; - assert_eq!(sampler.sample(&mut ::test::rng(233)), 293); - assert_eq!(sampler.ind_sample(&mut ::test::rng(234)), 293); - } - - #[cfg(feature="std")] - #[test] #[allow(deprecated)] - fn test_backwards_compat_exp() { - use distributions::{IndependentSample, Exp}; - let sampler = Exp::new(1.0); - sampler.ind_sample(&mut ::test::rng(235)); - } - - #[cfg(feature="std")] - #[test] - fn test_distributions_iter() { - use distributions::Normal; - let mut rng = ::test::rng(210); - let distr = Normal::new(10.0, 10.0); - let results: Vec<_> = distr.sample_iter(&mut rng).take(100).collect(); - println!("{:?}", results); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/distributions/normal.rs cargo-0.37.0/vendor/rand-0.5.6/src/distributions/normal.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/distributions/normal.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/distributions/normal.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,192 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The normal and derived distributions. - -use Rng; -use distributions::{ziggurat, ziggurat_tables, Distribution, Open01}; - -/// Samples floating-point numbers according to the normal distribution -/// `N(0, 1)` (a.k.a. a standard normal, or Gaussian). This is equivalent to -/// `Normal::new(0.0, 1.0)` but faster. -/// -/// See `Normal` for the general normal distribution. -/// -/// Implemented via the ZIGNOR variant[^1] of the Ziggurat method. -/// -/// [^1]: Jurgen A. Doornik (2005). [*An Improved Ziggurat Method to -/// Generate Normal Random Samples*]( -/// https://www.doornik.com/research/ziggurat.pdf). -/// Nuffield College, Oxford -/// -/// # Example -/// ``` -/// use rand::prelude::*; -/// use rand::distributions::StandardNormal; -/// -/// let val: f64 = SmallRng::from_entropy().sample(StandardNormal); -/// println!("{}", val); -/// ``` -#[derive(Clone, Copy, Debug)] -pub struct StandardNormal; - -impl Distribution for StandardNormal { - fn sample(&self, rng: &mut R) -> f64 { - #[inline] - fn pdf(x: f64) -> f64 { - (-x*x/2.0).exp() - } - #[inline] - fn zero_case(rng: &mut R, u: f64) -> f64 { - // compute a random number in the tail by hand - - // strange initial conditions, because the loop is not - // do-while, so the condition should be true on the first - // run, they get overwritten anyway (0 < 1, so these are - // good). - let mut x = 1.0f64; - let mut y = 0.0f64; - - while -2.0 * y < x * x { - let x_: f64 = rng.sample(Open01); - let y_: f64 = rng.sample(Open01); - - x = x_.ln() / ziggurat_tables::ZIG_NORM_R; - y = y_.ln(); - } - - if u < 0.0 { x - ziggurat_tables::ZIG_NORM_R } else { ziggurat_tables::ZIG_NORM_R - x } - } - - ziggurat(rng, true, // this is symmetric - &ziggurat_tables::ZIG_NORM_X, - &ziggurat_tables::ZIG_NORM_F, - pdf, zero_case) - } -} - -/// The normal distribution `N(mean, std_dev**2)`. -/// -/// This uses the ZIGNOR variant of the Ziggurat method, see `StandardNormal` -/// for more details. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{Normal, Distribution}; -/// -/// // mean 2, standard deviation 3 -/// let normal = Normal::new(2.0, 3.0); -/// let v = normal.sample(&mut rand::thread_rng()); -/// println!("{} is from a N(2, 9) distribution", v) -/// ``` -#[derive(Clone, Copy, Debug)] -pub struct Normal { - mean: f64, - std_dev: f64, -} - -impl Normal { - /// Construct a new `Normal` distribution with the given mean and - /// standard deviation. - /// - /// # Panics - /// - /// Panics if `std_dev < 0`. - #[inline] - pub fn new(mean: f64, std_dev: f64) -> Normal { - assert!(std_dev >= 0.0, "Normal::new called with `std_dev` < 0"); - Normal { - mean, - std_dev - } - } -} -impl Distribution for Normal { - fn sample(&self, rng: &mut R) -> f64 { - let n = rng.sample(StandardNormal); - self.mean + self.std_dev * n - } -} - - -/// The log-normal distribution `ln N(mean, std_dev**2)`. -/// -/// If `X` is log-normal distributed, then `ln(X)` is `N(mean, std_dev**2)` -/// distributed. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{LogNormal, Distribution}; -/// -/// // mean 2, standard deviation 3 -/// let log_normal = LogNormal::new(2.0, 3.0); -/// let v = log_normal.sample(&mut rand::thread_rng()); -/// println!("{} is from an ln N(2, 9) distribution", v) -/// ``` -#[derive(Clone, Copy, Debug)] -pub struct LogNormal { - norm: Normal -} - -impl LogNormal { - /// Construct a new `LogNormal` distribution with the given mean - /// and standard deviation. - /// - /// # Panics - /// - /// Panics if `std_dev < 0`. - #[inline] - pub fn new(mean: f64, std_dev: f64) -> LogNormal { - assert!(std_dev >= 0.0, "LogNormal::new called with `std_dev` < 0"); - LogNormal { norm: Normal::new(mean, std_dev) } - } -} -impl Distribution for LogNormal { - fn sample(&self, rng: &mut R) -> f64 { - self.norm.sample(rng).exp() - } -} - -#[cfg(test)] -mod tests { - use distributions::Distribution; - use super::{Normal, LogNormal}; - - #[test] - fn test_normal() { - let norm = Normal::new(10.0, 10.0); - let mut rng = ::test::rng(210); - for _ in 0..1000 { - norm.sample(&mut rng); - } - } - #[test] - #[should_panic] - fn test_normal_invalid_sd() { - Normal::new(10.0, -1.0); - } - - - #[test] - fn test_log_normal() { - let lnorm = LogNormal::new(10.0, 10.0); - let mut rng = ::test::rng(211); - for _ in 0..1000 { - lnorm.sample(&mut rng); - } - } - #[test] - #[should_panic] - fn test_log_normal_invalid_sd() { - LogNormal::new(10.0, -1.0); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/distributions/other.rs cargo-0.37.0/vendor/rand-0.5.6/src/distributions/other.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/distributions/other.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/distributions/other.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,215 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The implementations of the `Standard` distribution for other built-in types. - -use core::char; -use core::num::Wrapping; - -use {Rng}; -use distributions::{Distribution, Standard, Uniform}; - -// ----- Sampling distributions ----- - -/// Sample a `char`, uniformly distributed over ASCII letters and numbers: -/// a-z, A-Z and 0-9. -/// -/// # Example -/// -/// ``` -/// use std::iter; -/// use rand::{Rng, thread_rng}; -/// use rand::distributions::Alphanumeric; -/// -/// let mut rng = thread_rng(); -/// let chars: String = iter::repeat(()) -/// .map(|()| rng.sample(Alphanumeric)) -/// .take(7) -/// .collect(); -/// println!("Random chars: {}", chars); -/// ``` -#[derive(Debug)] -pub struct Alphanumeric; - - -// ----- Implementations of distributions ----- - -impl Distribution for Standard { - #[inline] - fn sample(&self, rng: &mut R) -> char { - let range = Uniform::new(0u32, 0x11_0000); - loop { - match char::from_u32(range.sample(rng)) { - Some(c) => return c, - // About 0.2% of numbers in the range 0..0x110000 are invalid - // codepoints (surrogates). - None => {} - } - } - } -} - -impl Distribution for Alphanumeric { - fn sample(&self, rng: &mut R) -> char { - const RANGE: u32 = 26 + 26 + 10; - const GEN_ASCII_STR_CHARSET: &[u8] = - b"ABCDEFGHIJKLMNOPQRSTUVWXYZ\ - abcdefghijklmnopqrstuvwxyz\ - 0123456789"; - // We can pick from 62 characters. This is so close to a power of 2, 64, - // that we can do better than `Uniform`. Use a simple bitshift and - // rejection sampling. We do not use a bitmask, because for small RNGs - // the most significant bits are usually of higher quality. - loop { - let var = rng.next_u32() >> (32 - 6); - if var < RANGE { - return GEN_ASCII_STR_CHARSET[var as usize] as char - } - } - } -} - -impl Distribution for Standard { - #[inline] - fn sample(&self, rng: &mut R) -> bool { - // We can compare against an arbitrary bit of an u32 to get a bool. - // Because the least significant bits of a lower quality RNG can have - // simple patterns, we compare against the most significant bit. This is - // easiest done using a sign test. - (rng.next_u32() as i32) < 0 - } -} - -macro_rules! tuple_impl { - // use variables to indicate the arity of the tuple - ($($tyvar:ident),* ) => { - // the trailing commas are for the 1 tuple - impl< $( $tyvar ),* > - Distribution<( $( $tyvar ),* , )> - for Standard - where $( Standard: Distribution<$tyvar> ),* - { - #[inline] - fn sample(&self, _rng: &mut R) -> ( $( $tyvar ),* , ) { - ( - // use the $tyvar's to get the appropriate number of - // repeats (they're not actually needed) - $( - _rng.gen::<$tyvar>() - ),* - , - ) - } - } - } -} - -impl Distribution<()> for Standard { - #[inline] - fn sample(&self, _: &mut R) -> () { () } -} -tuple_impl!{A} -tuple_impl!{A, B} -tuple_impl!{A, B, C} -tuple_impl!{A, B, C, D} -tuple_impl!{A, B, C, D, E} -tuple_impl!{A, B, C, D, E, F} -tuple_impl!{A, B, C, D, E, F, G} -tuple_impl!{A, B, C, D, E, F, G, H} -tuple_impl!{A, B, C, D, E, F, G, H, I} -tuple_impl!{A, B, C, D, E, F, G, H, I, J} -tuple_impl!{A, B, C, D, E, F, G, H, I, J, K} -tuple_impl!{A, B, C, D, E, F, G, H, I, J, K, L} - -macro_rules! array_impl { - // recursive, given at least one type parameter: - {$n:expr, $t:ident, $($ts:ident,)*} => { - array_impl!{($n - 1), $($ts,)*} - - impl Distribution<[T; $n]> for Standard where Standard: Distribution { - #[inline] - fn sample(&self, _rng: &mut R) -> [T; $n] { - [_rng.gen::<$t>(), $(_rng.gen::<$ts>()),*] - } - } - }; - // empty case: - {$n:expr,} => { - impl Distribution<[T; $n]> for Standard { - fn sample(&self, _rng: &mut R) -> [T; $n] { [] } - } - }; -} - -array_impl!{32, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T,} - -impl Distribution> for Standard where Standard: Distribution { - #[inline] - fn sample(&self, rng: &mut R) -> Option { - // UFCS is needed here: https://github.com/rust-lang/rust/issues/24066 - if rng.gen::() { - Some(rng.gen()) - } else { - None - } - } -} - -impl Distribution> for Standard where Standard: Distribution { - #[inline] - fn sample(&self, rng: &mut R) -> Wrapping { - Wrapping(rng.gen()) - } -} - - -#[cfg(test)] -mod tests { - use {Rng, RngCore, Standard}; - use distributions::Alphanumeric; - #[cfg(all(not(feature="std"), feature="alloc"))] use alloc::string::String; - - #[test] - fn test_misc() { - let rng: &mut RngCore = &mut ::test::rng(820); - - rng.sample::(Standard); - rng.sample::(Standard); - } - - #[cfg(feature="alloc")] - #[test] - fn test_chars() { - use core::iter; - let mut rng = ::test::rng(805); - - // Test by generating a relatively large number of chars, so we also - // take the rejection sampling path. - let word: String = iter::repeat(()) - .map(|()| rng.gen::()).take(1000).collect(); - assert!(word.len() != 0); - } - - #[test] - fn test_alphanumeric() { - let mut rng = ::test::rng(806); - - // Test by generating a relatively large number of chars, so we also - // take the rejection sampling path. - let mut incorrect = false; - for _ in 0..100 { - let c = rng.sample(Alphanumeric); - incorrect |= !((c >= '0' && c <= '9') || - (c >= 'A' && c <= 'Z') || - (c >= 'a' && c <= 'z') ); - } - assert!(incorrect == false); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/distributions/pareto.rs cargo-0.37.0/vendor/rand-0.5.6/src/distributions/pareto.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/distributions/pareto.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/distributions/pareto.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,76 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The Pareto distribution. - -use Rng; -use distributions::{Distribution, OpenClosed01}; - -/// Samples floating-point numbers according to the Pareto distribution -/// -/// # Example -/// ``` -/// use rand::prelude::*; -/// use rand::distributions::Pareto; -/// -/// let val: f64 = SmallRng::from_entropy().sample(Pareto::new(1., 2.)); -/// println!("{}", val); -/// ``` -#[derive(Clone, Copy, Debug)] -pub struct Pareto { - scale: f64, - inv_neg_shape: f64, -} - -impl Pareto { - /// Construct a new Pareto distribution with given `scale` and `shape`. - /// - /// In the literature, `scale` is commonly written as xm or k and - /// `shape` is often written as α. - /// - /// # Panics - /// - /// `scale` and `shape` have to be non-zero and positive. - pub fn new(scale: f64, shape: f64) -> Pareto { - assert!((scale > 0.) & (shape > 0.)); - Pareto { scale, inv_neg_shape: -1.0 / shape } - } -} - -impl Distribution for Pareto { - fn sample(&self, rng: &mut R) -> f64 { - let u: f64 = rng.sample(OpenClosed01); - self.scale * u.powf(self.inv_neg_shape) - } -} - -#[cfg(test)] -mod tests { - use distributions::Distribution; - use super::Pareto; - - #[test] - #[should_panic] - fn invalid() { - Pareto::new(0., 0.); - } - - #[test] - fn sample() { - let scale = 1.0; - let shape = 2.0; - let d = Pareto::new(scale, shape); - let mut rng = ::test::rng(1); - for _ in 0..1000 { - let r = d.sample(&mut rng); - assert!(r >= scale); - } - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/distributions/poisson.rs cargo-0.37.0/vendor/rand-0.5.6/src/distributions/poisson.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/distributions/poisson.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/distributions/poisson.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,158 +0,0 @@ -// Copyright 2016-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The Poisson distribution. - -use Rng; -use distributions::{Distribution, Cauchy}; -use distributions::log_gamma::log_gamma; - -/// The Poisson distribution `Poisson(lambda)`. -/// -/// This distribution has a density function: -/// `f(k) = lambda^k * exp(-lambda) / k!` for `k >= 0`. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{Poisson, Distribution}; -/// -/// let poi = Poisson::new(2.0); -/// let v = poi.sample(&mut rand::thread_rng()); -/// println!("{} is from a Poisson(2) distribution", v); -/// ``` -#[derive(Clone, Copy, Debug)] -pub struct Poisson { - lambda: f64, - // precalculated values - exp_lambda: f64, - log_lambda: f64, - sqrt_2lambda: f64, - magic_val: f64, -} - -impl Poisson { - /// Construct a new `Poisson` with the given shape parameter - /// `lambda`. Panics if `lambda <= 0`. - pub fn new(lambda: f64) -> Poisson { - assert!(lambda > 0.0, "Poisson::new called with lambda <= 0"); - let log_lambda = lambda.ln(); - Poisson { - lambda, - exp_lambda: (-lambda).exp(), - log_lambda, - sqrt_2lambda: (2.0 * lambda).sqrt(), - magic_val: lambda * log_lambda - log_gamma(1.0 + lambda), - } - } -} - -impl Distribution for Poisson { - fn sample(&self, rng: &mut R) -> u64 { - // using the algorithm from Numerical Recipes in C - - // for low expected values use the Knuth method - if self.lambda < 12.0 { - let mut result = 0; - let mut p = 1.0; - while p > self.exp_lambda { - p *= rng.gen::(); - result += 1; - } - result - 1 - } - // high expected values - rejection method - else { - let mut int_result: u64; - - // we use the Cauchy distribution as the comparison distribution - // f(x) ~ 1/(1+x^2) - let cauchy = Cauchy::new(0.0, 1.0); - - loop { - let mut result; - let mut comp_dev; - - loop { - // draw from the Cauchy distribution - comp_dev = rng.sample(cauchy); - // shift the peak of the comparison ditribution - result = self.sqrt_2lambda * comp_dev + self.lambda; - // repeat the drawing until we are in the range of possible values - if result >= 0.0 { - break; - } - } - // now the result is a random variable greater than 0 with Cauchy distribution - // the result should be an integer value - result = result.floor(); - int_result = result as u64; - - // this is the ratio of the Poisson distribution to the comparison distribution - // the magic value scales the distribution function to a range of approximately 0-1 - // since it is not exact, we multiply the ratio by 0.9 to avoid ratios greater than 1 - // this doesn't change the resulting distribution, only increases the rate of failed drawings - let check = 0.9 * (1.0 + comp_dev * comp_dev) - * (result * self.log_lambda - log_gamma(1.0 + result) - self.magic_val).exp(); - - // check with uniform random value - if below the threshold, we are within the target distribution - if rng.gen::() <= check { - break; - } - } - int_result - } - } -} - -#[cfg(test)] -mod test { - use distributions::Distribution; - use super::Poisson; - - #[test] - fn test_poisson_10() { - let poisson = Poisson::new(10.0); - let mut rng = ::test::rng(123); - let mut sum = 0; - for _ in 0..1000 { - sum += poisson.sample(&mut rng); - } - let avg = (sum as f64) / 1000.0; - println!("Poisson average: {}", avg); - assert!((avg - 10.0).abs() < 0.5); // not 100% certain, but probable enough - } - - #[test] - fn test_poisson_15() { - // Take the 'high expected values' path - let poisson = Poisson::new(15.0); - let mut rng = ::test::rng(123); - let mut sum = 0; - for _ in 0..1000 { - sum += poisson.sample(&mut rng); - } - let avg = (sum as f64) / 1000.0; - println!("Poisson average: {}", avg); - assert!((avg - 15.0).abs() < 0.5); // not 100% certain, but probable enough - } - - #[test] - #[should_panic] - fn test_poisson_invalid_lambda_zero() { - Poisson::new(0.0); - } - - #[test] - #[should_panic] - fn test_poisson_invalid_lambda_neg() { - Poisson::new(-10.0); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/distributions/uniform.rs cargo-0.37.0/vendor/rand-0.5.6/src/distributions/uniform.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/distributions/uniform.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/distributions/uniform.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,856 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! A distribution uniformly sampling numbers within a given range. -//! -//! [`Uniform`] is the standard distribution to sample uniformly from a range; -//! e.g. `Uniform::new_inclusive(1, 6)` can sample integers from 1 to 6, like a -//! standard die. [`Rng::gen_range`] supports any type supported by -//! [`Uniform`]. -//! -//! This distribution is provided with support for several primitive types -//! (all integer and floating-point types) as well as `std::time::Duration`, -//! and supports extension to user-defined types via a type-specific *back-end* -//! implementation. -//! -//! The types [`UniformInt`], [`UniformFloat`] and [`UniformDuration`] are the -//! back-ends supporting sampling from primitive integer and floating-point -//! ranges as well as from `std::time::Duration`; these types do not normally -//! need to be used directly (unless implementing a derived back-end). -//! -//! # Example usage -//! -//! ``` -//! use rand::{Rng, thread_rng}; -//! use rand::distributions::Uniform; -//! -//! let mut rng = thread_rng(); -//! let side = Uniform::new(-10.0, 10.0); -//! -//! // sample between 1 and 10 points -//! for _ in 0..rng.gen_range(1, 11) { -//! // sample a point from the square with sides -10 - 10 in two dimensions -//! let (x, y) = (rng.sample(side), rng.sample(side)); -//! println!("Point: {}, {}", x, y); -//! } -//! ``` -//! -//! # Extending `Uniform` to support a custom type -//! -//! To extend [`Uniform`] to support your own types, write a back-end which -//! implements the [`UniformSampler`] trait, then implement the [`SampleUniform`] -//! helper trait to "register" your back-end. See the `MyF32` example below. -//! -//! At a minimum, the back-end needs to store any parameters needed for sampling -//! (e.g. the target range) and implement `new`, `new_inclusive` and `sample`. -//! Those methods should include an assert to check the range is valid (i.e. -//! `low < high`). The example below merely wraps another back-end. -//! -//! ``` -//! use rand::prelude::*; -//! use rand::distributions::uniform::{Uniform, SampleUniform, -//! UniformSampler, UniformFloat}; -//! -//! struct MyF32(f32); -//! -//! #[derive(Clone, Copy, Debug)] -//! struct UniformMyF32 { -//! inner: UniformFloat, -//! } -//! -//! impl UniformSampler for UniformMyF32 { -//! type X = MyF32; -//! fn new(low: Self::X, high: Self::X) -> Self { -//! UniformMyF32 { -//! inner: UniformFloat::::new(low.0, high.0), -//! } -//! } -//! fn new_inclusive(low: Self::X, high: Self::X) -> Self { -//! UniformSampler::new(low, high) -//! } -//! fn sample(&self, rng: &mut R) -> Self::X { -//! MyF32(self.inner.sample(rng)) -//! } -//! } -//! -//! impl SampleUniform for MyF32 { -//! type Sampler = UniformMyF32; -//! } -//! -//! let (low, high) = (MyF32(17.0f32), MyF32(22.0f32)); -//! let uniform = Uniform::new(low, high); -//! let x = uniform.sample(&mut thread_rng()); -//! ``` -//! -//! [`Uniform`]: struct.Uniform.html -//! [`Rng::gen_range`]: ../../trait.Rng.html#method.gen_range -//! [`SampleUniform`]: trait.SampleUniform.html -//! [`UniformSampler`]: trait.UniformSampler.html -//! [`UniformInt`]: struct.UniformInt.html -//! [`UniformFloat`]: struct.UniformFloat.html -//! [`UniformDuration`]: struct.UniformDuration.html - -#[cfg(feature = "std")] -use std::time::Duration; - -use Rng; -use distributions::Distribution; -use distributions::float::IntoFloat; - -/// Sample values uniformly between two bounds. -/// -/// [`Uniform::new`] and [`Uniform::new_inclusive`] construct a uniform -/// distribution sampling from the given range; these functions may do extra -/// work up front to make sampling of multiple values faster. -/// -/// When sampling from a constant range, many calculations can happen at -/// compile-time and all methods should be fast; for floating-point ranges and -/// the full range of integer types this should have comparable performance to -/// the `Standard` distribution. -/// -/// Steps are taken to avoid bias which might be present in naive -/// implementations; for example `rng.gen::() % 170` samples from the range -/// `[0, 169]` but is twice as likely to select numbers less than 85 than other -/// values. Further, the implementations here give more weight to the high-bits -/// generated by the RNG than the low bits, since with some RNGs the low-bits -/// are of lower quality than the high bits. -/// -/// Implementations should attempt to sample in `[low, high)` for -/// `Uniform::new(low, high)`, i.e., excluding `high`, but this may be very -/// difficult. All the primitive integer types satisfy this property, and the -/// float types normally satisfy it, but rounding may mean `high` can occur. -/// -/// # Example -/// -/// ``` -/// use rand::distributions::{Distribution, Uniform}; -/// -/// fn main() { -/// let between = Uniform::from(10..10000); -/// let mut rng = rand::thread_rng(); -/// let mut sum = 0; -/// for _ in 0..1000 { -/// sum += between.sample(&mut rng); -/// } -/// println!("{}", sum); -/// } -/// ``` -/// -/// [`Uniform::new`]: struct.Uniform.html#method.new -/// [`Uniform::new_inclusive`]: struct.Uniform.html#method.new_inclusive -/// [`new`]: struct.Uniform.html#method.new -/// [`new_inclusive`]: struct.Uniform.html#method.new_inclusive -#[derive(Clone, Copy, Debug)] -pub struct Uniform { - inner: X::Sampler, -} - -impl Uniform { - /// Create a new `Uniform` instance which samples uniformly from the half - /// open range `[low, high)` (excluding `high`). Panics if `low >= high`. - pub fn new(low: X, high: X) -> Uniform { - Uniform { inner: X::Sampler::new(low, high) } - } - - /// Create a new `Uniform` instance which samples uniformly from the closed - /// range `[low, high]` (inclusive). Panics if `low > high`. - pub fn new_inclusive(low: X, high: X) -> Uniform { - Uniform { inner: X::Sampler::new_inclusive(low, high) } - } -} - -impl Distribution for Uniform { - fn sample(&self, rng: &mut R) -> X { - self.inner.sample(rng) - } -} - -/// Helper trait for creating objects using the correct implementation of -/// [`UniformSampler`] for the sampling type. -/// -/// See the [module documentation] on how to implement [`Uniform`] range -/// sampling for a custom type. -/// -/// [`UniformSampler`]: trait.UniformSampler.html -/// [module documentation]: index.html -/// [`Uniform`]: struct.Uniform.html -pub trait SampleUniform: Sized { - /// The `UniformSampler` implementation supporting type `X`. - type Sampler: UniformSampler; -} - -/// Helper trait handling actual uniform sampling. -/// -/// See the [module documentation] on how to implement [`Uniform`] range -/// sampling for a custom type. -/// -/// Implementation of [`sample_single`] is optional, and is only useful when -/// the implementation can be faster than `Self::new(low, high).sample(rng)`. -/// -/// [module documentation]: index.html -/// [`Uniform`]: struct.Uniform.html -/// [`sample_single`]: trait.UniformSampler.html#method.sample_single -pub trait UniformSampler: Sized { - /// The type sampled by this implementation. - type X; - - /// Construct self, with inclusive lower bound and exclusive upper bound - /// `[low, high)`. - /// - /// Usually users should not call this directly but instead use - /// `Uniform::new`, which asserts that `low < high` before calling this. - fn new(low: Self::X, high: Self::X) -> Self; - - /// Construct self, with inclusive bounds `[low, high]`. - /// - /// Usually users should not call this directly but instead use - /// `Uniform::new_inclusive`, which asserts that `low <= high` before - /// calling this. - fn new_inclusive(low: Self::X, high: Self::X) -> Self; - - /// Sample a value. - fn sample(&self, rng: &mut R) -> Self::X; - - /// Sample a single value uniformly from a range with inclusive lower bound - /// and exclusive upper bound `[low, high)`. - /// - /// Usually users should not call this directly but instead use - /// `Uniform::sample_single`, which asserts that `low < high` before calling - /// this. - /// - /// Via this method, implementations can provide a method optimized for - /// sampling only a single value from the specified range. The default - /// implementation simply calls `UniformSampler::new` then `sample` on the - /// result. - fn sample_single(low: Self::X, high: Self::X, rng: &mut R) - -> Self::X - { - let uniform: Self = UniformSampler::new(low, high); - uniform.sample(rng) - } -} - -impl From<::core::ops::Range> for Uniform { - fn from(r: ::core::ops::Range) -> Uniform { - Uniform::new(r.start, r.end) - } -} - -//////////////////////////////////////////////////////////////////////////////// - -// What follows are all back-ends. - - -/// The back-end implementing [`UniformSampler`] for integer types. -/// -/// Unless you are implementing [`UniformSampler`] for your own type, this type -/// should not be used directly, use [`Uniform`] instead. -/// -/// # Implementation notes -/// -/// For a closed range, the number of possible numbers we should generate is -/// `range = (high - low + 1)`. It is not possible to end up with a uniform -/// distribution if we map *all* the random integers that can be generated to -/// this range. We have to map integers from a `zone` that is a multiple of the -/// range. The rest of the integers, that cause a bias, are rejected. -/// -/// The problem with `range` is that to cover the full range of the type, it has -/// to store `unsigned_max + 1`, which can't be represented. But if the range -/// covers the full range of the type, no modulus is needed. A range of size 0 -/// can't exist, so we use that to represent this special case. Wrapping -/// arithmetic even makes representing `unsigned_max + 1` as 0 simple. -/// -/// We don't calculate `zone` directly, but first calculate the number of -/// integers to reject. To handle `unsigned_max + 1` not fitting in the type, -/// we use: -/// `ints_to_reject = (unsigned_max + 1) % range;` -/// `ints_to_reject = (unsigned_max - range + 1) % range;` -/// -/// The smallest integer PRNGs generate is `u32`. That is why for small integer -/// sizes (`i8`/`u8` and `i16`/`u16`) there is an optimization: don't pick the -/// largest zone that can fit in the small type, but pick the largest zone that -/// can fit in an `u32`. `ints_to_reject` is always less than half the size of -/// the small integer. This means the first bit of `zone` is always 1, and so -/// are all the other preceding bits of a larger integer. The easiest way to -/// grow the `zone` for the larger type is to simply sign extend it. -/// -/// An alternative to using a modulus is widening multiply: After a widening -/// multiply by `range`, the result is in the high word. Then comparing the low -/// word against `zone` makes sure our distribution is uniform. -/// -/// [`UniformSampler`]: trait.UniformSampler.html -/// [`Uniform`]: struct.Uniform.html -#[derive(Clone, Copy, Debug)] -pub struct UniformInt { - low: X, - range: X, - zone: X, -} - -macro_rules! uniform_int_impl { - ($ty:ty, $signed:ty, $unsigned:ident, - $i_large:ident, $u_large:ident) => { - impl SampleUniform for $ty { - type Sampler = UniformInt<$ty>; - } - - impl UniformSampler for UniformInt<$ty> { - // We play free and fast with unsigned vs signed here - // (when $ty is signed), but that's fine, since the - // contract of this macro is for $ty and $unsigned to be - // "bit-equal", so casting between them is a no-op. - - type X = $ty; - - #[inline] // if the range is constant, this helps LLVM to do the - // calculations at compile-time. - fn new(low: Self::X, high: Self::X) -> Self { - assert!(low < high, "Uniform::new called with `low >= high`"); - UniformSampler::new_inclusive(low, high - 1) - } - - #[inline] // if the range is constant, this helps LLVM to do the - // calculations at compile-time. - fn new_inclusive(low: Self::X, high: Self::X) -> Self { - assert!(low <= high, - "Uniform::new_inclusive called with `low > high`"); - let unsigned_max = ::core::$unsigned::MAX; - - let range = high.wrapping_sub(low).wrapping_add(1) as $unsigned; - let ints_to_reject = - if range > 0 { - (unsigned_max - range + 1) % range - } else { - 0 - }; - let zone = unsigned_max - ints_to_reject; - - UniformInt { - low: low, - // These are really $unsigned values, but store as $ty: - range: range as $ty, - zone: zone as $ty - } - } - - fn sample(&self, rng: &mut R) -> Self::X { - let range = self.range as $unsigned as $u_large; - if range > 0 { - // Grow `zone` to fit a type of at least 32 bits, by - // sign-extending it (the first bit is always 1, so are all - // the preceding bits of the larger type). - // For types that already have the right size, all the - // casting is a no-op. - let zone = self.zone as $signed as $i_large as $u_large; - loop { - let v: $u_large = rng.gen(); - let (hi, lo) = v.wmul(range); - if lo <= zone { - return self.low.wrapping_add(hi as $ty); - } - } - } else { - // Sample from the entire integer range. - rng.gen() - } - } - - fn sample_single(low: Self::X, - high: Self::X, - rng: &mut R) -> Self::X - { - assert!(low < high, - "Uniform::sample_single called with low >= high"); - let range = high.wrapping_sub(low) as $unsigned as $u_large; - let zone = - if ::core::$unsigned::MAX <= ::core::u16::MAX as $unsigned { - // Using a modulus is faster than the approximation for - // i8 and i16. I suppose we trade the cost of one - // modulus for near-perfect branch prediction. - let unsigned_max: $u_large = ::core::$u_large::MAX; - let ints_to_reject = (unsigned_max - range + 1) % range; - unsigned_max - ints_to_reject - } else { - // conservative but fast approximation - range << range.leading_zeros() - }; - - loop { - let v: $u_large = rng.gen(); - let (hi, lo) = v.wmul(range); - if lo <= zone { - return low.wrapping_add(hi as $ty); - } - } - } - } - } -} - -uniform_int_impl! { i8, i8, u8, i32, u32 } -uniform_int_impl! { i16, i16, u16, i32, u32 } -uniform_int_impl! { i32, i32, u32, i32, u32 } -uniform_int_impl! { i64, i64, u64, i64, u64 } -#[cfg(feature = "i128_support")] -uniform_int_impl! { i128, i128, u128, u128, u128 } -uniform_int_impl! { isize, isize, usize, isize, usize } -uniform_int_impl! { u8, i8, u8, i32, u32 } -uniform_int_impl! { u16, i16, u16, i32, u32 } -uniform_int_impl! { u32, i32, u32, i32, u32 } -uniform_int_impl! { u64, i64, u64, i64, u64 } -uniform_int_impl! { usize, isize, usize, isize, usize } -#[cfg(feature = "i128_support")] -uniform_int_impl! { u128, u128, u128, i128, u128 } - - -trait WideningMultiply { - type Output; - - fn wmul(self, x: RHS) -> Self::Output; -} - -macro_rules! wmul_impl { - ($ty:ty, $wide:ty, $shift:expr) => { - impl WideningMultiply for $ty { - type Output = ($ty, $ty); - - #[inline(always)] - fn wmul(self, x: $ty) -> Self::Output { - let tmp = (self as $wide) * (x as $wide); - ((tmp >> $shift) as $ty, tmp as $ty) - } - } - } -} -wmul_impl! { u8, u16, 8 } -wmul_impl! { u16, u32, 16 } -wmul_impl! { u32, u64, 32 } -#[cfg(feature = "i128_support")] -wmul_impl! { u64, u128, 64 } - -// This code is a translation of the __mulddi3 function in LLVM's -// compiler-rt. It is an optimised variant of the common method -// `(a + b) * (c + d) = ac + ad + bc + bd`. -// -// For some reason LLVM can optimise the C version very well, but -// keeps shuffeling registers in this Rust translation. -macro_rules! wmul_impl_large { - ($ty:ty, $half:expr) => { - impl WideningMultiply for $ty { - type Output = ($ty, $ty); - - #[inline(always)] - fn wmul(self, b: $ty) -> Self::Output { - const LOWER_MASK: $ty = !0 >> $half; - let mut low = (self & LOWER_MASK).wrapping_mul(b & LOWER_MASK); - let mut t = low >> $half; - low &= LOWER_MASK; - t += (self >> $half).wrapping_mul(b & LOWER_MASK); - low += (t & LOWER_MASK) << $half; - let mut high = t >> $half; - t = low >> $half; - low &= LOWER_MASK; - t += (b >> $half).wrapping_mul(self & LOWER_MASK); - low += (t & LOWER_MASK) << $half; - high += t >> $half; - high += (self >> $half).wrapping_mul(b >> $half); - - (high, low) - } - } - } -} -#[cfg(not(feature = "i128_support"))] -wmul_impl_large! { u64, 32 } -#[cfg(feature = "i128_support")] -wmul_impl_large! { u128, 64 } - -macro_rules! wmul_impl_usize { - ($ty:ty) => { - impl WideningMultiply for usize { - type Output = (usize, usize); - - #[inline(always)] - fn wmul(self, x: usize) -> Self::Output { - let (high, low) = (self as $ty).wmul(x as $ty); - (high as usize, low as usize) - } - } - } -} -#[cfg(target_pointer_width = "32")] -wmul_impl_usize! { u32 } -#[cfg(target_pointer_width = "64")] -wmul_impl_usize! { u64 } - - - -/// The back-end implementing [`UniformSampler`] for floating-point types. -/// -/// Unless you are implementing [`UniformSampler`] for your own type, this type -/// should not be used directly, use [`Uniform`] instead. -/// -/// # Implementation notes -/// -/// Instead of generating a float in the `[0, 1)` range using [`Standard`], the -/// `UniformFloat` implementation converts the output of an PRNG itself. This -/// way one or two steps can be optimized out. -/// -/// The floats are first converted to a value in the `[1, 2)` interval using a -/// transmute-based method, and then mapped to the expected range with a -/// multiply and addition. Values produced this way have what equals 22 bits of -/// random digits for an `f32`, and 52 for an `f64`. -/// -/// Currently there is no difference between [`new`] and [`new_inclusive`], -/// because the boundaries of a floats range are a bit of a fuzzy concept due to -/// rounding errors. -/// -/// [`UniformSampler`]: trait.UniformSampler.html -/// [`new`]: trait.UniformSampler.html#tymethod.new -/// [`new_inclusive`]: trait.UniformSampler.html#tymethod.new_inclusive -/// [`Uniform`]: struct.Uniform.html -/// [`Standard`]: ../struct.Standard.html -#[derive(Clone, Copy, Debug)] -pub struct UniformFloat { - scale: X, - offset: X, -} - -macro_rules! uniform_float_impl { - ($ty:ty, $bits_to_discard:expr, $next_u:ident) => { - impl SampleUniform for $ty { - type Sampler = UniformFloat<$ty>; - } - - impl UniformSampler for UniformFloat<$ty> { - type X = $ty; - - fn new(low: Self::X, high: Self::X) -> Self { - assert!(low < high, "Uniform::new called with `low >= high`"); - let scale = high - low; - let offset = low - scale; - UniformFloat { - scale: scale, - offset: offset, - } - } - - fn new_inclusive(low: Self::X, high: Self::X) -> Self { - assert!(low <= high, - "Uniform::new_inclusive called with `low > high`"); - let scale = high - low; - let offset = low - scale; - UniformFloat { - scale: scale, - offset: offset, - } - } - - fn sample(&self, rng: &mut R) -> Self::X { - // Generate a value in the range [1, 2) - let value1_2 = (rng.$next_u() >> $bits_to_discard) - .into_float_with_exponent(0); - // We don't use `f64::mul_add`, because it is not available with - // `no_std`. Furthermore, it is slower for some targets (but - // faster for others). However, the order of multiplication and - // addition is important, because on some platforms (e.g. ARM) - // it will be optimized to a single (non-FMA) instruction. - value1_2 * self.scale + self.offset - } - - fn sample_single(low: Self::X, - high: Self::X, - rng: &mut R) -> Self::X { - assert!(low < high, - "Uniform::sample_single called with low >= high"); - let scale = high - low; - let offset = low - scale; - // Generate a value in the range [1, 2) - let value1_2 = (rng.$next_u() >> $bits_to_discard) - .into_float_with_exponent(0); - // Doing multiply before addition allows some architectures to - // use a single instruction. - value1_2 * scale + offset - } - } - } -} - -uniform_float_impl! { f32, 32 - 23, next_u32 } -uniform_float_impl! { f64, 64 - 52, next_u64 } - - - -/// The back-end implementing [`UniformSampler`] for `Duration`. -/// -/// Unless you are implementing [`UniformSampler`] for your own types, this type -/// should not be used directly, use [`Uniform`] instead. -/// -/// [`UniformSampler`]: trait.UniformSampler.html -/// [`Uniform`]: struct.Uniform.html -#[cfg(feature = "std")] -#[derive(Clone, Copy, Debug)] -pub struct UniformDuration { - offset: Duration, - mode: UniformDurationMode, -} - -#[cfg(feature = "std")] -#[derive(Debug, Copy, Clone)] -enum UniformDurationMode { - Small { - nanos: Uniform, - }, - Large { - size: Duration, - secs: Uniform, - } -} - -#[cfg(feature = "std")] -impl SampleUniform for Duration { - type Sampler = UniformDuration; -} - -#[cfg(feature = "std")] -impl UniformSampler for UniformDuration { - type X = Duration; - - #[inline] - fn new(low: Duration, high: Duration) -> UniformDuration { - assert!(low < high, "Uniform::new called with `low >= high`"); - UniformDuration::new_inclusive(low, high - Duration::new(0, 1)) - } - - #[inline] - fn new_inclusive(low: Duration, high: Duration) -> UniformDuration { - assert!(low <= high, "Uniform::new_inclusive called with `low > high`"); - let size = high - low; - let nanos = size - .as_secs() - .checked_mul(1_000_000_000) - .and_then(|n| n.checked_add(size.subsec_nanos() as u64)); - - let mode = match nanos { - Some(nanos) => { - UniformDurationMode::Small { - nanos: Uniform::new_inclusive(0, nanos), - } - } - None => { - UniformDurationMode::Large { - size: size, - secs: Uniform::new_inclusive(0, size.as_secs()), - } - } - }; - - UniformDuration { - mode, - offset: low, - } - } - - #[inline] - fn sample(&self, rng: &mut R) -> Duration { - let d = match self.mode { - UniformDurationMode::Small { nanos } => { - let nanos = nanos.sample(rng); - Duration::new(nanos / 1_000_000_000, (nanos % 1_000_000_000) as u32) - } - UniformDurationMode::Large { size, secs } => { - // constant folding means this is at least as fast as `gen_range` - let nano_range = Uniform::new(0, 1_000_000_000); - loop { - let d = Duration::new(secs.sample(rng), nano_range.sample(rng)); - if d <= size { - break d; - } - } - } - }; - - self.offset + d - } -} - -#[cfg(test)] -mod tests { - use Rng; - use distributions::uniform::{Uniform, UniformSampler, UniformFloat, SampleUniform}; - - #[should_panic] - #[test] - fn test_uniform_bad_limits_equal_int() { - Uniform::new(10, 10); - } - - #[should_panic] - #[test] - fn test_uniform_bad_limits_equal_float() { - Uniform::new(10., 10.); - } - - #[test] - fn test_uniform_good_limits_equal_int() { - let mut rng = ::test::rng(804); - let dist = Uniform::new_inclusive(10, 10); - for _ in 0..20 { - assert_eq!(rng.sample(dist), 10); - } - } - - #[test] - fn test_uniform_good_limits_equal_float() { - let mut rng = ::test::rng(805); - let dist = Uniform::new_inclusive(10., 10.); - for _ in 0..20 { - assert_eq!(rng.sample(dist), 10.); - } - } - - #[should_panic] - #[test] - fn test_uniform_bad_limits_flipped_int() { - Uniform::new(10, 5); - } - - #[should_panic] - #[test] - fn test_uniform_bad_limits_flipped_float() { - Uniform::new(10., 5.); - } - - #[test] - fn test_integers() { - let mut rng = ::test::rng(251); - macro_rules! t { - ($($ty:ident),*) => {{ - $( - let v: &[($ty, $ty)] = &[(0, 10), - (10, 127), - (::core::$ty::MIN, ::core::$ty::MAX)]; - for &(low, high) in v.iter() { - let my_uniform = Uniform::new(low, high); - for _ in 0..1000 { - let v: $ty = rng.sample(my_uniform); - assert!(low <= v && v < high); - } - - let my_uniform = Uniform::new_inclusive(low, high); - for _ in 0..1000 { - let v: $ty = rng.sample(my_uniform); - assert!(low <= v && v <= high); - } - - for _ in 0..1000 { - let v: $ty = rng.gen_range(low, high); - assert!(low <= v && v < high); - } - } - )* - }} - } - t!(i8, i16, i32, i64, isize, - u8, u16, u32, u64, usize); - #[cfg(feature = "i128_support")] - t!(i128, u128) - } - - #[test] - fn test_floats() { - let mut rng = ::test::rng(252); - macro_rules! t { - ($($ty:ty),*) => {{ - $( - let v: &[($ty, $ty)] = &[(0.0, 100.0), - (-1e35, -1e25), - (1e-35, 1e-25), - (-1e35, 1e35)]; - for &(low, high) in v.iter() { - let my_uniform = Uniform::new(low, high); - for _ in 0..1000 { - let v: $ty = rng.sample(my_uniform); - assert!(low <= v && v < high); - } - } - )* - }} - } - - t!(f32, f64) - } - - #[test] - #[cfg(feature = "std")] - fn test_durations() { - use std::time::Duration; - - let mut rng = ::test::rng(253); - - let v = &[(Duration::new(10, 50000), Duration::new(100, 1234)), - (Duration::new(0, 100), Duration::new(1, 50)), - (Duration::new(0, 0), Duration::new(u64::max_value(), 999_999_999))]; - for &(low, high) in v.iter() { - let my_uniform = Uniform::new(low, high); - for _ in 0..1000 { - let v = rng.sample(my_uniform); - assert!(low <= v && v < high); - } - } - } - - #[test] - fn test_custom_uniform() { - #[derive(Clone, Copy, PartialEq, PartialOrd)] - struct MyF32 { - x: f32, - } - #[derive(Clone, Copy, Debug)] - struct UniformMyF32 { - inner: UniformFloat, - } - impl UniformSampler for UniformMyF32 { - type X = MyF32; - fn new(low: Self::X, high: Self::X) -> Self { - UniformMyF32 { - inner: UniformFloat::::new(low.x, high.x), - } - } - fn new_inclusive(low: Self::X, high: Self::X) -> Self { - UniformSampler::new(low, high) - } - fn sample(&self, rng: &mut R) -> Self::X { - MyF32 { x: self.inner.sample(rng) } - } - } - impl SampleUniform for MyF32 { - type Sampler = UniformMyF32; - } - - let (low, high) = (MyF32{ x: 17.0f32 }, MyF32{ x: 22.0f32 }); - let uniform = Uniform::new(low, high); - let mut rng = ::test::rng(804); - for _ in 0..100 { - let x: MyF32 = rng.sample(uniform); - assert!(low <= x && x < high); - } - } - - #[test] - fn test_uniform_from_std_range() { - let r = Uniform::from(2u32..7); - assert_eq!(r.inner.low, 2); - assert_eq!(r.inner.range, 5); - let r = Uniform::from(2.0f64..7.0); - assert_eq!(r.inner.offset, -3.0); - assert_eq!(r.inner.scale, 5.0); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/distributions/ziggurat_tables.rs cargo-0.37.0/vendor/rand-0.5.6/src/distributions/ziggurat_tables.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/distributions/ziggurat_tables.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/distributions/ziggurat_tables.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,280 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Tables for distributions which are sampled using the ziggurat -// algorithm. Autogenerated by `ziggurat_tables.py`. - -pub type ZigTable = &'static [f64; 257]; -pub const ZIG_NORM_R: f64 = 3.654152885361008796; -pub static ZIG_NORM_X: [f64; 257] = - [3.910757959537090045, 3.654152885361008796, 3.449278298560964462, 3.320244733839166074, - 3.224575052047029100, 3.147889289517149969, 3.083526132001233044, 3.027837791768635434, - 2.978603279880844834, 2.934366867207854224, 2.894121053612348060, 2.857138730872132548, - 2.822877396825325125, 2.790921174000785765, 2.760944005278822555, 2.732685359042827056, - 2.705933656121858100, 2.680514643284522158, 2.656283037575502437, 2.633116393630324570, - 2.610910518487548515, 2.589575986706995181, 2.569035452680536569, 2.549221550323460761, - 2.530075232158516929, 2.511544441625342294, 2.493583041269680667, 2.476149939669143318, - 2.459208374333311298, 2.442725318198956774, 2.426670984935725972, 2.411018413899685520, - 2.395743119780480601, 2.380822795170626005, 2.366237056715818632, 2.351967227377659952, - 2.337996148795031370, 2.324308018869623016, 2.310888250599850036, 2.297723348901329565, - 2.284800802722946056, 2.272108990226823888, 2.259637095172217780, 2.247375032945807760, - 2.235313384928327984, 2.223443340090905718, 2.211756642882544366, 2.200245546609647995, - 2.188902771624720689, 2.177721467738641614, 2.166695180352645966, 2.155817819875063268, - 2.145083634046203613, 2.134487182844320152, 2.124023315687815661, 2.113687150684933957, - 2.103474055713146829, 2.093379631137050279, 2.083399693996551783, 2.073530263516978778, - 2.063767547809956415, 2.054107931648864849, 2.044547965215732788, 2.035084353727808715, - 2.025713947862032960, 2.016433734904371722, 2.007240830558684852, 1.998132471356564244, - 1.989106007615571325, 1.980158896898598364, 1.971288697931769640, 1.962493064942461896, - 1.953769742382734043, 1.945116560006753925, 1.936531428273758904, 1.928012334050718257, - 1.919557336591228847, 1.911164563769282232, 1.902832208548446369, 1.894558525668710081, - 1.886341828534776388, 1.878180486290977669, 1.870072921069236838, 1.862017605397632281, - 1.854013059758148119, 1.846057850283119750, 1.838150586580728607, 1.830289919680666566, - 1.822474540091783224, 1.814703175964167636, 1.806974591348693426, 1.799287584547580199, - 1.791640986550010028, 1.784033659547276329, 1.776464495522344977, 1.768932414909077933, - 1.761436365316706665, 1.753975320315455111, 1.746548278279492994, 1.739154261283669012, - 1.731792314050707216, 1.724461502945775715, 1.717160915015540690, 1.709889657069006086, - 1.702646854797613907, 1.695431651932238548, 1.688243209434858727, 1.681080704722823338, - 1.673943330923760353, 1.666830296159286684, 1.659740822855789499, 1.652674147080648526, - 1.645629517902360339, 1.638606196773111146, 1.631603456932422036, 1.624620582830568427, - 1.617656869570534228, 1.610711622367333673, 1.603784156023583041, 1.596873794420261339, - 1.589979870021648534, 1.583101723393471438, 1.576238702733332886, 1.569390163412534456, - 1.562555467528439657, 1.555733983466554893, 1.548925085471535512, 1.542128153226347553, - 1.535342571438843118, 1.528567729435024614, 1.521803020758293101, 1.515047842773992404, - 1.508301596278571965, 1.501563685112706548, 1.494833515777718391, 1.488110497054654369, - 1.481394039625375747, 1.474683555695025516, 1.467978458615230908, 1.461278162507407830, - 1.454582081885523293, 1.447889631277669675, 1.441200224845798017, 1.434513276002946425, - 1.427828197027290358, 1.421144398672323117, 1.414461289772464658, 1.407778276843371534, - 1.401094763676202559, 1.394410150925071257, 1.387723835686884621, 1.381035211072741964, - 1.374343665770030531, 1.367648583594317957, 1.360949343030101844, 1.354245316759430606, - 1.347535871177359290, 1.340820365893152122, 1.334098153216083604, 1.327368577624624679, - 1.320630975217730096, 1.313884673146868964, 1.307128989027353860, 1.300363230327433728, - 1.293586693733517645, 1.286798664489786415, 1.279998415710333237, 1.273185207661843732, - 1.266358287014688333, 1.259516886060144225, 1.252660221891297887, 1.245787495544997903, - 1.238897891102027415, 1.231990574742445110, 1.225064693752808020, 1.218119375481726552, - 1.211153726239911244, 1.204166830140560140, 1.197157747875585931, 1.190125515422801650, - 1.183069142678760732, 1.175987612011489825, 1.168879876726833800, 1.161744859441574240, - 1.154581450355851802, 1.147388505416733873, 1.140164844363995789, 1.132909248648336975, - 1.125620459211294389, 1.118297174115062909, 1.110938046009249502, 1.103541679420268151, - 1.096106627847603487, 1.088631390649514197, 1.081114409698889389, 1.073554065787871714, - 1.065948674757506653, 1.058296483326006454, 1.050595664586207123, 1.042844313139370538, - 1.035040439828605274, 1.027181966030751292, 1.019266717460529215, 1.011292417434978441, - 1.003256679539591412, 0.995156999629943084, 0.986990747093846266, 0.978755155288937750, - 0.970447311058864615, 0.962064143217605250, 0.953602409875572654, 0.945058684462571130, - 0.936429340280896860, 0.927710533396234771, 0.918898183643734989, 0.909987953490768997, - 0.900975224455174528, 0.891855070726792376, 0.882622229578910122, 0.873271068082494550, - 0.863795545546826915, 0.854189171001560554, 0.844444954902423661, 0.834555354079518752, - 0.824512208745288633, 0.814306670128064347, 0.803929116982664893, 0.793369058833152785, - 0.782615023299588763, 0.771654424216739354, 0.760473406422083165, 0.749056662009581653, - 0.737387211425838629, 0.725446140901303549, 0.713212285182022732, 0.700661841097584448, - 0.687767892786257717, 0.674499822827436479, 0.660822574234205984, 0.646695714884388928, - 0.632072236375024632, 0.616896989996235545, 0.601104617743940417, 0.584616766093722262, - 0.567338257040473026, 0.549151702313026790, 0.529909720646495108, 0.509423329585933393, - 0.487443966121754335, 0.463634336771763245, 0.437518402186662658, 0.408389134588000746, - 0.375121332850465727, 0.335737519180459465, 0.286174591747260509, 0.215241895913273806, - 0.000000000000000000]; -pub static ZIG_NORM_F: [f64; 257] = - [0.000477467764586655, 0.001260285930498598, 0.002609072746106363, 0.004037972593371872, - 0.005522403299264754, 0.007050875471392110, 0.008616582769422917, 0.010214971439731100, - 0.011842757857943104, 0.013497450601780807, 0.015177088307982072, 0.016880083152595839, - 0.018605121275783350, 0.020351096230109354, 0.022117062707379922, 0.023902203305873237, - 0.025705804008632656, 0.027527235669693315, 0.029365939758230111, 0.031221417192023690, - 0.033093219458688698, 0.034980941461833073, 0.036884215688691151, 0.038802707404656918, - 0.040736110656078753, 0.042684144916619378, 0.044646552251446536, 0.046623094902089664, - 0.048613553216035145, 0.050617723861121788, 0.052635418276973649, 0.054666461325077916, - 0.056710690106399467, 0.058767952921137984, 0.060838108349751806, 0.062921024437977854, - 0.065016577971470438, 0.067124653828023989, 0.069245144397250269, 0.071377949059141965, - 0.073522973714240991, 0.075680130359194964, 0.077849336702372207, 0.080030515814947509, - 0.082223595813495684, 0.084428509570654661, 0.086645194450867782, 0.088873592068594229, - 0.091113648066700734, 0.093365311913026619, 0.095628536713353335, 0.097903279039215627, - 0.100189498769172020, 0.102487158942306270, 0.104796225622867056, 0.107116667775072880, - 0.109448457147210021, 0.111791568164245583, 0.114145977828255210, 0.116511665626037014, - 0.118888613443345698, 0.121276805485235437, 0.123676228202051403, 0.126086870220650349, - 0.128508722280473636, 0.130941777174128166, 0.133386029692162844, 0.135841476571757352, - 0.138308116449064322, 0.140785949814968309, 0.143274978974047118, 0.145775208006537926, - 0.148286642733128721, 0.150809290682410169, 0.153343161060837674, 0.155888264725064563, - 0.158444614156520225, 0.161012223438117663, 0.163591108232982951, 0.166181285765110071, - 0.168782774801850333, 0.171395595638155623, 0.174019770082499359, 0.176655321444406654, - 0.179302274523530397, 0.181960655600216487, 0.184630492427504539, 0.187311814224516926, - 0.190004651671193070, 0.192709036904328807, 0.195425003514885592, 0.198152586546538112, - 0.200891822495431333, 0.203642749311121501, 0.206405406398679298, 0.209179834621935651, - 0.211966076307852941, 0.214764175252008499, 0.217574176725178370, 0.220396127481011589, - 0.223230075764789593, 0.226076071323264877, 0.228934165415577484, 0.231804410825248525, - 0.234686861873252689, 0.237581574432173676, 0.240488605941449107, 0.243408015423711988, - 0.246339863502238771, 0.249284212419516704, 0.252241126056943765, 0.255210669955677150, - 0.258192911338648023, 0.261187919133763713, 0.264195763998317568, 0.267216518344631837, - 0.270250256366959984, 0.273297054069675804, 0.276356989296781264, 0.279430141762765316, - 0.282516593084849388, 0.285616426816658109, 0.288729728483353931, 0.291856585618280984, - 0.294997087801162572, 0.298151326697901342, 0.301319396102034120, 0.304501391977896274, - 0.307697412505553769, 0.310907558127563710, 0.314131931597630143, 0.317370638031222396, - 0.320623784958230129, 0.323891482377732021, 0.327173842814958593, 0.330470981380537099, - 0.333783015832108509, 0.337110066638412809, 0.340452257045945450, 0.343809713148291340, - 0.347182563958251478, 0.350570941482881204, 0.353974980801569250, 0.357394820147290515, - 0.360830600991175754, 0.364282468130549597, 0.367750569780596226, 0.371235057669821344, - 0.374736087139491414, 0.378253817247238111, 0.381788410875031348, 0.385340034841733958, - 0.388908860020464597, 0.392495061461010764, 0.396098818517547080, 0.399720314981931668, - 0.403359739222868885, 0.407017284331247953, 0.410693148271983222, 0.414387534042706784, - 0.418100649839684591, 0.421832709231353298, 0.425583931339900579, 0.429354541031341519, - 0.433144769114574058, 0.436954852549929273, 0.440785034667769915, 0.444635565397727750, - 0.448506701509214067, 0.452398706863882505, 0.456311852680773566, 0.460246417814923481, - 0.464202689050278838, 0.468180961407822172, 0.472181538469883255, 0.476204732721683788, - 0.480250865911249714, 0.484320269428911598, 0.488413284707712059, 0.492530263646148658, - 0.496671569054796314, 0.500837575128482149, 0.505028667945828791, 0.509245245998136142, - 0.513487720749743026, 0.517756517232200619, 0.522052074674794864, 0.526374847174186700, - 0.530725304406193921, 0.535103932383019565, 0.539511234259544614, 0.543947731192649941, - 0.548413963257921133, 0.552910490428519918, 0.557437893621486324, 0.561996775817277916, - 0.566587763258951771, 0.571211506738074970, 0.575868682975210544, 0.580559996103683473, - 0.585286179266300333, 0.590047996335791969, 0.594846243770991268, 0.599681752622167719, - 0.604555390700549533, 0.609468064928895381, 0.614420723892076803, 0.619414360609039205, - 0.624450015550274240, 0.629528779928128279, 0.634651799290960050, 0.639820277456438991, - 0.645035480824251883, 0.650298743114294586, 0.655611470583224665, 0.660975147780241357, - 0.666391343912380640, 0.671861719900766374, 0.677388036222513090, 0.682972161648791376, - 0.688616083008527058, 0.694321916130032579, 0.700091918140490099, 0.705928501336797409, - 0.711834248882358467, 0.717811932634901395, 0.723864533472881599, 0.729995264565802437, - 0.736207598131266683, 0.742505296344636245, 0.748892447223726720, 0.755373506511754500, - 0.761953346841546475, 0.768637315803334831, 0.775431304986138326, 0.782341832659861902, - 0.789376143571198563, 0.796542330428254619, 0.803849483176389490, 0.811307874318219935, - 0.818929191609414797, 0.826726833952094231, 0.834716292992930375, 0.842915653118441077, - 0.851346258465123684, 0.860033621203008636, 0.869008688043793165, 0.878309655816146839, - 0.887984660763399880, 0.898095921906304051, 0.908726440060562912, 0.919991505048360247, - 0.932060075968990209, 0.945198953453078028, 0.959879091812415930, 0.977101701282731328, - 1.000000000000000000]; -pub const ZIG_EXP_R: f64 = 7.697117470131050077; -pub static ZIG_EXP_X: [f64; 257] = - [8.697117470131052741, 7.697117470131050077, 6.941033629377212577, 6.478378493832569696, - 6.144164665772472667, 5.882144315795399869, 5.666410167454033697, 5.482890627526062488, - 5.323090505754398016, 5.181487281301500047, 5.054288489981304089, 4.938777085901250530, - 4.832939741025112035, 4.735242996601741083, 4.644491885420085175, 4.559737061707351380, - 4.480211746528421912, 4.405287693473573185, 4.334443680317273007, 4.267242480277365857, - 4.203313713735184365, 4.142340865664051464, 4.084051310408297830, 4.028208544647936762, - 3.974606066673788796, 3.923062500135489739, 3.873417670399509127, 3.825529418522336744, - 3.779270992411667862, 3.734528894039797375, 3.691201090237418825, 3.649195515760853770, - 3.608428813128909507, 3.568825265648337020, 3.530315889129343354, 3.492837654774059608, - 3.456332821132760191, 3.420748357251119920, 3.386035442460300970, 3.352149030900109405, - 3.319047470970748037, 3.286692171599068679, 3.255047308570449882, 3.224079565286264160, - 3.193757903212240290, 3.164053358025972873, 3.134938858084440394, 3.106389062339824481, - 3.078380215254090224, 3.050890016615455114, 3.023897504455676621, 2.997382949516130601, - 2.971327759921089662, 2.945714394895045718, 2.920526286512740821, 2.895747768600141825, - 2.871364012015536371, 2.847360965635188812, 2.823725302450035279, 2.800444370250737780, - 2.777506146439756574, 2.754899196562344610, 2.732612636194700073, 2.710636095867928752, - 2.688959688741803689, 2.667573980773266573, 2.646469963151809157, 2.625639026797788489, - 2.605072938740835564, 2.584763820214140750, 2.564704126316905253, 2.544886627111869970, - 2.525304390037828028, 2.505950763528594027, 2.486819361740209455, 2.467904050297364815, - 2.449198932978249754, 2.430698339264419694, 2.412396812688870629, 2.394289099921457886, - 2.376370140536140596, 2.358635057409337321, 2.341079147703034380, 2.323697874390196372, - 2.306486858283579799, 2.289441870532269441, 2.272558825553154804, 2.255833774367219213, - 2.239262898312909034, 2.222842503111036816, 2.206569013257663858, 2.190438966723220027, - 2.174449009937774679, 2.158595893043885994, 2.142876465399842001, 2.127287671317368289, - 2.111826546019042183, 2.096490211801715020, 2.081275874393225145, 2.066180819490575526, - 2.051202409468584786, 2.036338080248769611, 2.021585338318926173, 2.006941757894518563, - 1.992404978213576650, 1.977972700957360441, 1.963642687789548313, 1.949412758007184943, - 1.935280786297051359, 1.921244700591528076, 1.907302480018387536, 1.893452152939308242, - 1.879691795072211180, 1.866019527692827973, 1.852433515911175554, 1.838931967018879954, - 1.825513128903519799, 1.812175288526390649, 1.798916770460290859, 1.785735935484126014, - 1.772631179231305643, 1.759600930889074766, 1.746643651946074405, 1.733757834985571566, - 1.720942002521935299, 1.708194705878057773, 1.695514524101537912, 1.682900062917553896, - 1.670349953716452118, 1.657862852574172763, 1.645437439303723659, 1.633072416535991334, - 1.620766508828257901, 1.608518461798858379, 1.596327041286483395, 1.584191032532688892, - 1.572109239386229707, 1.560080483527888084, 1.548103603714513499, 1.536177455041032092, - 1.524300908219226258, 1.512472848872117082, 1.500692176842816750, 1.488957805516746058, - 1.477268661156133867, 1.465623682245745352, 1.454021818848793446, 1.442462031972012504, - 1.430943292938879674, 1.419464582769983219, 1.408024891569535697, 1.396623217917042137, - 1.385258568263121992, 1.373929956328490576, 1.362636402505086775, 1.351376933258335189, - 1.340150580529504643, 1.328956381137116560, 1.317793376176324749, 1.306660610415174117, - 1.295557131686601027, 1.284481990275012642, 1.273434238296241139, 1.262412929069615330, - 1.251417116480852521, 1.240445854334406572, 1.229498195693849105, 1.218573192208790124, - 1.207669893426761121, 1.196787346088403092, 1.185924593404202199, 1.175080674310911677, - 1.164254622705678921, 1.153445466655774743, 1.142652227581672841, 1.131873919411078511, - 1.121109547701330200, 1.110358108727411031, 1.099618588532597308, 1.088889961938546813, - 1.078171191511372307, 1.067461226479967662, 1.056759001602551429, 1.046063435977044209, - 1.035373431790528542, 1.024687873002617211, 1.014005623957096480, 1.003325527915696735, - 0.992646405507275897, 0.981967053085062602, 0.971286240983903260, 0.960602711668666509, - 0.949915177764075969, 0.939222319955262286, 0.928522784747210395, 0.917815182070044311, - 0.907098082715690257, 0.896370015589889935, 0.885629464761751528, 0.874874866291025066, - 0.864104604811004484, 0.853317009842373353, 0.842510351810368485, 0.831682837734273206, - 0.820832606554411814, 0.809957724057418282, 0.799056177355487174, 0.788125868869492430, - 0.777164609759129710, 0.766170112735434672, 0.755139984181982249, 0.744071715500508102, - 0.732962673584365398, 0.721810090308756203, 0.710611050909655040, 0.699362481103231959, - 0.688061132773747808, 0.676703568029522584, 0.665286141392677943, 0.653804979847664947, - 0.642255960424536365, 0.630634684933490286, 0.618936451394876075, 0.607156221620300030, - 0.595288584291502887, 0.583327712748769489, 0.571267316532588332, 0.559100585511540626, - 0.546820125163310577, 0.534417881237165604, 0.521885051592135052, 0.509211982443654398, - 0.496388045518671162, 0.483401491653461857, 0.470239275082169006, 0.456886840931420235, - 0.443327866073552401, 0.429543940225410703, 0.415514169600356364, 0.401214678896277765, - 0.386617977941119573, 0.371692145329917234, 0.356399760258393816, 0.340696481064849122, - 0.324529117016909452, 0.307832954674932158, 0.290527955491230394, 0.272513185478464703, - 0.253658363385912022, 0.233790483059674731, 0.212671510630966620, 0.189958689622431842, - 0.165127622564187282, 0.137304980940012589, 0.104838507565818778, 0.063852163815001570, - 0.000000000000000000]; -pub static ZIG_EXP_F: [f64; 257] = - [0.000167066692307963, 0.000454134353841497, 0.000967269282327174, 0.001536299780301573, - 0.002145967743718907, 0.002788798793574076, 0.003460264777836904, 0.004157295120833797, - 0.004877655983542396, 0.005619642207205489, 0.006381905937319183, 0.007163353183634991, - 0.007963077438017043, 0.008780314985808977, 0.009614413642502212, 0.010464810181029981, - 0.011331013597834600, 0.012212592426255378, 0.013109164931254991, 0.014020391403181943, - 0.014945968011691148, 0.015885621839973156, 0.016839106826039941, 0.017806200410911355, - 0.018786700744696024, 0.019780424338009740, 0.020787204072578114, 0.021806887504283581, - 0.022839335406385240, 0.023884420511558174, 0.024942026419731787, 0.026012046645134221, - 0.027094383780955803, 0.028188948763978646, 0.029295660224637411, 0.030414443910466622, - 0.031545232172893622, 0.032687963508959555, 0.033842582150874358, 0.035009037697397431, - 0.036187284781931443, 0.037377282772959382, 0.038578995503074871, 0.039792391023374139, - 0.041017441380414840, 0.042254122413316254, 0.043502413568888197, 0.044762297732943289, - 0.046033761076175184, 0.047316792913181561, 0.048611385573379504, 0.049917534282706379, - 0.051235237055126281, 0.052564494593071685, 0.053905310196046080, 0.055257689676697030, - 0.056621641283742870, 0.057997175631200659, 0.059384305633420280, 0.060783046445479660, - 0.062193415408541036, 0.063615431999807376, 0.065049117786753805, 0.066494496385339816, - 0.067951593421936643, 0.069420436498728783, 0.070901055162371843, 0.072393480875708752, - 0.073897746992364746, 0.075413888734058410, 0.076941943170480517, 0.078481949201606435, - 0.080033947542319905, 0.081597980709237419, 0.083174093009632397, 0.084762330532368146, - 0.086362741140756927, 0.087975374467270231, 0.089600281910032886, 0.091237516631040197, - 0.092887133556043569, 0.094549189376055873, 0.096223742550432825, 0.097910853311492213, - 0.099610583670637132, 0.101322997425953631, 0.103048160171257702, 0.104786139306570145, - 0.106537004050001632, 0.108300825451033755, 0.110077676405185357, 0.111867631670056283, - 0.113670767882744286, 0.115487163578633506, 0.117316899211555525, 0.119160057175327641, - 0.121016721826674792, 0.122886979509545108, 0.124770918580830933, 0.126668629437510671, - 0.128580204545228199, 0.130505738468330773, 0.132445327901387494, 0.134399071702213602, - 0.136367070926428829, 0.138349428863580176, 0.140346251074862399, 0.142357645432472146, - 0.144383722160634720, 0.146424593878344889, 0.148480375643866735, 0.150551185001039839, - 0.152637142027442801, 0.154738369384468027, 0.156854992369365148, 0.158987138969314129, - 0.161134939917591952, 0.163298528751901734, 0.165478041874935922, 0.167673618617250081, - 0.169885401302527550, 0.172113535315319977, 0.174358169171353411, 0.176619454590494829, - 0.178897546572478278, 0.181192603475496261, 0.183504787097767436, 0.185834262762197083, - 0.188181199404254262, 0.190545769663195363, 0.192928149976771296, 0.195328520679563189, - 0.197747066105098818, 0.200183974691911210, 0.202639439093708962, 0.205113656293837654, - 0.207606827724221982, 0.210119159388988230, 0.212650861992978224, 0.215202151075378628, - 0.217773247148700472, 0.220364375843359439, 0.222975768058120111, 0.225607660116683956, - 0.228260293930716618, 0.230933917169627356, 0.233628783437433291, 0.236345152457059560, - 0.239083290262449094, 0.241843469398877131, 0.244625969131892024, 0.247431075665327543, - 0.250259082368862240, 0.253110290015629402, 0.255985007030415324, 0.258883549749016173, - 0.261806242689362922, 0.264753418835062149, 0.267725419932044739, 0.270722596799059967, - 0.273745309652802915, 0.276793928448517301, 0.279868833236972869, 0.282970414538780746, - 0.286099073737076826, 0.289255223489677693, 0.292439288161892630, 0.295651704281261252, - 0.298892921015581847, 0.302163400675693528, 0.305463619244590256, 0.308794066934560185, - 0.312155248774179606, 0.315547685227128949, 0.318971912844957239, 0.322428484956089223, - 0.325917972393556354, 0.329440964264136438, 0.332998068761809096, 0.336589914028677717, - 0.340217149066780189, 0.343880444704502575, 0.347580494621637148, 0.351318016437483449, - 0.355093752866787626, 0.358908472948750001, 0.362762973354817997, 0.366658079781514379, - 0.370594648435146223, 0.374573567615902381, 0.378595759409581067, 0.382662181496010056, - 0.386773829084137932, 0.390931736984797384, 0.395136981833290435, 0.399390684475231350, - 0.403694012530530555, 0.408048183152032673, 0.412454465997161457, 0.416914186433003209, - 0.421428728997616908, 0.425999541143034677, 0.430628137288459167, 0.435316103215636907, - 0.440065100842354173, 0.444876873414548846, 0.449753251162755330, 0.454696157474615836, - 0.459707615642138023, 0.464789756250426511, 0.469944825283960310, 0.475175193037377708, - 0.480483363930454543, 0.485871987341885248, 0.491343869594032867, 0.496901987241549881, - 0.502549501841348056, 0.508289776410643213, 0.514126393814748894, 0.520063177368233931, - 0.526104213983620062, 0.532253880263043655, 0.538516872002862246, 0.544898237672440056, - 0.551403416540641733, 0.558038282262587892, 0.564809192912400615, 0.571723048664826150, - 0.578787358602845359, 0.586010318477268366, 0.593400901691733762, 0.600968966365232560, - 0.608725382079622346, 0.616682180915207878, 0.624852738703666200, 0.633251994214366398, - 0.641896716427266423, 0.650805833414571433, 0.660000841079000145, 0.669506316731925177, - 0.679350572264765806, 0.689566496117078431, 0.700192655082788606, 0.711274760805076456, - 0.722867659593572465, 0.735038092431424039, 0.747868621985195658, 0.761463388849896838, - 0.775956852040116218, 0.791527636972496285, 0.808421651523009044, 0.826993296643051101, - 0.847785500623990496, 0.871704332381204705, 0.900469929925747703, 0.938143680862176477, - 1.000000000000000000]; diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/lib.rs cargo-0.37.0/vendor/rand-0.5.6/src/lib.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/lib.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,1238 +0,0 @@ -// Copyright 2013-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Utilities for random number generation -//! -//! Rand provides utilities to generate random numbers, to convert them to -//! useful types and distributions, and some randomness-related algorithms. -//! -//! # Basic usage -//! -//! To get you started quickly, the easiest and highest-level way to get -//! a random value is to use [`random()`]. -//! -//! ``` -//! let x: u8 = rand::random(); -//! println!("{}", x); -//! -//! let y = rand::random::(); -//! println!("{}", y); -//! -//! if rand::random() { // generates a boolean -//! println!("Heads!"); -//! } -//! ``` -//! -//! This supports generating most common types but is not very flexible, thus -//! you probably want to learn a bit more about the Rand library. -//! -//! -//! # The two-step process to get a random value -//! -//! Generating random values is typically a two-step process: -//! -//! - get some *random data* (an integer or bit/byte sequence) from a random -//! number generator (RNG); -//! - use some function to transform that *data* into the type of value you want -//! (this function is an implementation of some *distribution* describing the -//! kind of value produced). -//! -//! Rand represents the first step with the [`RngCore`] trait and the second -//! step via a combination of the [`Rng`] extension trait and the -//! [`distributions` module]. -//! In practice you probably won't use [`RngCore`] directly unless you are -//! implementing a random number generator (RNG). -//! -//! There are many kinds of RNGs, with different trade-offs. You can read more -//! about them in the [`rngs` module] and even more in the [`prng` module], -//! however, often you can just use [`thread_rng()`]. This function -//! automatically initializes an RNG in thread-local memory, then returns a -//! reference to it. It is fast, good quality, and secure (unpredictable). -//! -//! To turn the output of the RNG into something usable, you usually want to use -//! the methods from the [`Rng`] trait. Some of the most useful methods are: -//! -//! - [`gen`] generates a random value appropriate for the type (just like -//! [`random()`]). For integers this is normally the full representable range -//! (e.g. from `0u32` to `std::u32::MAX`), for floats this is between 0 and 1, -//! and some other types are supported, including arrays and tuples. See the -//! [`Standard`] distribution which provides the implementations. -//! - [`gen_range`] samples from a specific range of values; this is like -//! [`gen`] but with specific upper and lower bounds. -//! - [`sample`] samples directly from some distribution. -//! -//! [`random()`] is defined using just the above: `thread_rng().gen()`. -//! -//! ## Distributions -//! -//! What are distributions, you ask? Specifying only the type and range of -//! values (known as the *sample space*) is not enough; samples must also have -//! a *probability distribution*, describing the relative probability of -//! sampling each value in that space. -//! -//! In many cases a *uniform* distribution is used, meaning roughly that each -//! value is equally likely (or for "continuous" types like floats, that each -//! equal-sized sub-range has the same probability of containing a sample). -//! [`gen`] and [`gen_range`] both use statistically uniform distributions. -//! -//! The [`distributions` module] provides implementations -//! of some other distributions, including Normal, Log-Normal and Exponential. -//! -//! It is worth noting that the functionality already mentioned is implemented -//! with distributions: [`gen`] samples values using the [`Standard`] -//! distribution, while [`gen_range`] uses [`Uniform`]. -//! -//! ## Importing (prelude) -//! -//! The most convenient way to import items from Rand is to use the [prelude]. -//! This includes the most important parts of Rand, but only those unlikely to -//! cause name conflicts. -//! -//! Note that Rand 0.5 has significantly changed the module organization and -//! contents relative to previous versions. Where possible old names have been -//! kept (but are hidden in the documentation), however these will be removed -//! in the future. We therefore recommend migrating to use the prelude or the -//! new module organization in your imports. -//! -//! -//! ## Examples -//! -//! ``` -//! use rand::prelude::*; -//! -//! // thread_rng is often the most convenient source of randomness: -//! let mut rng = thread_rng(); -//! -//! if rng.gen() { // random bool -//! let x: f64 = rng.gen(); // random number in range [0, 1) -//! println!("x is: {}", x); -//! let ch = rng.gen::(); // using type annotation -//! println!("char is: {}", ch); -//! println!("Number from 0 to 9: {}", rng.gen_range(0, 10)); -//! } -//! ``` -//! -//! -//! # More functionality -//! -//! The [`Rng`] trait includes a few more methods not mentioned above: -//! -//! - [`Rng::sample_iter`] allows iterating over values from a chosen -//! distribution. -//! - [`Rng::gen_bool`] generates boolean "events" with a given probability. -//! - [`Rng::fill`] and [`Rng::try_fill`] are fast alternatives to fill a slice -//! of integers. -//! - [`Rng::shuffle`] randomly shuffles elements in a slice. -//! - [`Rng::choose`] picks one element at random from a slice. -//! -//! For more slice/sequence related functionality, look in the [`seq` module]. -//! -//! There is also [`distributions::WeightedChoice`], which can be used to pick -//! elements at random with some probability. But it does not work well at the -//! moment and is going through a redesign. -//! -//! -//! # Error handling -//! -//! Error handling in Rand is a compromise between simplicity and necessity. -//! Most RNGs and sampling functions will never produce errors, and making these -//! able to handle errors would add significant overhead (to code complexity -//! and ergonomics of usage at least, and potentially also performance, -//! depending on the approach). -//! However, external RNGs can fail, and being able to handle this is important. -//! -//! It has therefore been decided that *most* methods should not return a -//! `Result` type, with as exceptions [`Rng::try_fill`], -//! [`RngCore::try_fill_bytes`], and [`SeedableRng::from_rng`]. -//! -//! Note that it is the RNG that panics when it fails but is not used through a -//! method that can report errors. Currently Rand contains only three RNGs that -//! can return an error (and thus may panic), and documents this property: -//! [`OsRng`], [`EntropyRng`] and [`ReadRng`]. Other RNGs, like [`ThreadRng`] -//! and [`StdRng`], can be used with all methods without concern. -//! -//! One further problem is that if Rand is unable to get any external randomness -//! when initializing an RNG with [`EntropyRng`], it will panic in -//! [`FromEntropy::from_entropy`], and notably in [`thread_rng()`]. Except by -//! compromising security, this problem is as unsolvable as running out of -//! memory. -//! -//! -//! # Distinction between Rand and `rand_core` -//! -//! The [`rand_core`] crate provides the necessary traits and functionality for -//! implementing RNGs; this includes the [`RngCore`] and [`SeedableRng`] traits -//! and the [`Error`] type. -//! Crates implementing RNGs should depend on [`rand_core`]. -//! -//! Applications and libraries consuming random values are encouraged to use the -//! Rand crate, which re-exports the common parts of [`rand_core`]. -//! -//! -//! # More examples -//! -//! For some inspiration, see the examples: -//! -//! - [Monte Carlo estimation of π]( -//! https://github.com/rust-lang-nursery/rand/blob/master/examples/monte-carlo.rs) -//! - [Monty Hall Problem]( -//! https://github.com/rust-lang-nursery/rand/blob/master/examples/monty-hall.rs) -//! -//! -//! [`distributions` module]: distributions/index.html -//! [`distributions::WeightedChoice`]: distributions/struct.WeightedChoice.html -//! [`FromEntropy::from_entropy`]: trait.FromEntropy.html#tymethod.from_entropy -//! [`EntropyRng`]: rngs/struct.EntropyRng.html -//! [`Error`]: struct.Error.html -//! [`gen_range`]: trait.Rng.html#method.gen_range -//! [`gen`]: trait.Rng.html#method.gen -//! [`OsRng`]: rngs/struct.OsRng.html -//! [prelude]: prelude/index.html -//! [`rand_core`]: https://crates.io/crates/rand_core -//! [`random()`]: fn.random.html -//! [`ReadRng`]: rngs/adapter/struct.ReadRng.html -//! [`Rng::choose`]: trait.Rng.html#method.choose -//! [`Rng::fill`]: trait.Rng.html#method.fill -//! [`Rng::gen_bool`]: trait.Rng.html#method.gen_bool -//! [`Rng::gen`]: trait.Rng.html#method.gen -//! [`Rng::sample_iter`]: trait.Rng.html#method.sample_iter -//! [`Rng::shuffle`]: trait.Rng.html#method.shuffle -//! [`RngCore`]: trait.RngCore.html -//! [`RngCore::try_fill_bytes`]: trait.RngCore.html#method.try_fill_bytes -//! [`rngs` module]: rngs/index.html -//! [`prng` module]: prng/index.html -//! [`Rng`]: trait.Rng.html -//! [`Rng::try_fill`]: trait.Rng.html#method.try_fill -//! [`sample`]: trait.Rng.html#method.sample -//! [`SeedableRng`]: trait.SeedableRng.html -//! [`SeedableRng::from_rng`]: trait.SeedableRng.html#method.from_rng -//! [`seq` module]: seq/index.html -//! [`SmallRng`]: rngs/struct.SmallRng.html -//! [`StdRng`]: rngs/struct.StdRng.html -//! [`thread_rng()`]: fn.thread_rng.html -//! [`ThreadRng`]: rngs/struct.ThreadRng.html -//! [`Standard`]: distributions/struct.Standard.html -//! [`Uniform`]: distributions/struct.Uniform.html - - -#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png", - html_favicon_url = "https://www.rust-lang.org/favicon.ico", - html_root_url = "https://docs.rs/rand/0.5.6")] - -#![deny(missing_docs)] -#![deny(missing_debug_implementations)] -#![doc(test(attr(allow(unused_variables), deny(warnings))))] - -#![cfg_attr(not(feature="std"), no_std)] -#![cfg_attr(all(feature="alloc", not(feature="std")), feature(alloc))] -#![cfg_attr(all(feature="i128_support", feature="nightly"), allow(stable_features))] // stable since 2018-03-27 -#![cfg_attr(all(feature="i128_support", feature="nightly"), feature(i128_type, i128))] -#![cfg_attr(feature = "stdweb", recursion_limit="128")] - -#[cfg(feature="std")] extern crate std as core; -#[cfg(all(feature = "alloc", not(feature="std")))] extern crate alloc; - -#[cfg(test)] #[cfg(feature="serde1")] extern crate bincode; -#[cfg(feature="serde1")] extern crate serde; -#[cfg(feature="serde1")] #[macro_use] extern crate serde_derive; - -#[cfg(all(target_arch="wasm32", not(target_os="emscripten"), feature="stdweb"))] -#[macro_use] -extern crate stdweb; - -extern crate rand_core; - -#[cfg(feature = "log")] #[macro_use] extern crate log; -#[allow(unused)] -#[cfg(not(feature = "log"))] macro_rules! trace { ($($x:tt)*) => () } -#[allow(unused)] -#[cfg(not(feature = "log"))] macro_rules! debug { ($($x:tt)*) => () } -#[allow(unused)] -#[cfg(not(feature = "log"))] macro_rules! info { ($($x:tt)*) => () } -#[allow(unused)] -#[cfg(not(feature = "log"))] macro_rules! warn { ($($x:tt)*) => () } -#[allow(unused)] -#[cfg(not(feature = "log"))] macro_rules! error { ($($x:tt)*) => () } - - -// Re-exports from rand_core -pub use rand_core::{RngCore, CryptoRng, SeedableRng}; -pub use rand_core::{ErrorKind, Error}; - -// Public exports -#[cfg(feature="std")] pub use rngs::thread::thread_rng; - -// Public modules -pub mod distributions; -pub mod prelude; -pub mod prng; -pub mod rngs; -#[cfg(feature = "alloc")] pub mod seq; - -//////////////////////////////////////////////////////////////////////////////// -// Compatibility re-exports. Documentation is hidden; will be removed eventually. - -#[cfg(feature="std")] #[doc(hidden)] pub use rngs::adapter::read; -#[doc(hidden)] pub use rngs::adapter::ReseedingRng; - -#[allow(deprecated)] -#[cfg(feature="std")] #[doc(hidden)] pub use rngs::EntropyRng; - -#[allow(deprecated)] -#[cfg(all(feature="std", - any(target_os = "linux", target_os = "android", - target_os = "netbsd", - target_os = "dragonfly", - target_os = "haiku", - target_os = "emscripten", - target_os = "solaris", - target_os = "cloudabi", - target_os = "macos", target_os = "ios", - target_os = "freebsd", - target_os = "openbsd", target_os = "bitrig", - target_os = "redox", - target_os = "fuchsia", - windows, - all(target_arch = "wasm32", feature = "stdweb") -)))] -#[doc(hidden)] -pub use rngs::OsRng; - -#[doc(hidden)] pub use prng::{ChaChaRng, IsaacRng, Isaac64Rng, XorShiftRng}; -#[doc(hidden)] pub use rngs::StdRng; - - -#[allow(deprecated)] -#[doc(hidden)] -pub mod jitter { - pub use rngs::{JitterRng, TimerError}; -} -#[allow(deprecated)] -#[cfg(all(feature="std", - any(target_os = "linux", target_os = "android", - target_os = "netbsd", - target_os = "dragonfly", - target_os = "haiku", - target_os = "emscripten", - target_os = "solaris", - target_os = "cloudabi", - target_os = "macos", target_os = "ios", - target_os = "freebsd", - target_os = "openbsd", target_os = "bitrig", - target_os = "redox", - target_os = "fuchsia", - windows, - all(target_arch = "wasm32", feature = "stdweb") -)))] -#[doc(hidden)] -pub mod os { - pub use rngs::OsRng; -} -#[allow(deprecated)] -#[doc(hidden)] -pub mod chacha { - //! The ChaCha random number generator. - pub use prng::ChaChaRng; -} -#[doc(hidden)] -pub mod isaac { - //! The ISAAC random number generator. - pub use prng::{IsaacRng, Isaac64Rng}; -} - -#[cfg(feature="std")] #[doc(hidden)] pub use rngs::ThreadRng; - -//////////////////////////////////////////////////////////////////////////////// - - -use core::{marker, mem, slice}; -use distributions::{Distribution, Standard}; -use distributions::uniform::{SampleUniform, UniformSampler}; - - -/// A type that can be randomly generated using an [`Rng`]. -/// -/// This is merely an adapter around the [`Standard`] distribution for -/// convenience and backwards-compatibility. -/// -/// [`Rng`]: trait.Rng.html -/// [`Standard`]: distributions/struct.Standard.html -#[deprecated(since="0.5.0", note="replaced by distributions::Standard")] -pub trait Rand : Sized { - /// Generates a random instance of this type using the specified source of - /// randomness. - fn rand(rng: &mut R) -> Self; -} - -/// An automatically-implemented extension trait on [`RngCore`] providing high-level -/// generic methods for sampling values and other convenience methods. -/// -/// This is the primary trait to use when generating random values. -/// -/// # Generic usage -/// -/// The basic pattern is `fn foo(rng: &mut R)`. Some -/// things are worth noting here: -/// -/// - Since `Rng: RngCore` and every `RngCore` implements `Rng`, it makes no -/// difference whether we use `R: Rng` or `R: RngCore`. -/// - The `+ ?Sized` un-bounding allows functions to be called directly on -/// type-erased references; i.e. `foo(r)` where `r: &mut RngCore`. Without -/// this it would be necessary to write `foo(&mut r)`. -/// -/// An alternative pattern is possible: `fn foo(rng: R)`. This has some -/// trade-offs. It allows the argument to be consumed directly without a `&mut` -/// (which is how `from_rng(thread_rng())` works); also it still works directly -/// on references (including type-erased references). Unfortunately within the -/// function `foo` it is not known whether `rng` is a reference type or not, -/// hence many uses of `rng` require an extra reference, either explicitly -/// (`distr.sample(&mut rng)`) or implicitly (`rng.gen()`); one may hope the -/// optimiser can remove redundant references later. -/// -/// Example: -/// -/// ``` -/// # use rand::thread_rng; -/// use rand::Rng; -/// -/// fn foo(rng: &mut R) -> f32 { -/// rng.gen() -/// } -/// -/// # let v = foo(&mut thread_rng()); -/// ``` -/// -/// [`RngCore`]: trait.RngCore.html -pub trait Rng: RngCore { - /// Return a random value supporting the [`Standard`] distribution. - /// - /// [`Standard`]: distributions/struct.Standard.html - /// - /// # Example - /// - /// ``` - /// use rand::{thread_rng, Rng}; - /// - /// let mut rng = thread_rng(); - /// let x: u32 = rng.gen(); - /// println!("{}", x); - /// println!("{:?}", rng.gen::<(f64, bool)>()); - /// ``` - #[inline] - fn gen(&mut self) -> T where Standard: Distribution { - Standard.sample(self) - } - - /// Generate a random value in the range [`low`, `high`), i.e. inclusive of - /// `low` and exclusive of `high`. - /// - /// This function is optimised for the case that only a single sample is - /// made from the given range. See also the [`Uniform`] distribution - /// type which may be faster if sampling from the same range repeatedly. - /// - /// # Panics - /// - /// Panics if `low >= high`. - /// - /// # Example - /// - /// ``` - /// use rand::{thread_rng, Rng}; - /// - /// let mut rng = thread_rng(); - /// let n: u32 = rng.gen_range(0, 10); - /// println!("{}", n); - /// let m: f64 = rng.gen_range(-40.0f64, 1.3e5f64); - /// println!("{}", m); - /// ``` - /// - /// [`Uniform`]: distributions/uniform/struct.Uniform.html - fn gen_range(&mut self, low: T, high: T) -> T { - T::Sampler::sample_single(low, high, self) - } - - /// Sample a new value, using the given distribution. - /// - /// ### Example - /// - /// ``` - /// use rand::{thread_rng, Rng}; - /// use rand::distributions::Uniform; - /// - /// let mut rng = thread_rng(); - /// let x = rng.sample(Uniform::new(10u32, 15)); - /// // Type annotation requires two types, the type and distribution; the - /// // distribution can be inferred. - /// let y = rng.sample::(Uniform::new(10, 15)); - /// ``` - fn sample>(&mut self, distr: D) -> T { - distr.sample(self) - } - - /// Create an iterator that generates values using the given distribution. - /// - /// # Example - /// - /// ``` - /// use rand::{thread_rng, Rng}; - /// use rand::distributions::{Alphanumeric, Uniform, Standard}; - /// - /// let mut rng = thread_rng(); - /// - /// // Vec of 16 x f32: - /// let v: Vec = thread_rng().sample_iter(&Standard).take(16).collect(); - /// - /// // String: - /// let s: String = rng.sample_iter(&Alphanumeric).take(7).collect(); - /// - /// // Combined values - /// println!("{:?}", thread_rng().sample_iter(&Standard).take(5) - /// .collect::>()); - /// - /// // Dice-rolling: - /// let die_range = Uniform::new_inclusive(1, 6); - /// let mut roll_die = rng.sample_iter(&die_range); - /// while roll_die.next().unwrap() != 6 { - /// println!("Not a 6; rolling again!"); - /// } - /// ``` - fn sample_iter<'a, T, D: Distribution>(&'a mut self, distr: &'a D) - -> distributions::DistIter<'a, D, Self, T> where Self: Sized - { - distr.sample_iter(self) - } - - /// Fill `dest` entirely with random bytes (uniform value distribution), - /// where `dest` is any type supporting [`AsByteSliceMut`], namely slices - /// and arrays over primitive integer types (`i8`, `i16`, `u32`, etc.). - /// - /// On big-endian platforms this performs byte-swapping to ensure - /// portability of results from reproducible generators. - /// - /// This uses [`fill_bytes`] internally which may handle some RNG errors - /// implicitly (e.g. waiting if the OS generator is not ready), but panics - /// on other errors. See also [`try_fill`] which returns errors. - /// - /// # Example - /// - /// ``` - /// use rand::{thread_rng, Rng}; - /// - /// let mut arr = [0i8; 20]; - /// thread_rng().fill(&mut arr[..]); - /// ``` - /// - /// [`fill_bytes`]: trait.RngCore.html#method.fill_bytes - /// [`try_fill`]: trait.Rng.html#method.try_fill - /// [`AsByteSliceMut`]: trait.AsByteSliceMut.html - fn fill(&mut self, dest: &mut T) { - self.fill_bytes(dest.as_byte_slice_mut()); - dest.to_le(); - } - - /// Fill `dest` entirely with random bytes (uniform value distribution), - /// where `dest` is any type supporting [`AsByteSliceMut`], namely slices - /// and arrays over primitive integer types (`i8`, `i16`, `u32`, etc.). - /// - /// On big-endian platforms this performs byte-swapping to ensure - /// portability of results from reproducible generators. - /// - /// This uses [`try_fill_bytes`] internally and forwards all RNG errors. In - /// some cases errors may be resolvable; see [`ErrorKind`] and - /// documentation for the RNG in use. If you do not plan to handle these - /// errors you may prefer to use [`fill`]. - /// - /// # Example - /// - /// ``` - /// # use rand::Error; - /// use rand::{thread_rng, Rng}; - /// - /// # fn try_inner() -> Result<(), Error> { - /// let mut arr = [0u64; 4]; - /// thread_rng().try_fill(&mut arr[..])?; - /// # Ok(()) - /// # } - /// - /// # try_inner().unwrap() - /// ``` - /// - /// [`ErrorKind`]: enum.ErrorKind.html - /// [`try_fill_bytes`]: trait.RngCore.html#method.try_fill_bytes - /// [`fill`]: trait.Rng.html#method.fill - /// [`AsByteSliceMut`]: trait.AsByteSliceMut.html - fn try_fill(&mut self, dest: &mut T) -> Result<(), Error> { - self.try_fill_bytes(dest.as_byte_slice_mut())?; - dest.to_le(); - Ok(()) - } - - /// Return a bool with a probability `p` of being true. - /// - /// This is a wrapper around [`distributions::Bernoulli`]. - /// - /// # Example - /// - /// ``` - /// use rand::{thread_rng, Rng}; - /// - /// let mut rng = thread_rng(); - /// println!("{}", rng.gen_bool(1.0 / 3.0)); - /// ``` - /// - /// # Panics - /// - /// If `p` < 0 or `p` > 1. - /// - /// [`distributions::Bernoulli`]: distributions/bernoulli/struct.Bernoulli.html - #[inline] - fn gen_bool(&mut self, p: f64) -> bool { - let d = distributions::Bernoulli::new(p); - self.sample(d) - } - - /// Return a random element from `values`. - /// - /// Return `None` if `values` is empty. - /// - /// # Example - /// - /// ``` - /// use rand::{thread_rng, Rng}; - /// - /// let choices = [1, 2, 4, 8, 16, 32]; - /// let mut rng = thread_rng(); - /// println!("{:?}", rng.choose(&choices)); - /// assert_eq!(rng.choose(&choices[..0]), None); - /// ``` - fn choose<'a, T>(&mut self, values: &'a [T]) -> Option<&'a T> { - if values.is_empty() { - None - } else { - Some(&values[self.gen_range(0, values.len())]) - } - } - - /// Return a mutable pointer to a random element from `values`. - /// - /// Return `None` if `values` is empty. - fn choose_mut<'a, T>(&mut self, values: &'a mut [T]) -> Option<&'a mut T> { - if values.is_empty() { - None - } else { - let len = values.len(); - Some(&mut values[self.gen_range(0, len)]) - } - } - - /// Shuffle a mutable slice in place. - /// - /// This applies Durstenfeld's algorithm for the [Fisher–Yates shuffle]( - /// https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm) - /// which produces an unbiased permutation. - /// - /// # Example - /// - /// ``` - /// use rand::{thread_rng, Rng}; - /// - /// let mut rng = thread_rng(); - /// let mut y = [1, 2, 3]; - /// rng.shuffle(&mut y); - /// println!("{:?}", y); - /// rng.shuffle(&mut y); - /// println!("{:?}", y); - /// ``` - fn shuffle(&mut self, values: &mut [T]) { - let mut i = values.len(); - while i >= 2 { - // invariant: elements with index >= i have been locked in place. - i -= 1; - // lock element i in place. - values.swap(i, self.gen_range(0, i + 1)); - } - } - - /// Return an iterator that will yield an infinite number of randomly - /// generated items. - /// - /// # Example - /// - /// ``` - /// # #![allow(deprecated)] - /// use rand::{thread_rng, Rng}; - /// - /// let mut rng = thread_rng(); - /// let x = rng.gen_iter::().take(10).collect::>(); - /// println!("{:?}", x); - /// println!("{:?}", rng.gen_iter::<(f64, bool)>().take(5) - /// .collect::>()); - /// ``` - #[allow(deprecated)] - #[deprecated(since="0.5.0", note="use Rng::sample_iter(&Standard) instead")] - fn gen_iter(&mut self) -> Generator where Standard: Distribution { - Generator { rng: self, _marker: marker::PhantomData } - } - - /// Return a bool with a 1 in n chance of true - /// - /// # Example - /// - /// ``` - /// # #![allow(deprecated)] - /// use rand::{thread_rng, Rng}; - /// - /// let mut rng = thread_rng(); - /// assert_eq!(rng.gen_weighted_bool(0), true); - /// assert_eq!(rng.gen_weighted_bool(1), true); - /// // Just like `rng.gen::()` a 50-50% chance, but using a slower - /// // method with different results. - /// println!("{}", rng.gen_weighted_bool(2)); - /// // First meaningful use of `gen_weighted_bool`. - /// println!("{}", rng.gen_weighted_bool(3)); - /// ``` - #[deprecated(since="0.5.0", note="use gen_bool instead")] - fn gen_weighted_bool(&mut self, n: u32) -> bool { - // Short-circuit after `n <= 1` to avoid panic in `gen_range` - n <= 1 || self.gen_range(0, n) == 0 - } - - /// Return an iterator of random characters from the set A-Z,a-z,0-9. - /// - /// # Example - /// - /// ``` - /// # #![allow(deprecated)] - /// use rand::{thread_rng, Rng}; - /// - /// let s: String = thread_rng().gen_ascii_chars().take(10).collect(); - /// println!("{}", s); - /// ``` - #[allow(deprecated)] - #[deprecated(since="0.5.0", note="use sample_iter(&Alphanumeric) instead")] - fn gen_ascii_chars(&mut self) -> AsciiGenerator<&mut Self> { - AsciiGenerator { rng: self } - } -} - -impl Rng for R {} - -/// Trait for casting types to byte slices -/// -/// This is used by the [`fill`] and [`try_fill`] methods. -/// -/// [`fill`]: trait.Rng.html#method.fill -/// [`try_fill`]: trait.Rng.html#method.try_fill -pub trait AsByteSliceMut { - /// Return a mutable reference to self as a byte slice - fn as_byte_slice_mut(&mut self) -> &mut [u8]; - - /// Call `to_le` on each element (i.e. byte-swap on Big Endian platforms). - fn to_le(&mut self); -} - -impl AsByteSliceMut for [u8] { - fn as_byte_slice_mut(&mut self) -> &mut [u8] { - self - } - - fn to_le(&mut self) {} -} - -macro_rules! impl_as_byte_slice { - ($t:ty) => { - impl AsByteSliceMut for [$t] { - fn as_byte_slice_mut(&mut self) -> &mut [u8] { - if self.len() == 0 { - unsafe { - // must not use null pointer - slice::from_raw_parts_mut(0x1 as *mut u8, 0) - } - } else { - unsafe { - slice::from_raw_parts_mut(&mut self[0] - as *mut $t - as *mut u8, - self.len() * mem::size_of::<$t>() - ) - } - } - } - - fn to_le(&mut self) { - for x in self { - *x = x.to_le(); - } - } - } - } -} - -impl_as_byte_slice!(u16); -impl_as_byte_slice!(u32); -impl_as_byte_slice!(u64); -#[cfg(feature="i128_support")] impl_as_byte_slice!(u128); -impl_as_byte_slice!(usize); -impl_as_byte_slice!(i8); -impl_as_byte_slice!(i16); -impl_as_byte_slice!(i32); -impl_as_byte_slice!(i64); -#[cfg(feature="i128_support")] impl_as_byte_slice!(i128); -impl_as_byte_slice!(isize); - -macro_rules! impl_as_byte_slice_arrays { - ($n:expr,) => {}; - ($n:expr, $N:ident, $($NN:ident,)*) => { - impl_as_byte_slice_arrays!($n - 1, $($NN,)*); - - impl AsByteSliceMut for [T; $n] where [T]: AsByteSliceMut { - fn as_byte_slice_mut(&mut self) -> &mut [u8] { - self[..].as_byte_slice_mut() - } - - fn to_le(&mut self) { - self[..].to_le() - } - } - }; - (!div $n:expr,) => {}; - (!div $n:expr, $N:ident, $($NN:ident,)*) => { - impl_as_byte_slice_arrays!(!div $n / 2, $($NN,)*); - - impl AsByteSliceMut for [T; $n] where [T]: AsByteSliceMut { - fn as_byte_slice_mut(&mut self) -> &mut [u8] { - self[..].as_byte_slice_mut() - } - - fn to_le(&mut self) { - self[..].to_le() - } - } - }; -} -impl_as_byte_slice_arrays!(32, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,); -impl_as_byte_slice_arrays!(!div 4096, N,N,N,N,N,N,N,); - -/// Iterator which will generate a stream of random items. -/// -/// This iterator is created via the [`gen_iter`] method on [`Rng`]. -/// -/// [`gen_iter`]: trait.Rng.html#method.gen_iter -/// [`Rng`]: trait.Rng.html -#[derive(Debug)] -#[allow(deprecated)] -#[deprecated(since="0.5.0", note="use Rng::sample_iter instead")] -pub struct Generator { - rng: R, - _marker: marker::PhantomData T>, -} - -#[allow(deprecated)] -impl Iterator for Generator where Standard: Distribution { - type Item = T; - - fn next(&mut self) -> Option { - Some(self.rng.gen()) - } -} - -/// Iterator which will continuously generate random ascii characters. -/// -/// This iterator is created via the [`gen_ascii_chars`] method on [`Rng`]. -/// -/// [`gen_ascii_chars`]: trait.Rng.html#method.gen_ascii_chars -/// [`Rng`]: trait.Rng.html -#[derive(Debug)] -#[allow(deprecated)] -#[deprecated(since="0.5.0", note="use distributions::Alphanumeric instead")] -pub struct AsciiGenerator { - rng: R, -} - -#[allow(deprecated)] -impl Iterator for AsciiGenerator { - type Item = char; - - fn next(&mut self) -> Option { - const GEN_ASCII_STR_CHARSET: &[u8] = - b"ABCDEFGHIJKLMNOPQRSTUVWXYZ\ - abcdefghijklmnopqrstuvwxyz\ - 0123456789"; - Some(*self.rng.choose(GEN_ASCII_STR_CHARSET).unwrap() as char) - } -} - - -/// A convenience extension to [`SeedableRng`] allowing construction from fresh -/// entropy. This trait is automatically implemented for any PRNG implementing -/// [`SeedableRng`] and is not intended to be implemented by users. -/// -/// This is equivalent to using `SeedableRng::from_rng(EntropyRng::new())` then -/// unwrapping the result. -/// -/// Since this is convenient and secure, it is the recommended way to create -/// PRNGs, though two alternatives may be considered: -/// -/// * Deterministic creation using [`SeedableRng::from_seed`] with a fixed seed -/// * Seeding from `thread_rng`: `SeedableRng::from_rng(thread_rng())?`; -/// this will usually be faster and should also be secure, but requires -/// trusting one extra component. -/// -/// ## Example -/// -/// ``` -/// use rand::{Rng, FromEntropy}; -/// use rand::rngs::StdRng; -/// -/// let mut rng = StdRng::from_entropy(); -/// println!("Random die roll: {}", rng.gen_range(1, 7)); -/// ``` -/// -/// [`EntropyRng`]: rngs/struct.EntropyRng.html -/// [`SeedableRng`]: trait.SeedableRng.html -/// [`SeedableRng::from_seed`]: trait.SeedableRng.html#tymethod.from_seed -#[cfg(feature="std")] -pub trait FromEntropy: SeedableRng { - /// Creates a new instance, automatically seeded with fresh entropy. - /// - /// Normally this will use `OsRng`, but if that fails `JitterRng` will be - /// used instead. Both should be suitable for cryptography. It is possible - /// that both entropy sources will fail though unlikely; failures would - /// almost certainly be platform limitations or build issues, i.e. most - /// applications targetting PC/mobile platforms should not need to worry - /// about this failing. - /// - /// # Panics - /// - /// If all entropy sources fail this will panic. If you need to handle - /// errors, use the following code, equivalent aside from error handling: - /// - /// ``` - /// # use rand::Error; - /// use rand::prelude::*; - /// use rand::rngs::EntropyRng; - /// - /// # fn try_inner() -> Result<(), Error> { - /// // This uses StdRng, but is valid for any R: SeedableRng - /// let mut rng = StdRng::from_rng(EntropyRng::new())?; - /// - /// println!("random number: {}", rng.gen_range(1, 10)); - /// # Ok(()) - /// # } - /// - /// # try_inner().unwrap() - /// ``` - fn from_entropy() -> Self; -} - -#[cfg(feature="std")] -impl FromEntropy for R { - fn from_entropy() -> R { - R::from_rng(EntropyRng::new()).unwrap_or_else(|err| - panic!("FromEntropy::from_entropy() failed: {}", err)) - } -} - - -/// DEPRECATED: use [`SmallRng`] instead. -/// -/// Create a weak random number generator with a default algorithm and seed. -/// -/// It returns the fastest `Rng` algorithm currently available in Rust without -/// consideration for cryptography or security. If you require a specifically -/// seeded `Rng` for consistency over time you should pick one algorithm and -/// create the `Rng` yourself. -/// -/// This will seed the generator with randomness from `thread_rng`. -/// -/// [`SmallRng`]: rngs/struct.SmallRng.html -#[deprecated(since="0.5.0", note="removed in favor of SmallRng")] -#[cfg(feature="std")] -pub fn weak_rng() -> XorShiftRng { - XorShiftRng::from_rng(thread_rng()).unwrap_or_else(|err| - panic!("weak_rng failed: {:?}", err)) -} - -/// Generates a random value using the thread-local random number generator. -/// -/// This is simply a shortcut for `thread_rng().gen()`. See [`thread_rng`] for -/// documentation of the entropy source and [`Standard`] for documentation of -/// distributions and type-specific generation. -/// -/// # Examples -/// -/// ``` -/// let x = rand::random::(); -/// println!("{}", x); -/// -/// let y = rand::random::(); -/// println!("{}", y); -/// -/// if rand::random() { // generates a boolean -/// println!("Better lucky than good!"); -/// } -/// ``` -/// -/// If you're calling `random()` in a loop, caching the generator as in the -/// following example can increase performance. -/// -/// ``` -/// # #![allow(deprecated)] -/// use rand::Rng; -/// -/// let mut v = vec![1, 2, 3]; -/// -/// for x in v.iter_mut() { -/// *x = rand::random() -/// } -/// -/// // can be made faster by caching thread_rng -/// -/// let mut rng = rand::thread_rng(); -/// -/// for x in v.iter_mut() { -/// *x = rng.gen(); -/// } -/// ``` -/// -/// [`thread_rng`]: fn.thread_rng.html -/// [`Standard`]: distributions/struct.Standard.html -#[cfg(feature="std")] -#[inline] -pub fn random() -> T where Standard: Distribution { - thread_rng().gen() -} - -/// DEPRECATED: use `seq::sample_iter` instead. -/// -/// Randomly sample up to `amount` elements from a finite iterator. -/// The order of elements in the sample is not random. -/// -/// # Example -/// -/// ``` -/// # #![allow(deprecated)] -/// use rand::{thread_rng, sample}; -/// -/// let mut rng = thread_rng(); -/// let sample = sample(&mut rng, 1..100, 5); -/// println!("{:?}", sample); -/// ``` -#[cfg(feature="std")] -#[inline] -#[deprecated(since="0.4.0", note="renamed to seq::sample_iter")] -pub fn sample(rng: &mut R, iterable: I, amount: usize) -> Vec - where I: IntoIterator, - R: Rng, -{ - // the legacy sample didn't care whether amount was met - seq::sample_iter(rng, iterable, amount) - .unwrap_or_else(|e| e) -} - -#[cfg(test)] -mod test { - use rngs::mock::StepRng; - use super::*; - #[cfg(all(not(feature="std"), feature="alloc"))] use alloc::boxed::Box; - - pub struct TestRng { inner: R } - - impl RngCore for TestRng { - fn next_u32(&mut self) -> u32 { - self.inner.next_u32() - } - fn next_u64(&mut self) -> u64 { - self.inner.next_u64() - } - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.inner.fill_bytes(dest) - } - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.inner.try_fill_bytes(dest) - } - } - - pub fn rng(seed: u64) -> TestRng { - TestRng { inner: StdRng::seed_from_u64(seed) } - } - - #[test] - fn test_fill_bytes_default() { - let mut r = StepRng::new(0x11_22_33_44_55_66_77_88, 0); - - // check every remainder mod 8, both in small and big vectors. - let lengths = [0, 1, 2, 3, 4, 5, 6, 7, - 80, 81, 82, 83, 84, 85, 86, 87]; - for &n in lengths.iter() { - let mut buffer = [0u8; 87]; - let v = &mut buffer[0..n]; - r.fill_bytes(v); - - // use this to get nicer error messages. - for (i, &byte) in v.iter().enumerate() { - if byte == 0 { - panic!("byte {} of {} is zero", i, n) - } - } - } - } - - #[test] - fn test_fill() { - let x = 9041086907909331047; // a random u64 - let mut rng = StepRng::new(x, 0); - - // Convert to byte sequence and back to u64; byte-swap twice if BE. - let mut array = [0u64; 2]; - rng.fill(&mut array[..]); - assert_eq!(array, [x, x]); - assert_eq!(rng.next_u64(), x); - - // Convert to bytes then u32 in LE order - let mut array = [0u32; 2]; - rng.fill(&mut array[..]); - assert_eq!(array, [x as u32, (x >> 32) as u32]); - assert_eq!(rng.next_u32(), x as u32); - } - - #[test] - fn test_fill_empty() { - let mut array = [0u32; 0]; - let mut rng = StepRng::new(0, 1); - rng.fill(&mut array); - rng.fill(&mut array[..]); - } - - #[test] - fn test_gen_range() { - let mut r = rng(101); - for _ in 0..1000 { - let a = r.gen_range(-3, 42); - assert!(a >= -3 && a < 42); - assert_eq!(r.gen_range(0, 1), 0); - assert_eq!(r.gen_range(-12, -11), -12); - } - - for _ in 0..1000 { - let a = r.gen_range(10, 42); - assert!(a >= 10 && a < 42); - assert_eq!(r.gen_range(0, 1), 0); - assert_eq!(r.gen_range(3_000_000, 3_000_001), 3_000_000); - } - - } - - #[test] - #[should_panic] - fn test_gen_range_panic_int() { - let mut r = rng(102); - r.gen_range(5, -2); - } - - #[test] - #[should_panic] - fn test_gen_range_panic_usize() { - let mut r = rng(103); - r.gen_range(5, 2); - } - - #[test] - #[allow(deprecated)] - fn test_gen_weighted_bool() { - let mut r = rng(104); - assert_eq!(r.gen_weighted_bool(0), true); - assert_eq!(r.gen_weighted_bool(1), true); - } - - #[test] - fn test_gen_bool() { - let mut r = rng(105); - for _ in 0..5 { - assert_eq!(r.gen_bool(0.0), false); - assert_eq!(r.gen_bool(1.0), true); - } - } - - #[test] - fn test_choose() { - let mut r = rng(107); - assert_eq!(r.choose(&[1, 1, 1]).map(|&x|x), Some(1)); - - let v: &[isize] = &[]; - assert_eq!(r.choose(v), None); - } - - #[test] - fn test_shuffle() { - let mut r = rng(108); - let empty: &mut [isize] = &mut []; - r.shuffle(empty); - let mut one = [1]; - r.shuffle(&mut one); - let b: &[_] = &[1]; - assert_eq!(one, b); - - let mut two = [1, 2]; - r.shuffle(&mut two); - assert!(two == [1, 2] || two == [2, 1]); - - let mut x = [1, 1, 1]; - r.shuffle(&mut x); - let b: &[_] = &[1, 1, 1]; - assert_eq!(x, b); - } - - #[test] - fn test_rng_trait_object() { - use distributions::{Distribution, Standard}; - let mut rng = rng(109); - let mut r = &mut rng as &mut RngCore; - r.next_u32(); - r.gen::(); - let mut v = [1, 1, 1]; - r.shuffle(&mut v); - let b: &[_] = &[1, 1, 1]; - assert_eq!(v, b); - assert_eq!(r.gen_range(0, 1), 0); - let _c: u8 = Standard.sample(&mut r); - } - - #[test] - #[cfg(feature="alloc")] - fn test_rng_boxed_trait() { - use distributions::{Distribution, Standard}; - let rng = rng(110); - let mut r = Box::new(rng) as Box; - r.next_u32(); - r.gen::(); - let mut v = [1, 1, 1]; - r.shuffle(&mut v); - let b: &[_] = &[1, 1, 1]; - assert_eq!(v, b); - assert_eq!(r.gen_range(0, 1), 0); - let _c: u8 = Standard.sample(&mut r); - } - - #[test] - #[cfg(feature="std")] - fn test_random() { - // not sure how to test this aside from just getting some values - let _n : usize = random(); - let _f : f32 = random(); - let _o : Option> = random(); - let _many : ((), - (usize, - isize, - Option<(u32, (bool,))>), - (u8, i8, u16, i16, u32, i32, u64, i64), - (f32, (f64, (f64,)))) = random(); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/prelude.rs cargo-0.37.0/vendor/rand-0.5.6/src/prelude.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/prelude.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/prelude.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Convenience re-export of common members -//! -//! Like the standard library's prelude, this module simplifies importing of -//! common items. Unlike the standard prelude, the contents of this module must -//! be imported manually: -//! -//! ``` -//! use rand::prelude::*; -//! # let _ = StdRng::from_entropy(); -//! # let mut r = SmallRng::from_rng(thread_rng()).unwrap(); -//! # let _: f32 = r.gen(); -//! ``` - -#[doc(no_inline)] pub use distributions::Distribution; -#[doc(no_inline)] pub use rngs::{SmallRng, StdRng}; -#[doc(no_inline)] #[cfg(feature="std")] pub use rngs::ThreadRng; -#[doc(no_inline)] pub use {Rng, RngCore, CryptoRng, SeedableRng}; -#[doc(no_inline)] #[cfg(feature="std")] pub use {FromEntropy, random, thread_rng}; diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/prng/chacha.rs cargo-0.37.0/vendor/rand-0.5.6/src/prng/chacha.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/prng/chacha.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/prng/chacha.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,477 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://www.rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The ChaCha random number generator. - -use core::fmt; -use rand_core::{CryptoRng, RngCore, SeedableRng, Error, le}; -use rand_core::block::{BlockRngCore, BlockRng}; - -const SEED_WORDS: usize = 8; // 8 words for the 256-bit key -const STATE_WORDS: usize = 16; - -/// A cryptographically secure random number generator that uses the ChaCha -/// algorithm. -/// -/// ChaCha is a stream cipher designed by Daniel J. Bernstein [^1], that we use -/// as an RNG. It is an improved variant of the Salsa20 cipher family, which was -/// selected as one of the "stream ciphers suitable for widespread adoption" by -/// eSTREAM [^2]. -/// -/// ChaCha uses add-rotate-xor (ARX) operations as its basis. These are safe -/// against timing attacks, although that is mostly a concern for ciphers and -/// not for RNGs. Also it is very suitable for SIMD implementation. -/// Here we do not provide a SIMD implementation yet, except for what is -/// provided by auto-vectorisation. -/// -/// With the ChaCha algorithm it is possible to choose the number of rounds the -/// core algorithm should run. The number of rounds is a tradeoff between -/// performance and security, where 8 rounds is the minimum potentially -/// secure configuration, and 20 rounds is widely used as a conservative choice. -/// We use 20 rounds in this implementation, but hope to allow type-level -/// configuration in the future. -/// -/// We use a 64-bit counter and 64-bit stream identifier as in Benstein's -/// implementation [^1] except that we use a stream identifier in place of a -/// nonce. A 64-bit counter over 64-byte (16 word) blocks allows 1 ZiB of output -/// before cycling, and the stream identifier allows 264 unique -/// streams of output per seed. Both counter and stream are initialized to zero -/// but may be set via [`set_word_pos`] and [`set_stream`]. -/// -/// The word layout is: -/// -/// ```text -/// constant constant constant constant -/// seed seed seed seed -/// seed seed seed seed -/// counter counter nonce nonce -/// ``` -/// -/// This implementation uses an output buffer of sixteen `u32` words, and uses -/// [`BlockRng`] to implement the [`RngCore`] methods. -/// -/// [^1]: D. J. Bernstein, [*ChaCha, a variant of Salsa20*]( -/// https://cr.yp.to/chacha.html) -/// -/// [^2]: [eSTREAM: the ECRYPT Stream Cipher Project]( -/// http://www.ecrypt.eu.org/stream/) -/// -/// [`set_word_pos`]: #method.set_word_pos -/// [`set_stream`]: #method.set_stream -/// [`BlockRng`]: ../../../rand_core/block/struct.BlockRng.html -/// [`RngCore`]: ../../trait.RngCore.html -#[derive(Clone, Debug)] -pub struct ChaChaRng(BlockRng); - -impl RngCore for ChaChaRng { - #[inline] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - #[inline] - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest) - } - - #[inline] - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -impl SeedableRng for ChaChaRng { - type Seed = ::Seed; - - fn from_seed(seed: Self::Seed) -> Self { - ChaChaRng(BlockRng::::from_seed(seed)) - } - - fn from_rng(rng: R) -> Result { - BlockRng::::from_rng(rng).map(ChaChaRng) - } -} - -impl CryptoRng for ChaChaRng {} - -impl ChaChaRng { - /// Create an ChaCha random number generator using the default - /// fixed key of 8 zero words. - /// - /// # Examples - /// - /// ``` - /// # #![allow(deprecated)] - /// use rand::{RngCore, ChaChaRng}; - /// - /// let mut ra = ChaChaRng::new_unseeded(); - /// println!("{:?}", ra.next_u32()); - /// println!("{:?}", ra.next_u32()); - /// ``` - /// - /// Since this equivalent to a RNG with a fixed seed, repeated executions - /// of an unseeded RNG will produce the same result. This code sample will - /// consistently produce: - /// - /// - 2917185654 - /// - 2419978656 - #[deprecated(since="0.5.0", note="use the FromEntropy or SeedableRng trait")] - pub fn new_unseeded() -> ChaChaRng { - ChaChaRng::from_seed([0; SEED_WORDS*4]) - } - - /// Get the offset from the start of the stream, in 32-bit words. - /// - /// Since the generated blocks are 16 words (24) long and the - /// counter is 64-bits, the offset is a 68-bit number. Sub-word offsets are - /// not supported, hence the result can simply be multiplied by 4 to get a - /// byte-offset. - /// - /// Note: this function is currently only available when the `i128_support` - /// feature is enabled. In the future this will be enabled by default. - #[cfg(feature = "i128_support")] - pub fn get_word_pos(&self) -> u128 { - let mut c = (self.0.core.state[13] as u64) << 32 - | (self.0.core.state[12] as u64); - let mut index = self.0.index(); - // c is the end of the last block generated, unless index is at end - if index >= STATE_WORDS { - index = 0; - } else { - c = c.wrapping_sub(1); - } - ((c as u128) << 4) | (index as u128) - } - - /// Set the offset from the start of the stream, in 32-bit words. - /// - /// As with `get_word_pos`, we use a 68-bit number. Since the generator - /// simply cycles at the end of its period (1 ZiB), we ignore the upper - /// 60 bits. - /// - /// Note: this function is currently only available when the `i128_support` - /// feature is enabled. In the future this will be enabled by default. - #[cfg(feature = "i128_support")] - pub fn set_word_pos(&mut self, word_offset: u128) { - let index = (word_offset as usize) & 0xF; - let counter = (word_offset >> 4) as u64; - self.0.core.state[12] = counter as u32; - self.0.core.state[13] = (counter >> 32) as u32; - if index != 0 { - self.0.generate_and_set(index); // also increments counter - } else { - self.0.reset(); - } - } - - /// Set the stream number. - /// - /// This is initialized to zero; 264 unique streams of output - /// are available per seed/key. - /// - /// Note that in order to reproduce ChaCha output with a specific 64-bit - /// nonce, one can convert that nonce to a `u64` in little-endian fashion - /// and pass to this function. In theory a 96-bit nonce can be used by - /// passing the last 64-bits to this function and using the first 32-bits as - /// the most significant half of the 64-bit counter (which may be set - /// indirectly via `set_word_pos`), but this is not directly supported. - pub fn set_stream(&mut self, stream: u64) { - let index = self.0.index(); - self.0.core.state[14] = stream as u32; - self.0.core.state[15] = (stream >> 32) as u32; - if index < STATE_WORDS { - // we need to regenerate a partial result buffer - { - // reverse of counter adjustment in generate() - if self.0.core.state[12] == 0 { - self.0.core.state[13] = self.0.core.state[13].wrapping_sub(1); - } - self.0.core.state[12] = self.0.core.state[12].wrapping_sub(1); - } - self.0.generate_and_set(index); - } - } -} - -/// The core of `ChaChaRng`, used with `BlockRng`. -#[derive(Clone)] -pub struct ChaChaCore { - state: [u32; STATE_WORDS], -} - -// Custom Debug implementation that does not expose the internal state -impl fmt::Debug for ChaChaCore { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "ChaChaCore {{}}") - } -} - -macro_rules! quarter_round{ - ($a: expr, $b: expr, $c: expr, $d: expr) => {{ - $a = $a.wrapping_add($b); $d ^= $a; $d = $d.rotate_left(16); - $c = $c.wrapping_add($d); $b ^= $c; $b = $b.rotate_left(12); - $a = $a.wrapping_add($b); $d ^= $a; $d = $d.rotate_left( 8); - $c = $c.wrapping_add($d); $b ^= $c; $b = $b.rotate_left( 7); - }} -} - -macro_rules! double_round{ - ($x: expr) => {{ - // Column round - quarter_round!($x[ 0], $x[ 4], $x[ 8], $x[12]); - quarter_round!($x[ 1], $x[ 5], $x[ 9], $x[13]); - quarter_round!($x[ 2], $x[ 6], $x[10], $x[14]); - quarter_round!($x[ 3], $x[ 7], $x[11], $x[15]); - // Diagonal round - quarter_round!($x[ 0], $x[ 5], $x[10], $x[15]); - quarter_round!($x[ 1], $x[ 6], $x[11], $x[12]); - quarter_round!($x[ 2], $x[ 7], $x[ 8], $x[13]); - quarter_round!($x[ 3], $x[ 4], $x[ 9], $x[14]); - }} -} - -impl BlockRngCore for ChaChaCore { - type Item = u32; - type Results = [u32; STATE_WORDS]; - - fn generate(&mut self, results: &mut Self::Results) { - // For some reason extracting this part into a separate function - // improves performance by 50%. - fn core(results: &mut [u32; STATE_WORDS], - state: &[u32; STATE_WORDS]) - { - let mut tmp = *state; - let rounds = 20; - for _ in 0..rounds / 2 { - double_round!(tmp); - } - for i in 0..STATE_WORDS { - results[i] = tmp[i].wrapping_add(state[i]); - } - } - - core(results, &self.state); - - // update 64-bit counter - self.state[12] = self.state[12].wrapping_add(1); - if self.state[12] != 0 { return; }; - self.state[13] = self.state[13].wrapping_add(1); - } -} - -impl SeedableRng for ChaChaCore { - type Seed = [u8; SEED_WORDS*4]; - - fn from_seed(seed: Self::Seed) -> Self { - let mut seed_le = [0u32; SEED_WORDS]; - le::read_u32_into(&seed, &mut seed_le); - Self { - state: [0x61707865, 0x3320646E, 0x79622D32, 0x6B206574, // constants - seed_le[0], seed_le[1], seed_le[2], seed_le[3], // seed - seed_le[4], seed_le[5], seed_le[6], seed_le[7], // seed - 0, 0, 0, 0], // counter - } - } -} - -impl CryptoRng for ChaChaCore {} - -impl From for ChaChaRng { - fn from(core: ChaChaCore) -> Self { - ChaChaRng(BlockRng::new(core)) - } -} - -#[cfg(test)] -mod test { - use {RngCore, SeedableRng}; - use super::ChaChaRng; - - #[test] - fn test_chacha_construction() { - let seed = [0,0,0,0,0,0,0,0, - 1,0,0,0,0,0,0,0, - 2,0,0,0,0,0,0,0, - 3,0,0,0,0,0,0,0]; - let mut rng1 = ChaChaRng::from_seed(seed); - assert_eq!(rng1.next_u32(), 137206642); - - let mut rng2 = ChaChaRng::from_rng(rng1).unwrap(); - assert_eq!(rng2.next_u32(), 1325750369); - } - - #[test] - fn test_chacha_true_values_a() { - // Test vectors 1 and 2 from - // https://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-04 - let seed = [0u8; 32]; - let mut rng = ChaChaRng::from_seed(seed); - - let mut results = [0u32; 16]; - for i in results.iter_mut() { *i = rng.next_u32(); } - let expected = [0xade0b876, 0x903df1a0, 0xe56a5d40, 0x28bd8653, - 0xb819d2bd, 0x1aed8da0, 0xccef36a8, 0xc70d778b, - 0x7c5941da, 0x8d485751, 0x3fe02477, 0x374ad8b8, - 0xf4b8436a, 0x1ca11815, 0x69b687c3, 0x8665eeb2]; - assert_eq!(results, expected); - - for i in results.iter_mut() { *i = rng.next_u32(); } - let expected = [0xbee7079f, 0x7a385155, 0x7c97ba98, 0x0d082d73, - 0xa0290fcb, 0x6965e348, 0x3e53c612, 0xed7aee32, - 0x7621b729, 0x434ee69c, 0xb03371d5, 0xd539d874, - 0x281fed31, 0x45fb0a51, 0x1f0ae1ac, 0x6f4d794b]; - assert_eq!(results, expected); - } - - #[test] - fn test_chacha_true_values_b() { - // Test vector 3 from - // https://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-04 - let seed = [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]; - let mut rng = ChaChaRng::from_seed(seed); - - // Skip block 0 - for _ in 0..16 { rng.next_u32(); } - - let mut results = [0u32; 16]; - for i in results.iter_mut() { *i = rng.next_u32(); } - let expected = [0x2452eb3a, 0x9249f8ec, 0x8d829d9b, 0xddd4ceb1, - 0xe8252083, 0x60818b01, 0xf38422b8, 0x5aaa49c9, - 0xbb00ca8e, 0xda3ba7b4, 0xc4b592d1, 0xfdf2732f, - 0x4436274e, 0x2561b3c8, 0xebdd4aa6, 0xa0136c00]; - assert_eq!(results, expected); - } - - #[test] - #[cfg(feature = "i128_support")] - fn test_chacha_true_values_c() { - // Test vector 4 from - // https://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-04 - let seed = [0, 0xff, 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]; - let expected = [0xfb4dd572, 0x4bc42ef1, 0xdf922636, 0x327f1394, - 0xa78dea8f, 0x5e269039, 0xa1bebbc1, 0xcaf09aae, - 0xa25ab213, 0x48a6b46c, 0x1b9d9bcb, 0x092c5be6, - 0x546ca624, 0x1bec45d5, 0x87f47473, 0x96f0992e]; - let expected_end = 3 * 16; - let mut results = [0u32; 16]; - - // Test block 2 by skipping block 0 and 1 - let mut rng1 = ChaChaRng::from_seed(seed); - for _ in 0..32 { rng1.next_u32(); } - for i in results.iter_mut() { *i = rng1.next_u32(); } - assert_eq!(results, expected); - assert_eq!(rng1.get_word_pos(), expected_end); - - // Test block 2 by using `set_word_pos` - let mut rng2 = ChaChaRng::from_seed(seed); - rng2.set_word_pos(2 * 16); - for i in results.iter_mut() { *i = rng2.next_u32(); } - assert_eq!(results, expected); - assert_eq!(rng2.get_word_pos(), expected_end); - - // Test skipping behaviour with other types - let mut buf = [0u8; 32]; - rng2.fill_bytes(&mut buf[..]); - assert_eq!(rng2.get_word_pos(), expected_end + 8); - rng2.fill_bytes(&mut buf[0..25]); - assert_eq!(rng2.get_word_pos(), expected_end + 15); - rng2.next_u64(); - assert_eq!(rng2.get_word_pos(), expected_end + 17); - rng2.next_u32(); - rng2.next_u64(); - assert_eq!(rng2.get_word_pos(), expected_end + 20); - rng2.fill_bytes(&mut buf[0..1]); - assert_eq!(rng2.get_word_pos(), expected_end + 21); - } - - #[test] - fn test_chacha_multiple_blocks() { - let seed = [0,0,0,0, 1,0,0,0, 2,0,0,0, 3,0,0,0, 4,0,0,0, 5,0,0,0, 6,0,0,0, 7,0,0,0]; - let mut rng = ChaChaRng::from_seed(seed); - - // Store the 17*i-th 32-bit word, - // i.e., the i-th word of the i-th 16-word block - let mut results = [0u32; 16]; - for i in results.iter_mut() { - *i = rng.next_u32(); - for _ in 0..16 { - rng.next_u32(); - } - } - let expected = [0xf225c81a, 0x6ab1be57, 0x04d42951, 0x70858036, - 0x49884684, 0x64efec72, 0x4be2d186, 0x3615b384, - 0x11cfa18e, 0xd3c50049, 0x75c775f6, 0x434c6530, - 0x2c5bad8f, 0x898881dc, 0x5f1c86d9, 0xc1f8e7f4]; - assert_eq!(results, expected); - } - - #[test] - fn test_chacha_true_bytes() { - let seed = [0u8; 32]; - let mut rng = ChaChaRng::from_seed(seed); - let mut results = [0u8; 32]; - rng.fill_bytes(&mut results); - let expected = [118, 184, 224, 173, 160, 241, 61, 144, - 64, 93, 106, 229, 83, 134, 189, 40, - 189, 210, 25, 184, 160, 141, 237, 26, - 168, 54, 239, 204, 139, 119, 13, 199]; - assert_eq!(results, expected); - } - - #[test] - fn test_chacha_nonce() { - // Test vector 5 from - // https://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-04 - // Although we do not support setting a nonce, we try it here anyway so - // we can use this test vector. - let seed = [0u8; 32]; - let mut rng = ChaChaRng::from_seed(seed); - // 96-bit nonce in LE order is: 0,0,0,0, 0,0,0,0, 0,0,0,2 - rng.set_stream(2u64 << (24 + 32)); - - let mut results = [0u32; 16]; - for i in results.iter_mut() { *i = rng.next_u32(); } - let expected = [0x374dc6c2, 0x3736d58c, 0xb904e24a, 0xcd3f93ef, - 0x88228b1a, 0x96a4dfb3, 0x5b76ab72, 0xc727ee54, - 0x0e0e978a, 0xf3145c95, 0x1b748ea8, 0xf786c297, - 0x99c28f5f, 0x628314e8, 0x398a19fa, 0x6ded1b53]; - assert_eq!(results, expected); - } - - #[test] - fn test_chacha_clone_streams() { - let seed = [0,0,0,0, 1,0,0,0, 2,0,0,0, 3,0,0,0, 4,0,0,0, 5,0,0,0, 6,0,0,0, 7,0,0,0]; - let mut rng = ChaChaRng::from_seed(seed); - let mut clone = rng.clone(); - for _ in 0..16 { - assert_eq!(rng.next_u64(), clone.next_u64()); - } - - rng.set_stream(51); - for _ in 0..7 { - assert!(rng.next_u32() != clone.next_u32()); - } - clone.set_stream(51); // switch part way through block - for _ in 7..16 { - assert_eq!(rng.next_u32(), clone.next_u32()); - } - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/prng/hc128.rs cargo-0.37.0/vendor/rand-0.5.6/src/prng/hc128.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/prng/hc128.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/prng/hc128.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,464 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://www.rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The HC-128 random number generator. - -use core::fmt; -use rand_core::{CryptoRng, RngCore, SeedableRng, Error, le}; -use rand_core::block::{BlockRngCore, BlockRng}; - -const SEED_WORDS: usize = 8; // 128 bit key followed by 128 bit iv - -/// A cryptographically secure random number generator that uses the HC-128 -/// algorithm. -/// -/// HC-128 is a stream cipher designed by Hongjun Wu[^1], that we use as an -/// RNG. It is selected as one of the "stream ciphers suitable for widespread -/// adoption" by eSTREAM[^2]. -/// -/// HC-128 is an array based RNG. In this it is similar to RC-4 and ISAAC before -/// it, but those have never been proven cryptographically secure (or have even -/// been significantly compromised, as in the case of RC-4[^5]). -/// -/// Because HC-128 works with simple indexing into a large array and with a few -/// operations that parallelize well, it has very good performance. The size of -/// the array it needs, 4kb, can however be a disadvantage. -/// -/// This implementation is not based on the version of HC-128 submitted to the -/// eSTREAM contest, but on a later version by the author with a few small -/// improvements from December 15, 2009[^3]. -/// -/// HC-128 has no known weaknesses that are easier to exploit than doing a -/// brute-force search of 2128. A very comprehensive analysis of the -/// current state of known attacks / weaknesses of HC-128 is given in *Some -/// Results On Analysis And Implementation Of HC-128 Stream Cipher*[^4]. -/// -/// The average cycle length is expected to be -/// 21024*32+10-1 = 232777. -/// We support seeding with a 256-bit array, which matches the 128-bit key -/// concatenated with a 128-bit IV from the stream cipher. -/// -/// This implementation uses an output buffer of sixteen `u32` words, and uses -/// [`BlockRng`] to implement the [`RngCore`] methods. -/// -/// ## References -/// [^1]: Hongjun Wu (2008). ["The Stream Cipher HC-128"]( -/// http://www.ecrypt.eu.org/stream/p3ciphers/hc/hc128_p3.pdf). -/// *The eSTREAM Finalists*, LNCS 4986, pp. 39–47, Springer-Verlag. -/// -/// [^2]: [eSTREAM: the ECRYPT Stream Cipher Project]( -/// http://www.ecrypt.eu.org/stream/) -/// -/// [^3]: Hongjun Wu, [Stream Ciphers HC-128 and HC-256]( -/// https://www.ntu.edu.sg/home/wuhj/research/hc/index.html) -/// -/// [^4]: Shashwat Raizada (January 2015),["Some Results On Analysis And -/// Implementation Of HC-128 Stream Cipher"]( -/// http://library.isical.ac.in:8080/jspui/bitstream/123456789/6636/1/TH431.pdf). -/// -/// [^5]: Internet Engineering Task Force (February 2015), -/// ["Prohibiting RC4 Cipher Suites"](https://tools.ietf.org/html/rfc7465). -/// -/// [`BlockRng`]: ../../../rand_core/block/struct.BlockRng.html -/// [`RngCore`]: ../../trait.RngCore.html -#[derive(Clone, Debug)] -pub struct Hc128Rng(BlockRng); - -impl RngCore for Hc128Rng { - #[inline(always)] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest) - } - - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -impl SeedableRng for Hc128Rng { - type Seed = ::Seed; - - fn from_seed(seed: Self::Seed) -> Self { - Hc128Rng(BlockRng::::from_seed(seed)) - } - - fn from_rng(rng: R) -> Result { - BlockRng::::from_rng(rng).map(Hc128Rng) - } -} - -impl CryptoRng for Hc128Rng {} - -/// The core of `Hc128Rng`, used with `BlockRng`. -#[derive(Clone)] -pub struct Hc128Core { - t: [u32; 1024], - counter1024: usize, -} - -// Custom Debug implementation that does not expose the internal state -impl fmt::Debug for Hc128Core { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "Hc128Core {{}}") - } -} - -impl BlockRngCore for Hc128Core { - type Item = u32; - type Results = [u32; 16]; - - fn generate(&mut self, results: &mut Self::Results) { - assert!(self.counter1024 % 16 == 0); - - let cc = self.counter1024 % 512; - let dd = (cc + 16) % 512; - let ee = cc.wrapping_sub(16) % 512; - - if self.counter1024 & 512 == 0 { - // P block - results[0] = self.step_p(cc+0, cc+1, ee+13, ee+6, ee+4); - results[1] = self.step_p(cc+1, cc+2, ee+14, ee+7, ee+5); - results[2] = self.step_p(cc+2, cc+3, ee+15, ee+8, ee+6); - results[3] = self.step_p(cc+3, cc+4, cc+0, ee+9, ee+7); - results[4] = self.step_p(cc+4, cc+5, cc+1, ee+10, ee+8); - results[5] = self.step_p(cc+5, cc+6, cc+2, ee+11, ee+9); - results[6] = self.step_p(cc+6, cc+7, cc+3, ee+12, ee+10); - results[7] = self.step_p(cc+7, cc+8, cc+4, ee+13, ee+11); - results[8] = self.step_p(cc+8, cc+9, cc+5, ee+14, ee+12); - results[9] = self.step_p(cc+9, cc+10, cc+6, ee+15, ee+13); - results[10] = self.step_p(cc+10, cc+11, cc+7, cc+0, ee+14); - results[11] = self.step_p(cc+11, cc+12, cc+8, cc+1, ee+15); - results[12] = self.step_p(cc+12, cc+13, cc+9, cc+2, cc+0); - results[13] = self.step_p(cc+13, cc+14, cc+10, cc+3, cc+1); - results[14] = self.step_p(cc+14, cc+15, cc+11, cc+4, cc+2); - results[15] = self.step_p(cc+15, dd+0, cc+12, cc+5, cc+3); - } else { - // Q block - results[0] = self.step_q(cc+0, cc+1, ee+13, ee+6, ee+4); - results[1] = self.step_q(cc+1, cc+2, ee+14, ee+7, ee+5); - results[2] = self.step_q(cc+2, cc+3, ee+15, ee+8, ee+6); - results[3] = self.step_q(cc+3, cc+4, cc+0, ee+9, ee+7); - results[4] = self.step_q(cc+4, cc+5, cc+1, ee+10, ee+8); - results[5] = self.step_q(cc+5, cc+6, cc+2, ee+11, ee+9); - results[6] = self.step_q(cc+6, cc+7, cc+3, ee+12, ee+10); - results[7] = self.step_q(cc+7, cc+8, cc+4, ee+13, ee+11); - results[8] = self.step_q(cc+8, cc+9, cc+5, ee+14, ee+12); - results[9] = self.step_q(cc+9, cc+10, cc+6, ee+15, ee+13); - results[10] = self.step_q(cc+10, cc+11, cc+7, cc+0, ee+14); - results[11] = self.step_q(cc+11, cc+12, cc+8, cc+1, ee+15); - results[12] = self.step_q(cc+12, cc+13, cc+9, cc+2, cc+0); - results[13] = self.step_q(cc+13, cc+14, cc+10, cc+3, cc+1); - results[14] = self.step_q(cc+14, cc+15, cc+11, cc+4, cc+2); - results[15] = self.step_q(cc+15, dd+0, cc+12, cc+5, cc+3); - } - self.counter1024 = self.counter1024.wrapping_add(16); - } -} - -impl Hc128Core { - // One step of HC-128, update P and generate 32 bits keystream - #[inline(always)] - fn step_p(&mut self, i: usize, i511: usize, i3: usize, i10: usize, i12: usize) - -> u32 - { - let (p, q) = self.t.split_at_mut(512); - // FIXME: it would be great if we the bounds checks here could be - // optimized out, and we would not need unsafe. - // This improves performance by about 7%. - unsafe { - let temp0 = p.get_unchecked(i511).rotate_right(23); - let temp1 = p.get_unchecked(i3).rotate_right(10); - let temp2 = p.get_unchecked(i10).rotate_right(8); - *p.get_unchecked_mut(i) = p.get_unchecked(i) - .wrapping_add(temp2) - .wrapping_add(temp0 ^ temp1); - let temp3 = { - // The h1 function in HC-128 - let a = *p.get_unchecked(i12) as u8; - let c = (p.get_unchecked(i12) >> 16) as u8; - q[a as usize].wrapping_add(q[256 + c as usize]) - }; - temp3 ^ p.get_unchecked(i) - } - } - - // One step of HC-128, update Q and generate 32 bits keystream - // Similar to `step_p`, but `p` and `q` are swapped, and the rotates are to - // the left instead of to the right. - #[inline(always)] - fn step_q(&mut self, i: usize, i511: usize, i3: usize, i10: usize, i12: usize) - -> u32 - { - let (p, q) = self.t.split_at_mut(512); - unsafe { - let temp0 = q.get_unchecked(i511).rotate_left(23); - let temp1 = q.get_unchecked(i3).rotate_left(10); - let temp2 = q.get_unchecked(i10).rotate_left(8); - *q.get_unchecked_mut(i) = q.get_unchecked(i) - .wrapping_add(temp2) - .wrapping_add(temp0 ^ temp1); - let temp3 = { - // The h2 function in HC-128 - let a = *q.get_unchecked(i12) as u8; - let c = (q.get_unchecked(i12) >> 16) as u8; - p[a as usize].wrapping_add(p[256 + c as usize]) - }; - temp3 ^ q.get_unchecked(i) - } - } - - fn sixteen_steps(&mut self) { - assert!(self.counter1024 % 16 == 0); - - let cc = self.counter1024 % 512; - let dd = (cc + 16) % 512; - let ee = cc.wrapping_sub(16) % 512; - - if self.counter1024 < 512 { - // P block - self.t[cc+0] = self.step_p(cc+0, cc+1, ee+13, ee+6, ee+4); - self.t[cc+1] = self.step_p(cc+1, cc+2, ee+14, ee+7, ee+5); - self.t[cc+2] = self.step_p(cc+2, cc+3, ee+15, ee+8, ee+6); - self.t[cc+3] = self.step_p(cc+3, cc+4, cc+0, ee+9, ee+7); - self.t[cc+4] = self.step_p(cc+4, cc+5, cc+1, ee+10, ee+8); - self.t[cc+5] = self.step_p(cc+5, cc+6, cc+2, ee+11, ee+9); - self.t[cc+6] = self.step_p(cc+6, cc+7, cc+3, ee+12, ee+10); - self.t[cc+7] = self.step_p(cc+7, cc+8, cc+4, ee+13, ee+11); - self.t[cc+8] = self.step_p(cc+8, cc+9, cc+5, ee+14, ee+12); - self.t[cc+9] = self.step_p(cc+9, cc+10, cc+6, ee+15, ee+13); - self.t[cc+10] = self.step_p(cc+10, cc+11, cc+7, cc+0, ee+14); - self.t[cc+11] = self.step_p(cc+11, cc+12, cc+8, cc+1, ee+15); - self.t[cc+12] = self.step_p(cc+12, cc+13, cc+9, cc+2, cc+0); - self.t[cc+13] = self.step_p(cc+13, cc+14, cc+10, cc+3, cc+1); - self.t[cc+14] = self.step_p(cc+14, cc+15, cc+11, cc+4, cc+2); - self.t[cc+15] = self.step_p(cc+15, dd+0, cc+12, cc+5, cc+3); - } else { - // Q block - self.t[cc+512+0] = self.step_q(cc+0, cc+1, ee+13, ee+6, ee+4); - self.t[cc+512+1] = self.step_q(cc+1, cc+2, ee+14, ee+7, ee+5); - self.t[cc+512+2] = self.step_q(cc+2, cc+3, ee+15, ee+8, ee+6); - self.t[cc+512+3] = self.step_q(cc+3, cc+4, cc+0, ee+9, ee+7); - self.t[cc+512+4] = self.step_q(cc+4, cc+5, cc+1, ee+10, ee+8); - self.t[cc+512+5] = self.step_q(cc+5, cc+6, cc+2, ee+11, ee+9); - self.t[cc+512+6] = self.step_q(cc+6, cc+7, cc+3, ee+12, ee+10); - self.t[cc+512+7] = self.step_q(cc+7, cc+8, cc+4, ee+13, ee+11); - self.t[cc+512+8] = self.step_q(cc+8, cc+9, cc+5, ee+14, ee+12); - self.t[cc+512+9] = self.step_q(cc+9, cc+10, cc+6, ee+15, ee+13); - self.t[cc+512+10] = self.step_q(cc+10, cc+11, cc+7, cc+0, ee+14); - self.t[cc+512+11] = self.step_q(cc+11, cc+12, cc+8, cc+1, ee+15); - self.t[cc+512+12] = self.step_q(cc+12, cc+13, cc+9, cc+2, cc+0); - self.t[cc+512+13] = self.step_q(cc+13, cc+14, cc+10, cc+3, cc+1); - self.t[cc+512+14] = self.step_q(cc+14, cc+15, cc+11, cc+4, cc+2); - self.t[cc+512+15] = self.step_q(cc+15, dd+0, cc+12, cc+5, cc+3); - } - self.counter1024 += 16; - } - - // Initialize an HC-128 random number generator. The seed has to be - // 256 bits in length (`[u32; 8]`), matching the 128 bit `key` followed by - // 128 bit `iv` when HC-128 where to be used as a stream cipher. - fn init(seed: [u32; SEED_WORDS]) -> Self { - #[inline] - fn f1(x: u32) -> u32 { - x.rotate_right(7) ^ x.rotate_right(18) ^ (x >> 3) - } - - #[inline] - fn f2(x: u32) -> u32 { - x.rotate_right(17) ^ x.rotate_right(19) ^ (x >> 10) - } - - let mut t = [0u32; 1024]; - - // Expand the key and iv into P and Q - let (key, iv) = seed.split_at(4); - t[..4].copy_from_slice(key); - t[4..8].copy_from_slice(key); - t[8..12].copy_from_slice(iv); - t[12..16].copy_from_slice(iv); - - // Generate the 256 intermediate values W[16] ... W[256+16-1], and - // copy the last 16 generated values to the start op P. - for i in 16..256+16 { - t[i] = f2(t[i-2]).wrapping_add(t[i-7]).wrapping_add(f1(t[i-15])) - .wrapping_add(t[i-16]).wrapping_add(i as u32); - } - { - let (p1, p2) = t.split_at_mut(256); - p1[0..16].copy_from_slice(&p2[0..16]); - } - - // Generate both the P and Q tables - for i in 16..1024 { - t[i] = f2(t[i-2]).wrapping_add(t[i-7]).wrapping_add(f1(t[i-15])) - .wrapping_add(t[i-16]).wrapping_add(256 + i as u32); - } - - let mut core = Self { t, counter1024: 0 }; - - // run the cipher 1024 steps - for _ in 0..64 { core.sixteen_steps() }; - core.counter1024 = 0; - core - } -} - -impl SeedableRng for Hc128Core { - type Seed = [u8; SEED_WORDS*4]; - - /// Create an HC-128 random number generator with a seed. The seed has to be - /// 256 bits in length, matching the 128 bit `key` followed by 128 bit `iv` - /// when HC-128 where to be used as a stream cipher. - fn from_seed(seed: Self::Seed) -> Self { - let mut seed_u32 = [0u32; SEED_WORDS]; - le::read_u32_into(&seed, &mut seed_u32); - Self::init(seed_u32) - } -} - -impl CryptoRng for Hc128Core {} - -#[cfg(test)] -mod test { - use {RngCore, SeedableRng}; - use super::Hc128Rng; - - #[test] - // Test vector 1 from the paper "The Stream Cipher HC-128" - fn test_hc128_true_values_a() { - let seed = [0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // key - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; // iv - let mut rng = Hc128Rng::from_seed(seed); - - let mut results = [0u32; 16]; - for i in results.iter_mut() { *i = rng.next_u32(); } - let expected = [0x73150082, 0x3bfd03a0, 0xfb2fd77f, 0xaa63af0e, - 0xde122fc6, 0xa7dc29b6, 0x62a68527, 0x8b75ec68, - 0x9036db1e, 0x81896005, 0x00ade078, 0x491fbf9a, - 0x1cdc3013, 0x6c3d6e24, 0x90f664b2, 0x9cd57102]; - assert_eq!(results, expected); - } - - #[test] - // Test vector 2 from the paper "The Stream Cipher HC-128" - fn test_hc128_true_values_b() { - let seed = [0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // key - 1,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; // iv - let mut rng = Hc128Rng::from_seed(seed); - - let mut results = [0u32; 16]; - for i in results.iter_mut() { *i = rng.next_u32(); } - let expected = [0xc01893d5, 0xb7dbe958, 0x8f65ec98, 0x64176604, - 0x36fc6724, 0xc82c6eec, 0x1b1c38a7, 0xc9b42a95, - 0x323ef123, 0x0a6a908b, 0xce757b68, 0x9f14f7bb, - 0xe4cde011, 0xaeb5173f, 0x89608c94, 0xb5cf46ca]; - assert_eq!(results, expected); - } - - #[test] - // Test vector 3 from the paper "The Stream Cipher HC-128" - fn test_hc128_true_values_c() { - let seed = [0x55,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // key - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; // iv - let mut rng = Hc128Rng::from_seed(seed); - - let mut results = [0u32; 16]; - for i in results.iter_mut() { *i = rng.next_u32(); } - let expected = [0x518251a4, 0x04b4930a, 0xb02af931, 0x0639f032, - 0xbcb4a47a, 0x5722480b, 0x2bf99f72, 0xcdc0e566, - 0x310f0c56, 0xd3cc83e8, 0x663db8ef, 0x62dfe07f, - 0x593e1790, 0xc5ceaa9c, 0xab03806f, 0xc9a6e5a0]; - assert_eq!(results, expected); - } - - #[test] - fn test_hc128_true_values_u64() { - let seed = [0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // key - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; // iv - let mut rng = Hc128Rng::from_seed(seed); - - let mut results = [0u64; 8]; - for i in results.iter_mut() { *i = rng.next_u64(); } - let expected = [0x3bfd03a073150082, 0xaa63af0efb2fd77f, - 0xa7dc29b6de122fc6, 0x8b75ec6862a68527, - 0x818960059036db1e, 0x491fbf9a00ade078, - 0x6c3d6e241cdc3013, 0x9cd5710290f664b2]; - assert_eq!(results, expected); - - // The RNG operates in a P block of 512 results and next a Q block. - // After skipping 2*800 u32 results we end up somewhere in the Q block - // of the second round - for _ in 0..800 { rng.next_u64(); } - - for i in results.iter_mut() { *i = rng.next_u64(); } - let expected = [0xd8c4d6ca84d0fc10, 0xf16a5d91dc66e8e7, - 0xd800de5bc37a8653, 0x7bae1f88c0dfbb4c, - 0x3bfe1f374e6d4d14, 0x424b55676be3fa06, - 0xe3a1e8758cbff579, 0x417f7198c5652bcd]; - assert_eq!(results, expected); - } - - #[test] - fn test_hc128_true_values_bytes() { - let seed = [0x55,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // key - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; // iv - let mut rng = Hc128Rng::from_seed(seed); - let expected = [0x31, 0xf9, 0x2a, 0xb0, 0x32, 0xf0, 0x39, 0x06, - 0x7a, 0xa4, 0xb4, 0xbc, 0x0b, 0x48, 0x22, 0x57, - 0x72, 0x9f, 0xf9, 0x2b, 0x66, 0xe5, 0xc0, 0xcd, - 0x56, 0x0c, 0x0f, 0x31, 0xe8, 0x83, 0xcc, 0xd3, - 0xef, 0xb8, 0x3d, 0x66, 0x7f, 0xe0, 0xdf, 0x62, - 0x90, 0x17, 0x3e, 0x59, 0x9c, 0xaa, 0xce, 0xc5, - 0x6f, 0x80, 0x03, 0xab, 0xa0, 0xe5, 0xa6, 0xc9, - 0x60, 0x95, 0x84, 0x7a, 0xa5, 0x68, 0x5a, 0x84, - 0xea, 0xd5, 0xf3, 0xea, 0x73, 0xa9, 0xad, 0x01, - 0x79, 0x7d, 0xbe, 0x9f, 0xea, 0xe3, 0xf9, 0x74, - 0x0e, 0xda, 0x2f, 0xa0, 0xe4, 0x7b, 0x4b, 0x1b, - 0xdd, 0x17, 0x69, 0x4a, 0xfe, 0x9f, 0x56, 0x95, - 0xad, 0x83, 0x6b, 0x9d, 0x60, 0xa1, 0x99, 0x96, - 0x90, 0x00, 0x66, 0x7f, 0xfa, 0x7e, 0x65, 0xe9, - 0xac, 0x8b, 0x92, 0x34, 0x77, 0xb4, 0x23, 0xd0, - 0xb9, 0xab, 0xb1, 0x47, 0x7d, 0x4a, 0x13, 0x0a]; - - // Pick a somewhat large buffer so we can test filling with the - // remainder from `state.results`, directly filling the buffer, and - // filling the remainder of the buffer. - let mut buffer = [0u8; 16*4*2]; - // Consume a value so that we have a remainder. - assert!(rng.next_u64() == 0x04b4930a518251a4); - rng.fill_bytes(&mut buffer); - - // [u8; 128] doesn't implement PartialEq - assert_eq!(buffer.len(), expected.len()); - for (b, e) in buffer.iter().zip(expected.iter()) { - assert_eq!(b, e); - } - } - - #[test] - fn test_hc128_clone() { - let seed = [0x55,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // key - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; // iv - let mut rng1 = Hc128Rng::from_seed(seed); - let mut rng2 = rng1.clone(); - for _ in 0..16 { - assert_eq!(rng1.next_u32(), rng2.next_u32()); - } - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/prng/isaac64.rs cargo-0.37.0/vendor/rand-0.5.6/src/prng/isaac64.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/prng/isaac64.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/prng/isaac64.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,491 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The ISAAC-64 random number generator. - -use core::{fmt, slice}; -use core::num::Wrapping as w; -use rand_core::{RngCore, SeedableRng, Error, le}; -use rand_core::block::{BlockRngCore, BlockRng64}; -use prng::isaac_array::IsaacArray; - -#[allow(non_camel_case_types)] -type w64 = w; - -const RAND_SIZE_LEN: usize = 8; -const RAND_SIZE: usize = 1 << RAND_SIZE_LEN; - -/// A random number generator that uses ISAAC-64, the 64-bit variant of the -/// ISAAC algorithm. -/// -/// ISAAC stands for "Indirection, Shift, Accumulate, Add, and Count" which are -/// the principal bitwise operations employed. It is the most advanced of a -/// series of array based random number generator designed by Robert Jenkins -/// in 1996[^1]. -/// -/// ISAAC-64 is mostly similar to ISAAC. Because it operates on 64-bit integers -/// instead of 32-bit, it uses twice as much memory to hold its state and -/// results. Also it uses different constants for shifts and indirect indexing, -/// optimized to give good results for 64bit arithmetic. -/// -/// ISAAC-64 is notably fast and produces excellent quality random numbers for -/// non-cryptographic applications. -/// -/// In spite of being designed with cryptographic security in mind, ISAAC hasn't -/// been stringently cryptanalyzed and thus cryptographers do not not -/// consensually trust it to be secure. When looking for a secure RNG, prefer -/// [`Hc128Rng`] instead, which, like ISAAC, is an array-based RNG and one of -/// the stream-ciphers selected the by eSTREAM contest. -/// -/// ## Overview of the ISAAC-64 algorithm: -/// (in pseudo-code) -/// -/// ```text -/// Input: a, b, c, s[256] // state -/// Output: r[256] // results -/// -/// mix(a,i) = !(a ^ a << 21) if i = 0 mod 4 -/// a ^ a >> 5 if i = 1 mod 4 -/// a ^ a << 12 if i = 2 mod 4 -/// a ^ a >> 33 if i = 3 mod 4 -/// -/// c = c + 1 -/// b = b + c -/// -/// for i in 0..256 { -/// x = s_[i] -/// a = mix(a,i) + s[i+128 mod 256] -/// y = a + b + s[x>>3 mod 256] -/// s[i] = y -/// b = x + s[y>>11 mod 256] -/// r[i] = b -/// } -/// ``` -/// -/// This implementation uses [`BlockRng64`] to implement the [`RngCore`] methods. -/// -/// See for more information the documentation of [`IsaacRng`]. -/// -/// [^1]: Bob Jenkins, [*ISAAC and RC4*]( -/// http://burtleburtle.net/bob/rand/isaac.html) -/// -/// [`IsaacRng`]: ../isaac/struct.IsaacRng.html -/// [`Hc128Rng`]: ../hc128/struct.Hc128Rng.html -/// [`BlockRng64`]: ../../../rand_core/block/struct.BlockRng64.html -/// [`RngCore`]: ../../trait.RngCore.html -#[derive(Clone, Debug)] -#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))] -pub struct Isaac64Rng(BlockRng64); - -impl RngCore for Isaac64Rng { - #[inline(always)] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest) - } - - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -impl SeedableRng for Isaac64Rng { - type Seed = ::Seed; - - fn from_seed(seed: Self::Seed) -> Self { - Isaac64Rng(BlockRng64::::from_seed(seed)) - } - - /// Create an ISAAC random number generator using an `u64` as seed. - /// If `seed == 0` this will produce the same stream of random numbers as - /// the reference implementation when used unseeded. - fn seed_from_u64(seed: u64) -> Self { - Isaac64Rng(BlockRng64::::seed_from_u64(seed)) - } - - fn from_rng(rng: S) -> Result { - BlockRng64::::from_rng(rng).map(|rng| Isaac64Rng(rng)) - } -} - -impl Isaac64Rng { - /// Create a 64-bit ISAAC random number generator using the - /// default fixed seed. - /// - /// DEPRECATED. `Isaac64Rng::new_from_u64(0)` will produce identical results. - #[deprecated(since="0.5.0", note="use the FromEntropy or SeedableRng trait")] - pub fn new_unseeded() -> Self { - Self::seed_from_u64(0) - } - - /// Create an ISAAC-64 random number generator using an `u64` as seed. - /// If `seed == 0` this will produce the same stream of random numbers as - /// the reference implementation when used unseeded. - #[deprecated(since="0.6.0", note="use SeedableRng::seed_from_u64 instead")] - pub fn new_from_u64(seed: u64) -> Self { - Self::seed_from_u64(seed) - } -} - -/// The core of `Isaac64Rng`, used with `BlockRng`. -#[derive(Clone)] -#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))] -pub struct Isaac64Core { - #[cfg_attr(feature="serde1",serde(with="super::isaac_array::isaac_array_serde"))] - mem: [w64; RAND_SIZE], - a: w64, - b: w64, - c: w64, -} - -// Custom Debug implementation that does not expose the internal state -impl fmt::Debug for Isaac64Core { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "Isaac64Core {{}}") - } -} - -impl BlockRngCore for Isaac64Core { - type Item = u64; - type Results = IsaacArray; - - /// Refills the output buffer, `results`. See also the pseudocode desciption - /// of the algorithm in the [`Isaac64Rng`] documentation. - /// - /// Optimisations used (similar to the reference implementation): - /// - /// - The loop is unrolled 4 times, once for every constant of mix(). - /// - The contents of the main loop are moved to a function `rngstep`, to - /// reduce code duplication. - /// - We use local variables for a and b, which helps with optimisations. - /// - We split the main loop in two, one that operates over 0..128 and one - /// over 128..256. This way we can optimise out the addition and modulus - /// from `s[i+128 mod 256]`. - /// - We maintain one index `i` and add `m` or `m2` as base (m2 for the - /// `s[i+128 mod 256]`), relying on the optimizer to turn it into pointer - /// arithmetic. - /// - We fill `results` backwards. The reference implementation reads values - /// from `results` in reverse. We read them in the normal direction, to - /// make `fill_bytes` a memcopy. To maintain compatibility we fill in - /// reverse. - /// - /// [`Isaac64Rng`]: struct.Isaac64Rng.html - fn generate(&mut self, results: &mut IsaacArray) { - self.c += w(1); - // abbreviations - let mut a = self.a; - let mut b = self.b + self.c; - const MIDPOINT: usize = RAND_SIZE / 2; - - #[inline] - fn ind(mem:&[w64; RAND_SIZE], v: w64, amount: usize) -> w64 { - let index = (v >> amount).0 as usize % RAND_SIZE; - mem[index] - } - - #[inline] - fn rngstep(mem: &mut [w64; RAND_SIZE], - results: &mut [u64; RAND_SIZE], - mix: w64, - a: &mut w64, - b: &mut w64, - base: usize, - m: usize, - m2: usize) { - let x = mem[base + m]; - *a = mix + mem[base + m2]; - let y = *a + *b + ind(&mem, x, 3); - mem[base + m] = y; - *b = x + ind(&mem, y, 3 + RAND_SIZE_LEN); - results[RAND_SIZE - 1 - base - m] = (*b).0; - } - - let mut m = 0; - let mut m2 = MIDPOINT; - for i in (0..MIDPOINT/4).map(|i| i * 4) { - rngstep(&mut self.mem, results, !(a ^ (a << 21)), &mut a, &mut b, i + 0, m, m2); - rngstep(&mut self.mem, results, a ^ (a >> 5 ), &mut a, &mut b, i + 1, m, m2); - rngstep(&mut self.mem, results, a ^ (a << 12), &mut a, &mut b, i + 2, m, m2); - rngstep(&mut self.mem, results, a ^ (a >> 33), &mut a, &mut b, i + 3, m, m2); - } - - m = MIDPOINT; - m2 = 0; - for i in (0..MIDPOINT/4).map(|i| i * 4) { - rngstep(&mut self.mem, results, !(a ^ (a << 21)), &mut a, &mut b, i + 0, m, m2); - rngstep(&mut self.mem, results, a ^ (a >> 5 ), &mut a, &mut b, i + 1, m, m2); - rngstep(&mut self.mem, results, a ^ (a << 12), &mut a, &mut b, i + 2, m, m2); - rngstep(&mut self.mem, results, a ^ (a >> 33), &mut a, &mut b, i + 3, m, m2); - } - - self.a = a; - self.b = b; - } -} - -impl Isaac64Core { - /// Create a new ISAAC-64 random number generator. - fn init(mut mem: [w64; RAND_SIZE], rounds: u32) -> Self { - fn mix(a: &mut w64, b: &mut w64, c: &mut w64, d: &mut w64, - e: &mut w64, f: &mut w64, g: &mut w64, h: &mut w64) { - *a -= *e; *f ^= *h >> 9; *h += *a; - *b -= *f; *g ^= *a << 9; *a += *b; - *c -= *g; *h ^= *b >> 23; *b += *c; - *d -= *h; *a ^= *c << 15; *c += *d; - *e -= *a; *b ^= *d >> 14; *d += *e; - *f -= *b; *c ^= *e << 20; *e += *f; - *g -= *c; *d ^= *f >> 17; *f += *g; - *h -= *d; *e ^= *g << 14; *g += *h; - } - - // These numbers are the result of initializing a...h with the - // fractional part of the golden ratio in binary (0x9e3779b97f4a7c13) - // and applying mix() 4 times. - let mut a = w(0x647c4677a2884b7c); - let mut b = w(0xb9f8b322c73ac862); - let mut c = w(0x8c0ea5053d4712a0); - let mut d = w(0xb29b2e824a595524); - let mut e = w(0x82f053db8355e0ce); - let mut f = w(0x48fe4a0fa5a09315); - let mut g = w(0xae985bf2cbfc89ed); - let mut h = w(0x98f5704f6c44c0ab); - - // Normally this should do two passes, to make all of the seed effect - // all of `mem` - for _ in 0..rounds { - for i in (0..RAND_SIZE/8).map(|i| i * 8) { - a += mem[i ]; b += mem[i+1]; - c += mem[i+2]; d += mem[i+3]; - e += mem[i+4]; f += mem[i+5]; - g += mem[i+6]; h += mem[i+7]; - mix(&mut a, &mut b, &mut c, &mut d, - &mut e, &mut f, &mut g, &mut h); - mem[i ] = a; mem[i+1] = b; - mem[i+2] = c; mem[i+3] = d; - mem[i+4] = e; mem[i+5] = f; - mem[i+6] = g; mem[i+7] = h; - } - } - - Self { mem, a: w(0), b: w(0), c: w(0) } - } - - /// Create an ISAAC-64 random number generator using an `u64` as seed. - /// If `seed == 0` this will produce the same stream of random numbers as - /// the reference implementation when used unseeded. - #[deprecated(since="0.6.0", note="use SeedableRng::seed_from_u64 instead")] - pub fn new_from_u64(seed: u64) -> Self { - Self::seed_from_u64(seed) - } -} - -impl SeedableRng for Isaac64Core { - type Seed = [u8; 32]; - - fn from_seed(seed: Self::Seed) -> Self { - let mut seed_u64 = [0u64; 4]; - le::read_u64_into(&seed, &mut seed_u64); - // Convert the seed to `Wrapping` and zero-extend to `RAND_SIZE`. - let mut seed_extended = [w(0); RAND_SIZE]; - for (x, y) in seed_extended.iter_mut().zip(seed_u64.iter()) { - *x = w(*y); - } - Self::init(seed_extended, 2) - } - - fn seed_from_u64(seed: u64) -> Self { - let mut key = [w(0); RAND_SIZE]; - key[0] = w(seed); - // Initialize with only one pass. - // A second pass does not improve the quality here, because all of the - // seed was already available in the first round. - // Not doing the second pass has the small advantage that if - // `seed == 0` this method produces exactly the same state as the - // reference implementation when used unseeded. - Self::init(key, 1) - } - - fn from_rng(mut rng: R) -> Result { - // Custom `from_rng` implementation that fills a seed with the same size - // as the entire state. - let mut seed = [w(0u64); RAND_SIZE]; - unsafe { - let ptr = seed.as_mut_ptr() as *mut u8; - let slice = slice::from_raw_parts_mut(ptr, RAND_SIZE * 8); - rng.try_fill_bytes(slice)?; - } - for i in seed.iter_mut() { - *i = w(i.0.to_le()); - } - - Ok(Self::init(seed, 2)) - } -} - -#[cfg(test)] -mod test { - use {RngCore, SeedableRng}; - use super::Isaac64Rng; - - #[test] - fn test_isaac64_construction() { - // Test that various construction techniques produce a working RNG. - let seed = [1,0,0,0, 23,0,0,0, 200,1,0,0, 210,30,0,0, - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; - let mut rng1 = Isaac64Rng::from_seed(seed); - assert_eq!(rng1.next_u64(), 14964555543728284049); - - let mut rng2 = Isaac64Rng::from_rng(rng1).unwrap(); - assert_eq!(rng2.next_u64(), 919595328260451758); - } - - #[test] - fn test_isaac64_true_values_64() { - let seed = [1,0,0,0, 0,0,0,0, 23,0,0,0, 0,0,0,0, - 200,1,0,0, 0,0,0,0, 210,30,0,0, 0,0,0,0]; - let mut rng1 = Isaac64Rng::from_seed(seed); - let mut results = [0u64; 10]; - for i in results.iter_mut() { *i = rng1.next_u64(); } - let expected = [ - 15071495833797886820, 7720185633435529318, - 10836773366498097981, 5414053799617603544, - 12890513357046278984, 17001051845652595546, - 9240803642279356310, 12558996012687158051, - 14673053937227185542, 1677046725350116783]; - assert_eq!(results, expected); - - let seed = [57,48,0,0, 0,0,0,0, 50,9,1,0, 0,0,0,0, - 49,212,0,0, 0,0,0,0, 148,38,0,0, 0,0,0,0]; - let mut rng2 = Isaac64Rng::from_seed(seed); - // skip forward to the 10000th number - for _ in 0..10000 { rng2.next_u64(); } - - for i in results.iter_mut() { *i = rng2.next_u64(); } - let expected = [ - 18143823860592706164, 8491801882678285927, 2699425367717515619, - 17196852593171130876, 2606123525235546165, 15790932315217671084, - 596345674630742204, 9947027391921273664, 11788097613744130851, - 10391409374914919106]; - assert_eq!(results, expected); - } - - #[test] - fn test_isaac64_true_values_32() { - let seed = [1,0,0,0, 0,0,0,0, 23,0,0,0, 0,0,0,0, - 200,1,0,0, 0,0,0,0, 210,30,0,0, 0,0,0,0]; - let mut rng = Isaac64Rng::from_seed(seed); - let mut results = [0u32; 12]; - for i in results.iter_mut() { *i = rng.next_u32(); } - // Subset of above values, as an LE u32 sequence - let expected = [ - 3477963620, 3509106075, - 687845478, 1797495790, - 227048253, 2523132918, - 4044335064, 1260557630, - 4079741768, 3001306521, - 69157722, 3958365844]; - assert_eq!(results, expected); - } - - #[test] - fn test_isaac64_true_values_mixed() { - let seed = [1,0,0,0, 0,0,0,0, 23,0,0,0, 0,0,0,0, - 200,1,0,0, 0,0,0,0, 210,30,0,0, 0,0,0,0]; - let mut rng = Isaac64Rng::from_seed(seed); - // Test alternating between `next_u64` and `next_u32` works as expected. - // Values are the same as `test_isaac64_true_values` and - // `test_isaac64_true_values_32`. - assert_eq!(rng.next_u64(), 15071495833797886820); - assert_eq!(rng.next_u32(), 687845478); - assert_eq!(rng.next_u32(), 1797495790); - assert_eq!(rng.next_u64(), 10836773366498097981); - assert_eq!(rng.next_u32(), 4044335064); - // Skip one u32 - assert_eq!(rng.next_u64(), 12890513357046278984); - assert_eq!(rng.next_u32(), 69157722); - } - - #[test] - fn test_isaac64_true_bytes() { - let seed = [1,0,0,0, 0,0,0,0, 23,0,0,0, 0,0,0,0, - 200,1,0,0, 0,0,0,0, 210,30,0,0, 0,0,0,0]; - let mut rng = Isaac64Rng::from_seed(seed); - let mut results = [0u8; 32]; - rng.fill_bytes(&mut results); - // Same as first values in test_isaac64_true_values as bytes in LE order - let expected = [100, 131, 77, 207, 155, 181, 40, 209, - 102, 176, 255, 40, 238, 155, 35, 107, - 61, 123, 136, 13, 246, 243, 99, 150, - 216, 167, 15, 241, 62, 149, 34, 75]; - assert_eq!(results, expected); - } - - #[test] - fn test_isaac64_new_uninitialized() { - // Compare the results from initializing `IsaacRng` with - // `seed_from_u64(0)`, to make sure it is the same as the reference - // implementation when used uninitialized. - // Note: We only test the first 16 integers, not the full 256 of the - // first block. - let mut rng = Isaac64Rng::seed_from_u64(0); - let mut results = [0u64; 16]; - for i in results.iter_mut() { *i = rng.next_u64(); } - let expected: [u64; 16] = [ - 0xF67DFBA498E4937C, 0x84A5066A9204F380, 0xFEE34BD5F5514DBB, - 0x4D1664739B8F80D6, 0x8607459AB52A14AA, 0x0E78BC5A98529E49, - 0xFE5332822AD13777, 0x556C27525E33D01A, 0x08643CA615F3149F, - 0xD0771FAF3CB04714, 0x30E86F68A37B008D, 0x3074EBC0488A3ADF, - 0x270645EA7A2790BC, 0x5601A0A8D3763C6A, 0x2F83071F53F325DD, - 0xB9090F3D42D2D2EA]; - assert_eq!(results, expected); - } - - #[test] - fn test_isaac64_clone() { - let seed = [1,0,0,0, 0,0,0,0, 23,0,0,0, 0,0,0,0, - 200,1,0,0, 0,0,0,0, 210,30,0,0, 0,0,0,0]; - let mut rng1 = Isaac64Rng::from_seed(seed); - let mut rng2 = rng1.clone(); - for _ in 0..16 { - assert_eq!(rng1.next_u64(), rng2.next_u64()); - } - } - - #[test] - #[cfg(all(feature="serde1", feature="std"))] - fn test_isaac64_serde() { - use bincode; - use std::io::{BufWriter, BufReader}; - - let seed = [1,0,0,0, 23,0,0,0, 200,1,0,0, 210,30,0,0, - 57,48,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; - let mut rng = Isaac64Rng::from_seed(seed); - - let buf: Vec = Vec::new(); - let mut buf = BufWriter::new(buf); - bincode::serialize_into(&mut buf, &rng).expect("Could not serialize"); - - let buf = buf.into_inner().unwrap(); - let mut read = BufReader::new(&buf[..]); - let mut deserialized: Isaac64Rng = bincode::deserialize_from(&mut read).expect("Could not deserialize"); - - for _ in 0..300 { // more than the 256 buffered results - assert_eq!(rng.next_u64(), deserialized.next_u64()); - } - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/prng/isaac_array.rs cargo-0.37.0/vendor/rand-0.5.6/src/prng/isaac_array.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/prng/isaac_array.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/prng/isaac_array.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,137 +0,0 @@ -// Copyright 2017-2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! ISAAC helper functions for 256-element arrays. - -// Terrible workaround because arrays with more than 32 elements do not -// implement `AsRef`, `Default`, `Serialize`, `Deserialize`, or any other -// traits for that matter. - -#[cfg(feature="serde1")] use serde::{Serialize, Deserialize}; - -const RAND_SIZE_LEN: usize = 8; -const RAND_SIZE: usize = 1 << RAND_SIZE_LEN; - - -#[derive(Copy, Clone)] -#[allow(missing_debug_implementations)] -#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))] -pub struct IsaacArray { - #[cfg_attr(feature="serde1",serde(with="isaac_array_serde"))] - #[cfg_attr(feature="serde1", serde(bound( - serialize = "T: Serialize", - deserialize = "T: Deserialize<'de> + Copy + Default")))] - inner: [T; RAND_SIZE] -} - -impl ::core::convert::AsRef<[T]> for IsaacArray { - #[inline(always)] - fn as_ref(&self) -> &[T] { - &self.inner[..] - } -} - -impl ::core::convert::AsMut<[T]> for IsaacArray { - #[inline(always)] - fn as_mut(&mut self) -> &mut [T] { - &mut self.inner[..] - } -} - -impl ::core::ops::Deref for IsaacArray { - type Target = [T; RAND_SIZE]; - #[inline(always)] - fn deref(&self) -> &Self::Target { - &self.inner - } -} - -impl ::core::ops::DerefMut for IsaacArray { - #[inline(always)] - fn deref_mut(&mut self) -> &mut [T; RAND_SIZE] { - &mut self.inner - } -} - -impl ::core::default::Default for IsaacArray where T: Copy + Default { - fn default() -> IsaacArray { - IsaacArray { inner: [T::default(); RAND_SIZE] } - } -} - - -#[cfg(feature="serde1")] -pub(super) mod isaac_array_serde { - const RAND_SIZE_LEN: usize = 8; - const RAND_SIZE: usize = 1 << RAND_SIZE_LEN; - - use serde::{Deserialize, Deserializer, Serialize, Serializer}; - use serde::de::{Visitor,SeqAccess}; - use serde::de; - - use core::fmt; - - pub fn serialize(arr: &[T;RAND_SIZE], ser: S) -> Result - where - T: Serialize, - S: Serializer - { - use serde::ser::SerializeTuple; - - let mut seq = ser.serialize_tuple(RAND_SIZE)?; - - for e in arr.iter() { - seq.serialize_element(&e)?; - } - - seq.end() - } - - #[inline] - pub fn deserialize<'de, T, D>(de: D) -> Result<[T;RAND_SIZE], D::Error> - where - T: Deserialize<'de>+Default+Copy, - D: Deserializer<'de>, - { - use core::marker::PhantomData; - struct ArrayVisitor { - _pd: PhantomData, - }; - impl<'de,T> Visitor<'de> for ArrayVisitor - where - T: Deserialize<'de>+Default+Copy - { - type Value = [T; RAND_SIZE]; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("Isaac state array") - } - - #[inline] - fn visit_seq(self, mut seq: A) -> Result<[T; RAND_SIZE], A::Error> - where - A: SeqAccess<'de>, - { - let mut out = [Default::default();RAND_SIZE]; - - for i in 0..RAND_SIZE { - match seq.next_element()? { - Some(val) => out[i] = val, - None => return Err(de::Error::invalid_length(i, &self)), - }; - } - - Ok(out) - } - } - - de.deserialize_tuple(RAND_SIZE, ArrayVisitor{_pd: PhantomData}) - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/prng/isaac.rs cargo-0.37.0/vendor/rand-0.5.6/src/prng/isaac.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/prng/isaac.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/prng/isaac.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,494 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The ISAAC random number generator. - -use core::{fmt, slice}; -use core::num::Wrapping as w; -use rand_core::{RngCore, SeedableRng, Error, le}; -use rand_core::block::{BlockRngCore, BlockRng}; -use prng::isaac_array::IsaacArray; - -#[allow(non_camel_case_types)] -type w32 = w; - -const RAND_SIZE_LEN: usize = 8; -const RAND_SIZE: usize = 1 << RAND_SIZE_LEN; - -/// A random number generator that uses the ISAAC algorithm. -/// -/// ISAAC stands for "Indirection, Shift, Accumulate, Add, and Count" which are -/// the principal bitwise operations employed. It is the most advanced of a -/// series of array based random number generator designed by Robert Jenkins -/// in 1996[^1][^2]. -/// -/// ISAAC is notably fast and produces excellent quality random numbers for -/// non-cryptographic applications. -/// -/// In spite of being designed with cryptographic security in mind, ISAAC hasn't -/// been stringently cryptanalyzed and thus cryptographers do not not -/// consensually trust it to be secure. When looking for a secure RNG, prefer -/// [`Hc128Rng`] instead, which, like ISAAC, is an array-based RNG and one of -/// the stream-ciphers selected the by eSTREAM contest. -/// -/// In 2006 an improvement to ISAAC was suggested by Jean-Philippe Aumasson, -/// named ISAAC+[^3]. But because the specification is not complete, because -/// there is no good implementation, and because the suggested bias may not -/// exist, it is not implemented here. -/// -/// ## Overview of the ISAAC algorithm: -/// (in pseudo-code) -/// -/// ```text -/// Input: a, b, c, s[256] // state -/// Output: r[256] // results -/// -/// mix(a,i) = a ^ a << 13 if i = 0 mod 4 -/// a ^ a >> 6 if i = 1 mod 4 -/// a ^ a << 2 if i = 2 mod 4 -/// a ^ a >> 16 if i = 3 mod 4 -/// -/// c = c + 1 -/// b = b + c -/// -/// for i in 0..256 { -/// x = s_[i] -/// a = f(a,i) + s[i+128 mod 256] -/// y = a + b + s[x>>2 mod 256] -/// s[i] = y -/// b = x + s[y>>10 mod 256] -/// r[i] = b -/// } -/// ``` -/// -/// Numbers are generated in blocks of 256. This means the function above only -/// runs once every 256 times you ask for a next random number. In all other -/// circumstances the last element of the results array is returned. -/// -/// ISAAC therefore needs a lot of memory, relative to other non-crypto RNGs. -/// 2 * 256 * 4 = 2 kb to hold the state and results. -/// -/// This implementation uses [`BlockRng`] to implement the [`RngCore`] methods. -/// -/// ## References -/// [^1]: Bob Jenkins, [*ISAAC: A fast cryptographic random number generator*]( -/// http://burtleburtle.net/bob/rand/isaacafa.html) -/// -/// [^2]: Bob Jenkins, [*ISAAC and RC4*]( -/// http://burtleburtle.net/bob/rand/isaac.html) -/// -/// [^3]: Jean-Philippe Aumasson, [*On the pseudo-random generator ISAAC*]( -/// https://eprint.iacr.org/2006/438) -/// -/// [`Hc128Rng`]: ../hc128/struct.Hc128Rng.html -/// [`BlockRng`]: ../../../rand_core/block/struct.BlockRng.html -/// [`RngCore`]: ../../trait.RngCore.html -#[derive(Clone, Debug)] -#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))] -pub struct IsaacRng(BlockRng); - -impl RngCore for IsaacRng { - #[inline(always)] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest) - } - - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -impl SeedableRng for IsaacRng { - type Seed = ::Seed; - - fn from_seed(seed: Self::Seed) -> Self { - IsaacRng(BlockRng::::from_seed(seed)) - } - - /// Create an ISAAC random number generator using an `u64` as seed. - /// If `seed == 0` this will produce the same stream of random numbers as - /// the reference implementation when used unseeded. - fn seed_from_u64(seed: u64) -> Self { - IsaacRng(BlockRng::::seed_from_u64(seed)) - } - - fn from_rng(rng: S) -> Result { - BlockRng::::from_rng(rng).map(|rng| IsaacRng(rng)) - } -} - -impl IsaacRng { - /// Create an ISAAC random number generator using the default - /// fixed seed. - /// - /// DEPRECATED. `IsaacRng::new_from_u64(0)` will produce identical results. - #[deprecated(since="0.5.0", note="use the FromEntropy or SeedableRng trait")] - pub fn new_unseeded() -> Self { - Self::seed_from_u64(0) - } - - /// Create an ISAAC random number generator using an `u64` as seed. - /// If `seed == 0` this will produce the same stream of random numbers as - /// the reference implementation when used unseeded. - #[deprecated(since="0.6.0", note="use SeedableRng::seed_from_u64 instead")] - pub fn new_from_u64(seed: u64) -> Self { - Self::seed_from_u64(seed) - } -} - -/// The core of `IsaacRng`, used with `BlockRng`. -#[derive(Clone)] -#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))] -pub struct IsaacCore { - #[cfg_attr(feature="serde1",serde(with="super::isaac_array::isaac_array_serde"))] - mem: [w32; RAND_SIZE], - a: w32, - b: w32, - c: w32, -} - -// Custom Debug implementation that does not expose the internal state -impl fmt::Debug for IsaacCore { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "IsaacCore {{}}") - } -} - -impl BlockRngCore for IsaacCore { - type Item = u32; - type Results = IsaacArray; - - /// Refills the output buffer, `results`. See also the pseudocode desciption - /// of the algorithm in the [`IsaacRng`] documentation. - /// - /// Optimisations used (similar to the reference implementation): - /// - /// - The loop is unrolled 4 times, once for every constant of mix(). - /// - The contents of the main loop are moved to a function `rngstep`, to - /// reduce code duplication. - /// - We use local variables for a and b, which helps with optimisations. - /// - We split the main loop in two, one that operates over 0..128 and one - /// over 128..256. This way we can optimise out the addition and modulus - /// from `s[i+128 mod 256]`. - /// - We maintain one index `i` and add `m` or `m2` as base (m2 for the - /// `s[i+128 mod 256]`), relying on the optimizer to turn it into pointer - /// arithmetic. - /// - We fill `results` backwards. The reference implementation reads values - /// from `results` in reverse. We read them in the normal direction, to - /// make `fill_bytes` a memcopy. To maintain compatibility we fill in - /// reverse. - /// - /// [`IsaacRng`]: struct.IsaacRng.html - fn generate(&mut self, results: &mut IsaacArray) { - self.c += w(1); - // abbreviations - let mut a = self.a; - let mut b = self.b + self.c; - const MIDPOINT: usize = RAND_SIZE / 2; - - #[inline] - fn ind(mem:&[w32; RAND_SIZE], v: w32, amount: usize) -> w32 { - let index = (v >> amount).0 as usize % RAND_SIZE; - mem[index] - } - - #[inline] - fn rngstep(mem: &mut [w32; RAND_SIZE], - results: &mut [u32; RAND_SIZE], - mix: w32, - a: &mut w32, - b: &mut w32, - base: usize, - m: usize, - m2: usize) { - let x = mem[base + m]; - *a = mix + mem[base + m2]; - let y = *a + *b + ind(&mem, x, 2); - mem[base + m] = y; - *b = x + ind(&mem, y, 2 + RAND_SIZE_LEN); - results[RAND_SIZE - 1 - base - m] = (*b).0; - } - - let mut m = 0; - let mut m2 = MIDPOINT; - for i in (0..MIDPOINT/4).map(|i| i * 4) { - rngstep(&mut self.mem, results, a ^ (a << 13), &mut a, &mut b, i + 0, m, m2); - rngstep(&mut self.mem, results, a ^ (a >> 6 ), &mut a, &mut b, i + 1, m, m2); - rngstep(&mut self.mem, results, a ^ (a << 2 ), &mut a, &mut b, i + 2, m, m2); - rngstep(&mut self.mem, results, a ^ (a >> 16), &mut a, &mut b, i + 3, m, m2); - } - - m = MIDPOINT; - m2 = 0; - for i in (0..MIDPOINT/4).map(|i| i * 4) { - rngstep(&mut self.mem, results, a ^ (a << 13), &mut a, &mut b, i + 0, m, m2); - rngstep(&mut self.mem, results, a ^ (a >> 6 ), &mut a, &mut b, i + 1, m, m2); - rngstep(&mut self.mem, results, a ^ (a << 2 ), &mut a, &mut b, i + 2, m, m2); - rngstep(&mut self.mem, results, a ^ (a >> 16), &mut a, &mut b, i + 3, m, m2); - } - - self.a = a; - self.b = b; - } -} - -impl IsaacCore { - /// Create a new ISAAC random number generator. - /// - /// The author Bob Jenkins describes how to best initialize ISAAC here: - /// - /// The answer is included here just in case: - /// - /// "No, you don't need a full 8192 bits of seed data. Normal key sizes will - /// do fine, and they should have their expected strength (eg a 40-bit key - /// will take as much time to brute force as 40-bit keys usually will). You - /// could fill the remainder with 0, but set the last array element to the - /// length of the key provided (to distinguish keys that differ only by - /// different amounts of 0 padding). You do still need to call `randinit()` - /// to make sure the initial state isn't uniform-looking." - /// "After publishing ISAAC, I wanted to limit the key to half the size of - /// `r[]`, and repeat it twice. That would have made it hard to provide a - /// key that sets the whole internal state to anything convenient. But I'd - /// already published it." - /// - /// And his answer to the question "For my code, would repeating the key - /// over and over to fill 256 integers be a better solution than - /// zero-filling, or would they essentially be the same?": - /// "If the seed is under 32 bytes, they're essentially the same, otherwise - /// repeating the seed would be stronger. randinit() takes a chunk of 32 - /// bytes, mixes it, and combines that with the next 32 bytes, et cetera. - /// Then loops over all the elements the same way a second time." - #[inline] - fn init(mut mem: [w32; RAND_SIZE], rounds: u32) -> Self { - fn mix(a: &mut w32, b: &mut w32, c: &mut w32, d: &mut w32, - e: &mut w32, f: &mut w32, g: &mut w32, h: &mut w32) { - *a ^= *b << 11; *d += *a; *b += *c; - *b ^= *c >> 2; *e += *b; *c += *d; - *c ^= *d << 8; *f += *c; *d += *e; - *d ^= *e >> 16; *g += *d; *e += *f; - *e ^= *f << 10; *h += *e; *f += *g; - *f ^= *g >> 4; *a += *f; *g += *h; - *g ^= *h << 8; *b += *g; *h += *a; - *h ^= *a >> 9; *c += *h; *a += *b; - } - - // These numbers are the result of initializing a...h with the - // fractional part of the golden ratio in binary (0x9e3779b9) - // and applying mix() 4 times. - let mut a = w(0x1367df5a); - let mut b = w(0x95d90059); - let mut c = w(0xc3163e4b); - let mut d = w(0x0f421ad8); - let mut e = w(0xd92a4a78); - let mut f = w(0xa51a3c49); - let mut g = w(0xc4efea1b); - let mut h = w(0x30609119); - - // Normally this should do two passes, to make all of the seed effect - // all of `mem` - for _ in 0..rounds { - for i in (0..RAND_SIZE/8).map(|i| i * 8) { - a += mem[i ]; b += mem[i+1]; - c += mem[i+2]; d += mem[i+3]; - e += mem[i+4]; f += mem[i+5]; - g += mem[i+6]; h += mem[i+7]; - mix(&mut a, &mut b, &mut c, &mut d, - &mut e, &mut f, &mut g, &mut h); - mem[i ] = a; mem[i+1] = b; - mem[i+2] = c; mem[i+3] = d; - mem[i+4] = e; mem[i+5] = f; - mem[i+6] = g; mem[i+7] = h; - } - } - - Self { mem, a: w(0), b: w(0), c: w(0) } - } -} - -impl SeedableRng for IsaacCore { - type Seed = [u8; 32]; - - fn from_seed(seed: Self::Seed) -> Self { - let mut seed_u32 = [0u32; 8]; - le::read_u32_into(&seed, &mut seed_u32); - // Convert the seed to `Wrapping` and zero-extend to `RAND_SIZE`. - let mut seed_extended = [w(0); RAND_SIZE]; - for (x, y) in seed_extended.iter_mut().zip(seed_u32.iter()) { - *x = w(*y); - } - Self::init(seed_extended, 2) - } - - /// Create an ISAAC random number generator using an `u64` as seed. - /// If `seed == 0` this will produce the same stream of random numbers as - /// the reference implementation when used unseeded. - fn seed_from_u64(seed: u64) -> Self { - let mut key = [w(0); RAND_SIZE]; - key[0] = w(seed as u32); - key[1] = w((seed >> 32) as u32); - // Initialize with only one pass. - // A second pass does not improve the quality here, because all of the - // seed was already available in the first round. - // Not doing the second pass has the small advantage that if - // `seed == 0` this method produces exactly the same state as the - // reference implementation when used unseeded. - Self::init(key, 1) - } - - fn from_rng(mut rng: R) -> Result { - // Custom `from_rng` implementation that fills a seed with the same size - // as the entire state. - let mut seed = [w(0u32); RAND_SIZE]; - unsafe { - let ptr = seed.as_mut_ptr() as *mut u8; - - let slice = slice::from_raw_parts_mut(ptr, RAND_SIZE * 4); - rng.try_fill_bytes(slice)?; - } - for i in seed.iter_mut() { - *i = w(i.0.to_le()); - } - - Ok(Self::init(seed, 2)) - } -} - -#[cfg(test)] -mod test { - use {RngCore, SeedableRng}; - use super::IsaacRng; - - #[test] - fn test_isaac_construction() { - // Test that various construction techniques produce a working RNG. - let seed = [1,0,0,0, 23,0,0,0, 200,1,0,0, 210,30,0,0, - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; - let mut rng1 = IsaacRng::from_seed(seed); - assert_eq!(rng1.next_u32(), 2869442790); - - let mut rng2 = IsaacRng::from_rng(rng1).unwrap(); - assert_eq!(rng2.next_u32(), 3094074039); - } - - #[test] - fn test_isaac_true_values_32() { - let seed = [1,0,0,0, 23,0,0,0, 200,1,0,0, 210,30,0,0, - 57,48,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; - let mut rng1 = IsaacRng::from_seed(seed); - let mut results = [0u32; 10]; - for i in results.iter_mut() { *i = rng1.next_u32(); } - let expected = [ - 2558573138, 873787463, 263499565, 2103644246, 3595684709, - 4203127393, 264982119, 2765226902, 2737944514, 3900253796]; - assert_eq!(results, expected); - - let seed = [57,48,0,0, 50,9,1,0, 49,212,0,0, 148,38,0,0, - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; - let mut rng2 = IsaacRng::from_seed(seed); - // skip forward to the 10000th number - for _ in 0..10000 { rng2.next_u32(); } - - for i in results.iter_mut() { *i = rng2.next_u32(); } - let expected = [ - 3676831399, 3183332890, 2834741178, 3854698763, 2717568474, - 1576568959, 3507990155, 179069555, 141456972, 2478885421]; - assert_eq!(results, expected); - } - - #[test] - fn test_isaac_true_values_64() { - // As above, using little-endian versions of above values - let seed = [1,0,0,0, 23,0,0,0, 200,1,0,0, 210,30,0,0, - 57,48,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; - let mut rng = IsaacRng::from_seed(seed); - let mut results = [0u64; 5]; - for i in results.iter_mut() { *i = rng.next_u64(); } - let expected = [ - 3752888579798383186, 9035083239252078381,18052294697452424037, - 11876559110374379111, 16751462502657800130]; - assert_eq!(results, expected); - } - - #[test] - fn test_isaac_true_bytes() { - let seed = [1,0,0,0, 23,0,0,0, 200,1,0,0, 210,30,0,0, - 57,48,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; - let mut rng = IsaacRng::from_seed(seed); - let mut results = [0u8; 32]; - rng.fill_bytes(&mut results); - // Same as first values in test_isaac_true_values as bytes in LE order - let expected = [82, 186, 128, 152, 71, 240, 20, 52, - 45, 175, 180, 15, 86, 16, 99, 125, - 101, 203, 81, 214, 97, 162, 134, 250, - 103, 78, 203, 15, 150, 3, 210, 164]; - assert_eq!(results, expected); - } - - #[test] - fn test_isaac_new_uninitialized() { - // Compare the results from initializing `IsaacRng` with - // `seed_from_u64(0)`, to make sure it is the same as the reference - // implementation when used uninitialized. - // Note: We only test the first 16 integers, not the full 256 of the - // first block. - let mut rng = IsaacRng::seed_from_u64(0); - let mut results = [0u32; 16]; - for i in results.iter_mut() { *i = rng.next_u32(); } - let expected: [u32; 16] = [ - 0x71D71FD2, 0xB54ADAE7, 0xD4788559, 0xC36129FA, - 0x21DC1EA9, 0x3CB879CA, 0xD83B237F, 0xFA3CE5BD, - 0x8D048509, 0xD82E9489, 0xDB452848, 0xCA20E846, - 0x500F972E, 0x0EEFF940, 0x00D6B993, 0xBC12C17F]; - assert_eq!(results, expected); - } - - #[test] - fn test_isaac_clone() { - let seed = [1,0,0,0, 23,0,0,0, 200,1,0,0, 210,30,0,0, - 57,48,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; - let mut rng1 = IsaacRng::from_seed(seed); - let mut rng2 = rng1.clone(); - for _ in 0..16 { - assert_eq!(rng1.next_u32(), rng2.next_u32()); - } - } - - #[test] - #[cfg(all(feature="serde1", feature="std"))] - fn test_isaac_serde() { - use bincode; - use std::io::{BufWriter, BufReader}; - - let seed = [1,0,0,0, 23,0,0,0, 200,1,0,0, 210,30,0,0, - 57,48,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; - let mut rng = IsaacRng::from_seed(seed); - - let buf: Vec = Vec::new(); - let mut buf = BufWriter::new(buf); - bincode::serialize_into(&mut buf, &rng).expect("Could not serialize"); - - let buf = buf.into_inner().unwrap(); - let mut read = BufReader::new(&buf[..]); - let mut deserialized: IsaacRng = bincode::deserialize_from(&mut read).expect("Could not deserialize"); - - for _ in 0..300 { // more than the 256 buffered results - assert_eq!(rng.next_u32(), deserialized.next_u32()); - } - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/prng/mod.rs cargo-0.37.0/vendor/rand-0.5.6/src/prng/mod.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/prng/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/prng/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,330 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Pseudo-random number generators. -//! -//! Pseudo-random number generators are algorithms to produce apparently random -//! numbers deterministically, and usually fairly quickly. See the documentation -//! of the [`rngs` module] for some introduction to PRNGs. -//! -//! As mentioned there, PRNGs fall in two broad categories: -//! -//! - [basic PRNGs], primarily designed for simulations -//! - [CSPRNGs], primarily designed for cryptography -//! -//! In simple terms, the basic PRNGs are often predictable; CSPRNGs should not -//! be predictable *when used correctly*. -//! -//! Contents of this documentation: -//! -//! 1. [The generators](#the-generators) -//! 1. [Performance and size](#performance) -//! 1. [Quality and cycle length](#quality) -//! 1. [Security](#security) -//! 1. [Extra features](#extra-features) -//! 1. [Further reading](#further-reading) -//! -//! -//! # The generators -//! -//! ## Basic pseudo-random number generators (PRNGs) -//! -//! The goal of regular, non-cryptographic PRNGs is usually to find a good -//! balance between simplicity, quality, memory usage and performance. These -//! algorithms are very important to Monte Carlo simulations, and also suitable -//! for several other problems such as randomized algorithms and games (except -//! where there is a risk of players predicting the next output value from -//! previous values, in which case a CSPRNG should be used). -//! -//! Currently Rand provides only one PRNG, and not a very good one at that: -//! -//! | name | full name | performance | memory | quality | period | features | -//! |------|-----------|-------------|--------|---------|--------|----------| -//! | [`XorShiftRng`] | Xorshift 32/128 | ★★★☆☆ | 16 bytes | ★☆☆☆☆ | `u32` * 2128 - 1 | — | -//! -// Quality stars [not rendered in documentation]: -// 5. reserved for crypto-level (e.g. ChaCha8, ISAAC) -// 4. good performance on TestU01 and PractRand, good theory -// (e.g. PCG, truncated Xorshift*) -// 3. good performance on TestU01 and PractRand, but "falling through the -// cracks" or insufficient theory (e.g. SFC, Xoshiro) -// 2. imperfect performance on tests or other limiting properties, but not -// terrible (e.g. Xoroshiro128+) -// 1. clear deficiencies in test results, cycle length, theory, or other -// properties (e.g. Xorshift) -// -// Performance stars [not rendered in documentation]: -// Meant to give an indication of relative performance. Roughly follows a log -// scale, based on the performance of `next_u64` on a current i5/i7: -// - 5. 8000 MB/s+ -// - 4. 4000 MB/s+ -// - 3. 2000 MB/s+ -// - 2. 1000 MB/s+ -// - 1. < 1000 MB/s -// -//! ## Cryptographically secure pseudo-random number generators (CSPRNGs) -//! -//! CSPRNGs have much higher requirements than basic PRNGs. The primary -//! consideration is security. Performance and simplicity are also important, -//! but in general CSPRNGs are more complex and slower than regular PRNGs. -//! Quality is no longer a concern, as it is a requirement for a -//! CSPRNG that the output is basically indistinguishable from true randomness -//! since any bias or correlation makes the output more predictable. -//! -//! There is a close relationship between CSPRNGs and cryptographic ciphers. -//! Any block cipher can be turned into a CSPRNG by encrypting a counter. Stream -//! ciphers are basically a CSPRNG and a combining operation, usually XOR. This -//! means that we can easily use any stream cipher as a CSPRNG. -//! -//! Rand currently provides two trustworthy CSPRNGs and two CSPRNG-like PRNGs: -//! -//! | name | full name | performance | initialization | memory | predictability | forward secrecy | -//! |------|-----------|--------------|--------------|----------|----------------|-------------------------| -//! | [`ChaChaRng`] | ChaCha20 | ★☆☆☆☆ | fast | 136 bytes | secure | no | -//! | [`Hc128Rng`] | HC-128 | ★★☆☆☆ | slow | 4176 bytes | secure | no | -//! | [`IsaacRng`] | ISAAC | ★★☆☆☆ | slow | 2072 bytes | unknown | unknown | -//! | [`Isaac64Rng`] | ISAAC-64 | ★★☆☆☆ | slow | 4136 bytes| unknown | unknown | -//! -//! It should be noted that the ISAAC generators are only included for -//! historical reasons, they have been with the Rust language since the very -//! beginning. They have good quality output and no attacks are known, but have -//! received little attention from cryptography experts. -//! -//! -//! # Performance -//! -//! First it has to be said most PRNGs are very fast, and will rarely be a -//! performance bottleneck. -//! -//! Performance of basic PRNGs is a bit of a subtle thing. It depends a lot on -//! the CPU architecture (32 vs. 64 bits), inlining, and also on the number of -//! available registers. This often causes the performance to be affected by -//! surrounding code due to inlining and other usage of registers. -//! -//! When choosing a PRNG for performance it is important to benchmark your own -//! application due to interactions between PRNGs and surrounding code and -//! dependence on the CPU architecture as well as the impact of the size of -//! data requested. Because of all this, we do not include performance numbers -//! here but merely a qualitative rating. -//! -//! CSPRNGs are a little different in that they typically generate a block of -//! output in a cache, and pull outputs from the cache. This allows them to have -//! good amortised performance, and reduces or completely removes the influence -//! of surrounding code on the CSPRNG performance. -//! -//! ### Worst-case performance -//! Because CSPRNGs usually produce a block of values into a cache, they have -//! poor worst case performance (in contrast to basic PRNGs, where the -//! performance is usually quite regular). -//! -//! ## State size -//! -//! Simple PRNGs often use very little memory, commonly only a few words, where -//! a *word* is usually either `u32` or `u64`. This is not true for all -//! non-cryptographic PRNGs however, for example the historically popular -//! Mersenne Twister MT19937 algorithm requires 2.5 kB of state. -//! -//! CSPRNGs typically require more memory; since the seed size is recommended -//! to be at least 192 bits and some more may be required for the algorithm, -//! 256 bits would be approximately the minimum secure size. In practice, -//! CSPRNGs tend to use quite a bit more, [`ChaChaRng`] is relatively small with -//! 136 bytes of state. -//! -//! ## Initialization time -//! -//! The time required to initialize new generators varies significantly. Many -//! simple PRNGs and even some cryptographic ones (including [`ChaChaRng`]) -//! only need to copy the seed value and some constants into their state, and -//! thus can be constructed very quickly. In contrast, CSPRNGs with large state -//! require an expensive key-expansion. -//! -//! # Quality -//! -//! Many basic PRNGs are not much more than a couple of bitwise and arithmetic -//! operations. Their simplicity gives good performance, but also means there -//! are small regularities hidden in the generated random number stream. -//! -//! How much do those hidden regularities matter? That is hard to say, and -//! depends on how the RNG gets used. If there happen to be correlations between -//! the random numbers and the algorithm they are used in, the results can be -//! wrong or misleading. -//! -//! A random number generator can be considered good if it gives the correct -//! results in as many applications as possible. The quality of PRNG -//! algorithms can be evaluated to some extend analytically, to determine the -//! cycle length and to rule out some correlations. Then there are empirical -//! test suites designed to test how well a PRNG performs on a wide range of -//! possible uses, the latest and most complete of which are [TestU01] and -//! [PractRand]. -//! -//! CSPRNGs tend to be more complex, and have an explicit requirement to be -//! unpredictable. This implies there must be no obvious correlations between -//! output values. -//! -//! ### Quality stars: -//! PRNGs with 3 stars or more should be good enough for any purpose. -//! 1 or 2 stars may be good enough for typical apps and games, but do not work -//! well with all algorithms. -//! -//! ## Period -//! -//! The *period* or *cycle length* of a PRNG is the number of values that can be -//! generated after which it starts repeating the same random number stream. -//! Many PRNGs have a fixed-size period, but for some only an expected average -//! cycle length can be given, where the exact length depends on the seed. -//! -//! On today's hardware, even a fast RNG with a cycle length of *only* -//! 264 can be used for centuries before cycling. Yet we recommend a -//! period of 2128 or more, which most modern PRNGs satisfy. -//! Alternatively a PRNG with shorter period but support for multiple streams -//! may be chosen. There are two reasons for this, as follows. -//! -//! If we see the entire period of an RNG as one long random number stream, -//! every independently seeded RNG returns a slice of that stream. When multiple -//! RNG are seeded randomly, there is an increasingly large chance to end up -//! with a partially overlapping slice of the stream. -//! -//! If the period of the RNG is 2128, and an application consumes -//! 248 values, it then takes about 232 random -//! initializations to have a chance of 1 in a million to repeat part of an -//! already used stream. This seems good enough for common usage of -//! non-cryptographic generators, hence the recommendation of at least -//! 2128. As an estimate, the chance of any overlap in a period of -//! size `p` with `n` independent seeds and `u` values used per seed is -//! approximately `1 - e^(-u * n^2 / (2 * p))`. -//! -//! Further, it is not recommended to use the full period of an RNG. Many -//! PRNGs have a property called *k-dimensional equidistribution*, meaning that -//! for values of some size (potentially larger than the output size), all -//! possible values are produced the same number of times over the generator's -//! period. This is not a property of true randomness. This is known as the -//! generalized birthday problem, see the [PCG paper] for a good explanation. -//! This results in a noticable bias on output after generating more values -//! than the square root of the period (after 264 values for a -//! period of 2128). -//! -//! -//! # Security -//! -//! ## Predictability -//! -//! From the context of any PRNG, one can ask the question *given some previous -//! output from the PRNG, is it possible to predict the next output value?* -//! This is an important property in any situation where there might be an -//! adversary. -//! -//! Regular PRNGs tend to be predictable, although with varying difficulty. In -//! some cases prediction is trivial, for example plain Xorshift outputs part of -//! its state without mutation, and prediction is as simple as seeding a new -//! Xorshift generator from four `u32` outputs. Other generators, like -//! [PCG](http://www.pcg-random.org/predictability.html) and truncated Xorshift* -//! are harder to predict, but not outside the realm of common mathematics and a -//! desktop PC. -//! -//! The basic security that CSPRNGs must provide is the infeasibility to predict -//! output. This requirement is formalized as the [next-bit test]; this is -//! roughly stated as: given the first *k* bits of a random sequence, the -//! sequence satisfies the next-bit test if there is no algorithm able to -//! predict the next bit using reasonable computing power. -//! -//! A further security that *some* CSPRNGs provide is forward secrecy: -//! in the event that the CSPRNGs state is revealed at some point, it must be -//! infeasible to reconstruct previous states or output. Note that many CSPRNGs -//! *do not* have forward secrecy in their usual formulations. -//! -//! As an outsider it is hard to get a good idea about the security of an -//! algorithm. People in the field of cryptography spend a lot of effort -//! analyzing existing designs, and what was once considered good may now turn -//! out to be weaker. Generally it is best to use algorithms well-analyzed by -//! experts, such as those recommended by NIST or ECRYPT. -//! -//! ## State and seeding -//! -//! It is worth noting that a CSPRNG's security relies absolutely on being -//! seeded with a secure random key. Should the key be known or guessable, all -//! output of the CSPRNG is easy to guess. This implies that the seed should -//! come from a trusted source; usually either the OS or another CSPRNG. Our -//! seeding helper trait, [`FromEntropy`], and the source it uses -//! ([`EntropyRng`]), should be secure. Additionally, [`ThreadRng`] is a CSPRNG, -//! thus it is acceptable to seed from this (although for security applications -//! fresh/external entropy should be preferred). -//! -//! Further, it should be obvious that the internal state of a CSPRNG must be -//! kept secret. With that in mind, our implementations do not provide direct -//! access to most of their internal state, and `Debug` implementations do not -//! print any internal state. This does not fully protect CSPRNG state; code -//! within the same process may read this memory (and we allow cloning and -//! serialisation of CSPRNGs for convenience). Further, a running process may be -//! forked by the operating system, which may leave both processes with a copy -//! of the same generator. -//! -//! ## Not a crypto library -//! -//! It should be emphasised that this is not a cryptography library; although -//! Rand does take some measures to provide secure random numbers, it does not -//! necessarily take all recommended measures. Further, cryptographic processes -//! such as encryption and authentication are complex and must be implemented -//! very carefully to avoid flaws and resist known attacks. It is therefore -//! recommended to use specialized libraries where possible, for example -//! [openssl], [ring] and the [RustCrypto libraries]. -//! -//! -//! # Extra features -//! -//! Some PRNGs may provide extra features, like: -//! -//! - Support for multiple streams, which can help with parallel tasks. -//! - The ability to jump or seek around in the random number stream; -//! with large periood this can be used as an alternative to streams. -//! -//! -//! # Further reading -//! -//! There is quite a lot that can be said about PRNGs. The [PCG paper] is a -//! very approachable explaining more concepts. -//! -//! A good paper about RNG quality is -//! ["Good random number generators are (not so) easy to find"]( -//! http://random.mat.sbg.ac.at/results/peter/A19final.pdf) by P. Hellekalek. -//! -//! -//! [`rngs` module]: ../rngs/index.html -//! [basic PRNGs]: #basic-pseudo-random-number-generators-prngs -//! [CSPRNGs]: #cryptographically-secure-pseudo-random-number-generators-csprngs -//! [`XorShiftRng`]: struct.XorShiftRng.html -//! [`ChaChaRng`]: chacha/struct.ChaChaRng.html -//! [`Hc128Rng`]: hc128/struct.Hc128Rng.html -//! [`IsaacRng`]: isaac/struct.IsaacRng.html -//! [`Isaac64Rng`]: isaac64/struct.Isaac64Rng.html -//! [`ThreadRng`]: ../rngs/struct.ThreadRng.html -//! [`FromEntropy`]: ../trait.FromEntropy.html -//! [`EntropyRng`]: ../rngs/struct.EntropyRng.html -//! [TestU01]: http://simul.iro.umontreal.ca/testu01/tu01.html -//! [PractRand]: http://pracrand.sourceforge.net/ -//! [PCG paper]: http://www.pcg-random.org/pdf/hmc-cs-2014-0905.pdf -//! [openssl]: https://crates.io/crates/openssl -//! [ring]: https://crates.io/crates/ring -//! [RustCrypto libraries]: https://github.com/RustCrypto -//! [next-bit test]: https://en.wikipedia.org/wiki/Next-bit_test - - -pub mod chacha; -pub mod hc128; -pub mod isaac; -pub mod isaac64; -mod xorshift; - -mod isaac_array; - -pub use self::chacha::ChaChaRng; -pub use self::hc128::Hc128Rng; -pub use self::isaac::IsaacRng; -pub use self::isaac64::Isaac64Rng; -pub use self::xorshift::XorShiftRng; diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/prng/xorshift.rs cargo-0.37.0/vendor/rand-0.5.6/src/prng/xorshift.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/prng/xorshift.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/prng/xorshift.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,225 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Xorshift generators - -use core::num::Wrapping as w; -use core::{fmt, slice}; -use rand_core::{RngCore, SeedableRng, Error, impls, le}; - -/// An Xorshift random number generator. -/// -/// The Xorshift[^1] algorithm is not suitable for cryptographic purposes -/// but is very fast. If you do not know for sure that it fits your -/// requirements, use a more secure one such as `IsaacRng` or `OsRng`. -/// -/// [^1]: Marsaglia, George (July 2003). -/// ["Xorshift RNGs"](https://www.jstatsoft.org/v08/i14/paper). -/// *Journal of Statistical Software*. Vol. 8 (Issue 14). -#[derive(Clone)] -#[cfg_attr(feature="serde1", derive(Serialize,Deserialize))] -pub struct XorShiftRng { - x: w, - y: w, - z: w, - w: w, -} - -// Custom Debug implementation that does not expose the internal state -impl fmt::Debug for XorShiftRng { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "XorShiftRng {{}}") - } -} - -impl XorShiftRng { - /// Creates a new XorShiftRng instance which is not seeded. - /// - /// The initial values of this RNG are constants, so all generators created - /// by this function will yield the same stream of random numbers. It is - /// highly recommended that this is created through `SeedableRng` instead of - /// this function - #[deprecated(since="0.5.0", note="use the FromEntropy or SeedableRng trait")] - pub fn new_unseeded() -> XorShiftRng { - XorShiftRng { - x: w(0x193a6754), - y: w(0xa8a7d469), - z: w(0x97830e05), - w: w(0x113ba7bb), - } - } -} - -impl RngCore for XorShiftRng { - #[inline] - fn next_u32(&mut self) -> u32 { - let x = self.x; - let t = x ^ (x << 11); - self.x = self.y; - self.y = self.z; - self.z = self.w; - let w_ = self.w; - self.w = w_ ^ (w_ >> 19) ^ (t ^ (t >> 8)); - self.w.0 - } - - #[inline] - fn next_u64(&mut self) -> u64 { - impls::next_u64_via_u32(self) - } - - #[inline] - fn fill_bytes(&mut self, dest: &mut [u8]) { - impls::fill_bytes_via_next(self, dest) - } - - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - Ok(self.fill_bytes(dest)) - } -} - -impl SeedableRng for XorShiftRng { - type Seed = [u8; 16]; - - fn from_seed(seed: Self::Seed) -> Self { - let mut seed_u32 = [0u32; 4]; - le::read_u32_into(&seed, &mut seed_u32); - - // Xorshift cannot be seeded with 0 and we cannot return an Error, but - // also do not wish to panic (because a random seed can legitimately be - // 0); our only option is therefore to use a preset value. - if seed_u32.iter().all(|&x| x == 0) { - seed_u32 = [0xBAD_5EED, 0xBAD_5EED, 0xBAD_5EED, 0xBAD_5EED]; - } - - XorShiftRng { - x: w(seed_u32[0]), - y: w(seed_u32[1]), - z: w(seed_u32[2]), - w: w(seed_u32[3]), - } - } - - fn from_rng(mut rng: R) -> Result { - let mut seed_u32 = [0u32; 4]; - loop { - unsafe { - let ptr = seed_u32.as_mut_ptr() as *mut u8; - - let slice = slice::from_raw_parts_mut(ptr, 4 * 4); - rng.try_fill_bytes(slice)?; - } - if !seed_u32.iter().all(|&x| x == 0) { break; } - } - - Ok(XorShiftRng { - x: w(seed_u32[0]), - y: w(seed_u32[1]), - z: w(seed_u32[2]), - w: w(seed_u32[3]), - }) - } -} - -#[cfg(test)] -mod tests { - use {RngCore, SeedableRng}; - use super::XorShiftRng; - - #[test] - fn test_xorshift_construction() { - // Test that various construction techniques produce a working RNG. - let seed = [1,2,3,4, 5,6,7,8, 9,10,11,12, 13,14,15,16]; - let mut rng1 = XorShiftRng::from_seed(seed); - assert_eq!(rng1.next_u64(), 4325440999699518727); - - let _rng2 = XorShiftRng::from_rng(rng1).unwrap(); - // Note: we cannot test the state of _rng2 because from_rng does not - // fix Endianness. This is allowed in the trait specification. - } - - #[test] - fn test_xorshift_true_values() { - let seed = [16,15,14,13, 12,11,10,9, 8,7,6,5, 4,3,2,1]; - let mut rng = XorShiftRng::from_seed(seed); - - let mut results = [0u32; 9]; - for i in results.iter_mut() { *i = rng.next_u32(); } - let expected: [u32; 9] = [ - 2081028795, 620940381, 269070770, 16943764, 854422573, 29242889, - 1550291885, 1227154591, 271695242]; - assert_eq!(results, expected); - - let mut results = [0u64; 9]; - for i in results.iter_mut() { *i = rng.next_u64(); } - let expected: [u64; 9] = [ - 9247529084182843387, 8321512596129439293, 14104136531997710878, - 6848554330849612046, 343577296533772213, 17828467390962600268, - 9847333257685787782, 7717352744383350108, 1133407547287910111]; - assert_eq!(results, expected); - - let mut results = [0u8; 32]; - rng.fill_bytes(&mut results); - let expected = [102, 57, 212, 16, 233, 130, 49, 183, - 158, 187, 44, 203, 63, 149, 45, 17, - 117, 129, 131, 160, 70, 121, 158, 155, - 224, 209, 192, 53, 10, 62, 57, 72]; - assert_eq!(results, expected); - } - - #[test] - fn test_xorshift_zero_seed() { - // Xorshift does not work with an all zero seed. - // Assert it does not panic. - let seed = [0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; - let mut rng = XorShiftRng::from_seed(seed); - let a = rng.next_u64(); - let b = rng.next_u64(); - assert!(a != 0); - assert!(b != a); - } - - #[test] - fn test_xorshift_clone() { - let seed = [1,2,3,4, 5,5,7,8, 8,7,6,5, 4,3,2,1]; - let mut rng1 = XorShiftRng::from_seed(seed); - let mut rng2 = rng1.clone(); - for _ in 0..16 { - assert_eq!(rng1.next_u64(), rng2.next_u64()); - } - } - - #[cfg(all(feature="serde1", feature="std"))] - #[test] - fn test_xorshift_serde() { - use bincode; - use std::io::{BufWriter, BufReader}; - - let seed = [1,2,3,4, 5,6,7,8, 9,10,11,12, 13,14,15,16]; - let mut rng = XorShiftRng::from_seed(seed); - - let buf: Vec = Vec::new(); - let mut buf = BufWriter::new(buf); - bincode::serialize_into(&mut buf, &rng).expect("Could not serialize"); - - let buf = buf.into_inner().unwrap(); - let mut read = BufReader::new(&buf[..]); - let mut deserialized: XorShiftRng = bincode::deserialize_from(&mut read).expect("Could not deserialize"); - - assert_eq!(rng.x, deserialized.x); - assert_eq!(rng.y, deserialized.y); - assert_eq!(rng.z, deserialized.z); - assert_eq!(rng.w, deserialized.w); - - for _ in 0..16 { - assert_eq!(rng.next_u64(), deserialized.next_u64()); - } - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/rngs/adapter/mod.rs cargo-0.37.0/vendor/rand-0.5.6/src/rngs/adapter/mod.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/rngs/adapter/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/rngs/adapter/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Wrappers / adapters forming RNGs - -#[cfg(feature="std")] #[doc(hidden)] pub mod read; -mod reseeding; - -#[cfg(feature="std")] pub use self::read::ReadRng; -pub use self::reseeding::ReseedingRng; diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/rngs/adapter/read.rs cargo-0.37.0/vendor/rand-0.5.6/src/rngs/adapter/read.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/rngs/adapter/read.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/rngs/adapter/read.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,137 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! A wrapper around any Read to treat it as an RNG. - -use std::io::Read; - -use rand_core::{RngCore, Error, ErrorKind, impls}; - - -/// An RNG that reads random bytes straight from any type supporting -/// `std::io::Read`, for example files. -/// -/// This will work best with an infinite reader, but that is not required. -/// -/// This can be used with `/dev/urandom` on Unix but it is recommended to use -/// [`OsRng`] instead. -/// -/// # Panics -/// -/// `ReadRng` uses `std::io::read_exact`, which retries on interrupts. All other -/// errors from the underlying reader, including when it does not have enough -/// data, will only be reported through [`try_fill_bytes`]. The other -/// [`RngCore`] methods will panic in case of an error. -/// -/// # Example -/// -/// ``` -/// use rand::{read, Rng}; -/// -/// let data = vec![1, 2, 3, 4, 5, 6, 7, 8]; -/// let mut rng = read::ReadRng::new(&data[..]); -/// println!("{:x}", rng.gen::()); -/// ``` -/// -/// [`OsRng`]: ../struct.OsRng.html -/// [`RngCore`]: ../../trait.RngCore.html -/// [`try_fill_bytes`]: ../../trait.RngCore.html#method.tymethod.try_fill_bytes -#[derive(Debug)] -pub struct ReadRng { - reader: R -} - -impl ReadRng { - /// Create a new `ReadRng` from a `Read`. - pub fn new(r: R) -> ReadRng { - ReadRng { - reader: r - } - } -} - -impl RngCore for ReadRng { - fn next_u32(&mut self) -> u32 { - impls::next_u32_via_fill(self) - } - - fn next_u64(&mut self) -> u64 { - impls::next_u64_via_fill(self) - } - - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.try_fill_bytes(dest).unwrap_or_else(|err| - panic!("reading random bytes from Read implementation failed; error: {}", err)); - } - - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - if dest.len() == 0 { return Ok(()); } - // Use `std::io::read_exact`, which retries on `ErrorKind::Interrupted`. - self.reader.read_exact(dest).map_err(|err| { - match err.kind() { - ::std::io::ErrorKind::UnexpectedEof => Error::with_cause( - ErrorKind::Unavailable, - "not enough bytes available, reached end of source", err), - _ => Error::with_cause(ErrorKind::Unavailable, - "error reading from Read source", err) - } - }) - } -} - -#[cfg(test)] -mod test { - use super::ReadRng; - use {RngCore, ErrorKind}; - - #[test] - fn test_reader_rng_u64() { - // transmute from the target to avoid endianness concerns. - let v = vec![0u8, 0, 0, 0, 0, 0, 0, 1, - 0 , 0, 0, 0, 0, 0, 0, 2, - 0, 0, 0, 0, 0, 0, 0, 3]; - let mut rng = ReadRng::new(&v[..]); - - assert_eq!(rng.next_u64(), 1_u64.to_be()); - assert_eq!(rng.next_u64(), 2_u64.to_be()); - assert_eq!(rng.next_u64(), 3_u64.to_be()); - } - - #[test] - fn test_reader_rng_u32() { - let v = vec![0u8, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3]; - let mut rng = ReadRng::new(&v[..]); - - assert_eq!(rng.next_u32(), 1_u32.to_be()); - assert_eq!(rng.next_u32(), 2_u32.to_be()); - assert_eq!(rng.next_u32(), 3_u32.to_be()); - } - - #[test] - fn test_reader_rng_fill_bytes() { - let v = [1u8, 2, 3, 4, 5, 6, 7, 8]; - let mut w = [0u8; 8]; - - let mut rng = ReadRng::new(&v[..]); - rng.fill_bytes(&mut w); - - assert!(v == w); - } - - #[test] - fn test_reader_rng_insufficient_bytes() { - let v = [1u8, 2, 3, 4, 5, 6, 7, 8]; - let mut w = [0u8; 9]; - - let mut rng = ReadRng::new(&v[..]); - - assert!(rng.try_fill_bytes(&mut w).err().unwrap().kind == ErrorKind::Unavailable); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/rngs/adapter/reseeding.rs cargo-0.37.0/vendor/rand-0.5.6/src/rngs/adapter/reseeding.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/rngs/adapter/reseeding.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/rngs/adapter/reseeding.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,260 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! A wrapper around another PRNG that reseeds it after it -//! generates a certain number of random bytes. - -use core::mem::size_of; - -use rand_core::{RngCore, CryptoRng, SeedableRng, Error, ErrorKind}; -use rand_core::block::{BlockRngCore, BlockRng}; - -/// A wrapper around any PRNG which reseeds the underlying PRNG after it has -/// generated a certain number of random bytes. -/// -/// When the RNG gets cloned, the clone is reseeded on first use. -/// -/// Reseeding is never strictly *necessary*. Cryptographic PRNGs don't have a -/// limited number of bytes they can output, or at least not a limit reachable -/// in any practical way. There is no such thing as 'running out of entropy'. -/// -/// Some small non-cryptographic PRNGs can have very small periods, for -/// example less than 264. Would reseeding help to ensure that you do -/// not wrap around at the end of the period? A period of 264 still -/// takes several centuries of CPU-years on current hardware. Reseeding will -/// actually make things worse, because the reseeded PRNG will just continue -/// somewhere else *in the same period*, with a high chance of overlapping with -/// previously used parts of it. -/// -/// # When should you use `ReseedingRng`? -/// -/// - Reseeding can be seen as some form of 'security in depth'. Even if in the -/// future a cryptographic weakness is found in the CSPRNG being used, -/// occasionally reseeding should make exploiting it much more difficult or -/// even impossible. -/// - It can be used as a poor man's cryptography (not recommended, just use a -/// good CSPRNG). Previous implementations of `thread_rng` for example used -/// `ReseedingRng` with the ISAAC RNG. That algorithm, although apparently -/// strong and with no known attack, does not come with any proof of security -/// and does not meet the current standards for a cryptographically secure -/// PRNG. By reseeding it frequently (every 32 kiB) it seems safe to assume -/// there is no attack that can operate on the tiny window between reseeds. -/// -/// # Error handling -/// -/// Although extremely unlikely, reseeding the wrapped PRNG can fail. -/// `ReseedingRng` will never panic but try to handle the error intelligently -/// through some combination of retrying and delaying reseeding until later. -/// If handling the source error fails `ReseedingRng` will continue generating -/// data from the wrapped PRNG without reseeding. -#[derive(Debug)] -pub struct ReseedingRng(BlockRng>) -where R: BlockRngCore + SeedableRng, - Rsdr: RngCore; - -impl ReseedingRng -where R: BlockRngCore + SeedableRng, - Rsdr: RngCore -{ - /// Create a new `ReseedingRng` with the given parameters. - /// - /// # Arguments - /// - /// * `rng`: the random number generator to use. - /// * `threshold`: the number of generated bytes after which to reseed the RNG. - /// * `reseeder`: the RNG to use for reseeding. - pub fn new(rng: R, threshold: u64, reseeder: Rsdr) -> Self { - ReseedingRng(BlockRng::new(ReseedingCore::new(rng, threshold, reseeder))) - } - - /// Reseed the internal PRNG. - pub fn reseed(&mut self) -> Result<(), Error> { - self.0.core.reseed() - } -} - -// TODO: this should be implemented for any type where the inner type -// implements RngCore, but we can't specify that because ReseedingCore is private -impl RngCore for ReseedingRng -where R: BlockRngCore + SeedableRng, - ::Results: AsRef<[u32]> + AsMut<[u32]> -{ - #[inline(always)] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest) - } - - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -impl Clone for ReseedingRng -where R: BlockRngCore + SeedableRng + Clone, - Rsdr: RngCore + Clone -{ - fn clone(&self) -> ReseedingRng { - // Recreating `BlockRng` seems easier than cloning it and resetting - // the index. - ReseedingRng(BlockRng::new(self.0.core.clone())) - } -} - -impl CryptoRng for ReseedingRng -where R: BlockRngCore + SeedableRng + CryptoRng, - Rsdr: RngCore + CryptoRng {} - -#[derive(Debug)] -struct ReseedingCore { - inner: R, - reseeder: Rsdr, - threshold: i64, - bytes_until_reseed: i64, -} - -impl BlockRngCore for ReseedingCore -where R: BlockRngCore + SeedableRng, - Rsdr: RngCore -{ - type Item = ::Item; - type Results = ::Results; - - fn generate(&mut self, results: &mut Self::Results) { - if self.bytes_until_reseed <= 0 { - // We get better performance by not calling only `auto_reseed` here - // and continuing with the rest of the function, but by directly - // returning from a non-inlined function. - return self.reseed_and_generate(results); - } - let num_bytes = results.as_ref().len() * size_of::(); - self.bytes_until_reseed -= num_bytes as i64; - self.inner.generate(results); - } -} - -impl ReseedingCore -where R: BlockRngCore + SeedableRng, - Rsdr: RngCore -{ - /// Create a new `ReseedingCore` with the given parameters. - /// - /// # Arguments - /// - /// * `rng`: the random number generator to use. - /// * `threshold`: the number of generated bytes after which to reseed the RNG. - /// * `reseeder`: the RNG to use for reseeding. - pub fn new(rng: R, threshold: u64, reseeder: Rsdr) -> Self { - assert!(threshold <= ::core::i64::MAX as u64); - ReseedingCore { - inner: rng, - reseeder, - threshold: threshold as i64, - bytes_until_reseed: threshold as i64, - } - } - - /// Reseed the internal PRNG. - fn reseed(&mut self) -> Result<(), Error> { - R::from_rng(&mut self.reseeder).map(|result| { - self.bytes_until_reseed = self.threshold; - self.inner = result - }) - } - - #[inline(never)] - fn reseed_and_generate(&mut self, - results: &mut ::Results) - { - trace!("Reseeding RNG after {} generated bytes", - self.threshold - self.bytes_until_reseed); - let threshold = if let Err(e) = self.reseed() { - let delay = match e.kind { - ErrorKind::Transient => 0, - kind @ _ if kind.should_retry() => self.threshold >> 8, - _ => self.threshold, - }; - warn!("Reseeding RNG delayed reseeding by {} bytes due to \ - error from source: {}", delay, e); - delay - } else { - self.threshold - }; - - let num_bytes = results.as_ref().len() * size_of::<::Item>(); - self.bytes_until_reseed = threshold - num_bytes as i64; - self.inner.generate(results); - } -} - -impl Clone for ReseedingCore -where R: BlockRngCore + SeedableRng + Clone, - Rsdr: RngCore + Clone -{ - fn clone(&self) -> ReseedingCore { - ReseedingCore { - inner: self.inner.clone(), - reseeder: self.reseeder.clone(), - threshold: self.threshold, - bytes_until_reseed: 0, // reseed clone on first use - } - } -} - -impl CryptoRng for ReseedingCore -where R: BlockRngCore + SeedableRng + CryptoRng, - Rsdr: RngCore + CryptoRng {} - -#[cfg(test)] -mod test { - use {Rng, SeedableRng}; - use prng::chacha::ChaChaCore; - use rngs::mock::StepRng; - use super::ReseedingRng; - - #[test] - fn test_reseeding() { - let mut zero = StepRng::new(0, 0); - let rng = ChaChaCore::from_rng(&mut zero).unwrap(); - let mut reseeding = ReseedingRng::new(rng, 32*4, zero); - - // Currently we only support for arrays up to length 32. - // TODO: cannot generate seq via Rng::gen because it uses different alg - let mut buf = [0u32; 32]; // Needs to be a multiple of the RNGs result - // size to test exactly. - reseeding.fill(&mut buf); - let seq = buf; - for _ in 0..10 { - reseeding.fill(&mut buf); - assert_eq!(buf, seq); - } - } - - #[test] - fn test_clone_reseeding() { - let mut zero = StepRng::new(0, 0); - let rng = ChaChaCore::from_rng(&mut zero).unwrap(); - let mut rng1 = ReseedingRng::new(rng, 32*4, zero); - - let first: u32 = rng1.gen(); - for _ in 0..10 { let _ = rng1.gen::(); } - - let mut rng2 = rng1.clone(); - assert_eq!(first, rng2.gen::()); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/rngs/entropy.rs cargo-0.37.0/vendor/rand-0.5.6/src/rngs/entropy.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/rngs/entropy.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/rngs/entropy.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,296 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Entropy generator, or wrapper around external generators - -use rand_core::{RngCore, CryptoRng, Error, ErrorKind, impls}; -#[allow(unused)] -use rngs; - -/// An interface returning random data from external source(s), provided -/// specifically for securely seeding algorithmic generators (PRNGs). -/// -/// Where possible, `EntropyRng` retrieves random data from the operating -/// system's interface for random numbers ([`OsRng`]); if that fails it will -/// fall back to the [`JitterRng`] entropy collector. In the latter case it will -/// still try to use [`OsRng`] on the next usage. -/// -/// If no secure source of entropy is available `EntropyRng` will panic on use; -/// i.e. it should never output predictable data. -/// -/// This is either a little slow ([`OsRng`] requires a system call) or extremely -/// slow ([`JitterRng`] must use significant CPU time to generate sufficient -/// jitter); for better performance it is common to seed a local PRNG from -/// external entropy then primarily use the local PRNG ([`thread_rng`] is -/// provided as a convenient, local, automatically-seeded CSPRNG). -/// -/// # Panics -/// -/// On most systems, like Windows, Linux, macOS and *BSD on common hardware, it -/// is highly unlikely for both [`OsRng`] and [`JitterRng`] to fail. But on -/// combinations like webassembly without Emscripten or stdweb both sources are -/// unavailable. If both sources fail, only [`try_fill_bytes`] is able to -/// report the error, and only the one from `OsRng`. The other [`RngCore`] -/// methods will panic in case of an error. -/// -/// [`OsRng`]: struct.OsRng.html -/// [`JitterRng`]: jitter/struct.JitterRng.html -/// [`thread_rng`]: ../fn.thread_rng.html -/// [`RngCore`]: ../trait.RngCore.html -/// [`try_fill_bytes`]: ../trait.RngCore.html#method.tymethod.try_fill_bytes -#[derive(Debug)] -pub struct EntropyRng { - source: Source, -} - -#[derive(Debug)] -enum Source { - Os(Os), - Custom(Custom), - Jitter(Jitter), - None, -} - -impl EntropyRng { - /// Create a new `EntropyRng`. - /// - /// This method will do no system calls or other initialization routines, - /// those are done on first use. This is done to make `new` infallible, - /// and `try_fill_bytes` the only place to report errors. - pub fn new() -> Self { - EntropyRng { source: Source::None } - } -} - -impl Default for EntropyRng { - fn default() -> Self { - EntropyRng::new() - } -} - -impl RngCore for EntropyRng { - fn next_u32(&mut self) -> u32 { - impls::next_u32_via_fill(self) - } - - fn next_u64(&mut self) -> u64 { - impls::next_u64_via_fill(self) - } - - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.try_fill_bytes(dest).unwrap_or_else(|err| - panic!("all entropy sources failed; first error: {}", err)) - } - - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - let mut reported_error = None; - - if let Source::Os(ref mut os_rng) = self.source { - match os_rng.fill(dest) { - Ok(()) => return Ok(()), - Err(err) => { - warn!("EntropyRng: OsRng failed \ - [trying other entropy sources]: {}", err); - reported_error = Some(err); - }, - } - } else if Os::is_supported() { - match Os::new_and_fill(dest) { - Ok(os_rng) => { - debug!("EntropyRng: using OsRng"); - self.source = Source::Os(os_rng); - return Ok(()); - }, - Err(err) => { reported_error = reported_error.or(Some(err)) }, - } - } - - if let Source::Custom(ref mut rng) = self.source { - match rng.fill(dest) { - Ok(()) => return Ok(()), - Err(err) => { - warn!("EntropyRng: custom entropy source failed \ - [trying other entropy sources]: {}", err); - reported_error = Some(err); - }, - } - } else if Custom::is_supported() { - match Custom::new_and_fill(dest) { - Ok(custom) => { - debug!("EntropyRng: using custom entropy source"); - self.source = Source::Custom(custom); - return Ok(()); - }, - Err(err) => { reported_error = reported_error.or(Some(err)) }, - } - } - - if let Source::Jitter(ref mut jitter_rng) = self.source { - match jitter_rng.fill(dest) { - Ok(()) => return Ok(()), - Err(err) => { - warn!("EntropyRng: JitterRng failed: {}", err); - reported_error = Some(err); - }, - } - } else if Jitter::is_supported() { - match Jitter::new_and_fill(dest) { - Ok(jitter_rng) => { - debug!("EntropyRng: using JitterRng"); - self.source = Source::Jitter(jitter_rng); - return Ok(()); - }, - Err(err) => { reported_error = reported_error.or(Some(err)) }, - } - } - - if let Some(err) = reported_error { - Err(Error::with_cause(ErrorKind::Unavailable, - "All entropy sources failed", - err)) - } else { - Err(Error::new(ErrorKind::Unavailable, - "No entropy sources available")) - } - } -} - -impl CryptoRng for EntropyRng {} - - - -trait EntropySource { - fn new_and_fill(dest: &mut [u8]) -> Result - where Self: Sized; - - fn fill(&mut self, dest: &mut [u8]) -> Result<(), Error>; - - fn is_supported() -> bool { true } -} - -#[allow(unused)] -#[derive(Clone, Debug)] -struct NoSource; - -#[allow(unused)] -impl EntropySource for NoSource { - fn new_and_fill(dest: &mut [u8]) -> Result { - Err(Error::new(ErrorKind::Unavailable, "Source not supported")) - } - - fn fill(&mut self, dest: &mut [u8]) -> Result<(), Error> { - unreachable!() - } - - fn is_supported() -> bool { false } -} - - -#[cfg(all(feature="std", - any(target_os = "linux", target_os = "android", - target_os = "netbsd", - target_os = "dragonfly", - target_os = "haiku", - target_os = "emscripten", - target_os = "solaris", - target_os = "cloudabi", - target_os = "macos", target_os = "ios", - target_os = "freebsd", - target_os = "openbsd", target_os = "bitrig", - target_os = "redox", - target_os = "fuchsia", - windows, - all(target_arch = "wasm32", feature = "stdweb") -)))] -#[derive(Clone, Debug)] -pub struct Os(rngs::OsRng); - -#[cfg(all(feature="std", - any(target_os = "linux", target_os = "android", - target_os = "netbsd", - target_os = "dragonfly", - target_os = "haiku", - target_os = "emscripten", - target_os = "solaris", - target_os = "cloudabi", - target_os = "macos", target_os = "ios", - target_os = "freebsd", - target_os = "openbsd", target_os = "bitrig", - target_os = "redox", - target_os = "fuchsia", - windows, - all(target_arch = "wasm32", feature = "stdweb") -)))] -impl EntropySource for Os { - fn new_and_fill(dest: &mut [u8]) -> Result { - let mut rng = rngs::OsRng::new()?; - rng.try_fill_bytes(dest)?; - Ok(Os(rng)) - } - - fn fill(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -#[cfg(not(all(feature="std", - any(target_os = "linux", target_os = "android", - target_os = "netbsd", - target_os = "dragonfly", - target_os = "haiku", - target_os = "emscripten", - target_os = "solaris", - target_os = "cloudabi", - target_os = "macos", target_os = "ios", - target_os = "freebsd", - target_os = "openbsd", target_os = "bitrig", - target_os = "redox", - target_os = "fuchsia", - windows, - all(target_arch = "wasm32", feature = "stdweb") -))))] -type Os = NoSource; - - -type Custom = NoSource; - - -#[cfg(not(target_arch = "wasm32"))] -#[derive(Clone, Debug)] -pub struct Jitter(rngs::JitterRng); - -#[cfg(not(target_arch = "wasm32"))] -impl EntropySource for Jitter { - fn new_and_fill(dest: &mut [u8]) -> Result { - let mut rng = rngs::JitterRng::new()?; - rng.try_fill_bytes(dest)?; - Ok(Jitter(rng)) - } - - fn fill(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -#[cfg(target_arch = "wasm32")] -type Jitter = NoSource; - - -#[cfg(test)] -mod test { - use super::*; - - #[test] - fn test_entropy() { - let mut rng = EntropyRng::new(); - let n = (rng.next_u32() ^ rng.next_u32()).count_ones(); - assert!(n >= 2); // p(failure) approx 1e-7 - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/rngs/jitter.rs cargo-0.37.0/vendor/rand-0.5.6/src/rngs/jitter.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/rngs/jitter.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/rngs/jitter.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,887 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// -// Based on jitterentropy-library, http://www.chronox.de/jent.html. -// Copyright Stephan Mueller , 2014 - 2017. -// -// With permission from Stephan Mueller to relicense the Rust translation under -// the MIT license. - -//! Non-physical true random number generator based on timing jitter. - -// Note: the C implementation of `Jitterentropy` relies on being compiled -// without optimizations. This implementation goes through lengths to make the -// compiler not optimize out code which does influence timing jitter, but is -// technically dead code. - -use rand_core::{RngCore, CryptoRng, Error, ErrorKind, impls}; - -use core::{fmt, mem, ptr}; -#[cfg(all(feature="std", not(target_arch = "wasm32")))] -use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; - -const MEMORY_BLOCKS: usize = 64; -const MEMORY_BLOCKSIZE: usize = 32; -const MEMORY_SIZE: usize = MEMORY_BLOCKS * MEMORY_BLOCKSIZE; - -/// A true random number generator based on jitter in the CPU execution time, -/// and jitter in memory access time. -/// -/// This is a true random number generator, as opposed to pseudo-random -/// generators. Random numbers generated by `JitterRng` can be seen as fresh -/// entropy. A consequence is that is orders of magnitude slower than [`OsRng`] -/// and PRNGs (about 103..106 slower). -/// -/// There are very few situations where using this RNG is appropriate. Only very -/// few applications require true entropy. A normal PRNG can be statistically -/// indistinguishable, and a cryptographic PRNG should also be as impossible to -/// predict. -/// -/// Use of `JitterRng` is recommended for initializing cryptographic PRNGs when -/// [`OsRng`] is not available. -/// -/// `JitterRng` can be used without the standard library, but not conveniently, -/// you must provide a high-precision timer and carefully have to follow the -/// instructions of [`new_with_timer`]. -/// -/// This implementation is based on -/// [Jitterentropy](http://www.chronox.de/jent.html) version 2.1.0. -/// -/// Note: There is no accurate timer available on Wasm platforms, to help -/// prevent fingerprinting or timing side-channel attacks. Therefore -/// [`JitterRng::new()`] is not available on Wasm. -/// -/// # Quality testing -/// -/// [`JitterRng::new()`] has build-in, but limited, quality testing, however -/// before using `JitterRng` on untested hardware, or after changes that could -/// effect how the code is optimized (such as a new LLVM version), it is -/// recommend to run the much more stringent -/// [NIST SP 800-90B Entropy Estimation Suite]( -/// https://github.com/usnistgov/SP800-90B_EntropyAssessment). -/// -/// Use the following code using [`timer_stats`] to collect the data: -/// -/// ```no_run -/// use rand::jitter::JitterRng; -/// # -/// # use std::error::Error; -/// # use std::fs::File; -/// # use std::io::Write; -/// # -/// # fn try_main() -> Result<(), Box> { -/// let mut rng = JitterRng::new()?; -/// -/// // 1_000_000 results are required for the -/// // NIST SP 800-90B Entropy Estimation Suite -/// const ROUNDS: usize = 1_000_000; -/// let mut deltas_variable: Vec = Vec::with_capacity(ROUNDS); -/// let mut deltas_minimal: Vec = Vec::with_capacity(ROUNDS); -/// -/// for _ in 0..ROUNDS { -/// deltas_variable.push(rng.timer_stats(true) as u8); -/// deltas_minimal.push(rng.timer_stats(false) as u8); -/// } -/// -/// // Write out after the statistics collection loop, to not disturb the -/// // test results. -/// File::create("jitter_rng_var.bin")?.write(&deltas_variable)?; -/// File::create("jitter_rng_min.bin")?.write(&deltas_minimal)?; -/// # -/// # Ok(()) -/// # } -/// # -/// # fn main() { -/// # try_main().unwrap(); -/// # } -/// ``` -/// -/// This will produce two files: `jitter_rng_var.bin` and `jitter_rng_min.bin`. -/// Run the Entropy Estimation Suite in three configurations, as outlined below. -/// Every run has two steps. One step to produce an estimation, another to -/// validate the estimation. -/// -/// 1. Estimate the expected amount of entropy that is at least available with -/// each round of the entropy collector. This number should be greater than -/// the amount estimated with `64 / test_timer()`. -/// ```sh -/// python noniid_main.py -v jitter_rng_var.bin 8 -/// restart.py -v jitter_rng_var.bin 8 -/// ``` -/// 2. Estimate the expected amount of entropy that is available in the last 4 -/// bits of the timer delta after running noice sources. Note that a value of -/// `3.70` is the minimum estimated entropy for true randomness. -/// ```sh -/// python noniid_main.py -v -u 4 jitter_rng_var.bin 4 -/// restart.py -v -u 4 jitter_rng_var.bin 4 -/// ``` -/// 3. Estimate the expected amount of entropy that is available to the entropy -/// collector if both noice sources only run their minimal number of times. -/// This measures the absolute worst-case, and gives a lower bound for the -/// available entropy. -/// ```sh -/// python noniid_main.py -v -u 4 jitter_rng_min.bin 4 -/// restart.py -v -u 4 jitter_rng_min.bin 4 -/// ``` -/// -/// [`OsRng`]: struct.OsRng.html -/// [`JitterRng::new()`]: struct.JitterRng.html#method.new -/// [`new_with_timer`]: struct.JitterRng.html#method.new_with_timer -/// [`timer_stats`]: struct.JitterRng.html#method.timer_stats -pub struct JitterRng { - data: u64, // Actual random number - // Number of rounds to run the entropy collector per 64 bits - rounds: u8, - // Timer used by `measure_jitter` - timer: fn() -> u64, - // Memory for the Memory Access noise source - mem_prev_index: u16, - // Make `next_u32` not waste 32 bits - data_half_used: bool, -} - -// Note: `JitterRng` maintains a small 64-bit entropy pool. With every -// `generate` 64 new bits should be integrated in the pool. If a round of -// `generate` were to collect less than the expected 64 bit, then the returned -// value, and the new state of the entropy pool, would be in some way related to -// the initial state. It is therefore better if the initial state of the entropy -// pool is different on each call to `generate`. This has a few implications: -// - `generate` should be called once before using `JitterRng` to produce the -// first usable value (this is done by default in `new`); -// - We do not zero the entropy pool after generating a result. The reference -// implementation also does not support zeroing, but recommends generating a -// new value without using it if you want to protect a previously generated -// 'secret' value from someone inspecting the memory; -// - Implementing `Clone` seems acceptable, as it would not cause the systematic -// bias a constant might cause. Only instead of one value that could be -// potentially related to the same initial state, there are now two. - -// Entropy collector state. -// These values are not necessary to preserve across runs. -struct EcState { - // Previous time stamp to determine the timer delta - prev_time: u64, - // Deltas used for the stuck test - last_delta: i32, - last_delta2: i32, - // Memory for the Memory Access noise source - mem: [u8; MEMORY_SIZE], -} - -impl EcState { - // Stuck test by checking the: - // - 1st derivation of the jitter measurement (time delta) - // - 2nd derivation of the jitter measurement (delta of time deltas) - // - 3rd derivation of the jitter measurement (delta of delta of time - // deltas) - // - // All values must always be non-zero. - // This test is a heuristic to see whether the last measurement holds - // entropy. - fn stuck(&mut self, current_delta: i32) -> bool { - let delta2 = self.last_delta - current_delta; - let delta3 = delta2 - self.last_delta2; - - self.last_delta = current_delta; - self.last_delta2 = delta2; - - current_delta == 0 || delta2 == 0 || delta3 == 0 - } -} - -// Custom Debug implementation that does not expose the internal state -impl fmt::Debug for JitterRng { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "JitterRng {{}}") - } -} - -impl Clone for JitterRng { - fn clone(&self) -> JitterRng { - JitterRng { - data: self.data, - rounds: self.rounds, - timer: self.timer, - mem_prev_index: self.mem_prev_index, - // The 32 bits that may still be unused from the previous round are - // for the original to use, not for the clone. - data_half_used: false, - } - } -} - -/// An error that can occur when [`JitterRng::test_timer`] fails. -/// -/// [`JitterRng::test_timer`]: struct.JitterRng.html#method.test_timer -#[derive(Debug, Clone, PartialEq, Eq)] -pub enum TimerError { - /// No timer available. - NoTimer, - /// Timer too coarse to use as an entropy source. - CoarseTimer, - /// Timer is not monotonically increasing. - NotMonotonic, - /// Variations of deltas of time too small. - TinyVariantions, - /// Too many stuck results (indicating no added entropy). - TooManyStuck, - #[doc(hidden)] - __Nonexhaustive, -} - -impl TimerError { - fn description(&self) -> &'static str { - match *self { - TimerError::NoTimer => "no timer available", - TimerError::CoarseTimer => "coarse timer", - TimerError::NotMonotonic => "timer not monotonic", - TimerError::TinyVariantions => "time delta variations too small", - TimerError::TooManyStuck => "too many stuck results", - TimerError::__Nonexhaustive => unreachable!(), - } - } -} - -impl fmt::Display for TimerError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", self.description()) - } -} - -#[cfg(feature="std")] -impl ::std::error::Error for TimerError { - fn description(&self) -> &str { - self.description() - } -} - -impl From for Error { - fn from(err: TimerError) -> Error { - // Timer check is already quite permissive of failures so we don't - // expect false-positive failures, i.e. any error is irrecoverable. - Error::with_cause(ErrorKind::Unavailable, - "timer jitter failed basic quality tests", err) - } -} - -// Initialise to zero; must be positive -#[cfg(all(feature="std", not(target_arch = "wasm32")))] -static JITTER_ROUNDS: AtomicUsize = ATOMIC_USIZE_INIT; - -impl JitterRng { - /// Create a new `JitterRng`. Makes use of `std::time` for a timer, or a - /// platform-specific function with higher accuracy if necessary and - /// available. - /// - /// During initialization CPU execution timing jitter is measured a few - /// hundred times. If this does not pass basic quality tests, an error is - /// returned. The test result is cached to make subsequent calls faster. - #[cfg(all(feature="std", not(target_arch = "wasm32")))] - pub fn new() -> Result { - let mut state = JitterRng::new_with_timer(platform::get_nstime); - let mut rounds = JITTER_ROUNDS.load(Ordering::Relaxed) as u8; - if rounds == 0 { - // No result yet: run test. - // This allows the timer test to run multiple times; we don't care. - rounds = state.test_timer()?; - JITTER_ROUNDS.store(rounds as usize, Ordering::Relaxed); - info!("JitterRng: using {} rounds per u64 output", rounds); - } - state.set_rounds(rounds); - - // Fill `data` with a non-zero value. - state.gen_entropy(); - Ok(state) - } - - /// Create a new `JitterRng`. - /// A custom timer can be supplied, making it possible to use `JitterRng` in - /// `no_std` environments. - /// - /// The timer must have nanosecond precision. - /// - /// This method is more low-level than `new()`. It is the responsibility of - /// the caller to run [`test_timer`] before using any numbers generated with - /// `JitterRng`, and optionally call [`set_rounds`]. Also it is important to - /// consume at least one `u64` before using the first result to initialize - /// the entropy collection pool. - /// - /// # Example - /// - /// ``` - /// # use rand::{Rng, Error}; - /// use rand::jitter::JitterRng; - /// - /// # fn try_inner() -> Result<(), Error> { - /// fn get_nstime() -> u64 { - /// use std::time::{SystemTime, UNIX_EPOCH}; - /// - /// let dur = SystemTime::now().duration_since(UNIX_EPOCH).unwrap(); - /// // The correct way to calculate the current time is - /// // `dur.as_secs() * 1_000_000_000 + dur.subsec_nanos() as u64` - /// // But this is faster, and the difference in terms of entropy is - /// // negligible (log2(10^9) == 29.9). - /// dur.as_secs() << 30 | dur.subsec_nanos() as u64 - /// } - /// - /// let mut rng = JitterRng::new_with_timer(get_nstime); - /// let rounds = rng.test_timer()?; - /// rng.set_rounds(rounds); // optional - /// let _ = rng.gen::(); - /// - /// // Ready for use - /// let v: u64 = rng.gen(); - /// # Ok(()) - /// # } - /// - /// # let _ = try_inner(); - /// ``` - /// - /// [`test_timer`]: struct.JitterRng.html#method.test_timer - /// [`set_rounds`]: struct.JitterRng.html#method.set_rounds - pub fn new_with_timer(timer: fn() -> u64) -> JitterRng { - JitterRng { - data: 0, - rounds: 64, - timer, - mem_prev_index: 0, - data_half_used: false, - } - } - - /// Configures how many rounds are used to generate each 64-bit value. - /// This must be greater than zero, and has a big impact on performance - /// and output quality. - /// - /// [`new_with_timer`] conservatively uses 64 rounds, but often less rounds - /// can be used. The `test_timer()` function returns the minimum number of - /// rounds required for full strength (platform dependent), so one may use - /// `rng.set_rounds(rng.test_timer()?);` or cache the value. - /// - /// [`new_with_timer`]: struct.JitterRng.html#method.new_with_timer - pub fn set_rounds(&mut self, rounds: u8) { - assert!(rounds > 0); - self.rounds = rounds; - } - - // Calculate a random loop count used for the next round of an entropy - // collection, based on bits from a fresh value from the timer. - // - // The timer is folded to produce a number that contains at most `n_bits` - // bits. - // - // Note: A constant should be added to the resulting random loop count to - // prevent loops that run 0 times. - #[inline(never)] - fn random_loop_cnt(&mut self, n_bits: u32) -> u32 { - let mut rounds = 0; - - let mut time = (self.timer)(); - // Mix with the current state of the random number balance the random - // loop counter a bit more. - time ^= self.data; - - // We fold the time value as much as possible to ensure that as many - // bits of the time stamp are included as possible. - let folds = (64 + n_bits - 1) / n_bits; - let mask = (1 << n_bits) - 1; - for _ in 0..folds { - rounds ^= time & mask; - time >>= n_bits; - } - - rounds as u32 - } - - // CPU jitter noise source - // Noise source based on the CPU execution time jitter - // - // This function injects the individual bits of the time value into the - // entropy pool using an LFSR. - // - // The code is deliberately inefficient with respect to the bit shifting. - // This function not only acts as folding operation, but this function's - // execution is used to measure the CPU execution time jitter. Any change to - // the loop in this function implies that careful retesting must be done. - #[inline(never)] - fn lfsr_time(&mut self, time: u64, var_rounds: bool) { - fn lfsr(mut data: u64, time: u64) -> u64{ - for i in 1..65 { - let mut tmp = time << (64 - i); - tmp >>= 64 - 1; - - // Fibonacci LSFR with polynomial of - // x^64 + x^61 + x^56 + x^31 + x^28 + x^23 + 1 which is - // primitive according to - // http://poincare.matf.bg.ac.rs/~ezivkovm/publications/primpol1.pdf - // (the shift values are the polynomial values minus one - // due to counting bits from 0 to 63). As the current - // position is always the LSB, the polynomial only needs - // to shift data in from the left without wrap. - data ^= tmp; - data ^= (data >> 63) & 1; - data ^= (data >> 60) & 1; - data ^= (data >> 55) & 1; - data ^= (data >> 30) & 1; - data ^= (data >> 27) & 1; - data ^= (data >> 22) & 1; - data = data.rotate_left(1); - } - data - } - - // Note: in the reference implementation only the last round effects - // `self.data`, all the other results are ignored. To make sure the - // other rounds are not optimised out, we first run all but the last - // round on a throw-away value instead of the real `self.data`. - let mut lfsr_loop_cnt = 0; - if var_rounds { lfsr_loop_cnt = self.random_loop_cnt(4) }; - - let mut throw_away: u64 = 0; - for _ in 0..lfsr_loop_cnt { - throw_away = lfsr(throw_away, time); - } - black_box(throw_away); - - self.data = lfsr(self.data, time); - } - - // Memory Access noise source - // This is a noise source based on variations in memory access times - // - // This function performs memory accesses which will add to the timing - // variations due to an unknown amount of CPU wait states that need to be - // added when accessing memory. The memory size should be larger than the L1 - // caches as outlined in the documentation and the associated testing. - // - // The L1 cache has a very high bandwidth, albeit its access rate is usually - // slower than accessing CPU registers. Therefore, L1 accesses only add - // minimal variations as the CPU has hardly to wait. Starting with L2, - // significant variations are added because L2 typically does not belong to - // the CPU any more and therefore a wider range of CPU wait states is - // necessary for accesses. L3 and real memory accesses have even a wider - // range of wait states. However, to reliably access either L3 or memory, - // the `self.mem` memory must be quite large which is usually not desirable. - #[inline(never)] - fn memaccess(&mut self, mem: &mut [u8; MEMORY_SIZE], var_rounds: bool) { - let mut acc_loop_cnt = 128; - if var_rounds { acc_loop_cnt += self.random_loop_cnt(4) }; - - let mut index = self.mem_prev_index as usize; - for _ in 0..acc_loop_cnt { - // Addition of memblocksize - 1 to index with wrap around logic to - // ensure that every memory location is hit evenly. - // The modulus also allows the compiler to remove the indexing - // bounds check. - index = (index + MEMORY_BLOCKSIZE - 1) % MEMORY_SIZE; - - // memory access: just add 1 to one byte - // memory access implies read from and write to memory location - mem[index] = mem[index].wrapping_add(1); - } - self.mem_prev_index = index as u16; - } - - // This is the heart of the entropy generation: calculate time deltas and - // use the CPU jitter in the time deltas. The jitter is injected into the - // entropy pool. - // - // Ensure that `ec.prev_time` is primed before using the output of this - // function. This can be done by calling this function and not using its - // result. - fn measure_jitter(&mut self, ec: &mut EcState) -> Option<()> { - // Invoke one noise source before time measurement to add variations - self.memaccess(&mut ec.mem, true); - - // Get time stamp and calculate time delta to previous - // invocation to measure the timing variations - let time = (self.timer)(); - // Note: wrapping_sub combined with a cast to `i64` generates a correct - // delta, even in the unlikely case this is a timer that is not strictly - // monotonic. - let current_delta = time.wrapping_sub(ec.prev_time) as i64 as i32; - ec.prev_time = time; - - // Call the next noise source which also injects the data - self.lfsr_time(current_delta as u64, true); - - // Check whether we have a stuck measurement (i.e. does the last - // measurement holds entropy?). - if ec.stuck(current_delta) { return None }; - - // Rotate the data buffer by a prime number (any odd number would - // do) to ensure that every bit position of the input time stamp - // has an even chance of being merged with a bit position in the - // entropy pool. We do not use one here as the adjacent bits in - // successive time deltas may have some form of dependency. The - // chosen value of 7 implies that the low 7 bits of the next - // time delta value is concatenated with the current time delta. - self.data = self.data.rotate_left(7); - - Some(()) - } - - // Shuffle the pool a bit by mixing some value with a bijective function - // (XOR) into the pool. - // - // The function generates a mixer value that depends on the bits set and - // the location of the set bits in the random number generated by the - // entropy source. Therefore, based on the generated random number, this - // mixer value can have 2^64 different values. That mixer value is - // initialized with the first two SHA-1 constants. After obtaining the - // mixer value, it is XORed into the random number. - // - // The mixer value is not assumed to contain any entropy. But due to the - // XOR operation, it can also not destroy any entropy present in the - // entropy pool. - #[inline(never)] - fn stir_pool(&mut self) { - // This constant is derived from the first two 32 bit initialization - // vectors of SHA-1 as defined in FIPS 180-4 section 5.3.1 - // The order does not really matter as we do not rely on the specific - // numbers. We just pick the SHA-1 constants as they have a good mix of - // bit set and unset. - const CONSTANT: u64 = 0x67452301efcdab89; - - // The start value of the mixer variable is derived from the third - // and fourth 32 bit initialization vector of SHA-1 as defined in - // FIPS 180-4 section 5.3.1 - let mut mixer = 0x98badcfe10325476; - - // This is a constant time function to prevent leaking timing - // information about the random number. - // The normal code is: - // ``` - // for i in 0..64 { - // if ((self.data >> i) & 1) == 1 { mixer ^= CONSTANT; } - // } - // ``` - // This is a bit fragile, as LLVM really wants to use branches here, and - // we rely on it to not recognise the opportunity. - for i in 0..64 { - let apply = (self.data >> i) & 1; - let mask = !apply.wrapping_sub(1); - mixer ^= CONSTANT & mask; - mixer = mixer.rotate_left(1); - } - - self.data ^= mixer; - } - - fn gen_entropy(&mut self) -> u64 { - trace!("JitterRng: collecting entropy"); - - // Prime `ec.prev_time`, and run the noice sources to make sure the - // first loop round collects the expected entropy. - let mut ec = EcState { - prev_time: (self.timer)(), - last_delta: 0, - last_delta2: 0, - mem: [0; MEMORY_SIZE], - }; - let _ = self.measure_jitter(&mut ec); - - for _ in 0..self.rounds { - // If a stuck measurement is received, repeat measurement - // Note: we do not guard against an infinite loop, that would mean - // the timer suddenly became broken. - while self.measure_jitter(&mut ec).is_none() {} - } - - // Do a single read from `self.mem` to make sure the Memory Access noise - // source is not optimised out. - black_box(ec.mem[0]); - - self.stir_pool(); - self.data - } - - /// Basic quality tests on the timer, by measuring CPU timing jitter a few - /// hundred times. - /// - /// If succesful, this will return the estimated number of rounds necessary - /// to collect 64 bits of entropy. Otherwise a [`TimerError`] with the cause - /// of the failure will be returned. - /// - /// [`TimerError`]: enum.TimerError.html - pub fn test_timer(&mut self) -> Result { - debug!("JitterRng: testing timer ..."); - // We could add a check for system capabilities such as `clock_getres` - // or check for `CONFIG_X86_TSC`, but it does not make much sense as the - // following sanity checks verify that we have a high-resolution timer. - - let mut delta_sum = 0; - let mut old_delta = 0; - - let mut time_backwards = 0; - let mut count_mod = 0; - let mut count_stuck = 0; - - let mut ec = EcState { - prev_time: (self.timer)(), - last_delta: 0, - last_delta2: 0, - mem: [0; MEMORY_SIZE], - }; - - // TESTLOOPCOUNT needs some loops to identify edge systems. - // 100 is definitely too little. - const TESTLOOPCOUNT: u64 = 300; - const CLEARCACHE: u64 = 100; - - for i in 0..(CLEARCACHE + TESTLOOPCOUNT) { - // Measure time delta of core entropy collection logic - let time = (self.timer)(); - self.memaccess(&mut ec.mem, true); - self.lfsr_time(time, true); - let time2 = (self.timer)(); - - // Test whether timer works - if time == 0 || time2 == 0 { - return Err(TimerError::NoTimer); - } - let delta = time2.wrapping_sub(time) as i64 as i32; - - // Test whether timer is fine grained enough to provide delta even - // when called shortly after each other -- this implies that we also - // have a high resolution timer - if delta == 0 { - return Err(TimerError::CoarseTimer); - } - - // Up to here we did not modify any variable that will be - // evaluated later, but we already performed some work. Thus we - // already have had an impact on the caches, branch prediction, - // etc. with the goal to clear it to get the worst case - // measurements. - if i < CLEARCACHE { continue; } - - if ec.stuck(delta) { count_stuck += 1; } - - // Test whether we have an increasing timer. - if !(time2 > time) { time_backwards += 1; } - - // Count the number of times the counter increases in steps of 100ns - // or greater. - if (delta % 100) == 0 { count_mod += 1; } - - // Ensure that we have a varying delta timer which is necessary for - // the calculation of entropy -- perform this check only after the - // first loop is executed as we need to prime the old_delta value - delta_sum += (delta - old_delta).abs() as u64; - old_delta = delta; - } - - // Do a single read from `self.mem` to make sure the Memory Access noise - // source is not optimised out. - black_box(ec.mem[0]); - - // We allow the time to run backwards for up to three times. - // This can happen if the clock is being adjusted by NTP operations. - // If such an operation just happens to interfere with our test, it - // should not fail. The value of 3 should cover the NTP case being - // performed during our test run. - if time_backwards > 3 { - return Err(TimerError::NotMonotonic); - } - - // Test that the available amount of entropy per round does not get to - // low. We expect 1 bit of entropy per round as a reasonable minimum - // (although less is possible, it means the collector loop has to run - // much more often). - // `assert!(delta_average >= log2(1))` - // `assert!(delta_sum / TESTLOOPCOUNT >= 1)` - // `assert!(delta_sum >= TESTLOOPCOUNT)` - if delta_sum < TESTLOOPCOUNT { - return Err(TimerError::TinyVariantions); - } - - // Ensure that we have variations in the time stamp below 100 for at - // least 10% of all checks -- on some platforms, the counter increments - // in multiples of 100, but not always - if count_mod > (TESTLOOPCOUNT * 9 / 10) { - return Err(TimerError::CoarseTimer); - } - - // If we have more than 90% stuck results, then this Jitter RNG is - // likely to not work well. - if count_stuck > (TESTLOOPCOUNT * 9 / 10) { - return Err(TimerError::TooManyStuck); - } - - // Estimate the number of `measure_jitter` rounds necessary for 64 bits - // of entropy. - // - // We don't try very hard to come up with a good estimate of the - // available bits of entropy per round here for two reasons: - // 1. Simple estimates of the available bits (like Shannon entropy) are - // too optimistic. - // 2. Unless we want to waste a lot of time during intialization, there - // only a small number of samples are available. - // - // Therefore we use a very simple and conservative estimate: - // `let bits_of_entropy = log2(delta_average) / 2`. - // - // The number of rounds `measure_jitter` should run to collect 64 bits - // of entropy is `64 / bits_of_entropy`. - let delta_average = delta_sum / TESTLOOPCOUNT; - - if delta_average >= 16 { - let log2 = 64 - delta_average.leading_zeros(); - // Do something similar to roundup(64/(log2/2)): - Ok( ((64u32 * 2 + log2 - 1) / log2) as u8) - } else { - // For values < 16 the rounding error becomes too large, use a - // lookup table. - // Values 0 and 1 are invalid, and filtered out by the - // `delta_sum < TESTLOOPCOUNT` test above. - let log2_lookup = [0, 0, 128, 81, 64, 56, 50, 46, - 43, 41, 39, 38, 36, 35, 34, 33]; - Ok(log2_lookup[delta_average as usize]) - } - } - - /// Statistical test: return the timer delta of one normal run of the - /// `JitterRng` entropy collector. - /// - /// Setting `var_rounds` to `true` will execute the memory access and the - /// CPU jitter noice sources a variable amount of times (just like a real - /// `JitterRng` round). - /// - /// Setting `var_rounds` to `false` will execute the noice sources the - /// minimal number of times. This can be used to measure the minimum amount - /// of entropy one round of the entropy collector can collect in the worst - /// case. - /// - /// See [Quality testing](struct.JitterRng.html#quality-testing) on how to - /// use `timer_stats` to test the quality of `JitterRng`. - pub fn timer_stats(&mut self, var_rounds: bool) -> i64 { - let mut mem = [0; MEMORY_SIZE]; - - let time = (self.timer)(); - self.memaccess(&mut mem, var_rounds); - self.lfsr_time(time, var_rounds); - let time2 = (self.timer)(); - time2.wrapping_sub(time) as i64 - } -} - -#[cfg(feature="std")] -mod platform { - #[cfg(not(any(target_os = "macos", target_os = "ios", - target_os = "windows", - target_arch = "wasm32")))] - pub fn get_nstime() -> u64 { - use std::time::{SystemTime, UNIX_EPOCH}; - - let dur = SystemTime::now().duration_since(UNIX_EPOCH).unwrap(); - // The correct way to calculate the current time is - // `dur.as_secs() * 1_000_000_000 + dur.subsec_nanos() as u64` - // But this is faster, and the difference in terms of entropy is - // negligible (log2(10^9) == 29.9). - dur.as_secs() << 30 | dur.subsec_nanos() as u64 - } - - #[cfg(any(target_os = "macos", target_os = "ios"))] - pub fn get_nstime() -> u64 { - extern crate libc; - // On Mac OS and iOS std::time::SystemTime only has 1000ns resolution. - // We use `mach_absolute_time` instead. This provides a CPU dependent - // unit, to get real nanoseconds the result should by multiplied by - // numer/denom from `mach_timebase_info`. - // But we are not interested in the exact nanoseconds, just entropy. So - // we use the raw result. - unsafe { libc::mach_absolute_time() } - } - - #[cfg(target_os = "windows")] - pub fn get_nstime() -> u64 { - extern crate winapi; - unsafe { - let mut t = super::mem::zeroed(); - winapi::um::profileapi::QueryPerformanceCounter(&mut t); - *t.QuadPart() as u64 - } - } -} - -// A function that is opaque to the optimizer to assist in avoiding dead-code -// elimination. Taken from `bencher`. -fn black_box(dummy: T) -> T { - unsafe { - let ret = ptr::read_volatile(&dummy); - mem::forget(dummy); - ret - } -} - -impl RngCore for JitterRng { - fn next_u32(&mut self) -> u32 { - // We want to use both parts of the generated entropy - if self.data_half_used { - self.data_half_used = false; - (self.data >> 32) as u32 - } else { - self.data = self.next_u64(); - self.data_half_used = true; - self.data as u32 - } - } - - fn next_u64(&mut self) -> u64 { - self.data_half_used = false; - self.gen_entropy() - } - - fn fill_bytes(&mut self, dest: &mut [u8]) { - // Fill using `next_u32`. This is faster for filling small slices (four - // bytes or less), while the overhead is negligible. - // - // This is done especially for wrappers that implement `next_u32` - // themselves via `fill_bytes`. - impls::fill_bytes_via_next(self, dest) - } - - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - Ok(self.fill_bytes(dest)) - } -} - -impl CryptoRng for JitterRng {} - -#[cfg(test)] -mod test_jitter_init { - use jitter::JitterRng; - - #[cfg(all(feature="std", not(target_arch = "wasm32")))] - #[test] - fn test_jitter_init() { - use RngCore; - // Because this is a debug build, measurements here are not representive - // of the final release build. - // Don't fail this test if initializing `JitterRng` fails because of a - // bad timer (the timer from the standard library may not have enough - // accuracy on all platforms). - match JitterRng::new() { - Ok(ref mut rng) => { - // false positives are possible, but extremely unlikely - assert!(rng.next_u32() | rng.next_u32() != 0); - }, - Err(_) => {}, - } - } - - #[test] - fn test_jitter_bad_timer() { - fn bad_timer() -> u64 { 0 } - let mut rng = JitterRng::new_with_timer(bad_timer); - assert!(rng.test_timer().is_err()); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/rngs/mock.rs cargo-0.37.0/vendor/rand-0.5.6/src/rngs/mock.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/rngs/mock.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/rngs/mock.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Mock random number generator - -use rand_core::{RngCore, Error, impls}; - -/// A simple implementation of `RngCore` for testing purposes. -/// -/// This generates an arithmetic sequence (i.e. adds a constant each step) -/// over a `u64` number, using wrapping arithmetic. If the increment is 0 -/// the generator yields a constant. -/// -/// ``` -/// use rand::Rng; -/// use rand::rngs::mock::StepRng; -/// -/// let mut my_rng = StepRng::new(2, 1); -/// let sample: [u64; 3] = my_rng.gen(); -/// assert_eq!(sample, [2, 3, 4]); -/// ``` -#[derive(Debug, Clone)] -pub struct StepRng { - v: u64, - a: u64, -} - -impl StepRng { - /// Create a `StepRng`, yielding an arithmetic sequence starting with - /// `initial` and incremented by `increment` each time. - pub fn new(initial: u64, increment: u64) -> Self { - StepRng { v: initial, a: increment } - } -} - -impl RngCore for StepRng { - fn next_u32(&mut self) -> u32 { - self.next_u64() as u32 - } - - fn next_u64(&mut self) -> u64 { - let result = self.v; - self.v = self.v.wrapping_add(self.a); - result - } - - fn fill_bytes(&mut self, dest: &mut [u8]) { - impls::fill_bytes_via_next(self, dest); - } - - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - Ok(self.fill_bytes(dest)) - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/rngs/mod.rs cargo-0.37.0/vendor/rand-0.5.6/src/rngs/mod.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/rngs/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/rngs/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,218 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Random number generators and adapters for common usage: -//! -//! - [`ThreadRng`], a fast, secure, auto-seeded thread-local generator -//! - [`StdRng`] and [`SmallRng`], algorithms to cover typical usage -//! - [`EntropyRng`], [`OsRng`] and [`JitterRng`] as entropy sources -//! - [`mock::StepRng`] as a simple counter for tests -//! - [`adapter::ReadRng`] to read from a file/stream -//! -//! # Background — Random number generators (RNGs) -//! -//! Computers are inherently deterministic, so to get *random* numbers one -//! either has to use a hardware generator or collect bits of *entropy* from -//! various sources (e.g. event timestamps, or jitter). This is a relatively -//! slow and complicated operation. -//! -//! Generally the operating system will collect some entropy, remove bias, and -//! use that to seed its own PRNG; [`OsRng`] provides an interface to this. -//! [`JitterRng`] is an entropy collector included with Rand that measures -//! jitter in the CPU execution time, and jitter in memory access time. -//! [`EntropyRng`] is a wrapper that uses the best entropy source that is -//! available. -//! -//! ## Pseudo-random number generators -//! -//! What is commonly used instead of "true" random number renerators, are -//! *pseudo-random number generators* (PRNGs), deterministic algorithms that -//! produce an infinite stream of pseudo-random numbers from a small random -//! seed. PRNGs are faster, and have better provable properties. The numbers -//! produced can be statistically of very high quality and can be impossible to -//! predict. (They can also have obvious correlations and be trivial to predict; -//! quality varies.) -//! -//! There are two different types of PRNGs: those developed for simulations -//! and statistics, and those developed for use in cryptography; the latter are -//! called Cryptographically Secure PRNGs (CSPRNG or CPRNG). Both types can -//! have good statistical quality but the latter also have to be impossible to -//! predict, even after seeing many previous output values. Rand provides a good -//! default algorithm from each class: -//! -//! - [`SmallRng`] is a PRNG chosen for low memory usage, high performance and -//! good statistical quality. -//! The current algorithm (plain Xorshift) unfortunately performs -//! poorly in statistical quality test suites (TestU01 and PractRand) and will -//! be replaced in the next major release. -//! - [`StdRng`] is a CSPRNG chosen for good performance and trust of security -//! (based on reviews, maturity and usage). The current algorithm is HC-128, -//! which is one of the recommendations by ECRYPT's eSTREAM project. -//! -//! The above PRNGs do not cover all use-cases; more algorithms can be found in -//! the [`prng` module], as well as in several other crates. For example, you -//! may wish a CSPRNG with significantly lower memory usage than [`StdRng`] -//! while being less concerned about performance, in which case [`ChaChaRng`] -//! is a good choice. -//! -//! One complexity is that the internal state of a PRNG must change with every -//! generated number. For APIs this generally means a mutable reference to the -//! state of the PRNG has to be passed around. -//! -//! A solution is [`ThreadRng`]. This is a thread-local implementation of -//! [`StdRng`] with automatic seeding on first use. It is the best choice if you -//! "just" want a convenient, secure, fast random number source. Use via the -//! [`thread_rng`] function, which gets a reference to the current thread's -//! local instance. -//! -//! ## Seeding -//! -//! As mentioned above, PRNGs require a random seed in order to produce random -//! output. This is especially important for CSPRNGs, which are still -//! deterministic algorithms, thus can only be secure if their seed value is -//! also secure. To seed a PRNG, use one of: -//! -//! - [`FromEntropy::from_entropy`]; this is the most convenient way to seed -//! with fresh, secure random data. -//! - [`SeedableRng::from_rng`]; this allows seeding from another PRNG or -//! from an entropy source such as [`EntropyRng`]. -//! - [`SeedableRng::from_seed`]; this is mostly useful if you wish to be able -//! to reproduce the output sequence by using a fixed seed. (Don't use -//! [`StdRng`] or [`SmallRng`] in this case since different algorithms may be -//! used by future versions of Rand; use an algorithm from the -//! [`prng` module].) -//! -//! ## Conclusion -//! -//! - [`thread_rng`] is what you often want to use. -//! - If you want more control, flexibility, or better performance, use -//! [`StdRng`], [`SmallRng`] or an algorithm from the [`prng` module]. -//! - Use [`FromEntropy::from_entropy`] to seed new PRNGs. -//! - If you need reproducibility, use [`SeedableRng::from_seed`] combined with -//! a named PRNG. -//! -//! More information and notes on cryptographic security can be found -//! in the [`prng` module]. -//! -//! ## Examples -//! -//! Examples of seeding PRNGs: -//! -//! ``` -//! use rand::prelude::*; -//! # use rand::Error; -//! -//! // StdRng seeded securely by the OS or local entropy collector: -//! let mut rng = StdRng::from_entropy(); -//! # let v: u32 = rng.gen(); -//! -//! // SmallRng seeded from thread_rng: -//! # fn try_inner() -> Result<(), Error> { -//! let mut rng = SmallRng::from_rng(thread_rng())?; -//! # let v: u32 = rng.gen(); -//! # Ok(()) -//! # } -//! # try_inner().unwrap(); -//! -//! // SmallRng seeded by a constant, for deterministic results: -//! let seed = [1,2,3,4, 5,6,7,8, 9,10,11,12, 13,14,15,16]; // byte array -//! let mut rng = SmallRng::from_seed(seed); -//! # let v: u32 = rng.gen(); -//! ``` -//! -//! -//! # Implementing custom RNGs -//! -//! If you want to implement custom RNG, see the [`rand_core`] crate. The RNG -//! will have to implement the [`RngCore`] trait, where the [`Rng`] trait is -//! build on top of. -//! -//! If the RNG needs seeding, also implement the [`SeedableRng`] trait. -//! -//! [`CryptoRng`] is a marker trait cryptographically secure PRNGs can -//! implement. -//! -//! -// This module: -//! [`ThreadRng`]: struct.ThreadRng.html -//! [`StdRng`]: struct.StdRng.html -//! [`SmallRng`]: struct.SmallRng.html -//! [`EntropyRng`]: struct.EntropyRng.html -//! [`OsRng`]: struct.OsRng.html -//! [`JitterRng`]: struct.JitterRng.html -// Other traits and functions: -//! [`rand_core`]: https://crates.io/crates/rand_core -//! [`prng` module]: ../prng/index.html -//! [`CryptoRng`]: ../trait.CryptoRng.html -//! [`FromEntropy`]: ../trait.FromEntropy.html -//! [`FromEntropy::from_entropy`]: ../trait.FromEntropy.html#tymethod.from_entropy -//! [`RngCore`]: ../trait.RngCore.html -//! [`Rng`]: ../trait.Rng.html -//! [`SeedableRng`]: ../trait.SeedableRng.html -//! [`SeedableRng::from_rng`]: ../trait.SeedableRng.html#tymethod.from_rng -//! [`SeedableRng::from_seed`]: ../trait.SeedableRng.html#tymethod.from_seed -//! [`thread_rng`]: ../fn.thread_rng.html -//! [`mock::StepRng`]: mock/struct.StepRng.html -//! [`adapter::ReadRng`]: adapter/struct.ReadRng.html -//! [`ChaChaRng`]: ../prng/chacha/struct.ChaChaRng.html - -pub mod adapter; - -#[cfg(feature="std")] mod entropy; -#[doc(hidden)] pub mod jitter; -pub mod mock; // Public so we don't export `StepRng` directly, making it a bit - // more clear it is intended for testing. -mod small; -mod std; -#[cfg(feature="std")] pub(crate) mod thread; - - -pub use self::jitter::{JitterRng, TimerError}; -#[cfg(feature="std")] pub use self::entropy::EntropyRng; - -pub use self::small::SmallRng; -pub use self::std::StdRng; -#[cfg(feature="std")] pub use self::thread::ThreadRng; - -#[cfg(all(feature="std", - any(target_os = "linux", target_os = "android", - target_os = "netbsd", - target_os = "dragonfly", - target_os = "haiku", - target_os = "emscripten", - target_os = "solaris", - target_os = "cloudabi", - target_os = "macos", target_os = "ios", - target_os = "freebsd", - target_os = "openbsd", target_os = "bitrig", - target_os = "redox", - target_os = "fuchsia", - windows, - all(target_arch = "wasm32", feature = "stdweb") -)))] -mod os; - -#[cfg(all(feature="std", - any(target_os = "linux", target_os = "android", - target_os = "netbsd", - target_os = "dragonfly", - target_os = "haiku", - target_os = "emscripten", - target_os = "solaris", - target_os = "cloudabi", - target_os = "macos", target_os = "ios", - target_os = "freebsd", - target_os = "openbsd", target_os = "bitrig", - target_os = "redox", - target_os = "fuchsia", - windows, - all(target_arch = "wasm32", feature = "stdweb") -)))] -pub use self::os::OsRng; diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/rngs/os.rs cargo-0.37.0/vendor/rand-0.5.6/src/rngs/os.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/rngs/os.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/rngs/os.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,1171 +0,0 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Interface to the random number generator of the operating system. - -use std::fmt; -use rand_core::{CryptoRng, RngCore, Error, impls}; - -/// A random number generator that retrieves randomness straight from the -/// operating system. -/// -/// This is the preferred external source of entropy for most applications. -/// Commonly it is used to initialize a user-space RNG, which can then be used -/// to generate random values with much less overhead than `OsRng`. -/// -/// You may prefer to use [`EntropyRng`] instead of `OsRng`. It is unlikely, but -/// not entirely theoretical, for `OsRng` to fail. In such cases [`EntropyRng`] -/// falls back on a good alternative entropy source. -/// -/// `OsRng::new()` is guaranteed to be very cheap (after the first successful -/// call), and will never consume more than one file handle per process. -/// -/// # Platform sources -/// -/// | OS | interface -/// |------------------|--------------------------------------------------------- -/// | Linux, Android | [`getrandom`][1] system call if available, otherwise [`/dev/urandom`][2] after reading from `/dev/random` once -/// | Windows | [`RtlGenRandom`][3] -/// | macOS, iOS | [`SecRandomCopyBytes`][4] -/// | FreeBSD | [`kern.arandom`][5] -/// | OpenBSD, Bitrig | [`getentropy`][6] -/// | NetBSD | [`/dev/urandom`][7] after reading from `/dev/random` once -/// | Dragonfly BSD | [`/dev/random`][8] -/// | Solaris, illumos | [`getrandom`][9] system call if available, otherwise [`/dev/random`][10] -/// | Fuchsia OS | [`cprng_draw`][11] -/// | Redox | [`rand:`][12] -/// | CloudABI | [`random_get`][13] -/// | Haiku | `/dev/random` (identical to `/dev/urandom`) -/// | Web browsers | [`Crypto.getRandomValues`][14] (see [Support for WebAssembly and ams.js][14]) -/// | Node.js | [`crypto.randomBytes`][15] (see [Support for WebAssembly and ams.js][16]) -/// -/// Rand doesn't have a blanket implementation for all Unix-like operating -/// systems that reads from `/dev/urandom`. This ensures all supported operating -/// systems are using the recommended interface and respect maximum buffer -/// sizes. -/// -/// ## Support for WebAssembly and ams.js -/// -/// The three Emscripten targets `asmjs-unknown-emscripten`, -/// `wasm32-unknown-emscripten` and `wasm32-experimental-emscripten` use -/// Emscripten's emulation of `/dev/random` on web browsers and Node.js. -/// Unfortunately it falls back to the insecure `Math.random()` if a browser -/// doesn't support [`Crypto.getRandomValues`][12]. -/// -/// The bare Wasm target `wasm32-unknown-unknown` tries to call the javascript -/// methods directly, using `stdweb` in combination with `cargo-web`. -/// `wasm-bindgen` is not yet supported. -/// -/// ## Early boot -/// -/// It is possible that early in the boot process the OS hasn't had enough time -/// yet to collect entropy to securely seed its RNG, especially on virtual -/// machines. -/// -/// Some operating systems always block the thread until the RNG is securely -/// seeded. This can take anywhere from a few seconds to more than a minute. -/// Others make a best effort to use a seed from before the shutdown and don't -/// document much. -/// -/// A few, Linux, NetBSD and Solaris, offer a choice between blocking, and -/// getting an error. With `try_fill_bytes` we choose to get the error -/// ([`ErrorKind::NotReady`]), while the other methods use a blocking interface. -/// -/// On Linux (when the `genrandom` system call is not available) and on NetBSD -/// reading from `/dev/urandom` never blocks, even when the OS hasn't collected -/// enough entropy yet. As a countermeasure we try to do a single read from -/// `/dev/random` until we know the OS RNG is initialized (and store this in a -/// global static). -/// -/// # Panics -/// -/// `OsRng` is extremely unlikely to fail if `OsRng::new()`, and one read from -/// it, where succesfull. But in case it does fail, only [`try_fill_bytes`] is -/// able to report the cause. Depending on the error the other [`RngCore`] -/// methods will retry several times, and panic in case the error remains. -/// -/// [`EntropyRng`]: struct.EntropyRng.html -/// [`RngCore`]: ../trait.RngCore.html -/// [`try_fill_bytes`]: ../trait.RngCore.html#method.tymethod.try_fill_bytes -/// [`ErrorKind::NotReady`]: ../enum.ErrorKind.html#variant.NotReady -/// -/// [1]: http://man7.org/linux/man-pages/man2/getrandom.2.html -/// [2]: http://man7.org/linux/man-pages/man4/urandom.4.html -/// [3]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa387694.aspx -/// [4]: https://developer.apple.com/documentation/security/1399291-secrandomcopybytes?language=objc -/// [5]: https://www.freebsd.org/cgi/man.cgi?query=random&sektion=4 -/// [6]: https://man.openbsd.org/getentropy.2 -/// [7]: http://netbsd.gw.com/cgi-bin/man-cgi?random+4+NetBSD-current -/// [8]: https://leaf.dragonflybsd.org/cgi/web-man?command=random§ion=4 -/// [9]: https://docs.oracle.com/cd/E88353_01/html/E37841/getrandom-2.html -/// [10]: https://docs.oracle.com/cd/E86824_01/html/E54777/random-7d.html -/// [11]: https://fuchsia.googlesource.com/zircon/+/HEAD/docs/syscalls/cprng_draw.md -/// [12]: https://github.com/redox-os/randd/blob/master/src/main.rs -/// [13]: https://github.com/NuxiNL/cloudabi/blob/v0.20/cloudabi.txt#L1826 -/// [14]: https://www.w3.org/TR/WebCryptoAPI/#Crypto-method-getRandomValues -/// [15]: https://nodejs.org/api/crypto.html#crypto_crypto_randombytes_size_callback -/// [16]: #support-for-webassembly-and-amsjs - - -#[derive(Clone)] -pub struct OsRng(imp::OsRng); - -impl fmt::Debug for OsRng { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - self.0.fmt(f) - } -} - -impl OsRng { - /// Create a new `OsRng`. - pub fn new() -> Result { - imp::OsRng::new().map(OsRng) - } -} - -impl CryptoRng for OsRng {} - -impl RngCore for OsRng { - fn next_u32(&mut self) -> u32 { - impls::next_u32_via_fill(self) - } - - fn next_u64(&mut self) -> u64 { - impls::next_u64_via_fill(self) - } - - fn fill_bytes(&mut self, dest: &mut [u8]) { - use std::{time, thread}; - - // We cannot return Err(..), so we try to handle before panicking. - const MAX_RETRY_PERIOD: u32 = 10; // max 10s - const WAIT_DUR_MS: u32 = 100; // retry every 100ms - let wait_dur = time::Duration::from_millis(WAIT_DUR_MS as u64); - const RETRY_LIMIT: u32 = (MAX_RETRY_PERIOD * 1000) / WAIT_DUR_MS; - const TRANSIENT_RETRIES: u32 = 8; - let mut err_count = 0; - let mut error_logged = false; - - // Maybe block until the OS RNG is initialized - let mut read = 0; - if let Ok(n) = self.0.test_initialized(dest, true) { read = n }; - let dest = &mut dest[read..]; - - loop { - if let Err(e) = self.try_fill_bytes(dest) { - if err_count >= RETRY_LIMIT { - error!("OsRng failed too many times; last error: {}", e); - panic!("OsRng failed too many times; last error: {}", e); - } - - if e.kind.should_wait() { - if !error_logged { - warn!("OsRng failed; waiting up to {}s and retrying. Error: {}", - MAX_RETRY_PERIOD, e); - error_logged = true; - } - err_count += 1; - thread::sleep(wait_dur); - continue; - } else if e.kind.should_retry() { - if !error_logged { - warn!("OsRng failed; retrying up to {} times. Error: {}", - TRANSIENT_RETRIES, e); - error_logged = true; - } - err_count += (RETRY_LIMIT + TRANSIENT_RETRIES - 1) - / TRANSIENT_RETRIES; // round up - continue; - } else { - error!("OsRng failed: {}", e); - panic!("OsRng fatal error: {}", e); - } - } - - break; - } - } - - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - // Some systems do not support reading 0 random bytes. - // (And why waste a system call?) - if dest.len() == 0 { return Ok(()); } - - let read = self.0.test_initialized(dest, false)?; - let dest = &mut dest[read..]; - - let max = self.0.max_chunk_size(); - if dest.len() <= max { - trace!("OsRng: reading {} bytes via {}", - dest.len(), self.0.method_str()); - } else { - trace!("OsRng: reading {} bytes via {} in {} chunks of {} bytes", - dest.len(), self.0.method_str(), (dest.len() + max) / max, max); - } - for slice in dest.chunks_mut(max) { - self.0.fill_chunk(slice)?; - } - Ok(()) - } -} - -trait OsRngImpl where Self: Sized { - // Create a new `OsRng` platform interface. - fn new() -> Result; - - // Fill a chunk with random bytes. - fn fill_chunk(&mut self, dest: &mut [u8]) -> Result<(), Error>; - - // Test whether the OS RNG is initialized. This method may not be possible - // to support cheaply (or at all) on all operating systems. - // - // If `blocking` is set, this will cause the OS the block execution until - // its RNG is initialized. - // - // Random values that are read while this are stored in `dest`, the amount - // of read bytes is returned. - fn test_initialized(&mut self, _dest: &mut [u8], _blocking: bool) - -> Result { Ok(0) } - - // Maximum chunk size supported. - fn max_chunk_size(&self) -> usize { ::core::usize::MAX } - - // Name of the OS interface (used for logging). - fn method_str(&self) -> &'static str; -} - - - - -// Helper functions to read from a random device such as `/dev/urandom`. -// -// All instances use a single internal file handle, to prevent possible -// exhaustion of file descriptors. -#[cfg(any(target_os = "linux", target_os = "android", - target_os = "netbsd", target_os = "dragonfly", - target_os = "solaris", target_os = "redox", - target_os = "haiku", target_os = "emscripten"))] -mod random_device { - use {Error, ErrorKind}; - use std::fs::File; - use std::io; - use std::io::Read; - use std::sync::{Once, Mutex, ONCE_INIT}; - - // TODO: remove outer Option when `Mutex::new(None)` is a constant expression - static mut READ_RNG_FILE: Option>> = None; - static READ_RNG_ONCE: Once = ONCE_INIT; - - #[allow(unused)] - pub fn open(path: &'static str, open_fn: F) -> Result<(), Error> - where F: Fn(&'static str) -> Result - { - READ_RNG_ONCE.call_once(|| { - unsafe { READ_RNG_FILE = Some(Mutex::new(None)) } - }); - - // We try opening the file outside the `call_once` fn because we cannot - // clone the error, thus we must retry on failure. - - let mutex = unsafe { READ_RNG_FILE.as_ref().unwrap() }; - let mut guard = mutex.lock().unwrap(); - if (*guard).is_none() { - info!("OsRng: opening random device {}", path); - let file = open_fn(path).map_err(map_err)?; - *guard = Some(file); - }; - Ok(()) - } - - pub fn read(dest: &mut [u8]) -> Result<(), Error> { - // We expect this function only to be used after `random_device::open` - // was succesful. Therefore we can assume that our memory was set with a - // valid object. - let mutex = unsafe { READ_RNG_FILE.as_ref().unwrap() }; - let mut guard = mutex.lock().unwrap(); - let file = (*guard).as_mut().unwrap(); - - // Use `std::io::read_exact`, which retries on `ErrorKind::Interrupted`. - file.read_exact(dest).map_err(|err| { - Error::with_cause(ErrorKind::Unavailable, - "error reading random device", err) - }) - - } - - pub fn map_err(err: io::Error) -> Error { - match err.kind() { - io::ErrorKind::Interrupted => - Error::new(ErrorKind::Transient, "interrupted"), - io::ErrorKind::WouldBlock => - Error::with_cause(ErrorKind::NotReady, - "OS RNG not yet seeded", err), - _ => Error::with_cause(ErrorKind::Unavailable, - "error while opening random device", err) - } - } -} - - -#[cfg(any(target_os = "linux", target_os = "android"))] -mod imp { - extern crate libc; - - use {Error, ErrorKind}; - use super::random_device; - use super::OsRngImpl; - - use std::io; - use std::io::Read; - use std::fs::{File, OpenOptions}; - use std::os::unix::fs::OpenOptionsExt; - use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering}; - use std::sync::{Once, ONCE_INIT}; - - #[derive(Clone, Debug)] - pub struct OsRng { - method: OsRngMethod, - initialized: bool, - } - - #[derive(Clone, Debug)] - enum OsRngMethod { - GetRandom, - RandomDevice, - } - - impl OsRngImpl for OsRng { - fn new() -> Result { - if is_getrandom_available() { - return Ok(OsRng { method: OsRngMethod::GetRandom, - initialized: false }); - } - random_device::open("/dev/urandom", &|p| File::open(p))?; - Ok(OsRng { method: OsRngMethod::RandomDevice, initialized: false }) - } - - fn fill_chunk(&mut self, dest: &mut [u8]) -> Result<(), Error> { - match self.method { - OsRngMethod::GetRandom => getrandom_try_fill(dest, false), - OsRngMethod::RandomDevice => random_device::read(dest), - } - } - - fn test_initialized(&mut self, dest: &mut [u8], blocking: bool) - -> Result - { - static OS_RNG_INITIALIZED: AtomicBool = ATOMIC_BOOL_INIT; - if !self.initialized { - self.initialized = OS_RNG_INITIALIZED.load(Ordering::Relaxed); - } - if self.initialized { return Ok(0); } - - let result = match self.method { - OsRngMethod::GetRandom => { - getrandom_try_fill(dest, blocking)?; - Ok(dest.len()) - } - OsRngMethod::RandomDevice => { - info!("OsRng: testing random device /dev/random"); - let mut file = OpenOptions::new() - .read(true) - .custom_flags(if blocking { 0 } else { libc::O_NONBLOCK }) - .open("/dev/random") - .map_err(random_device::map_err)?; - file.read(&mut dest[..1]).map_err(random_device::map_err)?; - Ok(1) - } - }; - OS_RNG_INITIALIZED.store(true, Ordering::Relaxed); - self.initialized = true; - result - } - - fn method_str(&self) -> &'static str { - match self.method { - OsRngMethod::GetRandom => "getrandom", - OsRngMethod::RandomDevice => "/dev/urandom", - } - } - } - - #[cfg(target_arch = "x86_64")] - const NR_GETRANDOM: libc::c_long = 318; - #[cfg(target_arch = "x86")] - const NR_GETRANDOM: libc::c_long = 355; - #[cfg(target_arch = "arm")] - const NR_GETRANDOM: libc::c_long = 384; - #[cfg(target_arch = "aarch64")] - const NR_GETRANDOM: libc::c_long = 278; - #[cfg(target_arch = "s390x")] - const NR_GETRANDOM: libc::c_long = 349; - #[cfg(target_arch = "powerpc")] - const NR_GETRANDOM: libc::c_long = 359; - #[cfg(target_arch = "mips")] // old ABI - const NR_GETRANDOM: libc::c_long = 4353; - #[cfg(target_arch = "mips64")] - const NR_GETRANDOM: libc::c_long = 5313; - #[cfg(not(any(target_arch = "x86_64", target_arch = "x86", - target_arch = "arm", target_arch = "aarch64", - target_arch = "s390x", target_arch = "powerpc", - target_arch = "mips", target_arch = "mips64")))] - const NR_GETRANDOM: libc::c_long = 0; - - fn getrandom(buf: &mut [u8], blocking: bool) -> libc::c_long { - extern "C" { - fn syscall(number: libc::c_long, ...) -> libc::c_long; - } - const GRND_NONBLOCK: libc::c_uint = 0x0001; - - if NR_GETRANDOM == 0 { return -1 }; - - unsafe { - syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(), - if blocking { 0 } else { GRND_NONBLOCK }) - } - } - - fn getrandom_try_fill(dest: &mut [u8], blocking: bool) -> Result<(), Error> { - let mut read = 0; - while read < dest.len() { - let result = getrandom(&mut dest[read..], blocking); - if result == -1 { - let err = io::Error::last_os_error(); - let kind = err.kind(); - if kind == io::ErrorKind::Interrupted { - continue; - } else if kind == io::ErrorKind::WouldBlock { - return Err(Error::with_cause( - ErrorKind::NotReady, - "getrandom not ready", - err, - )); - } else { - return Err(Error::with_cause( - ErrorKind::Unavailable, - "unexpected getrandom error", - err, - )); - } - } else { - read += result as usize; - } - } - Ok(()) - } - - fn is_getrandom_available() -> bool { - static CHECKER: Once = ONCE_INIT; - static AVAILABLE: AtomicBool = ATOMIC_BOOL_INIT; - - if NR_GETRANDOM == 0 { return false }; - - CHECKER.call_once(|| { - debug!("OsRng: testing getrandom"); - let mut buf: [u8; 0] = []; - let result = getrandom(&mut buf, false); - let available = if result == -1 { - let err = io::Error::last_os_error().raw_os_error(); - err != Some(libc::ENOSYS) - } else { - true - }; - AVAILABLE.store(available, Ordering::Relaxed); - info!("OsRng: using {}", if available { "getrandom" } else { "/dev/urandom" }); - }); - - AVAILABLE.load(Ordering::Relaxed) - } -} - - -#[cfg(target_os = "netbsd")] -mod imp { - use Error; - use super::random_device; - use super::OsRngImpl; - - use std::fs::File; - use std::io::Read; - use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering}; - - #[derive(Clone, Debug)] - pub struct OsRng { initialized: bool } - - impl OsRngImpl for OsRng { - fn new() -> Result { - random_device::open("/dev/urandom", &|p| File::open(p))?; - Ok(OsRng { initialized: false }) - } - - fn fill_chunk(&mut self, dest: &mut [u8]) -> Result<(), Error> { - random_device::read(dest) - } - - // Read a single byte from `/dev/random` to determine if the OS RNG is - // already seeded. NetBSD always blocks if not yet ready. - fn test_initialized(&mut self, dest: &mut [u8], _blocking: bool) - -> Result - { - static OS_RNG_INITIALIZED: AtomicBool = ATOMIC_BOOL_INIT; - if !self.initialized { - self.initialized = OS_RNG_INITIALIZED.load(Ordering::Relaxed); - } - if self.initialized { return Ok(0); } - - info!("OsRng: testing random device /dev/random"); - let mut file = - File::open("/dev/random").map_err(random_device::map_err)?; - file.read(&mut dest[..1]).map_err(random_device::map_err)?; - - OS_RNG_INITIALIZED.store(true, Ordering::Relaxed); - self.initialized = true; - Ok(1) - } - - fn method_str(&self) -> &'static str { "/dev/urandom" } - } -} - - -#[cfg(any(target_os = "dragonfly", - target_os = "haiku", - target_os = "emscripten"))] -mod imp { - use Error; - use super::random_device; - use super::OsRngImpl; - use std::fs::File; - - #[derive(Clone, Debug)] - pub struct OsRng(); - - impl OsRngImpl for OsRng { - fn new() -> Result { - random_device::open("/dev/random", &|p| File::open(p))?; - Ok(OsRng()) - } - - fn fill_chunk(&mut self, dest: &mut [u8]) -> Result<(), Error> { - random_device::read(dest) - } - - #[cfg(target_os = "emscripten")] - fn max_chunk_size(&self) -> usize { - // `Crypto.getRandomValues` documents `dest` should be at most 65536 - // bytes. `crypto.randomBytes` documents: "To minimize threadpool - // task length variation, partition large randomBytes requests when - // doing so as part of fulfilling a client request. - 65536 - } - - fn method_str(&self) -> &'static str { "/dev/random" } - } -} - - -// Read from `/dev/random`, with chunks of limited size (1040 bytes). -// `/dev/random` uses the Hash_DRBG with SHA512 algorithm from NIST SP 800-90A. -// `/dev/urandom` uses the FIPS 186-2 algorithm, which is considered less -// secure. We choose to read from `/dev/random`. -// -// Since Solaris 11.3 the `getrandom` syscall is available. To make sure we can -// compile on both Solaris and on OpenSolaris derivatives, that do not have the -// function, we do a direct syscall instead of calling a library function. -// -// We have no way to differentiate between Solaris, illumos, SmartOS, etc. -#[cfg(target_os = "solaris")] -mod imp { - extern crate libc; - - use {Error, ErrorKind}; - use super::random_device; - use super::OsRngImpl; - - use std::io; - use std::io::Read; - use std::fs::{File, OpenOptions}; - use std::os::unix::fs::OpenOptionsExt; - use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering}; - - #[derive(Clone, Debug)] - pub struct OsRng { - method: OsRngMethod, - initialized: bool, - } - - #[derive(Clone, Debug)] - enum OsRngMethod { - GetRandom, - RandomDevice, - } - - impl OsRngImpl for OsRng { - fn new() -> Result { - if is_getrandom_available() { - return Ok(OsRng { method: OsRngMethod::GetRandom, - initialized: false }); - } - let open = |p| OpenOptions::new() - .read(true) - .custom_flags(libc::O_NONBLOCK) - .open(p); - random_device::open("/dev/random", &open)?; - Ok(OsRng { method: OsRngMethod::RandomDevice, initialized: false }) - } - - fn fill_chunk(&mut self, dest: &mut [u8]) -> Result<(), Error> { - match self.method { - OsRngMethod::GetRandom => getrandom_try_fill(dest, false), - OsRngMethod::RandomDevice => random_device::read(dest), - } - } - - fn test_initialized(&mut self, dest: &mut [u8], blocking: bool) - -> Result - { - static OS_RNG_INITIALIZED: AtomicBool = ATOMIC_BOOL_INIT; - if !self.initialized { - self.initialized = OS_RNG_INITIALIZED.load(Ordering::Relaxed); - } - if self.initialized { return Ok(0); } - - let chunk_len = ::core::cmp::min(1024, dest.len()); - let dest = &mut dest[..chunk_len]; - - match self.method { - OsRngMethod::GetRandom => getrandom_try_fill(dest, blocking)?, - OsRngMethod::RandomDevice => { - if blocking { - info!("OsRng: testing random device /dev/random"); - // We already have a non-blocking handle, but now need a - // blocking one. Not much choice except opening it twice - let mut file = File::open("/dev/random") - .map_err(random_device::map_err)?; - file.read(dest).map_err(random_device::map_err)?; - } else { - self.fill_chunk(dest)?; - } - } - }; - OS_RNG_INITIALIZED.store(true, Ordering::Relaxed); - self.initialized = true; - Ok(chunk_len) - } - - fn max_chunk_size(&self) -> usize { - // The documentation says 1024 is the maximum for getrandom, but - // 1040 for /dev/random. - 1024 - } - - fn method_str(&self) -> &'static str { - match self.method { - OsRngMethod::GetRandom => "getrandom", - OsRngMethod::RandomDevice => "/dev/random", - } - } - } - - fn getrandom(buf: &mut [u8], blocking: bool) -> libc::c_long { - extern "C" { - fn syscall(number: libc::c_long, ...) -> libc::c_long; - } - - const SYS_GETRANDOM: libc::c_long = 143; - const GRND_NONBLOCK: libc::c_uint = 0x0001; - const GRND_RANDOM: libc::c_uint = 0x0002; - - unsafe { - syscall(SYS_GETRANDOM, buf.as_mut_ptr(), buf.len(), - if blocking { 0 } else { GRND_NONBLOCK } | GRND_RANDOM) - } - } - - fn getrandom_try_fill(dest: &mut [u8], blocking: bool) -> Result<(), Error> { - let result = getrandom(dest, blocking); - if result == -1 || result == 0 { - let err = io::Error::last_os_error(); - let kind = err.kind(); - if kind == io::ErrorKind::WouldBlock { - return Err(Error::with_cause( - ErrorKind::NotReady, - "getrandom not ready", - err, - )); - } else { - return Err(Error::with_cause( - ErrorKind::Unavailable, - "unexpected getrandom error", - err, - )); - } - } else if result != dest.len() as i64 { - return Err(Error::new(ErrorKind::Unavailable, - "unexpected getrandom error")); - } - Ok(()) - } - - fn is_getrandom_available() -> bool { - use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering}; - use std::sync::{Once, ONCE_INIT}; - - static CHECKER: Once = ONCE_INIT; - static AVAILABLE: AtomicBool = ATOMIC_BOOL_INIT; - - CHECKER.call_once(|| { - debug!("OsRng: testing getrandom"); - let mut buf: [u8; 0] = []; - let result = getrandom(&mut buf, false); - let available = if result == -1 { - let err = io::Error::last_os_error().raw_os_error(); - err != Some(libc::ENOSYS) - } else { - true - }; - AVAILABLE.store(available, Ordering::Relaxed); - info!("OsRng: using {}", if available { "getrandom" } else { "/dev/random" }); - }); - - AVAILABLE.load(Ordering::Relaxed) - } -} - - -#[cfg(target_os = "cloudabi")] -mod imp { - extern crate cloudabi; - - use std::io; - use {Error, ErrorKind}; - use super::OsRngImpl; - - #[derive(Clone, Debug)] - pub struct OsRng; - - impl OsRngImpl for OsRng { - fn new() -> Result { Ok(OsRng) } - - fn fill_chunk(&mut self, dest: &mut [u8]) -> Result<(), Error> { - let errno = unsafe { cloudabi::random_get(dest) }; - if errno == cloudabi::errno::SUCCESS { - Ok(()) - } else { - // Cloudlibc provides its own `strerror` implementation so we - // can use `from_raw_os_error` here. - Err(Error::with_cause( - ErrorKind::Unavailable, - "random_get() system call failed", - io::Error::from_raw_os_error(errno as i32), - )) - } - } - - fn method_str(&self) -> &'static str { "cloudabi::random_get" } - } -} - - -#[cfg(any(target_os = "macos", target_os = "ios"))] -mod imp { - extern crate libc; - - use {Error, ErrorKind}; - use super::OsRngImpl; - - use std::io; - use self::libc::{c_int, size_t}; - - #[derive(Clone, Debug)] - pub struct OsRng; - - enum SecRandom {} - - #[allow(non_upper_case_globals)] - const kSecRandomDefault: *const SecRandom = 0 as *const SecRandom; - - #[link(name = "Security", kind = "framework")] - extern { - fn SecRandomCopyBytes(rnd: *const SecRandom, - count: size_t, bytes: *mut u8) -> c_int; - } - - impl OsRngImpl for OsRng { - fn new() -> Result { Ok(OsRng) } - - fn fill_chunk(&mut self, dest: &mut [u8]) -> Result<(), Error> { - let ret = unsafe { - SecRandomCopyBytes(kSecRandomDefault, - dest.len() as size_t, - dest.as_mut_ptr()) - }; - if ret == -1 { - Err(Error::with_cause( - ErrorKind::Unavailable, - "couldn't generate random bytes", - io::Error::last_os_error())) - } else { - Ok(()) - } - } - - fn method_str(&self) -> &'static str { "SecRandomCopyBytes" } - } -} - - -#[cfg(target_os = "freebsd")] -mod imp { - extern crate libc; - - use {Error, ErrorKind}; - use super::OsRngImpl; - - use std::ptr; - use std::io; - - #[derive(Clone, Debug)] - pub struct OsRng; - - impl OsRngImpl for OsRng { - fn new() -> Result { Ok(OsRng) } - - fn fill_chunk(&mut self, dest: &mut [u8]) -> Result<(), Error> { - let mib = [libc::CTL_KERN, libc::KERN_ARND]; - let mut len = dest.len(); - let ret = unsafe { - libc::sysctl(mib.as_ptr(), mib.len() as libc::c_uint, - dest.as_mut_ptr() as *mut _, &mut len, - ptr::null(), 0) - }; - if ret == -1 || len != dest.len() { - return Err(Error::with_cause( - ErrorKind::Unavailable, - "kern.arandom sysctl failed", - io::Error::last_os_error())); - } - Ok(()) - } - - fn max_chunk_size(&self) -> usize { 256 } - - fn method_str(&self) -> &'static str { "kern.arandom" } - } -} - - -#[cfg(any(target_os = "openbsd", target_os = "bitrig"))] -mod imp { - extern crate libc; - - use {Error, ErrorKind}; - use super::OsRngImpl; - - use std::io; - - #[derive(Clone, Debug)] - pub struct OsRng; - - impl OsRngImpl for OsRng { - fn new() -> Result { Ok(OsRng) } - - fn fill_chunk(&mut self, dest: &mut [u8]) -> Result<(), Error> { - let ret = unsafe { - libc::getentropy(dest.as_mut_ptr() as *mut libc::c_void, dest.len()) - }; - if ret == -1 { - return Err(Error::with_cause( - ErrorKind::Unavailable, - "getentropy failed", - io::Error::last_os_error())); - } - Ok(()) - } - - fn max_chunk_size(&self) -> usize { 256 } - - fn method_str(&self) -> &'static str { "getentropy" } - } -} - - -#[cfg(target_os = "redox")] -mod imp { - use Error; - use super::random_device; - use super::OsRngImpl; - use std::fs::File; - - #[derive(Clone, Debug)] - pub struct OsRng(); - - impl OsRngImpl for OsRng { - fn new() -> Result { - random_device::open("rand:", &|p| File::open(p))?; - Ok(OsRng()) - } - - fn fill_chunk(&mut self, dest: &mut [u8]) -> Result<(), Error> { - random_device::read(dest) - } - - fn method_str(&self) -> &'static str { "'rand:'" } - } -} - - -#[cfg(target_os = "fuchsia")] -mod imp { - extern crate fuchsia_cprng; - - use Error; - use super::OsRngImpl; - - #[derive(Clone, Debug)] - pub struct OsRng; - - impl OsRngImpl for OsRng { - fn new() -> Result { Ok(OsRng) } - - fn fill_chunk(&mut self, dest: &mut [u8]) -> Result<(), Error> { - fuchsia_cprng::cprng_draw(dest); - Ok(()) - } - - fn method_str(&self) -> &'static str { "cprng_draw" } - } -} - - -#[cfg(windows)] -mod imp { - extern crate winapi; - - use {Error, ErrorKind}; - use super::OsRngImpl; - - use std::io; - - use self::winapi::shared::minwindef::ULONG; - use self::winapi::um::ntsecapi::RtlGenRandom; - use self::winapi::um::winnt::PVOID; - - #[derive(Clone, Debug)] - pub struct OsRng; - - impl OsRngImpl for OsRng { - fn new() -> Result { Ok(OsRng) } - - fn fill_chunk(&mut self, dest: &mut [u8]) -> Result<(), Error> { - let ret = unsafe { - RtlGenRandom(dest.as_mut_ptr() as PVOID, dest.len() as ULONG) - }; - if ret == 0 { - return Err(Error::with_cause( - ErrorKind::Unavailable, - "couldn't generate random bytes", - io::Error::last_os_error())); - } - Ok(()) - } - - fn max_chunk_size(&self) -> usize { ::max_value() as usize } - - fn method_str(&self) -> &'static str { "RtlGenRandom" } - } -} - - -#[cfg(all(target_arch = "wasm32", - not(target_os = "emscripten"), - feature = "stdweb"))] -mod imp { - use std::mem; - use stdweb::unstable::TryInto; - use stdweb::web::error::Error as WebError; - use {Error, ErrorKind}; - use super::OsRngImpl; - - #[derive(Clone, Debug)] - enum OsRngMethod { - Browser, - Node - } - - #[derive(Clone, Debug)] - pub struct OsRng(OsRngMethod); - - impl OsRngImpl for OsRng { - fn new() -> Result { - let result = js! { - try { - if ( - typeof self === "object" && - typeof self.crypto === "object" && - typeof self.crypto.getRandomValues === "function" - ) { - return { success: true, ty: 1 }; - } - - if (typeof require("crypto").randomBytes === "function") { - return { success: true, ty: 2 }; - } - - return { success: false, error: new Error("not supported") }; - } catch(err) { - return { success: false, error: err }; - } - }; - - if js!{ return @{ result.as_ref() }.success } == true { - let ty = js!{ return @{ result }.ty }; - - if ty == 1 { Ok(OsRng(OsRngMethod::Browser)) } - else if ty == 2 { Ok(OsRng(OsRngMethod::Node)) } - else { unreachable!() } - } else { - let err: WebError = js!{ return @{ result }.error }.try_into().unwrap(); - Err(Error::with_cause(ErrorKind::Unavailable, "WASM Error", err)) - } - } - - - fn fill_chunk(&mut self, dest: &mut [u8]) -> Result<(), Error> { - assert_eq!(mem::size_of::(), 4); - - let len = dest.len() as u32; - let ptr = dest.as_mut_ptr() as i32; - - let result = match self.0 { - OsRngMethod::Browser => js! { - try { - let array = new Uint8Array(@{ len }); - self.crypto.getRandomValues(array); - HEAPU8.set(array, @{ ptr }); - - return { success: true }; - } catch(err) { - return { success: false, error: err }; - } - }, - OsRngMethod::Node => js! { - try { - let bytes = require("crypto").randomBytes(@{ len }); - HEAPU8.set(new Uint8Array(bytes), @{ ptr }); - - return { success: true }; - } catch(err) { - return { success: false, error: err }; - } - } - }; - - if js!{ return @{ result.as_ref() }.success } == true { - Ok(()) - } else { - let err: WebError = js!{ return @{ result }.error }.try_into().unwrap(); - Err(Error::with_cause(ErrorKind::Unexpected, "WASM Error", err)) - } - } - - fn max_chunk_size(&self) -> usize { 65536 } - - fn method_str(&self) -> &'static str { - match self.0 { - OsRngMethod::Browser => "Crypto.getRandomValues", - OsRngMethod::Node => "crypto.randomBytes", - } - } - } -} - - -#[cfg(test)] -mod test { - use RngCore; - use OsRng; - - #[test] - fn test_os_rng() { - let mut r = OsRng::new().unwrap(); - - r.next_u32(); - r.next_u64(); - - let mut v1 = [0u8; 1000]; - r.fill_bytes(&mut v1); - - let mut v2 = [0u8; 1000]; - r.fill_bytes(&mut v2); - - let mut n_diff_bits = 0; - for i in 0..v1.len() { - n_diff_bits += (v1[i] ^ v2[i]).count_ones(); - } - - // Check at least 1 bit per byte differs. p(failure) < 1e-1000 with random input. - assert!(n_diff_bits >= v1.len() as u32); - } - - #[test] - fn test_os_rng_empty() { - let mut r = OsRng::new().unwrap(); - - let mut empty = [0u8; 0]; - r.fill_bytes(&mut empty); - } - - #[test] - fn test_os_rng_huge() { - let mut r = OsRng::new().unwrap(); - - let mut huge = [0u8; 100_000]; - r.fill_bytes(&mut huge); - } - - #[cfg(not(any(target_arch = "wasm32", target_arch = "asmjs")))] - #[test] - fn test_os_rng_tasks() { - use std::sync::mpsc::channel; - use std::thread; - - let mut txs = vec!(); - for _ in 0..20 { - let (tx, rx) = channel(); - txs.push(tx); - - thread::spawn(move|| { - // wait until all the tasks are ready to go. - rx.recv().unwrap(); - - // deschedule to attempt to interleave things as much - // as possible (XXX: is this a good test?) - let mut r = OsRng::new().unwrap(); - thread::yield_now(); - let mut v = [0u8; 1000]; - - for _ in 0..100 { - r.next_u32(); - thread::yield_now(); - r.next_u64(); - thread::yield_now(); - r.fill_bytes(&mut v); - thread::yield_now(); - } - }); - } - - // start all the tasks - for tx in txs.iter() { - tx.send(()).unwrap(); - } - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/rngs/small.rs cargo-0.37.0/vendor/rand-0.5.6/src/rngs/small.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/rngs/small.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/rngs/small.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,101 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! A small fast RNG - -use {RngCore, SeedableRng, Error}; -use prng::XorShiftRng; - -/// An RNG recommended when small state, cheap initialization and good -/// performance are required. The PRNG algorithm in `SmallRng` is chosen to be -/// efficient on the current platform, **without consideration for cryptography -/// or security**. The size of its state is much smaller than for [`StdRng`]. -/// -/// Reproducibility of output from this generator is however not required, thus -/// future library versions may use a different internal generator with -/// different output. Further, this generator may not be portable and can -/// produce different output depending on the architecture. If you require -/// reproducible output, use a named RNG, for example [`XorShiftRng`]. -/// -/// The current algorithm used on all platforms is [Xorshift]. -/// -/// # Examples -/// -/// Initializing `SmallRng` with a random seed can be done using [`FromEntropy`]: -/// -/// ``` -/// # use rand::Rng; -/// use rand::FromEntropy; -/// use rand::rngs::SmallRng; -/// -/// // Create small, cheap to initialize and fast RNG with a random seed. -/// // The randomness is supplied by the operating system. -/// let mut small_rng = SmallRng::from_entropy(); -/// # let v: u32 = small_rng.gen(); -/// ``` -/// -/// When initializing a lot of `SmallRng`'s, using [`thread_rng`] can be more -/// efficient: -/// -/// ``` -/// use std::iter; -/// use rand::{SeedableRng, thread_rng}; -/// use rand::rngs::SmallRng; -/// -/// // Create a big, expensive to initialize and slower, but unpredictable RNG. -/// // This is cached and done only once per thread. -/// let mut thread_rng = thread_rng(); -/// // Create small, cheap to initialize and fast RNGs with random seeds. -/// // One can generally assume this won't fail. -/// let rngs: Vec = iter::repeat(()) -/// .map(|()| SmallRng::from_rng(&mut thread_rng).unwrap()) -/// .take(10) -/// .collect(); -/// ``` -/// -/// [`FromEntropy`]: ../trait.FromEntropy.html -/// [`StdRng`]: struct.StdRng.html -/// [`thread_rng`]: ../fn.thread_rng.html -/// [Xorshift]: ../prng/struct.XorShiftRng.html -/// [`XorShiftRng`]: ../prng/struct.XorShiftRng.html -#[derive(Clone, Debug)] -pub struct SmallRng(XorShiftRng); - -impl RngCore for SmallRng { - #[inline(always)] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest); - } - - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -impl SeedableRng for SmallRng { - type Seed = ::Seed; - - fn from_seed(seed: Self::Seed) -> Self { - SmallRng(XorShiftRng::from_seed(seed)) - } - - fn from_rng(rng: R) -> Result { - XorShiftRng::from_rng(rng).map(SmallRng) - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/rngs/std.rs cargo-0.37.0/vendor/rand-0.5.6/src/rngs/std.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/rngs/std.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/rngs/std.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,83 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The standard RNG - -use {RngCore, CryptoRng, Error, SeedableRng}; -use prng::Hc128Rng; - -/// The standard RNG. The PRNG algorithm in `StdRng` is chosen to be efficient -/// on the current platform, to be statistically strong and unpredictable -/// (meaning a cryptographically secure PRNG). -/// -/// The current algorithm used on all platforms is [HC-128]. -/// -/// Reproducibility of output from this generator is however not required, thus -/// future library versions may use a different internal generator with -/// different output. Further, this generator may not be portable and can -/// produce different output depending on the architecture. If you require -/// reproducible output, use a named RNG, for example [`ChaChaRng`]. -/// -/// [HC-128]: ../prng/hc128/struct.Hc128Rng.html -/// [`ChaChaRng`]: ../prng/chacha/struct.ChaChaRng.html -#[derive(Clone, Debug)] -pub struct StdRng(Hc128Rng); - -impl RngCore for StdRng { - #[inline(always)] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest); - } - - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) - } -} - -impl SeedableRng for StdRng { - type Seed = ::Seed; - - fn from_seed(seed: Self::Seed) -> Self { - StdRng(Hc128Rng::from_seed(seed)) - } - - fn from_rng(rng: R) -> Result { - Hc128Rng::from_rng(rng).map(StdRng) - } -} - -impl CryptoRng for StdRng {} - - -#[cfg(test)] -mod test { - use {RngCore, SeedableRng}; - use rngs::StdRng; - - #[test] - fn test_stdrng_construction() { - let seed = [1,0,0,0, 23,0,0,0, 200,1,0,0, 210,30,0,0, - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; - let mut rng1 = StdRng::from_seed(seed); - assert_eq!(rng1.next_u64(), 15759097995037006553); - - let mut rng2 = StdRng::from_rng(rng1).unwrap(); - assert_eq!(rng2.next_u64(), 6766915756997287454); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/rngs/thread.rs cargo-0.37.0/vendor/rand-0.5.6/src/rngs/thread.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/rngs/thread.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/rngs/thread.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,141 +0,0 @@ -// Copyright 2017-2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Thread-local random number generator - -use std::cell::UnsafeCell; -use std::rc::Rc; - -use {RngCore, CryptoRng, SeedableRng, Error}; -use rngs::adapter::ReseedingRng; -use rngs::EntropyRng; -use prng::hc128::Hc128Core; - -// Rationale for using `UnsafeCell` in `ThreadRng`: -// -// Previously we used a `RefCell`, with an overhead of ~15%. There will only -// ever be one mutable reference to the interior of the `UnsafeCell`, because -// we only have such a reference inside `next_u32`, `next_u64`, etc. Within a -// single thread (which is the definition of `ThreadRng`), there will only ever -// be one of these methods active at a time. -// -// A possible scenario where there could be multiple mutable references is if -// `ThreadRng` is used inside `next_u32` and co. But the implementation is -// completely under our control. We just have to ensure none of them use -// `ThreadRng` internally, which is nonsensical anyway. We should also never run -// `ThreadRng` in destructors of its implementation, which is also nonsensical. -// -// The additional `Rc` is not strictly neccesary, and could be removed. For now -// it ensures `ThreadRng` stays `!Send` and `!Sync`, and implements `Clone`. - - -// Number of generated bytes after which to reseed `TreadRng`. -// -// The time it takes to reseed HC-128 is roughly equivalent to generating 7 KiB. -// We pick a treshold here that is large enough to not reduce the average -// performance too much, but also small enough to not make reseeding something -// that basically never happens. -const THREAD_RNG_RESEED_THRESHOLD: u64 = 32*1024*1024; // 32 MiB - -/// The type returned by [`thread_rng`], essentially just a reference to the -/// PRNG in thread-local memory. -/// -/// `ThreadRng` uses [`ReseedingRng`] wrapping the same PRNG as [`StdRng`], -/// which is reseeded after generating 32 MiB of random data. A single instance -/// is cached per thread and the returned `ThreadRng` is a reference to this -/// instance — hence `ThreadRng` is neither `Send` nor `Sync` but is safe to use -/// within a single thread. This RNG is seeded and reseeded via [`EntropyRng`] -/// as required. -/// -/// Note that the reseeding is done as an extra precaution against entropy -/// leaks and is in theory unnecessary — to predict `ThreadRng`'s output, an -/// attacker would have to either determine most of the RNG's seed or internal -/// state, or crack the algorithm used. -/// -/// Like [`StdRng`], `ThreadRng` is a cryptographically secure PRNG. The current -/// algorithm used is [HC-128], which is an array-based PRNG that trades memory -/// usage for better performance. This makes it similar to ISAAC, the algorithm -/// used in `ThreadRng` before rand 0.5. -/// -/// Cloning this handle just produces a new reference to the same thread-local -/// generator. -/// -/// [`thread_rng`]: ../fn.thread_rng.html -/// [`ReseedingRng`]: adapter/struct.ReseedingRng.html -/// [`StdRng`]: struct.StdRng.html -/// [`EntropyRng`]: struct.EntropyRng.html -/// [HC-128]: ../prng/hc128/struct.Hc128Rng.html -#[derive(Clone, Debug)] -pub struct ThreadRng { - rng: Rc>>, -} - -thread_local!( - static THREAD_RNG_KEY: Rc>> = { - let mut entropy_source = EntropyRng::new(); - let r = Hc128Core::from_rng(&mut entropy_source).unwrap_or_else(|err| - panic!("could not initialize thread_rng: {}", err)); - let rng = ReseedingRng::new(r, - THREAD_RNG_RESEED_THRESHOLD, - entropy_source); - Rc::new(UnsafeCell::new(rng)) - } -); - -/// Retrieve the lazily-initialized thread-local random number -/// generator, seeded by the system. Intended to be used in method -/// chaining style, e.g. `thread_rng().gen::()`, or cached locally, e.g. -/// `let mut rng = thread_rng();`. -/// -/// For more information see [`ThreadRng`]. -/// -/// [`ThreadRng`]: rngs/struct.ThreadRng.html -pub fn thread_rng() -> ThreadRng { - ThreadRng { rng: THREAD_RNG_KEY.with(|t| t.clone()) } -} - -impl RngCore for ThreadRng { - #[inline(always)] - fn next_u32(&mut self) -> u32 { - unsafe { (*self.rng.get()).next_u32() } - } - - #[inline(always)] - fn next_u64(&mut self) -> u64 { - unsafe { (*self.rng.get()).next_u64() } - } - - fn fill_bytes(&mut self, dest: &mut [u8]) { - unsafe { (*self.rng.get()).fill_bytes(dest) } - } - - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - unsafe { (*self.rng.get()).try_fill_bytes(dest) } - } -} - -impl CryptoRng for ThreadRng {} - - -#[cfg(test)] -mod test { - #[test] - #[cfg(not(feature="stdweb"))] - fn test_thread_rng() { - use Rng; - let mut r = ::thread_rng(); - r.gen::(); - let mut v = [1, 1, 1]; - r.shuffle(&mut v); - let b: &[_] = &[1, 1, 1]; - assert_eq!(v, b); - assert_eq!(r.gen_range(0, 1), 0); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/src/seq.rs cargo-0.37.0/vendor/rand-0.5.6/src/seq.rs --- cargo-0.35.0/vendor/rand-0.5.6/src/seq.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/src/seq.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,334 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Functions for randomly accessing and sampling sequences. - -use super::Rng; - -// This crate is only enabled when either std or alloc is available. -#[cfg(all(feature="alloc", not(feature="std")))] use alloc::vec::Vec; -// BTreeMap is not as fast in tests, but better than nothing. -#[cfg(feature="std")] use std::collections::HashMap; -#[cfg(all(feature="alloc", not(feature="std")))] use alloc::collections::BTreeMap; - -/// Randomly sample `amount` elements from a finite iterator. -/// -/// The following can be returned: -/// -/// - `Ok`: `Vec` of `amount` non-repeating randomly sampled elements. The order is not random. -/// - `Err`: `Vec` of all the elements from `iterable` in sequential order. This happens when the -/// length of `iterable` was less than `amount`. This is considered an error since exactly -/// `amount` elements is typically expected. -/// -/// This implementation uses `O(len(iterable))` time and `O(amount)` memory. -/// -/// # Example -/// -/// ``` -/// use rand::{thread_rng, seq}; -/// -/// let mut rng = thread_rng(); -/// let sample = seq::sample_iter(&mut rng, 1..100, 5).unwrap(); -/// println!("{:?}", sample); -/// ``` -pub fn sample_iter(rng: &mut R, iterable: I, amount: usize) -> Result, Vec> - where I: IntoIterator, - R: Rng + ?Sized, -{ - let mut iter = iterable.into_iter(); - let mut reservoir = Vec::with_capacity(amount); - reservoir.extend(iter.by_ref().take(amount)); - - // Continue unless the iterator was exhausted - // - // note: this prevents iterators that "restart" from causing problems. - // If the iterator stops once, then so do we. - if reservoir.len() == amount { - for (i, elem) in iter.enumerate() { - let k = rng.gen_range(0, i + 1 + amount); - if let Some(spot) = reservoir.get_mut(k) { - *spot = elem; - } - } - Ok(reservoir) - } else { - // Don't hang onto extra memory. There is a corner case where - // `amount` was much less than `len(iterable)`. - reservoir.shrink_to_fit(); - Err(reservoir) - } -} - -/// Randomly sample exactly `amount` values from `slice`. -/// -/// The values are non-repeating and in random order. -/// -/// This implementation uses `O(amount)` time and memory. -/// -/// Panics if `amount > slice.len()` -/// -/// # Example -/// -/// ``` -/// use rand::{thread_rng, seq}; -/// -/// let mut rng = thread_rng(); -/// let values = vec![5, 6, 1, 3, 4, 6, 7]; -/// println!("{:?}", seq::sample_slice(&mut rng, &values, 3)); -/// ``` -pub fn sample_slice(rng: &mut R, slice: &[T], amount: usize) -> Vec - where R: Rng + ?Sized, - T: Clone -{ - let indices = sample_indices(rng, slice.len(), amount); - - let mut out = Vec::with_capacity(amount); - out.extend(indices.iter().map(|i| slice[*i].clone())); - out -} - -/// Randomly sample exactly `amount` references from `slice`. -/// -/// The references are non-repeating and in random order. -/// -/// This implementation uses `O(amount)` time and memory. -/// -/// Panics if `amount > slice.len()` -/// -/// # Example -/// -/// ``` -/// use rand::{thread_rng, seq}; -/// -/// let mut rng = thread_rng(); -/// let values = vec![5, 6, 1, 3, 4, 6, 7]; -/// println!("{:?}", seq::sample_slice_ref(&mut rng, &values, 3)); -/// ``` -pub fn sample_slice_ref<'a, R, T>(rng: &mut R, slice: &'a [T], amount: usize) -> Vec<&'a T> - where R: Rng + ?Sized -{ - let indices = sample_indices(rng, slice.len(), amount); - - let mut out = Vec::with_capacity(amount); - out.extend(indices.iter().map(|i| &slice[*i])); - out -} - -/// Randomly sample exactly `amount` indices from `0..length`. -/// -/// The values are non-repeating and in random order. -/// -/// This implementation uses `O(amount)` time and memory. -/// -/// This method is used internally by the slice sampling methods, but it can sometimes be useful to -/// have the indices themselves so this is provided as an alternative. -/// -/// Panics if `amount > length` -pub fn sample_indices(rng: &mut R, length: usize, amount: usize) -> Vec - where R: Rng + ?Sized, -{ - if amount > length { - panic!("`amount` must be less than or equal to `slice.len()`"); - } - - // We are going to have to allocate at least `amount` for the output no matter what. However, - // if we use the `cached` version we will have to allocate `amount` as a HashMap as well since - // it inserts an element for every loop. - // - // Therefore, if `amount >= length / 2` then inplace will be both faster and use less memory. - // In fact, benchmarks show the inplace version is faster for length up to about 20 times - // faster than amount. - // - // TODO: there is probably even more fine-tuning that can be done here since - // `HashMap::with_capacity(amount)` probably allocates more than `amount` in practice, - // and a trade off could probably be made between memory/cpu, since hashmap operations - // are slower than array index swapping. - if amount >= length / 20 { - sample_indices_inplace(rng, length, amount) - } else { - sample_indices_cache(rng, length, amount) - } -} - -/// Sample an amount of indices using an inplace partial fisher yates method. -/// -/// This allocates the entire `length` of indices and randomizes only the first `amount`. -/// It then truncates to `amount` and returns. -/// -/// This is better than using a `HashMap` "cache" when `amount >= length / 2` -/// since it does not require allocating an extra cache and is much faster. -fn sample_indices_inplace(rng: &mut R, length: usize, amount: usize) -> Vec - where R: Rng + ?Sized, -{ - debug_assert!(amount <= length); - let mut indices: Vec = Vec::with_capacity(length); - indices.extend(0..length); - for i in 0..amount { - let j: usize = rng.gen_range(i, length); - indices.swap(i, j); - } - indices.truncate(amount); - debug_assert_eq!(indices.len(), amount); - indices -} - - -/// This method performs a partial fisher-yates on a range of indices using a -/// `HashMap` as a cache to record potential collisions. -/// -/// The cache avoids allocating the entire `length` of values. This is especially useful when -/// `amount <<< length`, i.e. select 3 non-repeating from `1_000_000` -fn sample_indices_cache( - rng: &mut R, - length: usize, - amount: usize, -) -> Vec - where R: Rng + ?Sized, -{ - debug_assert!(amount <= length); - #[cfg(feature="std")] let mut cache = HashMap::with_capacity(amount); - #[cfg(not(feature="std"))] let mut cache = BTreeMap::new(); - let mut out = Vec::with_capacity(amount); - for i in 0..amount { - let j: usize = rng.gen_range(i, length); - - // equiv: let tmp = slice[i]; - let tmp = match cache.get(&i) { - Some(e) => *e, - None => i, - }; - - // equiv: slice[i] = slice[j]; - let x = match cache.get(&j) { - Some(x) => *x, - None => j, - }; - - // equiv: slice[j] = tmp; - cache.insert(j, tmp); - - // note that in the inplace version, slice[i] is automatically "returned" value - out.push(x); - } - debug_assert_eq!(out.len(), amount); - out -} - -#[cfg(test)] -mod test { - use super::*; - use {XorShiftRng, Rng, SeedableRng}; - #[cfg(not(feature="std"))] - use alloc::vec::Vec; - - #[test] - fn test_sample_iter() { - let min_val = 1; - let max_val = 100; - - let mut r = ::test::rng(401); - let vals = (min_val..max_val).collect::>(); - let small_sample = sample_iter(&mut r, vals.iter(), 5).unwrap(); - let large_sample = sample_iter(&mut r, vals.iter(), vals.len() + 5).unwrap_err(); - - assert_eq!(small_sample.len(), 5); - assert_eq!(large_sample.len(), vals.len()); - // no randomization happens when amount >= len - assert_eq!(large_sample, vals.iter().collect::>()); - - assert!(small_sample.iter().all(|e| { - **e >= min_val && **e <= max_val - })); - } - #[test] - fn test_sample_slice_boundaries() { - let empty: &[u8] = &[]; - - let mut r = ::test::rng(402); - - // sample 0 items - assert_eq!(&sample_slice(&mut r, empty, 0)[..], [0u8; 0]); - assert_eq!(&sample_slice(&mut r, &[42, 2, 42], 0)[..], [0u8; 0]); - - // sample 1 item - assert_eq!(&sample_slice(&mut r, &[42], 1)[..], [42]); - let v = sample_slice(&mut r, &[1, 42], 1)[0]; - assert!(v == 1 || v == 42); - - // sample "all" the items - let v = sample_slice(&mut r, &[42, 133], 2); - assert!(&v[..] == [42, 133] || v[..] == [133, 42]); - - assert_eq!(&sample_indices_inplace(&mut r, 0, 0)[..], [0usize; 0]); - assert_eq!(&sample_indices_inplace(&mut r, 1, 0)[..], [0usize; 0]); - assert_eq!(&sample_indices_inplace(&mut r, 1, 1)[..], [0]); - - assert_eq!(&sample_indices_cache(&mut r, 0, 0)[..], [0usize; 0]); - assert_eq!(&sample_indices_cache(&mut r, 1, 0)[..], [0usize; 0]); - assert_eq!(&sample_indices_cache(&mut r, 1, 1)[..], [0]); - - // Make sure lucky 777's aren't lucky - let slice = &[42, 777]; - let mut num_42 = 0; - let total = 1000; - for _ in 0..total { - let v = sample_slice(&mut r, slice, 1); - assert_eq!(v.len(), 1); - let v = v[0]; - assert!(v == 42 || v == 777); - if v == 42 { - num_42 += 1; - } - } - let ratio_42 = num_42 as f64 / 1000 as f64; - assert!(0.4 <= ratio_42 || ratio_42 <= 0.6, "{}", ratio_42); - } - - #[test] - fn test_sample_slice() { - let xor_rng = XorShiftRng::from_seed; - - let max_range = 100; - let mut r = ::test::rng(403); - - for length in 1usize..max_range { - let amount = r.gen_range(0, length); - let mut seed = [0u8; 16]; - r.fill(&mut seed); - - // assert that the two index methods give exactly the same result - let inplace = sample_indices_inplace( - &mut xor_rng(seed), length, amount); - let cache = sample_indices_cache( - &mut xor_rng(seed), length, amount); - assert_eq!(inplace, cache); - - // assert the basics work - let regular = sample_indices( - &mut xor_rng(seed), length, amount); - assert_eq!(regular.len(), amount); - assert!(regular.iter().all(|e| *e < length)); - assert_eq!(regular, inplace); - - // also test that sampling the slice works - let vec: Vec = (0..length).collect(); - { - let result = sample_slice(&mut xor_rng(seed), &vec, amount); - assert_eq!(result, regular); - } - - { - let result = sample_slice_ref(&mut xor_rng(seed), &vec, amount); - let expected = regular.iter().map(|v| v).collect::>(); - assert_eq!(result, expected); - } - } - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/tests/bool.rs cargo-0.37.0/vendor/rand-0.5.6/tests/bool.rs --- cargo-0.35.0/vendor/rand-0.5.6/tests/bool.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/tests/bool.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -#![no_std] - -extern crate rand; - -use rand::SeedableRng; -use rand::rngs::SmallRng; -use rand::distributions::{Distribution, Bernoulli}; - -/// This test should make sure that we don't accidentally have undefined -/// behavior for large propabilties due to -/// https://github.com/rust-lang/rust/issues/10184. -/// Expressions like `1.0*(u64::MAX as f64) as u64` have to be avoided. -#[test] -fn large_probability() { - let p = 1. - ::core::f64::EPSILON / 2.; - assert!(p < 1.); - let d = Bernoulli::new(p); - let mut rng = SmallRng::from_seed( - [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); - for _ in 0..10 { - assert!(d.sample(&mut rng), "extremely unlikely to fail by accident"); - } -} diff -Nru cargo-0.35.0/vendor/rand-0.5.6/UPDATING.md cargo-0.37.0/vendor/rand-0.5.6/UPDATING.md --- cargo-0.35.0/vendor/rand-0.5.6/UPDATING.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/UPDATING.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,260 +0,0 @@ -# Update Guide - -This guide gives a few more details than the [changelog], in particular giving -guidance on how to use new features and migrate away from old ones. - -[changelog]: CHANGELOG.md - -## Rand 0.5 - -The 0.5 release has quite significant changes over the 0.4 release; as such, -it may be worth reading through the following coverage of breaking changes. -This release also contains many optimisations, which are not detailed below. - -### Crates - -We have a new crate: `rand_core`! This crate houses some important traits, -`RngCore`, `BlockRngCore`, `SeedableRng` and `CryptoRng`, the error types, as -well as two modules with helpers for implementations: `le` and `impls`. It is -recommended that implementations of generators use the `rand_core` crate while -other users use only the `rand` crate, which re-exports most parts of `rand_core`. - -The `rand_derive` crate has been deprecated due to very low usage and -deprecation of `Rand`. - -### Features - -Several new Cargo feature flags have been added: - -- `alloc`, used without `std`, allows use of `Box` and `Vec` -- `serde1` adds serialization support to some PRNGs -- `log` adds logging in a few places (primarily to `OsRng` and `JitterRng`) - -### `Rng` and friends (core traits) - -`Rng` trait has been split into two traits, a "back end" `RngCore` (implemented -by generators) and a "front end" `Rng` implementing all the convenient extension -methods. - -Implementations of generators must `impl RngCore` instead. Usage of `rand_core` -for implementations is encouraged; the `rand_core::{le, impls}` modules may -prove useful. - -Users of `Rng` *who don't need to implement it* won't need to make so many -changes; often users can forget about `RngCore` and only import `Rng`. Instead -of `RngCore::next_u32()` / `next_u64()` users should prefer `Rng::gen()`, and -instead of `RngCore::fill_bytes(dest)`, `Rng::fill(dest)` can be used. - -#### `Rng` / `RngCore` methods - -To allow error handling from fallible sources (e.g. `OsRng`), a new -`RngCore::try_fill_bytes` method has been added; for example `EntropyRng` uses -this mechanism to fall back to `JitterRng` if `OsRng` fails, and various -handlers produce better error messages. -As before, the other methods will panic on failure, but since these are usually -used with algorithmic generators which are usually infallible, this is -considered an appropriate compromise. - -A few methods from the old `Rng` have been removed or deprecated: - -- `next_f32` and `next_f64`; these are no longer implementable by generators; - use `gen` instead -- `gen_iter`; users may instead use standard iterators with closures: - `::std::iter::repeat(()).map(|()| rng.gen())` -- `gen_ascii_chars`; use `repeat` as above and `rng.sample(Alphanumeric)` -- `gen_weighted_bool(n)`; use `gen_bool(1.0 / n)` instead - -`Rng` has a few new methods: - -- `sample(distr)` is a shortcut for `distr.sample(rng)` for any `Distribution` -- `gen_bool(p)` generates a boolean with probability `p` of being true -- `fill` and `try_fill`, corresponding to `fill_bytes` and `try_fill_bytes` - respectively (i.e. the only difference is error handling); these can fill - and integer slice / array directly, and provide better performance - than `gen()` - -#### Constructing PRNGs - -##### New randomly-initialised PRNGs - -A new trait has been added: `FromEntropy`. This is automatically implemented for -any type supporting `SeedableRng`, and provides construction from fresh, strong -entropy: - -```rust -use rand::{ChaChaRng, FromEntropy}; - -let mut rng = ChaChaRng::from_entropy(); -``` - -##### Seeding PRNGs - -The `SeedableRng` trait has been modified to include the seed type via an -associated type (`SeedableRng::Seed`) instead of a template parameter -(`SeedableRng`). Additionally, all PRNGs now seed from a byte-array -(`[u8; N]` for some fixed N). This allows generic handling of PRNG seeding -which was not previously possible. - -PRNGs are no longer constructed from other PRNGs via `Rand` support / `gen()`, -but through `SeedableRng::from_rng`, which allows error handling and is -intentionally explicit. - -`SeedableRng::reseed` has been removed since it has no utility over `from_seed` -and its performance advantage is questionable. - -Implementations of `SeedableRng` may need to change their `Seed` type to a -byte-array; this restriction has been made to ensure portable handling of -Endianness. Helper functions are available in `rand_core::le` to read `u32` and -`u64` values from byte arrays. - -#### Block-based PRNGs - -rand_core has a new helper trait, `BlockRngCore`, and implementation, -`BlockRng`. These are for use by generators which generate a block of random -data at a time instead of word-sized values. Using this trait and implementation -has two advantages: optimised `RngCore` methods are provided, and the PRNG can -be used with `ReseedingRng` with very low overhead. - -#### Cryptographic RNGs - -A new trait has been added: `CryptoRng`. This is purely a marker trait to -indicate which generators should be suitable for cryptography, e.g. -`fn foo(rng: &mut R)`. *Suitability for cryptographic -use cannot be guaranteed.* - -### Error handling - -A new `Error` type has been added, designed explicitly for no-std compatibility, -simplicity, and enough flexibility for our uses (carrying a `cause` when -possible): -```rust -pub struct Error { - pub kind: ErrorKind, - pub msg: &'static str, - // some fields omitted -} -``` -The associated `ErrorKind` allows broad classification of errors into permanent, -unexpected, transient and not-yet-ready kinds. - -The following use the new error type: - -- `RngCore::try_fill_bytes` -- `Rng::try_fill` -- `OsRng::new` -- `JitterRng::new` - -### External generators - -We have a new generator, `EntropyRng`, which wraps `OsRng` and `JitterRng` -(preferring to use the former, but falling back to the latter if necessary). -This allows easy construction with fallback via `SeedableRng::from_rng`, -e.g. `IsaacRng::from_rng(EntropyRng::new())?`. This is equivalent to using -`FromEntropy` except for error handling. - -It is recommended to use `EntropyRng` over `OsRng` to avoid errors on platforms -with broken system generator, but it should be noted that the `JitterRng` -fallback is very slow. - -### PRNGs - -*Pseudo-Random Number Generators* (i.e. deterministic algorithmic generators) -have had a few changes since 0.4, and are now housed in the `prng` module -(old names remain temporarily available for compatibility; eventually these -generators will likely be housed outside the `rand` crate). - -All PRNGs now do not implement `Copy` to prevent accidental copying of the -generator's state (and thus repetitions of generated values). Explicit cloning -via `Clone` is still available. All PRNGs now have a custom implementation of -`Debug` which does not print any internal state; this helps avoid accidentally -leaking cryptographic generator state in log files. External PRNG -implementations are advised to follow this pattern (see also doc on `RngCore`). - -`SmallRng` has been added as a wrapper, currently around `XorShiftRng` (but -likely another algorithm soon). This is for uses where small state and fast -initialisation are important but cryptographic strength is not required. -(Actual performance of generation varies by benchmark; dependending on usage -this may or may not be the fastest algorithm, but will always be fast.) - -#### `ReseedingRng` - -The `ReseedingRng` wrapper has been signficantly altered to reduce overhead. -Unfortunately the new `ReseedingRng` is not compatible with all RNGs, but only -those using `BlockRngCore`. - -#### ISAAC PRNGs - -The `IsaacRng` and `Isaac64Rng` PRNGs now have an additional construction -method: `new_from_u64(seed)`. 64 bits of state is insufficient for cryptography -but may be of use in simulations and games. This will likely be superceeded by -a method to construct any PRNG from any hashable object in the future. - -#### HC-128 - -This is a new cryptographic generator, selected as one of the "stream ciphers -suitable for widespread adoption" by eSTREAM. This is now the default -cryptographic generator, used by `StdRng` and `thread_rng()`. - -### Helper functions/traits - -The `Rand` trait has been deprecated. Instead, users are encouraged to use -`Standard` which is a real distribution and supports the same sampling as -`Rand`. `Rng::gen()` now uses `Standard` and should work exactly as before. -See the documentation of the `distributions` module on how to implement -`Distribution` for `Standard` for user types `T` - -`weak_rng()` has been deprecated; use `SmallRng::from_entropy()` instead. - -### Distributions - -The `Sample` and `IndependentSample` traits have been replaced by a single -trait, `Distribution`. This is largely equivalent to `IndependentSample`, but -with `ind_sample` replaced by just `sample`. Support for mutable distributions -has been dropped; although it appears there may be a few genuine uses, these -are not used widely enough to justify the existance of two independent traits -or of having to provide mutable access to a distribution object. Both `Sample` -and `IndependentSample` are still available, but deprecated; they will be -removed in a future release. - -`Distribution::sample` (as well as several other functions) can now be called -directly on type-erased (unsized) RNGs. - -`RandSample` has been removed (see `Rand` deprecation and new `Standard` -distribution). - -The `Closed01` wrapper has been removed, but `OpenClosed01` has been added. - -#### Uniform distributions - -Two new distributions are available: - -- `Standard` produces uniformly-distributed samples for many different types, - and acts as a replacement for `Rand` -- `Alphanumeric` samples `char`s from the ranges `a-z A-Z 0-9` - -##### Ranges - -The `Range` distribution has been heavily adapted, and renamed to `Uniform`: - -- `Uniform::new(low, high)` remains (half open `[low, high)`) -- `Uniform::new_inclusive(low, high)` has been added, including `high` in the sample range -- `Uniform::sample_single(low, high, rng)` is a faster variant for single usage sampling from `[low, high)` - -`Uniform` can now be implemented for user-defined types; see the `uniform` module. - -#### Non-uniform distributions - -Two distributions have been added: - -- Poisson, modelling the number of events expected from a constant-rate - source within a fixed time interval (e.g. nuclear decay) -- Binomial, modelling the outcome of a fixed number of yes-no trials - -The sampling methods are based on those in "Numerical Recipes in C". - -##### Exponential and Normal distributions - -The main `Exp` and `Normal` distributions are unchanged, however the -"standard" versions, `Exp1` and `StandardNormal` are no longer wrapper types, -but full distributions. Instead of writing `let Exp1(x) = rng.gen();` you now -write `let x = rng.sample(Exp1);`. diff -Nru cargo-0.35.0/vendor/rand-0.5.6/utils/ci/install.sh cargo-0.37.0/vendor/rand-0.5.6/utils/ci/install.sh --- cargo-0.35.0/vendor/rand-0.5.6/utils/ci/install.sh 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/utils/ci/install.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -# From https://github.com/japaric/trust - -set -ex - -main() { - local target= - if [ $TRAVIS_OS_NAME = linux ]; then - target=x86_64-unknown-linux-musl - sort=sort - else - target=x86_64-apple-darwin - sort=gsort # for `sort --sort-version`, from brew's coreutils. - fi - - # Builds for iOS are done on OSX, but require the specific target to be - # installed. - case $TARGET in - aarch64-apple-ios) - rustup target install aarch64-apple-ios - ;; - armv7-apple-ios) - rustup target install armv7-apple-ios - ;; - armv7s-apple-ios) - rustup target install armv7s-apple-ios - ;; - i386-apple-ios) - rustup target install i386-apple-ios - ;; - x86_64-apple-ios) - rustup target install x86_64-apple-ios - ;; - esac - - # This fetches latest stable release - local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \ - | cut -d/ -f3 \ - | grep -E '^v[0.1.0-9.]+$' \ - | $sort --version-sort \ - | tail -n1) - curl -LSfs https://japaric.github.io/trust/install.sh | \ - sh -s -- \ - --force \ - --git japaric/cross \ - --tag $tag \ - --target $target -} - -main diff -Nru cargo-0.35.0/vendor/rand-0.5.6/utils/ci/script.sh cargo-0.37.0/vendor/rand-0.5.6/utils/ci/script.sh --- cargo-0.35.0/vendor/rand-0.5.6/utils/ci/script.sh 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/utils/ci/script.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -# Derived from https://github.com/japaric/trust - -set -ex - -main() { - if [ ! -z $DISABLE_TESTS ]; then # tests are disabled - cross build --no-default-features --target $TARGET --release - if [ -z $DISABLE_STD ]; then # std is enabled - cross build --features log,serde1 --target $TARGET - fi - return - fi - - if [ ! -z $NIGHTLY ]; then # have nightly Rust - cross test --tests --no-default-features --features alloc --target $TARGET - cross test --package rand_core --no-default-features --features alloc --target $TARGET - cross test --features serde1,log,nightly,alloc --target $TARGET - cross test --all --benches --target $TARGET - else # have stable Rust - cross test --tests --no-default-features --target $TARGET - cross test --package rand_core --no-default-features --target $TARGET - cross test --features serde1,log --target $TARGET - fi -} - -# we don't run the "test phase" when doing deploys -if [ -z $TRAVIS_TAG ]; then - main -fi diff -Nru cargo-0.35.0/vendor/rand-0.5.6/utils/ziggurat_tables.py cargo-0.37.0/vendor/rand-0.5.6/utils/ziggurat_tables.py --- cargo-0.35.0/vendor/rand-0.5.6/utils/ziggurat_tables.py 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.5.6/utils/ziggurat_tables.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,127 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2013 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# https://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -# This creates the tables used for distributions implemented using the -# ziggurat algorithm in `rand::distributions;`. They are -# (basically) the tables as used in the ZIGNOR variant (Doornik 2005). -# They are changed rarely, so the generated file should be checked in -# to git. -# -# It creates 3 tables: X as in the paper, F which is f(x_i), and -# F_DIFF which is f(x_i) - f(x_{i-1}). The latter two are just cached -# values which is not done in that paper (but is done in other -# variants). Note that the adZigR table is unnecessary because of -# algebra. -# -# It is designed to be compatible with Python 2 and 3. - -from math import exp, sqrt, log, floor -import random - -# The order should match the return value of `tables` -TABLE_NAMES = ['X', 'F'] - -# The actual length of the table is 1 more, to stop -# index-out-of-bounds errors. This should match the bitwise operation -# to find `i` in `zigurrat` in `libstd/rand/mod.rs`. Also the *_R and -# *_V constants below depend on this value. -TABLE_LEN = 256 - -# equivalent to `zigNorInit` in Doornik2005, but generalised to any -# distribution. r = dR, v = dV, f = probability density function, -# f_inv = inverse of f -def tables(r, v, f, f_inv): - # compute the x_i - xvec = [0]*(TABLE_LEN+1) - - xvec[0] = v / f(r) - xvec[1] = r - - for i in range(2, TABLE_LEN): - last = xvec[i-1] - xvec[i] = f_inv(v / last + f(last)) - - # cache the f's - fvec = [0]*(TABLE_LEN+1) - for i in range(TABLE_LEN+1): - fvec[i] = f(xvec[i]) - - return xvec, fvec - -# Distributions -# N(0, 1) -def norm_f(x): - return exp(-x*x/2.0) -def norm_f_inv(y): - return sqrt(-2.0*log(y)) - -NORM_R = 3.6541528853610088 -NORM_V = 0.00492867323399 - -NORM = tables(NORM_R, NORM_V, - norm_f, norm_f_inv) - -# Exp(1) -def exp_f(x): - return exp(-x) -def exp_f_inv(y): - return -log(y) - -EXP_R = 7.69711747013104972 -EXP_V = 0.0039496598225815571993 - -EXP = tables(EXP_R, EXP_V, - exp_f, exp_f_inv) - - -# Output the tables/constants/types - -def render_static(name, type, value): - # no space or - return 'pub static %s: %s =%s;\n' % (name, type, value) - -# static `name`: [`type`, .. `len(values)`] = -# [values[0], ..., values[3], -# values[4], ..., values[7], -# ... ]; -def render_table(name, values): - rows = [] - # 4 values on each row - for i in range(0, len(values), 4): - row = values[i:i+4] - rows.append(', '.join('%.18f' % f for f in row)) - - rendered = '\n [%s]' % ',\n '.join(rows) - return render_static(name, '[f64, .. %d]' % len(values), rendered) - - -with open('ziggurat_tables.rs', 'w') as f: - f.write('''// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// https://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Tables for distributions which are sampled using the ziggurat -// algorithm. Autogenerated by `ziggurat_tables.py`. - -pub type ZigTable = &\'static [f64, .. %d]; -''' % (TABLE_LEN + 1)) - for name, tables, r in [('NORM', NORM, NORM_R), - ('EXP', EXP, EXP_R)]: - f.write(render_static('ZIG_%s_R' % name, 'f64', ' %.18f' % r)) - for (tabname, table) in zip(TABLE_NAMES, tables): - f.write(render_table('ZIG_%s_%s' % (name, tabname), table)) diff -Nru cargo-0.35.0/vendor/rand-0.6.5/benches/distributions.rs cargo-0.37.0/vendor/rand-0.6.5/benches/distributions.rs --- cargo-0.35.0/vendor/rand-0.6.5/benches/distributions.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/benches/distributions.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,259 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(test)] + +extern crate test; +extern crate rand; + +const RAND_BENCH_N: u64 = 1000; + +use std::mem::size_of; +use test::Bencher; +use std::time::Duration; + +use rand::{Rng, FromEntropy}; +use rand::rngs::SmallRng; +use rand::distributions::*; + +macro_rules! distr_int { + ($fnn:ident, $ty:ty, $distr:expr) => { + #[bench] + fn $fnn(b: &mut Bencher) { + let mut rng = SmallRng::from_entropy(); + let distr = $distr; + + b.iter(|| { + let mut accum = 0 as $ty; + for _ in 0..::RAND_BENCH_N { + let x: $ty = distr.sample(&mut rng); + accum = accum.wrapping_add(x); + } + accum + }); + b.bytes = size_of::<$ty>() as u64 * ::RAND_BENCH_N; + } + } +} + +macro_rules! distr_float { + ($fnn:ident, $ty:ty, $distr:expr) => { + #[bench] + fn $fnn(b: &mut Bencher) { + let mut rng = SmallRng::from_entropy(); + let distr = $distr; + + b.iter(|| { + let mut accum = 0.0; + for _ in 0..::RAND_BENCH_N { + let x: $ty = distr.sample(&mut rng); + accum += x; + } + accum + }); + b.bytes = size_of::<$ty>() as u64 * ::RAND_BENCH_N; + } + } +} + +macro_rules! distr_duration { + ($fnn:ident, $distr:expr) => { + #[bench] + fn $fnn(b: &mut Bencher) { + let mut rng = SmallRng::from_entropy(); + let distr = $distr; + + b.iter(|| { + let mut accum = Duration::new(0, 0); + for _ in 0..::RAND_BENCH_N { + let x: Duration = distr.sample(&mut rng); + accum = accum.checked_add(x).unwrap_or(Duration::new(u64::max_value(), 999_999_999)); + } + accum + }); + b.bytes = size_of::() as u64 * ::RAND_BENCH_N; + } + } +} + +macro_rules! distr { + ($fnn:ident, $ty:ty, $distr:expr) => { + #[bench] + fn $fnn(b: &mut Bencher) { + let mut rng = SmallRng::from_entropy(); + let distr = $distr; + + b.iter(|| { + let mut accum = 0u32; + for _ in 0..::RAND_BENCH_N { + let x: $ty = distr.sample(&mut rng); + accum = accum.wrapping_add(x as u32); + } + accum + }); + b.bytes = size_of::<$ty>() as u64 * ::RAND_BENCH_N; + } + } +} + +macro_rules! distr_arr { + ($fnn:ident, $ty:ty, $distr:expr) => { + #[bench] + fn $fnn(b: &mut Bencher) { + let mut rng = SmallRng::from_entropy(); + let distr = $distr; + + b.iter(|| { + let mut accum = 0u32; + for _ in 0..::RAND_BENCH_N { + let x: $ty = distr.sample(&mut rng); + accum = accum.wrapping_add(x[0] as u32); + } + accum + }); + b.bytes = size_of::<$ty>() as u64 * ::RAND_BENCH_N; + } + } +} + +// uniform +distr_int!(distr_uniform_i8, i8, Uniform::new(20i8, 100)); +distr_int!(distr_uniform_i16, i16, Uniform::new(-500i16, 2000)); +distr_int!(distr_uniform_i32, i32, Uniform::new(-200_000_000i32, 800_000_000)); +distr_int!(distr_uniform_i64, i64, Uniform::new(3i64, 123_456_789_123)); +distr_int!(distr_uniform_i128, i128, Uniform::new(-123_456_789_123i128, 123_456_789_123_456_789)); + +distr_float!(distr_uniform_f32, f32, Uniform::new(2.26f32, 2.319)); +distr_float!(distr_uniform_f64, f64, Uniform::new(2.26f64, 2.319)); + +const LARGE_SEC: u64 = u64::max_value() / 1000; + +distr_duration!(distr_uniform_duration_largest, + Uniform::new_inclusive(Duration::new(0, 0), Duration::new(u64::max_value(), 999_999_999)) +); +distr_duration!(distr_uniform_duration_large, + Uniform::new(Duration::new(0, 0), Duration::new(LARGE_SEC, 1_000_000_000 / 2)) +); +distr_duration!(distr_uniform_duration_one, + Uniform::new(Duration::new(0, 0), Duration::new(1, 0)) +); +distr_duration!(distr_uniform_duration_variety, + Uniform::new(Duration::new(10000, 423423), Duration::new(200000, 6969954)) +); +distr_duration!(distr_uniform_duration_edge, + Uniform::new_inclusive(Duration::new(LARGE_SEC, 999_999_999), Duration::new(LARGE_SEC + 1, 1)) +); + + +// standard +distr_int!(distr_standard_i8, i8, Standard); +distr_int!(distr_standard_i16, i16, Standard); +distr_int!(distr_standard_i32, i32, Standard); +distr_int!(distr_standard_i64, i64, Standard); +distr_int!(distr_standard_i128, i128, Standard); + +distr!(distr_standard_bool, bool, Standard); +distr!(distr_standard_alphanumeric, char, Alphanumeric); +distr!(distr_standard_codepoint, char, Standard); + +distr_float!(distr_standard_f32, f32, Standard); +distr_float!(distr_standard_f64, f64, Standard); +distr_float!(distr_open01_f32, f32, Open01); +distr_float!(distr_open01_f64, f64, Open01); +distr_float!(distr_openclosed01_f32, f32, OpenClosed01); +distr_float!(distr_openclosed01_f64, f64, OpenClosed01); + +// distributions +distr_float!(distr_exp, f64, Exp::new(1.23 * 4.56)); +distr_float!(distr_normal, f64, Normal::new(-1.23, 4.56)); +distr_float!(distr_log_normal, f64, LogNormal::new(-1.23, 4.56)); +distr_float!(distr_gamma_large_shape, f64, Gamma::new(10., 1.0)); +distr_float!(distr_gamma_small_shape, f64, Gamma::new(0.1, 1.0)); +distr_float!(distr_cauchy, f64, Cauchy::new(4.2, 6.9)); +distr_int!(distr_binomial, u64, Binomial::new(20, 0.7)); +distr_int!(distr_poisson, u64, Poisson::new(4.0)); +distr!(distr_bernoulli, bool, Bernoulli::new(0.18)); +distr_arr!(distr_circle, [f64; 2], UnitCircle::new()); +distr_arr!(distr_sphere_surface, [f64; 3], UnitSphereSurface::new()); + +// Weighted +distr_int!(distr_weighted_i8, usize, WeightedIndex::new(&[1i8, 2, 3, 4, 12, 0, 2, 1]).unwrap()); +distr_int!(distr_weighted_u32, usize, WeightedIndex::new(&[1u32, 2, 3, 4, 12, 0, 2, 1]).unwrap()); +distr_int!(distr_weighted_f64, usize, WeightedIndex::new(&[1.0f64, 0.001, 1.0/3.0, 4.01, 0.0, 3.3, 22.0, 0.001]).unwrap()); +distr_int!(distr_weighted_large_set, usize, WeightedIndex::new((0..10000).rev().chain(1..10001)).unwrap()); + +// construct and sample from a range +macro_rules! gen_range_int { + ($fnn:ident, $ty:ident, $low:expr, $high:expr) => { + #[bench] + fn $fnn(b: &mut Bencher) { + let mut rng = SmallRng::from_entropy(); + + b.iter(|| { + let mut high = $high; + let mut accum: $ty = 0; + for _ in 0..::RAND_BENCH_N { + accum = accum.wrapping_add(rng.gen_range($low, high)); + // force recalculation of range each time + high = high.wrapping_add(1) & std::$ty::MAX; + } + accum + }); + b.bytes = size_of::<$ty>() as u64 * ::RAND_BENCH_N; + } + } +} + +gen_range_int!(gen_range_i8, i8, -20i8, 100); +gen_range_int!(gen_range_i16, i16, -500i16, 2000); +gen_range_int!(gen_range_i32, i32, -200_000_000i32, 800_000_000); +gen_range_int!(gen_range_i64, i64, 3i64, 123_456_789_123); +gen_range_int!(gen_range_i128, i128, -12345678901234i128, 123_456_789_123_456_789); + +// construct and sample from a floating-point range +macro_rules! gen_range_float { + ($fnn:ident, $ty:ident, $low:expr, $high:expr) => { + #[bench] + fn $fnn(b: &mut Bencher) { + let mut rng = SmallRng::from_entropy(); + + b.iter(|| { + let mut high = $high; + let mut low = $low; + let mut accum: $ty = 0.0; + for _ in 0..::RAND_BENCH_N { + accum += rng.gen_range(low, high); + // force recalculation of range each time + low += 0.9; + high += 1.1; + } + accum + }); + b.bytes = size_of::<$ty>() as u64 * ::RAND_BENCH_N; + } + } +} + +gen_range_float!(gen_range_f32, f32, -20000.0f32, 100000.0); +gen_range_float!(gen_range_f64, f64, 123.456f64, 7890.12); + +#[bench] +fn dist_iter(b: &mut Bencher) { + let mut rng = SmallRng::from_entropy(); + let distr = Normal::new(-2.71828, 3.14159); + let mut iter = distr.sample_iter(&mut rng); + + b.iter(|| { + let mut accum = 0.0; + for _ in 0..::RAND_BENCH_N { + accum += iter.next().unwrap(); + } + accum + }); + b.bytes = size_of::() as u64 * ::RAND_BENCH_N; +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/benches/generators.rs cargo-0.37.0/vendor/rand-0.6.5/benches/generators.rs --- cargo-0.35.0/vendor/rand-0.6.5/benches/generators.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/benches/generators.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,240 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(test)] + +extern crate test; +extern crate rand; +extern crate rand_isaac; +extern crate rand_chacha; +extern crate rand_hc; +extern crate rand_pcg; +extern crate rand_xorshift; +extern crate rand_xoshiro; + +const RAND_BENCH_N: u64 = 1000; +const BYTES_LEN: usize = 1024; + +use std::mem::size_of; +use test::{black_box, Bencher}; + +use rand::prelude::*; +use rand::rngs::adapter::ReseedingRng; +use rand::rngs::{OsRng, JitterRng, EntropyRng}; +use rand_isaac::{IsaacRng, Isaac64Rng}; +use rand_chacha::ChaChaRng; +use rand_hc::{Hc128Rng, Hc128Core}; +use rand_pcg::{Lcg64Xsh32, Mcg128Xsl64}; +use rand_xorshift::XorShiftRng; +use rand_xoshiro::{Xoshiro256StarStar, Xoshiro256Plus, Xoshiro128StarStar, + Xoshiro128Plus, Xoroshiro128StarStar, Xoroshiro128Plus, SplitMix64, + Xoroshiro64StarStar, Xoroshiro64Star}; + +macro_rules! gen_bytes { + ($fnn:ident, $gen:expr) => { + #[bench] + fn $fnn(b: &mut Bencher) { + let mut rng = $gen; + let mut buf = [0u8; BYTES_LEN]; + b.iter(|| { + for _ in 0..RAND_BENCH_N { + rng.fill_bytes(&mut buf); + black_box(buf); + } + }); + b.bytes = BYTES_LEN as u64 * RAND_BENCH_N; + } + } +} + +gen_bytes!(gen_bytes_xorshift, XorShiftRng::from_entropy()); +gen_bytes!(gen_bytes_xoshiro256starstar, Xoshiro256StarStar::from_entropy()); +gen_bytes!(gen_bytes_xoshiro256plus, Xoshiro256Plus::from_entropy()); +gen_bytes!(gen_bytes_xoshiro128starstar, Xoshiro128StarStar::from_entropy()); +gen_bytes!(gen_bytes_xoshiro128plus, Xoshiro128Plus::from_entropy()); +gen_bytes!(gen_bytes_xoroshiro128starstar, Xoroshiro128StarStar::from_entropy()); +gen_bytes!(gen_bytes_xoroshiro128plus, Xoroshiro128Plus::from_entropy()); +gen_bytes!(gen_bytes_xoroshiro64starstar, Xoroshiro64StarStar::from_entropy()); +gen_bytes!(gen_bytes_xoroshiro64star, Xoroshiro64Star::from_entropy()); +gen_bytes!(gen_bytes_splitmix64, SplitMix64::from_entropy()); +gen_bytes!(gen_bytes_lcg64_xsh32, Lcg64Xsh32::from_entropy()); +gen_bytes!(gen_bytes_mcg128_xsh64, Mcg128Xsl64::from_entropy()); +gen_bytes!(gen_bytes_chacha20, ChaChaRng::from_entropy()); +gen_bytes!(gen_bytes_hc128, Hc128Rng::from_entropy()); +gen_bytes!(gen_bytes_isaac, IsaacRng::from_entropy()); +gen_bytes!(gen_bytes_isaac64, Isaac64Rng::from_entropy()); +gen_bytes!(gen_bytes_std, StdRng::from_entropy()); +gen_bytes!(gen_bytes_small, SmallRng::from_entropy()); +gen_bytes!(gen_bytes_os, OsRng::new().unwrap()); + +macro_rules! gen_uint { + ($fnn:ident, $ty:ty, $gen:expr) => { + #[bench] + fn $fnn(b: &mut Bencher) { + let mut rng = $gen; + b.iter(|| { + let mut accum: $ty = 0; + for _ in 0..RAND_BENCH_N { + accum = accum.wrapping_add(rng.gen::<$ty>()); + } + accum + }); + b.bytes = size_of::<$ty>() as u64 * RAND_BENCH_N; + } + } +} + +gen_uint!(gen_u32_xorshift, u32, XorShiftRng::from_entropy()); +gen_uint!(gen_u32_xoshiro256starstar, u32, Xoshiro256StarStar::from_entropy()); +gen_uint!(gen_u32_xoshiro256plus, u32, Xoshiro256Plus::from_entropy()); +gen_uint!(gen_u32_xoshiro128starstar, u32, Xoshiro128StarStar::from_entropy()); +gen_uint!(gen_u32_xoshiro128plus, u32, Xoshiro128Plus::from_entropy()); +gen_uint!(gen_u32_xoroshiro128starstar, u32, Xoroshiro128StarStar::from_entropy()); +gen_uint!(gen_u32_xoroshiro128plus, u32, Xoroshiro128Plus::from_entropy()); +gen_uint!(gen_u32_xoroshiro64starstar, u32, Xoroshiro64StarStar::from_entropy()); +gen_uint!(gen_u32_xoroshiro64star, u32, Xoroshiro64Star::from_entropy()); +gen_uint!(gen_u32_splitmix64, u32, SplitMix64::from_entropy()); +gen_uint!(gen_u32_lcg64_xsh32, u32, Lcg64Xsh32::from_entropy()); +gen_uint!(gen_u32_mcg128_xsh64, u32, Mcg128Xsl64::from_entropy()); +gen_uint!(gen_u32_chacha20, u32, ChaChaRng::from_entropy()); +gen_uint!(gen_u32_hc128, u32, Hc128Rng::from_entropy()); +gen_uint!(gen_u32_isaac, u32, IsaacRng::from_entropy()); +gen_uint!(gen_u32_isaac64, u32, Isaac64Rng::from_entropy()); +gen_uint!(gen_u32_std, u32, StdRng::from_entropy()); +gen_uint!(gen_u32_small, u32, SmallRng::from_entropy()); +gen_uint!(gen_u32_os, u32, OsRng::new().unwrap()); + +gen_uint!(gen_u64_xorshift, u64, XorShiftRng::from_entropy()); +gen_uint!(gen_u64_xoshiro256starstar, u64, Xoshiro256StarStar::from_entropy()); +gen_uint!(gen_u64_xoshiro256plus, u64, Xoshiro256Plus::from_entropy()); +gen_uint!(gen_u64_xoshiro128starstar, u64, Xoshiro128StarStar::from_entropy()); +gen_uint!(gen_u64_xoshiro128plus, u64, Xoshiro128Plus::from_entropy()); +gen_uint!(gen_u64_xoroshiro128starstar, u64, Xoroshiro128StarStar::from_entropy()); +gen_uint!(gen_u64_xoroshiro128plus, u64, Xoroshiro128Plus::from_entropy()); +gen_uint!(gen_u64_xoroshiro64starstar, u64, Xoroshiro64StarStar::from_entropy()); +gen_uint!(gen_u64_xoroshiro64star, u64, Xoroshiro64Star::from_entropy()); +gen_uint!(gen_u64_splitmix64, u64, SplitMix64::from_entropy()); +gen_uint!(gen_u64_lcg64_xsh32, u64, Lcg64Xsh32::from_entropy()); +gen_uint!(gen_u64_mcg128_xsh64, u64, Mcg128Xsl64::from_entropy()); +gen_uint!(gen_u64_chacha20, u64, ChaChaRng::from_entropy()); +gen_uint!(gen_u64_hc128, u64, Hc128Rng::from_entropy()); +gen_uint!(gen_u64_isaac, u64, IsaacRng::from_entropy()); +gen_uint!(gen_u64_isaac64, u64, Isaac64Rng::from_entropy()); +gen_uint!(gen_u64_std, u64, StdRng::from_entropy()); +gen_uint!(gen_u64_small, u64, SmallRng::from_entropy()); +gen_uint!(gen_u64_os, u64, OsRng::new().unwrap()); + +// Do not test JitterRng like the others by running it RAND_BENCH_N times per, +// measurement, because it is way too slow. Only run it once. +#[bench] +fn gen_u64_jitter(b: &mut Bencher) { + let mut rng = JitterRng::new().unwrap(); + b.iter(|| { + rng.gen::() + }); + b.bytes = size_of::() as u64; +} + +macro_rules! init_gen { + ($fnn:ident, $gen:ident) => { + #[bench] + fn $fnn(b: &mut Bencher) { + let mut rng = XorShiftRng::from_entropy(); + b.iter(|| { + let r2 = $gen::from_rng(&mut rng).unwrap(); + r2 + }); + } + } +} + +init_gen!(init_xorshift, XorShiftRng); +init_gen!(init_xoshiro256starstar, Xoshiro256StarStar); +init_gen!(init_xoshiro256plus, Xoshiro256Plus); +init_gen!(init_xoshiro128starstar, Xoshiro128StarStar); +init_gen!(init_xoshiro128plus, Xoshiro128Plus); +init_gen!(init_xoroshiro128starstar, Xoroshiro128StarStar); +init_gen!(init_xoroshiro128plus, Xoroshiro128Plus); +init_gen!(init_xoroshiro64starstar, Xoroshiro64StarStar); +init_gen!(init_xoroshiro64star, Xoroshiro64Star); +init_gen!(init_splitmix64, SplitMix64); +init_gen!(init_lcg64_xsh32, Lcg64Xsh32); +init_gen!(init_mcg128_xsh64, Mcg128Xsl64); +init_gen!(init_hc128, Hc128Rng); +init_gen!(init_isaac, IsaacRng); +init_gen!(init_isaac64, Isaac64Rng); +init_gen!(init_chacha, ChaChaRng); + +#[bench] +fn init_jitter(b: &mut Bencher) { + b.iter(|| { + JitterRng::new().unwrap() + }); +} + + +const RESEEDING_THRESHOLD: u64 = 1024*1024*1024; // something high enough to get + // deterministic measurements + +#[bench] +fn reseeding_hc128_bytes(b: &mut Bencher) { + let mut rng = ReseedingRng::new(Hc128Core::from_entropy(), + RESEEDING_THRESHOLD, + EntropyRng::new()); + let mut buf = [0u8; BYTES_LEN]; + b.iter(|| { + for _ in 0..RAND_BENCH_N { + rng.fill_bytes(&mut buf); + black_box(buf); + } + }); + b.bytes = BYTES_LEN as u64 * RAND_BENCH_N; +} + +macro_rules! reseeding_uint { + ($fnn:ident, $ty:ty) => { + #[bench] + fn $fnn(b: &mut Bencher) { + let mut rng = ReseedingRng::new(Hc128Core::from_entropy(), + RESEEDING_THRESHOLD, + EntropyRng::new()); + b.iter(|| { + let mut accum: $ty = 0; + for _ in 0..RAND_BENCH_N { + accum = accum.wrapping_add(rng.gen::<$ty>()); + } + accum + }); + b.bytes = size_of::<$ty>() as u64 * RAND_BENCH_N; + } + } +} + +reseeding_uint!(reseeding_hc128_u32, u32); +reseeding_uint!(reseeding_hc128_u64, u64); + + +macro_rules! threadrng_uint { + ($fnn:ident, $ty:ty) => { + #[bench] + fn $fnn(b: &mut Bencher) { + let mut rng = thread_rng(); + b.iter(|| { + let mut accum: $ty = 0; + for _ in 0..RAND_BENCH_N { + accum = accum.wrapping_add(rng.gen::<$ty>()); + } + accum + }); + b.bytes = size_of::<$ty>() as u64 * RAND_BENCH_N; + } + } +} + +threadrng_uint!(thread_rng_u32, u32); +threadrng_uint!(thread_rng_u64, u64); diff -Nru cargo-0.35.0/vendor/rand-0.6.5/benches/misc.rs cargo-0.37.0/vendor/rand-0.6.5/benches/misc.rs --- cargo-0.35.0/vendor/rand-0.6.5/benches/misc.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/benches/misc.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,160 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(test)] + +extern crate test; +extern crate rand; + +const RAND_BENCH_N: u64 = 1000; + +use test::Bencher; + +use rand::prelude::*; + +#[bench] +fn misc_gen_bool_const(b: &mut Bencher) { + let mut rng = StdRng::from_rng(&mut thread_rng()).unwrap(); + b.iter(|| { + let mut accum = true; + for _ in 0..::RAND_BENCH_N { + accum ^= rng.gen_bool(0.18); + } + accum + }) +} + +#[bench] +fn misc_gen_bool_var(b: &mut Bencher) { + let mut rng = StdRng::from_rng(&mut thread_rng()).unwrap(); + b.iter(|| { + let mut accum = true; + let mut p = 0.18; + for _ in 0..::RAND_BENCH_N { + accum ^= rng.gen_bool(p); + p += 0.0001; + } + accum + }) +} + +#[bench] +fn misc_gen_ratio_const(b: &mut Bencher) { + let mut rng = StdRng::from_rng(&mut thread_rng()).unwrap(); + b.iter(|| { + let mut accum = true; + for _ in 0..::RAND_BENCH_N { + accum ^= rng.gen_ratio(2, 3); + } + accum + }) +} + +#[bench] +fn misc_gen_ratio_var(b: &mut Bencher) { + let mut rng = StdRng::from_rng(&mut thread_rng()).unwrap(); + b.iter(|| { + let mut accum = true; + for i in 2..(::RAND_BENCH_N as u32 + 2) { + accum ^= rng.gen_ratio(i, i + 1); + } + accum + }) +} + +#[bench] +fn misc_bernoulli_const(b: &mut Bencher) { + let mut rng = StdRng::from_rng(&mut thread_rng()).unwrap(); + b.iter(|| { + let d = rand::distributions::Bernoulli::new(0.18); + let mut accum = true; + for _ in 0..::RAND_BENCH_N { + accum ^= rng.sample(d); + } + accum + }) +} + +#[bench] +fn misc_bernoulli_var(b: &mut Bencher) { + let mut rng = StdRng::from_rng(&mut thread_rng()).unwrap(); + b.iter(|| { + let mut accum = true; + let mut p = 0.18; + for _ in 0..::RAND_BENCH_N { + let d = rand::distributions::Bernoulli::new(p); + accum ^= rng.sample(d); + p += 0.0001; + } + accum + }) +} + +macro_rules! sample_binomial { + ($name:ident, $n:expr, $p:expr) => { + #[bench] + fn $name(b: &mut Bencher) { + let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap(); + let (n, p) = ($n, $p); + b.iter(|| { + let d = rand::distributions::Binomial::new(n, p); + rng.sample(d) + }) + } + } +} + +sample_binomial!(misc_binomial_1, 1, 0.9); +sample_binomial!(misc_binomial_10, 10, 0.9); +sample_binomial!(misc_binomial_100, 100, 0.99); +sample_binomial!(misc_binomial_1000, 1000, 0.01); +sample_binomial!(misc_binomial_1e12, 1000_000_000_000, 0.2); + +#[bench] +fn gen_1k_iter_repeat(b: &mut Bencher) { + use std::iter; + let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap(); + b.iter(|| { + let v: Vec = iter::repeat(()).map(|()| rng.gen()).take(128).collect(); + v + }); + b.bytes = 1024; +} + +#[bench] +fn gen_1k_sample_iter(b: &mut Bencher) { + use rand::distributions::{Distribution, Standard}; + let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap(); + b.iter(|| { + let v: Vec = Standard.sample_iter(&mut rng).take(128).collect(); + v + }); + b.bytes = 1024; +} + +#[bench] +fn gen_1k_gen_array(b: &mut Bencher) { + let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap(); + b.iter(|| { + // max supported array length is 32! + let v: [[u64; 32]; 4] = rng.gen(); + v + }); + b.bytes = 1024; +} + +#[bench] +fn gen_1k_fill(b: &mut Bencher) { + let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap(); + let mut buf = [0u64; 128]; + b.iter(|| { + rng.fill(&mut buf[..]); + buf + }); + b.bytes = 1024; +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/benches/seq.rs cargo-0.37.0/vendor/rand-0.6.5/benches/seq.rs --- cargo-0.35.0/vendor/rand-0.6.5/benches/seq.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/benches/seq.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,174 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(test)] +#![allow(non_snake_case)] + +extern crate test; +extern crate rand; + +use test::Bencher; + +use rand::prelude::*; +use rand::seq::*; +use std::mem::size_of; + +const RAND_BENCH_N: u64 = 1000; + +#[bench] +fn seq_shuffle_100(b: &mut Bencher) { + let mut rng = SmallRng::from_rng(thread_rng()).unwrap(); + let x : &mut [usize] = &mut [1; 100]; + b.iter(|| { + x.shuffle(&mut rng); + x[0] + }) +} + +#[bench] +fn seq_slice_choose_1_of_1000(b: &mut Bencher) { + let mut rng = SmallRng::from_rng(thread_rng()).unwrap(); + let x : &mut [usize] = &mut [1; 1000]; + for i in 0..1000 { + x[i] = i; + } + b.iter(|| { + let mut s = 0; + for _ in 0..RAND_BENCH_N { + s += x.choose(&mut rng).unwrap(); + } + s + }); + b.bytes = size_of::() as u64 * ::RAND_BENCH_N; +} + +macro_rules! seq_slice_choose_multiple { + ($name:ident, $amount:expr, $length:expr) => { + #[bench] + fn $name(b: &mut Bencher) { + let mut rng = SmallRng::from_rng(thread_rng()).unwrap(); + let x : &[i32] = &[$amount; $length]; + let mut result = [0i32; $amount]; + b.iter(|| { + // Collect full result to prevent unwanted shortcuts getting + // first element (in case sample_indices returns an iterator). + for (slot, sample) in result.iter_mut().zip( + x.choose_multiple(&mut rng, $amount)) { + *slot = *sample; + } + result[$amount-1] + }) + } + } +} + +seq_slice_choose_multiple!(seq_slice_choose_multiple_1_of_1000, 1, 1000); +seq_slice_choose_multiple!(seq_slice_choose_multiple_950_of_1000, 950, 1000); +seq_slice_choose_multiple!(seq_slice_choose_multiple_10_of_100, 10, 100); +seq_slice_choose_multiple!(seq_slice_choose_multiple_90_of_100, 90, 100); + +#[bench] +fn seq_iter_choose_from_1000(b: &mut Bencher) { + let mut rng = SmallRng::from_rng(thread_rng()).unwrap(); + let x : &mut [usize] = &mut [1; 1000]; + for i in 0..1000 { + x[i] = i; + } + b.iter(|| { + let mut s = 0; + for _ in 0..RAND_BENCH_N { + s += x.iter().choose(&mut rng).unwrap(); + } + s + }); + b.bytes = size_of::() as u64 * ::RAND_BENCH_N; +} + +#[derive(Clone)] +struct UnhintedIterator { + iter: I, +} +impl Iterator for UnhintedIterator { + type Item = I::Item; + fn next(&mut self) -> Option { + self.iter.next() + } +} + +#[derive(Clone)] +struct WindowHintedIterator { + iter: I, + window_size: usize, +} +impl Iterator for WindowHintedIterator { + type Item = I::Item; + fn next(&mut self) -> Option { + self.iter.next() + } + fn size_hint(&self) -> (usize, Option) { + (std::cmp::min(self.iter.len(), self.window_size), None) + } +} + +#[bench] +fn seq_iter_unhinted_choose_from_1000(b: &mut Bencher) { + let mut rng = SmallRng::from_rng(thread_rng()).unwrap(); + let x : &[usize] = &[1; 1000]; + b.iter(|| { + UnhintedIterator { iter: x.iter() }.choose(&mut rng).unwrap() + }) +} + +#[bench] +fn seq_iter_window_hinted_choose_from_1000(b: &mut Bencher) { + let mut rng = SmallRng::from_rng(thread_rng()).unwrap(); + let x : &[usize] = &[1; 1000]; + b.iter(|| { + WindowHintedIterator { iter: x.iter(), window_size: 7 }.choose(&mut rng) + }) +} + +#[bench] +fn seq_iter_choose_multiple_10_of_100(b: &mut Bencher) { + let mut rng = SmallRng::from_rng(thread_rng()).unwrap(); + let x : &[usize] = &[1; 100]; + b.iter(|| { + x.iter().cloned().choose_multiple(&mut rng, 10) + }) +} + +#[bench] +fn seq_iter_choose_multiple_fill_10_of_100(b: &mut Bencher) { + let mut rng = SmallRng::from_rng(thread_rng()).unwrap(); + let x : &[usize] = &[1; 100]; + let mut buf = [0; 10]; + b.iter(|| { + x.iter().cloned().choose_multiple_fill(&mut rng, &mut buf) + }) +} + +macro_rules! sample_indices { + ($name:ident, $fn:ident, $amount:expr, $length:expr) => { + #[bench] + fn $name(b: &mut Bencher) { + let mut rng = SmallRng::from_rng(thread_rng()).unwrap(); + b.iter(|| { + index::$fn(&mut rng, $length, $amount) + }) + } + } +} + +sample_indices!(misc_sample_indices_1_of_1k, sample, 1, 1000); +sample_indices!(misc_sample_indices_10_of_1k, sample, 10, 1000); +sample_indices!(misc_sample_indices_100_of_1k, sample, 100, 1000); +sample_indices!(misc_sample_indices_100_of_1M, sample, 100, 1000_000); +sample_indices!(misc_sample_indices_100_of_1G, sample, 100, 1000_000_000); +sample_indices!(misc_sample_indices_200_of_1G, sample, 200, 1000_000_000); +sample_indices!(misc_sample_indices_400_of_1G, sample, 400, 1000_000_000); +sample_indices!(misc_sample_indices_600_of_1G, sample, 600, 1000_000_000); diff -Nru cargo-0.35.0/vendor/rand-0.6.5/build.rs cargo-0.37.0/vendor/rand-0.6.5/build.rs --- cargo-0.35.0/vendor/rand-0.6.5/build.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/build.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,10 @@ +extern crate autocfg; + +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + + let ac = autocfg::new(); + ac.emit_rustc_version(1, 25); + ac.emit_rustc_version(1, 26); + ac.emit_rustc_version(1, 27); +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/.cargo-checksum.json cargo-0.37.0/vendor/rand-0.6.5/.cargo-checksum.json --- cargo-0.35.0/vendor/rand-0.6.5/.cargo-checksum.json 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +{"files":{},"package":"6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/rand-0.6.5/Cargo.toml cargo-0.37.0/vendor/rand-0.6.5/Cargo.toml --- cargo-0.35.0/vendor/rand-0.6.5/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,90 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# 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 = "rand" +version = "0.6.5" +authors = ["The Rand Project Developers", "The Rust Project Developers"] +build = "build.rs" +exclude = ["/utils/*", "/.travis.yml", "/appveyor.yml", ".gitignore"] +description = "Random number generators and other randomness functionality.\n" +homepage = "https://crates.io/crates/rand" +documentation = "https://rust-random.github.io/rand" +readme = "README.md" +keywords = ["random", "rng"] +categories = ["algorithms", "no-std"] +license = "MIT/Apache-2.0" +repository = "https://github.com/rust-random/rand" +[package.metadata.docs.rs] +all-features = true +[dependencies.log] +version = "0.4" +optional = true + +[dependencies.packed_simd] +version = "0.3" +features = ["into_bits"] +optional = true + +[dependencies.rand_chacha] +version = "0.1" + +[dependencies.rand_core] +version = "0.4" + +[dependencies.rand_hc] +version = "0.1" + +[dependencies.rand_isaac] +version = "0.1" + +[dependencies.rand_jitter] +version = "0.1" + +[dependencies.rand_os] +version = "0.1" +optional = true + +[dependencies.rand_pcg] +version = "0.1" + +[dependencies.rand_xorshift] +version = "0.1" +[dev-dependencies.average] +version = "0.9.2" + +[dev-dependencies.rand_xoshiro] +version = "0.1" +[build-dependencies.autocfg] +version = "0.1" + +[features] +alloc = ["rand_core/alloc"] +default = ["std"] +i128_support = [] +nightly = ["simd_support"] +serde1 = ["rand_core/serde1", "rand_isaac/serde1", "rand_xorshift/serde1"] +simd_support = ["packed_simd"] +std = ["rand_core/std", "alloc", "rand_os", "rand_jitter/std"] +stdweb = ["rand_os/stdweb"] +wasm-bindgen = ["rand_os/wasm-bindgen"] +[target."cfg(unix)".dependencies.libc] +version = "0.2" +default-features = false +[target."cfg(windows)".dependencies.winapi] +version = "0.3" +features = ["minwindef", "ntsecapi", "profileapi", "winnt"] +[badges.appveyor] +repository = "rust-random/rand" + +[badges.travis-ci] +repository = "rust-random/rand" diff -Nru cargo-0.35.0/vendor/rand-0.6.5/CHANGELOG.md cargo-0.37.0/vendor/rand-0.6.5/CHANGELOG.md --- cargo-0.35.0/vendor/rand-0.6.5/CHANGELOG.md 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,522 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +A [separate changelog is kept for rand_core](rand_core/CHANGELOG.md). + +You may also find the [Upgrade Guide](https://rust-random.github.io/book/update.html) useful. + + +## [0.6.5] - 2019-01-28 +### Crates +- Update `rand_core` to 0.4 (#703) +- Move `JitterRng` to its own crate (#685) +- Add a warm-bindgen test crate (#696) + +### Platforms +- Fuchsia: Replaced fuchsia-zircon with fuchsia-cprng + +### Doc +- Use RFC 1946 for doc links (#691) +- Fix some doc links and notes (#711) + +## [0.6.4] - 2019-01-08 +### Fixes +- Move wasm-bindgen shims to correct crate (#686) +- Make `wasm32-unknown-unknown` compile but fail at run-time if missing bindingsg (#686) + +## [0.6.3] - 2019-01-04 +### Fixes +- Make the `std` feature require the optional `rand_os` dependency (#675) +- Re-export the optional WASM dependencies of `rand_os` from `rand` to avoid breakage (#674) + +## [0.6.2] - 2019-01-04 +### Additions +- Add `Default` for `ThreadRng` (#657) +- Move `rngs::OsRng` to `rand_os` sub-crate; clean up code; use as dependency (#643) ##BLOCKER## +- Add `rand_xoshiro` sub-crate, plus benchmarks (#642, #668) + +### Fixes +- Fix bias in `UniformInt::sample_single` (#662) +- Use `autocfg` instead of `rustc_version` for rustc version detection (#664) +- Disable `i128` and `u128` if the `target_os` is `emscripten` (#671: work-around Emscripten limitation) +- CI fixes (#660, #671) + +### Optimisations +- Optimise memory usage of `UnitCircle` and `UnitSphereSurface` distributions (no PR) + +## [0.6.1] - 2018-11-22 +- Support sampling `Duration` also for `no_std` (only since Rust 1.25) (#649) +- Disable default features of `libc` (#647) + +## [0.6.0] - 2018-11-14 + +### Project organisation +- Rand has moved from [rust-lang-nursery](https://github.com/rust-lang-nursery/rand) + to [rust-random](https://github.com/rust-random/rand)! (#578) +- Created [The Rust Random Book](https://rust-random.github.io/book/) + ([source](https://github.com/rust-random/book)) +- Update copyright and licence notices (#591, #611) +- Migrate policy documentation from the wiki (#544) + +### Platforms +- Add fork protection on Unix (#466) +- Added support for wasm-bindgen. (#541, #559, #562, #600) +- Enable `OsRng` for powerpc64, sparc and sparc64 (#609) +- Use `syscall` from `libc` on Linux instead of redefining it (#629) + +### RNGs +- Switch `SmallRng` to use PCG (#623) +- Implement `Pcg32` and `Pcg64Mcg` generators (#632) +- Move ISAAC RNGs to a dedicated crate (#551) +- Move Xorshift RNG to its own crate (#557) +- Move ChaCha and HC128 RNGs to dedicated crates (#607, #636) +- Remove usage of `Rc` from `ThreadRng` (#615) + +### Sampling and distributions +- Implement `Rng.gen_ratio()` and `Bernoulli::new_ratio()` (#491) +- Make `Uniform` strictly respect `f32` / `f64` high/low bounds (#477) +- Allow `gen_range` and `Uniform` to work on non-`Copy` types (#506) +- `Uniform` supports inclusive ranges: `Uniform::from(a..=b)`. This is + automatically enabled for Rust >= 1.27. (#566) +- Implement `TrustedLen` and `FusedIterator` for `DistIter` (#620) + +#### New distributions +- Add the `Dirichlet` distribution (#485) +- Added sampling from the unit sphere and circle. (#567) +- Implement the triangular distribution (#575) +- Implement the Weibull distribution (#576) +- Implement the Beta distribution (#574) + +#### Optimisations + +- Optimise `Bernoulli::new` (#500) +- Optimise `char` sampling (#519) +- Optimise sampling of `std::time::Duration` (#583) + +### Sequences +- Redesign the `seq` module (#483, #515) +- Add `WeightedIndex` and `choose_weighted` (#518, #547) +- Optimised and changed return type of the `sample_indices` function. (#479) +- Use `Iterator::size_hint()` to speed up `IteratorRandom::choose` (#593) + +### SIMD +- Support for generating SIMD types (#523, #542, #561, #630) + +### Other +- Revise CI scripts (#632, #635) +- Remove functionality already deprecated in 0.5 (#499) +- Support for `i128` and `u128` is automatically enabled for Rust >= 1.26. This + renders the `i128_support` feature obsolete. It still exists for backwards + compatibility but does not have any effect. This breaks programs using Rand + with `i128_support` on nightlies older than Rust 1.26. (#571) + + +## [0.5.5] - 2018-08-07 +### Documentation +- Fix links in documentation (#582) + + +## [0.5.4] - 2018-07-11 +### Platform support +- Make `OsRng` work via WASM/stdweb for WebWorkers + + +## [0.5.3] - 2018-06-26 +### Platform support +- OpenBSD, Bitrig: fix compilation (broken in 0.5.1) (#530) + + +## [0.5.2] - 2018-06-18 +### Platform support +- Hide `OsRng` and `JitterRng` on unsupported platforms (#512; fixes #503). + + +## [0.5.1] - 2018-06-08 + +### New distributions +- Added Cauchy distribution. (#474, #486) +- Added Pareto distribution. (#495) + +### Platform support and `OsRng` +- Remove blanket Unix implementation. (#484) +- Remove Wasm unimplemented stub. (#484) +- Dragonfly BSD: read from `/dev/random`. (#484) +- Bitrig: use `getentropy` like OpenBSD. (#484) +- Solaris: (untested) use `getrandom` if available, otherwise `/dev/random`. (#484) +- Emscripten, `stdweb`: split the read up in chunks. (#484) +- Emscripten, Haiku: don't do an extra blocking read from `/dev/random`. (#484) +- Linux, NetBSD, Solaris: read in blocking mode on first use in `fill_bytes`. (#484) +- Fuchsia, CloudABI: fix compilation (broken in Rand 0.5). (#484) + + +## [0.5.0] - 2018-05-21 + +### Crate features and organisation +- Minimum Rust version update: 1.22.0. (#239) +- Create a separate `rand_core` crate. (#288) +- Deprecate `rand_derive`. (#256) +- Add `prelude` (and module reorganisation). (#435) +- Add `log` feature. Logging is now available in `JitterRng`, `OsRng`, `EntropyRng` and `ReseedingRng`. (#246) +- Add `serde1` feature for some PRNGs. (#189) +- `stdweb` feature for `OsRng` support on WASM via stdweb. (#272, #336) + +### `Rng` trait +- Split `Rng` in `RngCore` and `Rng` extension trait. + `next_u32`, `next_u64` and `fill_bytes` are now part of `RngCore`. (#265) +- Add `Rng::sample`. (#256) +- Deprecate `Rng::gen_weighted_bool`. (#308) +- Add `Rng::gen_bool`. (#308) +- Remove `Rng::next_f32` and `Rng::next_f64`. (#273) +- Add optimized `Rng::fill` and `Rng::try_fill` methods. (#247) +- Deprecate `Rng::gen_iter`. (#286) +- Deprecate `Rng::gen_ascii_chars`. (#279) + +### `rand_core` crate +- `rand` now depends on new `rand_core` crate (#288) +- `RngCore` and `SeedableRng` are now part of `rand_core`. (#288) +- Add modules to help implementing RNGs `impl` and `le`. (#209, #228) +- Add `Error` and `ErrorKind`. (#225) +- Add `CryptoRng` marker trait. (#273) +- Add `BlockRngCore` trait. (#281) +- Add `BlockRng` and `BlockRng64` wrappers to help implementations. (#281, #325) +- Revise the `SeedableRng` trait. (#233) +- Remove default implementations for `RngCore::next_u64` and `RngCore::fill_bytes`. (#288) +- Add `RngCore::try_fill_bytes`. (#225) + +### Other traits and types +- Add `FromEntropy` trait. (#233, #375) +- Add `SmallRng` wrapper. (#296) +- Rewrite `ReseedingRng` to only work with `BlockRngCore` (substantial performance improvement). (#281) +- Deprecate `weak_rng`. Use `SmallRng` instead. (#296) +- Deprecate `AsciiGenerator`. (#279) + +### Random number generators +- Switch `StdRng` and `thread_rng` to HC-128. (#277) +- `StdRng` must now be created with `from_entropy` instead of `new` +- Change `thread_rng` reseeding threshold to 32 MiB. (#277) +- PRNGs no longer implement `Copy`. (#209) +- `Debug` implementations no longer show internals. (#209) +- Implement `Clone` for `ReseedingRng`, `JitterRng`, OsRng`. (#383, #384) +- Implement serialization for `XorShiftRng`, `IsaacRng` and `Isaac64Rng` under the `serde1` feature. (#189) +- Implement `BlockRngCore` for `ChaChaCore` and `Hc128Core`. (#281) +- All PRNGs are now portable across big- and little-endian architectures. (#209) +- `Isaac64Rng::next_u32` no longer throws away half the results. (#209) +- Add `IsaacRng::new_from_u64` and `Isaac64Rng::new_from_u64`. (#209) +- Add the HC-128 CSPRNG `Hc128Rng`. (#210) +- Change ChaCha20 to have 64-bit counter and 64-bit stream. (#349) +- Changes to `JitterRng` to get its size down from 2112 to 24 bytes. (#251) +- Various performance improvements to all PRNGs. + +### Platform support and `OsRng` +- Add support for CloudABI. (#224) +- Remove support for NaCl. (#225) +- WASM support for `OsRng` via stdweb, behind the `stdweb` feature. (#272, #336) +- Use `getrandom` on more platforms for Linux, and on Android. (#338) +- Use the `SecRandomCopyBytes` interface on macOS. (#322) +- On systems that do not have a syscall interface, only keep a single file descriptor open for `OsRng`. (#239) +- On Unix, first try a single read from `/dev/random`, then `/dev/urandom`. (#338) +- Better error handling and reporting in `OsRng` (using new error type). (#225) +- `OsRng` now uses non-blocking when available. (#225) +- Add `EntropyRng`, which provides `OsRng`, but has `JitterRng` as a fallback. (#235) + +### Distributions +- New `Distribution` trait. (#256) +- Add `Distribution::sample_iter` and `Rng::::sample_iter`. (#361) +- Deprecate `Rand`, `Sample` and `IndependentSample` traits. (#256) +- Add a `Standard` distribution (replaces most `Rand` implementations). (#256) +- Add `Binomial` and `Poisson` distributions. (#96) +- Add `Bernoulli` dsitribution. (#411) +- Add `Alphanumeric` distribution. (#279) +- Remove `Closed01` distribution, add `OpenClosed01`. (#274, #420) +- Rework `Range` type, making it possible to implement it for user types. (#274) +- Rename `Range` to `Uniform`. (#395) +- Add `Uniform::new_inclusive` for inclusive ranges. (#274) +- Use widening multiply method for much faster integer range reduction. (#274) +- `Standard` distribution for `char` uses `Uniform` internally. (#274) +- `Standard` distribution for `bool` uses sign test. (#274) +- Implement `Standard` distribution for `Wrapping`. (#436) +- Implement `Uniform` distribution for `Duration`. (#427) + + +## [0.4.3] - 2018-08-16 +### Fixed +- Use correct syscall number for PowerPC (#589) + + +## [0.4.2] - 2018-01-06 +### Changed +- Use `winapi` on Windows +- Update for Fuchsia OS +- Remove dev-dependency on `log` + + +## [0.4.1] - 2017-12-17 +### Added +- `no_std` support + + +## [0.4.0-pre.0] - 2017-12-11 +### Added +- `JitterRng` added as a high-quality alternative entropy source using the + system timer +- new `seq` module with `sample_iter`, `sample_slice`, etc. +- WASM support via dummy implementations (fail at run-time) +- Additional benchmarks, covering generators and new seq code + +### Changed +- `thread_rng` uses `JitterRng` if seeding from system time fails + (slower but more secure than previous method) + +### Deprecated + - `sample` function deprecated (replaced by `sample_iter`) + + +## [0.3.20] - 2018-01-06 +### Changed +- Remove dev-dependency on `log` +- Update `fuchsia-zircon` dependency to 0.3.2 + + +## [0.3.19] - 2017-12-27 +### Changed +- Require `log <= 0.3.8` for dev builds +- Update `fuchsia-zircon` dependency to 0.3 +- Fix broken links in docs (to unblock compiler docs testing CI) + + +## [0.3.18] - 2017-11-06 +### Changed +- `thread_rng` is seeded from the system time if `OsRng` fails +- `weak_rng` now uses `thread_rng` internally + + +## [0.3.17] - 2017-10-07 +### Changed + - Fuchsia: Magenta was renamed Zircon + +## [0.3.16] - 2017-07-27 +### Added +- Implement Debug for mote non-public types +- implement `Rand` for (i|u)i128 +- Support for Fuchsia + +### Changed +- Add inline attribute to SampleRange::construct_range. + This improves the benchmark for sample in 11% and for shuffle in 16%. +- Use `RtlGenRandom` instead of `CryptGenRandom` + + +## [0.3.15] - 2016-11-26 +### Added +- Add `Rng` trait method `choose_mut` +- Redox support + +### Changed +- Use `arc4rand` for `OsRng` on FreeBSD. +- Use `arc4random(3)` for `OsRng` on OpenBSD. + +### Fixed +- Fix filling buffers 4 GiB or larger with `OsRng::fill_bytes` on Windows + + +## [0.3.14] - 2016-02-13 +### Fixed +- Inline definitions from winapi/advapi32, wich decreases build times + + +## [0.3.13] - 2016-01-09 +### Fixed +- Compatible with Rust 1.7.0-nightly (needed some extra type annotations) + + +## [0.3.12] - 2015-11-09 +### Changed +- Replaced the methods in `next_f32` and `next_f64` with the technique described + Saito & Matsumoto at MCQMC'08. The new method should exhibit a slightly more + uniform distribution. +- Depend on libc 0.2 + +### Fixed +- Fix iterator protocol issue in `rand::sample` + + +## [0.3.11] - 2015-08-31 +### Added +- Implement `Rand` for arrays with n <= 32 + + +## [0.3.10] - 2015-08-17 +### Added +- Support for NaCl platforms + +### Changed +- Allow `Rng` to be `?Sized`, impl for `&mut R` and `Box` where `R: ?Sized + Rng` + + +## [0.3.9] - 2015-06-18 +### Changed +- Use `winapi` for Windows API things + +### Fixed +- Fixed test on stable/nightly +- Fix `getrandom` syscall number for aarch64-unknown-linux-gnu + + +## [0.3.8] - 2015-04-23 +### Changed +- `log` is a dev dependency + +### Fixed +- Fix race condition of atomics in `is_getrandom_available` + + +## [0.3.7] - 2015-04-03 +### Fixed +- Derive Copy/Clone changes + + +## [0.3.6] - 2015-04-02 +### Changed +- Move to stable Rust! + + +## [0.3.5] - 2015-04-01 +### Fixed +- Compatible with Rust master + + +## [0.3.4] - 2015-03-31 +### Added +- Implement Clone for `Weighted` + +### Fixed +- Compatible with Rust master + + +## [0.3.3] - 2015-03-26 +### Fixed +- Fix compile on Windows + + +## [0.3.2] - 2015-03-26 + + +## [0.3.1] - 2015-03-26 +### Fixed +- Fix compile on Windows + + +## [0.3.0] - 2015-03-25 +### Changed +- Update to use log version 0.3.x + + +## [0.2.1] - 2015-03-22 +### Fixed +- Compatible with Rust master +- Fixed iOS compilation + + +## [0.2.0] - 2015-03-06 +### Fixed +- Compatible with Rust master (move from `old_io` to `std::io`) + + +## [0.1.4] - 2015-03-04 +### Fixed +- Compatible with Rust master (use wrapping ops) + + +## [0.1.3] - 2015-02-20 +### Fixed +- Compatible with Rust master + +### Removed +- Removed Copy implementations from RNGs + + +## [0.1.2] - 2015-02-03 +### Added +- Imported functionality from `std::rand`, including: + - `StdRng`, `SeedableRng`, `TreadRng`, `weak_rng()` + - `ReaderRng`: A wrapper around any Reader to treat it as an RNG. +- Imported documentation from `std::rand` +- Imported tests from `std::rand` + + +## [0.1.1] - 2015-02-03 +### Added +- Migrate to a cargo-compatible directory structure. + +### Fixed +- Do not use entropy during `gen_weighted_bool(1)` + + +## [Rust 0.12.0] - 2014-10-09 +### Added +- Impl Rand for tuples of arity 11 and 12 +- Include ChaCha pseudorandom generator +- Add `next_f64` and `next_f32` to Rng +- Implement Clone for PRNGs + +### Changed +- Rename `TaskRng` to `ThreadRng` and `task_rng` to `thread_rng` (since a + runtime is removed from Rust). + +### Fixed +- Improved performance of ISAAC and ISAAC64 by 30% and 12 % respectively, by + informing the optimiser that indexing is never out-of-bounds. + +### Removed +- Removed the Deprecated `choose_option` + + +## [Rust 0.11.0] - 2014-07-02 +### Added +- document when to use `OSRng` in cryptographic context, and explain why we use `/dev/urandom` instead of `/dev/random` +- `Rng::gen_iter()` which will return an infinite stream of random values +- `Rng::gen_ascii_chars()` which will return an infinite stream of random ascii characters + +### Changed +- Now only depends on libcore! +- Remove `Rng.choose()`, rename `Rng.choose_option()` to `.choose()` +- Rename OSRng to OsRng +- The WeightedChoice structure is no longer built with a `Vec>`, + but rather a `&mut [Weighted]`. This means that the WeightedChoice + structure now has a lifetime associated with it. +- The `sample` method on `Rng` has been moved to a top-level function in the + `rand` module due to its dependence on `Vec`. + +### Removed +- `Rng::gen_vec()` was removed. Previous behavior can be regained with + `rng.gen_iter().take(n).collect()` +- `Rng::gen_ascii_str()` was removed. Previous behavior can be regained with + `rng.gen_ascii_chars().take(n).collect()` +- {IsaacRng, Isaac64Rng, XorShiftRng}::new() have all been removed. These all + relied on being able to use an OSRng for seeding, but this is no longer + available in librand (where these types are defined). To retain the same + functionality, these types now implement the `Rand` trait so they can be + generated with a random seed from another random number generator. This allows + the stdlib to use an OSRng to create seeded instances of these RNGs. +- Rand implementations for `Box` and `@T` were removed. These seemed to be + pretty rare in the codebase, and it allows for librand to not depend on + liballoc. Additionally, other pointer types like Rc and Arc were not + supported. +- Remove a slew of old deprecated functions + + +## [Rust 0.10] - 2014-04-03 +### Changed +- replace `Rng.shuffle's` functionality with `.shuffle_mut` +- bubble up IO errors when creating an OSRng + +### Fixed +- Use `fill()` instead of `read()` +- Rewrite OsRng in Rust for windows + +## [0.10-pre] - 2014-03-02 +### Added +- Seperate `rand` out of the standard library diff -Nru cargo-0.35.0/vendor/rand-0.6.5/COPYRIGHT cargo-0.37.0/vendor/rand-0.6.5/COPYRIGHT --- cargo-0.35.0/vendor/rand-0.6.5/COPYRIGHT 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/COPYRIGHT 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,12 @@ +Copyrights in the Rand project are retained by their contributors. No +copyright assignment is required to contribute to the Rand project. + +For full authorship information, see the version control history. + +Except as otherwise noted (below and/or in individual files), Rand is +licensed under the Apache License, Version 2.0 or + or the MIT license + or , at your option. + +The Rand project includes code from the Rust project +published under these same licenses. diff -Nru cargo-0.35.0/vendor/rand-0.6.5/examples/monte-carlo.rs cargo-0.37.0/vendor/rand-0.6.5/examples/monte-carlo.rs --- cargo-0.35.0/vendor/rand-0.6.5/examples/monte-carlo.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/examples/monte-carlo.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,51 @@ +// Copyright 2018 Developers of the Rand project. +// Copyright 2013-2018 The Rust Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! # Monte Carlo estimation of π +//! +//! Imagine that we have a square with sides of length 2 and a unit circle +//! (radius = 1), both centered at the origin. The areas are: +//! +//! ```text +//! area of circle = πr² = π * r * r = π +//! area of square = 2² = 4 +//! ``` +//! +//! The circle is entirely within the square, so if we sample many points +//! randomly from the square, roughly π / 4 of them should be inside the circle. +//! +//! We can use the above fact to estimate the value of π: pick many points in +//! the square at random, calculate the fraction that fall within the circle, +//! and multiply this fraction by 4. + +#![cfg(feature="std")] + + +extern crate rand; + +use rand::distributions::{Distribution, Uniform}; + +fn main() { + let range = Uniform::new(-1.0f64, 1.0); + let mut rng = rand::thread_rng(); + + let total = 1_000_000; + let mut in_circle = 0; + + for _ in 0..total { + let a = range.sample(&mut rng); + let b = range.sample(&mut rng); + if a*a + b*b <= 1.0 { + in_circle += 1; + } + } + + // prints something close to 3.14159... + println!("π is approximately {}", 4. * (in_circle as f64) / (total as f64)); +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/examples/monty-hall.rs cargo-0.37.0/vendor/rand-0.6.5/examples/monty-hall.rs --- cargo-0.35.0/vendor/rand-0.6.5/examples/monty-hall.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/examples/monty-hall.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,116 @@ +// Copyright 2018 Developers of the Rand project. +// Copyright 2013-2018 The Rust Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! ## Monty Hall Problem +//! +//! This is a simulation of the [Monty Hall Problem][]: +//! +//! > Suppose you're on a game show, and you're given the choice of three doors: +//! > Behind one door is a car; behind the others, goats. You pick a door, say +//! > No. 1, and the host, who knows what's behind the doors, opens another +//! > door, say No. 3, which has a goat. He then says to you, "Do you want to +//! > pick door No. 2?" Is it to your advantage to switch your choice? +//! +//! The rather unintuitive answer is that you will have a 2/3 chance of winning +//! if you switch and a 1/3 chance of winning if you don't, so it's better to +//! switch. +//! +//! This program will simulate the game show and with large enough simulation +//! steps it will indeed confirm that it is better to switch. +//! +//! [Monty Hall Problem]: https://en.wikipedia.org/wiki/Monty_Hall_problem + +#![cfg(feature="std")] + + +extern crate rand; + +use rand::Rng; +use rand::distributions::{Distribution, Uniform}; + +struct SimulationResult { + win: bool, + switch: bool, +} + +// Run a single simulation of the Monty Hall problem. +fn simulate(random_door: &Uniform, rng: &mut R) + -> SimulationResult { + let car = random_door.sample(rng); + + // This is our initial choice + let mut choice = random_door.sample(rng); + + // The game host opens a door + let open = game_host_open(car, choice, rng); + + // Shall we switch? + let switch = rng.gen(); + if switch { + choice = switch_door(choice, open); + } + + SimulationResult { win: choice == car, switch } +} + +// Returns the door the game host opens given our choice and knowledge of +// where the car is. The game host will never open the door with the car. +fn game_host_open(car: u32, choice: u32, rng: &mut R) -> u32 { + use rand::seq::SliceRandom; + *free_doors(&[car, choice]).choose(rng).unwrap() +} + +// Returns the door we switch to, given our current choice and +// the open door. There will only be one valid door. +fn switch_door(choice: u32, open: u32) -> u32 { + free_doors(&[choice, open])[0] +} + +fn free_doors(blocked: &[u32]) -> Vec { + (0..3).filter(|x| !blocked.contains(x)).collect() +} + +fn main() { + // The estimation will be more accurate with more simulations + let num_simulations = 10000; + + let mut rng = rand::thread_rng(); + let random_door = Uniform::new(0u32, 3); + + let (mut switch_wins, mut switch_losses) = (0, 0); + let (mut keep_wins, mut keep_losses) = (0, 0); + + println!("Running {} simulations...", num_simulations); + for _ in 0..num_simulations { + let result = simulate(&random_door, &mut rng); + + match (result.win, result.switch) { + (true, true) => switch_wins += 1, + (true, false) => keep_wins += 1, + (false, true) => switch_losses += 1, + (false, false) => keep_losses += 1, + } + } + + let total_switches = switch_wins + switch_losses; + let total_keeps = keep_wins + keep_losses; + + println!("Switched door {} times with {} wins and {} losses", + total_switches, switch_wins, switch_losses); + + println!("Kept our choice {} times with {} wins and {} losses", + total_keeps, keep_wins, keep_losses); + + // With a large number of simulations, the values should converge to + // 0.667 and 0.333 respectively. + println!("Estimated chance to win if we switch: {}", + switch_wins as f32 / total_switches as f32); + println!("Estimated chance to win if we don't: {}", + keep_wins as f32 / total_keeps as f32); +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/LICENSE-APACHE cargo-0.37.0/vendor/rand-0.6.5/LICENSE-APACHE --- cargo-0.35.0/vendor/rand-0.6.5/LICENSE-APACHE 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/LICENSE-APACHE 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor 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, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff -Nru cargo-0.35.0/vendor/rand-0.6.5/LICENSE-MIT cargo-0.37.0/vendor/rand-0.6.5/LICENSE-MIT --- cargo-0.35.0/vendor/rand-0.6.5/LICENSE-MIT 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/LICENSE-MIT 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,26 @@ +Copyright 2018 Developers of the Rand project +Copyright (c) 2014 The Rust Project Developers + +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 +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff -Nru cargo-0.35.0/vendor/rand-0.6.5/README.md cargo-0.37.0/vendor/rand-0.6.5/README.md --- cargo-0.35.0/vendor/rand-0.6.5/README.md 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,122 @@ +# Rand + +[![Build Status](https://travis-ci.org/rust-random/rand.svg?branch=master)](https://travis-ci.org/rust-random/rand) +[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-random/rand?svg=true)](https://ci.appveyor.com/project/rust-random/rand) +[![Crate](https://img.shields.io/crates/v/rand.svg)](https://crates.io/crates/rand) +[![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) +[![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand) +[![API](https://docs.rs/rand/badge.svg)](https://docs.rs/rand) +[![Minimum rustc version](https://img.shields.io/badge/rustc-1.22+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements) + +A Rust library for random number generation. + +Rand provides utilities to generate random numbers, to convert them to useful +types and distributions, and some randomness-related algorithms. + +The core random number generation traits of Rand live in the [rand_core]( +https://crates.io/crates/rand_core) crate but are also exposed here; RNG +implementations should prefer to use `rand_core` while most other users should +depend on `rand`. + +Documentation: +- [The Rust Rand Book](https://rust-random.github.io/book) +- [API reference (master)](https://rust-random.github.io/rand) +- [API reference (docs.rs)](https://docs.rs/rand) + + +## Usage + +Add this to your `Cargo.toml`: + +```toml +[dependencies] +rand = "0.6" +``` + +To get started using Rand, see [The Book](https://rust-random.github.io/book). + + +## Versions + +The Rand lib is not yet stable, however we are careful to limit breaking changes +and warn via deprecation wherever possible. Patch versions never introduce +breaking changes. The following minor versions are supported: + +- Version 0.6 was released in November 2018, redesigning the `seq` module, + moving most PRNGs to external crates, and many small changes. +- Version 0.5 was released in May 2018, as a major reorganisation + (introducing `RngCore` and `rand_core`, and deprecating `Rand` and the + previous distribution traits). +- Version 0.4 was released in December 2017, but contained almost no breaking + changes from the 0.3 series. + +A detailed [changelog](CHANGELOG.md) is available. + +When upgrading to the next minor series (especially 0.4 → 0.5), we recommend +reading the [Upgrade Guide](https://rust-random.github.io/book/update.html). + +### Rust version requirements + +Since version 0.5, Rand requires **Rustc version 1.22 or greater**. +Rand 0.4 and 0.3 (since approx. June 2017) require Rustc version 1.15 or +greater. Subsets of the Rand code may work with older Rust versions, but this +is not supported. + +Travis CI always has a build with a pinned version of Rustc matching the oldest +supported Rust release. The current policy is that this can be updated in any +Rand release if required, but the change must be noted in the changelog. + +To avoid bumping the required version unnecessarily, we use a `build.rs` script +to auto-detect the compiler version and enable certain features or change code +paths automatically. Since this makes it easy to unintentionally make use of +features requiring a more recent Rust version, we recommend testing with a +pinned version of Rustc if you require compatibility with a specific version. + +## Crate Features + +Rand is built with the `std` and `rand_os` features enabled by default: + +- `std` enables functionality dependent on the `std` lib and implies `alloc` + and `rand_os` +- `rand_os` enables the `rand_os` crate, `rngs::OsRng` and enables its usage; + the continued existance of this feature is not guaranteed so users are + encouraged to specify `std` instead + +The following optional features are available: + +- `alloc` can be used instead of `std` to provide `Vec` and `Box`. +- `log` enables some logging via the `log` crate. +- `nightly` enables all unstable features (`simd_support`). +- `serde1` enables serialization for some types, via Serde version 1. +- `simd_support` enables uniform sampling of SIMD types (integers and floats). +- `stdweb` enables support for `OsRng` on `wasm32-unknown-unknown` via `stdweb` + combined with `cargo-web`. +- `wasm-bindgen` enables support for `OsRng` on `wasm32-unknown-unknown` via + [`wasm-bindgen`] + +[`wasm-bindgen`]: https://github.com/rustwasm/wasm-bindgen + +`no_std` mode is activated by setting `default-features = false`; this removes +functionality depending on `std`: + +- `thread_rng()`, and `random()` are not available, as they require thread-local + storage and an entropy source. +- `OsRng` and `EntropyRng` are unavailable. +- `JitterRng` code is still present, but a nanosecond timer must be provided via + `JitterRng::new_with_timer` +- Since no external entropy is available, it is not possible to create + generators with fresh seeds using the `FromEntropy` trait (user must provide + a seed). +- Several non-linear distributions distributions are unavailable since `exp` + and `log` functions are not provided in `core`. +- Large parts of the `seq`-uence module are unavailable, unless the `alloc` + feature is used (several APIs and many implementations require `Vec`). + + +# License + +Rand is distributed under the terms of both the MIT license and the +Apache License (Version 2.0). + +See [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT), and +[COPYRIGHT](COPYRIGHT) for details. diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/deprecated.rs cargo-0.37.0/vendor/rand-0.6.5/src/deprecated.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/deprecated.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/deprecated.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,544 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Deprecated re-exports (we can't add deprecation warnings otherwise) + +#![allow(deprecated)] + +use rngs; +use {RngCore, CryptoRng, SeedableRng, Error}; +use rand_core::block::BlockRngCore; +use rand_isaac; +use rand_chacha; +use rand_hc; + +#[cfg(feature="std")] +use std::io::Read; + +#[derive(Clone, Debug)] +#[deprecated(since="0.6.0", + note="import from rand_isaac crate instead, or use the newer Hc128Rng")] +pub struct IsaacRng(rand_isaac::IsaacRng); + +impl RngCore for IsaacRng { + #[inline(always)] + fn next_u32(&mut self) -> u32 { + self.0.next_u32() + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + self.0.next_u64() + } + + #[inline(always)] + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.0.fill_bytes(dest); + } + + #[inline(always)] + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +impl SeedableRng for IsaacRng { + type Seed = ::Seed; + + fn from_seed(seed: Self::Seed) -> Self { + IsaacRng(rand_isaac::IsaacRng::from_seed(seed)) + } + + fn from_rng(rng: R) -> Result { + rand_isaac::IsaacRng::from_rng(rng).map(IsaacRng) + } +} + +impl IsaacRng { + pub fn new_from_u64(seed: u64) -> Self { + IsaacRng(rand_isaac::IsaacRng::new_from_u64(seed)) + } +} + + +#[derive(Clone, Debug)] +#[deprecated(since="0.6.0", + note="import from rand_isaac crate instead, or use newer Hc128Rng")] +pub struct Isaac64Rng(rand_isaac::Isaac64Rng); + +impl RngCore for Isaac64Rng { + #[inline(always)] + fn next_u32(&mut self) -> u32 { + self.0.next_u32() + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + self.0.next_u64() + } + + #[inline(always)] + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.0.fill_bytes(dest); + } + + #[inline(always)] + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +impl SeedableRng for Isaac64Rng { + type Seed = ::Seed; + + fn from_seed(seed: Self::Seed) -> Self { + Isaac64Rng(rand_isaac::Isaac64Rng::from_seed(seed)) + } + + fn from_rng(rng: R) -> Result { + rand_isaac::Isaac64Rng::from_rng(rng).map(Isaac64Rng) + } +} + +impl Isaac64Rng { + pub fn new_from_u64(seed: u64) -> Self { + Isaac64Rng(rand_isaac::Isaac64Rng::new_from_u64(seed)) + } +} + + +#[derive(Clone, Debug)] +#[deprecated(since="0.6.0", note="import from rand_chacha crate instead")] +pub struct ChaChaRng(rand_chacha::ChaChaRng); + +impl RngCore for ChaChaRng { + #[inline(always)] + fn next_u32(&mut self) -> u32 { + self.0.next_u32() + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + self.0.next_u64() + } + + #[inline(always)] + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.0.fill_bytes(dest); + } + + #[inline(always)] + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +impl SeedableRng for ChaChaRng { + type Seed = ::Seed; + + fn from_seed(seed: Self::Seed) -> Self { + ChaChaRng(rand_chacha::ChaChaRng::from_seed(seed)) + } + + fn from_rng(rng: R) -> Result { + rand_chacha::ChaChaRng::from_rng(rng).map(ChaChaRng) + } +} + +impl ChaChaRng { + #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] + pub fn get_word_pos(&self) -> u128 { + self.0.get_word_pos() + } + + #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] + pub fn set_word_pos(&mut self, word_offset: u128) { + self.0.set_word_pos(word_offset) + } + + pub fn set_stream(&mut self, stream: u64) { + self.0.set_stream(stream) + } +} + +impl CryptoRng for ChaChaRng {} + + +#[derive(Clone, Debug)] +#[deprecated(since="0.6.0", note="import from rand_hc crate instead")] +pub struct Hc128Rng(rand_hc::Hc128Rng); + +impl RngCore for Hc128Rng { + #[inline(always)] + fn next_u32(&mut self) -> u32 { + self.0.next_u32() + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + self.0.next_u64() + } + + #[inline(always)] + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.0.fill_bytes(dest); + } + + #[inline(always)] + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +impl SeedableRng for Hc128Rng { + type Seed = ::Seed; + + fn from_seed(seed: Self::Seed) -> Self { + Hc128Rng(rand_hc::Hc128Rng::from_seed(seed)) + } + + fn from_rng(rng: R) -> Result { + rand_hc::Hc128Rng::from_rng(rng).map(Hc128Rng) + } +} + +impl CryptoRng for Hc128Rng {} + + +#[derive(Clone, Debug)] +#[deprecated(since="0.6.0", note="import from rand_xorshift crate instead")] +pub struct XorShiftRng(::rand_xorshift::XorShiftRng); + +impl RngCore for XorShiftRng { + #[inline(always)] + fn next_u32(&mut self) -> u32 { + self.0.next_u32() + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + self.0.next_u64() + } + + #[inline(always)] + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.0.fill_bytes(dest); + } + + #[inline(always)] + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +impl SeedableRng for XorShiftRng { + type Seed = <::rand_xorshift::XorShiftRng as SeedableRng>::Seed; + + fn from_seed(seed: Self::Seed) -> Self { + XorShiftRng(::rand_xorshift::XorShiftRng::from_seed(seed)) + } + + fn from_rng(rng: R) -> Result { + ::rand_xorshift::XorShiftRng::from_rng(rng).map(XorShiftRng) + } +} + + +#[derive(Clone, Debug)] +#[deprecated(since="0.6.0", + note="import with rand::prelude::* or rand::rngs::StdRng instead")] +pub struct StdRng(rngs::StdRng); + +impl RngCore for StdRng { + #[inline(always)] + fn next_u32(&mut self) -> u32 { + self.0.next_u32() + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + self.0.next_u64() + } + + #[inline(always)] + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.0.fill_bytes(dest); + } + + #[inline(always)] + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +impl SeedableRng for StdRng { + type Seed = ::Seed; + + fn from_seed(seed: Self::Seed) -> Self { + StdRng(rngs::StdRng::from_seed(seed)) + } + + fn from_rng(rng: R) -> Result { + rngs::StdRng::from_rng(rng).map(StdRng) + } +} + +impl CryptoRng for StdRng {} + + +#[cfg(feature="rand_os")] +#[derive(Clone, Debug)] +#[deprecated(since="0.6.0", note="import with rand::rngs::OsRng instead")] +pub struct OsRng(rngs::OsRng); + +#[cfg(feature="rand_os")] +impl RngCore for OsRng { + #[inline(always)] + fn next_u32(&mut self) -> u32 { + self.0.next_u32() + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + self.0.next_u64() + } + + #[inline(always)] + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.0.fill_bytes(dest); + } + + #[inline(always)] + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +#[cfg(feature="rand_os")] +impl OsRng { + pub fn new() -> Result { + rngs::OsRng::new().map(OsRng) + } +} + +#[cfg(feature="rand_os")] +impl CryptoRng for OsRng {} + + +#[cfg(feature="std")] +#[derive(Debug)] +#[deprecated(since="0.6.0", note="import with rand::rngs::EntropyRng instead")] +pub struct EntropyRng(rngs::EntropyRng); + +#[cfg(feature="std")] +impl RngCore for EntropyRng { + #[inline(always)] + fn next_u32(&mut self) -> u32 { + self.0.next_u32() + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + self.0.next_u64() + } + + #[inline(always)] + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.0.fill_bytes(dest); + } + + #[inline(always)] + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +#[cfg(feature="std")] +impl EntropyRng { + pub fn new() -> Self { + EntropyRng(rngs::EntropyRng::new()) + } +} + +#[cfg(feature="std")] +impl Default for EntropyRng { + fn default() -> Self { + EntropyRng::new() + } +} + +#[cfg(feature="std")] +impl CryptoRng for EntropyRng {} + + +#[derive(Clone, Debug)] +#[deprecated(since="0.6.0", note="import with rand::rngs::JitterRng instead")] +pub struct JitterRng(rngs::JitterRng); + +impl RngCore for JitterRng { + #[inline(always)] + fn next_u32(&mut self) -> u32 { + self.0.next_u32() + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + self.0.next_u64() + } + + #[inline(always)] + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.0.fill_bytes(dest); + } + + #[inline(always)] + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +impl JitterRng { + #[cfg(all(feature="std", not(target_arch = "wasm32")))] + pub fn new() -> Result { + rngs::JitterRng::new().map(JitterRng) + } + + pub fn new_with_timer(timer: fn() -> u64) -> JitterRng { + JitterRng(rngs::JitterRng::new_with_timer(timer)) + } + + pub fn set_rounds(&mut self, rounds: u8) { + self.0.set_rounds(rounds) + } + + pub fn test_timer(&mut self) -> Result { + self.0.test_timer() + } + + #[cfg(feature="std")] + pub fn timer_stats(&mut self, var_rounds: bool) -> i64 { + self.0.timer_stats(var_rounds) + } +} + +impl CryptoRng for JitterRng {} + + +#[cfg(feature="std")] +#[derive(Clone, Debug)] +#[deprecated(since="0.6.0", + note="import with rand::prelude::* or rand::rngs::ThreadRng instead")] +pub struct ThreadRng(rngs::ThreadRng); + +#[cfg(feature="std")] +impl RngCore for ThreadRng { + #[inline(always)] + fn next_u32(&mut self) -> u32 { + self.0.next_u32() + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + self.0.next_u64() + } + + #[inline(always)] + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.0.fill_bytes(dest); + } + + #[inline(always)] + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +#[cfg(feature="std")] +impl CryptoRng for ThreadRng {} + + +#[cfg(feature="std")] +#[derive(Debug)] +#[deprecated(since="0.6.0", note="import with rand::rngs::adapter::ReadRng instead")] +pub struct ReadRng(rngs::adapter::ReadRng); + +#[cfg(feature="std")] +impl RngCore for ReadRng { + #[inline(always)] + fn next_u32(&mut self) -> u32 { + self.0.next_u32() + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + self.0.next_u64() + } + + #[inline(always)] + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.0.fill_bytes(dest); + } + + #[inline(always)] + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +#[cfg(feature="std")] +impl ReadRng { + pub fn new(r: R) -> ReadRng { + ReadRng(rngs::adapter::ReadRng::new(r)) + } +} + + +#[derive(Clone, Debug)] +pub struct ReseedingRng(rngs::adapter::ReseedingRng) +where R: BlockRngCore + SeedableRng, + Rsdr: RngCore; + +impl RngCore for ReseedingRng +where R: BlockRngCore + SeedableRng, + ::Results: AsRef<[u32]> + AsMut<[u32]> +{ + #[inline(always)] + fn next_u32(&mut self) -> u32 { + self.0.next_u32() + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + self.0.next_u64() + } + + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.0.fill_bytes(dest) + } + + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +impl ReseedingRng +where R: BlockRngCore + SeedableRng, + Rsdr: RngCore +{ + pub fn new(rng: R, threshold: u64, reseeder: Rsdr) -> Self { + ReseedingRng(rngs::adapter::ReseedingRng::new(rng, threshold, reseeder)) + } + + pub fn reseed(&mut self) -> Result<(), Error> { + self.0.reseed() + } +} + +impl CryptoRng for ReseedingRng +where R: BlockRngCore + SeedableRng + CryptoRng, + Rsdr: RngCore + CryptoRng {} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/bernoulli.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/bernoulli.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/bernoulli.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/bernoulli.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,165 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The Bernoulli distribution. + +use Rng; +use distributions::Distribution; + +/// The Bernoulli distribution. +/// +/// This is a special case of the Binomial distribution where `n = 1`. +/// +/// # Example +/// +/// ```rust +/// use rand::distributions::{Bernoulli, Distribution}; +/// +/// let d = Bernoulli::new(0.3); +/// let v = d.sample(&mut rand::thread_rng()); +/// println!("{} is from a Bernoulli distribution", v); +/// ``` +/// +/// # Precision +/// +/// This `Bernoulli` distribution uses 64 bits from the RNG (a `u64`), +/// so only probabilities that are multiples of 2-64 can be +/// represented. +#[derive(Clone, Copy, Debug)] +pub struct Bernoulli { + /// Probability of success, relative to the maximal integer. + p_int: u64, +} + +// To sample from the Bernoulli distribution we use a method that compares a +// random `u64` value `v < (p * 2^64)`. +// +// If `p == 1.0`, the integer `v` to compare against can not represented as a +// `u64`. We manually set it to `u64::MAX` instead (2^64 - 1 instead of 2^64). +// Note that value of `p < 1.0` can never result in `u64::MAX`, because an +// `f64` only has 53 bits of precision, and the next largest value of `p` will +// result in `2^64 - 2048`. +// +// Also there is a 100% theoretical concern: if someone consistenly wants to +// generate `true` using the Bernoulli distribution (i.e. by using a probability +// of `1.0`), just using `u64::MAX` is not enough. On average it would return +// false once every 2^64 iterations. Some people apparently care about this +// case. +// +// That is why we special-case `u64::MAX` to always return `true`, without using +// the RNG, and pay the performance price for all uses that *are* reasonable. +// Luckily, if `new()` and `sample` are close, the compiler can optimize out the +// extra check. +const ALWAYS_TRUE: u64 = ::core::u64::MAX; + +// This is just `2.0.powi(64)`, but written this way because it is not available +// in `no_std` mode. +const SCALE: f64 = 2.0 * (1u64 << 63) as f64; + +impl Bernoulli { + /// Construct a new `Bernoulli` with the given probability of success `p`. + /// + /// # Panics + /// + /// If `p < 0` or `p > 1`. + /// + /// # Precision + /// + /// For `p = 1.0`, the resulting distribution will always generate true. + /// For `p = 0.0`, the resulting distribution will always generate false. + /// + /// This method is accurate for any input `p` in the range `[0, 1]` which is + /// a multiple of 2-64. (Note that not all multiples of + /// 2-64 in `[0, 1]` can be represented as a `f64`.) + #[inline] + pub fn new(p: f64) -> Bernoulli { + if p < 0.0 || p >= 1.0 { + if p == 1.0 { return Bernoulli { p_int: ALWAYS_TRUE } } + panic!("Bernoulli::new not called with 0.0 <= p <= 1.0"); + } + Bernoulli { p_int: (p * SCALE) as u64 } + } + + /// Construct a new `Bernoulli` with the probability of success of + /// `numerator`-in-`denominator`. I.e. `new_ratio(2, 3)` will return + /// a `Bernoulli` with a 2-in-3 chance, or about 67%, of returning `true`. + /// + /// If `numerator == denominator` then the returned `Bernoulli` will always + /// return `true`. If `numerator == 0` it will always return `false`. + /// + /// # Panics + /// + /// If `denominator == 0` or `numerator > denominator`. + /// + #[inline] + pub fn from_ratio(numerator: u32, denominator: u32) -> Bernoulli { + assert!(numerator <= denominator); + if numerator == denominator { + return Bernoulli { p_int: ::core::u64::MAX } + } + let p_int = ((numerator as f64 / denominator as f64) * SCALE) as u64; + Bernoulli { p_int } + } +} + +impl Distribution for Bernoulli { + #[inline] + fn sample(&self, rng: &mut R) -> bool { + // Make sure to always return true for p = 1.0. + if self.p_int == ALWAYS_TRUE { return true; } + let v: u64 = rng.gen(); + v < self.p_int + } +} + +#[cfg(test)] +mod test { + use Rng; + use distributions::Distribution; + use super::Bernoulli; + + #[test] + fn test_trivial() { + let mut r = ::test::rng(1); + let always_false = Bernoulli::new(0.0); + let always_true = Bernoulli::new(1.0); + for _ in 0..5 { + assert_eq!(r.sample::(&always_false), false); + assert_eq!(r.sample::(&always_true), true); + assert_eq!(Distribution::::sample(&always_false, &mut r), false); + assert_eq!(Distribution::::sample(&always_true, &mut r), true); + } + } + + #[test] + fn test_average() { + const P: f64 = 0.3; + const NUM: u32 = 3; + const DENOM: u32 = 10; + let d1 = Bernoulli::new(P); + let d2 = Bernoulli::from_ratio(NUM, DENOM); + const N: u32 = 100_000; + + let mut sum1: u32 = 0; + let mut sum2: u32 = 0; + let mut rng = ::test::rng(2); + for _ in 0..N { + if d1.sample(&mut rng) { + sum1 += 1; + } + if d2.sample(&mut rng) { + sum2 += 1; + } + } + let avg1 = (sum1 as f64) / (N as f64); + assert!((avg1 - P).abs() < 5e-3); + + let avg2 = (sum2 as f64) / (N as f64); + assert!((avg2 - (NUM as f64)/(DENOM as f64)).abs() < 5e-3); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/binomial.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/binomial.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/binomial.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/binomial.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,177 @@ +// Copyright 2018 Developers of the Rand project. +// Copyright 2016-2017 The Rust Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The binomial distribution. + +use Rng; +use distributions::{Distribution, Bernoulli, Cauchy}; +use distributions::utils::log_gamma; + +/// The binomial distribution `Binomial(n, p)`. +/// +/// This distribution has density function: +/// `f(k) = n!/(k! (n-k)!) p^k (1-p)^(n-k)` for `k >= 0`. +/// +/// # Example +/// +/// ``` +/// use rand::distributions::{Binomial, Distribution}; +/// +/// let bin = Binomial::new(20, 0.3); +/// let v = bin.sample(&mut rand::thread_rng()); +/// println!("{} is from a binomial distribution", v); +/// ``` +#[derive(Clone, Copy, Debug)] +pub struct Binomial { + /// Number of trials. + n: u64, + /// Probability of success. + p: f64, +} + +impl Binomial { + /// Construct a new `Binomial` with the given shape parameters `n` (number + /// of trials) and `p` (probability of success). + /// + /// Panics if `p < 0` or `p > 1`. + pub fn new(n: u64, p: f64) -> Binomial { + assert!(p >= 0.0, "Binomial::new called with p < 0"); + assert!(p <= 1.0, "Binomial::new called with p > 1"); + Binomial { n, p } + } +} + +impl Distribution for Binomial { + fn sample(&self, rng: &mut R) -> u64 { + // Handle these values directly. + if self.p == 0.0 { + return 0; + } else if self.p == 1.0 { + return self.n; + } + + // For low n, it is faster to sample directly. For both methods, + // performance is independent of p. On Intel Haswell CPU this method + // appears to be faster for approx n < 300. + if self.n < 300 { + let mut result = 0; + let d = Bernoulli::new(self.p); + for _ in 0 .. self.n { + result += rng.sample(d) as u32; + } + return result as u64; + } + + // binomial distribution is symmetrical with respect to p -> 1-p, k -> n-k + // switch p so that it is less than 0.5 - this allows for lower expected values + // we will just invert the result at the end + let p = if self.p <= 0.5 { + self.p + } else { + 1.0 - self.p + }; + + // prepare some cached values + let float_n = self.n as f64; + let ln_fact_n = log_gamma(float_n + 1.0); + let pc = 1.0 - p; + let log_p = p.ln(); + let log_pc = pc.ln(); + let expected = self.n as f64 * p; + let sq = (expected * (2.0 * pc)).sqrt(); + + let mut lresult; + + // we use the Cauchy distribution as the comparison distribution + // f(x) ~ 1/(1+x^2) + let cauchy = Cauchy::new(0.0, 1.0); + loop { + let mut comp_dev: f64; + loop { + // draw from the Cauchy distribution + comp_dev = rng.sample(cauchy); + // shift the peak of the comparison ditribution + lresult = expected + sq * comp_dev; + // repeat the drawing until we are in the range of possible values + if lresult >= 0.0 && lresult < float_n + 1.0 { + break; + } + } + + // the result should be discrete + lresult = lresult.floor(); + + let log_binomial_dist = ln_fact_n - log_gamma(lresult+1.0) - + log_gamma(float_n - lresult + 1.0) + lresult*log_p + (float_n - lresult)*log_pc; + // this is the binomial probability divided by the comparison probability + // we will generate a uniform random value and if it is larger than this, + // we interpret it as a value falling out of the distribution and repeat + let comparison_coeff = (log_binomial_dist.exp() * sq) * (1.2 * (1.0 + comp_dev*comp_dev)); + + if comparison_coeff >= rng.gen() { + break; + } + } + + // invert the result for p < 0.5 + if p != self.p { + self.n - lresult as u64 + } else { + lresult as u64 + } + } +} + +#[cfg(test)] +mod test { + use Rng; + use distributions::Distribution; + use super::Binomial; + + fn test_binomial_mean_and_variance(n: u64, p: f64, rng: &mut R) { + let binomial = Binomial::new(n, p); + + let expected_mean = n as f64 * p; + let expected_variance = n as f64 * p * (1.0 - p); + + let mut results = [0.0; 1000]; + for i in results.iter_mut() { *i = binomial.sample(rng) as f64; } + + let mean = results.iter().sum::() / results.len() as f64; + assert!((mean as f64 - expected_mean).abs() < expected_mean / 50.0); + + let variance = + results.iter().map(|x| (x - mean) * (x - mean)).sum::() + / results.len() as f64; + assert!((variance - expected_variance).abs() < expected_variance / 10.0); + } + + #[test] + fn test_binomial() { + let mut rng = ::test::rng(351); + test_binomial_mean_and_variance(150, 0.1, &mut rng); + test_binomial_mean_and_variance(70, 0.6, &mut rng); + test_binomial_mean_and_variance(40, 0.5, &mut rng); + test_binomial_mean_and_variance(20, 0.7, &mut rng); + test_binomial_mean_and_variance(20, 0.5, &mut rng); + } + + #[test] + fn test_binomial_end_points() { + let mut rng = ::test::rng(352); + assert_eq!(rng.sample(Binomial::new(20, 0.0)), 0); + assert_eq!(rng.sample(Binomial::new(20, 1.0)), 20); + } + + #[test] + #[should_panic] + fn test_binomial_invalid_lambda_neg() { + Binomial::new(20, -10.0); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/cauchy.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/cauchy.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/cauchy.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/cauchy.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,115 @@ +// Copyright 2018 Developers of the Rand project. +// Copyright 2016-2017 The Rust Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The Cauchy distribution. + +use Rng; +use distributions::Distribution; +use std::f64::consts::PI; + +/// The Cauchy distribution `Cauchy(median, scale)`. +/// +/// This distribution has a density function: +/// `f(x) = 1 / (pi * scale * (1 + ((x - median) / scale)^2))` +/// +/// # Example +/// +/// ``` +/// use rand::distributions::{Cauchy, Distribution}; +/// +/// let cau = Cauchy::new(2.0, 5.0); +/// let v = cau.sample(&mut rand::thread_rng()); +/// println!("{} is from a Cauchy(2, 5) distribution", v); +/// ``` +#[derive(Clone, Copy, Debug)] +pub struct Cauchy { + median: f64, + scale: f64 +} + +impl Cauchy { + /// Construct a new `Cauchy` with the given shape parameters + /// `median` the peak location and `scale` the scale factor. + /// Panics if `scale <= 0`. + pub fn new(median: f64, scale: f64) -> Cauchy { + assert!(scale > 0.0, "Cauchy::new called with scale factor <= 0"); + Cauchy { + median, + scale + } + } +} + +impl Distribution for Cauchy { + fn sample(&self, rng: &mut R) -> f64 { + // sample from [0, 1) + let x = rng.gen::(); + // get standard cauchy random number + // note that π/2 is not exactly representable, even if x=0.5 the result is finite + let comp_dev = (PI * x).tan(); + // shift and scale according to parameters + let result = self.median + self.scale * comp_dev; + result + } +} + +#[cfg(test)] +mod test { + use distributions::Distribution; + use super::Cauchy; + + fn median(mut numbers: &mut [f64]) -> f64 { + sort(&mut numbers); + let mid = numbers.len() / 2; + numbers[mid] + } + + fn sort(numbers: &mut [f64]) { + numbers.sort_by(|a, b| a.partial_cmp(b).unwrap()); + } + + #[test] + fn test_cauchy_median() { + let cauchy = Cauchy::new(10.0, 5.0); + let mut rng = ::test::rng(123); + let mut numbers: [f64; 1000] = [0.0; 1000]; + for i in 0..1000 { + numbers[i] = cauchy.sample(&mut rng); + } + let median = median(&mut numbers); + println!("Cauchy median: {}", median); + assert!((median - 10.0).abs() < 0.5); // not 100% certain, but probable enough + } + + #[test] + fn test_cauchy_mean() { + let cauchy = Cauchy::new(10.0, 5.0); + let mut rng = ::test::rng(123); + let mut sum = 0.0; + for _ in 0..1000 { + sum += cauchy.sample(&mut rng); + } + let mean = sum / 1000.0; + println!("Cauchy mean: {}", mean); + // for a Cauchy distribution the mean should not converge + assert!((mean - 10.0).abs() > 0.5); // not 100% certain, but probable enough + } + + #[test] + #[should_panic] + fn test_cauchy_invalid_scale_zero() { + Cauchy::new(0.0, 0.0); + } + + #[test] + #[should_panic] + fn test_cauchy_invalid_scale_neg() { + Cauchy::new(0.0, -10.0); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/dirichlet.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/dirichlet.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/dirichlet.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/dirichlet.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,137 @@ +// Copyright 2018 Developers of the Rand project. +// Copyright 2013 The Rust Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The dirichlet distribution. + +use Rng; +use distributions::Distribution; +use distributions::gamma::Gamma; + +/// The dirichelet distribution `Dirichlet(alpha)`. +/// +/// The Dirichlet distribution is a family of continuous multivariate +/// probability distributions parameterized by a vector alpha of positive reals. +/// It is a multivariate generalization of the beta distribution. +/// +/// # Example +/// +/// ``` +/// use rand::prelude::*; +/// use rand::distributions::Dirichlet; +/// +/// let dirichlet = Dirichlet::new(vec![1.0, 2.0, 3.0]); +/// let samples = dirichlet.sample(&mut rand::thread_rng()); +/// println!("{:?} is from a Dirichlet([1.0, 2.0, 3.0]) distribution", samples); +/// ``` + +#[derive(Clone, Debug)] +pub struct Dirichlet { + /// Concentration parameters (alpha) + alpha: Vec, +} + +impl Dirichlet { + /// Construct a new `Dirichlet` with the given alpha parameter `alpha`. + /// + /// # Panics + /// - if `alpha.len() < 2` + /// + #[inline] + pub fn new>>(alpha: V) -> Dirichlet { + let a = alpha.into(); + assert!(a.len() > 1); + for i in 0..a.len() { + assert!(a[i] > 0.0); + } + + Dirichlet { alpha: a } + } + + /// Construct a new `Dirichlet` with the given shape parameter `alpha` and `size`. + /// + /// # Panics + /// - if `alpha <= 0.0` + /// - if `size < 2` + /// + #[inline] + pub fn new_with_param(alpha: f64, size: usize) -> Dirichlet { + assert!(alpha > 0.0); + assert!(size > 1); + Dirichlet { + alpha: vec![alpha; size], + } + } +} + +impl Distribution> for Dirichlet { + fn sample(&self, rng: &mut R) -> Vec { + let n = self.alpha.len(); + let mut samples = vec![0.0f64; n]; + let mut sum = 0.0f64; + + for i in 0..n { + let g = Gamma::new(self.alpha[i], 1.0); + samples[i] = g.sample(rng); + sum += samples[i]; + } + let invacc = 1.0 / sum; + for i in 0..n { + samples[i] *= invacc; + } + samples + } +} + +#[cfg(test)] +mod test { + use super::Dirichlet; + use distributions::Distribution; + + #[test] + fn test_dirichlet() { + let d = Dirichlet::new(vec![1.0, 2.0, 3.0]); + let mut rng = ::test::rng(221); + let samples = d.sample(&mut rng); + let _: Vec = samples + .into_iter() + .map(|x| { + assert!(x > 0.0); + x + }) + .collect(); + } + + #[test] + fn test_dirichlet_with_param() { + let alpha = 0.5f64; + let size = 2; + let d = Dirichlet::new_with_param(alpha, size); + let mut rng = ::test::rng(221); + let samples = d.sample(&mut rng); + let _: Vec = samples + .into_iter() + .map(|x| { + assert!(x > 0.0); + x + }) + .collect(); + } + + #[test] + #[should_panic] + fn test_dirichlet_invalid_length() { + Dirichlet::new_with_param(0.5f64, 1); + } + + #[test] + #[should_panic] + fn test_dirichlet_invalid_alpha() { + Dirichlet::new_with_param(0.0f64, 2); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/exponential.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/exponential.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/exponential.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/exponential.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,124 @@ +// Copyright 2018 Developers of the Rand project. +// Copyright 2013 The Rust Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The exponential distribution. + +use {Rng}; +use distributions::{ziggurat_tables, Distribution}; +use distributions::utils::ziggurat; + +/// Samples floating-point numbers according to the exponential distribution, +/// with rate parameter `λ = 1`. This is equivalent to `Exp::new(1.0)` or +/// sampling with `-rng.gen::().ln()`, but faster. +/// +/// See `Exp` for the general exponential distribution. +/// +/// Implemented via the ZIGNOR variant[^1] of the Ziggurat method. The exact +/// description in the paper was adjusted to use tables for the exponential +/// distribution rather than normal. +/// +/// [^1]: Jurgen A. Doornik (2005). [*An Improved Ziggurat Method to +/// Generate Normal Random Samples*]( +/// https://www.doornik.com/research/ziggurat.pdf). +/// Nuffield College, Oxford +/// +/// # Example +/// ``` +/// use rand::prelude::*; +/// use rand::distributions::Exp1; +/// +/// let val: f64 = SmallRng::from_entropy().sample(Exp1); +/// println!("{}", val); +/// ``` +#[derive(Clone, Copy, Debug)] +pub struct Exp1; + +// This could be done via `-rng.gen::().ln()` but that is slower. +impl Distribution for Exp1 { + #[inline] + fn sample(&self, rng: &mut R) -> f64 { + #[inline] + fn pdf(x: f64) -> f64 { + (-x).exp() + } + #[inline] + fn zero_case(rng: &mut R, _u: f64) -> f64 { + ziggurat_tables::ZIG_EXP_R - rng.gen::().ln() + } + + ziggurat(rng, false, + &ziggurat_tables::ZIG_EXP_X, + &ziggurat_tables::ZIG_EXP_F, + pdf, zero_case) + } +} + +/// The exponential distribution `Exp(lambda)`. +/// +/// This distribution has density function: `f(x) = lambda * exp(-lambda * x)` +/// for `x > 0`. +/// +/// Note that [`Exp1`][crate::distributions::Exp1] is an optimised implementation for `lambda = 1`. +/// +/// # Example +/// +/// ``` +/// use rand::distributions::{Exp, Distribution}; +/// +/// let exp = Exp::new(2.0); +/// let v = exp.sample(&mut rand::thread_rng()); +/// println!("{} is from a Exp(2) distribution", v); +/// ``` +#[derive(Clone, Copy, Debug)] +pub struct Exp { + /// `lambda` stored as `1/lambda`, since this is what we scale by. + lambda_inverse: f64 +} + +impl Exp { + /// Construct a new `Exp` with the given shape parameter + /// `lambda`. Panics if `lambda <= 0`. + #[inline] + pub fn new(lambda: f64) -> Exp { + assert!(lambda > 0.0, "Exp::new called with `lambda` <= 0"); + Exp { lambda_inverse: 1.0 / lambda } + } +} + +impl Distribution for Exp { + fn sample(&self, rng: &mut R) -> f64 { + let n: f64 = rng.sample(Exp1); + n * self.lambda_inverse + } +} + +#[cfg(test)] +mod test { + use distributions::Distribution; + use super::Exp; + + #[test] + fn test_exp() { + let exp = Exp::new(10.0); + let mut rng = ::test::rng(221); + for _ in 0..1000 { + assert!(exp.sample(&mut rng) >= 0.0); + } + } + #[test] + #[should_panic] + fn test_exp_invalid_lambda_zero() { + Exp::new(0.0); + } + #[test] + #[should_panic] + fn test_exp_invalid_lambda_neg() { + Exp::new(-10.0); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/float.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/float.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/float.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/float.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,259 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Basic floating-point number distributions + +use core::mem; +use Rng; +use distributions::{Distribution, Standard}; +use distributions::utils::FloatSIMDUtils; +#[cfg(feature="simd_support")] +use packed_simd::*; + +/// A distribution to sample floating point numbers uniformly in the half-open +/// interval `(0, 1]`, i.e. including 1 but not 0. +/// +/// All values that can be generated are of the form `n * ε/2`. For `f32` +/// the 23 most significant random bits of a `u32` are used and for `f64` the +/// 53 most significant bits of a `u64` are used. The conversion uses the +/// multiplicative method. +/// +/// See also: [`Standard`] which samples from `[0, 1)`, [`Open01`] +/// which samples from `(0, 1)` and [`Uniform`] which samples from arbitrary +/// ranges. +/// +/// # Example +/// ``` +/// use rand::{thread_rng, Rng}; +/// use rand::distributions::OpenClosed01; +/// +/// let val: f32 = thread_rng().sample(OpenClosed01); +/// println!("f32 from (0, 1): {}", val); +/// ``` +/// +/// [`Standard`]: crate::distributions::Standard +/// [`Open01`]: crate::distributions::Open01 +/// [`Uniform`]: crate::distributions::uniform::Uniform +#[derive(Clone, Copy, Debug)] +pub struct OpenClosed01; + +/// A distribution to sample floating point numbers uniformly in the open +/// interval `(0, 1)`, i.e. not including either endpoint. +/// +/// All values that can be generated are of the form `n * ε + ε/2`. For `f32` +/// the 22 most significant random bits of an `u32` are used, for `f64` 52 from +/// an `u64`. The conversion uses a transmute-based method. +/// +/// See also: [`Standard`] which samples from `[0, 1)`, [`OpenClosed01`] +/// which samples from `(0, 1]` and [`Uniform`] which samples from arbitrary +/// ranges. +/// +/// # Example +/// ``` +/// use rand::{thread_rng, Rng}; +/// use rand::distributions::Open01; +/// +/// let val: f32 = thread_rng().sample(Open01); +/// println!("f32 from (0, 1): {}", val); +/// ``` +/// +/// [`Standard`]: crate::distributions::Standard +/// [`OpenClosed01`]: crate::distributions::OpenClosed01 +/// [`Uniform`]: crate::distributions::uniform::Uniform +#[derive(Clone, Copy, Debug)] +pub struct Open01; + + +pub(crate) trait IntoFloat { + type F; + + /// Helper method to combine the fraction and a contant exponent into a + /// float. + /// + /// Only the least significant bits of `self` may be set, 23 for `f32` and + /// 52 for `f64`. + /// The resulting value will fall in a range that depends on the exponent. + /// As an example the range with exponent 0 will be + /// [20..21), which is [1..2). + fn into_float_with_exponent(self, exponent: i32) -> Self::F; +} + +macro_rules! float_impls { + ($ty:ident, $uty:ident, $f_scalar:ident, $u_scalar:ty, + $fraction_bits:expr, $exponent_bias:expr) => { + impl IntoFloat for $uty { + type F = $ty; + #[inline(always)] + fn into_float_with_exponent(self, exponent: i32) -> $ty { + // The exponent is encoded using an offset-binary representation + let exponent_bits: $u_scalar = + (($exponent_bias + exponent) as $u_scalar) << $fraction_bits; + // TODO: use from_bits when min compiler > 1.25 (see #545) + // $ty::from_bits(self | exponent_bits) + unsafe{ mem::transmute(self | exponent_bits) } + } + } + + impl Distribution<$ty> for Standard { + fn sample(&self, rng: &mut R) -> $ty { + // Multiply-based method; 24/53 random bits; [0, 1) interval. + // We use the most significant bits because for simple RNGs + // those are usually more random. + let float_size = mem::size_of::<$f_scalar>() as u32 * 8; + let precision = $fraction_bits + 1; + let scale = 1.0 / ((1 as $u_scalar << precision) as $f_scalar); + + let value: $uty = rng.gen(); + let value = value >> (float_size - precision); + scale * $ty::cast_from_int(value) + } + } + + impl Distribution<$ty> for OpenClosed01 { + fn sample(&self, rng: &mut R) -> $ty { + // Multiply-based method; 24/53 random bits; (0, 1] interval. + // We use the most significant bits because for simple RNGs + // those are usually more random. + let float_size = mem::size_of::<$f_scalar>() as u32 * 8; + let precision = $fraction_bits + 1; + let scale = 1.0 / ((1 as $u_scalar << precision) as $f_scalar); + + let value: $uty = rng.gen(); + let value = value >> (float_size - precision); + // Add 1 to shift up; will not overflow because of right-shift: + scale * $ty::cast_from_int(value + 1) + } + } + + impl Distribution<$ty> for Open01 { + fn sample(&self, rng: &mut R) -> $ty { + // Transmute-based method; 23/52 random bits; (0, 1) interval. + // We use the most significant bits because for simple RNGs + // those are usually more random. + use core::$f_scalar::EPSILON; + let float_size = mem::size_of::<$f_scalar>() as u32 * 8; + + let value: $uty = rng.gen(); + let fraction = value >> (float_size - $fraction_bits); + fraction.into_float_with_exponent(0) - (1.0 - EPSILON / 2.0) + } + } + } +} + +float_impls! { f32, u32, f32, u32, 23, 127 } +float_impls! { f64, u64, f64, u64, 52, 1023 } + +#[cfg(feature="simd_support")] +float_impls! { f32x2, u32x2, f32, u32, 23, 127 } +#[cfg(feature="simd_support")] +float_impls! { f32x4, u32x4, f32, u32, 23, 127 } +#[cfg(feature="simd_support")] +float_impls! { f32x8, u32x8, f32, u32, 23, 127 } +#[cfg(feature="simd_support")] +float_impls! { f32x16, u32x16, f32, u32, 23, 127 } + +#[cfg(feature="simd_support")] +float_impls! { f64x2, u64x2, f64, u64, 52, 1023 } +#[cfg(feature="simd_support")] +float_impls! { f64x4, u64x4, f64, u64, 52, 1023 } +#[cfg(feature="simd_support")] +float_impls! { f64x8, u64x8, f64, u64, 52, 1023 } + + +#[cfg(test)] +mod tests { + use Rng; + use distributions::{Open01, OpenClosed01}; + use rngs::mock::StepRng; + #[cfg(feature="simd_support")] + use packed_simd::*; + + const EPSILON32: f32 = ::core::f32::EPSILON; + const EPSILON64: f64 = ::core::f64::EPSILON; + + macro_rules! test_f32 { + ($fnn:ident, $ty:ident, $ZERO:expr, $EPSILON:expr) => { + #[test] + fn $fnn() { + // Standard + let mut zeros = StepRng::new(0, 0); + assert_eq!(zeros.gen::<$ty>(), $ZERO); + let mut one = StepRng::new(1 << 8 | 1 << (8 + 32), 0); + assert_eq!(one.gen::<$ty>(), $EPSILON / 2.0); + let mut max = StepRng::new(!0, 0); + assert_eq!(max.gen::<$ty>(), 1.0 - $EPSILON / 2.0); + + // OpenClosed01 + let mut zeros = StepRng::new(0, 0); + assert_eq!(zeros.sample::<$ty, _>(OpenClosed01), + 0.0 + $EPSILON / 2.0); + let mut one = StepRng::new(1 << 8 | 1 << (8 + 32), 0); + assert_eq!(one.sample::<$ty, _>(OpenClosed01), $EPSILON); + let mut max = StepRng::new(!0, 0); + assert_eq!(max.sample::<$ty, _>(OpenClosed01), $ZERO + 1.0); + + // Open01 + let mut zeros = StepRng::new(0, 0); + assert_eq!(zeros.sample::<$ty, _>(Open01), 0.0 + $EPSILON / 2.0); + let mut one = StepRng::new(1 << 9 | 1 << (9 + 32), 0); + assert_eq!(one.sample::<$ty, _>(Open01), $EPSILON / 2.0 * 3.0); + let mut max = StepRng::new(!0, 0); + assert_eq!(max.sample::<$ty, _>(Open01), 1.0 - $EPSILON / 2.0); + } + } + } + test_f32! { f32_edge_cases, f32, 0.0, EPSILON32 } + #[cfg(feature="simd_support")] + test_f32! { f32x2_edge_cases, f32x2, f32x2::splat(0.0), f32x2::splat(EPSILON32) } + #[cfg(feature="simd_support")] + test_f32! { f32x4_edge_cases, f32x4, f32x4::splat(0.0), f32x4::splat(EPSILON32) } + #[cfg(feature="simd_support")] + test_f32! { f32x8_edge_cases, f32x8, f32x8::splat(0.0), f32x8::splat(EPSILON32) } + #[cfg(feature="simd_support")] + test_f32! { f32x16_edge_cases, f32x16, f32x16::splat(0.0), f32x16::splat(EPSILON32) } + + macro_rules! test_f64 { + ($fnn:ident, $ty:ident, $ZERO:expr, $EPSILON:expr) => { + #[test] + fn $fnn() { + // Standard + let mut zeros = StepRng::new(0, 0); + assert_eq!(zeros.gen::<$ty>(), $ZERO); + let mut one = StepRng::new(1 << 11, 0); + assert_eq!(one.gen::<$ty>(), $EPSILON / 2.0); + let mut max = StepRng::new(!0, 0); + assert_eq!(max.gen::<$ty>(), 1.0 - $EPSILON / 2.0); + + // OpenClosed01 + let mut zeros = StepRng::new(0, 0); + assert_eq!(zeros.sample::<$ty, _>(OpenClosed01), + 0.0 + $EPSILON / 2.0); + let mut one = StepRng::new(1 << 11, 0); + assert_eq!(one.sample::<$ty, _>(OpenClosed01), $EPSILON); + let mut max = StepRng::new(!0, 0); + assert_eq!(max.sample::<$ty, _>(OpenClosed01), $ZERO + 1.0); + + // Open01 + let mut zeros = StepRng::new(0, 0); + assert_eq!(zeros.sample::<$ty, _>(Open01), 0.0 + $EPSILON / 2.0); + let mut one = StepRng::new(1 << 12, 0); + assert_eq!(one.sample::<$ty, _>(Open01), $EPSILON / 2.0 * 3.0); + let mut max = StepRng::new(!0, 0); + assert_eq!(max.sample::<$ty, _>(Open01), 1.0 - $EPSILON / 2.0); + } + } + } + test_f64! { f64_edge_cases, f64, 0.0, EPSILON64 } + #[cfg(feature="simd_support")] + test_f64! { f64x2_edge_cases, f64x2, f64x2::splat(0.0), f64x2::splat(EPSILON64) } + #[cfg(feature="simd_support")] + test_f64! { f64x4_edge_cases, f64x4, f64x4::splat(0.0), f64x4::splat(EPSILON64) } + #[cfg(feature="simd_support")] + test_f64! { f64x8_edge_cases, f64x8, f64x8::splat(0.0), f64x8::splat(EPSILON64) } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/gamma.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/gamma.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/gamma.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/gamma.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,413 @@ +// Copyright 2018 Developers of the Rand project. +// Copyright 2013 The Rust Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The Gamma and derived distributions. + +use self::GammaRepr::*; +use self::ChiSquaredRepr::*; + +use Rng; +use distributions::normal::StandardNormal; +use distributions::{Distribution, Exp, Open01}; + +/// The Gamma distribution `Gamma(shape, scale)` distribution. +/// +/// The density function of this distribution is +/// +/// ```text +/// f(x) = x^(k - 1) * exp(-x / θ) / (Γ(k) * θ^k) +/// ``` +/// +/// where `Γ` is the Gamma function, `k` is the shape and `θ` is the +/// scale and both `k` and `θ` are strictly positive. +/// +/// The algorithm used is that described by Marsaglia & Tsang 2000[^1], +/// falling back to directly sampling from an Exponential for `shape +/// == 1`, and using the boosting technique described in that paper for +/// `shape < 1`. +/// +/// # Example +/// +/// ``` +/// use rand::distributions::{Distribution, Gamma}; +/// +/// let gamma = Gamma::new(2.0, 5.0); +/// let v = gamma.sample(&mut rand::thread_rng()); +/// println!("{} is from a Gamma(2, 5) distribution", v); +/// ``` +/// +/// [^1]: George Marsaglia and Wai Wan Tsang. 2000. "A Simple Method for +/// Generating Gamma Variables" *ACM Trans. Math. Softw.* 26, 3 +/// (September 2000), 363-372. +/// DOI:[10.1145/358407.358414](https://doi.acm.org/10.1145/358407.358414) +#[derive(Clone, Copy, Debug)] +pub struct Gamma { + repr: GammaRepr, +} + +#[derive(Clone, Copy, Debug)] +enum GammaRepr { + Large(GammaLargeShape), + One(Exp), + Small(GammaSmallShape) +} + +// These two helpers could be made public, but saving the +// match-on-Gamma-enum branch from using them directly (e.g. if one +// knows that the shape is always > 1) doesn't appear to be much +// faster. + +/// Gamma distribution where the shape parameter is less than 1. +/// +/// Note, samples from this require a compulsory floating-point `pow` +/// call, which makes it significantly slower than sampling from a +/// gamma distribution where the shape parameter is greater than or +/// equal to 1. +/// +/// See `Gamma` for sampling from a Gamma distribution with general +/// shape parameters. +#[derive(Clone, Copy, Debug)] +struct GammaSmallShape { + inv_shape: f64, + large_shape: GammaLargeShape +} + +/// Gamma distribution where the shape parameter is larger than 1. +/// +/// See `Gamma` for sampling from a Gamma distribution with general +/// shape parameters. +#[derive(Clone, Copy, Debug)] +struct GammaLargeShape { + scale: f64, + c: f64, + d: f64 +} + +impl Gamma { + /// Construct an object representing the `Gamma(shape, scale)` + /// distribution. + /// + /// Panics if `shape <= 0` or `scale <= 0`. + #[inline] + pub fn new(shape: f64, scale: f64) -> Gamma { + assert!(shape > 0.0, "Gamma::new called with shape <= 0"); + assert!(scale > 0.0, "Gamma::new called with scale <= 0"); + + let repr = if shape == 1.0 { + One(Exp::new(1.0 / scale)) + } else if shape < 1.0 { + Small(GammaSmallShape::new_raw(shape, scale)) + } else { + Large(GammaLargeShape::new_raw(shape, scale)) + }; + Gamma { repr } + } +} + +impl GammaSmallShape { + fn new_raw(shape: f64, scale: f64) -> GammaSmallShape { + GammaSmallShape { + inv_shape: 1. / shape, + large_shape: GammaLargeShape::new_raw(shape + 1.0, scale) + } + } +} + +impl GammaLargeShape { + fn new_raw(shape: f64, scale: f64) -> GammaLargeShape { + let d = shape - 1. / 3.; + GammaLargeShape { + scale, + c: 1. / (9. * d).sqrt(), + d + } + } +} + +impl Distribution for Gamma { + fn sample(&self, rng: &mut R) -> f64 { + match self.repr { + Small(ref g) => g.sample(rng), + One(ref g) => g.sample(rng), + Large(ref g) => g.sample(rng), + } + } +} +impl Distribution for GammaSmallShape { + fn sample(&self, rng: &mut R) -> f64 { + let u: f64 = rng.sample(Open01); + + self.large_shape.sample(rng) * u.powf(self.inv_shape) + } +} +impl Distribution for GammaLargeShape { + fn sample(&self, rng: &mut R) -> f64 { + loop { + let x = rng.sample(StandardNormal); + let v_cbrt = 1.0 + self.c * x; + if v_cbrt <= 0.0 { // a^3 <= 0 iff a <= 0 + continue + } + + let v = v_cbrt * v_cbrt * v_cbrt; + let u: f64 = rng.sample(Open01); + + let x_sqr = x * x; + if u < 1.0 - 0.0331 * x_sqr * x_sqr || + u.ln() < 0.5 * x_sqr + self.d * (1.0 - v + v.ln()) { + return self.d * v * self.scale + } + } + } +} + +/// The chi-squared distribution `χ²(k)`, where `k` is the degrees of +/// freedom. +/// +/// For `k > 0` integral, this distribution is the sum of the squares +/// of `k` independent standard normal random variables. For other +/// `k`, this uses the equivalent characterisation +/// `χ²(k) = Gamma(k/2, 2)`. +/// +/// # Example +/// +/// ``` +/// use rand::distributions::{ChiSquared, Distribution}; +/// +/// let chi = ChiSquared::new(11.0); +/// let v = chi.sample(&mut rand::thread_rng()); +/// println!("{} is from a χ²(11) distribution", v) +/// ``` +#[derive(Clone, Copy, Debug)] +pub struct ChiSquared { + repr: ChiSquaredRepr, +} + +#[derive(Clone, Copy, Debug)] +enum ChiSquaredRepr { + // k == 1, Gamma(alpha, ..) is particularly slow for alpha < 1, + // e.g. when alpha = 1/2 as it would be for this case, so special- + // casing and using the definition of N(0,1)^2 is faster. + DoFExactlyOne, + DoFAnythingElse(Gamma), +} + +impl ChiSquared { + /// Create a new chi-squared distribution with degrees-of-freedom + /// `k`. Panics if `k < 0`. + pub fn new(k: f64) -> ChiSquared { + let repr = if k == 1.0 { + DoFExactlyOne + } else { + assert!(k > 0.0, "ChiSquared::new called with `k` < 0"); + DoFAnythingElse(Gamma::new(0.5 * k, 2.0)) + }; + ChiSquared { repr } + } +} +impl Distribution for ChiSquared { + fn sample(&self, rng: &mut R) -> f64 { + match self.repr { + DoFExactlyOne => { + // k == 1 => N(0,1)^2 + let norm = rng.sample(StandardNormal); + norm * norm + } + DoFAnythingElse(ref g) => g.sample(rng) + } + } +} + +/// The Fisher F distribution `F(m, n)`. +/// +/// This distribution is equivalent to the ratio of two normalised +/// chi-squared distributions, that is, `F(m,n) = (χ²(m)/m) / +/// (χ²(n)/n)`. +/// +/// # Example +/// +/// ``` +/// use rand::distributions::{FisherF, Distribution}; +/// +/// let f = FisherF::new(2.0, 32.0); +/// let v = f.sample(&mut rand::thread_rng()); +/// println!("{} is from an F(2, 32) distribution", v) +/// ``` +#[derive(Clone, Copy, Debug)] +pub struct FisherF { + numer: ChiSquared, + denom: ChiSquared, + // denom_dof / numer_dof so that this can just be a straight + // multiplication, rather than a division. + dof_ratio: f64, +} + +impl FisherF { + /// Create a new `FisherF` distribution, with the given + /// parameter. Panics if either `m` or `n` are not positive. + pub fn new(m: f64, n: f64) -> FisherF { + assert!(m > 0.0, "FisherF::new called with `m < 0`"); + assert!(n > 0.0, "FisherF::new called with `n < 0`"); + + FisherF { + numer: ChiSquared::new(m), + denom: ChiSquared::new(n), + dof_ratio: n / m + } + } +} +impl Distribution for FisherF { + fn sample(&self, rng: &mut R) -> f64 { + self.numer.sample(rng) / self.denom.sample(rng) * self.dof_ratio + } +} + +/// The Student t distribution, `t(nu)`, where `nu` is the degrees of +/// freedom. +/// +/// # Example +/// +/// ``` +/// use rand::distributions::{StudentT, Distribution}; +/// +/// let t = StudentT::new(11.0); +/// let v = t.sample(&mut rand::thread_rng()); +/// println!("{} is from a t(11) distribution", v) +/// ``` +#[derive(Clone, Copy, Debug)] +pub struct StudentT { + chi: ChiSquared, + dof: f64 +} + +impl StudentT { + /// Create a new Student t distribution with `n` degrees of + /// freedom. Panics if `n <= 0`. + pub fn new(n: f64) -> StudentT { + assert!(n > 0.0, "StudentT::new called with `n <= 0`"); + StudentT { + chi: ChiSquared::new(n), + dof: n + } + } +} +impl Distribution for StudentT { + fn sample(&self, rng: &mut R) -> f64 { + let norm = rng.sample(StandardNormal); + norm * (self.dof / self.chi.sample(rng)).sqrt() + } +} + +/// The Beta distribution with shape parameters `alpha` and `beta`. +/// +/// # Example +/// +/// ``` +/// use rand::distributions::{Distribution, Beta}; +/// +/// let beta = Beta::new(2.0, 5.0); +/// let v = beta.sample(&mut rand::thread_rng()); +/// println!("{} is from a Beta(2, 5) distribution", v); +/// ``` +#[derive(Clone, Copy, Debug)] +pub struct Beta { + gamma_a: Gamma, + gamma_b: Gamma, +} + +impl Beta { + /// Construct an object representing the `Beta(alpha, beta)` + /// distribution. + /// + /// Panics if `shape <= 0` or `scale <= 0`. + pub fn new(alpha: f64, beta: f64) -> Beta { + assert!((alpha > 0.) & (beta > 0.)); + Beta { + gamma_a: Gamma::new(alpha, 1.), + gamma_b: Gamma::new(beta, 1.), + } + } +} + +impl Distribution for Beta { + fn sample(&self, rng: &mut R) -> f64 { + let x = self.gamma_a.sample(rng); + let y = self.gamma_b.sample(rng); + x / (x + y) + } +} + +#[cfg(test)] +mod test { + use distributions::Distribution; + use super::{Beta, ChiSquared, StudentT, FisherF}; + + #[test] + fn test_chi_squared_one() { + let chi = ChiSquared::new(1.0); + let mut rng = ::test::rng(201); + for _ in 0..1000 { + chi.sample(&mut rng); + } + } + #[test] + fn test_chi_squared_small() { + let chi = ChiSquared::new(0.5); + let mut rng = ::test::rng(202); + for _ in 0..1000 { + chi.sample(&mut rng); + } + } + #[test] + fn test_chi_squared_large() { + let chi = ChiSquared::new(30.0); + let mut rng = ::test::rng(203); + for _ in 0..1000 { + chi.sample(&mut rng); + } + } + #[test] + #[should_panic] + fn test_chi_squared_invalid_dof() { + ChiSquared::new(-1.0); + } + + #[test] + fn test_f() { + let f = FisherF::new(2.0, 32.0); + let mut rng = ::test::rng(204); + for _ in 0..1000 { + f.sample(&mut rng); + } + } + + #[test] + fn test_t() { + let t = StudentT::new(11.0); + let mut rng = ::test::rng(205); + for _ in 0..1000 { + t.sample(&mut rng); + } + } + + #[test] + fn test_beta() { + let beta = Beta::new(1.0, 2.0); + let mut rng = ::test::rng(201); + for _ in 0..1000 { + beta.sample(&mut rng); + } + } + + #[test] + #[should_panic] + fn test_beta_invalid_dof() { + Beta::new(0., 0.); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/integer.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/integer.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/integer.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/integer.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,161 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The implementations of the `Standard` distribution for integer types. + +use {Rng}; +use distributions::{Distribution, Standard}; +#[cfg(feature="simd_support")] +use packed_simd::*; +#[cfg(all(target_arch = "x86", feature="nightly"))] +use core::arch::x86::*; +#[cfg(all(target_arch = "x86_64", feature="nightly"))] +use core::arch::x86_64::*; + +impl Distribution for Standard { + #[inline] + fn sample(&self, rng: &mut R) -> u8 { + rng.next_u32() as u8 + } +} + +impl Distribution for Standard { + #[inline] + fn sample(&self, rng: &mut R) -> u16 { + rng.next_u32() as u16 + } +} + +impl Distribution for Standard { + #[inline] + fn sample(&self, rng: &mut R) -> u32 { + rng.next_u32() + } +} + +impl Distribution for Standard { + #[inline] + fn sample(&self, rng: &mut R) -> u64 { + rng.next_u64() + } +} + +#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] +impl Distribution for Standard { + #[inline] + fn sample(&self, rng: &mut R) -> u128 { + // Use LE; we explicitly generate one value before the next. + let x = rng.next_u64() as u128; + let y = rng.next_u64() as u128; + (y << 64) | x + } +} + +impl Distribution for Standard { + #[inline] + #[cfg(any(target_pointer_width = "32", target_pointer_width = "16"))] + fn sample(&self, rng: &mut R) -> usize { + rng.next_u32() as usize + } + + #[inline] + #[cfg(target_pointer_width = "64")] + fn sample(&self, rng: &mut R) -> usize { + rng.next_u64() as usize + } +} + +macro_rules! impl_int_from_uint { + ($ty:ty, $uty:ty) => { + impl Distribution<$ty> for Standard { + #[inline] + fn sample(&self, rng: &mut R) -> $ty { + rng.gen::<$uty>() as $ty + } + } + } +} + +impl_int_from_uint! { i8, u8 } +impl_int_from_uint! { i16, u16 } +impl_int_from_uint! { i32, u32 } +impl_int_from_uint! { i64, u64 } +#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] impl_int_from_uint! { i128, u128 } +impl_int_from_uint! { isize, usize } + +#[cfg(feature="simd_support")] +macro_rules! simd_impl { + ($(($intrinsic:ident, $vec:ty),)+) => {$( + impl Distribution<$intrinsic> for Standard { + #[inline] + fn sample(&self, rng: &mut R) -> $intrinsic { + $intrinsic::from_bits(rng.gen::<$vec>()) + } + } + )+}; + + ($bits:expr,) => {}; + ($bits:expr, $ty:ty, $($ty_more:ty,)*) => { + simd_impl!($bits, $($ty_more,)*); + + impl Distribution<$ty> for Standard { + #[inline] + fn sample(&self, rng: &mut R) -> $ty { + let mut vec: $ty = Default::default(); + unsafe { + let ptr = &mut vec; + let b_ptr = &mut *(ptr as *mut $ty as *mut [u8; $bits/8]); + rng.fill_bytes(b_ptr); + } + vec.to_le() + } + } + }; +} + +#[cfg(feature="simd_support")] +simd_impl!(16, u8x2, i8x2,); +#[cfg(feature="simd_support")] +simd_impl!(32, u8x4, i8x4, u16x2, i16x2,); +#[cfg(feature="simd_support")] +simd_impl!(64, u8x8, i8x8, u16x4, i16x4, u32x2, i32x2,); +#[cfg(feature="simd_support")] +simd_impl!(128, u8x16, i8x16, u16x8, i16x8, u32x4, i32x4, u64x2, i64x2,); +#[cfg(feature="simd_support")] +simd_impl!(256, u8x32, i8x32, u16x16, i16x16, u32x8, i32x8, u64x4, i64x4,); +#[cfg(feature="simd_support")] +simd_impl!(512, u8x64, i8x64, u16x32, i16x32, u32x16, i32x16, u64x8, i64x8,); +#[cfg(all(feature="simd_support", feature="nightly", any(target_arch="x86", target_arch="x86_64")))] +simd_impl!((__m64, u8x8), (__m128i, u8x16), (__m256i, u8x32),); + +#[cfg(test)] +mod tests { + use Rng; + use distributions::{Standard}; + + #[test] + fn test_integers() { + let mut rng = ::test::rng(806); + + rng.sample::(Standard); + rng.sample::(Standard); + rng.sample::(Standard); + rng.sample::(Standard); + rng.sample::(Standard); + #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] + rng.sample::(Standard); + + rng.sample::(Standard); + rng.sample::(Standard); + rng.sample::(Standard); + rng.sample::(Standard); + rng.sample::(Standard); + #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] + rng.sample::(Standard); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/mod.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/mod.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,608 @@ +// Copyright 2018 Developers of the Rand project. +// Copyright 2013-2017 The Rust Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Generating random samples from probability distributions. +//! +//! This module is the home of the [`Distribution`] trait and several of its +//! implementations. It is the workhorse behind some of the convenient +//! functionality of the [`Rng`] trait, including [`gen`], [`gen_range`] and +//! of course [`sample`]. +//! +//! Abstractly, a [probability distribution] describes the probability of +//! occurance of each value in its sample space. +//! +//! More concretely, an implementation of `Distribution` for type `X` is an +//! algorithm for choosing values from the sample space (a subset of `T`) +//! according to the distribution `X` represents, using an external source of +//! randomness (an RNG supplied to the `sample` function). +//! +//! A type `X` may implement `Distribution` for multiple types `T`. +//! Any type implementing [`Distribution`] is stateless (i.e. immutable), +//! but it may have internal parameters set at construction time (for example, +//! [`Uniform`] allows specification of its sample space as a range within `T`). +//! +//! +//! # The `Standard` distribution +//! +//! The [`Standard`] distribution is important to mention. This is the +//! distribution used by [`Rng::gen()`] and represents the "default" way to +//! produce a random value for many different types, including most primitive +//! types, tuples, arrays, and a few derived types. See the documentation of +//! [`Standard`] for more details. +//! +//! Implementing `Distribution` for [`Standard`] for user types `T` makes it +//! possible to generate type `T` with [`Rng::gen()`], and by extension also +//! with the [`random()`] function. +//! +//! +//! # Distribution to sample from a `Uniform` range +//! +//! The [`Uniform`] distribution is more flexible than [`Standard`], but also +//! more specialised: it supports fewer target types, but allows the sample +//! space to be specified as an arbitrary range within its target type `T`. +//! Both [`Standard`] and [`Uniform`] are in some sense uniform distributions. +//! +//! Values may be sampled from this distribution using [`Rng::gen_range`] or +//! by creating a distribution object with [`Uniform::new`], +//! [`Uniform::new_inclusive`] or `From`. When the range limits are not +//! known at compile time it is typically faster to reuse an existing +//! distribution object than to call [`Rng::gen_range`]. +//! +//! User types `T` may also implement `Distribution` for [`Uniform`], +//! although this is less straightforward than for [`Standard`] (see the +//! documentation in the [`uniform`] module. Doing so enables generation of +//! values of type `T` with [`Rng::gen_range`]. +//! +//! +//! # Other distributions +//! +//! There are surprisingly many ways to uniformly generate random floats. A +//! range between 0 and 1 is standard, but the exact bounds (open vs closed) +//! and accuracy differ. In addition to the [`Standard`] distribution Rand offers +//! [`Open01`] and [`OpenClosed01`]. See "Floating point implementation" section of +//! [`Standard`] documentation for more details. +//! +//! [`Alphanumeric`] is a simple distribution to sample random letters and +//! numbers of the `char` type; in contrast [`Standard`] may sample any valid +//! `char`. +//! +//! [`WeightedIndex`] can be used to do weighted sampling from a set of items, +//! such as from an array. +//! +//! # Non-uniform probability distributions +//! +//! Rand currently provides the following probability distributions: +//! +//! - Related to real-valued quantities that grow linearly +//! (e.g. errors, offsets): +//! - [`Normal`] distribution, and [`StandardNormal`] as a primitive +//! - [`Cauchy`] distribution +//! - Related to Bernoulli trials (yes/no events, with a given probability): +//! - [`Binomial`] distribution +//! - [`Bernoulli`] distribution, similar to [`Rng::gen_bool`]. +//! - Related to positive real-valued quantities that grow exponentially +//! (e.g. prices, incomes, populations): +//! - [`LogNormal`] distribution +//! - Related to the occurrence of independent events at a given rate: +//! - [`Pareto`] distribution +//! - [`Poisson`] distribution +//! - [`Exp`]onential distribution, and [`Exp1`] as a primitive +//! - [`Weibull`] distribution +//! - Gamma and derived distributions: +//! - [`Gamma`] distribution +//! - [`ChiSquared`] distribution +//! - [`StudentT`] distribution +//! - [`FisherF`] distribution +//! - Triangular distribution: +//! - [`Beta`] distribution +//! - [`Triangular`] distribution +//! - Multivariate probability distributions +//! - [`Dirichlet`] distribution +//! - [`UnitSphereSurface`] distribution +//! - [`UnitCircle`] distribution +//! +//! # Examples +//! +//! Sampling from a distribution: +//! +//! ``` +//! use rand::{thread_rng, Rng}; +//! use rand::distributions::Exp; +//! +//! let exp = Exp::new(2.0); +//! let v = thread_rng().sample(exp); +//! println!("{} is from an Exp(2) distribution", v); +//! ``` +//! +//! Implementing the [`Standard`] distribution for a user type: +//! +//! ``` +//! # #![allow(dead_code)] +//! use rand::Rng; +//! use rand::distributions::{Distribution, Standard}; +//! +//! struct MyF32 { +//! x: f32, +//! } +//! +//! impl Distribution for Standard { +//! fn sample(&self, rng: &mut R) -> MyF32 { +//! MyF32 { x: rng.gen() } +//! } +//! } +//! ``` +//! +//! +//! [probability distribution]: https://en.wikipedia.org/wiki/Probability_distribution +//! [`gen_range`]: Rng::gen_range +//! [`gen`]: Rng::gen +//! [`sample`]: Rng::sample +//! [`new_inclusive`]: Uniform::new_inclusive +//! [`Alphanumeric`]: distributions::Alphanumeric +//! [`Bernoulli`]: distributions::Bernoulli +//! [`Beta`]: distributions::Beta +//! [`Binomial`]: distributions::Binomial +//! [`Cauchy`]: distributions::Cauchy +//! [`ChiSquared`]: distributions::ChiSquared +//! [`Dirichlet`]: distributions::Dirichlet +//! [`Exp`]: distributions::Exp +//! [`Exp1`]: distributions::Exp1 +//! [`FisherF`]: distributions::FisherF +//! [`Gamma`]: distributions::Gamma +//! [`LogNormal`]: distributions::LogNormal +//! [`Normal`]: distributions::Normal +//! [`Open01`]: distributions::Open01 +//! [`OpenClosed01`]: distributions::OpenClosed01 +//! [`Pareto`]: distributions::Pareto +//! [`Poisson`]: distributions::Poisson +//! [`Standard`]: distributions::Standard +//! [`StandardNormal`]: distributions::StandardNormal +//! [`StudentT`]: distributions::StudentT +//! [`Triangular`]: distributions::Triangular +//! [`Uniform`]: distributions::Uniform +//! [`Uniform::new`]: distributions::Uniform::new +//! [`Uniform::new_inclusive`]: distributions::Uniform::new_inclusive +//! [`UnitSphereSurface`]: distributions::UnitSphereSurface +//! [`UnitCircle`]: distributions::UnitCircle +//! [`Weibull`]: distributions::Weibull +//! [`WeightedIndex`]: distributions::WeightedIndex + +#[cfg(any(rustc_1_26, features="nightly"))] +use core::iter; +use Rng; + +pub use self::other::Alphanumeric; +#[doc(inline)] pub use self::uniform::Uniform; +pub use self::float::{OpenClosed01, Open01}; +pub use self::bernoulli::Bernoulli; +#[cfg(feature="alloc")] pub use self::weighted::{WeightedIndex, WeightedError}; +#[cfg(feature="std")] pub use self::unit_sphere::UnitSphereSurface; +#[cfg(feature="std")] pub use self::unit_circle::UnitCircle; +#[cfg(feature="std")] pub use self::gamma::{Gamma, ChiSquared, FisherF, + StudentT, Beta}; +#[cfg(feature="std")] pub use self::normal::{Normal, LogNormal, StandardNormal}; +#[cfg(feature="std")] pub use self::exponential::{Exp, Exp1}; +#[cfg(feature="std")] pub use self::pareto::Pareto; +#[cfg(feature="std")] pub use self::poisson::Poisson; +#[cfg(feature="std")] pub use self::binomial::Binomial; +#[cfg(feature="std")] pub use self::cauchy::Cauchy; +#[cfg(feature="std")] pub use self::dirichlet::Dirichlet; +#[cfg(feature="std")] pub use self::triangular::Triangular; +#[cfg(feature="std")] pub use self::weibull::Weibull; + +pub mod uniform; +mod bernoulli; +#[cfg(feature="alloc")] mod weighted; +#[cfg(feature="std")] mod unit_sphere; +#[cfg(feature="std")] mod unit_circle; +#[cfg(feature="std")] mod gamma; +#[cfg(feature="std")] mod normal; +#[cfg(feature="std")] mod exponential; +#[cfg(feature="std")] mod pareto; +#[cfg(feature="std")] mod poisson; +#[cfg(feature="std")] mod binomial; +#[cfg(feature="std")] mod cauchy; +#[cfg(feature="std")] mod dirichlet; +#[cfg(feature="std")] mod triangular; +#[cfg(feature="std")] mod weibull; + +mod float; +mod integer; +mod other; +mod utils; +#[cfg(feature="std")] mod ziggurat_tables; + +/// Types (distributions) that can be used to create a random instance of `T`. +/// +/// It is possible to sample from a distribution through both the +/// `Distribution` and [`Rng`] traits, via `distr.sample(&mut rng)` and +/// `rng.sample(distr)`. They also both offer the [`sample_iter`] method, which +/// produces an iterator that samples from the distribution. +/// +/// All implementations are expected to be immutable; this has the significant +/// advantage of not needing to consider thread safety, and for most +/// distributions efficient state-less sampling algorithms are available. +/// +/// [`sample_iter`]: Distribution::method.sample_iter +pub trait Distribution { + /// Generate a random value of `T`, using `rng` as the source of randomness. + fn sample(&self, rng: &mut R) -> T; + + /// Create an iterator that generates random values of `T`, using `rng` as + /// the source of randomness. + /// + /// # Example + /// + /// ``` + /// use rand::thread_rng; + /// use rand::distributions::{Distribution, Alphanumeric, Uniform, Standard}; + /// + /// let mut rng = thread_rng(); + /// + /// // Vec of 16 x f32: + /// let v: Vec = Standard.sample_iter(&mut rng).take(16).collect(); + /// + /// // String: + /// let s: String = Alphanumeric.sample_iter(&mut rng).take(7).collect(); + /// + /// // Dice-rolling: + /// let die_range = Uniform::new_inclusive(1, 6); + /// let mut roll_die = die_range.sample_iter(&mut rng); + /// while roll_die.next().unwrap() != 6 { + /// println!("Not a 6; rolling again!"); + /// } + /// ``` + fn sample_iter<'a, R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T> + where Self: Sized, R: Rng + { + DistIter { + distr: self, + rng: rng, + phantom: ::core::marker::PhantomData, + } + } +} + +impl<'a, T, D: Distribution> Distribution for &'a D { + fn sample(&self, rng: &mut R) -> T { + (*self).sample(rng) + } +} + + +/// An iterator that generates random values of `T` with distribution `D`, +/// using `R` as the source of randomness. +/// +/// This `struct` is created by the [`sample_iter`] method on [`Distribution`]. +/// See its documentation for more. +/// +/// [`sample_iter`]: Distribution::sample_iter +#[derive(Debug)] +pub struct DistIter<'a, D: 'a, R: 'a, T> { + distr: &'a D, + rng: &'a mut R, + phantom: ::core::marker::PhantomData, +} + +impl<'a, D, R, T> Iterator for DistIter<'a, D, R, T> + where D: Distribution, R: Rng + 'a +{ + type Item = T; + + #[inline(always)] + fn next(&mut self) -> Option { + Some(self.distr.sample(self.rng)) + } + + fn size_hint(&self) -> (usize, Option) { + (usize::max_value(), None) + } +} + +#[cfg(rustc_1_26)] +impl<'a, D, R, T> iter::FusedIterator for DistIter<'a, D, R, T> + where D: Distribution, R: Rng + 'a {} + +#[cfg(features = "nightly")] +impl<'a, D, R, T> iter::TrustedLen for DistIter<'a, D, R, T> + where D: Distribution, R: Rng + 'a {} + + +/// A generic random value distribution, implemented for many primitive types. +/// Usually generates values with a numerically uniform distribution, and with a +/// range appropriate to the type. +/// +/// ## Built-in Implementations +/// +/// Assuming the provided `Rng` is well-behaved, these implementations +/// generate values with the following ranges and distributions: +/// +/// * Integers (`i32`, `u32`, `isize`, `usize`, etc.): Uniformly distributed +/// over all values of the type. +/// * `char`: Uniformly distributed over all Unicode scalar values, i.e. all +/// code points in the range `0...0x10_FFFF`, except for the range +/// `0xD800...0xDFFF` (the surrogate code points). This includes +/// unassigned/reserved code points. +/// * `bool`: Generates `false` or `true`, each with probability 0.5. +/// * Floating point types (`f32` and `f64`): Uniformly distributed in the +/// half-open range `[0, 1)`. See notes below. +/// * Wrapping integers (`Wrapping`), besides the type identical to their +/// normal integer variants. +/// +/// The following aggregate types also implement the distribution `Standard` as +/// long as their component types implement it: +/// +/// * Tuples and arrays: Each element of the tuple or array is generated +/// independently, using the `Standard` distribution recursively. +/// * `Option` where `Standard` is implemented for `T`: Returns `None` with +/// probability 0.5; otherwise generates a random `x: T` and returns `Some(x)`. +/// +/// # Example +/// ``` +/// use rand::prelude::*; +/// use rand::distributions::Standard; +/// +/// let val: f32 = SmallRng::from_entropy().sample(Standard); +/// println!("f32 from [0, 1): {}", val); +/// ``` +/// +/// # Floating point implementation +/// The floating point implementations for `Standard` generate a random value in +/// the half-open interval `[0, 1)`, i.e. including 0 but not 1. +/// +/// All values that can be generated are of the form `n * ε/2`. For `f32` +/// the 23 most significant random bits of a `u32` are used and for `f64` the +/// 53 most significant bits of a `u64` are used. The conversion uses the +/// multiplicative method: `(rng.gen::<$uty>() >> N) as $ty * (ε/2)`. +/// +/// See also: [`Open01`] which samples from `(0, 1)`, [`OpenClosed01`] which +/// samples from `(0, 1]` and `Rng::gen_range(0, 1)` which also samples from +/// `[0, 1)`. Note that `Open01` and `gen_range` (which uses [`Uniform`]) use +/// transmute-based methods which yield 1 bit less precision but may perform +/// faster on some architectures (on modern Intel CPUs all methods have +/// approximately equal performance). +/// +/// [`Uniform`]: uniform::Uniform +#[derive(Clone, Copy, Debug)] +pub struct Standard; + + +/// A value with a particular weight for use with `WeightedChoice`. +#[deprecated(since="0.6.0", note="use WeightedIndex instead")] +#[allow(deprecated)] +#[derive(Copy, Clone, Debug)] +pub struct Weighted { + /// The numerical weight of this item + pub weight: u32, + /// The actual item which is being weighted + pub item: T, +} + +/// A distribution that selects from a finite collection of weighted items. +/// +/// Deprecated: use [`WeightedIndex`] instead. +/// +/// [`WeightedIndex`]: WeightedIndex +#[deprecated(since="0.6.0", note="use WeightedIndex instead")] +#[allow(deprecated)] +#[derive(Debug)] +pub struct WeightedChoice<'a, T:'a> { + items: &'a mut [Weighted], + weight_range: Uniform, +} + +#[deprecated(since="0.6.0", note="use WeightedIndex instead")] +#[allow(deprecated)] +impl<'a, T: Clone> WeightedChoice<'a, T> { + /// Create a new `WeightedChoice`. + /// + /// Panics if: + /// + /// - `items` is empty + /// - the total weight is 0 + /// - the total weight is larger than a `u32` can contain. + pub fn new(items: &'a mut [Weighted]) -> WeightedChoice<'a, T> { + // strictly speaking, this is subsumed by the total weight == 0 case + assert!(!items.is_empty(), "WeightedChoice::new called with no items"); + + let mut running_total: u32 = 0; + + // we convert the list from individual weights to cumulative + // weights so we can binary search. This *could* drop elements + // with weight == 0 as an optimisation. + for item in items.iter_mut() { + running_total = match running_total.checked_add(item.weight) { + Some(n) => n, + None => panic!("WeightedChoice::new called with a total weight \ + larger than a u32 can contain") + }; + + item.weight = running_total; + } + assert!(running_total != 0, "WeightedChoice::new called with a total weight of 0"); + + WeightedChoice { + items, + // we're likely to be generating numbers in this range + // relatively often, so might as well cache it + weight_range: Uniform::new(0, running_total) + } + } +} + +#[deprecated(since="0.6.0", note="use WeightedIndex instead")] +#[allow(deprecated)] +impl<'a, T: Clone> Distribution for WeightedChoice<'a, T> { + fn sample(&self, rng: &mut R) -> T { + // we want to find the first element that has cumulative + // weight > sample_weight, which we do by binary since the + // cumulative weights of self.items are sorted. + + // choose a weight in [0, total_weight) + let sample_weight = self.weight_range.sample(rng); + + // short circuit when it's the first item + if sample_weight < self.items[0].weight { + return self.items[0].item.clone(); + } + + let mut idx = 0; + let mut modifier = self.items.len(); + + // now we know that every possibility has an element to the + // left, so we can just search for the last element that has + // cumulative weight <= sample_weight, then the next one will + // be "it". (Note that this greatest element will never be the + // last element of the vector, since sample_weight is chosen + // in [0, total_weight) and the cumulative weight of the last + // one is exactly the total weight.) + while modifier > 1 { + let i = idx + modifier / 2; + if self.items[i].weight <= sample_weight { + // we're small, so look to the right, but allow this + // exact element still. + idx = i; + // we need the `/ 2` to round up otherwise we'll drop + // the trailing elements when `modifier` is odd. + modifier += 1; + } else { + // otherwise we're too big, so go left. (i.e. do + // nothing) + } + modifier /= 2; + } + self.items[idx + 1].item.clone() + } +} + +#[cfg(test)] +mod tests { + use rngs::mock::StepRng; + #[allow(deprecated)] + use super::{WeightedChoice, Weighted, Distribution}; + + #[test] + #[allow(deprecated)] + fn test_weighted_choice() { + // this makes assumptions about the internal implementation of + // WeightedChoice. It may fail when the implementation in + // `distributions::uniform::UniformInt` changes. + + macro_rules! t { + ($items:expr, $expected:expr) => {{ + let mut items = $items; + let mut total_weight = 0; + for item in &items { total_weight += item.weight; } + + let wc = WeightedChoice::new(&mut items); + let expected = $expected; + + // Use extremely large steps between the random numbers, because + // we test with small ranges and `UniformInt` is designed to prefer + // the most significant bits. + let mut rng = StepRng::new(0, !0 / (total_weight as u64)); + + for &val in expected.iter() { + assert_eq!(wc.sample(&mut rng), val) + } + }} + } + + t!([Weighted { weight: 1, item: 10}], [10]); + + // skip some + t!([Weighted { weight: 0, item: 20}, + Weighted { weight: 2, item: 21}, + Weighted { weight: 0, item: 22}, + Weighted { weight: 1, item: 23}], + [21, 21, 23]); + + // different weights + t!([Weighted { weight: 4, item: 30}, + Weighted { weight: 3, item: 31}], + [30, 31, 30, 31, 30, 31, 30]); + + // check that we're binary searching + // correctly with some vectors of odd + // length. + t!([Weighted { weight: 1, item: 40}, + Weighted { weight: 1, item: 41}, + Weighted { weight: 1, item: 42}, + Weighted { weight: 1, item: 43}, + Weighted { weight: 1, item: 44}], + [40, 41, 42, 43, 44]); + t!([Weighted { weight: 1, item: 50}, + Weighted { weight: 1, item: 51}, + Weighted { weight: 1, item: 52}, + Weighted { weight: 1, item: 53}, + Weighted { weight: 1, item: 54}, + Weighted { weight: 1, item: 55}, + Weighted { weight: 1, item: 56}], + [50, 54, 51, 55, 52, 56, 53]); + } + + #[test] + #[allow(deprecated)] + fn test_weighted_clone_initialization() { + let initial : Weighted = Weighted {weight: 1, item: 1}; + let clone = initial.clone(); + assert_eq!(initial.weight, clone.weight); + assert_eq!(initial.item, clone.item); + } + + #[test] #[should_panic] + #[allow(deprecated)] + fn test_weighted_clone_change_weight() { + let initial : Weighted = Weighted {weight: 1, item: 1}; + let mut clone = initial.clone(); + clone.weight = 5; + assert_eq!(initial.weight, clone.weight); + } + + #[test] #[should_panic] + #[allow(deprecated)] + fn test_weighted_clone_change_item() { + let initial : Weighted = Weighted {weight: 1, item: 1}; + let mut clone = initial.clone(); + clone.item = 5; + assert_eq!(initial.item, clone.item); + + } + + #[test] #[should_panic] + #[allow(deprecated)] + fn test_weighted_choice_no_items() { + WeightedChoice::::new(&mut []); + } + #[test] #[should_panic] + #[allow(deprecated)] + fn test_weighted_choice_zero_weight() { + WeightedChoice::new(&mut [Weighted { weight: 0, item: 0}, + Weighted { weight: 0, item: 1}]); + } + #[test] #[should_panic] + #[allow(deprecated)] + fn test_weighted_choice_weight_overflows() { + let x = ::core::u32::MAX / 2; // x + x + 2 is the overflow + WeightedChoice::new(&mut [Weighted { weight: x, item: 0 }, + Weighted { weight: 1, item: 1 }, + Weighted { weight: x, item: 2 }, + Weighted { weight: 1, item: 3 }]); + } + + #[cfg(feature="std")] + #[test] + fn test_distributions_iter() { + use distributions::Normal; + let mut rng = ::test::rng(210); + let distr = Normal::new(10.0, 10.0); + let results: Vec<_> = distr.sample_iter(&mut rng).take(100).collect(); + println!("{:?}", results); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/normal.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/normal.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/normal.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/normal.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,197 @@ +// Copyright 2018 Developers of the Rand project. +// Copyright 2013 The Rust Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The normal and derived distributions. + +use Rng; +use distributions::{ziggurat_tables, Distribution, Open01}; +use distributions::utils::ziggurat; + +/// Samples floating-point numbers according to the normal distribution +/// `N(0, 1)` (a.k.a. a standard normal, or Gaussian). This is equivalent to +/// `Normal::new(0.0, 1.0)` but faster. +/// +/// See `Normal` for the general normal distribution. +/// +/// Implemented via the ZIGNOR variant[^1] of the Ziggurat method. +/// +/// [^1]: Jurgen A. Doornik (2005). [*An Improved Ziggurat Method to +/// Generate Normal Random Samples*]( +/// https://www.doornik.com/research/ziggurat.pdf). +/// Nuffield College, Oxford +/// +/// # Example +/// ``` +/// use rand::prelude::*; +/// use rand::distributions::StandardNormal; +/// +/// let val: f64 = SmallRng::from_entropy().sample(StandardNormal); +/// println!("{}", val); +/// ``` +#[derive(Clone, Copy, Debug)] +pub struct StandardNormal; + +impl Distribution for StandardNormal { + fn sample(&self, rng: &mut R) -> f64 { + #[inline] + fn pdf(x: f64) -> f64 { + (-x*x/2.0).exp() + } + #[inline] + fn zero_case(rng: &mut R, u: f64) -> f64 { + // compute a random number in the tail by hand + + // strange initial conditions, because the loop is not + // do-while, so the condition should be true on the first + // run, they get overwritten anyway (0 < 1, so these are + // good). + let mut x = 1.0f64; + let mut y = 0.0f64; + + while -2.0 * y < x * x { + let x_: f64 = rng.sample(Open01); + let y_: f64 = rng.sample(Open01); + + x = x_.ln() / ziggurat_tables::ZIG_NORM_R; + y = y_.ln(); + } + + if u < 0.0 { x - ziggurat_tables::ZIG_NORM_R } else { ziggurat_tables::ZIG_NORM_R - x } + } + + ziggurat(rng, true, // this is symmetric + &ziggurat_tables::ZIG_NORM_X, + &ziggurat_tables::ZIG_NORM_F, + pdf, zero_case) + } +} + +/// The normal distribution `N(mean, std_dev**2)`. +/// +/// This uses the ZIGNOR variant of the Ziggurat method, see [`StandardNormal`] +/// for more details. +/// +/// Note that [`StandardNormal`] is an optimised implementation for mean 0, and +/// standard deviation 1. +/// +/// # Example +/// +/// ``` +/// use rand::distributions::{Normal, Distribution}; +/// +/// // mean 2, standard deviation 3 +/// let normal = Normal::new(2.0, 3.0); +/// let v = normal.sample(&mut rand::thread_rng()); +/// println!("{} is from a N(2, 9) distribution", v) +/// ``` +/// +/// [`StandardNormal`]: crate::distributions::StandardNormal +#[derive(Clone, Copy, Debug)] +pub struct Normal { + mean: f64, + std_dev: f64, +} + +impl Normal { + /// Construct a new `Normal` distribution with the given mean and + /// standard deviation. + /// + /// # Panics + /// + /// Panics if `std_dev < 0`. + #[inline] + pub fn new(mean: f64, std_dev: f64) -> Normal { + assert!(std_dev >= 0.0, "Normal::new called with `std_dev` < 0"); + Normal { + mean, + std_dev + } + } +} +impl Distribution for Normal { + fn sample(&self, rng: &mut R) -> f64 { + let n = rng.sample(StandardNormal); + self.mean + self.std_dev * n + } +} + + +/// The log-normal distribution `ln N(mean, std_dev**2)`. +/// +/// If `X` is log-normal distributed, then `ln(X)` is `N(mean, std_dev**2)` +/// distributed. +/// +/// # Example +/// +/// ``` +/// use rand::distributions::{LogNormal, Distribution}; +/// +/// // mean 2, standard deviation 3 +/// let log_normal = LogNormal::new(2.0, 3.0); +/// let v = log_normal.sample(&mut rand::thread_rng()); +/// println!("{} is from an ln N(2, 9) distribution", v) +/// ``` +#[derive(Clone, Copy, Debug)] +pub struct LogNormal { + norm: Normal +} + +impl LogNormal { + /// Construct a new `LogNormal` distribution with the given mean + /// and standard deviation. + /// + /// # Panics + /// + /// Panics if `std_dev < 0`. + #[inline] + pub fn new(mean: f64, std_dev: f64) -> LogNormal { + assert!(std_dev >= 0.0, "LogNormal::new called with `std_dev` < 0"); + LogNormal { norm: Normal::new(mean, std_dev) } + } +} +impl Distribution for LogNormal { + fn sample(&self, rng: &mut R) -> f64 { + self.norm.sample(rng).exp() + } +} + +#[cfg(test)] +mod tests { + use distributions::Distribution; + use super::{Normal, LogNormal}; + + #[test] + fn test_normal() { + let norm = Normal::new(10.0, 10.0); + let mut rng = ::test::rng(210); + for _ in 0..1000 { + norm.sample(&mut rng); + } + } + #[test] + #[should_panic] + fn test_normal_invalid_sd() { + Normal::new(10.0, -1.0); + } + + + #[test] + fn test_log_normal() { + let lnorm = LogNormal::new(10.0, 10.0); + let mut rng = ::test::rng(211); + for _ in 0..1000 { + lnorm.sample(&mut rng); + } + } + #[test] + #[should_panic] + fn test_log_normal_invalid_sd() { + LogNormal::new(10.0, -1.0); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/other.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/other.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/other.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/other.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,219 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The implementations of the `Standard` distribution for other built-in types. + +use core::char; +use core::num::Wrapping; + +use {Rng}; +use distributions::{Distribution, Standard, Uniform}; + +// ----- Sampling distributions ----- + +/// Sample a `char`, uniformly distributed over ASCII letters and numbers: +/// a-z, A-Z and 0-9. +/// +/// # Example +/// +/// ``` +/// use std::iter; +/// use rand::{Rng, thread_rng}; +/// use rand::distributions::Alphanumeric; +/// +/// let mut rng = thread_rng(); +/// let chars: String = iter::repeat(()) +/// .map(|()| rng.sample(Alphanumeric)) +/// .take(7) +/// .collect(); +/// println!("Random chars: {}", chars); +/// ``` +#[derive(Debug)] +pub struct Alphanumeric; + + +// ----- Implementations of distributions ----- + +impl Distribution for Standard { + #[inline] + fn sample(&self, rng: &mut R) -> char { + // A valid `char` is either in the interval `[0, 0xD800)` or + // `(0xDFFF, 0x11_0000)`. All `char`s must therefore be in + // `[0, 0x11_0000)` but not in the "gap" `[0xD800, 0xDFFF]` which is + // reserved for surrogates. This is the size of that gap. + const GAP_SIZE: u32 = 0xDFFF - 0xD800 + 1; + + // Uniform::new(0, 0x11_0000 - GAP_SIZE) can also be used but it + // seemed slower. + let range = Uniform::new(GAP_SIZE, 0x11_0000); + + let mut n = range.sample(rng); + if n <= 0xDFFF { + n -= GAP_SIZE; + } + unsafe { char::from_u32_unchecked(n) } + } +} + +impl Distribution for Alphanumeric { + fn sample(&self, rng: &mut R) -> char { + const RANGE: u32 = 26 + 26 + 10; + const GEN_ASCII_STR_CHARSET: &[u8] = + b"ABCDEFGHIJKLMNOPQRSTUVWXYZ\ + abcdefghijklmnopqrstuvwxyz\ + 0123456789"; + // We can pick from 62 characters. This is so close to a power of 2, 64, + // that we can do better than `Uniform`. Use a simple bitshift and + // rejection sampling. We do not use a bitmask, because for small RNGs + // the most significant bits are usually of higher quality. + loop { + let var = rng.next_u32() >> (32 - 6); + if var < RANGE { + return GEN_ASCII_STR_CHARSET[var as usize] as char + } + } + } +} + +impl Distribution for Standard { + #[inline] + fn sample(&self, rng: &mut R) -> bool { + // We can compare against an arbitrary bit of an u32 to get a bool. + // Because the least significant bits of a lower quality RNG can have + // simple patterns, we compare against the most significant bit. This is + // easiest done using a sign test. + (rng.next_u32() as i32) < 0 + } +} + +macro_rules! tuple_impl { + // use variables to indicate the arity of the tuple + ($($tyvar:ident),* ) => { + // the trailing commas are for the 1 tuple + impl< $( $tyvar ),* > + Distribution<( $( $tyvar ),* , )> + for Standard + where $( Standard: Distribution<$tyvar> ),* + { + #[inline] + fn sample(&self, _rng: &mut R) -> ( $( $tyvar ),* , ) { + ( + // use the $tyvar's to get the appropriate number of + // repeats (they're not actually needed) + $( + _rng.gen::<$tyvar>() + ),* + , + ) + } + } + } +} + +impl Distribution<()> for Standard { + #[inline] + fn sample(&self, _: &mut R) -> () { () } +} +tuple_impl!{A} +tuple_impl!{A, B} +tuple_impl!{A, B, C} +tuple_impl!{A, B, C, D} +tuple_impl!{A, B, C, D, E} +tuple_impl!{A, B, C, D, E, F} +tuple_impl!{A, B, C, D, E, F, G} +tuple_impl!{A, B, C, D, E, F, G, H} +tuple_impl!{A, B, C, D, E, F, G, H, I} +tuple_impl!{A, B, C, D, E, F, G, H, I, J} +tuple_impl!{A, B, C, D, E, F, G, H, I, J, K} +tuple_impl!{A, B, C, D, E, F, G, H, I, J, K, L} + +macro_rules! array_impl { + // recursive, given at least one type parameter: + {$n:expr, $t:ident, $($ts:ident,)*} => { + array_impl!{($n - 1), $($ts,)*} + + impl Distribution<[T; $n]> for Standard where Standard: Distribution { + #[inline] + fn sample(&self, _rng: &mut R) -> [T; $n] { + [_rng.gen::<$t>(), $(_rng.gen::<$ts>()),*] + } + } + }; + // empty case: + {$n:expr,} => { + impl Distribution<[T; $n]> for Standard { + fn sample(&self, _rng: &mut R) -> [T; $n] { [] } + } + }; +} + +array_impl!{32, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T,} + +impl Distribution> for Standard where Standard: Distribution { + #[inline] + fn sample(&self, rng: &mut R) -> Option { + // UFCS is needed here: https://github.com/rust-lang/rust/issues/24066 + if rng.gen::() { + Some(rng.gen()) + } else { + None + } + } +} + +impl Distribution> for Standard where Standard: Distribution { + #[inline] + fn sample(&self, rng: &mut R) -> Wrapping { + Wrapping(rng.gen()) + } +} + + +#[cfg(test)] +mod tests { + use {Rng, RngCore, Standard}; + use distributions::Alphanumeric; + #[cfg(all(not(feature="std"), feature="alloc"))] use alloc::string::String; + + #[test] + fn test_misc() { + let rng: &mut RngCore = &mut ::test::rng(820); + + rng.sample::(Standard); + rng.sample::(Standard); + } + + #[cfg(feature="alloc")] + #[test] + fn test_chars() { + use core::iter; + let mut rng = ::test::rng(805); + + // Test by generating a relatively large number of chars, so we also + // take the rejection sampling path. + let word: String = iter::repeat(()) + .map(|()| rng.gen::()).take(1000).collect(); + assert!(word.len() != 0); + } + + #[test] + fn test_alphanumeric() { + let mut rng = ::test::rng(806); + + // Test by generating a relatively large number of chars, so we also + // take the rejection sampling path. + let mut incorrect = false; + for _ in 0..100 { + let c = rng.sample(Alphanumeric); + incorrect |= !((c >= '0' && c <= '9') || + (c >= 'A' && c <= 'Z') || + (c >= 'a' && c <= 'z') ); + } + assert!(incorrect == false); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/pareto.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/pareto.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/pareto.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/pareto.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,74 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The Pareto distribution. + +use Rng; +use distributions::{Distribution, OpenClosed01}; + +/// Samples floating-point numbers according to the Pareto distribution +/// +/// # Example +/// ``` +/// use rand::prelude::*; +/// use rand::distributions::Pareto; +/// +/// let val: f64 = SmallRng::from_entropy().sample(Pareto::new(1., 2.)); +/// println!("{}", val); +/// ``` +#[derive(Clone, Copy, Debug)] +pub struct Pareto { + scale: f64, + inv_neg_shape: f64, +} + +impl Pareto { + /// Construct a new Pareto distribution with given `scale` and `shape`. + /// + /// In the literature, `scale` is commonly written as xm or k and + /// `shape` is often written as α. + /// + /// # Panics + /// + /// `scale` and `shape` have to be non-zero and positive. + pub fn new(scale: f64, shape: f64) -> Pareto { + assert!((scale > 0.) & (shape > 0.)); + Pareto { scale, inv_neg_shape: -1.0 / shape } + } +} + +impl Distribution for Pareto { + fn sample(&self, rng: &mut R) -> f64 { + let u: f64 = rng.sample(OpenClosed01); + self.scale * u.powf(self.inv_neg_shape) + } +} + +#[cfg(test)] +mod tests { + use distributions::Distribution; + use super::Pareto; + + #[test] + #[should_panic] + fn invalid() { + Pareto::new(0., 0.); + } + + #[test] + fn sample() { + let scale = 1.0; + let shape = 2.0; + let d = Pareto::new(scale, shape); + let mut rng = ::test::rng(1); + for _ in 0..1000 { + let r = d.sample(&mut rng); + assert!(r >= scale); + } + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/poisson.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/poisson.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/poisson.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/poisson.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,157 @@ +// Copyright 2018 Developers of the Rand project. +// Copyright 2016-2017 The Rust Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The Poisson distribution. + +use Rng; +use distributions::{Distribution, Cauchy}; +use distributions::utils::log_gamma; + +/// The Poisson distribution `Poisson(lambda)`. +/// +/// This distribution has a density function: +/// `f(k) = lambda^k * exp(-lambda) / k!` for `k >= 0`. +/// +/// # Example +/// +/// ``` +/// use rand::distributions::{Poisson, Distribution}; +/// +/// let poi = Poisson::new(2.0); +/// let v = poi.sample(&mut rand::thread_rng()); +/// println!("{} is from a Poisson(2) distribution", v); +/// ``` +#[derive(Clone, Copy, Debug)] +pub struct Poisson { + lambda: f64, + // precalculated values + exp_lambda: f64, + log_lambda: f64, + sqrt_2lambda: f64, + magic_val: f64, +} + +impl Poisson { + /// Construct a new `Poisson` with the given shape parameter + /// `lambda`. Panics if `lambda <= 0`. + pub fn new(lambda: f64) -> Poisson { + assert!(lambda > 0.0, "Poisson::new called with lambda <= 0"); + let log_lambda = lambda.ln(); + Poisson { + lambda, + exp_lambda: (-lambda).exp(), + log_lambda, + sqrt_2lambda: (2.0 * lambda).sqrt(), + magic_val: lambda * log_lambda - log_gamma(1.0 + lambda), + } + } +} + +impl Distribution for Poisson { + fn sample(&self, rng: &mut R) -> u64 { + // using the algorithm from Numerical Recipes in C + + // for low expected values use the Knuth method + if self.lambda < 12.0 { + let mut result = 0; + let mut p = 1.0; + while p > self.exp_lambda { + p *= rng.gen::(); + result += 1; + } + result - 1 + } + // high expected values - rejection method + else { + let mut int_result: u64; + + // we use the Cauchy distribution as the comparison distribution + // f(x) ~ 1/(1+x^2) + let cauchy = Cauchy::new(0.0, 1.0); + + loop { + let mut result; + let mut comp_dev; + + loop { + // draw from the Cauchy distribution + comp_dev = rng.sample(cauchy); + // shift the peak of the comparison ditribution + result = self.sqrt_2lambda * comp_dev + self.lambda; + // repeat the drawing until we are in the range of possible values + if result >= 0.0 { + break; + } + } + // now the result is a random variable greater than 0 with Cauchy distribution + // the result should be an integer value + result = result.floor(); + int_result = result as u64; + + // this is the ratio of the Poisson distribution to the comparison distribution + // the magic value scales the distribution function to a range of approximately 0-1 + // since it is not exact, we multiply the ratio by 0.9 to avoid ratios greater than 1 + // this doesn't change the resulting distribution, only increases the rate of failed drawings + let check = 0.9 * (1.0 + comp_dev * comp_dev) + * (result * self.log_lambda - log_gamma(1.0 + result) - self.magic_val).exp(); + + // check with uniform random value - if below the threshold, we are within the target distribution + if rng.gen::() <= check { + break; + } + } + int_result + } + } +} + +#[cfg(test)] +mod test { + use distributions::Distribution; + use super::Poisson; + + #[test] + fn test_poisson_10() { + let poisson = Poisson::new(10.0); + let mut rng = ::test::rng(123); + let mut sum = 0; + for _ in 0..1000 { + sum += poisson.sample(&mut rng); + } + let avg = (sum as f64) / 1000.0; + println!("Poisson average: {}", avg); + assert!((avg - 10.0).abs() < 0.5); // not 100% certain, but probable enough + } + + #[test] + fn test_poisson_15() { + // Take the 'high expected values' path + let poisson = Poisson::new(15.0); + let mut rng = ::test::rng(123); + let mut sum = 0; + for _ in 0..1000 { + sum += poisson.sample(&mut rng); + } + let avg = (sum as f64) / 1000.0; + println!("Poisson average: {}", avg); + assert!((avg - 15.0).abs() < 0.5); // not 100% certain, but probable enough + } + + #[test] + #[should_panic] + fn test_poisson_invalid_lambda_zero() { + Poisson::new(0.0); + } + + #[test] + #[should_panic] + fn test_poisson_invalid_lambda_neg() { + Poisson::new(-10.0); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/triangular.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/triangular.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/triangular.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/triangular.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,86 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +//! The triangular distribution. + +use Rng; +use distributions::{Distribution, Standard}; + +/// The triangular distribution. +/// +/// # Example +/// +/// ```rust +/// use rand::distributions::{Triangular, Distribution}; +/// +/// let d = Triangular::new(0., 5., 2.5); +/// let v = d.sample(&mut rand::thread_rng()); +/// println!("{} is from a triangular distribution", v); +/// ``` +#[derive(Clone, Copy, Debug)] +pub struct Triangular { + min: f64, + max: f64, + mode: f64, +} + +impl Triangular { + /// Construct a new `Triangular` with minimum `min`, maximum `max` and mode + /// `mode`. + /// + /// # Panics + /// + /// If `max < mode`, `mode < max` or `max == min`. + /// + #[inline] + pub fn new(min: f64, max: f64, mode: f64) -> Triangular { + assert!(max >= mode); + assert!(mode >= min); + assert!(max != min); + Triangular { min, max, mode } + } +} + +impl Distribution for Triangular { + #[inline] + fn sample(&self, rng: &mut R) -> f64 { + let f: f64 = rng.sample(Standard); + let diff_mode_min = self.mode - self.min; + let diff_max_min = self.max - self.min; + if f * diff_max_min < diff_mode_min { + self.min + (f * diff_max_min * diff_mode_min).sqrt() + } else { + self.max - ((1. - f) * diff_max_min * (self.max - self.mode)).sqrt() + } + } +} + +#[cfg(test)] +mod test { + use distributions::Distribution; + use super::Triangular; + + #[test] + fn test_new() { + for &(min, max, mode) in &[ + (-1., 1., 0.), (1., 2., 1.), (5., 25., 25.), (1e-5, 1e5, 1e-3), + (0., 1., 0.9), (-4., -0.5, -2.), (-13.039, 8.41, 1.17), + ] { + println!("{} {} {}", min, max, mode); + let _ = Triangular::new(min, max, mode); + } + } + + #[test] + fn test_sample() { + let norm = Triangular::new(0., 1., 0.5); + let mut rng = ::test::rng(1); + for _ in 0..1000 { + norm.sample(&mut rng); + } + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/uniform.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/uniform.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/uniform.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/uniform.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,1283 @@ +// Copyright 2018 Developers of the Rand project. +// Copyright 2017 The Rust Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! A distribution uniformly sampling numbers within a given range. +//! +//! [`Uniform`] is the standard distribution to sample uniformly from a range; +//! e.g. `Uniform::new_inclusive(1, 6)` can sample integers from 1 to 6, like a +//! standard die. [`Rng::gen_range`] supports any type supported by +//! [`Uniform`]. +//! +//! This distribution is provided with support for several primitive types +//! (all integer and floating-point types) as well as [`std::time::Duration`], +//! and supports extension to user-defined types via a type-specific *back-end* +//! implementation. +//! +//! The types [`UniformInt`], [`UniformFloat`] and [`UniformDuration`] are the +//! back-ends supporting sampling from primitive integer and floating-point +//! ranges as well as from [`std::time::Duration`]; these types do not normally +//! need to be used directly (unless implementing a derived back-end). +//! +//! # Example usage +//! +//! ``` +//! use rand::{Rng, thread_rng}; +//! use rand::distributions::Uniform; +//! +//! let mut rng = thread_rng(); +//! let side = Uniform::new(-10.0, 10.0); +//! +//! // sample between 1 and 10 points +//! for _ in 0..rng.gen_range(1, 11) { +//! // sample a point from the square with sides -10 - 10 in two dimensions +//! let (x, y) = (rng.sample(side), rng.sample(side)); +//! println!("Point: {}, {}", x, y); +//! } +//! ``` +//! +//! # Extending `Uniform` to support a custom type +//! +//! To extend [`Uniform`] to support your own types, write a back-end which +//! implements the [`UniformSampler`] trait, then implement the [`SampleUniform`] +//! helper trait to "register" your back-end. See the `MyF32` example below. +//! +//! At a minimum, the back-end needs to store any parameters needed for sampling +//! (e.g. the target range) and implement `new`, `new_inclusive` and `sample`. +//! Those methods should include an assert to check the range is valid (i.e. +//! `low < high`). The example below merely wraps another back-end. +//! +//! The `new`, `new_inclusive` and `sample_single` functions use arguments of +//! type SampleBorrow in order to support passing in values by reference or +//! by value. In the implementation of these functions, you can choose to +//! simply use the reference returned by [`SampleBorrow::borrow`], or you can choose +//! to copy or clone the value, whatever is appropriate for your type. +//! +//! ``` +//! use rand::prelude::*; +//! use rand::distributions::uniform::{Uniform, SampleUniform, +//! UniformSampler, UniformFloat, SampleBorrow}; +//! +//! struct MyF32(f32); +//! +//! #[derive(Clone, Copy, Debug)] +//! struct UniformMyF32 { +//! inner: UniformFloat, +//! } +//! +//! impl UniformSampler for UniformMyF32 { +//! type X = MyF32; +//! fn new(low: B1, high: B2) -> Self +//! where B1: SampleBorrow + Sized, +//! B2: SampleBorrow + Sized +//! { +//! UniformMyF32 { +//! inner: UniformFloat::::new(low.borrow().0, high.borrow().0), +//! } +//! } +//! fn new_inclusive(low: B1, high: B2) -> Self +//! where B1: SampleBorrow + Sized, +//! B2: SampleBorrow + Sized +//! { +//! UniformSampler::new(low, high) +//! } +//! fn sample(&self, rng: &mut R) -> Self::X { +//! MyF32(self.inner.sample(rng)) +//! } +//! } +//! +//! impl SampleUniform for MyF32 { +//! type Sampler = UniformMyF32; +//! } +//! +//! let (low, high) = (MyF32(17.0f32), MyF32(22.0f32)); +//! let uniform = Uniform::new(low, high); +//! let x = uniform.sample(&mut thread_rng()); +//! ``` +//! +//! [`SampleUniform`]: crate::distributions::uniform::SampleUniform +//! [`UniformSampler`]: crate::distributions::uniform::UniformSampler +//! [`UniformInt`]: crate::distributions::uniform::UniformInt +//! [`UniformFloat`]: crate::distributions::uniform::UniformFloat +//! [`UniformDuration`]: crate::distributions::uniform::UniformDuration +//! [`SampleBorrow::borrow`]: crate::distributions::uniform::SampleBorrow::borrow + +#[cfg(feature = "std")] +use std::time::Duration; +#[cfg(all(not(feature = "std"), rustc_1_25))] +use core::time::Duration; + +use Rng; +use distributions::Distribution; +use distributions::float::IntoFloat; +use distributions::utils::{WideningMultiply, FloatSIMDUtils, FloatAsSIMD, BoolAsSIMD}; + +#[cfg(not(feature = "std"))] +#[allow(unused_imports)] // rustc doesn't detect that this is actually used +use distributions::utils::Float; + + +#[cfg(feature="simd_support")] +use packed_simd::*; + +/// Sample values uniformly between two bounds. +/// +/// [`Uniform::new`] and [`Uniform::new_inclusive`] construct a uniform +/// distribution sampling from the given range; these functions may do extra +/// work up front to make sampling of multiple values faster. +/// +/// When sampling from a constant range, many calculations can happen at +/// compile-time and all methods should be fast; for floating-point ranges and +/// the full range of integer types this should have comparable performance to +/// the `Standard` distribution. +/// +/// Steps are taken to avoid bias which might be present in naive +/// implementations; for example `rng.gen::() % 170` samples from the range +/// `[0, 169]` but is twice as likely to select numbers less than 85 than other +/// values. Further, the implementations here give more weight to the high-bits +/// generated by the RNG than the low bits, since with some RNGs the low-bits +/// are of lower quality than the high bits. +/// +/// Implementations must sample in `[low, high)` range for +/// `Uniform::new(low, high)`, i.e., excluding `high`. In particular care must +/// be taken to ensure that rounding never results values `< low` or `>= high`. +/// +/// # Example +/// +/// ``` +/// use rand::distributions::{Distribution, Uniform}; +/// +/// fn main() { +/// let between = Uniform::from(10..10000); +/// let mut rng = rand::thread_rng(); +/// let mut sum = 0; +/// for _ in 0..1000 { +/// sum += between.sample(&mut rng); +/// } +/// println!("{}", sum); +/// } +/// ``` +/// +/// [`new`]: Uniform::new +/// [`new_inclusive`]: Uniform::new_inclusive +#[derive(Clone, Copy, Debug)] +pub struct Uniform { + inner: X::Sampler, +} + +impl Uniform { + /// Create a new `Uniform` instance which samples uniformly from the half + /// open range `[low, high)` (excluding `high`). Panics if `low >= high`. + pub fn new(low: B1, high: B2) -> Uniform + where B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized + { + Uniform { inner: X::Sampler::new(low, high) } + } + + /// Create a new `Uniform` instance which samples uniformly from the closed + /// range `[low, high]` (inclusive). Panics if `low > high`. + pub fn new_inclusive(low: B1, high: B2) -> Uniform + where B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized + { + Uniform { inner: X::Sampler::new_inclusive(low, high) } + } +} + +impl Distribution for Uniform { + fn sample(&self, rng: &mut R) -> X { + self.inner.sample(rng) + } +} + +/// Helper trait for creating objects using the correct implementation of +/// [`UniformSampler`] for the sampling type. +/// +/// See the [module documentation] on how to implement [`Uniform`] range +/// sampling for a custom type. +/// +/// [module documentation]: crate::distributions::uniform +pub trait SampleUniform: Sized { + /// The `UniformSampler` implementation supporting type `X`. + type Sampler: UniformSampler; +} + +/// Helper trait handling actual uniform sampling. +/// +/// See the [module documentation] on how to implement [`Uniform`] range +/// sampling for a custom type. +/// +/// Implementation of [`sample_single`] is optional, and is only useful when +/// the implementation can be faster than `Self::new(low, high).sample(rng)`. +/// +/// [module documentation]: crate::distributions::uniform +/// [`sample_single`]: UniformSampler::sample_single +pub trait UniformSampler: Sized { + /// The type sampled by this implementation. + type X; + + /// Construct self, with inclusive lower bound and exclusive upper bound + /// `[low, high)`. + /// + /// Usually users should not call this directly but instead use + /// `Uniform::new`, which asserts that `low < high` before calling this. + fn new(low: B1, high: B2) -> Self + where B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized; + + /// Construct self, with inclusive bounds `[low, high]`. + /// + /// Usually users should not call this directly but instead use + /// `Uniform::new_inclusive`, which asserts that `low <= high` before + /// calling this. + fn new_inclusive(low: B1, high: B2) -> Self + where B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized; + + /// Sample a value. + fn sample(&self, rng: &mut R) -> Self::X; + + /// Sample a single value uniformly from a range with inclusive lower bound + /// and exclusive upper bound `[low, high)`. + /// + /// Usually users should not call this directly but instead use + /// `Uniform::sample_single`, which asserts that `low < high` before calling + /// this. + /// + /// Via this method, implementations can provide a method optimized for + /// sampling only a single value from the specified range. The default + /// implementation simply calls `UniformSampler::new` then `sample` on the + /// result. + fn sample_single(low: B1, high: B2, rng: &mut R) + -> Self::X + where B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized + { + let uniform: Self = UniformSampler::new(low, high); + uniform.sample(rng) + } +} + +impl From<::core::ops::Range> for Uniform { + fn from(r: ::core::ops::Range) -> Uniform { + Uniform::new(r.start, r.end) + } +} + +#[cfg(rustc_1_27)] +impl From<::core::ops::RangeInclusive> for Uniform { + fn from(r: ::core::ops::RangeInclusive) -> Uniform { + Uniform::new_inclusive(r.start(), r.end()) + } +} + +/// Helper trait similar to [`Borrow`] but implemented +/// only for SampleUniform and references to SampleUniform in +/// order to resolve ambiguity issues. +/// +/// [`Borrow`]: std::borrow::Borrow +pub trait SampleBorrow { + /// Immutably borrows from an owned value. See [`Borrow::borrow`] + /// + /// [`Borrow::borrow`]: std::borrow::Borrow::borrow + fn borrow(&self) -> &Borrowed; +} +impl SampleBorrow for Borrowed where Borrowed: SampleUniform { + #[inline(always)] + fn borrow(&self) -> &Borrowed { self } +} +impl<'a, Borrowed> SampleBorrow for &'a Borrowed where Borrowed: SampleUniform { + #[inline(always)] + fn borrow(&self) -> &Borrowed { *self } +} + +//////////////////////////////////////////////////////////////////////////////// + +// What follows are all back-ends. + + +/// The back-end implementing [`UniformSampler`] for integer types. +/// +/// Unless you are implementing [`UniformSampler`] for your own type, this type +/// should not be used directly, use [`Uniform`] instead. +/// +/// # Implementation notes +/// +/// For a closed range, the number of possible numbers we should generate is +/// `range = (high - low + 1)`. It is not possible to end up with a uniform +/// distribution if we map *all* the random integers that can be generated to +/// this range. We have to map integers from a `zone` that is a multiple of the +/// range. The rest of the integers, that cause a bias, are rejected. +/// +/// The problem with `range` is that to cover the full range of the type, it has +/// to store `unsigned_max + 1`, which can't be represented. But if the range +/// covers the full range of the type, no modulus is needed. A range of size 0 +/// can't exist, so we use that to represent this special case. Wrapping +/// arithmetic even makes representing `unsigned_max + 1` as 0 simple. +/// +/// We don't calculate `zone` directly, but first calculate the number of +/// integers to reject. To handle `unsigned_max + 1` not fitting in the type, +/// we use: +/// `ints_to_reject = (unsigned_max + 1) % range;` +/// `ints_to_reject = (unsigned_max - range + 1) % range;` +/// +/// The smallest integer PRNGs generate is `u32`. That is why for small integer +/// sizes (`i8`/`u8` and `i16`/`u16`) there is an optimization: don't pick the +/// largest zone that can fit in the small type, but pick the largest zone that +/// can fit in an `u32`. `ints_to_reject` is always less than half the size of +/// the small integer. This means the first bit of `zone` is always 1, and so +/// are all the other preceding bits of a larger integer. The easiest way to +/// grow the `zone` for the larger type is to simply sign extend it. +/// +/// An alternative to using a modulus is widening multiply: After a widening +/// multiply by `range`, the result is in the high word. Then comparing the low +/// word against `zone` makes sure our distribution is uniform. +#[derive(Clone, Copy, Debug)] +pub struct UniformInt { + low: X, + range: X, + zone: X, +} + +macro_rules! uniform_int_impl { + ($ty:ty, $signed:ty, $unsigned:ident, + $i_large:ident, $u_large:ident) => { + impl SampleUniform for $ty { + type Sampler = UniformInt<$ty>; + } + + impl UniformSampler for UniformInt<$ty> { + // We play free and fast with unsigned vs signed here + // (when $ty is signed), but that's fine, since the + // contract of this macro is for $ty and $unsigned to be + // "bit-equal", so casting between them is a no-op. + + type X = $ty; + + #[inline] // if the range is constant, this helps LLVM to do the + // calculations at compile-time. + fn new(low_b: B1, high_b: B2) -> Self + where B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized + { + let low = *low_b.borrow(); + let high = *high_b.borrow(); + assert!(low < high, "Uniform::new called with `low >= high`"); + UniformSampler::new_inclusive(low, high - 1) + } + + #[inline] // if the range is constant, this helps LLVM to do the + // calculations at compile-time. + fn new_inclusive(low_b: B1, high_b: B2) -> Self + where B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized + { + let low = *low_b.borrow(); + let high = *high_b.borrow(); + assert!(low <= high, + "Uniform::new_inclusive called with `low > high`"); + let unsigned_max = ::core::$unsigned::MAX; + + let range = high.wrapping_sub(low).wrapping_add(1) as $unsigned; + let ints_to_reject = + if range > 0 { + (unsigned_max - range + 1) % range + } else { + 0 + }; + let zone = unsigned_max - ints_to_reject; + + UniformInt { + low: low, + // These are really $unsigned values, but store as $ty: + range: range as $ty, + zone: zone as $ty + } + } + + fn sample(&self, rng: &mut R) -> Self::X { + let range = self.range as $unsigned as $u_large; + if range > 0 { + // Grow `zone` to fit a type of at least 32 bits, by + // sign-extending it (the first bit is always 1, so are all + // the preceding bits of the larger type). + // For types that already have the right size, all the + // casting is a no-op. + let zone = self.zone as $signed as $i_large as $u_large; + loop { + let v: $u_large = rng.gen(); + let (hi, lo) = v.wmul(range); + if lo <= zone { + return self.low.wrapping_add(hi as $ty); + } + } + } else { + // Sample from the entire integer range. + rng.gen() + } + } + + fn sample_single(low_b: B1, high_b: B2, rng: &mut R) + -> Self::X + where B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized + { + let low = *low_b.borrow(); + let high = *high_b.borrow(); + assert!(low < high, + "Uniform::sample_single called with low >= high"); + let range = high.wrapping_sub(low) as $unsigned as $u_large; + let zone = + if ::core::$unsigned::MAX <= ::core::u16::MAX as $unsigned { + // Using a modulus is faster than the approximation for + // i8 and i16. I suppose we trade the cost of one + // modulus for near-perfect branch prediction. + let unsigned_max: $u_large = ::core::$u_large::MAX; + let ints_to_reject = (unsigned_max - range + 1) % range; + unsigned_max - ints_to_reject + } else { + // conservative but fast approximation. `- 1` is necessary to allow the + // same comparison without bias. + (range << range.leading_zeros()).wrapping_sub(1) + }; + + loop { + let v: $u_large = rng.gen(); + let (hi, lo) = v.wmul(range); + if lo <= zone { + return low.wrapping_add(hi as $ty); + } + } + } + } + } +} + +uniform_int_impl! { i8, i8, u8, i32, u32 } +uniform_int_impl! { i16, i16, u16, i32, u32 } +uniform_int_impl! { i32, i32, u32, i32, u32 } +uniform_int_impl! { i64, i64, u64, i64, u64 } +#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] +uniform_int_impl! { i128, i128, u128, u128, u128 } +uniform_int_impl! { isize, isize, usize, isize, usize } +uniform_int_impl! { u8, i8, u8, i32, u32 } +uniform_int_impl! { u16, i16, u16, i32, u32 } +uniform_int_impl! { u32, i32, u32, i32, u32 } +uniform_int_impl! { u64, i64, u64, i64, u64 } +uniform_int_impl! { usize, isize, usize, isize, usize } +#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] +uniform_int_impl! { u128, u128, u128, i128, u128 } + +#[cfg(all(feature = "simd_support", feature = "nightly"))] +macro_rules! uniform_simd_int_impl { + ($ty:ident, $unsigned:ident, $u_scalar:ident) => { + // The "pick the largest zone that can fit in an `u32`" optimization + // is less useful here. Multiple lanes complicate things, we don't + // know the PRNG's minimal output size, and casting to a larger vector + // is generally a bad idea for SIMD performance. The user can still + // implement it manually. + + // TODO: look into `Uniform::::new(0u32, 100)` functionality + // perhaps `impl SampleUniform for $u_scalar`? + impl SampleUniform for $ty { + type Sampler = UniformInt<$ty>; + } + + impl UniformSampler for UniformInt<$ty> { + type X = $ty; + + #[inline] // if the range is constant, this helps LLVM to do the + // calculations at compile-time. + fn new(low_b: B1, high_b: B2) -> Self + where B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized + { + let low = *low_b.borrow(); + let high = *high_b.borrow(); + assert!(low.lt(high).all(), "Uniform::new called with `low >= high`"); + UniformSampler::new_inclusive(low, high - 1) + } + + #[inline] // if the range is constant, this helps LLVM to do the + // calculations at compile-time. + fn new_inclusive(low_b: B1, high_b: B2) -> Self + where B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized + { + let low = *low_b.borrow(); + let high = *high_b.borrow(); + assert!(low.le(high).all(), + "Uniform::new_inclusive called with `low > high`"); + let unsigned_max = ::core::$u_scalar::MAX; + + // NOTE: these may need to be replaced with explicitly + // wrapping operations if `packed_simd` changes + let range: $unsigned = ((high - low) + 1).cast(); + // `% 0` will panic at runtime. + let not_full_range = range.gt($unsigned::splat(0)); + // replacing 0 with `unsigned_max` allows a faster `select` + // with bitwise OR + let modulo = not_full_range.select(range, $unsigned::splat(unsigned_max)); + // wrapping addition + let ints_to_reject = (unsigned_max - range + 1) % modulo; + // When `range` is 0, `lo` of `v.wmul(range)` will always be + // zero which means only one sample is needed. + let zone = unsigned_max - ints_to_reject; + + UniformInt { + low: low, + // These are really $unsigned values, but store as $ty: + range: range.cast(), + zone: zone.cast(), + } + } + + fn sample(&self, rng: &mut R) -> Self::X { + let range: $unsigned = self.range.cast(); + let zone: $unsigned = self.zone.cast(); + + // This might seem very slow, generating a whole new + // SIMD vector for every sample rejection. For most uses + // though, the chance of rejection is small and provides good + // general performance. With multiple lanes, that chance is + // multiplied. To mitigate this, we replace only the lanes of + // the vector which fail, iteratively reducing the chance of + // rejection. The replacement method does however add a little + // overhead. Benchmarking or calculating probabilities might + // reveal contexts where this replacement method is slower. + let mut v: $unsigned = rng.gen(); + loop { + let (hi, lo) = v.wmul(range); + let mask = lo.le(zone); + if mask.all() { + let hi: $ty = hi.cast(); + // wrapping addition + let result = self.low + hi; + // `select` here compiles to a blend operation + // When `range.eq(0).none()` the compare and blend + // operations are avoided. + let v: $ty = v.cast(); + return range.gt($unsigned::splat(0)).select(result, v); + } + // Replace only the failing lanes + v = mask.select(v, rng.gen()); + } + } + } + }; + + // bulk implementation + ($(($unsigned:ident, $signed:ident),)+ $u_scalar:ident) => { + $( + uniform_simd_int_impl!($unsigned, $unsigned, $u_scalar); + uniform_simd_int_impl!($signed, $unsigned, $u_scalar); + )+ + }; +} + +#[cfg(all(feature = "simd_support", feature = "nightly"))] +uniform_simd_int_impl! { + (u64x2, i64x2), + (u64x4, i64x4), + (u64x8, i64x8), + u64 +} + +#[cfg(all(feature = "simd_support", feature = "nightly"))] +uniform_simd_int_impl! { + (u32x2, i32x2), + (u32x4, i32x4), + (u32x8, i32x8), + (u32x16, i32x16), + u32 +} + +#[cfg(all(feature = "simd_support", feature = "nightly"))] +uniform_simd_int_impl! { + (u16x2, i16x2), + (u16x4, i16x4), + (u16x8, i16x8), + (u16x16, i16x16), + (u16x32, i16x32), + u16 +} + +#[cfg(all(feature = "simd_support", feature = "nightly"))] +uniform_simd_int_impl! { + (u8x2, i8x2), + (u8x4, i8x4), + (u8x8, i8x8), + (u8x16, i8x16), + (u8x32, i8x32), + (u8x64, i8x64), + u8 +} + + +/// The back-end implementing [`UniformSampler`] for floating-point types. +/// +/// Unless you are implementing [`UniformSampler`] for your own type, this type +/// should not be used directly, use [`Uniform`] instead. +/// +/// # Implementation notes +/// +/// Instead of generating a float in the `[0, 1)` range using [`Standard`], the +/// `UniformFloat` implementation converts the output of an PRNG itself. This +/// way one or two steps can be optimized out. +/// +/// The floats are first converted to a value in the `[1, 2)` interval using a +/// transmute-based method, and then mapped to the expected range with a +/// multiply and addition. Values produced this way have what equals 22 bits of +/// random digits for an `f32`, and 52 for an `f64`. +/// +/// [`new`]: UniformSampler::new +/// [`new_inclusive`]: UniformSampler::new_inclusive +/// [`Standard`]: crate::distributions::Standard +#[derive(Clone, Copy, Debug)] +pub struct UniformFloat { + low: X, + scale: X, +} + +macro_rules! uniform_float_impl { + ($ty:ty, $uty:ident, $f_scalar:ident, $u_scalar:ident, $bits_to_discard:expr) => { + impl SampleUniform for $ty { + type Sampler = UniformFloat<$ty>; + } + + impl UniformSampler for UniformFloat<$ty> { + type X = $ty; + + fn new(low_b: B1, high_b: B2) -> Self + where B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized + { + let low = *low_b.borrow(); + let high = *high_b.borrow(); + assert!(low.all_lt(high), + "Uniform::new called with `low >= high`"); + assert!(low.all_finite() && high.all_finite(), + "Uniform::new called with non-finite boundaries"); + let max_rand = <$ty>::splat((::core::$u_scalar::MAX >> $bits_to_discard) + .into_float_with_exponent(0) - 1.0); + + let mut scale = high - low; + + loop { + let mask = (scale * max_rand + low).ge_mask(high); + if mask.none() { + break; + } + scale = scale.decrease_masked(mask); + } + + debug_assert!(<$ty>::splat(0.0).all_le(scale)); + + UniformFloat { low, scale } + } + + fn new_inclusive(low_b: B1, high_b: B2) -> Self + where B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized + { + let low = *low_b.borrow(); + let high = *high_b.borrow(); + assert!(low.all_le(high), + "Uniform::new_inclusive called with `low > high`"); + assert!(low.all_finite() && high.all_finite(), + "Uniform::new_inclusive called with non-finite boundaries"); + let max_rand = <$ty>::splat((::core::$u_scalar::MAX >> $bits_to_discard) + .into_float_with_exponent(0) - 1.0); + + let mut scale = (high - low) / max_rand; + + loop { + let mask = (scale * max_rand + low).gt_mask(high); + if mask.none() { + break; + } + scale = scale.decrease_masked(mask); + } + + debug_assert!(<$ty>::splat(0.0).all_le(scale)); + + UniformFloat { low, scale } + } + + fn sample(&self, rng: &mut R) -> Self::X { + // Generate a value in the range [1, 2) + let value1_2 = (rng.gen::<$uty>() >> $bits_to_discard) + .into_float_with_exponent(0); + + // Get a value in the range [0, 1) in order to avoid + // overflowing into infinity when multiplying with scale + let value0_1 = value1_2 - 1.0; + + // We don't use `f64::mul_add`, because it is not available with + // `no_std`. Furthermore, it is slower for some targets (but + // faster for others). However, the order of multiplication and + // addition is important, because on some platforms (e.g. ARM) + // it will be optimized to a single (non-FMA) instruction. + value0_1 * self.scale + self.low + } + + #[inline] + fn sample_single(low_b: B1, high_b: B2, rng: &mut R) + -> Self::X + where B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized + { + let low = *low_b.borrow(); + let high = *high_b.borrow(); + assert!(low.all_lt(high), + "Uniform::sample_single called with low >= high"); + let mut scale = high - low; + + loop { + // Generate a value in the range [1, 2) + let value1_2 = (rng.gen::<$uty>() >> $bits_to_discard) + .into_float_with_exponent(0); + + // Get a value in the range [0, 1) in order to avoid + // overflowing into infinity when multiplying with scale + let value0_1 = value1_2 - 1.0; + + // Doing multiply before addition allows some architectures + // to use a single instruction. + let res = value0_1 * scale + low; + + debug_assert!(low.all_le(res) || !scale.all_finite()); + if res.all_lt(high) { + return res; + } + + // This handles a number of edge cases. + // * `low` or `high` is NaN. In this case `scale` and + // `res` are going to end up as NaN. + // * `low` is negative infinity and `high` is finite. + // `scale` is going to be infinite and `res` will be + // NaN. + // * `high` is positive infinity and `low` is finite. + // `scale` is going to be infinite and `res` will + // be infinite or NaN (if value0_1 is 0). + // * `low` is negative infinity and `high` is positive + // infinity. `scale` will be infinite and `res` will + // be NaN. + // * `low` and `high` are finite, but `high - low` + // overflows to infinite. `scale` will be infinite + // and `res` will be infinite or NaN (if value0_1 is 0). + // So if `high` or `low` are non-finite, we are guaranteed + // to fail the `res < high` check above and end up here. + // + // While we technically should check for non-finite `low` + // and `high` before entering the loop, by doing the checks + // here instead, we allow the common case to avoid these + // checks. But we are still guaranteed that if `low` or + // `high` are non-finite we'll end up here and can do the + // appropriate checks. + // + // Likewise `high - low` overflowing to infinity is also + // rare, so handle it here after the common case. + let mask = !scale.finite_mask(); + if mask.any() { + assert!(low.all_finite() && high.all_finite(), + "Uniform::sample_single called with non-finite boundaries"); + scale = scale.decrease_masked(mask); + } + } + } + } + } +} + +uniform_float_impl! { f32, u32, f32, u32, 32 - 23 } +uniform_float_impl! { f64, u64, f64, u64, 64 - 52 } + +#[cfg(feature="simd_support")] +uniform_float_impl! { f32x2, u32x2, f32, u32, 32 - 23 } +#[cfg(feature="simd_support")] +uniform_float_impl! { f32x4, u32x4, f32, u32, 32 - 23 } +#[cfg(feature="simd_support")] +uniform_float_impl! { f32x8, u32x8, f32, u32, 32 - 23 } +#[cfg(feature="simd_support")] +uniform_float_impl! { f32x16, u32x16, f32, u32, 32 - 23 } + +#[cfg(feature="simd_support")] +uniform_float_impl! { f64x2, u64x2, f64, u64, 64 - 52 } +#[cfg(feature="simd_support")] +uniform_float_impl! { f64x4, u64x4, f64, u64, 64 - 52 } +#[cfg(feature="simd_support")] +uniform_float_impl! { f64x8, u64x8, f64, u64, 64 - 52 } + + + +/// The back-end implementing [`UniformSampler`] for `Duration`. +/// +/// Unless you are implementing [`UniformSampler`] for your own types, this type +/// should not be used directly, use [`Uniform`] instead. +#[cfg(any(feature = "std", rustc_1_25))] +#[derive(Clone, Copy, Debug)] +pub struct UniformDuration { + mode: UniformDurationMode, + offset: u32, +} + +#[cfg(any(feature = "std", rustc_1_25))] +#[derive(Debug, Copy, Clone)] +enum UniformDurationMode { + Small { + secs: u64, + nanos: Uniform, + }, + Medium { + nanos: Uniform, + }, + Large { + max_secs: u64, + max_nanos: u32, + secs: Uniform, + } +} + +#[cfg(any(feature = "std", rustc_1_25))] +impl SampleUniform for Duration { + type Sampler = UniformDuration; +} + +#[cfg(any(feature = "std", rustc_1_25))] +impl UniformSampler for UniformDuration { + type X = Duration; + + #[inline] + fn new(low_b: B1, high_b: B2) -> Self + where B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized + { + let low = *low_b.borrow(); + let high = *high_b.borrow(); + assert!(low < high, "Uniform::new called with `low >= high`"); + UniformDuration::new_inclusive(low, high - Duration::new(0, 1)) + } + + #[inline] + fn new_inclusive(low_b: B1, high_b: B2) -> Self + where B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized + { + let low = *low_b.borrow(); + let high = *high_b.borrow(); + assert!(low <= high, "Uniform::new_inclusive called with `low > high`"); + + let low_s = low.as_secs(); + let low_n = low.subsec_nanos(); + let mut high_s = high.as_secs(); + let mut high_n = high.subsec_nanos(); + + if high_n < low_n { + high_s = high_s - 1; + high_n = high_n + 1_000_000_000; + } + + let mode = if low_s == high_s { + UniformDurationMode::Small { + secs: low_s, + nanos: Uniform::new_inclusive(low_n, high_n), + } + } else { + let max = high_s + .checked_mul(1_000_000_000) + .and_then(|n| n.checked_add(high_n as u64)); + + if let Some(higher_bound) = max { + let lower_bound = low_s * 1_000_000_000 + low_n as u64; + UniformDurationMode::Medium { + nanos: Uniform::new_inclusive(lower_bound, higher_bound), + } + } else { + // An offset is applied to simplify generation of nanoseconds + let max_nanos = high_n - low_n; + UniformDurationMode::Large { + max_secs: high_s, + max_nanos, + secs: Uniform::new_inclusive(low_s, high_s), + } + } + }; + UniformDuration { + mode, + offset: low_n, + } + } + + #[inline] + fn sample(&self, rng: &mut R) -> Duration { + match self.mode { + UniformDurationMode::Small { secs, nanos } => { + let n = nanos.sample(rng); + Duration::new(secs, n) + } + UniformDurationMode::Medium { nanos } => { + let nanos = nanos.sample(rng); + Duration::new(nanos / 1_000_000_000, (nanos % 1_000_000_000) as u32) + } + UniformDurationMode::Large { max_secs, max_nanos, secs } => { + // constant folding means this is at least as fast as `gen_range` + let nano_range = Uniform::new(0, 1_000_000_000); + loop { + let s = secs.sample(rng); + let n = nano_range.sample(rng); + if !(s == max_secs && n > max_nanos) { + let sum = n + self.offset; + break Duration::new(s, sum); + } + } + } + } + } +} + +#[cfg(test)] +mod tests { + use Rng; + use rngs::mock::StepRng; + use distributions::uniform::Uniform; + use distributions::utils::FloatAsSIMD; + #[cfg(feature="simd_support")] use packed_simd::*; + + #[should_panic] + #[test] + fn test_uniform_bad_limits_equal_int() { + Uniform::new(10, 10); + } + + #[test] + fn test_uniform_good_limits_equal_int() { + let mut rng = ::test::rng(804); + let dist = Uniform::new_inclusive(10, 10); + for _ in 0..20 { + assert_eq!(rng.sample(dist), 10); + } + } + + #[should_panic] + #[test] + fn test_uniform_bad_limits_flipped_int() { + Uniform::new(10, 5); + } + + #[test] + fn test_integers() { + use core::{i8, i16, i32, i64, isize}; + use core::{u8, u16, u32, u64, usize}; + #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] + use core::{i128, u128}; + + let mut rng = ::test::rng(251); + macro_rules! t { + ($ty:ident, $v:expr, $le:expr, $lt:expr) => {{ + for &(low, high) in $v.iter() { + let my_uniform = Uniform::new(low, high); + for _ in 0..1000 { + let v: $ty = rng.sample(my_uniform); + assert!($le(low, v) && $lt(v, high)); + } + + let my_uniform = Uniform::new_inclusive(low, high); + for _ in 0..1000 { + let v: $ty = rng.sample(my_uniform); + assert!($le(low, v) && $le(v, high)); + } + + let my_uniform = Uniform::new(&low, high); + for _ in 0..1000 { + let v: $ty = rng.sample(my_uniform); + assert!($le(low, v) && $lt(v, high)); + } + + let my_uniform = Uniform::new_inclusive(&low, &high); + for _ in 0..1000 { + let v: $ty = rng.sample(my_uniform); + assert!($le(low, v) && $le(v, high)); + } + + for _ in 0..1000 { + let v: $ty = rng.gen_range(low, high); + assert!($le(low, v) && $lt(v, high)); + } + } + }}; + + // scalar bulk + ($($ty:ident),*) => {{ + $(t!( + $ty, + [(0, 10), (10, 127), ($ty::MIN, $ty::MAX)], + |x, y| x <= y, + |x, y| x < y + );)* + }}; + + // simd bulk + ($($ty:ident),* => $scalar:ident) => {{ + $(t!( + $ty, + [ + ($ty::splat(0), $ty::splat(10)), + ($ty::splat(10), $ty::splat(127)), + ($ty::splat($scalar::MIN), $ty::splat($scalar::MAX)), + ], + |x: $ty, y| x.le(y).all(), + |x: $ty, y| x.lt(y).all() + );)* + }}; + } + t!(i8, i16, i32, i64, isize, + u8, u16, u32, u64, usize); + #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] + t!(i128, u128); + + #[cfg(all(feature = "simd_support", feature = "nightly"))] + { + t!(u8x2, u8x4, u8x8, u8x16, u8x32, u8x64 => u8); + t!(i8x2, i8x4, i8x8, i8x16, i8x32, i8x64 => i8); + t!(u16x2, u16x4, u16x8, u16x16, u16x32 => u16); + t!(i16x2, i16x4, i16x8, i16x16, i16x32 => i16); + t!(u32x2, u32x4, u32x8, u32x16 => u32); + t!(i32x2, i32x4, i32x8, i32x16 => i32); + t!(u64x2, u64x4, u64x8 => u64); + t!(i64x2, i64x4, i64x8 => i64); + } + } + + #[test] + fn test_floats() { + let mut rng = ::test::rng(252); + let mut zero_rng = StepRng::new(0, 0); + let mut max_rng = StepRng::new(0xffff_ffff_ffff_ffff, 0); + macro_rules! t { + ($ty:ty, $f_scalar:ident, $bits_shifted:expr) => {{ + let v: &[($f_scalar, $f_scalar)]= + &[(0.0, 100.0), + (-1e35, -1e25), + (1e-35, 1e-25), + (-1e35, 1e35), + (<$f_scalar>::from_bits(0), <$f_scalar>::from_bits(3)), + (-<$f_scalar>::from_bits(10), -<$f_scalar>::from_bits(1)), + (-<$f_scalar>::from_bits(5), 0.0), + (-<$f_scalar>::from_bits(7), -0.0), + (10.0, ::core::$f_scalar::MAX), + (-100.0, ::core::$f_scalar::MAX), + (-::core::$f_scalar::MAX / 5.0, ::core::$f_scalar::MAX), + (-::core::$f_scalar::MAX, ::core::$f_scalar::MAX / 5.0), + (-::core::$f_scalar::MAX * 0.8, ::core::$f_scalar::MAX * 0.7), + (-::core::$f_scalar::MAX, ::core::$f_scalar::MAX), + ]; + for &(low_scalar, high_scalar) in v.iter() { + for lane in 0..<$ty>::lanes() { + let low = <$ty>::splat(0.0 as $f_scalar).replace(lane, low_scalar); + let high = <$ty>::splat(1.0 as $f_scalar).replace(lane, high_scalar); + let my_uniform = Uniform::new(low, high); + let my_incl_uniform = Uniform::new_inclusive(low, high); + for _ in 0..100 { + let v = rng.sample(my_uniform).extract(lane); + assert!(low_scalar <= v && v < high_scalar); + let v = rng.sample(my_incl_uniform).extract(lane); + assert!(low_scalar <= v && v <= high_scalar); + let v = rng.gen_range(low, high).extract(lane); + assert!(low_scalar <= v && v < high_scalar); + } + + assert_eq!(rng.sample(Uniform::new_inclusive(low, low)).extract(lane), low_scalar); + + assert_eq!(zero_rng.sample(my_uniform).extract(lane), low_scalar); + assert_eq!(zero_rng.sample(my_incl_uniform).extract(lane), low_scalar); + assert_eq!(zero_rng.gen_range(low, high).extract(lane), low_scalar); + assert!(max_rng.sample(my_uniform).extract(lane) < high_scalar); + assert!(max_rng.sample(my_incl_uniform).extract(lane) <= high_scalar); + + // Don't run this test for really tiny differences between high and low + // since for those rounding might result in selecting high for a very + // long time. + if (high_scalar - low_scalar) > 0.0001 { + let mut lowering_max_rng = + StepRng::new(0xffff_ffff_ffff_ffff, + (-1i64 << $bits_shifted) as u64); + assert!(lowering_max_rng.gen_range(low, high).extract(lane) < high_scalar); + } + } + } + + assert_eq!(rng.sample(Uniform::new_inclusive(::core::$f_scalar::MAX, + ::core::$f_scalar::MAX)), + ::core::$f_scalar::MAX); + assert_eq!(rng.sample(Uniform::new_inclusive(-::core::$f_scalar::MAX, + -::core::$f_scalar::MAX)), + -::core::$f_scalar::MAX); + }} + } + + t!(f32, f32, 32 - 23); + t!(f64, f64, 64 - 52); + #[cfg(feature="simd_support")] + { + t!(f32x2, f32, 32 - 23); + t!(f32x4, f32, 32 - 23); + t!(f32x8, f32, 32 - 23); + t!(f32x16, f32, 32 - 23); + t!(f64x2, f64, 64 - 52); + t!(f64x4, f64, 64 - 52); + t!(f64x8, f64, 64 - 52); + } + } + + #[test] + #[cfg(all(feature="std", + not(target_arch = "wasm32"), + not(target_arch = "asmjs")))] + fn test_float_assertions() { + use std::panic::catch_unwind; + use super::SampleUniform; + fn range(low: T, high: T) { + let mut rng = ::test::rng(253); + rng.gen_range(low, high); + } + + macro_rules! t { + ($ty:ident, $f_scalar:ident) => {{ + let v: &[($f_scalar, $f_scalar)] = + &[(::std::$f_scalar::NAN, 0.0), + (1.0, ::std::$f_scalar::NAN), + (::std::$f_scalar::NAN, ::std::$f_scalar::NAN), + (1.0, 0.5), + (::std::$f_scalar::MAX, -::std::$f_scalar::MAX), + (::std::$f_scalar::INFINITY, ::std::$f_scalar::INFINITY), + (::std::$f_scalar::NEG_INFINITY, ::std::$f_scalar::NEG_INFINITY), + (::std::$f_scalar::NEG_INFINITY, 5.0), + (5.0, ::std::$f_scalar::INFINITY), + (::std::$f_scalar::NAN, ::std::$f_scalar::INFINITY), + (::std::$f_scalar::NEG_INFINITY, ::std::$f_scalar::NAN), + (::std::$f_scalar::NEG_INFINITY, ::std::$f_scalar::INFINITY), + ]; + for &(low_scalar, high_scalar) in v.iter() { + for lane in 0..<$ty>::lanes() { + let low = <$ty>::splat(0.0 as $f_scalar).replace(lane, low_scalar); + let high = <$ty>::splat(1.0 as $f_scalar).replace(lane, high_scalar); + assert!(catch_unwind(|| range(low, high)).is_err()); + assert!(catch_unwind(|| Uniform::new(low, high)).is_err()); + assert!(catch_unwind(|| Uniform::new_inclusive(low, high)).is_err()); + assert!(catch_unwind(|| range(low, low)).is_err()); + assert!(catch_unwind(|| Uniform::new(low, low)).is_err()); + } + } + }} + } + + t!(f32, f32); + t!(f64, f64); + #[cfg(feature="simd_support")] + { + t!(f32x2, f32); + t!(f32x4, f32); + t!(f32x8, f32); + t!(f32x16, f32); + t!(f64x2, f64); + t!(f64x4, f64); + t!(f64x8, f64); + } + } + + + #[test] + #[cfg(any(feature = "std", rustc_1_25))] + fn test_durations() { + #[cfg(feature = "std")] + use std::time::Duration; + #[cfg(all(not(feature = "std"), rustc_1_25))] + use core::time::Duration; + + let mut rng = ::test::rng(253); + + let v = &[(Duration::new(10, 50000), Duration::new(100, 1234)), + (Duration::new(0, 100), Duration::new(1, 50)), + (Duration::new(0, 0), Duration::new(u64::max_value(), 999_999_999))]; + for &(low, high) in v.iter() { + let my_uniform = Uniform::new(low, high); + for _ in 0..1000 { + let v = rng.sample(my_uniform); + assert!(low <= v && v < high); + } + } + } + + #[test] + fn test_custom_uniform() { + use distributions::uniform::{UniformSampler, UniformFloat, SampleUniform, SampleBorrow}; + #[derive(Clone, Copy, PartialEq, PartialOrd)] + struct MyF32 { + x: f32, + } + #[derive(Clone, Copy, Debug)] + struct UniformMyF32 { + inner: UniformFloat, + } + impl UniformSampler for UniformMyF32 { + type X = MyF32; + fn new(low: B1, high: B2) -> Self + where B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized + { + UniformMyF32 { + inner: UniformFloat::::new(low.borrow().x, high.borrow().x), + } + } + fn new_inclusive(low: B1, high: B2) -> Self + where B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized + { + UniformSampler::new(low, high) + } + fn sample(&self, rng: &mut R) -> Self::X { + MyF32 { x: self.inner.sample(rng) } + } + } + impl SampleUniform for MyF32 { + type Sampler = UniformMyF32; + } + + let (low, high) = (MyF32{ x: 17.0f32 }, MyF32{ x: 22.0f32 }); + let uniform = Uniform::new(low, high); + let mut rng = ::test::rng(804); + for _ in 0..100 { + let x: MyF32 = rng.sample(uniform); + assert!(low <= x && x < high); + } + } + + #[test] + fn test_uniform_from_std_range() { + let r = Uniform::from(2u32..7); + assert_eq!(r.inner.low, 2); + assert_eq!(r.inner.range, 5); + let r = Uniform::from(2.0f64..7.0); + assert_eq!(r.inner.low, 2.0); + assert_eq!(r.inner.scale, 5.0); + } + + #[cfg(rustc_1_27)] + #[test] + fn test_uniform_from_std_range_inclusive() { + let r = Uniform::from(2u32..=6); + assert_eq!(r.inner.low, 2); + assert_eq!(r.inner.range, 5); + let r = Uniform::from(2.0f64..=7.0); + assert_eq!(r.inner.low, 2.0); + assert!(r.inner.scale > 5.0); + assert!(r.inner.scale < 5.0 + 1e-14); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/unit_circle.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/unit_circle.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/unit_circle.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/unit_circle.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,101 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use Rng; +use distributions::{Distribution, Uniform}; + +/// Samples uniformly from the edge of the unit circle in two dimensions. +/// +/// Implemented via a method by von Neumann[^1]. +/// +/// +/// # Example +/// +/// ``` +/// use rand::distributions::{UnitCircle, Distribution}; +/// +/// let circle = UnitCircle::new(); +/// let v = circle.sample(&mut rand::thread_rng()); +/// println!("{:?} is from the unit circle.", v) +/// ``` +/// +/// [^1]: von Neumann, J. (1951) [*Various Techniques Used in Connection with +/// Random Digits.*](https://mcnp.lanl.gov/pdf_files/nbs_vonneumann.pdf) +/// NBS Appl. Math. Ser., No. 12. Washington, DC: U.S. Government Printing +/// Office, pp. 36-38. +#[derive(Clone, Copy, Debug)] +pub struct UnitCircle; + +impl UnitCircle { + /// Construct a new `UnitCircle` distribution. + #[inline] + pub fn new() -> UnitCircle { + UnitCircle + } +} + +impl Distribution<[f64; 2]> for UnitCircle { + #[inline] + fn sample(&self, rng: &mut R) -> [f64; 2] { + let uniform = Uniform::new(-1., 1.); + let mut x1; + let mut x2; + let mut sum; + loop { + x1 = uniform.sample(rng); + x2 = uniform.sample(rng); + sum = x1*x1 + x2*x2; + if sum < 1. { + break; + } + } + let diff = x1*x1 - x2*x2; + [diff / sum, 2.*x1*x2 / sum] + } +} + +#[cfg(test)] +mod tests { + use distributions::Distribution; + use super::UnitCircle; + + /// Assert that two numbers are almost equal to each other. + /// + /// On panic, this macro will print the values of the expressions with their + /// debug representations. + macro_rules! assert_almost_eq { + ($a:expr, $b:expr, $prec:expr) => ( + let diff = ($a - $b).abs(); + if diff > $prec { + panic!(format!( + "assertion failed: `abs(left - right) = {:.1e} < {:e}`, \ + (left: `{}`, right: `{}`)", + diff, $prec, $a, $b)); + } + ); + } + + #[test] + fn norm() { + let mut rng = ::test::rng(1); + let dist = UnitCircle::new(); + for _ in 0..1000 { + let x = dist.sample(&mut rng); + assert_almost_eq!(x[0]*x[0] + x[1]*x[1], 1., 1e-15); + } + } + + #[test] + fn value_stability() { + let mut rng = ::test::rng(2); + let dist = UnitCircle::new(); + assert_eq!(dist.sample(&mut rng), [-0.8032118336637037, 0.5956935036263119]); + assert_eq!(dist.sample(&mut rng), [-0.4742919588505423, -0.880367615130018]); + assert_eq!(dist.sample(&mut rng), [0.9297328981467168, 0.368234623716601]); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/unit_sphere.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/unit_sphere.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/unit_sphere.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/unit_sphere.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,99 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use Rng; +use distributions::{Distribution, Uniform}; + +/// Samples uniformly from the surface of the unit sphere in three dimensions. +/// +/// Implemented via a method by Marsaglia[^1]. +/// +/// +/// # Example +/// +/// ``` +/// use rand::distributions::{UnitSphereSurface, Distribution}; +/// +/// let sphere = UnitSphereSurface::new(); +/// let v = sphere.sample(&mut rand::thread_rng()); +/// println!("{:?} is from the unit sphere surface.", v) +/// ``` +/// +/// [^1]: Marsaglia, George (1972). [*Choosing a Point from the Surface of a +/// Sphere.*](https://doi.org/10.1214/aoms/1177692644) +/// Ann. Math. Statist. 43, no. 2, 645--646. +#[derive(Clone, Copy, Debug)] +pub struct UnitSphereSurface; + +impl UnitSphereSurface { + /// Construct a new `UnitSphereSurface` distribution. + #[inline] + pub fn new() -> UnitSphereSurface { + UnitSphereSurface + } +} + +impl Distribution<[f64; 3]> for UnitSphereSurface { + #[inline] + fn sample(&self, rng: &mut R) -> [f64; 3] { + let uniform = Uniform::new(-1., 1.); + loop { + let (x1, x2) = (uniform.sample(rng), uniform.sample(rng)); + let sum = x1*x1 + x2*x2; + if sum >= 1. { + continue; + } + let factor = 2. * (1.0_f64 - sum).sqrt(); + return [x1 * factor, x2 * factor, 1. - 2.*sum]; + } + } +} + +#[cfg(test)] +mod tests { + use distributions::Distribution; + use super::UnitSphereSurface; + + /// Assert that two numbers are almost equal to each other. + /// + /// On panic, this macro will print the values of the expressions with their + /// debug representations. + macro_rules! assert_almost_eq { + ($a:expr, $b:expr, $prec:expr) => ( + let diff = ($a - $b).abs(); + if diff > $prec { + panic!(format!( + "assertion failed: `abs(left - right) = {:.1e} < {:e}`, \ + (left: `{}`, right: `{}`)", + diff, $prec, $a, $b)); + } + ); + } + + #[test] + fn norm() { + let mut rng = ::test::rng(1); + let dist = UnitSphereSurface::new(); + for _ in 0..1000 { + let x = dist.sample(&mut rng); + assert_almost_eq!(x[0]*x[0] + x[1]*x[1] + x[2]*x[2], 1., 1e-15); + } + } + + #[test] + fn value_stability() { + let mut rng = ::test::rng(2); + let dist = UnitSphereSurface::new(); + assert_eq!(dist.sample(&mut rng), + [-0.24950027180862533, -0.7552572587896719, 0.6060825747478084]); + assert_eq!(dist.sample(&mut rng), + [0.47604534507233487, -0.797200864987207, -0.3712837328763685]); + assert_eq!(dist.sample(&mut rng), + [0.9795722330927367, 0.18692349236651176, 0.07414747571708524]); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/utils.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/utils.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/utils.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/utils.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,504 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Math helper functions + +#[cfg(feature="simd_support")] +use packed_simd::*; +#[cfg(feature="std")] +use distributions::ziggurat_tables; +#[cfg(feature="std")] +use Rng; + + +pub trait WideningMultiply { + type Output; + + fn wmul(self, x: RHS) -> Self::Output; +} + +macro_rules! wmul_impl { + ($ty:ty, $wide:ty, $shift:expr) => { + impl WideningMultiply for $ty { + type Output = ($ty, $ty); + + #[inline(always)] + fn wmul(self, x: $ty) -> Self::Output { + let tmp = (self as $wide) * (x as $wide); + ((tmp >> $shift) as $ty, tmp as $ty) + } + } + }; + + // simd bulk implementation + ($(($ty:ident, $wide:ident),)+, $shift:expr) => { + $( + impl WideningMultiply for $ty { + type Output = ($ty, $ty); + + #[inline(always)] + fn wmul(self, x: $ty) -> Self::Output { + // For supported vectors, this should compile to a couple + // supported multiply & swizzle instructions (no actual + // casting). + // TODO: optimize + let y: $wide = self.cast(); + let x: $wide = x.cast(); + let tmp = y * x; + let hi: $ty = (tmp >> $shift).cast(); + let lo: $ty = tmp.cast(); + (hi, lo) + } + } + )+ + }; +} +wmul_impl! { u8, u16, 8 } +wmul_impl! { u16, u32, 16 } +wmul_impl! { u32, u64, 32 } +#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] +wmul_impl! { u64, u128, 64 } + +// This code is a translation of the __mulddi3 function in LLVM's +// compiler-rt. It is an optimised variant of the common method +// `(a + b) * (c + d) = ac + ad + bc + bd`. +// +// For some reason LLVM can optimise the C version very well, but +// keeps shuffling registers in this Rust translation. +macro_rules! wmul_impl_large { + ($ty:ty, $half:expr) => { + impl WideningMultiply for $ty { + type Output = ($ty, $ty); + + #[inline(always)] + fn wmul(self, b: $ty) -> Self::Output { + const LOWER_MASK: $ty = !0 >> $half; + let mut low = (self & LOWER_MASK).wrapping_mul(b & LOWER_MASK); + let mut t = low >> $half; + low &= LOWER_MASK; + t += (self >> $half).wrapping_mul(b & LOWER_MASK); + low += (t & LOWER_MASK) << $half; + let mut high = t >> $half; + t = low >> $half; + low &= LOWER_MASK; + t += (b >> $half).wrapping_mul(self & LOWER_MASK); + low += (t & LOWER_MASK) << $half; + high += t >> $half; + high += (self >> $half).wrapping_mul(b >> $half); + + (high, low) + } + } + }; + + // simd bulk implementation + (($($ty:ty,)+) $scalar:ty, $half:expr) => { + $( + impl WideningMultiply for $ty { + type Output = ($ty, $ty); + + #[inline(always)] + fn wmul(self, b: $ty) -> Self::Output { + // needs wrapping multiplication + const LOWER_MASK: $scalar = !0 >> $half; + let mut low = (self & LOWER_MASK) * (b & LOWER_MASK); + let mut t = low >> $half; + low &= LOWER_MASK; + t += (self >> $half) * (b & LOWER_MASK); + low += (t & LOWER_MASK) << $half; + let mut high = t >> $half; + t = low >> $half; + low &= LOWER_MASK; + t += (b >> $half) * (self & LOWER_MASK); + low += (t & LOWER_MASK) << $half; + high += t >> $half; + high += (self >> $half) * (b >> $half); + + (high, low) + } + } + )+ + }; +} +#[cfg(not(all(rustc_1_26, not(target_os = "emscripten"))))] +wmul_impl_large! { u64, 32 } +#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] +wmul_impl_large! { u128, 64 } + +macro_rules! wmul_impl_usize { + ($ty:ty) => { + impl WideningMultiply for usize { + type Output = (usize, usize); + + #[inline(always)] + fn wmul(self, x: usize) -> Self::Output { + let (high, low) = (self as $ty).wmul(x as $ty); + (high as usize, low as usize) + } + } + } +} +#[cfg(target_pointer_width = "32")] +wmul_impl_usize! { u32 } +#[cfg(target_pointer_width = "64")] +wmul_impl_usize! { u64 } + +#[cfg(all(feature = "simd_support", feature = "nightly"))] +mod simd_wmul { + #[cfg(target_arch = "x86")] + use core::arch::x86::*; + #[cfg(target_arch = "x86_64")] + use core::arch::x86_64::*; + use super::*; + + wmul_impl! { + (u8x2, u16x2), + (u8x4, u16x4), + (u8x8, u16x8), + (u8x16, u16x16), + (u8x32, u16x32),, + 8 + } + + wmul_impl! { (u16x2, u32x2),, 16 } + #[cfg(not(target_feature = "sse2"))] + wmul_impl! { (u16x4, u32x4),, 16 } + #[cfg(not(target_feature = "sse4.2"))] + wmul_impl! { (u16x8, u32x8),, 16 } + #[cfg(not(target_feature = "avx2"))] + wmul_impl! { (u16x16, u32x16),, 16 } + + // 16-bit lane widths allow use of the x86 `mulhi` instructions, which + // means `wmul` can be implemented with only two instructions. + #[allow(unused_macros)] + macro_rules! wmul_impl_16 { + ($ty:ident, $intrinsic:ident, $mulhi:ident, $mullo:ident) => { + impl WideningMultiply for $ty { + type Output = ($ty, $ty); + + #[inline(always)] + fn wmul(self, x: $ty) -> Self::Output { + let b = $intrinsic::from_bits(x); + let a = $intrinsic::from_bits(self); + let hi = $ty::from_bits(unsafe { $mulhi(a, b) }); + let lo = $ty::from_bits(unsafe { $mullo(a, b) }); + (hi, lo) + } + } + }; + } + + #[cfg(target_feature = "sse2")] + wmul_impl_16! { u16x4, __m64, _mm_mulhi_pu16, _mm_mullo_pi16 } + #[cfg(target_feature = "sse4.2")] + wmul_impl_16! { u16x8, __m128i, _mm_mulhi_epu16, _mm_mullo_epi16 } + #[cfg(target_feature = "avx2")] + wmul_impl_16! { u16x16, __m256i, _mm256_mulhi_epu16, _mm256_mullo_epi16 } + // FIXME: there are no `__m512i` types in stdsimd yet, so `wmul::` + // cannot use the same implementation. + + wmul_impl! { + (u32x2, u64x2), + (u32x4, u64x4), + (u32x8, u64x8),, + 32 + } + + // TODO: optimize, this seems to seriously slow things down + wmul_impl_large! { (u8x64,) u8, 4 } + wmul_impl_large! { (u16x32,) u16, 8 } + wmul_impl_large! { (u32x16,) u32, 16 } + wmul_impl_large! { (u64x2, u64x4, u64x8,) u64, 32 } +} +#[cfg(all(feature = "simd_support", feature = "nightly"))] +pub use self::simd_wmul::*; + + +/// Helper trait when dealing with scalar and SIMD floating point types. +pub(crate) trait FloatSIMDUtils { + // `PartialOrd` for vectors compares lexicographically. We want to compare all + // the individual SIMD lanes instead, and get the combined result over all + // lanes. This is possible using something like `a.lt(b).all()`, but we + // implement it as a trait so we can write the same code for `f32` and `f64`. + // Only the comparison functions we need are implemented. + fn all_lt(self, other: Self) -> bool; + fn all_le(self, other: Self) -> bool; + fn all_finite(self) -> bool; + + type Mask; + fn finite_mask(self) -> Self::Mask; + fn gt_mask(self, other: Self) -> Self::Mask; + fn ge_mask(self, other: Self) -> Self::Mask; + + // Decrease all lanes where the mask is `true` to the next lower value + // representable by the floating-point type. At least one of the lanes + // must be set. + fn decrease_masked(self, mask: Self::Mask) -> Self; + + // Convert from int value. Conversion is done while retaining the numerical + // value, not by retaining the binary representation. + type UInt; + fn cast_from_int(i: Self::UInt) -> Self; +} + +/// Implement functions available in std builds but missing from core primitives +#[cfg(not(std))] +pub(crate) trait Float : Sized { + type Bits; + + fn is_nan(self) -> bool; + fn is_infinite(self) -> bool; + fn is_finite(self) -> bool; + fn to_bits(self) -> Self::Bits; + fn from_bits(v: Self::Bits) -> Self; +} + +/// Implement functions on f32/f64 to give them APIs similar to SIMD types +pub(crate) trait FloatAsSIMD : Sized { + #[inline(always)] + fn lanes() -> usize { 1 } + #[inline(always)] + fn splat(scalar: Self) -> Self { scalar } + #[inline(always)] + fn extract(self, index: usize) -> Self { debug_assert_eq!(index, 0); self } + #[inline(always)] + fn replace(self, index: usize, new_value: Self) -> Self { debug_assert_eq!(index, 0); new_value } +} + +pub(crate) trait BoolAsSIMD : Sized { + fn any(self) -> bool; + fn all(self) -> bool; + fn none(self) -> bool; +} + +impl BoolAsSIMD for bool { + #[inline(always)] + fn any(self) -> bool { self } + #[inline(always)] + fn all(self) -> bool { self } + #[inline(always)] + fn none(self) -> bool { !self } +} + +macro_rules! scalar_float_impl { + ($ty:ident, $uty:ident) => { + #[cfg(not(std))] + impl Float for $ty { + type Bits = $uty; + + #[inline] + fn is_nan(self) -> bool { + self != self + } + + #[inline] + fn is_infinite(self) -> bool { + self == ::core::$ty::INFINITY || self == ::core::$ty::NEG_INFINITY + } + + #[inline] + fn is_finite(self) -> bool { + !(self.is_nan() || self.is_infinite()) + } + + #[inline] + fn to_bits(self) -> Self::Bits { + unsafe { ::core::mem::transmute(self) } + } + + #[inline] + fn from_bits(v: Self::Bits) -> Self { + // It turns out the safety issues with sNaN were overblown! Hooray! + unsafe { ::core::mem::transmute(v) } + } + } + + impl FloatSIMDUtils for $ty { + type Mask = bool; + #[inline(always)] + fn all_lt(self, other: Self) -> bool { self < other } + #[inline(always)] + fn all_le(self, other: Self) -> bool { self <= other } + #[inline(always)] + fn all_finite(self) -> bool { self.is_finite() } + #[inline(always)] + fn finite_mask(self) -> Self::Mask { self.is_finite() } + #[inline(always)] + fn gt_mask(self, other: Self) -> Self::Mask { self > other } + #[inline(always)] + fn ge_mask(self, other: Self) -> Self::Mask { self >= other } + #[inline(always)] + fn decrease_masked(self, mask: Self::Mask) -> Self { + debug_assert!(mask, "At least one lane must be set"); + <$ty>::from_bits(self.to_bits() - 1) + } + type UInt = $uty; + fn cast_from_int(i: Self::UInt) -> Self { i as $ty } + } + + impl FloatAsSIMD for $ty {} + } +} + +scalar_float_impl!(f32, u32); +scalar_float_impl!(f64, u64); + + +#[cfg(feature="simd_support")] +macro_rules! simd_impl { + ($ty:ident, $f_scalar:ident, $mty:ident, $uty:ident) => { + impl FloatSIMDUtils for $ty { + type Mask = $mty; + #[inline(always)] + fn all_lt(self, other: Self) -> bool { self.lt(other).all() } + #[inline(always)] + fn all_le(self, other: Self) -> bool { self.le(other).all() } + #[inline(always)] + fn all_finite(self) -> bool { self.finite_mask().all() } + #[inline(always)] + fn finite_mask(self) -> Self::Mask { + // This can possibly be done faster by checking bit patterns + let neg_inf = $ty::splat(::core::$f_scalar::NEG_INFINITY); + let pos_inf = $ty::splat(::core::$f_scalar::INFINITY); + self.gt(neg_inf) & self.lt(pos_inf) + } + #[inline(always)] + fn gt_mask(self, other: Self) -> Self::Mask { self.gt(other) } + #[inline(always)] + fn ge_mask(self, other: Self) -> Self::Mask { self.ge(other) } + #[inline(always)] + fn decrease_masked(self, mask: Self::Mask) -> Self { + // Casting a mask into ints will produce all bits set for + // true, and 0 for false. Adding that to the binary + // representation of a float means subtracting one from + // the binary representation, resulting in the next lower + // value representable by $ty. This works even when the + // current value is infinity. + debug_assert!(mask.any(), "At least one lane must be set"); + <$ty>::from_bits(<$uty>::from_bits(self) + <$uty>::from_bits(mask)) + } + type UInt = $uty; + fn cast_from_int(i: Self::UInt) -> Self { i.cast() } + } + } +} + +#[cfg(feature="simd_support")] simd_impl! { f32x2, f32, m32x2, u32x2 } +#[cfg(feature="simd_support")] simd_impl! { f32x4, f32, m32x4, u32x4 } +#[cfg(feature="simd_support")] simd_impl! { f32x8, f32, m32x8, u32x8 } +#[cfg(feature="simd_support")] simd_impl! { f32x16, f32, m32x16, u32x16 } +#[cfg(feature="simd_support")] simd_impl! { f64x2, f64, m64x2, u64x2 } +#[cfg(feature="simd_support")] simd_impl! { f64x4, f64, m64x4, u64x4 } +#[cfg(feature="simd_support")] simd_impl! { f64x8, f64, m64x8, u64x8 } + +/// Calculates ln(gamma(x)) (natural logarithm of the gamma +/// function) using the Lanczos approximation. +/// +/// The approximation expresses the gamma function as: +/// `gamma(z+1) = sqrt(2*pi)*(z+g+0.5)^(z+0.5)*exp(-z-g-0.5)*Ag(z)` +/// `g` is an arbitrary constant; we use the approximation with `g=5`. +/// +/// Noting that `gamma(z+1) = z*gamma(z)` and applying `ln` to both sides: +/// `ln(gamma(z)) = (z+0.5)*ln(z+g+0.5)-(z+g+0.5) + ln(sqrt(2*pi)*Ag(z)/z)` +/// +/// `Ag(z)` is an infinite series with coefficients that can be calculated +/// ahead of time - we use just the first 6 terms, which is good enough +/// for most purposes. +#[cfg(feature="std")] +pub fn log_gamma(x: f64) -> f64 { + // precalculated 6 coefficients for the first 6 terms of the series + let coefficients: [f64; 6] = [ + 76.18009172947146, + -86.50532032941677, + 24.01409824083091, + -1.231739572450155, + 0.1208650973866179e-2, + -0.5395239384953e-5, + ]; + + // (x+0.5)*ln(x+g+0.5)-(x+g+0.5) + let tmp = x + 5.5; + let log = (x + 0.5) * tmp.ln() - tmp; + + // the first few terms of the series for Ag(x) + let mut a = 1.000000000190015; + let mut denom = x; + for coeff in &coefficients { + denom += 1.0; + a += coeff / denom; + } + + // get everything together + // a is Ag(x) + // 2.5066... is sqrt(2pi) + log + (2.5066282746310005 * a / x).ln() +} + +/// Sample a random number using the Ziggurat method (specifically the +/// ZIGNOR variant from Doornik 2005). Most of the arguments are +/// directly from the paper: +/// +/// * `rng`: source of randomness +/// * `symmetric`: whether this is a symmetric distribution, or one-sided with P(x < 0) = 0. +/// * `X`: the $x_i$ abscissae. +/// * `F`: precomputed values of the PDF at the $x_i$, (i.e. $f(x_i)$) +/// * `F_DIFF`: precomputed values of $f(x_i) - f(x_{i+1})$ +/// * `pdf`: the probability density function +/// * `zero_case`: manual sampling from the tail when we chose the +/// bottom box (i.e. i == 0) + +// the perf improvement (25-50%) is definitely worth the extra code +// size from force-inlining. +#[cfg(feature="std")] +#[inline(always)] +pub fn ziggurat( + rng: &mut R, + symmetric: bool, + x_tab: ziggurat_tables::ZigTable, + f_tab: ziggurat_tables::ZigTable, + mut pdf: P, + mut zero_case: Z) + -> f64 where P: FnMut(f64) -> f64, Z: FnMut(&mut R, f64) -> f64 { + use distributions::float::IntoFloat; + loop { + // As an optimisation we re-implement the conversion to a f64. + // From the remaining 12 most significant bits we use 8 to construct `i`. + // This saves us generating a whole extra random number, while the added + // precision of using 64 bits for f64 does not buy us much. + let bits = rng.next_u64(); + let i = bits as usize & 0xff; + + let u = if symmetric { + // Convert to a value in the range [2,4) and substract to get [-1,1) + // We can't convert to an open range directly, that would require + // substracting `3.0 - EPSILON`, which is not representable. + // It is possible with an extra step, but an open range does not + // seem neccesary for the ziggurat algorithm anyway. + (bits >> 12).into_float_with_exponent(1) - 3.0 + } else { + // Convert to a value in the range [1,2) and substract to get (0,1) + (bits >> 12).into_float_with_exponent(0) + - (1.0 - ::core::f64::EPSILON / 2.0) + }; + let x = u * x_tab[i]; + + let test_x = if symmetric { x.abs() } else {x}; + + // algebraically equivalent to |u| < x_tab[i+1]/x_tab[i] (or u < x_tab[i+1]/x_tab[i]) + if test_x < x_tab[i + 1] { + return x; + } + if i == 0 { + return zero_case(rng, u); + } + // algebraically equivalent to f1 + DRanU()*(f0 - f1) < 1 + if f_tab[i + 1] + (f_tab[i] - f_tab[i + 1]) * rng.gen::() < pdf(x) { + return x; + } + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/weibull.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/weibull.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/weibull.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/weibull.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,71 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The Weibull distribution. + +use Rng; +use distributions::{Distribution, OpenClosed01}; + +/// Samples floating-point numbers according to the Weibull distribution +/// +/// # Example +/// ``` +/// use rand::prelude::*; +/// use rand::distributions::Weibull; +/// +/// let val: f64 = SmallRng::from_entropy().sample(Weibull::new(1., 10.)); +/// println!("{}", val); +/// ``` +#[derive(Clone, Copy, Debug)] +pub struct Weibull { + inv_shape: f64, + scale: f64, +} + +impl Weibull { + /// Construct a new `Weibull` distribution with given `scale` and `shape`. + /// + /// # Panics + /// + /// `scale` and `shape` have to be non-zero and positive. + pub fn new(scale: f64, shape: f64) -> Weibull { + assert!((scale > 0.) & (shape > 0.)); + Weibull { inv_shape: 1./shape, scale } + } +} + +impl Distribution for Weibull { + fn sample(&self, rng: &mut R) -> f64 { + let x: f64 = rng.sample(OpenClosed01); + self.scale * (-x.ln()).powf(self.inv_shape) + } +} + +#[cfg(test)] +mod tests { + use distributions::Distribution; + use super::Weibull; + + #[test] + #[should_panic] + fn invalid() { + Weibull::new(0., 0.); + } + + #[test] + fn sample() { + let scale = 1.0; + let shape = 2.0; + let d = Weibull::new(scale, shape); + let mut rng = ::test::rng(1); + for _ in 0..1000 { + let r = d.sample(&mut rng); + assert!(r >= 0.); + } + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/weighted.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/weighted.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/weighted.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/weighted.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,230 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use Rng; +use distributions::Distribution; +use distributions::uniform::{UniformSampler, SampleUniform, SampleBorrow}; +use ::core::cmp::PartialOrd; +use core::fmt; + +// Note that this whole module is only imported if feature="alloc" is enabled. +#[cfg(not(feature="std"))] use alloc::vec::Vec; + +/// A distribution using weighted sampling to pick a discretely selected +/// item. +/// +/// Sampling a `WeightedIndex` distribution returns the index of a randomly +/// selected element from the iterator used when the `WeightedIndex` was +/// created. The chance of a given element being picked is proportional to the +/// value of the element. The weights can use any type `X` for which an +/// implementation of [`Uniform`] exists. +/// +/// # Performance +/// +/// A `WeightedIndex` contains a `Vec` and a [`Uniform`] and so its +/// size is the sum of the size of those objects, possibly plus some alignment. +/// +/// Creating a `WeightedIndex` will allocate enough space to hold `N - 1` +/// weights of type `X`, where `N` is the number of weights. However, since +/// `Vec` doesn't guarantee a particular growth strategy, additional memory +/// might be allocated but not used. Since the `WeightedIndex` object also +/// contains, this might cause additional allocations, though for primitive +/// types, ['Uniform`] doesn't allocate any memory. +/// +/// Time complexity of sampling from `WeightedIndex` is `O(log N)` where +/// `N` is the number of weights. +/// +/// Sampling from `WeightedIndex` will result in a single call to +/// `Uniform::sample` (method of the [`Distribution`] trait), which typically +/// will request a single value from the underlying [`RngCore`], though the +/// exact number depends on the implementaiton of `Uniform::sample`. +/// +/// # Example +/// +/// ``` +/// use rand::prelude::*; +/// use rand::distributions::WeightedIndex; +/// +/// let choices = ['a', 'b', 'c']; +/// let weights = [2, 1, 1]; +/// let dist = WeightedIndex::new(&weights).unwrap(); +/// let mut rng = thread_rng(); +/// for _ in 0..100 { +/// // 50% chance to print 'a', 25% chance to print 'b', 25% chance to print 'c' +/// println!("{}", choices[dist.sample(&mut rng)]); +/// } +/// +/// let items = [('a', 0), ('b', 3), ('c', 7)]; +/// let dist2 = WeightedIndex::new(items.iter().map(|item| item.1)).unwrap(); +/// for _ in 0..100 { +/// // 0% chance to print 'a', 30% chance to print 'b', 70% chance to print 'c' +/// println!("{}", items[dist2.sample(&mut rng)].0); +/// } +/// ``` +/// +/// [`Uniform`]: crate::distributions::uniform::Uniform +/// [`RngCore`]: rand_core::RngCore +#[derive(Debug, Clone)] +pub struct WeightedIndex { + cumulative_weights: Vec, + weight_distribution: X::Sampler, +} + +impl WeightedIndex { + /// Creates a new a `WeightedIndex` [`Distribution`] using the values + /// in `weights`. The weights can use any type `X` for which an + /// implementation of [`Uniform`] exists. + /// + /// Returns an error if the iterator is empty, if any weight is `< 0`, or + /// if its total value is 0. + /// + /// [`Uniform`]: crate::distributions::uniform::Uniform + pub fn new(weights: I) -> Result, WeightedError> + where I: IntoIterator, + I::Item: SampleBorrow, + X: for<'a> ::core::ops::AddAssign<&'a X> + + Clone + + Default { + let mut iter = weights.into_iter(); + let mut total_weight: X = iter.next() + .ok_or(WeightedError::NoItem)? + .borrow() + .clone(); + + let zero = ::default(); + if total_weight < zero { + return Err(WeightedError::NegativeWeight); + } + + let mut weights = Vec::::with_capacity(iter.size_hint().0); + for w in iter { + if *w.borrow() < zero { + return Err(WeightedError::NegativeWeight); + } + weights.push(total_weight.clone()); + total_weight += w.borrow(); + } + + if total_weight == zero { + return Err(WeightedError::AllWeightsZero); + } + let distr = X::Sampler::new(zero, total_weight); + + Ok(WeightedIndex { cumulative_weights: weights, weight_distribution: distr }) + } +} + +impl Distribution for WeightedIndex where + X: SampleUniform + PartialOrd { + fn sample(&self, rng: &mut R) -> usize { + use ::core::cmp::Ordering; + let chosen_weight = self.weight_distribution.sample(rng); + // Find the first item which has a weight *higher* than the chosen weight. + self.cumulative_weights.binary_search_by( + |w| if *w <= chosen_weight { Ordering::Less } else { Ordering::Greater }).unwrap_err() + } +} + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_weightedindex() { + let mut r = ::test::rng(700); + const N_REPS: u32 = 5000; + let weights = [1u32, 2, 3, 0, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7]; + let total_weight = weights.iter().sum::() as f32; + + let verify = |result: [i32; 14]| { + for (i, count) in result.iter().enumerate() { + let exp = (weights[i] * N_REPS) as f32 / total_weight; + let mut err = (*count as f32 - exp).abs(); + if err != 0.0 { + err /= exp; + } + assert!(err <= 0.25); + } + }; + + // WeightedIndex from vec + let mut chosen = [0i32; 14]; + let distr = WeightedIndex::new(weights.to_vec()).unwrap(); + for _ in 0..N_REPS { + chosen[distr.sample(&mut r)] += 1; + } + verify(chosen); + + // WeightedIndex from slice + chosen = [0i32; 14]; + let distr = WeightedIndex::new(&weights[..]).unwrap(); + for _ in 0..N_REPS { + chosen[distr.sample(&mut r)] += 1; + } + verify(chosen); + + // WeightedIndex from iterator + chosen = [0i32; 14]; + let distr = WeightedIndex::new(weights.iter()).unwrap(); + for _ in 0..N_REPS { + chosen[distr.sample(&mut r)] += 1; + } + verify(chosen); + + for _ in 0..5 { + assert_eq!(WeightedIndex::new(&[0, 1]).unwrap().sample(&mut r), 1); + assert_eq!(WeightedIndex::new(&[1, 0]).unwrap().sample(&mut r), 0); + assert_eq!(WeightedIndex::new(&[0, 0, 0, 0, 10, 0]).unwrap().sample(&mut r), 4); + } + + assert_eq!(WeightedIndex::new(&[10][0..0]).unwrap_err(), WeightedError::NoItem); + assert_eq!(WeightedIndex::new(&[0]).unwrap_err(), WeightedError::AllWeightsZero); + assert_eq!(WeightedIndex::new(&[10, 20, -1, 30]).unwrap_err(), WeightedError::NegativeWeight); + assert_eq!(WeightedIndex::new(&[-10, 20, 1, 30]).unwrap_err(), WeightedError::NegativeWeight); + assert_eq!(WeightedIndex::new(&[-10]).unwrap_err(), WeightedError::NegativeWeight); + } +} + +/// Error type returned from `WeightedIndex::new`. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum WeightedError { + /// The provided iterator contained no items. + NoItem, + + /// A weight lower than zero was used. + NegativeWeight, + + /// All items in the provided iterator had a weight of zero. + AllWeightsZero, +} + +impl WeightedError { + fn msg(&self) -> &str { + match *self { + WeightedError::NoItem => "No items found", + WeightedError::NegativeWeight => "Item has negative weight", + WeightedError::AllWeightsZero => "All items had weight zero", + } + } +} + +#[cfg(feature="std")] +impl ::std::error::Error for WeightedError { + fn description(&self) -> &str { + self.msg() + } + fn cause(&self) -> Option<&::std::error::Error> { + None + } +} + +impl fmt::Display for WeightedError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.msg()) + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/distributions/ziggurat_tables.rs cargo-0.37.0/vendor/rand-0.6.5/src/distributions/ziggurat_tables.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/distributions/ziggurat_tables.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/distributions/ziggurat_tables.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,279 @@ +// Copyright 2018 Developers of the Rand project. +// Copyright 2013 The Rust Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Tables for distributions which are sampled using the ziggurat +// algorithm. Autogenerated by `ziggurat_tables.py`. + +pub type ZigTable = &'static [f64; 257]; +pub const ZIG_NORM_R: f64 = 3.654152885361008796; +pub static ZIG_NORM_X: [f64; 257] = + [3.910757959537090045, 3.654152885361008796, 3.449278298560964462, 3.320244733839166074, + 3.224575052047029100, 3.147889289517149969, 3.083526132001233044, 3.027837791768635434, + 2.978603279880844834, 2.934366867207854224, 2.894121053612348060, 2.857138730872132548, + 2.822877396825325125, 2.790921174000785765, 2.760944005278822555, 2.732685359042827056, + 2.705933656121858100, 2.680514643284522158, 2.656283037575502437, 2.633116393630324570, + 2.610910518487548515, 2.589575986706995181, 2.569035452680536569, 2.549221550323460761, + 2.530075232158516929, 2.511544441625342294, 2.493583041269680667, 2.476149939669143318, + 2.459208374333311298, 2.442725318198956774, 2.426670984935725972, 2.411018413899685520, + 2.395743119780480601, 2.380822795170626005, 2.366237056715818632, 2.351967227377659952, + 2.337996148795031370, 2.324308018869623016, 2.310888250599850036, 2.297723348901329565, + 2.284800802722946056, 2.272108990226823888, 2.259637095172217780, 2.247375032945807760, + 2.235313384928327984, 2.223443340090905718, 2.211756642882544366, 2.200245546609647995, + 2.188902771624720689, 2.177721467738641614, 2.166695180352645966, 2.155817819875063268, + 2.145083634046203613, 2.134487182844320152, 2.124023315687815661, 2.113687150684933957, + 2.103474055713146829, 2.093379631137050279, 2.083399693996551783, 2.073530263516978778, + 2.063767547809956415, 2.054107931648864849, 2.044547965215732788, 2.035084353727808715, + 2.025713947862032960, 2.016433734904371722, 2.007240830558684852, 1.998132471356564244, + 1.989106007615571325, 1.980158896898598364, 1.971288697931769640, 1.962493064942461896, + 1.953769742382734043, 1.945116560006753925, 1.936531428273758904, 1.928012334050718257, + 1.919557336591228847, 1.911164563769282232, 1.902832208548446369, 1.894558525668710081, + 1.886341828534776388, 1.878180486290977669, 1.870072921069236838, 1.862017605397632281, + 1.854013059758148119, 1.846057850283119750, 1.838150586580728607, 1.830289919680666566, + 1.822474540091783224, 1.814703175964167636, 1.806974591348693426, 1.799287584547580199, + 1.791640986550010028, 1.784033659547276329, 1.776464495522344977, 1.768932414909077933, + 1.761436365316706665, 1.753975320315455111, 1.746548278279492994, 1.739154261283669012, + 1.731792314050707216, 1.724461502945775715, 1.717160915015540690, 1.709889657069006086, + 1.702646854797613907, 1.695431651932238548, 1.688243209434858727, 1.681080704722823338, + 1.673943330923760353, 1.666830296159286684, 1.659740822855789499, 1.652674147080648526, + 1.645629517902360339, 1.638606196773111146, 1.631603456932422036, 1.624620582830568427, + 1.617656869570534228, 1.610711622367333673, 1.603784156023583041, 1.596873794420261339, + 1.589979870021648534, 1.583101723393471438, 1.576238702733332886, 1.569390163412534456, + 1.562555467528439657, 1.555733983466554893, 1.548925085471535512, 1.542128153226347553, + 1.535342571438843118, 1.528567729435024614, 1.521803020758293101, 1.515047842773992404, + 1.508301596278571965, 1.501563685112706548, 1.494833515777718391, 1.488110497054654369, + 1.481394039625375747, 1.474683555695025516, 1.467978458615230908, 1.461278162507407830, + 1.454582081885523293, 1.447889631277669675, 1.441200224845798017, 1.434513276002946425, + 1.427828197027290358, 1.421144398672323117, 1.414461289772464658, 1.407778276843371534, + 1.401094763676202559, 1.394410150925071257, 1.387723835686884621, 1.381035211072741964, + 1.374343665770030531, 1.367648583594317957, 1.360949343030101844, 1.354245316759430606, + 1.347535871177359290, 1.340820365893152122, 1.334098153216083604, 1.327368577624624679, + 1.320630975217730096, 1.313884673146868964, 1.307128989027353860, 1.300363230327433728, + 1.293586693733517645, 1.286798664489786415, 1.279998415710333237, 1.273185207661843732, + 1.266358287014688333, 1.259516886060144225, 1.252660221891297887, 1.245787495544997903, + 1.238897891102027415, 1.231990574742445110, 1.225064693752808020, 1.218119375481726552, + 1.211153726239911244, 1.204166830140560140, 1.197157747875585931, 1.190125515422801650, + 1.183069142678760732, 1.175987612011489825, 1.168879876726833800, 1.161744859441574240, + 1.154581450355851802, 1.147388505416733873, 1.140164844363995789, 1.132909248648336975, + 1.125620459211294389, 1.118297174115062909, 1.110938046009249502, 1.103541679420268151, + 1.096106627847603487, 1.088631390649514197, 1.081114409698889389, 1.073554065787871714, + 1.065948674757506653, 1.058296483326006454, 1.050595664586207123, 1.042844313139370538, + 1.035040439828605274, 1.027181966030751292, 1.019266717460529215, 1.011292417434978441, + 1.003256679539591412, 0.995156999629943084, 0.986990747093846266, 0.978755155288937750, + 0.970447311058864615, 0.962064143217605250, 0.953602409875572654, 0.945058684462571130, + 0.936429340280896860, 0.927710533396234771, 0.918898183643734989, 0.909987953490768997, + 0.900975224455174528, 0.891855070726792376, 0.882622229578910122, 0.873271068082494550, + 0.863795545546826915, 0.854189171001560554, 0.844444954902423661, 0.834555354079518752, + 0.824512208745288633, 0.814306670128064347, 0.803929116982664893, 0.793369058833152785, + 0.782615023299588763, 0.771654424216739354, 0.760473406422083165, 0.749056662009581653, + 0.737387211425838629, 0.725446140901303549, 0.713212285182022732, 0.700661841097584448, + 0.687767892786257717, 0.674499822827436479, 0.660822574234205984, 0.646695714884388928, + 0.632072236375024632, 0.616896989996235545, 0.601104617743940417, 0.584616766093722262, + 0.567338257040473026, 0.549151702313026790, 0.529909720646495108, 0.509423329585933393, + 0.487443966121754335, 0.463634336771763245, 0.437518402186662658, 0.408389134588000746, + 0.375121332850465727, 0.335737519180459465, 0.286174591747260509, 0.215241895913273806, + 0.000000000000000000]; +pub static ZIG_NORM_F: [f64; 257] = + [0.000477467764586655, 0.001260285930498598, 0.002609072746106363, 0.004037972593371872, + 0.005522403299264754, 0.007050875471392110, 0.008616582769422917, 0.010214971439731100, + 0.011842757857943104, 0.013497450601780807, 0.015177088307982072, 0.016880083152595839, + 0.018605121275783350, 0.020351096230109354, 0.022117062707379922, 0.023902203305873237, + 0.025705804008632656, 0.027527235669693315, 0.029365939758230111, 0.031221417192023690, + 0.033093219458688698, 0.034980941461833073, 0.036884215688691151, 0.038802707404656918, + 0.040736110656078753, 0.042684144916619378, 0.044646552251446536, 0.046623094902089664, + 0.048613553216035145, 0.050617723861121788, 0.052635418276973649, 0.054666461325077916, + 0.056710690106399467, 0.058767952921137984, 0.060838108349751806, 0.062921024437977854, + 0.065016577971470438, 0.067124653828023989, 0.069245144397250269, 0.071377949059141965, + 0.073522973714240991, 0.075680130359194964, 0.077849336702372207, 0.080030515814947509, + 0.082223595813495684, 0.084428509570654661, 0.086645194450867782, 0.088873592068594229, + 0.091113648066700734, 0.093365311913026619, 0.095628536713353335, 0.097903279039215627, + 0.100189498769172020, 0.102487158942306270, 0.104796225622867056, 0.107116667775072880, + 0.109448457147210021, 0.111791568164245583, 0.114145977828255210, 0.116511665626037014, + 0.118888613443345698, 0.121276805485235437, 0.123676228202051403, 0.126086870220650349, + 0.128508722280473636, 0.130941777174128166, 0.133386029692162844, 0.135841476571757352, + 0.138308116449064322, 0.140785949814968309, 0.143274978974047118, 0.145775208006537926, + 0.148286642733128721, 0.150809290682410169, 0.153343161060837674, 0.155888264725064563, + 0.158444614156520225, 0.161012223438117663, 0.163591108232982951, 0.166181285765110071, + 0.168782774801850333, 0.171395595638155623, 0.174019770082499359, 0.176655321444406654, + 0.179302274523530397, 0.181960655600216487, 0.184630492427504539, 0.187311814224516926, + 0.190004651671193070, 0.192709036904328807, 0.195425003514885592, 0.198152586546538112, + 0.200891822495431333, 0.203642749311121501, 0.206405406398679298, 0.209179834621935651, + 0.211966076307852941, 0.214764175252008499, 0.217574176725178370, 0.220396127481011589, + 0.223230075764789593, 0.226076071323264877, 0.228934165415577484, 0.231804410825248525, + 0.234686861873252689, 0.237581574432173676, 0.240488605941449107, 0.243408015423711988, + 0.246339863502238771, 0.249284212419516704, 0.252241126056943765, 0.255210669955677150, + 0.258192911338648023, 0.261187919133763713, 0.264195763998317568, 0.267216518344631837, + 0.270250256366959984, 0.273297054069675804, 0.276356989296781264, 0.279430141762765316, + 0.282516593084849388, 0.285616426816658109, 0.288729728483353931, 0.291856585618280984, + 0.294997087801162572, 0.298151326697901342, 0.301319396102034120, 0.304501391977896274, + 0.307697412505553769, 0.310907558127563710, 0.314131931597630143, 0.317370638031222396, + 0.320623784958230129, 0.323891482377732021, 0.327173842814958593, 0.330470981380537099, + 0.333783015832108509, 0.337110066638412809, 0.340452257045945450, 0.343809713148291340, + 0.347182563958251478, 0.350570941482881204, 0.353974980801569250, 0.357394820147290515, + 0.360830600991175754, 0.364282468130549597, 0.367750569780596226, 0.371235057669821344, + 0.374736087139491414, 0.378253817247238111, 0.381788410875031348, 0.385340034841733958, + 0.388908860020464597, 0.392495061461010764, 0.396098818517547080, 0.399720314981931668, + 0.403359739222868885, 0.407017284331247953, 0.410693148271983222, 0.414387534042706784, + 0.418100649839684591, 0.421832709231353298, 0.425583931339900579, 0.429354541031341519, + 0.433144769114574058, 0.436954852549929273, 0.440785034667769915, 0.444635565397727750, + 0.448506701509214067, 0.452398706863882505, 0.456311852680773566, 0.460246417814923481, + 0.464202689050278838, 0.468180961407822172, 0.472181538469883255, 0.476204732721683788, + 0.480250865911249714, 0.484320269428911598, 0.488413284707712059, 0.492530263646148658, + 0.496671569054796314, 0.500837575128482149, 0.505028667945828791, 0.509245245998136142, + 0.513487720749743026, 0.517756517232200619, 0.522052074674794864, 0.526374847174186700, + 0.530725304406193921, 0.535103932383019565, 0.539511234259544614, 0.543947731192649941, + 0.548413963257921133, 0.552910490428519918, 0.557437893621486324, 0.561996775817277916, + 0.566587763258951771, 0.571211506738074970, 0.575868682975210544, 0.580559996103683473, + 0.585286179266300333, 0.590047996335791969, 0.594846243770991268, 0.599681752622167719, + 0.604555390700549533, 0.609468064928895381, 0.614420723892076803, 0.619414360609039205, + 0.624450015550274240, 0.629528779928128279, 0.634651799290960050, 0.639820277456438991, + 0.645035480824251883, 0.650298743114294586, 0.655611470583224665, 0.660975147780241357, + 0.666391343912380640, 0.671861719900766374, 0.677388036222513090, 0.682972161648791376, + 0.688616083008527058, 0.694321916130032579, 0.700091918140490099, 0.705928501336797409, + 0.711834248882358467, 0.717811932634901395, 0.723864533472881599, 0.729995264565802437, + 0.736207598131266683, 0.742505296344636245, 0.748892447223726720, 0.755373506511754500, + 0.761953346841546475, 0.768637315803334831, 0.775431304986138326, 0.782341832659861902, + 0.789376143571198563, 0.796542330428254619, 0.803849483176389490, 0.811307874318219935, + 0.818929191609414797, 0.826726833952094231, 0.834716292992930375, 0.842915653118441077, + 0.851346258465123684, 0.860033621203008636, 0.869008688043793165, 0.878309655816146839, + 0.887984660763399880, 0.898095921906304051, 0.908726440060562912, 0.919991505048360247, + 0.932060075968990209, 0.945198953453078028, 0.959879091812415930, 0.977101701282731328, + 1.000000000000000000]; +pub const ZIG_EXP_R: f64 = 7.697117470131050077; +pub static ZIG_EXP_X: [f64; 257] = + [8.697117470131052741, 7.697117470131050077, 6.941033629377212577, 6.478378493832569696, + 6.144164665772472667, 5.882144315795399869, 5.666410167454033697, 5.482890627526062488, + 5.323090505754398016, 5.181487281301500047, 5.054288489981304089, 4.938777085901250530, + 4.832939741025112035, 4.735242996601741083, 4.644491885420085175, 4.559737061707351380, + 4.480211746528421912, 4.405287693473573185, 4.334443680317273007, 4.267242480277365857, + 4.203313713735184365, 4.142340865664051464, 4.084051310408297830, 4.028208544647936762, + 3.974606066673788796, 3.923062500135489739, 3.873417670399509127, 3.825529418522336744, + 3.779270992411667862, 3.734528894039797375, 3.691201090237418825, 3.649195515760853770, + 3.608428813128909507, 3.568825265648337020, 3.530315889129343354, 3.492837654774059608, + 3.456332821132760191, 3.420748357251119920, 3.386035442460300970, 3.352149030900109405, + 3.319047470970748037, 3.286692171599068679, 3.255047308570449882, 3.224079565286264160, + 3.193757903212240290, 3.164053358025972873, 3.134938858084440394, 3.106389062339824481, + 3.078380215254090224, 3.050890016615455114, 3.023897504455676621, 2.997382949516130601, + 2.971327759921089662, 2.945714394895045718, 2.920526286512740821, 2.895747768600141825, + 2.871364012015536371, 2.847360965635188812, 2.823725302450035279, 2.800444370250737780, + 2.777506146439756574, 2.754899196562344610, 2.732612636194700073, 2.710636095867928752, + 2.688959688741803689, 2.667573980773266573, 2.646469963151809157, 2.625639026797788489, + 2.605072938740835564, 2.584763820214140750, 2.564704126316905253, 2.544886627111869970, + 2.525304390037828028, 2.505950763528594027, 2.486819361740209455, 2.467904050297364815, + 2.449198932978249754, 2.430698339264419694, 2.412396812688870629, 2.394289099921457886, + 2.376370140536140596, 2.358635057409337321, 2.341079147703034380, 2.323697874390196372, + 2.306486858283579799, 2.289441870532269441, 2.272558825553154804, 2.255833774367219213, + 2.239262898312909034, 2.222842503111036816, 2.206569013257663858, 2.190438966723220027, + 2.174449009937774679, 2.158595893043885994, 2.142876465399842001, 2.127287671317368289, + 2.111826546019042183, 2.096490211801715020, 2.081275874393225145, 2.066180819490575526, + 2.051202409468584786, 2.036338080248769611, 2.021585338318926173, 2.006941757894518563, + 1.992404978213576650, 1.977972700957360441, 1.963642687789548313, 1.949412758007184943, + 1.935280786297051359, 1.921244700591528076, 1.907302480018387536, 1.893452152939308242, + 1.879691795072211180, 1.866019527692827973, 1.852433515911175554, 1.838931967018879954, + 1.825513128903519799, 1.812175288526390649, 1.798916770460290859, 1.785735935484126014, + 1.772631179231305643, 1.759600930889074766, 1.746643651946074405, 1.733757834985571566, + 1.720942002521935299, 1.708194705878057773, 1.695514524101537912, 1.682900062917553896, + 1.670349953716452118, 1.657862852574172763, 1.645437439303723659, 1.633072416535991334, + 1.620766508828257901, 1.608518461798858379, 1.596327041286483395, 1.584191032532688892, + 1.572109239386229707, 1.560080483527888084, 1.548103603714513499, 1.536177455041032092, + 1.524300908219226258, 1.512472848872117082, 1.500692176842816750, 1.488957805516746058, + 1.477268661156133867, 1.465623682245745352, 1.454021818848793446, 1.442462031972012504, + 1.430943292938879674, 1.419464582769983219, 1.408024891569535697, 1.396623217917042137, + 1.385258568263121992, 1.373929956328490576, 1.362636402505086775, 1.351376933258335189, + 1.340150580529504643, 1.328956381137116560, 1.317793376176324749, 1.306660610415174117, + 1.295557131686601027, 1.284481990275012642, 1.273434238296241139, 1.262412929069615330, + 1.251417116480852521, 1.240445854334406572, 1.229498195693849105, 1.218573192208790124, + 1.207669893426761121, 1.196787346088403092, 1.185924593404202199, 1.175080674310911677, + 1.164254622705678921, 1.153445466655774743, 1.142652227581672841, 1.131873919411078511, + 1.121109547701330200, 1.110358108727411031, 1.099618588532597308, 1.088889961938546813, + 1.078171191511372307, 1.067461226479967662, 1.056759001602551429, 1.046063435977044209, + 1.035373431790528542, 1.024687873002617211, 1.014005623957096480, 1.003325527915696735, + 0.992646405507275897, 0.981967053085062602, 0.971286240983903260, 0.960602711668666509, + 0.949915177764075969, 0.939222319955262286, 0.928522784747210395, 0.917815182070044311, + 0.907098082715690257, 0.896370015589889935, 0.885629464761751528, 0.874874866291025066, + 0.864104604811004484, 0.853317009842373353, 0.842510351810368485, 0.831682837734273206, + 0.820832606554411814, 0.809957724057418282, 0.799056177355487174, 0.788125868869492430, + 0.777164609759129710, 0.766170112735434672, 0.755139984181982249, 0.744071715500508102, + 0.732962673584365398, 0.721810090308756203, 0.710611050909655040, 0.699362481103231959, + 0.688061132773747808, 0.676703568029522584, 0.665286141392677943, 0.653804979847664947, + 0.642255960424536365, 0.630634684933490286, 0.618936451394876075, 0.607156221620300030, + 0.595288584291502887, 0.583327712748769489, 0.571267316532588332, 0.559100585511540626, + 0.546820125163310577, 0.534417881237165604, 0.521885051592135052, 0.509211982443654398, + 0.496388045518671162, 0.483401491653461857, 0.470239275082169006, 0.456886840931420235, + 0.443327866073552401, 0.429543940225410703, 0.415514169600356364, 0.401214678896277765, + 0.386617977941119573, 0.371692145329917234, 0.356399760258393816, 0.340696481064849122, + 0.324529117016909452, 0.307832954674932158, 0.290527955491230394, 0.272513185478464703, + 0.253658363385912022, 0.233790483059674731, 0.212671510630966620, 0.189958689622431842, + 0.165127622564187282, 0.137304980940012589, 0.104838507565818778, 0.063852163815001570, + 0.000000000000000000]; +pub static ZIG_EXP_F: [f64; 257] = + [0.000167066692307963, 0.000454134353841497, 0.000967269282327174, 0.001536299780301573, + 0.002145967743718907, 0.002788798793574076, 0.003460264777836904, 0.004157295120833797, + 0.004877655983542396, 0.005619642207205489, 0.006381905937319183, 0.007163353183634991, + 0.007963077438017043, 0.008780314985808977, 0.009614413642502212, 0.010464810181029981, + 0.011331013597834600, 0.012212592426255378, 0.013109164931254991, 0.014020391403181943, + 0.014945968011691148, 0.015885621839973156, 0.016839106826039941, 0.017806200410911355, + 0.018786700744696024, 0.019780424338009740, 0.020787204072578114, 0.021806887504283581, + 0.022839335406385240, 0.023884420511558174, 0.024942026419731787, 0.026012046645134221, + 0.027094383780955803, 0.028188948763978646, 0.029295660224637411, 0.030414443910466622, + 0.031545232172893622, 0.032687963508959555, 0.033842582150874358, 0.035009037697397431, + 0.036187284781931443, 0.037377282772959382, 0.038578995503074871, 0.039792391023374139, + 0.041017441380414840, 0.042254122413316254, 0.043502413568888197, 0.044762297732943289, + 0.046033761076175184, 0.047316792913181561, 0.048611385573379504, 0.049917534282706379, + 0.051235237055126281, 0.052564494593071685, 0.053905310196046080, 0.055257689676697030, + 0.056621641283742870, 0.057997175631200659, 0.059384305633420280, 0.060783046445479660, + 0.062193415408541036, 0.063615431999807376, 0.065049117786753805, 0.066494496385339816, + 0.067951593421936643, 0.069420436498728783, 0.070901055162371843, 0.072393480875708752, + 0.073897746992364746, 0.075413888734058410, 0.076941943170480517, 0.078481949201606435, + 0.080033947542319905, 0.081597980709237419, 0.083174093009632397, 0.084762330532368146, + 0.086362741140756927, 0.087975374467270231, 0.089600281910032886, 0.091237516631040197, + 0.092887133556043569, 0.094549189376055873, 0.096223742550432825, 0.097910853311492213, + 0.099610583670637132, 0.101322997425953631, 0.103048160171257702, 0.104786139306570145, + 0.106537004050001632, 0.108300825451033755, 0.110077676405185357, 0.111867631670056283, + 0.113670767882744286, 0.115487163578633506, 0.117316899211555525, 0.119160057175327641, + 0.121016721826674792, 0.122886979509545108, 0.124770918580830933, 0.126668629437510671, + 0.128580204545228199, 0.130505738468330773, 0.132445327901387494, 0.134399071702213602, + 0.136367070926428829, 0.138349428863580176, 0.140346251074862399, 0.142357645432472146, + 0.144383722160634720, 0.146424593878344889, 0.148480375643866735, 0.150551185001039839, + 0.152637142027442801, 0.154738369384468027, 0.156854992369365148, 0.158987138969314129, + 0.161134939917591952, 0.163298528751901734, 0.165478041874935922, 0.167673618617250081, + 0.169885401302527550, 0.172113535315319977, 0.174358169171353411, 0.176619454590494829, + 0.178897546572478278, 0.181192603475496261, 0.183504787097767436, 0.185834262762197083, + 0.188181199404254262, 0.190545769663195363, 0.192928149976771296, 0.195328520679563189, + 0.197747066105098818, 0.200183974691911210, 0.202639439093708962, 0.205113656293837654, + 0.207606827724221982, 0.210119159388988230, 0.212650861992978224, 0.215202151075378628, + 0.217773247148700472, 0.220364375843359439, 0.222975768058120111, 0.225607660116683956, + 0.228260293930716618, 0.230933917169627356, 0.233628783437433291, 0.236345152457059560, + 0.239083290262449094, 0.241843469398877131, 0.244625969131892024, 0.247431075665327543, + 0.250259082368862240, 0.253110290015629402, 0.255985007030415324, 0.258883549749016173, + 0.261806242689362922, 0.264753418835062149, 0.267725419932044739, 0.270722596799059967, + 0.273745309652802915, 0.276793928448517301, 0.279868833236972869, 0.282970414538780746, + 0.286099073737076826, 0.289255223489677693, 0.292439288161892630, 0.295651704281261252, + 0.298892921015581847, 0.302163400675693528, 0.305463619244590256, 0.308794066934560185, + 0.312155248774179606, 0.315547685227128949, 0.318971912844957239, 0.322428484956089223, + 0.325917972393556354, 0.329440964264136438, 0.332998068761809096, 0.336589914028677717, + 0.340217149066780189, 0.343880444704502575, 0.347580494621637148, 0.351318016437483449, + 0.355093752866787626, 0.358908472948750001, 0.362762973354817997, 0.366658079781514379, + 0.370594648435146223, 0.374573567615902381, 0.378595759409581067, 0.382662181496010056, + 0.386773829084137932, 0.390931736984797384, 0.395136981833290435, 0.399390684475231350, + 0.403694012530530555, 0.408048183152032673, 0.412454465997161457, 0.416914186433003209, + 0.421428728997616908, 0.425999541143034677, 0.430628137288459167, 0.435316103215636907, + 0.440065100842354173, 0.444876873414548846, 0.449753251162755330, 0.454696157474615836, + 0.459707615642138023, 0.464789756250426511, 0.469944825283960310, 0.475175193037377708, + 0.480483363930454543, 0.485871987341885248, 0.491343869594032867, 0.496901987241549881, + 0.502549501841348056, 0.508289776410643213, 0.514126393814748894, 0.520063177368233931, + 0.526104213983620062, 0.532253880263043655, 0.538516872002862246, 0.544898237672440056, + 0.551403416540641733, 0.558038282262587892, 0.564809192912400615, 0.571723048664826150, + 0.578787358602845359, 0.586010318477268366, 0.593400901691733762, 0.600968966365232560, + 0.608725382079622346, 0.616682180915207878, 0.624852738703666200, 0.633251994214366398, + 0.641896716427266423, 0.650805833414571433, 0.660000841079000145, 0.669506316731925177, + 0.679350572264765806, 0.689566496117078431, 0.700192655082788606, 0.711274760805076456, + 0.722867659593572465, 0.735038092431424039, 0.747868621985195658, 0.761463388849896838, + 0.775956852040116218, 0.791527636972496285, 0.808421651523009044, 0.826993296643051101, + 0.847785500623990496, 0.871704332381204705, 0.900469929925747703, 0.938143680862176477, + 1.000000000000000000]; diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/lib.rs cargo-0.37.0/vendor/rand-0.6.5/src/lib.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/lib.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,830 @@ +// Copyright 2018 Developers of the Rand project. +// Copyright 2013-2017 The Rust Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Utilities for random number generation +//! +//! Rand provides utilities to generate random numbers, to convert them to +//! useful types and distributions, and some randomness-related algorithms. +//! +//! # Quick Start +//! +//! To get you started quickly, the easiest and highest-level way to get +//! a random value is to use [`random()`]; alternatively you can use +//! [`thread_rng()`]. The [`Rng`] trait provides a useful API on all RNGs, while +//! the [`distributions`] and [`seq`] modules provide further +//! functionality on top of RNGs. +//! +//! ``` +//! use rand::prelude::*; +//! +//! if rand::random() { // generates a boolean +//! // Try printing a random unicode code point (probably a bad idea)! +//! println!("char: {}", rand::random::()); +//! } +//! +//! let mut rng = rand::thread_rng(); +//! let y: f64 = rng.gen(); // generates a float between 0 and 1 +//! +//! let mut nums: Vec = (1..100).collect(); +//! nums.shuffle(&mut rng); +//! ``` +//! +//! # The Book +//! +//! For the user guide and futher documentation, please read +//! [The Rust Rand Book](https://rust-random.github.io/book). + + +#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png", + html_favicon_url = "https://www.rust-lang.org/favicon.ico", + html_root_url = "https://rust-random.github.io/rand/")] + +#![deny(missing_docs)] +#![deny(missing_debug_implementations)] +#![doc(test(attr(allow(unused_variables), deny(warnings))))] + +#![cfg_attr(not(feature="std"), no_std)] +#![cfg_attr(all(feature="alloc", not(feature="std")), feature(alloc))] +#![cfg_attr(all(feature="simd_support", feature="nightly"), feature(stdsimd))] + +#[cfg(feature = "std")] extern crate core; +#[cfg(all(feature = "alloc", not(feature="std")))] #[macro_use] extern crate alloc; + +#[cfg(feature="simd_support")] extern crate packed_simd; + +extern crate rand_jitter; +#[cfg(feature = "rand_os")] +extern crate rand_os; + +extern crate rand_core; +extern crate rand_isaac; // only for deprecations +extern crate rand_chacha; // only for deprecations +extern crate rand_hc; +extern crate rand_pcg; +extern crate rand_xorshift; + +#[cfg(feature = "log")] #[macro_use] extern crate log; +#[allow(unused)] +#[cfg(not(feature = "log"))] macro_rules! trace { ($($x:tt)*) => () } +#[allow(unused)] +#[cfg(not(feature = "log"))] macro_rules! debug { ($($x:tt)*) => () } +#[allow(unused)] +#[cfg(not(feature = "log"))] macro_rules! info { ($($x:tt)*) => () } +#[allow(unused)] +#[cfg(not(feature = "log"))] macro_rules! warn { ($($x:tt)*) => () } +#[allow(unused)] +#[cfg(not(feature = "log"))] macro_rules! error { ($($x:tt)*) => () } + + +// Re-exports from rand_core +pub use rand_core::{RngCore, CryptoRng, SeedableRng}; +pub use rand_core::{ErrorKind, Error}; + +// Public exports +#[cfg(feature="std")] pub use rngs::thread::thread_rng; + +// Public modules +pub mod distributions; +pub mod prelude; +#[deprecated(since="0.6.0")] +pub mod prng; +pub mod rngs; +pub mod seq; + +//////////////////////////////////////////////////////////////////////////////// +// Compatibility re-exports. Documentation is hidden; will be removed eventually. + +#[doc(hidden)] mod deprecated; + +#[allow(deprecated)] +#[doc(hidden)] pub use deprecated::ReseedingRng; + +#[allow(deprecated)] +#[cfg(feature="std")] #[doc(hidden)] pub use deprecated::EntropyRng; + +#[allow(deprecated)] +#[cfg(feature="rand_os")] +#[doc(hidden)] +pub use deprecated::OsRng; + +#[allow(deprecated)] +#[doc(hidden)] pub use deprecated::{ChaChaRng, IsaacRng, Isaac64Rng, XorShiftRng}; +#[allow(deprecated)] +#[doc(hidden)] pub use deprecated::StdRng; + + +#[allow(deprecated)] +#[doc(hidden)] +pub mod jitter { + pub use deprecated::JitterRng; + pub use rngs::TimerError; +} +#[allow(deprecated)] +#[cfg(feature="rand_os")] +#[doc(hidden)] +pub mod os { + pub use deprecated::OsRng; +} +#[allow(deprecated)] +#[doc(hidden)] +pub mod chacha { + pub use deprecated::ChaChaRng; +} +#[allow(deprecated)] +#[doc(hidden)] +pub mod isaac { + pub use deprecated::{IsaacRng, Isaac64Rng}; +} +#[allow(deprecated)] +#[cfg(feature="std")] +#[doc(hidden)] +pub mod read { + pub use deprecated::ReadRng; +} + +#[allow(deprecated)] +#[cfg(feature="std")] #[doc(hidden)] pub use deprecated::ThreadRng; + +//////////////////////////////////////////////////////////////////////////////// + + +use core::{mem, slice}; +use distributions::{Distribution, Standard}; +use distributions::uniform::{SampleUniform, UniformSampler, SampleBorrow}; + +/// An automatically-implemented extension trait on [`RngCore`] providing high-level +/// generic methods for sampling values and other convenience methods. +/// +/// This is the primary trait to use when generating random values. +/// +/// # Generic usage +/// +/// The basic pattern is `fn foo(rng: &mut R)`. Some +/// things are worth noting here: +/// +/// - Since `Rng: RngCore` and every `RngCore` implements `Rng`, it makes no +/// difference whether we use `R: Rng` or `R: RngCore`. +/// - The `+ ?Sized` un-bounding allows functions to be called directly on +/// type-erased references; i.e. `foo(r)` where `r: &mut RngCore`. Without +/// this it would be necessary to write `foo(&mut r)`. +/// +/// An alternative pattern is possible: `fn foo(rng: R)`. This has some +/// trade-offs. It allows the argument to be consumed directly without a `&mut` +/// (which is how `from_rng(thread_rng())` works); also it still works directly +/// on references (including type-erased references). Unfortunately within the +/// function `foo` it is not known whether `rng` is a reference type or not, +/// hence many uses of `rng` require an extra reference, either explicitly +/// (`distr.sample(&mut rng)`) or implicitly (`rng.gen()`); one may hope the +/// optimiser can remove redundant references later. +/// +/// Example: +/// +/// ``` +/// # use rand::thread_rng; +/// use rand::Rng; +/// +/// fn foo(rng: &mut R) -> f32 { +/// rng.gen() +/// } +/// +/// # let v = foo(&mut thread_rng()); +/// ``` +pub trait Rng: RngCore { + /// Return a random value supporting the [`Standard`] distribution. + /// + /// [`Standard`]: distributions::Standard + /// + /// # Example + /// + /// ``` + /// use rand::{thread_rng, Rng}; + /// + /// let mut rng = thread_rng(); + /// let x: u32 = rng.gen(); + /// println!("{}", x); + /// println!("{:?}", rng.gen::<(f64, bool)>()); + /// ``` + #[inline] + fn gen(&mut self) -> T where Standard: Distribution { + Standard.sample(self) + } + + /// Generate a random value in the range [`low`, `high`), i.e. inclusive of + /// `low` and exclusive of `high`. + /// + /// This function is optimised for the case that only a single sample is + /// made from the given range. See also the [`Uniform`] distribution + /// type which may be faster if sampling from the same range repeatedly. + /// + /// # Panics + /// + /// Panics if `low >= high`. + /// + /// # Example + /// + /// ``` + /// use rand::{thread_rng, Rng}; + /// + /// let mut rng = thread_rng(); + /// let n: u32 = rng.gen_range(0, 10); + /// println!("{}", n); + /// let m: f64 = rng.gen_range(-40.0f64, 1.3e5f64); + /// println!("{}", m); + /// ``` + /// + /// [`Uniform`]: distributions::uniform::Uniform + fn gen_range(&mut self, low: B1, high: B2) -> T + where B1: SampleBorrow + Sized, + B2: SampleBorrow + Sized { + T::Sampler::sample_single(low, high, self) + } + + /// Sample a new value, using the given distribution. + /// + /// ### Example + /// + /// ``` + /// use rand::{thread_rng, Rng}; + /// use rand::distributions::Uniform; + /// + /// let mut rng = thread_rng(); + /// let x = rng.sample(Uniform::new(10u32, 15)); + /// // Type annotation requires two types, the type and distribution; the + /// // distribution can be inferred. + /// let y = rng.sample::(Uniform::new(10, 15)); + /// ``` + fn sample>(&mut self, distr: D) -> T { + distr.sample(self) + } + + /// Create an iterator that generates values using the given distribution. + /// + /// # Example + /// + /// ``` + /// use rand::{thread_rng, Rng}; + /// use rand::distributions::{Alphanumeric, Uniform, Standard}; + /// + /// let mut rng = thread_rng(); + /// + /// // Vec of 16 x f32: + /// let v: Vec = thread_rng().sample_iter(&Standard).take(16).collect(); + /// + /// // String: + /// let s: String = rng.sample_iter(&Alphanumeric).take(7).collect(); + /// + /// // Combined values + /// println!("{:?}", thread_rng().sample_iter(&Standard).take(5) + /// .collect::>()); + /// + /// // Dice-rolling: + /// let die_range = Uniform::new_inclusive(1, 6); + /// let mut roll_die = rng.sample_iter(&die_range); + /// while roll_die.next().unwrap() != 6 { + /// println!("Not a 6; rolling again!"); + /// } + /// ``` + fn sample_iter<'a, T, D: Distribution>(&'a mut self, distr: &'a D) + -> distributions::DistIter<'a, D, Self, T> where Self: Sized + { + distr.sample_iter(self) + } + + /// Fill `dest` entirely with random bytes (uniform value distribution), + /// where `dest` is any type supporting [`AsByteSliceMut`], namely slices + /// and arrays over primitive integer types (`i8`, `i16`, `u32`, etc.). + /// + /// On big-endian platforms this performs byte-swapping to ensure + /// portability of results from reproducible generators. + /// + /// This uses [`fill_bytes`] internally which may handle some RNG errors + /// implicitly (e.g. waiting if the OS generator is not ready), but panics + /// on other errors. See also [`try_fill`] which returns errors. + /// + /// # Example + /// + /// ``` + /// use rand::{thread_rng, Rng}; + /// + /// let mut arr = [0i8; 20]; + /// thread_rng().fill(&mut arr[..]); + /// ``` + /// + /// [`fill_bytes`]: RngCore::fill_bytes + /// [`try_fill`]: Rng::try_fill + fn fill(&mut self, dest: &mut T) { + self.fill_bytes(dest.as_byte_slice_mut()); + dest.to_le(); + } + + /// Fill `dest` entirely with random bytes (uniform value distribution), + /// where `dest` is any type supporting [`AsByteSliceMut`], namely slices + /// and arrays over primitive integer types (`i8`, `i16`, `u32`, etc.). + /// + /// On big-endian platforms this performs byte-swapping to ensure + /// portability of results from reproducible generators. + /// + /// This uses [`try_fill_bytes`] internally and forwards all RNG errors. In + /// some cases errors may be resolvable; see [`ErrorKind`] and + /// documentation for the RNG in use. If you do not plan to handle these + /// errors you may prefer to use [`fill`]. + /// + /// # Example + /// + /// ``` + /// # use rand::Error; + /// use rand::{thread_rng, Rng}; + /// + /// # fn try_inner() -> Result<(), Error> { + /// let mut arr = [0u64; 4]; + /// thread_rng().try_fill(&mut arr[..])?; + /// # Ok(()) + /// # } + /// + /// # try_inner().unwrap() + /// ``` + /// + /// [`try_fill_bytes`]: RngCore::try_fill_bytes + /// [`fill`]: Rng::fill + fn try_fill(&mut self, dest: &mut T) -> Result<(), Error> { + self.try_fill_bytes(dest.as_byte_slice_mut())?; + dest.to_le(); + Ok(()) + } + + /// Return a bool with a probability `p` of being true. + /// + /// See also the [`Bernoulli`] distribution, which may be faster if + /// sampling from the same probability repeatedly. + /// + /// # Example + /// + /// ``` + /// use rand::{thread_rng, Rng}; + /// + /// let mut rng = thread_rng(); + /// println!("{}", rng.gen_bool(1.0 / 3.0)); + /// ``` + /// + /// # Panics + /// + /// If `p < 0` or `p > 1`. + /// + /// [`Bernoulli`]: distributions::bernoulli::Bernoulli + #[inline] + fn gen_bool(&mut self, p: f64) -> bool { + let d = distributions::Bernoulli::new(p); + self.sample(d) + } + + /// Return a bool with a probability of `numerator/denominator` of being + /// true. I.e. `gen_ratio(2, 3)` has chance of 2 in 3, or about 67%, of + /// returning true. If `numerator == denominator`, then the returned value + /// is guaranteed to be `true`. If `numerator == 0`, then the returned + /// value is guaranteed to be `false`. + /// + /// See also the [`Bernoulli`] distribution, which may be faster if + /// sampling from the same `numerator` and `denominator` repeatedly. + /// + /// # Panics + /// + /// If `denominator == 0` or `numerator > denominator`. + /// + /// # Example + /// + /// ``` + /// use rand::{thread_rng, Rng}; + /// + /// let mut rng = thread_rng(); + /// println!("{}", rng.gen_ratio(2, 3)); + /// ``` + /// + /// [`Bernoulli`]: distributions::bernoulli::Bernoulli + #[inline] + fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool { + let d = distributions::Bernoulli::from_ratio(numerator, denominator); + self.sample(d) + } + + /// Return a random element from `values`. + /// + /// Deprecated: use [`seq::SliceRandom::choose`] instead. + #[deprecated(since="0.6.0", note="use SliceRandom::choose instead")] + fn choose<'a, T>(&mut self, values: &'a [T]) -> Option<&'a T> { + use seq::SliceRandom; + values.choose(self) + } + + /// Return a mutable pointer to a random element from `values`. + /// + /// Deprecated: use [`seq::SliceRandom::choose_mut`] instead. + #[deprecated(since="0.6.0", note="use SliceRandom::choose_mut instead")] + fn choose_mut<'a, T>(&mut self, values: &'a mut [T]) -> Option<&'a mut T> { + use seq::SliceRandom; + values.choose_mut(self) + } + + /// Shuffle a mutable slice in place. + /// + /// Deprecated: use [`seq::SliceRandom::shuffle`] instead. + #[deprecated(since="0.6.0", note="use SliceRandom::shuffle instead")] + fn shuffle(&mut self, values: &mut [T]) { + use seq::SliceRandom; + values.shuffle(self) + } +} + +impl Rng for R {} + +/// Trait for casting types to byte slices +/// +/// This is used by the [`Rng::fill`] and [`Rng::try_fill`] methods. +pub trait AsByteSliceMut { + /// Return a mutable reference to self as a byte slice + fn as_byte_slice_mut(&mut self) -> &mut [u8]; + + /// Call `to_le` on each element (i.e. byte-swap on Big Endian platforms). + fn to_le(&mut self); +} + +impl AsByteSliceMut for [u8] { + fn as_byte_slice_mut(&mut self) -> &mut [u8] { + self + } + + fn to_le(&mut self) {} +} + +macro_rules! impl_as_byte_slice { + ($t:ty) => { + impl AsByteSliceMut for [$t] { + fn as_byte_slice_mut(&mut self) -> &mut [u8] { + if self.len() == 0 { + unsafe { + // must not use null pointer + slice::from_raw_parts_mut(0x1 as *mut u8, 0) + } + } else { + unsafe { + slice::from_raw_parts_mut(&mut self[0] + as *mut $t + as *mut u8, + self.len() * mem::size_of::<$t>() + ) + } + } + } + + fn to_le(&mut self) { + for x in self { + *x = x.to_le(); + } + } + } + } +} + +impl_as_byte_slice!(u16); +impl_as_byte_slice!(u32); +impl_as_byte_slice!(u64); +#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] impl_as_byte_slice!(u128); +impl_as_byte_slice!(usize); +impl_as_byte_slice!(i8); +impl_as_byte_slice!(i16); +impl_as_byte_slice!(i32); +impl_as_byte_slice!(i64); +#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] impl_as_byte_slice!(i128); +impl_as_byte_slice!(isize); + +macro_rules! impl_as_byte_slice_arrays { + ($n:expr,) => {}; + ($n:expr, $N:ident, $($NN:ident,)*) => { + impl_as_byte_slice_arrays!($n - 1, $($NN,)*); + + impl AsByteSliceMut for [T; $n] where [T]: AsByteSliceMut { + fn as_byte_slice_mut(&mut self) -> &mut [u8] { + self[..].as_byte_slice_mut() + } + + fn to_le(&mut self) { + self[..].to_le() + } + } + }; + (!div $n:expr,) => {}; + (!div $n:expr, $N:ident, $($NN:ident,)*) => { + impl_as_byte_slice_arrays!(!div $n / 2, $($NN,)*); + + impl AsByteSliceMut for [T; $n] where [T]: AsByteSliceMut { + fn as_byte_slice_mut(&mut self) -> &mut [u8] { + self[..].as_byte_slice_mut() + } + + fn to_le(&mut self) { + self[..].to_le() + } + } + }; +} +impl_as_byte_slice_arrays!(32, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,); +impl_as_byte_slice_arrays!(!div 4096, N,N,N,N,N,N,N,); + + +/// A convenience extension to [`SeedableRng`] allowing construction from fresh +/// entropy. This trait is automatically implemented for any PRNG implementing +/// [`SeedableRng`] and is not intended to be implemented by users. +/// +/// This is equivalent to using `SeedableRng::from_rng(EntropyRng::new())` then +/// unwrapping the result. +/// +/// Since this is convenient and secure, it is the recommended way to create +/// PRNGs, though two alternatives may be considered: +/// +/// * Deterministic creation using [`SeedableRng::from_seed`] with a fixed seed +/// * Seeding from `thread_rng`: `SeedableRng::from_rng(thread_rng())?`; +/// this will usually be faster and should also be secure, but requires +/// trusting one extra component. +/// +/// ## Example +/// +/// ``` +/// use rand::{Rng, FromEntropy}; +/// use rand::rngs::StdRng; +/// +/// let mut rng = StdRng::from_entropy(); +/// println!("Random die roll: {}", rng.gen_range(1, 7)); +/// ``` +/// +/// [`EntropyRng`]: rngs::EntropyRng +#[cfg(feature="std")] +pub trait FromEntropy: SeedableRng { + /// Creates a new instance, automatically seeded with fresh entropy. + /// + /// Normally this will use `OsRng`, but if that fails `JitterRng` will be + /// used instead. Both should be suitable for cryptography. It is possible + /// that both entropy sources will fail though unlikely; failures would + /// almost certainly be platform limitations or build issues, i.e. most + /// applications targetting PC/mobile platforms should not need to worry + /// about this failing. + /// + /// # Panics + /// + /// If all entropy sources fail this will panic. If you need to handle + /// errors, use the following code, equivalent aside from error handling: + /// + /// ``` + /// # use rand::Error; + /// use rand::prelude::*; + /// use rand::rngs::EntropyRng; + /// + /// # fn try_inner() -> Result<(), Error> { + /// // This uses StdRng, but is valid for any R: SeedableRng + /// let mut rng = StdRng::from_rng(EntropyRng::new())?; + /// + /// println!("random number: {}", rng.gen_range(1, 10)); + /// # Ok(()) + /// # } + /// + /// # try_inner().unwrap() + /// ``` + fn from_entropy() -> Self; +} + +#[cfg(feature="std")] +impl FromEntropy for R { + fn from_entropy() -> R { + R::from_rng(rngs::EntropyRng::new()).unwrap_or_else(|err| + panic!("FromEntropy::from_entropy() failed: {}", err)) + } +} + + +/// Generates a random value using the thread-local random number generator. +/// +/// This is simply a shortcut for `thread_rng().gen()`. See [`thread_rng`] for +/// documentation of the entropy source and [`Standard`] for documentation of +/// distributions and type-specific generation. +/// +/// # Examples +/// +/// ``` +/// let x = rand::random::(); +/// println!("{}", x); +/// +/// let y = rand::random::(); +/// println!("{}", y); +/// +/// if rand::random() { // generates a boolean +/// println!("Better lucky than good!"); +/// } +/// ``` +/// +/// If you're calling `random()` in a loop, caching the generator as in the +/// following example can increase performance. +/// +/// ``` +/// use rand::Rng; +/// +/// let mut v = vec![1, 2, 3]; +/// +/// for x in v.iter_mut() { +/// *x = rand::random() +/// } +/// +/// // can be made faster by caching thread_rng +/// +/// let mut rng = rand::thread_rng(); +/// +/// for x in v.iter_mut() { +/// *x = rng.gen(); +/// } +/// ``` +/// +/// [`Standard`]: distributions::Standard +#[cfg(feature="std")] +#[inline] +pub fn random() -> T where Standard: Distribution { + thread_rng().gen() +} + +#[cfg(test)] +mod test { + use rngs::mock::StepRng; + use rngs::StdRng; + use super::*; + #[cfg(all(not(feature="std"), feature="alloc"))] use alloc::boxed::Box; + + pub struct TestRng { inner: R } + + impl RngCore for TestRng { + fn next_u32(&mut self) -> u32 { + self.inner.next_u32() + } + fn next_u64(&mut self) -> u64 { + self.inner.next_u64() + } + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.inner.fill_bytes(dest) + } + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.inner.try_fill_bytes(dest) + } + } + + pub fn rng(seed: u64) -> TestRng { + TestRng { inner: StdRng::seed_from_u64(seed) } + } + + #[test] + fn test_fill_bytes_default() { + let mut r = StepRng::new(0x11_22_33_44_55_66_77_88, 0); + + // check every remainder mod 8, both in small and big vectors. + let lengths = [0, 1, 2, 3, 4, 5, 6, 7, + 80, 81, 82, 83, 84, 85, 86, 87]; + for &n in lengths.iter() { + let mut buffer = [0u8; 87]; + let v = &mut buffer[0..n]; + r.fill_bytes(v); + + // use this to get nicer error messages. + for (i, &byte) in v.iter().enumerate() { + if byte == 0 { + panic!("byte {} of {} is zero", i, n) + } + } + } + } + + #[test] + fn test_fill() { + let x = 9041086907909331047; // a random u64 + let mut rng = StepRng::new(x, 0); + + // Convert to byte sequence and back to u64; byte-swap twice if BE. + let mut array = [0u64; 2]; + rng.fill(&mut array[..]); + assert_eq!(array, [x, x]); + assert_eq!(rng.next_u64(), x); + + // Convert to bytes then u32 in LE order + let mut array = [0u32; 2]; + rng.fill(&mut array[..]); + assert_eq!(array, [x as u32, (x >> 32) as u32]); + assert_eq!(rng.next_u32(), x as u32); + } + + #[test] + fn test_fill_empty() { + let mut array = [0u32; 0]; + let mut rng = StepRng::new(0, 1); + rng.fill(&mut array); + rng.fill(&mut array[..]); + } + + #[test] + fn test_gen_range() { + let mut r = rng(101); + for _ in 0..1000 { + let a = r.gen_range(-4711, 17); + assert!(a >= -4711 && a < 17); + let a = r.gen_range(-3i8, 42); + assert!(a >= -3i8 && a < 42i8); + let a = r.gen_range(&10u16, 99); + assert!(a >= 10u16 && a < 99u16); + let a = r.gen_range(-100i32, &2000); + assert!(a >= -100i32 && a < 2000i32); + let a = r.gen_range(&12u32, &24u32); + assert!(a >= 12u32 && a < 24u32); + + assert_eq!(r.gen_range(0u32, 1), 0u32); + assert_eq!(r.gen_range(-12i64, -11), -12i64); + assert_eq!(r.gen_range(3_000_000, 3_000_001), 3_000_000); + } + } + + #[test] + #[should_panic] + fn test_gen_range_panic_int() { + let mut r = rng(102); + r.gen_range(5, -2); + } + + #[test] + #[should_panic] + fn test_gen_range_panic_usize() { + let mut r = rng(103); + r.gen_range(5, 2); + } + + #[test] + fn test_gen_bool() { + let mut r = rng(105); + for _ in 0..5 { + assert_eq!(r.gen_bool(0.0), false); + assert_eq!(r.gen_bool(1.0), true); + } + } + + #[test] + fn test_rng_trait_object() { + use distributions::{Distribution, Standard}; + let mut rng = rng(109); + let mut r = &mut rng as &mut RngCore; + r.next_u32(); + r.gen::(); + assert_eq!(r.gen_range(0, 1), 0); + let _c: u8 = Standard.sample(&mut r); + } + + #[test] + #[cfg(feature="alloc")] + fn test_rng_boxed_trait() { + use distributions::{Distribution, Standard}; + let rng = rng(110); + let mut r = Box::new(rng) as Box; + r.next_u32(); + r.gen::(); + assert_eq!(r.gen_range(0, 1), 0); + let _c: u8 = Standard.sample(&mut r); + } + + #[test] + #[cfg(feature="std")] + fn test_random() { + // not sure how to test this aside from just getting some values + let _n : usize = random(); + let _f : f32 = random(); + let _o : Option> = random(); + let _many : ((), + (usize, + isize, + Option<(u32, (bool,))>), + (u8, i8, u16, i16, u32, i32, u64, i64), + (f32, (f64, (f64,)))) = random(); + } + + #[test] + fn test_gen_ratio_average() { + const NUM: u32 = 3; + const DENOM: u32 = 10; + const N: u32 = 100_000; + + let mut sum: u32 = 0; + let mut rng = rng(111); + for _ in 0..N { + if rng.gen_ratio(NUM, DENOM) { + sum += 1; + } + } + // Have Binomial(N, NUM/DENOM) distribution + let expected = (NUM * N) / DENOM; // exact integer + assert!(((sum - expected) as i32).abs() < 500); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/prelude.rs cargo-0.37.0/vendor/rand-0.6.5/src/prelude.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/prelude.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/prelude.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,27 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Convenience re-export of common members +//! +//! Like the standard library's prelude, this module simplifies importing of +//! common items. Unlike the standard prelude, the contents of this module must +//! be imported manually: +//! +//! ``` +//! use rand::prelude::*; +//! # let _ = StdRng::from_entropy(); +//! # let mut r = SmallRng::from_rng(thread_rng()).unwrap(); +//! # let _: f32 = r.gen(); +//! ``` + +#[doc(no_inline)] pub use distributions::Distribution; +#[doc(no_inline)] pub use rngs::{SmallRng, StdRng}; +#[doc(no_inline)] #[cfg(feature="std")] pub use rngs::ThreadRng; +#[doc(no_inline)] pub use {Rng, RngCore, CryptoRng, SeedableRng}; +#[doc(no_inline)] #[cfg(feature="std")] pub use {FromEntropy, random, thread_rng}; +#[doc(no_inline)] pub use seq::{SliceRandom, IteratorRandom}; diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/prng/mod.rs cargo-0.37.0/vendor/rand-0.6.5/src/prng/mod.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/prng/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/prng/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,37 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Pseudo-random number generators. +//! +//! This module is deprecated: +//! +//! - documentation has moved to +//! [The Book](https://rust-random.github.io/book/guide-rngs.html), +//! - PRNGs have moved to other `rand_*` crates. + +// Deprecations (to be removed in 0.7) +#[doc(hidden)] #[allow(deprecated)] +pub use deprecated::XorShiftRng; +#[doc(hidden)] pub mod isaac { + // Note: we miss `IsaacCore` here but probably unimportant. + #[allow(deprecated)] pub use deprecated::IsaacRng; +} +#[doc(hidden)] pub mod isaac64 { + #[allow(deprecated)] pub use deprecated::Isaac64Rng; +} +#[doc(hidden)] #[allow(deprecated)] pub use deprecated::{IsaacRng, Isaac64Rng}; +#[doc(hidden)] pub mod chacha { + // Note: we miss `ChaChaCore` here but probably unimportant. + #[allow(deprecated)] pub use deprecated::ChaChaRng; +} +#[doc(hidden)] #[allow(deprecated)] pub use deprecated::ChaChaRng; +#[doc(hidden)] pub mod hc128 { + // Note: we miss `Hc128Core` here but probably unimportant. + #[allow(deprecated)] pub use deprecated::Hc128Rng; +} +#[doc(hidden)] #[allow(deprecated)] pub use deprecated::Hc128Rng; diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/rngs/adapter/mod.rs cargo-0.37.0/vendor/rand-0.6.5/src/rngs/adapter/mod.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/rngs/adapter/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/rngs/adapter/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,15 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Wrappers / adapters forming RNGs + +#[cfg(feature="std")] #[doc(hidden)] pub mod read; +mod reseeding; + +#[cfg(feature="std")] pub use self::read::ReadRng; +pub use self::reseeding::ReseedingRng; diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/rngs/adapter/read.rs cargo-0.37.0/vendor/rand-0.6.5/src/rngs/adapter/read.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/rngs/adapter/read.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/rngs/adapter/read.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,136 @@ +// Copyright 2018 Developers of the Rand project. +// Copyright 2013 The Rust Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! A wrapper around any Read to treat it as an RNG. + +use std::io::Read; + +use rand_core::{RngCore, Error, ErrorKind, impls}; + + +/// An RNG that reads random bytes straight from any type supporting +/// [`std::io::Read`], for example files. +/// +/// This will work best with an infinite reader, but that is not required. +/// +/// This can be used with `/dev/urandom` on Unix but it is recommended to use +/// [`OsRng`] instead. +/// +/// # Panics +/// +/// `ReadRng` uses [`std::io::Read::read_exact`], which retries on interrupts. +/// All other errors from the underlying reader, including when it does not +/// have enough data, will only be reported through [`try_fill_bytes`]. +/// The other [`RngCore`] methods will panic in case of an error. +/// +/// # Example +/// +/// ``` +/// use rand::Rng; +/// use rand::rngs::adapter::ReadRng; +/// +/// let data = vec![1, 2, 3, 4, 5, 6, 7, 8]; +/// let mut rng = ReadRng::new(&data[..]); +/// println!("{:x}", rng.gen::()); +/// ``` +/// +/// [`OsRng`]: rand_os::OsRng +/// [`try_fill_bytes`]: RngCore::try_fill_bytes +#[derive(Debug)] +pub struct ReadRng { + reader: R +} + +impl ReadRng { + /// Create a new `ReadRng` from a `Read`. + pub fn new(r: R) -> ReadRng { + ReadRng { + reader: r + } + } +} + +impl RngCore for ReadRng { + fn next_u32(&mut self) -> u32 { + impls::next_u32_via_fill(self) + } + + fn next_u64(&mut self) -> u64 { + impls::next_u64_via_fill(self) + } + + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.try_fill_bytes(dest).unwrap_or_else(|err| + panic!("reading random bytes from Read implementation failed; error: {}", err)); + } + + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + if dest.len() == 0 { return Ok(()); } + // Use `std::io::read_exact`, which retries on `ErrorKind::Interrupted`. + self.reader.read_exact(dest).map_err(|err| { + match err.kind() { + ::std::io::ErrorKind::UnexpectedEof => Error::with_cause( + ErrorKind::Unavailable, + "not enough bytes available, reached end of source", err), + _ => Error::with_cause(ErrorKind::Unavailable, + "error reading from Read source", err) + } + }) + } +} + +#[cfg(test)] +mod test { + use super::ReadRng; + use {RngCore, ErrorKind}; + + #[test] + fn test_reader_rng_u64() { + // transmute from the target to avoid endianness concerns. + let v = vec![0u8, 0, 0, 0, 0, 0, 0, 1, + 0 , 0, 0, 0, 0, 0, 0, 2, + 0, 0, 0, 0, 0, 0, 0, 3]; + let mut rng = ReadRng::new(&v[..]); + + assert_eq!(rng.next_u64(), 1_u64.to_be()); + assert_eq!(rng.next_u64(), 2_u64.to_be()); + assert_eq!(rng.next_u64(), 3_u64.to_be()); + } + + #[test] + fn test_reader_rng_u32() { + let v = vec![0u8, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3]; + let mut rng = ReadRng::new(&v[..]); + + assert_eq!(rng.next_u32(), 1_u32.to_be()); + assert_eq!(rng.next_u32(), 2_u32.to_be()); + assert_eq!(rng.next_u32(), 3_u32.to_be()); + } + + #[test] + fn test_reader_rng_fill_bytes() { + let v = [1u8, 2, 3, 4, 5, 6, 7, 8]; + let mut w = [0u8; 8]; + + let mut rng = ReadRng::new(&v[..]); + rng.fill_bytes(&mut w); + + assert!(v == w); + } + + #[test] + fn test_reader_rng_insufficient_bytes() { + let v = [1u8, 2, 3, 4, 5, 6, 7, 8]; + let mut w = [0u8; 9]; + + let mut rng = ReadRng::new(&v[..]); + + assert!(rng.try_fill_bytes(&mut w).err().unwrap().kind == ErrorKind::Unavailable); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/rngs/adapter/reseeding.rs cargo-0.37.0/vendor/rand-0.6.5/src/rngs/adapter/reseeding.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/rngs/adapter/reseeding.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/rngs/adapter/reseeding.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,370 @@ +// Copyright 2018 Developers of the Rand project. +// Copyright 2013 The Rust Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! A wrapper around another PRNG that reseeds it after it +//! generates a certain number of random bytes. + +use core::mem::size_of; + +use rand_core::{RngCore, CryptoRng, SeedableRng, Error, ErrorKind}; +use rand_core::block::{BlockRngCore, BlockRng}; + +/// A wrapper around any PRNG that implements [`BlockRngCore`], that adds the +/// ability to reseed it. +/// +/// `ReseedingRng` reseeds the underlying PRNG in the following cases: +/// +/// - On a manual call to [`reseed()`]. +/// - After `clone()`, the clone will be reseeded on first use. +/// - After a process is forked, the RNG in the child process is reseeded within +/// the next few generated values, depending on the block size of the +/// underlying PRNG. For [`ChaChaCore`] and [`Hc128Core`] this is a maximum of +/// 15 `u32` values before reseeding. +/// - After the PRNG has generated a configurable number of random bytes. +/// +/// # When should reseeding after a fixed number of generated bytes be used? +/// +/// Reseeding after a fixed number of generated bytes is never strictly +/// *necessary*. Cryptographic PRNGs don't have a limited number of bytes they +/// can output, or at least not a limit reachable in any practical way. There is +/// no such thing as 'running out of entropy'. +/// +/// Occasionally reseeding can be seen as some form of 'security in depth'. Even +/// if in the future a cryptographic weakness is found in the CSPRNG being used, +/// or a flaw in the implementation, occasionally reseeding should make +/// exploiting it much more difficult or even impossible. +/// +/// Use [`ReseedingRng::new`] with a `threshold` of `0` to disable reseeding +/// after a fixed number of generated bytes. +/// +/// # Error handling +/// +/// Although unlikely, reseeding the wrapped PRNG can fail. `ReseedingRng` will +/// never panic but try to handle the error intelligently through some +/// combination of retrying and delaying reseeding until later. +/// If handling the source error fails `ReseedingRng` will continue generating +/// data from the wrapped PRNG without reseeding. +/// +/// Manually calling [`reseed()`] will not have this retry or delay logic, but +/// reports the error. +/// +/// # Example +/// +/// ``` +/// # extern crate rand; +/// # extern crate rand_chacha; +/// # fn main() { +/// use rand::prelude::*; +/// use rand_chacha::ChaChaCore; // Internal part of ChaChaRng that +/// // implements BlockRngCore +/// use rand::rngs::OsRng; +/// use rand::rngs::adapter::ReseedingRng; +/// +/// let prng = ChaChaCore::from_entropy(); +// FIXME: it is better to use EntropyRng as reseeder, but that doesn't implement +// clone yet. +/// let reseeder = OsRng::new().unwrap(); +/// let mut reseeding_rng = ReseedingRng::new(prng, 0, reseeder); +/// +/// println!("{}", reseeding_rng.gen::()); +/// +/// let mut cloned_rng = reseeding_rng.clone(); +/// assert!(reseeding_rng.gen::() != cloned_rng.gen::()); +/// # } +/// ``` +/// +/// [`ChaChaCore`]: rand_chacha::ChaChaCore +/// [`Hc128Core`]: rand_hc::Hc128Core +/// [`BlockRngCore`]: rand_core::block::BlockRngCore +/// [`ReseedingRng::new`]: ReseedingRng::new +/// [`reseed()`]: ReseedingRng::reseed +#[derive(Debug)] +pub struct ReseedingRng(BlockRng>) +where R: BlockRngCore + SeedableRng, + Rsdr: RngCore; + +impl ReseedingRng +where R: BlockRngCore + SeedableRng, + Rsdr: RngCore +{ + /// Create a new `ReseedingRng` from an existing PRNG, combined with a RNG + /// to use as reseeder. + /// + /// `threshold` sets the number of generated bytes after which to reseed the + /// PRNG. Set it to zero to never reseed based on the number of generated + /// values. + pub fn new(rng: R, threshold: u64, reseeder: Rsdr) -> Self { + ReseedingRng(BlockRng::new(ReseedingCore::new(rng, threshold, reseeder))) + } + + /// Reseed the internal PRNG. + pub fn reseed(&mut self) -> Result<(), Error> { + self.0.core.reseed() + } +} + +// TODO: this should be implemented for any type where the inner type +// implements RngCore, but we can't specify that because ReseedingCore is private +impl RngCore for ReseedingRng +where R: BlockRngCore + SeedableRng, + ::Results: AsRef<[u32]> + AsMut<[u32]> +{ + #[inline(always)] + fn next_u32(&mut self) -> u32 { + self.0.next_u32() + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + self.0.next_u64() + } + + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.0.fill_bytes(dest) + } + + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +impl Clone for ReseedingRng +where R: BlockRngCore + SeedableRng + Clone, + Rsdr: RngCore + Clone +{ + fn clone(&self) -> ReseedingRng { + // Recreating `BlockRng` seems easier than cloning it and resetting + // the index. + ReseedingRng(BlockRng::new(self.0.core.clone())) + } +} + +impl CryptoRng for ReseedingRng +where R: BlockRngCore + SeedableRng + CryptoRng, + Rsdr: RngCore + CryptoRng {} + +#[derive(Debug)] +struct ReseedingCore { + inner: R, + reseeder: Rsdr, + threshold: i64, + bytes_until_reseed: i64, + fork_counter: usize, +} + +impl BlockRngCore for ReseedingCore +where R: BlockRngCore + SeedableRng, + Rsdr: RngCore +{ + type Item = ::Item; + type Results = ::Results; + + fn generate(&mut self, results: &mut Self::Results) { + let global_fork_counter = fork::get_fork_counter(); + if self.bytes_until_reseed <= 0 || + self.is_forked(global_fork_counter) { + // We get better performance by not calling only `reseed` here + // and continuing with the rest of the function, but by directly + // returning from a non-inlined function. + return self.reseed_and_generate(results, global_fork_counter); + } + let num_bytes = results.as_ref().len() * size_of::(); + self.bytes_until_reseed -= num_bytes as i64; + self.inner.generate(results); + } +} + +impl ReseedingCore +where R: BlockRngCore + SeedableRng, + Rsdr: RngCore +{ + /// Create a new `ReseedingCore`. + fn new(rng: R, threshold: u64, reseeder: Rsdr) -> Self { + use ::core::i64::MAX; + fork::register_fork_handler(); + + // Because generating more values than `i64::MAX` takes centuries on + // current hardware, we just clamp to that value. + // Also we set a threshold of 0, which indicates no limit, to that + // value. + let threshold = + if threshold == 0 { MAX } + else if threshold <= MAX as u64 { threshold as i64 } + else { MAX }; + + ReseedingCore { + inner: rng, + reseeder, + threshold: threshold as i64, + bytes_until_reseed: threshold as i64, + fork_counter: 0, + } + } + + /// Reseed the internal PRNG. + fn reseed(&mut self) -> Result<(), Error> { + R::from_rng(&mut self.reseeder).map(|result| { + self.bytes_until_reseed = self.threshold; + self.inner = result + }) + } + + fn is_forked(&self, global_fork_counter: usize) -> bool { + // In theory, on 32-bit platforms, it is possible for + // `global_fork_counter` to wrap around after ~4e9 forks. + // + // This check will detect a fork in the normal case where + // `fork_counter < global_fork_counter`, and also when the difference + // between both is greater than `isize::MAX` (wrapped around). + // + // It will still fail to detect a fork if there have been more than + // `isize::MAX` forks, without any reseed in between. Seems unlikely + // enough. + (self.fork_counter.wrapping_sub(global_fork_counter) as isize) < 0 + } + + #[inline(never)] + fn reseed_and_generate(&mut self, + results: &mut ::Results, + global_fork_counter: usize) + { + if self.is_forked(global_fork_counter) { + info!("Fork detected, reseeding RNG"); + } else { + trace!("Reseeding RNG (periodic reseed)"); + } + + let num_bytes = + results.as_ref().len() * size_of::<::Item>(); + + let threshold = if let Err(e) = self.reseed() { + let delay = match e.kind { + ErrorKind::Transient => num_bytes as i64, + kind @ _ if kind.should_retry() => self.threshold >> 8, + _ => self.threshold, + }; + warn!("Reseeding RNG delayed reseeding by {} bytes due to \ + error from source: {}", delay, e); + delay + } else { + self.fork_counter = global_fork_counter; + self.threshold + }; + + self.bytes_until_reseed = threshold - num_bytes as i64; + self.inner.generate(results); + } +} + +impl Clone for ReseedingCore +where R: BlockRngCore + SeedableRng + Clone, + Rsdr: RngCore + Clone +{ + fn clone(&self) -> ReseedingCore { + ReseedingCore { + inner: self.inner.clone(), + reseeder: self.reseeder.clone(), + threshold: self.threshold, + bytes_until_reseed: 0, // reseed clone on first use + fork_counter: self.fork_counter, + } + } +} + +impl CryptoRng for ReseedingCore +where R: BlockRngCore + SeedableRng + CryptoRng, + Rsdr: RngCore + CryptoRng {} + + +#[cfg(all(feature="std", unix, not(target_os="emscripten")))] +mod fork { + extern crate libc; + + use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; + use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT}; + + // Fork protection + // + // We implement fork protection on Unix using `pthread_atfork`. + // When the process is forked, we increment `RESEEDING_RNG_FORK_COUNTER`. + // Every `ReseedingRng` stores the last known value of the static in + // `fork_counter`. If the cached `fork_counter` is less than + // `RESEEDING_RNG_FORK_COUNTER`, it is time to reseed this RNG. + // + // If reseeding fails, we don't deal with this by setting a delay, but just + // don't update `fork_counter`, so a reseed is attempted as soon as + // possible. + + static RESEEDING_RNG_FORK_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT; + + pub fn get_fork_counter() -> usize { + RESEEDING_RNG_FORK_COUNTER.load(Ordering::Relaxed) + } + + static FORK_HANDLER_REGISTERED: AtomicBool = ATOMIC_BOOL_INIT; + + extern fn fork_handler() { + // Note: fetch_add is defined to wrap on overflow + // (which is what we want). + RESEEDING_RNG_FORK_COUNTER.fetch_add(1, Ordering::Relaxed); + } + + pub fn register_fork_handler() { + if FORK_HANDLER_REGISTERED.load(Ordering::Relaxed) == false { + unsafe { libc::pthread_atfork(None, None, Some(fork_handler)) }; + FORK_HANDLER_REGISTERED.store(true, Ordering::Relaxed); + } + } +} + +#[cfg(not(all(feature="std", unix, not(target_os="emscripten"))))] +mod fork { + pub fn get_fork_counter() -> usize { 0 } + pub fn register_fork_handler() {} +} + + +#[cfg(test)] +mod test { + use {Rng, SeedableRng}; + use rand_chacha::ChaChaCore; + use rngs::mock::StepRng; + use super::ReseedingRng; + + #[test] + fn test_reseeding() { + let mut zero = StepRng::new(0, 0); + let rng = ChaChaCore::from_rng(&mut zero).unwrap(); + let mut reseeding = ReseedingRng::new(rng, 32*4, zero); + + // Currently we only support for arrays up to length 32. + // TODO: cannot generate seq via Rng::gen because it uses different alg + let mut buf = [0u32; 32]; // Needs to be a multiple of the RNGs result + // size to test exactly. + reseeding.fill(&mut buf); + let seq = buf; + for _ in 0..10 { + reseeding.fill(&mut buf); + assert_eq!(buf, seq); + } + } + + #[test] + fn test_clone_reseeding() { + let mut zero = StepRng::new(0, 0); + let rng = ChaChaCore::from_rng(&mut zero).unwrap(); + let mut rng1 = ReseedingRng::new(rng, 32*4, zero); + + let first: u32 = rng1.gen(); + for _ in 0..10 { let _ = rng1.gen::(); } + + let mut rng2 = rng1.clone(); + assert_eq!(first, rng2.gen::()); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/rngs/entropy.rs cargo-0.37.0/vendor/rand-0.6.5/src/rngs/entropy.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/rngs/entropy.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/rngs/entropy.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,248 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Entropy generator, or wrapper around external generators + +use rand_core::{RngCore, CryptoRng, Error, ErrorKind, impls}; +#[allow(unused)] +use rngs; + +/// An interface returning random data from external source(s), provided +/// specifically for securely seeding algorithmic generators (PRNGs). +/// +/// Where possible, `EntropyRng` retrieves random data from the operating +/// system's interface for random numbers ([`OsRng`]); if that fails it will +/// fall back to the [`JitterRng`] entropy collector. In the latter case it will +/// still try to use [`OsRng`] on the next usage. +/// +/// If no secure source of entropy is available `EntropyRng` will panic on use; +/// i.e. it should never output predictable data. +/// +/// This is either a little slow ([`OsRng`] requires a system call) or extremely +/// slow ([`JitterRng`] must use significant CPU time to generate sufficient +/// jitter); for better performance it is common to seed a local PRNG from +/// external entropy then primarily use the local PRNG ([`thread_rng`] is +/// provided as a convenient, local, automatically-seeded CSPRNG). +/// +/// # Panics +/// +/// On most systems, like Windows, Linux, macOS and *BSD on common hardware, it +/// is highly unlikely for both [`OsRng`] and [`JitterRng`] to fail. But on +/// combinations like webassembly without Emscripten or stdweb both sources are +/// unavailable. If both sources fail, only [`try_fill_bytes`] is able to +/// report the error, and only the one from `OsRng`. The other [`RngCore`] +/// methods will panic in case of an error. +/// +/// [`OsRng`]: rand_os::OsRng +/// [`thread_rng`]: crate::thread_rng +/// [`JitterRng`]: crate::rngs::JitterRng +/// [`try_fill_bytes`]: RngCore::try_fill_bytes +#[derive(Debug)] +pub struct EntropyRng { + source: Source, +} + +#[derive(Debug)] +enum Source { + Os(Os), + Custom(Custom), + Jitter(Jitter), + None, +} + +impl EntropyRng { + /// Create a new `EntropyRng`. + /// + /// This method will do no system calls or other initialization routines, + /// those are done on first use. This is done to make `new` infallible, + /// and `try_fill_bytes` the only place to report errors. + pub fn new() -> Self { + EntropyRng { source: Source::None } + } +} + +impl Default for EntropyRng { + fn default() -> Self { + EntropyRng::new() + } +} + +impl RngCore for EntropyRng { + fn next_u32(&mut self) -> u32 { + impls::next_u32_via_fill(self) + } + + fn next_u64(&mut self) -> u64 { + impls::next_u64_via_fill(self) + } + + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.try_fill_bytes(dest).unwrap_or_else(|err| + panic!("all entropy sources failed; first error: {}", err)) + } + + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + let mut reported_error = None; + + if let Source::Os(ref mut os_rng) = self.source { + match os_rng.fill(dest) { + Ok(()) => return Ok(()), + Err(err) => { + warn!("EntropyRng: OsRng failed \ + [trying other entropy sources]: {}", err); + reported_error = Some(err); + }, + } + } else if Os::is_supported() { + match Os::new_and_fill(dest) { + Ok(os_rng) => { + debug!("EntropyRng: using OsRng"); + self.source = Source::Os(os_rng); + return Ok(()); + }, + Err(err) => { reported_error = reported_error.or(Some(err)) }, + } + } + + if let Source::Custom(ref mut rng) = self.source { + match rng.fill(dest) { + Ok(()) => return Ok(()), + Err(err) => { + warn!("EntropyRng: custom entropy source failed \ + [trying other entropy sources]: {}", err); + reported_error = Some(err); + }, + } + } else if Custom::is_supported() { + match Custom::new_and_fill(dest) { + Ok(custom) => { + debug!("EntropyRng: using custom entropy source"); + self.source = Source::Custom(custom); + return Ok(()); + }, + Err(err) => { reported_error = reported_error.or(Some(err)) }, + } + } + + if let Source::Jitter(ref mut jitter_rng) = self.source { + match jitter_rng.fill(dest) { + Ok(()) => return Ok(()), + Err(err) => { + warn!("EntropyRng: JitterRng failed: {}", err); + reported_error = Some(err); + }, + } + } else if Jitter::is_supported() { + match Jitter::new_and_fill(dest) { + Ok(jitter_rng) => { + debug!("EntropyRng: using JitterRng"); + self.source = Source::Jitter(jitter_rng); + return Ok(()); + }, + Err(err) => { reported_error = reported_error.or(Some(err)) }, + } + } + + if let Some(err) = reported_error { + Err(Error::with_cause(ErrorKind::Unavailable, + "All entropy sources failed", + err)) + } else { + Err(Error::new(ErrorKind::Unavailable, + "No entropy sources available")) + } + } +} + +impl CryptoRng for EntropyRng {} + + + +trait EntropySource { + fn new_and_fill(dest: &mut [u8]) -> Result + where Self: Sized; + + fn fill(&mut self, dest: &mut [u8]) -> Result<(), Error>; + + fn is_supported() -> bool { true } +} + +#[allow(unused)] +#[derive(Clone, Debug)] +struct NoSource; + +#[allow(unused)] +impl EntropySource for NoSource { + fn new_and_fill(dest: &mut [u8]) -> Result { + Err(Error::new(ErrorKind::Unavailable, "Source not supported")) + } + + fn fill(&mut self, dest: &mut [u8]) -> Result<(), Error> { + unreachable!() + } + + fn is_supported() -> bool { false } +} + + +#[cfg(feature="rand_os")] +#[derive(Clone, Debug)] +pub struct Os(rngs::OsRng); + +#[cfg(feature="rand_os")] +impl EntropySource for Os { + fn new_and_fill(dest: &mut [u8]) -> Result { + let mut rng = rngs::OsRng::new()?; + rng.try_fill_bytes(dest)?; + Ok(Os(rng)) + } + + fn fill(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +#[cfg(not(feature="std"))] +type Os = NoSource; + + +type Custom = NoSource; + + +#[cfg(not(target_arch = "wasm32"))] +#[derive(Clone, Debug)] +pub struct Jitter(rngs::JitterRng); + +#[cfg(not(target_arch = "wasm32"))] +impl EntropySource for Jitter { + fn new_and_fill(dest: &mut [u8]) -> Result { + let mut rng = rngs::JitterRng::new()?; + rng.try_fill_bytes(dest)?; + Ok(Jitter(rng)) + } + + fn fill(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +#[cfg(target_arch = "wasm32")] +type Jitter = NoSource; + + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_entropy() { + let mut rng = EntropyRng::new(); + let n = (rng.next_u32() ^ rng.next_u32()).count_ones(); + assert!(n >= 2); // p(failure) approx 1e-7 + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/rngs/mock.rs cargo-0.37.0/vendor/rand-0.6.5/src/rngs/mock.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/rngs/mock.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/rngs/mock.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,59 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Mock random number generator + +use rand_core::{RngCore, Error, impls}; + +/// A simple implementation of `RngCore` for testing purposes. +/// +/// This generates an arithmetic sequence (i.e. adds a constant each step) +/// over a `u64` number, using wrapping arithmetic. If the increment is 0 +/// the generator yields a constant. +/// +/// ``` +/// use rand::Rng; +/// use rand::rngs::mock::StepRng; +/// +/// let mut my_rng = StepRng::new(2, 1); +/// let sample: [u64; 3] = my_rng.gen(); +/// assert_eq!(sample, [2, 3, 4]); +/// ``` +#[derive(Debug, Clone)] +pub struct StepRng { + v: u64, + a: u64, +} + +impl StepRng { + /// Create a `StepRng`, yielding an arithmetic sequence starting with + /// `initial` and incremented by `increment` each time. + pub fn new(initial: u64, increment: u64) -> Self { + StepRng { v: initial, a: increment } + } +} + +impl RngCore for StepRng { + fn next_u32(&mut self) -> u32 { + self.next_u64() as u32 + } + + fn next_u64(&mut self) -> u64 { + let result = self.v; + self.v = self.v.wrapping_add(self.a); + result + } + + fn fill_bytes(&mut self, dest: &mut [u8]) { + impls::fill_bytes_via_next(self, dest); + } + + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + Ok(self.fill_bytes(dest)) + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/rngs/mod.rs cargo-0.37.0/vendor/rand-0.6.5/src/rngs/mod.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/rngs/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/rngs/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,167 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Random number generators and adapters for common usage: +//! +//! - [`ThreadRng`], a fast, secure, auto-seeded thread-local generator +//! - [`StdRng`] and [`SmallRng`], algorithms to cover typical usage +//! - [`EntropyRng`], [`OsRng`] and [`JitterRng`] as entropy sources +//! - [`mock::StepRng`] as a simple counter for tests +//! - [`adapter::ReadRng`] to read from a file/stream +//! - [`adapter::ReseedingRng`] to reseed a PRNG on clone / process fork etc. +//! +//! # Background — Random number generators (RNGs) +//! +//! Computers are inherently deterministic, so to get *random* numbers one +//! either has to use a hardware generator or collect bits of *entropy* from +//! various sources (e.g. event timestamps, or jitter). This is a relatively +//! slow and complicated operation. +//! +//! Generally the operating system will collect some entropy, remove bias, and +//! use that to seed its own PRNG; [`OsRng`] provides an interface to this. +//! [`JitterRng`] is an entropy collector included with Rand that measures +//! jitter in the CPU execution time, and jitter in memory access time. +//! [`EntropyRng`] is a wrapper that uses the best entropy source that is +//! available. +//! +//! ## Pseudo-random number generators +//! +//! What is commonly used instead of "true" random number renerators, are +//! *pseudo-random number generators* (PRNGs), deterministic algorithms that +//! produce an infinite stream of pseudo-random numbers from a small random +//! seed. PRNGs are faster, and have better provable properties. The numbers +//! produced can be statistically of very high quality and can be impossible to +//! predict. (They can also have obvious correlations and be trivial to predict; +//! quality varies.) +//! +//! There are two different types of PRNGs: those developed for simulations +//! and statistics, and those developed for use in cryptography; the latter are +//! called Cryptographically Secure PRNGs (CSPRNG or CPRNG). Both types can +//! have good statistical quality but the latter also have to be impossible to +//! predict, even after seeing many previous output values. Rand provides a good +//! default algorithm from each class: +//! +//! - [`SmallRng`] is a PRNG chosen for low memory usage, high performance and +//! good statistical quality. +//! - [`StdRng`] is a CSPRNG chosen for good performance and trust of security +//! (based on reviews, maturity and usage). The current algorithm is HC-128, +//! which is one of the recommendations by ECRYPT's eSTREAM project. +//! +//! The above PRNGs do not cover all use-cases; more algorithms can be found in +//! the [`prng`][crate::prng] module, as well as in several other crates. For example, you +//! may wish a CSPRNG with significantly lower memory usage than [`StdRng`] +//! while being less concerned about performance, in which case [`ChaChaRng`] +//! is a good choice. +//! +//! One complexity is that the internal state of a PRNG must change with every +//! generated number. For APIs this generally means a mutable reference to the +//! state of the PRNG has to be passed around. +//! +//! A solution is [`ThreadRng`]. This is a thread-local implementation of +//! [`StdRng`] with automatic seeding on first use. It is the best choice if you +//! "just" want a convenient, secure, fast random number source. Use via the +//! [`thread_rng`] function, which gets a reference to the current thread's +//! local instance. +//! +//! ## Seeding +//! +//! As mentioned above, PRNGs require a random seed in order to produce random +//! output. This is especially important for CSPRNGs, which are still +//! deterministic algorithms, thus can only be secure if their seed value is +//! also secure. To seed a PRNG, use one of: +//! +//! - [`FromEntropy::from_entropy`]; this is the most convenient way to seed +//! with fresh, secure random data. +//! - [`SeedableRng::from_rng`]; this allows seeding from another PRNG or +//! from an entropy source such as [`EntropyRng`]. +//! - [`SeedableRng::from_seed`]; this is mostly useful if you wish to be able +//! to reproduce the output sequence by using a fixed seed. (Don't use +//! [`StdRng`] or [`SmallRng`] in this case since different algorithms may be +//! used by future versions of Rand; use an algorithm from the +//! [`prng`] module.) +//! +//! ## Conclusion +//! +//! - [`thread_rng`] is what you often want to use. +//! - If you want more control, flexibility, or better performance, use +//! [`StdRng`], [`SmallRng`] or an algorithm from the [`prng`] module. +//! - Use [`FromEntropy::from_entropy`] to seed new PRNGs. +//! - If you need reproducibility, use [`SeedableRng::from_seed`] combined with +//! a named PRNG. +//! +//! More information and notes on cryptographic security can be found +//! in the [`prng`] module. +//! +//! ## Examples +//! +//! Examples of seeding PRNGs: +//! +//! ``` +//! use rand::prelude::*; +//! # use rand::Error; +//! +//! // StdRng seeded securely by the OS or local entropy collector: +//! let mut rng = StdRng::from_entropy(); +//! # let v: u32 = rng.gen(); +//! +//! // SmallRng seeded from thread_rng: +//! # fn try_inner() -> Result<(), Error> { +//! let mut rng = SmallRng::from_rng(thread_rng())?; +//! # let v: u32 = rng.gen(); +//! # Ok(()) +//! # } +//! # try_inner().unwrap(); +//! +//! // SmallRng seeded by a constant, for deterministic results: +//! let seed = [1,2,3,4, 5,6,7,8, 9,10,11,12, 13,14,15,16]; // byte array +//! let mut rng = SmallRng::from_seed(seed); +//! # let v: u32 = rng.gen(); +//! ``` +//! +//! +//! # Implementing custom RNGs +//! +//! If you want to implement custom RNG, see the [`rand_core`] crate. The RNG +//! will have to implement the [`RngCore`] trait, where the [`Rng`] trait is +//! build on top of. +//! +//! If the RNG needs seeding, also implement the [`SeedableRng`] trait. +//! +//! [`CryptoRng`] is a marker trait cryptographically secure PRNGs can +//! implement. +//! +//! [`OsRng`]: rand_os::OsRng +//! [`SmallRng`]: rngs::SmallRng +//! [`StdRng`]: rngs::StdRng +//! [`ThreadRng`]: rngs::ThreadRng +//! [`EntropyRng`]: rngs::EntropyRng +//! [`JitterRng`]: rngs::JitterRng +//! [`mock::StepRng`]: rngs::mock::StepRng +//! [`adapter::ReadRng`]: rngs::adapter::ReadRng +//! [`adapter::ReseedingRng`]: rngs::adapter::ReseedingRng +//! [`ChaChaRng`]: rand_chacha::ChaChaRng + +pub mod adapter; + +#[cfg(feature="std")] mod entropy; +pub mod mock; // Public so we don't export `StepRng` directly, making it a bit + // more clear it is intended for testing. +mod small; +mod std; +#[cfg(feature="std")] pub(crate) mod thread; + + +pub use rand_jitter::{JitterRng, TimerError}; +#[cfg(feature="std")] pub use self::entropy::EntropyRng; + +pub use self::small::SmallRng; +pub use self::std::StdRng; +#[cfg(feature="std")] pub use self::thread::ThreadRng; + +#[cfg(feature="rand_os")] +pub use rand_os::OsRng; diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/rngs/small.rs cargo-0.37.0/vendor/rand-0.6.5/src/rngs/small.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/rngs/small.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/rngs/small.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,106 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! A small fast RNG + +use {RngCore, SeedableRng, Error}; + +#[cfg(all(all(rustc_1_26, not(target_os = "emscripten")), target_pointer_width = "64"))] +type Rng = ::rand_pcg::Pcg64Mcg; +#[cfg(not(all(all(rustc_1_26, not(target_os = "emscripten")), target_pointer_width = "64")))] +type Rng = ::rand_pcg::Pcg32; + +/// An RNG recommended when small state, cheap initialization and good +/// performance are required. The PRNG algorithm in `SmallRng` is chosen to be +/// efficient on the current platform, **without consideration for cryptography +/// or security**. The size of its state is much smaller than for [`StdRng`]. +/// +/// Reproducibility of output from this generator is however not required, thus +/// future library versions may use a different internal generator with +/// different output. Further, this generator may not be portable and can +/// produce different output depending on the architecture. If you require +/// reproducible output, use a named RNG. +/// Refer to [The Book](https://rust-random.github.io/book/guide-rngs.html). +/// +/// +/// The current algorithm is [`Pcg64Mcg`][rand_pcg::Pcg64Mcg] on 64-bit platforms with Rust version +/// 1.26 and later, or [`Pcg32`][rand_pcg::Pcg32] otherwise. Both are found in +/// the [rand_pcg] crate. +/// +/// # Examples +/// +/// Initializing `SmallRng` with a random seed can be done using [`FromEntropy`]: +/// +/// ``` +/// # use rand::Rng; +/// use rand::FromEntropy; +/// use rand::rngs::SmallRng; +/// +/// // Create small, cheap to initialize and fast RNG with a random seed. +/// // The randomness is supplied by the operating system. +/// let mut small_rng = SmallRng::from_entropy(); +/// # let v: u32 = small_rng.gen(); +/// ``` +/// +/// When initializing a lot of `SmallRng`'s, using [`thread_rng`] can be more +/// efficient: +/// +/// ``` +/// use std::iter; +/// use rand::{SeedableRng, thread_rng}; +/// use rand::rngs::SmallRng; +/// +/// // Create a big, expensive to initialize and slower, but unpredictable RNG. +/// // This is cached and done only once per thread. +/// let mut thread_rng = thread_rng(); +/// // Create small, cheap to initialize and fast RNGs with random seeds. +/// // One can generally assume this won't fail. +/// let rngs: Vec = iter::repeat(()) +/// .map(|()| SmallRng::from_rng(&mut thread_rng).unwrap()) +/// .take(10) +/// .collect(); +/// ``` +/// +/// [`FromEntropy`]: crate::FromEntropy +/// [`StdRng`]: crate::rngs::StdRng +/// [`thread_rng`]: crate::thread_rng +/// [rand_pcg]: https://crates.io/crates/rand_pcg +#[derive(Clone, Debug)] +pub struct SmallRng(Rng); + +impl RngCore for SmallRng { + #[inline(always)] + fn next_u32(&mut self) -> u32 { + self.0.next_u32() + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + self.0.next_u64() + } + + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.0.fill_bytes(dest); + } + + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +impl SeedableRng for SmallRng { + type Seed = ::Seed; + + fn from_seed(seed: Self::Seed) -> Self { + SmallRng(Rng::from_seed(seed)) + } + + fn from_rng(rng: R) -> Result { + Rng::from_rng(rng).map(SmallRng) + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/rngs/std.rs cargo-0.37.0/vendor/rand-0.6.5/src/rngs/std.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/rngs/std.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/rngs/std.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,85 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The standard RNG + +use {RngCore, CryptoRng, Error, SeedableRng}; +use rand_hc::Hc128Rng; + +/// The standard RNG. The PRNG algorithm in `StdRng` is chosen to be efficient +/// on the current platform, to be statistically strong and unpredictable +/// (meaning a cryptographically secure PRNG). +/// +/// The current algorithm used on all platforms is [HC-128], found in the +/// [rand_hc] crate. +/// +/// Reproducibility of output from this generator is however not required, thus +/// future library versions may use a different internal generator with +/// different output. Further, this generator may not be portable and can +/// produce different output depending on the architecture. If you require +/// reproducible output, use a named RNG, for example [`ChaChaRng`] from the +/// [rand_chacha] crate. +/// +/// [HC-128]: rand_hc::Hc128Rng +/// [`ChaChaRng`]: rand_chacha::ChaChaRng +/// [rand_hc]: https://crates.io/crates/rand_hc +/// [rand_chacha]: https://crates.io/crates/rand_chacha +#[derive(Clone, Debug)] +pub struct StdRng(Hc128Rng); + +impl RngCore for StdRng { + #[inline(always)] + fn next_u32(&mut self) -> u32 { + self.0.next_u32() + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + self.0.next_u64() + } + + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.0.fill_bytes(dest); + } + + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +impl SeedableRng for StdRng { + type Seed = ::Seed; + + fn from_seed(seed: Self::Seed) -> Self { + StdRng(Hc128Rng::from_seed(seed)) + } + + fn from_rng(rng: R) -> Result { + Hc128Rng::from_rng(rng).map(StdRng) + } +} + +impl CryptoRng for StdRng {} + + +#[cfg(test)] +mod test { + use {RngCore, SeedableRng}; + use rngs::StdRng; + + #[test] + fn test_stdrng_construction() { + let seed = [1,0,0,0, 23,0,0,0, 200,1,0,0, 210,30,0,0, + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; + let mut rng1 = StdRng::from_seed(seed); + assert_eq!(rng1.next_u64(), 15759097995037006553); + + let mut rng2 = StdRng::from_rng(rng1).unwrap(); + assert_eq!(rng2.next_u64(), 6766915756997287454); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/rngs/thread.rs cargo-0.37.0/vendor/rand-0.6.5/src/rngs/thread.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/rngs/thread.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/rngs/thread.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,137 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Thread-local random number generator + +use std::cell::UnsafeCell; + +use {RngCore, CryptoRng, SeedableRng, Error}; +use rngs::adapter::ReseedingRng; +use rngs::EntropyRng; +use rand_hc::Hc128Core; + +// Rationale for using `UnsafeCell` in `ThreadRng`: +// +// Previously we used a `RefCell`, with an overhead of ~15%. There will only +// ever be one mutable reference to the interior of the `UnsafeCell`, because +// we only have such a reference inside `next_u32`, `next_u64`, etc. Within a +// single thread (which is the definition of `ThreadRng`), there will only ever +// be one of these methods active at a time. +// +// A possible scenario where there could be multiple mutable references is if +// `ThreadRng` is used inside `next_u32` and co. But the implementation is +// completely under our control. We just have to ensure none of them use +// `ThreadRng` internally, which is nonsensical anyway. We should also never run +// `ThreadRng` in destructors of its implementation, which is also nonsensical. +// +// The additional `Rc` is not strictly neccesary, and could be removed. For now +// it ensures `ThreadRng` stays `!Send` and `!Sync`, and implements `Clone`. + + +// Number of generated bytes after which to reseed `TreadRng`. +// +// The time it takes to reseed HC-128 is roughly equivalent to generating 7 KiB. +// We pick a treshold here that is large enough to not reduce the average +// performance too much, but also small enough to not make reseeding something +// that basically never happens. +const THREAD_RNG_RESEED_THRESHOLD: u64 = 32*1024*1024; // 32 MiB + +/// The type returned by [`thread_rng`], essentially just a reference to the +/// PRNG in thread-local memory. +/// +/// `ThreadRng` uses [`ReseedingRng`] wrapping the same PRNG as [`StdRng`], +/// which is reseeded after generating 32 MiB of random data. A single instance +/// is cached per thread and the returned `ThreadRng` is a reference to this +/// instance — hence `ThreadRng` is neither `Send` nor `Sync` but is safe to use +/// within a single thread. This RNG is seeded and reseeded via [`EntropyRng`] +/// as required. +/// +/// Note that the reseeding is done as an extra precaution against entropy +/// leaks and is in theory unnecessary — to predict `ThreadRng`'s output, an +/// attacker would have to either determine most of the RNG's seed or internal +/// state, or crack the algorithm used. +/// +/// Like [`StdRng`], `ThreadRng` is a cryptographically secure PRNG. The current +/// algorithm used is [HC-128], which is an array-based PRNG that trades memory +/// usage for better performance. This makes it similar to ISAAC, the algorithm +/// used in `ThreadRng` before rand 0.5. +/// +/// Cloning this handle just produces a new reference to the same thread-local +/// generator. +/// +/// [`ReseedingRng`]: crate::rngs::adapter::ReseedingRng +/// [`StdRng`]: crate::rngs::StdRng +/// [HC-128]: rand_hc::Hc128Rng +#[derive(Clone, Debug)] +pub struct ThreadRng { + // use of raw pointer implies type is neither Send nor Sync + rng: *mut ReseedingRng, +} + +thread_local!( + static THREAD_RNG_KEY: UnsafeCell> = { + let mut entropy_source = EntropyRng::new(); + let r = Hc128Core::from_rng(&mut entropy_source).unwrap_or_else(|err| + panic!("could not initialize thread_rng: {}", err)); + let rng = ReseedingRng::new(r, + THREAD_RNG_RESEED_THRESHOLD, + entropy_source); + UnsafeCell::new(rng) + } +); + +/// Retrieve the lazily-initialized thread-local random number generator, +/// seeded by the system. Intended to be used in method chaining style, +/// e.g. `thread_rng().gen::()`, or cached locally, e.g. +/// `let mut rng = thread_rng();`. Invoked by the `Default` trait, making +/// `ThreadRng::default()` equivelent. +/// +/// For more information see [`ThreadRng`]. +pub fn thread_rng() -> ThreadRng { + ThreadRng { rng: THREAD_RNG_KEY.with(|t| t.get()) } +} + +impl Default for ThreadRng { + fn default() -> ThreadRng { + ::prelude::thread_rng() + } +} + +impl RngCore for ThreadRng { + #[inline(always)] + fn next_u32(&mut self) -> u32 { + unsafe { (*self.rng).next_u32() } + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + unsafe { (*self.rng).next_u64() } + } + + fn fill_bytes(&mut self, dest: &mut [u8]) { + unsafe { (*self.rng).fill_bytes(dest) } + } + + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + unsafe { (*self.rng).try_fill_bytes(dest) } + } +} + +impl CryptoRng for ThreadRng {} + + +#[cfg(test)] +mod test { + #[test] + fn test_thread_rng() { + use Rng; + let mut r = ::thread_rng(); + r.gen::(); + assert_eq!(r.gen_range(0, 1), 0); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/seq/index.rs cargo-0.37.0/vendor/rand-0.6.5/src/seq/index.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/seq/index.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/seq/index.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,378 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Index sampling + +#[cfg(feature="alloc")] use core::slice; + +#[cfg(feature="std")] use std::vec; +#[cfg(all(feature="alloc", not(feature="std")))] use alloc::vec::{self, Vec}; +// BTreeMap is not as fast in tests, but better than nothing. +#[cfg(feature="std")] use std::collections::{HashSet}; +#[cfg(all(feature="alloc", not(feature="std")))] use alloc::collections::BTreeSet; + +#[cfg(feature="alloc")] use distributions::{Distribution, Uniform}; +use Rng; + +/// A vector of indices. +/// +/// Multiple internal representations are possible. +#[derive(Clone, Debug)] +pub enum IndexVec { + #[doc(hidden)] U32(Vec), + #[doc(hidden)] USize(Vec), +} + +impl IndexVec { + /// Returns the number of indices + pub fn len(&self) -> usize { + match self { + &IndexVec::U32(ref v) => v.len(), + &IndexVec::USize(ref v) => v.len(), + } + } + + /// Return the value at the given `index`. + /// + /// (Note: we cannot implement [`std::ops::Index`] because of lifetime + /// restrictions.) + pub fn index(&self, index: usize) -> usize { + match self { + &IndexVec::U32(ref v) => v[index] as usize, + &IndexVec::USize(ref v) => v[index], + } + } + + /// Return result as a `Vec`. Conversion may or may not be trivial. + pub fn into_vec(self) -> Vec { + match self { + IndexVec::U32(v) => v.into_iter().map(|i| i as usize).collect(), + IndexVec::USize(v) => v, + } + } + + /// Iterate over the indices as a sequence of `usize` values + pub fn iter<'a>(&'a self) -> IndexVecIter<'a> { + match self { + &IndexVec::U32(ref v) => IndexVecIter::U32(v.iter()), + &IndexVec::USize(ref v) => IndexVecIter::USize(v.iter()), + } + } + + /// Convert into an iterator over the indices as a sequence of `usize` values + pub fn into_iter(self) -> IndexVecIntoIter { + match self { + IndexVec::U32(v) => IndexVecIntoIter::U32(v.into_iter()), + IndexVec::USize(v) => IndexVecIntoIter::USize(v.into_iter()), + } + } +} + +impl PartialEq for IndexVec { + fn eq(&self, other: &IndexVec) -> bool { + use self::IndexVec::*; + match (self, other) { + (&U32(ref v1), &U32(ref v2)) => v1 == v2, + (&USize(ref v1), &USize(ref v2)) => v1 == v2, + (&U32(ref v1), &USize(ref v2)) => (v1.len() == v2.len()) + && (v1.iter().zip(v2.iter()).all(|(x, y)| *x as usize == *y)), + (&USize(ref v1), &U32(ref v2)) => (v1.len() == v2.len()) + && (v1.iter().zip(v2.iter()).all(|(x, y)| *x == *y as usize)), + } + } +} + +impl From> for IndexVec { + fn from(v: Vec) -> Self { + IndexVec::U32(v) + } +} + +impl From> for IndexVec { + fn from(v: Vec) -> Self { + IndexVec::USize(v) + } +} + +/// Return type of `IndexVec::iter`. +#[derive(Debug)] +pub enum IndexVecIter<'a> { + #[doc(hidden)] U32(slice::Iter<'a, u32>), + #[doc(hidden)] USize(slice::Iter<'a, usize>), +} + +impl<'a> Iterator for IndexVecIter<'a> { + type Item = usize; + fn next(&mut self) -> Option { + use self::IndexVecIter::*; + match self { + &mut U32(ref mut iter) => iter.next().map(|i| *i as usize), + &mut USize(ref mut iter) => iter.next().cloned(), + } + } + + fn size_hint(&self) -> (usize, Option) { + match self { + &IndexVecIter::U32(ref v) => v.size_hint(), + &IndexVecIter::USize(ref v) => v.size_hint(), + } + } +} + +impl<'a> ExactSizeIterator for IndexVecIter<'a> {} + +/// Return type of `IndexVec::into_iter`. +#[derive(Clone, Debug)] +pub enum IndexVecIntoIter { + #[doc(hidden)] U32(vec::IntoIter), + #[doc(hidden)] USize(vec::IntoIter), +} + +impl Iterator for IndexVecIntoIter { + type Item = usize; + + fn next(&mut self) -> Option { + use self::IndexVecIntoIter::*; + match self { + &mut U32(ref mut v) => v.next().map(|i| i as usize), + &mut USize(ref mut v) => v.next(), + } + } + + fn size_hint(&self) -> (usize, Option) { + use self::IndexVecIntoIter::*; + match self { + &U32(ref v) => v.size_hint(), + &USize(ref v) => v.size_hint(), + } + } +} + +impl ExactSizeIterator for IndexVecIntoIter {} + + +/// Randomly sample exactly `amount` distinct indices from `0..length`, and +/// return them in random order (fully shuffled). +/// +/// This method is used internally by the slice sampling methods, but it can +/// sometimes be useful to have the indices themselves so this is provided as +/// an alternative. +/// +/// The implementation used is not specified; we automatically select the +/// fastest available algorithm for the `length` and `amount` parameters +/// (based on detailed profiling on an Intel Haswell CPU). Roughly speaking, +/// complexity is `O(amount)`, except that when `amount` is small, performance +/// is closer to `O(amount^2)`, and when `length` is close to `amount` then +/// `O(length)`. +/// +/// Note that performance is significantly better over `u32` indices than over +/// `u64` indices. Because of this we hide the underlying type behind an +/// abstraction, `IndexVec`. +/// +/// If an allocation-free `no_std` function is required, it is suggested +/// to adapt the internal `sample_floyd` implementation. +/// +/// Panics if `amount > length`. +pub fn sample(rng: &mut R, length: usize, amount: usize) -> IndexVec + where R: Rng + ?Sized, +{ + if amount > length { + panic!("`amount` of samples must be less than or equal to `length`"); + } + if length > (::core::u32::MAX as usize) { + // We never want to use inplace here, but could use floyd's alg + // Lazy version: always use the cache alg. + return sample_rejection(rng, length, amount); + } + let amount = amount as u32; + let length = length as u32; + + // Choice of algorithm here depends on both length and amount. See: + // https://github.com/rust-random/rand/pull/479 + // We do some calculations with f32. Accuracy is not very important. + + if amount < 163 { + const C: [[f32; 2]; 2] = [[1.6, 8.0/45.0], [10.0, 70.0/9.0]]; + let j = if length < 500_000 { 0 } else { 1 }; + let amount_fp = amount as f32; + let m4 = C[0][j] * amount_fp; + // Short-cut: when amount < 12, floyd's is always faster + if amount > 11 && (length as f32) < (C[1][j] + m4) * amount_fp { + sample_inplace(rng, length, amount) + } else { + sample_floyd(rng, length, amount) + } + } else { + const C: [f32; 2] = [270.0, 330.0/9.0]; + let j = if length < 500_000 { 0 } else { 1 }; + if (length as f32) < C[j] * (amount as f32) { + sample_inplace(rng, length, amount) + } else { + // note: could have a specific u32 impl, but I'm lazy and + // generics don't have usable conversions + sample_rejection(rng, length as usize, amount as usize) + } + } +} + +/// Randomly sample exactly `amount` indices from `0..length`, using Floyd's +/// combination algorithm. +/// +/// The output values are fully shuffled. (Overhead is under 50%.) +/// +/// This implementation uses `O(amount)` memory and `O(amount^2)` time. +fn sample_floyd(rng: &mut R, length: u32, amount: u32) -> IndexVec + where R: Rng + ?Sized, +{ + // For small amount we use Floyd's fully-shuffled variant. For larger + // amounts this is slow due to Vec::insert performance, so we shuffle + // afterwards. Benchmarks show little overhead from extra logic. + let floyd_shuffle = amount < 50; + + debug_assert!(amount <= length); + let mut indices = Vec::with_capacity(amount as usize); + for j in length - amount .. length { + let t = rng.gen_range(0, j + 1); + if floyd_shuffle { + if let Some(pos) = indices.iter().position(|&x| x == t) { + indices.insert(pos, j); + continue; + } + } else { + if indices.contains(&t) { + indices.push(j); + continue; + } + } + indices.push(t); + } + if !floyd_shuffle { + // Reimplement SliceRandom::shuffle with smaller indices + for i in (1..amount).rev() { + // invariant: elements with index > i have been locked in place. + indices.swap(i as usize, rng.gen_range(0, i + 1) as usize); + } + } + IndexVec::from(indices) +} + +/// Randomly sample exactly `amount` indices from `0..length`, using an inplace +/// partial Fisher-Yates method. +/// Sample an amount of indices using an inplace partial fisher yates method. +/// +/// This allocates the entire `length` of indices and randomizes only the first `amount`. +/// It then truncates to `amount` and returns. +/// +/// This method is not appropriate for large `length` and potentially uses a lot +/// of memory; because of this we only implement for `u32` index (which improves +/// performance in all cases). +/// +/// Set-up is `O(length)` time and memory and shuffling is `O(amount)` time. +fn sample_inplace(rng: &mut R, length: u32, amount: u32) -> IndexVec + where R: Rng + ?Sized, +{ + debug_assert!(amount <= length); + let mut indices: Vec = Vec::with_capacity(length as usize); + indices.extend(0..length); + for i in 0..amount { + let j: u32 = rng.gen_range(i, length); + indices.swap(i as usize, j as usize); + } + indices.truncate(amount as usize); + debug_assert_eq!(indices.len(), amount as usize); + IndexVec::from(indices) +} + +/// Randomly sample exactly `amount` indices from `0..length`, using rejection +/// sampling. +/// +/// Since `amount <<< length` there is a low chance of a random sample in +/// `0..length` being a duplicate. We test for duplicates and resample where +/// necessary. The algorithm is `O(amount)` time and memory. +fn sample_rejection(rng: &mut R, length: usize, amount: usize) -> IndexVec + where R: Rng + ?Sized, +{ + debug_assert!(amount < length); + #[cfg(feature="std")] let mut cache = HashSet::with_capacity(amount); + #[cfg(not(feature="std"))] let mut cache = BTreeSet::new(); + let distr = Uniform::new(0, length); + let mut indices = Vec::with_capacity(amount); + for _ in 0..amount { + let mut pos = distr.sample(rng); + while !cache.insert(pos) { + pos = distr.sample(rng); + } + indices.push(pos); + } + + debug_assert_eq!(indices.len(), amount); + IndexVec::from(indices) +} + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_sample_boundaries() { + let mut r = ::test::rng(404); + + assert_eq!(sample_inplace(&mut r, 0, 0).len(), 0); + assert_eq!(sample_inplace(&mut r, 1, 0).len(), 0); + assert_eq!(sample_inplace(&mut r, 1, 1).into_vec(), vec![0]); + + assert_eq!(sample_rejection(&mut r, 1, 0).len(), 0); + + assert_eq!(sample_floyd(&mut r, 0, 0).len(), 0); + assert_eq!(sample_floyd(&mut r, 1, 0).len(), 0); + assert_eq!(sample_floyd(&mut r, 1, 1).into_vec(), vec![0]); + + // These algorithms should be fast with big numbers. Test average. + let sum: usize = sample_rejection(&mut r, 1 << 25, 10) + .into_iter().sum(); + assert!(1 << 25 < sum && sum < (1 << 25) * 25); + + let sum: usize = sample_floyd(&mut r, 1 << 25, 10) + .into_iter().sum(); + assert!(1 << 25 < sum && sum < (1 << 25) * 25); + } + + #[test] + fn test_sample_alg() { + let seed_rng = ::test::rng; + + // We can't test which algorithm is used directly, but Floyd's alg + // should produce different results from the others. (Also, `inplace` + // and `cached` currently use different sizes thus produce different results.) + + // A small length and relatively large amount should use inplace + let (length, amount): (usize, usize) = (100, 50); + let v1 = sample(&mut seed_rng(420), length, amount); + let v2 = sample_inplace(&mut seed_rng(420), length as u32, amount as u32); + assert!(v1.iter().all(|e| e < length)); + assert_eq!(v1, v2); + + // Test Floyd's alg does produce different results + let v3 = sample_floyd(&mut seed_rng(420), length as u32, amount as u32); + assert!(v1 != v3); + + // A large length and small amount should use Floyd + let (length, amount): (usize, usize) = (1<<20, 50); + let v1 = sample(&mut seed_rng(421), length, amount); + let v2 = sample_floyd(&mut seed_rng(421), length as u32, amount as u32); + assert!(v1.iter().all(|e| e < length)); + assert_eq!(v1, v2); + + // A large length and larger amount should use cache + let (length, amount): (usize, usize) = (1<<20, 600); + let v1 = sample(&mut seed_rng(422), length, amount); + let v2 = sample_rejection(&mut seed_rng(422), length, amount); + assert!(v1.iter().all(|e| e < length)); + assert_eq!(v1, v2); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/src/seq/mod.rs cargo-0.37.0/vendor/rand-0.6.5/src/seq/mod.rs --- cargo-0.35.0/vendor/rand-0.6.5/src/seq/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/src/seq/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,829 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Functions for randomly accessing and sampling sequences. +//! +//! TODO: module doc + + +#[cfg(feature="alloc")] pub mod index; + +#[cfg(feature="alloc")] use core::ops::Index; + +#[cfg(all(feature="alloc", not(feature="std")))] use alloc::vec::Vec; + +use Rng; +#[cfg(feature="alloc")] use distributions::WeightedError; +#[cfg(feature="alloc")] use distributions::uniform::{SampleUniform, SampleBorrow}; + +/// Extension trait on slices, providing random mutation and sampling methods. +/// +/// An implementation is provided for slices. This may also be implementable for +/// other types. +pub trait SliceRandom { + /// The element type. + type Item; + + /// Returns a reference to one random element of the slice, or `None` if the + /// slice is empty. + /// + /// Depending on the implementation, complexity is expected to be `O(1)`. + /// + /// # Example + /// + /// ``` + /// use rand::thread_rng; + /// use rand::seq::SliceRandom; + /// + /// let choices = [1, 2, 4, 8, 16, 32]; + /// let mut rng = thread_rng(); + /// println!("{:?}", choices.choose(&mut rng)); + /// assert_eq!(choices[..0].choose(&mut rng), None); + /// ``` + fn choose(&self, rng: &mut R) -> Option<&Self::Item> + where R: Rng + ?Sized; + + /// Returns a mutable reference to one random element of the slice, or + /// `None` if the slice is empty. + /// + /// Depending on the implementation, complexity is expected to be `O(1)`. + fn choose_mut(&mut self, rng: &mut R) -> Option<&mut Self::Item> + where R: Rng + ?Sized; + + /// Produces an iterator that chooses `amount` elements from the slice at + /// random without repeating any, and returns them in random order. + /// + /// In case this API is not sufficiently flexible, use `index::sample` then + /// apply the indices to the slice. + /// + /// Complexity is expected to be the same as `index::sample`. + /// + /// # Example + /// ``` + /// use rand::seq::SliceRandom; + /// + /// let mut rng = &mut rand::thread_rng(); + /// let sample = "Hello, audience!".as_bytes(); + /// + /// // collect the results into a vector: + /// let v: Vec = sample.choose_multiple(&mut rng, 3).cloned().collect(); + /// + /// // store in a buffer: + /// let mut buf = [0u8; 5]; + /// for (b, slot) in sample.choose_multiple(&mut rng, buf.len()).zip(buf.iter_mut()) { + /// *slot = *b; + /// } + /// ``` + #[cfg(feature = "alloc")] + fn choose_multiple(&self, rng: &mut R, amount: usize) -> SliceChooseIter + where R: Rng + ?Sized; + + /// Similar to [`choose`], where the likelihood of each outcome may be + /// specified. The specified function `weight` maps items `x` to a relative + /// likelihood `weight(x)`. The probability of each item being selected is + /// therefore `weight(x) / s`, where `s` is the sum of all `weight(x)`. + /// + /// # Example + /// + /// ``` + /// use rand::prelude::*; + /// + /// let choices = [('a', 2), ('b', 1), ('c', 1)]; + /// let mut rng = thread_rng(); + /// // 50% chance to print 'a', 25% chance to print 'b', 25% chance to print 'c' + /// println!("{:?}", choices.choose_weighted(&mut rng, |item| item.1).unwrap().0); + /// ``` + /// [`choose`]: SliceRandom::choose + #[cfg(feature = "alloc")] + fn choose_weighted(&self, rng: &mut R, weight: F) -> Result<&Self::Item, WeightedError> + where R: Rng + ?Sized, + F: Fn(&Self::Item) -> B, + B: SampleBorrow, + X: SampleUniform + + for<'a> ::core::ops::AddAssign<&'a X> + + ::core::cmp::PartialOrd + + Clone + + Default; + + /// Similar to [`choose_mut`], where the likelihood of each outcome may be + /// specified. The specified function `weight` maps items `x` to a relative + /// likelihood `weight(x)`. The probability of each item being selected is + /// therefore `weight(x) / s`, where `s` is the sum of all `weight(x)`. + /// + /// See also [`choose_weighted`]. + /// + /// [`choose_mut`]: SliceRandom::choose_mut + /// [`choose_weighted`]: SliceRandom::choose_weighted + #[cfg(feature = "alloc")] + fn choose_weighted_mut(&mut self, rng: &mut R, weight: F) -> Result<&mut Self::Item, WeightedError> + where R: Rng + ?Sized, + F: Fn(&Self::Item) -> B, + B: SampleBorrow, + X: SampleUniform + + for<'a> ::core::ops::AddAssign<&'a X> + + ::core::cmp::PartialOrd + + Clone + + Default; + + /// Shuffle a mutable slice in place. + /// + /// Depending on the implementation, complexity is expected to be `O(1)`. + /// + /// # Example + /// + /// ``` + /// use rand::thread_rng; + /// use rand::seq::SliceRandom; + /// + /// let mut rng = thread_rng(); + /// let mut y = [1, 2, 3, 4, 5]; + /// println!("Unshuffled: {:?}", y); + /// y.shuffle(&mut rng); + /// println!("Shuffled: {:?}", y); + /// ``` + fn shuffle(&mut self, rng: &mut R) where R: Rng + ?Sized; + + /// Shuffle a slice in place, but exit early. + /// + /// Returns two mutable slices from the source slice. The first contains + /// `amount` elements randomly permuted. The second has the remaining + /// elements that are not fully shuffled. + /// + /// This is an efficient method to select `amount` elements at random from + /// the slice, provided the slice may be mutated. + /// + /// If you only need to choose elements randomly and `amount > self.len()/2` + /// then you may improve performance by taking + /// `amount = values.len() - amount` and using only the second slice. + /// + /// If `amount` is greater than the number of elements in the slice, this + /// will perform a full shuffle. + /// + /// Complexity is expected to be `O(m)` where `m = amount`. + fn partial_shuffle(&mut self, rng: &mut R, amount: usize) + -> (&mut [Self::Item], &mut [Self::Item]) where R: Rng + ?Sized; +} + +/// Extension trait on iterators, providing random sampling methods. +pub trait IteratorRandom: Iterator + Sized { + /// Choose one element at random from the iterator. If you have a slice, + /// it's significantly faster to call the [`choose`] or [`choose_mut`] + /// functions using the slice instead. + /// + /// Returns `None` if and only if the iterator is empty. + /// + /// Complexity is `O(n)`, where `n` is the length of the iterator. + /// This likely consumes multiple random numbers, but the exact number + /// is unspecified. + /// + /// [`choose`]: SliceRandom::method.choose + /// [`choose_mut`]: SliceRandom::choose_mut + fn choose(mut self, rng: &mut R) -> Option + where R: Rng + ?Sized + { + let (mut lower, mut upper) = self.size_hint(); + let mut consumed = 0; + let mut result = None; + + if upper == Some(lower) { + return if lower == 0 { None } else { self.nth(rng.gen_range(0, lower)) }; + } + + // Continue until the iterator is exhausted + loop { + if lower > 1 { + let ix = rng.gen_range(0, lower + consumed); + let skip; + if ix < lower { + result = self.nth(ix); + skip = lower - (ix + 1); + } else { + skip = lower; + } + if upper == Some(lower) { + return result; + } + consumed += lower; + if skip > 0 { + self.nth(skip - 1); + } + } else { + let elem = self.next(); + if elem.is_none() { + return result; + } + consumed += 1; + let denom = consumed as f64; // accurate to 2^53 elements + if rng.gen_bool(1.0 / denom) { + result = elem; + } + } + + let hint = self.size_hint(); + lower = hint.0; + upper = hint.1; + } + } + + /// Collects `amount` values at random from the iterator into a supplied + /// buffer. + /// + /// Although the elements are selected randomly, the order of elements in + /// the buffer is neither stable nor fully random. If random ordering is + /// desired, shuffle the result. + /// + /// Returns the number of elements added to the buffer. This equals `amount` + /// unless the iterator contains insufficient elements, in which case this + /// equals the number of elements available. + /// + /// Complexity is `O(n)` where `n` is the length of the iterator. + fn choose_multiple_fill(mut self, rng: &mut R, buf: &mut [Self::Item]) + -> usize where R: Rng + ?Sized + { + let amount = buf.len(); + let mut len = 0; + while len < amount { + if let Some(elem) = self.next() { + buf[len] = elem; + len += 1; + } else { + // Iterator exhausted; stop early + return len; + } + } + + // Continue, since the iterator was not exhausted + for (i, elem) in self.enumerate() { + let k = rng.gen_range(0, i + 1 + amount); + if let Some(slot) = buf.get_mut(k) { + *slot = elem; + } + } + len + } + + /// Collects `amount` values at random from the iterator into a vector. + /// + /// This is equivalent to `choose_multiple_fill` except for the result type. + /// + /// Although the elements are selected randomly, the order of elements in + /// the buffer is neither stable nor fully random. If random ordering is + /// desired, shuffle the result. + /// + /// The length of the returned vector equals `amount` unless the iterator + /// contains insufficient elements, in which case it equals the number of + /// elements available. + /// + /// Complexity is `O(n)` where `n` is the length of the iterator. + #[cfg(feature = "alloc")] + fn choose_multiple(mut self, rng: &mut R, amount: usize) -> Vec + where R: Rng + ?Sized + { + let mut reservoir = Vec::with_capacity(amount); + reservoir.extend(self.by_ref().take(amount)); + + // Continue unless the iterator was exhausted + // + // note: this prevents iterators that "restart" from causing problems. + // If the iterator stops once, then so do we. + if reservoir.len() == amount { + for (i, elem) in self.enumerate() { + let k = rng.gen_range(0, i + 1 + amount); + if let Some(slot) = reservoir.get_mut(k) { + *slot = elem; + } + } + } else { + // Don't hang onto extra memory. There is a corner case where + // `amount` was much less than `self.len()`. + reservoir.shrink_to_fit(); + } + reservoir + } +} + + +impl SliceRandom for [T] { + type Item = T; + + fn choose(&self, rng: &mut R) -> Option<&Self::Item> + where R: Rng + ?Sized + { + if self.is_empty() { + None + } else { + Some(&self[rng.gen_range(0, self.len())]) + } + } + + fn choose_mut(&mut self, rng: &mut R) -> Option<&mut Self::Item> + where R: Rng + ?Sized + { + if self.is_empty() { + None + } else { + let len = self.len(); + Some(&mut self[rng.gen_range(0, len)]) + } + } + + #[cfg(feature = "alloc")] + fn choose_multiple(&self, rng: &mut R, amount: usize) + -> SliceChooseIter + where R: Rng + ?Sized + { + let amount = ::core::cmp::min(amount, self.len()); + SliceChooseIter { + slice: self, + _phantom: Default::default(), + indices: index::sample(rng, self.len(), amount).into_iter(), + } + } + + #[cfg(feature = "alloc")] + fn choose_weighted(&self, rng: &mut R, weight: F) -> Result<&Self::Item, WeightedError> + where R: Rng + ?Sized, + F: Fn(&Self::Item) -> B, + B: SampleBorrow, + X: SampleUniform + + for<'a> ::core::ops::AddAssign<&'a X> + + ::core::cmp::PartialOrd + + Clone + + Default { + use distributions::{Distribution, WeightedIndex}; + let distr = WeightedIndex::new(self.iter().map(weight))?; + Ok(&self[distr.sample(rng)]) + } + + #[cfg(feature = "alloc")] + fn choose_weighted_mut(&mut self, rng: &mut R, weight: F) -> Result<&mut Self::Item, WeightedError> + where R: Rng + ?Sized, + F: Fn(&Self::Item) -> B, + B: SampleBorrow, + X: SampleUniform + + for<'a> ::core::ops::AddAssign<&'a X> + + ::core::cmp::PartialOrd + + Clone + + Default { + use distributions::{Distribution, WeightedIndex}; + let distr = WeightedIndex::new(self.iter().map(weight))?; + Ok(&mut self[distr.sample(rng)]) + } + + fn shuffle(&mut self, rng: &mut R) where R: Rng + ?Sized + { + for i in (1..self.len()).rev() { + // invariant: elements with index > i have been locked in place. + self.swap(i, rng.gen_range(0, i + 1)); + } + } + + fn partial_shuffle(&mut self, rng: &mut R, amount: usize) + -> (&mut [Self::Item], &mut [Self::Item]) where R: Rng + ?Sized + { + // This applies Durstenfeld's algorithm for the + // [Fisher–Yates shuffle](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm) + // for an unbiased permutation, but exits early after choosing `amount` + // elements. + + let len = self.len(); + let end = if amount >= len { 0 } else { len - amount }; + + for i in (end..len).rev() { + // invariant: elements with index > i have been locked in place. + self.swap(i, rng.gen_range(0, i + 1)); + } + let r = self.split_at_mut(end); + (r.1, r.0) + } +} + +impl IteratorRandom for I where I: Iterator + Sized {} + + +/// Iterator over multiple choices, as returned by [`SliceRandom::choose_multiple] +#[cfg(feature = "alloc")] +#[derive(Debug)] +pub struct SliceChooseIter<'a, S: ?Sized + 'a, T: 'a> { + slice: &'a S, + _phantom: ::core::marker::PhantomData, + indices: index::IndexVecIntoIter, +} + +#[cfg(feature = "alloc")] +impl<'a, S: Index + ?Sized + 'a, T: 'a> Iterator for SliceChooseIter<'a, S, T> { + type Item = &'a T; + + fn next(&mut self) -> Option { + // TODO: investigate using SliceIndex::get_unchecked when stable + self.indices.next().map(|i| &self.slice[i as usize]) + } + + fn size_hint(&self) -> (usize, Option) { + (self.indices.len(), Some(self.indices.len())) + } +} + +#[cfg(feature = "alloc")] +impl<'a, S: Index + ?Sized + 'a, T: 'a> ExactSizeIterator + for SliceChooseIter<'a, S, T> +{ + fn len(&self) -> usize { + self.indices.len() + } +} + + +/// Randomly sample `amount` elements from a finite iterator. +/// +/// Deprecated: use [`IteratorRandom::choose_multiple`] instead. +#[cfg(feature = "alloc")] +#[deprecated(since="0.6.0", note="use IteratorRandom::choose_multiple instead")] +pub fn sample_iter(rng: &mut R, iterable: I, amount: usize) -> Result, Vec> + where I: IntoIterator, + R: Rng + ?Sized, +{ + use seq::IteratorRandom; + let iter = iterable.into_iter(); + let result = iter.choose_multiple(rng, amount); + if result.len() == amount { + Ok(result) + } else { + Err(result) + } +} + +/// Randomly sample exactly `amount` values from `slice`. +/// +/// The values are non-repeating and in random order. +/// +/// This implementation uses `O(amount)` time and memory. +/// +/// Panics if `amount > slice.len()` +/// +/// Deprecated: use [`SliceRandom::choose_multiple`] instead. +#[cfg(feature = "alloc")] +#[deprecated(since="0.6.0", note="use SliceRandom::choose_multiple instead")] +pub fn sample_slice(rng: &mut R, slice: &[T], amount: usize) -> Vec + where R: Rng + ?Sized, + T: Clone +{ + let indices = index::sample(rng, slice.len(), amount).into_iter(); + + let mut out = Vec::with_capacity(amount); + out.extend(indices.map(|i| slice[i].clone())); + out +} + +/// Randomly sample exactly `amount` references from `slice`. +/// +/// The references are non-repeating and in random order. +/// +/// This implementation uses `O(amount)` time and memory. +/// +/// Panics if `amount > slice.len()` +/// +/// Deprecated: use [`SliceRandom::choose_multiple`] instead. +#[cfg(feature = "alloc")] +#[deprecated(since="0.6.0", note="use SliceRandom::choose_multiple instead")] +pub fn sample_slice_ref<'a, R, T>(rng: &mut R, slice: &'a [T], amount: usize) -> Vec<&'a T> + where R: Rng + ?Sized +{ + let indices = index::sample(rng, slice.len(), amount).into_iter(); + + let mut out = Vec::with_capacity(amount); + out.extend(indices.map(|i| &slice[i])); + out +} + +#[cfg(test)] +mod test { + use super::*; + #[cfg(feature = "alloc")] use {Rng, SeedableRng}; + #[cfg(feature = "alloc")] use rngs::SmallRng; + #[cfg(all(feature="alloc", not(feature="std")))] + use alloc::vec::Vec; + + #[test] + fn test_slice_choose() { + let mut r = ::test::rng(107); + let chars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n']; + let mut chosen = [0i32; 14]; + for _ in 0..1000 { + let picked = *chars.choose(&mut r).unwrap(); + chosen[(picked as usize) - ('a' as usize)] += 1; + } + for count in chosen.iter() { + let err = *count - (1000 / (chars.len() as i32)); + assert!(-20 <= err && err <= 20); + } + + chosen.iter_mut().for_each(|x| *x = 0); + for _ in 0..1000 { + *chosen.choose_mut(&mut r).unwrap() += 1; + } + for count in chosen.iter() { + let err = *count - (1000 / (chosen.len() as i32)); + assert!(-20 <= err && err <= 20); + } + + let mut v: [isize; 0] = []; + assert_eq!(v.choose(&mut r), None); + assert_eq!(v.choose_mut(&mut r), None); + } + + #[derive(Clone)] + struct UnhintedIterator { + iter: I, + } + impl Iterator for UnhintedIterator { + type Item = I::Item; + fn next(&mut self) -> Option { + self.iter.next() + } + } + + #[derive(Clone)] + struct ChunkHintedIterator { + iter: I, + chunk_remaining: usize, + chunk_size: usize, + hint_total_size: bool, + } + impl Iterator for ChunkHintedIterator { + type Item = I::Item; + fn next(&mut self) -> Option { + if self.chunk_remaining == 0 { + self.chunk_remaining = ::core::cmp::min(self.chunk_size, + self.iter.len()); + } + self.chunk_remaining = self.chunk_remaining.saturating_sub(1); + + self.iter.next() + } + fn size_hint(&self) -> (usize, Option) { + (self.chunk_remaining, + if self.hint_total_size { Some(self.iter.len()) } else { None }) + } + } + + #[derive(Clone)] + struct WindowHintedIterator { + iter: I, + window_size: usize, + hint_total_size: bool, + } + impl Iterator for WindowHintedIterator { + type Item = I::Item; + fn next(&mut self) -> Option { + self.iter.next() + } + fn size_hint(&self) -> (usize, Option) { + (::core::cmp::min(self.iter.len(), self.window_size), + if self.hint_total_size { Some(self.iter.len()) } else { None }) + } + } + + #[test] + fn test_iterator_choose() { + let r = &mut ::test::rng(109); + fn test_iter + Clone>(r: &mut R, iter: Iter) { + let mut chosen = [0i32; 9]; + for _ in 0..1000 { + let picked = iter.clone().choose(r).unwrap(); + chosen[picked] += 1; + } + for count in chosen.iter() { + // Samples should follow Binomial(1000, 1/9) + // Octave: binopdf(x, 1000, 1/9) gives the prob of *count == x + // Note: have seen 153, which is unlikely but not impossible. + assert!(72 < *count && *count < 154, "count not close to 1000/9: {}", count); + } + } + + test_iter(r, 0..9); + test_iter(r, [0, 1, 2, 3, 4, 5, 6, 7, 8].iter().cloned()); + #[cfg(feature = "alloc")] + test_iter(r, (0..9).collect::>().into_iter()); + test_iter(r, UnhintedIterator { iter: 0..9 }); + test_iter(r, ChunkHintedIterator { iter: 0..9, chunk_size: 4, chunk_remaining: 4, hint_total_size: false }); + test_iter(r, ChunkHintedIterator { iter: 0..9, chunk_size: 4, chunk_remaining: 4, hint_total_size: true }); + test_iter(r, WindowHintedIterator { iter: 0..9, window_size: 2, hint_total_size: false }); + test_iter(r, WindowHintedIterator { iter: 0..9, window_size: 2, hint_total_size: true }); + + assert_eq!((0..0).choose(r), None); + assert_eq!(UnhintedIterator{ iter: 0..0 }.choose(r), None); + } + + #[test] + fn test_shuffle() { + let mut r = ::test::rng(108); + let empty: &mut [isize] = &mut []; + empty.shuffle(&mut r); + let mut one = [1]; + one.shuffle(&mut r); + let b: &[_] = &[1]; + assert_eq!(one, b); + + let mut two = [1, 2]; + two.shuffle(&mut r); + assert!(two == [1, 2] || two == [2, 1]); + + fn move_last(slice: &mut [usize], pos: usize) { + // use slice[pos..].rotate_left(1); once we can use that + let last_val = slice[pos]; + for i in pos..slice.len() - 1 { + slice[i] = slice[i + 1]; + } + *slice.last_mut().unwrap() = last_val; + } + let mut counts = [0i32; 24]; + for _ in 0..10000 { + let mut arr: [usize; 4] = [0, 1, 2, 3]; + arr.shuffle(&mut r); + let mut permutation = 0usize; + let mut pos_value = counts.len(); + for i in 0..4 { + pos_value /= 4 - i; + let pos = arr.iter().position(|&x| x == i).unwrap(); + assert!(pos < (4 - i)); + permutation += pos * pos_value; + move_last(&mut arr, pos); + assert_eq!(arr[3], i); + } + for i in 0..4 { + assert_eq!(arr[i], i); + } + counts[permutation] += 1; + } + for count in counts.iter() { + let err = *count - 10000i32 / 24; + assert!(-50 <= err && err <= 50); + } + } + + #[test] + fn test_partial_shuffle() { + let mut r = ::test::rng(118); + + let mut empty: [u32; 0] = []; + let res = empty.partial_shuffle(&mut r, 10); + assert_eq!((res.0.len(), res.1.len()), (0, 0)); + + let mut v = [1, 2, 3, 4, 5]; + let res = v.partial_shuffle(&mut r, 2); + assert_eq!((res.0.len(), res.1.len()), (2, 3)); + assert!(res.0[0] != res.0[1]); + // First elements are only modified if selected, so at least one isn't modified: + assert!(res.1[0] == 1 || res.1[1] == 2 || res.1[2] == 3); + } + + #[test] + #[cfg(feature = "alloc")] + fn test_sample_iter() { + let min_val = 1; + let max_val = 100; + + let mut r = ::test::rng(401); + let vals = (min_val..max_val).collect::>(); + let small_sample = vals.iter().choose_multiple(&mut r, 5); + let large_sample = vals.iter().choose_multiple(&mut r, vals.len() + 5); + + assert_eq!(small_sample.len(), 5); + assert_eq!(large_sample.len(), vals.len()); + // no randomization happens when amount >= len + assert_eq!(large_sample, vals.iter().collect::>()); + + assert!(small_sample.iter().all(|e| { + **e >= min_val && **e <= max_val + })); + } + + #[test] + #[cfg(feature = "alloc")] + #[allow(deprecated)] + fn test_sample_slice_boundaries() { + let empty: &[u8] = &[]; + + let mut r = ::test::rng(402); + + // sample 0 items + assert_eq!(&sample_slice(&mut r, empty, 0)[..], [0u8; 0]); + assert_eq!(&sample_slice(&mut r, &[42, 2, 42], 0)[..], [0u8; 0]); + + // sample 1 item + assert_eq!(&sample_slice(&mut r, &[42], 1)[..], [42]); + let v = sample_slice(&mut r, &[1, 42], 1)[0]; + assert!(v == 1 || v == 42); + + // sample "all" the items + let v = sample_slice(&mut r, &[42, 133], 2); + assert!(&v[..] == [42, 133] || v[..] == [133, 42]); + + // Make sure lucky 777's aren't lucky + let slice = &[42, 777]; + let mut num_42 = 0; + let total = 1000; + for _ in 0..total { + let v = sample_slice(&mut r, slice, 1); + assert_eq!(v.len(), 1); + let v = v[0]; + assert!(v == 42 || v == 777); + if v == 42 { + num_42 += 1; + } + } + let ratio_42 = num_42 as f64 / 1000 as f64; + assert!(0.4 <= ratio_42 || ratio_42 <= 0.6, "{}", ratio_42); + } + + #[test] + #[cfg(feature = "alloc")] + #[allow(deprecated)] + fn test_sample_slice() { + let seeded_rng = SmallRng::from_seed; + + let mut r = ::test::rng(403); + + for n in 1..20 { + let length = 5*n - 4; // 1, 6, ... + let amount = r.gen_range(0, length); + let mut seed = [0u8; 16]; + r.fill(&mut seed); + + // assert the basics work + let regular = index::sample(&mut seeded_rng(seed), length, amount); + assert_eq!(regular.len(), amount); + assert!(regular.iter().all(|e| e < length)); + + // also test that sampling the slice works + let vec: Vec = (0..(length as u32)).collect(); + let result = sample_slice(&mut seeded_rng(seed), &vec, amount); + assert_eq!(result, regular.iter().map(|i| i as u32).collect::>()); + + let result = sample_slice_ref(&mut seeded_rng(seed), &vec, amount); + assert!(result.iter().zip(regular.iter()).all(|(i,j)| **i == j as u32)); + } + } + + #[test] + #[cfg(feature = "alloc")] + fn test_weighted() { + let mut r = ::test::rng(406); + const N_REPS: u32 = 3000; + let weights = [1u32, 2, 3, 0, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7]; + let total_weight = weights.iter().sum::() as f32; + + let verify = |result: [i32; 14]| { + for (i, count) in result.iter().enumerate() { + let exp = (weights[i] * N_REPS) as f32 / total_weight; + let mut err = (*count as f32 - exp).abs(); + if err != 0.0 { + err /= exp; + } + assert!(err <= 0.25); + } + }; + + // choose_weighted + fn get_weight(item: &(u32, T)) -> u32 { + item.0 + } + let mut chosen = [0i32; 14]; + let mut items = [(0u32, 0usize); 14]; // (weight, index) + for (i, item) in items.iter_mut().enumerate() { + *item = (weights[i], i); + } + for _ in 0..N_REPS { + let item = items.choose_weighted(&mut r, get_weight).unwrap(); + chosen[item.1] += 1; + } + verify(chosen); + + // choose_weighted_mut + let mut items = [(0u32, 0i32); 14]; // (weight, count) + for (i, item) in items.iter_mut().enumerate() { + *item = (weights[i], 0); + } + for _ in 0..N_REPS { + items.choose_weighted_mut(&mut r, get_weight).unwrap().1 += 1; + } + for (ch, item) in chosen.iter_mut().zip(items.iter()) { + *ch = item.1; + } + verify(chosen); + + // Check error cases + let empty_slice = &mut [10][0..0]; + assert_eq!(empty_slice.choose_weighted(&mut r, |_| 1), Err(WeightedError::NoItem)); + assert_eq!(empty_slice.choose_weighted_mut(&mut r, |_| 1), Err(WeightedError::NoItem)); + assert_eq!(['x'].choose_weighted_mut(&mut r, |_| 0), Err(WeightedError::AllWeightsZero)); + assert_eq!([0, -1].choose_weighted_mut(&mut r, |x| *x), Err(WeightedError::NegativeWeight)); + assert_eq!([-1, 0].choose_weighted_mut(&mut r, |x| *x), Err(WeightedError::NegativeWeight)); + } +} diff -Nru cargo-0.35.0/vendor/rand-0.6.5/tests/uniformity.rs cargo-0.37.0/vendor/rand-0.6.5/tests/uniformity.rs --- cargo-0.35.0/vendor/rand-0.6.5/tests/uniformity.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand-0.6.5/tests/uniformity.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,67 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![cfg(feature = "std")] + +#[macro_use] +extern crate average; +extern crate rand; + +use std as core; +use rand::FromEntropy; +use rand::distributions::Distribution; +use average::Histogram; + +const N_BINS: usize = 100; +const N_SAMPLES: u32 = 1_000_000; +const TOL: f64 = 1e-3; +define_histogram!(hist, 100); +use hist::Histogram as Histogram100; + +#[test] +fn unit_sphere() { + const N_DIM: usize = 3; + let h = Histogram100::with_const_width(-1., 1.); + let mut histograms = [h.clone(), h.clone(), h]; + let dist = rand::distributions::UnitSphereSurface::new(); + let mut rng = rand::rngs::SmallRng::from_entropy(); + for _ in 0..N_SAMPLES { + let v = dist.sample(&mut rng); + for i in 0..N_DIM { + histograms[i].add(v[i]).map_err( + |e| { println!("v: {}", v[i]); e } + ).unwrap(); + } + } + for h in &histograms { + let sum: u64 = h.bins().iter().sum(); + println!("{:?}", h); + for &b in h.bins() { + let p = (b as f64) / (sum as f64); + assert!((p - 1.0 / (N_BINS as f64)).abs() < TOL, "{}", p); + } + } +} + +#[test] +fn unit_circle() { + use ::std::f64::consts::PI; + let mut h = Histogram100::with_const_width(-PI, PI); + let dist = rand::distributions::UnitCircle::new(); + let mut rng = rand::rngs::SmallRng::from_entropy(); + for _ in 0..N_SAMPLES { + let v = dist.sample(&mut rng); + h.add(v[0].atan2(v[1])).unwrap(); + } + let sum: u64 = h.bins().iter().sum(); + println!("{:?}", h); + for &b in h.bins() { + let p = (b as f64) / (sum as f64); + assert!((p - 1.0 / (N_BINS as f64)).abs() < TOL, "{}", p); + } +} diff -Nru cargo-0.35.0/vendor/rand_chacha/.cargo-checksum.json cargo-0.37.0/vendor/rand_chacha/.cargo-checksum.json --- cargo-0.35.0/vendor/rand_chacha/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_chacha/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"} \ No newline at end of file +{"files":{},"package":"e193067942ef6f485a349a113329140d0ab9e2168ce92274499bb0e9a4190d9d"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/rand_chacha/Cargo.toml cargo-0.37.0/vendor/rand_chacha/Cargo.toml --- cargo-0.35.0/vendor/rand_chacha/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_chacha/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,22 +12,30 @@ [package] name = "rand_chacha" -version = "0.1.1" -authors = ["The Rand Project Developers", "The Rust Project Developers"] +version = "0.2.0" +authors = ["The Rand Project Developers", "The Rust Project Developers", "The CryptoCorrosion Contributors"] build = "build.rs" description = "ChaCha random number generator\n" homepage = "https://crates.io/crates/rand_chacha" -documentation = "https://rust-random.github.io/rand/rand_chacha" +documentation = "https://rust-random.github.io/rand/rand_chacha/" readme = "README.md" keywords = ["random", "rng", "chacha"] categories = ["algorithms", "no-std"] license = "MIT/Apache-2.0" repository = "https://github.com/rust-random/rand" -[dependencies.rand_core] -version = ">=0.2, <0.4" +[dependencies.c2-chacha] +version = "0.2.2" default-features = false + +[dependencies.rand_core] +version = "0.5" [build-dependencies.autocfg] version = "0.1" + +[features] +default = ["std", "simd"] +simd = ["c2-chacha/simd"] +std = ["c2-chacha/std"] [badges.appveyor] repository = "rust-random/rand" diff -Nru cargo-0.35.0/vendor/rand_chacha/CHANGELOG.md cargo-0.37.0/vendor/rand_chacha/CHANGELOG.md --- cargo-0.35.0/vendor/rand_chacha/CHANGELOG.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_chacha/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -4,6 +4,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.0] - 2019-06-06 +- Rewrite based on the much faster `c2-chacha` crate (#789) + ## [0.1.1] - 2019-01-04 - Disable `i128` and `u128` if the `target_os` is `emscripten` (#671: work-around Emscripten limitation) - Update readme and doc links diff -Nru cargo-0.35.0/vendor/rand_chacha/README.md cargo-0.37.0/vendor/rand_chacha/README.md --- cargo-0.35.0/vendor/rand_chacha/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_chacha/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -6,7 +6,7 @@ [![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) [![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_chacha) [![API](https://docs.rs/rand_chacha/badge.svg)](https://docs.rs/rand_chacha) -[![Minimum rustc version](https://img.shields.io/badge/rustc-1.22+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements) +[![Minimum rustc version](https://img.shields.io/badge/rustc-1.32+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements) A cryptographically secure random number generator that uses the ChaCha algorithm. @@ -16,11 +16,14 @@ selected as one of the "stream ciphers suitable for widespread adoption" by eSTREAM[^2]. +The RNGs provided by this crate are implemented via the fast stream ciphers of +the [`c2-chacha`](https://crates.io/crates/c2-chacha) crate. + Links: - [API documentation (master)](https://rust-random.github.io/rand/rand_chacha) - [API documentation (docs.rs)](https://docs.rs/rand_chacha) -- [Changelog](CHANGELOG.md) +- [Changelog](https://github.com/rust-random/rand/blob/master/rand_chacha/CHANGELOG.md) [rand]: https://crates.io/crates/rand [^1]: D. J. Bernstein, [*ChaCha, a variant of Salsa20*]( diff -Nru cargo-0.35.0/vendor/rand_chacha/src/chacha.rs cargo-0.37.0/vendor/rand_chacha/src/chacha.rs --- cargo-0.35.0/vendor/rand_chacha/src/chacha.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_chacha/src/chacha.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,5 +1,4 @@ // Copyright 2018 Developers of the Rand project. -// Copyright 2014 The Rust Project Developers. // // Licensed under the Apache License, Version 2.0 or the MIT license @@ -9,274 +8,254 @@ //! The ChaCha random number generator. -use core::fmt; -use rand_core::{CryptoRng, RngCore, SeedableRng, Error, le}; -use rand_core::block::{BlockRngCore, BlockRng}; - -const SEED_WORDS: usize = 8; // 8 words for the 256-bit key -const STATE_WORDS: usize = 16; - -/// A cryptographically secure random number generator that uses the ChaCha -/// algorithm. -/// -/// ChaCha is a stream cipher designed by Daniel J. Bernstein[^1], that we use -/// as an RNG. It is an improved variant of the Salsa20 cipher family, which was -/// selected as one of the "stream ciphers suitable for widespread adoption" by -/// eSTREAM[^2]. -/// -/// ChaCha uses add-rotate-xor (ARX) operations as its basis. These are safe -/// against timing attacks, although that is mostly a concern for ciphers and -/// not for RNGs. Also it is very suitable for SIMD implementation. -/// Here we do not provide a SIMD implementation yet, except for what is -/// provided by auto-vectorisation. -/// -/// With the ChaCha algorithm it is possible to choose the number of rounds the -/// core algorithm should run. The number of rounds is a tradeoff between -/// performance and security, where 8 rounds is the minimum potentially -/// secure configuration, and 20 rounds is widely used as a conservative choice. -/// We use 20 rounds in this implementation, but hope to allow type-level -/// configuration in the future. -/// -/// We use a 64-bit counter and 64-bit stream identifier as in Bernstein's -/// implementation[^1] except that we use a stream identifier in place of a -/// nonce. A 64-bit counter over 64-byte (16 word) blocks allows 1 ZiB of output -/// before cycling, and the stream identifier allows 264 unique -/// streams of output per seed. Both counter and stream are initialized to zero -/// but may be set via [`set_word_pos`] and [`set_stream`]. -/// -/// The word layout is: -/// -/// ```text -/// constant constant constant constant -/// seed seed seed seed -/// seed seed seed seed -/// counter counter stream_id stream_id -/// ``` -/// -/// This implementation uses an output buffer of sixteen `u32` words, and uses -/// [`BlockRng`] to implement the [`RngCore`] methods. -/// -/// [^1]: D. J. Bernstein, [*ChaCha, a variant of Salsa20*]( -/// https://cr.yp.to/chacha.html) -/// -/// [^2]: [eSTREAM: the ECRYPT Stream Cipher Project]( -/// http://www.ecrypt.eu.org/stream/) -/// -/// [`set_word_pos`]: #method.set_word_pos -/// [`set_stream`]: #method.set_stream -/// [`BlockRng`]: ../rand_core/block/struct.BlockRng.html -/// [`RngCore`]: ../rand_core/trait.RngCore.html -#[derive(Clone, Debug)] -pub struct ChaChaRng(BlockRng); - -impl RngCore for ChaChaRng { - #[inline] - fn next_u32(&mut self) -> u32 { - self.0.next_u32() - } - - #[inline] - fn next_u64(&mut self) -> u64 { - self.0.next_u64() - } - - #[inline] - fn fill_bytes(&mut self, dest: &mut [u8]) { - self.0.fill_bytes(dest) - } - - #[inline] - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.0.try_fill_bytes(dest) +#[cfg(feature = "std")] +use std as core; +#[cfg(not(feature = "std"))] +use core; + +use c2_chacha::guts::ChaCha; +use self::core::fmt; +use rand_core::block::{BlockRng, BlockRngCore}; +use rand_core::{CryptoRng, Error, RngCore, SeedableRng}; + +const STREAM_PARAM_NONCE: u32 = 1; +const STREAM_PARAM_BLOCK: u32 = 0; + +pub struct Array64([T; 64]); +impl Default for Array64 where T: Default { + fn default() -> Self { + Self([T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), + T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), + T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), + T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), + T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), + T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), + T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), + T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), T::default(), T::default()]) } } - -impl SeedableRng for ChaChaRng { - type Seed = ::Seed; - - fn from_seed(seed: Self::Seed) -> Self { - ChaChaRng(BlockRng::::from_seed(seed)) +impl AsRef<[T]> for Array64 { + fn as_ref(&self) -> &[T] { + &self.0 } - - fn from_rng(rng: R) -> Result { - BlockRng::::from_rng(rng).map(ChaChaRng) +} +impl AsMut<[T]> for Array64 { + fn as_mut(&mut self) -> &mut [T] { + &mut self.0 + } +} +impl Clone for Array64 where T: Copy + Default { + fn clone(&self) -> Self { + let mut new = Self::default(); + new.0.copy_from_slice(&self.0); + new + } +} +impl fmt::Debug for Array64 { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "Array64 {{}}") } } -impl CryptoRng for ChaChaRng {} +macro_rules! chacha_impl { + ($ChaChaXCore:ident, $ChaChaXRng:ident, $rounds:expr, $doc:expr) => { + #[doc=$doc] + #[derive(Clone)] + pub struct $ChaChaXCore { + state: ChaCha, + } -impl ChaChaRng { - /// Get the offset from the start of the stream, in 32-bit words. - /// - /// Since the generated blocks are 16 words (24) long and the - /// counter is 64-bits, the offset is a 68-bit number. Sub-word offsets are - /// not supported, hence the result can simply be multiplied by 4 to get a - /// byte-offset. - /// - /// Note: this function is currently only available with Rust 1.26 or later. - #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] - pub fn get_word_pos(&self) -> u128 { - let mut c = (self.0.core.state[13] as u64) << 32 - | (self.0.core.state[12] as u64); - let mut index = self.0.index(); - // c is the end of the last block generated, unless index is at end - if index >= STATE_WORDS { - index = 0; - } else { - c = c.wrapping_sub(1); - } - ((c as u128) << 4) | (index as u128) - } - - /// Set the offset from the start of the stream, in 32-bit words. - /// - /// As with `get_word_pos`, we use a 68-bit number. Since the generator - /// simply cycles at the end of its period (1 ZiB), we ignore the upper - /// 60 bits. - /// - /// Note: this function is currently only available with Rust 1.26 or later. - #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] - pub fn set_word_pos(&mut self, word_offset: u128) { - let index = (word_offset as usize) & 0xF; - let counter = (word_offset >> 4) as u64; - self.0.core.state[12] = counter as u32; - self.0.core.state[13] = (counter >> 32) as u32; - if index != 0 { - self.0.generate_and_set(index); // also increments counter - } else { - self.0.reset(); - } - } - - /// Set the stream number. - /// - /// This is initialized to zero; 264 unique streams of output - /// are available per seed/key. - /// - /// Note that in order to reproduce ChaCha output with a specific 64-bit - /// nonce, one can convert that nonce to a `u64` in little-endian fashion - /// and pass to this function. In theory a 96-bit nonce can be used by - /// passing the last 64-bits to this function and using the first 32-bits as - /// the most significant half of the 64-bit counter (which may be set - /// indirectly via `set_word_pos`), but this is not directly supported. - pub fn set_stream(&mut self, stream: u64) { - let index = self.0.index(); - self.0.core.state[14] = stream as u32; - self.0.core.state[15] = (stream >> 32) as u32; - if index < STATE_WORDS { - // we need to regenerate a partial result buffer - { - // reverse of counter adjustment in generate() - if self.0.core.state[12] == 0 { - self.0.core.state[13] = self.0.core.state[13].wrapping_sub(1); - } - self.0.core.state[12] = self.0.core.state[12].wrapping_sub(1); + // Custom Debug implementation that does not expose the internal state + impl fmt::Debug for $ChaChaXCore { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "ChaChaXCore {{}}") } - self.0.generate_and_set(index); } - } -} -/// The core of `ChaChaRng`, used with `BlockRng`. -#[derive(Clone)] -pub struct ChaChaCore { - state: [u32; STATE_WORDS], -} + impl BlockRngCore for $ChaChaXCore { + type Item = u32; + type Results = Array64; + #[inline] + fn generate(&mut self, r: &mut Self::Results) { + // Fill slice of words by writing to equivalent slice of bytes, then fixing endianness. + self.state.refill4($rounds, unsafe { + core::mem::transmute::<&mut Array64, &mut [u8; 256]>(&mut *r) + }); + for x in r.as_mut() { + *x = x.to_le(); + } + } + } -// Custom Debug implementation that does not expose the internal state -impl fmt::Debug for ChaChaCore { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "ChaChaCore {{}}") - } -} + impl SeedableRng for $ChaChaXCore { + type Seed = [u8; 32]; + #[inline] + fn from_seed(seed: Self::Seed) -> Self { + $ChaChaXCore { state: ChaCha::new(&seed, &[0u8; 8]) } + } + } -macro_rules! quarter_round{ - ($a: expr, $b: expr, $c: expr, $d: expr) => {{ - $a = $a.wrapping_add($b); $d ^= $a; $d = $d.rotate_left(16); - $c = $c.wrapping_add($d); $b ^= $c; $b = $b.rotate_left(12); - $a = $a.wrapping_add($b); $d ^= $a; $d = $d.rotate_left( 8); - $c = $c.wrapping_add($d); $b ^= $c; $b = $b.rotate_left( 7); - }} -} + /// A cryptographically secure random number generator that uses the ChaCha algorithm. + /// + /// ChaCha is a stream cipher designed by Daniel J. Bernstein[^1], that we use as an RNG. It is + /// an improved variant of the Salsa20 cipher family, which was selected as one of the "stream + /// ciphers suitable for widespread adoption" by eSTREAM[^2]. + /// + /// ChaCha uses add-rotate-xor (ARX) operations as its basis. These are safe against timing + /// attacks, although that is mostly a concern for ciphers and not for RNGs. We provide a SIMD + /// implementation to support high throughput on a variety of common hardware platforms. + /// + /// With the ChaCha algorithm it is possible to choose the number of rounds the core algorithm + /// should run. The number of rounds is a tradeoff between performance and security, where 8 + /// rounds is the minimum potentially secure configuration, and 20 rounds is widely used as a + /// conservative choice. + /// + /// We use a 64-bit counter and 64-bit stream identifier as in Bernstein's implementation[^1] + /// except that we use a stream identifier in place of a nonce. A 64-bit counter over 64-byte + /// (16 word) blocks allows 1 ZiB of output before cycling, and the stream identifier allows + /// 264 unique streams of output per seed. Both counter and stream are initialized + /// to zero but may be set via [`set_word_pos`] and [`set_stream`]. + /// + /// The word layout is: + /// + /// ```text + /// constant constant constant constant + /// seed seed seed seed + /// seed seed seed seed + /// counter counter stream_id stream_id + /// ``` + /// + /// This implementation uses an output buffer of sixteen `u32` words, and uses + /// [`BlockRng`] to implement the [`RngCore`] methods. + /// + /// [^1]: D. J. Bernstein, [*ChaCha, a variant of Salsa20*]( + /// https://cr.yp.to/chacha.html) + /// + /// [^2]: [eSTREAM: the ECRYPT Stream Cipher Project]( + /// http://www.ecrypt.eu.org/stream/) + /// + /// [`set_word_pos`]: ChaChaXRng::set_word_pos + /// [`set_stream`]: ChaChaXRng::set_stream + #[derive(Clone, Debug)] + pub struct $ChaChaXRng { + rng: BlockRng<$ChaChaXCore>, + } -macro_rules! double_round{ - ($x: expr) => {{ - // Column round - quarter_round!($x[ 0], $x[ 4], $x[ 8], $x[12]); - quarter_round!($x[ 1], $x[ 5], $x[ 9], $x[13]); - quarter_round!($x[ 2], $x[ 6], $x[10], $x[14]); - quarter_round!($x[ 3], $x[ 7], $x[11], $x[15]); - // Diagonal round - quarter_round!($x[ 0], $x[ 5], $x[10], $x[15]); - quarter_round!($x[ 1], $x[ 6], $x[11], $x[12]); - quarter_round!($x[ 2], $x[ 7], $x[ 8], $x[13]); - quarter_round!($x[ 3], $x[ 4], $x[ 9], $x[14]); - }} -} + impl SeedableRng for $ChaChaXRng { + type Seed = [u8; 32]; + #[inline] + fn from_seed(seed: Self::Seed) -> Self { + let core = $ChaChaXCore::from_seed(seed); + Self { + rng: BlockRng::new(core), + } + } + } -impl BlockRngCore for ChaChaCore { - type Item = u32; - type Results = [u32; STATE_WORDS]; - - fn generate(&mut self, results: &mut Self::Results) { - // For some reason extracting this part into a separate function - // improves performance by 50%. - fn core(results: &mut [u32; STATE_WORDS], - state: &[u32; STATE_WORDS]) - { - let mut tmp = *state; - let rounds = 20; - for _ in 0..rounds / 2 { - double_round!(tmp); - } - for i in 0..STATE_WORDS { - results[i] = tmp[i].wrapping_add(state[i]); + impl RngCore for $ChaChaXRng { + #[inline] + fn next_u32(&mut self) -> u32 { + self.rng.next_u32() + } + #[inline] + fn next_u64(&mut self) -> u64 { + self.rng.next_u64() + } + #[inline] + fn fill_bytes(&mut self, bytes: &mut [u8]) { + self.rng.fill_bytes(bytes) + } + #[inline] + fn try_fill_bytes(&mut self, bytes: &mut [u8]) -> Result<(), Error> { + self.rng.try_fill_bytes(bytes) } } - core(results, &self.state); - - // update 64-bit counter - self.state[12] = self.state[12].wrapping_add(1); - if self.state[12] != 0 { return; }; - self.state[13] = self.state[13].wrapping_add(1); - } -} + impl $ChaChaXRng { + // The buffer is a 4-block window, i.e. it is always at a block-aligned position in the + // stream but if the stream has been seeked it may not be self-aligned. + + /// Get the offset from the start of the stream, in 32-bit words. + /// + /// Since the generated blocks are 16 words (24) long and the + /// counter is 64-bits, the offset is a 68-bit number. Sub-word offsets are + /// not supported, hence the result can simply be multiplied by 4 to get a + /// byte-offset. + #[inline] + pub fn get_word_pos(&self) -> u128 { + let mut block = u128::from(self.rng.core.state.get_stream_param(STREAM_PARAM_BLOCK)); + // counter is incremented *after* filling buffer + block -= 4; + (block << 4) + self.rng.index() as u128 + } -impl SeedableRng for ChaChaCore { - type Seed = [u8; SEED_WORDS*4]; + /// Set the offset from the start of the stream, in 32-bit words. + /// + /// As with `get_word_pos`, we use a 68-bit number. Since the generator + /// simply cycles at the end of its period (1 ZiB), we ignore the upper + /// 60 bits. + #[inline] + pub fn set_word_pos(&mut self, word_offset: u128) { + let block = (word_offset >> 4) as u64; + self.rng + .core + .state + .set_stream_param(STREAM_PARAM_BLOCK, block); + self.rng.generate_and_set((word_offset & 15) as usize); + } - fn from_seed(seed: Self::Seed) -> Self { - let mut seed_le = [0u32; SEED_WORDS]; - le::read_u32_into(&seed, &mut seed_le); - Self { - state: [0x61707865, 0x3320646E, 0x79622D32, 0x6B206574, // constants - seed_le[0], seed_le[1], seed_le[2], seed_le[3], // seed - seed_le[4], seed_le[5], seed_le[6], seed_le[7], // seed - 0, 0, 0, 0], // counter - } - } -} + /// Set the stream number. + /// + /// This is initialized to zero; 264 unique streams of output + /// are available per seed/key. + /// + /// Note that in order to reproduce ChaCha output with a specific 64-bit + /// nonce, one can convert that nonce to a `u64` in little-endian fashion + /// and pass to this function. In theory a 96-bit nonce can be used by + /// passing the last 64-bits to this function and using the first 32-bits as + /// the most significant half of the 64-bit counter (which may be set + /// indirectly via `set_word_pos`), but this is not directly supported. + #[inline] + pub fn set_stream(&mut self, stream: u64) { + self.rng + .core + .state + .set_stream_param(STREAM_PARAM_NONCE, stream); + if self.rng.index() != 64 { + let wp = self.get_word_pos(); + self.set_word_pos(wp); + } + } + } -impl CryptoRng for ChaChaCore {} + impl CryptoRng for $ChaChaXRng {} -impl From for ChaChaRng { - fn from(core: ChaChaCore) -> Self { - ChaChaRng(BlockRng::new(core)) + impl From<$ChaChaXCore> for $ChaChaXRng { + fn from(core: $ChaChaXCore) -> Self { + $ChaChaXRng { + rng: BlockRng::new(core), + } + } + } } } +chacha_impl!(ChaCha20Core, ChaCha20Rng, 10, "ChaCha with 20 rounds"); +chacha_impl!(ChaCha12Core, ChaCha12Rng, 6, "ChaCha with 12 rounds"); +chacha_impl!(ChaCha8Core, ChaCha8Rng, 4, "ChaCha with 8 rounds"); + #[cfg(test)] mod test { - use ::rand_core::{RngCore, SeedableRng}; - use super::ChaChaRng; + use rand_core::{RngCore, SeedableRng}; + + type ChaChaRng = super::ChaCha20Rng; #[test] fn test_chacha_construction() { - let seed = [0,0,0,0,0,0,0,0, - 1,0,0,0,0,0,0,0, - 2,0,0,0,0,0,0,0, - 3,0,0,0,0,0,0,0]; + let seed = [ + 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, + 0, 0, 0, + ]; let mut rng1 = ChaChaRng::from_seed(seed); assert_eq!(rng1.next_u32(), 137206642); @@ -292,18 +271,24 @@ let mut rng = ChaChaRng::from_seed(seed); let mut results = [0u32; 16]; - for i in results.iter_mut() { *i = rng.next_u32(); } - let expected = [0xade0b876, 0x903df1a0, 0xe56a5d40, 0x28bd8653, - 0xb819d2bd, 0x1aed8da0, 0xccef36a8, 0xc70d778b, - 0x7c5941da, 0x8d485751, 0x3fe02477, 0x374ad8b8, - 0xf4b8436a, 0x1ca11815, 0x69b687c3, 0x8665eeb2]; + for i in results.iter_mut() { + *i = rng.next_u32(); + } + let expected = [ + 0xade0b876, 0x903df1a0, 0xe56a5d40, 0x28bd8653, 0xb819d2bd, 0x1aed8da0, 0xccef36a8, + 0xc70d778b, 0x7c5941da, 0x8d485751, 0x3fe02477, 0x374ad8b8, 0xf4b8436a, 0x1ca11815, + 0x69b687c3, 0x8665eeb2, + ]; assert_eq!(results, expected); - for i in results.iter_mut() { *i = rng.next_u32(); } - let expected = [0xbee7079f, 0x7a385155, 0x7c97ba98, 0x0d082d73, - 0xa0290fcb, 0x6965e348, 0x3e53c612, 0xed7aee32, - 0x7621b729, 0x434ee69c, 0xb03371d5, 0xd539d874, - 0x281fed31, 0x45fb0a51, 0x1f0ae1ac, 0x6f4d794b]; + for i in results.iter_mut() { + *i = rng.next_u32(); + } + let expected = [ + 0xbee7079f, 0x7a385155, 0x7c97ba98, 0x0d082d73, 0xa0290fcb, 0x6965e348, 0x3e53c612, + 0xed7aee32, 0x7621b729, 0x434ee69c, 0xb03371d5, 0xd539d874, 0x281fed31, 0x45fb0a51, + 0x1f0ae1ac, 0x6f4d794b, + ]; assert_eq!(results, expected); } @@ -311,51 +296,62 @@ fn test_chacha_true_values_b() { // Test vector 3 from // https://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-04 - let seed = [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]; + let seed = [ + 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, + ]; let mut rng = ChaChaRng::from_seed(seed); // Skip block 0 - for _ in 0..16 { rng.next_u32(); } + for _ in 0..16 { + rng.next_u32(); + } let mut results = [0u32; 16]; - for i in results.iter_mut() { *i = rng.next_u32(); } - let expected = [0x2452eb3a, 0x9249f8ec, 0x8d829d9b, 0xddd4ceb1, - 0xe8252083, 0x60818b01, 0xf38422b8, 0x5aaa49c9, - 0xbb00ca8e, 0xda3ba7b4, 0xc4b592d1, 0xfdf2732f, - 0x4436274e, 0x2561b3c8, 0xebdd4aa6, 0xa0136c00]; + for i in results.iter_mut() { + *i = rng.next_u32(); + } + let expected = [ + 0x2452eb3a, 0x9249f8ec, 0x8d829d9b, 0xddd4ceb1, 0xe8252083, 0x60818b01, 0xf38422b8, + 0x5aaa49c9, 0xbb00ca8e, 0xda3ba7b4, 0xc4b592d1, 0xfdf2732f, 0x4436274e, 0x2561b3c8, + 0xebdd4aa6, 0xa0136c00, + ]; assert_eq!(results, expected); } #[test] - #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] fn test_chacha_true_values_c() { // Test vector 4 from // https://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-04 - let seed = [0, 0xff, 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]; - let expected = [0xfb4dd572, 0x4bc42ef1, 0xdf922636, 0x327f1394, - 0xa78dea8f, 0x5e269039, 0xa1bebbc1, 0xcaf09aae, - 0xa25ab213, 0x48a6b46c, 0x1b9d9bcb, 0x092c5be6, - 0x546ca624, 0x1bec45d5, 0x87f47473, 0x96f0992e]; + let seed = [ + 0, 0xff, 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, + ]; + let expected = [ + 0xfb4dd572, 0x4bc42ef1, 0xdf922636, 0x327f1394, 0xa78dea8f, 0x5e269039, 0xa1bebbc1, + 0xcaf09aae, 0xa25ab213, 0x48a6b46c, 0x1b9d9bcb, 0x092c5be6, 0x546ca624, 0x1bec45d5, + 0x87f47473, 0x96f0992e, + ]; let expected_end = 3 * 16; let mut results = [0u32; 16]; // Test block 2 by skipping block 0 and 1 let mut rng1 = ChaChaRng::from_seed(seed); - for _ in 0..32 { rng1.next_u32(); } - for i in results.iter_mut() { *i = rng1.next_u32(); } + for _ in 0..32 { + rng1.next_u32(); + } + for i in results.iter_mut() { + *i = rng1.next_u32(); + } assert_eq!(results, expected); assert_eq!(rng1.get_word_pos(), expected_end); // Test block 2 by using `set_word_pos` let mut rng2 = ChaChaRng::from_seed(seed); rng2.set_word_pos(2 * 16); - for i in results.iter_mut() { *i = rng2.next_u32(); } + for i in results.iter_mut() { + *i = rng2.next_u32(); + } assert_eq!(results, expected); assert_eq!(rng2.get_word_pos(), expected_end); @@ -376,7 +372,10 @@ #[test] fn test_chacha_multiple_blocks() { - let seed = [0,0,0,0, 1,0,0,0, 2,0,0,0, 3,0,0,0, 4,0,0,0, 5,0,0,0, 6,0,0,0, 7,0,0,0]; + let seed = [ + 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 6, 0, 0, 0, 7, + 0, 0, 0, + ]; let mut rng = ChaChaRng::from_seed(seed); // Store the 17*i-th 32-bit word, @@ -388,10 +387,11 @@ rng.next_u32(); } } - let expected = [0xf225c81a, 0x6ab1be57, 0x04d42951, 0x70858036, - 0x49884684, 0x64efec72, 0x4be2d186, 0x3615b384, - 0x11cfa18e, 0xd3c50049, 0x75c775f6, 0x434c6530, - 0x2c5bad8f, 0x898881dc, 0x5f1c86d9, 0xc1f8e7f4]; + let expected = [ + 0xf225c81a, 0x6ab1be57, 0x04d42951, 0x70858036, 0x49884684, 0x64efec72, 0x4be2d186, + 0x3615b384, 0x11cfa18e, 0xd3c50049, 0x75c775f6, 0x434c6530, 0x2c5bad8f, 0x898881dc, + 0x5f1c86d9, 0xc1f8e7f4, + ]; assert_eq!(results, expected); } @@ -401,10 +401,10 @@ let mut rng = ChaChaRng::from_seed(seed); let mut results = [0u8; 32]; rng.fill_bytes(&mut results); - let expected = [118, 184, 224, 173, 160, 241, 61, 144, - 64, 93, 106, 229, 83, 134, 189, 40, - 189, 210, 25, 184, 160, 141, 237, 26, - 168, 54, 239, 204, 139, 119, 13, 199]; + let expected = [ + 118, 184, 224, 173, 160, 241, 61, 144, 64, 93, 106, 229, 83, 134, 189, 40, 189, 210, + 25, 184, 160, 141, 237, 26, 168, 54, 239, 204, 139, 119, 13, 199, + ]; assert_eq!(results, expected); } @@ -420,17 +420,23 @@ rng.set_stream(2u64 << (24 + 32)); let mut results = [0u32; 16]; - for i in results.iter_mut() { *i = rng.next_u32(); } - let expected = [0x374dc6c2, 0x3736d58c, 0xb904e24a, 0xcd3f93ef, - 0x88228b1a, 0x96a4dfb3, 0x5b76ab72, 0xc727ee54, - 0x0e0e978a, 0xf3145c95, 0x1b748ea8, 0xf786c297, - 0x99c28f5f, 0x628314e8, 0x398a19fa, 0x6ded1b53]; + for i in results.iter_mut() { + *i = rng.next_u32(); + } + let expected = [ + 0x374dc6c2, 0x3736d58c, 0xb904e24a, 0xcd3f93ef, 0x88228b1a, 0x96a4dfb3, 0x5b76ab72, + 0xc727ee54, 0x0e0e978a, 0xf3145c95, 0x1b748ea8, 0xf786c297, 0x99c28f5f, 0x628314e8, + 0x398a19fa, 0x6ded1b53, + ]; assert_eq!(results, expected); } #[test] fn test_chacha_clone_streams() { - let seed = [0,0,0,0, 1,0,0,0, 2,0,0,0, 3,0,0,0, 4,0,0,0, 5,0,0,0, 6,0,0,0, 7,0,0,0]; + let seed = [ + 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 6, 0, 0, 0, 7, + 0, 0, 0, + ]; let mut rng = ChaChaRng::from_seed(seed); let mut clone = rng.clone(); for _ in 0..16 { @@ -441,7 +447,7 @@ for _ in 0..7 { assert!(rng.next_u32() != clone.next_u32()); } - clone.set_stream(51); // switch part way through block + clone.set_stream(51); // switch part way through block for _ in 7..16 { assert_eq!(rng.next_u32(), clone.next_u32()); } diff -Nru cargo-0.35.0/vendor/rand_chacha/src/lib.rs cargo-0.37.0/vendor/rand_chacha/src/lib.rs --- cargo-0.35.0/vendor/rand_chacha/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_chacha/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -16,10 +16,16 @@ #![deny(missing_debug_implementations)] #![doc(test(attr(allow(unused_variables), deny(warnings))))] -#![no_std] +#![cfg_attr(not(feature = "std"), no_std)] -extern crate rand_core; +extern crate c2_chacha; +pub extern crate rand_core; mod chacha; -pub use chacha::{ChaChaRng, ChaChaCore}; +pub use chacha::{ChaCha12Core, ChaCha12Rng, ChaCha20Core, ChaCha20Rng, ChaCha8Core, ChaCha8Rng}; + +/// ChaCha with 20 rounds +pub type ChaChaRng = ChaCha20Rng; +/// ChaCha with 20 rounds, low-level interface +pub type ChaChaCore = ChaCha20Core; diff -Nru cargo-0.35.0/vendor/rand_chacha-0.1.1/build.rs cargo-0.37.0/vendor/rand_chacha-0.1.1/build.rs --- cargo-0.35.0/vendor/rand_chacha-0.1.1/build.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_chacha-0.1.1/build.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,7 @@ +extern crate autocfg; + +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + let ac = autocfg::new(); + ac.emit_rustc_version(1, 26); +} diff -Nru cargo-0.35.0/vendor/rand_chacha-0.1.1/.cargo-checksum.json cargo-0.37.0/vendor/rand_chacha-0.1.1/.cargo-checksum.json --- cargo-0.35.0/vendor/rand_chacha-0.1.1/.cargo-checksum.json 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_chacha-0.1.1/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +{"files":{},"package":"556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/rand_chacha-0.1.1/Cargo.toml cargo-0.37.0/vendor/rand_chacha-0.1.1/Cargo.toml --- cargo-0.35.0/vendor/rand_chacha-0.1.1/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_chacha-0.1.1/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,35 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# 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 = "rand_chacha" +version = "0.1.1" +authors = ["The Rand Project Developers", "The Rust Project Developers"] +build = "build.rs" +description = "ChaCha random number generator\n" +homepage = "https://crates.io/crates/rand_chacha" +documentation = "https://rust-random.github.io/rand/rand_chacha" +readme = "README.md" +keywords = ["random", "rng", "chacha"] +categories = ["algorithms", "no-std"] +license = "MIT/Apache-2.0" +repository = "https://github.com/rust-random/rand" +[dependencies.rand_core] +version = ">=0.2, <0.4" +default-features = false +[build-dependencies.autocfg] +version = "0.1" +[badges.appveyor] +repository = "rust-random/rand" + +[badges.travis-ci] +repository = "rust-random/rand" diff -Nru cargo-0.35.0/vendor/rand_chacha-0.1.1/CHANGELOG.md cargo-0.37.0/vendor/rand_chacha-0.1.1/CHANGELOG.md --- cargo-0.35.0/vendor/rand_chacha-0.1.1/CHANGELOG.md 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_chacha-0.1.1/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,12 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.1.1] - 2019-01-04 +- Disable `i128` and `u128` if the `target_os` is `emscripten` (#671: work-around Emscripten limitation) +- Update readme and doc links + +## [0.1.0] - 2018-10-17 +- Pulled out of the Rand crate diff -Nru cargo-0.35.0/vendor/rand_chacha-0.1.1/COPYRIGHT cargo-0.37.0/vendor/rand_chacha-0.1.1/COPYRIGHT --- cargo-0.35.0/vendor/rand_chacha-0.1.1/COPYRIGHT 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_chacha-0.1.1/COPYRIGHT 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,12 @@ +Copyrights in the Rand project are retained by their contributors. No +copyright assignment is required to contribute to the Rand project. + +For full authorship information, see the version control history. + +Except as otherwise noted (below and/or in individual files), Rand is +licensed under the Apache License, Version 2.0 or + or the MIT license + or , at your option. + +The Rand project includes code from the Rust project +published under these same licenses. diff -Nru cargo-0.35.0/vendor/rand_chacha-0.1.1/LICENSE-APACHE cargo-0.37.0/vendor/rand_chacha-0.1.1/LICENSE-APACHE --- cargo-0.35.0/vendor/rand_chacha-0.1.1/LICENSE-APACHE 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_chacha-0.1.1/LICENSE-APACHE 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor 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, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff -Nru cargo-0.35.0/vendor/rand_chacha-0.1.1/LICENSE-MIT cargo-0.37.0/vendor/rand_chacha-0.1.1/LICENSE-MIT --- cargo-0.35.0/vendor/rand_chacha-0.1.1/LICENSE-MIT 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_chacha-0.1.1/LICENSE-MIT 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,26 @@ +Copyright 2018 Developers of the Rand project +Copyright (c) 2014 The Rust Project Developers + +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 +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff -Nru cargo-0.35.0/vendor/rand_chacha-0.1.1/README.md cargo-0.37.0/vendor/rand_chacha-0.1.1/README.md --- cargo-0.35.0/vendor/rand_chacha-0.1.1/README.md 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_chacha-0.1.1/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,45 @@ +# rand_chacha + +[![Build Status](https://travis-ci.org/rust-random/rand.svg)](https://travis-ci.org/rust-random/rand) +[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-random/rand?svg=true)](https://ci.appveyor.com/project/rust-random/rand) +[![Latest version](https://img.shields.io/crates/v/rand_chacha.svg)](https://crates.io/crates/rand_chacha) +[![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) +[![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_chacha) +[![API](https://docs.rs/rand_chacha/badge.svg)](https://docs.rs/rand_chacha) +[![Minimum rustc version](https://img.shields.io/badge/rustc-1.22+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements) + +A cryptographically secure random number generator that uses the ChaCha +algorithm. + +ChaCha is a stream cipher designed by Daniel J. Bernstein[^1], that we use +as an RNG. It is an improved variant of the Salsa20 cipher family, which was +selected as one of the "stream ciphers suitable for widespread adoption" by +eSTREAM[^2]. + +Links: + +- [API documentation (master)](https://rust-random.github.io/rand/rand_chacha) +- [API documentation (docs.rs)](https://docs.rs/rand_chacha) +- [Changelog](CHANGELOG.md) + +[rand]: https://crates.io/crates/rand +[^1]: D. J. Bernstein, [*ChaCha, a variant of Salsa20*]( + https://cr.yp.to/chacha.html) + +[^2]: [eSTREAM: the ECRYPT Stream Cipher Project]( + http://www.ecrypt.eu.org/stream/) + + +## Crate Features + +`rand_chacha` is `no_std` compatible. It does not require any functionality +outside of the `core` lib, thus there are no features to configure. + + +# License + +`rand_chacha` is distributed under the terms of both the MIT license and the +Apache License (Version 2.0). + +See [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT), and +[COPYRIGHT](COPYRIGHT) for details. diff -Nru cargo-0.35.0/vendor/rand_chacha-0.1.1/src/chacha.rs cargo-0.37.0/vendor/rand_chacha-0.1.1/src/chacha.rs --- cargo-0.35.0/vendor/rand_chacha-0.1.1/src/chacha.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_chacha-0.1.1/src/chacha.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,449 @@ +// Copyright 2018 Developers of the Rand project. +// Copyright 2014 The Rust Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The ChaCha random number generator. + +use core::fmt; +use rand_core::{CryptoRng, RngCore, SeedableRng, Error, le}; +use rand_core::block::{BlockRngCore, BlockRng}; + +const SEED_WORDS: usize = 8; // 8 words for the 256-bit key +const STATE_WORDS: usize = 16; + +/// A cryptographically secure random number generator that uses the ChaCha +/// algorithm. +/// +/// ChaCha is a stream cipher designed by Daniel J. Bernstein[^1], that we use +/// as an RNG. It is an improved variant of the Salsa20 cipher family, which was +/// selected as one of the "stream ciphers suitable for widespread adoption" by +/// eSTREAM[^2]. +/// +/// ChaCha uses add-rotate-xor (ARX) operations as its basis. These are safe +/// against timing attacks, although that is mostly a concern for ciphers and +/// not for RNGs. Also it is very suitable for SIMD implementation. +/// Here we do not provide a SIMD implementation yet, except for what is +/// provided by auto-vectorisation. +/// +/// With the ChaCha algorithm it is possible to choose the number of rounds the +/// core algorithm should run. The number of rounds is a tradeoff between +/// performance and security, where 8 rounds is the minimum potentially +/// secure configuration, and 20 rounds is widely used as a conservative choice. +/// We use 20 rounds in this implementation, but hope to allow type-level +/// configuration in the future. +/// +/// We use a 64-bit counter and 64-bit stream identifier as in Bernstein's +/// implementation[^1] except that we use a stream identifier in place of a +/// nonce. A 64-bit counter over 64-byte (16 word) blocks allows 1 ZiB of output +/// before cycling, and the stream identifier allows 264 unique +/// streams of output per seed. Both counter and stream are initialized to zero +/// but may be set via [`set_word_pos`] and [`set_stream`]. +/// +/// The word layout is: +/// +/// ```text +/// constant constant constant constant +/// seed seed seed seed +/// seed seed seed seed +/// counter counter stream_id stream_id +/// ``` +/// +/// This implementation uses an output buffer of sixteen `u32` words, and uses +/// [`BlockRng`] to implement the [`RngCore`] methods. +/// +/// [^1]: D. J. Bernstein, [*ChaCha, a variant of Salsa20*]( +/// https://cr.yp.to/chacha.html) +/// +/// [^2]: [eSTREAM: the ECRYPT Stream Cipher Project]( +/// http://www.ecrypt.eu.org/stream/) +/// +/// [`set_word_pos`]: #method.set_word_pos +/// [`set_stream`]: #method.set_stream +/// [`BlockRng`]: ../rand_core/block/struct.BlockRng.html +/// [`RngCore`]: ../rand_core/trait.RngCore.html +#[derive(Clone, Debug)] +pub struct ChaChaRng(BlockRng); + +impl RngCore for ChaChaRng { + #[inline] + fn next_u32(&mut self) -> u32 { + self.0.next_u32() + } + + #[inline] + fn next_u64(&mut self) -> u64 { + self.0.next_u64() + } + + #[inline] + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.0.fill_bytes(dest) + } + + #[inline] + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +impl SeedableRng for ChaChaRng { + type Seed = ::Seed; + + fn from_seed(seed: Self::Seed) -> Self { + ChaChaRng(BlockRng::::from_seed(seed)) + } + + fn from_rng(rng: R) -> Result { + BlockRng::::from_rng(rng).map(ChaChaRng) + } +} + +impl CryptoRng for ChaChaRng {} + +impl ChaChaRng { + /// Get the offset from the start of the stream, in 32-bit words. + /// + /// Since the generated blocks are 16 words (24) long and the + /// counter is 64-bits, the offset is a 68-bit number. Sub-word offsets are + /// not supported, hence the result can simply be multiplied by 4 to get a + /// byte-offset. + /// + /// Note: this function is currently only available with Rust 1.26 or later. + #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] + pub fn get_word_pos(&self) -> u128 { + let mut c = (self.0.core.state[13] as u64) << 32 + | (self.0.core.state[12] as u64); + let mut index = self.0.index(); + // c is the end of the last block generated, unless index is at end + if index >= STATE_WORDS { + index = 0; + } else { + c = c.wrapping_sub(1); + } + ((c as u128) << 4) | (index as u128) + } + + /// Set the offset from the start of the stream, in 32-bit words. + /// + /// As with `get_word_pos`, we use a 68-bit number. Since the generator + /// simply cycles at the end of its period (1 ZiB), we ignore the upper + /// 60 bits. + /// + /// Note: this function is currently only available with Rust 1.26 or later. + #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] + pub fn set_word_pos(&mut self, word_offset: u128) { + let index = (word_offset as usize) & 0xF; + let counter = (word_offset >> 4) as u64; + self.0.core.state[12] = counter as u32; + self.0.core.state[13] = (counter >> 32) as u32; + if index != 0 { + self.0.generate_and_set(index); // also increments counter + } else { + self.0.reset(); + } + } + + /// Set the stream number. + /// + /// This is initialized to zero; 264 unique streams of output + /// are available per seed/key. + /// + /// Note that in order to reproduce ChaCha output with a specific 64-bit + /// nonce, one can convert that nonce to a `u64` in little-endian fashion + /// and pass to this function. In theory a 96-bit nonce can be used by + /// passing the last 64-bits to this function and using the first 32-bits as + /// the most significant half of the 64-bit counter (which may be set + /// indirectly via `set_word_pos`), but this is not directly supported. + pub fn set_stream(&mut self, stream: u64) { + let index = self.0.index(); + self.0.core.state[14] = stream as u32; + self.0.core.state[15] = (stream >> 32) as u32; + if index < STATE_WORDS { + // we need to regenerate a partial result buffer + { + // reverse of counter adjustment in generate() + if self.0.core.state[12] == 0 { + self.0.core.state[13] = self.0.core.state[13].wrapping_sub(1); + } + self.0.core.state[12] = self.0.core.state[12].wrapping_sub(1); + } + self.0.generate_and_set(index); + } + } +} + +/// The core of `ChaChaRng`, used with `BlockRng`. +#[derive(Clone)] +pub struct ChaChaCore { + state: [u32; STATE_WORDS], +} + +// Custom Debug implementation that does not expose the internal state +impl fmt::Debug for ChaChaCore { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "ChaChaCore {{}}") + } +} + +macro_rules! quarter_round{ + ($a: expr, $b: expr, $c: expr, $d: expr) => {{ + $a = $a.wrapping_add($b); $d ^= $a; $d = $d.rotate_left(16); + $c = $c.wrapping_add($d); $b ^= $c; $b = $b.rotate_left(12); + $a = $a.wrapping_add($b); $d ^= $a; $d = $d.rotate_left( 8); + $c = $c.wrapping_add($d); $b ^= $c; $b = $b.rotate_left( 7); + }} +} + +macro_rules! double_round{ + ($x: expr) => {{ + // Column round + quarter_round!($x[ 0], $x[ 4], $x[ 8], $x[12]); + quarter_round!($x[ 1], $x[ 5], $x[ 9], $x[13]); + quarter_round!($x[ 2], $x[ 6], $x[10], $x[14]); + quarter_round!($x[ 3], $x[ 7], $x[11], $x[15]); + // Diagonal round + quarter_round!($x[ 0], $x[ 5], $x[10], $x[15]); + quarter_round!($x[ 1], $x[ 6], $x[11], $x[12]); + quarter_round!($x[ 2], $x[ 7], $x[ 8], $x[13]); + quarter_round!($x[ 3], $x[ 4], $x[ 9], $x[14]); + }} +} + +impl BlockRngCore for ChaChaCore { + type Item = u32; + type Results = [u32; STATE_WORDS]; + + fn generate(&mut self, results: &mut Self::Results) { + // For some reason extracting this part into a separate function + // improves performance by 50%. + fn core(results: &mut [u32; STATE_WORDS], + state: &[u32; STATE_WORDS]) + { + let mut tmp = *state; + let rounds = 20; + for _ in 0..rounds / 2 { + double_round!(tmp); + } + for i in 0..STATE_WORDS { + results[i] = tmp[i].wrapping_add(state[i]); + } + } + + core(results, &self.state); + + // update 64-bit counter + self.state[12] = self.state[12].wrapping_add(1); + if self.state[12] != 0 { return; }; + self.state[13] = self.state[13].wrapping_add(1); + } +} + +impl SeedableRng for ChaChaCore { + type Seed = [u8; SEED_WORDS*4]; + + fn from_seed(seed: Self::Seed) -> Self { + let mut seed_le = [0u32; SEED_WORDS]; + le::read_u32_into(&seed, &mut seed_le); + Self { + state: [0x61707865, 0x3320646E, 0x79622D32, 0x6B206574, // constants + seed_le[0], seed_le[1], seed_le[2], seed_le[3], // seed + seed_le[4], seed_le[5], seed_le[6], seed_le[7], // seed + 0, 0, 0, 0], // counter + } + } +} + +impl CryptoRng for ChaChaCore {} + +impl From for ChaChaRng { + fn from(core: ChaChaCore) -> Self { + ChaChaRng(BlockRng::new(core)) + } +} + +#[cfg(test)] +mod test { + use ::rand_core::{RngCore, SeedableRng}; + use super::ChaChaRng; + + #[test] + fn test_chacha_construction() { + let seed = [0,0,0,0,0,0,0,0, + 1,0,0,0,0,0,0,0, + 2,0,0,0,0,0,0,0, + 3,0,0,0,0,0,0,0]; + let mut rng1 = ChaChaRng::from_seed(seed); + assert_eq!(rng1.next_u32(), 137206642); + + let mut rng2 = ChaChaRng::from_rng(rng1).unwrap(); + assert_eq!(rng2.next_u32(), 1325750369); + } + + #[test] + fn test_chacha_true_values_a() { + // Test vectors 1 and 2 from + // https://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-04 + let seed = [0u8; 32]; + let mut rng = ChaChaRng::from_seed(seed); + + let mut results = [0u32; 16]; + for i in results.iter_mut() { *i = rng.next_u32(); } + let expected = [0xade0b876, 0x903df1a0, 0xe56a5d40, 0x28bd8653, + 0xb819d2bd, 0x1aed8da0, 0xccef36a8, 0xc70d778b, + 0x7c5941da, 0x8d485751, 0x3fe02477, 0x374ad8b8, + 0xf4b8436a, 0x1ca11815, 0x69b687c3, 0x8665eeb2]; + assert_eq!(results, expected); + + for i in results.iter_mut() { *i = rng.next_u32(); } + let expected = [0xbee7079f, 0x7a385155, 0x7c97ba98, 0x0d082d73, + 0xa0290fcb, 0x6965e348, 0x3e53c612, 0xed7aee32, + 0x7621b729, 0x434ee69c, 0xb03371d5, 0xd539d874, + 0x281fed31, 0x45fb0a51, 0x1f0ae1ac, 0x6f4d794b]; + assert_eq!(results, expected); + } + + #[test] + fn test_chacha_true_values_b() { + // Test vector 3 from + // https://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-04 + let seed = [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]; + let mut rng = ChaChaRng::from_seed(seed); + + // Skip block 0 + for _ in 0..16 { rng.next_u32(); } + + let mut results = [0u32; 16]; + for i in results.iter_mut() { *i = rng.next_u32(); } + let expected = [0x2452eb3a, 0x9249f8ec, 0x8d829d9b, 0xddd4ceb1, + 0xe8252083, 0x60818b01, 0xf38422b8, 0x5aaa49c9, + 0xbb00ca8e, 0xda3ba7b4, 0xc4b592d1, 0xfdf2732f, + 0x4436274e, 0x2561b3c8, 0xebdd4aa6, 0xa0136c00]; + assert_eq!(results, expected); + } + + #[test] + #[cfg(all(rustc_1_26, not(target_os = "emscripten")))] + fn test_chacha_true_values_c() { + // Test vector 4 from + // https://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-04 + let seed = [0, 0xff, 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]; + let expected = [0xfb4dd572, 0x4bc42ef1, 0xdf922636, 0x327f1394, + 0xa78dea8f, 0x5e269039, 0xa1bebbc1, 0xcaf09aae, + 0xa25ab213, 0x48a6b46c, 0x1b9d9bcb, 0x092c5be6, + 0x546ca624, 0x1bec45d5, 0x87f47473, 0x96f0992e]; + let expected_end = 3 * 16; + let mut results = [0u32; 16]; + + // Test block 2 by skipping block 0 and 1 + let mut rng1 = ChaChaRng::from_seed(seed); + for _ in 0..32 { rng1.next_u32(); } + for i in results.iter_mut() { *i = rng1.next_u32(); } + assert_eq!(results, expected); + assert_eq!(rng1.get_word_pos(), expected_end); + + // Test block 2 by using `set_word_pos` + let mut rng2 = ChaChaRng::from_seed(seed); + rng2.set_word_pos(2 * 16); + for i in results.iter_mut() { *i = rng2.next_u32(); } + assert_eq!(results, expected); + assert_eq!(rng2.get_word_pos(), expected_end); + + // Test skipping behaviour with other types + let mut buf = [0u8; 32]; + rng2.fill_bytes(&mut buf[..]); + assert_eq!(rng2.get_word_pos(), expected_end + 8); + rng2.fill_bytes(&mut buf[0..25]); + assert_eq!(rng2.get_word_pos(), expected_end + 15); + rng2.next_u64(); + assert_eq!(rng2.get_word_pos(), expected_end + 17); + rng2.next_u32(); + rng2.next_u64(); + assert_eq!(rng2.get_word_pos(), expected_end + 20); + rng2.fill_bytes(&mut buf[0..1]); + assert_eq!(rng2.get_word_pos(), expected_end + 21); + } + + #[test] + fn test_chacha_multiple_blocks() { + let seed = [0,0,0,0, 1,0,0,0, 2,0,0,0, 3,0,0,0, 4,0,0,0, 5,0,0,0, 6,0,0,0, 7,0,0,0]; + let mut rng = ChaChaRng::from_seed(seed); + + // Store the 17*i-th 32-bit word, + // i.e., the i-th word of the i-th 16-word block + let mut results = [0u32; 16]; + for i in results.iter_mut() { + *i = rng.next_u32(); + for _ in 0..16 { + rng.next_u32(); + } + } + let expected = [0xf225c81a, 0x6ab1be57, 0x04d42951, 0x70858036, + 0x49884684, 0x64efec72, 0x4be2d186, 0x3615b384, + 0x11cfa18e, 0xd3c50049, 0x75c775f6, 0x434c6530, + 0x2c5bad8f, 0x898881dc, 0x5f1c86d9, 0xc1f8e7f4]; + assert_eq!(results, expected); + } + + #[test] + fn test_chacha_true_bytes() { + let seed = [0u8; 32]; + let mut rng = ChaChaRng::from_seed(seed); + let mut results = [0u8; 32]; + rng.fill_bytes(&mut results); + let expected = [118, 184, 224, 173, 160, 241, 61, 144, + 64, 93, 106, 229, 83, 134, 189, 40, + 189, 210, 25, 184, 160, 141, 237, 26, + 168, 54, 239, 204, 139, 119, 13, 199]; + assert_eq!(results, expected); + } + + #[test] + fn test_chacha_nonce() { + // Test vector 5 from + // https://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-04 + // Although we do not support setting a nonce, we try it here anyway so + // we can use this test vector. + let seed = [0u8; 32]; + let mut rng = ChaChaRng::from_seed(seed); + // 96-bit nonce in LE order is: 0,0,0,0, 0,0,0,0, 0,0,0,2 + rng.set_stream(2u64 << (24 + 32)); + + let mut results = [0u32; 16]; + for i in results.iter_mut() { *i = rng.next_u32(); } + let expected = [0x374dc6c2, 0x3736d58c, 0xb904e24a, 0xcd3f93ef, + 0x88228b1a, 0x96a4dfb3, 0x5b76ab72, 0xc727ee54, + 0x0e0e978a, 0xf3145c95, 0x1b748ea8, 0xf786c297, + 0x99c28f5f, 0x628314e8, 0x398a19fa, 0x6ded1b53]; + assert_eq!(results, expected); + } + + #[test] + fn test_chacha_clone_streams() { + let seed = [0,0,0,0, 1,0,0,0, 2,0,0,0, 3,0,0,0, 4,0,0,0, 5,0,0,0, 6,0,0,0, 7,0,0,0]; + let mut rng = ChaChaRng::from_seed(seed); + let mut clone = rng.clone(); + for _ in 0..16 { + assert_eq!(rng.next_u64(), clone.next_u64()); + } + + rng.set_stream(51); + for _ in 0..7 { + assert!(rng.next_u32() != clone.next_u32()); + } + clone.set_stream(51); // switch part way through block + for _ in 7..16 { + assert_eq!(rng.next_u32(), clone.next_u32()); + } + } +} diff -Nru cargo-0.35.0/vendor/rand_chacha-0.1.1/src/lib.rs cargo-0.37.0/vendor/rand_chacha-0.1.1/src/lib.rs --- cargo-0.35.0/vendor/rand_chacha-0.1.1/src/lib.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_chacha-0.1.1/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,25 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The ChaCha random number generator. + +#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png", + html_favicon_url = "https://www.rust-lang.org/favicon.ico", + html_root_url = "https://rust-random.github.io/rand/")] + +#![deny(missing_docs)] +#![deny(missing_debug_implementations)] +#![doc(test(attr(allow(unused_variables), deny(warnings))))] + +#![no_std] + +extern crate rand_core; + +mod chacha; + +pub use chacha::{ChaChaRng, ChaChaCore}; diff -Nru cargo-0.35.0/vendor/rand_core/.cargo-checksum.json cargo-0.37.0/vendor/rand_core/.cargo-checksum.json --- cargo-0.35.0/vendor/rand_core/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0"} \ No newline at end of file +{"files":{},"package":"615e683324e75af5d43d8f7a39ffe3ee4a9dc42c5c701167a71dc59c3a493aca"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/rand_core/Cargo.toml cargo-0.37.0/vendor/rand_core/Cargo.toml --- cargo-0.35.0/vendor/rand_core/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,16 +12,20 @@ [package] name = "rand_core" -version = "0.4.0" +version = "0.5.0" authors = ["The Rand Project Developers", "The Rust Project Developers"] description = "Core random number generator traits and tools for implementation.\n" homepage = "https://crates.io/crates/rand_core" -documentation = "https://rust-random.github.io/rand/rand_core" +documentation = "https://rust-random.github.io/rand/rand_core/" readme = "README.md" keywords = ["random", "rng"] categories = ["algorithms", "no-std"] license = "MIT/Apache-2.0" repository = "https://github.com/rust-random/rand" +[dependencies.getrandom] +version = "0.1" +optional = true + [dependencies.serde] version = "1" optional = true @@ -33,7 +37,7 @@ [features] alloc = [] serde1 = ["serde", "serde_derive"] -std = ["alloc"] +std = ["alloc", "getrandom", "getrandom/std"] [badges.appveyor] repository = "rust-random/rand" diff -Nru cargo-0.35.0/vendor/rand_core/CHANGELOG.md cargo-0.37.0/vendor/rand_core/CHANGELOG.md --- cargo-0.35.0/vendor/rand_core/CHANGELOG.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -4,6 +4,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.5.0] - 2019-06-06 +- Enable testing with Miri and fix incorrect pointer usages (#779, #780, #781, #783, #784) +- Rewrite `Error` type and adjust API (#800) +- Adjust usage of `#[inline]` for `BlockRng` and `BlockRng64` + ## [0.4.0] - 2019-01-24 - Disable the `std` feature by default (#702) diff -Nru cargo-0.35.0/vendor/rand_core/README.md cargo-0.37.0/vendor/rand_core/README.md --- cargo-0.35.0/vendor/rand_core/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -6,7 +6,7 @@ [![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) [![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_core) [![API](https://docs.rs/rand_core/badge.svg)](https://docs.rs/rand_core) -[![Minimum rustc version](https://img.shields.io/badge/rustc-1.22+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements) +[![Minimum rustc version](https://img.shields.io/badge/rustc-1.32+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements) Core traits and error types of the [rand] library, plus tools for implementing RNGs. @@ -25,7 +25,7 @@ - [API documentation (master)](https://rust-random.github.io/rand/rand_core) - [API documentation (docs.rs)](https://docs.rs/rand_core) -- [Changelog](CHANGELOG.md) +- [Changelog](https://github.com/rust-random/rand/blob/master/rand_core/CHANGELOG.md) [rand]: https://crates.io/crates/rand @@ -40,6 +40,22 @@ The traits and error types are also available via `rand`. +## Versions + +The current version is: +``` +rand_core = "0.5.0" +``` + +Rand libs have inter-dependencies and make use of the +[semver trick](https://github.com/dtolnay/semver-trick/) in order to make traits +compatible across crate versions. (This is especially important for `RngCore` +and `SeedableRng`.) A few crate releases are thus compatibility shims, +depending on the *next* lib version (e.g. `rand_core` versions `0.2.2` and +`0.3.1`). This means, for example, that `rand_core_0_4_0::SeedableRng` and +`rand_core_0_3_0::SeedableRng` are distinct, incompatible traits, which can +cause build errors. Usually, running `cargo update` is enough to fix any issues. + ## Crate Features `rand_core` supports `no_std` and `alloc`-only configurations, as well as full diff -Nru cargo-0.35.0/vendor/rand_core/src/block.rs cargo-0.37.0/vendor/rand_core/src/block.rs --- cargo-0.35.0/vendor/rand_core/src/block.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core/src/block.rs 2019-07-17 05:42:23.000000000 +0000 @@ -51,7 +51,7 @@ //! [`fill_bytes`]: RngCore::fill_bytes use core::convert::AsRef; -use core::fmt; +use core::{fmt, ptr}; use {RngCore, CryptoRng, SeedableRng, Error}; use impls::{fill_via_u32_chunks, fill_via_u64_chunks}; @@ -131,6 +131,7 @@ impl BlockRng { /// Create a new `BlockRng` from an existing RNG implementing /// `BlockRngCore`. Results will be generated on first use. + #[inline] pub fn new(core: R) -> BlockRng{ let results_empty = R::Results::default(); BlockRng { @@ -145,18 +146,21 @@ /// If this is equal to or larger than the size of the result buffer then /// the buffer is "empty" and `generate()` must be called to produce new /// results. + #[inline(always)] pub fn index(&self) -> usize { self.index } /// Reset the number of available results. /// This will force a new set of results to be generated on next use. + #[inline] pub fn reset(&mut self) { self.index = self.results.as_ref().len(); } /// Generate a new set of results immediately, setting the index to the /// given value. + #[inline] pub fn generate_and_set(&mut self, index: usize) { assert!(index < self.results.as_ref().len()); self.core.generate(&mut self.results); @@ -167,7 +171,7 @@ impl> RngCore for BlockRng where ::Results: AsRef<[u32]> + AsMut<[u32]> { - #[inline(always)] + #[inline] fn next_u32(&mut self) -> u32 { if self.index >= self.results.as_ref().len() { self.generate_and_set(0); @@ -178,12 +182,13 @@ value } - #[inline(always)] + #[inline] fn next_u64(&mut self) -> u64 { let read_u64 = |results: &[u32], index| { - if cfg!(any(target_arch = "x86", target_arch = "x86_64")) { - // requires little-endian CPU supporting unaligned reads: - unsafe { *(&results[index] as *const u32 as *const u64) } + if cfg!(any(target_endian = "little")) { + // requires little-endian CPU + let ptr: *const u64 = results[index..=index+1].as_ptr() as *const u64; + unsafe { ptr::read_unaligned(ptr) } } else { let x = u64::from(results[index]); let y = u64::from(results[index + 1]); @@ -209,48 +214,7 @@ } } - // As an optimization we try to write directly into the output buffer. - // This is only enabled for little-endian platforms where unaligned writes - // are known to be safe and fast. - #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] - fn fill_bytes(&mut self, dest: &mut [u8]) { - let mut filled = 0; - - // Continue filling from the current set of results - if self.index < self.results.as_ref().len() { - let (consumed_u32, filled_u8) = - fill_via_u32_chunks(&self.results.as_ref()[self.index..], - dest); - - self.index += consumed_u32; - filled += filled_u8; - } - - let len_remainder = - (dest.len() - filled) % (self.results.as_ref().len() * 4); - let end_direct = dest.len() - len_remainder; - - while filled < end_direct { - let dest_u32: &mut R::Results = unsafe { - &mut *(dest[filled..].as_mut_ptr() as - *mut ::Results) - }; - self.core.generate(dest_u32); - filled += self.results.as_ref().len() * 4; - self.index = self.results.as_ref().len(); - } - - if len_remainder > 0 { - self.core.generate(&mut self.results); - let (consumed_u32, _) = - fill_via_u32_chunks(self.results.as_ref(), - &mut dest[filled..]); - - self.index = consumed_u32; - } - } - - #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] + #[inline] fn fill_bytes(&mut self, dest: &mut [u8]) { let mut read_len = 0; while read_len < dest.len() { @@ -266,23 +230,26 @@ } } + #[inline(always)] fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - self.fill_bytes(dest); - Ok(()) + Ok(self.fill_bytes(dest)) } } impl SeedableRng for BlockRng { type Seed = R::Seed; + #[inline(always)] fn from_seed(seed: Self::Seed) -> Self { Self::new(R::from_seed(seed)) } + #[inline(always)] fn seed_from_u64(seed: u64) -> Self { Self::new(R::seed_from_u64(seed)) } + #[inline(always)] fn from_rng(rng: S) -> Result { Ok(Self::new(R::from_rng(rng)?)) } @@ -337,6 +304,7 @@ impl BlockRng64 { /// Create a new `BlockRng` from an existing RNG implementing /// `BlockRngCore`. Results will be generated on first use. + #[inline] pub fn new(core: R) -> BlockRng64{ let results_empty = R::Results::default(); BlockRng64 { @@ -352,12 +320,14 @@ /// If this is equal to or larger than the size of the result buffer then /// the buffer is "empty" and `generate()` must be called to produce new /// results. + #[inline(always)] pub fn index(&self) -> usize { self.index } /// Reset the number of available results. /// This will force a new set of results to be generated on next use. + #[inline] pub fn reset(&mut self) { self.index = self.results.as_ref().len(); self.half_used = false; @@ -365,6 +335,7 @@ /// Generate a new set of results immediately, setting the index to the /// given value. + #[inline] pub fn generate_and_set(&mut self, index: usize) { assert!(index < self.results.as_ref().len()); self.core.generate(&mut self.results); @@ -376,7 +347,7 @@ impl> RngCore for BlockRng64 where ::Results: AsRef<[u64]> + AsMut<[u64]> { - #[inline(always)] + #[inline] fn next_u32(&mut self) -> u32 { let mut index = self.index * 2 - self.half_used as usize; if index >= self.results.as_ref().len() * 2 { @@ -402,7 +373,7 @@ } } - #[inline(always)] + #[inline] fn next_u64(&mut self) -> u64 { if self.index >= self.results.as_ref().len() { self.core.generate(&mut self.results); @@ -415,48 +386,7 @@ value } - // As an optimization we try to write directly into the output buffer. - // This is only enabled for little-endian platforms where unaligned writes - // are known to be safe and fast. - #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] - fn fill_bytes(&mut self, dest: &mut [u8]) { - let mut filled = 0; - self.half_used = false; - - // Continue filling from the current set of results - if self.index < self.results.as_ref().len() { - let (consumed_u64, filled_u8) = - fill_via_u64_chunks(&self.results.as_ref()[self.index..], - dest); - - self.index += consumed_u64; - filled += filled_u8; - } - - let len_remainder = - (dest.len() - filled) % (self.results.as_ref().len() * 8); - let end_direct = dest.len() - len_remainder; - - while filled < end_direct { - let dest_u64: &mut R::Results = unsafe { - ::core::mem::transmute(dest[filled..].as_mut_ptr()) - }; - self.core.generate(dest_u64); - filled += self.results.as_ref().len() * 8; - self.index = self.results.as_ref().len(); - } - - if len_remainder > 0 { - self.core.generate(&mut self.results); - let (consumed_u64, _) = - fill_via_u64_chunks(&mut self.results.as_ref(), - &mut dest[filled..]); - - self.index = consumed_u64; - } - } - - #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] + #[inline] fn fill_bytes(&mut self, dest: &mut [u8]) { let mut read_len = 0; self.half_used = false; @@ -475,6 +405,7 @@ } } + #[inline(always)] fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { Ok(self.fill_bytes(dest)) } @@ -483,14 +414,17 @@ impl SeedableRng for BlockRng64 { type Seed = R::Seed; + #[inline(always)] fn from_seed(seed: Self::Seed) -> Self { Self::new(R::from_seed(seed)) } + #[inline(always)] fn seed_from_u64(seed: u64) -> Self { Self::new(R::seed_from_u64(seed)) } + #[inline(always)] fn from_rng(rng: S) -> Result { Ok(Self::new(R::from_rng(rng)?)) } diff -Nru cargo-0.35.0/vendor/rand_core/src/error.rs cargo-0.37.0/vendor/rand_core/src/error.rs --- cargo-0.35.0/vendor/rand_core/src/error.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core/src/error.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,169 +9,126 @@ //! Error types use core::fmt; - -#[cfg(feature="std")] -use std::error::Error as stdError; -#[cfg(feature="std")] -use std::io; - -/// Error kind which can be matched over. -#[derive(PartialEq, Eq, Debug, Copy, Clone)] -pub enum ErrorKind { - /// Feature is not available; not recoverable. - /// - /// This is the most permanent failure type and implies the error cannot be - /// resolved simply by retrying (e.g. the feature may not exist in this - /// build of the application or on the current platform). - Unavailable, - /// General failure; there may be a chance of recovery on retry. - /// - /// This is the catch-all kind for errors from known and unknown sources - /// which do not have a more specific kind / handling method. - /// - /// It is suggested to retry a couple of times or retry later when - /// handling; some error sources may be able to resolve themselves, - /// although this is not likely. - Unexpected, - /// A transient failure which likely can be resolved or worked around. - /// - /// This error kind exists for a few specific cases where it is known that - /// the error likely can be resolved internally, but is reported anyway. - Transient, - /// Not ready yet: recommended to try again a little later. - /// - /// This error kind implies the generator needs more time or needs some - /// other part of the application to do something else first before it is - /// ready for use; for example this may be used by external generators - /// which require time for initialization. - NotReady, - #[doc(hidden)] - __Nonexhaustive, -} - -impl ErrorKind { - /// True if this kind of error may resolve itself on retry. - /// - /// See also `should_wait()`. - pub fn should_retry(self) -> bool { - self != ErrorKind::Unavailable - } - - /// True if we should retry but wait before retrying - /// - /// This implies `should_retry()` is true. - pub fn should_wait(self) -> bool { - self == ErrorKind::NotReady - } - - /// A description of this error kind - pub fn description(self) -> &'static str { - match self { - ErrorKind::Unavailable => "permanently unavailable", - ErrorKind::Unexpected => "unexpected failure", - ErrorKind::Transient => "transient failure", - ErrorKind::NotReady => "not ready yet", - ErrorKind::__Nonexhaustive => unreachable!(), - } - } -} +use core::num::NonZeroU32; /// Error type of random number generators -/// -/// This is a relatively simple error type, designed for compatibility with and -/// without the Rust `std` library. It embeds a "kind" code, a message (static -/// string only), and an optional chained cause (`std` only). The `kind` and -/// `msg` fields can be accessed directly; cause can be accessed via -/// `std::error::Error::cause` or `Error::take_cause`. Construction can only be -/// done via `Error::new` or `Error::with_cause`. +/// +/// In order to be compatible with `std` and `no_std`, this type has two +/// possible implementations: with `std` a boxed `Error` trait object is stored, +/// while with `no_std` we merely store an error code. #[derive(Debug)] pub struct Error { - /// The error kind - pub kind: ErrorKind, - /// The error message - pub msg: &'static str, #[cfg(feature="std")] - cause: Option>, + inner: Box, + #[cfg(not(feature="std"))] + code: NonZeroU32, } impl Error { - /// Create a new instance, with specified kind and a message. - pub fn new(kind: ErrorKind, msg: &'static str) -> Self { - #[cfg(feature="std")] { - Error { kind, msg, cause: None } - } - #[cfg(not(feature="std"))] { - Error { kind, msg } - } - } - - /// Create a new instance, with specified kind, message, and a - /// chained cause. + /// Construct from any type supporting `std::error::Error` /// - /// Note: `stdError` is an alias for `std::error::Error`. + /// Available only when configured with `std`. /// - /// If not targetting `std` (i.e. `no_std`), this function is replaced by - /// another with the same prototype, except that there are no bounds on the - /// type `E` (because both `Box` and `stdError` are unavailable), and the - /// `cause` is ignored. + /// See also `From`, which is available with and without `std`. #[cfg(feature="std")] - pub fn with_cause(kind: ErrorKind, msg: &'static str, cause: E) -> Self - where E: Into> + pub fn new(err: E) -> Self + where E: Into> { - Error { kind, msg, cause: Some(cause.into()) } + Error { inner: err.into() } } - /// Create a new instance, with specified kind, message, and a - /// chained cause. + /// Reference the inner error (`std` only) /// - /// In `no_std` mode the *cause* is ignored. - #[cfg(not(feature="std"))] - pub fn with_cause(kind: ErrorKind, msg: &'static str, _cause: E) -> Self { - Error { kind, msg } + /// When configured with `std`, this is a trivial operation and never + /// panics. Without `std`, this method is simply unavailable. + #[cfg(feature="std")] + pub fn inner(&self) -> &(dyn std::error::Error + Send + Sync + 'static) { + &*self.inner } - /// Take the cause, if any. This allows the embedded cause to be extracted. - /// This uses `Option::take`, leaving `self` with no cause. + /// Unwrap the inner error (`std` only) + /// + /// When configured with `std`, this is a trivial operation and never + /// panics. Without `std`, this method is simply unavailable. #[cfg(feature="std")] - pub fn take_cause(&mut self) -> Option> { - self.cause.take() + pub fn take_inner(self) -> Box { + self.inner + } + + /// Retrieve the error code, if any. + /// + /// If this `Error` was constructed via `From`, then this method + /// will return this `NonZeroU32` code (for `no_std` this is always the + /// case). Otherwise, this method will return `None`. + pub fn code(&self) -> Option { + #[cfg(feature="std")] { + self.inner.downcast_ref::().map(|c| c.0) + } + #[cfg(not(feature="std"))] { + Some(self.code) + } } } impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { #[cfg(feature="std")] { - if let Some(ref cause) = self.cause { - return write!(f, "{} ({}); cause: {}", - self.msg, self.kind.description(), cause); - } + write!(f, "{}", self.inner) + } + #[cfg(not(feature="std"))] { + write!(f, "error code {}", self.code) } - write!(f, "{} ({})", self.msg, self.kind.description()) } } -#[cfg(feature="std")] -impl stdError for Error { - fn description(&self) -> &str { - self.msg +impl From for Error { + fn from(code: NonZeroU32) -> Self { + #[cfg(feature="std")] { + Error { inner: Box::new(ErrorCode(code)) } + } + #[cfg(not(feature="std"))] { + Error { code } + } } +} - fn cause(&self) -> Option<&stdError> { - self.cause.as_ref().map(|e| e.as_ref() as &stdError) +#[cfg(feature="getrandom")] +impl From for Error { + fn from(error: getrandom::Error) -> Self { + #[cfg(feature="std")] { + Error { inner: Box::new(error) } + } + #[cfg(not(feature="std"))] { + Error { code: error.code() } + } + } +} + +#[cfg(feature="std")] +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + self.inner.source() } } #[cfg(feature="std")] -impl From for io::Error { +impl From for std::io::Error { fn from(error: Error) -> Self { - use std::io::ErrorKind::*; - match error.kind { - ErrorKind::Unavailable => io::Error::new(NotFound, error), - ErrorKind::Unexpected | - ErrorKind::Transient => io::Error::new(Other, error), - ErrorKind::NotReady => io::Error::new(WouldBlock, error), - ErrorKind::__Nonexhaustive => unreachable!(), - } + std::io::Error::new(std::io::ErrorKind::Other, error) } } + +#[cfg(feature="std")] +#[derive(Debug, Copy, Clone)] +struct ErrorCode(NonZeroU32); + +#[cfg(feature="std")] +impl fmt::Display for ErrorCode { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "error code {}", self.0) + } +} + +#[cfg(feature="std")] +impl std::error::Error for ErrorCode {} diff -Nru cargo-0.35.0/vendor/rand_core/src/lib.rs cargo-0.37.0/vendor/rand_core/src/lib.rs --- cargo-0.35.0/vendor/rand_core/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -50,7 +50,7 @@ #[cfg(all(feature="alloc", not(feature="std")))] use alloc::boxed::Box; -pub use error::{ErrorKind, Error}; +pub use error::Error; mod error; @@ -213,10 +213,6 @@ /// This trait encapsulates the low-level functionality common to all /// pseudo-random number generators (PRNGs, or algorithmic generators). /// -/// The `FromEntropy` trait from the [`rand`] crate is automatically -/// implemented for every type implementing `SeedableRng`, providing -/// a convenient `from_entropy()` constructor. -/// /// [`rand`]: https://docs.rs/rand pub trait SeedableRng: Sized { /// Seed type, which is restricted to types mutably-dereferencable as `u8` @@ -270,14 +266,18 @@ /// /// PRNG implementations are allowed to assume that bits in the seed are /// well distributed. That means usually that the number of one and zero - /// bits are about equal, and values like 0, 1 and (size - 1) are unlikely. - /// - /// PRNG implementations are recommended to be reproducible. A PRNG seeded - /// using this function with a fixed seed should produce the same sequence - /// of output in the future and on different architectures (with for example - /// different endianness). + /// bits are roughly equal, and values like 0, 1 and (size - 1) are unlikely. + /// Note that many non-cryptographic PRNGs will show poor quality output + /// if this is not adhered to. If you wish to seed from simple numbers, use + /// `seed_from_u64` instead. + /// + /// All PRNG implementations should be reproducible unless otherwise noted: + /// given a fixed `seed`, the same sequence of output should be produced + /// on all runs, library versions and architectures (e.g. check endianness). + /// Any "value-breaking" changes to the generator should require bumping at + /// least the minor version and documentation of the change. /// - /// It is however not required that this function yield the same state as a + /// It is not required that this function yield the same state as a /// reference implementation of the PRNG given equivalent seed; if necessary /// another constructor replicating behaviour from a reference /// implementation can be added. @@ -330,33 +330,26 @@ /// Create a new PRNG seeded from another `Rng`. /// - /// This is the recommended way to initialize PRNGs with fresh entropy. The - /// `FromEntropy` trait from the [`rand`] crate provides a convenient - /// `from_entropy` method based on `from_rng`. - /// - /// Usage of this method is not recommended when reproducibility is required - /// since implementing PRNGs are not required to fix Endianness and are - /// allowed to modify implementations in new releases. - /// - /// It is important to use a good source of randomness to initialize the - /// PRNG. Cryptographic PRNG may be rendered insecure when seeded from a - /// non-cryptographic PRNG or with insufficient entropy. - /// Many non-cryptographic PRNGs will show statistical bias in their first - /// results if their seed numbers are small or if there is a simple pattern - /// between them. - /// - /// Prefer to seed from a strong external entropy source like `OsRng` from - /// the [`rand_os`] crate or from a cryptographic PRNG; if creating a new - /// generator for cryptographic uses you *must* seed from a strong source. - /// - /// Seeding a small PRNG from another small PRNG is possible, but - /// something to be careful with. An extreme example of how this can go - /// wrong is seeding an Xorshift RNG from another Xorshift RNG, which - /// will effectively clone the generator. In general seeding from a - /// generator which is hard to predict is probably okay. + /// This may be useful when needing to rapidly seed many PRNGs from a master + /// PRNG, and to allow forking of PRNGs. It may be considered deterministic. + /// + /// The master PRNG should be at least as high quality as the child PRNGs. + /// When seeding non-cryptographic child PRNGs, we recommend using a + /// different algorithm for the master PRNG (ideally a CSPRNG) to avoid + /// correlations between the child PRNGs. If this is not possible (e.g. + /// forking using small non-crypto PRNGs) ensure that your PRNG has a good + /// mixing function on the output or consider use of a hash function with + /// `from_seed`. + /// + /// Note that seeding `XorShiftRng` from another `XorShiftRng` provides an + /// extreme example of what can go wrong: the new PRNG will be a clone + /// of the parent. /// /// PRNG implementations are allowed to assume that a good RNG is provided /// for seeding, and that it is cryptographically secure when appropriate. + /// As of `rand` 0.7 / `rand_core` 0.5, implementations overriding this + /// method should ensure the implementation satisfies reproducibility + /// (in prior versions this was not required). /// /// [`rand`]: https://docs.rs/rand /// [`rand_os`]: https://docs.rs/rand_os @@ -365,6 +358,29 @@ rng.try_fill_bytes(seed.as_mut())?; Ok(Self::from_seed(seed)) } + + /// Creates a new instance of the RNG seeded via [`getrandom`]. + /// + /// This method is the recommended way to construct non-deterministic PRNGs + /// since it is convenient and secure. + /// + /// In case the overhead of using [`getrandom`] to seed *many* PRNGs is an + /// issue, one may prefer to seed from a local PRNG, e.g. + /// `from_rng(thread_rng()).unwrap()`. + /// + /// # Panics + /// + /// If [`getrandom`] is unable to provide secure entropy this method will panic. + /// + /// [`getrandom`]: https://docs.rs/getrandom + #[cfg(feature="getrandom")] + fn from_entropy() -> Self { + let mut seed = Self::Seed::default(); + if let Err(err) = getrandom::getrandom(seed.as_mut()) { + panic!("from_entropy failed: {}", err); + } + Self::from_seed(seed) + } } // Implement `RngCore` for references to an `RngCore`. diff -Nru cargo-0.35.0/vendor/rand_core-0.4.0/.cargo-checksum.json cargo-0.37.0/vendor/rand_core-0.4.0/.cargo-checksum.json --- cargo-0.35.0/vendor/rand_core-0.4.0/.cargo-checksum.json 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core-0.4.0/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +{"files":{},"package":"d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/rand_core-0.4.0/Cargo.toml cargo-0.37.0/vendor/rand_core-0.4.0/Cargo.toml --- cargo-0.35.0/vendor/rand_core-0.4.0/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core-0.4.0/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,41 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# 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 = "rand_core" +version = "0.4.0" +authors = ["The Rand Project Developers", "The Rust Project Developers"] +description = "Core random number generator traits and tools for implementation.\n" +homepage = "https://crates.io/crates/rand_core" +documentation = "https://rust-random.github.io/rand/rand_core" +readme = "README.md" +keywords = ["random", "rng"] +categories = ["algorithms", "no-std"] +license = "MIT/Apache-2.0" +repository = "https://github.com/rust-random/rand" +[dependencies.serde] +version = "1" +optional = true + +[dependencies.serde_derive] +version = "^1.0.38" +optional = true + +[features] +alloc = [] +serde1 = ["serde", "serde_derive"] +std = ["alloc"] +[badges.appveyor] +repository = "rust-random/rand" + +[badges.travis-ci] +repository = "rust-random/rand" diff -Nru cargo-0.35.0/vendor/rand_core-0.4.0/CHANGELOG.md cargo-0.37.0/vendor/rand_core-0.4.0/CHANGELOG.md --- cargo-0.35.0/vendor/rand_core-0.4.0/CHANGELOG.md 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core-0.4.0/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,36 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.4.0] - 2019-01-24 +- Disable the `std` feature by default (#702) + +## [0.3.0] - 2018-09-24 +- Add `SeedableRng::seed_from_u64` for convenient seeding. (#537) + +## [0.2.1] - 2018-06-08 +- References to a `CryptoRng` now also implement `CryptoRng`. (#470) + +## [0.2.0] - 2018-05-21 +- Enable the `std` feature by default. (#409) +- Remove `BlockRng{64}::inner` and `BlockRng::inner_mut`; instead making `core` public +- Add `BlockRng{64}::index` and `BlockRng{64}::generate_and_set`. (#374, #419) +- Change `BlockRngCore::Results` bound to also require `AsMut<[Self::Item]>`. (#419) +- Implement `std::io::Read` for RngCore. (#434) + +## [0.1.0] - 2018-04-17 +(Split out of the Rand crate, changes here are relative to rand 0.4.2) +- `RngCore` and `SeedableRng` are now part of `rand_core`. (#288) +- Add modules to help implementing RNGs `impl` and `le`. (#209, #228) +- Add `Error` and `ErrorKind`. (#225) +- Add `CryptoRng` marker trait. (#273) +- Add `BlockRngCore` trait. (#281) +- Add `BlockRng` and `BlockRng64` wrappers to help implementations. (#281, #325) +- Revise the `SeedableRng` trait. (#233) +- Remove default implementations for `RngCore::next_u64` and `RngCore::fill_bytes`. (#288) +- Add `RngCore::try_fill_bytes`. (#225) + +## [0.0.1] - 2017-09-14 (yanked) +Experimental version as part of the rand crate refactor. diff -Nru cargo-0.35.0/vendor/rand_core-0.4.0/COPYRIGHT cargo-0.37.0/vendor/rand_core-0.4.0/COPYRIGHT --- cargo-0.35.0/vendor/rand_core-0.4.0/COPYRIGHT 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core-0.4.0/COPYRIGHT 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,12 @@ +Copyrights in the Rand project are retained by their contributors. No +copyright assignment is required to contribute to the Rand project. + +For full authorship information, see the version control history. + +Except as otherwise noted (below and/or in individual files), Rand is +licensed under the Apache License, Version 2.0 or + or the MIT license + or , at your option. + +The Rand project includes code from the Rust project +published under these same licenses. diff -Nru cargo-0.35.0/vendor/rand_core-0.4.0/LICENSE-APACHE cargo-0.37.0/vendor/rand_core-0.4.0/LICENSE-APACHE --- cargo-0.35.0/vendor/rand_core-0.4.0/LICENSE-APACHE 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core-0.4.0/LICENSE-APACHE 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor 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, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff -Nru cargo-0.35.0/vendor/rand_core-0.4.0/LICENSE-MIT cargo-0.37.0/vendor/rand_core-0.4.0/LICENSE-MIT --- cargo-0.35.0/vendor/rand_core-0.4.0/LICENSE-MIT 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core-0.4.0/LICENSE-MIT 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,26 @@ +Copyright 2018 Developers of the Rand project +Copyright (c) 2014 The Rust Project Developers + +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 +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff -Nru cargo-0.35.0/vendor/rand_core-0.4.0/README.md cargo-0.37.0/vendor/rand_core-0.4.0/README.md --- cargo-0.35.0/vendor/rand_core-0.4.0/README.md 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core-0.4.0/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,66 @@ +# rand_core + +[![Build Status](https://travis-ci.org/rust-random/rand.svg)](https://travis-ci.org/rust-random/rand) +[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-random/rand?svg=true)](https://ci.appveyor.com/project/rust-random/rand) +[![Latest version](https://img.shields.io/crates/v/rand_core.svg)](https://crates.io/crates/rand_core) +[![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) +[![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_core) +[![API](https://docs.rs/rand_core/badge.svg)](https://docs.rs/rand_core) +[![Minimum rustc version](https://img.shields.io/badge/rustc-1.22+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements) + +Core traits and error types of the [rand] library, plus tools for implementing +RNGs. + +This crate is intended for use when implementing the core trait, `RngCore`; it +defines the core traits to be implemented as well as several small functions to +aid in their implementation and types required for error handling. + +The main [rand] crate re-exports most items defined in this crate, along with +tools to convert the integer samples generated by `RngCore` to many different +applications (including sampling from restricted ranges, conversion to floating +point, list permutations and secure initialisation of RNGs). Most users should +prefer to use the main [rand] crate. + +Links: + +- [API documentation (master)](https://rust-random.github.io/rand/rand_core) +- [API documentation (docs.rs)](https://docs.rs/rand_core) +- [Changelog](CHANGELOG.md) + +[rand]: https://crates.io/crates/rand + + +## Functionality + +The `rand_core` crate provides: + +- base random number generator traits +- error-reporting types +- functionality to aid implementation of RNGs + +The traits and error types are also available via `rand`. + +## Crate Features + +`rand_core` supports `no_std` and `alloc`-only configurations, as well as full +`std` functionality. The differences between `no_std` and full `std` are small, +comprising `RngCore` support for `Box` types where `R: RngCore`, +`std::io::Read` support for types supporting `RngCore`, and +extensions to the `Error` type's functionality. + +The `std` feature is *not enabled by default*. This is primarily to avoid build +problems where one crate implicitly requires `rand_core` with `std` support and +another crate requires `rand` *without* `std` support. However, the `rand` crate +continues to enable `std` support by default, both for itself and `rand_core`. + +The `serde1` feature can be used to derive `Serialize` and `Deserialize` for RNG +implementations that use the `BlockRng` or `BlockRng64` wrappers. + + +# License + +`rand_core` is distributed under the terms of both the MIT license and the +Apache License (Version 2.0). + +See [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT), and +[COPYRIGHT](COPYRIGHT) for details. diff -Nru cargo-0.35.0/vendor/rand_core-0.4.0/src/block.rs cargo-0.37.0/vendor/rand_core-0.4.0/src/block.rs --- cargo-0.35.0/vendor/rand_core-0.4.0/src/block.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core-0.4.0/src/block.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,499 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The `BlockRngCore` trait and implementation helpers +//! +//! The [`BlockRngCore`] trait exists to assist in the implementation of RNGs +//! which generate a block of data in a cache instead of returning generated +//! values directly. +//! +//! Usage of this trait is optional, but provides two advantages: +//! implementations only need to concern themselves with generation of the +//! block, not the various [`RngCore`] methods (especially [`fill_bytes`], where +//! the optimal implementations are not trivial), and this allows +//! `ReseedingRng` (see [`rand`](https://docs.rs/rand) crate) perform periodic +//! reseeding with very low overhead. +//! +//! # Example +//! +//! ```norun +//! use rand_core::block::{BlockRngCore, BlockRng}; +//! +//! struct MyRngCore; +//! +//! impl BlockRngCore for MyRngCore { +//! type Results = [u32; 16]; +//! +//! fn generate(&mut self, results: &mut Self::Results) { +//! unimplemented!() +//! } +//! } +//! +//! impl SeedableRng for MyRngCore { +//! type Seed = unimplemented!(); +//! fn from_seed(seed: Self::Seed) -> Self { +//! unimplemented!() +//! } +//! } +//! +//! // optionally, also implement CryptoRng for MyRngCore +//! +//! // Final RNG. +//! type MyRng = BlockRng; +//! ``` +//! +//! [`BlockRngCore`]: crate::block::BlockRngCore +//! [`fill_bytes`]: RngCore::fill_bytes + +use core::convert::AsRef; +use core::fmt; +use {RngCore, CryptoRng, SeedableRng, Error}; +use impls::{fill_via_u32_chunks, fill_via_u64_chunks}; + +/// A trait for RNGs which do not generate random numbers individually, but in +/// blocks (typically `[u32; N]`). This technique is commonly used by +/// cryptographic RNGs to improve performance. +/// +/// See the [module][crate::block] documentation for details. +pub trait BlockRngCore { + /// Results element type, e.g. `u32`. + type Item; + + /// Results type. This is the 'block' an RNG implementing `BlockRngCore` + /// generates, which will usually be an array like `[u32; 16]`. + type Results: AsRef<[Self::Item]> + AsMut<[Self::Item]> + Default; + + /// Generate a new block of results. + fn generate(&mut self, results: &mut Self::Results); +} + + +/// A wrapper type implementing [`RngCore`] for some type implementing +/// [`BlockRngCore`] with `u32` array buffer; i.e. this can be used to implement +/// a full RNG from just a `generate` function. +/// +/// The `core` field may be accessed directly but the results buffer may not. +/// PRNG implementations can simply use a type alias +/// (`pub type MyRng = BlockRng;`) but might prefer to use a +/// wrapper type (`pub struct MyRng(BlockRng);`); the latter must +/// re-implement `RngCore` but hides the implementation details and allows +/// extra functionality to be defined on the RNG +/// (e.g. `impl MyRng { fn set_stream(...){...} }`). +/// +/// `BlockRng` has heavily optimized implementations of the [`RngCore`] methods +/// reading values from the results buffer, as well as +/// calling [`BlockRngCore::generate`] directly on the output array when +/// [`fill_bytes`] / [`try_fill_bytes`] is called on a large array. These methods +/// also handle the bookkeeping of when to generate a new batch of values. +/// +/// No whole generated `u32` values are thown away and all values are consumed +/// in-order. [`next_u32`] simply takes the next available `u32` value. +/// [`next_u64`] is implemented by combining two `u32` values, least +/// significant first. [`fill_bytes`] and [`try_fill_bytes`] consume a whole +/// number of `u32` values, converting each `u32` to a byte slice in +/// little-endian order. If the requested byte length is not a multiple of 4, +/// some bytes will be discarded. +/// +/// See also [`BlockRng64`] which uses `u64` array buffers. Currently there is +/// no direct support for other buffer types. +/// +/// For easy initialization `BlockRng` also implements [`SeedableRng`]. +/// +/// [`next_u32`]: RngCore::next_u32 +/// [`next_u64`]: RngCore::next_u64 +/// [`fill_bytes`]: RngCore::fill_bytes +/// [`try_fill_bytes`]: RngCore::try_fill_bytes +#[derive(Clone)] +#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))] +pub struct BlockRng { + results: R::Results, + index: usize, + /// The *core* part of the RNG, implementing the `generate` function. + pub core: R, +} + +// Custom Debug implementation that does not expose the contents of `results`. +impl fmt::Debug for BlockRng { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt.debug_struct("BlockRng") + .field("core", &self.core) + .field("result_len", &self.results.as_ref().len()) + .field("index", &self.index) + .finish() + } +} + +impl BlockRng { + /// Create a new `BlockRng` from an existing RNG implementing + /// `BlockRngCore`. Results will be generated on first use. + pub fn new(core: R) -> BlockRng{ + let results_empty = R::Results::default(); + BlockRng { + core, + index: results_empty.as_ref().len(), + results: results_empty, + } + } + + /// Get the index into the result buffer. + /// + /// If this is equal to or larger than the size of the result buffer then + /// the buffer is "empty" and `generate()` must be called to produce new + /// results. + pub fn index(&self) -> usize { + self.index + } + + /// Reset the number of available results. + /// This will force a new set of results to be generated on next use. + pub fn reset(&mut self) { + self.index = self.results.as_ref().len(); + } + + /// Generate a new set of results immediately, setting the index to the + /// given value. + pub fn generate_and_set(&mut self, index: usize) { + assert!(index < self.results.as_ref().len()); + self.core.generate(&mut self.results); + self.index = index; + } +} + +impl> RngCore for BlockRng +where ::Results: AsRef<[u32]> + AsMut<[u32]> +{ + #[inline(always)] + fn next_u32(&mut self) -> u32 { + if self.index >= self.results.as_ref().len() { + self.generate_and_set(0); + } + + let value = self.results.as_ref()[self.index]; + self.index += 1; + value + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + let read_u64 = |results: &[u32], index| { + if cfg!(any(target_arch = "x86", target_arch = "x86_64")) { + // requires little-endian CPU supporting unaligned reads: + unsafe { *(&results[index] as *const u32 as *const u64) } + } else { + let x = u64::from(results[index]); + let y = u64::from(results[index + 1]); + (y << 32) | x + } + }; + + let len = self.results.as_ref().len(); + + let index = self.index; + if index < len-1 { + self.index += 2; + // Read an u64 from the current index + read_u64(self.results.as_ref(), index) + } else if index >= len { + self.generate_and_set(2); + read_u64(self.results.as_ref(), 0) + } else { + let x = u64::from(self.results.as_ref()[len-1]); + self.generate_and_set(1); + let y = u64::from(self.results.as_ref()[0]); + (y << 32) | x + } + } + + // As an optimization we try to write directly into the output buffer. + // This is only enabled for little-endian platforms where unaligned writes + // are known to be safe and fast. + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + fn fill_bytes(&mut self, dest: &mut [u8]) { + let mut filled = 0; + + // Continue filling from the current set of results + if self.index < self.results.as_ref().len() { + let (consumed_u32, filled_u8) = + fill_via_u32_chunks(&self.results.as_ref()[self.index..], + dest); + + self.index += consumed_u32; + filled += filled_u8; + } + + let len_remainder = + (dest.len() - filled) % (self.results.as_ref().len() * 4); + let end_direct = dest.len() - len_remainder; + + while filled < end_direct { + let dest_u32: &mut R::Results = unsafe { + &mut *(dest[filled..].as_mut_ptr() as + *mut ::Results) + }; + self.core.generate(dest_u32); + filled += self.results.as_ref().len() * 4; + self.index = self.results.as_ref().len(); + } + + if len_remainder > 0 { + self.core.generate(&mut self.results); + let (consumed_u32, _) = + fill_via_u32_chunks(self.results.as_ref(), + &mut dest[filled..]); + + self.index = consumed_u32; + } + } + + #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] + fn fill_bytes(&mut self, dest: &mut [u8]) { + let mut read_len = 0; + while read_len < dest.len() { + if self.index >= self.results.as_ref().len() { + self.generate_and_set(0); + } + let (consumed_u32, filled_u8) = + fill_via_u32_chunks(&self.results.as_ref()[self.index..], + &mut dest[read_len..]); + + self.index += consumed_u32; + read_len += filled_u8; + } + } + + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.fill_bytes(dest); + Ok(()) + } +} + +impl SeedableRng for BlockRng { + type Seed = R::Seed; + + fn from_seed(seed: Self::Seed) -> Self { + Self::new(R::from_seed(seed)) + } + + fn seed_from_u64(seed: u64) -> Self { + Self::new(R::seed_from_u64(seed)) + } + + fn from_rng(rng: S) -> Result { + Ok(Self::new(R::from_rng(rng)?)) + } +} + + + +/// A wrapper type implementing [`RngCore`] for some type implementing +/// [`BlockRngCore`] with `u64` array buffer; i.e. this can be used to implement +/// a full RNG from just a `generate` function. +/// +/// This is similar to [`BlockRng`], but specialized for algorithms that operate +/// on `u64` values. +/// +/// No whole generated `u64` values are thrown away and all values are consumed +/// in-order. [`next_u64`] simply takes the next available `u64` value. +/// [`next_u32`] is however a bit special: half of a `u64` is consumed, leaving +/// the other half in the buffer. If the next function called is [`next_u32`] +/// then the other half is then consumed, however both [`next_u64`] and +/// [`fill_bytes`] discard the rest of any half-consumed `u64`s when called. +/// +/// [`fill_bytes`] and [`try_fill_bytes`] consume a whole number of `u64` +/// values. If the requested length is not a multiple of 8, some bytes will be +/// discarded. +/// +/// [`next_u32`]: RngCore::next_u32 +/// [`next_u64`]: RngCore::next_u64 +/// [`fill_bytes`]: RngCore::fill_bytes +/// [`try_fill_bytes`]: RngCore::try_fill_bytes +#[derive(Clone)] +#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))] +pub struct BlockRng64 { + results: R::Results, + index: usize, + half_used: bool, // true if only half of the previous result is used + /// The *core* part of the RNG, implementing the `generate` function. + pub core: R, +} + +// Custom Debug implementation that does not expose the contents of `results`. +impl fmt::Debug for BlockRng64 { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt.debug_struct("BlockRng64") + .field("core", &self.core) + .field("result_len", &self.results.as_ref().len()) + .field("index", &self.index) + .field("half_used", &self.half_used) + .finish() + } +} + +impl BlockRng64 { + /// Create a new `BlockRng` from an existing RNG implementing + /// `BlockRngCore`. Results will be generated on first use. + pub fn new(core: R) -> BlockRng64{ + let results_empty = R::Results::default(); + BlockRng64 { + core, + index: results_empty.as_ref().len(), + half_used: false, + results: results_empty, + } + } + + /// Get the index into the result buffer. + /// + /// If this is equal to or larger than the size of the result buffer then + /// the buffer is "empty" and `generate()` must be called to produce new + /// results. + pub fn index(&self) -> usize { + self.index + } + + /// Reset the number of available results. + /// This will force a new set of results to be generated on next use. + pub fn reset(&mut self) { + self.index = self.results.as_ref().len(); + self.half_used = false; + } + + /// Generate a new set of results immediately, setting the index to the + /// given value. + pub fn generate_and_set(&mut self, index: usize) { + assert!(index < self.results.as_ref().len()); + self.core.generate(&mut self.results); + self.index = index; + self.half_used = false; + } +} + +impl> RngCore for BlockRng64 +where ::Results: AsRef<[u64]> + AsMut<[u64]> +{ + #[inline(always)] + fn next_u32(&mut self) -> u32 { + let mut index = self.index * 2 - self.half_used as usize; + if index >= self.results.as_ref().len() * 2 { + self.core.generate(&mut self.results); + self.index = 0; + // `self.half_used` is by definition `false` + self.half_used = false; + index = 0; + } + + self.half_used = !self.half_used; + self.index += self.half_used as usize; + + // Index as if this is a u32 slice. + unsafe { + let results = + &*(self.results.as_ref() as *const [u64] as *const [u32]); + if cfg!(target_endian = "little") { + *results.get_unchecked(index) + } else { + *results.get_unchecked(index ^ 1) + } + } + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + if self.index >= self.results.as_ref().len() { + self.core.generate(&mut self.results); + self.index = 0; + } + + let value = self.results.as_ref()[self.index]; + self.index += 1; + self.half_used = false; + value + } + + // As an optimization we try to write directly into the output buffer. + // This is only enabled for little-endian platforms where unaligned writes + // are known to be safe and fast. + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + fn fill_bytes(&mut self, dest: &mut [u8]) { + let mut filled = 0; + self.half_used = false; + + // Continue filling from the current set of results + if self.index < self.results.as_ref().len() { + let (consumed_u64, filled_u8) = + fill_via_u64_chunks(&self.results.as_ref()[self.index..], + dest); + + self.index += consumed_u64; + filled += filled_u8; + } + + let len_remainder = + (dest.len() - filled) % (self.results.as_ref().len() * 8); + let end_direct = dest.len() - len_remainder; + + while filled < end_direct { + let dest_u64: &mut R::Results = unsafe { + ::core::mem::transmute(dest[filled..].as_mut_ptr()) + }; + self.core.generate(dest_u64); + filled += self.results.as_ref().len() * 8; + self.index = self.results.as_ref().len(); + } + + if len_remainder > 0 { + self.core.generate(&mut self.results); + let (consumed_u64, _) = + fill_via_u64_chunks(&mut self.results.as_ref(), + &mut dest[filled..]); + + self.index = consumed_u64; + } + } + + #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] + fn fill_bytes(&mut self, dest: &mut [u8]) { + let mut read_len = 0; + self.half_used = false; + while read_len < dest.len() { + if self.index as usize >= self.results.as_ref().len() { + self.core.generate(&mut self.results); + self.index = 0; + } + + let (consumed_u64, filled_u8) = + fill_via_u64_chunks(&self.results.as_ref()[self.index as usize..], + &mut dest[read_len..]); + + self.index += consumed_u64; + read_len += filled_u8; + } + } + + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + Ok(self.fill_bytes(dest)) + } +} + +impl SeedableRng for BlockRng64 { + type Seed = R::Seed; + + fn from_seed(seed: Self::Seed) -> Self { + Self::new(R::from_seed(seed)) + } + + fn seed_from_u64(seed: u64) -> Self { + Self::new(R::seed_from_u64(seed)) + } + + fn from_rng(rng: S) -> Result { + Ok(Self::new(R::from_rng(rng)?)) + } +} + +impl CryptoRng for BlockRng {} diff -Nru cargo-0.35.0/vendor/rand_core-0.4.0/src/error.rs cargo-0.37.0/vendor/rand_core-0.4.0/src/error.rs --- cargo-0.35.0/vendor/rand_core-0.4.0/src/error.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core-0.4.0/src/error.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,177 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Error types + +use core::fmt; + +#[cfg(feature="std")] +use std::error::Error as stdError; +#[cfg(feature="std")] +use std::io; + +/// Error kind which can be matched over. +#[derive(PartialEq, Eq, Debug, Copy, Clone)] +pub enum ErrorKind { + /// Feature is not available; not recoverable. + /// + /// This is the most permanent failure type and implies the error cannot be + /// resolved simply by retrying (e.g. the feature may not exist in this + /// build of the application or on the current platform). + Unavailable, + /// General failure; there may be a chance of recovery on retry. + /// + /// This is the catch-all kind for errors from known and unknown sources + /// which do not have a more specific kind / handling method. + /// + /// It is suggested to retry a couple of times or retry later when + /// handling; some error sources may be able to resolve themselves, + /// although this is not likely. + Unexpected, + /// A transient failure which likely can be resolved or worked around. + /// + /// This error kind exists for a few specific cases where it is known that + /// the error likely can be resolved internally, but is reported anyway. + Transient, + /// Not ready yet: recommended to try again a little later. + /// + /// This error kind implies the generator needs more time or needs some + /// other part of the application to do something else first before it is + /// ready for use; for example this may be used by external generators + /// which require time for initialization. + NotReady, + #[doc(hidden)] + __Nonexhaustive, +} + +impl ErrorKind { + /// True if this kind of error may resolve itself on retry. + /// + /// See also `should_wait()`. + pub fn should_retry(self) -> bool { + self != ErrorKind::Unavailable + } + + /// True if we should retry but wait before retrying + /// + /// This implies `should_retry()` is true. + pub fn should_wait(self) -> bool { + self == ErrorKind::NotReady + } + + /// A description of this error kind + pub fn description(self) -> &'static str { + match self { + ErrorKind::Unavailable => "permanently unavailable", + ErrorKind::Unexpected => "unexpected failure", + ErrorKind::Transient => "transient failure", + ErrorKind::NotReady => "not ready yet", + ErrorKind::__Nonexhaustive => unreachable!(), + } + } +} + + +/// Error type of random number generators +/// +/// This is a relatively simple error type, designed for compatibility with and +/// without the Rust `std` library. It embeds a "kind" code, a message (static +/// string only), and an optional chained cause (`std` only). The `kind` and +/// `msg` fields can be accessed directly; cause can be accessed via +/// `std::error::Error::cause` or `Error::take_cause`. Construction can only be +/// done via `Error::new` or `Error::with_cause`. +#[derive(Debug)] +pub struct Error { + /// The error kind + pub kind: ErrorKind, + /// The error message + pub msg: &'static str, + #[cfg(feature="std")] + cause: Option>, +} + +impl Error { + /// Create a new instance, with specified kind and a message. + pub fn new(kind: ErrorKind, msg: &'static str) -> Self { + #[cfg(feature="std")] { + Error { kind, msg, cause: None } + } + #[cfg(not(feature="std"))] { + Error { kind, msg } + } + } + + /// Create a new instance, with specified kind, message, and a + /// chained cause. + /// + /// Note: `stdError` is an alias for `std::error::Error`. + /// + /// If not targetting `std` (i.e. `no_std`), this function is replaced by + /// another with the same prototype, except that there are no bounds on the + /// type `E` (because both `Box` and `stdError` are unavailable), and the + /// `cause` is ignored. + #[cfg(feature="std")] + pub fn with_cause(kind: ErrorKind, msg: &'static str, cause: E) -> Self + where E: Into> + { + Error { kind, msg, cause: Some(cause.into()) } + } + + /// Create a new instance, with specified kind, message, and a + /// chained cause. + /// + /// In `no_std` mode the *cause* is ignored. + #[cfg(not(feature="std"))] + pub fn with_cause(kind: ErrorKind, msg: &'static str, _cause: E) -> Self { + Error { kind, msg } + } + + /// Take the cause, if any. This allows the embedded cause to be extracted. + /// This uses `Option::take`, leaving `self` with no cause. + #[cfg(feature="std")] + pub fn take_cause(&mut self) -> Option> { + self.cause.take() + } +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + #[cfg(feature="std")] { + if let Some(ref cause) = self.cause { + return write!(f, "{} ({}); cause: {}", + self.msg, self.kind.description(), cause); + } + } + write!(f, "{} ({})", self.msg, self.kind.description()) + } +} + +#[cfg(feature="std")] +impl stdError for Error { + fn description(&self) -> &str { + self.msg + } + + fn cause(&self) -> Option<&stdError> { + self.cause.as_ref().map(|e| e.as_ref() as &stdError) + } +} + +#[cfg(feature="std")] +impl From for io::Error { + fn from(error: Error) -> Self { + use std::io::ErrorKind::*; + match error.kind { + ErrorKind::Unavailable => io::Error::new(NotFound, error), + ErrorKind::Unexpected | + ErrorKind::Transient => io::Error::new(Other, error), + ErrorKind::NotReady => io::Error::new(WouldBlock, error), + ErrorKind::__Nonexhaustive => unreachable!(), + } + } +} diff -Nru cargo-0.35.0/vendor/rand_core-0.4.0/src/impls.rs cargo-0.37.0/vendor/rand_core-0.4.0/src/impls.rs --- cargo-0.35.0/vendor/rand_core-0.4.0/src/impls.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core-0.4.0/src/impls.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,165 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Helper functions for implementing `RngCore` functions. +//! +//! For cross-platform reproducibility, these functions all use Little Endian: +//! least-significant part first. For example, `next_u64_via_u32` takes `u32` +//! values `x, y`, then outputs `(y << 32) | x`. To implement `next_u32` +//! from `next_u64` in little-endian order, one should use `next_u64() as u32`. +//! +//! Byte-swapping (like the std `to_le` functions) is only needed to convert +//! to/from byte sequences, and since its purpose is reproducibility, +//! non-reproducible sources (e.g. `OsRng`) need not bother with it. + +use core::intrinsics::transmute; +use core::ptr::copy_nonoverlapping; +use core::slice; +use core::cmp::min; +use core::mem::size_of; +use RngCore; + + +/// Implement `next_u64` via `next_u32`, little-endian order. +pub fn next_u64_via_u32(rng: &mut R) -> u64 { + // Use LE; we explicitly generate one value before the next. + let x = u64::from(rng.next_u32()); + let y = u64::from(rng.next_u32()); + (y << 32) | x +} + +/// Implement `fill_bytes` via `next_u64` and `next_u32`, little-endian order. +/// +/// The fastest way to fill a slice is usually to work as long as possible with +/// integers. That is why this method mostly uses `next_u64`, and only when +/// there are 4 or less bytes remaining at the end of the slice it uses +/// `next_u32` once. +pub fn fill_bytes_via_next(rng: &mut R, dest: &mut [u8]) { + let mut left = dest; + while left.len() >= 8 { + let (l, r) = {left}.split_at_mut(8); + left = r; + let chunk: [u8; 8] = unsafe { + transmute(rng.next_u64().to_le()) + }; + l.copy_from_slice(&chunk); + } + let n = left.len(); + if n > 4 { + let chunk: [u8; 8] = unsafe { + transmute(rng.next_u64().to_le()) + }; + left.copy_from_slice(&chunk[..n]); + } else if n > 0 { + let chunk: [u8; 4] = unsafe { + transmute(rng.next_u32().to_le()) + }; + left.copy_from_slice(&chunk[..n]); + } +} + +macro_rules! impl_uint_from_fill { + ($rng:expr, $ty:ty, $N:expr) => ({ + debug_assert!($N == size_of::<$ty>()); + + let mut int: $ty = 0; + unsafe { + let ptr = &mut int as *mut $ty as *mut u8; + let slice = slice::from_raw_parts_mut(ptr, $N); + $rng.fill_bytes(slice); + } + int + }); +} + +macro_rules! fill_via_chunks { + ($src:expr, $dst:expr, $ty:ty, $size:expr) => ({ + let chunk_size_u8 = min($src.len() * $size, $dst.len()); + let chunk_size = (chunk_size_u8 + $size - 1) / $size; + if cfg!(target_endian="little") { + unsafe { + copy_nonoverlapping( + $src.as_ptr() as *const u8, + $dst.as_mut_ptr(), + chunk_size_u8); + } + } else { + for (&n, chunk) in $src.iter().zip($dst.chunks_mut($size)) { + let tmp = n.to_le(); + let src_ptr = &tmp as *const $ty as *const u8; + unsafe { + copy_nonoverlapping(src_ptr, + chunk.as_mut_ptr(), + chunk.len()); + } + } + } + + (chunk_size, chunk_size_u8) + }); +} + +/// Implement `fill_bytes` by reading chunks from the output buffer of a block +/// based RNG. +/// +/// The return values are `(consumed_u32, filled_u8)`. +/// +/// `filled_u8` is the number of filled bytes in `dest`, which may be less than +/// the length of `dest`. +/// `consumed_u32` is the number of words consumed from `src`, which is the same +/// as `filled_u8 / 4` rounded up. +/// +/// # Example +/// (from `IsaacRng`) +/// +/// ```ignore +/// fn fill_bytes(&mut self, dest: &mut [u8]) { +/// let mut read_len = 0; +/// while read_len < dest.len() { +/// if self.index >= self.rsl.len() { +/// self.isaac(); +/// } +/// +/// let (consumed_u32, filled_u8) = +/// impls::fill_via_u32_chunks(&mut self.rsl[self.index..], +/// &mut dest[read_len..]); +/// +/// self.index += consumed_u32; +/// read_len += filled_u8; +/// } +/// } +/// ``` +pub fn fill_via_u32_chunks(src: &[u32], dest: &mut [u8]) -> (usize, usize) { + fill_via_chunks!(src, dest, u32, 4) +} + +/// Implement `fill_bytes` by reading chunks from the output buffer of a block +/// based RNG. +/// +/// The return values are `(consumed_u64, filled_u8)`. +/// `filled_u8` is the number of filled bytes in `dest`, which may be less than +/// the length of `dest`. +/// `consumed_u64` is the number of words consumed from `src`, which is the same +/// as `filled_u8 / 8` rounded up. +/// +/// See `fill_via_u32_chunks` for an example. +pub fn fill_via_u64_chunks(src: &[u64], dest: &mut [u8]) -> (usize, usize) { + fill_via_chunks!(src, dest, u64, 8) +} + +/// Implement `next_u32` via `fill_bytes`, little-endian order. +pub fn next_u32_via_fill(rng: &mut R) -> u32 { + impl_uint_from_fill!(rng, u32, 4) +} + +/// Implement `next_u64` via `fill_bytes`, little-endian order. +pub fn next_u64_via_fill(rng: &mut R) -> u64 { + impl_uint_from_fill!(rng, u64, 8) +} + +// TODO: implement tests for the above diff -Nru cargo-0.35.0/vendor/rand_core-0.4.0/src/le.rs cargo-0.37.0/vendor/rand_core-0.4.0/src/le.rs --- cargo-0.35.0/vendor/rand_core-0.4.0/src/le.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core-0.4.0/src/le.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,68 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Little-Endian utilities +//! +//! Little-Endian order has been chosen for internal usage; this makes some +//! useful functions available. + +use core::ptr; + +macro_rules! read_slice { + ($src:expr, $dst:expr, $size:expr, $which:ident) => {{ + assert_eq!($src.len(), $size * $dst.len()); + + unsafe { + ptr::copy_nonoverlapping( + $src.as_ptr(), + $dst.as_mut_ptr() as *mut u8, + $src.len()); + } + for v in $dst.iter_mut() { + *v = v.$which(); + } + }}; +} + +/// Reads unsigned 32 bit integers from `src` into `dst`. +/// Borrowed from the `byteorder` crate. +#[inline] +pub fn read_u32_into(src: &[u8], dst: &mut [u32]) { + read_slice!(src, dst, 4, to_le); +} + +/// Reads unsigned 64 bit integers from `src` into `dst`. +/// Borrowed from the `byteorder` crate. +#[inline] +pub fn read_u64_into(src: &[u8], dst: &mut [u64]) { + read_slice!(src, dst, 8, to_le); +} + +#[test] +fn test_read() { + let bytes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + + let mut buf = [0u32; 4]; + read_u32_into(&bytes, &mut buf); + assert_eq!(buf[0], 0x04030201); + assert_eq!(buf[3], 0x100F0E0D); + + let mut buf = [0u32; 3]; + read_u32_into(&bytes[1..13], &mut buf); // unaligned + assert_eq!(buf[0], 0x05040302); + assert_eq!(buf[2], 0x0D0C0B0A); + + let mut buf = [0u64; 2]; + read_u64_into(&bytes, &mut buf); + assert_eq!(buf[0], 0x0807060504030201); + assert_eq!(buf[1], 0x100F0E0D0C0B0A09); + + let mut buf = [0u64; 1]; + read_u64_into(&bytes[7..15], &mut buf); // unaligned + assert_eq!(buf[0], 0x0F0E0D0C0B0A0908); +} diff -Nru cargo-0.35.0/vendor/rand_core-0.4.0/src/lib.rs cargo-0.37.0/vendor/rand_core-0.4.0/src/lib.rs --- cargo-0.35.0/vendor/rand_core-0.4.0/src/lib.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_core-0.4.0/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,477 @@ +// Copyright 2018 Developers of the Rand project. +// Copyright 2017-2018 The Rust Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Random number generation traits +//! +//! This crate is mainly of interest to crates publishing implementations of +//! [`RngCore`]. Other users are encouraged to use the [`rand`] crate instead +//! which re-exports the main traits and error types. +//! +//! [`RngCore`] is the core trait implemented by algorithmic pseudo-random number +//! generators and external random-number sources. +//! +//! [`SeedableRng`] is an extension trait for construction from fixed seeds and +//! other random number generators. +//! +//! [`Error`] is provided for error-handling. It is safe to use in `no_std` +//! environments. +//! +//! The [`impls`] and [`le`] sub-modules include a few small functions to assist +//! implementation of [`RngCore`]. +//! +//! [`rand`]: https://docs.rs/rand + +#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png", + html_favicon_url = "https://www.rust-lang.org/favicon.ico", + html_root_url = "https://rust-random.github.io/rand/")] + +#![deny(missing_docs)] +#![deny(missing_debug_implementations)] +#![doc(test(attr(allow(unused_variables), deny(warnings))))] + +#![cfg_attr(not(feature="std"), no_std)] +#![cfg_attr(all(feature="alloc", not(feature="std")), feature(alloc))] + +#[cfg(feature="std")] extern crate core; +#[cfg(all(feature = "alloc", not(feature="std")))] extern crate alloc; +#[cfg(feature="serde1")] extern crate serde; +#[cfg(feature="serde1")] #[macro_use] extern crate serde_derive; + + +use core::default::Default; +use core::convert::AsMut; +use core::ptr::copy_nonoverlapping; + +#[cfg(all(feature="alloc", not(feature="std")))] use alloc::boxed::Box; + +pub use error::{ErrorKind, Error}; + + +mod error; +pub mod block; +pub mod impls; +pub mod le; + + +/// The core of a random number generator. +/// +/// This trait encapsulates the low-level functionality common to all +/// generators, and is the "back end", to be implemented by generators. +/// End users should normally use the `Rng` trait from the [`rand`] crate, +/// which is automatically implemented for every type implementing `RngCore`. +/// +/// Three different methods for generating random data are provided since the +/// optimal implementation of each is dependent on the type of generator. There +/// is no required relationship between the output of each; e.g. many +/// implementations of [`fill_bytes`] consume a whole number of `u32` or `u64` +/// values and drop any remaining unused bytes. +/// +/// The [`try_fill_bytes`] method is a variant of [`fill_bytes`] allowing error +/// handling; it is not deemed sufficiently useful to add equivalents for +/// [`next_u32`] or [`next_u64`] since the latter methods are almost always used +/// with algorithmic generators (PRNGs), which are normally infallible. +/// +/// Algorithmic generators implementing [`SeedableRng`] should normally have +/// *portable, reproducible* output, i.e. fix Endianness when converting values +/// to avoid platform differences, and avoid making any changes which affect +/// output (except by communicating that the release has breaking changes). +/// +/// Typically implementators will implement only one of the methods available +/// in this trait directly, then use the helper functions from the +/// [`impls`] module to implement the other methods. +/// +/// It is recommended that implementations also implement: +/// +/// - `Debug` with a custom implementation which *does not* print any internal +/// state (at least, [`CryptoRng`]s should not risk leaking state through +/// `Debug`). +/// - `Serialize` and `Deserialize` (from Serde), preferably making Serde +/// support optional at the crate level in PRNG libs. +/// - `Clone`, if possible. +/// - *never* implement `Copy` (accidental copies may cause repeated values). +/// - *do not* implement `Default` for pseudorandom generators, but instead +/// implement [`SeedableRng`], to guide users towards proper seeding. +/// External / hardware RNGs can choose to implement `Default`. +/// - `Eq` and `PartialEq` could be implemented, but are probably not useful. +/// +/// # Example +/// +/// A simple example, obviously not generating very *random* output: +/// +/// ``` +/// #![allow(dead_code)] +/// use rand_core::{RngCore, Error, impls}; +/// +/// struct CountingRng(u64); +/// +/// impl RngCore for CountingRng { +/// fn next_u32(&mut self) -> u32 { +/// self.next_u64() as u32 +/// } +/// +/// fn next_u64(&mut self) -> u64 { +/// self.0 += 1; +/// self.0 +/// } +/// +/// fn fill_bytes(&mut self, dest: &mut [u8]) { +/// impls::fill_bytes_via_next(self, dest) +/// } +/// +/// fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { +/// Ok(self.fill_bytes(dest)) +/// } +/// } +/// ``` +/// +/// [`rand`]: https://docs.rs/rand +/// [`try_fill_bytes`]: RngCore::try_fill_bytes +/// [`fill_bytes`]: RngCore::fill_bytes +/// [`next_u32`]: RngCore::next_u32 +/// [`next_u64`]: RngCore::next_u64 +pub trait RngCore { + /// Return the next random `u32`. + /// + /// RNGs must implement at least one method from this trait directly. In + /// the case this method is not implemented directly, it can be implemented + /// using `self.next_u64() as u32` or via + /// [`fill_bytes`][impls::next_u32_via_fill]. + fn next_u32(&mut self) -> u32; + + /// Return the next random `u64`. + /// + /// RNGs must implement at least one method from this trait directly. In + /// the case this method is not implemented directly, it can be implemented + /// via [`next_u32`][impls::next_u64_via_u32] or via + /// [`fill_bytes`][impls::next_u64_via_fill]. + fn next_u64(&mut self) -> u64; + + /// Fill `dest` with random data. + /// + /// RNGs must implement at least one method from this trait directly. In + /// the case this method is not implemented directly, it can be implemented + /// via [`next_u*`][impls::fill_bytes_via_next] or + /// via [`try_fill_bytes`][RngCore::try_fill_bytes]; if this generator can + /// fail the implementation must choose how best to handle errors here + /// (e.g. panic with a descriptive message or log a warning and retry a few + /// times). + /// + /// This method should guarantee that `dest` is entirely filled + /// with new data, and may panic if this is impossible + /// (e.g. reading past the end of a file that is being used as the + /// source of randomness). + fn fill_bytes(&mut self, dest: &mut [u8]); + + /// Fill `dest` entirely with random data. + /// + /// This is the only method which allows an RNG to report errors while + /// generating random data thus making this the primary method implemented + /// by external (true) RNGs (e.g. `OsRng`) which can fail. It may be used + /// directly to generate keys and to seed (infallible) PRNGs. + /// + /// Other than error handling, this method is identical to [`fill_bytes`]; + /// thus this may be implemented using `Ok(self.fill_bytes(dest))` or + /// `fill_bytes` may be implemented with + /// `self.try_fill_bytes(dest).unwrap()` or more specific error handling. + /// + /// [`fill_bytes`]: RngCore::fill_bytes + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error>; +} + +/// A marker trait used to indicate that an [`RngCore`] or [`BlockRngCore`] +/// implementation is supposed to be cryptographically secure. +/// +/// *Cryptographically secure generators*, also known as *CSPRNGs*, should +/// satisfy an additional properties over other generators: given the first +/// *k* bits of an algorithm's output +/// sequence, it should not be possible using polynomial-time algorithms to +/// predict the next bit with probability significantly greater than 50%. +/// +/// Some generators may satisfy an additional property, however this is not +/// required by this trait: if the CSPRNG's state is revealed, it should not be +/// computationally-feasible to reconstruct output prior to this. Some other +/// generators allow backwards-computation and are consided *reversible*. +/// +/// Note that this trait is provided for guidance only and cannot guarantee +/// suitability for cryptographic applications. In general it should only be +/// implemented for well-reviewed code implementing well-regarded algorithms. +/// +/// Note also that use of a `CryptoRng` does not protect against other +/// weaknesses such as seeding from a weak entropy source or leaking state. +/// +/// [`BlockRngCore`]: block::BlockRngCore +pub trait CryptoRng {} + +/// A random number generator that can be explicitly seeded. +/// +/// This trait encapsulates the low-level functionality common to all +/// pseudo-random number generators (PRNGs, or algorithmic generators). +/// +/// The `FromEntropy` trait from the [`rand`] crate is automatically +/// implemented for every type implementing `SeedableRng`, providing +/// a convenient `from_entropy()` constructor. +/// +/// [`rand`]: https://docs.rs/rand +pub trait SeedableRng: Sized { + /// Seed type, which is restricted to types mutably-dereferencable as `u8` + /// arrays (we recommend `[u8; N]` for some `N`). + /// + /// It is recommended to seed PRNGs with a seed of at least circa 100 bits, + /// which means an array of `[u8; 12]` or greater to avoid picking RNGs with + /// partially overlapping periods. + /// + /// For cryptographic RNG's a seed of 256 bits is recommended, `[u8; 32]`. + /// + /// + /// # Implementing `SeedableRng` for RNGs with large seeds + /// + /// Note that the required traits `core::default::Default` and + /// `core::convert::AsMut` are not implemented for large arrays + /// `[u8; N]` with `N` > 32. To be able to implement the traits required by + /// `SeedableRng` for RNGs with such large seeds, the newtype pattern can be + /// used: + /// + /// ``` + /// use rand_core::SeedableRng; + /// + /// const N: usize = 64; + /// pub struct MyRngSeed(pub [u8; N]); + /// pub struct MyRng(MyRngSeed); + /// + /// impl Default for MyRngSeed { + /// fn default() -> MyRngSeed { + /// MyRngSeed([0; N]) + /// } + /// } + /// + /// impl AsMut<[u8]> for MyRngSeed { + /// fn as_mut(&mut self) -> &mut [u8] { + /// &mut self.0 + /// } + /// } + /// + /// impl SeedableRng for MyRng { + /// type Seed = MyRngSeed; + /// + /// fn from_seed(seed: MyRngSeed) -> MyRng { + /// MyRng(seed) + /// } + /// } + /// ``` + type Seed: Sized + Default + AsMut<[u8]>; + + /// Create a new PRNG using the given seed. + /// + /// PRNG implementations are allowed to assume that bits in the seed are + /// well distributed. That means usually that the number of one and zero + /// bits are about equal, and values like 0, 1 and (size - 1) are unlikely. + /// + /// PRNG implementations are recommended to be reproducible. A PRNG seeded + /// using this function with a fixed seed should produce the same sequence + /// of output in the future and on different architectures (with for example + /// different endianness). + /// + /// It is however not required that this function yield the same state as a + /// reference implementation of the PRNG given equivalent seed; if necessary + /// another constructor replicating behaviour from a reference + /// implementation can be added. + /// + /// PRNG implementations should make sure `from_seed` never panics. In the + /// case that some special values (like an all zero seed) are not viable + /// seeds it is preferable to map these to alternative constant value(s), + /// for example `0xBAD5EEDu32` or `0x0DDB1A5E5BAD5EEDu64` ("odd biases? bad + /// seed"). This is assuming only a small number of values must be rejected. + fn from_seed(seed: Self::Seed) -> Self; + + /// Create a new PRNG using a `u64` seed. + /// + /// This is a convenience-wrapper around `from_seed` to allow construction + /// of any `SeedableRng` from a simple `u64` value. It is designed such that + /// low Hamming Weight numbers like 0 and 1 can be used and should still + /// result in good, independent seeds to the PRNG which is returned. + /// + /// This **is not suitable for cryptography**, as should be clear given that + /// the input size is only 64 bits. + /// + /// Implementations for PRNGs *may* provide their own implementations of + /// this function, but the default implementation should be good enough for + /// all purposes. *Changing* the implementation of this function should be + /// considered a value-breaking change. + fn seed_from_u64(mut state: u64) -> Self { + // We use PCG32 to generate a u32 sequence, and copy to the seed + const MUL: u64 = 6364136223846793005; + const INC: u64 = 11634580027462260723; + + let mut seed = Self::Seed::default(); + for chunk in seed.as_mut().chunks_mut(4) { + // We advance the state first (to get away from the input value, + // in case it has low Hamming Weight). + state = state.wrapping_mul(MUL).wrapping_add(INC); + + // Use PCG output function with to_le to generate x: + let xorshifted = (((state >> 18) ^ state) >> 27) as u32; + let rot = (state >> 59) as u32; + let x = xorshifted.rotate_right(rot).to_le(); + + unsafe { + let p = &x as *const u32 as *const u8; + copy_nonoverlapping(p, chunk.as_mut_ptr(), chunk.len()); + } + } + + Self::from_seed(seed) + } + + /// Create a new PRNG seeded from another `Rng`. + /// + /// This is the recommended way to initialize PRNGs with fresh entropy. The + /// `FromEntropy` trait from the [`rand`] crate provides a convenient + /// `from_entropy` method based on `from_rng`. + /// + /// Usage of this method is not recommended when reproducibility is required + /// since implementing PRNGs are not required to fix Endianness and are + /// allowed to modify implementations in new releases. + /// + /// It is important to use a good source of randomness to initialize the + /// PRNG. Cryptographic PRNG may be rendered insecure when seeded from a + /// non-cryptographic PRNG or with insufficient entropy. + /// Many non-cryptographic PRNGs will show statistical bias in their first + /// results if their seed numbers are small or if there is a simple pattern + /// between them. + /// + /// Prefer to seed from a strong external entropy source like `OsRng` from + /// the [`rand_os`] crate or from a cryptographic PRNG; if creating a new + /// generator for cryptographic uses you *must* seed from a strong source. + /// + /// Seeding a small PRNG from another small PRNG is possible, but + /// something to be careful with. An extreme example of how this can go + /// wrong is seeding an Xorshift RNG from another Xorshift RNG, which + /// will effectively clone the generator. In general seeding from a + /// generator which is hard to predict is probably okay. + /// + /// PRNG implementations are allowed to assume that a good RNG is provided + /// for seeding, and that it is cryptographically secure when appropriate. + /// + /// [`rand`]: https://docs.rs/rand + /// [`rand_os`]: https://docs.rs/rand_os + fn from_rng(mut rng: R) -> Result { + let mut seed = Self::Seed::default(); + rng.try_fill_bytes(seed.as_mut())?; + Ok(Self::from_seed(seed)) + } +} + +// Implement `RngCore` for references to an `RngCore`. +// Force inlining all functions, so that it is up to the `RngCore` +// implementation and the optimizer to decide on inlining. +impl<'a, R: RngCore + ?Sized> RngCore for &'a mut R { + #[inline(always)] + fn next_u32(&mut self) -> u32 { + (**self).next_u32() + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + (**self).next_u64() + } + + #[inline(always)] + fn fill_bytes(&mut self, dest: &mut [u8]) { + (**self).fill_bytes(dest) + } + + #[inline(always)] + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + (**self).try_fill_bytes(dest) + } +} + +// Implement `RngCore` for boxed references to an `RngCore`. +// Force inlining all functions, so that it is up to the `RngCore` +// implementation and the optimizer to decide on inlining. +#[cfg(feature="alloc")] +impl RngCore for Box { + #[inline(always)] + fn next_u32(&mut self) -> u32 { + (**self).next_u32() + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + (**self).next_u64() + } + + #[inline(always)] + fn fill_bytes(&mut self, dest: &mut [u8]) { + (**self).fill_bytes(dest) + } + + #[inline(always)] + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + (**self).try_fill_bytes(dest) + } +} + +#[cfg(feature="std")] +impl std::io::Read for RngCore { + fn read(&mut self, buf: &mut [u8]) -> Result { + self.try_fill_bytes(buf)?; + Ok(buf.len()) + } +} + +// Implement `CryptoRng` for references to an `CryptoRng`. +impl<'a, R: CryptoRng + ?Sized> CryptoRng for &'a mut R {} + +// Implement `CryptoRng` for boxed references to an `CryptoRng`. +#[cfg(feature="alloc")] +impl CryptoRng for Box {} + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_seed_from_u64() { + struct SeedableNum(u64); + impl SeedableRng for SeedableNum { + type Seed = [u8; 8]; + fn from_seed(seed: Self::Seed) -> Self { + let mut x = [0u64; 1]; + le::read_u64_into(&seed, &mut x); + SeedableNum(x[0]) + } + } + + const N: usize = 8; + const SEEDS: [u64; N] = [0u64, 1, 2, 3, 4, 8, 16, -1i64 as u64]; + let mut results = [0u64; N]; + for (i, seed) in SEEDS.iter().enumerate() { + let SeedableNum(x) = SeedableNum::seed_from_u64(*seed); + results[i] = x; + } + + for (i1, r1) in results.iter().enumerate() { + let weight = r1.count_ones(); + // This is the binomial distribution B(64, 0.5), so chance of + // weight < 20 is binocdf(19, 64, 0.5) = 7.8e-4, and same for + // weight > 44. + assert!(weight >= 20 && weight <= 44); + + for (i2, r2) in results.iter().enumerate() { + if i1 == i2 { continue; } + let diff_weight = (r1 ^ r2).count_ones(); + assert!(diff_weight >= 20); + } + } + + // value-breakage test: + assert_eq!(results[0], 5029875928683246316); + } +} diff -Nru cargo-0.35.0/vendor/rand_hc/.cargo-checksum.json cargo-0.37.0/vendor/rand_hc/.cargo-checksum.json --- cargo-0.35.0/vendor/rand_hc/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_hc/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"} \ No newline at end of file +{"files":{},"package":"ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/rand_hc/Cargo.toml cargo-0.37.0/vendor/rand_hc/Cargo.toml --- cargo-0.35.0/vendor/rand_hc/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_hc/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -11,20 +11,20 @@ # will likely look very different (and much more reasonable) [package] +edition = "2018" name = "rand_hc" -version = "0.1.0" +version = "0.2.0" authors = ["The Rand Project Developers"] description = "HC128 random number generator\n" homepage = "https://crates.io/crates/rand_hc" -documentation = "https://docs.rs/rand_hc" +documentation = "https://rust-random.github.io/rand/rand_hc/" readme = "README.md" keywords = ["random", "rng", "hc128"] categories = ["algorithms", "no-std"] license = "MIT/Apache-2.0" repository = "https://github.com/rust-random/rand" [dependencies.rand_core] -version = ">=0.2, <0.4" -default-features = false +version = "0.5" [badges.appveyor] repository = "rust-random/rand" diff -Nru cargo-0.35.0/vendor/rand_hc/CHANGELOG.md cargo-0.37.0/vendor/rand_hc/CHANGELOG.md --- cargo-0.35.0/vendor/rand_hc/CHANGELOG.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_hc/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -4,5 +4,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.0] - 2019-06-12 +- Bump minor crate version since rand_core bump is a breaking change +- Switch to Edition 2018 + +## [0.1.1] - 2019-06-06 - yanked +- Bump `rand_core` version +- Adjust usage of `#[inline]` + ## [0.1.0] - 2018-10-17 - Pulled out of the Rand crate diff -Nru cargo-0.35.0/vendor/rand_hc/README.md cargo-0.37.0/vendor/rand_hc/README.md --- cargo-0.35.0/vendor/rand_hc/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_hc/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -3,9 +3,10 @@ [![Build Status](https://travis-ci.org/rust-random/rand.svg)](https://travis-ci.org/rust-random/rand) [![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-random/rand?svg=true)](https://ci.appveyor.com/project/rust-random/rand) [![Latest version](https://img.shields.io/crates/v/rand_hc.svg)](https://crates.io/crates/rand_hc) -[![Documentation](https://docs.rs/rand_hc/badge.svg)](https://docs.rs/rand_hc) -[![Minimum rustc version](https://img.shields.io/badge/rustc-1.22+-yellow.svg)](https://github.com/rust-random/rand#rust-version-requirements) -[![License](https://img.shields.io/crates/l/rand_hc.svg)](https://github.com/rust-random/rand/tree/master/rand_hc#license) +[[![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) +[![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_hc) +[![API](https://docs.rs/rand_hc/badge.svg)](https://docs.rs/rand_hc) +[![Minimum rustc version](https://img.shields.io/badge/rustc-1.32+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements) A cryptographically secure random number generator that uses the HC-128 algorithm. @@ -14,11 +15,11 @@ RNG. It is selected as one of the "stream ciphers suitable for widespread adoption" by eSTREAM[^2]. -Documentation: -[master branch](https://rust-random.github.io/rand/rand_hc/index.html), -[by release](https://docs.rs/rand_hc) +Links: -[Changelog](CHANGELOG.md) +- [API documentation (master)](https://rust-random.github.io/rand/rand_hc) +- [API documentation (docs.rs)](https://docs.rs/rand_hc) +- [Changelog](https://github.com/rust-random/rand/blob/master/rand_hc/CHANGELOG.md) [rand]: https://crates.io/crates/rand [^1]: Hongjun Wu (2008). ["The Stream Cipher HC-128"]( diff -Nru cargo-0.35.0/vendor/rand_hc/src/hc128.rs cargo-0.37.0/vendor/rand_hc/src/hc128.rs --- cargo-0.35.0/vendor/rand_hc/src/hc128.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_hc/src/hc128.rs 2019-07-17 05:42:23.000000000 +0000 @@ -63,27 +63,26 @@ /// /// [^5]: Internet Engineering Task Force (February 2015), /// ["Prohibiting RC4 Cipher Suites"](https://tools.ietf.org/html/rfc7465). -/// -/// [`BlockRng`]: ../rand_core/block/struct.BlockRng.html -/// [`RngCore`]: ../rand_core/trait.RngCore.html #[derive(Clone, Debug)] pub struct Hc128Rng(BlockRng); impl RngCore for Hc128Rng { - #[inline(always)] + #[inline] fn next_u32(&mut self) -> u32 { self.0.next_u32() } - #[inline(always)] + #[inline] fn next_u64(&mut self) -> u64 { self.0.next_u64() } + #[inline] fn fill_bytes(&mut self, dest: &mut [u8]) { self.0.fill_bytes(dest) } + #[inline] fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { self.0.try_fill_bytes(dest) } @@ -92,10 +91,12 @@ impl SeedableRng for Hc128Rng { type Seed = ::Seed; + #[inline] fn from_seed(seed: Self::Seed) -> Self { Hc128Rng(BlockRng::::from_seed(seed)) } + #[inline] fn from_rng(rng: R) -> Result { BlockRng::::from_rng(rng).map(Hc128Rng) } @@ -271,6 +272,7 @@ // Initialize an HC-128 random number generator. The seed has to be // 256 bits in length (`[u32; 8]`), matching the 128 bit `key` followed by // 128 bit `iv` when HC-128 where to be used as a stream cipher. + #[inline(always)] // single use: SeedableRng::from_seed fn init(seed: [u32; SEED_WORDS]) -> Self { #[inline] fn f1(x: u32) -> u32 { diff -Nru cargo-0.35.0/vendor/rand_hc/src/lib.rs cargo-0.37.0/vendor/rand_hc/src/lib.rs --- cargo-0.35.0/vendor/rand_hc/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rand_hc/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -10,7 +10,7 @@ #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png", html_favicon_url = "https://www.rust-lang.org/favicon.ico", - html_root_url = "https://docs.rs/rand_hc/0.1.0")] + html_root_url = "https://rust-random.github.io/rand/")] #![deny(missing_docs)] #![deny(missing_debug_implementations)] @@ -18,8 +18,6 @@ #![no_std] -extern crate rand_core; - mod hc128; pub use hc128::{Hc128Rng, Hc128Core}; diff -Nru cargo-0.35.0/vendor/rand_hc-0.1.0/.cargo-checksum.json cargo-0.37.0/vendor/rand_hc-0.1.0/.cargo-checksum.json --- cargo-0.35.0/vendor/rand_hc-0.1.0/.cargo-checksum.json 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_hc-0.1.0/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +{"files":{},"package":"7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/rand_hc-0.1.0/Cargo.toml cargo-0.37.0/vendor/rand_hc-0.1.0/Cargo.toml --- cargo-0.35.0/vendor/rand_hc-0.1.0/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_hc-0.1.0/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,32 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# 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 = "rand_hc" +version = "0.1.0" +authors = ["The Rand Project Developers"] +description = "HC128 random number generator\n" +homepage = "https://crates.io/crates/rand_hc" +documentation = "https://docs.rs/rand_hc" +readme = "README.md" +keywords = ["random", "rng", "hc128"] +categories = ["algorithms", "no-std"] +license = "MIT/Apache-2.0" +repository = "https://github.com/rust-random/rand" +[dependencies.rand_core] +version = ">=0.2, <0.4" +default-features = false +[badges.appveyor] +repository = "rust-random/rand" + +[badges.travis-ci] +repository = "rust-random/rand" diff -Nru cargo-0.35.0/vendor/rand_hc-0.1.0/CHANGELOG.md cargo-0.37.0/vendor/rand_hc-0.1.0/CHANGELOG.md --- cargo-0.35.0/vendor/rand_hc-0.1.0/CHANGELOG.md 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_hc-0.1.0/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,8 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.1.0] - 2018-10-17 +- Pulled out of the Rand crate diff -Nru cargo-0.35.0/vendor/rand_hc-0.1.0/COPYRIGHT cargo-0.37.0/vendor/rand_hc-0.1.0/COPYRIGHT --- cargo-0.35.0/vendor/rand_hc-0.1.0/COPYRIGHT 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_hc-0.1.0/COPYRIGHT 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,12 @@ +Copyrights in the Rand project are retained by their contributors. No +copyright assignment is required to contribute to the Rand project. + +For full authorship information, see the version control history. + +Except as otherwise noted (below and/or in individual files), Rand is +licensed under the Apache License, Version 2.0 or + or the MIT license + or , at your option. + +The Rand project includes code from the Rust project +published under these same licenses. diff -Nru cargo-0.35.0/vendor/rand_hc-0.1.0/LICENSE-APACHE cargo-0.37.0/vendor/rand_hc-0.1.0/LICENSE-APACHE --- cargo-0.35.0/vendor/rand_hc-0.1.0/LICENSE-APACHE 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_hc-0.1.0/LICENSE-APACHE 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor 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, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff -Nru cargo-0.35.0/vendor/rand_hc-0.1.0/LICENSE-MIT cargo-0.37.0/vendor/rand_hc-0.1.0/LICENSE-MIT --- cargo-0.35.0/vendor/rand_hc-0.1.0/LICENSE-MIT 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_hc-0.1.0/LICENSE-MIT 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,25 @@ +Copyright 2018 Developers of the Rand project + +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 +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff -Nru cargo-0.35.0/vendor/rand_hc-0.1.0/README.md cargo-0.37.0/vendor/rand_hc-0.1.0/README.md --- cargo-0.35.0/vendor/rand_hc-0.1.0/README.md 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_hc-0.1.0/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,44 @@ +# rand_hc + +[![Build Status](https://travis-ci.org/rust-random/rand.svg)](https://travis-ci.org/rust-random/rand) +[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-random/rand?svg=true)](https://ci.appveyor.com/project/rust-random/rand) +[![Latest version](https://img.shields.io/crates/v/rand_hc.svg)](https://crates.io/crates/rand_hc) +[![Documentation](https://docs.rs/rand_hc/badge.svg)](https://docs.rs/rand_hc) +[![Minimum rustc version](https://img.shields.io/badge/rustc-1.22+-yellow.svg)](https://github.com/rust-random/rand#rust-version-requirements) +[![License](https://img.shields.io/crates/l/rand_hc.svg)](https://github.com/rust-random/rand/tree/master/rand_hc#license) + +A cryptographically secure random number generator that uses the HC-128 +algorithm. + +HC-128 is a stream cipher designed by Hongjun Wu[^1], that we use as an +RNG. It is selected as one of the "stream ciphers suitable for widespread +adoption" by eSTREAM[^2]. + +Documentation: +[master branch](https://rust-random.github.io/rand/rand_hc/index.html), +[by release](https://docs.rs/rand_hc) + +[Changelog](CHANGELOG.md) + +[rand]: https://crates.io/crates/rand +[^1]: Hongjun Wu (2008). ["The Stream Cipher HC-128"]( + http://www.ecrypt.eu.org/stream/p3ciphers/hc/hc128_p3.pdf). + *The eSTREAM Finalists*, LNCS 4986, pp. 39–47, Springer-Verlag. + +[^2]: [eSTREAM: the ECRYPT Stream Cipher Project]( + http://www.ecrypt.eu.org/stream/) + + +## Crate Features + +`rand_hc` is `no_std` compatible. It does not require any functionality +outside of the `core` lib, thus there are no features to configure. + + +# License + +`rand_hc` is distributed under the terms of both the MIT license and the +Apache License (Version 2.0). + +See [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT), and +[COPYRIGHT](COPYRIGHT) for details. diff -Nru cargo-0.35.0/vendor/rand_hc-0.1.0/src/hc128.rs cargo-0.37.0/vendor/rand_hc-0.1.0/src/hc128.rs --- cargo-0.35.0/vendor/rand_hc-0.1.0/src/hc128.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_hc-0.1.0/src/hc128.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,462 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The HC-128 random number generator. + +use core::fmt; +use rand_core::{CryptoRng, RngCore, SeedableRng, Error, le}; +use rand_core::block::{BlockRngCore, BlockRng}; + +const SEED_WORDS: usize = 8; // 128 bit key followed by 128 bit iv + +/// A cryptographically secure random number generator that uses the HC-128 +/// algorithm. +/// +/// HC-128 is a stream cipher designed by Hongjun Wu[^1], that we use as an +/// RNG. It is selected as one of the "stream ciphers suitable for widespread +/// adoption" by eSTREAM[^2]. +/// +/// HC-128 is an array based RNG. In this it is similar to RC-4 and ISAAC before +/// it, but those have never been proven cryptographically secure (or have even +/// been significantly compromised, as in the case of RC-4[^5]). +/// +/// Because HC-128 works with simple indexing into a large array and with a few +/// operations that parallelize well, it has very good performance. The size of +/// the array it needs, 4kb, can however be a disadvantage. +/// +/// This implementation is not based on the version of HC-128 submitted to the +/// eSTREAM contest, but on a later version by the author with a few small +/// improvements from December 15, 2009[^3]. +/// +/// HC-128 has no known weaknesses that are easier to exploit than doing a +/// brute-force search of 2128. A very comprehensive analysis of the +/// current state of known attacks / weaknesses of HC-128 is given in *Some +/// Results On Analysis And Implementation Of HC-128 Stream Cipher*[^4]. +/// +/// The average cycle length is expected to be +/// 21024*32+10-1 = 232777. +/// We support seeding with a 256-bit array, which matches the 128-bit key +/// concatenated with a 128-bit IV from the stream cipher. +/// +/// This implementation uses an output buffer of sixteen `u32` words, and uses +/// [`BlockRng`] to implement the [`RngCore`] methods. +/// +/// ## References +/// [^1]: Hongjun Wu (2008). ["The Stream Cipher HC-128"]( +/// http://www.ecrypt.eu.org/stream/p3ciphers/hc/hc128_p3.pdf). +/// *The eSTREAM Finalists*, LNCS 4986, pp. 39–47, Springer-Verlag. +/// +/// [^2]: [eSTREAM: the ECRYPT Stream Cipher Project]( +/// http://www.ecrypt.eu.org/stream/) +/// +/// [^3]: Hongjun Wu, [Stream Ciphers HC-128 and HC-256]( +/// https://www.ntu.edu.sg/home/wuhj/research/hc/index.html) +/// +/// [^4]: Shashwat Raizada (January 2015),["Some Results On Analysis And +/// Implementation Of HC-128 Stream Cipher"]( +/// http://library.isical.ac.in:8080/jspui/bitstream/123456789/6636/1/TH431.pdf). +/// +/// [^5]: Internet Engineering Task Force (February 2015), +/// ["Prohibiting RC4 Cipher Suites"](https://tools.ietf.org/html/rfc7465). +/// +/// [`BlockRng`]: ../rand_core/block/struct.BlockRng.html +/// [`RngCore`]: ../rand_core/trait.RngCore.html +#[derive(Clone, Debug)] +pub struct Hc128Rng(BlockRng); + +impl RngCore for Hc128Rng { + #[inline(always)] + fn next_u32(&mut self) -> u32 { + self.0.next_u32() + } + + #[inline(always)] + fn next_u64(&mut self) -> u64 { + self.0.next_u64() + } + + fn fill_bytes(&mut self, dest: &mut [u8]) { + self.0.fill_bytes(dest) + } + + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { + self.0.try_fill_bytes(dest) + } +} + +impl SeedableRng for Hc128Rng { + type Seed = ::Seed; + + fn from_seed(seed: Self::Seed) -> Self { + Hc128Rng(BlockRng::::from_seed(seed)) + } + + fn from_rng(rng: R) -> Result { + BlockRng::::from_rng(rng).map(Hc128Rng) + } +} + +impl CryptoRng for Hc128Rng {} + +/// The core of `Hc128Rng`, used with `BlockRng`. +#[derive(Clone)] +pub struct Hc128Core { + t: [u32; 1024], + counter1024: usize, +} + +// Custom Debug implementation that does not expose the internal state +impl fmt::Debug for Hc128Core { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "Hc128Core {{}}") + } +} + +impl BlockRngCore for Hc128Core { + type Item = u32; + type Results = [u32; 16]; + + fn generate(&mut self, results: &mut Self::Results) { + assert!(self.counter1024 % 16 == 0); + + let cc = self.counter1024 % 512; + let dd = (cc + 16) % 512; + let ee = cc.wrapping_sub(16) % 512; + + if self.counter1024 & 512 == 0 { + // P block + results[0] = self.step_p(cc+0, cc+1, ee+13, ee+6, ee+4); + results[1] = self.step_p(cc+1, cc+2, ee+14, ee+7, ee+5); + results[2] = self.step_p(cc+2, cc+3, ee+15, ee+8, ee+6); + results[3] = self.step_p(cc+3, cc+4, cc+0, ee+9, ee+7); + results[4] = self.step_p(cc+4, cc+5, cc+1, ee+10, ee+8); + results[5] = self.step_p(cc+5, cc+6, cc+2, ee+11, ee+9); + results[6] = self.step_p(cc+6, cc+7, cc+3, ee+12, ee+10); + results[7] = self.step_p(cc+7, cc+8, cc+4, ee+13, ee+11); + results[8] = self.step_p(cc+8, cc+9, cc+5, ee+14, ee+12); + results[9] = self.step_p(cc+9, cc+10, cc+6, ee+15, ee+13); + results[10] = self.step_p(cc+10, cc+11, cc+7, cc+0, ee+14); + results[11] = self.step_p(cc+11, cc+12, cc+8, cc+1, ee+15); + results[12] = self.step_p(cc+12, cc+13, cc+9, cc+2, cc+0); + results[13] = self.step_p(cc+13, cc+14, cc+10, cc+3, cc+1); + results[14] = self.step_p(cc+14, cc+15, cc+11, cc+4, cc+2); + results[15] = self.step_p(cc+15, dd+0, cc+12, cc+5, cc+3); + } else { + // Q block + results[0] = self.step_q(cc+0, cc+1, ee+13, ee+6, ee+4); + results[1] = self.step_q(cc+1, cc+2, ee+14, ee+7, ee+5); + results[2] = self.step_q(cc+2, cc+3, ee+15, ee+8, ee+6); + results[3] = self.step_q(cc+3, cc+4, cc+0, ee+9, ee+7); + results[4] = self.step_q(cc+4, cc+5, cc+1, ee+10, ee+8); + results[5] = self.step_q(cc+5, cc+6, cc+2, ee+11, ee+9); + results[6] = self.step_q(cc+6, cc+7, cc+3, ee+12, ee+10); + results[7] = self.step_q(cc+7, cc+8, cc+4, ee+13, ee+11); + results[8] = self.step_q(cc+8, cc+9, cc+5, ee+14, ee+12); + results[9] = self.step_q(cc+9, cc+10, cc+6, ee+15, ee+13); + results[10] = self.step_q(cc+10, cc+11, cc+7, cc+0, ee+14); + results[11] = self.step_q(cc+11, cc+12, cc+8, cc+1, ee+15); + results[12] = self.step_q(cc+12, cc+13, cc+9, cc+2, cc+0); + results[13] = self.step_q(cc+13, cc+14, cc+10, cc+3, cc+1); + results[14] = self.step_q(cc+14, cc+15, cc+11, cc+4, cc+2); + results[15] = self.step_q(cc+15, dd+0, cc+12, cc+5, cc+3); + } + self.counter1024 = self.counter1024.wrapping_add(16); + } +} + +impl Hc128Core { + // One step of HC-128, update P and generate 32 bits keystream + #[inline(always)] + fn step_p(&mut self, i: usize, i511: usize, i3: usize, i10: usize, i12: usize) + -> u32 + { + let (p, q) = self.t.split_at_mut(512); + // FIXME: it would be great if we the bounds checks here could be + // optimized out, and we would not need unsafe. + // This improves performance by about 7%. + unsafe { + let temp0 = p.get_unchecked(i511).rotate_right(23); + let temp1 = p.get_unchecked(i3).rotate_right(10); + let temp2 = p.get_unchecked(i10).rotate_right(8); + *p.get_unchecked_mut(i) = p.get_unchecked(i) + .wrapping_add(temp2) + .wrapping_add(temp0 ^ temp1); + let temp3 = { + // The h1 function in HC-128 + let a = *p.get_unchecked(i12) as u8; + let c = (p.get_unchecked(i12) >> 16) as u8; + q[a as usize].wrapping_add(q[256 + c as usize]) + }; + temp3 ^ p.get_unchecked(i) + } + } + + // One step of HC-128, update Q and generate 32 bits keystream + // Similar to `step_p`, but `p` and `q` are swapped, and the rotates are to + // the left instead of to the right. + #[inline(always)] + fn step_q(&mut self, i: usize, i511: usize, i3: usize, i10: usize, i12: usize) + -> u32 + { + let (p, q) = self.t.split_at_mut(512); + unsafe { + let temp0 = q.get_unchecked(i511).rotate_left(23); + let temp1 = q.get_unchecked(i3).rotate_left(10); + let temp2 = q.get_unchecked(i10).rotate_left(8); + *q.get_unchecked_mut(i) = q.get_unchecked(i) + .wrapping_add(temp2) + .wrapping_add(temp0 ^ temp1); + let temp3 = { + // The h2 function in HC-128 + let a = *q.get_unchecked(i12) as u8; + let c = (q.get_unchecked(i12) >> 16) as u8; + p[a as usize].wrapping_add(p[256 + c as usize]) + }; + temp3 ^ q.get_unchecked(i) + } + } + + fn sixteen_steps(&mut self) { + assert!(self.counter1024 % 16 == 0); + + let cc = self.counter1024 % 512; + let dd = (cc + 16) % 512; + let ee = cc.wrapping_sub(16) % 512; + + if self.counter1024 < 512 { + // P block + self.t[cc+0] = self.step_p(cc+0, cc+1, ee+13, ee+6, ee+4); + self.t[cc+1] = self.step_p(cc+1, cc+2, ee+14, ee+7, ee+5); + self.t[cc+2] = self.step_p(cc+2, cc+3, ee+15, ee+8, ee+6); + self.t[cc+3] = self.step_p(cc+3, cc+4, cc+0, ee+9, ee+7); + self.t[cc+4] = self.step_p(cc+4, cc+5, cc+1, ee+10, ee+8); + self.t[cc+5] = self.step_p(cc+5, cc+6, cc+2, ee+11, ee+9); + self.t[cc+6] = self.step_p(cc+6, cc+7, cc+3, ee+12, ee+10); + self.t[cc+7] = self.step_p(cc+7, cc+8, cc+4, ee+13, ee+11); + self.t[cc+8] = self.step_p(cc+8, cc+9, cc+5, ee+14, ee+12); + self.t[cc+9] = self.step_p(cc+9, cc+10, cc+6, ee+15, ee+13); + self.t[cc+10] = self.step_p(cc+10, cc+11, cc+7, cc+0, ee+14); + self.t[cc+11] = self.step_p(cc+11, cc+12, cc+8, cc+1, ee+15); + self.t[cc+12] = self.step_p(cc+12, cc+13, cc+9, cc+2, cc+0); + self.t[cc+13] = self.step_p(cc+13, cc+14, cc+10, cc+3, cc+1); + self.t[cc+14] = self.step_p(cc+14, cc+15, cc+11, cc+4, cc+2); + self.t[cc+15] = self.step_p(cc+15, dd+0, cc+12, cc+5, cc+3); + } else { + // Q block + self.t[cc+512+0] = self.step_q(cc+0, cc+1, ee+13, ee+6, ee+4); + self.t[cc+512+1] = self.step_q(cc+1, cc+2, ee+14, ee+7, ee+5); + self.t[cc+512+2] = self.step_q(cc+2, cc+3, ee+15, ee+8, ee+6); + self.t[cc+512+3] = self.step_q(cc+3, cc+4, cc+0, ee+9, ee+7); + self.t[cc+512+4] = self.step_q(cc+4, cc+5, cc+1, ee+10, ee+8); + self.t[cc+512+5] = self.step_q(cc+5, cc+6, cc+2, ee+11, ee+9); + self.t[cc+512+6] = self.step_q(cc+6, cc+7, cc+3, ee+12, ee+10); + self.t[cc+512+7] = self.step_q(cc+7, cc+8, cc+4, ee+13, ee+11); + self.t[cc+512+8] = self.step_q(cc+8, cc+9, cc+5, ee+14, ee+12); + self.t[cc+512+9] = self.step_q(cc+9, cc+10, cc+6, ee+15, ee+13); + self.t[cc+512+10] = self.step_q(cc+10, cc+11, cc+7, cc+0, ee+14); + self.t[cc+512+11] = self.step_q(cc+11, cc+12, cc+8, cc+1, ee+15); + self.t[cc+512+12] = self.step_q(cc+12, cc+13, cc+9, cc+2, cc+0); + self.t[cc+512+13] = self.step_q(cc+13, cc+14, cc+10, cc+3, cc+1); + self.t[cc+512+14] = self.step_q(cc+14, cc+15, cc+11, cc+4, cc+2); + self.t[cc+512+15] = self.step_q(cc+15, dd+0, cc+12, cc+5, cc+3); + } + self.counter1024 += 16; + } + + // Initialize an HC-128 random number generator. The seed has to be + // 256 bits in length (`[u32; 8]`), matching the 128 bit `key` followed by + // 128 bit `iv` when HC-128 where to be used as a stream cipher. + fn init(seed: [u32; SEED_WORDS]) -> Self { + #[inline] + fn f1(x: u32) -> u32 { + x.rotate_right(7) ^ x.rotate_right(18) ^ (x >> 3) + } + + #[inline] + fn f2(x: u32) -> u32 { + x.rotate_right(17) ^ x.rotate_right(19) ^ (x >> 10) + } + + let mut t = [0u32; 1024]; + + // Expand the key and iv into P and Q + let (key, iv) = seed.split_at(4); + t[..4].copy_from_slice(key); + t[4..8].copy_from_slice(key); + t[8..12].copy_from_slice(iv); + t[12..16].copy_from_slice(iv); + + // Generate the 256 intermediate values W[16] ... W[256+16-1], and + // copy the last 16 generated values to the start op P. + for i in 16..256+16 { + t[i] = f2(t[i-2]).wrapping_add(t[i-7]).wrapping_add(f1(t[i-15])) + .wrapping_add(t[i-16]).wrapping_add(i as u32); + } + { + let (p1, p2) = t.split_at_mut(256); + p1[0..16].copy_from_slice(&p2[0..16]); + } + + // Generate both the P and Q tables + for i in 16..1024 { + t[i] = f2(t[i-2]).wrapping_add(t[i-7]).wrapping_add(f1(t[i-15])) + .wrapping_add(t[i-16]).wrapping_add(256 + i as u32); + } + + let mut core = Self { t, counter1024: 0 }; + + // run the cipher 1024 steps + for _ in 0..64 { core.sixteen_steps() }; + core.counter1024 = 0; + core + } +} + +impl SeedableRng for Hc128Core { + type Seed = [u8; SEED_WORDS*4]; + + /// Create an HC-128 random number generator with a seed. The seed has to be + /// 256 bits in length, matching the 128 bit `key` followed by 128 bit `iv` + /// when HC-128 where to be used as a stream cipher. + fn from_seed(seed: Self::Seed) -> Self { + let mut seed_u32 = [0u32; SEED_WORDS]; + le::read_u32_into(&seed, &mut seed_u32); + Self::init(seed_u32) + } +} + +impl CryptoRng for Hc128Core {} + +#[cfg(test)] +mod test { + use ::rand_core::{RngCore, SeedableRng}; + use super::Hc128Rng; + + #[test] + // Test vector 1 from the paper "The Stream Cipher HC-128" + fn test_hc128_true_values_a() { + let seed = [0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // key + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; // iv + let mut rng = Hc128Rng::from_seed(seed); + + let mut results = [0u32; 16]; + for i in results.iter_mut() { *i = rng.next_u32(); } + let expected = [0x73150082, 0x3bfd03a0, 0xfb2fd77f, 0xaa63af0e, + 0xde122fc6, 0xa7dc29b6, 0x62a68527, 0x8b75ec68, + 0x9036db1e, 0x81896005, 0x00ade078, 0x491fbf9a, + 0x1cdc3013, 0x6c3d6e24, 0x90f664b2, 0x9cd57102]; + assert_eq!(results, expected); + } + + #[test] + // Test vector 2 from the paper "The Stream Cipher HC-128" + fn test_hc128_true_values_b() { + let seed = [0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // key + 1,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; // iv + let mut rng = Hc128Rng::from_seed(seed); + + let mut results = [0u32; 16]; + for i in results.iter_mut() { *i = rng.next_u32(); } + let expected = [0xc01893d5, 0xb7dbe958, 0x8f65ec98, 0x64176604, + 0x36fc6724, 0xc82c6eec, 0x1b1c38a7, 0xc9b42a95, + 0x323ef123, 0x0a6a908b, 0xce757b68, 0x9f14f7bb, + 0xe4cde011, 0xaeb5173f, 0x89608c94, 0xb5cf46ca]; + assert_eq!(results, expected); + } + + #[test] + // Test vector 3 from the paper "The Stream Cipher HC-128" + fn test_hc128_true_values_c() { + let seed = [0x55,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // key + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; // iv + let mut rng = Hc128Rng::from_seed(seed); + + let mut results = [0u32; 16]; + for i in results.iter_mut() { *i = rng.next_u32(); } + let expected = [0x518251a4, 0x04b4930a, 0xb02af931, 0x0639f032, + 0xbcb4a47a, 0x5722480b, 0x2bf99f72, 0xcdc0e566, + 0x310f0c56, 0xd3cc83e8, 0x663db8ef, 0x62dfe07f, + 0x593e1790, 0xc5ceaa9c, 0xab03806f, 0xc9a6e5a0]; + assert_eq!(results, expected); + } + + #[test] + fn test_hc128_true_values_u64() { + let seed = [0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // key + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; // iv + let mut rng = Hc128Rng::from_seed(seed); + + let mut results = [0u64; 8]; + for i in results.iter_mut() { *i = rng.next_u64(); } + let expected = [0x3bfd03a073150082, 0xaa63af0efb2fd77f, + 0xa7dc29b6de122fc6, 0x8b75ec6862a68527, + 0x818960059036db1e, 0x491fbf9a00ade078, + 0x6c3d6e241cdc3013, 0x9cd5710290f664b2]; + assert_eq!(results, expected); + + // The RNG operates in a P block of 512 results and next a Q block. + // After skipping 2*800 u32 results we end up somewhere in the Q block + // of the second round + for _ in 0..800 { rng.next_u64(); } + + for i in results.iter_mut() { *i = rng.next_u64(); } + let expected = [0xd8c4d6ca84d0fc10, 0xf16a5d91dc66e8e7, + 0xd800de5bc37a8653, 0x7bae1f88c0dfbb4c, + 0x3bfe1f374e6d4d14, 0x424b55676be3fa06, + 0xe3a1e8758cbff579, 0x417f7198c5652bcd]; + assert_eq!(results, expected); + } + + #[test] + fn test_hc128_true_values_bytes() { + let seed = [0x55,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // key + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; // iv + let mut rng = Hc128Rng::from_seed(seed); + let expected = [0x31, 0xf9, 0x2a, 0xb0, 0x32, 0xf0, 0x39, 0x06, + 0x7a, 0xa4, 0xb4, 0xbc, 0x0b, 0x48, 0x22, 0x57, + 0x72, 0x9f, 0xf9, 0x2b, 0x66, 0xe5, 0xc0, 0xcd, + 0x56, 0x0c, 0x0f, 0x31, 0xe8, 0x83, 0xcc, 0xd3, + 0xef, 0xb8, 0x3d, 0x66, 0x7f, 0xe0, 0xdf, 0x62, + 0x90, 0x17, 0x3e, 0x59, 0x9c, 0xaa, 0xce, 0xc5, + 0x6f, 0x80, 0x03, 0xab, 0xa0, 0xe5, 0xa6, 0xc9, + 0x60, 0x95, 0x84, 0x7a, 0xa5, 0x68, 0x5a, 0x84, + 0xea, 0xd5, 0xf3, 0xea, 0x73, 0xa9, 0xad, 0x01, + 0x79, 0x7d, 0xbe, 0x9f, 0xea, 0xe3, 0xf9, 0x74, + 0x0e, 0xda, 0x2f, 0xa0, 0xe4, 0x7b, 0x4b, 0x1b, + 0xdd, 0x17, 0x69, 0x4a, 0xfe, 0x9f, 0x56, 0x95, + 0xad, 0x83, 0x6b, 0x9d, 0x60, 0xa1, 0x99, 0x96, + 0x90, 0x00, 0x66, 0x7f, 0xfa, 0x7e, 0x65, 0xe9, + 0xac, 0x8b, 0x92, 0x34, 0x77, 0xb4, 0x23, 0xd0, + 0xb9, 0xab, 0xb1, 0x47, 0x7d, 0x4a, 0x13, 0x0a]; + + // Pick a somewhat large buffer so we can test filling with the + // remainder from `state.results`, directly filling the buffer, and + // filling the remainder of the buffer. + let mut buffer = [0u8; 16*4*2]; + // Consume a value so that we have a remainder. + assert!(rng.next_u64() == 0x04b4930a518251a4); + rng.fill_bytes(&mut buffer); + + // [u8; 128] doesn't implement PartialEq + assert_eq!(buffer.len(), expected.len()); + for (b, e) in buffer.iter().zip(expected.iter()) { + assert_eq!(b, e); + } + } + + #[test] + fn test_hc128_clone() { + let seed = [0x55,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // key + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; // iv + let mut rng1 = Hc128Rng::from_seed(seed); + let mut rng2 = rng1.clone(); + for _ in 0..16 { + assert_eq!(rng1.next_u32(), rng2.next_u32()); + } + } +} diff -Nru cargo-0.35.0/vendor/rand_hc-0.1.0/src/lib.rs cargo-0.37.0/vendor/rand_hc-0.1.0/src/lib.rs --- cargo-0.35.0/vendor/rand_hc-0.1.0/src/lib.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/rand_hc-0.1.0/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,25 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! The HC128 random number generator. + +#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png", + html_favicon_url = "https://www.rust-lang.org/favicon.ico", + html_root_url = "https://docs.rs/rand_hc/0.1.0")] + +#![deny(missing_docs)] +#![deny(missing_debug_implementations)] +#![doc(test(attr(allow(unused_variables), deny(warnings))))] + +#![no_std] + +extern crate rand_core; + +mod hc128; + +pub use hc128::{Hc128Rng, Hc128Core}; diff -Nru cargo-0.35.0/vendor/redox_syscall/.cargo-checksum.json cargo-0.37.0/vendor/redox_syscall/.cargo-checksum.json --- cargo-0.35.0/vendor/redox_syscall/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/redox_syscall/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252"} \ No newline at end of file +{"files":{},"package":"2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/redox_syscall/Cargo.toml cargo-0.37.0/vendor/redox_syscall/Cargo.toml --- cargo-0.35.0/vendor/redox_syscall/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/redox_syscall/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "redox_syscall" -version = "0.1.54" +version = "0.1.56" authors = ["Jeremy Soller "] description = "A Rust library to access raw Redox system calls" documentation = "https://docs.rs/redox_syscall" diff -Nru cargo-0.35.0/vendor/redox_syscall/src/arch/nonredox.rs cargo-0.37.0/vendor/redox_syscall/src/arch/nonredox.rs --- cargo-0.35.0/vendor/redox_syscall/src/arch/nonredox.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/redox_syscall/src/arch/nonredox.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,31 @@ +use super::error::{Error, Result, ENOSYS}; + +pub unsafe fn syscall0(_a: usize) -> Result { + Err(Error::new(ENOSYS)) +} + +pub unsafe fn syscall1(_a: usize, _b: usize) -> Result { + Err(Error::new(ENOSYS)) +} + +// Clobbers all registers - special for clone +pub unsafe fn syscall1_clobber(_a: usize, _b: usize) -> Result { + Err(Error::new(ENOSYS)) +} + +pub unsafe fn syscall2(_a: usize, _b: usize, _c: usize) -> Result { + Err(Error::new(ENOSYS)) +} + +pub unsafe fn syscall3(_a: usize, _b: usize, _c: usize, _d: usize) -> Result { + Err(Error::new(ENOSYS)) +} + +pub unsafe fn syscall4(_a: usize, _b: usize, _c: usize, _d: usize, _e: usize) -> Result { + Err(Error::new(ENOSYS)) +} + +pub unsafe fn syscall5(_a: usize, _b: usize, _c: usize, _d: usize, _e: usize, _f: usize) + -> Result { + Err(Error::new(ENOSYS)) +} diff -Nru cargo-0.35.0/vendor/redox_syscall/src/call.rs cargo-0.37.0/vendor/redox_syscall/src/call.rs --- cargo-0.35.0/vendor/redox_syscall/src/call.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/redox_syscall/src/call.rs 2019-07-17 05:42:23.000000000 +0000 @@ -43,6 +43,10 @@ unsafe { syscall2(SYS_CHDIR, path.as_ref().as_ptr() as usize, path.as_ref().len()) } } +#[deprecated( + since = "0.1.55", + note = "use fchmod instead" +)] pub fn chmod>(path: T, mode: usize) -> Result { unsafe { syscall3(SYS_CHMOD, path.as_ref().as_ptr() as usize, path.as_ref().len(), mode) } } diff -Nru cargo-0.35.0/vendor/redox_syscall/src/data.rs cargo-0.37.0/vendor/redox_syscall/src/data.rs --- cargo-0.35.0/vendor/redox_syscall/src/data.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/redox_syscall/src/data.rs 2019-07-17 05:42:23.000000000 +0000 @@ -192,7 +192,7 @@ } } -#[derive(Copy, Clone, Debug, Default)] +#[derive(Copy, Clone, Debug, Default, PartialEq)] #[repr(C)] pub struct TimeSpec { pub tv_sec: i64, @@ -217,3 +217,93 @@ } } } + +#[derive(Copy, Clone, Debug, Default)] +#[repr(C)] +#[cfg(target_arch = "x86_64")] +pub struct IntRegisters { + pub r15: usize, + pub r14: usize, + pub r13: usize, + pub r12: usize, + pub rbp: usize, + pub rbx: usize, + pub r11: usize, + pub r10: usize, + pub r9: usize, + pub r8: usize, + pub rax: usize, + pub rcx: usize, + pub rdx: usize, + pub rsi: usize, + pub rdi: usize, + // pub orig_rax: usize, + pub rip: usize, + pub cs: usize, + pub eflags: usize, + pub rsp: usize, + pub ss: usize, + pub fs_base: usize, + pub gs_base: usize, + pub ds: usize, + pub es: usize, + pub fs: usize, + pub gs: usize +} + +impl Deref for IntRegisters { + type Target = [u8]; + fn deref(&self) -> &[u8] { + unsafe { + slice::from_raw_parts(self as *const IntRegisters as *const u8, mem::size_of::()) as &[u8] + } + } +} + +impl DerefMut for IntRegisters { + fn deref_mut(&mut self) -> &mut [u8] { + unsafe { + slice::from_raw_parts_mut(self as *mut IntRegisters as *mut u8, mem::size_of::()) as &mut [u8] + } + } +} + +#[derive(Clone, Copy)] +#[repr(C)] +#[cfg(target_arch = "x86_64")] +pub struct FloatRegisters { + pub cwd: u16, + pub swd: u16, + pub ftw: u16, + pub fop: u16, + pub rip: u64, + pub rdp: u64, + pub mxcsr: u32, + pub mxcr_mask: u32, + pub st_space: [u32; 32], + pub xmm_space: [u32; 64] +} + +impl Default for FloatRegisters { + fn default() -> Self { + // xmm_space is not Default until const generics + unsafe { mem::zeroed() } + } +} + +impl Deref for FloatRegisters { + type Target = [u8]; + fn deref(&self) -> &[u8] { + unsafe { + slice::from_raw_parts(self as *const FloatRegisters as *const u8, mem::size_of::()) as &[u8] + } + } +} + +impl DerefMut for FloatRegisters { + fn deref_mut(&mut self) -> &mut [u8] { + unsafe { + slice::from_raw_parts_mut(self as *mut FloatRegisters as *mut u8, mem::size_of::()) as &mut [u8] + } + } +} diff -Nru cargo-0.35.0/vendor/redox_syscall/src/flag.rs cargo-0.37.0/vendor/redox_syscall/src/flag.rs --- cargo-0.35.0/vendor/redox_syscall/src/flag.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/redox_syscall/src/flag.rs 2019-07-17 05:42:23.000000000 +0000 @@ -65,6 +65,13 @@ pub const PROT_WRITE: usize = 0x0002_0000; pub const PROT_READ: usize = 0x0004_0000; +pub const PTRACE_CONT: u8 = 0b0000_0001; +pub const PTRACE_SINGLESTEP: u8 = 0b0000_0010; +pub const PTRACE_SYSCALL: u8 = 0b0000_0011; +pub const PTRACE_WAIT: u8 = 0b0000_0100; +pub const PTRACE_OPERATIONMASK: u8 = 0b0000_1111; +pub const PTRACE_SYSEMU: u8 = 0b0001_0000; + pub const SEEK_SET: usize = 0; pub const SEEK_CUR: usize = 1; pub const SEEK_END: usize = 2; diff -Nru cargo-0.35.0/vendor/redox_syscall/src/lib.rs cargo-0.37.0/vendor/redox_syscall/src/lib.rs --- cargo-0.35.0/vendor/redox_syscall/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/redox_syscall/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,6 +1,9 @@ #![feature(asm)] #![feature(const_fn)] -#![no_std] +#![cfg_attr(not(test), no_std)] + +#[cfg(test)] +extern crate core; pub use self::arch::*; pub use self::call::*; @@ -11,22 +14,26 @@ pub use self::number::*; pub use self::scheme::*; -#[cfg(target_arch = "arm")] +#[cfg(all(target_os = "redox", target_arch = "arm"))] #[path="arch/arm.rs"] mod arch; -#[cfg(target_arch = "aarch64")] +#[cfg(all(target_os = "redox", target_arch = "aarch64"))] #[path="arch/aarch64.rs"] mod arch; -#[cfg(target_arch = "x86")] +#[cfg(all(target_os = "redox", target_arch = "x86"))] #[path="arch/x86.rs"] mod arch; -#[cfg(target_arch = "x86_64")] +#[cfg(all(target_os = "redox", target_arch = "x86_64"))] #[path="arch/x86_64.rs"] mod arch; +#[cfg(not(target_os = "redox"))] +#[path="arch/nonredox.rs"] +mod arch; + /// Function definitions pub mod call; @@ -47,3 +54,6 @@ /// A trait useful for scheme handlers pub mod scheme; + +#[cfg(test)] +mod tests; diff -Nru cargo-0.35.0/vendor/redox_syscall/src/tests.rs cargo-0.37.0/vendor/redox_syscall/src/tests.rs --- cargo-0.35.0/vendor/redox_syscall/src/tests.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/redox_syscall/src/tests.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,129 @@ +#[test] +fn brk() { + unsafe { + let start = dbg!(crate::brk(0)).unwrap(); + let end = start + 4 * 1024 * 1024; + assert_eq!(dbg!(crate::brk(end)), Ok(end)); + } +} + +#[test] +fn chdir() { + //TODO: Verify CWD + assert_eq!(dbg!(crate::chdir("file:/")), Ok(0)); + assert_eq!(dbg!(crate::chdir("file:/root")), Ok(0)); +} + +//TODO: chmod + +#[test] +fn clone() { + let expected_status = 42; + let pid_res = unsafe { crate::clone(0) }; + if pid_res == Ok(0) { + crate::exit(expected_status).unwrap(); + panic!("failed to exit"); + } else { + let pid = dbg!(pid_res).unwrap(); + let mut status = 0; + assert_eq!(dbg!(crate::waitpid(pid, &mut status, 0)), Ok(pid)); + assert_eq!(dbg!(crate::wifexited(status)), true); + assert_eq!(dbg!(crate::wexitstatus(status)), expected_status); + } +} + +//TODO: close + +#[test] +fn clock_gettime() { + let mut tp = crate::TimeSpec::default(); + assert_eq!(dbg!( + crate::clock_gettime(crate::CLOCK_MONOTONIC, &mut tp) + ), Ok(0)); + assert_ne!(dbg!(tp), crate::TimeSpec::default()); + + tp = crate::TimeSpec::default(); + assert_eq!(dbg!( + crate::clock_gettime(crate::CLOCK_REALTIME, &mut tp) + ), Ok(0)); + assert_ne!(dbg!(tp), crate::TimeSpec::default()); +} + +//TODO: dup + +//TODO: dup2 + +//TODO: exit (handled by clone?) + +//TODO: fchmod + +//TODO: fcntl + +#[test] +fn fexec() { + let name = "/bin/ls"; + + let fd = dbg!( + crate::open(name, crate::O_RDONLY | crate::O_CLOEXEC) + ).unwrap(); + + let args = &[ + [name.as_ptr() as usize, name.len()] + ]; + + let vars = &[]; + + let pid_res = unsafe { crate::clone(0) }; + if pid_res == Ok(0) { + crate::fexec(fd, args, vars).unwrap(); + panic!("failed to fexec"); + } else { + assert_eq!(dbg!(crate::close(fd)), Ok(0)); + + let pid = dbg!(pid_res).unwrap(); + let mut status = 0; + assert_eq!(dbg!(crate::waitpid(pid, &mut status, 0)), Ok(pid)); + assert_eq!(dbg!(crate::wifexited(status)), true); + assert_eq!(dbg!(crate::wexitstatus(status)), 0); + } +} + +#[test] +fn fmap() { + use std::slice; + + let fd = dbg!( + crate::open( + "/tmp/syscall-tests-fmap", + crate::O_CREAT | crate::O_RDWR | crate::O_CLOEXEC + ) + ).unwrap(); + + let map = unsafe { + slice::from_raw_parts_mut( + dbg!( + crate::fmap(fd, &crate::Map { + offset: 0, + size: 128, + flags: crate::PROT_READ | crate::PROT_WRITE + }) + ).unwrap() as *mut u8, + 128 + ) + }; + + // Maps should be available after closing + assert_eq!(dbg!(crate::close(fd)), Ok(0)); + + for i in 0..128 { + map[i as usize] = i; + assert_eq!(map[i as usize], i); + } + + //TODO: add msync + unsafe { + assert_eq!(dbg!( + crate::funmap(map.as_mut_ptr() as usize) + ), Ok(0)); + } +} diff -Nru cargo-0.35.0/vendor/redox_termios/.cargo-checksum.json cargo-0.37.0/vendor/redox_termios/.cargo-checksum.json --- cargo-0.35.0/vendor/redox_termios/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/redox_termios/.cargo-checksum.json 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"files":{},"package":"7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/redox_termios/Cargo.toml cargo-0.37.0/vendor/redox_termios/Cargo.toml --- cargo-0.35.0/vendor/redox_termios/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/redox_termios/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO -# -# When uploading crates to the registry Cargo will automatically -# "normalize" Cargo.toml files for maximal compatibility -# with all versions of Cargo and also rewrite `path` dependencies -# 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 = "redox_termios" -version = "0.1.1" -authors = ["Jeremy Soller "] -description = "A Rust library to access Redox termios functions" -documentation = "https://docs.rs/redox_termios" -license = "MIT" -repository = "https://github.com/redox-os/termios" - -[lib] -name = "redox_termios" -path = "src/lib.rs" -[dependencies.redox_syscall] -version = "0.1" diff -Nru cargo-0.35.0/vendor/redox_termios/LICENSE cargo-0.37.0/vendor/redox_termios/LICENSE --- cargo-0.35.0/vendor/redox_termios/LICENSE 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/redox_termios/LICENSE 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 Redox OS - -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 is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff -Nru cargo-0.35.0/vendor/redox_termios/README.md cargo-0.37.0/vendor/redox_termios/README.md --- cargo-0.35.0/vendor/redox_termios/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/redox_termios/README.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -# termios -Redox Rust termios library diff -Nru cargo-0.35.0/vendor/redox_termios/src/lib.rs cargo-0.37.0/vendor/redox_termios/src/lib.rs --- cargo-0.35.0/vendor/redox_termios/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/redox_termios/src/lib.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,218 +0,0 @@ -#![allow(non_camel_case_types)] -#![no_std] - -extern crate syscall; - -use core::{mem, slice}; -use core::ops::{Deref, DerefMut}; - -pub type tcflag_t = u32; -pub type cc_t = u8; - -/* c_cc { */ -pub const VEOF: usize = 0; -pub const VEOL: usize = 1; -pub const VEOL2: usize = 2; -pub const VERASE: usize = 3; -pub const VWERASE: usize = 4; -pub const VKILL: usize = 5; -pub const VREPRINT: usize = 6; -pub const VSWTC: usize = 7; -pub const VINTR: usize = 8; -pub const VQUIT: usize = 9; -pub const VSUSP: usize = 10; -pub const VSTART: usize = 12; -pub const VSTOP: usize = 13; -pub const VLNEXT: usize = 14; -pub const VDISCARD: usize = 15; -pub const VMIN: usize = 16; -pub const VTIME: usize = 17; -pub const NCCS: usize = 32; -/* } c_cc */ - -/* c_iflag { */ -pub const IGNBRK: tcflag_t = 0o000001; -pub const BRKINT: tcflag_t = 0o000002; -pub const IGNPAR: tcflag_t = 0o000004; -pub const PARMRK: tcflag_t = 0o000010; -pub const INPCK: tcflag_t = 0o000020; -pub const ISTRIP: tcflag_t = 0o000040; -pub const INLCR: tcflag_t = 0o000100; -pub const IGNCR: tcflag_t = 0o000200; -pub const ICRNL: tcflag_t = 0o000400; -pub const IXON: tcflag_t = 0o001000; -pub const IXOFF: tcflag_t = 0o002000; -/* } c_iflag */ - -/* c_oflag { */ -pub const OPOST: tcflag_t = 0o000001; -pub const ONLCR: tcflag_t = 0o000002; -pub const OLCUC: tcflag_t = 0o000004; - -pub const OCRNL: tcflag_t = 0o000010; -pub const ONOCR: tcflag_t = 0o000020; -pub const ONLRET: tcflag_t = 0o000040; - -pub const OFILL: tcflag_t = 0o0000100; -pub const OFDEL: tcflag_t = 0o0000200; -/* } c_oflag */ - -/* c_cflag { */ -pub const B0: tcflag_t = 0o000000; -pub const B50: tcflag_t = 0o000001; -pub const B75: tcflag_t = 0o000002; -pub const B110: tcflag_t = 0o000003; -pub const B134: tcflag_t = 0o000004; -pub const B150: tcflag_t = 0o000005; -pub const B200: tcflag_t = 0o000006; -pub const B300: tcflag_t = 0o000007; -pub const B600: tcflag_t = 0o000010; -pub const B1200: tcflag_t = 0o000011; -pub const B1800: tcflag_t = 0o000012; -pub const B2400: tcflag_t = 0o000013; -pub const B4800: tcflag_t = 0o000014; -pub const B9600: tcflag_t = 0o000015; -pub const B19200: tcflag_t = 0o000016; -pub const B38400: tcflag_t = 0o000017; -pub const B57600: tcflag_t = 0o0020; -pub const B115200: tcflag_t = 0o0021; -pub const B230400: tcflag_t = 0o0022; -pub const B460800: tcflag_t = 0o0023; -pub const B500000: tcflag_t = 0o0024; -pub const B576000: tcflag_t = 0o0025; -pub const B921600: tcflag_t = 0o0026; -pub const B1000000: tcflag_t = 0o0027; -pub const B1152000: tcflag_t = 0o0030; -pub const B1500000: tcflag_t = 0o0031; -pub const B2000000: tcflag_t = 0o0032; -pub const B2500000: tcflag_t = 0o0033; -pub const B3000000: tcflag_t = 0o0034; -pub const B3500000: tcflag_t = 0o0035; -pub const B4000000: tcflag_t = 0o0036; - -pub const __MAX_BAUD: tcflag_t = B4000000; - -pub const CSIZE: tcflag_t = 0o0001400; -pub const CS5: tcflag_t = 0o0000000; -pub const CS6: tcflag_t = 0o0000400; -pub const CS7: tcflag_t = 0o0001000; -pub const CS8: tcflag_t = 0o0001400; - -pub const CSTOPB: tcflag_t = 0o0002000; -pub const CREAD: tcflag_t = 0o0004000; -pub const PARENB: tcflag_t = 0o0010000; -pub const PARODD: tcflag_t = 0o0020000; -pub const HUPCL: tcflag_t = 0o0040000; - -pub const CLOCAL: tcflag_t = 0o0100000; -/* } c_clfag */ - -/* c_lflag { */ -pub const ISIG: tcflag_t = 0x00000080; -pub const ICANON: tcflag_t = 0x00000100; -pub const ECHO: tcflag_t = 0x00000008; -pub const ECHOE: tcflag_t = 0x00000002; -pub const ECHOK: tcflag_t = 0x00000004; -pub const ECHONL: tcflag_t = 0x00000010; -pub const NOFLSH: tcflag_t = 0x80000000; -pub const TOSTOP: tcflag_t = 0x00400000; -pub const IEXTEN: tcflag_t = 0x00000400; -/* } c_lflag */ - -#[derive(Clone, Copy, Debug)] -#[repr(C)] -pub struct Termios { - pub c_iflag: tcflag_t, - pub c_oflag: tcflag_t, - pub c_cflag: tcflag_t, - pub c_lflag: tcflag_t, - pub c_cc: [cc_t; 32] -} - -impl Default for Termios { - fn default() -> Termios { - let mut termios = Termios { - c_iflag: ICRNL | IXON, - c_oflag: OPOST | ONLCR, - c_cflag: B38400 | CS8 | CREAD | HUPCL, - c_lflag: ISIG | ICANON | ECHO | ECHOE | ECHOK | IEXTEN, - c_cc: [0; 32] - }; - - { - let mut cc = |i: usize, b: cc_t| { - termios.c_cc[i] = b; - }; - - cc(VEOF, 0o004); // CTRL-D - cc(VEOL, 0o000); // NUL - cc(VEOL2, 0o000); // NUL - cc(VERASE, 0o177); // DEL - cc(VWERASE, 0o027); // CTRL-W - cc(VKILL, 0o025); // CTRL-U - cc(VREPRINT, 0o022);// CTRL-R - cc(VINTR, 0o003); // CTRL-C - cc(VQUIT, 0o034); // CTRL-\ - cc(VSUSP, 0o032); // CTRL-Z - cc(VSTART, 0o021); // CTRL-Q - cc(VSTOP, 0o023); // CTRL-S - cc(VLNEXT, 0o026); // CTRL-V - cc(VDISCARD, 0o017);// CTRL-U - cc(VMIN, 1); - cc(VTIME, 0); - } - - termios - } -} - -impl Termios { - pub fn make_raw(&mut self) { - self.c_iflag &= !(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON); - self.c_oflag &= !OPOST; - self.c_cflag &= !(CSIZE | PARENB); - self.c_cflag |= CS8; - self.c_lflag &= !(ECHO | ECHONL | ICANON | ISIG | IEXTEN); - } -} - -impl Deref for Termios { - type Target = [u8]; - fn deref(&self) -> &[u8] { - unsafe { - slice::from_raw_parts(self as *const Termios as *const u8, mem::size_of::()) as &[u8] - } - } -} - -impl DerefMut for Termios { - fn deref_mut(&mut self) -> &mut [u8] { - unsafe { - slice::from_raw_parts_mut(self as *mut Termios as *mut u8, mem::size_of::()) as &mut [u8] - } - } -} - -#[derive(Clone, Copy, Debug, Default)] -#[repr(C)] -pub struct Winsize { - pub ws_row: u16, - pub ws_col: u16 -} - -impl Deref for Winsize { - type Target = [u8]; - fn deref(&self) -> &[u8] { - unsafe { - slice::from_raw_parts(self as *const Winsize as *const u8, mem::size_of::()) as &[u8] - } - } -} - -impl DerefMut for Winsize { - fn deref_mut(&mut self) -> &mut [u8] { - unsafe { - slice::from_raw_parts_mut(self as *mut Winsize as *mut u8, mem::size_of::()) as &mut [u8] - } - } -} diff -Nru cargo-0.35.0/vendor/regex/.cargo-checksum.json cargo-0.37.0/vendor/regex/.cargo-checksum.json --- cargo-0.35.0/vendor/regex/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"8f0a0bcab2fd7d1d7c54fa9eae6f43eddeb9ce2e7352f8518a814a4f65d60c58"} \ No newline at end of file +{"files":{},"package":"d9d8297cc20bbb6184f8b45ff61c8ee6a9ac56c156cec8e38c3e5084773c44ad"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/regex/Cargo.toml cargo-0.37.0/vendor/regex/Cargo.toml --- cargo-0.35.0/vendor/regex/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "regex" -version = "1.1.6" +version = "1.1.9" authors = ["The Rust Project Developers"] exclude = ["/.travis.yml", "/appveyor.yml", "/ci/*", "/scripts/*"] autotests = false @@ -71,7 +71,7 @@ name = "crates-regex" path = "tests/test_crates_regex.rs" [dependencies.aho-corasick] -version = "0.7.3" +version = "0.7.4" [dependencies.memchr] version = "2.0.2" @@ -84,11 +84,14 @@ [dependencies.utf8-ranges] version = "1.0.1" +[dev-dependencies.doc-comment] +version = "0.3" + [dev-dependencies.lazy_static] version = "1" [dev-dependencies.quickcheck] -version = "0.7" +version = "0.8" default-features = false [dev-dependencies.rand] diff -Nru cargo-0.35.0/vendor/regex/CHANGELOG.md cargo-0.37.0/vendor/regex/CHANGELOG.md --- cargo-0.35.0/vendor/regex/CHANGELOG.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex/CHANGELOG.md 2019-07-17 05:42:23.000000000 +0000 @@ -1,3 +1,32 @@ +1.1.9 (2019-07-06) +================== +This release contains a bug fix that caused regex's tests to fail, due to a +dependency on an unreleased behavior in regex-syntax. + +* [BUG #593](https://github.com/rust-lang/regex/issues/593): + Move an integration-style test on error messages into regex-syntax. + + +1.1.8 (2019-07-04) +================== +This release contains a few small internal refactorings. One of which fixes +an instance of undefined behavior in a part of the SIMD code. + +Bug fixes: + +* [BUG #545](https://github.com/rust-lang/regex/issues/545): + Improves error messages when a repetition operator is used without a number. +* [BUG #588](https://github.com/rust-lang/regex/issues/588): + Removes use of a repr(Rust) union used for type punning in the Teddy matcher. +* [BUG #591](https://github.com/rust-lang/regex/issues/591): + Update docs for running benchmarks and improve failure modes. + + +1.1.7 (2019-06-09) +================== +This release fixes up a few warnings as a result of recent deprecations. + + 1.1.6 (2019-04-16) ================== This release fixes a regression introduced by a bug fix (for diff -Nru cargo-0.35.0/vendor/regex/HACKING.md cargo-0.37.0/vendor/regex/HACKING.md --- cargo-0.35.0/vendor/regex/HACKING.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex/HACKING.md 2019-07-17 05:42:23.000000000 +0000 @@ -303,13 +303,13 @@ If you're hacking on one of the matching engines and just want to see benchmarks, then all you need to run is: - $ ./bench/run rust + $ (cd bench && ./run rust) If you want to compare your results with older benchmarks, then try: - $ ./bench/run rust | tee old + $ (cd bench && ./run rust | tee old) $ ... make it faster - $ ./bench/run rust | tee new + $ (cd bench && ./run rust | tee new) $ cargo benchcmp old new --improvements The `cargo-benchcmp` utility is available here: diff -Nru cargo-0.35.0/vendor/regex/README.md cargo-0.37.0/vendor/regex/README.md --- cargo-0.35.0/vendor/regex/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -87,7 +87,7 @@ This example outputs: -``` +```text year: 2010, month: 03, day: 14 year: 2014, month: 10, day: 14 ``` @@ -107,7 +107,7 @@ For example: -```rust +```rust,ignore use regex::Regex; fn some_helper_function(text: &str) -> bool { diff -Nru cargo-0.35.0/vendor/regex/src/error.rs cargo-0.37.0/vendor/regex/src/error.rs --- cargo-0.35.0/vendor/regex/src/error.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex/src/error.rs 2019-07-17 05:42:23.000000000 +0000 @@ -36,10 +36,6 @@ Error::__Nonexhaustive => unreachable!(), } } - - fn cause(&self) -> Option<&::std::error::Error> { - None - } } impl fmt::Display for Error { diff -Nru cargo-0.35.0/vendor/regex/src/exec.rs cargo-0.37.0/vendor/regex/src/exec.rs --- cargo-0.35.0/vendor/regex/src/exec.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex/src/exec.rs 2019-07-17 05:42:23.000000000 +0000 @@ -323,9 +323,7 @@ .reverse(true) .compile(&parsed.exprs)?; - let prefixes = parsed.prefixes.unambiguous_prefixes(); - let suffixes = parsed.suffixes.unambiguous_suffixes(); - nfa.prefixes = LiteralSearcher::prefixes(prefixes); + nfa.prefixes = LiteralSearcher::prefixes(parsed.prefixes); dfa.prefixes = nfa.prefixes.clone(); dfa.dfa_size_limit = self.options.dfa_size_limit; dfa_reverse.dfa_size_limit = self.options.dfa_size_limit; @@ -354,7 +352,7 @@ nfa: nfa, dfa: dfa, dfa_reverse: dfa_reverse, - suffixes: LiteralSearcher::suffixes(suffixes), + suffixes: LiteralSearcher::suffixes(parsed.suffixes), ac: ac, match_type: MatchType::Nothing, }; @@ -1286,7 +1284,7 @@ #[derive(Clone, Copy, Debug)] enum MatchType { /// A single or multiple literal search. This is only used when the regex - /// can be decomposed into unambiguous literal search. + /// can be decomposed into a literal search. Literal(MatchLiteralType), /// A normal DFA search. Dfa, diff -Nru cargo-0.35.0/vendor/regex/src/expand.rs cargo-0.37.0/vendor/regex/src/expand.rs --- cargo-0.35.0/vendor/regex/src/expand.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex/src/expand.rs 2019-07-17 05:42:23.000000000 +0000 @@ -92,7 +92,7 @@ /// `CaptureRef` represents a reference to a capture group inside some text. /// The reference is either a capture group name or a number. /// -/// It is also tagged with the position in the text immediately proceeding the +/// It is also tagged with the position in the text following the /// capture reference. #[derive(Clone, Copy, Debug, Eq, PartialEq)] struct CaptureRef<'a> { @@ -204,6 +204,7 @@ find!(find_cap_ref3, "$0", c!(0, 2)); find!(find_cap_ref4, "$5", c!(5, 2)); find!(find_cap_ref5, "$10", c!(10, 3)); + // see https://github.com/rust-lang/regex/pull/585 for more on characters following numbers find!(find_cap_ref6, "$42a", c!("42a", 4)); find!(find_cap_ref7, "${42}a", c!(42, 5)); find!(find_cap_ref8, "${42"); @@ -212,4 +213,8 @@ find!(find_cap_ref11, "$"); find!(find_cap_ref12, " "); find!(find_cap_ref13, ""); + find!(find_cap_ref14, "$1-$2", c!(1,2)); + find!(find_cap_ref15, "$1_$2", c!("1_",3)); + find!(find_cap_ref16, "$x-$y", c!("x",2)); + find!(find_cap_ref17, "$x_$y", c!("x_",3)); } diff -Nru cargo-0.35.0/vendor/regex/src/lib.rs cargo-0.37.0/vendor/regex/src/lib.rs --- cargo-0.35.0/vendor/regex/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -518,6 +518,7 @@ */ #![deny(missing_docs)] +#![allow(ellipsis_inclusive_range_patterns)] #![cfg_attr(test, deny(warnings))] #![cfg_attr(feature = "pattern", feature(pattern))] @@ -532,6 +533,11 @@ extern crate quickcheck; extern crate regex_syntax as syntax; extern crate utf8_ranges; +#[cfg(test)] +extern crate doc_comment; + +#[cfg(test)] +doc_comment::doctest!("../README.md"); #[cfg(feature = "use_std")] pub use error::Error; diff -Nru cargo-0.35.0/vendor/regex/src/literal/mod.rs cargo-0.37.0/vendor/regex/src/literal/mod.rs --- cargo-0.35.0/vendor/regex/src/literal/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex/src/literal/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -11,7 +11,7 @@ use std::cmp; use std::mem; -use aho_corasick::{AhoCorasick, AhoCorasickBuilder}; +use aho_corasick::{self, AhoCorasick, AhoCorasickBuilder}; use memchr::{memchr, memchr2, memchr3}; use syntax::hir::literal::{Literal, Literals}; @@ -261,6 +261,7 @@ } let pats = lits.literals().to_owned(); let ac = AhoCorasickBuilder::new() + .match_kind(aho_corasick::MatchKind::LeftmostFirst) .dfa(true) .build_with_size::(&pats) .unwrap(); diff -Nru cargo-0.35.0/vendor/regex/src/literal/teddy_avx2/imp.rs cargo-0.37.0/vendor/regex/src/literal/teddy_avx2/imp.rs --- cargo-0.35.0/vendor/regex/src/literal/teddy_avx2/imp.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex/src/literal/teddy_avx2/imp.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,7 +9,7 @@ use std::cmp; -use aho_corasick::{AhoCorasick, AhoCorasickBuilder}; +use aho_corasick::{self, AhoCorasick, AhoCorasickBuilder}; use syntax::hir::literal::Literals; use vector::avx2::{AVX2VectorBuilder, u8x32}; @@ -89,6 +89,7 @@ masks.add(bucket as u8, pat); } let ac = AhoCorasickBuilder::new() + .match_kind(aho_corasick::MatchKind::LeftmostFirst) .dfa(true) .prefilter(false) .build(&pats); @@ -285,6 +286,7 @@ res: u8x32, mut bitfield: u32, ) -> Option { + let patterns = res.bytes(); while bitfield != 0 { // The next offset, relative to pos, where some fingerprint // matched. @@ -296,7 +298,7 @@ // The bitfield telling us which patterns had fingerprints that // match at this starting position. - let mut patterns = res.extract(byte_pos); + let mut patterns = patterns[byte_pos]; while patterns != 0 { let bucket = patterns.trailing_zeros() as usize; patterns &= !(1 << bucket); @@ -461,12 +463,20 @@ let byte_lo = (byte & 0xF) as usize; let byte_hi = (byte >> 4) as usize; - let lo = self.lo.extract(byte_lo) | ((1 << bucket) as u8); - self.lo.replace(byte_lo, lo); - self.lo.replace(byte_lo + 16, lo); - - let hi = self.hi.extract(byte_hi) | ((1 << bucket) as u8); - self.hi.replace(byte_hi, hi); - self.hi.replace(byte_hi + 16, hi); + { + let mut lo_bytes = self.lo.bytes(); + let lo = lo_bytes[byte_lo] | ((1 << bucket) as u8); + lo_bytes[byte_lo] = lo; + lo_bytes[byte_lo + 16] = lo; + self.lo.replace_bytes(lo_bytes); + } + + { + let mut hi_bytes = self.hi.bytes(); + let hi = hi_bytes[byte_hi] | ((1 << bucket) as u8); + hi_bytes[byte_hi] = hi; + hi_bytes[byte_hi + 16] = hi; + self.hi.replace_bytes(hi_bytes); + } } } diff -Nru cargo-0.35.0/vendor/regex/src/literal/teddy_ssse3/imp.rs cargo-0.37.0/vendor/regex/src/literal/teddy_ssse3/imp.rs --- cargo-0.35.0/vendor/regex/src/literal/teddy_ssse3/imp.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex/src/literal/teddy_ssse3/imp.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,7 +8,7 @@ ---------- The key idea of Teddy is to do *packed* substring matching. In the literature, -packed substring matching is the idea of examing multiple bytes in a haystack +packed substring matching is the idea of examining multiple bytes in a haystack at a time to detect matches. Implementations of, for example, memchr (which detects matches of a single byte) have been doing this for years. Only recently, with the introduction of various SIMD instructions, has this been @@ -320,7 +320,7 @@ use std::cmp; -use aho_corasick::{AhoCorasick, AhoCorasickBuilder}; +use aho_corasick::{self, AhoCorasick, AhoCorasickBuilder}; use syntax::hir::literal::Literals; use vector::ssse3::{SSSE3VectorBuilder, u8x16}; @@ -400,6 +400,7 @@ masks.add(bucket as u8, pat); } let ac = AhoCorasickBuilder::new() + .match_kind(aho_corasick::MatchKind::LeftmostFirst) .dfa(true) .prefilter(false) .build(&pats); @@ -595,6 +596,7 @@ res: u8x16, mut bitfield: u32, ) -> Option { + let patterns = res.bytes(); while bitfield != 0 { // The next offset, relative to pos, where some fingerprint // matched. @@ -606,7 +608,7 @@ // The bitfield telling us which patterns had fingerprints that // match at this starting position. - let mut patterns = res.extract(byte_pos); + let mut patterns = patterns[byte_pos]; while patterns != 0 { let bucket = patterns.trailing_zeros() as usize; patterns &= !(1 << bucket); @@ -771,10 +773,17 @@ let byte_lo = (byte & 0xF) as usize; let byte_hi = (byte >> 4) as usize; - let lo = self.lo.extract(byte_lo); - self.lo.replace(byte_lo, ((1 << bucket) as u8) | lo); - - let hi = self.hi.extract(byte_hi); - self.hi.replace(byte_hi, ((1 << bucket) as u8) | hi); + { + let mut lo_bytes = self.lo.bytes(); + let lo = lo_bytes[byte_lo]; + lo_bytes[byte_lo] = ((1 << bucket) as u8) | lo; + self.lo.replace_bytes(lo_bytes); + } + { + let mut hi_bytes = self.hi.bytes(); + let hi = hi_bytes[byte_hi]; + hi_bytes[byte_hi] = ((1 << bucket) as u8) | hi; + self.hi.replace_bytes(hi_bytes); + } } } diff -Nru cargo-0.35.0/vendor/regex/src/vector/avx2.rs cargo-0.37.0/vendor/regex/src/vector/avx2.rs --- cargo-0.35.0/vendor/regex/src/vector/avx2.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex/src/vector/avx2.rs 2019-07-17 05:42:23.000000000 +0000 @@ -2,6 +2,7 @@ use std::arch::x86_64::*; use std::fmt; +use std::mem; #[derive(Clone, Copy, Debug)] pub struct AVX2VectorBuilder(()); @@ -56,9 +57,9 @@ #[derive(Clone, Copy)] #[allow(non_camel_case_types)] -pub union u8x32 { - vector: __m256i, - bytes: [u8; 32], +#[repr(transparent)] +pub struct u8x32 { + vector: __m256i } impl u8x32 { @@ -93,18 +94,6 @@ } #[inline] - pub fn extract(self, i: usize) -> u8 { - // Safe because `bytes` is always accessible. - unsafe { self.bytes[i] } - } - - #[inline] - pub fn replace(&mut self, i: usize, byte: u8) { - // Safe because `bytes` is always accessible. - unsafe { self.bytes[i] = byte; } - } - - #[inline] pub fn shuffle(self, indices: u8x32) -> u8x32 { // Safe because we know AVX2 is enabled. unsafe { @@ -177,11 +166,22 @@ u8x32 { vector: _mm256_srli_epi16(self.vector, 4) } } } + + #[inline] + pub fn bytes(self) -> [u8; 32] { + // Safe because __m256i and [u8; 32] are layout compatible + unsafe { mem::transmute(self) } + } + + #[inline] + pub fn replace_bytes(&mut self, value: [u8; 32]) { + // Safe because __m256i and [u8; 32] are layout compatible + self.vector = unsafe { mem::transmute(value) }; + } } impl fmt::Debug for u8x32 { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - // Safe because `bytes` is always accessible. - unsafe { self.bytes.fmt(f) } + self.bytes().fmt(f) } } diff -Nru cargo-0.35.0/vendor/regex/src/vector/ssse3.rs cargo-0.37.0/vendor/regex/src/vector/ssse3.rs --- cargo-0.35.0/vendor/regex/src/vector/ssse3.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex/src/vector/ssse3.rs 2019-07-17 05:42:23.000000000 +0000 @@ -2,6 +2,7 @@ use std::arch::x86_64::*; use std::fmt; +use std::mem; /// A builder for SSSE3 empowered vectors. /// @@ -77,9 +78,9 @@ /// inlined, otherwise you probably have a performance bug. #[derive(Clone, Copy)] #[allow(non_camel_case_types)] -pub union u8x16 { - vector: __m128i, - bytes: [u8; 16], +#[repr(transparent)] +pub struct u8x16 { + vector: __m128i } impl u8x16 { @@ -114,18 +115,6 @@ } #[inline] - pub fn extract(self, i: usize) -> u8 { - // Safe because `bytes` is always accessible. - unsafe { self.bytes[i] } - } - - #[inline] - pub fn replace(&mut self, i: usize, byte: u8) { - // Safe because `bytes` is always accessible. - unsafe { self.bytes[i] = byte; } - } - - #[inline] pub fn shuffle(self, indices: u8x16) -> u8x16 { // Safe because we know SSSE3 is enabled. unsafe { @@ -182,11 +171,22 @@ u8x16 { vector: _mm_srli_epi16(self.vector, 4) } } } + + #[inline] + pub fn bytes(self) -> [u8; 16] { + // Safe because __m128i and [u8; 16] are layout compatible + unsafe { mem::transmute(self) } + } + + #[inline] + pub fn replace_bytes(&mut self, value: [u8; 16]) { + // Safe because __m128i and [u8; 16] are layout compatible + self.vector = unsafe { mem::transmute(value) }; + } } impl fmt::Debug for u8x16 { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - // Safe because `bytes` is always accessible. - unsafe { self.bytes.fmt(f) } + self.bytes().fmt(f) } } diff -Nru cargo-0.35.0/vendor/regex/tests/regression.rs cargo-0.37.0/vendor/regex/tests/regression.rs --- cargo-0.35.0/vendor/regex/tests/regression.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex/tests/regression.rs 2019-07-17 05:42:23.000000000 +0000 @@ -133,7 +133,9 @@ true); // Tests that our Aho-Corasick optimization works correctly. It only -// kicks in when we have >32 literals. +// kicks in when we have >32 literals. By "works correctly," we mean that +// leftmost-first match semantics are properly respected. That is, samwise +// should match, not sam. mat!( ahocorasick1, "samwise|sam|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|\ diff -Nru cargo-0.35.0/vendor/regex/tests/replace.rs cargo-0.37.0/vendor/regex/tests/replace.rs --- cargo-0.35.0/vendor/regex/tests/replace.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex/tests/replace.rs 2019-07-17 05:42:23.000000000 +0000 @@ -35,9 +35,11 @@ r"(\S+)\s+(\S+)", "w1 w2", no_expand!("$$1"), "$$1"); use_!(Captures); replace!(closure_returning_reference, replace, r"(\d+)", "age: 26", - | captures: &Captures | &match_text!(captures.get(1).unwrap())[0..1], "age: 2"); + |captures: &Captures| { + match_text!(captures.get(1).unwrap())[0..1].to_owned() + }, "age: 2"); replace!(closure_returning_value, replace, r"\d+", "age: 26", - | _captures: &Captures | t!("Z").to_owned(), "age: Z"); + |_captures: &Captures| t!("Z").to_owned(), "age: Z"); // See https://github.com/rust-lang/regex/issues/314 diff -Nru cargo-0.35.0/vendor/regex-syntax/.cargo-checksum.json cargo-0.37.0/vendor/regex-syntax/.cargo-checksum.json --- cargo-0.35.0/vendor/regex-syntax/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex-syntax/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"dcfd8681eebe297b81d98498869d4aae052137651ad7b96822f09ceb690d0a96"} \ No newline at end of file +{"files":{},"package":"9b01330cce219c1c6b2e209e5ed64ccd587ae5c67bed91c0b49eecf02ae40e21"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/regex-syntax/Cargo.toml cargo-0.37.0/vendor/regex-syntax/Cargo.toml --- cargo-0.35.0/vendor/regex-syntax/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex-syntax/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "regex-syntax" -version = "0.6.6" +version = "0.6.8" authors = ["The Rust Project Developers"] description = "A regular expression parser." homepage = "https://github.com/rust-lang/regex" diff -Nru cargo-0.35.0/vendor/regex-syntax/src/ast/mod.rs cargo-0.37.0/vendor/regex-syntax/src/ast/mod.rs --- cargo-0.35.0/vendor/regex-syntax/src/ast/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex-syntax/src/ast/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -95,7 +95,10 @@ ClassRangeLiteral, /// An opening `[` was found with no corresponding closing `]`. ClassUnclosed, - /// An empty decimal number was given where one was expected. + /// Note that this error variant is no longer used. Namely, a decimal + /// number can only appear as a repetition quantifier. When the number + /// in a repetition quantifier is empty, then it gets its own specialized + /// error, `RepetitionCountDecimalEmpty`. DecimalEmpty, /// An invalid decimal number was given where one was expected. DecimalInvalid, @@ -153,6 +156,9 @@ /// The range provided in a counted repetition operator is invalid. The /// range is invalid if the start is greater than the end. RepetitionCountInvalid, + /// An opening `{` was not followed by a valid decimal value. + /// For example, `x{}` or `x{]}` would fail. + RepetitionCountDecimalEmpty, /// An opening `{` was found with no corresponding closing `}`. RepetitionCountUnclosed, /// A repetition operator was applied to a missing sub-expression. This @@ -307,6 +313,9 @@ write!(f, "invalid repetition count range, \ the start must be <= the end") } + RepetitionCountDecimalEmpty => { + write!(f, "repetition quantifier expects a valid decimal") + } RepetitionCountUnclosed => { write!(f, "unclosed counted repetition") } diff -Nru cargo-0.35.0/vendor/regex-syntax/src/ast/parse.rs cargo-0.37.0/vendor/regex-syntax/src/ast/parse.rs --- cargo-0.35.0/vendor/regex-syntax/src/ast/parse.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex-syntax/src/ast/parse.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1113,7 +1113,11 @@ ast::ErrorKind::RepetitionCountUnclosed, )); } - let count_start = self.parse_decimal()?; + let count_start = specialize_err( + self.parse_decimal(), + ast::ErrorKind::DecimalEmpty, + ast::ErrorKind::RepetitionCountDecimalEmpty, + )?; let mut range = ast::RepetitionRange::Exactly(count_start); if self.is_eof() { return Err(self.error( @@ -1129,7 +1133,11 @@ )); } if self.char() != '}' { - let count_end = self.parse_decimal()?; + let count_end = specialize_err( + self.parse_decimal(), + ast::ErrorKind::DecimalEmpty, + ast::ErrorKind::RepetitionCountDecimalEmpty, + )?; range = ast::RepetitionRange::Bounded(count_start, count_end); } else { range = ast::RepetitionRange::AtLeast(count_start); @@ -2260,6 +2268,29 @@ } } +/// When the result is an error, transforms the ast::ErrorKind from the source +/// Result into another one. This function is used to return clearer error +/// messages when possible. +fn specialize_err( + result: Result, + from: ast::ErrorKind, + to: ast::ErrorKind, +) -> Result { + if let Err(e) = result { + if e.kind == from { + Err(ast::Error { + kind: to, + pattern: e.pattern, + span: e.span, + }) + } else { + Err(e) + } + } else { + result + } +} + #[cfg(test)] mod tests { use std::ops::Range; @@ -3144,6 +3175,18 @@ kind: ast::ErrorKind::RepetitionMissing, }); assert_eq!( + parser(r"a{]}").parse().unwrap_err(), + TestError { + span: span(2..2), + kind: ast::ErrorKind::RepetitionCountDecimalEmpty, + }); + assert_eq!( + parser(r"a{1,]}").parse().unwrap_err(), + TestError { + span: span(4..4), + kind: ast::ErrorKind::RepetitionCountDecimalEmpty, + }); + assert_eq!( parser(r"a{").parse().unwrap_err(), TestError { span: span(1..2), @@ -3153,13 +3196,13 @@ parser(r"a{}").parse().unwrap_err(), TestError { span: span(2..2), - kind: ast::ErrorKind::DecimalEmpty, + kind: ast::ErrorKind::RepetitionCountDecimalEmpty, }); assert_eq!( parser(r"a{a").parse().unwrap_err(), TestError { span: span(2..2), - kind: ast::ErrorKind::DecimalEmpty, + kind: ast::ErrorKind::RepetitionCountDecimalEmpty, }); assert_eq!( parser(r"a{9999999999}").parse().unwrap_err(), @@ -3177,7 +3220,7 @@ parser(r"a{9,a").parse().unwrap_err(), TestError { span: span(4..4), - kind: ast::ErrorKind::DecimalEmpty, + kind: ast::ErrorKind::RepetitionCountDecimalEmpty, }); assert_eq!( parser(r"a{9,9999999999}").parse().unwrap_err(), diff -Nru cargo-0.35.0/vendor/regex-syntax/src/error.rs cargo-0.37.0/vendor/regex-syntax/src/error.rs --- cargo-0.35.0/vendor/regex-syntax/src/error.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex-syntax/src/error.rs 2019-07-17 05:42:23.000000000 +0000 @@ -287,6 +287,18 @@ mod tests { use ast::parse::Parser; + fn assert_panic_message(pattern: &str, expected_msg: &str) -> () { + let result = Parser::new().parse(pattern); + match result { + Ok(_) => { + panic!("regex should not have parsed"); + } + Err(err) => { + assert_eq!(err.to_string(), expected_msg.trim()); + } + } + } + // See: https://github.com/rust-lang/regex/issues/464 #[test] fn regression_464() { @@ -294,4 +306,15 @@ // This test checks that the error formatter doesn't panic. assert!(!err.to_string().is_empty()); } + + // See: https://github.com/rust-lang/regex/issues/545 + #[test] + fn repetition_quantifier_expects_a_valid_decimal() { + assert_panic_message(r"\\u{[^}]*}", r#" +regex parse error: + \\u{[^}]*} + ^ +error: repetition quantifier expects a valid decimal +"#); + } } diff -Nru cargo-0.35.0/vendor/regex-syntax/src/hir/literal/mod.rs cargo-0.37.0/vendor/regex-syntax/src/hir/literal/mod.rs --- cargo-0.35.0/vendor/regex-syntax/src/hir/literal/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex-syntax/src/hir/literal/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -684,7 +684,7 @@ HirKind::Literal(hir::Literal::Unicode(c)) => { let mut buf = [0u8; 4]; let i = c.encode_utf8(&mut buf).len(); - let mut buf = &mut buf[..i]; + let buf = &mut buf[..i]; buf.reverse(); lits.cross_add(buf); } diff -Nru cargo-0.35.0/vendor/regex-syntax/src/lib.rs cargo-0.37.0/vendor/regex-syntax/src/lib.rs --- cargo-0.35.0/vendor/regex-syntax/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/regex-syntax/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -104,6 +104,7 @@ */ #![deny(missing_docs)] +#![allow(ellipsis_inclusive_range_patterns)] extern crate ucd_util; diff -Nru cargo-0.35.0/vendor/remove_dir_all/.cargo-checksum.json cargo-0.37.0/vendor/remove_dir_all/.cargo-checksum.json --- cargo-0.35.0/vendor/remove_dir_all/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/remove_dir_all/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5"} \ No newline at end of file +{"files":{},"package":"4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/remove_dir_all/Cargo.toml cargo-0.37.0/vendor/remove_dir_all/Cargo.toml --- cargo-0.35.0/vendor/remove_dir_all/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/remove_dir_all/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,7 +12,7 @@ [package] name = "remove_dir_all" -version = "0.5.1" +version = "0.5.2" authors = ["Aaronepower "] include = ["Cargo.toml", "LICENCE-APACHE", "LICENCE-MIT", "src/**/*"] description = "A safe, reliable implementation of remove_dir_all for Windows" @@ -20,7 +20,9 @@ keywords = ["utility", "filesystem", "remove_dir", "windows"] categories = ["filesystem"] license = "MIT/Apache-2.0" -repository = "https://github.com/Aaronepower/remove_dir_all.git" +repository = "https://github.com/XAMPPRocky/remove_dir_all.git" +[dev-dependencies.doc-comment] +version = "0.3" [target."cfg(windows)".dependencies.winapi] version = "0.3" features = ["std", "errhandlingapi", "winerror", "fileapi", "winbase"] diff -Nru cargo-0.35.0/vendor/remove_dir_all/src/fs.rs cargo-0.37.0/vendor/remove_dir_all/src/fs.rs --- cargo-0.35.0/vendor/remove_dir_all/src/fs.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/remove_dir_all/src/fs.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,8 +1,8 @@ use std::ffi::OsString; use std::fs::{self, File, OpenOptions}; -use std::{io, ptr}; use std::os::windows::prelude::*; use std::path::{Path, PathBuf}; +use std::{io, ptr}; use winapi::shared::minwindef::*; use winapi::shared::winerror::*; @@ -24,9 +24,11 @@ /// ```rust /// extern crate remove_dir_all; /// +/// use std::fs; /// use remove_dir_all::*; /// /// fn main() { +/// fs::create_dir("./temp/").unwrap(); /// remove_dir_all("./temp/").unwrap(); /// } /// ``` @@ -77,8 +79,7 @@ let path = path.as_ref(); let mut opts = OpenOptions::new(); opts.access_mode(FILE_READ_ATTRIBUTES); - opts.custom_flags(FILE_FLAG_BACKUP_SEMANTICS | - FILE_FLAG_OPEN_REPARSE_POINT); + opts.custom_flags(FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT); let file = opts.open(path)?; (get_path(&file)?, path.metadata()?) }; @@ -86,8 +87,12 @@ let mut ctx = RmdirContext { base_dir: match path.parent() { Some(dir) => dir, - None => return Err(io::Error::new(io::ErrorKind::PermissionDenied, - "Can't delete root directory")) + None => { + return Err(io::Error::new( + io::ErrorKind::PermissionDenied, + "Can't delete root directory", + )) + } }, readonly: metadata.permissions().readonly(), counter: 0, @@ -101,7 +106,10 @@ remove_item(path.as_ref(), &mut ctx) } } else { - Err(io::Error::new(io::ErrorKind::PermissionDenied, "Not a directory")) + Err(io::Error::new( + io::ErrorKind::PermissionDenied, + "Not a directory", + )) } } @@ -116,9 +124,11 @@ let mut opts = OpenOptions::new(); opts.access_mode(DELETE); - opts.custom_flags(FILE_FLAG_BACKUP_SEMANTICS | // delete directory + opts.custom_flags( + FILE_FLAG_BACKUP_SEMANTICS | // delete directory FILE_FLAG_OPEN_REPARSE_POINT | // delete symlink - FILE_FLAG_DELETE_ON_CLOSE); + FILE_FLAG_DELETE_ON_CLOSE, + ); let file = opts.open(path)?; move_item(&file, ctx)?; @@ -129,8 +139,8 @@ let mut perm = metadata.permissions(); perm.set_readonly(true); fs::set_permissions(&path, perm)?; - }, - Err(ref err) if err.kind() == io::ErrorKind::NotFound => {}, + } + Err(ref err) if err.kind() == io::ErrorKind::NotFound => {} err => return err.map(|_| ()), } } @@ -139,13 +149,15 @@ } fn move_item(file: &File, ctx: &mut RmdirContext) -> io::Result<()> { - let mut tmpname = ctx.base_dir.join(format!{"rm-{}", ctx.counter}); + let mut tmpname = ctx.base_dir.join(format! {"rm-{}", ctx.counter}); ctx.counter += 1; // Try to rename the file. If it already exists, just retry with an other // filename. while let Err(err) = rename(file, &tmpname, false) { - if err.kind() != io::ErrorKind::AlreadyExists { return Err(err) }; + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(err); + }; tmpname = ctx.base_dir.join(format!("rm-{}", ctx.counter)); ctx.counter += 1; } @@ -156,13 +168,14 @@ fn rename(file: &File, new: &Path, replace: bool) -> io::Result<()> { // &self must be opened with DELETE permission use std::iter; - #[cfg(target_arch = "x86")] + #[cfg(target_pointer_width = "32")] const STRUCT_SIZE: usize = 12; - #[cfg(target_arch = "x86_64")] + #[cfg(target_pointer_width = "64")] const STRUCT_SIZE: usize = 20; // FIXME: check for internal NULs in 'new' - let mut data: Vec = iter::repeat(0u16).take(STRUCT_SIZE/2) + let mut data: Vec = iter::repeat(0u16) + .take(STRUCT_SIZE / 2) .chain(new.as_os_str().encode_wide()) .collect(); data.push(0); @@ -177,10 +190,12 @@ (*info).ReplaceIfExists = if replace { -1 } else { FALSE }; (*info).RootDirectory = ptr::null_mut(); (*info).FileNameLength = (size - STRUCT_SIZE) as DWORD; - let result = SetFileInformationByHandle(file.as_raw_handle(), - FileRenameInfo, - data.as_mut_ptr() as *mut _ as *mut _, - size as DWORD); + let result = SetFileInformationByHandle( + file.as_raw_handle(), + FileRenameInfo, + data.as_mut_ptr() as *mut _ as *mut _, + size as DWORD, + ); if result == 0 { Err(io::Error::last_os_error()) @@ -191,25 +206,22 @@ } fn get_path(f: &File) -> io::Result { - - fill_utf16_buf(|buf, sz| unsafe { - GetFinalPathNameByHandleW(f.as_raw_handle(), buf, sz, VOLUME_NAME_DOS) - }, |buf| { - PathBuf::from(OsString::from_wide(buf)) - }) + fill_utf16_buf( + |buf, sz| unsafe { GetFinalPathNameByHandleW(f.as_raw_handle(), buf, sz, VOLUME_NAME_DOS) }, + |buf| PathBuf::from(OsString::from_wide(buf)), + ) } -fn remove_dir_all_recursive(path: &Path, ctx: &mut RmdirContext) - -> io::Result<()> { +fn remove_dir_all_recursive(path: &Path, ctx: &mut RmdirContext) -> io::Result<()> { let dir_readonly = ctx.readonly; - for child in try!(fs::read_dir(path)) { - let child = try!(child); - let child_type = try!(child.file_type()); - ctx.readonly = try!(child.metadata()).permissions().readonly(); + for child in fs::read_dir(path)? { + let child = child?; + let child_type = child.file_type()?; + ctx.readonly = child.metadata()?.permissions().readonly(); if child_type.is_dir() { - try!(remove_dir_all_recursive(&child.path(), ctx)); + remove_dir_all_recursive(&child.path(), ctx)?; } else { - try!(remove_item(&child.path().as_ref(), ctx)); + remove_item(&child.path().as_ref(), ctx)?; } } ctx.readonly = dir_readonly; @@ -217,8 +229,9 @@ } fn fill_utf16_buf(mut f1: F1, f2: F2) -> io::Result - where F1: FnMut(*mut u16, DWORD) -> DWORD, - F2: FnOnce(&[u16]) -> T +where + F1: FnMut(*mut u16, DWORD) -> DWORD, + F2: FnOnce(&[u16]) -> T, { // Start off with a stack buf but then spill over to the heap if we end up // needing more space. @@ -257,9 +270,8 @@ } else if k >= n { n = k; } else { - return Ok(f2(&buf[..k])) + return Ok(f2(&buf[..k])); } } } } - diff -Nru cargo-0.35.0/vendor/remove_dir_all/src/lib.rs cargo-0.37.0/vendor/remove_dir_all/src/lib.rs --- cargo-0.35.0/vendor/remove_dir_all/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/remove_dir_all/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,6 +1,13 @@ #[cfg(windows)] extern crate winapi; +#[cfg(test)] +#[macro_use] +extern crate doc_comment; + +#[cfg(test)] +doctest!("../README.md"); + #[cfg(windows)] mod fs; @@ -9,4 +16,3 @@ #[cfg(not(windows))] pub use std::fs::remove_dir_all; - diff -Nru cargo-0.35.0/vendor/rustc-demangle/.cargo-checksum.json cargo-0.37.0/vendor/rustc-demangle/.cargo-checksum.json --- cargo-0.35.0/vendor/rustc-demangle/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rustc-demangle/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"ccc78bfd5acd7bf3e89cffcf899e5cb1a52d6fafa8dec2739ad70c9577a57288"} \ No newline at end of file +{"files":{},"package":"a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/rustc-demangle/Cargo.toml cargo-0.37.0/vendor/rustc-demangle/Cargo.toml --- cargo-0.35.0/vendor/rustc-demangle/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rustc-demangle/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "rustc-demangle" -version = "0.1.14" +version = "0.1.15" authors = ["Alex Crichton "] description = "Rust compiler symbol demangling.\n" homepage = "https://github.com/alexcrichton/rustc-demangle" diff -Nru cargo-0.35.0/vendor/rustc-demangle/src/v0.rs cargo-0.37.0/vendor/rustc-demangle/src/v0.rs --- cargo-0.35.0/vendor/rustc-demangle/src/v0.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/rustc-demangle/src/v0.rs 2019-07-17 05:42:23.000000000 +0000 @@ -164,7 +164,7 @@ let d = match punycode_bytes.next() { Some(d @ b'a'...b'z') => d - b'a', - Some(d @ b'A'...b'J') => 26 + (d - b'A'), + Some(d @ b'0'...b'9') => 26 + (d - b'0'), _ => return Err(()), }; let d = d as usize; @@ -226,18 +226,12 @@ try!(f.write_str("punycode{")); // Reconstruct a standard Punycode encoding, - // by using `-` as the separator and replacing - // [A-J] with [0-9] (in the base36 codes). + // by using `-` as the separator. if !self.ascii.is_empty() { try!(f.write_str(self.ascii)); try!(f.write_str("-")); } - for mut b in self.punycode.bytes() { - if let b'A'...b'J' = b { - b = b - b'A' + b'0'; - } - try!((b as char).fmt(f)); - } + try!(f.write_str(self.punycode)); f.write_str("}") } else { @@ -396,6 +390,9 @@ } } + // Skip past the optional `_` separator. + self.eat(b'_'); + let start = self.next; self.next = try!(self.next.checked_add(len).ok_or(Invalid)); if self.next > self.sym.len() { @@ -688,16 +685,7 @@ let dis = parse!(self, disambiguator); let name = parse!(self, ident); - if name.punycode.is_empty() { - // Unescape `_[0-9_]`. - let mut name = name.ascii; - if name.starts_with("_") { - name = &name[1..]; - } - try!(self.out.write_str(name)); - } else { - try!(name.fmt(self.out)); - } + try!(name.fmt(self.out)); if !self.out.alternate() { try!(self.out.write_str("[")); try!(fmt::LowerHex::fmt(&dis, self.out)); @@ -1016,9 +1004,17 @@ } #[test] + fn demangle_crate_with_leading_digit() { + t_nohash!( + "_RNvC6_123foo3bar", + "123foo::bar" + ); + } + + #[test] fn demangle_utf8_idents() { t_nohash!( - "_RNqCs4fqI2P2rA04_11utf8_identsu30___HhkackfeceaBcbdathfdhJhlqGy", + "_RNqCs4fqI2P2rA04_11utf8_identsu30____7hkackfecea1cbdathfdh9hlq6y", "utf8_idents::საჭმელად_გემრიელი_სადილი" ); } diff -Nru cargo-0.35.0/vendor/ryu/benches/bench.rs cargo-0.37.0/vendor/ryu/benches/bench.rs --- cargo-0.35.0/vendor/ryu/benches/bench.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/ryu/benches/bench.rs 2019-07-17 05:42:23.000000000 +0000 @@ -18,7 +18,7 @@ b.iter(move || { let value = black_box($value); - let formatted = buf.format(value); + let formatted = buf.format_finite(value); black_box(formatted); }); } @@ -51,7 +51,6 @@ bench_short_f64(0.1234f64), bench_e_f64(2.718281828459045f64), bench_max_f64(::std::f64::MAX), - bench_0_f32(0f32), bench_short_f32(0.1234f32), bench_e_f32(2.718281828459045f32), diff -Nru cargo-0.35.0/vendor/ryu/.cargo-checksum.json cargo-0.37.0/vendor/ryu/.cargo-checksum.json --- cargo-0.35.0/vendor/ryu/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/ryu/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"b96a9549dc8d48f2c283938303c4b5a77aa29bfbc5b54b084fb1630408899a8f"} \ No newline at end of file +{"files":{},"package":"c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/ryu/Cargo.toml cargo-0.37.0/vendor/ryu/Cargo.toml --- cargo-0.35.0/vendor/ryu/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/ryu/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "ryu" -version = "0.2.8" +version = "1.0.0" authors = ["David Tolnay "] build = "build.rs" description = "Fast floating point to string conversion" diff -Nru cargo-0.35.0/vendor/ryu/examples/upstream_benchmark.rs cargo-0.37.0/vendor/ryu/examples/upstream_benchmark.rs --- cargo-0.35.0/vendor/ryu/examples/upstream_benchmark.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/ryu/examples/upstream_benchmark.rs 2019-07-17 05:42:23.000000000 +0000 @@ -56,7 +56,7 @@ let t1 = std::time::SystemTime::now(); for _ in 0..ITERATIONS { - throwaway += ryu::Buffer::new().format(f).len(); + throwaway += ryu::Buffer::new().format_finite(f).len(); } let duration = t1.elapsed().unwrap(); let nanos = duration.as_secs() * 1_000_000_000 + duration.subsec_nanos() as u64; diff -Nru cargo-0.35.0/vendor/ryu/README.md cargo-0.37.0/vendor/ryu/README.md --- cargo-0.35.0/vendor/ryu/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/ryu/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -13,22 +13,17 @@ under the creative commons CC-BY-SA license. This Rust implementation is a line-by-line port of Ulf Adams' implementation in -C, [https://github.com/ulfjack/ryu][upstream]. The `ryu::raw` module exposes -exactly the API and formatting of the C implementation as unsafe pure Rust -functions. There is additionally a safe API as demonstrated in the example code -below. The safe API uses the same underlying Ryū algorithm but diverges from the -formatting of the C implementation to produce more human-readable output, for -example `0.3` rather than `3E-1`. +C, [https://github.com/ulfjack/ryu][upstream]. *Requirements: this crate supports any compiler version back to rustc 1.15; it uses nothing from the Rust standard library so is usable from no_std crates.* [paper]: https://dl.acm.org/citation.cfm?id=3192369 -[upstream]: https://github.com/ulfjack/ryu/tree/795c8b57aa454c723194bbea8e4bf2ccd28e865f +[upstream]: https://github.com/ulfjack/ryu/tree/688f43b62276b400728baad54afc32c3ab9c1a95 ```toml [dependencies] -ryu = "0.2" +ryu = "1.0" ``` ## Example @@ -100,9 +95,20 @@ Both libraries print short decimals such as 0.0000123 without scientific notation. -## License +
-Licensed under either of the following at your option. +#### License -- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) -- Boost Software License 1.0 ([LICENSE-BOOST](LICENSE-BOOST) or https://www.boost.org/LICENSE_1_0.txt) + +Licensed under either of
Apache License, Version +2.0 or Boost Software License 1.0 at your +option. + + +
+ + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in this crate by you, as defined in the Apache-2.0 license, shall +be dual licensed as above, without any additional terms or conditions. + diff -Nru cargo-0.35.0/vendor/ryu/src/buffer/mod.rs cargo-0.37.0/vendor/ryu/src/buffer/mod.rs --- cargo-0.35.0/vendor/ryu/src/buffer/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/ryu/src/buffer/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,17 +1,21 @@ use core::{mem, slice, str}; -use pretty; +use raw; #[cfg(feature = "no-panic")] use no_panic::no_panic; +const NAN: &'static str = "NaN"; +const INFINITY: &'static str = "inf"; +const NEG_INFINITY: &'static str = "-inf"; + /// Safe API for formatting floating point numbers to text. /// /// ## Example /// /// ```edition2018 /// let mut buffer = ryu::Buffer::new(); -/// let printed = buffer.format(1.234); +/// let printed = buffer.format_finite(1.234); /// assert_eq!(printed, "1.234"); /// ``` #[derive(Copy, Clone)] @@ -35,6 +39,27 @@ /// /// # Special cases /// + /// This function formats NaN as the string "NaN", positive infinity as + /// "inf", and negative infinity as "-inf" to match std::fmt. + /// + /// If your input is known to be finite, you may get better performance by + /// calling the `format_finite` method instead of `format` to avoid the + /// checks for special cases. + #[cfg_attr(feature = "no-panic", inline)] + #[cfg_attr(feature = "no-panic", no_panic)] + pub fn format(&mut self, f: F) -> &str { + if f.is_nonfinite() { + f.format_nonfinite() + } else { + self.format_finite(f) + } + } + + /// Print a floating point number into this buffer and return a reference to + /// its string representation within the buffer. + /// + /// # Special cases + /// /// This function **does not** check for NaN or infinity. If the input /// number is not a finite float, the printed representation will be some /// correctly formatted but unspecified numerical value. @@ -47,7 +72,7 @@ /// [`is_infinite`]: https://doc.rust-lang.org/std/primitive.f64.html#method.is_infinite #[inline] #[cfg_attr(feature = "no-panic", no_panic)] - pub fn format(&mut self, f: F) -> &str { + pub fn format_finite(&mut self, f: F) -> &str { unsafe { let n = f.write_to_ryu_buffer(&mut self.bytes[0]); debug_assert!(n <= self.bytes.len()); @@ -70,28 +95,70 @@ /// /// This trait is sealed and cannot be implemented for types outside of the /// `ryu` crate. -pub trait Float: Sealed { - // Not public API. - #[doc(hidden)] +pub trait Float: Sealed {} +impl Float for f32 {} +impl Float for f64 {} + +pub trait Sealed: Copy { + fn is_nonfinite(self) -> bool; + fn format_nonfinite(self) -> &'static str; unsafe fn write_to_ryu_buffer(self, result: *mut u8) -> usize; } -impl Float for f32 { +impl Sealed for f32 { + #[inline] + fn is_nonfinite(self) -> bool { + const EXP_MASK: u32 = 0x7f800000; + let bits = unsafe { mem::transmute::(self) }; + bits & EXP_MASK == EXP_MASK + } + + #[cold] + #[cfg_attr(feature = "no-panic", inline)] + fn format_nonfinite(self) -> &'static str { + const MANTISSA_MASK: u32 = 0x007fffff; + const SIGN_MASK: u32 = 0x80000000; + let bits = unsafe { mem::transmute::(self) }; + if bits & MANTISSA_MASK != 0 { + NAN + } else if bits & SIGN_MASK != 0 { + NEG_INFINITY + } else { + INFINITY + } + } + #[inline] - #[cfg_attr(feature = "no-panic", no_panic)] unsafe fn write_to_ryu_buffer(self, result: *mut u8) -> usize { - pretty::f2s_buffered_n(self, result) + raw::format32(self, result) } } -impl Float for f64 { +impl Sealed for f64 { + #[inline] + fn is_nonfinite(self) -> bool { + const EXP_MASK: u64 = 0x7ff0000000000000; + let bits = unsafe { mem::transmute::(self) }; + bits & EXP_MASK == EXP_MASK + } + + #[cold] + #[cfg_attr(feature = "no-panic", inline)] + fn format_nonfinite(self) -> &'static str { + const MANTISSA_MASK: u64 = 0x000fffffffffffff; + const SIGN_MASK: u64 = 0x8000000000000000; + let bits = unsafe { mem::transmute::(self) }; + if bits & MANTISSA_MASK != 0 { + NAN + } else if bits & SIGN_MASK != 0 { + NEG_INFINITY + } else { + INFINITY + } + } + #[inline] - #[cfg_attr(feature = "no-panic", no_panic)] unsafe fn write_to_ryu_buffer(self, result: *mut u8) -> usize { - pretty::d2s_buffered_n(self, result) + raw::format64(self, result) } } - -pub trait Sealed {} -impl Sealed for f32 {} -impl Sealed for f64 {} diff -Nru cargo-0.35.0/vendor/ryu/src/common.rs cargo-0.37.0/vendor/ryu/src/common.rs --- cargo-0.35.0/vendor/ryu/src/common.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/ryu/src/common.rs 2019-07-17 05:42:23.000000000 +0000 @@ -18,7 +18,32 @@ // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. -use core::ptr; +#[cfg_attr(feature = "no-panic", inline)] +pub fn decimal_length9(v: u32) -> u32 { + // Function precondition: v is not a 10-digit number. + // (f2s: 9 digits are sufficient for round-tripping.) + debug_assert!(v < 1000000000); + + if v >= 100000000 { + 9 + } else if v >= 10000000 { + 8 + } else if v >= 1000000 { + 7 + } else if v >= 100000 { + 6 + } else if v >= 10000 { + 5 + } else if v >= 1000 { + 4 + } else if v >= 100 { + 3 + } else if v >= 10 { + 2 + } else { + 1 + } +} // Returns e == 0 ? 1 : ceil(log_2(5^e)). #[cfg_attr(feature = "no-panic", inline)] @@ -48,25 +73,3 @@ debug_assert!(e <= 2620); (e as u32 * 732923) >> 20 } - -#[cfg_attr(feature = "no-panic", inline)] -pub unsafe fn copy_special_str( - result: *mut u8, - sign: bool, - exponent: bool, - mantissa: bool, -) -> usize { - if mantissa { - ptr::copy_nonoverlapping(b"NaN".as_ptr(), result, 3); - return 3; - } - if sign { - *result = b'-'; - } - if exponent { - ptr::copy_nonoverlapping(b"Infinity".as_ptr(), result.offset(sign as isize), 8); - return sign as usize + 8; - } - ptr::copy_nonoverlapping(b"0E0".as_ptr(), result.offset(sign as isize), 3); - sign as usize + 3 -} diff -Nru cargo-0.35.0/vendor/ryu/src/d2s_intrinsics.rs cargo-0.37.0/vendor/ryu/src/d2s_intrinsics.rs --- cargo-0.35.0/vendor/ryu/src/d2s_intrinsics.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/ryu/src/d2s_intrinsics.rs 2019-07-17 05:42:23.000000000 +0000 @@ -44,7 +44,7 @@ let mid2_hi = (mid2 >> 32) as u32; let p_hi = b11 + mid1_hi as u64 + mid2_hi as u64; - let p_lo = ((mid2_lo as u64) << 32) + b00_lo as u64; + let p_lo = ((mid2_lo as u64) << 32) | b00_lo as u64; (p_lo, p_hi) } @@ -74,6 +74,32 @@ } #[cfg_attr(feature = "no-panic", inline)] -pub fn div100_000_000(x: u64) -> u64 { - x / 100_000_000 +fn pow5_factor(mut value: u64) -> u32 { + let mut count = 0u32; + loop { + debug_assert!(value != 0); + let q = div5(value); + let r = (value as u32).wrapping_sub(5u32.wrapping_mul(q as u32)); + if r != 0 { + break; + } + value = q; + count += 1; + } + count +} + +// Returns true if value is divisible by 5^p. +#[cfg_attr(feature = "no-panic", inline)] +pub fn multiple_of_power_of_5(value: u64, p: u32) -> bool { + // I tried a case distinction on p, but there was no performance difference. + pow5_factor(value) >= p +} + +// Returns true if value is divisible by 2^p. +#[cfg_attr(feature = "no-panic", inline)] +pub fn multiple_of_power_of_2(value: u64, p: u32) -> bool { + debug_assert!(value != 0); + // return __builtin_ctzll(value) >= p; + (value & ((1u64 << p) - 1)) == 0 } diff -Nru cargo-0.35.0/vendor/ryu/src/d2s.rs cargo-0.37.0/vendor/ryu/src/d2s.rs --- cargo-0.35.0/vendor/ryu/src/d2s.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/ryu/src/d2s.rs 2019-07-17 05:42:23.000000000 +0000 @@ -18,18 +18,14 @@ // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. -use core::{mem, ptr}; +use core::mem; use common::*; #[cfg(not(feature = "small"))] use d2s_full_table::*; +use d2s_intrinsics::*; #[cfg(feature = "small")] use d2s_small_table::*; -use digit_table::*; -use d2s_intrinsics::*; - -#[cfg(feature = "no-panic")] -use no_panic::no_panic; pub const DOUBLE_MANTISSA_BITS: u32 = 52; pub const DOUBLE_EXPONENT_BITS: u32 = 11; @@ -38,36 +34,6 @@ const DOUBLE_POW5_INV_BITCOUNT: i32 = 122; const DOUBLE_POW5_BITCOUNT: i32 = 121; -#[cfg_attr(feature = "no-panic", inline)] -fn pow5_factor(mut value: u64) -> u32 { - let mut count = 0u32; - loop { - debug_assert!(value != 0); - let q = div5(value); - let r = (value - 5 * q) as u32; - if r != 0 { - break; - } - value = q; - count += 1; - } - count -} - -// Returns true if value is divisible by 5^p. -#[cfg_attr(feature = "no-panic", inline)] -fn multiple_of_power_of_5(value: u64, p: u32) -> bool { - // I tried a case distinction on p, but there was no performance difference. - pow5_factor(value) >= p -} - -// Returns true if value is divisible by 2^p. -#[cfg_attr(feature = "no-panic", inline)] -fn multiple_of_power_of_2(value: u64, p: u32) -> bool { - // return __builtin_ctzll(value) >= p; - (value & ((1u64 << p) - 1)) == 0 -} - #[cfg(integer128)] #[cfg_attr(feature = "no-panic", inline)] fn mul_shift(m: u64, mul: &(u64, u64), j: u32) -> u64 { @@ -132,7 +98,7 @@ } #[cfg_attr(feature = "no-panic", inline)] -pub fn decimal_length(v: u64) -> u32 { +pub fn decimal_length17(v: u64) -> u32 { // This is slightly faster than a loop. // The average output length is 16.38 digits, so we check high-to-low. // Function precondition: v is not an 18, 19, or 20-digit number. @@ -179,6 +145,8 @@ // A floating decimal representing m * 10^e. pub struct FloatingDecimal64 { pub mantissa: u64, + // Decimal exponent's range is -324 to 308 + // inclusive, and can fit in i16 if needed. pub exponent: i32, } @@ -241,7 +209,7 @@ // This should use q <= 22, but I think 21 is also safe. Smaller values // may still be safe, but it's more difficult to reason about them. // Only one of mp, mv, and mm can be a multiple of 5, if any. - let mv_mod5 = (mv - 5 * div5(mv)) as u32; + let mv_mod5 = (mv as u32).wrapping_sub(5u32.wrapping_mul(div5(mv) as u32)); if mv_mod5 == 0 { vr_is_trailing_zeros = multiple_of_power_of_5(mv, q); } else if accept_bounds { @@ -290,12 +258,11 @@ } } else if q < 63 { // TODO(ulfjack): Use a tighter bound here. - // We need to compute min(ntz(mv), pow5_factor(mv) - e2) >= q - 1 - // <=> ntz(mv) >= q - 1 && pow5_factor(mv) - e2 >= q - 1 - // <=> ntz(mv) >= q - 1 (e2 is negative and -e2 >= q) - // <=> (mv & ((1 << (q - 1)) - 1)) == 0 - // We also need to make sure that the left shift does not overflow. - vr_is_trailing_zeros = multiple_of_power_of_2(mv, q - 1); + // We want to know if the full product has at least q trailing zeros. + // We need to compute min(p2(mv), p5(mv) - e2) >= q + // <=> p2(mv) >= q && p5(mv) - e2 >= q + // <=> p2(mv) >= q (because -e2 >= q) + vr_is_trailing_zeros = multiple_of_power_of_2(mv, q); } } @@ -311,9 +278,9 @@ if vp_div10 <= vm_div10 { break; } - let vm_mod10 = (vm - 10 * vm_div10) as u32; + let vm_mod10 = (vm as u32).wrapping_sub(10u32.wrapping_mul(vm_div10 as u32)); let vr_div10 = div10(vr); - let vr_mod10 = (vr - 10 * vr_div10) as u32; + let vr_mod10 = (vr as u32).wrapping_sub(10u32.wrapping_mul(vr_div10 as u32)); vm_is_trailing_zeros &= vm_mod10 == 0; vr_is_trailing_zeros &= last_removed_digit == 0; last_removed_digit = vr_mod10 as u8; @@ -325,13 +292,13 @@ if vm_is_trailing_zeros { loop { let vm_div10 = div10(vm); - let vm_mod10 = (vm - 10 * vm_div10) as u32; + let vm_mod10 = (vm as u32).wrapping_sub(10u32.wrapping_mul(vm_div10 as u32)); if vm_mod10 != 0 { break; } let vp_div10 = div10(vp); let vr_div10 = div10(vr); - let vr_mod10 = (vr - 10 * vr_div10) as u32; + let vr_mod10 = (vr as u32).wrapping_sub(10u32.wrapping_mul(vr_div10 as u32)); vr_is_trailing_zeros &= last_removed_digit == 0; last_removed_digit = vr_mod10 as u8; vr = vr_div10; @@ -355,7 +322,7 @@ // Optimization: remove two digits at a time (~86.2%). if vp_div100 > vm_div100 { let vr_div100 = div100(vr); - let vr_mod100 = (vr - 100 * vr_div100) as u32; + let vr_mod100 = (vr as u32).wrapping_sub(100u32.wrapping_mul(vr_div100 as u32)); round_up = vr_mod100 >= 50; vr = vr_div100; vp = vp_div100; @@ -373,7 +340,7 @@ break; } let vr_div10 = div10(vr); - let vr_mod10 = (vr - 10 * vr_div10) as u32; + let vr_mod10 = (vr as u32).wrapping_sub(10u32.wrapping_mul(vr_div10 as u32)); round_up = vr_mod10 >= 5; vr = vr_div10; vp = vp_div10; @@ -390,192 +357,3 @@ mantissa: output, } } - -#[cfg_attr(feature = "no-panic", inline)] -unsafe fn to_chars(v: FloatingDecimal64, sign: bool, result: *mut u8) -> usize { - // Step 5: Print the decimal representation. - let mut index = 0isize; - if sign { - *result.offset(index) = b'-'; - index += 1; - } - - let mut output = v.mantissa; - let olength = decimal_length(output); - - // Print the decimal digits. - // The following code is equivalent to: - // for (uint32_t i = 0; i < olength - 1; ++i) { - // const uint32_t c = output % 10; output /= 10; - // result[index + olength - i] = (char) ('0' + c); - // } - // result[index] = '0' + output % 10; - - let mut i = 0isize; - // We prefer 32-bit operations, even on 64-bit platforms. - // We have at most 17 digits, and uint32_t can store 9 digits. - // If output doesn't fit into uint32_t, we cut off 8 digits, - // so the rest will fit into uint32_t. - if (output >> 32) != 0 { - // Expensive 64-bit division. - let q = div100_000_000(output); - let mut output2 = (output - 100_000_000 * q) as u32; - output = q; - - let c = output2 % 10000; - output2 /= 10000; - let d = output2 % 10000; - let c0 = (c % 100) << 1; - let c1 = (c / 100) << 1; - let d0 = (d % 100) << 1; - let d1 = (d / 100) << 1; - ptr::copy_nonoverlapping( - DIGIT_TABLE.get_unchecked(c0 as usize), - result.offset(index + olength as isize - i - 1), - 2, - ); - ptr::copy_nonoverlapping( - DIGIT_TABLE.get_unchecked(c1 as usize), - result.offset(index + olength as isize - i - 3), - 2, - ); - ptr::copy_nonoverlapping( - DIGIT_TABLE.get_unchecked(d0 as usize), - result.offset(index + olength as isize - i - 5), - 2, - ); - ptr::copy_nonoverlapping( - DIGIT_TABLE.get_unchecked(d1 as usize), - result.offset(index + olength as isize - i - 7), - 2, - ); - i += 8; - } - let mut output2 = output as u32; - while output2 >= 10000 { - let c = (output2 - 10000 * (output2 / 10000)) as u32; - output2 /= 10000; - let c0 = (c % 100) << 1; - let c1 = (c / 100) << 1; - ptr::copy_nonoverlapping( - DIGIT_TABLE.get_unchecked(c0 as usize), - result.offset(index + olength as isize - i - 1), - 2, - ); - ptr::copy_nonoverlapping( - DIGIT_TABLE.get_unchecked(c1 as usize), - result.offset(index + olength as isize - i - 3), - 2, - ); - i += 4; - } - if output2 >= 100 { - let c = ((output2 % 100) << 1) as u32; - output2 /= 100; - ptr::copy_nonoverlapping( - DIGIT_TABLE.get_unchecked(c as usize), - result.offset(index + olength as isize - i - 1), - 2, - ); - i += 2; - } - if output2 >= 10 { - let c = (output2 << 1) as u32; - // We can't use memcpy here: the decimal dot goes between these two digits. - *result.offset(index + olength as isize - i) = *DIGIT_TABLE.get_unchecked(c as usize + 1); - *result.offset(index) = *DIGIT_TABLE.get_unchecked(c as usize); - } else { - *result.offset(index) = b'0' + output2 as u8; - } - - // Print decimal point if needed. - if olength > 1 { - *result.offset(index + 1) = b'.'; - index += olength as isize + 1; - } else { - index += 1; - } - - // Print the exponent. - *result.offset(index) = b'E'; - index += 1; - let mut exp = v.exponent as i32 + olength as i32 - 1; - if exp < 0 { - *result.offset(index) = b'-'; - index += 1; - exp = -exp; - } - - if exp >= 100 { - let c = exp % 10; - ptr::copy_nonoverlapping( - DIGIT_TABLE.get_unchecked((2 * (exp / 10)) as usize), - result.offset(index), - 2, - ); - *result.offset(index + 2) = b'0' + c as u8; - index += 3; - } else if exp >= 10 { - ptr::copy_nonoverlapping( - DIGIT_TABLE.get_unchecked((2 * exp) as usize), - result.offset(index), - 2, - ); - index += 2; - } else { - *result.offset(index) = b'0' + exp as u8; - index += 1; - } - - debug_assert!(index <= 24); - index as usize -} - -/// Print f64 to the given buffer and return number of bytes written. Ryū's -/// original formatting. -/// -/// At most 24 bytes will be written. -/// -/// ## Special cases -/// -/// This function represents any NaN as `NaN`, positive infinity as `Infinity`, -/// and negative infinity as `-Infinity`. -/// -/// ## Safety -/// -/// The `result` pointer argument must point to sufficiently many writable bytes -/// to hold Ryū's representation of `f`. -/// -/// ## Example -/// -/// ```edition2018 -/// let f = 1.234f64; -/// -/// unsafe { -/// let mut buffer: [u8; 24] = std::mem::uninitialized(); -/// let n = ryu::raw::d2s_buffered_n(f, &mut buffer[0]); -/// let s = std::str::from_utf8_unchecked(&buffer[..n]); -/// assert_eq!(s, "1.234E0"); -/// } -/// ``` -#[cfg_attr(must_use_return, must_use)] -#[cfg_attr(feature = "no-panic", no_panic)] -pub unsafe fn d2s_buffered_n(f: f64, result: *mut u8) -> usize { - // Step 1: Decode the floating-point number, and unify normalized and subnormal cases. - let bits = mem::transmute::(f); - - // Decode bits into sign, mantissa, and exponent. - let ieee_sign = ((bits >> (DOUBLE_MANTISSA_BITS + DOUBLE_EXPONENT_BITS)) & 1) != 0; - let ieee_mantissa = bits & ((1u64 << DOUBLE_MANTISSA_BITS) - 1); - let ieee_exponent = - (bits >> DOUBLE_MANTISSA_BITS) as u32 & ((1u32 << DOUBLE_EXPONENT_BITS) - 1); - // Case distinction; exit early for the easy cases. - if ieee_exponent == ((1u32 << DOUBLE_EXPONENT_BITS) - 1) - || (ieee_exponent == 0 && ieee_mantissa == 0) - { - return copy_special_str(result, ieee_sign, ieee_exponent != 0, ieee_mantissa != 0); - } - - let v = d2d(ieee_mantissa, ieee_exponent); - to_chars(v, ieee_sign, result) -} diff -Nru cargo-0.35.0/vendor/ryu/src/f2s.rs cargo-0.37.0/vendor/ryu/src/f2s.rs --- cargo-0.35.0/vendor/ryu/src/f2s.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/ryu/src/f2s.rs 2019-07-17 05:42:23.000000000 +0000 @@ -18,13 +18,7 @@ // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. -use core::{mem, ptr}; - use common::*; -use digit_table::*; - -#[cfg(feature = "no-panic")] -use no_panic::no_panic; pub const FLOAT_MANTISSA_BITS: u32 = 23; pub const FLOAT_EXPONENT_BITS: u32 = 8; @@ -179,36 +173,11 @@ unsafe { mul_shift(m, *FLOAT_POW5_SPLIT.get_unchecked(i as usize), j) } } -#[cfg_attr(feature = "no-panic", inline)] -pub fn decimal_length(v: u32) -> u32 { - // Function precondition: v is not a 10-digit number. - // (9 digits are sufficient for round-tripping.) - debug_assert!(v < 1000000000); - - if v >= 100000000 { - 9 - } else if v >= 10000000 { - 8 - } else if v >= 1000000 { - 7 - } else if v >= 100000 { - 6 - } else if v >= 10000 { - 5 - } else if v >= 1000 { - 4 - } else if v >= 100 { - 3 - } else if v >= 10 { - 2 - } else { - 1 - } -} - // A floating decimal representing m * 10^e. pub struct FloatingDecimal32 { pub mantissa: u32, + // Decimal exponent's range is -45 to 38 + // inclusive, and can fit in i16 if needed. pub exponent: i32, } @@ -352,143 +321,3 @@ mantissa: output, } } - -#[cfg_attr(feature = "no-panic", inline)] -unsafe fn to_chars(v: FloatingDecimal32, sign: bool, result: *mut u8) -> usize { - // Step 5: Print the decimal representation. - let mut index = 0isize; - if sign { - *result.offset(index) = b'-'; - index += 1; - } - - let mut output = v.mantissa; - let olength = decimal_length(output); - - // Print the decimal digits. - // The following code is equivalent to: - // for (uint32_t i = 0; i < olength - 1; ++i) { - // const uint32_t c = output % 10; output /= 10; - // result[index + olength - i] = (char) ('0' + c); - // } - // result[index] = '0' + output % 10; - let mut i = 0isize; - while output >= 10000 { - let c = output - 10000 * (output / 10000); - output /= 10000; - let c0 = (c % 100) << 1; - let c1 = (c / 100) << 1; - ptr::copy_nonoverlapping( - DIGIT_TABLE.get_unchecked(c0 as usize), - result.offset(index + olength as isize - i - 1), - 2, - ); - ptr::copy_nonoverlapping( - DIGIT_TABLE.get_unchecked(c1 as usize), - result.offset(index + olength as isize - i - 3), - 2, - ); - i += 4; - } - if output >= 100 { - let c = (output % 100) << 1; - output /= 100; - ptr::copy_nonoverlapping( - DIGIT_TABLE.get_unchecked(c as usize), - result.offset(index + olength as isize - i - 1), - 2, - ); - i += 2; - } - if output >= 10 { - let c = output << 1; - // We can't use memcpy here: the decimal dot goes between these two digits. - *result.offset(index + olength as isize - i) = *DIGIT_TABLE.get_unchecked(c as usize + 1); - *result.offset(index) = *DIGIT_TABLE.get_unchecked(c as usize); - } else { - *result.offset(index) = b'0' + output as u8; - } - - // Print decimal point if needed. - if olength > 1 { - *result.offset(index + 1) = b'.'; - index += olength as isize + 1; - } else { - index += 1; - } - - // Print the exponent. - *result.offset(index) = b'E'; - index += 1; - let mut exp = v.exponent + olength as i32 - 1; - if exp < 0 { - *result.offset(index) = b'-'; - index += 1; - exp = -exp; - } - - if exp >= 10 { - ptr::copy_nonoverlapping( - DIGIT_TABLE.get_unchecked((2 * exp) as usize), - result.offset(index), - 2, - ); - index += 2; - } else { - *result.offset(index) = b'0' + exp as u8; - index += 1; - } - - debug_assert!(index <= 15); - index as usize -} - -/// Print f32 to the given buffer and return number of bytes written. Ryū's -/// original formatting. -/// -/// At most 15 bytes will be written. -/// -/// ## Special cases -/// -/// This function represents any NaN as `NaN`, positive infinity as `Infinity`, -/// and negative infinity as `-Infinity`. -/// -/// ## Safety -/// -/// The `result` pointer argument must point to sufficiently many writable bytes -/// to hold Ryū's representation of `f`. -/// -/// ## Example -/// -/// ```edition2018 -/// let f = 1.234f32; -/// -/// unsafe { -/// let mut buffer: [u8; 15] = std::mem::uninitialized(); -/// let n = ryu::raw::f2s_buffered_n(f, &mut buffer[0]); -/// let s = std::str::from_utf8_unchecked(&buffer[..n]); -/// assert_eq!(s, "1.234E0"); -/// } -/// ``` -#[cfg_attr(must_use_return, must_use)] -#[cfg_attr(feature = "no-panic", no_panic)] -pub unsafe fn f2s_buffered_n(f: f32, result: *mut u8) -> usize { - // Step 1: Decode the floating-point number, and unify normalized and subnormal cases. - let bits = mem::transmute::(f); - - // Decode bits into sign, mantissa, and exponent. - let ieee_sign = ((bits >> (FLOAT_MANTISSA_BITS + FLOAT_EXPONENT_BITS)) & 1) != 0; - let ieee_mantissa = bits & ((1u32 << FLOAT_MANTISSA_BITS) - 1); - let ieee_exponent = - ((bits >> FLOAT_MANTISSA_BITS) & ((1u32 << FLOAT_EXPONENT_BITS) - 1)) as u32; - - // Case distinction; exit early for the easy cases. - if ieee_exponent == ((1u32 << FLOAT_EXPONENT_BITS) - 1) - || (ieee_exponent == 0 && ieee_mantissa == 0) - { - return copy_special_str(result, ieee_sign, ieee_exponent != 0, ieee_mantissa != 0); - } - - let v = f2d(ieee_mantissa, ieee_exponent); - to_chars(v, ieee_sign, result) -} diff -Nru cargo-0.35.0/vendor/ryu/src/lib.rs cargo-0.37.0/vendor/ryu/src/lib.rs --- cargo-0.35.0/vendor/ryu/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/ryu/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -6,16 +6,10 @@ //! available under the creative commons CC-BY-SA license. //! //! This Rust implementation is a line-by-line port of Ulf Adams' implementation -//! in C, [https://github.com/ulfjack/ryu][upstream]. The [`ryu::raw`][raw] -//! module exposes exactly the API and formatting of the C implementation as -//! unsafe pure Rust functions. There is additionally a safe API as demonstrated -//! in the example code below. The safe API uses the same underlying Ryū -//! algorithm but diverges from the formatting of the C implementation to -//! produce more human-readable output, for example `0.3` rather than `3E-1`. +//! in C, [https://github.com/ulfjack/ryu][upstream]. //! //! [paper]: https://dl.acm.org/citation.cfm?id=3192369 //! [upstream]: https://github.com/ulfjack/ryu -//! [raw]: raw/index.html //! //! # Example //! @@ -87,17 +81,11 @@ //! notation. #![no_std] -#![doc(html_root_url = "https://docs.rs/ryu/0.2.8")] +#![doc(html_root_url = "https://docs.rs/ryu/1.0.0")] #![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] #![cfg_attr( feature = "cargo-clippy", - allow( - cast_lossless, - cyclomatic_complexity, - many_single_char_names, - needless_pass_by_value, - unreadable_literal, - ) + allow(cast_lossless, many_single_char_names, unreadable_literal,) )] #[cfg(feature = "no-panic")] @@ -117,10 +105,7 @@ pub use buffer::{Buffer, Float}; -/// Unsafe functions that exactly mirror the API of the C implementation of Ryū. +/// Unsafe functions that mirror the API of the C implementation of Ryū. pub mod raw { - pub use d2s::d2s_buffered_n; - pub use f2s::f2s_buffered_n; - pub use pretty::d2s_buffered_n as pretty_d2s_buffered_n; - pub use pretty::f2s_buffered_n as pretty_f2s_buffered_n; + pub use pretty::{format32, format64}; } diff -Nru cargo-0.35.0/vendor/ryu/src/pretty/mod.rs cargo-0.37.0/vendor/ryu/src/pretty/mod.rs --- cargo-0.35.0/vendor/ryu/src/pretty/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/ryu/src/pretty/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -5,16 +5,15 @@ use self::exponent::*; use self::mantissa::*; +use common; use d2s; use d2s::*; -use f2s; use f2s::*; #[cfg(feature = "no-panic")] use no_panic::no_panic; -/// Print f64 to the given buffer and return number of bytes written. Human -/// readable formatting. +/// Print f64 to the given buffer and return number of bytes written. /// /// At most 24 bytes will be written. /// @@ -43,14 +42,15 @@ /// /// unsafe { /// let mut buffer: [u8; 24] = std::mem::uninitialized(); -/// let n = ryu::raw::pretty_d2s_buffered_n(f, &mut buffer[0]); -/// let s = std::str::from_utf8_unchecked(&buffer[..n]); -/// assert_eq!(s, "1.234"); +/// let len = ryu::raw::format64(f, buffer.as_mut_ptr()); +/// let slice = std::slice::from_raw_parts(buffer.as_ptr(), len); +/// let print = std::str::from_utf8_unchecked(slice); +/// assert_eq!(print, "1.234"); /// } /// ``` #[cfg_attr(must_use_return, must_use)] #[cfg_attr(feature = "no-panic", no_panic)] -pub unsafe fn d2s_buffered_n(f: f64, result: *mut u8) -> usize { +pub unsafe fn format64(f: f64, result: *mut u8) -> usize { let bits = mem::transmute::(f); let sign = ((bits >> (DOUBLE_MANTISSA_BITS + DOUBLE_EXPONENT_BITS)) & 1) != 0; let ieee_mantissa = bits & ((1u64 << DOUBLE_MANTISSA_BITS) - 1); @@ -70,7 +70,7 @@ let v = d2d(ieee_mantissa, ieee_exponent); - let length = d2s::decimal_length(v.mantissa) as isize; + let length = d2s::decimal_length17(v.mantissa) as isize; let k = v.exponent as isize; let kk = length + k; // 10^(kk-1) <= v < 10^kk debug_assert!(k >= -324); @@ -118,8 +118,7 @@ } } -/// Print f32 to the given buffer and return number of bytes written. Human -/// readable formatting. +/// Print f32 to the given buffer and return number of bytes written. /// /// At most 16 bytes will be written. /// @@ -148,14 +147,15 @@ /// /// unsafe { /// let mut buffer: [u8; 16] = std::mem::uninitialized(); -/// let n = ryu::raw::pretty_f2s_buffered_n(f, &mut buffer[0]); -/// let s = std::str::from_utf8_unchecked(&buffer[..n]); -/// assert_eq!(s, "1.234"); +/// let len = ryu::raw::format32(f, buffer.as_mut_ptr()); +/// let slice = std::slice::from_raw_parts(buffer.as_ptr(), len); +/// let print = std::str::from_utf8_unchecked(slice); +/// assert_eq!(print, "1.234"); /// } /// ``` #[cfg_attr(must_use_return, must_use)] #[cfg_attr(feature = "no-panic", no_panic)] -pub unsafe fn f2s_buffered_n(f: f32, result: *mut u8) -> usize { +pub unsafe fn format32(f: f32, result: *mut u8) -> usize { let bits = mem::transmute::(f); let sign = ((bits >> (FLOAT_MANTISSA_BITS + FLOAT_EXPONENT_BITS)) & 1) != 0; let ieee_mantissa = bits & ((1u32 << FLOAT_MANTISSA_BITS) - 1); @@ -175,7 +175,7 @@ let v = f2d(ieee_mantissa, ieee_exponent); - let length = f2s::decimal_length(v.mantissa) as isize; + let length = common::decimal_length9(v.mantissa) as isize; let k = v.exponent as isize; let kk = length + k; // 10^(kk-1) <= v < 10^kk debug_assert!(k >= -45); diff -Nru cargo-0.35.0/vendor/ryu/tests/d2s_test.rs cargo-0.37.0/vendor/ryu/tests/d2s_test.rs --- cargo-0.35.0/vendor/ryu/tests/d2s_test.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/ryu/tests/d2s_test.rs 2019-07-17 05:42:23.000000000 +0000 @@ -24,14 +24,7 @@ #[macro_use] mod macros; -use std::{f64, str}; - -fn print(f: f64) -> String { - let mut bytes = [0u8; 24]; - let n = unsafe { ryu::raw::d2s_buffered_n(f, &mut bytes[0]) }; - let s = str::from_utf8(&bytes[..n]).unwrap(); - s.to_owned() -} +use std::f64; fn pretty(f: f64) -> String { ryu::Buffer::new().format(f).to_owned() @@ -45,26 +38,23 @@ #[test] fn test_ryu() { - check!(3E-1, 0.3); - check!(1.234E15, 1234000000000000.0); - check!(1.234E16, 1.234e16); - check!(2.71828E0, 2.71828); - check!(1.1E128, 1.1e128); - check!(1.1E-64, 1.1e-64); - check!(2.718281828459045E0, 2.718281828459045); - check!(5E-324, 5e-324); - check!(1.7976931348623157E308, 1.7976931348623157e308); + check!(0.3); + check!(1234000000000000.0); + check!(1.234e16); + check!(2.71828); + check!(1.1e128); + check!(1.1e-64); + check!(2.718281828459045); + check!(5e-324); + check!(1.7976931348623157e308); } #[test] fn test_random() { - let mut bytes = [0u8; 24]; let mut buffer = ryu::Buffer::new(); for _ in 0..1000000 { - let f = rand::random(); - let n = unsafe { ryu::raw::d2s_buffered_n(f, &mut bytes[0]) }; - assert_eq!(f, str::from_utf8(&bytes[..n]).unwrap().parse().unwrap()); - assert_eq!(f, buffer.format(f).parse().unwrap()); + let f: f64 = rand::random(); + assert_eq!(f, buffer.format_finite(f).parse().unwrap()); } } @@ -73,49 +63,49 @@ for i in 0u64..1 << 23 { let f = f64::from_bits((((1 << 11) - 1) << 52) + (i << 29)); assert!(!f.is_finite(), "f={}", f); - ryu::Buffer::new().format(f); + ryu::Buffer::new().format_finite(f); } } #[test] fn test_basic() { - check!(0E0, 0.0); - check!(-0E0, -0.0); - check!(1E0, 1.0); - check!(-1E0, -1.0); - assert_eq!(print(f64::NAN), "NaN"); - assert_eq!(print(f64::INFINITY), "Infinity"); - assert_eq!(print(f64::NEG_INFINITY), "-Infinity"); + check!(0.0); + check!(-0.0); + check!(1.0); + check!(-1.0); + assert_eq!(pretty(f64::NAN), "NaN"); + assert_eq!(pretty(f64::INFINITY), "inf"); + assert_eq!(pretty(f64::NEG_INFINITY), "-inf"); } #[test] fn test_switch_to_subnormal() { - check!(2.2250738585072014E-308, 2.2250738585072014e-308); + check!(2.2250738585072014e-308); } #[test] fn test_min_and_max() { assert_eq!(f64::from_bits(0x7fefffffffffffff), 1.7976931348623157e308); - check!(1.7976931348623157E308, 1.7976931348623157e308); + check!(1.7976931348623157e308); assert_eq!(f64::from_bits(1), 5e-324); - check!(5E-324, 5e-324); + check!(5e-324); } #[test] fn test_lots_of_trailing_zeros() { - check!(2.9802322387695312E-8, 2.9802322387695312e-8); + check!(2.9802322387695312e-8); } #[test] fn test_regression() { - check!(-2.109808898695963E16, -2.109808898695963e16); - check!(4.940656E-318, 4.940656e-318); - check!(1.18575755E-316, 1.18575755e-316); - check!(2.989102097996E-312, 2.989102097996e-312); - check!(9.0608011534336E15, 9060801153433600.0); - check!(4.708356024711512E18, 4.708356024711512e18); - check!(9.409340012568248E18, 9.409340012568248e18); - check!(1.2345678E0, 1.2345678); + check!(-2.109808898695963e16); + check!(4.940656e-318); + check!(1.18575755e-316); + check!(2.989102097996e-312); + check!(9060801153433600.0); + check!(4.708356024711512e18); + check!(9.409340012568248e18); + check!(1.2345678); } #[test] @@ -124,39 +114,39 @@ // 5 that fits, and an exponent that causes the computation for q to result // in 22, which is a corner case for Ryu. assert_eq!(f64::from_bits(0x4830F0CF064DD592), 5.764607523034235e39); - check!(5.764607523034235E39, 5.764607523034235e39); + check!(5.764607523034235e39); assert_eq!(f64::from_bits(0x4840F0CF064DD592), 1.152921504606847e40); - check!(1.152921504606847E40, 1.152921504606847e40); + check!(1.152921504606847e40); assert_eq!(f64::from_bits(0x4850F0CF064DD592), 2.305843009213694e40); - check!(2.305843009213694E40, 2.305843009213694e40); + check!(2.305843009213694e40); } #[test] fn test_output_length() { - check!(1E0, 1.0); // already tested in Basic - check!(1.2E0, 1.2); - check!(1.23E0, 1.23); - check!(1.234E0, 1.234); - check!(1.2345E0, 1.2345); - check!(1.23456E0, 1.23456); - check!(1.234567E0, 1.234567); - check!(1.2345678E0, 1.2345678); // already tested in Regression - check!(1.23456789E0, 1.23456789); - check!(1.234567895E0, 1.234567895); // 1.234567890 would be trimmed - check!(1.2345678901E0, 1.2345678901); - check!(1.23456789012E0, 1.23456789012); - check!(1.234567890123E0, 1.234567890123); - check!(1.2345678901234E0, 1.2345678901234); - check!(1.23456789012345E0, 1.23456789012345); - check!(1.234567890123456E0, 1.234567890123456); - check!(1.2345678901234567E0, 1.2345678901234567); + check!(1.0); // already tested in Basic + check!(1.2); + check!(1.23); + check!(1.234); + check!(1.2345); + check!(1.23456); + check!(1.234567); + check!(1.2345678); // already tested in Regression + check!(1.23456789); + check!(1.234567895); // 1.234567890 would be trimmed + check!(1.2345678901); + check!(1.23456789012); + check!(1.234567890123); + check!(1.2345678901234); + check!(1.23456789012345); + check!(1.234567890123456); + check!(1.2345678901234567); // Test 32-bit chunking - check!(4.294967294E0, 4.294967294); // 2^32 - 2 - check!(4.294967295E0, 4.294967295); // 2^32 - 1 - check!(4.294967296E0, 4.294967296); // 2^32 - check!(4.294967297E0, 4.294967297); // 2^32 + 1 - check!(4.294967298E0, 4.294967298); // 2^32 + 2 + check!(4.294967294); // 2^32 - 2 + check!(4.294967295); // 2^32 - 1 + check!(4.294967296); // 2^32 + check!(4.294967297); // 2^32 + 1 + check!(4.294967298); // 2^32 + 2 } // Test min, max shift values in shiftright128 @@ -169,56 +159,163 @@ // 64-bit opt-size=0: 50 <= dist <= 50 // 64-bit opt-size=1: 30 <= dist <= 50 assert_eq!(1.7800590868057611E-307, ieee_parts_to_double(false, 4, 0)); - check!(1.7800590868057611E-307, 1.7800590868057611e-307); + check!(1.7800590868057611e-307); // 32-bit opt-size=0: 49 <= dist <= 49 // 32-bit opt-size=1: 28 <= dist <= 49 // 64-bit opt-size=0: 50 <= dist <= 50 // 64-bit opt-size=1: 28 <= dist <= 50 - assert_eq!(2.8480945388892175E-306, ieee_parts_to_double(false, 6, max_mantissa)); - check!(2.8480945388892175E-306, 2.8480945388892175e-306); + assert_eq!( + 2.8480945388892175E-306, + ieee_parts_to_double(false, 6, max_mantissa) + ); + check!(2.8480945388892175e-306); // 32-bit opt-size=0: 52 <= dist <= 53 // 32-bit opt-size=1: 2 <= dist <= 53 // 64-bit opt-size=0: 53 <= dist <= 53 // 64-bit opt-size=1: 2 <= dist <= 53 assert_eq!(2.446494580089078E-296, ieee_parts_to_double(false, 41, 0)); - check!(2.446494580089078E-296, 2.446494580089078e-296); + check!(2.446494580089078e-296); // 32-bit opt-size=0: 52 <= dist <= 52 // 32-bit opt-size=1: 2 <= dist <= 52 // 64-bit opt-size=0: 53 <= dist <= 53 // 64-bit opt-size=1: 2 <= dist <= 53 - assert_eq!(4.8929891601781557E-296, ieee_parts_to_double(false, 40, max_mantissa)); - check!(4.8929891601781557E-296, 4.8929891601781557e-296); + assert_eq!( + 4.8929891601781557E-296, + ieee_parts_to_double(false, 40, max_mantissa) + ); + check!(4.8929891601781557e-296); // 32-bit opt-size=0: 57 <= dist <= 58 // 32-bit opt-size=1: 57 <= dist <= 58 // 64-bit opt-size=0: 58 <= dist <= 58 // 64-bit opt-size=1: 58 <= dist <= 58 assert_eq!(1.8014398509481984E16, ieee_parts_to_double(false, 1077, 0)); - check!(1.8014398509481984E16, 1.8014398509481984e16); + check!(1.8014398509481984e16); // 32-bit opt-size=0: 57 <= dist <= 57 // 32-bit opt-size=1: 57 <= dist <= 57 // 64-bit opt-size=0: 58 <= dist <= 58 // 64-bit opt-size=1: 58 <= dist <= 58 - assert_eq!(3.6028797018963964E16, ieee_parts_to_double(false, 1076, max_mantissa)); - check!(3.6028797018963964E16, 3.6028797018963964e16); + assert_eq!( + 3.6028797018963964E16, + ieee_parts_to_double(false, 1076, max_mantissa) + ); + check!(3.6028797018963964e16); // 32-bit opt-size=0: 51 <= dist <= 52 // 32-bit opt-size=1: 51 <= dist <= 59 // 64-bit opt-size=0: 52 <= dist <= 52 // 64-bit opt-size=1: 52 <= dist <= 59 assert_eq!(2.900835519859558E-216, ieee_parts_to_double(false, 307, 0)); - check!(2.900835519859558E-216, 2.900835519859558e-216); + check!(2.900835519859558e-216); // 32-bit opt-size=0: 51 <= dist <= 51 // 32-bit opt-size=1: 51 <= dist <= 59 // 64-bit opt-size=0: 52 <= dist <= 52 // 64-bit opt-size=1: 52 <= dist <= 59 - assert_eq!(5.801671039719115E-216, ieee_parts_to_double(false, 306, max_mantissa)); - check!(5.801671039719115E-216, 5.801671039719115e-216); + assert_eq!( + 5.801671039719115E-216, + ieee_parts_to_double(false, 306, max_mantissa) + ); + check!(5.801671039719115e-216); // https://github.com/ulfjack/ryu/commit/19e44d16d80236f5de25800f56d82606d1be00b9#commitcomment-30146483 // 32-bit opt-size=0: 49 <= dist <= 49 // 32-bit opt-size=1: 44 <= dist <= 49 // 64-bit opt-size=0: 50 <= dist <= 50 // 64-bit opt-size=1: 44 <= dist <= 50 - assert_eq!(3.196104012172126E-27, ieee_parts_to_double(false, 934, 0x000FA7161A4D6E0C)); - check!(3.196104012172126E-27, 3.196104012172126e-27); + assert_eq!( + 3.196104012172126E-27, + ieee_parts_to_double(false, 934, 0x000FA7161A4D6E0C) + ); + check!(3.196104012172126e-27); +} + +#[test] +fn test_small_integers() { + check!(9007199254740991.0); // 2^53-1 + check!(9007199254740992.0); // 2^53 + + check!(1.0); + check!(12.0); + check!(123.0); + check!(1234.0); + check!(12345.0); + check!(123456.0); + check!(1234567.0); + check!(12345678.0); + check!(123456789.0); + check!(1234567890.0); + check!(1234567895.0); + check!(12345678901.0); + check!(123456789012.0); + check!(1234567890123.0); + check!(12345678901234.0); + check!(123456789012345.0); + check!(1234567890123456.0); + + // 10^i + check!(1.0); + check!(10.0); + check!(100.0); + check!(1000.0); + check!(10000.0); + check!(100000.0); + check!(1000000.0); + check!(10000000.0); + check!(100000000.0); + check!(1000000000.0); + check!(10000000000.0); + check!(100000000000.0); + check!(1000000000000.0); + check!(10000000000000.0); + check!(100000000000000.0); + check!(1000000000000000.0); + + // 10^15 + 10^i + check!(1000000000000001.0); + check!(1000000000000010.0); + check!(1000000000000100.0); + check!(1000000000001000.0); + check!(1000000000010000.0); + check!(1000000000100000.0); + check!(1000000001000000.0); + check!(1000000010000000.0); + check!(1000000100000000.0); + check!(1000001000000000.0); + check!(1000010000000000.0); + check!(1000100000000000.0); + check!(1001000000000000.0); + check!(1010000000000000.0); + check!(1100000000000000.0); + + // Largest power of 2 <= 10^(i+1) + check!(8.0); + check!(64.0); + check!(512.0); + check!(8192.0); + check!(65536.0); + check!(524288.0); + check!(8388608.0); + check!(67108864.0); + check!(536870912.0); + check!(8589934592.0); + check!(68719476736.0); + check!(549755813888.0); + check!(8796093022208.0); + check!(70368744177664.0); + check!(562949953421312.0); + check!(9007199254740992.0); + + // 1000 * (Largest power of 2 <= 10^(i+1)) + check!(8000.0); + check!(64000.0); + check!(512000.0); + check!(8192000.0); + check!(65536000.0); + check!(524288000.0); + check!(8388608000.0); + check!(67108864000.0); + check!(536870912000.0); + check!(8589934592000.0); + check!(68719476736000.0); + check!(549755813888000.0); + check!(8796093022208000.0); } diff -Nru cargo-0.35.0/vendor/ryu/tests/exhaustive.rs cargo-0.37.0/vendor/ryu/tests/exhaustive.rs --- cargo-0.35.0/vendor/ryu/tests/exhaustive.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/ryu/tests/exhaustive.rs 2019-07-17 05:42:23.000000000 +0000 @@ -38,9 +38,9 @@ if !f.is_finite() { continue; } - let n = unsafe { ryu::raw::f2s_buffered_n(f, &mut bytes[0]) }; + let n = unsafe { ryu::raw::format32(f, &mut bytes[0]) }; assert_eq!(Ok(Ok(f)), str::from_utf8(&bytes[..n]).map(str::parse)); - assert_eq!(Ok(f), buffer.format(f).parse()); + assert_eq!(Ok(f), buffer.format_finite(f).parse()); } let increment = (max - min + 1) as usize; diff -Nru cargo-0.35.0/vendor/ryu/tests/f2s_test.rs cargo-0.37.0/vendor/ryu/tests/f2s_test.rs --- cargo-0.35.0/vendor/ryu/tests/f2s_test.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/ryu/tests/f2s_test.rs 2019-07-17 05:42:23.000000000 +0000 @@ -24,14 +24,7 @@ #[macro_use] mod macros; -use std::{f32, str}; - -fn print(f: f32) -> String { - let mut bytes = [0u8; 24]; - let n = unsafe { ryu::raw::f2s_buffered_n(f, &mut bytes[0]) }; - let s = str::from_utf8(&bytes[..n]).unwrap(); - s.to_owned() -} +use std::f32; fn pretty(f: f32) -> String { ryu::Buffer::new().format(f).to_owned() @@ -39,27 +32,24 @@ #[test] fn test_ryu() { - check!(3E-1, 0.3); - check!(1.234E12, 1234000000000.0); - check!(1.234E13, 1.234e13); - check!(2.71828E0, 2.71828); - check!(1.1E32, 1.1e32); - check!(1.1E-32, 1.1e-32); - check!(2.7182817E0, 2.7182817); - check!(1E-45, 1e-45); - check!(3.4028235E38, 3.4028235e38); - check!(-1.234E-3, -0.001234); + check!(0.3); + check!(1234000000000.0); + check!(1.234e13); + check!(2.71828); + check!(1.1e32); + check!(1.1e-32); + check!(2.7182817); + check!(1e-45); + check!(3.4028235e38); + check!(-0.001234); } #[test] fn test_random() { - let mut bytes = [0u8; 24]; let mut buffer = ryu::Buffer::new(); for _ in 0..1000000 { - let f = rand::random(); - let n = unsafe { ryu::raw::f2s_buffered_n(f, &mut bytes[0]) }; - assert_eq!(f, str::from_utf8(&bytes[..n]).unwrap().parse().unwrap()); - assert_eq!(f, buffer.format(f).parse().unwrap()); + let f: f32 = rand::random(); + assert_eq!(f, buffer.format_finite(f).parse().unwrap()); } } @@ -68,41 +58,41 @@ for i in 0u32..1 << 23 { let f = f32::from_bits((((1 << 8) - 1) << 23) + i); assert!(!f.is_finite(), "f={}", f); - ryu::Buffer::new().format(f); + ryu::Buffer::new().format_finite(f); } } #[test] fn test_basic() { - check!(0E0, 0.0); - check!(-0E0, -0.0); - check!(1E0, 1.0); - check!(-1E0, -1.0); - assert_eq!(print(f32::NAN), "NaN"); - assert_eq!(print(f32::INFINITY), "Infinity"); - assert_eq!(print(f32::NEG_INFINITY), "-Infinity"); + check!(0.0); + check!(-0.0); + check!(1.0); + check!(-1.0); + assert_eq!(pretty(f32::NAN), "NaN"); + assert_eq!(pretty(f32::INFINITY), "inf"); + assert_eq!(pretty(f32::NEG_INFINITY), "-inf"); } #[test] fn test_switch_to_subnormal() { - check!(1.1754944E-38, 1.1754944e-38); + check!(1.1754944e-38); } #[test] fn test_min_and_max() { assert_eq!(f32::from_bits(0x7f7fffff), 3.4028235e38); - check!(3.4028235E38, 3.4028235e38); + check!(3.4028235e38); assert_eq!(f32::from_bits(1), 1e-45); - check!(1E-45, 1e-45); + check!(1e-45); } // Check that we return the exact boundary if it is the shortest // representation, but only if the original floating point number is even. #[test] fn test_boundary_round_even() { - check!(3.355445E7, 33554450.0); - check!(9E9, 9000000000.0); - check!(3.436672E10, 34366720000.0); + check!(33554450.0); + check!(9000000000.0); + check!(34366720000.0); } // If the exact value is exactly halfway between two shortest representations, @@ -110,50 +100,50 @@ // last two digits are ...2|5 or ...7|5, and we cut off the 5. #[test] fn test_exact_value_round_even() { - check!(3.0540412E5, 305404.12); - check!(8.0990312E3, 8099.0312); + check!(305404.12); + check!(8099.0312); } #[test] fn test_lots_of_trailing_zeros() { // Pattern for the first test: 00111001100000000000000000000000 - check!(2.4414062E-4, 0.00024414062); - check!(2.4414062E-3, 0.0024414062); - check!(4.3945312E-3, 0.0043945312); - check!(6.3476562E-3, 0.0063476562); + check!(0.00024414062); + check!(0.0024414062); + check!(0.0043945312); + check!(0.0063476562); } #[test] fn test_regression() { - check!(4.7223665E21, 4.7223665e21); - check!(8.388608E6, 8388608.0); - check!(1.6777216E7, 16777216.0); - check!(3.3554436E7, 33554436.0); - check!(6.7131496E7, 67131496.0); - check!(1.9310392E-38, 1.9310392e-38); - check!(-2.47E-43, -2.47e-43); - check!(1.993244E-38, 1.993244e-38); - check!(4.1039004E3, 4103.9004); - check!(5.3399997E9, 5339999700.0); - check!(6.0898E-39, 6.0898e-39); - check!(1.0310042E-3, 0.0010310042); - check!(2.882326E17, 2.882326e17); - check!(7.038531E-26, 7.038531e-26); - check!(9.223404E17, 9.223404e17); - check!(6.710887E7, 67108870.0); - check!(1E-44, 1e-44); - check!(2.816025E14, 2.816025e14); - check!(9.223372E18, 9.223372e18); - check!(1.5846086E29, 1.5846086e29); - check!(1.1811161E19, 1.1811161e19); - check!(5.368709E18, 5.368709e18); - check!(4.6143166E18, 4.6143166e18); - check!(7.812537E-3, 0.007812537); - check!(1E-45, 1e-45); - check!(1.18697725E20, 1.18697725e20); - check!(1.00014165E-36, 1.00014165e-36); - check!(2E2, 200.0); - check!(3.3554432E7, 33554432.0); + check!(4.7223665e21); + check!(8388608.0); + check!(16777216.0); + check!(33554436.0); + check!(67131496.0); + check!(1.9310392e-38); + check!(-2.47e-43); + check!(1.993244e-38); + check!(4103.9004); + check!(5339999700.0); + check!(6.0898e-39); + check!(0.0010310042); + check!(2.882326e17); + check!(7.038531e-26); + check!(9.223404e17); + check!(67108870.0); + check!(1e-44); + check!(2.816025e14); + check!(9.223372e18); + check!(1.5846086e29); + check!(1.1811161e19); + check!(5.368709e18); + check!(4.6143166e18); + check!(0.007812537); + check!(1e-45); + check!(1.18697725e20); + check!(1.00014165e-36); + check!(200.0); + check!(33554432.0); } #[test] @@ -162,22 +152,22 @@ // and an exponent that causes the computation for q to result in 10, which // is a corner case for Ryu. assert_eq!(f32::from_bits(0x5D1502F9), 6.7108864e17); - check!(6.7108864E17, 6.7108864e17); + check!(6.7108864e17); assert_eq!(f32::from_bits(0x5D9502F9), 1.3421773e18); - check!(1.3421773E18, 1.3421773e18); + check!(1.3421773e18); assert_eq!(f32::from_bits(0x5E1502F9), 2.6843546e18); - check!(2.6843546E18, 2.6843546e18); + check!(2.6843546e18); } #[test] fn test_output_length() { - check!(1E0, 1.0); // already tested in Basic - check!(1.2E0, 1.2); - check!(1.23E0, 1.23); - check!(1.234E0, 1.234); - check!(1.2345E0, 1.2345); - check!(1.23456E0, 1.23456); - check!(1.234567E0, 1.234567); - check!(1.2345678E0, 1.2345678); - check!(1.23456735E-36, 1.23456735e-36); + check!(1.0); // already tested in Basic + check!(1.2); + check!(1.23); + check!(1.234); + check!(1.2345); + check!(1.23456); + check!(1.234567); + check!(1.2345678); + check!(1.23456735e-36); } diff -Nru cargo-0.35.0/vendor/ryu/tests/macros/mod.rs cargo-0.37.0/vendor/ryu/tests/macros/mod.rs --- cargo-0.35.0/vendor/ryu/tests/macros/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/ryu/tests/macros/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,12 +1,8 @@ macro_rules! check { - ($ryu:tt, $pretty:tt) => { - assert_eq!($ryu, $pretty); - assert_eq!(print($ryu), stringify!($ryu)); - assert_eq!(pretty($pretty), stringify!($pretty)); + ($f:tt) => { + assert_eq!(pretty($f), stringify!($f)); }; - (-$ryu:tt, -$pretty:tt) => { - assert_eq!(-$ryu, -$pretty); - assert_eq!(print(-$ryu), concat!("-", stringify!($ryu))); - assert_eq!(pretty(-$pretty), concat!("-", stringify!($pretty))); + (-$f:tt) => { + assert_eq!(pretty(-$f), concat!("-", stringify!($f))); }; } diff -Nru cargo-0.35.0/vendor/same-file/.cargo-checksum.json cargo-0.37.0/vendor/same-file/.cargo-checksum.json --- cargo-0.35.0/vendor/same-file/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/same-file/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267"} \ No newline at end of file +{"files":{},"package":"585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/same-file/Cargo.toml cargo-0.37.0/vendor/same-file/Cargo.toml --- cargo-0.35.0/vendor/same-file/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/same-file/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,7 +12,7 @@ [package] name = "same-file" -version = "1.0.4" +version = "1.0.5" authors = ["Andrew Gallant "] exclude = ["/.travis.yml", "/appveyor.yml"] description = "A simple crate for determining whether two file paths point to the same file.\n" @@ -22,7 +22,5 @@ keywords = ["same", "file", "equal", "inode"] license = "Unlicense/MIT" repository = "https://github.com/BurntSushi/same-file" -[dev-dependencies.rand] -version = "0.4" [target."cfg(windows)".dependencies.winapi-util] version = "0.1.1" diff -Nru cargo-0.35.0/vendor/same-file/examples/is_same_file.rs cargo-0.37.0/vendor/same-file/examples/is_same_file.rs --- cargo-0.35.0/vendor/same-file/examples/is_same_file.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/same-file/examples/is_same_file.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,11 +1,11 @@ extern crate same_file; -use std::error::Error; +use std::io; use same_file::is_same_file; -fn try_main() -> Result<(), Box> { +fn try_main() -> Result<(), io::Error> { assert!(is_same_file("/bin/sh", "/usr/bin/sh")?); - Ok(()) + Ok(()) } fn main() { diff -Nru cargo-0.35.0/vendor/same-file/src/lib.rs cargo-0.37.0/vendor/same-file/src/lib.rs --- cargo-0.35.0/vendor/same-file/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/same-file/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -65,7 +65,7 @@ */ -#![doc(html_root_url = "https://docs.rs/same-file/1.0.0")] +#![allow(bare_trait_objects, unknown_lints)] #![deny(missing_docs)] #[cfg(windows)] @@ -79,11 +79,15 @@ use unix as imp; #[cfg(windows)] use win as imp; +#[cfg(not(any(target_os = "redox", unix, windows)))] +use unknown as imp; #[cfg(any(target_os = "redox", unix))] mod unix; #[cfg(windows)] mod win; +#[cfg(not(any(target_os = "redox", unix, windows)))] +mod unknown; /// A handle to a file that can be tested for equality with other handles. /// @@ -372,37 +376,72 @@ #[cfg(test)] mod tests { - extern crate rand; - use std::env; + use std::error; use std::fs::{self, File}; use std::io; use std::path::{Path, PathBuf}; - - use self::rand::Rng; + use std::result; use super::is_same_file; - struct TempDir(PathBuf); + type Result = result::Result>; - impl TempDir { - fn path<'a>(&'a self) -> &'a Path { - &self.0 + /// Create an error from a format!-like syntax. + macro_rules! err { + ($($tt:tt)*) => { + Box::::from(format!($($tt)*)) } } + /// A simple wrapper for creating a temporary directory that is + /// automatically deleted when it's dropped. + /// + /// We use this in lieu of tempfile because tempfile brings in too many + /// dependencies. + #[derive(Debug)] + struct TempDir(PathBuf); + impl Drop for TempDir { fn drop(&mut self) { fs::remove_dir_all(&self.0).unwrap(); } } + impl TempDir { + /// Create a new empty temporary directory under the system's + /// configured temporary directory. + fn new() -> Result { + #![allow(deprecated)] + + use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering}; + + static TRIES: usize = 100; + static COUNTER: AtomicUsize = ATOMIC_USIZE_INIT; + + let tmpdir = env::temp_dir(); + for _ in 0..TRIES { + let count = COUNTER.fetch_add(1, Ordering::SeqCst); + let path = tmpdir.join("rust-walkdir").join(count.to_string()); + if path.is_dir() { + continue; + } + fs::create_dir_all(&path).map_err(|e| { + err!("failed to create {}: {}", path.display(), e) + })?; + return Ok(TempDir(path)); + } + Err(err!("failed to create temp dir after {} tries", TRIES)) + } + + /// Return the underlying path to this temporary directory. + fn path(&self) -> &Path { + &self.0 + } + } + fn tmpdir() -> TempDir { - let p = env::temp_dir(); - let mut r = self::rand::thread_rng(); - let ret = p.join(&format!("rust-{}", r.next_u32())); - fs::create_dir(&ret).unwrap(); - TempDir(ret) + TempDir::new().unwrap() } #[cfg(unix)] diff -Nru cargo-0.35.0/vendor/same-file/src/unknown.rs cargo-0.37.0/vendor/same-file/src/unknown.rs --- cargo-0.35.0/vendor/same-file/src/unknown.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/same-file/src/unknown.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,52 @@ +use std::fs::File; +use std::io; +use std::path::Path; + +static ERROR_MESSAGE: &str = "same-file is not supported on this platform."; +// This implementation is to allow same-file to be compiled on +// unsupported platforms in case it was incidentally included +// as a transitive, unused dependency +#[derive(Debug)] +pub struct Handle; + +impl Eq for Handle {} + +impl PartialEq for Handle { + fn eq(&self, _other: &Handle) -> bool { + unreachable!(ERROR_MESSAGE); + } +} + +impl Handle { + pub fn from_path>(_p: P) -> io::Result { + error() + } + + pub fn from_file(_file: File) -> io::Result { + error() + } + + pub fn stdin() -> io::Result { + error() + } + + pub fn stdout() -> io::Result { + error() + } + + pub fn stderr() -> io::Result { + error() + } + + pub fn as_file(&self) -> &File { + unreachable!(ERROR_MESSAGE); + } + + pub fn as_file_mut(&self) -> &mut File { + unreachable!(ERROR_MESSAGE); + } +} + +fn error() -> io::Result { + Err(io::Error::new(io::ErrorKind::Other, ERROR_MESSAGE)) +} diff -Nru cargo-0.35.0/vendor/serde/build.rs cargo-0.37.0/vendor/serde/build.rs --- cargo-0.35.0/vendor/serde/build.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde/build.rs 2019-07-17 05:42:23.000000000 +0000 @@ -68,6 +68,10 @@ if minor >= 28 { println!("cargo:rustc-cfg=num_nonzero"); } + + if minor >= 34 { + println!("cargo:rustc-cfg=std_integer_atomics"); + } } fn rustc_minor_version() -> Option { diff -Nru cargo-0.35.0/vendor/serde/.cargo-checksum.json cargo-0.37.0/vendor/serde/.cargo-checksum.json --- cargo-0.35.0/vendor/serde/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"a72e9b96fa45ce22a4bc23da3858dfccfd60acd28a25bcd328a98fdd6bea43fd"} \ No newline at end of file +{"files":{},"package":"e47a9fd6b2d2d2330b19b0b3e5248a170a5acd6356fd88c7bb30362ef9c70567"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/serde/Cargo.toml cargo-0.37.0/vendor/serde/Cargo.toml --- cargo-0.35.0/vendor/serde/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "serde" -version = "1.0.91" +version = "1.0.95" authors = ["Erick Tryzelaar ", "David Tolnay "] build = "build.rs" include = ["Cargo.toml", "build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] @@ -22,7 +22,7 @@ readme = "crates-io.md" keywords = ["serde", "serialization", "no_std"] categories = ["encoding"] -license = "MIT/Apache-2.0" +license = "MIT OR Apache-2.0" repository = "https://github.com/serde-rs/serde" [package.metadata.playground] features = ["derive", "rc"] @@ -33,7 +33,7 @@ version = "1.0" [features] -alloc = ["unstable"] +alloc = [] default = ["std"] derive = ["serde_derive"] rc = [] diff -Nru cargo-0.35.0/vendor/serde/README.md cargo-0.37.0/vendor/serde/README.md --- cargo-0.35.0/vendor/serde/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -81,19 +81,19 @@ [irc]: https://wiki.mozilla.org/IRC [issues]: https://github.com/serde-rs/serde/issues/new/choose -## License +
-Serde is licensed under either of +#### License - * 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) + +Licensed under either of Apache License, Version +2.0 or MIT license at your option. + -at your option. - -### Contribution +
+ Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Serde by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. + diff -Nru cargo-0.35.0/vendor/serde/src/de/ignored_any.rs cargo-0.37.0/vendor/serde/src/de/ignored_any.rs --- cargo-0.35.0/vendor/serde/src/de/ignored_any.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde/src/de/ignored_any.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,6 +1,8 @@ use lib::*; -use de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor}; +use de::{ + Deserialize, Deserializer, EnumAccess, Error, MapAccess, SeqAccess, VariantAccess, Visitor, +}; /// An efficient way of discarding data from a deserializer. /// @@ -205,6 +207,13 @@ let _ = bytes; Ok(IgnoredAny) } + + fn visit_enum(self, data: A) -> Result + where + A: EnumAccess<'de>, + { + data.variant::()?.1.newtype_variant() + } } impl<'de> Deserialize<'de> for IgnoredAny { diff -Nru cargo-0.35.0/vendor/serde/src/de/impls.rs cargo-0.37.0/vendor/serde/src/de/impls.rs --- cargo-0.35.0/vendor/serde/src/de/impls.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde/src/de/impls.rs 2019-07-17 05:42:23.000000000 +0000 @@ -790,7 +790,8 @@ BinaryHeap::clear, BinaryHeap::with_capacity(size_hint::cautious(seq.size_hint())), BinaryHeap::reserve, - BinaryHeap::push); + BinaryHeap::push +); #[cfg(any(feature = "std", feature = "alloc"))] seq_impl!( @@ -799,7 +800,8 @@ BTreeSet::clear, BTreeSet::new(), nop_reserve, - BTreeSet::insert); + BTreeSet::insert +); #[cfg(any(feature = "std", feature = "alloc"))] seq_impl!( @@ -965,7 +967,7 @@ } macro_rules! array_impls { - ($($len:expr => ($($n:tt $name:ident)+))+) => { + ($($len:expr => ($($n:tt)+))+) => { $( impl<'de, T> Visitor<'de> for ArrayVisitor<[T; $len]> where @@ -982,14 +984,12 @@ where A: SeqAccess<'de>, { - $( - let $name = match try!(seq.next_element()) { + Ok([$( + match try!(seq.next_element()) { Some(val) => val, None => return Err(Error::invalid_length($n, &self)), - }; - )+ - - Ok([$($name),+]) + } + ),+]) } } @@ -1045,38 +1045,38 @@ } array_impls! { - 1 => (0 a) - 2 => (0 a 1 b) - 3 => (0 a 1 b 2 c) - 4 => (0 a 1 b 2 c 3 d) - 5 => (0 a 1 b 2 c 3 d 4 e) - 6 => (0 a 1 b 2 c 3 d 4 e 5 f) - 7 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g) - 8 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h) - 9 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i) - 10 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j) - 11 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k) - 12 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l) - 13 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m) - 14 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n) - 15 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o) - 16 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p) - 17 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p 16 q) - 18 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p 16 q 17 r) - 19 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p 16 q 17 r 18 s) - 20 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p 16 q 17 r 18 s 19 t) - 21 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p 16 q 17 r 18 s 19 t 20 u) - 22 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p 16 q 17 r 18 s 19 t 20 u 21 v) - 23 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p 16 q 17 r 18 s 19 t 20 u 21 v 22 w) - 24 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p 16 q 17 r 18 s 19 t 20 u 21 v 22 w 23 x) - 25 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p 16 q 17 r 18 s 19 t 20 u 21 v 22 w 23 x 24 y) - 26 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p 16 q 17 r 18 s 19 t 20 u 21 v 22 w 23 x 24 y 25 z) - 27 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p 16 q 17 r 18 s 19 t 20 u 21 v 22 w 23 x 24 y 25 z 26 aa) - 28 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p 16 q 17 r 18 s 19 t 20 u 21 v 22 w 23 x 24 y 25 z 26 aa 27 ab) - 29 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p 16 q 17 r 18 s 19 t 20 u 21 v 22 w 23 x 24 y 25 z 26 aa 27 ab 28 ac) - 30 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p 16 q 17 r 18 s 19 t 20 u 21 v 22 w 23 x 24 y 25 z 26 aa 27 ab 28 ac 29 ad) - 31 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p 16 q 17 r 18 s 19 t 20 u 21 v 22 w 23 x 24 y 25 z 26 aa 27 ab 28 ac 29 ad 30 ae) - 32 => (0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10 k 11 l 12 m 13 n 14 o 15 p 16 q 17 r 18 s 19 t 20 u 21 v 22 w 23 x 24 y 25 z 26 aa 27 ab 28 ac 29 ad 30 ae 31 af) + 1 => (0) + 2 => (0 1) + 3 => (0 1 2) + 4 => (0 1 2 3) + 5 => (0 1 2 3 4) + 6 => (0 1 2 3 4 5) + 7 => (0 1 2 3 4 5 6) + 8 => (0 1 2 3 4 5 6 7) + 9 => (0 1 2 3 4 5 6 7 8) + 10 => (0 1 2 3 4 5 6 7 8 9) + 11 => (0 1 2 3 4 5 6 7 8 9 10) + 12 => (0 1 2 3 4 5 6 7 8 9 10 11) + 13 => (0 1 2 3 4 5 6 7 8 9 10 11 12) + 14 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13) + 15 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14) + 16 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) + 17 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16) + 18 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17) + 19 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18) + 20 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19) + 21 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20) + 22 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21) + 23 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22) + 24 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23) + 25 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24) + 26 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25) + 27 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26) + 28 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27) + 29 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28) + 30 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29) + 31 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30) + 32 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31) } //////////////////////////////////////////////////////////////////////////////// @@ -2545,3 +2545,31 @@ Deserialize::deserialize(deserializer).map(Wrapping) } } + +#[cfg(all(feature = "std", std_integer_atomics))] +macro_rules! atomic_impl { + ($($ty:ident)*) => { + $( + impl<'de> Deserialize<'de> for $ty { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + Deserialize::deserialize(deserializer).map(Self::new) + } + } + )* + }; +} + +#[cfg(all(feature = "std", std_integer_atomics))] +atomic_impl! { + AtomicBool + AtomicI8 AtomicI16 AtomicI32 AtomicIsize + AtomicU8 AtomicU16 AtomicU32 AtomicUsize +} + +#[cfg(all(feature = "std", std_integer_atomics, not(target_os = "emscripten")))] +atomic_impl! { + AtomicI64 AtomicU64 +} diff -Nru cargo-0.35.0/vendor/serde/src/export.rs cargo-0.37.0/vendor/serde/src/export.rs --- cargo-0.35.0/vendor/serde/src/export.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde/src/export.rs 2019-07-17 05:42:23.000000000 +0000 @@ -9,7 +9,7 @@ pub use self::string::from_utf8_lossy; #[cfg(any(feature = "alloc", feature = "std"))] -pub use lib::Vec; +pub use lib::{ToString, Vec}; mod string { use lib::*; diff -Nru cargo-0.35.0/vendor/serde/src/integer128.rs cargo-0.37.0/vendor/serde/src/integer128.rs --- cargo-0.35.0/vendor/serde/src/integer128.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde/src/integer128.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,13 +1,13 @@ /// Conditional compilation depending on whether Serde is built with support for /// 128-bit integers. /// -/// Data formats that wish to support Rust compiler versions older than 1.26 may -/// place the i128 / u128 methods of their Serializer and Deserializer behind -/// this macro. +/// Data formats that wish to support Rust compiler versions older than 1.26 +/// (or targets that lack 128-bit integers) may place the i128 / u128 methods +/// of their Serializer and Deserializer behind this macro. /// -/// Data formats that require a minimum Rust compiler version of at least 1.26 -/// do not need to bother with this macro and may assume support for 128-bit -/// integers. +/// Data formats that require a minimum Rust compiler version of at least 1.26, +/// or do not target platforms that lack 128-bit integers, do not need to +/// bother with this macro and may assume support for 128-bit integers. /// /// ```edition2018 /// # use serde::private::ser::Error; diff -Nru cargo-0.35.0/vendor/serde/src/lib.rs cargo-0.37.0/vendor/serde/src/lib.rs --- cargo-0.35.0/vendor/serde/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -73,7 +73,7 @@ //////////////////////////////////////////////////////////////////////////////// // Serde types in rustdoc of other crates get linked to here. -#![doc(html_root_url = "https://docs.rs/serde/1.0.91")] +#![doc(html_root_url = "https://docs.rs/serde/1.0.95")] // Support using Serde without the standard library! #![cfg_attr(not(feature = "std"), no_std)] // Unstable functionality only if the user asks for it. For tracking and @@ -81,7 +81,7 @@ // // https://github.com/serde-rs/serde/issues/812 #![cfg_attr(feature = "unstable", feature(specialization, never_type))] -#![cfg_attr(feature = "alloc", feature(alloc))] +#![allow(unknown_lints, bare_trait_objects)] #![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))] // Ignored clippy and clippy_pedantic lints @@ -89,13 +89,13 @@ feature = "cargo-clippy", allow( // not available in our oldest supported compiler - const_static_lifetime, + checked_conversions, empty_enum, redundant_field_names, + redundant_static_lifetimes, // integer and float ser/de requires these sorts of casts cast_possible_truncation, cast_possible_wrap, - cast_precision_loss, cast_sign_loss, // things are often more readable this way cast_lossless, @@ -153,7 +153,7 @@ #[cfg(all(feature = "alloc", not(feature = "std")))] pub use alloc::string::{String, ToString}; #[cfg(feature = "std")] - pub use std::string::String; + pub use std::string::{String, ToString}; #[cfg(all(feature = "alloc", not(feature = "std")))] pub use alloc::vec::Vec; @@ -212,6 +212,14 @@ #[cfg(range_inclusive)] pub use self::core::ops::RangeInclusive; + #[cfg(all(feature = "std", std_integer_atomics))] + pub use std::sync::atomic::{ + AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, AtomicU8, + AtomicUsize, Ordering, + }; + #[cfg(all(feature = "std", std_integer_atomics, not(target_os = "emscripten")))] + pub use std::sync::atomic::{AtomicI64, AtomicU64}; + #[cfg(any(core_duration, feature = "std"))] pub use self::core::time::Duration; } diff -Nru cargo-0.35.0/vendor/serde/src/private/de.rs cargo-0.37.0/vendor/serde/src/private/de.rs --- cargo-0.35.0/vendor/serde/src/private/de.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde/src/private/de.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1420,6 +1420,7 @@ Content::ByteBuf(v) => visitor.visit_byte_buf(v), Content::Bytes(v) => visitor.visit_borrowed_bytes(v), Content::U8(v) => visitor.visit_u8(v), + Content::U64(v) => visitor.visit_u64(v), _ => Err(self.invalid_type(&visitor)), } } @@ -2123,6 +2124,7 @@ Content::ByteBuf(ref v) => visitor.visit_bytes(v), Content::Bytes(v) => visitor.visit_borrowed_bytes(v), Content::U8(v) => visitor.visit_u8(v), + Content::U64(v) => visitor.visit_u64(v), _ => Err(self.invalid_type(&visitor)), } } diff -Nru cargo-0.35.0/vendor/serde/src/ser/impls.rs cargo-0.37.0/vendor/serde/src/ser/impls.rs --- cargo-0.35.0/vendor/serde/src/ser/impls.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde/src/ser/impls.rs 2019-07-17 05:42:23.000000000 +0000 @@ -620,6 +620,7 @@ #[cfg(feature = "std")] macro_rules! serialize_display_bounded_length { ($value:expr, $max:expr, $serializer:expr) => {{ + #[allow(deprecated)] let mut buffer: [u8; $max] = unsafe { mem::uninitialized() }; let remaining_len = { let mut remaining = &mut buffer[..]; @@ -838,3 +839,33 @@ self.0.serialize(serializer) } } + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(all(feature = "std", std_integer_atomics))] +macro_rules! atomic_impl { + ($($ty:ident)*) => { + $( + impl Serialize for $ty { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + self.load(Ordering::SeqCst).serialize(serializer) + } + } + )* + } +} + +#[cfg(all(feature = "std", std_integer_atomics))] +atomic_impl! { + AtomicBool + AtomicI8 AtomicI16 AtomicI32 AtomicIsize + AtomicU8 AtomicU16 AtomicU32 AtomicUsize +} + +#[cfg(all(feature = "std", std_integer_atomics, not(target_os = "emscripten")))] +atomic_impl! { + AtomicI64 AtomicU64 +} diff -Nru cargo-0.35.0/vendor/serde_derive/.cargo-checksum.json cargo-0.37.0/vendor/serde_derive/.cargo-checksum.json --- cargo-0.35.0/vendor/serde_derive/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde_derive/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"101b495b109a3e3ca8c4cbe44cf62391527cdfb6ba15821c5ce80bcd5ea23f9f"} \ No newline at end of file +{"files":{},"package":"5ea8eb91549d859275aef70c58bb30bd62ce50e5eb1a52d32b1b6886e02f7bce"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/serde_derive/Cargo.toml cargo-0.37.0/vendor/serde_derive/Cargo.toml --- cargo-0.35.0/vendor/serde_derive/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde_derive/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "serde_derive" -version = "1.0.91" +version = "1.0.95" authors = ["Erick Tryzelaar ", "David Tolnay "] include = ["Cargo.toml", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]" @@ -20,7 +20,7 @@ documentation = "https://serde.rs/derive.html" readme = "crates-io.md" keywords = ["serde", "serialization", "no_std"] -license = "MIT/Apache-2.0" +license = "MIT OR Apache-2.0" repository = "https://github.com/serde-rs/serde" [lib] diff -Nru cargo-0.35.0/vendor/serde_derive/README.md cargo-0.37.0/vendor/serde_derive/README.md --- cargo-0.35.0/vendor/serde_derive/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde_derive/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -81,19 +81,19 @@ [irc]: https://wiki.mozilla.org/IRC [issues]: https://github.com/serde-rs/serde/issues/new/choose -## License +
-Serde is licensed under either of +#### License - * 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) + +Licensed under either of
Apache License, Version +2.0 or MIT license at your option. + -at your option. - -### Contribution +
+ Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Serde by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. + diff -Nru cargo-0.35.0/vendor/serde_derive/src/de.rs cargo-0.37.0/vendor/serde_derive/src/de.rs --- cargo-0.35.0/vendor/serde_derive/src/de.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde_derive/src/de.rs 2019-07-17 05:42:23.000000000 +0000 @@ -2059,7 +2059,7 @@ ) = if collect_other_fields { ( Some(quote! { - let __value = _serde::private::de::Content::String(__value.to_string()); + let __value = _serde::private::de::Content::String(_serde::export::ToString::to_string(__value)); }), Some(quote! { let __value = _serde::private::de::Content::Str(__value); diff -Nru cargo-0.35.0/vendor/serde_derive/src/lib.rs cargo-0.37.0/vendor/serde_derive/src/lib.rs --- cargo-0.35.0/vendor/serde_derive/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde_derive/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -13,7 +13,8 @@ //! //! [https://serde.rs/derive.html]: https://serde.rs/derive.html -#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.91")] +#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.95")] +#![allow(unknown_lints, bare_trait_objects)] #![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))] // Ignored clippy lints @@ -34,6 +35,7 @@ feature = "cargo-clippy", allow( cast_possible_truncation, + checked_conversions, doc_markdown, enum_glob_use, filter_map, diff -Nru cargo-0.35.0/vendor/serde_json/.cargo-checksum.json cargo-0.37.0/vendor/serde_json/.cargo-checksum.json --- cargo-0.35.0/vendor/serde_json/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde_json/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d"} \ No newline at end of file +{"files":{},"package":"051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/serde_json/Cargo.toml cargo-0.37.0/vendor/serde_json/Cargo.toml --- cargo-0.35.0/vendor/serde_json/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde_json/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "serde_json" -version = "1.0.39" +version = "1.0.40" authors = ["Erick Tryzelaar ", "David Tolnay "] include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] description = "A JSON serialization file format" @@ -20,7 +20,7 @@ readme = "README.md" keywords = ["json", "serde", "serialization"] categories = ["encoding"] -license = "MIT/Apache-2.0" +license = "MIT OR Apache-2.0" repository = "https://github.com/serde-rs/json" [package.metadata.docs.rs] features = ["raw_value", "unbounded_depth"] @@ -35,19 +35,18 @@ version = "0.4.3" [dependencies.ryu] -version = "0.2" +version = "1.0" [dependencies.serde] version = "1.0.60" [dev-dependencies.automod] version = "0.1" -[dev-dependencies.compiletest_rs] -version = "0.3" -features = ["stable"] +[dev-dependencies.select-rustc] +version = "0.1" [dev-dependencies.serde_bytes] -version = "0.10" +version = "0.11" [dev-dependencies.serde_derive] version = "1.0" @@ -55,6 +54,9 @@ [dev-dependencies.serde_stacker] version = "0.1" +[dev-dependencies.trybuild] +version = "1.0" + [features] arbitrary_precision = [] default = [] diff -Nru cargo-0.35.0/vendor/serde_json/README.md cargo-0.37.0/vendor/serde_json/README.md --- cargo-0.35.0/vendor/serde_json/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde_json/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -199,8 +199,7 @@ ## Constructing JSON values Serde JSON provides a [`json!` macro][macro] to build `serde_json::Value` -objects with very natural JSON syntax. In order to use this macro, -`serde_json` needs to be imported with the `#[macro_use]` attribute. +objects with very natural JSON syntax. @@ -327,23 +326,6 @@ [`serde-json-core`]: https://japaric.github.io/serde-json-core/serde_json_core/ -## License - -Serde JSON 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. - -### Contribution - -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in Serde JSON by you, as defined in the Apache-2.0 license, shall -be dual licensed as above, without any additional terms or conditions. - [value]: https://docs.serde.rs/serde_json/value/enum.Value.html [from_str]: https://docs.serde.rs/serde_json/de/fn.from_str.html [from_slice]: https://docs.serde.rs/serde_json/de/fn.from_slice.html @@ -352,3 +334,20 @@ [to_vec]: https://docs.serde.rs/serde_json/ser/fn.to_vec.html [to_writer]: https://docs.serde.rs/serde_json/ser/fn.to_writer.html [macro]: https://docs.serde.rs/serde_json/macro.json.html + +
+ +#### License + + +Licensed under either of
Apache License, Version +2.0 or MIT license at your option. + + +
+ + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in this crate by you, as defined in the Apache-2.0 license, shall +be dual licensed as above, without any additional terms or conditions. + diff -Nru cargo-0.35.0/vendor/serde_json/src/de.rs cargo-0.37.0/vendor/serde_json/src/de.rs --- cargo-0.35.0/vendor/serde_json/src/de.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde_json/src/de.rs 2019-07-17 05:42:23.000000000 +0000 @@ -380,7 +380,14 @@ } fn parse_integer(&mut self, positive: bool) -> Result { - match try!(self.next_char_or_null()) { + let next = match try!(self.next_char()) { + Some(b) => b, + None => { + return Err(self.error(ErrorCode::EofWhileParsingValue)); + } + }; + + match next { b'0' => { // There can be only one leading '0'. match try!(self.peek_or_null()) { @@ -496,7 +503,10 @@ } if !at_least_one_digit { - return Err(self.peek_error(ErrorCode::InvalidNumber)); + match try!(self.peek()) { + Some(_) => return Err(self.peek_error(ErrorCode::InvalidNumber)), + None => return Err(self.peek_error(ErrorCode::EofWhileParsingValue)), + } } match try!(self.peek_or_null()) { @@ -525,8 +535,15 @@ _ => true, }; + let next = match try!(self.next_char()) { + Some(b) => b, + None => { + return Err(self.error(ErrorCode::EofWhileParsingValue)); + } + }; + // Make sure a digit follows the exponent place. - let mut exp = match try!(self.next_char_or_null()) { + let mut exp = match next { c @ b'0'...b'9' => (c - b'0') as i32, _ => { return Err(self.error(ErrorCode::InvalidNumber)); @@ -623,19 +640,19 @@ } #[cfg(feature = "arbitrary_precision")] - fn scan_or_null(&mut self, buf: &mut String) -> Result { + fn scan_or_eof(&mut self, buf: &mut String) -> Result { match try!(self.next_char()) { Some(b) => { buf.push(b as char); Ok(b) } - None => Ok(b'\x00'), + None => Err(self.error(ErrorCode::EofWhileParsingValue)) } } #[cfg(feature = "arbitrary_precision")] fn scan_integer(&mut self, buf: &mut String) -> Result<()> { - match try!(self.scan_or_null(buf)) { + match try!(self.scan_or_eof(buf)) { b'0' => { // There can be only one leading '0'. match try!(self.peek_or_null()) { @@ -680,7 +697,10 @@ } if !at_least_one_digit { - return Err(self.peek_error(ErrorCode::InvalidNumber)); + match try!(self.peek()) { + Some(_) => return Err(self.peek_error(ErrorCode::InvalidNumber)), + None => return Err(self.peek_error(ErrorCode::EofWhileParsingValue)), + } } match try!(self.peek_or_null()) { @@ -706,7 +726,7 @@ } // Make sure a digit follows the exponent place. - match try!(self.scan_or_null(buf)) { + match try!(self.scan_or_eof(buf)) { b'0'...b'9' => {} _ => { return Err(self.error(ErrorCode::InvalidNumber)); @@ -2179,7 +2199,6 @@ /// # Example /// /// ```edition2018 -/// # use serde_derive::Deserialize; /// use serde::Deserialize; /// /// use std::error::Error; @@ -2235,7 +2254,6 @@ /// # Example /// /// ```edition2018 -/// # use serde_derive::Deserialize; /// use serde::Deserialize; /// /// #[derive(Deserialize, Debug)] @@ -2278,7 +2296,6 @@ /// # Example /// /// ```edition2018 -/// # use serde_derive::Deserialize; /// use serde::Deserialize; /// /// #[derive(Deserialize, Debug)] diff -Nru cargo-0.35.0/vendor/serde_json/src/lib.rs cargo-0.37.0/vendor/serde_json/src/lib.rs --- cargo-0.35.0/vendor/serde_json/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde_json/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -119,7 +119,6 @@ //! largely automatically. //! //! ```edition2018 -//! # use serde_derive::{Deserialize, Serialize}; //! use serde::{Deserialize, Serialize}; //! use serde_json::Result; //! @@ -179,8 +178,7 @@ //! # Constructing JSON values //! //! Serde JSON provides a [`json!` macro][macro] to build `serde_json::Value` -//! objects with very natural JSON syntax. In order to use this macro, -//! `serde_json` needs to be imported with the `#[macro_use]` attribute. +//! objects with very natural JSON syntax. //! //! ```edition2018 //! use serde_json::json; @@ -243,7 +241,6 @@ //! such as a File or a TCP stream. //! //! ```edition2018 -//! # use serde_derive::{Deserialize, Serialize}; //! use serde::{Deserialize, Serialize}; //! use serde_json::Result; //! @@ -294,7 +291,8 @@ //! [macro]: https://docs.serde.rs/serde_json/macro.json.html //! [`serde-json-core`]: https://japaric.github.io/serde-json-core/serde_json_core/ -#![doc(html_root_url = "https://docs.rs/serde_json/1.0.39")] +#![doc(html_root_url = "https://docs.rs/serde_json/1.0.40")] +#![allow(unknown_lints, bare_trait_objects, ellipsis_inclusive_range_patterns)] #![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))] // Ignored clippy lints @@ -307,6 +305,8 @@ cast_possible_wrap, cast_precision_loss, cast_sign_loss, + // correctly used + integer_division, // things are often more readable this way cast_lossless, module_name_repetitions, @@ -315,6 +315,7 @@ use_self, zero_prefixed_literal, // we support older compilers + checked_conversions, redundant_field_names, ))] #![deny(missing_docs)] diff -Nru cargo-0.35.0/vendor/serde_json/src/number.rs cargo-0.37.0/vendor/serde_json/src/number.rs --- cargo-0.35.0/vendor/serde_json/src/number.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde_json/src/number.rs 2019-07-17 05:42:23.000000000 +0000 @@ -237,7 +237,7 @@ } #[cfg(feature = "arbitrary_precision")] { - ryu::Buffer::new().format(f).to_owned() + ryu::Buffer::new().format_finite(f).to_owned() } }; Some(Number { n: n }) @@ -473,7 +473,7 @@ } else if let Some(i) = self.as_i64() { return visitor.visit_i64(i); } else if let Some(f) = self.as_f64() { - if ryu::Buffer::new().format(f) == self.n || f.to_string() == self.n { + if ryu::Buffer::new().format_finite(f) == self.n || f.to_string() == self.n { return visitor.visit_f64(f); } } diff -Nru cargo-0.35.0/vendor/serde_json/src/raw.rs cargo-0.37.0/vendor/serde_json/src/raw.rs --- cargo-0.35.0/vendor/serde_json/src/raw.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde_json/src/raw.rs 2019-07-17 05:42:23.000000000 +0000 @@ -20,10 +20,19 @@ /// When serializing, a value of this type will retain its original formatting /// and will not be minified or pretty-printed. /// +/// # Note +/// +/// `RawValue` is only available if serde\_json is built with the `"raw_value"` +/// feature. +/// +/// ```toml +/// [dependencies] +/// serde_json = { version = "1.0", features = ["raw_value"] } +/// ``` +/// /// # Example /// /// ```edition2018 -/// # use serde_derive::{Deserialize, Serialize}; /// use serde::{Deserialize, Serialize}; /// use serde_json::{Result, value::RawValue}; /// @@ -70,7 +79,7 @@ /// The typical usage of `RawValue` will be in the borrowed form: /// /// ```edition2018 -/// # use serde_derive::Deserialize; +/// # use serde::Deserialize; /// # use serde_json::value::RawValue; /// # /// #[derive(Deserialize)] @@ -93,7 +102,7 @@ /// [`serde_json::from_reader`]: ../fn.from_reader.html /// /// ```edition2018 -/// # use serde_derive::Deserialize; +/// # use serde::Deserialize; /// # use serde_json::value::RawValue; /// # /// #[derive(Deserialize)] @@ -101,16 +110,6 @@ /// raw_value: Box, /// } /// ``` -/// -/// # Note -/// -/// `RawValue` is only available if serde\_json is built with the `"raw_value"` -/// feature. -/// -/// ```toml -/// [dependencies] -/// serde_json = { version = "1.0", features = ["raw_value"] } -/// ``` #[repr(C)] pub struct RawValue { json: str, @@ -185,7 +184,6 @@ /// # Example /// /// ```edition2018 - /// # use serde_derive::Deserialize; /// use serde::Deserialize; /// use serde_json::{Result, value::RawValue}; /// diff -Nru cargo-0.35.0/vendor/serde_json/src/ser.rs cargo-0.37.0/vendor/serde_json/src/ser.rs --- cargo-0.35.0/vendor/serde_json/src/ser.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde_json/src/ser.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1711,7 +1711,7 @@ W: io::Write, { let mut buffer = ryu::Buffer::new(); - let s = buffer.format(value); + let s = buffer.format_finite(value); writer.write_all(s.as_bytes()) } @@ -1722,7 +1722,7 @@ W: io::Write, { let mut buffer = ryu::Buffer::new(); - let s = buffer.format(value); + let s = buffer.format_finite(value); writer.write_all(s.as_bytes()) } diff -Nru cargo-0.35.0/vendor/serde_json/src/value/mod.rs cargo-0.37.0/vendor/serde_json/src/value/mod.rs --- cargo-0.35.0/vendor/serde_json/src/value/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/serde_json/src/value/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -3,8 +3,7 @@ //! # Constructing JSON //! //! Serde JSON provides a [`json!` macro][macro] to build `serde_json::Value` -//! objects with very natural JSON syntax. In order to use this macro, -//! `serde_json` needs to be imported with the `#[macro_use]` attribute. +//! objects with very natural JSON syntax. //! //! ```edition2018 //! use serde_json::json; @@ -865,7 +864,7 @@ /// # Examples /// /// ```edition2018 -/// # use serde_derive::Deserialize; +/// # use serde::Deserialize; /// use serde_json::Value; /// /// #[derive(Deserialize)] @@ -907,7 +906,6 @@ /// # Example /// /// ```edition2018 -/// # use serde_derive::Serialize; /// use serde::Serialize; /// use serde_json::json; /// @@ -972,7 +970,6 @@ /// # Example /// /// ```edition2018 -/// # use serde_derive::Deserialize; /// use serde::Deserialize; /// use serde_json::json; /// diff -Nru cargo-0.35.0/vendor/smallvec/.cargo-checksum.json cargo-0.37.0/vendor/smallvec/.cargo-checksum.json --- cargo-0.35.0/vendor/smallvec/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/smallvec/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be"} \ No newline at end of file +{"files":{},"package":"ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/smallvec/Cargo.toml cargo-0.37.0/vendor/smallvec/Cargo.toml --- cargo-0.35.0/vendor/smallvec/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/smallvec/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,7 +12,7 @@ [package] name = "smallvec" -version = "0.6.9" +version = "0.6.10" authors = ["Simon Sapin "] description = "'Small vector' optimization: store up to a small number of items on the stack" documentation = "https://doc.servo.org/smallvec/" diff -Nru cargo-0.35.0/vendor/smallvec/lib.rs cargo-0.37.0/vendor/smallvec/lib.rs --- cargo-0.35.0/vendor/smallvec/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/smallvec/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -369,7 +369,7 @@ /// A `Vec`-like container that can store a small number of elements inline. /// /// `SmallVec` acts like a vector, but can store a limited amount of data inline within the -/// `Smallvec` struct rather than in a separate allocation. If the data exceeds this limit, the +/// `SmallVec` struct rather than in a separate allocation. If the data exceeds this limit, the /// `SmallVec` will "spill" its data onto the heap, allocating a new buffer to hold it. /// /// The amount of data that a `SmallVec` can store inline depends on its backing store. The backing @@ -654,6 +654,7 @@ } self.data = SmallVecData::from_inline(mem::uninitialized()); ptr::copy_nonoverlapping(ptr, self.data.inline_mut().ptr_mut(), len); + self.capacity = len; } else if new_cap != cap { let mut vec = Vec::with_capacity(new_cap); let new_alloc = vec.as_mut_ptr(); @@ -664,6 +665,8 @@ if unspilled { return; } + } else { + return; } deallocate(ptr, cap); } @@ -1355,7 +1358,7 @@ ptr::write(ptr.offset(len.get() as isize), out); len.increment_len(1); } else { - break; + return; } } } @@ -2311,4 +2314,47 @@ let decoded: SmallVec<[i32; 2]> = deserialize(&encoded).unwrap(); assert_eq!(small_vec, decoded); } + + #[test] + fn grow_to_shrink() { + let mut v: SmallVec<[u8; 2]> = SmallVec::new(); + v.push(1); + v.push(2); + v.push(3); + assert!(v.spilled()); + v.clear(); + // Shrink to inline. + v.grow(2); + assert!(!v.spilled()); + assert_eq!(v.capacity(), 2); + assert_eq!(v.len(), 0); + v.push(4); + assert_eq!(v[..], [4]); + } + + #[test] + fn resumable_extend() { + let s = "a b c"; + // This iterator yields: (Some('a'), None, Some('b'), None, Some('c')), None + let it = s + .chars() + .scan(0, |_, ch| if ch.is_whitespace() { None } else { Some(ch) }); + let mut v: SmallVec<[char; 4]> = SmallVec::new(); + v.extend(it); + assert_eq!(v[..], ['a']); + } + + #[test] + fn grow_spilled_same_size() { + let mut v: SmallVec<[u8; 2]> = SmallVec::new(); + v.push(0); + v.push(1); + v.push(2); + assert!(v.spilled()); + assert_eq!(v.capacity(), 4); + // grow with the same capacity + v.grow(4); + assert_eq!(v.capacity(), 4); + assert_eq!(v[..], [0, 1, 2]); + } } diff -Nru cargo-0.35.0/vendor/spin/.cargo-checksum.json cargo-0.37.0/vendor/spin/.cargo-checksum.json --- cargo-0.35.0/vendor/spin/.cargo-checksum.json 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/spin/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +{"files":{},"package":"44363f6f51401c34e7be73db0db371c04705d35efbe9f7d6082e03a921a32c55"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/spin/Cargo.toml cargo-0.37.0/vendor/spin/Cargo.toml --- cargo-0.35.0/vendor/spin/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/spin/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,21 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# 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 = "spin" +version = "0.5.0" +authors = ["Mathijs van de Nes ", "John Ericson "] +description = "Synchronization primitives based on spinning.\nThey may contain data, are usable without `std`,\nand static initializers are available.\n" +documentation = "https://mvdnes.github.io/rust-docs/spin-rs/spin/index.html" +keywords = ["spinlock", "mutex", "rwlock"] +license = "MIT" +repository = "https://github.com/mvdnes/spin-rs.git" diff -Nru cargo-0.35.0/vendor/spin/examples/debug.rs cargo-0.37.0/vendor/spin/examples/debug.rs --- cargo-0.35.0/vendor/spin/examples/debug.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/spin/examples/debug.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,21 @@ +extern crate spin; + +fn main() { + let mutex = spin::Mutex::new(42); + println!("{:?}", mutex); + { + let x = mutex.lock(); + println!("{:?}, {:?}", mutex, *x); + } + + let rwlock = spin::RwLock::new(42); + println!("{:?}", rwlock); + { + let x = rwlock.read(); + println!("{:?}, {:?}", rwlock, *x); + } + { + let x = rwlock.write(); + println!("{:?}, {:?}", rwlock, *x); + } +} diff -Nru cargo-0.35.0/vendor/spin/LICENSE cargo-0.37.0/vendor/spin/LICENSE --- cargo-0.35.0/vendor/spin/LICENSE 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/spin/LICENSE 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Mathijs van de Nes + +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 is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff -Nru cargo-0.35.0/vendor/spin/README.md cargo-0.37.0/vendor/spin/README.md --- cargo-0.35.0/vendor/spin/README.md 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/spin/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,64 @@ +spin-rs +=========== + +[![Build Status](https://travis-ci.org/mvdnes/spin-rs.svg)](https://travis-ci.org/mvdnes/spin-rs) +[![Crates.io version](https://img.shields.io/crates/v/spin.svg)](https://crates.io/crates/spin) +[![docs.rs](https://docs.rs/spin/badge.svg)](https://docs.rs/spin/) + +This Rust library implements a simple +[spinlock](https://en.wikipedia.org/wiki/Spinlock), and is safe for `#[no_std]` environments. + +Usage +----- + +Include the following code in your Cargo.toml + +```toml +[dependencies.spin] +version = "0.5" +``` + +Example +------- + +When calling `lock` on a `Mutex` you will get a reference to the data. When this +reference is dropped, the lock will be unlocked. + +```rust +extern crate spin; + +fn main() +{ + let mutex = spin::Mutex::new(0); + let rw_lock = spin::RwLock::new(0); + + // Modify the data + { + let mut data = mutex.lock(); + *data = 2; + let mut data = rw_lock.write(); + *data = 3; + } + + // Read the data + let answer = + { + let data1 = mutex.lock(); + let data2 = rw_lock.read(); + let data3 = rw_lock.read(); // sharing + (*data1, *data2, *data3) + }; + + println!("Answers are {:?}", answer); +} +``` + +To share the lock, an `Arc>` may be used. + +Remarks +------- + +The behaviour of these lock is similar to their namesakes in `std::sync`. they +differ on the following: + + - The lock will not be poisoned in case of failure; diff -Nru cargo-0.35.0/vendor/spin/script/doc-upload.cfg cargo-0.37.0/vendor/spin/script/doc-upload.cfg --- cargo-0.35.0/vendor/spin/script/doc-upload.cfg 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/spin/script/doc-upload.cfg 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,3 @@ +PROJECT_NAME=spin-rs +DOCS_REPO=mvdnes/rust-docs.git +DOC_RUST_VERSION=stable diff -Nru cargo-0.35.0/vendor/spin/src/lib.rs cargo-0.37.0/vendor/spin/src/lib.rs --- cargo-0.35.0/vendor/spin/src/lib.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/spin/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,18 @@ +#![crate_type = "lib"] +#![warn(missing_docs)] + +//! Synchronization primitives based on spinning + +#![no_std] + +#[cfg(test)] +#[macro_use] +extern crate std; + +pub use mutex::*; +pub use rw_lock::*; +pub use once::*; + +mod mutex; +mod rw_lock; +mod once; diff -Nru cargo-0.35.0/vendor/spin/src/mutex.rs cargo-0.37.0/vendor/spin/src/mutex.rs --- cargo-0.35.0/vendor/spin/src/mutex.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/spin/src/mutex.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,388 @@ +use core::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT, spin_loop_hint as cpu_relax}; +use core::cell::UnsafeCell; +use core::marker::Sync; +use core::ops::{Drop, Deref, DerefMut}; +use core::fmt; +use core::option::Option::{self, None, Some}; +use core::default::Default; + +/// This type provides MUTual EXclusion based on spinning. +/// +/// # Description +/// +/// The behaviour of these lock is similar to their namesakes in `std::sync`. they +/// differ on the following: +/// +/// - The lock will not be poisoned in case of failure; +/// +/// # Simple examples +/// +/// ``` +/// use spin; +/// let spin_mutex = spin::Mutex::new(0); +/// +/// // Modify the data +/// { +/// let mut data = spin_mutex.lock(); +/// *data = 2; +/// } +/// +/// // Read the data +/// let answer = +/// { +/// let data = spin_mutex.lock(); +/// *data +/// }; +/// +/// assert_eq!(answer, 2); +/// ``` +/// +/// # Thread-safety example +/// +/// ``` +/// use spin; +/// use std::sync::{Arc, Barrier}; +/// +/// let numthreads = 1000; +/// let spin_mutex = Arc::new(spin::Mutex::new(0)); +/// +/// // We use a barrier to ensure the readout happens after all writing +/// let barrier = Arc::new(Barrier::new(numthreads + 1)); +/// +/// for _ in (0..numthreads) +/// { +/// let my_barrier = barrier.clone(); +/// let my_lock = spin_mutex.clone(); +/// std::thread::spawn(move|| +/// { +/// let mut guard = my_lock.lock(); +/// *guard += 1; +/// +/// // Release the lock to prevent a deadlock +/// drop(guard); +/// my_barrier.wait(); +/// }); +/// } +/// +/// barrier.wait(); +/// +/// let answer = { *spin_mutex.lock() }; +/// assert_eq!(answer, numthreads); +/// ``` +pub struct Mutex +{ + lock: AtomicBool, + data: UnsafeCell, +} + +/// A guard to which the protected data can be accessed +/// +/// When the guard falls out of scope it will release the lock. +#[derive(Debug)] +pub struct MutexGuard<'a, T: ?Sized + 'a> +{ + lock: &'a AtomicBool, + data: &'a mut T, +} + +// Same unsafe impls as `std::sync::Mutex` +unsafe impl Sync for Mutex {} +unsafe impl Send for Mutex {} + +impl Mutex +{ + /// Creates a new spinlock wrapping the supplied data. + /// + /// May be used statically: + /// + /// ``` + /// use spin; + /// + /// static MUTEX: spin::Mutex<()> = spin::Mutex::new(()); + /// + /// fn demo() { + /// let lock = MUTEX.lock(); + /// // do something with lock + /// drop(lock); + /// } + /// ``` + pub const fn new(user_data: T) -> Mutex + { + Mutex + { + lock: ATOMIC_BOOL_INIT, + data: UnsafeCell::new(user_data), + } + } + + /// Consumes this mutex, returning the underlying data. + pub fn into_inner(self) -> T { + // We know statically that there are no outstanding references to + // `self` so there's no need to lock. + let Mutex { data, .. } = self; + data.into_inner() + } +} + +impl Mutex +{ + fn obtain_lock(&self) + { + while self.lock.compare_and_swap(false, true, Ordering::Acquire) != false + { + // Wait until the lock looks unlocked before retrying + while self.lock.load(Ordering::Relaxed) + { + cpu_relax(); + } + } + } + + /// Locks the spinlock and returns a guard. + /// + /// The returned value may be dereferenced for data access + /// and the lock will be dropped when the guard falls out of scope. + /// + /// ``` + /// let mylock = spin::Mutex::new(0); + /// { + /// let mut data = mylock.lock(); + /// // The lock is now locked and the data can be accessed + /// *data += 1; + /// // The lock is implicitly dropped + /// } + /// + /// ``` + pub fn lock(&self) -> MutexGuard + { + self.obtain_lock(); + MutexGuard + { + lock: &self.lock, + data: unsafe { &mut *self.data.get() }, + } + } + + /// Force unlock the spinlock. + /// + /// This is *extremely* unsafe if the lock is not held by the current + /// thread. However, this can be useful in some instances for exposing the + /// lock to FFI that doesn't know how to deal with RAII. + /// + /// If the lock isn't held, this is a no-op. + pub unsafe fn force_unlock(&self) { + self.lock.store(false, Ordering::Release); + } + + /// Tries to lock the mutex. If it is already locked, it will return None. Otherwise it returns + /// a guard within Some. + pub fn try_lock(&self) -> Option> + { + if self.lock.compare_and_swap(false, true, Ordering::Acquire) == false + { + Some( + MutexGuard { + lock: &self.lock, + data: unsafe { &mut *self.data.get() }, + } + ) + } + else + { + None + } + } +} + +impl fmt::Debug for Mutex +{ + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result + { + match self.try_lock() + { + Some(guard) => write!(f, "Mutex {{ data: ") + .and_then(|()| (&*guard).fmt(f)) + .and_then(|()| write!(f, "}}")), + None => write!(f, "Mutex {{ }}"), + } + } +} + +impl Default for Mutex { + fn default() -> Mutex { + Mutex::new(Default::default()) + } +} + +impl<'a, T: ?Sized> Deref for MutexGuard<'a, T> +{ + type Target = T; + fn deref<'b>(&'b self) -> &'b T { &*self.data } +} + +impl<'a, T: ?Sized> DerefMut for MutexGuard<'a, T> +{ + fn deref_mut<'b>(&'b mut self) -> &'b mut T { &mut *self.data } +} + +impl<'a, T: ?Sized> Drop for MutexGuard<'a, T> +{ + /// The dropping of the MutexGuard will release the lock it was created from. + fn drop(&mut self) + { + self.lock.store(false, Ordering::Release); + } +} + +#[cfg(test)] +mod tests { + use std::prelude::v1::*; + + use std::sync::mpsc::channel; + use std::sync::Arc; + use std::sync::atomic::{AtomicUsize, Ordering}; + use std::thread; + + use super::*; + + #[derive(Eq, PartialEq, Debug)] + struct NonCopy(i32); + + #[test] + fn smoke() { + let m = Mutex::new(()); + drop(m.lock()); + drop(m.lock()); + } + + #[test] + fn lots_and_lots() { + static M: Mutex<()> = Mutex::new(()); + static mut CNT: u32 = 0; + const J: u32 = 1000; + const K: u32 = 3; + + fn inc() { + for _ in 0..J { + unsafe { + let _g = M.lock(); + CNT += 1; + } + } + } + + let (tx, rx) = channel(); + for _ in 0..K { + let tx2 = tx.clone(); + thread::spawn(move|| { inc(); tx2.send(()).unwrap(); }); + let tx2 = tx.clone(); + thread::spawn(move|| { inc(); tx2.send(()).unwrap(); }); + } + + drop(tx); + for _ in 0..2 * K { + rx.recv().unwrap(); + } + assert_eq!(unsafe {CNT}, J * K * 2); + } + + #[test] + fn try_lock() { + let mutex = Mutex::new(42); + + // First lock succeeds + let a = mutex.try_lock(); + assert_eq!(a.as_ref().map(|r| **r), Some(42)); + + // Additional lock failes + let b = mutex.try_lock(); + assert!(b.is_none()); + + // After dropping lock, it succeeds again + ::core::mem::drop(a); + let c = mutex.try_lock(); + assert_eq!(c.as_ref().map(|r| **r), Some(42)); + } + + #[test] + fn test_into_inner() { + let m = Mutex::new(NonCopy(10)); + assert_eq!(m.into_inner(), NonCopy(10)); + } + + #[test] + fn test_into_inner_drop() { + struct Foo(Arc); + impl Drop for Foo { + fn drop(&mut self) { + self.0.fetch_add(1, Ordering::SeqCst); + } + } + let num_drops = Arc::new(AtomicUsize::new(0)); + let m = Mutex::new(Foo(num_drops.clone())); + assert_eq!(num_drops.load(Ordering::SeqCst), 0); + { + let _inner = m.into_inner(); + assert_eq!(num_drops.load(Ordering::SeqCst), 0); + } + assert_eq!(num_drops.load(Ordering::SeqCst), 1); + } + + #[test] + fn test_mutex_arc_nested() { + // Tests nested mutexes and access + // to underlying data. + let arc = Arc::new(Mutex::new(1)); + let arc2 = Arc::new(Mutex::new(arc)); + let (tx, rx) = channel(); + let _t = thread::spawn(move|| { + let lock = arc2.lock(); + let lock2 = lock.lock(); + assert_eq!(*lock2, 1); + tx.send(()).unwrap(); + }); + rx.recv().unwrap(); + } + + #[test] + fn test_mutex_arc_access_in_unwind() { + let arc = Arc::new(Mutex::new(1)); + let arc2 = arc.clone(); + let _ = thread::spawn(move|| -> () { + struct Unwinder { + i: Arc>, + } + impl Drop for Unwinder { + fn drop(&mut self) { + *self.i.lock() += 1; + } + } + let _u = Unwinder { i: arc2 }; + panic!(); + }).join(); + let lock = arc.lock(); + assert_eq!(*lock, 2); + } + + #[test] + fn test_mutex_unsized() { + let mutex: &Mutex<[i32]> = &Mutex::new([1, 2, 3]); + { + let b = &mut *mutex.lock(); + b[0] = 4; + b[2] = 5; + } + let comp: &[i32] = &[4, 2, 5]; + assert_eq!(&*mutex.lock(), comp); + } + + #[test] + fn test_mutex_force_lock() { + let lock = Mutex::new(()); + ::std::mem::forget(lock.lock()); + unsafe { + lock.force_unlock(); + } + assert!(lock.try_lock().is_some()); + } +} diff -Nru cargo-0.35.0/vendor/spin/src/once.rs cargo-0.37.0/vendor/spin/src/once.rs --- cargo-0.35.0/vendor/spin/src/once.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/spin/src/once.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,290 @@ +use core::cell::UnsafeCell; +use core::sync::atomic::{AtomicUsize, Ordering, spin_loop_hint as cpu_relax}; +use core::fmt; + +/// A synchronization primitive which can be used to run a one-time global +/// initialization. Unlike its std equivalent, this is generalized so that The +/// closure returns a value and it is stored. Once therefore acts something like +/// 1a future, too. +/// +/// # Examples +/// +/// ``` +/// use spin; +/// +/// static START: spin::Once<()> = spin::Once::new(); +/// +/// START.call_once(|| { +/// // run initialization here +/// }); +/// ``` +pub struct Once { + state: AtomicUsize, + data: UnsafeCell>, // TODO remove option and use mem::uninitialized +} + +impl fmt::Debug for Once { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self.try() { + Some(s) => write!(f, "Once {{ data: ") + .and_then(|()| s.fmt(f)) + .and_then(|()| write!(f, "}}")), + None => write!(f, "Once {{ }}") + } + } +} + +// Same unsafe impls as `std::sync::RwLock`, because this also allows for +// concurrent reads. +unsafe impl Sync for Once {} +unsafe impl Send for Once {} + +// Four states that a Once can be in, encoded into the lower bits of `state` in +// the Once structure. +const INCOMPLETE: usize = 0x0; +const RUNNING: usize = 0x1; +const COMPLETE: usize = 0x2; +const PANICKED: usize = 0x3; + +use core::hint::unreachable_unchecked as unreachable; + +impl Once { + /// Initialization constant of `Once`. + pub const INIT: Self = Once { + state: AtomicUsize::new(INCOMPLETE), + data: UnsafeCell::new(None), + }; + + /// Creates a new `Once` value. + pub const fn new() -> Once { + Self::INIT + } + + fn force_get<'a>(&'a self) -> &'a T { + match unsafe { &*self.data.get() }.as_ref() { + None => unsafe { unreachable() }, + Some(p) => p, + } + } + + /// Performs an initialization routine once and only once. The given closure + /// will be executed if this is the first time `call_once` has been called, + /// and otherwise the routine will *not* be invoked. + /// + /// This method will block the calling thread if another initialization + /// routine is currently running. + /// + /// When this function returns, it is guaranteed that some initialization + /// has run and completed (it may not be the closure specified). The + /// returned pointer will point to the result from the closure that was + /// ran. + /// + /// # Examples + /// + /// ``` + /// use spin; + /// + /// static INIT: spin::Once = spin::Once::new(); + /// + /// fn get_cached_val() -> usize { + /// *INIT.call_once(expensive_computation) + /// } + /// + /// fn expensive_computation() -> usize { + /// // ... + /// # 2 + /// } + /// ``` + pub fn call_once<'a, F>(&'a self, builder: F) -> &'a T + where F: FnOnce() -> T + { + let mut status = self.state.load(Ordering::SeqCst); + + if status == INCOMPLETE { + status = self.state.compare_and_swap(INCOMPLETE, + RUNNING, + Ordering::SeqCst); + if status == INCOMPLETE { // We init + // We use a guard (Finish) to catch panics caused by builder + let mut finish = Finish { state: &self.state, panicked: true }; + unsafe { *self.data.get() = Some(builder()) }; + finish.panicked = false; + + status = COMPLETE; + self.state.store(status, Ordering::SeqCst); + + // This next line is strictly an optomization + return self.force_get(); + } + } + + loop { + match status { + INCOMPLETE => unreachable!(), + RUNNING => { // We spin + cpu_relax(); + status = self.state.load(Ordering::SeqCst) + }, + PANICKED => panic!("Once has panicked"), + COMPLETE => return self.force_get(), + _ => unsafe { unreachable() }, + } + } + } + + /// Returns a pointer iff the `Once` was previously initialized + pub fn try<'a>(&'a self) -> Option<&'a T> { + match self.state.load(Ordering::SeqCst) { + COMPLETE => Some(self.force_get()), + _ => None, + } + } + + /// Like try, but will spin if the `Once` is in the process of being + /// initialized + pub fn wait<'a>(&'a self) -> Option<&'a T> { + loop { + match self.state.load(Ordering::SeqCst) { + INCOMPLETE => return None, + RUNNING => cpu_relax(), // We spin + COMPLETE => return Some(self.force_get()), + PANICKED => panic!("Once has panicked"), + _ => unsafe { unreachable() }, + } + } + } +} + +struct Finish<'a> { + state: &'a AtomicUsize, + panicked: bool, +} + +impl<'a> Drop for Finish<'a> { + fn drop(&mut self) { + if self.panicked { + self.state.store(PANICKED, Ordering::SeqCst); + } + } +} + +#[cfg(test)] +mod tests { + use std::prelude::v1::*; + + use std::sync::mpsc::channel; + use std::thread; + use super::Once; + + #[test] + fn smoke_once() { + static O: Once<()> = Once::new(); + let mut a = 0; + O.call_once(|| a += 1); + assert_eq!(a, 1); + O.call_once(|| a += 1); + assert_eq!(a, 1); + } + + #[test] + fn smoke_once_value() { + static O: Once = Once::new(); + let a = O.call_once(|| 1); + assert_eq!(*a, 1); + let b = O.call_once(|| 2); + assert_eq!(*b, 1); + } + + #[test] + fn stampede_once() { + static O: Once<()> = Once::new(); + static mut RUN: bool = false; + + let (tx, rx) = channel(); + for _ in 0..10 { + let tx = tx.clone(); + thread::spawn(move|| { + for _ in 0..4 { thread::yield_now() } + unsafe { + O.call_once(|| { + assert!(!RUN); + RUN = true; + }); + assert!(RUN); + } + tx.send(()).unwrap(); + }); + } + + unsafe { + O.call_once(|| { + assert!(!RUN); + RUN = true; + }); + assert!(RUN); + } + + for _ in 0..10 { + rx.recv().unwrap(); + } + } + + #[test] + fn try() { + static INIT: Once = Once::new(); + + assert!(INIT.try().is_none()); + INIT.call_once(|| 2); + assert_eq!(INIT.try().map(|r| *r), Some(2)); + } + + #[test] + fn try_no_wait() { + static INIT: Once = Once::new(); + + assert!(INIT.try().is_none()); + thread::spawn(move|| { + INIT.call_once(|| loop { }); + }); + assert!(INIT.try().is_none()); + } + + + #[test] + fn wait() { + static INIT: Once = Once::new(); + + assert!(INIT.wait().is_none()); + INIT.call_once(|| 3); + assert_eq!(INIT.wait().map(|r| *r), Some(3)); + } + + #[test] + fn panic() { + use ::std::panic; + + static INIT: Once<()> = Once::new(); + + // poison the once + let t = panic::catch_unwind(|| { + INIT.call_once(|| panic!()); + }); + assert!(t.is_err()); + + // poisoning propagates + let t = panic::catch_unwind(|| { + INIT.call_once(|| {}); + }); + assert!(t.is_err()); + } + + #[test] + fn init_constant() { + static O: Once<()> = Once::INIT; + let mut a = 0; + O.call_once(|| a += 1); + assert_eq!(a, 1); + O.call_once(|| a += 1); + assert_eq!(a, 1); + } +} diff -Nru cargo-0.35.0/vendor/spin/src/rw_lock.rs cargo-0.37.0/vendor/spin/src/rw_lock.rs --- cargo-0.35.0/vendor/spin/src/rw_lock.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/spin/src/rw_lock.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,554 @@ +use core::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT, spin_loop_hint as cpu_relax}; +use core::cell::UnsafeCell; +use core::ops::{Deref, DerefMut}; +use core::fmt; +use core::default::Default; + +/// A reader-writer lock +/// +/// This type of lock allows a number of readers or at most one writer at any +/// point in time. The write portion of this lock typically allows modification +/// of the underlying data (exclusive access) and the read portion of this lock +/// typically allows for read-only access (shared access). +/// +/// The type parameter `T` represents the data that this lock protects. It is +/// required that `T` satisfies `Send` to be shared across tasks and `Sync` to +/// allow concurrent access through readers. The RAII guards returned from the +/// locking methods implement `Deref` (and `DerefMut` for the `write` methods) +/// to allow access to the contained of the lock. +/// +/// Based on +/// +/// +/// # Examples +/// +/// ``` +/// use spin; +/// +/// let lock = spin::RwLock::new(5); +/// +/// // many reader locks can be held at once +/// { +/// let r1 = lock.read(); +/// let r2 = lock.read(); +/// assert_eq!(*r1, 5); +/// assert_eq!(*r2, 5); +/// } // read locks are dropped at this point +/// +/// // only one write lock may be held, however +/// { +/// let mut w = lock.write(); +/// *w += 1; +/// assert_eq!(*w, 6); +/// } // write lock is dropped here +/// ``` +pub struct RwLock +{ + lock: AtomicUsize, + data: UnsafeCell, +} + +/// A guard to which the protected data can be read +/// +/// When the guard falls out of scope it will decrement the read count, +/// potentially releasing the lock. +#[derive(Debug)] +pub struct RwLockReadGuard<'a, T: 'a + ?Sized> +{ + lock: &'a AtomicUsize, + data: &'a T, +} + +/// A guard to which the protected data can be written +/// +/// When the guard falls out of scope it will release the lock. +#[derive(Debug)] +pub struct RwLockWriteGuard<'a, T: 'a + ?Sized> +{ + lock: &'a AtomicUsize, + data: &'a mut T, +} + +// Same unsafe impls as `std::sync::RwLock` +unsafe impl Send for RwLock {} +unsafe impl Sync for RwLock {} + +const USIZE_MSB: usize = ::core::isize::MIN as usize; + +impl RwLock +{ + /// Creates a new spinlock wrapping the supplied data. + /// + /// May be used statically: + /// + /// ``` + /// use spin; + /// + /// static RW_LOCK: spin::RwLock<()> = spin::RwLock::new(()); + /// + /// fn demo() { + /// let lock = RW_LOCK.read(); + /// // do something with lock + /// drop(lock); + /// } + /// ``` + #[inline] + pub const fn new(user_data: T) -> RwLock + { + RwLock + { + lock: ATOMIC_USIZE_INIT, + data: UnsafeCell::new(user_data), + } + } + + /// Consumes this `RwLock`, returning the underlying data. + pub fn into_inner(self) -> T + { + // We know statically that there are no outstanding references to + // `self` so there's no need to lock. + let RwLock { data, .. } = self; + data.into_inner() + } +} + +impl RwLock +{ + /// Locks this rwlock with shared read access, blocking the current thread + /// until it can be acquired. + /// + /// The calling thread will be blocked until there are no more writers which + /// hold the lock. There may be other readers currently inside the lock when + /// this method returns. This method does not provide any guarantees with + /// respect to the ordering of whether contentious readers or writers will + /// acquire the lock first. + /// + /// Returns an RAII guard which will release this thread's shared access + /// once it is dropped. + /// + /// ``` + /// let mylock = spin::RwLock::new(0); + /// { + /// let mut data = mylock.read(); + /// // The lock is now locked and the data can be read + /// println!("{}", *data); + /// // The lock is dropped + /// } + /// ``` + #[inline] + pub fn read<'a>(&'a self) -> RwLockReadGuard<'a, T> + { + // (funny do-while loop) + while { + // Old value, with write bit unset + let mut old; + + // Wait for for writer to go away before doing expensive atomic ops + // (funny do-while loop) + while { + old = self.lock.load(Ordering::Relaxed); + old & USIZE_MSB != 0 + } { + cpu_relax(); + } + + // unset write bit + old &= !USIZE_MSB; + + let new = old + 1; + debug_assert!(new != (!USIZE_MSB) & (!0)); + + self.lock.compare_and_swap(old, new, Ordering::SeqCst) != old + } { + cpu_relax(); + } + RwLockReadGuard { + lock: &self.lock, + data: unsafe { & *self.data.get() }, + } + } + + /// Attempt to acquire this lock with shared read access. + /// + /// This function will never block and will return immediately if `read` + /// would otherwise succeed. Returns `Some` of an RAII guard which will + /// release the shared access of this thread when dropped, or `None` if the + /// access could not be granted. This method does not provide any + /// guarantees with respect to the ordering of whether contentious readers + /// or writers will acquire the lock first. + /// + /// ``` + /// let mylock = spin::RwLock::new(0); + /// { + /// match mylock.try_read() { + /// Some(data) => { + /// // The lock is now locked and the data can be read + /// println!("{}", *data); + /// // The lock is dropped + /// }, + /// None => (), // no cigar + /// }; + /// } + /// ``` + #[inline] + pub fn try_read(&self) -> Option> + { + // Old value, with write bit unset + let old = (!USIZE_MSB) & self.lock.load(Ordering::Relaxed); + + let new = old + 1; + debug_assert!(new != (!USIZE_MSB) & (!0)); + if self.lock.compare_and_swap(old, + new, + Ordering::SeqCst) == old + { + Some(RwLockReadGuard { + lock: &self.lock, + data: unsafe { & *self.data.get() }, + }) + } else { + None + } + } + + /// Force decrement the reader count. + /// + /// This is *extremely* unsafe if there are outstanding `RwLockReadGuard`s + /// live, or if called more times than `read` has been called, but can be + /// useful in FFI contexts where the caller doesn't know how to deal with + /// RAII. + pub unsafe fn force_read_decrement(&self) { + debug_assert!(self.lock.load(Ordering::Relaxed) & (!USIZE_MSB) > 0); + self.lock.fetch_sub(1, Ordering::SeqCst); + } + + /// Force unlock exclusive write access. + /// + /// This is *extremely* unsafe if there are outstanding `RwLockWriteGuard`s + /// live, or if called when there are current readers, but can be useful in + /// FFI contexts where the caller doesn't know how to deal with RAII. + pub unsafe fn force_write_unlock(&self) { + debug_assert_eq!(self.lock.load(Ordering::Relaxed), USIZE_MSB); + self.lock.store(0, Ordering::Relaxed); + } + + /// Lock this rwlock with exclusive write access, blocking the current + /// thread until it can be acquired. + /// + /// This function will not return while other writers or other readers + /// currently have access to the lock. + /// + /// Returns an RAII guard which will drop the write access of this rwlock + /// when dropped. + /// + /// ``` + /// let mylock = spin::RwLock::new(0); + /// { + /// let mut data = mylock.write(); + /// // The lock is now locked and the data can be written + /// *data += 1; + /// // The lock is dropped + /// } + /// ``` + #[inline] + pub fn write<'a>(&'a self) -> RwLockWriteGuard<'a, T> + { + loop + { + // Old value, with write bit unset. + let old = (!USIZE_MSB) & self.lock.load(Ordering::Relaxed); + // Old value, with write bit set. + let new = USIZE_MSB | old; + if self.lock.compare_and_swap(old, + new, + Ordering::SeqCst) == old + { + // Wait for readers to go away, then lock is ours. + while self.lock.load(Ordering::Relaxed) != USIZE_MSB { + cpu_relax(); + } + break + } + } + RwLockWriteGuard { + lock: &self.lock, + data: unsafe { &mut *self.data.get() }, + } + } + + /// Attempt to lock this rwlock with exclusive write access. + /// + /// This function does not ever block, and it will return `None` if a call + /// to `write` would otherwise block. If successful, an RAII guard is + /// returned. + /// + /// ``` + /// let mylock = spin::RwLock::new(0); + /// { + /// match mylock.try_write() { + /// Some(mut data) => { + /// // The lock is now locked and the data can be written + /// *data += 1; + /// // The lock is implicitly dropped + /// }, + /// None => (), // no cigar + /// }; + /// } + /// ``` + #[inline] + pub fn try_write(&self) -> Option> + { + if self.lock.compare_and_swap(0, + USIZE_MSB, + Ordering::SeqCst) == 0 + { + Some(RwLockWriteGuard { + lock: &self.lock, + data: unsafe { &mut *self.data.get() }, + }) + } else { + None + } + } +} + +impl fmt::Debug for RwLock +{ + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result + { + match self.try_read() + { + Some(guard) => write!(f, "RwLock {{ data: ") + .and_then(|()| (&*guard).fmt(f)) + .and_then(|()| write!(f, "}}")), + None => write!(f, "RwLock {{ }}"), + } + } +} + +impl Default for RwLock { + fn default() -> RwLock { + RwLock::new(Default::default()) + } +} + +impl<'rwlock, T: ?Sized> Deref for RwLockReadGuard<'rwlock, T> { + type Target = T; + + fn deref(&self) -> &T { self.data } +} + +impl<'rwlock, T: ?Sized> Deref for RwLockWriteGuard<'rwlock, T> { + type Target = T; + + fn deref(&self) -> &T { self.data } +} + +impl<'rwlock, T: ?Sized> DerefMut for RwLockWriteGuard<'rwlock, T> { + fn deref_mut(&mut self) -> &mut T { self.data } +} + +impl<'rwlock, T: ?Sized> Drop for RwLockReadGuard<'rwlock, T> { + fn drop(&mut self) { + debug_assert!(self.lock.load(Ordering::Relaxed) & (!USIZE_MSB) > 0); + self.lock.fetch_sub(1, Ordering::SeqCst); + } +} + +impl<'rwlock, T: ?Sized> Drop for RwLockWriteGuard<'rwlock, T> { + fn drop(&mut self) { + debug_assert_eq!(self.lock.load(Ordering::Relaxed), USIZE_MSB); + self.lock.store(0, Ordering::Relaxed); + } +} + +#[cfg(test)] +mod tests { + use std::prelude::v1::*; + + use std::sync::Arc; + use std::sync::mpsc::channel; + use std::sync::atomic::{AtomicUsize, Ordering}; + use std::thread; + + use super::*; + + #[derive(Eq, PartialEq, Debug)] + struct NonCopy(i32); + + #[test] + fn smoke() { + let l = RwLock::new(()); + drop(l.read()); + drop(l.write()); + drop((l.read(), l.read())); + drop(l.write()); + } + + // TODO: needs RNG + //#[test] + //fn frob() { + // static R: RwLock = RwLock::new(); + // const N: usize = 10; + // const M: usize = 1000; + // + // let (tx, rx) = channel::<()>(); + // for _ in 0..N { + // let tx = tx.clone(); + // thread::spawn(move|| { + // let mut rng = rand::thread_rng(); + // for _ in 0..M { + // if rng.gen_weighted_bool(N) { + // drop(R.write()); + // } else { + // drop(R.read()); + // } + // } + // drop(tx); + // }); + // } + // drop(tx); + // let _ = rx.recv(); + // unsafe { R.destroy(); } + //} + + #[test] + fn test_rw_arc() { + let arc = Arc::new(RwLock::new(0)); + let arc2 = arc.clone(); + let (tx, rx) = channel(); + + thread::spawn(move|| { + let mut lock = arc2.write(); + for _ in 0..10 { + let tmp = *lock; + *lock = -1; + thread::yield_now(); + *lock = tmp + 1; + } + tx.send(()).unwrap(); + }); + + // Readers try to catch the writer in the act + let mut children = Vec::new(); + for _ in 0..5 { + let arc3 = arc.clone(); + children.push(thread::spawn(move|| { + let lock = arc3.read(); + assert!(*lock >= 0); + })); + } + + // Wait for children to pass their asserts + for r in children { + assert!(r.join().is_ok()); + } + + // Wait for writer to finish + rx.recv().unwrap(); + let lock = arc.read(); + assert_eq!(*lock, 10); + } + + #[test] + fn test_rw_arc_access_in_unwind() { + let arc = Arc::new(RwLock::new(1)); + let arc2 = arc.clone(); + let _ = thread::spawn(move|| -> () { + struct Unwinder { + i: Arc>, + } + impl Drop for Unwinder { + fn drop(&mut self) { + let mut lock = self.i.write(); + *lock += 1; + } + } + let _u = Unwinder { i: arc2 }; + panic!(); + }).join(); + let lock = arc.read(); + assert_eq!(*lock, 2); + } + + #[test] + fn test_rwlock_unsized() { + let rw: &RwLock<[i32]> = &RwLock::new([1, 2, 3]); + { + let b = &mut *rw.write(); + b[0] = 4; + b[2] = 5; + } + let comp: &[i32] = &[4, 2, 5]; + assert_eq!(&*rw.read(), comp); + } + + #[test] + fn test_rwlock_try_write() { + use std::mem::drop; + + let lock = RwLock::new(0isize); + let read_guard = lock.read(); + + let write_result = lock.try_write(); + match write_result { + None => (), + Some(_) => assert!(false, "try_write should not succeed while read_guard is in scope"), + } + + drop(read_guard); + } + + #[test] + fn test_into_inner() { + let m = RwLock::new(NonCopy(10)); + assert_eq!(m.into_inner(), NonCopy(10)); + } + + #[test] + fn test_into_inner_drop() { + struct Foo(Arc); + impl Drop for Foo { + fn drop(&mut self) { + self.0.fetch_add(1, Ordering::SeqCst); + } + } + let num_drops = Arc::new(AtomicUsize::new(0)); + let m = RwLock::new(Foo(num_drops.clone())); + assert_eq!(num_drops.load(Ordering::SeqCst), 0); + { + let _inner = m.into_inner(); + assert_eq!(num_drops.load(Ordering::SeqCst), 0); + } + assert_eq!(num_drops.load(Ordering::SeqCst), 1); + } + + #[test] + fn test_force_read_decrement() { + let m = RwLock::new(()); + ::std::mem::forget(m.read()); + ::std::mem::forget(m.read()); + ::std::mem::forget(m.read()); + assert!(m.try_write().is_none()); + unsafe { + m.force_read_decrement(); + m.force_read_decrement(); + } + assert!(m.try_write().is_none()); + unsafe { + m.force_read_decrement(); + } + assert!(m.try_write().is_some()); + } + + #[test] + fn test_force_write_unlock() { + let m = RwLock::new(()); + ::std::mem::forget(m.write()); + assert!(m.try_read().is_none()); + unsafe { + m.force_write_unlock(); + } + assert!(m.try_read().is_some()); + } +} diff -Nru cargo-0.35.0/vendor/syn/benches/file.rs cargo-0.37.0/vendor/syn/benches/file.rs --- cargo-0.35.0/vendor/syn/benches/file.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/benches/file.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,28 @@ +// $ cargo bench --features full --bench file + +#![recursion_limit = "256"] +#![feature(rustc_private, test)] + +extern crate test; + +#[macro_use] +#[path = "../tests/macros/mod.rs"] +mod macros; + +#[path = "../tests/common/mod.rs"] +mod common; + +use proc_macro2::TokenStream; +use std::fs; +use std::str::FromStr; +use test::Bencher; + +const FILE: &str = "tests/rust/src/libcore/str/mod.rs"; + +#[bench] +fn parse_file(b: &mut Bencher) { + common::clone_rust(); + let content = fs::read_to_string(FILE).unwrap(); + let tokens = TokenStream::from_str(&content).unwrap(); + b.iter(|| syn::parse2::(tokens.clone())); +} diff -Nru cargo-0.35.0/vendor/syn/benches/rust.rs cargo-0.37.0/vendor/syn/benches/rust.rs --- cargo-0.35.0/vendor/syn/benches/rust.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/benches/rust.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,129 @@ +// $ cargo bench --features full --bench rust + +#![recursion_limit = "256"] +#![feature(rustc_private)] + +extern crate rustc_data_structures; +extern crate syntax; +extern crate syntax_pos; + +#[macro_use] +#[path = "../tests/macros/mod.rs"] +mod macros; + +#[path = "../tests/common/mod.rs"] +mod common; + +use proc_macro2::TokenStream; +use rustc_data_structures::sync::Lrc; +use std::fs; +use std::str::FromStr; +use std::time::{Duration, Instant}; +use syntax::edition::Edition; +use syntax::errors::{emitter::Emitter, DiagnosticBuilder, Handler}; +use syntax::parse::ParseSess; +use syntax::source_map::{FilePathMapping, SourceMap}; +use syntax_pos::FileName; + +fn tokenstream_parse(content: &str) -> Result<(), ()> { + TokenStream::from_str(content).map(drop).map_err(drop) +} + +fn syn_parse(content: &str) -> Result<(), ()> { + syn::parse_file(content).map(drop).map_err(drop) +} + +fn libsyntax_parse(content: &str) -> Result<(), ()> { + struct SilentEmitter; + + impl Emitter for SilentEmitter { + fn emit_diagnostic(&mut self, _db: &DiagnosticBuilder) {} + } + + syntax::with_globals(Edition::Edition2018, || { + let cm = Lrc::new(SourceMap::new(FilePathMapping::empty())); + let emitter = Box::new(SilentEmitter); + let handler = Handler::with_emitter(false, None, emitter); + let sess = ParseSess::with_span_handler(handler, cm); + if let Err(mut diagnostic) = syntax::parse::parse_crate_from_source_str( + FileName::Custom("bench".to_owned()), + content.to_owned(), + &sess, + ) { + diagnostic.cancel(); + return Err(()); + }; + Ok(()) + }) +} + +fn read_from_disk(content: &str) -> Result<(), ()> { + let _ = content; + Ok(()) +} + +fn exec(mut codepath: impl FnMut(&str) -> Result<(), ()>) -> Duration { + let begin = Instant::now(); + let mut success = 0; + let mut total = 0; + + walkdir::WalkDir::new("tests/rust/src") + .into_iter() + .filter_entry(common::base_dir_filter) + .for_each(|entry| { + let entry = entry.unwrap(); + let path = entry.path(); + if path.is_dir() { + return; + } + let content = fs::read_to_string(path).unwrap(); + let ok = codepath(&content).is_ok(); + success += ok as usize; + total += 1; + if !ok { + eprintln!("FAIL {}", path.display()); + } + }); + + assert_eq!(success, total); + begin.elapsed() +} + +fn main() { + common::clone_rust(); + + macro_rules! testcases { + ($($name:ident,)*) => { + vec![ + $( + (stringify!($name), $name as fn(&str) -> Result<(), ()>), + )* + ] + }; + } + + let mut lines = 0; + let mut files = 0; + exec(|content| { + lines += content.lines().count(); + files += 1; + Ok(()) + }); + eprintln!("\n{} lines in {} files", lines, files); + + for (name, f) in testcases!( + read_from_disk, + tokenstream_parse, + syn_parse, + libsyntax_parse, + ) { + eprint!("{:20}", format!("{}:", name)); + let elapsed = exec(f); + eprintln!( + "elapsed={}.{:03}s", + elapsed.as_secs(), + elapsed.subsec_millis(), + ); + } + eprintln!(); +} diff -Nru cargo-0.35.0/vendor/syn/build.rs cargo-0.37.0/vendor/syn/build.rs --- cargo-0.35.0/vendor/syn/build.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/build.rs 2019-07-17 05:42:23.000000000 +0000 @@ -11,6 +11,10 @@ None => return, }; + if compiler.minor >= 17 { + println!("cargo:rustc-cfg=syn_can_match_trailing_dollar"); + } + if compiler.minor >= 19 { println!("cargo:rustc-cfg=syn_can_use_thread_id"); } diff -Nru cargo-0.35.0/vendor/syn/.cargo-checksum.json cargo-0.37.0/vendor/syn/.cargo-checksum.json --- cargo-0.35.0/vendor/syn/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"a1393e4a97a19c01e900df2aec855a29f71cf02c402e2f443b8d2747c25c5dbe"} \ No newline at end of file +{"files":{},"package":"b4d960b829a55e56db167e861ddb43602c003c7be0bee1d345021703fac2fb7c"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/syn/Cargo.toml cargo-0.37.0/vendor/syn/Cargo.toml --- cargo-0.35.0/vendor/syn/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -12,20 +12,31 @@ [package] name = "syn" -version = "0.15.34" +version = "0.15.39" authors = ["David Tolnay "] -include = ["/build.rs", "/Cargo.toml", "/LICENSE-APACHE", "/LICENSE-MIT", "/README.md", "/src/**/*.rs"] +include = ["/benches/**", "/build.rs", "/Cargo.toml", "/LICENSE-APACHE", "/LICENSE-MIT", "/README.md", "/src/**", "/tests/**"] description = "Parser for Rust source code" documentation = "https://docs.rs/syn" readme = "README.md" categories = ["development-tools::procedural-macro-helpers"] -license = "MIT/Apache-2.0" +license = "MIT OR Apache-2.0" repository = "https://github.com/dtolnay/syn" [package.metadata.docs.rs] all-features = true [package.metadata.playground] all-features = true + +[[bench]] +name = "rust" +harness = false +required-features = ["full", "parsing"] +edition = "2018" + +[[bench]] +name = "file" +required-features = ["full", "parsing"] +edition = "2018" [dependencies.proc-macro2] version = "0.4.4" default-features = false @@ -37,18 +48,21 @@ [dependencies.unicode-xid] version = "0.1" -[dev-dependencies.colored] -version = "1.7" - [dev-dependencies.insta] -version = "0.7" +version = "0.8" [dev-dependencies.rayon] version = "1.0" +[dev-dependencies.ref-cast] +version = "0.2" + [dev-dependencies.regex] version = "1.0" +[dev-dependencies.termcolor] +version = "1.0" + [dev-dependencies.walkdir] version = "2.1" diff -Nru cargo-0.35.0/vendor/syn/README.md cargo-0.37.0/vendor/syn/README.md --- cargo-0.35.0/vendor/syn/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -182,6 +182,18 @@ | ^^^ ``` +## Testing + +When testing macros, we often care not just that the macro can be used +successfully but also that when the macro is provided with invalid input it +produces maximally helpful error messages. Consider using the [`trybuild`] crate +to write tests for errors that are emitted by your macro or errors detected by +the Rust compiler in the expanded code following misuse of the macro. Such tests +help avoid regressions from later refactors that mistakenly make an error no +longer trigger or be less helpful than it used to be. + +[`trybuild`]: https://github.com/dtolnay/trybuild + ## Debugging When developing a procedural macro it can be helpful to look at what the @@ -240,17 +252,19 @@ [proc-macro2]: https://github.com/alexcrichton/proc-macro2 -## License - -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) +#### License -at your option. + +Licensed under either of Apache License, Version +2.0 or MIT license at your option. + -### Contribution +
+ Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. + diff -Nru cargo-0.35.0/vendor/syn/src/attr.rs cargo-0.37.0/vendor/syn/src/attr.rs --- cargo-0.35.0/vendor/syn/src/attr.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/src/attr.rs 2019-07-17 05:42:23.000000000 +0000 @@ -600,11 +600,9 @@ impl Parse for NestedMeta { fn parse(input: ParseStream) -> Result { - let ahead = input.fork(); - - if ahead.peek(Lit) && !(ahead.peek(LitBool) && ahead.peek2(Token![=])) { + if input.peek(Lit) && !(input.peek(LitBool) && input.peek2(Token![=])) { input.parse().map(NestedMeta::Literal) - } else if ahead.call(Ident::parse_any).is_ok() { + } else if private::peek_any_ident(input) { input.parse().map(NestedMeta::Meta) } else { Err(input.error("expected identifier or literal")) diff -Nru cargo-0.35.0/vendor/syn/src/buffer.rs cargo-0.37.0/vendor/syn/src/buffer.rs --- cargo-0.35.0/vendor/syn/src/buffer.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/src/buffer.rs 2019-07-17 05:42:23.000000000 +0000 @@ -348,6 +348,10 @@ } impl private { + pub fn same_scope(a: Cursor, b: Cursor) -> bool { + a.scope == b.scope + } + #[cfg(procmacro2_semver_exempt)] pub fn open_span_of_group(cursor: Cursor) -> Span { match *cursor.entry() { diff -Nru cargo-0.35.0/vendor/syn/src/data.rs cargo-0.37.0/vendor/syn/src/data.rs --- cargo-0.35.0/vendor/syn/src/data.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/src/data.rs 2019-07-17 05:42:23.000000000 +0000 @@ -268,6 +268,7 @@ let pub_token = input.parse::()?; if input.peek(token::Paren) { + // TODO: optimize using advance_to let ahead = input.fork(); let mut content; parenthesized!(content in ahead); diff -Nru cargo-0.35.0/vendor/syn/src/discouraged.rs cargo-0.37.0/vendor/syn/src/discouraged.rs --- cargo-0.35.0/vendor/syn/src/discouraged.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/src/discouraged.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,171 @@ +//! Extensions to the parsing API with niche applicability. + +use super::*; + +/// Extensions to the `ParseStream` API to support speculative parsing. +pub trait Speculative { + /// Advance this parse stream to the position of a forked parse stream. + /// + /// This is the opposite operation to [`ParseStream::fork`]. You can fork a + /// parse stream, perform some speculative parsing, then join the original + /// stream to the fork to "commit" the parsing from the fork to the main + /// stream. + /// + /// If you can avoid doing this, you should, as it limits the ability to + /// generate useful errors. That said, it is often the only way to parse + /// syntax of the form `A* B*` for arbitrary syntax `A` and `B`. The problem + /// is that when the fork fails to parse an `A`, it's impossible to tell + /// whether that was because of a syntax error and the user meant to provide + /// an `A`, or that the `A`s are finished and its time to start parsing + /// `B`s. Use with care. + /// + /// Also note that if `A` is a subset of `B`, `A* B*` can be parsed by + /// parsing `B*` and removing the leading members of `A` from the + /// repetition, bypassing the need to involve the downsides associated with + /// speculative parsing. + /// + /// [`ParseStream::fork`]: ../struct.ParseBuffer.html#method.fork + /// + /// # Example + /// + /// There has been chatter about the possibility of making the colons in the + /// turbofish syntax like `path::to::` no longer required by accepting + /// `path::to` in expression position. Specifically, according to [RFC + /// 2544], [`PathSegment`] parsing should always try to consume a following + /// `<` token as the start of generic arguments, and reset to the `<` if + /// that fails (e.g. the token is acting as a less-than operator). + /// + /// This is the exact kind of parsing behavior which requires the "fork, + /// try, commit" behavior that [`ParseStream::fork`] discourages. With + /// `advance_to`, we can avoid having to parse the speculatively parsed + /// content a second time. + /// + /// This change in behavior can be implemented in syn by replacing just the + /// `Parse` implementation for `PathSegment`: + /// + /// ```edition2018 + /// # use syn::ext::IdentExt; + /// use syn::parse::discouraged::Speculative; + /// # use syn::parse::{Parse, ParseStream}; + /// # use syn::{Ident, PathArguments, Result, Token}; + /// + /// pub struct PathSegment { + /// pub ident: Ident, + /// pub arguments: PathArguments, + /// } + /// # + /// # impl From for PathSegment + /// # where + /// # T: Into, + /// # { + /// # fn from(ident: T) -> Self { + /// # PathSegment { + /// # ident: ident.into(), + /// # arguments: PathArguments::None, + /// # } + /// # } + /// # } + /// + /// impl Parse for PathSegment { + /// fn parse(input: ParseStream) -> Result { + /// if input.peek(Token![super]) + /// || input.peek(Token![self]) + /// || input.peek(Token![Self]) + /// || input.peek(Token![crate]) + /// || input.peek(Token![extern]) + /// { + /// let ident = input.call(Ident::parse_any)?; + /// return Ok(PathSegment::from(ident)); + /// } + /// + /// let ident = input.parse()?; + /// if input.peek(Token![::]) && input.peek3(Token![<]) { + /// return Ok(PathSegment { + /// ident: ident, + /// arguments: PathArguments::AngleBracketed(input.parse()?), + /// }); + /// } + /// if input.peek(Token![<]) && !input.peek(Token![<=]) { + /// let fork = input.fork(); + /// if let Ok(arguments) = fork.parse() { + /// input.advance_to(&fork); + /// return Ok(PathSegment { + /// ident: ident, + /// arguments: PathArguments::AngleBracketed(arguments), + /// }); + /// } + /// } + /// Ok(PathSegment::from(ident)) + /// } + /// } + /// + /// # syn::parse_str::("a").unwrap(); + /// ``` + /// + /// # Drawbacks + /// + /// The main drawback of this style of speculative parsing is in error + /// presentation. Even if the lookahead is the "correct" parse, the error + /// that is shown is that of the "fallback" parse. To use the same example + /// as the turbofish above, take the following unfinished "turbofish": + /// + /// ```text + /// let _ = f<&'a fn(), for<'a> serde::>(); + /// ``` + /// + /// If this is parsed as generic arguments, we can provide the error message + /// + /// ```text + /// error: expected identifier + /// --> src.rs:L:C + /// | + /// L | let _ = f<&'a fn(), for<'a> serde::>(); + /// | ^ + /// ``` + /// + /// but if parsed using the above speculative parsing, it falls back to + /// assuming that the `<` is a less-than when it fails to parse the generic + /// arguments, and tries to interpret the `&'a` as the start of a labelled + /// loop, resulting in the much less helpful error + /// + /// ```text + /// error: expected `:` + /// --> src.rs:L:C + /// | + /// L | let _ = f<&'a fn(), for<'a> serde::>(); + /// | ^^ + /// ``` + /// + /// This can be mitigated with various heuristics (two examples: show both + /// forks' parse errors, or show the one that consumed more tokens), but + /// when you can control the grammar, sticking to something that can be + /// parsed LL(3) and without the LL(*) speculative parsing this makes + /// possible, displaying reasonable errors becomes much more simple. + /// + /// [RFC 2544]: https://github.com/rust-lang/rfcs/pull/2544 + /// [`PathSegment`]: ../../struct.PathSegment.html + /// + /// # Performance + /// + /// This method performs a cheap fixed amount of work that does not depend + /// on how far apart the two streams are positioned. + /// + /// # Panics + /// + /// The forked stream in the argument of `advance_to` must have been + /// obtained by forking `self`. Attempting to advance to any other stream + /// will cause a panic. + fn advance_to(&self, fork: &Self); +} + +impl<'a> Speculative for ParseBuffer<'a> { + fn advance_to(&self, fork: &Self) { + if !private::same_scope(self.cursor(), fork.cursor()) { + panic!("Fork was not derived from the advancing parse stream"); + } + + // See comment on `cell` in the struct definition. + self.cell + .set(unsafe { mem::transmute::>(fork.cursor()) }) + } +} diff -Nru cargo-0.35.0/vendor/syn/src/expr.rs cargo-0.37.0/vendor/syn/src/expr.rs --- cargo-0.35.0/vendor/syn/src/expr.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/src/expr.rs 2019-07-17 05:42:23.000000000 +0000 @@ -994,7 +994,6 @@ enum Precedence { Any, Assign, - Placement, Range, Or, And, @@ -1111,23 +1110,6 @@ eq_token: eq_token, right: Box::new(rhs), }); - } else if Precedence::Placement >= base && input.peek(Token![<-]) { - let arrow_token: Token![<-] = input.parse()?; - let mut rhs = unary_expr(input, allow_struct)?; - loop { - let next = peek_precedence(input); - if next > Precedence::Placement { - rhs = parse_expr(input, rhs, allow_struct, next)?; - } else { - break; - } - } - lhs = Expr::InPlace(ExprInPlace { - attrs: Vec::new(), - place: Box::new(lhs), - arrow_token: arrow_token, - value: Box::new(rhs), - }); } else if Precedence::Range >= base && input.peek(Token![..]) { let limits: RangeLimits = input.parse()?; let rhs = if input.is_empty() @@ -1231,8 +1213,6 @@ Precedence::of(&op) } else if input.peek(Token![=]) && !input.peek(Token![=>]) { Precedence::Assign - } else if input.peek(Token![<-]) { - Precedence::Placement } else if input.peek(Token![..]) { Precedence::Range } else if input.peek(Token![as]) || input.peek(Token![:]) && !input.peek(Token![::]) { @@ -1254,6 +1234,7 @@ // box #[cfg(feature = "full")] fn unary_expr(input: ParseStream, allow_struct: AllowStruct) -> Result { + // TODO: optimize using advance_to let ahead = input.fork(); ahead.call(Attribute::parse_outer)?; if ahead.peek(Token![&]) @@ -1290,6 +1271,7 @@ #[cfg(not(feature = "full"))] fn unary_expr(input: ParseStream, allow_struct: AllowStruct) -> Result { + // TODO: optimize using advance_to let ahead = input.fork(); ahead.call(Attribute::parse_outer)?; if ahead.peek(Token![*]) || ahead.peek(Token![!]) || ahead.peek(Token![-]) { @@ -1897,55 +1879,70 @@ } } + #[cfg(all(feature = "full", feature = "printing"))] + impl Parse for ExprInPlace { + fn parse(input: ParseStream) -> Result { + let msg = "placement expression has been removed from Rust and is no longer parsed"; + Err(input.error(msg)) + } + } + macro_rules! impl_by_parsing_expr { - ($expr_type:ty, $variant:ident, $msg:expr) => ( - #[cfg(all(feature = "full", feature = "printing"))] - impl Parse for $expr_type { - fn parse(input: ParseStream) -> Result { - let mut expr: Expr = input.parse()?; - loop { - match expr { - Expr::$variant(inner) => return Ok(inner), - Expr::Group(ExprGroup { expr: next, .. }) => expr = *next, - _ => return Err(Error::new_spanned(expr, $msg)) + ( + $( + $expr_type:ty, $variant:ident, $msg:expr, + )* + ) => { + $( + #[cfg(all(feature = "full", feature = "printing"))] + impl Parse for $expr_type { + fn parse(input: ParseStream) -> Result { + let mut expr: Expr = input.parse()?; + loop { + match expr { + Expr::$variant(inner) => return Ok(inner), + Expr::Group(next) => expr = *next.expr, + _ => return Err(Error::new_spanned(expr, $msg)), + } } } } - } - ) + )* + }; } - impl_by_parsing_expr!(ExprBox, Box, "expected box expression"); - impl_by_parsing_expr!(ExprInPlace, InPlace, "expected placement expression"); - impl_by_parsing_expr!(ExprArray, Array, "expected slice literal expression"); - impl_by_parsing_expr!(ExprCall, Call, "expected function call expression"); - impl_by_parsing_expr!(ExprMethodCall, MethodCall, "expected method call expression"); - impl_by_parsing_expr!(ExprTuple, Tuple, "expected tuple expression"); - impl_by_parsing_expr!(ExprBinary, Binary, "expected binary operation"); - impl_by_parsing_expr!(ExprUnary, Unary, "expected unary operation"); - impl_by_parsing_expr!(ExprCast, Cast, "expected cast expression"); - impl_by_parsing_expr!(ExprType, Type, "expected type ascription expression"); - impl_by_parsing_expr!(ExprLet, Let, "expected let guard"); - impl_by_parsing_expr!(ExprClosure, Closure, "expected closure expression"); - impl_by_parsing_expr!(ExprUnsafe, Unsafe, "expected unsafe block"); - impl_by_parsing_expr!(ExprBlock, Block, "expected blocked scope"); - impl_by_parsing_expr!(ExprAssign, Assign, "expected assignment expression"); - impl_by_parsing_expr!(ExprAssignOp, AssignOp, "expected compound assignment expression"); - impl_by_parsing_expr!(ExprField, Field, "expected struct field access"); - impl_by_parsing_expr!(ExprIndex, Index, "expected indexing expression"); - impl_by_parsing_expr!(ExprRange, Range, "expected range expression"); - impl_by_parsing_expr!(ExprReference, Reference, "expected referencing operation"); - impl_by_parsing_expr!(ExprBreak, Break, "expected break expression"); - impl_by_parsing_expr!(ExprContinue, Continue, "expected continue expression"); - impl_by_parsing_expr!(ExprReturn, Return, "expected return expression"); - impl_by_parsing_expr!(ExprMacro, Macro, "expected macro invocation expression"); - impl_by_parsing_expr!(ExprStruct, Struct, "expected struct literal expression"); - impl_by_parsing_expr!(ExprRepeat, Repeat, "expected array literal constructed from one repeated element"); - impl_by_parsing_expr!(ExprParen, Paren, "expected parenthesized expression"); - impl_by_parsing_expr!(ExprTry, Try, "expected try expression"); - impl_by_parsing_expr!(ExprAsync, Async, "expected async block"); - impl_by_parsing_expr!(ExprTryBlock, TryBlock, "expected try block"); - impl_by_parsing_expr!(ExprYield, Yield, "expected yield expression"); + impl_by_parsing_expr! { + ExprBox, Box, "expected box expression", + ExprArray, Array, "expected slice literal expression", + ExprCall, Call, "expected function call expression", + ExprMethodCall, MethodCall, "expected method call expression", + ExprTuple, Tuple, "expected tuple expression", + ExprBinary, Binary, "expected binary operation", + ExprUnary, Unary, "expected unary operation", + ExprCast, Cast, "expected cast expression", + ExprType, Type, "expected type ascription expression", + ExprLet, Let, "expected let guard", + ExprClosure, Closure, "expected closure expression", + ExprUnsafe, Unsafe, "expected unsafe block", + ExprBlock, Block, "expected blocked scope", + ExprAssign, Assign, "expected assignment expression", + ExprAssignOp, AssignOp, "expected compound assignment expression", + ExprField, Field, "expected struct field access", + ExprIndex, Index, "expected indexing expression", + ExprRange, Range, "expected range expression", + ExprReference, Reference, "expected referencing operation", + ExprBreak, Break, "expected break expression", + ExprContinue, Continue, "expected continue expression", + ExprReturn, Return, "expected return expression", + ExprMacro, Macro, "expected macro invocation expression", + ExprStruct, Struct, "expected struct literal expression", + ExprRepeat, Repeat, "expected array literal constructed from one repeated element", + ExprParen, Paren, "expected parenthesized expression", + ExprTry, Try, "expected try expression", + ExprAsync, Async, "expected async block", + ExprTryBlock, TryBlock, "expected try block", + ExprYield, Yield, "expected yield expression", + } #[cfg(feature = "full")] fn expr_try_block(input: ParseStream) -> Result { @@ -2190,6 +2187,7 @@ let mut fields = Punctuated::new(); loop { let attrs = content.call(Attribute::parse_outer)?; + // TODO: optimize using advance_to if content.fork().parse::().is_err() { if attrs.is_empty() { break; @@ -2421,6 +2419,7 @@ #[cfg(feature = "full")] fn parse_stmt(input: ParseStream, allow_nosemi: bool) -> Result { + // TODO: optimize using advance_to let ahead = input.fork(); ahead.call(Attribute::parse_outer)?; @@ -3708,7 +3707,7 @@ self.lo.to_tokens(tokens); match self.limits { RangeLimits::HalfOpen(ref t) => t.to_tokens(tokens), - RangeLimits::Closed(ref t) => Token![...](t.spans).to_tokens(tokens), + RangeLimits::Closed(ref t) => t.to_tokens(tokens), } self.hi.to_tokens(tokens); } diff -Nru cargo-0.35.0/vendor/syn/src/gen/fold.rs cargo-0.37.0/vendor/syn/src/gen/fold.rs --- cargo-0.35.0/vendor/syn/src/gen/fold.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/src/gen/fold.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,4 +1,5 @@ -// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT +// This file is @generated by syn-internal-codegen. +// It is not intended for manual editing. #![allow(unreachable_code)] #[cfg(any(feature = "full", feature = "derive"))] @@ -819,28 +820,6 @@ fold_ident(self, i) } } -#[cfg(any(feature = "full", feature = "derive"))] -macro_rules! fold_span_only { - ($f:ident : $t:ident) => { - pub fn $f(_visitor: &mut V, mut _i: $t) -> $t { - let span = _visitor.fold_span(_i.span()); - _i.set_span(span); - _i - } - }; -} -#[cfg(any(feature = "full", feature = "derive"))] -fold_span_only!(fold_lit_byte: LitByte); -#[cfg(any(feature = "full", feature = "derive"))] -fold_span_only!(fold_lit_byte_str: LitByteStr); -#[cfg(any(feature = "full", feature = "derive"))] -fold_span_only!(fold_lit_char: LitChar); -#[cfg(any(feature = "full", feature = "derive"))] -fold_span_only!(fold_lit_float: LitFloat); -#[cfg(any(feature = "full", feature = "derive"))] -fold_span_only!(fold_lit_int: LitInt); -#[cfg(any(feature = "full", feature = "derive"))] -fold_span_only!(fold_lit_str: LitStr); #[cfg(any(feature = "derive", feature = "full"))] pub fn fold_abi(_visitor: &mut V, _i: Abi) -> Abi { Abi { @@ -1956,8 +1935,8 @@ attrs: FoldHelper::lift(_i.attrs, |it| _visitor.fold_attribute(it)), vis: _visitor.fold_visibility(_i.vis), constness: (_i.constness).map(|it| Token![const](tokens_helper(_visitor, &it.span))), - unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))), asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))), + unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))), abi: (_i.abi).map(|it| _visitor.fold_abi(it)), ident: _visitor.fold_ident(_i.ident), decl: Box::new(_visitor.fold_fn_decl(*_i.decl)), @@ -2176,6 +2155,48 @@ } } #[cfg(any(feature = "derive", feature = "full"))] +pub fn fold_lit_byte(_visitor: &mut V, _i: LitByte) -> LitByte { + let span = _visitor.fold_span(_i.span()); + let mut _i = _i; + _i.set_span(span); + _i +} +#[cfg(any(feature = "derive", feature = "full"))] +pub fn fold_lit_byte_str(_visitor: &mut V, _i: LitByteStr) -> LitByteStr { + let span = _visitor.fold_span(_i.span()); + let mut _i = _i; + _i.set_span(span); + _i +} +#[cfg(any(feature = "derive", feature = "full"))] +pub fn fold_lit_char(_visitor: &mut V, _i: LitChar) -> LitChar { + let span = _visitor.fold_span(_i.span()); + let mut _i = _i; + _i.set_span(span); + _i +} +#[cfg(any(feature = "derive", feature = "full"))] +pub fn fold_lit_float(_visitor: &mut V, _i: LitFloat) -> LitFloat { + let span = _visitor.fold_span(_i.span()); + let mut _i = _i; + _i.set_span(span); + _i +} +#[cfg(any(feature = "derive", feature = "full"))] +pub fn fold_lit_int(_visitor: &mut V, _i: LitInt) -> LitInt { + let span = _visitor.fold_span(_i.span()); + let mut _i = _i; + _i.set_span(span); + _i +} +#[cfg(any(feature = "derive", feature = "full"))] +pub fn fold_lit_str(_visitor: &mut V, _i: LitStr) -> LitStr { + let span = _visitor.fold_span(_i.span()); + let mut _i = _i; + _i.set_span(span); + _i +} +#[cfg(any(feature = "derive", feature = "full"))] pub fn fold_lit_verbatim(_visitor: &mut V, _i: LitVerbatim) -> LitVerbatim { LitVerbatim { token: _i.token } } @@ -2264,8 +2285,8 @@ pub fn fold_method_sig(_visitor: &mut V, _i: MethodSig) -> MethodSig { MethodSig { constness: (_i.constness).map(|it| Token![const](tokens_helper(_visitor, &it.span))), - unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))), asyncness: (_i.asyncness).map(|it| Token![async](tokens_helper(_visitor, &it.span))), + unsafety: (_i.unsafety).map(|it| Token![unsafe](tokens_helper(_visitor, &it.span))), abi: (_i.abi).map(|it| _visitor.fold_abi(it)), ident: _visitor.fold_ident(_i.ident), decl: _visitor.fold_fn_decl(_i.decl), diff -Nru cargo-0.35.0/vendor/syn/src/gen/visit_mut.rs cargo-0.37.0/vendor/syn/src/gen/visit_mut.rs --- cargo-0.35.0/vendor/syn/src/gen/visit_mut.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/src/gen/visit_mut.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,4 +1,5 @@ -// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT +// This file is @generated by syn-internal-codegen. +// It is not intended for manual editing. #[cfg(any(feature = "full", feature = "derive"))] use gen::helper::visit_mut::*; @@ -2157,10 +2158,10 @@ if let Some(ref mut it) = _i.constness { tokens_helper(_visitor, &mut it.span) }; - if let Some(ref mut it) = _i.unsafety { + if let Some(ref mut it) = _i.asyncness { tokens_helper(_visitor, &mut it.span) }; - if let Some(ref mut it) = _i.asyncness { + if let Some(ref mut it) = _i.unsafety { tokens_helper(_visitor, &mut it.span) }; if let Some(ref mut it) = _i.abi { @@ -2525,10 +2526,10 @@ if let Some(ref mut it) = _i.constness { tokens_helper(_visitor, &mut it.span) }; - if let Some(ref mut it) = _i.unsafety { + if let Some(ref mut it) = _i.asyncness { tokens_helper(_visitor, &mut it.span) }; - if let Some(ref mut it) = _i.asyncness { + if let Some(ref mut it) = _i.unsafety { tokens_helper(_visitor, &mut it.span) }; if let Some(ref mut it) = _i.abi { diff -Nru cargo-0.35.0/vendor/syn/src/gen/visit.rs cargo-0.37.0/vendor/syn/src/gen/visit.rs --- cargo-0.35.0/vendor/syn/src/gen/visit.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/src/gen/visit.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,4 +1,5 @@ -// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT +// This file is @generated by syn-internal-codegen. +// It is not intended for manual editing. #![cfg_attr(feature = "cargo-clippy", allow(trivially_copy_pass_by_ref))] #[cfg(any(feature = "full", feature = "derive"))] @@ -2199,10 +2200,10 @@ if let Some(ref it) = _i.constness { tokens_helper(_visitor, &it.span) }; - if let Some(ref it) = _i.unsafety { + if let Some(ref it) = _i.asyncness { tokens_helper(_visitor, &it.span) }; - if let Some(ref it) = _i.asyncness { + if let Some(ref it) = _i.unsafety { tokens_helper(_visitor, &it.span) }; if let Some(ref it) = _i.abi { @@ -2582,10 +2583,10 @@ if let Some(ref it) = _i.constness { tokens_helper(_visitor, &it.span) }; - if let Some(ref it) = _i.unsafety { + if let Some(ref it) = _i.asyncness { tokens_helper(_visitor, &it.span) }; - if let Some(ref it) = _i.asyncness { + if let Some(ref it) = _i.unsafety { tokens_helper(_visitor, &it.span) }; if let Some(ref it) = _i.abi { diff -Nru cargo-0.35.0/vendor/syn/src/generics.rs cargo-0.37.0/vendor/syn/src/generics.rs --- cargo-0.35.0/vendor/syn/src/generics.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/src/generics.rs 2019-07-17 05:42:23.000000000 +0000 @@ -484,7 +484,8 @@ let lt_token: Token![<] = input.parse()?; let mut params = Punctuated::new(); - let mut has_type_param = false; + let mut allow_lifetime_param = true; + let mut allow_type_param = true; loop { if input.peek(Token![>]) { break; @@ -492,17 +493,24 @@ let attrs = input.call(Attribute::parse_outer)?; let lookahead = input.lookahead1(); - if !has_type_param && lookahead.peek(Lifetime) { + if allow_lifetime_param && lookahead.peek(Lifetime) { params.push_value(GenericParam::Lifetime(LifetimeDef { attrs: attrs, ..input.parse()? })); - } else if lookahead.peek(Ident) { - has_type_param = true; + } else if allow_type_param && lookahead.peek(Ident) { + allow_lifetime_param = false; params.push_value(GenericParam::Type(TypeParam { attrs: attrs, ..input.parse()? })); + } else if lookahead.peek(Token![const]) { + allow_lifetime_param = false; + allow_type_param = false; + params.push_value(GenericParam::Const(ConstParam { + attrs: attrs, + ..input.parse()? + })); } else { return Err(lookahead.error()); } diff -Nru cargo-0.35.0/vendor/syn/src/group.rs cargo-0.37.0/vendor/syn/src/group.rs --- cargo-0.35.0/vendor/syn/src/group.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/src/group.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,7 +1,7 @@ use proc_macro2::{Delimiter, Span}; use error::Result; -use parse::{ParseBuffer, ParseStream}; +use parse::ParseBuffer; use private; use token; @@ -36,7 +36,7 @@ // Not public API. #[doc(hidden)] -pub fn parse_parens(input: ParseStream) -> Result { +pub fn parse_parens<'a>(input: &ParseBuffer<'a>) -> Result> { parse_delimited(input, Delimiter::Parenthesis).map(|(span, content)| Parens { token: token::Paren(span), content: content, @@ -45,7 +45,7 @@ // Not public API. #[doc(hidden)] -pub fn parse_braces(input: ParseStream) -> Result { +pub fn parse_braces<'a>(input: &ParseBuffer<'a>) -> Result> { parse_delimited(input, Delimiter::Brace).map(|(span, content)| Braces { token: token::Brace(span), content: content, @@ -54,7 +54,7 @@ // Not public API. #[doc(hidden)] -pub fn parse_brackets(input: ParseStream) -> Result { +pub fn parse_brackets<'a>(input: &ParseBuffer<'a>) -> Result> { parse_delimited(input, Delimiter::Bracket).map(|(span, content)| Brackets { token: token::Bracket(span), content: content, @@ -63,7 +63,7 @@ #[cfg(any(feature = "full", feature = "derive"))] impl private { - pub fn parse_group(input: ParseStream) -> Result { + pub fn parse_group<'a>(input: &ParseBuffer<'a>) -> Result> { parse_delimited(input, Delimiter::None).map(|(span, content)| Group { token: token::Group(span), content: content, @@ -71,7 +71,10 @@ } } -fn parse_delimited(input: ParseStream, delimiter: Delimiter) -> Result<(Span, ParseBuffer)> { +fn parse_delimited<'a>( + input: &ParseBuffer<'a>, + delimiter: Delimiter, +) -> Result<(Span, ParseBuffer<'a>)> { input.step(|cursor| { if let Some((content, span, rest)) = cursor.group(delimiter) { #[cfg(procmacro2_semver_exempt)] diff -Nru cargo-0.35.0/vendor/syn/src/ident.rs cargo-0.37.0/vendor/syn/src/ident.rs --- cargo-0.35.0/vendor/syn/src/ident.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/src/ident.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,11 +1,11 @@ #[cfg(feature = "parsing")] use buffer::Cursor; #[cfg(feature = "parsing")] -use lookahead; -#[cfg(feature = "parsing")] use parse::{Parse, ParseStream, Result}; #[cfg(feature = "parsing")] use token::Token; +#[cfg(feature = "parsing")] +use {lookahead, private}; pub use proc_macro2::Ident; @@ -19,17 +19,17 @@ #[cfg(feature = "parsing")] fn accept_as_ident(ident: &Ident) -> bool { match ident.to_string().as_str() { - "_" + "_" | // Based on https://doc.rust-lang.org/grammar.html#keywords // and https://github.com/rust-lang/rfcs/blob/master/text/2421-unreservations-2018.md // and https://github.com/rust-lang/rfcs/blob/master/text/2420-unreserve-proc.md - | "abstract" | "as" | "become" | "box" | "break" | "const" - | "continue" | "crate" | "do" | "else" | "enum" | "extern" | "false" | "final" - | "fn" | "for" | "if" | "impl" | "in" | "let" | "loop" | "macro" | "match" - | "mod" | "move" | "mut" | "override" | "priv" | "pub" - | "ref" | "return" | "Self" | "self" | "static" | "struct" - | "super" | "trait" | "true" | "type" | "typeof" | "unsafe" | "unsized" | "use" - | "virtual" | "where" | "while" | "yield" => false, + "abstract" | "as" | "become" | "box" | "break" | "const" | "continue" | + "crate" | "do" | "else" | "enum" | "extern" | "false" | "final" | "fn" | + "for" | "if" | "impl" | "in" | "let" | "loop" | "macro" | "match" | + "mod" | "move" | "mut" | "override" | "priv" | "pub" | "ref" | + "return" | "Self" | "self" | "static" | "struct" | "super" | "trait" | + "true" | "type" | "typeof" | "unsafe" | "unsized" | "use" | "virtual" | + "where" | "while" | "yield" => false, _ => true, } } @@ -84,3 +84,17 @@ Ident::new("_", token.span) } } + +#[cfg(feature = "parsing")] +impl private { + #[cfg(syn_can_use_associated_constants)] + pub fn peek_any_ident(input: ParseStream) -> bool { + use ext::IdentExt; + input.peek(Ident::peek_any) + } + + #[cfg(not(syn_can_use_associated_constants))] + pub fn peek_any_ident(input: ParseStream) -> bool { + input.cursor().ident().is_some() + } +} diff -Nru cargo-0.35.0/vendor/syn/src/item.rs cargo-0.37.0/vendor/syn/src/item.rs --- cargo-0.35.0/vendor/syn/src/item.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/src/item.rs 2019-07-17 05:42:23.000000000 +0000 @@ -84,8 +84,8 @@ pub attrs: Vec, pub vis: Visibility, pub constness: Option, - pub unsafety: Option, pub asyncness: Option, + pub unsafety: Option, pub abi: Option, pub ident: Ident, pub decl: Box, @@ -687,8 +687,8 @@ /// *This type is available if Syn is built with the `"full"` feature.* pub struct MethodSig { pub constness: Option, - pub unsafety: Option, pub asyncness: Option, + pub unsafety: Option, pub abi: Option, pub ident: Ident, pub decl: FnDecl, @@ -767,12 +767,12 @@ impl Parse for Item { fn parse(input: ParseStream) -> Result { + let mut attrs = input.call(Attribute::parse_outer)?; let ahead = input.fork(); - ahead.call(Attribute::parse_outer)?; let vis: Visibility = ahead.parse()?; let lookahead = ahead.lookahead1(); - if lookahead.peek(Token![extern]) { + let mut item = if lookahead.peek(Token![extern]) { ahead.parse::()?; let lookahead = ahead.lookahead1(); if lookahead.peek(Token![crate]) { @@ -864,7 +864,34 @@ input.parse().map(Item::Macro) } else { Err(lookahead.error()) + }?; + + { + let item_attrs = match item { + Item::ExternCrate(ref mut item) => &mut item.attrs, + Item::Use(ref mut item) => &mut item.attrs, + Item::Static(ref mut item) => &mut item.attrs, + Item::Const(ref mut item) => &mut item.attrs, + Item::Fn(ref mut item) => &mut item.attrs, + Item::Mod(ref mut item) => &mut item.attrs, + Item::ForeignMod(ref mut item) => &mut item.attrs, + Item::Type(ref mut item) => &mut item.attrs, + Item::Existential(ref mut item) => &mut item.attrs, + Item::Struct(ref mut item) => &mut item.attrs, + Item::Enum(ref mut item) => &mut item.attrs, + Item::Union(ref mut item) => &mut item.attrs, + Item::Trait(ref mut item) => &mut item.attrs, + Item::TraitAlias(ref mut item) => &mut item.attrs, + Item::Impl(ref mut item) => &mut item.attrs, + Item::Macro(ref mut item) => &mut item.attrs, + Item::Macro2(ref mut item) => &mut item.attrs, + Item::Verbatim(_) => unreachable!(), + }; + attrs.extend(item_attrs.drain(..)); + *item_attrs = attrs; } + + Ok(item) } } @@ -1084,8 +1111,8 @@ let outer_attrs = input.call(Attribute::parse_outer)?; let vis: Visibility = input.parse()?; let constness: Option = input.parse()?; - let unsafety: Option = input.parse()?; let asyncness: Option = input.parse()?; + let unsafety: Option = input.parse()?; let abi: Option = input.parse()?; let fn_token: Token![fn] = input.parse()?; let ident: Ident = input.parse()?; @@ -1114,8 +1141,8 @@ attrs: private::attrs(outer_attrs, inner_attrs), vis: vis, constness: constness, - unsafety: unsafety, asyncness: asyncness, + unsafety: unsafety, abi: abi, ident: ident, decl: Box::new(FnDecl { @@ -1139,6 +1166,8 @@ impl Parse for FnArg { fn parse(input: ParseStream) -> Result { + // TODO: optimize using advance_to + if input.peek(Token![&]) { let ahead = input.fork(); if ahead.call(arg_self_ref).is_ok() && !ahead.peek(Token![:]) { @@ -1273,12 +1302,12 @@ impl Parse for ForeignItem { fn parse(input: ParseStream) -> Result { + let mut attrs = input.call(Attribute::parse_outer)?; let ahead = input.fork(); - ahead.call(Attribute::parse_outer)?; let vis: Visibility = ahead.parse()?; let lookahead = ahead.lookahead1(); - if lookahead.peek(Token![fn]) { + let mut item = if lookahead.peek(Token![fn]) { input.parse().map(ForeignItem::Fn) } else if lookahead.peek(Token![static]) { input.parse().map(ForeignItem::Static) @@ -1295,7 +1324,21 @@ input.parse().map(ForeignItem::Macro) } else { Err(lookahead.error()) + }?; + + { + let item_attrs = match item { + ForeignItem::Fn(ref mut item) => &mut item.attrs, + ForeignItem::Static(ref mut item) => &mut item.attrs, + ForeignItem::Type(ref mut item) => &mut item.attrs, + ForeignItem::Macro(ref mut item) => &mut item.attrs, + ForeignItem::Verbatim(_) => unreachable!(), + }; + attrs.extend(item_attrs.drain(..)); + *item_attrs = attrs; } + + Ok(item) } } @@ -1664,11 +1707,11 @@ impl Parse for TraitItem { fn parse(input: ParseStream) -> Result { + let mut attrs = input.call(Attribute::parse_outer)?; let ahead = input.fork(); - ahead.call(Attribute::parse_outer)?; let lookahead = ahead.lookahead1(); - if lookahead.peek(Token![const]) { + let mut item = if lookahead.peek(Token![const]) { ahead.parse::()?; let lookahead = ahead.lookahead1(); if lookahead.peek(Ident) { @@ -1698,7 +1741,21 @@ input.parse().map(TraitItem::Macro) } else { Err(lookahead.error()) + }?; + + { + let item_attrs = match item { + TraitItem::Const(ref mut item) => &mut item.attrs, + TraitItem::Method(ref mut item) => &mut item.attrs, + TraitItem::Type(ref mut item) => &mut item.attrs, + TraitItem::Macro(ref mut item) => &mut item.attrs, + TraitItem::Verbatim(_) => unreachable!(), + }; + attrs.extend(item_attrs.drain(..)); + *item_attrs = attrs; } + + Ok(item) } } @@ -1759,8 +1816,8 @@ attrs: private::attrs(outer_attrs, inner_attrs), sig: MethodSig { constness: constness, - unsafety: unsafety, asyncness: None, + unsafety: unsafety, abi: abi, ident: ident, decl: FnDecl { @@ -1864,6 +1921,7 @@ }; let trait_ = { + // TODO: optimize using advance_to let ahead = input.fork(); if ahead.parse::>().is_ok() && ahead.parse::().is_ok() @@ -1908,8 +1966,8 @@ impl Parse for ImplItem { fn parse(input: ParseStream) -> Result { + let mut attrs = input.call(Attribute::parse_outer)?; let ahead = input.fork(); - ahead.call(Attribute::parse_outer)?; let vis: Visibility = ahead.parse()?; let mut lookahead = ahead.lookahead1(); @@ -1921,7 +1979,7 @@ None }; - if lookahead.peek(Token![const]) { + let mut item = if lookahead.peek(Token![const]) { ahead.parse::()?; let lookahead = ahead.lookahead1(); if lookahead.peek(Ident) { @@ -1960,7 +2018,22 @@ input.parse().map(ImplItem::Macro) } else { Err(lookahead.error()) + }?; + + { + let item_attrs = match item { + ImplItem::Const(ref mut item) => &mut item.attrs, + ImplItem::Method(ref mut item) => &mut item.attrs, + ImplItem::Type(ref mut item) => &mut item.attrs, + ImplItem::Existential(ref mut item) => &mut item.attrs, + ImplItem::Macro(ref mut item) => &mut item.attrs, + ImplItem::Verbatim(_) => unreachable!(), + }; + attrs.extend(item_attrs.drain(..)); + *item_attrs = attrs; } + + Ok(item) } } @@ -1987,8 +2060,8 @@ let vis: Visibility = input.parse()?; let defaultness: Option = input.parse()?; let constness: Option = input.parse()?; - let unsafety: Option = input.parse()?; let asyncness: Option = input.parse()?; + let unsafety: Option = input.parse()?; let abi: Option = input.parse()?; let fn_token: Token![fn] = input.parse()?; let ident: Ident = input.parse()?; @@ -2012,8 +2085,8 @@ defaultness: defaultness, sig: MethodSig { constness: constness, - unsafety: unsafety, asyncness: asyncness, + unsafety: unsafety, abi: abi, ident: ident, decl: FnDecl { @@ -2178,8 +2251,8 @@ tokens.append_all(self.attrs.outer()); self.vis.to_tokens(tokens); self.constness.to_tokens(tokens); - self.unsafety.to_tokens(tokens); self.asyncness.to_tokens(tokens); + self.unsafety.to_tokens(tokens); self.abi.to_tokens(tokens); NamedDecl(&self.decl, &self.ident).to_tokens(tokens); self.block.brace_token.surround(tokens, |tokens| { @@ -2625,8 +2698,8 @@ impl ToTokens for MethodSig { fn to_tokens(&self, tokens: &mut TokenStream) { self.constness.to_tokens(tokens); - self.unsafety.to_tokens(tokens); self.asyncness.to_tokens(tokens); + self.unsafety.to_tokens(tokens); self.abi.to_tokens(tokens); NamedDecl(&self.decl, &self.ident).to_tokens(tokens); } diff -Nru cargo-0.35.0/vendor/syn/src/lib.rs cargo-0.37.0/vendor/syn/src/lib.rs --- cargo-0.35.0/vendor/syn/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -178,6 +178,19 @@ //! | ^^^ //! ``` //! +//! ## Testing +//! +//! When testing macros, we often care not just that the macro can be used +//! successfully but also that when the macro is provided with invalid input it +//! produces maximally helpful error messages. Consider using the [`trybuild`] +//! crate to write tests for errors that are emitted by your macro or errors +//! detected by the Rust compiler in the expanded code following misuse of the +//! macro. Such tests help avoid regressions from later refactors that +//! mistakenly make an error no longer trigger or be less helpful than it used +//! to be. +//! +//! [`trybuild`]: https://github.com/dtolnay/trybuild +//! //! ## Debugging //! //! When developing a procedural macro it can be helpful to look at what the @@ -222,7 +235,8 @@ //! dynamic library libproc_macro from rustc toolchain. // Syn types in rustdoc of other crates get linked to here. -#![doc(html_root_url = "https://docs.rs/syn/0.15.34")] +#![doc(html_root_url = "https://docs.rs/syn/0.15.39")] +#![allow(unknown_lints, bare_trait_objects, ellipsis_inclusive_range_patterns)] #![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))] // Ignored clippy lints. @@ -231,7 +245,6 @@ allow( block_in_if_condition_stmt, cognitive_complexity, - const_static_lifetime, deprecated_cfg_attr, doc_markdown, eval_order_dependence, @@ -239,6 +252,7 @@ needless_pass_by_value, never_loop, redundant_field_names, + redundant_static_lifetimes, too_many_arguments, ) )] diff -Nru cargo-0.35.0/vendor/syn/src/mac.rs cargo-0.37.0/vendor/syn/src/mac.rs --- cargo-0.35.0/vendor/syn/src/mac.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/src/mac.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,11 +1,11 @@ use super::*; use proc_macro2::TokenStream; #[cfg(feature = "parsing")] -use proc_macro2::{Delimiter, TokenTree}; +use proc_macro2::{Delimiter, Span, TokenTree}; use token::{Brace, Bracket, Paren}; #[cfg(feature = "parsing")] -use parse::{ParseStream, Result}; +use parse::{Parse, ParseStream, Parser, Result}; #[cfg(feature = "extra-traits")] use std::hash::{Hash, Hasher}; #[cfg(feature = "extra-traits")] @@ -62,6 +62,114 @@ } } +#[cfg(feature = "parsing")] +fn delimiter_span(delimiter: &MacroDelimiter) -> Span { + match *delimiter { + MacroDelimiter::Paren(ref token) => token.span, + MacroDelimiter::Brace(ref token) => token.span, + MacroDelimiter::Bracket(ref token) => token.span, + } +} + +impl Macro { + /// Parse the tokens within the macro invocation's delimiters into a syntax + /// tree. + /// + /// This is equivalent to `syn::parse2::(mac.tts)` except that it + /// produces a more useful span when `tts` is empty. + /// + /// # Example + /// + /// ```edition2018 + /// use syn::{parse_quote, Expr, ExprLit, Ident, Lit, LitStr, Macro, Token}; + /// use syn::ext::IdentExt; + /// use syn::parse::{Error, Parse, ParseStream, Result}; + /// use syn::punctuated::Punctuated; + /// + /// // The arguments expected by libcore's format_args macro, and as a + /// // result most other formatting and printing macros like println. + /// // + /// // println!("{} is {number:.prec$}", "x", prec=5, number=0.01) + /// struct FormatArgs { + /// format_string: Expr, + /// positional_args: Vec, + /// named_args: Vec<(Ident, Expr)>, + /// } + /// + /// impl Parse for FormatArgs { + /// fn parse(input: ParseStream) -> Result { + /// let format_string: Expr; + /// let mut positional_args = Vec::new(); + /// let mut named_args = Vec::new(); + /// + /// format_string = input.parse()?; + /// while !input.is_empty() { + /// input.parse::()?; + /// if input.is_empty() { + /// break; + /// } + /// if input.peek(Ident::peek_any) && input.peek2(Token![=]) { + /// while !input.is_empty() { + /// let name: Ident = input.call(Ident::parse_any)?; + /// input.parse::()?; + /// let value: Expr = input.parse()?; + /// named_args.push((name, value)); + /// if input.is_empty() { + /// break; + /// } + /// input.parse::()?; + /// } + /// break; + /// } + /// positional_args.push(input.parse()?); + /// } + /// + /// Ok(FormatArgs { + /// format_string, + /// positional_args, + /// named_args, + /// }) + /// } + /// } + /// + /// // Extract the first argument, the format string literal, from an + /// // invocation of a formatting or printing macro. + /// fn get_format_string(m: &Macro) -> Result { + /// let args: FormatArgs = m.parse_body()?; + /// match args.format_string { + /// Expr::Lit(ExprLit { lit: Lit::Str(lit), .. }) => Ok(lit), + /// other => { + /// // First argument was not a string literal expression. + /// // Maybe something like: println!(concat!(...), ...) + /// Err(Error::new_spanned(other, "format string must be a string literal")) + /// } + /// } + /// } + /// + /// fn main() { + /// let invocation = parse_quote! { + /// println!("{:?}", Instant::now()) + /// }; + /// let lit = get_format_string(&invocation).unwrap(); + /// assert_eq!(lit.value(), "{:?}"); + /// } + /// ``` + #[cfg(feature = "parsing")] + pub fn parse_body(&self) -> Result { + self.parse_body_with(T::parse) + } + + /// Parse the tokens within the macro invocation's delimiters using the + /// given parser. + #[cfg(feature = "parsing")] + pub fn parse_body_with(&self, parser: F) -> Result { + // TODO: see if we can get a group.span_close() span in here as the + // scope, rather than the span of the whole group. + let scope = delimiter_span(&self.delimiter); + private::parse_scoped(parser, scope, self.tts.clone()) + } +} + #[cfg(feature = "parsing")] pub fn parse_delimiter(input: ParseStream) -> Result<(MacroDelimiter, TokenStream)> { input.step(|cursor| { diff -Nru cargo-0.35.0/vendor/syn/src/parse.rs cargo-0.37.0/vendor/syn/src/parse.rs --- cargo-0.35.0/vendor/syn/src/parse.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/src/parse.rs 2019-07-17 05:42:23.000000000 +0000 @@ -188,6 +188,9 @@ //! //! *This module is available if Syn is built with the `"parsing"` feature.* +#[path = "discouraged.rs"] +pub mod discouraged; + use std::cell::Cell; use std::fmt::{self, Debug, Display}; use std::marker::PhantomData; @@ -745,9 +748,15 @@ /// parse stream. Only use a fork when the amount of work performed against /// the fork is small and bounded. /// - /// For a lower level but occasionally more performant way to perform - /// speculative parsing, consider using [`ParseStream::step`] instead. + /// When complex speculative parsing against the forked stream is + /// unavoidable, use [`parse::discouraged::Speculative`] to advance the + /// original stream once the fork's parse is determined to have been + /// successful. + /// + /// For a lower level way to perform speculative parsing at the token level, + /// consider using [`ParseStream::step`] instead. /// + /// [`parse::discouraged::Speculative`]: ./discouraged/trait.Speculative.html /// [`ParseStream::step`]: #method.step /// /// # Example @@ -1082,6 +1091,13 @@ fn parse_str(self, s: &str) -> Result { self.parse2(proc_macro2::TokenStream::from_str(s)?) } + + // Not public API. + #[doc(hidden)] + fn __parse_scoped(self, scope: Span, tokens: TokenStream) -> Result { + let _ = scope; + self.parse2(tokens) + } } fn tokens_to_parse_buffer(tokens: &TokenBuffer) -> ParseBuffer { @@ -1108,4 +1124,25 @@ Err(state.error("unexpected token")) } } + + #[doc(hidden)] + fn __parse_scoped(self, scope: Span, tokens: TokenStream) -> Result { + let buf = TokenBuffer::new2(tokens); + let cursor = buf.begin(); + let unexpected = Rc::new(Cell::new(None)); + let state = private::new_parse_buffer(scope, cursor, unexpected); + let node = self(&state)?; + state.check_unexpected()?; + if state.is_empty() { + Ok(node) + } else { + Err(state.error("unexpected token")) + } + } +} + +impl private { + pub fn parse_scoped(f: F, scope: Span, tokens: TokenStream) -> Result { + f.__parse_scoped(scope, tokens) + } } diff -Nru cargo-0.35.0/vendor/syn/src/path.rs cargo-0.37.0/vendor/syn/src/path.rs --- cargo-0.35.0/vendor/syn/src/path.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/src/path.rs 2019-07-17 05:42:23.000000000 +0000 @@ -293,7 +293,6 @@ fn parse_helper(input: ParseStream, expr_style: bool) -> Result { if input.peek(Token![super]) || input.peek(Token![self]) - || input.peek(Token![Self]) || input.peek(Token![crate]) || input.peek(Token![extern]) { @@ -301,7 +300,12 @@ return Ok(PathSegment::from(ident)); } - let ident = input.parse()?; + let ident = if input.peek(Token![Self]) { + input.call(Ident::parse_any)? + } else { + input.parse()? + }; + if !expr_style && input.peek(Token![<]) && !input.peek(Token![<=]) || input.peek(Token![::]) && input.peek3(Token![<]) { @@ -442,10 +446,6 @@ } fn parse_helper(input: ParseStream, expr_style: bool) -> Result { - if input.peek(Token![dyn]) { - return Err(input.error("expected path")); - } - Ok(Path { leading_colon: input.parse()?, segments: { diff -Nru cargo-0.35.0/vendor/syn/src/token.rs cargo-0.37.0/vendor/syn/src/token.rs --- cargo-0.35.0/vendor/syn/src/token.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/syn/src/token.rs 2019-07-17 05:42:23.000000000 +0000 @@ -701,117 +701,128 @@ " " pub struct Group /// None-delimited group } -/// A type-macro that expands to the name of the Rust type representation of a -/// given token. -/// -/// See the [token module] documentation for details and examples. -/// -/// [token module]: token/index.html -// Unfortunate duplication due to a rustdoc bug. -// https://github.com/rust-lang/rust/issues/45939 -#[macro_export] -#[cfg_attr(rustfmt, rustfmt_skip)] -macro_rules! Token { - (abstract) => { $crate::token::Abstract }; - (as) => { $crate::token::As }; - (async) => { $crate::token::Async }; - (auto) => { $crate::token::Auto }; - (become) => { $crate::token::Become }; - (box) => { $crate::token::Box }; - (break) => { $crate::token::Break }; - (const) => { $crate::token::Const }; - (continue) => { $crate::token::Continue }; - (crate) => { $crate::token::Crate }; - (default) => { $crate::token::Default }; - (do) => { $crate::token::Do }; - (dyn) => { $crate::token::Dyn }; - (else) => { $crate::token::Else }; - (enum) => { $crate::token::Enum }; - (existential) => { $crate::token::Existential }; - (extern) => { $crate::token::Extern }; - (final) => { $crate::token::Final }; - (fn) => { $crate::token::Fn }; - (for) => { $crate::token::For }; - (if) => { $crate::token::If }; - (impl) => { $crate::token::Impl }; - (in) => { $crate::token::In }; - (let) => { $crate::token::Let }; - (loop) => { $crate::token::Loop }; - (macro) => { $crate::token::Macro }; - (match) => { $crate::token::Match }; - (mod) => { $crate::token::Mod }; - (move) => { $crate::token::Move }; - (mut) => { $crate::token::Mut }; - (override) => { $crate::token::Override }; - (priv) => { $crate::token::Priv }; - (pub) => { $crate::token::Pub }; - (ref) => { $crate::token::Ref }; - (return) => { $crate::token::Return }; - (Self) => { $crate::token::SelfType }; - (self) => { $crate::token::SelfValue }; - (static) => { $crate::token::Static }; - (struct) => { $crate::token::Struct }; - (super) => { $crate::token::Super }; - (trait) => { $crate::token::Trait }; - (try) => { $crate::token::Try }; - (type) => { $crate::token::Type }; - (typeof) => { $crate::token::Typeof }; - (union) => { $crate::token::Union }; - (unsafe) => { $crate::token::Unsafe }; - (unsized) => { $crate::token::Unsized }; - (use) => { $crate::token::Use }; - (virtual) => { $crate::token::Virtual }; - (where) => { $crate::token::Where }; - (while) => { $crate::token::While }; - (yield) => { $crate::token::Yield }; - (+) => { $crate::token::Add }; - (+=) => { $crate::token::AddEq }; - (&) => { $crate::token::And }; - (&&) => { $crate::token::AndAnd }; - (&=) => { $crate::token::AndEq }; - (@) => { $crate::token::At }; - (!) => { $crate::token::Bang }; - (^) => { $crate::token::Caret }; - (^=) => { $crate::token::CaretEq }; - (:) => { $crate::token::Colon }; - (::) => { $crate::token::Colon2 }; - (,) => { $crate::token::Comma }; - (/) => { $crate::token::Div }; - (/=) => { $crate::token::DivEq }; - (.) => { $crate::token::Dot }; - (..) => { $crate::token::Dot2 }; - (...) => { $crate::token::Dot3 }; - (..=) => { $crate::token::DotDotEq }; - (=) => { $crate::token::Eq }; - (==) => { $crate::token::EqEq }; - (>=) => { $crate::token::Ge }; - (>) => { $crate::token::Gt }; - (<=) => { $crate::token::Le }; - (<) => { $crate::token::Lt }; - (*=) => { $crate::token::MulEq }; - (!=) => { $crate::token::Ne }; - (|) => { $crate::token::Or }; - (|=) => { $crate::token::OrEq }; - (||) => { $crate::token::OrOr }; - (#) => { $crate::token::Pound }; - (?) => { $crate::token::Question }; - (->) => { $crate::token::RArrow }; - (<-) => { $crate::token::LArrow }; - (%) => { $crate::token::Rem }; - (%=) => { $crate::token::RemEq }; - (=>) => { $crate::token::FatArrow }; - (;) => { $crate::token::Semi }; - (<<) => { $crate::token::Shl }; - (<<=) => { $crate::token::ShlEq }; - (>>) => { $crate::token::Shr }; - (>>=) => { $crate::token::ShrEq }; - (*) => { $crate::token::Star }; - (-) => { $crate::token::Sub }; - (-=) => { $crate::token::SubEq }; - (~) => { $crate::token::Tilde }; - (_) => { $crate::token::Underscore }; +macro_rules! export_token_macro { + ($($dollar:tt)*) => { + /// A type-macro that expands to the name of the Rust type representation of a + /// given token. + /// + /// See the [token module] documentation for details and examples. + /// + /// [token module]: token/index.html + // Unfortunate duplication due to a rustdoc bug. + // https://github.com/rust-lang/rust/issues/45939 + #[macro_export] + macro_rules! Token { + (abstract) => { $crate::token::Abstract }; + (as) => { $crate::token::As }; + (async) => { $crate::token::Async }; + (auto) => { $crate::token::Auto }; + (become) => { $crate::token::Become }; + (box) => { $crate::token::Box }; + (break) => { $crate::token::Break }; + (const) => { $crate::token::Const }; + (continue) => { $crate::token::Continue }; + (crate) => { $crate::token::Crate }; + (default) => { $crate::token::Default }; + (do) => { $crate::token::Do }; + (dyn) => { $crate::token::Dyn }; + (else) => { $crate::token::Else }; + (enum) => { $crate::token::Enum }; + (existential) => { $crate::token::Existential }; + (extern) => { $crate::token::Extern }; + (final) => { $crate::token::Final }; + (fn) => { $crate::token::Fn }; + (for) => { $crate::token::For }; + (if) => { $crate::token::If }; + (impl) => { $crate::token::Impl }; + (in) => { $crate::token::In }; + (let) => { $crate::token::Let }; + (loop) => { $crate::token::Loop }; + (macro) => { $crate::token::Macro }; + (match) => { $crate::token::Match }; + (mod) => { $crate::token::Mod }; + (move) => { $crate::token::Move }; + (mut) => { $crate::token::Mut }; + (override) => { $crate::token::Override }; + (priv) => { $crate::token::Priv }; + (pub) => { $crate::token::Pub }; + (ref) => { $crate::token::Ref }; + (return) => { $crate::token::Return }; + (Self) => { $crate::token::SelfType }; + (self) => { $crate::token::SelfValue }; + (static) => { $crate::token::Static }; + (struct) => { $crate::token::Struct }; + (super) => { $crate::token::Super }; + (trait) => { $crate::token::Trait }; + (try) => { $crate::token::Try }; + (type) => { $crate::token::Type }; + (typeof) => { $crate::token::Typeof }; + (union) => { $crate::token::Union }; + (unsafe) => { $crate::token::Unsafe }; + (unsized) => { $crate::token::Unsized }; + (use) => { $crate::token::Use }; + (virtual) => { $crate::token::Virtual }; + (where) => { $crate::token::Where }; + (while) => { $crate::token::While }; + (yield) => { $crate::token::Yield }; + (+) => { $crate::token::Add }; + (+=) => { $crate::token::AddEq }; + (&) => { $crate::token::And }; + (&&) => { $crate::token::AndAnd }; + (&=) => { $crate::token::AndEq }; + (@) => { $crate::token::At }; + (!) => { $crate::token::Bang }; + (^) => { $crate::token::Caret }; + (^=) => { $crate::token::CaretEq }; + (:) => { $crate::token::Colon }; + (::) => { $crate::token::Colon2 }; + (,) => { $crate::token::Comma }; + (/) => { $crate::token::Div }; + (/=) => { $crate::token::DivEq }; + (.) => { $crate::token::Dot }; + (..) => { $crate::token::Dot2 }; + (...) => { $crate::token::Dot3 }; + (..=) => { $crate::token::DotDotEq }; + (=) => { $crate::token::Eq }; + (==) => { $crate::token::EqEq }; + (>=) => { $crate::token::Ge }; + (>) => { $crate::token::Gt }; + (<=) => { $crate::token::Le }; + (<) => { $crate::token::Lt }; + (*=) => { $crate::token::MulEq }; + (!=) => { $crate::token::Ne }; + (|) => { $crate::token::Or }; + (|=) => { $crate::token::OrEq }; + (||) => { $crate::token::OrOr }; + (#) => { $crate::token::Pound }; + (?) => { $crate::token::Question }; + (->) => { $crate::token::RArrow }; + (<-) => { $crate::token::LArrow }; + (%) => { $crate::token::Rem }; + (%=) => { $crate::token::RemEq }; + (=>) => { $crate::token::FatArrow }; + (;) => { $crate::token::Semi }; + (<<) => { $crate::token::Shl }; + (<<=) => { $crate::token::ShlEq }; + (>>) => { $crate::token::Shr }; + (>>=) => { $crate::token::ShrEq }; + (*) => { $crate::token::Star }; + (-) => { $crate::token::Sub }; + (-=) => { $crate::token::SubEq }; + (~) => { $crate::token::Tilde }; + (_) => { $crate::token::Underscore }; + $($dollar => { $crate::token::Dollar };)* + } + }; } +#[cfg(syn_can_match_trailing_dollar)] +export_token_macro![($)]; + +// Old rustc does not support ($) => {...} as a macro rule. +#[cfg(not(syn_can_match_trailing_dollar))] +export_token_macro![]; + // Old names. TODO: remove these re-exports in a breaking change. // https://github.com/dtolnay/syn/issues/486 #[doc(hidden)] diff -Nru cargo-0.35.0/vendor/syn/tests/clone.sh cargo-0.37.0/vendor/syn/tests/clone.sh --- cargo-0.35.0/vendor/syn/tests/clone.sh 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/clone.sh 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,16 @@ +#!/bin/bash + +REV=d132f544f9d74e3cc047ef211e57eae60b78e5c5 + +set -euo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")" +mkdir -p rust +touch rust/COMMIT + +if [ "$(cat rust/COMMIT)" != "$REV" ]; then + rm -rf rust + mkdir rust + curl -L "https://github.com/rust-lang/rust/archive/${REV}.tar.gz" \ + | tar xz --directory rust --strip-components 1 + echo "$REV" > rust/COMMIT +fi diff -Nru cargo-0.35.0/vendor/syn/tests/common/eq.rs cargo-0.37.0/vendor/syn/tests/common/eq.rs --- cargo-0.35.0/vendor/syn/tests/common/eq.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/common/eq.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,458 @@ +extern crate rustc_data_structures; +extern crate rustc_target; +extern crate syntax; +extern crate syntax_pos; + +use std::mem; + +use self::rustc_data_structures::sync::Lrc; +use self::rustc_data_structures::thin_vec::ThinVec; +use self::rustc_target::abi::FloatTy; +use self::rustc_target::spec::abi::Abi; +use self::syntax::ast::{ + AngleBracketedArgs, AnonConst, Arg, Arm, AsmDialect, AssocTyConstraint, AssocTyConstraintKind, + AttrId, AttrStyle, Attribute, AwaitOrigin, BareFnTy, BinOpKind, BindingMode, Block, + BlockCheckMode, CaptureBy, Constness, Crate, CrateSugar, Defaultness, EnumDef, Expr, ExprKind, + Field, FieldPat, FnDecl, FnHeader, ForeignItem, ForeignItemKind, ForeignMod, FunctionRetTy, + GenericArg, GenericArgs, GenericBound, GenericParam, GenericParamKind, Generics, GlobalAsm, + Ident, ImplItem, ImplItemKind, ImplPolarity, InlineAsm, InlineAsmOutput, IntTy, IsAsync, + IsAuto, Item, ItemKind, Label, Lifetime, Lit, LitIntType, LitKind, Local, MacDelimiter, + MacStmtStyle, Mac_, MacroDef, MethodSig, Mod, Movability, MutTy, Mutability, NodeId, + ParenthesizedArgs, Pat, PatKind, Path, PathSegment, PolyTraitRef, QSelf, RangeEnd, RangeLimits, + RangeSyntax, Stmt, StmtKind, StrStyle, StructField, TraitBoundModifier, TraitItem, + TraitItemKind, TraitObjectSyntax, TraitRef, Ty, TyKind, UintTy, UnOp, UnsafeSource, Unsafety, + UseTree, UseTreeKind, VariantData, Variant_, VisibilityKind, WhereBoundPredicate, WhereClause, + WhereEqPredicate, WherePredicate, WhereRegionPredicate, +}; +use self::syntax::parse::lexer::comments; +use self::syntax::parse::token::{self, DelimToken, Token, TokenKind}; +use self::syntax::ptr::P; +use self::syntax::source_map::Spanned; +use self::syntax::symbol::{sym, Symbol}; +use self::syntax::tokenstream::{DelimSpan, TokenStream, TokenTree}; +use self::syntax_pos::{Span, SyntaxContext, DUMMY_SP}; + +pub trait SpanlessEq { + fn eq(&self, other: &Self) -> bool; +} + +impl SpanlessEq for P { + fn eq(&self, other: &Self) -> bool { + SpanlessEq::eq(&**self, &**other) + } +} + +impl SpanlessEq for Lrc { + fn eq(&self, other: &Self) -> bool { + SpanlessEq::eq(&**self, &**other) + } +} + +impl SpanlessEq for Option { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (None, None) => true, + (Some(this), Some(other)) => SpanlessEq::eq(this, other), + _ => false, + } + } +} + +impl SpanlessEq for Vec { + fn eq(&self, other: &Self) -> bool { + self.len() == other.len() && self.iter().zip(other).all(|(a, b)| SpanlessEq::eq(a, b)) + } +} + +impl SpanlessEq for ThinVec { + fn eq(&self, other: &Self) -> bool { + self.len() == other.len() + && self + .iter() + .zip(other.iter()) + .all(|(a, b)| SpanlessEq::eq(a, b)) + } +} + +impl SpanlessEq for Spanned { + fn eq(&self, other: &Self) -> bool { + SpanlessEq::eq(&self.node, &other.node) + } +} + +impl SpanlessEq for (A, B) { + fn eq(&self, other: &Self) -> bool { + SpanlessEq::eq(&self.0, &other.0) && SpanlessEq::eq(&self.1, &other.1) + } +} + +impl SpanlessEq for (A, B, C) { + fn eq(&self, other: &Self) -> bool { + SpanlessEq::eq(&self.0, &other.0) + && SpanlessEq::eq(&self.1, &other.1) + && SpanlessEq::eq(&self.2, &other.2) + } +} + +macro_rules! spanless_eq_true { + ($name:ident) => { + impl SpanlessEq for $name { + fn eq(&self, _other: &Self) -> bool { + true + } + } + }; +} + +spanless_eq_true!(Span); +spanless_eq_true!(DelimSpan); +spanless_eq_true!(AttrId); +spanless_eq_true!(NodeId); +spanless_eq_true!(SyntaxContext); + +macro_rules! spanless_eq_partial_eq { + ($name:ident) => { + impl SpanlessEq for $name { + fn eq(&self, other: &Self) -> bool { + PartialEq::eq(self, other) + } + } + }; +} + +spanless_eq_partial_eq!(bool); +spanless_eq_partial_eq!(u8); +spanless_eq_partial_eq!(u16); +spanless_eq_partial_eq!(u128); +spanless_eq_partial_eq!(usize); +spanless_eq_partial_eq!(char); +spanless_eq_partial_eq!(Symbol); +spanless_eq_partial_eq!(Abi); +spanless_eq_partial_eq!(DelimToken); + +macro_rules! spanless_eq_struct { + { + $name:ident; + $([$field:ident $other:ident])* + $(![$ignore:ident])* + } => { + impl SpanlessEq for $name { + fn eq(&self, other: &Self) -> bool { + let $name { $($field,)* $($ignore: _,)* } = self; + let $name { $($field: $other,)* $($ignore: _,)* } = other; + $(SpanlessEq::eq($field, $other))&&* + } + } + }; + + { + $name:ident; + $([$field:ident $other:ident])* + $next:ident + $($rest:ident)* + $(!$ignore:ident)* + } => { + spanless_eq_struct! { + $name; + $([$field $other])* + [$next other] + $($rest)* + $(!$ignore)* + } + }; + + { + $name:ident; + $([$field:ident $other:ident])* + $(![$ignore:ident])* + !$next:ident + $(!$rest:ident)* + } => { + spanless_eq_struct! { + $name; + $([$field $other])* + $(![$ignore])* + ![$next] + $(!$rest)* + } + }; +} + +macro_rules! spanless_eq_enum { + { + $name:ident; + $([$variant:ident $([$field:tt $this:ident $other:ident])*])* + } => { + impl SpanlessEq for $name { + fn eq(&self, other: &Self) -> bool { + match self { + $( + $name::$variant { .. } => {} + )* + } + #[allow(unreachable_patterns)] + match (self, other) { + $( + ( + $name::$variant { $($field: $this),* }, + $name::$variant { $($field: $other),* }, + ) => { + true $(&& SpanlessEq::eq($this, $other))* + } + )* + _ => false, + } + } + } + }; + + { + $name:ident; + $([$variant:ident $($fields:tt)*])* + $next:ident [$($named:tt)*] ( $i:tt $($field:tt)* ) + $($rest:tt)* + } => { + spanless_eq_enum! { + $name; + $([$variant $($fields)*])* + $next [$($named)* [$i this other]] ( $($field)* ) + $($rest)* + } + }; + + { + $name:ident; + $([$variant:ident $($fields:tt)*])* + $next:ident [$($named:tt)*] () + $($rest:tt)* + } => { + spanless_eq_enum! { + $name; + $([$variant $($fields)*])* + [$next $($named)*] + $($rest)* + } + }; + + { + $name:ident; + $([$variant:ident $($fields:tt)*])* + $next:ident ( $($field:tt)* ) + $($rest:tt)* + } => { + spanless_eq_enum! { + $name; + $([$variant $($fields)*])* + $next [] ( $($field)* ) + $($rest)* + } + }; + + { + $name:ident; + $([$variant:ident $($fields:tt)*])* + $next:ident + $($rest:tt)* + } => { + spanless_eq_enum! { + $name; + $([$variant $($fields)*])* + [$next] + $($rest)* + } + }; +} + +spanless_eq_struct!(AngleBracketedArgs; span args constraints); +spanless_eq_struct!(AnonConst; id value); +spanless_eq_struct!(Arg; attrs ty pat id); +spanless_eq_struct!(Arm; attrs pats guard body span); +spanless_eq_struct!(AssocTyConstraint; id ident kind span); +spanless_eq_struct!(Attribute; id style path tokens span !is_sugared_doc); +spanless_eq_struct!(BareFnTy; unsafety abi generic_params decl); +spanless_eq_struct!(Block; stmts id rules span); +spanless_eq_struct!(Crate; module attrs span); +spanless_eq_struct!(EnumDef; variants); +spanless_eq_struct!(Expr; id node span attrs); +spanless_eq_struct!(Field; ident expr span is_shorthand attrs); +spanless_eq_struct!(FieldPat; ident pat is_shorthand attrs); +spanless_eq_struct!(FnDecl; inputs output c_variadic); +spanless_eq_struct!(FnHeader; constness asyncness unsafety abi); +spanless_eq_struct!(ForeignItem; ident attrs node id span vis); +spanless_eq_struct!(ForeignMod; abi items); +spanless_eq_struct!(GenericParam; id ident attrs bounds kind); +spanless_eq_struct!(Generics; params where_clause span); +spanless_eq_struct!(GlobalAsm; asm ctxt); +spanless_eq_struct!(ImplItem; id ident vis defaultness attrs generics node span !tokens); +spanless_eq_struct!(InlineAsm; asm asm_str_style outputs inputs clobbers volatile alignstack dialect ctxt); +spanless_eq_struct!(InlineAsmOutput; constraint expr is_rw is_indirect); +spanless_eq_struct!(Item; ident attrs id node vis span !tokens); +spanless_eq_struct!(Label; ident); +spanless_eq_struct!(Lifetime; id ident); +spanless_eq_struct!(Lit; token node span); +spanless_eq_struct!(Local; pat ty init id span attrs); +spanless_eq_struct!(Mac_; path delim tts); +spanless_eq_struct!(MacroDef; tokens legacy); +spanless_eq_struct!(MethodSig; header decl); +spanless_eq_struct!(Mod; inner items inline); +spanless_eq_struct!(MutTy; ty mutbl); +spanless_eq_struct!(ParenthesizedArgs; span inputs output); +spanless_eq_struct!(Pat; id node span); +spanless_eq_struct!(Path; span segments); +spanless_eq_struct!(PathSegment; ident id args); +spanless_eq_struct!(PolyTraitRef; bound_generic_params trait_ref span); +spanless_eq_struct!(QSelf; ty path_span position); +spanless_eq_struct!(Stmt; id node span); +spanless_eq_struct!(StructField; span ident vis id ty attrs); +spanless_eq_struct!(Token; kind span); +spanless_eq_struct!(TraitItem; id ident attrs generics node span !tokens); +spanless_eq_struct!(TraitRef; path ref_id); +spanless_eq_struct!(Ty; id node span); +spanless_eq_struct!(UseTree; prefix kind span); +spanless_eq_struct!(Variant_; ident attrs id data disr_expr); +spanless_eq_struct!(WhereBoundPredicate; span bound_generic_params bounded_ty bounds); +spanless_eq_struct!(WhereClause; predicates span); +spanless_eq_struct!(WhereEqPredicate; id span lhs_ty rhs_ty); +spanless_eq_struct!(WhereRegionPredicate; span lifetime bounds); +spanless_eq_enum!(AsmDialect; Att Intel); +spanless_eq_enum!(AssocTyConstraintKind; Equality(ty) Bound(bounds)); +spanless_eq_enum!(AttrStyle; Outer Inner); +spanless_eq_enum!(AwaitOrigin; FieldLike MacroLike); +spanless_eq_enum!(BinOpKind; Add Sub Mul Div Rem And Or BitXor BitAnd BitOr Shl Shr Eq Lt Le Ne Ge Gt); +spanless_eq_enum!(BindingMode; ByRef(0) ByValue(0)); +spanless_eq_enum!(BlockCheckMode; Default Unsafe(0)); +spanless_eq_enum!(CaptureBy; Value Ref); +spanless_eq_enum!(Constness; Const NotConst); +spanless_eq_enum!(CrateSugar; PubCrate JustCrate); +spanless_eq_enum!(Defaultness; Default Final); +spanless_eq_enum!(FloatTy; F32 F64); +spanless_eq_enum!(ForeignItemKind; Fn(0 1) Static(0 1) Ty Macro(0)); +spanless_eq_enum!(FunctionRetTy; Default(0) Ty(0)); +spanless_eq_enum!(GenericArg; Lifetime(0) Type(0) Const(0)); +spanless_eq_enum!(GenericArgs; AngleBracketed(0) Parenthesized(0)); +spanless_eq_enum!(GenericBound; Trait(0 1) Outlives(0)); +spanless_eq_enum!(GenericParamKind; Lifetime Type(default) Const(ty)); +spanless_eq_enum!(ImplItemKind; Const(0 1) Method(0 1) Type(0) Existential(0) Macro(0)); +spanless_eq_enum!(ImplPolarity; Positive Negative); +spanless_eq_enum!(IntTy; Isize I8 I16 I32 I64 I128); +spanless_eq_enum!(IsAsync; Async(closure_id return_impl_trait_id) NotAsync); +spanless_eq_enum!(IsAuto; Yes No); +spanless_eq_enum!(LitIntType; Signed(0) Unsigned(0) Unsuffixed); +spanless_eq_enum!(MacDelimiter; Parenthesis Bracket Brace); +spanless_eq_enum!(MacStmtStyle; Semicolon Braces NoBraces); +spanless_eq_enum!(Movability; Static Movable); +spanless_eq_enum!(Mutability; Mutable Immutable); +spanless_eq_enum!(RangeEnd; Included(0) Excluded); +spanless_eq_enum!(RangeLimits; HalfOpen Closed); +spanless_eq_enum!(StmtKind; Local(0) Item(0) Expr(0) Semi(0) Mac(0)); +spanless_eq_enum!(StrStyle; Cooked Raw(0)); +spanless_eq_enum!(TokenTree; Token(0) Delimited(0 1 2)); +spanless_eq_enum!(TraitBoundModifier; None Maybe); +spanless_eq_enum!(TraitItemKind; Const(0 1) Method(0 1) Type(0 1) Macro(0)); +spanless_eq_enum!(TraitObjectSyntax; Dyn None); +spanless_eq_enum!(UintTy; Usize U8 U16 U32 U64 U128); +spanless_eq_enum!(UnOp; Deref Not Neg); +spanless_eq_enum!(UnsafeSource; CompilerGenerated UserProvided); +spanless_eq_enum!(Unsafety; Unsafe Normal); +spanless_eq_enum!(UseTreeKind; Simple(0 1 2) Nested(0) Glob); +spanless_eq_enum!(VariantData; Struct(0 1) Tuple(0 1) Unit(0)); +spanless_eq_enum!(VisibilityKind; Public Crate(0) Restricted(path id) Inherited); +spanless_eq_enum!(WherePredicate; BoundPredicate(0) RegionPredicate(0) EqPredicate(0)); +spanless_eq_enum!(ExprKind; Box(0) Array(0) Call(0 1) MethodCall(0 1) Tup(0) + Binary(0 1 2) Unary(0 1) Lit(0) Cast(0 1) Type(0 1) Let(0 1) If(0 1 2) + While(0 1 2) ForLoop(0 1 2 3) Loop(0 1) Match(0 1) Closure(0 1 2 3 4 5) + Block(0 1) Async(0 1 2) Await(0 1) TryBlock(0) Assign(0 1) AssignOp(0 1 2) + Field(0 1) Index(0 1) Range(0 1 2) Path(0 1) AddrOf(0 1) Break(0 1) + Continue(0) Ret(0) InlineAsm(0) Mac(0) Struct(0 1 2) Repeat(0 1) Paren(0) + Try(0) Yield(0) Err); +spanless_eq_enum!(ItemKind; ExternCrate(0) Use(0) Static(0 1 2) Const(0 1) + Fn(0 1 2 3) Mod(0) ForeignMod(0) GlobalAsm(0) Ty(0 1) Existential(0 1) + Enum(0 1) Struct(0 1) Union(0 1) Trait(0 1 2 3 4) TraitAlias(0 1) + Impl(0 1 2 3 4 5 6) Mac(0) MacroDef(0)); +spanless_eq_enum!(LitKind; Str(0 1) ByteStr(0) Byte(0) Char(0) Int(0 1) + Float(0 1) FloatUnsuffixed(0) Bool(0) Err(0)); +spanless_eq_enum!(PatKind; Wild Ident(0 1 2) Struct(0 1 2) TupleStruct(0 1 2) + Path(0 1) Tuple(0 1) Box(0) Ref(0 1) Lit(0) Range(0 1 2) Slice(0 1 2) + Paren(0) Mac(0)); +spanless_eq_enum!(TyKind; Slice(0) Array(0 1) Ptr(0) Rptr(0 1) BareFn(0) Never + Tup(0) Path(0 1) TraitObject(0 1) ImplTrait(0 1) Paren(0) Typeof(0) Infer + ImplicitSelf Mac(0) Err CVarArgs); + +impl SpanlessEq for Ident { + fn eq(&self, other: &Self) -> bool { + self.as_str() == other.as_str() + } +} + +// Give up on comparing literals inside of macros because there are so many +// equivalent representations of the same literal; they are tested elsewhere +impl SpanlessEq for token::Lit { + fn eq(&self, other: &Self) -> bool { + mem::discriminant(self) == mem::discriminant(other) + } +} + +impl SpanlessEq for RangeSyntax { + fn eq(&self, _other: &Self) -> bool { + match self { + RangeSyntax::DotDotDot | RangeSyntax::DotDotEq => true, + } + } +} + +impl SpanlessEq for TokenKind { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (TokenKind::Literal(this), TokenKind::Literal(other)) => SpanlessEq::eq(this, other), + (TokenKind::DotDotEq, _) | (TokenKind::DotDotDot, _) => match other { + TokenKind::DotDotEq | TokenKind::DotDotDot => true, + _ => false, + }, + _ => self == other, + } + } +} + +impl SpanlessEq for TokenStream { + fn eq(&self, other: &Self) -> bool { + SpanlessEq::eq(&expand_tts(self), &expand_tts(other)) + } +} + +fn expand_tts(tts: &TokenStream) -> Vec { + let mut tokens = Vec::new(); + for tt in tts.clone().into_trees() { + let c = match tt { + TokenTree::Token(Token { + kind: TokenKind::DocComment(c), + .. + }) => c, + _ => { + tokens.push(tt); + continue; + } + }; + let contents = comments::strip_doc_comment_decoration(&c.as_str()); + let style = comments::doc_comment_style(&c.as_str()); + tokens.push(TokenTree::token(TokenKind::Pound, DUMMY_SP)); + if style == AttrStyle::Inner { + tokens.push(TokenTree::token(TokenKind::Not, DUMMY_SP)); + } + let lit = token::Lit { + kind: token::LitKind::Str, + symbol: Symbol::intern(&contents), + suffix: None, + }; + let tts = vec![ + TokenTree::token(TokenKind::Ident(sym::doc, false), DUMMY_SP), + TokenTree::token(TokenKind::Eq, DUMMY_SP), + TokenTree::token(TokenKind::Literal(lit), DUMMY_SP), + ]; + tokens.push(TokenTree::Delimited( + DelimSpan::dummy(), + DelimToken::Bracket, + tts.into_iter().collect::().into(), + )); + } + tokens +} diff -Nru cargo-0.35.0/vendor/syn/tests/common/mod.rs cargo-0.37.0/vendor/syn/tests/common/mod.rs --- cargo-0.35.0/vendor/syn/tests/common/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/common/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,70 @@ +#![allow(dead_code)] + +extern crate syntax; +extern crate walkdir; + +use std; +use std::env; +use std::process::Command; + +use self::walkdir::DirEntry; + +pub mod eq; +pub mod parse; + +/// Read the `ABORT_AFTER_FAILURE` environment variable, and parse it. +pub fn abort_after() -> usize { + match env::var("ABORT_AFTER_FAILURE") { + Ok(s) => s.parse().expect("failed to parse ABORT_AFTER_FAILURE"), + Err(_) => std::usize::MAX, + } +} + +pub fn base_dir_filter(entry: &DirEntry) -> bool { + let path = entry.path(); + if path.is_dir() { + return true; // otherwise walkdir does not visit the files + } + if path.extension().map(|e| e != "rs").unwrap_or(true) { + return false; + } + let path_string = path.to_string_lossy(); + let path_string = if cfg!(windows) { + path_string.replace('\\', "/").into() + } else { + path_string + }; + // TODO assert that parsing fails on the parse-fail cases + if path_string.starts_with("tests/rust/src/test/parse-fail") + || path_string.starts_with("tests/rust/src/test/compile-fail") + || path_string.starts_with("tests/rust/src/test/rustfix") + { + return false; + } + + if path_string.starts_with("tests/rust/src/test/ui") { + let stderr_path = path.with_extension("stderr"); + if stderr_path.exists() { + // Expected to fail in some way + return false; + } + } + + match path_string.as_ref() { + // Deprecated placement syntax + "tests/rust/src/test/run-pass/new-box-syntax.rs" | + "tests/rust/src/test/ui/obsolete-in-place/bad.rs" | + // 2015-style dyn that libsyntax rejects + "tests/rust/src/test/ui/dyn-keyword/dyn-2015-no-warnings-without-lints.rs" | + // not actually test cases + "tests/rust/src/test/run-pass/macros/auxiliary/macro-comma-support.rs" | + "tests/rust/src/test/run-pass/macros/auxiliary/macro-include-items-expr.rs" | + "tests/rust/src/test/ui/issues/auxiliary/issue-21146-inc.rs" => false, + _ => true, + } +} + +pub fn clone_rust() { + let result = Command::new("tests/clone.sh").status().unwrap(); + assert!(result.success()); +} diff -Nru cargo-0.35.0/vendor/syn/tests/common/parse.rs cargo-0.37.0/vendor/syn/tests/common/parse.rs --- cargo-0.35.0/vendor/syn/tests/common/parse.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/common/parse.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,49 @@ +extern crate proc_macro2; +extern crate syn; +extern crate syntax; +extern crate syntax_pos; + +use self::syntax::ast; +use self::syntax::parse::{self, ParseSess}; +use self::syntax::ptr::P; +use self::syntax::source_map::FilePathMapping; +use self::syntax_pos::FileName; + +use std::panic; + +pub fn libsyntax_expr(input: &str) -> Option> { + match panic::catch_unwind(|| { + let sess = ParseSess::new(FilePathMapping::empty()); + sess.span_diagnostic.set_continue_after_error(false); + let e = parse::new_parser_from_source_str( + &sess, + FileName::Custom("test_precedence".to_string()), + input.to_string(), + ) + .parse_expr(); + match e { + Ok(expr) => Some(expr), + Err(mut diagnostic) => { + diagnostic.emit(); + None + } + } + }) { + Ok(Some(e)) => Some(e), + Ok(None) => None, + Err(_) => { + errorf!("libsyntax panicked\n"); + None + } + } +} + +pub fn syn_expr(input: &str) -> Option { + match syn::parse_str(input) { + Ok(e) => Some(e), + Err(msg) => { + errorf!("syn failed to parse\n{:?}\n", msg); + None + } + } +} diff -Nru cargo-0.35.0/vendor/syn/tests/debug/gen.rs cargo-0.37.0/vendor/syn/tests/debug/gen.rs --- cargo-0.35.0/vendor/syn/tests/debug/gen.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/debug/gen.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,5934 @@ +// This file is @generated by syn-internal-codegen. +// It is not intended for manual editing. + +use super::{Lite, RefCast}; +use std::fmt::{self, Debug}; +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("Abi"); + if let Some(val) = &_val.name { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::LitStr); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("name", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("AngleBracketedGenericArguments"); + if let Some(val) = &_val.colon2_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Colon2); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("colon2_token", Print::ref_cast(val)); + } + if !_val.args.is_empty() { + formatter.field("args", Lite(&_val.args)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ArgCaptured"); + formatter.field("pat", Lite(&_val.pat)); + formatter.field("ty", Lite(&_val.ty)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ArgSelf"); + if let Some(val) = &_val.mutability { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Mut); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("mutability", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ArgSelfRef"); + if let Some(val) = &_val.lifetime { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Lifetime); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("lifetime", Print::ref_cast(val)); + } + if let Some(val) = &_val.mutability { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Mut); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("mutability", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("Arm"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.leading_vert { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Or); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("leading_vert", Print::ref_cast(val)); + } + if !_val.pats.is_empty() { + formatter.field("pats", Lite(&_val.pats)); + } + if let Some(val) = &_val.guard { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((syn::token::If, Box)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(&_val.1), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("guard", Print::ref_cast(val)); + } + formatter.field("body", Lite(&_val.body)); + if let Some(val) = &_val.comma { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Comma); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("comma", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::AttrStyle::Outer => formatter.write_str("Outer"), + syn::AttrStyle::Inner(_val) => { + formatter.write_str("Inner")?; + Ok(()) + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("Attribute"); + formatter.field("style", Lite(&_val.style)); + formatter.field("path", Lite(&_val.path)); + formatter.field("tts", Lite(&_val.tts)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("BareFnArg"); + if let Some(val) = &_val.name { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((syn::BareFnArgName, syn::token::Colon)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(&_val.0), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("name", Print::ref_cast(val)); + } + formatter.field("ty", Lite(&_val.ty)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::BareFnArgName::Named(_val) => { + formatter.write_str("Named")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::BareFnArgName::Wild(_val) => { + formatter.write_str("Wild")?; + Ok(()) + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::BinOp::Add(_val) => { + formatter.write_str("Add")?; + Ok(()) + } + syn::BinOp::Sub(_val) => { + formatter.write_str("Sub")?; + Ok(()) + } + syn::BinOp::Mul(_val) => { + formatter.write_str("Mul")?; + Ok(()) + } + syn::BinOp::Div(_val) => { + formatter.write_str("Div")?; + Ok(()) + } + syn::BinOp::Rem(_val) => { + formatter.write_str("Rem")?; + Ok(()) + } + syn::BinOp::And(_val) => { + formatter.write_str("And")?; + Ok(()) + } + syn::BinOp::Or(_val) => { + formatter.write_str("Or")?; + Ok(()) + } + syn::BinOp::BitXor(_val) => { + formatter.write_str("BitXor")?; + Ok(()) + } + syn::BinOp::BitAnd(_val) => { + formatter.write_str("BitAnd")?; + Ok(()) + } + syn::BinOp::BitOr(_val) => { + formatter.write_str("BitOr")?; + Ok(()) + } + syn::BinOp::Shl(_val) => { + formatter.write_str("Shl")?; + Ok(()) + } + syn::BinOp::Shr(_val) => { + formatter.write_str("Shr")?; + Ok(()) + } + syn::BinOp::Eq(_val) => { + formatter.write_str("Eq")?; + Ok(()) + } + syn::BinOp::Lt(_val) => { + formatter.write_str("Lt")?; + Ok(()) + } + syn::BinOp::Le(_val) => { + formatter.write_str("Le")?; + Ok(()) + } + syn::BinOp::Ne(_val) => { + formatter.write_str("Ne")?; + Ok(()) + } + syn::BinOp::Ge(_val) => { + formatter.write_str("Ge")?; + Ok(()) + } + syn::BinOp::Gt(_val) => { + formatter.write_str("Gt")?; + Ok(()) + } + syn::BinOp::AddEq(_val) => { + formatter.write_str("AddEq")?; + Ok(()) + } + syn::BinOp::SubEq(_val) => { + formatter.write_str("SubEq")?; + Ok(()) + } + syn::BinOp::MulEq(_val) => { + formatter.write_str("MulEq")?; + Ok(()) + } + syn::BinOp::DivEq(_val) => { + formatter.write_str("DivEq")?; + Ok(()) + } + syn::BinOp::RemEq(_val) => { + formatter.write_str("RemEq")?; + Ok(()) + } + syn::BinOp::BitXorEq(_val) => { + formatter.write_str("BitXorEq")?; + Ok(()) + } + syn::BinOp::BitAndEq(_val) => { + formatter.write_str("BitAndEq")?; + Ok(()) + } + syn::BinOp::BitOrEq(_val) => { + formatter.write_str("BitOrEq")?; + Ok(()) + } + syn::BinOp::ShlEq(_val) => { + formatter.write_str("ShlEq")?; + Ok(()) + } + syn::BinOp::ShrEq(_val) => { + formatter.write_str("ShrEq")?; + Ok(()) + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("Binding"); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("ty", Lite(&_val.ty)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("Block"); + if !_val.stmts.is_empty() { + formatter.field("stmts", Lite(&_val.stmts)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("BoundLifetimes"); + if !_val.lifetimes.is_empty() { + formatter.field("lifetimes", Lite(&_val.lifetimes)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ConstParam"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("ty", Lite(&_val.ty)); + if let Some(val) = &_val.eq_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Eq); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("eq_token", Print::ref_cast(val)); + } + if let Some(val) = &_val.default { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Expr); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("default", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("Constraint"); + formatter.field("ident", Lite(&_val.ident)); + if !_val.bounds.is_empty() { + formatter.field("bounds", Lite(&_val.bounds)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::Data::Struct(_val) => { + let mut formatter = formatter.debug_struct("Data::Struct"); + formatter.field("fields", Lite(&_val.fields)); + if let Some(val) = &_val.semi_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Semi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("semi_token", Print::ref_cast(val)); + } + formatter.finish() + } + syn::Data::Enum(_val) => { + let mut formatter = formatter.debug_struct("Data::Enum"); + if !_val.variants.is_empty() { + formatter.field("variants", Lite(&_val.variants)); + } + formatter.finish() + } + syn::Data::Union(_val) => { + let mut formatter = formatter.debug_struct("Data::Union"); + formatter.field("fields", Lite(&_val.fields)); + formatter.finish() + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("DataEnum"); + if !_val.variants.is_empty() { + formatter.field("variants", Lite(&_val.variants)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("DataStruct"); + formatter.field("fields", Lite(&_val.fields)); + if let Some(val) = &_val.semi_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Semi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("semi_token", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("DataUnion"); + formatter.field("fields", Lite(&_val.fields)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("DeriveInput"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + formatter.field("data", Lite(&_val.data)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::Expr::Box(_val) => { + let mut formatter = formatter.debug_struct("Expr::Box"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } + syn::Expr::InPlace(_val) => { + let mut formatter = formatter.debug_struct("Expr::InPlace"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("place", Lite(&_val.place)); + formatter.field("value", Lite(&_val.value)); + formatter.finish() + } + syn::Expr::Array(_val) => { + let mut formatter = formatter.debug_struct("Expr::Array"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if !_val.elems.is_empty() { + formatter.field("elems", Lite(&_val.elems)); + } + formatter.finish() + } + syn::Expr::Call(_val) => { + let mut formatter = formatter.debug_struct("Expr::Call"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("func", Lite(&_val.func)); + if !_val.args.is_empty() { + formatter.field("args", Lite(&_val.args)); + } + formatter.finish() + } + syn::Expr::MethodCall(_val) => { + let mut formatter = formatter.debug_struct("Expr::MethodCall"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("receiver", Lite(&_val.receiver)); + formatter.field("method", Lite(&_val.method)); + if let Some(val) = &_val.turbofish { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::MethodTurbofish); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("turbofish", Print::ref_cast(val)); + } + if !_val.args.is_empty() { + formatter.field("args", Lite(&_val.args)); + } + formatter.finish() + } + syn::Expr::Tuple(_val) => { + let mut formatter = formatter.debug_struct("Expr::Tuple"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if !_val.elems.is_empty() { + formatter.field("elems", Lite(&_val.elems)); + } + formatter.finish() + } + syn::Expr::Binary(_val) => { + let mut formatter = formatter.debug_struct("Expr::Binary"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("left", Lite(&_val.left)); + formatter.field("op", Lite(&_val.op)); + formatter.field("right", Lite(&_val.right)); + formatter.finish() + } + syn::Expr::Unary(_val) => { + let mut formatter = formatter.debug_struct("Expr::Unary"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("op", Lite(&_val.op)); + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } + syn::Expr::Lit(_val) => { + let mut formatter = formatter.debug_struct("Expr::Lit"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("lit", Lite(&_val.lit)); + formatter.finish() + } + syn::Expr::Cast(_val) => { + let mut formatter = formatter.debug_struct("Expr::Cast"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.field("ty", Lite(&_val.ty)); + formatter.finish() + } + syn::Expr::Type(_val) => { + let mut formatter = formatter.debug_struct("Expr::Type"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.field("ty", Lite(&_val.ty)); + formatter.finish() + } + syn::Expr::Let(_val) => { + let mut formatter = formatter.debug_struct("Expr::Let"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if !_val.pats.is_empty() { + formatter.field("pats", Lite(&_val.pats)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } + syn::Expr::If(_val) => { + let mut formatter = formatter.debug_struct("Expr::If"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("cond", Lite(&_val.cond)); + formatter.field("then_branch", Lite(&_val.then_branch)); + if let Some(val) = &_val.else_branch { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((syn::token::Else, Box)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(&_val.1), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("else_branch", Print::ref_cast(val)); + } + formatter.finish() + } + syn::Expr::While(_val) => { + let mut formatter = formatter.debug_struct("Expr::While"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.label { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Label); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("label", Print::ref_cast(val)); + } + formatter.field("cond", Lite(&_val.cond)); + formatter.field("body", Lite(&_val.body)); + formatter.finish() + } + syn::Expr::ForLoop(_val) => { + let mut formatter = formatter.debug_struct("Expr::ForLoop"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.label { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Label); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("label", Print::ref_cast(val)); + } + formatter.field("pat", Lite(&_val.pat)); + formatter.field("expr", Lite(&_val.expr)); + formatter.field("body", Lite(&_val.body)); + formatter.finish() + } + syn::Expr::Loop(_val) => { + let mut formatter = formatter.debug_struct("Expr::Loop"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.label { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Label); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("label", Print::ref_cast(val)); + } + formatter.field("body", Lite(&_val.body)); + formatter.finish() + } + syn::Expr::Match(_val) => { + let mut formatter = formatter.debug_struct("Expr::Match"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("expr", Lite(&_val.expr)); + if !_val.arms.is_empty() { + formatter.field("arms", Lite(&_val.arms)); + } + formatter.finish() + } + syn::Expr::Closure(_val) => { + let mut formatter = formatter.debug_struct("Expr::Closure"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.asyncness { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Async); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("asyncness", Print::ref_cast(val)); + } + if let Some(val) = &_val.movability { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Static); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("movability", Print::ref_cast(val)); + } + if let Some(val) = &_val.capture { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Move); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("capture", Print::ref_cast(val)); + } + if !_val.inputs.is_empty() { + formatter.field("inputs", Lite(&_val.inputs)); + } + formatter.field("output", Lite(&_val.output)); + formatter.field("body", Lite(&_val.body)); + formatter.finish() + } + syn::Expr::Unsafe(_val) => { + let mut formatter = formatter.debug_struct("Expr::Unsafe"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("block", Lite(&_val.block)); + formatter.finish() + } + syn::Expr::Block(_val) => { + let mut formatter = formatter.debug_struct("Expr::Block"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.label { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Label); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("label", Print::ref_cast(val)); + } + formatter.field("block", Lite(&_val.block)); + formatter.finish() + } + syn::Expr::Assign(_val) => { + let mut formatter = formatter.debug_struct("Expr::Assign"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("left", Lite(&_val.left)); + formatter.field("right", Lite(&_val.right)); + formatter.finish() + } + syn::Expr::AssignOp(_val) => { + let mut formatter = formatter.debug_struct("Expr::AssignOp"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("left", Lite(&_val.left)); + formatter.field("op", Lite(&_val.op)); + formatter.field("right", Lite(&_val.right)); + formatter.finish() + } + syn::Expr::Field(_val) => { + let mut formatter = formatter.debug_struct("Expr::Field"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("base", Lite(&_val.base)); + formatter.field("member", Lite(&_val.member)); + formatter.finish() + } + syn::Expr::Index(_val) => { + let mut formatter = formatter.debug_struct("Expr::Index"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.field("index", Lite(&_val.index)); + formatter.finish() + } + syn::Expr::Range(_val) => { + let mut formatter = formatter.debug_struct("Expr::Range"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.from { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(Box); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("from", Print::ref_cast(val)); + } + formatter.field("limits", Lite(&_val.limits)); + if let Some(val) = &_val.to { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(Box); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("to", Print::ref_cast(val)); + } + formatter.finish() + } + syn::Expr::Path(_val) => { + let mut formatter = formatter.debug_struct("Expr::Path"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.qself { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::QSelf); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("qself", Print::ref_cast(val)); + } + formatter.field("path", Lite(&_val.path)); + formatter.finish() + } + syn::Expr::Reference(_val) => { + let mut formatter = formatter.debug_struct("Expr::Reference"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.mutability { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Mut); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("mutability", Print::ref_cast(val)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } + syn::Expr::Break(_val) => { + let mut formatter = formatter.debug_struct("Expr::Break"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.label { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Lifetime); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("label", Print::ref_cast(val)); + } + if let Some(val) = &_val.expr { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(Box); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("expr", Print::ref_cast(val)); + } + formatter.finish() + } + syn::Expr::Continue(_val) => { + let mut formatter = formatter.debug_struct("Expr::Continue"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.label { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Lifetime); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("label", Print::ref_cast(val)); + } + formatter.finish() + } + syn::Expr::Return(_val) => { + let mut formatter = formatter.debug_struct("Expr::Return"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.expr { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(Box); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("expr", Print::ref_cast(val)); + } + formatter.finish() + } + syn::Expr::Macro(_val) => { + let mut formatter = formatter.debug_struct("Expr::Macro"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("mac", Lite(&_val.mac)); + formatter.finish() + } + syn::Expr::Struct(_val) => { + let mut formatter = formatter.debug_struct("Expr::Struct"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("path", Lite(&_val.path)); + if !_val.fields.is_empty() { + formatter.field("fields", Lite(&_val.fields)); + } + if let Some(val) = &_val.dot2_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Dot2); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("dot2_token", Print::ref_cast(val)); + } + if let Some(val) = &_val.rest { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(Box); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("rest", Print::ref_cast(val)); + } + formatter.finish() + } + syn::Expr::Repeat(_val) => { + let mut formatter = formatter.debug_struct("Expr::Repeat"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.field("len", Lite(&_val.len)); + formatter.finish() + } + syn::Expr::Paren(_val) => { + let mut formatter = formatter.debug_struct("Expr::Paren"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } + syn::Expr::Group(_val) => { + let mut formatter = formatter.debug_struct("Expr::Group"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } + syn::Expr::Try(_val) => { + let mut formatter = formatter.debug_struct("Expr::Try"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } + syn::Expr::Async(_val) => { + let mut formatter = formatter.debug_struct("Expr::Async"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.capture { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Move); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("capture", Print::ref_cast(val)); + } + formatter.field("block", Lite(&_val.block)); + formatter.finish() + } + syn::Expr::TryBlock(_val) => { + let mut formatter = formatter.debug_struct("Expr::TryBlock"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("block", Lite(&_val.block)); + formatter.finish() + } + syn::Expr::Yield(_val) => { + let mut formatter = formatter.debug_struct("Expr::Yield"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.expr { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(Box); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("expr", Print::ref_cast(val)); + } + formatter.finish() + } + syn::Expr::Verbatim(_val) => { + let mut formatter = formatter.debug_struct("Expr::Verbatim"); + formatter.field("tts", Lite(&_val.tts)); + formatter.finish() + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprArray"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if !_val.elems.is_empty() { + formatter.field("elems", Lite(&_val.elems)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprAssign"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("left", Lite(&_val.left)); + formatter.field("right", Lite(&_val.right)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprAssignOp"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("left", Lite(&_val.left)); + formatter.field("op", Lite(&_val.op)); + formatter.field("right", Lite(&_val.right)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprAsync"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.capture { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Move); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("capture", Print::ref_cast(val)); + } + formatter.field("block", Lite(&_val.block)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprBinary"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("left", Lite(&_val.left)); + formatter.field("op", Lite(&_val.op)); + formatter.field("right", Lite(&_val.right)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprBlock"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.label { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Label); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("label", Print::ref_cast(val)); + } + formatter.field("block", Lite(&_val.block)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprBox"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprBreak"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.label { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Lifetime); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("label", Print::ref_cast(val)); + } + if let Some(val) = &_val.expr { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(Box); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("expr", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprCall"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("func", Lite(&_val.func)); + if !_val.args.is_empty() { + formatter.field("args", Lite(&_val.args)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprCast"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.field("ty", Lite(&_val.ty)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprClosure"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.asyncness { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Async); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("asyncness", Print::ref_cast(val)); + } + if let Some(val) = &_val.movability { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Static); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("movability", Print::ref_cast(val)); + } + if let Some(val) = &_val.capture { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Move); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("capture", Print::ref_cast(val)); + } + if !_val.inputs.is_empty() { + formatter.field("inputs", Lite(&_val.inputs)); + } + formatter.field("output", Lite(&_val.output)); + formatter.field("body", Lite(&_val.body)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprContinue"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.label { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Lifetime); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("label", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprField"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("base", Lite(&_val.base)); + formatter.field("member", Lite(&_val.member)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprForLoop"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.label { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Label); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("label", Print::ref_cast(val)); + } + formatter.field("pat", Lite(&_val.pat)); + formatter.field("expr", Lite(&_val.expr)); + formatter.field("body", Lite(&_val.body)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprGroup"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprIf"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("cond", Lite(&_val.cond)); + formatter.field("then_branch", Lite(&_val.then_branch)); + if let Some(val) = &_val.else_branch { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((syn::token::Else, Box)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(&_val.1), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("else_branch", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprInPlace"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("place", Lite(&_val.place)); + formatter.field("value", Lite(&_val.value)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprIndex"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.field("index", Lite(&_val.index)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprLet"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if !_val.pats.is_empty() { + formatter.field("pats", Lite(&_val.pats)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprLit"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("lit", Lite(&_val.lit)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprLoop"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.label { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Label); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("label", Print::ref_cast(val)); + } + formatter.field("body", Lite(&_val.body)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprMacro"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("mac", Lite(&_val.mac)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprMatch"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("expr", Lite(&_val.expr)); + if !_val.arms.is_empty() { + formatter.field("arms", Lite(&_val.arms)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprMethodCall"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("receiver", Lite(&_val.receiver)); + formatter.field("method", Lite(&_val.method)); + if let Some(val) = &_val.turbofish { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::MethodTurbofish); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("turbofish", Print::ref_cast(val)); + } + if !_val.args.is_empty() { + formatter.field("args", Lite(&_val.args)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprParen"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprPath"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.qself { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::QSelf); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("qself", Print::ref_cast(val)); + } + formatter.field("path", Lite(&_val.path)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprRange"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.from { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(Box); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("from", Print::ref_cast(val)); + } + formatter.field("limits", Lite(&_val.limits)); + if let Some(val) = &_val.to { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(Box); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("to", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprReference"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.mutability { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Mut); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("mutability", Print::ref_cast(val)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprRepeat"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.field("len", Lite(&_val.len)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprReturn"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.expr { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(Box); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("expr", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprStruct"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("path", Lite(&_val.path)); + if !_val.fields.is_empty() { + formatter.field("fields", Lite(&_val.fields)); + } + if let Some(val) = &_val.dot2_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Dot2); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("dot2_token", Print::ref_cast(val)); + } + if let Some(val) = &_val.rest { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(Box); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("rest", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprTry"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprTryBlock"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("block", Lite(&_val.block)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprTuple"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if !_val.elems.is_empty() { + formatter.field("elems", Lite(&_val.elems)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprType"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.field("ty", Lite(&_val.ty)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprUnary"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("op", Lite(&_val.op)); + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprUnsafe"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("block", Lite(&_val.block)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprVerbatim"); + formatter.field("tts", Lite(&_val.tts)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprWhile"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.label { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Label); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("label", Print::ref_cast(val)); + } + formatter.field("cond", Lite(&_val.cond)); + formatter.field("body", Lite(&_val.body)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ExprYield"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.expr { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(Box); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("expr", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("Field"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + if let Some(val) = &_val.ident { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(proc_macro2::Ident); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("ident", Print::ref_cast(val)); + } + if let Some(val) = &_val.colon_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Colon); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("colon_token", Print::ref_cast(val)); + } + formatter.field("ty", Lite(&_val.ty)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("FieldPat"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("member", Lite(&_val.member)); + if let Some(val) = &_val.colon_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Colon); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("colon_token", Print::ref_cast(val)); + } + formatter.field("pat", Lite(&_val.pat)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("FieldValue"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("member", Lite(&_val.member)); + if let Some(val) = &_val.colon_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Colon); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("colon_token", Print::ref_cast(val)); + } + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::Fields::Named(_val) => { + let mut formatter = formatter.debug_struct("Fields::Named"); + if !_val.named.is_empty() { + formatter.field("named", Lite(&_val.named)); + } + formatter.finish() + } + syn::Fields::Unnamed(_val) => { + let mut formatter = formatter.debug_struct("Fields::Unnamed"); + if !_val.unnamed.is_empty() { + formatter.field("unnamed", Lite(&_val.unnamed)); + } + formatter.finish() + } + syn::Fields::Unit => formatter.write_str("Unit"), + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("FieldsNamed"); + if !_val.named.is_empty() { + formatter.field("named", Lite(&_val.named)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("FieldsUnnamed"); + if !_val.unnamed.is_empty() { + formatter.field("unnamed", Lite(&_val.unnamed)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("File"); + if let Some(val) = &_val.shebang { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(String); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("shebang", Print::ref_cast(val)); + } + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if !_val.items.is_empty() { + formatter.field("items", Lite(&_val.items)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::FnArg::SelfRef(_val) => { + formatter.write_str("SelfRef")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::FnArg::SelfValue(_val) => { + formatter.write_str("SelfValue")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::FnArg::Captured(_val) => { + formatter.write_str("Captured")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::FnArg::Inferred(_val) => { + formatter.write_str("Inferred")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::FnArg::Ignored(_val) => { + formatter.write_str("Ignored")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("FnDecl"); + formatter.field("generics", Lite(&_val.generics)); + if !_val.inputs.is_empty() { + formatter.field("inputs", Lite(&_val.inputs)); + } + if let Some(val) = &_val.variadic { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Dot3); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("variadic", Print::ref_cast(val)); + } + formatter.field("output", Lite(&_val.output)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::ForeignItem::Fn(_val) => { + let mut formatter = formatter.debug_struct("ForeignItem::Fn"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("decl", Lite(&_val.decl)); + formatter.finish() + } + syn::ForeignItem::Static(_val) => { + let mut formatter = formatter.debug_struct("ForeignItem::Static"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + if let Some(val) = &_val.mutability { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Mut); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("mutability", Print::ref_cast(val)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("ty", Lite(&_val.ty)); + formatter.finish() + } + syn::ForeignItem::Type(_val) => { + let mut formatter = formatter.debug_struct("ForeignItem::Type"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.finish() + } + syn::ForeignItem::Macro(_val) => { + let mut formatter = formatter.debug_struct("ForeignItem::Macro"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("mac", Lite(&_val.mac)); + if let Some(val) = &_val.semi_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Semi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("semi_token", Print::ref_cast(val)); + } + formatter.finish() + } + syn::ForeignItem::Verbatim(_val) => { + let mut formatter = formatter.debug_struct("ForeignItem::Verbatim"); + formatter.field("tts", Lite(&_val.tts)); + formatter.finish() + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ForeignItemFn"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("decl", Lite(&_val.decl)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ForeignItemMacro"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("mac", Lite(&_val.mac)); + if let Some(val) = &_val.semi_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Semi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("semi_token", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ForeignItemStatic"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + if let Some(val) = &_val.mutability { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Mut); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("mutability", Print::ref_cast(val)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("ty", Lite(&_val.ty)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ForeignItemType"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ForeignItemVerbatim"); + formatter.field("tts", Lite(&_val.tts)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::GenericArgument::Lifetime(_val) => { + formatter.write_str("Lifetime")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::GenericArgument::Type(_val) => { + formatter.write_str("Type")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::GenericArgument::Binding(_val) => { + formatter.write_str("Binding")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::GenericArgument::Constraint(_val) => { + formatter.write_str("Constraint")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::GenericArgument::Const(_val) => { + formatter.write_str("Const")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::GenericMethodArgument::Type(_val) => { + formatter.write_str("Type")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::GenericMethodArgument::Const(_val) => { + formatter.write_str("Const")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::GenericParam::Type(_val) => { + formatter.write_str("Type")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::GenericParam::Lifetime(_val) => { + formatter.write_str("Lifetime")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::GenericParam::Const(_val) => { + formatter.write_str("Const")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("Generics"); + if let Some(val) = &_val.lt_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Lt); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("lt_token", Print::ref_cast(val)); + } + if !_val.params.is_empty() { + formatter.field("params", Lite(&_val.params)); + } + if let Some(val) = &_val.gt_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Gt); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("gt_token", Print::ref_cast(val)); + } + if let Some(val) = &_val.where_clause { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::WhereClause); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("where_clause", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::ImplItem::Const(_val) => { + let mut formatter = formatter.debug_struct("ImplItem::Const"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + if let Some(val) = &_val.defaultness { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Default); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("defaultness", Print::ref_cast(val)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("ty", Lite(&_val.ty)); + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } + syn::ImplItem::Method(_val) => { + let mut formatter = formatter.debug_struct("ImplItem::Method"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + if let Some(val) = &_val.defaultness { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Default); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("defaultness", Print::ref_cast(val)); + } + formatter.field("sig", Lite(&_val.sig)); + formatter.field("block", Lite(&_val.block)); + formatter.finish() + } + syn::ImplItem::Type(_val) => { + let mut formatter = formatter.debug_struct("ImplItem::Type"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + if let Some(val) = &_val.defaultness { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Default); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("defaultness", Print::ref_cast(val)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + formatter.field("ty", Lite(&_val.ty)); + formatter.finish() + } + syn::ImplItem::Existential(_val) => { + let mut formatter = formatter.debug_struct("ImplItem::Existential"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + if let Some(val) = &_val.colon_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Colon); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("colon_token", Print::ref_cast(val)); + } + if !_val.bounds.is_empty() { + formatter.field("bounds", Lite(&_val.bounds)); + } + formatter.finish() + } + syn::ImplItem::Macro(_val) => { + let mut formatter = formatter.debug_struct("ImplItem::Macro"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("mac", Lite(&_val.mac)); + if let Some(val) = &_val.semi_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Semi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("semi_token", Print::ref_cast(val)); + } + formatter.finish() + } + syn::ImplItem::Verbatim(_val) => { + let mut formatter = formatter.debug_struct("ImplItem::Verbatim"); + formatter.field("tts", Lite(&_val.tts)); + formatter.finish() + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ImplItemConst"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + if let Some(val) = &_val.defaultness { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Default); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("defaultness", Print::ref_cast(val)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("ty", Lite(&_val.ty)); + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ImplItemExistential"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + if let Some(val) = &_val.colon_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Colon); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("colon_token", Print::ref_cast(val)); + } + if !_val.bounds.is_empty() { + formatter.field("bounds", Lite(&_val.bounds)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ImplItemMacro"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("mac", Lite(&_val.mac)); + if let Some(val) = &_val.semi_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Semi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("semi_token", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ImplItemMethod"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + if let Some(val) = &_val.defaultness { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Default); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("defaultness", Print::ref_cast(val)); + } + formatter.field("sig", Lite(&_val.sig)); + formatter.field("block", Lite(&_val.block)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ImplItemType"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + if let Some(val) = &_val.defaultness { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Default); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("defaultness", Print::ref_cast(val)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + formatter.field("ty", Lite(&_val.ty)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ImplItemVerbatim"); + formatter.field("tts", Lite(&_val.tts)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("Index"); + formatter.field("index", Lite(&_val.index)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::Item::ExternCrate(_val) => { + let mut formatter = formatter.debug_struct("Item::ExternCrate"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + if let Some(val) = &_val.rename { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((syn::token::As, proc_macro2::Ident)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(&_val.1), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("rename", Print::ref_cast(val)); + } + formatter.finish() + } + syn::Item::Use(_val) => { + let mut formatter = formatter.debug_struct("Item::Use"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + if let Some(val) = &_val.leading_colon { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Colon2); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("leading_colon", Print::ref_cast(val)); + } + formatter.field("tree", Lite(&_val.tree)); + formatter.finish() + } + syn::Item::Static(_val) => { + let mut formatter = formatter.debug_struct("Item::Static"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + if let Some(val) = &_val.mutability { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Mut); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("mutability", Print::ref_cast(val)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("ty", Lite(&_val.ty)); + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } + syn::Item::Const(_val) => { + let mut formatter = formatter.debug_struct("Item::Const"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("ty", Lite(&_val.ty)); + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } + syn::Item::Fn(_val) => { + let mut formatter = formatter.debug_struct("Item::Fn"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + if let Some(val) = &_val.constness { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Const); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("constness", Print::ref_cast(val)); + } + if let Some(val) = &_val.asyncness { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Async); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("asyncness", Print::ref_cast(val)); + } + if let Some(val) = &_val.unsafety { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Unsafe); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("unsafety", Print::ref_cast(val)); + } + if let Some(val) = &_val.abi { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Abi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("abi", Print::ref_cast(val)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("decl", Lite(&_val.decl)); + formatter.field("block", Lite(&_val.block)); + formatter.finish() + } + syn::Item::Mod(_val) => { + let mut formatter = formatter.debug_struct("Item::Mod"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + if let Some(val) = &_val.content { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((syn::token::Brace, Vec)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(&_val.1), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("content", Print::ref_cast(val)); + } + if let Some(val) = &_val.semi { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Semi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("semi", Print::ref_cast(val)); + } + formatter.finish() + } + syn::Item::ForeignMod(_val) => { + let mut formatter = formatter.debug_struct("Item::ForeignMod"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("abi", Lite(&_val.abi)); + if !_val.items.is_empty() { + formatter.field("items", Lite(&_val.items)); + } + formatter.finish() + } + syn::Item::Type(_val) => { + let mut formatter = formatter.debug_struct("Item::Type"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + formatter.field("ty", Lite(&_val.ty)); + formatter.finish() + } + syn::Item::Existential(_val) => { + let mut formatter = formatter.debug_struct("Item::Existential"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + if let Some(val) = &_val.colon_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Colon); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("colon_token", Print::ref_cast(val)); + } + if !_val.bounds.is_empty() { + formatter.field("bounds", Lite(&_val.bounds)); + } + formatter.finish() + } + syn::Item::Struct(_val) => { + let mut formatter = formatter.debug_struct("Item::Struct"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + formatter.field("fields", Lite(&_val.fields)); + if let Some(val) = &_val.semi_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Semi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("semi_token", Print::ref_cast(val)); + } + formatter.finish() + } + syn::Item::Enum(_val) => { + let mut formatter = formatter.debug_struct("Item::Enum"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + if !_val.variants.is_empty() { + formatter.field("variants", Lite(&_val.variants)); + } + formatter.finish() + } + syn::Item::Union(_val) => { + let mut formatter = formatter.debug_struct("Item::Union"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + formatter.field("fields", Lite(&_val.fields)); + formatter.finish() + } + syn::Item::Trait(_val) => { + let mut formatter = formatter.debug_struct("Item::Trait"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + if let Some(val) = &_val.unsafety { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Unsafe); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("unsafety", Print::ref_cast(val)); + } + if let Some(val) = &_val.auto_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Auto); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("auto_token", Print::ref_cast(val)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + if let Some(val) = &_val.colon_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Colon); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("colon_token", Print::ref_cast(val)); + } + if !_val.supertraits.is_empty() { + formatter.field("supertraits", Lite(&_val.supertraits)); + } + if !_val.items.is_empty() { + formatter.field("items", Lite(&_val.items)); + } + formatter.finish() + } + syn::Item::TraitAlias(_val) => { + let mut formatter = formatter.debug_struct("Item::TraitAlias"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + if !_val.bounds.is_empty() { + formatter.field("bounds", Lite(&_val.bounds)); + } + formatter.finish() + } + syn::Item::Impl(_val) => { + let mut formatter = formatter.debug_struct("Item::Impl"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.defaultness { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Default); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("defaultness", Print::ref_cast(val)); + } + if let Some(val) = &_val.unsafety { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Unsafe); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("unsafety", Print::ref_cast(val)); + } + formatter.field("generics", Lite(&_val.generics)); + if let Some(val) = &_val.trait_ { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((Option, syn::Path, syn::token::For)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt( + &( + { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(Option); + impl Debug for Print { + fn fmt( + &self, + formatter: &mut fmt::Formatter, + ) -> fmt::Result + { + match &self.0 { + Some(_val) => { + formatter.write_str("Some")?; + Ok(()) + } + None => formatter.write_str("None"), + } + } + } + Print::ref_cast(&_val.0) + }, + Lite(&_val.1), + ), + formatter, + )?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("trait_", Print::ref_cast(val)); + } + formatter.field("self_ty", Lite(&_val.self_ty)); + if !_val.items.is_empty() { + formatter.field("items", Lite(&_val.items)); + } + formatter.finish() + } + syn::Item::Macro(_val) => { + let mut formatter = formatter.debug_struct("Item::Macro"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.ident { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(proc_macro2::Ident); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("ident", Print::ref_cast(val)); + } + formatter.field("mac", Lite(&_val.mac)); + if let Some(val) = &_val.semi_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Semi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("semi_token", Print::ref_cast(val)); + } + formatter.finish() + } + syn::Item::Macro2(_val) => { + let mut formatter = formatter.debug_struct("Item::Macro2"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("args", Lite(&_val.args)); + formatter.field("body", Lite(&_val.body)); + formatter.finish() + } + syn::Item::Verbatim(_val) => { + let mut formatter = formatter.debug_struct("Item::Verbatim"); + formatter.field("tts", Lite(&_val.tts)); + formatter.finish() + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ItemConst"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("ty", Lite(&_val.ty)); + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ItemEnum"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + if !_val.variants.is_empty() { + formatter.field("variants", Lite(&_val.variants)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ItemExistential"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + if let Some(val) = &_val.colon_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Colon); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("colon_token", Print::ref_cast(val)); + } + if !_val.bounds.is_empty() { + formatter.field("bounds", Lite(&_val.bounds)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ItemExternCrate"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + if let Some(val) = &_val.rename { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((syn::token::As, proc_macro2::Ident)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(&_val.1), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("rename", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ItemFn"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + if let Some(val) = &_val.constness { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Const); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("constness", Print::ref_cast(val)); + } + if let Some(val) = &_val.asyncness { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Async); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("asyncness", Print::ref_cast(val)); + } + if let Some(val) = &_val.unsafety { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Unsafe); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("unsafety", Print::ref_cast(val)); + } + if let Some(val) = &_val.abi { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Abi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("abi", Print::ref_cast(val)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("decl", Lite(&_val.decl)); + formatter.field("block", Lite(&_val.block)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ItemForeignMod"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("abi", Lite(&_val.abi)); + if !_val.items.is_empty() { + formatter.field("items", Lite(&_val.items)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ItemImpl"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.defaultness { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Default); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("defaultness", Print::ref_cast(val)); + } + if let Some(val) = &_val.unsafety { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Unsafe); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("unsafety", Print::ref_cast(val)); + } + formatter.field("generics", Lite(&_val.generics)); + if let Some(val) = &_val.trait_ { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((Option, syn::Path, syn::token::For)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt( + &( + { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(Option); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match &self.0 { + Some(_val) => { + formatter.write_str("Some")?; + Ok(()) + } + None => formatter.write_str("None"), + } + } + } + Print::ref_cast(&_val.0) + }, + Lite(&_val.1), + ), + formatter, + )?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("trait_", Print::ref_cast(val)); + } + formatter.field("self_ty", Lite(&_val.self_ty)); + if !_val.items.is_empty() { + formatter.field("items", Lite(&_val.items)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ItemMacro"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if let Some(val) = &_val.ident { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(proc_macro2::Ident); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("ident", Print::ref_cast(val)); + } + formatter.field("mac", Lite(&_val.mac)); + if let Some(val) = &_val.semi_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Semi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("semi_token", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ItemMacro2"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("args", Lite(&_val.args)); + formatter.field("body", Lite(&_val.body)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ItemMod"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + if let Some(val) = &_val.content { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((syn::token::Brace, Vec)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(&_val.1), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("content", Print::ref_cast(val)); + } + if let Some(val) = &_val.semi { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Semi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("semi", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ItemStatic"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + if let Some(val) = &_val.mutability { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Mut); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("mutability", Print::ref_cast(val)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("ty", Lite(&_val.ty)); + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ItemStruct"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + formatter.field("fields", Lite(&_val.fields)); + if let Some(val) = &_val.semi_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Semi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("semi_token", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ItemTrait"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + if let Some(val) = &_val.unsafety { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Unsafe); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("unsafety", Print::ref_cast(val)); + } + if let Some(val) = &_val.auto_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Auto); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("auto_token", Print::ref_cast(val)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + if let Some(val) = &_val.colon_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Colon); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("colon_token", Print::ref_cast(val)); + } + if !_val.supertraits.is_empty() { + formatter.field("supertraits", Lite(&_val.supertraits)); + } + if !_val.items.is_empty() { + formatter.field("items", Lite(&_val.items)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ItemTraitAlias"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + if !_val.bounds.is_empty() { + formatter.field("bounds", Lite(&_val.bounds)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ItemType"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + formatter.field("ty", Lite(&_val.ty)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ItemUnion"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + formatter.field("fields", Lite(&_val.fields)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ItemUse"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("vis", Lite(&_val.vis)); + if let Some(val) = &_val.leading_colon { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Colon2); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("leading_colon", Print::ref_cast(val)); + } + formatter.field("tree", Lite(&_val.tree)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ItemVerbatim"); + formatter.field("tts", Lite(&_val.tts)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("Label"); + formatter.field("name", Lite(&_val.name)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("Lifetime"); + formatter.field("ident", Lite(&_val.ident)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("LifetimeDef"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("lifetime", Lite(&_val.lifetime)); + if let Some(val) = &_val.colon_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Colon); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("colon_token", Print::ref_cast(val)); + } + if !_val.bounds.is_empty() { + formatter.field("bounds", Lite(&_val.bounds)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::Lit::Str(_val) => write!(formatter, "{:?}", _val.value()), + syn::Lit::ByteStr(_val) => write!(formatter, "{:?}", _val.value()), + syn::Lit::Byte(_val) => write!(formatter, "{:?}", _val.value()), + syn::Lit::Char(_val) => write!(formatter, "{:?}", _val.value()), + syn::Lit::Int(_val) => write!(formatter, "{:?}", _val.value()), + syn::Lit::Float(_val) => write!(formatter, "{:?}", _val.value()), + syn::Lit::Bool(_val) => { + let mut formatter = formatter.debug_struct("Lit::Bool"); + formatter.field("value", Lite(&_val.value)); + formatter.finish() + } + syn::Lit::Verbatim(_val) => { + let mut formatter = formatter.debug_struct("Lit::Verbatim"); + formatter.field("token", Lite(&_val.token)); + formatter.finish() + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("LitBool"); + formatter.field("value", Lite(&_val.value)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + write!(formatter, "{:?}", _val.value()) + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + write!(formatter, "{:?}", _val.value()) + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + write!(formatter, "{:?}", _val.value()) + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + write!(formatter, "{:?}", _val.value()) + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + write!(formatter, "{:?}", _val.value()) + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + write!(formatter, "{:?}", _val.value()) + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("LitVerbatim"); + formatter.field("token", Lite(&_val.token)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("Local"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + if !_val.pats.is_empty() { + formatter.field("pats", Lite(&_val.pats)); + } + if let Some(val) = &_val.ty { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((syn::token::Colon, Box)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(&_val.1), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("ty", Print::ref_cast(val)); + } + if let Some(val) = &_val.init { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((syn::token::Eq, Box)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(&_val.1), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("init", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("Macro"); + formatter.field("path", Lite(&_val.path)); + formatter.field("delimiter", Lite(&_val.delimiter)); + formatter.field("tts", Lite(&_val.tts)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::MacroDelimiter::Paren(_val) => { + formatter.write_str("Paren")?; + Ok(()) + } + syn::MacroDelimiter::Brace(_val) => { + formatter.write_str("Brace")?; + Ok(()) + } + syn::MacroDelimiter::Bracket(_val) => { + formatter.write_str("Bracket")?; + Ok(()) + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::Member::Named(_val) => { + formatter.write_str("Named")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::Member::Unnamed(_val) => { + formatter.write_str("Unnamed")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::Meta::Word(_val) => { + formatter.write_str("Word")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::Meta::List(_val) => { + let mut formatter = formatter.debug_struct("Meta::List"); + formatter.field("ident", Lite(&_val.ident)); + if !_val.nested.is_empty() { + formatter.field("nested", Lite(&_val.nested)); + } + formatter.finish() + } + syn::Meta::NameValue(_val) => { + let mut formatter = formatter.debug_struct("Meta::NameValue"); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("lit", Lite(&_val.lit)); + formatter.finish() + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("MetaList"); + formatter.field("ident", Lite(&_val.ident)); + if !_val.nested.is_empty() { + formatter.field("nested", Lite(&_val.nested)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("MetaNameValue"); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("lit", Lite(&_val.lit)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("MethodSig"); + if let Some(val) = &_val.constness { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Const); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("constness", Print::ref_cast(val)); + } + if let Some(val) = &_val.asyncness { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Async); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("asyncness", Print::ref_cast(val)); + } + if let Some(val) = &_val.unsafety { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Unsafe); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("unsafety", Print::ref_cast(val)); + } + if let Some(val) = &_val.abi { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Abi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("abi", Print::ref_cast(val)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("decl", Lite(&_val.decl)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("MethodTurbofish"); + if !_val.args.is_empty() { + formatter.field("args", Lite(&_val.args)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::NestedMeta::Meta(_val) => { + formatter.write_str("Meta")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::NestedMeta::Literal(_val) => { + formatter.write_str("Literal")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("ParenthesizedGenericArguments"); + if !_val.inputs.is_empty() { + formatter.field("inputs", Lite(&_val.inputs)); + } + formatter.field("output", Lite(&_val.output)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::Pat::Wild(_val) => { + let mut formatter = formatter.debug_struct("Pat::Wild"); + formatter.finish() + } + syn::Pat::Ident(_val) => { + let mut formatter = formatter.debug_struct("Pat::Ident"); + if let Some(val) = &_val.by_ref { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Ref); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("by_ref", Print::ref_cast(val)); + } + if let Some(val) = &_val.mutability { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Mut); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("mutability", Print::ref_cast(val)); + } + formatter.field("ident", Lite(&_val.ident)); + if let Some(val) = &_val.subpat { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((syn::token::At, Box)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(&_val.1), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("subpat", Print::ref_cast(val)); + } + formatter.finish() + } + syn::Pat::Struct(_val) => { + let mut formatter = formatter.debug_struct("Pat::Struct"); + formatter.field("path", Lite(&_val.path)); + if !_val.fields.is_empty() { + formatter.field("fields", Lite(&_val.fields)); + } + if let Some(val) = &_val.dot2_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Dot2); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("dot2_token", Print::ref_cast(val)); + } + formatter.finish() + } + syn::Pat::TupleStruct(_val) => { + let mut formatter = formatter.debug_struct("Pat::TupleStruct"); + formatter.field("path", Lite(&_val.path)); + formatter.field("pat", Lite(&_val.pat)); + formatter.finish() + } + syn::Pat::Path(_val) => { + let mut formatter = formatter.debug_struct("Pat::Path"); + if let Some(val) = &_val.qself { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::QSelf); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("qself", Print::ref_cast(val)); + } + formatter.field("path", Lite(&_val.path)); + formatter.finish() + } + syn::Pat::Tuple(_val) => { + let mut formatter = formatter.debug_struct("Pat::Tuple"); + if !_val.front.is_empty() { + formatter.field("front", Lite(&_val.front)); + } + if let Some(val) = &_val.dot2_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Dot2); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("dot2_token", Print::ref_cast(val)); + } + if let Some(val) = &_val.comma_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Comma); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("comma_token", Print::ref_cast(val)); + } + if !_val.back.is_empty() { + formatter.field("back", Lite(&_val.back)); + } + formatter.finish() + } + syn::Pat::Box(_val) => { + let mut formatter = formatter.debug_struct("Pat::Box"); + formatter.field("pat", Lite(&_val.pat)); + formatter.finish() + } + syn::Pat::Ref(_val) => { + let mut formatter = formatter.debug_struct("Pat::Ref"); + if let Some(val) = &_val.mutability { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Mut); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("mutability", Print::ref_cast(val)); + } + formatter.field("pat", Lite(&_val.pat)); + formatter.finish() + } + syn::Pat::Lit(_val) => { + let mut formatter = formatter.debug_struct("Pat::Lit"); + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } + syn::Pat::Range(_val) => { + let mut formatter = formatter.debug_struct("Pat::Range"); + formatter.field("lo", Lite(&_val.lo)); + formatter.field("limits", Lite(&_val.limits)); + formatter.field("hi", Lite(&_val.hi)); + formatter.finish() + } + syn::Pat::Slice(_val) => { + let mut formatter = formatter.debug_struct("Pat::Slice"); + if !_val.front.is_empty() { + formatter.field("front", Lite(&_val.front)); + } + if let Some(val) = &_val.middle { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(Box); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("middle", Print::ref_cast(val)); + } + if let Some(val) = &_val.dot2_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Dot2); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("dot2_token", Print::ref_cast(val)); + } + if let Some(val) = &_val.comma_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Comma); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("comma_token", Print::ref_cast(val)); + } + if !_val.back.is_empty() { + formatter.field("back", Lite(&_val.back)); + } + formatter.finish() + } + syn::Pat::Macro(_val) => { + let mut formatter = formatter.debug_struct("Pat::Macro"); + formatter.field("mac", Lite(&_val.mac)); + formatter.finish() + } + syn::Pat::Verbatim(_val) => { + let mut formatter = formatter.debug_struct("Pat::Verbatim"); + formatter.field("tts", Lite(&_val.tts)); + formatter.finish() + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("PatBox"); + formatter.field("pat", Lite(&_val.pat)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("PatIdent"); + if let Some(val) = &_val.by_ref { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Ref); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("by_ref", Print::ref_cast(val)); + } + if let Some(val) = &_val.mutability { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Mut); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("mutability", Print::ref_cast(val)); + } + formatter.field("ident", Lite(&_val.ident)); + if let Some(val) = &_val.subpat { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((syn::token::At, Box)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(&_val.1), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("subpat", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("PatLit"); + formatter.field("expr", Lite(&_val.expr)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("PatMacro"); + formatter.field("mac", Lite(&_val.mac)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("PatPath"); + if let Some(val) = &_val.qself { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::QSelf); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("qself", Print::ref_cast(val)); + } + formatter.field("path", Lite(&_val.path)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("PatRange"); + formatter.field("lo", Lite(&_val.lo)); + formatter.field("limits", Lite(&_val.limits)); + formatter.field("hi", Lite(&_val.hi)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("PatRef"); + if let Some(val) = &_val.mutability { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Mut); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("mutability", Print::ref_cast(val)); + } + formatter.field("pat", Lite(&_val.pat)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("PatSlice"); + if !_val.front.is_empty() { + formatter.field("front", Lite(&_val.front)); + } + if let Some(val) = &_val.middle { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(Box); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("middle", Print::ref_cast(val)); + } + if let Some(val) = &_val.dot2_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Dot2); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("dot2_token", Print::ref_cast(val)); + } + if let Some(val) = &_val.comma_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Comma); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("comma_token", Print::ref_cast(val)); + } + if !_val.back.is_empty() { + formatter.field("back", Lite(&_val.back)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("PatStruct"); + formatter.field("path", Lite(&_val.path)); + if !_val.fields.is_empty() { + formatter.field("fields", Lite(&_val.fields)); + } + if let Some(val) = &_val.dot2_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Dot2); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("dot2_token", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("PatTuple"); + if !_val.front.is_empty() { + formatter.field("front", Lite(&_val.front)); + } + if let Some(val) = &_val.dot2_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Dot2); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("dot2_token", Print::ref_cast(val)); + } + if let Some(val) = &_val.comma_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Comma); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("comma_token", Print::ref_cast(val)); + } + if !_val.back.is_empty() { + formatter.field("back", Lite(&_val.back)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("PatTupleStruct"); + formatter.field("path", Lite(&_val.path)); + formatter.field("pat", Lite(&_val.pat)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("PatVerbatim"); + formatter.field("tts", Lite(&_val.tts)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("PatWild"); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("Path"); + if let Some(val) = &_val.leading_colon { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Colon2); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("leading_colon", Print::ref_cast(val)); + } + if !_val.segments.is_empty() { + formatter.field("segments", Lite(&_val.segments)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::PathArguments::None => formatter.write_str("None"), + syn::PathArguments::AngleBracketed(_val) => { + let mut formatter = formatter.debug_struct("PathArguments::AngleBracketed"); + if let Some(val) = &_val.colon2_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Colon2); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("colon2_token", Print::ref_cast(val)); + } + if !_val.args.is_empty() { + formatter.field("args", Lite(&_val.args)); + } + formatter.finish() + } + syn::PathArguments::Parenthesized(_val) => { + let mut formatter = formatter.debug_struct("PathArguments::Parenthesized"); + if !_val.inputs.is_empty() { + formatter.field("inputs", Lite(&_val.inputs)); + } + formatter.field("output", Lite(&_val.output)); + formatter.finish() + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("PathSegment"); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("arguments", Lite(&_val.arguments)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("PredicateEq"); + formatter.field("lhs_ty", Lite(&_val.lhs_ty)); + formatter.field("rhs_ty", Lite(&_val.rhs_ty)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("PredicateLifetime"); + formatter.field("lifetime", Lite(&_val.lifetime)); + if !_val.bounds.is_empty() { + formatter.field("bounds", Lite(&_val.bounds)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("PredicateType"); + if let Some(val) = &_val.lifetimes { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::BoundLifetimes); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("lifetimes", Print::ref_cast(val)); + } + formatter.field("bounded_ty", Lite(&_val.bounded_ty)); + if !_val.bounds.is_empty() { + formatter.field("bounds", Lite(&_val.bounds)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("QSelf"); + formatter.field("ty", Lite(&_val.ty)); + formatter.field("position", Lite(&_val.position)); + if let Some(val) = &_val.as_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::As); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("as_token", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::RangeLimits::HalfOpen(_val) => { + formatter.write_str("HalfOpen")?; + Ok(()) + } + syn::RangeLimits::Closed(_val) => { + formatter.write_str("Closed")?; + Ok(()) + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::ReturnType::Default => formatter.write_str("Default"), + syn::ReturnType::Type(_v0, _v1) => { + let mut formatter = formatter.debug_tuple("Type"); + formatter.field(Lite(_v1)); + formatter.finish() + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::Stmt::Local(_val) => { + formatter.write_str("Local")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::Stmt::Item(_val) => { + formatter.write_str("Item")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::Stmt::Expr(_val) => { + formatter.write_str("Expr")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::Stmt::Semi(_v0, _v1) => { + let mut formatter = formatter.debug_tuple("Semi"); + formatter.field(Lite(_v0)); + formatter.finish() + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TraitBound"); + if let Some(val) = &_val.paren_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Paren); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("paren_token", Print::ref_cast(val)); + } + formatter.field("modifier", Lite(&_val.modifier)); + if let Some(val) = &_val.lifetimes { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::BoundLifetimes); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("lifetimes", Print::ref_cast(val)); + } + formatter.field("path", Lite(&_val.path)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::TraitBoundModifier::None => formatter.write_str("None"), + syn::TraitBoundModifier::Maybe(_val) => { + formatter.write_str("Maybe")?; + Ok(()) + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::TraitItem::Const(_val) => { + let mut formatter = formatter.debug_struct("TraitItem::Const"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("ty", Lite(&_val.ty)); + if let Some(val) = &_val.default { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((syn::token::Eq, syn::Expr)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(&_val.1), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("default", Print::ref_cast(val)); + } + formatter.finish() + } + syn::TraitItem::Method(_val) => { + let mut formatter = formatter.debug_struct("TraitItem::Method"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("sig", Lite(&_val.sig)); + if let Some(val) = &_val.default { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Block); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("default", Print::ref_cast(val)); + } + if let Some(val) = &_val.semi_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Semi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("semi_token", Print::ref_cast(val)); + } + formatter.finish() + } + syn::TraitItem::Type(_val) => { + let mut formatter = formatter.debug_struct("TraitItem::Type"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + if let Some(val) = &_val.colon_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Colon); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("colon_token", Print::ref_cast(val)); + } + if !_val.bounds.is_empty() { + formatter.field("bounds", Lite(&_val.bounds)); + } + if let Some(val) = &_val.default { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((syn::token::Eq, syn::Type)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(&_val.1), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("default", Print::ref_cast(val)); + } + formatter.finish() + } + syn::TraitItem::Macro(_val) => { + let mut formatter = formatter.debug_struct("TraitItem::Macro"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("mac", Lite(&_val.mac)); + if let Some(val) = &_val.semi_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Semi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("semi_token", Print::ref_cast(val)); + } + formatter.finish() + } + syn::TraitItem::Verbatim(_val) => { + let mut formatter = formatter.debug_struct("TraitItem::Verbatim"); + formatter.field("tts", Lite(&_val.tts)); + formatter.finish() + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TraitItemConst"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("ty", Lite(&_val.ty)); + if let Some(val) = &_val.default { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((syn::token::Eq, syn::Expr)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(&_val.1), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("default", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TraitItemMacro"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("mac", Lite(&_val.mac)); + if let Some(val) = &_val.semi_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Semi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("semi_token", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TraitItemMethod"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("sig", Lite(&_val.sig)); + if let Some(val) = &_val.default { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Block); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("default", Print::ref_cast(val)); + } + if let Some(val) = &_val.semi_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Semi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("semi_token", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TraitItemType"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("generics", Lite(&_val.generics)); + if let Some(val) = &_val.colon_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Colon); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("colon_token", Print::ref_cast(val)); + } + if !_val.bounds.is_empty() { + formatter.field("bounds", Lite(&_val.bounds)); + } + if let Some(val) = &_val.default { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((syn::token::Eq, syn::Type)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(&_val.1), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("default", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TraitItemVerbatim"); + formatter.field("tts", Lite(&_val.tts)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::Type::Slice(_val) => { + let mut formatter = formatter.debug_struct("Type::Slice"); + formatter.field("elem", Lite(&_val.elem)); + formatter.finish() + } + syn::Type::Array(_val) => { + let mut formatter = formatter.debug_struct("Type::Array"); + formatter.field("elem", Lite(&_val.elem)); + formatter.field("len", Lite(&_val.len)); + formatter.finish() + } + syn::Type::Ptr(_val) => { + let mut formatter = formatter.debug_struct("Type::Ptr"); + if let Some(val) = &_val.const_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Const); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("const_token", Print::ref_cast(val)); + } + if let Some(val) = &_val.mutability { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Mut); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("mutability", Print::ref_cast(val)); + } + formatter.field("elem", Lite(&_val.elem)); + formatter.finish() + } + syn::Type::Reference(_val) => { + let mut formatter = formatter.debug_struct("Type::Reference"); + if let Some(val) = &_val.lifetime { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Lifetime); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("lifetime", Print::ref_cast(val)); + } + if let Some(val) = &_val.mutability { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Mut); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("mutability", Print::ref_cast(val)); + } + formatter.field("elem", Lite(&_val.elem)); + formatter.finish() + } + syn::Type::BareFn(_val) => { + let mut formatter = formatter.debug_struct("Type::BareFn"); + if let Some(val) = &_val.lifetimes { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::BoundLifetimes); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("lifetimes", Print::ref_cast(val)); + } + if let Some(val) = &_val.unsafety { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Unsafe); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("unsafety", Print::ref_cast(val)); + } + if let Some(val) = &_val.abi { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Abi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("abi", Print::ref_cast(val)); + } + if !_val.inputs.is_empty() { + formatter.field("inputs", Lite(&_val.inputs)); + } + if let Some(val) = &_val.variadic { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Dot3); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("variadic", Print::ref_cast(val)); + } + formatter.field("output", Lite(&_val.output)); + formatter.finish() + } + syn::Type::Never(_val) => { + let mut formatter = formatter.debug_struct("Type::Never"); + formatter.finish() + } + syn::Type::Tuple(_val) => { + let mut formatter = formatter.debug_struct("Type::Tuple"); + if !_val.elems.is_empty() { + formatter.field("elems", Lite(&_val.elems)); + } + formatter.finish() + } + syn::Type::Path(_val) => { + let mut formatter = formatter.debug_struct("Type::Path"); + if let Some(val) = &_val.qself { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::QSelf); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("qself", Print::ref_cast(val)); + } + formatter.field("path", Lite(&_val.path)); + formatter.finish() + } + syn::Type::TraitObject(_val) => { + let mut formatter = formatter.debug_struct("Type::TraitObject"); + if let Some(val) = &_val.dyn_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Dyn); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("dyn_token", Print::ref_cast(val)); + } + if !_val.bounds.is_empty() { + formatter.field("bounds", Lite(&_val.bounds)); + } + formatter.finish() + } + syn::Type::ImplTrait(_val) => { + let mut formatter = formatter.debug_struct("Type::ImplTrait"); + if !_val.bounds.is_empty() { + formatter.field("bounds", Lite(&_val.bounds)); + } + formatter.finish() + } + syn::Type::Paren(_val) => { + let mut formatter = formatter.debug_struct("Type::Paren"); + formatter.field("elem", Lite(&_val.elem)); + formatter.finish() + } + syn::Type::Group(_val) => { + let mut formatter = formatter.debug_struct("Type::Group"); + formatter.field("elem", Lite(&_val.elem)); + formatter.finish() + } + syn::Type::Infer(_val) => { + let mut formatter = formatter.debug_struct("Type::Infer"); + formatter.finish() + } + syn::Type::Macro(_val) => { + let mut formatter = formatter.debug_struct("Type::Macro"); + formatter.field("mac", Lite(&_val.mac)); + formatter.finish() + } + syn::Type::Verbatim(_val) => { + let mut formatter = formatter.debug_struct("Type::Verbatim"); + formatter.field("tts", Lite(&_val.tts)); + formatter.finish() + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TypeArray"); + formatter.field("elem", Lite(&_val.elem)); + formatter.field("len", Lite(&_val.len)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TypeBareFn"); + if let Some(val) = &_val.lifetimes { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::BoundLifetimes); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("lifetimes", Print::ref_cast(val)); + } + if let Some(val) = &_val.unsafety { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Unsafe); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("unsafety", Print::ref_cast(val)); + } + if let Some(val) = &_val.abi { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Abi); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("abi", Print::ref_cast(val)); + } + if !_val.inputs.is_empty() { + formatter.field("inputs", Lite(&_val.inputs)); + } + if let Some(val) = &_val.variadic { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Dot3); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("variadic", Print::ref_cast(val)); + } + formatter.field("output", Lite(&_val.output)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TypeGroup"); + formatter.field("elem", Lite(&_val.elem)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TypeImplTrait"); + if !_val.bounds.is_empty() { + formatter.field("bounds", Lite(&_val.bounds)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TypeInfer"); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TypeMacro"); + formatter.field("mac", Lite(&_val.mac)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TypeNever"); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TypeParam"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("ident", Lite(&_val.ident)); + if let Some(val) = &_val.colon_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Colon); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("colon_token", Print::ref_cast(val)); + } + if !_val.bounds.is_empty() { + formatter.field("bounds", Lite(&_val.bounds)); + } + if let Some(val) = &_val.eq_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Eq); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("eq_token", Print::ref_cast(val)); + } + if let Some(val) = &_val.default { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Type); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("default", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::TypeParamBound::Trait(_val) => { + formatter.write_str("Trait")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::TypeParamBound::Lifetime(_val) => { + formatter.write_str("Lifetime")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TypeParen"); + formatter.field("elem", Lite(&_val.elem)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TypePath"); + if let Some(val) = &_val.qself { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::QSelf); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("qself", Print::ref_cast(val)); + } + formatter.field("path", Lite(&_val.path)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TypePtr"); + if let Some(val) = &_val.const_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Const); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("const_token", Print::ref_cast(val)); + } + if let Some(val) = &_val.mutability { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Mut); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("mutability", Print::ref_cast(val)); + } + formatter.field("elem", Lite(&_val.elem)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TypeReference"); + if let Some(val) = &_val.lifetime { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::Lifetime); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("lifetime", Print::ref_cast(val)); + } + if let Some(val) = &_val.mutability { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Mut); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("mutability", Print::ref_cast(val)); + } + formatter.field("elem", Lite(&_val.elem)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TypeSlice"); + formatter.field("elem", Lite(&_val.elem)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TypeTraitObject"); + if let Some(val) = &_val.dyn_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::Dyn); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("dyn_token", Print::ref_cast(val)); + } + if !_val.bounds.is_empty() { + formatter.field("bounds", Lite(&_val.bounds)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TypeTuple"); + if !_val.elems.is_empty() { + formatter.field("elems", Lite(&_val.elems)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("TypeVerbatim"); + formatter.field("tts", Lite(&_val.tts)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::UnOp::Deref(_val) => { + formatter.write_str("Deref")?; + Ok(()) + } + syn::UnOp::Not(_val) => { + formatter.write_str("Not")?; + Ok(()) + } + syn::UnOp::Neg(_val) => { + formatter.write_str("Neg")?; + Ok(()) + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("UseGlob"); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("UseGroup"); + if !_val.items.is_empty() { + formatter.field("items", Lite(&_val.items)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("UseName"); + formatter.field("ident", Lite(&_val.ident)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("UsePath"); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("tree", Lite(&_val.tree)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("UseRename"); + formatter.field("ident", Lite(&_val.ident)); + formatter.field("rename", Lite(&_val.rename)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::UseTree::Path(_val) => { + formatter.write_str("Path")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::UseTree::Name(_val) => { + formatter.write_str("Name")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::UseTree::Rename(_val) => { + formatter.write_str("Rename")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::UseTree::Glob(_val) => { + formatter.write_str("Glob")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::UseTree::Group(_val) => { + formatter.write_str("Group")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("Variant"); + if !_val.attrs.is_empty() { + formatter.field("attrs", Lite(&_val.attrs)); + } + formatter.field("ident", Lite(&_val.ident)); + formatter.field("fields", Lite(&_val.fields)); + if let Some(val) = &_val.discriminant { + #[derive(RefCast)] + #[repr(transparent)] + struct Print((syn::token::Eq, syn::Expr)); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + let _val = &self.0; + formatter.write_str("(")?; + Debug::fmt(Lite(&_val.1), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + formatter.field("discriminant", Print::ref_cast(val)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("VisCrate"); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("VisPublic"); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("VisRestricted"); + if let Some(val) = &_val.in_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::In); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("in_token", Print::ref_cast(val)); + } + formatter.field("path", Lite(&_val.path)); + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::Visibility::Public(_val) => { + let mut formatter = formatter.debug_struct("Visibility::Public"); + formatter.finish() + } + syn::Visibility::Crate(_val) => { + let mut formatter = formatter.debug_struct("Visibility::Crate"); + formatter.finish() + } + syn::Visibility::Restricted(_val) => { + let mut formatter = formatter.debug_struct("Visibility::Restricted"); + if let Some(val) = &_val.in_token { + #[derive(RefCast)] + #[repr(transparent)] + struct Print(syn::token::In); + impl Debug for Print { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("Some")?; + Ok(()) + } + } + formatter.field("in_token", Print::ref_cast(val)); + } + formatter.field("path", Lite(&_val.path)); + formatter.finish() + } + syn::Visibility::Inherited => formatter.write_str("Inherited"), + } + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + let mut formatter = formatter.debug_struct("WhereClause"); + if !_val.predicates.is_empty() { + formatter.field("predicates", Lite(&_val.predicates)); + } + formatter.finish() + } +} +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let _val = &self.value; + match _val { + syn::WherePredicate::Type(_val) => { + formatter.write_str("Type")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::WherePredicate::Lifetime(_val) => { + formatter.write_str("Lifetime")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + syn::WherePredicate::Eq(_val) => { + formatter.write_str("Eq")?; + formatter.write_str("(")?; + Debug::fmt(Lite(_val), formatter)?; + formatter.write_str(")")?; + Ok(()) + } + } + } +} diff -Nru cargo-0.35.0/vendor/syn/tests/debug/mod.rs cargo-0.37.0/vendor/syn/tests/debug/mod.rs --- cargo-0.35.0/vendor/syn/tests/debug/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/debug/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,113 @@ +extern crate proc_macro2; +extern crate ref_cast; + +mod gen; + +use self::proc_macro2::{Ident, Literal, TokenStream}; +use self::ref_cast::RefCast; +use std::fmt::{self, Debug}; +use std::ops::Deref; +use syn::punctuated::Punctuated; + +#[derive(RefCast)] +#[repr(transparent)] +pub struct Lite { + value: T, +} + +#[allow(non_snake_case)] +pub fn Lite(value: &T) -> &Lite { + Lite::ref_cast(value) +} + +impl Deref for Lite { + type Target = T; + + fn deref(&self) -> &Self::Target { + &self.value + } +} + +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!(formatter, "{}", self.value) + } +} + +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!(formatter, "{}", self.value) + } +} + +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!(formatter, "{}", self.value) + } +} + +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!(formatter, "{:?}", self.value) + } +} + +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!(formatter, "{:?}", self.value.to_string()) + } +} + +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!(formatter, "{}", self.value) + } +} + +impl Debug for Lite { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!(formatter, "`{}`", self.value) + } +} + +impl<'a, T> Debug for Lite<&'a T> +where + Lite: Debug, +{ + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + Debug::fmt(Lite(&*self.value), formatter) + } +} + +impl Debug for Lite> +where + Lite: Debug, +{ + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + Debug::fmt(Lite(&*self.value), formatter) + } +} + +impl Debug for Lite> +where + Lite: Debug, +{ + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter + .debug_list() + .entries(self.value.iter().map(Lite)) + .finish() + } +} + +impl Debug for Lite> +where + Lite: Debug, +{ + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter + .debug_list() + .entries(self.value.iter().map(Lite)) + .finish() + } +} diff -Nru cargo-0.35.0/vendor/syn/tests/features/error.rs cargo-0.37.0/vendor/syn/tests/features/error.rs --- cargo-0.35.0/vendor/syn/tests/features/error.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/features/error.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +"Hello! You want: cargo test --release --all-features" diff -Nru cargo-0.35.0/vendor/syn/tests/features/mod.rs cargo-0.37.0/vendor/syn/tests/features/mod.rs --- cargo-0.35.0/vendor/syn/tests/features/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/features/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,22 @@ +#[allow(unused_macros)] +macro_rules! hide_from_rustfmt { + ($mod:item) => { + $mod + }; +} + +#[cfg(not(all( + feature = "derive", + feature = "full", + feature = "parsing", + feature = "printing", + feature = "visit", + feature = "visit-mut", + feature = "fold", + feature = "clone-impls", + feature = "extra-traits", + feature = "proc-macro", +)))] +hide_from_rustfmt! { + mod error; +} diff -Nru cargo-0.35.0/vendor/syn/tests/macros/mod.rs cargo-0.37.0/vendor/syn/tests/macros/mod.rs --- cargo-0.35.0/vendor/syn/tests/macros/mod.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/macros/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,78 @@ +extern crate proc_macro2; + +#[path = "../debug/mod.rs"] +pub mod debug; + +use syn; +use syn::parse::{Parse, Result}; + +#[macro_export] +macro_rules! errorf { + ($($tt:tt)*) => {{ + use ::std::io::Write; + let stderr = ::std::io::stderr(); + write!(stderr.lock(), $($tt)*).unwrap(); + }}; +} + +#[macro_export] +macro_rules! punctuated { + ($($e:expr,)+) => {{ + let mut seq = ::syn::punctuated::Punctuated::new(); + $( + seq.push($e); + )+ + seq + }}; + + ($($e:expr),+) => { + punctuated!($($e,)+) + }; +} + +#[macro_export] +macro_rules! snapshot { + ($($args:tt)*) => { + snapshot_impl!(() $($args)*) + }; +} + +#[macro_export] +macro_rules! snapshot_impl { + (($expr:ident) as $t:ty, @$snapshot:literal) => { + let $expr = ::macros::Tokens::parse::<$t>($expr).unwrap(); + let debug = crate::macros::debug::Lite(&$expr); + insta::assert_debug_snapshot_matches!(debug, @$snapshot); + }; + (($($expr:tt)*) as $t:ty, @$snapshot:literal) => {{ + let syntax_tree = ::macros::Tokens::parse::<$t>($($expr)*).unwrap(); + let debug = crate::macros::debug::Lite(&syntax_tree); + insta::assert_debug_snapshot_matches!(debug, @$snapshot); + syntax_tree + }}; + (($($expr:tt)*) , @$snapshot:literal) => {{ + let syntax_tree = $($expr)*; + let debug = crate::macros::debug::Lite(&syntax_tree); + insta::assert_debug_snapshot_matches!(debug, @$snapshot); + syntax_tree + }}; + (($($expr:tt)*) $next:tt $($rest:tt)*) => { + snapshot_impl!(($($expr)* $next) $($rest)*) + }; +} + +pub trait Tokens { + fn parse(self) -> Result; +} + +impl<'a> Tokens for &'a str { + fn parse(self) -> Result { + syn::parse_str(self) + } +} + +impl Tokens for proc_macro2::TokenStream { + fn parse(self) -> Result { + syn::parse2(self) + } +} diff -Nru cargo-0.35.0/vendor/syn/tests/test_asyncness.rs cargo-0.37.0/vendor/syn/tests/test_asyncness.rs --- cargo-0.35.0/vendor/syn/tests/test_asyncness.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/test_asyncness.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,41 @@ +extern crate syn; + +mod features; + +#[macro_use] +mod macros; + +use syn::{Expr, Item}; + +#[test] +fn test_async_fn() { + let input = "async fn process() {}"; + + snapshot!(input as Item, @r###" + ⋮Item::Fn { + ⋮ vis: Inherited, + ⋮ asyncness: Some, + ⋮ ident: "process", + ⋮ decl: FnDecl { + ⋮ generics: Generics, + ⋮ output: Default, + ⋮ }, + ⋮ block: Block, + ⋮} + "###); +} + +#[test] +fn test_async_closure() { + let input = "async || {}"; + + snapshot!(input as Expr, @r###" + ⋮Expr::Closure { + ⋮ asyncness: Some, + ⋮ output: Default, + ⋮ body: Expr::Block { + ⋮ block: Block, + ⋮ }, + ⋮} + "###); +} diff -Nru cargo-0.35.0/vendor/syn/tests/test_attribute.rs cargo-0.37.0/vendor/syn/tests/test_attribute.rs --- cargo-0.35.0/vendor/syn/tests/test_attribute.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/test_attribute.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,279 @@ +extern crate syn; + +mod features; + +#[macro_use] +mod macros; + +use syn::parse::Parser; +use syn::{Attribute, Meta}; + +#[test] +fn test_meta_item_word() { + let (interpret, parse) = test("#[foo]"); + + snapshot!(interpret, @r###"Word("foo")"###); + + snapshot!(parse, @r###"Word("foo")"###); +} + +#[test] +fn test_meta_item_name_value() { + let (interpret, parse) = test("#[foo = 5]"); + + snapshot!(interpret, @r###" + ⋮Meta::NameValue { + ⋮ ident: "foo", + ⋮ lit: 5, + ⋮} + "###); + + snapshot!(parse, @r###" + ⋮Meta::NameValue { + ⋮ ident: "foo", + ⋮ lit: 5, + ⋮} + "###); +} + +#[test] +fn test_meta_item_bool_value() { + let (interpret, parse) = test("#[foo = true]");; + + snapshot!(interpret, @r###" + ⋮Meta::NameValue { + ⋮ ident: "foo", + ⋮ lit: Lit::Bool { + ⋮ value: true, + ⋮ }, + ⋮} + "###); + + snapshot!(parse, @r###" + ⋮Meta::NameValue { + ⋮ ident: "foo", + ⋮ lit: Lit::Bool { + ⋮ value: true, + ⋮ }, + ⋮} + "###); + + let (interpret, parse) = test("#[foo = false]"); + + snapshot!(interpret, @r###" + ⋮Meta::NameValue { + ⋮ ident: "foo", + ⋮ lit: Lit::Bool { + ⋮ value: false, + ⋮ }, + ⋮} + "###); + + snapshot!(parse, @r###" + ⋮Meta::NameValue { + ⋮ ident: "foo", + ⋮ lit: Lit::Bool { + ⋮ value: false, + ⋮ }, + ⋮} + "###); +} + +#[test] +fn test_meta_item_list_lit() { + let (interpret, parse) = test("#[foo(5)]"); + + snapshot!(interpret, @r###" + ⋮Meta::List { + ⋮ ident: "foo", + ⋮ nested: [ + ⋮ Literal(5), + ⋮ ], + ⋮} + "###); + + snapshot!(parse, @r###" + ⋮Meta::List { + ⋮ ident: "foo", + ⋮ nested: [ + ⋮ Literal(5), + ⋮ ], + ⋮} + "###); +} + +#[test] +fn test_meta_item_list_word() { + let (interpret, parse) = test("#[foo(bar)]"); + + snapshot!(interpret, @r###" + ⋮Meta::List { + ⋮ ident: "foo", + ⋮ nested: [ + ⋮ Meta(Word("bar")), + ⋮ ], + ⋮} + "###); + + snapshot!(parse, @r###" + ⋮Meta::List { + ⋮ ident: "foo", + ⋮ nested: [ + ⋮ Meta(Word("bar")), + ⋮ ], + ⋮} + "###); +} + +#[test] +fn test_meta_item_list_name_value() { + let (interpret, parse) = test("#[foo(bar = 5)]"); + + snapshot!(interpret, @r###" + ⋮Meta::List { + ⋮ ident: "foo", + ⋮ nested: [ + ⋮ Meta(Meta::NameValue { + ⋮ ident: "bar", + ⋮ lit: 5, + ⋮ }), + ⋮ ], + ⋮} + "###); + + snapshot!(parse, @r###" + ⋮Meta::List { + ⋮ ident: "foo", + ⋮ nested: [ + ⋮ Meta(Meta::NameValue { + ⋮ ident: "bar", + ⋮ lit: 5, + ⋮ }), + ⋮ ], + ⋮} + "###); +} + +#[test] +fn test_meta_item_list_bool_value() { + let (interpret, parse) = test("#[foo(bar = true)]"); + + snapshot!(interpret, @r###" + ⋮Meta::List { + ⋮ ident: "foo", + ⋮ nested: [ + ⋮ Meta(Meta::NameValue { + ⋮ ident: "bar", + ⋮ lit: Lit::Bool { + ⋮ value: true, + ⋮ }, + ⋮ }), + ⋮ ], + ⋮} + "###); + + snapshot!(parse, @r###" + ⋮Meta::List { + ⋮ ident: "foo", + ⋮ nested: [ + ⋮ Meta(Meta::NameValue { + ⋮ ident: "bar", + ⋮ lit: Lit::Bool { + ⋮ value: true, + ⋮ }, + ⋮ }), + ⋮ ], + ⋮} + "###); +} + +#[test] +fn test_meta_item_multiple() { + let (interpret, parse) = test("#[foo(word, name = 5, list(name2 = 6), word2)]"); + + snapshot!(interpret, @r###" + ⋮Meta::List { + ⋮ ident: "foo", + ⋮ nested: [ + ⋮ Meta(Word("word")), + ⋮ Meta(Meta::NameValue { + ⋮ ident: "name", + ⋮ lit: 5, + ⋮ }), + ⋮ Meta(Meta::List { + ⋮ ident: "list", + ⋮ nested: [ + ⋮ Meta(Meta::NameValue { + ⋮ ident: "name2", + ⋮ lit: 6, + ⋮ }), + ⋮ ], + ⋮ }), + ⋮ Meta(Word("word2")), + ⋮ ], + ⋮} + "###); + + snapshot!(parse, @r###" + ⋮Meta::List { + ⋮ ident: "foo", + ⋮ nested: [ + ⋮ Meta(Word("word")), + ⋮ Meta(Meta::NameValue { + ⋮ ident: "name", + ⋮ lit: 5, + ⋮ }), + ⋮ Meta(Meta::List { + ⋮ ident: "list", + ⋮ nested: [ + ⋮ Meta(Meta::NameValue { + ⋮ ident: "name2", + ⋮ lit: 6, + ⋮ }), + ⋮ ], + ⋮ }), + ⋮ Meta(Word("word2")), + ⋮ ], + ⋮} + "###); +} + +#[test] +fn test_bool_lit() { + let (interpret, parse) = test("#[foo(true)]"); + + snapshot!(interpret, @r###" + ⋮Meta::List { + ⋮ ident: "foo", + ⋮ nested: [ + ⋮ Literal(Lit::Bool { + ⋮ value: true, + ⋮ }), + ⋮ ], + ⋮} + "###); + + snapshot!(parse, @r###" + ⋮Meta::List { + ⋮ ident: "foo", + ⋮ nested: [ + ⋮ Literal(Lit::Bool { + ⋮ value: true, + ⋮ }), + ⋮ ], + ⋮} + "###); +} + +fn test(input: &str) -> (Meta, Meta) { + let attrs = Attribute::parse_outer.parse_str(input).unwrap(); + + assert_eq!(attrs.len(), 1); + let attr = attrs.into_iter().next().unwrap(); + + let interpret = attr.interpret_meta().unwrap(); + let parse = attr.parse_meta().unwrap(); + assert_eq!(interpret, parse); + + (interpret, parse) +} diff -Nru cargo-0.35.0/vendor/syn/tests/test_derive_input.rs cargo-0.37.0/vendor/syn/tests/test_derive_input.rs --- cargo-0.35.0/vendor/syn/tests/test_derive_input.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/test_derive_input.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,849 @@ +extern crate quote; +extern crate syn; + +mod features; + +#[macro_use] +mod macros; + +use quote::quote; +use syn::{Data, DeriveInput}; + +#[test] +fn test_unit() { + let input = quote! { + struct Unit; + }; + + snapshot!(input as DeriveInput, @r###" + ⋮DeriveInput { + ⋮ vis: Inherited, + ⋮ ident: "Unit", + ⋮ generics: Generics, + ⋮ data: Data::Struct { + ⋮ fields: Unit, + ⋮ semi_token: Some, + ⋮ }, + ⋮} + "###); +} + +#[test] +fn test_struct() { + let input = quote! { + #[derive(Debug, Clone)] + pub struct Item { + pub ident: Ident, + pub attrs: Vec + } + }; + + snapshot!(input as DeriveInput, @r###" + ⋮DeriveInput { + ⋮ attrs: [ + ⋮ Attribute { + ⋮ style: Outer, + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "derive", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ tts: `( Debug , Clone )`, + ⋮ }, + ⋮ ], + ⋮ vis: Visibility::Public, + ⋮ ident: "Item", + ⋮ generics: Generics, + ⋮ data: Data::Struct { + ⋮ fields: Fields::Named { + ⋮ named: [ + ⋮ Field { + ⋮ vis: Visibility::Public, + ⋮ ident: Some("ident"), + ⋮ colon_token: Some, + ⋮ ty: Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "Ident", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ }, + ⋮ Field { + ⋮ vis: Visibility::Public, + ⋮ ident: Some("attrs"), + ⋮ colon_token: Some, + ⋮ ty: Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "Vec", + ⋮ arguments: PathArguments::AngleBracketed { + ⋮ args: [ + ⋮ Type(Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "Attribute", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }), + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮} + "###); + + snapshot!(input.attrs[0].interpret_meta().unwrap(), @r###" + ⋮Meta::List { + ⋮ ident: "derive", + ⋮ nested: [ + ⋮ Meta(Word("Debug")), + ⋮ Meta(Word("Clone")), + ⋮ ], + ⋮} + "###); +} + +#[test] +fn test_union() { + let input = quote! { + union MaybeUninit { + uninit: (), + value: T + } + }; + + snapshot!(input as DeriveInput, @r###" + ⋮DeriveInput { + ⋮ vis: Inherited, + ⋮ ident: "MaybeUninit", + ⋮ generics: Generics { + ⋮ lt_token: Some, + ⋮ params: [ + ⋮ Type(TypeParam { + ⋮ ident: "T", + ⋮ }), + ⋮ ], + ⋮ gt_token: Some, + ⋮ }, + ⋮ data: Data::Union { + ⋮ fields: FieldsNamed { + ⋮ named: [ + ⋮ Field { + ⋮ vis: Inherited, + ⋮ ident: Some("uninit"), + ⋮ colon_token: Some, + ⋮ ty: Type::Tuple, + ⋮ }, + ⋮ Field { + ⋮ vis: Inherited, + ⋮ ident: Some("value"), + ⋮ colon_token: Some, + ⋮ ty: Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "T", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮} + "###); +} + +#[test] +#[cfg(feature = "full")] +fn test_enum() { + let input = quote! { + /// See the std::result module documentation for details. + #[must_use] + pub enum Result { + Ok(T), + Err(E), + Surprise = 0isize, + + // Smuggling data into a proc_macro_derive, + // in the style of https://github.com/dtolnay/proc-macro-hack + ProcMacroHack = (0, "data").0 + } + }; + + snapshot!(input as DeriveInput, @r###" + ⋮DeriveInput { + ⋮ attrs: [ + ⋮ Attribute { + ⋮ style: Outer, + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "doc", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ tts: `= r" See the std::result module documentation for details."`, + ⋮ }, + ⋮ Attribute { + ⋮ style: Outer, + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "must_use", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ tts: ``, + ⋮ }, + ⋮ ], + ⋮ vis: Visibility::Public, + ⋮ ident: "Result", + ⋮ generics: Generics { + ⋮ lt_token: Some, + ⋮ params: [ + ⋮ Type(TypeParam { + ⋮ ident: "T", + ⋮ }), + ⋮ Type(TypeParam { + ⋮ ident: "E", + ⋮ }), + ⋮ ], + ⋮ gt_token: Some, + ⋮ }, + ⋮ data: Data::Enum { + ⋮ variants: [ + ⋮ Variant { + ⋮ ident: "Ok", + ⋮ fields: Fields::Unnamed { + ⋮ unnamed: [ + ⋮ Field { + ⋮ vis: Inherited, + ⋮ ty: Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "T", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ Variant { + ⋮ ident: "Err", + ⋮ fields: Fields::Unnamed { + ⋮ unnamed: [ + ⋮ Field { + ⋮ vis: Inherited, + ⋮ ty: Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "E", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ Variant { + ⋮ ident: "Surprise", + ⋮ fields: Unit, + ⋮ discriminant: Some(Expr::Lit { + ⋮ lit: 0, + ⋮ }), + ⋮ }, + ⋮ Variant { + ⋮ ident: "ProcMacroHack", + ⋮ fields: Unit, + ⋮ discriminant: Some(Expr::Field { + ⋮ base: Expr::Tuple { + ⋮ elems: [ + ⋮ Expr::Lit { + ⋮ lit: 0, + ⋮ }, + ⋮ Expr::Lit { + ⋮ lit: "data", + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ member: Unnamed(Index { + ⋮ index: 0, + ⋮ }), + ⋮ }), + ⋮ }, + ⋮ ], + ⋮ }, + ⋮} + "###); + + let meta_items: Vec<_> = input + .attrs + .into_iter() + .map(|attr| attr.interpret_meta().unwrap()) + .collect(); + + snapshot!(meta_items, @r###" + ⋮[ + ⋮ Meta::NameValue { + ⋮ ident: "doc", + ⋮ lit: " See the std::result module documentation for details.", + ⋮ }, + ⋮ Word("must_use"), + ⋮] + "###); +} + +#[test] +fn test_attr_with_path() { + let input = quote! { + #[::attr_args::identity + fn main() { assert_eq!(foo(), "Hello, world!"); }] + struct Dummy; + }; + + snapshot!(input as DeriveInput, @r###" + ⋮DeriveInput { + ⋮ attrs: [ + ⋮ Attribute { + ⋮ style: Outer, + ⋮ path: Path { + ⋮ leading_colon: Some, + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "attr_args", + ⋮ arguments: None, + ⋮ }, + ⋮ PathSegment { + ⋮ ident: "identity", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ tts: `fn main ( ) { assert_eq ! ( foo ( ) , "Hello, world!" ) ; }`, + ⋮ }, + ⋮ ], + ⋮ vis: Inherited, + ⋮ ident: "Dummy", + ⋮ generics: Generics, + ⋮ data: Data::Struct { + ⋮ fields: Unit, + ⋮ semi_token: Some, + ⋮ }, + ⋮} + "###); + + assert!(input.attrs[0].interpret_meta().is_none()); +} + +#[test] +fn test_attr_with_non_mod_style_path() { + let input = quote! { + #[inert ] + struct S; + }; + + snapshot!(input as DeriveInput, @r###" + ⋮DeriveInput { + ⋮ attrs: [ + ⋮ Attribute { + ⋮ style: Outer, + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "inert", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ tts: `< T >`, + ⋮ }, + ⋮ ], + ⋮ vis: Inherited, + ⋮ ident: "S", + ⋮ generics: Generics, + ⋮ data: Data::Struct { + ⋮ fields: Unit, + ⋮ semi_token: Some, + ⋮ }, + ⋮} + "###); + + assert!(input.attrs[0].interpret_meta().is_none()); +} + +#[test] +fn test_attr_with_mod_style_path_with_self() { + let input = quote! { + #[foo::self] + struct S; + }; + + snapshot!(input as DeriveInput, @r###" + ⋮DeriveInput { + ⋮ attrs: [ + ⋮ Attribute { + ⋮ style: Outer, + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "foo", + ⋮ arguments: None, + ⋮ }, + ⋮ PathSegment { + ⋮ ident: "self", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ tts: ``, + ⋮ }, + ⋮ ], + ⋮ vis: Inherited, + ⋮ ident: "S", + ⋮ generics: Generics, + ⋮ data: Data::Struct { + ⋮ fields: Unit, + ⋮ semi_token: Some, + ⋮ }, + ⋮} + "###); + + assert!(input.attrs[0].interpret_meta().is_none()); +} + +#[test] +fn test_pub_restricted() { + // Taken from tests/rust/src/test/ui/resolve/auxiliary/privacy-struct-ctor.rs + let input = quote! { + pub(in m) struct Z(pub(in m::n) u8); + }; + + snapshot!(input as DeriveInput, @r###" + ⋮DeriveInput { + ⋮ vis: Visibility::Restricted { + ⋮ in_token: Some, + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "m", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ ident: "Z", + ⋮ generics: Generics, + ⋮ data: Data::Struct { + ⋮ fields: Fields::Unnamed { + ⋮ unnamed: [ + ⋮ Field { + ⋮ vis: Visibility::Restricted { + ⋮ in_token: Some, + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "m", + ⋮ arguments: None, + ⋮ }, + ⋮ PathSegment { + ⋮ ident: "n", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ ty: Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "u8", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ semi_token: Some, + ⋮ }, + ⋮} + "###); +} + +#[test] +fn test_vis_crate() { + let input = quote! { + crate struct S; + }; + + snapshot!(input as DeriveInput, @r###" + ⋮DeriveInput { + ⋮ vis: Visibility::Crate, + ⋮ ident: "S", + ⋮ generics: Generics, + ⋮ data: Data::Struct { + ⋮ fields: Unit, + ⋮ semi_token: Some, + ⋮ }, + ⋮} + "###); +} + +#[test] +fn test_pub_restricted_crate() { + let input = quote! { + pub(crate) struct S; + }; + + snapshot!(input as DeriveInput, @r###" + ⋮DeriveInput { + ⋮ vis: Visibility::Restricted { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "crate", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ ident: "S", + ⋮ generics: Generics, + ⋮ data: Data::Struct { + ⋮ fields: Unit, + ⋮ semi_token: Some, + ⋮ }, + ⋮} + "###); +} + +#[test] +fn test_pub_restricted_super() { + let input = quote! { + pub(super) struct S; + }; + + snapshot!(input as DeriveInput, @r###" + ⋮DeriveInput { + ⋮ vis: Visibility::Restricted { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "super", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ ident: "S", + ⋮ generics: Generics, + ⋮ data: Data::Struct { + ⋮ fields: Unit, + ⋮ semi_token: Some, + ⋮ }, + ⋮} + "###); +} + +#[test] +fn test_pub_restricted_in_super() { + let input = quote! { + pub(in super) struct S; + }; + + snapshot!(input as DeriveInput, @r###" + ⋮DeriveInput { + ⋮ vis: Visibility::Restricted { + ⋮ in_token: Some, + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "super", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ ident: "S", + ⋮ generics: Generics, + ⋮ data: Data::Struct { + ⋮ fields: Unit, + ⋮ semi_token: Some, + ⋮ }, + ⋮} + "###); +} + +#[test] +fn test_fields_on_unit_struct() { + let input = quote! { + struct S; + }; + + snapshot!(input as DeriveInput, @r###" + ⋮DeriveInput { + ⋮ vis: Inherited, + ⋮ ident: "S", + ⋮ generics: Generics, + ⋮ data: Data::Struct { + ⋮ fields: Unit, + ⋮ semi_token: Some, + ⋮ }, + ⋮} + "###); + + let data = match input.data { + Data::Struct(data) => data, + _ => panic!("expected a struct"), + }; + + assert_eq!(0, data.fields.iter().count()); +} + +#[test] +fn test_fields_on_named_struct() { + let input = quote! { + struct S { + foo: i32, + pub bar: String, + } + }; + + snapshot!(input as DeriveInput, @r###" + ⋮DeriveInput { + ⋮ vis: Inherited, + ⋮ ident: "S", + ⋮ generics: Generics, + ⋮ data: Data::Struct { + ⋮ fields: Fields::Named { + ⋮ named: [ + ⋮ Field { + ⋮ vis: Inherited, + ⋮ ident: Some("foo"), + ⋮ colon_token: Some, + ⋮ ty: Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "i32", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ }, + ⋮ Field { + ⋮ vis: Visibility::Public, + ⋮ ident: Some("bar"), + ⋮ colon_token: Some, + ⋮ ty: Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "String", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮} + "###); + + let data = match input.data { + Data::Struct(data) => data, + _ => panic!("expected a struct"), + }; + + snapshot!(data.fields.into_iter().collect::>(), @r###" + ⋮[ + ⋮ Field { + ⋮ vis: Inherited, + ⋮ ident: Some("foo"), + ⋮ colon_token: Some, + ⋮ ty: Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "i32", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ }, + ⋮ Field { + ⋮ vis: Visibility::Public, + ⋮ ident: Some("bar"), + ⋮ colon_token: Some, + ⋮ ty: Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "String", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ }, + ⋮] + "###); +} + +#[test] +fn test_fields_on_tuple_struct() { + let input = quote! { + struct S(i32, pub String); + }; + + snapshot!(input as DeriveInput, @r###" + ⋮DeriveInput { + ⋮ vis: Inherited, + ⋮ ident: "S", + ⋮ generics: Generics, + ⋮ data: Data::Struct { + ⋮ fields: Fields::Unnamed { + ⋮ unnamed: [ + ⋮ Field { + ⋮ vis: Inherited, + ⋮ ty: Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "i32", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ }, + ⋮ Field { + ⋮ vis: Visibility::Public, + ⋮ ty: Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "String", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ semi_token: Some, + ⋮ }, + ⋮} + "###); + + let data = match input.data { + Data::Struct(data) => data, + _ => panic!("expected a struct"), + }; + + snapshot!(data.fields.iter().collect::>(), @r###" + ⋮[ + ⋮ Field { + ⋮ vis: Inherited, + ⋮ ty: Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "i32", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ }, + ⋮ Field { + ⋮ vis: Visibility::Public, + ⋮ ty: Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "String", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ }, + ⋮] + "###); +} + +#[test] +fn test_ambiguous_crate() { + let input = quote! { + // The field type is `(crate::X)` not `crate (::X)`. + struct S(crate::X); + }; + + snapshot!(input as DeriveInput, @r###" + ⋮DeriveInput { + ⋮ vis: Inherited, + ⋮ ident: "S", + ⋮ generics: Generics, + ⋮ data: Data::Struct { + ⋮ fields: Fields::Unnamed { + ⋮ unnamed: [ + ⋮ Field { + ⋮ vis: Inherited, + ⋮ ty: Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "crate", + ⋮ arguments: None, + ⋮ }, + ⋮ PathSegment { + ⋮ ident: "X", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ semi_token: Some, + ⋮ }, + ⋮} + "###); +} diff -Nru cargo-0.35.0/vendor/syn/tests/test_expr.rs cargo-0.37.0/vendor/syn/tests/test_expr.rs --- cargo-0.35.0/vendor/syn/tests/test_expr.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/test_expr.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,16 @@ +extern crate proc_macro2; +extern crate syn; + +use std::str::FromStr; + +use proc_macro2::TokenStream; +use syn::{Expr, ExprRange}; + +#[test] +fn test_expr_parse() { + let code = "..100u32"; + let tt = TokenStream::from_str(code).unwrap(); + let expr: Expr = syn::parse2(tt.clone()).unwrap(); + let expr_range: ExprRange = syn::parse2(tt).unwrap(); + assert_eq!(expr, Expr::Range(expr_range)); +} diff -Nru cargo-0.35.0/vendor/syn/tests/test_generics.rs cargo-0.37.0/vendor/syn/tests/test_generics.rs --- cargo-0.35.0/vendor/syn/tests/test_generics.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/test_generics.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,288 @@ +extern crate quote; +extern crate syn; + +mod features; + +#[macro_use] +mod macros; + +use quote::quote; +use syn::{DeriveInput, ItemFn, TypeParamBound, WhereClause, WherePredicate}; + +#[test] +fn test_split_for_impl() { + let input = quote! { + struct S<'a, 'b: 'a, #[may_dangle] T: 'a = ()> where T: Debug; + }; + + snapshot!(input as DeriveInput, @r###" + ⋮DeriveInput { + ⋮ vis: Inherited, + ⋮ ident: "S", + ⋮ generics: Generics { + ⋮ lt_token: Some, + ⋮ params: [ + ⋮ Lifetime(LifetimeDef { + ⋮ lifetime: Lifetime { + ⋮ ident: "a", + ⋮ }, + ⋮ }), + ⋮ Lifetime(LifetimeDef { + ⋮ lifetime: Lifetime { + ⋮ ident: "b", + ⋮ }, + ⋮ colon_token: Some, + ⋮ bounds: [ + ⋮ Lifetime { + ⋮ ident: "a", + ⋮ }, + ⋮ ], + ⋮ }), + ⋮ Type(TypeParam { + ⋮ attrs: [ + ⋮ Attribute { + ⋮ style: Outer, + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "may_dangle", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ tts: ``, + ⋮ }, + ⋮ ], + ⋮ ident: "T", + ⋮ colon_token: Some, + ⋮ bounds: [ + ⋮ Lifetime(Lifetime { + ⋮ ident: "a", + ⋮ }), + ⋮ ], + ⋮ eq_token: Some, + ⋮ default: Some(Type::Tuple), + ⋮ }), + ⋮ ], + ⋮ gt_token: Some, + ⋮ where_clause: Some(WhereClause { + ⋮ predicates: [ + ⋮ Type(PredicateType { + ⋮ bounded_ty: Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "T", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ bounds: [ + ⋮ Trait(TraitBound { + ⋮ modifier: None, + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "Debug", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }), + ⋮ ], + ⋮ }), + ⋮ ], + ⋮ }), + ⋮ }, + ⋮ data: Data::Struct { + ⋮ fields: Unit, + ⋮ semi_token: Some, + ⋮ }, + ⋮} + "###); + + let generics = input.generics; + let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + + let generated = quote! { + impl #impl_generics MyTrait for Test #ty_generics #where_clause {} + }; + let expected = quote! { + impl<'a, 'b: 'a, #[may_dangle] T: 'a> MyTrait + for Test<'a, 'b, T> + where + T: Debug + {} + }; + assert_eq!(generated.to_string(), expected.to_string()); + + let turbofish = ty_generics.as_turbofish(); + let generated = quote! { + Test #turbofish + }; + let expected = quote! { + Test::<'a, 'b, T> + }; + assert_eq!(generated.to_string(), expected.to_string()); +} + +#[test] +fn test_ty_param_bound() { + let tokens = quote!('a); + snapshot!(tokens as TypeParamBound, @r###" + ⋮Lifetime(Lifetime { + ⋮ ident: "a", + ⋮}) + "###); + + let tokens = quote!('_); + snapshot!(tokens as TypeParamBound, @r###" + ⋮Lifetime(Lifetime { + ⋮ ident: "_", + ⋮}) + "###); + + let tokens = quote!(Debug); + snapshot!(tokens as TypeParamBound, @r###" + ⋮Trait(TraitBound { + ⋮ modifier: None, + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "Debug", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮}) + "###); + + let tokens = quote!(?Sized); + snapshot!(tokens as TypeParamBound, @r###" + ⋮Trait(TraitBound { + ⋮ modifier: Maybe, + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "Sized", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮}) + "###); +} + +#[test] +fn test_fn_precedence_in_where_clause() { + // This should parse as two separate bounds, `FnOnce() -> i32` and `Send` - not + // `FnOnce() -> (i32 + Send)`. + let input = quote! { + fn f() + where + G: FnOnce() -> i32 + Send, + { + } + }; + + snapshot!(input as ItemFn, @r###" + ⋮ItemFn { + ⋮ vis: Inherited, + ⋮ ident: "f", + ⋮ decl: FnDecl { + ⋮ generics: Generics { + ⋮ lt_token: Some, + ⋮ params: [ + ⋮ Type(TypeParam { + ⋮ ident: "G", + ⋮ }), + ⋮ ], + ⋮ gt_token: Some, + ⋮ where_clause: Some(WhereClause { + ⋮ predicates: [ + ⋮ Type(PredicateType { + ⋮ bounded_ty: Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "G", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ bounds: [ + ⋮ Trait(TraitBound { + ⋮ modifier: None, + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "FnOnce", + ⋮ arguments: PathArguments::Parenthesized { + ⋮ output: Type( + ⋮ Type::Path { + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "i32", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }, + ⋮ ), + ⋮ }, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }), + ⋮ Trait(TraitBound { + ⋮ modifier: None, + ⋮ path: Path { + ⋮ segments: [ + ⋮ PathSegment { + ⋮ ident: "Send", + ⋮ arguments: None, + ⋮ }, + ⋮ ], + ⋮ }, + ⋮ }), + ⋮ ], + ⋮ }), + ⋮ ], + ⋮ }), + ⋮ }, + ⋮ output: Default, + ⋮ }, + ⋮ block: Block, + ⋮} + "###); + + let where_clause = input.decl.generics.where_clause.as_ref().unwrap(); + assert_eq!(where_clause.predicates.len(), 1); + + let predicate = match &where_clause.predicates[0] { + WherePredicate::Type(pred) => pred, + _ => panic!("wrong predicate kind"), + }; + + assert_eq!(predicate.bounds.len(), 2, "{:#?}", predicate.bounds); + + let first_bound = &predicate.bounds[0]; + assert_eq!(quote!(#first_bound).to_string(), "FnOnce ( ) -> i32"); + + let second_bound = &predicate.bounds[1]; + assert_eq!(quote!(#second_bound).to_string(), "Send"); +} + +#[test] +fn test_where_clause_at_end_of_input() { + let input = quote! { + where + }; + + snapshot!(input as WhereClause, @"WhereClause"); + + assert_eq!(input.predicates.len(), 0); +} diff -Nru cargo-0.35.0/vendor/syn/tests/test_grouping.rs cargo-0.37.0/vendor/syn/tests/test_grouping.rs --- cargo-0.35.0/vendor/syn/tests/test_grouping.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/test_grouping.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,58 @@ +extern crate proc_macro2; +extern crate syn; + +mod features; + +#[macro_use] +mod macros; + +use proc_macro2::{Delimiter, Group, Literal, Punct, Spacing, TokenStream, TokenTree}; +use syn::Expr; + +use std::iter::FromIterator; + +#[test] +fn test_grouping() { + let tokens: TokenStream = TokenStream::from_iter(vec![ + TokenTree::Literal(Literal::i32_suffixed(1)), + TokenTree::Punct(Punct::new('+', Spacing::Alone)), + TokenTree::Group(Group::new( + Delimiter::None, + TokenStream::from_iter(vec![ + TokenTree::Literal(Literal::i32_suffixed(2)), + TokenTree::Punct(Punct::new('+', Spacing::Alone)), + TokenTree::Literal(Literal::i32_suffixed(3)), + ]), + )), + TokenTree::Punct(Punct::new('*', Spacing::Alone)), + TokenTree::Literal(Literal::i32_suffixed(4)), + ]); + + assert_eq!(tokens.to_string(), "1i32 + 2i32 + 3i32 * 4i32"); + + snapshot!(tokens as Expr, @r###" + ⋮Expr::Binary { + ⋮ left: Expr::Lit { + ⋮ lit: 1, + ⋮ }, + ⋮ op: Add, + ⋮ right: Expr::Binary { + ⋮ left: Expr::Group { + ⋮ expr: Expr::Binary { + ⋮ left: Expr::Lit { + ⋮ lit: 2, + ⋮ }, + ⋮ op: Add, + ⋮ right: Expr::Lit { + ⋮ lit: 3, + ⋮ }, + ⋮ }, + ⋮ }, + ⋮ op: Mul, + ⋮ right: Expr::Lit { + ⋮ lit: 4, + ⋮ }, + ⋮ }, + ⋮} + "###); +} diff -Nru cargo-0.35.0/vendor/syn/tests/test_ident.rs cargo-0.37.0/vendor/syn/tests/test_ident.rs --- cargo-0.35.0/vendor/syn/tests/test_ident.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/test_ident.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,90 @@ +extern crate proc_macro2; +extern crate syn; + +mod features; + +use proc_macro2::{Ident, Span, TokenStream}; +use std::str::FromStr; +use syn::Result; + +fn parse(s: &str) -> Result { + syn::parse2(TokenStream::from_str(s).unwrap()) +} + +fn new(s: &str) -> Ident { + Ident::new(s, Span::call_site()) +} + +#[test] +fn ident_parse() { + parse("String").unwrap(); +} + +#[test] +fn ident_parse_keyword() { + parse("abstract").unwrap_err(); +} + +#[test] +fn ident_parse_empty() { + parse("").unwrap_err(); +} + +#[test] +fn ident_parse_lifetime() { + parse("'static").unwrap_err(); +} + +#[test] +fn ident_parse_underscore() { + parse("_").unwrap_err(); +} + +#[test] +fn ident_parse_number() { + parse("255").unwrap_err(); +} + +#[test] +fn ident_parse_invalid() { + parse("a#").unwrap_err(); +} + +#[test] +fn ident_new() { + new("String"); +} + +#[test] +fn ident_new_keyword() { + new("abstract"); +} + +#[test] +#[should_panic(expected = "use Option")] +fn ident_new_empty() { + new(""); +} + +#[test] +#[should_panic(expected = "not a valid Ident")] +fn ident_new_lifetime() { + new("'static"); +} + +#[test] +fn ident_new_underscore() { + new("_"); +} + +#[test] +#[should_panic(expected = "use Literal instead")] +fn ident_new_number() { + new("255"); +} + +#[test] +#[should_panic(expected = "\"a#\" is not a valid Ident")] +fn ident_new_invalid() { + new("a#"); +} diff -Nru cargo-0.35.0/vendor/syn/tests/test_lit.rs cargo-0.37.0/vendor/syn/tests/test_lit.rs --- cargo-0.35.0/vendor/syn/tests/test_lit.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/test_lit.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,190 @@ +extern crate proc_macro2; +extern crate quote; +extern crate syn; + +mod features; + +use proc_macro2::{TokenStream, TokenTree}; +use quote::ToTokens; +use std::str::FromStr; +use syn::{FloatSuffix, IntSuffix, Lit}; + +fn lit(s: &str) -> Lit { + match TokenStream::from_str(s) + .unwrap() + .into_iter() + .next() + .unwrap() + { + TokenTree::Literal(lit) => Lit::new(lit), + _ => panic!(), + } +} + +#[test] +fn strings() { + fn test_string(s: &str, value: &str) { + match lit(s) { + Lit::Str(lit) => { + assert_eq!(lit.value(), value); + let again = lit.into_token_stream().to_string(); + if again != s { + test_string(&again, value); + } + } + wrong => panic!("{:?}", wrong), + } + } + + test_string("\"a\"", "a"); + test_string("\"\\n\"", "\n"); + test_string("\"\\r\"", "\r"); + test_string("\"\\t\"", "\t"); + test_string("\"🐕\"", "🐕"); // NOTE: This is an emoji + test_string("\"\\\"\"", "\""); + test_string("\"'\"", "'"); + test_string("\"\"", ""); + test_string("\"\\u{1F415}\"", "\u{1F415}"); + test_string( + "\"contains\nnewlines\\\nescaped newlines\"", + "contains\nnewlinesescaped newlines", + ); + test_string("r\"raw\nstring\\\nhere\"", "raw\nstring\\\nhere"); +} + +#[test] +fn byte_strings() { + fn test_byte_string(s: &str, value: &[u8]) { + match lit(s) { + Lit::ByteStr(lit) => { + assert_eq!(lit.value(), value); + let again = lit.into_token_stream().to_string(); + if again != s { + test_byte_string(&again, value); + } + } + wrong => panic!("{:?}", wrong), + } + } + + test_byte_string("b\"a\"", b"a"); + test_byte_string("b\"\\n\"", b"\n"); + test_byte_string("b\"\\r\"", b"\r"); + test_byte_string("b\"\\t\"", b"\t"); + test_byte_string("b\"\\\"\"", b"\""); + test_byte_string("b\"'\"", b"'"); + test_byte_string("b\"\"", b""); + test_byte_string( + "b\"contains\nnewlines\\\nescaped newlines\"", + b"contains\nnewlinesescaped newlines", + ); + test_byte_string("br\"raw\nstring\\\nhere\"", b"raw\nstring\\\nhere"); +} + +#[test] +fn bytes() { + fn test_byte(s: &str, value: u8) { + match lit(s) { + Lit::Byte(lit) => { + assert_eq!(lit.value(), value); + let again = lit.into_token_stream().to_string(); + assert_eq!(again, s); + } + wrong => panic!("{:?}", wrong), + } + } + + test_byte("b'a'", b'a'); + test_byte("b'\\n'", b'\n'); + test_byte("b'\\r'", b'\r'); + test_byte("b'\\t'", b'\t'); + test_byte("b'\\''", b'\''); + test_byte("b'\"'", b'"'); +} + +#[test] +fn chars() { + fn test_char(s: &str, value: char) { + match lit(s) { + Lit::Char(lit) => { + assert_eq!(lit.value(), value); + let again = lit.into_token_stream().to_string(); + if again != s { + test_char(&again, value); + } + } + wrong => panic!("{:?}", wrong), + } + } + + test_char("'a'", 'a'); + test_char("'\\n'", '\n'); + test_char("'\\r'", '\r'); + test_char("'\\t'", '\t'); + test_char("'🐕'", '🐕'); // NOTE: This is an emoji + test_char("'\\''", '\''); + test_char("'\"'", '"'); + test_char("'\\u{1F415}'", '\u{1F415}'); +} + +#[test] +fn ints() { + fn test_int(s: &str, value: u64, suffix: IntSuffix) { + match lit(s) { + Lit::Int(lit) => { + assert_eq!(lit.value(), value); + assert_eq!(lit.suffix(), suffix); + let again = lit.into_token_stream().to_string(); + if again != s { + test_int(&again, value, suffix); + } + } + wrong => panic!("{:?}", wrong), + } + } + + use syn::IntSuffix::*; + test_int("5", 5, None); + test_int("5u32", 5, U32); + test_int("5_0", 50, None); + test_int("5_____0_____", 50, None); + test_int("0x7f", 127, None); + test_int("0x7F", 127, None); + test_int("0b1001", 9, None); + test_int("0o73", 59, None); + test_int("0x7Fu8", 127, U8); + test_int("0b1001i8", 9, I8); + test_int("0o73u32", 59, U32); + test_int("0x__7___f_", 127, None); + test_int("0x__7___F_", 127, None); + test_int("0b_1_0__01", 9, None); + test_int("0o_7__3", 59, None); + test_int("0x_7F__u8", 127, U8); + test_int("0b__10__0_1i8", 9, I8); + test_int("0o__7__________________3u32", 59, U32); +} + +#[test] +fn floats() { + #[cfg_attr(feature = "cargo-clippy", allow(float_cmp))] + fn test_float(s: &str, value: f64, suffix: FloatSuffix) { + match lit(s) { + Lit::Float(lit) => { + assert_eq!(lit.value(), value); + assert_eq!(lit.suffix(), suffix); + let again = lit.into_token_stream().to_string(); + if again != s { + test_float(&again, value, suffix); + } + } + wrong => panic!("{:?}", wrong), + } + } + + use syn::FloatSuffix::*; + test_float("5.5", 5.5, None); + test_float("5.5E12", 5.5e12, None); + test_float("5.5e12", 5.5e12, None); + test_float("1.0__3e-12", 1.03e-12, None); + test_float("1.03e+12", 1.03e12, None); +} diff -Nru cargo-0.35.0/vendor/syn/tests/test_meta.rs cargo-0.37.0/vendor/syn/tests/test_meta.rs --- cargo-0.35.0/vendor/syn/tests/test_meta.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/test_meta.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,180 @@ +extern crate syn; + +mod features; + +#[macro_use] +mod macros; + +use syn::{Meta, MetaList, MetaNameValue, NestedMeta}; + +#[test] +fn test_parse_meta_item_word() { + let input = "hello"; + + snapshot!(input as Meta, @r###"Word("hello")"###); +} + +#[test] +fn test_parse_meta_name_value() { + let input = "foo = 5"; + let (inner, meta) = (input, input); + + snapshot!(inner as MetaNameValue, @r###" + ⋮MetaNameValue { + ⋮ ident: "foo", + ⋮ lit: 5, + ⋮} + "###); + + snapshot!(meta as Meta, @r###" + ⋮Meta::NameValue { + ⋮ ident: "foo", + ⋮ lit: 5, + ⋮} + "###); + + assert_eq!(meta, inner.into()); +} + +#[test] +fn test_parse_meta_name_value_with_keyword() { + let input = "static = 5"; + let (inner, meta) = (input, input); + + snapshot!(inner as MetaNameValue, @r###" + ⋮MetaNameValue { + ⋮ ident: "static", + ⋮ lit: 5, + ⋮} + "###); + + snapshot!(meta as Meta, @r###" + ⋮Meta::NameValue { + ⋮ ident: "static", + ⋮ lit: 5, + ⋮} + "###); + + assert_eq!(meta, inner.into()); +} + +#[test] +fn test_parse_meta_name_value_with_bool() { + let input = "true = 5"; + let (inner, meta) = (input, input); + + snapshot!(inner as MetaNameValue, @r###" + ⋮MetaNameValue { + ⋮ ident: "true", + ⋮ lit: 5, + ⋮} + "###); + + snapshot!(meta as Meta, @r###" + ⋮Meta::NameValue { + ⋮ ident: "true", + ⋮ lit: 5, + ⋮} + "###); + + assert_eq!(meta, inner.into()); +} + +#[test] +fn test_parse_meta_item_list_lit() { + let input = "foo(5)"; + let (inner, meta) = (input, input); + + snapshot!(inner as MetaList, @r###" + ⋮MetaList { + ⋮ ident: "foo", + ⋮ nested: [ + ⋮ Literal(5), + ⋮ ], + ⋮} + "###); + + snapshot!(meta as Meta, @r###" + ⋮Meta::List { + ⋮ ident: "foo", + ⋮ nested: [ + ⋮ Literal(5), + ⋮ ], + ⋮} + "###); + + assert_eq!(meta, inner.into()); +} + +#[test] +fn test_parse_meta_item_multiple() { + let input = "foo(word, name = 5, list(name2 = 6), word2)"; + let (inner, meta) = (input, input); + + snapshot!(inner as MetaList, @r###" + ⋮MetaList { + ⋮ ident: "foo", + ⋮ nested: [ + ⋮ Meta(Word("word")), + ⋮ Meta(Meta::NameValue { + ⋮ ident: "name", + ⋮ lit: 5, + ⋮ }), + ⋮ Meta(Meta::List { + ⋮ ident: "list", + ⋮ nested: [ + ⋮ Meta(Meta::NameValue { + ⋮ ident: "name2", + ⋮ lit: 6, + ⋮ }), + ⋮ ], + ⋮ }), + ⋮ Meta(Word("word2")), + ⋮ ], + ⋮} + "###); + + snapshot!(meta as Meta, @r###" + ⋮Meta::List { + ⋮ ident: "foo", + ⋮ nested: [ + ⋮ Meta(Word("word")), + ⋮ Meta(Meta::NameValue { + ⋮ ident: "name", + ⋮ lit: 5, + ⋮ }), + ⋮ Meta(Meta::List { + ⋮ ident: "list", + ⋮ nested: [ + ⋮ Meta(Meta::NameValue { + ⋮ ident: "name2", + ⋮ lit: 6, + ⋮ }), + ⋮ ], + ⋮ }), + ⋮ Meta(Word("word2")), + ⋮ ], + ⋮} + "###); + + assert_eq!(meta, inner.into()); +} + +#[test] +fn test_parse_nested_meta() { + let input = "5"; + snapshot!(input as NestedMeta, @"Literal(5)"); + + let input = "list(name2 = 6)"; + snapshot!(input as NestedMeta, @r###" + ⋮Meta(Meta::List { + ⋮ ident: "list", + ⋮ nested: [ + ⋮ Meta(Meta::NameValue { + ⋮ ident: "name2", + ⋮ lit: 6, + ⋮ }), + ⋮ ], + ⋮}) + "###); +} diff -Nru cargo-0.35.0/vendor/syn/tests/test_parse_buffer.rs cargo-0.37.0/vendor/syn/tests/test_parse_buffer.rs --- cargo-0.35.0/vendor/syn/tests/test_parse_buffer.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/test_parse_buffer.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,55 @@ +#[macro_use] +extern crate syn; + +use syn::parse::{discouraged::Speculative, Parse, ParseStream, Parser, Result}; + +#[test] +#[should_panic(expected = "Fork was not derived from the advancing parse stream")] +fn smuggled_speculative_cursor_between_sources() { + struct BreakRules; + impl Parse for BreakRules { + fn parse(input1: ParseStream) -> Result { + let nested = |input2: ParseStream| { + input1.advance_to(&input2); + Ok(Self) + }; + nested.parse_str("") + } + } + + syn::parse_str::("").unwrap(); +} + +#[test] +#[should_panic(expected = "Fork was not derived from the advancing parse stream")] +fn smuggled_speculative_cursor_between_brackets() { + struct BreakRules; + impl Parse for BreakRules { + fn parse(input: ParseStream) -> Result { + let a; + let b; + parenthesized!(a in input); + parenthesized!(b in input); + a.advance_to(&b); + Ok(Self) + } + } + + syn::parse_str::("()()").unwrap(); +} + +#[test] +#[should_panic(expected = "Fork was not derived from the advancing parse stream")] +fn smuggled_speculative_cursor_into_brackets() { + struct BreakRules; + impl Parse for BreakRules { + fn parse(input: ParseStream) -> Result { + let a; + parenthesized!(a in input); + input.advance_to(&a); + Ok(Self) + } + } + + syn::parse_str::("()").unwrap(); +} diff -Nru cargo-0.35.0/vendor/syn/tests/test_pat.rs cargo-0.37.0/vendor/syn/tests/test_pat.rs --- cargo-0.35.0/vendor/syn/tests/test_pat.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/test_pat.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,23 @@ +extern crate quote; +extern crate syn; + +mod features; + +use quote::quote; +use syn::Pat; + +#[test] +fn test_pat_ident() { + match syn::parse2(quote!(self)).unwrap() { + Pat::Ident(_) => (), + value => panic!("expected PatIdent, got {:?}", value), + } +} + +#[test] +fn test_pat_path() { + match syn::parse2(quote!(self::CONST)).unwrap() { + Pat::Path(_) => (), + value => panic!("expected PatPath, got {:?}", value), + } +} diff -Nru cargo-0.35.0/vendor/syn/tests/test_precedence.rs cargo-0.37.0/vendor/syn/tests/test_precedence.rs --- cargo-0.35.0/vendor/syn/tests/test_precedence.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/test_precedence.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,385 @@ +#![cfg(not(syn_disable_nightly_tests))] +#![recursion_limit = "1024"] +#![feature(rustc_private)] + +//! The tests in this module do the following: +//! +//! 1. Parse a given expression in both `syn` and `libsyntax`. +//! 2. Fold over the expression adding brackets around each subexpression (with +//! some complications - see the `syn_brackets` and `libsyntax_brackets` +//! methods). +//! 3. Serialize the `syn` expression back into a string, and re-parse it with +//! `libsyntax`. +//! 4. Respan all of the expressions, replacing the spans with the default +//! spans. +//! 5. Compare the expressions with one another, if they are not equal fail. + +extern crate quote; +extern crate rayon; +extern crate regex; +extern crate rustc_data_structures; +extern crate smallvec; +extern crate syn; +extern crate syntax; +extern crate syntax_pos; +extern crate walkdir; + +mod features; + +use quote::quote; +use rayon::iter::{IntoParallelIterator, ParallelIterator}; +use regex::Regex; +use smallvec::smallvec; +use syntax::ast; +use syntax::ptr::P; +use syntax_pos::edition::Edition; +use walkdir::{DirEntry, WalkDir}; + +use std::fs::File; +use std::io::Read; +use std::process; +use std::sync::atomic::{AtomicUsize, Ordering}; + +use common::eq::SpanlessEq; +use common::parse; + +#[macro_use] +mod macros; + +#[allow(dead_code)] +mod common; + +/// Test some pre-set expressions chosen by us. +#[test] +fn test_simple_precedence() { + const EXPRS: &[&str] = &[ + "1 + 2 * 3 + 4", + "1 + 2 * ( 3 + 4 )", + "{ for i in r { } *some_ptr += 1; }", + "{ loop { break 5; } }", + "{ if true { () }.mthd() }", + "{ for i in unsafe { 20 } { } }", + ]; + + let mut failed = 0; + + for input in EXPRS { + let expr = if let Some(expr) = parse::syn_expr(input) { + expr + } else { + failed += 1; + continue; + }; + + let pf = match test_expressions(vec![expr]) { + (1, 0) => "passed", + (0, 1) => { + failed += 1; + "failed" + } + _ => unreachable!(), + }; + errorf!("=== {}: {}\n", input, pf); + } + + if failed > 0 { + panic!("Failed {} tests", failed); + } +} + +/// Test expressions from rustc, like in `test_round_trip`. +#[test] +#[cfg_attr(target_os = "windows", ignore = "requires nix .sh")] +fn test_rustc_precedence() { + common::clone_rust(); + let abort_after = common::abort_after(); + if abort_after == 0 { + panic!("Skipping all precedence tests"); + } + + let passed = AtomicUsize::new(0); + let failed = AtomicUsize::new(0); + + // 2018 edition is hard + let edition_regex = Regex::new(r"\b(async|try)[!(]").unwrap(); + + WalkDir::new("tests/rust") + .sort_by(|a, b| a.file_name().cmp(b.file_name())) + .into_iter() + .filter_entry(common::base_dir_filter) + .collect::, walkdir::Error>>() + .unwrap() + .into_par_iter() + .for_each(|entry| { + let path = entry.path(); + if path.is_dir() { + return; + } + + // Our version of `libsyntax` can't parse this tests + if path + .to_str() + .unwrap() + .ends_with("optional_comma_in_match_arm.rs") + { + return; + } + + let mut file = File::open(path).unwrap(); + let mut content = String::new(); + file.read_to_string(&mut content).unwrap(); + let content = edition_regex.replace_all(&content, "_$0"); + + let (l_passed, l_failed) = match syn::parse_file(&content) { + Ok(file) => { + let exprs = collect_exprs(file); + test_expressions(exprs) + } + Err(msg) => { + errorf!("syn failed to parse\n{:?}\n", msg); + (0, 1) + } + }; + + errorf!( + "=== {}: {} passed | {} failed\n", + path.display(), + l_passed, + l_failed + ); + + passed.fetch_add(l_passed, Ordering::SeqCst); + let prev_failed = failed.fetch_add(l_failed, Ordering::SeqCst); + + if prev_failed + l_failed >= abort_after { + process::exit(1); + } + }); + + let passed = passed.load(Ordering::SeqCst); + let failed = failed.load(Ordering::SeqCst); + + errorf!("\n===== Precedence Test Results =====\n"); + errorf!("{} passed | {} failed\n", passed, failed); + + if failed > 0 { + panic!("{} failures", failed); + } +} + +fn test_expressions(exprs: Vec) -> (usize, usize) { + let mut passed = 0; + let mut failed = 0; + + syntax::with_globals(Edition::Edition2018, || { + for expr in exprs { + let raw = quote!(#expr).to_string(); + + let libsyntax_ast = if let Some(e) = libsyntax_parse_and_rewrite(&raw) { + e + } else { + failed += 1; + errorf!("\nFAIL - libsyntax failed to parse raw\n"); + continue; + }; + + let syn_expr = syn_brackets(expr); + let syn_ast = if let Some(e) = parse::libsyntax_expr("e!(#syn_expr).to_string()) { + e + } else { + failed += 1; + errorf!("\nFAIL - libsyntax failed to parse bracketed\n"); + continue; + }; + + if SpanlessEq::eq(&syn_ast, &libsyntax_ast) { + passed += 1; + } else { + failed += 1; + errorf!("\nFAIL\n{:?}\n!=\n{:?}\n", syn_ast, libsyntax_ast); + } + } + }); + + (passed, failed) +} + +fn libsyntax_parse_and_rewrite(input: &str) -> Option> { + parse::libsyntax_expr(input).and_then(libsyntax_brackets) +} + +/// Wrap every expression which is not already wrapped in parens with parens, to +/// reveal the precidence of the parsed expressions, and produce a stringified +/// form of the resulting expression. +/// +/// This method operates on libsyntax objects. +fn libsyntax_brackets(mut libsyntax_expr: P) -> Option> { + use rustc_data_structures::thin_vec::ThinVec; + use smallvec::SmallVec; + use std::mem; + use syntax::ast::{AwaitOrigin, Expr, ExprKind, Field, Mac, Pat, Stmt, StmtKind, Ty}; + use syntax::mut_visit::{self, MutVisitor}; + use syntax_pos::DUMMY_SP; + + struct BracketsVisitor { + failed: bool, + }; + + impl BracketsVisitor { + fn recurse_expr(&mut self, e: &mut Expr) { + match e.node { + ExprKind::Await(AwaitOrigin::MacroLike, _) => { + // Syn sees await!() as macro and doesn't recurse inside, so + // skip it here too. + } + _ => mut_visit::noop_visit_expr(e, self), + } + } + } + + impl MutVisitor for BracketsVisitor { + fn visit_expr(&mut self, e: &mut P) { + self.recurse_expr(e); + match e.node { + ExprKind::If(..) | ExprKind::Block(..) | ExprKind::Let(..) => {} + _ => { + let inner = mem::replace( + e, + P(Expr { + id: ast::DUMMY_NODE_ID, + node: ExprKind::Err, + span: DUMMY_SP, + attrs: ThinVec::new(), + }), + ); + e.node = ExprKind::Paren(inner); + } + } + } + + fn visit_field(&mut self, f: &mut Field) { + if f.is_shorthand { + self.recurse_expr(&mut f.expr); + } else { + self.visit_expr(&mut f.expr); + } + } + + // We don't want to look at expressions that might appear in patterns or + // types yet. We'll look into comparing those in the future. For now + // focus on expressions appearing in other places. + fn visit_pat(&mut self, pat: &mut P) { + let _ = pat; + } + + fn visit_ty(&mut self, ty: &mut P) { + let _ = ty; + } + + fn flat_map_stmt(&mut self, stmt: Stmt) -> SmallVec<[Stmt; 1]> { + let node = match stmt.node { + // Don't wrap toplevel expressions in statements. + StmtKind::Expr(mut e) => { + self.recurse_expr(&mut e); + StmtKind::Expr(e) + } + StmtKind::Semi(mut e) => { + self.recurse_expr(&mut e); + StmtKind::Semi(e) + } + s => s, + }; + + smallvec![Stmt { node, ..stmt }] + } + + fn visit_mac(&mut self, mac: &mut Mac) { + // By default when folding over macros, libsyntax panics. This is + // because it's usually not what you want, you want to run after + // macro expansion. We do want to do that (syn doesn't do macro + // expansion), so we implement visit_mac to just return the macro + // unchanged. + let _ = mac; + } + } + + let mut folder = BracketsVisitor { failed: false }; + folder.visit_expr(&mut libsyntax_expr); + if folder.failed { + None + } else { + Some(libsyntax_expr) + } +} + +/// Wrap every expression which is not already wrapped in parens with parens, to +/// reveal the precedence of the parsed expressions, and produce a stringified +/// form of the resulting expression. +fn syn_brackets(syn_expr: syn::Expr) -> syn::Expr { + use syn::fold::*; + use syn::*; + + struct ParenthesizeEveryExpr; + impl Fold for ParenthesizeEveryExpr { + fn fold_expr(&mut self, expr: Expr) -> Expr { + match expr { + Expr::Group(_) => unreachable!(), + Expr::If(..) | Expr::Unsafe(..) | Expr::Block(..) | Expr::Let(..) => { + fold_expr(self, expr) + } + node => Expr::Paren(ExprParen { + attrs: Vec::new(), + expr: Box::new(fold_expr(self, node)), + paren_token: token::Paren::default(), + }), + } + } + + fn fold_stmt(&mut self, stmt: Stmt) -> Stmt { + match stmt { + // Don't wrap toplevel expressions in statements. + Stmt::Expr(e) => Stmt::Expr(fold_expr(self, e)), + Stmt::Semi(e, semi) => Stmt::Semi(fold_expr(self, e), semi), + s => s, + } + } + + // We don't want to look at expressions that might appear in patterns or + // types yet. We'll look into comparing those in the future. For now + // focus on expressions appearing in other places. + fn fold_pat(&mut self, pat: Pat) -> Pat { + pat + } + + fn fold_type(&mut self, ty: Type) -> Type { + ty + } + } + + let mut folder = ParenthesizeEveryExpr; + folder.fold_expr(syn_expr) +} + +/// Walk through a crate collecting all expressions we can find in it. +fn collect_exprs(file: syn::File) -> Vec { + use syn::fold::*; + use syn::punctuated::Punctuated; + use syn::*; + + struct CollectExprs(Vec); + impl Fold for CollectExprs { + fn fold_expr(&mut self, expr: Expr) -> Expr { + self.0.push(expr); + + Expr::Tuple(ExprTuple { + attrs: vec![], + elems: Punctuated::new(), + paren_token: token::Paren::default(), + }) + } + } + + let mut folder = CollectExprs(vec![]); + folder.fold_file(file); + folder.0 +} diff -Nru cargo-0.35.0/vendor/syn/tests/test_round_trip.rs cargo-0.37.0/vendor/syn/tests/test_round_trip.rs --- cargo-0.35.0/vendor/syn/tests/test_round_trip.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/test_round_trip.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,151 @@ +#![cfg(not(syn_disable_nightly_tests))] +#![recursion_limit = "1024"] +#![feature(rustc_private)] + +extern crate quote; +extern crate rayon; +extern crate syn; +extern crate syntax; +extern crate syntax_pos; +extern crate walkdir; + +mod features; + +use quote::quote; +use rayon::iter::{IntoParallelIterator, ParallelIterator}; +use syntax::ast; +use syntax::parse::{self, PResult, ParseSess}; +use syntax::source_map::FilePathMapping; +use syntax_pos::edition::Edition; +use syntax_pos::FileName; +use walkdir::{DirEntry, WalkDir}; + +use std::fs::File; +use std::io::Read; +use std::panic; +use std::process; +use std::sync::atomic::{AtomicUsize, Ordering}; +use std::time::Instant; + +#[macro_use] +mod macros; + +#[allow(dead_code)] +mod common; + +use common::eq::SpanlessEq; + +#[test] +#[cfg_attr(target_os = "windows", ignore = "requires nix .sh")] +fn test_round_trip() { + common::clone_rust(); + let abort_after = common::abort_after(); + if abort_after == 0 { + panic!("Skipping all round_trip tests"); + } + + let failed = AtomicUsize::new(0); + + WalkDir::new("tests/rust") + .sort_by(|a, b| a.file_name().cmp(b.file_name())) + .into_iter() + .filter_entry(common::base_dir_filter) + .collect::, walkdir::Error>>() + .unwrap() + .into_par_iter() + .for_each(|entry| { + let path = entry.path(); + if path.is_dir() { + return; + } + + let mut file = File::open(path).unwrap(); + let mut content = String::new(); + file.read_to_string(&mut content).unwrap(); + + let start = Instant::now(); + let (krate, elapsed) = match syn::parse_file(&content) { + Ok(krate) => (krate, start.elapsed()), + Err(msg) => { + errorf!("=== {}: syn failed to parse\n{:?}\n", path.display(), msg); + let prev_failed = failed.fetch_add(1, Ordering::SeqCst); + if prev_failed + 1 >= abort_after { + process::exit(1); + } + return; + } + }; + let back = quote!(#krate).to_string(); + + let equal = panic::catch_unwind(|| { + syntax::with_globals(Edition::Edition2018, || { + let sess = ParseSess::new(FilePathMapping::empty()); + let before = match libsyntax_parse(content, &sess) { + Ok(before) => before, + Err(mut diagnostic) => { + diagnostic.cancel(); + if diagnostic + .message() + .starts_with("file not found for module") + { + errorf!("=== {}: ignore\n", path.display()); + } else { + errorf!( + "=== {}: ignore - libsyntax failed to parse original content: {}\n", + path.display(), + diagnostic.message() + ); + } + return true; + } + }; + let after = match libsyntax_parse(back, &sess) { + Ok(after) => after, + Err(mut diagnostic) => { + errorf!("=== {}: libsyntax failed to parse", path.display()); + diagnostic.emit(); + return false; + } + }; + + if SpanlessEq::eq(&before, &after) { + errorf!( + "=== {}: pass in {}ms\n", + path.display(), + elapsed.as_secs() * 1000 + + u64::from(elapsed.subsec_nanos()) / 1_000_000 + ); + true + } else { + errorf!( + "=== {}: FAIL\nbefore: {:#?}\nafter: {:#?}\n", + path.display(), + before, + after, + ); + false + } + }) + }); + match equal { + Err(_) => errorf!("=== {}: ignoring libsyntax panic\n", path.display()), + Ok(true) => {} + Ok(false) => { + let prev_failed = failed.fetch_add(1, Ordering::SeqCst); + if prev_failed + 1 >= abort_after { + process::exit(1); + } + } + } + }); + + let failed = failed.load(Ordering::SeqCst); + if failed > 0 { + panic!("{} failures", failed); + } +} + +fn libsyntax_parse(content: String, sess: &ParseSess) -> PResult { + let name = FileName::Custom("test_round_trip".to_string()); + parse::parse_crate_from_source_str(name, content, sess) +} diff -Nru cargo-0.35.0/vendor/syn/tests/test_should_parse.rs cargo-0.37.0/vendor/syn/tests/test_should_parse.rs --- cargo-0.35.0/vendor/syn/tests/test_should_parse.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/test_should_parse.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,49 @@ +extern crate syn; + +mod features; + +macro_rules! should_parse { + ($name:ident, { $($in:tt)* }) => { + #[test] + fn $name() { + // Make sure we can parse the file! + syn::parse_file(stringify!($($in)*)).unwrap(); + } + } +} + +should_parse!(generic_associated_type, { + impl Foo { + type Item = &'a i32; + fn foo<'a>(&'a self) -> Self::Item<'a> {} + } +}); + +#[rustfmt::skip] +should_parse!(const_generics_use, { + type X = Foo<5>; + type Y = Foo<"foo">; + type Z = Foo; + type W = Foo<{ X + 10 }>; +}); + +should_parse!(trailing_plus_type, { + type A = Box; + type A = Box; + type A = Box<'a + Foo>; +}); + +should_parse!(generic_associated_type_where, { + trait Foo { + type Item; + fn foo(&self, t: T) -> Self::Item; + } +}); + +should_parse!(match_with_block_expr, { + fn main() { + match false { + _ => {}.a(), + } + } +}); diff -Nru cargo-0.35.0/vendor/syn/tests/test_token_trees.rs cargo-0.37.0/vendor/syn/tests/test_token_trees.rs --- cargo-0.35.0/vendor/syn/tests/test_token_trees.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/test_token_trees.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,32 @@ +extern crate proc_macro2; +extern crate quote; +extern crate syn; + +mod features; + +#[macro_use] +mod macros; + +use proc_macro2::TokenStream; +use quote::quote; +use syn::Lit; + +#[test] +fn test_struct() { + let input = " + #[derive(Debug, Clone)] + pub struct Item { + pub ident: Ident, + pub attrs: Vec, + } + "; + + snapshot!(input as TokenStream, @"`# [ derive ( Debug , Clone ) ] pub struct Item { pub ident : Ident , pub attrs : Vec < Attribute >, }`"); +} + +#[test] +fn test_literal_mangling() { + let code = "0_4"; + let parsed: Lit = syn::parse_str(code).unwrap(); + assert_eq!(code, quote!(#parsed).to_string()); +} diff -Nru cargo-0.35.0/vendor/syn/tests/zzz_stable.rs cargo-0.37.0/vendor/syn/tests/zzz_stable.rs --- cargo-0.35.0/vendor/syn/tests/zzz_stable.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/syn/tests/zzz_stable.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,35 @@ +#![cfg(syn_disable_nightly_tests)] + +extern crate termcolor; + +use std::io::{self, Write}; +use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor}; + +const MSG: &str = "\ +‖ +‖ WARNING: +‖ This is not a nightly compiler so not all tests were able to +‖ run. Syn includes tests that compare Syn's parser against the +‖ compiler's parser, which requires access to unstable libsyntax +‖ data structures and a nightly compiler. +‖ +"; + +#[test] +fn notice() -> io::Result<()> { + let header = "WARNING"; + let index_of_header = MSG.find(header).unwrap(); + let before = &MSG[..index_of_header]; + let after = &MSG[index_of_header + header.len()..]; + + let mut stderr = StandardStream::stderr(ColorChoice::Auto); + stderr.set_color(ColorSpec::new().set_fg(Some(Color::Yellow)))?; + write!(&mut stderr, "{}", before)?; + stderr.set_color(ColorSpec::new().set_bold(true).set_fg(Some(Color::Yellow)))?; + write!(&mut stderr, "{}", header)?; + stderr.set_color(ColorSpec::new().set_fg(Some(Color::Yellow)))?; + write!(&mut stderr, "{}", after)?; + stderr.reset()?; + + Ok(()) +} diff -Nru cargo-0.35.0/vendor/tar/.cargo-checksum.json cargo-0.37.0/vendor/tar/.cargo-checksum.json --- cargo-0.35.0/vendor/tar/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tar/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"7201214ded95b34e3bc00c9557b6dcec34fd1af428d343143f5db67c661762f0"} \ No newline at end of file +{"files":{},"package":"b3196bfbffbba3e57481b6ea32249fbaf590396a52505a2615adbb79d9d826d3"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/tar/Cargo.toml cargo-0.37.0/vendor/tar/Cargo.toml --- cargo-0.35.0/vendor/tar/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tar/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -13,7 +13,7 @@ [package] edition = "2018" name = "tar" -version = "0.4.25" +version = "0.4.26" authors = ["Alex Crichton "] exclude = ["tests/archives/*"] description = "A Rust implementation of a TAR file reader and writer. This library does not\ncurrently handle compression, but it is abstract over all I/O readers and\nwriters. Additionally, great lengths are taken to ensure that the entire\ncontents are never required to be entirely resident in memory all at once.\n" @@ -24,7 +24,7 @@ license = "MIT/Apache-2.0" repository = "https://github.com/alexcrichton/tar-rs" [dependencies.filetime] -version = "0.2" +version = "0.2.6" [dev-dependencies.tempdir] version = "0.3" diff -Nru cargo-0.35.0/vendor/tar/src/entry.rs cargo-0.37.0/vendor/tar/src/entry.rs --- cargo-0.35.0/vendor/tar/src/entry.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tar/src/entry.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,6 +1,7 @@ use std::borrow::Cow; use std::cmp; use std::fs; +use std::fs::OpenOptions; use std::io::prelude::*; use std::io::{self, Error, ErrorKind, SeekFrom}; use std::marker; @@ -46,6 +47,18 @@ Data(io::Take<&'a ArchiveInner>), } +/// When unpacking items the unpacked thing is returned to allow custom +/// additional handling by users. Today the File is returned, in future +/// the enum may be extended with kinds for links, directories etc. +#[derive(Debug)] +pub enum Unpacked { + /// A file was unpacked. + File(std::fs::File), + /// A directory, hardlink, symlink, or other node was unpacked. + #[doc(hidden)] + __Nonexhaustive, +} + impl<'a, R: Read> Entry<'a, R> { /// Returns the path name for this entry. /// @@ -177,7 +190,7 @@ /// file.unpack(format!("file-{}", i)).unwrap(); /// } /// ``` - pub fn unpack>(&mut self, dst: P) -> io::Result<()> { + pub fn unpack>(&mut self, dst: P) -> io::Result { self.fields.unpack(None, dst.as_ref()) } @@ -397,27 +410,30 @@ /// Unpack as destination directory `dst`. fn unpack_dir(&mut self, dst: &Path) -> io::Result<()> { // If the directory already exists just let it slide - let prev = fs::metadata(dst); - if prev.map(|m| m.is_dir()).unwrap_or(false) { - return Ok(()); - } - fs::create_dir(dst).map_err(|err| { - Error::new( + fs::create_dir(dst).or_else(|err| { + if err.kind() == ErrorKind::AlreadyExists { + let prev = fs::metadata(dst); + if prev.map(|m| m.is_dir()).unwrap_or(false) { + return Ok(()); + } + } + Err(Error::new( err.kind(), format!("{} when creating dir {}", err, dst.display()), - ) + )) }) } /// Returns access to the header of this entry in the archive. - fn unpack(&mut self, target_base: Option<&Path>, dst: &Path) -> io::Result<()> { + fn unpack(&mut self, target_base: Option<&Path>, dst: &Path) -> io::Result { let kind = self.header.entry_type(); if kind.is_dir() { - return self - .unpack_dir(dst) - .and_then(|_| self.header.mode()) - .and_then(|mode| set_perms(dst, mode, self.preserve_permissions)); + self.unpack_dir(dst)?; + if let Ok(mode) = self.header.mode() { + set_perms(dst, None, mode, self.preserve_permissions)?; + } + return Ok(Unpacked::__Nonexhaustive); } else if kind.is_hard_link() || kind.is_symlink() { let src = match self.link_name()? { Some(name) => name, @@ -436,7 +452,7 @@ ))); } - return if kind.is_hard_link() { + if kind.is_hard_link() { let link_src = match target_base { // If we're unpacking within a directory then ensure that // the destination of this hard link is both present and @@ -466,7 +482,7 @@ dst.display() ), ) - }) + })?; } else { symlink(&src, dst).map_err(|err| { Error::new( @@ -478,8 +494,9 @@ dst.display() ), ) - }) + })?; }; + return Ok(Unpacked::__Nonexhaustive); #[cfg(target_arch = "wasm32")] #[allow(unused_variables)] @@ -501,14 +518,18 @@ || kind.is_gnu_longname() || kind.is_gnu_longlink() { - return Ok(()); + return Ok(Unpacked::__Nonexhaustive); }; // Old BSD-tar compatibility. // Names that have a trailing slash should be treated as a directory. // Only applies to old headers. if self.header.as_ustar().is_none() && self.path_bytes().ends_with(b"/") { - return self.unpack_dir(dst); + self.unpack_dir(dst)?; + if let Ok(mode) = self.header.mode() { + set_perms(dst, None, mode, self.preserve_permissions)?; + } + return Ok(Unpacked::__Nonexhaustive); } // Note the lack of `else` clause above. According to the FreeBSD @@ -520,16 +541,23 @@ // As a result if we don't recognize the kind we just write out the file // as we would normally. - // Remove an existing file, if any, to avoid writing through - // symlinks/hardlinks to weird locations. The tar archive says this is a - // regular file, so let's make it a regular file. - (|| -> io::Result<()> { - match fs::remove_file(dst) { - Ok(()) => {} - Err(ref e) if e.kind() == io::ErrorKind::NotFound => {} - Err(e) => return Err(e), - } - let mut f = fs::File::create(dst)?; + // Ensure we write a new file rather than overwriting in-place which + // is attackable; if an existing file is found unlink it. + fn open(dst: &Path) -> io::Result { + OpenOptions::new().write(true).create_new(true).open(dst) + }; + let mut f = (|| -> io::Result { + let mut f = open(dst).or_else(|err| { + if err.kind() != ErrorKind::AlreadyExists { + Err(err) + } else { + match fs::remove_file(dst) { + Ok(()) => open(dst), + Err(ref e) if e.kind() == io::ErrorKind::NotFound => open(dst), + Err(e) => Err(e), + } + } + })?; for io in self.data.drain(..) { match io { EntryIo::Data(mut d) => { @@ -546,7 +574,7 @@ } } } - Ok(()) + Ok(f) })() .map_err(|e| { let header = self.header.path_bytes(); @@ -563,13 +591,26 @@ if self.preserve_mtime { if let Ok(mtime) = self.header.mtime() { let mtime = FileTime::from_unix_time(mtime as i64, 0); - filetime::set_file_times(dst, mtime, mtime).map_err(|e| { + filetime::set_file_handle_times(&f, Some(mtime), Some(mtime)).map_err(|e| { TarError::new(&format!("failed to set mtime for `{}`", dst.display()), e) })?; } } if let Ok(mode) = self.header.mode() { - set_perms(dst, mode, self.preserve_permissions).map_err(|e| { + set_perms(dst, Some(&mut f), mode, self.preserve_permissions)?; + } + if self.unpack_xattrs { + set_xattrs(self, dst)?; + } + return Ok(Unpacked::File(f)); + + fn set_perms( + dst: &Path, + f: Option<&mut std::fs::File>, + mode: u32, + preserve: bool, + ) -> Result<(), TarError> { + _set_perms(dst, f, mode, preserve).map_err(|e| { TarError::new( &format!( "failed to set permissions to {:o} \ @@ -579,32 +620,58 @@ ), e, ) - })?; - } - if self.unpack_xattrs { - set_xattrs(self, dst)?; + }) } - return Ok(()); #[cfg(any(unix, target_os = "redox"))] - fn set_perms(dst: &Path, mode: u32, preserve: bool) -> io::Result<()> { + fn _set_perms( + dst: &Path, + f: Option<&mut std::fs::File>, + mode: u32, + preserve: bool, + ) -> io::Result<()> { use std::os::unix::prelude::*; let mode = if preserve { mode } else { mode & 0o777 }; - let perm = fs::Permissions::from_mode(mode as _); - fs::set_permissions(dst, perm) + match f { + Some(f) => f.set_permissions(perm), + None => fs::set_permissions(dst, perm), + } } + #[cfg(windows)] - fn set_perms(dst: &Path, mode: u32, _preserve: bool) -> io::Result<()> { - let mut perm = r#try!(fs::metadata(dst)).permissions(); - perm.set_readonly(mode & 0o200 != 0o200); - fs::set_permissions(dst, perm) + fn _set_perms( + dst: &Path, + f: Option<&mut std::fs::File>, + mode: u32, + _preserve: bool, + ) -> io::Result<()> { + if mode & 0o200 == 0o200 { + return Ok(()); + } + match f { + Some(f) => { + let mut perm = f.metadata()?.permissions(); + perm.set_readonly(true); + f.set_permissions(perm) + } + None => { + let mut perm = fs::metadata(dst)?.permissions(); + perm.set_readonly(true); + fs::set_permissions(dst, perm) + } + } } #[cfg(target_arch = "wasm32")] #[allow(unused_variables)] - fn set_perms(dst: &Path, mode: u32, _preserve: bool) -> io::Result<()> { + fn _set_perms( + dst: &Path, + f: Option<&mut std::fs::File>, + mode: u32, + _preserve: bool, + ) -> io::Result<()> { Err(io::Error::new(io::ErrorKind::Other, "Not implemented")) } diff -Nru cargo-0.35.0/vendor/tar/src/lib.rs cargo-0.37.0/vendor/tar/src/lib.rs --- cargo-0.35.0/vendor/tar/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tar/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -25,7 +25,7 @@ pub use crate::archive::{Archive, Entries}; pub use crate::builder::Builder; -pub use crate::entry::Entry; +pub use crate::entry::{Entry, Unpacked}; pub use crate::entry_type::EntryType; pub use crate::header::GnuExtSparseHeader; pub use crate::header::{GnuHeader, GnuSparseHeader, Header, HeaderMode, OldHeader, UstarHeader}; diff -Nru cargo-0.35.0/vendor/tempfile/.cargo-checksum.json cargo-0.37.0/vendor/tempfile/.cargo-checksum.json --- cargo-0.35.0/vendor/tempfile/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tempfile/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"b86c784c88d98c801132806dadd3819ed29d8600836c4088e855cdf3e178ed8a"} \ No newline at end of file +{"files":{},"package":"7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/tempfile/Cargo.toml cargo-0.37.0/vendor/tempfile/Cargo.toml --- cargo-0.35.0/vendor/tempfile/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tempfile/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -11,21 +11,22 @@ # will likely look very different (and much more reasonable) [package] +edition = "2018" name = "tempfile" -version = "3.0.7" +version = "3.1.0" authors = ["Steven Allen ", "The Rust Project Developers", "Ashley Mannix ", "Jason White "] exclude = ["/.travis.yml", "/appveyor.yml"] -description = "A library for managing temporary files and directories.\n" +description = "A library for managing temporary files and directories." homepage = "http://stebalien.com/projects/tempfile-rs" documentation = "https://docs.rs/tempfile" keywords = ["tempfile", "tmpfile", "filesystem"] -license = "MIT/Apache-2.0" +license = "MIT OR Apache-2.0" repository = "https://github.com/Stebalien/tempfile" [dependencies.cfg-if] version = "0.1" [dependencies.rand] -version = "0.6" +version = "0.7" [dependencies.remove_dir_all] version = "0.5" @@ -35,4 +36,4 @@ version = "0.2.27" [target."cfg(windows)".dependencies.winapi] version = "0.3" -features = ["fileapi", "winbase", "handleapi"] +features = ["fileapi", "handleapi", "winbase"] diff -Nru cargo-0.35.0/vendor/tempfile/NEWS cargo-0.37.0/vendor/tempfile/NEWS --- cargo-0.35.0/vendor/tempfile/NEWS 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tempfile/NEWS 2019-07-17 05:42:23.000000000 +0000 @@ -1,3 +1,40 @@ +3.1.0 +===== + +Features: + +* Bump rand dependency to `0.7`. + +Breaking: The minimum rust version is now `1.32.0`. + +3.0.9 +===== + +Documentation: + +* Add an example for reopening a named temporary file. +* Flesh out the security documentation. + +Features: + +* Introduce an `append` option to the builder. +* Errors: + * No longer implement the soft-deprecated `description`. + * Implement `source` instead of `cause`. + +Breaking: The minimum rust version is now 1.30. + +3.0.8 +===== + +This is a bugfix release. + +Fixes: + +* Export `PathPersistError`. +* Fix a bug where flushing a `SpooledTempFile` to disk could fail to write part + of the file in some rare, yet-to-reproduced cases. + 3.0.7 ===== @@ -124,7 +161,7 @@ * Implement `AsRef` for `NamedTempFile` allowing named temporary files to be borrowed as `File`s. -* Add a method to convert a `NamedTempFile` to an unnamed temporary `File`. +* Add a method to convert a `NamedTempFile` to an unnamed temporary `File`. 2.0.1 ===== diff -Nru cargo-0.35.0/vendor/tempfile/README.md cargo-0.37.0/vendor/tempfile/README.md --- cargo-0.35.0/vendor/tempfile/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tempfile/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -15,7 +15,7 @@ Usage ----- -Minimum required Rust version: 1.24.0 +Minimum required Rust version: 1.32.0 Add this to your `Cargo.toml`: ```toml @@ -23,16 +23,10 @@ tempfile = "3" ``` -...and this to your crate root: -```rust -extern crate tempfile; -``` - Example ------- ```rust -extern crate tempfile; use std::fs::File; use std::io::{Write, Read, Seek, SeekFrom}; diff -Nru cargo-0.35.0/vendor/tempfile/src/dir.rs cargo-0.37.0/vendor/tempfile/src/dir.rs --- cargo-0.35.0/vendor/tempfile/src/dir.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tempfile/src/dir.rs 2019-07-17 05:42:23.000000000 +0000 @@ -12,8 +12,8 @@ use std::path::{self, Path, PathBuf}; use std::{fmt, fs, io}; -use error::IoResultExt; -use Builder; +use crate::error::IoResultExt; +use crate::Builder; /// Create a new temporary directory. /// @@ -33,7 +33,6 @@ /// # Examples /// /// ``` -/// # extern crate tempfile; /// use tempfile::tempdir; /// use std::fs::File; /// use std::io::{self, Write}; @@ -83,7 +82,6 @@ /// # Examples /// /// ``` -/// # extern crate tempfile; /// use tempfile::tempdir; /// use std::fs::File; /// use std::io::{self, Write}; @@ -385,7 +383,7 @@ } impl fmt::Debug for TempDir { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("TempDir") .field("path", &self.path()) .finish() diff -Nru cargo-0.35.0/vendor/tempfile/src/error.rs cargo-0.37.0/vendor/tempfile/src/error.rs --- cargo-0.35.0/vendor/tempfile/src/error.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tempfile/src/error.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,19 +8,14 @@ } impl fmt::Display for PathError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{} at path {:?}", self.err, self.path) } } impl error::Error for PathError { - fn description(&self) -> &str { - self.err.description() - } - - #[allow(deprecated)] - fn cause(&self) -> Option<&error::Error> { - self.err.cause() + fn source(&self) -> Option<&(dyn error::Error + 'static)> { + self.err.source() } } diff -Nru cargo-0.35.0/vendor/tempfile/src/file/imp/other.rs cargo-0.37.0/vendor/tempfile/src/file/imp/other.rs --- cargo-0.35.0/vendor/tempfile/src/file/imp/other.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tempfile/src/file/imp/other.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,12 +1,15 @@ -use std::path::Path; +use std::fs::{File, OpenOptions}; use std::io; -use std::fs::File; +use std::path::Path; fn not_supported() -> io::Result { - Err(io::Error::new(io::ErrorKind::Other, "operation not supported on this platform")) + Err(io::Error::new( + io::ErrorKind::Other, + "operation not supported on this platform", + )) } -pub fn create_named(_path: &Path) -> io::Result { +pub fn create_named(_path: &Path, open_options: &mut OpenOptions) -> io::Result { not_supported() } @@ -21,3 +24,7 @@ pub fn persist(_old_path: &Path, _new_path: &Path, _overwrite: bool) -> io::Result<()> { not_supported() } + +pub fn keep(path: &Path) -> io::Result<()> { + not_supported() +} diff -Nru cargo-0.35.0/vendor/tempfile/src/file/imp/unix.rs cargo-0.37.0/vendor/tempfile/src/file/imp/unix.rs --- cargo-0.35.0/vendor/tempfile/src/file/imp/unix.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tempfile/src/file/imp/unix.rs 2019-07-17 05:42:23.000000000 +0000 @@ -5,7 +5,7 @@ use std::os::unix::ffi::OsStrExt; use std::os::unix::fs::{MetadataExt, OpenOptionsExt}; use std::path::Path; -use util; +use crate::util; #[cfg(not(target_os = "redox"))] use libc::{c_char, c_int, link, rename, unlink}; @@ -32,8 +32,8 @@ .map_err(|_| io::Error::new(io::ErrorKind::InvalidInput, "path contained a null")) } -pub fn create_named(path: &Path) -> io::Result { - OpenOptions::new() +pub fn create_named(path: &Path, open_options: &mut OpenOptions) -> io::Result { + open_options .read(true) .write(true) .create_new(true) @@ -51,7 +51,7 @@ path = &tmp; } - let f = create_named(path)?; + let f = create_named(path, &mut OpenOptions::new())?; // don't care whether the path has already been unlinked, // but perhaps there are some IO error conditions we should send up? let _ = fs::remove_file(path); @@ -85,7 +85,7 @@ dir, OsStr::new(".tmp"), OsStr::new(""), - ::NUM_RAND_CHARS, + crate::NUM_RAND_CHARS, |path| create_unlinked(&path), ) } @@ -131,3 +131,7 @@ // XXX implement when possible Err(io::Error::from_raw_os_error(syscall::ENOSYS)) } + +pub fn keep(_: &Path) -> io::Result<()> { + Ok(()) +} diff -Nru cargo-0.35.0/vendor/tempfile/src/file/imp/windows.rs cargo-0.37.0/vendor/tempfile/src/file/imp/windows.rs --- cargo-0.35.0/vendor/tempfile/src/file/imp/windows.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tempfile/src/file/imp/windows.rs 2019-07-17 05:42:23.000000000 +0000 @@ -14,14 +14,14 @@ use winapi::um::winnt::{FILE_GENERIC_READ, FILE_GENERIC_WRITE, HANDLE}; use winapi::um::winnt::{FILE_SHARE_DELETE, FILE_SHARE_READ, FILE_SHARE_WRITE}; -use util; +use crate::util; fn to_utf16(s: &Path) -> Vec { s.as_os_str().encode_wide().chain(iter::once(0)).collect() } -pub fn create_named(path: &Path) -> io::Result { - OpenOptions::new() +pub fn create_named(path: &Path, open_options: &mut OpenOptions) -> io::Result { + open_options .create_new(true) .read(true) .write(true) @@ -34,7 +34,7 @@ dir, OsStr::new(".tmp"), OsStr::new(""), - ::NUM_RAND_CHARS, + crate::NUM_RAND_CHARS, |path| { OpenOptions::new() .create_new(true) @@ -63,6 +63,17 @@ } } } + +pub fn keep(path: &Path) -> io::Result<()> { + unsafe { + let path_w = to_utf16(path); + if SetFileAttributesW(path_w.as_ptr(), FILE_ATTRIBUTE_NORMAL) == 0 { + Err(io::Error::last_os_error()) + } else { + Ok(()) + } + } +} pub fn persist(old_path: &Path, new_path: &Path, overwrite: bool) -> io::Result<()> { // TODO: We should probably do this in one-shot using SetFileInformationByHandle but the API is diff -Nru cargo-0.35.0/vendor/tempfile/src/file/mod.rs cargo-0.37.0/vendor/tempfile/src/file/mod.rs --- cargo-0.35.0/vendor/tempfile/src/file/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tempfile/src/file/mod.rs 2019-07-17 05:42:23.000000000 +0000 @@ -3,14 +3,14 @@ use std::error; use std::ffi::OsStr; use std::fmt; -use std::fs::{self, File}; +use std::fs::{self, File, OpenOptions}; use std::io::{self, Read, Seek, SeekFrom, Write}; use std::mem; use std::ops::Deref; use std::path::{Path, PathBuf}; -use error::IoResultExt; -use Builder; +use crate::error::IoResultExt; +use crate::Builder; mod imp; @@ -34,7 +34,6 @@ /// # Examples /// /// ``` -/// # extern crate tempfile; /// use tempfile::tempfile; /// use std::io::{self, Write}; /// @@ -76,7 +75,6 @@ /// # Examples /// /// ``` -/// # extern crate tempfile; /// use tempfile::tempfile_in; /// use std::io::{self, Write}; /// @@ -123,17 +121,13 @@ } impl fmt::Display for PathPersistError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "failed to persist temporary file path: {}", self.error) } } impl error::Error for PathPersistError { - fn description(&self) -> &str { - "failed to persist temporary file path" - } - - fn cause(&self) -> Option<&error::Error> { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { Some(&self.error) } } @@ -160,7 +154,6 @@ /// # Examples /// /// ```no_run - /// # extern crate tempfile; /// # use std::io; /// use tempfile::NamedTempFile; /// @@ -212,7 +205,6 @@ /// /// ```no_run /// # use std::io::{self, Write}; - /// # extern crate tempfile; /// use tempfile::NamedTempFile; /// /// # fn main() { @@ -272,7 +264,6 @@ /// /// ```no_run /// # use std::io::{self, Write}; - /// # extern crate tempfile; /// use tempfile::NamedTempFile; /// /// # fn main() { @@ -310,10 +301,59 @@ }), } } + + /// Keep the temporary file from being deleted. This function will turn the + /// temporary file into a non-temporary file without moving it. + /// + /// + /// # Errors + /// + /// On some platforms (e.g., Windows), we need to mark the file as + /// non-temporary. This operation could fail. + /// + /// # Examples + /// + /// ```no_run + /// # use std::io::{self, Write}; + /// use tempfile::NamedTempFile; + /// + /// # fn main() { + /// # if let Err(_) = run() { + /// # ::std::process::exit(1); + /// # } + /// # } + /// # fn run() -> Result<(), io::Error> { + /// let mut file = NamedTempFile::new()?; + /// writeln!(file, "Brian was here. Briefly.")?; + /// + /// let path = file.into_temp_path(); + /// let path = path.keep()?; + /// # Ok(()) + /// # } + /// ``` + /// + /// [`PathPersistError`]: struct.PathPersistError.html + pub fn keep(mut self) -> Result { + match imp::keep(&self.path) { + Ok(_) => { + // Don't drop `self`. We don't want to try deleting the old + // temporary file path. (It'll fail, but the failure is never + // seen.) + let mut path = PathBuf::new(); + mem::swap(&mut self.path, &mut path); + mem::forget(self); + Ok(path) + } + Err(e) => Err(PathPersistError { + error: e, + path: self, + }), + } + } } impl fmt::Debug for TempPath { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.path.fmt(f) } } @@ -353,7 +393,63 @@ /// /// # Security /// -/// This variant is *NOT* secure/reliable in the presence of a pathological temporary file cleaner. +/// Most operating systems employ temporary file cleaners to delete old +/// temporary files. Unfortunately these temporary file cleaners don't always +/// reliably _detect_ whether the temporary file is still being used. +/// +/// Specifically, the following sequence of events can happen: +/// +/// 1. A user creates a temporary file with `NamedTempFile::new()`. +/// 2. Time passes. +/// 3. The temporary file cleaner deletes (unlinks) the temporary file from the +/// filesystem. +/// 4. Some other program creates a new file to replace this deleted temporary +/// file. +/// 5. The user tries to re-open the temporary file (in the same program or in a +/// different program) by path. Unfortunately, they'll end up opening the +/// file created by the other program, not the original file. +/// +/// ## Operating System Specific Concerns +/// +/// The behavior of temporary files and temporary file cleaners differ by +/// operating system. +/// +/// ### Windows +/// +/// On Windows, open files _can't_ be deleted. This removes most of the concerns +/// around temporary file cleaners. +/// +/// Furthermore, temporary files are, by default, created in per-user temporary +/// file directories so only an application running as the same user would be +/// able to interfere (which they could do anyways). However, an application +/// running as the same user can still _accidentally_ re-create deleted +/// temporary files if the number of random bytes in the temporary file name is +/// too small. +/// +/// So, the only real concern on Windows is: +/// +/// 1. Opening a named temporary file in a world-writable directory. +/// 2. Using the `into_temp_path()` and/or `into_parts()` APIs to close the file +/// handle without deleting the underlying file. +/// 3. Continuing to use the file by path. +/// +/// ### UNIX +/// +/// Unlike on Windows, UNIX (and UNIX like) systems allow open files to be +/// "unlinked" (deleted). +/// +/// #### MacOS +/// +/// Like on Windows, temporary files are created in per-user temporary file +/// directories by default so calling `NamedTempFile::new()` should be +/// relatively safe. +/// +/// #### Linux +/// +/// Unfortunately, most _Linux_ distributions don't create per-user temporary +/// file directories. Worse, systemd's tmpfiles daemon (a common temporary file +/// cleaner) will happily remove open temporary files if they haven't been +/// modified within the last 10 days. /// /// # Resource Leaking /// @@ -375,7 +471,7 @@ } impl fmt::Debug for NamedTempFile { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "NamedTempFile({:?})", self.path) } } @@ -411,16 +507,13 @@ } impl fmt::Display for PersistError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "failed to persist temporary file: {}", self.error) } } impl error::Error for PersistError { - fn description(&self) -> &str { - "failed to persist temporary file" - } - fn cause(&self) -> Option<&error::Error> { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { Some(&self.error) } } @@ -433,9 +526,9 @@ /// # Security /// /// This will create a temporary file in the default temporary file - /// directory (platform dependent). These directories are often patrolled by temporary file - /// cleaners so only use this method if you're *positive* that the temporary file cleaner won't - /// delete your file. + /// directory (platform dependent). This has security implications on many + /// platforms so please read the security section of this type's + /// documentation. /// /// Reasons to use this method: /// @@ -467,7 +560,6 @@ /// /// ```no_run /// # use std::io::{self, Write}; - /// # extern crate tempfile; /// use tempfile::NamedTempFile; /// /// # fn main() { @@ -501,15 +593,14 @@ /// /// # Security /// - /// Only use this method if you're positive that a - /// temporary file cleaner won't have deleted your file. Otherwise, the path - /// returned by this method may refer to an attacker controlled file. + /// Referring to a temporary file's path may not be secure in all cases. + /// Please read the security section on the top level documentation of this + /// type for details. /// /// # Examples /// /// ```no_run /// # use std::io::{self, Write}; - /// # extern crate tempfile; /// use tempfile::NamedTempFile; /// /// # fn main() { @@ -540,7 +631,6 @@ /// # Examples /// /// ```no_run - /// # extern crate tempfile; /// # use std::io; /// use tempfile::NamedTempFile; /// @@ -576,9 +666,9 @@ /// /// # Security /// - /// Only use this method if you're positive that a - /// temporary file cleaner won't have deleted your file. Otherwise, you - /// might end up persisting an attacker controlled file. + /// This method persists the temporary file using it's path and may not be + /// secure in the in all cases. Please read the security section on the top + /// level documentation of this type for details. /// /// # Errors /// @@ -588,7 +678,6 @@ /// /// ```no_run /// # use std::io::{self, Write}; - /// # extern crate tempfile; /// use tempfile::NamedTempFile; /// /// # fn main() { @@ -631,9 +720,9 @@ /// /// # Security /// - /// Only use this method if you're positive that a - /// temporary file cleaner won't have deleted your file. Otherwise, you - /// might end up persisting an attacker controlled file. + /// This method persists the temporary file using it's path and may not be + /// secure in the in all cases. Please read the security section on the top + /// level documentation of this type for details. /// /// # Errors /// @@ -644,7 +733,6 @@ /// /// ```no_run /// # use std::io::{self, Write}; - /// # extern crate tempfile; /// use tempfile::NamedTempFile; /// /// # fn main() { @@ -674,7 +762,48 @@ } } - /// Reopen the temporary file. + /// Keep the temporary file from being deleted. This function will turn the + /// temporary file into a non-temporary file without moving it. + /// + /// + /// # Errors + /// + /// On some platforms (e.g., Windows), we need to mark the file as + /// non-temporary. This operation could fail. + /// + /// # Examples + /// + /// ```no_run + /// # use std::io::{self, Write}; + /// use tempfile::NamedTempFile; + /// + /// # fn main() { + /// # if let Err(_) = run() { + /// # ::std::process::exit(1); + /// # } + /// # } + /// # fn run() -> Result<(), io::Error> { + /// let mut file = NamedTempFile::new()?; + /// writeln!(file, "Brian was here. Briefly.")?; + /// + /// let (file, path) = file.keep()?; + /// # Ok(()) + /// # } + /// ``` + /// + /// [`PathPersistError`]: struct.PathPersistError.html + pub fn keep(self) -> Result<(File, PathBuf), PersistError> { + let (file, path) = (self.file, self.path); + match path.keep() { + Ok(path) => Ok((file, path)), + Err(PathPersistError { error, path }) => Err(PersistError { + file: NamedTempFile { path, file }, + error, + }), + } + } + + /// Securely reopen the temporary file. /// /// This function is useful when you need multiple independent handles to /// the same file. It's perfectly fine to drop the original `NamedTempFile` @@ -685,11 +814,16 @@ /// /// If the file cannot be reopened, `Err` is returned. /// + /// # Security + /// + /// Unlike `File::open(my_temp_file.path())`, `NamedTempFile::reopen()` + /// guarantees that the re-opened file is the _same_ file, even in the + /// presence of pathological temporary file cleaners. + /// /// # Examples /// /// ```no_run /// # use std::io; - /// # extern crate tempfile; /// use tempfile::NamedTempFile; /// /// # fn main() { @@ -733,6 +867,14 @@ pub fn into_temp_path(self) -> TempPath { self.path } + + /// Converts the named temporary file into its constituent parts. + /// + /// Note: When the path is dropped, the file is deleted but the file handle + /// is still usable. + pub fn into_parts(self) -> (File, TempPath) { + (self.file, self.path) + } } impl Read for NamedTempFile { @@ -795,13 +937,16 @@ } } -pub(crate) fn create_named(mut path: PathBuf) -> io::Result { +pub(crate) fn create_named( + mut path: PathBuf, + open_options: &mut OpenOptions, +) -> io::Result { // Make the path absolute. Otherwise, changing directories could cause us to // delete the wrong file. if !path.is_absolute() { path = env::current_dir()?.join(path) } - imp::create_named(&path) + imp::create_named(&path, open_options) .with_err_path(|| path.clone()) .map(|file| NamedTempFile { path: TempPath { path }, diff -Nru cargo-0.35.0/vendor/tempfile/src/lib.rs cargo-0.37.0/vendor/tempfile/src/lib.rs --- cargo-0.35.0/vendor/tempfile/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tempfile/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -24,14 +24,14 @@ //! a temporary file cleaner could delete the temporary file which an attacker could then replace. //! //! `tempfile` doesn't rely on file paths so this isn't an issue. However, `NamedTempFile` does -//! rely on file paths. +//! rely on file paths for _some_ operations. See the security documentation on +//! the `NamedTempFile` type for more information. //! //! ## Examples //! //! Create a temporary file and write some data into it: //! //! ``` -//! # extern crate tempfile; //! use tempfile::tempfile; //! use std::io::{self, Write}; //! @@ -49,10 +49,40 @@ //! # } //! ``` //! +//! Create a named temporary file and open an independent file handle: +//! +//! ``` +//! use tempfile::NamedTempFile; +//! use std::io::{self, Write, Read}; +//! +//! # fn main() { +//! # if let Err(_) = run() { +//! # ::std::process::exit(1); +//! # } +//! # } +//! # fn run() -> Result<(), io::Error> { +//! let text = "Brian was here. Briefly."; +//! +//! // Create a file inside of `std::env::temp_dir()`. +//! let mut file1 = NamedTempFile::new()?; +//! +//! // Re-open it. +//! let mut file2 = file1.reopen()?; +//! +//! // Write some test data to the first handle. +//! file1.write_all(text.as_bytes())?; +//! +//! // Read the test data using the second handle. +//! let mut buf = String::new(); +//! file2.read_to_string(&mut buf)?; +//! assert_eq!(buf, text); +//! # Ok(()) +//! # } +//! ``` +//! //! Create a temporary directory and add a file to it: //! //! ``` -//! # extern crate tempfile; //! use tempfile::tempdir; //! use std::fs::File; //! use std::io::{self, Write}; @@ -90,28 +120,19 @@ #![doc( html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://www.rust-lang.org/favicon.ico", - html_root_url = "https://docs.rs/tempfile/2.2.0" + html_root_url = "https://docs.rs/tempfile/3.1.0" )] #![cfg_attr(test, deny(warnings))] +#![deny(rust_2018_idioms)] #[macro_use] extern crate cfg_if; -extern crate rand; -extern crate remove_dir_all; - -#[cfg(unix)] -extern crate libc; - -#[cfg(windows)] -extern crate winapi; - -#[cfg(target_os = "redox")] -extern crate syscall; const NUM_RETRIES: u32 = 1 << 31; const NUM_RAND_CHARS: usize = 6; use std::ffi::OsStr; +use std::fs::OpenOptions; use std::path::Path; use std::{env, io}; @@ -121,9 +142,9 @@ mod spooled; mod util; -pub use dir::{tempdir, tempdir_in, TempDir}; -pub use file::{tempfile, tempfile_in, NamedTempFile, PersistError, TempPath}; -pub use spooled::{spooled_tempfile, SpooledTempFile}; +pub use crate::dir::{tempdir, tempdir_in, TempDir}; +pub use crate::file::{tempfile, tempfile_in, NamedTempFile, PathPersistError, PersistError, TempPath}; +pub use crate::spooled::{spooled_tempfile, SpooledTempFile}; /// Create a new temporary file or directory with custom parameters. #[derive(Debug, Clone, Eq, PartialEq)] @@ -131,14 +152,16 @@ random_len: usize, prefix: &'a OsStr, suffix: &'b OsStr, + append: bool, } impl<'a, 'b> Default for Builder<'a, 'b> { fn default() -> Self { Builder { - random_len: ::NUM_RAND_CHARS, + random_len: crate::NUM_RAND_CHARS, prefix: OsStr::new(".tmp"), suffix: OsStr::new(""), + append: false, } } } @@ -151,7 +174,6 @@ /// Create a named temporary file and write some data into it: /// /// ``` - /// # extern crate tempfile; /// # use std::io; /// # use std::ffi::OsStr; /// # fn main() { @@ -184,7 +206,6 @@ /// Create a temporary directory and add a file to it: /// /// ``` - /// # extern crate tempfile; /// # use std::io::{self, Write}; /// # use std::fs::File; /// # use std::ffi::OsStr; @@ -227,7 +248,6 @@ /// # Examples /// /// ``` - /// # extern crate tempfile; /// # use std::io; /// # fn main() { /// # if let Err(_) = run() { @@ -255,7 +275,6 @@ /// # Examples /// /// ``` - /// # extern crate tempfile; /// # use std::io; /// # fn main() { /// # if let Err(_) = run() { @@ -282,7 +301,6 @@ /// # Examples /// /// ``` - /// # extern crate tempfile; /// # use std::io; /// # fn main() { /// # if let Err(_) = run() { @@ -302,6 +320,32 @@ self } + /// Set the file to be opened in append mode. + /// + /// Default: `false`. + /// + /// # Examples + /// + /// ``` + /// # use std::io; + /// # fn main() { + /// # if let Err(_) = run() { + /// # ::std::process::exit(1); + /// # } + /// # } + /// # fn run() -> Result<(), io::Error> { + /// # use tempfile::Builder; + /// let named_tempfile = Builder::new() + /// .append(true) + /// .tempfile()?; + /// # Ok(()) + /// # } + /// ``` + pub fn append(&mut self, append: bool) -> &mut Self { + self.append = append; + self + } + /// Create the named temporary file. /// /// # Security @@ -319,7 +363,6 @@ /// # Examples /// /// ``` - /// # extern crate tempfile; /// # use std::io; /// # fn main() { /// # if let Err(_) = run() { @@ -356,7 +399,6 @@ /// # Examples /// /// ``` - /// # extern crate tempfile; /// # use std::io; /// # fn main() { /// # if let Err(_) = run() { @@ -378,7 +420,7 @@ self.prefix, self.suffix, self.random_len, - file::create_named, + |path| file::create_named(path, OpenOptions::new().append(self.append)), ) } diff -Nru cargo-0.35.0/vendor/tempfile/src/spooled.rs cargo-0.37.0/vendor/tempfile/src/spooled.rs --- cargo-0.35.0/vendor/tempfile/src/spooled.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tempfile/src/spooled.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,7 +1,6 @@ -use file::tempfile; +use crate::file::tempfile; use std::fs::File; use std::io::{self, Cursor, Read, Seek, SeekFrom, Write}; -use std::mem::drop; #[derive(Debug)] enum SpooledInner { @@ -35,7 +34,6 @@ /// # Examples /// /// ``` -/// # extern crate tempfile; /// use tempfile::spooled_tempfile; /// use std::io::{self, Write}; /// @@ -86,9 +84,8 @@ if !self.is_rolled() { let mut file = tempfile()?; if let SpooledInner::InMemory(ref mut cursor) = self.inner { - file.write(cursor.get_ref())?; + file.write_all(cursor.get_ref())?; file.seek(SeekFrom::Start(cursor.position()))?; - drop(cursor); } self.inner = SpooledInner::OnDisk(file); } diff -Nru cargo-0.35.0/vendor/tempfile/src/util.rs cargo-0.37.0/vendor/tempfile/src/util.rs --- cargo-0.35.0/vendor/tempfile/src/util.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tempfile/src/util.rs 2019-07-17 05:42:23.000000000 +0000 @@ -4,7 +4,7 @@ use std::path::{Path, PathBuf}; use std::{io, str}; -use error::IoResultExt; +use crate::error::IoResultExt; fn tmpname(prefix: &OsStr, suffix: &OsStr, rand_len: usize) -> OsString { let mut buf = OsString::with_capacity(prefix.len() + suffix.len() + rand_len); @@ -20,7 +20,7 @@ .for_each(|b| buf.push(str::from_utf8_unchecked(&[b as u8]))) } buf.push(suffix); - return buf; + buf } pub fn create_helper( @@ -33,7 +33,7 @@ where F: Fn(PathBuf) -> io::Result, { - let num_retries = if random_len != 0 { ::NUM_RETRIES } else { 1 }; + let num_retries = if random_len != 0 { crate::NUM_RETRIES } else { 1 }; for _ in 0..num_retries { let path = base.join(tmpname(prefix, suffix, random_len)); diff -Nru cargo-0.35.0/vendor/tempfile/tests/namedtempfile.rs cargo-0.37.0/vendor/tempfile/tests/namedtempfile.rs --- cargo-0.35.0/vendor/tempfile/tests/namedtempfile.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tempfile/tests/namedtempfile.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,4 +1,5 @@ -extern crate tempfile; +#![deny(rust_2018_idioms)] + use std::env; use std::fs::File; use std::io::{Read, Seek, SeekFrom, Write}; @@ -96,6 +97,19 @@ } #[test] +fn test_append() { + let mut tmpfile = Builder::new().append(true).tempfile().unwrap(); + tmpfile.write(b"a").unwrap(); + tmpfile.seek(SeekFrom::Start(0)).unwrap(); + tmpfile.write(b"b").unwrap(); + + tmpfile.seek(SeekFrom::Start(0)).unwrap(); + let mut buf = vec![0u8; 1]; + tmpfile.read_exact(&mut buf).unwrap(); + assert_eq!(buf, b"a"); +} + +#[test] fn test_reopen() { let source = NamedTempFile::new().unwrap(); let mut first = source.reopen().unwrap(); @@ -217,3 +231,53 @@ drop(tmpfile); assert!(!exists(path)) } + +#[test] +fn test_into_parts() { + let mut file = NamedTempFile::new().unwrap(); + write!(file, "abcd").expect("write failed"); + + let (mut file, temp_path) = file.into_parts(); + + let path = temp_path.to_path_buf(); + + assert!(path.exists()); + drop(temp_path); + assert!(!path.exists()); + + write!(file, "efgh").expect("write failed"); + + file.seek(SeekFrom::Start(0)).unwrap(); + let mut buf = String::new(); + file.read_to_string(&mut buf).unwrap(); + assert_eq!("abcdefgh", buf); +} + +#[test] +fn test_keep() { + let mut tmpfile = NamedTempFile::new().unwrap(); + write!(tmpfile, "abcde").unwrap(); + let (mut f, temp_path) = tmpfile.into_parts(); + let path; + { + assert!(exists(&temp_path)); + path = temp_path.keep().unwrap(); + assert!(exists(&path)); + + // Check original file + f.seek(SeekFrom::Start(0)).unwrap(); + let mut buf = String::new(); + f.read_to_string(&mut buf).unwrap(); + assert_eq!("abcde", buf); + } + + { + // Try opening it again. + let mut f = File::open(&path).unwrap(); + f.seek(SeekFrom::Start(0)).unwrap(); + let mut buf = String::new(); + f.read_to_string(&mut buf).unwrap(); + assert_eq!("abcde", buf); + } + std::fs::remove_file(&path).unwrap(); +} diff -Nru cargo-0.35.0/vendor/tempfile/tests/spooled.rs cargo-0.37.0/vendor/tempfile/tests/spooled.rs --- cargo-0.35.0/vendor/tempfile/tests/spooled.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tempfile/tests/spooled.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,4 +1,4 @@ -extern crate tempfile; +#![deny(rust_2018_idioms)] use std::io::{Read, Seek, SeekFrom, Write}; diff -Nru cargo-0.35.0/vendor/tempfile/tests/tempdir.rs cargo-0.37.0/vendor/tempfile/tests/tempdir.rs --- cargo-0.35.0/vendor/tempfile/tests/tempdir.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tempfile/tests/tempdir.rs 2019-07-17 05:42:23.000000000 +0000 @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate tempfile; +#![deny(rust_2018_idioms)] use std::env; use std::fs; diff -Nru cargo-0.35.0/vendor/tempfile/tests/tempfile.rs cargo-0.37.0/vendor/tempfile/tests/tempfile.rs --- cargo-0.35.0/vendor/tempfile/tests/tempfile.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/tempfile/tests/tempfile.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,4 +1,5 @@ -extern crate tempfile; +#![deny(rust_2018_idioms)] + use std::fs; use std::io::{Read, Seek, SeekFrom, Write}; use std::sync::mpsc::{sync_channel, TryRecvError}; diff -Nru cargo-0.35.0/vendor/termcolor/.cargo-checksum.json cargo-0.37.0/vendor/termcolor/.cargo-checksum.json --- cargo-0.35.0/vendor/termcolor/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termcolor/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f"} \ No newline at end of file +{"files":{},"package":"96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/termcolor/Cargo.toml cargo-0.37.0/vendor/termcolor/Cargo.toml --- cargo-0.35.0/vendor/termcolor/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termcolor/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,7 +12,7 @@ [package] name = "termcolor" -version = "1.0.4" +version = "1.0.5" authors = ["Andrew Gallant "] exclude = ["/.travis.yml", "/appveyor.yml", "/ci/**"] description = "A simple cross platform library for writing colored text to a terminal.\n" diff -Nru cargo-0.35.0/vendor/termcolor/src/lib.rs cargo-0.37.0/vendor/termcolor/src/lib.rs --- cargo-0.35.0/vendor/termcolor/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termcolor/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1511,17 +1511,12 @@ &self, console: &mut wincolor::Console, ) -> io::Result<()> { - use wincolor::Intense; - - let intense = if self.intense { Intense::Yes } else { Intense::No }; - - let fg_color = self.fg_color.as_ref().and_then(|c| c.to_windows()); - if let Some(color) = fg_color { + let fg_color = self.fg_color.and_then(|c| c.to_windows(self.intense)); + if let Some((intense, color)) = fg_color { console.fg(intense, color)?; } - - let bg_color = self.bg_color.as_ref().and_then(|c| c.to_windows()); - if let Some(color) = bg_color { + let bg_color = self.bg_color.and_then(|c| c.to_windows(self.intense)); + if let Some((intense, color)) = bg_color { console.bg(intense, color)?; } Ok(()) @@ -1569,20 +1564,43 @@ impl Color { /// Translate this color to a wincolor::Color. #[cfg(windows)] - fn to_windows(&self) -> Option { - match *self { - Color::Black => Some(wincolor::Color::Black), - Color::Blue => Some(wincolor::Color::Blue), - Color::Green => Some(wincolor::Color::Green), - Color::Red => Some(wincolor::Color::Red), - Color::Cyan => Some(wincolor::Color::Cyan), - Color::Magenta => Some(wincolor::Color::Magenta), - Color::Yellow => Some(wincolor::Color::Yellow), - Color::White => Some(wincolor::Color::White), - Color::Ansi256(_) => None, - Color::Rgb(_, _, _) => None, + fn to_windows( + self, + intense: bool, + ) -> Option<(wincolor::Intense, wincolor::Color)> { + use wincolor::Intense::{Yes, No}; + + let color = match self { + Color::Black => wincolor::Color::Black, + Color::Blue => wincolor::Color::Blue, + Color::Green => wincolor::Color::Green, + Color::Red => wincolor::Color::Red, + Color::Cyan => wincolor::Color::Cyan, + Color::Magenta => wincolor::Color::Magenta, + Color::Yellow => wincolor::Color::Yellow, + Color::White => wincolor::Color::White, + Color::Ansi256(0) => return Some((No, wincolor::Color::Black)), + Color::Ansi256(1) => return Some((No, wincolor::Color::Red)), + Color::Ansi256(2) => return Some((No, wincolor::Color::Green)), + Color::Ansi256(3) => return Some((No, wincolor::Color::Yellow)), + Color::Ansi256(4) => return Some((No, wincolor::Color::Blue)), + Color::Ansi256(5) => return Some((No, wincolor::Color::Magenta)), + Color::Ansi256(6) => return Some((No, wincolor::Color::Cyan)), + Color::Ansi256(7) => return Some((No, wincolor::Color::White)), + Color::Ansi256(8) => return Some((Yes, wincolor::Color::Black)), + Color::Ansi256(9) => return Some((Yes, wincolor::Color::Red)), + Color::Ansi256(10) => return Some((Yes, wincolor::Color::Green)), + Color::Ansi256(11) => return Some((Yes, wincolor::Color::Yellow)), + Color::Ansi256(12) => return Some((Yes, wincolor::Color::Blue)), + Color::Ansi256(13) => return Some((Yes, wincolor::Color::Magenta)), + Color::Ansi256(14) => return Some((Yes, wincolor::Color::Cyan)), + Color::Ansi256(15) => return Some((Yes, wincolor::Color::White)), + Color::Ansi256(_) => return None, + Color::Rgb(_, _, _) => return None, Color::__Nonexhaustive => unreachable!(), - } + }; + let intense = if intense { Yes } else { No }; + Some((intense, color)) } /// Parses a numeric color string, either ANSI or RGB. diff -Nru cargo-0.35.0/vendor/termion/.cargo-checksum.json cargo-0.37.0/vendor/termion/.cargo-checksum.json --- cargo-0.35.0/vendor/termion/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/.cargo-checksum.json 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"files":{},"package":"dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/termion/Cargo.toml cargo-0.37.0/vendor/termion/Cargo.toml --- cargo-0.35.0/vendor/termion/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO -# -# When uploading crates to the registry Cargo will automatically -# "normalize" Cargo.toml files for maximal compatibility -# with all versions of Cargo and also rewrite `path` dependencies -# 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 = "termion" -version = "1.5.2" -authors = ["ticki ", "gycos ", "IGI-111 "] -exclude = ["target", "CHANGELOG.md", "image.png", "Cargo.lock"] -description = "A bindless library for manipulating terminals." -documentation = "https://docs.rs/termion" -keywords = ["tty", "color", "terminal", "password", "tui"] -license = "MIT" -repository = "https://gitlab.redox-os.org/redox-os/termion" -[dependencies.numtoa] -version = "0.1.0" -features = ["std"] -[target."cfg(not(target_os = \"redox\"))".dependencies.libc] -version = "0.2.8" -[target."cfg(target_os = \"redox\")".dependencies.redox_syscall] -version = "0.1" - -[target."cfg(target_os = \"redox\")".dependencies.redox_termios] -version = "0.1" diff -Nru cargo-0.35.0/vendor/termion/examples/alternate_screen_raw.rs cargo-0.37.0/vendor/termion/examples/alternate_screen_raw.rs --- cargo-0.35.0/vendor/termion/examples/alternate_screen_raw.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/examples/alternate_screen_raw.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -extern crate termion; - -use termion::event::Key; -use termion::input::TermRead; -use termion::raw::IntoRawMode; -use termion::screen::*; -use std::io::{Write, stdout, stdin}; - -fn write_alt_screen_msg(screen: &mut W) { - write!(screen, "{}{}Welcome to the alternate screen.{}Press '1' to switch to the main screen or '2' to switch to the alternate screen.{}Press 'q' to exit (and switch back to the main screen).", - termion::clear::All, - termion::cursor::Goto(1, 1), - termion::cursor::Goto(1, 3), - termion::cursor::Goto(1, 4)).unwrap(); -} - -fn main() { - let stdin = stdin(); - let mut screen = AlternateScreen::from(stdout().into_raw_mode().unwrap()); - write!(screen, "{}", termion::cursor::Hide).unwrap(); - write_alt_screen_msg(&mut screen); - - screen.flush().unwrap(); - - for c in stdin.keys() { - match c.unwrap() { - Key::Char('q') => break, - Key::Char('1') => { - write!(screen, "{}", ToMainScreen).unwrap(); - } - Key::Char('2') => { - write!(screen, "{}", ToAlternateScreen).unwrap(); - write_alt_screen_msg(&mut screen); - } - _ => {} - } - screen.flush().unwrap(); - } - write!(screen, "{}", termion::cursor::Show).unwrap(); -} diff -Nru cargo-0.35.0/vendor/termion/examples/alternate_screen.rs cargo-0.37.0/vendor/termion/examples/alternate_screen.rs --- cargo-0.35.0/vendor/termion/examples/alternate_screen.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/examples/alternate_screen.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -extern crate termion; - -use termion::screen::*; -use std::io::{Write, stdout}; -use std::{time, thread}; - -fn main() { - { - let mut screen = AlternateScreen::from(stdout()); - write!(screen, "Welcome to the alternate screen.\n\nPlease wait patiently until we arrive back at the main screen in a about three seconds.").unwrap(); - screen.flush().unwrap(); - - thread::sleep(time::Duration::from_secs(3)); - } - - println!("Phew! We are back."); -} diff -Nru cargo-0.35.0/vendor/termion/examples/async.rs cargo-0.37.0/vendor/termion/examples/async.rs --- cargo-0.35.0/vendor/termion/examples/async.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/examples/async.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -extern crate termion; - -use termion::raw::IntoRawMode; -use termion::async_stdin; -use std::io::{Read, Write, stdout}; -use std::thread; -use std::time::Duration; - -fn main() { - let stdout = stdout(); - let mut stdout = stdout.lock().into_raw_mode().unwrap(); - let mut stdin = async_stdin().bytes(); - - write!(stdout, - "{}{}", - termion::clear::All, - termion::cursor::Goto(1, 1)) - .unwrap(); - - loop { - write!(stdout, "{}", termion::clear::CurrentLine).unwrap(); - - let b = stdin.next(); - write!(stdout, "\r{:?} <- This demonstrates the async read input char. Between each update a 100 ms. is waited, simply to demonstrate the async fashion. \n\r", b).unwrap(); - if let Some(Ok(b'q')) = b { - break; - } - - stdout.flush().unwrap(); - - thread::sleep(Duration::from_millis(50)); - stdout.write_all(b"# ").unwrap(); - stdout.flush().unwrap(); - thread::sleep(Duration::from_millis(50)); - stdout.write_all(b"\r #").unwrap(); - write!(stdout, "{}", termion::cursor::Goto(1, 1)).unwrap(); - stdout.flush().unwrap(); - } -} diff -Nru cargo-0.35.0/vendor/termion/examples/click.rs cargo-0.37.0/vendor/termion/examples/click.rs --- cargo-0.35.0/vendor/termion/examples/click.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/examples/click.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -extern crate termion; - -use termion::event::{Key, Event, MouseEvent}; -use termion::input::{TermRead, MouseTerminal}; -use termion::raw::IntoRawMode; -use std::io::{Write, stdout, stdin}; - -fn main() { - let stdin = stdin(); - let mut stdout = MouseTerminal::from(stdout().into_raw_mode().unwrap()); - - write!(stdout, - "{}{}q to exit. Click, click, click!", - termion::clear::All, - termion::cursor::Goto(1, 1)) - .unwrap(); - stdout.flush().unwrap(); - - for c in stdin.events() { - let evt = c.unwrap(); - match evt { - Event::Key(Key::Char('q')) => break, - Event::Mouse(me) => { - match me { - MouseEvent::Press(_, x, y) => { - write!(stdout, "{}x", termion::cursor::Goto(x, y)).unwrap(); - } - _ => (), - } - } - _ => {} - } - stdout.flush().unwrap(); - } -} diff -Nru cargo-0.35.0/vendor/termion/examples/color.rs cargo-0.37.0/vendor/termion/examples/color.rs --- cargo-0.35.0/vendor/termion/examples/color.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/examples/color.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -extern crate termion; - -use termion::{color, style}; - -fn main() { - println!("{}Red", color::Fg(color::Red)); - println!("{}Blue", color::Fg(color::Blue)); - println!("{}Blue'n'Bold{}", style::Bold, style::Reset); - println!("{}Just plain italic{}", style::Italic, style::Reset); -} diff -Nru cargo-0.35.0/vendor/termion/examples/commie.rs cargo-0.37.0/vendor/termion/examples/commie.rs --- cargo-0.35.0/vendor/termion/examples/commie.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/examples/commie.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -extern crate termion; - -use termion::{clear, color, cursor}; - -use std::{time, thread}; - -const COMMUNISM: &'static str = r#" - !######### # - !########! ##! - !########! ### - !########## #### - ######### ##### ###### - !###! !####! ###### - ! ##### ######! - !####! ####### - ##### ####### - !####! #######! - ####!######## - ## ########## - ,######! !############# - ,#### ########################!####! - ,####' ##################!' ##### - ,####' ####### !####! - ####' ##### - ~## ##~ -"#; - -fn main() { - let mut state = 0; - - println!("\n{}{}{}{}{}{}", - cursor::Hide, - clear::All, - cursor::Goto(1, 1), - color::Fg(color::Black), - color::Bg(color::Red), - COMMUNISM); - loop { - println!("{}{} ☭ GAY ☭ SPACE ☭ COMMUNISM ☭ ", - cursor::Goto(1, 1), - color::Bg(color::AnsiValue(state))); - println!("{}{} WILL PREVAIL, COMRADES! ", - cursor::Goto(1, 20), - color::Bg(color::AnsiValue(state))); - - state += 1; - state %= 8; - - thread::sleep(time::Duration::from_millis(90)); - } -} diff -Nru cargo-0.35.0/vendor/termion/examples/detect_color.rs cargo-0.37.0/vendor/termion/examples/detect_color.rs --- cargo-0.35.0/vendor/termion/examples/detect_color.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/examples/detect_color.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -extern crate termion; - -use termion::color::{DetectColors, AnsiValue, Bg}; -use termion::raw::IntoRawMode; -use std::io::stdout; - -fn main() { - let count; - { - let mut term = stdout().into_raw_mode().unwrap(); - count = term.available_colors().unwrap(); - } - - println!("This terminal supports {} colors.", count); - for i in 0..count { - print!("{} {}", Bg(AnsiValue(i as u8)), Bg(AnsiValue(0))); - } - println!(); -} diff -Nru cargo-0.35.0/vendor/termion/examples/is_tty.rs cargo-0.37.0/vendor/termion/examples/is_tty.rs --- cargo-0.35.0/vendor/termion/examples/is_tty.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/examples/is_tty.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -extern crate termion; - -use std::fs; - -fn main() { - if termion::is_tty(&fs::File::create("/dev/stdout").unwrap()) { - println!("This is a TTY!"); - } else { - println!("This is not a TTY :("); - } -} diff -Nru cargo-0.35.0/vendor/termion/examples/keys.rs cargo-0.37.0/vendor/termion/examples/keys.rs --- cargo-0.35.0/vendor/termion/examples/keys.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/examples/keys.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -extern crate termion; - -use termion::event::Key; -use termion::input::TermRead; -use termion::raw::IntoRawMode; -use std::io::{Write, stdout, stdin}; - -fn main() { - let stdin = stdin(); - let mut stdout = stdout().into_raw_mode().unwrap(); - - write!(stdout, - "{}{}q to exit. Type stuff, use alt, and so on.{}", - termion::clear::All, - termion::cursor::Goto(1, 1), - termion::cursor::Hide) - .unwrap(); - stdout.flush().unwrap(); - - for c in stdin.keys() { - write!(stdout, - "{}{}", - termion::cursor::Goto(1, 1), - termion::clear::CurrentLine) - .unwrap(); - - match c.unwrap() { - Key::Char('q') => break, - Key::Char(c) => println!("{}", c), - Key::Alt(c) => println!("^{}", c), - Key::Ctrl(c) => println!("*{}", c), - Key::Esc => println!("ESC"), - Key::Left => println!("←"), - Key::Right => println!("→"), - Key::Up => println!("↑"), - Key::Down => println!("↓"), - Key::Backspace => println!("×"), - _ => {} - } - stdout.flush().unwrap(); - } - - write!(stdout, "{}", termion::cursor::Show).unwrap(); -} diff -Nru cargo-0.35.0/vendor/termion/examples/mouse.rs cargo-0.37.0/vendor/termion/examples/mouse.rs --- cargo-0.35.0/vendor/termion/examples/mouse.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/examples/mouse.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -extern crate termion; - -use termion::event::*; -use termion::cursor::{self, DetectCursorPos}; -use termion::input::{TermRead, MouseTerminal}; -use termion::raw::IntoRawMode; -use std::io::{self, Write}; - -fn main() { - let stdin = io::stdin(); - let mut stdout = MouseTerminal::from(io::stdout().into_raw_mode().unwrap()); - - writeln!(stdout, - "{}{}q to exit. Type stuff, use alt, click around...", - termion::clear::All, - termion::cursor::Goto(1, 1)) - .unwrap(); - - for c in stdin.events() { - let evt = c.unwrap(); - match evt { - Event::Key(Key::Char('q')) => break, - Event::Mouse(me) => { - match me { - MouseEvent::Press(_, a, b) | - MouseEvent::Release(a, b) | - MouseEvent::Hold(a, b) => { - write!(stdout, "{}", cursor::Goto(a, b)).unwrap(); - let (x, y) = stdout.cursor_pos().unwrap(); - write!(stdout, - "{}{}Cursor is at: ({},{}){}", - cursor::Goto(5, 5), - termion::clear::UntilNewline, - x, - y, - cursor::Goto(a, b)) - .unwrap(); - } - } - } - _ => {} - } - - stdout.flush().unwrap(); - } -} diff -Nru cargo-0.35.0/vendor/termion/examples/rainbow.rs cargo-0.37.0/vendor/termion/examples/rainbow.rs --- cargo-0.35.0/vendor/termion/examples/rainbow.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/examples/rainbow.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -extern crate termion; - -use termion::event::Key; -use termion::input::TermRead; -use termion::raw::IntoRawMode; -use std::io::{Write, stdout, stdin}; - -fn rainbow(stdout: &mut W, blue: u8) { - write!(stdout, - "{}{}", - termion::cursor::Goto(1, 1), - termion::clear::All) - .unwrap(); - - for red in 0..32 { - let red = red * 8; - for green in 0..64 { - let green = green * 4; - write!(stdout, - "{} ", - termion::color::Bg(termion::color::Rgb(red, green, blue))) - .unwrap(); - } - write!(stdout, "\n\r").unwrap(); - } - - writeln!(stdout, "{}b = {}", termion::style::Reset, blue).unwrap(); -} - -fn main() { - let stdin = stdin(); - let mut stdout = stdout().into_raw_mode().unwrap(); - - writeln!(stdout, - "{}{}{}Use the up/down arrow keys to change the blue in the rainbow.", - termion::clear::All, - termion::cursor::Goto(1, 1), - termion::cursor::Hide) - .unwrap(); - - let mut blue = 172u8; - - for c in stdin.keys() { - match c.unwrap() { - Key::Up => { - blue = blue.saturating_add(4); - rainbow(&mut stdout, blue); - } - Key::Down => { - blue = blue.saturating_sub(4); - rainbow(&mut stdout, blue); - } - Key::Char('q') => break, - _ => {} - } - stdout.flush().unwrap(); - } - - write!(stdout, "{}", termion::cursor::Show).unwrap(); -} diff -Nru cargo-0.35.0/vendor/termion/examples/read.rs cargo-0.37.0/vendor/termion/examples/read.rs --- cargo-0.35.0/vendor/termion/examples/read.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/examples/read.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -extern crate termion; - -use termion::input::TermRead; -use std::io::{Write, stdout, stdin}; - -fn main() { - let stdout = stdout(); - let mut stdout = stdout.lock(); - let stdin = stdin(); - let mut stdin = stdin.lock(); - - stdout.write_all(b"password: ").unwrap(); - stdout.flush().unwrap(); - - let pass = stdin.read_passwd(&mut stdout); - - if let Ok(Some(pass)) = pass { - stdout.write_all(pass.as_bytes()).unwrap(); - stdout.write_all(b"\n").unwrap(); - } else { - stdout.write_all(b"Error\n").unwrap(); - } -} diff -Nru cargo-0.35.0/vendor/termion/examples/rustc_fun.rs cargo-0.37.0/vendor/termion/examples/rustc_fun.rs --- cargo-0.35.0/vendor/termion/examples/rustc_fun.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/examples/rustc_fun.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -extern crate termion; - -use termion::{color, style}; - -fn main() { - println!("{lighgreen}-- src/test/ui/borrow-errors.rs at 82:18 --\n\ - {red}error: {reset}{bold}two closures require unique access to `vec` at the same time {reset}{bold}{magenta}[E0524]{reset}\n\ - {line_num_fg}{line_num_bg}79 {reset} let append = |e| {{\n\ - {line_num_fg}{line_num_bg}{info_line}{reset} {red}^^^{reset} {error_fg}first closure is constructed here\n\ - {line_num_fg}{line_num_bg}80 {reset} vec.push(e)\n\ - {line_num_fg}{line_num_bg}{info_line}{reset} {red}^^^{reset} {error_fg}previous borrow occurs due to use of `vec` in closure\n\ - {line_num_fg}{line_num_bg}84 {reset} }};\n\ - {line_num_fg}{line_num_bg}85 {reset} }}\n\ - {line_num_fg}{line_num_bg}{info_line}{reset} {red}^{reset} {error_fg}borrow from first closure ends here", - lighgreen = color::Fg(color::LightGreen), - red = color::Fg(color::Red), - bold = style::Bold, - reset = style::Reset, - magenta = color::Fg(color::Magenta), - line_num_bg = color::Bg(color::AnsiValue::grayscale(3)), - line_num_fg = color::Fg(color::AnsiValue::grayscale(18)), - info_line = "| ", - error_fg = color::Fg(color::AnsiValue::grayscale(17))) -} diff -Nru cargo-0.35.0/vendor/termion/examples/simple.rs cargo-0.37.0/vendor/termion/examples/simple.rs --- cargo-0.35.0/vendor/termion/examples/simple.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/examples/simple.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -extern crate termion; - -use termion::color; -use termion::raw::IntoRawMode; -use std::io::{Read, Write, stdout, stdin}; - -fn main() { - // Initialize 'em all. - let stdout = stdout(); - let mut stdout = stdout.lock().into_raw_mode().unwrap(); - let stdin = stdin(); - let stdin = stdin.lock(); - - write!(stdout, - "{}{}{}yo, 'q' will exit.{}{}", - termion::clear::All, - termion::cursor::Goto(5, 5), - termion::style::Bold, - termion::style::Reset, - termion::cursor::Goto(20, 10)) - .unwrap(); - stdout.flush().unwrap(); - - let mut bytes = stdin.bytes(); - loop { - let b = bytes.next().unwrap().unwrap(); - - match b { - // Quit - b'q' => return, - // Clear the screen - b'c' => write!(stdout, "{}", termion::clear::All), - // Set red color - b'r' => write!(stdout, "{}", color::Fg(color::Rgb(5, 0, 0))), - // Write it to stdout. - a => write!(stdout, "{}", a), - } - .unwrap(); - - stdout.flush().unwrap(); - } -} diff -Nru cargo-0.35.0/vendor/termion/examples/size.rs cargo-0.37.0/vendor/termion/examples/size.rs --- cargo-0.35.0/vendor/termion/examples/size.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/examples/size.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -extern crate termion; - -use termion::terminal_size; - -fn main() { - println!("Size is {:?}", terminal_size().unwrap()) -} diff -Nru cargo-0.35.0/vendor/termion/examples/truecolor.rs cargo-0.37.0/vendor/termion/examples/truecolor.rs --- cargo-0.35.0/vendor/termion/examples/truecolor.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/examples/truecolor.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -extern crate termion; - -use termion::{color, cursor, clear}; -use std::{thread, time}; - -fn main() { - for r in 0..255 { - let c = color::Rgb(r, !r, 2 * ((r % 128) as i8 - 64).abs() as u8); - println!("{}{}{}wow", cursor::Goto(1, 1), color::Bg(c), clear::All); - thread::sleep(time::Duration::from_millis(100)); - } -} diff -Nru cargo-0.35.0/vendor/termion/LICENSE cargo-0.37.0/vendor/termion/LICENSE --- cargo-0.35.0/vendor/termion/LICENSE 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/LICENSE 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Ticki - -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 is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff -Nru cargo-0.35.0/vendor/termion/logo.svg cargo-0.37.0/vendor/termion/logo.svg --- cargo-0.35.0/vendor/termion/logo.svg 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/logo.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ - - - - - - - diff -Nru cargo-0.35.0/vendor/termion/README.md cargo-0.37.0/vendor/termion/README.md --- cargo-0.35.0/vendor/termion/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/README.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,181 +0,0 @@ -

-Termion logo -

- -[![Build Status](https://travis-ci.org/redox-os/termion.svg?branch=master)](https://travis-ci.org/redox-os/termion) [![Latest Version](https://img.shields.io/crates/v/termion.svg)](https://crates.io/crates/termion) | [Documentation](https://docs.rs/termion) | [Examples](https://github.com/redox-os/termion/tree/master/examples) | [Changelog](https://github.com/redox-os/termion/tree/master/CHANGELOG.md) | [Tutorial](http://ticki.github.io/blog/making-terminal-applications-in-rust-with-termion/) -|----|----|----|----|---- - - -**Termion** is a pure Rust, bindless library for low-level handling, manipulating -and reading information about terminals. This provides a full-featured -alternative to Termbox. - -Termion aims to be simple and yet expressive. It is bindless, meaning that it -is not a front-end to some other library (e.g., ncurses or termbox), but a -standalone library directly talking to the TTY. - -Termion is quite convenient, due to its complete coverage of essential TTY -features, providing one consistent API. Termion is rather low-level containing -only abstraction aligned with what actually happens behind the scenes. For -something more high-level, refer to inquirer-rs, which uses Termion as backend. - -Termion generates escapes and API calls for the user. This makes it a whole lot -cleaner to use escapes. - -Supports Redox, Mac OS X, BSD, and Linux (or, in general, ANSI terminals). - -## A note on stability - -This crate is stable. - -## Cargo.toml - -```toml -[dependencies] -termion = "*" -``` - -## 0.1.0 to 1.0.0 guide - -This sample table gives an idea of how to go about converting to the new major -version of Termion. - -| 0.1.0 | 1.0.0 -|--------------------------------|--------------------------- -| `use termion::IntoRawMode` | `use termion::raw::IntoRawMode` -| `use termion::TermRead` | `use termion::input::TermRead` -| `stdout.color(color::Red);` | `write!(stdout, "{}", color::Fg(color::Red));` -| `stdout.color_bg(color::Red);` | `write!(stdout, "{}", color::Bg(color::Red));` -| `stdout.goto(x, y);` | `write!(stdout, "{}", cursor::Goto(x, y));` -| `color::rgb(r, g, b);` | `color::Rgb(r, g, b)` (truecolor) -| `x.with_mouse()` | `MouseTerminal::from(x)` - -## Features - -- Raw mode. -- TrueColor. -- 256-color mode. -- Cursor movement. -- Text formatting. -- Console size. -- TTY-only stream. -- Control sequences. -- Termios control. -- Password input. -- Redox support. -- Safe `isatty` wrapper. -- Panic-free error handling. -- Special keys events (modifiers, special keys, etc.). -- Allocation-free. -- Asynchronous key events. -- Mouse input. -- Carefully tested. -- Detailed documentation on every item. - -and much more. - -## Examples - -### Style and colors. - -```rust -extern crate termion; - -use termion::{color, style}; - -use std::io; - -fn main() { - println!("{}Red", color::Fg(color::Red)); - println!("{}Blue", color::Fg(color::Blue)); - println!("{}Blue'n'Bold{}", style::Bold, style::Reset); - println!("{}Just plain italic", style::Italic); -} -``` - -### Moving the cursor - -```rust -extern crate termion; - -fn main() { - print!("{}{}Stuff", termion::clear::All, termion::cursor::Goto(1, 1)); -} - -``` - -### Mouse - -```rust -extern crate termion; - -use termion::event::{Key, Event, MouseEvent}; -use termion::input::{TermRead, MouseTerminal}; -use termion::raw::IntoRawMode; -use std::io::{Write, stdout, stdin}; - -fn main() { - let stdin = stdin(); - let mut stdout = MouseTerminal::from(stdout().into_raw_mode().unwrap()); - - write!(stdout, "{}{}q to exit. Click, click, click!", termion::clear::All, termion::cursor::Goto(1, 1)).unwrap(); - stdout.flush().unwrap(); - - for c in stdin.events() { - let evt = c.unwrap(); - match evt { - Event::Key(Key::Char('q')) => break, - Event::Mouse(me) => { - match me { - MouseEvent::Press(_, x, y) => { - write!(stdout, "{}x", termion::cursor::Goto(x, y)).unwrap(); - }, - _ => (), - } - } - _ => {} - } - stdout.flush().unwrap(); - } -} -``` - -### Read a password - -```rust -extern crate termion; - -use termion::input::TermRead; -use std::io::{Write, stdout, stdin}; - -fn main() { - let stdout = stdout(); - let mut stdout = stdout.lock(); - let stdin = stdin(); - let mut stdin = stdin.lock(); - - stdout.write_all(b"password: ").unwrap(); - stdout.flush().unwrap(); - - let pass = stdin.read_passwd(&mut stdout); - - if let Ok(Some(pass)) = pass { - stdout.write_all(pass.as_bytes()).unwrap(); - stdout.write_all(b"\n").unwrap(); - } else { - stdout.write_all(b"Error\n").unwrap(); - } -} -``` - -## Usage - -See `examples/`, and the documentation, which can be rendered using `cargo doc`. - -For a more complete example, see [a minesweeper implementation](https://github.com/redox-os/games-for-redox/blob/master/src/minesweeper/main.rs), that I made for Redox using termion. - - - -## License - -MIT/X11. diff -Nru cargo-0.35.0/vendor/termion/src/async.rs cargo-0.37.0/vendor/termion/src/async.rs --- cargo-0.35.0/vendor/termion/src/async.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/async.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,101 +0,0 @@ -use std::io::{self, Read}; -use std::sync::mpsc; -use std::thread; - -use sys::tty::get_tty; - -/// Construct an asynchronous handle to the TTY standard input, with a delimiter byte. -/// -/// This has the same advantages as async_stdin(), but also allows specifying a delimiter byte. The -/// reader will stop reading after consuming the delimiter byte. -pub fn async_stdin_until(delimiter: u8) -> AsyncReader { - let (send, recv) = mpsc::channel(); - - thread::spawn(move || for i in get_tty().unwrap().bytes() { - - match i { - Ok(byte) => { - let end_of_stream = &byte == &delimiter; - let send_error = send.send(Ok(byte)).is_err(); - - if end_of_stream || send_error { return; } - }, - Err(_) => { return; } - } - }); - - AsyncReader { recv: recv } -} - -/// Construct an asynchronous handle to the TTY standard input. -/// -/// This allows you to read from standard input _without blocking_ the current thread. -/// Specifically, it works by firing up another thread to handle the event stream, which will then -/// be buffered in a mpsc queue, which will eventually be read by the current thread. -/// -/// This will not read the piped standard input, but rather read from the TTY device, since reading -/// asyncronized from piped input would rarely make sense. In other words, if you pipe standard -/// output from another process, it won't be reflected in the stream returned by this function, as -/// this represents the TTY device, and not the piped standard input. -pub fn async_stdin() -> AsyncReader { - let (send, recv) = mpsc::channel(); - - thread::spawn(move || for i in get_tty().unwrap().bytes() { - if send.send(i).is_err() { - return; - } - }); - - AsyncReader { recv: recv } -} - -/// An asynchronous reader. -/// -/// This acts as any other stream, with the exception that reading from it won't block. Instead, -/// the buffer will only be partially updated based on how much the internal buffer holds. -pub struct AsyncReader { - /// The underlying mpsc receiver. - recv: mpsc::Receiver>, -} - -// FIXME: Allow constructing an async reader from an arbitrary stream. - -impl Read for AsyncReader { - /// Read from the byte stream. - /// - /// This will never block, but try to drain the event queue until empty. If the total number of - /// bytes written is lower than the buffer's length, the event queue is empty or that the event - /// stream halted. - fn read(&mut self, buf: &mut [u8]) -> io::Result { - let mut total = 0; - - loop { - if total >= buf.len() { - break; - } - - match self.recv.try_recv() { - Ok(Ok(b)) => { - buf[total] = b; - total += 1; - } - Ok(Err(e)) => return Err(e), - Err(_) => break, - } - } - - Ok(total) - } -} - -#[cfg(test)] -mod test { - use super::*; - use std::io::Read; - - #[test] - fn test_async_stdin() { - let stdin = async_stdin(); - stdin.bytes().next(); - } -} diff -Nru cargo-0.35.0/vendor/termion/src/clear.rs cargo-0.37.0/vendor/termion/src/clear.rs --- cargo-0.35.0/vendor/termion/src/clear.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/clear.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -//! Clearing the screen. - -use std::fmt; - -derive_csi_sequence!("Clear the entire screen.", All, "2J"); -derive_csi_sequence!("Clear everything after the cursor.", AfterCursor, "J"); -derive_csi_sequence!("Clear everything before the cursor.", BeforeCursor, "1J"); -derive_csi_sequence!("Clear the current line.", CurrentLine, "2K"); -derive_csi_sequence!("Clear from cursor to newline.", UntilNewline, "K"); diff -Nru cargo-0.35.0/vendor/termion/src/color.rs cargo-0.37.0/vendor/termion/src/color.rs --- cargo-0.35.0/vendor/termion/src/color.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/color.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,306 +0,0 @@ -//! Color managemement. -//! -//! # Example -//! -//! ```rust -//! use termion::color; -//! -//! fn main() { -//! println!("{}Red", color::Fg(color::Red)); -//! println!("{}Blue", color::Fg(color::Blue)); -//! println!("{}Back again", color::Fg(color::Reset)); -//! } -//! ``` - -use std::fmt; -use raw::CONTROL_SEQUENCE_TIMEOUT; -use std::io::{self, Write, Read}; -use std::time::{SystemTime, Duration}; -use async::async_stdin; -use std::env; -use std::fmt::Debug; -use numtoa::NumToA; - -/// A terminal color. -pub trait Color: Debug { - /// Write the foreground version of this color. - fn write_fg(&self, f: &mut fmt::Formatter) -> fmt::Result; - /// Write the background version of this color. - fn write_bg(&self, f: &mut fmt::Formatter) -> fmt::Result; -} - -macro_rules! derive_color { - ($doc:expr, $name:ident, $value:expr) => { - #[doc = $doc] - #[derive(Copy, Clone, Debug)] - pub struct $name; - - impl Color for $name { - #[inline] - fn write_fg(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str(self.fg_str()) - } - - #[inline] - fn write_bg(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str(self.bg_str()) - } - } - - impl $name { - #[inline] - /// Returns the ANSI escape sequence as a string. - pub fn fg_str(&self) -> &'static str { csi!("38;5;", $value, "m") } - - #[inline] - /// Returns the ANSI escape sequences as a string. - pub fn bg_str(&self) -> &'static str { csi!("48;5;", $value, "m") } - } - }; -} - -derive_color!("Black.", Black, "0"); -derive_color!("Red.", Red, "1"); -derive_color!("Green.", Green, "2"); -derive_color!("Yellow.", Yellow, "3"); -derive_color!("Blue.", Blue, "4"); -derive_color!("Magenta.", Magenta, "5"); -derive_color!("Cyan.", Cyan, "6"); -derive_color!("White.", White, "7"); -derive_color!("High-intensity light black.", LightBlack, "8"); -derive_color!("High-intensity light red.", LightRed, "9"); -derive_color!("High-intensity light green.", LightGreen, "10"); -derive_color!("High-intensity light yellow.", LightYellow, "11"); -derive_color!("High-intensity light blue.", LightBlue, "12"); -derive_color!("High-intensity light magenta.", LightMagenta, "13"); -derive_color!("High-intensity light cyan.", LightCyan, "14"); -derive_color!("High-intensity light white.", LightWhite, "15"); - -impl<'a> Color for &'a Color { - #[inline] - fn write_fg(&self, f: &mut fmt::Formatter) -> fmt::Result { - (*self).write_fg(f) - } - - #[inline] - fn write_bg(&self, f: &mut fmt::Formatter) -> fmt::Result { - (*self).write_bg(f) - } -} - -/// An arbitrary ANSI color value. -#[derive(Clone, Copy, Debug)] -pub struct AnsiValue(pub u8); - -impl AnsiValue { - /// 216-color (r, g, b ≤ 5) RGB. - pub fn rgb(r: u8, g: u8, b: u8) -> AnsiValue { - debug_assert!(r <= 5, - "Red color fragment (r = {}) is out of bound. Make sure r ≤ 5.", - r); - debug_assert!(g <= 5, - "Green color fragment (g = {}) is out of bound. Make sure g ≤ 5.", - g); - debug_assert!(b <= 5, - "Blue color fragment (b = {}) is out of bound. Make sure b ≤ 5.", - b); - - AnsiValue(16 + 36 * r + 6 * g + b) - } - - /// Grayscale color. - /// - /// There are 24 shades of gray. - pub fn grayscale(shade: u8) -> AnsiValue { - // Unfortunately, there are a little less than fifty shades. - debug_assert!(shade < 24, - "Grayscale out of bound (shade = {}). There are only 24 shades of \ - gray.", - shade); - - AnsiValue(0xE8 + shade) - } -} - -impl AnsiValue { - /// Returns the ANSI sequence as a string. - pub fn fg_string(self) -> String { - let mut x = [0u8; 20]; - let x = self.0.numtoa_str(10, &mut x); - [csi!("38;5;"), x, "m"].concat() - } - - /// Returns the ANSI sequence as a string. - pub fn bg_string(self) -> String { - let mut x = [0u8; 20]; - let x = self.0.numtoa_str(10, &mut x); - [csi!("48;5;"), x, "m"].concat() - } -} - -impl Color for AnsiValue { - #[inline] - fn write_fg(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str(&self.fg_string()) - } - - #[inline] - fn write_bg(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str(&self.bg_string()) - } -} - -/// A truecolor RGB. -#[derive(Debug, Clone, Copy, PartialEq)] -pub struct Rgb(pub u8, pub u8, pub u8); - -impl Rgb { - /// Returns the ANSI sequence as a string. - pub fn fg_string(self) -> String { - let (mut x, mut y, mut z) = ([0u8; 20], [0u8; 20], [0u8; 20]); - let (x, y, z) = ( - self.0.numtoa_str(10, &mut x), - self.1.numtoa_str(10, &mut y), - self.2.numtoa_str(10, &mut z), - ); - - [csi!("38;2;"), x, ";", y, ";", z, "m"].concat() - } - - /// Returns the ANSI sequence as a string. - pub fn bg_string(self) -> String { - let (mut x, mut y, mut z) = ([0u8; 20], [0u8; 20], [0u8; 20]); - let (x, y, z) = ( - self.0.numtoa_str(10, &mut x), - self.1.numtoa_str(10, &mut y), - self.2.numtoa_str(10, &mut z), - ); - - [csi!("48;2;"), x, ";", y, ";", z, "m"].concat() - } -} - -impl Color for Rgb { - #[inline] - fn write_fg(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str(&self.fg_string()) - } - - #[inline] - fn write_bg(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str(&self.bg_string()) - } -} - -/// Reset colors to defaults. -#[derive(Debug, Clone, Copy)] -pub struct Reset; - -const RESET_FG: &str = csi!("39m"); -const RESET_BG: &str = csi!("49m"); - -impl Reset { - /// Returns the ANSI sequence as a string. - pub fn fg_str(self) -> &'static str { RESET_FG } - /// Returns the ANSI sequence as a string. - pub fn bg_str(self) -> &'static str { RESET_BG } -} - -impl Color for Reset { - #[inline] - fn write_fg(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str(RESET_FG) - } - - #[inline] - fn write_bg(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str(RESET_BG) - } -} - -/// A foreground color. -#[derive(Debug, Clone, Copy)] -pub struct Fg(pub C); - -impl fmt::Display for Fg { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - self.0.write_fg(f) - } -} - -/// A background color. -#[derive(Debug, Clone, Copy)] -pub struct Bg(pub C); - -impl fmt::Display for Bg { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - self.0.write_bg(f) - } -} - -/// Types that allow detection of the colors they support. -pub trait DetectColors { - /// How many ANSI colors are supported (from 8 to 256)? - /// - /// Beware: the information given isn't authoritative, it's infered through escape codes or the - /// value of `TERM`, more colors may be available. - fn available_colors(&mut self) -> io::Result; -} - -impl DetectColors for W { - fn available_colors(&mut self) -> io::Result { - let mut stdin = async_stdin(); - - if detect_color(self, &mut stdin, 0)? { - // OSC 4 is supported, detect how many colors there are. - // Do a binary search of the last supported color. - let mut min = 8; - let mut max = 256; - let mut i; - while min + 1 < max { - i = (min + max) / 2; - if detect_color(self, &mut stdin, i)? { - min = i - } else { - max = i - } - } - Ok(max) - } else { - // OSC 4 is not supported, trust TERM contents. - Ok(match env::var_os("TERM") { - Some(val) => { - if val.to_str().unwrap_or("").contains("256color") { - 256 - } else { - 8 - } - } - None => 8, - }) - } - } -} - -/// Detect a color using OSC 4. -fn detect_color(stdout: &mut Write, stdin: &mut Read, color: u16) -> io::Result { - // Is the color available? - // Use `ESC ] 4 ; color ; ? BEL`. - write!(stdout, "\x1B]4;{};?\x07", color)?; - stdout.flush()?; - - let mut buf: [u8; 1] = [0]; - let mut total_read = 0; - - let timeout = Duration::from_millis(CONTROL_SEQUENCE_TIMEOUT); - let now = SystemTime::now(); - let bell = 7u8; - - // Either consume all data up to bell or wait for a timeout. - while buf[0] != bell && now.elapsed().unwrap() < timeout { - total_read += stdin.read(&mut buf)?; - } - - // If there was a response, the color is supported. - Ok(total_read > 0) -} diff -Nru cargo-0.35.0/vendor/termion/src/cursor.rs cargo-0.37.0/vendor/termion/src/cursor.rs --- cargo-0.35.0/vendor/termion/src/cursor.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/cursor.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,222 +0,0 @@ -//! Cursor movement. - -use std::fmt; -use std::ops; -use std::io::{self, Write, Error, ErrorKind, Read}; -use async::async_stdin_until; -use std::time::{SystemTime, Duration}; -use raw::CONTROL_SEQUENCE_TIMEOUT; -use numtoa::NumToA; - -derive_csi_sequence!("Hide the cursor.", Hide, "?25l"); -derive_csi_sequence!("Show the cursor.", Show, "?25h"); - -derive_csi_sequence!("Restore the cursor.", Restore, "u"); -derive_csi_sequence!("Save the cursor.", Save, "s"); - -/// Goto some position ((1,1)-based). -/// -/// # Why one-based? -/// -/// ANSI escapes are very poorly designed, and one of the many odd aspects is being one-based. This -/// can be quite strange at first, but it is not that big of an obstruction once you get used to -/// it. -/// -/// # Example -/// -/// ```rust -/// extern crate termion; -/// -/// fn main() { -/// print!("{}{}Stuff", termion::clear::All, termion::cursor::Goto(5, 3)); -/// } -/// ``` -#[derive(Copy, Clone, PartialEq, Eq)] -pub struct Goto(pub u16, pub u16); - -impl From for String { - fn from(this: Goto) -> String { - let (mut x, mut y) = ([0u8; 20], [0u8; 20]); - ["\x1B[", this.1.numtoa_str(10, &mut x), ";", this.0.numtoa_str(10, &mut y), "H"].concat() - } -} - -impl Default for Goto { - fn default() -> Goto { - Goto(1, 1) - } -} - -impl fmt::Display for Goto { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - debug_assert!(self != &Goto(0, 0), "Goto is one-based."); - f.write_str(&String::from(*self)) - } -} - -/// Move cursor left. -#[derive(Copy, Clone, PartialEq, Eq)] -pub struct Left(pub u16); - -impl From for String { - fn from(this: Left) -> String { - let mut buf = [0u8; 20]; - ["\x1B[", this.0.numtoa_str(10, &mut buf), "D"].concat() - } -} - -impl fmt::Display for Left { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str(&String::from(*self)) - } -} - -/// Move cursor right. -#[derive(Copy, Clone, PartialEq, Eq)] -pub struct Right(pub u16); - -impl From for String { - fn from(this: Right) -> String { - let mut buf = [0u8; 20]; - ["\x1B[", this.0.numtoa_str(10, &mut buf), "C"].concat() - } -} - -impl fmt::Display for Right { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str(&String::from(*self)) - } -} - -/// Move cursor up. -#[derive(Copy, Clone, PartialEq, Eq)] -pub struct Up(pub u16); - -impl From for String { - fn from(this: Up) -> String { - let mut buf = [0u8; 20]; - ["\x1B[", this.0.numtoa_str(10, &mut buf), "A"].concat() - } -} - -impl fmt::Display for Up { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str(&String::from(*self)) - } -} - -/// Move cursor down. -#[derive(Copy, Clone, PartialEq, Eq)] -pub struct Down(pub u16); - -impl From for String { - fn from(this: Down) -> String { - let mut buf = [0u8; 20]; - ["\x1B[", this.0.numtoa_str(10, &mut buf), "B"].concat() - } -} - -impl fmt::Display for Down { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str(&String::from(*self)) - } -} - -/// Types that allow detection of the cursor position. -pub trait DetectCursorPos { - /// Get the (1,1)-based cursor position from the terminal. - fn cursor_pos(&mut self) -> io::Result<(u16, u16)>; -} - -impl DetectCursorPos for W { - fn cursor_pos(&mut self) -> io::Result<(u16, u16)> { - let delimiter = b'R'; - let mut stdin = async_stdin_until(delimiter); - - // Where is the cursor? - // Use `ESC [ 6 n`. - write!(self, "\x1B[6n")?; - self.flush()?; - - let mut buf: [u8; 1] = [0]; - let mut read_chars = Vec::new(); - - let timeout = Duration::from_millis(CONTROL_SEQUENCE_TIMEOUT); - let now = SystemTime::now(); - - // Either consume all data up to R or wait for a timeout. - while buf[0] != delimiter && now.elapsed().unwrap() < timeout { - if stdin.read(&mut buf)? > 0 { - read_chars.push(buf[0]); - } - } - - if read_chars.is_empty() { - return Err(Error::new(ErrorKind::Other, "Cursor position detection timed out.")); - } - - // The answer will look like `ESC [ Cy ; Cx R`. - - read_chars.pop(); // remove trailing R. - let read_str = String::from_utf8(read_chars).unwrap(); - let beg = read_str.rfind('[').unwrap(); - let coords: String = read_str.chars().skip(beg + 1).collect(); - let mut nums = coords.split(';'); - - let cy = nums.next() - .unwrap() - .parse::() - .unwrap(); - let cx = nums.next() - .unwrap() - .parse::() - .unwrap(); - - Ok((cx, cy)) - } -} - -/// Hide the cursor for the lifetime of this struct. -/// It will hide the cursor on creation with from() and show it back on drop(). -pub struct HideCursor { - /// The output target. - output: W, -} - -impl HideCursor { - /// Create a hide cursor wrapper struct for the provided output and hides the cursor. - pub fn from(mut output: W) -> Self { - write!(output, "{}", Hide).expect("hide the cursor"); - HideCursor { output: output } - } -} - -impl Drop for HideCursor { - fn drop(&mut self) { - write!(self, "{}", Show).expect("show the cursor"); - } -} - -impl ops::Deref for HideCursor { - type Target = W; - - fn deref(&self) -> &W { - &self.output - } -} - -impl ops::DerefMut for HideCursor { - fn deref_mut(&mut self) -> &mut W { - &mut self.output - } -} - -impl Write for HideCursor { - fn write(&mut self, buf: &[u8]) -> io::Result { - self.output.write(buf) - } - - fn flush(&mut self) -> io::Result<()> { - self.output.flush() - } -} diff -Nru cargo-0.35.0/vendor/termion/src/event.rs cargo-0.37.0/vendor/termion/src/event.rs --- cargo-0.35.0/vendor/termion/src/event.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/event.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,350 +0,0 @@ -//! Mouse and key events. - -use std::io::{Error, ErrorKind}; -use std::str; - -/// An event reported by the terminal. -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum Event { - /// A key press. - Key(Key), - /// A mouse button press, release or wheel use at specific coordinates. - Mouse(MouseEvent), - /// An event that cannot currently be evaluated. - Unsupported(Vec), -} - -/// A mouse related event. -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum MouseEvent { - /// A mouse button was pressed. - /// - /// The coordinates are one-based. - Press(MouseButton, u16, u16), - /// A mouse button was released. - /// - /// The coordinates are one-based. - Release(u16, u16), - /// A mouse button is held over the given coordinates. - /// - /// The coordinates are one-based. - Hold(u16, u16), -} - -/// A mouse button. -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum MouseButton { - /// The left mouse button. - Left, - /// The right mouse button. - Right, - /// The middle mouse button. - Middle, - /// Mouse wheel is going up. - /// - /// This event is typically only used with Mouse::Press. - WheelUp, - /// Mouse wheel is going down. - /// - /// This event is typically only used with Mouse::Press. - WheelDown, -} - -/// A key. -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Key { - /// Backspace. - Backspace, - /// Left arrow. - Left, - /// Right arrow. - Right, - /// Up arrow. - Up, - /// Down arrow. - Down, - /// Home key. - Home, - /// End key. - End, - /// Page Up key. - PageUp, - /// Page Down key. - PageDown, - /// Delete key. - Delete, - /// Insert key. - Insert, - /// Function keys. - /// - /// Only function keys 1 through 12 are supported. - F(u8), - /// Normal character. - Char(char), - /// Alt modified character. - Alt(char), - /// Ctrl modified character. - /// - /// Note that certain keys may not be modifiable with `ctrl`, due to limitations of terminals. - Ctrl(char), - /// Null byte. - Null, - /// Esc key. - Esc, - - #[doc(hidden)] - __IsNotComplete, -} - -/// Parse an Event from `item` and possibly subsequent bytes through `iter`. -pub fn parse_event(item: u8, iter: &mut I) -> Result - where I: Iterator> -{ - let error = Error::new(ErrorKind::Other, "Could not parse an event"); - match item { - b'\x1B' => { - // This is an escape character, leading a control sequence. - Ok(match iter.next() { - Some(Ok(b'O')) => { - match iter.next() { - // F1-F4 - Some(Ok(val @ b'P'...b'S')) => Event::Key(Key::F(1 + val - b'P')), - _ => return Err(error), - } - } - Some(Ok(b'[')) => { - // This is a CSI sequence. - parse_csi(iter).ok_or(error)? - } - Some(Ok(c)) => { - let ch = parse_utf8_char(c, iter); - Event::Key(Key::Alt(try!(ch))) - } - Some(Err(_)) | None => return Err(error), - }) - } - b'\n' | b'\r' => Ok(Event::Key(Key::Char('\n'))), - b'\t' => Ok(Event::Key(Key::Char('\t'))), - b'\x7F' => Ok(Event::Key(Key::Backspace)), - c @ b'\x01'...b'\x1A' => Ok(Event::Key(Key::Ctrl((c as u8 - 0x1 + b'a') as char))), - c @ b'\x1C'...b'\x1F' => Ok(Event::Key(Key::Ctrl((c as u8 - 0x1C + b'4') as char))), - b'\0' => Ok(Event::Key(Key::Null)), - c => { - Ok({ - let ch = parse_utf8_char(c, iter); - Event::Key(Key::Char(try!(ch))) - }) - } - } -} - -/// Parses a CSI sequence, just after reading ^[ -/// -/// Returns None if an unrecognized sequence is found. -fn parse_csi(iter: &mut I) -> Option - where I: Iterator> -{ - Some(match iter.next() { - Some(Ok(b'[')) => match iter.next() { - Some(Ok(val @ b'A'...b'E')) => Event::Key(Key::F(1 + val - b'A')), - _ => return None, - }, - Some(Ok(b'D')) => Event::Key(Key::Left), - Some(Ok(b'C')) => Event::Key(Key::Right), - Some(Ok(b'A')) => Event::Key(Key::Up), - Some(Ok(b'B')) => Event::Key(Key::Down), - Some(Ok(b'H')) => Event::Key(Key::Home), - Some(Ok(b'F')) => Event::Key(Key::End), - Some(Ok(b'M')) => { - // X10 emulation mouse encoding: ESC [ CB Cx Cy (6 characters only). - let mut next = || iter.next().unwrap().unwrap(); - - let cb = next() as i8 - 32; - // (1, 1) are the coords for upper left. - let cx = next().saturating_sub(32) as u16; - let cy = next().saturating_sub(32) as u16; - Event::Mouse(match cb & 0b11 { - 0 => { - if cb & 0x40 != 0 { - MouseEvent::Press(MouseButton::WheelUp, cx, cy) - } else { - MouseEvent::Press(MouseButton::Left, cx, cy) - } - } - 1 => { - if cb & 0x40 != 0 { - MouseEvent::Press(MouseButton::WheelDown, cx, cy) - } else { - MouseEvent::Press(MouseButton::Middle, cx, cy) - } - } - 2 => MouseEvent::Press(MouseButton::Right, cx, cy), - 3 => MouseEvent::Release(cx, cy), - _ => return None, - }) - } - Some(Ok(b'<')) => { - // xterm mouse encoding: - // ESC [ < Cb ; Cx ; Cy (;) (M or m) - let mut buf = Vec::new(); - let mut c = iter.next().unwrap().unwrap(); - while match c { - b'm' | b'M' => false, - _ => true, - } { - buf.push(c); - c = iter.next().unwrap().unwrap(); - } - let str_buf = String::from_utf8(buf).unwrap(); - let nums = &mut str_buf.split(';'); - - let cb = nums.next() - .unwrap() - .parse::() - .unwrap(); - let cx = nums.next() - .unwrap() - .parse::() - .unwrap(); - let cy = nums.next() - .unwrap() - .parse::() - .unwrap(); - - let event = match cb { - 0...2 | 64...65 => { - let button = match cb { - 0 => MouseButton::Left, - 1 => MouseButton::Middle, - 2 => MouseButton::Right, - 64 => MouseButton::WheelUp, - 65 => MouseButton::WheelDown, - _ => unreachable!(), - }; - match c { - b'M' => MouseEvent::Press(button, cx, cy), - b'm' => MouseEvent::Release(cx, cy), - _ => return None, - } - } - 32 => MouseEvent::Hold(cx, cy), - 3 => MouseEvent::Release(cx, cy), - _ => return None, - }; - - Event::Mouse(event) - } - Some(Ok(c @ b'0'...b'9')) => { - // Numbered escape code. - let mut buf = Vec::new(); - buf.push(c); - let mut c = iter.next().unwrap().unwrap(); - // The final byte of a CSI sequence can be in the range 64-126, so - // let's keep reading anything else. - while c < 64 || c > 126 { - buf.push(c); - c = iter.next().unwrap().unwrap(); - } - - match c { - // rxvt mouse encoding: - // ESC [ Cb ; Cx ; Cy ; M - b'M' => { - let str_buf = String::from_utf8(buf).unwrap(); - - let nums: Vec = str_buf.split(';').map(|n| n.parse().unwrap()).collect(); - - let cb = nums[0]; - let cx = nums[1]; - let cy = nums[2]; - - let event = match cb { - 32 => MouseEvent::Press(MouseButton::Left, cx, cy), - 33 => MouseEvent::Press(MouseButton::Middle, cx, cy), - 34 => MouseEvent::Press(MouseButton::Right, cx, cy), - 35 => MouseEvent::Release(cx, cy), - 64 => MouseEvent::Hold(cx, cy), - 96 | 97 => MouseEvent::Press(MouseButton::WheelUp, cx, cy), - _ => return None, - }; - - Event::Mouse(event) - } - // Special key code. - b'~' => { - let str_buf = String::from_utf8(buf).unwrap(); - - // This CSI sequence can be a list of semicolon-separated - // numbers. - let nums: Vec = str_buf.split(';').map(|n| n.parse().unwrap()).collect(); - - if nums.is_empty() { - return None; - } - - // TODO: handle multiple values for key modififiers (ex: values - // [3, 2] means Shift+Delete) - if nums.len() > 1 { - return None; - } - - match nums[0] { - 1 | 7 => Event::Key(Key::Home), - 2 => Event::Key(Key::Insert), - 3 => Event::Key(Key::Delete), - 4 | 8 => Event::Key(Key::End), - 5 => Event::Key(Key::PageUp), - 6 => Event::Key(Key::PageDown), - v @ 11...15 => Event::Key(Key::F(v - 10)), - v @ 17...21 => Event::Key(Key::F(v - 11)), - v @ 23...24 => Event::Key(Key::F(v - 12)), - _ => return None, - } - } - _ => return None, - } - } - _ => return None, - }) - -} - -/// Parse `c` as either a single byte ASCII char or a variable size UTF-8 char. -fn parse_utf8_char(c: u8, iter: &mut I) -> Result - where I: Iterator> -{ - let error = Err(Error::new(ErrorKind::Other, "Input character is not valid UTF-8")); - if c.is_ascii() { - Ok(c as char) - } else { - let bytes = &mut Vec::new(); - bytes.push(c); - - loop { - match iter.next() { - Some(Ok(next)) => { - bytes.push(next); - if let Ok(st) = str::from_utf8(bytes) { - return Ok(st.chars().next().unwrap()); - } - if bytes.len() >= 4 { - return error; - } - } - _ => return error, - } - } - } -} - -#[cfg(test)] -#[test] -fn test_parse_utf8() { - let st = "abcéŷ¤£€ù%323"; - let ref mut bytes = st.bytes().map(|x| Ok(x)); - let chars = st.chars(); - for c in chars { - let b = bytes.next().unwrap().unwrap(); - assert!(c == parse_utf8_char(b, bytes).unwrap()); - } -} diff -Nru cargo-0.35.0/vendor/termion/src/input.rs cargo-0.37.0/vendor/termion/src/input.rs --- cargo-0.35.0/vendor/termion/src/input.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/input.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,388 +0,0 @@ -//! User input. - -use std::io::{self, Read, Write}; -use std::ops; - -use event::{self, Event, Key}; -use raw::IntoRawMode; - -/// An iterator over input keys. -pub struct Keys { - iter: Events, -} - -impl Iterator for Keys { - type Item = Result; - - fn next(&mut self) -> Option> { - loop { - match self.iter.next() { - Some(Ok(Event::Key(k))) => return Some(Ok(k)), - Some(Ok(_)) => continue, - e @ Some(Err(_)) => e, - None => return None, - }; - } - } -} - -/// An iterator over input events. -pub struct Events { - inner: EventsAndRaw -} - -impl Iterator for Events { - type Item = Result; - - fn next(&mut self) -> Option> { - self.inner.next().map(|tuple| tuple.map(|(event, _raw)| event)) - } -} - -/// An iterator over input events and the bytes that define them. -pub struct EventsAndRaw { - source: R, - leftover: Option, -} - -impl Iterator for EventsAndRaw { - type Item = Result<(Event, Vec), io::Error>; - - fn next(&mut self) -> Option), io::Error>> { - let source = &mut self.source; - - if let Some(c) = self.leftover { - // we have a leftover byte, use it - self.leftover = None; - return Some(parse_event(c, &mut source.bytes())); - } - - // Here we read two bytes at a time. We need to distinguish between single ESC key presses, - // and escape sequences (which start with ESC or a x1B byte). The idea is that if this is - // an escape sequence, we will read multiple bytes (the first byte being ESC) but if this - // is a single ESC keypress, we will only read a single byte. - let mut buf = [0u8; 2]; - let res = match source.read(&mut buf) { - Ok(0) => return None, - Ok(1) => { - match buf[0] { - b'\x1B' => Ok((Event::Key(Key::Esc), vec![b'\x1B'])), - c => parse_event(c, &mut source.bytes()), - } - } - Ok(2) => { - let mut option_iter = &mut Some(buf[1]).into_iter(); - let result = { - let mut iter = option_iter.map(|c| Ok(c)).chain(source.bytes()); - parse_event(buf[0], &mut iter) - }; - // If the option_iter wasn't consumed, keep the byte for later. - self.leftover = option_iter.next(); - result - } - Ok(_) => unreachable!(), - Err(e) => Err(e), - }; - - Some(res) - } -} - -fn parse_event(item: u8, iter: &mut I) -> Result<(Event, Vec), io::Error> - where I: Iterator> -{ - let mut buf = vec![item]; - let result = { - let mut iter = iter.inspect(|byte| if let &Ok(byte) = byte { - buf.push(byte); - }); - event::parse_event(item, &mut iter) - }; - result.or(Ok(Event::Unsupported(buf.clone()))).map(|e| (e, buf)) -} - - -/// Extension to `Read` trait. -pub trait TermRead { - /// An iterator over input events. - fn events(self) -> Events where Self: Sized; - - /// An iterator over key inputs. - fn keys(self) -> Keys where Self: Sized; - - /// Read a line. - /// - /// EOT and ETX will abort the prompt, returning `None`. Newline or carriage return will - /// complete the input. - fn read_line(&mut self) -> io::Result>; - - /// Read a password. - /// - /// EOT and ETX will abort the prompt, returning `None`. Newline or carriage return will - /// complete the input. - fn read_passwd(&mut self, writer: &mut W) -> io::Result> { - let _raw = try!(writer.into_raw_mode()); - self.read_line() - } -} - - -impl TermRead for R { - fn events(self) -> Events { - Events { - inner: self.events_and_raw() - } - } - fn keys(self) -> Keys { - Keys { iter: self.events() } - } - - fn read_line(&mut self) -> io::Result> { - let mut buf = Vec::with_capacity(30); - - for c in self.bytes() { - match c { - Err(e) => return Err(e), - Ok(0) | Ok(3) | Ok(4) => return Ok(None), - Ok(0x7f) => { - buf.pop(); - } - Ok(b'\n') | Ok(b'\r') => break, - Ok(c) => buf.push(c), - } - } - - let string = try!(String::from_utf8(buf) - .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))); - Ok(Some(string)) - } -} - -/// Extension to `TermRead` trait. A separate trait in order to maintain backwards compatibility. -pub trait TermReadEventsAndRaw { - /// An iterator over input events and the bytes that define them. - fn events_and_raw(self) -> EventsAndRaw where Self: Sized; -} - -impl TermReadEventsAndRaw for R { - fn events_and_raw(self) -> EventsAndRaw { - EventsAndRaw { - source: self, - leftover: None, - } - } -} - -/// A sequence of escape codes to enable terminal mouse support. -const ENTER_MOUSE_SEQUENCE: &'static str = csi!("?1000h\x1b[?1002h\x1b[?1015h\x1b[?1006h"); - -/// A sequence of escape codes to disable terminal mouse support. -const EXIT_MOUSE_SEQUENCE: &'static str = csi!("?1006l\x1b[?1015l\x1b[?1002l\x1b[?1000l"); - -/// A terminal with added mouse support. -/// -/// This can be obtained through the `From` implementations. -pub struct MouseTerminal { - term: W, -} - -impl From for MouseTerminal { - fn from(mut from: W) -> MouseTerminal { - from.write_all(ENTER_MOUSE_SEQUENCE.as_bytes()).unwrap(); - - MouseTerminal { term: from } - } -} - -impl Drop for MouseTerminal { - fn drop(&mut self) { - self.term.write_all(EXIT_MOUSE_SEQUENCE.as_bytes()).unwrap(); - } -} - -impl ops::Deref for MouseTerminal { - type Target = W; - - fn deref(&self) -> &W { - &self.term - } -} - -impl ops::DerefMut for MouseTerminal { - fn deref_mut(&mut self) -> &mut W { - &mut self.term - } -} - -impl Write for MouseTerminal { - fn write(&mut self, buf: &[u8]) -> io::Result { - self.term.write(buf) - } - - fn flush(&mut self) -> io::Result<()> { - self.term.flush() - } -} - -#[cfg(test)] -mod test { - use super::*; - use std::io; - use event::{Key, Event, MouseEvent, MouseButton}; - - #[test] - fn test_keys() { - let mut i = b"\x1Bayo\x7F\x1B[D".keys(); - - assert_eq!(i.next().unwrap().unwrap(), Key::Alt('a')); - assert_eq!(i.next().unwrap().unwrap(), Key::Char('y')); - assert_eq!(i.next().unwrap().unwrap(), Key::Char('o')); - assert_eq!(i.next().unwrap().unwrap(), Key::Backspace); - assert_eq!(i.next().unwrap().unwrap(), Key::Left); - assert!(i.next().is_none()); - } - - #[test] - fn test_events() { - let mut i = - b"\x1B[\x00bc\x7F\x1B[D\ - \x1B[M\x00\x22\x24\x1B[<0;2;4;M\x1B[32;2;4M\x1B[<0;2;4;m\x1B[35;2;4Mb" - .events(); - - assert_eq!(i.next().unwrap().unwrap(), - Event::Unsupported(vec![0x1B, b'[', 0x00])); - assert_eq!(i.next().unwrap().unwrap(), Event::Key(Key::Char('b'))); - assert_eq!(i.next().unwrap().unwrap(), Event::Key(Key::Char('c'))); - assert_eq!(i.next().unwrap().unwrap(), Event::Key(Key::Backspace)); - assert_eq!(i.next().unwrap().unwrap(), Event::Key(Key::Left)); - assert_eq!(i.next().unwrap().unwrap(), - Event::Mouse(MouseEvent::Press(MouseButton::WheelUp, 2, 4))); - assert_eq!(i.next().unwrap().unwrap(), - Event::Mouse(MouseEvent::Press(MouseButton::Left, 2, 4))); - assert_eq!(i.next().unwrap().unwrap(), - Event::Mouse(MouseEvent::Press(MouseButton::Left, 2, 4))); - assert_eq!(i.next().unwrap().unwrap(), - Event::Mouse(MouseEvent::Release(2, 4))); - assert_eq!(i.next().unwrap().unwrap(), - Event::Mouse(MouseEvent::Release(2, 4))); - assert_eq!(i.next().unwrap().unwrap(), Event::Key(Key::Char('b'))); - assert!(i.next().is_none()); - } - - #[test] - fn test_events_and_raw() { - let input = b"\x1B[\x00bc\x7F\x1B[D\ - \x1B[M\x00\x22\x24\x1B[<0;2;4;M\x1B[32;2;4M\x1B[<0;2;4;m\x1B[35;2;4Mb"; - let mut output = Vec::::new(); - { - let mut i = input.events_and_raw().map(|res| res.unwrap()) - .inspect(|&(_, ref raw)| { output.extend(raw); }).map(|(event, _)| event); - - assert_eq!(i.next().unwrap(), - Event::Unsupported(vec![0x1B, b'[', 0x00])); - assert_eq!(i.next().unwrap(), Event::Key(Key::Char('b'))); - assert_eq!(i.next().unwrap(), Event::Key(Key::Char('c'))); - assert_eq!(i.next().unwrap(), Event::Key(Key::Backspace)); - assert_eq!(i.next().unwrap(), Event::Key(Key::Left)); - assert_eq!(i.next().unwrap(), - Event::Mouse(MouseEvent::Press(MouseButton::WheelUp, 2, 4))); - assert_eq!(i.next().unwrap(), - Event::Mouse(MouseEvent::Press(MouseButton::Left, 2, 4))); - assert_eq!(i.next().unwrap(), - Event::Mouse(MouseEvent::Press(MouseButton::Left, 2, 4))); - assert_eq!(i.next().unwrap(), - Event::Mouse(MouseEvent::Release(2, 4))); - assert_eq!(i.next().unwrap(), - Event::Mouse(MouseEvent::Release(2, 4))); - assert_eq!(i.next().unwrap(), Event::Key(Key::Char('b'))); - assert!(i.next().is_none()); - } - - assert_eq!(input.iter().map(|b| *b).collect::>(), output) - } - - #[test] - fn test_function_keys() { - let mut st = b"\x1BOP\x1BOQ\x1BOR\x1BOS".keys(); - for i in 1..5 { - assert_eq!(st.next().unwrap().unwrap(), Key::F(i)); - } - - let mut st = b"\x1B[11~\x1B[12~\x1B[13~\x1B[14~\x1B[15~\ - \x1B[17~\x1B[18~\x1B[19~\x1B[20~\x1B[21~\x1B[23~\x1B[24~" - .keys(); - for i in 1..13 { - assert_eq!(st.next().unwrap().unwrap(), Key::F(i)); - } - } - - #[test] - fn test_special_keys() { - let mut st = b"\x1B[2~\x1B[H\x1B[7~\x1B[5~\x1B[3~\x1B[F\x1B[8~\x1B[6~".keys(); - assert_eq!(st.next().unwrap().unwrap(), Key::Insert); - assert_eq!(st.next().unwrap().unwrap(), Key::Home); - assert_eq!(st.next().unwrap().unwrap(), Key::Home); - assert_eq!(st.next().unwrap().unwrap(), Key::PageUp); - assert_eq!(st.next().unwrap().unwrap(), Key::Delete); - assert_eq!(st.next().unwrap().unwrap(), Key::End); - assert_eq!(st.next().unwrap().unwrap(), Key::End); - assert_eq!(st.next().unwrap().unwrap(), Key::PageDown); - assert!(st.next().is_none()); - } - - #[test] - fn test_esc_key() { - let mut st = b"\x1B".keys(); - assert_eq!(st.next().unwrap().unwrap(), Key::Esc); - assert!(st.next().is_none()); - } - - fn line_match(a: &str, b: Option<&str>) { - let mut sink = io::sink(); - - let line = a.as_bytes().read_line().unwrap(); - let pass = a.as_bytes().read_passwd(&mut sink).unwrap(); - - // godammit rustc - - assert_eq!(line, pass); - - if let Some(l) = line { - assert_eq!(Some(l.as_str()), b); - } else { - assert!(b.is_none()); - } - } - - #[test] - fn test_read() { - let test1 = "this is the first test"; - let test2 = "this is the second test"; - - line_match(test1, Some(test1)); - line_match(test2, Some(test2)); - } - - #[test] - fn test_backspace() { - line_match("this is the\x7f first\x7f\x7f test", - Some("this is th fir test")); - line_match("this is the seco\x7fnd test\x7f", - Some("this is the secnd tes")); - } - - #[test] - fn test_end() { - line_match("abc\nhttps://www.youtube.com/watch?v=dQw4w9WgXcQ", - Some("abc")); - line_match("hello\rhttps://www.youtube.com/watch?v=yPYZpwSpKmA", - Some("hello")); - } - - #[test] - fn test_abort() { - line_match("abc\x03https://www.youtube.com/watch?v=dQw4w9WgXcQ", None); - line_match("hello\x04https://www.youtube.com/watch?v=yPYZpwSpKmA", None); - } - -} diff -Nru cargo-0.35.0/vendor/termion/src/lib.rs cargo-0.37.0/vendor/termion/src/lib.rs --- cargo-0.35.0/vendor/termion/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/lib.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -//! Termion is a pure Rust, bindless library for low-level handling, manipulating -//! and reading information about terminals. This provides a full-featured -//! alternative to Termbox. -//! -//! Termion aims to be simple and yet expressive. It is bindless, meaning that it -//! is not a front-end to some other library (e.g., ncurses or termbox), but a -//! standalone library directly talking to the TTY. -//! -//! Supports Redox, Mac OS X, and Linux (or, in general, ANSI terminals). -//! -//! For more information refer to the [README](https://github.com/redox-os/termion). -#![warn(missing_docs)] - -extern crate numtoa; - -#[cfg(target_os = "redox")] -#[path="sys/redox/mod.rs"] -mod sys; - -#[cfg(all(unix, not(target_os = "redox")))] -#[path="sys/unix/mod.rs"] -mod sys; - -pub use sys::size::terminal_size; -pub use sys::tty::{is_tty, get_tty}; - -mod async; -pub use async::{AsyncReader, async_stdin}; - -#[macro_use] -mod macros; -pub mod clear; -pub mod color; -pub mod cursor; -pub mod event; -pub mod input; -pub mod raw; -pub mod screen; -pub mod scroll; -pub mod style; - -#[cfg(test)] -mod test { - use super::sys; - - #[test] - fn test_get_terminal_attr() { - sys::attr::get_terminal_attr().unwrap(); - sys::attr::get_terminal_attr().unwrap(); - sys::attr::get_terminal_attr().unwrap(); - } - - #[test] - fn test_set_terminal_attr() { - let ios = sys::attr::get_terminal_attr().unwrap(); - sys::attr::set_terminal_attr(&ios).unwrap(); - } - - #[test] - fn test_size() { - sys::size::terminal_size().unwrap(); - } -} diff -Nru cargo-0.35.0/vendor/termion/src/macros.rs cargo-0.37.0/vendor/termion/src/macros.rs --- cargo-0.35.0/vendor/termion/src/macros.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/macros.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -/// Create a CSI-introduced sequence. -macro_rules! csi { - ($( $l:expr ),*) => { concat!("\x1B[", $( $l ),*) }; -} - -/// Derive a CSI sequence struct. -macro_rules! derive_csi_sequence { - ($doc:expr, $name:ident, $value:expr) => { - #[doc = $doc] - #[derive(Copy, Clone)] - pub struct $name; - - impl fmt::Display for $name { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, csi!($value)) - } - } - - impl AsRef<[u8]> for $name { - fn as_ref(&self) -> &'static [u8] { csi!($value).as_bytes() } - } - - impl AsRef for $name { - fn as_ref(&self) -> &'static str { csi!($value) } - } - }; -} diff -Nru cargo-0.35.0/vendor/termion/src/raw.rs cargo-0.37.0/vendor/termion/src/raw.rs --- cargo-0.35.0/vendor/termion/src/raw.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/raw.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,131 +0,0 @@ -//! Managing raw mode. -//! -//! Raw mode is a particular state a TTY can have. It signifies that: -//! -//! 1. No line buffering (the input is given byte-by-byte). -//! 2. The input is not written out, instead it has to be done manually by the programmer. -//! 3. The output is not canonicalized (for example, `\n` means "go one line down", not "line -//! break"). -//! -//! It is essential to design terminal programs. -//! -//! # Example -//! -//! ```rust,no_run -//! use termion::raw::IntoRawMode; -//! use std::io::{Write, stdout}; -//! -//! fn main() { -//! let mut stdout = stdout().into_raw_mode().unwrap(); -//! -//! write!(stdout, "Hey there.").unwrap(); -//! } -//! ``` - -use std::io::{self, Write}; -use std::ops; - -use sys::Termios; -use sys::attr::{get_terminal_attr, raw_terminal_attr, set_terminal_attr}; - -/// The timeout of an escape code control sequence, in milliseconds. -pub const CONTROL_SEQUENCE_TIMEOUT: u64 = 100; - -/// A terminal restorer, which keeps the previous state of the terminal, and restores it, when -/// dropped. -/// -/// Restoring will entirely bring back the old TTY state. -pub struct RawTerminal { - prev_ios: Termios, - output: W, -} - -impl Drop for RawTerminal { - fn drop(&mut self) { - set_terminal_attr(&self.prev_ios).unwrap(); - } -} - -impl ops::Deref for RawTerminal { - type Target = W; - - fn deref(&self) -> &W { - &self.output - } -} - -impl ops::DerefMut for RawTerminal { - fn deref_mut(&mut self) -> &mut W { - &mut self.output - } -} - -impl Write for RawTerminal { - fn write(&mut self, buf: &[u8]) -> io::Result { - self.output.write(buf) - } - - fn flush(&mut self) -> io::Result<()> { - self.output.flush() - } -} - -/// Types which can be converted into "raw mode". -/// -/// # Why is this type defined on writers and not readers? -/// -/// TTYs has their state controlled by the writer, not the reader. You use the writer to clear the -/// screen, move the cursor and so on, so naturally you use the writer to change the mode as well. -pub trait IntoRawMode: Write + Sized { - /// Switch to raw mode. - /// - /// Raw mode means that stdin won't be printed (it will instead have to be written manually by - /// the program). Furthermore, the input isn't canonicalised or buffered (that is, you can - /// read from stdin one byte of a time). The output is neither modified in any way. - fn into_raw_mode(self) -> io::Result>; -} - -impl IntoRawMode for W { - fn into_raw_mode(self) -> io::Result> { - let mut ios = get_terminal_attr()?; - let prev_ios = ios; - - raw_terminal_attr(&mut ios); - - set_terminal_attr(&ios)?; - - Ok(RawTerminal { - prev_ios: prev_ios, - output: self, - }) - } -} - -impl RawTerminal { - pub fn suspend_raw_mode(&self) -> io::Result<()> { - set_terminal_attr(&self.prev_ios)?; - Ok(()) - } - - pub fn activate_raw_mode(&self) -> io::Result<()> { - let mut ios = get_terminal_attr()?; - raw_terminal_attr(&mut ios); - set_terminal_attr(&ios)?; - Ok(()) - } -} - -#[cfg(test)] -mod test { - use super::*; - use std::io::{Write, stdout}; - - #[test] - fn test_into_raw_mode() { - let mut out = stdout().into_raw_mode().unwrap(); - - out.write_all(b"this is a test, muahhahahah\r\n").unwrap(); - - drop(out); - } -} diff -Nru cargo-0.35.0/vendor/termion/src/screen.rs cargo-0.37.0/vendor/termion/src/screen.rs --- cargo-0.35.0/vendor/termion/src/screen.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/screen.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -//! Managing switching between main and alternate screen buffers. -//! -//! Note that this implementation uses xterm's new escape sequences for screen switching and thus -//! only works for xterm compatible terminals (which should be most terminals nowadays). -//! -//! # Example -//! -//! ```rust -//! use termion::screen::AlternateScreen; -//! use std::io::{Write, stdout}; -//! -//! fn main() { -//! { -//! let mut screen = AlternateScreen::from(stdout()); -//! write!(screen, "Writing to alternate screen!").unwrap(); -//! screen.flush().unwrap(); -//! } -//! println!("Writing to main screen."); -//! } -//! ``` - -use std::io::{self, Write}; -use std::ops; -use std::fmt; - -/// Switch to the main screen buffer of the terminal. -pub struct ToMainScreen; - -impl fmt::Display for ToMainScreen { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, csi!("?1049l")) - } -} - -/// Switch to the alternate screen buffer of the terminal. -pub struct ToAlternateScreen; - -impl fmt::Display for ToAlternateScreen { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, csi!("?1049h")) - } -} - -/// A terminal restorer, which wraps a type implementing Write, and causes all writes to be written -/// to an alternate screen. -/// -/// This is achieved by switching the terminal to the alternate screen on creation and -/// automatically switching it back to the original screen on drop. -pub struct AlternateScreen { - /// The output target. - output: W, -} - -impl AlternateScreen { - /// Create an alternate screen wrapper struct for the provided output and switch the terminal - /// to the alternate screen. - pub fn from(mut output: W) -> Self { - write!(output, "{}", ToAlternateScreen).expect("switch to alternate screen"); - AlternateScreen { output: output } - } -} - -impl Drop for AlternateScreen { - fn drop(&mut self) { - write!(self, "{}", ToMainScreen).expect("switch to main screen"); - } -} - -impl ops::Deref for AlternateScreen { - type Target = W; - - fn deref(&self) -> &W { - &self.output - } -} - -impl ops::DerefMut for AlternateScreen { - fn deref_mut(&mut self) -> &mut W { - &mut self.output - } -} - -impl Write for AlternateScreen { - fn write(&mut self, buf: &[u8]) -> io::Result { - self.output.write(buf) - } - - fn flush(&mut self) -> io::Result<()> { - self.output.flush() - } -} diff -Nru cargo-0.35.0/vendor/termion/src/scroll.rs cargo-0.37.0/vendor/termion/src/scroll.rs --- cargo-0.35.0/vendor/termion/src/scroll.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/scroll.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -//! Scrolling. - -use std::fmt; - -/// Scroll up. -#[derive(Copy, Clone, PartialEq, Eq)] -pub struct Up(pub u16); - -impl fmt::Display for Up { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, csi!("{}S"), self.0) - } -} - -/// Scroll down. -#[derive(Copy, Clone, PartialEq, Eq)] -pub struct Down(pub u16); - -impl fmt::Display for Down { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, csi!("{}T"), self.0) - } -} diff -Nru cargo-0.35.0/vendor/termion/src/style.rs cargo-0.37.0/vendor/termion/src/style.rs --- cargo-0.35.0/vendor/termion/src/style.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/style.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -//! Text styling management. - -use std::fmt; - -derive_csi_sequence!("Reset SGR parameters.", Reset, "m"); -derive_csi_sequence!("Bold text.", Bold, "1m"); -derive_csi_sequence!("Fainted text (not widely supported).", Faint, "2m"); -derive_csi_sequence!("Italic text.", Italic, "3m"); -derive_csi_sequence!("Underlined text.", Underline, "4m"); -derive_csi_sequence!("Blinking text (not widely supported).", Blink, "5m"); -derive_csi_sequence!("Inverted colors (negative mode).", Invert, "7m"); -derive_csi_sequence!("Crossed out text (not widely supported).", CrossedOut, "9m"); -derive_csi_sequence!("Undo bold text.", NoBold, "21m"); -derive_csi_sequence!("Undo fainted text (not widely supported).", NoFaint, "22m"); -derive_csi_sequence!("Undo italic text.", NoItalic, "23m"); -derive_csi_sequence!("Undo underlined text.", NoUnderline, "24m"); -derive_csi_sequence!("Undo blinking text (not widely supported).", NoBlink, "25m"); -derive_csi_sequence!("Undo inverted colors (negative mode).", NoInvert, "27m"); -derive_csi_sequence!("Undo crossed out text (not widely supported).", - NoCrossedOut, - "29m"); -derive_csi_sequence!("Framed text (not widely supported).", Framed, "51m"); diff -Nru cargo-0.35.0/vendor/termion/src/sys/redox/attr.rs cargo-0.37.0/vendor/termion/src/sys/redox/attr.rs --- cargo-0.35.0/vendor/termion/src/sys/redox/attr.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/sys/redox/attr.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -use std::io; - -use super::{cvt, syscall, Termios}; - -pub fn get_terminal_attr() -> io::Result { - let mut termios = Termios::default(); - - let fd = cvt(syscall::dup(0, b"termios"))?; - let res = cvt(syscall::read(fd, &mut termios)); - let _ = syscall::close(fd); - - if res? == termios.len() { - Ok(termios) - } else { - Err(io::Error::new(io::ErrorKind::Other, "Unable to get the terminal attributes.")) - } -} - -pub fn set_terminal_attr(termios: &Termios) -> io::Result<()> { - let fd = cvt(syscall::dup(0, b"termios"))?; - let res = cvt(syscall::write(fd, termios)); - let _ = syscall::close(fd); - - if res? == termios.len() { - Ok(()) - } else { - Err(io::Error::new(io::ErrorKind::Other, "Unable to set the terminal attributes.")) - } -} - -pub fn raw_terminal_attr(ios: &mut Termios) { - ios.make_raw() -} diff -Nru cargo-0.35.0/vendor/termion/src/sys/redox/mod.rs cargo-0.37.0/vendor/termion/src/sys/redox/mod.rs --- cargo-0.35.0/vendor/termion/src/sys/redox/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/sys/redox/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -extern crate redox_termios; -extern crate syscall; - -use std::io; - -pub use self::redox_termios::Termios; - -pub mod attr; -pub mod size; -pub mod tty; - -// Support function for converting syscall error to io error -fn cvt(result: Result) -> io::Result { - result.map_err(|err| io::Error::from_raw_os_error(err.errno)) -} diff -Nru cargo-0.35.0/vendor/termion/src/sys/redox/size.rs cargo-0.37.0/vendor/termion/src/sys/redox/size.rs --- cargo-0.35.0/vendor/termion/src/sys/redox/size.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/sys/redox/size.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -use std::io; - -use super::{cvt, redox_termios, syscall}; - -/// Get the size of the terminal. -pub fn terminal_size() -> io::Result<(u16, u16)> { - let mut winsize = redox_termios::Winsize::default(); - - let fd = cvt(syscall::dup(1, b"winsize"))?; - let res = cvt(syscall::read(fd, &mut winsize)); - let _ = syscall::close(fd); - - if res? == winsize.len() { - Ok((winsize.ws_col, winsize.ws_row)) - } else { - Err(io::Error::new(io::ErrorKind::Other, "Unable to get the terminal size.")) - } -} diff -Nru cargo-0.35.0/vendor/termion/src/sys/redox/tty.rs cargo-0.37.0/vendor/termion/src/sys/redox/tty.rs --- cargo-0.35.0/vendor/termion/src/sys/redox/tty.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/sys/redox/tty.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -use std::{env, fs, io}; -use std::os::unix::io::AsRawFd; - -use super::syscall; - -/// Is this stream a TTY? -pub fn is_tty(stream: &T) -> bool { - if let Ok(fd) = syscall::dup(stream.as_raw_fd() as _, b"termios") { - let _ = syscall::close(fd); - true - } else { - false - } -} - -/// Get the TTY device. -/// -/// This allows for getting stdio representing _only_ the TTY, and not other streams. -pub fn get_tty() -> io::Result { - let tty = try!(env::var("TTY").map_err(|x| io::Error::new(io::ErrorKind::NotFound, x))); - fs::OpenOptions::new().read(true).write(true).open(tty) -} diff -Nru cargo-0.35.0/vendor/termion/src/sys/unix/attr.rs cargo-0.37.0/vendor/termion/src/sys/unix/attr.rs --- cargo-0.35.0/vendor/termion/src/sys/unix/attr.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/sys/unix/attr.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -use std::{io, mem}; - -use super::{cvt, Termios}; -use super::libc::c_int; - -pub fn get_terminal_attr() -> io::Result { - extern "C" { - pub fn tcgetattr(fd: c_int, termptr: *mut Termios) -> c_int; - } - unsafe { - let mut termios = mem::zeroed(); - cvt(tcgetattr(0, &mut termios))?; - Ok(termios) - } -} - -pub fn set_terminal_attr(termios: &Termios) -> io::Result<()> { - extern "C" { - pub fn tcsetattr(fd: c_int, opt: c_int, termptr: *const Termios) -> c_int; - } - cvt(unsafe { tcsetattr(0, 0, termios) }).and(Ok(())) -} - -pub fn raw_terminal_attr(termios: &mut Termios) { - extern "C" { - pub fn cfmakeraw(termptr: *mut Termios); - } - unsafe { cfmakeraw(termios) } -} diff -Nru cargo-0.35.0/vendor/termion/src/sys/unix/mod.rs cargo-0.37.0/vendor/termion/src/sys/unix/mod.rs --- cargo-0.35.0/vendor/termion/src/sys/unix/mod.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/sys/unix/mod.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -extern crate libc; - -use std::io; - -pub use self::libc::termios as Termios; - -pub mod attr; -pub mod size; -pub mod tty; - -// Support functions for converting libc return values to io errors { -trait IsMinusOne { - fn is_minus_one(&self) -> bool; -} - -macro_rules! impl_is_minus_one { - ($($t:ident)*) => ($(impl IsMinusOne for $t { - fn is_minus_one(&self) -> bool { - *self == -1 - } - })*) - } - -impl_is_minus_one! { i8 i16 i32 i64 isize } - -fn cvt(t: T) -> io::Result { - if t.is_minus_one() { - Err(io::Error::last_os_error()) - } else { - Ok(t) - } -} -// } End of support functions diff -Nru cargo-0.35.0/vendor/termion/src/sys/unix/size.rs cargo-0.37.0/vendor/termion/src/sys/unix/size.rs --- cargo-0.35.0/vendor/termion/src/sys/unix/size.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/sys/unix/size.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -use std::{io, mem}; - -use super::cvt; -use super::libc::{c_ushort, ioctl, STDOUT_FILENO, TIOCGWINSZ}; - -#[repr(C)] -struct TermSize { - row: c_ushort, - col: c_ushort, - _x: c_ushort, - _y: c_ushort, -} -/// Get the size of the terminal. -pub fn terminal_size() -> io::Result<(u16, u16)> { - unsafe { - let mut size: TermSize = mem::zeroed(); - cvt(ioctl(STDOUT_FILENO, TIOCGWINSZ.into(), &mut size as *mut _))?; - Ok((size.col as u16, size.row as u16)) - } -} diff -Nru cargo-0.35.0/vendor/termion/src/sys/unix/tty.rs cargo-0.37.0/vendor/termion/src/sys/unix/tty.rs --- cargo-0.35.0/vendor/termion/src/sys/unix/tty.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/termion/src/sys/unix/tty.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -use std::{fs, io}; -use std::os::unix::io::AsRawFd; - -use super::libc; - - -/// Is this stream a TTY? -pub fn is_tty(stream: &T) -> bool { - unsafe { libc::isatty(stream.as_raw_fd()) == 1 } -} - -/// Get the TTY device. -/// -/// This allows for getting stdio representing _only_ the TTY, and not other streams. -pub fn get_tty() -> io::Result { - fs::OpenOptions::new().read(true).write(true).open("/dev/tty") -} diff -Nru cargo-0.35.0/vendor/toml/.cargo-checksum.json cargo-0.37.0/vendor/toml/.cargo-checksum.json --- cargo-0.35.0/vendor/toml/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/toml/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f"} \ No newline at end of file +{"files":{},"package":"b8c96d7873fa7ef8bdeb3a9cda3ac48389b4154f32b9803b4bc26220b677b039"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/toml/Cargo.toml cargo-0.37.0/vendor/toml/Cargo.toml --- cargo-0.35.0/vendor/toml/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/toml/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -11,8 +11,9 @@ # will likely look very different (and much more reasonable) [package] +edition = "2018" name = "toml" -version = "0.4.10" +version = "0.5.1" authors = ["Alex Crichton "] description = "A native Rust encoder and decoder of TOML-formatted files and streams. Provides\nimplementations of the standard Serialize/Deserialize traits for TOML data to\nfacilitate deserializing and serializing Rust structures.\n" homepage = "https://github.com/alexcrichton/toml-rs" @@ -22,6 +23,10 @@ categories = ["config", "encoding", "parser-implementations"] license = "MIT/Apache-2.0" repository = "https://github.com/alexcrichton/toml-rs" +[dependencies.linked-hash-map] +version = "0.5" +optional = true + [dependencies.serde] version = "1.0" [dev-dependencies.serde_derive] @@ -29,5 +34,9 @@ [dev-dependencies.serde_json] version = "1.0" + +[features] +default = [] +preserve_order = ["linked-hash-map"] [badges.travis-ci] repository = "alexcrichton/toml-rs" diff -Nru cargo-0.35.0/vendor/toml/examples/decode.rs cargo-0.37.0/vendor/toml/examples/decode.rs --- cargo-0.35.0/vendor/toml/examples/decode.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/toml/examples/decode.rs 2019-07-17 05:42:23.000000000 +0000 @@ -3,9 +3,7 @@ #![deny(warnings)] -extern crate toml; -#[macro_use] -extern crate serde_derive; +use serde_derive::Deserialize; /// This is what we're going to decode into. Each field is optional, meaning /// that it doesn't have to be present in TOML. diff -Nru cargo-0.35.0/vendor/toml/examples/enum_external.rs cargo-0.37.0/vendor/toml/examples/enum_external.rs --- cargo-0.35.0/vendor/toml/examples/enum_external.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/toml/examples/enum_external.rs 2019-07-17 05:42:23.000000000 +0000 @@ -3,9 +3,7 @@ #![deny(warnings)] -extern crate toml; -#[macro_use] -extern crate serde_derive; +use serde_derive::Deserialize; /// This is what we're going to decode into. #[derive(Debug, Deserialize)] diff -Nru cargo-0.35.0/vendor/toml/examples/toml2json.rs cargo-0.37.0/vendor/toml/examples/toml2json.rs --- cargo-0.35.0/vendor/toml/examples/toml2json.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/toml/examples/toml2json.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,24 +1,21 @@ #![deny(warnings)] -extern crate toml; -extern crate serde_json; - -use std::fs::File; use std::env; +use std::fs::File; use std::io; use std::io::prelude::*; -use toml::Value as Toml; use serde_json::Value as Json; +use toml::Value as Toml; fn main() { let mut args = env::args(); let mut input = String::new(); if args.len() > 1 { let name = args.nth(1).unwrap(); - File::open(&name).and_then(|mut f| { - f.read_to_string(&mut input) - }).unwrap(); + File::open(&name) + .and_then(|mut f| f.read_to_string(&mut input)) + .unwrap(); } else { io::stdin().read_to_string(&mut input).unwrap(); } @@ -37,15 +34,14 @@ Toml::String(s) => Json::String(s), Toml::Integer(i) => Json::Number(i.into()), Toml::Float(f) => { - let n = serde_json::Number::from_f64(f) - .expect("float infinite and nan not allowed"); + let n = serde_json::Number::from_f64(f).expect("float infinite and nan not allowed"); Json::Number(n) } Toml::Boolean(b) => Json::Bool(b), Toml::Array(arr) => Json::Array(arr.into_iter().map(convert).collect()), - Toml::Table(table) => Json::Object(table.into_iter().map(|(k, v)| { - (k, convert(v)) - }).collect()), + Toml::Table(table) => { + Json::Object(table.into_iter().map(|(k, v)| (k, convert(v))).collect()) + } Toml::Datetime(dt) => Json::String(dt.to_string()), } } diff -Nru cargo-0.35.0/vendor/toml/README.md cargo-0.37.0/vendor/toml/README.md --- cargo-0.35.0/vendor/toml/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/toml/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -1,6 +1,6 @@ # toml-rs -[![Build Status](https://travis-ci.org/alexcrichton/toml-rs.svg?branch=master)](https://travis-ci.org/alexcrichton/toml-rs) +[![Build Status](https://travis-ci.com/alexcrichton/toml-rs.svg?branch=master)](https://travis-ci.com/alexcrichton/toml-rs) [![Coverage Status](https://coveralls.io/repos/alexcrichton/toml-rs/badge.svg?branch=master&service=github)](https://coveralls.io/github/alexcrichton/toml-rs?branch=master) [![Latest Version](https://img.shields.io/crates/v/toml.svg)](https://crates.io/crates/toml) [![Documentation](https://docs.rs/toml/badge.svg)](https://docs.rs/toml) @@ -14,7 +14,7 @@ ```toml # Cargo.toml [dependencies] -toml = "0.4" +toml = "0.5" ``` This crate also supports serialization/deserialization through the diff -Nru cargo-0.35.0/vendor/toml/src/datetime.rs cargo-0.37.0/vendor/toml/src/datetime.rs --- cargo-0.35.0/vendor/toml/src/datetime.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/toml/src/datetime.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,6 +1,6 @@ +use std::error; use std::fmt; use std::str::{self, FromStr}; -use std::error; use serde::{de, ser}; @@ -65,13 +65,13 @@ } impl fmt::Debug for Datetime { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(self, f) } } impl fmt::Display for Datetime { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if let Some(ref date) = self.date { write!(f, "{}", date)?; } @@ -89,29 +89,27 @@ } impl fmt::Display for Date { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{:04}-{:02}-{:02}", self.year, self.month, self.day) } } impl fmt::Display for Time { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{:02}:{:02}:{:02}", self.hour, self.minute, self.second)?; if self.nanosecond != 0 { let s = format!("{:09}", self.nanosecond); - write!(f, ".{}", s.trim_right_matches('0'))?; + write!(f, ".{}", s.trim_end_matches('0'))?; } Ok(()) } } impl fmt::Display for Offset { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { Offset::Z => write!(f, "Z"), - Offset::Custom { hours, minutes } => { - write!(f, "{:+03}:{:02}", hours, minutes) - } + Offset::Custom { hours, minutes } => write!(f, "{:+03}:{:02}", hours, minutes), } } } @@ -127,7 +125,7 @@ // 0000-00-00 // 00:00:00.00 if date.len() < 3 { - return Err(DatetimeParseError { _private: () }) + return Err(DatetimeParseError { _private: () }); } let mut offset_allowed = true; let mut chars = date.chars(); @@ -165,19 +163,20 @@ }; if date.month < 1 || date.month > 12 { - return Err(DatetimeParseError { _private: () }) + return Err(DatetimeParseError { _private: () }); } if date.day < 1 || date.day > 31 { - return Err(DatetimeParseError { _private: () }) + return Err(DatetimeParseError { _private: () }); } Some(date) }; // Next parse the "partial-time" if available - let partial_time = if full_date.is_some() && - (chars.clone().next() == Some('T') - || chars.clone().next() == Some(' ')) { + let next = chars.clone().next(); + let partial_time = if full_date.is_some() + && (next == Some('T') || next == Some('t') || next == Some(' ')) + { chars.next(); true } else { @@ -208,7 +207,7 @@ let mut end = whole.len(); for (i, byte) in whole.bytes().enumerate() { match byte { - b'0' ... b'9' => { + b'0'..=b'9' => { if i < 9 { let p = 10_u32.pow(8 - i as u32); nanosecond += p * (byte - b'0') as u32; @@ -221,7 +220,7 @@ } } if end == 0 { - return Err(DatetimeParseError { _private: () }) + return Err(DatetimeParseError { _private: () }); } chars = whole[end..].chars(); } @@ -234,16 +233,16 @@ }; if time.hour > 24 { - return Err(DatetimeParseError { _private: () }) + return Err(DatetimeParseError { _private: () }); } if time.minute > 59 { - return Err(DatetimeParseError { _private: () }) + return Err(DatetimeParseError { _private: () }); } if time.second > 59 { - return Err(DatetimeParseError { _private: () }) + return Err(DatetimeParseError { _private: () }); } if time.nanosecond > 999_999_999 { - return Err(DatetimeParseError { _private: () }) + return Err(DatetimeParseError { _private: () }); } Some(time) @@ -255,7 +254,7 @@ // And finally, parse the offset let offset = if offset_allowed { let next = chars.clone().next(); - if next == Some('Z') { + if next == Some('Z') || next == Some('z') { chars.next(); Some(Offset::Z) } else if next.is_none() { @@ -288,7 +287,7 @@ // Return an error if we didn't hit eof, otherwise return our parsed // date if chars.next().is_some() { - return Err(DatetimeParseError { _private: () }) + return Err(DatetimeParseError { _private: () }); } Ok(Datetime { @@ -299,7 +298,7 @@ } } -fn digit(chars: &mut str::Chars) -> Result { +fn digit(chars: &mut str::Chars<'_>) -> Result { match chars.next() { Some(c) if '0' <= c && c <= '9' => Ok(c as u8 - b'0'), _ => Err(DatetimeParseError { _private: () }), @@ -308,7 +307,8 @@ impl ser::Serialize for Datetime { fn serialize(&self, serializer: S) -> Result - where S: ser::Serializer + where + S: ser::Serializer, { use serde::ser::SerializeStruct; @@ -320,27 +320,28 @@ impl<'de> de::Deserialize<'de> for Datetime { fn deserialize(deserializer: D) -> Result - where D: de::Deserializer<'de> + where + D: de::Deserializer<'de>, { struct DatetimeVisitor; impl<'de> de::Visitor<'de> for DatetimeVisitor { type Value = Datetime; - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { formatter.write_str("a TOML datetime") } fn visit_map(self, mut visitor: V) -> Result - where V: de::MapAccess<'de> + where + V: de::MapAccess<'de>, { let value = visitor.next_key::()?; if value.is_none() { - return Err(de::Error::custom("datetime key not found")) + return Err(de::Error::custom("datetime key not found")); } let v: DatetimeFromString = visitor.next_value()?; Ok(v.value) - } } @@ -353,19 +354,21 @@ impl<'de> de::Deserialize<'de> for DatetimeKey { fn deserialize(deserializer: D) -> Result - where D: de::Deserializer<'de> + where + D: de::Deserializer<'de>, { struct FieldVisitor; impl<'de> de::Visitor<'de> for FieldVisitor { type Value = (); - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { formatter.write_str("a valid datetime field") } fn visit_str(self, s: &str) -> Result<(), E> - where E: de::Error + where + E: de::Error, { if s == FIELD { Ok(()) @@ -386,19 +389,21 @@ impl<'de> de::Deserialize<'de> for DatetimeFromString { fn deserialize(deserializer: D) -> Result - where D: de::Deserializer<'de> + where + D: de::Deserializer<'de>, { struct Visitor; impl<'de> de::Visitor<'de> for Visitor { type Value = DatetimeFromString; - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { formatter.write_str("string containing a datetime") } fn visit_str(self, s: &str) -> Result - where E: de::Error, + where + E: de::Error, { match s.parse() { Ok(date) => Ok(DatetimeFromString { value: date }), @@ -412,7 +417,7 @@ } impl fmt::Display for DatetimeParseError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { "failed to parse datetime".fmt(f) } } diff -Nru cargo-0.35.0/vendor/toml/src/de.rs cargo-0.37.0/vendor/toml/src/de.rs --- cargo-0.35.0/vendor/toml/src/de.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/toml/src/de.rs 2019-07-17 05:42:23.000000000 +0000 @@ -12,19 +12,20 @@ use std::vec; use serde::de; -use serde::de::IntoDeserializer; use serde::de::value::BorrowedStrDeserializer; +use serde::de::IntoDeserializer; -use tokens::{Tokenizer, Token, Error as TokenError, Span}; -use datetime; -use spanned; +use crate::datetime; +use crate::spanned; +use crate::tokens::{Error as TokenError, Span, Token, Tokenizer}; /// Deserializes a byte slice into a type. /// /// This function will attempt to interpret `bytes` as UTF-8 data and then /// deserialize `T` from the TOML document provided. pub fn from_slice<'de, T>(bytes: &'de [u8]) -> Result - where T: de::Deserialize<'de>, +where + T: de::Deserialize<'de>, { match str::from_utf8(bytes) { Ok(s) => from_str(s), @@ -40,9 +41,7 @@ /// # Examples /// /// ``` -/// #[macro_use] -/// extern crate serde_derive; -/// extern crate toml; +/// use serde_derive::Deserialize; /// /// #[derive(Deserialize)] /// struct Config { @@ -68,7 +67,8 @@ /// } /// ``` pub fn from_str<'de, T>(s: &'de str) -> Result - where T: de::Deserialize<'de>, +where + T: de::Deserialize<'de>, { let mut d = Deserializer::new(s); let ret = T::deserialize(&mut d)?; @@ -77,12 +77,12 @@ } /// Errors that can occur when deserializing a type. -#[derive(Debug, Clone)] +#[derive(Debug, PartialEq, Clone)] pub struct Error { inner: Box, } -#[derive(Debug, Clone)] +#[derive(Debug, PartialEq, Clone)] struct ErrorInner { kind: ErrorKind, line: Option, @@ -92,7 +92,7 @@ } /// Errors that can occur when deserializing a type. -#[derive(Debug, Clone)] +#[derive(Debug, PartialEq, Clone)] enum ErrorKind { /// EOF was reached when looking for a value UnexpectedEof, @@ -195,6 +195,7 @@ /// Deserialization implementation for TOML. pub struct Deserializer<'a> { require_newline_after_table: bool, + allow_duplciate_after_longer_table: bool, input: &'a str, tokens: Tokenizer<'a>, } @@ -203,9 +204,9 @@ type Error = Error; fn deserialize_any(self, visitor: V) -> Result - where V: de::Visitor<'de>, + where + V: de::Visitor<'de>, { - let mut tables = self.tables()?; visitor.visit_map(MapVisitor { @@ -226,9 +227,10 @@ self, _name: &'static str, _variants: &'static [&'static str], - visitor: V + visitor: V, ) -> Result - where V: de::Visitor<'de> + where + V: de::Visitor<'de>, { let (value, name) = self.string_or_table()?; match value.e { @@ -261,7 +263,7 @@ } } - forward_to_deserialize_any! { + serde::forward_to_deserialize_any! { bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string seq bytes byte_buf map struct unit newtype_struct ignored_any unit_struct tuple_struct tuple option identifier @@ -292,10 +294,11 @@ type Error = Error; fn next_key_seed(&mut self, seed: K) -> Result, Error> - where K: de::DeserializeSeed<'de>, + where + K: de::DeserializeSeed<'de>, { if self.cur_parent == self.max || self.cur == self.max { - return Ok(None) + return Ok(None); } loop { @@ -303,20 +306,24 @@ if let Some((key, value)) = self.values.next() { let ret = seed.deserialize(StrDeserializer::new(key.clone()))?; self.next_value = Some((key, value)); - return Ok(Some(ret)) + return Ok(Some(ret)); } let next_table = { let prefix = &self.tables[self.cur_parent].header[..self.depth]; - self.tables[self.cur..self.max].iter().enumerate().find(|&(_, t)| { - if t.values.is_none() { - return false - } - match t.header.get(..self.depth) { - Some(header) => header == prefix, - None => false, - } - }).map(|(i, _)| i + self.cur) + self.tables[self.cur..self.max] + .iter() + .enumerate() + .find(|&(_, t)| { + if t.values.is_none() { + return false; + } + match t.header.get(..self.depth) { + Some(header) => header == prefix, + None => false, + } + }) + .map(|(i, _)| i + self.cur) }; let pos = match next_table { @@ -327,11 +334,24 @@ // Test to see if we're duplicating our parent's table, and if so // then this is an error in the toml format - if self.cur_parent != pos && - self.tables[self.cur_parent].header == self.tables[pos].header { - let at = self.tables[pos].at; - let name = self.tables[pos].header.join("."); - return Err(self.de.error(at, ErrorKind::DuplicateTable(name))) + if self.cur_parent != pos { + if self.tables[self.cur_parent].header == self.tables[pos].header { + let at = self.tables[pos].at; + let name = self.tables[pos].header.join("."); + return Err(self.de.error(at, ErrorKind::DuplicateTable(name))); + } + + // If we're here we know we should share the same prefix, and if + // the longer table was defined first then we want to narrow + // down our parent's length if possible to ensure that we catch + // duplicate tables defined afterwards. + if !self.de.allow_duplciate_after_longer_table { + let parent_len = self.tables[self.cur_parent].header.len(); + let cur_len = self.tables[pos].header.len(); + if cur_len < parent_len { + self.cur_parent = pos; + } + } } let table = &mut self.tables[pos]; @@ -342,42 +362,47 @@ if self.depth != table.header.len() { let key = &table.header[self.depth]; let key = seed.deserialize(StrDeserializer::new(key.clone()))?; - return Ok(Some(key)) + return Ok(Some(key)); } // Rule out cases like: // // [[foo.bar]] // [[foo]] - if table.array { + if table.array { let kind = ErrorKind::RedefineAsArray; - return Err(self.de.error(table.at, kind)) + return Err(self.de.error(table.at, kind)); } - self.values = table.values.take().expect("Unable to read table values").into_iter(); + self.values = table + .values + .take() + .expect("Unable to read table values") + .into_iter(); } } fn next_value_seed(&mut self, seed: V) -> Result - where V: de::DeserializeSeed<'de>, + where + V: de::DeserializeSeed<'de>, { if let Some((k, v)) = self.next_value.take() { match seed.deserialize(ValueDeserializer::new(v)) { Ok(v) => return Ok(v), Err(mut e) => { e.add_key_context(&k); - return Err(e) + return Err(e); } } } - let array = self.tables[self.cur].array && - self.depth == self.tables[self.cur].header.len() - 1; + let array = + self.tables[self.cur].array && self.depth == self.tables[self.cur].header.len() - 1; self.cur += 1; let res = seed.deserialize(MapVisitor { values: Vec::new().into_iter(), next_value: None, - depth: self.depth + if array {0} else {1}, + depth: self.depth + if array { 0 } else { 1 }, cur_parent: self.cur - 1, cur: 0, max: self.max, @@ -396,26 +421,30 @@ type Error = Error; fn next_element_seed(&mut self, seed: K) -> Result, Error> - where K: de::DeserializeSeed<'de>, + where + K: de::DeserializeSeed<'de>, { assert!(self.next_value.is_none()); assert!(self.values.next().is_none()); if self.cur_parent == self.max { - return Ok(None) + return Ok(None); } let next = self.tables[..self.max] .iter() .enumerate() .skip(self.cur_parent + 1) - .find(|&(_, table)| { - table.array && table.header == self.tables[self.cur_parent].header - }).map(|p| p.0) + .find(|&(_, table)| table.array && table.header == self.tables[self.cur_parent].header) + .map(|p| p.0) .unwrap_or(self.max); let ret = seed.deserialize(MapVisitor { - values: self.tables[self.cur_parent].values.take().expect("Unable to read table values").into_iter(), + values: self.tables[self.cur_parent] + .values + .take() + .expect("Unable to read table values") + .into_iter(), next_value: None, depth: self.depth + 1, cur_parent: self.cur_parent, @@ -434,9 +463,10 @@ type Error = Error; fn deserialize_any(self, visitor: V) -> Result - where V: de::Visitor<'de>, + where + V: de::Visitor<'de>, { - if self.array { + if self.array { visitor.visit_seq(self) } else { visitor.visit_map(self) @@ -446,7 +476,8 @@ // `None` is interpreted as a missing field so be sure to implement `Some` // as a present field. fn deserialize_option(self, visitor: V) -> Result - where V: de::Visitor<'de>, + where + V: de::Visitor<'de>, { visitor.visit_some(self) } @@ -454,14 +485,15 @@ fn deserialize_newtype_struct( self, _name: &'static str, - visitor: V + visitor: V, ) -> Result - where V: de::Visitor<'de> + where + V: de::Visitor<'de>, { visitor.visit_newtype_struct(self) } - forward_to_deserialize_any! { + serde::forward_to_deserialize_any! { bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string seq bytes byte_buf map struct unit identifier ignored_any unit_struct tuple_struct tuple enum @@ -474,9 +506,7 @@ impl<'a> StrDeserializer<'a> { fn new(key: Cow<'a, str>) -> StrDeserializer<'a> { - StrDeserializer { - key: key, - } + StrDeserializer { key: key } } } @@ -484,7 +514,8 @@ type Error = Error; fn deserialize_any(self, visitor: V) -> Result - where V: de::Visitor<'de>, + where + V: de::Visitor<'de>, { match self.key { Cow::Borrowed(s) => visitor.visit_borrowed_str(s), @@ -492,7 +523,7 @@ } } - forward_to_deserialize_any! { + serde::forward_to_deserialize_any! { bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string seq bytes byte_buf map struct option unit newtype_struct ignored_any unit_struct tuple_struct tuple enum identifier @@ -522,7 +553,8 @@ type Error = Error; fn deserialize_any(self, visitor: V) -> Result - where V: de::Visitor<'de>, + where + V: de::Visitor<'de>, { match self.value.e { E::Integer(i) => visitor.visit_i64(i), @@ -549,25 +581,29 @@ } } - fn deserialize_struct(self, - name: &'static str, - fields: &'static [&'static str], - visitor: V) -> Result - where V: de::Visitor<'de>, + fn deserialize_struct( + self, + name: &'static str, + fields: &'static [&'static str], + visitor: V, + ) -> Result + where + V: de::Visitor<'de>, { if name == datetime::NAME && fields == &[datetime::FIELD] { if let E::Datetime(s) = self.value.e { return visitor.visit_map(DatetimeDeserializer { date: s, visited: false, - }) + }); } } if self.validate_struct_keys { match &self.value.e { &E::InlineTable(ref values) | &E::DottedTable(ref values) => { - let extra_fields = values.iter() + let extra_fields = values + .iter() .filter_map(|key_value| { let (ref key, ref _val) = *key_value; if !fields.contains(&&(**key)) { @@ -580,7 +616,10 @@ if !extra_fields.is_empty() { return Err(Error::from_kind(ErrorKind::UnexpectedKeys { - keys: extra_fields.iter().map(|k| k.to_string()).collect::>(), + keys: extra_fields + .iter() + .map(|k| k.to_string()) + .collect::>(), available: fields, })); } @@ -606,7 +645,8 @@ // `None` is interpreted as a missing field so be sure to implement `Some` // as a present field. fn deserialize_option(self, visitor: V) -> Result - where V: de::Visitor<'de>, + where + V: de::Visitor<'de>, { visitor.visit_some(self) } @@ -615,9 +655,10 @@ self, _name: &'static str, _variants: &'static [&'static str], - visitor: V + visitor: V, ) -> Result - where V: de::Visitor<'de> + where + V: de::Visitor<'de>, { match self.value.e { E::String(val) => visitor.visit_enum(val.into_deserializer()), @@ -648,14 +689,15 @@ fn deserialize_newtype_struct( self, _name: &'static str, - visitor: V + visitor: V, ) -> Result - where V: de::Visitor<'de> + where + V: de::Visitor<'de>, { visitor.visit_newtype_struct(self) } - forward_to_deserialize_any! { + serde::forward_to_deserialize_any! { bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string seq bytes byte_buf map unit identifier ignored_any unit_struct tuple_struct tuple @@ -684,11 +726,14 @@ K: de::DeserializeSeed<'de>, { if self.start.is_some() { - seed.deserialize(BorrowedStrDeserializer::new(spanned::START)).map(Some) + seed.deserialize(BorrowedStrDeserializer::new(spanned::START)) + .map(Some) } else if self.end.is_some() { - seed.deserialize(BorrowedStrDeserializer::new(spanned::END)).map(Some) + seed.deserialize(BorrowedStrDeserializer::new(spanned::END)) + .map(Some) } else if self.value.is_some() { - seed.deserialize(BorrowedStrDeserializer::new(spanned::VALUE)).map(Some) + seed.deserialize(BorrowedStrDeserializer::new(spanned::VALUE)) + .map(Some) } else { Ok(None) } @@ -700,7 +745,7 @@ { if let Some(start) = self.start.take() { seed.deserialize(start.into_deserializer()) - } else if let Some(end) = self.end.take() { + } else if let Some(end) = self.end.take() { seed.deserialize(end.into_deserializer()) } else if let Some(value) = self.value.take() { seed.deserialize(value.into_deserializer()) @@ -719,17 +764,19 @@ type Error = Error; fn next_key_seed(&mut self, seed: K) -> Result, Error> - where K: de::DeserializeSeed<'de>, + where + K: de::DeserializeSeed<'de>, { if self.visited { - return Ok(None) + return Ok(None); } self.visited = true; seed.deserialize(DatetimeFieldDeserializer).map(Some) } fn next_value_seed(&mut self, seed: V) -> Result - where V: de::DeserializeSeed<'de>, + where + V: de::DeserializeSeed<'de>, { seed.deserialize(StrDeserializer::new(self.date.into())) } @@ -741,12 +788,13 @@ type Error = Error; fn deserialize_any(self, visitor: V) -> Result - where V: de::Visitor<'de>, + where + V: de::Visitor<'de>, { visitor.visit_borrowed_str(datetime::FIELD) } - forward_to_deserialize_any! { + serde::forward_to_deserialize_any! { bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string seq bytes byte_buf map struct option unit newtype_struct ignored_any unit_struct tuple_struct tuple enum identifier @@ -781,7 +829,8 @@ type Error = Error; fn next_key_seed(&mut self, seed: K) -> Result, Error> - where K: de::DeserializeSeed<'de>, + where + K: de::DeserializeSeed<'de>, { let (key, value) = match self.values.next() { Some(pair) => pair, @@ -792,7 +841,8 @@ } fn next_value_seed(&mut self, seed: V) -> Result - where V: de::DeserializeSeed<'de>, + where + V: de::DeserializeSeed<'de>, { let value = self.next_value.take().expect("Unable to read table values"); seed.deserialize(ValueDeserializer::new(value)) @@ -926,6 +976,7 @@ tokens: Tokenizer::new(input), input: input, require_newline_after_table: true, + allow_duplciate_after_longer_table: false, } } @@ -947,6 +998,16 @@ self.require_newline_after_table = require; } + /// Historical versions of toml-rs accidentally allowed a duplicate table + /// header after a longer table header was previously defined. This is + /// invalid according to the TOML spec, however. + /// + /// This option can be set to `true` (the default is `false`) to emulate + /// this behavior for backwards compatibility with older toml-rs versions. + pub fn set_allow_duplicate_after_longer_table(&mut self, allow: bool) { + self.allow_duplciate_after_longer_table = allow; + } + fn tables(&mut self) -> Result>, Error> { let mut tables = Vec::new(); let mut cur_table = Table { @@ -998,12 +1059,12 @@ loop { self.eat_whitespace()?; if self.eat_comment()? { - continue + continue; } if self.eat(Token::Newline)? { - continue + continue; } - break + break; } match self.peek()? { @@ -1017,9 +1078,7 @@ let start = self.tokens.current(); self.expect(Token::LeftBracket)?; let array = self.eat(Token::LeftBracket)?; - let ret = Header::new(self.tokens.clone(), - array, - self.require_newline_after_table); + let ret = Header::new(self.tokens.clone(), array, self.require_newline_after_table); if self.require_newline_after_table { self.tokens.skip_to_newline(); } else { @@ -1029,16 +1088,19 @@ if array { self.eat(Token::RightBracket)?; } - break + break; } - Some((_, Token::Newline)) | - None => break, + Some((_, Token::Newline)) | None => break, _ => {} } } self.eat_whitespace()?; } - Ok(Line::Table { at: start, header: ret, array: array }) + Ok(Line::Table { + at: start, + header: ret, + array: array, + }) } fn key_value(&mut self) -> Result, Error> { @@ -1059,58 +1121,69 @@ fn value(&mut self) -> Result, Error> { let at = self.tokens.current(); let value = match self.next()? { - Some((Span { start, end }, Token::String { val, .. })) => { - Value { e: E::String(val), start: start, end: end } - } - Some((Span { start, end }, Token::Keylike("true"))) => { - Value { e: E::Boolean(true), start: start, end: end } - } - Some((Span { start, end }, Token::Keylike("false"))) => { - Value { e: E::Boolean(false), start: start, end: end } - } + Some((Span { start, end }, Token::String { val, .. })) => Value { + e: E::String(val), + start: start, + end: end, + }, + Some((Span { start, end }, Token::Keylike("true"))) => Value { + e: E::Boolean(true), + start: start, + end: end, + }, + Some((Span { start, end }, Token::Keylike("false"))) => Value { + e: E::Boolean(false), + start: start, + end: end, + }, Some((span, Token::Keylike(key))) => self.number_or_date(span, key)?, Some((span, Token::Plus)) => self.number_leading_plus(span)?, Some((Span { start, .. }, Token::LeftBrace)) => { self.inline_table().map(|(Span { end, .. }, table)| Value { e: E::InlineTable(table), start: start, - end: end + end: end, })? } Some((Span { start, .. }, Token::LeftBracket)) => { self.array().map(|(Span { end, .. }, array)| Value { e: E::Array(array), start: start, - end: end + end: end, })? } Some(token) => { - return Err(self.error(at, ErrorKind::Wanted { - expected: "a value", - found: token.1.describe(), - })) + return Err(self.error( + at, + ErrorKind::Wanted { + expected: "a value", + found: token.1.describe(), + }, + )) } None => return Err(self.eof()), }; Ok(value) } - fn number_or_date(&mut self, span: Span, s: &'a str) - -> Result, Error> - { - if s.contains('T') || (s.len() > 1 && s[1..].contains('-')) && - !s.contains("e-") { - self.datetime(span, s, false).map(|(Span { start, end }, d)| Value { - e: E::Datetime(d), - start: start, - end: end - }) + fn number_or_date(&mut self, span: Span, s: &'a str) -> Result, Error> { + if s.contains('T') + || s.contains('t') + || (s.len() > 1 && s[1..].contains('-') && !s.contains("e-") && !s.contains("E-")) + { + self.datetime(span, s, false) + .map(|(Span { start, end }, d)| Value { + e: E::Datetime(d), + start: start, + end: end, + }) } else if self.eat(Token::Colon)? { - self.datetime(span, s, true).map(|(Span { start, end }, d)| Value { - e: E::Datetime(d), - start: start, - end: end - }) + self.datetime(span, s, true) + .map(|(Span { start, end }, d)| Value { + e: E::Datetime(d), + start: start, + end: end, + }) } else { self.number(span, s) } @@ -1166,7 +1239,11 @@ } fn number(&mut self, Span { start, end }: Span, s: &'a str) -> Result, Error> { - let to_integer = |f| Value { e: E::Integer(f), start: start, end: end }; + let to_integer = |f| Value { + e: E::Integer(f), + start: start, + end: end, + }; if s.starts_with("0x") { self.integer(&s[2..], 16).map(to_integer) } else if s.starts_with("0o") { @@ -1174,25 +1251,47 @@ } else if s.starts_with("0b") { self.integer(&s[2..], 2).map(to_integer) } else if s.contains('e') || s.contains('E') { - self.float(s, None).map(|f| Value { e: E::Float(f), start: start, end: end }) + self.float(s, None).map(|f| Value { + e: E::Float(f), + start: start, + end: end, + }) } else if self.eat(Token::Period)? { let at = self.tokens.current(); match self.next()? { Some((Span { start, end }, Token::Keylike(after))) => { self.float(s, Some(after)).map(|f| Value { - e: E::Float(f), start: start, end: end + e: E::Float(f), + start: start, + end: end, }) } _ => Err(self.error(at, ErrorKind::NumberInvalid)), } } else if s == "inf" { - Ok(Value { e: E::Float(f64::INFINITY), start: start, end: end }) + Ok(Value { + e: E::Float(f64::INFINITY), + start: start, + end: end, + }) } else if s == "-inf" { - Ok(Value { e: E::Float(f64::NEG_INFINITY), start: start, end: end }) + Ok(Value { + e: E::Float(f64::NEG_INFINITY), + start: start, + end: end, + }) } else if s == "nan" { - Ok(Value { e: E::Float(f64::NAN), start: start, end: end }) + Ok(Value { + e: E::Float(f64::NAN), + start: start, + end: end, + }) } else if s == "-nan" { - Ok(Value { e: E::Float(-f64::NAN), start: start, end: end }) + Ok(Value { + e: E::Float(-f64::NAN), + start: start, + end: end, + }) } else { self.integer(s, 10).map(to_integer) } @@ -1201,9 +1300,13 @@ fn number_leading_plus(&mut self, Span { start, .. }: Span) -> Result, Error> { let start_token = self.tokens.current(); match self.next()? { - Some((Span { end, .. }, Token::Keylike(s))) => { - self.number(Span { start: start, end: end }, s) - }, + Some((Span { end, .. }, Token::Keylike(s))) => self.number( + Span { + start: start, + end: end, + }, + s, + ), _ => Err(self.error(start_token, ErrorKind::NumberInvalid)), } } @@ -1214,9 +1317,9 @@ let (prefix, suffix) = self.parse_integer(s, allow_sign, allow_leading_zeros, radix)?; let start = self.tokens.substr_offset(s); if suffix != "" { - return Err(self.error(start, ErrorKind::NumberInvalid)) + return Err(self.error(start, ErrorKind::NumberInvalid)); } - i64::from_str_radix(&prefix.replace("_", "").trim_left_matches('+'), radix) + i64::from_str_radix(&prefix.replace("_", "").trim_start_matches('+'), radix) .map_err(|_e| self.error(start, ErrorKind::NumberInvalid)) } @@ -1236,7 +1339,7 @@ for (i, c) in s.char_indices() { let at = i + start; if i == 0 && (c == '+' || c == '-') && allow_sign { - continue + continue; } if c == '0' && first { @@ -1257,20 +1360,19 @@ first = false; } if first || underscore { - return Err(self.error(start, ErrorKind::NumberInvalid)) + return Err(self.error(start, ErrorKind::NumberInvalid)); } Ok((&s[..end], &s[end..])) } - fn float(&mut self, s: &'a str, after_decimal: Option<&'a str>) - -> Result { + fn float(&mut self, s: &'a str, after_decimal: Option<&'a str>) -> Result { let (integral, mut suffix) = self.parse_integer(s, true, false, 10)?; let start = self.tokens.substr_offset(integral); let mut fraction = None; if let Some(after) = after_decimal { if suffix != "" { - return Err(self.error(start, ErrorKind::NumberInvalid)) + return Err(self.error(start, ErrorKind::NumberInvalid)); } let (a, b) = self.parse_integer(after, false, true, 10)?; fraction = Some(a); @@ -1282,24 +1384,25 @@ let (a, b) = if suffix.len() == 1 { self.eat(Token::Plus)?; match self.next()? { - Some((_, Token::Keylike(s))) => { - self.parse_integer(s, false, false, 10)? - } + Some((_, Token::Keylike(s))) => self.parse_integer(s, false, false, 10)?, _ => return Err(self.error(start, ErrorKind::NumberInvalid)), } } else { self.parse_integer(&suffix[1..], true, false, 10)? }; if b != "" { - return Err(self.error(start, ErrorKind::NumberInvalid)) + return Err(self.error(start, ErrorKind::NumberInvalid)); } exponent = Some(a); + } else if !suffix.is_empty() { + return Err(self.error(start, ErrorKind::NumberInvalid)); } - let mut number = integral.trim_left_matches('+') - .chars() - .filter(|c| *c != '_') - .collect::(); + let mut number = integral + .trim_start_matches('+') + .chars() + .filter(|c| *c != '_') + .collect::(); if let Some(fraction) = fraction { number.push_str("."); number.extend(fraction.chars().filter(|c| *c != '_')); @@ -1308,19 +1411,24 @@ number.push_str("E"); number.extend(exponent.chars().filter(|c| *c != '_')); } - number.parse().map_err(|_e| { - self.error(start, ErrorKind::NumberInvalid) - }).and_then(|n: f64| { - if n.is_finite() { - Ok(n) - } else { - Err(self.error(start, ErrorKind::NumberInvalid)) - } - }) + number + .parse() + .map_err(|_e| self.error(start, ErrorKind::NumberInvalid)) + .and_then(|n: f64| { + if n.is_finite() { + Ok(n) + } else { + Err(self.error(start, ErrorKind::NumberInvalid)) + } + }) } - fn datetime(&mut self, mut span: Span, date: &'a str, colon_eaten: bool) - -> Result<(Span, &'a str), Error> { + fn datetime( + &mut self, + mut span: Span, + date: &'a str, + colon_eaten: bool, + ) -> Result<(Span, &'a str), Error> { let start = self.tokens.substr_offset(date); // Check for space separated date and time. @@ -1328,8 +1436,8 @@ if let Ok(Some((_, Token::Whitespace(" ")))) = lookahead.next() { // Check if hour follows. if let Ok(Some((_, Token::Keylike(_)))) = lookahead.next() { - self.next()?; // skip space - self.next()?; // skip keylike hour + self.next()?; // skip space + self.next()?; // skip keylike hour } } @@ -1344,7 +1452,7 @@ match self.next()? { Some((Span { end, .. }, Token::Keylike(_))) => { span.end = end; - }, + } _ => return Err(self.error(start, ErrorKind::DateInvalid)), } // Fractional seconds @@ -1352,7 +1460,7 @@ match self.next()? { Some((Span { end, .. }, Token::Keylike(_))) => { span.end = end; - }, + } _ => return Err(self.error(start, ErrorKind::DateInvalid)), } } @@ -1362,7 +1470,7 @@ match self.next()? { Some((Span { end, .. }, Token::Keylike(_))) => { span.end = end; - }, + } _ => return Err(self.error(start, ErrorKind::DateInvalid)), } } @@ -1370,7 +1478,7 @@ match self.next()? { Some((Span { end, .. }, Token::Keylike(_))) => { span.end = end; - }, + } _ => return Err(self.error(start, ErrorKind::DateInvalid)), } } @@ -1386,7 +1494,7 @@ let mut ret = Vec::new(); self.eat_whitespace()?; if let Some(span) = self.eat_spanned(Token::RightBrace)? { - return Ok((span, ret)) + return Ok((span, ret)); } loop { let key = self.dotted_key()?; @@ -1398,7 +1506,7 @@ self.eat_whitespace()?; if let Some(span) = self.eat_spanned(Token::RightBrace)? { - return Ok((span, ret)) + return Ok((span, ret)); } self.expect(Token::Comma)?; self.eat_whitespace()?; @@ -1410,11 +1518,11 @@ fn array(&mut self) -> Result<(Span, Vec>), Error> { let mut ret = Vec::new(); - let intermediate = |me: &mut Deserializer| { + let intermediate = |me: &mut Deserializer<'_>| { loop { me.eat_whitespace()?; if !me.eat(Token::Newline)? && !me.eat_comment()? { - break + break; } } Ok(()) @@ -1423,19 +1531,19 @@ loop { intermediate(self)?; if let Some(span) = self.eat_spanned(Token::RightBracket)? { - return Ok((span, ret)) + return Ok((span, ret)); } let at = self.tokens.current(); let value = self.value()?; if let Some(last) = ret.last() { if !value.same_type(last) { - return Err(self.error(at, ErrorKind::MixedArrayType)) + return Err(self.error(at, ErrorKind::MixedArrayType)); } } ret.push(value); intermediate(self)?; if !self.eat(Token::Comma)? { - break + break; } } intermediate(self)?; @@ -1444,7 +1552,10 @@ } fn table_key(&mut self) -> Result, Error> { - self.tokens.table_key().map(|t| t.1).map_err(|e| self.token_error(e)) + self.tokens + .table_key() + .map(|t| t.1) + .map_err(|e| self.token_error(e)) } fn dotted_key(&mut self) -> Result>, Error> { @@ -1483,7 +1594,13 @@ return Ok(()); } match values.iter_mut().find(|&&mut (ref k, _)| *k == key) { - Some(&mut (_, Value { e: E::DottedTable(ref mut v), .. })) => { + Some(&mut ( + _, + Value { + e: E::DottedTable(ref mut v), + .. + }, + )) => { return self.add_dotted_key(key_parts, value, v); } Some(&mut (_, Value { start, .. })) => { @@ -1499,14 +1616,23 @@ }; values.push((key, table_values)); let last_i = values.len() - 1; - if let (_, Value { e: E::DottedTable(ref mut v), .. }) = values[last_i] { + if let ( + _, + Value { + e: E::DottedTable(ref mut v), + .. + }, + ) = values[last_i] + { self.add_dotted_key(key_parts, value, v)?; } Ok(()) } fn eat_whitespace(&mut self) -> Result<(), Error> { - self.tokens.eat_whitespace().map_err(|e| self.token_error(e)) + self.tokens + .eat_whitespace() + .map_err(|e| self.token_error(e)) } fn eat_comment(&mut self) -> Result { @@ -1514,7 +1640,9 @@ } fn eat_newline_or_eof(&mut self) -> Result<(), Error> { - self.tokens.eat_newline_or_eof().map_err(|e| self.token_error(e)) + self.tokens + .eat_newline_or_eof() + .map_err(|e| self.token_error(e)) } fn eat(&mut self, expected: Token<'a>) -> Result { @@ -1522,15 +1650,21 @@ } fn eat_spanned(&mut self, expected: Token<'a>) -> Result, Error> { - self.tokens.eat_spanned(expected).map_err(|e| self.token_error(e)) + self.tokens + .eat_spanned(expected) + .map_err(|e| self.token_error(e)) } fn expect(&mut self, expected: Token<'a>) -> Result<(), Error> { - self.tokens.expect(expected).map_err(|e| self.token_error(e)) + self.tokens + .expect(expected) + .map_err(|e| self.token_error(e)) } fn expect_spanned(&mut self, expected: Token<'a>) -> Result { - self.tokens.expect_spanned(expected).map_err(|e| self.token_error(e)) + self.tokens + .expect_spanned(expected) + .map_err(|e| self.token_error(e)) } fn next(&mut self) -> Result)>, Error> { @@ -1550,36 +1684,28 @@ TokenError::InvalidCharInString(at, ch) => { self.error(at, ErrorKind::InvalidCharInString(ch)) } - TokenError::InvalidEscape(at, ch) => { - self.error(at, ErrorKind::InvalidEscape(ch)) - } + TokenError::InvalidEscape(at, ch) => self.error(at, ErrorKind::InvalidEscape(ch)), TokenError::InvalidEscapeValue(at, v) => { self.error(at, ErrorKind::InvalidEscapeValue(v)) } - TokenError::InvalidHexEscape(at, ch) => { - self.error(at, ErrorKind::InvalidHexEscape(ch)) - } - TokenError::NewlineInString(at) => { - self.error(at, ErrorKind::NewlineInString) - } - TokenError::Unexpected(at, ch) => { - self.error(at, ErrorKind::Unexpected(ch)) - } - TokenError::UnterminatedString(at) => { - self.error(at, ErrorKind::UnterminatedString) - } - TokenError::NewlineInTableKey(at) => { - self.error(at, ErrorKind::NewlineInTableKey) - } - TokenError::Wanted { at, expected, found } => { - self.error(at, ErrorKind::Wanted { expected: expected, found: found }) - } - TokenError::EmptyTableKey(at) => { - self.error(at, ErrorKind::EmptyTableKey) - } - TokenError::MultilineStringKey(at) => { - self.error(at, ErrorKind::MultilineStringKey) - } + TokenError::InvalidHexEscape(at, ch) => self.error(at, ErrorKind::InvalidHexEscape(ch)), + TokenError::NewlineInString(at) => self.error(at, ErrorKind::NewlineInString), + TokenError::Unexpected(at, ch) => self.error(at, ErrorKind::Unexpected(ch)), + TokenError::UnterminatedString(at) => self.error(at, ErrorKind::UnterminatedString), + TokenError::NewlineInTableKey(at) => self.error(at, ErrorKind::NewlineInTableKey), + TokenError::Wanted { + at, + expected, + found, + } => self.error( + at, + ErrorKind::Wanted { + expected: expected, + found: found, + }, + ), + TokenError::EmptyTableKey(at) => self.error(at, ErrorKind::EmptyTableKey), + TokenError::MultilineStringKey(at) => self.error(at, ErrorKind::MultilineStringKey), } } @@ -1598,7 +1724,7 @@ let mut cur = 0; for (i, line) in self.input.lines().enumerate() { if cur + line.len() + 1 > offset { - return (i, offset - cur) + return (i, offset - cur); } cur += line.len() + 1; } @@ -1647,29 +1773,31 @@ } impl fmt::Display for Error { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self.inner.kind { ErrorKind::UnexpectedEof => "unexpected eof encountered".fmt(f)?, - ErrorKind::InvalidCharInString(c) => { - write!(f, "invalid character in string: `{}`", - c.escape_default().collect::())? - } - ErrorKind::InvalidEscape(c) => { - write!(f, "invalid escape character in string: `{}`", - c.escape_default().collect::())? - } - ErrorKind::InvalidHexEscape(c) => { - write!(f, "invalid hex escape character in string: `{}`", - c.escape_default().collect::())? - } - ErrorKind::InvalidEscapeValue(c) => { - write!(f, "invalid escape value: `{}`", c)? - } + ErrorKind::InvalidCharInString(c) => write!( + f, + "invalid character in string: `{}`", + c.escape_default().collect::() + )?, + ErrorKind::InvalidEscape(c) => write!( + f, + "invalid escape character in string: `{}`", + c.escape_default().collect::() + )?, + ErrorKind::InvalidHexEscape(c) => write!( + f, + "invalid hex escape character in string: `{}`", + c.escape_default().collect::() + )?, + ErrorKind::InvalidEscapeValue(c) => write!(f, "invalid escape value: `{}`", c)?, ErrorKind::NewlineInString => "newline in string found".fmt(f)?, - ErrorKind::Unexpected(ch) => { - write!(f, "unexpected character found: `{}`", - ch.escape_default().collect::())? - } + ErrorKind::Unexpected(ch) => write!( + f, + "unexpected character found: `{}`", + ch.escape_default().collect::() + )?, ErrorKind::UnterminatedString => "unterminated string".fmt(f)?, ErrorKind::NewlineInTableKey => "found newline in table key".fmt(f)?, ErrorKind::Wanted { expected, found } => { @@ -1694,14 +1822,14 @@ ErrorKind::DottedKeyInvalidType => { "dotted key attempted to extend non-table type".fmt(f)? } - ErrorKind::UnexpectedKeys { ref keys, available } => { - write!( - f, - "unexpected keys in table: `{:?}`, available keys: `{:?}`", - keys, - available - )? - } + ErrorKind::UnexpectedKeys { + ref keys, + available, + } => write!( + f, + "unexpected keys in table: `{:?}`, available keys: `{:?}`", + keys, available + )?, ErrorKind::__Nonexhaustive => panic!(), } @@ -1762,7 +1890,11 @@ } enum Line<'a> { - Table { at: usize, header: Header<'a>, array: bool }, + Table { + at: usize, + header: Header<'a>, + array: bool, + }, KeyValue(Vec>, Value<'a>), } @@ -1774,9 +1906,7 @@ } impl<'a> Header<'a> { - fn new(tokens: Tokenizer<'a>, - array: bool, - require_newline_after_table: bool) -> Header<'a> { + fn new(tokens: Tokenizer<'a>, array: bool, require_newline_after_table: bool) -> Header<'a> { Header { first: true, array: array, @@ -1846,13 +1976,13 @@ impl<'a> Value<'a> { fn same_type(&self, other: &Value<'a>) -> bool { match (&self.e, &other.e) { - (&E::String(..), &E::String(..)) | - (&E::Integer(..), &E::Integer(..)) | - (&E::Float(..), &E::Float(..)) | - (&E::Boolean(..), &E::Boolean(..)) | - (&E::Datetime(..), &E::Datetime(..)) | - (&E::Array(..), &E::Array(..)) | - (&E::InlineTable(..), &E::InlineTable(..)) => true, + (&E::String(..), &E::String(..)) + | (&E::Integer(..), &E::Integer(..)) + | (&E::Float(..), &E::Float(..)) + | (&E::Boolean(..), &E::Boolean(..)) + | (&E::Datetime(..), &E::Datetime(..)) + | (&E::Array(..), &E::Array(..)) + | (&E::InlineTable(..), &E::InlineTable(..)) => true, (&E::DottedTable(..), &E::DottedTable(..)) => true, _ => false, diff -Nru cargo-0.35.0/vendor/toml/src/lib.rs cargo-0.37.0/vendor/toml/src/lib.rs --- cargo-0.35.0/vendor/toml/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/toml/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -77,9 +77,7 @@ //! An example of deserializing with TOML is: //! //! ```rust -//! #[macro_use] -//! extern crate serde_derive; -//! extern crate toml; +//! use serde_derive::Deserialize; //! //! #[derive(Deserialize)] //! struct Config { @@ -113,9 +111,7 @@ //! You can serialize types in a similar fashion: //! //! ```rust -//! #[macro_use] -//! extern crate serde_derive; -//! extern crate toml; +//! use serde_derive::Serialize; //! //! #[derive(Serialize)] //! struct Config { @@ -148,23 +144,22 @@ //! [Cargo]: https://crates.io/ //! [`serde`]: https://serde.rs/ -#![doc(html_root_url = "https://docs.rs/toml/0.4")] +#![doc(html_root_url = "https://docs.rs/toml/0.5")] #![deny(missing_docs)] +#![warn(rust_2018_idioms)] -#[macro_use] -extern crate serde; - +pub mod map; pub mod value; #[doc(no_inline)] -pub use value::Value; +pub use crate::value::Value; mod datetime; pub mod ser; #[doc(no_inline)] -pub use ser::{to_string, to_string_pretty, to_vec, Serializer}; +pub use crate::ser::{to_string, to_string_pretty, to_vec, Serializer}; pub mod de; #[doc(no_inline)] -pub use de::{from_slice, from_str, Deserializer}; +pub use crate::de::{from_slice, from_str, Deserializer}; mod tokens; #[doc(hidden)] @@ -172,4 +167,4 @@ mod spanned; #[doc(no_inline)] -pub use spanned::Spanned; +pub use crate::spanned::Spanned; diff -Nru cargo-0.35.0/vendor/toml/src/macros.rs cargo-0.37.0/vendor/toml/src/macros.rs --- cargo-0.35.0/vendor/toml/src/macros.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/toml/src/macros.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,17 +1,14 @@ pub use serde::de::{Deserialize, IntoDeserializer}; -use value::{Value, Table, Array}; +use crate::value::{Array, Table, Value}; /// Construct a [`toml::Value`] from TOML syntax. /// /// [`toml::Value`]: value/enum.Value.html /// /// ```rust -/// #[macro_use] -/// extern crate toml; -/// /// fn main() { -/// let cargo_toml = toml! { +/// let cargo_toml = toml::toml! { /// [package] /// name = "toml" /// version = "0.4.5" @@ -36,7 +33,7 @@ ($($toml:tt)+) => {{ let table = $crate::value::Table::new(); let mut root = $crate::Value::Table(table); - toml_internal!(@toplevel root [] $($toml)+); + $crate::toml_internal!(@toplevel root [] $($toml)+); root }}; } @@ -81,63 +78,63 @@ // Parse negative number `key = -value`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = - $v:tt $($rest:tt)*) => { - toml_internal!(@toplevel $root [$($path)*] $($($k)-+).+ = (-$v) $($rest)*); + $crate::toml_internal!(@toplevel $root [$($path)*] $($($k)-+).+ = (-$v) $($rest)*); }; // Parse positive number `key = +value`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = + $v:tt $($rest:tt)*) => { - toml_internal!(@toplevel $root [$($path)*] $($($k)-+).+ = ($v) $($rest)*); + $crate::toml_internal!(@toplevel $root [$($path)*] $($($k)-+).+ = ($v) $($rest)*); }; // Parse offset datetime `key = 1979-05-27T00:32:00.999999-07:00`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt . $frac:tt - $tzh:tt : $tzm:tt $($rest:tt)*) => { - toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); + $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); }; // Space instead of T. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt . $frac:tt - $tzh:tt : $tzm:tt $($rest:tt)*) => { - toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); + $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); }; // Parse offset datetime `key = 1979-05-27T00:32:00-07:00`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt - $tzh:tt : $tzm:tt $($rest:tt)*) => { - toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec - $tzh : $tzm) $($rest)*); + $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec - $tzh : $tzm) $($rest)*); }; // Space instead of T. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt - $tzh:tt : $tzm:tt $($rest:tt)*) => { - toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec - $tzh : $tzm) $($rest)*); + $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec - $tzh : $tzm) $($rest)*); }; // Parse local datetime `key = 1979-05-27T00:32:00.999999`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt . $frac:tt $($rest:tt)*) => { - toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac) $($rest)*); + $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac) $($rest)*); }; // Space instead of T. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt . $frac:tt $($rest:tt)*) => { - toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac) $($rest)*); + $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac) $($rest)*); }; // Parse offset datetime `key = 1979-05-27T07:32:00Z` and local datetime `key = 1979-05-27T07:32:00`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt $($rest:tt)*) => { - toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec) $($rest)*); + $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec) $($rest)*); }; // Space instead of T. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt $($rest:tt)*) => { - toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec) $($rest)*); + $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec) $($rest)*); }; // Parse local date `key = 1979-05-27`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $($rest:tt)*) => { - toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day) $($rest)*); + $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day) $($rest)*); }; // Parse local time `key = 00:32:00.999999`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $hr:tt : $min:tt : $sec:tt . $frac:tt $($rest:tt)*) => { - toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($hr : $min : $sec . $frac) $($rest)*); + $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($hr : $min : $sec . $frac) $($rest)*); }; // Parse local time `key = 07:32:00`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $hr:tt : $min:tt : $sec:tt $($rest:tt)*) => { - toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($hr : $min : $sec) $($rest)*); + $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($hr : $min : $sec) $($rest)*); }; // Parse any other `key = value` including string, inline array, inline @@ -145,35 +142,35 @@ (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $v:tt $($rest:tt)*) => {{ $crate::macros::insert_toml( &mut $root, - &[$($path)* $(&concat!($("-", toml_internal!(@path $k),)+)[1..], )+], - toml_internal!(@value $v)); - toml_internal!(@toplevel $root [$($path)*] $($rest)*); + &[$($path)* $(&concat!($("-", $crate::toml_internal!(@path $k),)+)[1..], )+], + $crate::toml_internal!(@value $v)); + $crate::toml_internal!(@toplevel $root [$($path)*] $($rest)*); }}; // Parse array header `[[bin]]`. (@toplevel $root:ident $oldpath:tt [[$($($path:tt)-+).+]] $($rest:tt)*) => { $crate::macros::push_toml( &mut $root, - &[$(&concat!($("-", toml_internal!(@path $path),)+)[1..],)+]); - toml_internal!(@toplevel $root [$(&concat!($("-", toml_internal!(@path $path),)+)[1..],)+] $($rest)*); + &[$(&concat!($("-", $crate::toml_internal!(@path $path),)+)[1..],)+]); + $crate::toml_internal!(@toplevel $root [$(&concat!($("-", $crate::toml_internal!(@path $path),)+)[1..],)+] $($rest)*); }; // Parse table header `[patch.crates-io]`. (@toplevel $root:ident $oldpath:tt [$($($path:tt)-+).+] $($rest:tt)*) => { $crate::macros::insert_toml( &mut $root, - &[$(&concat!($("-", toml_internal!(@path $path),)+)[1..],)+], + &[$(&concat!($("-", $crate::toml_internal!(@path $path),)+)[1..],)+], $crate::Value::Table($crate::value::Table::new())); - toml_internal!(@toplevel $root [$(&concat!($("-", toml_internal!(@path $path),)+)[1..],)+] $($rest)*); + $crate::toml_internal!(@toplevel $root [$(&concat!($("-", $crate::toml_internal!(@path $path),)+)[1..],)+] $($rest)*); }; // Parse datetime from string and insert into table. (@topleveldatetime $root:ident [$($path:tt)*] $($($k:tt)-+).+ = ($($datetime:tt)+) $($rest:tt)*) => { $crate::macros::insert_toml( &mut $root, - &[$($path)* $(&concat!($("-", toml_internal!(@path $k),)+)[1..], )+], + &[$($path)* $(&concat!($("-", $crate::toml_internal!(@path $k),)+)[1..], )+], $crate::Value::Datetime(concat!($(stringify!($datetime)),+).parse().unwrap())); - toml_internal!(@toplevel $root [$($path)*] $($rest)*); + $crate::toml_internal!(@toplevel $root [$($path)*] $($rest)*); }; // Turn a path segment into a string. @@ -190,14 +187,14 @@ // Construct a Value from an inline table. (@value { $($inline:tt)* }) => {{ let mut table = $crate::Value::Table($crate::value::Table::new()); - toml_internal!(@trailingcomma (@table table) $($inline)*); + $crate::toml_internal!(@trailingcomma (@table table) $($inline)*); table }}; // Construct a Value from an inline array. (@value [ $($inline:tt)* ]) => {{ let mut array = $crate::value::Array::new(); - toml_internal!(@trailingcomma (@array array) $($inline)*); + $crate::toml_internal!(@trailingcomma (@array array) $($inline)*); $crate::Value::Array(array) }}; @@ -237,81 +234,81 @@ // Parse negative number `key = -value`. (@table $root:ident $($($k:tt)-+).+ = - $v:tt , $($rest:tt)*) => { - toml_internal!(@table $root $($($k)-+).+ = (-$v) , $($rest)*); + $crate::toml_internal!(@table $root $($($k)-+).+ = (-$v) , $($rest)*); }; // Parse positive number `key = +value`. (@table $root:ident $($($k:tt)-+).+ = + $v:tt , $($rest:tt)*) => { - toml_internal!(@table $root $($($k)-+).+ = ($v) , $($rest)*); + $crate::toml_internal!(@table $root $($($k)-+).+ = ($v) , $($rest)*); }; // Parse offset datetime `key = 1979-05-27T00:32:00.999999-07:00`. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt . $frac:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); + $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); }; // Space instead of T. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt . $frac:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); + $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); }; // Parse offset datetime `key = 1979-05-27T00:32:00-07:00`. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec - $tzh : $tzm) $($rest)*); + $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec - $tzh : $tzm) $($rest)*); }; // Space instead of T. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec - $tzh : $tzm) $($rest)*); + $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec - $tzh : $tzm) $($rest)*); }; // Parse local datetime `key = 1979-05-27T00:32:00.999999`. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt . $frac:tt , $($rest:tt)*) => { - toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac) $($rest)*); + $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac) $($rest)*); }; // Space instead of T. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt . $frac:tt , $($rest:tt)*) => { - toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac) $($rest)*); + $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac) $($rest)*); }; // Parse offset datetime `key = 1979-05-27T07:32:00Z` and local datetime `key = 1979-05-27T07:32:00`. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt , $($rest:tt)*) => { - toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec) $($rest)*); + $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec) $($rest)*); }; // Space instead of T. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt , $($rest:tt)*) => { - toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec) $($rest)*); + $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec) $($rest)*); }; // Parse local date `key = 1979-05-27`. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt , $($rest:tt)*) => { - toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day) $($rest)*); + $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day) $($rest)*); }; // Parse local time `key = 00:32:00.999999`. (@table $root:ident $($($k:tt)-+).+ = $hr:tt : $min:tt : $sec:tt . $frac:tt , $($rest:tt)*) => { - toml_internal!(@tabledatetime $root $($($k)-+).+ = ($hr : $min : $sec . $frac) $($rest)*); + $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($hr : $min : $sec . $frac) $($rest)*); }; // Parse local time `key = 07:32:00`. (@table $root:ident $($($k:tt)-+).+ = $hr:tt : $min:tt : $sec:tt , $($rest:tt)*) => { - toml_internal!(@tabledatetime $root $($($k)-+).+ = ($hr : $min : $sec) $($rest)*); + $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($hr : $min : $sec) $($rest)*); }; // Parse any other type, probably string or boolean or number. (@table $root:ident $($($k:tt)-+).+ = $v:tt , $($rest:tt)*) => { $crate::macros::insert_toml( &mut $root, - &[$(&concat!($("-", toml_internal!(@path $k),)+)[1..], )+], - toml_internal!(@value $v)); - toml_internal!(@table $root $($rest)*); + &[$(&concat!($("-", $crate::toml_internal!(@path $k),)+)[1..], )+], + $crate::toml_internal!(@value $v)); + $crate::toml_internal!(@table $root $($rest)*); }; // Parse a Datetime from string and continue in @table state. (@tabledatetime $root:ident $($($k:tt)-+).+ = ($($datetime:tt)*) $($rest:tt)*) => { $crate::macros::insert_toml( &mut $root, - &[$(&concat!($("-", toml_internal!(@path $k),)+)[1..], )+], + &[$(&concat!($("-", $crate::toml_internal!(@path $k),)+)[1..], )+], $crate::Value::Datetime(concat!($(stringify!($datetime)),+).parse().unwrap())); - toml_internal!(@table $root $($rest)*); + $crate::toml_internal!(@table $root $($rest)*); }; // Base case of inline array. @@ -319,95 +316,95 @@ // Parse negative number `-value`. (@array $root:ident - $v:tt , $($rest:tt)*) => { - toml_internal!(@array $root (-$v) , $($rest)*); + $crate::toml_internal!(@array $root (-$v) , $($rest)*); }; // Parse positive number `+value`. (@array $root:ident + $v:tt , $($rest:tt)*) => { - toml_internal!(@array $root ($v) , $($rest)*); + $crate::toml_internal!(@array $root ($v) , $($rest)*); }; // Parse offset datetime `1979-05-27T00:32:00.999999-07:00`. (@array $root:ident $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt . $frac:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - toml_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); + $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); }; // Space instead of T. (@array $root:ident $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt . $frac:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - toml_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); + $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); }; // Parse offset datetime `1979-05-27T00:32:00-07:00`. (@array $root:ident $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - toml_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec - $tzh : $tzm) $($rest)*); + $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec - $tzh : $tzm) $($rest)*); }; // Space instead of T. (@array $root:ident $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - toml_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec - $tzh : $tzm) $($rest)*); + $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec - $tzh : $tzm) $($rest)*); }; // Parse local datetime `1979-05-27T00:32:00.999999`. (@array $root:ident $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt . $frac:tt , $($rest:tt)*) => { - toml_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec . $frac) $($rest)*); + $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec . $frac) $($rest)*); }; // Space instead of T. (@array $root:ident $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt . $frac:tt , $($rest:tt)*) => { - toml_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec . $frac) $($rest)*); + $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec . $frac) $($rest)*); }; // Parse offset datetime `1979-05-27T07:32:00Z` and local datetime `1979-05-27T07:32:00`. (@array $root:ident $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt , $($rest:tt)*) => { - toml_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec) $($rest)*); + $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec) $($rest)*); }; // Space instead of T. (@array $root:ident $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt , $($rest:tt)*) => { - toml_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec) $($rest)*); + $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec) $($rest)*); }; // Parse local date `1979-05-27`. (@array $root:ident $yr:tt - $mo:tt - $day:tt , $($rest:tt)*) => { - toml_internal!(@arraydatetime $root ($yr - $mo - $day) $($rest)*); + $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $day) $($rest)*); }; // Parse local time `00:32:00.999999`. (@array $root:ident $hr:tt : $min:tt : $sec:tt . $frac:tt , $($rest:tt)*) => { - toml_internal!(@arraydatetime $root ($hr : $min : $sec . $frac) $($rest)*); + $crate::toml_internal!(@arraydatetime $root ($hr : $min : $sec . $frac) $($rest)*); }; // Parse local time `07:32:00`. (@array $root:ident $hr:tt : $min:tt : $sec:tt , $($rest:tt)*) => { - toml_internal!(@arraydatetime $root ($hr : $min : $sec) $($rest)*); + $crate::toml_internal!(@arraydatetime $root ($hr : $min : $sec) $($rest)*); }; // Parse any other type, probably string or boolean or number. (@array $root:ident $v:tt , $($rest:tt)*) => { - $root.push(toml_internal!(@value $v)); - toml_internal!(@array $root $($rest)*); + $root.push($crate::toml_internal!(@value $v)); + $crate::toml_internal!(@array $root $($rest)*); }; // Parse a Datetime from string and continue in @array state. (@arraydatetime $root:ident ($($datetime:tt)*) $($rest:tt)*) => { $root.push($crate::Value::Datetime(concat!($(stringify!($datetime)),+).parse().unwrap())); - toml_internal!(@array $root $($rest)*); + $crate::toml_internal!(@array $root $($rest)*); }; // No trailing comma required if the tokens are empty. (@trailingcomma ($($args:tt)*)) => { - toml_internal!($($args)*); + $crate::toml_internal!($($args)*); }; // Tokens end with a trailing comma, do not append another one. (@trailingcomma ($($args:tt)*) ,) => { - toml_internal!($($args)* ,); + $crate::toml_internal!($($args)* ,); }; // Tokens end with something other than comma, append a trailing comma. (@trailingcomma ($($args:tt)*) $last:tt) => { - toml_internal!($($args)* $last ,); + $crate::toml_internal!($($args)* $last ,); }; // Not yet at the last token. (@trailingcomma ($($args:tt)*) $first:tt $($rest:tt)+) => { - toml_internal!(@trailingcomma ($($args)* $first) $($rest)+); + $crate::toml_internal!(@trailingcomma ($($args)* $first) $($rest)+); }; } @@ -424,7 +421,10 @@ if !target.is_array() { *target = Value::Array(Array::new()); } - target.as_array_mut().unwrap().push(Value::Table(Table::new())); + target + .as_array_mut() + .unwrap() + .push(Value::Table(Table::new())); } fn traverse<'a>(root: &'a mut Value, path: &[&str]) -> &'a mut Value { diff -Nru cargo-0.35.0/vendor/toml/src/map.rs cargo-0.37.0/vendor/toml/src/map.rs --- cargo-0.35.0/vendor/toml/src/map.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/toml/src/map.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,595 @@ +// Copyright 2017 Serde Developers +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! A map of String to toml::Value. +//! +//! By default the map is backed by a [`BTreeMap`]. Enable the `preserve_order` +//! feature of toml-rs to use [`LinkedHashMap`] instead. +//! +//! [`BTreeMap`]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html +//! [`LinkedHashMap`]: https://docs.rs/linked-hash-map/*/linked_hash_map/struct.LinkedHashMap.html + +use crate::value::Value; +use serde::{de, ser}; +use std::borrow::Borrow; +use std::fmt::{self, Debug}; +use std::hash::Hash; +use std::iter::FromIterator; +use std::ops; + +#[cfg(not(feature = "preserve_order"))] +use std::collections::{btree_map, BTreeMap}; + +#[cfg(feature = "preserve_order")] +use linked_hash_map::{self, LinkedHashMap}; + +/// Represents a JSON key/value type. +pub struct Map { + map: MapImpl, +} + +#[cfg(not(feature = "preserve_order"))] +type MapImpl = BTreeMap; +#[cfg(feature = "preserve_order")] +type MapImpl = LinkedHashMap; + +impl Map { + /// Makes a new empty Map. + #[inline] + pub fn new() -> Self { + Map { + map: MapImpl::new(), + } + } + + #[cfg(not(feature = "preserve_order"))] + /// Makes a new empty Map with the given initial capacity. + #[inline] + pub fn with_capacity(capacity: usize) -> Self { + // does not support with_capacity + let _ = capacity; + Map { + map: BTreeMap::new(), + } + } + + #[cfg(feature = "preserve_order")] + /// Makes a new empty Map with the given initial capacity. + #[inline] + pub fn with_capacity(capacity: usize) -> Self { + Map { + map: LinkedHashMap::with_capacity(capacity), + } + } + + /// Clears the map, removing all values. + #[inline] + pub fn clear(&mut self) { + self.map.clear() + } + + /// Returns a reference to the value corresponding to the key. + /// + /// The key may be any borrowed form of the map's key type, but the ordering + /// on the borrowed form *must* match the ordering on the key type. + #[inline] + pub fn get(&self, key: &Q) -> Option<&Value> + where + String: Borrow, + Q: Ord + Eq + Hash, + { + self.map.get(key) + } + + /// Returns true if the map contains a value for the specified key. + /// + /// The key may be any borrowed form of the map's key type, but the ordering + /// on the borrowed form *must* match the ordering on the key type. + #[inline] + pub fn contains_key(&self, key: &Q) -> bool + where + String: Borrow, + Q: Ord + Eq + Hash, + { + self.map.contains_key(key) + } + + /// Returns a mutable reference to the value corresponding to the key. + /// + /// The key may be any borrowed form of the map's key type, but the ordering + /// on the borrowed form *must* match the ordering on the key type. + #[inline] + pub fn get_mut(&mut self, key: &Q) -> Option<&mut Value> + where + String: Borrow, + Q: Ord + Eq + Hash, + { + self.map.get_mut(key) + } + + /// Inserts a key-value pair into the map. + /// + /// If the map did not have this key present, `None` is returned. + /// + /// If the map did have this key present, the value is updated, and the old + /// value is returned. The key is not updated, though; this matters for + /// types that can be `==` without being identical. + #[inline] + pub fn insert(&mut self, k: String, v: Value) -> Option { + self.map.insert(k, v) + } + + /// Removes a key from the map, returning the value at the key if the key + /// was previously in the map. + /// + /// The key may be any borrowed form of the map's key type, but the ordering + /// on the borrowed form *must* match the ordering on the key type. + #[inline] + pub fn remove(&mut self, key: &Q) -> Option + where + String: Borrow, + Q: Ord + Eq + Hash, + { + self.map.remove(key) + } + + /// Gets the given key's corresponding entry in the map for in-place + /// manipulation. + pub fn entry(&mut self, key: S) -> Entry<'_> + where + S: Into, + { + #[cfg(feature = "preserve_order")] + use linked_hash_map::Entry as EntryImpl; + #[cfg(not(feature = "preserve_order"))] + use std::collections::btree_map::Entry as EntryImpl; + + match self.map.entry(key.into()) { + EntryImpl::Vacant(vacant) => Entry::Vacant(VacantEntry { vacant: vacant }), + EntryImpl::Occupied(occupied) => Entry::Occupied(OccupiedEntry { occupied: occupied }), + } + } + + /// Returns the number of elements in the map. + #[inline] + pub fn len(&self) -> usize { + self.map.len() + } + + /// Returns true if the map contains no elements. + #[inline] + pub fn is_empty(&self) -> bool { + self.map.is_empty() + } + + /// Gets an iterator over the entries of the map. + #[inline] + pub fn iter(&self) -> Iter<'_> { + Iter { + iter: self.map.iter(), + } + } + + /// Gets a mutable iterator over the entries of the map. + #[inline] + pub fn iter_mut(&mut self) -> IterMut<'_> { + IterMut { + iter: self.map.iter_mut(), + } + } + + /// Gets an iterator over the keys of the map. + #[inline] + pub fn keys(&self) -> Keys<'_> { + Keys { + iter: self.map.keys(), + } + } + + /// Gets an iterator over the values of the map. + #[inline] + pub fn values(&self) -> Values<'_> { + Values { + iter: self.map.values(), + } + } +} + +impl Default for Map { + #[inline] + fn default() -> Self { + Map { + map: MapImpl::new(), + } + } +} + +impl Clone for Map { + #[inline] + fn clone(&self) -> Self { + Map { + map: self.map.clone(), + } + } +} + +impl PartialEq for Map { + #[inline] + fn eq(&self, other: &Self) -> bool { + self.map.eq(&other.map) + } +} + +/// Access an element of this map. Panics if the given key is not present in the +/// map. +impl<'a, Q: ?Sized> ops::Index<&'a Q> for Map +where + String: Borrow, + Q: Ord + Eq + Hash, +{ + type Output = Value; + + fn index(&self, index: &Q) -> &Value { + self.map.index(index) + } +} + +/// Mutably access an element of this map. Panics if the given key is not +/// present in the map. +impl<'a, Q: ?Sized> ops::IndexMut<&'a Q> for Map +where + String: Borrow, + Q: Ord + Eq + Hash, +{ + fn index_mut(&mut self, index: &Q) -> &mut Value { + self.map.get_mut(index).expect("no entry found for key") + } +} + +impl Debug for Map { + #[inline] + fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { + self.map.fmt(formatter) + } +} + +impl ser::Serialize for Map { + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: ser::Serializer, + { + use serde::ser::SerializeMap; + let mut map = serializer.serialize_map(Some(self.len()))?; + for (k, v) in self { + map.serialize_key(k)?; + map.serialize_value(v)?; + } + map.end() + } +} + +impl<'de> de::Deserialize<'de> for Map { + #[inline] + fn deserialize(deserializer: D) -> Result + where + D: de::Deserializer<'de>, + { + struct Visitor; + + impl<'de> de::Visitor<'de> for Visitor { + type Value = Map; + + fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { + formatter.write_str("a map") + } + + #[inline] + fn visit_unit(self) -> Result + where + E: de::Error, + { + Ok(Map::new()) + } + + #[inline] + fn visit_map(self, mut visitor: V) -> Result + where + V: de::MapAccess<'de>, + { + let mut values = Map::new(); + + while let Some((key, value)) = visitor.next_entry()? { + values.insert(key, value); + } + + Ok(values) + } + } + + deserializer.deserialize_map(Visitor) + } +} + +impl FromIterator<(String, Value)> for Map { + fn from_iter(iter: T) -> Self + where + T: IntoIterator, + { + Map { + map: FromIterator::from_iter(iter), + } + } +} + +impl Extend<(String, Value)> for Map { + fn extend(&mut self, iter: T) + where + T: IntoIterator, + { + self.map.extend(iter); + } +} + +macro_rules! delegate_iterator { + (($name:ident $($generics:tt)*) => $item:ty) => { + impl $($generics)* Iterator for $name $($generics)* { + type Item = $item; + #[inline] + fn next(&mut self) -> Option { + self.iter.next() + } + #[inline] + fn size_hint(&self) -> (usize, Option) { + self.iter.size_hint() + } + } + + impl $($generics)* DoubleEndedIterator for $name $($generics)* { + #[inline] + fn next_back(&mut self) -> Option { + self.iter.next_back() + } + } + + impl $($generics)* ExactSizeIterator for $name $($generics)* { + #[inline] + fn len(&self) -> usize { + self.iter.len() + } + } + } +} + +////////////////////////////////////////////////////////////////////////////// + +/// A view into a single entry in a map, which may either be vacant or occupied. +/// This enum is constructed from the [`entry`] method on [`Map`]. +/// +/// [`entry`]: struct.Map.html#method.entry +/// [`Map`]: struct.Map.html +pub enum Entry<'a> { + /// A vacant Entry. + Vacant(VacantEntry<'a>), + /// An occupied Entry. + Occupied(OccupiedEntry<'a>), +} + +/// A vacant Entry. It is part of the [`Entry`] enum. +/// +/// [`Entry`]: enum.Entry.html +pub struct VacantEntry<'a> { + vacant: VacantEntryImpl<'a>, +} + +/// An occupied Entry. It is part of the [`Entry`] enum. +/// +/// [`Entry`]: enum.Entry.html +pub struct OccupiedEntry<'a> { + occupied: OccupiedEntryImpl<'a>, +} + +#[cfg(not(feature = "preserve_order"))] +type VacantEntryImpl<'a> = btree_map::VacantEntry<'a, String, Value>; +#[cfg(feature = "preserve_order")] +type VacantEntryImpl<'a> = linked_hash_map::VacantEntry<'a, String, Value>; + +#[cfg(not(feature = "preserve_order"))] +type OccupiedEntryImpl<'a> = btree_map::OccupiedEntry<'a, String, Value>; +#[cfg(feature = "preserve_order")] +type OccupiedEntryImpl<'a> = linked_hash_map::OccupiedEntry<'a, String, Value>; + +impl<'a> Entry<'a> { + /// Returns a reference to this entry's key. + pub fn key(&self) -> &String { + match *self { + Entry::Vacant(ref e) => e.key(), + Entry::Occupied(ref e) => e.key(), + } + } + + /// Ensures a value is in the entry by inserting the default if empty, and + /// returns a mutable reference to the value in the entry. + pub fn or_insert(self, default: Value) -> &'a mut Value { + match self { + Entry::Vacant(entry) => entry.insert(default), + Entry::Occupied(entry) => entry.into_mut(), + } + } + + /// Ensures a value is in the entry by inserting the result of the default + /// function if empty, and returns a mutable reference to the value in the + /// entry. + pub fn or_insert_with(self, default: F) -> &'a mut Value + where + F: FnOnce() -> Value, + { + match self { + Entry::Vacant(entry) => entry.insert(default()), + Entry::Occupied(entry) => entry.into_mut(), + } + } +} + +impl<'a> VacantEntry<'a> { + /// Gets a reference to the key that would be used when inserting a value + /// through the VacantEntry. + #[inline] + pub fn key(&self) -> &String { + self.vacant.key() + } + + /// Sets the value of the entry with the VacantEntry's key, and returns a + /// mutable reference to it. + #[inline] + pub fn insert(self, value: Value) -> &'a mut Value { + self.vacant.insert(value) + } +} + +impl<'a> OccupiedEntry<'a> { + /// Gets a reference to the key in the entry. + #[inline] + pub fn key(&self) -> &String { + self.occupied.key() + } + + /// Gets a reference to the value in the entry. + #[inline] + pub fn get(&self) -> &Value { + self.occupied.get() + } + + /// Gets a mutable reference to the value in the entry. + #[inline] + pub fn get_mut(&mut self) -> &mut Value { + self.occupied.get_mut() + } + + /// Converts the entry into a mutable reference to its value. + #[inline] + pub fn into_mut(self) -> &'a mut Value { + self.occupied.into_mut() + } + + /// Sets the value of the entry with the `OccupiedEntry`'s key, and returns + /// the entry's old value. + #[inline] + pub fn insert(&mut self, value: Value) -> Value { + self.occupied.insert(value) + } + + /// Takes the value of the entry out of the map, and returns it. + #[inline] + pub fn remove(self) -> Value { + self.occupied.remove() + } +} + +////////////////////////////////////////////////////////////////////////////// + +impl<'a> IntoIterator for &'a Map { + type Item = (&'a String, &'a Value); + type IntoIter = Iter<'a>; + #[inline] + fn into_iter(self) -> Self::IntoIter { + Iter { + iter: self.map.iter(), + } + } +} + +/// An iterator over a toml::Map's entries. +pub struct Iter<'a> { + iter: IterImpl<'a>, +} + +#[cfg(not(feature = "preserve_order"))] +type IterImpl<'a> = btree_map::Iter<'a, String, Value>; +#[cfg(feature = "preserve_order")] +type IterImpl<'a> = linked_hash_map::Iter<'a, String, Value>; + +delegate_iterator!((Iter<'a>) => (&'a String, &'a Value)); + +////////////////////////////////////////////////////////////////////////////// + +impl<'a> IntoIterator for &'a mut Map { + type Item = (&'a String, &'a mut Value); + type IntoIter = IterMut<'a>; + #[inline] + fn into_iter(self) -> Self::IntoIter { + IterMut { + iter: self.map.iter_mut(), + } + } +} + +/// A mutable iterator over a toml::Map's entries. +pub struct IterMut<'a> { + iter: IterMutImpl<'a>, +} + +#[cfg(not(feature = "preserve_order"))] +type IterMutImpl<'a> = btree_map::IterMut<'a, String, Value>; +#[cfg(feature = "preserve_order")] +type IterMutImpl<'a> = linked_hash_map::IterMut<'a, String, Value>; + +delegate_iterator!((IterMut<'a>) => (&'a String, &'a mut Value)); + +////////////////////////////////////////////////////////////////////////////// + +impl IntoIterator for Map { + type Item = (String, Value); + type IntoIter = IntoIter; + #[inline] + fn into_iter(self) -> Self::IntoIter { + IntoIter { + iter: self.map.into_iter(), + } + } +} + +/// An owning iterator over a toml::Map's entries. +pub struct IntoIter { + iter: IntoIterImpl, +} + +#[cfg(not(feature = "preserve_order"))] +type IntoIterImpl = btree_map::IntoIter; +#[cfg(feature = "preserve_order")] +type IntoIterImpl = linked_hash_map::IntoIter; + +delegate_iterator!((IntoIter) => (String, Value)); + +////////////////////////////////////////////////////////////////////////////// + +/// An iterator over a toml::Map's keys. +pub struct Keys<'a> { + iter: KeysImpl<'a>, +} + +#[cfg(not(feature = "preserve_order"))] +type KeysImpl<'a> = btree_map::Keys<'a, String, Value>; +#[cfg(feature = "preserve_order")] +type KeysImpl<'a> = linked_hash_map::Keys<'a, String, Value>; + +delegate_iterator!((Keys<'a>) => &'a String); + +////////////////////////////////////////////////////////////////////////////// + +/// An iterator over a toml::Map's values. +pub struct Values<'a> { + iter: ValuesImpl<'a>, +} + +#[cfg(not(feature = "preserve_order"))] +type ValuesImpl<'a> = btree_map::Values<'a, String, Value>; +#[cfg(feature = "preserve_order")] +type ValuesImpl<'a> = linked_hash_map::Values<'a, String, Value>; + +delegate_iterator!((Values<'a>) => &'a Value); diff -Nru cargo-0.35.0/vendor/toml/src/ser.rs cargo-0.37.0/vendor/toml/src/ser.rs --- cargo-0.35.0/vendor/toml/src/ser.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/toml/src/ser.rs 2019-07-17 05:42:23.000000000 +0000 @@ -12,8 +12,7 @@ //! may use the `tables_last` function in this module like so: //! //! ```rust -//! # #[macro_use] extern crate serde_derive; -//! # extern crate toml; +//! # use serde_derive::Serialize; //! # use std::collections::HashMap; //! #[derive(Serialize)] //! struct Manifest { @@ -32,8 +31,8 @@ use std::marker; use std::rc::Rc; +use crate::datetime; use serde::ser; -use datetime; /// Serialize the given data structure as a TOML byte vector. /// @@ -41,7 +40,8 @@ /// fail, if `T` contains a map with non-string keys, or if `T` attempts to /// serialize an unsupported datatype such as an enum, tuple, or tuple struct. pub fn to_vec(value: &T) -> Result, Error> - where T: ser::Serialize, +where + T: ser::Serialize, { to_string(value).map(|e| e.into_bytes()) } @@ -55,9 +55,7 @@ /// # Examples /// /// ``` -/// #[macro_use] -/// extern crate serde_derive; -/// extern crate toml; +/// use serde_derive::Serialize; /// /// #[derive(Serialize)] /// struct Config { @@ -87,7 +85,8 @@ /// } /// ``` pub fn to_string(value: &T) -> Result - where T: ser::Serialize, +where + T: ser::Serialize, { let mut dst = String::with_capacity(128); value.serialize(&mut Serializer::new(&mut dst))?; @@ -99,7 +98,8 @@ /// This is identical to `to_string` except the output string has a more /// "pretty" output. See `Serializer::pretty` for more details. pub fn to_string_pretty(value: &T) -> Result - where T: ser::Serialize, +where + T: ser::Serialize, { let mut dst = String::with_capacity(128); value.serialize(&mut Serializer::pretty(&mut dst))?; @@ -177,9 +177,7 @@ impl StringSettings { fn pretty() -> StringSettings { - StringSettings { - literal: true, - } + StringSettings { literal: true } } } @@ -239,7 +237,7 @@ key: String, first: Cell, table_emitted: Cell, - } + }, } impl<'a> Serializer<'a> { @@ -333,13 +331,13 @@ /// """ /// ``` pub fn pretty_string_literal(&mut self, value: bool) -> &mut Self { - let use_default = if let &mut Some(ref mut s) = &mut Rc::get_mut(&mut self.settings) - .unwrap().string { - s.literal = value; - false - } else { - true - }; + let use_default = + if let &mut Some(ref mut s) = &mut Rc::get_mut(&mut self.settings).unwrap().string { + s.literal = value; + false + } else { + true + }; if use_default { let mut string = StringSettings::pretty(); @@ -389,13 +387,13 @@ /// /// See `Serializer::pretty_array` for more details. pub fn pretty_array_indent(&mut self, value: usize) -> &mut Self { - let use_default = if let &mut Some(ref mut a) = &mut Rc::get_mut(&mut self.settings) - .unwrap().array { - a.indent = value; - false - } else { - true - }; + let use_default = + if let &mut Some(ref mut a) = &mut Rc::get_mut(&mut self.settings).unwrap().array { + a.indent = value; + false + } else { + true + }; if use_default { let mut array = ArraySettings::pretty(); @@ -409,13 +407,13 @@ /// /// See `Serializer::pretty_array` for more details. pub fn pretty_array_trailing_comma(&mut self, value: bool) -> &mut Self { - let use_default = if let &mut Some(ref mut a) = &mut Rc::get_mut(&mut self.settings) - .unwrap().array { - a.trailing_comma = value; - false - } else { - true - }; + let use_default = + if let &mut Some(ref mut a) = &mut Rc::get_mut(&mut self.settings).unwrap().array { + a.trailing_comma = value; + false + } else { + true + }; if use_default { let mut array = ArraySettings::pretty(); @@ -425,9 +423,7 @@ self } - fn display(&mut self, - t: T, - type_: &'static str) -> Result<(), Error> { + fn display(&mut self, t: T, type_: &'static str) -> Result<(), Error> { self.emit_key(type_)?; drop(write!(self.dst, "{}", t)); if let State::Table { .. } = self.state { @@ -443,19 +439,29 @@ } // recursive implementation of `emit_key` above - fn _emit_key(&mut self, state: &State) -> Result<(), Error> { + fn _emit_key(&mut self, state: &State<'_>) -> Result<(), Error> { match *state { State::End => Ok(()), - State::Array { parent, first, type_, len } => { + State::Array { + parent, + first, + type_, + len, + } => { assert!(type_.get().is_some()); if first.get() { self._emit_key(parent)?; } self.emit_array(first, len) } - State::Table { parent, first, table_emitted, key } => { + State::Table { + parent, + first, + table_emitted, + key, + } => { if table_emitted.get() { - return Err(Error::ValueAfterTable) + return Err(Error::ValueAfterTable); } if first.get() { self.emit_table_header(parent)?; @@ -470,13 +476,13 @@ fn emit_array(&mut self, first: &Cell, len: Option) -> Result<(), Error> { match (len, &self.settings.array) { - (Some(0...1), _) | (_, &None) => { + (Some(0..=1), _) | (_, &None) => { if first.get() { self.dst.push_str("[") } else { self.dst.push_str(", ") } - }, + } (_, &Some(ref a)) => { if first.get() { self.dst.push_str("[\n") @@ -486,7 +492,7 @@ for _ in 0..a.indent { self.dst.push_str(" "); } - }, + } } Ok(()) } @@ -498,7 +504,7 @@ }; if let Some(prev) = prev.get() { if prev != type_ { - return Err(Error::ArrayMixedType) + return Err(Error::ArrayMixedType); } } else { prev.set(Some(type_)); @@ -507,14 +513,9 @@ } fn escape_key(&mut self, key: &str) -> Result<(), Error> { - let ok = key.chars().all(|c| { - match c { - 'a' ... 'z' | - 'A' ... 'Z' | - '0' ... '9' | - '-' | '_' => true, - _ => false, - } + let ok = key.chars().all(|c| match c { + 'a'..='z' | 'A'..='Z' | '0'..='9' | '-' | '_' => true, + _ => false, }); if ok { drop(write!(self.dst, "{}", key)); @@ -570,7 +571,7 @@ found_singles = 0 } match ch { - '\t' => {}, + '\t' => {} '\n' => ty = Type::NewlineTripple, // note that the following are invalid: \b \f \r c if c < '\u{1f}' => can_be_pretty = false, // Invalid control character @@ -606,8 +607,9 @@ let repr = if !is_key && self.settings.string.is_some() { match (&self.settings.string, do_pretty(value)) { - (&Some(StringSettings { literal: false, .. }), Repr::Literal(_, ty)) => - Repr::Std(ty), + (&Some(StringSettings { literal: false, .. }), Repr::Literal(_, ty)) => { + Repr::Std(ty) + } (_, r @ _) => r, } } else { @@ -626,26 +628,23 @@ Type::OnelineSingle => self.dst.push('\''), _ => self.dst.push_str("'''"), } - }, + } Repr::Std(ty) => { match ty { - Type::NewlineTripple => self.dst.push_str("\"\"\"\n"), + Type::NewlineTripple => self.dst.push_str("\"\"\"\n"), // note: OnelineTripple can happen if do_pretty wants to do // '''it's one line''' // but settings.string.literal == false - Type::OnelineSingle | - Type::OnelineTripple => self.dst.push('"'), + Type::OnelineSingle | Type::OnelineTripple => self.dst.push('"'), } for ch in value.chars() { match ch { '\u{8}' => self.dst.push_str("\\b"), '\u{9}' => self.dst.push_str("\\t"), - '\u{a}' => { - match ty { - Type::NewlineTripple => self.dst.push('\n'), - Type::OnelineSingle => self.dst.push_str("\\n"), - _ => unreachable!(), - } + '\u{a}' => match ty { + Type::NewlineTripple => self.dst.push('\n'), + Type::OnelineSingle => self.dst.push_str("\\n"), + _ => unreachable!(), }, '\u{c}' => self.dst.push_str("\\f"), '\u{d}' => self.dst.push_str("\\r"), @@ -656,15 +655,15 @@ } } match ty { - Type::NewlineTripple => self.dst.push_str("\"\"\""), + Type::NewlineTripple => self.dst.push_str("\"\"\""), Type::OnelineSingle | Type::OnelineTripple => self.dst.push('"'), } - }, + } } Ok(()) } - fn emit_table_header(&mut self, state: &State) -> Result<(), Error> { + fn emit_table_header(&mut self, state: &State<'_>) -> Result<(), Error> { let array_of_tables = match *state { State::End => return Ok(()), State::Array { .. } => true, @@ -684,7 +683,11 @@ if !first.get() { break; } - if let State::Array { parent: &State::Table {..}, ..} = *parent { + if let State::Array { + parent: &State::Table { .. }, + .. + } = *parent + { self.emit_table_header(parent)?; break; } @@ -697,7 +700,7 @@ // table in the document. self.dst.push('\n'); } - }, + } State::Array { parent, first, .. } => { if !first.get() { // Always newline if we are not the first item in the @@ -709,7 +712,7 @@ self.dst.push('\n'); } } - }, + } _ => {} } self.dst.push_str("["); @@ -724,13 +727,18 @@ Ok(()) } - fn emit_key_part(&mut self, key: &State) -> Result { + fn emit_key_part(&mut self, key: &State<'_>) -> Result { match *key { State::Array { parent, .. } => self.emit_key_part(parent), State::End => Ok(true), - State::Table { key, parent, table_emitted, .. } => { + State::Table { + key, + parent, + table_emitted, + .. + } => { table_emitted.set(true); - let first = self.emit_key_part(parent)?; + let first = self.emit_key_part(parent)?; if !first { self.dst.push_str("."); } @@ -841,7 +849,8 @@ } fn serialize_some(self, value: &T) -> Result<(), Self::Error> - where T: ser::Serialize + where + T: ser::Serialize, { value.serialize(self) } @@ -850,40 +859,44 @@ Err(Error::UnsupportedType) } - fn serialize_unit_struct(self, - _name: &'static str) - -> Result<(), Self::Error> { + fn serialize_unit_struct(self, _name: &'static str) -> Result<(), Self::Error> { Err(Error::UnsupportedType) } - fn serialize_unit_variant(self, - _name: &'static str, - _variant_index: u32, - variant: &'static str) - -> Result<(), Self::Error> { + fn serialize_unit_variant( + self, + _name: &'static str, + _variant_index: u32, + variant: &'static str, + ) -> Result<(), Self::Error> { self.serialize_str(variant) } - fn serialize_newtype_struct(self, _name: &'static str, value: &T) - -> Result<(), Self::Error> - where T: ser::Serialize, + fn serialize_newtype_struct( + self, + _name: &'static str, + value: &T, + ) -> Result<(), Self::Error> + where + T: ser::Serialize, { value.serialize(self) } - fn serialize_newtype_variant(self, - _name: &'static str, - _variant_index: u32, - _variant: &'static str, - _value: &T) - -> Result<(), Self::Error> - where T: ser::Serialize, + fn serialize_newtype_variant( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + _value: &T, + ) -> Result<(), Self::Error> + where + T: ser::Serialize, { Err(Error::UnsupportedType) } - fn serialize_seq(self, len: Option) - -> Result { + fn serialize_seq(self, len: Option) -> Result { self.array_type("array")?; Ok(SerializeSeq { ser: self, @@ -893,27 +906,29 @@ }) } - fn serialize_tuple(self, len: usize) - -> Result { + fn serialize_tuple(self, len: usize) -> Result { self.serialize_seq(Some(len)) } - fn serialize_tuple_struct(self, _name: &'static str, len: usize) - -> Result { + fn serialize_tuple_struct( + self, + _name: &'static str, + len: usize, + ) -> Result { self.serialize_seq(Some(len)) } - fn serialize_tuple_variant(self, - _name: &'static str, - _variant_index: u32, - _variant: &'static str, - len: usize) - -> Result { + fn serialize_tuple_variant( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + len: usize, + ) -> Result { self.serialize_seq(Some(len)) } - fn serialize_map(self, _len: Option) - -> Result { + fn serialize_map(self, _len: Option) -> Result { self.array_type("table")?; Ok(SerializeTable::Table { ser: self, @@ -923,8 +938,11 @@ }) } - fn serialize_struct(self, name: &'static str, _len: usize) - -> Result { + fn serialize_struct( + self, + name: &'static str, + _len: usize, + ) -> Result { if name == datetime::NAME { self.array_type("datetime")?; Ok(SerializeTable::Datetime(self)) @@ -939,12 +957,13 @@ } } - fn serialize_struct_variant(self, - _name: &'static str, - _variant_index: u32, - _variant: &'static str, - _len: usize) - -> Result { + fn serialize_struct_variant( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + _len: usize, + ) -> Result { Err(Error::UnsupportedType) } } @@ -954,7 +973,8 @@ type Error = Error; fn serialize_element(&mut self, value: &T) -> Result<(), Error> - where T: ser::Serialize, + where + T: ser::Serialize, { value.serialize(&mut Serializer { dst: &mut *self.ser.dst, @@ -973,19 +993,17 @@ fn end(self) -> Result<(), Error> { match self.type_.get() { Some("table") => return Ok(()), - Some(_) => { - match (self.len, &self.ser.settings.array) { - (Some(0...1), _) | (_, &None) => { - self.ser.dst.push_str("]"); - }, - (_, &Some(ref a)) => { - if a.trailing_comma { - self.ser.dst.push_str(","); - } - self.ser.dst.push_str("\n]"); - }, + Some(_) => match (self.len, &self.ser.settings.array) { + (Some(0..=1), _) | (_, &None) => { + self.ser.dst.push_str("]"); + } + (_, &Some(ref a)) => { + if a.trailing_comma { + self.ser.dst.push_str(","); + } + self.ser.dst.push_str("\n]"); } - } + }, None => { assert!(self.first.get()); self.ser.emit_key("array")?; @@ -1004,7 +1022,8 @@ type Error = Error; fn serialize_element(&mut self, value: &T) -> Result<(), Error> - where T: ser::Serialize, + where + T: ser::Serialize, { ser::SerializeSeq::serialize_element(self, value) } @@ -1019,7 +1038,8 @@ type Error = Error; fn serialize_field(&mut self, value: &T) -> Result<(), Error> - where T: ser::Serialize, + where + T: ser::Serialize, { ser::SerializeSeq::serialize_element(self, value) } @@ -1034,7 +1054,8 @@ type Error = Error; fn serialize_field(&mut self, value: &T) -> Result<(), Error> - where T: ser::Serialize, + where + T: ser::Serialize, { ser::SerializeSeq::serialize_element(self, value) } @@ -1049,7 +1070,8 @@ type Error = Error; fn serialize_key(&mut self, input: &T) -> Result<(), Error> - where T: ser::Serialize, + where + T: ser::Serialize, { match *self { SerializeTable::Datetime(_) => panic!(), // shouldn't be possible @@ -1062,7 +1084,8 @@ } fn serialize_value(&mut self, value: &T) -> Result<(), Error> - where T: ser::Serialize, + where + T: ser::Serialize, { match *self { SerializeTable::Datetime(_) => panic!(), // shouldn't be possible @@ -1085,7 +1108,7 @@ }); match res { Ok(()) => first.set(false), - Err(Error::UnsupportedNone) => {}, + Err(Error::UnsupportedNone) => {} Err(e) => return Err(e), } } @@ -1096,7 +1119,7 @@ fn end(self) -> Result<(), Error> { match self { SerializeTable::Datetime(_) => panic!(), // shouldn't be possible - SerializeTable::Table { ser, first, .. } => { + SerializeTable::Table { ser, first, .. } => { if first.get() { let state = ser.state.clone(); ser.emit_table_header(&state)?; @@ -1111,16 +1134,16 @@ type Ok = (); type Error = Error; - fn serialize_field(&mut self, key: &'static str, value: &T) - -> Result<(), Error> - where T: ser::Serialize, + fn serialize_field(&mut self, key: &'static str, value: &T) -> Result<(), Error> + where + T: ser::Serialize, { match *self { SerializeTable::Datetime(ref mut ser) => { if key == datetime::FIELD { value.serialize(DateStrEmitter(&mut *ser))?; } else { - return Err(Error::DateInvalid) + return Err(Error::DateInvalid); } } SerializeTable::Table { @@ -1141,7 +1164,7 @@ }); match res { Ok(()) => first.set(false), - Err(Error::UnsupportedNone) => {}, + Err(Error::UnsupportedNone) => {} Err(e) => return Err(e), } } @@ -1151,8 +1174,8 @@ fn end(self) -> Result<(), Error> { match self { - SerializeTable::Datetime(_) => {}, - SerializeTable::Table { ser, first, .. } => { + SerializeTable::Datetime(_) => {} + SerializeTable::Table { ser, first, .. } => { if first.get() { let state = ser.state.clone(); ser.emit_table_header(&state)?; @@ -1238,7 +1261,8 @@ } fn serialize_some(self, _value: &T) -> Result<(), Self::Error> - where T: ser::Serialize + where + T: ser::Serialize, { Err(Error::KeyNotString) } @@ -1247,78 +1271,88 @@ Err(Error::KeyNotString) } - fn serialize_unit_struct(self, - _name: &'static str) - -> Result<(), Self::Error> { + fn serialize_unit_struct(self, _name: &'static str) -> Result<(), Self::Error> { Err(Error::DateInvalid) } - fn serialize_unit_variant(self, - _name: &'static str, - _variant_index: u32, - _variant: &'static str) - -> Result<(), Self::Error> { + fn serialize_unit_variant( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + ) -> Result<(), Self::Error> { Err(Error::DateInvalid) } - fn serialize_newtype_struct(self, _name: &'static str, _value: &T) - -> Result<(), Self::Error> - where T: ser::Serialize, + fn serialize_newtype_struct( + self, + _name: &'static str, + _value: &T, + ) -> Result<(), Self::Error> + where + T: ser::Serialize, { Err(Error::DateInvalid) } - fn serialize_newtype_variant(self, - _name: &'static str, - _variant_index: u32, - _variant: &'static str, - _value: &T) - -> Result<(), Self::Error> - where T: ser::Serialize, + fn serialize_newtype_variant( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + _value: &T, + ) -> Result<(), Self::Error> + where + T: ser::Serialize, { Err(Error::DateInvalid) } - fn serialize_seq(self, _len: Option) - -> Result { + fn serialize_seq(self, _len: Option) -> Result { Err(Error::DateInvalid) } - fn serialize_tuple(self, _len: usize) - -> Result { + fn serialize_tuple(self, _len: usize) -> Result { Err(Error::DateInvalid) } - fn serialize_tuple_struct(self, _name: &'static str, _len: usize) - -> Result { + fn serialize_tuple_struct( + self, + _name: &'static str, + _len: usize, + ) -> Result { Err(Error::DateInvalid) } - fn serialize_tuple_variant(self, - _name: &'static str, - _variant_index: u32, - _variant: &'static str, - _len: usize) - -> Result { + fn serialize_tuple_variant( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + _len: usize, + ) -> Result { Err(Error::DateInvalid) } - fn serialize_map(self, _len: Option) - -> Result { + fn serialize_map(self, _len: Option) -> Result { Err(Error::DateInvalid) } - fn serialize_struct(self, _name: &'static str, _len: usize) - -> Result { + fn serialize_struct( + self, + _name: &'static str, + _len: usize, + ) -> Result { Err(Error::DateInvalid) } - fn serialize_struct_variant(self, - _name: &'static str, - _variant_index: u32, - _variant: &'static str, - _len: usize) - -> Result { + fn serialize_struct_variant( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + _len: usize, + ) -> Result { Err(Error::DateInvalid) } } @@ -1397,7 +1431,8 @@ } fn serialize_some(self, _value: &T) -> Result - where T: ser::Serialize + where + T: ser::Serialize, { Err(Error::KeyNotString) } @@ -1406,84 +1441,94 @@ Err(Error::KeyNotString) } - fn serialize_unit_struct(self, - _name: &'static str) - -> Result { + fn serialize_unit_struct(self, _name: &'static str) -> Result { Err(Error::KeyNotString) } - fn serialize_unit_variant(self, - _name: &'static str, - _variant_index: u32, - _variant: &'static str) - -> Result { + fn serialize_unit_variant( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + ) -> Result { Err(Error::KeyNotString) } - fn serialize_newtype_struct(self, _name: &'static str, value: &T) - -> Result - where T: ser::Serialize, + fn serialize_newtype_struct( + self, + _name: &'static str, + value: &T, + ) -> Result + where + T: ser::Serialize, { value.serialize(self) } - fn serialize_newtype_variant(self, - _name: &'static str, - _variant_index: u32, - _variant: &'static str, - _value: &T) - -> Result - where T: ser::Serialize, + fn serialize_newtype_variant( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + _value: &T, + ) -> Result + where + T: ser::Serialize, { Err(Error::KeyNotString) } - fn serialize_seq(self, _len: Option) - -> Result { + fn serialize_seq(self, _len: Option) -> Result { Err(Error::KeyNotString) } - fn serialize_tuple(self, _len: usize) - -> Result { + fn serialize_tuple(self, _len: usize) -> Result { Err(Error::KeyNotString) } - fn serialize_tuple_struct(self, _name: &'static str, _len: usize) - -> Result { + fn serialize_tuple_struct( + self, + _name: &'static str, + _len: usize, + ) -> Result { Err(Error::KeyNotString) } - fn serialize_tuple_variant(self, - _name: &'static str, - _variant_index: u32, - _variant: &'static str, - _len: usize) - -> Result { + fn serialize_tuple_variant( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + _len: usize, + ) -> Result { Err(Error::KeyNotString) } - fn serialize_map(self, _len: Option) - -> Result { + fn serialize_map(self, _len: Option) -> Result { Err(Error::KeyNotString) } - fn serialize_struct(self, _name: &'static str, _len: usize) - -> Result { + fn serialize_struct( + self, + _name: &'static str, + _len: usize, + ) -> Result { Err(Error::KeyNotString) } - fn serialize_struct_variant(self, - _name: &'static str, - _variant_index: u32, - _variant: &'static str, - _len: usize) - -> Result { + fn serialize_struct_variant( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + _len: usize, + ) -> Result { Err(Error::KeyNotString) } } impl fmt::Display for Error { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { Error::UnsupportedType => "unsupported Rust type".fmt(f), Error::KeyNotString => "map key was not a string".fmt(f), @@ -1536,8 +1581,7 @@ /// helper can be used like so: /// /// ```rust -/// # #[macro_use] extern crate serde_derive; -/// # extern crate toml; +/// # use serde_derive::Serialize; /// # use std::collections::HashMap; /// #[derive(Serialize)] /// struct Manifest { @@ -1549,12 +1593,12 @@ /// # type Dependency = String; /// # fn main() {} /// ``` -pub fn tables_last<'a, I, K, V, S>(data: &'a I, serializer: S) - -> Result - where &'a I: IntoIterator, - K: ser::Serialize, - V: ser::Serialize, - S: ser::Serializer +pub fn tables_last<'a, I, K, V, S>(data: &'a I, serializer: S) -> Result +where + &'a I: IntoIterator, + K: ser::Serialize, + V: ser::Serialize, + S: ser::Serializer, { use serde::ser::SerializeMap; @@ -1668,15 +1712,30 @@ Err(ser::Error::custom("unsupported")) } - fn serialize_unit_variant(self, _: &'static str, _: u32, _: &'static str) -> Result { + fn serialize_unit_variant( + self, + _: &'static str, + _: u32, + _: &'static str, + ) -> Result { Err(ser::Error::custom("unsupported")) } - fn serialize_newtype_struct(self, _: &'static str, v: &T) -> Result { + fn serialize_newtype_struct( + self, + _: &'static str, + v: &T, + ) -> Result { v.serialize(self) } - fn serialize_newtype_variant(self, _: &'static str, _: u32, _: &'static str, _: &T) -> Result { + fn serialize_newtype_variant( + self, + _: &'static str, + _: u32, + _: &'static str, + _: &T, + ) -> Result { Err(ser::Error::custom("unsupported")) } @@ -1688,11 +1747,21 @@ Ok(self) } - fn serialize_tuple_struct(self, _: &'static str, _: usize) -> Result { + fn serialize_tuple_struct( + self, + _: &'static str, + _: usize, + ) -> Result { Ok(self) } - fn serialize_tuple_variant(self, _: &'static str, _: u32, _: &'static str, _: usize) -> Result { + fn serialize_tuple_variant( + self, + _: &'static str, + _: u32, + _: &'static str, + _: usize, + ) -> Result { Ok(self) } @@ -1704,7 +1773,13 @@ Ok(self) } - fn serialize_struct_variant(self, _: &'static str, _: u32, _: &'static str, _: usize) -> Result { + fn serialize_struct_variant( + self, + _: &'static str, + _: u32, + _: &'static str, + _: usize, + ) -> Result { Err(ser::Error::custom("unsupported")) } } @@ -1713,8 +1788,7 @@ type Ok = Category; type Error = E; - fn serialize_element(&mut self, _: &T) - -> Result<(), Self::Error> { + fn serialize_element(&mut self, _: &T) -> Result<(), Self::Error> { Ok(()) } @@ -1727,8 +1801,7 @@ type Ok = Category; type Error = E; - fn serialize_element(&mut self, _: &T) - -> Result<(), Self::Error> { + fn serialize_element(&mut self, _: &T) -> Result<(), Self::Error> { Ok(()) } @@ -1741,8 +1814,7 @@ type Ok = Category; type Error = E; - fn serialize_field(&mut self, _: &T) - -> Result<(), Self::Error> { + fn serialize_field(&mut self, _: &T) -> Result<(), Self::Error> { Ok(()) } @@ -1755,8 +1827,7 @@ type Ok = Category; type Error = E; - fn serialize_field(&mut self, _: &T) - -> Result<(), Self::Error> { + fn serialize_field(&mut self, _: &T) -> Result<(), Self::Error> { Ok(()) } @@ -1769,13 +1840,11 @@ type Ok = Category; type Error = E; - fn serialize_key(&mut self, _: &T) - -> Result<(), Self::Error> { + fn serialize_key(&mut self, _: &T) -> Result<(), Self::Error> { Ok(()) } - fn serialize_value(&mut self, _: &T) - -> Result<(), Self::Error> { + fn serialize_value(&mut self, _: &T) -> Result<(), Self::Error> { Ok(()) } @@ -1788,10 +1857,9 @@ type Ok = Category; type Error = E; - fn serialize_field(&mut self, - _: &'static str, - _: &T) -> Result<(), Self::Error> - where T: ser::Serialize, + fn serialize_field(&mut self, _: &'static str, _: &T) -> Result<(), Self::Error> + where + T: ser::Serialize, { Ok(()) } diff -Nru cargo-0.35.0/vendor/toml/src/spanned.rs cargo-0.37.0/vendor/toml/src/spanned.rs --- cargo-0.35.0/vendor/toml/src/spanned.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/toml/src/spanned.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,8 +1,5 @@ //! ``` -//! #[macro_use] -//! extern crate serde_derive; -//! -//! extern crate toml; +//! use serde_derive::Deserialize; //! use toml::Spanned; //! //! #[derive(Deserialize)] @@ -78,39 +75,43 @@ } impl<'de, T> de::Deserialize<'de> for Spanned - where T: de::Deserialize<'de> +where + T: de::Deserialize<'de>, { fn deserialize(deserializer: D) -> Result, D::Error> - where D: de::Deserializer<'de> + where + D: de::Deserializer<'de>, { struct SpannedVisitor(::std::marker::PhantomData); impl<'de, T> de::Visitor<'de> for SpannedVisitor - where T: de::Deserialize<'de> + where + T: de::Deserialize<'de>, { type Value = Spanned; - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { formatter.write_str("a TOML spanned") } fn visit_map(self, mut visitor: V) -> Result, V::Error> - where V: de::MapAccess<'de> + where + V: de::MapAccess<'de>, { if visitor.next_key()? != Some(START) { - return Err(de::Error::custom("spanned start key not found")) + return Err(de::Error::custom("spanned start key not found")); } let start: usize = visitor.next_value()?; if visitor.next_key()? != Some(END) { - return Err(de::Error::custom("spanned end key not found")) + return Err(de::Error::custom("spanned end key not found")); } let end: usize = visitor.next_value()?; if visitor.next_key()? != Some(VALUE) { - return Err(de::Error::custom("spanned value key not found")) + return Err(de::Error::custom("spanned value key not found")); } let value: T = visitor.next_value()?; @@ -118,7 +119,7 @@ Ok(Spanned { start: start, end: end, - value: value + value: value, }) } } diff -Nru cargo-0.35.0/vendor/toml/src/tokens.rs cargo-0.37.0/vendor/toml/src/tokens.rs --- cargo-0.35.0/vendor/toml/src/tokens.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/toml/src/tokens.rs 2019-07-17 05:42:23.000000000 +0000 @@ -38,7 +38,11 @@ RightBracket, Keylike(&'a str), - String { src: &'a str, val: Cow<'a, str>, multiline: bool }, + String { + src: &'a str, + val: Cow<'a, str>, + multiline: bool, + }, } #[derive(Eq, PartialEq, Debug)] @@ -53,7 +57,11 @@ NewlineInTableKey(usize), MultilineStringKey(usize), EmptyTableKey(usize), - Wanted { at: usize, expected: &'static str, found: &'static str }, + Wanted { + at: usize, + expected: &'static str, + found: &'static str, + }, } #[derive(Clone)] @@ -101,10 +109,16 @@ Some((start, '}')) => (start, RightBrace), Some((start, '[')) => (start, LeftBracket), Some((start, ']')) => (start, RightBracket), - Some((start, '\'')) => return self.literal_string(start) - .map(|t| Some((self.step_span(start), t))), - Some((start, '"')) => return self.basic_string(start) - .map(|t| Some((self.step_span(start), t))), + Some((start, '\'')) => { + return self + .literal_string(start) + .map(|t| Some((self.step_span(start), t))) + } + Some((start, '"')) => { + return self + .basic_string(start) + .map(|t| Some((self.step_span(start), t))) + } Some((start, ch)) if is_keylike(ch) => (start, self.keylike(start)), Some((start, ch)) => return Err(Error::Unexpected(start, ch)), @@ -156,13 +170,11 @@ }) } } - None => { - Err(Error::Wanted { - at: self.input.len(), - expected: expected.describe(), - found: "eof", - }) - } + None => Err(Error::Wanted { + at: self.input.len(), + expected: expected.describe(), + found: "eof", + }), } } @@ -170,33 +182,36 @@ let current = self.current(); match self.next()? { Some((span, Token::Keylike(k))) => Ok((span, k.into())), - Some((span, Token::String { src, val, multiline })) => { + Some(( + span, + Token::String { + src, + val, + multiline, + }, + )) => { let offset = self.substr_offset(src); if multiline { - return Err(Error::MultilineStringKey(offset)) + return Err(Error::MultilineStringKey(offset)); } if val == "" { - return Err(Error::EmptyTableKey(offset)) + return Err(Error::EmptyTableKey(offset)); } match src.find('\n') { None => Ok((span, val)), Some(i) => Err(Error::NewlineInTableKey(offset + i)), } } - Some((_, other)) => { - Err(Error::Wanted { - at: current, - expected: "a table key", - found: other.describe(), - }) - } - None => { - Err(Error::Wanted { - at: self.input.len(), - expected: "a table key", - found: "eof", - }) - } + Some((_, other)) => Err(Error::Wanted { + at: current, + expected: "a table key", + found: other.describe(), + }), + None => Err(Error::Wanted { + at: self.input.len(), + expected: "a table key", + found: "eof", + }), } } @@ -209,7 +224,7 @@ pub fn eat_comment(&mut self) -> Result { if !self.eatc('#') { - return Ok(false) + return Ok(false); } drop(self.comment_token(0)); self.eat_newline_or_eof().map(|()| true) @@ -218,23 +233,19 @@ pub fn eat_newline_or_eof(&mut self) -> Result<(), Error> { let current = self.current(); match self.next()? { - None | - Some((_, Token::Newline)) => Ok(()), - Some((_, other)) => { - Err(Error::Wanted { - at: current, - expected: "newline", - found: other.describe(), - }) - } + None | Some((_, Token::Newline)) => Ok(()), + Some((_, other)) => Err(Error::Wanted { + at: current, + expected: "newline", + found: other.describe(), + }), } } pub fn skip_to_newline(&mut self) { loop { match self.one() { - Some((_, '\n')) | - None => break, + Some((_, '\n')) | None => break, _ => {} } } @@ -251,7 +262,11 @@ } pub fn current(&mut self) -> usize { - self.chars.clone().next().map(|i| i.0).unwrap_or(self.input.len()) + self.chars + .clone() + .next() + .map(|i| i.0) + .unwrap_or(self.input.len()) } pub fn input(&self) -> &'a str { @@ -268,30 +283,35 @@ fn comment_token(&mut self, start: usize) -> Token<'a> { while let Some((_, ch)) = self.chars.clone().next() { if ch != '\t' && (ch < '\u{20}' || ch > '\u{10ffff}') { - break + break; } self.one(); } Comment(&self.input[start..self.current()]) } - fn read_string(&mut self, - delim: char, - start: usize, - new_ch: &mut FnMut(&mut Tokenizer, &mut MaybeString, - bool, usize, char) - -> Result<(), Error>) - -> Result, Error> { + fn read_string( + &mut self, + delim: char, + start: usize, + new_ch: &mut dyn FnMut( + &mut Tokenizer<'_>, + &mut MaybeString, + bool, + usize, + char, + ) -> Result<(), Error>, + ) -> Result, Error> { let mut multiline = false; if self.eatc(delim) { if self.eatc(delim) { multiline = true; } else { return Ok(String { - src: &self.input[start..start+2], + src: &self.input[start..start + 2], val: Cow::Borrowed(""), multiline: false, - }) + }); } } let mut val = MaybeString::NotEscaped(self.current()); @@ -309,28 +329,31 @@ } else { val.push('\n'); } - continue + continue; } else { - return Err(Error::NewlineInString(i)) + return Err(Error::NewlineInString(i)); } } Some((i, ch)) if ch == delim => { if multiline { - for _ in 0..2 { - if !self.eatc(delim) { - val.push(delim); - continue 'outer - } + if !self.eatc(delim) { + val.push(delim); + continue 'outer; + } + if !self.eatc(delim) { + val.push(delim); + val.push(delim); + continue 'outer; } } return Ok(String { src: &self.input[start..self.current()], val: val.into_cow(&self.input[..i]), multiline: multiline, - }) + }); } Some((i, c)) => new_ch(self, &mut val, multiline, i, c)?, - None => return Err(Error::UnterminatedString(start)) + None => return Err(Error::UnterminatedString(start)), } } } @@ -347,61 +370,56 @@ } fn basic_string(&mut self, start: usize) -> Result, Error> { - self.read_string('"', start, &mut |me, val, multi, i, ch| { - match ch { - '\\' => { - val.to_owned(&me.input[..i]); - match me.chars.next() { - Some((_, '"')) => val.push('"'), - Some((_, '\\')) => val.push('\\'), - Some((_, 'b')) => val.push('\u{8}'), - Some((_, 'f')) => val.push('\u{c}'), - Some((_, 'n')) => val.push('\n'), - Some((_, 'r')) => val.push('\r'), - Some((_, 't')) => val.push('\t'), - Some((i, c @ 'u')) | - Some((i, c @ 'U')) => { - let len = if c == 'u' {4} else {8}; - val.push(me.hex(start, i, len)?); - } - Some((i, c @ ' ')) | - Some((i, c @ '\t')) | - Some((i, c @ '\n')) if multi => { - if c != '\n' { - while let Some((_, ch)) = me.chars.clone().next() { - match ch { - ' ' | '\t' => { - me.chars.next(); - continue - }, - '\n' => { - me.chars.next(); - break - }, - _ => return Err(Error::InvalidEscape(i, c)), - } - } - } + self.read_string('"', start, &mut |me, val, multi, i, ch| match ch { + '\\' => { + val.to_owned(&me.input[..i]); + match me.chars.next() { + Some((_, '"')) => val.push('"'), + Some((_, '\\')) => val.push('\\'), + Some((_, 'b')) => val.push('\u{8}'), + Some((_, 'f')) => val.push('\u{c}'), + Some((_, 'n')) => val.push('\n'), + Some((_, 'r')) => val.push('\r'), + Some((_, 't')) => val.push('\t'), + Some((i, c @ 'u')) | Some((i, c @ 'U')) => { + let len = if c == 'u' { 4 } else { 8 }; + val.push(me.hex(start, i, len)?); + } + Some((i, c @ ' ')) | Some((i, c @ '\t')) | Some((i, c @ '\n')) if multi => { + if c != '\n' { while let Some((_, ch)) = me.chars.clone().next() { match ch { - ' ' | '\t' | '\n' => { + ' ' | '\t' => { + me.chars.next(); + continue; + } + '\n' => { me.chars.next(); + break; } - _ => break, + _ => return Err(Error::InvalidEscape(i, c)), } } } - Some((i, c)) => return Err(Error::InvalidEscape(i, c)), - None => return Err(Error::UnterminatedString(start)), + while let Some((_, ch)) = me.chars.clone().next() { + match ch { + ' ' | '\t' | '\n' => { + me.chars.next(); + } + _ => break, + } + } } - Ok(()) - } - ch if '\u{20}' <= ch && ch <= '\u{10ffff}' && ch != '\u{7f}' => { - val.push(ch); - Ok(()) + Some((i, c)) => return Err(Error::InvalidEscape(i, c)), + None => return Err(Error::UnterminatedString(start)), } - _ => Err(Error::InvalidCharInString(i, ch)) + Ok(()) + } + ch if '\u{20}' <= ch && ch <= '\u{10ffff}' && ch != '\u{7f}' => { + val.push(ch); + Ok(()) } + _ => Err(Error::InvalidCharInString(i, ch)), }) } @@ -424,7 +442,7 @@ fn keylike(&mut self, start: usize) -> Token<'a> { while let Some((_, ch)) = self.peek_one() { if !is_keylike(ch) { - break + break; } self.one(); } @@ -441,8 +459,14 @@ /// Calculate the span of a single character. fn step_span(&mut self, start: usize) -> Span { - let end = self.peek_one().map(|t| t.0).unwrap_or_else(|| self.input.len()); - Span { start: start, end: end } + let end = self + .peek_one() + .map(|t| t.0) + .unwrap_or_else(|| self.input.len()); + Span { + start: start, + end: end, + } } /// Peek one char without consuming it. @@ -465,7 +489,7 @@ let mut attempt = self.chars.clone(); if let Some((_, '\n')) = attempt.next() { self.chars = attempt; - return (i, '\n') + return (i, '\n'); } } (i, c) @@ -490,7 +514,7 @@ } } - fn into_cow(self, input: &str) -> Cow { + fn into_cow(self, input: &str) -> Cow<'_, str> { match self { MaybeString::NotEscaped(start) => Cow::Borrowed(&input[start..]), MaybeString::Owned(s) => Cow::Owned(s), @@ -499,11 +523,11 @@ } fn is_keylike(ch: char) -> bool { - ('A' <= ch && ch <= 'Z') || - ('a' <= ch && ch <= 'z') || - ('0' <= ch && ch <= '9') || - ch == '-' || - ch == '_' + ('A' <= ch && ch <= 'Z') + || ('a' <= ch && ch <= 'z') + || ('0' <= ch && ch <= '9') + || ch == '-' + || ch == '_' } impl<'a> Token<'a> { @@ -520,7 +544,13 @@ Token::LeftBrace => "a left brace", Token::RightBracket => "a right bracket", Token::LeftBracket => "a left bracket", - Token::String { multiline, .. } => if multiline { "a multiline string" } else { "a string" }, + Token::String { multiline, .. } => { + if multiline { + "a multiline string" + } else { + "a string" + } + } Token::Colon => "a colon", Token::Plus => "a plus", } @@ -529,8 +559,8 @@ #[cfg(test)] mod tests { + use super::{Error, Token, Tokenizer}; use std::borrow::Cow; - use super::{Tokenizer, Token, Error}; fn err(input: &str, err: Error) { let mut t = Tokenizer::new(input); @@ -544,11 +574,14 @@ fn t(input: &str, val: &str, multiline: bool) { let mut t = Tokenizer::new(input); let (_, token) = t.next().unwrap().unwrap(); - assert_eq!(token, Token::String { - src: input, - val: Cow::Borrowed(val), - multiline: multiline, - }); + assert_eq!( + token, + Token::String { + src: input, + val: Cow::Borrowed(val), + multiline: multiline, + } + ); assert!(t.next().unwrap().is_none()); } @@ -567,11 +600,14 @@ fn t(input: &str, val: &str, multiline: bool) { let mut t = Tokenizer::new(input); let (_, token) = t.next().unwrap().unwrap(); - assert_eq!(token, Token::String { - src: input, - val: Cow::Borrowed(val), - multiline: multiline, - }); + assert_eq!( + token, + Token::String { + src: input, + val: Cow::Borrowed(val), + multiline: multiline, + } + ); assert!(t.next().unwrap().is_none()); } @@ -585,7 +621,11 @@ t(r#""\U000A0000""#, "\u{A0000}", false); t(r#""\\t""#, "\\t", false); t("\"\"\"\\\n\"\"\"", "", true); - t("\"\"\"\\\n \t \t \\\r\n \t \n \t \r\n\"\"\"", "", true); + t( + "\"\"\"\\\n \t \t \\\r\n \t \n \t \r\n\"\"\"", + "", + true, + ); t(r#""\r""#, "\r", false); t(r#""\n""#, "\n", false); t(r#""\b""#, "\u{8}", false); @@ -593,6 +633,7 @@ t(r#""\"a""#, "\"a", false); t("\"\"\"\na\"\"\"", "a", true); t("\"\"\"\n\"\"\"", "", true); + t(r#""""a\"""b""""#, "a\"\"\"b", true); err(r#""\a"#, Error::InvalidEscape(2, 'a')); err("\"\\\n", Error::InvalidEscape(2, '\n')); err("\"\\\r\n", Error::InvalidEscape(2, '\n')); @@ -624,9 +665,9 @@ #[test] fn all() { - fn t(input: &str, expected: &[((usize, usize), Token, &str)]) { + fn t(input: &str, expected: &[((usize, usize), Token<'_>, &str)]) { let mut tokens = Tokenizer::new(input); - let mut actual: Vec<((usize, usize), Token, &str)> = Vec::new(); + let mut actual: Vec<((usize, usize), Token<'_>, &str)> = Vec::new(); while let Some((span, token)) = tokens.next().unwrap() { actual.push((span.into(), token, &input[span.start..span.end])); } @@ -636,39 +677,45 @@ assert_eq!(actual.len(), expected.len()); } - t(" a ", &[ - ((0, 1), Token::Whitespace(" "), " "), - ((1, 2), Token::Keylike("a"), "a"), - ((2, 3), Token::Whitespace(" "), " "), - ]); - - t(" a\t [[]] \t [] {} , . =\n# foo \r\n#foo \n ", &[ - ((0, 1), Token::Whitespace(" "), " "), - ((1, 2), Token::Keylike("a"), "a"), - ((2, 4), Token::Whitespace("\t "), "\t "), - ((4, 5), Token::LeftBracket, "["), - ((5, 6), Token::LeftBracket, "["), - ((6, 7), Token::RightBracket, "]"), - ((7, 8), Token::RightBracket, "]"), - ((8, 11), Token::Whitespace(" \t "), " \t "), - ((11, 12), Token::LeftBracket, "["), - ((12, 13), Token::RightBracket, "]"), - ((13, 14), Token::Whitespace(" "), " "), - ((14, 15), Token::LeftBrace, "{"), - ((15, 16), Token::RightBrace, "}"), - ((16, 17), Token::Whitespace(" "), " "), - ((17, 18), Token::Comma, ","), - ((18, 19), Token::Whitespace(" "), " "), - ((19, 20), Token::Period, "."), - ((20, 21), Token::Whitespace(" "), " "), - ((21, 22), Token::Equals, "="), - ((22, 23), Token::Newline, "\n"), - ((23, 29), Token::Comment("# foo "), "# foo "), - ((29, 31), Token::Newline, "\r\n"), - ((31, 36), Token::Comment("#foo "), "#foo "), - ((36, 37), Token::Newline, "\n"), - ((37, 38), Token::Whitespace(" "), " "), - ]); + t( + " a ", + &[ + ((0, 1), Token::Whitespace(" "), " "), + ((1, 2), Token::Keylike("a"), "a"), + ((2, 3), Token::Whitespace(" "), " "), + ], + ); + + t( + " a\t [[]] \t [] {} , . =\n# foo \r\n#foo \n ", + &[ + ((0, 1), Token::Whitespace(" "), " "), + ((1, 2), Token::Keylike("a"), "a"), + ((2, 4), Token::Whitespace("\t "), "\t "), + ((4, 5), Token::LeftBracket, "["), + ((5, 6), Token::LeftBracket, "["), + ((6, 7), Token::RightBracket, "]"), + ((7, 8), Token::RightBracket, "]"), + ((8, 11), Token::Whitespace(" \t "), " \t "), + ((11, 12), Token::LeftBracket, "["), + ((12, 13), Token::RightBracket, "]"), + ((13, 14), Token::Whitespace(" "), " "), + ((14, 15), Token::LeftBrace, "{"), + ((15, 16), Token::RightBrace, "}"), + ((16, 17), Token::Whitespace(" "), " "), + ((17, 18), Token::Comma, ","), + ((18, 19), Token::Whitespace(" "), " "), + ((19, 20), Token::Period, "."), + ((20, 21), Token::Whitespace(" "), " "), + ((21, 22), Token::Equals, "="), + ((22, 23), Token::Newline, "\n"), + ((23, 29), Token::Comment("# foo "), "# foo "), + ((29, 31), Token::Newline, "\r\n"), + ((31, 36), Token::Comment("#foo "), "#foo "), + ((36, 37), Token::Newline, "\n"), + ((37, 38), Token::Whitespace(" "), " "), + ], + ); } #[test] diff -Nru cargo-0.35.0/vendor/toml/src/value.rs cargo-0.37.0/vendor/toml/src/value.rs --- cargo-0.35.0/vendor/toml/src/value.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/toml/src/value.rs 2019-07-17 05:42:23.000000000 +0000 @@ -1,18 +1,20 @@ //! Definition of a TOML value use std::collections::{BTreeMap, HashMap}; -use std::hash::Hash; use std::fmt; +use std::hash::Hash; use std::ops; use std::str::FromStr; use std::vec; -use serde::ser; use serde::de; use serde::de::IntoDeserializer; +use serde::ser; + +use crate::datetime::{self, DatetimeFromString}; +pub use crate::datetime::{Datetime, DatetimeParseError}; -pub use datetime::{Datetime, DatetimeParseError}; -use datetime::{self, DatetimeFromString}; +pub use crate::map::Map; /// Representation of a TOML value. #[derive(PartialEq, Clone, Debug)] @@ -36,8 +38,10 @@ /// Type representing a TOML array, payload of the `Value::Array` variant pub type Array = Vec; -/// Type representing a TOML table, payload of the `Value::Table` variant -pub type Table = BTreeMap; +/// Type representing a TOML table, payload of the `Value::Table` variant. +/// By default it is backed by a BTreeMap, enable the `preserve_order` feature +/// to use a LinkedHashMap instead. +pub type Table = Map; impl Value { /// Convert a `T` into `toml::Value` which is an enum that can represent @@ -45,8 +49,9 @@ /// /// This conversion can fail if `T`'s implementation of `Serialize` decides to /// fail, or if `T` contains a map with non-string keys. - pub fn try_from(value: T) -> Result - where T: ser::Serialize, + pub fn try_from(value: T) -> Result + where + T: ser::Serialize, { value.serialize(Serializer) } @@ -60,8 +65,9 @@ /// something is wrong with the data, for example required struct fields are /// missing from the TOML map or some number is too big to fit in the expected /// primitive type. - pub fn try_into<'de, T>(self) -> Result - where T: de::Deserialize<'de>, + pub fn try_into<'de, T>(self) -> Result + where + T: de::Deserialize<'de>, { de::Deserialize::deserialize(self) } @@ -92,7 +98,10 @@ /// Extracts the integer value if it is an integer. pub fn as_integer(&self) -> Option { - match *self { Value::Integer(i) => Some(i), _ => None } + match *self { + Value::Integer(i) => Some(i), + _ => None, + } } /// Tests whether this value is an integer. @@ -102,7 +111,10 @@ /// Extracts the float value if it is a float. pub fn as_float(&self) -> Option { - match *self { Value::Float(f) => Some(f), _ => None } + match *self { + Value::Float(f) => Some(f), + _ => None, + } } /// Tests whether this value is a float. @@ -112,7 +124,10 @@ /// Extracts the boolean value if it is a boolean. pub fn as_bool(&self) -> Option { - match *self { Value::Boolean(b) => Some(b), _ => None } + match *self { + Value::Boolean(b) => Some(b), + _ => None, + } } /// Tests whether this value is a boolean. @@ -122,7 +137,10 @@ /// Extracts the string of this value if it is a string. pub fn as_str(&self) -> Option<&str> { - match *self { Value::String(ref s) => Some(&**s), _ => None } + match *self { + Value::String(ref s) => Some(&**s), + _ => None, + } } /// Tests if this value is a string. @@ -139,7 +157,10 @@ /// 1979-05-27T07:32:00Z /// ``` pub fn as_datetime(&self) -> Option<&Datetime> { - match *self { Value::Datetime(ref s) => Some(s), _ => None } + match *self { + Value::Datetime(ref s) => Some(s), + _ => None, + } } /// Tests whether this value is a datetime. @@ -149,12 +170,18 @@ /// Extracts the array value if it is an array. pub fn as_array(&self) -> Option<&Vec> { - match *self { Value::Array(ref s) => Some(s), _ => None } + match *self { + Value::Array(ref s) => Some(s), + _ => None, + } } /// Extracts the array value if it is an array. pub fn as_array_mut(&mut self) -> Option<&mut Vec> { - match *self { Value::Array(ref mut s) => Some(s), _ => None } + match *self { + Value::Array(ref mut s) => Some(s), + _ => None, + } } /// Tests whether this value is an array. @@ -164,12 +191,18 @@ /// Extracts the table value if it is a table. pub fn as_table(&self) -> Option<&Table> { - match *self { Value::Table(ref s) => Some(s), _ => None } + match *self { + Value::Table(ref s) => Some(s), + _ => None, + } } /// Extracts the table value if it is a table. pub fn as_table_mut(&mut self) -> Option<&mut Table> { - match *self { Value::Table(ref mut s) => Some(s), _ => None } + match *self { + Value::Table(ref mut s) => Some(s), + _ => None, + } } /// Tests whether this value is a table. @@ -180,13 +213,13 @@ /// Tests whether this and another value have the same type. pub fn same_type(&self, other: &Value) -> bool { match (self, other) { - (&Value::String(..), &Value::String(..)) | - (&Value::Integer(..), &Value::Integer(..)) | - (&Value::Float(..), &Value::Float(..)) | - (&Value::Boolean(..), &Value::Boolean(..)) | - (&Value::Datetime(..), &Value::Datetime(..)) | - (&Value::Array(..), &Value::Array(..)) | - (&Value::Table(..), &Value::Table(..)) => true, + (&Value::String(..), &Value::String(..)) + | (&Value::Integer(..), &Value::Integer(..)) + | (&Value::Float(..), &Value::Float(..)) + | (&Value::Boolean(..), &Value::Boolean(..)) + | (&Value::Datetime(..), &Value::Datetime(..)) + | (&Value::Array(..), &Value::Array(..)) + | (&Value::Table(..), &Value::Table(..)) => true, _ => false, } @@ -206,7 +239,10 @@ } } -impl ops::Index for Value where I: Index { +impl ops::Index for Value +where + I: Index, +{ type Output = Value; fn index(&self, index: I) -> &Value { @@ -214,7 +250,10 @@ } } -impl ops::IndexMut for Value where I: Index { +impl ops::IndexMut for Value +where + I: Index, +{ fn index_mut(&mut self, index: I) -> &mut Value { self.get_mut(index).expect("index not found") } @@ -235,9 +274,7 @@ impl, V: Into> From> for Value { fn from(val: BTreeMap) -> Value { - let table = val.into_iter() - .map(|(s, v)| (s.into(), v.into())) - .collect(); + let table = val.into_iter().map(|(s, v)| (s.into(), v.into())).collect(); Value::Table(table) } @@ -245,9 +282,7 @@ impl + Hash + Eq, V: Into> From> for Value { fn from(val: HashMap) -> Value { - let table = val.into_iter() - .map(|(s, v)| (s.into(), v.into())) - .collect(); + let table = val.into_iter().map(|(s, v)| (s.into(), v.into())).collect(); Value::Table(table) } @@ -261,7 +296,7 @@ Value::$variant(val.into()) } } - } + }; } impl_into_value!(String: String); @@ -274,6 +309,7 @@ impl_into_value!(Float: f32); impl_into_value!(Boolean: bool); impl_into_value!(Datetime: Datetime); +impl_into_value!(Table: Table); /// Types that can be used to index a `toml::Value` /// @@ -340,7 +376,10 @@ } } -impl<'s, T: ?Sized> Index for &'s T where T: Index { +impl<'s, T: ?Sized> Index for &'s T +where + T: Index, +{ fn index<'a>(&self, val: &'a Value) -> Option<&'a Value> { (**self).index(val) } @@ -351,21 +390,24 @@ } impl fmt::Display for Value { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - ::ser::to_string(self).expect("Unable to represent value as string").fmt(f) + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + crate::ser::to_string(self) + .expect("Unable to represent value as string") + .fmt(f) } } impl FromStr for Value { - type Err = ::de::Error; + type Err = crate::de::Error; fn from_str(s: &str) -> Result { - ::from_str(s) + crate::from_str(s) } } impl ser::Serialize for Value { fn serialize(&self, serializer: S) -> Result - where S: ser::Serializer + where + S: ser::Serializer, { use serde::ser::SerializeMap; @@ -381,13 +423,20 @@ // Be sure to visit non-tables first (and also non // array-of-tables) as all keys must be emitted first. for (k, v) in t { - if !v.is_table() && !v.is_array() || - (v.as_array().map(|a| !a.iter().any(|v| v.is_table())).unwrap_or(false)) { + if !v.is_table() && !v.is_array() + || (v + .as_array() + .map(|a| !a.iter().any(|v| v.is_table())) + .unwrap_or(false)) + { map.serialize_entry(k, v)?; } } for (k, v) in t { - if v.as_array().map(|a| a.iter().any(|v| v.is_table())).unwrap_or(false) { + if v.as_array() + .map(|a| a.iter().any(|v| v.is_table())) + .unwrap_or(false) + { map.serialize_entry(k, v)?; } } @@ -404,14 +453,15 @@ impl<'de> de::Deserialize<'de> for Value { fn deserialize(deserializer: D) -> Result - where D: de::Deserializer<'de>, + where + D: de::Deserializer<'de>, { struct ValueVisitor; impl<'de> de::Visitor<'de> for ValueVisitor { type Value = Value; - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { formatter.write_str("any valid TOML value") } @@ -452,13 +502,15 @@ } fn visit_some(self, deserializer: D) -> Result - where D: de::Deserializer<'de>, + where + D: de::Deserializer<'de>, { de::Deserialize::deserialize(deserializer) } fn visit_seq(self, mut visitor: V) -> Result - where V: de::SeqAccess<'de>, + where + V: de::SeqAccess<'de>, { let mut vec = Vec::new(); while let Some(elem) = visitor.next_element()? { @@ -468,26 +520,25 @@ } fn visit_map(self, mut visitor: V) -> Result - where V: de::MapAccess<'de>, + where + V: de::MapAccess<'de>, { let mut key = String::new(); - let datetime = visitor.next_key_seed(DatetimeOrTable { - key: &mut key, - })?; + let datetime = visitor.next_key_seed(DatetimeOrTable { key: &mut key })?; match datetime { Some(true) => { let date: DatetimeFromString = visitor.next_value()?; - return Ok(Value::Datetime(date.value)) + return Ok(Value::Datetime(date.value)); } - None => return Ok(Value::Table(BTreeMap::new())), + None => return Ok(Value::Table(Map::new())), Some(false) => {} } - let mut map = BTreeMap::new(); + let mut map = Map::new(); map.insert(key, visitor.next_value()?); while let Some(key) = visitor.next_key()? { if map.contains_key(&key) { let msg = format!("duplicate key: `{}`", key); - return Err(de::Error::custom(msg)) + return Err(de::Error::custom(msg)); } map.insert(key, visitor.next_value()?); } @@ -500,10 +551,11 @@ } impl<'de> de::Deserializer<'de> for Value { - type Error = ::de::Error; + type Error = crate::de::Error; - fn deserialize_any(self, visitor: V) -> Result - where V: de::Visitor<'de>, + fn deserialize_any(self, visitor: V) -> Result + where + V: de::Visitor<'de>, { match self { Value::Boolean(v) => visitor.visit_bool(v), @@ -542,20 +594,24 @@ _name: &str, _variants: &'static [&'static str], visitor: V, - ) -> Result + ) -> Result where V: de::Visitor<'de>, { match self { Value::String(variant) => visitor.visit_enum(variant.into_deserializer()), - _ => Err(de::Error::invalid_type(de::Unexpected::UnitVariant, &"string only")), + _ => Err(de::Error::invalid_type( + de::Unexpected::UnitVariant, + &"string only", + )), } } // `None` is interpreted as a missing field so be sure to implement `Some` // as a present field. - fn deserialize_option(self, visitor: V) -> Result - where V: de::Visitor<'de>, + fn deserialize_option(self, visitor: V) -> Result + where + V: de::Visitor<'de>, { visitor.visit_some(self) } @@ -563,14 +619,15 @@ fn deserialize_newtype_struct( self, _name: &'static str, - visitor: V - ) -> Result - where V: de::Visitor<'de> + visitor: V, + ) -> Result + where + V: de::Visitor<'de>, { visitor.visit_newtype_struct(self) } - forward_to_deserialize_any! { + serde::forward_to_deserialize_any! { bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit seq bytes byte_buf map unit_struct tuple_struct struct tuple ignored_any identifier @@ -590,11 +647,11 @@ } impl<'de> de::SeqAccess<'de> for SeqDeserializer { - type Error = ::de::Error; + type Error = crate::de::Error; - fn next_element_seed(&mut self, seed: T) - -> Result, ::de::Error> - where T: de::DeserializeSeed<'de>, + fn next_element_seed(&mut self, seed: T) -> Result, crate::de::Error> + where + T: de::DeserializeSeed<'de>, { match self.iter.next() { Some(value) => seed.deserialize(value).map(Some), @@ -611,12 +668,12 @@ } struct MapDeserializer { - iter: as IntoIterator>::IntoIter, + iter: as IntoIterator>::IntoIter, value: Option<(String, Value)>, } impl MapDeserializer { - fn new(map: BTreeMap) -> Self { + fn new(map: Map) -> Self { MapDeserializer { iter: map.into_iter(), value: None, @@ -625,10 +682,11 @@ } impl<'de> de::MapAccess<'de> for MapDeserializer { - type Error = ::de::Error; + type Error = crate::de::Error; - fn next_key_seed(&mut self, seed: T) -> Result, ::de::Error> - where T: de::DeserializeSeed<'de>, + fn next_key_seed(&mut self, seed: T) -> Result, crate::de::Error> + where + T: de::DeserializeSeed<'de>, { match self.iter.next() { Some((key, value)) => { @@ -639,8 +697,9 @@ } } - fn next_value_seed(&mut self, seed: T) -> Result - where T: de::DeserializeSeed<'de>, + fn next_value_seed(&mut self, seed: T) -> Result + where + T: de::DeserializeSeed<'de>, { let (key, res) = match self.value.take() { Some((key, value)) => (key, seed.deserialize(value)), @@ -660,7 +719,7 @@ } } -impl<'de> de::IntoDeserializer<'de, ::de::Error> for Value { +impl<'de> de::IntoDeserializer<'de, crate::de::Error> for Value { type Deserializer = Self; fn into_deserializer(self) -> Self { @@ -672,7 +731,7 @@ impl ser::Serializer for Serializer { type Ok = Value; - type Error = ::ser::Error; + type Error = crate::ser::Error; type SerializeSeq = SerializeVec; type SerializeTuple = SerializeVec; @@ -680,41 +739,41 @@ type SerializeTupleVariant = SerializeVec; type SerializeMap = SerializeMap; type SerializeStruct = SerializeMap; - type SerializeStructVariant = ser::Impossible; + type SerializeStructVariant = ser::Impossible; - fn serialize_bool(self, value: bool) -> Result { + fn serialize_bool(self, value: bool) -> Result { Ok(Value::Boolean(value)) } - fn serialize_i8(self, value: i8) -> Result { + fn serialize_i8(self, value: i8) -> Result { self.serialize_i64(value.into()) } - fn serialize_i16(self, value: i16) -> Result { + fn serialize_i16(self, value: i16) -> Result { self.serialize_i64(value.into()) } - fn serialize_i32(self, value: i32) -> Result { + fn serialize_i32(self, value: i32) -> Result { self.serialize_i64(value.into()) } - fn serialize_i64(self, value: i64) -> Result { + fn serialize_i64(self, value: i64) -> Result { Ok(Value::Integer(value.into())) } - fn serialize_u8(self, value: u8) -> Result { + fn serialize_u8(self, value: u8) -> Result { self.serialize_i64(value.into()) } - fn serialize_u16(self, value: u16) -> Result { + fn serialize_u16(self, value: u16) -> Result { self.serialize_i64(value.into()) } - fn serialize_u32(self, value: u32) -> Result { + fn serialize_u32(self, value: u32) -> Result { self.serialize_i64(value.into()) } - fn serialize_u64(self, value: u64) -> Result { + fn serialize_u64(self, value: u64) -> Result { if value <= i64::max_value() as u64 { self.serialize_i64(value as i64) } else { @@ -722,125 +781,132 @@ } } - fn serialize_f32(self, value: f32) -> Result { + fn serialize_f32(self, value: f32) -> Result { self.serialize_f64(value.into()) } - fn serialize_f64(self, value: f64) -> Result { + fn serialize_f64(self, value: f64) -> Result { Ok(Value::Float(value)) } - fn serialize_char(self, value: char) -> Result { + fn serialize_char(self, value: char) -> Result { let mut s = String::new(); s.push(value); self.serialize_str(&s) } - fn serialize_str(self, value: &str) -> Result { + fn serialize_str(self, value: &str) -> Result { Ok(Value::String(value.to_owned())) } - fn serialize_bytes(self, value: &[u8]) -> Result { + fn serialize_bytes(self, value: &[u8]) -> Result { let vec = value.iter().map(|&b| Value::Integer(b.into())).collect(); Ok(Value::Array(vec)) } - fn serialize_unit(self) -> Result { - Err(::ser::Error::UnsupportedType) + fn serialize_unit(self) -> Result { + Err(crate::ser::Error::UnsupportedType) } - fn serialize_unit_struct(self, _name: &'static str) - -> Result { - Err(::ser::Error::UnsupportedType) + fn serialize_unit_struct(self, _name: &'static str) -> Result { + Err(crate::ser::Error::UnsupportedType) } - fn serialize_unit_variant(self, - _name: &'static str, - _variant_index: u32, - _variant: &'static str) - -> Result { + fn serialize_unit_variant( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + ) -> Result { self.serialize_str(_variant) } - fn serialize_newtype_struct(self, - _name: &'static str, - value: &T) - -> Result - where T: ser::Serialize, + fn serialize_newtype_struct( + self, + _name: &'static str, + value: &T, + ) -> Result + where + T: ser::Serialize, { value.serialize(self) } - fn serialize_newtype_variant(self, - _name: &'static str, - _variant_index: u32, - _variant: &'static str, - _value: &T) - -> Result - where T: ser::Serialize, + fn serialize_newtype_variant( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + _value: &T, + ) -> Result + where + T: ser::Serialize, { - Err(::ser::Error::UnsupportedType) + Err(crate::ser::Error::UnsupportedType) } - fn serialize_none(self) -> Result { - Err(::ser::Error::UnsupportedNone) + fn serialize_none(self) -> Result { + Err(crate::ser::Error::UnsupportedNone) } - fn serialize_some(self, value: &T) -> Result - where T: ser::Serialize, + fn serialize_some(self, value: &T) -> Result + where + T: ser::Serialize, { value.serialize(self) } - fn serialize_seq(self, len: Option) - -> Result - { + fn serialize_seq(self, len: Option) -> Result { Ok(SerializeVec { - vec: Vec::with_capacity(len.unwrap_or(0)) + vec: Vec::with_capacity(len.unwrap_or(0)), }) } - fn serialize_tuple(self, len: usize) -> Result { + fn serialize_tuple(self, len: usize) -> Result { self.serialize_seq(Some(len)) } - fn serialize_tuple_struct(self, _name: &'static str, len: usize) - -> Result { + fn serialize_tuple_struct( + self, + _name: &'static str, + len: usize, + ) -> Result { self.serialize_seq(Some(len)) } - fn serialize_tuple_variant(self, - _name: &'static str, - _variant_index: u32, - _variant: &'static str, - len: usize) - -> Result - { + fn serialize_tuple_variant( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + len: usize, + ) -> Result { self.serialize_seq(Some(len)) } - fn serialize_map(self, _len: Option) - -> Result - { + fn serialize_map(self, _len: Option) -> Result { Ok(SerializeMap { - map: BTreeMap::new(), + map: Map::new(), next_key: None, }) } - fn serialize_struct(self, _name: &'static str, len: usize) - -> Result { + fn serialize_struct( + self, + _name: &'static str, + len: usize, + ) -> Result { self.serialize_map(Some(len)) } - fn serialize_struct_variant(self, - _name: &'static str, - _variant_index: u32, - _variant: &'static str, - _len: usize) - -> Result - { - Err(::ser::Error::UnsupportedType) + fn serialize_struct_variant( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + _len: usize, + ) -> Result { + Err(crate::ser::Error::UnsupportedType) } } @@ -849,115 +915,128 @@ } struct SerializeMap { - map: BTreeMap, + map: Map, next_key: Option, } impl ser::SerializeSeq for SerializeVec { type Ok = Value; - type Error = ::ser::Error; + type Error = crate::ser::Error; - fn serialize_element(&mut self, value: &T) -> Result<(), ::ser::Error> - where T: ser::Serialize + fn serialize_element(&mut self, value: &T) -> Result<(), crate::ser::Error> + where + T: ser::Serialize, { self.vec.push(Value::try_from(value)?); Ok(()) } - fn end(self) -> Result { + fn end(self) -> Result { Ok(Value::Array(self.vec)) } } impl ser::SerializeTuple for SerializeVec { type Ok = Value; - type Error = ::ser::Error; + type Error = crate::ser::Error; - fn serialize_element(&mut self, value: &T) -> Result<(), ::ser::Error> - where T: ser::Serialize + fn serialize_element(&mut self, value: &T) -> Result<(), crate::ser::Error> + where + T: ser::Serialize, { ser::SerializeSeq::serialize_element(self, value) } - fn end(self) -> Result { + fn end(self) -> Result { ser::SerializeSeq::end(self) } } impl ser::SerializeTupleStruct for SerializeVec { type Ok = Value; - type Error = ::ser::Error; + type Error = crate::ser::Error; - fn serialize_field(&mut self, value: &T) -> Result<(), ::ser::Error> - where T: ser::Serialize + fn serialize_field(&mut self, value: &T) -> Result<(), crate::ser::Error> + where + T: ser::Serialize, { ser::SerializeSeq::serialize_element(self, value) } - fn end(self) -> Result { + fn end(self) -> Result { ser::SerializeSeq::end(self) } } impl ser::SerializeTupleVariant for SerializeVec { type Ok = Value; - type Error = ::ser::Error; + type Error = crate::ser::Error; - fn serialize_field(&mut self, value: &T) -> Result<(), ::ser::Error> - where T: ser::Serialize + fn serialize_field(&mut self, value: &T) -> Result<(), crate::ser::Error> + where + T: ser::Serialize, { ser::SerializeSeq::serialize_element(self, value) } - fn end(self) -> Result { + fn end(self) -> Result { ser::SerializeSeq::end(self) } } impl ser::SerializeMap for SerializeMap { type Ok = Value; - type Error = ::ser::Error; + type Error = crate::ser::Error; - fn serialize_key(&mut self, key: &T) -> Result<(), ::ser::Error> - where T: ser::Serialize + fn serialize_key(&mut self, key: &T) -> Result<(), crate::ser::Error> + where + T: ser::Serialize, { match Value::try_from(key)? { Value::String(s) => self.next_key = Some(s), - _ => return Err(::ser::Error::KeyNotString), + _ => return Err(crate::ser::Error::KeyNotString), }; Ok(()) } - fn serialize_value(&mut self, value: &T) -> Result<(), ::ser::Error> - where T: ser::Serialize + fn serialize_value(&mut self, value: &T) -> Result<(), crate::ser::Error> + where + T: ser::Serialize, { let key = self.next_key.take(); let key = key.expect("serialize_value called before serialize_key"); match Value::try_from(value) { - Ok(value) => { self.map.insert(key, value); } - Err(::ser::Error::UnsupportedNone) => {} + Ok(value) => { + self.map.insert(key, value); + } + Err(crate::ser::Error::UnsupportedNone) => {} Err(e) => return Err(e), } Ok(()) } - fn end(self) -> Result { + fn end(self) -> Result { Ok(Value::Table(self.map)) } } impl ser::SerializeStruct for SerializeMap { type Ok = Value; - type Error = ::ser::Error; + type Error = crate::ser::Error; - fn serialize_field(&mut self, key: &'static str, value: &T) -> Result<(), ::ser::Error> - where T: ser::Serialize + fn serialize_field( + &mut self, + key: &'static str, + value: &T, + ) -> Result<(), crate::ser::Error> + where + T: ser::Serialize, { ser::SerializeMap::serialize_key(self, key)?; ser::SerializeMap::serialize_value(self, value) } - fn end(self) -> Result { + fn end(self) -> Result { ser::SerializeMap::end(self) } } @@ -970,7 +1049,8 @@ type Value = bool; fn deserialize(self, deserializer: D) -> Result - where D: de::Deserializer<'de> + where + D: de::Deserializer<'de>, { deserializer.deserialize_any(self) } @@ -979,12 +1059,13 @@ impl<'a, 'de> de::Visitor<'de> for DatetimeOrTable<'a> { type Value = bool; - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { formatter.write_str("a string key") } fn visit_str(self, s: &str) -> Result - where E: de::Error, + where + E: de::Error, { if s == datetime::FIELD { Ok(true) @@ -995,7 +1076,8 @@ } fn visit_string(self, s: String) -> Result - where E: de::Error, + where + E: de::Error, { if s == datetime::FIELD { Ok(true) diff -Nru cargo-0.35.0/vendor/typenum/build/main.rs cargo-0.37.0/vendor/typenum/build/main.rs --- cargo-0.35.0/vendor/typenum/build/main.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/typenum/build/main.rs 2019-07-17 05:42:23.000000000 +0000 @@ -77,7 +77,7 @@ fn main() { let highest: u64 = 1024; - let first2: u32 = (highest as f64).log(2.0) as u32 + 1; + let first2: u32 = (highest as f64).log(2.0).round() as u32 + 1; let first10: u32 = (highest as f64).log(10.0) as u32 + 1; let uints = (0..(highest + 1)) .chain((first2..64).map(|i| 2u64.pow(i))) diff -Nru cargo-0.35.0/vendor/typenum/debian/patches/pr115.patch cargo-0.37.0/vendor/typenum/debian/patches/pr115.patch --- cargo-0.35.0/vendor/typenum/debian/patches/pr115.patch 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/typenum/debian/patches/pr115.patch 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,23 @@ +From 0d5196feadafa77c727f517d747ffcf3fd0e8ba9 Mon Sep 17 00:00:00 2001 +From: Michael Hudson-Doyle +Date: Wed, 13 Mar 2019 15:55:30 +1300 +Subject: [PATCH] round result of (highest as f64).log(2.0) + +Even though (1024f64).log(2.0) has an exact, representable, value, with rustc 1.32 on i386 it comes out as +9.999999999999999985 with optimization enabled. And the rustc doesn't like having two defintions for U1024 etc. +--- + build/main.rs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/build/main.rs b/build/main.rs +index 16b0ffe2f..b7939f993 100644 +--- a/build/main.rs ++++ b/build/main.rs +@@ -81,7 +81,7 @@ pub fn no_std() {} + fn main() { + let highest: u64 = 1024; + +- let first2: u32 = (highest as f64).log(2.0) as u32 + 1; ++ let first2: u32 = (highest as f64).log(2.0).round() as u32 + 1; + let first10: u32 = (highest as f64).log(10.0) as u32 + 1; + let uints = (0..(highest + 1)) + .chain((first2..64).map(|i| 2u64.pow(i))) diff -Nru cargo-0.35.0/vendor/typenum/debian/patches/series cargo-0.37.0/vendor/typenum/debian/patches/series --- cargo-0.35.0/vendor/typenum/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/typenum/debian/patches/series 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +pr115.patch diff -Nru cargo-0.35.0/vendor/typenum/.pc/applied-patches cargo-0.37.0/vendor/typenum/.pc/applied-patches --- cargo-0.35.0/vendor/typenum/.pc/applied-patches 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/typenum/.pc/applied-patches 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +pr115.patch diff -Nru cargo-0.35.0/vendor/typenum/.pc/pr115.patch/build/main.rs cargo-0.37.0/vendor/typenum/.pc/pr115.patch/build/main.rs --- cargo-0.35.0/vendor/typenum/.pc/pr115.patch/build/main.rs 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/typenum/.pc/pr115.patch/build/main.rs 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1,179 @@ +use std::env; +use std::fs::File; +use std::io::Write; +use std::path::Path; +use std::fmt; + +#[cfg(tests)] +mod tests; +mod op; + +pub enum UIntCode { + Term, + Zero(Box), + One(Box), +} + +pub enum IntCode { + Zero, + Pos(Box), + Neg(Box), +} + +impl fmt::Display for UIntCode { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + UIntCode::Term => write!(f, "UTerm"), + UIntCode::Zero(ref inner) => write!(f, "UInt<{}, B0>", inner), + UIntCode::One(ref inner) => write!(f, "UInt<{}, B1>", inner), + } + } +} + +impl fmt::Display for IntCode { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + IntCode::Zero => write!(f, "Z0"), + IntCode::Pos(ref inner) => write!(f, "PInt<{}>", inner), + IntCode::Neg(ref inner) => write!(f, "NInt<{}>", inner), + } + } +} + +pub fn gen_uint(u: u64) -> UIntCode { + let mut result = UIntCode::Term; + let mut x = 1u64 << 63; + while x > u { + x >>= 1 + } + while x > 0 { + result = if x & u > 0 { + UIntCode::One(Box::new(result)) + } else { + UIntCode::Zero(Box::new(result)) + }; + x >>= 1; + } + result +} + +pub fn gen_int(i: i64) -> IntCode { + if i > 0 { + IntCode::Pos(Box::new(gen_uint(i as u64))) + } else if i < 0 { + IntCode::Neg(Box::new(gen_uint(i.abs() as u64))) + } else { + IntCode::Zero + } +} + +#[cfg_attr(feature="no_std", deprecated( + since="1.3.0", + note="the `no_std` flag is no longer necessary and will be removed in the future"))] +pub fn no_std() {} + +// fixme: get a warning when testing without this +#[allow(dead_code)] +fn main() { + let highest: u64 = 1024; + + let first2: u32 = (highest as f64).log(2.0) as u32 + 1; + let first10: u32 = (highest as f64).log(10.0) as u32 + 1; + let uints = (0..(highest + 1)) + .chain((first2..64).map(|i| 2u64.pow(i))) + .chain((first10..20).map(|i| 10u64.pow(i))); + + let out_dir = env::var("OUT_DIR").unwrap(); + let dest = Path::new(&out_dir).join("consts.rs"); + + let mut f = File::create(&dest).unwrap(); + + no_std(); + + // Header stuff here! + write!( + f, + " +/** +Type aliases for many constants. + +This file is generated by typenum's build script. + +For unsigned integers, the format is `U` followed by the number. We define aliases for + +- Numbers 0 through {highest} +- Powers of 2 below `u64::MAX` +- Powers of 10 below `u64::MAX` + +These alias definitions look like this: + +```rust +use typenum::{{B0, B1, UInt, UTerm}}; + +# #[allow(dead_code)] +type U6 = UInt, B1>, B0>; +``` + +For positive signed integers, the format is `P` followed by the number and for negative +signed integers it is `N` followed by the number. For the signed integer zero, we use +`Z0`. We define aliases for + +- Numbers -{highest} through {highest} +- Powers of 2 between `i64::MIN` and `i64::MAX` +- Powers of 10 between `i64::MIN` and `i64::MAX` + +These alias definitions look like this: + +```rust +use typenum::{{B0, B1, UInt, UTerm, PInt, NInt}}; + +# #[allow(dead_code)] +type P6 = PInt, B1>, B0>>; +# #[allow(dead_code)] +type N6 = NInt, B1>, B0>>; +``` + +# Example +```rust +# #[allow(unused_imports)] +use typenum::{{U0, U1, U2, U3, U4, U5, U6}}; +# #[allow(unused_imports)] +use typenum::{{N3, N2, N1, Z0, P1, P2, P3}}; +# #[allow(unused_imports)] +use typenum::{{U774, N17, N10000, P1024, P4096}}; +``` + +We also define the aliases `False` and `True` for `B0` and `B1`, respectively. +*/ +#[allow(missing_docs)] +pub mod consts {{ + use uint::{{UInt, UTerm}}; + use int::{{PInt, NInt}}; + + pub use bit::{{B0, B1}}; + pub use int::Z0; + + pub type True = B1; + pub type False = B0; +", + highest = highest + ).unwrap(); + + for u in uints { + write!(f, " pub type U{} = {};\n", u, gen_uint(u)).unwrap(); + if u <= ::std::i64::MAX as u64 && u != 0 { + let i = u as i64; + write!( + f, + " pub type P{i} = PInt; pub type N{i} = NInt;\n", + i = i + ).unwrap(); + } + } + write!(f, "}}").unwrap(); + + #[cfg(tests)] + tests::build_tests().unwrap(); + + op::write_op_macro().unwrap(); +} diff -Nru cargo-0.35.0/vendor/typenum/.pc/.quilt_patches cargo-0.37.0/vendor/typenum/.pc/.quilt_patches --- cargo-0.35.0/vendor/typenum/.pc/.quilt_patches 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/typenum/.pc/.quilt_patches 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +debian/patches diff -Nru cargo-0.35.0/vendor/typenum/.pc/.quilt_series cargo-0.37.0/vendor/typenum/.pc/.quilt_series --- cargo-0.35.0/vendor/typenum/.pc/.quilt_series 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/typenum/.pc/.quilt_series 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +series diff -Nru cargo-0.35.0/vendor/typenum/.pc/.version cargo-0.37.0/vendor/typenum/.pc/.version --- cargo-0.35.0/vendor/typenum/.pc/.version 1970-01-01 00:00:00.000000000 +0000 +++ cargo-0.37.0/vendor/typenum/.pc/.version 2019-07-17 05:42:23.000000000 +0000 @@ -0,0 +1 @@ +2 diff -Nru cargo-0.35.0/vendor/utf8-ranges/.cargo-checksum.json cargo-0.37.0/vendor/utf8-ranges/.cargo-checksum.json --- cargo-0.35.0/vendor/utf8-ranges/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/utf8-ranges/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737"} \ No newline at end of file +{"files":{},"package":"9d50aa7650df78abf942826607c62468ce18d9019673d4a2ebe1865dbb96ffde"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/utf8-ranges/Cargo.toml cargo-0.37.0/vendor/utf8-ranges/Cargo.toml --- cargo-0.35.0/vendor/utf8-ranges/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/utf8-ranges/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,7 +12,7 @@ [package] name = "utf8-ranges" -version = "1.0.2" +version = "1.0.3" authors = ["Andrew Gallant "] exclude = ["/ci/*", "/.travis.yml", "/Makefile", "/ctags.rust", "/session.vim"] description = "Convert ranges of Unicode codepoints to UTF-8 byte ranges." @@ -22,8 +22,11 @@ keywords = ["codepoint", "utf8", "automaton", "range"] license = "Unlicense/MIT" repository = "https://github.com/BurntSushi/utf8-ranges" +[dev-dependencies.doc-comment] +version = "0.3" + [dev-dependencies.quickcheck] -version = "0.7" +version = "0.8" default-features = false [badges.travis-ci] repository = "BurntSushi/utf8-ranges" diff -Nru cargo-0.35.0/vendor/utf8-ranges/README.md cargo-0.37.0/vendor/utf8-ranges/README.md --- cargo-0.35.0/vendor/utf8-ranges/README.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/utf8-ranges/README.md 2019-07-17 05:42:23.000000000 +0000 @@ -36,7 +36,7 @@ The output: -``` +```text [0-7F] [C2-DF][80-BF] [E0][A0-BF][80-BF] diff -Nru cargo-0.35.0/vendor/utf8-ranges/src/lib.rs cargo-0.37.0/vendor/utf8-ranges/src/lib.rs --- cargo-0.35.0/vendor/utf8-ranges/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/utf8-ranges/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -89,7 +89,14 @@ #![deny(missing_docs)] -#[cfg(test)] extern crate quickcheck; +#[cfg(test)] +extern crate quickcheck; +#[cfg(test)] +#[macro_use] +extern crate doc_comment; + +#[cfg(test)] +doctest!("../README.md"); use std::char; use std::fmt; diff -Nru cargo-0.35.0/vendor/vcpkg/.cargo-checksum.json cargo-0.37.0/vendor/vcpkg/.cargo-checksum.json --- cargo-0.35.0/vendor/vcpkg/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/vcpkg/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d"} \ No newline at end of file +{"files":{},"package":"33dd455d0f96e90a75803cfeb7f948768c08d70a6de9a8d2362461935698bf95"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/vcpkg/Cargo.toml cargo-0.37.0/vendor/vcpkg/Cargo.toml --- cargo-0.35.0/vendor/vcpkg/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/vcpkg/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,7 +12,7 @@ [package] name = "vcpkg" -version = "0.2.6" +version = "0.2.7" authors = ["Jim McGrath "] description = "A library to find native dependencies in a vcpkg tree at build\ntime in order to be used in Cargo build scripts.\n" documentation = "https://docs.rs/vcpkg" diff -Nru cargo-0.35.0/vendor/vcpkg/src/lib.rs cargo-0.37.0/vendor/vcpkg/src/lib.rs --- cargo-0.35.0/vendor/vcpkg/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/vcpkg/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -59,11 +59,15 @@ //! cargo:rustc-link-lib=static=mysqlclient //! ``` +// The CI will test vcpkg-rs on 1.10 because at this point rust-openssl's +// openssl-sys is backward compatible that far. (Actually, the oldest release +// crate openssl version 0.10 seems to build against is now Rust 1.24.1?) +#![allow(deprecated)] + #[cfg(test)] #[macro_use] extern crate lazy_static; -#[allow(deprecated)] #[allow(unused_imports)] use std::ascii::AsciiExt; @@ -84,7 +88,7 @@ /// should cargo:include= metadata be emitted (defaults to false) emit_includes: bool, - /// .libs that must be be found for probing to be considered successful + /// .lib/.a files that must be be found for probing to be considered successful required_libs: Vec, /// .dlls that must be be found for probing to be considered successful @@ -112,23 +116,30 @@ /// libraries found are static pub is_static: bool, - // DLLs found + /// DLLs found pub found_dlls: Vec, - // static libs or import libs found + /// static libs or import libs found pub found_libs: Vec, + + /// ports that are providing the libraries to link to, in port link order + pub ports: Vec, } enum MSVCTarget { - X86, - X64, + X86Windows, + X64Windows, + X64Linux, + X64MacOS, } impl fmt::Display for MSVCTarget { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { - MSVCTarget::X86 => write!(f, "x86-windows"), - MSVCTarget::X64 => write!(f, "x64-windows"), + MSVCTarget::X86Windows => write!(f, "x86-windows"), + MSVCTarget::X64Windows => write!(f, "x64-windows"), + MSVCTarget::X64Linux => write!(f, "x64-linux"), + MSVCTarget::X64MacOS => write!(f, "x64-osx"), } } } @@ -143,7 +154,7 @@ /// Aborted because a required environment variable was not set. RequiredEnvMissing(String), - /// Only MSVC ABI is supported + /// On Windows, only MSVC ABI is supported NotMSVC, /// Can't find a vcpkg tree @@ -229,7 +240,7 @@ // see if there is a per-user vcpkg tree that has been integrated into msbuild // using `vcpkg integrate install` let local_app_data = try!(env::var("LOCALAPPDATA").map_err(|_| Error::VcpkgNotFound( - "Failed to read LOCALAPPDATA environment variable".to_string() + "Failed to read either VCPKG_ROOT or LOCALAPPDATA environment variables".to_string() ))); // not present or can't utf8 let vcpkg_user_targets_path = Path::new(local_app_data.as_str()) .join("vcpkg") @@ -290,16 +301,21 @@ let vcpkg_root = try!(find_vcpkg_root()); try!(validate_vcpkg_root(&vcpkg_root)); - let static_lib = env::var("CARGO_CFG_TARGET_FEATURE") - .unwrap_or(String::new()) // rustc 1.10 - .contains("crt-static"); + let (static_lib, static_appendage, lib_suffix, strip_lib_prefix) = match msvc_target { + &MSVCTarget::X64Windows | &MSVCTarget::X86Windows => { + let static_lib = env::var("CARGO_CFG_TARGET_FEATURE") + .unwrap_or(String::new()) // rustc 1.10 + .contains("crt-static"); + let static_appendage = if static_lib { "-static" } else { "" }; + (static_lib, static_appendage, "lib", false) + } + _ => (true, "", "a", true), + }; let mut base = vcpkg_root; base.push("installed"); let status_path = base.join("vcpkg"); - let static_appendage = if static_lib { "-static" } else { "" }; - let vcpkg_triple = format!("{}{}", msvc_target.to_string(), static_appendage); base.push(&vcpkg_triple); @@ -314,6 +330,8 @@ include_path: include_path, is_static: static_lib, status_path: status_path, + lib_suffix: lib_suffix.to_owned(), + strip_lib_prefix: strip_lib_prefix, }) } @@ -333,11 +351,12 @@ path: &PathBuf, port: &str, version: &str, - vcpkg_triple: &str, + vcpkg_target: &VcpkgTarget, ) -> Result<(Vec, Vec), Error> { - let manifest_file = path - .join("info") - .join(format!("{}_{}_{}.list", port, version, vcpkg_triple)); + let manifest_file = path.join("info").join(format!( + "{}_{}_{}.list", + port, version, vcpkg_target.vcpkg_triple + )); let mut dlls = Vec::new(); let mut libs = Vec::new(); @@ -351,8 +370,8 @@ let file = BufReader::new(&f); - let dll_prefix = Path::new(vcpkg_triple).join("bin"); - let lib_prefix = Path::new(vcpkg_triple).join("lib"); + let dll_prefix = Path::new(&vcpkg_target.vcpkg_triple).join("bin"); + let lib_prefix = Path::new(&vcpkg_target.vcpkg_triple).join("lib"); for line in file.lines() { let line = line.unwrap(); @@ -368,10 +387,12 @@ dll.to_str().map(|s| dlls.push(s.to_owned())); } } else if let Ok(lib) = file_path.strip_prefix(&lib_prefix) { - if lib.extension() == Some(OsStr::new("lib")) + if lib.extension() == Some(OsStr::new(&vcpkg_target.lib_suffix)) && lib.components().collect::>().len() == 1 { - lib.to_str().map(|s| libs.push(s.to_owned())); + if let Some(lib) = vcpkg_target.link_name_for_lib(lib) { + libs.push(lib); + } } } } @@ -423,7 +444,7 @@ } fn load_ports(target: &VcpkgTarget) -> Result, Error> { - let mut ports = BTreeMap::new(); + let mut ports: BTreeMap = BTreeMap::new(); let mut port_info: Vec> = Vec::new(); @@ -446,17 +467,15 @@ ); // get all of the paths of the update files into a Vec - let mut paths = try!( - paths - .map(|rde| rde.map(|de| de.path())) // Result -> Result - .collect::, _>>() // collect into Result, io::Error> - .map_err(|e| { - Error::VcpkgInstallation(format!( - "could not read status file update filenames: {}", - e - )) - }) - ); + let mut paths = try!(paths + .map(|rde| rde.map(|de| de.path())) // Result -> Result + .collect::, _>>() // collect into Result, io::Error> + .map_err(|e| { + Error::VcpkgInstallation(format!( + "could not read status file update filenames: {}", + e + )) + })); // Sort the paths and read them. This could be done directly from the iterator if // read_dir() guarantees that the files will be read in alpha order but that appears @@ -464,65 +483,70 @@ // https://doc.rust-lang.org/nightly/std/fs/fn.read_dir.html#platform-specific-behavior paths.sort(); for path in paths { - // println!("Name: {}", path.display()); + // println!("Name: {}", path.display()); try!(load_port_file(&path, &mut port_info)); } + //println!("{:#?}", port_info); + let mut seen_names = BTreeMap::new(); for current in &port_info { - if let Some(name) = current.get("Package") { - if let Some(arch) = current.get("Architecture") { - if *arch == target.vcpkg_triple { - // println!("-++++++-"); - // println!("{:?}", current); - // println!("--------"); - - let mut deps = if let Some(deps) = current.get("Depends") { - deps.split(", ").map(|x| x.to_owned()).collect() - } else { - Vec::new() - }; - - if current - .get("Status") - .unwrap_or(&String::new()) - .ends_with(" installed") - { - match (current.get("Version"), current.get("Feature")) { - (Some(version), _) => { - let lib_info = try!(load_port_manifest( - &target.status_path, - name, - version, - &target.vcpkg_triple - )); - let port = Port { - dlls: lib_info.0, - libs: lib_info.1, - deps: deps, - }; - - ports.insert(name.clone(), port); - } - (_, Some(_feature)) => match ports.get_mut(name) { - Some(ref mut port) => { - port.deps.append(&mut deps); - } - _ => { - println!("found a feature that had no corresponding port :-"); - println!("current {:+?}", current); - continue; - } - }, - (_, _) => { - println!("didn't know how to deal with status file entry :-"); - println!("{:+?}", current); - continue; - } + // store them by name and arch, clobbering older details + match ( + current.get("Package"), + current.get("Architecture"), + current.get("Feature"), + ) { + (Some(pkg), Some(arch), feature) => { + seen_names.insert((pkg, arch, feature), current); + } + _ => {} + } + } + + for (&(name, arch, feature), current) in &seen_names { + if **arch == target.vcpkg_triple { + let mut deps = if let Some(deps) = current.get("Depends") { + deps.split(", ").map(|x| x.to_owned()).collect() + } else { + Vec::new() + }; + + if current + .get("Status") + .unwrap_or(&String::new()) + .ends_with(" installed") + { + match (current.get("Version"), feature) { + (Some(version), _) => { + // this failing here and bailing out causes everything to fail + let lib_info = try!(load_port_manifest( + &target.status_path, + &name, + version, + &target + )); + let port = Port { + dlls: lib_info.0, + libs: lib_info.1, + deps: deps, + }; + + ports.insert(name.to_string(), port); + } + (_, Some(_feature)) => match ports.get_mut(name) { + Some(ref mut port) => { + port.deps.append(&mut deps); + } + _ => { + println!("found a feature that had no corresponding port :-"); + println!("current {:+?}", current); + continue; } - } else { - // remove it? - //ports.remove(name); - //println!("would delete {} for arch {}", name, arch); + }, + (_, _) => { + println!("didn't know how to deal with status file entry :-"); + println!("{:+?}", current); + continue; } } } @@ -543,6 +567,23 @@ status_path: PathBuf, is_static: bool, + lib_suffix: String, + + /// strip 'lib' from library names in linker args? + strip_lib_prefix: bool, +} + +impl VcpkgTarget { + fn link_name_for_lib(&self, filename: &std::path::Path) -> Option { + if self.strip_lib_prefix { + filename.to_str().map(|s| s.to_owned()) + // filename + // .to_str() + // .map(|s| s.trim_left_matches("lib").to_owned()) + } else { + filename.to_str().map(|s| s.to_owned()) + } + } } impl Config { @@ -699,12 +740,18 @@ for required_lib in &self.required_libs { // this could use static-nobundle= for static libraries but it is apparently // not necessary to make the distinction for windows-msvc. + + let link_name = match vcpkg_target.strip_lib_prefix { + true => required_lib.trim_left_matches("lib"), + false => required_lib, + }; + lib.cargo_metadata - .push(format!("cargo:rustc-link-lib={}", required_lib)); + .push(format!("cargo:rustc-link-lib={}", link_name)); // verify that the library exists let mut lib_location = vcpkg_target.lib_path.clone(); - lib_location.push(required_lib.clone() + ".lib"); + lib_location.push(required_lib.clone() + "." + &vcpkg_target.lib_suffix); if !lib_location.exists() { return Err(Error::LibNotFound(lib_location.display().to_string())); @@ -800,6 +847,8 @@ let vcpkg_target = try!(find_vcpkg_target(&msvc_target)); + let mut required_port_order = Vec::new(); + // if no overrides have been selected, then the Vcpkg port name // is the the .lib name and the .dll name if self.required_libs.is_empty() { @@ -811,7 +860,6 @@ // the complete set of ports required let mut required_ports: BTreeMap = BTreeMap::new(); - // working of ports that we need to include // let mut ports_to_scan: BTreeSet = BTreeSet::new(); // ports_to_scan.insert(port_name.to_owned()); @@ -828,7 +876,9 @@ for dep in &port.deps { ports_to_scan.push(dep.clone()); } - required_ports.insert(port_name, (*port).clone()); + required_ports.insert(port_name.clone(), (*port).clone()); + remove_item(&mut required_port_order, &port_name); + required_port_order.push(port_name); } else { // what? } @@ -837,15 +887,20 @@ // for port in ports { // println!("port {:?}", port); // } + // println!("== Looking for port {}", port_name); + // for port in &required_port_order { + // println!("ordered required port {:?}", port); + // } // println!("============================="); - //for port in &required_ports { - // println!("required port {:?}", port); - //} + // for port in &required_ports { + // println!("required port {:?}", port); + // } // if no overrides have been selected, then the Vcpkg port name // is the the .lib name and the .dll name if self.required_libs.is_empty() { - for (_, port) in &required_ports { + for port_name in &required_port_order { + let port = required_ports.get(port_name).unwrap(); self.required_libs.extend(port.libs.iter().map(|s| { Path::new(&s) .file_stem() @@ -901,6 +956,8 @@ lib.dll_paths.push(vcpkg_target.bin_path.clone()); } + lib.ports = required_port_order; + try!(self.emit_libs(&mut lib, &vcpkg_target)); if self.copy_dlls { @@ -916,6 +973,13 @@ } } +fn remove_item(cont: &mut Vec, item: &String) -> Option { + match cont.iter().position(|x| *x == *item) { + Some(pos) => Some(cont.remove(pos)), + None => None, + } +} + impl Library { fn new(is_static: bool) -> Library { Library { @@ -926,6 +990,7 @@ is_static: is_static, found_dlls: Vec::new(), found_libs: Vec::new(), + ports: Vec::new(), } } } @@ -939,13 +1004,17 @@ fn msvc_target() -> Result { let target = env::var("TARGET").unwrap_or(String::new()); - if !target.contains("-pc-windows-msvc") { + if target == "x86_64-apple-darwin" { + Ok(MSVCTarget::X64MacOS) + } else if target == "x86_64-unknown-linux-gnu" { + Ok(MSVCTarget::X64Linux) + } else if !target.contains("-pc-windows-msvc") { Err(Error::NotMSVC) } else if target.starts_with("x86_64-") { - Ok(MSVCTarget::X64) + Ok(MSVCTarget::X64Windows) } else { // everything else is x86 - Ok(MSVCTarget::X86) + Ok(MSVCTarget::X86Windows) } } @@ -963,10 +1032,10 @@ } #[test] - fn do_nothing_for_non_msvc_target() { + fn do_nothing_for_unsupported_target() { let _g = LOCK.lock(); env::set_var("VCPKG_ROOT", "/"); - env::set_var("TARGET", "x86_64-unknown-linux-gnu"); + env::set_var("TARGET", "x86_64-pc-windows-gnu"); assert!(match ::probe_package("foo") { Err(Error::NotMSVC) => true, _ => false, @@ -1100,6 +1169,75 @@ clean_env(); } + #[test] + fn link_lib_name_is_correct() { + let _g = LOCK.lock(); + + for target in &[ + "x86_64-apple-darwin", + "i686-pc-windows-msvc", + // "x86_64-pc-windows-msvc", + // "x86_64-unknown-linux-gnu", + ] { + clean_env(); + env::set_var("VCPKG_ROOT", vcpkg_test_tree_loc("normalized")); + env::set_var("TARGET", target); + env::set_var("VCPKGRS_DYNAMIC", "1"); + let tmp_dir = tempdir::TempDir::new("vcpkg_tests").unwrap(); + env::set_var("OUT_DIR", tmp_dir.path()); + + println!("Result is {:?}", ::find_package("harfbuzz")); + assert!(match ::find_package("harfbuzz") { + Ok(lib) => lib + .cargo_metadata + .iter() + .find(|&x| x == "cargo:rustc-link-lib=harfbuzz") + .is_some(), + _ => false, + }); + clean_env(); + } + } + + #[test] + fn link_dependencies_after_port() { + let _g = LOCK.lock(); + clean_env(); + env::set_var("VCPKG_ROOT", vcpkg_test_tree_loc("normalized")); + env::set_var("TARGET", "i686-pc-windows-msvc"); + env::set_var("VCPKGRS_DYNAMIC", "1"); + let tmp_dir = tempdir::TempDir::new("vcpkg_tests").unwrap(); + env::set_var("OUT_DIR", tmp_dir.path()); + + let lib = ::find_package("harfbuzz").unwrap(); + + check_before(&lib, "freetype", "zlib"); + check_before(&lib, "freetype", "bzip2"); + check_before(&lib, "freetype", "libpng"); + check_before(&lib, "harfbuzz", "freetype"); + check_before(&lib, "harfbuzz", "ragel"); + check_before(&lib, "libpng", "zlib"); + + clean_env(); + + fn check_before(lib: &Library, earlier: &str, later: &str) { + match ( + lib.ports.iter().position(|x| *x == *earlier), + lib.ports.iter().position(|x| *x == *later), + ) { + (Some(earlier_pos), Some(later_pos)) if earlier_pos < later_pos => { + // ok + } + _ => { + println!( + "earlier: {}, later: {}\nLibrary found: {:#?}", + earlier, later, lib + ); + panic!(); + } + } + } + } // #[test] // fn dynamic_build_package_specific_bailout() { // clean_env(); diff -Nru cargo-0.35.0/vendor/walkdir/.cargo-checksum.json cargo-0.37.0/vendor/walkdir/.cargo-checksum.json --- cargo-0.35.0/vendor/walkdir/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/walkdir/.cargo-checksum.json 2019-07-17 05:42:23.000000000 +0000 @@ -1 +1 @@ -{"files":{},"package":"9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1"} \ No newline at end of file +{"files":{},"package":"c7904a7e2bb3cdf0cf5e783f44204a85a37a93151738fa349f06680f59a98b45"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/walkdir/Cargo.toml cargo-0.37.0/vendor/walkdir/Cargo.toml --- cargo-0.35.0/vendor/walkdir/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/walkdir/Cargo.toml 2019-07-17 05:42:23.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# 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 @@ -12,9 +12,9 @@ [package] name = "walkdir" -version = "2.2.7" +version = "2.2.8" authors = ["Andrew Gallant "] -exclude = ["/ci/*", "/.travis.yml", "/Makefile", "/appveyor.yml", "/ctags.rust", "/session.vim"] +exclude = ["/ci/*", "/.travis.yml", "/appveyor.yml"] description = "Recursively walk a directory." homepage = "https://github.com/BurntSushi/walkdir" documentation = "https://docs.rs/walkdir/" @@ -25,15 +25,18 @@ repository = "https://github.com/BurntSushi/walkdir" [dependencies.same-file] version = "1.0.1" +[dev-dependencies.doc-comment] +version = "0.3" + [dev-dependencies.docopt] version = "1.0.1" [dev-dependencies.quickcheck] -version = "0.7" +version = "0.8" default-features = false [dev-dependencies.rand] -version = "0.5" +version = "0.6" [dev-dependencies.serde] version = "1" diff -Nru cargo-0.35.0/vendor/walkdir/src/lib.rs cargo-0.37.0/vendor/walkdir/src/lib.rs --- cargo-0.35.0/vendor/walkdir/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/walkdir/src/lib.rs 2019-07-17 05:42:23.000000000 +0000 @@ -104,6 +104,7 @@ */ #![deny(missing_docs)] +#![allow(bare_trait_objects)] #[cfg(test)] extern crate quickcheck; @@ -114,6 +115,12 @@ extern crate winapi; #[cfg(windows)] extern crate winapi_util; +#[cfg(test)] +#[macro_use] +extern crate doc_comment; + +#[cfg(test)] +doctest!("../README.md"); use std::cmp::{Ordering, min}; use std::error; @@ -683,7 +690,7 @@ .map_err(|e| Error::from_path(0, start.clone(), e)); self.root_device = Some(itry!(result)); } - let mut dent = itry!(DirEntry::from_path(0, start, false)); + let dent = itry!(DirEntry::from_path(0, start, false)); if let Some(result) = self.handle_entry(dent) { return Some(result); } diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/.cargo-checksum.json cargo-0.37.0/vendor/winapi-0.2.8/.cargo-checksum.json --- cargo-0.35.0/vendor/winapi-0.2.8/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/.cargo-checksum.json 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"files":{},"package":"167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/Cargo.toml cargo-0.37.0/vendor/winapi-0.2.8/Cargo.toml --- cargo-0.35.0/vendor/winapi-0.2.8/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -[package] -name = "winapi" -version = "0.2.8" -authors = ["Peter Atashian "] -description = "Types and constants for WinAPI bindings. See README for list of crates providing function bindings." -documentation = "https://retep998.github.io/doc/winapi/" -repository = "https://github.com/retep998/winapi-rs" -readme = "README.md" -keywords = ["windows", "ffi", "win32", "com", "directx"] -license = "MIT" -include = ["src/**/*", "Cargo.toml", "LICENSE.md"] - -[dev-dependencies] -advapi32-sys = { version = "0", path = "lib/advapi32" } -bcrypt-sys = { version = "0", path = "lib/bcrypt" } -comctl32-sys = { version = "0", path = "lib/comctl32" } -comdlg32-sys = { version = "0", path = "lib/comdlg32" } -credui-sys = { version = "0", path = "lib/credui" } -crypt32-sys = { version = "0", path = "lib/crypt32" } -d2d1-sys = { version = "0", path = "lib/d2d1" } -d3d11-sys = { version = "0", path = "lib/d3d11" } -d3d12-sys = { version = "0", path = "lib/d3d12" } -d3d9-sys = { version = "0", path = "lib/d3d9" } -d3dcompiler-sys = { version = "0", path = "lib/d3dcompiler" } -dbghelp-sys = { version = "0", path = "lib/dbghelp" } -dsound-sys = { version = "0", path = "lib/dsound" } -dwmapi-sys = { version = "0", path = "lib/dwmapi" } -dwrite-sys = { version = "0", path = "lib/dwrite" } -dxgi-sys = { version = "0", path = "lib/dxgi" } -dxguid-sys = { version = "0", path = "lib/dxguid" } -gdi32-sys = { version = "0", path = "lib/gdi32" } -hid-sys = { version = "0", path = "lib/hid" } -httpapi-sys = { version = "0", path = "lib/httpapi" } -kernel32-sys = { version = "0", path = "lib/kernel32" } -ktmw32-sys = { version = "0", path = "lib/ktmw32" } -mpr-sys = { version = "0", path = "lib/mpr" } -netapi32-sys = { version = "0", path = "lib/netapi32" } -odbc32-sys = { version = "0", path = "lib/odbc32" } -ole32-sys = { version = "0", path = "lib/ole32" } -oleaut32-sys = { version = "0", path = "lib/oleaut32" } -opengl32-sys = { version = "0", path = "lib/opengl32" } -pdh-sys = { version = "0", path = "lib/pdh" } -psapi-sys = { version = "0", path = "lib/psapi" } -runtimeobject-sys = { version = "0", path = "lib/runtimeobject" } -secur32-sys = { version = "0", path = "lib/secur32" } -setupapi-sys = { version = "0", path = "lib/setupapi" } -shell32-sys = { version = "0", path = "lib/shell32" } -shlwapi-sys = { version = "0", path = "lib/shlwapi" } -user32-sys = { version = "0", path = "lib/user32" } -userenv-sys = { version = "0", path = "lib/userenv" } -usp10-sys = { version = "0", path = "lib/usp10" } -uuid-sys = { version = "0", path = "lib/uuid" } -vssapi-sys = { version = "0", path = "lib/vssapi" } -wevtapi-sys = { version = "0", path = "lib/wevtapi" } -winhttp-sys = { version = "0", path = "lib/winhttp" } -winmm-sys = { version = "0", path = "lib/winmm" } -winscard-sys = { version = "0", path = "lib/winscard" } -winspool-sys = { version = "0", path = "lib/winspool" } -winusb-sys = { version = "0", path = "lib/winusb" } -ws2_32-sys = { version = "0", path = "lib/ws2_32" } -xinput-sys = { version = "0", path = "lib/xinput" } diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/LICENSE.md cargo-0.37.0/vendor/winapi-0.2.8/LICENSE.md --- cargo-0.35.0/vendor/winapi-0.2.8/LICENSE.md 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/LICENSE.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Peter Atashian - -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 is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/activation.rs cargo-0.37.0/vendor/winapi-0.2.8/src/activation.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/activation.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/activation.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -RIDL!( -interface IActivationFactory(IActivationFactoryVtbl): IInspectable(IInspectableVtbl) { - fn ActivateInstance(&mut self, instance: *mut *mut ::IInspectable) -> ::HRESULT -} -); \ No newline at end of file diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/audioclient.rs cargo-0.37.0/vendor/winapi-0.2.8/src/audioclient.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/audioclient.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/audioclient.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! this ALWAYS GENERATED file contains the definitions for the interfaces -//1627 -pub const AUDCLNT_E_NOT_INITIALIZED: ::HRESULT = AUDCLNT_ERR!(0x001); -pub const AUDCLNT_E_ALREADY_INITIALIZED: ::HRESULT = AUDCLNT_ERR!(0x002); -pub const AUDCLNT_E_WRONG_ENDPOINT_TYPE: ::HRESULT = AUDCLNT_ERR!(0x003); -pub const AUDCLNT_E_DEVICE_INVALIDATED: ::HRESULT = AUDCLNT_ERR!(0x004); -pub const AUDCLNT_E_NOT_STOPPED: ::HRESULT = AUDCLNT_ERR!(0x005); -pub const AUDCLNT_E_BUFFER_TOO_LARGE: ::HRESULT = AUDCLNT_ERR!(0x006); -pub const AUDCLNT_E_OUT_OF_ORDER: ::HRESULT = AUDCLNT_ERR!(0x007); -pub const AUDCLNT_E_UNSUPPORTED_FORMAT: ::HRESULT = AUDCLNT_ERR!(0x008); -pub const AUDCLNT_E_INVALID_SIZE: ::HRESULT = AUDCLNT_ERR!(0x009); -pub const AUDCLNT_E_DEVICE_IN_USE: ::HRESULT = AUDCLNT_ERR!(0x00a); -pub const AUDCLNT_E_BUFFER_OPERATION_PENDING: ::HRESULT = AUDCLNT_ERR!(0x00b); -pub const AUDCLNT_E_THREAD_NOT_REGISTERED: ::HRESULT = AUDCLNT_ERR!(0x00c); -pub const AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED: ::HRESULT = AUDCLNT_ERR!(0x00e); -pub const AUDCLNT_E_ENDPOINT_CREATE_FAILED: ::HRESULT = AUDCLNT_ERR!(0x00f); -pub const AUDCLNT_E_SERVICE_NOT_RUNNING: ::HRESULT = AUDCLNT_ERR!(0x010); -pub const AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED: ::HRESULT = AUDCLNT_ERR!(0x011); -pub const AUDCLNT_E_EXCLUSIVE_MODE_ONLY: ::HRESULT = AUDCLNT_ERR!(0x012); -pub const AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL: ::HRESULT = AUDCLNT_ERR!(0x013); -pub const AUDCLNT_E_EVENTHANDLE_NOT_SET: ::HRESULT = AUDCLNT_ERR!(0x014); -pub const AUDCLNT_E_INCORRECT_BUFFER_SIZE: ::HRESULT = AUDCLNT_ERR!(0x015); -pub const AUDCLNT_E_BUFFER_SIZE_ERROR: ::HRESULT = AUDCLNT_ERR!(0x016); -pub const AUDCLNT_E_CPUUSAGE_EXCEEDED: ::HRESULT = AUDCLNT_ERR!(0x017); -pub const AUDCLNT_E_BUFFER_ERROR: ::HRESULT = AUDCLNT_ERR!(0x018); -pub const AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED: ::HRESULT = AUDCLNT_ERR!(0x019); -pub const AUDCLNT_E_INVALID_DEVICE_PERIOD: ::HRESULT = AUDCLNT_ERR!(0x020); -pub const AUDCLNT_E_INVALID_STREAM_FLAG: ::HRESULT = AUDCLNT_ERR!(0x021); -pub const AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE: ::HRESULT = AUDCLNT_ERR!(0x022); -pub const AUDCLNT_E_OUT_OF_OFFLOAD_RESOURCES: ::HRESULT = AUDCLNT_ERR!(0x023); -pub const AUDCLNT_E_OFFLOAD_MODE_ONLY: ::HRESULT = AUDCLNT_ERR!(0x024); -pub const AUDCLNT_E_NONOFFLOAD_MODE_ONLY: ::HRESULT = AUDCLNT_ERR!(0x025); -pub const AUDCLNT_E_RESOURCES_INVALIDATED: ::HRESULT = AUDCLNT_ERR!(0x026); -pub const AUDCLNT_E_RAW_MODE_UNSUPPORTED: ::HRESULT = AUDCLNT_ERR!(0x027); -pub const AUDCLNT_S_BUFFER_EMPTY: ::SCODE = AUDCLNT_SUCCESS!(0x001); -pub const AUDCLNT_S_THREAD_ALREADY_REGISTERED: ::SCODE = AUDCLNT_SUCCESS!(0x002); -pub const AUDCLNT_S_POSITION_STALLED: ::SCODE = AUDCLNT_SUCCESS!(0x003); -DEFINE_GUID!(IID_IAudioClient, 0x1CB9AD4C, 0xDBFA, 0x4c32, - 0xB1, 0x78, 0xC2, 0xF5, 0x68, 0xA7, 0x03, 0xB2); -DEFINE_GUID!(IID_IAudioRenderClient, 0xF294ACFC, 0x3146, 0x4483, - 0xA7, 0xBF, 0xAD, 0xDC, 0xA7, 0xC2, 0x60, 0xE2); -RIDL!{interface IAudioClient(IAudioClientVtbl): IUnknown(IUnknownVtbl) { - fn Initialize( - &mut self, ShareMode: ::AUDCLNT_SHAREMODE, StreamFlags: ::DWORD, - hnsBufferDuration: ::REFERENCE_TIME, hnsPeriodicity: ::REFERENCE_TIME, - pFormat: *const ::WAVEFORMATEX, AudioSessionGuid: ::LPCGUID - ) -> ::HRESULT, - fn GetBufferSize(&mut self, pNumBufferFrames: *mut ::UINT32) -> ::HRESULT, - fn GetStreamLatency(&mut self, phnsLatency: *mut ::REFERENCE_TIME) -> ::HRESULT, - fn GetCurrentPadding(&mut self, pNumPaddingFrames: *mut ::UINT32) -> ::HRESULT, - fn IsFormatSupported( - &mut self, ShareMode: ::AUDCLNT_SHAREMODE, pFormat: *const ::WAVEFORMATEX, - ppClosestMatch: *mut *mut ::WAVEFORMATEX - ) -> ::HRESULT, - fn GetMixFormat(&mut self, ppDeviceFormat: *mut *mut ::WAVEFORMATEX) -> ::HRESULT, - fn GetDevicePeriod( - &mut self, phnsDefaultDevicePeriod: *mut ::REFERENCE_TIME, - phnsMinimumDevicePeriod: *mut ::REFERENCE_TIME - ) -> ::HRESULT, - fn Start(&mut self) -> ::HRESULT, - fn Stop(&mut self) -> ::HRESULT, - fn Reset(&mut self) -> ::HRESULT, - fn SetEventHandle(&mut self, eventHandle: ::HANDLE) -> ::HRESULT, - fn GetService(&mut self, riid: ::REFIID, ppv: *mut ::LPVOID) -> ::HRESULT -}} -RIDL!{interface IAudioRenderClient(IAudioRenderClientVtbl): IUnknown(IUnknownVtbl) { - fn GetBuffer(&mut self, NumFramesRequested: ::UINT32, ppData: *mut *mut ::BYTE) -> ::HRESULT, - fn ReleaseBuffer(&mut self, NumFramesWritten: ::UINT32, dwFlags: ::DWORD) -> ::HRESULT -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/audiosessiontypes.rs cargo-0.37.0/vendor/winapi-0.2.8/src/audiosessiontypes.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/audiosessiontypes.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/audiosessiontypes.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -ENUM!{enum AUDCLNT_SHAREMODE { - AUDCLNT_SHAREMODE_SHARED, - AUDCLNT_SHAREMODE_EXCLUSIVE, -}} -pub const AUDCLNT_STREAMFLAGS_CROSSPROCESS: ::DWORD = 0x00010000; -pub const AUDCLNT_STREAMFLAGS_LOOPBACK: ::DWORD = 0x00020000; -pub const AUDCLNT_STREAMFLAGS_EVENTCALLBACK: ::DWORD = 0x00040000; -pub const AUDCLNT_STREAMFLAGS_NOPERSIST: ::DWORD = 0x00080000; -pub const AUDCLNT_STREAMFLAGS_RATEADJUST: ::DWORD = 0x00100000; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/basetsd.rs cargo-0.37.0/vendor/winapi-0.2.8/src/basetsd.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/basetsd.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/basetsd.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,99 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Type definitions for the basic sized types. -#[cfg(target_arch = "x86")] -pub type POINTER_64_INT = ::c_ulong; -#[cfg(target_arch = "x86_64")] -pub type POINTER_64_INT = ::__uint64; -pub type INT8 = ::c_schar; -pub type PINT8 = *mut ::c_schar; -pub type INT16 = ::c_short; -pub type PINT16 = *mut ::c_short; -pub type INT32 = ::c_int; -pub type PINT32 = *mut ::c_int; -pub type INT64 = ::__int64; -pub type PINT64 = *mut ::__int64; -pub type UINT8 = ::c_uchar; -pub type PUINT8 = *mut ::c_uchar; -pub type UINT16 = ::c_ushort; -pub type PUINT16 = *mut ::c_ushort; -pub type UINT32 = ::c_uint; -pub type PUINT32 = *mut ::c_uint; -pub type UINT64 = ::__uint64; -pub type PUINT64 = *mut ::__uint64; -pub type LONG32 = ::c_int; -pub type PLONG32 = *mut ::c_int; -pub type ULONG32 = ::c_uint; -pub type PULONG32 = *mut ::c_uint; -pub type DWORD32 = ::c_uint; -pub type PDWORD32 = *mut ::c_uint; -#[cfg(target_arch = "x86")] -pub type INT_PTR = ::c_int; -#[cfg(target_arch = "x86_64")] -pub type INT_PTR = ::__int64; -#[cfg(target_arch = "x86")] -pub type PINT_PTR = *mut ::c_int; -#[cfg(target_arch = "x86_64")] -pub type PINT_PTR = *mut ::__int64; -#[cfg(target_arch = "x86")] -pub type UINT_PTR = ::c_uint; -#[cfg(target_arch = "x86_64")] -pub type UINT_PTR = ::__uint64; -#[cfg(target_arch = "x86")] -pub type PUINT_PTR = *mut ::c_uint; -#[cfg(target_arch = "x86_64")] -pub type PUINT_PTR = *mut ::__uint64; -#[cfg(target_arch = "x86")] -pub type LONG_PTR = ::c_long; -#[cfg(target_arch = "x86_64")] -pub type LONG_PTR = ::__int64; -#[cfg(target_arch = "x86")] -pub type PLONG_PTR = *mut ::c_long; -#[cfg(target_arch = "x86_64")] -pub type PLONG_PTR = *mut ::__int64; -#[cfg(target_arch = "x86")] -pub type ULONG_PTR = ::c_ulong; -#[cfg(target_arch = "x86_64")] -pub type ULONG_PTR = ::__uint64; -#[cfg(target_arch = "x86")] -pub type PULONG_PTR = *mut ::c_ulong; -#[cfg(target_arch = "x86_64")] -pub type PULONG_PTR = *mut ::__uint64; -#[cfg(target_arch = "x86_64")] -pub type SHANDLE_PTR = ::__int64; -#[cfg(target_arch = "x86_64")] -pub type HANDLE_PTR = ::__uint64; -#[cfg(target_arch = "x86_64")] -pub type UHALF_PTR = ::c_uint; -#[cfg(target_arch = "x86_64")] -pub type PUHALF_PTR = *mut ::c_uint; -#[cfg(target_arch = "x86_64")] -pub type HALF_PTR = ::c_int; -#[cfg(target_arch = "x86_64")] -pub type PHALF_PTR = *mut ::c_int; -#[cfg(target_arch = "x86")] -pub type SHANDLE_PTR = ::c_long; -#[cfg(target_arch = "x86")] -pub type HANDLE_PTR = ::c_ulong; -#[cfg(target_arch = "x86")] -pub type UHALF_PTR = ::c_ushort; -#[cfg(target_arch = "x86")] -pub type PUHALF_PTR = *mut ::c_ushort; -#[cfg(target_arch = "x86")] -pub type HALF_PTR = ::c_short; -#[cfg(target_arch = "x86")] -pub type PHALF_PTR = *mut ::c_short; -pub type SIZE_T = ULONG_PTR; -pub type PSIZE_T = *mut ULONG_PTR; -pub type SSIZE_T = LONG_PTR; -pub type PSSIZE_T = *mut LONG_PTR; -pub type DWORD_PTR = ULONG_PTR; -pub type PDWORD_PTR = *mut ULONG_PTR; -pub type LONG64 = ::__int64; -pub type PLONG64 = *mut ::__int64; -pub type ULONG64 = ::__uint64; -pub type PULONG64 = *mut ::__uint64; -pub type DWORD64 = ::__uint64; -pub type PDWORD64 = *mut ::__uint64; -pub type KAFFINITY = ULONG_PTR; -pub type PKAFFINITY = *mut KAFFINITY; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/bcrypt.rs cargo-0.37.0/vendor/winapi-0.2.8/src/bcrypt.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/bcrypt.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/bcrypt.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,356 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Cryptographic Primitive API Prototypes and Definitions -pub const KDF_HASH_ALGORITHM: ::ULONG = 0x0; -pub const KDF_SECRET_PREPEND: ::ULONG = 0x1; -pub const KDF_SECRET_APPEND: ::ULONG = 0x2; -pub const KDF_HMAC_KEY: ::ULONG = 0x3; -pub const KDF_TLS_PRF_LABEL: ::ULONG = 0x4; -pub const KDF_TLS_PRF_SEED: ::ULONG = 0x5; -pub const KDF_SECRET_HANDLE: ::ULONG = 0x6; -pub const KDF_TLS_PRF_PROTOCOL: ::ULONG = 0x7; -pub const KDF_ALGORITHMID: ::ULONG = 0x8; -pub const KDF_PARTYUINFO: ::ULONG = 0x9; -pub const KDF_PARTYVINFO: ::ULONG = 0xA; -pub const KDF_SUPPPUBINFO: ::ULONG = 0xB; -pub const KDF_SUPPPRIVINFO: ::ULONG = 0xC; -pub const KDF_LABEL: ::ULONG = 0xD; -pub const KDF_CONTEXT: ::ULONG = 0xE; -pub const KDF_SALT: ::ULONG = 0xF; -pub const KDF_ITERATION_COUNT: ::ULONG = 0x10; -pub const KDF_GENERIC_PARAMETER: ::ULONG = 0x11; -pub const KDF_KEYBITLENGTH: ::ULONG = 0x12; -pub const KDF_USE_SECRET_AS_HMAC_KEY_FLAG: ::ULONG = 0x1; -STRUCT!{struct BCRYPT_KEY_LENGTHS_STRUCT { - dwMinLength: ::ULONG, - dwMaxLength: ::ULONG, - dwIncrement: ::ULONG, -}} -pub type BCRYPT_AUTH_TAG_LENGTHS_STRUCT = BCRYPT_KEY_LENGTHS_STRUCT; -STRUCT!{struct BCRYPT_OID { - cbOID: ::ULONG, - pbOID: ::PUCHAR, -}} -STRUCT!{struct BCRYPT_OID_LIST { - dwOIDCount: ::ULONG, - pOIDs: *mut BCRYPT_OID, -}} -STRUCT!{struct BCRYPT_PKCS1_PADDING_INFO { - pszAlgId: ::LPCWSTR, -}} -STRUCT!{struct BCRYPT_PSS_PADDING_INFO { - pszAlgId: ::LPCWSTR, - cbSalt: ::ULONG, -}} -STRUCT!{struct BCRYPT_OAEP_PADDING_INFO { - pszAlgId: ::LPCWSTR, - pbLabel: ::PUCHAR, - cbLabel: ::ULONG, -}} -pub const BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO_VERSION: ::ULONG = 1; -pub const BCRYPT_AUTH_MODE_CHAIN_CALLS_FLAG: ::ULONG = 0x00000001; -pub const BCRYPT_AUTH_MODE_IN_PROGRESS_FLAG: ::ULONG = 0x00000002; -STRUCT!{struct BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO { - cbSize: ::ULONG, - dwInfoVersion: ::ULONG, - pbNonce: ::PUCHAR, - cbNonce: ::ULONG, - pbAuthData: ::PUCHAR, - cbAuthData: ::ULONG, - pbTag: ::PUCHAR, - cbTag: ::ULONG, - pbMacContext: ::PUCHAR, - cbMacContext: ::ULONG, - cbAAD: ::ULONG, - cbData: ::ULONGLONG, - dwFlags: ::ULONG, -}} -pub type PBCRYPT_AUTHENTICATED_CIPHER_MODE_INFO = *mut BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO; -pub const BCRYPT_PROV_DISPATCH: ::ULONG = 0x00000001; -pub const BCRYPT_BLOCK_PADDING: ::ULONG = 0x00000001; -pub const BCRYPT_PAD_NONE: ::ULONG = 0x00000001; -pub const BCRYPT_PAD_PKCS1: ::ULONG = 0x00000002; -pub const BCRYPT_PAD_OAEP: ::ULONG = 0x00000004; -pub const BCRYPT_PAD_PSS: ::ULONG = 0x00000008; -pub const BCRYPT_PAD_PKCS1_OPTIONAL_HASH_OID: ::ULONG = 0x00000010; -pub const BCRYPTBUFFER_VERSION: ::ULONG = 0; -STRUCT!{struct BCryptBuffer { - cbBuffer: ::ULONG, - BufferType: ::ULONG, - pvBuffer: ::PVOID, -}} -pub type PBCryptBuffer = *mut BCryptBuffer; -STRUCT!{struct BCryptBufferDesc { - ulVersion: ::ULONG, - cBuffers: ::ULONG, - pBuffers: PBCryptBuffer, -}} -pub type PBCryptBufferDesc = *mut BCryptBufferDesc; -//321 -pub type BCRYPT_HANDLE = ::PVOID; -pub type BCRYPT_ALG_HANDLE = ::PVOID; -pub type BCRYPT_KEY_HANDLE = ::PVOID; -pub type BCRYPT_HASH_HANDLE = ::PVOID; -pub type BCRYPT_SECRET_HANDLE = ::PVOID; -STRUCT!{struct BCRYPT_KEY_BLOB { - Magic: ::ULONG, -}} -pub const BCRYPT_RSAPUBLIC_MAGIC: ::ULONG = 0x31415352; -pub const BCRYPT_RSAPRIVATE_MAGIC: ::ULONG = 0x32415352; -STRUCT!{struct BCRYPT_RSAKEY_BLOB { - Magic: ::ULONG, - BitLength: ::ULONG, - cbPublicExp: ::ULONG, - cbModulus: ::ULONG, - cbPrime1: ::ULONG, - cbPrime2: ::ULONG, -}} -pub const BCRYPT_RSAFULLPRIVATE_MAGIC: ::ULONG = 0x33415352; -pub const BCRYPT_ECDH_PUBLIC_P256_MAGIC: ::ULONG = 0x314B4345; -pub const BCRYPT_ECDH_PRIVATE_P256_MAGIC: ::ULONG = 0x324B4345; -pub const BCRYPT_ECDH_PUBLIC_P384_MAGIC: ::ULONG = 0x334B4345; -pub const BCRYPT_ECDH_PRIVATE_P384_MAGIC: ::ULONG = 0x344B4345; -pub const BCRYPT_ECDH_PUBLIC_P521_MAGIC: ::ULONG = 0x354B4345; -pub const BCRYPT_ECDH_PRIVATE_P521_MAGIC: ::ULONG = 0x364B4345; -pub const BCRYPT_ECDSA_PUBLIC_P256_MAGIC: ::ULONG = 0x31534345; -pub const BCRYPT_ECDSA_PRIVATE_P256_MAGIC: ::ULONG = 0x32534345; -pub const BCRYPT_ECDSA_PUBLIC_P384_MAGIC: ::ULONG = 0x33534345; -pub const BCRYPT_ECDSA_PRIVATE_P384_MAGIC: ::ULONG = 0x34534345; -pub const BCRYPT_ECDSA_PUBLIC_P521_MAGIC: ::ULONG = 0x35534345; -pub const BCRYPT_ECDSA_PRIVATE_P521_MAGIC: ::ULONG = 0x36534345; -STRUCT!{struct BCRYPT_ECCKEY_BLOB { - dwMagic: ::ULONG, - cbKey: ::ULONG, -}} -pub type PBCRYPT_ECCKEY_BLOB = *mut BCRYPT_ECCKEY_BLOB; -pub const BCRYPT_DH_PUBLIC_MAGIC: ::ULONG = 0x42504844; -pub const BCRYPT_DH_PRIVATE_MAGIC: ::ULONG = 0x56504844; -STRUCT!{struct BCRYPT_DH_KEY_BLOB { - dwMagic: ::ULONG, - cbKey: ::ULONG, -}} -pub type PBCRYPT_DH_KEY_BLOB = *mut BCRYPT_DH_KEY_BLOB; -pub const BCRYPT_DH_PARAMETERS_MAGIC: ::ULONG = 0x4d504844; -STRUCT!{struct BCRYPT_DH_PARAMETER_HEADER { - cbLength: ::ULONG, - dwMagic: ::ULONG, - cbKeyLength: ::ULONG, -}} -pub const BCRYPT_DSA_PUBLIC_MAGIC: ::ULONG = 0x42505344; -pub const BCRYPT_DSA_PRIVATE_MAGIC: ::ULONG = 0x56505344; -pub const BCRYPT_DSA_PUBLIC_MAGIC_V2: ::ULONG = 0x32425044; -pub const BCRYPT_DSA_PRIVATE_MAGIC_V2: ::ULONG = 0x32565044; -STRUCT!{struct BCRYPT_DSA_KEY_BLOB { - dwMagic: ::ULONG, - cbKey: ::ULONG, - Count: [::UCHAR; 4], - Seed: [::UCHAR; 20], - q: [::UCHAR; 20], -}} -pub type PBCRYPT_DSA_KEY_BLOB = *mut BCRYPT_DSA_KEY_BLOB; -ENUM!{enum HASHALGORITHM_ENUM { - DSA_HASH_ALGORITHM_SHA1, - DSA_HASH_ALGORITHM_SHA256, - DSA_HASH_ALGORITHM_SHA512, -}} -ENUM!{enum DSAFIPSVERSION_ENUM { - DSA_FIPS186_2, - DSA_FIPS186_3, -}} -STRUCT!{struct BCRYPT_DSA_KEY_BLOB_V2 { - dwMagic: ::ULONG, - cbKey: ::ULONG, - hashAlgorithm: HASHALGORITHM_ENUM, - standardVersion: DSAFIPSVERSION_ENUM, - cbSeedLength: ::ULONG, - cbGroupSize: ::ULONG, - Count: [::UCHAR; 4], -}} -pub type PBCRYPT_DSA_KEY_BLOB_V2 = *mut BCRYPT_DSA_KEY_BLOB_V2; -STRUCT!{struct BCRYPT_KEY_DATA_BLOB_HEADER { - dwMagic: ::ULONG, - dwVersion: ::ULONG, - cbKeyData: ::ULONG, -}} -pub type PBCRYPT_KEY_DATA_BLOB_HEADER = *mut BCRYPT_KEY_DATA_BLOB_HEADER; -pub const BCRYPT_KEY_DATA_BLOB_MAGIC: ::ULONG = 0x4d42444b; -pub const BCRYPT_KEY_DATA_BLOB_VERSION1: ::ULONG = 0x1; -pub const BCRYPT_DSA_PARAMETERS_MAGIC: ::ULONG = 0x4d505344; -pub const BCRYPT_DSA_PARAMETERS_MAGIC_V2: ::ULONG = 0x324d5044; -STRUCT!{struct BCRYPT_DSA_PARAMETER_HEADER { - cbLength: ::ULONG, - dwMagic: ::ULONG, - cbKeyLength: ::ULONG, - Count: [::UCHAR; 4], - Seed: [::UCHAR; 20], - q: [::UCHAR; 20], -}} -STRUCT!{struct BCRYPT_DSA_PARAMETER_HEADER_V2 { - cbLength: ::ULONG, - dwMagic: ::ULONG, - cbKeyLength: ::ULONG, - hashAlgorithm: HASHALGORITHM_ENUM, - standardVersion: DSAFIPSVERSION_ENUM, - cbSeedLength: ::ULONG, - cbGroupSize: ::ULONG, - Count: [::UCHAR; 4], -}} -ENUM!{enum BCRYPT_HASH_OPERATION_TYPE { - BCRYPT_HASH_OPERATION_HASH_DATA = 1, - BCRYPT_HASH_OPERATION_FINISH_HASH = 2, -}} -STRUCT!{struct BCRYPT_MULTI_HASH_OPERATION { - iHash: ::ULONG, - hashOperation: BCRYPT_HASH_OPERATION_TYPE, - pbBuffer: ::PUCHAR, - cbBuffer: ::ULONG, -}} -ENUM!{enum BCRYPT_MULTI_OPERATION_TYPE { - BCRYPT_OPERATION_TYPE_HASH = 1, -}} -STRUCT!{struct BCRYPT_MULTI_OBJECT_LENGTH_STRUCT { - cbPerObject: ::ULONG, - cbPerElement: ::ULONG, -}} -pub const BCRYPT_CIPHER_INTERFACE: ::ULONG = 0x00000001; -pub const BCRYPT_HASH_INTERFACE: ::ULONG = 0x00000002; -pub const BCRYPT_ASYMMETRIC_ENCRYPTION_INTERFACE: ::ULONG = 0x00000003; -pub const BCRYPT_SECRET_AGREEMENT_INTERFACE: ::ULONG = 0x00000004; -pub const BCRYPT_SIGNATURE_INTERFACE: ::ULONG = 0x00000005; -pub const BCRYPT_RNG_INTERFACE: ::ULONG = 0x00000006; -pub const BCRYPT_KEY_DERIVATION_INTERFACE: ::ULONG = 0x00000007; -pub const BCRYPT_ALG_HANDLE_HMAC_FLAG: ::ULONG = 0x00000008; -pub const BCRYPT_CAPI_AES_FLAG: ::ULONG = 0x00000010; -pub const BCRYPT_HASH_REUSABLE_FLAG: ::ULONG = 0x00000020; -pub const BCRYPT_BUFFERS_LOCKED_FLAG: ::ULONG = 0x00000040; -pub const BCRYPT_EXTENDED_KEYSIZE: ::ULONG = 0x00000080; -pub const BCRYPT_CIPHER_OPERATION: ::ULONG = 0x00000001; -pub const BCRYPT_HASH_OPERATION: ::ULONG = 0x00000002; -pub const BCRYPT_ASYMMETRIC_ENCRYPTION_OPERATION: ::ULONG = 0x00000004; -pub const BCRYPT_SECRET_AGREEMENT_OPERATION: ::ULONG = 0x00000008; -pub const BCRYPT_SIGNATURE_OPERATION: ::ULONG = 0x00000010; -pub const BCRYPT_RNG_OPERATION: ::ULONG = 0x00000020; -pub const BCRYPT_KEY_DERIVATION_OPERATION: ::ULONG = 0x00000040; -STRUCT!{struct BCRYPT_ALGORITHM_IDENTIFIER { - pszName: ::LPWSTR, - dwClass: ::ULONG, - dwFlags: ::ULONG, -}} -STRUCT!{struct BCRYPT_PROVIDER_NAME { - pszProviderName: ::LPWSTR, -}} -pub const BCRYPT_PUBLIC_KEY_FLAG: ::ULONG = 0x00000001; -pub const BCRYPT_PRIVATE_KEY_FLAG: ::ULONG = 0x00000002; -pub const BCRYPT_RNG_USE_ENTROPY_IN_BUFFER: ::ULONG = 0x00000001; -pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG: ::ULONG = 0x00000002; -STRUCT!{struct BCRYPT_INTERFACE_VERSION { - MajorVersion: ::USHORT, - MinorVersion: ::USHORT, -}} -pub type PBCRYPT_INTERFACE_VERSION = *mut BCRYPT_INTERFACE_VERSION; -pub const BCRYPT_CIPHER_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION = - BCRYPT_MAKE_INTERFACE_VERSION!(1, 0); -pub const BCRYPT_HASH_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION = - BCRYPT_MAKE_INTERFACE_VERSION!(1, 0); -pub const BCRYPT_HASH_INTERFACE_MAJORVERSION_2: ::USHORT = 2; -pub const BCRYPT_HASH_INTERFACE_VERSION_2: BCRYPT_INTERFACE_VERSION = - BCRYPT_MAKE_INTERFACE_VERSION!(BCRYPT_HASH_INTERFACE_MAJORVERSION_2, 0); -pub const BCRYPT_ASYMMETRIC_ENCRYPTION_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION = - BCRYPT_MAKE_INTERFACE_VERSION!(1, 0); -pub const BCRYPT_SECRET_AGREEMENT_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION = - BCRYPT_MAKE_INTERFACE_VERSION!(1, 0); -pub const BCRYPT_SIGNATURE_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION = - BCRYPT_MAKE_INTERFACE_VERSION!(1, 0); -pub const BCRYPT_RNG_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION = - BCRYPT_MAKE_INTERFACE_VERSION!(1, 0); -pub const CRYPT_MIN_DEPENDENCIES: ::ULONG = 0x00000001; -pub const CRYPT_PROCESS_ISOLATE: ::ULONG = 0x00010000; -pub const CRYPT_UM: ::ULONG = 0x00000001; -pub const CRYPT_KM: ::ULONG = 0x00000002; -pub const CRYPT_MM: ::ULONG = 0x00000003; -pub const CRYPT_ANY: ::ULONG = 0x00000004; -pub const CRYPT_OVERWRITE: ::ULONG = 0x00000001; -pub const CRYPT_LOCAL: ::ULONG = 0x00000001; -pub const CRYPT_DOMAIN: ::ULONG = 0x00000002; -pub const CRYPT_EXCLUSIVE: ::ULONG = 0x00000001; -pub const CRYPT_OVERRIDE: ::ULONG = 0x00010000; -pub const CRYPT_ALL_FUNCTIONS: ::ULONG = 0x00000001; -pub const CRYPT_ALL_PROVIDERS: ::ULONG = 0x00000002; -pub const CRYPT_PRIORITY_TOP: ::ULONG = 0x00000000; -pub const CRYPT_PRIORITY_BOTTOM: ::ULONG = 0xFFFFFFFF; -STRUCT!{struct CRYPT_INTERFACE_REG { - dwInterface: ::ULONG, - dwFlags: ::ULONG, - cFunctions: ::ULONG, - rgpszFunctions: *mut ::PWSTR, -}} -pub type PCRYPT_INTERFACE_REG = *mut CRYPT_INTERFACE_REG; -STRUCT!{struct CRYPT_IMAGE_REG { - pszImage: ::PWSTR, - cInterfaces: ::ULONG, - rgpInterfaces: *mut PCRYPT_INTERFACE_REG, -}} -pub type PCRYPT_IMAGE_REG = *mut CRYPT_IMAGE_REG; -STRUCT!{struct CRYPT_PROVIDER_REG { - cAliases: ::ULONG, - rgpszAliases: *mut ::PWSTR, - pUM: PCRYPT_IMAGE_REG, - pKM: PCRYPT_IMAGE_REG, -}} -pub type PCRYPT_PROVIDER_REG = *mut CRYPT_PROVIDER_REG; -STRUCT!{struct CRYPT_PROVIDERS { - cProviders: ::ULONG, - rgpszProviders: *mut ::PWSTR, -}} -pub type PCRYPT_PROVIDERS = *mut CRYPT_PROVIDERS; -STRUCT!{struct CRYPT_CONTEXT_CONFIG { - dwFlags: ::ULONG, - dwReserved: ::ULONG, -}} -pub type PCRYPT_CONTEXT_CONFIG = *mut CRYPT_CONTEXT_CONFIG; -STRUCT!{struct CRYPT_CONTEXT_FUNCTION_CONFIG { - dwFlags: ::ULONG, - dwReserved: ::ULONG, -}} -pub type PCRYPT_CONTEXT_FUNCTION_CONFIG = *mut CRYPT_CONTEXT_FUNCTION_CONFIG; -STRUCT!{struct CRYPT_CONTEXTS { - cContexts: ::ULONG, - rgpszContexts: *mut ::PWSTR, -}} -pub type PCRYPT_CONTEXTS = *mut CRYPT_CONTEXTS; -STRUCT!{struct CRYPT_CONTEXT_FUNCTIONS { - cFunctions: ::ULONG, - rgpszFunctions: *mut ::PWSTR, -}} -pub type PCRYPT_CONTEXT_FUNCTIONS = *mut CRYPT_CONTEXT_FUNCTIONS; -STRUCT!{struct CRYPT_CONTEXT_FUNCTION_PROVIDERS { - cProviders: ::ULONG, - rgpszProviders: *mut ::PWSTR, -}} -pub type PCRYPT_CONTEXT_FUNCTION_PROVIDERS = *mut CRYPT_CONTEXT_FUNCTION_PROVIDERS; -STRUCT!{struct CRYPT_PROPERTY_REF { - pszProperty: ::PWSTR, - cbValue: ::ULONG, - pbValue: ::PUCHAR, -}} -pub type PCRYPT_PROPERTY_REF = *mut CRYPT_PROPERTY_REF; -STRUCT!{struct CRYPT_IMAGE_REF { - pszImage: ::PWSTR, - dwFlags: ::ULONG, -}} -pub type PCRYPT_IMAGE_REF = *mut CRYPT_IMAGE_REF; -STRUCT!{struct CRYPT_PROVIDER_REF { - dwInterface: ::ULONG, - pszFunction: ::PWSTR, - pszProvider: ::PWSTR, - cProperties: ::ULONG, - rgpProperties: *mut PCRYPT_PROPERTY_REF, - pUM: PCRYPT_IMAGE_REF, - pKM: PCRYPT_IMAGE_REF, -}} -pub type PCRYPT_PROVIDER_REF = *mut CRYPT_PROVIDER_REF; -STRUCT!{struct CRYPT_PROVIDER_REFS { - cProviders: ::ULONG, - rgpProviders: *mut PCRYPT_PROVIDER_REF, -}} -pub type PCRYPT_PROVIDER_REFS = *mut CRYPT_PROVIDER_REFS; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/cfgmgr32.rs cargo-0.37.0/vendor/winapi-0.2.8/src/cfgmgr32.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/cfgmgr32.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/cfgmgr32.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,758 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! user APIs for the Configuration Manager -pub type PCVOID = *const ::VOID; -pub const MAX_DEVICE_ID_LEN: usize = 200; -pub const MAX_DEVNODE_ID_LEN: usize = MAX_DEVICE_ID_LEN; -pub const MAX_GUID_STRING_LEN: usize = 39; -pub const MAX_CLASS_NAME_LEN: usize = 32; -pub const MAX_PROFILE_LEN: usize = 80; -pub const MAX_CONFIG_VALUE: ::DWORD = 9999; -pub const MAX_INSTANCE_VALUE: ::DWORD = 9999; -pub const MAX_MEM_REGISTERS: ::DWORD = 9; -pub const MAX_IO_PORTS: ::DWORD = 20; -pub const MAX_IRQS: ::DWORD = 7; -pub const MAX_DMA_CHANNELS: ::DWORD = 7; -pub const DWORD_MAX: ::DWORD = 0xffffffff; -pub const DWORDLONG_MAX: ::DWORDLONG = 0xffffffffffffffff; -pub const CONFIGMG_VERSION: ::DWORD = 0x0400; -pub type RETURN_TYPE = ::DWORD; -pub type CONFIGRET = RETURN_TYPE; -pub type DEVNODE = ::DWORD; -pub type DEVINST = ::DWORD; -pub type PDEVNODE = *mut DEVNODE; -pub type PDEVINST = *mut DEVNODE; -pub type DEVNODEID_A = *mut ::CHAR; -pub type DEVINSTID_A = *mut ::CHAR; -pub type DEVNODEID_W = *mut ::WCHAR; -pub type DEVINSTID_W = *mut ::WCHAR; -pub type LOG_CONF = ::DWORD_PTR; -pub type PLOG_CONF = *mut LOG_CONF; -pub type RES_DES = ::DWORD_PTR; -pub type PRES_DES = *mut RES_DES; -pub type RESOURCEID = ::ULONG; -pub type PRESOURCEID = *mut RESOURCEID; -pub type PRIORITY = ::ULONG; -pub type PPRIORITY = *mut PRIORITY; -pub type RANGE_LIST = ::DWORD_PTR; -pub type PRANGE_LIST = *mut RANGE_LIST; -pub type RANGE_ELEMENT = ::DWORD_PTR; -pub type PRANGE_ELEMENT = *mut RANGE_ELEMENT; -pub type HMACHINE = ::HANDLE; -pub type PHMACHINE = *mut HMACHINE; -pub type CONFLICT_LIST = ::ULONG_PTR; -pub type PCONFLICT_LIST = *mut CONFLICT_LIST; -STRUCT!{nodebug struct CONFLICT_DETAILS_A { - CD_ulSize: ::ULONG, - CD_ulMask: ::ULONG, - CD_dnDevInst: DEVINST, - CD_rdResDes: RES_DES, - CD_ulFlags: ::ULONG, - CD_szDescription: [::CHAR; ::MAX_PATH], -}} -pub type PCONFLICT_DETAILS_A = *mut CONFLICT_DETAILS_A; -STRUCT!{nodebug struct CONFLICT_DETAILS_W { - CD_ulSize: ::ULONG, - CD_ulMask: ::ULONG, - CD_dnDevInst: DEVINST, - CD_rdResDes: RES_DES, - CD_ulFlags: ::ULONG, - CD_szDescription: [::WCHAR; ::MAX_PATH], -}} -pub type PCONFLICT_DETAILS_W = *mut CONFLICT_DETAILS_W; -pub const CM_CDMASK_DEVINST: ::ULONG = 0x00000001; -pub const CM_CDMASK_RESDES: ::ULONG = 0x00000002; -pub const CM_CDMASK_FLAGS: ::ULONG = 0x00000004; -pub const CM_CDMASK_DESCRIPTION: ::ULONG = 0x00000008; -pub const CM_CDMASK_VALID: ::ULONG = 0x0000000F; -pub const CM_CDFLAGS_DRIVER: ::ULONG = 0x00000001; -pub const CM_CDFLAGS_ROOT_OWNED: ::ULONG = 0x00000002; -pub const CM_CDFLAGS_RESERVED: ::ULONG = 0x00000004; -pub type REGDISPOSITION = ::ULONG; -pub const mMD_MemoryType: ::DWORD = 0x1; -pub const fMD_MemoryType: ::DWORD = mMD_MemoryType; -pub const fMD_ROM: ::DWORD = 0x0; -pub const fMD_RAM: ::DWORD = 0x1; -pub const mMD_32_24: ::DWORD = 0x2; -pub const fMD_32_24: ::DWORD = mMD_32_24; -pub const fMD_24: ::DWORD = 0x0; -pub const fMD_32: ::DWORD = 0x2; -pub const mMD_Prefetchable: ::DWORD = 0x4; -pub const fMD_Prefetchable: ::DWORD = mMD_Prefetchable; -pub const fMD_Pref: ::DWORD = mMD_Prefetchable; -pub const fMD_PrefetchDisallowed: ::DWORD = 0x0; -pub const fMD_PrefetchAllowed: ::DWORD = 0x4; -pub const mMD_Readable: ::DWORD = 0x8; -pub const fMD_Readable: ::DWORD = mMD_Readable; -pub const fMD_ReadAllowed: ::DWORD = 0x0; -pub const fMD_ReadDisallowed: ::DWORD = 0x8; -pub const mMD_CombinedWrite: ::DWORD = 0x10; -pub const fMD_CombinedWrite: ::DWORD = mMD_CombinedWrite; -pub const fMD_CombinedWriteDisallowed: ::DWORD = 0x0; -pub const fMD_CombinedWriteAllowed: ::DWORD = 0x10; -pub const mMD_Cacheable: ::DWORD = 0x20; -pub const fMD_NonCacheable: ::DWORD = 0x0; -pub const fMD_Cacheable: ::DWORD = 0x20; -pub const fMD_WINDOW_DECODE: ::DWORD = 0x40; -pub const fMD_MEMORY_BAR: ::DWORD = 0x80; -STRUCT!{struct MEM_RANGE { - MR_Align: ::DWORDLONG, - MR_nBytes: ::ULONG, - MR_Min: ::DWORDLONG, - MR_Max: ::DWORDLONG, - MR_Flags: ::DWORD, - MR_Reserved: ::DWORD, -}} -pub type PMEM_RANGE = *mut MEM_RANGE; -STRUCT!{struct MEM_DES { - MD_Count: ::DWORD, - MD_Type: ::DWORD, - MD_Alloc_Base: ::DWORDLONG, - MD_Alloc_End: ::DWORDLONG, - MD_Flags: ::DWORD, - MD_Reserved: ::DWORD, -}} -pub type PMEM_DES = *mut MEM_DES; -STRUCT!{struct MEM_RESOURCE { - MEM_Header: MEM_DES, - MEM_Data: [MEM_RANGE; ::ANYSIZE_ARRAY], -}} -pub type PMEM_RESOURCE = *mut MEM_RESOURCE; -STRUCT!{struct MEM_LARGE_RANGE { - MLR_Align: ::DWORDLONG, - MLR_nBytes: ::ULONGLONG, - MLR_Min: ::DWORDLONG, - MLR_Max: ::DWORDLONG, - MLR_Flags: ::DWORD, - MLR_Reserved: ::DWORD, -}} -pub type PMEM_LARGE_RANGE = *mut MEM_LARGE_RANGE; -STRUCT!{struct MEM_LARGE_DES { - MLD_Count: ::DWORD, - MLD_Type: ::DWORD, - MLD_Alloc_Base: ::DWORDLONG, - MLD_Alloc_End: ::DWORDLONG, - MLD_Flags: ::DWORD, - MLD_Reserved: ::DWORD, -}} -pub type PMEM_LARGE_DES = *mut MEM_LARGE_DES; -STRUCT!{struct MEM_LARGE_RESOURCE { - MEM_LARGE_Header: MEM_LARGE_DES, - MEM_LARGE_Data: [MEM_LARGE_RANGE; ::ANYSIZE_ARRAY], -}} -pub type PMEM_LARGE_RESOURCE = *mut MEM_LARGE_RESOURCE; -pub const fIOD_PortType: ::DWORD = 0x1; -pub const fIOD_Memory: ::DWORD = 0x0; -pub const fIOD_IO: ::DWORD = 0x1; -pub const fIOD_DECODE: ::DWORD = 0x00fc; -pub const fIOD_10_BIT_DECODE: ::DWORD = 0x0004; -pub const fIOD_12_BIT_DECODE: ::DWORD = 0x0008; -pub const fIOD_16_BIT_DECODE: ::DWORD = 0x0010; -pub const fIOD_POSITIVE_DECODE: ::DWORD = 0x0020; -pub const fIOD_PASSIVE_DECODE: ::DWORD = 0x0040; -pub const fIOD_WINDOW_DECODE: ::DWORD = 0x0080; -pub const fIOD_PORT_BAR: ::DWORD = 0x0100; -pub const IO_ALIAS_10_BIT_DECODE: ::DWORDLONG = 0x00000004; -pub const IO_ALIAS_12_BIT_DECODE: ::DWORDLONG = 0x00000010; -pub const IO_ALIAS_16_BIT_DECODE: ::DWORDLONG = 0x00000000; -pub const IO_ALIAS_POSITIVE_DECODE: ::DWORDLONG = 0x000000FF; -STRUCT!{struct IO_RANGE { - IOR_Align: ::DWORDLONG, - IOR_nPorts: ::DWORD, - IOR_Min: ::DWORDLONG, - IOR_Max: ::DWORDLONG, - IOR_RangeFlags: ::DWORD, - IOR_Alias: ::DWORDLONG, -}} -pub type PIO_RANGE = *mut IO_RANGE; -STRUCT!{struct IO_DES { - IOD_Count: ::DWORD, - IOD_Type: ::DWORD, - IOD_Alloc_Base: ::DWORDLONG, - IOD_Alloc_End: ::DWORDLONG, - IOD_DesFlags: ::DWORD, -}} -pub type PIO_DES = *mut IO_DES; -STRUCT!{struct IO_RESOURCE { - IO_Header: IO_DES, - IO_Data: [IO_RANGE; ::ANYSIZE_ARRAY], -}} -pub type PIO_RESOURCE = *mut IO_RESOURCE; -pub const mDD_Width: ::ULONG = 0x3; -pub const fDD_BYTE: ::ULONG = 0x0; -pub const fDD_WORD: ::ULONG = 0x1; -pub const fDD_DWORD: ::ULONG = 0x2; -pub const fDD_BYTE_AND_WORD: ::ULONG = 0x3; -pub const mDD_BusMaster: ::ULONG = 0x4; -pub const fDD_NoBusMaster: ::ULONG = 0x0; -pub const fDD_BusMaster: ::ULONG = 0x4; -pub const mDD_Type: ::ULONG = 0x18; -pub const fDD_TypeStandard: ::ULONG = 0x00; -pub const fDD_TypeA: ::ULONG = 0x08; -pub const fDD_TypeB: ::ULONG = 0x10; -pub const fDD_TypeF: ::ULONG = 0x18; -STRUCT!{struct DMA_RANGE { - DR_Min: ::ULONG, - DR_Max: ::ULONG, - DR_Flags: ::ULONG, -}} -pub type PDMA_RANGE = *mut DMA_RANGE; -STRUCT!{struct DMA_DES { - DD_Count: ::DWORD, - DD_Type: ::DWORD, - DD_Flags: ::DWORD, - DD_Alloc_Chan: ::ULONG, -}} -pub type PDMA_DES = *mut DMA_DES; -STRUCT!{struct DMA_RESOURCE { - DMA_Header: DMA_DES, - DMA_Data: [DMA_RANGE; ::ANYSIZE_ARRAY], -}} -pub type PDMA_RESOURCE = *mut DMA_RESOURCE; -pub const mIRQD_Share: ::ULONG = 0x1; -pub const fIRQD_Exclusive: ::ULONG = 0x0; -pub const fIRQD_Share: ::ULONG = 0x1; -pub const fIRQD_Share_Bit: ::ULONG = 0; -pub const fIRQD_Level_Bit: ::ULONG = 1; -pub const mIRQD_Edge_Level: ::ULONG = 0x2; -pub const fIRQD_Level: ::ULONG = 0x0; -pub const fIRQD_Edge: ::ULONG = 0x2; -STRUCT!{struct IRQ_RANGE { - IRQR_Min: ::ULONG, - IRQR_Max: ::ULONG, - IRQR_Flags: ::ULONG, -}} -pub type PIRQ_RANGE = *mut IRQ_RANGE; -STRUCT!{struct IRQ_DES_32 { - IRQD_Count: ::DWORD, - IRQD_Type: ::DWORD, - IRQD_Flags: ::DWORD, - IRQD_Alloc_Num: ::ULONG, - IRQD_Affinity: ::ULONG32, -}} -pub type PIRQ_DES_32 = *mut IRQ_DES_32; -STRUCT!{struct IRQ_DES_64 { - IRQD_Count: ::DWORD, - IRQD_Type: ::DWORD, - IRQD_Flags: ::DWORD, - IRQD_Alloc_Num: ::ULONG, - IRQD_Affinity: ::ULONG64, -}} -pub type PIRQ_DES_64 = *mut IRQ_DES_64; -STRUCT!{struct IRQ_RESOURCE_32 { - IRQ_Header: IRQ_DES_32, - IRQ_Data: [IRQ_RANGE; ::ANYSIZE_ARRAY], -}} -pub type PIRQ_RESOURCE_32 = *mut IRQ_RESOURCE_32; -STRUCT!{struct IRQ_RESOURCE_64 { - IRQ_Header: IRQ_DES_64, - IRQ_Data: [IRQ_RANGE; ::ANYSIZE_ARRAY], -}} -pub type PIRQ_RESOURCE_64 = *mut IRQ_RESOURCE_64; -STRUCT!{struct DEVPRIVATE_RANGE { - PR_Data1: ::DWORD, - PR_Data2: ::DWORD, - PR_Data3: ::DWORD, -}} -pub type PDEVPRIVATE_RANGE = *mut DEVPRIVATE_RANGE; -STRUCT!{struct DEVPRIVATE_DES { - PD_Count: ::DWORD, - PD_Type: ::DWORD, - PD_Data1: ::DWORD, - PD_Data2: ::DWORD, - PD_Data3: ::DWORD, - PD_Flags: ::DWORD, -}} -pub type PDEVPRIVATE_DES = *mut DEVPRIVATE_DES; -STRUCT!{struct DEVPRIVATE_RESOURCE { - PRV_Header: DEVPRIVATE_DES, - PRV_Data: [DEVPRIVATE_RANGE; ::ANYSIZE_ARRAY], -}} -pub type PDEVPRIVATE_RESOURCE = *mut DEVPRIVATE_RESOURCE; -STRUCT!{struct CS_DES { - CSD_SignatureLength: ::DWORD, - CSD_LegacyDataOffset: ::DWORD, - CSD_LegacyDataSize: ::DWORD, - CSD_Flags: ::DWORD, - CSD_ClassGuid: ::GUID, - CSD_Signature: [::BYTE; ::ANYSIZE_ARRAY], -}} -pub type PCS_DES = *mut CS_DES; -STRUCT!{struct CS_RESOURCE { - CS_Header: CS_DES, -}} -pub type PCS_RESOURCE = *mut CS_RESOURCE; -pub const mPCD_IO_8_16: ::DWORD = 0x1; -pub const fPCD_IO_8: ::DWORD = 0x0; -pub const fPCD_IO_16: ::DWORD = 0x1; -pub const mPCD_MEM_8_16: ::DWORD = 0x2; -pub const fPCD_MEM_8: ::DWORD = 0x0; -pub const fPCD_MEM_16: ::DWORD = 0x2; -pub const mPCD_MEM_A_C: ::DWORD = 0xC; -pub const fPCD_MEM1_A: ::DWORD = 0x4; -pub const fPCD_MEM2_A: ::DWORD = 0x8; -pub const fPCD_IO_ZW_8: ::DWORD = 0x10; -pub const fPCD_IO_SRC_16: ::DWORD = 0x20; -pub const fPCD_IO_WS_16: ::DWORD = 0x40; -pub const mPCD_MEM_WS: ::DWORD = 0x300; -pub const fPCD_MEM_WS_ONE: ::DWORD = 0x100; -pub const fPCD_MEM_WS_TWO: ::DWORD = 0x200; -pub const fPCD_MEM_WS_THREE: ::DWORD = 0x300; -pub const fPCD_MEM_A: ::DWORD = 0x4; -pub const fPCD_ATTRIBUTES_PER_WINDOW: ::DWORD = 0x8000; -pub const fPCD_IO1_16: ::DWORD = 0x00010000; -pub const fPCD_IO1_ZW_8: ::DWORD = 0x00020000; -pub const fPCD_IO1_SRC_16: ::DWORD = 0x00040000; -pub const fPCD_IO1_WS_16: ::DWORD = 0x00080000; -pub const fPCD_IO2_16: ::DWORD = 0x00100000; -pub const fPCD_IO2_ZW_8: ::DWORD = 0x00200000; -pub const fPCD_IO2_SRC_16: ::DWORD = 0x00400000; -pub const fPCD_IO2_WS_16: ::DWORD = 0x00800000; -pub const mPCD_MEM1_WS: ::DWORD = 0x03000000; -pub const fPCD_MEM1_WS_TWO: ::DWORD = 0x02000000; -pub const fPCD_MEM1_WS_THREE: ::DWORD = 0x03000000; -pub const fPCD_MEM1_16: ::DWORD = 0x04000000; -pub const mPCD_MEM2_WS: ::DWORD = 0x30000000; -pub const fPCD_MEM2_WS_ONE: ::DWORD = 0x10000000; -pub const fPCD_MEM2_WS_TWO: ::DWORD = 0x20000000; -pub const fPCD_MEM2_WS_THREE: ::DWORD = 0x30000000; -pub const fPCD_MEM2_16: ::DWORD = 0x40000000; -pub const PCD_MAX_MEMORY: usize = 2; -pub const PCD_MAX_IO: usize = 2; -STRUCT!{struct PCCARD_DES { - PCD_Count: ::DWORD, - PCD_Type: ::DWORD, - PCD_Flags: ::DWORD, - PCD_ConfigIndex: ::BYTE, - PCD_Reserved: [::BYTE; 3], - PCD_MemoryCardBase1: ::DWORD, - PCD_MemoryCardBase2: ::DWORD, - PCD_MemoryCardBase: [::DWORD; PCD_MAX_MEMORY], - PCD_MemoryFlags: [::WORD; PCD_MAX_MEMORY], - PCD_IoFlags: [::BYTE; PCD_MAX_IO], -}} -pub type PPCCARD_DES = *mut PCCARD_DES; -STRUCT!{struct PCCARD_RESOURCE { - PcCard_Header: PCCARD_DES, -}} -pub type PPCCARD_RESOURCE = *mut PCCARD_RESOURCE; -pub const mPMF_AUDIO_ENABLE: ::DWORD = 0x8; -pub const fPMF_AUDIO_ENABLE: ::DWORD = 0x8; -STRUCT!{struct MFCARD_DES { - PMF_Count: ::DWORD, - PMF_Type: ::DWORD, - PMF_Flags: ::DWORD, - PMF_ConfigOptions: ::BYTE, - PMF_IoResourceIndex: ::BYTE, - PMF_Reserved: [::BYTE; 2], - PMF_ConfigRegisterBase: ::DWORD, -}} -pub type PMFCARD_DES = *mut MFCARD_DES; -STRUCT!{struct MFCARD_RESOURCE { - MfCard_Header: MFCARD_DES, -}} -pub type PMFCARD_RESOURCE = *mut MFCARD_RESOURCE; -STRUCT!{struct BUSNUMBER_RANGE { - BUSR_Min: ::ULONG, - BUSR_Max: ::ULONG, - BUSR_nBusNumbers: ::ULONG, - BUSR_Flags: ::ULONG, -}} -pub type PBUSNUMBER_RANGE = *mut BUSNUMBER_RANGE; -STRUCT!{struct BUSNUMBER_DES { - BUSD_Count: ::DWORD, - BUSD_Type: ::DWORD, - BUSD_Flags: ::DWORD, - BUSD_Alloc_Base: ::ULONG, - BUSD_Alloc_End: ::ULONG, -}} -pub type PBUSNUMBER_DES = *mut BUSNUMBER_DES; -STRUCT!{struct BUSNUMBER_RESOURCE { - BusNumber_Header: BUSNUMBER_DES, - BusNumber_Data: [BUSNUMBER_RANGE; ::ANYSIZE_ARRAY], -}} -pub type PBUSNUMBER_RESOURCE = *mut BUSNUMBER_RESOURCE; -STRUCT!{struct CONNECTION_DES { - COND_Type: ::DWORD, - COND_Flags: ::DWORD, - COND_Class: ::BYTE, - COND_ClassType: ::BYTE, - COND_Reserved1: ::BYTE, - COND_Reserved2: ::BYTE, - COND_Id: ::LARGE_INTEGER, -}} -pub type PCONNECTION_DES = *mut CONNECTION_DES; -STRUCT!{struct CONNECTION_RESOURCE { - Connection_Header: CONNECTION_DES, -}} -pub type PCONNECTION_RESOURCE = *mut CONNECTION_RESOURCE; -pub const CM_HWPI_NOT_DOCKABLE: ::DWORD = 0x00000000; -pub const CM_HWPI_UNDOCKED: ::DWORD = 0x00000001; -pub const CM_HWPI_DOCKED: ::DWORD = 0x00000002; -STRUCT!{nodebug struct HWPROFILEINFO_A { - HWPI_ulHWProfile: ::ULONG, - HWPI_szFriendlyName: [::CHAR; MAX_PROFILE_LEN], - HWPI_dwFlags: ::DWORD, -}} -pub type PHWPROFILEINFO_A = *mut HWPROFILEINFO_A; -STRUCT!{nodebug struct HWPROFILEINFO_W { - HWPI_ulHWProfile: ::ULONG, - HWPI_szFriendlyName: [::WCHAR; MAX_PROFILE_LEN], - HWPI_dwFlags: ::DWORD, -}} -pub type PHWPROFILEINFO_W = *mut HWPROFILEINFO_W; -pub const ResType_All: RESOURCEID = 0x00000000; -pub const ResType_None: RESOURCEID = 0x00000000; -pub const ResType_Mem: RESOURCEID = 0x00000001; -pub const ResType_IO: RESOURCEID = 0x00000002; -pub const ResType_DMA: RESOURCEID = 0x00000003; -pub const ResType_IRQ: RESOURCEID = 0x00000004; -pub const ResType_DoNotUse: RESOURCEID = 0x00000005; -pub const ResType_BusNumber: RESOURCEID = 0x00000006; -pub const ResType_MemLarge: RESOURCEID = 0x00000007; -pub const ResType_MAX: RESOURCEID = 0x00000007; -pub const ResType_Ignored_Bit: RESOURCEID = 0x00008000; -pub const ResType_ClassSpecific: RESOURCEID = 0x0000FFFF; -pub const ResType_Reserved: RESOURCEID = 0x00008000; -pub const ResType_DevicePrivate: RESOURCEID = 0x00008001; -pub const ResType_PcCardConfig: RESOURCEID = 0x00008002; -pub const ResType_MfCardConfig: RESOURCEID = 0x00008003; -pub const ResType_Connection: RESOURCEID = 0x00008004; -pub const CM_ADD_RANGE_ADDIFCONFLICT: ::ULONG = 0x00000000; -pub const CM_ADD_RANGE_DONOTADDIFCONFLICT: ::ULONG = 0x00000001; -pub const CM_ADD_RANGE_BITS: ::ULONG = 0x00000001; -pub const BASIC_LOG_CONF: ::ULONG = 0x00000000; -pub const FILTERED_LOG_CONF: ::ULONG = 0x00000001; -pub const ALLOC_LOG_CONF: ::ULONG = 0x00000002; -pub const BOOT_LOG_CONF: ::ULONG = 0x00000003; -pub const FORCED_LOG_CONF: ::ULONG = 0x00000004; -pub const OVERRIDE_LOG_CONF: ::ULONG = 0x00000005; -pub const NUM_LOG_CONF: ::ULONG = 0x00000006; -pub const LOG_CONF_BITS: ::ULONG = 0x00000007; -pub const PRIORITY_EQUAL_FIRST: ::ULONG = 0x00000008; -pub const PRIORITY_EQUAL_LAST: ::ULONG = 0x00000000; -pub const PRIORITY_BIT: ::ULONG = 0x00000008; -pub const RegDisposition_OpenAlways: REGDISPOSITION = 0x00000000; -pub const RegDisposition_OpenExisting: REGDISPOSITION = 0x00000001; -pub const RegDisposition_Bits: REGDISPOSITION = 0x00000001; -pub const CM_ADD_ID_HARDWARE: ::ULONG = 0x00000000; -pub const CM_ADD_ID_COMPATIBLE: ::ULONG = 0x00000001; -pub const CM_ADD_ID_BITS: ::ULONG = 0x00000001; -pub const CM_CREATE_DEVNODE_NORMAL: ::ULONG = 0x00000000; -pub const CM_CREATE_DEVNODE_NO_WAIT_INSTALL: ::ULONG = 0x00000001; -pub const CM_CREATE_DEVNODE_PHANTOM: ::ULONG = 0x00000002; -pub const CM_CREATE_DEVNODE_GENERATE_ID: ::ULONG = 0x00000004; -pub const CM_CREATE_DEVNODE_DO_NOT_INSTALL: ::ULONG = 0x00000008; -pub const CM_CREATE_DEVNODE_BITS: ::ULONG = 0x0000000F; -pub const CM_CREATE_DEVINST_NORMAL: ::ULONG = CM_CREATE_DEVNODE_NORMAL; -pub const CM_CREATE_DEVINST_NO_WAIT_INSTALL: ::ULONG = CM_CREATE_DEVNODE_NO_WAIT_INSTALL; -pub const CM_CREATE_DEVINST_PHANTOM: ::ULONG = CM_CREATE_DEVNODE_PHANTOM; -pub const CM_CREATE_DEVINST_GENERATE_ID: ::ULONG = CM_CREATE_DEVNODE_GENERATE_ID; -pub const CM_CREATE_DEVINST_DO_NOT_INSTALL: ::ULONG = CM_CREATE_DEVNODE_DO_NOT_INSTALL; -pub const CM_CREATE_DEVINST_BITS: ::ULONG = CM_CREATE_DEVNODE_BITS; -pub const CM_DELETE_CLASS_ONLY: ::ULONG = 0x00000000; -pub const CM_DELETE_CLASS_SUBKEYS: ::ULONG = 0x00000001; -pub const CM_DELETE_CLASS_INTERFACE: ::ULONG = 0x00000002; -pub const CM_DELETE_CLASS_BITS: ::ULONG = 0x00000003; -pub const CM_ENUMERATE_CLASSES_INSTALLER: ::ULONG = 0x00000000; -pub const CM_ENUMERATE_CLASSES_INTERFACE: ::ULONG = 0x00000001; -pub const CM_ENUMERATE_CLASSES_BITS: ::ULONG = 0x00000001; -pub const CM_DETECT_NEW_PROFILE: ::ULONG = 0x00000001; -pub const CM_DETECT_CRASHED: ::ULONG = 0x00000002; -pub const CM_DETECT_HWPROF_FIRST_BOOT: ::ULONG = 0x00000004; -pub const CM_DETECT_RUN: ::ULONG = 0x80000000; -pub const CM_DETECT_BITS: ::ULONG = 0x80000007; -pub const CM_DISABLE_POLITE: ::ULONG = 0x00000000; -pub const CM_DISABLE_ABSOLUTE: ::ULONG = 0x00000001; -pub const CM_DISABLE_HARDWARE: ::ULONG = 0x00000002; -pub const CM_DISABLE_UI_NOT_OK: ::ULONG = 0x00000004; -pub const CM_DISABLE_BITS: ::ULONG = 0x00000007; -pub const CM_GETIDLIST_FILTER_NONE: ::ULONG = 0x00000000; -pub const CM_GETIDLIST_FILTER_ENUMERATOR: ::ULONG = 0x00000001; -pub const CM_GETIDLIST_FILTER_SERVICE: ::ULONG = 0x00000002; -pub const CM_GETIDLIST_FILTER_EJECTRELATIONS: ::ULONG = 0x00000004; -pub const CM_GETIDLIST_FILTER_REMOVALRELATIONS: ::ULONG = 0x00000008; -pub const CM_GETIDLIST_FILTER_POWERRELATIONS: ::ULONG = 0x00000010; -pub const CM_GETIDLIST_FILTER_BUSRELATIONS: ::ULONG = 0x00000020; -pub const CM_GETIDLIST_DONOTGENERATE: ::ULONG = 0x10000040; -pub const CM_GETIDLIST_FILTER_TRANSPORTRELATIONS: ::ULONG = 0x00000080; -pub const CM_GETIDLIST_FILTER_PRESENT: ::ULONG = 0x00000100; -pub const CM_GETIDLIST_FILTER_CLASS: ::ULONG = 0x00000200; -pub const CM_GETIDLIST_FILTER_BITS: ::ULONG = 0x100003FF; -pub const CM_GET_DEVICE_INTERFACE_LIST_PRESENT: ::ULONG = 0x00000000; -pub const CM_GET_DEVICE_INTERFACE_LIST_ALL_DEVICES: ::ULONG = 0x00000001; -pub const CM_GET_DEVICE_INTERFACE_LIST_BITS: ::ULONG = 0x00000001; -pub const CM_DRP_DEVICEDESC: ::ULONG = 0x00000001; -pub const CM_DRP_HARDWAREID: ::ULONG = 0x00000002; -pub const CM_DRP_COMPATIBLEIDS: ::ULONG = 0x00000003; -pub const CM_DRP_UNUSED0: ::ULONG = 0x00000004; -pub const CM_DRP_SERVICE: ::ULONG = 0x00000005; -pub const CM_DRP_UNUSED1: ::ULONG = 0x00000006; -pub const CM_DRP_UNUSED2: ::ULONG = 0x00000007; -pub const CM_DRP_CLASS: ::ULONG = 0x00000008; -pub const CM_DRP_CLASSGUID: ::ULONG = 0x00000009; -pub const CM_DRP_DRIVER: ::ULONG = 0x0000000A; -pub const CM_DRP_CONFIGFLAGS: ::ULONG = 0x0000000B; -pub const CM_DRP_MFG: ::ULONG = 0x0000000C; -pub const CM_DRP_FRIENDLYNAME: ::ULONG = 0x0000000D; -pub const CM_DRP_LOCATION_INFORMATION: ::ULONG = 0x0000000E; -pub const CM_DRP_PHYSICAL_DEVICE_OBJECT_NAME: ::ULONG = 0x0000000F; -pub const CM_DRP_CAPABILITIES: ::ULONG = 0x00000010; -pub const CM_DRP_UI_NUMBER: ::ULONG = 0x00000011; -pub const CM_DRP_UPPERFILTERS: ::ULONG = 0x00000012; -pub const CM_CRP_UPPERFILTERS: ::ULONG = CM_DRP_UPPERFILTERS; -pub const CM_DRP_LOWERFILTERS: ::ULONG = 0x00000013; -pub const CM_CRP_LOWERFILTERS: ::ULONG = CM_DRP_LOWERFILTERS; -pub const CM_DRP_BUSTYPEGUID: ::ULONG = 0x00000014; -pub const CM_DRP_LEGACYBUSTYPE: ::ULONG = 0x00000015; -pub const CM_DRP_BUSNUMBER: ::ULONG = 0x00000016; -pub const CM_DRP_ENUMERATOR_NAME: ::ULONG = 0x00000017; -pub const CM_DRP_SECURITY: ::ULONG = 0x00000018; -pub const CM_CRP_SECURITY: ::ULONG = CM_DRP_SECURITY; -pub const CM_DRP_SECURITY_SDS: ::ULONG = 0x00000019; -pub const CM_CRP_SECURITY_SDS: ::ULONG = CM_DRP_SECURITY_SDS; -pub const CM_DRP_DEVTYPE: ::ULONG = 0x0000001A; -pub const CM_CRP_DEVTYPE: ::ULONG = CM_DRP_DEVTYPE; -pub const CM_DRP_EXCLUSIVE: ::ULONG = 0x0000001B; -pub const CM_CRP_EXCLUSIVE: ::ULONG = CM_DRP_EXCLUSIVE; -pub const CM_DRP_CHARACTERISTICS: ::ULONG = 0x0000001C; -pub const CM_CRP_CHARACTERISTICS: ::ULONG = CM_DRP_CHARACTERISTICS; -pub const CM_DRP_ADDRESS: ::ULONG = 0x0000001D; -pub const CM_DRP_UI_NUMBER_DESC_FORMAT: ::ULONG = 0x0000001E; -pub const CM_DRP_DEVICE_POWER_DATA: ::ULONG = 0x0000001F; -pub const CM_DRP_REMOVAL_POLICY: ::ULONG = 0x00000020; -pub const CM_DRP_REMOVAL_POLICY_HW_DEFAULT: ::ULONG = 0x00000021; -pub const CM_DRP_REMOVAL_POLICY_OVERRIDE: ::ULONG = 0x00000022; -pub const CM_DRP_INSTALL_STATE: ::ULONG = 0x00000023; -pub const CM_DRP_LOCATION_PATHS: ::ULONG = 0x00000024; -pub const CM_DRP_BASE_CONTAINERID: ::ULONG = 0x00000025; -pub const CM_DRP_MIN: ::ULONG = 0x00000001; -pub const CM_CRP_MIN: ::ULONG = CM_DRP_MIN; -pub const CM_DRP_MAX: ::ULONG = 0x00000025; -pub const CM_CRP_MAX: ::ULONG = CM_DRP_MAX; -pub const CM_DEVCAP_LOCKSUPPORTED: ::ULONG = 0x00000001; -pub const CM_DEVCAP_EJECTSUPPORTED: ::ULONG = 0x00000002; -pub const CM_DEVCAP_REMOVABLE: ::ULONG = 0x00000004; -pub const CM_DEVCAP_DOCKDEVICE: ::ULONG = 0x00000008; -pub const CM_DEVCAP_UNIQUEID: ::ULONG = 0x00000010; -pub const CM_DEVCAP_SILENTINSTALL: ::ULONG = 0x00000020; -pub const CM_DEVCAP_RAWDEVICEOK: ::ULONG = 0x00000040; -pub const CM_DEVCAP_SURPRISEREMOVALOK: ::ULONG = 0x00000080; -pub const CM_DEVCAP_HARDWAREDISABLED: ::ULONG = 0x00000100; -pub const CM_DEVCAP_NONDYNAMIC: ::ULONG = 0x00000200; -pub const CM_REMOVAL_POLICY_EXPECT_NO_REMOVAL: ::ULONG = 1; -pub const CM_REMOVAL_POLICY_EXPECT_ORDERLY_REMOVAL: ::ULONG = 2; -pub const CM_REMOVAL_POLICY_EXPECT_SURPRISE_REMOVAL: ::ULONG = 3; -pub const CM_INSTALL_STATE_INSTALLED: ::ULONG = 0; -pub const CM_INSTALL_STATE_NEEDS_REINSTALL: ::ULONG = 1; -pub const CM_INSTALL_STATE_FAILED_INSTALL: ::ULONG = 2; -pub const CM_INSTALL_STATE_FINISH_INSTALL: ::ULONG = 3; -pub const CM_LOCATE_DEVNODE_NORMAL: ::ULONG = 0x00000000; -pub const CM_LOCATE_DEVNODE_PHANTOM: ::ULONG = 0x00000001; -pub const CM_LOCATE_DEVNODE_CANCELREMOVE: ::ULONG = 0x00000002; -pub const CM_LOCATE_DEVNODE_NOVALIDATION: ::ULONG = 0x00000004; -pub const CM_LOCATE_DEVNODE_BITS: ::ULONG = 0x00000007; -pub const CM_LOCATE_DEVINST_NORMAL: ::ULONG = CM_LOCATE_DEVNODE_NORMAL; -pub const CM_LOCATE_DEVINST_PHANTOM: ::ULONG = CM_LOCATE_DEVNODE_PHANTOM; -pub const CM_LOCATE_DEVINST_CANCELREMOVE: ::ULONG = CM_LOCATE_DEVNODE_CANCELREMOVE; -pub const CM_LOCATE_DEVINST_NOVALIDATION: ::ULONG = CM_LOCATE_DEVNODE_NOVALIDATION; -pub const CM_LOCATE_DEVINST_BITS: ::ULONG = CM_LOCATE_DEVNODE_BITS; -pub const CM_OPEN_CLASS_KEY_INSTALLER: ::ULONG = 0x00000000; -pub const CM_OPEN_CLASS_KEY_INTERFACE: ::ULONG = 0x00000001; -pub const CM_OPEN_CLASS_KEY_BITS: ::ULONG = 0x00000001; -pub const CM_REMOVE_UI_OK: ::ULONG = 0x00000000; -pub const CM_REMOVE_UI_NOT_OK: ::ULONG = 0x00000001; -pub const CM_REMOVE_NO_RESTART: ::ULONG = 0x00000002; -pub const CM_REMOVE_BITS: ::ULONG = 0x00000003; -pub const CM_QUERY_REMOVE_UI_OK: ::ULONG = CM_REMOVE_UI_OK; -pub const CM_QUERY_REMOVE_UI_NOT_OK: ::ULONG = CM_REMOVE_UI_NOT_OK; -pub const CM_QUERY_REMOVE_BITS: ::ULONG = CM_QUERY_REMOVE_UI_OK | CM_QUERY_REMOVE_UI_NOT_OK; -pub const CM_REENUMERATE_NORMAL: ::ULONG = 0x00000000; -pub const CM_REENUMERATE_SYNCHRONOUS: ::ULONG = 0x00000001; -pub const CM_REENUMERATE_RETRY_INSTALLATION: ::ULONG = 0x00000002; -pub const CM_REENUMERATE_ASYNCHRONOUS: ::ULONG = 0x00000004; -pub const CM_REENUMERATE_BITS: ::ULONG = 0x00000007; -pub const CM_REGISTER_DEVICE_DRIVER_STATIC: ::ULONG = 0x00000000; -pub const CM_REGISTER_DEVICE_DRIVER_DISABLEABLE: ::ULONG = 0x00000001; -pub const CM_REGISTER_DEVICE_DRIVER_REMOVABLE: ::ULONG = 0x00000002; -pub const CM_REGISTER_DEVICE_DRIVER_BITS: ::ULONG = 0x00000003; -pub const CM_REGISTRY_HARDWARE: ::ULONG = 0x00000000; -pub const CM_REGISTRY_SOFTWARE: ::ULONG = 0x00000001; -pub const CM_REGISTRY_USER: ::ULONG = 0x00000100; -pub const CM_REGISTRY_CONFIG: ::ULONG = 0x00000200; -pub const CM_REGISTRY_BITS: ::ULONG = 0x00000301; -pub const CM_SET_DEVNODE_PROBLEM_NORMAL: ::ULONG = 0x00000000; -pub const CM_SET_DEVNODE_PROBLEM_OVERRIDE: ::ULONG = 0x00000001; -pub const CM_SET_DEVNODE_PROBLEM_BITS: ::ULONG = 0x00000001; -pub const CM_SET_DEVINST_PROBLEM_NORMAL: ::ULONG = CM_SET_DEVNODE_PROBLEM_NORMAL; -pub const CM_SET_DEVINST_PROBLEM_OVERRIDE: ::ULONG = CM_SET_DEVNODE_PROBLEM_OVERRIDE; -pub const CM_SET_DEVINST_PROBLEM_BITS: ::ULONG = CM_SET_DEVNODE_PROBLEM_BITS; -pub const CM_SET_HW_PROF_FLAGS_UI_NOT_OK: ::ULONG = 0x00000001; -pub const CM_SET_HW_PROF_FLAGS_BITS: ::ULONG = 0x00000001; -pub const CM_SETUP_DEVNODE_READY: ::ULONG = 0x00000000; -pub const CM_SETUP_DEVINST_READY: ::ULONG = CM_SETUP_DEVNODE_READY; -pub const CM_SETUP_DOWNLOAD: ::ULONG = 0x00000001; -pub const CM_SETUP_WRITE_LOG_CONFS: ::ULONG = 0x00000002; -pub const CM_SETUP_PROP_CHANGE: ::ULONG = 0x00000003; -pub const CM_SETUP_DEVNODE_RESET: ::ULONG = 0x00000004; -pub const CM_SETUP_DEVINST_RESET: ::ULONG = CM_SETUP_DEVNODE_RESET; -pub const CM_SETUP_DEVNODE_CONFIG: ::ULONG = 0x00000005; -pub const CM_SETUP_DEVINST_CONFIG: ::ULONG = CM_SETUP_DEVNODE_CONFIG; -pub const CM_SETUP_DEVNODE_CONFIG_CLASS: ::ULONG = 0x00000006; -pub const CM_SETUP_DEVINST_CONFIG_CLASS: ::ULONG = CM_SETUP_DEVNODE_CONFIG_CLASS; -pub const CM_SETUP_DEVNODE_CONFIG_EXTENSIONS: ::ULONG = 0x00000007; -pub const CM_SETUP_DEVINST_CONFIG_EXTENSIONS: ::ULONG = CM_SETUP_DEVNODE_CONFIG_EXTENSIONS; -pub const CM_SETUP_BITS: ::ULONG = 0x00000007; -pub const CM_QUERY_ARBITRATOR_RAW: ::ULONG = 0x00000000; -pub const CM_QUERY_ARBITRATOR_TRANSLATED: ::ULONG = 0x00000001; -pub const CM_QUERY_ARBITRATOR_BITS: ::ULONG = 0x00000001; -pub const CM_CUSTOMDEVPROP_MERGE_MULTISZ: ::ULONG = 0x00000001; -pub const CM_CUSTOMDEVPROP_BITS: ::ULONG = 0x00000001; -pub const CM_NAME_ATTRIBUTE_NAME_RETRIEVED_FROM_DEVICE: ::ULONG = 0x1; -pub const CM_NAME_ATTRIBUTE_USER_ASSIGNED_NAME: ::ULONG = 0x2; -pub const CM_CLASS_PROPERTY_INSTALLER: ::ULONG = 0x00000000; -pub const CM_CLASS_PROPERTY_INTERFACE: ::ULONG = 0x00000001; -pub const CM_CLASS_PROPERTY_BITS: ::ULONG = 0x00000001; -DECLARE_HANDLE!(HCMNOTIFICATION, HCMNOTIFICATION__); -pub type PHCMNOTIFICATION = *mut HCMNOTIFICATION; -pub const CM_NOTIFY_FILTER_FLAG_ALL_INTERFACE_CLASSES: ::ULONG = 0x00000001; -pub const CM_NOTIFY_FILTER_FLAG_ALL_DEVICE_INSTANCES: ::ULONG = 0x00000002; -pub const CM_NOTIFY_FILTER_VALID_FLAGS: ::ULONG = CM_NOTIFY_FILTER_FLAG_ALL_INTERFACE_CLASSES - | CM_NOTIFY_FILTER_FLAG_ALL_DEVICE_INSTANCES; -ENUM!{enum CM_NOTIFY_FILTER_TYPE { - CM_NOTIFY_FILTER_TYPE_DEVICEINTERFACE = 0, - CM_NOTIFY_FILTER_TYPE_DEVICEHANDLE, - CM_NOTIFY_FILTER_TYPE_DEVICEINSTANCE, - CM_NOTIFY_FILTER_TYPE_MAX, -}} -pub type PCM_NOTIFY_FILTER_TYPE = *mut CM_NOTIFY_FILTER_TYPE; -STRUCT!{struct CM_NOTIFY_FILTER_DeviceInterface { - ClassGuid: ::GUID, -}} -STRUCT!{struct CM_NOTIFY_FILTER_DeviceHandle { - hTarget: ::HANDLE, -}} -STRUCT!{nodebug struct CM_NOTIFY_FILTER_DeviceInstance { - InstanceId: [::WCHAR; MAX_DEVICE_ID_LEN], -}} -STRUCT!{nodebug struct CM_NOTIFY_FILTER { - cbSize: ::DWORD, - Flags: ::DWORD, - FilterType: CM_NOTIFY_FILTER_TYPE, - Reserved: ::DWORD, - u: [::BYTE; 400], -}} -UNION!(CM_NOTIFY_FILTER, u, DeviceInterface, DeviceInterface_mut, CM_NOTIFY_FILTER_DeviceInterface); -UNION!(CM_NOTIFY_FILTER, u, DeviceHandle, DeviceHandle_mut, CM_NOTIFY_FILTER_DeviceHandle); -UNION!(CM_NOTIFY_FILTER, u, DeviceInstance, DeviceInstance_mut, CM_NOTIFY_FILTER_DeviceInstance); -pub type PCM_NOTIFY_FILTER = *mut CM_NOTIFY_FILTER; -ENUM!{enum CM_NOTIFY_ACTION { - CM_NOTIFY_ACTION_DEVICEINTERFACEARRIVAL = 0, - CM_NOTIFY_ACTION_DEVICEINTERFACEREMOVAL, - CM_NOTIFY_ACTION_DEVICEQUERYREMOVE, - CM_NOTIFY_ACTION_DEVICEQUERYREMOVEFAILED, - CM_NOTIFY_ACTION_DEVICEREMOVEPENDING, - CM_NOTIFY_ACTION_DEVICEREMOVECOMPLETE, - CM_NOTIFY_ACTION_DEVICECUSTOMEVENT, - CM_NOTIFY_ACTION_DEVICEINSTANCEENUMERATED, - CM_NOTIFY_ACTION_DEVICEINSTANCESTARTED, - CM_NOTIFY_ACTION_DEVICEINSTANCEREMOVED, - CM_NOTIFY_ACTION_MAX, -}} -pub type PCM_NOTIFY_ACTION = *mut CM_NOTIFY_ACTION; -STRUCT!{struct CM_NOTIFY_EVENT_DATA_DeviceInterface { - ClassGuid: ::GUID, - SymbolicLink: [::WCHAR; ::ANYSIZE_ARRAY], -}} -STRUCT!{struct CM_NOTIFY_EVENT_DATA_DeviceHandle { - EventGuid: ::GUID, - NameOffset: ::LONG, - DataSize: ::DWORD, - Data: [::BYTE; ::ANYSIZE_ARRAY], -}} -STRUCT!{struct CM_NOTIFY_EVENT_DATA_DeviceInstance { - InstanceId: [::WCHAR; ::ANYSIZE_ARRAY], -}} -STRUCT!{struct CM_NOTIFY_EVENT_DATA { - FilterType: CM_NOTIFY_FILTER_TYPE, - Reserved: ::DWORD, - u: [::BYTE; 25], -}} -UNION!( - CM_NOTIFY_EVENT_DATA, u, DeviceInterface, DeviceInterface_mut, - CM_NOTIFY_EVENT_DATA_DeviceInterface -); -UNION!(CM_NOTIFY_EVENT_DATA, u, DeviceHandle, DeviceHandle_mut, CM_NOTIFY_EVENT_DATA_DeviceHandle); -UNION!( - CM_NOTIFY_EVENT_DATA, u, DeviceInstance, DeviceInstance_mut, CM_NOTIFY_EVENT_DATA_DeviceInstance -); -pub type PCM_NOTIFY_EVENT_DATA = *mut CM_NOTIFY_EVENT_DATA; -pub type PCM_NOTIFY_CALLBACK = Option ::DWORD>; -pub const CR_SUCCESS: CONFIGRET = 0x00000000; -pub const CR_DEFAULT: CONFIGRET = 0x00000001; -pub const CR_OUT_OF_MEMORY: CONFIGRET = 0x00000002; -pub const CR_INVALID_POINTER: CONFIGRET = 0x00000003; -pub const CR_INVALID_FLAG: CONFIGRET = 0x00000004; -pub const CR_INVALID_DEVNODE: CONFIGRET = 0x00000005; -pub const CR_INVALID_DEVINST: CONFIGRET = CR_INVALID_DEVNODE; -pub const CR_INVALID_RES_DES: CONFIGRET = 0x00000006; -pub const CR_INVALID_LOG_CONF: CONFIGRET = 0x00000007; -pub const CR_INVALID_ARBITRATOR: CONFIGRET = 0x00000008; -pub const CR_INVALID_NODELIST: CONFIGRET = 0x00000009; -pub const CR_DEVNODE_HAS_REQS: CONFIGRET = 0x0000000A; -pub const CR_DEVINST_HAS_REQS: CONFIGRET = CR_DEVNODE_HAS_REQS; -pub const CR_INVALID_RESOURCEID: CONFIGRET = 0x0000000B; -pub const CR_DLVXD_NOT_FOUND: CONFIGRET = 0x0000000C; -pub const CR_NO_SUCH_DEVNODE: CONFIGRET = 0x0000000D; -pub const CR_NO_SUCH_DEVINST: CONFIGRET = CR_NO_SUCH_DEVNODE; -pub const CR_NO_MORE_LOG_CONF: CONFIGRET = 0x0000000E; -pub const CR_NO_MORE_RES_DES: CONFIGRET = 0x0000000F; -pub const CR_ALREADY_SUCH_DEVNODE: CONFIGRET = 0x00000010; -pub const CR_ALREADY_SUCH_DEVINST: CONFIGRET = CR_ALREADY_SUCH_DEVNODE; -pub const CR_INVALID_RANGE_LIST: CONFIGRET = 0x00000011; -pub const CR_INVALID_RANGE: CONFIGRET = 0x00000012; -pub const CR_FAILURE: CONFIGRET = 0x00000013; -pub const CR_NO_SUCH_LOGICAL_DEV: CONFIGRET = 0x00000014; -pub const CR_CREATE_BLOCKED: CONFIGRET = 0x00000015; -pub const CR_NOT_SYSTEM_VM: CONFIGRET = 0x00000016; -pub const CR_REMOVE_VETOED: CONFIGRET = 0x00000017; -pub const CR_APM_VETOED: CONFIGRET = 0x00000018; -pub const CR_INVALID_LOAD_TYPE: CONFIGRET = 0x00000019; -pub const CR_BUFFER_SMALL: CONFIGRET = 0x0000001A; -pub const CR_NO_ARBITRATOR: CONFIGRET = 0x0000001B; -pub const CR_NO_REGISTRY_HANDLE: CONFIGRET = 0x0000001C; -pub const CR_REGISTRY_ERROR: CONFIGRET = 0x0000001D; -pub const CR_INVALID_DEVICE_ID: CONFIGRET = 0x0000001E; -pub const CR_INVALID_DATA: CONFIGRET = 0x0000001F; -pub const CR_INVALID_API: CONFIGRET = 0x00000020; -pub const CR_DEVLOADER_NOT_READY: CONFIGRET = 0x00000021; -pub const CR_NEED_RESTART: CONFIGRET = 0x00000022; -pub const CR_NO_MORE_HW_PROFILES: CONFIGRET = 0x00000023; -pub const CR_DEVICE_NOT_THERE: CONFIGRET = 0x00000024; -pub const CR_NO_SUCH_VALUE: CONFIGRET = 0x00000025; -pub const CR_WRONG_TYPE: CONFIGRET = 0x00000026; -pub const CR_INVALID_PRIORITY: CONFIGRET = 0x00000027; -pub const CR_NOT_DISABLEABLE: CONFIGRET = 0x00000028; -pub const CR_FREE_RESOURCES: CONFIGRET = 0x00000029; -pub const CR_QUERY_VETOED: CONFIGRET = 0x0000002A; -pub const CR_CANT_SHARE_IRQ: CONFIGRET = 0x0000002B; -pub const CR_NO_DEPENDENT: CONFIGRET = 0x0000002C; -pub const CR_SAME_RESOURCES: CONFIGRET = 0x0000002D; -pub const CR_NO_SUCH_REGISTRY_KEY: CONFIGRET = 0x0000002E; -pub const CR_INVALID_MACHINENAME: CONFIGRET = 0x0000002F; -pub const CR_REMOTE_COMM_FAILURE: CONFIGRET = 0x00000030; -pub const CR_MACHINE_UNAVAILABLE: CONFIGRET = 0x00000031; -pub const CR_NO_CM_SERVICES: CONFIGRET = 0x00000032; -pub const CR_ACCESS_DENIED: CONFIGRET = 0x00000033; -pub const CR_CALL_NOT_IMPLEMENTED: CONFIGRET = 0x00000034; -pub const CR_INVALID_PROPERTY: CONFIGRET = 0x00000035; -pub const CR_DEVICE_INTERFACE_ACTIVE: CONFIGRET = 0x00000036; -pub const CR_NO_SUCH_DEVICE_INTERFACE: CONFIGRET = 0x00000037; -pub const CR_INVALID_REFERENCE_STRING: CONFIGRET = 0x00000038; -pub const CR_INVALID_CONFLICT_LIST: CONFIGRET = 0x00000039; -pub const CR_INVALID_INDEX: CONFIGRET = 0x0000003A; -pub const CR_INVALID_STRUCTURE_SIZE: CONFIGRET = 0x0000003B; -pub const NUM_CR_RESULTS: CONFIGRET = 0x0000003C; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/cfg.rs cargo-0.37.0/vendor/winapi-0.2.8/src/cfg.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/cfg.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/cfg.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,134 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! common Configuration Manager definitions for both user mode and kernel mode code -ENUM!{enum PNP_VETO_TYPE { - PNP_VetoTypeUnknown, - PNP_VetoLegacyDevice, - PNP_VetoPendingClose, - PNP_VetoWindowsApp, - PNP_VetoWindowsService, - PNP_VetoOutstandingOpen, - PNP_VetoDevice, - PNP_VetoDriver, - PNP_VetoIllegalDeviceRequest, - PNP_VetoInsufficientPower, - PNP_VetoNonDisableable, - PNP_VetoLegacyDriver, - PNP_VetoInsufficientRights, -}} -pub type PPNP_VETO_TYPE = *mut PNP_VETO_TYPE; -pub const CM_PROB_NOT_CONFIGURED: ::CONFIGRET = 0x00000001; -pub const CM_PROB_DEVLOADER_FAILED: ::CONFIGRET = 0x00000002; -pub const CM_PROB_OUT_OF_MEMORY: ::CONFIGRET = 0x00000003; -pub const CM_PROB_ENTRY_IS_WRONG_TYPE: ::CONFIGRET = 0x00000004; -pub const CM_PROB_LACKED_ARBITRATOR: ::CONFIGRET = 0x00000005; -pub const CM_PROB_BOOT_CONFIG_CONFLICT: ::CONFIGRET = 0x00000006; -pub const CM_PROB_FAILED_FILTER: ::CONFIGRET = 0x00000007; -pub const CM_PROB_DEVLOADER_NOT_FOUND: ::CONFIGRET = 0x00000008; -pub const CM_PROB_INVALID_DATA: ::CONFIGRET = 0x00000009; -pub const CM_PROB_FAILED_START: ::CONFIGRET = 0x0000000A; -pub const CM_PROB_LIAR: ::CONFIGRET = 0x0000000B; -pub const CM_PROB_NORMAL_CONFLICT: ::CONFIGRET = 0x0000000C; -pub const CM_PROB_NOT_VERIFIED: ::CONFIGRET = 0x0000000D; -pub const CM_PROB_NEED_RESTART: ::CONFIGRET = 0x0000000E; -pub const CM_PROB_REENUMERATION: ::CONFIGRET = 0x0000000F; -pub const CM_PROB_PARTIAL_LOG_CONF: ::CONFIGRET = 0x00000010; -pub const CM_PROB_UNKNOWN_RESOURCE: ::CONFIGRET = 0x00000011; -pub const CM_PROB_REINSTALL: ::CONFIGRET = 0x00000012; -pub const CM_PROB_REGISTRY: ::CONFIGRET = 0x00000013; -pub const CM_PROB_VXDLDR: ::CONFIGRET = 0x00000014; -pub const CM_PROB_WILL_BE_REMOVED: ::CONFIGRET = 0x00000015; -pub const CM_PROB_DISABLED: ::CONFIGRET = 0x00000016; -pub const CM_PROB_DEVLOADER_NOT_READY: ::CONFIGRET = 0x00000017; -pub const CM_PROB_DEVICE_NOT_THERE: ::CONFIGRET = 0x00000018; -pub const CM_PROB_MOVED: ::CONFIGRET = 0x00000019; -pub const CM_PROB_TOO_EARLY: ::CONFIGRET = 0x0000001A; -pub const CM_PROB_NO_VALID_LOG_CONF: ::CONFIGRET = 0x0000001B; -pub const CM_PROB_FAILED_INSTALL: ::CONFIGRET = 0x0000001C; -pub const CM_PROB_HARDWARE_DISABLED: ::CONFIGRET = 0x0000001D; -pub const CM_PROB_CANT_SHARE_IRQ: ::CONFIGRET = 0x0000001E; -pub const CM_PROB_FAILED_ADD: ::CONFIGRET = 0x0000001F; -pub const CM_PROB_DISABLED_SERVICE: ::CONFIGRET = 0x00000020; -pub const CM_PROB_TRANSLATION_FAILED: ::CONFIGRET = 0x00000021; -pub const CM_PROB_NO_SOFTCONFIG: ::CONFIGRET = 0x00000022; -pub const CM_PROB_BIOS_TABLE: ::CONFIGRET = 0x00000023; -pub const CM_PROB_IRQ_TRANSLATION_FAILED: ::CONFIGRET = 0x00000024; -pub const CM_PROB_FAILED_DRIVER_ENTRY: ::CONFIGRET = 0x00000025; -pub const CM_PROB_DRIVER_FAILED_PRIOR_UNLOAD: ::CONFIGRET = 0x00000026; -pub const CM_PROB_DRIVER_FAILED_LOAD: ::CONFIGRET = 0x00000027; -pub const CM_PROB_DRIVER_SERVICE_KEY_INVALID: ::CONFIGRET = 0x00000028; -pub const CM_PROB_LEGACY_SERVICE_NO_DEVICES: ::CONFIGRET = 0x00000029; -pub const CM_PROB_DUPLICATE_DEVICE: ::CONFIGRET = 0x0000002A; -pub const CM_PROB_FAILED_POST_START: ::CONFIGRET = 0x0000002B; -pub const CM_PROB_HALTED: ::CONFIGRET = 0x0000002C; -pub const CM_PROB_PHANTOM: ::CONFIGRET = 0x0000002D; -pub const CM_PROB_SYSTEM_SHUTDOWN: ::CONFIGRET = 0x0000002E; -pub const CM_PROB_HELD_FOR_EJECT: ::CONFIGRET = 0x0000002F; -pub const CM_PROB_DRIVER_BLOCKED: ::CONFIGRET = 0x00000030; -pub const CM_PROB_REGISTRY_TOO_LARGE: ::CONFIGRET = 0x00000031; -pub const CM_PROB_SETPROPERTIES_FAILED: ::CONFIGRET = 0x00000032; -pub const CM_PROB_WAITING_ON_DEPENDENCY: ::CONFIGRET = 0x00000033; -pub const CM_PROB_UNSIGNED_DRIVER: ::CONFIGRET = 0x00000034; -pub const CM_PROB_USED_BY_DEBUGGER: ::CONFIGRET = 0x00000035; -pub const NUM_CM_PROB_V1: ::CONFIGRET = 0x00000025; -pub const NUM_CM_PROB_V2: ::CONFIGRET = 0x00000032; -pub const NUM_CM_PROB_V3: ::CONFIGRET = 0x00000033; -pub const NUM_CM_PROB_V4: ::CONFIGRET = 0x00000034; -pub const NUM_CM_PROB_V5: ::CONFIGRET = 0x00000035; -pub const NUM_CM_PROB_V6: ::CONFIGRET = 0x00000036; -pub const DN_ROOT_ENUMERATED: ::CONFIGRET = 0x00000001; -pub const DN_DRIVER_LOADED: ::CONFIGRET = 0x00000002; -pub const DN_ENUM_LOADED: ::CONFIGRET = 0x00000004; -pub const DN_STARTED: ::CONFIGRET = 0x00000008; -pub const DN_MANUAL: ::CONFIGRET = 0x00000010; -pub const DN_NEED_TO_ENUM: ::CONFIGRET = 0x00000020; -pub const DN_NOT_FIRST_TIME: ::CONFIGRET = 0x00000040; -pub const DN_HARDWARE_ENUM: ::CONFIGRET = 0x00000080; -pub const DN_LIAR: ::CONFIGRET = 0x00000100; -pub const DN_HAS_MARK: ::CONFIGRET = 0x00000200; -pub const DN_HAS_PROBLEM: ::CONFIGRET = 0x00000400; -pub const DN_FILTERED: ::CONFIGRET = 0x00000800; -pub const DN_MOVED: ::CONFIGRET = 0x00001000; -pub const DN_DISABLEABLE: ::CONFIGRET = 0x00002000; -pub const DN_REMOVABLE: ::CONFIGRET = 0x00004000; -pub const DN_PRIVATE_PROBLEM: ::CONFIGRET = 0x00008000; -pub const DN_MF_PARENT: ::CONFIGRET = 0x00010000; -pub const DN_MF_CHILD: ::CONFIGRET = 0x00020000; -pub const DN_WILL_BE_REMOVED: ::CONFIGRET = 0x00040000; -pub const DN_NOT_FIRST_TIMEE: ::CONFIGRET = 0x00080000; -pub const DN_STOP_FREE_RES: ::CONFIGRET = 0x00100000; -pub const DN_REBAL_CANDIDATE: ::CONFIGRET = 0x00200000; -pub const DN_BAD_PARTIAL: ::CONFIGRET = 0x00400000; -pub const DN_NT_ENUMERATOR: ::CONFIGRET = 0x00800000; -pub const DN_NT_DRIVER: ::CONFIGRET = 0x01000000; -pub const DN_NEEDS_LOCKING: ::CONFIGRET = 0x02000000; -pub const DN_ARM_WAKEUP: ::CONFIGRET = 0x04000000; -pub const DN_APM_ENUMERATOR: ::CONFIGRET = 0x08000000; -pub const DN_APM_DRIVER: ::CONFIGRET = 0x10000000; -pub const DN_SILENT_INSTALL: ::CONFIGRET = 0x20000000; -pub const DN_NO_SHOW_IN_DM: ::CONFIGRET = 0x40000000; -pub const DN_BOOT_LOG_PROB: ::CONFIGRET = 0x80000000; -pub const DN_NEED_RESTART: ::CONFIGRET = DN_LIAR; -pub const DN_DRIVER_BLOCKED: ::CONFIGRET = DN_NOT_FIRST_TIME; -pub const DN_LEGACY_DRIVER: ::CONFIGRET = DN_MOVED; -pub const DN_CHILD_WITH_INVALID_ID: ::CONFIGRET = DN_HAS_MARK; -pub const DN_DEVICE_DISCONNECTED: ::CONFIGRET = DN_NEEDS_LOCKING; -pub const DN_CHANGEABLE_FLAGS: ::CONFIGRET = DN_NOT_FIRST_TIME + DN_HARDWARE_ENUM + DN_HAS_MARK - + DN_DISABLEABLE + DN_REMOVABLE + DN_MF_CHILD + DN_MF_PARENT + DN_NOT_FIRST_TIMEE - + DN_STOP_FREE_RES + DN_REBAL_CANDIDATE + DN_NT_ENUMERATOR + DN_NT_DRIVER + DN_SILENT_INSTALL - + DN_NO_SHOW_IN_DM; -pub const LCPRI_FORCECONFIG: ::PRIORITY = 0x00000000; -pub const LCPRI_BOOTCONFIG: ::PRIORITY = 0x00000001; -pub const LCPRI_DESIRED: ::PRIORITY = 0x00002000; -pub const LCPRI_NORMAL: ::PRIORITY = 0x00003000; -pub const LCPRI_LASTBESTCONFIG: ::PRIORITY = 0x00003FFF; -pub const LCPRI_SUBOPTIMAL: ::PRIORITY = 0x00005000; -pub const LCPRI_LASTSOFTCONFIG: ::PRIORITY = 0x00007FFF; -pub const LCPRI_RESTART: ::PRIORITY = 0x00008000; -pub const LCPRI_REBOOT: ::PRIORITY = 0x00009000; -pub const LCPRI_POWEROFF: ::PRIORITY = 0x0000A000; -pub const LCPRI_HARDRECONFIG: ::PRIORITY = 0x0000C000; -pub const LCPRI_HARDWIRED: ::PRIORITY = 0x0000E000; -pub const LCPRI_IMPOSSIBLE: ::PRIORITY = 0x0000F000; -pub const LCPRI_DISABLED: ::PRIORITY = 0x0000FFFF; -pub const MAX_LCPRI: ::PRIORITY = 0x0000FFFF; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/combaseapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/combaseapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/combaseapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/combaseapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -// Copyright © 2016, Peter Atashian -// Licensed under the MIT License -use super::*; -pub const CLSCTX_INPROC_SERVER: DWORD = 0x1; -pub const CLSCTX_INPROC_HANDLER: DWORD = 0x2; -pub const CLSCTX_LOCAL_SERVER: DWORD = 0x4; -pub const CLSCTX_REMOTE_SERVER: DWORD = 0x10; -pub const CLSCTX_SERVER: DWORD = CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER | - CLSCTX_REMOTE_SERVER; -pub const CLSCTX_ALL: DWORD = CLSCTX_INPROC_HANDLER | CLSCTX_SERVER; -STRUCT!{struct ServerInformation { - dwServerPid: DWORD, - dwServerTid: DWORD, - ui64ServerAddress: UINT64, -}} -pub type PServerInformation = *mut ServerInformation; -DECLARE_HANDLE!(CO_MTA_USAGE_COOKIE, CO_MTA_USAGE_COOKIE__); diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/commctrl.rs cargo-0.37.0/vendor/winapi-0.2.8/src/commctrl.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/commctrl.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/commctrl.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,3578 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//138 -STRUCT!{struct INITCOMMONCONTROLSEX { - dwSize: ::DWORD, - dwICC: ::DWORD, -}} -pub type LPINITCOMMONCONTROLSEX = *mut INITCOMMONCONTROLSEX; -pub const ICC_LISTVIEW_CLASSES: ::DWORD = 0x1; -pub const ICC_TREEVIEW_CLASSES: ::DWORD = 0x2; -pub const ICC_BAR_CLASSES: ::DWORD = 0x4; -pub const ICC_TAB_CLASSES: ::DWORD = 0x8; -pub const ICC_UPDOWN_CLASS: ::DWORD = 0x10; -pub const ICC_PROGRESS_CLASS: ::DWORD = 0x20; -pub const ICC_HOTKEY_CLASS: ::DWORD = 0x40; -pub const ICC_ANIMATE_CLASS: ::DWORD = 0x80; -pub const ICC_WIN95_CLASSES: ::DWORD = 0xFF; -pub const ICC_DATE_CLASSES: ::DWORD = 0x100; -pub const ICC_USEREX_CLASSES: ::DWORD = 0x200; -pub const ICC_COOL_CLASSES: ::DWORD = 0x400; -pub const ICC_INTERNET_CLASSES: ::DWORD = 0x800; -pub const ICC_PAGESCROLLER_CLASS: ::DWORD = 0x1000; -pub const ICC_NATIVEFNTCTL_CLASS: ::DWORD = 0x2000; -pub const ICC_STANDARD_CLASSES: ::DWORD = 0x4000; -pub const ICC_LINK_CLASS: ::DWORD = 0x8000; -pub const ODT_HEADER: ::UINT = 100; -pub const ODT_TAB: ::UINT = 101; -pub const ODT_LISTVIEW: ::UINT = 102; -pub const LVM_FIRST: ::UINT = 0x1000; -pub const TV_FIRST: ::UINT = 0x1100; -pub const HDM_FIRST: ::UINT = 0x1200; -pub const TCM_FIRST: ::UINT = 0x1300; -pub const PGM_FIRST: ::UINT = 0x1400; -pub const ECM_FIRST: ::UINT = 0x1500; -pub const BCM_FIRST: ::UINT = 0x1600; -pub const CBM_FIRST: ::UINT = 0x1700; -pub const CCM_FIRST: ::UINT = 0x2000; -pub const CCM_LAST: ::UINT = CCM_FIRST + 0x200; -pub const CCM_SETBKCOLOR: ::UINT = CCM_FIRST + 1; -STRUCT!{struct COLORSCHEME { - dwSize: ::DWORD, - clrBtnHighlight: ::COLORREF, - clrBtnShadow: ::COLORREF, -}} -pub type LPCOLORSCHEME = *mut COLORSCHEME; -pub const CCM_SETCOLORSCHEME: ::UINT = CCM_FIRST + 2; -pub const CCM_GETCOLORSCHEME: ::UINT = CCM_FIRST + 3; -pub const CCM_GETDROPTARGET: ::UINT = CCM_FIRST + 4; -pub const CCM_SETUNICODEFORMAT: ::UINT = CCM_FIRST + 5; -pub const CCM_GETUNICODEFORMAT: ::UINT = CCM_FIRST + 6; -pub const CCM_SETVERSION: ::UINT = CCM_FIRST + 7; -pub const CCM_GETVERSION: ::UINT = CCM_FIRST + 8; -pub const CCM_SETNOTIFYWINDOW: ::UINT = CCM_FIRST + 9; -pub const CCM_SETWINDOWTHEME: ::UINT = CCM_FIRST + 0xb; -pub const CCM_DPISCALE: ::UINT = CCM_FIRST + 0xc; -pub const INFOTIPSIZE: ::c_int = 1024; -pub const NM_OUTOFMEMORY: ::UINT = (NM_FIRST as ::INT - 1) as ::UINT; -pub const NM_CLICK: ::UINT = (NM_FIRST as ::INT - 2) as ::UINT; -pub const NM_DBLCLK: ::UINT = (NM_FIRST as ::INT - 3) as ::UINT; -pub const NM_RETURN: ::UINT = (NM_FIRST as ::INT - 4) as ::UINT; -pub const NM_RCLICK: ::UINT = (NM_FIRST as ::INT - 5) as ::UINT; -pub const NM_RDBLCLK: ::UINT = (NM_FIRST as ::INT - 6) as ::UINT; -pub const NM_SETFOCUS: ::UINT = (NM_FIRST as ::INT - 7) as ::UINT; -pub const NM_KILLFOCUS: ::UINT = (NM_FIRST as ::INT - 8) as ::UINT; -pub const NM_CUSTOMDRAW: ::UINT = (NM_FIRST as ::INT - 12) as ::UINT; -pub const NM_HOVER: ::UINT = (NM_FIRST as ::INT - 13) as ::UINT; -pub const NM_NCHITTEST: ::UINT = (NM_FIRST as ::INT - 14) as ::UINT; -pub const NM_KEYDOWN: ::UINT = (NM_FIRST as ::INT - 15) as ::UINT; -pub const NM_RELEASEDCAPTURE: ::UINT = (NM_FIRST as ::INT - 16) as ::UINT; -pub const NM_SETCURSOR: ::UINT = (NM_FIRST as ::INT - 17) as ::UINT; -pub const NM_CHAR: ::UINT = (NM_FIRST as ::INT - 18) as ::UINT; -pub const NM_TOOLTIPSCREATED: ::UINT = (NM_FIRST as ::INT - 19) as ::UINT; -pub const NM_LDOWN: ::UINT = (NM_FIRST as ::INT - 20) as ::UINT; -pub const NM_RDOWN: ::UINT = (NM_FIRST as ::INT - 21) as ::UINT; -pub const NM_THEMECHANGED: ::UINT = (NM_FIRST as ::INT - 22) as ::UINT; -pub const NM_FONTCHANGED: ::UINT = (NM_FIRST as ::INT - 23) as ::UINT; -pub const NM_CUSTOMTEXT: ::UINT = (NM_FIRST as ::INT - 24) as ::UINT; -pub const NM_TVSTATEIMAGECHANGING: ::UINT = (NM_FIRST as ::INT - 24) as ::UINT; -STRUCT!{struct NMTOOLTIPSCREATED { - hdr: ::NMHDR, - hwndToolTips: ::HWND, -}} -pub type LPNMTOOLTIPSCREATED = *mut NMTOOLTIPSCREATED; -STRUCT!{struct NMMOUSE { - hdr : ::NMHDR, - dwItemSpec: ::DWORD_PTR, - dwItemData: ::DWORD_PTR, - pt: ::POINT, - dwHitInfo: ::LPARAM, -}} -pub type LPNMMOUSE = *mut NMMOUSE; -pub type NMCLICK = NMMOUSE; -pub type LPNMCLICK = LPNMMOUSE; -STRUCT!{struct NMOBJECTNOTIFY { - hdr: ::NMHDR, - iItem: ::c_int, - piid: *const ::IID, - pObject: *mut ::c_void, - hResult: ::HRESULT, - dwFlags: ::DWORD, -}} -pub type LPNMOBJECTNOTIFY = *mut NMOBJECTNOTIFY; -STRUCT!{struct NMKEY { - hdr: ::NMHDR, - nVKey: ::UINT, - uFlags: ::UINT, -}} -pub type LPNMKEY = *mut NMKEY; -STRUCT!{struct NMCHAR { - hdr: ::NMHDR, - ch: ::UINT, - dwItemPrev: ::DWORD, - dwItemNext: ::DWORD, -}} -pub type LPNMCHAR = *mut NMCHAR; -STRUCT!{struct NMCUSTOMTEXT { - hdr: ::NMHDR, - hDC: ::HDC, - lpString: ::LPCWSTR, - nCount: ::c_int, - lpRect: ::LPRECT, - uFormat: ::UINT, - fLink: ::BOOL, -}} -pub type LPNMCUSTOMTEXT = *mut NMCUSTOMTEXT; -pub const NM_FIRST: ::UINT = 0; -pub const NM_LAST: ::UINT = -99i32 as ::UINT; -pub const LVN_FIRST: ::UINT = -100i32 as ::UINT; -pub const LVN_LAST: ::UINT = -199i32 as ::UINT; -pub const HDN_FIRST: ::UINT = -300i32 as ::UINT; -pub const HDN_LAST: ::UINT = -399i32 as ::UINT; -pub const TVN_FIRST: ::UINT = -400i32 as ::UINT; -pub const TVN_LAST: ::UINT = -499i32 as ::UINT; -pub const TTN_FIRST: ::UINT = -520i32 as ::UINT; -pub const TTN_LAST: ::UINT = -549i32 as ::UINT; -pub const TCN_FIRST: ::UINT = -550i32 as ::UINT; -pub const TCN_LAST: ::UINT = -580i32 as ::UINT; -// pub const CDN_FIRST: ::UINT = 0 - 601; -// pub const CDN_LAST: ::UINT = 0 - 699; -pub const TBN_FIRST: ::UINT = -700i32 as ::UINT; -pub const TBN_LAST: ::UINT = -720i32 as ::UINT; -pub const UDN_FIRST: ::UINT = -721i32 as ::UINT; -pub const UDN_LAST: ::UINT = -729i32 as ::UINT; -pub const DTN_FIRST: ::UINT = -740i32 as ::UINT; -pub const DTN_LAST: ::UINT = -745i32 as ::UINT; -pub const MCN_FIRST: ::UINT = -746i32 as ::UINT; -pub const MCN_LAST: ::UINT = -752i32 as ::UINT; -pub const DTN_FIRST2: ::UINT = -753i32 as ::UINT; -pub const DTN_LAST2: ::UINT = -799i32 as ::UINT; -pub const CBEN_FIRST: ::UINT = -800i32 as ::UINT; -pub const CBEN_LAST: ::UINT = -830i32 as ::UINT; -pub const RBN_FIRST: ::UINT = -831i32 as ::UINT; -pub const RBN_LAST: ::UINT = -859i32 as ::UINT; -pub const IPN_FIRST: ::UINT = -860i32 as ::UINT; -pub const IPN_LAST: ::UINT = -879i32 as ::UINT; -pub const SBN_FIRST: ::UINT = -880i32 as ::UINT; -pub const SBN_LAST: ::UINT = -899i32 as ::UINT; -pub const PGN_FIRST: ::UINT = -900i32 as ::UINT; -pub const PGN_LAST: ::UINT = -950i32 as ::UINT; -pub const WMN_FIRST: ::UINT = -1000i32 as ::UINT; -pub const WMN_LAST: ::UINT = -1200i32 as ::UINT; -pub const BCN_FIRST: ::UINT = -1250i32 as ::UINT; -pub const BCN_LAST: ::UINT = -1350i32 as ::UINT; -pub const TRBN_FIRST: ::UINT = -1501i32 as ::UINT; -pub const TRBN_LAST: ::UINT = -1519i32 as ::UINT; -pub const CDRF_DODEFAULT: ::LRESULT = 0x00000000; -pub const CDRF_NEWFONT: ::LRESULT = 0x00000002; -pub const CDRF_SKIPDEFAULT: ::LRESULT = 0x00000004; -pub const CDRF_DOERASE: ::LRESULT = 0x00000008; -pub const CDRF_SKIPPOSTPAINT: ::LRESULT = 0x00000100; -pub const CDRF_NOTIFYPOSTPAINT: ::LRESULT = 0x00000010; -pub const CDRF_NOTIFYITEMDRAW: ::LRESULT = 0x00000020; -pub const CDRF_NOTIFYSUBITEMDRAW: ::LRESULT = 0x00000020; -pub const CDRF_NOTIFYPOSTERASE: ::LRESULT = 0x00000040; -pub const CDDS_PREPAINT: ::DWORD = 0x00000001; -pub const CDDS_POSTPAINT: ::DWORD = 0x00000002; -pub const CDDS_PREERASE: ::DWORD = 0x00000003; -pub const CDDS_POSTERASE: ::DWORD = 0x00000004; -pub const CDDS_ITEM: ::DWORD = 0x00010000; -pub const CDDS_ITEMPREPAINT: ::DWORD = CDDS_ITEM | CDDS_PREPAINT; -pub const CDDS_ITEMPOSTPAINT: ::DWORD = CDDS_ITEM | CDDS_POSTPAINT; -pub const CDDS_ITEMPREERASE: ::DWORD = CDDS_ITEM | CDDS_PREERASE; -pub const CDDS_ITEMPOSTERASE: ::DWORD = CDDS_ITEM | CDDS_POSTERASE; -pub const CDDS_SUBITEM: ::DWORD = 0x00020000; -pub const CDIS_SELECTED: ::UINT = 0x0001; -pub const CDIS_GRAYED: ::UINT = 0x0002; -pub const CDIS_DISABLED: ::UINT = 0x0004; -pub const CDIS_CHECKED: ::UINT = 0x0008; -pub const CDIS_FOCUS: ::UINT = 0x0010; -pub const CDIS_DEFAULT: ::UINT = 0x0020; -pub const CDIS_HOT: ::UINT = 0x0040; -pub const CDIS_MARKED: ::UINT = 0x0080; -pub const CDIS_INDETERMINATE: ::UINT = 0x0100; -pub const CDIS_SHOWKEYBOARDCUES: ::UINT = 0x0200; -pub const CDIS_NEARHOT: ::UINT = 0x0400; -pub const CDIS_OTHERSIDEHOT: ::UINT = 0x0800; -pub const CDIS_DROPHILITED: ::UINT = 0x1000; -STRUCT!{struct NMCUSTOMDRAW { - hdr: ::NMHDR, - dwDrawStage: ::DWORD, - hdc: ::HDC, - rc: ::RECT, - dwItemSpec: ::DWORD_PTR, - uItemState: ::UINT, - lItemlParam: ::LPARAM, -}} -pub type LPNMCUSTOMDRAW = *mut NMCUSTOMDRAW; -STRUCT!{struct NMTTCUSTOMDRAW { - nmcd: NMCUSTOMDRAW, - uDrawFlags: ::UINT, -}} -pub type LPNMTTCUSTOMDRAW = *mut NMTTCUSTOMDRAW; -STRUCT!{struct NMCUSTOMSPLITRECTINFO { - hdr: ::NMHDR, - rcClient: ::RECT, - rcButton: ::RECT, - rcSplit: ::RECT, -}} -pub type LPNMCUSTOMSPLITRECTINFO = *mut NMCUSTOMSPLITRECTINFO; -pub const NM_GETCUSTOMSPLITRECT: ::UINT = BCN_FIRST + 0x0003; -pub const CLR_NONE: ::DWORD = 0xFFFFFFFF; -pub const CLR_DEFAULT: ::DWORD = 0xFF000000; -pub enum IMAGELIST {} -pub type HIMAGELIST = *mut IMAGELIST; -STRUCT!{struct IMAGELISTDRAWPARAMS { - cbSize: ::DWORD, - himl: HIMAGELIST, - i: ::c_int, - hdcDst: ::HDC, - x: ::c_int, - y: ::c_int, - cx: ::c_int, - cy: ::c_int, - xBitmap: ::c_int, - yBitmap: ::c_int, - rgbBk: ::COLORREF, - rgbFg: ::COLORREF, - fStyle: ::UINT, - dwRop: ::DWORD, - fState: ::DWORD, - Frame: ::DWORD, - crEffect: ::COLORREF, -}} -pub type LPIMAGELISTDRAWPARAMS = *mut IMAGELISTDRAWPARAMS; -pub const ILC_MASK: ::UINT = 0x00000001; -pub const ILC_COLOR: ::UINT = 0x00000000; -pub const ILC_COLORDDB: ::UINT = 0x000000FE; -pub const ILC_COLOR4: ::UINT = 0x00000004; -pub const ILC_COLOR8: ::UINT = 0x00000008; -pub const ILC_COLOR16: ::UINT = 0x00000010; -pub const ILC_COLOR24: ::UINT = 0x00000018; -pub const ILC_COLOR32: ::UINT = 0x00000020; -pub const ILC_PALETTE: ::UINT = 0x00000800; -pub const ILC_MIRROR: ::UINT = 0x00002000; -pub const ILC_PERITEMMIRROR: ::UINT = 0x00008000; -pub const ILC_ORIGINALSIZE: ::UINT = 0x00010000; -pub const ILC_HIGHQUALITYSCALE: ::UINT = 0x00020000; -pub const ILD_NORMAL: ::UINT = 0x00000000; -pub const ILD_TRANSPARENT: ::UINT = 0x00000001; -pub const ILD_MASK: ::UINT = 0x00000010; -pub const ILD_IMAGE: ::UINT = 0x00000020; -pub const ILD_ROP: ::UINT = 0x00000040; -pub const ILD_BLEND25: ::UINT = 0x00000002; -pub const ILD_BLEND50: ::UINT = 0x00000004; -pub const ILD_OVERLAYMASK: ::UINT = 0x00000F00; -#[inline] #[allow(dead_code)] -pub fn INDEXTOOVERLAYMASK(i: ::UINT) -> ::UINT { i << 8 } -pub const ILD_PRESERVEALPHA: ::UINT = 0x00001000; -pub const ILD_SCALE: ::UINT = 0x00002000; -pub const ILD_DPISCALE: ::UINT = 0x00004000; -pub const ILD_ASYNC: ::UINT = 0x00008000; -pub const ILD_SELECTED: ::UINT = ILD_BLEND50; -pub const ILD_FOCUS: ::UINT = ILD_BLEND25; -pub const ILD_BLEND: ::UINT = ILD_BLEND50; -pub const CLR_HILIGHT: ::DWORD = CLR_DEFAULT; -pub const ILS_NORMAL: ::DWORD = 0x00000000; -pub const ILS_GLOW: ::DWORD = 0x00000001; -pub const ILS_SHADOW: ::DWORD = 0x00000002; -pub const ILS_SATURATE: ::DWORD = 0x00000004; -pub const ILS_ALPHA: ::DWORD = 0x00000008; -pub const HBITMAP_CALLBACK: ::HBITMAP = (0-1) as ::HBITMAP; -pub const ILCF_MOVE: ::UINT = 0x00000000; -pub const ILCF_SWAP: ::UINT = 0x00000001; -STRUCT!{struct IMAGEINFO { - hbmImage: ::HBITMAP, - hbmMask: ::HBITMAP, - Unused1: ::c_int, - Unused2: ::c_int, - rcImage: ::RECT, -}} -pub type LPIMAGEINFO = *mut IMAGEINFO; -pub const HDS_HORZ: ::DWORD = 0x0000; -pub const HDS_BUTTONS: ::DWORD = 0x0002; -pub const HDS_HOTTRACK: ::DWORD = 0x0004; -pub const HDS_HIDDEN: ::DWORD = 0x0008; -pub const HDS_DRAGDROP: ::DWORD = 0x0040; -pub const HDS_FULLDRAG: ::DWORD = 0x0080; -pub const HDS_FILTERBAR: ::DWORD = 0x0100; -pub const HDS_FLAT: ::DWORD = 0x0200; -pub const HDS_CHECKBOXES: ::DWORD = 0x0400; -pub const HDS_NOSIZING: ::DWORD = 0x0800; -pub const HDS_OVERFLOW: ::DWORD = 0x1000; -pub const HDFT_ISSTRING: ::UINT = 0x0000; -pub const HDFT_ISNUMBER: ::UINT = 0x0001; -pub const HDFT_ISDATE: ::UINT = 0x0002; -pub const HDFT_HASNOVALUE: ::UINT = 0x8000; -STRUCT!{struct HD_TEXTFILTERA { - pszText: ::LPSTR, - cchTextMax: ::INT, -}} -pub type LPHD_TEXTFILTERA = *mut HD_TEXTFILTERA; -STRUCT!{struct HD_TEXTFILTERW { - pszText: ::LPWSTR, - cchTextMax: ::INT, -}} -pub type LPHD_TEXTFILTERW = *mut HD_TEXTFILTERW; -STRUCT!{struct HDITEMA { - mask: ::UINT, - cxy: ::c_int, - pszText: ::LPSTR, - hbm: ::HBITMAP, - cchTextMax: ::c_int, - fmt: ::c_int, - lParam: ::LPARAM, - iImage: ::c_int, - iOrder: ::c_int, - _type: ::UINT, - pvFilter: *mut ::c_void, - state: ::UINT, -}} -pub type LPHDITEMA = *mut HDITEMA; -STRUCT!{struct HDITEMW { - mask: ::UINT, - cxy: ::c_int, - pszText: ::LPWSTR, - hbm: ::HBITMAP, - cchTextMax: ::c_int, - fmt: ::c_int, - lParam: ::LPARAM, - iImage: ::c_int, - iOrder: ::c_int, - _type: ::UINT, - pvFilter: *mut ::c_void, - state: ::UINT, -}} -pub type LPHDITEMW = *mut HDITEMW; -pub const HDI_WIDTH: ::UINT = 0x0001; -pub const HDI_HEIGHT: ::UINT = HDI_WIDTH; -pub const HDI_TEXT: ::UINT = 0x0002; -pub const HDI_FORMAT: ::UINT = 0x0004; -pub const HDI_LPARAM: ::UINT = 0x0008; -pub const HDI_BITMAP: ::UINT = 0x0010; -pub const HDI_IMAGE: ::UINT = 0x0020; -pub const HDI_DI_SETITEM: ::UINT = 0x0040; -pub const HDI_ORDER: ::UINT = 0x0080; -pub const HDI_FILTER: ::UINT = 0x0100; -pub const HDI_STATE: ::UINT = 0x0200; -pub const HDF_LEFT: ::c_int = 0x0000; -pub const HDF_RIGHT: ::c_int = 0x0001; -pub const HDF_CENTER: ::c_int = 0x0002; -pub const HDF_JUSTIFYMASK: ::c_int = 0x0003; -pub const HDF_RTLREADING: ::c_int = 0x0004; -pub const HDF_BITMAP: ::c_int = 0x2000; -pub const HDF_STRING: ::c_int = 0x4000; -pub const HDF_OWNERDRAW: ::c_int = 0x8000; -pub const HDF_IMAGE: ::c_int = 0x0800; -pub const HDF_BITMAP_ON_RIGHT: ::c_int = 0x1000; -pub const HDF_SORTUP: ::c_int = 0x0400; -pub const HDF_SORTDOWN: ::c_int = 0x0200; -pub const HDF_CHECKBOX: ::c_int = 0x0040; -pub const HDF_CHECKED: ::c_int = 0x0080; -pub const HDF_FIXEDWIDTH: ::c_int = 0x0100; -pub const HDF_SPLITBUTTON: ::c_int = 0x1000000; -pub const HDIS_FOCUSED: ::UINT = 0x00000001; -pub const HDM_GETITEMCOUNT: ::UINT = HDM_FIRST + 0; -pub const HDM_INSERTITEMA: ::UINT = HDM_FIRST + 1; -pub const HDM_INSERTITEMW: ::UINT = HDM_FIRST + 10; -pub const HDM_DELETEITEM: ::UINT = HDM_FIRST + 2; -pub const HDM_GETITEMA: ::UINT = HDM_FIRST + 3; -pub const HDM_GETITEMW: ::UINT = HDM_FIRST + 11; -pub const HDM_SETITEMA: ::UINT = HDM_FIRST + 4; -pub const HDM_SETITEMW: ::UINT = HDM_FIRST + 12; -STRUCT!{struct HDLAYOUT { - prc: *mut ::RECT, - pwpos: *mut ::WINDOWPOS, -}} -pub type LPHDLAYOUT = *mut HDLAYOUT; -pub const HDM_LAYOUT: ::UINT = HDM_FIRST + 5; -pub const HHT_NOWHERE: ::UINT = 0x0001; -pub const HHT_ONHEADER: ::UINT = 0x0002; -pub const HHT_ONDIVIDER: ::UINT = 0x0004; -pub const HHT_ONDIVOPEN: ::UINT = 0x0008; -pub const HHT_ONFILTER: ::UINT = 0x0010; -pub const HHT_ONFILTERBUTTON: ::UINT = 0x0020; -pub const HHT_ABOVE: ::UINT = 0x0100; -pub const HHT_BELOW: ::UINT = 0x0200; -pub const HHT_TORIGHT: ::UINT = 0x0400; -pub const HHT_TOLEFT: ::UINT = 0x0800; -pub const HHT_ONITEMSTATEICON: ::UINT = 0x1000; -pub const HHT_ONDROPDOWN: ::UINT = 0x2000; -pub const HHT_ONOVERFLOW: ::UINT = 0x4000; -STRUCT!{struct HDHITTESTINFO { - pt: ::POINT, - flags: ::UINT, - iItem: ::c_int, -}} -pub type LPHDHITTESTINFO = *mut HDHITTESTINFO; -pub const HDSIL_NORMAL: ::WPARAM = 0; -pub const HDSIL_STATE: ::WPARAM = 1; -pub const HDM_HITTEST: ::UINT = HDM_FIRST + 6; -pub const HDM_GETITEMRECT: ::UINT = HDM_FIRST + 7; -pub const HDM_SETIMAGELIST: ::UINT = HDM_FIRST + 8; -pub const HDM_GETIMAGELIST: ::UINT = HDM_FIRST + 9; -pub const HDM_ORDERTOINDEX: ::UINT = HDM_FIRST + 15; -pub const HDM_CREATEDRAGIMAGE: ::UINT = HDM_FIRST + 16; -pub const HDM_GETORDERARRAY: ::UINT = HDM_FIRST + 17; -pub const HDM_SETORDERARRAY: ::UINT = HDM_FIRST + 18; -pub const HDM_SETHOTDIVIDER: ::UINT = HDM_FIRST + 19; -pub const HDM_SETBITMAPMARGIN: ::UINT = HDM_FIRST + 20; -pub const HDM_GETBITMAPMARGIN: ::UINT = HDM_FIRST + 21; -pub const HDM_SETFILTERCHANGETIMEOUT: ::UINT = HDM_FIRST + 22; -pub const HDM_EDITFILTER: ::UINT = HDM_FIRST + 23; -pub const HDM_CLEARFILTER: ::UINT = HDM_FIRST + 24; -pub const HDM_GETITEMDROPDOWNRECT: ::UINT = HDM_FIRST + 25; -pub const HDM_GETOVERFLOWRECT: ::UINT = HDM_FIRST + 26; -pub const HDM_GETFOCUSEDITEM: ::UINT = HDM_FIRST + 27; -pub const HDM_SETFOCUSEDITEM: ::UINT = HDM_FIRST + 28; -pub const HDN_ITEMCHANGINGA: ::UINT = HDN_FIRST-0; -pub const HDN_ITEMCHANGINGW: ::UINT = HDN_FIRST-20; -pub const HDN_ITEMCHANGEDA: ::UINT = HDN_FIRST-1; -pub const HDN_ITEMCHANGEDW: ::UINT = HDN_FIRST-21; -pub const HDN_ITEMCLICKA: ::UINT = HDN_FIRST-2; -pub const HDN_ITEMCLICKW: ::UINT = HDN_FIRST-22; -pub const HDN_ITEMDBLCLICKA: ::UINT = HDN_FIRST-3; -pub const HDN_ITEMDBLCLICKW: ::UINT = HDN_FIRST-23; -pub const HDN_DIVIDERDBLCLICKA: ::UINT = HDN_FIRST-5; -pub const HDN_DIVIDERDBLCLICKW: ::UINT = HDN_FIRST-25; -pub const HDN_BEGINTRACKA: ::UINT = HDN_FIRST-6; -pub const HDN_BEGINTRACKW: ::UINT = HDN_FIRST-26; -pub const HDN_ENDTRACKA: ::UINT = HDN_FIRST-7; -pub const HDN_ENDTRACKW: ::UINT = HDN_FIRST-27; -pub const HDN_TRACKA: ::UINT = HDN_FIRST-8; -pub const HDN_TRACKW: ::UINT = HDN_FIRST-28; -pub const HDN_GETDISPINFOA: ::UINT = HDN_FIRST-9; -pub const HDN_GETDISPINFOW: ::UINT = HDN_FIRST-29; -pub const HDN_BEGINDRAG: ::UINT = HDN_FIRST-10; -pub const HDN_ENDDRAG: ::UINT = HDN_FIRST-11; -pub const HDN_FILTERCHANGE: ::UINT = HDN_FIRST-12; -pub const HDN_FILTERBTNCLICK: ::UINT = HDN_FIRST-13; -pub const HDN_BEGINFILTEREDIT: ::UINT = HDN_FIRST-14; -pub const HDN_ENDFILTEREDIT: ::UINT = HDN_FIRST-15; -pub const HDN_ITEMSTATEICONCLICK: ::UINT = HDN_FIRST-16; -pub const HDN_ITEMKEYDOWN: ::UINT = HDN_FIRST-17; -pub const HDN_DROPDOWN: ::UINT = HDN_FIRST-18; -pub const HDN_OVERFLOWCLICK: ::UINT = HDN_FIRST-19; -STRUCT!{struct NMHEADERA { - hdr: ::NMHDR, - iItem: ::c_int, - iButton: ::c_int, - pitem: *mut HDITEMA, -}} -pub type LPNMHEADERA = *mut NMHEADERA; -STRUCT!{struct NMHEADERW { - hdr: ::NMHDR, - iItem: ::c_int, - iButton: ::c_int, - pitem: *mut HDITEMW, -}} -pub type LPNMHEADERW = *mut NMHEADERW; -STRUCT!{struct NMHDDISPINFOW { - hdr: ::NMHDR, - iItem: ::c_int, - mask: ::UINT, - pszText: ::LPWSTR, - cchTextMax: ::c_int, - iImage: ::c_int, - lParam: ::LPARAM, -}} -pub type LPNMHDDISPINFOW = *mut NMHDDISPINFOW; -STRUCT!{struct NMHDDISPINFOA { - hdr: ::NMHDR, - iItem: ::c_int, - mask: ::UINT, - pszText: ::LPSTR, - cchTextMax: ::c_int, - iImage: ::c_int, - lParam: ::LPARAM, -}} -pub type LPNMHDDISPINFOA = *mut NMHDDISPINFOA; -STRUCT!{struct NMHDFILTERBTNCLICK { - hdr: ::NMHDR, - iItem: ::INT, - rc: ::RECT, -}} -pub type LPNMHDFILTERBTNCLICK = *mut NMHDFILTERBTNCLICK; -#[cfg(target_arch="x86")] -STRUCT!{struct TBBUTTON { - iBitmap: ::c_int, - idCommand: ::c_int, - fsState: ::BYTE, - fsStyle: ::BYTE, - bReserved: [::BYTE; 2], - dwData: ::DWORD_PTR, - iString: ::INT_PTR, -}} -#[cfg(target_arch="x86_64")] -STRUCT!{struct TBBUTTON { - iBitmap: ::c_int, - idCommand: ::c_int, - fsState: ::BYTE, - fsStyle: ::BYTE, - bReserved: [::BYTE; 6], - dwData: ::DWORD_PTR, - iString: ::INT_PTR, -}} -pub type PTBBUTTON = *mut TBBUTTON; -pub type LPTBBUTTON = *mut TBBUTTON; -pub type LPCTBBUTTON = *const TBBUTTON; -STRUCT!{struct COLORMAP { - from: ::COLORREF, - to: ::COLORREF, -}} -pub type LPCOLORMAP = *mut COLORMAP; -pub const CMB_MASKED: ::UINT = 0x02; -pub const TBSTATE_CHECKED: ::BYTE = 0x01; -pub const TBSTATE_PRESSED: ::BYTE = 0x02; -pub const TBSTATE_ENABLED: ::BYTE = 0x04; -pub const TBSTATE_HIDDEN: ::BYTE = 0x08; -pub const TBSTATE_INDETERMINATE: ::BYTE = 0x10; -pub const TBSTATE_WRAP: ::BYTE = 0x20; -pub const TBSTATE_ELLIPSES: ::BYTE = 0x40; -pub const TBSTATE_MARKED: ::BYTE = 0x80; -pub const TBSTYLE_BUTTON: ::DWORD = 0x0000; -pub const TBSTYLE_SEP: ::DWORD = 0x0001; -pub const TBSTYLE_CHECK: ::DWORD = 0x0002; -pub const TBSTYLE_GROUP: ::DWORD = 0x0004; -pub const TBSTYLE_CHECKGROUP: ::DWORD = TBSTYLE_GROUP | TBSTYLE_CHECK; -pub const TBSTYLE_DROPDOWN: ::DWORD = 0x0008; -pub const TBSTYLE_AUTOSIZE: ::DWORD = 0x0010; -pub const TBSTYLE_NOPREFIX: ::DWORD = 0x0020; -pub const TBSTYLE_TOOLTIPS: ::DWORD = 0x0100; -pub const TBSTYLE_WRAPABLE: ::DWORD = 0x0200; -pub const TBSTYLE_ALTDRAG: ::DWORD = 0x0400; -pub const TBSTYLE_FLAT: ::DWORD = 0x0800; -pub const TBSTYLE_LIST: ::DWORD = 0x1000; -pub const TBSTYLE_CUSTOMERASE: ::DWORD = 0x2000; -pub const TBSTYLE_REGISTERDROP: ::DWORD = 0x4000; -pub const TBSTYLE_TRANSPARENT: ::DWORD = 0x8000; -pub const TBSTYLE_EX_DRAWDDARROWS: ::DWORD = 0x00000001; -pub const BTNS_BUTTON: ::DWORD = TBSTYLE_BUTTON; -pub const BTNS_SEP: ::DWORD = TBSTYLE_SEP; -pub const BTNS_CHECK: ::DWORD = TBSTYLE_CHECK; -pub const BTNS_GROUP: ::DWORD = TBSTYLE_GROUP; -pub const BTNS_CHECKGROUP: ::DWORD = TBSTYLE_CHECKGROUP; -pub const BTNS_DROPDOWN: ::DWORD = TBSTYLE_DROPDOWN; -pub const BTNS_AUTOSIZE: ::DWORD = TBSTYLE_AUTOSIZE; -pub const BTNS_NOPREFIX: ::DWORD = TBSTYLE_NOPREFIX; -pub const BTNS_SHOWTEXT: ::DWORD = 0x0040; -pub const BTNS_WHOLEDROPDOWN: ::DWORD = 0x0080; -pub const TBSTYLE_EX_MIXEDBUTTONS: ::DWORD = 0x00000008; -pub const TBSTYLE_EX_HIDECLIPPEDBUTTONS: ::DWORD = 0x00000010; -pub const TBSTYLE_EX_MULTICOLUMN: ::DWORD = 0x00000002; -pub const TBSTYLE_EX_VERTICAL: ::DWORD = 0x00000004; -pub const TBSTYLE_EX_DOUBLEBUFFER: ::DWORD = 0x00000080; -STRUCT!{struct NMTBCUSTOMDRAW { - nmcd: NMCUSTOMDRAW, - hbrMonoDither: ::HBRUSH, - hbrLines: ::HBRUSH, - hpenLines: ::HPEN, - clrText: ::COLORREF, - clrMark: ::COLORREF, - clrTextHighlight: ::COLORREF, - clrBtnFace: ::COLORREF, - clrBtnHighlight: ::COLORREF, - clrHighlightHotTrack: ::COLORREF, - rcText: ::RECT, - nStringBkMode: ::c_int, - nHLStringBkMode: ::c_int, - iListGap: ::c_int, -}} -pub type LPNMTBCUSTOMDRAW = *mut NMTBCUSTOMDRAW; -pub const TBCDRF_NOEDGES: ::LRESULT = 0x00010000; -pub const TBCDRF_HILITEHOTTRACK: ::LRESULT = 0x00020000; -pub const TBCDRF_NOOFFSET: ::LRESULT = 0x00040000; -pub const TBCDRF_NOMARK: ::LRESULT = 0x00080000; -pub const TBCDRF_NOETCHEDEFFECT: ::LRESULT = 0x00100000; -pub const TBCDRF_BLENDICON: ::LRESULT = 0x00200000; -pub const TBCDRF_NOBACKGROUND: ::LRESULT = 0x00400000; -pub const TBCDRF_USECDCOLORS: ::LRESULT = 0x00800000; -pub const TB_ENABLEBUTTON: ::UINT = ::WM_USER + 1; -pub const TB_CHECKBUTTON: ::UINT = ::WM_USER + 2; -pub const TB_PRESSBUTTON: ::UINT = ::WM_USER + 3; -pub const TB_HIDEBUTTON: ::UINT = ::WM_USER + 4; -pub const TB_INDETERMINATE: ::UINT = ::WM_USER + 5; -pub const TB_MARKBUTTON: ::UINT = ::WM_USER + 6; -pub const TB_ISBUTTONENABLED: ::UINT = ::WM_USER + 9; -pub const TB_ISBUTTONCHECKED: ::UINT = ::WM_USER + 10; -pub const TB_ISBUTTONPRESSED: ::UINT = ::WM_USER + 11; -pub const TB_ISBUTTONHIDDEN: ::UINT = ::WM_USER + 12; -pub const TB_ISBUTTONINDETERMINATE : ::UINT = ::WM_USER + 13; -pub const TB_ISBUTTONHIGHLIGHTED: ::UINT = ::WM_USER + 14; -pub const TB_SETSTATE: ::UINT = ::WM_USER + 17; -pub const TB_GETSTATE: ::UINT = ::WM_USER + 18; -pub const TB_ADDBITMAP: ::UINT = ::WM_USER + 19; -STRUCT!{struct TBADDBITMAP { - hInst: ::HINSTANCE, - nID: ::UINT_PTR, -}} -pub type LPTBADDBITMAP = *mut TBADDBITMAP; -pub const HINST_COMMCTRL: ::HINSTANCE = (0 - 1) as ::HINSTANCE; -pub const IDB_STD_SMALL_COLOR: ::WPARAM = 0; -pub const IDB_STD_LARGE_COLOR: ::WPARAM = 1; -pub const IDB_VIEW_SMALL_COLOR: ::WPARAM = 4; -pub const IDB_VIEW_LARGE_COLOR: ::WPARAM = 5; -pub const IDB_HIST_SMALL_COLOR: ::WPARAM = 8; -pub const IDB_HIST_LARGE_COLOR: ::WPARAM = 9; -pub const IDB_HIST_NORMAL: ::WPARAM = 12; -pub const IDB_HIST_HOT: ::WPARAM = 13; -pub const IDB_HIST_DISABLED: ::WPARAM = 14; -pub const IDB_HIST_PRESSED: ::WPARAM = 15; -pub const STD_CUT: ::c_int = 0; -pub const STD_COPY: ::c_int = 1; -pub const STD_PASTE: ::c_int = 2; -pub const STD_UNDO: ::c_int = 3; -pub const STD_REDOW: ::c_int = 4; -pub const STD_DELETE: ::c_int = 5; -pub const STD_FILENEW: ::c_int = 6; -pub const STD_FILEOPEN: ::c_int = 7; -pub const STD_FILESAVE: ::c_int = 8; -pub const STD_PRINTPRE: ::c_int = 9; -pub const STD_PROPERTIES: ::c_int = 10; -pub const STD_HELP: ::c_int = 11; -pub const STD_FIND: ::c_int = 12; -pub const STD_REPLACE: ::c_int = 13; -pub const STD_PRINT: ::c_int = 14; -pub const VIEW_LARGEICONS: ::c_int = 0; -pub const VIEW_SMALLICONS: ::c_int = 1; -pub const VIEW_LIST: ::c_int = 2; -pub const VIEW_DETAILS: ::c_int = 3; -pub const VIEW_SORTNAME: ::c_int = 4; -pub const VIEW_SORTSIZE: ::c_int = 5; -pub const VIEW_SORTDATE: ::c_int = 6; -pub const VIEW_SORTTYPE: ::c_int = 7; -pub const VIEW_PARENTFOLDER: ::c_int = 8; -pub const VIEW_NETCONNECT: ::c_int = 9; -pub const VIEW_NETDISCONNECT: ::c_int = 10; -pub const VIEW_NEWFOLDER: ::c_int = 11; -pub const VIEW_VIEWMENU: ::c_int = 12; -pub const HIST_BACK: ::c_int = 0; -pub const HIST_FORWARD: ::c_int = 1; -pub const HIST_FAVORITES: ::c_int = 2; -pub const HIST_ADDTOFAVORITES: ::c_int = 3; -pub const HIST_VIEWTREE: ::c_int = 4; -pub const TB_ADDBUTTONSA: ::UINT = ::WM_USER + 20; -pub const TB_INSERTBUTTONA: ::UINT = ::WM_USER + 21; -pub const TB_DELETEBUTTON: ::UINT = ::WM_USER + 22; -pub const TB_GETBUTTON: ::UINT = ::WM_USER + 23; -pub const TB_BUTTONCOUNT: ::UINT = ::WM_USER + 24; -pub const TB_COMMANDTOINDEX: ::UINT = ::WM_USER + 25; -STRUCT!{struct TBSAVEPARAMSA { - hkr: ::HKEY, - pszSubKey: ::LPCSTR, - pszValueName: ::LPCSTR, -}} -pub type LPTBSAVEPARAMSA = *mut TBSAVEPARAMSA; -STRUCT!{struct TBSAVEPARAMSW { - hkr: ::HKEY, - pszSubKey: ::LPCWSTR, - pszValueName: ::LPCWSTR, -}} -pub type LPTBSAVEPARAMSW = *mut TBSAVEPARAMSW; -pub const TB_SAVERESTOREA: ::UINT = ::WM_USER + 26; -pub const TB_SAVERESTOREW: ::UINT = ::WM_USER + 76; -pub const TB_CUSTOMIZE: ::UINT = ::WM_USER + 27; -pub const TB_ADDSTRINGA: ::UINT = ::WM_USER + 28; -pub const TB_ADDSTRINGW: ::UINT = ::WM_USER + 77; -pub const TB_GETITEMRECT: ::UINT = ::WM_USER + 29; -pub const TB_BUTTONSTRUCTSIZE: ::UINT = ::WM_USER + 30; -pub const TB_SETBUTTONSIZE: ::UINT = ::WM_USER + 31; -pub const TB_SETBITMAPSIZE: ::UINT = ::WM_USER + 32; -pub const TB_AUTOSIZE: ::UINT = ::WM_USER + 33; -pub const TB_GETTOOLTIPS: ::UINT = ::WM_USER + 35; -pub const TB_SETTOOLTIPS: ::UINT = ::WM_USER + 36; -pub const TB_SETPARENT: ::UINT = ::WM_USER + 37; -pub const TB_SETROWS: ::UINT = ::WM_USER + 39; -pub const TB_GETROWS: ::UINT = ::WM_USER + 40; -pub const TB_SETCMDID: ::UINT = ::WM_USER + 42; -pub const TB_CHANGEBITMAP: ::UINT = ::WM_USER + 43; -pub const TB_GETBITMAP: ::UINT = ::WM_USER + 44; -pub const TB_GETBUTTONTEXTA: ::UINT = ::WM_USER + 45; -pub const TB_GETBUTTONTEXTW: ::UINT = ::WM_USER + 75; -pub const TB_REPLACEBITMAP: ::UINT = ::WM_USER + 46; -pub const TB_SETINDENT: ::UINT = ::WM_USER + 47; -pub const TB_SETIMAGELIST: ::UINT = ::WM_USER + 48; -pub const TB_GETIMAGELIST: ::UINT = ::WM_USER + 49; -pub const TB_LOADIMAGES: ::UINT = ::WM_USER + 50; -pub const TB_GETRECT: ::UINT = ::WM_USER + 51; -pub const TB_SETHOTIMAGELIST: ::UINT = ::WM_USER + 52; -pub const TB_GETHOTIMAGELIST: ::UINT = ::WM_USER + 53; -pub const TB_SETDISABLEDIMAGELIST: ::UINT = ::WM_USER + 54; -pub const TB_GETDISABLEDIMAGELIST: ::UINT = ::WM_USER + 55; -pub const TB_SETSTYLE: ::UINT = ::WM_USER + 56; -pub const TB_GETSTYLE: ::UINT = ::WM_USER + 57; -pub const TB_GETBUTTONSIZE: ::UINT = ::WM_USER + 58; -pub const TB_SETBUTTONWIDTH: ::UINT = ::WM_USER + 59; -pub const TB_SETMAXTEXTROWS: ::UINT = ::WM_USER + 60; -pub const TB_GETTEXTROWS: ::UINT = ::WM_USER + 61; -pub const TB_GETOBJECT: ::UINT = ::WM_USER + 62; -pub const TB_GETHOTITEM: ::UINT = ::WM_USER + 71; -pub const TB_SETHOTITEM: ::UINT = ::WM_USER + 72; -pub const TB_SETANCHORHIGHLIGHT: ::UINT = ::WM_USER + 73; -pub const TB_GETANCHORHIGHLIGHT: ::UINT = ::WM_USER + 74; -pub const TB_MAPACCELERATORA: ::UINT = ::WM_USER + 78; -STRUCT!{struct TBINSERTMARK { - iButton: ::c_int, - dwFlags: ::DWORD, -}} -pub type LPTBINSERTMARK = *mut TBINSERTMARK; -pub const TBIMHT_AFTER: ::DWORD = 0x00000001; -pub const TBIMHT_BACKGROUND: ::DWORD = 0x00000002; -pub const TB_GETINSERTMARK: ::UINT = ::WM_USER + 79; -pub const TB_SETINSERTMARK: ::UINT = ::WM_USER + 80; -pub const TB_INSERTMARKHITTEST: ::UINT = ::WM_USER + 81; -pub const TB_MOVEBUTTON: ::UINT = ::WM_USER + 82; -pub const TB_GETMAXSIZE: ::UINT = ::WM_USER + 83; -pub const TB_SETEXTENDEDSTYLE: ::UINT = ::WM_USER + 84; -pub const TB_GETEXTENDEDSTYLE: ::UINT = ::WM_USER + 85; -pub const TB_GETPADDING: ::UINT = ::WM_USER + 86; -pub const TB_SETPADDING: ::UINT = ::WM_USER + 87; -pub const TB_SETINSERTMARKCOLOR: ::UINT = ::WM_USER + 88; -pub const TB_GETINSERTMARKCOLOR: ::UINT = ::WM_USER + 89; -pub const TB_SETCOLORSCHEME: ::UINT = CCM_SETCOLORSCHEME; -pub const TB_GETCOLORSCHEME: ::UINT = CCM_GETCOLORSCHEME; -pub const TB_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; -pub const TB_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; -pub const TB_MAPACCELERATORW: ::UINT = ::WM_USER + 90; -STRUCT!{struct TBREPLACEBITMAP { - hInstOld: ::HINSTANCE, - nIDOld: ::UINT_PTR, - hInstNew: ::HINSTANCE, - nIDNew: ::UINT_PTR, - nButtons: ::c_int, -}} -pub type LPTBREPLACEBITMAP = *mut TBREPLACEBITMAP; -pub const TBBF_LARGE: ::DWORD = 0x0001; -pub const TB_GETBITMAPFLAGS: ::UINT = ::WM_USER + 41; -pub const TBIF_IMAGE: ::DWORD = 0x00000001; -pub const TBIF_TEXT: ::DWORD = 0x00000002; -pub const TBIF_STATE: ::DWORD = 0x00000004; -pub const TBIF_STYLE: ::DWORD = 0x00000008; -pub const TBIF_LPARAM: ::DWORD = 0x00000010; -pub const TBIF_COMMAND: ::DWORD = 0x00000020; -pub const TBIF_SIZE: ::DWORD = 0x00000040; -pub const TBIF_BYINDEX: ::DWORD = 0x80000000; -STRUCT!{struct TBBUTTONINFOA { - cbSize: ::UINT, - dwMask: ::DWORD, - idCommand: ::c_int, - iImage: ::c_int, - fsState: ::BYTE, - fsStyle: ::BYTE, - cx: ::WORD, - lParam: ::DWORD_PTR, - pszText: ::LPSTR, - cchText: ::c_int, -}} -pub type LPTBBUTTONINFOA = *mut TBBUTTONINFOA; -STRUCT!{struct TBBUTTONINFOW { - cbSize: ::UINT, - dwMask: ::DWORD, - idCommand: ::c_int, - iImage: ::c_int, - fsState: ::BYTE, - fsStyle: ::BYTE, - cx: ::WORD, - lParam: ::DWORD_PTR, - pszText: ::LPWSTR, - cchText: ::c_int, -}} -pub type LPTBBUTTONINFOW = *mut TBBUTTONINFOW; -pub const TB_GETBUTTONINFOW: ::UINT = ::WM_USER + 63; -pub const TB_SETBUTTONINFOW: ::UINT = ::WM_USER + 64; -pub const TB_GETBUTTONINFOA: ::UINT = ::WM_USER + 65; -pub const TB_SETBUTTONINFOA: ::UINT = ::WM_USER + 66; -pub const TB_INSERTBUTTONW: ::UINT = ::WM_USER + 67; -pub const TB_ADDBUTTONSW: ::UINT = ::WM_USER + 68; -pub const TB_HITTEST: ::UINT = ::WM_USER + 69; -pub const TB_SETDRAWTEXTFLAGS: ::UINT = ::WM_USER + 70; -pub const TB_GETSTRINGW: ::UINT = ::WM_USER + 91; -pub const TB_GETSTRINGA: ::UINT = ::WM_USER + 92; -pub const TB_SETBOUNDINGSIZE: ::UINT = ::WM_USER + 93; -pub const TB_SETHOTITEM2: ::UINT = ::WM_USER + 94; -pub const TB_HASACCELERATOR: ::UINT = ::WM_USER + 95; -pub const TB_SETLISTGAP: ::UINT = ::WM_USER + 96; -pub const TB_GETIMAGELISTCOUNT: ::UINT = ::WM_USER + 98; -pub const TB_GETIDEALSIZE: ::UINT = ::WM_USER + 99; -pub const TBMF_PAD: ::DWORD = 0x00000001; -pub const TBMF_BARPAD: ::DWORD = 0x00000002; -pub const TBMF_BUTTONSPACING: ::DWORD = 0x00000004; -STRUCT!{struct TBMETRICS { - cbSize: ::UINT, - dwMask: ::DWORD, - cxPad: ::c_int, - cyPad: ::c_int, - cxBarPad: ::c_int, - cyBarPad: ::c_int, - cxButtonSpacing: ::c_int, - cyButtonSpacing: ::c_int, -}} -pub type LPTBMETRICS = *mut TBMETRICS; -pub const TB_GETMETRICS: ::UINT = ::WM_USER + 101; -pub const TB_SETMETRICS: ::UINT = ::WM_USER + 102; -pub const TB_GETITEMDROPDOWNRECT: ::UINT = ::WM_USER + 103; -pub const TB_SETPRESSEDIMAGELIST: ::UINT = ::WM_USER + 104; -pub const TB_GETPRESSEDIMAGELIST: ::UINT = ::WM_USER + 105; -pub const TB_SETWINDOWTHEME: ::UINT = CCM_SETWINDOWTHEME; -pub const TBN_GETBUTTONINFOA: ::UINT = TBN_FIRST - 0; -pub const TBN_BEGINDRAG: ::UINT = TBN_FIRST - 1; -pub const TBN_ENDDRAG: ::UINT = TBN_FIRST - 2; -pub const TBN_BEGINADJUST: ::UINT = TBN_FIRST - 3; -pub const TBN_ENDADJUST: ::UINT = TBN_FIRST - 4; -pub const TBN_RESET: ::UINT = TBN_FIRST - 5; -pub const TBN_QUERYINSERT: ::UINT = TBN_FIRST - 6; -pub const TBN_QUERYDELETE: ::UINT = TBN_FIRST - 7; -pub const TBN_TOOLBARCHANGE: ::UINT = TBN_FIRST - 8; -pub const TBN_CUSTHELP: ::UINT = TBN_FIRST - 9; -pub const TBN_DROPDOWN: ::UINT = TBN_FIRST - 10; -pub const TBN_GETOBJECT: ::UINT = TBN_FIRST - 12; -STRUCT!{struct NMTBHOTITEM { - hdr: ::NMHDR, - idOld: ::c_int, - idNew: ::c_int, - dwFlags: ::DWORD, -}} -pub type LPNMTBHOTITEM = *mut NMTBHOTITEM; -pub const HICF_OTHER: ::DWORD = 0x00000000; -pub const HICF_MOUSE: ::DWORD = 0x00000001; -pub const HICF_ARROWKEYS: ::DWORD = 0x00000002; -pub const HICF_ACCELERATOR: ::DWORD = 0x00000004; -pub const HICF_DUPACCEL: ::DWORD = 0x00000008; -pub const HICF_ENTERING: ::DWORD = 0x00000010; -pub const HICF_LEAVING: ::DWORD = 0x00000020; -pub const HICF_RESELECT: ::DWORD = 0x00000040; -pub const HICF_LMOUSE: ::DWORD = 0x00000080; -pub const HICF_TOGGLEDROPDOWN: ::DWORD = 0x00000100; -pub const TBN_HOTITEMCHANGE: ::UINT = TBN_FIRST - 13; -pub const TBN_DRAGOUT: ::UINT = TBN_FIRST - 14; -pub const TBN_DELETINGBUTTON: ::UINT = TBN_FIRST - 15; -pub const TBN_GETDISPINFOA: ::UINT = TBN_FIRST - 16; -pub const TBN_GETDISPINFOW: ::UINT = TBN_FIRST - 17; -pub const TBN_GETINFOTIPA: ::UINT = TBN_FIRST - 18; -pub const TBN_GETINFOTIPW: ::UINT = TBN_FIRST - 19; -pub const TBN_GETBUTTONINFOW: ::UINT = TBN_FIRST - 20; -pub const TBN_RESTORE: ::UINT = TBN_FIRST - 21; -pub const TBN_SAVE: ::UINT = TBN_FIRST - 22; -pub const TBN_INITCUSTOMIZE: ::UINT = TBN_FIRST - 23; -pub const TBN_WRAPHOTITEM: ::UINT = TBN_FIRST - 24; -pub const TBN_DUPACCELERATOR: ::UINT = TBN_FIRST - 25; -pub const TBN_WRAPACCELERATOR: ::UINT = TBN_FIRST - 26; -pub const TBN_DRAGOVER: ::UINT = TBN_FIRST - 27; -pub const TBN_MAPACCELERATOR: ::UINT = TBN_FIRST - 28; -pub const TBNRF_HIDEHELP: ::LRESULT = 0x00000001; -pub const TBNRF_ENDCUSTOMIZE: ::LRESULT = 0x00000002; -STRUCT!{struct NMTBSAVE { - hdr: ::NMHDR, - pData: *mut ::DWORD, - pCurrent: *mut ::DWORD, - cbData: ::UINT, - iItem: ::c_int, - cButtons: ::c_int, - tbButton: TBBUTTON, -}} -pub type LPNMTBSAVE = *mut NMTBSAVE; -STRUCT!{struct NMTBRESTORE { - hdr: ::NMHDR, - pData: *mut ::DWORD, - pCurrent: *mut ::DWORD, - cbData: ::UINT, - iItem: ::c_int, - cButtons: ::c_int, - cbBytesPerRecord: ::c_int, - tbButton: TBBUTTON, -}} -pub type LPNMTBRESTORE = *mut NMTBRESTORE; -STRUCT!{struct NMTBGETINFOTIPA { - hdr: ::NMHDR, - pszText: ::LPSTR, - cchTextMax: ::c_int, - iItem: ::c_int, - lParal: ::LPARAM, -}} -pub type LPNMTBGETINFOTIPA = *mut NMTBGETINFOTIPA; -STRUCT!{struct NMTBGETINFOTIPW { - hdr: ::NMHDR, - pszText: ::LPWSTR, - cchTextMax: ::c_int, - iItem: ::c_int, - lParal: ::LPARAM, -}} -pub type LPNMTBGETINFOTIPW = *mut NMTBGETINFOTIPW; -pub const TBNF_IMAGE: ::DWORD = 0x00000001; -pub const TBNF_TEXT: ::DWORD = 0x00000002; -pub const TBNF_DI_SETITEM: ::DWORD = 0x10000000; -STRUCT!{struct NMTBDISPINFOA { - hdr: ::NMHDR, - dwMask: ::DWORD, - idCommand: ::c_int, - lParam: ::DWORD_PTR, - iImage: ::c_int, - pszText: ::LPSTR, - cchText: ::c_int, -}} -pub type LPNMTBDISPINFOA = *mut NMTBDISPINFOA; -STRUCT!{struct NMTBDISPINFOW { - hdr: ::NMHDR, - dwMask: ::DWORD, - idCommand: ::c_int, - lParam: ::DWORD_PTR, - iImage: ::c_int, - pszText: ::LPWSTR, - cchText: ::c_int, -}} -pub type LPNMTBDISPINFOW = *mut NMTBDISPINFOW; -pub const TBDDRET_DEFAULT: ::LRESULT = 0; -pub const TBDDRET_NODEFAULT: ::LRESULT = 1; -pub const TBDDRET_TREATPRESSED: ::LRESULT = 2; -pub type TBNOTIFYA = NMTOOLBARA; -pub type TBNOTIFYW = NMTOOLBARW; -pub type LPTBNOTIFYA = LPNMTOOLBARA; -pub type LPTBNOTIFYW = LPNMTOOLBARW; -STRUCT!{struct NMTOOLBARA { - hdr: ::NMHDR, - iItem: ::c_int, - tbButton: TBBUTTON, - cchText: ::c_int, - pszText: ::LPSTR, - rcButton: ::RECT, -}} -pub type LPNMTOOLBARA = *mut NMTOOLBARA; -STRUCT!{struct NMTOOLBARW { - hdr: ::NMHDR, - iItem: ::c_int, - tbButton: TBBUTTON, - cchText: ::c_int, - pszText: ::LPWSTR, - rcButton: ::RECT, -}} -pub type LPNMTOOLBARW = *mut NMTOOLBARW; -pub const RBIM_IMAGELIST: ::UINT = 0x00000001; -pub const RBS_TOOLTIPS: ::DWORD = 0x00000100; -pub const RBS_VARHEIGHT: ::DWORD = 0x00000200; -pub const RBS_BANDBORDERS: ::DWORD = 0x00000400; -pub const RBS_FIXEDORDER: ::DWORD = 0x00000800; -pub const RBS_REGISTERDROP: ::DWORD = 0x00001000; -pub const RBS_AUTOSIZE: ::DWORD = 0x00002000; -pub const RBS_VERTICALGRIPPER: ::DWORD = 0x00004000; -pub const RBS_DBLCLKTOGGLE: ::DWORD = 0x00008000; -STRUCT!{struct REBARINFO { - cbSize: ::UINT, - fMask: ::UINT, - himl: HIMAGELIST, -}} -pub type LPREBARINFO = *mut REBARINFO; -pub const RBBS_BREAK: ::UINT = 0x00000001; -pub const RBBS_FIXEDSIZE: ::UINT = 0x00000002; -pub const RBBS_CHILDEDGE: ::UINT = 0x00000004; -pub const RBBS_HIDDEN: ::UINT = 0x00000008; -pub const RBBS_NOVERT: ::UINT = 0x00000010; -pub const RBBS_FIXEDBMP: ::UINT = 0x00000020; -pub const RBBS_VARIABLEHEIGHT: ::UINT = 0x00000040; -pub const RBBS_GRIPPERALWAYS: ::UINT = 0x00000080; -pub const RBBS_NOGRIPPER: ::UINT = 0x00000100; -pub const RBBS_USECHEVRON: ::UINT = 0x00000200; -pub const RBBS_HIDETITLE: ::UINT = 0x00000400; -pub const RBBS_TOPALIGN: ::UINT = 0x00000800; -pub const RBBIM_STYLE: ::UINT = 0x00000001; -pub const RBBIM_COLORS: ::UINT = 0x00000002; -pub const RBBIM_TEXT: ::UINT = 0x00000004; -pub const RBBIM_IMAGE: ::UINT = 0x00000008; -pub const RBBIM_CHILD: ::UINT = 0x00000010; -pub const RBBIM_CHILDSIZE: ::UINT = 0x00000020; -pub const RBBIM_SIZE: ::UINT = 0x00000040; -pub const RBBIM_BACKGROUND: ::UINT = 0x00000080; -pub const RBBIM_ID: ::UINT = 0x00000100; -pub const RBBIM_IDEALSIZE: ::UINT = 0x00000200; -pub const RBBIM_LPARAM: ::UINT = 0x00000400; -pub const RBBIM_HEADERSIZE: ::UINT = 0x00000800; -pub const RBBIM_CHEVRONLOCATION: ::UINT = 0x00001000; -pub const RBBIM_CHEVRONSTATE: ::UINT = 0x00002000; -STRUCT!{struct REBARBANDINFOA { - cbSize: ::UINT, - fMask: ::UINT, - fStyle: ::UINT, - clrFore: ::COLORREF, - clrBack: ::COLORREF, - lpText: ::LPSTR, - cch: ::UINT, - iImage: ::c_int, - hwndChild: ::HWND, - cxMinChild: ::UINT, - cyMinChild: ::UINT, - cx: ::UINT, - hbmBack: ::HBITMAP, - wID: ::UINT, - cyChild: ::UINT, - cyMaxChild: ::UINT, - cyIntegral: ::UINT, - cxIdeal: ::UINT, - lParam: ::LPARAM, - cxHeader: ::UINT, - rcChevronLocation: ::RECT, - uChevronState: ::UINT, -}} -pub type LPREBARBANDINFOA = *mut REBARBANDINFOA; -pub type LPCREBARBANDINFOA = *const REBARBANDINFOA; -STRUCT!{struct REBARBANDINFOW { - cbSize: ::UINT, - fMask: ::UINT, - fStyle: ::UINT, - clrFore: ::COLORREF, - clrBack: ::COLORREF, - lpText: ::LPWSTR, - cch: ::UINT, - iImage: ::c_int, - hwndChild: ::HWND, - cxMinChild: ::UINT, - cyMinChild: ::UINT, - cx: ::UINT, - hbmBack: ::HBITMAP, - wID: ::UINT, - cyChild: ::UINT, - cyMaxChild: ::UINT, - cyIntegral: ::UINT, - cxIdeal: ::UINT, - lParam: ::LPARAM, - cxHeader: ::UINT, - rcChevronLocation: ::RECT, - uChevronState: ::UINT, -}} -pub type LPREBARBANDINFOW = *mut REBARBANDINFOW; -pub type LPCREBARBANDINFOW = *const REBARBANDINFOW; -pub const RB_INSERTBANDA: ::UINT = ::WM_USER + 1; -pub const RB_DELETEBAND: ::UINT = ::WM_USER + 2; -pub const RB_GETBARINFO: ::UINT = ::WM_USER + 3; -pub const RB_SETBARINFO: ::UINT = ::WM_USER + 4; -pub const RB_SETBANDINFOA: ::UINT = ::WM_USER + 6; -pub const RB_SETPARENT: ::UINT = ::WM_USER + 7; -pub const RB_HITTEST: ::UINT = ::WM_USER + 8; -pub const RB_GETRECT: ::UINT = ::WM_USER + 9; -pub const RB_INSERTBANDW: ::UINT = ::WM_USER + 10; -pub const RB_SETBANDINFOW: ::UINT = ::WM_USER + 11; -pub const RB_GETBANDCOUNT: ::UINT = ::WM_USER + 12; -pub const RB_GETROWCOUNT: ::UINT = ::WM_USER + 13; -pub const RB_GETROWHEIGHT: ::UINT = ::WM_USER + 14; -pub const RB_IDTOINDEX: ::UINT = ::WM_USER + 16; -pub const RB_GETTOOLTIPS: ::UINT = ::WM_USER + 17; -pub const RB_SETTOOLTIPS: ::UINT = ::WM_USER + 18; -pub const RB_SETBKCOLOR: ::UINT = ::WM_USER + 19; -pub const RB_GETBKCOLOR: ::UINT = ::WM_USER + 20; -pub const RB_SETTEXTCOLOR: ::UINT = ::WM_USER + 21; -pub const RB_GETTEXTCOLOR: ::UINT = ::WM_USER + 22; -pub const RBSTR_CHANGERECT: ::WPARAM = 0x0001; -pub const RB_SIZETORECT: ::UINT = ::WM_USER + 23; -pub const RB_SETCOLORSCHEME: ::UINT = CCM_SETCOLORSCHEME; -pub const RB_GETCOLORSCHEME: ::UINT = CCM_GETCOLORSCHEME; -pub const RB_BEGINDRAG: ::UINT = ::WM_USER + 24; -pub const RB_ENDDRAG: ::UINT = ::WM_USER + 25; -pub const RB_DRAGMOVE: ::UINT = ::WM_USER + 26; -pub const RB_GETBARHEIGHT: ::UINT = ::WM_USER + 27; -pub const RB_GETBANDINFOW: ::UINT = ::WM_USER + 28; -pub const RB_GETBANDINFOA: ::UINT = ::WM_USER + 29; -pub const RB_MINIMIZEBAND: ::UINT = ::WM_USER + 30; -pub const RB_MAXIMIZEBAND: ::UINT = ::WM_USER + 31; -pub const RB_GETDROPTARGET: ::UINT = CCM_GETDROPTARGET; -pub const RB_GETBANDBORDERS: ::UINT = ::WM_USER + 34; -pub const RB_SHOWBAND: ::UINT = ::WM_USER + 35; -pub const RB_SETPALETTE: ::UINT = ::WM_USER + 37; -pub const RB_GETPALETTE: ::UINT = ::WM_USER + 38; -pub const RB_MOVEBAND: ::UINT = ::WM_USER + 39; -pub const RB_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; -pub const RB_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; -pub const RB_GETBANDMARGINS: ::UINT = ::WM_USER + 40; -pub const RB_SETWINDOWTHEME: ::UINT = CCM_SETWINDOWTHEME; -pub const RB_SETEXTENDEDSTYLE: ::UINT = ::WM_USER + 41; -pub const RB_GETEXTENDEDSTYLE: ::UINT = ::WM_USER + 42; -pub const RB_PUSHCHEVRON: ::UINT = ::WM_USER + 43; -pub const RB_SETBANDWIDTH: ::UINT = ::WM_USER + 44; -pub const RBN_HEIGHTCHANGE: ::UINT = RBN_FIRST - 0; -pub const RBN_GETOBJECT: ::UINT = RBN_FIRST - 1; -pub const RBN_LAYOUTCHANGED: ::UINT = RBN_FIRST - 2; -pub const RBN_AUTOSIZE: ::UINT = RBN_FIRST - 3; -pub const RBN_BEGINDRAG: ::UINT = RBN_FIRST - 4; -pub const RBN_ENDDRAG: ::UINT = RBN_FIRST - 5; -pub const RBN_DELETINGBAND: ::UINT = RBN_FIRST - 6; -pub const RBN_DELETEDBAND: ::UINT = RBN_FIRST - 7; -pub const RBN_CHILDSIZE: ::UINT = RBN_FIRST - 8; -pub const RBN_CHEVRONPUSHED: ::UINT = RBN_FIRST - 10; -pub const RBN_SPLITTERDRAG: ::UINT = RBN_FIRST - 11; -pub const RBN_MINMAX: ::UINT = RBN_FIRST - 21; -pub const RBN_AUTOBREAK: ::UINT = RBN_FIRST - 22; -STRUCT!{struct NMREBARCHILDSIZE { - hdr: ::NMHDR, - uBand: ::UINT, - wID: ::UINT, - rcChild: ::RECT, - rcBand: ::RECT, -}} -pub type LPNMREBARCHILDSIZE = *mut NMREBARCHILDSIZE; -STRUCT!{struct NMREBAR { - hdr: ::NMHDR, - dwMask: ::DWORD, - uBand: ::UINT, - fStyle: ::UINT, - wID: ::UINT, - lParam: ::LPARAM, -}} -pub type LPNMREBAR = *mut NMREBAR; -pub const RBNM_ID: ::DWORD = 0x00000001; -pub const RBNM_STYLE: ::DWORD = 0x00000002; -pub const RBNM_LPARAM: ::DWORD = 0x00000004; -STRUCT!{struct NMRBAUTOSIZE { - hdr: ::NMHDR, - fChanged: ::BOOL, - rcTarget: ::RECT, - rcActual: ::RECT, -}} -pub type LPNMRBAUTOSIZE = *mut NMRBAUTOSIZE; -STRUCT!{struct NMREBARCHEVRON { - hdr: ::NMHDR, - uBand: ::UINT, - wID: ::UINT, - lParam: ::LPARAM, - rc: ::RECT, - lParamNM: ::LPARAM, -}} -pub type LPNMREBARCHEVRON = *mut NMREBARCHEVRON; -STRUCT!{struct NMREBARSPLITTER { - hdr: ::NMHDR, - rcSizing: ::RECT, -}} -pub type LPNMREBARSPLITTER = *mut NMREBARSPLITTER; -pub const RBAB_AUTOSIZE: ::UINT = 0x0001; -pub const RBAB_ADDBAND: ::UINT = 0x0002; -STRUCT!{struct NMREBARAUTOBREAK { - hdr: ::NMHDR, - uBand: ::UINT, - wID: ::UINT, - lParam: ::LPARAM, - uMsg: ::UINT, - fStyleCurrent: ::UINT, - fAutoBreak: ::UINT, -}} -pub type LPNMREBARAUTOBREAK = *mut NMREBARAUTOBREAK; -pub const RBHT_NOWHERE: ::UINT = 0x0001; -pub const RBHT_CAPTION: ::UINT = 0x0002; -pub const RBHT_CLIENT: ::UINT = 0x0003; -pub const RBHT_GRABBER: ::UINT = 0x0004; -pub const RBHT_CHEVRON: ::UINT = 0x0008; -pub const RBHT_SPLITTER: ::UINT = 0x0010; -STRUCT!{struct RBHITTESTINFO { - pt: ::POINT, - flags: ::UINT, - iBand: ::c_int, -}} -pub type LPRBHITTESTINFO = *mut RBHITTESTINFO; -pub type LPTOOLINFOA = LPTTTOOLINFOA; -pub type LPTOOLINFOW = LPTTTOOLINFOW; -pub type TOOLINFOA = TTTOOLINFOA; -pub type TOOLINFOW = TTTOOLINFOW; -STRUCT!{struct TTTOOLINFOA { - cbSize: ::UINT, - uFlags: ::UINT, - hwnd: ::HWND, - uId: ::UINT_PTR, - rect: ::RECT, - hinst: ::HINSTANCE, - lpszText: ::LPSTR, - lParam: ::LPARAM, - lpReserved: *mut ::c_void, -}} -pub type PTTTOOLINFOA = *mut TTTOOLINFOA; -pub type LPTTTOOLINFOA = *mut TTTOOLINFOA; -STRUCT!{struct TTTOOLINFOW { - cbSize: ::UINT, - uFlags: ::UINT, - hwnd: ::HWND, - uId: ::UINT_PTR, - rect: ::RECT, - hinst: ::HINSTANCE, - lpszText: ::LPSTR, - lParam: ::LPARAM, - lpReserved: *mut ::c_void, -}} -pub type PTTTOOLINFOW = *mut TTTOOLINFOW; -pub type LPTTTOOLINFOW = *mut TTTOOLINFOW; -pub const TTS_ALWAYSTIP: ::DWORD = 0x01; -pub const TTS_NOPREFIX: ::DWORD = 0x02; -pub const TTS_NOANIMATE: ::DWORD = 0x10; -pub const TTS_NOFADE: ::DWORD = 0x20; -pub const TTS_BALLOON: ::DWORD = 0x40; -pub const TTS_CLOSE: ::DWORD = 0x80; -pub const TTS_USEVISUALSTYLE: ::DWORD = 0x100; -pub const TTF_IDISHWND: ::UINT = 0x0001; -pub const TTF_CENTERTIP: ::UINT = 0x0002; -pub const TTF_RTLREADING: ::UINT = 0x0004; -pub const TTF_SUBCLASS: ::UINT = 0x0010; -pub const TTF_TRACK: ::UINT = 0x0020; -pub const TTF_ABSOLUTE: ::UINT = 0x0080; -pub const TTF_TRANSPARENT: ::UINT = 0x0100; -pub const TTF_PARSELINKS: ::UINT = 0x1000; -pub const TTF_DI_SETITEM: ::UINT = 0x8000; -pub const TTDT_AUTOMATIC: ::WPARAM = 0; -pub const TTDT_RESHOW: ::WPARAM = 1; -pub const TTDT_AUTOPOP: ::WPARAM = 2; -pub const TTDT_INITIAL: ::WPARAM = 3; -pub const TTI_NONE: ::WPARAM = 0; -pub const TTI_INFO: ::WPARAM = 1; -pub const TTI_WARNING: ::WPARAM = 2; -pub const TTI_ERROR: ::WPARAM = 3; -pub const TTI_INFO_LARGE: ::WPARAM = 4; -pub const TTI_WARNING_LARGE: ::WPARAM = 5; -pub const TTI_ERROR_LARGE: ::WPARAM = 6; -pub const TTM_ACTIVATE: ::UINT = ::WM_USER + 1; -pub const TTM_SETDELAYTIME: ::UINT = ::WM_USER + 3; -pub const TTM_ADDTOOLA: ::UINT = ::WM_USER + 4; -pub const TTM_ADDTOOLW: ::UINT = ::WM_USER + 50; -pub const TTM_DELTOOLA: ::UINT = ::WM_USER + 5; -pub const TTM_DELTOOLW: ::UINT = ::WM_USER + 51; -pub const TTM_NEWTOOLRECTA: ::UINT = ::WM_USER + 6; -pub const TTM_NEWTOOLRECTW: ::UINT = ::WM_USER + 52; -pub const TTM_RELAYEVENT: ::UINT = ::WM_USER + 7; -pub const TTM_GETTOOLINFOA: ::UINT = ::WM_USER + 8; -pub const TTM_GETTOOLINFOW: ::UINT = ::WM_USER + 53; -pub const TTM_SETTOOLINFOA: ::UINT = ::WM_USER + 9; -pub const TTM_SETTOOLINFOW: ::UINT = ::WM_USER + 54; -pub const TTM_HITTESTA: ::UINT = ::WM_USER + 10; -pub const TTM_HITTESTW: ::UINT = ::WM_USER + 55; -pub const TTM_GETTEXTA: ::UINT = ::WM_USER + 11; -pub const TTM_GETTEXTW: ::UINT = ::WM_USER + 56; -pub const TTM_UPDATETIPTEXTA: ::UINT = ::WM_USER + 12; -pub const TTM_UPDATETIPTEXTW: ::UINT = ::WM_USER + 57; -pub const TTM_GETTOOLCOUNT: ::UINT = ::WM_USER + 13; -pub const TTM_ENUMTOOLSA: ::UINT = ::WM_USER + 14; -pub const TTM_ENUMTOOLSW: ::UINT = ::WM_USER + 58; -pub const TTM_GETCURRENTTOOLA: ::UINT = ::WM_USER + 15; -pub const TTM_GETCURRENTTOOLW: ::UINT = ::WM_USER + 59; -pub const TTM_WINDOWFROMPOINT: ::UINT = ::WM_USER + 16; -pub const TTM_TRACKACTIVATE: ::UINT = ::WM_USER + 17; -pub const TTM_TRACKPOSITION: ::UINT = ::WM_USER + 18; -pub const TTM_SETTIPBKCOLOR: ::UINT = ::WM_USER + 19; -pub const TTM_SETTIPTEXTCOLOR: ::UINT = ::WM_USER + 20; -pub const TTM_GETDELAYTIME: ::UINT = ::WM_USER + 21; -pub const TTM_GETTIPBKCOLOR: ::UINT = ::WM_USER + 22; -pub const TTM_GETTIPTEXTCOLOR: ::UINT = ::WM_USER + 23; -pub const TTM_SETMAXTIPWIDTH: ::UINT = ::WM_USER + 24; -pub const TTM_GETMAXTIPWIDTH: ::UINT = ::WM_USER + 25; -pub const TTM_SETMARGIN: ::UINT = ::WM_USER + 26; -pub const TTM_GETMARGIN: ::UINT = ::WM_USER + 27; -pub const TTM_POP: ::UINT = ::WM_USER + 28; -pub const TTM_UPDATE: ::UINT = ::WM_USER + 29; -pub const TTM_GETBUBBLESIZE: ::UINT = ::WM_USER + 30; -pub const TTM_ADJUSTRECT: ::UINT = ::WM_USER + 31; -pub const TTM_SETTITLEA: ::UINT = ::WM_USER + 32; -pub const TTM_SETTITLEW: ::UINT = ::WM_USER + 33; -pub const TTM_POPUP: ::UINT = ::WM_USER + 34; -pub const TTM_GETTITLE: ::UINT = ::WM_USER + 35; -STRUCT!{struct TTGETTITLE { - dwSize: ::DWORD, - uTitleBitmap: ::UINT, - cch: ::UINT, - pszTitle: *mut ::WCHAR, -}} -pub type LPTTGETTITLE = *mut TTGETTITLE; -pub const TTM_SETWINDOWTHEME: ::UINT = CCM_SETWINDOWTHEME; -pub type LPHITTESTINFOW = LPTTHITTESTINFOW; -pub type LPHITTESTINFOA = LPTTHITTESTINFOA; -STRUCT!{struct TTHITTESTINFOA { - hwnd: ::HWND, - pt: ::POINT, - ti: TTTOOLINFOA, -}} -pub type LPTTHITTESTINFOA = *mut TTHITTESTINFOA; -STRUCT!{struct TTHITTESTINFOW { - hwnd: ::HWND, - pt: ::POINT, - ti: TTTOOLINFOW, -}} -pub type LPTTHITTESTINFOW = *mut TTHITTESTINFOW; -pub const TTN_GETDISPINFOA: ::UINT = TTN_FIRST - 0; -pub const TTN_GETDISPINFOW: ::UINT = TTN_FIRST - 10; -pub const TTN_SHOW: ::UINT = TTN_FIRST - 1; -pub const TTN_POP: ::UINT = TTN_FIRST - 2; -pub const TTN_LINKCLICK: ::UINT = TTN_FIRST - 3; -pub const TTN_NEEDTEXTA: ::UINT = TTN_GETDISPINFOA; -pub const TTN_NEEDTEXTW: ::UINT = TTN_GETDISPINFOW; -pub type TOOLTIPTEXTW = NMTTDISPINFOW; -pub type TOOLTIPTEXTA = NMTTDISPINFOA; -pub type LPTOOLTIPTEXTA = LPNMTTDISPINFOA; -pub type LPTOOLTIPTEXTW = LPNMTTDISPINFOW; -STRUCT!{nodebug struct NMTTDISPINFOA { - hdr: ::NMHDR, - lpszText: ::LPSTR, - szText: [::c_char; 80], - hinst: ::HINSTANCE, - uFlags: ::UINT, - lParam: ::LPARAM, -}} -pub type LPNMTTDISPINFOA = *mut NMTTDISPINFOA; -STRUCT!{nodebug struct NMTTDISPINFOW { - hdr: ::NMHDR, - lpszText: ::LPWSTR, - szText: [::WCHAR; 80], - hinst: ::HINSTANCE, - uFlags: ::UINT, - lParam: ::LPARAM, -}} -pub type LPNMTTDISPINFOW = *mut NMTTDISPINFOW; -pub const SBARS_SIZEGRIP: ::DWORD = 0x0100; -pub const SBARS_TOOLTIPS: ::DWORD = 0x0800; -pub const SBT_TOOLTIPS: ::DWORD = 0x0800; -pub const SB_SETTEXTA: ::UINT = ::WM_USER + 1; -pub const SB_SETTEXTW: ::UINT = ::WM_USER + 11; -pub const SB_GETTEXTA: ::UINT = ::WM_USER + 2; -pub const SB_GETTEXTW: ::UINT = ::WM_USER + 13; -pub const SB_GETTEXTLENGTHA: ::UINT = ::WM_USER + 3; -pub const SB_GETTEXTLENGTHW: ::UINT = ::WM_USER + 12; -pub const SB_SETPARTS: ::UINT = ::WM_USER + 4; -pub const SB_GETPARTS: ::UINT = ::WM_USER + 6; -pub const SB_GETBORDERS: ::UINT = ::WM_USER + 7; -pub const SB_SETMINHEIGHT: ::UINT = ::WM_USER + 8; -pub const SB_SIMPLE: ::UINT = ::WM_USER + 9; -pub const SB_GETRECT: ::UINT = ::WM_USER + 10; -pub const SB_ISSIMPLE: ::UINT = ::WM_USER + 14; -pub const SB_SETICON: ::UINT = ::WM_USER + 15; -pub const SB_SETTIPTEXTA: ::UINT = ::WM_USER + 16; -pub const SB_SETTIPTEXTW: ::UINT = ::WM_USER + 17; -pub const SB_GETTIPTEXTA: ::UINT = ::WM_USER + 18; -pub const SB_GETTIPTEXTW: ::UINT = ::WM_USER + 19; -pub const SB_GETICON: ::UINT = ::WM_USER + 20; -pub const SB_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; -pub const SB_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; -pub const SBT_OWNERDRAW: ::WPARAM = 0x1000; -pub const SBT_NOBORDERS: ::WPARAM = 0x0100; -pub const SBT_POPOUT: ::WPARAM = 0x0200; -pub const SBT_RTLREADING: ::WPARAM = 0x0400; -pub const SBT_NOTABPARSING: ::WPARAM = 0x0800; -pub const SB_SETBKCOLOR: ::UINT = CCM_SETBKCOLOR; -pub const SBN_SIMPLEMODECHANGE: ::UINT = SBN_FIRST - 0; -pub const SB_SIMPLEID: ::WPARAM = 0x00ff; -pub const TBS_AUTOTICKS: ::DWORD = 0x0001; -pub const TBS_VERT: ::DWORD = 0x0002; -pub const TBS_HORZ: ::DWORD = 0x0000; -pub const TBS_TOP: ::DWORD = 0x0004; -pub const TBS_BOTTOM: ::DWORD = 0x0000; -pub const TBS_LEFT: ::DWORD = 0x0004; -pub const TBS_RIGHT: ::DWORD = 0x0000; -pub const TBS_BOTH: ::DWORD = 0x0008; -pub const TBS_NOTICKS: ::DWORD = 0x0010; -pub const TBS_ENABLESELRANGE: ::DWORD = 0x0020; -pub const TBS_FIXEDLENGTH: ::DWORD = 0x0040; -pub const TBS_NOTHUMB: ::DWORD = 0x0080; -pub const TBS_TOOLTIPS: ::DWORD = 0x0100; -pub const TBS_REVERSED: ::DWORD = 0x0200; -pub const TBS_DOWNISLEFT: ::DWORD = 0x0400; -pub const TBS_NOTIFYBEFOREMOVE: ::DWORD = 0x0800; -pub const TBS_TRANSPARENTBKGND: ::DWORD = 0x1000; -pub const TBM_GETPOS: ::UINT = ::WM_USER; -pub const TBM_GETRANGEMIN: ::UINT = ::WM_USER + 1; -pub const TBM_GETRANGEMAX: ::UINT = ::WM_USER + 2; -pub const TBM_GETTIC: ::UINT = ::WM_USER + 3; -pub const TBM_SETTIC: ::UINT = ::WM_USER + 4; -pub const TBM_SETPOS: ::UINT = ::WM_USER + 5; -pub const TBM_SETRANGE: ::UINT = ::WM_USER + 6; -pub const TBM_SETRANGEMIN: ::UINT = ::WM_USER + 7; -pub const TBM_SETRANGEMAX: ::UINT = ::WM_USER + 8; -pub const TBM_CLEARTICS: ::UINT = ::WM_USER + 9; -pub const TBM_SETSEL: ::UINT = ::WM_USER + 10; -pub const TBM_SETSELSTART: ::UINT = ::WM_USER + 11; -pub const TBM_SETSELEND: ::UINT = ::WM_USER + 12; -pub const TBM_GETPTICS: ::UINT = ::WM_USER + 14; -pub const TBM_GETTICPOS: ::UINT = ::WM_USER + 15; -pub const TBM_GETNUMTICS: ::UINT = ::WM_USER + 16; -pub const TBM_GETSELSTART: ::UINT = ::WM_USER + 17; -pub const TBM_GETSELEND: ::UINT = ::WM_USER + 18; -pub const TBM_CLEARSEL: ::UINT = ::WM_USER + 19; -pub const TBM_SETTICFREQ: ::UINT = ::WM_USER + 20; -pub const TBM_SETPAGESIZE: ::UINT = ::WM_USER + 21; -pub const TBM_GETPAGESIZE: ::UINT = ::WM_USER + 22; -pub const TBM_SETLINESIZE: ::UINT = ::WM_USER + 23; -pub const TBM_GETLINESIZE: ::UINT = ::WM_USER + 24; -pub const TBM_GETTHUMBRECT: ::UINT = ::WM_USER + 25; -pub const TBM_GETCHANNELRECT: ::UINT = ::WM_USER + 26; -pub const TBM_SETTHUMBLENGTH: ::UINT = ::WM_USER + 27; -pub const TBM_GETTHUMBLENGTH: ::UINT = ::WM_USER + 28; -pub const TBM_SETTOOLTIPS: ::UINT = ::WM_USER + 29; -pub const TBM_GETTOOLTIPS: ::UINT = ::WM_USER + 30; -pub const TBM_SETTIPSIDE: ::UINT = ::WM_USER + 31; -pub const TBTS_TOP: ::WPARAM = 0; -pub const TBTS_LEFT: ::WPARAM = 1; -pub const TBTS_BOTTOM: ::WPARAM = 2; -pub const TBTS_RIGHT: ::WPARAM = 3; -pub const TBM_SETBUDDY: ::UINT = ::WM_USER + 32; -pub const TBM_GETBUDDY: ::UINT = ::WM_USER + 33; -pub const TBM_SETPOSNOTIFY: ::UINT = ::WM_USER + 34; -pub const TBM_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; -pub const TBM_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; -pub const TBCD_TICS: ::DWORD_PTR = 0x0001; -pub const TBCD_THUMB: ::DWORD_PTR = 0x0001; -pub const TBCD_CHANNEL: ::DWORD_PTR = 0x0001; -pub const TB_LINEUP: ::WPARAM = 0; -pub const TB_LINEDOWN: ::WPARAM = 1; -pub const TB_PAGEUP: ::WPARAM = 2; -pub const TB_PAGEDOWN: ::WPARAM = 3; -pub const TB_THUMBPOSITION: ::WPARAM = 4; -pub const TB_THUMBTRACK: ::WPARAM = 5; -pub const TB_TOP: ::WPARAM = 6; -pub const TB_BOTTOM: ::WPARAM = 7; -pub const TB_ENDTRACK: ::WPARAM = 8; -pub const TRBN_THUMBPOSCHANGING: ::UINT = TRBN_FIRST - 1; -STRUCT!{struct NMTRBTHUMBPOSCHANGING { - hdr: ::NMHDR, - dwPos: ::DWORD, - nReason: ::c_int, -}} -STRUCT!{struct DRAGLISTINFO { - uNotification: ::UINT, - hWnd: ::HWND, - ptCursor: ::POINT, -}} -pub type LPDRAGLISTINFO = *mut DRAGLISTINFO; -pub const DL_BEGINDRAG: ::UINT = ::WM_USER + 133; -pub const DL_DRAGGING: ::UINT = ::WM_USER + 134; -pub const DL_DROPPED: ::UINT = ::WM_USER + 135; -pub const DL_CANCELDRAG: ::UINT = ::WM_USER + 136; -pub const DL_CURSORSET: ::UINT = 0; -pub const DL_STOPCURSOR: ::UINT = 1; -pub const DL_COPYCURSOR: ::UINT = 2; -pub const DL_MOVECURSOR: ::UINT = 3; -STRUCT!{struct UDACCEL { - nSec: ::UINT, - nInc: ::UINT, -}} -pub type LPUDACCEL = *mut UDACCEL; -pub const UD_MAXVAL: ::c_short = 0x7fff; -pub const UD_MINVAL: ::c_short = 0 - UD_MAXVAL; -pub const UDS_WRAP: ::DWORD = 0x0001; -pub const UDS_SETBUDDYINT: ::DWORD = 0x0002; -pub const UDS_ALIGNRIGHT: ::DWORD = 0x0004; -pub const UDS_ALIGNLEFT: ::DWORD = 0x0008; -pub const UDS_AUTOBUDDY: ::DWORD = 0x0010; -pub const UDS_ARROWKEYS: ::DWORD = 0x0020; -pub const UDS_HORZ: ::DWORD = 0x0040; -pub const UDS_NOTHOUSANDS: ::DWORD = 0x0080; -pub const UDS_HOTTRACK: ::DWORD = 0x0100; -pub const UDM_SETRANGE: ::UINT = ::WM_USER + 101; -pub const UDM_GETRANGE: ::UINT = ::WM_USER + 102; -pub const UDM_SETPOS: ::UINT = ::WM_USER + 103; -pub const UDM_GETPOS: ::UINT = ::WM_USER + 104; -pub const UDM_SETBUDDY: ::UINT = ::WM_USER + 105; -pub const UDM_GETBUDDY: ::UINT = ::WM_USER + 106; -pub const UDM_SETACCEL: ::UINT = ::WM_USER + 107; -pub const UDM_GETACCEL: ::UINT = ::WM_USER + 108; -pub const UDM_SETBASE: ::UINT = ::WM_USER + 109; -pub const UDM_GETBASE: ::UINT = ::WM_USER + 110; -pub const UDM_SETRANGE32: ::UINT = ::WM_USER + 111; -pub const UDM_GETRANGE32: ::UINT = ::WM_USER + 112; -pub const UDM_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; -pub const UDM_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; -pub const UDM_SETPOS32: ::UINT = ::WM_USER + 113; -pub const UDM_GETPOS32: ::UINT = ::WM_USER + 114; -pub type NM_UPDOWN = NMUPDOWN; -pub type LPNM_UPDOWN = LPNMUPDOWN; -STRUCT!{struct NMUPDOWN { - hdr: ::NMHDR, - iPos: ::c_int, - iDelta: ::c_int, -}} -pub type LPNMUPDOWN = *mut NMUPDOWN; -pub const UDN_DELTAPOS: ::UINT = UDN_FIRST - 1; -pub const PBS_SMOOTH: ::DWORD = 0x01; -pub const PBS_VERTICAL: ::DWORD = 0x04; -pub const PBM_SETRANGE: ::UINT = ::WM_USER + 1; -pub const PBM_SETPOS: ::UINT = ::WM_USER + 2; -pub const PBM_DELTAPOS: ::UINT = ::WM_USER + 3; -pub const PBM_SETSTEP: ::UINT = ::WM_USER + 4; -pub const PBM_STEPIT: ::UINT = ::WM_USER + 5; -pub const PBM_SETRANGE32: ::UINT = ::WM_USER + 6; -STRUCT!{struct PBRANGE { - iLow: ::c_int, - iHigh: ::c_int, -}} -pub type LPPBRANGE = *mut PBRANGE; -pub const PBM_GETRANGE: ::UINT = ::WM_USER + 7; -pub const PBM_GETPOS: ::UINT = ::WM_USER + 8; -pub const PBM_SETBARCOLOR: ::UINT = ::WM_USER + 9; -pub const PBM_SETBKCOLOR: ::UINT = CCM_SETBKCOLOR; -pub const PBM_SETMARQUEE: ::UINT = ::WM_USER + 10; -pub const PBS_MARQUEE: ::DWORD = 0x08; -pub const PBS_SMOOTHREVERSE: ::DWORD = 0x10; -pub const PBM_GETSTEP: ::UINT = ::WM_USER + 13; -pub const PBM_GETBKCOLOR: ::UINT = ::WM_USER + 14; -pub const PBM_GETBARCOLOR: ::UINT = ::WM_USER + 15; -pub const PBM_SETSTATE: ::UINT = ::WM_USER + 16; -pub const PBM_GETSTATE: ::UINT = ::WM_USER + 17; -pub const PBST_NORMAL: ::c_int = 0x0001; -pub const PBST_ERROR: ::c_int = 0x0002; -pub const PBST_PAUSED: ::c_int = 0x0003; -pub const HOTKEYF_SHIFT: ::BYTE = 0x01; -pub const HOTKEYF_CONTROL: ::BYTE = 0x02; -pub const HOTKEYF_ALT: ::BYTE = 0x04; -pub const HOTKEYF_EXT: ::BYTE = 0x08; -pub const HKCOMB_NONE: ::WPARAM = 0x0001; -pub const HKCOMB_S: ::WPARAM = 0x0002; -pub const HKCOMB_C: ::WPARAM = 0x0004; -pub const HKCOMB_A: ::WPARAM = 0x0008; -pub const HKCOMB_SC: ::WPARAM = 0x0010; -pub const HKCOMB_SA: ::WPARAM = 0x0020; -pub const HKCOMB_CA: ::WPARAM = 0x0040; -pub const HKCOMB_SCA: ::WPARAM = 0x0080; -pub const HKM_SETHOTKEY: ::UINT = ::WM_USER + 1; -pub const HKM_GETHOTKEY: ::UINT = ::WM_USER + 2; -pub const HKM_SETRULES: ::UINT = ::WM_USER + 3; -pub const CCS_TOP: ::DWORD = 0x00000001; -pub const CCS_NOMOVEY: ::DWORD = 0x00000002; -pub const CCS_BOTTOM: ::DWORD = 0x00000003; -pub const CCS_NORESIZE: ::DWORD = 0x00000004; -pub const CCS_NOPARENTALIGN: ::DWORD = 0x00000008; -pub const CCS_ADJUSTABLE: ::DWORD = 0x00000020; -pub const CCS_NODIVIDER: ::DWORD = 0x00000040; -pub const CCS_VERT: ::DWORD = 0x00000080; -pub const CCS_LEFT: ::DWORD = CCS_VERT | CCS_TOP; -pub const CCS_RIGHT: ::DWORD = CCS_VERT | CCS_BOTTOM; -pub const CCS_NOMOVEX: ::DWORD = CCS_VERT | CCS_NOMOVEY; -pub const MAX_LINKID_TEXT: usize = 48; -pub const L_MAX_URL_LENGTH: usize = 2048 + 32 + 4; -pub const LWS_TRANSPARENT: ::DWORD = 0x0001; -pub const LWS_IGNORERETURN: ::DWORD = 0x0002; -pub const LWS_NOPREFIX: ::DWORD = 0x0004; -pub const LWS_USEVISUALSTYLE: ::DWORD = 0x0008; -pub const LWS_USECUSTOMTEXT: ::DWORD = 0x0010; -pub const LWS_RIGHT: ::DWORD = 0x0020; -pub const LIF_ITEMINDEX: ::UINT = 0x00000001; -pub const LIF_STATE: ::UINT = 0x00000002; -pub const LIF_ITEMID: ::UINT = 0x00000004; -pub const LIF_URL: ::UINT = 0x00000008; -pub const LIS_FOCUSED: ::UINT = 0x00000001; -pub const LIS_ENABLED: ::UINT = 0x00000002; -pub const LIS_VISITED: ::UINT = 0x00000004; -pub const LIS_HOTTRACK: ::UINT = 0x00000008; -pub const LIS_DEFAULTCOLORS: ::UINT = 0x00000010; -STRUCT!{nodebug struct LITEM { - mask: ::UINT, - iLink: ::c_int, - state: ::UINT, - stateMask: ::UINT, - szID: [::WCHAR; MAX_LINKID_TEXT], - szUrl: [::WCHAR; L_MAX_URL_LENGTH], -}} -pub type PLITEM = *mut LITEM; -STRUCT!{nodebug struct LHITTESTINFO { - pt: ::POINT, - item: LITEM, -}} -pub type PLHITTESTINFO = *mut LHITTESTINFO; -STRUCT!{nodebug struct NMLINK { - hdr: ::NMHDR, - item: LITEM, -}} -pub type PNMLINK = *mut NMLINK; -pub const LM_HITTEST: ::UINT = ::WM_USER + 0x300; -pub const LM_GETIDEALHEIGHT: ::UINT = ::WM_USER + 0x301; -pub const LM_SETITEM: ::UINT = ::WM_USER + 0x302; -pub const LM_GETITEM: ::UINT = ::WM_USER + 0x303; -pub const LM_GETIDEALSIZE: ::UINT = LM_GETIDEALHEIGHT; -pub const LVS_ICON: ::DWORD = 0x0000; -pub const LVS_REPORT: ::DWORD = 0x0001; -pub const LVS_SMALLICON: ::DWORD = 0x0002; -pub const LVS_LIST: ::DWORD = 0x0003; -pub const LVS_TYPEMASK: ::DWORD = 0x0003; -pub const LVS_SINGLESEL: ::DWORD = 0x0004; -pub const LVS_SHOWSELALWAYS: ::DWORD = 0x0008; -pub const LVS_SORTASCENDING: ::DWORD = 0x0010; -pub const LVS_SORTDESCENDING: ::DWORD = 0x0020; -pub const LVS_SHAREIMAGELISTS: ::DWORD = 0x0040; -pub const LVS_NOLABELWRAP: ::DWORD = 0x0080; -pub const LVS_AUTOARRANGE: ::DWORD = 0x0100; -pub const LVS_EDITLABELS: ::DWORD = 0x0200; -pub const LVS_OWNERDATA: ::DWORD = 0x1000; -pub const LVS_NOSCROLL: ::DWORD = 0x2000; -pub const LVS_TYPESTYLEMASK: ::DWORD = 0xfc00; -pub const LVS_ALIGNTOP: ::DWORD = 0x0000; -pub const LVS_ALIGNLEFT: ::DWORD = 0x0800; -pub const LVS_ALIGNMASK: ::DWORD = 0x0c00; -pub const LVS_OWNERDRAWFIXED: ::DWORD = 0x0400; -pub const LVS_NOCOLUMNHEADER: ::DWORD = 0x4000; -pub const LVS_NOSORTHEADER: ::DWORD = 0x8000; -pub const LVM_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; -pub const LVM_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; -pub const LVM_GETBKCOLOR: ::UINT = LVM_FIRST + 0; -pub const LVM_SETBKCOLOR: ::UINT = LVM_FIRST + 1; -pub const LVM_GETIMAGELIST: ::UINT = LVM_FIRST + 2; -pub const LVM_SETIMAGELIST: ::UINT = LVM_FIRST + 3; -pub const LVM_GETITEMCOUNT: ::UINT = LVM_FIRST + 4; -pub const LVSIL_NORMAL: ::c_int = 0; -pub const LVSIL_SMALL: ::c_int = 1; -pub const LVSIL_STATE: ::c_int = 2; -pub const LVSIL_GROUPHEADER: ::c_int = 3; -pub const LVIF_TEXT: ::UINT = 0x00000001; -pub const LVIF_IMAGE: ::UINT = 0x00000002; -pub const LVIF_PARAM: ::UINT = 0x00000004; -pub const LVIF_STATE: ::UINT = 0x00000008; -pub const LVIF_INDENT: ::UINT = 0x00000010; -pub const LVIF_NORECOMPUTE: ::UINT = 0x00000800; -pub const LVIF_GROUPID: ::UINT = 0x00000100; -pub const LVIF_COLUMNS: ::UINT = 0x00000200; -pub const LVIF_COLFMT: ::UINT = 0x00010000; -pub const LVIS_FOCUSED: ::UINT = 0x0001; -pub const LVIS_SELECTED: ::UINT = 0x0002; -pub const LVIS_CUT: ::UINT = 0x0004; -pub const LVIS_DROPHILITED: ::UINT = 0x0008; -pub const LVIS_GLOW: ::UINT = 0x0010; -pub const LVIS_ACTIVATING: ::UINT = 0x0020; -pub const LVIS_OVERLAYMASK: ::UINT = 0x0F00; -pub const LVIS_STATEIMAGEMASK: ::UINT = 0xF000; -#[inline] #[allow(dead_code)] -pub fn INDEXTOSTATEIMAGEMASK(i: ::UINT) -> ::UINT { i << 12 } -pub const I_INDENTCALLBACK: ::c_int = -1; -pub type LV_ITEMA = LVITEMA; -pub type LV_ITEMW = LVITEMW; -pub const I_GROUPIDCALLBACK: ::c_int = -1; -pub const I_GROUPIDNONE: ::c_int = -2; -STRUCT!{struct LVITEMA { - mask: ::UINT, - iItem: ::c_int, - iSubItem: ::c_int, - state: ::UINT, - stateMask: ::UINT, - pszText: ::LPSTR, - cchTextMax: ::c_int, - iImage: ::c_int, - lParam: ::LPARAM, - iIndent: ::c_int, - iGroupId: ::c_int, - cColumns: ::UINT, - puColumns: ::PUINT, - piColFmt: *mut ::c_int, - iGroup: ::c_int, -}} -pub type LPLVITEMA = *mut LVITEMA; -STRUCT!{struct LVITEMW { - mask: ::UINT, - iItem: ::c_int, - iSubItem: ::c_int, - state: ::UINT, - stateMask: ::UINT, - pszText: ::LPWSTR, - cchTextMax: ::c_int, - iImage: ::c_int, - lParam: ::LPARAM, - iIndent: ::c_int, - iGroupId: ::c_int, - cColumns: ::UINT, - puColumns: ::PUINT, - piColFmt: *mut ::c_int, - iGroup: ::c_int, -}} -pub type LPLVITEMW = *mut LVITEMW; -pub const LPSTR_TEXTCALLBACKW: ::LPWSTR = (0 - 1) as ::LPWSTR; -pub const LPSTR_TEXTCALLBACKA: ::LPSTR = (0 - 1) as ::LPSTR; -pub const I_IMAGECALLBACK: ::c_int = -1; -pub const I_IMAGENONE: ::c_int = -2; -pub const I_COLUMNSCALLBACK: ::UINT = -1i32 as ::UINT; -pub const LVM_GETITEMA: ::UINT = LVM_FIRST + 5; -pub const LVM_GETITEMW: ::UINT = LVM_FIRST + 75; -pub const LVM_SETITEMA: ::UINT = LVM_FIRST + 6; -pub const LVM_SETITEMW: ::UINT = LVM_FIRST + 76; -pub const LVM_INSERTITEMA: ::UINT = LVM_FIRST + 7; -pub const LVM_INSERTITEMW: ::UINT = LVM_FIRST + 77; -pub const LVM_DELETEITEM: ::UINT = LVM_FIRST + 8; -pub const LVM_DELETEALLITEMS: ::UINT = LVM_FIRST + 9; -pub const LVM_GETCALLBACKMASK: ::UINT = LVM_FIRST + 10; -pub const LVM_SETCALLBACKMASK: ::UINT = LVM_FIRST + 11; -pub const LVM_GETNEXTITEM: ::UINT = LVM_FIRST + 12; -pub const LVNI_ALL: ::LPARAM = 0x0000; -pub const LVNI_FOCUSED: ::LPARAM = 0x0001; -pub const LVNI_SELECTED: ::LPARAM = 0x0002; -pub const LVNI_CUT: ::LPARAM = 0x0004; -pub const LVNI_DROPHILITED: ::LPARAM = 0x0008; -pub const LVNI_STATEMASK: ::LPARAM = LVNI_FOCUSED | LVNI_SELECTED | LVNI_CUT | LVNI_DROPHILITED; -pub const LVNI_VISIBLEORDER: ::LPARAM = 0x0010; -pub const LVNI_PREVIOUS: ::LPARAM = 0x0020; -pub const LVNI_VISIBLEONLY: ::LPARAM = 0x0040; -pub const LVNI_SAMEGROUPONLY: ::LPARAM = 0x0080; -pub const LVNI_ABOVE: ::LPARAM = 0x0100; -pub const LVNI_BELOW: ::LPARAM = 0x0200; -pub const LVNI_TOLEFT: ::LPARAM = 0x0400; -pub const LVNI_TORIGHT: ::LPARAM = 0x0800; -pub const LVNI_DIRECTIONMASK: ::LPARAM = LVNI_ABOVE | LVNI_BELOW | LVNI_TOLEFT | LVNI_TORIGHT; -pub const LVFI_PARAM: ::UINT = 0x0001; -pub const LVFI_STRING: ::UINT = 0x0002; -pub const LVFI_SUBSTRING: ::UINT = 0x0004; -pub const LVFI_PARTIAL: ::UINT = 0x0008; -pub const LVFI_WRAP: ::UINT = 0x0020; -pub const LVFI_NEARESTXY: ::UINT = 0x0040; -pub type LV_FINDINFOA = LVFINDINFOA; -pub type LV_FINDINFOW = LVFINDINFOW; -STRUCT!{struct LVFINDINFOA { - flags: ::UINT, - psz: ::LPCSTR, - lParam: ::LPARAM, - pt: ::POINT, - vkDirection: ::UINT, -}} -pub type LPLVFINDINFOA = *mut LVFINDINFOA; -STRUCT!{struct LVFINDINFOW { - flags: ::UINT, - psz: ::LPCWSTR, - lParam: ::LPARAM, - pt: ::POINT, - vkDirection: ::UINT, -}} -pub type LPLVFINDINFOW = *mut LVFINDINFOW; -pub const LVM_FINDITEMA: ::UINT = LVM_FIRST + 13; -pub const LVM_FINDITEMW: ::UINT = LVM_FIRST + 83; -pub const LVIR_BOUNDS: ::c_int = 0; -pub const LVIR_ICON: ::c_int = 1; -pub const LVIR_LABEL: ::c_int = 2; -pub const LVIR_SELECTBOUNDS: ::c_int = 3; -pub const LVM_GETITEMRECT: ::UINT = LVM_FIRST + 14; -pub const LVM_SETITEMPOSITION: ::UINT = LVM_FIRST + 15; -pub const LVM_GETITEMPOSITION: ::UINT = LVM_FIRST + 16; -pub const LVM_GETSTRINGWIDTHA: ::UINT = LVM_FIRST + 17; -pub const LVM_GETSTRINGWIDTHW: ::UINT = LVM_FIRST + 87; -pub const LVHT_NOWHERE: ::UINT = 0x00000001; -pub const LVHT_ONITEMICON: ::UINT = 0x00000002; -pub const LVHT_ONITEMLABEL: ::UINT = 0x00000004; -pub const LVHT_ONITEMSTATEICON: ::UINT = 0x00000008; -pub const LVHT_ONITEM: ::UINT = LVHT_ONITEMICON | LVHT_ONITEMLABEL | LVHT_ONITEMSTATEICON; -pub const LVHT_ABOVE: ::UINT = 0x00000008; -pub const LVHT_BELOW: ::UINT = 0x00000010; -pub const LVHT_TORIGHT: ::UINT = 0x00000020; -pub const LVHT_TOLEFT: ::UINT = 0x00000040; -pub const LVHT_EX_GROUP_HEADER: ::UINT = 0x10000000; -pub const LVHT_EX_GROUP_FOOTER: ::UINT = 0x20000000; -pub const LVHT_EX_GROUP_COLLAPSE: ::UINT = 0x40000000; -pub const LVHT_EX_GROUP_BACKGROUND: ::UINT = 0x80000000; -pub const LVHT_EX_GROUP_STATEICON: ::UINT = 0x01000000; -pub const LVHT_EX_GROUP_SUBSETLINK: ::UINT = 0x02000000; -pub const LVHT_EX_GROUP: ::UINT = LVHT_EX_GROUP_BACKGROUND | LVHT_EX_GROUP_COLLAPSE - | LVHT_EX_GROUP_FOOTER | LVHT_EX_GROUP_HEADER | LVHT_EX_GROUP_STATEICON - | LVHT_EX_GROUP_SUBSETLINK; -pub const LVHT_EX_ONCONTENTS: ::UINT = 0x04000000; -pub const LVHT_EX_FOOTER: ::UINT = 0x08000000; -pub type LV_HITTESTINFO = LVHITTESTINFO; -STRUCT!{struct LVHITTESTINFO { - pt: ::POINT, - flags: ::UINT, - iItem: ::c_int, - iSubItem: ::c_int, - iGroup: ::c_int, -}} -pub type LPLVHITTESTINFO = *mut LVHITTESTINFO; -pub const LVM_HITTEST: ::UINT = LVM_FIRST + 18; -pub const LVM_ENSUREVISIBLE: ::UINT = LVM_FIRST + 19; -pub const LVM_SCROLL: ::UINT = LVM_FIRST + 20; -pub const LVM_REDRAWITEMS: ::UINT = LVM_FIRST + 21; -pub const LVA_DEFAULT: ::WPARAM = 0x0000; -pub const LVA_ALIGNLEFT: ::WPARAM = 0x0001; -pub const LVA_ALIGNTOP: ::WPARAM = 0x0002; -pub const LVA_SNAPTOGRID: ::WPARAM = 0x0005; -pub const LVM_ARRANGE: ::UINT = LVM_FIRST + 22; -pub const LVM_EDITLABELA: ::UINT = LVM_FIRST + 23; -pub const LVM_EDITLABELW: ::UINT = LVM_FIRST + 118; -pub const LVM_GETEDITCONTROL: ::UINT = LVM_FIRST + 24; -pub type LV_COLUMNA = LVCOLUMNA; -pub type LV_COLUMNW = LVCOLUMNW; -STRUCT!{struct LVCOLUMNA { - mask: ::UINT, - fmt: ::c_int, - cx: ::c_int, - pszText: ::LPSTR, - cchTextMax: ::c_int, - iSubItem: ::c_int, - iImage: ::c_int, - iOrder: ::c_int, - cxMin: ::c_int, - cxDefault: ::c_int, - cxIdeal: ::c_int, -}} -pub type LPLVCOLUMNA = *mut LVCOLUMNA; -STRUCT!{struct LVCOLUMNW { - mask: ::UINT, - fmt: ::c_int, - cx: ::c_int, - pszText: ::LPWSTR, - cchTextMax: ::c_int, - iSubItem: ::c_int, - iImage: ::c_int, - iOrder: ::c_int, - cxMin: ::c_int, - cxDefault: ::c_int, - cxIdeal: ::c_int, -}} -pub type LPLVCOLUMNW = *mut LVCOLUMNW; -pub const LVCF_FMT: ::UINT = 0x0001; -pub const LVCF_WIDTH: ::UINT = 0x0002; -pub const LVCF_TEXT: ::UINT = 0x0004; -pub const LVCF_SUBITEM: ::UINT = 0x0008; -pub const LVCF_IMAGE: ::UINT = 0x0010; -pub const LVCF_ORDER: ::UINT = 0x0020; -pub const LVCF_MINWIDTH: ::UINT = 0x0040; -pub const LVCF_DEFAULTWIDTH: ::UINT = 0x0080; -pub const LVCF_IDEALWIDTH: ::UINT = 0x0100; -pub const LVCFMT_LEFT: ::c_int = 0x0000; -pub const LVCFMT_RIGHT: ::c_int = 0x0001; -pub const LVCFMT_CENTER: ::c_int = 0x0002; -pub const LVCFMT_JUSTIFYMASK: ::c_int = 0x0003; -pub const LVCFMT_IMAGE: ::c_int = 0x0800; -pub const LVCFMT_BITMAP_ON_RIGHT: ::c_int = 0x1000; -pub const LVCFMT_COL_HAS_IMAGES: ::c_int = 0x8000; -pub const LVCFMT_FIXED_WIDTH: ::c_int = 0x00100; -pub const LVCFMT_NO_DPI_SCALE: ::c_int = 0x40000; -pub const LVCFMT_FIXED_RATIO: ::c_int = 0x80000; -pub const LVCFMT_LINE_BREAK: ::c_int = 0x100000; -pub const LVCFMT_FILL: ::c_int = 0x200000; -pub const LVCFMT_WRAP: ::c_int = 0x400000; -pub const LVCFMT_NO_TITLE: ::c_int = 0x800000; -pub const LVCFMT_TILE_PLACEMENTMASK: ::c_int = LVCFMT_LINE_BREAK | LVCFMT_FILL; -pub const LVCFMT_SPLITBUTTON: ::c_int = 0x1000000; -pub const LVM_GETCOLUMNA: ::UINT = LVM_FIRST + 25; -pub const LVM_GETCOLUMNW: ::UINT = LVM_FIRST + 95; -pub const LVM_SETCOLUMNA: ::UINT = LVM_FIRST + 26; -pub const LVM_SETCOLUMNW: ::UINT = LVM_FIRST + 96; -pub const LVM_INSERTCOLUMNA: ::UINT = LVM_FIRST + 27; -pub const LVM_INSERTCOLUMNW: ::UINT = LVM_FIRST + 97; -pub const LVM_DELETECOLUMN: ::UINT = LVM_FIRST + 28; -pub const LVM_GETCOLUMNWIDTH: ::UINT = LVM_FIRST + 29; -pub const LVM_SETCOLUMNWIDTH: ::UINT = LVM_FIRST + 30; -pub const LVM_GETHEADER: ::UINT = LVM_FIRST + 31; -pub const LVM_CREATEDRAGIMAGE: ::UINT = LVM_FIRST + 33; -pub const LVM_GETVIEWRECT: ::UINT = LVM_FIRST + 34; -pub const LVM_GETTEXTCOLOR: ::UINT = LVM_FIRST + 35; -pub const LVM_SETTEXTCOLOR: ::UINT = LVM_FIRST + 36; -pub const LVM_GETTEXTBKCOLOR: ::UINT = LVM_FIRST + 37; -pub const LVM_SETTEXTBKCOLOR: ::UINT = LVM_FIRST + 38; -pub const LVM_GETTOPINDEX: ::UINT = LVM_FIRST + 39; -pub const LVM_GETCOUNTPERPAGE: ::UINT = LVM_FIRST + 40; -pub const LVM_GETORIGIN: ::UINT = LVM_FIRST + 41; -pub const LVM_UPDATE: ::UINT = LVM_FIRST + 42; -pub const LVM_SETITEMSTATE: ::UINT = LVM_FIRST + 43; -pub const LVM_GETITEMSTATE: ::UINT = LVM_FIRST + 44; -pub const LVM_GETITEMTEXTA: ::UINT = LVM_FIRST + 45; -pub const LVM_GETITEMTEXTW: ::UINT = LVM_FIRST + 115; -pub const LVM_SETITEMTEXTA: ::UINT = LVM_FIRST + 46; -pub const LVM_SETITEMTEXTW: ::UINT = LVM_FIRST + 116; -pub const LVM_SETITEMCOUNT: ::UINT = LVM_FIRST + 47; -pub const LVM_SORTITEMS: ::UINT = LVM_FIRST + 48; -pub const LVM_SETITEMPOSITION32: ::UINT = LVM_FIRST + 49; -pub const LVM_GETSELECTEDCOUNT: ::UINT = LVM_FIRST + 50; -pub const LVM_GETITEMSPACING: ::UINT = LVM_FIRST + 51; -pub const LVM_GETISEARCHSTRINGA: ::UINT = LVM_FIRST + 52; -pub const LVM_GETISEARCHSTRINGW: ::UINT = LVM_FIRST + 117; -pub const LVM_SETICONSPACING: ::UINT = LVM_FIRST + 53; -pub const LVM_SETEXTENDEDLISTVIEWSTYLE: ::UINT = LVM_FIRST + 54; -pub const LVM_GETEXTENDEDLISTVIEWSTYLE: ::UINT = LVM_FIRST + 55; -pub const LVSICF_NOINVALIDATEALL: ::LPARAM = 0x00000001; -pub const LVSICF_NOSCROLL: ::LPARAM = 0x00000002; -pub const LVS_EX_GRIDLINES: ::DWORD = 0x00000001; -pub const LVS_EX_SUBITEMIMAGES: ::DWORD = 0x00000002; -pub const LVS_EX_CHECKBOXES: ::DWORD = 0x00000004; -pub const LVS_EX_TRACKSELECT: ::DWORD = 0x00000008; -pub const LVS_EX_HEADERDRAGDROP: ::DWORD = 0x00000010; -pub const LVS_EX_FULLROWSELECT: ::DWORD = 0x00000020; -pub const LVS_EX_ONECLICKACTIVATE: ::DWORD = 0x00000040; -pub const LVS_EX_TWOCLICKACTIVATE: ::DWORD = 0x00000080; -pub const LVS_EX_FLATSB: ::DWORD = 0x00000100; -pub const LVS_EX_REGIONAL: ::DWORD = 0x00000200; -pub const LVS_EX_INFOTIP: ::DWORD = 0x00000400; -pub const LVS_EX_UNDERLINEHOT: ::DWORD = 0x00000800; -pub const LVS_EX_UNDERLINECOLD: ::DWORD = 0x00001000; -pub const LVS_EX_MULTIWORKAREAS: ::DWORD = 0x00002000; -pub const LVS_EX_LABELTIP: ::DWORD = 0x00004000; -pub const LVS_EX_BORDERSELECT: ::DWORD = 0x00008000; -pub const LVS_EX_DOUBLEBUFFER: ::DWORD = 0x00010000; -pub const LVS_EX_HIDELABELS: ::DWORD = 0x00020000; -pub const LVS_EX_SINGLEROW: ::DWORD = 0x00040000; -pub const LVS_EX_SNAPTOGRID: ::DWORD = 0x00080000; -pub const LVS_EX_SIMPLESELECT: ::DWORD = 0x00100000; -pub const LVS_EX_JUSTIFYCOLUMNS: ::DWORD = 0x00200000; -pub const LVS_EX_TRANSPARENTBKGND: ::DWORD = 0x00400000; -pub const LVS_EX_TRANSPARENTSHADOWTEXT: ::DWORD = 0x00800000; -pub const LVS_EX_AUTOAUTOARRANGE: ::DWORD = 0x01000000; -pub const LVS_EX_HEADERINALLVIEWS: ::DWORD = 0x02000000; -pub const LVS_EX_AUTOCHECKSELECT: ::DWORD = 0x08000000; -pub const LVS_EX_AUTOSIZECOLUMNS: ::DWORD = 0x10000000; -pub const LVS_EX_COLUMNSNAPPOINTS: ::DWORD = 0x40000000; -pub const LVS_EX_COLUMNOVERFLOW: ::DWORD = 0x80000000; -pub const LVM_GETSUBITEMRECT: ::UINT = LVM_FIRST + 56; -pub const LVM_SUBITEMHITTEST: ::UINT = LVM_FIRST + 57; -pub const LVM_SETCOLUMNORDERARRAY: ::UINT = LVM_FIRST + 58; -pub const LVM_GETCOLUMNORDERARRAY: ::UINT = LVM_FIRST + 59; -pub const LVM_SETHOTITEM: ::UINT = LVM_FIRST + 60; -pub const LVM_GETHOTITEM: ::UINT = LVM_FIRST + 61; -pub const LVM_SETHOTCURSOR: ::UINT = LVM_FIRST + 62; -pub const LVM_GETHOTCURSOR: ::UINT = LVM_FIRST + 63; -pub const LVM_APPROXIMATEVIEWRECT: ::UINT = LVM_FIRST + 64; -pub const LV_MAX_WORKAREAS: ::WPARAM = 16; -pub const LVM_SETWORKAREAS: ::UINT = LVM_FIRST + 65; -pub const LVM_GETWORKAREAS: ::UINT = LVM_FIRST + 70; -pub const LVM_GETNUMBEROFWORKAREAS: ::UINT = LVM_FIRST + 73; -pub const LVM_GETSELECTIONMARK: ::UINT = LVM_FIRST + 66; -pub const LVM_SETSELECTIONMARK: ::UINT = LVM_FIRST + 67; -pub const LVM_SETHOVERTIME: ::UINT = LVM_FIRST + 71; -pub const LVM_GETHOVERTIME: ::UINT = LVM_FIRST + 72; -pub const LVM_SETTOOLTIPS: ::UINT = LVM_FIRST + 74; -pub const LVM_GETTOOLTIPS: ::UINT = LVM_FIRST + 78; -pub const LVM_SORTITEMSEX: ::UINT = LVM_FIRST + 81; -STRUCT!{struct LVBKIMAGEA { - ulFlags: ::ULONG, - hbm: ::HBITMAP, - pszImage: ::LPSTR, - cchImageMax: ::UINT, - xOffsetPercent: ::c_int, - yOffsetPercent: ::c_int, -}} -pub type LPLVBKIMAGEA = *mut LVBKIMAGEA; -STRUCT!{struct LVBKIMAGEW { - ulFlags: ::ULONG, - hbm: ::HBITMAP, - pszImage: ::LPWSTR, - cchImageMax: ::UINT, - xOffsetPercent: ::c_int, - yOffsetPercent: ::c_int, -}} -pub type LPLVBKIMAGEW = *mut LVBKIMAGEW; -pub const LVBKIF_SOURCE_NONE: ::ULONG = 0x00000000; -pub const LVBKIF_SOURCE_HBITMAP: ::ULONG = 0x00000001; -pub const LVBKIF_SOURCE_URL: ::ULONG = 0x00000002; -pub const LVBKIF_SOURCE_MASK: ::ULONG = 0x00000003; -pub const LVBKIF_STYLE_NORMAL: ::ULONG = 0x00000000; -pub const LVBKIF_STYLE_TILE: ::ULONG = 0x00000010; -pub const LVBKIF_STYLE_MASK: ::ULONG = 0x00000010; -pub const LVBKIF_FLAG_TILEOFFSET: ::ULONG = 0x00000100; -pub const LVBKIF_TYPE_WATERMARK: ::ULONG = 0x10000000; -pub const LVBKIF_FLAG_ALPHABLEND: ::ULONG = 0x20000000; -pub const LVM_SETBKIMAGEA: ::UINT = LVM_FIRST + 68; -pub const LVM_SETBKIMAGEW: ::UINT = LVM_FIRST + 138; -pub const LVM_GETBKIMAGEA: ::UINT = LVM_FIRST + 69; -pub const LVM_GETBKIMAGEW: ::UINT = LVM_FIRST + 139; -pub const LVM_SETSELECTEDCOLUMN: ::UINT = LVM_FIRST + 140; -pub const LV_VIEW_ICON: ::DWORD = 0x0000; -pub const LV_VIEW_DETAILS: ::DWORD = 0x0001; -pub const LV_VIEW_SMALLICON: ::DWORD = 0x0002; -pub const LV_VIEW_LIST: ::DWORD = 0x0003; -pub const LV_VIEW_TILE: ::DWORD = 0x0004; -pub const LV_VIEW_MAX: ::DWORD = 0x0004; -pub const LVM_SETVIEW: ::UINT = LVM_FIRST + 142; -pub const LVM_GETVIEW: ::UINT = LVM_FIRST + 143; -pub const LVGF_NONE: ::UINT = 0x00000000; -pub const LVGF_HEADER: ::UINT = 0x00000001; -pub const LVGF_FOOTER: ::UINT = 0x00000002; -pub const LVGF_STATE: ::UINT = 0x00000004; -pub const LVGF_ALIGN: ::UINT = 0x00000008; -pub const LVGF_GROUPID: ::UINT = 0x00000010; -pub const LVGF_SUBTITLE: ::UINT = 0x00000100; -pub const LVGF_TASK: ::UINT = 0x00000200; -pub const LVGF_DESCRIPTIONTOP: ::UINT = 0x00000400; -pub const LVGF_DESCRIPTIONBOTTOM: ::UINT = 0x00000800; -pub const LVGF_TITLEIMAGE: ::UINT = 0x00001000; -pub const LVGF_EXTENDEDIMAGE: ::UINT = 0x00002000; -pub const LVGF_ITEMS: ::UINT = 0x00004000; -pub const LVGF_SUBSET: ::UINT = 0x00008000; -pub const LVGF_SUBSETITEMS: ::UINT = 0x00010000; -pub const LVGS_NORMAL: ::UINT = 0x00000000; -pub const LVGS_COLLAPSED: ::UINT = 0x00000001; -pub const LVGS_HIDDEN: ::UINT = 0x00000002; -pub const LVGS_NOHEADER: ::UINT = 0x00000004; -pub const LVGS_COLLAPSIBLE: ::UINT = 0x00000008; -pub const LVGS_FOCUSED: ::UINT = 0x00000010; -pub const LVGS_SELECTED: ::UINT = 0x00000020; -pub const LVGS_SUBSETED: ::UINT = 0x00000040; -pub const LVGS_SUBSETLINKFOCUSED: ::UINT = 0x00000080; -pub const LVGA_HEADER_LEFT: ::UINT = 0x00000001; -pub const LVGA_HEADER_CENTER: ::UINT = 0x00000002; -pub const LVGA_HEADER_RIGHT: ::UINT = 0x00000004; -pub const LVGA_FOOTER_LEFT: ::UINT = 0x00000008; -pub const LVGA_FOOTER_CENTER: ::UINT = 0x00000010; -pub const LVGA_FOOTER_RIGHT: ::UINT = 0x00000020; -STRUCT!{struct LVGROUP { - cbSize: ::UINT, - mask: ::UINT, - pszHeader: ::LPWSTR, - cchHeader: ::c_int, - pszFooter: ::LPWSTR, - cchFooter: ::c_int, - iGroupId: ::c_int, - stateMask: ::UINT, - state: ::UINT, - uAlign: ::UINT, - pszSubtitle: ::LPWSTR, - cchSubtitle: ::UINT, - pszTask: ::LPWSTR, - cchTask: ::UINT, - pszDescriptionTop: ::LPWSTR, - cchDescriptionTop: ::UINT, - pszDescriptionBottom: ::LPWSTR, - cchDescriptionBottom: ::UINT, - iTitleImage: ::c_int, - iExtendedImage: ::c_int, - iFirstItem: ::c_int, - cItems: ::UINT, - pszSubsetTitle: ::LPWSTR, - cchSubsetTitle: ::UINT, -}} -pub type PLVGROUP = *mut LVGROUP; -pub const LVM_INSERTGROUP: ::UINT = LVM_FIRST + 145; -pub const LVM_SETGROUPINFO: ::UINT = LVM_FIRST + 147; -pub const LVM_GETGROUPINFO: ::UINT = LVM_FIRST + 149; -pub const LVM_REMOVEGROUP: ::UINT = LVM_FIRST + 150; -pub const LVM_MOVEGROUP: ::UINT = LVM_FIRST + 151; -pub const LVM_GETGROUPCOUNT: ::UINT = LVM_FIRST + 152; -pub const LVM_GETGROUPINFOBYINDEX: ::UINT = LVM_FIRST + 153; -pub const LVM_MOVEITEMTOGROUP: ::UINT = LVM_FIRST + 154; -pub const LVM_GETGROUPRECT: ::UINT = LVM_FIRST + 98; -pub const LVGGR_GROUP: ::LPARAM = 0; -pub const LVGGR_HEADER: ::LPARAM = 1; -pub const LVGGR_LABEL: ::LPARAM = 2; -pub const LVGGR_SUBSETLINK: ::LPARAM = 3; -pub const LVGMF_NONE: ::UINT = 0x00000000; -pub const LVGMF_BORDERSIZE: ::UINT = 0x00000001; -pub const LVGMF_BORDERCOLOR: ::UINT = 0x00000002; -pub const LVGMF_TEXTCOLOR: ::UINT = 0x00000004; -STRUCT!{struct LVGROUPMETRICS { - cbSize: ::UINT, - mask: ::UINT, - Left: ::UINT, - Top: ::UINT, - Right: ::UINT, - Bottom: ::UINT, - crLeft: ::COLORREF, - crTop: ::COLORREF, - crRight: ::COLORREF, - crBottom: ::COLORREF, - crHeader: ::COLORREF, - crFooter: ::COLORREF, -}} -pub type PLVGROUPMETRICS = *mut LVGROUPMETRICS; -pub const LVM_SETGROUPMETRICS: ::UINT = LVM_FIRST + 155; -pub const LVM_GETGROUPMETRICS: ::UINT = LVM_FIRST + 156; -pub const LVM_ENABLEGROUPVIEW: ::UINT = LVM_FIRST + 157; -pub const LVM_SORTGROUPS: ::UINT = LVM_FIRST + 158; -pub type PFNLVGROUPCOMPARE = Option ::c_int>; -STRUCT!{nodebug struct LVINSERTGROUPSORTED { - pfnGroupCompare: PFNLVGROUPCOMPARE, - pvData: *mut ::c_void, - lvGroup: LVGROUP, -}} -pub type PLVINSERTGROUPSORTED = *mut LVINSERTGROUPSORTED; -pub const LVM_INSERTGROUPSORTED: ::UINT = LVM_FIRST + 159; -pub const LVM_REMOVEALLGROUPS: ::UINT = LVM_FIRST + 160; -pub const LVM_HASGROUP: ::UINT = LVM_FIRST + 161; -pub const LVM_GETGROUPSTATE: ::UINT = LVM_FIRST + 92; -pub const LVM_GETFOCUSEDGROUP: ::UINT = LVM_FIRST + 93; -pub const LVTVIF_AUTOSIZE: ::DWORD = 0x00000000; -pub const LVTVIF_FIXEDWIDTH: ::DWORD = 0x00000001; -pub const LVTVIF_FIXEDHEIGHT: ::DWORD = 0x00000002; -pub const LVTVIF_FIXEDSIZE: ::DWORD = 0x00000003; -pub const LVTVIF_EXTENDED: ::DWORD = 0x00000004; -pub const LVTVIM_TILESIZE: ::DWORD = 0x00000001; -pub const LVTVIM_COLUMNS: ::DWORD = 0x00000002; -pub const LVTVIM_LABELMARGIN: ::DWORD = 0x00000004; -STRUCT!{struct LVTILEVIEWINFO { - cbSize: ::UINT, - dwMask: ::DWORD, - dwFlags: ::DWORD, - sizeTile: ::SIZE, - cLines: ::c_int, - rcLabelMargin: ::RECT, -}} -pub type PLVTILEVIEWINFO = *mut LVTILEVIEWINFO; -STRUCT!{struct LVTILEINFO { - cbSize: ::UINT, - iItem: ::c_int, - cColumns: ::UINT, - puColumns: ::PUINT, - piColFmt: *mut ::c_int, -}} -pub type PLVTILEINFO = *mut LVTILEINFO; -pub const LVM_SETTILEVIEWINFO: ::UINT = LVM_FIRST + 162; -pub const LVM_GETTILEVIEWINFO: ::UINT = LVM_FIRST + 163; -pub const LVM_SETTILEINFO: ::UINT = LVM_FIRST + 164; -pub const LVM_GETTILEINFO: ::UINT = LVM_FIRST + 165; -STRUCT!{struct LVINSERTMARK { - cbSize: ::UINT, - dwFlags: ::DWORD, - iItem: ::c_int, - dwReserved: ::DWORD, -}} -pub type LPLVINSERTMARK = *mut LVINSERTMARK; -pub const LVIM_AFTER: ::DWORD = 0x00000001; -pub const LVM_SETINSERTMARK: ::UINT = LVM_FIRST + 166; -pub const LVM_GETINSERTMARK: ::UINT = LVM_FIRST + 167; -pub const LVM_INSERTMARKHITTEST: ::UINT = LVM_FIRST + 168; -pub const LVM_GETINSERTMARKRECT: ::UINT = LVM_FIRST + 169; -pub const LVM_SETINSERTMARKCOLOR: ::UINT = LVM_FIRST + 170; -pub const LVM_GETINSERTMARKCOLOR: ::UINT = LVM_FIRST + 171; -STRUCT!{struct LVSETINFOTIP { - cbSize: ::UINT, - dwFlags: ::DWORD, - pszText: ::LPWSTR, - iItem: ::c_int, - iSubItem: ::c_int, -}} -pub type PLVSETINFOTIP = *mut LVSETINFOTIP; -pub const LVM_SETINFOTIP: ::UINT = LVM_FIRST + 173; -pub const LVM_GETSELECTEDCOLUMN: ::UINT = LVM_FIRST + 174; -pub const LVM_ISGROUPVIEWENABLED: ::UINT = LVM_FIRST + 175; -pub const LVM_GETOUTLINECOLOR: ::UINT = LVM_FIRST + 176; -pub const LVM_SETOUTLINECOLOR: ::UINT = LVM_FIRST + 177; -pub const LVM_CANCELEDITLABEL: ::UINT = LVM_FIRST + 179; -pub const LVM_MAPINDEXTOID: ::UINT = LVM_FIRST + 180; -pub const LVM_MAPIDTOINDEX: ::UINT = LVM_FIRST + 181; -pub const LVM_ISITEMVISIBLE: ::UINT = LVM_FIRST + 182; -pub const LVM_GETEMPTYTEXT: ::UINT = LVM_FIRST + 204; -pub const LVM_GETFOOTERRECT: ::UINT = LVM_FIRST + 205; -pub const LVFF_ITEMCOUNT: ::UINT = 0x00000001; -STRUCT!{struct LVFOOTERINFO { - mask: ::UINT, - pszText: ::LPWSTR, - cchTextMax: ::c_int, - cItems: ::UINT, -}} -pub type LPLVFOOTERINFO = *mut LVFOOTERINFO; -pub const LVM_GETFOOTERINFO: ::UINT = LVM_FIRST + 206; -pub const LVM_GETFOOTERITEMRECT: ::UINT = LVM_FIRST + 207; -pub const LVFIF_TEXT: ::UINT = 0x00000001; -pub const LVFIF_STATE: ::UINT = 0x00000002; -pub const LVFIS_FOCUSED: ::UINT = 0x0001; -STRUCT!{struct LVFOOTERITEM { - mask: ::UINT, - iItem: ::c_int, - pszText: ::LPWSTR, - cchTextMax: ::c_int, - state: ::UINT, - stateMask: ::UINT, -}} -pub type LPLVFOOTERITEM = *mut LVFOOTERITEM; -pub const LVM_GETFOOTERITEM: ::UINT = LVM_FIRST + 208; -STRUCT!{struct LVITEMINDEX { - iItem: ::c_int, - iGroup: ::c_int, -}} -pub type PLVITEMINDEX = *mut LVITEMINDEX; -pub const LVM_GETITEMINDEXRECT: ::UINT = LVM_FIRST + 209; -pub const LVM_SETITEMINDEXSTATE: ::UINT = LVM_FIRST + 210; -pub const LVM_GETNEXTITEMINDEX: ::UINT = LVM_FIRST + 211; -pub type LPNM_LISTVIEW = LPNMLISTVIEW; -pub type NM_LISTVIEW = NMLISTVIEW; -STRUCT!{struct NMLISTVIEW { - hdr: ::NMHDR, - iItem: ::c_int, - iSubItem: ::c_int, - uNewState: ::UINT, - uOldState: ::UINT, - uChanged: ::UINT, - ptAction: ::POINT, - lParam: ::LPARAM, -}} -pub type LPNMLISTVIEW = *mut NMLISTVIEW; -STRUCT!{struct NMITEMACTIVATE { - hdr: ::NMHDR, - iItem: ::c_int, - iSubItem: ::c_int, - uNewState: ::UINT, - uOldState: ::UINT, - uChanged: ::UINT, - ptAction: ::POINT, - lParam: ::LPARAM, - uKeyFlags: ::UINT, -}} -pub type LPNMITEMACTIVATE = *mut NMITEMACTIVATE; -pub const LVKF_ALT: ::UINT = 0x0001; -pub const LVKF_CONTROL: ::UINT = 0x0002; -pub const LVKF_SHIFT: ::UINT = 0x0004; -STRUCT!{struct NMLVCUSTOMDRAW { - nmcd: NMCUSTOMDRAW, - clrText: ::COLORREF, - clrTextBk: ::COLORREF, - iSubItem: ::c_int, - dwItemType: ::DWORD, - clrFace: ::COLORREF, - iIconEffect: ::c_int, - iIconPhase: ::c_int, - iPartId: ::c_int, - iStateId: ::c_int, - rcText: ::RECT, - uAlign: ::UINT, -}} -pub type LPNMLVCUSTOMDRAW = *mut NMLVCUSTOMDRAW; -pub const LVCDI_ITEM: ::DWORD = 0x00000000; -pub const LVCDI_GROUP: ::DWORD = 0x00000001; -pub const LVCDI_ITEMSLIST: ::DWORD = 0x00000002; -pub const LVCDRF_NOSELECT: ::LRESULT = 0x00010000; -pub const LVCDRF_NOGROUPFRAME: ::LRESULT = 0x00020000; -STRUCT!{struct NMLVCACHEHINT { - hdr: ::NMHDR, - iFrom: ::c_int, - iTo: ::c_int, -}} -pub type LPNMLVCACHEHINT = *mut NMLVCACHEHINT; -pub type LPNM_CACHEHINT = LPNMLVCACHEHINT; -pub type PNM_CACHEHINT = LPNMLVCACHEHINT; -pub type NM_CACHEHINT = NMLVCACHEHINT; -STRUCT!{struct NMLVFINDITEMA { - hdr: ::NMHDR, - iStart: ::c_int, - lvfi: LVFINDINFOA, -}} -pub type LPNMLVFINDITEMA = *mut NMLVFINDITEMA; -STRUCT!{struct NMLVFINDITEMW { - hdr: ::NMHDR, - iStart: ::c_int, - lvfi: LVFINDINFOW, -}} -pub type LPNMLVFINDITEMW = *mut NMLVFINDITEMW; -pub type PNM_FINDITEMA = LPNMLVFINDITEMA; -pub type LPNM_FINDITEMA = LPNMLVFINDITEMA; -pub type NM_FINDITEMA = NMLVFINDITEMA; -pub type PNM_FINDITEMW = LPNMLVFINDITEMW; -pub type LPNM_FINDITEMW = LPNMLVFINDITEMW; -pub type NM_FINDITEMW = NMLVFINDITEMW; -STRUCT!{struct NMLVODSTATECHANGE { - hdr: ::NMHDR, - iFrom: ::c_int, - iTo: ::c_int, - uNewState: ::UINT, - uOldState: ::UINT, -}} -pub type LPNMLVODSTATECHANGE = *mut NMLVODSTATECHANGE; -pub type PNM_ODSTATECHANGE = LPNMLVODSTATECHANGE; -pub type LPNM_ODSTATECHANGE = LPNMLVODSTATECHANGE; -pub type NM_ODSTATECHANGE = NMLVODSTATECHANGE; -pub const LVN_ITEMCHANGING: ::UINT = LVN_FIRST - 0; -pub const LVN_ITEMCHANGED: ::UINT = LVN_FIRST - 1; -pub const LVN_INSERTITEM: ::UINT = LVN_FIRST - 2; -pub const LVN_DELETEITEM: ::UINT = LVN_FIRST - 3; -pub const LVN_DELETEALLITEMS: ::UINT = LVN_FIRST - 4; -pub const LVN_BEGINLABELEDITA: ::UINT = LVN_FIRST - 5; -pub const LVN_BEGINLABELEDITW: ::UINT = LVN_FIRST - 75; -pub const LVN_ENDLABELEDITA: ::UINT = LVN_FIRST - 6; -pub const LVN_ENDLABELEDITW: ::UINT = LVN_FIRST - 76; -pub const LVN_COLUMNCLICK: ::UINT = LVN_FIRST - 8; -pub const LVN_BEGINDRAG: ::UINT = LVN_FIRST - 9; -pub const LVN_BEGINRDRAG: ::UINT = LVN_FIRST - 11; -pub const LVN_ODCACHEHINT: ::UINT = LVN_FIRST - 13; -pub const LVN_ODFINDITEMA: ::UINT = LVN_FIRST - 52; -pub const LVN_ODFINDITEMW: ::UINT = LVN_FIRST - 79; -pub const LVN_ITEMACTIVATE: ::UINT = LVN_FIRST - 14; -pub const LVN_ODSTATECHANGED: ::UINT = LVN_FIRST - 15; -pub const LVN_HOTTRACK: ::UINT = LVN_FIRST - 21; -pub const LVN_GETDISPINFOA: ::UINT = LVN_FIRST - 50; -pub const LVN_GETDISPINFOW: ::UINT = LVN_FIRST - 77; -pub const LVN_SETDISPINFOA: ::UINT = LVN_FIRST - 51; -pub const LVN_SETDISPINFOW: ::UINT = LVN_FIRST - 78; -pub const LVIF_DI_SETITEM: ::UINT = 0x1000; -pub type LV_DISPINFOA = NMLVDISPINFOA; -pub type LV_DISPINFOW = NMLVDISPINFOW; -STRUCT!{struct NMLVDISPINFOA { - hdr: ::NMHDR, - item: LVITEMA, -}} -pub type LPNMLVDISPINFOA = *mut NMLVDISPINFOA; -STRUCT!{struct NMLVDISPINFOW { - hdr: ::NMHDR, - item: LVITEMW, -}} -pub type LPNMLVDISPINFOW = *mut NMLVDISPINFOW; -pub const LVN_KEYDOWN: ::UINT = LVN_FIRST - 55; -pub type LV_KEYDOWN = NMLVKEYDOWN; -STRUCT!{struct NMLVKEYDOWN { - hdr: ::NMHDR, - wVKey: ::WORD, - flags: ::UINT, -}} -pub type LPNMLVKEYDOWN = *mut NMLVKEYDOWN; -pub const LVN_MARQUEEBEGIN: ::UINT = LVN_FIRST - 56; -STRUCT!{nodebug struct NMLVLINK { - hdr: ::NMHDR, - link: LITEM, - iItem: ::c_int, - iSubItem: ::c_int, -}} -pub type PNMLVLINK = *mut NMLVLINK; -STRUCT!{struct NMLVGETINFOTIPA { - hdr: ::NMHDR, - dwFlags: ::DWORD, - pszText: ::LPSTR, - cchTextMax: ::c_int, - iItem: ::c_int, - iSubItem: ::c_int, - lParam: ::LPARAM, -}} -pub type LPNMLVGETINFOTIPA = *mut NMLVGETINFOTIPA; -STRUCT!{struct NMLVGETINFOTIPW { - hdr: ::NMHDR, - dwFlags: ::DWORD, - pszText: ::LPWSTR, - cchTextMax: ::c_int, - iItem: ::c_int, - iSubItem: ::c_int, - lParam: ::LPARAM, -}} -pub type LPNMLVGETINFOTIPW = *mut NMLVGETINFOTIPW; -pub const LVGIT_UNFOLDED: ::DWORD = 0x0001; -pub const LVN_GETINFOTIPA: ::UINT = LVN_FIRST - 57; -pub const LVN_GETINFOTIPW: ::UINT = LVN_FIRST - 58; -pub const LVNSCH_DEFAULT: ::LPARAM = -1; -pub const LVNSCH_ERROR: ::LPARAM = -2; -pub const LVNSCH_IGNORE: ::LPARAM = -3; -pub const LVN_INCREMENTALSEARCHA: ::UINT = LVN_FIRST - 62; -pub const LVN_INCREMENTALSEARCHW: ::UINT = LVN_FIRST - 63; -pub const LVN_COLUMNDROPDOWN: ::UINT = LVN_FIRST - 64; -pub const LVN_COLUMNOVERFLOWCLICK: ::UINT = LVN_FIRST - 66; -STRUCT!{struct NMLVSCROLL { - hdr: ::NMHDR, - dx: ::c_int, - dy: ::c_int, -}} -pub type LPNMLVSCROLL = *mut NMLVSCROLL; -pub const LVN_BEGINSCROLL: ::UINT = LVN_FIRST - 80; -pub const LVN_ENDSCROLL: ::UINT = LVN_FIRST - 81; -pub const LVN_LINKCLICK: ::UINT = LVN_FIRST - 84; -pub const EMF_CENTERED: ::DWORD = 0x00000001; -STRUCT!{nodebug struct NMLVEMPTYMARKUP { - hdr: ::NMHDR, - dwFlags: ::DWORD, - szMarkup: [::WCHAR; L_MAX_URL_LENGTH], -}} -pub const LVN_GETEMPTYMARKUP: ::UINT = LVN_FIRST - 87; -pub const TVS_HASBUTTONS: ::DWORD = 0x0001; -pub const TVS_HASLINES: ::DWORD = 0x0002; -pub const TVS_LINESATROOT: ::DWORD = 0x0004; -pub const TVS_EDITLABELS: ::DWORD = 0x0008; -pub const TVS_DISABLEDRAGDROP: ::DWORD = 0x0010; -pub const TVS_SHOWSELALWAYS: ::DWORD = 0x0020; -pub const TVS_RTLREADING: ::DWORD = 0x0040; -pub const TVS_NOTOOLTIPS: ::DWORD = 0x0080; -pub const TVS_CHECKBOXES: ::DWORD = 0x0100; -pub const TVS_TRACKSELECT: ::DWORD = 0x0200; -pub const TVS_SINGLEEXPAND: ::DWORD = 0x0400; -pub const TVS_INFOTIP: ::DWORD = 0x0800; -pub const TVS_FULLROWSELECT: ::DWORD = 0x1000; -pub const TVS_NOSCROLL: ::DWORD = 0x2000; -pub const TVS_NONEVENHEIGHT: ::DWORD = 0x4000; -pub const TVS_NOHSCROLL: ::DWORD = 0x8000; -pub const TVS_EX_NOSINGLECOLLAPSE: ::DWORD = 0x0001; -pub const TVS_EX_MULTISELECT: ::DWORD = 0x0002; -pub const TVS_EX_DOUBLEBUFFER: ::DWORD = 0x0004; -pub const TVS_EX_NOINDENTSTATE: ::DWORD = 0x0008; -pub const TVS_EX_RICHTOOLTIP: ::DWORD = 0x0010; -pub const TVS_EX_AUTOHSCROLL: ::DWORD = 0x0020; -pub const TVS_EX_FADEINOUTEXPANDOS: ::DWORD = 0x0040; -pub const TVS_EX_PARTIALCHECKBOXES: ::DWORD = 0x0080; -pub const TVS_EX_EXCLUSIONCHECKBOXES: ::DWORD = 0x0100; -pub const TVS_EX_DIMMEDCHECKBOXES: ::DWORD = 0x0200; -pub const TVS_EX_DRAWIMAGEASYNC: ::DWORD = 0x0400; -pub enum TREEITEM {} -pub type HTREEITEM = *mut TREEITEM; -pub const TVIF_TEXT: ::UINT = 0x0001; -pub const TVIF_IMAGE: ::UINT = 0x0002; -pub const TVIF_PARAM: ::UINT = 0x0004; -pub const TVIF_STATE: ::UINT = 0x0008; -pub const TVIF_HANDLE: ::UINT = 0x0010; -pub const TVIF_SELECTEDIMAGE: ::UINT = 0x0020; -pub const TVIF_CHILDREN: ::UINT = 0x0040; -pub const TVIF_INTEGRAL: ::UINT = 0x0080; -pub const TVIF_STATEEX: ::UINT = 0x0100; -pub const TVIF_EXPANDEDIMAGE: ::UINT = 0x0200; -pub const TVIS_SELECTED: ::UINT = 0x0002; -pub const TVIS_CUT: ::UINT = 0x0004; -pub const TVIS_DROPHILITED: ::UINT = 0x0008; -pub const TVIS_BOLD: ::UINT = 0x0010; -pub const TVIS_EXPANDED: ::UINT = 0x0020; -pub const TVIS_EXPANDEDONCE: ::UINT = 0x0040; -pub const TVIS_EXPANDPARTIAL: ::UINT = 0x0080; -pub const TVIS_OVERLAYMASK: ::UINT = 0x0F00; -pub const TVIS_STATEIMAGEMASK: ::UINT = 0xF000; -pub const TVIS_USERMASK: ::UINT = 0xF000; -pub const TVIS_EX_FLAT: ::UINT = 0x0001; -pub const TVIS_EX_DISABLED: ::UINT = 0x0002; -pub const TVIS_EX_ALL: ::UINT = 0x0002; -STRUCT!{struct NMTVSTATEIMAGECHANGING { - hdr: ::NMHDR, - hti: HTREEITEM, - iOldStateImageIndex: ::c_int, - iNewStateImageIndex: ::c_int, -}} -pub type LPNMTVSTATEIMAGECHANGING = *mut NMTVSTATEIMAGECHANGING; -pub const I_CHILDRENCALLBACK: ::c_int = -1; -pub const I_CHILDRENAUTO: ::c_int = -2; -pub type LPTV_ITEMW = LPTVITEMW; -pub type LPTV_ITEMA = LPTVITEMA; -pub type TV_ITEMW = TVITEMW; -pub type TV_ITEMA = TVITEMA; -STRUCT!{struct TVITEMA { - mask: ::UINT, - hItem: HTREEITEM, - state: ::UINT, - stateMask: ::UINT, - pszText: ::LPSTR, - cchTextMax: ::c_int, - iImage: ::c_int, - iSelectedImage: ::c_int, - cChildren: ::c_int, - lParam: ::LPARAM, -}} -pub type LPTVITEMA = *mut TVITEMA; -STRUCT!{struct TVITEMW { - mask: ::UINT, - hItem: HTREEITEM, - state: ::UINT, - stateMask: ::UINT, - pszText: ::LPWSTR, - cchTextMax: ::c_int, - iImage: ::c_int, - iSelectedImage: ::c_int, - cChildren: ::c_int, - lParam: ::LPARAM, -}} -pub type LPTVITEMW = *mut TVITEMW; -STRUCT!{struct TVITEMEXA { - mask: ::UINT, - hItem: HTREEITEM, - state: ::UINT, - stateMask: ::UINT, - pszText: ::LPSTR, - cchTextMax: ::c_int, - iImage: ::c_int, - iSelectedImage: ::c_int, - cChildren: ::c_int, - lParam: ::LPARAM, - iIntegral: ::c_int, - uStateEx: ::UINT, - hwnd: ::HWND, - iExpandedImage: ::c_int, - iReserved: ::c_int, -}} -pub type LPTVITEMEXA = *mut TVITEMEXA; -STRUCT!{struct TVITEMEXW { - mask: ::UINT, - hItem: HTREEITEM, - state: ::UINT, - stateMask: ::UINT, - pszText: ::LPWSTR, - cchTextMax: ::c_int, - iImage: ::c_int, - iSelectedImage: ::c_int, - cChildren: ::c_int, - lParam: ::LPARAM, - iIntegral: ::c_int, - uStateEx: ::UINT, - hwnd: ::HWND, - iExpandedImage: ::c_int, - iReserved: ::c_int, -}} -pub type LPTVITEMEXW = *mut TVITEMEXW; -pub const TVI_ROOT: HTREEITEM = (0 - 0x10000) as HTREEITEM; -pub const TVI_FIRST: HTREEITEM = (0 - 0x0FFFF) as HTREEITEM; -pub const TVI_LAST: HTREEITEM = (0 - 0x0FFFE) as HTREEITEM; -pub const TVI_SORT: HTREEITEM = (0 - 0x0FFFD) as HTREEITEM; -pub type LPTV_INSERTSTRUCTA = LPTVINSERTSTRUCTA; -pub type LPTV_INSERTSTRUCTW = LPTVINSERTSTRUCTW; -pub type TV_INSERTSTRUCTA = TVINSERTSTRUCTA; -pub type TV_INSERTSTRUCTW = TVINSERTSTRUCTW; -STRUCT!{struct TVINSERTSTRUCTA { - hParent: HTREEITEM, - hInsertAfter: HTREEITEM, - itemex: TVITEMEXA, -}} -UNION!(TVINSERTSTRUCTA, itemex, item, item_mut, TV_ITEMA); -pub type LPTVINSERTSTRUCTA = *mut TVINSERTSTRUCTA; -STRUCT!{struct TVINSERTSTRUCTW { - hParent: HTREEITEM, - hInsertAfter: HTREEITEM, - itemex: TVITEMEXW, -}} -UNION!(TVINSERTSTRUCTW, itemex, item, item_mut, TV_ITEMW); -pub type LPTVINSERTSTRUCTW = *mut TVINSERTSTRUCTW; -pub const TVM_INSERTITEMA: ::UINT = TV_FIRST + 0; -pub const TVM_INSERTITEMW: ::UINT = TV_FIRST + 50; -pub const TVM_DELETEITEM: ::UINT = TV_FIRST + 1; -pub const TVM_EXPAND: ::UINT = TV_FIRST + 2; -pub const TVM_GETITEMRECT: ::UINT = TV_FIRST + 4; -pub const TVE_COLLAPSE: ::WPARAM = 0x0001; -pub const TVE_EXPAND: ::WPARAM = 0x0002; -pub const TVE_TOGGLE: ::WPARAM = 0x0003; -pub const TVE_EXPANDPARTIAL: ::WPARAM = 0x4000; -pub const TVE_COLLAPSERESET: ::WPARAM = 0x8000; -pub const TVM_GETCOUNT: ::UINT = TV_FIRST + 5; -pub const TVM_GETINDENT: ::UINT = TV_FIRST + 6; -pub const TVM_SETINDENT: ::UINT = TV_FIRST + 7; -pub const TVM_GETIMAGELIST: ::UINT = TV_FIRST + 8; -pub const TVM_SETIMAGELIST: ::UINT = TV_FIRST + 9; -pub const TVM_GETNEXTITEM: ::UINT = TV_FIRST + 10; -pub const TVSIL_NORMAL: ::WPARAM = 0; -pub const TVSIL_STATE: ::WPARAM = 2; -pub const TVGN_ROOT: ::WPARAM = 0x0000; -pub const TVGN_NEXT: ::WPARAM = 0x0001; -pub const TVGN_PREVIOUS: ::WPARAM = 0x0002; -pub const TVGN_PARENT: ::WPARAM = 0x0003; -pub const TVGN_CHILD: ::WPARAM = 0x0004; -pub const TVGN_FIRSTVISIBLE: ::WPARAM = 0x0005; -pub const TVGN_NEXTVISIBLE: ::WPARAM = 0x0006; -pub const TVGN_PREVIOUSVISIBLE: ::WPARAM = 0x0007; -pub const TVGN_DROPHILITE: ::WPARAM = 0x0008; -pub const TVGN_CARET: ::WPARAM = 0x0009; -pub const TVGN_LASTVISIBLE: ::WPARAM = 0x000A; -pub const TVGN_NEXTSELECTED: ::WPARAM = 0x000B; -pub const TVSI_NOSINGLEEXPAND: ::WPARAM = 0x8000; -pub const TVM_SELECTITEM: ::UINT = TV_FIRST + 11; -pub const TVM_GETITEMA: ::UINT = TV_FIRST + 12; -pub const TVM_GETITEMW: ::UINT = TV_FIRST + 62; -pub const TVM_SETITEMA: ::UINT = TV_FIRST + 13; -pub const TVM_SETITEMW: ::UINT = TV_FIRST + 63; -pub const TVM_EDITLABELA: ::UINT = TV_FIRST + 14; -pub const TVM_EDITLABELW: ::UINT = TV_FIRST + 65; -pub const TVM_GETEDITCONTROL: ::UINT = TV_FIRST + 15; -pub const TVM_GETVISIBLECOUNT: ::UINT = TV_FIRST + 16; -pub const TVM_HITTEST: ::UINT = TV_FIRST + 17; -pub type LPTV_HITTESTINFO = LPTVHITTESTINFO; -pub type TV_HITTESTINFO = TVHITTESTINFO; -STRUCT!{struct TVHITTESTINFO { - pt: ::POINT, - flags: ::UINT, - hItem: HTREEITEM, -}} -pub type LPTVHITTESTINFO = *mut TVHITTESTINFO; -pub const TVHT_NOWHERE: ::UINT = 0x0001; -pub const TVHT_ONITEMICON: ::UINT = 0x0002; -pub const TVHT_ONITEMLABEL: ::UINT = 0x0004; -pub const TVHT_ONITEM: ::UINT = TVHT_ONITEMICON | TVHT_ONITEMLABEL | TVHT_ONITEMSTATEICON; -pub const TVHT_ONITEMINDENT: ::UINT = 0x0008; -pub const TVHT_ONITEMBUTTON: ::UINT = 0x0010; -pub const TVHT_ONITEMRIGHT: ::UINT = 0x0020; -pub const TVHT_ONITEMSTATEICON: ::UINT = 0x0040; -pub const TVHT_ABOVE: ::UINT = 0x0100; -pub const TVHT_BELOW: ::UINT = 0x0200; -pub const TVHT_TORIGHT: ::UINT = 0x0400; -pub const TVHT_TOLEFT: ::UINT = 0x0800; -pub const TVM_CREATEDRAGIMAGE: ::UINT = TV_FIRST + 18; -pub const TVM_SORTCHILDREN: ::UINT = TV_FIRST + 19; -pub const TVM_ENSUREVISIBLE: ::UINT = TV_FIRST + 20; -pub const TVM_SORTCHILDRENCB: ::UINT = TV_FIRST + 21; -pub const TVM_ENDEDITLABELNOW: ::UINT = TV_FIRST + 22; -pub const TVM_GETISEARCHSTRINGA: ::UINT = TV_FIRST + 23; -pub const TVM_GETISEARCHSTRINGW: ::UINT = TV_FIRST + 64; -pub const TVM_SETTOOLTIPS: ::UINT = TV_FIRST + 24; -pub const TVM_GETTOOLTIPS: ::UINT = TV_FIRST + 25; -pub const TVM_SETINSERTMARK: ::UINT = TV_FIRST + 26; -pub const TVM_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; -pub const TVM_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; -pub const TVM_SETITEMHEIGHT: ::UINT = TV_FIRST + 27; -pub const TVM_GETITEMHEIGHT: ::UINT = TV_FIRST + 28; -pub const TVM_SETBKCOLOR: ::UINT = TV_FIRST + 29; -pub const TVM_SETTEXTCOLOR: ::UINT = TV_FIRST + 30; -pub const TVM_GETBKCOLOR: ::UINT = TV_FIRST + 31; -pub const TVM_GETTEXTCOLOR: ::UINT = TV_FIRST + 32; -pub const TVM_SETSCROLLTIME: ::UINT = TV_FIRST + 33; -pub const TVM_GETSCROLLTIME: ::UINT = TV_FIRST + 34; -pub const TVM_SETINSERTMARKCOLOR: ::UINT = TV_FIRST + 37; -pub const TVM_GETINSERTMARKCOLOR: ::UINT = TV_FIRST + 38; -pub const TVM_SETBORDER: ::UINT = TV_FIRST + 35; -pub const TVSBF_XBORDER: ::WPARAM = 0x00000001; -pub const TVSBF_YBORDER: ::WPARAM = 0x00000002; -pub const TVM_GETITEMSTATE: ::UINT = TV_FIRST + 39; -pub const TVM_SETLINECOLOR: ::UINT = TV_FIRST + 40; -pub const TVM_GETLINECOLOR: ::UINT = TV_FIRST + 41; -pub const TVM_MAPACCIDTOHTREEITEM: ::UINT = TV_FIRST + 42; -pub const TVM_MAPHTREEITEMTOACCID: ::UINT = TV_FIRST + 43; -pub const TVM_SETEXTENDEDSTYLE: ::UINT = TV_FIRST + 44; -pub const TVM_GETEXTENDEDSTYLE: ::UINT = TV_FIRST + 45; -pub const TVM_SETAUTOSCROLLINFO: ::UINT = TV_FIRST + 59; -pub const TVM_SETHOT: ::UINT = TV_FIRST + 58; -pub const TVM_GETSELECTEDCOUNT: ::UINT = TV_FIRST + 70; -pub const TVM_SHOWINFOTIP: ::UINT = TV_FIRST + 71; -ENUM!{enum TVITEMPART { - TVGIPR_BUTTON = 0x0001, -}} -STRUCT!{struct TVGETITEMPARTRECTINFO { - hti: HTREEITEM, - prc: *mut ::RECT, - partID: TVITEMPART, -}} -pub const TVM_GETITEMPARTRECT: ::UINT = TV_FIRST + 72; -pub type PFNTVCOMPARE = Option ::c_int>; -pub type LPTV_SORTCB = LPTVSORTCB; -pub type TV_SORTCB = TVSORTCB; -STRUCT!{nodebug struct TVSORTCB { - hParent: HTREEITEM, - lpfnCompare: PFNTVCOMPARE, - lParam: ::LPARAM, -}} -pub type LPTVSORTCB = *mut TVSORTCB; -pub type LPNM_TREEVIEWA = LPNMTREEVIEWA; -pub type LPNM_TREEVIEWW = LPNMTREEVIEWW; -pub type NM_TREEVIEWA = NMTREEVIEWA; -pub type NM_TREEVIEWW = NMTREEVIEWW; -STRUCT!{struct NMTREEVIEWA { - hdr: ::NMHDR, - action: ::UINT, - itemOld: TVITEMA, - itemNew: TVITEMA, - ptDrag: ::POINT, -}} -pub type LPNMTREEVIEWA = *mut NMTREEVIEWA; -STRUCT!{struct NMTREEVIEWW { - hdr: ::NMHDR, - action: ::UINT, - itemOld: TVITEMW, - itemNew: TVITEMW, - ptDrag: ::POINT, -}} -pub type LPNMTREEVIEWW = *mut NMTREEVIEWW; -pub const TVN_SELCHANGINGA: ::UINT = TVN_FIRST - 1; -pub const TVN_SELCHANGINGW: ::UINT = TVN_FIRST - 50; -pub const TVN_SELCHANGEDA: ::UINT = TVN_FIRST - 2; -pub const TVN_SELCHANGEDW: ::UINT = TVN_FIRST - 51; -pub const TVN_GETDISPINFOA: ::UINT = TVN_FIRST - 3; -pub const TVN_GETDISPINFOW: ::UINT = TVN_FIRST - 52; -pub const TVN_SETDISPINFOA: ::UINT = TVN_FIRST - 4; -pub const TVN_SETDISPINFOW: ::UINT = TVN_FIRST - 53; -pub const TVC_UNKNOWN: ::LPARAM = 0x0000; -pub const TVC_BYMOUSE: ::LPARAM = 0x0001; -pub const TVC_BYKEYBOARD: ::LPARAM = 0x0002; -pub const TVIF_DI_SETITEM: ::UINT = 0x1000; -pub type TV_DISPINFOA = NMTVDISPINFOA; -pub type TV_DISPINFOW = NMTVDISPINFOW; -STRUCT!{struct NMTVDISPINFOA { - hdr: ::NMHDR, - item: TVITEMA, -}} -pub type LPNMTVDISPINFOA = *mut NMTVDISPINFOA; -STRUCT!{struct NMTVDISPINFOW { - hdr: ::NMHDR, - item: TVITEMW, -}} -pub type LPNMTVDISPINFOW = *mut NMTVDISPINFOW; -STRUCT!{struct NMTVDISPINFOEXA { - hdr: ::NMHDR, - item: TVITEMEXA, -}} -pub type LPNMTVDISPINFOEXA = *mut NMTVDISPINFOEXA; -STRUCT!{struct NMTVDISPINFOEXW { - hdr: ::NMHDR, - item: TVITEMEXW, -}} -pub type LPNMTVDISPINFOEXW = *mut NMTVDISPINFOEXW; -pub type TV_DISPINFOEXA = NMTVDISPINFOEXA; -pub type TV_DISPINFOEXW = NMTVDISPINFOEXW; -pub const TVN_ITEMEXPANDINGA: ::UINT = TVN_FIRST - 5; -pub const TVN_ITEMEXPANDINGW: ::UINT = TVN_FIRST - 54; -pub const TVN_ITEMEXPANDEDA: ::UINT = TVN_FIRST - 6; -pub const TVN_ITEMEXPANDEDW: ::UINT = TVN_FIRST - 55; -pub const TVN_BEGINDRAGA: ::UINT = TVN_FIRST - 7; -pub const TVN_BEGINDRAGW: ::UINT = TVN_FIRST - 56; -pub const TVN_BEGINRDRAGA: ::UINT = TVN_FIRST - 8; -pub const TVN_BEGINRDRAGW: ::UINT = TVN_FIRST - 57; -pub const TVN_DELETEITEMA: ::UINT = TVN_FIRST - 9; -pub const TVN_DELETEITEMW: ::UINT = TVN_FIRST - 58; -pub const TVN_BEGINLABELEDITA: ::UINT = TVN_FIRST - 10; -pub const TVN_BEGINLABELEDITW: ::UINT = TVN_FIRST - 59; -pub const TVN_ENDLABELEDITA: ::UINT = TVN_FIRST - 11; -pub const TVN_ENDLABELEDITW: ::UINT = TVN_FIRST - 60; -pub const TVN_KEYDOWN: ::UINT = TVN_FIRST - 12; -pub const TVN_GETINFOTIPA: ::UINT = TVN_FIRST - 13; -pub const TVN_GETINFOTIPW: ::UINT = TVN_FIRST - 14; -pub const TVN_SINGLEEXPAND: ::UINT = TVN_FIRST - 15; -pub const TVN_ITEMCHANGINGA: ::UINT = TVN_FIRST - 16; -pub const TVN_ITEMCHANGINGW: ::UINT = TVN_FIRST - 17; -pub const TVN_ITEMCHANGEDA: ::UINT = TVN_FIRST - 18; -pub const TVN_ITEMCHANGEDW: ::UINT = TVN_FIRST - 19; -pub const TVN_ASYNCDRAW: ::UINT = TVN_FIRST - 20; -pub const TVNRET_DEFAULT: ::LRESULT = 0; -pub const TVNRET_SKIPOLD: ::LRESULT = 1; -pub const TVNRET_SKIPNEW: ::LRESULT = 2; -pub type TV_KEYDOWN = NMTVKEYDOWN; -STRUCT!{struct NMTVKEYDOWN { - hdr: ::NMHDR, - wVKey: ::WORD, - flags: ::UINT, -}} -pub type LPNMTVKEYDOWN = *mut NMTVKEYDOWN; -STRUCT!{struct NMTVCUSTOMDRAW { - nmcd: NMCUSTOMDRAW, - clrText: ::COLORREF, - clrTextBk: ::COLORREF, - iLevel: ::c_int, -}} -pub type LPNMTVCUSTOMDRAW = *mut NMTVCUSTOMDRAW; -STRUCT!{struct NMTVGETINFOTIPA { - hdr: ::NMHDR, - pszText: ::LPSTR, - cchTextMax: ::c_int, - hItem: HTREEITEM, - lParam: ::LPARAM, -}} -pub type LPNMTVGETINFOTIPA = *mut NMTVGETINFOTIPA; -STRUCT!{struct NMTVGETINFOTIPW { - hdr: ::NMHDR, - pszText: ::LPWSTR, - cchTextMax: ::c_int, - hItem: HTREEITEM, - lParam: ::LPARAM, -}} -pub type LPNMTVGETINFOTIPW = *mut NMTVGETINFOTIPW; -pub const TVCDRF_NOIMAGES: ::LRESULT = 0x00010000; -STRUCT!{struct NMTVITEMCHANGE { - hdr: ::NMHDR, - uChanged: ::UINT, - hItem: HTREEITEM, - uStateNew: ::UINT, - uStateOld: ::UINT, - lParam: ::LPARAM, -}} -STRUCT!{struct NMTVASYNCDRAW { - hdr: ::NMHDR, - pimldp: *mut IMAGELISTDRAWPARAMS, - hr: ::HRESULT, - hItem: HTREEITEM, - lParam: ::LPARAM, - dwRetFlags: ::DWORD, - iRetImageIndex: ::c_int, -}} -pub const CBEIF_TEXT: ::UINT = 0x00000001; -pub const CBEIF_IMAGE: ::UINT = 0x00000002; -pub const CBEIF_SELECTEDIMAGE: ::UINT = 0x00000004; -pub const CBEIF_OVERLAY: ::UINT = 0x00000008; -pub const CBEIF_INDENT: ::UINT = 0x00000010; -pub const CBEIF_LPARAM: ::UINT = 0x00000020; -pub const CBEIF_DI_SETITEM: ::UINT = 0x10000000; -STRUCT!{struct COMBOBOXEXITEMA { - mask: ::UINT, - iItem: ::INT_PTR, - pszText: ::LPSTR, - cchTextMax: ::c_int, - iImage: ::c_int, - iSelectedImage: ::c_int, - iOverlay: ::c_int, - iIndent: ::c_int, - lParam: ::LPARAM, -}} -pub type PCOMBOBOXEXITEMA = *mut COMBOBOXEXITEMA; -pub type PCCOMBOBOXEXITEMA = *const COMBOBOXEXITEMA; -STRUCT!{struct COMBOBOXEXITEMW { - mask: ::UINT, - iItem: ::INT_PTR, - pszText: ::LPWSTR, - cchTextMax: ::c_int, - iImage: ::c_int, - iSelectedImage: ::c_int, - iOverlay: ::c_int, - iIndent: ::c_int, - lParam: ::LPARAM, -}} -pub type PCOMBOBOXEXITEMW = *mut COMBOBOXEXITEMW; -pub type PCCOMBOBOXEXITEMW = *const COMBOBOXEXITEMW; -pub const CBEM_INSERTITEMA: ::UINT = ::WM_USER + 1; -pub const CBEM_SETIMAGELIST: ::UINT = ::WM_USER + 2; -pub const CBEM_GETIMAGELIST: ::UINT = ::WM_USER + 3; -pub const CBEM_GETITEMA: ::UINT = ::WM_USER + 4; -pub const CBEM_SETITEMA: ::UINT = ::WM_USER + 5; -pub const CBEM_DELETEITEM: ::UINT = ::CB_DELETESTRING; -pub const CBEM_GETCOMBOCONTROL: ::UINT = ::WM_USER + 6; -pub const CBEM_GETEDITCONTROL: ::UINT = ::WM_USER + 7; -pub const CBEM_SETEXSTYLE: ::UINT = ::WM_USER + 8; -pub const CBEM_SETEXTENDEDSTYLE: ::UINT = ::WM_USER + 14; -pub const CBEM_GETEXSTYLE: ::UINT = ::WM_USER + 9; -pub const CBEM_GETEXTENDEDSTYLE: ::UINT = ::WM_USER + 9; -pub const CBEM_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; -pub const CBEM_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; -pub const CBEM_HASEDITCHANGED: ::UINT = ::WM_USER + 10; -pub const CBEM_INSERTITEMW: ::UINT = ::WM_USER + 11; -pub const CBEM_SETITEMW: ::UINT = ::WM_USER + 12; -pub const CBEM_GETITEMW: ::UINT = ::WM_USER + 13; -pub const CBEM_SETWINDOWTHEME: ::UINT = CCM_SETWINDOWTHEME; -pub const CBES_EX_NOEDITIMAGE: ::DWORD = 0x00000001; -pub const CBES_EX_NOEDITIMAGEINDENT: ::DWORD = 0x00000002; -pub const CBES_EX_PATHWORDBREAKPROC: ::DWORD = 0x00000004; -pub const CBES_EX_NOSIZELIMIT: ::DWORD = 0x00000008; -pub const CBES_EX_CASESENSITIVE: ::DWORD = 0x00000010; -pub const CBES_EX_TEXTENDELLIPSIS: ::DWORD = 0x00000020; -STRUCT!{struct NMCOMBOBOXEXA { - hdr: ::NMHDR, - ceItem: COMBOBOXEXITEMA, -}} -pub type PNMCOMBOBOXEXA = *mut NMCOMBOBOXEXA; -STRUCT!{struct NMCOMBOBOXEXW { - hdr: ::NMHDR, - ceItem: COMBOBOXEXITEMW, -}} -pub type PNMCOMBOBOXEXW = *mut NMCOMBOBOXEXW; -pub const CBEN_GETDISPINFOA: ::UINT = CBEN_FIRST - 0; -pub const CBEN_INSERTITEM: ::UINT = CBEN_FIRST - 1; -pub const CBEN_DELETEITEM: ::UINT = CBEN_FIRST - 2; -pub const CBEN_BEGINEDIT: ::UINT = CBEN_FIRST - 4; -pub const CBEN_ENDEDITA: ::UINT = CBEN_FIRST - 5; -pub const CBEN_ENDEDITW: ::UINT = CBEN_FIRST - 6; -pub const CBEN_GETDISPINFOW: ::UINT = CBEN_FIRST - 7; -pub const CBEN_DRAGBEGINA: ::UINT = CBEN_FIRST - 8; -pub const CBEN_DRAGBEGINW: ::UINT = CBEN_FIRST - 9; -pub const CBENF_KILLFOCUS: ::c_int = 1; -pub const CBENF_RETURN: ::c_int = 2; -pub const CBENF_ESCAPE: ::c_int = 3; -pub const CBENF_DROPDOWN: ::c_int = 4; -pub const CBEMAXSTRLEN: usize = 260; -STRUCT!{nodebug struct NMCBEDRAGBEGINW { - hdr: ::NMHDR, - iItemid: ::c_int, - szText: [::WCHAR; CBEMAXSTRLEN], -}} -pub type PNMCBEDRAGBEGINW = *mut NMCBEDRAGBEGINW; -pub type LPNMCBEDRAGBEGINW = *mut NMCBEDRAGBEGINW; -STRUCT!{nodebug struct NMCBEDRAGBEGINA { - hdr: ::NMHDR, - iItemid: ::c_int, - szText: [::c_char; CBEMAXSTRLEN], -}} -pub type PNMCBEDRAGBEGINA = *mut NMCBEDRAGBEGINA; -pub type LPNMCBEDRAGBEGINA = *mut NMCBEDRAGBEGINA; -STRUCT!{nodebug struct NMCBEENDEDITW { - hdr: ::NMHDR, - fChanged: ::BOOL, - iNewSelection: ::c_int, - szText: [::WCHAR; CBEMAXSTRLEN], - iWhy: ::c_int, -}} -pub type PNMCBEENDEDITW = *mut NMCBEENDEDITW; -pub type LPNMCBEENDEDITW = *mut NMCBEENDEDITW; -STRUCT!{nodebug struct NMCBEENDEDITA { - hdr: ::NMHDR, - fChanged: ::BOOL, - iNewSelection: ::c_int, - szText: [::c_char; CBEMAXSTRLEN], - iWhy: ::c_int, -}} -pub type PNMCBEENDEDITA = *mut NMCBEENDEDITA; -pub type LPNMCBEENDEDITA = *mut NMCBEENDEDITA; -pub const TCS_SCROLLOPPOSITE: ::DWORD = 0x0001; -pub const TCS_BOTTOM: ::DWORD = 0x0002; -pub const TCS_RIGHT: ::DWORD = 0x0002; -pub const TCS_MULTISELECT: ::DWORD = 0x0004; -pub const TCS_FLATBUTTONS: ::DWORD = 0x0008; -pub const TCS_FORCEICONLEFT: ::DWORD = 0x0010; -pub const TCS_FORCELABELLEFT: ::DWORD = 0x0020; -pub const TCS_HOTTRACK: ::DWORD = 0x0040; -pub const TCS_VERTICAL: ::DWORD = 0x0080; -pub const TCS_TABS: ::DWORD = 0x0000; -pub const TCS_BUTTONS: ::DWORD = 0x0100; -pub const TCS_SINGLELINE: ::DWORD = 0x0000; -pub const TCS_MULTILINE: ::DWORD = 0x0200; -pub const TCS_RIGHTJUSTIFY: ::DWORD = 0x0000; -pub const TCS_FIXEDWIDTH: ::DWORD = 0x0400; -pub const TCS_RAGGEDRIGHT: ::DWORD = 0x0800; -pub const TCS_FOCUSONBUTTONDOWN: ::DWORD = 0x1000; -pub const TCS_OWNERDRAWFIXED: ::DWORD = 0x2000; -pub const TCS_TOOLTIPS: ::DWORD = 0x4000; -pub const TCS_FOCUSNEVER: ::DWORD = 0x8000; -pub const TCS_EX_FLATSEPARATORS: ::DWORD = 0x00000001; -pub const TCS_EX_REGISTERDROP: ::DWORD = 0x00000002; -pub const TCM_GETIMAGELIST: ::UINT = TCM_FIRST + 2; -pub const TCM_SETIMAGELIST: ::UINT = TCM_FIRST + 3; -pub const TCM_GETITEMCOUNT: ::UINT = TCM_FIRST + 4; -pub const TCIF_TEXT: ::UINT = 0x0001; -pub const TCIF_IMAGE: ::UINT = 0x0002; -pub const TCIF_RTLREADING: ::UINT = 0x0004; -pub const TCIF_PARAM: ::UINT = 0x0008; -pub const TCIF_STATE: ::UINT = 0x0010; -pub const TCIS_BUTTONPRESSED: ::DWORD = 0x0001; -pub const TCIS_HIGHLIGHTED: ::DWORD = 0x0002; -pub type TC_ITEMHEADERA = TCITEMHEADERA; -pub type TC_ITEMHEADERW = TCITEMHEADERW; -STRUCT!{struct TCITEMHEADERA { - mask: ::UINT, - lpReserved1: ::UINT, - lpReserved2: ::UINT, - pszText: ::LPSTR, - cchTextMax: ::c_int, - iImage: ::c_int, -}} -pub type LPTCITEMHEADERA = *mut TCITEMHEADERA; -STRUCT!{struct TCITEMHEADERW { - mask: ::UINT, - lpReserved1: ::UINT, - lpReserved2: ::UINT, - pszText: ::LPWSTR, - cchTextMax: ::c_int, - iImage: ::c_int, -}} -pub type LPTCITEMHEADERW = *mut TCITEMHEADERW; -pub type TC_ITEMA = TCITEMA; -pub type TC_ITEMW = TCITEMW; -STRUCT!{struct TCITEMA { - mask: ::UINT, - dwState: ::DWORD, - dwStateMask: ::DWORD, - pszText: ::LPSTR, - cchTextMax: ::c_int, - iImage: ::c_int, - lParam: ::LPARAM, -}} -pub type LPTCITEMA = *mut TCITEMA; -STRUCT!{struct TCITEMW { - mask: ::UINT, - dwState: ::DWORD, - dwStateMask: ::DWORD, - pszText: ::LPWSTR, - cchTextMax: ::c_int, - iImage: ::c_int, - lParam: ::LPARAM, -}} -pub type LPTCITEMW = *mut TCITEMW; -pub const TCM_GETITEMA: ::UINT = TCM_FIRST + 5; -pub const TCM_GETITEMW: ::UINT = TCM_FIRST + 60; -pub const TCM_SETITEMA: ::UINT = TCM_FIRST + 6; -pub const TCM_SETITEMW: ::UINT = TCM_FIRST + 61; -pub const TCM_INSERTITEMA: ::UINT = TCM_FIRST + 7; -pub const TCM_INSERTITEMW: ::UINT = TCM_FIRST + 62; -pub const TCM_DELETEITEM: ::UINT = TCM_FIRST + 8; -pub const TCM_DELETEALLITEMS: ::UINT = TCM_FIRST + 9; -pub const TCM_GETITEMRECT: ::UINT = TCM_FIRST + 10; -pub const TCM_GETCURSEL: ::UINT = TCM_FIRST + 11; -pub const TCM_SETCURSEL: ::UINT = TCM_FIRST + 12; -pub const TCHT_NOWHERE: ::UINT = 0x0001; -pub const TCHT_ONITEMICON: ::UINT = 0x0002; -pub const TCHT_ONITEMLABEL: ::UINT = 0x0004; -pub const TCHT_ONITEM: ::UINT = TCHT_ONITEMICON | TCHT_ONITEMLABEL; -pub type LPTC_HITTESTINFO = LPTCHITTESTINFO; -pub type TC_HITTESTINFO = TCHITTESTINFO; -STRUCT!{struct TCHITTESTINFO { - pt: ::POINT, - flags: ::UINT, -}} -pub type LPTCHITTESTINFO = *mut TCHITTESTINFO; -pub const TCM_HITTEST: ::UINT = TCM_FIRST + 13; -pub const TCM_SETITEMEXTRA: ::UINT = TCM_FIRST + 14; -pub const TCM_ADJUSTRECT: ::UINT = TCM_FIRST + 40; -pub const TCM_SETITEMSIZE: ::UINT = TCM_FIRST + 41; -pub const TCM_REMOVEIMAGE: ::UINT = TCM_FIRST + 42; -pub const TCM_SETPADDING: ::UINT = TCM_FIRST + 43; -pub const TCM_GETROWCOUNT: ::UINT = TCM_FIRST + 44; -pub const TCM_GETTOOLTIPS: ::UINT = TCM_FIRST + 45; -pub const TCM_SETTOOLTIPS: ::UINT = TCM_FIRST + 46; -pub const TCM_GETCURFOCUS: ::UINT = TCM_FIRST + 47; -pub const TCM_SETCURFOCUS: ::UINT = TCM_FIRST + 48; -pub const TCM_SETMINTABWIDTH: ::UINT = TCM_FIRST + 49; -pub const TCM_DESELECTALL: ::UINT = TCM_FIRST + 50; -pub const TCM_HIGHLIGHTITEM: ::UINT = TCM_FIRST + 51; -pub const TCM_SETEXTENDEDSTYLE: ::UINT = TCM_FIRST + 52; -pub const TCM_GETEXTENDEDSTYLE: ::UINT = TCM_FIRST + 53; -pub const TCM_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; -pub const TCM_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; -pub const TCN_KEYDOWN: ::UINT = TCN_FIRST - 0; -pub type TC_KEYDOWN = NMTCKEYDOWN; -STRUCT!{struct NMTCKEYDOWN { - hdr: ::NMHDR, - wVKey: ::WORD, - flags: ::UINT, -}} -pub const TCN_SELCHANGE: ::UINT = TCN_FIRST - 1; -pub const TCN_SELCHANGING: ::UINT = TCN_FIRST - 2; -pub const TCN_GETOBJECT: ::UINT = TCN_FIRST - 3; -pub const TCN_FOCUSCHANGE: ::UINT = TCN_FIRST - 4; -pub const ACS_CENTER: ::DWORD = 0x0001; -pub const ACS_TRANSPARENT: ::DWORD = 0x0002; -pub const ACS_AUTOPLAY: ::DWORD = 0x0004; -pub const ACS_TIMER: ::DWORD = 0x0008; -pub const ACM_OPENA: ::UINT = ::WM_USER + 100; -pub const ACM_OPENW: ::UINT = ::WM_USER + 103; -pub const ACM_PLAY: ::UINT = ::WM_USER + 101; -pub const ACM_STOP: ::UINT = ::WM_USER + 102; -pub const ACM_ISPLAYING: ::UINT = ::WM_USER + 104; -pub const ACN_START: ::WPARAM = 1; -pub const ACN_STOP: ::WPARAM = 2; -pub type MONTHDAYSTATE = ::DWORD; -pub type LPMONTHDAYSTATE = *mut ::DWORD; -pub const MCM_FIRST: ::UINT = 0x1000; -pub const MCM_GETCURSEL: ::UINT = MCM_FIRST + 1; -pub const MCM_SETCURSEL: ::UINT = MCM_FIRST + 2; -pub const MCM_GETMAXSELCOUNT: ::UINT = MCM_FIRST + 3; -pub const MCM_SETMAXSELCOUNT: ::UINT = MCM_FIRST + 4; -pub const MCM_GETSELRANGE: ::UINT = MCM_FIRST + 5; -pub const MCM_SETSELRANGE: ::UINT = MCM_FIRST + 6; -pub const MCM_GETMONTHRANGE: ::UINT = MCM_FIRST + 7; -pub const MCM_SETDAYSTATE: ::UINT = MCM_FIRST + 8; -pub const MCM_GETMINREQRECT: ::UINT = MCM_FIRST + 9; -pub const MCM_SETCOLOR: ::UINT = MCM_FIRST + 10; -pub const MCM_GETCOLOR: ::UINT = MCM_FIRST + 11; -pub const MCM_SETTODAY: ::UINT = MCM_FIRST + 12; -pub const MCM_GETTODAY: ::UINT = MCM_FIRST + 13; -pub const MCM_HITTEST: ::UINT = MCM_FIRST + 14; -pub const MCSC_BACKGROUND: ::WPARAM = 0; -pub const MCSC_TEXT: ::WPARAM = 1; -pub const MCSC_TITLEBK: ::WPARAM = 2; -pub const MCSC_TITLETEXT: ::WPARAM = 3; -pub const MCSC_MONTHBK: ::WPARAM = 4; -pub const MCSC_TRAILINGTEXT: ::WPARAM = 5; -STRUCT!{struct MCHITTESTINFO { - cbSize: ::UINT, - pt: ::POINT, - uHit: ::UINT, - st: ::SYSTEMTIME, - rc: ::RECT, - iOffset: ::c_int, - iRow: ::c_int, - iCol: ::c_int, -}} -pub type PMCHITTESTINFO = *mut MCHITTESTINFO; -pub const MCHT_TITLE: ::UINT = 0x00010000; -pub const MCHT_CALENDAR: ::UINT = 0x00020000; -pub const MCHT_TODAYLINK: ::UINT = 0x00030000; -pub const MCHT_CALENDARCONTROL: ::UINT = 0x00100000; -pub const MCHT_NEXT: ::UINT = 0x01000000; -pub const MCHT_PREV: ::UINT = 0x02000000; -pub const MCHT_NOWHERE: ::UINT = 0x00000000; -pub const MCHT_TITLEBK: ::UINT = MCHT_TITLE; -pub const MCHT_TITLEMONTH: ::UINT = MCHT_TITLE | 0x0001; -pub const MCHT_TITLEYEAR: ::UINT = MCHT_TITLE | 0x0002; -pub const MCHT_TITLEBTNNEXT: ::UINT = MCHT_TITLE | MCHT_NEXT | 0x0003; -pub const MCHT_TITLEBTNPREV: ::UINT = MCHT_TITLE | MCHT_PREV | 0x0003; -pub const MCHT_CALENDARBK: ::UINT = MCHT_CALENDAR; -pub const MCHT_CALENDARDATE: ::UINT = MCHT_CALENDAR | 0x0001; -pub const MCHT_CALENDARDATENEXT: ::UINT = MCHT_CALENDARDATE | MCHT_NEXT; -pub const MCHT_CALENDARDATEPREV: ::UINT = MCHT_CALENDARDATE | MCHT_PREV; -pub const MCHT_CALENDARDAY: ::UINT = MCHT_CALENDAR | 0x0002; -pub const MCHT_CALENDARWEEKNUM: ::UINT = MCHT_CALENDAR | 0x0003; -pub const MCHT_CALENDARDATEMIN: ::UINT = MCHT_CALENDAR | 0x0004; -pub const MCHT_CALENDARDATEMAX: ::UINT = MCHT_CALENDAR | 0x0005; -pub const MCM_SETFIRSTDAYOFWEEK: ::UINT = MCM_FIRST + 15; -pub const MCM_GETFIRSTDAYOFWEEK: ::UINT = MCM_FIRST + 16; -pub const MCM_GETRANGE: ::UINT = MCM_FIRST + 17; -pub const MCM_SETRANGE: ::UINT = MCM_FIRST + 18; -pub const MCM_GETMONTHDELTA: ::UINT = MCM_FIRST + 19; -pub const MCM_SETMONTHDELTA: ::UINT = MCM_FIRST + 20; -pub const MCM_GETMAXTODAYWIDTH: ::UINT = MCM_FIRST + 21; -pub const MCM_SETUNICODEFORMAT: ::UINT = CCM_SETUNICODEFORMAT; -pub const MCM_GETUNICODEFORMAT: ::UINT = CCM_GETUNICODEFORMAT; -pub const MCM_GETCURRENTVIEW: ::UINT = MCM_FIRST + 22; -pub const MCM_GETCALENDARCOUNT: ::UINT = MCM_FIRST + 23; -pub const MCMV_MONTH: ::DWORD = 0; -pub const MCMV_YEAR: ::DWORD = 1; -pub const MCMV_DECADE: ::DWORD = 2; -pub const MCMV_CENTURY: ::DWORD = 3; -pub const MCMV_MAX: ::DWORD = MCMV_CENTURY; -pub const MCGIP_CALENDARCONTROL: ::DWORD = 0; -pub const MCGIP_NEXT: ::DWORD = 1; -pub const MCGIP_PREV: ::DWORD = 2; -pub const MCGIP_FOOTER: ::DWORD = 3; -pub const MCGIP_CALENDAR: ::DWORD = 4; -pub const MCGIP_CALENDARHEADER: ::DWORD = 5; -pub const MCGIP_CALENDARBODY: ::DWORD = 6; -pub const MCGIP_CALENDARROW: ::DWORD = 7; -pub const MCGIP_CALENDARCELL: ::DWORD = 8; -pub const MCGIF_DATE: ::DWORD = 0x00000001; -pub const MCGIF_RECT: ::DWORD = 0x00000002; -pub const MCGIF_NAME: ::DWORD = 0x00000004; -STRUCT!{struct MCGRIDINFO { - cbSize: ::UINT, - dwPart: ::DWORD, - dwFlags: ::DWORD, - iCalendar: ::c_int, - iRow: ::c_int, - iCol: ::c_int, - bSelected: ::BOOL, - stStart: ::SYSTEMTIME, - stEnd: ::SYSTEMTIME, - rc: ::RECT, - pszName: ::PWSTR, - cchName: ::size_t, -}} -pub type PMCGRIDINFO = *mut MCGRIDINFO; -pub const MCM_GETCALENDARGRIDINFO: ::UINT = MCM_FIRST + 24; -pub const MCM_GETCALID: ::UINT = MCM_FIRST + 27; -pub const MCM_SETCALID: ::UINT = MCM_FIRST + 28; -pub const MCM_SIZERECTTOMIN: ::UINT = MCM_FIRST + 29; -pub const MCM_SETCALENDARBORDER: ::UINT = MCM_FIRST + 30; -pub const MCM_GETCALENDARBORDER: ::UINT = MCM_FIRST + 31; -pub const MCM_SETCURRENTVIEW: ::UINT = MCM_FIRST + 32; -STRUCT!{struct NMSELCHANGE { - nmhdr: ::NMHDR, - stSelStart: ::SYSTEMTIME, - stSelEnd: ::SYSTEMTIME, -}} -pub type LPNMSELCHANGE = *mut NMSELCHANGE; -pub const MCN_SELCHANGE: ::UINT = MCN_FIRST - 3; -STRUCT!{struct NMDAYSTATE { - nmhdr: ::NMHDR, - stStart: ::SYSTEMTIME, - cDayState: ::c_int, - prgDayState: LPMONTHDAYSTATE, -}} -pub type LPNMDAYSTATE = *mut NMDAYSTATE; -pub const MCN_GETDAYSTATE: ::UINT = MCN_FIRST - 1; -pub type NMSELECT = NMSELCHANGE; -pub type LPNMSELECT = *mut NMSELCHANGE; -pub const MCN_SELECT: ::UINT = MCN_FIRST; -STRUCT!{struct NMVIEWCHANGE { - nmhdr: ::NMHDR, - dwOldView: ::DWORD, - dwNewView: ::DWORD, -}} -pub type LPNMVIEWCHANGE = *mut NMVIEWCHANGE; -pub const MCN_VIEWCHANGE: ::UINT = MCN_FIRST - 4; -pub const MCS_DAYSTATE: ::DWORD = 0x0001; -pub const MCS_MULTISELECT: ::DWORD = 0x0002; -pub const MCS_WEEKNUMBERS: ::DWORD = 0x0004; -pub const MCS_NOTODAYCIRCLE: ::DWORD = 0x0008; -pub const MCS_NOTODAY: ::DWORD = 0x0010; -pub const MCS_NOTRAILINGDATES: ::DWORD = 0x0040; -pub const MCS_SHORTDAYSOFWEEK: ::DWORD = 0x0080; -pub const MCS_NOSELCHANGEONNAV: ::DWORD = 0x0100; -pub const GMR_VISIBLE: ::DWORD = 0; -pub const GMR_DAYSTATE: ::DWORD = 1; -STRUCT!{struct DATETIMEPICKERINFO { - cbSize: ::UINT, - rcCheck: ::RECT, - stateCheck: ::DWORD, - rcButton: ::RECT, - stateButton: ::DWORD, - hwndEdit: ::HWND, - hwndUD: ::HWND, - hwndDropDown: ::HWND, -}} -pub type LPDATETIMEPICKERINFO = *mut DATETIMEPICKERINFO; -pub const DTM_FIRST: ::UINT = 0x1000; -pub const DTM_GETSYSTEMTIME: ::UINT = DTM_FIRST + 1; -pub const DTM_SETSYSTEMTIME: ::UINT = DTM_FIRST + 2; -pub const DTM_GETRANGE: ::UINT = DTM_FIRST + 3; -pub const DTM_SETRANGE: ::UINT = DTM_FIRST + 4; -pub const DTM_SETFORMATA: ::UINT = DTM_FIRST + 5; -pub const DTM_SETFORMATW: ::UINT = DTM_FIRST + 50; -pub const DTM_SETMCCOLOR: ::UINT = DTM_FIRST + 6; -pub const DTM_GETMCCOLOR: ::UINT = DTM_FIRST + 7; -pub const DTM_GETMONTHCAL: ::UINT = DTM_FIRST + 8; -pub const DTM_SETMCFONT: ::UINT = DTM_FIRST + 9; -pub const DTM_GETMCFONT: ::UINT = DTM_FIRST + 10; -pub const DTM_SETMCSTYLE: ::UINT = DTM_FIRST + 11; -pub const DTM_GETMCSTYLE: ::UINT = DTM_FIRST + 12; -pub const DTM_CLOSEMONTHCAL: ::UINT = DTM_FIRST + 13; -pub const DTM_GETDATETIMEPICKERINFO: ::UINT = DTM_FIRST + 14; -pub const DTM_GETIDEALSIZE: ::UINT = DTM_FIRST + 15; -pub const DTS_UPDOWN: ::DWORD = 0x0001; -pub const DTS_SHOWNONE: ::DWORD = 0x0002; -pub const DTS_SHORTDATEFORMAT: ::DWORD = 0x0000; -pub const DTS_LONGDATEFORMAT: ::DWORD = 0x0004; -pub const DTS_SHORTDATECENTURYFORMAT: ::DWORD = 0x000C; -pub const DTS_TIMEFORMAT: ::DWORD = 0x0009; -pub const DTS_APPCANPARSE: ::DWORD = 0x0010; -pub const DTS_RIGHTALIGN: ::DWORD = 0x0020; -pub const DTN_DATETIMECHANGE: ::UINT = DTN_FIRST2 - 6; -STRUCT!{struct NMDATETIMECHANGE { - nmhdr: ::NMHDR, - dwFlags: ::DWORD, - st: ::SYSTEMTIME, -}} -pub type LPNMDATETIMECHANGE = *mut NMDATETIMECHANGE; -pub const DTN_USERSTRINGA: ::UINT = DTN_FIRST2 - 5; -pub const DTN_USERSTRINGW: ::UINT = DTN_FIRST - 5; -STRUCT!{struct NMDATETIMESTRINGA { - nmhdr: ::NMHDR, - pszUserString: ::LPCSTR, - st: ::SYSTEMTIME, - dwFlags: ::DWORD, -}} -pub type LPNMDATETIMESTRINGA = *mut NMDATETIMESTRINGA; -STRUCT!{struct NMDATETIMESTRINGW { - nmhdr: ::NMHDR, - pszUserString: ::LPCWSTR, - st: ::SYSTEMTIME, - dwFlags: ::DWORD, -}} -pub type LPNMDATETIMESTRINGW = *mut NMDATETIMESTRINGW; -pub const DTN_WMKEYDOWNA: ::UINT = DTN_FIRST2 - 4; -pub const DTN_WMKEYDOWNW: ::UINT = DTN_FIRST - 4; -STRUCT!{struct NMDATETIMEWMKEYDOWNA { - nmhdr: ::NMHDR, - nVirtKey: ::c_int, - pszFormat: ::LPCSTR, - st: ::SYSTEMTIME, -}} -pub type LPNMDATETIMEWMKEYDOWNA = *mut NMDATETIMEWMKEYDOWNA; -STRUCT!{struct NMDATETIMEWMKEYDOWNW { - nmhdr: ::NMHDR, - nVirtKey: ::c_int, - pszFormat: ::LPCWSTR, - st: ::SYSTEMTIME, -}} -pub type LPNMDATETIMEWMKEYDOWNW = *mut NMDATETIMEWMKEYDOWNW; -pub const DTN_FORMATA: ::UINT = DTN_FIRST2 - 3; -pub const DTN_FORMATW: ::UINT = DTN_FIRST - 3; -STRUCT!{nodebug struct NMDATETIMEFORMATA { - nmhdr: ::NMHDR, - pszFormat: ::LPCSTR, - st: ::SYSTEMTIME, - pszDisplay: ::LPCSTR, - szDisplay: [::CHAR; 64], -}} -pub type LPNMDATETIMEFORMATA = *mut NMDATETIMEFORMATA; -STRUCT!{nodebug struct NMDATETIMEFORMATW { - nmhdr: ::NMHDR, - pszFormat: ::LPCWSTR, - st: ::SYSTEMTIME, - pszDisplay: ::LPCWSTR, - szDisplay: [::WCHAR; 64], -}} -pub type LPNMDATETIMEFORMATW = *mut NMDATETIMEFORMATW; -pub const DTN_FORMATQUERYA: ::UINT = DTN_FIRST2 - 2; -pub const DTN_FORMATQUERYW: ::UINT = DTN_FIRST - 2; -STRUCT!{struct NMDATETIMEFORMATQUERYA { - nmhdr: ::NMHDR, - pszFormat: ::LPCSTR, - szMax: ::SIZE, -}} -pub type LPNMDATETIMEFORMATQUERYA = *mut NMDATETIMEFORMATQUERYA; -STRUCT!{struct NMDATETIMEFORMATQUERYW { - nmhdr: ::NMHDR, - pszFormat: ::LPCWSTR, - szMax: ::SIZE, -}} -pub type LPNMDATETIMEFORMATQUERYW = *mut NMDATETIMEFORMATQUERYW; -pub const DTN_DROPDOWN: ::UINT = DTN_FIRST2 - 1; -pub const DTN_CLOSEUP: ::UINT = DTN_FIRST2; -pub const GDTR_MIN: ::WPARAM = 0x0001; -pub const GDTR_MAX: ::WPARAM = 0x0002; -pub const GDT_ERROR: ::LRESULT = -1; -pub const GDT_VALID: ::LRESULT = 0; -pub const GDT_NONE: ::LRESULT = 1; -pub const IPM_CLEARADDRESS: ::UINT = ::WM_USER + 100; -pub const IPM_SETADDRESS: ::UINT = ::WM_USER + 101; -pub const IPM_GETADDRESS: ::UINT = ::WM_USER + 102; -pub const IPM_SETRANGE: ::UINT = ::WM_USER + 103; -pub const IPM_SETFOCUS: ::UINT = ::WM_USER + 104; -pub const IPM_ISBLANK: ::UINT = ::WM_USER + 105; -pub const IPN_FIELDCHANGED: ::UINT = IPN_FIRST - 0; -STRUCT!{struct NMIPADDRESS { - hdr: ::NMHDR, - iField: ::c_int, - iValue: ::c_int, -}} -pub type LPNMIPADDRESS = *mut NMIPADDRESS; -#[inline] #[allow(dead_code)] -pub fn MAKEIPRANGE(low: ::BYTE, high: ::BYTE) -> ::LPARAM { - (high << 8 + low) as ::LPARAM -} -#[inline] #[allow(dead_code)] -pub fn MAKEIPADDRESS(b1: ::DWORD, b2: ::DWORD, b3: ::DWORD, b4: ::DWORD) -> ::LPARAM { - ((b1 << 24) + (b2 << 16) + (b3 << 8) + b4) as ::LPARAM -} -pub const PGS_VERT: ::DWORD = 0x00000000; -pub const PGS_HORZ: ::DWORD = 0x00000001; -pub const PGS_AUTOSCROLL: ::DWORD = 0x00000002; -pub const PGS_DRAGNDROP: ::DWORD = 0x00000004; -pub const PGF_INVISIBLE: ::DWORD = 0; -pub const PGF_NORMAL: ::DWORD = 1; -pub const PGF_GRAYED: ::DWORD = 2; -pub const PGF_DEPRESSED: ::DWORD = 4; -pub const PGF_HOT: ::DWORD = 8; -pub const PGB_TOPORLEFT: ::c_int = 0; -pub const PGB_BOTTOMORRIGHT: ::c_int = 1; -pub const PGM_SETCHILD: ::UINT = PGM_FIRST + 1; -pub const PGM_RECALCSIZE: ::UINT = PGM_FIRST + 2; -pub const PGM_FORWARDMOUSE: ::UINT = PGM_FIRST + 3; -pub const PGM_SETBKCOLOR: ::UINT = PGM_FIRST + 4; -pub const PGM_GETBKCOLOR: ::UINT = PGM_FIRST + 5; -pub const PGM_SETBORDER: ::UINT = PGM_FIRST + 6; -pub const PGM_GETBORDER: ::UINT = PGM_FIRST + 7; -pub const PGM_SETPOS: ::UINT = PGM_FIRST + 8; -pub const PGM_GETPOS: ::UINT = PGM_FIRST + 9; -pub const PGM_SETBUTTONSIZE: ::UINT = PGM_FIRST + 10; -pub const PGM_GETBUTTONSIZE: ::UINT = PGM_FIRST + 11; -pub const PGM_GETBUTTONSTATE: ::UINT = PGM_FIRST + 12; -pub const PGM_GETDROPTARGET: ::UINT = CCM_GETDROPTARGET; -pub const PGM_SETSCROLLINFO: ::UINT = PGM_FIRST + 13; -pub const PGN_SCROLL: ::UINT = PGN_FIRST - 1; -pub const PGF_SCROLLUP: ::c_int = 1; -pub const PGF_SCROLLDOWN: ::c_int = 2; -pub const PGF_SCROLLLEFT: ::c_int = 4; -pub const PGF_SCROLLRIGHT: ::c_int = 8; -pub const PGK_SHIFT: ::BOOL = 1; -pub const PGK_CONTROL: ::BOOL = 2; -pub const PGK_MENU: ::BOOL = 4; -STRUCT!{struct NMPGSCROLL { - hdr: ::NMHDR, - fwKeys: ::BOOL, - rcParent: ::RECT, - iDir: ::c_int, - iXpos: ::c_int, - iYpos: ::c_int, - iScroll: ::c_int, -}} -pub type LPNMPGSCROLL = *mut NMPGSCROLL; -pub const PGN_CALCSIZE: ::UINT = PGN_FIRST - 2; -pub const PGF_CALCWIDTH: ::DWORD = 1; -pub const PGF_CALCHEIGHT: ::DWORD = 2; -STRUCT!{struct NMPGCALCSIZE { - hdr: ::NMHDR, - dwFlag: ::DWORD, - iWidth: ::c_int, - iHeight: ::c_int, -}} -pub type LPNMPGCALCSIZE = *mut NMPGCALCSIZE; -pub const PGN_HOTITEMCHANGE: ::UINT = PGN_FIRST - 3; -STRUCT!{struct NMPGHOTITEM { - hdr: ::NMHDR, - idOld: ::c_int, - idNew: ::c_int, - dwFlags: ::DWORD, -}} -pub type LPNMPGHOTITEM = *mut NMPGHOTITEM; -pub const NFS_EDIT: ::DWORD = 0x0001; -pub const NFS_STATIC: ::DWORD = 0x0002; -pub const NFS_LISTCOMBO: ::DWORD = 0x0004; -pub const NFS_BUTTON: ::DWORD = 0x0008; -pub const NFS_ALL: ::DWORD = 0x0010; -pub const NFS_USEFONTASSOC: ::DWORD = 0x0020; -pub const BUTTON_IMAGELIST_ALIGN_LEFT: ::UINT = 0; -pub const BUTTON_IMAGELIST_ALIGN_RIGHT: ::UINT = 1; -pub const BUTTON_IMAGELIST_ALIGN_TOP: ::UINT = 2; -pub const BUTTON_IMAGELIST_ALIGN_BOTTOM: ::UINT = 3; -pub const BUTTON_IMAGELIST_ALIGN_CENTER: ::UINT = 4; -STRUCT!{struct BUTTON_IMAGELIST { - himl: HIMAGELIST, - margin: ::RECT, - uAlign: ::UINT, -}} -pub type PBUTTON_IMAGELIST = *mut BUTTON_IMAGELIST; -pub const BCM_GETIDEALSIZE: ::UINT = BCM_FIRST + 0x0001; -pub const BCM_SETIMAGELIST: ::UINT = BCM_FIRST + 0x0002; -pub const BCM_GETIMAGELIST: ::UINT = BCM_FIRST + 0x0003; -pub const BCM_SETTEXTMARGIN: ::UINT = BCM_FIRST + 0x0004; -pub const BCM_GETTEXTMARGIN: ::UINT = BCM_FIRST + 0x0005; -STRUCT!{struct NMBCHOTITEM { - hdr: ::NMHDR, - dwFlags: ::DWORD, -}} -pub type LPNMBCHOTITEM = *mut NMBCHOTITEM; -pub const BCN_HOTITEMCHANGE: ::UINT = BCN_FIRST + 0x0001; -pub const BS_SPLITBUTTON: ::UINT = 0x0000000C; -pub const BS_DEFSPLITBUTTON: ::UINT = 0x0000000D; -pub const BS_COMMANDLINK: ::UINT = 0x0000000E; -pub const BS_DEFCOMMANDLINK: ::UINT = 0x0000000F; -pub const BCSIF_GLYPH: ::UINT = 0x0001; -pub const BCSIF_IMAGE: ::UINT = 0x0002; -pub const BCSIF_STYLE: ::UINT = 0x0004; -pub const BCSIF_SIZE: ::UINT = 0x0008; -pub const BCSS_NOSPLIT: ::UINT = 0x0001; -pub const BCSS_STRETCH: ::UINT = 0x0002; -pub const BCSS_ALIGNLEFT: ::UINT = 0x0004; -pub const BCSS_IMAGE: ::UINT = 0x0008; -STRUCT!{struct BUTTON_SPLITINFO { - mask: ::UINT, - himlGlyph: HIMAGELIST, - uSplitStyle: ::UINT, - size: ::SIZE, -}} -pub type PBUTTON_SPLITINFO = *mut BUTTON_SPLITINFO; -pub const BCM_SETDROPDOWNSTATE: ::UINT = BCM_FIRST + 0x0006; -pub const BCM_SETSPLITINFO: ::UINT = BCM_FIRST + 0x0007; -pub const BCM_GETSPLITINFO: ::UINT = BCM_FIRST + 0x0008; -pub const BCM_SETNOTE: ::UINT = BCM_FIRST + 0x0009; -pub const BCM_GETNOTE: ::UINT = BCM_FIRST + 0x000A; -pub const BCM_GETNOTELENGTH: ::UINT = BCM_FIRST + 0x000B; -pub const BCM_SETSHIELD: ::UINT = BCM_FIRST + 0x000C; -pub const BCCL_NOGLYPH: HIMAGELIST = (0 - 1) as HIMAGELIST; -STRUCT!{struct NMBCDROPDOWN { - hdr: ::NMHDR, - rcButton: ::RECT, -}} -pub type LPNMBCDROPDOWN = *mut NMBCDROPDOWN; -pub const BCN_DROPDOWN: ::UINT = BCN_FIRST + 0x0002; -pub const EM_SETCUEBANNER: ::UINT = ECM_FIRST + 1; -pub const EM_GETCUEBANNER: ::UINT = ECM_FIRST + 2; -pub const EM_SHOWBALLOONTIP: ::UINT = ECM_FIRST + 3; -pub const EM_HIDEBALLOONTIP: ::UINT = ECM_FIRST + 4; -pub const EM_SETHILITE: ::UINT = ECM_FIRST + 5; -pub const EM_GETHILITE: ::UINT = ECM_FIRST + 6; -pub const EM_NOSETFOCUS: ::UINT = ECM_FIRST + 7; -pub const EM_TAKEFOCUS: ::UINT = ECM_FIRST + 8; -STRUCT!{struct EDITBALLOONTIP { - cbStruct: ::DWORD, - pszTitle: ::LPCWSTR, - pszText: ::LPCWSTR, - ttiIcon: ::INT, -}} -pub type PEDITBALLOONTIP = *mut EDITBALLOONTIP; -pub const CB_SETMINVISIBLE: ::UINT = CBM_FIRST + 1; -pub const CB_GETMINVISIBLE: ::UINT = CBM_FIRST + 2; -pub const CB_SETCUEBANNER: ::UINT = CBM_FIRST + 3; -pub const CB_GETCUEBANNER: ::UINT = CBM_FIRST + 4; -pub type PFTASKDIALOGCALLBACK = Option ::HRESULT>; -FLAGS!{enum TASKDIALOG_FLAGS { - TDF_ENABLE_HYPERLINKS = 0x0001, - TDF_USE_HICON_MAIN = 0x0002, - TDF_USE_HICON_FOOTER = 0x0004, - TDF_ALLOW_DIALOG_CANCELLATION = 0x0008, - TDF_USE_COMMAND_LINKS = 0x0010, - TDF_USE_COMMAND_LINKS_NO_ICON = 0x0020, - TDF_EXPAND_FOOTER_AREA = 0x0040, - TDF_EXPANDED_BY_DEFAULT = 0x0080, - TDF_VERIFICATION_FLAG_CHECKED = 0x0100, - TDF_SHOW_PROGRESS_BAR = 0x0200, - TDF_SHOW_MARQUEE_PROGRESS_BAR = 0x0400, - TDF_CALLBACK_TIMER = 0x0800, - TDF_POSITION_RELATIVE_TO_WINDOW = 0x1000, - TDF_RTL_LAYOUT = 0x2000, - TDF_NO_DEFAULT_RADIO_BUTTON = 0x4000, - TDF_CAN_BE_MINIMIZED = 0x8000, - TDF_NO_SET_FOREGROUND = 0x00010000, - TDF_SIZE_TO_CONTENT = 0x01000000, -}} -ENUM!{enum TASKDIALOG_MESSAGES { - TDM_NAVIGATE_PAGE = ::WM_USER + 101, - TDM_CLICK_BUTTON = ::WM_USER + 102, - TDM_SET_MARQUEE_PROGRESS_BAR = ::WM_USER + 103, - TDM_SET_PROGRESS_BAR_STATE = ::WM_USER + 104, - TDM_SET_PROGRESS_BAR_RANGE = ::WM_USER + 105, - TDM_SET_PROGRESS_BAR_POS = ::WM_USER + 106, - TDM_SET_PROGRESS_BAR_MARQUEE = ::WM_USER + 107, - TDM_SET_ELEMENT_TEXT = ::WM_USER + 108, - TDM_CLICK_RADIO_BUTTON = ::WM_USER + 110, - TDM_ENABLE_BUTTON = ::WM_USER + 111, - TDM_ENABLE_RADIO_BUTTON = ::WM_USER + 112, - TDM_CLICK_VERIFICATION = ::WM_USER + 113, - TDM_UPDATE_ELEMENT_TEXT = ::WM_USER + 114, - TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE = ::WM_USER + 115, - TDM_UPDATE_ICON = ::WM_USER + 116, -}} -ENUM!{enum TASKDIALOG_NOTIFICATIONS { - TDN_CREATED = 0, - TDN_NAVIGATED = 1, - TDN_BUTTON_CLICKED = 2, - TDN_HYPERLINK_CLICKED = 3, - TDN_TIMER = 4, - TDN_DESTROYED = 5, - TDN_RADIO_BUTTON_CLICKED = 6, - TDN_DIALOG_CONSTRUCTED = 7, - TDN_VERIFICATION_CLICKED = 8, - TDN_HELP = 9, - TDN_EXPANDO_BUTTON_CLICKED = 10, -}} -STRUCT!{struct TASKDIALOG_BUTTON { - nButtonID: ::c_int, - pszButtonText: ::PCWSTR, -}} -ENUM!{enum TASKDIALOG_ELEMENTS { - TDE_CONTENT, - TDE_EXPANDED_INFORMATION, - TDE_FOOTER, - TDE_MAIN_INSTRUCTION, -}} -ENUM!{enum TASKDIALOG_ICON_ELEMENTS { - TDIE_ICON_MAIN, - TDIE_ICON_FOOTER, -}} -FLAGS!{enum TASKDIALOG_COMMON_BUTTON_FLAGS { - TDCBF_OK_BUTTON = 0x0001, - TDCBF_YES_BUTTON = 0x0002, - TDCBF_NO_BUTTON = 0x0004, - TDCBF_CANCEL_BUTTON = 0x0008, - TDCBF_RETRY_BUTTON = 0x0010, - TDCBF_CLOSE_BUTTON = 0x0020, -}} -STRUCT!{nodebug struct TASKDIALOGCONFIG { - cbSize: ::UINT, - hwndParent: ::HWND, - hInstance: ::HINSTANCE, - dwFlags: TASKDIALOG_FLAGS, - dwCommonButtons: TASKDIALOG_COMMON_BUTTON_FLAGS, - pszWindowTitle: ::PCWSTR, - hMainIcon: ::HICON, - pszMainInstruction: ::PCWSTR, - pszContent: ::PCWSTR, - cButtons: ::UINT, - pButtons: *const TASKDIALOG_BUTTON, - nDefaultButton: ::c_int, - cRadioButtons: ::UINT, - pRadioButtons: *const TASKDIALOG_BUTTON, - nDefaultRadioButton: ::c_int, - pszVerificationText: ::PCWSTR, - pszExpandedInformation: ::PCWSTR, - pszExpandedControlText: ::PCWSTR, - pszCollapsedControlText: ::PCWSTR, - hFooterIcon: ::HICON, - pszFooter: ::PCWSTR, - pfCallback: PFTASKDIALOGCALLBACK, - lpCallbackData: ::LONG_PTR, - cxWidth: ::UINT, -}} -UNION!(TASKDIALOGCONFIG, hMainIcon, pszMainIcon, pszMainIcon_mut, ::PCWSTR); -UNION!(TASKDIALOGCONFIG, hFooterIcon, pszFooterIcon, pszFooterIcon_mut, ::PCWSTR); -pub const DA_LAST: ::c_int = 0x7FFFFFFF; -pub const DA_ERR: ::c_int = -1; -pub type PFNDAENUMCALLBACK = Option ::c_int>; -pub type PFNDAENUMCALLBACKCONST = Option ::c_int>; -pub type PFNDACOMPARE = Option ::c_int>; -pub type PFNDACOMPARECONST = Option ::c_int>; -pub enum DSA {} -pub type HDSA = *mut DSA; -pub const DSA_APPEND: ::c_int = DA_LAST; -pub const DSA_ERR: ::c_int = DA_ERR; -pub type PFNDSAENUMCALLBACK = PFNDAENUMCALLBACK; -pub type PFNDSAENUMCALLBACKCONST = PFNDAENUMCALLBACKCONST; -pub type PFNDSACOMPARE = PFNDACOMPARE; -pub type PFNDSACOMPARECONST = PFNDACOMPARECONST; -pub enum DPA {} -pub type HDPA = *mut DPA; -STRUCT!{struct DPASTREAMINFO { - iPos: ::c_int, - pvItem: *mut ::c_void, -}} -pub type PFNDPASTREAM = Option ::HRESULT>; -pub const DPAM_SORTED: ::DWORD = 0x00000001; -pub const DPAM_NORMAL: ::DWORD = 0x00000002; -pub const DPAM_UNION: ::DWORD = 0x00000004; -pub const DPAM_INTERSECT: ::DWORD = 0x00000008; -pub type PFNDPAMERGE = Option *mut ::c_void>; -pub type PFNDPAMERGECONST = Option *const ::c_void>; -pub const DPAMM_MERGE: ::UINT = 1; -pub const DPAMM_DELETE: ::UINT = 2; -pub const DPAMM_INSERT: ::UINT = 3; -pub const DPAS_SORTED: ::UINT = 0x0001; -pub const DPAS_INSERTBEFORE: ::UINT = 0x0002; -pub const DPAS_INSERTAFTER: ::UINT = 0x0004; -pub const DPA_APPEND: ::c_int = DA_LAST; -pub const DPA_ERR: ::c_int = DA_ERR; -pub type PFNDPAENUMCALLBACK = PFNDAENUMCALLBACK; -pub type PFNDPAENUMCALLBACKCONST = PFNDAENUMCALLBACKCONST; -pub type PFNDPACOMPARE = PFNDACOMPARE; -pub type PFNDPACOMPARECONST = PFNDACOMPARECONST; -pub const WSB_PROP_CYVSCROLL: ::UINT = 0x00000001; -pub const WSB_PROP_CXHSCROLL: ::UINT = 0x00000002; -pub const WSB_PROP_CYHSCROLL: ::UINT = 0x00000004; -pub const WSB_PROP_CXVSCROLL: ::UINT = 0x00000008; -pub const WSB_PROP_CXHTHUMB: ::UINT = 0x00000010; -pub const WSB_PROP_CYVTHUMB: ::UINT = 0x00000020; -pub const WSB_PROP_VBKGCOLOR: ::UINT = 0x00000040; -pub const WSB_PROP_HBKGCOLOR: ::UINT = 0x00000080; -pub const WSB_PROP_VSTYLE: ::UINT = 0x00000100; -pub const WSB_PROP_HSTYLE: ::UINT = 0x00000200; -pub const WSB_PROP_WINSTYLE: ::UINT = 0x00000400; -pub const WSB_PROP_PALETTE: ::UINT = 0x00000800; -pub const WSB_PROP_MASK: ::UINT = 0x00000FFF; -pub const FSB_FLAT_MODE: ::INT_PTR = 2; -pub const FSB_ENCARTA_MODE: ::INT_PTR = 1; -pub const FSB_REGULAR_MODE: ::INT_PTR = 0; -pub type SUBCLASSPROC = Option ::LRESULT>; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/commdlg.rs cargo-0.37.0/vendor/winapi-0.2.8/src/commdlg.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/commdlg.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/commdlg.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,583 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! 32-Bit Common Dialog APIs -pub type LPOFNHOOKPROC = Option ::UINT_PTR>; -STRUCT!{nodebug struct OPENFILENAME_NT4A { - lStructSize: ::DWORD, - hwndOwner: ::HWND, - hInstance: ::HINSTANCE, - lpstrFilter: ::LPCSTR, - lpstrCustomFilter: ::LPSTR, - nMaxCustFilter: ::DWORD, - nFilterIndex: ::DWORD, - lpstrFile: ::LPSTR, - nMaxFile: ::DWORD, - lpstrFileTitle: ::LPSTR, - nMaxFileTitle: ::DWORD, - lpstrInitialDir: ::LPCSTR, - lpstrTitle: ::LPCSTR, - Flags: ::DWORD, - nFileOffset: ::WORD, - nFileExtension: ::WORD, - lpstrDefExt: ::LPCSTR, - lCustData: ::LPARAM, - lpfnHook: LPOFNHOOKPROC, - lpTemplateName: ::LPCSTR, -}} -pub type LPOPENFILENAME_NT4A = *mut OPENFILENAME_NT4A; -STRUCT!{nodebug struct OPENFILENAME_NT4W { - lStructSize: ::DWORD, - hwndOwner: ::HWND, - hInstance: ::HINSTANCE, - lpstrFilter: ::LPCWSTR, - lpstrCustomFilter: ::LPWSTR, - nMaxCustFilter: ::DWORD, - nFilterIndex: ::DWORD, - lpstrFile: ::LPWSTR, - nMaxFile: ::DWORD, - lpstrFileTitle: ::LPWSTR, - nMaxFileTitle: ::DWORD, - lpstrInitialDir: ::LPCWSTR, - lpstrTitle: ::LPCWSTR, - Flags: ::DWORD, - nFileOffset: ::WORD, - nFileExtension: ::WORD, - lpstrDefExt: ::LPCWSTR, - lCustData: ::LPARAM, - lpfnHook: LPOFNHOOKPROC, - lpTemplateName: ::LPCWSTR, -}} -pub type LPOPENFILENAME_NT4W = *mut OPENFILENAME_NT4W; -STRUCT!{nodebug struct OPENFILENAMEA { - lStructSize: ::DWORD, - hwndOwner: ::HWND, - hInstance: ::HINSTANCE, - lpstrFilter: ::LPCSTR, - lpstrCustomFilter: ::LPSTR, - nMaxCustFilter: ::DWORD, - nFilterIndex: ::DWORD, - lpstrFile: ::LPSTR, - nMaxFile: ::DWORD, - lpstrFileTitle: ::LPSTR, - nMaxFileTitle: ::DWORD, - lpstrInitialDir: ::LPCSTR, - lpstrTitle: ::LPCSTR, - Flags: ::DWORD, - nFileOffset: ::WORD, - nFileExtension: ::WORD, - lpstrDefExt: ::LPCSTR, - lCustData: ::LPARAM, - lpfnHook: LPOFNHOOKPROC, - lpTemplateName: ::LPCSTR, - pvReserved: *mut ::c_void, - dwReserved: ::DWORD, - FlagsEx: ::DWORD, -}} -pub type LPOPENFILENAMEA = *mut OPENFILENAMEA; -STRUCT!{nodebug struct OPENFILENAMEW { - lStructSize: ::DWORD, - hwndOwner: ::HWND, - hInstance: ::HINSTANCE, - lpstrFilter: ::LPCWSTR, - lpstrCustomFilter: ::LPWSTR, - nMaxCustFilter: ::DWORD, - nFilterIndex: ::DWORD, - lpstrFile: ::LPWSTR, - nMaxFile: ::DWORD, - lpstrFileTitle: ::LPWSTR, - nMaxFileTitle: ::DWORD, - lpstrInitialDir: ::LPCWSTR, - lpstrTitle: ::LPCWSTR, - Flags: ::DWORD, - nFileOffset: ::WORD, - nFileExtension: ::WORD, - lpstrDefExt: ::LPCWSTR, - lCustData: ::LPARAM, - lpfnHook: LPOFNHOOKPROC, - lpTemplateName: ::LPCWSTR, - pvReserved: *mut ::c_void, - dwReserved: ::DWORD, - FlagsEx: ::DWORD, -}} -pub type LPOPENFILENAMEW = *mut OPENFILENAMEW; -pub const OFN_READONLY: ::DWORD = 0x00000001; -pub const OFN_OVERWRITEPROMPT: ::DWORD = 0x00000002; -pub const OFN_HIDEREADONLY: ::DWORD = 0x00000004; -pub const OFN_NOCHANGEDIR: ::DWORD = 0x00000008; -pub const OFN_SHOWHELP: ::DWORD = 0x00000010; -pub const OFN_ENABLEHOOK: ::DWORD = 0x00000020; -pub const OFN_ENABLETEMPLATE: ::DWORD = 0x00000040; -pub const OFN_ENABLETEMPLATEHANDLE: ::DWORD = 0x00000080; -pub const OFN_NOVALIDATE: ::DWORD = 0x00000100; -pub const OFN_ALLOWMULTISELECT: ::DWORD = 0x00000200; -pub const OFN_EXTENSIONDIFFERENT: ::DWORD = 0x00000400; -pub const OFN_PATHMUSTEXIST: ::DWORD = 0x00000800; -pub const OFN_FILEMUSTEXIST: ::DWORD = 0x00001000; -pub const OFN_CREATEPROMPT: ::DWORD = 0x00002000; -pub const OFN_SHAREAWARE: ::DWORD = 0x00004000; -pub const OFN_NOREADONLYRETURN: ::DWORD = 0x00008000; -pub const OFN_NOTESTFILECREATE: ::DWORD = 0x00010000; -pub const OFN_NONETWORKBUTTON: ::DWORD = 0x00020000; -pub const OFN_NOLONGNAMES: ::DWORD = 0x00040000; -pub const OFN_EXPLORER: ::DWORD = 0x00080000; -pub const OFN_NODEREFERENCELINKS: ::DWORD = 0x00100000; -pub const OFN_LONGNAMES: ::DWORD = 0x00200000; -pub const OFN_ENABLEINCLUDENOTIFY: ::DWORD = 0x00400000; -pub const OFN_ENABLESIZING: ::DWORD = 0x00800000; -pub const OFN_DONTADDTORECENT: ::DWORD = 0x02000000; -pub const OFN_FORCESHOWHIDDEN: ::DWORD = 0x10000000; -pub const OFN_EX_NOPLACESBAR: ::DWORD = 0x00000001; -pub const OFN_SHAREFALLTHROUGH: ::UINT_PTR = 2; -pub const OFN_SHARENOWARN: ::UINT_PTR = 1; -pub const OFN_SHAREWARN: ::UINT_PTR = 0; -pub type LPCCHOOKPROC = Option ::UINT_PTR>; -STRUCT!{struct OFNOTIFYA { - hdr: ::NMHDR, - lpOFN: LPOPENFILENAMEA, - pszFile: ::LPSTR, -}} -pub type LPOFNOTIFYA = *mut OFNOTIFYA; -STRUCT!{struct OFNOTIFYW { - hdr: ::NMHDR, - lpOFN: LPOPENFILENAMEW, - pszFile: ::LPWSTR, -}} -pub type LPOFNOTIFYW = *mut OFNOTIFYW; -STRUCT!{struct OFNOTIFYEXA { - hdr: ::NMHDR, - lpOFN: LPOPENFILENAMEA, - psf: ::LPVOID, - pidl: ::LPVOID, -}} -pub type LPOFNOTIFYEXA = *mut OFNOTIFYEXA; -STRUCT!{struct OFNOTIFYEXW { - hdr: ::NMHDR, - lpOFN: LPOPENFILENAMEW, - psf: ::LPVOID, - pidl: ::LPVOID, -}} -pub type LPOFNOTIFYEXW = *mut OFNOTIFYEXW; -pub const CDN_FIRST: ::UINT = -601i32 as ::UINT; -pub const CDN_LAST: ::UINT = -699i32 as ::UINT; -pub const CDN_INITDONE: ::UINT = CDN_FIRST - 0x0000; -pub const CDN_SELCHANGE: ::UINT = CDN_FIRST - 0x0001; -pub const CDN_FOLDERCHANGE: ::UINT = CDN_FIRST - 0x0002; -pub const CDN_SHAREVIOLATION: ::UINT = CDN_FIRST - 0x0003; -pub const CDN_HELP: ::UINT = CDN_FIRST - 0x0004; -pub const CDN_FILEOK: ::UINT = CDN_FIRST - 0x0005; -pub const CDN_TYPECHANGE: ::UINT = CDN_FIRST - 0x0006; -pub const CDN_INCLUDEITEM: ::UINT = CDN_FIRST - 0x0007; -pub const CDM_FIRST: ::UINT = ::WM_USER + 100; -pub const CDM_LAST: ::UINT = ::WM_USER + 200; -pub const CDM_GETSPEC: ::UINT = CDM_FIRST + 0x0000; -pub const CDM_GETFILEPATH: ::UINT = CDM_FIRST + 0x0001; -pub const CDM_GETFOLDERPATH: ::UINT = CDM_FIRST + 0x0002; -pub const CDM_GETFOLDERIDLIST: ::UINT = CDM_FIRST + 0x0003; -pub const CDM_SETCONTROLTEXT: ::UINT = CDM_FIRST + 0x0004; -pub const CDM_HIDECONTROL: ::UINT = CDM_FIRST + 0x0005; -pub const CDM_SETDEFEXT: ::UINT = CDM_FIRST + 0x0006; -STRUCT!{nodebug struct CHOOSECOLORA { - lStructSize: ::DWORD, - hwndOwner: ::HWND, - hInstance: ::HWND, - rgbResult: ::COLORREF, - lpCustColors: *mut ::COLORREF, - Flags: ::DWORD, - lCustData: ::LPARAM, - lpfnHook: LPCCHOOKPROC, - lpTemplateName: ::LPCSTR, -}} -pub type LPCHOOSECOLORA = *mut CHOOSECOLORA; -STRUCT!{nodebug struct CHOOSECOLORW { - lStructSize: ::DWORD, - hwndOwner: ::HWND, - hInstance: ::HWND, - rgbResult: ::COLORREF, - lpCustColors: *mut ::COLORREF, - Flags: ::DWORD, - lCustData: ::LPARAM, - lpfnHook: LPCCHOOKPROC, - lpTemplateName: ::LPCWSTR, -}} -pub type LPCHOOSECOLORW = *mut CHOOSECOLORW; -pub const CC_RGBINIT: ::DWORD = 0x00000001; -pub const CC_FULLOPEN: ::DWORD = 0x00000002; -pub const CC_PREVENTFULLOPEN: ::DWORD = 0x00000004; -pub const CC_SHOWHELP: ::DWORD = 0x00000008; -pub const CC_ENABLEHOOK: ::DWORD = 0x00000010; -pub const CC_ENABLETEMPLATE: ::DWORD = 0x00000020; -pub const CC_ENABLETEMPLATEHANDLE: ::DWORD = 0x00000040; -pub const CC_SOLIDCOLOR: ::DWORD = 0x00000080; -pub const CC_ANYCOLOR: ::DWORD = 0x00000100; -pub type LPFRHOOKPROC = Option ::UINT_PTR>; -STRUCT!{nodebug struct FINDREPLACEA { - lStructSize: ::DWORD, - hwndOwner: ::HWND, - hInstance: ::HINSTANCE, - Flags: ::DWORD, - lpstrFindWhat: ::LPSTR, - lpstrReplaceWith: ::LPSTR, - wFindWhatLen: ::WORD, - wReplaceWithLen: ::WORD, - lCustData: ::LPARAM, - lpfnHook: LPFRHOOKPROC, - lpTemplateName: ::LPCSTR, -}} -pub type LPFINDREPLACEA = *mut FINDREPLACEA; -STRUCT!{nodebug struct FINDREPLACEW { - lStructSize: ::DWORD, - hwndOwner: ::HWND, - hInstance: ::HINSTANCE, - Flags: ::DWORD, - lpstrFindWhat: ::LPWSTR, - lpstrReplaceWith: ::LPWSTR, - wFindWhatLen: ::WORD, - wReplaceWithLen: ::WORD, - lCustData: ::LPARAM, - lpfnHook: LPFRHOOKPROC, - lpTemplateName: ::LPCWSTR, -}} -pub type LPFINDREPLACEW = *mut FINDREPLACEW; -pub const FR_DOWN: ::DWORD = 0x00000001; -pub const FR_WHOLEWORD: ::DWORD = 0x00000002; -pub const FR_MATCHCASE: ::DWORD = 0x00000004; -pub const FR_FINDNEXT: ::DWORD = 0x00000008; -pub const FR_REPLACE: ::DWORD = 0x00000010; -pub const FR_REPLACEALL: ::DWORD = 0x00000020; -pub const FR_DIALOGTERM: ::DWORD = 0x00000040; -pub const FR_SHOWHELP: ::DWORD = 0x00000080; -pub const FR_ENABLEHOOK: ::DWORD = 0x00000100; -pub const FR_ENABLETEMPLATE: ::DWORD = 0x00000200; -pub const FR_NOUPDOWN: ::DWORD = 0x00000400; -pub const FR_NOMATCHCASE: ::DWORD = 0x00000800; -pub const FR_NOWHOLEWORD: ::DWORD = 0x00001000; -pub const FR_ENABLETEMPLATEHANDLE: ::DWORD = 0x00002000; -pub const FR_HIDEUPDOWN: ::DWORD = 0x00004000; -pub const FR_HIDEMATCHCASE: ::DWORD = 0x00008000; -pub const FR_HIDEWHOLEWORD: ::DWORD = 0x00010000; -pub const FR_RAW: ::DWORD = 0x00020000; -pub const FR_MATCHDIAC: ::DWORD = 0x20000000; -pub const FR_MATCHKASHIDA: ::DWORD = 0x40000000; -pub const FR_MATCHALEFHAMZA: ::DWORD = 0x80000000; -pub type LPCFHOOKPROC = Option ::UINT_PTR>; -STRUCT!{nodebug struct CHOOSEFONTA { - lStructSize: ::DWORD, - hwndOwner: ::HWND, - hDC: ::HDC, - lpLogFont: ::LPLOGFONTA, - iPointSize: ::INT, - Flags: ::DWORD, - rgbColors: ::COLORREF, - lCustData: ::LPARAM, - lpfnHook: LPCFHOOKPROC, - lpTemplateName: ::LPCSTR, - hInstance: ::HINSTANCE, - lpszStyle: ::LPSTR, - nFontType: ::WORD, - ___MISSING_ALIGNMENT__: ::WORD, - nSizeMin: ::INT, - nSizeMax: ::INT, -}} -pub type LPCHOOSEFONTA = *mut CHOOSEFONTA; -STRUCT!{nodebug struct CHOOSEFONTW { - lStructSize: ::DWORD, - hwndOwner: ::HWND, - hDC: ::HDC, - lpLogFont: ::LPLOGFONTW, - iPointSize: ::INT, - Flags: ::DWORD, - rgbColors: ::COLORREF, - lCustData: ::LPARAM, - lpfnHook: LPCFHOOKPROC, - lpTemplateName: ::LPCWSTR, - hInstance: ::HINSTANCE, - lpszStyle: ::LPWSTR, - nFontType: ::WORD, - ___MISSING_ALIGNMENT__: ::WORD, - nSizeMin: ::INT, - nSizeMax: ::INT, -}} -pub type LPCHOOSEFONTW = *mut CHOOSEFONTW; -pub const CF_SCREENFONTS: ::DWORD = 0x00000001; -pub const CF_PRINTERFONTS: ::DWORD = 0x00000002; -pub const CF_BOTH: ::DWORD = CF_SCREENFONTS | CF_PRINTERFONTS; -pub const CF_SHOWHELP: ::DWORD = 0x00000004; -pub const CF_ENABLEHOOK: ::DWORD = 0x00000008; -pub const CF_ENABLETEMPLATE: ::DWORD = 0x00000010; -pub const CF_ENABLETEMPLATEHANDLE: ::DWORD = 0x00000020; -pub const CF_INITTOLOGFONTSTRUCT: ::DWORD = 0x00000040; -pub const CF_USESTYLE: ::DWORD = 0x00000080; -pub const CF_EFFECTS: ::DWORD = 0x00000100; -pub const CF_APPLY: ::DWORD = 0x00000200; -pub const CF_ANSIONLY: ::DWORD = 0x00000400; -pub const CF_SCRIPTSONLY: ::DWORD = CF_ANSIONLY; -pub const CF_NOVECTORFONTS: ::DWORD = 0x00000800; -pub const CF_NOOEMFONTS: ::DWORD = CF_NOVECTORFONTS; -pub const CF_NOSIMULATIONS: ::DWORD = 0x00001000; -pub const CF_LIMITSIZE: ::DWORD = 0x00002000; -pub const CF_FIXEDPITCHONLY: ::DWORD = 0x00004000; -pub const CF_WYSIWYG: ::DWORD = 0x00008000; -pub const CF_FORCEFONTEXIST: ::DWORD = 0x00010000; -pub const CF_SCALABLEONLY: ::DWORD = 0x00020000; -pub const CF_TTONLY: ::DWORD = 0x00040000; -pub const CF_NOFACESEL: ::DWORD = 0x00080000; -pub const CF_NOSTYLESEL: ::DWORD = 0x00100000; -pub const CF_NOSIZESEL: ::DWORD = 0x00200000; -pub const CF_SELECTSCRIPT: ::DWORD = 0x00400000; -pub const CF_NOSCRIPTSEL: ::DWORD = 0x00800000; -pub const CF_NOVERTFONTS: ::DWORD = 0x01000000; -pub const CF_INACTIVEFONTS: ::DWORD = 0x02000000; -pub const SIMULATED_FONTTYPE: ::WORD = 0x8000; -pub const PRINTER_FONTTYPE: ::WORD = 0x4000; -pub const SCREEN_FONTTYPE: ::WORD = 0x2000; -pub const BOLD_FONTTYPE: ::WORD = 0x0100; -pub const ITALIC_FONTTYPE: ::WORD = 0x0200; -pub const REGULAR_FONTTYPE: ::WORD = 0x0400; -pub const PS_OPENTYPE_FONTTYPE: ::DWORD = 0x10000; -pub const TT_OPENTYPE_FONTTYPE: ::DWORD = 0x20000; -pub const TYPE1_FONTTYPE: ::DWORD = 0x40000; -pub const SYMBOL_FONTTYPE: ::DWORD = 0x80000; -pub const WM_CHOOSEFONT_GETLOGFONT: ::UINT = ::WM_USER + 1; -pub const WM_CHOOSEFONT_SETLOGFONT: ::UINT = ::WM_USER + 101; -pub const WM_CHOOSEFONT_SETFLAGS: ::UINT = ::WM_USER + 102; -pub const CD_LBSELNOITEMS: ::WORD = -1i16 as ::WORD; -pub const CD_LBSELCHANGE: ::WORD = 0; -pub const CD_LBSELSUB: ::WORD = 1; -pub const CD_LBSELADD: ::WORD = 2; -pub type LPPRINTHOOKPROC = Option ::UINT_PTR>; -pub type LPSETUPHOOKPROC = Option ::UINT_PTR>; -STRUCT!{nodebug struct PRINTDLGA { - lStructSize: ::DWORD, - hwndOwner: ::HWND, - hDevMode: ::HGLOBAL, - hDevNames: ::HGLOBAL, - hDC: ::HDC, - Flags: ::DWORD, - nFromPage: ::WORD, - nToPage: ::WORD, - nMinPage: ::WORD, - nMaxPage: ::WORD, - nCopies: ::WORD, - hInstance: ::HINSTANCE, - lCustData: ::LPARAM, - lpfnPrintHook: LPPRINTHOOKPROC, - lpfnSetupHook: LPSETUPHOOKPROC, - lpPrintTemplateName: ::LPCSTR, - lpSetupTemplateName: ::LPCSTR, - hPrintTemplate: ::HGLOBAL, - hSetupTemplate: ::HGLOBAL, -}} -pub type LPPRINTDLGA = *mut PRINTDLGA; -STRUCT!{nodebug struct PRINTDLGW { - lStructSize: ::DWORD, - hwndOwner: ::HWND, - hDevMode: ::HGLOBAL, - hDevNames: ::HGLOBAL, - hDC: ::HDC, - Flags: ::DWORD, - nFromPage: ::WORD, - nToPage: ::WORD, - nMinPage: ::WORD, - nMaxPage: ::WORD, - nCopies: ::WORD, - hInstance: ::HINSTANCE, - lCustData: ::LPARAM, - lpfnPrintHook: LPPRINTHOOKPROC, - lpfnSetupHook: LPSETUPHOOKPROC, - lpPrintTemplateName: ::LPCWSTR, - lpSetupTemplateName: ::LPCWSTR, - hPrintTemplate: ::HGLOBAL, - hSetupTemplate: ::HGLOBAL, -}} -pub type LPPRINTDLGW = *mut PRINTDLGW; -RIDL!( -interface IPrintDialogCallback(IPrintDialogCallbackVtbl) : IUnknown(IUnknownVtbl) { - fn InitDone(&mut self) -> ::HRESULT, - fn SelectionChange(&mut self) -> ::HRESULT, - fn HandleMessage( - &mut self, hDlg: ::HWND, uMsg: ::UINT, wParam: ::WPARAM, lParam: ::LPARAM, - pResult: *mut ::LRESULT - ) -> ::HRESULT -} -); -RIDL!( -interface IPrintDialogServices(IPrintDialogServicesVtbl) : IUnknown(IUnknownVtbl) { - fn GetCurrentDevMode(&mut self, pDevMode: ::LPDEVMODEW, pcbSize: *mut ::UINT) -> ::HRESULT, - fn GetCurrentPrinterName(&mut self, pPrinterName: ::LPWSTR, pcchSize: *mut ::UINT) -> ::HRESULT, - fn GetCurrentPortName(&mut self, pPortName: ::LPWSTR, pcchSize: *mut ::UINT) -> ::HRESULT -} -); -STRUCT!{struct PRINTPAGERANGE { - nFromPage: ::DWORD, - nToPage: ::DWORD, -}} -pub type LPPRINTPAGERANGE = *mut PRINTPAGERANGE; -pub type PCPRINTPAGERANGE = *const PRINTPAGERANGE; -STRUCT!{struct PRINTDLGEXA { - lStructSize: ::DWORD, - hwndOwner: ::HWND, - hDevMode: ::HGLOBAL, - hDevNames: ::HGLOBAL, - hDC: ::HDC, - Flags: ::DWORD, - Flags2: ::DWORD, - ExclusionFlags: ::DWORD, - nPageRanges: ::DWORD, - nMaxPageRanges: ::DWORD, - lpPageRanges: LPPRINTPAGERANGE, - nMinPage: ::DWORD, - nMaxPage: ::DWORD, - nCopies: ::DWORD, - hInstance: ::HINSTANCE, - lpPrintTemplateName: ::LPCSTR, - lpCallback: ::LPUNKNOWN, - nPropertyPages: ::DWORD, - lphPropertyPages: *mut ::HPROPSHEETPAGE, - nStartPage: ::DWORD, - dwResultAction: ::DWORD, -}} -pub type LPPRINTDLGEXA = *mut PRINTDLGEXA; -STRUCT!{struct PRINTDLGEXW { - lStructSize: ::DWORD, - hwndOwner: ::HWND, - hDevMode: ::HGLOBAL, - hDevNames: ::HGLOBAL, - hDC: ::HDC, - Flags: ::DWORD, - Flags2: ::DWORD, - ExclusionFlags: ::DWORD, - nPageRanges: ::DWORD, - nMaxPageRanges: ::DWORD, - lpPageRanges: LPPRINTPAGERANGE, - nMinPage: ::DWORD, - nMaxPage: ::DWORD, - nCopies: ::DWORD, - hInstance: ::HINSTANCE, - lpPrintTemplateName: ::LPCWSTR, - lpCallback: ::LPUNKNOWN, - nPropertyPages: ::DWORD, - lphPropertyPages: *mut ::HPROPSHEETPAGE, - nStartPage: ::DWORD, - dwResultAction: ::DWORD, -}} -pub type LPPRINTDLGEXW = *mut PRINTDLGEXW; -pub const PD_ALLPAGES: ::DWORD = 0x00000000; -pub const PD_SELECTION: ::DWORD = 0x00000001; -pub const PD_PAGENUMS: ::DWORD = 0x00000002; -pub const PD_NOSELECTION: ::DWORD = 0x00000004; -pub const PD_NOPAGENUMS: ::DWORD = 0x00000008; -pub const PD_COLLATE: ::DWORD = 0x00000010; -pub const PD_PRINTTOFILE: ::DWORD = 0x00000020; -pub const PD_PRINTSETUP: ::DWORD = 0x00000040; -pub const PD_NOWARNING: ::DWORD = 0x00000080; -pub const PD_RETURNDC: ::DWORD = 0x00000100; -pub const PD_RETURNIC: ::DWORD = 0x00000200; -pub const PD_RETURNDEFAULT: ::DWORD = 0x00000400; -pub const PD_SHOWHELP: ::DWORD = 0x00000800; -pub const PD_ENABLEPRINTHOOK: ::DWORD = 0x00001000; -pub const PD_ENABLESETUPHOOK: ::DWORD = 0x00002000; -pub const PD_ENABLEPRINTTEMPLATE: ::DWORD = 0x00004000; -pub const PD_ENABLESETUPTEMPLATE: ::DWORD = 0x00008000; -pub const PD_ENABLEPRINTTEMPLATEHANDLE: ::DWORD = 0x00010000; -pub const PD_ENABLESETUPTEMPLATEHANDLE: ::DWORD = 0x00020000; -pub const PD_USEDEVMODECOPIES: ::DWORD = 0x00040000; -pub const PD_USEDEVMODECOPIESANDCOLLATE: ::DWORD = 0x00040000; -pub const PD_DISABLEPRINTTOFILE: ::DWORD = 0x00080000; -pub const PD_HIDEPRINTTOFILE: ::DWORD = 0x00100000; -pub const PD_NONETWORKBUTTON: ::DWORD = 0x00200000; -pub const PD_CURRENTPAGE: ::DWORD = 0x00400000; -pub const PD_NOCURRENTPAGE: ::DWORD = 0x00800000; -pub const PD_EXCLUSIONFLAGS: ::DWORD = 0x01000000; -pub const PD_USELARGETEMPLATE: ::DWORD = 0x10000000; -pub const PD_EXCL_COPIESANDCOLLATE: ::DWORD = ::DM_COPIES | ::DM_COLLATE; -pub const START_PAGE_GENERAL: ::DWORD = 0xffffffff; -pub const PD_RESULT_CANCEL: ::DWORD = 0; -pub const PD_RESULT_PRINT: ::DWORD = 1; -pub const PD_RESULT_APPLY: ::DWORD = 2; -STRUCT!{struct DEVNAMES { - wDriverOffset: ::WORD, - wDeviceOffset: ::WORD, - wOutputOffset: ::WORD, - wDefault: ::WORD, -}} -pub type LPDEVNAMES = *mut DEVNAMES; -pub type PCDEVNAMES = *const DEVNAMES; -pub const DN_DEFAULTPRN: ::WORD = 0x0001; -pub const WM_PSD_PAGESETUPDLG: ::UINT = ::WM_USER; -pub const WM_PSD_FULLPAGERECT: ::UINT = ::WM_USER + 1; -pub const WM_PSD_MINMARGINRECT: ::UINT = ::WM_USER + 2; -pub const WM_PSD_MARGINRECT: ::UINT = ::WM_USER + 3; -pub const WM_PSD_GREEKTEXTRECT: ::UINT = ::WM_USER + 4; -pub const WM_PSD_ENVSTAMPRECT: ::UINT = ::WM_USER + 5; -pub const WM_PSD_YAFULLPAGERECT: ::UINT = ::WM_USER + 6; -pub type LPPAGEPAINTHOOK = Option ::UINT_PTR>; -pub type LPPAGESETUPHOOK = Option ::UINT_PTR>; -STRUCT!{nodebug struct PAGESETUPDLGA { - lStructSize: ::DWORD, - hwndOwner: ::HWND, - hDevMode: ::HGLOBAL, - hDevNames: ::HGLOBAL, - Flags: ::DWORD, - ptPaperSize: ::POINT, - rtMinMargin: ::RECT, - rtMargin: ::RECT, - hInstance: ::HINSTANCE, - lCustData: ::LPARAM, - lpfnPageSetupHook: LPPAGESETUPHOOK, - lpfnPagePaintHook: LPPAGEPAINTHOOK, - lpPageSetupTemplateName: ::LPCSTR, - hPageSetupTemplate: ::HGLOBAL, -}} -pub type LPPAGESETUPDLGA = *mut PAGESETUPDLGA; -STRUCT!{nodebug struct PAGESETUPDLGW { - lStructSize: ::DWORD, - hwndOwner: ::HWND, - hDevMode: ::HGLOBAL, - hDevNames: ::HGLOBAL, - Flags: ::DWORD, - ptPaperSize: ::POINT, - rtMinMargin: ::RECT, - rtMargin: ::RECT, - hInstance: ::HINSTANCE, - lCustData: ::LPARAM, - lpfnPageSetupHook: LPPAGESETUPHOOK, - lpfnPagePaintHook: LPPAGEPAINTHOOK, - lpPageSetupTemplateName: ::LPCWSTR, - hPageSetupTemplate: ::HGLOBAL, -}} -pub type LPPAGESETUPDLGW = *mut PAGESETUPDLGW; -pub const PSD_DEFAULTMINMARGINS: ::DWORD = 0x00000000; -pub const PSD_INWININIINTLMEASURE: ::DWORD = 0x00000000; -pub const PSD_MINMARGINS: ::DWORD = 0x00000001; -pub const PSD_MARGINS: ::DWORD = 0x00000002; -pub const PSD_INTHOUSANDTHSOFINCHES: ::DWORD = 0x00000004; -pub const PSD_INHUNDREDTHSOFMILLIMETERS: ::DWORD = 0x00000008; -pub const PSD_DISABLEMARGINS: ::DWORD = 0x00000010; -pub const PSD_DISABLEPRINTER: ::DWORD = 0x00000020; -pub const PSD_NOWARNING: ::DWORD = 0x00000080; -pub const PSD_DISABLEORIENTATION: ::DWORD = 0x00000100; -pub const PSD_RETURNDEFAULT: ::DWORD = 0x00000400; -pub const PSD_DISABLEPAPER: ::DWORD = 0x00000200; -pub const PSD_SHOWHELP: ::DWORD = 0x00000800; -pub const PSD_ENABLEPAGESETUPHOOK: ::DWORD = 0x00002000; -pub const PSD_ENABLEPAGESETUPTEMPLATE: ::DWORD = 0x00008000; -pub const PSD_ENABLEPAGESETUPTEMPLATEHANDLE: ::DWORD = 0x00020000; -pub const PSD_ENABLEPAGEPAINTHOOK: ::DWORD = 0x00040000; -pub const PSD_DISABLEPAGEPAINTING: ::DWORD = 0x00080000; -pub const PSD_NONETWORKBUTTON: ::DWORD = 0x00200000; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/corsym.rs cargo-0.37.0/vendor/winapi-0.2.8/src/corsym.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/corsym.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/corsym.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Common Language Runtime Debugging Symbol Reader/Writer/Binder Interfaces -DEFINE_GUID!(CorSym_LanguageType_C, 0x63a08714, 0xfc37, 0x11d2, - 0x90, 0x4c, 0x0, 0xc0, 0x4f, 0xa3, 0x02, 0xa1); -DEFINE_GUID!(CorSym_LanguageType_CPlusPlus, 0x3a12d0b7, 0xc26c, 0x11d0, - 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2); -DEFINE_GUID!(CorSym_LanguageType_CSharp, 0x3f5162f8, 0x07c6, 0x11d3, - 0x90, 0x53, 0x0, 0xc0, 0x4f, 0xa3, 0x02, 0xa1); -DEFINE_GUID!(CorSym_LanguageType_Basic, 0x3a12d0b8, 0xc26c, 0x11d0, - 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2); -DEFINE_GUID!(CorSym_LanguageType_Java, 0x3a12d0b4, 0xc26c, 0x11d0, - 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2); -DEFINE_GUID!(CorSym_LanguageType_Cobol, 0xaf046cd1, 0xd0e1, 0x11d2, - 0x97, 0x7c, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc); -DEFINE_GUID!(CorSym_LanguageType_Pascal, 0xaf046cd2, 0xd0e1, 0x11d2, - 0x97, 0x7c, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc); -DEFINE_GUID!(CorSym_LanguageType_ILAssembly, 0xaf046cd3, 0xd0e1, 0x11d2, - 0x97, 0x7c, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc); -DEFINE_GUID!(CorSym_LanguageType_JScript, 0x3a12d0b6, 0xc26c, 0x11d0, - 0xb4, 0x42, 0x00, 0xa0, 0x24, 0x4a, 0x1d, 0xd2); -DEFINE_GUID!(CorSym_LanguageType_SMC, 0xd9b9f7b, 0x6611, 0x11d3, - 0xbd, 0x2a, 0x0, 0x0, 0xf8, 0x8, 0x49, 0xbd); -DEFINE_GUID!(CorSym_LanguageType_MCPlusPlus, 0x4b35fde8, 0x07c6, 0x11d3, - 0x90, 0x53, 0x0, 0xc0, 0x4f, 0xa3, 0x02, 0xa1); -DEFINE_GUID!(CorSym_LanguageVendor_Microsoft, 0x994b45c4, 0xe6e9, 0x11d2, - 0x90, 0x3f, 0x00, 0xc0, 0x4f, 0xa3, 0x02, 0xa1); -DEFINE_GUID!(CorSym_DocumentType_Text, 0x5a869d0b, 0x6611, 0x11d3, - 0xbd, 0x2a, 0x0, 0x0, 0xf8, 0x8, 0x49, 0xbd); -DEFINE_GUID!(CorSym_DocumentType_MC, 0xeb40cb65, 0x3c1f, 0x4352, - 0x9d, 0x7b, 0xba, 0xf, 0xc4, 0x7a, 0x9d, 0x77); -DEFINE_GUID!(CorSym_SourceHash_MD5, 0x406ea660, 0x64cf, 0x4c82, - 0xb6, 0xf0, 0x42, 0xd4, 0x81, 0x72, 0xa7, 0x99); -DEFINE_GUID!(CorSym_SourceHash_SHA1, 0xff1816ec, 0xaa5e, 0x4d10, - 0x87, 0xf7, 0x6f, 0x49, 0x63, 0x83, 0x34, 0x60); -ENUM!{enum CorSymAddrKind { - ADDR_IL_OFFSET = 1, - ADDR_NATIVE_RVA = 2, - ADDR_NATIVE_REGISTER = 3, - ADDR_NATIVE_REGREL = 4, - ADDR_NATIVE_OFFSET = 5, - ADDR_NATIVE_REGREG = 6, - ADDR_NATIVE_REGSTK = 7, - ADDR_NATIVE_STKREG = 8, - ADDR_BITFIELD = 9, - ADDR_NATIVE_ISECTOFFSET = 10, -}} -FLAGS!{enum CorSymVarFlag { - VAR_IS_COMP_GEN = 1, -}} -RIDL!( -interface ISymUnmanagedBinder(ISymUnmanagedBinderVtbl): IUnknown(IUnknownVtbl) { - fn GetReaderForFile( - &mut self, importer: *mut ::IUnknown, fileName: *const ::WCHAR, searchPath: *const ::WCHAR, - pRetVal: *mut *mut ISymUnmanagedReader - ) -> ::HRESULT, - fn GetReaderFromStream( - &mut self, importer: *mut ::IUnknown, pstream: *mut ::IStream, - pRetVal: *mut *mut ISymUnmanagedReader - ) -> ::HRESULT -} -); -FLAGS!{enum CorSymSearchPolicyAttributes { - AllowRegistryAccess = 0x1, - AllowSymbolServerAccess = 0x2, - AllowOriginalPathAccess = 0x4, - AllowReferencePathAccess = 0x8, -}} -RIDL!( -interface ISymUnmanagedBinder2(ISymUnmanagedBinder2Vtbl): - ISymUnmanagedBinder(ISymUnmanagedBinderVtbl) { - fn GetReaderForFile2( - &mut self, importer: *mut ::IUnknown, fileName: *const ::WCHAR, searchPath: *const ::WCHAR, - searchPolicy: ::ULONG32, pRetVal: *mut *mut ISymUnmanagedReader - ) -> ::HRESULT -} -); -#[derive(Clone, Copy)] -pub struct ISymUnmanagedReader; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/d2d1.rs cargo-0.37.0/vendor/winapi-0.2.8/src/d2d1.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/d2d1.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/d2d1.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,734 +0,0 @@ -// Copyright © 2015, Connor Hilarides -// Licensed under the MIT License -//! Mappings for the contents of d2d1.h -// Types confirmed affected by the ABI issue: -// D2D1_SIZE_F, D2D1_SIZE_U, D2D1_COLOR_F, D2D1_PIXEL_FORMAT, -// D2D1_POINT_2F -pub const D2D1_DEFAULT_FLATTENING_TOLERANCE: ::FLOAT = 0.25; -pub const D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR: ::DWORD = 0; -pub const D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR: ::DWORD = 1; -pub const D2D1_INTERPOLATION_MODE_DEFINITION_CUBIC: ::DWORD = 2; -pub const D2D1_INTERPOLATION_MODE_DEFINITION_MULTI_SAMPLE_LINEAR: ::DWORD = 3; -pub const D2D1_INTERPOLATION_MODE_DEFINITION_ANISOTROPIC: ::DWORD = 4; -pub const D2D1_INTERPOLATION_MODE_DEFINITION_HIGH_QUALITY_CUBIC: ::DWORD = 5; -pub const D2D1_INTERPOLATION_MODE_DEFINITION_FANT: ::DWORD = 6; -pub const D2D1_INTERPOLATION_MODE_DEFINITION_MIPMAP_LINEAR: ::DWORD = 7; -ENUM!{enum D2D1_GAMMA { - D2D1_GAMMA_2_2 = 0, - D2D1_GAMMA_1_0 = 1, -}} -ENUM!{enum D2D1_OPACITY_MASK_CONTENT { - D2D1_OPACITY_MASK_CONTENT_GRAPHICS = 0, - D2D1_OPACITY_MASK_CONTENT_TEXT_NATURAL = 1, - D2D1_OPACITY_MASK_CONTENT_TEXT_GDI_COMPATIBLE = 2, -}} -ENUM!{enum D2D1_EXTEND_MODE { - D2D1_EXTEND_MODE_CLAMP = 0, - D2D1_EXTEND_MODE_WRAP = 1, - D2D1_EXTEND_MODE_MIRROR = 2, -}} -ENUM!{enum D2D1_ANTIALIAS_MODE { - D2D1_ANTIALIAS_MODE_PER_PRIMITIVE = 0, - D2D1_ANTIALIAS_MODE_ALIASED = 1, -}} -ENUM!{enum D2D1_TEXT_ANTIALIAS_MODE { - D2D1_TEXT_ANTIALIAS_MODE_DEFAULT = 0, - D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE = 1, - D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE = 2, - D2D1_TEXT_ANTIALIAS_MODE_ALIASED = 3, -}} -ENUM!{enum D2D1_BITMAP_INTERPOLATION_MODE { - D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR = - D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR, - D2D1_BITMAP_INTERPOLATION_MODE_LINEAR = - D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR, -}} -FLAGS!{enum D2D1_DRAW_TEXT_OPTIONS { - D2D1_DRAW_TEXT_OPTIONS_NO_SNAP = 0x00000001, - D2D1_DRAW_TEXT_OPTIONS_CLIP = 0x00000002, - D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT = 0x00000004, - D2D1_DRAW_TEXT_OPTIONS_NONE = 0x00000000, -}} -pub type D2D1_POINT_2U = ::D2D_POINT_2U; -pub type D2D1_POINT_2F = ::D2D_POINT_2F; -pub type D2D1_RECT_F = ::D2D_RECT_F; -pub type D2D1_RECT_U = ::D2D_RECT_U; -pub type D2D1_SIZE_F = ::D2D_SIZE_F; -pub type D2D1_SIZE_U = ::D2D_SIZE_U; -pub type D2D1_COLOR_F = ::D2D_COLOR_F; -pub type D2D1_MATRIX_3X2_F = ::D2D_MATRIX_3X2_F; -pub type D2D1_TAG = ::UINT64; -STRUCT!{struct D2D1_BITMAP_PROPERTIES { - pixelFormat: ::D2D1_PIXEL_FORMAT, - dpiX: ::FLOAT, - dpiY: ::FLOAT, -}} -STRUCT!{struct D2D1_GRADIENT_STOP { - position: ::FLOAT, - color: D2D1_COLOR_F, -}} -STRUCT!{struct D2D1_BRUSH_PROPERTIES { - opacity: ::FLOAT, - transform: D2D1_MATRIX_3X2_F, -}} -STRUCT!{struct D2D1_BITMAP_BRUSH_PROPERTIES { - extendModeX: D2D1_EXTEND_MODE, - extendModeY: D2D1_EXTEND_MODE, - interpolationMode: D2D1_BITMAP_INTERPOLATION_MODE, -}} -STRUCT!{struct D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES { - startPoint: ::D2D1_POINT_2F, - endPoint: ::D2D1_POINT_2F, -}} -STRUCT!{struct D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES { - center: ::D2D1_POINT_2F, - gradientOriginOffset: ::D2D1_POINT_2F, - radiusX: ::FLOAT, - radiusY: ::FLOAT, -}} -ENUM!{enum D2D1_ARC_SIZE { - D2D1_ARC_SIZE_SMALL = 0, - D2D1_ARC_SIZE_LARGE = 1, -}} -ENUM!{enum D2D1_CAP_STYLE { - D2D1_CAP_STYLE_FLAT = 0, - D2D1_CAP_STYLE_SQUARE = 1, - D2D1_CAP_STYLE_ROUND = 2, - D2D1_CAP_STYLE_TRIANGLE = 3, -}} -ENUM!{enum D2D1_DASH_STYLE { - D2D1_DASH_STYLE_SOLID = 0, - D2D1_DASH_STYLE_DASH = 1, - D2D1_DASH_STYLE_DOT = 2, - D2D1_DASH_STYLE_DASH_DOT = 3, - D2D1_DASH_STYLE_DASH_DOT_DOT = 4, - D2D1_DASH_STYLE_CUSTOM = 5, -}} -ENUM!{enum D2D1_LINE_JOIN { - D2D1_LINE_JOIN_MITER = 0, - D2D1_LINE_JOIN_BEVEL = 1, - D2D1_LINE_JOIN_ROUND = 2, - D2D1_LINE_JOIN_MITER_OR_BEVEL = 3, -}} -ENUM!{enum D2D1_COMBINE_MODE { - D2D1_COMBINE_MODE_UNION = 0, - D2D1_COMBINE_MODE_INTERSECT = 1, - D2D1_COMBINE_MODE_XOR = 2, - D2D1_COMBINE_MODE_EXCLUDE = 3, -}} -ENUM!{enum D2D1_GEOMETRY_RELATION { - D2D1_GEOMETRY_RELATION_UNKNOWN = 0, - D2D1_GEOMETRY_RELATION_DISJOINT = 1, - D2D1_GEOMETRY_RELATION_IS_CONTAINED = 2, - D2D1_GEOMETRY_RELATION_CONTAINS = 3, - D2D1_GEOMETRY_RELATION_OVERLAP = 4, -}} -ENUM!{enum D2D1_GEOMETRY_SIMPLIFICATION_OPTION { - D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES = 0, - D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES = 1, -}} -ENUM!{enum D2D1_FIGURE_BEGIN { - D2D1_FIGURE_BEGIN_FILLED = 0, - D2D1_FIGURE_BEGIN_HOLLOW = 1, -}} -ENUM!{enum D2D1_FIGURE_END { - D2D1_FIGURE_END_OPEN = 0, - D2D1_FIGURE_END_CLOSED = 1, -}} -STRUCT!{struct D2D1_BEZIER_SEGMENT { - point1: ::D2D1_POINT_2F, - point2: ::D2D1_POINT_2F, - point3: ::D2D1_POINT_2F, -}} -STRUCT!{struct D2D1_TRIANGLE { - point1: ::D2D1_POINT_2F, - point2: ::D2D1_POINT_2F, - point3: ::D2D1_POINT_2F, -}} -FLAGS!{enum D2D1_PATH_SEGMENT { - D2D1_PATH_SEGMENT_NONE = 0x00000000, - D2D1_PATH_SEGMENT_FORCE_UNSTROKED = 0x00000001, - D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN = 0x00000002, -}} -ENUM!{enum D2D1_SWEEP_DIRECTION { - D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE = 0, - D2D1_SWEEP_DIRECTION_CLOCKWISE = 1, -}} -ENUM!{enum D2D1_FILL_MODE { - D2D1_FILL_MODE_ALTERNATE = 0, - D2D1_FILL_MODE_WINDING = 1, -}} -STRUCT!{struct D2D1_ARC_SEGMENT { - point: ::D2D1_POINT_2F, - size: D2D1_SIZE_F, - rotationAngle: ::FLOAT, - sweepDirection: D2D1_SWEEP_DIRECTION, - arcSize: D2D1_ARC_SIZE, -}} -STRUCT!{struct D2D1_QUADRATIC_BEZIER_SEGMENT { - point1: ::D2D1_POINT_2F, - point2: ::D2D1_POINT_2F, -}} -STRUCT!{struct D2D1_ELLIPSE { - point: ::D2D1_POINT_2F, - radiusX: ::FLOAT, - radiusY: ::FLOAT, -}} -STRUCT!{struct D2D1_ROUNDED_RECT { - rect: ::D2D1_RECT_F, - radiusX: ::FLOAT, - radiusY: ::FLOAT, -}} -STRUCT!{struct D2D1_STROKE_STYLE_PROPERTIES { - startCap: D2D1_CAP_STYLE, - endCap: D2D1_CAP_STYLE, - dashCap: D2D1_CAP_STYLE, - lineJoin: D2D1_LINE_JOIN, - miterLimit: ::FLOAT, - dashStyle: D2D1_DASH_STYLE, - dashOffset: ::FLOAT, -}} -FLAGS!{enum D2D1_LAYER_OPTIONS { - D2D1_LAYER_OPTIONS_NONE = 0x00000000, - D2D1_LAYER_OPTIONS_INITIALIZE_FOR_CLEARTYPE = 0x00000001, -}} -STRUCT!{struct D2D1_LAYER_PARAMETERS { - contentBounds: ::D2D1_RECT_F, - geometricMask: *mut ID2D1Geometry, - maskAntialiasMode: D2D1_ANTIALIAS_MODE, - maskTransform: D2D1_MATRIX_3X2_F, - opacity: ::FLOAT, - opacityBrush: *mut ID2D1Brush, - layerOptions: D2D1_LAYER_OPTIONS, -}} -ENUM!{enum D2D1_WINDOW_STATE { - D2D1_WINDOW_STATE_NONE = 0x0000000, - D2D1_WINDOW_STATE_OCCLUDED = 0x0000001, -}} -ENUM!{enum D2D1_RENDER_TARGET_TYPE { - D2D1_RENDER_TARGET_TYPE_DEFAULT = 0, - D2D1_RENDER_TARGET_TYPE_SOFTWARE = 1, - D2D1_RENDER_TARGET_TYPE_HARDWARE = 2, -}} -ENUM!{enum D2D1_FEATURE_LEVEL { - D2D1_FEATURE_LEVEL_DEFAULT = 0, - D2D1_FEATURE_LEVEL_9 = ::D3D_FEATURE_LEVEL_9_1.0, - D2D1_FEATURE_LEVEL_10 = ::D3D_FEATURE_LEVEL_10_0.0, -}} -FLAGS!{enum D2D1_RENDER_TARGET_USAGE { - D2D1_RENDER_TARGET_USAGE_NONE = 0x00000000, - D2D1_RENDER_TARGET_USAGE_FORCE_BITMAP_REMOTING = 0x00000001, - D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE = 0x00000002, -}} -FLAGS!{enum D2D1_PRESENT_OPTIONS { - D2D1_PRESENT_OPTIONS_NONE = 0x00000000, - D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS = 0x00000001, - D2D1_PRESENT_OPTIONS_IMMEDIATELY = 0x00000002, -}} -STRUCT!{struct D2D1_RENDER_TARGET_PROPERTIES { - _type: D2D1_RENDER_TARGET_TYPE, - pixelFormat: ::D2D1_PIXEL_FORMAT, - dpiX: ::FLOAT, - dpiY: ::FLOAT, - usage: D2D1_RENDER_TARGET_USAGE, - minLevel: D2D1_FEATURE_LEVEL, -}} -STRUCT!{struct D2D1_HWND_RENDER_TARGET_PROPERTIES { - hwnd: ::HWND, - pixelSize: D2D1_SIZE_U, - presentOptions: D2D1_PRESENT_OPTIONS, -}} -FLAGS!{enum D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS { - D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE = 0x00000000, - D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_GDI_COMPATIBLE = 0x00000001, -}} -STRUCT!{struct D2D1_DRAWING_STATE_DESCRIPTION { - antialiasMode: D2D1_ANTIALIAS_MODE, - textAntialiasMode: D2D1_TEXT_ANTIALIAS_MODE, - tag1: D2D1_TAG, - tag2: D2D1_TAG, - transform: D2D1_MATRIX_3X2_F, -}} -ENUM!{enum D2D1_DC_INITIALIZE_MODE { - D2D1_DC_INITIALIZE_MODE_COPY = 0, - D2D1_DC_INITIALIZE_MODE_CLEAR = 1, -}} -ENUM!{enum D2D1_DEBUG_LEVEL { - D2D1_DEBUG_LEVEL_NONE = 0, - D2D1_DEBUG_LEVEL_ERROR = 1, - D2D1_DEBUG_LEVEL_WARNING = 2, - D2D1_DEBUG_LEVEL_INFORMATION = 3, -}} -ENUM!{enum D2D1_FACTORY_TYPE { - D2D1_FACTORY_TYPE_SINGLE_THREADED = 0, - D2D1_FACTORY_TYPE_MULTI_THREADED = 1, -}} -STRUCT!{struct D2D1_FACTORY_OPTIONS { - debugLevel: D2D1_DEBUG_LEVEL, -}} -RIDL!( -interface ID2D1Resource(ID2D1ResourceVtbl): IUnknown(IUnknownVtbl) { - fn GetFactory(&mut self, factory: *mut *mut ID2D1Factory) -> () -}); -RIDL!( -interface ID2D1Image(ID2D1ImageVtbl): ID2D1Resource(ID2D1ResourceVtbl) { -}); -RIDL!( -interface ID2D1Bitmap(ID2D1BitmapVtbl): ID2D1Image(ID2D1ImageVtbl) { - fn GetSize(&mut self, ret: *mut D2D1_SIZE_F) -> *mut D2D1_SIZE_F, // FIXME: ABI issue - fn GetPixelSize(&mut self, ret: *mut D2D1_SIZE_U) -> *mut D2D1_SIZE_U, // FIXME: ABI issue - fn GetPixelFormat( - &mut self, ret: *mut ::D2D1_PIXEL_FORMAT - ) -> *mut ::D2D1_PIXEL_FORMAT, // FIXME: ABI issue - fn GetDpi(&mut self, dpiX: *mut ::FLOAT, dpiY: *mut ::FLOAT) -> (), - fn CopyFromBitmap( - &mut self, destPoint: *const ::D2D1_POINT_2U, bitmap: *mut ID2D1Bitmap, - srcRect: *const ::D2D1_RECT_U - ) -> ::HRESULT, - fn CopyFromRenderTarget( - &mut self, destPoint: *const ::D2D1_POINT_2U, renderTarget: *mut ID2D1RenderTarget, - srcRect: *const ::D2D1_RECT_U - ) -> ::HRESULT, - fn CopyFromMemory( - &mut self, dstRect: *const ::D2D1_RECT_U, srcData: *const ::c_void, pitch: ::UINT32 - ) -> ::HRESULT -}); -RIDL!( -interface ID2D1GradientStopCollection(ID2D1GradientStopCollectionVtbl) - : ID2D1Resource(ID2D1ResourceVtbl) { - fn GetGradientStopCount(&mut self) -> ::UINT32, - fn GetGradientStops( - &mut self, gradientStops: *mut D2D1_GRADIENT_STOP, gradientStopsCount: ::UINT32 - ) -> (), - fn GetColorInterpolationGamma(&mut self) -> D2D1_GAMMA, - fn GetExtendMode(&mut self) -> D2D1_EXTEND_MODE -}); -RIDL!( -interface ID2D1Brush(ID2D1BrushVtbl): ID2D1Resource(ID2D1ResourceVtbl) { - fn SetOpacity(&mut self, opacity: ::FLOAT) -> (), - fn SetTransform(&mut self, transform: *const D2D1_MATRIX_3X2_F) -> (), - fn GetOpacity(&mut self) -> ::FLOAT, - fn GetTransform(&mut self, transform: *mut D2D1_MATRIX_3X2_F) -> () -}); -RIDL!( -interface ID2D1BitmapBrush(ID2D1BitmapBrushVtbl): ID2D1Brush(ID2D1BrushVtbl) { - fn SetExtendModeX(&mut self, extendModeX: D2D1_EXTEND_MODE) -> (), - fn SetExtendModeY(&mut self, extendModeY: D2D1_EXTEND_MODE) -> (), - fn SetInterpolationMode(&mut self, interpolationMode: D2D1_BITMAP_INTERPOLATION_MODE) -> (), - fn SetBitmap(&mut self, bitmap: *mut ID2D1Bitmap) -> (), - fn GetExtendModeX(&mut self) -> D2D1_EXTEND_MODE, - fn GetExtendModeY(&mut self) -> D2D1_EXTEND_MODE, - fn GetInterpolationMode(&mut self) -> D2D1_BITMAP_INTERPOLATION_MODE, - fn GetBitmap(&mut self, bitmap: *mut *mut ID2D1Bitmap) -> () -}); -RIDL!( -interface ID2D1SolidColorBrush(ID2D1SolidColorBrushVtbl): ID2D1Brush(ID2D1BrushVtbl) { - fn SetColor(&mut self, color: *const D2D1_COLOR_F) -> (), - fn GetColor(&mut self, color: *mut D2D1_COLOR_F) -> *mut D2D1_COLOR_F -}); -RIDL!( -interface ID2D1LinearGradientBrush(ID2D1LinearGradientBrushVtbl): ID2D1Brush(ID2D1BrushVtbl) { - fn SetStartPoint(&mut self, startPoint: ::D2D1_POINT_2F) -> (), - fn SetEndPoint(&mut self, endPoint: ::D2D1_POINT_2F) -> (), - fn GetStartPoint(&mut self, ret: *mut D2D1_POINT_2F) -> *mut D2D1_POINT_2F, // FIXME ABI issue - fn GetEndPoint(&mut self, ret: *mut D2D1_POINT_2F) -> *mut D2D1_POINT_2F, // FIXME ABI issue - fn GetGradientStopCollection( - &mut self, gradientStopCollection: *mut *mut ID2D1GradientStopCollection - ) -> () -}); -RIDL!( -interface ID2D1RadialGradientBrush(ID2D1RadialGradientBrushVtbl): ID2D1Brush(ID2D1BrushVtbl) { - fn SetCenter(&mut self, center: ::D2D1_POINT_2F) -> (), - fn SetGradientOriginOffset(&mut self, gradientOriginOffset: ::D2D1_POINT_2F) -> (), - fn SetRadiusX(&mut self, radiusX: ::FLOAT) -> (), - fn SetRadiusY(&mut self, radiusY: ::FLOAT) -> (), - fn GetCenter(&mut self, ret: *mut D2D1_POINT_2F) -> *mut D2D1_POINT_2F, // FIXME ABI issue - fn GetGradientOriginOffset( - &mut self, ret: *mut D2D1_POINT_2F - ) -> *mut D2D1_POINT_2F, // FIXME ABI issue - fn GetRadiusX(&mut self) -> ::FLOAT, - fn GetRadiusY(&mut self) -> ::FLOAT, - fn GetGradientStopCollection( - &mut self, gradientStopCollection: *mut *mut ID2D1GradientStopCollection - ) -> () -}); -RIDL!( -interface ID2D1StrokeStyle(ID2D1StrokeStyleVtbl): ID2D1Resource(ID2D1ResourceVtbl) { - fn GetStartCap(&mut self) -> D2D1_CAP_STYLE, - fn GetEndCap(&mut self) -> D2D1_CAP_STYLE, - fn GetDashCap(&mut self) -> D2D1_CAP_STYLE, - fn GetMiterLimit(&mut self) -> ::FLOAT, - fn GetLineJoin(&mut self) -> D2D1_LINE_JOIN, - fn GetDashOffset(&mut self) -> ::FLOAT, - fn GetDashStyle(&mut self) -> D2D1_DASH_STYLE, - fn GetDashesCount(&mut self) -> ::UINT32, - fn GetDashes(&mut self, dashes: *mut ::FLOAT, dashesCount: ::UINT32) -> () -}); -RIDL!( -interface ID2D1Geometry(ID2D1GeometryVtbl): ID2D1Resource(ID2D1ResourceVtbl) { - fn GetBounds( - &mut self, worldTransform: *const D2D1_MATRIX_3X2_F, bounds: *mut ::D2D1_RECT_F - ) -> ::HRESULT, - fn GetWidenedBounds( - &mut self, strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle, - worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, - bounds: *mut ::D2D1_RECT_F - ) -> ::HRESULT, - fn StrokeContainsPoint( - &mut self, point: ::D2D1_POINT_2F, strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle, - worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, - contains: *mut ::BOOL - ) -> ::HRESULT, - fn FillContainsPoint( - &mut self, point: ::D2D1_POINT_2F, worldTransform: *const D2D1_MATRIX_3X2_F, - flatteningTolerance: ::FLOAT, contains: *mut ::BOOL - ) -> ::HRESULT, - fn CompareWithGeometry( - &mut self, inputGeometry: *mut ID2D1Geometry, - inputGeometryTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, - relation: *mut D2D1_GEOMETRY_RELATION - ) -> ::HRESULT, - fn Simplify( - &mut self, simplificationOption: D2D1_GEOMETRY_SIMPLIFICATION_OPTION, - worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, - geometrySink: *mut ID2D1SimplifiedGeometrySink - ) -> ::HRESULT, - fn Tessellate( - &mut self, worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, - tessellationSink: *mut ID2D1TessellationSink - ) -> ::HRESULT, - fn CombineWithGeometry( - &mut self, inputGeometry: *mut ID2D1Geometry, combineMode: D2D1_COMBINE_MODE, - inputGeometryTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, - geometrySink: *mut ID2D1SimplifiedGeometrySink - ) -> ::HRESULT, - fn Outline( - &mut self, worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, - geometrySink: *mut ID2D1SimplifiedGeometrySink - ) -> ::HRESULT, - fn ComputeArea( - &mut self, worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, - area: *mut ::FLOAT - ) -> ::HRESULT, - fn ComputeLength( - &mut self, worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, - length: *mut ::FLOAT - ) -> ::HRESULT, - fn ComputePointAtLength( - &mut self, length: ::FLOAT, worldTransform: *const D2D1_MATRIX_3X2_F, - flatteningTolerance: ::FLOAT, point: *mut ::D2D1_POINT_2F, - unitTangentVector: *mut ::D2D1_POINT_2F - ) -> ::HRESULT, - fn Widen( - &mut self, strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle, - worldTransform: *const D2D1_MATRIX_3X2_F, flatteningTolerance: ::FLOAT, - geometrySink: *mut ID2D1SimplifiedGeometrySink - ) -> ::HRESULT -}); -RIDL!( -interface ID2D1RectangleGeometry(ID2D1RectangleGeometryVtbl): ID2D1Geometry(ID2D1GeometryVtbl) { - fn GetRect(&mut self, rect: *mut ::D2D1_RECT_F) -> () -}); -RIDL!( -interface ID2D1RoundedRectangleGeometry(ID2D1RoundedRectangleGeometryVtbl) - : ID2D1Geometry(ID2D1GeometryVtbl) { - fn GetRoundedRect(&mut self, roundedRect: *mut D2D1_ROUNDED_RECT) -> () -}); -RIDL!( -interface ID2D1EllipseGeometry(ID2D1EllipseGeometryVtbl): ID2D1Geometry(ID2D1GeometryVtbl) { - fn GetEllipse(&mut self, ellipse: *mut D2D1_ELLIPSE) -> () -}); -RIDL!( -interface ID2D1GeometryGroup(ID2D1GeometryGroupVtbl): ID2D1Geometry(ID2D1GeometryVtbl) { - fn GetFillMode(&mut self) -> D2D1_FILL_MODE, - fn GetSourceGeometryCount(&mut self) -> ::UINT32, - fn GetSourceGeometries( - &mut self, geometries: *mut *mut ID2D1Geometry, geometriesCount: ::UINT32 - ) -> () -}); -RIDL!( -interface ID2D1TransformedGeometry(ID2D1TransformedGeometryVtbl) - : ID2D1Geometry(ID2D1GeometryVtbl) { - fn GetSourceGeometry(&mut self, sourceGeometry: *mut *mut ID2D1Geometry) -> (), - fn GetTransform(&mut self, transform: *mut D2D1_MATRIX_3X2_F) -> () -}); -RIDL!( -interface ID2D1SimplifiedGeometrySink(ID2D1SimplifiedGeometrySinkVtbl): IUnknown(IUnknownVtbl) { - fn SetFillMode(&mut self, fillMode: D2D1_FILL_MODE) -> (), - fn SetSegmentFlags(&mut self, vertexFlags: D2D1_PATH_SEGMENT) -> (), - fn BeginFigure(&mut self, startPoint: ::D2D1_POINT_2F, figureBegin: D2D1_FIGURE_BEGIN) -> (), - fn AddLines(&mut self, points: *const ::D2D1_POINT_2F, pointsCount: ::UINT32) -> (), - fn AddBeziers(&mut self, beziers: *const D2D1_BEZIER_SEGMENT, beziersCount: ::UINT32) -> (), - fn EndFigure(&mut self, figureEnd: D2D1_FIGURE_END) -> (), - fn Close(&mut self) -> ::HRESULT -}); -RIDL!( -interface ID2D1GeometrySink(ID2D1GeometrySinkVtbl) - : ID2D1SimplifiedGeometrySink(ID2D1SimplifiedGeometrySinkVtbl) { - fn AddLine(&mut self, point: ::D2D1_POINT_2F) -> (), - fn AddBezier(&mut self, bezier: *const D2D1_BEZIER_SEGMENT) -> (), - fn AddQuadraticBezier(&mut self, bezier: *const D2D1_QUADRATIC_BEZIER_SEGMENT) -> (), - fn AddQuadraticBeziers( - &mut self, beziers: *const D2D1_QUADRATIC_BEZIER_SEGMENT, beziersCount: ::UINT32 - ) -> (), - fn AddArc(&mut self, arc: *const D2D1_ARC_SEGMENT) -> () -}); -RIDL!( -interface ID2D1TessellationSink(ID2D1TessellationSinkVtbl): IUnknown(IUnknownVtbl) { - fn AddTriangles(&mut self, triangles: *const D2D1_TRIANGLE, triangleCount: ::UINT32) -> (), - fn Close(&mut self) -> ::HRESULT -}); -RIDL!( -interface ID2D1PathGeometry(ID2D1PathGeometryVtbl): ID2D1Geometry(ID2D1GeometryVtbl) { - fn Open(&mut self, geometrySink: *mut *mut ID2D1GeometrySink) -> ::HRESULT, - fn Stream(&mut self, geometrySink: *mut ID2D1GeometrySink) -> ::HRESULT, - fn GetSegmentCount(&mut self, count: *mut ::UINT32) -> ::HRESULT, - fn GetFigureCount(&mut self, count: *mut ::UINT32) -> ::HRESULT -}); -RIDL!( -interface ID2D1Mesh(ID2D1MeshVtbl): ID2D1Resource(ID2D1ResourceVtbl) { - fn Open(&mut self, tessellationSink: *mut *mut ID2D1TessellationSink) -> ::HRESULT -}); -RIDL!( -interface ID2D1Layer(ID2D1LayerVtbl): ID2D1Resource(ID2D1ResourceVtbl) { - fn GetSize(&mut self, ret: *mut D2D1_SIZE_F) -> *mut D2D1_SIZE_F // FIXME: ABI issue -}); -RIDL!( -interface ID2D1DrawingStateBlock(ID2D1DrawingStateBlockVtbl): ID2D1Resource(ID2D1ResourceVtbl) { - fn GetDescription(&mut self, stateDescription: *mut D2D1_DRAWING_STATE_DESCRIPTION) -> (), - fn SetDescription(&mut self, stateDescription: *const D2D1_DRAWING_STATE_DESCRIPTION) -> (), - fn SetTextRenderingParams( - &mut self, textRenderingParams: *mut ::IDWriteRenderingParams - ) -> (), - fn GetTextRenderingParams( - &mut self, textRenderingParams: *mut *mut ::IDWriteRenderingParams - ) -> () -}); -RIDL!( -interface ID2D1RenderTarget(ID2D1RenderTargetVtbl): ID2D1Resource(ID2D1ResourceVtbl) { - fn CreateBitmap( - &mut self, size: D2D1_SIZE_U, srcData: *const ::c_void, pitch: ::UINT32, - bitmapProperties: *const D2D1_BITMAP_PROPERTIES, bitmap: *mut *mut ID2D1Bitmap - ) -> ::HRESULT, - fn CreateBitmapFromWicBitmap( - &mut self, wicBitmapSource: *mut ::IWICBitmapSource, - bitmapProperties: *const D2D1_BITMAP_PROPERTIES, bitmap: *mut *mut ID2D1Bitmap - ) -> ::HRESULT, - fn CreateSharedBitmap( - &mut self, riid: ::REFIID, data: *const ::c_void, - bitmapProperties: *const D2D1_BITMAP_PROPERTIES, bitmap: *mut *mut ID2D1Bitmap - ) -> ::HRESULT, - fn CreateBitmapBrush( - &mut self, bitmap: *mut ID2D1Bitmap, - bitmapBrushProperties: *const D2D1_BITMAP_BRUSH_PROPERTIES, - brushProperties: *const D2D1_BRUSH_PROPERTIES, bitmapBrush: *mut *mut ID2D1BitmapBrush - ) -> ::HRESULT, - fn CreateSolidColorBrush( - &mut self, color: *const D2D1_COLOR_F, brushProperties: *const D2D1_BRUSH_PROPERTIES, - solidColorBrush: *mut *mut ID2D1SolidColorBrush - ) -> ::HRESULT, - fn CreateGradientStopCollection( - &mut self, gradientStops: *const D2D1_GRADIENT_STOP, gradientStopsCount: ::UINT32, - colorInterpolationGamma: D2D1_GAMMA, extendMode: D2D1_EXTEND_MODE, - gradientStopCollection: *mut *mut ID2D1GradientStopCollection - ) -> ::HRESULT, - fn CreateLinearGradientBrush( - &mut self, linearGradientBrushProperties: *const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES, - brushProperties: *const D2D1_BRUSH_PROPERTIES, - gradientStopCollection: *mut ID2D1GradientStopCollection, - linearGradientBrush: *mut *mut ID2D1LinearGradientBrush - ) -> ::HRESULT, - fn CreateRadialGradientBrush( - &mut self, radialGradientBrushProperties: *const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES, - brushProperties: *const D2D1_BRUSH_PROPERTIES, - gradientStopCollection: *mut ID2D1GradientStopCollection, - radialGradientBrush: *mut *mut ID2D1RadialGradientBrush - ) -> ::HRESULT, - fn CreateCompatibleRenderTarget( - &mut self, desiredSize: *const D2D1_SIZE_F, desiredPixelSize: *const D2D1_SIZE_U, - desiredFormat: *const ::D2D1_PIXEL_FORMAT, options: D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS, - bitmapRenderTarget: *mut *mut ID2D1BitmapRenderTarget - ) -> ::HRESULT, - fn CreateLayer(&mut self, size: *const D2D1_SIZE_F, layer: *mut *mut ID2D1Layer) -> ::HRESULT, - fn CreateMesh(&mut self, mesh: *mut *mut ID2D1Mesh) -> ::HRESULT, - fn DrawLine( - &mut self, point0: ::D2D1_POINT_2F, point1: ::D2D1_POINT_2F, brush: *mut ID2D1Brush, - strokeWidth: ::FLOAT, strokeStype: *mut ID2D1StrokeStyle - ) -> (), - fn DrawRectangle( - &mut self, rect: *const ::D2D1_RECT_F, brush: *mut ID2D1Brush, - strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle - ) -> (), - fn FillRectangle( - &mut self, rect: *const ::D2D1_RECT_F, brush: *mut ID2D1Brush - ) -> (), - fn DrawRoundedRectangle( - &mut self, roundedRect: *const D2D1_ROUNDED_RECT, brush: *mut ID2D1Brush, - strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle - ) -> (), - fn FillRoundedRectangle( - &mut self, roundedRect: *const D2D1_ROUNDED_RECT, brush: *mut ID2D1Brush - ) -> (), - fn DrawEllipse( - &mut self, ellipse: *const D2D1_ELLIPSE, brush: *mut ID2D1Brush, - strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle - ) -> (), - fn FillEllipse( - &mut self, ellipse: *const D2D1_ELLIPSE, brush: *mut ID2D1Brush - ) -> (), - fn DrawGeometry( - &mut self, geometry: *mut ID2D1Geometry, brush: *mut ID2D1Brush, - strokeWidth: ::FLOAT, strokeStyle: *mut ID2D1StrokeStyle - ) -> (), - fn FillGeometry( - &mut self, geometry: *mut ID2D1Geometry, brush: *mut ID2D1Brush, - opacityBrush: *mut ID2D1Brush - ) -> (), - fn FillMesh( - &mut self, mesh: *mut ID2D1Mesh, brush: *const ID2D1Brush - ) -> (), - fn FillOpacityMask( - &mut self, opacityMask: *mut ID2D1Bitmap, brush: *mut ID2D1Brush, - content: D2D1_OPACITY_MASK_CONTENT, destinationRectangle: *const ::D2D1_RECT_F, - sourceRectangle: *const ::D2D1_RECT_F - ) -> (), - fn DrawBitmap( - &mut self, bitmap: *mut ID2D1Bitmap, destinationRectangle: *const ::D2D1_RECT_F, - opacity: ::FLOAT, interpolationMode: D2D1_BITMAP_INTERPOLATION_MODE, - sourceRectangle: *const ::D2D1_RECT_F - ) -> (), - fn DrawText( - &mut self, string: *const ::WCHAR, stringLength: ::UINT32, - textFormat: *mut ::IDWriteTextFormat, layoutRect: *const ::D2D1_RECT_F, - defaultForegroundBrush: *mut ID2D1Brush, options: D2D1_DRAW_TEXT_OPTIONS, - measuringMode: ::DWRITE_MEASURING_MODE - ) -> (), - fn DrawTextLayout( - &mut self, origin: ::D2D1_POINT_2F, textLayout: *mut ::IDWriteTextLayout, - defaultForegroundBrush: *mut ID2D1Brush, options: D2D1_DRAW_TEXT_OPTIONS - ) -> (), - fn DrawGlyphRun( - &mut self, baselineOrigin: ::D2D1_POINT_2F, glyphRun: *const ::DWRITE_GLYPH_RUN, - foregroundBrush: *mut ID2D1Brush, measuringMode: ::DWRITE_MEASURING_MODE - ) -> (), - fn SetTransform(&mut self, transform: *const D2D1_MATRIX_3X2_F) -> (), - fn GetTransform(&mut self, transform: *mut D2D1_MATRIX_3X2_F) -> (), - fn SetAntialiasMode(&mut self, antialiasMode: D2D1_ANTIALIAS_MODE) -> (), - fn GetAntialiasMode(&mut self) -> D2D1_ANTIALIAS_MODE, - fn SetTextAntialiasMode(&mut self, textAntialiasMode: D2D1_TEXT_ANTIALIAS_MODE) -> (), - fn GetTextAntialiasMode(&mut self) -> D2D1_TEXT_ANTIALIAS_MODE, - fn SetTextRenderingParams( - &mut self, textRenderingParams: *mut ::IDWriteRenderingParams - ) -> (), - fn GetTextRenderingParams( - &mut self, textRenderingParams: *mut *mut ::IDWriteRenderingParams - ) -> (), - fn SetTags(&mut self, tag1: D2D1_TAG, tag2: D2D1_TAG) -> (), - fn GetTags(&mut self, tag1: *mut D2D1_TAG, tag2: *mut D2D1_TAG) -> (), - fn PushLayer( - &mut self, layerParameters: *const D2D1_LAYER_PARAMETERS, layer: *mut ID2D1Layer - ) -> (), - fn PopLayer(&mut self) -> (), - fn Flush(&mut self, tag1: *mut D2D1_TAG, tag2: *mut D2D1_TAG) -> ::HRESULT, - fn SaveDrawingState(&mut self, drawingStateBlock: *mut ID2D1DrawingStateBlock) -> (), - fn RestoreDrawingState(&mut self, drawingStateBlock: *mut ID2D1DrawingStateBlock) -> (), - fn PushAxisAlignedClip( - &mut self, clipRect: *const ::D2D1_RECT_F, antialiasMode: D2D1_ANTIALIAS_MODE - ) -> (), - fn PopAxisAlignedClip(&mut self) -> (), - fn Clear(&mut self, clearColor: *const D2D1_COLOR_F) -> (), - fn BeginDraw(&mut self) -> (), - fn EndDraw(&mut self, tag1: *mut D2D1_TAG, tag2: *mut D2D1_TAG) -> ::HRESULT, - fn GetPixelFormat( - &mut self, ret: *mut ::D2D1_PIXEL_FORMAT - ) -> *mut ::D2D1_PIXEL_FORMAT, // FIXME: ABI issue - fn SetDpi(&mut self, dpiX: ::FLOAT, dpiY: ::FLOAT) -> (), - fn GetDpi(&mut self, dpiX: *mut ::FLOAT, dpiY: *mut ::FLOAT) -> (), - fn GetSize(&mut self, ret: *mut D2D1_SIZE_F) -> *mut D2D1_SIZE_F, // FIXME: ABI issue - fn GetPixelSize(&mut self, ret: *mut D2D1_SIZE_U) -> *mut D2D1_SIZE_U, // FIXME: ABI issue - fn GetMaximumBitmapSize(&mut self) -> ::UINT32, - fn IsSupported( - &mut self, renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES - ) -> ::BOOL -}); -RIDL!( -interface ID2D1BitmapRenderTarget(ID2D1BitmapRenderTargetVtbl) - : ID2D1RenderTarget(ID2D1RenderTargetVtbl) { - fn GetBitmap(&mut self, bitmap: *mut *mut ID2D1Bitmap) -> ::HRESULT -}); -RIDL!( -interface ID2D1HwndRenderTarget(ID2D1HwndRenderTargetVtbl) - : ID2D1RenderTarget(ID2D1RenderTargetVtbl) { - fn CheckWindowState(&mut self) -> D2D1_WINDOW_STATE, - fn Resize(&mut self, pixelSize: *const D2D1_SIZE_U) -> ::HRESULT, - fn GetHwnd(&mut self) -> ::HWND -}); -RIDL!( -interface ID2D1GdiInteropRenderTarget(ID2D1GdiInteropRenderTargetVtbl): IUnknown(IUnknownVtbl) { - fn GetDC(&mut self, mode: D2D1_DC_INITIALIZE_MODE, hdc: *mut ::HDC) -> ::HRESULT, - fn ReleaseDC(&mut self, update: *const ::RECT) -> ::HRESULT -}); -RIDL!( -interface ID2D1DCRenderTarget(ID2D1DCRenderTargetVtbl): ID2D1RenderTarget(ID2D1RenderTargetVtbl) { - fn BindDC(&mut self, hDC: ::HDC, pSubRect: *const ::RECT) -> ::HRESULT -}); -RIDL!( -interface ID2D1Factory(ID2D1FactoryVtbl): IUnknown(IUnknownVtbl) { - fn ReloadSystemMetrics(&mut self) -> ::HRESULT, - fn GetDesktopDpi(&mut self, dpiX: *mut ::FLOAT, dpiY: *mut ::FLOAT) -> (), - fn CreateRectangleGeometry( - &mut self, rectangle: *const ::D2D1_RECT_F, - rectangleGeometry: *mut *mut ID2D1RectangleGeometry - ) -> ::HRESULT, - fn CreateRoundedRectangleGeometry( - &mut self, roundedRectangle: *const D2D1_ROUNDED_RECT, - roundedRectangleGeometry: *mut *mut ID2D1RoundedRectangleGeometry - ) -> ::HRESULT, - fn CreateEllipseGeometry( - &mut self, ellipse: *const D2D1_ELLIPSE, - ellipseGeometry: *mut *mut ID2D1EllipseGeometry - ) -> ::HRESULT, - fn CreateGeometryGroup( - &mut self, fillMode: D2D1_FILL_MODE, geometries: *mut *mut ID2D1Geometry, - geometriesCount: ::UINT32, geometryGroup: *mut *mut ID2D1GeometryGroup - ) -> ::HRESULT, - fn CreateTransformedGeometry( - &mut self, sourceGeometry: *mut ID2D1Geometry, transform: *const D2D1_MATRIX_3X2_F, - transformedGeometry: *mut *mut ID2D1TransformedGeometry - ) -> ::HRESULT, - fn CreatePathGeometry( - &mut self, pathGeometry: *mut *mut ID2D1PathGeometry - ) -> ::HRESULT, - fn CreateStrokeStyle( - &mut self, strokeStyleProperties: *const D2D1_STROKE_STYLE_PROPERTIES, - dashes: *const ::FLOAT, dashesCount: ::UINT32, strokeStyle: *mut *mut ID2D1StrokeStyle - ) -> ::HRESULT, - fn CreateDrawingStateBlock( - &mut self, drawingStateDescription: *const D2D1_DRAWING_STATE_DESCRIPTION, - textRenderingParams: *mut ::IDWriteRenderingParams, - drawingStateBlock: *mut *mut ID2D1DrawingStateBlock - ) -> ::HRESULT, - fn CreateWicBitmapRenderTarget( - &mut self, target: *mut ::IWICBitmap, - renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES, - renderTarget: *mut *mut ID2D1RenderTarget - ) -> ::HRESULT, - fn CreateHwndRenderTarget( - &mut self, renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES, - hwndRenderTargetProperties: *const D2D1_HWND_RENDER_TARGET_PROPERTIES, - hwndRenderTarget: *mut *mut ID2D1HwndRenderTarget - ) -> ::HRESULT, - fn CreateDxgiSurfaceRenderTarget( - &mut self, dxgiSurface: *mut ::IDXGISurface, - renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES, - renderTarget: *mut *mut ID2D1RenderTarget - ) -> ::HRESULT, - fn CreateDCRenderTarget( - &mut self, renderTargetProperties: *const D2D1_RENDER_TARGET_PROPERTIES, - dcRenderTarget: *mut *mut ID2D1DCRenderTarget - ) -> ::HRESULT -}); -DEFINE_GUID!( - UuidOfID2D1Factory, - 0x06152247, 0x6f50, 0x465a, 0x92, 0x45, 0x11, 0x8b, 0xfd, 0x3b, 0x60, 0x07 -); diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/d2dbasetypes.rs cargo-0.37.0/vendor/winapi-0.2.8/src/d2dbasetypes.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/d2dbasetypes.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/d2dbasetypes.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -// Copyright © 2015, Connor Hilarides -// Licensed under the MIT License -//! Mappings for the contents of d2dbasetypes.h -STRUCT!{struct D2D_POINT_2U { - x: ::UINT32, - y: ::UINT32, -}} -STRUCT!{struct D2D_POINT_2F { - x: ::FLOAT, - y: ::FLOAT, -}} -pub type D2D_POINT_2L = ::POINT; -STRUCT!{struct D2D_VECTOR_2F { - x: ::FLOAT, - y: ::FLOAT, -}} -STRUCT!{struct D2D_VECTOR_3F { - x: ::FLOAT, - y: ::FLOAT, - z: ::FLOAT, -}} -STRUCT!{struct D2D_VECTOR_4F { - x: ::FLOAT, - y: ::FLOAT, - z: ::FLOAT, - w: ::FLOAT, -}} -STRUCT!{struct D2D_RECT_F { - left: ::FLOAT, - top: ::FLOAT, - right: ::FLOAT, - bottom: ::FLOAT, -}} -STRUCT!{struct D2D_RECT_U { - left: ::UINT32, - top: ::UINT32, - right: ::UINT32, - bottom: ::UINT32, -}} -pub type D2D_RECT_L = ::RECT; -STRUCT!{struct D2D_SIZE_F { - width: ::FLOAT, - height: ::FLOAT, -}} -STRUCT!{struct D2D_SIZE_U { - width: ::UINT32, - height: ::UINT32, -}} -pub type D2D_COLOR_F = ::D3DCOLORVALUE; -STRUCT!{struct D2D_MATRIX_3X2_F { - matrix: [[::FLOAT; 2]; 3], -}} -STRUCT!{struct D2D_MATRIX_4X3_F { - matrix: [[::FLOAT; 3]; 4], -}} -STRUCT!{struct D2D_MATRIX_4X4_F { - matrix: [[::FLOAT; 4]; 4], -}} -STRUCT!{struct D2D_MATRIX_5X4_F { - matrix: [[::FLOAT; 4]; 5], -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/d3d10shader.rs cargo-0.37.0/vendor/winapi-0.2.8/src/d3d10shader.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/d3d10shader.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/d3d10shader.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,110 +0,0 @@ -// Copyright © 2016, Peter Atashian -// Licensed under the MIT License -use super::*; -pub type D3D10_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE; -pub type D3D10_CBUFFER_TYPE = D3D_CBUFFER_TYPE; -STRUCT!{struct D3D10_SHADER_DESC { - Version: UINT, - Creator: LPCSTR, - Flags: UINT, - ConstantBuffers: UINT, - BoundResources: UINT, - InputParameters: UINT, - OutputParameters: UINT, - InstructionCount: UINT, - TempRegisterCount: UINT, - TempArrayCount: UINT, - DefCount: UINT, - DclCount: UINT, - TextureNormalInstructions: UINT, - TextureLoadInstructions: UINT, - TextureCompInstructions: UINT, - TextureBiasInstructions: UINT, - TextureGradientInstructions: UINT, - FloatInstructionCount: UINT, - IntInstructionCount: UINT, - UintInstructionCount: UINT, - StaticFlowControlCount: UINT, - DynamicFlowControlCount: UINT, - MacroInstructionCount: UINT, - ArrayInstructionCount: UINT, - CutInstructionCount: UINT, - EmitInstructionCount: UINT, - GSOutputTopology: D3D_PRIMITIVE_TOPOLOGY, - GSMaxOutputVertexCount: UINT, -}} -STRUCT!{struct D3D10_SHADER_BUFFER_DESC { - Name: LPCSTR, - Type: D3D10_CBUFFER_TYPE, - Variables: UINT, - Size: UINT, - uFlags: UINT, -}} -STRUCT!{struct D3D10_SHADER_VARIABLE_DESC { - Name: LPCSTR, - StartOffset: UINT, - Size: UINT, - uFlags: UINT, - DefaultValue: LPVOID, -}} -STRUCT!{struct D3D10_SHADER_TYPE_DESC { - Class: D3D_SHADER_VARIABLE_CLASS, - Type: D3D_SHADER_VARIABLE_TYPE, - Rows: UINT, - Columns: UINT, - Elements: UINT, - Members: UINT, - Offset: UINT, -}} -STRUCT!{struct D3D10_SHADER_INPUT_BIND_DESC { - Name: LPCSTR, - Type: D3D_SHADER_INPUT_TYPE, - BindPoint: UINT, - BindCount: UINT, - uFlags: UINT, - ReturnType: D3D_RESOURCE_RETURN_TYPE, - Dimension: D3D_SRV_DIMENSION, - NumSamples: UINT, -}} -STRUCT!{struct D3D10_SIGNATURE_PARAMETER_DESC { - SemanticName: LPCSTR, - SemanticIndex: UINT, - Register: UINT, - SystemValueType: D3D_NAME, - ComponentType: D3D_REGISTER_COMPONENT_TYPE, - Mask: BYTE, - ReadWriteMask: BYTE, -}} -RIDL!{interface ID3D10ShaderReflectionType(ID3D10ShaderReflectionTypeVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D10_SHADER_TYPE_DESC) -> HRESULT, - fn GetMemberTypeByIndex(&mut self, Index: UINT) -> *mut ID3D10ShaderReflectionType, - fn GetMemberTypeByName(&mut self, Name: LPCSTR) -> *mut ID3D10ShaderReflectionType, - fn GetMemberTypeName(&mut self, Index: UINT) -> LPCSTR -}} -RIDL!{interface ID3D10ShaderReflectionVariable(ID3D10ShaderReflectionVariableVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D10_SHADER_VARIABLE_DESC) -> HRESULT, - fn GetType(&mut self) -> *mut ID3D10ShaderReflectionType -}} -RIDL!{interface ID3D10ShaderReflectionConstantBuffer(ID3D10ShaderReflectionConstantBufferVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D10_SHADER_BUFFER_DESC) -> HRESULT, - fn GetVariableByIndex(&mut self, Index: UINT) -> *mut ID3D10ShaderReflectionVariable, - fn GetVariableByName(&mut self, Name: LPCSTR) -> *mut ID3D10ShaderReflectionVariable -}} -RIDL!{interface ID3D10ShaderReflection(ID3D10ShaderReflectionVtbl): IUnknown(IUnknownVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D10_SHADER_DESC) -> HRESULT, - fn GetConstantBufferByIndex( - &mut self, Index: UINT - ) -> *mut ID3D10ShaderReflectionConstantBuffer, - fn GetConstantBufferByName( - &mut self, Name: LPCSTR - ) -> *mut ID3D10ShaderReflectionConstantBuffer, - fn GetResourceBindingDesc( - &mut self, ResourceIndex: UINT, pDesc: *mut D3D10_SHADER_INPUT_BIND_DESC - ) -> HRESULT, - fn GetInputParameterDesc( - &mut self, ParameterIndex: UINT, pDesc: *mut D3D10_SIGNATURE_PARAMETER_DESC - ) -> HRESULT, - fn GetOutputParameterDesc( - &mut self, ParameterIndex: UINT, pDesc: *mut D3D10_SIGNATURE_PARAMETER_DESC - ) -> HRESULT -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/d3d11.rs cargo-0.37.0/vendor/winapi-0.2.8/src/d3d11.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/d3d11.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/d3d11.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,2665 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -use super::*; -pub const D3D11_16BIT_INDEX_STRIP_CUT_VALUE: DWORD = 0xffff; -pub const D3D11_32BIT_INDEX_STRIP_CUT_VALUE: DWORD = 0xffffffff; -pub const D3D11_8BIT_INDEX_STRIP_CUT_VALUE: DWORD = 0xff; -pub const D3D11_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT: DWORD = 9; -pub const D3D11_CLIP_OR_CULL_DISTANCE_COUNT: DWORD = 8; -pub const D3D11_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT: DWORD = 2; -pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT: DWORD = 14; -pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS: DWORD = 4; -pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT: DWORD = 15; -pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_PARTIAL_UPDATE_EXTENTS_BYTE_ALIGNMENT: DWORD = 16; -pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS: DWORD = 4; -pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT: DWORD = 15; -pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST: DWORD = 1; -pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT: DWORD = 64; -pub const D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS: DWORD = 4; -pub const D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT: DWORD = 1; -pub const D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST: DWORD = 1; -pub const D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS: DWORD = 1; -pub const D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT: DWORD = 128; -pub const D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST: DWORD = 1; -pub const D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT: DWORD = 128; -pub const D3D11_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS: DWORD = 1; -pub const D3D11_COMMONSHADER_SAMPLER_REGISTER_COUNT: DWORD = 16; -pub const D3D11_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST: DWORD = 1; -pub const D3D11_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT: DWORD = 16; -pub const D3D11_COMMONSHADER_SUBROUTINE_NESTING_LIMIT: DWORD = 32; -pub const D3D11_COMMONSHADER_TEMP_REGISTER_COMPONENTS: DWORD = 4; -pub const D3D11_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_COMMONSHADER_TEMP_REGISTER_COUNT: DWORD = 4096; -pub const D3D11_COMMONSHADER_TEMP_REGISTER_READS_PER_INST: DWORD = 3; -pub const D3D11_COMMONSHADER_TEMP_REGISTER_READ_PORTS: DWORD = 3; -pub const D3D11_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX: DWORD = 10; -pub const D3D11_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN: c_long = -10; -pub const D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE: c_long = -8; -pub const D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE: DWORD = 7; -pub const D3D11_CS_4_X_BUCKET00_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 256; -pub const D3D11_CS_4_X_BUCKET00_MAX_NUM_THREADS_PER_GROUP: DWORD = 64; -pub const D3D11_CS_4_X_BUCKET01_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 240; -pub const D3D11_CS_4_X_BUCKET01_MAX_NUM_THREADS_PER_GROUP: DWORD = 68; -pub const D3D11_CS_4_X_BUCKET02_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 224; -pub const D3D11_CS_4_X_BUCKET02_MAX_NUM_THREADS_PER_GROUP: DWORD = 72; -pub const D3D11_CS_4_X_BUCKET03_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 208; -pub const D3D11_CS_4_X_BUCKET03_MAX_NUM_THREADS_PER_GROUP: DWORD = 76; -pub const D3D11_CS_4_X_BUCKET04_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 192; -pub const D3D11_CS_4_X_BUCKET04_MAX_NUM_THREADS_PER_GROUP: DWORD = 84; -pub const D3D11_CS_4_X_BUCKET05_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 176; -pub const D3D11_CS_4_X_BUCKET05_MAX_NUM_THREADS_PER_GROUP: DWORD = 92; -pub const D3D11_CS_4_X_BUCKET06_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 160; -pub const D3D11_CS_4_X_BUCKET06_MAX_NUM_THREADS_PER_GROUP: DWORD = 100; -pub const D3D11_CS_4_X_BUCKET07_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 144; -pub const D3D11_CS_4_X_BUCKET07_MAX_NUM_THREADS_PER_GROUP: DWORD = 112; -pub const D3D11_CS_4_X_BUCKET08_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 128; -pub const D3D11_CS_4_X_BUCKET08_MAX_NUM_THREADS_PER_GROUP: DWORD = 128; -pub const D3D11_CS_4_X_BUCKET09_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 112; -pub const D3D11_CS_4_X_BUCKET09_MAX_NUM_THREADS_PER_GROUP: DWORD = 144; -pub const D3D11_CS_4_X_BUCKET10_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 96; -pub const D3D11_CS_4_X_BUCKET10_MAX_NUM_THREADS_PER_GROUP: DWORD = 168; -pub const D3D11_CS_4_X_BUCKET11_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 80; -pub const D3D11_CS_4_X_BUCKET11_MAX_NUM_THREADS_PER_GROUP: DWORD = 204; -pub const D3D11_CS_4_X_BUCKET12_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 64; -pub const D3D11_CS_4_X_BUCKET12_MAX_NUM_THREADS_PER_GROUP: DWORD = 256; -pub const D3D11_CS_4_X_BUCKET13_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 48; -pub const D3D11_CS_4_X_BUCKET13_MAX_NUM_THREADS_PER_GROUP: DWORD = 340; -pub const D3D11_CS_4_X_BUCKET14_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 32; -pub const D3D11_CS_4_X_BUCKET14_MAX_NUM_THREADS_PER_GROUP: DWORD = 512; -pub const D3D11_CS_4_X_BUCKET15_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: DWORD = 16; -pub const D3D11_CS_4_X_BUCKET15_MAX_NUM_THREADS_PER_GROUP: DWORD = 768; -pub const D3D11_CS_4_X_DISPATCH_MAX_THREAD_GROUPS_IN_Z_DIMENSION: DWORD = 1; -pub const D3D11_CS_4_X_RAW_UAV_BYTE_ALIGNMENT: DWORD = 256; -pub const D3D11_CS_4_X_THREAD_GROUP_MAX_THREADS_PER_GROUP: DWORD = 768; -pub const D3D11_CS_4_X_THREAD_GROUP_MAX_X: DWORD = 768; -pub const D3D11_CS_4_X_THREAD_GROUP_MAX_Y: DWORD = 768; -pub const D3D11_CS_4_X_UAV_REGISTER_COUNT: DWORD = 1; -pub const D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION: DWORD = 65535; -pub const D3D11_CS_TGSM_REGISTER_COUNT: DWORD = 8192; -pub const D3D11_CS_TGSM_REGISTER_READS_PER_INST: DWORD = 1; -pub const D3D11_CS_TGSM_RESOURCE_REGISTER_COMPONENTS: DWORD = 1; -pub const D3D11_CS_TGSM_RESOURCE_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_CS_THREADGROUPID_REGISTER_COMPONENTS: DWORD = 3; -pub const D3D11_CS_THREADGROUPID_REGISTER_COUNT: DWORD = 1; -pub const D3D11_CS_THREADIDINGROUPFLATTENED_REGISTER_COMPONENTS: DWORD = 1; -pub const D3D11_CS_THREADIDINGROUPFLATTENED_REGISTER_COUNT: DWORD = 1; -pub const D3D11_CS_THREADIDINGROUP_REGISTER_COMPONENTS: DWORD = 3; -pub const D3D11_CS_THREADIDINGROUP_REGISTER_COUNT: DWORD = 1; -pub const D3D11_CS_THREADID_REGISTER_COMPONENTS: DWORD = 3; -pub const D3D11_CS_THREADID_REGISTER_COUNT: DWORD = 1; -pub const D3D11_CS_THREAD_GROUP_MAX_THREADS_PER_GROUP: DWORD = 1024; -pub const D3D11_CS_THREAD_GROUP_MAX_X: DWORD = 1024; -pub const D3D11_CS_THREAD_GROUP_MAX_Y: DWORD = 1024; -pub const D3D11_CS_THREAD_GROUP_MAX_Z: DWORD = 64; -pub const D3D11_CS_THREAD_GROUP_MIN_X: DWORD = 1; -pub const D3D11_CS_THREAD_GROUP_MIN_Y: DWORD = 1; -pub const D3D11_CS_THREAD_GROUP_MIN_Z: DWORD = 1; -pub const D3D11_CS_THREAD_LOCAL_TEMP_REGISTER_POOL: DWORD = 16384; -pub const D3D11_DEFAULT_BLEND_FACTOR_ALPHA: FLOAT = 1.0; -pub const D3D11_DEFAULT_BLEND_FACTOR_BLUE: FLOAT = 1.0; -pub const D3D11_DEFAULT_BLEND_FACTOR_GREEN: FLOAT = 1.0; -pub const D3D11_DEFAULT_BLEND_FACTOR_RED: FLOAT = 1.0; -pub const D3D11_DEFAULT_BORDER_COLOR_COMPONENT: FLOAT = 0.0; -pub const D3D11_DEFAULT_DEPTH_BIAS: DWORD = 0; -pub const D3D11_DEFAULT_DEPTH_BIAS_CLAMP: FLOAT = 0.0; -pub const D3D11_DEFAULT_MAX_ANISOTROPY: DWORD = 16; -pub const D3D11_DEFAULT_MIP_LOD_BIAS: FLOAT = 0.0; -pub const D3D11_DEFAULT_RENDER_TARGET_ARRAY_INDEX: DWORD = 0; -pub const D3D11_DEFAULT_SAMPLE_MASK: DWORD = 0xffffffff; -pub const D3D11_DEFAULT_SCISSOR_ENDX: DWORD = 0; -pub const D3D11_DEFAULT_SCISSOR_ENDY: DWORD = 0; -pub const D3D11_DEFAULT_SCISSOR_STARTX: DWORD = 0; -pub const D3D11_DEFAULT_SCISSOR_STARTY: DWORD = 0; -pub const D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS: FLOAT = 0.0; -pub const D3D11_DEFAULT_STENCIL_READ_MASK: DWORD = 0xff; -pub const D3D11_DEFAULT_STENCIL_REFERENCE: DWORD = 0; -pub const D3D11_DEFAULT_STENCIL_WRITE_MASK: DWORD = 0xff; -pub const D3D11_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX: DWORD = 0; -pub const D3D11_DEFAULT_VIEWPORT_HEIGHT: DWORD = 0; -pub const D3D11_DEFAULT_VIEWPORT_MAX_DEPTH: FLOAT = 0.0; -pub const D3D11_DEFAULT_VIEWPORT_MIN_DEPTH: FLOAT = 0.0; -pub const D3D11_DEFAULT_VIEWPORT_TOPLEFTX: DWORD = 0; -pub const D3D11_DEFAULT_VIEWPORT_TOPLEFTY: DWORD = 0; -pub const D3D11_DEFAULT_VIEWPORT_WIDTH: DWORD = 0; -pub const D3D11_DS_INPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS: DWORD = 3968; -pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENTS: DWORD = 4; -pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COUNT: DWORD = 32; -pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_READS_PER_INST: DWORD = 2; -pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENTS: DWORD = 3; -pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COUNT: DWORD = 1; -pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_READS_PER_INST: DWORD = 2; -pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENTS: DWORD = 4; -pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COUNT: DWORD = 32; -pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST: DWORD = 2; -pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS: DWORD = 1; -pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_COUNT: DWORD = 1; -pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST: DWORD = 2; -pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_DS_OUTPUT_REGISTER_COMPONENTS: DWORD = 4; -pub const D3D11_DS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_DS_OUTPUT_REGISTER_COUNT: DWORD = 32; -pub const D3D11_FLOAT16_FUSED_TOLERANCE_IN_ULP: FLOAT = 0.6; -pub const D3D11_FLOAT32_MAX: FLOAT = 3.402823466E+38; -pub const D3D11_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP: FLOAT = 0.6; -pub const D3D11_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR: FLOAT = 2.4; -pub const D3D11_FLOAT_TO_SRGB_EXPONENT_NUMERATOR: FLOAT = 1.0; -pub const D3D11_FLOAT_TO_SRGB_OFFSET: FLOAT = 0.055; -pub const D3D11_FLOAT_TO_SRGB_SCALE_1: FLOAT = 12.92; -pub const D3D11_FLOAT_TO_SRGB_SCALE_2: FLOAT = 1.055; -pub const D3D11_FLOAT_TO_SRGB_THRESHOLD: FLOAT = 0.0031308; -pub const D3D11_FTOI_INSTRUCTION_MAX_INPUT: FLOAT = 2147483647.999; -pub const D3D11_FTOI_INSTRUCTION_MIN_INPUT: FLOAT = -2147483648.999; -pub const D3D11_FTOU_INSTRUCTION_MAX_INPUT: FLOAT = 4294967295.999; -pub const D3D11_FTOU_INSTRUCTION_MIN_INPUT: FLOAT = 0.0; -pub const D3D11_GS_INPUT_INSTANCE_ID_READS_PER_INST: DWORD = 2; -pub const D3D11_GS_INPUT_INSTANCE_ID_READ_PORTS: DWORD = 1; -pub const D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENTS: DWORD = 1; -pub const D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COUNT: DWORD = 1; -pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS: DWORD = 1; -pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_COUNT: DWORD = 1; -pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST: DWORD = 2; -pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_GS_INPUT_REGISTER_COMPONENTS: DWORD = 4; -pub const D3D11_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_GS_INPUT_REGISTER_COUNT: DWORD = 32; -pub const D3D11_GS_INPUT_REGISTER_READS_PER_INST: DWORD = 2; -pub const D3D11_GS_INPUT_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_GS_INPUT_REGISTER_VERTICES: DWORD = 32; -pub const D3D11_GS_MAX_INSTANCE_COUNT: DWORD = 32; -pub const D3D11_GS_MAX_OUTPUT_VERTEX_COUNT_ACROSS_INSTANCES: DWORD = 1024; -pub const D3D11_GS_OUTPUT_ELEMENTS: DWORD = 32; -pub const D3D11_GS_OUTPUT_REGISTER_COMPONENTS: DWORD = 4; -pub const D3D11_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_GS_OUTPUT_REGISTER_COUNT: DWORD = 32; -pub const D3D11_HS_CONTROL_POINT_PHASE_INPUT_REGISTER_COUNT: DWORD = 32; -pub const D3D11_HS_CONTROL_POINT_PHASE_OUTPUT_REGISTER_COUNT: DWORD = 32; -pub const D3D11_HS_CONTROL_POINT_REGISTER_COMPONENTS: DWORD = 4; -pub const D3D11_HS_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_HS_CONTROL_POINT_REGISTER_READS_PER_INST: DWORD = 2; -pub const D3D11_HS_CONTROL_POINT_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_HS_FORK_PHASE_INSTANCE_COUNT_UPPER_BOUND: DWORD = 0xffffffff; -pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENTS: DWORD = 1; -pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COUNT: DWORD = 1; -pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READS_PER_INST: DWORD = 2; -pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENTS: DWORD = 1; -pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COUNT: DWORD = 1; -pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READS_PER_INST: DWORD = 2; -pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS: DWORD = 1; -pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COUNT: DWORD = 1; -pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST: DWORD = 2; -pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_HS_JOIN_PHASE_INSTANCE_COUNT_UPPER_BOUND: DWORD = 0xffffffff; -pub const D3D11_HS_MAXTESSFACTOR_LOWER_BOUND: FLOAT = 1.0; -pub const D3D11_HS_MAXTESSFACTOR_UPPER_BOUND: FLOAT = 64.0; -pub const D3D11_HS_OUTPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS: DWORD = 3968; -pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENTS: DWORD = 1; -pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COUNT: DWORD = 1; -pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READS_PER_INST: DWORD = 2; -pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENTS: DWORD = 4; -pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COUNT: DWORD = 32; -pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST: DWORD = 2; -pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_SCALAR_COMPONENTS: DWORD = 128; -pub const D3D11_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES: DWORD = 0; -pub const D3D11_IA_DEFAULT_PRIMITIVE_TOPOLOGY: DWORD = 0; -pub const D3D11_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES: DWORD = 0; -pub const D3D11_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT: DWORD = 1; -pub const D3D11_IA_INSTANCE_ID_BIT_COUNT: DWORD = 32; -pub const D3D11_IA_INTEGER_ARITHMETIC_BIT_COUNT: DWORD = 32; -pub const D3D11_IA_PATCH_MAX_CONTROL_POINT_COUNT: DWORD = 32; -pub const D3D11_IA_PRIMITIVE_ID_BIT_COUNT: DWORD = 32; -pub const D3D11_IA_VERTEX_ID_BIT_COUNT: DWORD = 32; -pub const D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT: DWORD = 32; -pub const D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS: DWORD = 128; -pub const D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT: DWORD = 32; -pub const D3D11_INTEGER_DIVIDE_BY_ZERO_QUOTIENT: DWORD = 0xffffffff; -pub const D3D11_INTEGER_DIVIDE_BY_ZERO_REMAINDER: DWORD = 0xffffffff; -pub const D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL: DWORD = 0xffffffff; -pub const D3D11_KEEP_UNORDERED_ACCESS_VIEWS: DWORD = 0xffffffff; -pub const D3D11_LINEAR_GAMMA: FLOAT = 1.0; -pub const D3D11_MAJOR_VERSION: DWORD = 11; -pub const D3D11_MAX_BORDER_COLOR_COMPONENT: FLOAT = 1.0; -pub const D3D11_MAX_DEPTH: FLOAT = 1.0; -pub const D3D11_MAX_MAXANISOTROPY: DWORD = 16; -pub const D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT: DWORD = 32; -pub const D3D11_MAX_POSITION_VALUE: FLOAT = 3.402823466E+34; -pub const D3D11_MAX_TEXTURE_DIMENSION_2_TO_EXP: DWORD = 17; -pub const D3D11_MINOR_VERSION: DWORD = 0; -pub const D3D11_MIN_BORDER_COLOR_COMPONENT: FLOAT = 0.0; -pub const D3D11_MIN_DEPTH: FLOAT = 0.0; -pub const D3D11_MIN_MAXANISOTROPY: DWORD = 0; -pub const D3D11_MIP_LOD_BIAS_MAX: FLOAT = 15.99; -pub const D3D11_MIP_LOD_BIAS_MIN: FLOAT = -16.0; -pub const D3D11_MIP_LOD_FRACTIONAL_BIT_COUNT: DWORD = 8; -pub const D3D11_MIP_LOD_RANGE_BIT_COUNT: DWORD = 8; -pub const D3D11_MULTISAMPLE_ANTIALIAS_LINE_WIDTH: FLOAT = 1.4; -pub const D3D11_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT: DWORD = 0; -pub const D3D11_PIXEL_ADDRESS_RANGE_BIT_COUNT: DWORD = 15; -pub const D3D11_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT: DWORD = 16; -pub const D3D11_PS_CS_UAV_REGISTER_COMPONENTS: DWORD = 1; -pub const D3D11_PS_CS_UAV_REGISTER_COUNT: DWORD = 8; -pub const D3D11_PS_CS_UAV_REGISTER_READS_PER_INST: DWORD = 1; -pub const D3D11_PS_CS_UAV_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_PS_FRONTFACING_DEFAULT_VALUE: DWORD = 0xffffffff; -pub const D3D11_PS_FRONTFACING_FALSE_VALUE: DWORD = 0; -pub const D3D11_PS_FRONTFACING_TRUE_VALUE: DWORD = 0xffffffff; -pub const D3D11_PS_INPUT_REGISTER_COMPONENTS: DWORD = 4; -pub const D3D11_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_PS_INPUT_REGISTER_COUNT: DWORD = 32; -pub const D3D11_PS_INPUT_REGISTER_READS_PER_INST: DWORD = 2; -pub const D3D11_PS_INPUT_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT: FLOAT = 0.0; -pub const D3D11_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS: DWORD = 1; -pub const D3D11_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_PS_OUTPUT_DEPTH_REGISTER_COUNT: DWORD = 1; -pub const D3D11_PS_OUTPUT_MASK_REGISTER_COMPONENTS: DWORD = 1; -pub const D3D11_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_PS_OUTPUT_MASK_REGISTER_COUNT: DWORD = 1; -pub const D3D11_PS_OUTPUT_REGISTER_COMPONENTS: DWORD = 4; -pub const D3D11_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_PS_OUTPUT_REGISTER_COUNT: DWORD = 8; -pub const D3D11_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT: FLOAT = 0.5; -pub const D3D11_RAW_UAV_SRV_BYTE_ALIGNMENT: DWORD = 16; -pub const D3D11_REQ_BLEND_OBJECT_COUNT_PER_DEVICE: DWORD = 4096; -pub const D3D11_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP: DWORD = 27; -pub const D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT: DWORD = 4096; -pub const D3D11_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_DEVICE: DWORD = 4096; -pub const D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP: DWORD = 32; -pub const D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP: DWORD = 32; -pub const D3D11_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION: DWORD = 16384; -pub const D3D11_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT: DWORD = 1024; -pub const D3D11_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT: DWORD = 4096; -pub const D3D11_REQ_MAXANISOTROPY: DWORD = 16; -pub const D3D11_REQ_MIP_LEVELS: DWORD = 15; -pub const D3D11_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES: DWORD = 2048; -pub const D3D11_REQ_RASTERIZER_OBJECT_COUNT_PER_DEVICE: DWORD = 4096; -pub const D3D11_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH: DWORD = 16384; -pub const D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_A_TERM: DWORD = 128; -pub const D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_B_TERM: FLOAT = 0.25; -pub const D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_C_TERM: DWORD = 2048; -pub const D3D11_REQ_RESOURCE_VIEW_COUNT_PER_DEVICE_2_TO_EXP: DWORD = 20; -pub const D3D11_REQ_SAMPLER_OBJECT_COUNT_PER_DEVICE: DWORD = 4096; -pub const D3D11_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION: DWORD = 2048; -pub const D3D11_REQ_TEXTURE1D_U_DIMENSION: DWORD = 16384; -pub const D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION: DWORD = 2048; -pub const D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION: DWORD = 16384; -pub const D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION: DWORD = 2048; -pub const D3D11_REQ_TEXTURECUBE_DIMENSION: DWORD = 16384; -pub const D3D11_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL: DWORD = 0; -pub const D3D11_SHADER_MAJOR_VERSION: DWORD = 5; -pub const D3D11_SHADER_MAX_INSTANCES: DWORD = 65535; -pub const D3D11_SHADER_MAX_INTERFACES: DWORD = 253; -pub const D3D11_SHADER_MAX_INTERFACE_CALL_SITES: DWORD = 4096; -pub const D3D11_SHADER_MAX_TYPES: DWORD = 65535; -pub const D3D11_SHADER_MINOR_VERSION: DWORD = 0; -pub const D3D11_SHIFT_INSTRUCTION_PAD_VALUE: DWORD = 0; -pub const D3D11_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT: DWORD = 5; -pub const D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT: DWORD = 8; -pub const D3D11_SO_BUFFER_MAX_STRIDE_IN_BYTES: DWORD = 2048; -pub const D3D11_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES: DWORD = 512; -pub const D3D11_SO_BUFFER_SLOT_COUNT: DWORD = 4; -pub const D3D11_SO_DDI_REGISTER_INDEX_DENOTING_GAP: DWORD = 0xffffffff; -pub const D3D11_SO_NO_RASTERIZED_STREAM: DWORD = 0xffffffff; -pub const D3D11_SO_OUTPUT_COMPONENT_COUNT: DWORD = 128; -pub const D3D11_SO_STREAM_COUNT: DWORD = 4; -pub const D3D11_SPEC_DATE_DAY: DWORD = 16; -pub const D3D11_SPEC_DATE_MONTH: DWORD = 05; -pub const D3D11_SPEC_DATE_YEAR: DWORD = 2011; -pub const D3D11_SPEC_VERSION: FLOAT = 1.07; -pub const D3D11_SRGB_GAMMA: FLOAT = 2.2; -pub const D3D11_SRGB_TO_FLOAT_DENOMINATOR_1: FLOAT = 12.92; -pub const D3D11_SRGB_TO_FLOAT_DENOMINATOR_2: FLOAT = 1.055; -pub const D3D11_SRGB_TO_FLOAT_EXPONENT: FLOAT = 2.4; -pub const D3D11_SRGB_TO_FLOAT_OFFSET: FLOAT = 0.055; -pub const D3D11_SRGB_TO_FLOAT_THRESHOLD: FLOAT = 0.04045; -pub const D3D11_SRGB_TO_FLOAT_TOLERANCE_IN_ULP: FLOAT = 0.5; -pub const D3D11_STANDARD_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_STANDARD_COMPONENT_BIT_COUNT_DOUBLED: DWORD = 64; -pub const D3D11_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE: DWORD = 4; -pub const D3D11_STANDARD_PIXEL_COMPONENT_COUNT: DWORD = 128; -pub const D3D11_STANDARD_PIXEL_ELEMENT_COUNT: DWORD = 32; -pub const D3D11_STANDARD_VECTOR_SIZE: DWORD = 4; -pub const D3D11_STANDARD_VERTEX_ELEMENT_COUNT: DWORD = 32; -pub const D3D11_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT: DWORD = 64; -pub const D3D11_SUBPIXEL_FRACTIONAL_BIT_COUNT: DWORD = 8; -pub const D3D11_SUBTEXEL_FRACTIONAL_BIT_COUNT: DWORD = 8; -pub const D3D11_TESSELLATOR_MAX_EVEN_TESSELLATION_FACTOR: DWORD = 64; -pub const D3D11_TESSELLATOR_MAX_ISOLINE_DENSITY_TESSELLATION_FACTOR: DWORD = 64; -pub const D3D11_TESSELLATOR_MAX_ODD_TESSELLATION_FACTOR: DWORD = 63; -pub const D3D11_TESSELLATOR_MAX_TESSELLATION_FACTOR: DWORD = 64; -pub const D3D11_TESSELLATOR_MIN_EVEN_TESSELLATION_FACTOR: DWORD = 2; -pub const D3D11_TESSELLATOR_MIN_ISOLINE_DENSITY_TESSELLATION_FACTOR: DWORD = 1; -pub const D3D11_TESSELLATOR_MIN_ODD_TESSELLATION_FACTOR: DWORD = 1; -pub const D3D11_TEXEL_ADDRESS_RANGE_BIT_COUNT: DWORD = 16; -pub const D3D11_UNBOUND_MEMORY_ACCESS_RESULT: DWORD = 0; -pub const D3D11_VIEWPORT_AND_SCISSORRECT_MAX_INDEX: DWORD = 15; -pub const D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE: DWORD = 16; -pub const D3D11_VIEWPORT_BOUNDS_MAX: DWORD = 32767; -pub const D3D11_VIEWPORT_BOUNDS_MIN: c_long = -32768; -pub const D3D11_VS_INPUT_REGISTER_COMPONENTS: DWORD = 4; -pub const D3D11_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_VS_INPUT_REGISTER_COUNT: DWORD = 32; -pub const D3D11_VS_INPUT_REGISTER_READS_PER_INST: DWORD = 2; -pub const D3D11_VS_INPUT_REGISTER_READ_PORTS: DWORD = 1; -pub const D3D11_VS_OUTPUT_REGISTER_COMPONENTS: DWORD = 4; -pub const D3D11_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32; -pub const D3D11_VS_OUTPUT_REGISTER_COUNT: DWORD = 32; -pub const D3D11_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT: DWORD = 10; -pub const D3D11_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP: DWORD = 25; -pub const D3D11_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP: DWORD = 25; -pub const D3D11_1_UAV_SLOT_COUNT: DWORD = 64; -pub const D3D11_2_TILED_RESOURCE_TILE_SIZE_IN_BYTES: DWORD = 65536; -ENUM!{enum D3D11_INPUT_CLASSIFICATION { - D3D11_INPUT_PER_VERTEX_DATA = 0, - D3D11_INPUT_PER_INSTANCE_DATA = 1, -}} -pub const D3D11_APPEND_ALIGNED_ELEMENT: DWORD = 0xffffffff; -STRUCT!{struct D3D11_INPUT_ELEMENT_DESC { - SemanticName: LPCSTR, - SemanticIndex: UINT, - Format: DXGI_FORMAT, - InputSlot: UINT, - AlignedByteOffset: UINT, - InputSlotClass: D3D11_INPUT_CLASSIFICATION, - InstanceDataStepRate: UINT, -}} -ENUM!{enum D3D11_FILL_MODE { - D3D11_FILL_WIREFRAME = 2, - D3D11_FILL_SOLID = 3, -}} -pub type D3D11_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY; -pub type D3D11_PRIMITIVE = D3D_PRIMITIVE; -ENUM!{enum D3D11_CULL_MODE { - D3D11_CULL_NONE = 1, - D3D11_CULL_FRONT = 2, - D3D11_CULL_BACK = 3, -}} -STRUCT!{struct D3D11_SO_DECLARATION_ENTRY { - Stream: UINT, - SemanticName: LPCSTR, - SemanticIndex: UINT, - StartComponent: BYTE, - ComponentCount: BYTE, - OutputSlot: BYTE, -}} -STRUCT!{struct D3D11_VIEWPORT { - TopLeftX: FLOAT, - TopLeftY: FLOAT, - Width: FLOAT, - Height: FLOAT, - MinDepth: FLOAT, - MaxDepth: FLOAT, -}} -STRUCT!{struct D3D11_DRAW_INSTANCED_INDIRECT_ARGS { - VertexCountPerInstance: UINT, - InstanceCount: UINT, - StartVertexLocation: UINT, - StartInstanceLocation: UINT, -}} -STRUCT!{struct D3D11_DRAW_INDEXED_INSTANCED_INDIRECT_ARGS { - IndexCountPerInstance: UINT, - InstanceCount: UINT, - StartIndexLocation: UINT, - BaseVertexLocation: INT, - StartInstanceLocation: UINT, -}} -ENUM!{enum D3D11_RESOURCE_DIMENSION { - D3D11_RESOURCE_DIMENSION_UNKNOWN = 0, - D3D11_RESOURCE_DIMENSION_BUFFER = 1, - D3D11_RESOURCE_DIMENSION_TEXTURE1D = 2, - D3D11_RESOURCE_DIMENSION_TEXTURE2D = 3, - D3D11_RESOURCE_DIMENSION_TEXTURE3D = 4, -}} -pub type D3D11_SRV_DIMENSION = D3D_SRV_DIMENSION; -ENUM!{enum D3D11_DSV_DIMENSION { - D3D11_DSV_DIMENSION_UNKNOWN = 0, - D3D11_DSV_DIMENSION_TEXTURE1D = 1, - D3D11_DSV_DIMENSION_TEXTURE1DARRAY = 2, - D3D11_DSV_DIMENSION_TEXTURE2D = 3, - D3D11_DSV_DIMENSION_TEXTURE2DARRAY = 4, - D3D11_DSV_DIMENSION_TEXTURE2DMS = 5, - D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY = 6, -}} -ENUM!{enum D3D11_RTV_DIMENSION { - D3D11_RTV_DIMENSION_UNKNOWN = 0, - D3D11_RTV_DIMENSION_BUFFER = 1, - D3D11_RTV_DIMENSION_TEXTURE1D = 2, - D3D11_RTV_DIMENSION_TEXTURE1DARRAY = 3, - D3D11_RTV_DIMENSION_TEXTURE2D = 4, - D3D11_RTV_DIMENSION_TEXTURE2DARRAY = 5, - D3D11_RTV_DIMENSION_TEXTURE2DMS = 6, - D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY = 7, - D3D11_RTV_DIMENSION_TEXTURE3D = 8, -}} -ENUM!{enum D3D11_UAV_DIMENSION { - D3D11_UAV_DIMENSION_UNKNOWN = 0, - D3D11_UAV_DIMENSION_BUFFER = 1, - D3D11_UAV_DIMENSION_TEXTURE1D = 2, - D3D11_UAV_DIMENSION_TEXTURE1DARRAY = 3, - D3D11_UAV_DIMENSION_TEXTURE2D = 4, - D3D11_UAV_DIMENSION_TEXTURE2DARRAY = 5, - D3D11_UAV_DIMENSION_TEXTURE3D = 8, -}} -ENUM!{enum D3D11_USAGE { - D3D11_USAGE_DEFAULT = 0, - D3D11_USAGE_IMMUTABLE = 1, - D3D11_USAGE_DYNAMIC = 2, - D3D11_USAGE_STAGING = 3, -}} -FLAGS!{enum D3D11_BIND_FLAG { - D3D11_BIND_VERTEX_BUFFER = 0x1, - D3D11_BIND_INDEX_BUFFER = 0x2, - D3D11_BIND_CONSTANT_BUFFER = 0x4, - D3D11_BIND_SHADER_RESOURCE = 0x8, - D3D11_BIND_STREAM_OUTPUT = 0x10, - D3D11_BIND_RENDER_TARGET = 0x20, - D3D11_BIND_DEPTH_STENCIL = 0x40, - D3D11_BIND_UNORDERED_ACCESS = 0x80, - D3D11_BIND_DECODER = 0x200, - D3D11_BIND_VIDEO_ENCODER = 0x400, -}} -FLAGS!{enum D3D11_CPU_ACCESS_FLAG { - D3D11_CPU_ACCESS_WRITE = 0x10000, - D3D11_CPU_ACCESS_READ = 0x20000, -}} -FLAGS!{enum D3D11_RESOURCE_MISC_FLAG { - D3D11_RESOURCE_MISC_GENERATE_MIPS = 0x1, - D3D11_RESOURCE_MISC_SHARED = 0x2, - D3D11_RESOURCE_MISC_TEXTURECUBE = 0x4, - D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS = 0x10, - D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS = 0x20, - D3D11_RESOURCE_MISC_BUFFER_STRUCTURED = 0x40, - D3D11_RESOURCE_MISC_RESOURCE_CLAMP = 0x80, - D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX = 0x100, - D3D11_RESOURCE_MISC_GDI_COMPATIBLE = 0x200, - D3D11_RESOURCE_MISC_SHARED_NTHANDLE = 0x800, - D3D11_RESOURCE_MISC_RESTRICTED_CONTENT = 0x1000, - D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE = 0x2000, - D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE_DRIVER = 0x4000, - D3D11_RESOURCE_MISC_GUARDED = 0x8000, - D3D11_RESOURCE_MISC_TILE_POOL = 0x20000, - D3D11_RESOURCE_MISC_TILED = 0x40000, - D3D11_RESOURCE_MISC_HW_PROTECTED = 0x80000, -}} -ENUM!{enum D3D11_MAP { - D3D11_MAP_READ = 1, - D3D11_MAP_WRITE = 2, - D3D11_MAP_READ_WRITE = 3, - D3D11_MAP_WRITE_DISCARD = 4, - D3D11_MAP_WRITE_NO_OVERWRITE = 5, -}} -FLAGS!{enum D3D11_MAP_FLAG { - D3D11_MAP_FLAG_DO_NOT_WAIT = 0x100000, -}} -FLAGS!{enum D3D11_RAISE_FLAG { - D3D11_RAISE_FLAG_DRIVER_INTERNAL_ERROR = 0x1, -}} -FLAGS!{enum D3D11_CLEAR_FLAG { - D3D11_CLEAR_DEPTH = 0x1, - D3D11_CLEAR_STENCIL = 0x2, -}} -pub type D3D11_RECT = RECT; -STRUCT!{struct D3D11_BOX { - left: UINT, - top: UINT, - front: UINT, - right: UINT, - bottom: UINT, - back: UINT, -}} -RIDL!{interface ID3D11DeviceChild(ID3D11DeviceChildVtbl): IUnknown(IUnknownVtbl) { - fn GetDevice(&mut self, ppDevice: *mut *mut ID3D11Device) -> (), - fn GetPrivateData( - &mut self, guid: REFGUID, pDataSize: *mut UINT, pData: *mut c_void - ) -> HRESULT, - fn SetPrivateData( - &mut self, guid: REFGUID, DataSize: UINT, pData: *const c_void - ) -> HRESULT, - fn SetPrivateDataInterface(&mut self, guid: REFGUID, pData: *const IUnknown) -> HRESULT -}} -ENUM!{enum D3D11_COMPARISON_FUNC { - D3D11_COMPARISON_NEVER = 1, - D3D11_COMPARISON_LESS = 2, - D3D11_COMPARISON_EQUAL = 3, - D3D11_COMPARISON_LESS_EQUAL = 4, - D3D11_COMPARISON_GREATER = 5, - D3D11_COMPARISON_NOT_EQUAL = 6, - D3D11_COMPARISON_GREATER_EQUAL = 7, - D3D11_COMPARISON_ALWAYS = 8, -}} -ENUM!{enum D3D11_DEPTH_WRITE_MASK { - D3D11_DEPTH_WRITE_MASK_ZERO = 0, - D3D11_DEPTH_WRITE_MASK_ALL = 1, -}} -ENUM!{enum D3D11_STENCIL_OP { - D3D11_STENCIL_OP_KEEP = 1, - D3D11_STENCIL_OP_ZERO = 2, - D3D11_STENCIL_OP_REPLACE = 3, - D3D11_STENCIL_OP_INCR_SAT = 4, - D3D11_STENCIL_OP_DECR_SAT = 5, - D3D11_STENCIL_OP_INVERT = 6, - D3D11_STENCIL_OP_INCR = 7, - D3D11_STENCIL_OP_DECR = 8, -}} -STRUCT!{struct D3D11_DEPTH_STENCILOP_DESC { - StencilFailOp: D3D11_STENCIL_OP, - StencilDepthFailOp: D3D11_STENCIL_OP, - StencilPassOp: D3D11_STENCIL_OP, - StencilFunc: D3D11_COMPARISON_FUNC, -}} -STRUCT!{struct D3D11_DEPTH_STENCIL_DESC { - DepthEnable: BOOL, - DepthWriteMask: D3D11_DEPTH_WRITE_MASK, - DepthFunc: D3D11_COMPARISON_FUNC, - StencilEnable: BOOL, - StencilReadMask: UINT8, - StencilWriteMask: UINT8, - FrontFace: D3D11_DEPTH_STENCILOP_DESC, - BackFace: D3D11_DEPTH_STENCILOP_DESC, -}} -RIDL!{interface ID3D11DepthStencilState(ID3D11DepthStencilStateVtbl) - : ID3D11DeviceChild(ID3D11DeviceChildVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_DEPTH_STENCIL_DESC) -> () -}} -ENUM!{enum D3D11_BLEND { - D3D11_BLEND_ZERO = 1, - D3D11_BLEND_ONE = 2, - D3D11_BLEND_SRC_COLOR = 3, - D3D11_BLEND_INV_SRC_COLOR = 4, - D3D11_BLEND_SRC_ALPHA = 5, - D3D11_BLEND_INV_SRC_ALPHA = 6, - D3D11_BLEND_DEST_ALPHA = 7, - D3D11_BLEND_INV_DEST_ALPHA = 8, - D3D11_BLEND_DEST_COLOR = 9, - D3D11_BLEND_INV_DEST_COLOR = 10, - D3D11_BLEND_SRC_ALPHA_SAT = 11, - D3D11_BLEND_BLEND_FACTOR = 14, - D3D11_BLEND_INV_BLEND_FACTOR = 15, - D3D11_BLEND_SRC1_COLOR = 16, - D3D11_BLEND_INV_SRC1_COLOR = 17, - D3D11_BLEND_SRC1_ALPHA = 18, - D3D11_BLEND_INV_SRC1_ALPHA = 19, -}} -ENUM!{enum D3D11_BLEND_OP { - D3D11_BLEND_OP_ADD = 1, - D3D11_BLEND_OP_SUBTRACT = 2, - D3D11_BLEND_OP_REV_SUBTRACT = 3, - D3D11_BLEND_OP_MIN = 4, - D3D11_BLEND_OP_MAX = 5, -}} -FLAGS!{enum D3D11_COLOR_WRITE_ENABLE { - D3D11_COLOR_WRITE_ENABLE_RED = 1, - D3D11_COLOR_WRITE_ENABLE_GREEN = 2, - D3D11_COLOR_WRITE_ENABLE_BLUE = 4, - D3D11_COLOR_WRITE_ENABLE_ALPHA = 8, - D3D11_COLOR_WRITE_ENABLE_ALL = D3D11_COLOR_WRITE_ENABLE_RED.0 | D3D11_COLOR_WRITE_ENABLE_GREEN.0 | - D3D11_COLOR_WRITE_ENABLE_BLUE.0 | D3D11_COLOR_WRITE_ENABLE_ALPHA.0, -}} -STRUCT!{struct D3D11_RENDER_TARGET_BLEND_DESC { - BlendEnable: BOOL, - SrcBlend: D3D11_BLEND, - DestBlend: D3D11_BLEND, - BlendOp: D3D11_BLEND_OP, - SrcBlendAlpha: D3D11_BLEND, - DestBlendAlpha: D3D11_BLEND, - BlendOpAlpha: D3D11_BLEND_OP, - RenderTargetWriteMask: UINT8, -}} -STRUCT!{struct D3D11_BLEND_DESC { - AlphaToCoverageEnable: BOOL, - IndependentBlendEnable: BOOL, - RenderTarget: [D3D11_RENDER_TARGET_BLEND_DESC; 8], -}} -RIDL!{interface ID3D11BlendState(ID3D11BlendStateVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_BLEND_DESC) -> () -}} -STRUCT!{struct D3D11_RASTERIZER_DESC { - FillMode: D3D11_FILL_MODE, - CullMode: D3D11_CULL_MODE, - FrontCounterClockwise: BOOL, - DepthBias: INT, - DepthBiasClamp: FLOAT, - SlopeScaledDepthBias: FLOAT, - DepthClipEnable: BOOL, - ScissorEnable: BOOL, - MultisampleEnable: BOOL, - AntialiasedLineEnable: BOOL, -}} -RIDL!{interface ID3D11RasterizerState(ID3D11RasterizerStateVtbl) - : ID3D11DeviceChild(ID3D11DeviceChildVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_RASTERIZER_DESC) -> () -}} -STRUCT!{struct D3D11_SUBRESOURCE_DATA { - pSysMem: *const c_void, - SysMemPitch: UINT, - SysMemSlicePitch: UINT, -}} -STRUCT!{struct D3D11_MAPPED_SUBRESOURCE { - pData: *mut c_void, - RowPitch: UINT, - DepthPitch: UINT, -}} -RIDL!{interface ID3D11Resource(ID3D11ResourceVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { - fn GetType(&mut self, pResourceDimension: *mut D3D11_RESOURCE_DIMENSION) -> (), - fn SetEvictionPriority(&mut self, EvictionPriority: UINT) -> (), - fn GetEvictionPriority(&mut self) -> UINT -}} -STRUCT!{struct D3D11_BUFFER_DESC { - ByteWidth: UINT, - Usage: D3D11_USAGE, - BindFlags: UINT, - CPUAccessFlags: UINT, - MiscFlags: UINT, - StructureByteStride: UINT, -}} -RIDL!{interface ID3D11Buffer(ID3D11BufferVtbl): ID3D11Resource(ID3D11ResourceVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_BUFFER_DESC) -> () -}} -STRUCT!{struct D3D11_TEXTURE1D_DESC { - Width: UINT, - MipLevels: UINT, - ArraySize: UINT, - Format: DXGI_FORMAT, - Usage: D3D11_USAGE, - BindFlags: UINT, - CPUAccessFlags: UINT, - MiscFlags: UINT, -}} -RIDL!{interface ID3D11Texture1D(ID3D11Texture1DVtbl): ID3D11Resource(ID3D11ResourceVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_TEXTURE1D_DESC) -> () -}} -STRUCT!{struct D3D11_TEXTURE2D_DESC { - Width: UINT, - Height: UINT, - MipLevels: UINT, - ArraySize: UINT, - Format: DXGI_FORMAT, - SampleDesc: DXGI_SAMPLE_DESC, - Usage: D3D11_USAGE, - BindFlags: UINT, - CPUAccessFlags: UINT, - MiscFlags: UINT, -}} -RIDL!{interface ID3D11Texture2D(ID3D11Texture2DVtbl): ID3D11Resource(ID3D11ResourceVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_TEXTURE2D_DESC) -> () -}} -STRUCT!{struct D3D11_TEXTURE3D_DESC { - Width: UINT, - Height: UINT, - Depth: UINT, - MipLevels: UINT, - Format: DXGI_FORMAT, - Usage: D3D11_USAGE, - BindFlags: UINT, - CPUAccessFlags: UINT, - MiscFlags: UINT, -}} -RIDL!{interface ID3D11Texture3D(ID3D11Texture3DVtbl): ID3D11Resource(ID3D11ResourceVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_TEXTURE3D_DESC) -> () -}} -ENUM!{enum D3D11_TEXTURECUBE_FACE { - D3D11_TEXTURECUBE_FACE_POSITIVE_X = 0, - D3D11_TEXTURECUBE_FACE_NEGATIVE_X = 1, - D3D11_TEXTURECUBE_FACE_POSITIVE_Y = 2, - D3D11_TEXTURECUBE_FACE_NEGATIVE_Y = 3, - D3D11_TEXTURECUBE_FACE_POSITIVE_Z = 4, - D3D11_TEXTURECUBE_FACE_NEGATIVE_Z = 5, -}} -RIDL!{interface ID3D11View(ID3D11ViewVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { - fn GetResource(&mut self, ppResource: *mut *mut ID3D11Resource) -> () -}} -STRUCT!{struct D3D11_BUFFER_SRV { - u1: UINT, - u2: UINT, -}} -UNION!{D3D11_BUFFER_SRV, u1, FirstElement, FirstElement_mut, UINT} -UNION!{D3D11_BUFFER_SRV, u1, ElementOffset, ElementOffset_mut, UINT} -UNION!{D3D11_BUFFER_SRV, u2, NumElements, NumElements_mut, UINT} -UNION!{D3D11_BUFFER_SRV, u2, ElementWidth, ElementWidth_mut, UINT} -FLAGS!{enum D3D11_BUFFEREX_SRV_FLAG { - D3D11_BUFFEREX_SRV_FLAG_RAW = 0x1, -}} -STRUCT!{struct D3D11_BUFFEREX_SRV { - FirstElement: UINT, - NumElements: UINT, - Flags: UINT, -}} -STRUCT!{struct D3D11_TEX1D_SRV { - MostDetailedMip: UINT, - MipLevels: UINT, -}} -STRUCT!{struct D3D11_TEX1D_ARRAY_SRV { - MostDetailedMip: UINT, - MipLevels: UINT, - FirstArraySlice: UINT, - ArraySize: UINT, -}} -STRUCT!{struct D3D11_TEX2D_SRV { - MostDetailedMip: UINT, - MipLevels: UINT, -}} -STRUCT!{struct D3D11_TEX2D_ARRAY_SRV { - MostDetailedMip: UINT, - MipLevels: UINT, - FirstArraySlice: UINT, - ArraySize: UINT, -}} -STRUCT!{struct D3D11_TEX3D_SRV { - MostDetailedMip: UINT, - MipLevels: UINT, -}} -STRUCT!{struct D3D11_TEXCUBE_SRV { - MostDetailedMip: UINT, - MipLevels: UINT, -}} -STRUCT!{struct D3D11_TEXCUBE_ARRAY_SRV { - MostDetailedMip: UINT, - MipLevels: UINT, - First2DArrayFace: UINT, - NumCubes: UINT, -}} -STRUCT!{struct D3D11_TEX2DMS_SRV { - UnusedField_NothingToDefine: UINT, -}} -STRUCT!{struct D3D11_TEX2DMS_ARRAY_SRV { - FirstArraySlice: UINT, - ArraySize: UINT, -}} -STRUCT!{struct D3D11_SHADER_RESOURCE_VIEW_DESC { - Format: DXGI_FORMAT, - ViewDimension: D3D11_SRV_DIMENSION, - u: [UINT; 4], -}} -UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, Buffer, Buffer_mut, D3D11_BUFFER_SRV} -UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, Texture1D, Texture1D_mut, D3D11_TEX1D_SRV} -UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, Texture1DArray, Texture1DArray_mut, - D3D11_TEX1D_ARRAY_SRV} -UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, Texture2D, Texture2D_mut, D3D11_TEX2D_SRV} -UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, Texture2DArray, Texture2DArray_mut, - D3D11_TEX2D_ARRAY_SRV} -UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, Texture2DMS, Texture2DMS_mut, D3D11_TEX2DMS_SRV} -UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, Texture2DMSArray, Texture2DMSArray_mut, - D3D11_TEX2DMS_ARRAY_SRV} -UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, Texture3D, Texture3D_mut, D3D11_TEX3D_SRV} -UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, TextureCube, TextureCube_mut, D3D11_TEXCUBE_SRV} -UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, TextureCubeArray, TextureCubeArray_mut, - D3D11_TEXCUBE_ARRAY_SRV} -UNION!{D3D11_SHADER_RESOURCE_VIEW_DESC, u, BufferEx, BufferEx_mut, D3D11_BUFFEREX_SRV} -RIDL!{interface ID3D11ShaderResourceView(ID3D11ShaderResourceViewVtbl): ID3D11View(ID3D11ViewVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_SHADER_RESOURCE_VIEW_DESC) -> () -}} -STRUCT!{struct D3D11_BUFFER_RTV { - u1: UINT, - u2: UINT, -}} -UNION!{D3D11_BUFFER_RTV, u1, FirstElement, FirstElement_mut, UINT} -UNION!{D3D11_BUFFER_RTV, u1, ElementOffset, ElementOffset_mut, UINT} -UNION!{D3D11_BUFFER_RTV, u2, NumElements, NumElements_mut, UINT} -UNION!{D3D11_BUFFER_RTV, u2, ElementWidth, ElementWidth_mut, UINT} -STRUCT!{struct D3D11_TEX1D_RTV { - MipSlice: UINT, -}} -STRUCT!{struct D3D11_TEX1D_ARRAY_RTV { - MipSlice: UINT, - FirstArraySlice: UINT, - ArraySize: UINT, -}} -STRUCT!{struct D3D11_TEX2D_RTV { - MipSlice: UINT, -}} -STRUCT!{struct D3D11_TEX2DMS_RTV { - UnusedField_NothingToDefine: UINT, -}} -STRUCT!{struct D3D11_TEX2D_ARRAY_RTV { - MipSlice: UINT, - FirstArraySlice: UINT, - ArraySize: UINT, -}} -STRUCT!{struct D3D11_TEX2DMS_ARRAY_RTV { - FirstArraySlice: UINT, - ArraySize: UINT, -}} -STRUCT!{struct D3D11_TEX3D_RTV { - MipSlice: UINT, - FirstWSlice: UINT, - WSize: UINT, -}} -STRUCT!{struct D3D11_RENDER_TARGET_VIEW_DESC { - Format: DXGI_FORMAT, - ViewDimension: D3D11_RTV_DIMENSION, - u: [UINT; 3], -}} -UNION!{D3D11_RENDER_TARGET_VIEW_DESC, u, Buffer, Buffer_mut, D3D11_BUFFER_RTV} -UNION!{D3D11_RENDER_TARGET_VIEW_DESC, u, Texture1D, Texture1D_mut, D3D11_TEX1D_RTV} -UNION!{D3D11_RENDER_TARGET_VIEW_DESC, u, Texture1DArray, Texture1DArray_mut, - D3D11_TEX1D_ARRAY_RTV} -UNION!{D3D11_RENDER_TARGET_VIEW_DESC, u, Texture2D, Texture2D_mut, D3D11_TEX2D_RTV} -UNION!{D3D11_RENDER_TARGET_VIEW_DESC, u, Texture2DArray, Texture2DArray_mut, - D3D11_TEX2D_ARRAY_RTV} -UNION!{D3D11_RENDER_TARGET_VIEW_DESC, u, Texture2DMS, Texture2DMS_mut, D3D11_TEX2DMS_RTV} -UNION!{D3D11_RENDER_TARGET_VIEW_DESC, u, Texture2DMSArray,Texture2DMSArray_mut, - D3D11_TEX2DMS_ARRAY_RTV} -UNION!{D3D11_RENDER_TARGET_VIEW_DESC, u, Texture3D, Texture3D_mut, D3D11_TEX3D_RTV} -RIDL!{interface ID3D11RenderTargetView(ID3D11RenderTargetViewVtbl): ID3D11View(ID3D11ViewVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_RENDER_TARGET_VIEW_DESC) -> () -}} -STRUCT!{struct D3D11_TEX1D_DSV { - MipSlice: UINT, -}} -STRUCT!{struct D3D11_TEX1D_ARRAY_DSV { - MipSlice: UINT, - FirstArraySlice: UINT, - ArraySize: UINT, -}} -STRUCT!{struct D3D11_TEX2D_DSV { - MipSlice: UINT, -}} -STRUCT!{struct D3D11_TEX2D_ARRAY_DSV { - MipSlice: UINT, - FirstArraySlice: UINT, - ArraySize: UINT, -}} -STRUCT!{struct D3D11_TEX2DMS_DSV { - UnusedField_NothingToDefine: UINT, -}} -STRUCT!{struct D3D11_TEX2DMS_ARRAY_DSV { - FirstArraySlice: UINT, - ArraySize: UINT, -}} -FLAGS!{enum D3D11_DSV_FLAG{ - D3D11_DSV_READ_ONLY_DEPTH = 0x1, - D3D11_DSV_READ_ONLY_STENCIL = 0x2, -}} -STRUCT!{struct D3D11_DEPTH_STENCIL_VIEW_DESC { - Format: DXGI_FORMAT, - ViewDimension: D3D11_DSV_DIMENSION, - Flags: UINT, - u: [UINT; 3], -}} -UNION!{D3D11_DEPTH_STENCIL_VIEW_DESC, u, Texture1D, Texture1D_mut, D3D11_TEX1D_DSV} -UNION!{D3D11_DEPTH_STENCIL_VIEW_DESC, u, Texture1DArray, Texture1DArray_mut, - D3D11_TEX1D_ARRAY_DSV} -UNION!{D3D11_DEPTH_STENCIL_VIEW_DESC, u, Texture2D, Texture2D_mut, D3D11_TEX2D_DSV} -UNION!{D3D11_DEPTH_STENCIL_VIEW_DESC, u, Texture2DArray, Texture2DArray_mut, - D3D11_TEX2D_ARRAY_DSV} -UNION!{D3D11_DEPTH_STENCIL_VIEW_DESC, u, Texture2DMS, Texture2DMS_mut, D3D11_TEX2DMS_DSV} -UNION!{D3D11_DEPTH_STENCIL_VIEW_DESC, u, Texture2DMSArray, Texture2DMSArray_mut, - D3D11_TEX2DMS_ARRAY_DSV} -RIDL!{interface ID3D11DepthStencilView(ID3D11DepthStencilViewVtbl): ID3D11View(ID3D11ViewVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_DEPTH_STENCIL_VIEW_DESC) -> () -}} -FLAGS!{enum D3D11_BUFFER_UAV_FLAG { - D3D11_BUFFER_UAV_FLAG_RAW = 0x1, - D3D11_BUFFER_UAV_FLAG_APPEND = 0x2, - D3D11_BUFFER_UAV_FLAG_COUNTER = 0x4, -}} -STRUCT!{struct D3D11_BUFFER_UAV { - FirstElement: UINT, - NumElements: UINT, - Flags: UINT, -}} -STRUCT!{struct D3D11_TEX1D_UAV { - MipSlice: UINT, -}} -STRUCT!{struct D3D11_TEX1D_ARRAY_UAV { - MipSlice: UINT, - FirstArraySlice: UINT, - ArraySize: UINT, -}} -STRUCT!{struct D3D11_TEX2D_UAV { - MipSlice: UINT, -}} -STRUCT!{struct D3D11_TEX2D_ARRAY_UAV { - MipSlice: UINT, - FirstArraySlice: UINT, - ArraySize: UINT, -}} -STRUCT!{struct D3D11_TEX3D_UAV { - MipSlice: UINT, - FirstWSlice: UINT, - WSize: UINT, -}} -STRUCT!{struct D3D11_UNORDERED_ACCESS_VIEW_DESC { - Format: DXGI_FORMAT, - ViewDimension: D3D11_UAV_DIMENSION, - u: [UINT; 3], -}} -UNION!{D3D11_UNORDERED_ACCESS_VIEW_DESC, u, Buffer, Buffer_mut, D3D11_BUFFER_UAV} -UNION!{D3D11_UNORDERED_ACCESS_VIEW_DESC, u, Texture1D, Texture1D_mut, D3D11_TEX1D_UAV} -UNION!{D3D11_UNORDERED_ACCESS_VIEW_DESC, u, Texture1DArray, Texture1DArray_mut, - D3D11_TEX1D_ARRAY_UAV} -UNION!{D3D11_UNORDERED_ACCESS_VIEW_DESC, u, Texture2D, Texture2D_mut, D3D11_TEX2D_UAV} -UNION!{D3D11_UNORDERED_ACCESS_VIEW_DESC, u, Texture2DArray, Texture2DArray_mut, - D3D11_TEX2D_ARRAY_UAV} -UNION!{D3D11_UNORDERED_ACCESS_VIEW_DESC, u, Texture3D, Texture3D_mut, D3D11_TEX3D_UAV} -RIDL!{interface ID3D11UnorderedAccessView(ID3D11UnorderedAccessViewVtbl): ID3D11View(ID3D11ViewVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_UNORDERED_ACCESS_VIEW_DESC) -> () -}} -RIDL!{interface ID3D11VertexShader(ID3D11VertexShaderVtbl) - : ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} -RIDL!{interface ID3D11HullShader(ID3D11HullShaderVtbl) - : ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} -RIDL!{interface ID3D11DomainShader(ID3D11DomainShaderVtbl) - : ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} -RIDL!{interface ID3D11GeometryShader(ID3D11GeometryShaderVtbl) - : ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} -RIDL!{interface ID3D11PixelShader(ID3D11PixelShaderVtbl) - : ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} -RIDL!{interface ID3D11ComputeShader(ID3D11ComputeShaderVtbl) - : ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} -RIDL!{interface ID3D11InputLayout(ID3D11InputLayoutVtbl) - : ID3D11DeviceChild(ID3D11DeviceChildVtbl) {}} -ENUM!{enum D3D11_FILTER { - D3D11_FILTER_MIN_MAG_MIP_POINT = 0, - D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x1, - D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x4, - D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x5, - D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10, - D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11, - D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14, - D3D11_FILTER_MIN_MAG_MIP_LINEAR = 0x15, - D3D11_FILTER_ANISOTROPIC = 0x55, - D3D11_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x80, - D3D11_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x81, - D3D11_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x84, - D3D11_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x85, - D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x90, - D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x91, - D3D11_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x94, - D3D11_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x95, - D3D11_FILTER_COMPARISON_ANISOTROPIC = 0xd5, - D3D11_FILTER_MINIMUM_MIN_MAG_MIP_POINT = 0x100, - D3D11_FILTER_MINIMUM_MIN_MAG_POINT_MIP_LINEAR = 0x101, - D3D11_FILTER_MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x104, - D3D11_FILTER_MINIMUM_MIN_POINT_MAG_MIP_LINEAR = 0x105, - D3D11_FILTER_MINIMUM_MIN_LINEAR_MAG_MIP_POINT = 0x110, - D3D11_FILTER_MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x111, - D3D11_FILTER_MINIMUM_MIN_MAG_LINEAR_MIP_POINT = 0x114, - D3D11_FILTER_MINIMUM_MIN_MAG_MIP_LINEAR = 0x115, - D3D11_FILTER_MINIMUM_ANISOTROPIC = 0x155, - D3D11_FILTER_MAXIMUM_MIN_MAG_MIP_POINT = 0x180, - D3D11_FILTER_MAXIMUM_MIN_MAG_POINT_MIP_LINEAR = 0x181, - D3D11_FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x184, - D3D11_FILTER_MAXIMUM_MIN_POINT_MAG_MIP_LINEAR = 0x185, - D3D11_FILTER_MAXIMUM_MIN_LINEAR_MAG_MIP_POINT = 0x190, - D3D11_FILTER_MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x191, - D3D11_FILTER_MAXIMUM_MIN_MAG_LINEAR_MIP_POINT = 0x194, - D3D11_FILTER_MAXIMUM_MIN_MAG_MIP_LINEAR = 0x195, - D3D11_FILTER_MAXIMUM_ANISOTROPIC = 0x1d5, -}} -ENUM!{enum D3D11_FILTER_TYPE { - D3D11_FILTER_TYPE_POINT = 0, - D3D11_FILTER_TYPE_LINEAR = 1, -}} -ENUM!{enum D3D11_FILTER_REDUCTION_TYPE { - D3D11_FILTER_REDUCTION_TYPE_STANDARD = 0, - D3D11_FILTER_REDUCTION_TYPE_COMPARISON = 1, - D3D11_FILTER_REDUCTION_TYPE_MINIMUM = 2, - D3D11_FILTER_REDUCTION_TYPE_MAXIMUM = 3, -}} -pub const D3D11_FILTER_REDUCTION_TYPE_MASK: DWORD = 0x3; -pub const D3D11_FILTER_REDUCTION_TYPE_SHIFT: DWORD = 7; -pub const D3D11_FILTER_TYPE_MASK: DWORD = 0x3; -pub const D3D11_MIN_FILTER_SHIFT: DWORD = 4; -pub const D3D11_MAG_FILTER_SHIFT: DWORD = 2; -pub const D3D11_MIP_FILTER_SHIFT: DWORD = 0; -pub const D3D11_COMPARISON_FILTERING_BIT: DWORD = 0x80; -pub const D3D11_ANISOTROPIC_FILTERING_BIT: DWORD = 0x40; -ENUM!{enum D3D11_TEXTURE_ADDRESS_MODE { - D3D11_TEXTURE_ADDRESS_WRAP = 1, - D3D11_TEXTURE_ADDRESS_MIRROR = 2, - D3D11_TEXTURE_ADDRESS_CLAMP = 3, - D3D11_TEXTURE_ADDRESS_BORDER = 4, - D3D11_TEXTURE_ADDRESS_MIRROR_ONCE = 5, -}} -STRUCT!{struct D3D11_SAMPLER_DESC { - Filter: D3D11_FILTER, - AddressU: D3D11_TEXTURE_ADDRESS_MODE, - AddressV: D3D11_TEXTURE_ADDRESS_MODE, - AddressW: D3D11_TEXTURE_ADDRESS_MODE, - MipLODBias: FLOAT, - MaxAnisotropy: UINT, - ComparisonFunc: D3D11_COMPARISON_FUNC, - BorderColor: [FLOAT; 4], - MinLOD: FLOAT, - MaxLOD: FLOAT, -}} -RIDL!{interface ID3D11SamplerState(ID3D11SamplerStateVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_SAMPLER_DESC) -> () -}} -FLAGS!{enum D3D11_FORMAT_SUPPORT { - D3D11_FORMAT_SUPPORT_BUFFER = 0x1, - D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER = 0x2, - D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER = 0x4, - D3D11_FORMAT_SUPPORT_SO_BUFFER = 0x8, - D3D11_FORMAT_SUPPORT_TEXTURE1D = 0x10, - D3D11_FORMAT_SUPPORT_TEXTURE2D = 0x20, - D3D11_FORMAT_SUPPORT_TEXTURE3D = 0x40, - D3D11_FORMAT_SUPPORT_TEXTURECUBE = 0x80, - D3D11_FORMAT_SUPPORT_SHADER_LOAD = 0x100, - D3D11_FORMAT_SUPPORT_SHADER_SAMPLE = 0x200, - D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON = 0x400, - D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_MONO_TEXT = 0x800, - D3D11_FORMAT_SUPPORT_MIP = 0x1000, - D3D11_FORMAT_SUPPORT_MIP_AUTOGEN = 0x2000, - D3D11_FORMAT_SUPPORT_RENDER_TARGET = 0x4000, - D3D11_FORMAT_SUPPORT_BLENDABLE = 0x8000, - D3D11_FORMAT_SUPPORT_DEPTH_STENCIL = 0x10000, - D3D11_FORMAT_SUPPORT_CPU_LOCKABLE = 0x20000, - D3D11_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE = 0x40000, - D3D11_FORMAT_SUPPORT_DISPLAY = 0x80000, - D3D11_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT = 0x100000, - D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET = 0x200000, - D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD = 0x400000, - D3D11_FORMAT_SUPPORT_SHADER_GATHER = 0x800000, - D3D11_FORMAT_SUPPORT_BACK_BUFFER_CAST = 0x1000000, - D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW = 0x2000000, - D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON = 0x4000000, - D3D11_FORMAT_SUPPORT_DECODER_OUTPUT = 0x8000000, - D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_OUTPUT = 0x10000000, - D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT = 0x20000000, - D3D11_FORMAT_SUPPORT_VIDEO_ENCODER = 0x40000000, -}} -FLAGS!{enum D3D11_FORMAT_SUPPORT2 { - D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_ADD = 0x1, - D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS = 0x2, - D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE = 0x4, - D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_EXCHANGE = 0x8, - D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_SIGNED_MIN_OR_MAX = 0x10, - D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_UNSIGNED_MIN_OR_MAX = 0x20, - D3D11_FORMAT_SUPPORT2_UAV_TYPED_LOAD = 0x40, - D3D11_FORMAT_SUPPORT2_UAV_TYPED_STORE = 0x80, - D3D11_FORMAT_SUPPORT2_OUTPUT_MERGER_LOGIC_OP = 0x100, - D3D11_FORMAT_SUPPORT2_TILED = 0x200, - D3D11_FORMAT_SUPPORT2_SHAREABLE = 0x400, - D3D11_FORMAT_SUPPORT2_MULTIPLANE_OVERLAY = 0x4000, -}} -RIDL!{interface ID3D11Asynchronous(ID3D11AsynchronousVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { - fn GetDataSize(&mut self) -> UINT -}} -FLAGS!{enum D3D11_ASYNC_GETDATA_FLAG { - D3D11_ASYNC_GETDATA_DONOTFLUSH = 0x1, -}} -ENUM!{enum D3D11_QUERY { - D3D11_QUERY_EVENT = 0, - D3D11_QUERY_OCCLUSION = D3D11_QUERY_EVENT.0 + 1, - D3D11_QUERY_TIMESTAMP = D3D11_QUERY_OCCLUSION.0 + 1, - D3D11_QUERY_TIMESTAMP_DISJOINT = D3D11_QUERY_TIMESTAMP.0 + 1, - D3D11_QUERY_PIPELINE_STATISTICS = D3D11_QUERY_TIMESTAMP_DISJOINT.0 + 1, - D3D11_QUERY_OCCLUSION_PREDICATE = D3D11_QUERY_PIPELINE_STATISTICS.0 + 1, - D3D11_QUERY_SO_STATISTICS = D3D11_QUERY_OCCLUSION_PREDICATE.0 + 1, - D3D11_QUERY_SO_OVERFLOW_PREDICATE = D3D11_QUERY_SO_STATISTICS.0 + 1, - D3D11_QUERY_SO_STATISTICS_STREAM0 = D3D11_QUERY_SO_OVERFLOW_PREDICATE.0 + 1, - D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0 = D3D11_QUERY_SO_STATISTICS_STREAM0.0 + 1, - D3D11_QUERY_SO_STATISTICS_STREAM1 = D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0.0 + 1, - D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1 = D3D11_QUERY_SO_STATISTICS_STREAM1.0 + 1, - D3D11_QUERY_SO_STATISTICS_STREAM2 = D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1.0 + 1, - D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2 = D3D11_QUERY_SO_STATISTICS_STREAM2.0 + 1, - D3D11_QUERY_SO_STATISTICS_STREAM3 = D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2.0 + 1, - D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3 = D3D11_QUERY_SO_STATISTICS_STREAM3.0 + 1, -}} -FLAGS!{enum D3D11_QUERY_MISC_FLAG { - D3D11_QUERY_MISC_PREDICATEHINT = 0x1, -}} -STRUCT!{struct D3D11_QUERY_DESC { - Query: D3D11_QUERY, - MiscFlags: UINT, -}} -RIDL!{interface ID3D11Query(ID3D11QueryVtbl): ID3D11Asynchronous(ID3D11AsynchronousVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_QUERY_DESC) -> () -}} -RIDL!{interface ID3D11Predicate(ID3D11PredicateVtbl): ID3D11Query(ID3D11QueryVtbl) {}} -STRUCT!{struct D3D11_QUERY_DATA_TIMESTAMP_DISJOINT { - Frequency: UINT64, - Disjoint: BOOL, -}} -STRUCT!{struct D3D11_QUERY_DATA_PIPELINE_STATISTICS { - IAVertices: UINT64, - IAPrimitives: UINT64, - VSInvocations: UINT64, - GSInvocations: UINT64, - GSPrimitives: UINT64, - CInvocations: UINT64, - CPrimitives: UINT64, - PSInvocations: UINT64, - HSInvocations: UINT64, - DSInvocations: UINT64, - CSInvocations: UINT64, -}} -STRUCT!{struct D3D11_QUERY_DATA_SO_STATISTICS { - NumPrimitivesWritten: UINT64, - PrimitivesStorageNeeded: UINT64, -}} -FLAGS!{enum D3D11_COUNTER { - D3D11_COUNTER_DEVICE_DEPENDENT_0 = 0x40000000, -}} -ENUM!{enum D3D11_COUNTER_TYPE { - D3D11_COUNTER_TYPE_FLOAT32 = 0, - D3D11_COUNTER_TYPE_UINT16 = D3D11_COUNTER_TYPE_FLOAT32.0 + 1, - D3D11_COUNTER_TYPE_UINT32 = D3D11_COUNTER_TYPE_UINT16.0 + 1, - D3D11_COUNTER_TYPE_UINT64 = D3D11_COUNTER_TYPE_UINT32.0 + 1, -}} -STRUCT!{struct D3D11_COUNTER_DESC { - Counter: D3D11_COUNTER, - MiscFlags: UINT, -}} -STRUCT!{struct D3D11_COUNTER_INFO { - LastDeviceDependentCounter: D3D11_COUNTER, - NumSimultaneousCounters: UINT, - NumDetectableParallelUnits: UINT8, -}} -RIDL!{interface ID3D11Counter(ID3D11CounterVtbl): ID3D11Asynchronous(ID3D11AsynchronousVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_COUNTER_DESC) -> () -}} -ENUM!{enum D3D11_STANDARD_MULTISAMPLE_QUALITY_LEVELS { - D3D11_STANDARD_MULTISAMPLE_PATTERN = 0xffffffff, - D3D11_CENTER_MULTISAMPLE_PATTERN = 0xfffffffe, -}} -ENUM!{enum D3D11_DEVICE_CONTEXT_TYPE { - D3D11_DEVICE_CONTEXT_IMMEDIATE = 0, - D3D11_DEVICE_CONTEXT_DEFERRED = D3D11_DEVICE_CONTEXT_IMMEDIATE.0 + 1, -}} -STRUCT!{struct D3D11_CLASS_INSTANCE_DESC { - InstanceId: UINT, - InstanceIndex: UINT, - TypeId: UINT, - ConstantBuffer: UINT, - BaseConstantBufferOffset: UINT, - BaseTexture: UINT, - BaseSampler: UINT, - Created: BOOL, -}} -RIDL!{interface ID3D11ClassInstance(ID3D11ClassInstanceVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { - fn GetClassLinkage(&mut self, ppLinkage: *mut *mut ID3D11ClassLinkage) -> (), - fn GetDesc(&mut self, pDesc: *mut D3D11_CLASS_INSTANCE_DESC) -> (), - fn GetInstanceName(&mut self, pInstanceName: LPSTR, pBufferLength: *mut SIZE_T) -> (), - fn GetTypeName(&mut self, pTypeName: LPSTR, pBufferLength: *mut SIZE_T) -> () -}} -RIDL!{interface ID3D11ClassLinkage(ID3D11ClassLinkageVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { - fn GetClassInstance( - &mut self, GetClassInstance: LPCSTR, InstanceIndex: UINT, - ppInstance: *mut *mut ID3D11ClassInstance - ) -> HRESULT, - fn CreateClassInstance( - &mut self, pClassTypeName: LPCSTR, ConstantBufferOffset: UINT, ConstantVectorOffset: UINT, TextureOffset: UINT, SamplerOffset: UINT, ppInstance: *mut *mut ID3D11ClassInstance - ) -> HRESULT -}} -RIDL!{interface ID3D11CommandList(ID3D11CommandListVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { - fn GetContextFlags(&mut self) -> UINT -}} -ENUM!{enum D3D11_FEATURE { - D3D11_FEATURE_THREADING = 0, - D3D11_FEATURE_DOUBLES = D3D11_FEATURE_THREADING.0 + 1, - D3D11_FEATURE_FORMAT_SUPPORT = D3D11_FEATURE_DOUBLES.0 + 1, - D3D11_FEATURE_FORMAT_SUPPORT2 = D3D11_FEATURE_FORMAT_SUPPORT.0 + 1, - D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS = D3D11_FEATURE_FORMAT_SUPPORT2.0 + 1, - D3D11_FEATURE_D3D11_OPTIONS = D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS.0 + 1, - D3D11_FEATURE_ARCHITECTURE_INFO = D3D11_FEATURE_D3D11_OPTIONS.0 + 1, - D3D11_FEATURE_D3D9_OPTIONS = D3D11_FEATURE_ARCHITECTURE_INFO.0 + 1, - D3D11_FEATURE_SHADER_MIN_PRECISION_SUPPORT = D3D11_FEATURE_D3D9_OPTIONS.0 + 1, - D3D11_FEATURE_D3D9_SHADOW_SUPPORT = D3D11_FEATURE_SHADER_MIN_PRECISION_SUPPORT.0 + 1, - D3D11_FEATURE_D3D11_OPTIONS1 = D3D11_FEATURE_D3D9_SHADOW_SUPPORT.0 + 1, - D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT = D3D11_FEATURE_D3D11_OPTIONS1.0 + 1, - D3D11_FEATURE_MARKER_SUPPORT = D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT.0 + 1, - D3D11_FEATURE_D3D9_OPTIONS1 = D3D11_FEATURE_MARKER_SUPPORT.0 + 1, - D3D11_FEATURE_D3D11_OPTIONS2 = D3D11_FEATURE_D3D9_OPTIONS1.0 + 1, - D3D11_FEATURE_D3D11_OPTIONS3 = D3D11_FEATURE_D3D11_OPTIONS2.0 + 1, - D3D11_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT = D3D11_FEATURE_D3D11_OPTIONS3.0 + 1, -}} -STRUCT!{struct D3D11_FEATURE_DATA_THREADING { - DriverConcurrentCreates: BOOL, - DriverCommandLists: BOOL, -}} -STRUCT!{struct D3D11_FEATURE_DATA_DOUBLES { - DoublePrecisionFloatShaderOps: BOOL, -}} -STRUCT!{struct D3D11_FEATURE_DATA_FORMAT_SUPPORT { - InFormat: DXGI_FORMAT, - OutFormatSupport: UINT, -}} -STRUCT!{struct D3D11_FEATURE_DATA_FORMAT_SUPPORT2 { - InFormat: DXGI_FORMAT, - OutFormatSupport2: UINT, -}} -STRUCT!{struct D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS { - ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x: BOOL, -}} -STRUCT!{struct D3D11_FEATURE_DATA_D3D11_OPTIONS { - OutputMergerLogicOp: BOOL, - UAVOnlyRenderingForcedSampleCount: BOOL, - DiscardAPIsSeenByDriver: BOOL, - FlagsForUpdateAndCopySeenByDriver: BOOL, - ClearView: BOOL, - CopyWithOverlap: BOOL, - ConstantBufferPartialUpdate: BOOL, - ConstantBufferOffsetting: BOOL, - MapNoOverwriteOnDynamicConstantBuffer: BOOL, - MapNoOverwriteOnDynamicBufferSRV: BOOL, - MultisampleRTVWithForcedSampleCountOne: BOOL, - SAD4ShaderInstructions: BOOL, - ExtendedDoublesShaderInstructions: BOOL, - ExtendedResourceSharing: BOOL, -}} -STRUCT!{struct D3D11_FEATURE_DATA_ARCHITECTURE_INFO { - TileBasedDeferredRenderer: BOOL, -}} -STRUCT!{struct D3D11_FEATURE_DATA_D3D9_OPTIONS { - FullNonPow2TextureSupport: BOOL, -}} -STRUCT!{struct D3D11_FEATURE_DATA_D3D9_SHADOW_SUPPORT { - SupportsDepthAsTextureWithLessEqualComparisonFilter: BOOL, -}} -FLAGS!{enum D3D11_SHADER_MIN_PRECISION_SUPPORT { - D3D11_SHADER_MIN_PRECISION_10_BIT = 0x1, - D3D11_SHADER_MIN_PRECISION_16_BIT = 0x2, -}} -STRUCT!{struct D3D11_FEATURE_DATA_SHADER_MIN_PRECISION_SUPPORT { - PixelShaderMinPrecision: UINT, - AllOtherShaderStagesMinPrecision: UINT, -}} -ENUM!{enum D3D11_TILED_RESOURCES_TIER { - D3D11_TILED_RESOURCES_NOT_SUPPORTED = 0, - D3D11_TILED_RESOURCES_TIER_1 = 1, - D3D11_TILED_RESOURCES_TIER_2 = 2, - D3D11_TILED_RESOURCES_TIER_3 = 3, -}} -STRUCT!{struct D3D11_FEATURE_DATA_D3D11_OPTIONS1 { - TiledResourcesTier: D3D11_TILED_RESOURCES_TIER, - MinMaxFiltering: BOOL, - ClearViewAlsoSupportsDepthOnlyFormats: BOOL, - MapOnDefaultBuffers: BOOL, -}} -STRUCT!{struct D3D11_FEATURE_DATA_D3D9_SIMPLE_INSTANCING_SUPPORT { - SimpleInstancingSupported: BOOL, -}} -STRUCT!{struct D3D11_FEATURE_DATA_MARKER_SUPPORT { - Profile: BOOL, -}} -STRUCT!{struct D3D11_FEATURE_DATA_D3D9_OPTIONS1 { - FullNonPow2TextureSupported: BOOL, - DepthAsTextureWithLessEqualComparisonFilterSupported: BOOL, - SimpleInstancingSupported: BOOL, - TextureCubeFaceRenderTargetWithNonCubeDepthStencilSupported: BOOL, -}} -ENUM!{enum D3D11_CONSERVATIVE_RASTERIZATION_TIER { - D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED = 0, - D3D11_CONSERVATIVE_RASTERIZATION_TIER_1 = 1, - D3D11_CONSERVATIVE_RASTERIZATION_TIER_2 = 2, - D3D11_CONSERVATIVE_RASTERIZATION_TIER_3 = 3, -}} -STRUCT!{struct D3D11_FEATURE_DATA_D3D11_OPTIONS2 { - PSSpecifiedStencilRefSupported: BOOL, - TypedUAVLoadAdditionalFormats: BOOL, - ROVsSupported: BOOL, - ConservativeRasterizationTier: D3D11_CONSERVATIVE_RASTERIZATION_TIER, - TiledResourcesTier: D3D11_TILED_RESOURCES_TIER, - MapOnDefaultTextures: BOOL, - StandardSwizzle: BOOL, - UnifiedMemoryArchitecture: BOOL, -}} -STRUCT!{struct D3D11_FEATURE_DATA_D3D11_OPTIONS3 { - VPAndRTArrayIndexFromAnyShaderFeedingRasterizer: BOOL, -}} -STRUCT!{struct D3D11_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT { - MaxGPUVirtualAddressBitsPerResource: UINT, - MaxGPUVirtualAddressBitsPerProcess: UINT, -}} -RIDL!{interface ID3D11DeviceContext(ID3D11DeviceContextVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { - fn VSSetConstantBuffers( - &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *const *mut ID3D11Buffer - ) -> (), - fn PSSetShaderResources( - &mut self, StartSlot: UINT, NumViews: UINT, - ppShaderResourceViews: *const *mut ID3D11ShaderResourceView - ) -> (), - fn PSSetShader( - &mut self, pPixelShader: *mut ID3D11PixelShader, - ppClassInstances: *const *mut ID3D11ClassInstance, NumClassInstances: UINT - ) -> (), - fn PSSetSamplers( - &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *const *mut ID3D11SamplerState - ) -> (), - fn VSSetShader( - &mut self, pVertexShader: *mut ID3D11VertexShader, - ppClassInstances: *const *mut ID3D11ClassInstance, NumClassInstances: UINT - ) -> (), - fn DrawIndexed( - &mut self, IndexCount: UINT, StartIndexLocation: UINT, BaseVertexLocation: INT - ) -> (), - fn Draw(&mut self, VertexCount: UINT, StartVertexLocation: UINT) -> (), - fn Map( - &mut self, pResource: *mut ID3D11Resource, Subresource: UINT, MapType: D3D11_MAP, - MapFlags: UINT, pMappedResource: *mut D3D11_MAPPED_SUBRESOURCE - ) -> HRESULT, - fn Unmap(&mut self, pResource: *mut ID3D11Resource, Subresource: UINT) -> (), - fn PSSetConstantBuffers( - &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *const *mut ID3D11Buffer - ) -> (), - fn IASetInputLayout(&mut self, pInputLayout: *mut ID3D11InputLayout) -> (), - fn IASetVertexBuffers( - &mut self, StartSlot: UINT, NumBuffers: UINT, ppVertexBuffers: *const *mut ID3D11Buffer, - pStrides: *const UINT, pOffsets: *const UINT - ) -> (), - fn IASetIndexBuffer( - &mut self, pIndexBuffer: *mut ID3D11Buffer, Format: DXGI_FORMAT, Offset: UINT - ) -> (), - fn DrawIndexedInstanced( - &mut self, IndexCountPerInstance: UINT, InstanceCount: UINT, StartIndexLocation: UINT, - BaseVertexLocation: INT, StartInstanceLocation: UINT - ) -> (), - fn DrawInstanced( - &mut self, VertexCountPerInstance: UINT, InstanceCount: UINT, StartVertexLocation: UINT, - StartInstanceLocation: UINT - ) -> (), - fn GSSetConstantBuffers( - &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *const *mut ID3D11Buffer - ) -> (), - fn GSSetShader( - &mut self, pShader: *mut ID3D11GeometryShader, - ppClassInstances: *const *mut ID3D11ClassInstance, NumClassInstances: UINT - ) -> (), - fn IASetPrimitiveTopology(&mut self, Topology: D3D11_PRIMITIVE_TOPOLOGY) -> (), - fn VSSetShaderResources( - &mut self, StartSlot: UINT, NumViews: UINT, - ppShaderResourceViews: *const *mut ID3D11ShaderResourceView - ) -> (), - fn VSSetSamplers( - &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *const *mut ID3D11SamplerState - ) -> (), - fn Begin(&mut self, pAsync: *mut ID3D11Asynchronous) -> (), - fn End(&mut self, pAsync: *mut ID3D11Asynchronous) -> (), - fn GetData( - &mut self, pAsync: *mut ID3D11Asynchronous, pData: *mut c_void, DataSize: UINT, - GetDataFlags: UINT - ) -> HRESULT, - fn SetPredication( - &mut self, pPredicate: *mut ID3D11Predicate, PredicateValue: BOOL - ) -> (), - fn GSSetShaderResources( - &mut self, StartSlot: UINT, NumViews: UINT, - ppShaderResourceViews: *const *mut ID3D11ShaderResourceView - ) -> (), - fn GSSetSamplers( - &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *const *mut ID3D11SamplerState - ) -> (), - fn OMSetRenderTargets( - &mut self, NumViews: UINT, ppRenderTargetViews: *const *mut ID3D11RenderTargetView, - pDepthStencilView: *mut ID3D11DepthStencilView - ) -> (), - fn OMSetRenderTargetsAndUnorderedAccessViews( - &mut self, NumRTVs: UINT, ppRenderTargetViews: *const *mut ID3D11RenderTargetView, - pDepthStencilView: *mut ID3D11DepthStencilView, UAVStartSlot: UINT, NumUAVs: UINT, - ppUnorderedAccessViews: *const *mut ID3D11UnorderedAccessView, - pUAVInitialCounts: *const UINT - ) -> (), - fn OMSetBlendState( - &mut self, pBlendState: *mut ID3D11BlendState, BlendFactor: &[FLOAT; 4], SampleMask: UINT - ) -> (), - fn OMSetDepthStencilState( - &mut self, pDepthStencilState: *mut ID3D11DepthStencilState, StencilRef: UINT - ) -> (), - fn SOSetTargets( - &mut self, NumBuffers: UINT, ppSOTargets: *const *mut ID3D11Buffer, pOffsets: *const UINT - ) -> (), - fn DrawAuto(&mut self) -> (), - fn DrawIndexedInstancedIndirect( - &mut self, pBufferForArgs: *mut ID3D11Buffer, AlignedByteOffsetForArgs: UINT - ) -> (), - fn DrawInstancedIndirect( - &mut self, pBufferForArgs: *mut ID3D11Buffer, AlignedByteOffsetForArgs: UINT - ) -> (), - fn Dispatch( - &mut self, ThreadGroupCountX: UINT, ThreadGroupCountY: UINT, ThreadGroupCountZ: UINT - ) -> (), - fn DispatchIndirect( - &mut self, pBufferForArgs: *mut ID3D11Buffer, AlignedByteOffsetForArgs: UINT - ) -> (), - fn RSSetState(&mut self, pRasterizerState: *mut ID3D11RasterizerState) -> (), - fn RSSetViewports(&mut self, NumViewports: UINT, pViewports: *const D3D11_VIEWPORT) -> (), - fn RSSetScissorRects(&mut self, NumRects: UINT, pRects: *const D3D11_RECT) -> (), - fn CopySubresourceRegion( - &mut self, pDstResource: *mut ID3D11Resource, DstSubresource: UINT, DstX: UINT, DstY: UINT, - DstZ: UINT, pSrcResource: *mut ID3D11Resource, SrcSubresource: UINT, - pSrcBox: *const D3D11_BOX - ) -> (), - fn CopyResource( - &mut self, pDstResource: *mut ID3D11Resource, pSrcResource: *mut ID3D11Resource - ) -> (), - fn UpdateSubresource( - &mut self, pDstResource: *mut ID3D11Resource, DstSubresource: UINT, - pDstBox: *const D3D11_BOX, pSrcData: *const c_void, SrcRowPitch: UINT, SrcDepthPitch: UINT - ) -> (), - fn CopyStructureCount( - &mut self, pDstBuffer: *mut ID3D11Buffer, DstAlignedByteOffset: UINT, - pSrcView: *mut ID3D11UnorderedAccessView - ) -> (), - fn ClearRenderTargetView( - &mut self, pRenderTargetView: *mut ID3D11RenderTargetView, ColorRGBA: &[FLOAT; 4] - ) -> (), - fn ClearUnorderedAccessViewUint( - &mut self, pUnorderedAccessView: *mut ID3D11UnorderedAccessView, Values: &[UINT; 4] - ) -> (), - fn ClearUnorderedAccessViewFloat( - &mut self, pUnorderedAccessView: *mut ID3D11UnorderedAccessView, Values: &[FLOAT; 4] - ) -> (), - fn ClearDepthStencilView( - &mut self, pDepthStencilView: *mut ID3D11DepthStencilView, ClearFlags: UINT, Depth: FLOAT, - Stencil: UINT8 - ) -> (), - fn GenerateMips(&mut self, pShaderResourceView: *mut ID3D11ShaderResourceView) -> (), - fn SetResourceMinLOD(&mut self, pResource: *mut ID3D11Resource, MinLOD: FLOAT) -> (), - fn GetResourceMinLOD(&mut self, pResource: *mut ID3D11Resource) -> FLOAT, - fn ResolveSubresource( - &mut self, pDstResource: *mut ID3D11Resource, DstSubresource: UINT, - pSrcResource: *mut ID3D11Resource, SrcSubresource: UINT, Format: DXGI_FORMAT - ) -> (), - fn ExecuteCommandList( - &mut self, pCommandList: *mut ID3D11CommandList, - RestoreContextState: BOOL - ) -> (), - fn HSSetShaderResources( - &mut self, StartSlot: UINT, NumViews: UINT, - ppShaderResourceViews: *const *mut ID3D11ShaderResourceView - ) -> (), - fn HSSetShader( - &mut self, pHullShader: *mut ID3D11HullShader, - ppClassInstances: *const *mut ID3D11ClassInstance, NumClassInstances: UINT - ) -> (), - fn HSSetSamplers( - &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *const *mut ID3D11SamplerState - ) -> (), - fn HSSetConstantBuffers( - &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *const *mut ID3D11Buffer - ) -> (), - fn DSSetShaderResources( - &mut self, StartSlot: UINT, NumViews: UINT, - ppShaderResourceViews: *const *mut ID3D11ShaderResourceView - ) -> (), - fn DSSetShader( - &mut self, pDomainShader: *mut ID3D11DomainShader, - ppClassInstances: *const *mut ID3D11ClassInstance, NumClassInstances: UINT - ) -> (), - fn DSSetSamplers( - &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *const *mut ID3D11SamplerState - ) -> (), - fn DSSetConstantBuffers( - &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *const *mut ID3D11Buffer - ) -> (), - fn CSSetShaderResources( - &mut self, StartSlot: UINT, NumViews: UINT, - ppShaderResourceViews: *const *mut ID3D11ShaderResourceView - ) -> (), - fn CSSetUnorderedAccessViews( - &mut self, StartSlot: UINT, NumUAVs: UINT, - ppUnorderedAccessViews: *const *mut ID3D11UnorderedAccessView - ) -> (), - fn CSSetShader( - &mut self, pComputeShader: *mut ID3D11ComputeShader, - ppClassInstances: *const *mut ID3D11ClassInstance, NumClassInstances: UINT - ) -> (), - fn CSSetSamplers( - &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *const *mut ID3D11SamplerState - ) -> (), - fn CSSetConstantBuffers( - &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *const *mut ID3D11Buffer - ) -> (), - fn VSGetConstantBuffers( - &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *mut *mut ID3D11Buffer - ) -> (), - fn PSGetShaderResources( - &mut self, StartSlot: UINT, NumViews: UINT, - ppShaderResourceViews: *mut *mut ID3D11ShaderResourceView - ) -> (), - fn PSGetShader( - &mut self, ppPixelShader: *mut *mut ID3D11PixelShader, - ppClassInstances: *mut *mut ID3D11ClassInstance, pNumClassInstances: *mut UINT - ) -> (), - fn PSGetSamplers( - &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *mut *mut ID3D11SamplerState - ) -> (), - fn VSGetShader( - &mut self, ppVertexShader: *mut *mut ID3D11VertexShader, - ppClassInstances: *mut *mut ID3D11ClassInstance, pNumClassInstances: *mut UINT - ) -> (), - fn PSGetConstantBuffers( - &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *mut *mut ID3D11Buffer - ) -> (), - fn IAGetInputLayout(&mut self, ppInputLayout: *mut *mut ID3D11InputLayout) -> (), - fn IAGetVertexBuffers( - &mut self, StartSlot: UINT, NumBuffers: UINT, ppVertexBuffers: *mut *mut ID3D11Buffer, - pStrides: *mut UINT, pOffsets: *mut UINT - ) -> (), - fn IAGetIndexBuffer( - &mut self, pIndexBuffer: *mut *mut ID3D11Buffer, Format: *mut DXGI_FORMAT, - Offset: *mut UINT - ) -> (), - fn GSGetConstantBuffers( - &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *mut *mut ID3D11Buffer - ) -> (), - fn GSGetShader( - &mut self, ppGeometryShader: *mut *mut ID3D11GeometryShader, - ppClassInstances: *mut *mut ID3D11ClassInstance, pNumClassInstances: *mut UINT - ) -> (), - fn IAGetPrimitiveTopology(&mut self, pTopology: *mut D3D11_PRIMITIVE_TOPOLOGY) -> (), - fn VSGetShaderResources( - &mut self, StartSlot: UINT, NumViews: UINT, - ppShaderResourceViews: *mut *mut ID3D11ShaderResourceView - ) -> (), - fn VSGetSamplers( - &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *mut *mut ID3D11SamplerState - ) -> (), - fn GetPredication( - &mut self, ppPredicate: *mut *mut ID3D11Predicate, pPredicateValue: *mut BOOL - ) -> (), - fn GSGetShaderResources( - &mut self, StartSlot: UINT, NumViews: UINT, - ppShaderResourceViews: *mut *mut ID3D11ShaderResourceView - ) -> (), - fn GSGetSamplers( - &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *mut *mut ID3D11SamplerState - ) -> (), - fn OMGetRenderTargets( - &mut self, NumViews: UINT, ppRenderTargetViews: *mut *mut ID3D11RenderTargetView, - ppDepthStencilView: *mut *mut ID3D11DepthStencilView - ) -> (), - fn OMGetRenderTargetsAndUnorderedAccessViews( - &mut self, NumRTVs: UINT, ppRenderTargetViews: *mut *mut ID3D11RenderTargetView, - ppDepthStencilView: *mut *mut ID3D11DepthStencilView, UAVStartSlot: UINT, - ppUnorderedAccessViews: *mut *mut ID3D11UnorderedAccessView - ) -> (), - fn OMGetBlendState( - &mut self, ppBlendState: *mut *mut ID3D11BlendState, BlendFactor: &mut [FLOAT; 4], - pSampleMask: *mut UINT - ) -> (), - fn OMGetDepthStencilState( - &mut self, ppDepthStencilState: *mut *mut ID3D11DepthStencilState, pStencilRef: *mut UINT - ) -> (), - fn SOGetTargets(&mut self, NumBuffers: UINT, ppSOTargets: *mut *mut ID3D11Buffer) -> (), - fn RSGetState(&mut self, ppRasterizerState: *mut *mut ID3D11RasterizerState) -> (), - fn RSGetViewports(&mut self, pNumViewports: *mut UINT, pViewports: *mut D3D11_VIEWPORT) -> (), - fn RSGetScissorRects(&mut self, pNumRects: *mut UINT, pRects: *mut D3D11_RECT) -> (), - fn HSGetShaderResources( - &mut self, StartSlot: UINT, NumViews: UINT, - ppShaderResourceViews: *mut *mut ID3D11ShaderResourceView - ) -> (), - fn HSGetShader( - &mut self, ppHullShader: *mut *mut ID3D11HullShader, - ppClassInstances: *mut *mut ID3D11ClassInstance, pNumClassInstances: *mut UINT - ) -> (), - fn HSGetSamplers( - &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *mut *mut ID3D11SamplerState - ) -> (), - fn HSGetConstantBuffers( - &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *mut *mut ID3D11Buffer - ) -> (), - fn DSGetShaderResources( - &mut self, StartSlot: UINT, NumViews: UINT, - ppShaderResourceViews: *mut *mut ID3D11ShaderResourceView - ) -> (), - fn DSGetShader( - &mut self, ppDomainShader: *mut *mut ID3D11DomainShader, - ppClassInstances: *mut *mut ID3D11ClassInstance, pNumClassInstances: *mut UINT - ) -> (), - fn DSGetSamplers( - &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *mut *mut ID3D11SamplerState - ) -> (), - fn DSGetConstantBuffers( - &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *mut *mut ID3D11Buffer - ) -> (), - fn CSGetShaderResources( - &mut self, StartSlot: UINT, NumViews: UINT, - ppShaderResourceViews: *mut *mut ID3D11ShaderResourceView - ) -> (), - fn CSGetUnorderedAccessViews( - &mut self, StartSlot: UINT, NumUAVs: UINT, - ppUnorderedAccessViews: *mut *mut ID3D11UnorderedAccessView - ) -> (), - fn CSGetShader( - &mut self, ppComputeShader: *mut *mut ID3D11ComputeShader, - ppClassInstances: *mut *mut ID3D11ClassInstance, pNumClassInstances: *mut UINT - ) -> (), - fn CSGetSamplers( - &mut self, StartSlot: UINT, NumSamplers: UINT, ppSamplers: *mut *mut ID3D11SamplerState - ) -> (), - fn CSGetConstantBuffers( - &mut self, StartSlot: UINT, NumBuffers: UINT, ppConstantBuffers: *mut *mut ID3D11Buffer - ) -> (), - fn ClearState(&mut self) -> (), - fn Flush(&mut self) -> (), - fn GetType(&mut self) -> D3D11_DEVICE_CONTEXT_TYPE, - fn GetContextFlags(&mut self) -> UINT, - fn FinishCommandList( - &mut self, RestoreDeferredContextState: BOOL, ppCommandList: *mut *mut ID3D11CommandList - ) -> HRESULT -}} -STRUCT!{struct D3D11_VIDEO_DECODER_DESC { - Guid: GUID, - SampleWidth: UINT, - SampleHeight: UINT, - OutputFormat: DXGI_FORMAT, -}} -STRUCT!{struct D3D11_VIDEO_DECODER_CONFIG { - guidConfigBitstreamEncryption: GUID, - guidConfigMBcontrolEncryption: GUID, - guidConfigResidDiffEncryption: GUID, - ConfigBitstreamRaw: UINT, - ConfigMBcontrolRasterOrder: UINT, - ConfigResidDiffHost: UINT, - ConfigSpatialResid8: UINT, - ConfigResid8Subtraction: UINT, - ConfigSpatialHost8or9Clipping: UINT, - ConfigSpatialResidInterleaved: UINT, - ConfigIntraResidUnsigned: UINT, - ConfigResidDiffAccelerator: UINT, - ConfigHostInverseScan: UINT, - ConfigSpecificIDCT: UINT, - Config4GroupedCoefs: UINT, - ConfigMinRenderTargetBuffCount: USHORT, - ConfigDecoderSpecific: USHORT, -}} -ENUM!{enum D3D11_VIDEO_DECODER_BUFFER_TYPE { - D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERS = 0, - D3D11_VIDEO_DECODER_BUFFER_MACROBLOCK_CONTROL = 1, - D3D11_VIDEO_DECODER_BUFFER_RESIDUAL_DIFFERENCE = 2, - D3D11_VIDEO_DECODER_BUFFER_DEBLOCKING_CONTROL = 3, - D3D11_VIDEO_DECODER_BUFFER_INVERSE_QUANTIZATION_MATRIX = 4, - D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL = 5, - D3D11_VIDEO_DECODER_BUFFER_BITSTREAM = 6, - D3D11_VIDEO_DECODER_BUFFER_MOTION_VECTOR = 7, - D3D11_VIDEO_DECODER_BUFFER_FILM_GRAIN = 8, -}} -STRUCT!{struct D3D11_AES_CTR_IV { - IV: UINT64, - Count: UINT64, -}} -STRUCT!{struct D3D11_ENCRYPTED_BLOCK_INFO { - NumEncryptedBytesAtBeginning: UINT, - NumBytesInSkipPattern: UINT, - NumBytesInEncryptPattern: UINT, -}} -STRUCT!{struct D3D11_VIDEO_DECODER_BUFFER_DESC { - BufferType: D3D11_VIDEO_DECODER_BUFFER_TYPE, - BufferIndex: UINT, - DataOffset: UINT, - DataSize: UINT, - FirstMBaddress: UINT, - NumMBsInBuffer: UINT, - Width: UINT, - Height: UINT, - Stride: UINT, - ReservedBits: UINT, - pIV: *mut c_void, - IVSize: UINT, - PartialEncryption: BOOL, - EncryptedBlockInfo: D3D11_ENCRYPTED_BLOCK_INFO, -}} -STRUCT!{struct D3D11_VIDEO_DECODER_EXTENSION { - Function: UINT, - pPrivateInputData: *mut c_void, - PrivateInputDataSize: UINT, - pPrivateOutputData: *mut c_void, - PrivateOutputDataSize: UINT, - ResourceCount: UINT, - ppResourceList: *mut *mut ID3D11Resource, -}} -RIDL!{interface ID3D11VideoDecoder(ID3D11VideoDecoderVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { - fn GetCreationParameters( - &mut self, pVideoDesc: *mut D3D11_VIDEO_DECODER_DESC, - pConfig: *mut D3D11_VIDEO_DECODER_CONFIG - ) -> HRESULT, - fn GetDriverHandle(&mut self, pDriverHandle: *mut HANDLE) -> HRESULT -}} -FLAGS!{enum D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT { - D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_INPUT = 0x1, - D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_OUTPUT = 0x2, -}} -FLAGS!{enum D3D11_VIDEO_PROCESSOR_DEVICE_CAPS { - D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_LINEAR_SPACE = 0x1, - D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_xvYCC = 0x2, - D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_RGB_RANGE_CONVERSION = 0x4, - D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_YCbCr_MATRIX_CONVERSION = 0x8, - D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_NOMINAL_RANGE = 0x10, -}} -FLAGS!{enum D3D11_VIDEO_PROCESSOR_FEATURE_CAPS { - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_FILL = 0x1, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_CONSTRICTION = 0x2, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_LUMA_KEY = 0x4, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_PALETTE = 0x8, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_LEGACY = 0x10, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_STEREO = 0x20, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ROTATION = 0x40, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_STREAM = 0x80, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_PIXEL_ASPECT_RATIO = 0x100, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_MIRROR = 0x200, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_SHADER_USAGE = 0x400, -}} -FLAGS!{enum D3D11_VIDEO_PROCESSOR_FILTER_CAPS { - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_BRIGHTNESS = 0x1, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_CONTRAST = 0x2, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_HUE = 0x4, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_SATURATION = 0x8, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_NOISE_REDUCTION = 0x10, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_EDGE_ENHANCEMENT = 0x20, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_ANAMORPHIC_SCALING = 0x40, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_STEREO_ADJUSTMENT = 0x80, -}} -FLAGS!{enum D3D11_VIDEO_PROCESSOR_FORMAT_CAPS { - D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_INTERLACED = 0x1, - D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_PROCAMP = 0x2, - D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_LUMA_KEY = 0x4, - D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_PALETTE_INTERLACED = 0x8, -}} -FLAGS!{enum D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS { - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_DENOISE = 0x1, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_DERINGING = 0x2, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_EDGE_ENHANCEMENT = 0x4, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_COLOR_CORRECTION = 0x8, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_FLESH_TONE_MAPPING = 0x10, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_IMAGE_STABILIZATION = 0x20, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_SUPER_RESOLUTION = 0x40, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_ANAMORPHIC_SCALING = 0x80, -}} -FLAGS!{enum D3D11_VIDEO_PROCESSOR_STEREO_CAPS { - D3D11_VIDEO_PROCESSOR_STEREO_CAPS_MONO_OFFSET = 0x1, - D3D11_VIDEO_PROCESSOR_STEREO_CAPS_ROW_INTERLEAVED = 0x2, - D3D11_VIDEO_PROCESSOR_STEREO_CAPS_COLUMN_INTERLEAVED = 0x4, - D3D11_VIDEO_PROCESSOR_STEREO_CAPS_CHECKERBOARD = 0x8, - D3D11_VIDEO_PROCESSOR_STEREO_CAPS_FLIP_MODE = 0x10, -}} -STRUCT!{struct D3D11_VIDEO_PROCESSOR_CAPS { - DeviceCaps: UINT, - FeatureCaps: UINT, - FilterCaps: UINT, - InputFormatCaps: UINT, - AutoStreamCaps: UINT, - StereoCaps: UINT, - RateConversionCapsCount: UINT, - MaxInputStreams: UINT, - MaxStreamStates: UINT, -}} -FLAGS!{enum D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS { - D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BLEND = 0x1, - D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BOB = 0x2, - D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_ADAPTIVE = 0x4, - D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_MOTION_COMPENSATION = 0x8, - D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_INVERSE_TELECINE = 0x10, - D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_FRAME_RATE_CONVERSION = 0x20, -}} -FLAGS!{enum D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS { - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_32 = 0x1, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_22 = 0x2, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_2224 = 0x4, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_2332 = 0x8, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_32322 = 0x10, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_55 = 0x20, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_64 = 0x40, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_87 = 0x80, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_222222222223 = 0x100, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_OTHER = 0x80000000, -}} -STRUCT!{struct D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS { - PastFrames: UINT, - FutureFrames: UINT, - ProcessorCaps: UINT, - ITelecineCaps: UINT, - CustomRateCount: UINT, -}} -FLAGS!{enum D3D11_CONTENT_PROTECTION_CAPS { - D3D11_CONTENT_PROTECTION_CAPS_SOFTWARE = 0x1, - D3D11_CONTENT_PROTECTION_CAPS_HARDWARE = 0x2, - D3D11_CONTENT_PROTECTION_CAPS_PROTECTION_ALWAYS_ON = 0x4, - D3D11_CONTENT_PROTECTION_CAPS_PARTIAL_DECRYPTION = 0x8, - D3D11_CONTENT_PROTECTION_CAPS_CONTENT_KEY = 0x10, - D3D11_CONTENT_PROTECTION_CAPS_FRESHEN_SESSION_KEY = 0x20, - D3D11_CONTENT_PROTECTION_CAPS_ENCRYPTED_READ_BACK = 0x40, - D3D11_CONTENT_PROTECTION_CAPS_ENCRYPTED_READ_BACK_KEY = 0x80, - D3D11_CONTENT_PROTECTION_CAPS_SEQUENTIAL_CTR_IV = 0x100, - D3D11_CONTENT_PROTECTION_CAPS_ENCRYPT_SLICEDATA_ONLY = 0x200, - D3D11_CONTENT_PROTECTION_CAPS_DECRYPTION_BLT = 0x400, - D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_PROTECT_UNCOMPRESSED = 0x800, - D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_PROTECTED_MEMORY_PAGEABLE = 0x1000, - D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_TEARDOWN = 0x2000, - D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_DRM_COMMUNICATION = 0x4000, -}} -STRUCT!{struct D3D11_VIDEO_CONTENT_PROTECTION_CAPS { - Caps: UINT, - KeyExchangeTypeCount: UINT, - BlockAlignmentSize: UINT, - ProtectedMemorySize: ULONGLONG, -}} -STRUCT!{struct D3D11_VIDEO_PROCESSOR_CUSTOM_RATE { - CustomRate: DXGI_RATIONAL, - OutputFrames: UINT, - InputInterlaced: BOOL, - InputFramesOrFields: UINT, -}} -ENUM!{enum D3D11_VIDEO_PROCESSOR_FILTER { - D3D11_VIDEO_PROCESSOR_FILTER_BRIGHTNESS = 0, - D3D11_VIDEO_PROCESSOR_FILTER_CONTRAST = 1, - D3D11_VIDEO_PROCESSOR_FILTER_HUE = 2, - D3D11_VIDEO_PROCESSOR_FILTER_SATURATION = 3, - D3D11_VIDEO_PROCESSOR_FILTER_NOISE_REDUCTION = 4, - D3D11_VIDEO_PROCESSOR_FILTER_EDGE_ENHANCEMENT = 5, - D3D11_VIDEO_PROCESSOR_FILTER_ANAMORPHIC_SCALING = 6, - D3D11_VIDEO_PROCESSOR_FILTER_STEREO_ADJUSTMENT = 7, -}} -STRUCT!{struct D3D11_VIDEO_PROCESSOR_FILTER_RANGE { - Minimum: c_int, - Maximum: c_int, - Default: c_int, - Multiplier: c_float, -}} -ENUM!{enum D3D11_VIDEO_FRAME_FORMAT { - D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE = 0, - D3D11_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST = 1, - D3D11_VIDEO_FRAME_FORMAT_INTERLACED_BOTTOM_FIELD_FIRST = 2, -}} -ENUM!{enum D3D11_VIDEO_USAGE { - D3D11_VIDEO_USAGE_PLAYBACK_NORMAL = 0, - D3D11_VIDEO_USAGE_OPTIMAL_SPEED = 1, - D3D11_VIDEO_USAGE_OPTIMAL_QUALITY = 2, -}} -STRUCT!{struct D3D11_VIDEO_PROCESSOR_CONTENT_DESC { - InputFrameFormat: D3D11_VIDEO_FRAME_FORMAT, - InputFrameRate: DXGI_RATIONAL, - InputWidth: UINT, - InputHeight: UINT, - OutputFrameRate: DXGI_RATIONAL, - OutputWidth: UINT, - OutputHeight: UINT, - Usage: D3D11_VIDEO_USAGE, -}} -RIDL!{interface ID3D11VideoProcessorEnumerator(ID3D11VideoProcessorEnumeratorVtbl) - : ID3D11DeviceChild(ID3D11DeviceChildVtbl) { - fn GetVideoProcessorContentDesc( - &mut self, pContentDesc: *mut D3D11_VIDEO_PROCESSOR_CONTENT_DESC - ) -> HRESULT, - fn CheckVideoProcessorFormat(&mut self, Format: DXGI_FORMAT, pFlags: *mut UINT) -> HRESULT, - fn GetVideoProcessorCaps(&mut self, pCaps: *mut D3D11_VIDEO_PROCESSOR_CAPS) -> HRESULT, - fn GetVideoProcessorRateConversionCaps( - &mut self, TypeIndex: UINT, pCaps: *mut D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS - ) -> HRESULT, - fn GetVideoProcessorCustomRate( - &mut self, TypeIndex: UINT, CustomRateIndex: UINT, - pRate: *mut D3D11_VIDEO_PROCESSOR_CUSTOM_RATE - ) -> HRESULT, - fn GetVideoProcessorFilterRange( - &mut self, Filter: D3D11_VIDEO_PROCESSOR_FILTER, - Range: *mut D3D11_VIDEO_PROCESSOR_FILTER_RANGE - ) -> HRESULT -}} -STRUCT!{struct D3D11_VIDEO_COLOR_RGBA { - R: c_float, - G: c_float, - B: c_float, - A: c_float, -}} -STRUCT!{struct D3D11_VIDEO_COLOR_YCbCrA { - Y: c_float, - Cb: c_float, - Cr: c_float, - A: c_float, -}} -STRUCT!{struct D3D11_VIDEO_COLOR { - u: [c_float; 4], -}} -UNION!{D3D11_VIDEO_COLOR, u, YCbCr, YCbCr_mut, D3D11_VIDEO_COLOR_YCbCrA} -UNION!{D3D11_VIDEO_COLOR, u, RGBA, RGBA_mut, D3D11_VIDEO_COLOR_RGBA} -ENUM!{enum D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE { - D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_UNDEFINED = 0, - D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_16_235 = 1, - D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_0_255 = 2, -}} -STRUCT!{struct D3D11_VIDEO_PROCESSOR_COLOR_SPACE { - bitfield: UINT, -}} -BITFIELD!{D3D11_VIDEO_PROCESSOR_COLOR_SPACE bitfield: UINT [ - Usage set_Usage[0..1], - RGB_Range set_RGB_Range[1..2], - YCbCr_Matrix set_YCbCr_Matrix[2..3], - YCbCr_xvYCC set_YCbCr_xvYCC[3..4], - Nominal_Range set_Nominal_Range[4..6], -]} -ENUM!{enum D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE { - D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_OPAQUE = 0, - D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_BACKGROUND = 1, - D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_DESTINATION = 2, - D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_SOURCE_STREAM = 3, -}} -ENUM!{enum D3D11_VIDEO_PROCESSOR_OUTPUT_RATE { - D3D11_VIDEO_PROCESSOR_OUTPUT_RATE_NORMAL = 0, - D3D11_VIDEO_PROCESSOR_OUTPUT_RATE_HALF = 1, - D3D11_VIDEO_PROCESSOR_OUTPUT_RATE_CUSTOM = 2, -}} -ENUM!{enum D3D11_VIDEO_PROCESSOR_STEREO_FORMAT { - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_MONO = 0, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_HORIZONTAL = 1, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_VERTICAL = 2, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_SEPARATE = 3, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_MONO_OFFSET = 4, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_ROW_INTERLEAVED = 5, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_COLUMN_INTERLEAVED = 6, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_CHECKERBOARD = 7, -}} -ENUM!{enum D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE { - D3D11_VIDEO_PROCESSOR_STEREO_FLIP_NONE = 0, - D3D11_VIDEO_PROCESSOR_STEREO_FLIP_FRAME0 = 1, - D3D11_VIDEO_PROCESSOR_STEREO_FLIP_FRAME1 = 2, -}} -ENUM!{enum D3D11_VIDEO_PROCESSOR_ROTATION { - D3D11_VIDEO_PROCESSOR_ROTATION_IDENTITY = 0, - D3D11_VIDEO_PROCESSOR_ROTATION_90 = 1, - D3D11_VIDEO_PROCESSOR_ROTATION_180 = 2, - D3D11_VIDEO_PROCESSOR_ROTATION_270 = 3, -}} -STRUCT!{struct D3D11_VIDEO_PROCESSOR_STREAM { - Enable: BOOL, - OutputIndex: UINT, - InputFrameOrField: UINT, - PastFrames: UINT, - FutureFrames: UINT, - ppPastSurfaces: *mut *mut ID3D11VideoProcessorInputView, - pInputSurface: *mut ID3D11VideoProcessorInputView, - ppFutureSurfaces: *mut *mut ID3D11VideoProcessorInputView, - ppPastSurfacesRight: *mut *mut ID3D11VideoProcessorInputView, - pInputSurfaceRight: *mut ID3D11VideoProcessorInputView, - ppFutureSurfacesRight: *mut *mut ID3D11VideoProcessorInputView, -}} -RIDL!{interface ID3D11VideoProcessor(ID3D11VideoProcessorVtbl) - : ID3D11DeviceChild(ID3D11DeviceChildVtbl) { - fn GetContentDesc(&mut self, pDesc: *mut D3D11_VIDEO_PROCESSOR_CONTENT_DESC) -> (), - fn GetRateConversionCaps( - &mut self, pCaps: *mut D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS - ) -> () -}} -STRUCT!{struct D3D11_OMAC { - Omac: [BYTE; 16], -}} -ENUM!{enum D3D11_AUTHENTICATED_CHANNEL_TYPE { - D3D11_AUTHENTICATED_CHANNEL_D3D11 = 1, - D3D11_AUTHENTICATED_CHANNEL_DRIVER_SOFTWARE = 2, - D3D11_AUTHENTICATED_CHANNEL_DRIVER_HARDWARE = 3, -}} -RIDL!{interface ID3D11AuthenticatedChannel(ID3D11AuthenticatedChannelVtbl) - : ID3D11DeviceChild(ID3D11DeviceChildVtbl) { - fn GetCertificateSize(&mut self, pCertificateSize: *mut UINT) -> HRESULT, - fn GetCertificate(&mut self, CertificateSize: UINT, pCertificate: *mut BYTE) -> HRESULT, - fn GetChannelHandle(&mut self, pChannelHandle: *mut HANDLE) -> () -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_INPUT { - QueryType: GUID, - hChannel: HANDLE, - SequenceNumber: UINT, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_OUTPUT { - omac: D3D11_OMAC, - QueryType: GUID, - hChannel: HANDLE, - SequenceNumber: UINT, - ReturnCode: HRESULT, -}} -//FIXME bitfield -STRUCT!{struct D3D11_AUTHENTICATED_PROTECTION_FLAGS { - u: UINT, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_PROTECTION_OUTPUT { - Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, - ProtectionFlags: D3D11_AUTHENTICATED_PROTECTION_FLAGS, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_CHANNEL_TYPE_OUTPUT { - Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, - ChannelType: D3D11_AUTHENTICATED_CHANNEL_TYPE, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_DEVICE_HANDLE_OUTPUT { - Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, - DeviceHandle: HANDLE, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_CRYPTO_SESSION_INPUT { - Input: D3D11_AUTHENTICATED_QUERY_INPUT, - DecoderHandle: HANDLE, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_CRYPTO_SESSION_OUTPUT { - Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, - DecoderHandle: HANDLE, - CryptoSessionHandle: HANDLE, - DeviceHandle: HANDLE, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_RESTRICTED_SHARED_RESOURCE_PROCESS_COUNT_OUTPUT { - Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, - RestrictedSharedResourceProcessCount: UINT, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_RESTRICTED_SHARED_RESOURCE_PROCESS_INPUT { - Input: D3D11_AUTHENTICATED_QUERY_INPUT, - ProcessIndex: UINT, -}} -ENUM!{enum D3D11_AUTHENTICATED_PROCESS_IDENTIFIER_TYPE { - DD3D11_PROCESSIDTYPE_UNKNOWN = 0, - DD3D11_PROCESSIDTYPE_DWM = 1, - DD3D11_PROCESSIDTYPE_HANDLE = 2, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_RESTRICTED_SHARED_RESOURCE_PROCESS_OUTPUT { - Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, - ProcessIndex: UINT, - ProcessIdentifier: D3D11_AUTHENTICATED_PROCESS_IDENTIFIER_TYPE, - ProcessHandle: HANDLE, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_UNRESTRICTED_PROTECTED_SHARED_RESOURCE_COUNT_OUTPUT { - Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, - UnrestrictedProtectedSharedResourceCount: UINT, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_OUTPUT_ID_COUNT_INPUT { - Input: D3D11_AUTHENTICATED_QUERY_INPUT, - DeviceHandle: HANDLE, - CryptoSessionHandle: HANDLE, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_OUTPUT_ID_COUNT_OUTPUT { - Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, - DeviceHandle: HANDLE, - CryptoSessionHandle: HANDLE, - OutputIDCount: UINT, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_OUTPUT_ID_INPUT { - Input: D3D11_AUTHENTICATED_QUERY_INPUT, - DeviceHandle: HANDLE, - CryptoSessionHandle: HANDLE, - OutputIDIndex: UINT, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_OUTPUT_ID_OUTPUT { - Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, - DeviceHandle: HANDLE, - CryptoSessionHandle: HANDLE, - OutputIDIndex: UINT, - OutputID: UINT64, -}} -ENUM!{enum D3D11_BUS_TYPE { - D3D11_BUS_TYPE_OTHER = 0, - D3D11_BUS_TYPE_PCI = 0x1, - D3D11_BUS_TYPE_PCIX = 0x2, - D3D11_BUS_TYPE_PCIEXPRESS = 0x3, - D3D11_BUS_TYPE_AGP = 0x4, - D3D11_BUS_IMPL_MODIFIER_INSIDE_OF_CHIPSET = 0x10000, - D3D11_BUS_IMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_CHIP = 0x20000, - D3D11_BUS_IMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_SOCKET = 0x30000, - D3D11_BUS_IMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR = 0x40000, - D3D11_BUS_IMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR_INSIDE_OF_NUAE = 0x50000, - D3D11_BUS_IMPL_MODIFIER_NON_STANDARD = 0x80000000, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_ACESSIBILITY_OUTPUT { - Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, - BusType: D3D11_BUS_TYPE, - AccessibleInContiguousBlocks: BOOL, - AccessibleInNonContiguousBlocks: BOOL, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_ACCESSIBILITY_ENCRYPTION_GUID_COUNT_OUTPUT { - Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, - EncryptionGuidCount: UINT, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_ACCESSIBILITY_ENCRYPTION_GUID_INPUT { - Input: D3D11_AUTHENTICATED_QUERY_INPUT, - EncryptionGuidIndex: UINT, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_ACCESSIBILITY_ENCRYPTION_GUID_OUTPUT { - Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, - EncryptionGuidIndex: UINT, - EncryptionGuid: GUID, -}} -STRUCT!{struct D3D11_AUTHENTICATED_QUERY_CURRENT_ACCESSIBILITY_ENCRYPTION_OUTPUT { - Output: D3D11_AUTHENTICATED_QUERY_OUTPUT, - EncryptionGuid: GUID, -}} -STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_INPUT { - omac: D3D11_OMAC, - ConfigureType: GUID, - hChannel: HANDLE, - SequenceNumber: UINT, -}} -STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_OUTPUT { - omac: D3D11_OMAC, - ConfigureType: GUID, - hChannel: HANDLE, - SequenceNumber: UINT, - ReturnCode: HRESULT, -}} -STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_INITIALIZE_INPUT { - Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT, - StartSequenceQuery: UINT, - StartSequenceConfigure: UINT, -}} -STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_PROTECTION_INPUT { - Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT, - Protections: D3D11_AUTHENTICATED_PROTECTION_FLAGS, -}} -STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_CRYPTO_SESSION_INPUT { - Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT, - DecoderHandle: HANDLE, - CryptoSessionHandle: HANDLE, - DeviceHandle: HANDLE, -}} -STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_SHARED_RESOURCE_INPUT { - Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT, - ProcessType: D3D11_AUTHENTICATED_PROCESS_IDENTIFIER_TYPE, - ProcessHandle: HANDLE, - AllowAccess: BOOL, -}} -STRUCT!{struct D3D11_AUTHENTICATED_CONFIGURE_ACCESSIBLE_ENCRYPTION_INPUT { - Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT, - EncryptionGuid: GUID, -}} -RIDL!{interface ID3D11CryptoSession(ID3D11CryptoSessionVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { - fn GetCryptoType(&mut self, pCryptoType: *mut GUID) -> (), - fn GetDecoderProfile(&mut self, pDecoderProfile: *mut GUID) -> (), - fn GetCertificateSize(&mut self, pCertificateSize: *mut UINT) -> HRESULT, - fn GetCertificate(&mut self, CertificateSize: UINT, pCertificate: *mut BYTE) -> HRESULT, - fn GetCryptoSessionHandle(&mut self, pCertificate: *mut HANDLE) -> () -}} -ENUM!{enum D3D11_VDOV_DIMENSION { - D3D11_VDOV_DIMENSION_UNKNOWN = 0, - D3D11_VDOV_DIMENSION_TEXTURE2D = 1, -}} -STRUCT!{struct D3D11_TEX2D_VDOV { - ArraySlice: UINT, -}} -STRUCT!{struct D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC { - DecodeProfile: GUID, - ViewDimension: D3D11_VDOV_DIMENSION, - Texture2D: D3D11_TEX2D_VDOV, -}} -RIDL!{interface ID3D11VideoDecoderOutputView(ID3D11VideoDecoderOutputViewVtbl) - : ID3D11View(ID3D11ViewVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC) -> () -}} -ENUM!{enum D3D11_VPIV_DIMENSION { - D3D11_VPIV_DIMENSION_UNKNOWN = 0, - D3D11_VPIV_DIMENSION_TEXTURE2D = 1, -}} -STRUCT!{struct D3D11_TEX2D_VPIV { - MipSlice: UINT, - ArraySlice: UINT, -}} -STRUCT!{struct D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC { - FourCC: UINT, - ViewDimension: D3D11_VPIV_DIMENSION, - Texture2D: D3D11_TEX2D_VPIV, -}} -RIDL!{interface ID3D11VideoProcessorInputView(ID3D11VideoProcessorInputViewVtbl) - : ID3D11View(ID3D11ViewVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC) -> () -}} -ENUM!{enum D3D11_VPOV_DIMENSION { - D3D11_VPOV_DIMENSION_UNKNOWN = 0, - D3D11_VPOV_DIMENSION_TEXTURE2D = 1, - D3D11_VPOV_DIMENSION_TEXTURE2DARRAY = 2, -}} -STRUCT!{struct D3D11_TEX2D_VPOV { - MipSlice: UINT, -}} -STRUCT!{struct D3D11_TEX2D_ARRAY_VPOV { - MipSlice: UINT, - FirstArraySlice: UINT, - ArraySize: UINT, -}} -STRUCT!{struct D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC { - ViewDimension: D3D11_VPOV_DIMENSION, - u: [UINT; 3], -}} -UNION!{D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC, u, Texture2D, Texture2D_mut, D3D11_TEX2D_VPOV} -UNION!{D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC, u, Texture2DArray, Texture2DArray_mut, - D3D11_TEX2D_ARRAY_VPOV} -RIDL!{interface ID3D11VideoProcessorOutputView(ID3D11VideoProcessorOutputViewVtbl) - : ID3D11View(ID3D11ViewVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC) -> () -}} -RIDL!{interface ID3D11VideoContext(ID3D11VideoContextVtbl): ID3D11DeviceChild(ID3D11DeviceChildVtbl) { - fn GetDecoderBuffer( - &mut self, pDecoder: *mut ID3D11VideoDecoder, Type: D3D11_VIDEO_DECODER_BUFFER_TYPE, - pBufferSize: *mut UINT, ppBuffer: *mut *mut c_void - ) -> HRESULT, - fn ReleaseDecoderBuffer( - &mut self, pDecoder: *mut ID3D11VideoDecoder, Type: D3D11_VIDEO_DECODER_BUFFER_TYPE - ) -> HRESULT, - fn DecoderBeginFrame( - &mut self, pDecoder: *mut ID3D11VideoDecoder, pView: *mut ID3D11VideoDecoderOutputView, - ContentKeySize: UINT, pContentKey: *const c_void - ) -> HRESULT, - fn DecoderEndFrame(&mut self, pDecoder: *mut ID3D11VideoDecoder) -> HRESULT, - fn SubmitDecoderBuffers( - &mut self, pDecoder: *mut ID3D11VideoDecoder, NumBuffers: UINT, - pBufferDesc: *const D3D11_VIDEO_DECODER_BUFFER_DESC - ) -> HRESULT, - fn DecoderExtension( - &mut self, pDecoder: *mut ID3D11VideoDecoder, - pExtensionData: *const D3D11_VIDEO_DECODER_EXTENSION - ) -> HRESULT, - fn VideoProcessorSetOutputTargetRect( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, Enable: BOOL, pRect: *const RECT - ) -> (), - fn VideoProcessorSetOutputBackgroundColor( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, YCbCr: BOOL, pRect: *const RECT - ) -> (), - fn VideoProcessorSetOutputColorSpace( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, - pColorSpace: *const D3D11_VIDEO_PROCESSOR_COLOR_SPACE - ) -> HRESULT, - fn VideoProcessorSetOutputAlphaFillMode( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, - AlphaFillMode: D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE, StreamIndex: UINT - ) -> (), - fn VideoProcessorSetOutputConstriction( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, Enable: BOOL, Size: SIZE - ) -> (), - fn VideoProcessorSetOutputStereoMode( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, Enable: BOOL - ) -> (), - fn VideoProcessorSetOutputExtension( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, pExtensionGuid: *const GUID, - DataSize: UINT, pData: *mut c_void - ) -> HRESULT, - fn VideoProcessorGetOutputTargetRect( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, Enabled: *mut BOOL, pRect: *mut RECT - ) -> (), - fn VideoProcessorGetOutputBackgroundColor( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, pYCbCr: *mut BOOL, - pColor: *mut D3D11_VIDEO_COLOR - ) -> (), - fn VideoProcessorGetOutputColorSpace( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, - pColorSpace: *mut D3D11_VIDEO_PROCESSOR_COLOR_SPACE - ) -> (), - fn VideoProcessorGetOutputAlphaFillMode( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, - pAlphaFillMode: *mut D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE, pStreamIndex: *mut UINT - ) -> (), - fn VideoProcessorGetOutputConstriction( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, pEnabled: *mut BOOL, - pSize: *mut SIZE - ) -> (), - fn VideoProcessorGetOutputStereoMode( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, pEnabled: *mut BOOL - ) -> (), - fn VideoProcessorGetOutputExtension( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, pExtensionGuid: *const GUID, - DataSize: UINT, pData: *mut c_void - ) -> HRESULT, - fn VideoProcessorSetStreamFrameFormat( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, - FrameFormat: D3D11_VIDEO_FRAME_FORMAT - ) -> (), - fn VideoProcessorSetStreamColorSpace( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, - pColorSpace: *const D3D11_VIDEO_PROCESSOR_COLOR_SPACE - ) -> (), - fn VideoProcessorSetStreamOutputRate( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, - OutputRate: D3D11_VIDEO_PROCESSOR_OUTPUT_RATE, RepeatFrame: BOOL, - pCustomRate: *const DXGI_RATIONAL - ) -> (), - fn VideoProcessorSetStreamSourceRect( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Enable: BOOL, - pRect: *const RECT - ) -> (), - fn VideoProcessorSetStreamDestRect( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Enable: BOOL, - pRect: *const RECT - ) -> (), - fn VideoProcessorSetStreamAlpha( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Enable: BOOL, - Alpha: FLOAT - ) -> (), - fn VideoProcessorSetStreamPalette( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Count: UINT, - pEntries: *const UINT - ) -> (), - fn VideoProcessorSetStreamPixelAspectRatio( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Enable: BOOL, - pSourceAspectRatio: *const DXGI_RATIONAL, pDestinationAspectRatio: *const DXGI_RATIONAL - ) -> (), - fn VideoProcessorSetStreamLumaKey( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Enable: BOOL, - Lower: FLOAT, Upper: FLOAT - ) -> (), - fn VideoProcessorSetStreamStereoFormat( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Enable: BOOL, - Format: D3D11_VIDEO_PROCESSOR_STEREO_FORMAT, LeftViewFrame0: BOOL, BaseViewFrame0: BOOL, - FlipMode: D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE - ) -> (), - fn VideoProcessorSetStreamAutoProcessingMode( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Enable: BOOL - ) -> (), - fn VideoProcessorSetStreamFilter( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, - Filter: D3D11_VIDEO_PROCESSOR_FILTER, Enable: BOOL, Level: c_int - ) -> (), - fn VideoProcessorSetStreamExtension( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, - pExtensionGuid: *const GUID, DataSize: UINT, pData: *mut c_void - ) -> HRESULT, - fn VideoProcessorGetStreamFrameFormat( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, - pFrameFormat: *mut D3D11_VIDEO_FRAME_FORMAT - ) -> (), - fn VideoProcessorGetStreamColorSpace( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, - pColorSpace: *mut D3D11_VIDEO_PROCESSOR_COLOR_SPACE - ) -> (), - fn VideoProcessorGetStreamOutputRate( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, - pOutputRate: *mut D3D11_VIDEO_PROCESSOR_OUTPUT_RATE, pRepeatFrame: *mut BOOL, - pCustomRate: *mut DXGI_RATIONAL - ) -> (), - fn VideoProcessorGetStreamSourceRect( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, - pEnabled: *mut BOOL, pRect: *mut RECT - ) -> (), - fn VideoProcessorGetStreamDestRect( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, - pEnabled: *mut BOOL, pRect: *mut RECT - ) -> (), - fn VideoProcessorGetStreamAlpha( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, - pEnabled: *mut BOOL, pAlpha: *mut FLOAT - ) -> (), - fn VideoProcessorGetStreamPalette( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Count: UINT, - pEntries: *mut UINT - ) -> (), - fn VideoProcessorGetStreamPixelAspectRatio( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, - pEnabled: *mut BOOL, pSourceAspectRatio: *mut DXGI_RATIONAL, - pDestinationAspectRatio: *mut DXGI_RATIONAL - ) -> (), - fn VideoProcessorGetStreamLumaKey( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, - pEnabled: *mut BOOL, pLower: *mut FLOAT, pUpper: *mut FLOAT - ) -> (), - fn VideoProcessorGetStreamStereoFormat( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, - pEnabled: *mut BOOL, pFormat: *mut D3D11_VIDEO_PROCESSOR_STEREO_FORMAT, - pLeftViewFrame0: *mut BOOL, pBaseViewFrame0: *mut BOOL, - pFlipMode: *mut D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE, MonoOffset: *mut c_int - ) -> (), - fn VideoProcessorGetStreamAutoProcessingMode( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, - pEnabled: *mut BOOL - ) -> (), - fn VideoProcessorGetStreamFilter( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, - Filter: D3D11_VIDEO_PROCESSOR_FILTER, pEnabled: *mut BOOL, pLevel: *mut c_int - ) -> (), - fn VideoProcessorGetStreamExtension( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, - pExtensionGuid: *const GUID, DataSize: UINT, pData: *mut c_void - ) -> HRESULT, - fn VideoProcessorBlt( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, - pView: *mut ID3D11VideoProcessorOutputView, OutputFrame: UINT, StreamCount: UINT, - pStreams: *const D3D11_VIDEO_PROCESSOR_STREAM - ) -> HRESULT, - fn NegotiateCryptoSessionKeyExchange( - &mut self, pCryptoSession: *mut ID3D11CryptoSession, DataSize: UINT, pData: *mut c_void - ) -> HRESULT, - fn EncryptionBlt( - &mut self, pCryptoSession: *mut ID3D11CryptoSession, pSrcSurface: *mut ID3D11Texture2D, - pDstSurface: *mut ID3D11Texture2D, IVSize: UINT, pIV: *mut c_void - ) -> HRESULT, - fn DecryptionBlt( - &mut self, pCryptoSession: *mut ID3D11CryptoSession, pSrcSurface: *mut ID3D11Texture2D, - pDstSurface: *mut ID3D11Texture2D, pEncryptedBlockInfo: *mut D3D11_ENCRYPTED_BLOCK_INFO, - ContentKeySize: UINT, pContentKey: *const c_void, IVSize: UINT, pIV: *mut c_void - ) -> HRESULT, - fn StartSessionKeyRefresh( - &mut self, pCryptoSession: *mut ID3D11CryptoSession, RandomNumberSize: UINT, - pRandomNumber: *mut c_void - ) -> HRESULT, - fn FinishSessionKeyRefresh(&mut self, pCryptoSession: *mut ID3D11CryptoSession) -> HRESULT, - fn GetEncryptionBltKey( - &mut self, pCryptoSession: *mut ID3D11CryptoSession, KeySize: UINT, - pReadbackKey: *mut c_void - ) -> HRESULT, - fn NegotiateAuthenticatedChannelKeyExchange( - &mut self, pChannel: *mut ID3D11AuthenticatedChannel, DataSize: UINT, pData: *mut c_void - ) -> HRESULT, - fn QueryAuthenticatedChannel( - &mut self, pChannel: *mut ID3D11AuthenticatedChannel, InputSize: UINT, - pInput: *const c_void, OutputSize: UINT, pOutput: *mut c_void - ) -> HRESULT, - fn ConfigureAuthenticatedChannel( - &mut self, pChannel: *mut ID3D11AuthenticatedChannel, InputSize: UINT, - pInput: *const c_void, pOutput: *mut D3D11_AUTHENTICATED_CONFIGURE_OUTPUT - ) -> HRESULT, - fn VideoProcessorSetStreamRotation( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, Enable: BOOL, - Rotation: D3D11_VIDEO_PROCESSOR_ROTATION - ) -> HRESULT, - fn VideoProcessorGetStreamRotation( - &mut self, pVideoProcessor: *mut ID3D11VideoProcessor, StreamIndex: UINT, - pEnable: *mut BOOL, pRotation: *mut D3D11_VIDEO_PROCESSOR_ROTATION - ) -> HRESULT -}} -RIDL!{interface ID3D11VideoDevice(ID3D11VideoDeviceVtbl): IUnknown(IUnknownVtbl) { - fn CreateVideoDecoder( - &mut self, pVideoDesc: *const D3D11_VIDEO_DECODER_DESC, - pConfig: *const D3D11_VIDEO_DECODER_CONFIG, ppDecoder: *mut *mut ID3D11VideoDecoder - ) -> HRESULT, - fn CreateVideoProcessor( - &mut self, pEnum: *mut ID3D11VideoProcessorEnumerator, RateConversionIndex: UINT, - ppVideoProcessor: *mut *mut ID3D11VideoProcessor - ) -> HRESULT, - fn CreateAuthenticatedChannel( - &mut self, ChannelType: D3D11_AUTHENTICATED_CHANNEL_TYPE, - ppAuthenticatedChannel: *mut *mut ID3D11AuthenticatedChannel - ) -> HRESULT, - fn CreateCryptoSession( - &mut self, pCryptoType: *const GUID, pDecoderProfile: *const GUID, - pKeyExchangeType: *const GUID, ppCryptoSession: *mut *mut ID3D11CryptoSession - ) -> HRESULT, - fn CreateVideoDecoderOutputView( - &mut self, pResource: *mut ID3D11Resource, - pDesc: *const D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC, - ppVDOVView: *mut *mut ID3D11VideoDecoderOutputView - ) -> HRESULT, - fn CreateVideoProcessorInputView( - &mut self, pResource: *mut ID3D11Resource, pEnum: *mut ID3D11VideoProcessorEnumerator, - pDesc: *const D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC, - ppVPIView: *mut *mut ID3D11VideoProcessorInputView - ) -> HRESULT, - fn CreateVideoProcessorOutputView( - &mut self, pResource: *mut ID3D11Resource, pEnum: *mut ID3D11VideoProcessorEnumerator, - pDesc: *const D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC, - ppVPOView: *mut *mut ID3D11VideoProcessorOutputView - ) -> HRESULT, - fn CreateVideoProcessorEnumerator( - &mut self, pDesc: *const D3D11_VIDEO_PROCESSOR_CONTENT_DESC, - ppEnum: *mut *mut ID3D11VideoProcessorEnumerator - ) -> HRESULT, - fn GetVideoDecoderProfileCount(&mut self) -> UINT, - fn GetVideoDecoderProfile(&mut self, Index: UINT, pDecoderProfile: *mut GUID) -> HRESULT, - fn CheckVideoDecoderFormat( - &mut self, pDecoderProfile: *const GUID, Format: DXGI_FORMAT, pSupported: *mut BOOL - ) -> HRESULT, - fn GetVideoDecoderConfigCount( - &mut self, pDesc: *const D3D11_VIDEO_DECODER_DESC, pCount: *mut UINT - ) -> HRESULT, - fn GetVideoDecoderConfig( - &mut self, pDesc: *const D3D11_VIDEO_DECODER_DESC, Index: UINT, - pConfig: *mut D3D11_VIDEO_DECODER_CONFIG - ) -> HRESULT, - fn GetContentProtectionCaps( - &mut self, pCryptoType: *const GUID, pDecoderProfile: *const GUID, - pCaps: *mut D3D11_VIDEO_CONTENT_PROTECTION_CAPS - ) -> HRESULT, - fn CheckCryptoKeyExchange( - &mut self, pCryptoType: *const GUID, pDecoderProfile: *const GUID, Index: UINT, - pKeyExchangeType: *mut GUID - ) -> HRESULT, - fn SetPrivateData( &mut self, guid: REFGUID, DataSize: UINT, pData: *const c_void) -> HRESULT, - fn SetPrivateDataInterface(&mut self, guid: REFGUID, pData: *const IUnknown) -> HRESULT -}} -RIDL!{interface ID3D11Device(ID3D11DeviceVtbl): IUnknown(IUnknownVtbl) { - fn CreateBuffer( - &mut self, pDesc: *const D3D11_BUFFER_DESC, pInitialData: *const D3D11_SUBRESOURCE_DATA, - ppBuffer: *mut *mut ID3D11Buffer - ) -> HRESULT, - fn CreateTexture1D( - &mut self, pDesc: *const D3D11_TEXTURE1D_DESC, pInitialData: *const D3D11_SUBRESOURCE_DATA, - ppTexture1D: *mut *mut ID3D11Texture1D - ) -> HRESULT, - fn CreateTexture2D( - &mut self, pDesc: *const D3D11_TEXTURE2D_DESC, pInitialData: *const D3D11_SUBRESOURCE_DATA, - ppTexture2D: *mut *mut ID3D11Texture2D - ) -> HRESULT, - fn CreateTexture3D( - &mut self, pDesc: *const D3D11_TEXTURE3D_DESC, pInitialData: *const D3D11_SUBRESOURCE_DATA, - ppTexture3D: *mut *mut ID3D11Texture3D - ) -> HRESULT, - fn CreateShaderResourceView( - &mut self, pResource: *mut ID3D11Resource, pDesc: *const D3D11_SHADER_RESOURCE_VIEW_DESC, - ppSRView: *mut *mut ID3D11ShaderResourceView - ) -> HRESULT, - fn CreateUnorderedAccessView( - &mut self, pResource: *mut ID3D11Resource, pDesc: *const D3D11_UNORDERED_ACCESS_VIEW_DESC, - ppUAView: *mut *mut ID3D11UnorderedAccessView - ) -> HRESULT, - fn CreateRenderTargetView( - &mut self, pResource: *mut ID3D11Resource, pDesc: *const D3D11_RENDER_TARGET_VIEW_DESC, - ppRTView: *mut *mut ID3D11RenderTargetView - ) -> HRESULT, - fn CreateDepthStencilView( - &mut self, pResource: *mut ID3D11Resource, pDesc: *const D3D11_DEPTH_STENCIL_VIEW_DESC, - ppDepthStencilView: *mut *mut ID3D11DepthStencilView - ) -> HRESULT, - fn CreateInputLayout( - &mut self, pInputElementDescs: *const D3D11_INPUT_ELEMENT_DESC, NumElements: UINT, - pShaderBytecodeWithInputSignature: *const c_void, BytecodeLength: SIZE_T, - ppInputLayout: *mut *mut ID3D11InputLayout - ) -> HRESULT, - fn CreateVertexShader( - &mut self, pShaderBytecode: *const c_void, BytecodeLength: SIZE_T, - pClassLinkage: *mut ID3D11ClassLinkage, ppVertexShader: *mut *mut ID3D11VertexShader - ) -> HRESULT, - fn CreateGeometryShader( - &mut self, pShaderBytecode: *const c_void, BytecodeLength: SIZE_T, - pClassLinkage: *mut ID3D11ClassLinkage, ppGeometryShader: *mut *mut ID3D11GeometryShader - ) -> HRESULT, - fn CreateGeometryShaderWithStreamOutput( - &mut self, pShaderBytecode: *const c_void, BytecodeLength: SIZE_T, - pSODeclaration: *const D3D11_SO_DECLARATION_ENTRY, NumEntries: UINT, - pBufferStrides: *const UINT, NumStrides: UINT, RasterizedStream: UINT, - pClassLinkage: *mut ID3D11ClassLinkage, ppGeometryShader: *mut *mut ID3D11GeometryShader - ) -> HRESULT, - fn CreatePixelShader( - &mut self, pShaderBytecode: *const c_void, BytecodeLength: SIZE_T, - pClassLinkage: *mut ID3D11ClassLinkage, ppPixelShader: *mut *mut ID3D11PixelShader - ) -> HRESULT, - fn CreateHullShader( - &mut self, pShaderBytecode: *const c_void, BytecodeLength: SIZE_T, - pClassLinkage: *mut ID3D11ClassLinkage, ppHullShader: *mut *mut ID3D11HullShader - ) -> HRESULT, - fn CreateDomainShader( - &mut self, pShaderBytecode: *const c_void, BytecodeLength: SIZE_T, - pClassLinkage: *mut ID3D11ClassLinkage, ppDomainShader: *mut *mut ID3D11DomainShader - ) -> HRESULT, - fn CreateComputeShader( - &mut self, pShaderBytecode: *const c_void, BytecodeLength: SIZE_T, - pClassLinkage: *mut ID3D11ClassLinkage, ppComputeShader: *mut *mut ID3D11ComputeShader - ) -> HRESULT, - fn CreateClassLinkage(&mut self, ppLinkage: *mut *mut ID3D11ClassLinkage) -> HRESULT, - fn CreateBlendState( - &mut self, pBlendStateDesc: *const D3D11_BLEND_DESC, - ppBlendState: *mut *mut ID3D11BlendState - ) -> HRESULT, - fn CreateDepthStencilState( - &mut self, pDepthStencilDesc: *const D3D11_DEPTH_STENCIL_DESC, - ppDepthStencilState: *mut *mut ID3D11DepthStencilState - ) -> HRESULT, - fn CreateRasterizerState( - &mut self, pRasterizerDesc: *const D3D11_RASTERIZER_DESC, - ppRasterizerState: *mut *mut ID3D11RasterizerState - ) -> HRESULT, - fn CreateSamplerState( - &mut self, pSamplerDesc: *const D3D11_SAMPLER_DESC, - ppSamplerState: *mut *mut ID3D11SamplerState - ) -> HRESULT, - fn CreateQuery( - &mut self, pQueryDesc: *const D3D11_QUERY_DESC, ppQuery: *mut *mut ID3D11Query - ) -> HRESULT, - fn CreatePredicate( - &mut self, pPredicateDesc: *const D3D11_QUERY_DESC, ppPredicate: *mut *mut ID3D11Predicate - ) -> HRESULT, - fn CreateCounter( - &mut self, pCounterDesc: *const D3D11_COUNTER_DESC, ppCounter: *mut *mut ID3D11Counter - ) -> HRESULT, - fn CreateDeferredContext( - &mut self, ContextFlags: UINT, ppDeferredContext: *mut *mut ID3D11DeviceContext - ) -> HRESULT, - fn OpenSharedResource( - &mut self, hResource: HANDLE, ReturnedInterface: REFIID, ppResource: *mut *mut c_void - ) -> HRESULT, - fn CheckFormatSupport( - &mut self, Format: DXGI_FORMAT, pFormatSupport: *mut UINT - ) -> HRESULT, - fn CheckMultisampleQualityLevels( - &mut self, Format: DXGI_FORMAT, SampleCount: UINT, pNumQualityLevels: *mut UINT - ) -> HRESULT, - fn CheckCounterInfo(&mut self, pCounterInfo: *mut D3D11_COUNTER_INFO) -> (), - fn CheckCounter( - &mut self, pDesc: *const D3D11_COUNTER_DESC, pType: *mut D3D11_COUNTER_TYPE, - pActiveCounters: *mut UINT, szName: LPSTR, pNameLength: *mut UINT, szUnits: LPSTR, - pUnitsLength: *mut UINT, szDescription: LPSTR, pDescriptionLength: *mut UINT - ) -> HRESULT, - fn CheckFeatureSupport( - &mut self, Feature: D3D11_FEATURE, pFeatureSupportData: *mut c_void, - FeatureSupportDataSize: UINT - ) -> HRESULT, - fn GetPrivateData( - &mut self, guid: REFGUID, pDataSize: *mut UINT, pData: *mut c_void - ) -> HRESULT, - fn SetPrivateData( - &mut self, guid: REFGUID, DataSize: UINT, pData: *const c_void - ) -> HRESULT, - fn SetPrivateDataInterface(&mut self, guid: REFGUID, pData: *const IUnknown) -> HRESULT, - fn GetFeatureLevel(&mut self) -> D3D_FEATURE_LEVEL, - fn GetCreationFlags(&mut self) -> UINT, - fn GetDeviceRemovedReason(&mut self) -> HRESULT, - fn GetImmediateContext(&mut self, ppImmediateContext: *mut *mut ID3D11DeviceContext) -> (), - fn SetExceptionMode(&mut self, RaiseFlags: UINT) -> HRESULT, - fn GetExceptionMode(&mut self) -> UINT -}} -FLAGS!{enum D3D11_CREATE_DEVICE_FLAG { - D3D11_CREATE_DEVICE_SINGLETHREADED = 0x1, - D3D11_CREATE_DEVICE_DEBUG = 0x2, - D3D11_CREATE_DEVICE_SWITCH_TO_REF = 0x4, - D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = 0x8, - D3D11_CREATE_DEVICE_BGRA_SUPPORT = 0x20, - D3D11_CREATE_DEVICE_DEBUGGABLE = 0x40, - D3D11_CREATE_DEVICE_PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY = 0x80, - D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT = 0x100, - D3D11_CREATE_DEVICE_VIDEO_SUPPORT = 0x800, -}} -pub const D3D11_SDK_VERSION: DWORD = 7; - -pub fn D3D11CalcSubresource(MipSlice: ::UINT, ArraySlice: ::UINT, MipLevels: ::UINT) -> ::UINT { - MipSlice + ArraySlice * MipLevels -} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/d3d11shader.rs cargo-0.37.0/vendor/winapi-0.2.8/src/d3d11shader.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/d3d11shader.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/d3d11shader.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,320 +0,0 @@ -// Copyright © 2016, Peter Atashian -// Licensed under the MIT License -use super::*; -ENUM!{enum D3D11_SHADER_VERSION_TYPE { - D3D11_SHVER_PIXEL_SHADER = 0, - D3D11_SHVER_VERTEX_SHADER = 1, - D3D11_SHVER_GEOMETRY_SHADER = 2, - D3D11_SHVER_HULL_SHADER = 3, - D3D11_SHVER_DOMAIN_SHADER = 4, - D3D11_SHVER_COMPUTE_SHADER = 5, - D3D11_SHVER_RESERVED0 = 0xFFF0, -}} -pub const D3D_RETURN_PARAMETER_INDEX: c_int = -1; -pub type D3D11_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE; -pub type D3D11_CBUFFER_TYPE = D3D_CBUFFER_TYPE; -STRUCT!{struct D3D11_SIGNATURE_PARAMETER_DESC { - SemanticName: LPCSTR, - SemanticIndex: UINT, - Register: UINT, - SystemValueType: D3D_NAME, - ComponentType: D3D_REGISTER_COMPONENT_TYPE, - Mask: BYTE, - ReadWriteMask: BYTE, - Stream: UINT, - MinPrecision: D3D_MIN_PRECISION, -}} -STRUCT!{struct D3D11_SHADER_BUFFER_DESC { - Name: LPCSTR, - Type: D3D_CBUFFER_TYPE, - Variables: UINT, - Size: UINT, - uFlags: UINT, -}} -STRUCT!{struct D3D11_SHADER_VARIABLE_DESC { - Name: LPCSTR, - StartOffset: UINT, - Size: UINT, - uFlags: UINT, - DefaultValue: LPVOID, - StartTexture: UINT, - TextureSize: UINT, - StartSampler: UINT, - SamplerSize: UINT, -}} -STRUCT!{struct D3D11_SHADER_TYPE_DESC { - Class: D3D_SHADER_VARIABLE_CLASS, - Type: D3D_SHADER_VARIABLE_TYPE, - Rows: UINT, - Columns: UINT, - Elements: UINT, - Members: UINT, - Offset: UINT, - Name: LPCSTR, -}} -pub type D3D11_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN; -pub type D3D11_TESSELLATOR_PARTITIONING = D3D_TESSELLATOR_PARTITIONING; -pub type D3D11_TESSELLATOR_OUTPUT_PRIMITIVE = D3D_TESSELLATOR_OUTPUT_PRIMITIVE; -STRUCT!{struct D3D11_SHADER_DESC { - Version: UINT, - Creator: LPCSTR, - Flags: UINT, - ConstantBuffers: UINT, - BoundResources: UINT, - InputParameters: UINT, - OutputParameters: UINT, - InstructionCount: UINT, - TempRegisterCount: UINT, - TempArrayCount: UINT, - DefCount: UINT, - DclCount: UINT, - TextureNormalInstructions: UINT, - TextureLoadInstructions: UINT, - TextureCompInstructions: UINT, - TextureBiasInstructions: UINT, - TextureGradientInstructions: UINT, - FloatInstructionCount: UINT, - IntInstructionCount: UINT, - UintInstructionCount: UINT, - StaticFlowControlCount: UINT, - DynamicFlowControlCount: UINT, - MacroInstructionCount: UINT, - ArrayInstructionCount: UINT, - CutInstructionCount: UINT, - EmitInstructionCount: UINT, - GSOutputTopology: D3D_PRIMITIVE_TOPOLOGY, - GSMaxOutputVertexCount: UINT, - InputPrimitive: D3D_PRIMITIVE, - PatchConstantParameters: UINT, - cGSInstanceCount: UINT, - cControlPoints: UINT, - HSOutputPrimitive: D3D_TESSELLATOR_OUTPUT_PRIMITIVE, - HSPartitioning: D3D_TESSELLATOR_PARTITIONING, - TessellatorDomain: D3D_TESSELLATOR_DOMAIN, - cBarrierInstructions: UINT, - cInterlockedInstructions: UINT, - cTextureStoreInstructions: UINT, -}} -STRUCT!{struct D3D11_SHADER_INPUT_BIND_DESC { - Name: LPCSTR, - Type: D3D_SHADER_INPUT_TYPE, - BindPoint: UINT, - BindCount: UINT, - uFlags: UINT, - ReturnType: D3D_RESOURCE_RETURN_TYPE, - Dimension: D3D_SRV_DIMENSION, - NumSamples: UINT, -}} -pub const D3D_SHADER_REQUIRES_DOUBLES: UINT64 = 0x00000001; -pub const D3D_SHADER_REQUIRES_EARLY_DEPTH_STENCIL: UINT64 = 0x00000002; -pub const D3D_SHADER_REQUIRES_UAVS_AT_EVERY_STAGE: UINT64 = 0x00000004; -pub const D3D_SHADER_REQUIRES_64_UAVS: UINT64 = 0x00000008; -pub const D3D_SHADER_REQUIRES_MINIMUM_PRECISION: UINT64 = 0x00000010; -pub const D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS: UINT64 = 0x00000020; -pub const D3D_SHADER_REQUIRES_11_1_SHADER_EXTENSIONS: UINT64 = 0x00000040; -pub const D3D_SHADER_REQUIRES_LEVEL_9_COMPARISON_FILTERING: UINT64 = 0x00000080; -pub const D3D_SHADER_REQUIRES_TILED_RESOURCES: UINT64 = 0x00000100; -STRUCT!{struct D3D11_LIBRARY_DESC { - Creator: LPCSTR, - Flags: UINT, - FunctionCount: UINT, -}} -STRUCT!{struct D3D11_FUNCTION_DESC { - Version: UINT, - Creator: LPCSTR, - Flags: UINT, - ConstantBuffers: UINT, - BoundResources: UINT, - InstructionCount: UINT, - TempRegisterCount: UINT, - TempArrayCount: UINT, - DefCount: UINT, - DclCount: UINT, - TextureNormalInstructions: UINT, - TextureLoadInstructions: UINT, - TextureCompInstructions: UINT, - TextureBiasInstructions: UINT, - TextureGradientInstructions: UINT, - FloatInstructionCount: UINT, - IntInstructionCount: UINT, - UintInstructionCount: UINT, - StaticFlowControlCount: UINT, - DynamicFlowControlCount: UINT, - MacroInstructionCount: UINT, - ArrayInstructionCount: UINT, - MovInstructionCount: UINT, - MovcInstructionCount: UINT, - ConversionInstructionCount: UINT, - BitwiseInstructionCount: UINT, - MinFeatureLevel: D3D_FEATURE_LEVEL, - RequiredFeatureFlags: UINT64, - Name: LPCSTR, - FunctionParameterCount: INT, - HasReturn: BOOL, - Has10Level9VertexShader: BOOL, - Has10Level9PixelShader: BOOL, -}} -STRUCT!{struct D3D11_PARAMETER_DESC { - Name: LPCSTR, - SemanticName: LPCSTR, - Type: D3D_SHADER_VARIABLE_TYPE, - Class: D3D_SHADER_VARIABLE_CLASS, - Rows: UINT, - Columns: UINT, - InterpolationMode: D3D_INTERPOLATION_MODE, - Flags: D3D_PARAMETER_FLAGS, - FirstInRegister: UINT, - FirstInComponent: UINT, - FirstOutRegister: UINT, - FirstOutComponent: UINT, -}} -RIDL!{interface ID3D11ShaderReflectionType(ID3D11ShaderReflectionTypeVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_SHADER_TYPE_DESC) -> HRESULT, - fn GetMemberTypeByIndex(&mut self, Index: UINT) -> *mut ID3D11ShaderReflectionType, - fn GetMemberTypeByName(&mut self, Name: LPCSTR) -> *mut ID3D11ShaderReflectionType, - fn GetMemberTypeName(&mut self, Index: UINT) -> LPCSTR, - fn IsEqual(&mut self, pType: *mut ID3D11ShaderReflectionType) -> HRESULT, - fn GetSubType(&mut self) -> *mut ID3D11ShaderReflectionType, - fn GetBaseClass(&mut self) -> *mut ID3D11ShaderReflectionType, - fn GetNumInterfaces(&mut self) -> UINT, - fn GetInterfaceByIndex(&mut self, uIndex: UINT) -> *mut ID3D11ShaderReflectionType, - fn IsOfType(&mut self, pType: *mut ID3D11ShaderReflectionType) -> HRESULT, - fn ImplementsInterface(&mut self, pBase: *mut ID3D11ShaderReflectionType) -> HRESULT -}} -RIDL!{interface ID3D11ShaderReflectionVariable(ID3D11ShaderReflectionVariableVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_SHADER_VARIABLE_DESC) -> HRESULT, - fn GetType(&mut self) -> *mut ID3D11ShaderReflectionType, - fn GetBuffer(&mut self) -> *mut ID3D11ShaderReflectionConstantBuffer, - fn GetInterfaceSlot(&mut self, uArrayIndex: UINT) -> UINT -}} -RIDL!{interface ID3D11ShaderReflectionConstantBuffer(ID3D11ShaderReflectionConstantBufferVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_SHADER_BUFFER_DESC) -> HRESULT, - fn GetVariableByIndex(&mut self, Index: UINT) -> *mut ID3D11ShaderReflectionVariable, - fn GetVariableByName(&mut self, Name: LPCSTR) -> *mut ID3D11ShaderReflectionVariable -}} -RIDL!{interface ID3D11ShaderReflection(ID3D11ShaderReflectionVtbl): IUnknown(IUnknownVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_SHADER_DESC) -> HRESULT, - fn GetConstantBufferByIndex( - &mut self, Index: UINT - ) -> *mut ID3D11ShaderReflectionConstantBuffer, - fn GetConstantBufferByName( - &mut self, Name: LPCSTR - ) -> *mut ID3D11ShaderReflectionConstantBuffer, - fn GetResourceBindingDesc( - &mut self, ResourceIndex: UINT, pDesc: *mut D3D11_SHADER_INPUT_BIND_DESC - ) -> HRESULT, - fn GetInputParameterDesc( - &mut self, ParameterIndex: UINT, pDesc: *mut D3D11_SIGNATURE_PARAMETER_DESC - ) -> HRESULT, - fn GetOutputParameterDesc( - &mut self, ParameterIndex: UINT, pDesc: *mut D3D11_SIGNATURE_PARAMETER_DESC - ) -> HRESULT, - fn GetPatchConstantParameterDesc( - &mut self, ParameterIndex: UINT, pDesc: *mut D3D11_SIGNATURE_PARAMETER_DESC - ) -> HRESULT, - fn GetVariableByName(&mut self, Name: LPCSTR) -> *mut ID3D11ShaderReflectionVariable, - fn GetResourceBindingDescByName( - &mut self, Name: LPCSTR, pDesc: *mut D3D11_SHADER_INPUT_BIND_DESC - ) -> HRESULT, - fn GetMovInstructionCount(&mut self) -> UINT, - fn GetMovcInstructionCount(&mut self) -> UINT, - fn GetConversionInstructionCount(&mut self) -> UINT, - fn GetBitwiseInstructionCount(&mut self) -> UINT, - fn GetGSInputPrimitive(&mut self) -> D3D_PRIMITIVE, - fn IsSampleFrequencyShader(&mut self) -> BOOL, - fn GetNumInterfaceSlots(&mut self) -> UINT, - fn GetMinFeatureLevel(&mut self, pLevel: *mut D3D_FEATURE_LEVEL) -> HRESULT, - fn GetThreadGroupSize( - &mut self, pSizeX: *mut UINT, pSizeY: *mut UINT, pSizeZ: *mut UINT - ) -> UINT, - fn GetRequiresFlags(&mut self) -> UINT64 -}} -RIDL!{interface ID3D11LibraryReflection(ID3D11LibraryReflectionVtbl): IUnknown(IUnknownVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_LIBRARY_DESC) -> HRESULT, - fn GetFunctionByIndex(&mut self, FunctionIndex: INT) -> *mut ID3D11FunctionReflection -}} -RIDL!{interface ID3D11FunctionReflection(ID3D11FunctionReflectionVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_FUNCTION_DESC) -> HRESULT, - fn GetConstantBufferByIndex( - &mut self, BufferIndex: UINT - ) -> *mut ID3D11ShaderReflectionConstantBuffer, - fn GetConstantBufferByName( - &mut self, Name: LPCSTR - ) -> *mut ID3D11ShaderReflectionConstantBuffer, - fn GetResourceBindingDesc( - &mut self, ResourceIndex: UINT, pDesc: *mut D3D11_SHADER_INPUT_BIND_DESC - ) -> HRESULT, - fn GetVariableByName(&mut self, Name: LPCSTR) -> *mut ID3D11ShaderReflectionVariable, - fn GetResourceBindingDescByName( - &mut self, Name: LPCSTR, pDesc: *mut D3D11_SHADER_INPUT_BIND_DESC - ) -> HRESULT, - fn GetFunctionParameter( - &mut self, ParameterIndex: INT - ) -> *mut ID3D11FunctionParameterReflection -}} -RIDL!{interface ID3D11FunctionParameterReflection(ID3D11FunctionParameterReflectionVtbl) { - fn GetDesc(&mut self, pDesc: *mut D3D11_PARAMETER_DESC) -> HRESULT -}} -RIDL!{interface ID3D11Module(ID3D11ModuleVtbl): IUnknown(IUnknownVtbl) { - fn CreateInstance( - &mut self, pNamespace: LPCSTR, ppModuleInstance: *mut *mut ID3D11ModuleInstance - ) -> HRESULT -}} -RIDL!{interface ID3D11ModuleInstance(ID3D11ModuleInstanceVtbl): IUnknown(IUnknownVtbl) { - fn BindConstantBuffer(&mut self, uSrcSlot: UINT, uDstSlot: UINT, cbDstOffset: UINT) -> HRESULT, - fn BindConstantBufferByName( - &mut self, pName: LPCSTR, uDstSlot: UINT, cbDstOffset: UINT - ) -> HRESULT, - fn BindResource(&mut self, uSrcSlot: UINT, uDstSlot: UINT, uCount: UINT) -> HRESULT, - fn BindResourceByName(&mut self, pName: LPCSTR, uDstSlot: UINT, uCount: UINT) -> HRESULT, - fn BindSampler(&mut self, uSrcSlot: UINT, uDstSlot: UINT, uCount: UINT) -> HRESULT, - fn BindSamplerByName(&mut self, pName: LPCSTR, uDstSlot: UINT, uCount: UINT) -> HRESULT, - fn BindUnorderedAccessView(&mut self, uSrcSlot: UINT, uDstSlot: UINT, uCount: UINT) -> HRESULT, - fn BindUnorderedAccessViewByName( - &mut self, pName: LPCSTR, uDstSlot: UINT, uCount: UINT - ) -> HRESULT, - fn BindResourceAsUnorderedAccessView( - &mut self, uSrcSrvSlot: UINT, uDstUavSlot: UINT, uCount: UINT - ) -> HRESULT, - fn BindResourceAsUnorderedAccessViewByName( - &mut self, pSrvName: LPCSTR, uDstUavSlot: UINT, uCount: UINT - ) -> HRESULT -}} -RIDL!{interface ID3D11Linker(ID3D11LinkerVtbl): IUnknown(IUnknownVtbl) { - fn Link( - &mut self, pEntry: *mut ID3D11ModuleInstance, pEntryName: LPCSTR, pTargetName: LPCSTR, - uFlags: UINT, ppShaderBlob: *mut *mut ID3DBlob, ppErrorBuffer: *mut *mut ID3DBlob - ) -> HRESULT, - fn UseLibrary(&mut self, pLibraryMI: *mut ID3D11ModuleInstance) -> HRESULT, - fn AddClipPlaneFromCBuffer(&mut self, uCBufferSlot: UINT, uCBufferEntry: UINT) -> HRESULT -}} -RIDL!{interface ID3D11LinkingNode(ID3D11LinkingNodeVtbl): IUnknown(IUnknownVtbl) {}} -RIDL!{interface ID3D11FunctionLinkingGraph(ID3D11FunctionLinkingGraphVtbl): IUnknown(IUnknownVtbl) { - fn CreateModuleInstance( - &mut self, ppModuleInstance: *mut *mut ID3D11ModuleInstance, - ppErrorBuffer: *mut *mut ID3DBlob - ) -> HRESULT, - fn SetInputSignature( - &mut self, pInputParameters: *const D3D11_PARAMETER_DESC, cInputParameters: UINT, - ppInputNode: *mut *mut ID3D11LinkingNode - ) -> HRESULT, - fn SetOutputSignature( - &mut self, pOutputParameters: *const D3D11_PARAMETER_DESC, cOutputParameters: UINT, - ppOutputNode: *mut *mut ID3D11LinkingNode - ) -> HRESULT, - fn CallFunction( - &mut self, pModuleInstanceNamespace: LPCSTR, - pModuleWithFunctionPrototype: *mut ID3D11Module, pFunctionName: LPCSTR, - ppCallNode: *mut *mut ID3D11LinkingNode - ) -> HRESULT, - fn PassValue( - &mut self, pSrcNode: *mut ID3D11LinkingNode, SrcParameterIndex: INT, - pDstNode: *mut ID3D11LinkingNode, DstParameterIndex: INT - ) -> HRESULT, - fn PassValueWithSwizzle( - &mut self, pSrcNode: *mut ID3D11LinkingNode, SrcParameterIndex: INT, pSrcSwizzle: LPCSTR, - pDstNode: *mut ID3D11LinkingNode, DstParameterIndex: INT, pDstSwizzle: LPCSTR - ) -> HRESULT, - fn GetLastError(&mut self, ppErrorBuffer: *mut *mut ID3DBlob) -> HRESULT, - fn GenerateHlsl(&mut self, uFlags: UINT, ppBuffer: *mut *mut ID3DBlob) -> HRESULT -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/d3d12.rs cargo-0.37.0/vendor/winapi-0.2.8/src/d3d12.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/d3d12.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/d3d12.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,2324 +0,0 @@ -// Copyright © 2015, Dmitry Roschin -// Licensed under the MIT License -pub const D3D12_16BIT_INDEX_STRIP_CUT_VALUE: ::UINT = 0xffff; -pub const D3D12_32BIT_INDEX_STRIP_CUT_VALUE: ::UINT = 0xffffffff; -pub const D3D12_8BIT_INDEX_STRIP_CUT_VALUE: ::UINT = 0xff; -pub const D3D12_ANISOTROPIC_FILTERING_BIT: ::UINT = 0x40; -pub const D3D12_APPEND_ALIGNED_ELEMENT: ::UINT = 0xffffffff; -pub const D3D12_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT: ::UINT = 9; -pub const D3D12_CLIP_OR_CULL_DISTANCE_COUNT: ::UINT = 8; -pub const D3D12_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT: ::UINT = 2; -pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT: ::UINT = 14; -pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS: ::UINT = 4; -pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT: ::UINT = 15; -pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_PARTIAL_UPDATE_EXTENTS_BYTE_ALIGNMENT: ::UINT = 16; -pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS: ::UINT = 4; -pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT: ::UINT = 15; -pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST: ::UINT = 1; -pub const D3D12_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT: ::UINT = 64; -pub const D3D12_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS: ::UINT = 4; -pub const D3D12_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT: ::UINT = 1; -pub const D3D12_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST: ::UINT = 1; -pub const D3D12_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS: ::UINT = 1; -pub const D3D12_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT: ::UINT = 128; -pub const D3D12_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST: ::UINT = 1; -pub const D3D12_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT: ::UINT = 128; -pub const D3D12_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS: ::UINT = 1; -pub const D3D12_COMMONSHADER_SAMPLER_REGISTER_COUNT: ::UINT = 16; -pub const D3D12_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST: ::UINT = 1; -pub const D3D12_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_COMMONSHADER_SAMPLER_SLOT_COUNT: ::UINT = 16; -pub const D3D12_COMMONSHADER_SUBROUTINE_NESTING_LIMIT: ::UINT = 32; -pub const D3D12_COMMONSHADER_TEMP_REGISTER_COMPONENTS: ::UINT = 4; -pub const D3D12_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_COMMONSHADER_TEMP_REGISTER_COUNT: ::UINT = 4096; -pub const D3D12_COMMONSHADER_TEMP_REGISTER_READS_PER_INST: ::UINT = 3; -pub const D3D12_COMMONSHADER_TEMP_REGISTER_READ_PORTS: ::UINT = 3; -pub const D3D12_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX: ::UINT = 10; -pub const D3D12_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN: ::INT = -10; -pub const D3D12_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE: ::INT = -8; -pub const D3D12_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE: ::UINT = 7; -pub const D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT: ::UINT = 256; -pub const D3D12_CS_4_X_BUCKET00_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 256; -pub const D3D12_CS_4_X_BUCKET00_MAX_NUM_THREADS_PER_GROUP: ::UINT = 64; -pub const D3D12_CS_4_X_BUCKET01_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 240; -pub const D3D12_CS_4_X_BUCKET01_MAX_NUM_THREADS_PER_GROUP: ::UINT = 68; -pub const D3D12_CS_4_X_BUCKET02_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 224; -pub const D3D12_CS_4_X_BUCKET02_MAX_NUM_THREADS_PER_GROUP: ::UINT = 72; -pub const D3D12_CS_4_X_BUCKET03_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 208; -pub const D3D12_CS_4_X_BUCKET03_MAX_NUM_THREADS_PER_GROUP: ::UINT = 76; -pub const D3D12_CS_4_X_BUCKET04_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 192; -pub const D3D12_CS_4_X_BUCKET04_MAX_NUM_THREADS_PER_GROUP: ::UINT = 84; -pub const D3D12_CS_4_X_BUCKET05_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 176; -pub const D3D12_CS_4_X_BUCKET05_MAX_NUM_THREADS_PER_GROUP: ::UINT = 92; -pub const D3D12_CS_4_X_BUCKET06_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 160; -pub const D3D12_CS_4_X_BUCKET06_MAX_NUM_THREADS_PER_GROUP: ::UINT = 100; -pub const D3D12_CS_4_X_BUCKET07_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 144; -pub const D3D12_CS_4_X_BUCKET07_MAX_NUM_THREADS_PER_GROUP: ::UINT = 112; -pub const D3D12_CS_4_X_BUCKET08_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 128; -pub const D3D12_CS_4_X_BUCKET08_MAX_NUM_THREADS_PER_GROUP: ::UINT = 128; -pub const D3D12_CS_4_X_BUCKET09_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 112; -pub const D3D12_CS_4_X_BUCKET09_MAX_NUM_THREADS_PER_GROUP: ::UINT = 144; -pub const D3D12_CS_4_X_BUCKET10_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 96; -pub const D3D12_CS_4_X_BUCKET10_MAX_NUM_THREADS_PER_GROUP: ::UINT = 168; -pub const D3D12_CS_4_X_BUCKET11_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 80; -pub const D3D12_CS_4_X_BUCKET11_MAX_NUM_THREADS_PER_GROUP: ::UINT = 204; -pub const D3D12_CS_4_X_BUCKET12_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 64; -pub const D3D12_CS_4_X_BUCKET12_MAX_NUM_THREADS_PER_GROUP: ::UINT = 256; -pub const D3D12_CS_4_X_BUCKET13_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 48; -pub const D3D12_CS_4_X_BUCKET13_MAX_NUM_THREADS_PER_GROUP: ::UINT = 340; -pub const D3D12_CS_4_X_BUCKET14_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 32; -pub const D3D12_CS_4_X_BUCKET14_MAX_NUM_THREADS_PER_GROUP: ::UINT = 512; -pub const D3D12_CS_4_X_BUCKET15_MAX_BYTES_TGSM_WRITABLE_PER_THREAD: ::UINT = 16; -pub const D3D12_CS_4_X_BUCKET15_MAX_NUM_THREADS_PER_GROUP: ::UINT = 768; -pub const D3D12_CS_4_X_DISPATCH_MAX_THREAD_GROUPS_IN_Z_DIMENSION: ::UINT = 1; -pub const D3D12_CS_4_X_RAW_UAV_BYTE_ALIGNMENT: ::UINT = 256; -pub const D3D12_CS_4_X_THREAD_GROUP_MAX_THREADS_PER_GROUP: ::UINT = 768; -pub const D3D12_CS_4_X_THREAD_GROUP_MAX_X: ::UINT = 768; -pub const D3D12_CS_4_X_THREAD_GROUP_MAX_Y: ::UINT = 768; -pub const D3D12_CS_4_X_UAV_REGISTER_COUNT: ::UINT = 1; -pub const D3D12_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION: ::UINT = 65535; -pub const D3D12_CS_TGSM_REGISTER_COUNT: ::UINT = 8192; -pub const D3D12_CS_TGSM_REGISTER_READS_PER_INST: ::UINT = 1; -pub const D3D12_CS_TGSM_RESOURCE_REGISTER_COMPONENTS: ::UINT = 1; -pub const D3D12_CS_TGSM_RESOURCE_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_CS_THREADGROUPID_REGISTER_COMPONENTS: ::UINT = 3; -pub const D3D12_CS_THREADGROUPID_REGISTER_COUNT: ::UINT = 1; -pub const D3D12_CS_THREADIDINGROUPFLATTENED_REGISTER_COMPONENTS: ::UINT = 1; -pub const D3D12_CS_THREADIDINGROUPFLATTENED_REGISTER_COUNT: ::UINT = 1; -pub const D3D12_CS_THREADIDINGROUP_REGISTER_COMPONENTS: ::UINT = 3; -pub const D3D12_CS_THREADIDINGROUP_REGISTER_COUNT: ::UINT = 1; -pub const D3D12_CS_THREADID_REGISTER_COMPONENTS: ::UINT = 3; -pub const D3D12_CS_THREADID_REGISTER_COUNT: ::UINT = 1; -pub const D3D12_CS_THREAD_GROUP_MAX_THREADS_PER_GROUP: ::UINT = 1024; -pub const D3D12_CS_THREAD_GROUP_MAX_X: ::UINT = 1024; -pub const D3D12_CS_THREAD_GROUP_MAX_Y: ::UINT = 1024; -pub const D3D12_CS_THREAD_GROUP_MAX_Z: ::UINT = 64; -pub const D3D12_CS_THREAD_GROUP_MIN_X: ::UINT = 1; -pub const D3D12_CS_THREAD_GROUP_MIN_Y: ::UINT = 1; -pub const D3D12_CS_THREAD_GROUP_MIN_Z: ::UINT = 1; -pub const D3D12_CS_THREAD_LOCAL_TEMP_REGISTER_POOL: ::UINT = 16384; -pub const D3D12_DEFAULT_BLEND_FACTOR_ALPHA: ::FLOAT = 1.0; -pub const D3D12_DEFAULT_BLEND_FACTOR_BLUE: ::FLOAT = 1.0; -pub const D3D12_DEFAULT_BLEND_FACTOR_GREEN: ::FLOAT = 1.0; -pub const D3D12_DEFAULT_BLEND_FACTOR_RED: ::FLOAT = 1.0; -pub const D3D12_DEFAULT_BORDER_COLOR_COMPONENT: ::FLOAT = 0.0; -pub const D3D12_DEFAULT_DEPTH_BIAS: ::UINT = 0; -pub const D3D12_DEFAULT_DEPTH_BIAS_CLAMP: ::FLOAT = 0.0; -pub const D3D12_DEFAULT_MAX_ANISOTROPY: ::UINT = 16; -pub const D3D12_DEFAULT_MIP_LOD_BIAS: ::FLOAT = 0.0; -pub const D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT: ::UINT = 4194304; -pub const D3D12_DEFAULT_RENDER_TARGET_ARRAY_INDEX: ::UINT = 0; -pub const D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT: ::UINT = 65536; -pub const D3D12_DEFAULT_SAMPLE_MASK: ::UINT = 0xffffffff; -pub const D3D12_DEFAULT_SCISSOR_ENDX: ::UINT = 0; -pub const D3D12_DEFAULT_SCISSOR_ENDY: ::UINT = 0; -pub const D3D12_DEFAULT_SCISSOR_STARTX: ::UINT = 0; -pub const D3D12_DEFAULT_SCISSOR_STARTY: ::UINT = 0; -pub const D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS: ::FLOAT = 0.0; -pub const D3D12_DEFAULT_STENCIL_READ_MASK: ::UINT = 0xff; -pub const D3D12_DEFAULT_STENCIL_REFERENCE: ::UINT = 0; -pub const D3D12_DEFAULT_STENCIL_WRITE_MASK: ::UINT = 0xff; -pub const D3D12_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX: ::UINT = 0; -pub const D3D12_DEFAULT_VIEWPORT_HEIGHT: ::UINT = 0; -pub const D3D12_DEFAULT_VIEWPORT_MAX_DEPTH: ::FLOAT = 0.0; -pub const D3D12_DEFAULT_VIEWPORT_MIN_DEPTH: ::FLOAT = 0.0; -pub const D3D12_DEFAULT_VIEWPORT_TOPLEFTX: ::UINT = 0; -pub const D3D12_DEFAULT_VIEWPORT_TOPLEFTY: ::UINT = 0; -pub const D3D12_DEFAULT_VIEWPORT_WIDTH: ::UINT = 0; -pub const D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND: ::UINT = 0xffffffff; -pub const D3D12_DRIVER_RESERVED_REGISTER_SPACE_VALUES_END: ::UINT = 0xfffffff7; -pub const D3D12_DRIVER_RESERVED_REGISTER_SPACE_VALUES_START: ::UINT = 0xfffffff0; -pub const D3D12_DS_INPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS: ::UINT = 3968; -pub const D3D12_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENTS: ::UINT = 4; -pub const D3D12_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_DS_INPUT_CONTROL_POINT_REGISTER_COUNT: ::UINT = 32; -pub const D3D12_DS_INPUT_CONTROL_POINT_REGISTER_READS_PER_INST: ::UINT = 2; -pub const D3D12_DS_INPUT_CONTROL_POINT_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENTS: ::UINT = 3; -pub const D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_COUNT: ::UINT = 1; -pub const D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_READS_PER_INST: ::UINT = 2; -pub const D3D12_DS_INPUT_DOMAIN_POINT_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENTS: ::UINT = 4; -pub const D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_COUNT: ::UINT = 32; -pub const D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST: ::UINT = 2; -pub const D3D12_DS_INPUT_PATCH_CONSTANT_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS: ::UINT = 1; -pub const D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_COUNT: ::UINT = 1; -pub const D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST: ::UINT = 2; -pub const D3D12_DS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_DS_OUTPUT_REGISTER_COMPONENTS: ::UINT = 4; -pub const D3D12_DS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_DS_OUTPUT_REGISTER_COUNT: ::UINT = 32; -pub const D3D12_FILTER_REDUCTION_TYPE_MASK: ::UINT = 0x3; -pub const D3D12_FILTER_REDUCTION_TYPE_SHIFT: ::UINT = 7; -pub const D3D12_FILTER_TYPE_MASK: ::UINT = 0x3; -pub const D3D12_FLOAT16_FUSED_TOLERANCE_IN_ULP: ::DOUBLE = 0.6; -pub const D3D12_FLOAT32_MAX: ::FLOAT = 3.402823466e+38; -pub const D3D12_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP: ::FLOAT = 0.6; -pub const D3D12_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR: ::FLOAT = 2.4; -pub const D3D12_FLOAT_TO_SRGB_EXPONENT_NUMERATOR: ::FLOAT = 1.0; -pub const D3D12_FLOAT_TO_SRGB_OFFSET: ::FLOAT = 0.055; -pub const D3D12_FLOAT_TO_SRGB_SCALE_1: ::FLOAT = 12.92; -pub const D3D12_FLOAT_TO_SRGB_SCALE_2: ::FLOAT = 1.055; -pub const D3D12_FLOAT_TO_SRGB_THRESHOLD: ::FLOAT = 0.0031308; -pub const D3D12_FTOI_INSTRUCTION_MAX_INPUT: ::FLOAT = 2147483647.999; -pub const D3D12_FTOI_INSTRUCTION_MIN_INPUT: ::FLOAT = -2147483648.999; -pub const D3D12_FTOU_INSTRUCTION_MAX_INPUT: ::FLOAT = 4294967295.999; -pub const D3D12_FTOU_INSTRUCTION_MIN_INPUT: ::FLOAT = 0.0; -pub const D3D12_GS_INPUT_INSTANCE_ID_READS_PER_INST: ::UINT = 2; -pub const D3D12_GS_INPUT_INSTANCE_ID_READ_PORTS: ::UINT = 1; -pub const D3D12_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENTS: ::UINT = 1; -pub const D3D12_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_GS_INPUT_INSTANCE_ID_REGISTER_COUNT: ::UINT = 1; -pub const D3D12_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS: ::UINT = 1; -pub const D3D12_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_GS_INPUT_PRIM_CONST_REGISTER_COUNT: ::UINT = 1; -pub const D3D12_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST: ::UINT = 2; -pub const D3D12_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_GS_INPUT_REGISTER_COMPONENTS: ::UINT = 4; -pub const D3D12_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_GS_INPUT_REGISTER_COUNT: ::UINT = 32; -pub const D3D12_GS_INPUT_REGISTER_READS_PER_INST: ::UINT = 2; -pub const D3D12_GS_INPUT_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_GS_INPUT_REGISTER_VERTICES: ::UINT = 32; -pub const D3D12_GS_MAX_INSTANCE_COUNT: ::UINT = 32; -pub const D3D12_GS_MAX_OUTPUT_VERTEX_COUNT_ACROSS_INSTANCES: ::UINT = 1024; -pub const D3D12_GS_OUTPUT_ELEMENTS: ::UINT = 32; -pub const D3D12_GS_OUTPUT_REGISTER_COMPONENTS: ::UINT = 4; -pub const D3D12_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_GS_OUTPUT_REGISTER_COUNT: ::UINT = 32; -pub const D3D12_HS_CONTROL_POINT_PHASE_INPUT_REGISTER_COUNT: ::UINT = 32; -pub const D3D12_HS_CONTROL_POINT_PHASE_OUTPUT_REGISTER_COUNT: ::UINT = 32; -pub const D3D12_HS_CONTROL_POINT_REGISTER_COMPONENTS: ::UINT = 4; -pub const D3D12_HS_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_HS_CONTROL_POINT_REGISTER_READS_PER_INST: ::UINT = 2; -pub const D3D12_HS_CONTROL_POINT_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_HS_FORK_PHASE_INSTANCE_COUNT_UPPER_BOUND: ::UINT = 0xffffffff; -pub const D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENTS: ::UINT = 1; -pub const D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COUNT: ::UINT = 1; -pub const D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READS_PER_INST: ::UINT = 2; -pub const D3D12_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENTS: ::UINT = 1; -pub const D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COUNT: ::UINT = 1; -pub const D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READS_PER_INST: ::UINT = 2; -pub const D3D12_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS: ::UINT = 1; -pub const D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_COUNT: ::UINT = 1; -pub const D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST: ::UINT = 2; -pub const D3D12_HS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_HS_JOIN_PHASE_INSTANCE_COUNT_UPPER_BOUND: ::UINT = 0xffffffff; -pub const D3D12_HS_MAXTESSFACTOR_LOWER_BOUND: ::FLOAT = 1.0; -pub const D3D12_HS_MAXTESSFACTOR_UPPER_BOUND: ::FLOAT = 64.0; -pub const D3D12_HS_OUTPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS: ::UINT = 3968; -pub const D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENTS: ::UINT = 1; -pub const D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COUNT: ::UINT = 1; -pub const D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READS_PER_INST: ::UINT = 2; -pub const D3D12_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENTS: ::UINT = 4; -pub const D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COUNT: ::UINT = 32; -pub const D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST: ::UINT = 2; -pub const D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_HS_OUTPUT_PATCH_CONSTANT_REGISTER_SCALAR_COMPONENTS: ::UINT = 128; -pub const D3D12_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES: ::UINT = 0; -pub const D3D12_IA_DEFAULT_PRIMITIVE_TOPOLOGY: ::UINT = 0; -pub const D3D12_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES: ::UINT = 0; -pub const D3D12_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT: ::UINT = 1; -pub const D3D12_IA_INSTANCE_ID_BIT_COUNT: ::UINT = 32; -pub const D3D12_IA_INTEGER_ARITHMETIC_BIT_COUNT: ::UINT = 32; -pub const D3D12_IA_PATCH_MAX_CONTROL_POINT_COUNT: ::UINT = 32; -pub const D3D12_IA_PRIMITIVE_ID_BIT_COUNT: ::UINT = 32; -pub const D3D12_IA_VERTEX_ID_BIT_COUNT: ::UINT = 32; -pub const D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT: ::UINT = 32; -pub const D3D12_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS: ::UINT = 128; -pub const D3D12_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT: ::UINT = 32; -pub const D3D12_INTEGER_DIVIDE_BY_ZERO_QUOTIENT: ::UINT = 0xffffffff; -pub const D3D12_INTEGER_DIVIDE_BY_ZERO_REMAINDER: ::UINT = 0xffffffff; -pub const D3D12_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL: ::UINT = 0xffffffff; -pub const D3D12_KEEP_UNORDERED_ACCESS_VIEWS: ::UINT = 0xffffffff; -pub const D3D12_LINEAR_GAMMA: ::FLOAT = 1.0; -pub const D3D12_MAG_FILTER_SHIFT: ::UINT = 2; -pub const D3D12_MAJOR_VERSION: ::UINT = 12; -pub const D3D12_MAX_BORDER_COLOR_COMPONENT: ::FLOAT = 1.0; -pub const D3D12_MAX_DEPTH: ::FLOAT = 1.0; -pub const D3D12_MAX_LIVE_STATIC_SAMPLERS: ::UINT = 2032; -pub const D3D12_MAX_MAXANISOTROPY: ::UINT = 16; -pub const D3D12_MAX_MULTISAMPLE_SAMPLE_COUNT: ::UINT = 32; -pub const D3D12_MAX_POSITION_VALUE: ::FLOAT = 3.402823466e+34; -pub const D3D12_MAX_ROOT_COST: ::UINT = 64; -pub const D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_1: ::UINT = 1000000; -pub const D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_2: ::UINT = 1000000; -pub const D3D12_MAX_SHADER_VISIBLE_SAMPLER_HEAP_SIZE: ::UINT = 2048; -pub const D3D12_MAX_TEXTURE_DIMENSION_2_TO_EXP: ::UINT = 17; -pub const D3D12_MINOR_VERSION: ::UINT = 0; -pub const D3D12_MIN_BORDER_COLOR_COMPONENT: ::FLOAT = 0.0; -pub const D3D12_MIN_DEPTH: ::FLOAT = 0.0; -pub const D3D12_MIN_FILTER_SHIFT: ::UINT = 4; -pub const D3D12_MIN_MAXANISOTROPY: ::UINT = 0; -pub const D3D12_MIP_FILTER_SHIFT: ::UINT = 0; -pub const D3D12_MIP_LOD_BIAS_MAX: ::FLOAT = 15.99; -pub const D3D12_MIP_LOD_BIAS_MIN: ::FLOAT = -16.0; -pub const D3D12_MIP_LOD_FRACTIONAL_BIT_COUNT: ::UINT = 8; -pub const D3D12_MIP_LOD_RANGE_BIT_COUNT: ::UINT = 8; -pub const D3D12_MULTISAMPLE_ANTIALIAS_LINE_WIDTH: ::FLOAT = 1.4; -pub const D3D12_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT: ::UINT = 0; -pub const D3D12_OS_RESERVED_REGISTER_SPACE_VALUES_END: ::UINT = 0xffffffff; -pub const D3D12_OS_RESERVED_REGISTER_SPACE_VALUES_START: ::UINT = 0xfffffff8; -pub const D3D12_PACKED_TILE: ::UINT = 0xffffffff; -pub const D3D12_PIXEL_ADDRESS_RANGE_BIT_COUNT: ::UINT = 15; -pub const D3D12_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT: ::UINT = 16; -pub const D3D12_PS_CS_UAV_REGISTER_COMPONENTS: ::UINT = 1; -pub const D3D12_PS_CS_UAV_REGISTER_COUNT: ::UINT = 8; -pub const D3D12_PS_CS_UAV_REGISTER_READS_PER_INST: ::UINT = 1; -pub const D3D12_PS_CS_UAV_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_PS_FRONTFACING_DEFAULT_VALUE: ::UINT = 0xffffffff; -pub const D3D12_PS_FRONTFACING_FALSE_VALUE: ::UINT = 0; -pub const D3D12_PS_FRONTFACING_TRUE_VALUE: ::UINT = 0xffffffff; -pub const D3D12_PS_INPUT_REGISTER_COMPONENTS: ::UINT = 4; -pub const D3D12_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_PS_INPUT_REGISTER_COUNT: ::UINT = 32; -pub const D3D12_PS_INPUT_REGISTER_READS_PER_INST: ::UINT = 2; -pub const D3D12_PS_INPUT_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT: ::FLOAT = 0.0; -pub const D3D12_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS: ::UINT = 1; -pub const D3D12_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_PS_OUTPUT_DEPTH_REGISTER_COUNT: ::UINT = 1; -pub const D3D12_PS_OUTPUT_MASK_REGISTER_COMPONENTS: ::UINT = 1; -pub const D3D12_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_PS_OUTPUT_MASK_REGISTER_COUNT: ::UINT = 1; -pub const D3D12_PS_OUTPUT_REGISTER_COMPONENTS: ::UINT = 4; -pub const D3D12_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_PS_OUTPUT_REGISTER_COUNT: ::UINT = 8; -pub const D3D12_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT: ::FLOAT = 0.5; -pub const D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT: ::UINT = 16; -pub const D3D12_REQ_BLEND_OBJECT_COUNT_PER_DEVICE: ::UINT = 4096; -pub const D3D12_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP: ::UINT = 27; -pub const D3D12_REQ_CONSTANT_BUFFER_ELEMENT_COUNT: ::UINT = 4096; -pub const D3D12_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_DEVICE: ::UINT = 4096; -pub const D3D12_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP: ::UINT = 32; -pub const D3D12_REQ_DRAW_VERTEX_COUNT_2_TO_EXP: ::UINT = 32; -pub const D3D12_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION: ::UINT = 16384; -pub const D3D12_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT: ::UINT = 1024; -pub const D3D12_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT: ::UINT = 4096; -pub const D3D12_REQ_MAXANISOTROPY: ::UINT = 16; -pub const D3D12_REQ_MIP_LEVELS: ::UINT = 15; -pub const D3D12_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES: ::UINT = 2048; -pub const D3D12_REQ_RASTERIZER_OBJECT_COUNT_PER_DEVICE: ::UINT = 4096; -pub const D3D12_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH: ::UINT = 16384; -pub const D3D12_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_A_TERM: ::UINT = 128; -pub const D3D12_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_B_TERM: ::FLOAT = 0.25; -pub const D3D12_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_C_TERM: ::UINT = 2048; -pub const D3D12_REQ_RESOURCE_VIEW_COUNT_PER_DEVICE_2_TO_EXP: ::UINT = 20; -pub const D3D12_REQ_SAMPLER_OBJECT_COUNT_PER_DEVICE: ::UINT = 4096; -pub const D3D12_REQ_SUBRESOURCES: ::UINT = 30720; -pub const D3D12_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION: ::UINT = 2048; -pub const D3D12_REQ_TEXTURE1D_U_DIMENSION: ::UINT = 16384; -pub const D3D12_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION: ::UINT = 2048; -pub const D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION: ::UINT = 16384; -pub const D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION: ::UINT = 2048; -pub const D3D12_REQ_TEXTURECUBE_DIMENSION: ::UINT = 16384; -pub const D3D12_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL: ::UINT = 0; -pub const D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES: ::UINT = 0xffffffff; -pub const D3D12_SHADER_COMPONENT_MAPPING_MASK: ::UINT = 0x7; -pub const D3D12_SHADER_COMPONENT_MAPPING_SHIFT: ::UINT = 3; -pub const D3D12_SHADER_MAJOR_VERSION: ::UINT = 5; -pub const D3D12_SHADER_MAX_INSTANCES: ::UINT = 65535; -pub const D3D12_SHADER_MAX_INTERFACES: ::UINT = 253; -pub const D3D12_SHADER_MAX_INTERFACE_CALL_SITES: ::UINT = 4096; -pub const D3D12_SHADER_MAX_TYPES: ::UINT = 65535; -pub const D3D12_SHADER_MINOR_VERSION: ::UINT = 1; -pub const D3D12_SHIFT_INSTRUCTION_PAD_VALUE: ::UINT = 0; -pub const D3D12_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT: ::UINT = 5; -pub const D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT: ::UINT = 8; -pub const D3D12_SMALL_MSAA_RESOURCE_PLACEMENT_ALIGNMENT: ::UINT = 65536; -pub const D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT: ::UINT = 4096; -pub const D3D12_SO_BUFFER_MAX_STRIDE_IN_BYTES: ::UINT = 2048; -pub const D3D12_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES: ::UINT = 512; -pub const D3D12_SO_BUFFER_SLOT_COUNT: ::UINT = 4; -pub const D3D12_SO_DDI_REGISTER_INDEX_DENOTING_GAP: ::UINT = 0xffffffff; -pub const D3D12_SO_NO_RASTERIZED_STREAM: ::UINT = 0xffffffff; -pub const D3D12_SO_OUTPUT_COMPONENT_COUNT: ::UINT = 128; -pub const D3D12_SO_STREAM_COUNT: ::UINT = 4; -pub const D3D12_SPEC_DATE_DAY: ::UINT = 14; -pub const D3D12_SPEC_DATE_MONTH: ::UINT = 11; -pub const D3D12_SPEC_DATE_YEAR: ::UINT = 2014; -pub const D3D12_SPEC_VERSION: ::DOUBLE = 1.16; -pub const D3D12_SRGB_GAMMA: ::FLOAT = 2.2; -pub const D3D12_SRGB_TO_FLOAT_DENOMINATOR_1: ::FLOAT = 12.92; -pub const D3D12_SRGB_TO_FLOAT_DENOMINATOR_2: ::FLOAT = 1.055; -pub const D3D12_SRGB_TO_FLOAT_EXPONENT: ::FLOAT = 2.4; -pub const D3D12_SRGB_TO_FLOAT_OFFSET: ::FLOAT = 0.055; -pub const D3D12_SRGB_TO_FLOAT_THRESHOLD: ::FLOAT = 0.04045; -pub const D3D12_SRGB_TO_FLOAT_TOLERANCE_IN_ULP: ::FLOAT = 0.5; -pub const D3D12_STANDARD_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_STANDARD_COMPONENT_BIT_COUNT_DOUBLED: ::UINT = 64; -pub const D3D12_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE: ::UINT = 4; -pub const D3D12_STANDARD_PIXEL_COMPONENT_COUNT: ::UINT = 128; -pub const D3D12_STANDARD_PIXEL_ELEMENT_COUNT: ::UINT = 32; -pub const D3D12_STANDARD_VECTOR_SIZE: ::UINT = 4; -pub const D3D12_STANDARD_VERTEX_ELEMENT_COUNT: ::UINT = 32; -pub const D3D12_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT: ::UINT = 64; -pub const D3D12_SUBPIXEL_FRACTIONAL_BIT_COUNT: ::UINT = 8; -pub const D3D12_SUBTEXEL_FRACTIONAL_BIT_COUNT: ::UINT = 8; -pub const D3D12_SYSTEM_RESERVED_REGISTER_SPACE_VALUES_END: ::UINT = 0xffffffff; -pub const D3D12_SYSTEM_RESERVED_REGISTER_SPACE_VALUES_START: ::UINT = 0xfffffff0; -pub const D3D12_TESSELLATOR_MAX_EVEN_TESSELLATION_FACTOR: ::UINT = 64; -pub const D3D12_TESSELLATOR_MAX_ISOLINE_DENSITY_TESSELLATION_FACTOR: ::UINT = 64; -pub const D3D12_TESSELLATOR_MAX_ODD_TESSELLATION_FACTOR: ::UINT = 63; -pub const D3D12_TESSELLATOR_MAX_TESSELLATION_FACTOR: ::UINT = 64; -pub const D3D12_TESSELLATOR_MIN_EVEN_TESSELLATION_FACTOR: ::UINT = 2; -pub const D3D12_TESSELLATOR_MIN_ISOLINE_DENSITY_TESSELLATION_FACTOR: ::UINT = 1; -pub const D3D12_TESSELLATOR_MIN_ODD_TESSELLATION_FACTOR: ::UINT = 1; -pub const D3D12_TEXEL_ADDRESS_RANGE_BIT_COUNT: ::UINT = 16; -pub const D3D12_TEXTURE_DATA_PITCH_ALIGNMENT: ::UINT = 256; -pub const D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT: ::UINT = 512; -pub const D3D12_TILED_RESOURCE_TILE_SIZE_IN_BYTES: ::UINT = 65536; -pub const D3D12_UAV_COUNTER_PLACEMENT_ALIGNMENT: ::UINT = 4096; -pub const D3D12_UAV_SLOT_COUNT: ::UINT = 64; -pub const D3D12_UNBOUND_MEMORY_ACCESS_RESULT: ::UINT = 0; -pub const D3D12_VIEWPORT_AND_SCISSORRECT_MAX_INDEX: ::UINT = 15; -pub const D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE: ::UINT = 16; -pub const D3D12_VIEWPORT_BOUNDS_MAX: ::UINT = 32767; -pub const D3D12_VIEWPORT_BOUNDS_MIN: ::INT = -32768; -pub const D3D12_VS_INPUT_REGISTER_COMPONENTS: ::UINT = 4; -pub const D3D12_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_VS_INPUT_REGISTER_COUNT: ::UINT = 32; -pub const D3D12_VS_INPUT_REGISTER_READS_PER_INST: ::UINT = 2; -pub const D3D12_VS_INPUT_REGISTER_READ_PORTS: ::UINT = 1; -pub const D3D12_VS_OUTPUT_REGISTER_COMPONENTS: ::UINT = 4; -pub const D3D12_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT: ::UINT = 32; -pub const D3D12_VS_OUTPUT_REGISTER_COUNT: ::UINT = 32; -pub const D3D12_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT: ::UINT = 10; -pub const D3D12_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP: ::UINT = 25; -pub const D3D12_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP: ::UINT = 25; -pub type D3D12_GPU_VIRTUAL_ADDRESS = ::UINT64; -ENUM!{enum D3D12_COMMAND_LIST_TYPE { - D3D12_COMMAND_LIST_TYPE_DIRECT = 0, - D3D12_COMMAND_LIST_TYPE_BUNDLE = 1, - D3D12_COMMAND_LIST_TYPE_COMPUTE = 2, - D3D12_COMMAND_LIST_TYPE_COPY = 3, -}} -FLAGS!{enum D3D12_COMMAND_QUEUE_FLAGS { - D3D12_COMMAND_QUEUE_FLAG_NONE = 0x0, - D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT = 0x1, -}} -ENUM!{enum D3D12_COMMAND_QUEUE_PRIORITY { - D3D12_COMMAND_QUEUE_PRIORITY_NORMAL = 0, - D3D12_COMMAND_QUEUE_PRIORITY_HIGH = 100, -}} -STRUCT!{struct D3D12_COMMAND_QUEUE_DESC { - Type: D3D12_COMMAND_LIST_TYPE, - Priority: ::INT, - Flags: D3D12_COMMAND_QUEUE_FLAGS, - NodeMask: ::UINT, -}} -ENUM!{enum D3D12_PRIMITIVE_TOPOLOGY_TYPE { - D3D12_PRIMITIVE_TOPOLOGY_TYPE_UNDEFINED = 0, - D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT = 1, - D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE = 2, - D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE = 3, - D3D12_PRIMITIVE_TOPOLOGY_TYPE_PATCH = 4, -}} -ENUM!{enum D3D12_INPUT_CLASSIFICATION { - D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA = 0, - D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA = 1, -}} -STRUCT!{struct D3D12_INPUT_ELEMENT_DESC { - SemanticName: ::LPCSTR, - SemanticIndex: ::UINT, - Format: ::DXGI_FORMAT, - InputSlot: ::UINT, - AlignedByteOffset: ::UINT, - InputSlotClass: D3D12_INPUT_CLASSIFICATION, - InstanceDataStepRate: ::UINT, -}} -ENUM!{enum D3D12_FILL_MODE { - D3D12_FILL_MODE_WIREFRAME = 2, - D3D12_FILL_MODE_SOLID = 3, -}} -pub type D3D12_PRIMITIVE_TOPOLOGY = ::D3D_PRIMITIVE_TOPOLOGY; -pub type D3D12_PRIMITIVE = ::D3D_PRIMITIVE; -ENUM!{enum D3D12_CULL_MODE { - D3D12_CULL_MODE_NONE = 1, - D3D12_CULL_MODE_FRONT = 2, - D3D12_CULL_MODE_BACK = 3, -}} -STRUCT!{struct D3D12_SO_DECLARATION_ENTRY { - Stream: ::UINT, - SemanticName: ::LPCSTR, - SemanticIndex: ::UINT, - StartComponent: ::BYTE, - ComponentCount: ::BYTE, - OutputSlot: ::BYTE, -}} -STRUCT!{struct D3D12_VIEWPORT { - TopLeftX: ::FLOAT, - TopLeftY: ::FLOAT, - Width: ::FLOAT, - Height: ::FLOAT, - MinDepth: ::FLOAT, - MaxDepth: ::FLOAT, -}} -pub type D3D12_RECT = ::RECT; -STRUCT!{struct D3D12_BOX { - left: ::UINT, - top: ::UINT, - front: ::UINT, - right: ::UINT, - bottom: ::UINT, - back: ::UINT, -}} -ENUM!{enum D3D12_COMPARISON_FUNC { - D3D12_COMPARISON_FUNC_NEVER = 1, - D3D12_COMPARISON_FUNC_LESS = 2, - D3D12_COMPARISON_FUNC_EQUAL = 3, - D3D12_COMPARISON_FUNC_LESS_EQUAL = 4, - D3D12_COMPARISON_FUNC_GREATER = 5, - D3D12_COMPARISON_FUNC_NOT_EQUAL = 6, - D3D12_COMPARISON_FUNC_GREATER_EQUAL = 7, - D3D12_COMPARISON_FUNC_ALWAYS = 8, -}} -ENUM!{enum D3D12_DEPTH_WRITE_MASK { - D3D12_DEPTH_WRITE_MASK_ZERO = 0, - D3D12_DEPTH_WRITE_MASK_ALL = 1, -}} -ENUM!{enum D3D12_STENCIL_OP { - D3D12_STENCIL_OP_KEEP = 1, - D3D12_STENCIL_OP_ZERO = 2, - D3D12_STENCIL_OP_REPLACE = 3, - D3D12_STENCIL_OP_INCR_SAT = 4, - D3D12_STENCIL_OP_DECR_SAT = 5, - D3D12_STENCIL_OP_INVERT = 6, - D3D12_STENCIL_OP_INCR = 7, - D3D12_STENCIL_OP_DECR = 8, -}} -STRUCT!{struct D3D12_DEPTH_STENCILOP_DESC { - StencilFailOp: D3D12_STENCIL_OP, - StencilDepthFailOp: D3D12_STENCIL_OP, - StencilPassOp: D3D12_STENCIL_OP, - StencilFunc: D3D12_COMPARISON_FUNC, -}} -STRUCT!{struct D3D12_DEPTH_STENCIL_DESC { - DepthEnable: ::BOOL, - DepthWriteMask: D3D12_DEPTH_WRITE_MASK, - DepthFunc: D3D12_COMPARISON_FUNC, - StencilEnable: ::BOOL, - StencilReadMask: ::UINT8, - StencilWriteMask: ::UINT8, - FrontFace: D3D12_DEPTH_STENCILOP_DESC, - BackFace: D3D12_DEPTH_STENCILOP_DESC, -}} -ENUM!{enum D3D12_BLEND { - D3D12_BLEND_ZERO = 1, - D3D12_BLEND_ONE = 2, - D3D12_BLEND_SRC_COLOR = 3, - D3D12_BLEND_INV_SRC_COLOR = 4, - D3D12_BLEND_SRC_ALPHA = 5, - D3D12_BLEND_INV_SRC_ALPHA = 6, - D3D12_BLEND_DEST_ALPHA = 7, - D3D12_BLEND_INV_DEST_ALPHA = 8, - D3D12_BLEND_DEST_COLOR = 9, - D3D12_BLEND_INV_DEST_COLOR = 10, - D3D12_BLEND_SRC_ALPHA_SAT = 11, - D3D12_BLEND_BLEND_FACTOR = 14, - D3D12_BLEND_INV_BLEND_FACTOR = 15, - D3D12_BLEND_SRC1_COLOR = 16, - D3D12_BLEND_INV_SRC1_COLOR = 17, - D3D12_BLEND_SRC1_ALPHA = 18, - D3D12_BLEND_INV_SRC1_ALPHA = 19, -}} -ENUM!{enum D3D12_BLEND_OP { - D3D12_BLEND_OP_ADD = 1, - D3D12_BLEND_OP_SUBTRACT = 2, - D3D12_BLEND_OP_REV_SUBTRACT = 3, - D3D12_BLEND_OP_MIN = 4, - D3D12_BLEND_OP_MAX = 5, -}} -FLAGS!{enum D3D12_COLOR_WRITE_ENABLE { - D3D12_COLOR_WRITE_ENABLE_RED = 0x1, - D3D12_COLOR_WRITE_ENABLE_GREEN = 0x2, - D3D12_COLOR_WRITE_ENABLE_BLUE = 0x4, - D3D12_COLOR_WRITE_ENABLE_ALPHA = 0x8, - D3D12_COLOR_WRITE_ENABLE_ALL = 0xF, -}} -ENUM!{enum D3D12_LOGIC_OP { - D3D12_LOGIC_OP_CLEAR = 0, - D3D12_LOGIC_OP_SET = 1, - D3D12_LOGIC_OP_COPY = 2, - D3D12_LOGIC_OP_COPY_INVERTED = 3, - D3D12_LOGIC_OP_NOOP = 4, - D3D12_LOGIC_OP_INVERT = 5, - D3D12_LOGIC_OP_AND = 6, - D3D12_LOGIC_OP_NAND = 7, - D3D12_LOGIC_OP_OR = 8, - D3D12_LOGIC_OP_NOR = 9, - D3D12_LOGIC_OP_XOR = 10, - D3D12_LOGIC_OP_EQUIV = 11, - D3D12_LOGIC_OP_AND_REVERSE = 12, - D3D12_LOGIC_OP_AND_INVERTED = 13, - D3D12_LOGIC_OP_OR_REVERSE = 14, - D3D12_LOGIC_OP_OR_INVERTED = 15, -}} -STRUCT!{struct D3D12_RENDER_TARGET_BLEND_DESC { - BlendEnable: ::BOOL, - LogicOpEnable: ::BOOL, - SrcBlend: D3D12_BLEND, - DestBlend: D3D12_BLEND, - BlendOp: D3D12_BLEND_OP, - SrcBlendAlpha: D3D12_BLEND, - DestBlendAlpha: D3D12_BLEND, - BlendOpAlpha: D3D12_BLEND_OP, - LogicOp: D3D12_LOGIC_OP, - RenderTargetWriteMask: ::UINT8, -}} -STRUCT!{struct D3D12_BLEND_DESC { - AlphaToCoverageEnable: ::BOOL, - IndependentBlendEnable: ::BOOL, - RenderTarget: [D3D12_RENDER_TARGET_BLEND_DESC; 8], -}} -ENUM!{enum D3D12_CONSERVATIVE_RASTERIZATION_MODE { - D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF = 0, - D3D12_CONSERVATIVE_RASTERIZATION_MODE_ON = 1, -}} -STRUCT!{struct D3D12_RASTERIZER_DESC { - FillMode: D3D12_FILL_MODE, - CullMode: D3D12_CULL_MODE, - FrontCounterClockwise: ::BOOL, - DepthBias: ::INT, - DepthBiasClamp: ::FLOAT, - SlopeScaledDepthBias: ::FLOAT, - DepthClipEnable: ::BOOL, - MultisampleEnable: ::BOOL, - AntialiasedLineEnable: ::BOOL, - ForcedSampleCount: ::UINT, - ConservativeRaster: D3D12_CONSERVATIVE_RASTERIZATION_MODE, -}} -RIDL!{interface ID3D12Object(ID3D12ObjectVtbl): IUnknown(IUnknownVtbl) { - fn GetPrivateData( - &mut self, guid: ::REFGUID, pDataSize: *mut ::UINT, pData: *mut ::c_void - ) -> ::HRESULT, - fn SetPrivateData( - &mut self, guid: ::REFGUID, DataSize: ::UINT, pData: *const ::c_void - ) -> ::HRESULT, - fn SetPrivateDataInterface( - &mut self, guid: ::REFGUID, pData: *const ::IUnknown - ) -> ::HRESULT, - fn SetName(&mut self, Name: ::LPCWSTR) -> ::HRESULT -}} -RIDL!{interface ID3D12DeviceChild(ID3D12DeviceChildVtbl): ID3D12Object(ID3D12ObjectVtbl) { - fn GetDevice( - &mut self, riid: ::REFGUID, ppvDevice: *mut *mut ::c_void - ) -> ::HRESULT -}} -RIDL!{interface ID3D12RootSignature(ID3D12RootSignatureVtbl): - ID3D12DeviceChild(ID3D12DeviceChildVtbl) { -}} -STRUCT!{struct D3D12_SHADER_BYTECODE { - pShaderBytecode: *const ::c_void, - BytecodeLength: ::SIZE_T, -}} -STRUCT!{struct D3D12_STREAM_OUTPUT_DESC { - pSODeclaration: *const D3D12_SO_DECLARATION_ENTRY, - NumEntries: ::UINT, - pBufferStrides: *const ::UINT, - NumStrides: ::UINT, - RasterizedStream: ::UINT, -}} -STRUCT!{struct D3D12_INPUT_LAYOUT_DESC { - pInputElementDescs: *const D3D12_INPUT_ELEMENT_DESC, - NumElements: ::UINT, -}} -ENUM!{enum D3D12_INDEX_BUFFER_STRIP_CUT_VALUE { - D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_DISABLED = 0, - D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFF = 1, - D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFFFFFF = 2, -}} -STRUCT!{struct D3D12_CACHED_PIPELINE_STATE { - pCachedBlob: *const ::c_void, - CachedBlobSizeInBytes: ::SIZE_T, -}} -FLAGS!{enum D3D12_PIPELINE_STATE_FLAGS { - D3D12_PIPELINE_STATE_FLAG_NONE = 0x0, - D3D12_PIPELINE_STATE_FLAG_TOOL_DEBUG = 0x1, -}} -STRUCT!{struct D3D12_GRAPHICS_PIPELINE_STATE_DESC { - pRootSignature: *mut ID3D12RootSignature, - VS: D3D12_SHADER_BYTECODE, - PS: D3D12_SHADER_BYTECODE, - DS: D3D12_SHADER_BYTECODE, - HS: D3D12_SHADER_BYTECODE, - GS: D3D12_SHADER_BYTECODE, - StreamOutput: D3D12_STREAM_OUTPUT_DESC, - BlendState: D3D12_BLEND_DESC, - SampleMask: ::UINT, - RasterizerState: D3D12_RASTERIZER_DESC, - DepthStencilState: D3D12_DEPTH_STENCIL_DESC, - InputLayout: D3D12_INPUT_LAYOUT_DESC, - IBStripCutValue: D3D12_INDEX_BUFFER_STRIP_CUT_VALUE, - PrimitiveTopologyType: D3D12_PRIMITIVE_TOPOLOGY_TYPE, - NumRenderTargets: ::UINT, - RTVFormats: [::DXGI_FORMAT; 8], - DSVFormat: ::DXGI_FORMAT, - SampleDesc: ::DXGI_SAMPLE_DESC, - NodeMask: ::UINT, - CachedPSO: D3D12_CACHED_PIPELINE_STATE, - Flags: D3D12_PIPELINE_STATE_FLAGS, -}} -STRUCT!{struct D3D12_COMPUTE_PIPELINE_STATE_DESC { - pRootSignature: *mut ID3D12RootSignature, - CS: D3D12_SHADER_BYTECODE, - NodeMask: ::UINT, - CachedPSO: D3D12_CACHED_PIPELINE_STATE, - Flags: D3D12_PIPELINE_STATE_FLAGS, -}} -ENUM!{enum D3D12_FEATURE { - D3D12_FEATURE_D3D12_OPTIONS = 0, - D3D12_FEATURE_ARCHITECTURE = 1, - D3D12_FEATURE_FEATURE_LEVELS = 2, - D3D12_FEATURE_FORMAT_SUPPORT = 3, - D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS = 4, - D3D12_FEATURE_FORMAT_INFO = 5, - D3D12_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT = 6, -}} -FLAGS!{enum D3D12_SHADER_MIN_PRECISION_SUPPORT { - D3D12_SHADER_MIN_PRECISION_SUPPORT_NONE = 0, - D3D12_SHADER_MIN_PRECISION_SUPPORT_10_BIT = 0x1, - D3D12_SHADER_MIN_PRECISION_SUPPORT_16_BIT = 0x2, -}} -ENUM!{enum D3D12_TILED_RESOURCES_TIER { - D3D12_TILED_RESOURCES_TIER_NOT_SUPPORTED = 0, - D3D12_TILED_RESOURCES_TIER_1 = 1, - D3D12_TILED_RESOURCES_TIER_2 = 2, - D3D12_TILED_RESOURCES_TIER_3 = 3, -}} -ENUM!{enum D3D12_RESOURCE_BINDING_TIER { - D3D12_RESOURCE_BINDING_TIER_1 = 1, - D3D12_RESOURCE_BINDING_TIER_2 = 2, - D3D12_RESOURCE_BINDING_TIER_3 = 3, -}} -ENUM!{enum D3D12_CONSERVATIVE_RASTERIZATION_TIER { - D3D12_CONSERVATIVE_RASTERIZATION_TIER_NOT_SUPPORTED = 0, - D3D12_CONSERVATIVE_RASTERIZATION_TIER_1 = 1, - D3D12_CONSERVATIVE_RASTERIZATION_TIER_2 = 2, - D3D12_CONSERVATIVE_RASTERIZATION_TIER_3 = 3, -}} -FLAGS!{enum D3D12_FORMAT_SUPPORT1 { - D3D12_FORMAT_SUPPORT1_NONE = 0x0, - D3D12_FORMAT_SUPPORT1_BUFFER = 0x1, - D3D12_FORMAT_SUPPORT1_IA_VERTEX_BUFFER = 0x2, - D3D12_FORMAT_SUPPORT1_IA_INDEX_BUFFER = 0x4, - D3D12_FORMAT_SUPPORT1_SO_BUFFER = 0x8, - D3D12_FORMAT_SUPPORT1_TEXTURE1D = 0x10, - D3D12_FORMAT_SUPPORT1_TEXTURE2D = 0x20, - D3D12_FORMAT_SUPPORT1_TEXTURE3D = 0x40, - D3D12_FORMAT_SUPPORT1_TEXTURECUBE = 0x80, - D3D12_FORMAT_SUPPORT1_SHADER_LOAD = 0x100, - D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE = 0x200, - D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE_COMPARISON = 0x400, - D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE_MONO_TEXT = 0x800, - D3D12_FORMAT_SUPPORT1_MIP = 0x1000, - D3D12_FORMAT_SUPPORT1_RENDER_TARGET = 0x4000, - D3D12_FORMAT_SUPPORT1_BLENDABLE = 0x8000, - D3D12_FORMAT_SUPPORT1_DEPTH_STENCIL = 0x10000, - D3D12_FORMAT_SUPPORT1_MULTISAMPLE_RESOLVE = 0x40000, - D3D12_FORMAT_SUPPORT1_DISPLAY = 0x80000, - D3D12_FORMAT_SUPPORT1_CAST_WITHIN_BIT_LAYOUT = 0x100000, - D3D12_FORMAT_SUPPORT1_MULTISAMPLE_RENDERTARGET = 0x200000, - D3D12_FORMAT_SUPPORT1_MULTISAMPLE_LOAD = 0x400000, - D3D12_FORMAT_SUPPORT1_SHADER_GATHER = 0x800000, - D3D12_FORMAT_SUPPORT1_BACK_BUFFER_CAST = 0x1000000, - D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW = 0x2000000, - D3D12_FORMAT_SUPPORT1_SHADER_GATHER_COMPARISON = 0x4000000, - D3D12_FORMAT_SUPPORT1_DECODER_OUTPUT = 0x8000000, - D3D12_FORMAT_SUPPORT1_VIDEO_PROCESSOR_OUTPUT = 0x10000000, - D3D12_FORMAT_SUPPORT1_VIDEO_PROCESSOR_INPUT = 0x20000000, - D3D12_FORMAT_SUPPORT1_VIDEO_ENCODER = 0x40000000, -}} -FLAGS!{enum D3D12_FORMAT_SUPPORT2 { - D3D12_FORMAT_SUPPORT2_NONE = 0x0, - D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_ADD = 0x1, - D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS = 0x2, - D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE = 0x4, - D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_EXCHANGE = 0x8, - D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_SIGNED_MIN_OR_MAX = 0x10, - D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_UNSIGNED_MIN_OR_MAX = 0x20, - D3D12_FORMAT_SUPPORT2_UAV_TYPED_LOAD = 0x40, - D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE = 0x80, - D3D12_FORMAT_SUPPORT2_OUTPUT_MERGER_LOGIC_OP = 0x100, - D3D12_FORMAT_SUPPORT2_TILED = 0x200, - D3D12_FORMAT_SUPPORT2_MULTIPLANE_OVERLAY = 0x4000, -}} -FLAGS!{enum D3D12_MULTISAMPLE_QUALITY_LEVEL_FLAGS { - D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_NONE = 0x0, - D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_TILED_RESOURCE = 0x1, -}} -ENUM!{enum D3D12_CROSS_NODE_SHARING_TIER { - D3D12_CROSS_NODE_SHARING_TIER_NOT_SUPPORTED = 0, - D3D12_CROSS_NODE_SHARING_TIER_1_EMULATED = 1, - D3D12_CROSS_NODE_SHARING_TIER_1 = 2, - D3D12_CROSS_NODE_SHARING_TIER_2 = 3, -}} -ENUM!{enum D3D12_RESOURCE_HEAP_TIER { - D3D12_RESOURCE_HEAP_TIER_1 = 1, - D3D12_RESOURCE_HEAP_TIER_2 = 2, -}} -STRUCT!{struct D3D12_FEATURE_DATA_D3D12_OPTIONS { - DoublePrecisionFloatShaderOps: ::BOOL, - OutputMergerLogicOp: ::BOOL, - MinPrecisionSupport: D3D12_SHADER_MIN_PRECISION_SUPPORT, - TiledResourcesTier: D3D12_TILED_RESOURCES_TIER, - ResourceBindingTier: D3D12_RESOURCE_BINDING_TIER, - PSSpecifiedStencilRefSupported: ::BOOL, - TypedUAVLoadAdditionalFormats: ::BOOL, - ROVsSupported: ::BOOL, - ConservativeRasterizationTier: D3D12_CONSERVATIVE_RASTERIZATION_TIER, - MaxGPUVirtualAddressBitsPerResource: ::UINT, - StandardSwizzle64KBSupported: ::BOOL, - CrossNodeSharingTier: D3D12_CROSS_NODE_SHARING_TIER, - CrossAdapterRowMajorTextureSupported: ::BOOL, - VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation: ::BOOL, - ResourceHeapTier: D3D12_RESOURCE_HEAP_TIER, -}} - - - - - - - - - -FLAGS!{ enum D3D12_BUFFER_SRV_FLAGS { - D3D12_BUFFER_SRV_FLAG_NONE = 0x0, - D3D12_BUFFER_SRV_FLAG_RAW = 0x1, -}} - -FLAGS!{ enum D3D12_BUFFER_UAV_FLAGS { - D3D12_BUFFER_UAV_FLAG_NONE = 0x0, - D3D12_BUFFER_UAV_FLAG_RAW = 0x1, -}} - -FLAGS!{ enum D3D12_CLEAR_FLAGS { - D3D12_CLEAR_FLAG_DEPTH = 0x1, - D3D12_CLEAR_FLAG_STENCIL = 0x2, -}} - - -ENUM!{ enum D3D12_CPU_PAGE_PROPERTY { - D3D12_CPU_PAGE_PROPERTY_UNKNOWN = 0, - D3D12_CPU_PAGE_PROPERTY_NOT_AVAILABLE = 1, - D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE = 2, - D3D12_CPU_PAGE_PROPERTY_WRITE_BACK = 3, -}} - - -FLAGS!{ enum D3D12_DESCRIPTOR_HEAP_FLAGS { - D3D12_DESCRIPTOR_HEAP_FLAG_NONE = 0x0, - D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE = 0x1, -}} - -ENUM!{ enum D3D12_DESCRIPTOR_HEAP_TYPE { - D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV = 0, - D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER = 1, - D3D12_DESCRIPTOR_HEAP_TYPE_RTV = 2, - D3D12_DESCRIPTOR_HEAP_TYPE_DSV = 3, - D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES = 4, -}} - -ENUM!{ enum D3D12_DESCRIPTOR_RANGE_TYPE { - D3D12_DESCRIPTOR_RANGE_TYPE_SRV = 0, - D3D12_DESCRIPTOR_RANGE_TYPE_UAV = 1, - D3D12_DESCRIPTOR_RANGE_TYPE_CBV = 2, - D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER = 3, -}} - -ENUM!{ enum D3D12_DSV_DIMENSION { - D3D12_DSV_DIMENSION_UNKNOWN = 0, - D3D12_DSV_DIMENSION_TEXTURE1D = 1, - D3D12_DSV_DIMENSION_TEXTURE1DARRAY = 2, - D3D12_DSV_DIMENSION_TEXTURE2D = 3, - D3D12_DSV_DIMENSION_TEXTURE2DARRAY = 4, - D3D12_DSV_DIMENSION_TEXTURE2DMS = 5, - D3D12_DSV_DIMENSION_TEXTURE2DMSARRAY = 6, -}} - -FLAGS!{ enum D3D12_DSV_FLAGS { - D3D12_DSV_FLAG_NONE = 0x0, - D3D12_DSV_FLAG_READ_ONLY_DEPTH = 0x1, - D3D12_DSV_FLAG_READ_ONLY_STENCIL = 0x2, -}} - - - -FLAGS!{ enum D3D12_FENCE_FLAGS { - D3D12_FENCE_FLAG_NONE = 0x0, - D3D12_FENCE_FLAG_SHARED = 0x1, - D3D12_FENCE_FLAG_SHARED_CROSS_ADAPTER = 0x2, -}} - - - -ENUM!{ enum D3D12_FILTER { - D3D12_FILTER_MIN_MAG_MIP_POINT = 0, - D3D12_FILTER_MIN_MAG_POINT_MIP_LINEAR = 1, - D3D12_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 4, - D3D12_FILTER_MIN_POINT_MAG_MIP_LINEAR = 5, - D3D12_FILTER_MIN_LINEAR_MAG_MIP_POINT = 16, - D3D12_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 17, - D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT = 20, - D3D12_FILTER_MIN_MAG_MIP_LINEAR = 21, - D3D12_FILTER_ANISOTROPIC = 85, - D3D12_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 128, - D3D12_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 129, - D3D12_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 132, - D3D12_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 133, - D3D12_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 144, - D3D12_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 145, - D3D12_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 148, - D3D12_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 149, - D3D12_FILTER_COMPARISON_ANISOTROPIC = 213, - D3D12_FILTER_MINIMUM_MIN_MAG_MIP_POINT = 256, - D3D12_FILTER_MINIMUM_MIN_MAG_POINT_MIP_LINEAR = 257, - D3D12_FILTER_MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 260, - D3D12_FILTER_MINIMUM_MIN_POINT_MAG_MIP_LINEAR = 261, - D3D12_FILTER_MINIMUM_MIN_LINEAR_MAG_MIP_POINT = 272, - D3D12_FILTER_MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 273, - D3D12_FILTER_MINIMUM_MIN_MAG_LINEAR_MIP_POINT = 276, - D3D12_FILTER_MINIMUM_MIN_MAG_MIP_LINEAR = 277, - D3D12_FILTER_MINIMUM_ANISOTROPIC = 341, - D3D12_FILTER_MAXIMUM_MIN_MAG_MIP_POINT = 384, - D3D12_FILTER_MAXIMUM_MIN_MAG_POINT_MIP_LINEAR = 385, - D3D12_FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 388, - D3D12_FILTER_MAXIMUM_MIN_POINT_MAG_MIP_LINEAR = 389, - D3D12_FILTER_MAXIMUM_MIN_LINEAR_MAG_MIP_POINT = 400, - D3D12_FILTER_MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 401, - D3D12_FILTER_MAXIMUM_MIN_MAG_LINEAR_MIP_POINT = 404, - D3D12_FILTER_MAXIMUM_MIN_MAG_MIP_LINEAR = 405, - D3D12_FILTER_MAXIMUM_ANISOTROPIC = 469, -}} - -ENUM!{ enum D3D12_FILTER_REDUCTION_TYPE { - D3D12_FILTER_REDUCTION_TYPE_STANDARD = 0, - D3D12_FILTER_REDUCTION_TYPE_COMPARISON = 1, - D3D12_FILTER_REDUCTION_TYPE_MINIMUM = 2, - D3D12_FILTER_REDUCTION_TYPE_MAXIMUM = 3, -}} - -ENUM!{ enum D3D12_FILTER_TYPE { - D3D12_FILTER_TYPE_POINT = 0, - D3D12_FILTER_TYPE_LINEAR = 1, -}} - - - -FLAGS!{ enum D3D12_HEAP_FLAGS { - D3D12_HEAP_FLAG_NONE = 0x0, - D3D12_HEAP_FLAG_SHARED = 0x1, - D3D12_HEAP_FLAG_DENY_BUFFERS = 0x4, - D3D12_HEAP_FLAG_ALLOW_DISPLAY = 0x8, - D3D12_HEAP_FLAG_SHARED_CROSS_ADAPTER = 0x20, - D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES = 0x40, - D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES = 0x80, - D3D12_HEAP_FLAG_ALLOW_ALL_BUFFERS_AND_TEXTURES = 0x0, - D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS = 0xC0, - D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES = 0x44, - D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES = 0x84, -}} - -ENUM!{ enum D3D12_HEAP_TYPE { - D3D12_HEAP_TYPE_DEFAULT = 1, - D3D12_HEAP_TYPE_UPLOAD = 2, - D3D12_HEAP_TYPE_READBACK = 3, - D3D12_HEAP_TYPE_CUSTOM = 4, -}} - - - -ENUM!{ enum D3D12_INDIRECT_ARGUMENT_TYPE { - D3D12_INDIRECT_ARGUMENT_TYPE_DRAW = 0, - D3D12_INDIRECT_ARGUMENT_TYPE_DRAW_INDEXED = 1, - D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH = 2, - D3D12_INDIRECT_ARGUMENT_TYPE_VERTEX_BUFFER_VIEW = 3, - D3D12_INDIRECT_ARGUMENT_TYPE_INDEX_BUFFER_VIEW = 4, - D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT = 5, - D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT_BUFFER_VIEW = 6, - D3D12_INDIRECT_ARGUMENT_TYPE_SHADER_RESOURCE_VIEW = 7, - D3D12_INDIRECT_ARGUMENT_TYPE_UNORDERED_ACCESS_VIEW = 8, -}} - - - - - -ENUM!{ enum D3D12_MEMORY_POOL { - D3D12_MEMORY_POOL_UNKNOWN = 0, - D3D12_MEMORY_POOL_L0 = 1, - D3D12_MEMORY_POOL_L1 = 2, -}} - - - - -ENUM!{ enum D3D12_PREDICATION_OP { - D3D12_PREDICATION_OP_EQUAL_ZERO = 0, - D3D12_PREDICATION_OP_NOT_EQUAL_ZERO = 1, -}} - - - -ENUM!{ enum D3D12_QUERY_HEAP_TYPE { - D3D12_QUERY_HEAP_TYPE_OCCLUSION = 0, - D3D12_QUERY_HEAP_TYPE_TIMESTAMP = 1, - D3D12_QUERY_HEAP_TYPE_PIPELINE_STATISTICS = 2, - D3D12_QUERY_HEAP_TYPE_SO_STATISTICS = 3, -}} - -ENUM!{ enum D3D12_QUERY_TYPE { - D3D12_QUERY_TYPE_OCCLUSION = 0, - D3D12_QUERY_TYPE_BINARY_OCCLUSION = 1, - D3D12_QUERY_TYPE_TIMESTAMP = 2, - D3D12_QUERY_TYPE_PIPELINE_STATISTICS = 3, - D3D12_QUERY_TYPE_SO_STATISTICS_STREAM0 = 4, - D3D12_QUERY_TYPE_SO_STATISTICS_STREAM1 = 5, - D3D12_QUERY_TYPE_SO_STATISTICS_STREAM2 = 6, - D3D12_QUERY_TYPE_SO_STATISTICS_STREAM3 = 7, -}} - -FLAGS!{ enum D3D12_RESOURCE_BARRIER_FLAGS { - D3D12_RESOURCE_BARRIER_FLAG_NONE = 0x0, - D3D12_RESOURCE_BARRIER_FLAG_BEGIN_ONLY = 0x1, - D3D12_RESOURCE_BARRIER_FLAG_END_ONLY = 0x2, -}} - -ENUM!{ enum D3D12_RESOURCE_BARRIER_TYPE { - D3D12_RESOURCE_BARRIER_TYPE_TRANSITION = 0, - D3D12_RESOURCE_BARRIER_TYPE_ALIASING = 1, - D3D12_RESOURCE_BARRIER_TYPE_UAV = 2, -}} - - -ENUM!{ enum D3D12_RESOURCE_DIMENSION { - D3D12_RESOURCE_DIMENSION_UNKNOWN = 0, - D3D12_RESOURCE_DIMENSION_BUFFER = 1, - D3D12_RESOURCE_DIMENSION_TEXTURE1D = 2, - D3D12_RESOURCE_DIMENSION_TEXTURE2D = 3, - D3D12_RESOURCE_DIMENSION_TEXTURE3D = 4, -}} - -FLAGS!{ enum D3D12_RESOURCE_FLAGS { - D3D12_RESOURCE_FLAG_NONE = 0x0, - D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET = 0x1, - D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL = 0x2, - D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS = 0x4, - D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE = 0x8, - D3D12_RESOURCE_FLAG_ALLOW_CROSS_ADAPTER = 0x10, - D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS = 0x20, -}} - - -FLAGS!{ enum D3D12_RESOURCE_STATES { - D3D12_RESOURCE_STATE_COMMON = 0x0, - D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER = 0x1, - D3D12_RESOURCE_STATE_INDEX_BUFFER = 0x2, - D3D12_RESOURCE_STATE_RENDER_TARGET = 0x4, - D3D12_RESOURCE_STATE_UNORDERED_ACCESS = 0x8, - D3D12_RESOURCE_STATE_DEPTH_WRITE = 0x10, - D3D12_RESOURCE_STATE_DEPTH_READ = 0x20, - D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE = 0x40, - D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE = 0x80, - D3D12_RESOURCE_STATE_STREAM_OUT = 0x100, - D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT = 0x200, - D3D12_RESOURCE_STATE_COPY_DEST = 0x400, - D3D12_RESOURCE_STATE_COPY_SOURCE = 0x800, - D3D12_RESOURCE_STATE_RESOLVE_DEST = 0x1000, - D3D12_RESOURCE_STATE_RESOLVE_SOURCE = 0x2000, - D3D12_RESOURCE_STATE_GENERIC_READ = 0xAC3, - D3D12_RESOURCE_STATE_PRESENT = 0x0, - D3D12_RESOURCE_STATE_PREDICATION = 0x200, -}} - -ENUM!{ enum D3D12_ROOT_PARAMETER_TYPE { - D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE = 0, - D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS = 1, - D3D12_ROOT_PARAMETER_TYPE_CBV = 2, - D3D12_ROOT_PARAMETER_TYPE_SRV = 3, - D3D12_ROOT_PARAMETER_TYPE_UAV = 4, -}} - -FLAGS!{ enum D3D12_ROOT_SIGNATURE_FLAGS { - D3D12_ROOT_SIGNATURE_FLAG_NONE = 0x0, - D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT = 0x1, - D3D12_ROOT_SIGNATURE_FLAG_DENY_VERTEX_SHADER_ROOT_ACCESS = 0x2, - D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS = 0x4, - D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS = 0x8, - D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS = 0x10, - D3D12_ROOT_SIGNATURE_FLAG_DENY_PIXEL_SHADER_ROOT_ACCESS = 0x20, - D3D12_ROOT_SIGNATURE_FLAG_ALLOW_STREAM_OUTPUT = 0x40, -}} - -ENUM!{ enum D3D12_RTV_DIMENSION { - D3D12_RTV_DIMENSION_UNKNOWN = 0, - D3D12_RTV_DIMENSION_BUFFER = 1, - D3D12_RTV_DIMENSION_TEXTURE1D = 2, - D3D12_RTV_DIMENSION_TEXTURE1DARRAY = 3, - D3D12_RTV_DIMENSION_TEXTURE2D = 4, - D3D12_RTV_DIMENSION_TEXTURE2DARRAY = 5, - D3D12_RTV_DIMENSION_TEXTURE2DMS = 6, - D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY = 7, - D3D12_RTV_DIMENSION_TEXTURE3D = 8, -}} - -ENUM!{ enum D3D12_SHADER_COMPONENT_MAPPING { - D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0 = 0, - D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1 = 1, - D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_2 = 2, - D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_3 = 3, - D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0 = 4, - D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1 = 5, -}} - - -ENUM!{ enum D3D12_SHADER_VISIBILITY { - D3D12_SHADER_VISIBILITY_ALL = 0, - D3D12_SHADER_VISIBILITY_VERTEX = 1, - D3D12_SHADER_VISIBILITY_HULL = 2, - D3D12_SHADER_VISIBILITY_DOMAIN = 3, - D3D12_SHADER_VISIBILITY_GEOMETRY = 4, - D3D12_SHADER_VISIBILITY_PIXEL = 5, -}} - -ENUM!{ enum D3D12_SRV_DIMENSION { - D3D12_SRV_DIMENSION_UNKNOWN = 0, - D3D12_SRV_DIMENSION_BUFFER = 1, - D3D12_SRV_DIMENSION_TEXTURE1D = 2, - D3D12_SRV_DIMENSION_TEXTURE1DARRAY = 3, - D3D12_SRV_DIMENSION_TEXTURE2D = 4, - D3D12_SRV_DIMENSION_TEXTURE2DARRAY = 5, - D3D12_SRV_DIMENSION_TEXTURE2DMS = 6, - D3D12_SRV_DIMENSION_TEXTURE2DMSARRAY = 7, - D3D12_SRV_DIMENSION_TEXTURE3D = 8, - D3D12_SRV_DIMENSION_TEXTURECUBE = 9, - D3D12_SRV_DIMENSION_TEXTURECUBEARRAY = 10, -}} - -ENUM!{ enum D3D12_STATIC_BORDER_COLOR { - D3D12_STATIC_BORDER_COLOR_TRANSPARENT_BLACK = 0, - D3D12_STATIC_BORDER_COLOR_OPAQUE_BLACK = 1, - D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE = 2, -}} - - - -ENUM!{ enum D3D12_TEXTURE_ADDRESS_MODE { - D3D12_TEXTURE_ADDRESS_MODE_WRAP = 1, - D3D12_TEXTURE_ADDRESS_MODE_MIRROR = 2, - D3D12_TEXTURE_ADDRESS_MODE_CLAMP = 3, - D3D12_TEXTURE_ADDRESS_MODE_BORDER = 4, - D3D12_TEXTURE_ADDRESS_MODE_MIRROR_ONCE = 5, -}} - -ENUM!{ enum D3D12_TEXTURE_COPY_TYPE { - D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX = 0, - D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT = 1, -}} - -ENUM!{ enum D3D12_TEXTURE_LAYOUT { - D3D12_TEXTURE_LAYOUT_UNKNOWN = 0, - D3D12_TEXTURE_LAYOUT_ROW_MAJOR = 1, - D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE = 2, - D3D12_TEXTURE_LAYOUT_64KB_STANDARD_SWIZZLE = 3, -}} - - -FLAGS!{ enum D3D12_TILE_COPY_FLAGS { - D3D12_TILE_COPY_FLAG_NONE = 0x0, - D3D12_TILE_COPY_FLAG_NO_HAZARD = 0x1, - D3D12_TILE_COPY_FLAG_LINEAR_BUFFER_TO_SWIZZLED_TILED_RESOURCE = 0x2, - D3D12_TILE_COPY_FLAG_SWIZZLED_TILED_RESOURCE_TO_LINEAR_BUFFER = 0x4, -}} - -FLAGS!{ enum D3D12_TILE_MAPPING_FLAGS { - D3D12_TILE_MAPPING_FLAG_NONE = 0x0, - D3D12_TILE_MAPPING_FLAG_NO_HAZARD = 0x1, -}} - -FLAGS!{ enum D3D12_TILE_RANGE_FLAGS { - D3D12_TILE_RANGE_FLAG_NONE = 0x0, - D3D12_TILE_RANGE_FLAG_NULL = 0x1, - D3D12_TILE_RANGE_FLAG_SKIP = 0x2, - D3D12_TILE_RANGE_FLAG_REUSE_SINGLE_TILE = 0x4, -}} - -ENUM!{ enum D3D12_UAV_DIMENSION { - D3D12_UAV_DIMENSION_UNKNOWN = 0, - D3D12_UAV_DIMENSION_BUFFER = 1, - D3D12_UAV_DIMENSION_TEXTURE1D = 2, - D3D12_UAV_DIMENSION_TEXTURE1DARRAY = 3, - D3D12_UAV_DIMENSION_TEXTURE2D = 4, - D3D12_UAV_DIMENSION_TEXTURE2DARRAY = 5, - D3D12_UAV_DIMENSION_TEXTURE3D = 8, -}} - -ENUM!{ enum D3D_ROOT_SIGNATURE_VERSION { - D3D_ROOT_SIGNATURE_VERSION_1 = 1, -}} - - - - - -STRUCT!{struct D3D12_BUFFER_RTV { - FirstElement: ::UINT64, - NumElements: ::UINT, -}} - -STRUCT!{struct D3D12_BUFFER_SRV { - FirstElement: ::UINT64, - NumElements: ::UINT, - StructureByteStride: ::UINT, - Flags: ::D3D12_BUFFER_SRV_FLAGS, -}} - -STRUCT!{struct D3D12_BUFFER_UAV { - FirstElement: ::UINT64, - NumElements: ::UINT, - StructureByteStride: ::UINT, - CounterOffsetInBytes: ::UINT64, - Flags: ::D3D12_BUFFER_UAV_FLAGS, -}} - - - -STRUCT!{struct D3D12_CLEAR_VALUE { - Format: ::DXGI_FORMAT, - u: [::FLOAT; 4], -}} - -UNION!(D3D12_CLEAR_VALUE, u, DepthStencil, DepthStencil_mut, ::D3D12_DEPTH_STENCIL_VALUE); -UNION!(D3D12_CLEAR_VALUE, u, Color, Color_mut, [::FLOAT; 4]); - - - -STRUCT!{struct D3D12_COMMAND_SIGNATURE_DESC { - ByteStride: ::UINT, - NumArgumentDescs: ::UINT, - pArgumentDescs: *const ::D3D12_INDIRECT_ARGUMENT_DESC, - NodeMask: ::UINT, -}} - - - -STRUCT!{struct D3D12_CONSTANT_BUFFER_VIEW_DESC { - BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS, - SizeInBytes: ::UINT, -}} - -STRUCT!{struct D3D12_CPU_DESCRIPTOR_HANDLE { - ptr: ::SIZE_T, -}} - - - -STRUCT!{struct D3D12_DEPTH_STENCIL_VALUE { - Depth: ::FLOAT, - Stencil: ::UINT8, -}} - -STRUCT!{struct D3D12_DEPTH_STENCIL_VIEW_DESC { - Format: ::DXGI_FORMAT, - ViewDimension: ::D3D12_DSV_DIMENSION, - Flags: ::D3D12_DSV_FLAGS, - u: ::D3D12_TEX1D_ARRAY_DSV, -}} - -UNION!(D3D12_DEPTH_STENCIL_VIEW_DESC, u, Texture2DMSArray, Texture2DMSArray_mut, - ::D3D12_TEX2DMS_ARRAY_DSV); -UNION!(D3D12_DEPTH_STENCIL_VIEW_DESC, u, Texture2DMS, Texture2DMS_mut, ::D3D12_TEX2DMS_DSV); -UNION!(D3D12_DEPTH_STENCIL_VIEW_DESC, u, Texture2DArray, Texture2DArray_mut, - ::D3D12_TEX2D_ARRAY_DSV); -UNION!(D3D12_DEPTH_STENCIL_VIEW_DESC, u, Texture2D, Texture2D_mut, ::D3D12_TEX2D_DSV); -UNION!(D3D12_DEPTH_STENCIL_VIEW_DESC, u, Texture1DArray, Texture1DArray_mut, - ::D3D12_TEX1D_ARRAY_DSV); -UNION!(D3D12_DEPTH_STENCIL_VIEW_DESC, u, Texture1D, Texture1D_mut, ::D3D12_TEX1D_DSV); - -STRUCT!{struct D3D12_DESCRIPTOR_HEAP_DESC { - Type: ::D3D12_DESCRIPTOR_HEAP_TYPE, - NumDescriptors: ::UINT, - Flags: ::D3D12_DESCRIPTOR_HEAP_FLAGS, - NodeMask: ::UINT, -}} - -STRUCT!{struct D3D12_DESCRIPTOR_RANGE { - RangeType: ::D3D12_DESCRIPTOR_RANGE_TYPE, - NumDescriptors: ::UINT, - BaseShaderRegister: ::UINT, - RegisterSpace: ::UINT, - OffsetInDescriptorsFromTableStart: ::UINT, -}} - -STRUCT!{struct D3D12_DISCARD_REGION { - NumRects: ::UINT, - pRects: *const ::D3D12_RECT, - FirstSubresource: ::UINT, - NumSubresources: ::UINT, -}} - -STRUCT!{struct D3D12_DISPATCH_ARGUMENTS { - ThreadGroupCountX: ::UINT, - ThreadGroupCountY: ::UINT, - ThreadGroupCountZ: ::UINT, -}} - -STRUCT!{struct D3D12_DRAW_ARGUMENTS { - VertexCountPerInstance: ::UINT, - InstanceCount: ::UINT, - StartVertexLocation: ::UINT, - StartInstanceLocation: ::UINT, -}} - -STRUCT!{struct D3D12_DRAW_INDEXED_ARGUMENTS { - IndexCountPerInstance: ::UINT, - InstanceCount: ::UINT, - StartIndexLocation: ::UINT, - BaseVertexLocation: ::INT, - StartInstanceLocation: ::UINT, -}} - -STRUCT!{struct D3D12_FEATURE_DATA_ARCHITECTURE { - NodeIndex: ::UINT, - TileBasedRenderer: ::BOOL, - UMA: ::BOOL, - CacheCoherentUMA: ::BOOL, -}} - - -STRUCT!{struct D3D12_FEATURE_DATA_FEATURE_LEVELS { - NumFeatureLevels: ::UINT, - pFeatureLevelsRequested: *const ::D3D_FEATURE_LEVEL, - MaxSupportedFeatureLevel: ::D3D_FEATURE_LEVEL, -}} - -STRUCT!{struct D3D12_FEATURE_DATA_FORMAT_INFO { - Format: ::DXGI_FORMAT, - PlaneCount: ::UINT8, -}} - -STRUCT!{struct D3D12_FEATURE_DATA_FORMAT_SUPPORT { - Format: ::DXGI_FORMAT, - Support1: ::D3D12_FORMAT_SUPPORT1, - Support2: ::D3D12_FORMAT_SUPPORT2, -}} - -STRUCT!{struct D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT { - MaxGPUVirtualAddressBitsPerResource: ::UINT, - MaxGPUVirtualAddressBitsPerProcess: ::UINT, -}} - -STRUCT!{struct D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS { - Format: ::DXGI_FORMAT, - SampleCount: ::UINT, - Flags: ::D3D12_MULTISAMPLE_QUALITY_LEVEL_FLAGS, - NumQualityLevels: ::UINT, -}} - -STRUCT!{struct D3D12_GPU_DESCRIPTOR_HANDLE { - ptr: ::UINT64, -}} - - - -STRUCT!{struct D3D12_HEAP_DESC { - SizeInBytes: ::UINT64, - Properties: ::D3D12_HEAP_PROPERTIES, - Alignment: ::UINT64, - Flags: ::D3D12_HEAP_FLAGS, -}} - -STRUCT!{struct D3D12_HEAP_PROPERTIES { - Type: ::D3D12_HEAP_TYPE, - CPUPageProperty: ::D3D12_CPU_PAGE_PROPERTY, - MemoryPoolPreference: ::D3D12_MEMORY_POOL, - CreationNodeMask: ::UINT, - VisibleNodeMask: ::UINT, -}} - -STRUCT!{struct D3D12_INDEX_BUFFER_VIEW { - BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS, - SizeInBytes: ::UINT, - Format: ::DXGI_FORMAT, -}} - -STRUCT!{struct D3D12_INDIRECT_ARGUMENT_DESC_VertexBuffer { - Slot: ::UINT, -}} - -STRUCT!{struct D3D12_INDIRECT_ARGUMENT_DESC_Constant { - RootParameterIndex: ::UINT, - DestOffsetIn32BitValues: ::UINT, - Num32BitValuesToSet: ::UINT, -}} - -STRUCT!{struct D3D12_INDIRECT_ARGUMENT_DESC_ConstantBufferView { - RootParameterIndex: ::UINT, -}} - -STRUCT!{struct D3D12_INDIRECT_ARGUMENT_DESC_ShaderResourceView { - RootParameterIndex: ::UINT, -}} - -STRUCT!{struct D3D12_INDIRECT_ARGUMENT_DESC_UnorderedAccessView { - RootParameterIndex: ::UINT, -}} - -STRUCT!{struct D3D12_INDIRECT_ARGUMENT_DESC { - Type: ::D3D12_INDIRECT_ARGUMENT_TYPE, - u: ::D3D12_INDIRECT_ARGUMENT_DESC_Constant, -}} - -UNION!(D3D12_INDIRECT_ARGUMENT_DESC, u, UnorderedAccessView, UnorderedAccessView_mut, - D3D12_INDIRECT_ARGUMENT_DESC_UnorderedAccessView); -UNION!(D3D12_INDIRECT_ARGUMENT_DESC, u, ShaderResourceView, ShaderResourceView_mut, - D3D12_INDIRECT_ARGUMENT_DESC_ShaderResourceView); -UNION!(D3D12_INDIRECT_ARGUMENT_DESC, u, ConstantBufferView, ConstantBufferView_mut, - D3D12_INDIRECT_ARGUMENT_DESC_ConstantBufferView); -UNION!(D3D12_INDIRECT_ARGUMENT_DESC, u, Constant, Constant_mut, - D3D12_INDIRECT_ARGUMENT_DESC_Constant); -UNION!(D3D12_INDIRECT_ARGUMENT_DESC, u, VertexBuffer, VertexBuffer_mut, - D3D12_INDIRECT_ARGUMENT_DESC_VertexBuffer); - - - - -STRUCT!{struct D3D12_MEMCPY_DEST { - pData: *mut ::c_void, - RowPitch: ::SIZE_T, - SlicePitch: ::SIZE_T, -}} - -STRUCT!{struct D3D12_PACKED_MIP_INFO { - NumStandardMips: ::UINT8, - NumPackedMips: ::UINT8, - NumTilesForPackedMips: ::UINT, - StartTileIndexInOverallResource: ::UINT, -}} - -STRUCT!{struct D3D12_PLACED_SUBRESOURCE_FOOTPRINT { - Offset: ::UINT64, - Footprint: ::D3D12_SUBRESOURCE_FOOTPRINT, -}} - -STRUCT!{struct D3D12_QUERY_DATA_PIPELINE_STATISTICS { - IAVertices: ::UINT64, - IAPrimitives: ::UINT64, - VSInvocations: ::UINT64, - GSInvocations: ::UINT64, - GSPrimitives: ::UINT64, - CInvocations: ::UINT64, - CPrimitives: ::UINT64, - PSInvocations: ::UINT64, - HSInvocations: ::UINT64, - DSInvocations: ::UINT64, - CSInvocations: ::UINT64, -}} - -STRUCT!{struct D3D12_QUERY_DATA_SO_STATISTICS { - NumPrimitivesWritten: ::UINT64, - PrimitivesStorageNeeded: ::UINT64, -}} - -STRUCT!{struct D3D12_QUERY_HEAP_DESC { - Type: ::D3D12_QUERY_HEAP_TYPE, - Count: ::UINT, - NodeMask: ::UINT, -}} - -STRUCT!{struct D3D12_RANGE { - Begin: ::SIZE_T, - End: ::SIZE_T, -}} - - - -STRUCT!{struct D3D12_RENDER_TARGET_VIEW_DESC { - Format: ::DXGI_FORMAT, - ViewDimension: ::D3D12_RTV_DIMENSION, - u: ::D3D12_BUFFER_RTV, -}} - -UNION!(D3D12_RENDER_TARGET_VIEW_DESC, u, Texture3D, Texture3D_mut, ::D3D12_TEX3D_RTV); -UNION!(D3D12_RENDER_TARGET_VIEW_DESC, u, Texture2DMSArray, Texture2DMSArray_mut, - ::D3D12_TEX2DMS_ARRAY_RTV); -UNION!(D3D12_RENDER_TARGET_VIEW_DESC, u, Texture2DMS, Texture2DMS_mut, ::D3D12_TEX2DMS_RTV); -UNION!(D3D12_RENDER_TARGET_VIEW_DESC, u, Texture2DArray, Texture2DArray_mut, - ::D3D12_TEX2D_ARRAY_RTV); -UNION!(D3D12_RENDER_TARGET_VIEW_DESC, u, Texture2D, Texture2D_mut, ::D3D12_TEX2D_RTV); -UNION!(D3D12_RENDER_TARGET_VIEW_DESC, u, Texture1DArray, Texture1DArray_mut, - ::D3D12_TEX1D_ARRAY_RTV); -UNION!(D3D12_RENDER_TARGET_VIEW_DESC, u, Texture1D, Texture1D_mut, ::D3D12_TEX1D_RTV); -UNION!(D3D12_RENDER_TARGET_VIEW_DESC, u, Buffer, Buffer_mut, ::D3D12_BUFFER_RTV); - -STRUCT!{struct D3D12_RESOURCE_ALIASING_BARRIER { - pResourceBefore: *mut ::ID3D12Resource, - pResourceAfter: *mut ::ID3D12Resource, -}} - -STRUCT!{struct D3D12_RESOURCE_ALLOCATION_INFO { - SizeInBytes: ::UINT64, - Alignment: ::UINT64, -}} - -STRUCT!{struct D3D12_RESOURCE_BARRIER { - Type: ::D3D12_RESOURCE_BARRIER_TYPE, - Flags: ::D3D12_RESOURCE_BARRIER_FLAGS, - u: ::D3D12_RESOURCE_TRANSITION_BARRIER, -}} - -UNION!(D3D12_RESOURCE_BARRIER, u, UAV, UAV_mut, ::D3D12_RESOURCE_UAV_BARRIER); -UNION!(D3D12_RESOURCE_BARRIER, u, Aliasing, Aliasing_mut, ::D3D12_RESOURCE_ALIASING_BARRIER); -UNION!(D3D12_RESOURCE_BARRIER, u, Transition, Transition_mut, ::D3D12_RESOURCE_TRANSITION_BARRIER); - -STRUCT!{struct D3D12_RESOURCE_DESC { - Dimension: ::D3D12_RESOURCE_DIMENSION, - Alignment: ::UINT64, - Width: ::UINT64, - Height: ::UINT, - DepthOrArraySize: ::UINT16, - MipLevels: ::UINT16, - Format: ::DXGI_FORMAT, - SampleDesc: ::DXGI_SAMPLE_DESC, - Layout: ::D3D12_TEXTURE_LAYOUT, - Flags: ::D3D12_RESOURCE_FLAGS, -}} - -STRUCT!{struct D3D12_RESOURCE_TRANSITION_BARRIER { - pResource: *mut ::ID3D12Resource, - Subresource: ::UINT, - StateBefore: ::D3D12_RESOURCE_STATES, - StateAfter: ::D3D12_RESOURCE_STATES, -}} - -STRUCT!{struct D3D12_RESOURCE_UAV_BARRIER { - pResource: *mut ::ID3D12Resource, -}} - -STRUCT!{struct D3D12_ROOT_CONSTANTS { - ShaderRegister: ::UINT, - RegisterSpace: ::UINT, - Num32BitValues: ::UINT, -}} - -STRUCT!{struct D3D12_ROOT_DESCRIPTOR { - ShaderRegister: ::UINT, - RegisterSpace: ::UINT, -}} - -STRUCT!{struct D3D12_ROOT_DESCRIPTOR_TABLE { - NumDescriptorRanges: ::UINT, - pDescriptorRanges: *const ::D3D12_DESCRIPTOR_RANGE, -}} - -#[cfg(target_pointer_width = "64")] -STRUCT!{struct D3D12_ROOT_PARAMETER { - ParameterType: ::D3D12_ROOT_PARAMETER_TYPE, - u: ::D3D12_ROOT_DESCRIPTOR_TABLE, - ShaderVisibility: ::D3D12_SHADER_VISIBILITY, -}} - -#[cfg(target_pointer_width = "32")] -STRUCT!{struct D3D12_ROOT_PARAMETER { - ParameterType: ::D3D12_ROOT_PARAMETER_TYPE, - u: ::D3D12_ROOT_CONSTANTS, - ShaderVisibility: ::D3D12_SHADER_VISIBILITY, -}} - -UNION!(D3D12_ROOT_PARAMETER, u, Descriptor, Descriptor_mut, ::D3D12_ROOT_DESCRIPTOR); -UNION!(D3D12_ROOT_PARAMETER, u, Constants, Constants_mut, ::D3D12_ROOT_CONSTANTS); -UNION!(D3D12_ROOT_PARAMETER, u, DescriptorTable, DescriptorTable_mut, - ::D3D12_ROOT_DESCRIPTOR_TABLE); - -STRUCT!{struct D3D12_ROOT_SIGNATURE_DESC { - NumParameters: ::UINT, - pParameters: *const ::D3D12_ROOT_PARAMETER, - NumStaticSamplers: ::UINT, - pStaticSamplers: *const ::D3D12_STATIC_SAMPLER_DESC, - Flags: ::D3D12_ROOT_SIGNATURE_FLAGS, -}} - -STRUCT!{struct D3D12_SAMPLER_DESC { - Filter: ::D3D12_FILTER, - AddressU: ::D3D12_TEXTURE_ADDRESS_MODE, - AddressV: ::D3D12_TEXTURE_ADDRESS_MODE, - AddressW: ::D3D12_TEXTURE_ADDRESS_MODE, - MipLODBias: ::FLOAT, - MaxAnisotropy: ::UINT, - ComparisonFunc: ::D3D12_COMPARISON_FUNC, - BorderColor: [::FLOAT; 4], - MinLOD: ::FLOAT, - MaxLOD: ::FLOAT, -}} - - - -STRUCT!{struct D3D12_SHADER_RESOURCE_VIEW_DESC { - Format: ::DXGI_FORMAT, - ViewDimension: ::D3D12_SRV_DIMENSION, - Shader4ComponentMapping: ::UINT, - u: ::D3D12_BUFFER_SRV, -}} - -UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, TextureCubeArray, TextureCubeArray_mut, - ::D3D12_TEXCUBE_ARRAY_SRV); -UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, TextureCube, TextureCube_mut, ::D3D12_TEXCUBE_SRV); -UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, Texture3D, Texture3D_mut, ::D3D12_TEX3D_SRV); -UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, Texture2DMSArray, Texture2DMSArray_mut, - ::D3D12_TEX2DMS_ARRAY_SRV); -UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, Texture2DMS, Texture2DMS_mut, ::D3D12_TEX2DMS_SRV); -UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, Texture2DArray, Texture2DArray_mut, - ::D3D12_TEX2D_ARRAY_SRV); -UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, Texture2D, Texture2D_mut, ::D3D12_TEX2D_SRV); -UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, Texture1DArray, Texture1DArray_mut, - ::D3D12_TEX1D_ARRAY_SRV); -UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, Texture1D, Texture1D_mut, ::D3D12_TEX1D_SRV); -UNION!(D3D12_SHADER_RESOURCE_VIEW_DESC, u, Buffer, Buffer_mut, ::D3D12_BUFFER_SRV); - - - -STRUCT!{struct D3D12_STATIC_SAMPLER_DESC { - Filter: ::D3D12_FILTER, - AddressU: ::D3D12_TEXTURE_ADDRESS_MODE, - AddressV: ::D3D12_TEXTURE_ADDRESS_MODE, - AddressW: ::D3D12_TEXTURE_ADDRESS_MODE, - MipLODBias: ::FLOAT, - MaxAnisotropy: ::UINT, - ComparisonFunc: ::D3D12_COMPARISON_FUNC, - BorderColor: ::D3D12_STATIC_BORDER_COLOR, - MinLOD: ::FLOAT, - MaxLOD: ::FLOAT, - ShaderRegister: ::UINT, - RegisterSpace: ::UINT, - ShaderVisibility: ::D3D12_SHADER_VISIBILITY, -}} - -STRUCT!{struct D3D12_STREAM_OUTPUT_BUFFER_VIEW { - BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS, - SizeInBytes: ::UINT64, - BufferFilledSizeLocation: ::D3D12_GPU_VIRTUAL_ADDRESS, -}} - - - -STRUCT!{struct D3D12_SUBRESOURCE_DATA { - pData: *const ::c_void, - RowPitch: ::LONG_PTR, - SlicePitch: ::LONG_PTR, -}} - -STRUCT!{struct D3D12_SUBRESOURCE_FOOTPRINT { - Format: ::DXGI_FORMAT, - Width: ::UINT, - Height: ::UINT, - Depth: ::UINT, - RowPitch: ::UINT, -}} - -STRUCT!{struct D3D12_SUBRESOURCE_INFO { - Offset: ::UINT64, - RowPitch: ::UINT, - DepthPitch: ::UINT, -}} - -STRUCT!{struct D3D12_SUBRESOURCE_TILING { - WidthInTiles: ::UINT, - HeightInTiles: ::UINT16, - DepthInTiles: ::UINT16, - StartTileIndexInOverallResource: ::UINT, -}} - -STRUCT!{struct D3D12_TEX1D_ARRAY_DSV { - MipSlice: ::UINT, - FirstArraySlice: ::UINT, - ArraySize: ::UINT, -}} - -STRUCT!{struct D3D12_TEX1D_ARRAY_RTV { - MipSlice: ::UINT, - FirstArraySlice: ::UINT, - ArraySize: ::UINT, -}} - -STRUCT!{struct D3D12_TEX1D_ARRAY_SRV { - MostDetailedMip: ::UINT, - MipLevels: ::UINT, - FirstArraySlice: ::UINT, - ArraySize: ::UINT, - ResourceMinLODClamp: ::FLOAT, -}} - -STRUCT!{struct D3D12_TEX1D_ARRAY_UAV { - MipSlice: ::UINT, - FirstArraySlice: ::UINT, - ArraySize: ::UINT, -}} - -STRUCT!{struct D3D12_TEX1D_DSV { - MipSlice: ::UINT, -}} - -STRUCT!{struct D3D12_TEX1D_RTV { - MipSlice: ::UINT, -}} - -STRUCT!{struct D3D12_TEX1D_SRV { - MostDetailedMip: ::UINT, - MipLevels: ::UINT, - ResourceMinLODClamp: ::FLOAT, -}} - -STRUCT!{struct D3D12_TEX1D_UAV { - MipSlice: ::UINT, -}} - -STRUCT!{struct D3D12_TEX2DMS_ARRAY_DSV { - FirstArraySlice: ::UINT, - ArraySize: ::UINT, -}} - -STRUCT!{struct D3D12_TEX2DMS_ARRAY_RTV { - FirstArraySlice: ::UINT, - ArraySize: ::UINT, -}} - -STRUCT!{struct D3D12_TEX2DMS_ARRAY_SRV { - FirstArraySlice: ::UINT, - ArraySize: ::UINT, -}} - -STRUCT!{struct D3D12_TEX2DMS_DSV { - UnusedField_NothingToDefine: ::UINT, -}} - -STRUCT!{struct D3D12_TEX2DMS_RTV { - UnusedField_NothingToDefine: ::UINT, -}} - -STRUCT!{struct D3D12_TEX2DMS_SRV { - UnusedField_NothingToDefine: ::UINT, -}} - -STRUCT!{struct D3D12_TEX2D_ARRAY_DSV { - MipSlice: ::UINT, - FirstArraySlice: ::UINT, - ArraySize: ::UINT, -}} - -STRUCT!{struct D3D12_TEX2D_ARRAY_RTV { - MipSlice: ::UINT, - FirstArraySlice: ::UINT, - ArraySize: ::UINT, - PlaneSlice: ::UINT, -}} - -STRUCT!{struct D3D12_TEX2D_ARRAY_SRV { - MostDetailedMip: ::UINT, - MipLevels: ::UINT, - FirstArraySlice: ::UINT, - ArraySize: ::UINT, - PlaneSlice: ::UINT, - ResourceMinLODClamp: ::FLOAT, -}} - -STRUCT!{struct D3D12_TEX2D_ARRAY_UAV { - MipSlice: ::UINT, - FirstArraySlice: ::UINT, - ArraySize: ::UINT, - PlaneSlice: ::UINT, -}} - -STRUCT!{struct D3D12_TEX2D_DSV { - MipSlice: ::UINT, -}} - -STRUCT!{struct D3D12_TEX2D_RTV { - MipSlice: ::UINT, - PlaneSlice: ::UINT, -}} - -STRUCT!{struct D3D12_TEX2D_SRV { - MostDetailedMip: ::UINT, - MipLevels: ::UINT, - PlaneSlice: ::UINT, - ResourceMinLODClamp: ::FLOAT, -}} - -STRUCT!{struct D3D12_TEX2D_UAV { - MipSlice: ::UINT, - PlaneSlice: ::UINT, -}} - -STRUCT!{struct D3D12_TEX3D_RTV { - MipSlice: ::UINT, - FirstWSlice: ::UINT, - WSize: ::UINT, -}} - -STRUCT!{struct D3D12_TEX3D_SRV { - MostDetailedMip: ::UINT, - MipLevels: ::UINT, - ResourceMinLODClamp: ::FLOAT, -}} - -STRUCT!{struct D3D12_TEX3D_UAV { - MipSlice: ::UINT, - FirstWSlice: ::UINT, - WSize: ::UINT, -}} - -STRUCT!{struct D3D12_TEXCUBE_ARRAY_SRV { - MostDetailedMip: ::UINT, - MipLevels: ::UINT, - First2DArrayFace: ::UINT, - NumCubes: ::UINT, - ResourceMinLODClamp: ::FLOAT, -}} - -STRUCT!{struct D3D12_TEXCUBE_SRV { - MostDetailedMip: ::UINT, - MipLevels: ::UINT, - ResourceMinLODClamp: ::FLOAT, -}} - -STRUCT!{struct D3D12_TEXTURE_COPY_LOCATION { - pResource: *mut ::ID3D12Resource, - Type: ::D3D12_TEXTURE_COPY_TYPE, - u: ::D3D12_PLACED_SUBRESOURCE_FOOTPRINT, -}} - -UNION!(D3D12_TEXTURE_COPY_LOCATION, u, SubresourceIndex, SubresourceIndex_mut, ::UINT); -UNION!(D3D12_TEXTURE_COPY_LOCATION, u, PlacedFootprint, PlacedFootprint_mut, - ::D3D12_PLACED_SUBRESOURCE_FOOTPRINT); - -STRUCT!{struct D3D12_TILED_RESOURCE_COORDINATE { - X: ::UINT, - Y: ::UINT, - Z: ::UINT, - Subresource: ::UINT, -}} - -STRUCT!{struct D3D12_TILE_REGION_SIZE { - NumTiles: ::UINT, - UseBox: ::BOOL, - Width: ::UINT, - Height: ::UINT16, - Depth: ::UINT16, -}} - -STRUCT!{struct D3D12_TILE_SHAPE { - WidthInTexels: ::UINT, - HeightInTexels: ::UINT, - DepthInTexels: ::UINT, -}} - -STRUCT!{struct D3D12_UNORDERED_ACCESS_VIEW_DESC { - Format: ::DXGI_FORMAT, - ViewDimension: ::D3D12_UAV_DIMENSION, - u: ::D3D12_BUFFER_UAV, -}} - -UNION!(D3D12_UNORDERED_ACCESS_VIEW_DESC, u, Texture3D, Texture3D_mut, ::D3D12_TEX3D_UAV); -UNION!(D3D12_UNORDERED_ACCESS_VIEW_DESC, u, Texture2DArray, Texture2DArray_mut, - ::D3D12_TEX2D_ARRAY_UAV); -UNION!(D3D12_UNORDERED_ACCESS_VIEW_DESC, u, Texture2D, Texture2D_mut, ::D3D12_TEX2D_UAV); -UNION!(D3D12_UNORDERED_ACCESS_VIEW_DESC, u, Texture1DArray, Texture1DArray_mut, - ::D3D12_TEX1D_ARRAY_UAV); -UNION!(D3D12_UNORDERED_ACCESS_VIEW_DESC, u, Texture1D, Texture1D_mut, ::D3D12_TEX1D_UAV); -UNION!(D3D12_UNORDERED_ACCESS_VIEW_DESC, u, Buffer, Buffer_mut, ::D3D12_BUFFER_UAV); - -STRUCT!{struct D3D12_VERTEX_BUFFER_VIEW { - BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS, - SizeInBytes: ::UINT, - StrideInBytes: ::UINT, -}} - - - -RIDL!( -interface ID3D12CommandAllocator(ID3D12CommandAllocatorVtbl): ID3D12Pageable(ID3D12PageableVtbl) { - fn Reset(&mut self) -> ::HRESULT -}); - -RIDL!( -interface ID3D12CommandList(ID3D12CommandListVtbl): ID3D12DeviceChild(ID3D12DeviceChildVtbl) { - fn GetType(&mut self) -> ::D3D12_COMMAND_LIST_TYPE -}); - -RIDL!( -interface ID3D12CommandQueue(ID3D12CommandQueueVtbl): ID3D12Pageable(ID3D12PageableVtbl) { - fn UpdateTileMappings( - &mut self, pResource: *mut ::ID3D12Resource, NumResourceRegions: ::UINT, - pResourceRegionStartCoordinates: *const ::D3D12_TILED_RESOURCE_COORDINATE, - pResourceRegionSizes: *const ::D3D12_TILE_REGION_SIZE, pHeap: *mut ::ID3D12Heap, - NumRanges: ::UINT, pRangeFlags: *const ::D3D12_TILE_RANGE_FLAGS, - pHeapRangeStartOffsets: *const ::UINT, pRangeTileCounts: *const ::UINT, - Flags: ::D3D12_TILE_MAPPING_FLAGS - ) -> (), - fn CopyTileMappings( - &mut self, pDstResource: *mut ::ID3D12Resource, - pDstRegionStartCoordinate: *const ::D3D12_TILED_RESOURCE_COORDINATE, - pSrcResource: *mut ::ID3D12Resource, - pSrcRegionStartCoordinate: *const ::D3D12_TILED_RESOURCE_COORDINATE, - pRegionSize: *const ::D3D12_TILE_REGION_SIZE, Flags: ::D3D12_TILE_MAPPING_FLAGS - ) -> (), - fn ExecuteCommandLists( - &mut self, NumCommandLists: ::UINT, ppCommandLists: *mut *mut ::ID3D12CommandList - ) -> (), - fn SetMarker( - &mut self, Metadata: ::UINT, pData: *const ::c_void, Size: ::UINT - ) -> (), - fn BeginEvent( - &mut self, Metadata: ::UINT, pData: *const ::c_void, Size: ::UINT - ) -> (), - fn EndEvent(&mut self) -> (), - fn Signal( - &mut self, pFence: *mut ::ID3D12Fence, Value: ::UINT64 - ) -> ::HRESULT, - fn Wait( - &mut self, pFence: *mut ::ID3D12Fence, Value: ::UINT64 - ) -> ::HRESULT, - fn GetTimestampFrequency(&mut self, pFrequency: *mut ::UINT64) -> ::HRESULT, - fn GetClockCalibration( - &mut self, pGpuTimestamp: *mut ::UINT64, pCpuTimestamp: *mut ::UINT64 - ) -> ::HRESULT, - fn GetDesc( - &mut self, __ret_val: *mut ::D3D12_COMMAND_QUEUE_DESC - ) -> *mut ::D3D12_COMMAND_QUEUE_DESC -}); - -RIDL!( -interface ID3D12CommandSignature(ID3D12CommandSignatureVtbl): ID3D12Pageable(ID3D12PageableVtbl) { -}); - -RIDL!( -interface ID3D12DescriptorHeap(ID3D12DescriptorHeapVtbl): ID3D12Pageable(ID3D12PageableVtbl) { - fn GetDesc( - &mut self, __ret_val: *mut ::D3D12_DESCRIPTOR_HEAP_DESC - ) -> *mut ::D3D12_DESCRIPTOR_HEAP_DESC, - fn GetCPUDescriptorHandleForHeapStart( - &mut self, __ret_val: *mut ::D3D12_CPU_DESCRIPTOR_HANDLE - ) -> *mut ::D3D12_CPU_DESCRIPTOR_HANDLE, - fn GetGPUDescriptorHandleForHeapStart( - &mut self, __ret_val: *mut ::D3D12_GPU_DESCRIPTOR_HANDLE - ) -> *mut ::D3D12_GPU_DESCRIPTOR_HANDLE -}); - - - -RIDL!( -interface ID3D12Device(ID3D12DeviceVtbl): ID3D12Object(ID3D12ObjectVtbl) { - fn GetNodeCount(&mut self) -> ::UINT, - fn CreateCommandQueue( - &mut self, pDesc: *const ::D3D12_COMMAND_QUEUE_DESC, riid: ::REFGUID, - ppCommandQueue: *mut *mut ::c_void - ) -> ::HRESULT, - fn CreateCommandAllocator( - &mut self, type_: ::D3D12_COMMAND_LIST_TYPE, riid: ::REFGUID, - ppCommandAllocator: *mut *mut ::c_void - ) -> ::HRESULT, - fn CreateGraphicsPipelineState( - &mut self, pDesc: *const ::D3D12_GRAPHICS_PIPELINE_STATE_DESC, riid: ::REFGUID, - ppPipelineState: *mut *mut ::c_void - ) -> ::HRESULT, - fn CreateComputePipelineState( - &mut self, pDesc: *const ::D3D12_COMPUTE_PIPELINE_STATE_DESC, riid: ::REFGUID, - ppPipelineState: *mut *mut ::c_void - ) -> ::HRESULT, - fn CreateCommandList( - &mut self, nodeMask: ::UINT, type_: ::D3D12_COMMAND_LIST_TYPE, - pCommandAllocator: *mut ::ID3D12CommandAllocator, - pInitialState: *mut ::ID3D12PipelineState, riid: ::REFGUID, - ppCommandList: *mut *mut ::c_void - ) -> ::HRESULT, - fn CheckFeatureSupport( - &mut self, Feature: ::D3D12_FEATURE, pFeatureSupportData: *mut ::c_void, - FeatureSupportDataSize: ::UINT - ) -> ::HRESULT, - fn CreateDescriptorHeap( - &mut self, pDescriptorHeapDesc: *const ::D3D12_DESCRIPTOR_HEAP_DESC, riid: ::REFGUID, - ppvHeap: *mut *mut ::c_void - ) -> ::HRESULT, - fn GetDescriptorHandleIncrementSize( - &mut self, DescriptorHeapType: ::D3D12_DESCRIPTOR_HEAP_TYPE - ) -> ::UINT, - fn CreateRootSignature( - &mut self, nodeMask: ::UINT, pBlobWithRootSignature: *const ::c_void, - blobLengthInBytes: ::SIZE_T, riid: ::REFGUID, ppvRootSignature: *mut *mut ::c_void - ) -> ::HRESULT, - fn CreateConstantBufferView( - &mut self, pDesc: *const ::D3D12_CONSTANT_BUFFER_VIEW_DESC, - DestDescriptor: ::D3D12_CPU_DESCRIPTOR_HANDLE - ) -> (), - fn CreateShaderResourceView( - &mut self, pResource: *mut ::ID3D12Resource, - pDesc: *const ::D3D12_SHADER_RESOURCE_VIEW_DESC, - DestDescriptor: ::D3D12_CPU_DESCRIPTOR_HANDLE - ) -> (), - fn CreateUnorderedAccessView( - &mut self, pResource: *mut ::ID3D12Resource, pCounterResource: *mut ::ID3D12Resource, - pDesc: *const ::D3D12_UNORDERED_ACCESS_VIEW_DESC, - DestDescriptor: ::D3D12_CPU_DESCRIPTOR_HANDLE - ) -> (), - fn CreateRenderTargetView( - &mut self, pResource: *mut ::ID3D12Resource, pDesc: *const ::D3D12_RENDER_TARGET_VIEW_DESC, - DestDescriptor: ::D3D12_CPU_DESCRIPTOR_HANDLE - ) -> (), - fn CreateDepthStencilView( - &mut self, pResource: *mut ::ID3D12Resource, pDesc: *const ::D3D12_DEPTH_STENCIL_VIEW_DESC, - DestDescriptor: ::D3D12_CPU_DESCRIPTOR_HANDLE - ) -> (), - fn CreateSampler( - &mut self, pDesc: *const ::D3D12_SAMPLER_DESC, - DestDescriptor: ::D3D12_CPU_DESCRIPTOR_HANDLE - ) -> (), - fn CopyDescriptors( - &mut self, NumDestDescriptorRanges: ::UINT, - pDestDescriptorRangeStarts: *const ::D3D12_CPU_DESCRIPTOR_HANDLE, - pDestDescriptorRangeSizes: *const ::UINT, NumSrcDescriptorRanges: ::UINT, - pSrcDescriptorRangeStarts: *const ::D3D12_CPU_DESCRIPTOR_HANDLE, - pSrcDescriptorRangeSizes: *const ::UINT, DescriptorHeapsType: ::D3D12_DESCRIPTOR_HEAP_TYPE - ) -> (), - fn CopyDescriptorsSimple( - &mut self, NumDescriptors: ::UINT, DestDescriptorRangeStart: ::D3D12_CPU_DESCRIPTOR_HANDLE, - SrcDescriptorRangeStart: ::D3D12_CPU_DESCRIPTOR_HANDLE, - DescriptorHeapsType: ::D3D12_DESCRIPTOR_HEAP_TYPE - ) -> (), - fn GetResourceAllocationInfo( - &mut self, visibleMask: ::UINT, numResourceDescs: ::UINT, - pResourceDescs: *const ::D3D12_RESOURCE_DESC, - __ret_val: *mut ::D3D12_RESOURCE_ALLOCATION_INFO - ) -> *mut ::D3D12_RESOURCE_ALLOCATION_INFO, - fn GetCustomHeapProperties( - &mut self, nodeMask: ::UINT, heapType: ::D3D12_HEAP_TYPE, - __ret_val: *mut ::D3D12_HEAP_PROPERTIES - ) -> *mut ::D3D12_HEAP_PROPERTIES, - fn CreateCommittedResource( - &mut self, pHeapProperties: *const ::D3D12_HEAP_PROPERTIES, HeapFlags: ::D3D12_HEAP_FLAGS, - pResourceDesc: *const ::D3D12_RESOURCE_DESC, InitialResourceState: ::D3D12_RESOURCE_STATES, - pOptimizedClearValue: *const ::D3D12_CLEAR_VALUE, riidResource: ::REFGUID, - ppvResource: *mut *mut ::c_void - ) -> ::HRESULT, - fn CreateHeap( - &mut self, pDesc: *const ::D3D12_HEAP_DESC, riid: ::REFGUID, ppvHeap: *mut *mut ::c_void - ) -> ::HRESULT, - fn CreatePlacedResource( - &mut self, pHeap: *mut ::ID3D12Heap, HeapOffset: ::UINT64, - pDesc: *const ::D3D12_RESOURCE_DESC, InitialState: ::D3D12_RESOURCE_STATES, - pOptimizedClearValue: *const ::D3D12_CLEAR_VALUE, riid: ::REFGUID, - ppvResource: *mut *mut ::c_void - ) -> ::HRESULT, - fn CreateReservedResource( - &mut self, pDesc: *const ::D3D12_RESOURCE_DESC, InitialState: ::D3D12_RESOURCE_STATES, - pOptimizedClearValue: *const ::D3D12_CLEAR_VALUE, riid: ::REFGUID, - ppvResource: *mut *mut ::c_void - ) -> ::HRESULT, - fn CreateSharedHandle( - &mut self, pObject: *mut ::ID3D12DeviceChild, pAttributes: *const ::SECURITY_ATTRIBUTES, - Access: ::DWORD, Name: ::LPCWSTR, pHandle: *mut ::HANDLE - ) -> ::HRESULT, - fn OpenSharedHandle( - &mut self, NTHandle: ::HANDLE, riid: ::REFGUID, ppvObj: *mut *mut ::c_void - ) -> ::HRESULT, - fn OpenSharedHandleByName( - &mut self, Name: ::LPCWSTR, Access: ::DWORD, pNTHandle: *mut ::HANDLE - ) -> ::HRESULT, - fn MakeResident( - &mut self, NumObjects: ::UINT, ppObjects: *mut *mut ::ID3D12Pageable - ) -> ::HRESULT, - fn Evict( - &mut self, NumObjects: ::UINT, ppObjects: *mut *mut ::ID3D12Pageable - ) -> ::HRESULT, - fn CreateFence( - &mut self, InitialValue: ::UINT64, Flags: ::D3D12_FENCE_FLAGS, riid: ::REFGUID, - ppFence: *mut *mut ::c_void - ) -> ::HRESULT, - fn GetDeviceRemovedReason(&mut self) -> ::HRESULT, - fn GetCopyableFootprints( - &mut self, pResourceDesc: *const ::D3D12_RESOURCE_DESC, FirstSubresource: ::UINT, - NumSubresources: ::UINT, BaseOffset: ::UINT64, - pLayouts: *mut ::D3D12_PLACED_SUBRESOURCE_FOOTPRINT, pNumRows: *mut ::UINT, - pRowSizeInBytes: *mut ::UINT64, pTotalBytes: *mut ::UINT64 - ) -> (), - fn CreateQueryHeap( - &mut self, pDesc: *const ::D3D12_QUERY_HEAP_DESC, riid: ::REFGUID, - ppvHeap: *mut *mut ::c_void - ) -> ::HRESULT, - fn SetStablePowerState(&mut self, Enable: ::BOOL) -> ::HRESULT, - fn CreateCommandSignature( - &mut self, pDesc: *const ::D3D12_COMMAND_SIGNATURE_DESC, - pRootSignature: *mut ::ID3D12RootSignature, riid: ::REFGUID, - ppvCommandSignature: *mut *mut ::c_void - ) -> ::HRESULT, - fn GetResourceTiling( - &mut self, pTiledResource: *mut ::ID3D12Resource, pNumTilesForEntireResource: *mut ::UINT, - pPackedMipDesc: *mut ::D3D12_PACKED_MIP_INFO, - pStandardTileShapeForNonPackedMips: *mut ::D3D12_TILE_SHAPE, - pNumSubresourceTilings: *mut ::UINT, FirstSubresourceTilingToGet: ::UINT, - pSubresourceTilingsForNonPackedMips: *mut ::D3D12_SUBRESOURCE_TILING - ) -> (), - fn GetAdapterLuid(&mut self, __ret_val: *mut ::LUID) -> *mut ::LUID -}); - -RIDL!( -interface ID3D12Fence(ID3D12FenceVtbl): ID3D12Pageable(ID3D12PageableVtbl) { - fn GetCompletedValue(&mut self) -> ::UINT64, - fn SetEventOnCompletion( - &mut self, Value: ::UINT64, hEvent: ::HANDLE - ) -> ::HRESULT, - fn Signal(&mut self, Value: ::UINT64) -> ::HRESULT -}); - -RIDL!( -interface ID3D12GraphicsCommandList(ID3D12GraphicsCommandListVtbl): ID3D12CommandList(ID3D12CommandListVtbl) { - fn Close(&mut self) -> ::HRESULT, - fn Reset( - &mut self, pAllocator: *mut ::ID3D12CommandAllocator, - pInitialState: *mut ::ID3D12PipelineState - ) -> ::HRESULT, - fn ClearState(&mut self, pPipelineState: *mut ::ID3D12PipelineState) -> (), - fn DrawInstanced( - &mut self, VertexCountPerInstance: ::UINT, InstanceCount: ::UINT, - StartVertexLocation: ::UINT, StartInstanceLocation: ::UINT - ) -> (), - fn DrawIndexedInstanced( - &mut self, IndexCountPerInstance: ::UINT, InstanceCount: ::UINT, - StartIndexLocation: ::UINT, BaseVertexLocation: ::INT, StartInstanceLocation: ::UINT - ) -> (), - fn Dispatch( - &mut self, ThreadGroupCountX: ::UINT, ThreadGroupCountY: ::UINT, ThreadGroupCountZ: ::UINT - ) -> (), - fn CopyBufferRegion( - &mut self, pDstBuffer: *mut ::ID3D12Resource, DstOffset: ::UINT64, - pSrcBuffer: *mut ::ID3D12Resource, SrcOffset: ::UINT64, NumBytes: ::UINT64 - ) -> (), - fn CopyTextureRegion( - &mut self, pDst: *const ::D3D12_TEXTURE_COPY_LOCATION, DstX: ::UINT, DstY: ::UINT, - DstZ: ::UINT, pSrc: *const ::D3D12_TEXTURE_COPY_LOCATION, pSrcBox: *const ::D3D12_BOX - ) -> (), - fn CopyResource( - &mut self, pDstResource: *mut ::ID3D12Resource, pSrcResource: *mut ::ID3D12Resource - ) -> (), - fn CopyTiles( - &mut self, pTiledResource: *mut ::ID3D12Resource, - pTileRegionStartCoordinate: *const ::D3D12_TILED_RESOURCE_COORDINATE, - pTileRegionSize: *const ::D3D12_TILE_REGION_SIZE, pBuffer: *mut ::ID3D12Resource, - BufferStartOffsetInBytes: ::UINT64, Flags: ::D3D12_TILE_COPY_FLAGS - ) -> (), - fn ResolveSubresource( - &mut self, pDstResource: *mut ::ID3D12Resource, DstSubresource: ::UINT, - pSrcResource: *mut ::ID3D12Resource, SrcSubresource: ::UINT, Format: ::DXGI_FORMAT - ) -> (), - fn IASetPrimitiveTopology( - &mut self, PrimitiveTopology: ::D3D12_PRIMITIVE_TOPOLOGY - ) -> (), - fn RSSetViewports( - &mut self, NumViewports: ::UINT, pViewports: *const ::D3D12_VIEWPORT - ) -> (), - fn RSSetScissorRects( - &mut self, NumRects: ::UINT, pRects: *const ::D3D12_RECT - ) -> (), - fn OMSetBlendFactor(&mut self, BlendFactor: *const [::FLOAT; 4]) -> (), - fn OMSetStencilRef(&mut self, StencilRef: ::UINT) -> (), - fn SetPipelineState( - &mut self, pPipelineState: *mut ::ID3D12PipelineState - ) -> (), - fn ResourceBarrier( - &mut self, NumBarriers: ::UINT, pBarriers: *const ::D3D12_RESOURCE_BARRIER - ) -> (), - fn ExecuteBundle( - &mut self, pCommandList: *mut ::ID3D12GraphicsCommandList - ) -> (), - fn SetDescriptorHeaps( - &mut self, NumDescriptorHeaps: ::UINT, ppDescriptorHeaps: *mut *mut ::ID3D12DescriptorHeap - ) -> (), - fn SetComputeRootSignature( - &mut self, pRootSignature: *mut ::ID3D12RootSignature - ) -> (), - fn SetGraphicsRootSignature( - &mut self, pRootSignature: *mut ::ID3D12RootSignature - ) -> (), - fn SetComputeRootDescriptorTable( - &mut self, RootParameterIndex: ::UINT, BaseDescriptor: ::D3D12_GPU_DESCRIPTOR_HANDLE - ) -> (), - fn SetGraphicsRootDescriptorTable( - &mut self, RootParameterIndex: ::UINT, BaseDescriptor: ::D3D12_GPU_DESCRIPTOR_HANDLE - ) -> (), - fn SetComputeRoot32BitConstant( - &mut self, RootParameterIndex: ::UINT, SrcData: ::UINT, DestOffsetIn32BitValues: ::UINT - ) -> (), - fn SetGraphicsRoot32BitConstant( - &mut self, RootParameterIndex: ::UINT, SrcData: ::UINT, DestOffsetIn32BitValues: ::UINT - ) -> (), - fn SetComputeRoot32BitConstants( - &mut self, RootParameterIndex: ::UINT, Num32BitValuesToSet: ::UINT, - pSrcData: *const ::c_void, DestOffsetIn32BitValues: ::UINT - ) -> (), - fn SetGraphicsRoot32BitConstants( - &mut self, RootParameterIndex: ::UINT, Num32BitValuesToSet: ::UINT, - pSrcData: *const ::c_void, DestOffsetIn32BitValues: ::UINT - ) -> (), - fn SetComputeRootConstantBufferView( - &mut self, RootParameterIndex: ::UINT, BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS - ) -> (), - fn SetGraphicsRootConstantBufferView( - &mut self, RootParameterIndex: ::UINT, BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS - ) -> (), - fn SetComputeRootShaderResourceView( - &mut self, RootParameterIndex: ::UINT, BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS - ) -> (), - fn SetGraphicsRootShaderResourceView( - &mut self, RootParameterIndex: ::UINT, BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS - ) -> (), - fn SetComputeRootUnorderedAccessView( - &mut self, RootParameterIndex: ::UINT, BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS - ) -> (), - fn SetGraphicsRootUnorderedAccessView( - &mut self, RootParameterIndex: ::UINT, BufferLocation: ::D3D12_GPU_VIRTUAL_ADDRESS - ) -> (), - fn IASetIndexBuffer( - &mut self, pView: *const ::D3D12_INDEX_BUFFER_VIEW - ) -> (), - fn IASetVertexBuffers( - &mut self, StartSlot: ::UINT, NumViews: ::UINT, pViews: *const ::D3D12_VERTEX_BUFFER_VIEW - ) -> (), - fn SOSetTargets( - &mut self, StartSlot: ::UINT, NumViews: ::UINT, - pViews: *const ::D3D12_STREAM_OUTPUT_BUFFER_VIEW - ) -> (), - fn OMSetRenderTargets( - &mut self, NumRenderTargetDescriptors: ::UINT, - pRenderTargetDescriptors: *const ::D3D12_CPU_DESCRIPTOR_HANDLE, - RTsSingleHandleToDescriptorRange: ::BOOL, - pDepthStencilDescriptor: *const ::D3D12_CPU_DESCRIPTOR_HANDLE - ) -> (), - fn ClearDepthStencilView( - &mut self, DepthStencilView: ::D3D12_CPU_DESCRIPTOR_HANDLE, - ClearFlags: ::D3D12_CLEAR_FLAGS, Depth: ::FLOAT, Stencil: ::UINT8, NumRects: ::UINT, - pRects: *const ::D3D12_RECT - ) -> (), - fn ClearRenderTargetView( - &mut self, RenderTargetView: ::D3D12_CPU_DESCRIPTOR_HANDLE, ColorRGBA: *const [::FLOAT; 4], - NumRects: ::UINT, pRects: *const ::D3D12_RECT - ) -> (), - fn ClearUnorderedAccessViewUint( - &mut self, ViewGPUHandleInCurrentHeap: ::D3D12_GPU_DESCRIPTOR_HANDLE, - ViewCPUHandle: ::D3D12_CPU_DESCRIPTOR_HANDLE, pResource: *mut ::ID3D12Resource, - Values: *const [::UINT; 4], NumRects: ::UINT, pRects: *const ::D3D12_RECT - ) -> (), - fn ClearUnorderedAccessViewFloat( - &mut self, ViewGPUHandleInCurrentHeap: ::D3D12_GPU_DESCRIPTOR_HANDLE, - ViewCPUHandle: ::D3D12_CPU_DESCRIPTOR_HANDLE, pResource: *mut ::ID3D12Resource, - Values: *const [::FLOAT; 4], NumRects: ::UINT, pRects: *const ::D3D12_RECT - ) -> (), - fn DiscardResource( - &mut self, pResource: *mut ::ID3D12Resource, pRegion: *const ::D3D12_DISCARD_REGION - ) -> (), - fn BeginQuery( - &mut self, pQueryHeap: *mut ::ID3D12QueryHeap, Type: ::D3D12_QUERY_TYPE, Index: ::UINT - ) -> (), - fn EndQuery( - &mut self, pQueryHeap: *mut ::ID3D12QueryHeap, Type: ::D3D12_QUERY_TYPE, Index: ::UINT - ) -> (), - fn ResolveQueryData( - &mut self, pQueryHeap: *mut ::ID3D12QueryHeap, Type: ::D3D12_QUERY_TYPE, - StartIndex: ::UINT, NumQueries: ::UINT, pDestinationBuffer: *mut ::ID3D12Resource, - AlignedDestinationBufferOffset: ::UINT64 - ) -> (), - fn SetPredication( - &mut self, pBuffer: *mut ::ID3D12Resource, AlignedBufferOffset: ::UINT64, - Operation: ::D3D12_PREDICATION_OP - ) -> (), - fn SetMarker( - &mut self, Metadata: ::UINT, pData: *const ::c_void, Size: ::UINT - ) -> (), - fn BeginEvent( - &mut self, Metadata: ::UINT, pData: *const ::c_void, Size: ::UINT - ) -> (), - fn EndEvent(&mut self) -> (), - fn ExecuteIndirect( - &mut self, pCommandSignature: *mut ::ID3D12CommandSignature, MaxCommandCount: ::UINT, - pArgumentBuffer: *mut ::ID3D12Resource, ArgumentBufferOffset: ::UINT64, - pCountBuffer: *mut ::ID3D12Resource, CountBufferOffset: ::UINT64 - ) -> () -}); - -RIDL!( -interface ID3D12Heap(ID3D12HeapVtbl): ID3D12Pageable(ID3D12PageableVtbl) { - fn GetDesc( - &mut self, __ret_val: *mut ::D3D12_HEAP_DESC - ) -> *mut ::D3D12_HEAP_DESC -}); - - - -RIDL!( -interface ID3D12Pageable(ID3D12PageableVtbl): ID3D12DeviceChild(ID3D12DeviceChildVtbl) { -}); - -RIDL!( -interface ID3D12PipelineState(ID3D12PipelineStateVtbl): ID3D12Pageable(ID3D12PageableVtbl) { - fn GetCachedBlob(&mut self, ppBlob: *mut *mut ::ID3DBlob) -> ::HRESULT -}); - -RIDL!( -interface ID3D12QueryHeap(ID3D12QueryHeapVtbl): ID3D12Pageable(ID3D12PageableVtbl) { -}); - -RIDL!( -interface ID3D12Resource(ID3D12ResourceVtbl): ID3D12Pageable(ID3D12PageableVtbl) { - fn Map( - &mut self, Subresource: ::UINT, pReadRange: *const ::D3D12_RANGE, - ppData: *mut *mut ::c_void - ) -> ::HRESULT, - fn Unmap( - &mut self, Subresource: ::UINT, pWrittenRange: *const ::D3D12_RANGE - ) -> (), - fn GetDesc( - &mut self, __ret_val: *mut ::D3D12_RESOURCE_DESC - ) -> *mut ::D3D12_RESOURCE_DESC, - fn GetGPUVirtualAddress(&mut self) -> ::D3D12_GPU_VIRTUAL_ADDRESS, - fn WriteToSubresource( - &mut self, DstSubresource: ::UINT, pDstBox: *const ::D3D12_BOX, pSrcData: *const ::c_void, - SrcRowPitch: ::UINT, SrcDepthPitch: ::UINT - ) -> ::HRESULT, - fn ReadFromSubresource( - &mut self, pDstData: *mut ::c_void, DstRowPitch: ::UINT, DstDepthPitch: ::UINT, - SrcSubresource: ::UINT, pSrcBox: *const ::D3D12_BOX - ) -> ::HRESULT, - fn GetHeapProperties( - &mut self, pHeapProperties: *mut ::D3D12_HEAP_PROPERTIES, - pHeapFlags: *mut ::D3D12_HEAP_FLAGS - ) -> ::HRESULT -}); - -RIDL!( -interface ID3D12RootSignatureDeserializer(ID3D12RootSignatureDeserializerVtbl): IUnknown(IUnknownVtbl) { - fn GetRootSignatureDesc(&mut self) -> *const ::D3D12_ROOT_SIGNATURE_DESC -}); - - - -pub type PFN_D3D12_CREATE_DEVICE = extern "system" fn (_ : *mut ::IUnknown, _ : ::D3D_FEATURE_LEVEL, _ : ::REFGUID, _ : *mut *mut ::c_void) -> ::HRESULT; -pub type PFN_D3D12_CREATE_ROOT_SIGNATURE_DESERIALIZER = extern "system" fn (pSrcData: ::LPCVOID, SrcDataSizeInBytes: ::SIZE_T, pRootSignatureDeserializerInterface: ::REFGUID, ppRootSignatureDeserializer: *mut *mut ::c_void) -> ::HRESULT; -pub type PFN_D3D12_GET_DEBUG_INTERFACE = extern "system" fn (_ : ::REFGUID, _ : *mut *mut ::c_void) -> ::HRESULT; -pub type PFN_D3D12_SERIALIZE_ROOT_SIGNATURE = extern "system" fn (pRootSignature: *const ::D3D12_ROOT_SIGNATURE_DESC, Version: ::D3D_ROOT_SIGNATURE_VERSION, ppBlob: *mut *mut ::ID3DBlob, ppErrorBlob: *mut *mut ::ID3DBlob) -> ::HRESULT; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/d3d12sdklayers.rs cargo-0.37.0/vendor/winapi-0.2.8/src/d3d12sdklayers.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/d3d12sdklayers.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/d3d12sdklayers.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,1063 +0,0 @@ -// Copyright © 2015, Dmitry Roschin -// Licensed under the MIT License -RIDL!{interface ID3D12Debug(ID3D12DebugVtbl): IUnknown(IUnknownVtbl) { - fn EnableDebugLayer(&mut self) -> () -}} -FLAGS!{enum D3D12_DEBUG_FEATURE { - D3D12_DEBUG_FEATURE_NONE = 0, - D3D12_DEBUG_FEATURE_TREAT_BUNDLE_AS_DRAW = 0x1, - D3D12_DEBUG_FEATURE_TREAT_BUNDLE_AS_DISPATCH = 0x2, -}} -FLAGS!{enum D3D12_RLDO_FLAGS { - D3D12_RLDO_NONE = 0x0, - D3D12_RLDO_SUMMARY = 0x1, - D3D12_RLDO_DETAIL = 0x2, - D3D12_RLDO_IGNORE_INTERNAL = 0x4, -}} -RIDL!{interface ID3D12DebugDevice(ID3D12DebugDeviceVtbl): IUnknown(IUnknownVtbl) { - fn SetFeatureMask(&mut self, Mask: ::D3D12_DEBUG_FEATURE) -> ::HRESULT, - fn GetFeatureMask(&mut self) -> ::D3D12_DEBUG_FEATURE, - fn ReportLiveDeviceObjects(&mut self, Flags: ::D3D12_RLDO_FLAGS) -> ::HRESULT -}} -RIDL!{interface ID3D12DebugCommandQueue(ID3D12DebugCommandQueueVtbl): IUnknown(IUnknownVtbl) { - fn AssertResourceState( - &mut self, pResource: *mut ::ID3D12Resource, Subresource: ::UINT, State: ::UINT - ) -> ::BOOL -}} -RIDL!{interface ID3D12DebugCommandList(ID3D12DebugCommandListVtbl): IUnknown(IUnknownVtbl) { - fn AssertResourceState( - &mut self, pResource: *mut ::ID3D12Resource, Subresource: ::UINT, State: ::UINT - ) -> ::BOOL, - fn SetFeatureMask(&mut self, Mask: ::D3D12_DEBUG_FEATURE) -> ::HRESULT, - fn GetFeatureMask(&mut self) -> ::D3D12_DEBUG_FEATURE -}} -ENUM!{enum D3D12_MESSAGE_CATEGORY { - D3D12_MESSAGE_CATEGORY_APPLICATION_DEFINED = 0, - D3D12_MESSAGE_CATEGORY_MISCELLANEOUS = 1, - D3D12_MESSAGE_CATEGORY_INITIALIZATION = 2, - D3D12_MESSAGE_CATEGORY_CLEANUP = 3, - D3D12_MESSAGE_CATEGORY_COMPILATION = 4, - D3D12_MESSAGE_CATEGORY_STATE_CREATION = 5, - D3D12_MESSAGE_CATEGORY_STATE_SETTING = 6, - D3D12_MESSAGE_CATEGORY_STATE_GETTING = 7, - D3D12_MESSAGE_CATEGORY_RESOURCE_MANIPULATION = 8, - D3D12_MESSAGE_CATEGORY_EXECUTION = 9, - D3D12_MESSAGE_CATEGORY_SHADER = 10, -}} -ENUM!{enum D3D12_MESSAGE_SEVERITY { - D3D12_MESSAGE_SEVERITY_CORRUPTION = 0, - D3D12_MESSAGE_SEVERITY_ERROR = 1, - D3D12_MESSAGE_SEVERITY_WARNING = 2, - D3D12_MESSAGE_SEVERITY_INFO = 3, - D3D12_MESSAGE_SEVERITY_MESSAGE = 4, -}} -ENUM!{enum D3D12_MESSAGE_ID { - D3D12_MESSAGE_ID_UNKNOWN = 0, - D3D12_MESSAGE_ID_STRING_FROM_APPLICATION = 1, - D3D12_MESSAGE_ID_CORRUPTED_THIS = 2, - D3D12_MESSAGE_ID_CORRUPTED_PARAMETER1 = 3, - D3D12_MESSAGE_ID_CORRUPTED_PARAMETER2 = 4, - D3D12_MESSAGE_ID_CORRUPTED_PARAMETER3 = 5, - D3D12_MESSAGE_ID_CORRUPTED_PARAMETER4 = 6, - D3D12_MESSAGE_ID_CORRUPTED_PARAMETER5 = 7, - D3D12_MESSAGE_ID_CORRUPTED_PARAMETER6 = 8, - D3D12_MESSAGE_ID_CORRUPTED_PARAMETER7 = 9, - D3D12_MESSAGE_ID_CORRUPTED_PARAMETER8 = 10, - D3D12_MESSAGE_ID_CORRUPTED_PARAMETER9 = 11, - D3D12_MESSAGE_ID_CORRUPTED_PARAMETER10 = 12, - D3D12_MESSAGE_ID_CORRUPTED_PARAMETER11 = 13, - D3D12_MESSAGE_ID_CORRUPTED_PARAMETER12 = 14, - D3D12_MESSAGE_ID_CORRUPTED_PARAMETER13 = 15, - D3D12_MESSAGE_ID_CORRUPTED_PARAMETER14 = 16, - D3D12_MESSAGE_ID_CORRUPTED_PARAMETER15 = 17, - D3D12_MESSAGE_ID_CORRUPTED_MULTITHREADING = 18, - D3D12_MESSAGE_ID_MESSAGE_REPORTING_OUTOFMEMORY = 19, - D3D12_MESSAGE_ID_GETPRIVATEDATA_MOREDATA = 20, - D3D12_MESSAGE_ID_SETPRIVATEDATA_INVALIDFREEDATA = 21, - D3D12_MESSAGE_ID_SETPRIVATEDATA_INVALIDIUNKNOWN = 22, - D3D12_MESSAGE_ID_SETPRIVATEDATA_INVALIDFLAGS = 23, - D3D12_MESSAGE_ID_SETPRIVATEDATA_CHANGINGPARAMS = 24, - D3D12_MESSAGE_ID_SETPRIVATEDATA_OUTOFMEMORY = 25, - D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT = 26, - D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDESC = 27, - D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFORMAT = 28, - D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDVIDEOPLANESLICE = 29, - D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDPLANESLICE = 30, - D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS = 31, - D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDRESOURCE = 32, - D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDARG_RETURN = 33, - D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_OUTOFMEMORY_RETURN = 34, - D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT = 35, - D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT = 36, - D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDESC = 37, - D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDFORMAT = 38, - D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDVIDEOPLANESLICE = 39, - D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDPLANESLICE = 40, - D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDIMENSIONS = 41, - D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDRESOURCE = 42, - D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDARG_RETURN = 43, - D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_OUTOFMEMORY_RETURN = 44, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT = 45, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDESC = 46, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFORMAT = 47, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS = 48, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE = 49, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN = 50, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_OUTOFMEMORY_RETURN = 51, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_OUTOFMEMORY = 52, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_TOOMANYELEMENTS = 53, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDFORMAT = 54, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT = 55, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOT = 56, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS = 57, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH = 58, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE = 59, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE = 60, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDALIGNMENT = 61, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_DUPLICATESEMANTIC = 62, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE = 63, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_NULLSEMANTIC = 64, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_MISSINGELEMENT = 65, - D3D12_MESSAGE_ID_CREATEVERTEXSHADER_OUTOFMEMORY = 66, - D3D12_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERBYTECODE = 67, - D3D12_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERTYPE = 68, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADER_OUTOFMEMORY = 69, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE = 70, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERTYPE = 71, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY = 72, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE = 73, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE = 74, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES = 75, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED = 76, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDDECL = 77, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_EXPECTEDDECL = 78, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED = 79, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT = 80, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT = 81, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT = 82, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT = 83, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION = 84, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT = 85, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE = 86, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC = 87, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH = 88, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS = 89, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX = 90, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE = 91, - D3D12_MESSAGE_ID_CREATEPIXELSHADER_OUTOFMEMORY = 92, - D3D12_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERBYTECODE = 93, - D3D12_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERTYPE = 94, - D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFILLMODE = 95, - D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDCULLMODE = 96, - D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP = 97, - D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS = 98, - D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_NULLDESC = 99, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK = 100, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC = 101, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP = 102, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP = 103, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP = 104, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC = 105, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP = 106, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP = 107, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP = 108, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC = 109, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_NULLDESC = 110, - D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLEND = 111, - D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLEND = 112, - D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOP = 113, - D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLENDALPHA = 114, - D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLENDALPHA = 115, - D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOPALPHA = 116, - D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK = 117, - D3D12_MESSAGE_ID_CREATEBLENDSTATE_NULLDESC = 118, - D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDFILTER = 119, - D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSU = 120, - D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSV = 121, - D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSW = 122, - D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMIPLODBIAS = 123, - D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXANISOTROPY = 124, - D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDCOMPARISONFUNC = 125, - D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMINLOD = 126, - D3D12_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXLOD = 127, - D3D12_MESSAGE_ID_CREATESAMPLERSTATE_NULLDESC = 128, - D3D12_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNRECOGNIZED = 129, - D3D12_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNDEFINED = 130, - D3D12_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_INVALIDVIEWPORT = 131, - D3D12_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_INVALIDSCISSOR = 132, - D3D12_MESSAGE_ID_CLEARRENDERTARGETVIEW_DENORMFLUSH = 133, - D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DENORMFLUSH = 134, - D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_INVALID = 135, - D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCE = 136, - D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDDESTINATIONSTATE = 137, - D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCESTATE = 138, - D3D12_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE = 139, - D3D12_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONBOX = 140, - D3D12_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE = 141, - D3D12_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_INVALID = 142, - D3D12_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_SUBRESOURCE_INVALID = 143, - D3D12_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_INVALID = 144, - D3D12_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_SUBRESOURCE_INVALID = 145, - D3D12_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_FORMAT_INVALID = 146, - D3D12_MESSAGE_ID_BUFFER_MAP_INVALIDMAPTYPE = 147, - D3D12_MESSAGE_ID_BUFFER_MAP_INVALIDFLAGS = 148, - D3D12_MESSAGE_ID_BUFFER_MAP_ALREADYMAPPED = 149, - D3D12_MESSAGE_ID_BUFFER_MAP_DEVICEREMOVED_RETURN = 150, - D3D12_MESSAGE_ID_BUFFER_UNMAP_NOTMAPPED = 151, - D3D12_MESSAGE_ID_TEXTURE1D_MAP_INVALIDMAPTYPE = 152, - D3D12_MESSAGE_ID_TEXTURE1D_MAP_INVALIDSUBRESOURCE = 153, - D3D12_MESSAGE_ID_TEXTURE1D_MAP_INVALIDFLAGS = 154, - D3D12_MESSAGE_ID_TEXTURE1D_MAP_ALREADYMAPPED = 155, - D3D12_MESSAGE_ID_TEXTURE1D_MAP_DEVICEREMOVED_RETURN = 156, - D3D12_MESSAGE_ID_TEXTURE1D_UNMAP_INVALIDSUBRESOURCE = 157, - D3D12_MESSAGE_ID_TEXTURE1D_UNMAP_NOTMAPPED = 158, - D3D12_MESSAGE_ID_TEXTURE2D_MAP_INVALIDMAPTYPE = 159, - D3D12_MESSAGE_ID_TEXTURE2D_MAP_INVALIDSUBRESOURCE = 160, - D3D12_MESSAGE_ID_TEXTURE2D_MAP_INVALIDFLAGS = 161, - D3D12_MESSAGE_ID_TEXTURE2D_MAP_ALREADYMAPPED = 162, - D3D12_MESSAGE_ID_TEXTURE2D_MAP_DEVICEREMOVED_RETURN = 163, - D3D12_MESSAGE_ID_TEXTURE2D_UNMAP_INVALIDSUBRESOURCE = 164, - D3D12_MESSAGE_ID_TEXTURE2D_UNMAP_NOTMAPPED = 165, - D3D12_MESSAGE_ID_TEXTURE3D_MAP_INVALIDMAPTYPE = 166, - D3D12_MESSAGE_ID_TEXTURE3D_MAP_INVALIDSUBRESOURCE = 167, - D3D12_MESSAGE_ID_TEXTURE3D_MAP_INVALIDFLAGS = 168, - D3D12_MESSAGE_ID_TEXTURE3D_MAP_ALREADYMAPPED = 169, - D3D12_MESSAGE_ID_TEXTURE3D_MAP_DEVICEREMOVED_RETURN = 170, - D3D12_MESSAGE_ID_TEXTURE3D_UNMAP_INVALIDSUBRESOURCE = 171, - D3D12_MESSAGE_ID_TEXTURE3D_UNMAP_NOTMAPPED = 172, - D3D12_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_DEPRECATED = 173, - D3D12_MESSAGE_ID_CHECKMULTISAMPLEQUALITYLEVELS_FORMAT_DEPRECATED = 174, - D3D12_MESSAGE_ID_SETEXCEPTIONMODE_UNRECOGNIZEDFLAGS = 175, - D3D12_MESSAGE_ID_SETEXCEPTIONMODE_INVALIDARG_RETURN = 176, - D3D12_MESSAGE_ID_SETEXCEPTIONMODE_DEVICEREMOVED_RETURN = 177, - D3D12_MESSAGE_ID_REF_SIMULATING_INFINITELY_FAST_HARDWARE = 178, - D3D12_MESSAGE_ID_REF_THREADING_MODE = 179, - D3D12_MESSAGE_ID_REF_UMDRIVER_EXCEPTION = 180, - D3D12_MESSAGE_ID_REF_KMDRIVER_EXCEPTION = 181, - D3D12_MESSAGE_ID_REF_HARDWARE_EXCEPTION = 182, - D3D12_MESSAGE_ID_REF_ACCESSING_INDEXABLE_TEMP_OUT_OF_RANGE = 183, - D3D12_MESSAGE_ID_REF_PROBLEM_PARSING_SHADER = 184, - D3D12_MESSAGE_ID_REF_OUT_OF_MEMORY = 185, - D3D12_MESSAGE_ID_REF_INFO = 186, - D3D12_MESSAGE_ID_DEVICE_DRAW_VERTEXPOS_OVERFLOW = 187, - D3D12_MESSAGE_ID_DEVICE_DRAWINDEXED_INDEXPOS_OVERFLOW = 188, - D3D12_MESSAGE_ID_DEVICE_DRAWINSTANCED_VERTEXPOS_OVERFLOW = 189, - D3D12_MESSAGE_ID_DEVICE_DRAWINSTANCED_INSTANCEPOS_OVERFLOW = 190, - D3D12_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INSTANCEPOS_OVERFLOW = 191, - D3D12_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INDEXPOS_OVERFLOW = 192, - D3D12_MESSAGE_ID_DEVICE_DRAW_VERTEX_SHADER_NOT_SET = 193, - D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND = 194, - D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERINDEX = 195, - D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_COMPONENTTYPE = 196, - D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERMASK = 197, - D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SYSTEMVALUE = 198, - D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS = 199, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_ROOT_SIGNATURE_NOT_SET = 200, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_ROOT_SIGNATURE_MISMATCH = 201, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_BUFFER_NOT_SET = 202, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INPUTLAYOUT_NOT_SET = 203, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_CONSTANT_BUFFER_NOT_SET = 204, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_CONSTANT_BUFFER_TOO_SMALL = 205, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_SAMPLER_NOT_SET = 206, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_SHADERRESOURCEVIEW_NOT_SET = 207, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VIEW_DIMENSION_MISMATCH = 208, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL = 209, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_BUFFER_TOO_SMALL = 210, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INDEX_BUFFER_NOT_SET = 211, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INDEX_BUFFER_FORMAT_INVALID = 212, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INDEX_BUFFER_TOO_SMALL = 213, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_GS_INPUT_PRIMITIVE_MISMATCH = 214, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RESOURCE_RETURN_TYPE_MISMATCH = 215, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_POSITION_NOT_PRESENT = 216, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_OUTPUT_STREAM_NOT_SET = 217, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_BOUND_RESOURCE_MAPPED = 218, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INVALID_PRIMITIVETOPOLOGY = 219, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_OFFSET_UNALIGNED = 220, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_VERTEX_STRIDE_UNALIGNED = 221, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INDEX_OFFSET_UNALIGNED = 222, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_OUTPUT_STREAM_OFFSET_UNALIGNED = 223, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RESOURCE_FORMAT_LD_UNSUPPORTED = 224, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED = 225, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RESOURCE_FORMAT_SAMPLE_C_UNSUPPORTED = 226, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RESOURCE_MULTISAMPLE_UNSUPPORTED = 227, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE = 228, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_SO_STRIDE_LARGER_THAN_BUFFER = 229, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING = 230, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 = 231, - D3D12_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_AT_FAULT = 232, - D3D12_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT = 233, - D3D12_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT = 234, - D3D12_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN = 235, - D3D12_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_OUTOFMEMORY_RETURN = 236, - D3D12_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_BADINTERFACE_RETURN = 237, - D3D12_MESSAGE_ID_DEVICE_DRAW_VIEWPORT_NOT_SET = 238, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC = 239, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC = 240, - D3D12_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_DENORMFLUSH = 241, - D3D12_MESSAGE_ID_OMSETRENDERTARGETS_INVALIDVIEW = 242, - D3D12_MESSAGE_ID_DEVICE_SETTEXTFILTERSIZE_INVALIDDIMENSIONS = 243, - D3D12_MESSAGE_ID_DEVICE_DRAW_SAMPLER_MISMATCH = 244, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_TYPE_MISMATCH = 245, - D3D12_MESSAGE_ID_BLENDSTATE_GETDESC_LEGACY = 246, - D3D12_MESSAGE_ID_SHADERRESOURCEVIEW_GETDESC_LEGACY = 247, - D3D12_MESSAGE_ID_DEVICE_DRAW_PS_OUTPUT_TYPE_MISMATCH = 248, - D3D12_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_GATHER_UNSUPPORTED = 249, - D3D12_MESSAGE_ID_DEVICE_DRAW_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN = 250, - D3D12_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_STRIDE_TOO_LARGE = 251, - D3D12_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_INVALIDRANGE = 252, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_EMPTY_LAYOUT = 253, - D3D12_MESSAGE_ID_DEVICE_DRAW_RESOURCE_SAMPLE_COUNT_MISMATCH = 254, - D3D12_MESSAGE_ID_LIVE_OBJECT_SUMMARY = 255, - D3D12_MESSAGE_ID_LIVE_BUFFER = 256, - D3D12_MESSAGE_ID_LIVE_TEXTURE1D = 257, - D3D12_MESSAGE_ID_LIVE_TEXTURE2D = 258, - D3D12_MESSAGE_ID_LIVE_TEXTURE3D = 259, - D3D12_MESSAGE_ID_LIVE_SHADERRESOURCEVIEW = 260, - D3D12_MESSAGE_ID_LIVE_RENDERTARGETVIEW = 261, - D3D12_MESSAGE_ID_LIVE_DEPTHSTENCILVIEW = 262, - D3D12_MESSAGE_ID_LIVE_VERTEXSHADER = 263, - D3D12_MESSAGE_ID_LIVE_GEOMETRYSHADER = 264, - D3D12_MESSAGE_ID_LIVE_PIXELSHADER = 265, - D3D12_MESSAGE_ID_LIVE_INPUTLAYOUT = 266, - D3D12_MESSAGE_ID_LIVE_SAMPLER = 267, - D3D12_MESSAGE_ID_LIVE_BLENDSTATE = 268, - D3D12_MESSAGE_ID_LIVE_DEPTHSTENCILSTATE = 269, - D3D12_MESSAGE_ID_LIVE_RASTERIZERSTATE = 270, - D3D12_MESSAGE_ID_LIVE_QUERY = 271, - D3D12_MESSAGE_ID_LIVE_PREDICATE = 272, - D3D12_MESSAGE_ID_LIVE_COUNTER = 273, - D3D12_MESSAGE_ID_LIVE_DEVICE = 274, - D3D12_MESSAGE_ID_LIVE_SWAPCHAIN = 275, - D3D12_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFLAGS = 276, - D3D12_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDCLASSLINKAGE = 277, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDCLASSLINKAGE = 278, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTREAMS = 279, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAMTORASTERIZER = 280, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTREAMS = 281, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCLASSLINKAGE = 282, - D3D12_MESSAGE_ID_CREATEPIXELSHADER_INVALIDCLASSLINKAGE = 283, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAM = 284, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDENTRIES = 285, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTRIDES = 286, - D3D12_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTRIDES = 287, - D3D12_MESSAGE_ID_CREATEHULLSHADER_INVALIDCALL = 288, - D3D12_MESSAGE_ID_CREATEHULLSHADER_OUTOFMEMORY = 289, - D3D12_MESSAGE_ID_CREATEHULLSHADER_INVALIDSHADERBYTECODE = 290, - D3D12_MESSAGE_ID_CREATEHULLSHADER_INVALIDSHADERTYPE = 291, - D3D12_MESSAGE_ID_CREATEHULLSHADER_INVALIDCLASSLINKAGE = 292, - D3D12_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDCALL = 293, - D3D12_MESSAGE_ID_CREATEDOMAINSHADER_OUTOFMEMORY = 294, - D3D12_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDSHADERBYTECODE = 295, - D3D12_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDSHADERTYPE = 296, - D3D12_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDCLASSLINKAGE = 297, - D3D12_MESSAGE_ID_DEVICE_DRAW_HS_XOR_DS_MISMATCH = 298, - D3D12_MESSAGE_ID_DEVICE_DRAWINDIRECT_INVALID_ARG_BUFFER = 299, - D3D12_MESSAGE_ID_DEVICE_DRAWINDIRECT_OFFSET_UNALIGNED = 300, - D3D12_MESSAGE_ID_DEVICE_DRAWINDIRECT_OFFSET_OVERFLOW = 301, - D3D12_MESSAGE_ID_RESOURCE_MAP_INVALIDMAPTYPE = 302, - D3D12_MESSAGE_ID_RESOURCE_MAP_INVALIDSUBRESOURCE = 303, - D3D12_MESSAGE_ID_RESOURCE_MAP_INVALIDFLAGS = 304, - D3D12_MESSAGE_ID_RESOURCE_MAP_ALREADYMAPPED = 305, - D3D12_MESSAGE_ID_RESOURCE_MAP_DEVICEREMOVED_RETURN = 306, - D3D12_MESSAGE_ID_RESOURCE_MAP_OUTOFMEMORY_RETURN = 307, - D3D12_MESSAGE_ID_RESOURCE_MAP_WITHOUT_INITIAL_DISCARD = 308, - D3D12_MESSAGE_ID_RESOURCE_UNMAP_INVALIDSUBRESOURCE = 309, - D3D12_MESSAGE_ID_RESOURCE_UNMAP_NOTMAPPED = 310, - D3D12_MESSAGE_ID_DEVICE_DRAW_RASTERIZING_CONTROL_POINTS = 311, - D3D12_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNSUPPORTED = 312, - D3D12_MESSAGE_ID_DEVICE_DRAW_HS_DS_SIGNATURE_MISMATCH = 313, - D3D12_MESSAGE_ID_DEVICE_DRAW_HULL_SHADER_INPUT_TOPOLOGY_MISMATCH = 314, - D3D12_MESSAGE_ID_DEVICE_DRAW_HS_DS_CONTROL_POINT_COUNT_MISMATCH = 315, - D3D12_MESSAGE_ID_DEVICE_DRAW_HS_DS_TESSELLATOR_DOMAIN_MISMATCH = 316, - D3D12_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_UNRECOGNIZED_FEATURE = 317, - D3D12_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_MISMATCHED_DATA_SIZE = 318, - D3D12_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_INVALIDARG_RETURN = 319, - D3D12_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDCALL = 320, - D3D12_MESSAGE_ID_CREATECOMPUTESHADER_OUTOFMEMORY = 321, - D3D12_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDSHADERBYTECODE = 322, - D3D12_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDCLASSLINKAGE = 323, - D3D12_MESSAGE_ID_DEVICE_CSSETSHADERRESOURCES_VIEWS_EMPTY = 324, - D3D12_MESSAGE_ID_CSSETCONSTANTBUFFERS_INVALIDBUFFER = 325, - D3D12_MESSAGE_ID_DEVICE_CSSETCONSTANTBUFFERS_BUFFERS_EMPTY = 326, - D3D12_MESSAGE_ID_DEVICE_CSSETSAMPLERS_SAMPLERS_EMPTY = 327, - D3D12_MESSAGE_ID_DEVICE_CSGETSHADERRESOURCES_VIEWS_EMPTY = 328, - D3D12_MESSAGE_ID_DEVICE_CSGETCONSTANTBUFFERS_BUFFERS_EMPTY = 329, - D3D12_MESSAGE_ID_DEVICE_CSGETSAMPLERS_SAMPLERS_EMPTY = 330, - D3D12_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 331, - D3D12_MESSAGE_ID_DEVICE_CREATEHULLSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 332, - D3D12_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 333, - D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 334, - D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DOUBLEFLOATOPSNOTSUPPORTED = 335, - D3D12_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 336, - D3D12_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_DOUBLEFLOATOPSNOTSUPPORTED = 337, - D3D12_MESSAGE_ID_CREATEBUFFER_INVALIDSTRUCTURESTRIDE = 338, - D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFLAGS = 339, - D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDRESOURCE = 340, - D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDESC = 341, - D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDFORMAT = 342, - D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDVIDEOPLANESLICE = 343, - D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDPLANESLICE = 344, - D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDIMENSIONS = 345, - D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_UNRECOGNIZEDFORMAT = 346, - D3D12_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_OVERLAPPING_OLD_SLOTS = 347, - D3D12_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_NO_OP = 348, - D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDARG_RETURN = 349, - D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_OUTOFMEMORY_RETURN = 350, - D3D12_MESSAGE_ID_CLEARUNORDEREDACCESSVIEW_DENORMFLUSH = 351, - D3D12_MESSAGE_ID_DEVICE_CSSETUNORDEREDACCESSS_VIEWS_EMPTY = 352, - D3D12_MESSAGE_ID_DEVICE_CSGETUNORDEREDACCESSS_VIEWS_EMPTY = 353, - D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDFLAGS = 354, - D3D12_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_INVALID_ARG_BUFFER = 355, - D3D12_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_OFFSET_UNALIGNED = 356, - D3D12_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_OFFSET_OVERFLOW = 357, - D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DEPTH_READONLY = 358, - D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_STENCIL_READONLY = 359, - D3D12_MESSAGE_ID_CHECKFEATURESUPPORT_FORMAT_DEPRECATED = 360, - D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_RETURN_TYPE_MISMATCH = 361, - D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_NOT_SET = 362, - D3D12_MESSAGE_ID_DEVICE_DRAW_UNORDEREDACCESSVIEW_RENDERTARGETVIEW_OVERLAP = 363, - D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_DIMENSION_MISMATCH = 364, - D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_APPEND_UNSUPPORTED = 365, - D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMICS_UNSUPPORTED = 366, - D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_STRUCTURE_STRIDE_MISMATCH = 367, - D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_BUFFER_TYPE_MISMATCH = 368, - D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_RAW_UNSUPPORTED = 369, - D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_FORMAT_LD_UNSUPPORTED = 370, - D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_FORMAT_STORE_UNSUPPORTED = 371, - D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_ADD_UNSUPPORTED = 372, - D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_BITWISE_OPS_UNSUPPORTED = 373, - D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_CMPSTORE_CMPEXCHANGE_UNSUPPORTED = 374, - D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_EXCHANGE_UNSUPPORTED = 375, - D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_SIGNED_MINMAX_UNSUPPORTED = 376, - D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_UNSIGNED_MINMAX_UNSUPPORTED = 377, - D3D12_MESSAGE_ID_DEVICE_DISPATCH_BOUND_RESOURCE_MAPPED = 378, - D3D12_MESSAGE_ID_DEVICE_DISPATCH_THREADGROUPCOUNT_OVERFLOW = 379, - D3D12_MESSAGE_ID_DEVICE_DISPATCH_THREADGROUPCOUNT_ZERO = 380, - D3D12_MESSAGE_ID_DEVICE_SHADERRESOURCEVIEW_STRUCTURE_STRIDE_MISMATCH = 381, - D3D12_MESSAGE_ID_DEVICE_SHADERRESOURCEVIEW_BUFFER_TYPE_MISMATCH = 382, - D3D12_MESSAGE_ID_DEVICE_SHADERRESOURCEVIEW_RAW_UNSUPPORTED = 383, - D3D12_MESSAGE_ID_DEVICE_DISPATCH_UNSUPPORTED = 384, - D3D12_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_UNSUPPORTED = 385, - D3D12_MESSAGE_ID_COPYSTRUCTURECOUNT_INVALIDOFFSET = 386, - D3D12_MESSAGE_ID_COPYSTRUCTURECOUNT_LARGEOFFSET = 387, - D3D12_MESSAGE_ID_COPYSTRUCTURECOUNT_INVALIDDESTINATIONSTATE = 388, - D3D12_MESSAGE_ID_COPYSTRUCTURECOUNT_INVALIDSOURCESTATE = 389, - D3D12_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_NOT_SUPPORTED = 390, - D3D12_MESSAGE_ID_CLEARUNORDEREDACCESSVIEWFLOAT_INVALIDFORMAT = 391, - D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_COUNTER_UNSUPPORTED = 392, - D3D12_MESSAGE_ID_DEVICE_DRAW_PIXEL_SHADER_WITHOUT_RTV_OR_DSV = 393, - D3D12_MESSAGE_ID_SHADER_ABORT = 394, - D3D12_MESSAGE_ID_SHADER_MESSAGE = 395, - D3D12_MESSAGE_ID_SHADER_ERROR = 396, - D3D12_MESSAGE_ID_OFFERRESOURCES_INVALIDRESOURCE = 397, - D3D12_MESSAGE_ID_ENQUEUESETEVENT_INVALIDARG_RETURN = 398, - D3D12_MESSAGE_ID_ENQUEUESETEVENT_OUTOFMEMORY_RETURN = 399, - D3D12_MESSAGE_ID_ENQUEUESETEVENT_ACCESSDENIED_RETURN = 400, - D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFORCEDSAMPLECOUNT = 401, - D3D12_MESSAGE_ID_DEVICE_DRAW_INVALID_USE_OF_FORCED_SAMPLE_COUNT = 402, - D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDLOGICOPS = 403, - D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDARRAYWITHDECODER = 404, - D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDARRAYWITHDECODER = 405, - D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDARRAYWITHDECODER = 406, - D3D12_MESSAGE_ID_DEVICE_LOCKEDOUT_INTERFACE = 407, - D3D12_MESSAGE_ID_OFFERRESOURCES_INVALIDPRIORITY = 408, - D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_INVALIDVIEW = 409, - D3D12_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 410, - D3D12_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_SHADEREXTENSIONSNOTSUPPORTED = 411, - D3D12_MESSAGE_ID_DEVICE_CREATEHULLSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 412, - D3D12_MESSAGE_ID_DEVICE_CREATEHULLSHADER_SHADEREXTENSIONSNOTSUPPORTED = 413, - D3D12_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 414, - D3D12_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_SHADEREXTENSIONSNOTSUPPORTED = 415, - D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 416, - D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_SHADEREXTENSIONSNOTSUPPORTED = 417, - D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DOUBLEEXTENSIONSNOTSUPPORTED = 418, - D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_SHADEREXTENSIONSNOTSUPPORTED = 419, - D3D12_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 420, - D3D12_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_SHADEREXTENSIONSNOTSUPPORTED = 421, - D3D12_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 422, - D3D12_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_SHADEREXTENSIONSNOTSUPPORTED = 423, - D3D12_MESSAGE_ID_DEVICE_SHADER_LINKAGE_MINPRECISION = 424, - D3D12_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_UAVSNOTSUPPORTED = 425, - D3D12_MESSAGE_ID_DEVICE_CREATEHULLSHADER_UAVSNOTSUPPORTED = 426, - D3D12_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_UAVSNOTSUPPORTED = 427, - D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_UAVSNOTSUPPORTED = 428, - D3D12_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UAVSNOTSUPPORTED = 429, - D3D12_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_UAVSNOTSUPPORTED = 430, - D3D12_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_UAVSNOTSUPPORTED = 431, - D3D12_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_INVALIDOFFSET = 432, - D3D12_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_TOOMANYVIEWS = 433, - D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_NOTSUPPORTED = 434, - D3D12_MESSAGE_ID_SWAPDEVICECONTEXTSTATE_NOTSUPPORTED = 435, - D3D12_MESSAGE_ID_UPDATESUBRESOURCE_PREFERUPDATESUBRESOURCE1 = 436, - D3D12_MESSAGE_ID_GETDC_INACCESSIBLE = 437, - D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_INVALIDRECT = 438, - D3D12_MESSAGE_ID_DEVICE_DRAW_SAMPLE_MASK_IGNORED_ON_FL9 = 439, - D3D12_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE1_NOT_SUPPORTED = 440, - D3D12_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_BY_NAME_NOT_SUPPORTED = 441, - D3D12_MESSAGE_ID_ENQUEUESETEVENT_NOT_SUPPORTED = 442, - D3D12_MESSAGE_ID_OFFERRELEASE_NOT_SUPPORTED = 443, - D3D12_MESSAGE_ID_OFFERRESOURCES_INACCESSIBLE = 444, - D3D12_MESSAGE_ID_CREATEVIDEOPROCESSORINPUTVIEW_INVALIDMSAA = 445, - D3D12_MESSAGE_ID_CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDMSAA = 446, - D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_INVALIDSOURCERECT = 447, - D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_EMPTYRECT = 448, - D3D12_MESSAGE_ID_UPDATESUBRESOURCE_EMPTYDESTBOX = 449, - D3D12_MESSAGE_ID_COPYSUBRESOURCEREGION_EMPTYSOURCEBOX = 450, - D3D12_MESSAGE_ID_DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_LOGIC_OPS = 451, - D3D12_MESSAGE_ID_DEVICE_DRAW_DEPTHSTENCILVIEW_NOT_SET = 452, - D3D12_MESSAGE_ID_DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET = 453, - D3D12_MESSAGE_ID_DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET_DUE_TO_FLIP_PRESENT = 454, - D3D12_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_NOT_SET_DUE_TO_FLIP_PRESENT = 455, - D3D12_MESSAGE_ID_GETDATAFORNEWHARDWAREKEY_NULLPARAM = 456, - D3D12_MESSAGE_ID_CHECKCRYPTOSESSIONSTATUS_NULLPARAM = 457, - D3D12_MESSAGE_ID_SETEVENTONHARDWARECONTENTPROTECTIONTILT_NULLPARAM = 458, - D3D12_MESSAGE_ID_GETVIDEODECODERCAPS_NULLPARAM = 459, - D3D12_MESSAGE_ID_GETVIDEODECODERCAPS_ZEROWIDTHHEIGHT = 460, - D3D12_MESSAGE_ID_CHECKVIDEODECODERDOWNSAMPLING_NULLPARAM = 461, - D3D12_MESSAGE_ID_CHECKVIDEODECODERDOWNSAMPLING_INVALIDCOLORSPACE = 462, - D3D12_MESSAGE_ID_CHECKVIDEODECODERDOWNSAMPLING_ZEROWIDTHHEIGHT = 463, - D3D12_MESSAGE_ID_VIDEODECODERENABLEDOWNSAMPLING_NULLPARAM = 464, - D3D12_MESSAGE_ID_VIDEODECODERENABLEDOWNSAMPLING_UNSUPPORTED = 465, - D3D12_MESSAGE_ID_VIDEODECODERUPDATEDOWNSAMPLING_NULLPARAM = 466, - D3D12_MESSAGE_ID_VIDEODECODERUPDATEDOWNSAMPLING_UNSUPPORTED = 467, - D3D12_MESSAGE_ID_CHECKVIDEOPROCESSORFORMATCONVERSION_NULLPARAM = 468, - D3D12_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTCOLORSPACE1_NULLPARAM = 469, - D3D12_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTCOLORSPACE1_NULLPARAM = 470, - D3D12_MESSAGE_ID_VIDEOPROCESSORSETSTREAMCOLORSPACE1_NULLPARAM = 471, - D3D12_MESSAGE_ID_VIDEOPROCESSORSETSTREAMCOLORSPACE1_INVALIDSTREAM = 472, - D3D12_MESSAGE_ID_VIDEOPROCESSORSETSTREAMMIRROR_NULLPARAM = 473, - D3D12_MESSAGE_ID_VIDEOPROCESSORSETSTREAMMIRROR_INVALIDSTREAM = 474, - D3D12_MESSAGE_ID_VIDEOPROCESSORSETSTREAMMIRROR_UNSUPPORTED = 475, - D3D12_MESSAGE_ID_VIDEOPROCESSORGETSTREAMCOLORSPACE1_NULLPARAM = 476, - D3D12_MESSAGE_ID_VIDEOPROCESSORGETSTREAMMIRROR_NULLPARAM = 477, - D3D12_MESSAGE_ID_RECOMMENDVIDEODECODERDOWNSAMPLING_NULLPARAM = 478, - D3D12_MESSAGE_ID_RECOMMENDVIDEODECODERDOWNSAMPLING_INVALIDCOLORSPACE = 479, - D3D12_MESSAGE_ID_RECOMMENDVIDEODECODERDOWNSAMPLING_ZEROWIDTHHEIGHT = 480, - D3D12_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTSHADERUSAGE_NULLPARAM = 481, - D3D12_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTSHADERUSAGE_NULLPARAM = 482, - D3D12_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_NULLPARAM = 483, - D3D12_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDSTREAMCOUNT = 484, - D3D12_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_TARGETRECT = 485, - D3D12_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDSOURCERECT = 486, - D3D12_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDDESTRECT = 487, - D3D12_MESSAGE_ID_CREATEBUFFER_INVALIDUSAGE = 488, - D3D12_MESSAGE_ID_CREATETEXTURE1D_INVALIDUSAGE = 489, - D3D12_MESSAGE_ID_CREATETEXTURE2D_INVALIDUSAGE = 490, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_LEVEL9_STEPRATE_NOT_1 = 491, - D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_LEVEL9_INSTANCING_NOT_SUPPORTED = 492, - D3D12_MESSAGE_ID_UPDATETILEMAPPINGS_INVALID_PARAMETER = 493, - D3D12_MESSAGE_ID_COPYTILEMAPPINGS_INVALID_PARAMETER = 494, - D3D12_MESSAGE_ID_COPYTILES_INVALID_PARAMETER = 495, - D3D12_MESSAGE_ID_NULL_TILE_MAPPING_ACCESS_WARNING = 496, - D3D12_MESSAGE_ID_NULL_TILE_MAPPING_ACCESS_ERROR = 497, - D3D12_MESSAGE_ID_DIRTY_TILE_MAPPING_ACCESS = 498, - D3D12_MESSAGE_ID_DUPLICATE_TILE_MAPPINGS_IN_COVERED_AREA = 499, - D3D12_MESSAGE_ID_TILE_MAPPINGS_IN_COVERED_AREA_DUPLICATED_OUTSIDE = 500, - D3D12_MESSAGE_ID_TILE_MAPPINGS_SHARED_BETWEEN_INCOMPATIBLE_RESOURCES = 501, - D3D12_MESSAGE_ID_TILE_MAPPINGS_SHARED_BETWEEN_INPUT_AND_OUTPUT = 502, - D3D12_MESSAGE_ID_CHECKMULTISAMPLEQUALITYLEVELS_INVALIDFLAGS = 503, - D3D12_MESSAGE_ID_GETRESOURCETILING_NONTILED_RESOURCE = 504, - D3D12_MESSAGE_ID_NEED_TO_CALL_TILEDRESOURCEBARRIER = 505, - D3D12_MESSAGE_ID_CREATEDEVICE_INVALIDARGS = 506, - D3D12_MESSAGE_ID_CREATEDEVICE_WARNING = 507, - D3D12_MESSAGE_ID_TILED_RESOURCE_TIER_1_BUFFER_TEXTURE_MISMATCH = 508, - D3D12_MESSAGE_ID_CREATE_CRYPTOSESSION = 509, - D3D12_MESSAGE_ID_CREATE_AUTHENTICATEDCHANNEL = 510, - D3D12_MESSAGE_ID_LIVE_CRYPTOSESSION = 511, - D3D12_MESSAGE_ID_LIVE_AUTHENTICATEDCHANNEL = 512, - D3D12_MESSAGE_ID_DESTROY_CRYPTOSESSION = 513, - D3D12_MESSAGE_ID_DESTROY_AUTHENTICATEDCHANNEL = 514, - D3D12_MESSAGE_ID_MAP_INVALID_SUBRESOURCE = 515, - D3D12_MESSAGE_ID_MAP_INVALID_TYPE = 516, - D3D12_MESSAGE_ID_MAP_UNSUPPORTED_TYPE = 517, - D3D12_MESSAGE_ID_UNMAP_INVALID_SUBRESOURCE = 518, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_TYPE = 519, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_NULL_POINTER = 520, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_SUBRESOURCE = 521, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_RESERVED_BITS = 522, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISSING_BIND_FLAGS = 523, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISMATCHING_MISC_FLAGS = 524, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_MATCHING_STATES = 525, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_COMBINATION = 526, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_BEFORE_AFTER_MISMATCH = 527, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_RESOURCE = 528, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_SAMPLE_COUNT = 529, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_FLAGS = 530, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_COMBINED_FLAGS = 531, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_FLAGS_FOR_FORMAT = 532, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_SPLIT_BARRIER = 533, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_UNMATCHED_END = 534, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_UNMATCHED_BEGIN = 535, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_FLAG = 536, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_COMMAND_LIST_TYPE = 537, - D3D12_MESSAGE_ID_INVALID_SUBRESOURCE_STATE = 538, - D3D12_MESSAGE_ID_INEFFICIENT_PRESENT = 539, - D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_CONTENTION = 540, - D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_RESET = 541, - D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_RESET_BUNDLE = 542, - D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_CANNOT_RESET = 543, - D3D12_MESSAGE_ID_COMMAND_LIST_OPEN = 544, - D3D12_MESSAGE_ID_QUERY_STATE_MISMATCH = 545, - D3D12_MESSAGE_ID_INVALID_BUNDLE_API = 546, - D3D12_MESSAGE_ID_COMMAND_LIST_CLOSED = 547, - D3D12_MESSAGE_ID_COMMAND_LIST_CLOSED_WITH_INVALID_RESOURCE = 548, - D3D12_MESSAGE_ID_WRONG_COMMAND_ALLOCATOR_TYPE = 549, - D3D12_MESSAGE_ID_INVALID_INDIRECT_ARGUMENT_BUFFER = 550, - D3D12_MESSAGE_ID_COMPUTE_AND_GRAPHICS_PIPELINE = 551, - D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_SYNC = 552, - D3D12_MESSAGE_ID_COMMAND_LIST_SYNC = 553, - D3D12_MESSAGE_ID_SET_DESCRIPTOR_HEAP_INVALID = 554, - D3D12_MESSAGE_ID_CREATE_QUEUE_IMAGE_NOT_SUPPORTED = 555, - D3D12_MESSAGE_ID_CREATE_COMMAND_ALLOCATOR_IMAGE_NOT_SUPPORTED = 556, - D3D12_MESSAGE_ID_CREATE_COMMANDQUEUE = 557, - D3D12_MESSAGE_ID_CREATE_COMMANDALLOCATOR = 558, - D3D12_MESSAGE_ID_CREATE_PIPELINESTATE = 559, - D3D12_MESSAGE_ID_CREATE_COMMANDLIST12 = 560, - D3D12_MESSAGE_ID_CREATE_IMAGECOMMANDLIST = 561, - D3D12_MESSAGE_ID_CREATE_RESOURCE = 562, - D3D12_MESSAGE_ID_CREATE_DESCRIPTORHEAP = 563, - D3D12_MESSAGE_ID_CREATE_ROOTSIGNATURE = 564, - D3D12_MESSAGE_ID_CREATE_LIBRARY = 565, - D3D12_MESSAGE_ID_CREATE_HEAP = 566, - D3D12_MESSAGE_ID_CREATE_MONITOREDFENCE = 567, - D3D12_MESSAGE_ID_CREATE_QUERYHEAP = 568, - D3D12_MESSAGE_ID_CREATE_COMMANDSIGNATURE = 569, - D3D12_MESSAGE_ID_LIVE_COMMANDQUEUE = 570, - D3D12_MESSAGE_ID_LIVE_COMMANDALLOCATOR = 571, - D3D12_MESSAGE_ID_LIVE_PIPELINESTATE = 572, - D3D12_MESSAGE_ID_LIVE_COMMANDLIST12 = 573, - D3D12_MESSAGE_ID_LIVE_IMAGECOMMANDLIST = 574, - D3D12_MESSAGE_ID_LIVE_RESOURCE = 575, - D3D12_MESSAGE_ID_LIVE_DESCRIPTORHEAP = 576, - D3D12_MESSAGE_ID_LIVE_ROOTSIGNATURE = 577, - D3D12_MESSAGE_ID_LIVE_LIBRARY = 578, - D3D12_MESSAGE_ID_LIVE_HEAP = 579, - D3D12_MESSAGE_ID_LIVE_MONITOREDFENCE = 580, - D3D12_MESSAGE_ID_LIVE_QUERYHEAP = 581, - D3D12_MESSAGE_ID_LIVE_COMMANDSIGNATURE = 582, - D3D12_MESSAGE_ID_DESTROY_COMMANDQUEUE = 583, - D3D12_MESSAGE_ID_DESTROY_COMMANDALLOCATOR = 584, - D3D12_MESSAGE_ID_DESTROY_PIPELINESTATE = 585, - D3D12_MESSAGE_ID_DESTROY_COMMANDLIST12 = 586, - D3D12_MESSAGE_ID_DESTROY_IMAGECOMMANDLIST = 587, - D3D12_MESSAGE_ID_DESTROY_RESOURCE = 588, - D3D12_MESSAGE_ID_DESTROY_DESCRIPTORHEAP = 589, - D3D12_MESSAGE_ID_DESTROY_ROOTSIGNATURE = 590, - D3D12_MESSAGE_ID_DESTROY_LIBRARY = 591, - D3D12_MESSAGE_ID_DESTROY_HEAP = 592, - D3D12_MESSAGE_ID_DESTROY_MONITOREDFENCE = 593, - D3D12_MESSAGE_ID_DESTROY_QUERYHEAP = 594, - D3D12_MESSAGE_ID_DESTROY_COMMANDSIGNATURE = 595, - D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDHEAPTYPE = 596, - D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDDIMENSIONS = 597, - D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDMISCFLAGS = 598, - D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDMISCFLAGS = 599, - D3D12_MESSAGE_ID_CREATERESOURCE_LARGEALLOCATION = 600, - D3D12_MESSAGE_ID_CREATERESOURCE_SMALLALLOCATION = 601, - D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDARG_RETURN = 602, - D3D12_MESSAGE_ID_CREATERESOURCE_OUTOFMEMORY_RETURN = 603, - D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDDESC = 604, - D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDINITIALSTATE = 605, - D3D12_MESSAGE_ID_RESOURCE_HAS_PENDING_INITIAL_DATA = 606, - D3D12_MESSAGE_ID_POSSIBLY_INVALID_SUBRESOURCE_STATE = 607, - D3D12_MESSAGE_ID_INVALID_USE_OF_NON_RESIDENT_RESOURCE = 608, - D3D12_MESSAGE_ID_POSSIBLE_INVALID_USE_OF_NON_RESIDENT_RESOURCE = 609, - D3D12_MESSAGE_ID_BUNDLE_PIPELINE_STATE_MISMATCH = 610, - D3D12_MESSAGE_ID_PRIMITIVE_TOPOLOGY_MISMATCH_PIPELINE_STATE = 611, - D3D12_MESSAGE_ID_RENDER_TARGET_NUMBER_MISMATCH_PIPELINE_STATE = 612, - D3D12_MESSAGE_ID_RENDER_TARGET_FORMAT_MISMATCH_PIPELINE_STATE = 613, - D3D12_MESSAGE_ID_RENDER_TARGET_SAMPLE_DESC_MISMATCH_PIPELINE_STATE = 614, - D3D12_MESSAGE_ID_DEPTH_STENCIL_FORMAT_MISMATCH_PIPELINE_STATE = 615, - D3D12_MESSAGE_ID_DEPTH_STENCIL_SAMPLE_DESC_MISMATCH_PIPELINE_STATE = 616, - D3D12_MESSAGE_ID_RENDER_TARGET_NUMBER_MISMATCH_BUNDLE_PIPELINE_STATE = 617, - D3D12_MESSAGE_ID_RENDER_TARGET_FORMAT_MISMATCH_BUNDLE_PIPELINE_STATE = 618, - D3D12_MESSAGE_ID_RENDER_TARGET_SAMPLE_DESC_MISMATCH_BUNDLE_PIPELINE_STATE = 619, - D3D12_MESSAGE_ID_DEPTH_STENCIL_FORMAT_MISMATCH_BUNDLE_PIPELINE_STATE = 620, - D3D12_MESSAGE_ID_DEPTH_STENCIL_SAMPLE_DESC_MISMATCH_BUNDLE_PIPELINE_STATE = 621, - D3D12_MESSAGE_ID_CREATESHADER_INVALIDBYTECODE = 622, - D3D12_MESSAGE_ID_CREATEHEAP_NULLDESC = 623, - D3D12_MESSAGE_ID_CREATEHEAP_INVALIDSIZE = 624, - D3D12_MESSAGE_ID_CREATEHEAP_UNRECOGNIZEDHEAPTYPE = 625, - D3D12_MESSAGE_ID_CREATEHEAP_UNRECOGNIZEDCPUPAGEPROPERTIES = 626, - D3D12_MESSAGE_ID_CREATEHEAP_UNRECOGNIZEDMEMORYPOOL = 627, - D3D12_MESSAGE_ID_CREATEHEAP_INVALIDPROPERTIES = 628, - D3D12_MESSAGE_ID_CREATEHEAP_INVALIDALIGNMENT = 629, - D3D12_MESSAGE_ID_CREATEHEAP_UNRECOGNIZEDMISCFLAGS = 630, - D3D12_MESSAGE_ID_CREATEHEAP_INVALIDMISCFLAGS = 631, - D3D12_MESSAGE_ID_CREATEHEAP_INVALIDARG_RETURN = 632, - D3D12_MESSAGE_ID_CREATEHEAP_OUTOFMEMORY_RETURN = 633, - D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_NULLHEAPPROPERTIES = 634, - D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_UNRECOGNIZEDHEAPTYPE = 635, - D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_UNRECOGNIZEDCPUPAGEPROPERTIES = 636, - D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_UNRECOGNIZEDMEMORYPOOL = 637, - D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_INVALIDHEAPPROPERTIES = 638, - D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_UNRECOGNIZEDHEAPMISCFLAGS = 639, - D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_INVALIDHEAPMISCFLAGS = 640, - D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_INVALIDARG_RETURN = 641, - D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_OUTOFMEMORY_RETURN = 642, - D3D12_MESSAGE_ID_GETCUSTOMHEAPPROPERTIES_UNRECOGNIZEDHEAPTYPE = 643, - D3D12_MESSAGE_ID_GETCUSTOMHEAPPROPERTIES_INVALIDHEAPTYPE = 644, - D3D12_MESSAGE_ID_CREATE_DESCRIPTOR_HEAP_INVALID_DESC = 645, - D3D12_MESSAGE_ID_INVALID_DESCRIPTOR_HANDLE = 646, - D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALID_CONSERVATIVERASTERMODE = 647, - D3D12_MESSAGE_ID_DEVICE_DRAW_INVALID_SYSTEMVALUE = 648, - D3D12_MESSAGE_ID_CREATE_CONSTANT_BUFFER_VIEW_INVALID_RESOURCE = 649, - D3D12_MESSAGE_ID_CREATE_CONSTANT_BUFFER_VIEW_INVALID_DESC = 650, - D3D12_MESSAGE_ID_CREATE_CONSTANT_BUFFER_VIEW_LARGE_OFFSET = 651, - D3D12_MESSAGE_ID_CREATE_UNORDEREDACCESS_VIEW_INVALID_COUNTER_USAGE = 652, - D3D12_MESSAGE_ID_COPY_DESCRIPTORS_INVALID_RANGES = 653, - D3D12_MESSAGE_ID_COPY_DESCRIPTORS_WRITE_ONLY_DESCRIPTOR = 654, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_RTV_FORMAT_NOT_UNKNOWN = 655, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_RENDER_TARGET_COUNT = 656, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_VERTEX_SHADER_NOT_SET = 657, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INPUTLAYOUT_NOT_SET = 658, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_HS_DS_SIGNATURE_MISMATCH = 659, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_REGISTERINDEX = 660, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_COMPONENTTYPE = 661, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_REGISTERMASK = 662, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_SYSTEMVALUE = 663, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS = 664, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_MINPRECISION = 665, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND = 666, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HS_XOR_DS_MISMATCH = 667, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HULL_SHADER_INPUT_TOPOLOGY_MISMATCH = 668, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HS_DS_CONTROL_POINT_COUNT_MISMATCH = 669, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HS_DS_TESSELLATOR_DOMAIN_MISMATCH = 670, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN = 671, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_USE_OF_FORCED_SAMPLE_COUNT = 672, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_PRIMITIVETOPOLOGY = 673, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_SYSTEMVALUE = 674, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 = 675, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING = 676, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_PS_OUTPUT_TYPE_MISMATCH = 677, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_OM_RENDER_TARGET_DOES_NOT_SUPPORT_LOGIC_OPS = 678, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_RENDERTARGETVIEW_NOT_SET = 679, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_DEPTHSTENCILVIEW_NOT_SET = 680, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_GS_INPUT_PRIMITIVE_MISMATCH = 681, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_POSITION_NOT_PRESENT = 682, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_MISSING_ROOT_SIGNATURE_FLAGS = 683, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_INDEX_BUFFER_PROPERTIES = 684, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_INVALID_SAMPLE_DESC = 685, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_HS_ROOT_SIGNATURE_MISMATCH = 686, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_DS_ROOT_SIGNATURE_MISMATCH = 687, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_VS_ROOT_SIGNATURE_MISMATCH = 688, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_GS_ROOT_SIGNATURE_MISMATCH = 689, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_PS_ROOT_SIGNATURE_MISMATCH = 690, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_MISSING_ROOT_SIGNATURE = 691, - D3D12_MESSAGE_ID_EXECUTE_BUNDLE_OPEN_BUNDLE = 692, - D3D12_MESSAGE_ID_EXECUTE_BUNDLE_DESCRIPTOR_HEAP_MISMATCH = 693, - D3D12_MESSAGE_ID_EXECUTE_BUNDLE_TYPE = 694, - D3D12_MESSAGE_ID_DRAW_EMPTY_SCISSOR_RECTANGLE = 695, - D3D12_MESSAGE_ID_CREATE_ROOT_SIGNATURE_BLOB_NOT_FOUND = 696, - D3D12_MESSAGE_ID_CREATE_ROOT_SIGNATURE_DESERIALIZE_FAILED = 697, - D3D12_MESSAGE_ID_CREATE_ROOT_SIGNATURE_INVALID_CONFIGURATION = 698, - D3D12_MESSAGE_ID_CREATE_ROOT_SIGNATURE_NOT_SUPPORTED_ON_DEVICE = 699, - D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_NULLRESOURCEPROPERTIES = 700, - D3D12_MESSAGE_ID_CREATERESOURCEANDHEAP_NULLHEAP = 701, - D3D12_MESSAGE_ID_GETRESOURCEALLOCATIONINFO_INVALIDRDESCS = 702, - D3D12_MESSAGE_ID_MAKERESIDENT_NULLOBJECTARRAY = 703, - D3D12_MESSAGE_ID_MAKERESIDENT_INVALIDOBJECT = 704, - D3D12_MESSAGE_ID_EVICT_NULLOBJECTARRAY = 705, - D3D12_MESSAGE_ID_EVICT_INVALIDOBJECT = 706, - D3D12_MESSAGE_ID_HEAPS_UNSUPPORTED = 707, - D3D12_MESSAGE_ID_SET_DESCRIPTOR_TABLE_INVALID = 708, - D3D12_MESSAGE_ID_SET_ROOT_CONSTANT_INVALID = 709, - D3D12_MESSAGE_ID_SET_ROOT_CONSTANT_BUFFER_VIEW_INVALID = 710, - D3D12_MESSAGE_ID_SET_ROOT_SHADER_RESOURCE_VIEW_INVALID = 711, - D3D12_MESSAGE_ID_SET_ROOT_UNORDERED_ACCESS_VIEW_INVALID = 712, - D3D12_MESSAGE_ID_SET_VERTEX_BUFFERS_INVALID_DESC = 713, - D3D12_MESSAGE_ID_SET_VERTEX_BUFFERS_LARGE_OFFSET = 714, - D3D12_MESSAGE_ID_SET_INDEX_BUFFER_INVALID_DESC = 715, - D3D12_MESSAGE_ID_SET_INDEX_BUFFER_LARGE_OFFSET = 716, - D3D12_MESSAGE_ID_SET_STREAM_OUTPUT_BUFFERS_INVALID_DESC = 717, - D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDDIMENSIONALITY = 718, - D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDLAYOUT = 719, - D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDDIMENSIONALITY = 720, - D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDALIGNMENT = 721, - D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDMIPLEVELS = 722, - D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDSAMPLEDESC = 723, - D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDLAYOUT = 724, - D3D12_MESSAGE_ID_SET_INDEX_BUFFER_INVALID = 725, - D3D12_MESSAGE_ID_SET_VERTEX_BUFFERS_INVALID = 726, - D3D12_MESSAGE_ID_SET_STREAM_OUTPUT_BUFFERS_INVALID = 727, - D3D12_MESSAGE_ID_SET_RENDER_TARGETS_INVALID = 728, - D3D12_MESSAGE_ID_CREATEQUERY_HEAP_INVALID_PARAMETERS = 729, - D3D12_MESSAGE_ID_CREATEQUERY_HEAP_JPEG_NOT_SUPPORTED = 730, - D3D12_MESSAGE_ID_BEGIN_END_QUERY_INVALID_PARAMETERS = 731, - D3D12_MESSAGE_ID_CLOSE_COMMAND_LIST_OPEN_QUERY = 732, - D3D12_MESSAGE_ID_RESOLVE_QUERY_DATA_INVALID_PARAMETERS = 733, - D3D12_MESSAGE_ID_SET_PREDICATION_INVALID_PARAMETERS = 734, - D3D12_MESSAGE_ID_TIMESTAMPS_NOT_SUPPORTED = 735, - D3D12_MESSAGE_ID_UNSTABLE_POWER_STATE = 736, - D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDFORMAT = 737, - D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDFORMAT = 738, - D3D12_MESSAGE_ID_GETCOPYABLELAYOUT_INVALIDSUBRESOURCERANGE = 739, - D3D12_MESSAGE_ID_GETCOPYABLELAYOUT_INVALIDBASEOFFSET = 740, - D3D12_MESSAGE_ID_RESOURCE_BARRIER_INVALID_HEAP = 741, - D3D12_MESSAGE_ID_CREATE_SAMPLER_INVALID = 742, - D3D12_MESSAGE_ID_CREATECOMMANDSIGNATURE_INVALID = 743, - D3D12_MESSAGE_ID_EXECUTE_INDIRECT_INVALID_PARAMETERS = 744, - D3D12_MESSAGE_ID_GETGPUVIRTUALADDRESS_INVALID_RESOURCE_DIMENSION = 745, - D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDCONTEXTTYPE = 746, - D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_DECODENOTSUPPORTED = 747, - D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_ENCODENOTSUPPORTED = 748, - D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDPLANEINDEX = 749, - D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDVIDEOPLANEINDEX = 750, - D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_AMBIGUOUSVIDEOPLANEINDEX = 751, - D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDPLANEINDEX = 752, - D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDVIDEOPLANEINDEX = 753, - D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_AMBIGUOUSVIDEOPLANEINDEX = 754, - D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDPLANEINDEX = 755, - D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDVIDEOPLANEINDEX = 756, - D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_AMBIGUOUSVIDEOPLANEINDEX = 757, - D3D12_MESSAGE_ID_JPEGDECODE_INVALIDSCANDATAOFFSET = 758, - D3D12_MESSAGE_ID_JPEGDECODE_NOTSUPPORTED = 759, - D3D12_MESSAGE_ID_JPEGDECODE_DIMENSIONSTOOLARGE = 760, - D3D12_MESSAGE_ID_JPEGDECODE_INVALIDCOMPONENTS = 761, - D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDCOMPONENTS = 762, - D3D12_MESSAGE_ID_JPEGDECODE_DESTINATIONNOT2D = 763, - D3D12_MESSAGE_ID_JPEGDECODE_TILEDRESOURCESUNSUPPORTED = 764, - D3D12_MESSAGE_ID_JPEGDECODE_GUARDRECTSUNSUPPORTED = 765, - D3D12_MESSAGE_ID_JPEGDECODE_FORMATUNSUPPORTED = 766, - D3D12_MESSAGE_ID_JPEGDECODE_INVALIDSUBRESOURCE = 767, - D3D12_MESSAGE_ID_JPEGDECODE_INVALIDMIPLEVEL = 768, - D3D12_MESSAGE_ID_JPEGDECODE_EMPTYDESTBOX = 769, - D3D12_MESSAGE_ID_JPEGDECODE_DESTBOXNOT2D = 770, - D3D12_MESSAGE_ID_JPEGDECODE_DESTBOXNOTSUB = 771, - D3D12_MESSAGE_ID_JPEGDECODE_DESTBOXESINTERSECT = 772, - D3D12_MESSAGE_ID_JPEGDECODE_XSUBSAMPLEMISMATCH = 773, - D3D12_MESSAGE_ID_JPEGDECODE_YSUBSAMPLEMISMATCH = 774, - D3D12_MESSAGE_ID_JPEGDECODE_XSUBSAMPLEODD = 775, - D3D12_MESSAGE_ID_JPEGDECODE_YSUBSAMPLEODD = 776, - D3D12_MESSAGE_ID_JPEGDECODE_UPSCALEUNSUPPORTED = 777, - D3D12_MESSAGE_ID_JPEGDECODE_TIER4DOWNSCALETOLARGE = 778, - D3D12_MESSAGE_ID_JPEGDECODE_TIER3DOWNSCALEUNSUPPORTED = 779, - D3D12_MESSAGE_ID_JPEGDECODE_CHROMASIZEMISMATCH = 780, - D3D12_MESSAGE_ID_JPEGDECODE_LUMACHROMASIZEMISMATCH = 781, - D3D12_MESSAGE_ID_JPEGDECODE_INVALIDNUMDESTINATIONS = 782, - D3D12_MESSAGE_ID_JPEGDECODE_SUBBOXUNSUPPORTED = 783, - D3D12_MESSAGE_ID_JPEGDECODE_1DESTUNSUPPORTEDFORMAT = 784, - D3D12_MESSAGE_ID_JPEGDECODE_3DESTUNSUPPORTEDFORMAT = 785, - D3D12_MESSAGE_ID_JPEGDECODE_SCALEUNSUPPORTED = 786, - D3D12_MESSAGE_ID_JPEGDECODE_INVALIDSOURCESIZE = 787, - D3D12_MESSAGE_ID_JPEGDECODE_INVALIDCOPYFLAGS = 788, - D3D12_MESSAGE_ID_JPEGDECODE_HAZARD = 789, - D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDSRCBUFFERUSAGE = 790, - D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDSRCBUFFERMISCFLAGS = 791, - D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDDSTTEXTUREUSAGE = 792, - D3D12_MESSAGE_ID_JPEGDECODE_BACKBUFFERNOTSUPPORTED = 793, - D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPRTEDCOPYFLAGS = 794, - D3D12_MESSAGE_ID_JPEGENCODE_NOTSUPPORTED = 795, - D3D12_MESSAGE_ID_JPEGENCODE_INVALIDSCANDATAOFFSET = 796, - D3D12_MESSAGE_ID_JPEGENCODE_INVALIDCOMPONENTS = 797, - D3D12_MESSAGE_ID_JPEGENCODE_SOURCENOT2D = 798, - D3D12_MESSAGE_ID_JPEGENCODE_TILEDRESOURCESUNSUPPORTED = 799, - D3D12_MESSAGE_ID_JPEGENCODE_GUARDRECTSUNSUPPORTED = 800, - D3D12_MESSAGE_ID_JPEGENCODE_XSUBSAMPLEMISMATCH = 801, - D3D12_MESSAGE_ID_JPEGENCODE_YSUBSAMPLEMISMATCH = 802, - D3D12_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDCOMPONENTS = 803, - D3D12_MESSAGE_ID_JPEGENCODE_FORMATUNSUPPORTED = 804, - D3D12_MESSAGE_ID_JPEGENCODE_INVALIDSUBRESOURCE = 805, - D3D12_MESSAGE_ID_JPEGENCODE_INVALIDMIPLEVEL = 806, - D3D12_MESSAGE_ID_JPEGENCODE_DIMENSIONSTOOLARGE = 807, - D3D12_MESSAGE_ID_JPEGENCODE_HAZARD = 808, - D3D12_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDDSTBUFFERUSAGE = 809, - D3D12_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDDSTBUFFERMISCFLAGS = 810, - D3D12_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDSRCTEXTUREUSAGE = 811, - D3D12_MESSAGE_ID_JPEGENCODE_BACKBUFFERNOTSUPPORTED = 812, - D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_UNSUPPORTEDCONTEXTTTYPEFORQUERY = 813, - D3D12_MESSAGE_ID_FLUSH1_INVALIDCONTEXTTYPE = 814, - D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDCLEARVALUE = 815, - D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDCLEARVALUEFORMAT = 816, - D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDCLEARVALUEFORMAT = 817, - D3D12_MESSAGE_ID_CREATERESOURCE_CLEARVALUEDENORMFLUSH = 818, - D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_INVALIDDEPTH = 819, - D3D12_MESSAGE_ID_CLEARRENDERTARGETVIEW_MISMATCHINGCLEARVALUE = 820, - D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_MISMATCHINGCLEARVALUE = 821, - D3D12_MESSAGE_ID_MAP_INVALIDHEAP = 822, - D3D12_MESSAGE_ID_UNMAP_INVALIDHEAP = 823, - D3D12_MESSAGE_ID_MAP_INVALIDRESOURCE = 824, - D3D12_MESSAGE_ID_UNMAP_INVALIDRESOURCE = 825, - D3D12_MESSAGE_ID_MAP_INVALIDSUBRESOURCE = 826, - D3D12_MESSAGE_ID_UNMAP_INVALIDSUBRESOURCE = 827, - D3D12_MESSAGE_ID_MAP_INVALIDRANGE = 828, - D3D12_MESSAGE_ID_UNMAP_INVALIDRANGE = 829, - D3D12_MESSAGE_ID_MAP_NULLRANGE = 830, - D3D12_MESSAGE_ID_UNMAP_NULLRANGE = 831, - D3D12_MESSAGE_ID_MAP_INVALIDDATAPOINTER = 832, - D3D12_MESSAGE_ID_MAP_INVALIDARG_RETURN = 833, - D3D12_MESSAGE_ID_MAP_OUTOFMEMORY_RETURN = 834, - D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_BUNDLENOTSUPPORTED = 835, - D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_COMMANDLISTMISMATCH = 836, - D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_OPENCOMMANDLIST = 837, - D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_FAILEDCOMMANDLIST = 838, - D3D12_MESSAGE_ID_COPYBUFFERREGION_NULLDST = 839, - D3D12_MESSAGE_ID_COPYBUFFERREGION_INVALIDDSTRESOURCEDIMENSION = 840, - D3D12_MESSAGE_ID_COPYBUFFERREGION_DSTRANGEOUTOFBOUNDS = 841, - D3D12_MESSAGE_ID_COPYBUFFERREGION_NULLSRC = 842, - D3D12_MESSAGE_ID_COPYBUFFERREGION_INVALIDSRCRESOURCEDIMENSION = 843, - D3D12_MESSAGE_ID_COPYBUFFERREGION_SRCRANGEOUTOFBOUNDS = 844, - D3D12_MESSAGE_ID_COPYBUFFERREGION_INVALIDCOPYFLAGS = 845, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_NULLDST = 846, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_UNRECOGNIZEDDSTTYPE = 847, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTRESOURCEDIMENSION = 848, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTRESOURCE = 849, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTSUBRESOURCE = 850, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTOFFSET = 851, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_UNRECOGNIZEDDSTFORMAT = 852, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTFORMAT = 853, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTDIMENSIONS = 854, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTROWPITCH = 855, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTPLACEMENT = 856, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTDSPLACEDFOOTPRINTFORMAT = 857, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_DSTREGIONOUTOFBOUNDS = 858, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_NULLSRC = 859, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_UNRECOGNIZEDSRCTYPE = 860, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCRESOURCEDIMENSION = 861, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCRESOURCE = 862, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCSUBRESOURCE = 863, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCOFFSET = 864, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_UNRECOGNIZEDSRCFORMAT = 865, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCFORMAT = 866, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCDIMENSIONS = 867, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCROWPITCH = 868, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCPLACEMENT = 869, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCDSPLACEDFOOTPRINTFORMAT = 870, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_SRCREGIONOUTOFBOUNDS = 871, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDDSTCOORDINATES = 872, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDSRCBOX = 873, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_FORMATMISMATCH = 874, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_EMPTYBOX = 875, - D3D12_MESSAGE_ID_COPYTEXTUREREGION_INVALIDCOPYFLAGS = 876, - D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALID_SUBRESOURCE_INDEX = 877, - D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALID_FORMAT = 878, - D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_RESOURCE_MISMATCH = 879, - D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALID_SAMPLE_COUNT = 880, - D3D12_MESSAGE_ID_CREATECOMPUTEPIPELINESTATE_INVALID_SHADER = 881, - D3D12_MESSAGE_ID_CREATECOMPUTEPIPELINESTATE_CS_ROOT_SIGNATURE_MISMATCH = 882, - D3D12_MESSAGE_ID_CREATECOMPUTEPIPELINESTATE_MISSING_ROOT_SIGNATURE = 883, - D3D12_MESSAGE_ID_CREATEPIPELINESTATE_INVALIDCACHEDBLOB = 884, - D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CACHEDBLOBADAPTERMISMATCH = 885, - D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CACHEDBLOBDRIVERVERSIONMISMATCH = 886, - D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CACHEDBLOBDESCMISMATCH = 887, - D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CACHEDBLOBIGNORED = 888, - D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_INVALIDHEAP = 889, - D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_INVALIDRESOURCE = 890, - D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_INVALIDBOX = 891, - D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_INVALIDSUBRESOURCE = 892, - D3D12_MESSAGE_ID_WRITETOSUBRESOURCE_EMPTYBOX = 893, - D3D12_MESSAGE_ID_READFROMSUBRESOURCE_INVALIDHEAP = 894, - D3D12_MESSAGE_ID_READFROMSUBRESOURCE_INVALIDRESOURCE = 895, - D3D12_MESSAGE_ID_READFROMSUBRESOURCE_INVALIDBOX = 896, - D3D12_MESSAGE_ID_READFROMSUBRESOURCE_INVALIDSUBRESOURCE = 897, - D3D12_MESSAGE_ID_READFROMSUBRESOURCE_EMPTYBOX = 898, - D3D12_MESSAGE_ID_TOO_MANY_NODES_SPECIFIED = 899, - D3D12_MESSAGE_ID_INVALID_NODE_INDEX = 900, - D3D12_MESSAGE_ID_GETHEAPPROPERTIES_INVALIDRESOURCE = 901, - D3D12_MESSAGE_ID_NODE_MASK_MISMATCH = 902, - D3D12_MESSAGE_ID_COMMAND_LIST_OUTOFMEMORY = 903, - D3D12_MESSAGE_ID_COMMAND_LIST_MULTIPLE_SWAPCHAIN_BUFFER_REFERENCES = 904, - D3D12_MESSAGE_ID_COMMAND_LIST_TOO_MANY_SWAPCHAIN_REFERENCES = 905, - D3D12_MESSAGE_ID_COMMAND_QUEUE_TOO_MANY_SWAPCHAIN_REFERENCES = 906, - D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_WRONGSWAPCHAINBUFFERREFERENCE = 907, - D3D12_MESSAGE_ID_COMMAND_LIST_SETRENDERTARGETS_INVALIDNUMRENDERTARGETS = 908, - D3D12_MESSAGE_ID_CREATE_QUEUE_INVALID_TYPE = 909, - D3D12_MESSAGE_ID_CREATE_QUEUE_INVALID_FLAGS = 910, - D3D12_MESSAGE_ID_CREATESHAREDRESOURCE_INVALIDFLAGS = 911, - D3D12_MESSAGE_ID_CREATESHAREDRESOURCE_INVALIDFORMAT = 912, - D3D12_MESSAGE_ID_CREATESHAREDHEAP_INVALIDFLAGS = 913, - D3D12_MESSAGE_ID_REFLECTSHAREDPROPERTIES_UNRECOGNIZEDPROPERTIES = 914, - D3D12_MESSAGE_ID_REFLECTSHAREDPROPERTIES_INVALIDSIZE = 915, - D3D12_MESSAGE_ID_REFLECTSHAREDPROPERTIES_INVALIDOBJECT = 916, - D3D12_MESSAGE_ID_KEYEDMUTEX_INVALIDOBJECT = 917, - D3D12_MESSAGE_ID_KEYEDMUTEX_INVALIDKEY = 918, - D3D12_MESSAGE_ID_KEYEDMUTEX_WRONGSTATE = 919, - D3D12_MESSAGE_ID_CREATE_QUEUE_INVALID_PRIORITY = 920, - D3D12_MESSAGE_ID_OBJECT_DELETED_WHILE_STILL_IN_USE = 921, - D3D12_MESSAGE_ID_CREATEPIPELINESTATE_INVALID_FLAGS = 922, - D3D12_MESSAGE_ID_HEAP_ADDRESS_RANGE_HAS_NO_RESOURCE = 923, - D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_RENDER_TARGET_DELETED = 924, - D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_ALL_RENDER_TARGETS_HAVE_UNKNOWN_FORMAT = 925, - D3D12_MESSAGE_ID_HEAP_ADDRESS_RANGE_INTERSECTS_MULTIPLE_BUFFERS = 926, - D3D12_MESSAGE_ID_EXECUTECOMMANDLISTS_GPU_WRITTEN_READBACK_RESOURCE_MAPPED = 927, - D3D12_MESSAGE_ID_UNMAP_RANGE_NOT_NEEDED = 928, - D3D12_MESSAGE_ID_UNMAP_RANGE_NOT_EMPTY = 929, - D3D12_MESSAGE_ID_MAP_INVALID_NULLRANGE = 930, - D3D12_MESSAGE_ID_UNMAP_INVALID_NULLRANGE = 931, - D3D12_MESSAGE_ID_NO_GRAPHICS_API_SUPPORT = 932, - D3D12_MESSAGE_ID_NO_COMPUTE_API_SUPPORT = 933, - D3D12_MESSAGE_ID_D3D12_MESSAGES_END = 934, -}} -STRUCT!{struct D3D12_MESSAGE { - Category: D3D12_MESSAGE_CATEGORY, - Severity: D3D12_MESSAGE_SEVERITY, - ID: D3D12_MESSAGE_ID, - pDescription: *const ::c_char, - DescriptionByteLength: ::SIZE_T, -}} -STRUCT!{struct D3D12_INFO_QUEUE_FILTER_DESC { - NumCategories: ::UINT, - pCategoryList: *mut D3D12_MESSAGE_CATEGORY, - NumSeverities: ::UINT, - pSeverityList: *mut D3D12_MESSAGE_SEVERITY, - NumIDs: ::UINT, - pIDList: *mut D3D12_MESSAGE_ID, -}} -STRUCT!{struct D3D12_INFO_QUEUE_FILTER { - AllowList: D3D12_INFO_QUEUE_FILTER_DESC, - DenyList: D3D12_INFO_QUEUE_FILTER_DESC, -}} -pub const D3D12_INFO_QUEUE_DEFAULT_MESSAGE_COUNT_LIMIT: ::UINT = 1024; -RIDL!{interface ID3D12InfoQueue(ID3D12InfoQueueVtbl): IUnknown(IUnknownVtbl) { - fn SetMessageCountLimit(&mut self, MessageCountLimit: ::UINT64) -> ::HRESULT, - fn ClearStoredMessages(&mut self) -> (), - fn GetMessage( - &mut self, MessageIndex: ::UINT64, pMessage: *mut ::D3D12_MESSAGE, - pMessageByteLength: *mut ::SIZE_T - ) -> ::HRESULT, - fn GetNumMessagesAllowedByStorageFilter(&mut self) -> ::UINT64, - fn GetNumMessagesDeniedByStorageFilter(&mut self) -> ::UINT64, - fn GetNumStoredMessages(&mut self) -> ::UINT64, - fn GetNumStoredMessagesAllowedByRetrievalFilter(&mut self) -> ::UINT64, - fn GetNumMessagesDiscardedByMessageCountLimit(&mut self) -> ::UINT64, - fn GetMessageCountLimit(&mut self) -> ::UINT64, - fn AddStorageFilterEntries(&mut self, pFilter: *mut ::D3D12_INFO_QUEUE_FILTER) -> ::HRESULT, - fn GetStorageFilter( - &mut self, pFilter: *mut ::D3D12_INFO_QUEUE_FILTER, pFilterByteLength: *mut ::SIZE_T - ) -> ::HRESULT, - fn ClearStorageFilter(&mut self) -> (), - fn PushEmptyStorageFilter(&mut self) -> ::HRESULT, - fn PushCopyOfStorageFilter(&mut self) -> ::HRESULT, - fn PushStorageFilter(&mut self, pFilter: *mut ::D3D12_INFO_QUEUE_FILTER) -> ::HRESULT, - fn PopStorageFilter(&mut self) -> (), - fn GetStorageFilterStackSize(&mut self) -> ::UINT, - fn AddRetrievalFilterEntries(&mut self, pFilter: *mut ::D3D12_INFO_QUEUE_FILTER) -> ::HRESULT, - fn GetRetrievalFilter( - &mut self, pFilter: *mut ::D3D12_INFO_QUEUE_FILTER, pFilterByteLength: *mut ::SIZE_T - ) -> ::HRESULT, - fn ClearRetrievalFilter(&mut self) -> (), - fn PushEmptyRetrievalFilter(&mut self) -> ::HRESULT, - fn PushCopyOfRetrievalFilter(&mut self) -> ::HRESULT, - fn PushRetrievalFilter(&mut self, pFilter: *mut ::D3D12_INFO_QUEUE_FILTER) -> ::HRESULT, - fn PopRetrievalFilter(&mut self) -> (), - fn GetRetrievalFilterStackSize(&mut self) -> ::UINT, - fn AddMessage( - &mut self, Category: ::D3D12_MESSAGE_CATEGORY, Severity: ::D3D12_MESSAGE_SEVERITY, - ID: ::D3D12_MESSAGE_ID, pDescription: ::LPCSTR - ) -> ::HRESULT, - fn AddApplicationMessage( - &mut self, Severity: ::D3D12_MESSAGE_SEVERITY, pDescription: ::LPCSTR - ) -> ::HRESULT, - fn SetBreakOnCategory( - &mut self, Category: ::D3D12_MESSAGE_CATEGORY, bEnable: ::BOOL - ) -> ::HRESULT, - fn SetBreakOnSeverity( - &mut self, Severity: ::D3D12_MESSAGE_SEVERITY, bEnable: ::BOOL - ) -> ::HRESULT, - fn SetBreakOnID(&mut self, ID: ::D3D12_MESSAGE_ID, bEnable: ::BOOL) -> ::HRESULT, - fn GetBreakOnCategory(&mut self, Category: ::D3D12_MESSAGE_CATEGORY) -> ::BOOL, - fn GetBreakOnSeverity(&mut self, Severity: ::D3D12_MESSAGE_SEVERITY) -> ::BOOL, - fn GetBreakOnID(&mut self, ID: ::D3D12_MESSAGE_ID) -> ::BOOL, - fn SetMuteDebugOutput(&mut self, bMute: ::BOOL) -> (), - fn GetMuteDebugOutput(&mut self) -> ::BOOL -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/d3d12shader.rs cargo-0.37.0/vendor/winapi-0.2.8/src/d3d12shader.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/d3d12shader.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/d3d12shader.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,320 +0,0 @@ -// Copyright © 2016; Dmitry Roschin -// Licensed under the MIT License -FLAGS!{ enum D3D12_SHADER_VERSION_TYPE { - D3D12_SHVER_PIXEL_SHADER = 0x0, - D3D12_SHVER_VERTEX_SHADER = 0x1, - D3D12_SHVER_GEOMETRY_SHADER = 0x2, - D3D12_SHVER_HULL_SHADER = 0x3, - D3D12_SHVER_DOMAIN_SHADER = 0x4, - D3D12_SHVER_COMPUTE_SHADER = 0x5, - D3D12_SHVER_RESERVED0 = 0xFFF0, -}} - -STRUCT!{struct D3D12_FUNCTION_DESC { - Version: ::UINT, - Creator: ::LPCSTR, - Flags: ::UINT, - ConstantBuffers: ::UINT, - BoundResources: ::UINT, - InstructionCount: ::UINT, - TempRegisterCount: ::UINT, - TempArrayCount: ::UINT, - DefCount: ::UINT, - DclCount: ::UINT, - TextureNormalInstructions: ::UINT, - TextureLoadInstructions: ::UINT, - TextureCompInstructions: ::UINT, - TextureBiasInstructions: ::UINT, - TextureGradientInstructions: ::UINT, - FloatInstructionCount: ::UINT, - IntInstructionCount: ::UINT, - UintInstructionCount: ::UINT, - StaticFlowControlCount: ::UINT, - DynamicFlowControlCount: ::UINT, - MacroInstructionCount: ::UINT, - ArrayInstructionCount: ::UINT, - MovInstructionCount: ::UINT, - MovcInstructionCount: ::UINT, - ConversionInstructionCount: ::UINT, - BitwiseInstructionCount: ::UINT, - MinFeatureLevel: ::D3D_FEATURE_LEVEL, - RequiredFeatureFlags: ::UINT64, - Name: ::LPCSTR, - FunctionParameterCount: ::INT, - HasReturn: ::BOOL, - Has10Level9VertexShader: ::BOOL, - Has10Level9PixelShader: ::BOOL, -}} - -STRUCT!{struct D3D12_LIBRARY_DESC { - Creator: ::LPCSTR, - Flags: ::UINT, - FunctionCount: ::UINT, -}} - -STRUCT!{struct D3D12_PARAMETER_DESC { - Name: ::LPCSTR, - SemanticName: ::LPCSTR, - Type: ::D3D_SHADER_VARIABLE_TYPE, - Class: ::D3D_SHADER_VARIABLE_CLASS, - Rows: ::UINT, - Columns: ::UINT, - InterpolationMode: ::D3D_INTERPOLATION_MODE, - Flags: ::D3D_PARAMETER_FLAGS, - FirstInRegister: ::UINT, - FirstInComponent: ::UINT, - FirstOutRegister: ::UINT, - FirstOutComponent: ::UINT, -}} - -STRUCT!{struct D3D12_SHADER_BUFFER_DESC { - Name: ::LPCSTR, - Type: ::D3D_CBUFFER_TYPE, - Variables: ::UINT, - Size: ::UINT, - uFlags: ::UINT, -}} - -STRUCT!{struct D3D12_SHADER_DESC { - Version: ::UINT, - Creator: ::LPCSTR, - Flags: ::UINT, - ConstantBuffers: ::UINT, - BoundResources: ::UINT, - InputParameters: ::UINT, - OutputParameters: ::UINT, - InstructionCount: ::UINT, - TempRegisterCount: ::UINT, - TempArrayCount: ::UINT, - DefCount: ::UINT, - DclCount: ::UINT, - TextureNormalInstructions: ::UINT, - TextureLoadInstructions: ::UINT, - TextureCompInstructions: ::UINT, - TextureBiasInstructions: ::UINT, - TextureGradientInstructions: ::UINT, - FloatInstructionCount: ::UINT, - IntInstructionCount: ::UINT, - UintInstructionCount: ::UINT, - StaticFlowControlCount: ::UINT, - DynamicFlowControlCount: ::UINT, - MacroInstructionCount: ::UINT, - ArrayInstructionCount: ::UINT, - CutInstructionCount: ::UINT, - EmitInstructionCount: ::UINT, - GSOutputTopology: ::D3D_PRIMITIVE_TOPOLOGY, - GSMaxOutputVertexCount: ::UINT, - InputPrimitive: ::D3D_PRIMITIVE, - PatchConstantParameters: ::UINT, - cGSInstanceCount: ::UINT, - cControlPoints: ::UINT, - HSOutputPrimitive: ::D3D_TESSELLATOR_OUTPUT_PRIMITIVE, - HSPartitioning: ::D3D_TESSELLATOR_PARTITIONING, - TessellatorDomain: ::D3D_TESSELLATOR_DOMAIN, - cBarrierInstructions: ::UINT, - cInterlockedInstructions: ::UINT, - cTextureStoreInstructions: ::UINT, -}} - -STRUCT!{struct D3D12_SHADER_INPUT_BIND_DESC { - Name: ::LPCSTR, - Type: ::D3D_SHADER_INPUT_TYPE, - BindPoint: ::UINT, - BindCount: ::UINT, - uFlags: ::UINT, - ReturnType: ::D3D_RESOURCE_RETURN_TYPE, - Dimension: ::D3D_SRV_DIMENSION, - NumSamples: ::UINT, - Space: ::UINT, - uID: ::UINT, -}} - -STRUCT!{struct D3D12_SHADER_TYPE_DESC { - Class: ::D3D_SHADER_VARIABLE_CLASS, - Type: ::D3D_SHADER_VARIABLE_TYPE, - Rows: ::UINT, - Columns: ::UINT, - Elements: ::UINT, - Members: ::UINT, - Offset: ::UINT, - Name: ::LPCSTR, -}} - -STRUCT!{struct D3D12_SHADER_VARIABLE_DESC { - Name: ::LPCSTR, - StartOffset: ::UINT, - Size: ::UINT, - uFlags: ::UINT, - DefaultValue: ::LPVOID, - StartTexture: ::UINT, - TextureSize: ::UINT, - StartSampler: ::UINT, - SamplerSize: ::UINT, -}} - -STRUCT!{struct D3D12_SIGNATURE_PARAMETER_DESC { - SemanticName: ::LPCSTR, - SemanticIndex: ::UINT, - Register: ::UINT, - SystemValueType: ::D3D_NAME, - ComponentType: ::D3D_REGISTER_COMPONENT_TYPE, - Mask: ::BYTE, - ReadWriteMask: ::BYTE, - Stream: ::UINT, - MinPrecision: ::D3D_MIN_PRECISION, -}} - -RIDL!( -interface ID3D12FunctionParameterReflection(ID3D12FunctionParameterReflectionVtbl) { - fn GetDesc(&mut self, pDesc: *mut ::D3D12_PARAMETER_DESC) -> ::HRESULT -}); - -RIDL!( -interface ID3D12FunctionReflection(ID3D12FunctionReflectionVtbl) { - fn GetDesc(&mut self, pDesc: *mut ::D3D12_FUNCTION_DESC) -> ::HRESULT, - fn GetConstantBufferByIndex( - &mut self, BufferIndex: ::UINT - ) -> *mut ::ID3D12ShaderReflectionConstantBuffer, - fn GetConstantBufferByName( - &mut self, Name: ::LPCSTR - ) -> *mut ::ID3D12ShaderReflectionConstantBuffer, - fn GetResourceBindingDesc( - &mut self, ResourceIndex: ::UINT, pDesc: *mut ::D3D12_SHADER_INPUT_BIND_DESC - ) -> ::HRESULT, - fn GetVariableByName( - &mut self, Name: ::LPCSTR - ) -> *mut ::ID3D12ShaderReflectionVariable, - fn GetResourceBindingDescByName( - &mut self, Name: ::LPCSTR, pDesc: *mut ::D3D12_SHADER_INPUT_BIND_DESC - ) -> ::HRESULT, - fn GetFunctionParameter( - &mut self, ParameterIndex: ::INT - ) -> *mut ::ID3D12FunctionParameterReflection -}); - -RIDL!( -interface ID3D12LibraryReflection(ID3D12LibraryReflectionVtbl): IUnknown(IUnknownVtbl) { - fn QueryInterface( - &mut self, iid: *const ::IID, ppv: *mut ::LPVOID - ) -> ::HRESULT, - fn AddRef(&mut self) -> ::ULONG, - fn Release(&mut self) -> ::ULONG, - fn GetDesc(&mut self, pDesc: *mut ::D3D12_LIBRARY_DESC) -> ::HRESULT, - fn GetFunctionByIndex( - &mut self, FunctionIndex: ::INT - ) -> *mut ::ID3D12FunctionReflection -}); - -RIDL!( -interface ID3D12ShaderReflectionConstantBuffer(ID3D12ShaderReflectionConstantBufferVtbl) { - fn GetDesc(&mut self, pDesc: *mut ::D3D12_SHADER_BUFFER_DESC) -> ::HRESULT, - fn GetVariableByIndex( - &mut self, Index: ::UINT - ) -> *mut ::ID3D12ShaderReflectionVariable, - fn GetVariableByName( - &mut self, Name: ::LPCSTR - ) -> *mut ::ID3D12ShaderReflectionVariable -}); - -RIDL!( -interface ID3D12ShaderReflectionType(ID3D12ShaderReflectionTypeVtbl) { - fn GetDesc(&mut self, pDesc: *mut ::D3D12_SHADER_TYPE_DESC) -> ::HRESULT, - fn GetMemberTypeByIndex( - &mut self, Index: ::UINT - ) -> *mut ::ID3D12ShaderReflectionType, - fn GetMemberTypeByName( - &mut self, Name: ::LPCSTR - ) -> *mut ::ID3D12ShaderReflectionType, - fn GetMemberTypeName(&mut self, Index: ::UINT) -> ::LPCSTR, - fn IsEqual( - &mut self, pType: *mut ::ID3D12ShaderReflectionType - ) -> ::HRESULT, - fn GetSubType(&mut self) -> *mut ::ID3D12ShaderReflectionType, - fn GetBaseClass(&mut self) -> *mut ::ID3D12ShaderReflectionType, - fn GetNumInterfaces(&mut self) -> ::UINT, - fn GetInterfaceByIndex( - &mut self, uIndex: ::UINT - ) -> *mut ::ID3D12ShaderReflectionType, - fn IsOfType( - &mut self, pType: *mut ::ID3D12ShaderReflectionType - ) -> ::HRESULT, - fn ImplementsInterface( - &mut self, pBase: *mut ::ID3D12ShaderReflectionType - ) -> ::HRESULT -}); - -RIDL!( -interface ID3D12ShaderReflectionVariable(ID3D12ShaderReflectionVariableVtbl) { - fn GetDesc( - &mut self, pDesc: *mut ::D3D12_SHADER_VARIABLE_DESC - ) -> ::HRESULT, - fn GetType(&mut self) -> *mut ::ID3D12ShaderReflectionType, - fn GetBuffer(&mut self) -> *mut ::ID3D12ShaderReflectionConstantBuffer, - fn GetInterfaceSlot(&mut self, uArrayIndex: ::UINT) -> ::UINT -}); - -RIDL!( -interface ID3D12ShaderReflection(ID3D12ShaderReflectionVtbl): IUnknown(IUnknownVtbl) { - fn QueryInterface( - &mut self, iid: *const ::IID, ppv: *mut ::LPVOID - ) -> ::HRESULT, - fn AddRef(&mut self) -> ::ULONG, - fn Release(&mut self) -> ::ULONG, - fn GetDesc(&mut self, pDesc: *mut ::D3D12_SHADER_DESC) -> ::HRESULT, - fn GetConstantBufferByIndex( - &mut self, Index: ::UINT - ) -> *mut ::ID3D12ShaderReflectionConstantBuffer, - fn GetConstantBufferByName( - &mut self, Name: ::LPCSTR - ) -> *mut ::ID3D12ShaderReflectionConstantBuffer, - fn GetResourceBindingDesc( - &mut self, ResourceIndex: ::UINT, pDesc: *mut ::D3D12_SHADER_INPUT_BIND_DESC - ) -> ::HRESULT, - fn GetInputParameterDesc( - &mut self, ParameterIndex: ::UINT, pDesc: *mut ::D3D12_SIGNATURE_PARAMETER_DESC - ) -> ::HRESULT, - fn GetOutputParameterDesc( - &mut self, ParameterIndex: ::UINT, pDesc: *mut ::D3D12_SIGNATURE_PARAMETER_DESC - ) -> ::HRESULT, - fn GetPatchConstantParameterDesc( - &mut self, ParameterIndex: ::UINT, pDesc: *mut ::D3D12_SIGNATURE_PARAMETER_DESC - ) -> ::HRESULT, - fn GetVariableByName( - &mut self, Name: ::LPCSTR - ) -> *mut ::ID3D12ShaderReflectionVariable, - fn GetResourceBindingDescByName( - &mut self, Name: ::LPCSTR, pDesc: *mut ::D3D12_SHADER_INPUT_BIND_DESC - ) -> ::HRESULT, - fn GetMovInstructionCount(&mut self) -> ::UINT, - fn GetMovcInstructionCount(&mut self) -> ::UINT, - fn GetConversionInstructionCount(&mut self) -> ::UINT, - fn GetBitwiseInstructionCount(&mut self) -> ::UINT, - fn GetGSInputPrimitive(&mut self) -> ::D3D_PRIMITIVE, - fn IsSampleFrequencyShader(&mut self) -> ::BOOL, - fn GetNumInterfaceSlots(&mut self) -> ::UINT, - fn GetMinFeatureLevel( - &mut self, pLevel: *mut ::D3D_FEATURE_LEVEL - ) -> ::HRESULT, - fn GetThreadGroupSize( - &mut self, pSizeX: *mut ::UINT, pSizeY: *mut ::UINT, pSizeZ: *mut ::UINT - ) -> ::UINT, - fn GetRequiresFlags(&mut self) -> ::UINT64 -}); - -pub type D3D12_CBUFFER_TYPE = ::D3D_CBUFFER_TYPE; -pub type D3D12_RESOURCE_RETURN_TYPE = ::D3D_RESOURCE_RETURN_TYPE; -pub type D3D12_TESSELLATOR_DOMAIN = ::D3D_TESSELLATOR_DOMAIN; -pub type D3D12_TESSELLATOR_OUTPUT_PRIMITIVE = ::D3D_TESSELLATOR_OUTPUT_PRIMITIVE; -pub type D3D12_TESSELLATOR_PARTITIONING = ::D3D_TESSELLATOR_PARTITIONING; -pub type LPD3D12FUNCTIONPARAMETERREFLECTION = *mut ::ID3D12FunctionParameterReflection; -pub type LPD3D12FUNCTIONREFLECTION = *mut ::ID3D12FunctionReflection; -pub type LPD3D12LIBRARYREFLECTION = *mut ::ID3D12LibraryReflection; -pub type LPD3D12SHADERREFLECTION = *mut ::ID3D12ShaderReflection; -pub type LPD3D12SHADERREFLECTIONCONSTANTBUFFER = *mut ::ID3D12ShaderReflectionConstantBuffer; -pub type LPD3D12SHADERREFLECTIONTYPE = *mut ::ID3D12ShaderReflectionType; -pub type LPD3D12SHADERREFLECTIONVARIABLE = *mut ::ID3D12ShaderReflectionVariable; -pub const D3D_SHADER_REQUIRES_INNER_COVERAGE: ::UINT64 = 0x00000400; -pub const D3D_SHADER_REQUIRES_ROVS: ::UINT64 = 0x00001000; -pub const D3D_SHADER_REQUIRES_STENCIL_REF: ::UINT64 = 0x00000200; -pub const D3D_SHADER_REQUIRES_TYPED_UAV_LOAD_ADDITIONAL_FORMATS: ::UINT64 = 0x00000800; -pub const D3D_SHADER_REQUIRES_VIEWPORT_AND_RT_ARRAY_INDEX_FROM_ANY_SHADER_FEEDING_RASTERIZER: ::UINT64 = 0x00002000; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/d3d9caps.rs cargo-0.37.0/vendor/winapi-0.2.8/src/d3d9caps.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/d3d9caps.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/d3d9caps.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,349 +0,0 @@ -// Copyright © 2015, Corey Richardson -// Licensed under the MIT License -//! Direct3D capabilities include file -STRUCT!{struct D3DVSHADERCAPS2_0 { - Caps: ::DWORD, - DynamicFlowControlDepth: ::INT, - NumTemps: ::INT, - StaticFlowControlDepth: ::INT, -}} -pub const D3DVS20CAPS_PREDICATION: ::DWORD = 1 << 0; -pub const D3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH: ::DWORD = 24; -pub const D3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH: ::DWORD = 0; -pub const D3DVS20_MAX_NUMTEMPS: ::DWORD = 32; -pub const D3DVS20_MIN_NUMTEMPS: ::DWORD = 12; -pub const D3DVS20_MAX_STATICFLOWCONTROLDEPTH: ::DWORD = 4; -pub const D3DVS20_MIN_STATICFLOWCONTROLDEPTH: ::DWORD = 1; -STRUCT!{struct D3DPSHADERCAPS2_0 { - Caps: ::DWORD, - DynamicFlowControlDepth: ::INT, - NumTemps: ::INT, - StaticFlowControlDepth: ::INT, - NumInstructionSlots: ::INT, -}} -pub const D3DPS20CAPS_ARBITRARYSWIZZLE: ::DWORD = 1 << 0; -pub const D3DPS20CAPS_GRADIENTINSTRUCTIONS: ::DWORD = 1 << 1; -pub const D3DPS20CAPS_PREDICATION: ::DWORD = 1 << 2; -pub const D3DPS20CAPS_NODEPENDENTREADLIMIT: ::DWORD = 1 << 3; -pub const D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT: ::DWORD = 1 << 4; -pub const D3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH: ::DWORD = 24; -pub const D3DPS20_MIN_DYNAMICFLOWCONTROLDEPTH: ::DWORD = 0; -pub const D3DPS20_MAX_NUMTEMPS: ::DWORD = 32; -pub const D3DPS20_MIN_NUMTEMPS: ::DWORD = 12; -pub const D3DPS20_MAX_STATICFLOWCONTROLDEPTH: ::DWORD = 4; -pub const D3DPS20_MIN_STATICFLOWCONTROLDEPTH: ::DWORD = 0; -pub const D3DPS20_MAX_NUMINSTRUCTIONSLOTS: ::DWORD = 512; -pub const D3DPS20_MIN_NUMINSTRUCTIONSLOTS: ::DWORD = 96; -pub const D3DMIN30SHADERINSTRUCTIONS: ::DWORD = 512; -pub const D3DMAX30SHADERINSTRUCTIONS: ::DWORD = 32768; -STRUCT!{struct D3DOVERLAYCAPS { - Caps: ::UINT, - MaxOverlayDisplayWidth: ::UINT, - MaxOverlayDisplayHeight: ::UINT, -}} -pub const D3DOVERLAYCAPS_FULLRANGERGB: ::DWORD = 0x00000001; -pub const D3DOVERLAYCAPS_LIMITEDRANGERGB: ::DWORD = 0x00000002; -pub const D3DOVERLAYCAPS_YCbCr_BT601: ::DWORD = 0x00000004; -pub const D3DOVERLAYCAPS_YCbCr_BT709: ::DWORD = 0x00000008; -pub const D3DOVERLAYCAPS_YCbCr_BT601_xvYCC: ::DWORD = 0x00000010; -pub const D3DOVERLAYCAPS_YCbCr_BT709_xvYCC: ::DWORD = 0x00000020; -pub const D3DOVERLAYCAPS_STRETCHX: ::DWORD = 0x00000040; -pub const D3DOVERLAYCAPS_STRETCHY: ::DWORD = 0x00000080; -STRUCT!{struct D3DCONTENTPROTECTIONCAPS { - Caps: ::DWORD, - KeyExchangeType: ::GUID, - BufferAlignmentStart: ::UINT, - BlockAlignmentSize: ::UINT, - ProtectedMemorySize: ::ULONGLONG, -}} -pub const D3DCPCAPS_SOFTWARE: ::DWORD = 0x00000001; -pub const D3DCPCAPS_HARDWARE: ::DWORD = 0x00000002; -pub const D3DCPCAPS_PROTECTIONALWAYSON: ::DWORD = 0x00000004; -pub const D3DCPCAPS_PARTIALDECRYPTION: ::DWORD = 0x00000008; -pub const D3DCPCAPS_CONTENTKEY: ::DWORD = 0x00000010; -pub const D3DCPCAPS_FRESHENSESSIONKEY: ::DWORD = 0x00000020; -pub const D3DCPCAPS_ENCRYPTEDREADBACK: ::DWORD = 0x00000040; -pub const D3DCPCAPS_ENCRYPTEDREADBACKKEY: ::DWORD = 0x00000080; -pub const D3DCPCAPS_SEQUENTIAL_CTR_IV: ::DWORD = 0x00000100; -pub const D3DCPCAPS_ENCRYPTSLICEDATAONLY: ::DWORD = 0x00000200; -STRUCT!{struct D3DCAPS9 { - DeviceType: ::D3DDEVTYPE, - AdapterOrdinal: ::UINT, - Caps: ::DWORD, - Caps2: ::DWORD, - Caps3: ::DWORD, - PresentationIntervals: ::DWORD, - CursorCaps: ::DWORD, - DevCaps: ::DWORD, - PrimitiveMiscCaps: ::DWORD, - RasterCaps: ::DWORD, - ZCmpCaps: ::DWORD, - SrcBlendCaps: ::DWORD, - DestBlendCaps: ::DWORD, - AlphaCmpCaps: ::DWORD, - ShadeCaps: ::DWORD, - TextureCaps: ::DWORD, - TextureFilterCaps: ::DWORD, - CubeTextureFilterCaps: ::DWORD, - VolumeTextureFilterCaps: ::DWORD, - TextureAddressCaps: ::DWORD, - VolumeTextureAddressCaps: ::DWORD, - LineCaps: ::DWORD, - MaxTextureWidth: ::DWORD, - MaxTextureHeight: ::DWORD, - MaxVolumeExtent: ::DWORD, - MaxTextureRepeat: ::DWORD, - MaxTextureAspectRatio: ::DWORD, - MaxAnisotropy: ::DWORD, - MaxVertexW: ::c_float, - GuardBandLeft: ::c_float, - GuardBandTop: ::c_float, - GuardBandRight: ::c_float, - GuardBandBottom: ::c_float, - ExtentsAdjust: ::c_float, - StencilCaps: ::DWORD, - FVFCaps: ::DWORD, - TextureOpCaps: ::DWORD, - MaxTextureBlendStages: ::DWORD, - MaxSimultaneousTextures: ::DWORD, - VertexProcessingCaps: ::DWORD, - MaxActiveLights: ::DWORD, - MaxUserClipPlanes: ::DWORD, - MaxVertexBlendMatrices: ::DWORD, - MaxVertexBlendMatrixIndex: ::DWORD, - MaxPointSize: ::c_float, - MaxPrimitiveCount: ::DWORD, - MaxVertexIndex: ::DWORD, - MaxStreams: ::DWORD, - MaxStreamStride: ::DWORD, - VertexShaderVersion: ::DWORD, - MaxVertexShaderConst: ::DWORD, - PixelShaderVersion: ::DWORD, - PixelShader1xMaxValue: ::c_float, - DevCaps2: ::DWORD, - MaxNpatchTessellationLevel: ::c_float, - Reserved5: ::DWORD, - MasterAdapterOrdinal: ::UINT, - AdapterOrdinalInGroup: ::UINT, - NumberOfAdaptersInGroup: ::UINT, - DeclTypes: ::DWORD, - NumSimultaneousRTs: ::DWORD, - StretchRectFilterCaps: ::DWORD, - VS20Caps: ::D3DVSHADERCAPS2_0, - PS20Caps: ::D3DPSHADERCAPS2_0, - VertexTextureFilterCaps: ::DWORD, - MaxVShaderInstructionsExecuted: ::DWORD, - MaxPShaderInstructionsExecuted: ::DWORD, - MaxVertexShader30InstructionSlots: ::DWORD, - MaxPixelShader30InstructionSlots: ::DWORD, -}} -pub const D3DCAPS_OVERLAY: ::DWORD = 0x00000800; -pub const D3DCAPS_READ_SCANLINE: ::DWORD = 0x00020000; -pub const D3DCAPS2_FULLSCREENGAMMA: ::DWORD = 0x00020000; -pub const D3DCAPS2_CANCALIBRATEGAMMA: ::DWORD = 0x00100000; -pub const D3DCAPS2_RESERVED: ::DWORD = 0x02000000; -pub const D3DCAPS2_CANMANAGERESOURCE: ::DWORD = 0x10000000; -pub const D3DCAPS2_DYNAMICTEXTURES: ::DWORD = 0x20000000; -pub const D3DCAPS2_CANAUTOGENMIPMAP: ::DWORD = 0x40000000; -pub const D3DCAPS2_CANSHARERESOURCE: ::DWORD = 0x80000000; -pub const D3DCAPS3_RESERVED: ::DWORD = 0x8000001f; -pub const D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD: ::DWORD = 0x00000020; -pub const D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION: ::DWORD = 0x00000080; -pub const D3DCAPS3_COPY_TO_VIDMEM: ::DWORD = 0x00000100; -pub const D3DCAPS3_COPY_TO_SYSTEMMEM: ::DWORD = 0x00000200; -pub const D3DCAPS3_DXVAHD: ::DWORD = 0x00000400; -pub const D3DCAPS3_DXVAHD_LIMITED: ::DWORD = 0x00000800; -pub const D3DPRESENT_INTERVAL_DEFAULT: ::DWORD = 0x00000000; -pub const D3DPRESENT_INTERVAL_ONE: ::DWORD = 0x00000001; -pub const D3DPRESENT_INTERVAL_TWO: ::DWORD = 0x00000002; -pub const D3DPRESENT_INTERVAL_THREE: ::DWORD = 0x00000004; -pub const D3DPRESENT_INTERVAL_FOUR: ::DWORD = 0x00000008; -pub const D3DPRESENT_INTERVAL_IMMEDIATE: ::DWORD = 0x80000000; -pub const D3DCURSORCAPS_COLOR: ::DWORD = 0x00000001; -pub const D3DCURSORCAPS_LOWRES: ::DWORD = 0x00000002; -pub const D3DDEVCAPS_EXECUTESYSTEMMEMORY: ::DWORD = 0x00000010; -pub const D3DDEVCAPS_EXECUTEVIDEOMEMORY: ::DWORD = 0x00000020; -pub const D3DDEVCAPS_TLVERTEXSYSTEMMEMORY: ::DWORD = 0x00000040; -pub const D3DDEVCAPS_TLVERTEXVIDEOMEMORY: ::DWORD = 0x00000080; -pub const D3DDEVCAPS_TEXTURESYSTEMMEMORY: ::DWORD = 0x00000100; -pub const D3DDEVCAPS_TEXTUREVIDEOMEMORY: ::DWORD = 0x00000200; -pub const D3DDEVCAPS_DRAWPRIMTLVERTEX: ::DWORD = 0x00000400; -pub const D3DDEVCAPS_CANRENDERAFTERFLIP: ::DWORD = 0x00000800; -pub const D3DDEVCAPS_TEXTURENONLOCALVIDMEM: ::DWORD = 0x00001000; -pub const D3DDEVCAPS_DRAWPRIMITIVES2: ::DWORD = 0x00002000; -pub const D3DDEVCAPS_SEPARATETEXTUREMEMORIES: ::DWORD = 0x00004000; -pub const D3DDEVCAPS_DRAWPRIMITIVES2EX: ::DWORD = 0x00008000; -pub const D3DDEVCAPS_HWTRANSFORMANDLIGHT: ::DWORD = 0x00010000; -pub const D3DDEVCAPS_CANBLTSYSTONONLOCAL: ::DWORD = 0x00020000; -pub const D3DDEVCAPS_HWRASTERIZATION: ::DWORD = 0x00080000; -pub const D3DDEVCAPS_PUREDEVICE: ::DWORD = 0x00100000; -pub const D3DDEVCAPS_QUINTICRTPATCHES: ::DWORD = 0x00200000; -pub const D3DDEVCAPS_RTPATCHES: ::DWORD = 0x00400000; -pub const D3DDEVCAPS_RTPATCHHANDLEZERO: ::DWORD = 0x00800000; -pub const D3DDEVCAPS_NPATCHES: ::DWORD = 0x01000000; -pub const D3DPMISCCAPS_MASKZ: ::DWORD = 0x00000002; -pub const D3DPMISCCAPS_CULLNONE: ::DWORD = 0x00000010; -pub const D3DPMISCCAPS_CULLCW: ::DWORD = 0x00000020; -pub const D3DPMISCCAPS_CULLCCW: ::DWORD = 0x00000040; -pub const D3DPMISCCAPS_COLORWRITEENABLE: ::DWORD = 0x00000080; -pub const D3DPMISCCAPS_CLIPPLANESCALEDPOINTS: ::DWORD = 0x00000100; -pub const D3DPMISCCAPS_CLIPTLVERTS: ::DWORD = 0x00000200; -pub const D3DPMISCCAPS_TSSARGTEMP: ::DWORD = 0x00000400; -pub const D3DPMISCCAPS_BLENDOP: ::DWORD = 0x00000800; -pub const D3DPMISCCAPS_NULLREFERENCE: ::DWORD = 0x00001000; -pub const D3DPMISCCAPS_INDEPENDENTWRITEMASKS: ::DWORD = 0x00004000; -pub const D3DPMISCCAPS_PERSTAGECONSTANT: ::DWORD = 0x00008000; -pub const D3DPMISCCAPS_FOGANDSPECULARALPHA: ::DWORD = 0x00010000; -pub const D3DPMISCCAPS_SEPARATEALPHABLEND: ::DWORD = 0x00020000; -pub const D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS: ::DWORD = 0x00040000; -pub const D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING: ::DWORD = 0x00080000; -pub const D3DPMISCCAPS_FOGVERTEXCLAMPED: ::DWORD = 0x00100000; -pub const D3DPMISCCAPS_POSTBLENDSRGBCONVERT: ::DWORD = 0x00200000; -pub const D3DLINECAPS_TEXTURE: ::DWORD = 0x00000001; -pub const D3DLINECAPS_ZTEST: ::DWORD = 0x00000002; -pub const D3DLINECAPS_BLEND: ::DWORD = 0x00000004; -pub const D3DLINECAPS_ALPHACMP: ::DWORD = 0x00000008; -pub const D3DLINECAPS_FOG: ::DWORD = 0x00000010; -pub const D3DLINECAPS_ANTIALIAS: ::DWORD = 0x00000020; -pub const D3DPRASTERCAPS_DITHER: ::DWORD = 0x00000001; -pub const D3DPRASTERCAPS_ZTEST: ::DWORD = 0x00000010; -pub const D3DPRASTERCAPS_FOGVERTEX: ::DWORD = 0x00000080; -pub const D3DPRASTERCAPS_FOGTABLE: ::DWORD = 0x00000100; -pub const D3DPRASTERCAPS_MIPMAPLODBIAS: ::DWORD = 0x00002000; -pub const D3DPRASTERCAPS_ZBUFFERLESSHSR: ::DWORD = 0x00008000; -pub const D3DPRASTERCAPS_FOGRANGE: ::DWORD = 0x00010000; -pub const D3DPRASTERCAPS_ANISOTROPY: ::DWORD = 0x00020000; -pub const D3DPRASTERCAPS_WBUFFER: ::DWORD = 0x00040000; -pub const D3DPRASTERCAPS_WFOG: ::DWORD = 0x00100000; -pub const D3DPRASTERCAPS_ZFOG: ::DWORD = 0x00200000; -pub const D3DPRASTERCAPS_COLORPERSPECTIVE: ::DWORD = 0x00400000; -pub const D3DPRASTERCAPS_SCISSORTEST: ::DWORD = 0x01000000; -pub const D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS: ::DWORD = 0x02000000; -pub const D3DPRASTERCAPS_DEPTHBIAS: ::DWORD = 0x04000000; -pub const D3DPRASTERCAPS_MULTISAMPLE_TOGGLE: ::DWORD = 0x08000000; -pub const D3DPCMPCAPS_NEVER: ::DWORD = 0x00000001; -pub const D3DPCMPCAPS_LESS: ::DWORD = 0x00000002; -pub const D3DPCMPCAPS_EQUAL: ::DWORD = 0x00000004; -pub const D3DPCMPCAPS_LESSEQUAL: ::DWORD = 0x00000008; -pub const D3DPCMPCAPS_GREATER: ::DWORD = 0x00000010; -pub const D3DPCMPCAPS_NOTEQUAL: ::DWORD = 0x00000020; -pub const D3DPCMPCAPS_GREATEREQUAL: ::DWORD = 0x00000040; -pub const D3DPCMPCAPS_ALWAYS: ::DWORD = 0x00000080; -pub const D3DPBLENDCAPS_ZERO: ::DWORD = 0x00000001; -pub const D3DPBLENDCAPS_ONE: ::DWORD = 0x00000002; -pub const D3DPBLENDCAPS_SRCCOLOR: ::DWORD = 0x00000004; -pub const D3DPBLENDCAPS_INVSRCCOLOR: ::DWORD = 0x00000008; -pub const D3DPBLENDCAPS_SRCALPHA: ::DWORD = 0x00000010; -pub const D3DPBLENDCAPS_INVSRCALPHA: ::DWORD = 0x00000020; -pub const D3DPBLENDCAPS_DESTALPHA: ::DWORD = 0x00000040; -pub const D3DPBLENDCAPS_INVDESTALPHA: ::DWORD = 0x00000080; -pub const D3DPBLENDCAPS_DESTCOLOR: ::DWORD = 0x00000100; -pub const D3DPBLENDCAPS_INVDESTCOLOR: ::DWORD = 0x00000200; -pub const D3DPBLENDCAPS_SRCALPHASAT: ::DWORD = 0x00000400; -pub const D3DPBLENDCAPS_BOTHSRCALPHA: ::DWORD = 0x00000800; -pub const D3DPBLENDCAPS_BOTHINVSRCALPHA: ::DWORD = 0x00001000; -pub const D3DPBLENDCAPS_BLENDFACTOR: ::DWORD = 0x00002000; -pub const D3DPBLENDCAPS_SRCCOLOR2: ::DWORD = 0x00004000; -pub const D3DPBLENDCAPS_INVSRCCOLOR2: ::DWORD = 0x00008000; -pub const D3DPSHADECAPS_COLORGOURAUDRGB: ::DWORD = 0x00000008; -pub const D3DPSHADECAPS_SPECULARGOURAUDRGB: ::DWORD = 0x00000200; -pub const D3DPSHADECAPS_ALPHAGOURAUDBLEND: ::DWORD = 0x00004000; -pub const D3DPSHADECAPS_FOGGOURAUD: ::DWORD = 0x00080000; -pub const D3DPTEXTURECAPS_PERSPECTIVE: ::DWORD = 0x00000001; -pub const D3DPTEXTURECAPS_POW2: ::DWORD = 0x00000002; -pub const D3DPTEXTURECAPS_ALPHA: ::DWORD = 0x00000004; -pub const D3DPTEXTURECAPS_SQUAREONLY: ::DWORD = 0x00000020; -pub const D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE: ::DWORD = 0x00000040; -pub const D3DPTEXTURECAPS_ALPHAPALETTE: ::DWORD = 0x00000080; -pub const D3DPTEXTURECAPS_NONPOW2CONDITIONAL: ::DWORD = 0x00000100; -pub const D3DPTEXTURECAPS_PROJECTED: ::DWORD = 0x00000400; -pub const D3DPTEXTURECAPS_CUBEMAP: ::DWORD = 0x00000800; -pub const D3DPTEXTURECAPS_VOLUMEMAP: ::DWORD = 0x00002000; -pub const D3DPTEXTURECAPS_MIPMAP: ::DWORD = 0x00004000; -pub const D3DPTEXTURECAPS_MIPVOLUMEMAP: ::DWORD = 0x00008000; -pub const D3DPTEXTURECAPS_MIPCUBEMAP: ::DWORD = 0x00010000; -pub const D3DPTEXTURECAPS_CUBEMAP_POW2: ::DWORD = 0x00020000; -pub const D3DPTEXTURECAPS_VOLUMEMAP_POW2: ::DWORD = 0x00040000; -pub const D3DPTEXTURECAPS_NOPROJECTEDBUMPENV: ::DWORD = 0x00200000; -pub const D3DPTFILTERCAPS_MINFPOINT: ::DWORD = 0x00000100; -pub const D3DPTFILTERCAPS_MINFLINEAR: ::DWORD = 0x00000200; -pub const D3DPTFILTERCAPS_MINFANISOTROPIC: ::DWORD = 0x00000400; -pub const D3DPTFILTERCAPS_MINFPYRAMIDALQUAD: ::DWORD = 0x00000800; -pub const D3DPTFILTERCAPS_MINFGAUSSIANQUAD: ::DWORD = 0x00001000; -pub const D3DPTFILTERCAPS_MIPFPOINT: ::DWORD = 0x00010000; -pub const D3DPTFILTERCAPS_MIPFLINEAR: ::DWORD = 0x00020000; -pub const D3DPTFILTERCAPS_CONVOLUTIONMONO: ::DWORD = 0x00040000; -pub const D3DPTFILTERCAPS_MAGFPOINT: ::DWORD = 0x01000000; -pub const D3DPTFILTERCAPS_MAGFLINEAR: ::DWORD = 0x02000000; -pub const D3DPTFILTERCAPS_MAGFANISOTROPIC: ::DWORD = 0x04000000; -pub const D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD: ::DWORD = 0x08000000; -pub const D3DPTFILTERCAPS_MAGFGAUSSIANQUAD: ::DWORD = 0x10000000; -pub const D3DPTADDRESSCAPS_WRAP: ::DWORD = 0x00000001; -pub const D3DPTADDRESSCAPS_MIRROR: ::DWORD = 0x00000002; -pub const D3DPTADDRESSCAPS_CLAMP: ::DWORD = 0x00000004; -pub const D3DPTADDRESSCAPS_BORDER: ::DWORD = 0x00000008; -pub const D3DPTADDRESSCAPS_INDEPENDENTUV: ::DWORD = 0x00000010; -pub const D3DPTADDRESSCAPS_MIRRORONCE: ::DWORD = 0x00000020; -pub const D3DSTENCILCAPS_KEEP: ::DWORD = 0x00000001; -pub const D3DSTENCILCAPS_ZERO: ::DWORD = 0x00000002; -pub const D3DSTENCILCAPS_REPLACE: ::DWORD = 0x00000004; -pub const D3DSTENCILCAPS_INCRSAT: ::DWORD = 0x00000008; -pub const D3DSTENCILCAPS_DECRSAT: ::DWORD = 0x00000010; -pub const D3DSTENCILCAPS_INVERT: ::DWORD = 0x00000020; -pub const D3DSTENCILCAPS_INCR: ::DWORD = 0x00000040; -pub const D3DSTENCILCAPS_DECR: ::DWORD = 0x00000080; -pub const D3DSTENCILCAPS_TWOSIDED: ::DWORD = 0x00000100; -pub const D3DTEXOPCAPS_DISABLE: ::DWORD = 0x00000001; -pub const D3DTEXOPCAPS_SELECTARG1: ::DWORD = 0x00000002; -pub const D3DTEXOPCAPS_SELECTARG2: ::DWORD = 0x00000004; -pub const D3DTEXOPCAPS_MODULATE: ::DWORD = 0x00000008; -pub const D3DTEXOPCAPS_MODULATE2X: ::DWORD = 0x00000010; -pub const D3DTEXOPCAPS_MODULATE4X: ::DWORD = 0x00000020; -pub const D3DTEXOPCAPS_ADD: ::DWORD = 0x00000040; -pub const D3DTEXOPCAPS_ADDSIGNED: ::DWORD = 0x00000080; -pub const D3DTEXOPCAPS_ADDSIGNED2X: ::DWORD = 0x00000100; -pub const D3DTEXOPCAPS_SUBTRACT: ::DWORD = 0x00000200; -pub const D3DTEXOPCAPS_ADDSMOOTH: ::DWORD = 0x00000400; -pub const D3DTEXOPCAPS_BLENDDIFFUSEALPHA: ::DWORD = 0x00000800; -pub const D3DTEXOPCAPS_BLENDTEXTUREALPHA: ::DWORD = 0x00001000; -pub const D3DTEXOPCAPS_BLENDFACTORALPHA: ::DWORD = 0x00002000; -pub const D3DTEXOPCAPS_BLENDTEXTUREALPHAPM: ::DWORD = 0x00004000; -pub const D3DTEXOPCAPS_BLENDCURRENTALPHA: ::DWORD = 0x00008000; -pub const D3DTEXOPCAPS_PREMODULATE: ::DWORD = 0x00010000; -pub const D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR: ::DWORD = 0x00020000; -pub const D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA: ::DWORD = 0x00040000; -pub const D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR: ::DWORD = 0x00080000; -pub const D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA: ::DWORD = 0x00100000; -pub const D3DTEXOPCAPS_BUMPENVMAP: ::DWORD = 0x00200000; -pub const D3DTEXOPCAPS_BUMPENVMAPLUMINANCE: ::DWORD = 0x00400000; -pub const D3DTEXOPCAPS_DOTPRODUCT3: ::DWORD = 0x00800000; -pub const D3DTEXOPCAPS_MULTIPLYADD: ::DWORD = 0x01000000; -pub const D3DTEXOPCAPS_LERP: ::DWORD = 0x02000000; -pub const D3DFVFCAPS_TEXCOORDCOUNTMASK: ::DWORD = 0x0000ffff; -pub const D3DFVFCAPS_DONOTSTRIPELEMENTS: ::DWORD = 0x00080000; -pub const D3DFVFCAPS_PSIZE: ::DWORD = 0x00100000; -pub const D3DVTXPCAPS_TEXGEN: ::DWORD = 0x00000001; -pub const D3DVTXPCAPS_MATERIALSOURCE7: ::DWORD = 0x00000002; -pub const D3DVTXPCAPS_DIRECTIONALLIGHTS: ::DWORD = 0x00000008; -pub const D3DVTXPCAPS_POSITIONALLIGHTS: ::DWORD = 0x00000010; -pub const D3DVTXPCAPS_LOCALVIEWER: ::DWORD = 0x00000020; -pub const D3DVTXPCAPS_TWEENING: ::DWORD = 0x00000040; -pub const D3DVTXPCAPS_TEXGEN_SPHEREMAP: ::DWORD = 0x00000100; -pub const D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER: ::DWORD = 0x00000200; -pub const D3DDEVCAPS2_STREAMOFFSET: ::DWORD = 0x00000001; -pub const D3DDEVCAPS2_DMAPNPATCH: ::DWORD = 0x00000002; -pub const D3DDEVCAPS2_ADAPTIVETESSRTPATCH: ::DWORD = 0x00000004; -pub const D3DDEVCAPS2_ADAPTIVETESSNPATCH: ::DWORD = 0x00000008; -pub const D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES: ::DWORD = 0x00000010; -pub const D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH: ::DWORD = 0x00000020; -pub const D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET: ::DWORD = 0x00000040; -pub const D3DDTCAPS_UBYTE4: ::DWORD = 0x00000001; -pub const D3DDTCAPS_UBYTE4N: ::DWORD = 0x00000002; -pub const D3DDTCAPS_SHORT2N: ::DWORD = 0x00000004; -pub const D3DDTCAPS_SHORT4N: ::DWORD = 0x00000008; -pub const D3DDTCAPS_USHORT2N: ::DWORD = 0x00000010; -pub const D3DDTCAPS_USHORT4N: ::DWORD = 0x00000020; -pub const D3DDTCAPS_UDEC3: ::DWORD = 0x00000040; -pub const D3DDTCAPS_DEC3N: ::DWORD = 0x00000080; -pub const D3DDTCAPS_FLOAT16_2: ::DWORD = 0x00000100; -pub const D3DDTCAPS_FLOAT16_4: ::DWORD = 0x00000200; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/d3d9.rs cargo-0.37.0/vendor/winapi-0.2.8/src/d3d9.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/d3d9.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/d3d9.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,713 +0,0 @@ -// Copyright © 2015, Corey Richardson -// Licensed under the MIT License -//! Direct3D include file -pub const D3D_SDK_VERSION: ::DWORD = 32; -pub const D3D9b_SDK_VERSION: ::DWORD = 31; -RIDL!( -interface IDirect3D9(IDirect3D9Vtbl): IUnknown(IUnknownVtbl) { - fn RegisterSoftwareDevice(&mut self, pInitializeFunction: *mut ::VOID) -> ::HRESULT, - fn GetAdapterCount(&mut self) -> ::UINT, - fn GetAdapterIdentifier( - &mut self, Adapter: ::UINT, Flags: ::DWORD, pIdentifier: *mut ::D3DADAPTER_IDENTIFIER9 - ) -> ::HRESULT, - fn GetAdapterModeCount(&mut self, Adapter: ::UINT, Format: ::D3DFORMAT) -> ::UINT, - fn EnumAdapterModes( - &mut self, Adapter: ::UINT, Format: ::D3DFORMAT, Mode: ::UINT, pMode: *mut ::D3DDISPLAYMODE - ) -> ::HRESULT, - fn GetAdapterDisplayMode( - &mut self, Adapter: ::UINT, pMode: *mut ::D3DDISPLAYMODE - ) -> ::HRESULT, - fn CheckDeviceType( - &mut self, Adapter: ::UINT, DevType: ::D3DDEVTYPE, AdapterFormat: ::D3DFORMAT, - BackBufferFormat: ::D3DFORMAT, bWindowed: ::BOOL - ) -> ::HRESULT, - fn CheckDeviceFormat( - &mut self, Adapter: ::UINT, DeviceType: ::D3DDEVTYPE, AdapterFormat: ::D3DFORMAT, - Usage: ::DWORD, RType: ::D3DRESOURCETYPE, CheckFormat: ::D3DFORMAT - ) -> ::HRESULT, - fn CheckDeviceMultiSampleType( - &mut self, Adapter: ::UINT, DeviceType: ::D3DDEVTYPE, SurfaceFormat: ::D3DFORMAT, - Windowed: ::BOOL, MultiSampleType: ::D3DMULTISAMPLE_TYPE, pQualityLevels: *mut ::DWORD - ) -> ::HRESULT, - fn CheckDepthStencilMatch( - &mut self, Adapter: ::UINT, DeviceType: ::D3DDEVTYPE, AdapterFormat: ::D3DFORMAT, - RenderTargetFormat: ::D3DFORMAT, DepthStencilFormat: ::D3DFORMAT - ) -> ::HRESULT, - fn CheckDeviceFormatConversion( - &mut self, Adapter: ::UINT, DeviceType: ::D3DDEVTYPE, SourceFormat: ::D3DFORMAT, - TargetFormat: ::D3DFORMAT - ) -> ::HRESULT, - fn GetDeviceCaps( - &mut self, Adapter: ::UINT, DeviceType: ::D3DDEVTYPE, pCaps: *mut ::D3DCAPS9 - ) -> ::HRESULT, - fn GetAdapterMonitor(&mut self, Adapter: ::UINT) -> ::HMONITOR, - fn CreateDevice( - &mut self, Adapter: ::UINT, DeviceType: ::D3DDEVTYPE, hFocusWindow: ::HWND, - BehaviorFlags: ::DWORD, pPresentationParameters: *mut ::D3DPRESENT_PARAMETERS, - ppReturnedDeviceInterface: *mut *mut IDirect3DDevice9 - ) -> ::HRESULT -} -); -pub type LPDIRECT3D9 = *mut IDirect3D9; -pub type PDIRECT3D9 = *mut IDirect3D9; -RIDL!( -interface IDirect3DDevice9(IDirect3DDevice9Vtbl): IUnknown(IUnknownVtbl) { - fn TestCooperativeLevel(&mut self) -> ::HRESULT, - fn GetAvailableTextureMem(&mut self) -> ::UINT, - fn EvictManagedResources(&mut self) -> ::HRESULT, - fn GetDirect3D(&mut self, ppD3D9: *mut *mut IDirect3D9) -> ::HRESULT, - fn GetDeviceCaps(&mut self, pCaps: *mut ::D3DCAPS9) -> ::HRESULT, - fn GetDisplayMode(&mut self, iSwapChain: ::UINT, pMode: *mut ::D3DDISPLAYMODE) -> ::HRESULT, - fn GetCreationParameters( - &mut self, pParameters: *mut ::D3DDEVICE_CREATION_PARAMETERS - ) -> ::HRESULT, - fn SetCursorProperties( - &mut self, XHotSpot: ::UINT, YHotSpot: ::UINT, pCursorBitmap: *mut IDirect3DSurface9 - ) -> ::HRESULT, - fn SetCursorPosition(&mut self, X: ::INT, Y: ::INT, Flags: ::DWORD) -> (), - fn ShowCursor(&mut self, bShow: ::BOOL) -> ::BOOL, - fn CreateAdditionalSwapChain( - &mut self, pPresentationParameters: *mut ::D3DPRESENT_PARAMETERS, - pSwapChain: *mut *mut IDirect3DSwapChain9 - ) -> ::HRESULT, - fn GetSwapChain( - &mut self, iSwapChain: ::UINT, pSwapChain: *mut *mut IDirect3DSwapChain9 - ) -> ::HRESULT, - fn GetNumberOfSwapChains(&mut self) -> ::UINT, - fn Reset(&mut self, pPresentationParameters: *mut ::D3DPRESENT_PARAMETERS) -> ::HRESULT, - fn Present( - &mut self, pSourceRect: *const ::RECT, pDestRect: *const ::RECT, - hDestWindowOverride: ::HWND, pDirtyRegion: *const ::RGNDATA - ) -> ::HRESULT, - fn GetBackBuffer( - &mut self, iSwapChain: ::UINT, iBackBuffer: ::UINT, Type: ::D3DBACKBUFFER_TYPE, - ppBackBuffer: *mut *mut IDirect3DSurface9 - ) -> ::HRESULT, - fn GetRasterStatus( - &mut self, iSwapChain: ::UINT, pRasterStatus: *mut ::D3DRASTER_STATUS - ) -> ::HRESULT, - fn SetDialogBoxMode(&mut self, bEnableDialogs: ::BOOL) -> ::HRESULT, - fn SetGammaRamp( - &mut self, iSwapChain: ::UINT, Flags: ::DWORD, pRamp: *const ::D3DGAMMARAMP - ) -> (), - fn GetGammaRamp(&mut self, iSwapChain: ::UINT, pRamp: *mut ::D3DGAMMARAMP) -> (), - fn CreateTexture( - &mut self, Width: ::UINT, Height: ::UINT, Levels: ::UINT, Usage: ::DWORD, - Format: ::D3DFORMAT, Pool: ::D3DPOOL, ppTexture: *mut *mut IDirect3DTexture9, - pSharedHandle: *mut ::HANDLE - ) -> ::HRESULT, - fn CreateVolumeTexture( - &mut self, Width: ::UINT, Height: ::UINT, Depth: ::UINT, Levels: ::UINT, Usage: ::DWORD, - Format: ::D3DFORMAT, Pool: ::D3DPOOL, ppVolumeTexture: *mut *mut IDirect3DVolumeTexture9, - pSharedHandle: *mut ::HANDLE - ) -> ::HRESULT, - fn CreateCubeTexture( - &mut self, EdgeLength: ::UINT, Levels: ::UINT, Usage: ::DWORD, Format: ::D3DFORMAT, - Pool: ::D3DPOOL, ppCubeTexture: *mut *mut IDirect3DCubeTexture9, - pSharedHandle: *mut ::HANDLE - ) -> ::HRESULT, - fn CreateVertexBuffer( - &mut self, Length: ::UINT, Usage: ::DWORD, FVF: ::DWORD, Pool: ::D3DPOOL, - ppVertexBuffer: *mut *mut IDirect3DVertexBuffer9, pSharedHandle: *mut ::HANDLE - ) -> ::HRESULT, - fn CreateIndexBuffer( - &mut self, Length: ::UINT, Usage: ::DWORD, Format: ::D3DFORMAT, Pool: ::D3DPOOL, - ppIndexBuffer: *mut *mut IDirect3DIndexBuffer9, pSharedHandle: *mut ::HANDLE - ) -> ::HRESULT, - fn CreateRenderTarget( - &mut self, Width: ::UINT, Height: ::UINT, Format: ::D3DFORMAT, - MultiSample: ::D3DMULTISAMPLE_TYPE, MultisampleQuality: ::DWORD, Lockable: ::BOOL, - ppSurface: *mut *mut IDirect3DSurface9, pSharedHandle: *mut ::HANDLE - ) -> ::HRESULT, - fn CreateDepthStencilSurface( - &mut self, Width: ::UINT, Height: ::UINT, Format: ::D3DFORMAT, - MultiSample: ::D3DMULTISAMPLE_TYPE, MultisampleQuality: ::DWORD, Discard: ::BOOL, - ppSurface: *mut *mut IDirect3DSurface9, pSharedHandle: *mut ::HANDLE - ) -> ::HRESULT, - fn UpdateSurface( - &mut self, pSourceSurface: *mut IDirect3DSurface9, pSourceRect: *const ::RECT, - pDestinationSurface: *mut IDirect3DSurface9, pDestPoint: *const ::POINT - ) -> ::HRESULT, - fn UpdateTexture( - &mut self, pSourceTexture: *mut IDirect3DBaseTexture9, - pDestinationTexture: *mut IDirect3DBaseTexture9 - ) -> ::HRESULT, - fn GetRenderTargetData( - &mut self, pRenderTarget: *mut IDirect3DSurface9, pDestSurface: *mut IDirect3DSurface9 - ) -> ::HRESULT, - fn GetFrontBufferData( - &mut self, iSwapChain: ::UINT, pDestSurface: *mut IDirect3DSurface9 - ) -> ::HRESULT, - fn StretchRect( - &mut self, pSourceSurface: *mut IDirect3DSurface9, pSourceRect: *const ::RECT, - pDestSurface: *mut IDirect3DSurface9, pDestRect: *const ::RECT, - Filter: ::D3DTEXTUREFILTERTYPE - ) -> ::HRESULT, - fn ColorFill( - &mut self, pSurface: *mut IDirect3DSurface9, pRect: *const ::RECT, color: ::D3DCOLOR - ) -> ::HRESULT, - fn CreateOffscreenPlainSurface( - &mut self, Width: ::UINT, Height: ::UINT, Format: ::D3DFORMAT, Pool: ::D3DPOOL, - ppSurface: *mut *mut IDirect3DSurface9, pSharedHandle: *mut ::HANDLE - ) -> ::HRESULT, - fn SetRenderTarget( - &mut self, RenderTargetIndex: ::DWORD, pRenderTarget: *mut IDirect3DSurface9 - ) -> ::HRESULT, - fn GetRenderTarget( - &mut self, RenderTargetIndex: ::DWORD, ppRenderTarget: *mut *mut IDirect3DSurface9 - ) -> ::HRESULT, - fn SetDepthStencilSurface(&mut self, pNewZStencil: *mut IDirect3DSurface9) -> ::HRESULT, - fn GetDepthStencilSurface( - &mut self, ppZStencilSurface: *mut *mut IDirect3DSurface9 - ) -> ::HRESULT, - fn BeginScene(&mut self) -> ::HRESULT, - fn EndScene(&mut self) -> ::HRESULT, - fn Clear( - &mut self, Count: ::DWORD, pRects: *const ::D3DRECT, Flags: ::DWORD, Color: ::D3DCOLOR, - Z: ::FLOAT, Stencil: ::DWORD - ) -> ::HRESULT, - fn SetTransform( - &mut self, State: ::D3DTRANSFORMSTATETYPE, pMatrix: *const ::D3DMATRIX - ) -> ::HRESULT, - fn GetTransform( - &mut self, State: ::D3DTRANSFORMSTATETYPE, pMatrix: *mut ::D3DMATRIX - ) -> ::HRESULT, - fn MultiplyTransform( - &mut self, arg1: ::D3DTRANSFORMSTATETYPE, arg2: *const ::D3DMATRIX - ) -> ::HRESULT, - fn SetViewport(&mut self, pViewport: *const ::D3DVIEWPORT9) -> ::HRESULT, - fn GetViewport(&mut self, pViewport: *mut ::D3DVIEWPORT9) -> ::HRESULT, - fn SetMaterial(&mut self, pMaterial: *const ::D3DMATERIAL9) -> ::HRESULT, - fn GetMaterial(&mut self, pMaterial: *mut ::D3DMATERIAL9) -> ::HRESULT, - fn SetLight(&mut self, Index: ::DWORD, arg1: *const ::D3DLIGHT9) -> ::HRESULT, - fn GetLight(&mut self, Index: ::DWORD, arg1: *mut ::D3DLIGHT9) -> ::HRESULT, - fn LightEnable(&mut self, Index: ::DWORD, Enable: ::BOOL) -> ::HRESULT, - fn GetLightEnable(&mut self, Index: ::DWORD, pEnable: *mut ::BOOL) -> ::HRESULT, - fn SetClipPlane(&mut self, Index: ::DWORD, pPlane: *const ::FLOAT) -> ::HRESULT, - fn GetClipPlane(&mut self, Index: ::DWORD, pPlane: *mut ::FLOAT) -> ::HRESULT, - fn SetRenderState(&mut self, State: ::D3DRENDERSTATETYPE, Value: ::DWORD) -> ::HRESULT, - fn GetRenderState(&mut self, State: ::D3DRENDERSTATETYPE, pValue: *mut ::DWORD) -> ::HRESULT, - fn CreateStateBlock( - &mut self, Type: ::D3DSTATEBLOCKTYPE, ppSB: *mut *mut IDirect3DStateBlock9 - ) -> ::HRESULT, - fn BeginStateBlock(&mut self) -> ::HRESULT, - fn EndStateBlock(&mut self, ppSB: *mut *mut IDirect3DStateBlock9) -> ::HRESULT, - fn SetClipStatus(&mut self, pClipStatus: *const ::D3DCLIPSTATUS9) -> ::HRESULT, - fn GetClipStatus(&mut self, pClipStatus: *mut ::D3DCLIPSTATUS9) -> ::HRESULT, - fn GetTexture( - &mut self, Stage: ::DWORD, ppTexture: *mut *mut IDirect3DBaseTexture9 - ) -> ::HRESULT, - fn SetTexture(&mut self, Stage: ::DWORD, pTexture: *mut IDirect3DBaseTexture9) -> ::HRESULT, - fn GetTextureStageState( - &mut self, Stage: ::DWORD, Type: ::D3DTEXTURESTAGESTATETYPE, pValue: *mut ::DWORD - ) -> ::HRESULT, - fn SetTextureStageState( - &mut self, Stage: ::DWORD, Type: ::D3DTEXTURESTAGESTATETYPE, Value: ::DWORD - ) -> ::HRESULT, - fn GetSamplerState( - &mut self, Sampler: ::DWORD, Type: ::D3DSAMPLERSTATETYPE, pValue: *mut ::DWORD - ) -> ::HRESULT, - fn SetSamplerState( - &mut self, Sampler: ::DWORD, Type: ::D3DSAMPLERSTATETYPE, Value: ::DWORD - ) -> ::HRESULT, - fn ValidateDevice(&mut self, pNumPasses: *mut ::DWORD) -> ::HRESULT, - fn SetPaletteEntries( - &mut self, PaletteNumber: ::UINT, pEntries: *const ::PALETTEENTRY - ) -> ::HRESULT, - fn GetPaletteEntries( - &mut self, PaletteNumber: ::UINT, pEntries: *mut ::PALETTEENTRY - ) -> ::HRESULT, - fn SetCurrentTexturePalette(&mut self, PaletteNumber: ::UINT) -> ::HRESULT, - fn GetCurrentTexturePalette(&mut self, PaletteNumber: *mut ::UINT) -> ::HRESULT, - fn SetScissorRect(&mut self, pRect: *const ::RECT) -> ::HRESULT, - fn GetScissorRect(&mut self, pRect: *mut ::RECT) -> ::HRESULT, - fn SetSoftwareVertexProcessing(&mut self, bSoftware: ::BOOL) -> ::HRESULT, - fn GetSoftwareVertexProcessing(&mut self) -> ::BOOL, - fn SetNPatchMode(&mut self, nSegments: ::FLOAT) -> ::HRESULT, - fn GetNPatchMode(&mut self) -> ::FLOAT, - fn DrawPrimitive( - &mut self, PrimitiveType: ::D3DPRIMITIVETYPE, StartVertex: ::UINT, PrimitiveCount: ::UINT - ) -> ::HRESULT, - fn DrawIndexedPrimitive( - &mut self, arg1: ::D3DPRIMITIVETYPE, BaseVertexIndex: ::INT, MinVertexIndex: ::UINT, - NumVertices: ::UINT, startIndex: ::UINT, primCount: ::UINT - ) -> ::HRESULT, - fn DrawPrimitiveUP( - &mut self, PrimitiveType: ::D3DPRIMITIVETYPE, PrimitiveCount: ::UINT, - pVertexStreamZeroData: *const ::VOID, VertexStreamZeroStride: ::UINT - ) -> ::HRESULT, - fn DrawIndexedPrimitiveUP( - &mut self, PrimitiveType: ::D3DPRIMITIVETYPE, MinVertexIndex: ::UINT, NumVertices: ::UINT, - PrimitiveCount: ::UINT, pIndexData: *const ::VOID, IndexDataFormat: ::D3DFORMAT, - pVertexStreamZeroData: *const ::VOID, VertexStreamZeroStride: ::UINT - ) -> ::HRESULT, - fn ProcessVertices( - &mut self, SrcStartIndex: ::UINT, DestIndex: ::UINT, VertexCount: ::UINT, - pDestBuffer: *mut IDirect3DVertexBuffer9, pVertexDecl: *mut IDirect3DVertexDeclaration9, - Flags: ::DWORD - ) -> ::HRESULT, - fn CreateVertexDeclaration( - &mut self, pVertexElements: *const ::D3DVERTEXELEMENT9, - ppDecl: *mut *mut IDirect3DVertexDeclaration9 - ) -> ::HRESULT, - fn SetVertexDeclaration(&mut self, pDecl: *mut IDirect3DVertexDeclaration9) -> ::HRESULT, - fn GetVertexDeclaration(&mut self, ppDecl: *mut *mut IDirect3DVertexDeclaration9) -> ::HRESULT, - fn SetFVF(&mut self, FVF: ::DWORD) -> ::HRESULT, - fn GetFVF(&mut self, pFVF: *mut ::DWORD) -> ::HRESULT, - fn CreateVertexShader( - &mut self, pFunction: *const ::DWORD, ppShader: *mut *mut IDirect3DVertexShader9 - ) -> ::HRESULT, - fn SetVertexShader(&mut self, pShader: *mut IDirect3DVertexShader9) -> ::HRESULT, - fn GetVertexShader(&mut self, ppShader: *mut *mut IDirect3DVertexShader9) -> ::HRESULT, - fn SetVertexShaderConstantF( - &mut self, StartRegister: ::UINT, pConstantData: *const ::FLOAT, Vector4fCount: ::UINT - ) -> ::HRESULT, - fn GetVertexShaderConstantF( - &mut self, StartRegister: ::UINT, pConstantData: *mut ::FLOAT, Vector4fCount: ::UINT - ) -> ::HRESULT, - fn SetVertexShaderConstantI( - &mut self, StartRegister: ::UINT, pConstantData: *const ::INT, Vector4iCount: ::UINT - ) -> ::HRESULT, - fn GetVertexShaderConstantI( - &mut self, StartRegister: ::UINT, pConstantData: *mut ::INT, Vector4iCount: ::UINT - ) -> ::HRESULT, - fn SetVertexShaderConstantB( - &mut self, StartRegister: ::UINT, pConstantData: *const ::BOOL, BoolCount: ::UINT - ) -> ::HRESULT, - fn GetVertexShaderConstantB( - &mut self, StartRegister: ::UINT, pConstantData: *mut ::BOOL, BoolCount: ::UINT - ) -> ::HRESULT, - fn SetStreamSource( - &mut self, StreamNumber: ::UINT, pStreamData: *mut IDirect3DVertexBuffer9, - OffsetInBytes: ::UINT, Stride: ::UINT - ) -> ::HRESULT, - fn GetStreamSource( - &mut self, StreamNumber: ::UINT, ppStreamData: *mut *mut IDirect3DVertexBuffer9, - pOffsetInBytes: *mut ::UINT, pStride: *mut ::UINT - ) -> ::HRESULT, - fn SetStreamSourceFreq(&mut self, StreamNumber: ::UINT, Setting: ::UINT) -> ::HRESULT, - fn GetStreamSourceFreq(&mut self, StreamNumber: ::UINT, pSetting: *mut ::UINT) -> ::HRESULT, - fn SetIndices(&mut self, pIndexData: *mut IDirect3DIndexBuffer9) -> ::HRESULT, - fn GetIndices(&mut self, ppIndexData: *mut *mut IDirect3DIndexBuffer9) -> ::HRESULT, - fn CreatePixelShader( - &mut self, pFunction: *const ::DWORD, ppShader: *mut *mut IDirect3DPixelShader9 - ) -> ::HRESULT, - fn SetPixelShader(&mut self, pShader: *mut IDirect3DPixelShader9) -> ::HRESULT, - fn GetPixelShader(&mut self, ppShader: *mut *mut IDirect3DPixelShader9) -> ::HRESULT, - fn SetPixelShaderConstantF( - &mut self, StartRegister: ::UINT, pConstantData: *const ::FLOAT, Vector4fCount: ::UINT - ) -> ::HRESULT, - fn GetPixelShaderConstantF( - &mut self, StartRegister: ::UINT, pConstantData: *mut ::FLOAT, Vector4fCount: ::UINT - ) -> ::HRESULT, - fn SetPixelShaderConstantI( - &mut self, StartRegister: ::UINT, pConstantData: *const ::INT, Vector4iCount: ::UINT - ) -> ::HRESULT, - fn GetPixelShaderConstantI( - &mut self, StartRegister: ::UINT, pConstantData: *mut ::INT, Vector4iCount: ::UINT - ) -> ::HRESULT, - fn SetPixelShaderConstantB( - &mut self, StartRegister: ::UINT, pConstantData: *const ::BOOL, BoolCount: ::UINT - ) -> ::HRESULT, - fn GetPixelShaderConstantB( - &mut self, StartRegister: ::UINT, pConstantData: *mut ::BOOL, BoolCount: ::UINT - ) -> ::HRESULT, - fn DrawRectPatch( - &mut self, Handle: ::UINT, pNumSegs: *const ::FLOAT, - pRectPatchInfo: *const ::D3DRECTPATCH_INFO - ) -> ::HRESULT, - fn DrawTriPatch( - &mut self, Handle: ::UINT, pNumSegs: *const ::FLOAT, - pTriPatchInfo: *const ::D3DTRIPATCH_INFO - ) -> ::HRESULT, - fn DeletePatch(&mut self, Handle: ::UINT) -> ::HRESULT, - fn CreateQuery( - &mut self, Type: ::D3DQUERYTYPE, ppQuery: *mut *mut IDirect3DQuery9 - ) -> ::HRESULT -} -); -pub type LPDIRECT3DDEVICE9 = *mut IDirect3DDevice9; -pub type PDIRECT3DDEVICE9 = *mut IDirect3DDevice9; -RIDL!( -interface IDirect3DStateBlock9(IDirect3DStateBlock9Vtbl): IUnknown(IUnknownVtbl) { - fn GetDevice(&mut self, ppDevice: *mut *mut IDirect3DDevice9) -> ::HRESULT, - fn Capture(&mut self) -> ::HRESULT, - fn Apply(&mut self) -> ::HRESULT -} -); -pub type LPDIRECT3DSTATEBLOCK9 = *mut IDirect3DStateBlock9; -pub type PDIRECT3DSTATEBLOCK9 = *mut IDirect3DStateBlock9; -RIDL!( -interface IDirect3DSwapChain9(IDirect3DSwapChain9Vtbl): IUnknown(IUnknownVtbl) { - fn Present( - &mut self, pSourceRect: *const ::RECT, pDestRect: *const ::RECT, - hDestWindowOverride: ::HWND, pDirtyRegion: *const ::RGNDATA, dwFlags: ::DWORD - ) -> ::HRESULT, - fn GetFrontBufferData(&mut self, pDestSurface: *mut IDirect3DSurface9) -> ::HRESULT, - fn GetBackBuffer( - &mut self, iBackBuffer: ::UINT, Type: ::D3DBACKBUFFER_TYPE, - ppBackBuffer: *mut *mut IDirect3DSurface9 - ) -> ::HRESULT, - fn GetRasterStatus(&mut self, pRasterStatus: *mut ::D3DRASTER_STATUS) -> ::HRESULT, - fn GetDisplayMode(&mut self, pMode: *mut ::D3DDISPLAYMODE) -> ::HRESULT, - fn GetDevice(&mut self, ppDevice: *mut *mut IDirect3DDevice9) -> ::HRESULT, - fn GetPresentParameters( - &mut self, pPresentationParameters: *mut ::D3DPRESENT_PARAMETERS - ) -> ::HRESULT -} -); -pub type LPDIRECT3DSWAPCHAIN9 = *mut IDirect3DSwapChain9; -pub type PDIRECT3DSWAPCHAIN9 = *mut IDirect3DSwapChain9; -RIDL!( -interface IDirect3DResource9(IDirect3DResource9Vtbl): IUnknown(IUnknownVtbl) { - fn GetDevice(&mut self, ppDevice: *mut *mut IDirect3DDevice9) -> ::HRESULT, - fn SetPrivateData( - &mut self, refguid: *const ::GUID, pData: *const ::VOID, SizeOfData: ::DWORD, - Flags: ::DWORD - ) -> ::HRESULT, - fn GetPrivateData( - &mut self, refguid: *const ::GUID, pData: *mut ::VOID, pSizeOfData: *mut ::DWORD - ) -> ::HRESULT, - fn FreePrivateData(&mut self, refguid: *const ::GUID) -> ::HRESULT, - fn SetPriority(&mut self, PriorityNew: ::DWORD) -> ::DWORD, - fn GetPriority(&mut self) -> ::DWORD, - fn PreLoad(&mut self) -> (), - fn GetType(&mut self) -> ::D3DRESOURCETYPE -} -); -pub type LPDIRECT3DRESOURCE9 = *mut IDirect3DResource9; -pub type PDIRECT3DRESOURCE9 = *mut IDirect3DResource9; -RIDL!( -interface IDirect3DVertexDeclaration9(IDirect3DVertexDeclaration9Vtbl): IUnknown(IUnknownVtbl) { - fn GetDevice(&mut self, ppDevice: *mut *mut IDirect3DDevice9) -> ::HRESULT, - fn GetDeclaration( - &mut self, pElement: *mut ::D3DVERTEXELEMENT9, pNumElements: *mut ::UINT - ) -> ::HRESULT -} -); -pub type LPDIRECT3DVERTEXDECLARATION9 = *mut IDirect3DVertexDeclaration9; -pub type PDIRECT3DVERTEXDECLARATION9 = *mut IDirect3DVertexDeclaration9; -RIDL!( -interface IDirect3DVertexShader9(IDirect3DVertexShader9Vtbl): IUnknown(IUnknownVtbl) { - fn GetDevice(&mut self, ppDevice: *mut *mut IDirect3DDevice9) -> ::HRESULT, - fn GetFunction(&mut self, arg1: *mut ::VOID, pSizeOfData: *mut ::UINT) -> ::HRESULT -} -); -pub type LPDIRECT3DVERTEXSHADER9 = *mut IDirect3DVertexShader9; -pub type PDIRECT3DVERTEXSHADER9 = *mut IDirect3DVertexShader9; -RIDL!( -interface IDirect3DPixelShader9(IDirect3DPixelShader9Vtbl): IUnknown(IUnknownVtbl) { - fn GetDevice(&mut self, ppDevice: *mut *mut IDirect3DDevice9) -> ::HRESULT, - fn GetFunction(&mut self, arg1: *mut ::VOID, pSizeOfData: *mut ::UINT) -> ::HRESULT -} -); -pub type LPDIRECT3DPIXELSHADER9 = *mut IDirect3DPixelShader9; -pub type PDIRECT3DPIXELSHADER9 = *mut IDirect3DPixelShader9; -RIDL!( -interface IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl): IDirect3DResource9(IDirect3DResource9Vtbl) { - fn SetLOD(&mut self, LODNew: ::DWORD) -> ::DWORD, - fn GetLOD(&mut self) -> ::DWORD, - fn GetLevelCount(&mut self) -> ::DWORD, - fn SetAutoGenFilterType(&mut self, FilterType: ::D3DTEXTUREFILTERTYPE) -> ::HRESULT, - fn GetAutoGenFilterType(&mut self) -> ::D3DTEXTUREFILTERTYPE, - fn GenerateMipSubLevels(&mut self) -> () -} -); -pub type LPDIRECT3DBASETEXTURE9 = *mut IDirect3DBaseTexture9; -pub type PDIRECT3DBASETEXTURE9 = *mut IDirect3DBaseTexture9; -RIDL!( -interface IDirect3DTexture9(IDirect3DTexture9Vtbl): IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl) { - fn GetLevelDesc(&mut self, Level: ::UINT, pDesc: *mut ::D3DSURFACE_DESC) -> ::HRESULT, - fn GetSurfaceLevel( - &mut self, Level: ::UINT, ppSurfaceLevel: *mut *mut IDirect3DSurface9 - ) -> ::HRESULT, - fn LockRect( - &mut self, Level: ::UINT, pLockedRect: *mut ::D3DLOCKED_RECT, pRect: *const ::RECT, - Flags: ::DWORD - ) -> ::HRESULT, - fn UnlockRect(&mut self, Level: ::UINT) -> ::HRESULT, - fn AddDirtyRect(&mut self, pDirtyRect: *const ::RECT) -> ::HRESULT -} -); -pub type LPDIRECT3DTEXTURE9 = *mut IDirect3DTexture9; -pub type PDIRECT3DTEXTURE9 = *mut IDirect3DTexture9; -RIDL!( -interface IDirect3DVolumeTexture9(IDirect3DVolumeTexture9Vtbl): IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl) { - fn GetLevelDesc(&mut self, Level: ::UINT, pDesc: *mut ::D3DVOLUME_DESC) -> ::HRESULT, - fn GetVolumeLevel( - &mut self, Level: ::UINT, ppVolumeLevel: *mut *mut IDirect3DVolume9 - ) -> ::HRESULT, - fn LockBox( - &mut self, Level: ::UINT, pLockedVolume: *mut ::D3DLOCKED_BOX, pBox: *const ::D3DBOX, - Flags: ::DWORD - ) -> ::HRESULT, - fn UnlockBox(&mut self, Level: ::UINT) -> ::HRESULT, - fn AddDirtyBox(&mut self, pDirtyBox: *const ::D3DBOX) -> ::HRESULT -} -); -pub type LPDIRECT3DVOLUMETEXTURE9 = *mut IDirect3DVolumeTexture9; -pub type PDIRECT3DVOLUMETEXTURE9 = *mut IDirect3DVolumeTexture9; -RIDL!( -interface IDirect3DCubeTexture9(IDirect3DCubeTexture9Vtbl): IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl) { - fn GetLevelDesc(&mut self, Level: ::UINT, pDesc: *mut ::D3DSURFACE_DESC) -> ::HRESULT, - fn GetCubeMapSurface( - &mut self, FaceType: ::D3DCUBEMAP_FACES, Level: ::UINT, - ppCubeMapSurface: *mut *mut IDirect3DSurface9 - ) -> ::HRESULT, - fn LockRect( - &mut self, FaceType: ::D3DCUBEMAP_FACES, Level: ::UINT, pLockedRect: *mut ::D3DLOCKED_RECT, - pRect: *const ::RECT, Flags: ::DWORD - ) -> ::HRESULT, - fn UnlockRect(&mut self, FaceType: ::D3DCUBEMAP_FACES, Level: ::UINT) -> ::HRESULT, - fn AddDirtyRect( - &mut self, FaceType: ::D3DCUBEMAP_FACES, pDirtyRect: *const ::RECT - ) -> ::HRESULT -} -); -pub type LPDIRECT3DCUBETEXTURE9 = *mut IDirect3DCubeTexture9; -pub type PDIRECT3DCUBETEXTURE9 = *mut IDirect3DCubeTexture9; -RIDL!( -interface IDirect3DVertexBuffer9(IDirect3DVertexBuffer9Vtbl): IDirect3DResource9(IDirect3DResource9Vtbl) { - fn Lock( - &mut self, OffsetToLock: ::UINT, SizeToLock: ::UINT, ppbData: *mut *mut ::VOID, - Flags: ::DWORD - ) -> ::HRESULT, - fn Unlock(&mut self) -> ::HRESULT, - fn GetDesc(&mut self, pDesc: *mut ::D3DVERTEXBUFFER_DESC) -> ::HRESULT -} -); -pub type LPDIRECT3DVERTEXBUFFER9 = *mut IDirect3DVertexBuffer9; -pub type PDIRECT3DVERTEXBUFFER9 = *mut IDirect3DVertexBuffer9; -RIDL!( -interface IDirect3DIndexBuffer9(IDirect3DIndexBuffer9Vtbl): IDirect3DResource9(IDirect3DResource9Vtbl) { - fn Lock( - &mut self, OffsetToLock: ::UINT, SizeToLock: ::UINT, ppbData: *mut *mut ::VOID, - Flags: ::DWORD - ) -> ::HRESULT, - fn Unlock(&mut self) -> ::HRESULT, - fn GetDesc(&mut self, pDesc: *mut ::D3DINDEXBUFFER_DESC) -> ::HRESULT -} -); -pub type LPDIRECT3DINDEXBUFFER9 = *mut IDirect3DIndexBuffer9; -pub type PDIRECT3DINDEXBUFFER9 = *mut IDirect3DIndexBuffer9; -RIDL!( -interface IDirect3DSurface9(IDirect3DSurface9Vtbl): IDirect3DResource9(IDirect3DResource9Vtbl) { - fn GetContainer(&mut self, riid: *const ::IID, ppContainer: *mut *mut ::VOID) -> ::HRESULT, - fn GetDesc(&mut self, pDesc: *mut ::D3DSURFACE_DESC) -> ::HRESULT, - fn LockRect( - &mut self, pLockedRect: *mut ::D3DLOCKED_RECT, pRect: *const ::RECT, Flags: ::DWORD - ) -> ::HRESULT, - fn UnlockRect(&mut self) -> ::HRESULT, - fn GetDC(&mut self, phdc: *mut ::HDC) -> ::HRESULT, - fn ReleaseDC(&mut self, hdc: ::HDC) -> ::HRESULT -} -); -pub type LPDIRECT3DSURFACE9 = *mut IDirect3DSurface9; -pub type PDIRECT3DSURFACE9 = *mut IDirect3DSurface9; -RIDL!( -interface IDirect3DVolume9(IDirect3DVolume9Vtbl): IUnknown(IUnknownVtbl) { - fn GetDevice(&mut self, ppDevice: *mut *mut IDirect3DDevice9) -> ::HRESULT, - fn SetPrivateData( - &mut self, refguid: *const ::GUID, pData: *const ::VOID, SizeOfData: ::DWORD, - Flags: ::DWORD - ) -> ::HRESULT, - fn GetPrivateData( - &mut self, refguid: *const ::GUID, pData: *mut ::VOID, pSizeOfData: *mut ::DWORD - ) -> ::HRESULT, - fn FreePrivateData(&mut self, refguid: *const ::GUID) -> ::HRESULT, - fn GetContainer(&mut self, riid: *const ::IID, ppContainer: *mut *mut ::VOID) -> ::HRESULT, - fn GetDesc(&mut self, pDesc: *mut ::D3DVOLUME_DESC) -> ::HRESULT, - fn LockBox( - &mut self, pLockedVolume: *mut ::D3DLOCKED_BOX, pBox: *const ::D3DBOX, Flags: ::DWORD - ) -> ::HRESULT, - fn UnlockBox(&mut self) -> ::HRESULT -} -); -pub type LPDIRECT3DVOLUME9 = *mut IDirect3DVolume9; -pub type PDIRECT3DVOLUME9 = *mut IDirect3DVolume9; -RIDL!( -interface IDirect3DQuery9(IDirect3DQuery9Vtbl): IUnknown(IUnknownVtbl) { - fn GetDevice(&mut self, ppDevice: *mut *mut IDirect3DDevice9) -> ::HRESULT, - fn GetType(&mut self) -> ::D3DRESOURCETYPE, - fn GetDataSize(&mut self) -> ::DWORD, - fn Issue(&mut self, dwIssueFlags: ::DWORD) -> ::HRESULT, - fn GetData( - &mut self, pData: *mut ::VOID, dwSize: ::DWORD, dwGetDataFlags: ::DWORD - ) -> ::HRESULT -} -); -pub type LPDIRECT3DQUERY9 = *mut IDirect3DQuery9; -pub type PDIRECT3DQUERY9 = *mut IDirect3DQuery9; -pub const D3DCREATE_FPU_PRESERVE: ::DWORD = 0x2; -pub const D3DCREATE_MULTITHREADED: ::DWORD = 0x4; -pub const D3DCREATE_PUREDEVICE: ::DWORD = 0x10; -pub const D3DCREATE_SOFTWARE_VERTEXPROCESSING: ::DWORD = 0x20; -pub const D3DCREATE_HARDWARE_VERTEXPROCESSING: ::DWORD = 0x40; -pub const D3DCREATE_MIXED_VERTEXPROCESSING: ::DWORD = 0x80; -pub const D3DCREATE_DISABLE_DRIVER_MANAGEMENT: ::DWORD = 0x100; -pub const D3DCREATE_ADAPTERGROUP_DEVICE: ::DWORD = 0x200; -pub const D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX: ::DWORD = 0x400; -pub const D3DCREATE_NOWINDOWCHANGES: ::DWORD = 0x800; -pub const D3DCREATE_DISABLE_PSGP_THREADING: ::DWORD = 0x2000; -pub const D3DCREATE_ENABLE_PRESENTSTATS: ::DWORD = 0x4000; -pub const D3DCREATE_DISABLE_PRESENTSTATS: ::DWORD = 0x8000; -pub const D3DCREATE_SCREENSAVER: ::DWORD = 0x10000000; -pub const D3DADAPTER_DEFAULT: ::DWORD = 0; -RIDL!( -interface IDirect3D9Ex(IDirect3D9ExVtbl): IDirect3D9(IDirect3D9Vtbl) { - fn GetAdapterModeCountEx( - &mut self, Adapter: ::UINT, pFilter: *const ::D3DDISPLAYMODEFILTER - ) -> ::UINT, - fn EnumAdapterModesEx( - &mut self, Adapter: ::UINT, pFilter: *const ::D3DDISPLAYMODEFILTER, Mode: ::UINT, - pMode: *mut ::D3DDISPLAYMODEEX - ) -> ::HRESULT, - fn GetAdapterDisplayModeEx( - &mut self, Adapter: ::UINT, pMode: *mut ::D3DDISPLAYMODEEX, - pRotation: *mut ::D3DDISPLAYROTATION - ) -> ::HRESULT, - fn CreateDeviceEx( - &mut self, Adapter: ::UINT, DeviceType: ::D3DDEVTYPE, hFocusWindow: ::HWND, - BehaviorFlags: ::DWORD, pPresentationParameters: *mut ::D3DPRESENT_PARAMETERS, - pFullscreenDisplayMode: *mut ::D3DDISPLAYMODEEX, - ppReturnedDeviceInterface: *mut *mut IDirect3DDevice9Ex - ) -> ::HRESULT, - fn GetAdapterLUID(&mut self, Adapter: ::UINT, pLUID: *mut ::LUID) -> ::HRESULT -} -); -pub type LPDIRECT3D9EX = *mut IDirect3D9Ex; -pub type PDIRECT3D9EX = *mut IDirect3D9Ex; -RIDL!( -interface IDirect3DDevice9Ex(IDirect3DDevice9ExVtbl): IDirect3DDevice9(IDirect3DDevice9Vtbl) { - fn SetConvolutionMonoKernel( - &mut self, width: ::UINT, height: ::UINT, rows: *mut ::FLOAT, columns: *mut ::FLOAT - ) -> ::HRESULT, - fn ComposeRects( - &mut self, pSrc: *mut IDirect3DSurface9, pDst: *mut IDirect3DSurface9, - pSrcRectDescs: *mut IDirect3DVertexBuffer9, NumRects: ::UINT, - pDstRectDescs: *mut IDirect3DVertexBuffer9, Operation: ::D3DCOMPOSERECTSOP, Xoffset: ::INT, - Yoffset: ::INT - ) -> ::HRESULT, - fn PresentEx( - &mut self, pSourceRect: *const ::RECT, pDestRect: *const ::RECT, - hDestWindowOverride: ::HWND, pDirtyRegion: *const ::RGNDATA, dwFlags: ::DWORD - ) -> ::HRESULT, - fn GetGPUThreadPriority(&mut self, pPriority: *mut ::INT) -> ::HRESULT, - fn SetGPUThreadPriority(&mut self, Priority: ::INT) -> ::HRESULT, - fn WaitForVBlank(&mut self, iSwapChain: ::UINT) -> ::HRESULT, - fn CheckResourceResidency( - &mut self, pResourceArray: *mut *mut IDirect3DResource9, NumResources: ::UINT32 - ) -> ::HRESULT, - fn SetMaximumFrameLatency(&mut self, MaxLatency: ::UINT) -> ::HRESULT, - fn GetMaximumFrameLatency(&mut self, pMaxLatency: *mut ::UINT) -> ::HRESULT, - fn CheckDeviceState(&mut self, hDestinationWindow: ::HWND) -> ::HRESULT, - fn CreateRenderTargetEx( - &mut self, Width: ::UINT, Height: ::UINT, Format: ::D3DFORMAT, - MultiSample: ::D3DMULTISAMPLE_TYPE, MultisampleQuality: ::DWORD, Lockable: ::BOOL, - ppSurface: *mut *mut IDirect3DSurface9, pSharedHandle: *mut ::HANDLE, Usage: ::DWORD - ) -> ::HRESULT, - fn CreateOffscreenPlainSurfaceEx( - &mut self, Width: ::UINT, Height: ::UINT, Format: ::D3DFORMAT, Pool: ::D3DPOOL, - ppSurface: *mut *mut IDirect3DSurface9, pSharedHandle: *mut ::HANDLE, Usage: ::DWORD - ) -> ::HRESULT, - fn CreateDepthStencilSurfaceEx( - &mut self, Width: ::UINT, Height: ::UINT, Format: ::D3DFORMAT, - MultiSample: ::D3DMULTISAMPLE_TYPE, MultisampleQuality: ::DWORD, Discard: ::BOOL, - ppSurface: *mut *mut IDirect3DSurface9, pSharedHandle: *mut ::HANDLE, Usage: ::DWORD - ) -> ::HRESULT, - fn ResetEx( - &mut self, pPresentationParameters: *mut ::D3DPRESENT_PARAMETERS, - pFullscreenDisplayMode: *mut ::D3DDISPLAYMODEEX - ) -> ::HRESULT, - fn GetDisplayModeEx( - &mut self, iSwapChain: ::UINT, pMode: *mut ::D3DDISPLAYMODEEX, - pRotation: *mut ::D3DDISPLAYROTATION - ) -> ::HRESULT -} -); -pub type LPDIRECT3DDEVICE9EX = *mut IDirect3DDevice9Ex; -pub type PDIRECT3DDEVICE9EX = *mut IDirect3DDevice9Ex; -RIDL!( -interface IDirect3DSwapChain9Ex(IDirect3DSwapChain9ExVtbl): IDirect3DSwapChain9(IDirect3DSwapChain9Vtbl) { - fn GetLastPresentCount(&mut self, pLastPresentCount: *mut ::UINT) -> ::HRESULT, - fn GetPresentStats(&mut self, pPresentationStatistics: *mut ::D3DPRESENTSTATS) -> ::HRESULT, - fn GetDisplayModeEx( - &mut self, pMode: *mut ::D3DDISPLAYMODEEX, pRotation: *mut ::D3DDISPLAYROTATION - ) -> ::HRESULT -} -); -pub type LPDIRECT3DSWAPCHAIN9EX = *mut IDirect3DSwapChain9Ex; -pub type PDIRECT3DSWAPCHAIN9EX = *mut IDirect3DSwapChain9Ex; -RIDL!( -interface IDirect3D9ExOverlayExtension(IDirect3D9ExOverlayExtensionVtbl): IUnknown(IUnknownVtbl) { - fn CheckDeviceOverlayType( - &mut self, Adapter: ::UINT, DevType: ::D3DDEVTYPE, OverlayWidth: ::UINT, - OverlayHeight: ::UINT, OverlayFormat: ::D3DFORMAT, pDisplayMode: *mut ::D3DDISPLAYMODEEX, - DisplayRotation: ::D3DDISPLAYROTATION, pOverlayCaps: *mut ::D3DOVERLAYCAPS - ) -> ::HRESULT -} -); -pub type LPDIRECT3D9EXOVERLAYEXTENSION = *mut IDirect3D9ExOverlayExtension; -pub type PDIRECT3D9EXOVERLAYEXTENSION = *mut IDirect3D9ExOverlayExtension; -RIDL!( -interface IDirect3DDevice9Video(IDirect3DDevice9VideoVtbl): IUnknown(IUnknownVtbl) { - fn GetContentProtectionCaps( - &mut self, pCryptoType: *const ::GUID, pDecodeProfile: *const ::GUID, - pCaps: *mut ::D3DCONTENTPROTECTIONCAPS - ) -> ::HRESULT, - fn CreateAuthenticatedChannel( - &mut self, ChannelType: ::D3DAUTHENTICATEDCHANNELTYPE, - ppAuthenticatedChannel: *mut *mut IDirect3DAuthenticatedChannel9, - pChannelHandle: *mut ::HANDLE - ) -> ::HRESULT, - fn CreateCryptoSession( - &mut self, pCryptoType: *const ::GUID, pDecodeProfile: *const ::GUID, - ppCryptoSession: *mut *mut IDirect3DCryptoSession9, pCryptoHandle: *mut ::HANDLE - ) -> ::HRESULT -} -); -pub type LPDIRECT3DDEVICE9VIDEO = *mut IDirect3DDevice9Video; -pub type PDIRECT3DDEVICE9VIDEO = *mut IDirect3DDevice9Video; -RIDL!( -interface IDirect3DAuthenticatedChannel9(IDirect3DAuthenticatedChannel9Vtbl): IUnknown(IUnknownVtbl) { - fn GetCertificateSize(&mut self, pCertificateSize: *mut ::UINT) -> ::HRESULT, - fn GetCertificate(&mut self, CertifacteSize: ::UINT, ppCertificate: *mut ::BYTE) -> ::HRESULT, - fn NegotiateKeyExchange(&mut self, DataSize: ::UINT, pData: *mut ::VOID) -> ::HRESULT, - fn Query( - &mut self, InputSize: ::UINT, pInput: *const ::VOID, OutputSize: ::UINT, - pOutput: *mut ::VOID - ) -> ::HRESULT, - fn Configure( - &mut self, InputSize: ::UINT, pInput: *const ::VOID, - pOutput: *mut ::D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT - ) -> ::HRESULT -} -); -pub type LPDIRECT3DAUTHENTICATEDCHANNEL9 = *mut IDirect3DAuthenticatedChannel9; -pub type PDIRECT3DAUTHENTICATEDCHANNEL9 = *mut IDirect3DAuthenticatedChannel9; -RIDL!( -interface IDirect3DCryptoSession9(IDirect3DCryptoSession9Vtbl): IUnknown(IUnknownVtbl) { - fn GetCertificateSize(&mut self, pCertificateSize: *mut ::UINT) -> ::HRESULT, - fn GetCertificate(&mut self, CertifacteSize: ::UINT, ppCertificate: *mut ::BYTE) -> ::HRESULT, - fn NegotiateKeyExchange(&mut self, DataSize: ::UINT, pData: *mut ::VOID) -> ::HRESULT, - fn EncryptionBlt( - &mut self, pSrcSurface: *mut IDirect3DSurface9, pDstSurface: *mut IDirect3DSurface9, - DstSurfaceSize: ::UINT, pIV: *mut ::VOID - ) -> ::HRESULT, - fn DecryptionBlt( - &mut self, pSrcSurface: *mut IDirect3DSurface9, pDstSurface: *mut IDirect3DSurface9, - SrcSurfaceSize: ::UINT, pEncryptedBlockInfo: *mut ::D3DENCRYPTED_BLOCK_INFO, - pContentKey: *mut ::VOID, pIV: *mut ::VOID - ) -> ::HRESULT, - fn GetSurfacePitch( - &mut self, pSrcSurface: *mut IDirect3DSurface9, pSurfacePitch: *mut ::UINT - ) -> ::HRESULT, - fn StartSessionKeyRefresh( - &mut self, pRandomNumber: *mut ::VOID, RandomNumberSize: ::UINT - ) -> ::HRESULT, - fn FinishSessionKeyRefresh(&mut self) -> ::HRESULT, - fn GetEncryptionBltKey(&mut self, pReadbackKey: *mut ::VOID, KeySize: ::UINT) -> ::HRESULT -} -); -pub type LPDIRECT3DCRYPTOSESSION9 = *mut IDirect3DCryptoSession9; -pub type PDIRECT3DCRYPTOSESSION9 = *mut IDirect3DCryptoSession9; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/d3d9types.rs cargo-0.37.0/vendor/winapi-0.2.8/src/d3d9types.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/d3d9types.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/d3d9types.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,1397 +0,0 @@ -// Copyright © 2015, Corey Richardson -// Licensed under the MIT License -//! Direct3D capabilities include file -pub type D3DCOLOR = ::DWORD; -STRUCT!{struct D3DVECTOR { - x: ::c_float, - y: ::c_float, - z: ::c_float, -}} -STRUCT!{struct D3DCOLORVALUE { - r: ::c_float, - g: ::c_float, - b: ::c_float, - a: ::c_float, -}} -STRUCT!{struct D3DRECT { - x1: ::LONG, - y1: ::LONG, - x2: ::LONG, - y2: ::LONG, -}} -STRUCT!{struct D3DMATRIX { - m: [[::c_float; 4]; 4], -}} -STRUCT!{struct D3DVIEWPORT9 { - X: ::DWORD, - Y: ::DWORD, - Width: ::DWORD, - Height: ::DWORD, - MinZ: ::c_float, - MaxZ: ::c_float, -}} -pub const D3DMAXUSERCLIPPLANES: ::DWORD = 32; -pub const D3DCLIPPLANE0: ::DWORD = (1 << 0); -pub const D3DCLIPPLANE1: ::DWORD = (1 << 1); -pub const D3DCLIPPLANE2: ::DWORD = (1 << 2); -pub const D3DCLIPPLANE3: ::DWORD = (1 << 3); -pub const D3DCLIPPLANE4: ::DWORD = (1 << 4); -pub const D3DCLIPPLANE5: ::DWORD = (1 << 5); -pub const D3DCS_LEFT: ::DWORD = 0x00000001; -pub const D3DCS_RIGHT: ::DWORD = 0x00000002; -pub const D3DCS_TOP: ::DWORD = 0x00000004; -pub const D3DCS_BOTTOM: ::DWORD = 0x00000008; -pub const D3DCS_FRONT: ::DWORD = 0x00000010; -pub const D3DCS_BACK: ::DWORD = 0x00000020; -pub const D3DCS_PLANE0: ::DWORD = 0x00000040; -pub const D3DCS_PLANE1: ::DWORD = 0x00000080; -pub const D3DCS_PLANE2: ::DWORD = 0x00000100; -pub const D3DCS_PLANE3: ::DWORD = 0x00000200; -pub const D3DCS_PLANE4: ::DWORD = 0x00000400; -pub const D3DCS_PLANE5: ::DWORD = 0x00000800; -pub const D3DCS_ALL: ::DWORD = D3DCS_LEFT | D3DCS_RIGHT | D3DCS_TOP | D3DCS_BOTTOM | D3DCS_FRONT - | D3DCS_BACK | D3DCS_PLANE0 | D3DCS_PLANE1 | D3DCS_PLANE2 | D3DCS_PLANE3 | D3DCS_PLANE4 - | D3DCS_PLANE5; -STRUCT!{struct D3DCLIPSTATUS9 { - ClipUnion: ::DWORD, - ClipIntersection: ::DWORD, -}} -STRUCT!{struct D3DMATERIAL9 { - Diffuse: D3DCOLORVALUE, - Ambient: D3DCOLORVALUE, - Specular: D3DCOLORVALUE, - Emissive: D3DCOLORVALUE, - Power: ::c_float, -}} -ENUM!{enum D3DLIGHTTYPE { - D3DLIGHT_POINT = 1, - D3DLIGHT_SPOT = 2, - D3DLIGHT_DIRECTIONAL = 3, -}} -STRUCT!{struct D3DLIGHT9 { - Type: D3DLIGHTTYPE, - Diffuse: D3DCOLORVALUE, - Specular: D3DCOLORVALUE, - Ambient: D3DCOLORVALUE, - Position: D3DVECTOR, - Direction: D3DVECTOR, - Range: ::c_float, - Falloff: ::c_float, - Attenuation0: ::c_float, - Attenuation1: ::c_float, - Attenuation2: ::c_float, - Theta: ::c_float, - Phi: ::c_float, -}} -pub const D3DCLEAR_TARGET: ::DWORD = 0x1; -pub const D3DCLEAR_ZBUFFER: ::DWORD = 0x2; -pub const D3DCLEAR_STENCIL: ::DWORD = 0x4; -ENUM!{enum D3DSHADEMODE { - D3DSHADE_FLAT = 1, - D3DSHADE_GOURAUD = 2, - D3DSHADE_PHONG = 3, -}} -ENUM!{enum D3DFILLMODE { - D3DFILL_POINT = 1, - D3DFILL_WIREFRAME = 2, - D3DFILL_SOLID = 3, -}} -ENUM!{enum D3DBLEND { - D3DBLEND_ZERO = 1, - D3DBLEND_ONE = 2, - D3DBLEND_SRCCOLOR = 3, - D3DBLEND_INVSRCCOLOR = 4, - D3DBLEND_SRCALPHA = 5, - D3DBLEND_INVSRCALPHA = 6, - D3DBLEND_DESTALPHA = 7, - D3DBLEND_INVDESTALPHA = 8, - D3DBLEND_DESTCOLOR = 9, - D3DBLEND_INVDESTCOLOR = 10, - D3DBLEND_SRCALPHASAT = 11, - D3DBLEND_BOTHSRCALPHA = 12, - D3DBLEND_BOTHINVSRCALPHA = 13, - D3DBLEND_BLENDFACTOR = 14, - D3DBLEND_INVBLENDFACTOR = 15, -}} -ENUM!{enum D3DBLENDOP { - D3DBLENDOP_ADD = 1, - D3DBLENDOP_SUBTRACT = 2, - D3DBLENDOP_REVSUBTRACT = 3, - D3DBLENDOP_MIN = 4, - D3DBLENDOP_MAX = 5, -}} -ENUM!{enum D3DTEXTUREADDRESS { - D3DTADDRESS_WRAP = 1, - D3DTADDRESS_MIRROR = 2, - D3DTADDRESS_CLAMP = 3, - D3DTADDRESS_BORDER = 4, - D3DTADDRESS_MIRRORONCE = 5, -}} -ENUM!{enum D3DCULL { - D3DCULL_NONE = 1, - D3DCULL_CW = 2, - D3DCULL_CCW = 3, -}} -ENUM!{enum D3DCMPFUNC { - D3DCMP_NEVER = 1, - D3DCMP_LESS = 2, - D3DCMP_EQUAL = 3, - D3DCMP_LESSEQUAL = 4, - D3DCMP_GREATER = 5, - D3DCMP_NOTEQUAL = 6, - D3DCMP_GREATEREQUAL = 7, - D3DCMP_ALWAYS = 8, -}} -ENUM!{enum D3DSTENCILOP { - D3DSTENCILOP_KEEP = 1, - D3DSTENCILOP_ZERO = 2, - D3DSTENCILOP_REPLACE = 3, - D3DSTENCILOP_INCRSAT = 4, - D3DSTENCILOP_DECRSAT = 5, - D3DSTENCILOP_INVERT = 6, - D3DSTENCILOP_INCR = 7, - D3DSTENCILOP_DECR = 8, -}} -ENUM!{enum D3DFOGMODE { - D3DFOG_NONE = 0, - D3DFOG_EXP = 1, - D3DFOG_EXP2 = 2, - D3DFOG_LINEAR = 3, -}} -ENUM!{enum D3DZBUFFERTYPE { - D3DZB_FALSE = 0, - D3DZB_TRUE = 1, - D3DZB_USEW = 2, -}} -ENUM!{enum D3DPRIMITIVETYPE { - D3DPT_POINTLIST = 1, - D3DPT_LINELIST = 2, - D3DPT_LINESTRIP = 3, - D3DPT_TRIANGLELIST = 4, - D3DPT_TRIANGLESTRIP = 5, - D3DPT_TRIANGLEFAN = 6, -}} -ENUM!{enum D3DTRANSFORMSTATETYPE { - D3DTS_VIEW = 2, - D3DTS_PROJECTION = 3, - D3DTS_TEXTURE0 = 16, - D3DTS_TEXTURE1 = 17, - D3DTS_TEXTURE2 = 18, - D3DTS_TEXTURE3 = 19, - D3DTS_TEXTURE4 = 20, - D3DTS_TEXTURE5 = 21, - D3DTS_TEXTURE6 = 22, - D3DTS_TEXTURE7 = 23, -}} -ENUM!{enum D3DRENDERSTATETYPE { - D3DRS_ZENABLE = 7, - D3DRS_FILLMODE = 8, - D3DRS_SHADEMODE = 9, - D3DRS_ZWRITEENABLE = 14, - D3DRS_ALPHATESTENABLE = 15, - D3DRS_LASTPIXEL = 16, - D3DRS_SRCBLEND = 19, - D3DRS_DESTBLEND = 20, - D3DRS_CULLMODE = 22, - D3DRS_ZFUNC = 23, - D3DRS_ALPHAREF = 24, - D3DRS_ALPHAFUNC = 25, - D3DRS_DITHERENABLE = 26, - D3DRS_ALPHABLENDENABLE = 27, - D3DRS_FOGENABLE = 28, - D3DRS_SPECULARENABLE = 29, - D3DRS_FOGCOLOR = 34, - D3DRS_FOGTABLEMODE = 35, - D3DRS_FOGSTART = 36, - D3DRS_FOGEND = 37, - D3DRS_FOGDENSITY = 38, - D3DRS_RANGEFOGENABLE = 48, - D3DRS_STENCILENABLE = 52, - D3DRS_STENCILFAIL = 53, - D3DRS_STENCILZFAIL = 54, - D3DRS_STENCILPASS = 55, - D3DRS_STENCILFUNC = 56, - D3DRS_STENCILREF = 57, - D3DRS_STENCILMASK = 58, - D3DRS_STENCILWRITEMASK = 59, - D3DRS_TEXTUREFACTOR = 60, - D3DRS_WRAP0 = 128, - D3DRS_WRAP1 = 129, - D3DRS_WRAP2 = 130, - D3DRS_WRAP3 = 131, - D3DRS_WRAP4 = 132, - D3DRS_WRAP5 = 133, - D3DRS_WRAP6 = 134, - D3DRS_WRAP7 = 135, - D3DRS_CLIPPING = 136, - D3DRS_LIGHTING = 137, - D3DRS_AMBIENT = 139, - D3DRS_FOGVERTEXMODE = 140, - D3DRS_COLORVERTEX = 141, - D3DRS_LOCALVIEWER = 142, - D3DRS_NORMALIZENORMALS = 143, - D3DRS_DIFFUSEMATERIALSOURCE = 145, - D3DRS_SPECULARMATERIALSOURCE = 146, - D3DRS_AMBIENTMATERIALSOURCE = 147, - D3DRS_EMISSIVEMATERIALSOURCE = 148, - D3DRS_VERTEXBLEND = 151, - D3DRS_CLIPPLANEENABLE = 152, - D3DRS_POINTSIZE = 154, - D3DRS_POINTSIZE_MIN = 155, - D3DRS_POINTSPRITEENABLE = 156, - D3DRS_POINTSCALEENABLE = 157, - D3DRS_POINTSCALE_A = 158, - D3DRS_POINTSCALE_B = 159, - D3DRS_POINTSCALE_C = 160, - D3DRS_MULTISAMPLEANTIALIAS = 161, - D3DRS_MULTISAMPLEMASK = 162, - D3DRS_PATCHEDGESTYLE = 163, - D3DRS_DEBUGMONITORTOKEN = 165, - D3DRS_POINTSIZE_MAX = 166, - D3DRS_INDEXEDVERTEXBLENDENABLE = 167, - D3DRS_COLORWRITEENABLE = 168, - D3DRS_TWEENFACTOR = 170, - D3DRS_BLENDOP = 171, - D3DRS_POSITIONDEGREE = 172, - D3DRS_NORMALDEGREE = 173, - D3DRS_SCISSORTESTENABLE = 174, - D3DRS_SLOPESCALEDEPTHBIAS = 175, - D3DRS_ANTIALIASEDLINEENABLE = 176, - D3DRS_MINTESSELLATIONLEVEL = 178, - D3DRS_MAXTESSELLATIONLEVEL = 179, - D3DRS_ADAPTIVETESS_X = 180, - D3DRS_ADAPTIVETESS_Y = 181, - D3DRS_ADAPTIVETESS_Z = 182, - D3DRS_ADAPTIVETESS_W = 183, - D3DRS_ENABLEADAPTIVETESSELLATION = 184, - D3DRS_TWOSIDEDSTENCILMODE = 185, - D3DRS_CCW_STENCILFAIL = 186, - D3DRS_CCW_STENCILZFAIL = 187, - D3DRS_CCW_STENCILPASS = 188, - D3DRS_CCW_STENCILFUNC = 189, - D3DRS_COLORWRITEENABLE1 = 190, - D3DRS_COLORWRITEENABLE2 = 191, - D3DRS_COLORWRITEENABLE3 = 192, - D3DRS_BLENDFACTOR = 193, - D3DRS_SRGBWRITEENABLE = 194, - D3DRS_DEPTHBIAS = 195, - D3DRS_WRAP8 = 198, - D3DRS_WRAP9 = 199, - D3DRS_WRAP10 = 200, - D3DRS_WRAP11 = 201, - D3DRS_WRAP12 = 202, - D3DRS_WRAP13 = 203, - D3DRS_WRAP14 = 204, - D3DRS_WRAP15 = 205, - D3DRS_SEPARATEALPHABLENDENABLE = 206, - D3DRS_SRCBLENDALPHA = 207, - D3DRS_DESTBLENDALPHA = 208, - D3DRS_BLENDOPALPHA = 209, -}} -pub const D3D_MAX_SIMULTANEOUS_RENDERTARGETS: ::DWORD = 4; -ENUM!{enum D3DMATERIALCOLORSOURCE { - D3DMCS_MATERIAL = 0, - D3DMCS_COLOR1 = 1, - D3DMCS_COLOR2 = 2, -}} -pub const D3DRENDERSTATE_WRAPBIAS: ::DWORD = 128; -pub const D3DWRAP_U: ::DWORD = 0x00000001; -pub const D3DWRAP_V: ::DWORD = 0x00000002; -pub const D3DWRAP_W: ::DWORD = 0x00000004; -pub const D3DWRAPCOORD_0: ::DWORD = 0x00000001; -pub const D3DWRAPCOORD_1: ::DWORD = 0x00000002; -pub const D3DWRAPCOORD_2: ::DWORD = 0x00000004; -pub const D3DWRAPCOORD_3: ::DWORD = 0x00000008; -pub const D3DCOLORWRITEENABLE_RED: ::DWORD = 1 << 0; -pub const D3DCOLORWRITEENABLE_GREEN: ::DWORD = 1 << 1; -pub const D3DCOLORWRITEENABLE_BLUE: ::DWORD = 1 << 2; -pub const D3DCOLORWRITEENABLE_ALPHA: ::DWORD = 1 << 3; -ENUM!{enum D3DTEXTURESTAGESTATETYPE { - D3DTSS_COLOROP = 1, - D3DTSS_COLORARG1 = 2, - D3DTSS_COLORARG2 = 3, - D3DTSS_ALPHAOP = 4, - D3DTSS_ALPHAARG1 = 5, - D3DTSS_ALPHAARG2 = 6, - D3DTSS_BUMPENVMAT00 = 7, - D3DTSS_BUMPENVMAT01 = 8, - D3DTSS_BUMPENVMAT10 = 9, - D3DTSS_BUMPENVMAT11 = 10, - D3DTSS_TEXCOORDINDEX = 11, - D3DTSS_BUMPENVLSCALE = 22, - D3DTSS_BUMPENVLOFFSET = 23, - D3DTSS_TEXTURETRANSFORMFLAGS = 24, - D3DTSS_COLORARG0 = 26, - D3DTSS_ALPHAARG0 = 27, - D3DTSS_RESULTARG = 28, - D3DTSS_CONSTANT = 32, -}} -ENUM!{enum D3DSAMPLERSTATETYPE { - D3DSAMP_ADDRESSU = 1, - D3DSAMP_ADDRESSV = 2, - D3DSAMP_ADDRESSW = 3, - D3DSAMP_BORDERCOLOR = 4, - D3DSAMP_MAGFILTER = 5, - D3DSAMP_MINFILTER = 6, - D3DSAMP_MIPFILTER = 7, - D3DSAMP_MIPMAPLODBIAS = 8, - D3DSAMP_MAXMIPLEVEL = 9, - D3DSAMP_MAXANISOTROPY = 10, - D3DSAMP_SRGBTEXTURE = 11, - D3DSAMP_ELEMENTINDEX = 12, - D3DSAMP_DMAPOFFSET = 13, -}} -pub const D3DDMAPSAMPLER: ::DWORD = 256; -pub const D3DVERTEXTEXTURESAMPLER0: ::DWORD = D3DDMAPSAMPLER + 1; -pub const D3DVERTEXTEXTURESAMPLER1: ::DWORD = D3DDMAPSAMPLER + 2; -pub const D3DVERTEXTEXTURESAMPLER2: ::DWORD = D3DDMAPSAMPLER + 3; -pub const D3DVERTEXTEXTURESAMPLER3: ::DWORD = D3DDMAPSAMPLER + 4; -pub const D3DTSS_TCI_PASSTHRU: ::DWORD = 0x00000000; -pub const D3DTSS_TCI_CAMERASPACENORMAL: ::DWORD = 0x00010000; -pub const D3DTSS_TCI_CAMERASPACEPOSITION: ::DWORD = 0x00020000; -pub const D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR: ::DWORD = 0x00030000; -pub const D3DTSS_TCI_SPHEREMAP: ::DWORD = 0x00040000; -ENUM!{enum D3DTEXTUREOP { - D3DTOP_DISABLE = 1, - D3DTOP_SELECTARG1 = 2, - D3DTOP_SELECTARG2 = 3, - D3DTOP_MODULATE = 4, - D3DTOP_MODULATE2X = 5, - D3DTOP_MODULATE4X = 6, - D3DTOP_ADD = 7, - D3DTOP_ADDSIGNED = 8, - D3DTOP_ADDSIGNED2X = 9, - D3DTOP_SUBTRACT = 10, - D3DTOP_ADDSMOOTH = 11, - D3DTOP_BLENDDIFFUSEALPHA = 12, - D3DTOP_BLENDTEXTUREALPHA = 13, - D3DTOP_BLENDFACTORALPHA = 14, - D3DTOP_BLENDTEXTUREALPHAPM = 15, - D3DTOP_BLENDCURRENTALPHA = 16, - D3DTOP_PREMODULATE = 17, - D3DTOP_MODULATEALPHA_ADDCOLOR = 18, - D3DTOP_MODULATECOLOR_ADDALPHA = 19, - D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, - D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, - D3DTOP_BUMPENVMAP = 22, - D3DTOP_BUMPENVMAPLUMINANCE = 23, - D3DTOP_DOTPRODUCT3 = 24, - D3DTOP_MULTIPLYADD = 25, - D3DTOP_LERP = 26, -}} -pub const D3DTA_SELECTMASK: ::DWORD = 0x0000000f; -pub const D3DTA_DIFFUSE: ::DWORD = 0x00000000; -pub const D3DTA_CURRENT: ::DWORD = 0x00000001; -pub const D3DTA_TEXTURE: ::DWORD = 0x00000002; -pub const D3DTA_TFACTOR: ::DWORD = 0x00000003; -pub const D3DTA_SPECULAR: ::DWORD = 0x00000004; -pub const D3DTA_TEMP: ::DWORD = 0x00000005; -pub const D3DTA_CONSTANT: ::DWORD = 0x00000006; -pub const D3DTA_COMPLEMENT: ::DWORD = 0x00000010; -pub const D3DTA_ALPHAREPLICATE: ::DWORD = 0x00000020; -ENUM!{enum D3DTEXTUREFILTERTYPE { - D3DTEXF_NONE = 0, - D3DTEXF_POINT = 1, - D3DTEXF_LINEAR = 2, - D3DTEXF_ANISOTROPIC = 3, - D3DTEXF_PYRAMIDALQUAD = 6, - D3DTEXF_GAUSSIANQUAD = 7, - D3DTEXF_CONVOLUTIONMONO = 8, -}} -pub const D3DPV_DONOTCOPYDATA: ::DWORD = 1 << 0; -pub const D3DFVF_RESERVED0: ::DWORD = 0x001; -pub const D3DFVF_POSITION_MASK: ::DWORD = 0x400E; -pub const D3DFVF_XYZ: ::DWORD = 0x002; -pub const D3DFVF_XYZRHW: ::DWORD = 0x004; -pub const D3DFVF_XYZB1: ::DWORD = 0x006; -pub const D3DFVF_XYZB2: ::DWORD = 0x008; -pub const D3DFVF_XYZB3: ::DWORD = 0x00a; -pub const D3DFVF_XYZB4: ::DWORD = 0x00c; -pub const D3DFVF_XYZB5: ::DWORD = 0x00e; -pub const D3DFVF_XYZW: ::DWORD = 0x4002; -pub const D3DFVF_NORMAL: ::DWORD = 0x010; -pub const D3DFVF_PSIZE: ::DWORD = 0x020; -pub const D3DFVF_DIFFUSE: ::DWORD = 0x040; -pub const D3DFVF_SPECULAR: ::DWORD = 0x080; -pub const D3DFVF_TEXCOUNT_MASK: ::DWORD = 0xf00; -pub const D3DFVF_TEXCOUNT_SHIFT: ::DWORD = 8; -pub const D3DFVF_TEX0: ::DWORD = 0x000; -pub const D3DFVF_TEX1: ::DWORD = 0x100; -pub const D3DFVF_TEX2: ::DWORD = 0x200; -pub const D3DFVF_TEX3: ::DWORD = 0x300; -pub const D3DFVF_TEX4: ::DWORD = 0x400; -pub const D3DFVF_TEX5: ::DWORD = 0x500; -pub const D3DFVF_TEX6: ::DWORD = 0x600; -pub const D3DFVF_TEX7: ::DWORD = 0x700; -pub const D3DFVF_TEX8: ::DWORD = 0x800; -pub const D3DFVF_LASTBETA_UBYTE4: ::DWORD = 0x1000; -pub const D3DFVF_LASTBETA_D3DCOLOR: ::DWORD = 0x8000; -pub const D3DFVF_RESERVED2: ::DWORD = 0x6000; -ENUM!{enum D3DDECLUSAGE { - D3DDECLUSAGE_POSITION = 0, - D3DDECLUSAGE_BLENDWEIGHT, - D3DDECLUSAGE_BLENDINDICES, - D3DDECLUSAGE_NORMAL, - D3DDECLUSAGE_PSIZE, - D3DDECLUSAGE_TEXCOORD, - D3DDECLUSAGE_TANGENT, - D3DDECLUSAGE_BINORMAL, - D3DDECLUSAGE_TESSFACTOR, - D3DDECLUSAGE_POSITIONT, - D3DDECLUSAGE_COLOR, - D3DDECLUSAGE_FOG, - D3DDECLUSAGE_DEPTH, - D3DDECLUSAGE_SAMPLE, -}} -pub const MAXD3DDECLUSAGE: D3DDECLUSAGE = D3DDECLUSAGE_SAMPLE; -pub const MAXD3DDECLUSAGEINDEX: ::DWORD = 15; -pub const MAXD3DDECLLENGTH: ::DWORD = 64; -ENUM!{enum D3DDECLMETHOD { - D3DDECLMETHOD_DEFAULT = 0, - D3DDECLMETHOD_PARTIALU, - D3DDECLMETHOD_PARTIALV, - D3DDECLMETHOD_CROSSUV, - D3DDECLMETHOD_UV, - D3DDECLMETHOD_LOOKUP, - D3DDECLMETHOD_LOOKUPPRESAMPLED, -}} -pub const MAXD3DDECLMETHOD: D3DDECLMETHOD = D3DDECLMETHOD_LOOKUPPRESAMPLED; -ENUM!{enum D3DDECLTYPE { - D3DDECLTYPE_FLOAT1 = 0, - D3DDECLTYPE_FLOAT2 = 1, - D3DDECLTYPE_FLOAT3 = 2, - D3DDECLTYPE_FLOAT4 = 3, - D3DDECLTYPE_D3DCOLOR = 4, - D3DDECLTYPE_UBYTE4 = 5, - D3DDECLTYPE_SHORT2 = 6, - D3DDECLTYPE_SHORT4 = 7, - D3DDECLTYPE_UBYTE4N = 8, - D3DDECLTYPE_SHORT2N = 9, - D3DDECLTYPE_SHORT4N = 10, - D3DDECLTYPE_USHORT2N = 11, - D3DDECLTYPE_USHORT4N = 12, - D3DDECLTYPE_UDEC3 = 13, - D3DDECLTYPE_DEC3N = 14, - D3DDECLTYPE_FLOAT16_2 = 15, - D3DDECLTYPE_FLOAT16_4 = 16, - D3DDECLTYPE_UNUSED = 17, -}} -pub const MAXD3DDECLTYPE: D3DDECLTYPE = D3DDECLTYPE_UNUSED; -STRUCT!{struct D3DVERTEXELEMENT9 { - Stream: ::WORD, - Offset: ::WORD, - Type: ::BYTE, - Method: ::BYTE, - Usage: ::BYTE, - UsageIndex: ::BYTE, -}} -pub type LPD3DVERTEXELEMENT9 = *mut D3DVERTEXELEMENT9; -pub const D3DDECL_END: D3DVERTEXELEMENT9 = D3DVERTEXELEMENT9 { - Stream: 0xFF, - Offset: 0, - Type: D3DDECLTYPE_UNUSED.0 as ::BYTE, - Method: 0, - Usage: 0, - UsageIndex: 0, -}; -pub const D3DDP_MAXTEXCOORD: ::DWORD = 8; -pub const D3DSTREAMSOURCE_INDEXEDDATA: ::DWORD = 1 << 30; -pub const D3DSTREAMSOURCE_INSTANCEDATA: ::DWORD = 2 << 30; -pub const D3DSI_OPCODE_MASK: ::DWORD = 0x0000FFFF; -pub const D3DSI_INSTLENGTH_MASK: ::DWORD = 0x0F000000; -pub const D3DSI_INSTLENGTH_SHIFT: ::DWORD = 24; -ENUM!{enum D3DSHADER_INSTRUCTION_OPCODE_TYPE { - D3DSIO_NOP = 0, - D3DSIO_MOV = 1, - D3DSIO_ADD = 2, - D3DSIO_SUB = 3, - D3DSIO_MAD = 4, - D3DSIO_MUL = 5, - D3DSIO_RCP = 6, - D3DSIO_RSQ = 7, - D3DSIO_DP3 = 8, - D3DSIO_DP4 = 9, - D3DSIO_MIN = 10, - D3DSIO_MAX = 11, - D3DSIO_SLT = 12, - D3DSIO_SGE = 13, - D3DSIO_EXP = 14, - D3DSIO_LOG = 15, - D3DSIO_LIT = 16, - D3DSIO_DST = 17, - D3DSIO_LRP = 18, - D3DSIO_FRC = 18, - D3DSIO_M4x4 = 20, - D3DSIO_M4x3 = 21, - D3DSIO_M3x4 = 22, - D3DSIO_M3x3 = 23, - D3DSIO_M3x2 = 24, - D3DSIO_CALL = 25, - D3DSIO_CALLNZ = 26, - D3DSIO_LOOP = 27, - D3DSIO_RET = 28, - D3DSIO_ENDLOOP = 29, - D3DSIO_LABEL = 30, - D3DSIO_DCL = 31, - D3DSIO_POW = 32, - D3DSIO_CRS = 33, - D3DSIO_SGN = 34, - D3DSIO_ABS = 35, - D3DSIO_NRM = 36, - D3DSIO_SINCOS = 37, - D3DSIO_REP = 38, - D3DSIO_ENDREP = 39, - D3DSIO_IF = 40, - D3DSIO_IFC = 41, - D3DSIO_ELSE = 42, - D3DSIO_ENDIF = 43, - D3DSIO_BREAK = 44, - D3DSIO_BREAKC = 45, - D3DSIO_MOVA = 46, - D3DSIO_DEFB = 47, - D3DSIO_DEFI = 48, - D3DSIO_TEXCOORD = 64, - D3DSIO_TEXKILL = 65, - D3DSIO_TEX = 66, - D3DSIO_TEXBEM = 67, - D3DSIO_TEXBEML = 68, - D3DSIO_TEXREG2AR = 69, - D3DSIO_TEXREG2GB = 70, - D3DSIO_TEXM3x2PAD = 71, - D3DSIO_TEXM3x2TEX = 72, - D3DSIO_TEXM3x3PAD = 73, - D3DSIO_TEXM3x3TEX = 74, - D3DSIO_RESERVED0 = 75, - D3DSIO_TEXM3x3SPEC = 76, - D3DSIO_TEXM3x3VSPEC = 77, - D3DSIO_EXPP = 78, - D3DSIO_LOGP = 79, - D3DSIO_CND = 80, - D3DSIO_DEF = 81, - D3DSIO_TEXREG2RGB = 82, - D3DSIO_TEXDP3TEX = 83, - D3DSIO_TEXM3x2DEPTH = 84, - D3DSIO_TEXDP3 = 85, - D3DSIO_TEXM3x3 = 86, - D3DSIO_TEXDEPTH = 87, - D3DSIO_CMP = 88, - D3DSIO_BEM = 89, - D3DSIO_DP2ADD = 90, - D3DSIO_DSX = 91, - D3DSIO_DSY = 92, - D3DSIO_TEXLDD = 93, - D3DSIO_SETP = 94, - D3DSIO_TEXLDL = 95, - D3DSIO_BREAKP = 96, - D3DSIO_PHASE = 0xFFFD, - D3DSIO_COMMENT = 0xFFFE, - D3DSIO_END = 0xFFFF, -}} -pub const D3DSI_COISSUE: ::DWORD = 0x40000000; -pub const D3DSP_OPCODESPECIFICCONTROL_MASK: ::DWORD = 0x00ff0000; -pub const D3DSP_OPCODESPECIFICCONTROL_SHIFT: ::DWORD = 16; -pub const D3DSI_TEXLD_PROJECT: ::DWORD = 0x01 << D3DSP_OPCODESPECIFICCONTROL_SHIFT; -pub const D3DSI_TEXLD_BIAS: ::DWORD = 0x02 << D3DSP_OPCODESPECIFICCONTROL_SHIFT; -ENUM!{enum D3DSHADER_COMPARISON { - D3DSPC_RESERVED0 = 0, - D3DSPC_GT = 1, - D3DSPC_EQ = 2, - D3DSPC_GE = 3, - D3DSPC_LT = 4, - D3DSPC_NE = 5, - D3DSPC_LE = 6, - D3DSPC_RESERVED1 = 7, -}} -pub const D3DSHADER_COMPARISON_SHIFT: ::DWORD = D3DSP_OPCODESPECIFICCONTROL_SHIFT; -pub const D3DSHADER_COMPARISON_MASK: ::DWORD = 0x7 << D3DSHADER_COMPARISON_SHIFT; -pub const D3DSHADER_INSTRUCTION_PREDICATED: ::DWORD = 0x1 << 28; -pub const D3DSP_DCL_USAGE_SHIFT: ::DWORD = 0; -pub const D3DSP_DCL_USAGE_MASK: ::DWORD = 0x0000000f; -pub const D3DSP_DCL_USAGEINDEX_SHIFT: ::DWORD = 16; -pub const D3DSP_DCL_USAGEINDEX_MASK: ::DWORD = 0x000f0000; -pub const D3DSP_TEXTURETYPE_SHIFT: ::DWORD = 27; -pub const D3DSP_TEXTURETYPE_MASK: ::DWORD = 0x78000000; -ENUM!{enum D3DSAMPLER_TEXTURE_TYPE { - D3DSTT_UNKNOWN = 0 << D3DSP_TEXTURETYPE_SHIFT, - D3DSTT_2D = 2 << D3DSP_TEXTURETYPE_SHIFT, - D3DSTT_CUBE = 3 << D3DSP_TEXTURETYPE_SHIFT, - D3DSTT_VOLUME = 4 << D3DSP_TEXTURETYPE_SHIFT, -}} -pub const D3DSP_REGNUM_MASK: ::DWORD = 0x000007FF; -pub const D3DSP_WRITEMASK_0: ::DWORD = 0x00010000; -pub const D3DSP_WRITEMASK_1: ::DWORD = 0x00020000; -pub const D3DSP_WRITEMASK_2: ::DWORD = 0x00040000; -pub const D3DSP_WRITEMASK_3: ::DWORD = 0x00080000; -pub const D3DSP_WRITEMASK_ALL: ::DWORD = 0x000F0000; -pub const D3DSP_DSTMOD_SHIFT: ::DWORD = 20; -pub const D3DSP_DSTMOD_MASK: ::DWORD = 0x00F00000; -pub const D3DSPDM_NONE: ::DWORD = 0 << D3DSP_DSTMOD_SHIFT; -pub const D3DSPDM_SATURATE: ::DWORD = 1 << D3DSP_DSTMOD_SHIFT; -pub const D3DSPDM_PARTIALPRECISION: ::DWORD = 2 << D3DSP_DSTMOD_SHIFT; -pub const D3DSPDM_MSAMPCENTROID: ::DWORD = 4 << D3DSP_DSTMOD_SHIFT; -pub const D3DSP_DSTSHIFT_SHIFT: ::DWORD = 24; -pub const D3DSP_DSTSHIFT_MASK: ::DWORD = 0x0F000000; -pub const D3DSP_REGTYPE_SHIFT: ::DWORD = 28; -pub const D3DSP_REGTYPE_SHIFT2: ::DWORD = 8; -pub const D3DSP_REGTYPE_MASK: ::DWORD = 0x70000000; -pub const D3DSP_REGTYPE_MASK2: ::DWORD = 0x00001800; -ENUM!{enum D3DSHADER_PARAM_REGISTER_TYPE { - D3DSPR_TEMP = 0, - D3DSPR_INPUT = 1, - D3DSPR_CONST = 2, - D3DSPR_ADDR = 3, - D3DSPR_TEXTURE = 3, - D3DSPR_RASTOUT = 4, - D3DSPR_ATTROUT = 5, - D3DSPR_TEXCRDOUT = 6, - D3DSPR_OUTPUT = 6, - D3DSPR_CONSTINT = 7, - D3DSPR_COLOROUT = 8, - D3DSPR_DEPTHOUT = 9, - D3DSPR_SAMPLER = 10, - D3DSPR_CONST2 = 11, - D3DSPR_CONST3 = 12, - D3DSPR_CONST4 = 13, - D3DSPR_CONSTBOOL = 14, - D3DSPR_LOOP = 15, - D3DSPR_TEMPFLOAT16 = 16, - D3DSPR_MISCTYPE = 17, - D3DSPR_LABEL = 18, - D3DSPR_PREDICATE = 19, -}} -ENUM!{enum D3DSHADER_MISCTYPE_OFFSETS { - D3DSMO_POSITION = 0, - D3DSMO_FACE = 1, -}} -ENUM!{enum D3DVS_RASTOUT_OFFSETS { - D3DSRO_POSITION = 0, - D3DSRO_FOG, - D3DSRO_POINT_SIZE, -}} -pub const D3DVS_ADDRESSMODE_SHIFT: ::DWORD = 13; -pub const D3DVS_ADDRESSMODE_MASK: ::DWORD = 1 << D3DVS_ADDRESSMODE_SHIFT; -ENUM!{enum D3DVS_ADDRESSMODE_TYPE { - D3DVS_ADDRMODE_ABSOLUTE = 0 << D3DVS_ADDRESSMODE_SHIFT, - D3DVS_ADDRMODE_RELATIVE = 1 << D3DVS_ADDRESSMODE_SHIFT, -}} -pub const D3DSHADER_ADDRESSMODE_SHIFT: ::DWORD = 13; -pub const D3DSHADER_ADDRESSMODE_MASK: ::DWORD = 1 << D3DSHADER_ADDRESSMODE_SHIFT; -ENUM!{enum D3DSHADER_ADDRESSMODE_TYPE { - D3DSHADER_ADDRMODE_ABSOLUTE = 0 << D3DSHADER_ADDRESSMODE_SHIFT, - D3DSHADER_ADDRMODE_RELATIVE = 1 << D3DSHADER_ADDRESSMODE_SHIFT, -}} -pub const D3DVS_SWIZZLE_SHIFT: ::DWORD = 16; -pub const D3DVS_SWIZZLE_MASK: ::DWORD = 0x00FF0000; -pub const D3DVS_X_X: ::DWORD = 0 << D3DVS_SWIZZLE_SHIFT; -pub const D3DVS_X_Y: ::DWORD = 1 << D3DVS_SWIZZLE_SHIFT; -pub const D3DVS_X_Z: ::DWORD = 2 << D3DVS_SWIZZLE_SHIFT; -pub const D3DVS_X_W: ::DWORD = 3 << D3DVS_SWIZZLE_SHIFT; -pub const D3DVS_Y_X: ::DWORD = 0 << (D3DVS_SWIZZLE_SHIFT + 2); -pub const D3DVS_Y_Y: ::DWORD = 1 << (D3DVS_SWIZZLE_SHIFT + 2); -pub const D3DVS_Y_Z: ::DWORD = 2 << (D3DVS_SWIZZLE_SHIFT + 2); -pub const D3DVS_Y_W: ::DWORD = 3 << (D3DVS_SWIZZLE_SHIFT + 2); -pub const D3DVS_Z_X: ::DWORD = 0 << (D3DVS_SWIZZLE_SHIFT + 4); -pub const D3DVS_Z_Y: ::DWORD = 1 << (D3DVS_SWIZZLE_SHIFT + 4); -pub const D3DVS_Z_Z: ::DWORD = 2 << (D3DVS_SWIZZLE_SHIFT + 4); -pub const D3DVS_Z_W: ::DWORD = 3 << (D3DVS_SWIZZLE_SHIFT + 4); -pub const D3DVS_W_X: ::DWORD = 0 << (D3DVS_SWIZZLE_SHIFT + 6); -pub const D3DVS_W_Y: ::DWORD = 1 << (D3DVS_SWIZZLE_SHIFT + 6); -pub const D3DVS_W_Z: ::DWORD = 2 << (D3DVS_SWIZZLE_SHIFT + 6); -pub const D3DVS_W_W: ::DWORD = 3 << (D3DVS_SWIZZLE_SHIFT + 6); -pub const D3DVS_NOSWIZZLE: ::DWORD = D3DVS_X_X | D3DVS_Y_Y | D3DVS_Z_Z | D3DVS_W_W; -pub const D3DSP_SWIZZLE_SHIFT: ::DWORD = 16; -pub const D3DSP_SWIZZLE_MASK: ::DWORD = 0x00FF0000; -pub const D3DSP_NOSWIZZLE: ::DWORD = (0 << (D3DSP_SWIZZLE_SHIFT + 0)) - | (1 << (D3DSP_SWIZZLE_SHIFT + 2)) | (2 << (D3DSP_SWIZZLE_SHIFT + 4)) - | (3 << (D3DSP_SWIZZLE_SHIFT + 6)); -pub const D3DSP_REPLICATERED: ::DWORD = (0 << (D3DSP_SWIZZLE_SHIFT + 0)) - | (0 << (D3DSP_SWIZZLE_SHIFT + 2)) | (0 << (D3DSP_SWIZZLE_SHIFT + 4)) - | (0 << (D3DSP_SWIZZLE_SHIFT + 6)); -pub const D3DSP_REPLICATEGREEN: ::DWORD = (1 << (D3DSP_SWIZZLE_SHIFT + 0)) - | (1 << (D3DSP_SWIZZLE_SHIFT + 2)) | (1 << (D3DSP_SWIZZLE_SHIFT + 4)) - | (1 << (D3DSP_SWIZZLE_SHIFT + 6)); -pub const D3DSP_REPLICATEBLUE: ::DWORD = (2 << (D3DSP_SWIZZLE_SHIFT + 0)) - | (2 << (D3DSP_SWIZZLE_SHIFT + 2)) | (2 << (D3DSP_SWIZZLE_SHIFT + 4)) - | (2 << (D3DSP_SWIZZLE_SHIFT + 6)); -pub const D3DSP_REPLICATEALPHA: ::DWORD = (3 << (D3DSP_SWIZZLE_SHIFT + 0)) - | (3 << (D3DSP_SWIZZLE_SHIFT + 2)) | (3 << (D3DSP_SWIZZLE_SHIFT + 4)) - | (3 << (D3DSP_SWIZZLE_SHIFT + 6)); -pub const D3DSP_SRCMOD_SHIFT: ::DWORD = 24; -pub const D3DSP_SRCMOD_MASK: ::DWORD = 0x0F000000; -ENUM!{enum D3DSHADER_PARAM_SRCMOD_TYPE { - D3DSPSM_NONE = 0 << D3DSP_SRCMOD_SHIFT, - D3DSPSM_NEG = 1 << D3DSP_SRCMOD_SHIFT, - D3DSPSM_BIAS = 2 << D3DSP_SRCMOD_SHIFT, - D3DSPSM_BIASNEG = 3 << D3DSP_SRCMOD_SHIFT, - D3DSPSM_SIGN = 4 << D3DSP_SRCMOD_SHIFT, - D3DSPSM_SIGNNEG = 5 << D3DSP_SRCMOD_SHIFT, - D3DSPSM_COMP = 6 << D3DSP_SRCMOD_SHIFT, - D3DSPSM_X2 = 7 << D3DSP_SRCMOD_SHIFT, - D3DSPSM_X2NEG = 8 << D3DSP_SRCMOD_SHIFT, - D3DSPSM_DZ = 9 << D3DSP_SRCMOD_SHIFT, - D3DSPSM_DW = 10 << D3DSP_SRCMOD_SHIFT, - D3DSPSM_ABS = 11 << D3DSP_SRCMOD_SHIFT, - D3DSPSM_ABSNEG = 12 << D3DSP_SRCMOD_SHIFT, - D3DSPSM_NOT = 13 << D3DSP_SRCMOD_SHIFT, -}} -pub const D3DSP_MIN_PRECISION_SHIFT: ::DWORD = 14; -pub const D3DSP_MIN_PRECISION_MASK: ::DWORD = 0x0000C000; -ENUM!{enum D3DSHADER_MIN_PRECISION { - D3DMP_DEFAULT = 0, - D3DMP_16 = 1, - D3DMP_2_8 = 2, -}} -pub const D3DSI_COMMENTSIZE_SHIFT: ::DWORD = 16; -pub const D3DSI_COMMENTSIZE_MASK: ::DWORD = 0x7FFF0000; -pub const D3DPS_END: ::DWORD = 0x0000FFFF; -pub const D3DVS_END: ::DWORD = 0x0000FFFF; -ENUM!{enum D3DBASISTYPE { - D3DBASIS_BEZIER = 0, - D3DBASIS_BSPLINE = 1, - D3DBASIS_CATMULL_ROM = 2, -}} -ENUM!{enum D3DDEGREETYPE { - D3DDEGREE_LINEAR = 1, - D3DDEGREE_QUADRATIC = 2, - D3DDEGREE_CUBIC = 3, - D3DDEGREE_QUINTIC = 5, -}} -ENUM!{enum D3DPATCHEDGESTYLE { - D3DPATCHEDGE_DISCRETE = 0, - D3DPATCHEDGE_CONTINUOUS = 1, -}} -ENUM!{enum D3DSTATEBLOCKTYPE { - D3DSBT_ALL = 1, - D3DSBT_PIXELSTATE = 2, - D3DSBT_VERTEXSTATE = 3, -}} -FLAGS!{enum D3DVERTEXBLENDFLAGS { - D3DVBF_DISABLE = 0, - D3DVBF_1WEIGHTS = 1, - D3DVBF_2WEIGHTS = 2, - D3DVBF_3WEIGHTS = 3, - D3DVBF_TWEENING = 255, - D3DVBF_0WEIGHTS = 256, -}} -ENUM!{enum D3DTEXTURETRANSFORMFLAGS { - D3DTTFF_DISABLE = 0, - D3DTTFF_COUNT1 = 1, - D3DTTFF_COUNT2 = 2, - D3DTTFF_COUNT3 = 3, - D3DTTFF_COUNT4 = 4, - D3DTTFF_PROJECTED = 256, -}} -pub const D3DFVF_TEXTUREFORMAT2: ::DWORD = 0; -pub const D3DFVF_TEXTUREFORMAT1: ::DWORD = 3; -pub const D3DFVF_TEXTUREFORMAT3: ::DWORD = 1; -pub const D3DFVF_TEXTUREFORMAT4: ::DWORD = 2; -ENUM!{enum D3DDEVTYPE { - D3DDEVTYPE_HAL = 1, - D3DDEVTYPE_REF = 2, - D3DDEVTYPE_SW = 3, - D3DDEVTYPE_NULLREF = 4, -}} -ENUM!{enum D3DMULTISAMPLE_TYPE { - D3DMULTISAMPLE_NONE = 0, - D3DMULTISAMPLE_NONMASKABLE = 1, - D3DMULTISAMPLE_2_SAMPLES = 2, - D3DMULTISAMPLE_3_SAMPLES = 3, - D3DMULTISAMPLE_4_SAMPLES = 4, - D3DMULTISAMPLE_5_SAMPLES = 5, - D3DMULTISAMPLE_6_SAMPLES = 6, - D3DMULTISAMPLE_7_SAMPLES = 7, - D3DMULTISAMPLE_8_SAMPLES = 8, - D3DMULTISAMPLE_9_SAMPLES = 9, - D3DMULTISAMPLE_10_SAMPLES = 10, - D3DMULTISAMPLE_11_SAMPLES = 11, - D3DMULTISAMPLE_12_SAMPLES = 12, - D3DMULTISAMPLE_13_SAMPLES = 13, - D3DMULTISAMPLE_14_SAMPLES = 14, - D3DMULTISAMPLE_15_SAMPLES = 15, - D3DMULTISAMPLE_16_SAMPLES = 16, -}} -ENUM!{enum D3DFORMAT { - D3DFMT_UNKNOWN = 0, - D3DFMT_R8G8B8 = 20, - D3DFMT_A8R8G8B8 = 21, - D3DFMT_X8R8G8B8 = 22, - D3DFMT_R5G6B5 = 23, - D3DFMT_X1R5G5B5 = 24, - D3DFMT_A1R5G5B5 = 25, - D3DFMT_A4R4G4B4 = 26, - D3DFMT_R3G3B2 = 27, - D3DFMT_A8 = 28, - D3DFMT_A8R3G3B2 = 29, - D3DFMT_X4R4G4B4 = 30, - D3DFMT_A2B10G10R10 = 31, - D3DFMT_A8B8G8R8 = 32, - D3DFMT_X8B8G8R8 = 33, - D3DFMT_G16R16 = 34, - D3DFMT_A2R10G10B10 = 35, - D3DFMT_A16B16G16R16 = 36, - D3DFMT_A8P8 = 40, - D3DFMT_P8 = 41, - D3DFMT_L8 = 50, - D3DFMT_A8L8 = 51, - D3DFMT_A4L4 = 52, - D3DFMT_V8U8 = 60, - D3DFMT_L6V5U5 = 61, - D3DFMT_X8L8V8U8 = 62, - D3DFMT_Q8W8V8U8 = 63, - D3DFMT_V16U16 = 64, - D3DFMT_A2W10V10U10 = 67, - D3DFMT_UYVY = MAKEFOURCC!(b'U', b'Y', b'V', b'Y') as u32, - D3DFMT_R8G8_B8G8 = MAKEFOURCC!(b'R', b'G', b'B', b'G') as u32, - D3DFMT_YUY2 = MAKEFOURCC!(b'Y', b'U', b'Y', b'2') as u32, - D3DFMT_G8R8_G8B8 = MAKEFOURCC!(b'G', b'R', b'G', b'B') as u32, - D3DFMT_DXT1 = MAKEFOURCC!(b'D', b'X', b'T', b'1') as u32, - D3DFMT_DXT2 = MAKEFOURCC!(b'D', b'X', b'T', b'2') as u32, - D3DFMT_DXT3 = MAKEFOURCC!(b'D', b'X', b'T', b'3') as u32, - D3DFMT_DXT4 = MAKEFOURCC!(b'D', b'X', b'T', b'4') as u32, - D3DFMT_DXT5 = MAKEFOURCC!(b'D', b'X', b'T', b'5') as u32, - D3DFMT_D16_LOCKABLE = 70, - D3DFMT_D32 = 71, - D3DFMT_D15S1 = 73, - D3DFMT_D24S8 = 75, - D3DFMT_D24X8 = 77, - D3DFMT_D24X4S4 = 79, - D3DFMT_D16 = 80, - D3DFMT_D32F_LOCKABLE = 82, - D3DFMT_D24FS8 = 83, - D3DFMT_D32_LOCKABLE = 84, - D3DFMT_S8_LOCKABLE = 85, - D3DFMT_L16 = 81, - D3DFMT_VERTEXDATA = 100, - D3DFMT_INDEX16 = 101, - D3DFMT_INDEX32 = 102, - D3DFMT_Q16W16V16U16 = 110, - D3DFMT_MULTI2_ARGB8 = MAKEFOURCC!(b'M', b'E', b'T', b'1') as u32, - D3DFMT_R16F = 111, - D3DFMT_G16R16F = 112, - D3DFMT_A16B16G16R16F = 113, - D3DFMT_R32F = 114, - D3DFMT_G32R32F = 115, - D3DFMT_A32B32G32R32F = 116, - D3DFMT_CxV8U8 = 117, - D3DFMT_A1 = 118, - D3DFMT_A2B10G10R10_XR_BIAS = 119, - D3DFMT_BINARYBUFFER = 199, -}} -STRUCT!{struct D3DDISPLAYMODE { - Width: ::UINT, - Height: ::UINT, - RefreshRate: ::UINT, - Format: D3DFORMAT, -}} -STRUCT!{struct D3DDEVICE_CREATION_PARAMETERS { - AdapterOrdinal: ::UINT, - DeviceType: D3DDEVTYPE, - hFocusWindow: ::HWND, - BehaviorFlags: ::DWORD, -}} -ENUM!{enum D3DSWAPEFFECT { - D3DSWAPEFFECT_DISCARD = 1, - D3DSWAPEFFECT_FLIP = 2, - D3DSWAPEFFECT_COPY = 3, - D3DSWAPEFFECT_OVERLAY = 4, - D3DSWAPEFFECT_FLIPEX = 5, -}} -ENUM!{enum D3DPOOL { - D3DPOOL_DEFAULT = 0, - D3DPOOL_MANAGED = 1, - D3DPOOL_SYSTEMMEM = 2, - D3DPOOL_SCRATCH = 3, -}} -pub const D3DPRESENT_RATE_DEFAULT: ::DWORD = 0x00000000; -STRUCT!{struct D3DPRESENT_PARAMETERS { - BackBufferWidth: ::UINT, - BackBufferHeight: ::UINT, - BackBufferFormat: D3DFORMAT, - BackBufferCount: ::UINT, - MultiSampleType: D3DMULTISAMPLE_TYPE, - MultiSampleQuality: ::DWORD, - SwapEffect: D3DSWAPEFFECT, - hDeviceWindow: ::HWND, - Windowed: ::BOOL, - EnableAutoDepthStencil: ::BOOL, - AutoDepthStencilFormat: D3DFORMAT, - Flags: ::DWORD, - FullScreen_RefreshRateInHz: ::UINT, - PresentationInterval: ::UINT, -}} -pub const D3DPRESENTFLAG_LOCKABLE_BACKBUFFER: ::DWORD = 0x00000001; -pub const D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL: ::DWORD = 0x00000002; -pub const D3DPRESENTFLAG_DEVICECLIP: ::DWORD = 0x00000004; -pub const D3DPRESENTFLAG_VIDEO: ::DWORD = 0x00000010; -pub const D3DPRESENTFLAG_NOAUTOROTATE: ::DWORD = 0x00000020; -pub const D3DPRESENTFLAG_UNPRUNEDMODE: ::DWORD = 0x00000040; -pub const D3DPRESENTFLAG_OVERLAY_LIMITEDRGB: ::DWORD = 0x00000080; -pub const D3DPRESENTFLAG_OVERLAY_YCbCr_BT709: ::DWORD = 0x00000100; -pub const D3DPRESENTFLAG_OVERLAY_YCbCr_xvYCC: ::DWORD = 0x00000200; -pub const D3DPRESENTFLAG_RESTRICTED_CONTENT: ::DWORD = 0x00000400; -pub const D3DPRESENTFLAG_RESTRICT_SHARED_RESOURCE_DRIVER: ::DWORD = 0x00000800; -STRUCT!{nodebug struct D3DGAMMARAMP { - red: [::WORD; 256], - green: [::WORD; 256], - blue: [::WORD; 256], -}} -ENUM!{enum D3DBACKBUFFER_TYPE { - D3DBACKBUFFER_TYPE_MONO = 0, - D3DBACKBUFFER_TYPE_LEFT = 1, - D3DBACKBUFFER_TYPE_RIGHT = 2, -}} -ENUM!{enum D3DRESOURCETYPE { - D3DRTYPE_SURFACE = 1, - D3DRTYPE_VOLUME = 2, - D3DRTYPE_TEXTURE = 3, - D3DRTYPE_VOLUMETEXTURE = 4, - D3DRTYPE_CUBETEXTURE = 5, - D3DRTYPE_VERTEXBUFFER = 6, - D3DRTYPE_INDEXBUFFER = 7, -}} -pub const D3DUSAGE_RENDERTARGET: ::DWORD = 0x00000001; -pub const D3DUSAGE_DEPTHSTENCIL: ::DWORD = 0x00000002; -pub const D3DUSAGE_DYNAMIC: ::DWORD = 0x00000200; -pub const D3DUSAGE_NONSECURE: ::DWORD = 0x00800000; -pub const D3DUSAGE_AUTOGENMIPMAP: ::DWORD = 0x00000400; -pub const D3DUSAGE_DMAP: ::DWORD = 0x00004000; -pub const D3DUSAGE_QUERY_LEGACYBUMPMAP: ::DWORD = 0x00008000; -pub const D3DUSAGE_QUERY_SRGBREAD: ::DWORD = 0x00010000; -pub const D3DUSAGE_QUERY_FILTER: ::DWORD = 0x00020000; -pub const D3DUSAGE_QUERY_SRGBWRITE: ::DWORD = 0x00040000; -pub const D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING: ::DWORD = 0x00080000; -pub const D3DUSAGE_QUERY_VERTEXTEXTURE: ::DWORD = 0x00100000; -pub const D3DUSAGE_QUERY_WRAPANDMIP: ::DWORD = 0x00200000; -pub const D3DUSAGE_WRITEONLY: ::DWORD = 0x00000008; -pub const D3DUSAGE_SOFTWAREPROCESSING: ::DWORD = 0x00000010; -pub const D3DUSAGE_DONOTCLIP: ::DWORD = 0x00000020; -pub const D3DUSAGE_POINTS: ::DWORD = 0x00000040; -pub const D3DUSAGE_RTPATCHES: ::DWORD = 0x00000080; -pub const D3DUSAGE_NPATCHES: ::DWORD = 0x00000100; -pub const D3DUSAGE_TEXTAPI: ::DWORD = 0x10000000; -pub const D3DUSAGE_RESTRICTED_CONTENT: ::DWORD = 0x00000800; -pub const D3DUSAGE_RESTRICT_SHARED_RESOURCE: ::DWORD = 0x00002000; -pub const D3DUSAGE_RESTRICT_SHARED_RESOURCE_DRIVER: ::DWORD = 0x00001000; -ENUM!{enum D3DCUBEMAP_FACES { - D3DCUBEMAP_FACE_POSITIVE_X = 0, - D3DCUBEMAP_FACE_NEGATIVE_X = 1, - D3DCUBEMAP_FACE_POSITIVE_Y = 2, - D3DCUBEMAP_FACE_NEGATIVE_Y = 3, - D3DCUBEMAP_FACE_POSITIVE_Z = 4, - D3DCUBEMAP_FACE_NEGATIVE_Z = 5, -}} -pub const D3DLOCK_READONLY: ::DWORD = 0x00000010; -pub const D3DLOCK_DISCARD: ::DWORD = 0x00002000; -pub const D3DLOCK_NOOVERWRITE: ::DWORD = 0x00001000; -pub const D3DLOCK_NOSYSLOCK: ::DWORD = 0x00000800; -pub const D3DLOCK_DONOTWAIT: ::DWORD = 0x00004000; -pub const D3DLOCK_NO_DIRTY_UPDATE: ::DWORD = 0x00008000; -STRUCT!{struct D3DVERTEXBUFFER_DESC { - Format: D3DFORMAT, - Type: D3DRESOURCETYPE, - Usage: ::DWORD, - Pool: D3DPOOL, - Size: ::UINT, - FVF: ::DWORD, -}} -STRUCT!{struct D3DINDEXBUFFER_DESC { - Format: D3DFORMAT, - Type: D3DRESOURCETYPE, - Usage: ::DWORD, - Pool: D3DPOOL, - Size: ::UINT, -}} -STRUCT!{struct D3DSURFACE_DESC { - Format: D3DFORMAT, - Type: D3DRESOURCETYPE, - Usage: ::DWORD, - Pool: D3DPOOL, - MultiSampleType: D3DMULTISAMPLE_TYPE, - MultiSampleQuality: ::DWORD, - Width: ::UINT, - Height: ::UINT, -}} -STRUCT!{struct D3DVOLUME_DESC { - Format: D3DFORMAT, - Type: D3DRESOURCETYPE, - Usage: ::DWORD, - Pool: D3DPOOL, - Width: ::UINT, - Height: ::UINT, - Depth: ::UINT, -}} -STRUCT!{struct D3DLOCKED_RECT { - Pitch: ::INT, - pBits: *mut ::c_void, -}} -STRUCT!{struct D3DBOX { - Left: ::UINT, - Top: ::UINT, - Right: ::UINT, - Bottom: ::UINT, - Front: ::UINT, - Back: ::UINT, -}} -STRUCT!{struct D3DLOCKED_BOX { - RowPitch: ::INT, - SlicePitch: ::INT, - pBits: *mut ::c_void, -}} -STRUCT!{struct D3DRANGE { - Offset: ::UINT, - Size: ::UINT, -}} -STRUCT!{struct D3DRECTPATCH_INFO { - StartVertexOffsetWidth: ::UINT, - StartVertexOffsetHeight: ::UINT, - Width: ::UINT, - Height: ::UINT, - Stride: ::UINT, - Basis: D3DBASISTYPE, - Degree: D3DDEGREETYPE, -}} -STRUCT!{struct D3DTRIPATCH_INFO { - StartVertexOffset: ::UINT, - NumVertices: ::UINT, - Basis: D3DBASISTYPE, - Degree: D3DDEGREETYPE, -}} -pub const MAX_DEVICE_IDENTIFIER_STRING: usize = 512; -STRUCT!{nodebug struct D3DADAPTER_IDENTIFIER9 { - Driver: [::c_char; MAX_DEVICE_IDENTIFIER_STRING], - Description: [::c_char; MAX_DEVICE_IDENTIFIER_STRING], - DeviceName: [::c_char; 32], - DriverVersion: ::LARGE_INTEGER, - VendorId: ::DWORD, - DeviceId: ::DWORD, - SubSysId: ::DWORD, - Revision: ::DWORD, - DeviceIdentifier: ::GUID, - WHQLLevel: ::DWORD, -}} -STRUCT!{struct D3DRASTER_STATUS { - InVBlank: ::BOOL, - ScanLine: ::UINT, -}} -ENUM!{enum D3DDEBUGMONITORTOKENS { - D3DDMT_ENABLE = 0, - D3DDMT_DISABLE = 1, -}} -ENUM!{enum D3DQUERYTYPE { - D3DQUERYTYPE_VCACHE = 4, - D3DQUERYTYPE_RESOURCEMANAGER = 5, - D3DQUERYTYPE_VERTEXSTATS = 6, - D3DQUERYTYPE_EVENT = 8, - D3DQUERYTYPE_OCCLUSION = 9, - D3DQUERYTYPE_TIMESTAMP = 10, - D3DQUERYTYPE_TIMESTAMPDISJOINT = 11, - D3DQUERYTYPE_TIMESTAMPFREQ = 12, - D3DQUERYTYPE_PIPELINETIMINGS = 13, - D3DQUERYTYPE_INTERFACETIMINGS = 14, - D3DQUERYTYPE_VERTEXTIMINGS = 15, - D3DQUERYTYPE_PIXELTIMINGS = 16, - D3DQUERYTYPE_BANDWIDTHTIMINGS = 17, - D3DQUERYTYPE_CACHEUTILIZATION = 18, - D3DQUERYTYPE_MEMORYPRESSURE = 19, -}} -pub const D3DISSUE_END: ::DWORD = 1 << 0; -pub const D3DISSUE_BEGIN: ::DWORD = 1 << 1; -pub const D3DGETDATA_FLUSH: ::DWORD = 1 << 0; -STRUCT!{struct D3DRESOURCESTATS { - bThrashing: ::BOOL, - ApproxBytesDownloaded: ::DWORD, - NumEvicts: ::DWORD, - NumVidCreates: ::DWORD, - LastPri: ::DWORD, - NumUsed: ::DWORD, - NumUsedInVidMem: ::DWORD, - WorkingSet: ::DWORD, - WorkingSetBytes: ::DWORD, - TotalManaged: ::DWORD, - TotalBytes: ::DWORD, -}} -pub const D3DRTYPECOUNT: usize = 8; -STRUCT!{struct D3DDEVINFO_RESOURCEMANAGER { - stats: [D3DRESOURCESTATS; 8 /*D3DRTYPECOUNT, rust bug?*/], -}} -pub type LPD3DDEVINFO_RESOURCEMANAGER = *mut D3DDEVINFO_RESOURCEMANAGER; -STRUCT!{struct D3DDEVINFO_D3DVERTEXSTATS { - NumRenderedTriangles: ::DWORD, - NumExtraClippingTriangles: ::DWORD, -}} -pub type LPD3DDEVINFO_D3DVERTEXSTATS = *mut D3DDEVINFO_D3DVERTEXSTATS; -STRUCT!{struct D3DDEVINFO_VCACHE { - Pattern: ::DWORD, - OptMethod: ::DWORD, - CacheSize: ::DWORD, - MagicNumber: ::DWORD, -}} -pub type LPD3DDEVINFO_VCACHE = *mut D3DDEVINFO_VCACHE; -STRUCT!{struct D3DDEVINFO_D3D9PIPELINETIMINGS { - VertexProcessingTimePercent: ::FLOAT, - PixelProcessingTimePercent: ::FLOAT, - OtherGPUProcessingTimePercent: ::FLOAT, - GPUIdleTimePercent: ::FLOAT, -}} -STRUCT!{struct D3DDEVINFO_D3D9INTERFACETIMINGS { - WaitingForGPUToUseApplicationResourceTimePercent: ::FLOAT, - WaitingForGPUToAcceptMoreCommandsTimePercent: ::FLOAT, - WaitingForGPUToStayWithinLatencyTimePercent: ::FLOAT, - WaitingForGPUExclusiveResourceTimePercent: ::FLOAT, - WaitingForGPUOtherTimePercent: ::FLOAT, -}} -STRUCT!{struct D3DDEVINFO_D3D9STAGETIMINGS { - MemoryProcessingPercent: ::FLOAT, - ComputationProcessingPercent: ::FLOAT, -}} -STRUCT!{struct D3DDEVINFO_D3D9BANDWIDTHTIMINGS { - MaxBandwidthUtilized: ::FLOAT, - FrontEndUploadMemoryUtilizedPercent: ::FLOAT, - VertexRateUtilizedPercent: ::FLOAT, - TriangleSetupRateUtilizedPercent: ::FLOAT, - FillRateUtilizedPercent: ::FLOAT, -}} -STRUCT!{struct D3DDEVINFO_D3D9CACHEUTILIZATION { - TextureCacheHitRate: ::FLOAT, - PostTransformVertexCacheHitRate: ::FLOAT, -}} -STRUCT!{struct D3DMEMORYPRESSURE { - BytesEvictedFromProcess: ::UINT64, - SizeOfInefficientAllocation: ::UINT64, - LevelOfEfficiency: ::DWORD, -}} -ENUM!{enum D3DCOMPOSERECTSOP { - D3DCOMPOSERECTS_COPY = 1, - D3DCOMPOSERECTS_OR = 2, - D3DCOMPOSERECTS_AND = 3, - D3DCOMPOSERECTS_NEG = 4, -}} -STRUCT!{struct D3DCOMPOSERECTDESC { - X: ::USHORT, - Y: ::USHORT, - Width: ::USHORT, - Height: ::USHORT, -}} -STRUCT!{struct D3DCOMPOSERECTDESTINATION { - SrcRectIndex: ::USHORT, - Reserved: ::USHORT, - X: ::SHORT, - Y: ::SHORT, -}} -pub const D3DCOMPOSERECTS_MAXNUMRECTS: ::DWORD = 0xFFFF; -pub const D3DCONVOLUTIONMONO_MAXWIDTH: ::DWORD = 7; -pub const D3DCONVOLUTIONMONO_MAXHEIGHT: ::DWORD = D3DCONVOLUTIONMONO_MAXWIDTH; -pub const D3DFMT_A1_SURFACE_MAXWIDTH: ::DWORD = 8192; -pub const D3DFMT_A1_SURFACE_MAXHEIGHT: ::DWORD = 2048; -STRUCT!{struct D3DPRESENTSTATS { - PresentCount: ::UINT, - PresentRefreshCount: ::UINT, - SyncRefreshCount: ::UINT, - SyncQPCTime: ::LARGE_INTEGER, - SyncGPUTime: ::LARGE_INTEGER, -}} -ENUM!{enum D3DSCANLINEORDERING { - D3DSCANLINEORDERING_UNKNOWN = 0, - D3DSCANLINEORDERING_PROGRESSIVE = 1, - D3DSCANLINEORDERING_INTERLACED = 2, -}} -STRUCT!{struct D3DDISPLAYMODEEX { - Size: ::UINT, - Width: ::UINT, - Height: ::UINT, - RefreshRate: ::UINT, - Format: D3DFORMAT, - ScanLineOrdering: D3DSCANLINEORDERING, -}} -STRUCT!{struct D3DDISPLAYMODEFILTER { - Size: ::UINT, - Format: D3DFORMAT, - ScanLineOrdering: D3DSCANLINEORDERING, -}} -ENUM!{enum D3DDISPLAYROTATION { - D3DDISPLAYROTATION_IDENTITY = 1, - D3DDISPLAYROTATION_90 = 2, - D3DDISPLAYROTATION_180 = 3, - D3DDISPLAYROTATION_270 = 4, -}} -pub const D3D9_RESOURCE_PRIORITY_MINIMUM: ::DWORD = 0x28000000; -pub const D3D9_RESOURCE_PRIORITY_LOW: ::DWORD = 0x50000000; -pub const D3D9_RESOURCE_PRIORITY_NORMAL: ::DWORD = 0x78000000; -pub const D3D9_RESOURCE_PRIORITY_HIGH: ::DWORD = 0xa0000000; -pub const D3D9_RESOURCE_PRIORITY_MAXIMUM: ::DWORD = 0xc8000000; -pub const D3D_OMAC_SIZE: usize = 16; -STRUCT!{struct D3D_OMAC { - Omac: [::BYTE; D3D_OMAC_SIZE], -}} -ENUM!{enum D3DAUTHENTICATEDCHANNELTYPE { - D3DAUTHENTICATEDCHANNEL_D3D9 = 1, - D3DAUTHENTICATEDCHANNEL_DRIVER_SOFTWARE = 2, - D3DAUTHENTICATEDCHANNEL_DRIVER_HARDWARE = 3, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERY_INPUT { - QueryType: ::GUID, - hChannel: ::HANDLE, - SequenceNumber: ::UINT, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT { - omac: D3D_OMAC, - QueryType: ::GUID, - hChannel: ::HANDLE, - SequenceNumber: ::UINT, - ReturnCode: ::HRESULT, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS { - Value: ::UINT, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYPROTECTION_OUTPUT { - Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, - ProtectionFlags: D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYCHANNELTYPE_OUTPUT { - Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, - ChannelType: D3DAUTHENTICATEDCHANNELTYPE, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYDEVICEHANDLE_OUTPUT { - Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, - DeviceHandle: ::HANDLE, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_INPUT { - Input: D3DAUTHENTICATEDCHANNEL_QUERY_INPUT, - DXVA2DecodeHandle: ::HANDLE, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_OUTPUT { - Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, - DXVA2DecodeHandle: ::HANDLE, - CryptoSessionHandle: ::HANDLE, - DeviceHandle: ::HANDLE, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESSCOUNT_OUTPUT { - Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, - NumRestrictedSharedResourceProcesses: ::UINT, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_INPUT { - Input: D3DAUTHENTICATEDCHANNEL_QUERY_INPUT, - ProcessIndex: ::UINT, -}} -ENUM!{enum D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE { - PROCESSIDTYPE_UNKNOWN = 0, - PROCESSIDTYPE_DWM = 1, - PROCESSIDTYPE_HANDLE = 2, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_OUTPUT { - Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, - ProcessIndex: ::UINT, - ProcessIdentifer: D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE, - ProcessHandle: ::HANDLE, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYUNRESTRICTEDPROTECTEDSHAREDRESOURCECOUNT_OUTPUT { - Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, - NumUnrestrictedProtectedSharedResources: ::UINT, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_INPUT { - Input: D3DAUTHENTICATEDCHANNEL_QUERY_INPUT, - DeviceHandle: ::HANDLE, - CryptoSessionHandle: ::HANDLE, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_OUTPUT { - Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, - DeviceHandle: ::HANDLE, - CryptoSessionHandle: ::HANDLE, - NumOutputIDs: ::UINT, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_INPUT { - Input: D3DAUTHENTICATEDCHANNEL_QUERY_INPUT, - DeviceHandle: ::HANDLE, - CryptoSessionHandle: ::HANDLE, - OutputIDIndex: ::UINT, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_OUTPUT { - Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, - DeviceHandle: ::HANDLE, - CryptoSessionHandle: ::HANDLE, - OutputIDIndex: ::UINT, - OutputID: ::UINT64, -}} -FLAGS!{enum D3DBUSTYPE { - D3DBUSTYPE_OTHER = 0x00000000, - D3DBUSTYPE_PCI = 0x00000001, - D3DBUSTYPE_PCIX = 0x00000002, - D3DBUSTYPE_PCIEXPRESS = 0x00000003, - D3DBUSTYPE_AGP = 0x00000004, - D3DBUSIMPL_MODIFIER_INSIDE_OF_CHIPSET = 0x00010000, - MD3DBUSIMPL_ODIFIER_TRACKS_ON_MOTHER_BOARD_TO_CHIP = 0x00020000, - D3DBUSIMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_SOCKET = 0x00030000, - D3DBUSIMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR = 0x00040000, - D3DBUSIMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR_INSIDE_OF_NUAE = 0x00050000, - D3DBUSIMPL_MODIFIER_NON_STANDARD = 0x80000000, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYINFOBUSTYPE_OUTPUT { - Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, - BusType: D3DBUSTYPE, - bAccessibleInContiguousBlocks: ::BOOL, - bAccessibleInNonContiguousBlocks: ::BOOL, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUIDCOUNT_OUTPUT { - Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, - NumEncryptionGuids: ::UINT, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_INPUT { - Input: D3DAUTHENTICATEDCHANNEL_QUERY_INPUT, - EncryptionGuidIndex: ::UINT, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_OUTPUT { - Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, - EncryptionGuidIndex: ::UINT, - EncryptionGuid: ::GUID, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_QUERYUNCOMPRESSEDENCRYPTIONLEVEL_OUTPUT { - Output: D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, - EncryptionGuid: ::GUID, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT { - omac: D3D_OMAC, - ConfigureType: ::GUID, - hChannel: ::HANDLE, - SequenceNumber: ::UINT, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT { - omac: D3D_OMAC, - ConfigureType: ::GUID, - hChannel: ::HANDLE, - SequenceNumber: ::UINT, - ReturnCode: ::HRESULT, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGUREINITIALIZE { - Parameters: D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT, - StartSequenceQuery: ::UINT, - StartSequenceConfigure: ::UINT, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGUREPROTECTION { - Parameters: D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT, - Protections: D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGURECRYPTOSESSION { - Parameters: D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT, - DXVA2DecodeHandle: ::HANDLE, - CryptoSessionHandle: ::HANDLE, - DeviceHandle: ::HANDLE, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGURESHAREDRESOURCE { - Parameters: D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT, - ProcessIdentiferType: D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE, - ProcessHandle: ::HANDLE, - AllowAccess: ::BOOL, -}} -STRUCT!{struct D3DAUTHENTICATEDCHANNEL_CONFIGUREUNCOMPRESSEDENCRYPTION { - Parameters: D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT, - EncryptionGuid: ::GUID, -}} -STRUCT!{struct D3DENCRYPTED_BLOCK_INFO { - NumEncryptedBytesAtBeginning: ::UINT, - NumBytesInSkipPattern: ::UINT, - NumBytesInEncryptPattern: ::UINT, -}} -STRUCT!{struct D3DAES_CTR_IV { - IV: ::UINT64, - Count: ::UINT64, -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/d3dcommon.rs cargo-0.37.0/vendor/winapi-0.2.8/src/d3dcommon.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/d3dcommon.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/d3dcommon.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,753 +0,0 @@ -// Copyright © 2015; Connor Hilarides -// Licensed under the MIT License -//! Mappings for the contents of d3dcommon.h -ENUM!{enum D3D_DRIVER_TYPE { - D3D_DRIVER_TYPE_UNKNOWN, - D3D_DRIVER_TYPE_HARDWARE, - D3D_DRIVER_TYPE_REFERENCE, - D3D_DRIVER_TYPE_NULL, - D3D_DRIVER_TYPE_SOFTWARE, - D3D_DRIVER_TYPE_WARP, -}} -ENUM!{enum D3D_FEATURE_LEVEL { - D3D_FEATURE_LEVEL_9_1 = 0x9100, - D3D_FEATURE_LEVEL_9_2 = 0x9200, - D3D_FEATURE_LEVEL_9_3 = 0x9300, - D3D_FEATURE_LEVEL_10_0 = 0xa000, - D3D_FEATURE_LEVEL_10_1 = 0xa100, - D3D_FEATURE_LEVEL_11_0 = 0xb000, - D3D_FEATURE_LEVEL_11_1 = 0xb100, - D3D_FEATURE_LEVEL_12_0 = 0xc000, - D3D_FEATURE_LEVEL_12_1 = 0xc100, -}} -ENUM!{enum D3D_PRIMITIVE_TOPOLOGY { - D3D_PRIMITIVE_TOPOLOGY_UNDEFINED = 0, - D3D_PRIMITIVE_TOPOLOGY_POINTLIST = 1, - D3D_PRIMITIVE_TOPOLOGY_LINELIST = 2, - D3D_PRIMITIVE_TOPOLOGY_LINESTRIP = 3, - D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4, - D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5, - D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10, - D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11, - D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12, - D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13, - D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33, - D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = 34, - D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = 35, - D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = 36, - D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = 37, - D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = 38, - D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = 39, - D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = 40, - D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = 41, - D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = 42, - D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = 43, - D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = 44, - D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = 45, - D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = 46, - D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = 47, - D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = 48, - D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = 49, - D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = 50, - D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = 51, - D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = 52, - D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = 53, - D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = 54, - D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = 55, - D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = 56, - D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = 57, - D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = 58, - D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = 59, - D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = 60, - D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = 61, - D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = 62, - D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = 63, - D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = 64, -}} -pub const D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_UNDEFINED; -pub const D3D10_PRIMITIVE_TOPOLOGY_POINTLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_POINTLIST; -pub const D3D10_PRIMITIVE_TOPOLOGY_LINELIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_LINELIST; -pub const D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_LINESTRIP; -pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; -pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; -pub const D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ; -pub const D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ; -pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ; -pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ; -pub const D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_UNDEFINED; -pub const D3D11_PRIMITIVE_TOPOLOGY_POINTLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_POINTLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_LINELIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_LINELIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_LINESTRIP; -pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; -pub const D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ; -pub const D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ; -pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ; -pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ; -pub const D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST; -pub const D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST: ::D3D_PRIMITIVE_TOPOLOGY = - D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST; -ENUM!{enum D3D_PRIMITIVE { - D3D_PRIMITIVE_UNDEFINED = 0, - D3D_PRIMITIVE_POINT = 1, - D3D_PRIMITIVE_LINE = 2, - D3D_PRIMITIVE_TRIANGLE = 3, - D3D_PRIMITIVE_LINE_ADJ = 6, - D3D_PRIMITIVE_TRIANGLE_ADJ = 7, - D3D_PRIMITIVE_1_CONTROL_POINT_PATCH = 8, - D3D_PRIMITIVE_2_CONTROL_POINT_PATCH = 9, - D3D_PRIMITIVE_3_CONTROL_POINT_PATCH = 10, - D3D_PRIMITIVE_4_CONTROL_POINT_PATCH = 11, - D3D_PRIMITIVE_5_CONTROL_POINT_PATCH = 12, - D3D_PRIMITIVE_6_CONTROL_POINT_PATCH = 13, - D3D_PRIMITIVE_7_CONTROL_POINT_PATCH = 14, - D3D_PRIMITIVE_8_CONTROL_POINT_PATCH = 15, - D3D_PRIMITIVE_9_CONTROL_POINT_PATCH = 16, - D3D_PRIMITIVE_10_CONTROL_POINT_PATCH = 17, - D3D_PRIMITIVE_11_CONTROL_POINT_PATCH = 18, - D3D_PRIMITIVE_12_CONTROL_POINT_PATCH = 19, - D3D_PRIMITIVE_13_CONTROL_POINT_PATCH = 20, - D3D_PRIMITIVE_14_CONTROL_POINT_PATCH = 21, - D3D_PRIMITIVE_15_CONTROL_POINT_PATCH = 22, - D3D_PRIMITIVE_16_CONTROL_POINT_PATCH = 23, - D3D_PRIMITIVE_17_CONTROL_POINT_PATCH = 24, - D3D_PRIMITIVE_18_CONTROL_POINT_PATCH = 25, - D3D_PRIMITIVE_19_CONTROL_POINT_PATCH = 26, - D3D_PRIMITIVE_20_CONTROL_POINT_PATCH = 28, - D3D_PRIMITIVE_21_CONTROL_POINT_PATCH = 29, - D3D_PRIMITIVE_22_CONTROL_POINT_PATCH = 30, - D3D_PRIMITIVE_23_CONTROL_POINT_PATCH = 31, - D3D_PRIMITIVE_24_CONTROL_POINT_PATCH = 32, - D3D_PRIMITIVE_25_CONTROL_POINT_PATCH = 33, - D3D_PRIMITIVE_26_CONTROL_POINT_PATCH = 34, - D3D_PRIMITIVE_27_CONTROL_POINT_PATCH = 35, - D3D_PRIMITIVE_28_CONTROL_POINT_PATCH = 36, - D3D_PRIMITIVE_29_CONTROL_POINT_PATCH = 37, - D3D_PRIMITIVE_30_CONTROL_POINT_PATCH = 38, - D3D_PRIMITIVE_31_CONTROL_POINT_PATCH = 39, - D3D_PRIMITIVE_32_CONTROL_POINT_PATCH = 40, -}} -pub const D3D10_PRIMITIVE_UNDEFINED: ::D3D_PRIMITIVE = D3D_PRIMITIVE_UNDEFINED; -pub const D3D10_PRIMITIVE_POINT: ::D3D_PRIMITIVE = D3D_PRIMITIVE_POINT; -pub const D3D10_PRIMITIVE_LINE: ::D3D_PRIMITIVE = D3D_PRIMITIVE_LINE; -pub const D3D10_PRIMITIVE_TRIANGLE: ::D3D_PRIMITIVE = D3D_PRIMITIVE_TRIANGLE; -pub const D3D10_PRIMITIVE_LINE_ADJ: ::D3D_PRIMITIVE = D3D_PRIMITIVE_LINE_ADJ; -pub const D3D10_PRIMITIVE_TRIANGLE_ADJ: ::D3D_PRIMITIVE = D3D_PRIMITIVE_TRIANGLE_ADJ; -pub const D3D11_PRIMITIVE_UNDEFINED: ::D3D_PRIMITIVE = D3D_PRIMITIVE_UNDEFINED; -pub const D3D11_PRIMITIVE_POINT: ::D3D_PRIMITIVE = D3D_PRIMITIVE_POINT; -pub const D3D11_PRIMITIVE_LINE: ::D3D_PRIMITIVE = D3D_PRIMITIVE_LINE; -pub const D3D11_PRIMITIVE_TRIANGLE: ::D3D_PRIMITIVE = D3D_PRIMITIVE_TRIANGLE; -pub const D3D11_PRIMITIVE_LINE_ADJ: ::D3D_PRIMITIVE = D3D_PRIMITIVE_LINE_ADJ; -pub const D3D11_PRIMITIVE_TRIANGLE_ADJ: ::D3D_PRIMITIVE = D3D_PRIMITIVE_TRIANGLE_ADJ; -pub const D3D11_PRIMITIVE_1_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_1_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_2_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_2_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_3_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_3_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_4_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_4_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_5_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_5_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_6_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_6_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_7_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_7_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_8_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_8_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_9_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_9_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_10_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_10_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_11_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_11_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_12_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_12_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_13_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_13_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_14_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_14_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_15_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_15_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_16_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_16_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_17_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_17_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_18_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_18_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_19_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_19_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_20_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_20_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_21_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_21_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_22_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_22_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_23_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_23_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_24_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_24_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_25_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_25_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_26_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_26_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_27_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_27_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_28_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_28_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_29_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_29_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_30_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_30_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_31_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_31_CONTROL_POINT_PATCH; -pub const D3D11_PRIMITIVE_32_CONTROL_POINT_PATCH: ::D3D_PRIMITIVE = - D3D_PRIMITIVE_32_CONTROL_POINT_PATCH; -ENUM!{enum D3D_SRV_DIMENSION { - D3D_SRV_DIMENSION_UNKNOWN = 0, - D3D_SRV_DIMENSION_BUFFER = 1, - D3D_SRV_DIMENSION_TEXTURE1D = 2, - D3D_SRV_DIMENSION_TEXTURE1DARRAY = 3, - D3D_SRV_DIMENSION_TEXTURE2D = 4, - D3D_SRV_DIMENSION_TEXTURE2DARRAY = 5, - D3D_SRV_DIMENSION_TEXTURE2DMS = 6, - D3D_SRV_DIMENSION_TEXTURE2DMSARRAY = 7, - D3D_SRV_DIMENSION_TEXTURE3D = 8, - D3D_SRV_DIMENSION_TEXTURECUBE = 9, - D3D_SRV_DIMENSION_TEXTURECUBEARRAY = 10, - D3D_SRV_DIMENSION_BUFFEREX = 11, -}} -pub const D3D10_SRV_DIMENSION_UNKNOWN: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_UNKNOWN; -pub const D3D10_SRV_DIMENSION_BUFFER: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_BUFFER; -pub const D3D10_SRV_DIMENSION_TEXTURE1D: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE1D; -pub const D3D10_SRV_DIMENSION_TEXTURE1DARRAY: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE1DARRAY; -pub const D3D10_SRV_DIMENSION_TEXTURE2D: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE2D; -pub const D3D10_SRV_DIMENSION_TEXTURE2DARRAY: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE2DARRAY; -pub const D3D10_SRV_DIMENSION_TEXTURE2DMS: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE2DMS; -pub const D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE2DMSARRAY; -pub const D3D10_SRV_DIMENSION_TEXTURE3D: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE3D; -pub const D3D10_SRV_DIMENSION_TEXTURECUBE: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURECUBE; -pub const D3D10_1_SRV_DIMENSION_UNKNOWN: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_UNKNOWN; -pub const D3D10_1_SRV_DIMENSION_BUFFER: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_BUFFER; -pub const D3D10_1_SRV_DIMENSION_TEXTURE1D: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE1D; -pub const D3D10_1_SRV_DIMENSION_TEXTURE1DARRAY: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE1DARRAY; -pub const D3D10_1_SRV_DIMENSION_TEXTURE2D: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE2D; -pub const D3D10_1_SRV_DIMENSION_TEXTURE2DARRAY: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE2DARRAY; -pub const D3D10_1_SRV_DIMENSION_TEXTURE2DMS: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE2DMS; -pub const D3D10_1_SRV_DIMENSION_TEXTURE2DMSARRAY: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE2DMSARRAY; -pub const D3D10_1_SRV_DIMENSION_TEXTURE3D: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE3D; -pub const D3D10_1_SRV_DIMENSION_TEXTURECUBE: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURECUBE; -pub const D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURECUBEARRAY; -pub const D3D11_SRV_DIMENSION_UNKNOWN: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_UNKNOWN; -pub const D3D11_SRV_DIMENSION_BUFFER: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_BUFFER; -pub const D3D11_SRV_DIMENSION_TEXTURE1D: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE1D; -pub const D3D11_SRV_DIMENSION_TEXTURE1DARRAY: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE1DARRAY; -pub const D3D11_SRV_DIMENSION_TEXTURE2D: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE2D; -pub const D3D11_SRV_DIMENSION_TEXTURE2DARRAY: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE2DARRAY; -pub const D3D11_SRV_DIMENSION_TEXTURE2DMS: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE2DMS; -pub const D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE2DMSARRAY; -pub const D3D11_SRV_DIMENSION_TEXTURE3D: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURE3D; -pub const D3D11_SRV_DIMENSION_TEXTURECUBE: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURECUBE; -pub const D3D11_SRV_DIMENSION_TEXTURECUBEARRAY: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_TEXTURECUBEARRAY; -pub const D3D11_SRV_DIMENSION_BUFFEREX: ::D3D_SRV_DIMENSION = - D3D_SRV_DIMENSION_BUFFEREX; -STRUCT!{struct D3D_SHADER_MACRO { - Name: ::LPCSTR, - Definition: ::LPCSTR, -}} -pub type LPD3D_SHADER_MACRO = *mut D3D_SHADER_MACRO; -RIDL!( -interface ID3D10Blob(ID3D10BlobVtbl): IUnknown(IUnknownVtbl) { - fn GetBufferPointer(&mut self) -> ::LPVOID, - fn GetBufferSize(&mut self) -> ::SIZE_T -} -); -pub type LPD3D10BLOB = *mut ID3D10Blob; -pub type ID3DBlob = ID3D10Blob; -pub type LPD3DBLOB = *mut ID3DBlob; -ENUM!{enum D3D_INCLUDE_TYPE { - D3D_INCLUDE_LOCAL = 0, - D3D_INCLUDE_SYSTEM, -}} -pub const D3D10_INCLUDE_LOCAL: ::D3D_INCLUDE_TYPE = D3D_INCLUDE_LOCAL; -pub const D3D10_INCLUDE_SYSTEM: ::D3D_INCLUDE_TYPE = D3D_INCLUDE_SYSTEM; -RIDL!( -interface ID3DInclude(ID3DIncludeVtbl) { - fn Open( - &mut self, IncludeType: D3D_INCLUDE_TYPE, pFileName: ::LPCSTR, pParentData: ::LPCVOID, - ppData: *mut ::LPCVOID, pBytes: *mut ::UINT - ) -> ::HRESULT, - fn Close(&mut self, pData: ::LPCVOID) -> ::HRESULT -} -); -pub type LPD3DINCLUDE = *mut ID3DInclude; -ENUM!{enum D3D_SHADER_VARIABLE_CLASS { - D3D_SVC_SCALAR = 0, - D3D_SVC_VECTOR, - D3D_SVC_MATRIX_ROWS, - D3D_SVC_MATRIX_COLUMNS, - D3D_SVC_OBJECT, - D3D_SVC_STRUCT, - D3D_SVC_INTERFACE_CLASS, - D3D_SVC_INTERFACE_POINTER, -}} -pub const D3D10_SVC_SCALAR: ::D3D_SHADER_VARIABLE_CLASS = D3D_SVC_SCALAR; -pub const D3D10_SVC_VECTOR: ::D3D_SHADER_VARIABLE_CLASS = D3D_SVC_VECTOR; -pub const D3D10_SVC_MATRIX_ROWS: ::D3D_SHADER_VARIABLE_CLASS = D3D_SVC_MATRIX_ROWS; -pub const D3D10_SVC_MATRIX_COLUMNS: ::D3D_SHADER_VARIABLE_CLASS = D3D_SVC_MATRIX_COLUMNS; -pub const D3D10_SVC_OBJECT: ::D3D_SHADER_VARIABLE_CLASS = D3D_SVC_OBJECT; -pub const D3D10_SVC_STRUCT: ::D3D_SHADER_VARIABLE_CLASS = D3D_SVC_STRUCT; -pub const D3D11_SVC_INTERFACE_CLASS: ::D3D_SHADER_VARIABLE_CLASS = D3D_SVC_INTERFACE_CLASS; -pub const D3D11_SVC_INTERFACE_POINTER: ::D3D_SHADER_VARIABLE_CLASS = D3D_SVC_INTERFACE_POINTER; -FLAGS!{enum D3D_SHADER_VARIABLE_FLAGS { - D3D_SVF_USERPACKED = 1, - D3D_SVF_USED = 2, - D3D_SVF_INTERFACE_POINTER = 4, - D3D_SVF_INTERFACE_PARAMETER = 8, -}} -pub const D3D10_SVF_USERPACKED: ::D3D_SHADER_VARIABLE_FLAGS = D3D_SVF_USERPACKED; -pub const D3D10_SVF_USED: ::D3D_SHADER_VARIABLE_FLAGS = D3D_SVF_USED; -pub const D3D11_SVF_INTERFACE_POINTER: ::D3D_SHADER_VARIABLE_FLAGS = D3D_SVF_INTERFACE_POINTER; -pub const D3D11_SVF_INTERFACE_PARAMETER: ::D3D_SHADER_VARIABLE_FLAGS = D3D_SVF_INTERFACE_PARAMETER; -ENUM!{enum D3D_SHADER_VARIABLE_TYPE { - D3D_SVT_VOID = 0, - D3D_SVT_BOOL = 1, - D3D_SVT_INT = 2, - D3D_SVT_FLOAT = 3, - D3D_SVT_STRING = 4, - D3D_SVT_TEXTURE = 5, - D3D_SVT_TEXTURE1D = 6, - D3D_SVT_TEXTURE2D = 7, - D3D_SVT_TEXTURE3D = 8, - D3D_SVT_TEXTURECUBE = 9, - D3D_SVT_SAMPLER = 10, - D3D_SVT_SAMPLER1D = 11, - D3D_SVT_SAMPLER2D = 12, - D3D_SVT_SAMPLER3D = 13, - D3D_SVT_SAMPLERCUBE = 14, - D3D_SVT_PIXELSHADER = 15, - D3D_SVT_VERTEXSHADER = 16, - D3D_SVT_PIXELFRAGMENT = 17, - D3D_SVT_VERTEXFRAGMENT = 18, - D3D_SVT_UINT = 19, - D3D_SVT_UINT8 = 20, - D3D_SVT_GEOMETRYSHADER = 21, - D3D_SVT_RASTERIZER = 22, - D3D_SVT_DEPTHSTENCIL = 23, - D3D_SVT_BLEND = 24, - D3D_SVT_BUFFER = 25, - D3D_SVT_CBUFFER = 26, - D3D_SVT_TBUFFER = 27, - D3D_SVT_TEXTURE1DARRAY = 28, - D3D_SVT_TEXTURE2DARRAY = 29, - D3D_SVT_RENDERTARGETVIEW = 30, - D3D_SVT_DEPTHSTENCILVIEW = 31, - D3D_SVT_TEXTURE2DMS = 32, - D3D_SVT_TEXTURE2DMSARRAY = 33, - D3D_SVT_TEXTURECUBEARRAY = 34, - D3D_SVT_HULLSHADER = 35, - D3D_SVT_DOMAINSHADER = 36, - D3D_SVT_INTERFACE_POINTER = 37, - D3D_SVT_COMPUTESHADER = 38, - D3D_SVT_DOUBLE = 39, - D3D_SVT_RWTEXTURE1D = 40, - D3D_SVT_RWTEXTURE1DARRAY = 41, - D3D_SVT_RWTEXTURE2D = 42, - D3D_SVT_RWTEXTURE2DARRAY = 43, - D3D_SVT_RWTEXTURE3D = 44, - D3D_SVT_RWBUFFER = 45, - D3D_SVT_BYTEADDRESS_BUFFER = 46, - D3D_SVT_RWBYTEADDRESS_BUFFER = 47, - D3D_SVT_STRUCTURED_BUFFER = 48, - D3D_SVT_RWSTRUCTURED_BUFFER = 49, - D3D_SVT_APPEND_STRUCTURED_BUFFER = 50, - D3D_SVT_CONSUME_STRUCTURED_BUFFER = 51, - D3D_SVT_MIN8FLOAT = 52, - D3D_SVT_MIN10FLOAT = 53, - D3D_SVT_MIN16FLOAT = 54, - D3D_SVT_MIN12INT = 55, - D3D_SVT_MIN16INT = 56, - D3D_SVT_MIN16UINT = 57, -}} -pub const D3D10_SVT_VOID: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_VOID; -pub const D3D10_SVT_BOOL: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_BOOL; -pub const D3D10_SVT_INT: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_INT; -pub const D3D10_SVT_FLOAT: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_FLOAT; -pub const D3D10_SVT_STRING: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_STRING; -pub const D3D10_SVT_TEXTURE: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE; -pub const D3D10_SVT_TEXTURE1D: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE1D; -pub const D3D10_SVT_TEXTURE2D: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE2D; -pub const D3D10_SVT_TEXTURE3D: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE3D; -pub const D3D10_SVT_TEXTURECUBE: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURECUBE; -pub const D3D10_SVT_SAMPLER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_SAMPLER; -pub const D3D10_SVT_SAMPLER1D: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_SAMPLER1D; -pub const D3D10_SVT_SAMPLER2D: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_SAMPLER2D; -pub const D3D10_SVT_SAMPLER3D: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_SAMPLER3D; -pub const D3D10_SVT_SAMPLERCUBE: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_SAMPLERCUBE; -pub const D3D10_SVT_PIXELSHADER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_PIXELSHADER; -pub const D3D10_SVT_VERTEXSHADER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_VERTEXSHADER; -pub const D3D10_SVT_PIXELFRAGMENT: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_PIXELFRAGMENT; -pub const D3D10_SVT_VERTEXFRAGMENT: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_VERTEXFRAGMENT; -pub const D3D10_SVT_UINT: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_UINT; -pub const D3D10_SVT_UINT8: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_UINT8; -pub const D3D10_SVT_GEOMETRYSHADER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_GEOMETRYSHADER; -pub const D3D10_SVT_RASTERIZER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RASTERIZER; -pub const D3D10_SVT_DEPTHSTENCIL: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_DEPTHSTENCIL; -pub const D3D10_SVT_BLEND: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_BLEND; -pub const D3D10_SVT_BUFFER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_BUFFER; -pub const D3D10_SVT_CBUFFER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_CBUFFER; -pub const D3D10_SVT_TBUFFER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TBUFFER; -pub const D3D10_SVT_TEXTURE1DARRAY: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE1DARRAY; -pub const D3D10_SVT_TEXTURE2DARRAY: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE2DARRAY; -pub const D3D10_SVT_RENDERTARGETVIEW: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RENDERTARGETVIEW; -pub const D3D10_SVT_DEPTHSTENCILVIEW: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_DEPTHSTENCILVIEW; -pub const D3D10_SVT_TEXTURE2DMS: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE2DMS; -pub const D3D10_SVT_TEXTURE2DMSARRAY: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURE2DMSARRAY; -pub const D3D10_SVT_TEXTURECUBEARRAY: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_TEXTURECUBEARRAY; -pub const D3D11_SVT_HULLSHADER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_HULLSHADER; -pub const D3D11_SVT_DOMAINSHADER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_DOMAINSHADER; -pub const D3D11_SVT_INTERFACE_POINTER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_INTERFACE_POINTER; -pub const D3D11_SVT_COMPUTESHADER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_COMPUTESHADER; -pub const D3D11_SVT_DOUBLE: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_DOUBLE; -pub const D3D11_SVT_RWTEXTURE1D: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWTEXTURE1D; -pub const D3D11_SVT_RWTEXTURE1DARRAY: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWTEXTURE1DARRAY; -pub const D3D11_SVT_RWTEXTURE2D: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWTEXTURE2D; -pub const D3D11_SVT_RWTEXTURE2DARRAY: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWTEXTURE2DARRAY; -pub const D3D11_SVT_RWTEXTURE3D: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWTEXTURE3D; -pub const D3D11_SVT_RWBUFFER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_RWBUFFER; -pub const D3D11_SVT_BYTEADDRESS_BUFFER: ::D3D_SHADER_VARIABLE_TYPE = D3D_SVT_BYTEADDRESS_BUFFER; -pub const D3D11_SVT_RWBYTEADDRESS_BUFFER: ::D3D_SHADER_VARIABLE_TYPE = - D3D_SVT_RWBYTEADDRESS_BUFFER; -pub const D3D11_SVT_STRUCTURED_BUFFER: ::D3D_SHADER_VARIABLE_TYPE = - D3D_SVT_STRUCTURED_BUFFER; -pub const D3D11_SVT_RWSTRUCTURED_BUFFER: ::D3D_SHADER_VARIABLE_TYPE = - D3D_SVT_RWSTRUCTURED_BUFFER; -pub const D3D11_SVT_APPEND_STRUCTURED_BUFFER: ::D3D_SHADER_VARIABLE_TYPE = - D3D_SVT_APPEND_STRUCTURED_BUFFER; -pub const D3D11_SVT_CONSUME_STRUCTURED_BUFFER: ::D3D_SHADER_VARIABLE_TYPE = - D3D_SVT_CONSUME_STRUCTURED_BUFFER; -FLAGS!{enum D3D_SHADER_INPUT_FLAGS { - D3D_SIF_USERPACKED = 0x1, - D3D_SIF_COMPARISON_SAMPLER = 0x2, - D3D_SIF_TEXTURE_COMPONENT_0 = 0x4, - D3D_SIF_TEXTURE_COMPONENT_1 = 0x8, - D3D_SIF_TEXTURE_COMPONENTS = 0xc, - D3D_SIF_UNUSED = 0x10, -}} -pub const D3D10_SIF_USERPACKED: ::D3D_SHADER_INPUT_FLAGS = D3D_SIF_USERPACKED; -pub const D3D10_SIF_COMPARISON_SAMPLER: ::D3D_SHADER_INPUT_FLAGS = D3D_SIF_COMPARISON_SAMPLER; -pub const D3D10_SIF_TEXTURE_COMPONENT_0: ::D3D_SHADER_INPUT_FLAGS = D3D_SIF_TEXTURE_COMPONENT_0; -pub const D3D10_SIF_TEXTURE_COMPONENT_1: ::D3D_SHADER_INPUT_FLAGS = D3D_SIF_TEXTURE_COMPONENT_1; -pub const D3D10_SIF_TEXTURE_COMPONENTS: ::D3D_SHADER_INPUT_FLAGS = D3D_SIF_TEXTURE_COMPONENTS; -ENUM!{enum D3D_SHADER_INPUT_TYPE { - D3D_SIT_CBUFFER, - D3D_SIT_TBUFFER, - D3D_SIT_TEXTURE, - D3D_SIT_SAMPLER, - D3D_SIT_UAV_RWTYPED, - D3D_SIT_STRUCTURED, - D3D_SIT_UAV_RWSTRUCTURED, - D3D_SIT_BYTEADDRESS, - D3D_SIT_UAV_RWBYTEADDRESS, - D3D_SIT_UAV_APPEND_STRUCTURED, - D3D_SIT_UAV_CONSUME_STRUCTURED, - D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER, -}} -pub const D3D10_SIT_CBUFFER: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_CBUFFER; -pub const D3D10_SIT_TBUFFER: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_TBUFFER; -pub const D3D10_SIT_TEXTURE: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_TEXTURE; -pub const D3D10_SIT_SAMPLER: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_SAMPLER; -pub const D3D11_SIT_UAV_RWTYPED: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_UAV_RWTYPED; -pub const D3D11_SIT_STRUCTURED: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_STRUCTURED; -pub const D3D11_SIT_UAV_RWSTRUCTURED: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_UAV_RWSTRUCTURED; -pub const D3D11_SIT_BYTEADDRESS: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_BYTEADDRESS; -pub const D3D11_SIT_UAV_RWBYTEADDRESS: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_UAV_RWBYTEADDRESS; -pub const D3D11_SIT_UAV_APPEND_STRUCTURED: ::D3D_SHADER_INPUT_TYPE = D3D_SIT_UAV_APPEND_STRUCTURED; -pub const D3D11_SIT_UAV_CONSUME_STRUCTURED: ::D3D_SHADER_INPUT_TYPE = - D3D_SIT_UAV_CONSUME_STRUCTURED; -pub const D3D11_SIT_UAV_RWSTRUCTURED_WITH_COUNTER: ::D3D_SHADER_INPUT_TYPE = - D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER; -FLAGS!{enum D3D_SHADER_CBUFFER_FLAGS { - D3D_CBF_USERPACKED = 1, -}} -pub const D3D10_CBF_USERPACKED: ::D3D_SHADER_CBUFFER_FLAGS = D3D_CBF_USERPACKED; -ENUM!{enum D3D_CBUFFER_TYPE { - D3D_CT_CBUFFER, - D3D_CT_TBUFFER, - D3D_CT_INTERFACE_POINTERS, - D3D_CT_RESOURCE_BIND_INFO, -}} -pub const D3D10_CT_CBUFFER: ::D3D_CBUFFER_TYPE = D3D_CT_CBUFFER; -pub const D3D10_CT_TBUFFER: ::D3D_CBUFFER_TYPE = D3D_CT_TBUFFER; -pub const D3D11_CT_CBUFFER: ::D3D_CBUFFER_TYPE = D3D_CT_CBUFFER; -pub const D3D11_CT_TBUFFER: ::D3D_CBUFFER_TYPE = D3D_CT_TBUFFER; -pub const D3D11_CT_INTERFACE_POINTERS: ::D3D_CBUFFER_TYPE = D3D_CT_INTERFACE_POINTERS; -pub const D3D11_CT_RESOURCE_BIND_INFO: ::D3D_CBUFFER_TYPE = D3D_CT_RESOURCE_BIND_INFO; -ENUM!{enum D3D_NAME { - D3D_NAME_UNDEFINED = 0, - D3D_NAME_POSITION = 1, - D3D_NAME_CLIP_DISTANCE = 2, - D3D_NAME_CULL_DISTANCE = 3, - D3D_NAME_RENDER_TARGET_ARRAY_INDEX = 4, - D3D_NAME_VIEWPORT_ARRAY_INDEX = 5, - D3D_NAME_VERTEX_ID = 6, - D3D_NAME_PRIMITIVE_ID = 7, - D3D_NAME_INSTANCE_ID = 8, - D3D_NAME_IS_FRONT_FACE = 9, - D3D_NAME_SAMPLE_INDEX = 10, - D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR = 11, - D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = 12, - D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR = 13, - D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR = 14, - D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR = 15, - D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR = 16, - D3D_NAME_TARGET = 64, - D3D_NAME_DEPTH = 65, - D3D_NAME_COVERAGE = 66, - D3D_NAME_DEPTH_GREATER_EQUAL = 67, - D3D_NAME_DEPTH_LESS_EQUAL = 68, -}} -pub const D3D10_NAME_UNDEFINED: D3D_NAME = D3D_NAME_UNDEFINED; -pub const D3D10_NAME_POSITION: D3D_NAME = D3D_NAME_POSITION; -pub const D3D10_NAME_CLIP_DISTANCE: D3D_NAME = D3D_NAME_CLIP_DISTANCE; -pub const D3D10_NAME_CULL_DISTANCE: D3D_NAME = D3D_NAME_CULL_DISTANCE; -pub const D3D10_NAME_RENDER_TARGET_ARRAY_INDEX: D3D_NAME = D3D_NAME_RENDER_TARGET_ARRAY_INDEX; -pub const D3D10_NAME_VIEWPORT_ARRAY_INDEX: D3D_NAME = D3D_NAME_VIEWPORT_ARRAY_INDEX; -pub const D3D10_NAME_VERTEX_ID: D3D_NAME = D3D_NAME_VERTEX_ID; -pub const D3D10_NAME_PRIMITIVE_ID: D3D_NAME = D3D_NAME_PRIMITIVE_ID; -pub const D3D10_NAME_INSTANCE_ID: D3D_NAME = D3D_NAME_INSTANCE_ID; -pub const D3D10_NAME_IS_FRONT_FACE: D3D_NAME = D3D_NAME_IS_FRONT_FACE; -pub const D3D10_NAME_SAMPLE_INDEX: D3D_NAME = D3D_NAME_SAMPLE_INDEX; -pub const D3D10_NAME_TARGET: D3D_NAME = D3D_NAME_TARGET; -pub const D3D10_NAME_DEPTH: D3D_NAME = D3D_NAME_DEPTH; -pub const D3D10_NAME_COVERAGE: D3D_NAME = D3D_NAME_COVERAGE; -pub const D3D11_NAME_FINAL_QUAD_EDGE_TESSFACTOR: D3D_NAME = D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR; -pub const D3D11_NAME_FINAL_QUAD_INSIDE_TESSFACTOR: D3D_NAME = D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR; -pub const D3D11_NAME_FINAL_TRI_EDGE_TESSFACTOR: D3D_NAME = D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR; -pub const D3D11_NAME_FINAL_TRI_INSIDE_TESSFACTOR: D3D_NAME = D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR; -pub const D3D11_NAME_FINAL_LINE_DETAIL_TESSFACTOR: D3D_NAME = D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR; -pub const D3D11_NAME_FINAL_LINE_DENSITY_TESSFACTOR: D3D_NAME = D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR; -pub const D3D11_NAME_DEPTH_GREATER_EQUAL: D3D_NAME = D3D_NAME_DEPTH_GREATER_EQUAL; -pub const D3D11_NAME_DEPTH_LESS_EQUAL: D3D_NAME = D3D_NAME_DEPTH_LESS_EQUAL; -ENUM!{enum D3D_RESOURCE_RETURN_TYPE { - D3D_RETURN_TYPE_UNORM = 1, - D3D_RETURN_TYPE_SNORM = 2, - D3D_RETURN_TYPE_SINT = 3, - D3D_RETURN_TYPE_UINT = 4, - D3D_RETURN_TYPE_FLOAT = 5, - D3D_RETURN_TYPE_MIXED = 6, - D3D_RETURN_TYPE_DOUBLE = 7, - D3D_RETURN_TYPE_CONTINUED = 8, -}} -pub const D3D10_RETURN_TYPE_UNORM: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_UNORM; -pub const D3D10_RETURN_TYPE_SNORM: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_SNORM; -pub const D3D10_RETURN_TYPE_SINT: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_SINT; -pub const D3D10_RETURN_TYPE_UINT: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_UINT; -pub const D3D10_RETURN_TYPE_FLOAT: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_FLOAT; -pub const D3D10_RETURN_TYPE_MIXED: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_MIXED; -pub const D3D11_RETURN_TYPE_UNORM: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_UNORM; -pub const D3D11_RETURN_TYPE_SNORM: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_SNORM; -pub const D3D11_RETURN_TYPE_SINT: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_SINT; -pub const D3D11_RETURN_TYPE_UINT: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_UINT; -pub const D3D11_RETURN_TYPE_FLOAT: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_FLOAT; -pub const D3D11_RETURN_TYPE_MIXED: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_MIXED; -pub const D3D11_RETURN_TYPE_DOUBLE: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_DOUBLE; -pub const D3D11_RETURN_TYPE_CONTINUED: ::D3D_RESOURCE_RETURN_TYPE = D3D_RETURN_TYPE_CONTINUED; -ENUM!{enum D3D_REGISTER_COMPONENT_TYPE { - D3D_REGISTER_COMPONENT_UNKNOWN = 0, - D3D_REGISTER_COMPONENT_UINT32 = 1, - D3D_REGISTER_COMPONENT_SINT32 = 2, - D3D_REGISTER_COMPONENT_FLOAT32 = 3, -}} -pub const D3D10_REGISTER_COMPONENT_UNKNOWN: ::D3D_REGISTER_COMPONENT_TYPE = - D3D_REGISTER_COMPONENT_UNKNOWN; -pub const D3D10_REGISTER_COMPONENT_UINT32: ::D3D_REGISTER_COMPONENT_TYPE = - D3D_REGISTER_COMPONENT_UINT32; -pub const D3D10_REGISTER_COMPONENT_SINT32: ::D3D_REGISTER_COMPONENT_TYPE = - D3D_REGISTER_COMPONENT_SINT32; -pub const D3D10_REGISTER_COMPONENT_FLOAT32: ::D3D_REGISTER_COMPONENT_TYPE = - D3D_REGISTER_COMPONENT_FLOAT32; -ENUM!{enum D3D_TESSELLATOR_DOMAIN { - D3D_TESSELLATOR_DOMAIN_UNDEFINED, - D3D_TESSELLATOR_DOMAIN_ISOLINE, - D3D_TESSELLATOR_DOMAIN_TRI, - D3D_TESSELLATOR_DOMAIN_QUAD, -}} -pub const D3D11_TESSELLATOR_DOMAIN_UNDEFINED: ::D3D_TESSELLATOR_DOMAIN = - D3D_TESSELLATOR_DOMAIN_UNDEFINED; -pub const D3D11_TESSELLATOR_DOMAIN_ISOLINE: ::D3D_TESSELLATOR_DOMAIN = - D3D_TESSELLATOR_DOMAIN_ISOLINE; -pub const D3D11_TESSELLATOR_DOMAIN_TRI: ::D3D_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN_TRI; -pub const D3D11_TESSELLATOR_DOMAIN_QUAD: ::D3D_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN_QUAD; -ENUM!{enum D3D_TESSELLATOR_PARTITIONING { - D3D_TESSELLATOR_PARTITIONING_UNDEFINED, - D3D_TESSELLATOR_PARTITIONING_INTEGER, - D3D_TESSELLATOR_PARTITIONING_POW2, - D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD, - D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN, -}} -pub const D3D11_TESSELLATOR_PARTITIONING_UNDEFINED: ::D3D_TESSELLATOR_PARTITIONING = - D3D_TESSELLATOR_PARTITIONING_UNDEFINED; -pub const D3D11_TESSELLATOR_PARTITIONING_INTEGER: ::D3D_TESSELLATOR_PARTITIONING = - D3D_TESSELLATOR_PARTITIONING_INTEGER; -pub const D3D11_TESSELLATOR_PARTITIONING_POW2: ::D3D_TESSELLATOR_PARTITIONING = - D3D_TESSELLATOR_PARTITIONING_POW2; -pub const D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD: ::D3D_TESSELLATOR_PARTITIONING = - D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD; -pub const D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN: ::D3D_TESSELLATOR_PARTITIONING = - D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN; -ENUM!{enum D3D_TESSELLATOR_OUTPUT_PRIMITIVE { - D3D_TESSELLATOR_OUTPUT_UNDEFINED, - D3D_TESSELLATOR_OUTPUT_POINT, - D3D_TESSELLATOR_OUTPUT_LINE, - D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW, - D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW, -}} -pub const D3D11_TESSELLATOR_OUTPUT_UNDEFINED: ::D3D_TESSELLATOR_OUTPUT_PRIMITIVE = - D3D_TESSELLATOR_OUTPUT_UNDEFINED; -pub const D3D11_TESSELLATOR_OUTPUT_POINT: ::D3D_TESSELLATOR_OUTPUT_PRIMITIVE = - D3D_TESSELLATOR_OUTPUT_POINT; -pub const D3D11_TESSELLATOR_OUTPUT_LINE: ::D3D_TESSELLATOR_OUTPUT_PRIMITIVE = - D3D_TESSELLATOR_OUTPUT_LINE; -pub const D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW: ::D3D_TESSELLATOR_OUTPUT_PRIMITIVE = - D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW; -pub const D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW: ::D3D_TESSELLATOR_OUTPUT_PRIMITIVE = - D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW; -ENUM!{enum D3D_MIN_PRECISION { - D3D_MIN_PRECISION_DEFAULT, - D3D_MIN_PRECISION_FLOAT_16, - D3D_MIN_PRECISION_FLOAT_2_8, - D3D_MIN_PRECISION_RESERVED, - D3D_MIN_PRECISION_SINT_16, - D3D_MIN_PRECISION_UINT_16, - D3D_MIN_PRECISION_ANY_16 = 0xf0, - D3D_MIN_PRECISION_ANY_10 = 0xf1, -}} -ENUM!{enum D3D_INTERPOLATION_MODE { - D3D_INTERPOLATION_UNDEFINED, - D3D_INTERPOLATION_CONSTANT, - D3D_INTERPOLATION_LINEAR, - D3D_INTERPOLATION_LINEAR_CENTROID, - D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE, - D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID, - D3D_INTERPOLATION_LINEAR_SAMPLE, - D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE, -}} -FLAGS!{enum D3D_PARAMETER_FLAGS { - D3D_PF_NONE = 0, - D3D_PF_IN = 0x1, - D3D_PF_OUT = 0x2, -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/d3dcompiler.rs cargo-0.37.0/vendor/winapi-0.2.8/src/d3dcompiler.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/d3dcompiler.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/d3dcompiler.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -// Copyright © 2016, Peter Atashian -// Licensed under the MIT License -use super::*; -pub const D3DCOMPILER_DLL: &'static str = "d3dcompiler_47.dll"; -pub const D3D_COMPILER_VERSION: DWORD = 47; -pub const D3DCOMPILE_DEBUG: DWORD = 1 << 0; -pub const D3DCOMPILE_SKIP_VALIDATION: DWORD = 1 << 1; -pub const D3DCOMPILE_SKIP_OPTIMIZATION: DWORD = 1 << 2; -pub const D3DCOMPILE_PACK_MATRIX_ROW_MAJOR: DWORD = 1 << 3; -pub const D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR: DWORD = 1 << 4; -pub const D3DCOMPILE_PARTIAL_PRECISION: DWORD = 1 << 5; -pub const D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT: DWORD = 1 << 6; -pub const D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT: DWORD = 1 << 7; -pub const D3DCOMPILE_NO_PRESHADER: DWORD = 1 << 8; -pub const D3DCOMPILE_AVOID_FLOW_CONTROL: DWORD = 1 << 9; -pub const D3DCOMPILE_PREFER_FLOW_CONTROL: DWORD = 1 << 10; -pub const D3DCOMPILE_ENABLE_STRICTNESS: DWORD = 1 << 11; -pub const D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY: DWORD = 1 << 12; -pub const D3DCOMPILE_IEEE_STRICTNESS: DWORD = 1 << 13; -pub const D3DCOMPILE_OPTIMIZATION_LEVEL0: DWORD = 1 << 14; -pub const D3DCOMPILE_OPTIMIZATION_LEVEL1: DWORD = 0; -pub const D3DCOMPILE_OPTIMIZATION_LEVEL2: DWORD = (1 << 14) | (1 << 15); -pub const D3DCOMPILE_OPTIMIZATION_LEVEL3: DWORD = 1 << 15; -pub const D3DCOMPILE_RESERVED16: DWORD = 1 << 16; -pub const D3DCOMPILE_RESERVED17: DWORD = 1 << 17; -pub const D3DCOMPILE_WARNINGS_ARE_ERRORS: DWORD = 1 << 18; -pub const D3DCOMPILE_RESOURCES_MAY_ALIAS: DWORD = 1 << 19; -pub const D3DCOMPILE_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES: DWORD = 1 << 20; -pub const D3DCOMPILE_ALL_RESOURCES_BOUND: DWORD = 1 << 21; -pub const D3DCOMPILE_EFFECT_CHILD_EFFECT: DWORD = 1 << 0; -pub const D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS: DWORD = 1 << 1; -pub const D3D_COMPILE_STANDARD_FILE_INCLUDE: *mut ID3DInclude = 1 as *mut ID3DInclude; -pub const D3DCOMPILE_SECDATA_MERGE_UAV_SLOTS: DWORD = 0x00000001; -pub const D3DCOMPILE_SECDATA_PRESERVE_TEMPLATE_SLOTS: DWORD = 0x00000002; -pub const D3DCOMPILE_SECDATA_REQUIRE_TEMPLATE_MATCH: DWORD = 0x00000004; -pub const D3D_DISASM_ENABLE_COLOR_CODE: DWORD = 0x00000001; -pub const D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS: DWORD = 0x00000002; -pub const D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING: DWORD = 0x00000004; -pub const D3D_DISASM_ENABLE_INSTRUCTION_CYCLE: DWORD = 0x00000008; -pub const D3D_DISASM_DISABLE_DEBUG_INFO: DWORD = 0x00000010; -pub const D3D_DISASM_ENABLE_INSTRUCTION_OFFSET: DWORD = 0x00000020; -pub const D3D_DISASM_INSTRUCTION_ONLY: DWORD = 0x00000040; -pub const D3D_DISASM_PRINT_HEX_LITERALS: DWORD = 0x00000080; -pub const D3D_GET_INST_OFFSETS_INCLUDE_NON_EXECUTABLE: DWORD = 0x00000001; -FLAGS!{enum D3DCOMPILER_STRIP_FLAGS { - D3DCOMPILER_STRIP_REFLECTION_DATA = 0x00000001, - D3DCOMPILER_STRIP_DEBUG_INFO = 0x00000002, - D3DCOMPILER_STRIP_TEST_BLOBS = 0x00000004, - D3DCOMPILER_STRIP_PRIVATE_DATA = 0x00000008, - D3DCOMPILER_STRIP_ROOT_SIGNATURE = 0x00000010, - D3DCOMPILER_STRIP_FORCE_DWORD = 0x7fffffff, -}} -ENUM!{enum D3D_BLOB_PART { - D3D_BLOB_INPUT_SIGNATURE_BLOB, - D3D_BLOB_OUTPUT_SIGNATURE_BLOB, - D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB, - D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB, - D3D_BLOB_ALL_SIGNATURE_BLOB, - D3D_BLOB_DEBUG_INFO, - D3D_BLOB_LEGACY_SHADER, - D3D_BLOB_XNA_PREPASS_SHADER, - D3D_BLOB_XNA_SHADER, - D3D_BLOB_PDB, - D3D_BLOB_PRIVATE_DATA, - D3D_BLOB_ROOT_SIGNATURE, - D3D_BLOB_TEST_ALTERNATE_SHADER = 0x8000, - D3D_BLOB_TEST_COMPILE_DETAILS, - D3D_BLOB_TEST_COMPILE_PERF, - D3D_BLOB_TEST_COMPILE_REPORT, -}} -STRUCT!{struct D3D_SHADER_DATA { - pBytecode: LPCVOID, - BytecodeLength: SIZE_T, -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/dbghelp.rs cargo-0.37.0/vendor/winapi-0.2.8/src/dbghelp.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/dbghelp.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/dbghelp.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,340 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! DbgHelp include file -#[cfg(target_arch = "x86_64")] -STRUCT!{struct LOADED_IMAGE { - ModuleName: ::PSTR, - hFile: ::HANDLE, - MappedAddress: ::PUCHAR, - FileHeader: ::PIMAGE_NT_HEADERS64, - LastRvaSection: ::PIMAGE_SECTION_HEADER, - NumberOfSections: ::ULONG, - Sections: ::PIMAGE_SECTION_HEADER, - Characteristics: ::ULONG, - fSystemImage: ::BOOLEAN, - fDOSImage: ::BOOLEAN, - fReadOnly: ::BOOLEAN, - Version: ::UCHAR, - Links: ::LIST_ENTRY, - SizeOfImage: ::ULONG, -}} -#[cfg(target_arch = "x86")] -STRUCT!{struct LOADED_IMAGE { - ModuleName: ::PSTR, - hFile: ::HANDLE, - MappedAddress: ::PUCHAR, - FileHeader: ::PIMAGE_NT_HEADERS32, - LastRvaSection: ::PIMAGE_SECTION_HEADER, - NumberOfSections: ::ULONG, - Sections: ::PIMAGE_SECTION_HEADER, - Characteristics: ::ULONG, - fSystemImage: ::BOOLEAN, - fDOSImage: ::BOOLEAN, - fReadOnly: ::BOOLEAN, - Version: ::UCHAR, - Links: ::LIST_ENTRY, - SizeOfImage: ::ULONG, -}} -pub const MAX_SYM_NAME: usize = 2000; -pub const ERROR_IMAGE_NOT_STRIPPED: ::DWORD = 0x8800; -pub const ERROR_NO_DBG_POINTER: ::DWORD = 0x8801; -pub const ERROR_NO_PDB_POINTER: ::DWORD = 0x8802; -pub type PFIND_DEBUG_FILE_CALLBACK = Option ::BOOL>; -pub type PFIND_DEBUG_FILE_CALLBACKW = Option ::BOOL>; -pub type PFINDFILEINPATHCALLBACK = Option ::BOOL>; -pub type PFINDFILEINPATHCALLBACKW = Option ::BOOL>; -pub type PFIND_EXE_FILE_CALLBACK = Option ::BOOL>; -pub type PFIND_EXE_FILE_CALLBACKW = Option ::BOOL>; -#[cfg(target_arch = "x86")] -STRUCT!{struct IMAGE_DEBUG_INFORMATION { - List: ::LIST_ENTRY, - ReservedSize: ::DWORD, - ReservedMappedBase: ::PVOID, - ReservedMachine: ::USHORT, - ReservedCharacteristics: ::USHORT, - ReservedCheckSum: ::DWORD, - ImageBase: ::DWORD, - SizeOfImage: ::DWORD, - ReservedNumberOfSections: ::DWORD, - ReservedSections: ::PIMAGE_SECTION_HEADER, - ReservedExportedNamesSize: ::DWORD, - ReservedExportedNames: ::PSTR, - ReservedNumberOfFunctionTableEntries: ::DWORD, - ReservedFunctionTableEntries: ::PIMAGE_FUNCTION_ENTRY, - ReservedLowestFunctionStartingAddress: ::DWORD, - ReservedHighestFunctionEndingAddress: ::DWORD, - ReservedNumberOfFpoTableEntries: ::DWORD, - ReservedFpoTableEntries: ::PFPO_DATA, - SizeOfCoffSymbols: ::DWORD, - CoffSymbols: ::PIMAGE_COFF_SYMBOLS_HEADER, - ReservedSizeOfCodeViewSymbols: ::DWORD, - ReservedCodeViewSymbols: ::PVOID, - ImageFilePath: ::PSTR, - ImageFileName: ::PSTR, - ReservedDebugFilePath: ::PSTR, - ReservedTimeDateStamp: ::DWORD, - ReservedRomImage: ::BOOL, - ReservedDebugDirectory: ::PIMAGE_DEBUG_DIRECTORY, - ReservedNumberOfDebugDirectories: ::DWORD, - ReservedOriginalFunctionTableBaseAddress: ::DWORD, - Reserved: [::DWORD; 2], -}} -#[cfg(target_arch = "x86")] -pub type PIMAGE_DEBUG_INFORMATION = *mut IMAGE_DEBUG_INFORMATION; -pub type PENUMDIRTREE_CALLBACK = Option ::BOOL>; -pub type PENUMDIRTREE_CALLBACKW = Option ::BOOL>; -pub const UNDNAME_COMPLETE: ::DWORD = 0x0000; -pub const UNDNAME_NO_LEADING_UNDERSCORES: ::DWORD = 0x0001; -pub const UNDNAME_NO_MS_KEYWORDS: ::DWORD = 0x0002; -pub const UNDNAME_NO_FUNCTION_RETURNS: ::DWORD = 0x0004; -pub const UNDNAME_NO_ALLOCATION_MODEL: ::DWORD = 0x0008; -pub const UNDNAME_NO_ALLOCATION_LANGUAGE: ::DWORD = 0x0010; -pub const UNDNAME_NO_MS_THISTYPE: ::DWORD = 0x0020; -pub const UNDNAME_NO_CV_THISTYPE: ::DWORD = 0x0040; -pub const UNDNAME_NO_THISTYPE: ::DWORD = 0x0060; -pub const UNDNAME_NO_ACCESS_SPECIFIERS: ::DWORD = 0x0080; -pub const UNDNAME_NO_THROW_SIGNATURES: ::DWORD = 0x0100; -pub const UNDNAME_NO_MEMBER_TYPE: ::DWORD = 0x0200; -pub const UNDNAME_NO_RETURN_UDT_MODEL: ::DWORD = 0x0400; -pub const UNDNAME_32_BIT_DECODE: ::DWORD = 0x0800; -pub const UNDNAME_NAME_ONLY: ::DWORD = 0x1000; -pub const UNDNAME_NO_ARGUMENTS: ::DWORD = 0x2000; -pub const UNDNAME_NO_SPECIAL_SYMS: ::DWORD = 0x4000; -pub const DBHHEADER_DEBUGDIRS: ::DWORD = 0x1; -pub const DBHHEADER_CVMISC: ::DWORD = 0x2; -pub const DBHHEADER_PDBGUID: ::DWORD = 0x3; -STRUCT!{struct MODLOAD_DATA { - ssize: ::DWORD, - ssig: ::DWORD, - data: ::PVOID, - size: ::DWORD, - flags: ::DWORD, -}} -pub type PMODLOAD_DATA = *mut MODLOAD_DATA; -STRUCT!{struct MODLOAD_CVMISC { - oCV: ::DWORD, - cCV: ::size_t, - oMisc: ::DWORD, - cMisc: ::size_t, - dtImage: ::DWORD, - cImage: ::DWORD, -}} -pub type PMODLOAD_CVMISC = *mut MODLOAD_CVMISC; -STRUCT!{struct MODLOAD_PDBGUID_PDBAGE { - PdbGuid: ::GUID, - PdbAge: ::DWORD, -}} -pub type PMODLOAD_PDBGUID_PDBAGE = *mut MODLOAD_PDBGUID_PDBAGE; -ENUM!{enum ADDRESS_MODE { - AddrMode1616, - AddrMode1632, - AddrModeReal, - AddrModeFlat, -}} -STRUCT!{struct ADDRESS64 { - Offset: ::DWORD64, - Segment: ::WORD, - Mode: ::ADDRESS_MODE, -}} -pub type LPADDRESS64 = *mut ADDRESS64; -#[cfg(target_arch = "x86_64")] -pub type ADDRESS = ADDRESS64; -#[cfg(target_arch = "x86_64")] -pub type LPADDRESS = LPADDRESS64; -#[cfg(target_arch = "x86")] -STRUCT!{struct ADDRESS { - Offset: ::DWORD, - Segment: ::WORD, - Mode: ::ADDRESS_MODE, -}} -#[cfg(target_arch = "x86")] -pub type LPADDRESS = *mut ADDRESS; -STRUCT!{struct KDHELP64 { - Thread: ::DWORD64, - ThCallbackStack: ::DWORD, - ThCallbackBStore: ::DWORD, - NextCallback: ::DWORD, - FramePointer: ::DWORD, - KiCallUserMode: ::DWORD64, - KeUserCallbackDispatcher: ::DWORD64, - SystemRangeStart: ::DWORD64, - KiUserExceptionDispatcher: ::DWORD64, - StackBase: ::DWORD64, - StackLimit: ::DWORD64, - BuildVersion: ::DWORD, - Reserved0: ::DWORD, - Reserved1: [::DWORD64; 4], -}} -pub type PKDHELP64 = *mut KDHELP64; -#[cfg(target_arch = "x86_64")] -pub type KDHELP = KDHELP64; -#[cfg(target_arch = "x86_64")] -pub type PKDHELP = PKDHELP64; -#[cfg(target_arch = "x86")] -STRUCT!{struct KDHELP { - Thread: ::DWORD, - ThCallbackStack: ::DWORD, - NextCallback: ::DWORD, - FramePointer: ::DWORD, - KiCallUserMode: ::DWORD, - KeUserCallbackDispatcher: ::DWORD, - SystemRangeStart: ::DWORD, - ThCallbackBStore: ::DWORD, - KiUserExceptionDispatcher: ::DWORD, - StackBase: ::DWORD, - StackLimit: ::DWORD, - Reserved: [::DWORD; 5], -}} -#[cfg(target_arch = "x86")] -pub type PKDHELP = *mut KDHELP; -STRUCT!{struct STACKFRAME64 { - AddrPC: ::ADDRESS64, - AddrReturn: ::ADDRESS64, - AddrFrame: ::ADDRESS64, - AddrStack: ::ADDRESS64, - AddrBStore: ::ADDRESS64, - FuncTableEntry: ::PVOID, - Params: [::DWORD64; 4], - Far: ::BOOL, - Virtual: ::BOOL, - Reserved: [::DWORD64; 3], - KdHelp: ::KDHELP64, -}} -pub type LPSTACKFRAME64 = *mut STACKFRAME64; -pub const INLINE_FRAME_CONTEXT_INIT: ::DWORD = 0; -pub const INLINE_FRAME_CONTEXT_IGNORE: ::DWORD = 0xFFFFFFFF; -STRUCT!{struct STACKFRAME_EX { - AddrPC: ::ADDRESS64, - AddrReturn: ::ADDRESS64, - AddrFrame: ::ADDRESS64, - AddrStack: ::ADDRESS64, - AddrBStore: ::ADDRESS64, - FuncTableEntry: ::PVOID, - Params: [::DWORD64; 4], - Far: ::BOOL, - Virtual: ::BOOL, - Reserved: [::DWORD64; 3], - KdHelp: ::KDHELP64, - StackFrameSize: ::DWORD, - InlineFrameContext: ::DWORD, -}} -pub type LPSTACKFRAME_EX = *mut STACKFRAME_EX; -#[cfg(target_arch = "x86_64")] -pub type STACKFRAME = STACKFRAME64; -#[cfg(target_arch = "x86_64")] -pub type LPSTACKFRAME = LPSTACKFRAME64; -#[cfg(target_arch = "x86")] -STRUCT!{struct STACKFRAME { - AddrPC: ::ADDRESS, - AddrReturn: ::ADDRESS, - AddrFrame: ::ADDRESS, - AddrStack: ::ADDRESS, - FuncTableEntry: ::PVOID, - Params: [::DWORD; 4], - Far: ::BOOL, - Virtual: ::BOOL, - Reserved: [::DWORD; 3], - KdHelp: ::KDHELP, - AddrBStore: ::ADDRESS, -}} -#[cfg(target_arch = "x86")] -pub type LPSTACKFRAME = *mut STACKFRAME; -pub type PREAD_PROCESS_MEMORY_ROUTINE64 = Option ::BOOL>; -pub type PFUNCTION_TABLE_ACCESS_ROUTINE64 = Option ::PVOID>; -pub type PGET_MODULE_BASE_ROUTINE64 = Option ::DWORD64>; -pub type PTRANSLATE_ADDRESS_ROUTINE64 = Option ::DWORD64>; -pub const SYM_STKWALK_DEFAULT: ::DWORD = 0x00000000; -pub const SYM_STKWALK_FORCE_FRAMEPTR: ::DWORD = 0x00000001; -#[cfg(target_arch = "x86_64")] -pub type PREAD_PROCESS_MEMORY_ROUTINE = PREAD_PROCESS_MEMORY_ROUTINE64; -#[cfg(target_arch = "x86_64")] -pub type PFUNCTION_TABLE_ACCESS_ROUTINE = PFUNCTION_TABLE_ACCESS_ROUTINE64; -#[cfg(target_arch = "x86_64")] -pub type PGET_MODULE_BASE_ROUTINE = PGET_MODULE_BASE_ROUTINE64; -#[cfg(target_arch = "x86_64")] -pub type PTRANSLATE_ADDRESS_ROUTINE = PTRANSLATE_ADDRESS_ROUTINE64; -#[cfg(target_arch = "x86")] -pub type PREAD_PROCESS_MEMORY_ROUTINE = Option ::BOOL>; -#[cfg(target_arch = "x86")] -pub type PFUNCTION_TABLE_ACCESS_ROUTINE = Option ::PVOID>; -#[cfg(target_arch = "x86")] -pub type PGET_MODULE_BASE_ROUTINE = Option ::DWORD>; -#[cfg(target_arch = "x86")] -pub type PTRANSLATE_ADDRESS_ROUTINE = Option ::DWORD>; -pub const API_VERSION_NUMBER: ::USHORT = 12; -STRUCT!{struct API_VERSION { - MajorVersion: ::USHORT, - MinorVersion: ::USHORT, - Revision: ::USHORT, - Reserved: ::USHORT, -}} -pub type LPAPI_VERSION = *mut API_VERSION; -STRUCT!{struct SYMBOL_INFOW { - SizeOfStruct: ::ULONG, - TypeIndex: ::ULONG, - Reserved: [::ULONG64; 2], - Index: ::ULONG, - Size: ::ULONG, - ModBase: ::ULONG64, - Flags: ::ULONG, - Value: ::ULONG64, - Address: ::ULONG64, - Register: ::ULONG, - Scope: ::ULONG, - Tag: ::ULONG, - NameLen: ::ULONG, - MaxNameLen: ::ULONG, - Name: [::WCHAR; 1], -}} -pub type PSYMBOL_INFOW = *mut SYMBOL_INFOW; -STRUCT!{struct IMAGEHLP_SYMBOL64 { - SizeOfStruct: ::DWORD, - Address: ::DWORD64, - Size: ::DWORD, - Flags: ::DWORD, - MaxNameLength: ::DWORD, - Name: [::CHAR; 1], -}} -pub type PIMAGEHLP_SYMBOL64 = *mut IMAGEHLP_SYMBOL64; -STRUCT!{struct IMAGEHLP_LINEW64 { - SizeOfStruct: ::DWORD, - Key: ::PVOID, - LineNumber: ::DWORD, - FileName: ::PWSTR, - Address: ::DWORD64, -}} -pub type PIMAGEHLP_LINEW64 = *mut IMAGEHLP_LINEW64; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/dcommon.rs cargo-0.37.0/vendor/winapi-0.2.8/src/dcommon.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/dcommon.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/dcommon.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -// Copyright © 2015; Connor Hilarides -// Licensed under the MIT License -//! Mappings for the contents of dcommon.h -ENUM!{enum DWRITE_MEASURING_MODE { - DWRITE_MEASURING_MODE_NATURAL = 0, - DWRITE_MEASURING_MODE_GDI_CLASSIC = 1, - DWRITE_MEASURING_MODE_GDI_NATURAL = 2, -}} -ENUM!{enum D2D1_ALPHA_MODE { - D2D1_ALPHA_MODE_UNKNOWN = 0, - D2D1_ALPHA_MODE_PREMULTIPLIED = 1, - D2D1_ALPHA_MODE_STRAIGHT = 2, - D2D1_ALPHA_MODE_IGNORE = 3, -}} -STRUCT!{struct D2D1_PIXEL_FORMAT { - format: ::DXGI_FORMAT, - alphaMode: D2D1_ALPHA_MODE, -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/devpropdef.rs cargo-0.37.0/vendor/winapi-0.2.8/src/devpropdef.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/devpropdef.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/devpropdef.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! Defines property types and keys for the Plug and Play Device Property API -pub type DEVPROPTYPE = ::ULONG; -pub type PDEVPROPTYPE = *mut ::ULONG; -pub const DEVPROP_TYPEMOD_ARRAY: DEVPROPTYPE = 0x00001000; -pub const DEVPROP_TYPEMOD_LIST: DEVPROPTYPE = 0x00002000; -pub const DEVPROP_TYPE_EMPTY: DEVPROPTYPE = 0x00000000; -pub const DEVPROP_TYPE_NULL: DEVPROPTYPE = 0x00000001; -pub const DEVPROP_TYPE_SBYTE: DEVPROPTYPE = 0x00000002; -pub const DEVPROP_TYPE_BYTE: DEVPROPTYPE = 0x00000003; -pub const DEVPROP_TYPE_INT16: DEVPROPTYPE = 0x00000004; -pub const DEVPROP_TYPE_UINT16: DEVPROPTYPE = 0x00000005; -pub const DEVPROP_TYPE_INT32: DEVPROPTYPE = 0x00000006; -pub const DEVPROP_TYPE_UINT32: DEVPROPTYPE = 0x00000007; -pub const DEVPROP_TYPE_INT64: DEVPROPTYPE = 0x00000008; -pub const DEVPROP_TYPE_UINT64: DEVPROPTYPE = 0x00000009; -pub const DEVPROP_TYPE_FLOAT: DEVPROPTYPE = 0x0000000A; -pub const DEVPROP_TYPE_DOUBLE: DEVPROPTYPE = 0x0000000B; -pub const DEVPROP_TYPE_DECIMAL: DEVPROPTYPE = 0x0000000C; -pub const DEVPROP_TYPE_GUID: DEVPROPTYPE = 0x0000000D; -pub const DEVPROP_TYPE_CURRENCY: DEVPROPTYPE = 0x0000000E; -pub const DEVPROP_TYPE_DATE: DEVPROPTYPE = 0x0000000F; -pub const DEVPROP_TYPE_FILETIME: DEVPROPTYPE = 0x00000010; -pub const DEVPROP_TYPE_BOOLEAN: DEVPROPTYPE = 0x00000011; -pub const DEVPROP_TYPE_STRING: DEVPROPTYPE = 0x00000012; -pub const DEVPROP_TYPE_STRING_LIST: DEVPROPTYPE = DEVPROP_TYPE_STRING | DEVPROP_TYPEMOD_LIST; -pub const DEVPROP_TYPE_SECURITY_DESCRIPTOR: DEVPROPTYPE = 0x00000013; -pub const DEVPROP_TYPE_SECURITY_DESCRIPTOR_STRING: DEVPROPTYPE = 0x00000014; -pub const DEVPROP_TYPE_DEVPROPKEY: DEVPROPTYPE = 0x00000015; -pub const DEVPROP_TYPE_DEVPROPTYPE: DEVPROPTYPE = 0x00000016; -pub const DEVPROP_TYPE_BINARY: DEVPROPTYPE = DEVPROP_TYPE_BYTE | DEVPROP_TYPEMOD_ARRAY; -pub const DEVPROP_TYPE_ERROR: DEVPROPTYPE = 0x00000017; -pub const DEVPROP_TYPE_NTSTATUS: DEVPROPTYPE = 0x00000018; -pub const DEVPROP_TYPE_STRING_INDIRECT: DEVPROPTYPE = 0x00000019; -pub const MAX_DEVPROP_TYPE: DEVPROPTYPE = 0x00000019; -pub const MAX_DEVPROP_TYPEMOD: DEVPROPTYPE = 0x00002000; -pub const DEVPROP_MASK_TYPE: DEVPROPTYPE = 0x00000FFF; -pub const DEVPROP_MASK_TYPEMOD: DEVPROPTYPE = 0x0000F000; -pub type DEVPROP_BOOLEAN = ::CHAR; -pub type PDEVPROP_BOOLEAN = *mut ::CHAR; -pub const DEVPROP_TRUE: DEVPROP_BOOLEAN = -1; -pub const DEVPROP_FALSE: DEVPROP_BOOLEAN = 0; -pub type DEVPROPGUID = ::GUID; -pub type PDEVPROPGUID = *mut ::GUID; -pub type DEVPROPID = ::ULONG; -pub type PDEVPROPID = *mut ::ULONG; -STRUCT!{struct DEVPROPKEY { - fmtid: DEVPROPGUID, - pid: DEVPROPID, -}} -pub type PDEVPROPKEY = *mut DEVPROPKEY; -ENUM!{enum DEVPROPSTORE { - DEVPROP_STORE_SYSTEM, - DEVPROP_STORE_USER, -}} -pub type PDEVPROPSTORE = *mut DEVPROPSTORE; -STRUCT!{struct DEVPROPCOMPKEY { - Key: DEVPROPKEY, - Store: DEVPROPSTORE, - LocaleName: ::PCWSTR, -}} -pub type PDEVPROPCOMPKEY = *mut DEVPROPCOMPKEY; -STRUCT!{struct DEVPROPERTY { - CompKey: DEVPROPCOMPKEY, - Type: DEVPROPTYPE, - BufferSize: ::ULONG, - Buffer: ::PVOID, -}} -pub type PDEVPROPERTY = *mut DEVPROPERTY; -pub const DEVPROPID_FIRST_USABLE: DEVPROPID = 2; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/docobj.rs cargo-0.37.0/vendor/winapi-0.2.8/src/docobj.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/docobj.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/docobj.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -STRUCT!{struct OLECMD { - cmdID: ::ULONG, - cmdf: ::DWORD, -}} -STRUCT!{struct OLECMDTEXT { - cmdtextf: ::DWORD, - cwActual: ::ULONG, - cwBuf: ::ULONG, - rgwz: [::wchar_t; 0], -}} -RIDL!{interface IOleCommandTarget(IOleCommandTargetVtbl): IUnknown(IUnknownVtbl) { - fn QueryStatus( - &mut self, pguidCmdGroup: *const ::GUID, cCmds: ::ULONG, prgCmds: *mut OLECMD, - pCmdText: *mut OLECMDTEXT - ) -> ::HRESULT, - fn Exec( - &mut self, pguidCmdGroup: *const :: GUID, nCmdID: ::DWORD, nCmdexecopt: ::DWORD, - pvaIn: *mut ::VARIANT, pvaOut: *mut ::VARIANT - ) -> ::HRESULT -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/dpapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/dpapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/dpapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/dpapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! Data Protection API Prototypes and Definitions -pub const szFORCE_KEY_PROTECTION: &'static str = "ForceKeyProtection"; -STRUCT!{struct CRYPTPROTECT_PROMPTSTRUCT { - cbSize: ::DWORD, - dwPromptFlags: ::DWORD, - hwndApp: ::HWND, - szPrompt: ::LPCWSTR, -}} -pub type PCRYPTPROTECT_PROMPTSTRUCT = *mut CRYPTPROTECT_PROMPTSTRUCT; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/dsgetdc.rs cargo-0.37.0/vendor/winapi-0.2.8/src/dsgetdc.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/dsgetdc.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/dsgetdc.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,113 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! This file contains structures, function prototypes, and definitions for the DsGetDcName API. -pub const DS_FORCE_REDISCOVERY: ::ULONG = 0x00000001; -pub const DS_DIRECTORY_SERVICE_REQUIRED: ::ULONG = 0x00000010; -pub const DS_DIRECTORY_SERVICE_PREFERRED: ::ULONG = 0x00000020; -pub const DS_GC_SERVER_REQUIRED: ::ULONG = 0x00000040; -pub const DS_PDC_REQUIRED: ::ULONG = 0x00000080; -pub const DS_BACKGROUND_ONLY: ::ULONG = 0x00000100; -pub const DS_IP_REQUIRED: ::ULONG = 0x00000200; -pub const DS_KDC_REQUIRED: ::ULONG = 0x00000400; -pub const DS_TIMESERV_REQUIRED: ::ULONG = 0x00000800; -pub const DS_WRITABLE_REQUIRED: ::ULONG = 0x00001000; -pub const DS_GOOD_TIMESERV_PREFERRED: ::ULONG = 0x00002000; -pub const DS_AVOID_SELF: ::ULONG = 0x00004000; -pub const DS_ONLY_LDAP_NEEDED: ::ULONG = 0x00008000; -pub const DS_IS_FLAT_NAME: ::ULONG = 0x00010000; -pub const DS_IS_DNS_NAME: ::ULONG = 0x00020000; -pub const DS_TRY_NEXTCLOSEST_SITE: ::ULONG = 0x00040000; -pub const DS_DIRECTORY_SERVICE_6_REQUIRED: ::ULONG = 0x00080000; -pub const DS_WEB_SERVICE_REQUIRED: ::ULONG = 0x00100000; -pub const DS_DIRECTORY_SERVICE_8_REQUIRED: ::ULONG = 0x00200000; -pub const DS_DIRECTORY_SERVICE_9_REQUIRED: ::ULONG = 0x00400000; -pub const DS_RETURN_DNS_NAME: ::ULONG = 0x40000000; -pub const DS_RETURN_FLAT_NAME: ::ULONG = 0x80000000; -pub const DSGETDC_VALID_FLAGS: ::ULONG = DS_FORCE_REDISCOVERY | DS_DIRECTORY_SERVICE_REQUIRED - | DS_DIRECTORY_SERVICE_PREFERRED | DS_GC_SERVER_REQUIRED | DS_PDC_REQUIRED | DS_BACKGROUND_ONLY - | DS_IP_REQUIRED | DS_KDC_REQUIRED | DS_TIMESERV_REQUIRED | DS_WRITABLE_REQUIRED - | DS_GOOD_TIMESERV_PREFERRED | DS_AVOID_SELF | DS_ONLY_LDAP_NEEDED | DS_IS_FLAT_NAME - | DS_IS_DNS_NAME | DS_TRY_NEXTCLOSEST_SITE | DS_DIRECTORY_SERVICE_6_REQUIRED - | DS_DIRECTORY_SERVICE_8_REQUIRED | DS_DIRECTORY_SERVICE_9_REQUIRED | DS_WEB_SERVICE_REQUIRED - | DS_RETURN_FLAT_NAME | DS_RETURN_DNS_NAME; -STRUCT!{struct DOMAIN_CONTROLLER_INFOA { - DomainControllerName: ::LPSTR, - DomainControllerAddress: ::LPSTR, - DomainControllerAddressType: ::ULONG, - DomainGuid: ::GUID, - DomainName: ::LPSTR, - DnsForestName: ::LPSTR, - Flags: ::ULONG, - DcSiteName: ::LPSTR, - ClientSiteName: ::LPSTR, -}} -pub type PDOMAIN_CONTROLLER_INFOA = *mut DOMAIN_CONTROLLER_INFOA; -STRUCT!{struct DOMAIN_CONTROLLER_INFOW { - DomainControllerName: ::LPWSTR, - DomainControllerAddress: ::LPWSTR, - DomainControllerAddressType: ::ULONG, - DomainGuid: ::GUID, - DomainName: ::LPWSTR, - DnsForestName: ::LPWSTR, - Flags: ::ULONG, - DcSiteName: ::LPWSTR, - ClientSiteName: ::LPWSTR, -}} -pub type PDOMAIN_CONTROLLER_INFOW = *mut DOMAIN_CONTROLLER_INFOW; -pub const DS_INET_ADDRESS: ::ULONG = 1; -pub const DS_NETBIOS_ADDRESS: ::ULONG = 2; -pub const DS_PDC_FLAG: ::ULONG = 0x00000001; -pub const DS_GC_FLAG: ::ULONG = 0x00000004; -pub const DS_LDAP_FLAG: ::ULONG = 0x00000008; -pub const DS_DS_FLAG: ::ULONG = 0x00000010; -pub const DS_KDC_FLAG: ::ULONG = 0x00000020; -pub const DS_TIMESERV_FLAG: ::ULONG = 0x00000040; -pub const DS_CLOSEST_FLAG: ::ULONG = 0x00000080; -pub const DS_WRITABLE_FLAG: ::ULONG = 0x00000100; -pub const DS_GOOD_TIMESERV_FLAG: ::ULONG = 0x00000200; -pub const DS_NDNC_FLAG: ::ULONG = 0x00000400; -pub const DS_SELECT_SECRET_DOMAIN_6_FLAG: ::ULONG = 0x00000800; -pub const DS_FULL_SECRET_DOMAIN_6_FLAG: ::ULONG = 0x00001000; -pub const DS_WS_FLAG: ::ULONG = 0x00002000; -pub const DS_DS_8_FLAG: ::ULONG = 0x00004000; -pub const DS_DS_9_FLAG: ::ULONG = 0x00008000; -pub const DS_PING_FLAGS: ::ULONG = 0x000FFFFF; -pub const DS_DNS_CONTROLLER_FLAG: ::ULONG = 0x20000000; -pub const DS_DNS_DOMAIN_FLAG: ::ULONG = 0x40000000; -pub const DS_DNS_FOREST_FLAG: ::ULONG = 0x80000000; -pub const DS_DOMAIN_IN_FOREST: ::ULONG = 0x0001; -pub const DS_DOMAIN_DIRECT_OUTBOUND: ::ULONG = 0x0002; -pub const DS_DOMAIN_TREE_ROOT: ::ULONG = 0x0004; -pub const DS_DOMAIN_PRIMARY: ::ULONG = 0x0008; -pub const DS_DOMAIN_NATIVE_MODE: ::ULONG = 0x0010; -pub const DS_DOMAIN_DIRECT_INBOUND: ::ULONG = 0x0020; -pub const DS_DOMAIN_VALID_FLAGS: ::ULONG = DS_DOMAIN_IN_FOREST | DS_DOMAIN_DIRECT_OUTBOUND - | DS_DOMAIN_TREE_ROOT | DS_DOMAIN_PRIMARY | DS_DOMAIN_NATIVE_MODE | DS_DOMAIN_DIRECT_INBOUND; -STRUCT!{struct DS_DOMAIN_TRUSTSW { - NetbiosDomainName: ::LPWSTR, - DnsDomainName: ::LPWSTR, - Flags: ::ULONG, - ParentIndex: ::ULONG, - TrustType: ::ULONG, - TrustAttributes: ::ULONG, - DomainSid: ::PSID, - DomainGuid: ::GUID, -}} -pub type PDS_DOMAIN_TRUSTSW = *mut DS_DOMAIN_TRUSTSW; -STRUCT!{struct DS_DOMAIN_TRUSTSA { - NetbiosDomainName: ::LPSTR, - DnsDomainName: ::LPSTR, - Flags: ::ULONG, - ParentIndex: ::ULONG, - TrustType: ::ULONG, - TrustAttributes: ::ULONG, - DomainSid: ::PSID, - DomainGuid: ::GUID, -}} -pub type PDS_DOMAIN_TRUSTSA = *mut DS_DOMAIN_TRUSTSA; -pub const DS_ONLY_DO_SITE_NAME: ::ULONG = 0x01; -pub const DS_NOTIFY_AFTER_SITE_RECORDS: ::ULONG = 0x02; -pub const DS_OPEN_VALID_OPTION_FLAGS: ::ULONG = DS_ONLY_DO_SITE_NAME - | DS_NOTIFY_AFTER_SITE_RECORDS; -pub const DS_OPEN_VALID_FLAGS: ::ULONG = DS_FORCE_REDISCOVERY | DS_ONLY_LDAP_NEEDED - | DS_KDC_REQUIRED | DS_PDC_REQUIRED | DS_GC_SERVER_REQUIRED | DS_WRITABLE_REQUIRED; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/dsound.rs cargo-0.37.0/vendor/winapi-0.2.8/src/dsound.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/dsound.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/dsound.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,132 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! DSound procedure declarations, constant definitions and macros -STRUCT!{struct DSCAPS { - dwSize: ::DWORD, - dwFlags: ::DWORD, - dwMinSecondarySampleRate: ::DWORD, - dwMaxSecondarySampleRate: ::DWORD, - dwPrimaryBuffers: ::DWORD, - dwMaxHwMixingAllBuffers: ::DWORD, - dwMaxHwMixingStaticBuffers: ::DWORD, - dwMaxHwMixingStreamingBuffers: ::DWORD, - dwFreeHwMixingAllBuffers: ::DWORD, - dwFreeHwMixingStaticBuffers: ::DWORD, - dwFreeHwMixingStreamingBuffers: ::DWORD, - dwMaxHw3DAllBuffers: ::DWORD, - dwMaxHw3DStaticBuffers: ::DWORD, - dwMaxHw3DStreamingBuffers: ::DWORD, - dwFreeHw3DAllBuffers: ::DWORD, - dwFreeHw3DStaticBuffers: ::DWORD, - dwFreeHw3DStreamingBuffers: ::DWORD, - dwTotalHwMemBytes: ::DWORD, - dwFreeHwMemBytes: ::DWORD, - dwMaxContigFreeHwMemBytes: ::DWORD, - dwUnlockTransferRateHwBuffers: ::DWORD, - dwPlayCpuOverheadSwBuffers: ::DWORD, - dwReserved1: ::DWORD, - dwReserved2: ::DWORD, -}} -pub type LPDSCAPS = *mut DSCAPS; -STRUCT!{struct DSBCAPS { - dwSize: ::DWORD, - dwFlags: ::DWORD, - dwBufferBytes: ::DWORD, - dwUnlockTransferRate: ::DWORD, - dwPlayCpuOverhead: ::DWORD, -}} -pub type LPDSBCAPS = *mut DSBCAPS; -STRUCT!{struct DSBUFFERDESC { - dwSize: ::DWORD, - dwFlags: ::DWORD, - dwBufferBytes: ::DWORD, - dwReserved: ::DWORD, - lpwfxFormat: ::LPWAVEFORMATEX, - guid3DAlgorithm: ::GUID, -}} -pub type LPCDSBUFFERDESC = *const DSBUFFERDESC; -RIDL!( -interface IDirectSoundBuffer(IDirectSoundBufferVtbl): IUnknown(IUnknownVtbl) { - fn GetCaps(&mut self, pDSBufferCaps: ::LPDSBCAPS) -> ::HRESULT, - fn GetCurrentPosition( - &mut self, pdwCurrentPlayCursor: ::LPDWORD, pdwCurrentWriteCursor: ::LPDWORD - ) -> ::HRESULT, - fn GetFormat( - &mut self, pwfxFormat: ::LPWAVEFORMATEX, dwSizeAllocated: ::DWORD, - pdwSizeWritten: ::LPDWORD - ) -> ::HRESULT, - fn GetVolume(&mut self, plVolume: ::LPLONG) -> ::HRESULT, - fn GetPan(&mut self, plPan: ::LPLONG) -> ::HRESULT, - fn GetFrequency(&mut self, pdwFrequency: ::LPDWORD) -> ::HRESULT, - fn GetStatus(&mut self, pdwStatus: ::LPDWORD) -> ::HRESULT, - fn Initialize( - &mut self, pDirectSound: ::LPDIRECTSOUND, pcDSBufferDesc: ::LPCDSBUFFERDESC - ) -> ::HRESULT, - fn Lock( - &mut self, dwOffset: ::DWORD, dwBytes: ::DWORD, ppvAudioPtr1: *mut ::LPVOID, - pdwAudioBytes1: ::LPDWORD, ppvAudioPtr2: *mut ::LPVOID, pdwAudioBytes2: ::LPDWORD, - dwFlags: ::DWORD - ) -> ::HRESULT, - fn Play(&mut self, dwReserved1: ::DWORD, dwPriority: ::DWORD, dwFlags: ::DWORD) -> ::HRESULT, - fn SetCurrentPosition(&mut self, dwNewPosition: ::DWORD) -> ::HRESULT, - fn SetFormat(&mut self, pcfxFormat: ::LPCWAVEFORMATEX) -> ::HRESULT, - fn SetVolume(&mut self, lVolume: ::LONG) -> ::HRESULT, - fn SetPan(&mut self, lPan: ::LONG) -> ::HRESULT, - fn SetFrequency(&mut self, dwFrequency: ::DWORD) -> ::HRESULT, - fn Stop(&mut self) -> ::HRESULT, - fn Unlock( - &mut self, pvAudioPtr1: ::LPVOID, dwAudioBytes1: ::DWORD, pvAudioPtr2: ::LPVOID, - dwAudioBytes2: ::DWORD - ) -> ::HRESULT, - fn Restore(&mut self) -> ::HRESULT -} -); -pub type LPDIRECTSOUNDBUFFER = *mut IDirectSoundBuffer; -RIDL!( -interface IDirectSound(IDirectSoundVtbl): IUnknown(IUnknownVtbl) -{ - fn CreateSoundBuffer( - &mut self, pcDSBufferDesc: ::LPCDSBUFFERDESC, ppDSBuffer: *mut ::LPDIRECTSOUNDBUFFER, - pUnkOuter: ::LPUNKNOWN - ) -> ::HRESULT, - fn GetCaps(&mut self, pDSCaps: ::LPDSCAPS) -> ::HRESULT, - fn DuplicateSoundBuffer( - &mut self, pDSBufferOriginal: LPDIRECTSOUNDBUFFER, - ppDSBufferDuplicate: *mut ::LPDIRECTSOUNDBUFFER - ) -> ::HRESULT, - fn SetCooperativeLevel(&mut self, hWnd: ::HWND, dwLevel: ::DWORD) -> ::HRESULT, - fn Compact(&mut self) -> ::HRESULT, - fn GetSpeakerConfig(&mut self, pdwSpeakerConfig: ::LPDWORD) -> ::HRESULT, - fn SetSpeakerConfig(&mut self, dwSpeakerConfig: ::DWORD) -> ::HRESULT, - fn Initialize(&mut self, pcGuidDevice: ::LPCGUID) -> ::HRESULT -} -); -pub type LPDIRECTSOUND = *mut IDirectSound; -pub const DS_OK: ::HRESULT = ::S_OK; -pub const DSERR_GENERIC: ::HRESULT = ::E_FAIL; -pub const DSSCL_NORMAL: ::DWORD = 0x00000001; -pub const DSSCL_PRIORITY: ::DWORD = 0x00000002; -pub const DSSCL_EXCLUSIVE: ::DWORD = 0x00000003; -pub const DSSCL_WRITEPRIMARY: ::DWORD = 0x00000004; -pub const DSBCAPS_PRIMARYBUFFER: ::DWORD = 0x00000001; -pub const DSBCAPS_STATIC: ::DWORD = 0x00000002; -pub const DSBCAPS_LOCHARDWARE: ::DWORD = 0x00000004; -pub const DSBCAPS_LOCSOFTWARE: ::DWORD = 0x00000008; -pub const DSBCAPS_CTRL3D: ::DWORD = 0x00000010; -pub const DSBCAPS_CTRLFREQUENCY: ::DWORD = 0x00000020; -pub const DSBCAPS_CTRLPAN: ::DWORD = 0x00000040; -pub const DSBCAPS_CTRLVOLUME: ::DWORD = 0x00000080; -pub const DSBCAPS_CTRLPOSITIONNOTIFY: ::DWORD = 0x00000100; -pub const DSBCAPS_CTRLFX: ::DWORD = 0x00000200; -pub const DSBCAPS_STICKYFOCUS: ::DWORD = 0x00004000; -pub const DSBCAPS_GLOBALFOCUS: ::DWORD = 0x00008000; -pub const DSBCAPS_GETCURRENTPOSITION2: ::DWORD = 0x00010000; -pub const DSBCAPS_MUTE3DATMAXDISTANCE: ::DWORD = 0x00020000; -pub const DSBCAPS_LOCDEFER: ::DWORD = 0x00040000; -pub const DSBCAPS_TRUEPLAYPOSITION: ::DWORD = 0x00080000; -pub const DSBPLAY_LOOPING: ::DWORD = 0x00000001; -pub const DSBPLAY_LOCHARDWARE: ::DWORD = 0x00000002; -pub const DSBPLAY_LOCSOFTWARE: ::DWORD = 0x00000004; -pub const DSBPLAY_TERMINATEBY_TIME: ::DWORD = 0x00000008; -pub const DSBPLAY_TERMINATEBY_DISTANCE: ::DWORD = 0x000000010; -pub const DSBPLAY_TERMINATEBY_PRIORITY: ::DWORD = 0x000000020; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/dsrole.rs cargo-0.37.0/vendor/winapi-0.2.8/src/dsrole.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/dsrole.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/dsrole.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! Contains public interfaces to query the network roles of workstations, servers, and DCs -ENUM!{enum DSROLE_MACHINE_ROLE { - DsRole_RoleStandaloneWorkstation, - DsRole_RoleMemberWorkstation, - DsRole_RoleStandaloneServer, - DsRole_RoleMemberServer, - DsRole_RoleBackupDomainController, - DsRole_RolePrimaryDomainController, -}} -ENUM!{enum DSROLE_SERVER_STATE { - DsRoleServerUnknown = 0, - DsRoleServerPrimary, - DsRoleServerBackup, -}} -pub type PDSROLE_SERVER_STATE = *mut DSROLE_SERVER_STATE; -ENUM!{enum DSROLE_PRIMARY_DOMAIN_INFO_LEVEL { - DsRolePrimaryDomainInfoBasic = 1, - DsRoleUpgradeStatus, - DsRoleOperationState, -}} -pub const DSROLE_PRIMARY_DS_RUNNING: ::ULONG = 0x00000001; -pub const DSROLE_PRIMARY_DS_MIXED_MODE: ::ULONG = 0x00000002; -pub const DSROLE_UPGRADE_IN_PROGRESS: ::ULONG = 0x00000004; -pub const DSROLE_PRIMARY_DS_READONLY: ::ULONG = 0x00000008; -pub const DSROLE_PRIMARY_DOMAIN_GUID_PRESENT: ::ULONG = 0x01000000; -STRUCT!{struct DSROLE_PRIMARY_DOMAIN_INFO_BASIC { - MachineRole: DSROLE_MACHINE_ROLE, - Flags: ::ULONG, - DomainNameFlat: ::LPWSTR, - DomainNameDns: ::LPWSTR, - DomainForestName: ::LPWSTR, - DomainGuid: ::GUID, -}} -pub type PDSROLE_PRIMARY_DOMAIN_INFO_BASIC = *mut DSROLE_PRIMARY_DOMAIN_INFO_BASIC; -STRUCT!{struct DSROLE_UPGRADE_STATUS_INFO { - OperationState: ::ULONG, - PreviousServerState: DSROLE_SERVER_STATE, -}} -pub type PDSROLE_UPGRADE_STATUS_INFO = *mut DSROLE_UPGRADE_STATUS_INFO; -ENUM!{enum DSROLE_OPERATION_STATE { - DsRoleOperationIdle = 0, - DsRoleOperationActive, - DsRoleOperationNeedReboot, -}} -STRUCT!{struct DSROLE_OPERATION_STATE_INFO { - OperationState: DSROLE_OPERATION_STATE, -}} -pub type PDSROLE_OPERATION_STATE_INFO = *mut DSROLE_OPERATION_STATE_INFO; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/dwmapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/dwmapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/dwmapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/dwmapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Procedure declarations, constant definitions, and macros for the NLS component. -STRUCT!{struct DWM_BLURBEHIND { - dwFlags: ::DWORD, - fEnable: ::BOOL, - hRgnBlur: ::HRGN, - fTransitionOnMaximized: ::BOOL, -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/dwrite.rs cargo-0.37.0/vendor/winapi-0.2.8/src/dwrite.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/dwrite.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/dwrite.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,1038 +0,0 @@ -// Copyright © 2015, Connor Hilarides -// Licensed under the MIT License -//! DirectX Typography Services public API definitions. -ENUM!{enum DWRITE_FONT_FILE_TYPE { - DWRITE_FONT_FILE_TYPE_UNKNOWN, - DWRITE_FONT_FILE_TYPE_CFF, - DWRITE_FONT_FILE_TYPE_TRUETYPE, - DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION, - DWRITE_FONT_FILE_TYPE_TYPE1_PFM, - DWRITE_FONT_FILE_TYPE_TYPE1_PFB, - DWRITE_FONT_FILE_TYPE_VECTOR, - DWRITE_FONT_FILE_TYPE_BITMAP, -}} -ENUM!{enum DWRITE_FONT_FACE_TYPE { - DWRITE_FONT_FACE_TYPE_CFF, - DWRITE_FONT_FACE_TYPE_TRUETYPE, - DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION, - DWRITE_FONT_FACE_TYPE_TYPE1, - DWRITE_FONT_FACE_TYPE_VECTOR, - DWRITE_FONT_FACE_TYPE_BITMAP, - DWRITE_FONT_FACE_TYPE_UNKNOWN, - DWRITE_FONT_FACE_TYPE_RAW_CFF, -}} -FLAGS!{enum DWRITE_FONT_SIMULATIONS { - DWRITE_FONT_SIMULATIONS_NONE = 0x0000, - DWRITE_FONT_SIMULATIONS_BOLD = 0x0001, - DWRITE_FONT_SIMULATIONS_OBLIQUE = 0x0002, -}} -ENUM!{enum DWRITE_FONT_WEIGHT { - DWRITE_FONT_WEIGHT_THIN = 100, - DWRITE_FONT_WEIGHT_EXTRA_LIGHT = 200, - DWRITE_FONT_WEIGHT_ULTRA_LIGHT = 200, - DWRITE_FONT_WEIGHT_LIGHT = 300, - DWRITE_FONT_WEIGHT_SEMI_LIGHT = 350, - DWRITE_FONT_WEIGHT_NORMAL = 400, - DWRITE_FONT_WEIGHT_REGULAR = 400, - DWRITE_FONT_WEIGHT_MEDIUM = 500, - DWRITE_FONT_WEIGHT_DEMI_BOLD = 600, - DWRITE_FONT_WEIGHT_SEMI_BOLD = 600, - DWRITE_FONT_WEIGHT_BOLD = 700, - DWRITE_FONT_WEIGHT_EXTRA_BOLD = 800, - DWRITE_FONT_WEIGHT_ULTRA_BOLD = 800, - DWRITE_FONT_WEIGHT_BLACK = 900, - DWRITE_FONT_WEIGHT_HEAVY = 900, - DWRITE_FONT_WEIGHT_EXTRA_BLACK = 950, - DWRITE_FONT_WEIGHT_ULTRA_BLACK = 950, -}} -ENUM!{enum DWRITE_FONT_STRETCH { - DWRITE_FONT_STRETCH_UNDEFINED = 0, - DWRITE_FONT_STRETCH_ULTRA_CONDENSED = 1, - DWRITE_FONT_STRETCH_EXTRA_CONDENSED = 2, - DWRITE_FONT_STRETCH_CONDENSED = 3, - DWRITE_FONT_STRETCH_SEMI_CONDENSED = 4, - DWRITE_FONT_STRETCH_NORMAL = 5, - DWRITE_FONT_STRETCH_MEDIUM = 5, - DWRITE_FONT_STRETCH_SEMI_EXPANDED = 6, - DWRITE_FONT_STRETCH_EXPANDED = 7, - DWRITE_FONT_STRETCH_EXTRA_EXPANDED = 8, - DWRITE_FONT_STRETCH_ULTRA_EXPANDED = 9, -}} -ENUM!{enum DWRITE_FONT_STYLE { - DWRITE_FONT_STYLE_NORMAL, - DWRITE_FONT_STYLE_OBLIQUE, - DWRITE_FONT_STYLE_ITALIC, -}} -ENUM!{enum DWRITE_INFORMATIONAL_STRING_ID { - DWRITE_INFORMATIONAL_STRING_NONE, - DWRITE_INFORMATIONAL_STRING_COPYRIGHT_NOTICE, - DWRITE_INFORMATIONAL_STRING_VERSION_STRINGS, - DWRITE_INFORMATIONAL_STRING_TRADEMARK, - DWRITE_INFORMATIONAL_STRING_MANUFACTURER, - DWRITE_INFORMATIONAL_STRING_DESIGNER, - DWRITE_INFORMATIONAL_STRING_DESIGNER_URL, - DWRITE_INFORMATIONAL_STRING_DESCRIPTION, - DWRITE_INFORMATIONAL_STRING_FONT_VENDOR_URL, - DWRITE_INFORMATIONAL_STRING_LICENSE_DESCRIPTION, - DWRITE_INFORMATIONAL_STRING_LICENSE_INFO_URL, - DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, - DWRITE_INFORMATIONAL_STRING_WIN32_SUBFAMILY_NAMES, - DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES, - DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES, - DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT, - DWRITE_INFORMATIONAL_STRING_FULL_NAME, - DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_NAME, - DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_CID_NAME, - DWRITE_INFORMATIONAL_STRING_WWS_FAMILY_NAME, - DWRITE_INFORMATIONAL_STRING_DESIGN_SCRIPT_LANGUAGE_TAG, - DWRITE_INFORMATIONAL_STRING_SUPPORTED_SCRIPT_LANGUAGE_TAG, -}} -STRUCT!{struct DWRITE_FONT_METRICS { - designUnitsPerEm: ::UINT16, - ascent: ::UINT16, - descent: ::UINT16, - lineGap: ::INT16, - capHeight: ::UINT16, - xHeight: ::UINT16, - underlinePosition: ::INT16, - underlineThickness: ::UINT16, - strikethroughPosition: ::INT16, - strikethroughThickness: ::UINT16, -}} -STRUCT!{struct DWRITE_GLYPH_METRICS { - leftSideBearing: ::INT32, - advanceWidth: ::UINT32, - rightSideBearing: ::INT32, - topSideBearing: ::INT32, - advanceHeight: ::UINT32, - bottomSideBearing: ::INT32, - verticalOriginY: ::INT32, -}} -STRUCT!{struct DWRITE_GLYPH_OFFSET { - advanceOffset: ::FLOAT, - ascenderOffset: ::FLOAT, -}} -ENUM!{enum DWRITE_FACTORY_TYPE { - DWRITE_FACTORY_TYPE_SHARED, - DWRITE_FACTORY_TYPE_ISOLATED, -}} -#[inline] -pub fn DWRITE_MAKE_OPENTYPE_TAG(a: u8, b: u8, c: u8, d: u8) -> u32 { - ((d as u32) << 24) | ((c as u32) << 16) | ((b as u32) << 8) | (a as u32) -} -RIDL!{interface IDWriteFontFileLoader(IDWriteFontFileLoaderVtbl): IUnknown(IUnknownVtbl) { - fn CreateStreamFromKey( - &mut self, fontFileReferenceKey: *const ::c_void, fontFileReferenceKeySize: ::UINT32, - fontFileStream: *mut *mut IDWriteFontFileStream - ) -> ::HRESULT -}} -RIDL!{interface IDWriteLocalFontFileLoader(IDWriteLocalFontFileLoaderVtbl): - IDWriteFontFileLoader(IDWriteFontFileLoaderVtbl) { - fn GetFilePathLengthFromKey( - &mut self, fontFileReferenceKey: *const ::c_void, fontFileReferenceKeySize: ::UINT32, - filePathLength: *mut ::UINT32 - ) -> ::HRESULT, - fn GetFilePathFromKey( - &mut self, fontFileReferenceKey: *const ::c_void, fontFileReferenceKeySize: ::UINT32, - filePath: *mut ::WCHAR, - filePathSize: ::UINT32 - ) -> ::HRESULT, - fn GetLastWriteTimeFromKey( - &mut self, fontFileReferenceKey: *const ::c_void, fontFileReferenceKeySize: ::UINT32, - lastWriteTime: *mut ::FILETIME - ) -> ::HRESULT -}} -RIDL!{interface IDWriteFontFileStream(IDWriteFontFileStreamVtbl): IUnknown(IUnknownVtbl) { - fn ReadFileFragment( - &mut self, fragmentStart: *mut *const ::c_void, fileOffset: ::UINT64, - fragmentSize: ::UINT64, fragmentContext: *mut *mut ::c_void - ) -> ::HRESULT, - fn ReleaseFileFragment(&mut self, fragmentContext: *mut ::c_void) -> (), - fn GetFileSize(&mut self, fileSize: *mut ::UINT64) -> ::HRESULT, - fn GetLastWriteTime(&mut self, lastWriteTime: *mut ::UINT64) -> ::HRESULT -}} -RIDL!{interface IDWriteFontFile(IDWriteFontFileVtbl): IUnknown(IUnknownVtbl) { - fn GetReferenceKey( - &mut self, fontFileReferenceKey: *mut *const ::c_void, - fontFileReferenceKeySize: *mut ::UINT32 - ) -> ::HRESULT, - fn GetLoader(&mut self, fontFileLoader: *mut *mut IDWriteFontFileLoader) -> ::HRESULT, - fn Analyze( - &mut self, isSupportedFontType: *mut ::BOOL, fontFileType: *mut DWRITE_FONT_FILE_TYPE, - fontFaceType: *mut DWRITE_FONT_FACE_TYPE, numberOfFaces: *mut ::UINT32 - ) -> ::HRESULT -}} -ENUM!{enum DWRITE_PIXEL_GEOMETRY { - DWRITE_PIXEL_GEOMETRY_FLAT, - DWRITE_PIXEL_GEOMETRY_RGB, - DWRITE_PIXEL_GEOMETRY_BGR, -}} -ENUM!{enum DWRITE_RENDERING_MODE { - DWRITE_RENDERING_MODE_DEFAULT, - DWRITE_RENDERING_MODE_ALIASED, - DWRITE_RENDERING_MODE_GDI_CLASSIC, - DWRITE_RENDERING_MODE_GDI_NATURAL, - DWRITE_RENDERING_MODE_NATURAL, - DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC, - DWRITE_RENDERING_MODE_OUTLINE, - DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC = DWRITE_RENDERING_MODE_GDI_CLASSIC.0, - DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL = DWRITE_RENDERING_MODE_GDI_NATURAL.0, - DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL = DWRITE_RENDERING_MODE_NATURAL.0, - DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC = DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC.0, -}} -STRUCT!{struct DWRITE_MATRIX { - m11: ::FLOAT, - m12: ::FLOAT, - m21: ::FLOAT, - m22: ::FLOAT, - dx: ::FLOAT, - dy: ::FLOAT, -}} -RIDL!{interface IDWriteRenderingParams(IDWriteRenderingParamsVtbl): IUnknown(IUnknownVtbl) { - fn GetGamma(&mut self) -> ::FLOAT, - fn GetEnhancedContrast(&mut self) -> ::FLOAT, - fn GetClearTypeLevel(&mut self) -> ::FLOAT, - fn GetPixelGeometry(&mut self) -> DWRITE_PIXEL_GEOMETRY, - fn GetRenderingMode(&mut self) -> DWRITE_RENDERING_MODE -}} -pub type IDWriteGeometrySink = ::ID2D1SimplifiedGeometrySink; -RIDL!{interface IDWriteFontFace(IDWriteFontFaceVtbl): IUnknown(IUnknownVtbl) { - fn GetType(&mut self) -> DWRITE_FONT_FACE_TYPE, - fn GetFiles( - &mut self, numberOfFiles: *mut ::UINT32, fontFiles: *mut *mut IDWriteFontFile - ) -> ::HRESULT, - fn GetIndex(&mut self) -> ::UINT32, - fn GetSimulations(&mut self) -> DWRITE_FONT_SIMULATIONS, - fn IsSymbolFont(&mut self) -> ::BOOL, - fn GetMetrics(&mut self, fontFaceMetrics: *mut DWRITE_FONT_METRICS) -> (), - fn GetGlyphCount(&mut self) -> ::UINT16, - fn GetDesignGlyphMetrics( - &mut self, glyphIndices: *const ::UINT16, glyphCount: ::UINT32, - glyphMetrics: *mut DWRITE_GLYPH_METRICS, isSideways: ::BOOL - ) -> ::HRESULT, - fn GetGlyphIndices( - &mut self, codePoints: *const ::UINT32, codePointCount: ::UINT32, - glyphIndices: *mut ::UINT16 - ) -> ::HRESULT, - fn TryGetFontTable( - &mut self, openTypeTableTag: ::UINT32, tableData: *mut *const ::c_void, - tableSize: *mut ::UINT32, tableContext: *mut *mut ::c_void, exists: *mut ::BOOL - ) -> ::HRESULT, - fn ReleaseFontTable( - &mut self, tableContext: *mut ::c_void - ) -> ::HRESULT, - fn GetGlyphRunOutline( - &mut self, emSize: ::FLOAT, glyphIndices: *const ::UINT16, glyphAdvances: *const ::FLOAT, - glyphOffsets: *const DWRITE_GLYPH_OFFSET, glyphCount: ::UINT32, isSideways: ::BOOL, - isRightToLeft: ::BOOL, geometrySink: *mut IDWriteGeometrySink - ) -> ::HRESULT, - fn GetRecommendedRenderingMode( - &mut self, emSize: ::FLOAT, pixelsPerDip: ::FLOAT, measuringMode: ::DWRITE_MEASURING_MODE, - renderingParams: *mut IDWriteRenderingParams, renderingMode: *mut DWRITE_RENDERING_MODE - ) -> ::HRESULT, - fn GetGdiCompatibleMetrics( - &mut self, emSize: ::FLOAT, pixelsPerDip: ::FLOAT, transform: *const DWRITE_MATRIX, - fontFaceMetrics: *mut DWRITE_FONT_METRICS - ) -> ::HRESULT, - fn GetGdiCompatibleGlyphMetrics( - &mut self, enSize: ::FLOAT, pixelsPerDip: ::FLOAT, transform: *const DWRITE_MATRIX, - useGdiNatrual: ::BOOL, glyphIndices: *const ::UINT16, glyphCount: ::UINT32, - glyphMetrics: *mut DWRITE_GLYPH_METRICS, isSideways: ::BOOL - ) -> ::HRESULT -}} -RIDL!{interface IDWriteFontCollectionLoader(IDWriteFontCollectionLoaderVtbl): - IUnknown(IUnknownVtbl) { - fn CreateEnumeratorFromKey( - &mut self, factory: *mut IDWriteFactory, collectionKey: *const ::c_void, - collectionKeySize: ::UINT32, fontFileEnumerator: *mut *mut IDWriteFontFileEnumerator - ) -> ::HRESULT -}} -RIDL!{interface IDWriteFontFileEnumerator(IDWriteFontFileEnumeratorVtbl): IUnknown(IUnknownVtbl) { - fn MoveNext(&mut self, hasCurrentFile: *mut ::BOOL) -> ::HRESULT, - fn GetCurrentFontFile(&mut self, fontFile: *mut *mut IDWriteFontFile) -> ::HRESULT -}} -RIDL!{interface IDWriteLocalizedStrings(IDWriteLocalizedStringsVtbl): IUnknown(IUnknownVtbl) { - fn GetCount(&mut self) -> ::UINT32, - fn FindLocaleName( - &mut self, localeName: *const ::WCHAR, index: *mut ::UINT32, exists: *mut ::BOOL - ) -> ::HRESULT, - fn GetLocaleNameLength(&mut self, index: ::UINT32, length: *mut ::UINT32) -> ::HRESULT, - fn GetLocaleName( - &mut self, index: ::UINT32, localeName: *mut ::WCHAR, size: ::UINT32 - ) -> ::HRESULT, - fn GetStringLength(&mut self, index: ::UINT32, length: *mut ::UINT32) -> ::HRESULT, - fn GetString( - &mut self, index: ::UINT32, stringBuffer: *mut ::WCHAR, size: ::UINT32 - ) -> ::HRESULT -}} -RIDL!{interface IDWriteFontCollection(IDWriteFontCollectionVtbl): IUnknown(IUnknownVtbl) { - fn GetFontFamilyCount(&mut self) -> ::UINT32, - fn GetFontFamily( - &mut self, index: ::UINT32, fontFamily: *mut *mut IDWriteFontFamily - ) -> ::HRESULT, - fn FindFamilyName( - &mut self, familyName: *const ::WCHAR, index: *mut ::UINT32, exists: *mut ::BOOL - ) -> ::HRESULT, - fn GetFontFromFontFace( - &mut self, fontFace: *mut IDWriteFontFace, font: *mut *mut IDWriteFont - ) -> ::HRESULT -}} -RIDL!{interface IDWriteFontList(IDWriteFontListVtbl): IUnknown(IUnknownVtbl) { - fn GetFontCollection(&mut self, fontCollection: *mut *mut IDWriteFontCollection) -> ::HRESULT, - fn GetFontCount(&mut self) -> ::UINT32, - fn GetFont(&mut self, index: ::UINT32, font: *mut *mut IDWriteFont) -> ::HRESULT -}} -RIDL!{interface IDWriteFontFamily(IDWriteFontFamilyVtbl): IDWriteFontList(IDWriteFontListVtbl) { - fn GetFamilyNames(&mut self, names: *mut *mut IDWriteLocalizedStrings) -> ::HRESULT, - fn GetFirstMatchingFont( - &mut self, weight: DWRITE_FONT_WEIGHT, stretch: DWRITE_FONT_STRETCH, - style: DWRITE_FONT_STYLE, matchingFont: *mut *mut IDWriteFont - ) -> ::HRESULT, - fn GetMatchingFonts( - &mut self, weight: DWRITE_FONT_WEIGHT, stretch: DWRITE_FONT_STRETCH, - style: DWRITE_FONT_STYLE, matchingFonts: *mut *mut IDWriteFontList - ) -> ::HRESULT -}} -RIDL!{interface IDWriteFont(IDWriteFontVtbl): IUnknown(IUnknownVtbl) { - fn GetFontFamily(&mut self, fontFamily: *mut *mut IDWriteFontFamily) -> ::HRESULT, - fn GetWeight(&mut self) -> DWRITE_FONT_WEIGHT, - fn GetStretch(&mut self) -> DWRITE_FONT_STRETCH, - fn GetStyle(&mut self) -> DWRITE_FONT_STYLE, - fn IsSymbolFont(&mut self) -> ::BOOL, - fn GetFaceNames(&mut self, names: *mut *mut IDWriteLocalizedStrings) -> ::HRESULT, - fn GetInformationalStrings( - &mut self, informationalStringId: DWRITE_INFORMATIONAL_STRING_ID, - informationalStrings: *mut *mut IDWriteLocalizedStrings, exists: *mut ::BOOL - ) -> ::HRESULT, - fn GetSimulations(&mut self) -> DWRITE_FONT_SIMULATIONS, - fn GetMetrics(&mut self, fontMetrics: *mut DWRITE_FONT_METRICS) -> (), - fn HasCharacter(&mut self, unicodeValue: ::UINT32, exists: *mut ::BOOL) -> ::HRESULT, - fn CreateFontFace(&mut self, fontFace: *mut *mut IDWriteFontFace) -> ::HRESULT -}} -ENUM!{enum DWRITE_READING_DIRECTION { - DWRITE_READING_DIRECTION_LEFT_TO_RIGHT = 0, - DWRITE_READING_DIRECTION_RIGHT_TO_LEFT = 1, - DWRITE_READING_DIRECTION_TOP_TO_BOTTOM = 2, - DWRITE_READING_DIRECTION_BOTTOM_TO_TOP = 3, -}} -ENUM!{enum DWRITE_FLOW_DIRECTION { - DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM = 0, - DWRITE_FLOW_DIRECTION_BOTTOM_TO_TOP = 1, - DWRITE_FLOW_DIRECTION_LEFT_TO_RIGHT = 2, - DWRITE_FLOW_DIRECTION_RIGHT_TO_LEFT = 3, -}} -ENUM!{enum DWRITE_TEXT_ALIGNMENT { - DWRITE_TEXT_ALIGNMENT_LEADING, - DWRITE_TEXT_ALIGNMENT_TRAILING, - DWRITE_TEXT_ALIGNMENT_CENTER, - DWRITE_TEXT_ALIGNMENT_JUSTIFIED, -}} -ENUM!{enum DWRITE_PARAGRAPH_ALIGNMENT { - DWRITE_PARAGRAPH_ALIGNMENT_NEAR, - DWRITE_PARAGRAPH_ALIGNMENT_FAR, - DWRITE_PARAGRAPH_ALIGNMENT_CENTER, -}} -ENUM!{enum DWRITE_WORD_WRAPPING { - DWRITE_WORD_WRAPPING_WRAP = 0, - DWRITE_WORD_WRAPPING_NO_WRAP = 1, - DWRITE_WORD_WRAPPING_EMERGENCY_BREAK = 2, - DWRITE_WORD_WRAPPING_WHOLE_WORD = 3, - DWRITE_WORD_WRAPPING_CHARACTER = 4, -}} -ENUM!{enum DWRITE_LINE_SPACING_METHOD { - DWRITE_LINE_SPACING_METHOD_DEFAULT, - DWRITE_LINE_SPACING_METHOD_UNIFORM, - DWRITE_LINE_SPACING_METHOD_PROPORTIONAL, -}} -ENUM!{enum DWRITE_TRIMMING_GRANULARITY { - DWRITE_TRIMMING_GRANULARITY_NONE, - DWRITE_TRIMMING_GRANULARITY_CHARACTER, - DWRITE_TRIMMING_GRANULARITY_WORD, -}} -ENUM!{enum DWRITE_FONT_FEATURE_TAG { - DWRITE_FONT_FEATURE_TAG_ALTERNATIVE_FRACTIONS = 0x63726661, // 'afrc' - DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS_FROM_CAPITALS = 0x63703263, // 'c2pc' - DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS_FROM_CAPITALS = 0x63733263, // 'c2sc' - DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_ALTERNATES = 0x746c6163, // 'calt' - DWRITE_FONT_FEATURE_TAG_CASE_SENSITIVE_FORMS = 0x65736163, // 'case' - DWRITE_FONT_FEATURE_TAG_GLYPH_COMPOSITION_DECOMPOSITION = 0x706d6363, // 'ccmp' - DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_LIGATURES = 0x67696c63, // 'clig' - DWRITE_FONT_FEATURE_TAG_CAPITAL_SPACING = 0x70737063, // 'cpsp' - DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_SWASH = 0x68777363, // 'cswh' - DWRITE_FONT_FEATURE_TAG_CURSIVE_POSITIONING = 0x73727563, // 'curs' - DWRITE_FONT_FEATURE_TAG_DEFAULT = 0x746c6664, // 'dflt' - DWRITE_FONT_FEATURE_TAG_DISCRETIONARY_LIGATURES = 0x67696c64, // 'dlig' - DWRITE_FONT_FEATURE_TAG_EXPERT_FORMS = 0x74707865, // 'expt' - DWRITE_FONT_FEATURE_TAG_FRACTIONS = 0x63617266, // 'frac' - DWRITE_FONT_FEATURE_TAG_FULL_WIDTH = 0x64697766, // 'fwid' - DWRITE_FONT_FEATURE_TAG_HALF_FORMS = 0x666c6168, // 'half' - DWRITE_FONT_FEATURE_TAG_HALANT_FORMS = 0x6e6c6168, // 'haln' - DWRITE_FONT_FEATURE_TAG_ALTERNATE_HALF_WIDTH = 0x746c6168, // 'halt' - DWRITE_FONT_FEATURE_TAG_HISTORICAL_FORMS = 0x74736968, // 'hist' - DWRITE_FONT_FEATURE_TAG_HORIZONTAL_KANA_ALTERNATES = 0x616e6b68, // 'hkna' - DWRITE_FONT_FEATURE_TAG_HISTORICAL_LIGATURES = 0x67696c68, // 'hlig' - DWRITE_FONT_FEATURE_TAG_HALF_WIDTH = 0x64697768, // 'hwid' - DWRITE_FONT_FEATURE_TAG_HOJO_KANJI_FORMS = 0x6f6a6f68, // 'hojo' - DWRITE_FONT_FEATURE_TAG_JIS04_FORMS = 0x3430706a, // 'jp04' - DWRITE_FONT_FEATURE_TAG_JIS78_FORMS = 0x3837706a, // 'jp78' - DWRITE_FONT_FEATURE_TAG_JIS83_FORMS = 0x3338706a, // 'jp83' - DWRITE_FONT_FEATURE_TAG_JIS90_FORMS = 0x3039706a, // 'jp90' - DWRITE_FONT_FEATURE_TAG_KERNING = 0x6e72656b, // 'kern' - DWRITE_FONT_FEATURE_TAG_STANDARD_LIGATURES = 0x6167696c, // 'liga' - DWRITE_FONT_FEATURE_TAG_LINING_FIGURES = 0x6d756e6c, // 'lnum' - DWRITE_FONT_FEATURE_TAG_LOCALIZED_FORMS = 0x6c636f6c, // 'locl' - DWRITE_FONT_FEATURE_TAG_MARK_POSITIONING = 0x6b72616d, // 'mark' - DWRITE_FONT_FEATURE_TAG_MATHEMATICAL_GREEK = 0x6b72676d, // 'mgrk' - DWRITE_FONT_FEATURE_TAG_MARK_TO_MARK_POSITIONING = 0x6b6d6b6d, // 'mkmk' - DWRITE_FONT_FEATURE_TAG_ALTERNATE_ANNOTATION_FORMS = 0x746c616e, // 'nalt' - DWRITE_FONT_FEATURE_TAG_NLC_KANJI_FORMS = 0x6b636c6e, // 'nlck' - DWRITE_FONT_FEATURE_TAG_OLD_STYLE_FIGURES = 0x6d756e6f, // 'onum' - DWRITE_FONT_FEATURE_TAG_ORDINALS = 0x6e64726f, // 'ordn' - DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_ALTERNATE_WIDTH = 0x746c6170, // 'palt' - DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS = 0x70616370, // 'pcap' - DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_FIGURES = 0x6d756e70, // 'pnum' - DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_WIDTHS = 0x64697770, // 'pwid' - DWRITE_FONT_FEATURE_TAG_QUARTER_WIDTHS = 0x64697771, // 'qwid' - DWRITE_FONT_FEATURE_TAG_REQUIRED_LIGATURES = 0x67696c72, // 'rlig' - DWRITE_FONT_FEATURE_TAG_RUBY_NOTATION_FORMS = 0x79627572, // 'ruby' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_ALTERNATES = 0x746c6173, // 'salt' - DWRITE_FONT_FEATURE_TAG_SCIENTIFIC_INFERIORS = 0x666e6973, // 'sinf' - DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS = 0x70636d73, // 'smcp' - DWRITE_FONT_FEATURE_TAG_SIMPLIFIED_FORMS = 0x6c706d73, // 'smpl' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1 = 0x31307373, // 'ss01' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_2 = 0x32307373, // 'ss02' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_3 = 0x33307373, // 'ss03' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_4 = 0x34307373, // 'ss04' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_5 = 0x35307373, // 'ss05' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_6 = 0x36307373, // 'ss06' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_7 = 0x37307373, // 'ss07' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_8 = 0x38307373, // 'ss08' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_9 = 0x39307373, // 'ss09' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_10 = 0x30317373, // 'ss10' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_11 = 0x31317373, // 'ss11' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_12 = 0x32317373, // 'ss12' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_13 = 0x33317373, // 'ss13' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_14 = 0x34317373, // 'ss14' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_15 = 0x35317373, // 'ss15' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_16 = 0x36317373, // 'ss16' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_17 = 0x37317373, // 'ss17' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_18 = 0x38317373, // 'ss18' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_19 = 0x39317373, // 'ss19' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_20 = 0x30327373, // 'ss20' - DWRITE_FONT_FEATURE_TAG_SUBSCRIPT = 0x73627573, // 'subs' - DWRITE_FONT_FEATURE_TAG_SUPERSCRIPT = 0x73707573, // 'sups' - DWRITE_FONT_FEATURE_TAG_SWASH = 0x68737773, // 'swsh' - DWRITE_FONT_FEATURE_TAG_TITLING = 0x6c746974, // 'titl' - DWRITE_FONT_FEATURE_TAG_TRADITIONAL_NAME_FORMS = 0x6d616e74, // 'tnam' - DWRITE_FONT_FEATURE_TAG_TABULAR_FIGURES = 0x6d756e74, // 'tnum' - DWRITE_FONT_FEATURE_TAG_TRADITIONAL_FORMS = 0x64617274, // 'trad' - DWRITE_FONT_FEATURE_TAG_THIRD_WIDTHS = 0x64697774, // 'twid' - DWRITE_FONT_FEATURE_TAG_UNICASE = 0x63696e75, // 'unic' - DWRITE_FONT_FEATURE_TAG_VERTICAL_WRITING = 0x74726576, // 'vert' - DWRITE_FONT_FEATURE_TAG_VERTICAL_ALTERNATES_AND_ROTATION = 0x32747276, // 'vrt2' - DWRITE_FONT_FEATURE_TAG_SLASHED_ZERO = 0x6f72657a, // 'zero' -}} -STRUCT!{struct DWRITE_TEXT_RANGE { - startPosition: ::UINT32, - length: ::UINT32, -}} -STRUCT!{struct DWRITE_FONT_FEATURE { - nameTag: DWRITE_FONT_FEATURE_TAG, - parameter: ::UINT32, -}} -STRUCT!{struct DWRITE_TYPOGRAPHIC_FEATURES { - features: *mut DWRITE_FONT_FEATURE, - featureCount: ::UINT32, -}} -STRUCT!{struct DWRITE_TRIMMING { - granularity: DWRITE_TRIMMING_GRANULARITY, - delimiter: ::UINT32, - delimiterCount: ::UINT32, -}} -RIDL!{interface IDWriteTextFormat(IDWriteTextFormatVtbl): IUnknown(IUnknownVtbl) { - fn SetTextAlignment(&mut self, textAlignment: DWRITE_TEXT_ALIGNMENT) -> ::HRESULT, - fn SetParagraphAlignment( - &mut self, paragraphAlignment: DWRITE_PARAGRAPH_ALIGNMENT - ) -> ::HRESULT, - fn SetWordWrapping(&mut self, wordWrapping: DWRITE_WORD_WRAPPING) -> ::HRESULT, - fn SetReadingDirection(&mut self, readingDirection: DWRITE_READING_DIRECTION) -> ::HRESULT, - fn SetFlowDirection(&mut self, flowDirection: DWRITE_FLOW_DIRECTION) -> ::HRESULT, - fn SetIncrementalTabStop(&mut self, incrementalTabStop: ::FLOAT) -> ::HRESULT, - fn SetTrimming( - &mut self, trimmingOptions: *const DWRITE_TRIMMING, trimmingSign: *mut IDWriteInlineObject - ) -> ::HRESULT, - fn SetLineSpacing( - &mut self, lineSpacingMethod: DWRITE_LINE_SPACING_METHOD, lineSpacing: ::FLOAT, - baseLine: ::FLOAT - ) -> ::HRESULT, - fn GetTextAlignment(&mut self) -> DWRITE_TEXT_ALIGNMENT, - fn GetParagraphAlignment(&mut self) -> DWRITE_PARAGRAPH_ALIGNMENT, - fn GetWordWrapping(&mut self) -> DWRITE_WORD_WRAPPING, - fn GetReadingDirection(&mut self) -> DWRITE_READING_DIRECTION, - fn GetFlowDirection(&mut self) -> DWRITE_FLOW_DIRECTION, - fn GetIncrementalTabStop(&mut self) -> ::FLOAT, - fn GetTrimming( - &mut self, trimmingOptions: *mut DWRITE_TRIMMING, - trimmingSign: *mut *mut IDWriteInlineObject - ) -> ::HRESULT, - fn GetLineSpacing( - &mut self, lineSpacingMethod: *mut DWRITE_LINE_SPACING_METHOD, lineSpacing: *mut ::FLOAT, - baseline: *mut ::FLOAT - ) -> ::HRESULT, - fn GetFontCollection(&mut self, fontCollection: *mut *mut IDWriteFontCollection) -> ::HRESULT, - fn GetFontFamilyNameLength(&mut self) -> ::UINT32, - fn GetFontFamilyName(&mut self, fontFamilyName: *mut ::WCHAR, nameSize: ::UINT32) -> ::HRESULT, - fn GetFontWeight(&mut self) -> DWRITE_FONT_WEIGHT, - fn GetFontStyle(&mut self) -> DWRITE_FONT_STYLE, - fn GetFontStretch(&mut self) -> DWRITE_FONT_STRETCH, - fn GetFontSize(&mut self) -> ::FLOAT, - fn GetLocaleNameLength(&mut self) -> ::UINT32, - fn GetLocaleName(&mut self, localeName: *mut ::WCHAR, nameSize: ::UINT32) -> ::HRESULT -}} -RIDL!{interface IDWriteTypography(IDWriteTypographyVtbl): IUnknown(IUnknownVtbl) { - fn AddFontFeature(&mut self, fontFeature: DWRITE_FONT_FEATURE) -> ::HRESULT, - fn GetFontFeatureCount(&mut self) -> ::UINT32, - fn GetFontFeature( - &mut self, fontFeatureIndex: ::UINT32, fontFeature: *mut DWRITE_FONT_FEATURE - ) -> ::HRESULT -}} -FLAGS!{enum DWRITE_SCRIPT_SHAPES { - DWRITE_SCRIPT_SHAPES_DEFAULT = 0, - DWRITE_SCRIPT_SHAPES_NO_VISUAL = 1, -}} -STRUCT!{struct DWRITE_SCRIPT_ANALYSIS { - script: ::UINT16, - shapes: DWRITE_SCRIPT_SHAPES, -}} -ENUM!{enum DWRITE_BREAK_CONDITION { - DWRITE_BREAK_CONDITION_NEUTRAL, - DWRITE_BREAK_CONDITION_CAN_BREAK, - DWRITE_BREAK_CONDITION_MAY_NOT_BREAK, - DWRITE_BREAK_CONDITION_MUST_BREAK, -}} -STRUCT!{struct DWRITE_LINE_BREAKPOINT { - bit_fields: ::UINT8, -}} -BITFIELD!{DWRITE_LINE_BREAKPOINT bit_fields: ::UINT8 [ - breakConditionBefore set_breakConditionBefore[0..2], - breakConditionAfter set_breakConditionAfter[2..4], - isWhitespace set_isWhitespace[4..5], - isSoftHyphen set_isSoftHyphen[5..6], - padding set_padding[6..8], -]} -ENUM!{enum DWRITE_NUMBER_SUBSTITUTION_METHOD { - DWRITE_NUMBER_SUBSTITUTION_METHOD_FROM_CULTURE, - DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL, - DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE, - DWRITE_NUMBER_SUBSTITUTION_METHOD_NATIONAL, - DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL, -}} -RIDL!{interface IDWriteNumberSubstitution(IDWriteNumberSubstitutionVtbl): IUnknown(IUnknownVtbl) { -}} -STRUCT!{struct DWRITE_SHAPING_TEXT_PROPERTIES { - bit_fields: ::UINT16, -}} -BITFIELD!{DWRITE_SHAPING_TEXT_PROPERTIES bit_fields: ::UINT16 [ - isShapedAlone set_isShapedAlone[0..1], - reserved set_reserved[1..16], -]} -STRUCT!{struct DWRITE_SHAPING_GLYPH_PROPERTIES { - bit_fields: ::UINT16, -}} -BITFIELD!{DWRITE_SHAPING_GLYPH_PROPERTIES bit_fields: ::UINT16 [ - justification set_justification[0..4], - isClusterStart set_isClusterStart[4..5], - isDiacritic set_isDiacritic[5..6], - isZeroWidthSpace set_isZeroWidthSpace[6..7], - reserved set_reserved[7..16], -]} -RIDL!{interface IDWriteTextAnalysisSource(IDWriteTextAnalysisSourceVtbl): IUnknown(IUnknownVtbl) { - fn GetTextAtPosition( - &mut self, textPosition: ::UINT32, textString: *mut *const ::WCHAR, - textLength: *mut ::UINT32 - ) -> ::HRESULT, - fn GetTextBeforePosition( - &mut self, textPosition: ::UINT32, textString: *mut *const ::WCHAR, - textLength: *mut ::UINT32 - ) -> ::HRESULT, - fn GetParagraphReadingDirection(&mut self) -> DWRITE_READING_DIRECTION, - fn GetLocaleName( - &mut self, textPosition: ::UINT32, textLength: *mut ::UINT32, - localeName: *mut *const ::WCHAR - ) -> ::HRESULT, - fn GetNumberSubstitution( - &mut self, textPosition: ::UINT32, textLength: *mut ::UINT32, - numberSubstitution: *mut *mut IDWriteNumberSubstitution - ) -> ::HRESULT -}} -RIDL!{interface IDWriteTextAnalysisSink(IDWriteTextAnalysisSinkVtbl): IUnknown(IUnknownVtbl) { - fn SetScriptAnalysis( - &mut self, textPosition: ::UINT32, textLength: ::UINT32, - scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS - ) -> ::HRESULT, - fn SetLineBreakpoints( - &mut self, textPosition: ::UINT32, textLength: ::UINT32, - lineBreakpoints: *const DWRITE_LINE_BREAKPOINT - ) -> ::HRESULT, - fn SetBidiLevel( - &mut self, textPosition: ::UINT32, textLength: ::UINT32, explicitLevel: ::UINT8, - resolvedLevel: ::UINT8 - ) -> ::HRESULT, - fn SetNumberSubstitution( - &mut self, textPosition: ::UINT32, textLength: ::UINT32, - numberSubstitution: *mut IDWriteNumberSubstitution - ) -> ::HRESULT -}} -RIDL!{interface IDWriteTextAnalyzer(IDWriteTextAnalyzerVtbl): IUnknown(IUnknownVtbl) { - fn AnalyzeScript( - &mut self, analysisSource: *mut IDWriteTextAnalysisSource, textPosition: ::UINT32, - textLength: ::UINT32, analysisSink: *mut IDWriteTextAnalysisSink - ) -> ::HRESULT, - fn AnalyzeBidi( - &mut self, analysisSource: *mut IDWriteTextAnalysisSource, textPosition: ::UINT32, - textLength: ::UINT32, analysisSink: *mut IDWriteTextAnalysisSink - ) -> ::HRESULT, - fn AnalyzeNumberSubstitution( - &mut self, analysisSource: *mut IDWriteTextAnalysisSource, textPosition: ::UINT32, - textLength: ::UINT32, analysisSink: *mut IDWriteTextAnalysisSink - ) -> ::HRESULT, - fn AnalyzeLineBreakpoints( - &mut self, analysisSource: *mut IDWriteTextAnalysisSource, textPosition: ::UINT32, - textLength: ::UINT32, analysisSink: *mut IDWriteTextAnalysisSink - ) -> ::HRESULT, - fn GetGlyphs( - &mut self, textString: *const ::WCHAR, textLength: ::UINT32, - fontFace: *mut IDWriteFontFace, isSideways: ::BOOL, isRightToLeft: ::BOOL, - scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS, localeName: *const ::WCHAR, - numberSubstitution: *mut IDWriteNumberSubstitution, - features: *mut *const DWRITE_TYPOGRAPHIC_FEATURES, featureRangeLengths: *const ::UINT32, - featureRanges: ::UINT32, maxGlyphCount: ::UINT32, clusterMap: *mut ::UINT16, - textProps: *mut DWRITE_SHAPING_TEXT_PROPERTIES, glyphIndices: *mut ::UINT16, - glyphProps: *mut DWRITE_SHAPING_GLYPH_PROPERTIES, actualGlyphCount: *mut ::UINT32 - ) -> ::HRESULT, - fn GetGlyphPlacements( - &mut self, textString: *const ::WCHAR, clusterMap: *const ::UINT16, - textProps: *mut DWRITE_SHAPING_TEXT_PROPERTIES, textLength: ::UINT32, - glyphIndices: *const ::UINT16, glyphProps: *const DWRITE_SHAPING_GLYPH_PROPERTIES, - glyphCount: ::UINT32, fontFace: *mut IDWriteFontFace, fontEmSize: ::FLOAT, - isSideways: ::BOOL, isRightToLeft: ::BOOL, scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS, - localeName: *const ::WCHAR, features: *mut *const DWRITE_TYPOGRAPHIC_FEATURES, - featureRangeLengths: *const ::UINT32, featureRanges: ::UINT32, glyphAdvances: *mut ::FLOAT, - glyphOffsets: *mut DWRITE_GLYPH_OFFSET - ) -> ::HRESULT, - fn GetGdiCompatibleGlyphPlacements( - &mut self, textString: *const ::WCHAR, clusterMap: *const ::UINT16, - textProps: *mut DWRITE_SHAPING_TEXT_PROPERTIES, textLength: ::UINT32, - glyphIndices: *const ::UINT16, glyphProps: *const DWRITE_SHAPING_GLYPH_PROPERTIES, - glyphCount: ::UINT32, fontFace: *mut IDWriteFontFace, fontEmSize: ::FLOAT, - pixelsPerDip: ::FLOAT, transform: *const DWRITE_MATRIX, useGdiNatrual: ::BOOL, - isSideways: ::BOOL, isRightToLeft: ::BOOL, scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS, - localeName: *const ::WCHAR, features: *mut *const DWRITE_TYPOGRAPHIC_FEATURES, - featureRangeLengths: *const ::UINT32, featureRanges: ::UINT32, glyphAdvances: *mut ::FLOAT, - glyphOffsets: *mut DWRITE_GLYPH_OFFSET - ) -> ::HRESULT -}} -STRUCT!{struct DWRITE_GLYPH_RUN { - fontFace: *mut IDWriteFontFace, - fontEmSize: ::FLOAT, - glyphCount: ::UINT32, - glyphIndices: *const ::UINT16, - glyphAdvances: *const ::FLOAT, - glyphOffsets: *const DWRITE_GLYPH_OFFSET, - isSideways: ::BOOL, - bidiLevel: ::UINT32, -}} -STRUCT!{struct DWRITE_GLYPH_RUN_DESCRIPTION { - localeName: *const ::WCHAR, - string: *const ::WCHAR, - stringLength: ::UINT32, - clusterMap: *const ::UINT16, - textPosition: ::UINT32, -}} -STRUCT!{struct DWRITE_UNDERLINE { - width: ::FLOAT, - thickness: ::FLOAT, - offset: ::FLOAT, - runHeight: ::FLOAT, - readingDirection: DWRITE_READING_DIRECTION, - flowDirection: DWRITE_FLOW_DIRECTION, - localeName: *const ::WCHAR, - measuringMode: ::DWRITE_MEASURING_MODE, -}} -STRUCT!{struct DWRITE_STRIKETHROUGH { - width: ::FLOAT, - thickness: ::FLOAT, - offset: ::FLOAT, - readingDirection: DWRITE_READING_DIRECTION, - flowDirection: DWRITE_FLOW_DIRECTION, - localeName: *const ::WCHAR, - measuringMode: ::DWRITE_MEASURING_MODE, -}} -STRUCT!{struct DWRITE_LINE_METRICS { - length: ::UINT32, - trailingWhitespaceLength: ::UINT32, - newlineLength: ::UINT32, - height: ::FLOAT, - baseline: ::FLOAT, - isTrimmed: ::BOOL, -}} -STRUCT!{struct DWRITE_CLUSTER_METRICS { - width: ::FLOAT, - length: ::UINT16, - bit_fields: ::UINT16, -}} -BITFIELD!{DWRITE_CLUSTER_METRICS bit_fields: ::UINT16 [ - canWrapLineAfter set_canWrapLineAfter[0..1], - isWhitespace set_isWhitespace[1..2], - isNewline set_isNewline[2..3], - isSoftHyphen set_isSoftHyphen[3..4], - isRightToLeft set_isRightToLeft[4..5], - padding set_padding[5..16], -]} -STRUCT!{struct DWRITE_TEXT_METRICS { - left: ::FLOAT, - top: ::FLOAT, - width: ::FLOAT, - widthIncludingTrailingWhitespace: ::FLOAT, - height: ::FLOAT, - layoutWidth: ::FLOAT, - layoutHeight: ::FLOAT, - maxBidiReorderingDepth: ::UINT32, - lineCount: ::UINT32, -}} -STRUCT!{struct DWRITE_INLINE_OBJECT_METRICS { - width: ::FLOAT, - height: ::FLOAT, - baseline: ::FLOAT, - supportsSideways: ::BOOL, -}} -STRUCT!{struct DWRITE_OVERHANG_METRICS { - left: ::FLOAT, - top: ::FLOAT, - right: ::FLOAT, - bottom: ::FLOAT, -}} -STRUCT!{struct DWRITE_HIT_TEST_METRICS { - textPosition: ::UINT32, - length: ::UINT32, - left: ::FLOAT, - top: ::FLOAT, - width: ::FLOAT, - height: ::FLOAT, - bidiLevel: ::UINT32, - isText: ::BOOL, - isTrimmed: ::BOOL, -}} -RIDL!{interface IDWriteInlineObject(IDWriteInlineObjectVtbl): IUnknown(IUnknownVtbl) { - fn Draw( - &mut self, clientDrawingContext: *mut ::c_void, renderer: *mut IDWriteTextRenderer, - originX: ::FLOAT, originY: ::FLOAT, isSideways: ::BOOL, isRightToLeft: ::BOOL, - clientDrawingEffect: *mut ::IUnknown - ) -> ::HRESULT, - fn GetMetrics(&mut self, metrics: *mut DWRITE_INLINE_OBJECT_METRICS) -> ::HRESULT, - fn GetOverhangMetrics(&mut self, overhangs: *mut DWRITE_OVERHANG_METRICS) -> ::HRESULT, - fn GetBreakConditions( - &mut self, breakConditionBefore: *mut DWRITE_BREAK_CONDITION, - breakConditionAfter: *mut DWRITE_BREAK_CONDITION - ) -> ::HRESULT -}} -RIDL!{interface IDWritePixelSnapping(IDWritePixelSnappingVtbl): IUnknown(IUnknownVtbl) { - fn IsPixelSnappingDisabled( - &mut self, clientDrawingContext: *mut ::c_void, isDisabled: *mut ::BOOL - ) -> ::HRESULT, - fn GetCurrentTransform( - &mut self, clientDrawingContext: *mut ::c_void, transform: *mut DWRITE_MATRIX - ) -> ::HRESULT, - fn GetPixelsPerDip( - &mut self, clientDrawingContext: *mut ::c_void, pixelsPerDip: *mut ::FLOAT - ) -> ::HRESULT -}} -RIDL!{interface IDWriteTextRenderer(IDWriteTextRendererVtbl): - IDWritePixelSnapping(IDWritePixelSnappingVtbl) { - fn DrawGlyphRun( - &mut self, clientDrawingContext: *mut ::c_void, baselineOriginX: ::FLOAT, - baselineOriginY: ::FLOAT, measuringMode: ::DWRITE_MEASURING_MODE, - glyphRun: *const DWRITE_GLYPH_RUN, - glyphRunDescription: *const DWRITE_GLYPH_RUN_DESCRIPTION, - clientDrawingEffect: *mut ::IUnknown - ) -> ::HRESULT, - fn DrawUnderline( - &mut self, clientDrawingContext: *mut ::c_void, baselineOriginX: ::FLOAT, - baselineOriginY: ::FLOAT, underline: *const DWRITE_UNDERLINE, - clientDrawingEffect: *mut ::IUnknown - ) -> ::HRESULT, - fn DrawStrikethrough( - &mut self, clientDrawingContext: *mut ::c_void, baselineOriginX: ::FLOAT, - baselineOriginY: ::FLOAT, strikethrough: *const DWRITE_STRIKETHROUGH, - clientDrawingEffect: *mut ::IUnknown - ) -> ::HRESULT, - fn DrawInlineObject( - &mut self, clientDrawingContext: *mut ::c_void, baselineOriginX: ::FLOAT, - baselineOriginY: ::FLOAT, inlineObject: *mut IDWriteInlineObject, - isSideways: ::BOOL, isRightToLeft: ::BOOL, clientDrawingEffect: *mut ::IUnknown - ) -> ::HRESULT -}} -RIDL!{interface IDWriteTextLayout(IDWriteTextLayoutVtbl): - IDWriteTextFormat(IDWriteTextFormatVtbl) { - fn SetMaxWidth(&mut self, maxWidth: ::FLOAT) -> ::HRESULT, - fn SetMaxHeight(&mut self, maxHeight: ::FLOAT) -> ::HRESULT, - fn SetFontCollection( - &mut self, fontCollection: *mut IDWriteFontCollection, textRange: DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn SetFontFamilyName( - &mut self, fontFamilyName: *const ::WCHAR, textRange: DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn SetFontWeight( - &mut self, fontWeight: DWRITE_FONT_WEIGHT, textRange: DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn SetFontStyle( - &mut self, fontStyle: DWRITE_FONT_STYLE, textRange: DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn SetFontStretch( - &mut self, fontStretch: DWRITE_FONT_STRETCH, textRange: DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn SetFontSize(&mut self, fontSize: ::FLOAT, textRange: DWRITE_TEXT_RANGE) -> ::HRESULT, - fn SetUnderline(&mut self, hasUnderline: ::BOOL, textRange: DWRITE_TEXT_RANGE) -> ::HRESULT, - fn SetStrikethrough( - &mut self, hasStrikethrough: ::BOOL, textRange: DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn SetDrawingEffect( - &mut self, drawingEffect: *mut ::IUnknown, textRange: DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn SetInlineObject( - &mut self, inlineObject: *mut IDWriteInlineObject, textRange: DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn SetTypography( - &mut self, typography: *mut IDWriteTypography, textRange: DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn SetLocaleName( - &mut self, localeName: *const ::WCHAR, textRange: DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn GetMaxWidth(&mut self) -> ::FLOAT, - fn GetMaxHeight(&mut self) -> ::FLOAT, - fn GetFontCollection( - &mut self, currentPosition: ::UINT32, fontCollection: *mut *mut IDWriteFontCollection, - textRange: *mut DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn GetFontFamilyNameLength( - &mut self, currentPosition: ::UINT32, nameLength: *mut ::UINT32, - textRange: *mut DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn GetFontFamilyName( - &mut self, currentPosition: ::UINT32, fontFamilyName: *mut ::WCHAR, - nameSize: ::UINT32, textRange: *mut DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn GetFontWeight( - &mut self, currentPosition: ::UINT32, fontWeight: *mut DWRITE_FONT_WEIGHT, - textRange: *mut DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn GetFontStyle( - &mut self, currentPosition: ::UINT32, fontStyle: *mut DWRITE_FONT_STYLE, - textRange: *mut DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn GetFontStretch( - &mut self, currentPosition: ::UINT32, fontStretch: *mut DWRITE_FONT_STRETCH, - textRange: *mut DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn GetFontSize( - &mut self, currentPosition: ::UINT32, fontSize: *mut ::FLOAT, - textRange: *mut DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn GetUnderline( - &mut self, currentPosition: ::UINT32, hasUnderline: *mut ::BOOL, - textRange: *mut DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn GetStrikethrough( - &mut self, currentPosition: ::UINT32, hasStrikethrough: *mut ::BOOL, - textRange: *mut DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn GetDrawingEffect( - &mut self, currentPosition: ::UINT32, drawingEffect: *mut *mut ::IUnknown, - textRange: *mut DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn GetInlineObject( - &mut self, currentPosition: ::UINT32, inlineObject: *mut *mut IDWriteInlineObject, - textRange: *mut DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn GetTypography( - &mut self, currentPosition: ::UINT32, typography: *mut *mut IDWriteTypography, - textRange: *mut DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn GetLocaleNameLength( - &mut self, currentPosition: ::UINT32, nameLength: *mut ::UINT32, - textRange: *mut DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn GetLocaleName( - &mut self, currentPosition: ::UINT32, localeName: *mut ::WCHAR, nameSize: ::UINT32, - textRange: *mut DWRITE_TEXT_RANGE - ) -> ::HRESULT, - fn Draw( - &mut self, clientDrawingContext: *mut ::c_void, renderer: *mut IDWriteTextRenderer, - originX: ::FLOAT, originY: ::FLOAT - ) -> ::HRESULT, - fn GetLineMetrics( - &mut self, lineMetrics: *mut DWRITE_LINE_METRICS, maxLineCount: ::UINT32, - actualLineCount: *mut ::UINT32 - ) -> ::HRESULT, - fn GetMetrics(&mut self, textMetrics: *mut DWRITE_TEXT_METRICS) -> ::HRESULT, - fn GetOverhangMetrics(&mut self, overhangs: *mut DWRITE_OVERHANG_METRICS) -> ::HRESULT, - fn GetClusterMetrics( - &mut self, clusterMetrics: *mut DWRITE_CLUSTER_METRICS, maxClusterCount: ::UINT32, - actualClusterCount: *mut ::UINT32 - ) -> ::HRESULT, - fn DetermineMinWidth(&mut self, minWidth: *mut ::FLOAT) -> ::HRESULT, - fn HitTestPoint( - &mut self, pointX: ::FLOAT, pointY: ::FLOAT, isTrailingHit: *mut ::BOOL, - isInside: *mut ::BOOL, hitTestMetrics: *mut DWRITE_HIT_TEST_METRICS - ) -> ::HRESULT, - fn HitTestTextPosition( - &mut self, textPosition: ::UINT32, isTrailingHit: ::BOOL, pointX: *mut ::FLOAT, - pointY: *mut ::FLOAT, hitTestMetrics: *mut DWRITE_HIT_TEST_METRICS - ) -> ::HRESULT, - fn HitTestTextRange( - &mut self, textPosition: ::UINT32, textLength: ::UINT32, originX: ::FLOAT, - originY: ::FLOAT, hitTestMetrics: *mut DWRITE_HIT_TEST_METRICS, - maxHitTestMetricsCount: ::UINT32, actualHitTestMetricsCount: *mut ::UINT32 - ) -> ::HRESULT -}} -RIDL!{interface IDWriteBitmapRenderTarget(IDWriteBitmapRenderTargetVtbl): IUnknown(IUnknownVtbl) { - fn DrawGlyphRun( - &mut self, baselineOriginX: ::FLOAT, baselineOriginY: ::FLOAT, - measuringMode: ::DWRITE_MEASURING_MODE, glyphRun: *const ::DWRITE_GLYPH_RUN, - renderingParams: *mut IDWriteRenderingParams, textColor: ::COLORREF, - blackBoxRect: *mut ::RECT - ) -> ::HRESULT, - fn GetMemoryDC(&mut self) -> ::HDC, - fn GetPixelsPerDip(&mut self) -> ::FLOAT, - fn SetPixelsPerDip(&mut self, pixelsPerDip: ::FLOAT) -> ::HRESULT, - fn GetCurrentTransform(&mut self, transform: *mut DWRITE_MATRIX) -> ::HRESULT, - fn SetCurrentTransform(&mut self, transform: *const DWRITE_MATRIX) -> ::HRESULT, - fn GetSize(&mut self, size: *mut ::SIZE) -> ::HRESULT, - fn Resize(&mut self, width: ::UINT32, height: ::UINT32) -> ::HRESULT -}} -RIDL!{interface IDWriteGdiInterop(IDWriteGdiInteropVtbl): IUnknown(IUnknownVtbl) { - fn CreateFontFromLOGFONT( - &mut self, logFont: *const ::LOGFONTW, font: *mut *mut IDWriteFont - ) -> ::HRESULT, - fn ConvertFontToLOGFONT( - &mut self, font: *mut IDWriteFont, logFont: *mut ::LOGFONTW, isSystemFont: *mut ::BOOL - ) -> ::HRESULT, - fn ConvertFontFaceToLOGFONT( - &mut self, font: *mut IDWriteFontFace, logFont: *mut ::LOGFONTW - ) -> ::HRESULT, - fn CreateFontFaceFromHdc( - &mut self, hdc: ::HDC, fontFace: *mut *mut IDWriteFontFace - ) -> ::HRESULT, - fn CreateBitmapRenderTarget( - &mut self, hdc: ::HDC, width: ::UINT32, height: ::UINT32, - renderTarget: *mut *mut IDWriteBitmapRenderTarget - ) -> ::HRESULT -}} -ENUM!{enum DWRITE_TEXTURE_TYPE { - DWRITE_TEXTURE_ALIASED_1x1 = 0, - DWRITE_TEXTURE_CLEARTYPE_3x1 = 1, -}} -pub const DWRITE_ALPHA_MAX: ::BYTE = 255; -RIDL!{interface IDWriteGlyphRunAnalysis(IDWriteGlyphRunAnalysisVtbl): IUnknown(IUnknownVtbl) { - fn GetAlphaTextureBounds( - &mut self, textureType: DWRITE_TEXTURE_TYPE, textureBounds: *mut ::RECT - ) -> ::HRESULT, - fn CreateAlphaTexture( - &mut self, textureType: DWRITE_TEXTURE_TYPE, textureBounds: *const ::RECT, - alphaValues: *mut ::BYTE, bufferSize: ::UINT32 - ) -> ::HRESULT, - fn GetAlphaBlendParams( - &mut self, renderingParams: *mut IDWriteRenderingParams, blendGamma: *mut ::FLOAT, - blendEnhancedContrast: *mut ::FLOAT, blendClearTypeLevel: *mut ::FLOAT - ) -> ::HRESULT -}} -RIDL!{interface IDWriteFactory(IDWriteFactoryVtbl): IUnknown(IUnknownVtbl) { - fn GetSystemFontCollection( - &mut self, fontCollection: *mut *mut IDWriteFontCollection, checkForUpdates: ::BOOL - ) -> ::HRESULT, - fn CreateCustomFontCollection( - &mut self, collectionLoader: *mut IDWriteFontCollectionLoader, - collectionKey: *const ::c_void, collectionKeySize: ::UINT32, - fontCollection: *mut *mut IDWriteFontCollection - ) -> ::HRESULT, - fn RegisterFontCollectionLoader( - &mut self, fontCollectionLoader: *mut IDWriteFontCollectionLoader - ) -> ::HRESULT, - fn UnregisterFontCollectionLoader( - &mut self, fontCollectionLoader: *mut IDWriteFontCollectionLoader - ) -> ::HRESULT, - fn CreateFontFileReference( - &mut self, filePath: *const ::WCHAR, lastWriteTime: *const ::FILETIME, - fontFile: *mut *mut IDWriteFontFile - ) -> ::HRESULT, - fn CreateCustomFontFileReference( - &mut self, fontFileReferenceKey: *const ::c_void, fontFileReferenceKeySize: ::UINT32, - fontFileLoader: *mut IDWriteFontFileLoader, fontFile: *mut *mut IDWriteFontFile - ) -> ::HRESULT, - fn CreateFontFace( - &mut self, fontFaceType: DWRITE_FONT_FACE_TYPE, numberOfFiles: ::UINT32, - fontFiles: *const *mut IDWriteFontFile, faceIndex: ::UINT32, - fontFaceSimulationFlags: DWRITE_FONT_SIMULATIONS, fontFace: *mut *mut IDWriteFontFace - ) -> ::HRESULT, - fn CreateRenderingParams( - &mut self, renderingParams: *mut *mut IDWriteRenderingParams - ) -> ::HRESULT, - fn CreateMonitorRenderingParams( - &mut self, monitor: ::HMONITOR, renderingParams: *mut *mut IDWriteRenderingParams - ) -> ::HRESULT, - fn CreateCustomRenderingParams( - &mut self, gamma: ::FLOAT, enhancedContrast: ::FLOAT, clearTypeLevel: ::FLOAT, - pixelGeometry: DWRITE_PIXEL_GEOMETRY, renderingMode: DWRITE_RENDERING_MODE, - renderingParams: *mut *mut IDWriteRenderingParams - ) -> ::HRESULT, - fn RegisterFontFileLoader( - &mut self, fontFileLoader: *mut IDWriteFontFileLoader - ) -> ::HRESULT, - fn UnregisterFontFileLoader( - &mut self, fontFileLoader: *mut IDWriteFontFileLoader - ) -> ::HRESULT, - fn CreateTextFormat( - &mut self, fontFamilyName: *const ::WCHAR, fontCollection: *mut IDWriteFontCollection, - fontWeight: DWRITE_FONT_WEIGHT, fontStyle: DWRITE_FONT_STYLE, - fontStretch: DWRITE_FONT_STRETCH, fontSize: ::FLOAT, localeName: *const ::WCHAR, - textFormat: *mut *mut IDWriteTextFormat - ) -> ::HRESULT, - fn CreateTypography(&mut self, typography: *mut *mut IDWriteTypography) -> ::HRESULT, - fn GetGdiInterop(&mut self, gdiInterop: *mut *mut IDWriteGdiInterop) -> ::HRESULT, - fn CreateTextLayout( - &mut self, string: *const ::WCHAR, stringLength: ::UINT32, - textFormat: *mut IDWriteTextFormat, maxWidth: ::FLOAT, maxHeight: ::FLOAT, - textLayout: *mut *mut IDWriteTextLayout - ) -> ::HRESULT, - fn CreateGdiCompatibleTextLayout( - &mut self, string: *const ::WCHAR, stringLength: ::UINT32, - textFormat: *mut IDWriteTextFormat, layoutWidth: ::FLOAT, layoutHeight: ::FLOAT, - pixelsPerDip: ::FLOAT, transform: *const DWRITE_MATRIX, useGdiNatrual: ::BOOL, - textLayout: *mut *mut IDWriteTextLayout - ) -> ::HRESULT, - fn CreateEllipsisTrimmingSign( - &mut self, textFormat: *mut IDWriteTextFormat, trimmingSign: *mut *mut IDWriteInlineObject - ) -> ::HRESULT, - fn CreateTextAnalyzer(&mut self, textAnalyzer: *mut *mut IDWriteTextAnalyzer) -> ::HRESULT, - fn CreateNumberSubstitution( - &mut self, substitutionMethod: DWRITE_NUMBER_SUBSTITUTION_METHOD, - localeName: *const ::WCHAR, ignoreUserOverride: ::BOOL, - numberSubstitution: *mut *mut IDWriteNumberSubstitution - ) -> ::HRESULT, - fn CreateGlyphRunAnalysis( - &mut self, glyphRun: *const DWRITE_GLYPH_RUN, pixelsPerDip: ::FLOAT, - transform: *const DWRITE_MATRIX, renderingMode: DWRITE_RENDERING_MODE, - measuringMode: ::DWRITE_MEASURING_MODE, baselineOriginX: ::FLOAT, - baselineOriginY: ::FLOAT, glyphRunAnalysis: *mut *mut IDWriteGlyphRunAnalysis - ) -> ::HRESULT -}} -pub const FACILITY_DWRITE: ::HRESULT = 0x898; -pub const DWRITE_ERR_BASE: ::HRESULT = 0x5000; -#[inline] -pub fn MAKE_DWRITE_HR(severity: ::HRESULT, code: ::HRESULT) -> ::HRESULT { - ::MAKE_HRESULT(severity, FACILITY_DWRITE, DWRITE_ERR_BASE + code) -} -#[inline] -pub fn MAKE_DWRITE_HR_ERR(code: ::HRESULT) -> ::HRESULT { - MAKE_DWRITE_HR(::SEVERITY_ERROR, code) -} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/dxgi1_2.rs cargo-0.37.0/vendor/winapi-0.2.8/src/dxgi1_2.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/dxgi1_2.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/dxgi1_2.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,288 +0,0 @@ -// Copyright © 2015; Dmitry Roschin -// Licensed under the MIT License -//! Mappings for the contents of dxgi1_2.h - -ENUM!{ enum DXGI_ALPHA_MODE { - DXGI_ALPHA_MODE_UNSPECIFIED = 0, - DXGI_ALPHA_MODE_PREMULTIPLIED = 1, - DXGI_ALPHA_MODE_STRAIGHT = 2, - DXGI_ALPHA_MODE_IGNORE = 3, - DXGI_ALPHA_MODE_FORCE_DWORD = 0xFFFFFFFF, -}} - -ENUM!{ enum DXGI_COMPUTE_PREEMPTION_GRANULARITY { - DXGI_COMPUTE_PREEMPTION_DMA_BUFFER_BOUNDARY = 0, - DXGI_COMPUTE_PREEMPTION_DISPATCH_BOUNDARY = 1, - DXGI_COMPUTE_PREEMPTION_THREAD_GROUP_BOUNDARY = 2, - DXGI_COMPUTE_PREEMPTION_THREAD_BOUNDARY = 3, - DXGI_COMPUTE_PREEMPTION_INSTRUCTION_BOUNDARY = 4, -}} - -ENUM!{ enum DXGI_GRAPHICS_PREEMPTION_GRANULARITY { - DXGI_GRAPHICS_PREEMPTION_DMA_BUFFER_BOUNDARY = 0, - DXGI_GRAPHICS_PREEMPTION_PRIMITIVE_BOUNDARY = 1, - DXGI_GRAPHICS_PREEMPTION_TRIANGLE_BOUNDARY = 2, - DXGI_GRAPHICS_PREEMPTION_PIXEL_BOUNDARY = 3, - DXGI_GRAPHICS_PREEMPTION_INSTRUCTION_BOUNDARY = 4, -}} - -ENUM!{ enum DXGI_OUTDUPL_POINTER_SHAPE_TYPE { - DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MONOCHROME = 1, - DXGI_OUTDUPL_POINTER_SHAPE_TYPE_COLOR = 2, - DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MASKED_COLOR = 4, -}} - -ENUM!{ enum DXGI_SCALING { - DXGI_SCALING_STRETCH = 0, - DXGI_SCALING_NONE = 1, - DXGI_SCALING_ASPECT_RATIO_STRETCH = 2, -}} - -ENUM!{ enum _DXGI_OFFER_RESOURCE_PRIORITY { - DXGI_OFFER_RESOURCE_PRIORITY_LOW = 1, - DXGI_OFFER_RESOURCE_PRIORITY_NORMAL = 2, - DXGI_OFFER_RESOURCE_PRIORITY_HIGH = 3, -}} - -STRUCT!{nodebug struct DXGI_ADAPTER_DESC2 { - Description: [::WCHAR; 128], - VendorId: ::UINT, - DeviceId: ::UINT, - SubSysId: ::UINT, - Revision: ::UINT, - DedicatedVideoMemory: ::SIZE_T, - DedicatedSystemMemory: ::SIZE_T, - SharedSystemMemory: ::SIZE_T, - AdapterLuid: ::LUID, - Flags: ::UINT, - GraphicsPreemptionGranularity: ::DXGI_GRAPHICS_PREEMPTION_GRANULARITY, - ComputePreemptionGranularity: ::DXGI_COMPUTE_PREEMPTION_GRANULARITY, -}} - -STRUCT!{struct DXGI_MODE_DESC1 { - Width: ::UINT, - Height: ::UINT, - RefreshRate: ::DXGI_RATIONAL, - Format: ::DXGI_FORMAT, - ScanlineOrdering: ::DXGI_MODE_SCANLINE_ORDER, - Scaling: ::DXGI_MODE_SCALING, - Stereo: ::BOOL, -}} - -STRUCT!{struct DXGI_OUTDUPL_DESC { - ModeDesc: ::DXGI_MODE_DESC, - Rotation: ::DXGI_MODE_ROTATION, - DesktopImageInSystemMemory: ::BOOL, -}} - -STRUCT!{struct DXGI_OUTDUPL_FRAME_INFO { - LastPresentTime: ::LARGE_INTEGER, - LastMouseUpdateTime: ::LARGE_INTEGER, - AccumulatedFrames: ::UINT, - RectsCoalesced: ::BOOL, - ProtectedContentMaskedOut: ::BOOL, - PointerPosition: ::DXGI_OUTDUPL_POINTER_POSITION, - TotalMetadataBufferSize: ::UINT, - PointerShapeBufferSize: ::UINT, -}} - -STRUCT!{struct DXGI_OUTDUPL_MOVE_RECT { - SourcePoint: ::POINT, - DestinationRect: ::RECT, -}} - -STRUCT!{struct DXGI_OUTDUPL_POINTER_POSITION { - Position: ::POINT, - Visible: ::BOOL, -}} - -STRUCT!{struct DXGI_OUTDUPL_POINTER_SHAPE_INFO { - Type: ::UINT, - Width: ::UINT, - Height: ::UINT, - Pitch: ::UINT, - HotSpot: ::POINT, -}} - -STRUCT!{struct DXGI_PRESENT_PARAMETERS { - DirtyRectsCount: ::UINT, - pDirtyRects: *mut ::RECT, - pScrollRect: *mut ::RECT, - pScrollOffset: *mut ::POINT, -}} - -STRUCT!{struct DXGI_SWAP_CHAIN_DESC1 { - Width: ::UINT, - Height: ::UINT, - Format: ::DXGI_FORMAT, - Stereo: ::BOOL, - SampleDesc: ::DXGI_SAMPLE_DESC, - BufferUsage: ::DXGI_USAGE, - BufferCount: ::UINT, - Scaling: ::DXGI_SCALING, - SwapEffect: ::DXGI_SWAP_EFFECT, - AlphaMode: ::DXGI_ALPHA_MODE, - Flags: ::UINT, -}} - -STRUCT!{struct DXGI_SWAP_CHAIN_FULLSCREEN_DESC { - RefreshRate: ::DXGI_RATIONAL, - ScanlineOrdering: ::DXGI_MODE_SCANLINE_ORDER, - Scaling: ::DXGI_MODE_SCALING, - Windowed: ::BOOL, -}} - -RIDL!( -interface IDXGIAdapter2(IDXGIAdapter2Vtbl): IDXGIAdapter1(IDXGIAdapter1Vtbl) { - fn GetDesc2(&mut self, pDesc: *mut ::DXGI_ADAPTER_DESC2) -> ::HRESULT -}); - -RIDL!( -interface IDXGIDevice2(IDXGIDevice2Vtbl): IDXGIDevice1(IDXGIDevice1Vtbl) { - fn OfferResources( - &mut self, NumResources: ::UINT, ppResources: *mut *mut ::IDXGIResource, - Priority: ::DXGI_OFFER_RESOURCE_PRIORITY - ) -> ::HRESULT, - fn ReclaimResources( - &mut self, NumResources: ::UINT, ppResources: *mut *mut ::IDXGIResource, - pDiscarded: *mut ::BOOL - ) -> ::HRESULT, - fn EnqueueSetEvent(&mut self, hEvent: ::HANDLE) -> ::HRESULT -}); - -RIDL!( -interface IDXGIDisplayControl(IDXGIDisplayControlVtbl): IUnknown(IUnknownVtbl) { - fn IsStereoEnabled(&mut self) -> ::BOOL, - fn SetStereoEnabled(&mut self, enabled: ::BOOL) -> () -}); - -RIDL!( -interface IDXGIFactory2(IDXGIFactory2Vtbl): IDXGIFactory1(IDXGIFactory1Vtbl) { - fn IsWindowedStereoEnabled(&mut self) -> ::BOOL, - fn CreateSwapChainForHwnd( - &mut self, pDevice: *mut ::IUnknown, hWnd: ::HWND, pDesc: *const ::DXGI_SWAP_CHAIN_DESC1, - pFullscreenDesc: *const ::DXGI_SWAP_CHAIN_FULLSCREEN_DESC, - pRestrictToOutput: *mut ::IDXGIOutput, ppSwapChain: *mut *mut ::IDXGISwapChain1 - ) -> ::HRESULT, - fn CreateSwapChainForCoreWindow( - &mut self, pDevice: *mut ::IUnknown, pWindow: *mut ::IUnknown, - pDesc: *const ::DXGI_SWAP_CHAIN_DESC1, pRestrictToOutput: *mut ::IDXGIOutput, - ppSwapChain: *mut *mut ::IDXGISwapChain1 - ) -> ::HRESULT, - fn GetSharedResourceAdapterLuid( - &mut self, hResource: ::HANDLE, pLuid: *mut ::LUID - ) -> ::HRESULT, - fn RegisterStereoStatusWindow( - &mut self, WindowHandle: ::HWND, wMsg: ::UINT, pdwCookie: *mut ::DWORD - ) -> ::HRESULT, - fn RegisterStereoStatusEvent( - &mut self, hEvent: ::HANDLE, pdwCookie: *mut ::DWORD - ) -> ::HRESULT, - fn UnregisterStereoStatus(&mut self, dwCookie: ::DWORD) -> (), - fn RegisterOcclusionStatusWindow( - &mut self, WindowHandle: ::HWND, wMsg: ::UINT, pdwCookie: *mut ::DWORD - ) -> ::HRESULT, - fn RegisterOcclusionStatusEvent( - &mut self, hEvent: ::HANDLE, pdwCookie: *mut ::DWORD - ) -> ::HRESULT, - fn UnregisterOcclusionStatus(&mut self, dwCookie: ::DWORD) -> (), - fn CreateSwapChainForComposition( - &mut self, pDevice: *mut ::IUnknown, pDesc: *const ::DXGI_SWAP_CHAIN_DESC1, - pRestrictToOutput: *mut ::IDXGIOutput, ppSwapChain: *mut *mut ::IDXGISwapChain1 - ) -> ::HRESULT -}); - -RIDL!( -interface IDXGIOutput1(IDXGIOutput1Vtbl): IDXGIOutput(IDXGIOutputVtbl) { - fn GetDisplayModeList1( - &mut self, EnumFormat: ::DXGI_FORMAT, Flags: ::UINT, pNumModes: *mut ::UINT, - pDesc: *mut ::DXGI_MODE_DESC1 - ) -> ::HRESULT, - fn FindClosestMatchingMode1( - &mut self, pModeToMatch: *const ::DXGI_MODE_DESC1, pClosestMatch: *mut ::DXGI_MODE_DESC1, - pConcernedDevice: *mut ::IUnknown - ) -> ::HRESULT, - fn GetDisplaySurfaceData1( - &mut self, pDestination: *mut ::IDXGIResource - ) -> ::HRESULT, - fn DuplicateOutput( - &mut self, pDevice: *mut ::IUnknown, - ppOutputDuplication: *mut *mut ::IDXGIOutputDuplication - ) -> ::HRESULT -}); - -RIDL!( -interface IDXGIOutputDuplication(IDXGIOutputDuplicationVtbl): IDXGIObject(IDXGIObjectVtbl) { - fn GetDesc(&mut self, pDesc: *mut ::DXGI_OUTDUPL_DESC) -> (), - fn AcquireNextFrame( - &mut self, TimeoutInMilliseconds: ::UINT, pFrameInfo: *mut ::DXGI_OUTDUPL_FRAME_INFO, - ppDesktopResource: *mut *mut ::IDXGIResource - ) -> ::HRESULT, - fn GetFrameDirtyRects( - &mut self, DirtyRectsBufferSize: ::UINT, pDirtyRectsBuffer: *mut ::RECT, - pDirtyRectsBufferSizeRequired: *mut ::UINT - ) -> ::HRESULT, - fn GetFrameMoveRects( - &mut self, MoveRectsBufferSize: ::UINT, pMoveRectBuffer: *mut ::DXGI_OUTDUPL_MOVE_RECT, - pMoveRectsBufferSizeRequired: *mut ::UINT - ) -> ::HRESULT, - fn GetFramePointerShape( - &mut self, PointerShapeBufferSize: ::UINT, pPointerShapeBuffer: *mut ::c_void, - pPointerShapeBufferSizeRequired: *mut ::UINT, - pPointerShapeInfo: *mut ::DXGI_OUTDUPL_POINTER_SHAPE_INFO - ) -> ::HRESULT, - fn MapDesktopSurface( - &mut self, pLockedRect: *mut ::DXGI_MAPPED_RECT - ) -> ::HRESULT, - fn UnMapDesktopSurface(&mut self) -> ::HRESULT, - fn ReleaseFrame(&mut self) -> ::HRESULT -}); - -RIDL!( -interface IDXGIResource1(IDXGIResource1Vtbl): IDXGIResource(IDXGIResourceVtbl) { - fn CreateSubresourceSurface( - &mut self, index: ::UINT, ppSurface: *mut *mut ::IDXGISurface2 - ) -> ::HRESULT, - fn CreateSharedHandle( - &mut self, pAttributes: *const ::SECURITY_ATTRIBUTES, dwAccess: ::DWORD, lpName: ::LPCWSTR, - pHandle: *mut ::HANDLE - ) -> ::HRESULT -}); - -RIDL!( -interface IDXGISurface2(IDXGISurface2Vtbl): IDXGISurface1(IDXGISurface1Vtbl) { - fn GetResource( - &mut self, riid: ::REFGUID, ppParentResource: *mut *mut ::c_void, - pSubresourceIndex: *mut ::UINT - ) -> ::HRESULT -}); - -RIDL!( -interface IDXGISwapChain1(IDXGISwapChain1Vtbl): IDXGISwapChain(IDXGISwapChainVtbl) { - fn GetDesc1(&mut self, pDesc: *mut ::DXGI_SWAP_CHAIN_DESC1) -> ::HRESULT, - fn GetFullscreenDesc( - &mut self, pDesc: *mut ::DXGI_SWAP_CHAIN_FULLSCREEN_DESC - ) -> ::HRESULT, - fn GetHwnd(&mut self, pHwnd: *mut ::HWND) -> ::HRESULT, - fn GetCoreWindow( - &mut self, refiid: ::REFGUID, ppUnk: *mut *mut ::c_void - ) -> ::HRESULT, - fn Present1( - &mut self, SyncInterval: ::UINT, PresentFlags: ::UINT, - pPresentParameters: *const ::DXGI_PRESENT_PARAMETERS - ) -> ::HRESULT, - fn IsTemporaryMonoSupported(&mut self) -> ::BOOL, - fn GetRestrictToOutput( - &mut self, ppRestrictToOutput: *mut *mut ::IDXGIOutput - ) -> ::HRESULT, - fn SetBackgroundColor(&mut self, pColor: *const ::DXGI_RGBA) -> ::HRESULT, - fn GetBackgroundColor(&mut self, pColor: *mut ::DXGI_RGBA) -> ::HRESULT, - fn SetRotation(&mut self, Rotation: ::DXGI_MODE_ROTATION) -> ::HRESULT, - fn GetRotation(&mut self, pRotation: *mut ::DXGI_MODE_ROTATION) -> ::HRESULT -}); - -pub type DXGI_OFFER_RESOURCE_PRIORITY = ::_DXGI_OFFER_RESOURCE_PRIORITY; -pub const DXGI_ENUM_MODES_DISABLED_STEREO: ::UINT = 8; -pub const DXGI_ENUM_MODES_STEREO: ::UINT = 4; -pub const DXGI_SHARED_RESOURCE_READ: ::UINT = 0x80000000; -pub const DXGI_SHARED_RESOURCE_WRITE: ::UINT = 1; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/dxgi1_3.rs cargo-0.37.0/vendor/winapi-0.2.8/src/dxgi1_3.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/dxgi1_3.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/dxgi1_3.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,131 +0,0 @@ -// Copyright © 2015; Dmitry Roschin -// Licensed under the MIT License -//! Mappings for the contents of dxgi1_3.h - -ENUM!{ enum DXGI_FRAME_PRESENTATION_MODE { - DXGI_FRAME_PRESENTATION_MODE_COMPOSED = 0, - DXGI_FRAME_PRESENTATION_MODE_OVERLAY = 1, - DXGI_FRAME_PRESENTATION_MODE_NONE = 2, - DXGI_FRAME_PRESENTATION_MODE_COMPOSITION_FAILURE = 3, -}} - -FLAGS!{ enum DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS { - DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_NOMINAL_RANGE = 0x1, - DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_BT709 = 0x2, - DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_xvYCC = 0x4, -}} - -FLAGS!{ enum DXGI_OVERLAY_SUPPORT_FLAG { - DXGI_OVERLAY_SUPPORT_FLAG_DIRECT = 0x1, - DXGI_OVERLAY_SUPPORT_FLAG_SCALING = 0x2, -}} - -STRUCT!{struct DXGI_DECODE_SWAP_CHAIN_DESC { - Flags: ::UINT, -}} - -STRUCT!{struct DXGI_FRAME_STATISTICS_MEDIA { - PresentCount: ::UINT, - PresentRefreshCount: ::UINT, - SyncRefreshCount: ::UINT, - SyncQPCTime: ::LARGE_INTEGER, - SyncGPUTime: ::LARGE_INTEGER, - CompositionMode: ::DXGI_FRAME_PRESENTATION_MODE, - ApprovedPresentDuration: ::UINT, -}} - -STRUCT!{struct DXGI_MATRIX_3X2_F { - _11: ::FLOAT, - _12: ::FLOAT, - _21: ::FLOAT, - _22: ::FLOAT, - _31: ::FLOAT, - _32: ::FLOAT, -}} - -RIDL!( -interface IDXGIDecodeSwapChain(IDXGIDecodeSwapChainVtbl): IUnknown(IUnknownVtbl) { - fn PresentBuffer( - &mut self, BufferToPresent: ::UINT, SyncInterval: ::UINT, Flags: ::UINT - ) -> ::HRESULT, - fn SetSourceRect(&mut self, pRect: *const ::RECT) -> ::HRESULT, - fn SetTargetRect(&mut self, pRect: *const ::RECT) -> ::HRESULT, - fn SetDestSize(&mut self, Width: ::UINT, Height: ::UINT) -> ::HRESULT, - fn GetSourceRect(&mut self, pRect: *mut ::RECT) -> ::HRESULT, - fn GetTargetRect(&mut self, pRect: *mut ::RECT) -> ::HRESULT, - fn GetDestSize( - &mut self, pWidth: *mut ::UINT, pHeight: *mut ::UINT - ) -> ::HRESULT, - fn SetColorSpace( - &mut self, ColorSpace: ::DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS - ) -> ::HRESULT, - fn GetColorSpace(&mut self) -> ::DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS -}); - -RIDL!( -interface IDXGIDevice3(IDXGIDevice3Vtbl): IDXGIDevice2(IDXGIDevice2Vtbl) { - fn Trim(&mut self) -> () -}); - -RIDL!( -interface IDXGIFactory3(IDXGIFactory3Vtbl): IDXGIFactory2(IDXGIFactory2Vtbl) { - fn GetCreationFlags(&mut self) -> ::UINT -}); - -RIDL!( -interface IDXGIFactoryMedia(IDXGIFactoryMediaVtbl): IUnknown(IUnknownVtbl) { - fn CreateSwapChainForCompositionSurfaceHandle( - &mut self, pDevice: *mut ::IUnknown, hSurface: ::HANDLE, - pDesc: *const ::DXGI_SWAP_CHAIN_DESC1, pRestrictToOutput: *mut ::IDXGIOutput, - ppSwapChain: *mut *mut ::IDXGISwapChain1 - ) -> ::HRESULT, - fn CreateDecodeSwapChainForCompositionSurfaceHandle( - &mut self, pDevice: *mut ::IUnknown, hSurface: ::HANDLE, - pDesc: *mut ::DXGI_DECODE_SWAP_CHAIN_DESC, pYuvDecodeBuffers: *mut ::IDXGIResource, - pRestrictToOutput: *mut ::IDXGIOutput, ppSwapChain: *mut *mut ::IDXGIDecodeSwapChain - ) -> ::HRESULT -}); - -RIDL!( -interface IDXGIOutput2(IDXGIOutput2Vtbl): IDXGIOutput1(IDXGIOutput1Vtbl) { - fn SupportsOverlays(&mut self) -> ::BOOL -}); - -RIDL!( -interface IDXGIOutput3(IDXGIOutput3Vtbl): IDXGIOutput2(IDXGIOutput2Vtbl) { - fn CheckOverlaySupport( - &mut self, EnumFormat: ::DXGI_FORMAT, pConcernedDevice: *mut ::IUnknown, - pFlags: *mut ::UINT - ) -> ::HRESULT -}); - -RIDL!( -interface IDXGISwapChain2(IDXGISwapChain2Vtbl): IDXGISwapChain1(IDXGISwapChain1Vtbl) { - fn SetSourceSize(&mut self, Width: ::UINT, Height: ::UINT) -> ::HRESULT, - fn GetSourceSize( - &mut self, pWidth: *mut ::UINT, pHeight: *mut ::UINT - ) -> ::HRESULT, - fn SetMaximumFrameLatency(&mut self, MaxLatency: ::UINT) -> ::HRESULT, - fn GetMaximumFrameLatency(&mut self, pMaxLatency: *mut ::UINT) -> ::HRESULT, - fn GetFrameLatencyWaitableObject(&mut self) -> ::HANDLE, - fn SetMatrixTransform( - &mut self, pMatrix: *const ::DXGI_MATRIX_3X2_F - ) -> ::HRESULT, - fn GetMatrixTransform( - &mut self, pMatrix: *mut ::DXGI_MATRIX_3X2_F - ) -> ::HRESULT -}); - -RIDL!( -interface IDXGISwapChainMedia(IDXGISwapChainMediaVtbl): IUnknown(IUnknownVtbl) { - fn GetFrameStatisticsMedia( - &mut self, pStats: *mut ::DXGI_FRAME_STATISTICS_MEDIA - ) -> ::HRESULT, - fn SetPresentDuration(&mut self, Duration: ::UINT) -> ::HRESULT, - fn CheckPresentDurationSupport( - &mut self, DesiredPresentDuration: ::UINT, pClosestSmallerPresentDuration: *mut ::UINT, - pClosestLargerPresentDuration: *mut ::UINT - ) -> ::HRESULT -}); - -pub const DXGI_CREATE_FACTORY_DEBUG: ::UINT = 0x1; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/dxgi1_4.rs cargo-0.37.0/vendor/winapi-0.2.8/src/dxgi1_4.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/dxgi1_4.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/dxgi1_4.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -// Copyright © 2015; Dmitry Roschin -// Licensed under the MIT License -//! Mappings for the contents of dxgi1_4.h - -ENUM!{ enum DXGI_MEMORY_SEGMENT_GROUP { - DXGI_MEMORY_SEGMENT_GROUP_LOCAL = 0, - DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL = 1, -}} - -FLAGS!{ enum DXGI_OVERLAY_COLOR_SPACE_SUPPORT_FLAG { - DXGI_OVERLAY_COLOR_SPACE_SUPPORT_FLAG_PRESENT = 0x1, -}} - -FLAGS!{ enum DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG { - DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT = 0x1, - DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_OVERLAY_PRESENT = 0x2, -}} - -STRUCT!{struct DXGI_QUERY_VIDEO_MEMORY_INFO { - Budget: ::UINT64, - CurrentUsage: ::UINT64, - AvailableForReservation: ::UINT64, - CurrentReservation: ::UINT64, -}} - -RIDL!( -interface IDXGIAdapter3(IDXGIAdapter3Vtbl): IDXGIAdapter2(IDXGIAdapter2Vtbl) { - fn RegisterHardwareContentProtectionTeardownStatusEvent( - &mut self, hEvent: ::HANDLE, pdwCookie: *mut ::DWORD - ) -> ::HRESULT, - fn UnregisterHardwareContentProtectionTeardownStatus( - &mut self, dwCookie: ::DWORD - ) -> (), - fn QueryVideoMemoryInfo( - &mut self, NodeIndex: ::UINT, MemorySegmentGroup: ::DXGI_MEMORY_SEGMENT_GROUP, - pVideoMemoryInfo: *mut ::DXGI_QUERY_VIDEO_MEMORY_INFO - ) -> ::HRESULT, - fn SetVideoMemoryReservation( - &mut self, NodeIndex: ::UINT, MemorySegmentGroup: ::DXGI_MEMORY_SEGMENT_GROUP, - Reservation: ::UINT64 - ) -> ::HRESULT, - fn RegisterVideoMemoryBudgetChangeNotificationEvent( - &mut self, hEvent: ::HANDLE, pdwCookie: *mut ::DWORD - ) -> ::HRESULT, - fn UnregisterVideoMemoryBudgetChangeNotification( - &mut self, dwCookie: ::DWORD - ) -> () -}); - -RIDL!( -interface IDXGIFactory4(IDXGIFactory4Vtbl): IDXGIFactory3(IDXGIFactory3Vtbl) { - fn EnumAdapterByLuid( - &mut self, AdapterLuid: ::LUID, riid: ::REFGUID, ppvAdapter: *mut *mut ::c_void - ) -> ::HRESULT, - fn EnumWarpAdapter( - &mut self, riid: ::REFGUID, ppvAdapter: *mut *mut ::c_void - ) -> ::HRESULT -}); - -RIDL!( -interface IDXGIOutput4(IDXGIOutput4Vtbl): IDXGIOutput3(IDXGIOutput3Vtbl) { - fn CheckOverlayColorSpaceSupport( - &mut self, Format: ::DXGI_FORMAT, ColorSpace: ::DXGI_COLOR_SPACE_TYPE, - pConcernedDevice: *mut ::IUnknown, pFlags: *mut ::UINT - ) -> ::HRESULT -}); - -RIDL!( -interface IDXGISwapChain3(IDXGISwapChain3Vtbl): IDXGISwapChain2(IDXGISwapChain2Vtbl) { - fn GetCurrentBackBufferIndex(&mut self) -> ::UINT, - fn CheckColorSpaceSupport( - &mut self, ColorSpace: ::DXGI_COLOR_SPACE_TYPE, pColorSpaceSupport: *mut ::UINT - ) -> ::HRESULT, - fn SetColorSpace1( - &mut self, ColorSpace: ::DXGI_COLOR_SPACE_TYPE - ) -> ::HRESULT, - fn ResizeBuffers1( - &mut self, BufferCount: ::UINT, Width: ::UINT, Height: ::UINT, Format: ::DXGI_FORMAT, - SwapChainFlags: ::UINT, pCreationNodeMask: *const ::UINT, - ppPresentQueue: *mut *mut ::IUnknown - ) -> ::HRESULT -}); diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/dxgiformat.rs cargo-0.37.0/vendor/winapi-0.2.8/src/dxgiformat.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/dxgiformat.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/dxgiformat.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,124 +0,0 @@ -// Copyright © 2015, Connor Hilarides -// Licensed under the MIT License -//! Mappings for the contents of dxgiformat.h -ENUM!{enum DXGI_FORMAT { - DXGI_FORMAT_UNKNOWN = 0, - DXGI_FORMAT_R32G32B32A32_TYPELESS = 1, - DXGI_FORMAT_R32G32B32A32_FLOAT = 2, - DXGI_FORMAT_R32G32B32A32_UINT = 3, - DXGI_FORMAT_R32G32B32A32_SINT = 4, - DXGI_FORMAT_R32G32B32_TYPELESS = 5, - DXGI_FORMAT_R32G32B32_FLOAT = 6, - DXGI_FORMAT_R32G32B32_UINT = 7, - DXGI_FORMAT_R32G32B32_SINT = 8, - DXGI_FORMAT_R16G16B16A16_TYPELESS = 9, - DXGI_FORMAT_R16G16B16A16_FLOAT = 10, - DXGI_FORMAT_R16G16B16A16_UNORM = 11, - DXGI_FORMAT_R16G16B16A16_UINT = 12, - DXGI_FORMAT_R16G16B16A16_SNORM = 13, - DXGI_FORMAT_R16G16B16A16_SINT = 14, - DXGI_FORMAT_R32G32_TYPELESS = 15, - DXGI_FORMAT_R32G32_FLOAT = 16, - DXGI_FORMAT_R32G32_UINT = 17, - DXGI_FORMAT_R32G32_SINT = 18, - DXGI_FORMAT_R32G8X24_TYPELESS = 19, - DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20, - DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21, - DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22, - DXGI_FORMAT_R10G10B10A2_TYPELESS = 23, - DXGI_FORMAT_R10G10B10A2_UNORM = 24, - DXGI_FORMAT_R10G10B10A2_UINT = 25, - DXGI_FORMAT_R11G11B10_FLOAT = 26, - DXGI_FORMAT_R8G8B8A8_TYPELESS = 27, - DXGI_FORMAT_R8G8B8A8_UNORM = 28, - DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29, - DXGI_FORMAT_R8G8B8A8_UINT = 30, - DXGI_FORMAT_R8G8B8A8_SNORM = 31, - DXGI_FORMAT_R8G8B8A8_SINT = 32, - DXGI_FORMAT_R16G16_TYPELESS = 33, - DXGI_FORMAT_R16G16_FLOAT = 34, - DXGI_FORMAT_R16G16_UNORM = 35, - DXGI_FORMAT_R16G16_UINT = 36, - DXGI_FORMAT_R16G16_SNORM = 37, - DXGI_FORMAT_R16G16_SINT = 38, - DXGI_FORMAT_R32_TYPELESS = 39, - DXGI_FORMAT_D32_FLOAT = 40, - DXGI_FORMAT_R32_FLOAT = 41, - DXGI_FORMAT_R32_UINT = 42, - DXGI_FORMAT_R32_SINT = 43, - DXGI_FORMAT_R24G8_TYPELESS = 44, - DXGI_FORMAT_D24_UNORM_S8_UINT = 45, - DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46, - DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47, - DXGI_FORMAT_R8G8_TYPELESS = 48, - DXGI_FORMAT_R8G8_UNORM = 49, - DXGI_FORMAT_R8G8_UINT = 50, - DXGI_FORMAT_R8G8_SNORM = 51, - DXGI_FORMAT_R8G8_SINT = 52, - DXGI_FORMAT_R16_TYPELESS = 53, - DXGI_FORMAT_R16_FLOAT = 54, - DXGI_FORMAT_D16_UNORM = 55, - DXGI_FORMAT_R16_UNORM = 56, - DXGI_FORMAT_R16_UINT = 57, - DXGI_FORMAT_R16_SNORM = 58, - DXGI_FORMAT_R16_SINT = 59, - DXGI_FORMAT_R8_TYPELESS = 60, - DXGI_FORMAT_R8_UNORM = 61, - DXGI_FORMAT_R8_UINT = 62, - DXGI_FORMAT_R8_SNORM = 63, - DXGI_FORMAT_R8_SINT = 64, - DXGI_FORMAT_A8_UNORM = 65, - DXGI_FORMAT_R1_UNORM = 66, - DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67, - DXGI_FORMAT_R8G8_B8G8_UNORM = 68, - DXGI_FORMAT_G8R8_G8B8_UNORM = 69, - DXGI_FORMAT_BC1_TYPELESS = 70, - DXGI_FORMAT_BC1_UNORM = 71, - DXGI_FORMAT_BC1_UNORM_SRGB = 72, - DXGI_FORMAT_BC2_TYPELESS = 73, - DXGI_FORMAT_BC2_UNORM = 74, - DXGI_FORMAT_BC2_UNORM_SRGB = 75, - DXGI_FORMAT_BC3_TYPELESS = 76, - DXGI_FORMAT_BC3_UNORM = 77, - DXGI_FORMAT_BC3_UNORM_SRGB = 78, - DXGI_FORMAT_BC4_TYPELESS = 79, - DXGI_FORMAT_BC4_UNORM = 80, - DXGI_FORMAT_BC4_SNORM = 81, - DXGI_FORMAT_BC5_TYPELESS = 82, - DXGI_FORMAT_BC5_UNORM = 83, - DXGI_FORMAT_BC5_SNORM = 84, - DXGI_FORMAT_B5G6R5_UNORM = 85, - DXGI_FORMAT_B5G5R5A1_UNORM = 86, - DXGI_FORMAT_B8G8R8A8_UNORM = 87, - DXGI_FORMAT_B8G8R8X8_UNORM = 88, - DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89, - DXGI_FORMAT_B8G8R8A8_TYPELESS = 90, - DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91, - DXGI_FORMAT_B8G8R8X8_TYPELESS = 92, - DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93, - DXGI_FORMAT_BC6H_TYPELESS = 94, - DXGI_FORMAT_BC6H_UF16 = 95, - DXGI_FORMAT_BC6H_SF16 = 96, - DXGI_FORMAT_BC7_TYPELESS = 97, - DXGI_FORMAT_BC7_UNORM = 98, - DXGI_FORMAT_BC7_UNORM_SRGB = 99, - DXGI_FORMAT_AYUV = 100, - DXGI_FORMAT_Y410 = 101, - DXGI_FORMAT_Y416 = 102, - DXGI_FORMAT_NV12 = 103, - DXGI_FORMAT_P010 = 104, - DXGI_FORMAT_P016 = 105, - DXGI_FORMAT_420_OPAQUE = 106, - DXGI_FORMAT_YUY2 = 107, - DXGI_FORMAT_Y210 = 108, - DXGI_FORMAT_Y216 = 109, - DXGI_FORMAT_NV11 = 110, - DXGI_FORMAT_AI44 = 111, - DXGI_FORMAT_IA44 = 112, - DXGI_FORMAT_P8 = 113, - DXGI_FORMAT_A8P8 = 114, - DXGI_FORMAT_B4G4R4A4_UNORM = 115, - DXGI_FORMAT_P208 = 130, - DXGI_FORMAT_V208 = 131, - DXGI_FORMAT_V408 = 132, -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/dxgi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/dxgi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/dxgi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/dxgi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,240 +0,0 @@ -// Copyright © 2015; Connor Hilarides -// Licensed under the MIT License -//! Mappings for the contents of dxgi.h -STRUCT!{struct DXGI_FRAME_STATISTICS { - PresentCount: ::UINT, - PresentRefreshCount: ::UINT, - SyncRefreshCount: ::UINT, - SyncQPCTime: ::LARGE_INTEGER, - SyncGPUTime: ::LARGE_INTEGER, -}} -STRUCT!{struct DXGI_MAPPED_RECT { - Pitch: ::INT, - pBits: *mut ::BYTE, -}} -STRUCT!{nodebug struct DXGI_ADAPTER_DESC { - Description: [::WCHAR; 128], - VectorId: ::UINT, - DeviceId: ::UINT, - SubSysId: ::UINT, - Revision: ::UINT, - DedicatedVideoMemory: ::SIZE_T, - DedicatedSystemMemory: ::SIZE_T, - SharedSystemMemory: ::SIZE_T, - AdapterLuid: ::LUID, -}} -STRUCT!{nodebug struct DXGI_OUTPUT_DESC { - DeviceName: [::WCHAR; 32], - DesktopCoordinates: ::RECT, - AttachedToDesktop: ::BOOL, - Rotation: ::DXGI_MODE_ROTATION, - Monitor: ::HMONITOR, -}} -STRUCT!{struct DXGI_SHARED_RESOURCE { - Handle: ::HANDLE, -}} -pub const DXGI_RESOURCE_PRIORITY_MINIMUM: ::DWORD = 0x28000000; -pub const DXGI_RESOURCE_PRIORITY_LOW: ::DWORD = 0x50000000; -pub const DXGI_RESOURCE_PRIORITY_NORMAL: ::DWORD = 0x78000000; -pub const DXGI_RESOURCE_PRIORITY_HIGH: ::DWORD = 0xa0000000; -pub const DXGI_RESOURCE_PRIORITY_MAXIMUM: ::DWORD = 0xc8000000; -ENUM!{enum DXGI_RESIDENCY { - DXGI_RESIDENCY_FULLY_RESIDENT = 1, - DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY = 2, - DXGI_RESIDENCY_EVICTED_TO_DISK = 3, -}} -STRUCT!{struct DXGI_SURFACE_DESC { - Width: ::UINT, - Height: ::UINT, - Format: ::DXGI_FORMAT, - SampleDesc: ::DXGI_SAMPLE_DESC, -}} -ENUM!{enum DXGI_SWAP_EFFECT { - DXGI_SWAP_EFFECT_DISCARD = 0, - DXGI_SWAP_EFFECT_SEQUENTIAL = 1, - DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL = 3, -}} -FLAGS!{enum DXGI_SWAP_CHAIN_FLAG { - DXGI_SWAP_CHAIN_FLAG_NONPREROTATED = 1, - DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH = 2, - DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE = 4, - DXGI_SWAP_CHAIN_FLAG_RESTRICTED_CONTENT = 8, - DXGI_SWAP_CHAIN_FLAG_RESTRICT_SHARED_RESOURCE_DRIVER = 16, - DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY = 32, - DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT = 64, - DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER = 128, - DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO = 256, - DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO = 512, -}} -STRUCT!{struct DXGI_SWAP_CHAIN_DESC { - BufferDesc: ::DXGI_MODE_DESC, - SampleDesc: ::DXGI_SAMPLE_DESC, - BufferUsage: ::DXGI_USAGE, - BufferCount: ::UINT, - OutputWindow: ::HWND, - Windowed: ::BOOL, - SwapEffect: DXGI_SWAP_EFFECT, - Flags: ::UINT, -}} -RIDL!( -interface IDXGIObject(IDXGIObjectVtbl): IUnknown(IUnknownVtbl) { - fn SetPrivateData( - &mut self, Name: ::REFGUID, DataSize: ::UINT, pData: *const ::c_void - ) -> ::HRESULT, - fn SetPrivateDataInterface(&mut self, Name: ::REFGUID, pUnknown: *const ::IUnknown) -> ::HRESULT, - fn GetPrivateData( - &mut self, Name: ::REFGUID, pDataSize: *mut ::UINT, pData: *mut ::c_void - ) -> ::HRESULT, - fn GetParent( - &mut self, riid: ::REFIID, ppParent: *mut *mut ::c_void - ) -> ::HRESULT -}); -RIDL!( -interface IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl): IDXGIObject(IDXGIObjectVtbl) { - fn GetDevice(&mut self, riid: ::REFIID, ppDevice: *mut *mut ::c_void) -> ::HRESULT -}); -RIDL!( -interface IDXGIResource(IDXGIResourceVtbl): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl) { - fn GetSharedHandle(&mut self, pSharedHandle: *mut ::HANDLE) -> ::HRESULT, - fn GetUsage(&mut self, pUsage: *mut ::DXGI_USAGE) -> ::HRESULT, - fn SetEvictionPriority(&mut self, EvictionPriority: ::UINT) -> ::HRESULT, - fn GetEvictionPriority(&mut self, pEvictionPriority: *mut ::UINT) -> ::HRESULT -}); -RIDL!( -interface IDXGIKeyedMutex(IDXGIKeyedMutexVtbl): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl) { - fn AcquireSync(&mut self, Key: ::UINT64, dwMilliseconds: ::DWORD) -> ::HRESULT, - fn ReleaseSync(&mut self, Key: ::UINT64) -> ::HRESULT -}); -RIDL!( -interface IDXGISurface(IDXGISurfaceVtbl): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl) { - fn GetDesc(&mut self, pDesc: *mut DXGI_SURFACE_DESC) -> ::HRESULT, - fn Map(&mut self, pLockedRect: *mut DXGI_MAPPED_RECT, MapFlags: ::UINT) -> ::HRESULT, - fn Unmap(&mut self) -> ::HRESULT -}); -RIDL!( -interface IDXGISurface1(IDXGISurface1Vtbl): IDXGISurface(IDXGISurfaceVtbl) { - fn GetDC(&mut self, Discard: ::BOOL, phdc: *mut ::HDC) -> ::HRESULT, - fn ReleaseDC(&mut self, pDirtyRect: *mut ::RECT) -> ::HRESULT -}); -RIDL!( -interface IDXGIAdapter(IDXGIAdapterVtbl): IDXGIObject(IDXGIObjectVtbl) { - fn EnumOutputs(&mut self, Output: ::UINT, ppOutput: *mut *mut IDXGIOutput) -> ::HRESULT, - fn GetDesc(&mut self, pDesc: *mut DXGI_ADAPTER_DESC) -> ::HRESULT, - fn CheckInterfaceSupport( - &mut self, InterfaceName: ::REFGUID, pUMDVersion: *mut ::LARGE_INTEGER - ) -> ::HRESULT -}); -RIDL!( -interface IDXGIOutput(IDXGIOutputVtbl): IDXGIObject(IDXGIObjectVtbl) { - fn GetDesc(&mut self, pDesc: *mut DXGI_OUTPUT_DESC) -> ::HRESULT, - fn GetDisplayModeList( - &mut self, EnumFormat: ::DXGI_FORMAT, Flags: ::UINT, pNumModes: *mut ::UINT, - pDesc: *mut ::DXGI_MODE_DESC - ) -> ::HRESULT, - fn FindClosestMatchingMode( - &mut self, pModeToMatch: *const ::DXGI_MODE_DESC, pClosestMatch: *mut ::DXGI_MODE_DESC, - pConcernedDevice: *mut ::IUnknown - ) -> ::HRESULT, - fn WaitForVBlank(&mut self) -> ::HRESULT, - fn TakeOwnership(&mut self, pDevice: *mut ::IUnknown, Exclusive: ::BOOL) -> ::HRESULT, - fn ReleaseOwnership(&mut self) -> (), - fn GetGammaControlCapabilities( - &mut self, pGammaCaps: *mut ::DXGI_GAMMA_CONTROL_CAPABILITIES - ) -> ::HRESULT, - fn SetGammaControl(&mut self, pArray: *const ::DXGI_GAMMA_CONTROL) -> ::HRESULT, - fn GetGammaControl(&mut self, pArray: *mut ::DXGI_GAMMA_CONTROL) -> ::HRESULT, - fn SetDisplaySurface(&mut self, pScanoutSurface: *mut IDXGISurface) -> ::HRESULT, - fn GetDisplaySurfaceData(&mut self, pDestination: *mut IDXGISurface) -> ::HRESULT, - fn GetFrameStatistics(&mut self, pStats: *mut DXGI_FRAME_STATISTICS) -> ::HRESULT -}); -pub const DXGI_MAX_SWAP_CHAIN_BUFFERS: ::DWORD = 16; -pub const DXGI_PRESENT_TEST: ::DWORD = 0x00000001; -pub const DXGI_PRESENT_DO_NOT_SEQUENCE: ::DWORD = 0x00000002; -pub const DXGI_PRESENT_RESTART: ::DWORD = 0x00000004; -pub const DXGI_PRESENT_DO_NOT_WAIT: ::DWORD = 0x00000008; -pub const DXGI_PRESENT_STEREO_PREFER_RIGHT: ::DWORD = 0x00000010; -pub const DXGI_PRESENT_STEREO_TEMPORARY_MONO: ::DWORD = 0x00000020; -pub const DXGI_PRESENT_RESTRICT_TO_OUTPUT: ::DWORD = 0x00000040; -pub const DXGI_PRESENT_USE_DURATION: ::DWORD = 0x00000100; -RIDL!( -interface IDXGISwapChain(IDXGISwapChainVtbl): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl) { - fn Present(&mut self, SyncInterval: ::UINT, Flags: ::UINT) -> ::HRESULT, - fn GetBuffer( - &mut self, Buffer: ::UINT, riid: ::REFIID, ppSurface: *mut *mut ::c_void - ) -> ::HRESULT, - fn SetFullscreenState(&mut self, Fullscreen: ::BOOL, pTarget: *mut IDXGIOutput) -> ::HRESULT, - fn GetFullscreenState( - &mut self, pFullscreen: *mut ::BOOL, ppTarget: *mut *mut IDXGIOutput - ) -> ::HRESULT, - fn GetDesc(&mut self, pDesc: *mut DXGI_SWAP_CHAIN_DESC) -> ::HRESULT, - fn ResizeBuffers( - &mut self, BufferCount: ::UINT, Width: ::UINT, Height: ::UINT, NewFormat: ::DXGI_FORMAT, - SwapChainFlags: ::UINT - ) -> ::HRESULT, - fn ResizeTarget(&mut self, pNewTargetParameters: *const ::DXGI_MODE_DESC) -> ::HRESULT, - fn GetContainingOutput(&mut self, ppOutput: *mut *mut IDXGIOutput) -> ::HRESULT, - fn GetFrameStatistics(&mut self, pStats: *mut DXGI_FRAME_STATISTICS) -> ::HRESULT, - fn GetLastPresentCount(&mut self, pLastPresentCount: *mut ::UINT) -> ::HRESULT -}); -RIDL!( -interface IDXGIFactory(IDXGIFactoryVtbl): IDXGIObject(IDXGIObjectVtbl) { - fn EnumAdapters(&mut self, Adapter: ::UINT, ppAdapter: *mut *mut IDXGIAdapter) -> ::HRESULT, - fn MakeWindowAssociation(&mut self, WindowHandle: ::HWND, Flags: ::UINT) -> ::HRESULT, - fn GetWindowAssociation(&mut self, pWindowHandle: *mut ::HWND) -> ::HRESULT, - fn CreateSwapChain( - &mut self, pDevice: *mut ::IUnknown, pDesc: *mut DXGI_SWAP_CHAIN_DESC, - ppSwapChain: *mut *mut IDXGISwapChain - ) -> ::HRESULT, - fn CreateSoftwareAdapter( - &mut self, Module: ::HMODULE, ppAdapter: *mut *mut IDXGIAdapter - ) -> ::HRESULT -}); -RIDL!( -interface IDXGIDevice(IDXGIDeviceVtbl): IDXGIObject(IDXGIObjectVtbl) { - fn GetAdapter(&mut self, pAdapter: *mut *mut IDXGIAdapter) -> ::HRESULT, - fn CreateSurface( - &mut self, pDesc: *const DXGI_SURFACE_DESC, NumSurfaces: ::UINT, Usage: ::DXGI_USAGE, - pSharedResource: *const DXGI_SHARED_RESOURCE, ppSurface: *mut *mut IDXGISurface - ) -> ::HRESULT, - fn QueryResourceResidency( - &mut self, ppResources: *const *mut ::IUnknown, pResidencyStatus: *mut DXGI_RESIDENCY, - NumResources: ::UINT - ) -> ::HRESULT, - fn SetGPUThreadPriority(&mut self, Priority: ::INT) -> ::HRESULT, - fn GetGPUThreadPriority(&mut self, pPriority: *mut ::INT) -> ::HRESULT -}); -ENUM!{enum DXGI_ADAPTER_FLAG { - DXGI_ADAPTER_FLAG_NONE, - DXGI_ADAPTER_FLAG_REMOTE, - DXGI_ADAPTER_FLAG_SOFTWARE, -}} -STRUCT!{nodebug struct DXGI_ADAPTER_DESC1 { - Description: [::WCHAR; 128], - VendorId: ::UINT, - DeviceId: ::UINT, - SubSysId: ::UINT, - Revision: ::UINT, - DedicatedVideoMemory: ::SIZE_T, - DedicatedSystemMemory: ::SIZE_T, - SharedSystemMemory: ::SIZE_T, - AdapterLuid: ::LUID, - Flags: ::UINT, -}} -STRUCT!{struct DXGI_DISPLAY_COLOR_SPACE { - PrimaryCoordinates: [[::FLOAT; 2]; 8], - WhitePoints: [[::FLOAT; 2]; 16], -}} -RIDL!( -interface IDXGIFactory1(IDXGIFactory1Vtbl): IDXGIFactory(IDXGIFactoryVtbl) { - fn EnumAdapters1(&mut self, Adapter: ::UINT, ppAdapter: *mut *mut IDXGIAdapter1) -> ::HRESULT, - fn IsCurrent(&mut self) -> ::BOOL -}); -RIDL!( -interface IDXGIAdapter1(IDXGIAdapter1Vtbl): IDXGIAdapter(IDXGIAdapterVtbl) { - fn GetDesc1(&mut self, pDesc: *mut DXGI_ADAPTER_DESC1) -> ::HRESULT -}); -RIDL!( -interface IDXGIDevice1(IDXGIDevice1Vtbl): IDXGIDevice(IDXGIDeviceVtbl) { - fn SetMaximumFrameLatency(&mut self, MaxLatency: ::UINT) -> ::HRESULT, - fn GetMaximumFrameLatency(&mut self, pMaxLatency: *mut ::UINT) -> ::HRESULT -}); diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/dxgitype.rs cargo-0.37.0/vendor/winapi-0.2.8/src/dxgitype.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/dxgitype.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/dxgitype.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ -// Copyright © 2015; Connor Hilarides -// Licensed under the MIT License -//! Mappings for the contents of dxgitype.h -pub const DXGI_CPU_ACCESS_NONE: ::DWORD = 0; -pub const DXGI_CPU_ACCESS_DYNAMIC: ::DWORD = 1; -pub const DXGI_CPU_ACCESS_READ_WRITE: ::DWORD = 2; -pub const DXGI_CPU_ACCESS_SCRATCH: ::DWORD = 3; -pub const DXGI_CPU_ACCESS_FIELD: ::DWORD = 15; -FLAGS!{enum DXGI_USAGE { - DXGI_USAGE_SHADER_INPUT = 1 << (0 + 4), - DXGI_USAGE_RENDER_TARGET_OUTPUT = 1 << (1 + 4), - DXGI_USAGE_BACK_BUFFER = 1 << (2 + 4), - DXGI_USAGE_SHARED = 1 << (3 + 4), - DXGI_USAGE_READ_ONLY = 1 << (4 + 4), - DXGI_USAGE_DISCARD_ON_PRESENT = 1 << (5 + 4), - DXGI_USAGE_UNORDERED_ACCESS = 1 << (6 + 4), -}} -STRUCT!{struct DXGI_RGB { - Red: f32, - Green: f32, - Blue: f32, -}} -pub type DXGI_RGBA = ::D3DCOLORVALUE; -STRUCT!{nodebug struct DXGI_GAMMA_CONTROL { - Scale: DXGI_RGB, - Offset: DXGI_RGB, - GammaCurve: [DXGI_RGB; 1025], -}} -STRUCT!{nodebug struct DXGI_GAMMA_CONTROL_CAPABILITIES { - ScaleAndOffsetSupported: ::BOOL, - MaxConvertedValue: f32, - MinConvertedValue: f32, - NumGammaControlPoints: ::UINT, - ControlPointPositions: [f32; 1025], -}} -STRUCT!{struct DXGI_RATIONAL { - Numerator: ::UINT, - Denominator: ::UINT, -}} -ENUM!{enum DXGI_MODE_SCANLINE_ORDER { - DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED, - DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE, - DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST, - DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST, -}} -ENUM!{enum DXGI_MODE_SCALING { - DXGI_MODE_SCALING_UNSPECIFIED, - DXGI_MODE_SCALING_CENTERED, - DXGI_MODE_SCALING_STRETCHED, -}} -ENUM!{enum DXGI_MODE_ROTATION { - DXGI_MODE_ROTATION_UNSPECIFIED, - DXGI_MODE_ROTATION_IDENTITY, - DXGI_MODE_ROTATION_ROTATE90, - DXGI_MODE_ROTATION_ROTATE180, - DXGI_MODE_ROTATION_ROTATE270, -}} -STRUCT!{struct DXGI_MODE_DESC { - Width: ::UINT, - Height: ::UINT, - RefreshRate: DXGI_RATIONAL, - Format: ::DXGI_FORMAT, - ScanlineOrdering: DXGI_MODE_SCANLINE_ORDER, - Scaling: DXGI_MODE_SCALING, -}} -STRUCT!{struct DXGI_SAMPLE_DESC { - Count: ::UINT, - Quality: ::UINT, -}} -ENUM!{enum DXGI_COLOR_SPACE_TYPE { - DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 = 0x0, - DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 = 0x1, - DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709 = 0x2, - DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020 = 0x3, - DXGI_COLOR_SPACE_RESERVED = 0x4, - DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 = 0x5, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 = 0x6, - DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601 = 0x7, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 = 0x8, - DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709 = 0x9, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 = 0xA, - DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 = 0xB, - DXGI_COLOR_SPACE_CUSTOM = 0xFFFFFFFF, -}} -pub const DXGI_CENTER_MULTISAMPLE_QUALITY_PATTERN: ::UINT = 0xfffffffe; -pub const DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN: ::UINT = 0xffffffff; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/errhandlingapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/errhandlingapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/errhandlingapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/errhandlingapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! ApiSet Contract for api-ms-win-core-errorhandling-l1 -pub type PTOP_LEVEL_EXCEPTION_FILTER = Option ::LONG>; -pub type LPTOP_LEVEL_EXCEPTION_FILTER = PTOP_LEVEL_EXCEPTION_FILTER; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/excpt.rs cargo-0.37.0/vendor/winapi-0.2.8/src/excpt.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/excpt.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/excpt.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -ENUM!{enum EXCEPTION_DISPOSITION { - ExceptionContinueExecution = 0, - ExceptionContinueSearch = 1, - ExceptionNestedException = 2, - ExceptionCollidedUnwind = 3, -}} -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct _EXCEPTION_RECORD; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct _CONTEXT; -#[cfg(target_arch = "x86_64")] #[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct _DISPATCHER_CONTEXT; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/fileapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/fileapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/fileapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/fileapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,152 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! ApiSet Contract for api-ms-win-core-file-l1 -pub const CREATE_NEW: ::DWORD = 1; -pub const CREATE_ALWAYS: ::DWORD = 2; -pub const OPEN_EXISTING: ::DWORD = 3; -pub const OPEN_ALWAYS: ::DWORD = 4; -pub const TRUNCATE_EXISTING: ::DWORD = 5; -pub const INVALID_FILE_SIZE: ::DWORD = 0xFFFFFFFF; -pub const INVALID_SET_FILE_POINTER: ::DWORD = 0xFFFFFFFF; -pub const INVALID_FILE_ATTRIBUTES: ::DWORD = 0xFFFFFFFF; -STRUCT!{struct WIN32_FILE_ATTRIBUTE_DATA { - dwFileAttributes: ::DWORD, - ftCreationTime: ::FILETIME, - ftLastAccessTime: ::FILETIME, - ftLastWriteTime: ::FILETIME, - nFileSizeHigh: ::DWORD, - nFileSizeLow: ::DWORD, -}} -pub type LPWIN32_FILE_ATTRIBUTE_DATA = *mut WIN32_FILE_ATTRIBUTE_DATA; -STRUCT!{struct BY_HANDLE_FILE_INFORMATION { - dwFileAttributes: ::DWORD, - ftCreationTime: ::FILETIME, - ftLastAccessTime: ::FILETIME, - ftLastWriteTime: ::FILETIME, - dwVolumeSerialNumber: ::DWORD, - nFileSizeHigh: ::DWORD, - nFileSizeLow: ::DWORD, - nNumberOfLinks: ::DWORD, - nFileIndexHigh: ::DWORD, - nFileIndexLow: ::DWORD, -}} -pub type PBY_HANDLE_FILE_INFORMATION = *mut BY_HANDLE_FILE_INFORMATION; -pub type LPBY_HANDLE_FILE_INFORMATION = *mut BY_HANDLE_FILE_INFORMATION; -STRUCT!{struct CREATEFILE2_EXTENDED_PARAMETERS { - dwSize: ::DWORD, - dwFileAttributes: ::DWORD, - dwFileFlags: ::DWORD, - dwSecurityQosFlags: ::DWORD, - lpSecurityAttributes: ::LPSECURITY_ATTRIBUTES, - hTemplateFile: ::HANDLE, -}} -pub type PCREATEFILE2_EXTENDED_PARAMETERS = *mut CREATEFILE2_EXTENDED_PARAMETERS; -pub type LPCREATEFILE2_EXTENDED_PARAMETERS = *mut CREATEFILE2_EXTENDED_PARAMETERS; -ENUM!{enum PRIORITY_HINT { - IoPriorityHintVeryLow = 0, - IoPriorityHintLow = 1, - IoPriorityHintNormal = 2, - MaximumIoPriorityHintType = 3, -}} -STRUCT!{struct FILE_BASIC_INFO { - CreationTime: ::LARGE_INTEGER, - LastAccessTime: ::LARGE_INTEGER, - LastWriteTime: ::LARGE_INTEGER, - ChangeTime: ::LARGE_INTEGER, - FileAttributes: ::DWORD, -}} -STRUCT!{struct FILE_STANDARD_INFO { - AllocationSize: ::LARGE_INTEGER, - EndOfFile: ::LARGE_INTEGER, - NumberOfLinks: ::DWORD, - DeletePending: ::BOOLEAN, - Directory: ::BOOLEAN, -}} -STRUCT!{struct FILE_NAME_INFO { - FileNameLength: ::DWORD, - FileName: [::WCHAR; 0], -}} -STRUCT!{struct FILE_RENAME_INFO { - ReplaceIfExists: ::BOOL, - RootDirectory: ::HANDLE, - FileNameLength: ::DWORD, - FileName: [::WCHAR; 0], -}} -STRUCT!{struct FILE_DISPOSITION_INFO { - DeleteFile: ::BOOL, -}} -STRUCT!{struct FILE_ALLOCATION_INFO { - AllocationSize: ::LARGE_INTEGER, -}} -STRUCT!{struct FILE_END_OF_FILE_INFO { - EndOfFile: ::LARGE_INTEGER, -}} -STRUCT!{struct FILE_STREAM_INFO { - NextEntryOffset: ::DWORD, - StreamNameLength: ::DWORD, - StreamSize: ::DWORD, - StreamAllocationSize: ::DWORD, - StreamName: [::WCHAR; 0], -}} -STRUCT!{struct FILE_COMPRESSION_INFO { - CompressedFileSize: ::LARGE_INTEGER, - CompressionFormat: ::WORD, - CompressionUnitShift: ::UCHAR, - ChunkShift: ::UCHAR, - ClusterShift: ::UCHAR, - Reserved: [::UCHAR; 3], -}} -STRUCT!{struct FILE_ATTRIBUTE_TAG_INFO { - NextEntryOffset: ::DWORD, - ReparseTag: ::DWORD, -}} -STRUCT!{struct FILE_ID_BOTH_DIR_INFO { - NextEntryOffset: ::DWORD, - FileIndex: ::DWORD, - CreationTime: ::LARGE_INTEGER, - LastAccessTime: ::LARGE_INTEGER, - LastWriteTime: ::LARGE_INTEGER, - ChangeTime: ::LARGE_INTEGER, - EndOfFile: ::LARGE_INTEGER, - AllocationSize: ::LARGE_INTEGER, - FileAttributes: ::DWORD, - FileNameLength: ::DWORD, - EaSize: ::DWORD, - ShortNameLength: ::CCHAR, - ShortName: [::WCHAR; 12], - FileId: ::LARGE_INTEGER, - FileName: [::WCHAR; 0], -}} -STRUCT!{struct FILE_IO_PRIORITY_HINT_INFO { - PriorityHint: ::PRIORITY_HINT, -}} -STRUCT!{struct FILE_FULL_DIR_INFO { - NextEntryOffset: ::ULONG, - FileIndex: ::ULONG, - CreationTime: ::LARGE_INTEGER, - LastAccessTime: ::LARGE_INTEGER, - LastWriteTime: ::LARGE_INTEGER, - ChangeTime: ::LARGE_INTEGER, - EndOfFile: ::LARGE_INTEGER, - AllocationSize: ::LARGE_INTEGER, - FileAttributes: ::ULONG, - FileNameLength: ::ULONG, - EaSize: ::ULONG, - FileName: [::WCHAR; 0], -}} -STRUCT!{struct FILE_STORAGE_INFO { - LogicalBytesPerSector: ::ULONG, - PhysicalBytesPerSectorForAtomicity: ::ULONG, - PhysicalBytesPerSectorForPerformance: ::ULONG, - FileSystemEffectivePhysicalBytesPerSectorForAtomicity: ::ULONG, - Flags: ::ULONG, - ByteOffsetForSectorAlignment: ::ULONG, - ByteOffsetForPartitionAlignment: ::ULONG, -}} -STRUCT!{struct FILE_ALIGNMENT_INFO { - AlignmentRequirement: ::ULONG, -}} -STRUCT!{struct FILE_ID_INFO { - VolumeSerialNumber: ::ULONGLONG, - FileId: ::FILE_ID_128, -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/gl.rs cargo-0.37.0/vendor/winapi-0.2.8/src/gl.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/gl.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/gl.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//48 -pub type GLenum = ::c_uint; -pub type GLboolean = ::c_uchar; -pub type GLbitfield = ::c_uint; -pub type GLbyte = ::c_schar; -pub type GLshort = ::c_short; -pub type GLint = ::c_int; -pub type GLsizei = ::c_int; -pub type GLubyte = ::c_uchar; -pub type GLushort = ::c_ushort; -pub type GLuint = ::c_uint; -pub type GLfloat = ::c_float; -pub type GLclampf = ::c_float; -pub type GLdouble = ::c_double; -pub type GLclampd = ::c_double; -pub type GLvoid = ::c_void; -//63 -//68 -//AccumOp -pub const GL_ACCUM: GLenum = 0x0100; -pub const GL_LOAD: GLenum = 0x0101; -pub const GL_RETURN: GLenum = 0x0102; -pub const GL_MULT: GLenum = 0x0103; -pub const GL_ADD: GLenum = 0x0104; -//AlphaFunction -pub const GL_NEVER: GLenum = 0x0200; -pub const GL_LESS: GLenum = 0x0201; -pub const GL_EQUAL: GLenum = 0x0202; -pub const GL_LEQUAL: GLenum = 0x0203; -pub const GL_GREATER: GLenum = 0x0204; -pub const GL_NOTEQUAL: GLenum = 0x0205; -pub const GL_GEQUAL: GLenum = 0x0206; -pub const GL_ALWAYS: GLenum = 0x0207; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/guiddef.rs cargo-0.37.0/vendor/winapi-0.2.8/src/guiddef.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/guiddef.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/guiddef.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -STRUCT!{struct GUID { - Data1: ::c_ulong, - Data2: ::c_ushort, - Data3: ::c_ushort, - Data4: [::c_uchar; 8], -}} -pub type LPGUID = *mut GUID; -pub type LPCGUID = *const GUID; -pub type IID = GUID; -pub type LPIID = *mut IID; -pub type CLSID = GUID; -pub type LPCLSID = *mut CLSID; -pub type FMTID = GUID; -pub type LPFMTID = *mut FMTID; -pub type REFGUID = *const GUID; -pub type REFIID = *const IID; -pub type REFCLSID = *const IID; -pub type REFFMTID = *const IID; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/heapapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/heapapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/heapapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/heapapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! ApiSet Contract for api-ms-win-core-heap-l1 -STRUCT!{struct HEAP_SUMMARY { - cb: ::DWORD, - cbAllocated: ::SIZE_T, - cbCommitted: ::SIZE_T, - cbReserved: ::SIZE_T, - cbMaxReserve: ::SIZE_T, -}} -pub type PHEAP_SUMMARY = *mut HEAP_SUMMARY; -pub type LPHEAP_SUMMARY = PHEAP_SUMMARY; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/hidclass.rs cargo-0.37.0/vendor/winapi-0.2.8/src/hidclass.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/hidclass.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/hidclass.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -// Copyright © 2015, Peter Atashian and Alex Daniel Jones -// Licensed under the MIT License -DEFINE_GUID!{GUID_DEVINTERFACE_HID, 0x4D1E55B2, 0xF16F, 0x11CF, - 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30} -pub const GUID_CLASS_INPUT: ::GUID = GUID_DEVINTERFACE_HID; -DEFINE_GUID!{GUID_HID_INTERFACE_NOTIFY, 0x2c4e2e88, 0x25e6, 0x4c33, 0x88, 0x2f, 0x3d, 0x82, 0xe6, 0x07, 0x36, 0x81} -DEFINE_GUID!{GUID_HID_INTERFACE_HIDPARSE, 0xf5c315a5, 0x69ac, 0x4bc2, 0x92, 0x79, 0xd0, 0xb6, 0x45, 0x76, 0xf4, 0x4b} -// FIXME devpropkey stuff -pub const HID_REVISION: ::DWORD = 0x00000001; -pub const IOCTL_HID_GET_DRIVER_CONFIG: ::DWORD = HID_BUFFER_CTL_CODE!(100); -pub const IOCTL_HID_SET_DRIVER_CONFIG: ::DWORD = HID_BUFFER_CTL_CODE!(101); -pub const IOCTL_HID_GET_POLL_FREQUENCY_MSEC: ::DWORD = HID_BUFFER_CTL_CODE!(102); -pub const IOCTL_HID_SET_POLL_FREQUENCY_MSEC: ::DWORD = HID_BUFFER_CTL_CODE!(103); -pub const IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS: ::DWORD = HID_BUFFER_CTL_CODE!(104); -pub const IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS: ::DWORD = HID_BUFFER_CTL_CODE!(105); -pub const IOCTL_HID_GET_COLLECTION_INFORMATION: ::DWORD = HID_BUFFER_CTL_CODE!(106); -pub const IOCTL_HID_ENABLE_WAKE_ON_SX: ::DWORD = HID_BUFFER_CTL_CODE!(107); -pub const IOCTL_HID_SET_S0_IDLE_TIMEOUT: ::DWORD = HID_BUFFER_CTL_CODE!(108); -pub const IOCTL_HID_GET_COLLECTION_DESCRIPTOR: ::DWORD = HID_CTL_CODE!(100); -pub const IOCTL_HID_FLUSH_QUEUE: ::DWORD = HID_CTL_CODE!(101); -pub const IOCTL_HID_SET_FEATURE: ::DWORD = HID_IN_CTL_CODE!(100); -pub const IOCTL_HID_SET_OUTPUT_REPORT: ::DWORD = HID_IN_CTL_CODE!(101); -pub const IOCTL_HID_GET_FEATURE: ::DWORD = HID_OUT_CTL_CODE!(100); -pub const IOCTL_GET_PHYSICAL_DESCRIPTOR: ::DWORD = HID_OUT_CTL_CODE!(102); -pub const IOCTL_HID_GET_HARDWARE_ID: ::DWORD = HID_OUT_CTL_CODE!(103); -pub const IOCTL_HID_GET_INPUT_REPORT: ::DWORD = HID_OUT_CTL_CODE!(104); -pub const IOCTL_HID_GET_OUTPUT_REPORT: ::DWORD = HID_OUT_CTL_CODE!(105); -pub const IOCTL_HID_GET_MANUFACTURER_STRING: ::DWORD = HID_OUT_CTL_CODE!(110); -pub const IOCTL_HID_GET_PRODUCT_STRING: ::DWORD = HID_OUT_CTL_CODE!(111); -pub const IOCTL_HID_GET_SERIALNUMBER_STRING: ::DWORD = HID_OUT_CTL_CODE!(112); -pub const IOCTL_HID_GET_INDEXED_STRING: ::DWORD = HID_OUT_CTL_CODE!(120); -pub const IOCTL_HID_GET_MS_GENRE_DESCRIPTOR: ::DWORD = HID_OUT_CTL_CODE!(121); -pub const IOCTL_HID_ENABLE_SECURE_READ: ::DWORD = HID_CTL_CODE!(130); -pub const IOCTL_HID_DISABLE_SECURE_READ: ::DWORD = HID_CTL_CODE!(131); -pub const IOCTL_HID_DEVICERESET_NOTIFICATION: ::DWORD = HID_CTL_CODE!(140); -STRUCT!{struct HID_XFER_PACKET { - reportBuffer: ::PUCHAR, - reportBufferLen: ::ULONG, - reportId: ::UCHAR, -}} -pub type PHID_XFER_PACKET = *mut HID_XFER_PACKET; -//FIXME Stuff for NT_INCLUDED -STRUCT!{struct HID_COLLECTION_INFORMATION { - DescriptorSize: ::ULONG, - Polled: ::BOOLEAN, - Reserved1: [::UCHAR; 1], - VendorID: ::USHORT, - ProductID: ::USHORT, - VersionNumber: ::USHORT, -}} -pub type PHID_COLLECTION_INFORMATION = *mut HID_COLLECTION_INFORMATION; -STRUCT!{struct HID_DRIVER_CONFIG { - Size: ::ULONG, - RingBufferSize: ::ULONG, -}} -pub type PHID_DRIVER_CONFIG = *mut HID_DRIVER_CONFIG; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/hidpi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/hidpi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/hidpi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/hidpi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,182 +0,0 @@ -// Copyright © 2015, Peter Atashian and Alex Daniel Jones -// Licensed under the MIT License -pub const HIDP_LINK_COLLECTION_ROOT: ::USHORT = -1i16 as u16; -pub const HIDP_LINK_COLLECTION_UNSPECIFIED: ::USHORT = 0; -ENUM!{enum HIDP_REPORT_TYPE { - HidP_Input, - HidP_Output, - HidP_Feature, -}} -STRUCT!{struct USAGE_AND_PAGE { - Usage: ::USAGE, - UsagePage: ::USAGE, -}} -pub type PUSAGE_AND_PAGE = *mut USAGE_AND_PAGE; -STRUCT!{struct HIDP_BUTTON_CAPS { - UsagePage: ::USAGE, - ReportID: ::UCHAR, - IsAlias: ::BOOLEAN, - BitField: ::USHORT, - LinkCollection: ::USHORT, - LinkUsage: ::USAGE, - LinkUsagePage: ::USAGE, - IsRange: ::BOOLEAN, - IsStringRange: ::BOOLEAN, - IsDesignatorRange: ::BOOLEAN, - IsAbsolute: ::BOOLEAN, - Reserved: [::ULONG; 10], - S_un: [u16; 8], -}} -UNION!{HIDP_BUTTON_CAPS, S_un, Range, Range_mut, HIDP_RANGE_STRUCT} -UNION!{HIDP_BUTTON_CAPS, S_un, NotRange, NotRange_mut, HIDP_NOTRANGE_STRUCT} -pub type PHIDP_BUTTON_CAPS = *mut HIDP_BUTTON_CAPS; -STRUCT!{struct HIDP_RANGE_STRUCT { - UsageMin: ::USAGE, - UsageMax: ::USAGE, - StringMin: ::USHORT, - StringMax: ::USHORT, - DesignatorMin: ::USHORT, - DesignatorMax: ::USHORT, - DataIndexMin: ::USHORT, - DataIndexMax: ::USHORT, -}} -STRUCT!{struct HIDP_NOTRANGE_STRUCT { - Usage: ::USAGE, - Reserved1: ::USAGE, - StringIndex: ::USHORT, - Reserved2: ::USHORT, - DesignatorIndex: ::USHORT, - Reserved3: ::USHORT, - DataIndex: ::USHORT, - Reserved4: ::USHORT, -}} -STRUCT!{struct HIDP_VALUE_CAPS { - UsagePage: ::USAGE, - ReportID: ::UCHAR, - IsAlias: ::BOOLEAN, - BitField: ::USHORT, - LinkCollection: ::USHORT, - LinkUsage: ::USAGE, - LinkUsagePage: ::USAGE, - IsRange: ::BOOLEAN, - IsStringRange: ::BOOLEAN, - IsDesignatorRange: ::BOOLEAN, - IsAbsolute: ::BOOLEAN, - HasNull: ::BOOLEAN, - Reserved: ::UCHAR, - BitSize: ::USHORT, - ReportCount: ::USHORT, - Reserved2: [::USHORT; 5], - UnitsExp: ::ULONG, - Units: ::ULONG, - LogicalMin: ::LONG, - LogicalMax: ::LONG, - PhysicalMin: ::LONG, - PhysicalMax: ::LONG, - S_un: [u16; 8], -}} -UNION!{HIDP_VALUE_CAPS, S_un, Range, Range_mut, HIDP_RANGE_STRUCT} -UNION!{HIDP_VALUE_CAPS, S_un, NotRange, NotRange_mut, HIDP_NOTRANGE_STRUCT} -pub type PHIDP_VALUE_CAPS = *mut HIDP_VALUE_CAPS; -STRUCT!{struct HIDP_LINK_COLLECTION_NODE { - LinkUsage: ::USAGE, - LinkUsagePage: ::USAGE, - Parent: ::USHORT, - NumberOfChildren: ::USHORT, - NextSibling: ::USHORT, - FirstChild: ::USHORT, - bit_fields: ::ULONG, - UserContext: ::PVOID, -}} -BITFIELD!{HIDP_LINK_COLLECTION_NODE bit_fields: ::ULONG [ - CollectionType set_CollectionType[0..8], - IsAlias set_IsAlias[8..9], -]} -pub type PHIDP_LINK_COLLECTION_NODE = *mut HIDP_LINK_COLLECTION_NODE; -pub type PHIDP_REPORT_DESCRIPTOR = ::PUCHAR; -pub enum HIDP_PREPARSED_DATA{} -pub type PHIDP_PREPARSED_DATA = *mut HIDP_PREPARSED_DATA; -STRUCT!{struct HIDP_CAPS { - Usage: ::USAGE, - UsagePage: ::USAGE, - InputReportByteLength: ::USHORT, - OutputReportByteLength: ::USHORT, - FeatureReportByteLength: ::USHORT, - Reserved: [::USHORT; 17], - NumberLinkCollectionNodes: ::USHORT, - NumberInputButtonCaps: ::USHORT, - NumberInputValueCaps: ::USHORT, - NumberInputDataIndices: ::USHORT, - NumberOutputButtonCaps: ::USHORT, - NumberOutputValueCaps: ::USHORT, - NumberOutputDataIndices: ::USHORT, - NumberFeatureButtonCaps: ::USHORT, - NumberFeatureValueCaps: ::USHORT, - NumberFeatureDataIndices: ::USHORT, -}} -pub type PHIDP_CAPS = *mut HIDP_CAPS; -STRUCT!{struct HIDP_DATA { - DataIndex: ::USHORT, - Reserved: ::USHORT, - S_un: [u32; 1], -}} -UNION!{HIDP_DATA, S_un, RawValue, RawValue_mut, ::ULONG} -UNION!{HIDP_DATA, S_un, On, On_mut, ::BOOLEAN} -pub type PHIDP_DATA = *mut HIDP_DATA; -STRUCT!{struct HIDP_UNKNOWN_TOKEN { - Token: ::UCHAR, - Reserved: [::UCHAR; 3], - BitField: ::ULONG, -}} -pub type PHIDP_UNKNOWN_TOKEN = *mut HIDP_UNKNOWN_TOKEN; -STRUCT!{struct HIDP_EXTENDED_ATTRIBUTES { - NumGlobalUnknowns: ::UCHAR, - Reserved: [::UCHAR; 3], - GlobalUnknowns: PHIDP_UNKNOWN_TOKEN, - Data: [::ULONG; 1], -}} -pub type PHIDP_EXTENDED_ATTRIBUTES = *mut HIDP_EXTENDED_ATTRIBUTES; -ENUM!{enum HIDP_KEYBOARD_DIRECTION { - HidP_Keyboard_Break, - HidP_Keyboard_Make, -}} -STRUCT!{struct HIDP_KEYBOARD_MODIFIER_STATE { - ul: ::ULONG, -}} -BITFIELD!{HIDP_KEYBOARD_MODIFIER_STATE ul: ::ULONG [ - LeftControl set_LeftControl[0..1], - LeftShift set_LeftShift[1..2], - LeftAlt set_LeftAlt[2..3], - LeftGUI set_LeftGUI[3..4], - RightControl set_RightControl[4..5], - RightShift set_RightShift[5..6], - RightAlt set_RightAlt[6..7], - RigthGUI set_RigthGUI[7..8], - CapsLock set_CapsLock[8..9], - ScollLock set_ScollLock[9..10], - NumLock set_NumLock[10..11], -]} -pub type PHIDP_KEYBOARD_MODIFIER_STATE = *mut HIDP_KEYBOARD_MODIFIER_STATE; -pub type PHIDP_INSERT_SCANCODES = Option ::BOOLEAN>; -pub const HIDP_STATUS_SUCCESS: ::NTSTATUS = HIDP_ERROR_CODES!(0x0, 0); -pub const HIDP_STATUS_NULL: ::NTSTATUS = HIDP_ERROR_CODES!(0x8, 1); -pub const HIDP_STATUS_INVALID_PREPARSED_DATA: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 1); -pub const HIDP_STATUS_INVALID_REPORT_TYPE: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 2); -pub const HIDP_STATUS_INVALID_REPORT_LENGTH: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 3); -pub const HIDP_STATUS_USAGE_NOT_FOUND: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 4); -pub const HIDP_STATUS_VALUE_OUT_OF_RANGE: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 5); -pub const HIDP_STATUS_BAD_LOG_PHY_VALUES: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 6); -pub const HIDP_STATUS_BUFFER_TOO_SMALL: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 7); -pub const HIDP_STATUS_INTERNAL_ERROR: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 8); -pub const HIDP_STATUS_I8042_TRANS_UNKNOWN: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 9); -pub const HIDP_STATUS_INCOMPATIBLE_REPORT_ID: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 0xA); -pub const HIDP_STATUS_NOT_VALUE_ARRAY: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 0xB); -pub const HIDP_STATUS_IS_VALUE_ARRAY: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 0xC); -pub const HIDP_STATUS_DATA_INDEX_NOT_FOUND: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 0xD); -pub const HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 0xE); -pub const HIDP_STATUS_BUTTON_NOT_PRESSED: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 0xF); -pub const HIDP_STATUS_REPORT_DOES_NOT_EXIST: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 0x10); -pub const HIDP_STATUS_NOT_IMPLEMENTED: ::NTSTATUS = HIDP_ERROR_CODES!(0xC, 0x20); -pub const HIDP_STATUS_I8242_TRANS_UNKNOWN: ::NTSTATUS = HIDP_STATUS_I8042_TRANS_UNKNOWN; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/hidsdi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/hidsdi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/hidsdi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/hidsdi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -// Copyright © 2015, Peter Atashian and Alex Daniel Jones -// Licensed under the MIT License -STRUCT!{struct HIDD_CONFIGURATION { - cookie: ::PVOID, - size: ::ULONG, - RingBufferSize: ::ULONG, -}} -pub type PHIDD_CONFIGURATION = *mut HIDD_CONFIGURATION; -STRUCT!{struct HIDD_ATTRIBUTES { - Size: ::ULONG, - VendorID: ::USHORT, - ProductID: ::USHORT, - VersionNumber: ::USHORT, -}} -pub type PHIDD_ATTRIBUTES = *mut HIDD_ATTRIBUTES; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/hidusage.rs cargo-0.37.0/vendor/winapi-0.2.8/src/hidusage.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/hidusage.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/hidusage.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,270 +0,0 @@ -// Copyright © 2015, Peter Atashian and Alex Daniel Jones -// Licensed under the MIT License -pub type USAGE = ::USHORT; -pub type PUSAGE = *mut USAGE; -pub const HID_USAGE_PAGE_UNDEFINED: ::USAGE = 0x00; -pub const HID_USAGE_PAGE_GENERIC: ::USAGE = 0x01; -pub const HID_USAGE_PAGE_SIMULATION: ::USAGE = 0x02; -pub const HID_USAGE_PAGE_VR: ::USAGE = 0x03; -pub const HID_USAGE_PAGE_SPORT: ::USAGE = 0x04; -pub const HID_USAGE_PAGE_GAME: ::USAGE = 0x05; -pub const HID_USAGE_PAGE_KEYBOARD: ::USAGE = 0x07; -pub const HID_USAGE_PAGE_LED: ::USAGE = 0x08; -pub const HID_USAGE_PAGE_BUTTON: ::USAGE = 0x09; -pub const HID_USAGE_PAGE_ORDINAL: ::USAGE = 0x0A; -pub const HID_USAGE_PAGE_TELEPHONY: ::USAGE = 0x0B; -pub const HID_USAGE_PAGE_CONSUMER: ::USAGE = 0x0C; -pub const HID_USAGE_PAGE_DIGITIZER: ::USAGE = 0x0D; -pub const HID_USAGE_PAGE_UNICODE: ::USAGE = 0x10; -pub const HID_USAGE_PAGE_ALPHANUMERIC: ::USAGE = 0x14; -pub const HID_USAGE_PAGE_SENSOR: ::USAGE = 0x20; -pub const HID_USAGE_PAGE_BARCODE_SCANNER: ::USAGE = 0x8C; -pub const HID_USAGE_PAGE_WEIGHING_DEVICE: ::USAGE = 0x8D; -pub const HID_USAGE_PAGE_MAGNETIC_STRIPE_READER: ::USAGE = 0x8E; -pub const HID_USAGE_PAGE_CAMERA_CONTROL: ::USAGE = 0x90; -pub const HID_USAGE_PAGE_MICROSOFT_BLUETOOTH_HANDSFREE: ::USAGE = 0xFFF3; -pub const HID_USAGE_PAGE_VENDOR_DEFINED_BEGIN: ::USAGE = 0xFF00; -pub const HID_USAGE_PAGE_VENDOR_DEFINED_END: ::USAGE = 0xFFFF; -pub const HID_USAGE_GENERIC_POINTER: ::USAGE = 0x01; -pub const HID_USAGE_GENERIC_MOUSE: ::USAGE = 0x02; -pub const HID_USAGE_GENERIC_JOYSTICK: ::USAGE = 0x04; -pub const HID_USAGE_GENERIC_GAMEPAD: ::USAGE = 0x05; -pub const HID_USAGE_GENERIC_KEYBOARD: ::USAGE = 0x06; -pub const HID_USAGE_GENERIC_KEYPAD: ::USAGE = 0x07; -pub const HID_USAGE_GENERIC_PORTABLE_DEVICE_CONTROL: ::USAGE = 0x0D; -pub const HID_USAGE_GENERIC_SYSTEM_CTL: ::USAGE = 0x80; -pub const HID_USAGE_GENERIC_X: ::USAGE = 0x30; -pub const HID_USAGE_GENERIC_Y: ::USAGE = 0x31; -pub const HID_USAGE_GENERIC_Z: ::USAGE = 0x32; -pub const HID_USAGE_GENERIC_RX: ::USAGE = 0x33; -pub const HID_USAGE_GENERIC_RY: ::USAGE = 0x34; -pub const HID_USAGE_GENERIC_RZ: ::USAGE = 0x35; -pub const HID_USAGE_GENERIC_SLIDER: ::USAGE = 0x36; -pub const HID_USAGE_GENERIC_DIAL: ::USAGE = 0x37; -pub const HID_USAGE_GENERIC_WHEEL: ::USAGE = 0x38; -pub const HID_USAGE_GENERIC_HATSWITCH: ::USAGE = 0x39; -pub const HID_USAGE_GENERIC_COUNTED_BUFFER: ::USAGE = 0x3A; -pub const HID_USAGE_GENERIC_BYTE_COUNT: ::USAGE = 0x3B; -pub const HID_USAGE_GENERIC_MOTION_WAKEUP: ::USAGE = 0x3C; -pub const HID_USAGE_GENERIC_VX: ::USAGE = 0x40; -pub const HID_USAGE_GENERIC_VY: ::USAGE = 0x41; -pub const HID_USAGE_GENERIC_VZ: ::USAGE = 0x42; -pub const HID_USAGE_GENERIC_VBRX: ::USAGE = 0x43; -pub const HID_USAGE_GENERIC_VBRY: ::USAGE = 0x44; -pub const HID_USAGE_GENERIC_VBRZ: ::USAGE = 0x45; -pub const HID_USAGE_GENERIC_VNO: ::USAGE = 0x46; -pub const HID_USAGE_GENERIC_RESOLUTION_MULTIPLIER: ::USAGE = 0x48; -pub const HID_USAGE_GENERIC_SYSCTL_POWER: ::USAGE = 0x81; -pub const HID_USAGE_GENERIC_SYSCTL_SLEEP: ::USAGE = 0x82; -pub const HID_USAGE_GENERIC_SYSCTL_WAKE: ::USAGE = 0x83; -pub const HID_USAGE_GENERIC_SYSCTL_CONTEXT_MENU: ::USAGE = 0x84; -pub const HID_USAGE_GENERIC_SYSCTL_MAIN_MENU: ::USAGE = 0x85; -pub const HID_USAGE_GENERIC_SYSCTL_APP_MENU: ::USAGE = 0x86; -pub const HID_USAGE_GENERIC_SYSCTL_HELP_MENU: ::USAGE = 0x87; -pub const HID_USAGE_GENERIC_SYSCTL_MENU_EXIT: ::USAGE = 0x88; -pub const HID_USAGE_GENERIC_SYSCTL_MENU_SELECT: ::USAGE = 0x89; -pub const HID_USAGE_GENERIC_SYSCTL_MENU_RIGHT: ::USAGE = 0x8A; -pub const HID_USAGE_GENERIC_SYSCTL_MENU_LEFT: ::USAGE = 0x8B; -pub const HID_USAGE_GENERIC_SYSCTL_MENU_UP: ::USAGE = 0x8C; -pub const HID_USAGE_GENERIC_SYSCTL_MENU_DOWN: ::USAGE = 0x8D; -pub const HID_USAGE_GENERIC_SYSTEM_DISPLAY_ROTATION_LOCK_BUTTON: ::USAGE = 0xC9; -pub const HID_USAGE_GENERIC_SYSTEM_DISPLAY_ROTATION_LOCK_SLIDER_SWITCH: ::USAGE = 0xCA; -pub const HID_USAGE_GENERIC_CONTROL_ENABLE: ::USAGE = 0xCB; -pub const HID_USAGE_SIMULATION_RUDDER: ::USAGE = 0xBA; -pub const HID_USAGE_SIMULATION_THROTTLE: ::USAGE = 0xBB; -pub const HID_USAGE_KEYBOARD_NOEVENT: ::USAGE = 0x00; -pub const HID_USAGE_KEYBOARD_ROLLOVER: ::USAGE = 0x01; -pub const HID_USAGE_KEYBOARD_POSTFAIL: ::USAGE = 0x02; -pub const HID_USAGE_KEYBOARD_UNDEFINED: ::USAGE = 0x03; -pub const HID_USAGE_KEYBOARD_aA: ::USAGE = 0x04; -pub const HID_USAGE_KEYBOARD_zZ: ::USAGE = 0x1D; -pub const HID_USAGE_KEYBOARD_ONE: ::USAGE = 0x1E; -pub const HID_USAGE_KEYBOARD_ZERO: ::USAGE = 0x27; -pub const HID_USAGE_KEYBOARD_LCTRL: ::USAGE = 0xE0; -pub const HID_USAGE_KEYBOARD_LSHFT: ::USAGE = 0xE1; -pub const HID_USAGE_KEYBOARD_LALT: ::USAGE = 0xE2; -pub const HID_USAGE_KEYBOARD_LGUI: ::USAGE = 0xE3; -pub const HID_USAGE_KEYBOARD_RCTRL: ::USAGE = 0xE4; -pub const HID_USAGE_KEYBOARD_RSHFT: ::USAGE = 0xE5; -pub const HID_USAGE_KEYBOARD_RALT: ::USAGE = 0xE6; -pub const HID_USAGE_KEYBOARD_RGUI: ::USAGE = 0xE7; -pub const HID_USAGE_KEYBOARD_SCROLL_LOCK: ::USAGE = 0x47; -pub const HID_USAGE_KEYBOARD_NUM_LOCK: ::USAGE = 0x53; -pub const HID_USAGE_KEYBOARD_CAPS_LOCK: ::USAGE = 0x39; -pub const HID_USAGE_KEYBOARD_F1: ::USAGE = 0x3A; -pub const HID_USAGE_KEYBOARD_F2: ::USAGE = 0x3B; -pub const HID_USAGE_KEYBOARD_F3: ::USAGE = 0x3C; -pub const HID_USAGE_KEYBOARD_F4: ::USAGE = 0x3D; -pub const HID_USAGE_KEYBOARD_F5: ::USAGE = 0x3E; -pub const HID_USAGE_KEYBOARD_F6: ::USAGE = 0x3F; -pub const HID_USAGE_KEYBOARD_F7: ::USAGE = 0x40; -pub const HID_USAGE_KEYBOARD_F8: ::USAGE = 0x41; -pub const HID_USAGE_KEYBOARD_F9: ::USAGE = 0x42; -pub const HID_USAGE_KEYBOARD_F10: ::USAGE = 0x43; -pub const HID_USAGE_KEYBOARD_F11: ::USAGE = 0x44; -pub const HID_USAGE_KEYBOARD_F12: ::USAGE = 0x45; -pub const HID_USAGE_KEYBOARD_F13: ::USAGE = 0x68; -pub const HID_USAGE_KEYBOARD_F14: ::USAGE = 0x69; -pub const HID_USAGE_KEYBOARD_F15: ::USAGE = 0x6A; -pub const HID_USAGE_KEYBOARD_F16: ::USAGE = 0x6B; -pub const HID_USAGE_KEYBOARD_F17: ::USAGE = 0x6C; -pub const HID_USAGE_KEYBOARD_F18: ::USAGE = 0x6D; -pub const HID_USAGE_KEYBOARD_F19: ::USAGE = 0x6E; -pub const HID_USAGE_KEYBOARD_F20: ::USAGE = 0x6F; -pub const HID_USAGE_KEYBOARD_F21: ::USAGE = 0x70; -pub const HID_USAGE_KEYBOARD_F22: ::USAGE = 0x71; -pub const HID_USAGE_KEYBOARD_F23: ::USAGE = 0x72; -pub const HID_USAGE_KEYBOARD_F24: ::USAGE = 0x73; -pub const HID_USAGE_KEYBOARD_RETURN: ::USAGE = 0x28; -pub const HID_USAGE_KEYBOARD_ESCAPE: ::USAGE = 0x29; -pub const HID_USAGE_KEYBOARD_DELETE: ::USAGE = 0x2A; -pub const HID_USAGE_KEYBOARD_PRINT_SCREEN: ::USAGE = 0x46; -pub const HID_USAGE_KEYBOARD_DELETE_FORWARD: ::USAGE = 0x4C; -pub const HID_USAGE_LED_NUM_LOCK: ::USAGE = 0x01; -pub const HID_USAGE_LED_CAPS_LOCK: ::USAGE = 0x02; -pub const HID_USAGE_LED_SCROLL_LOCK: ::USAGE = 0x03; -pub const HID_USAGE_LED_COMPOSE: ::USAGE = 0x04; -pub const HID_USAGE_LED_KANA: ::USAGE = 0x05; -pub const HID_USAGE_LED_POWER: ::USAGE = 0x06; -pub const HID_USAGE_LED_SHIFT: ::USAGE = 0x07; -pub const HID_USAGE_LED_DO_NOT_DISTURB: ::USAGE = 0x08; -pub const HID_USAGE_LED_MUTE: ::USAGE = 0x09; -pub const HID_USAGE_LED_TONE_ENABLE: ::USAGE = 0x0A; -pub const HID_USAGE_LED_HIGH_CUT_FILTER: ::USAGE = 0x0B; -pub const HID_USAGE_LED_LOW_CUT_FILTER: ::USAGE = 0x0C; -pub const HID_USAGE_LED_EQUALIZER_ENABLE: ::USAGE = 0x0D; -pub const HID_USAGE_LED_SOUND_FIELD_ON: ::USAGE = 0x0E; -pub const HID_USAGE_LED_SURROUND_FIELD_ON: ::USAGE = 0x0F; -pub const HID_USAGE_LED_REPEAT: ::USAGE = 0x10; -pub const HID_USAGE_LED_STEREO: ::USAGE = 0x11; -pub const HID_USAGE_LED_SAMPLING_RATE_DETECT: ::USAGE = 0x12; -pub const HID_USAGE_LED_SPINNING: ::USAGE = 0x13; -pub const HID_USAGE_LED_CAV: ::USAGE = 0x14; -pub const HID_USAGE_LED_CLV: ::USAGE = 0x15; -pub const HID_USAGE_LED_RECORDING_FORMAT_DET: ::USAGE = 0x16; -pub const HID_USAGE_LED_OFF_HOOK: ::USAGE = 0x17; -pub const HID_USAGE_LED_RING: ::USAGE = 0x18; -pub const HID_USAGE_LED_MESSAGE_WAITING: ::USAGE = 0x19; -pub const HID_USAGE_LED_DATA_MODE: ::USAGE = 0x1A; -pub const HID_USAGE_LED_BATTERY_OPERATION: ::USAGE = 0x1B; -pub const HID_USAGE_LED_BATTERY_OK: ::USAGE = 0x1C; -pub const HID_USAGE_LED_BATTERY_LOW: ::USAGE = 0x1D; -pub const HID_USAGE_LED_SPEAKER: ::USAGE = 0x1E; -pub const HID_USAGE_LED_HEAD_SET: ::USAGE = 0x1F; -pub const HID_USAGE_LED_HOLD: ::USAGE = 0x20; -pub const HID_USAGE_LED_MICROPHONE: ::USAGE = 0x21; -pub const HID_USAGE_LED_COVERAGE: ::USAGE = 0x22; -pub const HID_USAGE_LED_NIGHT_MODE: ::USAGE = 0x23; -pub const HID_USAGE_LED_SEND_CALLS: ::USAGE = 0x24; -pub const HID_USAGE_LED_CALL_PICKUP: ::USAGE = 0x25; -pub const HID_USAGE_LED_CONFERENCE: ::USAGE = 0x26; -pub const HID_USAGE_LED_STAND_BY: ::USAGE = 0x27; -pub const HID_USAGE_LED_CAMERA_ON: ::USAGE = 0x28; -pub const HID_USAGE_LED_CAMERA_OFF: ::USAGE = 0x29; -pub const HID_USAGE_LED_ON_LINE: ::USAGE = 0x2A; -pub const HID_USAGE_LED_OFF_LINE: ::USAGE = 0x2B; -pub const HID_USAGE_LED_BUSY: ::USAGE = 0x2C; -pub const HID_USAGE_LED_READY: ::USAGE = 0x2D; -pub const HID_USAGE_LED_PAPER_OUT: ::USAGE = 0x2E; -pub const HID_USAGE_LED_PAPER_JAM: ::USAGE = 0x2F; -pub const HID_USAGE_LED_REMOTE: ::USAGE = 0x30; -pub const HID_USAGE_LED_FORWARD: ::USAGE = 0x31; -pub const HID_USAGE_LED_REVERSE: ::USAGE = 0x32; -pub const HID_USAGE_LED_STOP: ::USAGE = 0x33; -pub const HID_USAGE_LED_REWIND: ::USAGE = 0x34; -pub const HID_USAGE_LED_FAST_FORWARD: ::USAGE = 0x35; -pub const HID_USAGE_LED_PLAY: ::USAGE = 0x36; -pub const HID_USAGE_LED_PAUSE: ::USAGE = 0x37; -pub const HID_USAGE_LED_RECORD: ::USAGE = 0x38; -pub const HID_USAGE_LED_ERROR: ::USAGE = 0x39; -pub const HID_USAGE_LED_SELECTED_INDICATOR: ::USAGE = 0x3A; -pub const HID_USAGE_LED_IN_USE_INDICATOR: ::USAGE = 0x3B; -pub const HID_USAGE_LED_MULTI_MODE_INDICATOR: ::USAGE = 0x3C; -pub const HID_USAGE_LED_INDICATOR_ON: ::USAGE = 0x3D; -pub const HID_USAGE_LED_INDICATOR_FLASH: ::USAGE = 0x3E; -pub const HID_USAGE_LED_INDICATOR_SLOW_BLINK: ::USAGE = 0x3F; -pub const HID_USAGE_LED_INDICATOR_FAST_BLINK: ::USAGE = 0x40; -pub const HID_USAGE_LED_INDICATOR_OFF: ::USAGE = 0x41; -pub const HID_USAGE_LED_FLASH_ON_TIME: ::USAGE = 0x42; -pub const HID_USAGE_LED_SLOW_BLINK_ON_TIME: ::USAGE = 0x43; -pub const HID_USAGE_LED_SLOW_BLINK_OFF_TIME: ::USAGE = 0x44; -pub const HID_USAGE_LED_FAST_BLINK_ON_TIME: ::USAGE = 0x45; -pub const HID_USAGE_LED_FAST_BLINK_OFF_TIME: ::USAGE = 0x46; -pub const HID_USAGE_LED_INDICATOR_COLOR: ::USAGE = 0x47; -pub const HID_USAGE_LED_RED: ::USAGE = 0x48; -pub const HID_USAGE_LED_GREEN: ::USAGE = 0x49; -pub const HID_USAGE_LED_AMBER: ::USAGE = 0x4A; -pub const HID_USAGE_LED_GENERIC_INDICATOR: ::USAGE = 0x4B; -pub const HID_USAGE_TELEPHONY_PHONE: ::USAGE = 0x01; -pub const HID_USAGE_TELEPHONY_ANSWERING_MACHINE: ::USAGE = 0x02; -pub const HID_USAGE_TELEPHONY_MESSAGE_CONTROLS: ::USAGE = 0x03; -pub const HID_USAGE_TELEPHONY_HANDSET: ::USAGE = 0x04; -pub const HID_USAGE_TELEPHONY_HEADSET: ::USAGE = 0x05; -pub const HID_USAGE_TELEPHONY_KEYPAD: ::USAGE = 0x06; -pub const HID_USAGE_TELEPHONY_PROGRAMMABLE_BUTTON: ::USAGE = 0x07; -pub const HID_USAGE_TELEPHONY_REDIAL: ::USAGE = 0x24; -pub const HID_USAGE_TELEPHONY_TRANSFER: ::USAGE = 0x25; -pub const HID_USAGE_TELEPHONY_DROP: ::USAGE = 0x26; -pub const HID_USAGE_TELEPHONY_LINE: ::USAGE = 0x2A; -pub const HID_USAGE_TELEPHONY_RING_ENABLE: ::USAGE = 0x2D; -pub const HID_USAGE_TELEPHONY_SEND: ::USAGE = 0x31; -pub const HID_USAGE_TELEPHONY_KEYPAD_0: ::USAGE = 0xB0; -pub const HID_USAGE_TELEPHONY_KEYPAD_D: ::USAGE = 0xBF; -pub const HID_USAGE_TELEPHONY_HOST_AVAILABLE: ::USAGE = 0xF1; -pub const HID_USAGE_CONSUMERCTRL: ::USAGE = 0x01; -pub const HID_USAGE_CONSUMER_CHANNEL_INCREMENT: ::USAGE = 0x9C; -pub const HID_USAGE_CONSUMER_CHANNEL_DECREMENT: ::USAGE = 0x9D; -pub const HID_USAGE_CONSUMER_PLAY: ::USAGE = 0xB0; -pub const HID_USAGE_CONSUMER_PAUSE: ::USAGE = 0xB1; -pub const HID_USAGE_CONSUMER_RECORD: ::USAGE = 0xB2; -pub const HID_USAGE_CONSUMER_FAST_FORWARD: ::USAGE = 0xB3; -pub const HID_USAGE_CONSUMER_REWIND: ::USAGE = 0xB4; -pub const HID_USAGE_CONSUMER_SCAN_NEXT_TRACK: ::USAGE = 0xB5; -pub const HID_USAGE_CONSUMER_SCAN_PREV_TRACK: ::USAGE = 0xB6; -pub const HID_USAGE_CONSUMER_STOP: ::USAGE = 0xB7; -pub const HID_USAGE_CONSUMER_PLAY_PAUSE: ::USAGE = 0xCD; -pub const HID_USAGE_CONSUMER_VOLUME: ::USAGE = 0xE0; -pub const HID_USAGE_CONSUMER_BALANCE: ::USAGE = 0xE1; -pub const HID_USAGE_CONSUMER_MUTE: ::USAGE = 0xE2; -pub const HID_USAGE_CONSUMER_BASS: ::USAGE = 0xE3; -pub const HID_USAGE_CONSUMER_TREBLE: ::USAGE = 0xE4; -pub const HID_USAGE_CONSUMER_BASS_BOOST: ::USAGE = 0xE5; -pub const HID_USAGE_CONSUMER_SURROUND_MODE: ::USAGE = 0xE6; -pub const HID_USAGE_CONSUMER_LOUDNESS: ::USAGE = 0xE7; -pub const HID_USAGE_CONSUMER_MPX: ::USAGE = 0xE8; -pub const HID_USAGE_CONSUMER_VOLUME_INCREMENT: ::USAGE = 0xE9; -pub const HID_USAGE_CONSUMER_VOLUME_DECREMENT: ::USAGE = 0xEA; -pub const HID_USAGE_CONSUMER_BASS_INCREMENT: ::USAGE = 0x152; -pub const HID_USAGE_CONSUMER_BASS_DECREMENT: ::USAGE = 0x153; -pub const HID_USAGE_CONSUMER_TREBLE_INCREMENT: ::USAGE = 0x154; -pub const HID_USAGE_CONSUMER_TREBLE_DECREMENT: ::USAGE = 0x155; -pub const HID_USAGE_CONSUMER_AL_CONFIGURATION: ::USAGE = 0x183; -pub const HID_USAGE_CONSUMER_AL_EMAIL: ::USAGE = 0x18A; -pub const HID_USAGE_CONSUMER_AL_CALCULATOR: ::USAGE = 0x192; -pub const HID_USAGE_CONSUMER_AL_BROWSER: ::USAGE = 0x194; -pub const HID_USAGE_CONSUMER_AC_SEARCH: ::USAGE = 0x221; -pub const HID_USAGE_CONSUMER_AC_GOTO: ::USAGE = 0x222; -pub const HID_USAGE_CONSUMER_AC_HOME: ::USAGE = 0x223; -pub const HID_USAGE_CONSUMER_AC_BACK: ::USAGE = 0x224; -pub const HID_USAGE_CONSUMER_AC_FORWARD: ::USAGE = 0x225; -pub const HID_USAGE_CONSUMER_AC_STOP: ::USAGE = 0x226; -pub const HID_USAGE_CONSUMER_AC_REFRESH: ::USAGE = 0x227; -pub const HID_USAGE_CONSUMER_AC_PREVIOUS: ::USAGE = 0x228; -pub const HID_USAGE_CONSUMER_AC_NEXT: ::USAGE = 0x229; -pub const HID_USAGE_CONSUMER_AC_BOOKMARKS: ::USAGE = 0x22A; -pub const HID_USAGE_CONSUMER_AC_PAN: ::USAGE = 0x238; -pub const HID_USAGE_CONSUMER_EXTENDED_KEYBOARD_ATTRIBUTES_COLLECTION: ::USAGE = 0x2C0; -pub const HID_USAGE_CONSUMER_KEYBOARD_FORM_FACTOR: ::USAGE = 0x2C1; -pub const HID_USAGE_CONSUMER_KEYBOARD_KEY_TYPE: ::USAGE = 0x2C2; -pub const HID_USAGE_CONSUMER_KEYBOARD_PHYSICAL_LAYOUT: ::USAGE = 0x2C3; -pub const HID_USAGE_CONSUMER_VENDOR_SPECIFIC_KEYBOARD_PHYSICAL_LAYOUT: ::USAGE = 0x2C4; -pub const HID_USAGE_CONSUMER_KEYBOARD_IETF_LANGUAGE_TAG_INDEX: ::USAGE = 0x2C5; -pub const HID_USAGE_CONSUMER_IMPLEMENTED_KEYBOARD_INPUT_ASSIST_CONTROLS: ::USAGE = 0x2C6; -pub const HID_USAGE_DIGITIZER_PEN: ::USAGE = 0x02; -pub const HID_USAGE_DIGITIZER_IN_RANGE: ::USAGE = 0x32; -pub const HID_USAGE_DIGITIZER_TIP_SWITCH: ::USAGE = 0x42; -pub const HID_USAGE_DIGITIZER_BARREL_SWITCH: ::USAGE = 0x44; -pub const HID_USAGE_CAMERA_AUTO_FOCUS: ::USAGE = 0x20; -pub const HID_USAGE_CAMERA_SHUTTER: ::USAGE = 0x21; -pub const HID_USAGE_MS_BTH_HF_DIALNUMBER: ::USAGE = 0x21; -pub const HID_USAGE_MS_BTH_HF_DIALMEMORY: ::USAGE = 0x22; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/hstring.rs cargo-0.37.0/vendor/winapi-0.2.8/src/hstring.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/hstring.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/hstring.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! This interface definition contains typedefs for Windows Runtime data types. -DECLARE_HANDLE!(HSTRING, HSTRING__); -#[cfg(target_arch = "x86_64")] -STRUCT!{struct HSTRING_HEADER { - Reserved: [::PVOID; 0], // For alignment - Reserved2: [::c_char; 24], -}} -#[cfg(target_arch = "x86")] -STRUCT!{struct HSTRING_HEADER { - Reserved: [::PVOID; 0], // For alignment - Reserved2: [::c_char; 20], -}} -UNION!(HSTRING_HEADER, Reserved2, Reserved1, Reserved1_mut, ::PVOID); -DECLARE_HANDLE!(HSTRING_BUFFER, HSTRING_BUFFER__); diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/http.rs cargo-0.37.0/vendor/winapi-0.2.8/src/http.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/http.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/http.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,828 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! HTTP API specification -pub const HTTP_INITIALIZE_SERVER: ::ULONG = 0x00000001; -pub const HTTP_INITIALIZE_CONFIG: ::ULONG = 0x00000002; -pub const HTTP_DEMAND_CBT: ::ULONG = 0x00000004; -ENUM!{enum HTTP_SERVER_PROPERTY { - HttpServerAuthenticationProperty, - HttpServerLoggingProperty, - HttpServerQosProperty, - HttpServerTimeoutsProperty, - HttpServerQueueLengthProperty, - HttpServerStateProperty, - HttpServer503VerbosityProperty, - HttpServerBindingProperty, - HttpServerExtendedAuthenticationProperty, - HttpServerListenEndpointProperty, - HttpServerChannelBindProperty, - HttpServerProtectionLevelProperty, -}} -pub type PHTTP_SERVER_PROPERTY = *mut HTTP_SERVER_PROPERTY; -STRUCT!{struct HTTP_PROPERTY_FLAGS { - BitFields: ::ULONG, -}} -BITFIELD!(HTTP_PROPERTY_FLAGS BitFields: ::ULONG [ - Present set_Present[0..1], -]); -pub type PHTTP_PROPERTY_FLAGS = *mut HTTP_PROPERTY_FLAGS; -ENUM!{enum HTTP_ENABLED_STATE { - HttpEnabledStateActive, - HttpEnabledStateInactive, -}} -pub type PHTTP_ENABLED_STATE = *mut HTTP_ENABLED_STATE; -STRUCT!{struct HTTP_STATE_INFO { - Flags: HTTP_PROPERTY_FLAGS, - State: HTTP_ENABLED_STATE, -}} -pub type PHTTP_STATE_INFO = *mut HTTP_STATE_INFO; -ENUM!{enum HTTP_503_RESPONSE_VERBOSITY { - Http503ResponseVerbosityBasic, - Http503ResponseVerbosityLimited, - Http503ResponseVerbosityFull, -}} -pub type PHTTP_503_RESPONSE_VERBOSITY = *mut HTTP_503_RESPONSE_VERBOSITY; -ENUM!{enum HTTP_QOS_SETTING_TYPE { - HttpQosSettingTypeBandwidth, - HttpQosSettingTypeConnectionLimit, - HttpQosSettingTypeFlowRate, -}} -pub type PHTTP_QOS_SETTING_TYPE = *mut HTTP_QOS_SETTING_TYPE; -STRUCT!{struct HTTP_QOS_SETTING_INFO { - QosType: HTTP_QOS_SETTING_TYPE, - QosSetting: ::PVOID, -}} -pub type PHTTP_QOS_SETTING_INFO = *mut HTTP_QOS_SETTING_INFO; -STRUCT!{struct HTTP_CONNECTION_LIMIT_INFO { - Flags: HTTP_PROPERTY_FLAGS, - MaxConnections: ::ULONG, -}} -pub type PHTTP_CONNECTION_LIMIT_INFO = *mut HTTP_CONNECTION_LIMIT_INFO; -STRUCT!{struct HTTP_BANDWIDTH_LIMIT_INFO { - Flags: HTTP_PROPERTY_FLAGS, - MaxBandwidth: ::ULONG, -}} -pub type PHTTP_BANDWIDTH_LIMIT_INFO = *mut HTTP_BANDWIDTH_LIMIT_INFO; -STRUCT!{struct HTTP_FLOWRATE_INFO { - Flags: HTTP_PROPERTY_FLAGS, - MaxBandwidth: ::ULONG, - MaxPeakBandwidth: ::ULONG, - BurstSize: ::ULONG, -}} -pub type PHTTP_FLOWRATE_INFO = *mut HTTP_FLOWRATE_INFO; -pub const HTTP_MIN_ALLOWED_BANDWIDTH_THROTTLING_RATE: ::ULONG = 1024; -pub const HTTP_LIMIT_INFINITE: ::ULONG = !0; -ENUM!{enum HTTP_SERVICE_CONFIG_TIMEOUT_KEY { - IdleConnectionTimeout = 0, - HeaderWaitTimeout, -}} -pub type PHTTP_SERVICE_CONFIG_TIMEOUT_KEY = *mut HTTP_SERVICE_CONFIG_TIMEOUT_KEY; -pub type HTTP_SERVICE_CONFIG_TIMEOUT_PARAM = ::USHORT; -pub type PHTTP_SERVICE_CONFIG_TIMEOUT_PARAM = *mut ::USHORT; -STRUCT!{struct HTTP_SERVICE_CONFIG_TIMEOUT_SET { - KeyDesc: HTTP_SERVICE_CONFIG_TIMEOUT_KEY, - ParamDesc: HTTP_SERVICE_CONFIG_TIMEOUT_PARAM, -}} -pub type PHTTP_SERVICE_CONFIG_TIMEOUT_SET = *mut HTTP_SERVICE_CONFIG_TIMEOUT_SET; -STRUCT!{struct HTTP_TIMEOUT_LIMIT_INFO { - Flags: HTTP_PROPERTY_FLAGS, - EntityBody: ::USHORT, - DrainEntityBody: ::USHORT, - RequestQueue: ::USHORT, - IdleConnection: ::USHORT, - HeaderWait: ::USHORT, - MinSendRate: ::ULONG, -}} -pub type PHTTP_TIMEOUT_LIMIT_INFO = *mut HTTP_TIMEOUT_LIMIT_INFO; -STRUCT!{struct HTTP_LISTEN_ENDPOINT_INFO { - Flags: HTTP_PROPERTY_FLAGS, - EnableSharing: ::BOOLEAN, -}} -pub type PHTTP_LISTEN_ENDPOINT_INFO = *mut HTTP_LISTEN_ENDPOINT_INFO; -STRUCT!{struct HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS { - DomainNameLength: ::USHORT, - DomainName: ::PWSTR, - RealmLength: ::USHORT, - Realm: ::PWSTR, -}} -pub type PHTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS = *mut HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS; -STRUCT!{struct HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS { - RealmLength: ::USHORT, - Realm: ::PWSTR, -}} -pub type PHTTP_SERVER_AUTHENTICATION_BASIC_PARAMS = *mut HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS; -pub const HTTP_AUTH_ENABLE_BASIC: ::ULONG = 0x00000001; -pub const HTTP_AUTH_ENABLE_DIGEST: ::ULONG = 0x00000002; -pub const HTTP_AUTH_ENABLE_NTLM: ::ULONG = 0x00000004; -pub const HTTP_AUTH_ENABLE_NEGOTIATE: ::ULONG = 0x00000008; -pub const HTTP_AUTH_ENABLE_KERBEROS: ::ULONG = 0x00000010; -pub const HTTP_AUTH_ENABLE_ALL: ::ULONG = HTTP_AUTH_ENABLE_BASIC | HTTP_AUTH_ENABLE_DIGEST | - HTTP_AUTH_ENABLE_NTLM | HTTP_AUTH_ENABLE_NEGOTIATE | HTTP_AUTH_ENABLE_KERBEROS; -pub const HTTP_AUTH_EX_FLAG_ENABLE_KERBEROS_CREDENTIAL_CACHING: ::UCHAR = 0x01; -pub const HTTP_AUTH_EX_FLAG_CAPTURE_CREDENTIAL: ::UCHAR = 0x02; -STRUCT!{struct HTTP_SERVER_AUTHENTICATION_INFO { - Flags: HTTP_PROPERTY_FLAGS, - AuthSchemes: ::ULONG, - ReceiveMutualAuth: ::BOOLEAN, - ReceiveContextHandle: ::BOOLEAN, - DisableNTLMCredentialCaching: ::BOOLEAN, - ExFlags: ::UCHAR, - DigestParams: HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS, - BasicParams: HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS, -}} -pub type PHTTP_SERVER_AUTHENTICATION_INFO = *mut HTTP_SERVER_AUTHENTICATION_INFO; -ENUM!{enum HTTP_SERVICE_BINDING_TYPE { - HttpServiceBindingTypeNone = 0, - HttpServiceBindingTypeW, - HttpServiceBindingTypeA, -}} -STRUCT!{struct HTTP_SERVICE_BINDING_BASE { - Type: HTTP_SERVICE_BINDING_TYPE, -}} -pub type PHTTP_SERVICE_BINDING_BASE = *mut HTTP_SERVICE_BINDING_BASE; -STRUCT!{struct HTTP_SERVICE_BINDING_A { - Base: HTTP_SERVICE_BINDING_BASE, - Buffer: ::PCHAR, - BufferSize: ::ULONG, -}} -pub type PHTTP_SERVICE_BINDING_A = *mut HTTP_SERVICE_BINDING_A; -STRUCT!{struct HTTP_SERVICE_BINDING_W { - Base: HTTP_SERVICE_BINDING_BASE, - Buffer: ::PWCHAR, - BufferSize: ::ULONG, -}} -pub type PHTTP_SERVICE_BINDING_W = *mut HTTP_SERVICE_BINDING_W; -ENUM!{enum HTTP_AUTHENTICATION_HARDENING_LEVELS { - HttpAuthenticationHardeningLegacy = 0, - HttpAuthenticationHardeningMedium, - HttpAuthenticationHardeningStrict, -}} -pub const HTTP_CHANNEL_BIND_PROXY: ::ULONG = 0x1; -pub const HTTP_CHANNEL_BIND_PROXY_COHOSTING: ::ULONG = 0x20; -pub const HTTP_CHANNEL_BIND_NO_SERVICE_NAME_CHECK: ::ULONG = 0x2; -pub const HTTP_CHANNEL_BIND_DOTLESS_SERVICE: ::ULONG = 0x4; -pub const HTTP_CHANNEL_BIND_SECURE_CHANNEL_TOKEN: ::ULONG = 0x8; -pub const HTTP_CHANNEL_BIND_CLIENT_SERVICE: ::ULONG = 0x10; -STRUCT!{struct HTTP_CHANNEL_BIND_INFO { - Hardening: HTTP_AUTHENTICATION_HARDENING_LEVELS, - Flags: ::ULONG, - ServiceNames: *mut PHTTP_SERVICE_BINDING_BASE, - NumberOfServiceNames: ::ULONG, -}} -pub type PHTTP_CHANNEL_BIND_INFO = *mut HTTP_CHANNEL_BIND_INFO; -STRUCT!{struct HTTP_REQUEST_CHANNEL_BIND_STATUS { - ServiceName: PHTTP_SERVICE_BINDING_BASE, - ChannelToken: ::PUCHAR, - ChannelTokenSize: ::ULONG, - Flags: ::ULONG, -}} -pub type PHTTP_REQUEST_CHANNEL_BIND_STATUS = *mut HTTP_REQUEST_CHANNEL_BIND_STATUS; -pub const HTTP_LOG_FIELD_DATE: ::ULONG = 0x00000001; -pub const HTTP_LOG_FIELD_TIME: ::ULONG = 0x00000002; -pub const HTTP_LOG_FIELD_CLIENT_IP: ::ULONG = 0x00000004; -pub const HTTP_LOG_FIELD_USER_NAME: ::ULONG = 0x00000008; -pub const HTTP_LOG_FIELD_SITE_NAME: ::ULONG = 0x00000010; -pub const HTTP_LOG_FIELD_COMPUTER_NAME: ::ULONG = 0x00000020; -pub const HTTP_LOG_FIELD_SERVER_IP: ::ULONG = 0x00000040; -pub const HTTP_LOG_FIELD_METHOD: ::ULONG = 0x00000080; -pub const HTTP_LOG_FIELD_URI_STEM: ::ULONG = 0x00000100; -pub const HTTP_LOG_FIELD_URI_QUERY: ::ULONG = 0x00000200; -pub const HTTP_LOG_FIELD_STATUS: ::ULONG = 0x00000400; -pub const HTTP_LOG_FIELD_WIN32_STATUS: ::ULONG = 0x00000800; -pub const HTTP_LOG_FIELD_BYTES_SENT: ::ULONG = 0x00001000; -pub const HTTP_LOG_FIELD_BYTES_RECV: ::ULONG = 0x00002000; -pub const HTTP_LOG_FIELD_TIME_TAKEN: ::ULONG = 0x00004000; -pub const HTTP_LOG_FIELD_SERVER_PORT: ::ULONG = 0x00008000; -pub const HTTP_LOG_FIELD_USER_AGENT: ::ULONG = 0x00010000; -pub const HTTP_LOG_FIELD_COOKIE: ::ULONG = 0x00020000; -pub const HTTP_LOG_FIELD_REFERER: ::ULONG = 0x00040000; -pub const HTTP_LOG_FIELD_VERSION: ::ULONG = 0x00080000; -pub const HTTP_LOG_FIELD_HOST: ::ULONG = 0x00100000; -pub const HTTP_LOG_FIELD_SUB_STATUS: ::ULONG = 0x00200000; -pub const HTTP_LOG_FIELD_CLIENT_PORT: ::ULONG = 0x00400000; -pub const HTTP_LOG_FIELD_URI: ::ULONG = 0x00800000; -pub const HTTP_LOG_FIELD_SITE_ID: ::ULONG = 0x01000000; -pub const HTTP_LOG_FIELD_REASON: ::ULONG = 0x02000000; -pub const HTTP_LOG_FIELD_QUEUE_NAME: ::ULONG = 0x04000000; -ENUM!{enum HTTP_LOGGING_TYPE { - HttpLoggingTypeW3C, - HttpLoggingTypeIIS, - HttpLoggingTypeNCSA, - HttpLoggingTypeRaw, -}} -ENUM!{enum HTTP_LOGGING_ROLLOVER_TYPE { - HttpLoggingRolloverSize, - HttpLoggingRolloverDaily, - HttpLoggingRolloverWeekly, - HttpLoggingRolloverMonthly, - HttpLoggingRolloverHourly, -}} -pub const HTTP_MIN_ALLOWED_LOG_FILE_ROLLOVER_SIZE: ::ULONG = (1 * 1024 * 1024) as ::ULONG; -pub const HTTP_LOGGING_FLAG_LOCAL_TIME_ROLLOVER: ::ULONG = 0x00000001; -pub const HTTP_LOGGING_FLAG_USE_UTF8_CONVERSION: ::ULONG = 0x00000002; -pub const HTTP_LOGGING_FLAG_LOG_ERRORS_ONLY: ::ULONG = 0x00000004; -pub const HTTP_LOGGING_FLAG_LOG_SUCCESS_ONLY: ::ULONG = 0x00000008; -STRUCT!{struct HTTP_LOGGING_INFO { - Flags: HTTP_PROPERTY_FLAGS, - LoggingFlags: ::ULONG, - SoftwareName: ::PCWSTR, - SoftwareNameLength: ::USHORT, - DirectoryNameLength: ::USHORT, - DirectoryName: ::PCWSTR, - Format: HTTP_LOGGING_TYPE, - Fields: ::ULONG, - pExtFields: ::PVOID, - NumOfExtFields: ::USHORT, - MaxRecordSize: ::USHORT, - RolloverType: HTTP_LOGGING_ROLLOVER_TYPE, - RolloverSize: ::ULONG, - pSecurityDescriptor: ::PSECURITY_DESCRIPTOR, -}} -pub type PHTTP_LOGGING_INFO = *mut HTTP_LOGGING_INFO; -STRUCT!{struct HTTP_BINDING_INFO { - Flags: HTTP_PROPERTY_FLAGS, - RequestQueueHandle: ::HANDLE, -}} -pub type PHTTP_BINDING_INFO = *mut HTTP_BINDING_INFO; -ENUM!{enum HTTP_PROTECTION_LEVEL_TYPE { - HttpProtectionLevelUnrestricted, - HttpProtectionLevelEdgeRestricted, - HttpProtectionLevelRestricted, -}} -pub type PHTTP_PROTECTION_LEVEL_TYPE = *mut HTTP_PROTECTION_LEVEL_TYPE; -STRUCT!{struct HTTP_PROTECTION_LEVEL_INFO { - Flags: HTTP_PROPERTY_FLAGS, - Level: HTTP_PROTECTION_LEVEL_TYPE, -}} -pub type PHTTP_PROTECTION_LEVEL_INFO = *mut HTTP_PROTECTION_LEVEL_INFO; -pub const HTTP_CREATE_REQUEST_QUEUE_FLAG_OPEN_EXISTING: ::ULONG = 0x00000001; -pub const HTTP_CREATE_REQUEST_QUEUE_FLAG_CONTROLLER: ::ULONG = 0x00000002; -pub const HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY: ::ULONG = 0x00000001; -pub const HTTP_RECEIVE_REQUEST_FLAG_FLUSH_BODY: ::ULONG = 0x00000002; -pub const HTTP_RECEIVE_REQUEST_ENTITY_BODY_FLAG_FILL_BUFFER: ::ULONG = 0x00000001; -pub const HTTP_SEND_RESPONSE_FLAG_DISCONNECT: ::ULONG = 0x00000001; -pub const HTTP_SEND_RESPONSE_FLAG_MORE_DATA: ::ULONG = 0x00000002; -pub const HTTP_SEND_RESPONSE_FLAG_BUFFER_DATA: ::ULONG = 0x00000004; -pub const HTTP_SEND_RESPONSE_FLAG_ENABLE_NAGLING: ::ULONG = 0x00000008; -pub const HTTP_SEND_RESPONSE_FLAG_PROCESS_RANGES: ::ULONG = 0x00000020; -pub const HTTP_SEND_RESPONSE_FLAG_OPAQUE: ::ULONG = 0x00000040; -pub const HTTP_FLUSH_RESPONSE_FLAG_RECURSIVE: ::ULONG = 0x00000001; -pub type HTTP_OPAQUE_ID = ::ULONGLONG; -pub type PHTTP_OPAQUE_ID = *mut ::ULONGLONG; -pub type HTTP_REQUEST_ID = HTTP_OPAQUE_ID; -pub type PHTTP_REQUEST_ID = *mut HTTP_OPAQUE_ID; -pub type HTTP_CONNECTION_ID = HTTP_OPAQUE_ID; -pub type PHTTP_CONNECTION_ID = *mut HTTP_OPAQUE_ID; -pub type HTTP_RAW_CONNECTION_ID = HTTP_OPAQUE_ID; -pub type PHTTP_RAW_CONNECTION_ID = *mut HTTP_OPAQUE_ID; -pub type HTTP_URL_GROUP_ID = HTTP_OPAQUE_ID; -pub type PHTTP_URL_GROUP_ID = *mut HTTP_OPAQUE_ID; -pub type HTTP_SERVER_SESSION_ID = HTTP_OPAQUE_ID; -pub type PHTTP_SERVER_SESSION_ID = *mut HTTP_OPAQUE_ID; -pub const HTTP_BYTE_RANGE_TO_EOF: ::ULONGLONG = !0; -STRUCT!{struct HTTP_BYTE_RANGE { - StartingOffset: ::ULARGE_INTEGER, - Length: ::ULARGE_INTEGER, -}} -pub type PHTTP_BYTE_RANGE = *mut HTTP_BYTE_RANGE; -STRUCT!{struct HTTP_VERSION { - MajorVersion: ::USHORT, - MinorVersion: ::USHORT, -}} -pub type PHTTP_VERSION = *mut HTTP_VERSION; -pub const HTTP_VERSION_UNKNOWN: HTTP_VERSION = HTTP_VERSION { MajorVersion: 0, MinorVersion: 0 }; -pub const HTTP_VERSION_0_9: HTTP_VERSION = HTTP_VERSION { MajorVersion: 0, MinorVersion: 9 }; -pub const HTTP_VERSION_1_0: HTTP_VERSION = HTTP_VERSION { MajorVersion: 1, MinorVersion: 0 }; -pub const HTTP_VERSION_1_1: HTTP_VERSION = HTTP_VERSION { MajorVersion: 1, MinorVersion: 1 }; -#[inline] #[allow(dead_code)] -pub fn HTTP_SET_VERSION(mut version: HTTP_VERSION, major: ::USHORT, minor: ::USHORT) { - version.MajorVersion = major; - version.MinorVersion = minor; -} -#[inline] #[allow(dead_code)] -pub fn HTTP_EQUAL_VERSION(version: HTTP_VERSION, major: ::USHORT, minor: ::USHORT) -> bool { - version.MajorVersion == major && version.MinorVersion == minor -} -#[inline] #[allow(dead_code)] -pub fn HTTP_GREATER_VERSION(version: HTTP_VERSION, major: ::USHORT, minor: ::USHORT) -> bool { - version.MajorVersion > major || (version.MajorVersion == major && version.MinorVersion > minor) -} -#[inline] #[allow(dead_code)] -pub fn HTTP_LESS_VERSION(version: HTTP_VERSION, major: ::USHORT, minor: ::USHORT) -> bool { - version.MajorVersion < major || (version.MajorVersion == major && version.MinorVersion < minor) -} -#[inline] #[allow(dead_code)] -pub fn HTTP_NOT_EQUAL_VERSION(version: HTTP_VERSION, major: ::USHORT, minor: ::USHORT) -> bool { - !HTTP_EQUAL_VERSION(version, major, minor) -} -#[inline] #[allow(dead_code)] -pub fn HTTP_GREATER_EQUAL_VERSION(version: HTTP_VERSION, major: ::USHORT, minor: ::USHORT) -> bool { - !HTTP_LESS_VERSION(version, major, minor) -} -#[inline] #[allow(dead_code)] -pub fn HTTP_LESS_EQUAL_VERSION(version: HTTP_VERSION, major: ::USHORT, minor: ::USHORT) -> bool { - !HTTP_GREATER_VERSION(version, major, minor) -} -ENUM!{enum HTTP_VERB { - HttpVerbUnparsed, - HttpVerbUnknown, - HttpVerbInvalid, - HttpVerbOPTIONS, - HttpVerbGET, - HttpVerbHEAD, - HttpVerbPOST, - HttpVerbPUT, - HttpVerbDELETE, - HttpVerbTRACE, - HttpVerbCONNECT, - HttpVerbTRACK, - HttpVerbMOVE, - HttpVerbCOPY, - HttpVerbPROPFIND, - HttpVerbPROPPATCH, - HttpVerbMKCOL, - HttpVerbLOCK, - HttpVerbUNLOCK, - HttpVerbSEARCH, - HttpVerbMaximum, -}} -pub type PHTTP_VERB = *mut HTTP_VERB; -ENUM!{enum HTTP_HEADER_ID { - HttpHeaderCacheControl = 0, - HttpHeaderConnection = 1, - HttpHeaderDate = 2, - HttpHeaderKeepAlive = 3, - HttpHeaderPragma = 4, - HttpHeaderTrailer = 5, - HttpHeaderTransferEncoding = 6, - HttpHeaderUpgrade = 7, - HttpHeaderVia = 8, - HttpHeaderWarning = 9, - HttpHeaderAllow = 10, - HttpHeaderContentLength = 11, - HttpHeaderContentType = 12, - HttpHeaderContentEncoding = 13, - HttpHeaderContentLanguage = 14, - HttpHeaderContentLocation = 15, - HttpHeaderContentMd5 = 16, - HttpHeaderContentRange = 17, - HttpHeaderExpires = 18, - HttpHeaderLastModified = 19, - HttpHeaderAccept = 20, - HttpHeaderAcceptCharset = 21, - HttpHeaderAcceptEncoding = 22, - HttpHeaderAcceptLanguage = 23, - HttpHeaderAuthorization = 24, - HttpHeaderCookie = 25, - HttpHeaderExpect = 26, - HttpHeaderFrom = 27, - HttpHeaderHost = 28, - HttpHeaderIfMatch = 29, - HttpHeaderIfModifiedSince = 30, - HttpHeaderIfNoneMatch = 31, - HttpHeaderIfRange = 32, - HttpHeaderIfUnmodifiedSince = 33, - HttpHeaderMaxForwards = 34, - HttpHeaderProxyAuthorization = 35, - HttpHeaderReferer = 36, - HttpHeaderRange = 37, - HttpHeaderTe = 38, - HttpHeaderTranslate = 39, - HttpHeaderUserAgent = 40, - HttpHeaderRequestMaximum = 41, - HttpHeaderAcceptRanges = 20, - HttpHeaderAge = 21, - HttpHeaderEtag = 22, - HttpHeaderLocation = 23, - HttpHeaderProxyAuthenticate = 24, - HttpHeaderRetryAfter = 25, - HttpHeaderServer = 26, - HttpHeaderSetCookie = 27, - HttpHeaderVary = 28, - HttpHeaderWwwAuthenticate = 29, - HttpHeaderResponseMaximum = 30, - HttpHeaderMaximum = 41, -}} -pub type PHTTP_HEADER_ID = *mut HTTP_HEADER_ID; -STRUCT!{struct HTTP_KNOWN_HEADER { - RawValueLength: ::USHORT, - pRawValue: ::PCSTR, -}} -pub type PHTTP_KNOWN_HEADER = *mut HTTP_KNOWN_HEADER; -STRUCT!{struct HTTP_UNKNOWN_HEADER { - NameLength: ::USHORT, - RawValueLength: ::USHORT, - pName: ::PCSTR, - pRawValue: ::PCSTR, -}} -pub type PHTTP_UNKNOWN_HEADER = *mut HTTP_UNKNOWN_HEADER; -ENUM!{enum HTTP_LOG_DATA_TYPE { - HttpLogDataTypeFields = 0, -}} -pub type PHTTP_LOG_DATA_TYPE = *mut HTTP_LOG_DATA_TYPE; -STRUCT!{struct HTTP_LOG_DATA { - Type: HTTP_LOG_DATA_TYPE, -}} -pub type PHTTP_LOG_DATA = *mut HTTP_LOG_DATA; -STRUCT!{struct HTTP_LOG_FIELDS_DATA { - Base: HTTP_LOG_DATA, - UserNameLength: ::USHORT, - UriStemLength: ::USHORT, - ClientIpLength: ::USHORT, - ServerNameLength: ::USHORT, - ServiceNameLength: ::USHORT, - ServerIpLength: ::USHORT, - MethodLength: ::USHORT, - UriQueryLength: ::USHORT, - HostLength: ::USHORT, - UserAgentLength: ::USHORT, - CookieLength: ::USHORT, - ReferrerLength: ::USHORT, - UserName: ::PWCHAR, - UriStem: ::PWCHAR, - ClientIp: ::PCHAR, - ServerName: ::PCHAR, - ServiceName: ::PCHAR, - ServerIp: ::PCHAR, - Method: ::PCHAR, - UriQuery: ::PCHAR, - Host: ::PCHAR, - UserAgent: ::PCHAR, - Cookie: ::PCHAR, - Referrer: ::PCHAR, - ServerPort: ::USHORT, - ProtocolStatus: ::USHORT, - Win32Status: ::ULONG, - MethodNum: HTTP_VERB, - SubStatus: ::USHORT, -}} -pub type PHTTP_LOG_FIELDS_DATA = *mut HTTP_LOG_FIELDS_DATA; -ENUM!{enum HTTP_DATA_CHUNK_TYPE { - HttpDataChunkFromMemory, - HttpDataChunkFromFileHandle, - HttpDataChunkFromFragmentCache, - HttpDataChunkFromFragmentCacheEx, - HttpDataChunkMaximum, -}} -pub type PHTTP_DATA_CHUNK_TYPE = *mut HTTP_DATA_CHUNK_TYPE; -STRUCT!{struct HTTP_DATA_CHUNK_FromMemory { - pBuffer: ::PVOID, - BufferLength: ::ULONG, -}} -STRUCT!{struct HTTP_DATA_CHUNK_FromFileHandle { - ByteRange: HTTP_BYTE_RANGE, - FileHandle: ::HANDLE, -}} -STRUCT!{struct HTTP_DATA_CHUNK_FromFragmentCache { - FragmentNameLength: ::USHORT, - pFragmentName: ::PCWSTR, -}} -STRUCT!{struct HTTP_DATA_CHUNK_FromFragmentCacheEx { - ByteRange: HTTP_BYTE_RANGE, - pFragmentName: ::PCWSTR, -}} -STRUCT!{struct HTTP_DATA_CHUNK { - DataChunkType: HTTP_DATA_CHUNK_TYPE, - FromFileHandle: HTTP_DATA_CHUNK_FromFileHandle, -}} -UNION!(HTTP_DATA_CHUNK, FromFileHandle, FromMemory, FromMemory_mut, HTTP_DATA_CHUNK_FromMemory); -UNION!( - HTTP_DATA_CHUNK, FromFileHandle, FromFragmentCache, FromFragmentCache_mut, - HTTP_DATA_CHUNK_FromFragmentCache -); -UNION!( - HTTP_DATA_CHUNK, FromFileHandle, FromFragmentCacheEx, FromFragmentCacheEx_mut, - HTTP_DATA_CHUNK_FromFragmentCacheEx -); -pub type PHTTP_DATA_CHUNK = *mut HTTP_DATA_CHUNK; -STRUCT!{nodebug struct HTTP_REQUEST_HEADERS { - UnknownHeaderCount: ::USHORT, - pUnknownHeaders: PHTTP_UNKNOWN_HEADER, - TrailerCount: ::USHORT, - pTrailers: PHTTP_UNKNOWN_HEADER, - KnownHeaders: [HTTP_KNOWN_HEADER; 41], // FIXME HttpHeaderRequestMaximum -}} -pub type PHTTP_REQUEST_HEADERS = *mut HTTP_REQUEST_HEADERS; -STRUCT!{nodebug struct HTTP_RESPONSE_HEADERS { - UnknownHeaderCount: ::USHORT, - pUnknownHeaders: PHTTP_UNKNOWN_HEADER, - TrailerCount: ::USHORT, - pTrailers: PHTTP_UNKNOWN_HEADER, - KnownHeaders: [HTTP_KNOWN_HEADER; 30], // FIXME HttpHeaderResponseMaximum -}} -pub type PHTTP_RESPONSE_HEADERS = *mut HTTP_RESPONSE_HEADERS; -STRUCT!{struct HTTP_TRANSPORT_ADDRESS { - pRemoteAddress: ::PSOCKADDR, - pLocalAddress: ::PSOCKADDR, -}} -pub type PHTTP_TRANSPORT_ADDRESS = *mut HTTP_TRANSPORT_ADDRESS; -STRUCT!{struct HTTP_COOKED_URL { - FullUrlLength: ::USHORT, - HostLength: ::USHORT, - AbsPathLength: ::USHORT, - QueryStringLength: ::USHORT, - pFullUrl: ::PCWSTR, - pHost: ::PCWSTR, - pAbsPath: ::PCWSTR, - pQueryString: ::PCWSTR, -}} -pub type PHTTP_COOKED_URL = *mut HTTP_COOKED_URL; -pub type HTTP_URL_CONTEXT = ::ULONGLONG; -pub const HTTP_URL_FLAG_REMOVE_ALL: ::ULONG = 0x00000001; -ENUM!{enum HTTP_AUTH_STATUS { - HttpAuthStatusSuccess, - HttpAuthStatusNotAuthenticated, - HttpAuthStatusFailure, -}} -pub type PHTTP_AUTH_STATUS = *mut HTTP_AUTH_STATUS; -ENUM!{enum HTTP_REQUEST_AUTH_TYPE { - HttpRequestAuthTypeNone = 0, - HttpRequestAuthTypeBasic, - HttpRequestAuthTypeDigest, - HttpRequestAuthTypeNTLM, - HttpRequestAuthTypeNegotiate, - HttpRequestAuthTypeKerberos, -}} -pub type PHTTP_REQUEST_AUTH_TYPE = *mut HTTP_REQUEST_AUTH_TYPE; -STRUCT!{struct HTTP_SSL_CLIENT_CERT_INFO { - CertFlags: ::ULONG, - CertEncodedSize: ::ULONG, - pCertEncoded: ::PUCHAR, - Token: ::HANDLE, - CertDeniedByMapper: ::BOOLEAN, -}} -pub type PHTTP_SSL_CLIENT_CERT_INFO = *mut HTTP_SSL_CLIENT_CERT_INFO; -pub const HTTP_RECEIVE_SECURE_CHANNEL_TOKEN: ::ULONG = 0x1; -STRUCT!{struct HTTP_SSL_INFO { - ServerCertKeySize: ::USHORT, - ConnectionKeySize: ::USHORT, - ServerCertIssuerSize: ::ULONG, - ServerCertSubjectSize: ::ULONG, - pServerCertIssuer: ::PCSTR, - pServerCertSubject: ::PCSTR, - pClientCertInfo: PHTTP_SSL_CLIENT_CERT_INFO, - SslClientCertNegotiated: ::ULONG, -}} -pub type PHTTP_SSL_INFO = *mut HTTP_SSL_INFO; -ENUM!{enum HTTP_REQUEST_INFO_TYPE { - HttpRequestInfoTypeAuth, - HttpRequestInfoTypeChannelBind, -}} -STRUCT!{struct HTTP_REQUEST_INFO { - InfoType: HTTP_REQUEST_INFO_TYPE, - InfoLength: ::ULONG, - pInfo: ::PVOID, -}} -pub type PHTTP_REQUEST_INFO = *mut HTTP_REQUEST_INFO; -pub const HTTP_REQUEST_AUTH_FLAG_TOKEN_FOR_CACHED_CRED: ::ULONG = 0x00000001; -STRUCT!{struct HTTP_REQUEST_AUTH_INFO { - AuthStatus: HTTP_AUTH_STATUS, - SecStatus: ::SECURITY_STATUS, - Flags: ::ULONG, - AuthType: HTTP_REQUEST_AUTH_TYPE, - AccessToken: ::HANDLE, - ContextAttributes: ::ULONG, - PackedContextLength: ::ULONG, - PackedContextType: ::ULONG, - PackedContext: ::PVOID, - MutualAuthDataLength: ::ULONG, - pMutualAuthData: ::PCHAR, - PackageNameLength: ::USHORT, - pPackageName: ::PWSTR, -}} -pub type PHTTP_REQUEST_AUTH_INFO = *mut HTTP_REQUEST_AUTH_INFO; -STRUCT!{nodebug struct HTTP_REQUEST_V1 { - Flags: ::ULONG, - ConnectionId: HTTP_CONNECTION_ID, - RequestId: HTTP_REQUEST_ID, - UrlContext: HTTP_URL_CONTEXT, - Version: HTTP_VERSION, - Verb: HTTP_VERB, - UnknownVerbLength: ::USHORT, - RawUrlLength: ::USHORT, - pUnknownVerb: ::PCSTR, - pRawUrl: ::PCSTR, - CookedUrl: HTTP_COOKED_URL, - Address: HTTP_TRANSPORT_ADDRESS, - Headers: HTTP_REQUEST_HEADERS, - BytesReceived: ::ULONGLONG, - EntityChunkCount: ::USHORT, - pEntityChunks: PHTTP_DATA_CHUNK, - RawConnectionId: HTTP_RAW_CONNECTION_ID, - pSslInfo: PHTTP_SSL_INFO, -}} -pub type PHTTP_REQUEST_V1 = *mut HTTP_REQUEST_V1; -STRUCT!{nodebug struct HTTP_REQUEST_V2 { - Base: HTTP_REQUEST_V1, - RequestInfoCount: ::USHORT, - pRequestInfo: PHTTP_REQUEST_INFO, -}} -pub type PHTTP_REQUEST_V2 = *mut HTTP_REQUEST_V2; -pub type HTTP_REQUEST = HTTP_REQUEST_V2; -pub type PHTTP_REQUEST = *mut HTTP_REQUEST; -pub const HTTP_REQUEST_FLAG_MORE_ENTITY_BODY_EXISTS: ::ULONG = 0x00000001; -pub const HTTP_REQUEST_FLAG_IP_ROUTED: ::ULONG = 0x00000002; -STRUCT!{nodebug struct HTTP_RESPONSE_V1 { - Flags: ::ULONG, - Version: HTTP_VERSION, - StatusCode: ::USHORT, - ReasonLength: ::USHORT, - pReason: ::PCSTR, - Headers: HTTP_RESPONSE_HEADERS, - EntityChunkCount: ::USHORT, - pEntityChunks: PHTTP_DATA_CHUNK, -}} -pub type PHTTP_RESPONSE_V1 = *mut HTTP_RESPONSE_V1; -pub const HTTP_RESPONSE_FLAG_MULTIPLE_ENCODINGS_AVAILABLE: ::ULONG = 0x00000001; -ENUM!{enum HTTP_RESPONSE_INFO_TYPE { - HttpResponseInfoTypeMultipleKnownHeaders, - HttpResponseInfoTypeAuthenticationProperty, - HttpResponseInfoTypeQoSProperty, - HttpResponseInfoTypeChannelBind, -}} -pub type PHTTP_RESPONSE_INFO_TYPE = *mut HTTP_RESPONSE_INFO_TYPE; -STRUCT!{struct HTTP_RESPONSE_INFO { - Type: HTTP_RESPONSE_INFO_TYPE, - Length: ::ULONG, - pInfo: ::PVOID, -}} -pub type PHTTP_RESPONSE_INFO = *mut HTTP_RESPONSE_INFO; -pub const HTTP_RESPONSE_INFO_FLAGS_PRESERVE_ORDER: ::ULONG = 0x00000001; -STRUCT!{struct HTTP_MULTIPLE_KNOWN_HEADERS { - HeaderId: HTTP_HEADER_ID, - Flags: ::ULONG, - KnownHeaderCount: ::USHORT, - KnownHeaders: PHTTP_KNOWN_HEADER, -}} -pub type PHTTP_MULTIPLE_KNOWN_HEADERS = *mut HTTP_MULTIPLE_KNOWN_HEADERS; -STRUCT!{nodebug struct HTTP_RESPONSE_V2 { - Base: HTTP_RESPONSE_V1, - ResponseInfoCount: ::USHORT, - pResponseInfo: PHTTP_RESPONSE_INFO, -}} -pub type PHTTP_RESPONSE_V2 = *mut HTTP_RESPONSE_V2; -pub type HTTP_RESPONSE = HTTP_RESPONSE_V2; -pub type PHTTP_RESPONSE = *mut HTTP_RESPONSE; -STRUCT!{struct HTTPAPI_VERSION { - HttpApiMajorVersion: ::USHORT, - HttpApiMinorVersion: ::USHORT, -}} -pub type PHTTPAPI_VERSION = *mut HTTPAPI_VERSION; -pub const HTTPAPI_VERSION_2: HTTPAPI_VERSION = HTTPAPI_VERSION { - HttpApiMajorVersion: 2, HttpApiMinorVersion: 0, -}; -pub const HTTPAPI_VERSION_1: HTTPAPI_VERSION = HTTPAPI_VERSION { - HttpApiMajorVersion: 1, HttpApiMinorVersion: 0, -}; -#[inline] #[allow(dead_code)] -pub fn HTTPAPI_EQUAL_VERSION(version: HTTPAPI_VERSION, major: ::USHORT, minor: ::USHORT) -> bool { - version.HttpApiMajorVersion == major && version.HttpApiMinorVersion == minor -} -#[inline] #[allow(dead_code)] -pub fn HTTPAPI_GREATER_VERSION(version: HTTPAPI_VERSION, major: ::USHORT, minor: ::USHORT) -> bool { - version.HttpApiMajorVersion > major || - (version.HttpApiMajorVersion == major && version.HttpApiMinorVersion > minor) -} -#[inline] #[allow(dead_code)] -pub fn HTTPAPI_LESS_VERSION(version: HTTPAPI_VERSION, major: ::USHORT, minor: ::USHORT) -> bool { - version.HttpApiMajorVersion < major || - (version.HttpApiMajorVersion == major && version.HttpApiMinorVersion < minor) -} -#[inline] #[allow(dead_code)] -pub fn HTTPAPI_VERSION_GREATER_OR_EQUAL( - version: HTTPAPI_VERSION, major: ::USHORT, minor: ::USHORT -) -> bool { - !HTTPAPI_LESS_VERSION(version, major, minor) -} -ENUM!{enum HTTP_CACHE_POLICY_TYPE { - HttpCachePolicyNocache, - HttpCachePolicyUserInvalidates, - HttpCachePolicyTimeToLive, - HttpCachePolicyMaximum, -}} -pub type PHTTP_CACHE_POLICY_TYPE = *mut HTTP_CACHE_POLICY_TYPE; -STRUCT!{struct HTTP_CACHE_POLICY { - Policy: HTTP_CACHE_POLICY_TYPE, - SecondsToLive: ::ULONG, -}} -pub type PHTTP_CACHE_POLICY = *mut HTTP_CACHE_POLICY; -ENUM!{enum HTTP_SERVICE_CONFIG_ID { - HttpServiceConfigIPListenList, - HttpServiceConfigSSLCertInfo, - HttpServiceConfigUrlAclInfo, - HttpServiceConfigTimeout, - HttpServiceConfigCache, - HttpServiceConfigSslSniCertInfo, - HttpServiceConfigSslCcsCertInfo, - HttpServiceConfigMax, -}} -pub type PHTTP_SERVICE_CONFIG_ID = *mut HTTP_SERVICE_CONFIG_ID; -ENUM!{enum HTTP_SERVICE_CONFIG_QUERY_TYPE { - HttpServiceConfigQueryExact, - HttpServiceConfigQueryNext, - HttpServiceConfigQueryMax, -}} -pub type PHTTP_SERVICE_CONFIG_QUERY_TYPE = *mut HTTP_SERVICE_CONFIG_QUERY_TYPE; -STRUCT!{struct HTTP_SERVICE_CONFIG_SSL_KEY { - pIpPort: ::PSOCKADDR, -}} -pub type PHTTP_SERVICE_CONFIG_SSL_KEY = *mut HTTP_SERVICE_CONFIG_SSL_KEY; -STRUCT!{nodebug struct HTTP_SERVICE_CONFIG_SSL_SNI_KEY { - IpPort: ::SOCKADDR_STORAGE, - Host: ::PWSTR, -}} -pub type PHTTP_SERVICE_CONFIG_SSL_SNI_KEY = *mut HTTP_SERVICE_CONFIG_SSL_SNI_KEY; -STRUCT!{nodebug struct HTTP_SERVICE_CONFIG_SSL_CCS_KEY { - LocalAddress: ::SOCKADDR_STORAGE, -}} -pub type PHTTP_SERVICE_CONFIG_SSL_CCS_KEY = *mut HTTP_SERVICE_CONFIG_SSL_CCS_KEY; -STRUCT!{struct HTTP_SERVICE_CONFIG_SSL_PARAM { - SslHashLength: ::ULONG, - pSslHash: ::PVOID, - AppId: ::GUID, - pSslCertStoreName: ::PWSTR, - DefaultCertCheckMode: ::DWORD, - DefaultRevocationFreshnessTime: ::DWORD, - DefaultRevocationUrlRetrievalTimeout: ::DWORD, - pDefaultSslCtlIdentifier: ::PWSTR, - pDefaultSslCtlStoreName: ::PWSTR, - DefaultFlags: ::DWORD, -}} -pub type PHTTP_SERVICE_CONFIG_SSL_PARAM = *mut HTTP_SERVICE_CONFIG_SSL_PARAM; -pub const HTTP_SERVICE_CONFIG_SSL_FLAG_USE_DS_MAPPER: ::DWORD = 0x00000001; -pub const HTTP_SERVICE_CONFIG_SSL_FLAG_NEGOTIATE_CLIENT_CERT: ::DWORD = 0x00000002; -pub const HTTP_SERVICE_CONFIG_SSL_FLAG_NO_RAW_FILTER: ::DWORD = 0x00000004; -STRUCT!{struct HTTP_SERVICE_CONFIG_SSL_SET { - KeyDesc: HTTP_SERVICE_CONFIG_SSL_KEY, - ParamDesc: HTTP_SERVICE_CONFIG_SSL_PARAM, -}} -pub type PHTTP_SERVICE_CONFIG_SSL_SET = *mut HTTP_SERVICE_CONFIG_SSL_SET; -STRUCT!{nodebug struct HTTP_SERVICE_CONFIG_SSL_SNI_SET { - KeyDesc: HTTP_SERVICE_CONFIG_SSL_SNI_KEY, - ParamDesc: HTTP_SERVICE_CONFIG_SSL_PARAM, -}} -pub type PHTTP_SERVICE_CONFIG_SSL_SNI_SET = *mut HTTP_SERVICE_CONFIG_SSL_SNI_SET; -STRUCT!{nodebug struct HTTP_SERVICE_CONFIG_SSL_CCS_SET { - KeyDesc: HTTP_SERVICE_CONFIG_SSL_CCS_KEY, - ParamDesc: HTTP_SERVICE_CONFIG_SSL_PARAM, -}} -pub type PHTTP_SERVICE_CONFIG_SSL_CCS_SET = *mut HTTP_SERVICE_CONFIG_SSL_CCS_SET; -STRUCT!{struct HTTP_SERVICE_CONFIG_SSL_QUERY { - QueryDesc: HTTP_SERVICE_CONFIG_QUERY_TYPE, - KeyDesc: HTTP_SERVICE_CONFIG_SSL_KEY, - dwToken: ::DWORD, -}} -pub type PHTTP_SERVICE_CONFIG_SSL_QUERY = *mut HTTP_SERVICE_CONFIG_SSL_QUERY; -STRUCT!{nodebug struct HTTP_SERVICE_CONFIG_SSL_SNI_QUERY { - QueryDesc: HTTP_SERVICE_CONFIG_QUERY_TYPE, - KeyDesc: HTTP_SERVICE_CONFIG_SSL_SNI_KEY, - dwToken: ::DWORD, -}} -pub type PHTTP_SERVICE_CONFIG_SSL_SNI_QUERY = *mut HTTP_SERVICE_CONFIG_SSL_SNI_QUERY; -STRUCT!{nodebug struct HTTP_SERVICE_CONFIG_SSL_CCS_QUERY { - QueryDesc: HTTP_SERVICE_CONFIG_QUERY_TYPE, - KeyDesc: HTTP_SERVICE_CONFIG_SSL_CCS_KEY, - dwToken: ::DWORD, -}} -pub type PHTTP_SERVICE_CONFIG_SSL_CCS_QUERY = *mut HTTP_SERVICE_CONFIG_SSL_CCS_QUERY; -STRUCT!{struct HTTP_SERVICE_CONFIG_IP_LISTEN_PARAM { - AddrLength: ::USHORT, - pAddress: ::PSOCKADDR, -}} -pub type PHTTP_SERVICE_CONFIG_IP_LISTEN_PARAM = *mut HTTP_SERVICE_CONFIG_IP_LISTEN_PARAM; -STRUCT!{nodebug struct HTTP_SERVICE_CONFIG_IP_LISTEN_QUERY { - AddrCount: ::ULONG, - AddrList: [::SOCKADDR_STORAGE; ::ANYSIZE_ARRAY], -}} -pub type PHTTP_SERVICE_CONFIG_IP_LISTEN_QUERY = *mut HTTP_SERVICE_CONFIG_IP_LISTEN_QUERY; -STRUCT!{struct HTTP_SERVICE_CONFIG_URLACL_KEY { - pUrlPrefix: ::PWSTR, -}} -pub type PHTTP_SERVICE_CONFIG_URLACL_KEY = *mut HTTP_SERVICE_CONFIG_URLACL_KEY; -STRUCT!{struct HTTP_SERVICE_CONFIG_URLACL_PARAM { - pStringSecurityDescriptor: ::PWSTR, -}} -pub type PHTTP_SERVICE_CONFIG_URLACL_PARAM = *mut HTTP_SERVICE_CONFIG_URLACL_PARAM; -STRUCT!{struct HTTP_SERVICE_CONFIG_URLACL_SET { - KeyDesc: HTTP_SERVICE_CONFIG_URLACL_KEY, - ParamDesc: HTTP_SERVICE_CONFIG_URLACL_PARAM, -}} -pub type PHTTP_SERVICE_CONFIG_URLACL_SET = *mut HTTP_SERVICE_CONFIG_URLACL_SET; -STRUCT!{struct HTTP_SERVICE_CONFIG_URLACL_QUERY { - QueryDesc: HTTP_SERVICE_CONFIG_QUERY_TYPE, - KeyDesc: HTTP_SERVICE_CONFIG_URLACL_KEY, - dwToken: ::DWORD, -}} -pub type PHTTP_SERVICE_CONFIG_URLACL_QUERY = *mut HTTP_SERVICE_CONFIG_URLACL_QUERY; -ENUM!{enum HTTP_SERVICE_CONFIG_CACHE_KEY { - MaxCacheResponseSize = 0, - CacheRangeChunkSize, -}} -pub type PHTTP_SERVICE_CONFIG_CACHE_KEY = *mut HTTP_SERVICE_CONFIG_CACHE_KEY; -pub type HTTP_SERVICE_CONFIG_CACHE_PARAM = ::ULONG; -pub type PHTTP_SERVICE_CONFIG_CACHE_PARAM = *mut ::ULONG; -STRUCT!{struct HTTP_SERVICE_CONFIG_CACHE_SET { - KeyDesc: HTTP_SERVICE_CONFIG_CACHE_KEY, - ParamDesc: HTTP_SERVICE_CONFIG_CACHE_PARAM, -}} -pub type PHTTP_SERVICE_CONFIG_CACHE_SET = *mut HTTP_SERVICE_CONFIG_CACHE_SET; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/imm.rs cargo-0.37.0/vendor/winapi-0.2.8/src/imm.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/imm.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/imm.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -pub type LPUINT = *mut ::c_uint; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/inaddr.rs cargo-0.37.0/vendor/winapi-0.2.8/src/inaddr.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/inaddr.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/inaddr.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! IPv4 Internet address -STRUCT!{struct in_addr_S_un_b { - s_b1: ::UCHAR, - s_b2: ::UCHAR, - s_b3: ::UCHAR, - s_b4: ::UCHAR, -}} -STRUCT!{struct in_addr_S_un_w { - s_w1: ::USHORT, - s_w2: ::USHORT, -}} -STRUCT!{struct in_addr { - S_un: ::ULONG, -}} -UNION!(in_addr, S_un, S_un_b, S_un_b_mut, in_addr_S_un_b); -UNION!(in_addr, S_un, S_un_w, S_un_w_mut, in_addr_S_un_w); -UNION!(in_addr, S_un, S_addr, S_addr_mut, ::ULONG); -pub type IN_ADDR = in_addr; -pub type PIN_ADDR = *mut in_addr; -pub type LPIN_ADDR = *mut in_addr; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/inspectable.rs cargo-0.37.0/vendor/winapi-0.2.8/src/inspectable.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/inspectable.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/inspectable.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -pub type LPINSPECTABLE = *mut IInspectable; -ENUM!{enum TrustLevel { - BaseTrust = 0, - PartialTrust, - FullTrust, -}} -RIDL!( -interface IInspectable(IInspectableVtbl): IUnknown(IUnknownVtbl) { - fn GetIids(&mut self, iidCount: *mut ::ULONG, iids: *mut *mut ::IID) -> ::HRESULT, - fn GetRuntimeClassName(&mut self, className: *mut ::HSTRING) -> ::HRESULT, - fn GetTrustLevel(&mut self, trustLevel: *mut TrustLevel) -> ::HRESULT -} -); diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/ksmedia.rs cargo-0.37.0/vendor/winapi-0.2.8/src/ksmedia.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/ksmedia.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/ksmedia.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -DEFINE_GUID!(KSDATAFORMAT_SUBTYPE_ANALOG, 0x6DBA3190, 0x67BD, 0x11CF, - 0xA0, 0xF7, 0x00, 0x20, 0xAF, 0xD1, 0x56, 0xE4); -DEFINE_GUID!(KSDATAFORMAT_SUBTYPE_PCM, 0x00000001, 0x0000, 0x0010, - 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -DEFINE_GUID!(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 0x00000003, 0x0000, 0x0010, - 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -DEFINE_GUID!(KSDATAFORMAT_SUBTYPE_DRM, 0x00000009, 0x0000, 0x0010, - 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -DEFINE_GUID!(KSDATAFORMAT_SUBTYPE_ALAW, 0x00000006, 0x0000, 0x0010, - 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -DEFINE_GUID!(KSDATAFORMAT_SUBTYPE_MULAW, 0x00000007, 0x0000, 0x0010, - 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -DEFINE_GUID!(KSDATAFORMAT_SUBTYPE_ADPCM, 0x00000002, 0x0000, 0x0010, - 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); -DEFINE_GUID!(KSDATAFORMAT_SUBTYPE_MPEG, 0x00000050, 0x0000, 0x0010, - 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/libloaderapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/libloaderapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/libloaderapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/libloaderapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! ApiSet Contract for api-ms-win-core-libraryloader-l1 -pub type DLL_DIRECTORY_COOKIE = ::PVOID; -pub type PDLL_DIRECTORY_COOKIE = *mut ::PVOID; -pub type ENUMRESLANGPROCA = Option ::BOOL>; -pub type ENUMRESLANGPROCW = Option ::BOOL>; -pub type ENUMRESNAMEPROCA = Option ::BOOL>; -pub type ENUMRESNAMEPROCW = Option ::BOOL>; -pub type ENUMRESTYPEPROCA = Option ::BOOL>; -pub type ENUMRESTYPEPROCW = Option ::BOOL>; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/lib.rs cargo-0.37.0/vendor/winapi-0.2.8/src/lib.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/lib.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,368 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Types and constants for WinAPI bindings. -#![allow(bad_style)] -#![warn(trivial_casts, trivial_numeric_casts)] -#![warn(unused_qualifications, unused)] -#![cfg(windows)] -//------------------------------------------------------------------------------------------------- -// Imports -//------------------------------------------------------------------------------------------------- -pub use std::os::raw::{ - c_void, - c_char, - c_schar, - c_uchar, - c_short, - c_ushort, - c_int, - c_uint, - c_long, - c_ulong, - c_longlong, - c_ulonglong, - c_float, - c_double, -}; -pub use activation::*; -pub use audioclient::*; -pub use audiosessiontypes::*; -pub use basetsd::*; -pub use bcrypt::*; -pub use cfg::*; -pub use cfgmgr32::*; -pub use combaseapi::*; -pub use commctrl::*; -pub use commdlg::*; -pub use corsym::*; -pub use d2d1::*; -pub use d2dbasetypes::*; -pub use d3d9::*; -pub use d3d9caps::*; -pub use d3d9types::*; -pub use d3d11::*; -pub use d3d10shader::*; -pub use d3d11shader::*; -pub use d3d12::*; -pub use d3d12sdklayers::*; -pub use d3d12shader::*; -pub use d3dcommon::*; -pub use d3dcompiler::*; -pub use dbghelp::*; -pub use dcommon::*; -pub use devpropdef::*; -pub use docobj::*; -pub use dpapi::*; -pub use dsgetdc::*; -pub use dsound::*; -pub use dsrole::*; -pub use dwmapi::*; -pub use dwrite::*; -pub use dxgi::*; -pub use dxgi1_2::*; -pub use dxgi1_3::*; -pub use dxgi1_4::*; -pub use dxgiformat::*; -pub use dxgitype::*; -pub use errhandlingapi::*; -pub use excpt::*; -pub use fileapi::*; -pub use gl::*; -pub use guiddef::*; -pub use heapapi::*; -pub use hidclass::*; -pub use hidpi::*; -pub use hidsdi::*; -pub use hidusage::*; -pub use hstring::*; -pub use http::*; -pub use imm::*; -pub use inaddr::*; -pub use inspectable::*; -pub use ksmedia::*; -pub use libloaderapi::*; -pub use lmaccess::*; -pub use lmcons::*; -pub use lmdfs::*; -pub use lmerrlog::*; -pub use lmjoin::*; -pub use lsalookup::*; -pub use memoryapi::*; -pub use minschannel::*; -pub use minwinbase::*; -pub use minwindef::*; -pub use mmdeviceapi::*; -pub use mmreg::*; -pub use mmsystem::*; -pub use mscat::*; -pub use mssip::*; -pub use nb30::*; -pub use ncrypt::*; -pub use ntdef::*; -pub use ntsecapi::*; -pub use ntstatus::*; -pub use oaidl::*; -pub use objbase::*; -pub use objidl::*; -pub use objidlbase::*; -pub use olectl::*; -pub use pdh::*; -pub use playsoundapi::*; -pub use processsnapshot::*; -pub use processthreadsapi::*; -pub use propidl::*; -pub use propsys::*; -pub use prsht::*; -pub use psapi::*; -pub use qos::*; -pub use reason::*; -pub use restrictederrorinfo::*; -pub use roapi::*; -pub use roerrorapi::*; -pub use rpc::*; -pub use rpcdce::*; -pub use sapi::*; -pub use schannel::*; -pub use servprov::*; -pub use setupapi::*; -pub use shellapi::*; -pub use shellscalingapi::*; -pub use shlguid::*; -pub use shlobj::*; -pub use shobjidl::*; -pub use shtypes::*; -pub use spapidef::*; -pub use sqltypes::*; -pub use sspi::*; -pub use strmif::*; -pub use subauth::*; -pub use synchapi::*; -pub use sysinfoapi::*; -pub use threadpoolapi::*; -pub use timezoneapi::*; -pub use tlhelp32::*; -pub use unknwnbase::*; -pub use urlhist::*; -pub use urlmon::*; -pub use usb::*; -pub use usbspec::*; -pub use usp10::*; -pub use vadefs::*; -pub use vsbackup::*; -pub use vss::*; -pub use vsserror::*; -pub use vswriter::*; -pub use werapi::*; -pub use winbase::*; -pub use wincon::*; -pub use wincred::*; -pub use wincrypt::*; -pub use windowsx::*; -pub use windef::*; -pub use windowscodecs::*; -pub use winerror::*; -pub use winevt::*; -pub use wingdi::*; -pub use winhttp::*; -pub use winioctl::*; -pub use winnetwk::*; -pub use winnls::*; -pub use winnt::*; -pub use winreg::*; -pub use winscard::*; -pub use winsmcrd::*; -pub use winsock2::*; -pub use winspool::*; -pub use winstring::*; -pub use winsvc::*; -pub use winusb::*; -pub use winusbio::*; -pub use winuser::*; -pub use ws2def::*; -pub use ws2ipdef::*; -pub use ws2spi::*; -pub use ws2tcpip::*; -pub use wtypes::*; -pub use wtypesbase::*; -pub use xinput::*; -//------------------------------------------------------------------------------------------------- -// Modules -//------------------------------------------------------------------------------------------------- -#[macro_use] mod macros; -pub mod activation; -pub mod audioclient; -pub mod audiosessiontypes; -pub mod basetsd; -pub mod bcrypt; -pub mod cfg; -pub mod cfgmgr32; -pub mod combaseapi; -pub mod commctrl; -pub mod commdlg; -pub mod corsym; -pub mod d2d1; -pub mod d2dbasetypes; -pub mod d3d9; -pub mod d3d9caps; -pub mod d3d9types; -pub mod d3d11; -pub mod d3d10shader; -pub mod d3d11shader; -pub mod d3d12; -pub mod d3d12sdklayers; -pub mod d3d12shader; -pub mod d3dcommon; -pub mod d3dcompiler; -pub mod dbghelp; -pub mod dcommon; -pub mod devpropdef; -pub mod docobj; -pub mod dpapi; -pub mod dsgetdc; -pub mod dsound; -pub mod dsrole; -pub mod dwmapi; -pub mod dwrite; -pub mod dxgi; -pub mod dxgi1_2; -pub mod dxgi1_3; -pub mod dxgi1_4; -pub mod dxgiformat; -pub mod dxgitype; -pub mod errhandlingapi; -pub mod excpt; -pub mod fileapi; -pub mod gl; -pub mod guiddef; -pub mod heapapi; -pub mod hidclass; -pub mod hidpi; -pub mod hidsdi; -pub mod hidusage; -pub mod hstring; -pub mod http; -pub mod imm; -pub mod inaddr; -pub mod inspectable; -pub mod ksmedia; -pub mod libloaderapi; -pub mod lmaccess; -pub mod lmcons; -pub mod lmdfs; -pub mod lmerrlog; -pub mod lmjoin; -pub mod lsalookup; -pub mod memoryapi; -pub mod minschannel; -pub mod minwinbase; -pub mod minwindef; -pub mod mmdeviceapi; -pub mod mmreg; -pub mod mmsystem; -pub mod mscat; -pub mod mssip; -pub mod nb30; -pub mod ncrypt; -pub mod ntdef; -pub mod ntsecapi; -pub mod ntstatus; -pub mod oaidl; -pub mod objbase; -pub mod objidl; -pub mod objidlbase; -pub mod olectl; -pub mod pdh; -pub mod playsoundapi; -pub mod processsnapshot; -pub mod processthreadsapi; -pub mod propidl; -pub mod propsys; -pub mod prsht; -pub mod psapi; -pub mod qos; -pub mod reason; -pub mod restrictederrorinfo; -pub mod roapi; -pub mod roerrorapi; -pub mod rpc; -pub mod rpcdce; -pub mod sapi; -pub mod schannel; -pub mod servprov; -pub mod setupapi; -pub mod shellapi; -pub mod shellscalingapi; -pub mod shlguid; -pub mod shlobj; -pub mod shobjidl; -pub mod shtypes; -pub mod spapidef; -pub mod sqltypes; -pub mod sspi; -pub mod strmif; -pub mod subauth; -pub mod synchapi; -pub mod sysinfoapi; -pub mod threadpoolapi; -pub mod timezoneapi; -pub mod tlhelp32; -pub mod unknwnbase; -pub mod urlhist; -pub mod urlmon; -pub mod usb; -pub mod usbspec; -pub mod usp10; -pub mod vadefs; -pub mod vsbackup; -pub mod vss; -pub mod vsserror; -pub mod vswriter; -pub mod werapi; -pub mod winbase; -pub mod wincon; -pub mod wincred; -pub mod wincrypt; -pub mod windef; -pub mod windowscodecs; -pub mod windowsx; -pub mod winerror; -pub mod winevt; -pub mod wingdi; -pub mod winhttp; -pub mod winioctl; -pub mod winnetwk; -pub mod winnls; -pub mod winnt; -pub mod winreg; -pub mod winscard; -pub mod winsmcrd; -pub mod winsock2; -pub mod winspool; -pub mod winstring; -pub mod winsvc; -pub mod winusb; -pub mod winusbio; -pub mod winuser; -pub mod ws2def; -pub mod ws2ipdef; -pub mod ws2spi; -pub mod ws2tcpip; -pub mod wtypes; -pub mod wtypesbase; -pub mod xinput; -//------------------------------------------------------------------------------------------------- -// Primitive types not provided by std -//------------------------------------------------------------------------------------------------- -pub type __int8 = i8; -pub type __uint8 = u8; -pub type __int16 = i16; -pub type __uint16 = u16; -pub type __int32 = i32; -pub type __uint32 = u32; -pub type __int64 = i64; -pub type __uint64 = u64; -pub type wchar_t = c_ushort; -#[cfg(target_arch = "x86")] -pub type size_t = c_uint; -#[cfg(target_arch = "x86_64")] -pub type size_t = __uint64; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/lmaccess.rs cargo-0.37.0/vendor/winapi-0.2.8/src/lmaccess.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/lmaccess.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/lmaccess.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,853 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -// This file contains structures, function prototypes, and definitions -// for the NetUser, NetUserModals, NetGroup, NetAccess, and NetLogon API. -STRUCT!{struct USER_INFO_0 { - usri0_name: ::LPWSTR, -}} -pub type PUSER_INFO_0 = *mut USER_INFO_0; -pub type LPUSER_INFO_0 = *mut USER_INFO_0; -STRUCT!{struct USER_INFO_1 { - usri1_name: ::LPWSTR, - usri1_password: ::LPWSTR, - usri1_password_age: ::DWORD, - usri1_priv: ::DWORD, - usri1_home_dir: ::LPWSTR, - usri1_comment: ::LPWSTR, - usri1_flags: ::DWORD, - usri1_script_path: ::LPWSTR, -}} -pub type PUSER_INFO_1 = *mut USER_INFO_1; -pub type LPUSER_INFO_1 = *mut USER_INFO_1; -STRUCT!{struct USER_INFO_2 { - usri2_name: ::LPWSTR, - usri2_password: ::LPWSTR, - usri2_password_age: ::DWORD, - usri2_priv: ::DWORD, - usri2_home_dir: ::LPWSTR, - usri2_comment: ::LPWSTR, - usri2_flags: ::DWORD, - usri2_script_path: ::LPWSTR, - usri2_auth_flags: ::DWORD, - usri2_full_name: ::LPWSTR, - usri2_usr_comment: ::LPWSTR, - usri2_parms: ::LPWSTR, - usri2_workstations: ::LPWSTR, - usri2_last_logon: ::DWORD, - usri2_last_logoff: ::DWORD, - usri2_acct_expires: ::DWORD, - usri2_max_storage: ::DWORD, - usri2_units_per_week: ::DWORD, - usri2_logon_hours: ::PBYTE, - usri2_bad_pw_count: ::DWORD, - usri2_num_logons: ::DWORD, - usri2_logon_server: ::LPWSTR, - usri2_country_code: ::DWORD, - usri2_code_page: ::DWORD, -}} -pub type PUSER_INFO_2 = *mut USER_INFO_2; -pub type LPUSER_INFO_2 = *mut USER_INFO_2; -STRUCT!{struct USER_INFO_3 { - usri3_name: ::LPWSTR, - usri3_password: ::LPWSTR, - usri3_password_age: ::DWORD, - usri3_priv: ::DWORD, - usri3_home_dir: ::LPWSTR, - usri3_comment: ::LPWSTR, - usri3_flags: ::DWORD, - usri3_script_path: ::LPWSTR, - usri3_auth_flags: ::DWORD, - usri3_full_name: ::LPWSTR, - usri3_usr_comment: ::LPWSTR, - usri3_parms: ::LPWSTR, - usri3_workstations: ::LPWSTR, - usri3_last_logon: ::DWORD, - usri3_last_logoff: ::DWORD, - usri3_acct_expires: ::DWORD, - usri3_max_storage: ::DWORD, - usri3_units_per_week: ::DWORD, - usri3_logon_hours: ::PBYTE, - usri3_bad_pw_count: ::DWORD, - usri3_num_logons: ::DWORD, - usri3_logon_server: ::LPWSTR, - usri3_country_code: ::DWORD, - usri3_code_page: ::DWORD, - usri3_user_id: ::DWORD, - usri3_primary_group_id: ::DWORD, - usri3_profile: ::LPWSTR, - usri3_home_dir_drive: ::LPWSTR, - usri3_password_expired: ::DWORD, -}} -pub type PUSER_INFO_3 = *mut USER_INFO_3; -pub type LPUSER_INFO_3 = *mut USER_INFO_3; -STRUCT!{struct USER_INFO_4 { - usri4_name: ::LPWSTR, - usri4_password: ::LPWSTR, - usri4_password_age: ::DWORD, - usri4_priv: ::DWORD, - usri4_home_dir: ::LPWSTR, - usri4_comment: ::LPWSTR, - usri4_flags: ::DWORD, - usri4_script_path: ::LPWSTR, - usri4_auth_flags: ::DWORD, - usri4_full_name: ::LPWSTR, - usri4_usr_comment: ::LPWSTR, - usri4_parms: ::LPWSTR, - usri4_workstations: ::LPWSTR, - usri4_last_logon: ::DWORD, - usri4_last_logoff: ::DWORD, - usri4_acct_expires: ::DWORD, - usri4_max_storage: ::DWORD, - usri4_units_per_week: ::DWORD, - usri4_logon_hours: ::PBYTE, - usri4_bad_pw_count: ::DWORD, - usri4_num_logons: ::DWORD, - usri4_logon_server: ::LPWSTR, - usri4_country_code: ::DWORD, - usri4_code_page: ::DWORD, - usri4_user_sid: ::PSID, - usri4_primary_group_id: ::DWORD, - usri4_profile: ::LPWSTR, - usri4_home_dir_drive: ::LPWSTR, - usri4_password_expired: ::DWORD, -}} -pub type PUSER_INFO_4 = *mut USER_INFO_4; -pub type LPUSER_INFO_4 = *mut USER_INFO_4; -STRUCT!{struct USER_INFO_10 { - usri10_name: ::LPWSTR, - usri10_comment: ::LPWSTR, - usri10_usr_comment: ::LPWSTR, - usri10_full_name: ::LPWSTR, -}} -pub type PUSER_INFO_10 = *mut USER_INFO_10; -pub type LPUSER_INFO_10 = *mut USER_INFO_10; -STRUCT!{struct USER_INFO_11 { - usri11_name: ::LPWSTR, - usri11_comment: ::LPWSTR, - usri11_usr_comment: ::LPWSTR, - usri11_full_name: ::LPWSTR, - usri11_priv: ::DWORD, - usri11_auth_flags: ::DWORD, - usri11_password_age: ::DWORD, - usri11_home_dir: ::LPWSTR, - usri11_parms: ::LPWSTR, - usri11_last_logon: ::DWORD, - usri11_last_logoff: ::DWORD, - usri11_bad_pw_count: ::DWORD, - usri11_num_logons: ::DWORD, - usri11_logon_server: ::LPWSTR, - usri11_country_code: ::DWORD, - usri11_workstations: ::LPWSTR, - usri11_max_storage: ::DWORD, - usri11_units_per_week: ::DWORD, - usri11_logon_hours: ::PBYTE, - usri11_code_page: ::DWORD, -}} -pub type PUSER_INFO_11 = *mut USER_INFO_11; -pub type LPUSER_INFO_11 = *mut USER_INFO_11; -STRUCT!{struct USER_INFO_20 { - usri20_name: ::LPWSTR, - usri20_full_name: ::LPWSTR, - usri20_comment: ::LPWSTR, - usri20_flags: ::DWORD, - usri20_user_id: ::DWORD, -}} -pub type PUSER_INFO_20 = *mut USER_INFO_20; -pub type LPUSER_INFO_20 = *mut USER_INFO_20; -STRUCT!{struct USER_INFO_21 { - usri21_password: [::BYTE; ::ENCRYPTED_PWLEN], -}} -pub type PUSER_INFO_21 = *mut USER_INFO_21; -pub type LPUSER_INFO_21 = *mut USER_INFO_21; -STRUCT!{struct USER_INFO_22 { - usri22_name: ::LPWSTR, - usri22_password: [::BYTE; ::ENCRYPTED_PWLEN], - usri22_password_age: ::DWORD, - usri22_priv: ::DWORD, - usri22_home_dir: ::LPWSTR, - usri22_comment: ::LPWSTR, - usri22_flags: ::DWORD, - usri22_script_path: ::LPWSTR, - usri22_auth_flags: ::DWORD, - usri22_full_name: ::LPWSTR, - usri22_usr_comment: ::LPWSTR, - usri22_parms: ::LPWSTR, - usri22_workstations: ::LPWSTR, - usri22_last_logon: ::DWORD, - usri22_last_logoff: ::DWORD, - usri22_acct_expires: ::DWORD, - usri22_max_storage: ::DWORD, - usri22_units_per_week: ::DWORD, - usri22_logon_hours: ::PBYTE, - usri22_bad_pw_count: ::DWORD, - usri22_num_logons: ::DWORD, - usri22_logon_server: ::LPWSTR, - usri22_country_code: ::DWORD, - usri22_code_page: ::DWORD, -}} -pub type PUSER_INFO_22 = *mut USER_INFO_22; -pub type LPUSER_INFO_22 = *mut USER_INFO_22; -STRUCT!{struct USER_INFO_23 { - usri23_name: ::LPWSTR, - usri23_full_name: ::LPWSTR, - usri23_comment: ::LPWSTR, - usri23_flags: ::DWORD, - usri23_user_sid: ::PSID, -}} -pub type PUSER_INFO_23 = *mut USER_INFO_23; -pub type LPUSER_INFO_23 = *mut USER_INFO_23; -STRUCT!{struct USER_INFO_24 { - usri24_internet_identity: ::BOOL, - usri24_flags: ::DWORD, - usri24_internet_provider_name: ::LPWSTR, - usri24_internet_principal_name: ::LPWSTR, - usri24_user_sid: ::PSID, -}} -pub type PUSER_INFO_24 = *mut USER_INFO_24; -pub type LPUSER_INFO_24 = *mut USER_INFO_24; -STRUCT!{struct USER_INFO_1003 { - usri1003_password: ::LPWSTR, -}} -pub type PUSER_INFO_1003 = *mut USER_INFO_1003; -pub type LPUSER_INFO_1003 = *mut USER_INFO_1003; -STRUCT!{struct USER_INFO_1005 { - usri1005_priv: ::DWORD, -}} -pub type PUSER_INFO_1005 = *mut USER_INFO_1005; -pub type LPUSER_INFO_1005 = *mut USER_INFO_1005; -STRUCT!{struct USER_INFO_1006 { - usri1006_home_dir: ::LPWSTR, -}} -pub type PUSER_INFO_1006 = *mut USER_INFO_1006; -pub type LPUSER_INFO_1006 = *mut USER_INFO_1006; -STRUCT!{struct USER_INFO_1007 { - usri1007_comment: ::LPWSTR, -}} -pub type PUSER_INFO_1007 = *mut USER_INFO_1007; -pub type LPUSER_INFO_1007 = *mut USER_INFO_1007; -STRUCT!{struct USER_INFO_1008 { - usri1008_flags: ::DWORD, -}} -pub type PUSER_INFO_1008 = *mut USER_INFO_1008; -pub type LPUSER_INFO_1008 = *mut USER_INFO_1008; -STRUCT!{struct USER_INFO_1009 { - usri1009_script_path: ::LPWSTR, -}} -pub type PUSER_INFO_1009 = *mut USER_INFO_1009; -pub type LPUSER_INFO_1009 = *mut USER_INFO_1009; -STRUCT!{struct USER_INFO_1010 { - usri1010_auth_flags: ::DWORD, -}} -pub type PUSER_INFO_1010 = *mut USER_INFO_1010; -pub type LPUSER_INFO_1010 = *mut USER_INFO_1010; -STRUCT!{struct USER_INFO_1011 { - usri1011_full_name: ::LPWSTR, -}} -pub type PUSER_INFO_1011 = *mut USER_INFO_1011; -pub type LPUSER_INFO_1011 = *mut USER_INFO_1011; -STRUCT!{struct USER_INFO_1012 { - usri1012_usr_comment: ::LPWSTR, -}} -pub type PUSER_INFO_1012 = *mut USER_INFO_1012; -pub type LPUSER_INFO_1012 = *mut USER_INFO_1012; -STRUCT!{struct USER_INFO_1013 { - usri1013_parms: ::LPWSTR, -}} -pub type PUSER_INFO_1013 = *mut USER_INFO_1013; -pub type LPUSER_INFO_1013 = *mut USER_INFO_1013; -STRUCT!{struct USER_INFO_1014 { - usri1014_workstations: ::LPWSTR, -}} -pub type PUSER_INFO_1014 = *mut USER_INFO_1014; -pub type LPUSER_INFO_1014 = *mut USER_INFO_1014; -STRUCT!{struct USER_INFO_1017 { - usri1017_acct_expires: ::DWORD, -}} -pub type PUSER_INFO_1017 = *mut USER_INFO_1017; -pub type LPUSER_INFO_1017 = *mut USER_INFO_1017; -STRUCT!{struct USER_INFO_1018 { - usri1018_max_storage: ::DWORD, -}} -pub type PUSER_INFO_1018 = *mut USER_INFO_1018; -pub type LPUSER_INFO_1018 = *mut USER_INFO_1018; -STRUCT!{struct USER_INFO_1020 { - usri1020_units_per_week: ::DWORD, - usri1020_logon_hours: ::LPBYTE, -}} -pub type PUSER_INFO_1020 = *mut USER_INFO_1020; -pub type LPUSER_INFO_1020 = *mut USER_INFO_1020; -STRUCT!{struct USER_INFO_1023 { - usri1023_logon_server: ::LPWSTR, -}} -pub type PUSER_INFO_1023 = *mut USER_INFO_1023; -pub type LPUSER_INFO_1023 = *mut USER_INFO_1023; -STRUCT!{struct USER_INFO_1024 { - usri1024_country_code: ::DWORD, -}} -pub type PUSER_INFO_1024 = *mut USER_INFO_1024; -pub type LPUSER_INFO_1024 = *mut USER_INFO_1024; -STRUCT!{struct USER_INFO_1025 { - usri1025_code_page: ::DWORD, -}} -pub type PUSER_INFO_1025 = *mut USER_INFO_1025; -pub type LPUSER_INFO_1025 = *mut USER_INFO_1025; -STRUCT!{struct USER_INFO_1051 { - usri1051_primary_group_id: ::DWORD, -}} -pub type PUSER_INFO_1051 = *mut USER_INFO_1051; -pub type LPUSER_INFO_1051 = *mut USER_INFO_1051; -STRUCT!{struct USER_INFO_1052 { - usri1052_profile: ::LPWSTR, -}} -pub type PUSER_INFO_1052 = *mut USER_INFO_1052; -pub type LPUSER_INFO_1052 = *mut USER_INFO_1052; -STRUCT!{struct USER_INFO_1053 { - usri1053_home_dir_drive: ::LPWSTR, -}} -pub type PUSER_INFO_1053 = *mut USER_INFO_1053; -pub type LPUSER_INFO_1053 = *mut USER_INFO_1053; -STRUCT!{struct USER_MODALS_INFO_0 { - usrmod0_min_passwd_len: ::DWORD, - usrmod0_max_passwd_age: ::DWORD, - usrmod0_min_passwd_age: ::DWORD, - usrmod0_force_logoff: ::DWORD, - usrmod0_password_hist_len: ::DWORD, -}} -pub type PUSER_MODALS_INFO_0 = *mut USER_MODALS_INFO_0; -pub type LPUSER_MODALS_INFO_0 = *mut USER_MODALS_INFO_0; -STRUCT!{struct USER_MODALS_INFO_1 { - usrmod1_role: ::DWORD, - usrmod1_primary: ::LPWSTR, -}} -pub type PUSER_MODALS_INFO_1 = *mut USER_MODALS_INFO_1; -pub type LPUSER_MODALS_INFO_1 = *mut USER_MODALS_INFO_1; -STRUCT!{struct USER_MODALS_INFO_2 { - usrmod2_domain_name: ::LPWSTR, - usrmod2_domain_id: ::PSID, -}} -pub type PUSER_MODALS_INFO_2 = *mut USER_MODALS_INFO_2; -pub type LPUSER_MODALS_INFO_2 = *mut USER_MODALS_INFO_2; -STRUCT!{struct USER_MODALS_INFO_3 { - usrmod3_lockout_duration: ::DWORD, - usrmod3_lockout_observation_window: ::DWORD, - usrmod3_lockout_threshold: ::DWORD, -}} -pub type PUSER_MODALS_INFO_3 = *mut USER_MODALS_INFO_3; -pub type LPUSER_MODALS_INFO_3 = *mut USER_MODALS_INFO_3; -STRUCT!{struct USER_MODALS_INFO_1001 { - usrmod1001_min_passwd_len: ::DWORD, -}} -pub type PUSER_MODALS_INFO_1001 = *mut USER_MODALS_INFO_1001; -pub type LPUSER_MODALS_INFO_1001 = *mut USER_MODALS_INFO_1001; -STRUCT!{struct USER_MODALS_INFO_1002 { - usrmod1002_max_passwd_age: ::DWORD, -}} -pub type PUSER_MODALS_INFO_1002 = *mut USER_MODALS_INFO_1002; -pub type LPUSER_MODALS_INFO_1002 = *mut USER_MODALS_INFO_1002; -STRUCT!{struct USER_MODALS_INFO_1003 { - usrmod1003_min_passwd_age: ::DWORD, -}} -pub type PUSER_MODALS_INFO_1003 = *mut USER_MODALS_INFO_1003; -pub type LPUSER_MODALS_INFO_1003 = *mut USER_MODALS_INFO_1003; -STRUCT!{struct USER_MODALS_INFO_1004 { - usrmod1004_force_logoff: ::DWORD, -}} -pub type PUSER_MODALS_INFO_1004 = *mut USER_MODALS_INFO_1004; -pub type LPUSER_MODALS_INFO_1004 = *mut USER_MODALS_INFO_1004; -STRUCT!{struct USER_MODALS_INFO_1005 { - usrmod1005_password_hist_len: ::DWORD, -}} -pub type PUSER_MODALS_INFO_1005 = *mut USER_MODALS_INFO_1005; -pub type LPUSER_MODALS_INFO_1005 = *mut USER_MODALS_INFO_1005; -STRUCT!{struct USER_MODALS_INFO_1006 { - usrmod1006_role: ::DWORD, -}} -pub type PUSER_MODALS_INFO_1006 = *mut USER_MODALS_INFO_1006; -pub type LPUSER_MODALS_INFO_1006 = *mut USER_MODALS_INFO_1006; -STRUCT!{struct USER_MODALS_INFO_1007 { - usrmod1007_primary: ::LPWSTR, -}} -pub type PUSER_MODALS_INFO_1007 = *mut USER_MODALS_INFO_1007; -pub type LPUSER_MODALS_INFO_1007 = *mut USER_MODALS_INFO_1007; -pub const UF_SCRIPT: ::DWORD = 0x0001; -pub const UF_ACCOUNTDISABLE: ::DWORD = 0x0002; -pub const UF_HOMEDIR_REQUIRED: ::DWORD = 0x0008; -pub const UF_LOCKOUT: ::DWORD = 0x0010; -pub const UF_PASSWD_NOTREQD: ::DWORD = 0x0020; -pub const UF_PASSWD_CANT_CHANGE: ::DWORD = 0x0040; -pub const UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED: ::DWORD = 0x0080; -pub const UF_TEMP_DUPLICATE_ACCOUNT: ::DWORD = 0x0100; -pub const UF_NORMAL_ACCOUNT: ::DWORD = 0x0200; -pub const UF_INTERDOMAIN_TRUST_ACCOUNT: ::DWORD = 0x0800; -pub const UF_WORKSTATION_TRUST_ACCOUNT: ::DWORD = 0x1000; -pub const UF_SERVER_TRUST_ACCOUNT: ::DWORD = 0x2000; -pub const UF_MACHINE_ACCOUNT_MASK: ::DWORD = UF_INTERDOMAIN_TRUST_ACCOUNT - | UF_WORKSTATION_TRUST_ACCOUNT | UF_SERVER_TRUST_ACCOUNT; -pub const UF_ACCOUNT_TYPE_MASK: ::DWORD = UF_TEMP_DUPLICATE_ACCOUNT | UF_NORMAL_ACCOUNT - | UF_INTERDOMAIN_TRUST_ACCOUNT | UF_WORKSTATION_TRUST_ACCOUNT | UF_SERVER_TRUST_ACCOUNT; -pub const UF_DONT_EXPIRE_PASSWD: ::DWORD = 0x10000; -pub const UF_MNS_LOGON_ACCOUNT: ::DWORD = 0x20000; -pub const UF_SMARTCARD_REQUIRED: ::DWORD = 0x40000; -pub const UF_TRUSTED_FOR_DELEGATION: ::DWORD = 0x80000; -pub const UF_NOT_DELEGATED: ::DWORD = 0x100000; -pub const UF_USE_DES_KEY_ONLY: ::DWORD = 0x200000; -pub const UF_DONT_REQUIRE_PREAUTH: ::DWORD = 0x400000; -pub const UF_PASSWORD_EXPIRED: ::DWORD = 0x800000; -pub const UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION: ::DWORD = 0x1000000; -pub const UF_NO_AUTH_DATA_REQUIRED: ::DWORD = 0x2000000; -pub const UF_PARTIAL_SECRETS_ACCOUNT: ::DWORD = 0x4000000; -pub const UF_USE_AES_KEYS: ::DWORD = 0x8000000; -pub const UF_SETTABLE_BITS: ::DWORD = UF_SCRIPT | UF_ACCOUNTDISABLE | UF_LOCKOUT - | UF_HOMEDIR_REQUIRED | UF_PASSWD_NOTREQD | UF_PASSWD_CANT_CHANGE | UF_ACCOUNT_TYPE_MASK - | UF_DONT_EXPIRE_PASSWD | UF_MNS_LOGON_ACCOUNT | UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED - | UF_SMARTCARD_REQUIRED | UF_TRUSTED_FOR_DELEGATION | UF_NOT_DELEGATED | UF_USE_DES_KEY_ONLY - | UF_DONT_REQUIRE_PREAUTH | UF_PASSWORD_EXPIRED | UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION - | UF_NO_AUTH_DATA_REQUIRED | UF_USE_AES_KEYS | UF_PARTIAL_SECRETS_ACCOUNT; -pub const FILTER_TEMP_DUPLICATE_ACCOUNT: ::DWORD = 0x0001; -pub const FILTER_NORMAL_ACCOUNT: ::DWORD = 0x0002; -pub const FILTER_INTERDOMAIN_TRUST_ACCOUNT: ::DWORD = 0x0008; -pub const FILTER_WORKSTATION_TRUST_ACCOUNT: ::DWORD = 0x0010; -pub const FILTER_SERVER_TRUST_ACCOUNT: ::DWORD = 0x0020; -pub const LG_INCLUDE_INDIRECT: ::DWORD = 0x0001; -pub const AF_OP_PRINT: ::DWORD = 0x1; -pub const AF_OP_COMM: ::DWORD = 0x2; -pub const AF_OP_SERVER: ::DWORD = 0x4; -pub const AF_OP_ACCOUNTS: ::DWORD = 0x8; -pub const AF_SETTABLE_BITS: ::DWORD = AF_OP_PRINT | AF_OP_COMM | AF_OP_SERVER | AF_OP_ACCOUNTS; -pub const UAS_ROLE_STANDALONE: ::DWORD = 0; -pub const UAS_ROLE_MEMBER: ::DWORD = 1; -pub const UAS_ROLE_BACKUP: ::DWORD = 2; -pub const UAS_ROLE_PRIMARY: ::DWORD = 3; -pub const USER_NAME_PARMNUM: ::DWORD = 1; -pub const USER_PASSWORD_PARMNUM: ::DWORD = 3; -pub const USER_PASSWORD_AGE_PARMNUM: ::DWORD = 4; -pub const USER_PRIV_PARMNUM: ::DWORD = 5; -pub const USER_HOME_DIR_PARMNUM: ::DWORD = 6; -pub const USER_COMMENT_PARMNUM: ::DWORD = 7; -pub const USER_FLAGS_PARMNUM: ::DWORD = 8; -pub const USER_SCRIPT_PATH_PARMNUM: ::DWORD = 9; -pub const USER_AUTH_FLAGS_PARMNUM: ::DWORD = 10; -pub const USER_FULL_NAME_PARMNUM: ::DWORD = 11; -pub const USER_USR_COMMENT_PARMNUM: ::DWORD = 12; -pub const USER_PARMS_PARMNUM: ::DWORD = 13; -pub const USER_WORKSTATIONS_PARMNUM: ::DWORD = 14; -pub const USER_LAST_LOGON_PARMNUM: ::DWORD = 15; -pub const USER_LAST_LOGOFF_PARMNUM: ::DWORD = 16; -pub const USER_ACCT_EXPIRES_PARMNUM: ::DWORD = 17; -pub const USER_MAX_STORAGE_PARMNUM: ::DWORD = 18; -pub const USER_UNITS_PER_WEEK_PARMNUM: ::DWORD = 19; -pub const USER_LOGON_HOURS_PARMNUM: ::DWORD = 20; -pub const USER_PAD_PW_COUNT_PARMNUM: ::DWORD = 21; -pub const USER_NUM_LOGONS_PARMNUM: ::DWORD = 22; -pub const USER_LOGON_SERVER_PARMNUM: ::DWORD = 23; -pub const USER_COUNTRY_CODE_PARMNUM: ::DWORD = 24; -pub const USER_CODE_PAGE_PARMNUM: ::DWORD = 25; -pub const USER_PRIMARY_GROUP_PARMNUM: ::DWORD = 51; -pub const USER_PROFILE: ::DWORD = 52; -pub const USER_PROFILE_PARMNUM: ::DWORD = 52; -pub const USER_HOME_DIR_DRIVE_PARMNUM: ::DWORD = 53; -pub const USER_NAME_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_NAME_PARMNUM; -pub const USER_PASSWORD_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_PASSWORD_PARMNUM; -pub const USER_PASSWORD_AGE_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + USER_PASSWORD_AGE_PARMNUM; -pub const USER_PRIV_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_PRIV_PARMNUM; -pub const USER_HOME_DIR_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_HOME_DIR_PARMNUM; -pub const USER_COMMENT_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_COMMENT_PARMNUM; -pub const USER_FLAGS_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_FLAGS_PARMNUM; -pub const USER_SCRIPT_PATH_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + USER_SCRIPT_PATH_PARMNUM; -pub const USER_AUTH_FLAGS_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_AUTH_FLAGS_PARMNUM; -pub const USER_FULL_NAME_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_FULL_NAME_PARMNUM; -pub const USER_USR_COMMENT_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + USER_USR_COMMENT_PARMNUM; -pub const USER_PARMS_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_PARMS_PARMNUM; -pub const USER_WORKSTATIONS_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + USER_WORKSTATIONS_PARMNUM; -pub const USER_LAST_LOGON_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_LAST_LOGON_PARMNUM; -pub const USER_LAST_LOGOFF_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + USER_LAST_LOGOFF_PARMNUM; -pub const USER_ACCT_EXPIRES_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + USER_ACCT_EXPIRES_PARMNUM; -pub const USER_MAX_STORAGE_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_MAX_STORAGE_PARMNUM; -pub const USER_UNITS_PER_WEEK_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + USER_UNITS_PER_WEEK_PARMNUM; -pub const USER_LOGON_HOURS_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + USER_LOGON_HOURS_PARMNUM; -pub const USER_PAD_PW_COUNT_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + USER_PAD_PW_COUNT_PARMNUM; -pub const USER_NUM_LOGONS_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_NUM_LOGONS_PARMNUM; -pub const USER_LOGON_SERVER_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + USER_LOGON_SERVER_PARMNUM; -pub const USER_COUNTRY_CODE_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + USER_COUNTRY_CODE_PARMNUM; -pub const USER_CODE_PAGE_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + USER_CODE_PAGE_PARMNUM; -pub const USER_PRIMARY_GROUP_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + USER_PRIMARY_GROUP_PARMNUM; -pub const USER_HOME_DIR_DRIVE_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + USER_HOME_DIR_DRIVE_PARMNUM; -pub const TIMEQ_FOREVER: ::DWORD = -1i32 as ::DWORD; -pub const USER_MAXSTORAGE_UNLIMITED: ::DWORD = -1i32 as ::DWORD; -pub const USER_NO_LOGOFF: ::DWORD = -1i32 as ::DWORD; -pub const UNITS_PER_DAY: ::DWORD = 24; -pub const UNITS_PER_WEEK: ::DWORD = UNITS_PER_DAY * 7; -pub const USER_PRIV_MASK: ::DWORD = 0x3; -pub const USER_PRIV_GUEST: ::DWORD = 0; -pub const USER_PRIV_USER: ::DWORD = 1; -pub const USER_PRIV_ADMIN: ::DWORD = 2; -pub const MAX_PASSWD_LEN: ::DWORD = ::PWLEN; -pub const DEF_MIN_PWLEN: ::DWORD = 6; -pub const DEF_PWUNIQUENESS: ::DWORD = 5; -pub const DEF_MAX_PWHIST: ::DWORD = 8; -pub const DEF_MAX_PWAGE: ::DWORD = TIMEQ_FOREVER; -pub const DEF_MIN_PWAGE: ::DWORD = 0; -pub const DEF_FORCE_LOGOFF: ::DWORD = 0xffffffff; -pub const DEF_MAX_BADPW: ::DWORD = 0; -pub const ONE_DAY: ::DWORD = 1 * 24 * 3600; -pub const VALIDATED_LOGON: ::DWORD = 0; -pub const PASSWORD_EXPIRED: ::DWORD = 2; -pub const NON_VALIDATED_LOGON: ::DWORD = 3; -pub const VALID_LOGOFF: ::DWORD = 1; -pub const MODALS_MIN_PASSWD_LEN_PARMNUM: ::DWORD = 1; -pub const MODALS_MAX_PASSWD_AGE_PARMNUM: ::DWORD = 2; -pub const MODALS_MIN_PASSWD_AGE_PARMNUM: ::DWORD = 3; -pub const MODALS_FORCE_LOGOFF_PARMNUM: ::DWORD = 4; -pub const MODALS_PASSWD_HIST_LEN_PARMNUM: ::DWORD = 5; -pub const MODALS_ROLE_PARMNUM: ::DWORD = 6; -pub const MODALS_PRIMARY_PARMNUM: ::DWORD = 7; -pub const MODALS_DOMAIN_NAME_PARMNUM: ::DWORD = 8; -pub const MODALS_DOMAIN_ID_PARMNUM: ::DWORD = 9; -pub const MODALS_LOCKOUT_DURATION_PARMNUM: ::DWORD = 10; -pub const MODALS_LOCKOUT_OBSERVATION_WINDOW_PARMNUM: ::DWORD = 11; -pub const MODALS_LOCKOUT_THRESHOLD_PARMNUM: ::DWORD = 12; -pub const MODALS_MIN_PASSWD_LEN_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + MODALS_MIN_PASSWD_LEN_PARMNUM; -pub const MODALS_MAX_PASSWD_AGE_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + MODALS_MAX_PASSWD_AGE_PARMNUM; -pub const MODALS_MIN_PASSWD_AGE_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + MODALS_MIN_PASSWD_AGE_PARMNUM; -pub const MODALS_FORCE_LOGOFF_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + MODALS_FORCE_LOGOFF_PARMNUM; -pub const MODALS_PASSWD_HIST_LEN_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + MODALS_PASSWD_HIST_LEN_PARMNUM; -pub const MODALS_ROLE_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + MODALS_ROLE_PARMNUM; -pub const MODALS_PRIMARY_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + MODALS_PRIMARY_PARMNUM; -pub const MODALS_DOMAIN_NAME_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + MODALS_DOMAIN_NAME_PARMNUM; -pub const MODALS_DOMAIN_ID_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + MODALS_DOMAIN_ID_PARMNUM; -STRUCT!{struct GROUP_INFO_0 { - grpi0_name: ::LPWSTR, -}} -pub type PGROUP_INFO_0 = *mut GROUP_INFO_0; -pub type LPGROUP_INFO_0 = *mut GROUP_INFO_0; -STRUCT!{struct GROUP_INFO_1 { - grpi1_name: ::LPWSTR, - grpi1_comment: ::LPWSTR, -}} -pub type PGROUP_INFO_1 = *mut GROUP_INFO_1; -pub type LPGROUP_INFO_1 = *mut GROUP_INFO_1; -STRUCT!{struct GROUP_INFO_2 { - grpi2_name: ::LPWSTR, - grpi2_comment: ::LPWSTR, - grpi2_group_id: ::DWORD, - grpi2_attributes: ::DWORD, -}} -pub type PGROUP_INFO_2 = *mut GROUP_INFO_2; -STRUCT!{struct GROUP_INFO_3 { - grpi3_name: ::LPWSTR, - grpi3_comment: ::LPWSTR, - grpi3_group_sid: ::PSID, - grpi3_attributes: ::DWORD, -}} -pub type PGROUP_INFO_3 = *mut GROUP_INFO_3; -STRUCT!{struct GROUP_INFO_1002 { - grpi1002_comment: ::LPWSTR, -}} -pub type PGROUP_INFO_1002 = *mut GROUP_INFO_1002; -pub type LPGROUP_INFO_1002 = *mut GROUP_INFO_1002; -STRUCT!{struct GROUP_INFO_1005 { - grpi1005_attributes: ::DWORD, -}} -pub type PGROUP_INFO_1005 = *mut GROUP_INFO_1005; -pub type LPGROUP_INFO_1005 = *mut GROUP_INFO_1005; -STRUCT!{struct GROUP_USERS_INFO_0 { - grui0_name: ::LPWSTR, -}} -pub type PGROUP_USERS_INFO_0 = *mut GROUP_USERS_INFO_0; -pub type LPGROUP_USERS_INFO_0 = *mut GROUP_USERS_INFO_0; -STRUCT!{struct GROUP_USERS_INFO_1 { - grui1_name: ::LPWSTR, - grui1_attributes: ::DWORD, -}} -pub type PGROUP_USERS_INFO_1 = *mut GROUP_USERS_INFO_1; -pub type LPGROUP_USERS_INFO_1 = *mut GROUP_USERS_INFO_1; -pub const GROUPIDMASK: ::DWORD = 0x8000; -pub const GROUP_SPECIALGRP_USERS: &'static str = "USERS"; -pub const GROUP_SPECIALGRP_ADMINS: &'static str = "ADMINS"; -pub const GROUP_SPECIALGRP_GUESTS: &'static str = "GUESTS"; -pub const GROUP_SPECIALGRP_LOCAL: &'static str = "LOCAL"; -pub const GROUP_ALL_PARMNUM: ::DWORD = 0; -pub const GROUP_NAME_PARMNUM: ::DWORD = 1; -pub const GROUP_COMMENT_PARMNUM: ::DWORD = 2; -pub const GROUP_ATTRIBUTES_PARMNUM: ::DWORD = 3; -pub const GROUP_ALL_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + GROUP_ALL_PARMNUM; -pub const GROUP_NAME_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + GROUP_NAME_PARMNUM; -pub const GROUP_COMMENT_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + GROUP_COMMENT_PARMNUM; -pub const GROUP_ATTRIBUTES_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + GROUP_ATTRIBUTES_PARMNUM; -STRUCT!{struct LOCALGROUP_INFO_0 { - lgrpi0_name: ::LPWSTR, -}} -pub type PLOCALGROUP_INFO_0 = *mut LOCALGROUP_INFO_0; -pub type LPLOCALGROUP_INFO_0 = *mut LOCALGROUP_INFO_0; -STRUCT!{struct LOCALGROUP_INFO_1 { - lgrpi1_name: ::LPWSTR, - lgrpi1_comment: ::LPWSTR, -}} -pub type PLOCALGROUP_INFO_1 = *mut LOCALGROUP_INFO_1; -pub type LPLOCALGROUP_INFO_1 = *mut LOCALGROUP_INFO_1; -STRUCT!{struct LOCALGROUP_INFO_1002 { - lgrpi1002_comment: ::LPWSTR, -}} -pub type PLOCALGROUP_INFO_1002 = *mut LOCALGROUP_INFO_1002; -pub type LPLOCALGROUP_INFO_1002 = *mut LOCALGROUP_INFO_1002; -STRUCT!{struct LOCALGROUP_MEMBERS_INFO_0 { - lgrmi0_sid: ::PSID, -}} -pub type PLOCALGROUP_MEMBERS_INFO_0 = *mut LOCALGROUP_MEMBERS_INFO_0; -pub type LPLOCALGROUP_MEMBERS_INFO_0 = *mut LOCALGROUP_MEMBERS_INFO_0; -STRUCT!{struct LOCALGROUP_MEMBERS_INFO_1 { - lgrmi1_sid: ::PSID, - lgrmi1_sidusage: ::SID_NAME_USE, - lgrmi1_name: ::LPWSTR, -}} -pub type PLOCALGROUP_MEMBERS_INFO_1 = *mut LOCALGROUP_MEMBERS_INFO_1; -pub type LPLOCALGROUP_MEMBERS_INFO_1 = *mut LOCALGROUP_MEMBERS_INFO_1; -STRUCT!{struct LOCALGROUP_MEMBERS_INFO_2 { - lgrmi2_sid: ::PSID, - lgrmi2_sidusage: ::SID_NAME_USE, - lgrmi2_domainandname: ::LPWSTR, -}} -pub type PLOCALGROUP_MEMBERS_INFO_2 = *mut LOCALGROUP_MEMBERS_INFO_2; -pub type LPLOCALGROUP_MEMBERS_INFO_2 = *mut LOCALGROUP_MEMBERS_INFO_2; -STRUCT!{struct LOCALGROUP_MEMBERS_INFO_3 { - lgrmi3_domainandname: ::LPWSTR, -}} -pub type PLOCALGROUP_MEMBERS_INFO_3 = *mut LOCALGROUP_MEMBERS_INFO_3; -pub type LPLOCALGROUP_MEMBERS_INFO_3 = *mut LOCALGROUP_MEMBERS_INFO_3; -STRUCT!{struct LOCALGROUP_USERS_INFO_0 { - lgrui0_name: ::LPWSTR, -}} -pub type PLOCALGROUP_USERS_INFO_0 = *mut LOCALGROUP_USERS_INFO_0; -pub type LPLOCALGROUP_USERS_INFO_0 = *mut LOCALGROUP_USERS_INFO_0; -pub const LOCALGROUP_NAME_PARMNUM: ::DWORD = 1; -pub const LOCALGROUP_COMMENT_PARMNUM: ::DWORD = 2; -STRUCT!{struct NET_DISPLAY_USER { - usri1_name: ::LPWSTR, - usri1_comment: ::LPWSTR, - usri1_flags: ::DWORD, - usri1_full_name: ::LPWSTR, - usri1_user_id: ::DWORD, - usri1_next_index: ::DWORD, -}} -pub type PNET_DISPLAY_USER = *mut NET_DISPLAY_USER; -STRUCT!{struct NET_DISPLAY_MACHINE { - usri2_name: ::LPWSTR, - usri2_comment: ::LPWSTR, - usri2_flags: ::DWORD, - usri2_user_id: ::DWORD, - usri2_next_index: ::DWORD, -}} -pub type PNET_DISPLAY_MACHINE = *mut NET_DISPLAY_MACHINE; -STRUCT!{struct NET_DISPLAY_GROUP { - usri3_name: ::LPWSTR, - usri3_comment: ::LPWSTR, - grpi3_group_id: ::DWORD, - grpi3_attributes: ::DWORD, - grpi3_next_index: ::DWORD, -}} -pub type PNET_DISPLAY_GROUP = *mut NET_DISPLAY_GROUP; -STRUCT!{struct ACCESS_INFO_0 { - acc0_resource_name: ::LPWSTR, -}} -pub type PACCESS_INFO_0 = *mut ACCESS_INFO_0; -pub type LPACCESS_INFO_0 = *mut ACCESS_INFO_0; -STRUCT!{struct ACCESS_INFO_1 { - acc1_resource_name: ::LPWSTR, - acc1_attr: ::DWORD, - acc1_count: ::DWORD, -}} -pub type PACCESS_INFO_1 = *mut ACCESS_INFO_1; -pub type LPACCESS_INFO_1 = *mut ACCESS_INFO_1; -STRUCT!{struct ACCESS_INFO_1002 { - acc1002_attr: ::DWORD, -}} -pub type PACCESS_INFO_1002 = *mut ACCESS_INFO_1002; -pub type LPACCESS_INFO_1002 = *mut ACCESS_INFO_1002; -STRUCT!{struct ACCESS_LIST { - acl_ugname: ::LPWSTR, - acl_access: ::DWORD, -}} -pub type PACCESS_LIST = *mut ACCESS_LIST; -pub type LPACCESS_LIST = *mut ACCESS_LIST; -pub const ACCESS_NONE: ::DWORD = 0; -pub const ACCESS_ALL: ::DWORD = ACCESS_READ | ACCESS_WRITE | ACCESS_CREATE | ACCESS_EXEC - | ACCESS_DELETE | ACCESS_ATRIB | ACCESS_PERM; -pub const ACCESS_READ: ::DWORD = 0x01; -pub const ACCESS_WRITE: ::DWORD = 0x02; -pub const ACCESS_CREATE: ::DWORD = 0x04; -pub const ACCESS_EXEC: ::DWORD = 0x08; -pub const ACCESS_DELETE: ::DWORD = 0x10; -pub const ACCESS_ATRIB: ::DWORD = 0x20; -pub const ACCESS_PERM: ::DWORD = 0x40; -pub const ACCESS_GROUP: ::DWORD = 0x8000; -pub const ACCESS_AUDIT: ::DWORD = 0x1; -pub const ACCESS_SUCCESS_OPEN: ::DWORD = 0x10; -pub const ACCESS_SUCCESS_WRITE: ::DWORD = 0x20; -pub const ACCESS_SUCCESS_DELETE: ::DWORD = 0x40; -pub const ACCESS_SUCCESS_ACL: ::DWORD = 0x80; -pub const ACCESS_SUCCESS_MASK: ::DWORD = 0xF0; -pub const ACCESS_FAIL_OPEN: ::DWORD = 0x100; -pub const ACCESS_FAIL_WRITE: ::DWORD = 0x200; -pub const ACCESS_FAIL_DELETE: ::DWORD = 0x400; -pub const ACCESS_FAIL_ACL: ::DWORD = 0x800; -pub const ACCESS_FAIL_MASK: ::DWORD = 0xF00; -pub const ACCESS_FAIL_SHIFT: ::DWORD = 4; -pub const ACCESS_RESOURCE_NAME_PARMNUM: ::DWORD = 1; -pub const ACCESS_ATTR_PARMNUM: ::DWORD = 2; -pub const ACCESS_COUNT_PARMNUM: ::DWORD = 3; -pub const ACCESS_ACCESS_LIST_PARMNUM: ::DWORD = 4; -pub const ACCESS_RESOURCE_NAME_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + ACCESS_RESOURCE_NAME_PARMNUM; -pub const ACCESS_ATTR_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + ACCESS_ATTR_PARMNUM; -pub const ACCESS_COUNT_INFOLEVEL: ::DWORD = ::PARMNUM_BASE_INFOLEVEL + ACCESS_COUNT_PARMNUM; -pub const ACCESS_ACCESS_LIST_INFOLEVEL: ::DWORD = - ::PARMNUM_BASE_INFOLEVEL + ACCESS_ACCESS_LIST_PARMNUM; -ENUM!{enum NET_VALIDATE_PASSWORD_TYPE { - NetValidateAuthentication = 1, - NetValidatePasswordChange, - NetValidatePasswordReset, -}} -pub type PNET_VALIDATE_PASSWORD_TYPE = *mut NET_VALIDATE_PASSWORD_TYPE; -STRUCT!{struct NET_VALIDATE_PASSWORD_HASH { - Length: ::ULONG, - Hash: ::LPBYTE, -}} -pub type PNET_VALIDATE_PASSWORD_HASH = *mut NET_VALIDATE_PASSWORD_HASH; -pub const NET_VALIDATE_PASSWORD_LAST_SET: ::ULONG = 0x00000001; -pub const NET_VALIDATE_BAD_PASSWORD_TIME: ::ULONG = 0x00000002; -pub const NET_VALIDATE_LOCKOUT_TIME: ::ULONG = 0x00000004; -pub const NET_VALIDATE_BAD_PASSWORD_COUNT: ::ULONG = 0x00000008; -pub const NET_VALIDATE_PASSWORD_HISTORY_LENGTH: ::ULONG = 0x00000010; -pub const NET_VALIDATE_PASSWORD_HISTORY: ::ULONG = 0x00000020; -STRUCT!{struct NET_VALIDATE_PERSISTED_FIELDS { - PresentFields: ::ULONG, - PasswordLastSet: ::FILETIME, - BadPasswordTime: ::FILETIME, - LockoutTime: ::FILETIME, - BadPasswordCount: ::ULONG, - PasswordHistoryLength: ::ULONG, - PasswordHistory: PNET_VALIDATE_PASSWORD_HASH, -}} -pub type PNET_VALIDATE_PERSISTED_FIELDS = *mut NET_VALIDATE_PERSISTED_FIELDS; -STRUCT!{struct NET_VALIDATE_OUTPUT_ARG { - ChangedPersistedFields: NET_VALIDATE_PERSISTED_FIELDS, - ValidationStatus: ::NET_API_STATUS, -}} -pub type PNET_VALIDATE_OUTPUT_ARG = *mut NET_VALIDATE_OUTPUT_ARG; -STRUCT!{struct NET_VALIDATE_AUTHENTICATION_INPUT_ARG { - InputPersistedFields: NET_VALIDATE_PERSISTED_FIELDS, - PasswordMatched: ::BOOLEAN, -}} -pub type PNET_VALIDATE_AUTHENTICATION_INPUT_ARG = *mut NET_VALIDATE_AUTHENTICATION_INPUT_ARG; -STRUCT!{struct NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG { - InputPersistedFields: NET_VALIDATE_PERSISTED_FIELDS, - ClearPassword: ::LPWSTR, - UserAccountName: ::LPWSTR, - HashedPassword: NET_VALIDATE_PASSWORD_HASH, - PasswordMatch: ::BOOLEAN, -}} -pub type PNET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG = *mut NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG; -STRUCT!{struct NET_VALIDATE_PASSWORD_RESET_INPUT_ARG { - InputPersistedFields: NET_VALIDATE_PERSISTED_FIELDS, - ClearPassword: ::LPWSTR, - UserAccountName: ::LPWSTR, - HashedPassword: NET_VALIDATE_PASSWORD_HASH, - PasswordMustChangeAtNextLogon: ::BOOLEAN, - ClearLockout: ::BOOLEAN, -}} -pub type PNET_VALIDATE_PASSWORD_RESET_INPUT_ARG = *mut NET_VALIDATE_PASSWORD_RESET_INPUT_ARG; -pub const NETLOGON_CONTROL_QUERY: ::DWORD = 1; -pub const NETLOGON_CONTROL_REPLICATE: ::DWORD = 2; -pub const NETLOGON_CONTROL_SYNCHRONIZE: ::DWORD = 3; -pub const NETLOGON_CONTROL_PDC_REPLICATE: ::DWORD = 4; -pub const NETLOGON_CONTROL_REDISCOVER: ::DWORD = 5; -pub const NETLOGON_CONTROL_TC_QUERY: ::DWORD = 6; -pub const NETLOGON_CONTROL_TRANSPORT_NOTIFY: ::DWORD = 7; -pub const NETLOGON_CONTROL_FIND_USER: ::DWORD = 8; -pub const NETLOGON_CONTROL_CHANGE_PASSWORD: ::DWORD = 9; -pub const NETLOGON_CONTROL_TC_VERIFY: ::DWORD = 10; -pub const NETLOGON_CONTROL_FORCE_DNS_REG: ::DWORD = 11; -pub const NETLOGON_CONTROL_QUERY_DNS_REG: ::DWORD = 12; -pub const NETLOGON_CONTROL_UNLOAD_NETLOGON_DLL: ::DWORD = 0xFFFB; -pub const NETLOGON_CONTROL_BACKUP_CHANGE_LOG: ::DWORD = 0xFFFC; -pub const NETLOGON_CONTROL_TRUNCATE_LOG: ::DWORD = 0xFFFD; -pub const NETLOGON_CONTROL_SET_DBFLAG: ::DWORD = 0xFFFE; -pub const NETLOGON_CONTROL_BREAKPOINT: ::DWORD = 0xFFFF; -STRUCT!{struct NETLOGON_INFO_1 { - netlog1_flags: ::DWORD, - netlog1_pdc_connection_status: ::NET_API_STATUS, -}} -pub type PNETLOGON_INFO_1 = *mut NETLOGON_INFO_1; -STRUCT!{struct NETLOGON_INFO_2 { - netlog2_flags: ::DWORD, - netlog2_pdc_connection_status: ::NET_API_STATUS, - netlog2_trusted_dc_name: ::LPWSTR, - netlog2_tc_connection_status: ::NET_API_STATUS, -}} -pub type PNETLOGON_INFO_2 = *mut NETLOGON_INFO_2; -STRUCT!{struct NETLOGON_INFO_3 { - netlog3_flags: ::DWORD, - netlog3_logon_attempts: ::DWORD, - netlog3_reserved1: ::DWORD, - netlog3_reserved2: ::DWORD, - netlog3_reserved3: ::DWORD, - netlog3_reserved4: ::DWORD, - netlog3_reserved5: ::DWORD, -}} -pub type PNETLOGON_INFO_3 = *mut NETLOGON_INFO_3; -STRUCT!{struct NETLOGON_INFO_4 { - netlog4_trusted_dc_name: ::LPWSTR, - netlog4_trusted_domain_name: ::LPWSTR, -}} -pub type PNETLOGON_INFO_4 = *mut NETLOGON_INFO_4; -pub const NETLOGON_REPLICATION_NEEDED: ::DWORD = 0x01; -pub const NETLOGON_REPLICATION_IN_PROGRESS: ::DWORD = 0x02; -pub const NETLOGON_FULL_SYNC_REPLICATION: ::DWORD = 0x04; -pub const NETLOGON_REDO_NEEDED: ::DWORD = 0x08; -pub const NETLOGON_HAS_IP: ::DWORD = 0x10; -pub const NETLOGON_HAS_TIMESERV: ::DWORD = 0x20; -pub const NETLOGON_DNS_UPDATE_FAILURE: ::DWORD = 0x40; -pub const NETLOGON_VERIFY_STATUS_RETURNED: ::DWORD = 0x80; -DEFINE_GUID!(ServiceAccountPasswordGUID, 0x262E99C9, 0x6160, 0x4871, - 0xAC, 0xEC, 0x4E, 0x61, 0x73, 0x6B, 0x6F, 0x21); -pub const SERVICE_ACCOUNT_FLAG_LINK_TO_HOST_ONLY: ::DWORD = 0x00000001; -pub const SERVICE_ACCOUNT_FLAG_ADD_AGAINST_RODC: ::DWORD = 0x00000002; -pub const SERVICE_ACCOUNT_FLAG_UNLINK_FROM_HOST_ONLY: ::DWORD = 0x00000001; -pub const SERVICE_ACCOUNT_FLAG_REMOVE_OFFLINE: ::DWORD = 0x00000002; -ENUM!{enum MSA_INFO_LEVEL { - MsaInfoLevel0 = 0, - MsaInfoLevelMax, -}} -pub type PMSA_INFO_LEVEL = *mut MSA_INFO_LEVEL; -ENUM!{enum MSA_INFO_STATE { - MsaInfoNotExist = 1, - MsaInfoNotService, - MsaInfoCannotInstall, - MsaInfoCanInstall, - MsaInfoInstalled, -}} -pub type PMSA_INFO_STATE = *mut MSA_INFO_STATE; -STRUCT!{struct MSA_INFO_0 { - State: MSA_INFO_STATE, -}} -pub type PMSA_INFO_0 = *mut MSA_INFO_0; -pub type LPMSA_INFO_0 = *mut MSA_INFO_0; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/lmcons.rs cargo-0.37.0/vendor/winapi-0.2.8/src/lmcons.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/lmcons.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/lmcons.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! This file contains constants used throughout the LAN Manager API header files. -pub const CNLEN: ::DWORD = 15; -pub const LM20_CNLEN: ::DWORD = 15; -pub const DNLEN: ::DWORD = CNLEN; -pub const LM20_DNLEN: ::DWORD = LM20_CNLEN; -pub const UNCLEN: ::DWORD = CNLEN + 2; -pub const LM20_UNCLEN: ::DWORD = LM20_CNLEN + 2; -pub const NNLEN: ::DWORD = 80; -pub const LM20_NNLEN: ::DWORD = 12; -pub const RMLEN: ::DWORD = UNCLEN + 1 + NNLEN; -pub const LM20_RMLEN: ::DWORD = LM20_UNCLEN + 1 + LM20_NNLEN; -pub const SNLEN: ::DWORD = 80; -pub const LM20_SNLEN: ::DWORD = 15; -pub const STXTLEN: ::DWORD = 256; -pub const LM20_STXTLEN: ::DWORD = 63; -pub const PATHLEN: ::DWORD = 256; -pub const LM20_PATHLEN: ::DWORD = 256; -pub const DEVLEN: ::DWORD = 80; -pub const LM20_DEVLEN: ::DWORD = 8; -pub const EVLEN: ::DWORD = 16; -pub const UNLEN: ::DWORD = 256; -pub const LM20_UNLEN: ::DWORD = 20; -pub const GNLEN: ::DWORD = UNLEN; -pub const LM20_GNLEN: ::DWORD = LM20_UNLEN; -pub const PWLEN: ::DWORD = 256; -pub const LM20_PWLEN: ::DWORD = 14; -pub const SHPWLEN: ::DWORD = 8; -pub const CLTYPE_LEN: ::DWORD = 12; -pub const MAXCOMMENTSZ: ::DWORD = 256; -pub const LM20_MAXCOMMENTSZ: ::DWORD = 48; -pub const QNLEN: ::DWORD = NNLEN; -pub const LM20_QNLEN: ::DWORD = LM20_NNLEN; -pub const ALERTSZ: ::DWORD = 128; -pub const MAXDEVENTRIES: ::DWORD = 4 * 8; // FIXME: sizeof(int) instead of 4 -pub const NETBIOS_NAME_LEN: ::DWORD = 16; -pub const MAX_PREFERRED_LENGTH: ::DWORD = -1i32 as ::DWORD; -pub const CRYPT_KEY_LEN: ::DWORD = 7; -pub const CRYPT_TXT_LEN: ::DWORD = 8; -pub const ENCRYPTED_PWLEN: usize = 16; -pub const SESSION_PWLEN: ::DWORD = 24; -pub const SESSION_CRYPT_KLEN: ::DWORD = 21; -pub const PARM_ERROR_UNKNOWN: ::DWORD = -1i32 as ::DWORD; -pub const PARM_ERROR_NONE: ::DWORD = 0; -pub const PARMNUM_BASE_INFOLEVEL: ::DWORD = 1000; -pub type LMSTR = ::LPWSTR; -pub type LMCSTR = ::LPCWSTR; -pub type NET_API_STATUS = ::DWORD; -pub type API_RET_TYPE = NET_API_STATUS; -pub const PLATFORM_ID_DOS: ::DWORD = 300; -pub const PLATFORM_ID_OS2: ::DWORD = 400; -pub const PLATFORM_ID_NT: ::DWORD = 500; -pub const PLATFORM_ID_OSF: ::DWORD = 600; -pub const PLATFORM_ID_VMS: ::DWORD = 700; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/lmdfs.rs cargo-0.37.0/vendor/winapi-0.2.8/src/lmdfs.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/lmdfs.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/lmdfs.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,311 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -// This file contains structures, function prototypes, and definitions for the NetDfs API -pub const DFS_VOLUME_STATES: ::DWORD = 0xF; -pub const DFS_VOLUME_STATE_OK: ::DWORD = 1; -pub const DFS_VOLUME_STATE_INCONSISTENT: ::DWORD = 2; -pub const DFS_VOLUME_STATE_OFFLINE: ::DWORD = 3; -pub const DFS_VOLUME_STATE_ONLINE: ::DWORD = 4; -pub const DFS_VOLUME_STATE_RESYNCHRONIZE: ::DWORD = 0x10; -pub const DFS_VOLUME_STATE_STANDBY: ::DWORD = 0x20; -pub const DFS_VOLUME_STATE_FORCE_SYNC: ::DWORD = 0x40; -pub const DFS_VOLUME_FLAVORS: ::DWORD = 0x0300; -pub const DFS_VOLUME_FLAVOR_UNUSED1: ::DWORD = 0x0000; -pub const DFS_VOLUME_FLAVOR_STANDALONE: ::DWORD = 0x0100; -pub const DFS_VOLUME_FLAVOR_AD_BLOB: ::DWORD = 0x0200; -pub const DFS_STORAGE_FLAVOR_UNUSED2: ::DWORD = 0x0300; -pub const DFS_STORAGE_STATES: ::ULONG = 0xF; -pub const DFS_STORAGE_STATE_OFFLINE: ::ULONG = 1; -pub const DFS_STORAGE_STATE_ONLINE: ::ULONG = 2; -pub const DFS_STORAGE_STATE_ACTIVE: ::ULONG = 4; -ENUM!{enum DFS_TARGET_PRIORITY_CLASS { - DfsInvalidPriorityClass = -1i32 as u32, - DfsSiteCostNormalPriorityClass = 0, - DfsGlobalHighPriorityClass, - DfsSiteCostHighPriorityClass, - DfsSiteCostLowPriorityClass, - DfsGlobalLowPriorityClass, -}} -STRUCT!{struct DFS_TARGET_PRIORITY { - TargetPriorityClass: DFS_TARGET_PRIORITY_CLASS, - TargetPriorityRank: ::USHORT, - Reserved: ::USHORT, -}} -pub type PDFS_TARGET_PRIORITY = *mut DFS_TARGET_PRIORITY; -STRUCT!{struct DFS_INFO_1 { - EntryPath: ::LPWSTR, -}} -pub type PDFS_INFO_1 = *mut DFS_INFO_1; -pub type LPDFS_INFO_1 = *mut DFS_INFO_1; -#[cfg(target_arch="x86_64")] STRUCT!{struct DFS_INFO_1_32 { - EntryPath: ::ULONG, -}} -#[cfg(target_arch="x86_64")] -pub type PDFS_INFO_1_32 = *mut DFS_INFO_1_32; -#[cfg(target_arch="x86_64")] -pub type LPDFS_INFO_1_32 = *mut DFS_INFO_1_32; -STRUCT!{struct DFS_INFO_2 { - EntryPath: ::LPWSTR, - Comment: ::LPWSTR, - State: ::DWORD, - NumberOfStorages: ::DWORD, -}} -pub type PDFS_INFO_2 = *mut DFS_INFO_2; -pub type LPDFS_INFO_2 = *mut DFS_INFO_2; -#[cfg(target_arch="x86_64")] STRUCT!{struct DFS_INFO_2_32 { - EntryPath: ::ULONG, - Comment: ::ULONG, - State: ::DWORD, - NumberOfStorages: ::DWORD, -}} -#[cfg(target_arch="x86_64")] -pub type PDFS_INFO_2_32 = *mut DFS_INFO_2_32; -#[cfg(target_arch="x86_64")] -pub type LPDFS_INFO_2_32 = *mut DFS_INFO_2_32; -STRUCT!{struct DFS_STORAGE_INFO { - State: ::ULONG, - ServerName: ::LPWSTR, - ShareName: ::LPWSTR, -}} -pub type PDFS_STORAGE_INFO = *mut DFS_STORAGE_INFO; -pub type LPDFS_STORAGE_INFO = *mut DFS_STORAGE_INFO; -#[cfg(target_arch="x86_64")] STRUCT!{struct DFS_STORAGE_INFO_0_32 { - State: ::ULONG, - ServerName: ::ULONG, - ShareName: ::ULONG, -}} -#[cfg(target_arch="x86_64")] -pub type PDFS_STORAGE_INFO_0_32 = *mut DFS_STORAGE_INFO_0_32; -#[cfg(target_arch="x86_64")] -pub type LPDFS_STORAGE_INFO_0_32 = *mut DFS_STORAGE_INFO_0_32; -STRUCT!{struct DFS_STORAGE_INFO_1 { - State: ::ULONG, - ServerName: ::LPWSTR, - ShareName: ::LPWSTR, - TargetPriority: DFS_TARGET_PRIORITY, -}} -pub type PDFS_STORAGE_INFO_1 = *mut DFS_STORAGE_INFO_1; -pub type LPDFS_STORAGE_INFO_1 = *mut DFS_STORAGE_INFO_1; -STRUCT!{struct DFS_INFO_3 { - EntryPath: ::LPWSTR, - Comment: ::LPWSTR, - State: ::DWORD, - NumberOfStorages: ::DWORD, - Storage: LPDFS_STORAGE_INFO, -}} -pub type PDFS_INFO_3 = *mut DFS_INFO_3; -pub type LPDFS_INFO_3 = *mut DFS_INFO_3; -#[cfg(target_arch="x86_64")] STRUCT!{struct DFS_INFO_3_32 { - EntryPath: ::ULONG, - Comment: ::ULONG, - State: ::DWORD, - NumberOfStorages: ::DWORD, - Storage: ::ULONG, -}} -#[cfg(target_arch="x86_64")] -pub type PDFS_INFO_3_32 = *mut DFS_INFO_3_32; -#[cfg(target_arch="x86_64")] -pub type LPDFS_INFO_3_32 = *mut DFS_INFO_3_32; -STRUCT!{struct DFS_INFO_4 { - EntryPath: ::LPWSTR, - Comment: ::LPWSTR, - State: ::DWORD, - Timeout: ::ULONG, - Guid: ::GUID, - NumberOfStorages: ::DWORD, - Storage: LPDFS_STORAGE_INFO, -}} -pub type PDFS_INFO_4 = *mut DFS_INFO_4; -pub type LPDFS_INFO_4 = *mut DFS_INFO_4; -#[cfg(target_arch="x86_64")] STRUCT!{struct DFS_INFO_4_32 { - EntryPath: ::ULONG, - Comment: ::ULONG, - State: ::DWORD, - Timeout: ::ULONG, - Guid: ::GUID, - NumberOfStorages: ::DWORD, - Storage: ::ULONG, -}} -#[cfg(target_arch="x86_64")] -pub type PDFS_INFO_4_32 = *mut DFS_INFO_4_32; -#[cfg(target_arch="x86_64")] -pub type LPDFS_INFO_4_32 = *mut DFS_INFO_4_32; -STRUCT!{struct DFS_INFO_5 { - EntryPath: ::LPWSTR, - Comment: ::LPWSTR, - State: ::DWORD, - Timeout: ::ULONG, - Guid: ::GUID, - PropertyFlags: ::ULONG, - MetadataSize: ::ULONG, - NumberOfStorages: ::DWORD, -}} -pub type PDFS_INFO_5 = *mut DFS_INFO_5; -pub type LPDFS_INFO_5 = *mut DFS_INFO_5; -STRUCT!{struct DFS_INFO_6 { - EntryPath: ::LPWSTR, - Comment: ::LPWSTR, - State: ::DWORD, - Timeout: ::ULONG, - Guid: ::GUID, - PropertyFlags: ::ULONG, - MetadataSize: ::ULONG, - NumberOfStorages: ::DWORD, - Storage: LPDFS_STORAGE_INFO, -}} -pub type PDFS_INFO_6 = *mut DFS_INFO_6; -pub type LPDFS_INFO_6 = *mut DFS_INFO_6; -STRUCT!{struct DFS_INFO_7 { - GenerationGuid: ::GUID, -}} -pub type PDFS_INFO_7 = *mut DFS_INFO_7; -pub type LPDFS_INFO_7 = *mut DFS_INFO_7; -STRUCT!{struct DFS_INFO_8 { - EntryPath: ::LPWSTR, - Comment: ::LPWSTR, - State: ::DWORD, - Timeout: ::ULONG, - Guid: ::GUID, - PropertyFlags: ::ULONG, - MetadataSize: ::ULONG, - SdLengthReserved: ::ULONG, - pSecurityDescriptor: ::PSECURITY_DESCRIPTOR, - NumberOfStorages: ::DWORD, -}} -pub type PDFS_INFO_8 = *mut DFS_INFO_8; -pub type LPDFS_INFO_8 = *mut DFS_INFO_8; -STRUCT!{struct DFS_INFO_9 { - EntryPath: ::LPWSTR, - Comment: ::LPWSTR, - State: ::DWORD, - Timeout: ::ULONG, - Guid: ::GUID, - PropertyFlags: ::ULONG, - MetadataSize: ::ULONG, - SdLengthReserved: ::ULONG, - pSecurityDescriptor: ::PSECURITY_DESCRIPTOR, - NumberOfStorages: ::DWORD, - Storage: LPDFS_STORAGE_INFO, -}} -pub type PDFS_INFO_9 = *mut DFS_INFO_9; -pub type LPDFS_INFO_9 = *mut DFS_INFO_9; -pub const DFS_PROPERTY_FLAG_INSITE_REFERRALS: ::ULONG = 0x00000001; -pub const DFS_PROPERTY_FLAG_ROOT_SCALABILITY: ::ULONG = 0x00000002; -pub const DFS_PROPERTY_FLAG_SITE_COSTING: ::ULONG = 0x00000004; -pub const DFS_PROPERTY_FLAG_TARGET_FAILBACK: ::ULONG = 0x00000008; -pub const DFS_PROPERTY_FLAG_CLUSTER_ENABLED: ::ULONG = 0x00000010; -pub const DFS_PROPERTY_FLAG_ABDE: ::ULONG = 0x00000020; -pub const DFS_VALID_PROPERTY_FLAGS: ::ULONG = DFS_PROPERTY_FLAG_INSITE_REFERRALS - | DFS_PROPERTY_FLAG_ROOT_SCALABILITY | DFS_PROPERTY_FLAG_SITE_COSTING - | DFS_PROPERTY_FLAG_TARGET_FAILBACK | DFS_PROPERTY_FLAG_CLUSTER_ENABLED - | DFS_PROPERTY_FLAG_ABDE; -STRUCT!{struct DFS_INFO_50 { - NamespaceMajorVersion: ::ULONG, - NamespaceMinorVersion: ::ULONG, - NamespaceCapabilities: ::ULONGLONG, -}} -pub type PDFS_INFO_50 = *mut DFS_INFO_50; -pub type LPDFS_INFO_50 = *mut DFS_INFO_50; -STRUCT!{struct DFS_INFO_100 { - Comment: ::LPWSTR, -}} -pub type PDFS_INFO_100 = *mut DFS_INFO_100; -pub type LPDFS_INFO_100 = *mut DFS_INFO_100; -STRUCT!{struct DFS_INFO_101 { - State: ::DWORD, -}} -pub type PDFS_INFO_101 = *mut DFS_INFO_101; -pub type LPDFS_INFO_101 = *mut DFS_INFO_101; -STRUCT!{struct DFS_INFO_102 { - Timeout: ::ULONG, -}} -pub type PDFS_INFO_102 = *mut DFS_INFO_102; -pub type LPDFS_INFO_102 = *mut DFS_INFO_102; -STRUCT!{struct DFS_INFO_103 { - PropertyFlagMask: ::ULONG, - PropertyFlags: ::ULONG, -}} -pub type PDFS_INFO_103 = *mut DFS_INFO_103; -pub type LPDFS_INFO_103 = *mut DFS_INFO_103; -STRUCT!{struct DFS_INFO_104 { - TargetPriority: DFS_TARGET_PRIORITY, -}} -pub type PDFS_INFO_104 = *mut DFS_INFO_104; -pub type LPDFS_INFO_104 = *mut DFS_INFO_104; -STRUCT!{struct DFS_INFO_105 { - Comment: ::LPWSTR, - State: ::DWORD, - Timeout: ::ULONG, - PropertyFlagMask: ::ULONG, - PropertyFlags: ::ULONG, -}} -pub type PDFS_INFO_105 = *mut DFS_INFO_105; -pub type LPDFS_INFO_105 = *mut DFS_INFO_105; -STRUCT!{struct DFS_INFO_106 { - State: ::DWORD, - TargetPriority: DFS_TARGET_PRIORITY, -}} -pub type PDFS_INFO_106 = *mut DFS_INFO_106; -pub type LPDFS_INFO_106 = *mut DFS_INFO_106; -STRUCT!{struct DFS_INFO_107 { - Comment: ::LPWSTR, - State: ::DWORD, - Timeout: ::ULONG, - PropertyFlagMask: ::ULONG, - PropertyFlags: ::ULONG, - SdLengthReserved: ::ULONG, - pSecurityDescriptor: ::PSECURITY_DESCRIPTOR, -}} -pub type PDFS_INFO_107 = *mut DFS_INFO_107; -pub type LPDFS_INFO_107 = *mut DFS_INFO_107; -STRUCT!{struct DFS_INFO_150 { - SdLengthReserved: ::ULONG, - pSecurityDescriptor: ::PSECURITY_DESCRIPTOR, -}} -pub type PDFS_INFO_150 = *mut DFS_INFO_150; -pub type LPDFS_INFO_150 = *mut DFS_INFO_150; -STRUCT!{struct DFS_INFO_200 { - FtDfsName: ::LPWSTR, -}} -pub type PDFS_INFO_200 = *mut DFS_INFO_200; -pub type LPDFS_INFO_200 = *mut DFS_INFO_200; -STRUCT!{struct DFS_INFO_300 { - Flags: ::DWORD, - DfsName: ::LPWSTR, -}} -pub type PDFS_INFO_300 = *mut DFS_INFO_300; -pub type LPDFS_INFO_300 = *mut DFS_INFO_300; -pub const DFS_ADD_VOLUME: ::DWORD = 1; -pub const DFS_RESTORE_VOLUME: ::DWORD = 2; -pub const NET_DFS_SETDC_FLAGS: ::DWORD = 0x00000000; -pub const NET_DFS_SETDC_TIMEOUT: ::DWORD = 0x00000001; -pub const NET_DFS_SETDC_INITPKT: ::DWORD = 0x00000002; -STRUCT!{struct DFS_SITENAME_INFO { - SiteFlags: ::ULONG, - SiteName: ::LPWSTR, -}} -pub type PDFS_SITENAME_INFO = *mut DFS_SITENAME_INFO; -pub type LPDFS_SITENAME_INFO = *mut DFS_SITENAME_INFO; -pub const DFS_SITE_PRIMARY: ::ULONG = 0x1; -STRUCT!{struct DFS_SITELIST_INFO { - cSites: ::ULONG, - Site: [DFS_SITENAME_INFO; 1], -}} -pub type PDFS_SITELIST_INFO = *mut DFS_SITELIST_INFO; -pub type LPDFS_SITELIST_INFO = *mut DFS_SITELIST_INFO; -ENUM!{enum DFS_NAMESPACE_VERSION_ORIGIN { - DFS_NAMESPACE_VERSION_ORIGIN_COMBINED = 0, - DFS_NAMESPACE_VERSION_ORIGIN_SERVER, - DFS_NAMESPACE_VERSION_ORIGIN_DOMAIN, -}} -pub type PDFS_NAMESPACE_VERSION_ORIGIN = *mut DFS_NAMESPACE_VERSION_ORIGIN; -pub const DFS_NAMESPACE_CAPABILITY_ABDE: ::ULONGLONG = 0x0000000000000001; -STRUCT!{struct DFS_SUPPORTED_NAMESPACE_VERSION_INFO { - DomainDfsMajorVersion: ::ULONG, - DomainDfsMinorVersion: ::ULONG, - DomainDfsCapabilities: ::ULONGLONG, - StandaloneDfsMajorVersion: ::ULONG, - StandaloneDfsMinorVersion: ::ULONG, - StandaloneDfsCapabilities: ::ULONGLONG, -}} -pub type PDFS_SUPPORTED_NAMESPACE_VERSION_INFO = *mut DFS_SUPPORTED_NAMESPACE_VERSION_INFO; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/lmerrlog.rs cargo-0.37.0/vendor/winapi-0.2.8/src/lmerrlog.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/lmerrlog.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/lmerrlog.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,263 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -STRUCT!{struct ERROR_LOG { - el_len: ::DWORD, - el_reserved: ::DWORD, - el_time: ::DWORD, - el_error: ::DWORD, - el_name: ::LPWSTR, - el_text: ::LPWSTR, - el_data: ::LPBYTE, - el_data_size: ::DWORD, - el_nstrings: ::DWORD, -}} -pub type PERROR_LOG = *mut ERROR_LOG; -pub type LPERROR_LOG = *mut ERROR_LOG; -STRUCT!{struct HLOG { - time: ::DWORD, - last_flags: ::DWORD, - offset: ::DWORD, - rec_offset: ::DWORD, -}} -pub type PHLOG = *mut HLOG; -pub type LPHLOG = *mut HLOG; -pub const LOGFLAGS_FORWARD: ::DWORD = 0; -pub const LOGFLAGS_BACKWARD: ::DWORD = 0x1; -pub const LOGFLAGS_SEEK: ::DWORD = 0x2; -pub const ERRLOG_BASE: ::DWORD = 3100; -pub const NELOG_Internal_Error: ::DWORD = ERRLOG_BASE + 0; -pub const NELOG_Resource_Shortage: ::DWORD = ERRLOG_BASE + 1; -pub const NELOG_Unable_To_Lock_Segment: ::DWORD = ERRLOG_BASE + 2; -pub const NELOG_Unable_To_Unlock_Segment: ::DWORD = ERRLOG_BASE + 3; -pub const NELOG_Uninstall_Service: ::DWORD = ERRLOG_BASE + 4; -pub const NELOG_Init_Exec_Fail: ::DWORD = ERRLOG_BASE + 5; -pub const NELOG_Ncb_Error: ::DWORD = ERRLOG_BASE + 6; -pub const NELOG_Net_Not_Started: ::DWORD = ERRLOG_BASE + 7; -pub const NELOG_Ioctl_Error: ::DWORD = ERRLOG_BASE + 8; -pub const NELOG_System_Semaphore: ::DWORD = ERRLOG_BASE + 9; -pub const NELOG_Init_OpenCreate_Err: ::DWORD = ERRLOG_BASE + 10; -pub const NELOG_NetBios: ::DWORD = ERRLOG_BASE + 11; -pub const NELOG_SMB_Illegal: ::DWORD = ERRLOG_BASE + 12; -pub const NELOG_Service_Fail: ::DWORD = ERRLOG_BASE + 13; -pub const NELOG_Entries_Lost: ::DWORD = ERRLOG_BASE + 14; -pub const NELOG_Init_Seg_Overflow: ::DWORD = ERRLOG_BASE + 20; -pub const NELOG_Srv_No_Mem_Grow: ::DWORD = ERRLOG_BASE + 21; -pub const NELOG_Access_File_Bad: ::DWORD = ERRLOG_BASE + 22; -pub const NELOG_Srvnet_Not_Started: ::DWORD = ERRLOG_BASE + 23; -pub const NELOG_Init_Chardev_Err: ::DWORD = ERRLOG_BASE + 24; -pub const NELOG_Remote_API: ::DWORD = ERRLOG_BASE + 25; -pub const NELOG_Ncb_TooManyErr: ::DWORD = ERRLOG_BASE + 26; -pub const NELOG_Mailslot_err: ::DWORD = ERRLOG_BASE + 27; -pub const NELOG_ReleaseMem_Alert: ::DWORD = ERRLOG_BASE + 28; -pub const NELOG_AT_cannot_write: ::DWORD = ERRLOG_BASE + 29; -pub const NELOG_Cant_Make_Msg_File: ::DWORD = ERRLOG_BASE + 30; -pub const NELOG_Exec_Netservr_NoMem: ::DWORD = ERRLOG_BASE + 31; -pub const NELOG_Server_Lock_Failure: ::DWORD = ERRLOG_BASE + 32; -pub const NELOG_Msg_Shutdown: ::DWORD = ERRLOG_BASE + 40; -pub const NELOG_Msg_Sem_Shutdown: ::DWORD = ERRLOG_BASE + 41; -pub const NELOG_Msg_Log_Err: ::DWORD = ERRLOG_BASE + 50; -pub const NELOG_VIO_POPUP_ERR: ::DWORD = ERRLOG_BASE + 51; -pub const NELOG_Msg_Unexpected_SMB_Type: ::DWORD = ERRLOG_BASE + 52; -pub const NELOG_Wksta_Infoseg: ::DWORD = ERRLOG_BASE + 60; -pub const NELOG_Wksta_Compname: ::DWORD = ERRLOG_BASE + 61; -pub const NELOG_Wksta_BiosThreadFailure: ::DWORD = ERRLOG_BASE + 62; -pub const NELOG_Wksta_IniSeg: ::DWORD = ERRLOG_BASE + 63; -pub const NELOG_Wksta_HostTab_Full: ::DWORD = ERRLOG_BASE + 64; -pub const NELOG_Wksta_Bad_Mailslot_SMB: ::DWORD = ERRLOG_BASE + 65; -pub const NELOG_Wksta_UASInit: ::DWORD = ERRLOG_BASE + 66; -pub const NELOG_Wksta_SSIRelogon: ::DWORD = ERRLOG_BASE + 67; -pub const NELOG_Build_Name: ::DWORD = ERRLOG_BASE + 70; -pub const NELOG_Name_Expansion: ::DWORD = ERRLOG_BASE + 71; -pub const NELOG_Message_Send: ::DWORD = ERRLOG_BASE + 72; -pub const NELOG_Mail_Slt_Err: ::DWORD = ERRLOG_BASE + 73; -pub const NELOG_AT_cannot_read: ::DWORD = ERRLOG_BASE + 74; -pub const NELOG_AT_sched_err: ::DWORD = ERRLOG_BASE + 75; -pub const NELOG_AT_schedule_file_created: ::DWORD = ERRLOG_BASE + 76; -pub const NELOG_Srvnet_NB_Open: ::DWORD = ERRLOG_BASE + 77; -pub const NELOG_AT_Exec_Err: ::DWORD = ERRLOG_BASE + 78; -pub const NELOG_Lazy_Write_Err: ::DWORD = ERRLOG_BASE + 80; -pub const NELOG_HotFix: ::DWORD = ERRLOG_BASE + 81; -pub const NELOG_HardErr_From_Server: ::DWORD = ERRLOG_BASE + 82; -pub const NELOG_LocalSecFail1: ::DWORD = ERRLOG_BASE + 83; -pub const NELOG_LocalSecFail2: ::DWORD = ERRLOG_BASE + 84; -pub const NELOG_LocalSecFail3: ::DWORD = ERRLOG_BASE + 85; -pub const NELOG_LocalSecGeneralFail: ::DWORD = ERRLOG_BASE + 86; -pub const NELOG_NetWkSta_Internal_Error: ::DWORD = ERRLOG_BASE + 90; -pub const NELOG_NetWkSta_No_Resource: ::DWORD = ERRLOG_BASE + 91; -pub const NELOG_NetWkSta_SMB_Err: ::DWORD = ERRLOG_BASE + 92; -pub const NELOG_NetWkSta_VC_Err: ::DWORD = ERRLOG_BASE + 93; -pub const NELOG_NetWkSta_Stuck_VC_Err: ::DWORD = ERRLOG_BASE + 94; -pub const NELOG_NetWkSta_NCB_Err: ::DWORD = ERRLOG_BASE + 95; -pub const NELOG_NetWkSta_Write_Behind_Err: ::DWORD = ERRLOG_BASE + 96; -pub const NELOG_NetWkSta_Reset_Err: ::DWORD = ERRLOG_BASE + 97; -pub const NELOG_NetWkSta_Too_Many: ::DWORD = ERRLOG_BASE + 98; -pub const NELOG_Srv_Thread_Failure: ::DWORD = ERRLOG_BASE + 104; -pub const NELOG_Srv_Close_Failure: ::DWORD = ERRLOG_BASE + 105; -pub const NELOG_ReplUserCurDir: ::DWORD = ERRLOG_BASE + 106; -pub const NELOG_ReplCannotMasterDir: ::DWORD = ERRLOG_BASE + 107; -pub const NELOG_ReplUpdateError: ::DWORD = ERRLOG_BASE + 108; -pub const NELOG_ReplLostMaster: ::DWORD = ERRLOG_BASE + 109; -pub const NELOG_NetlogonAuthDCFail: ::DWORD = ERRLOG_BASE + 110; -pub const NELOG_ReplLogonFailed: ::DWORD = ERRLOG_BASE + 111; -pub const NELOG_ReplNetErr: ::DWORD = ERRLOG_BASE + 112; -pub const NELOG_ReplMaxFiles: ::DWORD = ERRLOG_BASE + 113; -pub const NELOG_ReplMaxTreeDepth: ::DWORD = ERRLOG_BASE + 114; -pub const NELOG_ReplBadMsg: ::DWORD = ERRLOG_BASE + 115; -pub const NELOG_ReplSysErr: ::DWORD = ERRLOG_BASE + 116; -pub const NELOG_ReplUserLoged: ::DWORD = ERRLOG_BASE + 117; -pub const NELOG_ReplBadImport: ::DWORD = ERRLOG_BASE + 118; -pub const NELOG_ReplBadExport: ::DWORD = ERRLOG_BASE + 119; -pub const NELOG_ReplSignalFileErr: ::DWORD = ERRLOG_BASE + 120; -pub const NELOG_DiskFT: ::DWORD = ERRLOG_BASE + 121; -pub const NELOG_ReplAccessDenied: ::DWORD = ERRLOG_BASE + 122; -pub const NELOG_NetlogonFailedPrimary: ::DWORD = ERRLOG_BASE + 123; -pub const NELOG_NetlogonPasswdSetFailed: ::DWORD = ERRLOG_BASE + 124; -pub const NELOG_NetlogonTrackingError: ::DWORD = ERRLOG_BASE + 125; -pub const NELOG_NetlogonSyncError: ::DWORD = ERRLOG_BASE + 126; -pub const NELOG_NetlogonRequireSignOrSealError: ::DWORD = ERRLOG_BASE + 127; -pub const NELOG_UPS_PowerOut: ::DWORD = ERRLOG_BASE + 130; -pub const NELOG_UPS_Shutdown: ::DWORD = ERRLOG_BASE + 131; -pub const NELOG_UPS_CmdFileError: ::DWORD = ERRLOG_BASE + 132; -pub const NELOG_UPS_CannotOpenDriver: ::DWORD = ERRLOG_BASE+133; -pub const NELOG_UPS_PowerBack: ::DWORD = ERRLOG_BASE + 134; -pub const NELOG_UPS_CmdFileConfig: ::DWORD = ERRLOG_BASE + 135; -pub const NELOG_UPS_CmdFileExec: ::DWORD = ERRLOG_BASE + 136; -pub const NELOG_Missing_Parameter: ::DWORD = ERRLOG_BASE + 150; -pub const NELOG_Invalid_Config_Line: ::DWORD = ERRLOG_BASE + 151; -pub const NELOG_Invalid_Config_File: ::DWORD = ERRLOG_BASE + 152; -pub const NELOG_File_Changed: ::DWORD = ERRLOG_BASE + 153; -pub const NELOG_Files_Dont_Fit: ::DWORD = ERRLOG_BASE + 154; -pub const NELOG_Wrong_DLL_Version: ::DWORD = ERRLOG_BASE + 155; -pub const NELOG_Error_in_DLL: ::DWORD = ERRLOG_BASE + 156; -pub const NELOG_System_Error: ::DWORD = ERRLOG_BASE + 157; -pub const NELOG_FT_ErrLog_Too_Large: ::DWORD = ERRLOG_BASE + 158; -pub const NELOG_FT_Update_In_Progress: ::DWORD = ERRLOG_BASE + 159; -pub const NELOG_Joined_Domain: ::DWORD = ERRLOG_BASE + 160; -pub const NELOG_Joined_Workgroup: ::DWORD = ERRLOG_BASE + 161; -pub const NELOG_OEM_Code: ::DWORD = ERRLOG_BASE + 199; -pub const ERRLOG2_BASE: ::DWORD = 5700; -pub const NELOG_NetlogonSSIInitError: ::DWORD = ERRLOG2_BASE + 0; -pub const NELOG_NetlogonFailedToUpdateTrustList: ::DWORD = ERRLOG2_BASE + 1; -pub const NELOG_NetlogonFailedToAddRpcInterface: ::DWORD = ERRLOG2_BASE + 2; -pub const NELOG_NetlogonFailedToReadMailslot: ::DWORD = ERRLOG2_BASE + 3; -pub const NELOG_NetlogonFailedToRegisterSC: ::DWORD = ERRLOG2_BASE + 4; -pub const NELOG_NetlogonChangeLogCorrupt: ::DWORD = ERRLOG2_BASE + 5; -pub const NELOG_NetlogonFailedToCreateShare: ::DWORD = ERRLOG2_BASE + 6; -pub const NELOG_NetlogonDownLevelLogonFailed: ::DWORD = ERRLOG2_BASE + 7; -pub const NELOG_NetlogonDownLevelLogoffFailed: ::DWORD = ERRLOG2_BASE + 8; -pub const NELOG_NetlogonNTLogonFailed: ::DWORD = ERRLOG2_BASE + 9; -pub const NELOG_NetlogonNTLogoffFailed: ::DWORD = ERRLOG2_BASE + 10; -pub const NELOG_NetlogonPartialSyncCallSuccess: ::DWORD = ERRLOG2_BASE + 11; -pub const NELOG_NetlogonPartialSyncCallFailed: ::DWORD = ERRLOG2_BASE + 12; -pub const NELOG_NetlogonFullSyncCallSuccess: ::DWORD = ERRLOG2_BASE + 13; -pub const NELOG_NetlogonFullSyncCallFailed: ::DWORD = ERRLOG2_BASE + 14; -pub const NELOG_NetlogonPartialSyncSuccess: ::DWORD = ERRLOG2_BASE + 15; -pub const NELOG_NetlogonPartialSyncFailed: ::DWORD = ERRLOG2_BASE + 16; -pub const NELOG_NetlogonFullSyncSuccess: ::DWORD = ERRLOG2_BASE + 17; -pub const NELOG_NetlogonFullSyncFailed: ::DWORD = ERRLOG2_BASE + 18; -pub const NELOG_NetlogonAuthNoDomainController: ::DWORD = ERRLOG2_BASE + 19; -pub const NELOG_NetlogonAuthNoTrustLsaSecret: ::DWORD = ERRLOG2_BASE + 20; -pub const NELOG_NetlogonAuthNoTrustSamAccount: ::DWORD = ERRLOG2_BASE + 21; -pub const NELOG_NetlogonServerAuthFailed: ::DWORD = ERRLOG2_BASE + 22; -pub const NELOG_NetlogonServerAuthNoTrustSamAccount: ::DWORD = ERRLOG2_BASE + 23; -pub const NELOG_FailedToRegisterSC: ::DWORD = ERRLOG2_BASE + 24; -pub const NELOG_FailedToSetServiceStatus: ::DWORD = ERRLOG2_BASE + 25; -pub const NELOG_FailedToGetComputerName: ::DWORD = ERRLOG2_BASE + 26; -pub const NELOG_DriverNotLoaded: ::DWORD = ERRLOG2_BASE + 27; -pub const NELOG_NoTranportLoaded: ::DWORD = ERRLOG2_BASE + 28; -pub const NELOG_NetlogonFailedDomainDelta: ::DWORD = ERRLOG2_BASE + 29; -pub const NELOG_NetlogonFailedGlobalGroupDelta: ::DWORD = ERRLOG2_BASE + 30; -pub const NELOG_NetlogonFailedLocalGroupDelta: ::DWORD = ERRLOG2_BASE + 31; -pub const NELOG_NetlogonFailedUserDelta: ::DWORD = ERRLOG2_BASE + 32; -pub const NELOG_NetlogonFailedPolicyDelta: ::DWORD = ERRLOG2_BASE + 33; -pub const NELOG_NetlogonFailedTrustedDomainDelta: ::DWORD = ERRLOG2_BASE + 34; -pub const NELOG_NetlogonFailedAccountDelta: ::DWORD = ERRLOG2_BASE + 35; -pub const NELOG_NetlogonFailedSecretDelta: ::DWORD = ERRLOG2_BASE + 36; -pub const NELOG_NetlogonSystemError: ::DWORD = ERRLOG2_BASE + 37; -pub const NELOG_NetlogonDuplicateMachineAccounts: ::DWORD = ERRLOG2_BASE + 38; -pub const NELOG_NetlogonTooManyGlobalGroups: ::DWORD = ERRLOG2_BASE + 39; -pub const NELOG_NetlogonBrowserDriver: ::DWORD = ERRLOG2_BASE + 40; -pub const NELOG_NetlogonAddNameFailure: ::DWORD = ERRLOG2_BASE + 41; -pub const NELOG_RplMessages: ::DWORD = ERRLOG2_BASE + 42; -pub const NELOG_RplXnsBoot: ::DWORD = ERRLOG2_BASE + 43; -pub const NELOG_RplSystem: ::DWORD = ERRLOG2_BASE + 44; -pub const NELOG_RplWkstaTimeout: ::DWORD = ERRLOG2_BASE + 45; -pub const NELOG_RplWkstaFileOpen: ::DWORD = ERRLOG2_BASE + 46; -pub const NELOG_RplWkstaFileRead: ::DWORD = ERRLOG2_BASE + 47; -pub const NELOG_RplWkstaMemory: ::DWORD = ERRLOG2_BASE + 48; -pub const NELOG_RplWkstaFileChecksum: ::DWORD = ERRLOG2_BASE + 49; -pub const NELOG_RplWkstaFileLineCount: ::DWORD = ERRLOG2_BASE + 50; -pub const NELOG_RplWkstaBbcFile: ::DWORD = ERRLOG2_BASE + 51; -pub const NELOG_RplWkstaFileSize: ::DWORD = ERRLOG2_BASE + 52; -pub const NELOG_RplWkstaInternal: ::DWORD = ERRLOG2_BASE + 53; -pub const NELOG_RplWkstaWrongVersion: ::DWORD = ERRLOG2_BASE + 54; -pub const NELOG_RplWkstaNetwork: ::DWORD = ERRLOG2_BASE + 55; -pub const NELOG_RplAdapterResource: ::DWORD = ERRLOG2_BASE + 56; -pub const NELOG_RplFileCopy: ::DWORD = ERRLOG2_BASE + 57; -pub const NELOG_RplFileDelete: ::DWORD = ERRLOG2_BASE + 58; -pub const NELOG_RplFilePerms: ::DWORD = ERRLOG2_BASE + 59; -pub const NELOG_RplCheckConfigs: ::DWORD = ERRLOG2_BASE + 60; -pub const NELOG_RplCreateProfiles: ::DWORD = ERRLOG2_BASE + 61; -pub const NELOG_RplRegistry: ::DWORD = ERRLOG2_BASE + 62; -pub const NELOG_RplReplaceRPLDISK: ::DWORD = ERRLOG2_BASE + 63; -pub const NELOG_RplCheckSecurity: ::DWORD = ERRLOG2_BASE + 64; -pub const NELOG_RplBackupDatabase: ::DWORD = ERRLOG2_BASE + 65; -pub const NELOG_RplInitDatabase: ::DWORD = ERRLOG2_BASE + 66; -pub const NELOG_RplRestoreDatabaseFailure: ::DWORD = ERRLOG2_BASE + 67; -pub const NELOG_RplRestoreDatabaseSuccess: ::DWORD = ERRLOG2_BASE + 68; -pub const NELOG_RplInitRestoredDatabase: ::DWORD = ERRLOG2_BASE + 69; -pub const NELOG_NetlogonSessionTypeWrong: ::DWORD = ERRLOG2_BASE + 70; -pub const NELOG_RplUpgradeDBTo40: ::DWORD = ERRLOG2_BASE + 71; -pub const NELOG_NetlogonLanmanBdcsNotAllowed: ::DWORD = ERRLOG2_BASE + 72; -pub const NELOG_NetlogonNoDynamicDns: ::DWORD = ERRLOG2_BASE + 73; -pub const NELOG_NetlogonDynamicDnsRegisterFailure: ::DWORD = ERRLOG2_BASE + 74; -pub const NELOG_NetlogonDynamicDnsDeregisterFailure: ::DWORD = ERRLOG2_BASE + 75; -pub const NELOG_NetlogonFailedFileCreate: ::DWORD = ERRLOG2_BASE + 76; -pub const NELOG_NetlogonGetSubnetToSite: ::DWORD = ERRLOG2_BASE + 77; -pub const NELOG_NetlogonNoSiteForClient: ::DWORD = ERRLOG2_BASE + 78; -pub const NELOG_NetlogonBadSiteName: ::DWORD = ERRLOG2_BASE + 79; -pub const NELOG_NetlogonBadSubnetName: ::DWORD = ERRLOG2_BASE + 80; -pub const NELOG_NetlogonDynamicDnsServerFailure: ::DWORD = ERRLOG2_BASE + 81; -pub const NELOG_NetlogonDynamicDnsFailure: ::DWORD = ERRLOG2_BASE + 82; -pub const NELOG_NetlogonRpcCallCancelled: ::DWORD = ERRLOG2_BASE + 83; -pub const NELOG_NetlogonDcSiteCovered: ::DWORD = ERRLOG2_BASE + 84; -pub const NELOG_NetlogonDcSiteNotCovered: ::DWORD = ERRLOG2_BASE + 85; -pub const NELOG_NetlogonGcSiteCovered: ::DWORD = ERRLOG2_BASE + 86; -pub const NELOG_NetlogonGcSiteNotCovered: ::DWORD = ERRLOG2_BASE + 87; -pub const NELOG_NetlogonFailedSpnUpdate: ::DWORD = ERRLOG2_BASE + 88; -pub const NELOG_NetlogonFailedDnsHostNameUpdate: ::DWORD = ERRLOG2_BASE + 89; -pub const NELOG_NetlogonAuthNoUplevelDomainController: ::DWORD = ERRLOG2_BASE + 90; -pub const NELOG_NetlogonAuthDomainDowngraded: ::DWORD = ERRLOG2_BASE + 91; -pub const NELOG_NetlogonNdncSiteCovered: ::DWORD = ERRLOG2_BASE + 92; -pub const NELOG_NetlogonNdncSiteNotCovered: ::DWORD = ERRLOG2_BASE + 93; -pub const NELOG_NetlogonDcOldSiteCovered: ::DWORD = ERRLOG2_BASE + 94; -pub const NELOG_NetlogonDcSiteNotCoveredAuto: ::DWORD = ERRLOG2_BASE + 95; -pub const NELOG_NetlogonGcOldSiteCovered: ::DWORD = ERRLOG2_BASE + 96; -pub const NELOG_NetlogonGcSiteNotCoveredAuto: ::DWORD = ERRLOG2_BASE + 97; -pub const NELOG_NetlogonNdncOldSiteCovered: ::DWORD = ERRLOG2_BASE + 98; -pub const NELOG_NetlogonNdncSiteNotCoveredAuto: ::DWORD = ERRLOG2_BASE + 99; -pub const NELOG_NetlogonSpnMultipleSamAccountNames: ::DWORD = ERRLOG2_BASE + 100; -pub const NELOG_NetlogonSpnCrackNamesFailure: ::DWORD = ERRLOG2_BASE + 101; -pub const NELOG_NetlogonNoAddressToSiteMapping: ::DWORD = ERRLOG2_BASE + 102; -pub const NELOG_NetlogonInvalidGenericParameterValue: ::DWORD = ERRLOG2_BASE + 103; -pub const NELOG_NetlogonInvalidDwordParameterValue: ::DWORD = ERRLOG2_BASE + 104; -pub const NELOG_NetlogonServerAuthFailedNoAccount: ::DWORD = ERRLOG2_BASE + 105; -pub const NELOG_NetlogonNoDynamicDnsManual: ::DWORD = ERRLOG2_BASE + 106; -pub const NELOG_NetlogonNoSiteForClients: ::DWORD = ERRLOG2_BASE + 107; -pub const NELOG_NetlogonDnsDeregAborted: ::DWORD = ERRLOG2_BASE + 108; -pub const NELOG_NetlogonRpcPortRequestFailure: ::DWORD = ERRLOG2_BASE + 109; -pub const NELOG_NetlogonPartialSiteMappingForClients: ::DWORD = ERRLOG2_BASE + 110; -pub const NELOG_NetlogonRemoteDynamicDnsRegisterFailure: ::DWORD = ERRLOG2_BASE + 111; -pub const NELOG_NetlogonRemoteDynamicDnsDeregisterFailure: ::DWORD = ERRLOG2_BASE + 112; -pub const NELOG_NetlogonRejectedRemoteDynamicDnsRegister: ::DWORD = ERRLOG2_BASE + 113; -pub const NELOG_NetlogonRejectedRemoteDynamicDnsDeregister: ::DWORD = ERRLOG2_BASE + 114; -pub const NELOG_NetlogonRemoteDynamicDnsUpdateRequestFailure: ::DWORD = ERRLOG2_BASE + 115; -pub const NELOG_NetlogonUserValidationReqInitialTimeOut: ::DWORD = ERRLOG2_BASE + 116; -pub const NELOG_NetlogonUserValidationReqRecurringTimeOut: ::DWORD = ERRLOG2_BASE + 117; -pub const NELOG_NetlogonUserValidationReqWaitInitialWarning: ::DWORD = ERRLOG2_BASE + 118; -pub const NELOG_NetlogonUserValidationReqWaitRecurringWarning: ::DWORD = ERRLOG2_BASE + 119; -pub const NELOG_NetlogonFailedToAddAuthzRpcInterface: ::DWORD = ERRLOG2_BASE + 120; -pub const NELOG_NetLogonFailedToInitializeAuthzRm: ::DWORD = ERRLOG2_BASE + 121; -pub const NELOG_NetLogonFailedToInitializeRPCSD: ::DWORD = ERRLOG2_BASE + 122; -pub const NELOG_NetlogonMachinePasswdSetSucceeded: ::DWORD = ERRLOG2_BASE + 123; -pub const NELOG_NetlogonMsaPasswdSetSucceeded: ::DWORD = ERRLOG2_BASE + 124; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/lmjoin.rs cargo-0.37.0/vendor/winapi-0.2.8/src/lmjoin.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/lmjoin.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/lmjoin.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -// Definitions and prototypes for the Net setup apis -ENUM!{enum NETSETUP_NAME_TYPE { - NetSetupUnknown = 0, - NetSetupMachine, - NetSetupWorkgroup, - NetSetupDomain, - NetSetupNonExistentDomain, - NetSetupDnsMachine, -}} -pub type PNETSETUP_NAME_TYPE = *mut NETSETUP_NAME_TYPE; -ENUM!{enum NETSETUP_JOIN_STATUS { - NetSetupUnknownStatus = 0, - NetSetupUnjoined, - NetSetupWorkgroupName, - NetSetupDomainName, -}} -pub type PNETSETUP_JOIN_STATUS = *mut NETSETUP_JOIN_STATUS; -pub const NETSETUP_JOIN_DOMAIN: ::DWORD = 0x00000001; -pub const NETSETUP_ACCT_CREATE: ::DWORD = 0x00000002; -pub const NETSETUP_ACCT_DELETE: ::DWORD = 0x00000004; -pub const NETSETUP_WIN9X_UPGRADE: ::DWORD = 0x00000010; -pub const NETSETUP_DOMAIN_JOIN_IF_JOINED: ::DWORD = 0x00000020; -pub const NETSETUP_JOIN_UNSECURE: ::DWORD = 0x00000040; -pub const NETSETUP_MACHINE_PWD_PASSED: ::DWORD = 0x00000080; -pub const NETSETUP_DEFER_SPN_SET: ::DWORD = 0x00000100; -pub const NETSETUP_JOIN_DC_ACCOUNT: ::DWORD = 0x00000200; -pub const NETSETUP_JOIN_WITH_NEW_NAME: ::DWORD = 0x00000400; -pub const NETSETUP_JOIN_READONLY: ::DWORD = 0x00000800; -pub const NETSETUP_DNS_NAME_CHANGES_ONLY: ::DWORD = 0x00001000; -pub const NETSETUP_INSTALL_INVOCATION: ::DWORD = 0x00040000; -pub const NETSETUP_AMBIGUOUS_DC: ::DWORD = 0x00001000; -pub const NETSETUP_NO_NETLOGON_CACHE: ::DWORD = 0x00002000; -pub const NETSETUP_DONT_CONTROL_SERVICES: ::DWORD = 0x00004000; -pub const NETSETUP_SET_MACHINE_NAME: ::DWORD = 0x00008000; -pub const NETSETUP_FORCE_SPN_SET: ::DWORD = 0x00010000; -pub const NETSETUP_NO_ACCT_REUSE: ::DWORD = 0x00020000; -pub const NETSETUP_ALT_SAMACCOUNTNAME: ::DWORD = 0x00020000; -pub const NETSETUP_IGNORE_UNSUPPORTED_FLAGS: ::DWORD = 0x10000000; -pub const NETSETUP_VALID_UNJOIN_FLAGS: ::DWORD = NETSETUP_ACCT_DELETE - | NETSETUP_IGNORE_UNSUPPORTED_FLAGS | NETSETUP_JOIN_DC_ACCOUNT; -pub const NETSETUP_PROCESS_OFFLINE_FLAGS: ::DWORD = NETSETUP_JOIN_DOMAIN - | NETSETUP_DOMAIN_JOIN_IF_JOINED | NETSETUP_JOIN_WITH_NEW_NAME | NETSETUP_DONT_CONTROL_SERVICES - | NETSETUP_MACHINE_PWD_PASSED; -pub const NETSETUP_PROVISION_DOWNLEVEL_PRIV_SUPPORT: ::DWORD = 0x00000001; -pub const NETSETUP_PROVISION_REUSE_ACCOUNT: ::DWORD = 0x00000002; -pub const NETSETUP_PROVISION_USE_DEFAULT_PASSWORD: ::DWORD = 0x00000004; -pub const NETSETUP_PROVISION_SKIP_ACCOUNT_SEARCH: ::DWORD = 0x00000008; -pub const NETSETUP_PROVISION_ROOT_CA_CERTS: ::DWORD = 0x00000010; -pub const NETSETUP_PROVISION_PERSISTENTSITE: ::DWORD = 0x00000020; -pub const NETSETUP_PROVISION_ONLINE_CALLER: ::DWORD = 0x40000000; -pub const NETSETUP_PROVISION_CHECK_PWD_ONLY: ::DWORD = 0x80000000; -pub const NETSETUP_PROVISIONING_PARAMS_WIN8_VERSION: ::DWORD = 0x00000001; -pub const NETSETUP_PROVISIONING_PARAMS_CURRENT_VERSION: ::DWORD = 0x00000002; -STRUCT!{struct NETSETUP_PROVISIONING_PARAMS { - dwVersion: ::DWORD, - lpDomain: ::LPCWSTR, - lpHostName: ::LPCWSTR, - lpMachineAccountOU: ::LPCWSTR, - lpDcName: ::LPCWSTR, - dwProvisionOptions: ::DWORD, - aCertTemplateNames: *mut ::LPCWSTR, - cCertTemplateNames: ::DWORD, - aMachinePolicyNames: *mut ::LPCWSTR, - cMachinePolicyNames: ::DWORD, - aMachinePolicyPaths: *mut ::LPCWSTR, - cMachinePolicyPaths: ::DWORD, - lpNetbiosName: ::LPWSTR, - lpSiteName: ::LPWSTR, - lpPrimaryDNSDomain: ::LPWSTR, -}} -pub type PNETSETUP_PROVISIONING_PARAMS = *mut NETSETUP_PROVISIONING_PARAMS; -ENUM!{enum NET_COMPUTER_NAME_TYPE { - NetPrimaryComputerName, - NetAlternateComputerNames, - NetAllComputerNames, - NetComputerNameTypeMax, -}} -pub type PNET_COMPUTER_NAME_TYPE = *mut NET_COMPUTER_NAME_TYPE; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/lsalookup.rs cargo-0.37.0/vendor/winapi-0.2.8/src/lsalookup.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/lsalookup.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/lsalookup.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,69 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! LSA Policy Lookup API -STRUCT!{struct LSA_UNICODE_STRING { - Length: ::USHORT, - MaximumLength: ::USHORT, - Buffer: ::PWSTR, -}} -pub type PLSA_UNICODE_STRING = *mut LSA_UNICODE_STRING; -STRUCT!{struct LSA_STRING { - Length: ::USHORT, - MaximumLength: ::USHORT, - Buffer: ::PCHAR, -}} -pub type PLSA_STRING = *mut LSA_STRING; -STRUCT!{struct LSA_OBJECT_ATTRIBUTES { - Length: ::ULONG, - RootDirectory: ::HANDLE, - ObjectName: PLSA_UNICODE_STRING, - Attributes: ::ULONG, - SecurityDescriptor: ::PVOID, - SecurityQualityOfService: ::PVOID, -}} -pub type PLSA_OBJECT_ATTRIBUTES = *mut LSA_OBJECT_ATTRIBUTES; -STRUCT!{struct LSA_TRUST_INFORMATION { - Name: LSA_UNICODE_STRING, - Sid: ::PSID, -}} -pub type PLSA_TRUST_INFORMATION = *mut LSA_TRUST_INFORMATION; -STRUCT!{struct LSA_REFERENCED_DOMAIN_LIST { - Entries: ::ULONG, - Domains: PLSA_TRUST_INFORMATION, -}} -pub type PLSA_REFERENCED_DOMAIN_LIST = *mut LSA_REFERENCED_DOMAIN_LIST; -STRUCT!{struct LSA_TRANSLATED_SID2 { - Use: ::SID_NAME_USE, - Sid: ::PSID, - DomainIndex: ::LONG, - Flags: ::ULONG, -}} -pub type PLSA_TRANSLATED_SID2 = *mut LSA_TRANSLATED_SID2; -STRUCT!{struct LSA_TRANSLATED_NAME { - Use: ::SID_NAME_USE, - Name: LSA_UNICODE_STRING, - DomainIndex: ::LONG, -}} -pub type PLSA_TRANSLATED_NAME = *mut LSA_TRANSLATED_NAME; -STRUCT!{struct POLICY_ACCOUNT_DOMAIN_INFO { - DomainName: LSA_UNICODE_STRING, - DomainSid: ::PSID, -}} -pub type PPOLICY_ACCOUNT_DOMAIN_INFO = *mut POLICY_ACCOUNT_DOMAIN_INFO; -STRUCT!{struct POLICY_DNS_DOMAIN_INFO { - Name: LSA_UNICODE_STRING, - DnsDomainName: LSA_UNICODE_STRING, - DnsForestName: LSA_UNICODE_STRING, - DomainGuid: ::GUID, - Sid: ::PSID, -}} -pub type PPOLICY_DNS_DOMAIN_INFO = *mut POLICY_DNS_DOMAIN_INFO; -pub const LOOKUP_VIEW_LOCAL_INFORMATION: ::ACCESS_MASK = 0x00000001; -pub const LOOKUP_TRANSLATE_NAMES: ::ACCESS_MASK = 0x00000800; -ENUM!{enum LSA_LOOKUP_DOMAIN_INFO_CLASS { - AccountDomainInformation = 5, - DnsDomainInformation = 12, -}} -pub type PLSA_LOOKUP_DOMAIN_INFO_CLASS = *mut LSA_LOOKUP_DOMAIN_INFO_CLASS; -pub type LSA_LOOKUP_HANDLE = ::PVOID; -pub type PLSA_LOOKUP_HANDLE = *mut ::PVOID; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/macros.rs cargo-0.37.0/vendor/winapi-0.2.8/src/macros.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/macros.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/macros.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,270 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Macros to make things easier to define -macro_rules! DECLARE_HANDLE { - ($name:ident, $inner:ident) => { - #[allow(missing_copy_implementations)] pub enum $inner { } - pub type $name = *mut $inner; - }; -} -macro_rules! MAKE_HRESULT { - ($sev:expr, $fac:expr, $code:expr) => { - ($sev << 31) | ($fac << 16) | $code - } -} -macro_rules! MAKE_SCODE { - ($sev:expr, $fac:expr, $code:expr) => { - ($sev << 31) | ($fac << 16) | $code - } -} -macro_rules! HIDP_ERROR_CODES { - ($sev:expr, $code:expr) => { - ($sev << 28) | (::FACILITY_HID_ERROR_CODE << 16) | $code - } -} -macro_rules! MAKEFOURCC { - ($a:expr, $b:expr, $c:expr, $d:expr) => { - ($a as i32) | (($b as i32) << 8) | (($c as i32) << 16) | (($d as i32) << 24) - } -} -#[macro_export] -macro_rules! DEFINE_GUID { - ( - $name:ident, $l:expr, $w1:expr, $w2:expr, $b1:expr, $b2:expr, $b3:expr, $b4:expr, $b5:expr, - $b6:expr, $b7:expr, $b8:expr - ) => { - pub const $name: $crate::GUID = $crate::GUID { - Data1: $l, - Data2: $w1, - Data3: $w2, - Data4: [$b1, $b2, $b3, $b4, $b5, $b6, $b7, $b8], - }; - } -} -macro_rules! CTL_CODE { - ($DeviceType:expr, $Function:expr, $Method:expr, $Access:expr) => { - ($DeviceType << 16) | ($Access << 14) | ($Function << 2) | $Method - } -} -macro_rules! HID_CTL_CODE { - ($id:expr) => { - CTL_CODE!(::FILE_DEVICE_KEYBOARD, $id, ::METHOD_NEITHER, ::FILE_ANY_ACCESS) - } -} -macro_rules! HID_BUFFER_CTL_CODE { - ($id:expr) => { - CTL_CODE!(::FILE_DEVICE_KEYBOARD, $id, ::METHOD_BUFFERED, ::FILE_ANY_ACCESS) - } -} -macro_rules! HID_IN_CTL_CODE { - ($id:expr) => { - CTL_CODE!(::FILE_DEVICE_KEYBOARD, $id, ::METHOD_IN_DIRECT, ::FILE_ANY_ACCESS) - } -} -macro_rules! HID_OUT_CTL_CODE { - ($id:expr) => { - CTL_CODE!(::FILE_DEVICE_KEYBOARD, $id, ::METHOD_OUT_DIRECT, ::FILE_ANY_ACCESS) - } -} -macro_rules! AUDCLNT_ERR { - ($n:expr) => { - MAKE_HRESULT!(::SEVERITY_ERROR, ::FACILITY_AUDCLNT, $n) - }; -} -macro_rules! AUDCLNT_SUCCESS { - ($n:expr) => { - MAKE_SCODE!(::SEVERITY_SUCCESS, ::FACILITY_AUDCLNT, $n) - }; -} -macro_rules! BCRYPT_MAKE_INTERFACE_VERSION { - ($major:expr, $minor:expr) => { - ::BCRYPT_INTERFACE_VERSION { MajorVersion: $major, MinorVersion: $minor } - } -} -#[macro_export] -macro_rules! RIDL { - (interface $interface:ident ($vtbl:ident) - {$( - fn $method:ident(&mut self $(,$p:ident : $t:ty)*) -> $rtr:ty - ),+} - ) => { - #[repr(C)] #[allow(missing_copy_implementations)] - pub struct $vtbl { - $(pub $method: unsafe extern "system" fn( - This: *mut $interface - $(,$p: $t)* - ) -> $rtr),+ - } - #[repr(C)] #[derive(Debug)] #[allow(missing_copy_implementations)] - pub struct $interface { - pub lpVtbl: *const $vtbl - } - impl $interface { - #[inline] - $(pub unsafe fn $method(&mut self $(,$p: $t)*) -> $rtr { - ((*self.lpVtbl).$method)(self $(,$p)*) - })+ - } - }; - (interface $interface:ident ($vtbl:ident) : $pinterface:ident ($pvtbl:ident) { - }) => { - #[repr(C)] #[allow(missing_copy_implementations)] - pub struct $vtbl { - pub parent: $crate::$pvtbl - } - #[repr(C)] #[derive(Debug)] #[allow(missing_copy_implementations)] - pub struct $interface { - pub lpVtbl: *const $vtbl - } - impl ::std::ops::Deref for $interface { - type Target = $crate::$pinterface; - #[inline] - fn deref(&self) -> &$crate::$pinterface { - unsafe { ::std::mem::transmute(self) } - } - } - impl ::std::ops::DerefMut for $interface { - #[inline] - fn deref_mut(&mut self) -> &mut $crate::$pinterface { - unsafe { ::std::mem::transmute(self) } - } - } - }; - (interface $interface:ident ($vtbl:ident) : $pinterface:ident ($pvtbl:ident) - {$( - fn $method:ident(&mut self $(,$p:ident : $t:ty)*) -> $rtr:ty - ),+} - ) => { - #[repr(C)] #[allow(missing_copy_implementations)] - pub struct $vtbl { - pub parent: $crate::$pvtbl - $(,pub $method: unsafe extern "system" fn( - This: *mut $interface - $(,$p: $t)* - ) -> $rtr)+ - } - #[repr(C)] #[derive(Debug)] #[allow(missing_copy_implementations)] - pub struct $interface { - pub lpVtbl: *const $vtbl - } - impl $interface { - #[inline] - $(pub unsafe fn $method(&mut self $(,$p: $t)*) -> $rtr { - ((*self.lpVtbl).$method)(self $(,$p)*) - })+ - } - impl ::std::ops::Deref for $interface { - type Target = $crate::$pinterface; - #[inline] - fn deref(&self) -> &$crate::$pinterface { - unsafe { ::std::mem::transmute(self) } - } - } - impl ::std::ops::DerefMut for $interface { - #[inline] - fn deref_mut(&mut self) -> &mut $crate::$pinterface { - unsafe { ::std::mem::transmute(self) } - } - } - }; -} -macro_rules! UNION { - ($base:ident, $field:ident, $variant:ident, $variantmut:ident, $fieldtype:ty) => { - impl $base { - #[inline] - pub unsafe fn $variant(&self) -> &$fieldtype { - ::std::mem::transmute(&self.$field) - } - #[inline] - pub unsafe fn $variantmut(&mut self) -> &mut $fieldtype { - ::std::mem::transmute(&mut self.$field) - } - } - } -} -macro_rules! BITFIELD { - ($base:ident $field:ident: $fieldtype:ty [ - $($thing:ident $set_thing:ident[$r:expr],)+ - ]) => { - impl $base {$( - #[inline] - pub fn $thing(&self) -> $fieldtype { - let size = ::std::mem::size_of::<$fieldtype>() * 8; - self.$field << (size - $r.end) >> (size - $r.end + $r.start) - } - #[inline] - pub fn $set_thing(&mut self, val: $fieldtype) { - let mask = ((1 << ($r.end - $r.start)) - 1) << $r.start; - self.$field &= !mask; - self.$field |= (val << $r.start) & mask; - } - )+} - } -} -#[macro_export] -macro_rules! ENUM { - {enum $name:ident { $($variant:ident = $value:expr,)+ }} => { - #[repr(C)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] - pub struct $name(pub u32); - $(pub const $variant: $name = $name($value);)+ - }; - {enum $name:ident { $variant:ident = $value:expr, $($rest:tt)* }} => { - #[repr(C)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] - pub struct $name(pub u32); - pub const $variant: $name = $name($value); - ENUM!{@gen $name, $variant, $($rest)*} - }; - {enum $name:ident { $variant:ident, $($rest:tt)* }} => { - ENUM!{enum $name { $variant = 0, $($rest)* }} - }; - {@gen $name:ident, $base:ident,} => {}; - {@gen $name:ident, $base:ident, $variant:ident = $value:expr, $($rest:tt)*} => { - pub const $variant: $name = $name($value); - ENUM!{@gen $name, $variant, $($rest)*} - }; - {@gen $name:ident, $base:ident, $variant:ident, $($rest:tt)*} => { - pub const $variant: $name = $name($base.0 + 1u32); - ENUM!{@gen $name, $variant, $($rest)*} - }; -} -macro_rules! FLAGS { - {enum $name:ident { $($variant:ident = $value:expr,)+ }} => { - #[repr(C)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] - pub struct $name(pub u32); - $(pub const $variant: $name = $name($value);)+ - impl ::std::ops::BitAnd<$name> for $name { - type Output = $name; - fn bitand(self, o: $name) -> $name { $name(self.0 & o.0) } - } - impl ::std::ops::BitOr<$name> for $name { - type Output = $name; - fn bitor(self, o: $name) -> $name { $name(self.0 | o.0) } - } - impl ::std::ops::BitXor<$name> for $name { - type Output = $name; - fn bitxor(self, o: $name) -> $name { $name(self.0 ^ o.0) } - } - impl ::std::ops::Not for $name { - type Output = $name; - fn not(self) -> $name { $name(!self.0) } - } - } -} -macro_rules! STRUCT { - {$(#[$attrs:meta])* nodebug struct $name:ident { $($field:ident: $ftype:ty,)+ }} => { - #[repr(C)] $(#[$attrs])* - pub struct $name { - $(pub $field: $ftype,)+ - } - impl Copy for $name {} - impl Clone for $name { fn clone(&self) -> $name { *self } } - }; - {$(#[$attrs:meta])* struct $name:ident { $($field:ident: $ftype:ty,)+ }} => { - #[repr(C)] #[derive(Debug)] $(#[$attrs])* - pub struct $name { - $(pub $field: $ftype,)+ - } - impl Copy for $name {} - impl Clone for $name { fn clone(&self) -> $name { *self } } - }; -} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/memoryapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/memoryapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/memoryapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/memoryapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! ApiSet Contract for api-ms-win-core-memory-l1-1-0 -pub const FILE_MAP_WRITE: ::DWORD = ::SECTION_MAP_WRITE; -pub const FILE_MAP_READ: ::DWORD = ::SECTION_MAP_READ; -pub const FILE_MAP_ALL_ACCESS: ::DWORD = ::SECTION_ALL_ACCESS; -pub const FILE_MAP_EXECUTE: ::DWORD = ::SECTION_MAP_EXECUTE_EXPLICIT; -pub const FILE_MAP_COPY: ::DWORD = 0x00000001; -pub const FILE_MAP_RESERVE: ::DWORD = 0x80000000; -ENUM!{enum MEMORY_RESOURCE_NOTIFICATION_TYPE { - LowMemoryResourceNotification, - HighMemoryResourceNotification, -}} -STRUCT!{struct WIN32_MEMORY_RANGE_ENTRY { - VirtualAddress: ::PVOID, - NumberOfBytes: ::SIZE_T, -}} -pub type PWIN32_MEMORY_RANGE_ENTRY = *mut WIN32_MEMORY_RANGE_ENTRY; -pub type PBAD_MEMORY_CALLBACK_ROUTINE = Option; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/minschannel.rs cargo-0.37.0/vendor/winapi-0.2.8/src/minschannel.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/minschannel.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/minschannel.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Public Definitions for MIN SCHANNEL Security Provider - -pub const SECPKG_ATTR_ISSUER_LIST: ::DWORD = 0x50; -pub const SECPKG_ATTR_REMOTE_CRED: ::DWORD = 0x51; -pub const SECPKG_ATTR_LOCAL_CRED: ::DWORD = 0x52; -pub const SECPKG_ATTR_REMOTE_CERT_CONTEXT: ::DWORD = 0x53; -pub const SECPKG_ATTR_LOCAL_CERT_CONTEXT: ::DWORD = 0x54; -pub const SECPKG_ATTR_ROOT_STORE: ::DWORD = 0x55; -pub const SECPKG_ATTR_SUPPORTED_ALGS: ::DWORD = 0x56; -pub const SECPKG_ATTR_CIPHER_STRENGTHS: ::DWORD = 0x57; -pub const SECPKG_ATTR_SUPPORTED_PROTOCOLS: ::DWORD = 0x58; -pub const SECPKG_ATTR_ISSUER_LIST_EX: ::DWORD = 0x59; -pub const SECPKG_ATTR_CONNECTION_INFO: ::DWORD = 0x5a; -pub const SECPKG_ATTR_EAP_KEY_BLOCK: ::DWORD = 0x5b; -pub const SECPKG_ATTR_MAPPED_CRED_ATTR: ::DWORD = 0x5c; -pub const SECPKG_ATTR_SESSION_INFO: ::DWORD = 0x5d; -pub const SECPKG_ATTR_APP_DATA: ::DWORD = 0x5e; -pub const SECPKG_ATTR_REMOTE_CERTIFICATES: ::DWORD = 0x5F; -pub const SECPKG_ATTR_CLIENT_CERT_POLICY: ::DWORD = 0x60; -pub const SECPKG_ATTR_CC_POLICY_RESULT: ::DWORD = 0x61; -pub const SECPKG_ATTR_USE_NCRYPT: ::DWORD = 0x62; -pub const SECPKG_ATTR_LOCAL_CERT_INFO: ::DWORD = 0x63; -pub const SECPKG_ATTR_CIPHER_INFO: ::DWORD = 0x64; -pub const SECPKG_ATTR_EAP_PRF_INFO: ::DWORD = 0x65; -pub const SECPKG_ATTR_SUPPORTED_SIGNATURES: ::DWORD = 0x66; -pub const SECPKG_ATTR_REMOTE_CERT_CHAIN: ::DWORD = 0x67; -pub const SECPKG_ATTR_UI_INFO: ::DWORD = 0x68; -pub const SECPKG_ATTR_EARLY_START: ::DWORD = 0x69; - -STRUCT!{struct SecPkgCred_SupportedAlgs { - cSupportedAlgs: ::DWORD, - palgSupportedAlgs: ::ALG_ID, -}} - -STRUCT!{struct SecPkgCred_CipherStrengths { - dwMinimumCipherStrength: ::DWORD, - dwMaximumCipherStrength: ::DWORD, -}} - -STRUCT!{struct SecPkgCred_SupportedProtocols { - grbitProtocol: ::DWORD, -}} - -STRUCT!{struct SecPkgCred_ClientCertPolicy { - dwFlags: ::DWORD, - guidPolicyId: ::GUID, - dwCertFlags: ::DWORD, - dwUrlRetrievalTimeout: ::DWORD, - fCheckRevocationFreshnessTime: ::BOOL, - dwRevocationFreshnessTime: ::DWORD, - fOmitUsageCheck: ::BOOL, - pwszSslCtlStoreName: ::LPWSTR, - pwszSslCtlIdentifier: ::LPWSTR, -}} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/minwinbase.rs cargo-0.37.0/vendor/winapi-0.2.8/src/minwinbase.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/minwinbase.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/minwinbase.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,253 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! This module defines the 32-Bit Windows Base APIs -STRUCT!{struct SECURITY_ATTRIBUTES { - nLength: ::DWORD, - lpSecurityDescriptor: ::LPVOID, - bInheritHandle: ::BOOL, -}} -pub type PSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES; -pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES; -STRUCT!{struct OVERLAPPED { - Internal: ::ULONG_PTR, - InternalHigh: ::ULONG_PTR, - Offset: ::DWORD, - OffsetHigh: ::DWORD, - hEvent: ::HANDLE, -}} -UNION!(OVERLAPPED, Offset, Pointer, Pointer_mut, ::PVOID); -pub type LPOVERLAPPED = *mut OVERLAPPED; -STRUCT!{struct OVERLAPPED_ENTRY { - lpCompletionKey: ::ULONG_PTR, - lpOverlapped: LPOVERLAPPED, - Internal: ::ULONG_PTR, - dwNumberOfBytesTransferred: ::DWORD, -}} -pub type LPOVERLAPPED_ENTRY = *mut OVERLAPPED_ENTRY; -STRUCT!{struct SYSTEMTIME { - wYear: ::WORD, - wMonth: ::WORD, - wDayOfWeek: ::WORD, - wDay: ::WORD, - wHour: ::WORD, - wMinute: ::WORD, - wSecond: ::WORD, - wMilliseconds: ::WORD, -}} -pub type PSYSTEMTIME = *mut SYSTEMTIME; -pub type LPSYSTEMTIME = *mut SYSTEMTIME; -STRUCT!{nodebug struct WIN32_FIND_DATAA { - dwFileAttributes: ::DWORD, - ftCreationTime: ::FILETIME, - ftLastAccessTime: ::FILETIME, - ftLastWriteTime: ::FILETIME, - nFileSizeHigh: ::DWORD, - nFileSizeLow: ::DWORD, - dwReserved0: ::DWORD, - dwReserved1: ::DWORD, - cFileName: [::CHAR; ::MAX_PATH], - cAlternateFileName: [::CHAR; 14], -}} -pub type PWIN32_FIND_DATAA = *mut WIN32_FIND_DATAA; -pub type LPWIN32_FIND_DATAA = *mut WIN32_FIND_DATAA; -STRUCT!{nodebug struct WIN32_FIND_DATAW { - dwFileAttributes: ::DWORD, - ftCreationTime: ::FILETIME, - ftLastAccessTime: ::FILETIME, - ftLastWriteTime: ::FILETIME, - nFileSizeHigh: ::DWORD, - nFileSizeLow: ::DWORD, - dwReserved0: ::DWORD, - dwReserved1: ::DWORD, - cFileName: [::WCHAR; ::MAX_PATH], - cAlternateFileName: [::WCHAR; 14], -}} -pub type PWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW; -pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW; -ENUM!{enum FINDEX_INFO_LEVELS { - FindExInfoStandard, - FindExInfoBasic, - FindExInfoMaxInfoLevel, -}} -pub const FIND_FIRST_EX_CASE_SENSITIVE: ::DWORD = 0x00000001; -pub const FIND_FIRST_EX_LARGE_FETCH: ::DWORD = 0x00000002; -ENUM!{enum FINDEX_SEARCH_OPS { - FindExSearchNameMatch, - FindExSearchLimitToDirectories, - FindExSearchLimitToDevices, - FindExSearchMaxSearchOp, -}} -ENUM!{enum GET_FILEEX_INFO_LEVELS { - GetFileExInfoStandard, - GetFileExMaxInfoLevel, -}} -ENUM!{enum FILE_INFO_BY_HANDLE_CLASS { - FileBasicInfo, - FileStandardInfo, - FileNameInfo, - FileRenameInfo, - FileDispositionInfo, - FileAllocationInfo, - FileEndOfFileInfo, - FileStreamInfo, - FileCompressionInfo, - FileAttributeTagInfo, - FileIdBothDirectoryInfo, - FileIdBothDirectoryRestartInfo, - FileIoPriorityHintInfo, - FileRemoteProtocolInfo, - FileFullDirectoryInfo, - FileFullDirectoryRestartInfo, - FileStorageInfo, - FileAlignmentInfo, - FileIdInfo, - FileIdExtdDirectoryInfo, - FileIdExtdDirectoryRestartInfo, - MaximumFileInfoByHandleClass, -}} -pub type PFILE_INFO_BY_HANDLE_CLASS = *mut FILE_INFO_BY_HANDLE_CLASS; -pub type CRITICAL_SECTION = ::RTL_CRITICAL_SECTION; -pub type PCRITICAL_SECTION = ::PRTL_CRITICAL_SECTION; -pub type LPCRITICAL_SECTION = ::PRTL_CRITICAL_SECTION; -pub type CRITICAL_SECTION_DEBUG = ::RTL_CRITICAL_SECTION_DEBUG; -pub type PCRITICAL_SECTION_DEBUG = ::PRTL_CRITICAL_SECTION_DEBUG; -pub type LPCRITICAL_SECTION_DEBUG = ::PRTL_CRITICAL_SECTION_DEBUG; -pub type LPOVERLAPPED_COMPLETION_ROUTINE = Option; -pub const LOCKFILE_FAIL_IMMEDIATELY: ::DWORD = 0x00000001; -pub const LOCKFILE_EXCLUSIVE_LOCK: ::DWORD = 0x00000002; -STRUCT!{struct PROCESS_HEAP_ENTRY_Block { - hMem: ::HANDLE, - dwReserved: [::DWORD; 3], -}} -STRUCT!{struct PROCESS_HEAP_ENTRY_Region { - dwCommittedSize: ::DWORD, - dwUnCommittedSize: ::DWORD, - lpFirstBlock: ::LPVOID, - lpLastBlock: ::LPVOID, -}} -STRUCT!{struct PROCESS_HEAP_ENTRY { - lpData: ::PVOID, - cbData: ::DWORD, - cbOverhead: ::BYTE, - iRegionIndex: ::BYTE, - wFlags: ::WORD, - Region: PROCESS_HEAP_ENTRY_Region, -}} -UNION!(PROCESS_HEAP_ENTRY, Region, Block, Block_mut, PROCESS_HEAP_ENTRY_Block); -pub type LPPROCESS_HEAP_ENTRY = *mut PROCESS_HEAP_ENTRY; -pub type PPROCESS_HEAP_ENTRY = *mut PROCESS_HEAP_ENTRY; -pub const PROCESS_HEAP_REGION: ::WORD = 0x0001; -pub const PROCESS_HEAP_UNCOMMITTED_RANGE: ::WORD = 0x0002; -pub const PROCESS_HEAP_ENTRY_BUSY: ::WORD = 0x0004; -pub const PROCESS_HEAP_SEG_ALLOC: ::WORD = 0x0008; -pub const PROCESS_HEAP_ENTRY_MOVEABLE: ::WORD = 0x0010; -pub const PROCESS_HEAP_ENTRY_DDESHARE: ::WORD = 0x0020; -pub type PTHREAD_START_ROUTINE = Option ::DWORD>; -pub type LPTHREAD_START_ROUTINE = PTHREAD_START_ROUTINE; -pub type LPCONTEXT = ::PCONTEXT; -STRUCT!{struct REASON_CONTEXT_Detailed { - LocalizedReasonModule: ::HMODULE, - LocalizedReasonId: ::ULONG, - ReasonStringCount: ::ULONG, - ReasonStrings: *mut ::LPWSTR, -}} -STRUCT!{struct REASON_CONTEXT { - Version: ::ULONG, - Flags: ::DWORD, - Reason: REASON_CONTEXT_Detailed, -}} -UNION!(REASON_CONTEXT, Reason, SimpleReasonString, SimpleReasonString_mut, ::LPWSTR); -pub type PREASON_CONTEXT = *mut REASON_CONTEXT; -pub const EXCEPTION_DEBUG_EVENT: ::DWORD = 1; -pub const CREATE_THREAD_DEBUG_EVENT: ::DWORD = 2; -pub const CREATE_PROCESS_DEBUG_EVENT: ::DWORD = 3; -pub const EXIT_THREAD_DEBUG_EVENT: ::DWORD = 4; -pub const EXIT_PROCESS_DEBUG_EVENT: ::DWORD = 5; -pub const LOAD_DLL_DEBUG_EVENT: ::DWORD = 6; -pub const UNLOAD_DLL_DEBUG_EVENT: ::DWORD = 7; -pub const OUTPUT_DEBUG_STRING_EVENT: ::DWORD = 8; -pub const RIP_EVENT: ::DWORD = 9; -STRUCT!{struct EXCEPTION_DEBUG_INFO { - ExceptionRecord: ::EXCEPTION_RECORD, - dwFirstChance: ::DWORD, -}} -pub type LPEXCEPTION_DEBUG_INFO = *mut EXCEPTION_DEBUG_INFO; -STRUCT!{nodebug struct CREATE_THREAD_DEBUG_INFO { - hThread: ::HANDLE, - lpThreadLocalBase: ::LPVOID, - lpStartAddress: LPTHREAD_START_ROUTINE, -}} -pub type LPCREATE_THREAD_DEBUG_INFO = *mut CREATE_THREAD_DEBUG_INFO; -STRUCT!{nodebug struct CREATE_PROCESS_DEBUG_INFO { - hFile: ::HANDLE, - hProcess: ::HANDLE, - hThread: ::HANDLE, - lpBaseOfImage: ::LPVOID, - dwDebugInfoFileOffset: ::DWORD, - nDebugInfoSize: ::DWORD, - lpThreadLocalBase: ::LPVOID, - lpStartAddress: LPTHREAD_START_ROUTINE, - lpImageName: ::LPVOID, - fUnicode: ::WORD, -}} -pub type LPCREATE_PROCESS_DEBUG_INFO = *mut CREATE_PROCESS_DEBUG_INFO; -STRUCT!{struct EXIT_THREAD_DEBUG_INFO { - dwExitCode: ::DWORD, -}} -pub type LPEXIT_THREAD_DEBUG_INFO = *mut EXIT_THREAD_DEBUG_INFO; -STRUCT!{struct EXIT_PROCESS_DEBUG_INFO { - dwExitCode: ::DWORD, -}} -pub type LPEXIT_PROCESS_DEBUG_INFO = *mut EXIT_PROCESS_DEBUG_INFO; -STRUCT!{struct LOAD_DLL_DEBUG_INFO { - hFile: ::HANDLE, - lpBaseOfDll: ::LPVOID, - dwDebugInfoFileOffset: ::DWORD, - nDebugInfoSize: ::DWORD, - lpImageName: ::LPVOID, - fUnicode: ::WORD, -}} -pub type LPLOAD_DLL_DEBUG_INFO = *mut LOAD_DLL_DEBUG_INFO; -STRUCT!{struct UNLOAD_DLL_DEBUG_INFO { - lpBaseOfDll: ::LPVOID, -}} -pub type LPUNLOAD_DLL_DEBUG_INFO = *mut UNLOAD_DLL_DEBUG_INFO; -STRUCT!{struct OUTPUT_DEBUG_STRING_INFO { - lpDebugStringData: ::LPSTR, - fUnicode: ::WORD, - nDebugStringLength: ::WORD, -}} -pub type LPOUTPUT_DEBUG_STRING_INFO = *mut OUTPUT_DEBUG_STRING_INFO; -STRUCT!{struct RIP_INFO { - dwError: ::DWORD, - dwType: ::DWORD, -}} -pub type LPRIP_INFO = *mut RIP_INFO; -#[cfg(target_arch="x86_64")] -STRUCT!{nodebug struct DEBUG_EVENT { - dwDebugEventCode: ::DWORD, - dwProcessId: ::DWORD, - dwThreadId: ::DWORD, - u: [u8; 160], -}} -#[cfg(target_arch="x86")] -STRUCT!{nodebug struct DEBUG_EVENT { - dwDebugEventCode: ::DWORD, - dwProcessId: ::DWORD, - dwThreadId: ::DWORD, - u: [u8; 84], -}} -UNION!(DEBUG_EVENT, u, Exception, Exception_mut, EXCEPTION_DEBUG_INFO); -UNION!(DEBUG_EVENT, u, CreateThread, CreateThread_mut, CREATE_THREAD_DEBUG_INFO); -UNION!(DEBUG_EVENT, u, CreateProcessInfo, CreateProcessInfo_mut, CREATE_PROCESS_DEBUG_INFO); -UNION!(DEBUG_EVENT, u, ExitThread, ExitThread_mut, EXIT_THREAD_DEBUG_INFO); -UNION!(DEBUG_EVENT, u, ExitProcess, ExitProcess_mut, EXIT_PROCESS_DEBUG_INFO); -UNION!(DEBUG_EVENT, u, LoadDll, LoadDll_mut, LOAD_DLL_DEBUG_INFO); -UNION!(DEBUG_EVENT, u, UnloadDll, UnloadDll_mut, UNLOAD_DLL_DEBUG_INFO); -UNION!(DEBUG_EVENT, u, DebugString, DebugString_mut, OUTPUT_DEBUG_STRING_INFO); -UNION!(DEBUG_EVENT, u, RipInfo, RipInfo_mut, RIP_INFO); -pub type LPDEBUG_EVENT = *mut DEBUG_EVENT; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/minwindef.rs cargo-0.37.0/vendor/winapi-0.2.8/src/minwindef.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/minwindef.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/minwindef.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Basic Windows Type Definitions for minwin partition -pub type ULONG = ::c_ulong; -pub type PULONG = *mut ULONG; -pub type USHORT = ::c_ushort; -pub type PUSHORT = *mut USHORT; -pub type UCHAR = ::c_uchar; -pub type PUCHAR = *mut UCHAR; -pub type PSZ = *mut ::c_char; -pub const MAX_PATH: usize = 260; -pub const FALSE: BOOL = 0; -pub const TRUE: BOOL = 1; -pub type DWORD = ::c_ulong; -pub type BOOL = ::c_int; -pub type BYTE = ::c_uchar; -pub type WORD = ::c_ushort; -pub type FLOAT = ::c_float; -pub type PFLOAT = *mut FLOAT; -pub type PBOOL = *mut BOOL; -pub type LPBOOL = *mut BOOL; -pub type PBYTE = *mut BYTE; -pub type LPBYTE = *mut BYTE; -pub type PINT = *mut ::c_int; -pub type LPINT = *mut ::c_int; -pub type PWORD = *mut WORD; -pub type LPWORD = *mut WORD; -pub type LPLONG = *mut ::c_long; -pub type PDWORD = *mut DWORD; -pub type LPDWORD = *mut DWORD; -pub type LPVOID = *mut ::c_void; -pub type LPCVOID = *const ::c_void; -pub type INT = ::c_int; -pub type UINT = ::c_uint; -pub type PUINT = *mut ::c_uint; -pub type WPARAM = ::UINT_PTR; -pub type LPARAM = ::LONG_PTR; -pub type LRESULT = ::LONG_PTR; -pub fn MAKEWORD(a: BYTE, b: BYTE) -> WORD { - (a as WORD) | ((b as WORD) << 8) -} -pub fn MAKELONG(a: WORD, b: WORD) -> ::LONG { - ((a as DWORD) | ((b as DWORD) << 16)) as ::LONG -} -pub fn LOWORD(l: DWORD) -> WORD { - (l & 0xffff) as WORD -} -pub fn HIWORD(l: DWORD) -> WORD { - ((l >> 16) & 0xffff) as WORD -} -pub fn LOBYTE(l: WORD) -> BYTE { - (l & 0xff) as BYTE -} -pub fn HIBYTE(l: WORD) -> BYTE { - ((l >> 8) & 0xff) as BYTE -} -pub type SPHANDLE = *mut ::HANDLE; -pub type LPHANDLE = *mut ::HANDLE; -pub type HGLOBAL = ::HANDLE; -pub type HLOCAL = ::HANDLE; -pub type GLOBALHANDLE = ::HANDLE; -pub type LOCALHANDLE = ::HANDLE; -/// Pointer to probably a function with unknown type signature. -pub type FARPROC = *const ::c_void; -/// Pointer to probably a function with unknown type signature. -pub type NEARPROC = *const ::c_void; -/// Pointer to probably a function with unknown type signature. -pub type PROC = *const ::c_void; -pub type ATOM = WORD; -DECLARE_HANDLE!(HKEY, HKEY__); -pub type PHKEY = *mut HKEY; -DECLARE_HANDLE!(HMETAFILE, HMETAFILE__); -DECLARE_HANDLE!(HINSTANCE, HINSTANCE__); -pub type HMODULE = HINSTANCE; -DECLARE_HANDLE!(HRGN, HRGN__); -DECLARE_HANDLE!(HRSRC, HRSRC__); -DECLARE_HANDLE!(HSPRITE, HSPRITE__); -DECLARE_HANDLE!(HLSURF, HLSURF__); -DECLARE_HANDLE!(HSTR, HSTR__); -DECLARE_HANDLE!(HTASK, HTASK__); -DECLARE_HANDLE!(HWINSTA, HWINSTA__); -DECLARE_HANDLE!(HKL, HKL__); -pub type HFILE = ::c_int; -STRUCT!{struct FILETIME { - dwLowDateTime: DWORD, - dwHighDateTime: DWORD, -}} -pub type PFILETIME = *mut FILETIME; -pub type LPFILETIME = *mut FILETIME; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/mmdeviceapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/mmdeviceapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/mmdeviceapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/mmdeviceapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! this ALWAYS GENERATED file contains the definitions for the interfaces -pub const DEVICE_STATE_ACTIVE: ::DWORD = 0x00000001; -pub const DEVICE_STATE_DISABLED: ::DWORD = 0x00000002; -pub const DEVICE_STATE_NOTPRESENT: ::DWORD = 0x00000004; -pub const DEVICE_STATE_UNPLUGGED: ::DWORD = 0x00000008; -pub const DEVICE_STATEMASK_ALL: ::DWORD = 0x0000000F; -ENUM!{enum EDataFlow { - eRender, - eCapture, - eAll, - EDataFlow_enum_count, -}} -ENUM!{enum ERole { - eConsole, - eMultimedia, - eCommunications, - ERole_enum_count, -}} -DEFINE_GUID!(CLSID_MMDeviceEnumerator, 0xBCDE0395, 0xE52F, 0x467C, - 0x8E, 0x3D, 0xC4, 0x57, 0x92, 0x91, 0x69, 0x2E); -DEFINE_GUID!(IID_IMMDeviceEnumerator, 0xA95664D2, 0x9614, 0x4F35, - 0xA7, 0x46, 0xDE, 0x8D, 0xB6, 0x36, 0x17, 0xE6); -RIDL!( -interface IMMDevice(IMMDeviceVtbl): IUnknown(IUnknownVtbl) { - fn Activate( - &mut self, iid: ::REFIID, dwClsCtx: ::DWORD, pActivationParams: *mut ::PROPVARIANT, - ppInterface: *mut ::LPVOID - ) -> ::HRESULT, - fn OpenPropertyStore( - &mut self, stgmAccess: ::DWORD, ppProperties: *mut *mut ::IPropertyStore - ) -> ::HRESULT, - fn GetId(&mut self, ppstrId: *mut ::LPWSTR) -> ::HRESULT, - fn GetState(&mut self, pdwState: *mut ::DWORD) -> ::HRESULT -} -); -RIDL!( -interface IMMDeviceEnumerator(IMMDeviceEnumeratorVtbl): IUnknown(IUnknownVtbl) { - fn EnumAudioEndpoints( - &mut self, dataFlow: EDataFlow, dwStateMask: ::DWORD, - ppDevices: *mut *mut IMMDeviceCollection - ) -> ::HRESULT, - fn GetDefaultAudioEndpoint( - &mut self, dataFlow: EDataFlow, role: ERole, ppEndpoint: *mut *mut IMMDevice - ) -> ::HRESULT, - fn GetDevice(&mut self, pwstrId: ::LPCWSTR, ppDevices: *mut *mut IMMDevice) -> ::HRESULT, - fn RegisterEndpointNotificationCallback( - &mut self, pClient: *mut IMMNotificationClient - ) -> ::HRESULT, - fn UnregisterEndpointNotificationCallback( - &mut self, pClient: *mut IMMNotificationClient - ) -> ::HRESULT -} -); -RIDL!( -interface IMMDeviceCollection(IMMDeviceCollectionVtbl): IUnknown(IUnknownVtbl) { - fn GetCount(&mut self, pcDevices: *const ::UINT) -> ::HRESULT, - fn Item(&mut self, nDevice: ::UINT, ppDevice: *mut *mut IMMDevice) -> ::HRESULT -} -); -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IMMNotificationClient; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/mmreg.rs cargo-0.37.0/vendor/winapi-0.2.8/src/mmreg.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/mmreg.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/mmreg.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,304 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -pub const WAVE_FORMAT_UNKNOWN: ::WORD = 0x0000; -pub const WAVE_FORMAT_PCM: ::WORD = 0x0001; -pub const WAVE_FORMAT_ADPCM: ::WORD = 0x0002; -pub const WAVE_FORMAT_IEEE_FLOAT: ::WORD = 0x0003; -pub const WAVE_FORMAT_VSELP: ::WORD = 0x0004; -pub const WAVE_FORMAT_IBM_CVSD: ::WORD = 0x0005; -pub const WAVE_FORMAT_ALAW: ::WORD = 0x0006; -pub const WAVE_FORMAT_MULAW: ::WORD = 0x0007; -pub const WAVE_FORMAT_DTS: ::WORD = 0x0008; -pub const WAVE_FORMAT_DRM: ::WORD = 0x0009; -pub const WAVE_FORMAT_WMAVOICE9: ::WORD = 0x000A; -pub const WAVE_FORMAT_WMAVOICE10: ::WORD = 0x000B; -pub const WAVE_FORMAT_OKI_ADPCM: ::WORD = 0x0010; -pub const WAVE_FORMAT_DVI_ADPCM: ::WORD = 0x0011; -pub const WAVE_FORMAT_IMA_ADPCM: ::WORD = WAVE_FORMAT_DVI_ADPCM; -pub const WAVE_FORMAT_MEDIASPACE_ADPCM: ::WORD = 0x0012; -pub const WAVE_FORMAT_SIERRA_ADPCM: ::WORD = 0x0013; -pub const WAVE_FORMAT_G723_ADPCM: ::WORD = 0x0014; -pub const WAVE_FORMAT_DIGISTD: ::WORD = 0x0015; -pub const WAVE_FORMAT_DIGIFIX: ::WORD = 0x0016; -pub const WAVE_FORMAT_DIALOGIC_OKI_ADPCM: ::WORD = 0x0017; -pub const WAVE_FORMAT_MEDIAVISION_ADPCM: ::WORD = 0x0018; -pub const WAVE_FORMAT_CU_CODEC: ::WORD = 0x0019; -pub const WAVE_FORMAT_HP_DYN_VOICE: ::WORD = 0x001A; -pub const WAVE_FORMAT_YAMAHA_ADPCM: ::WORD = 0x0020; -pub const WAVE_FORMAT_SONARC: ::WORD = 0x0021; -pub const WAVE_FORMAT_DSPGROUP_TRUESPEECH: ::WORD = 0x0022; -pub const WAVE_FORMAT_ECHOSC1: ::WORD = 0x0023; -pub const WAVE_FORMAT_AUDIOFILE_AF36: ::WORD = 0x0024; -pub const WAVE_FORMAT_APTX: ::WORD = 0x0025; -pub const WAVE_FORMAT_AUDIOFILE_AF10: ::WORD = 0x0026; -pub const WAVE_FORMAT_PROSODY_1612: ::WORD = 0x0027; -pub const WAVE_FORMAT_LRC: ::WORD = 0x0028; -pub const WAVE_FORMAT_DOLBY_AC2: ::WORD = 0x0030; -pub const WAVE_FORMAT_GSM610: ::WORD = 0x0031; -pub const WAVE_FORMAT_MSNAUDIO: ::WORD = 0x0032; -pub const WAVE_FORMAT_ANTEX_ADPCME: ::WORD = 0x0033; -pub const WAVE_FORMAT_CONTROL_RES_VQLPC: ::WORD = 0x0034; -pub const WAVE_FORMAT_DIGIREAL: ::WORD = 0x0035; -pub const WAVE_FORMAT_DIGIADPCM: ::WORD = 0x0036; -pub const WAVE_FORMAT_CONTROL_RES_CR10: ::WORD = 0x0037; -pub const WAVE_FORMAT_NMS_VBXADPCM: ::WORD = 0x0038; -pub const WAVE_FORMAT_CS_IMAADPCM: ::WORD = 0x0039; -pub const WAVE_FORMAT_ECHOSC3: ::WORD = 0x003A; -pub const WAVE_FORMAT_ROCKWELL_ADPCM: ::WORD = 0x003B; -pub const WAVE_FORMAT_ROCKWELL_DIGITALK: ::WORD = 0x003C; -pub const WAVE_FORMAT_XEBEC: ::WORD = 0x003D; -pub const WAVE_FORMAT_G721_ADPCM: ::WORD = 0x0040; -pub const WAVE_FORMAT_G728_CELP: ::WORD = 0x0041; -pub const WAVE_FORMAT_MSG723: ::WORD = 0x0042; -pub const WAVE_FORMAT_INTEL_G723_1: ::WORD = 0x0043; -pub const WAVE_FORMAT_INTEL_G729: ::WORD = 0x0044; -pub const WAVE_FORMAT_SHARP_G726: ::WORD = 0x0045; -pub const WAVE_FORMAT_MPEG: ::WORD = 0x0050; -pub const WAVE_FORMAT_RT24: ::WORD = 0x0052; -pub const WAVE_FORMAT_PAC: ::WORD = 0x0053; -pub const WAVE_FORMAT_MPEGLAYER3: ::WORD = 0x0055; -pub const WAVE_FORMAT_LUCENT_G723: ::WORD = 0x0059; -pub const WAVE_FORMAT_CIRRUS: ::WORD = 0x0060; -pub const WAVE_FORMAT_ESPCM: ::WORD = 0x0061; -pub const WAVE_FORMAT_VOXWARE: ::WORD = 0x0062; -pub const WAVE_FORMAT_CANOPUS_ATRAC: ::WORD = 0x0063; -pub const WAVE_FORMAT_G726_ADPCM: ::WORD = 0x0064; -pub const WAVE_FORMAT_G722_ADPCM: ::WORD = 0x0065; -pub const WAVE_FORMAT_DSAT: ::WORD = 0x0066; -pub const WAVE_FORMAT_DSAT_DISPLAY: ::WORD = 0x0067; -pub const WAVE_FORMAT_VOXWARE_BYTE_ALIGNED: ::WORD = 0x0069; -pub const WAVE_FORMAT_VOXWARE_AC8: ::WORD = 0x0070; -pub const WAVE_FORMAT_VOXWARE_AC10: ::WORD = 0x0071; -pub const WAVE_FORMAT_VOXWARE_AC16: ::WORD = 0x0072; -pub const WAVE_FORMAT_VOXWARE_AC20: ::WORD = 0x0073; -pub const WAVE_FORMAT_VOXWARE_RT24: ::WORD = 0x0074; -pub const WAVE_FORMAT_VOXWARE_RT29: ::WORD = 0x0075; -pub const WAVE_FORMAT_VOXWARE_RT29HW: ::WORD = 0x0076; -pub const WAVE_FORMAT_VOXWARE_VR12: ::WORD = 0x0077; -pub const WAVE_FORMAT_VOXWARE_VR18: ::WORD = 0x0078; -pub const WAVE_FORMAT_VOXWARE_TQ40: ::WORD = 0x0079; -pub const WAVE_FORMAT_VOXWARE_SC3: ::WORD = 0x007A; -pub const WAVE_FORMAT_VOXWARE_SC3_1: ::WORD = 0x007B; -pub const WAVE_FORMAT_SOFTSOUND: ::WORD = 0x0080; -pub const WAVE_FORMAT_VOXWARE_TQ60: ::WORD = 0x0081; -pub const WAVE_FORMAT_MSRT24: ::WORD = 0x0082; -pub const WAVE_FORMAT_G729A: ::WORD = 0x0083; -pub const WAVE_FORMAT_MVI_MVI2: ::WORD = 0x0084; -pub const WAVE_FORMAT_DF_G726: ::WORD = 0x0085; -pub const WAVE_FORMAT_DF_GSM610: ::WORD = 0x0086; -pub const WAVE_FORMAT_ISIAUDIO: ::WORD = 0x0088; -pub const WAVE_FORMAT_ONLIVE: ::WORD = 0x0089; -pub const WAVE_FORMAT_MULTITUDE_FT_SX20: ::WORD = 0x008A; -pub const WAVE_FORMAT_INFOCOM_ITS_G721_ADPCM: ::WORD = 0x008B; -pub const WAVE_FORMAT_CONVEDIA_G729: ::WORD = 0x008C; -pub const WAVE_FORMAT_CONGRUENCY: ::WORD = 0x008D; -pub const WAVE_FORMAT_SBC24: ::WORD = 0x0091; -pub const WAVE_FORMAT_DOLBY_AC3_SPDIF: ::WORD = 0x0092; -pub const WAVE_FORMAT_MEDIASONIC_G723: ::WORD = 0x0093; -pub const WAVE_FORMAT_PROSODY_8KBPS: ::WORD = 0x0094; -pub const WAVE_FORMAT_ZYXEL_ADPCM: ::WORD = 0x0097; -pub const WAVE_FORMAT_PHILIPS_LPCBB: ::WORD = 0x0098; -pub const WAVE_FORMAT_PACKED: ::WORD = 0x0099; -pub const WAVE_FORMAT_MALDEN_PHONYTALK: ::WORD = 0x00A0; -pub const WAVE_FORMAT_RACAL_RECORDER_GSM: ::WORD = 0x00A1; -pub const WAVE_FORMAT_RACAL_RECORDER_G720_A: ::WORD = 0x00A2; -pub const WAVE_FORMAT_RACAL_RECORDER_G723_1: ::WORD = 0x00A3; -pub const WAVE_FORMAT_RACAL_RECORDER_TETRA_ACELP: ::WORD = 0x00A4; -pub const WAVE_FORMAT_NEC_AAC: ::WORD = 0x00B0; -pub const WAVE_FORMAT_RAW_AAC1: ::WORD = 0x00FF; -pub const WAVE_FORMAT_RHETOREX_ADPCM: ::WORD = 0x0100; -pub const WAVE_FORMAT_IRAT: ::WORD = 0x0101; -pub const WAVE_FORMAT_VIVO_G723: ::WORD = 0x0111; -pub const WAVE_FORMAT_VIVO_SIREN: ::WORD = 0x0112; -pub const WAVE_FORMAT_PHILIPS_CELP: ::WORD = 0x0120; -pub const WAVE_FORMAT_PHILIPS_GRUNDIG: ::WORD = 0x0121; -pub const WAVE_FORMAT_DIGITAL_G723: ::WORD = 0x0123; -pub const WAVE_FORMAT_SANYO_LD_ADPCM: ::WORD = 0x0125; -pub const WAVE_FORMAT_SIPROLAB_ACEPLNET: ::WORD = 0x0130; -pub const WAVE_FORMAT_SIPROLAB_ACELP4800: ::WORD = 0x0131; -pub const WAVE_FORMAT_SIPROLAB_ACELP8V3: ::WORD = 0x0132; -pub const WAVE_FORMAT_SIPROLAB_G729: ::WORD = 0x0133; -pub const WAVE_FORMAT_SIPROLAB_G729A: ::WORD = 0x0134; -pub const WAVE_FORMAT_SIPROLAB_KELVIN: ::WORD = 0x0135; -pub const WAVE_FORMAT_VOICEAGE_AMR: ::WORD = 0x0136; -pub const WAVE_FORMAT_G726ADPCM: ::WORD = 0x0140; -pub const WAVE_FORMAT_DICTAPHONE_CELP68: ::WORD = 0x0141; -pub const WAVE_FORMAT_DICTAPHONE_CELP54: ::WORD = 0x0142; -pub const WAVE_FORMAT_QUALCOMM_PUREVOICE: ::WORD = 0x0150; -pub const WAVE_FORMAT_QUALCOMM_HALFRATE: ::WORD = 0x0151; -pub const WAVE_FORMAT_TUBGSM: ::WORD = 0x0155; -pub const WAVE_FORMAT_MSAUDIO1: ::WORD = 0x0160; -pub const WAVE_FORMAT_WMAUDIO2: ::WORD = 0x0161; -pub const WAVE_FORMAT_WMAUDIO3: ::WORD = 0x0162; -pub const WAVE_FORMAT_WMAUDIO_LOSSLESS: ::WORD = 0x0163; -pub const WAVE_FORMAT_WMASPDIF: ::WORD = 0x0164; -pub const WAVE_FORMAT_UNISYS_NAP_ADPCM: ::WORD = 0x0170; -pub const WAVE_FORMAT_UNISYS_NAP_ULAW: ::WORD = 0x0171; -pub const WAVE_FORMAT_UNISYS_NAP_ALAW: ::WORD = 0x0172; -pub const WAVE_FORMAT_UNISYS_NAP_16K: ::WORD = 0x0173; -pub const WAVE_FORMAT_SYCOM_ACM_SYC008: ::WORD = 0x0174; -pub const WAVE_FORMAT_SYCOM_ACM_SYC701_G726L: ::WORD = 0x0175; -pub const WAVE_FORMAT_SYCOM_ACM_SYC701_CELP54: ::WORD = 0x0176; -pub const WAVE_FORMAT_SYCOM_ACM_SYC701_CELP68: ::WORD = 0x0177; -pub const WAVE_FORMAT_KNOWLEDGE_ADVENTURE_ADPCM: ::WORD = 0x0178; -pub const WAVE_FORMAT_FRAUNHOFER_IIS_MPEG2_AAC: ::WORD = 0x0180; -pub const WAVE_FORMAT_DTS_DS: ::WORD = 0x0190; -pub const WAVE_FORMAT_CREATIVE_ADPCM: ::WORD = 0x0200; -pub const WAVE_FORMAT_CREATIVE_FASTSPEECH8: ::WORD = 0x0202; -pub const WAVE_FORMAT_CREATIVE_FASTSPEECH10: ::WORD = 0x0203; -pub const WAVE_FORMAT_UHER_ADPCM: ::WORD = 0x0210; -pub const WAVE_FORMAT_ULEAD_DV_AUDIO: ::WORD = 0x0215; -pub const WAVE_FORMAT_ULEAD_DV_AUDIO_1: ::WORD = 0x0216; -pub const WAVE_FORMAT_QUARTERDECK: ::WORD = 0x0220; -pub const WAVE_FORMAT_ILINK_VC: ::WORD = 0x0230; -pub const WAVE_FORMAT_RAW_SPORT: ::WORD = 0x0240; -pub const WAVE_FORMAT_ESST_AC3: ::WORD = 0x0241; -pub const WAVE_FORMAT_GENERIC_PASSTHRU: ::WORD = 0x0249; -pub const WAVE_FORMAT_IPI_HSX: ::WORD = 0x0250; -pub const WAVE_FORMAT_IPI_RPELP: ::WORD = 0x0251; -pub const WAVE_FORMAT_CS2: ::WORD = 0x0260; -pub const WAVE_FORMAT_SONY_SCX: ::WORD = 0x0270; -pub const WAVE_FORMAT_SONY_SCY: ::WORD = 0x0271; -pub const WAVE_FORMAT_SONY_ATRAC3: ::WORD = 0x0272; -pub const WAVE_FORMAT_SONY_SPC: ::WORD = 0x0273; -pub const WAVE_FORMAT_TELUM_AUDIO: ::WORD = 0x0280; -pub const WAVE_FORMAT_TELUM_IA_AUDIO: ::WORD = 0x0281; -pub const WAVE_FORMAT_NORCOM_VOICE_SYSTEMS_ADPCM: ::WORD = 0x0285; -pub const WAVE_FORMAT_FM_TOWNS_SND: ::WORD = 0x0300; -pub const WAVE_FORMAT_MICRONAS: ::WORD = 0x0350; -pub const WAVE_FORMAT_MICRONAS_CELP833: ::WORD = 0x0351; -pub const WAVE_FORMAT_BTV_DIGITAL: ::WORD = 0x0400; -pub const WAVE_FORMAT_INTEL_MUSIC_CODER: ::WORD = 0x0401; -pub const WAVE_FORMAT_INDEO_AUDIO: ::WORD = 0x0402; -pub const WAVE_FORMAT_QDESIGN_MUSIC: ::WORD = 0x0450; -pub const WAVE_FORMAT_ON2_VP7_AUDIO: ::WORD = 0x0500; -pub const WAVE_FORMAT_ON2_VP6_AUDIO: ::WORD = 0x0501; -pub const WAVE_FORMAT_VME_VMPCM: ::WORD = 0x0680; -pub const WAVE_FORMAT_TPC: ::WORD = 0x0681; -pub const WAVE_FORMAT_LIGHTWAVE_LOSSLESS: ::WORD = 0x08AE; -pub const WAVE_FORMAT_OLIGSM: ::WORD = 0x1000; -pub const WAVE_FORMAT_OLIADPCM: ::WORD = 0x1001; -pub const WAVE_FORMAT_OLICELP: ::WORD = 0x1002; -pub const WAVE_FORMAT_OLISBC: ::WORD = 0x1003; -pub const WAVE_FORMAT_OLIOPR: ::WORD = 0x1004; -pub const WAVE_FORMAT_LH_CODEC: ::WORD = 0x1100; -pub const WAVE_FORMAT_LH_CODEC_CELP: ::WORD = 0x1101; -pub const WAVE_FORMAT_LH_CODEC_SBC8: ::WORD = 0x1102; -pub const WAVE_FORMAT_LH_CODEC_SBC12: ::WORD = 0x1103; -pub const WAVE_FORMAT_LH_CODEC_SBC16: ::WORD = 0x1104; -pub const WAVE_FORMAT_NORRIS: ::WORD = 0x1400; -pub const WAVE_FORMAT_ISIAUDIO_2: ::WORD = 0x1401; -pub const WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS: ::WORD = 0x1500; -pub const WAVE_FORMAT_MPEG_ADTS_AAC: ::WORD = 0x1600; -pub const WAVE_FORMAT_MPEG_RAW_AAC: ::WORD = 0x1601; -pub const WAVE_FORMAT_MPEG_LOAS: ::WORD = 0x1602; -pub const WAVE_FORMAT_NOKIA_MPEG_ADTS_AAC: ::WORD = 0x1608; -pub const WAVE_FORMAT_NOKIA_MPEG_RAW_AAC: ::WORD = 0x1609; -pub const WAVE_FORMAT_VODAFONE_MPEG_ADTS_AAC: ::WORD = 0x160A; -pub const WAVE_FORMAT_VODAFONE_MPEG_RAW_AAC: ::WORD = 0x160B; -pub const WAVE_FORMAT_MPEG_HEAAC: ::WORD = 0x1610; -pub const WAVE_FORMAT_VOXWARE_RT24_SPEECH: ::WORD = 0x181C; -pub const WAVE_FORMAT_SONICFOUNDRY_LOSSLESS: ::WORD = 0x1971; -pub const WAVE_FORMAT_INNINGS_TELECOM_ADPCM: ::WORD = 0x1979; -pub const WAVE_FORMAT_LUCENT_SX8300P: ::WORD = 0x1C07; -pub const WAVE_FORMAT_LUCENT_SX5363S: ::WORD = 0x1C0C; -pub const WAVE_FORMAT_CUSEEME: ::WORD = 0x1F03; -pub const WAVE_FORMAT_NTCSOFT_ALF2CM_ACM: ::WORD = 0x1FC4; -pub const WAVE_FORMAT_DVM: ::WORD = 0x2000; -pub const WAVE_FORMAT_DTS2: ::WORD = 0x2001; -pub const WAVE_FORMAT_MAKEAVIS: ::WORD = 0x3313; -pub const WAVE_FORMAT_DIVIO_MPEG4_AAC: ::WORD = 0x4143; -pub const WAVE_FORMAT_NOKIA_ADAPTIVE_MULTIRATE: ::WORD = 0x4201; -pub const WAVE_FORMAT_DIVIO_G726: ::WORD = 0x4243; -pub const WAVE_FORMAT_LEAD_SPEECH: ::WORD = 0x434C; -pub const WAVE_FORMAT_LEAD_VORBIS: ::WORD = 0x564C; -pub const WAVE_FORMAT_WAVPACK_AUDIO: ::WORD = 0x5756; -pub const WAVE_FORMAT_OGG_VORBIS_MODE_1: ::WORD = 0x674F; -pub const WAVE_FORMAT_OGG_VORBIS_MODE_2: ::WORD = 0x6750; -pub const WAVE_FORMAT_OGG_VORBIS_MODE_3: ::WORD = 0x6751; -pub const WAVE_FORMAT_OGG_VORBIS_MODE_1_PLUS: ::WORD = 0x676F; -pub const WAVE_FORMAT_OGG_VORBIS_MODE_2_PLUS: ::WORD = 0x6770; -pub const WAVE_FORMAT_OGG_VORBIS_MODE_3_PLUS: ::WORD = 0x6771; -pub const WAVE_FORMAT_3COM_NBX: ::WORD = 0x7000; -pub const WAVE_FORMAT_FAAD_AAC: ::WORD = 0x706D; -pub const WAVE_FORMAT_AMR_NB: ::WORD = 0x7361; -pub const WAVE_FORMAT_AMR_WB: ::WORD = 0x7362; -pub const WAVE_FORMAT_AMR_WP: ::WORD = 0x7363; -pub const WAVE_FORMAT_GSM_AMR_CBR: ::WORD = 0x7A21; -pub const WAVE_FORMAT_GSM_AMR_VBR_SID: ::WORD = 0x7A22; -pub const WAVE_FORMAT_COMVERSE_INFOSYS_G723_1: ::WORD = 0xA100; -pub const WAVE_FORMAT_COMVERSE_INFOSYS_AVQSBC: ::WORD = 0xA101; -pub const WAVE_FORMAT_COMVERSE_INFOSYS_SBC: ::WORD = 0xA102; -pub const WAVE_FORMAT_SYMBOL_G729_A: ::WORD = 0xA103; -pub const WAVE_FORMAT_VOICEAGE_AMR_WB: ::WORD = 0xA104; -pub const WAVE_FORMAT_INGENIENT_G726: ::WORD = 0xA105; -pub const WAVE_FORMAT_MPEG4_AAC: ::WORD = 0xA106; -pub const WAVE_FORMAT_ENCORE_G726: ::WORD = 0xA107; -pub const WAVE_FORMAT_ZOLL_ASAO: ::WORD = 0xA108; -pub const WAVE_FORMAT_SPEEX_VOICE: ::WORD = 0xA109; -pub const WAVE_FORMAT_VIANIX_MASC: ::WORD = 0xA10A; -pub const WAVE_FORMAT_WM9_SPECTRUM_ANALYZER: ::WORD = 0xA10B; -pub const WAVE_FORMAT_WMF_SPECTRUM_ANAYZER: ::WORD = 0xA10C; -pub const WAVE_FORMAT_GSM_610: ::WORD = 0xA10D; -pub const WAVE_FORMAT_GSM_620: ::WORD = 0xA10E; -pub const WAVE_FORMAT_GSM_660: ::WORD = 0xA10F; -pub const WAVE_FORMAT_GSM_690: ::WORD = 0xA110; -pub const WAVE_FORMAT_GSM_ADAPTIVE_MULTIRATE_WB: ::WORD = 0xA111; -pub const WAVE_FORMAT_POLYCOM_G722: ::WORD = 0xA112; -pub const WAVE_FORMAT_POLYCOM_G728: ::WORD = 0xA113; -pub const WAVE_FORMAT_POLYCOM_G729_A: ::WORD = 0xA114; -pub const WAVE_FORMAT_POLYCOM_SIREN: ::WORD = 0xA115; -pub const WAVE_FORMAT_GLOBAL_IP_ILBC: ::WORD = 0xA116; -pub const WAVE_FORMAT_RADIOTIME_TIME_SHIFT_RADIO: ::WORD = 0xA117; -pub const WAVE_FORMAT_NICE_ACA: ::WORD = 0xA118; -pub const WAVE_FORMAT_NICE_ADPCM: ::WORD = 0xA119; -pub const WAVE_FORMAT_VOCORD_G721: ::WORD = 0xA11A; -pub const WAVE_FORMAT_VOCORD_G726: ::WORD = 0xA11B; -pub const WAVE_FORMAT_VOCORD_G722_1: ::WORD = 0xA11C; -pub const WAVE_FORMAT_VOCORD_G728: ::WORD = 0xA11D; -pub const WAVE_FORMAT_VOCORD_G729: ::WORD = 0xA11E; -pub const WAVE_FORMAT_VOCORD_G729_A: ::WORD = 0xA11F; -pub const WAVE_FORMAT_VOCORD_G723_1: ::WORD = 0xA120; -pub const WAVE_FORMAT_VOCORD_LBC: ::WORD = 0xA121; -pub const WAVE_FORMAT_NICE_G728: ::WORD = 0xA122; -pub const WAVE_FORMAT_FRACE_TELECOM_G729: ::WORD = 0xA123; -pub const WAVE_FORMAT_CODIAN: ::WORD = 0xA124; -pub const WAVE_FORMAT_FLAC: ::WORD = 0xF1AC; -pub const WAVE_FORMAT_EXTENSIBLE: ::WORD = 0xFFFE; -pub const WAVE_FORMAT_DEVELOPMENT: ::WORD = 0xFFFF; -//2557 -pub const SPEAKER_FRONT_LEFT: ::DWORD = 0x1; -pub const SPEAKER_FRONT_RIGHT: ::DWORD = 0x2; -pub const SPEAKER_FRONT_CENTER: ::DWORD = 0x4; -pub const SPEAKER_LOW_FREQUENCY: ::DWORD = 0x8; -pub const SPEAKER_BACK_LEFT: ::DWORD = 0x10; -pub const SPEAKER_BACK_RIGHT: ::DWORD = 0x20; -pub const SPEAKER_FRONT_LEFT_OF_CENTER: ::DWORD = 0x40; -pub const SPEAKER_FRONT_RIGHT_OF_CENTER: ::DWORD = 0x80; -pub const SPEAKER_BACK_CENTER: ::DWORD = 0x100; -pub const SPEAKER_SIDE_LEFT: ::DWORD = 0x200; -pub const SPEAKER_SIDE_RIGHT: ::DWORD = 0x400; -pub const SPEAKER_TOP_CENTER: ::DWORD = 0x800; -pub const SPEAKER_TOP_FRONT_LEFT: ::DWORD = 0x1000; -pub const SPEAKER_TOP_FRONT_CENTER: ::DWORD = 0x2000; -pub const SPEAKER_TOP_FRONT_RIGHT: ::DWORD = 0x4000; -pub const SPEAKER_TOP_BACK_LEFT: ::DWORD = 0x8000; -pub const SPEAKER_TOP_BACK_CENTER: ::DWORD = 0x10000; -pub const SPEAKER_TOP_BACK_RIGHT: ::DWORD = 0x20000; -pub const SPEAKER_RESERVED: ::DWORD = 0x7FFC0000; -pub const SPEAKER_ALL: ::DWORD = 0x80000000; -STRUCT!{#[repr(packed)] struct WAVEFORMATEX { - wFormatTag: ::WORD, - nChannels: ::WORD, - nSamplesPerSec: ::DWORD, - nAvgBytesPerSec: ::DWORD, - nBlockAlign: ::WORD, - wBitsPerSample: ::WORD, - cbSize: ::WORD, -}} -STRUCT!{#[repr(packed)] struct WAVEFORMATEXTENSIBLE { - Format: ::WAVEFORMATEX, - Samples: ::WORD, - dwChannelMask: ::DWORD, - SubFormat: ::GUID, -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/mmsystem.rs cargo-0.37.0/vendor/winapi-0.2.8/src/mmsystem.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/mmsystem.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/mmsystem.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,259 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! MM procedure declarations, constant definitions and macros -//109 (Win 7 SDK) -pub type MMVERSION = ::UINT; -pub type MMRESULT = ::UINT; -STRUCT!{struct MMTIME { - wType: ::UINT, - u: MMTIME_u, -}} -pub type PMMTIME = *mut MMTIME; -pub type NPMMTIME = *mut MMTIME; -pub type LPMMTIME = *mut MMTIME; -STRUCT!{struct MMTIME_u { - data: [u8; 8], -}} -UNION!(MMTIME_u, data, ms, ms_mut, ::DWORD); -UNION!(MMTIME_u, data, sample, sample_mut, ::DWORD); -UNION!(MMTIME_u, data, cb, cb_mut, ::DWORD); -UNION!(MMTIME_u, data, ticks, ticks_mut, ::DWORD); -UNION!(MMTIME_u, data, smpte, smpte_mut, MMTIME_smpte); -UNION!(MMTIME_u, data, midi, midi_mut, MMTIME_midi); -STRUCT!{struct MMTIME_smpte { - hour: ::BYTE, - min: ::BYTE, - sec: ::BYTE, - frame: ::BYTE, - fps: ::BYTE, - dummy: ::BYTE, - pad: [::BYTE; 2], -}} -STRUCT!{struct MMTIME_midi { - songptrpos: ::DWORD, -}} -pub const TIME_MS: ::UINT = 0x0001; -pub const TIME_SAMPLES: ::UINT = 0x0002; -pub const TIME_BYTES: ::UINT = 0x0004; -pub const TIME_SMPTE: ::UINT = 0x0008; -pub const TIME_MIDI: ::UINT = 0x0010; -pub const TIME_TICKS: ::UINT = 0x0020; -pub const MM_JOY1MOVE: ::UINT = 0x3A0; -pub const MM_JOY2MOVE: ::UINT = 0x3A1; -pub const MM_JOY1ZMOVE: ::UINT = 0x3A2; -pub const MM_JOY2ZMOVE: ::UINT = 0x3A3; -pub const MM_JOY1BUTTONDOWN: ::UINT = 0x3B5; -pub const MM_JOY2BUTTONDOWN: ::UINT = 0x3B6; -pub const MM_JOY1BUTTONUP: ::UINT = 0x3B7; -pub const MM_JOY2BUTTONUP: ::UINT = 0x3B8; -pub const MM_MCINOTIFY: ::UINT = 0x3B9; -pub const MM_WOM_OPEN: ::UINT = 0x3BB; -pub const MM_WOM_CLOSE: ::UINT = 0x3BC; -pub const MM_WOM_DONE: ::UINT = 0x3BD; -pub const MM_WIM_OPEN: ::UINT = 0x3BE; -pub const MM_WIM_CLOSE: ::UINT = 0x3BF; -pub const MM_WIM_DATA: ::UINT = 0x3C0; -pub const MM_MIM_OPEN: ::UINT = 0x3C1; -pub const MM_MIM_CLOSE: ::UINT = 0x3C2; -pub const MM_MIM_DATA: ::UINT = 0x3C3; -pub const MM_MIM_LONGDATA: ::UINT = 0x3C4; -pub const MM_MIM_ERROR: ::UINT = 0x3C5; -pub const MM_MIM_LONGERROR: ::UINT = 0x3C6; -pub const MM_MOM_OPEN: ::UINT = 0x3C7; -pub const MM_MOM_CLOSE: ::UINT = 0x3C8; -pub const MM_MOM_DONE: ::UINT = 0x3C9; -pub const MMSYSERR_BASE: MMRESULT = 0; -pub const WAVERR_BASE: MMRESULT = 32; -pub const MIDIERR_BASE: MMRESULT = 64; -pub const TIMERR_BASE: MMRESULT = 96; -pub const JOYERR_BASE: MMRESULT = 160; -pub const MCIERR_BASE: MMRESULT = 256; -pub const MIXERR_BASE: MMRESULT = 1024; -pub const MMSYSERR_NOERROR: MMRESULT = 0; -pub const MMSYSERR_ERROR: MMRESULT = MMSYSERR_BASE + 1; -pub const MMSYSERR_BADDEVICEID: MMRESULT = MMSYSERR_BASE + 2; -pub const MMSYSERR_NOTENABLED: MMRESULT = MMSYSERR_BASE + 3; -pub const MMSYSERR_ALLOCATED: MMRESULT = MMSYSERR_BASE + 4; -pub const MMSYSERR_INVALHANDLE: MMRESULT = MMSYSERR_BASE + 5; -pub const MMSYSERR_NODRIVER: MMRESULT = MMSYSERR_BASE + 6; -pub const MMSYSERR_NOMEM: MMRESULT = MMSYSERR_BASE + 7; -pub const MMSYSERR_NOTSUPPORTED: MMRESULT = MMSYSERR_BASE + 8; -pub const MMSYSERR_BADERRNUM: MMRESULT = MMSYSERR_BASE + 9; -pub const MMSYSERR_INVALFLAG: MMRESULT = MMSYSERR_BASE + 10; -pub const MMSYSERR_INVALPARAM: MMRESULT = MMSYSERR_BASE + 11; -pub const MMSYSERR_HANDLEBUSY: MMRESULT = MMSYSERR_BASE + 12; -pub const MMSYSERR_INVALIDALIAS: MMRESULT = MMSYSERR_BASE + 13; -pub const MMSYSERR_BADDB: MMRESULT = MMSYSERR_BASE + 14; -pub const MMSYSERR_KEYNOTFOUND: MMRESULT = MMSYSERR_BASE + 15; -pub const MMSYSERR_READERROR: MMRESULT = MMSYSERR_BASE + 16; -pub const MMSYSERR_WRITEERROR: MMRESULT = MMSYSERR_BASE + 17; -pub const MMSYSERR_DELETEERROR: MMRESULT = MMSYSERR_BASE + 18; -pub const MMSYSERR_VALNOTFOUND: MMRESULT = MMSYSERR_BASE + 19; -pub const MMSYSERR_NODRIVERCB: MMRESULT = MMSYSERR_BASE + 20; -pub const MMSYSERR_MOREDATA: MMRESULT = MMSYSERR_BASE + 21; -pub const MMSYSERR_LASTERROR: MMRESULT = MMSYSERR_BASE + 21; -pub const MIDIERR_UNPREPARED: MMRESULT = MIDIERR_BASE + 0; -pub const MIDIERR_STILLPLAYING: MMRESULT = MIDIERR_BASE + 1; -pub const MIDIERR_NOMAP: MMRESULT = MIDIERR_BASE + 2; -pub const MIDIERR_NOTREADY: MMRESULT = MIDIERR_BASE + 3; -pub const MIDIERR_NODEVICE: MMRESULT = MIDIERR_BASE + 4; -pub const MIDIERR_INVALIDSETUP: MMRESULT = MIDIERR_BASE + 5; -pub const MIDIERR_BADOPENMODE: MMRESULT = MIDIERR_BASE + 6; -pub const MIDIERR_DONT_CONTINUE: MMRESULT = MIDIERR_BASE + 7; -pub const MIDIERR_LASTERROR: MMRESULT = MIDIERR_BASE + 7; -pub const CALLBACK_TYPEMASK: ::DWORD = 0x00070000; -pub const CALLBACK_NULL: ::DWORD = 0x00000000; -pub const CALLBACK_WINDOW: ::DWORD = 0x00010000; -pub const CALLBACK_TASK: ::DWORD = 0x00020000; -pub const CALLBACK_FUNCTION: ::DWORD = 0x00030000; -pub const CALLBACK_THREAD: ::DWORD = CALLBACK_TASK; -pub const CALLBACK_EVENT: ::DWORD = 0x00050000; -//497 (Win 7 SDK) -pub const WAVERR_BADFORMAT: MMRESULT = WAVERR_BASE + 0; -pub const WAVERR_STILLPLAYING: MMRESULT = WAVERR_BASE + 1; -pub const WAVERR_UNPREPARED: MMRESULT = WAVERR_BASE + 2; -pub const WAVERR_SYNC: MMRESULT = WAVERR_BASE + 3; -pub const WAVERR_LASTERROR: MMRESULT = WAVERR_BASE + 3; -DECLARE_HANDLE!(HWAVEIN, HWAVEIN__); -DECLARE_HANDLE!(HWAVEOUT, HWAVEOUT__); -pub type LPHWAVEIN = *mut HWAVEIN; -pub type LPHWAVEOUT = *mut HWAVEOUT; -pub const WOM_OPEN: ::UINT = MM_WOM_OPEN; -pub const WOM_CLOSE: ::UINT = MM_WOM_CLOSE; -pub const WOM_DONE: ::UINT = MM_WOM_DONE; -pub const WIM_OPEN: ::UINT = MM_WIM_OPEN; -pub const WIM_CLOSE: ::UINT = MM_WIM_CLOSE; -pub const WIM_DATA: ::UINT = MM_WIM_DATA; -pub const WAVE_MAPPER: ::UINT = 0xFFFFFFFF; -pub const WAVE_FORMAT_QUERY: ::DWORD = 0x0001; -pub const WAVE_ALLOWSYNC: ::DWORD = 0x0002; -pub const WAVE_MAPPED: ::DWORD = 0x0004; -pub const WAVE_FORMAT_DIRECT: ::DWORD = 0x0008; -pub const WAVE_FORMAT_DIRECT_QUERY: ::DWORD = WAVE_FORMAT_QUERY | WAVE_FORMAT_DIRECT; -pub const WAVE_MAPPED_DEFAULT_COMMUNICATION_DEVICE: ::DWORD = 0x0010; -STRUCT!{struct WAVEHDR { - lpData: ::LPSTR, - dwBufferLength: ::DWORD, - dwBytesRecorded: ::DWORD, - dwUser: ::DWORD_PTR, - dwFlags: ::DWORD, - dwLoops: ::DWORD, - lpNext: *mut WAVEHDR, - reserved: ::DWORD_PTR, -}} -pub type PWAVEHDR = *mut WAVEHDR; -pub type NPWAVEHDR = *mut WAVEHDR; -pub type LPWAVEHDR = *mut WAVEHDR; -STRUCT!{struct WAVEOUTCAPSW { - wMid: ::WORD, - wPid: ::WORD, - vDriverVersion: MMVERSION, - szPname: [::WCHAR; 32], - dwFormats: ::DWORD, - wChannels: ::WORD, - wReserved1: ::WORD, - dwSupport: ::DWORD, -}} -pub type PWAVEOUTCAPSW = *mut WAVEOUTCAPSW; -pub type NPWAVEOUTCAPSW = *mut WAVEOUTCAPSW; -pub type LPWAVEOUTCAPSW = *mut WAVEOUTCAPSW; -STRUCT!{struct WAVEINCAPSW { - wMid: ::WORD, - wPid: ::WORD, - vDriverVersion: MMVERSION, - szPname: [::WCHAR; 32], - dwFormats: ::DWORD, - wChannels: ::WORD, - wReserved1: ::WORD, -}} -pub type PWAVEINCAPSW = *mut WAVEINCAPSW; -pub type NPWAVEINCAPSW = *mut WAVEINCAPSW; -pub type LPWAVEINCAPSW = *mut WAVEINCAPSW; -pub const WAVE_INVALIDFORMAT: ::DWORD = 0x00000000; -pub const WAVE_FORMAT_1M08: ::DWORD = 0x00000001; -pub const WAVE_FORMAT_1S08: ::DWORD = 0x00000002; -pub const WAVE_FORMAT_1M16: ::DWORD = 0x00000004; -pub const WAVE_FORMAT_1S16: ::DWORD = 0x00000008; -pub const WAVE_FORMAT_2M08: ::DWORD = 0x00000010; -pub const WAVE_FORMAT_2S08: ::DWORD = 0x00000020; -pub const WAVE_FORMAT_2M16: ::DWORD = 0x00000040; -pub const WAVE_FORMAT_2S16: ::DWORD = 0x00000080; -pub const WAVE_FORMAT_4M08: ::DWORD = 0x00000100; -pub const WAVE_FORMAT_4S08: ::DWORD = 0x00000200; -pub const WAVE_FORMAT_4M16: ::DWORD = 0x00000400; -pub const WAVE_FORMAT_4S16: ::DWORD = 0x00000800; -pub const WAVE_FORMAT_44M08: ::DWORD = 0x00000100; -pub const WAVE_FORMAT_44S08: ::DWORD = 0x00000200; -pub const WAVE_FORMAT_44M16: ::DWORD = 0x00000400; -pub const WAVE_FORMAT_44S16: ::DWORD = 0x00000800; -pub const WAVE_FORMAT_48M08: ::DWORD = 0x00001000; -pub const WAVE_FORMAT_48S08: ::DWORD = 0x00002000; -pub const WAVE_FORMAT_48M16: ::DWORD = 0x00004000; -pub const WAVE_FORMAT_48S16: ::DWORD = 0x00008000; -pub const WAVE_FORMAT_96M08: ::DWORD = 0x00010000; -pub const WAVE_FORMAT_96S08: ::DWORD = 0x00020000; -pub const WAVE_FORMAT_96M16: ::DWORD = 0x00040000; -pub const WAVE_FORMAT_96S16: ::DWORD = 0x00080000; -//782 (Win 7 SDK) -pub type PWAVEFORMATEX = *mut ::WAVEFORMATEX; -pub type NPWAVEFORMATEX = *mut ::WAVEFORMATEX; -pub type LPWAVEFORMATEX = *mut ::WAVEFORMATEX; -pub type LPCWAVEFORMATEX = *const ::WAVEFORMATEX; -//2170 (Win 7 SDK) -pub const TIMERR_NOERROR: ::MMRESULT = 0; -pub const TIMERR_NOCANDO: ::MMRESULT = TIMERR_BASE + 1; -pub const TIMERR_STRUCT: ::MMRESULT = TIMERR_BASE + 33; -//2198 (Win 7 SDK) -STRUCT!{struct TIMECAPS { - wPeriodMin: ::UINT, - wPeriodMax: ::UINT, -}} -pub type PTIMECAPS = *mut TIMECAPS; -pub type NPTIMECAPS = *mut TIMECAPS; -pub type LPTIMECAPS = *mut TIMECAPS; -STRUCT!{struct MIDIHDR { - lpData: ::LPSTR, - dwBufferLength: ::DWORD, - dwBytesRecorded: ::DWORD, - dwUser: ::DWORD_PTR, - dwFlags: ::DWORD, - lpNext: *mut MIDIHDR, - reserved: ::DWORD_PTR, - dwOffset: ::DWORD, - dwReserved: [::DWORD_PTR; 4], -}} -pub type PMIDIHDR = *mut MIDIHDR; -pub type NPMIDIHDR = *mut MIDIHDR; -pub type LPMIDIHDR = *mut MIDIHDR; -STRUCT!{struct MIDIINCAPSW { - wMid: ::WORD, - wPid: ::WORD, - vDriverVersion: MMVERSION, - szPname: [::WCHAR; 32], - dwSupport: ::DWORD, -}} -pub type PMIDIINCAPSW = *mut MIDIINCAPSW; -pub type NPMIDIINCAPSW = *mut MIDIINCAPSW; -pub type LPMIDIINCAPSW = *mut MIDIINCAPSW; -STRUCT!{struct MIDIOUTCAPSW { - wMid: ::WORD, - wPid: ::WORD, - vDriverVersion: ::MMVERSION, - szPname: [::WCHAR; 32], - wTechnology: ::WORD, - wVoices: ::WORD, - wNotes: ::WORD, - wChannelMask: ::WORD, - dwSupport: ::DWORD, -}} -pub type PMIDIOUTCAPSW = *mut MIDIOUTCAPSW; -pub type NPMIDIOUTCAPSW = *mut MIDIOUTCAPSW; -pub type LPMIDIOUTCAPSW = *mut MIDIOUTCAPSW; -DECLARE_HANDLE!(HMIDIIN, HMIDIIN__); -DECLARE_HANDLE!(HMIDIOUT, HMIDIOUT__); -pub type LPHMIDIIN = *mut HMIDIIN; -pub type LPHMIDIOUT = *mut HMIDIOUT; -DECLARE_HANDLE!(HMIDISTRM, HMIDISTRM__); -DECLARE_HANDLE!(HMIDI, HMIDI__); -pub type LPHMIDISTRM = *mut HMIDISTRM; -pub type LPHMIDI = *mut HMIDI; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/mscat.rs cargo-0.37.0/vendor/winapi-0.2.8/src/mscat.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/mscat.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/mscat.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! Microsoft Internet Security Catalog API Prototypes and Definitions -STRUCT!{struct CRYPTCATSTORE { - cbStruct: ::DWORD, - dwPublicVersion: ::DWORD, - pwszP7File: ::LPWSTR, - hProv: ::HCRYPTPROV, - dwEncodingType: ::DWORD, - fdwStoreFlags: ::DWORD, - hReserved: ::HANDLE, - hAttrs: ::HANDLE, - hCryptMsg: ::HCRYPTMSG, - hSorted: ::HANDLE, -}} -STRUCT!{struct CRYPTCATMEMBER { - cbStruct: ::DWORD, - pwszReferenceTag: ::LPWSTR, - pwszFileName: ::LPWSTR, - gSubjectType: ::GUID, - fdwMemberFlags: ::DWORD, - pIndirectData: *mut ::SIP_INDIRECT_DATA, - dwCertVersion: ::DWORD, - dwReserved: ::DWORD, - hReserved: ::HANDLE, - sEncodedIndirectData: ::CRYPT_ATTR_BLOB, - sEncodedMemberInfo: ::CRYPT_ATTR_BLOB, -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/mssip.rs cargo-0.37.0/vendor/winapi-0.2.8/src/mssip.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/mssip.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/mssip.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! Microsoft SIP Provider Prototypes and Definitions -STRUCT!{struct SIP_SUBJECTINFO { - cbSize: ::DWORD, - pgSubjectType: *mut ::GUID, - hFile: ::HANDLE, - pwsFileName: ::LPCWSTR, - pwsDisplayName: ::LPCWSTR, - dwReserved1: ::DWORD, - dwIntVersion: ::DWORD, - hProv: ::HCRYPTPROV, - DigestAlgorithm: ::CRYPT_ALGORITHM_IDENTIFIER, - dwFlags: ::DWORD, - dwEncodingType: ::DWORD, - dwReserved2: ::DWORD, - fdwCAPISettings: ::DWORD, - fdwSecuritySettings: ::DWORD, - dwIndex: ::DWORD, - dwUnionChoice: ::DWORD, - psFlat: *mut MS_ADDINFO_FLAT, - pClientData: ::LPVOID, -}} -UNION!(SIP_SUBJECTINFO, psFlat, psCatMember, psCatMember_mut, *mut MS_ADDINFO_CATALOGMEMBER); -UNION!(SIP_SUBJECTINFO, psFlat, psBlob, psBlob_mut, *mut MS_ADDINFO_BLOB); -pub type LPSIP_SUBJECTINFO = *mut SIP_SUBJECTINFO; -STRUCT!{struct MS_ADDINFO_FLAT { - cbStruct: ::DWORD, - pIndirectData: *mut SIP_INDIRECT_DATA, -}} -pub type PMS_ADDINFO_FLAT = *mut MS_ADDINFO_FLAT; -STRUCT!{struct MS_ADDINFO_CATALOGMEMBER { - cbStruct: ::DWORD, - pStore: *mut ::CRYPTCATSTORE, - pMember: *mut ::CRYPTCATMEMBER, -}} -pub type PMS_ADDINFO_CATALOGMEMBER = *mut MS_ADDINFO_CATALOGMEMBER; -STRUCT!{struct MS_ADDINFO_BLOB { - cbStruct: ::DWORD, - cbMemObject: ::DWORD, - pbMemObject: *mut ::BYTE, - cbMemSignedMsg: ::DWORD, - pbMemSignedMsg: *mut ::BYTE, -}} -pub type PMS_ADDINFO_BLOB = *mut MS_ADDINFO_BLOB; -STRUCT!{struct SIP_INDIRECT_DATA { - Data: ::CRYPT_ATTRIBUTE_TYPE_VALUE, - DigestAlgorithm: ::CRYPT_ALGORITHM_IDENTIFIER, - Digest: ::CRYPT_HASH_BLOB, -}} -pub type PSIP_INDIRECT_DATA = *mut SIP_INDIRECT_DATA; -STRUCT!{struct SIP_ADD_NEWPROVIDER { - cbStruct: ::DWORD, - pgSubject: *mut ::GUID, - pwszDLLFileName: *mut ::WCHAR, - pwszMagicNumber: *mut ::WCHAR, - pwszIsFunctionName: *mut ::WCHAR, - pwszGetFuncName: *mut ::WCHAR, - pwszPutFuncName: *mut ::WCHAR, - pwszCreateFuncName: *mut ::WCHAR, - pwszVerifyFuncName: *mut ::WCHAR, - pwszRemoveFuncName: *mut ::WCHAR, - pwszIsFunctionNameFmt2: *mut ::WCHAR, - pwszGetCapFuncName: ::PWSTR, -}} -pub type PSIP_ADD_NEWPROVIDER = *mut SIP_ADD_NEWPROVIDER; -STRUCT!{struct SIP_CAP_SET_V3 { - cbSize: ::DWORD, - dwVersion: ::DWORD, - isMultiSign: ::BOOL, - dwFlags: ::DWORD, -}} -UNION!(SIP_CAP_SET_V3, dwFlags, dwReserved, dwReserved_mut, ::DWORD); -pub type PSIP_CAP_SET_V3 = *mut SIP_CAP_SET_V3; -pub type SIP_CAP_SET = PSIP_CAP_SET_V3; -pub type pCryptSIPGetSignedDataMsg = Option ::BOOL>; -pub type pCryptSIPPutSignedDataMsg = Option ::BOOL>; -pub type pCryptSIPCreateIndirectData = Option ::BOOL>; -pub type pCryptSIPVerifyIndirectData = Option ::BOOL>; -pub type pCryptSIPRemoveSignedDataMsg = Option ::BOOL>; -STRUCT!{nodebug struct SIP_DISPATCH_INFO { - cbSize: ::DWORD, - hSIP: ::HANDLE, - pfGet: pCryptSIPGetSignedDataMsg, - pfPut: pCryptSIPPutSignedDataMsg, - pfCreate: pCryptSIPCreateIndirectData, - pfVerify: pCryptSIPVerifyIndirectData, - pfRemove: pCryptSIPRemoveSignedDataMsg, -}} -pub type LPSIP_DISPATCH_INFO = *mut SIP_DISPATCH_INFO; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/nb30.rs cargo-0.37.0/vendor/winapi-0.2.8/src/nb30.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/nb30.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/nb30.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,200 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -// This module contains the definitions for portable NetBIOS 3.0 support. -pub const NCBNAMSZ: usize = 16; -pub const MAX_LANA: usize = 254; -pub type PFPOST = Option; -#[cfg(target_arch="x86_64")] -STRUCT!{nodebug struct NCB { - ncb_command: ::UCHAR, - ncb_retcode: ::UCHAR, - ncb_lsn: ::UCHAR, - ncb_num: ::UCHAR, - ncb_buffer: ::PUCHAR, - ncb_length: ::WORD, - ncb_callname: [::UCHAR; NCBNAMSZ], - ncb_name: [::UCHAR; NCBNAMSZ], - ncb_rto: ::UCHAR, - ncb_sto: ::UCHAR, - ncb_post: PFPOST, - ncb_lana_num: ::UCHAR, - ncb_cmd_cplt: ::UCHAR, - ncb_reserve: [::UCHAR; 18], - ncb_event: ::HANDLE, -}} -#[cfg(target_arch="x86")] -STRUCT!{nodebug struct NCB { - ncb_command: ::UCHAR, - ncb_retcode: ::UCHAR, - ncb_lsn: ::UCHAR, - ncb_num: ::UCHAR, - ncb_buffer: ::PUCHAR, - ncb_length: ::WORD, - ncb_callname: [::UCHAR; NCBNAMSZ], - ncb_name: [::UCHAR; NCBNAMSZ], - ncb_rto: ::UCHAR, - ncb_sto: ::UCHAR, - ncb_post: PFPOST, - ncb_lana_num: ::UCHAR, - ncb_cmd_cplt: ::UCHAR, - ncb_reserve: [::UCHAR; 10], - ncb_event: ::HANDLE, -}} -pub type PNCB = *mut NCB; -STRUCT!{struct ADAPTER_STATUS { - adapter_address: [::UCHAR; 6], - rev_major: ::UCHAR, - reserved0: ::UCHAR, - adapter_type: ::UCHAR, - rev_minor: ::UCHAR, - duration: ::WORD, - frmr_recv: ::WORD, - frmr_xmit: ::WORD, - iframe_recv_err: ::WORD, - xmit_aborts: ::WORD, - xmit_success: ::DWORD, - recv_success: ::DWORD, - iframe_xmit_err: ::WORD, - recv_buff_unavail: ::WORD, - t1_timeouts: ::WORD, - ti_timeouts: ::WORD, - reserved1: ::DWORD, - free_ncbs: ::WORD, - max_cfg_ncbs: ::WORD, - max_ncbs: ::WORD, - xmit_buf_unavail: ::WORD, - max_dgram_size: ::WORD, - pending_sess: ::WORD, - max_cfg_sess: ::WORD, - max_sess: ::WORD, - max_sess_pkt_size: ::WORD, - name_count: ::WORD, -}} -pub type PADAPTER_STATUS = *mut ADAPTER_STATUS; -STRUCT!{struct NAME_BUFFER { - name: [::UCHAR; NCBNAMSZ], - name_num: ::UCHAR, - name_flags: ::UCHAR, -}} -pub type PNAME_BUFFER = *mut NAME_BUFFER; -pub const NAME_FLAGS_MASK: ::UCHAR = 0x87; -pub const GROUP_NAME: ::UCHAR = 0x80; -pub const UNIQUE_NAME: ::UCHAR = 0x00; -pub const REGISTERING: ::UCHAR = 0x00; -pub const REGISTERED: ::UCHAR = 0x04; -pub const DEREGISTERED: ::UCHAR = 0x05; -pub const DUPLICATE: ::UCHAR = 0x06; -pub const DUPLICATE_DEREG: ::UCHAR = 0x07; -STRUCT!{struct SESSION_HEADER { - sess_name: ::UCHAR, - num_sess: ::UCHAR, - rcv_dg_outstanding: ::UCHAR, - rcv_any_outstanding: ::UCHAR, -}} -pub type PSESSION_HEADER = *mut SESSION_HEADER; -STRUCT!{struct SESSION_BUFFER { - lsn: ::UCHAR, - state: ::UCHAR, - local_name: [::UCHAR; NCBNAMSZ], - remote_name: [::UCHAR; NCBNAMSZ], - rcvs_outstanding: ::UCHAR, - sends_outstanding: ::UCHAR, -}} -pub type PSESSION_BUFFER = *mut SESSION_BUFFER; -pub const LISTEN_OUTSTANDING: ::UCHAR = 0x01; -pub const CALL_PENDING: ::UCHAR = 0x02; -pub const SESSION_ESTABLISHED: ::UCHAR = 0x03; -pub const HANGUP_PENDING: ::UCHAR = 0x04; -pub const HANGUP_COMPLETE: ::UCHAR = 0x05; -pub const SESSION_ABORTED: ::UCHAR = 0x06; -STRUCT!{nodebug struct LANA_ENUM { - length: ::UCHAR, - lana: [::UCHAR; MAX_LANA + 1], -}} -pub type PLANA_ENUM = *mut LANA_ENUM; -STRUCT!{struct FIND_NAME_HEADER { - node_count: ::WORD, - reserved: ::UCHAR, - unique_group: ::UCHAR, -}} -pub type PFIND_NAME_HEADER = *mut FIND_NAME_HEADER; -STRUCT!{struct FIND_NAME_BUFFER { - length: ::UCHAR, - access_control: ::UCHAR, - frame_control: ::UCHAR, - destination_addr: [::UCHAR; 6], - source_addr: [::UCHAR; 6], - routing_info: [::UCHAR; 18], -}} -pub type PFIND_NAME_BUFFER = *mut FIND_NAME_BUFFER; -STRUCT!{struct ACTION_HEADER { - transport_id: ::ULONG, - action_code: ::USHORT, - reserved: ::USHORT, -}} -pub type PACTION_HEADER = *mut ACTION_HEADER; -pub const NCBCALL: ::UCHAR = 0x10; -pub const NCBLISTEN: ::UCHAR = 0x11; -pub const NCBHANGUP: ::UCHAR = 0x12; -pub const NCBSEND: ::UCHAR = 0x14; -pub const NCBRECV: ::UCHAR = 0x15; -pub const NCBRECVANY: ::UCHAR = 0x16; -pub const NCBCHAINSEND: ::UCHAR = 0x17; -pub const NCBDGSEND: ::UCHAR = 0x20; -pub const NCBDGRECV: ::UCHAR = 0x21; -pub const NCBDGSENDBC: ::UCHAR = 0x22; -pub const NCBADDNAME: ::UCHAR = 0x30; -pub const NCBDELNAME: ::UCHAR = 0x31; -pub const NCBRESET: ::UCHAR = 0x32; -pub const NCBASTAT: ::UCHAR = 0x33; -pub const NCBSSTAT: ::UCHAR = 0x34; -pub const NCBCANCEL: ::UCHAR = 0x35; -pub const NCBADDGRNAME: ::UCHAR = 0x36; -pub const NCBENUM: ::UCHAR = 0x37; -pub const NCBUNLINK: ::UCHAR = 0x70; -pub const NCBSENDNA: ::UCHAR = 0x71; -pub const NCBCHAINSENDNA: ::UCHAR = 0x72; -pub const NCBLANSTALERT: ::UCHAR = 0x73; -pub const NCBACTION: ::UCHAR = 0x77; -pub const NCBFINDNAME: ::UCHAR = 0x78; -pub const NCBTRACE: ::UCHAR = 0x79; -pub const ASYNCH: ::UCHAR = 0x80; -pub const NRC_GOODRET: ::UCHAR = 0x00; -pub const NRC_BUFLEN: ::UCHAR = 0x01; -pub const NRC_ILLCMD: ::UCHAR = 0x03; -pub const NRC_CMDTMO: ::UCHAR = 0x05; -pub const NRC_INCOMP: ::UCHAR = 0x06; -pub const NRC_BADDR: ::UCHAR = 0x07; -pub const NRC_SNUMOUT: ::UCHAR = 0x08; -pub const NRC_NORES: ::UCHAR = 0x09; -pub const NRC_SCLOSED: ::UCHAR = 0x0a; -pub const NRC_CMDCAN: ::UCHAR = 0x0b; -pub const NRC_DUPNAME: ::UCHAR = 0x0d; -pub const NRC_NAMTFUL: ::UCHAR = 0x0e; -pub const NRC_ACTSES: ::UCHAR = 0x0f; -pub const NRC_LOCTFUL: ::UCHAR = 0x11; -pub const NRC_REMTFUL: ::UCHAR = 0x12; -pub const NRC_ILLNN: ::UCHAR = 0x13; -pub const NRC_NOCALL: ::UCHAR = 0x14; -pub const NRC_NOWILD: ::UCHAR = 0x15; -pub const NRC_INUSE: ::UCHAR = 0x16; -pub const NRC_NAMERR: ::UCHAR = 0x17; -pub const NRC_SABORT: ::UCHAR = 0x18; -pub const NRC_NAMCONF: ::UCHAR = 0x19; -pub const NRC_IFBUSY: ::UCHAR = 0x21; -pub const NRC_TOOMANY: ::UCHAR = 0x22; -pub const NRC_BRIDGE: ::UCHAR = 0x23; -pub const NRC_CANOCCR: ::UCHAR = 0x24; -pub const NRC_CANCEL: ::UCHAR = 0x26; -pub const NRC_DUPENV: ::UCHAR = 0x30; -pub const NRC_ENVNOTDEF: ::UCHAR = 0x34; -pub const NRC_OSRESNOTAV: ::UCHAR = 0x35; -pub const NRC_MAXAPPS: ::UCHAR = 0x36; -pub const NRC_NOSAPS: ::UCHAR = 0x37; -pub const NRC_NORESOURCES: ::UCHAR = 0x38; -pub const NRC_INVADDRESS: ::UCHAR = 0x39; -pub const NRC_INVDDID: ::UCHAR = 0x3B; -pub const NRC_LOCKFAIL: ::UCHAR = 0x3C; -pub const NRC_OPENERR: ::UCHAR = 0x3f; -pub const NRC_SYSTEM: ::UCHAR = 0x40; -pub const NRC_PENDING: ::UCHAR = 0xff; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/ncrypt.rs cargo-0.37.0/vendor/winapi-0.2.8/src/ncrypt.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/ncrypt.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/ncrypt.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! Cryptographic API Prototypes and Definitions -//191 -pub type NCRYPT_HANDLE = ::ULONG_PTR; -pub type NCRYPT_PROV_HANDLE = ::ULONG_PTR; -pub type NCRYPT_KEY_HANDLE = ::ULONG_PTR; -pub type NCRYPT_HASH_HANDLE = ::ULONG_PTR; -pub type NCRYPT_SECRET_HANDLE = ::ULONG_PTR; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/ntdef.rs cargo-0.37.0/vendor/winapi-0.2.8/src/ntdef.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/ntdef.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/ntdef.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! Type definitions for the basic types. -//909 -pub type NTSTATUS = ::LONG; -pub type PNTSTATUS = *mut NTSTATUS; -pub type PCNTSTATUS = *const NTSTATUS; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/ntsecapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/ntsecapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/ntsecapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/ntsecapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,1589 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! This module defines the Local Security Authority APIs. -DEFINE_GUID!(Audit_System_SecurityStateChange, 0x0cce9210, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_System_SecuritySubsystemExtension, 0x0cce9211, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_System_Integrity, 0x0cce9212, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_System_IPSecDriverEvents, 0x0cce9213, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_System_Others, 0x0cce9214, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_Logon_Logon, 0x0cce9215, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_Logon_Logoff, 0x0cce9216, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_Logon_AccountLockout, 0x0cce9217, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_Logon_IPSecMainMode, 0x0cce9218, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_Logon_IPSecQuickMode, 0x0cce9219, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_Logon_IPSecUserMode, 0x0cce921a, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_Logon_SpecialLogon, 0x0cce921b, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_Logon_Others, 0x0cce921c, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_ObjectAccess_FileSystem, 0x0cce921d, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_ObjectAccess_Registry, 0x0cce921e, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_ObjectAccess_Kernel, 0x0cce921f, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_ObjectAccess_Sam, 0x0cce9220, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_ObjectAccess_CertificationServices, 0x0cce9221, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_ObjectAccess_ApplicationGenerated, 0x0cce9222, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_ObjectAccess_Handle, 0x0cce9223, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_ObjectAccess_Share, 0x0cce9224, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_ObjectAccess_FirewallPacketDrops, 0x0cce9225, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_ObjectAccess_FirewallConnection, 0x0cce9226, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_ObjectAccess_Other, 0x0cce9227, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_PrivilegeUse_Sensitive, 0x0cce9228, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_PrivilegeUse_NonSensitive, 0x0cce9229, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_PrivilegeUse_Others, 0x0cce922a, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_DetailedTracking_ProcessCreation, 0x0cce922b, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_DetailedTracking_ProcessTermination, 0x0cce922c, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_DetailedTracking_DpapiActivity, 0x0cce922d, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_DetailedTracking_RpcCall, 0x0cce922e, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_PolicyChange_AuditPolicy, 0x0cce922f, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_PolicyChange_AuthenticationPolicy, 0x0cce9230, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_PolicyChange_AuthorizationPolicy, 0x0cce9231, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_PolicyChange_MpsscvRulePolicy, 0x0cce9232, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_PolicyChange_WfpIPSecPolicy, 0x0cce9233, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_PolicyChange_Others, 0x0cce9234, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_AccountManagement_UserAccount, 0x0cce9235, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_AccountManagement_ComputerAccount, 0x0cce9236, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_AccountManagement_SecurityGroup, 0x0cce9237, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_AccountManagement_DistributionGroup, 0x0cce9238, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_AccountManagement_ApplicationGroup, 0x0cce9239, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_AccountManagement_Others, 0x0cce923a, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_DSAccess_DSAccess, 0x0cce923b, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_DsAccess_AdAuditChanges, 0x0cce923c, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_Ds_Replication, 0x0cce923d, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_Ds_DetailedReplication, 0x0cce923e, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_AccountLogon_CredentialValidation, 0x0cce923f, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_AccountLogon_Kerberos, 0x0cce9240, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_AccountLogon_Others, 0x0cce9241, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_AccountLogon_KerbCredentialValidation, 0x0cce9242, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_Logon_NPS, 0x0cce9243, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_ObjectAccess_DetailedFileShare, 0x0cce9244, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_ObjectAccess_RemovableStorage, 0x0cce9245, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_ObjectAccess_CbacStaging, 0x0cce9246, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_Logon_Claims, 0x0cce9247, 0x69ae, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_System, 0x69979848, 0x797a, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_Logon, 0x69979849, 0x797a, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_ObjectAccess, 0x6997984a, 0x797a, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_PrivilegeUse, 0x6997984b, 0x797a, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_DetailedTracking, 0x6997984c, 0x797a, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_PolicyChange, 0x6997984d, 0x797a, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_AccountManagement, 0x6997984e, 0x797a, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_DirectoryServiceAccess, 0x6997984f, 0x797a, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -DEFINE_GUID!(Audit_AccountLogon, 0x69979850, 0x797a, 0x11d9, - 0xbe, 0xd3, 0x50, 0x50, 0x54, 0x50, 0x30, 0x30); -ENUM!{enum POLICY_AUDIT_EVENT_TYPE { - AuditCategorySystem = 0, - AuditCategoryLogon, - AuditCategoryObjectAccess, - AuditCategoryPrivilegeUse, - AuditCategoryDetailedTracking, - AuditCategoryPolicyChange, - AuditCategoryAccountManagement, - AuditCategoryDirectoryServiceAccess, - AuditCategoryAccountLogon, -}} -pub type PPOLICY_AUDIT_EVENT_TYPE = *mut POLICY_AUDIT_EVENT_TYPE; -pub const POLICY_AUDIT_EVENT_UNCHANGED: POLICY_AUDIT_EVENT_OPTIONS = 0x00000000; -pub const POLICY_AUDIT_EVENT_SUCCESS: POLICY_AUDIT_EVENT_OPTIONS = 0x00000001; -pub const POLICY_AUDIT_EVENT_FAILURE: POLICY_AUDIT_EVENT_OPTIONS = 0x00000002; -pub const POLICY_AUDIT_EVENT_NONE: POLICY_AUDIT_EVENT_OPTIONS = 0x00000004; -pub const POLICY_AUDIT_EVENT_MASK: POLICY_AUDIT_EVENT_OPTIONS = POLICY_AUDIT_EVENT_SUCCESS - | POLICY_AUDIT_EVENT_FAILURE | POLICY_AUDIT_EVENT_UNCHANGED | POLICY_AUDIT_EVENT_NONE; -pub const POLICY_VIEW_LOCAL_INFORMATION: ::ACCESS_MASK = 0x00000001; -pub const POLICY_VIEW_AUDIT_INFORMATION: ::ACCESS_MASK = 0x00000002; -pub const POLICY_GET_PRIVATE_INFORMATION: ::ACCESS_MASK = 0x00000004; -pub const POLICY_TRUST_ADMIN: ::ACCESS_MASK = 0x00000008; -pub const POLICY_CREATE_ACCOUNT: ::ACCESS_MASK = 0x00000010; -pub const POLICY_CREATE_SECRET: ::ACCESS_MASK = 0x00000020; -pub const POLICY_CREATE_PRIVILEGE: ::ACCESS_MASK = 0x00000040; -pub const POLICY_SET_DEFAULT_QUOTA_LIMITS: ::ACCESS_MASK = 0x00000080; -pub const POLICY_SET_AUDIT_REQUIREMENTS: ::ACCESS_MASK = 0x00000100; -pub const POLICY_AUDIT_LOG_ADMIN: ::ACCESS_MASK = 0x00000200; -pub const POLICY_SERVER_ADMIN: ::ACCESS_MASK = 0x00000400; -pub const POLICY_LOOKUP_NAMES: ::ACCESS_MASK = 0x00000800; -pub const POLICY_NOTIFICATION: ::ACCESS_MASK = 0x00001000; -pub const POLICY_ALL_ACCESS: ::ACCESS_MASK = ::STANDARD_RIGHTS_REQUIRED - | POLICY_VIEW_LOCAL_INFORMATION | POLICY_VIEW_AUDIT_INFORMATION - | POLICY_GET_PRIVATE_INFORMATION | POLICY_TRUST_ADMIN | POLICY_CREATE_ACCOUNT - | POLICY_CREATE_SECRET | POLICY_CREATE_PRIVILEGE | POLICY_SET_DEFAULT_QUOTA_LIMITS - | POLICY_SET_AUDIT_REQUIREMENTS | POLICY_AUDIT_LOG_ADMIN | POLICY_SERVER_ADMIN - | POLICY_LOOKUP_NAMES; -pub const POLICY_READ: ::ACCESS_MASK = ::STANDARD_RIGHTS_READ | POLICY_VIEW_AUDIT_INFORMATION - | POLICY_GET_PRIVATE_INFORMATION; -pub const POLICY_WRITE: ::ACCESS_MASK = ::STANDARD_RIGHTS_WRITE | POLICY_TRUST_ADMIN - | POLICY_CREATE_ACCOUNT | POLICY_CREATE_SECRET | POLICY_CREATE_PRIVILEGE - | POLICY_SET_DEFAULT_QUOTA_LIMITS | POLICY_SET_AUDIT_REQUIREMENTS | POLICY_AUDIT_LOG_ADMIN - | POLICY_SERVER_ADMIN; -pub const POLICY_EXECUTE: ::ACCESS_MASK = ::STANDARD_RIGHTS_EXECUTE - | POLICY_VIEW_LOCAL_INFORMATION | POLICY_LOOKUP_NAMES; -STRUCT!{struct LSA_TRANSLATED_SID { - Use: ::SID_NAME_USE, - RelativeId: ::ULONG, - DomainIndex: ::LONG, -}} -pub type PLSA_TRANSLATED_SID = *mut LSA_TRANSLATED_SID; -ENUM!{enum POLICY_LSA_SERVER_ROLE { - PolicyServerRoleBackup = 2, - PolicyServerRolePrimary, -}} -pub type PPOLICY_LSA_SERVER_ROLE = *mut POLICY_LSA_SERVER_ROLE; -pub type POLICY_AUDIT_EVENT_OPTIONS = ::ULONG; -pub type PPOLICY_AUDIT_EVENT_OPTIONS = *mut ::ULONG; -ENUM!{enum POLICY_INFORMATION_CLASS { - PolicyAuditLogInformation = 1, - PolicyAuditEventsInformation, - PolicyPrimaryDomainInformation, - PolicyPdAccountInformation, - PolicyAccountDomainInformation, - PolicyLsaServerRoleInformation, - PolicyReplicaSourceInformation, - PolicyDefaultQuotaInformation, - PolicyModificationInformation, - PolicyAuditFullSetInformation, - PolicyAuditFullQueryInformation, - PolicyDnsDomainInformation, - PolicyDnsDomainInformationInt, - PolicyLocalAccountDomainInformation, - PolicyLastEntry, -}} -pub type PPOLICY_INFORMATION_CLASS = *mut POLICY_INFORMATION_CLASS; -STRUCT!{struct POLICY_AUDIT_LOG_INFO { - AuditLogPercentFull: ::ULONG, - MaximumLogSize: ::ULONG, - AuditRetentionPeriod: ::LARGE_INTEGER, - AuditLogFullShutdownInProgress: ::BOOLEAN, - TimeToShutdown: ::LARGE_INTEGER, - NextAuditRecordId: ::ULONG, -}} -pub type PPOLICY_AUDIT_LOG_INFO = *mut POLICY_AUDIT_LOG_INFO; -STRUCT!{struct POLICY_AUDIT_EVENTS_INFO { - AuditingMode: ::BOOLEAN, - EventAuditingOptions: PPOLICY_AUDIT_EVENT_OPTIONS, - MaximumAuditEventCount: ::ULONG, -}} -pub type PPOLICY_AUDIT_EVENTS_INFO = *mut POLICY_AUDIT_EVENTS_INFO; -STRUCT!{struct POLICY_AUDIT_SUBCATEGORIES_INFO { - MaximumSubCategoryCount: ::ULONG, - EventAuditingOptions: PPOLICY_AUDIT_EVENT_OPTIONS, -}} -pub type PPOLICY_AUDIT_SUBCATEGORIES_INFO = *mut POLICY_AUDIT_SUBCATEGORIES_INFO; -STRUCT!{struct POLICY_AUDIT_CATEGORIES_INFO { - MaximumSubCategoryCount: ::ULONG, - SubCategoriesInfo: PPOLICY_AUDIT_SUBCATEGORIES_INFO, -}} -pub type PPOLICY_AUDIT_CATEGORIES_INFO = *mut POLICY_AUDIT_CATEGORIES_INFO; -pub const PER_USER_POLICY_UNCHANGED: ::ULONG = 0x00; -pub const PER_USER_AUDIT_SUCCESS_INCLUDE: ::ULONG = 0x01; -pub const PER_USER_AUDIT_SUCCESS_EXCLUDE: ::ULONG = 0x02; -pub const PER_USER_AUDIT_FAILURE_INCLUDE: ::ULONG = 0x04; -pub const PER_USER_AUDIT_FAILURE_EXCLUDE: ::ULONG = 0x08; -pub const PER_USER_AUDIT_NONE: ::ULONG = 0x10; -pub const VALID_PER_USER_AUDIT_POLICY_FLAG: ::ULONG = PER_USER_AUDIT_SUCCESS_INCLUDE - | PER_USER_AUDIT_SUCCESS_EXCLUDE | PER_USER_AUDIT_FAILURE_INCLUDE - | PER_USER_AUDIT_FAILURE_EXCLUDE | PER_USER_AUDIT_NONE; -STRUCT!{struct POLICY_PRIMARY_DOMAIN_INFO { - Name: ::LSA_UNICODE_STRING, - Sid: ::PSID, -}} -pub type PPOLICY_PRIMARY_DOMAIN_INFO = *mut POLICY_PRIMARY_DOMAIN_INFO; -STRUCT!{struct POLICY_PD_ACCOUNT_INFO { - Name: ::LSA_UNICODE_STRING, -}} -pub type PPOLICY_PD_ACCOUNT_INFO = *mut POLICY_PD_ACCOUNT_INFO; -STRUCT!{struct POLICY_LSA_SERVER_ROLE_INFO { - LsaServerRole: POLICY_LSA_SERVER_ROLE, -}} -pub type PPOLICY_LSA_SERVER_ROLE_INFO = *mut POLICY_LSA_SERVER_ROLE_INFO; -STRUCT!{struct POLICY_REPLICA_SOURCE_INFO { - ReplicaSource: ::LSA_UNICODE_STRING, - ReplicaAccountName: ::LSA_UNICODE_STRING, -}} -pub type PPOLICY_REPLICA_SOURCE_INFO = *mut POLICY_REPLICA_SOURCE_INFO; -STRUCT!{struct POLICY_DEFAULT_QUOTA_INFO { - QuotaLimits: ::QUOTA_LIMITS, -}} -pub type PPOLICY_DEFAULT_QUOTA_INFO = *mut POLICY_DEFAULT_QUOTA_INFO; -STRUCT!{struct POLICY_MODIFICATION_INFO { - ModifiedId: ::LARGE_INTEGER, - DatabaseCreationTime: ::LARGE_INTEGER, -}} -pub type PPOLICY_MODIFICATION_INFO = *mut POLICY_MODIFICATION_INFO; -STRUCT!{struct POLICY_AUDIT_FULL_SET_INFO { - ShutDownOnFull: ::BOOLEAN, -}} -pub type PPOLICY_AUDIT_FULL_SET_INFO = *mut POLICY_AUDIT_FULL_SET_INFO; -STRUCT!{struct POLICY_AUDIT_FULL_QUERY_INFO { - ShutDownOnFull: ::BOOLEAN, - LogIsFull: ::BOOLEAN, -}} -pub type PPOLICY_AUDIT_FULL_QUERY_INFO = *mut POLICY_AUDIT_FULL_QUERY_INFO; -ENUM!{enum POLICY_DOMAIN_INFORMATION_CLASS { - PolicyDomainEfsInformation = 2, - PolicyDomainKerberosTicketInformation, -}} -pub type PPOLICY_DOMAIN_INFORMATION_CLASS = *mut POLICY_DOMAIN_INFORMATION_CLASS; -STRUCT!{struct POLICY_DOMAIN_EFS_INFO { - InfoLength: ::ULONG, - EfsBlob: ::PUCHAR, -}} -pub type PPOLICY_DOMAIN_EFS_INFO = *mut POLICY_DOMAIN_EFS_INFO; -STRUCT!{struct POLICY_DOMAIN_KERBEROS_TICKET_INFO { - AuthenticationOptions: ::ULONG, - MaxServiceTicketAge: ::LARGE_INTEGER, - MaxTicketAge: ::LARGE_INTEGER, - MaxRenewAge: ::LARGE_INTEGER, - MaxClockSkew: ::LARGE_INTEGER, - Reserved: ::LARGE_INTEGER, -}} -pub type PPOLICY_DOMAIN_KERBEROS_TICKET_INFO = *mut POLICY_DOMAIN_KERBEROS_TICKET_INFO; -ENUM!{enum POLICY_NOTIFICATION_INFORMATION_CLASS { - PolicyNotifyAuditEventsInformation = 1, - PolicyNotifyAccountDomainInformation, - PolicyNotifyServerRoleInformation, - PolicyNotifyDnsDomainInformation, - PolicyNotifyDomainEfsInformation, - PolicyNotifyDomainKerberosTicketInformation, - PolicyNotifyMachineAccountPasswordInformation, - PolicyNotifyGlobalSaclInformation, - PolicyNotifyMax, -}} -pub type PPOLICY_NOTIFICATION_INFORMATION_CLASS = *mut POLICY_NOTIFICATION_INFORMATION_CLASS; -pub type LSA_HANDLE = ::PVOID; -pub type PLSA_HANDLE = *mut ::PVOID; -ENUM!{enum TRUSTED_INFORMATION_CLASS { - TrustedDomainNameInformation = 1, - TrustedControllersInformation, - TrustedPosixOffsetInformation, - TrustedPasswordInformation, - TrustedDomainInformationBasic, - TrustedDomainInformationEx, - TrustedDomainAuthInformation, - TrustedDomainFullInformation, - TrustedDomainAuthInformationInternal, - TrustedDomainFullInformationInternal, - TrustedDomainInformationEx2Internal, - TrustedDomainFullInformation2Internal, - TrustedDomainSupportedEncryptionTypes, -}} -pub type PTRUSTED_INFORMATION_CLASS = *mut TRUSTED_INFORMATION_CLASS; -STRUCT!{struct TRUSTED_DOMAIN_NAME_INFO { - Name: ::LSA_UNICODE_STRING, -}} -pub type PTRUSTED_DOMAIN_NAME_INFO = *mut TRUSTED_DOMAIN_NAME_INFO; -STRUCT!{struct TRUSTED_CONTROLLERS_INFO { - Entries: ::ULONG, - Names: ::PLSA_UNICODE_STRING, -}} -pub type PTRUSTED_CONTROLLERS_INFO = *mut TRUSTED_CONTROLLERS_INFO; -STRUCT!{struct TRUSTED_POSIX_OFFSET_INFO { - Offset: ::ULONG, -}} -pub type PTRUSTED_POSIX_OFFSET_INFO = *mut TRUSTED_POSIX_OFFSET_INFO; -STRUCT!{struct TRUSTED_PASSWORD_INFO { - Password: ::LSA_UNICODE_STRING, - OldPassword: ::LSA_UNICODE_STRING, -}} -pub type PTRUSTED_PASSWORD_INFO = *mut TRUSTED_PASSWORD_INFO; -pub type TRUSTED_DOMAIN_INFORMATION_BASIC = ::LSA_TRUST_INFORMATION; -pub type PTRUSTED_DOMAIN_INFORMATION_BASIC = ::PLSA_TRUST_INFORMATION; -pub const TRUST_DIRECTION_DISABLED: ::ULONG = 0x00000000; -pub const TRUST_DIRECTION_INBOUND: ::ULONG = 0x00000001; -pub const TRUST_DIRECTION_OUTBOUND: ::ULONG = 0x00000002; -pub const TRUST_DIRECTION_BIDIRECTIONAL: ::ULONG = TRUST_DIRECTION_INBOUND - | TRUST_DIRECTION_OUTBOUND; -pub const TRUST_TYPE_DOWNLEVEL: ::ULONG = 0x00000001; -pub const TRUST_TYPE_UPLEVEL: ::ULONG = 0x00000002; -pub const TRUST_TYPE_MIT: ::ULONG = 0x00000003; -pub const TRUST_ATTRIBUTE_NON_TRANSITIVE: ::ULONG = 0x00000001; -pub const TRUST_ATTRIBUTE_UPLEVEL_ONLY: ::ULONG = 0x00000002; -pub const TRUST_ATTRIBUTE_QUARANTINED_DOMAIN: ::ULONG = 0x00000004; -pub const TRUST_ATTRIBUTE_FOREST_TRANSITIVE: ::ULONG = 0x00000008; -pub const TRUST_ATTRIBUTE_CROSS_ORGANIZATION: ::ULONG = 0x00000010; -pub const TRUST_ATTRIBUTE_WITHIN_FOREST: ::ULONG = 0x00000020; -pub const TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL: ::ULONG = 0x00000040; -pub const TRUST_ATTRIBUTE_TRUST_USES_RC4_ENCRYPTION: ::ULONG = 0x00000080; -pub const TRUST_ATTRIBUTE_TRUST_USES_AES_KEYS: ::ULONG = 0x00000100; -pub const TRUST_ATTRIBUTE_CROSS_ORGANIZATION_NO_TGT_DELEGATION: ::ULONG = 0x00000200; -pub const TRUST_ATTRIBUTES_VALID: ::ULONG = 0xFF03FFFF; -pub const TRUST_ATTRIBUTES_USER: ::ULONG = 0xFF000000; -STRUCT!{struct TRUSTED_DOMAIN_INFORMATION_EX { - Name: ::LSA_UNICODE_STRING, - FlatName: ::LSA_UNICODE_STRING, - Sid: ::PSID, - TrustDirection: ::ULONG, - TrustType: ::ULONG, - TrustAttributes: ::ULONG, -}} -pub type PTRUSTED_DOMAIN_INFORMATION_EX = *mut TRUSTED_DOMAIN_INFORMATION_EX; -STRUCT!{struct TRUSTED_DOMAIN_INFORMATION_EX2 { - Name: ::LSA_UNICODE_STRING, - FlatName: ::LSA_UNICODE_STRING, - Sid: ::PSID, - TrustDirection: ::ULONG, - TrustType: ::ULONG, - TrustAttributes: ::ULONG, - ForestTrustLength: ::ULONG, - ForestTrustInfo: ::PUCHAR, -}} -pub type PTRUSTED_DOMAIN_INFORMATION_EX2 = *mut TRUSTED_DOMAIN_INFORMATION_EX2; -pub const TRUST_AUTH_TYPE_NONE: ::ULONG = 0; -pub const TRUST_AUTH_TYPE_NT4OWF: ::ULONG = 1; -pub const TRUST_AUTH_TYPE_CLEAR: ::ULONG = 2; -pub const TRUST_AUTH_TYPE_VERSION: ::ULONG = 3; -STRUCT!{struct LSA_AUTH_INFORMATION { - LastUpdateTime: ::LARGE_INTEGER, - AuthType: ::ULONG, - AuthInfoLength: ::ULONG, - AuthInfo: ::PUCHAR, -}} -pub type PLSA_AUTH_INFORMATION = *mut LSA_AUTH_INFORMATION; -STRUCT!{struct TRUSTED_DOMAIN_AUTH_INFORMATION { - IncomingAuthInfos: ::ULONG, - IncomingAuthenticationInformation: PLSA_AUTH_INFORMATION, - IncomingPreviousAuthenticationInformation: PLSA_AUTH_INFORMATION, - OutgoingAuthInfos: ::ULONG, - OutgoingAuthenticationInformation: PLSA_AUTH_INFORMATION, - OutgoingPreviousAuthenticationInformation: PLSA_AUTH_INFORMATION, -}} -pub type PTRUSTED_DOMAIN_AUTH_INFORMATION = *mut TRUSTED_DOMAIN_AUTH_INFORMATION; -STRUCT!{struct TRUSTED_DOMAIN_FULL_INFORMATION { - Information: TRUSTED_DOMAIN_INFORMATION_EX, - PosixOffset: TRUSTED_POSIX_OFFSET_INFO, - AuthInformation: TRUSTED_DOMAIN_AUTH_INFORMATION, -}} -pub type PTRUSTED_DOMAIN_FULL_INFORMATION = *mut TRUSTED_DOMAIN_FULL_INFORMATION; -STRUCT!{struct TRUSTED_DOMAIN_FULL_INFORMATION2 { - Information: TRUSTED_DOMAIN_INFORMATION_EX2, - PosixOffset: TRUSTED_POSIX_OFFSET_INFO, - AuthInformation: TRUSTED_DOMAIN_AUTH_INFORMATION, -}} -pub type PTRUSTED_DOMAIN_FULL_INFORMATION2 = *mut TRUSTED_DOMAIN_FULL_INFORMATION2; -STRUCT!{struct TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES { - SupportedEncryptionTypes: ::ULONG, -}} -pub type PTRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES = - *mut TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES; -ENUM!{enum LSA_FOREST_TRUST_RECORD_TYPE { - ForestTrustTopLevelName, - ForestTrustTopLevelNameEx, - ForestTrustDomainInfo, - ForestTrustRecordTypeLast, // = ForestTrustDomainInfo, -}} -pub const LSA_FTRECORD_DISABLED_REASONS: ::ULONG = 0x0000FFFF; -pub const LSA_TLN_DISABLED_NEW: ::ULONG = 0x00000001; -pub const LSA_TLN_DISABLED_ADMIN: ::ULONG = 0x00000002; -pub const LSA_TLN_DISABLED_CONFLICT: ::ULONG = 0x00000004; -pub const LSA_SID_DISABLED_ADMIN: ::ULONG = 0x00000001; -pub const LSA_SID_DISABLED_CONFLICT: ::ULONG = 0x00000002; -pub const LSA_NB_DISABLED_ADMIN: ::ULONG = 0x00000004; -pub const LSA_NB_DISABLED_CONFLICT: ::ULONG = 0x00000008; -STRUCT!{struct LSA_FOREST_TRUST_DOMAIN_INFO { - Sid: ::PSID, - DnsName: ::LSA_UNICODE_STRING, - NetbiosName: ::LSA_UNICODE_STRING, -}} -pub type PLSA_FOREST_TRUST_DOMAIN_INFO = *mut LSA_FOREST_TRUST_DOMAIN_INFO; -pub const MAX_FOREST_TRUST_BINARY_DATA_SIZE: ::ULONG = 128 * 1024; -STRUCT!{struct LSA_FOREST_TRUST_BINARY_DATA { - Length: ::ULONG, - Buffer: ::PUCHAR, -}} -pub type PLSA_FOREST_TRUST_BINARY_DATA = *mut LSA_FOREST_TRUST_BINARY_DATA; -STRUCT!{struct LSA_FOREST_TRUST_RECORD_ForestTrustData { - DomainInfo: LSA_FOREST_TRUST_DOMAIN_INFO, -}} -UNION!( - LSA_FOREST_TRUST_RECORD_ForestTrustData, DomainInfo, TopLevelName, TopLevelName_mut, - ::LSA_UNICODE_STRING -); -UNION!( - LSA_FOREST_TRUST_RECORD_ForestTrustData, DomainInfo, Data, Data_mut, - LSA_FOREST_TRUST_BINARY_DATA -); -STRUCT!{struct LSA_FOREST_TRUST_RECORD { - Flags: ::ULONG, - ForestTrustType: LSA_FOREST_TRUST_RECORD_TYPE, - Time: ::LARGE_INTEGER, - ForestTrustData: LSA_FOREST_TRUST_RECORD_ForestTrustData, -}} -pub type PLSA_FOREST_TRUST_RECORD = *mut LSA_FOREST_TRUST_RECORD; -pub const MAX_RECORDS_IN_FOREST_TRUST_INFO: ::ULONG = 4000; -STRUCT!{struct LSA_FOREST_TRUST_INFORMATION { - RecordCount: ::ULONG, - Entries: *mut PLSA_FOREST_TRUST_RECORD, -}} -pub type PLSA_FOREST_TRUST_INFORMATION = *mut LSA_FOREST_TRUST_INFORMATION; -ENUM!{enum LSA_FOREST_TRUST_COLLISION_RECORD_TYPE { - CollisionTdo, - CollisionXref, - CollisionOther, -}} -STRUCT!{struct LSA_FOREST_TRUST_COLLISION_RECORD { - Index: ::ULONG, - Type: LSA_FOREST_TRUST_COLLISION_RECORD_TYPE, - Flags: ::ULONG, - Name: ::LSA_UNICODE_STRING, -}} -pub type PLSA_FOREST_TRUST_COLLISION_RECORD = *mut LSA_FOREST_TRUST_COLLISION_RECORD; -STRUCT!{struct LSA_FOREST_TRUST_COLLISION_INFORMATION { - RecordCount: ::ULONG, - Entries: *mut PLSA_FOREST_TRUST_COLLISION_RECORD, -}} -pub type PLSA_FOREST_TRUST_COLLISION_INFORMATION = *mut LSA_FOREST_TRUST_COLLISION_INFORMATION; -pub type LSA_ENUMERATION_HANDLE = ::ULONG; -pub type PLSA_ENUMERATION_HANDLE = *mut ::ULONG; -STRUCT!{struct LSA_ENUMERATION_INFORMATION { - Sid: ::PSID, -}} -pub type PLSA_ENUMERATION_INFORMATION = *mut LSA_ENUMERATION_INFORMATION; -STRUCT!{struct LSA_LAST_INTER_LOGON_INFO { - LastSuccessfulLogon: ::LARGE_INTEGER, - LastFailedLogon: ::LARGE_INTEGER, - FailedAttemptCountSinceLastSuccessfulLogon: ::ULONG, -}} -pub type PLSA_LAST_INTER_LOGON_INFO = *mut LSA_LAST_INTER_LOGON_INFO; -STRUCT!{struct SECURITY_LOGON_SESSION_DATA { - Size: ::ULONG, - LogonId: ::LUID, - UserName: ::LSA_UNICODE_STRING, - LogonDomain: ::LSA_UNICODE_STRING, - AuthenticationPackage: ::LSA_UNICODE_STRING, - LogonType: ::ULONG, - Session: ::ULONG, - Sid: ::PSID, - LogonTime: ::LARGE_INTEGER, - LogonServer: ::LSA_UNICODE_STRING, - DnsDomainName: ::LSA_UNICODE_STRING, - Upn: ::LSA_UNICODE_STRING, - UserFlags: ::ULONG, - LastLogonInfo: LSA_LAST_INTER_LOGON_INFO, - LogonScript: ::LSA_UNICODE_STRING, - ProfilePath: ::LSA_UNICODE_STRING, - HomeDirectory: ::LSA_UNICODE_STRING, - HomeDirectoryDrive: ::LSA_UNICODE_STRING, - LogoffTime: ::LARGE_INTEGER, - KickOffTime: ::LARGE_INTEGER, - PasswordLastSet: ::LARGE_INTEGER, - PasswordCanChange: ::LARGE_INTEGER, - PasswordMustChange: ::LARGE_INTEGER, -}} -pub type PSECURITY_LOGON_SESSION_DATA = *mut SECURITY_LOGON_SESSION_DATA; -pub const CENTRAL_ACCESS_POLICY_OWNER_RIGHTS_PRESENT_FLAG: ::ULONG = 0x00000001; -pub const CENTRAL_ACCESS_POLICY_STAGED_OWNER_RIGHTS_PRESENT_FLAG: ::ULONG = 0x00000100; -pub const CENTRAL_ACCESS_POLICY_STAGED_FLAG: ::ULONG = 0x00010000; -pub const CENTRAL_ACCESS_POLICY_VALID_FLAG_MASK: ::ULONG = - CENTRAL_ACCESS_POLICY_OWNER_RIGHTS_PRESENT_FLAG - | CENTRAL_ACCESS_POLICY_STAGED_OWNER_RIGHTS_PRESENT_FLAG | CENTRAL_ACCESS_POLICY_STAGED_FLAG; -pub const LSASETCAPS_RELOAD_FLAG: ::ULONG = 0x00000001; -pub const LSASETCAPS_VALID_FLAG_MASK: ::ULONG = LSASETCAPS_RELOAD_FLAG; -STRUCT!{struct CENTRAL_ACCESS_POLICY_ENTRY { - Name: ::LSA_UNICODE_STRING, - Description: ::LSA_UNICODE_STRING, - ChangeId: ::LSA_UNICODE_STRING, - LengthAppliesTo: ::ULONG, - AppliesTo: ::PUCHAR, - LengthSD: ::ULONG, - SD: ::PSECURITY_DESCRIPTOR, - LengthStagedSD: ::ULONG, - StagedSD: ::PSECURITY_DESCRIPTOR, - Flags: ::ULONG, -}} -pub type PCENTRAL_ACCESS_POLICY_ENTRY = *mut CENTRAL_ACCESS_POLICY_ENTRY; -pub type PCCENTRAL_ACCESS_POLICY_ENTRY = *const CENTRAL_ACCESS_POLICY_ENTRY; -STRUCT!{struct CENTRAL_ACCESS_POLICY { - CAPID: ::PSID, - Name: ::LSA_UNICODE_STRING, - Description: ::LSA_UNICODE_STRING, - ChangeId: ::LSA_UNICODE_STRING, - Flags: ::ULONG, - CAPECount: ::ULONG, - CAPEs: *mut PCENTRAL_ACCESS_POLICY_ENTRY, -}} -pub type PCENTRAL_ACCESS_POLICY = *mut CENTRAL_ACCESS_POLICY; -pub type PCCENTRAL_ACCESS_POLICY = *const CENTRAL_ACCESS_POLICY; -ENUM!{enum NEGOTIATE_MESSAGES { - NegEnumPackagePrefixes = 0, - NegGetCallerName = 1, - NegTransferCredentials = 2, - NegCallPackageMax, -}} -pub const NEGOTIATE_MAX_PREFIX: usize = 32; -STRUCT!{struct NEGOTIATE_PACKAGE_PREFIX { - PackageId: ::ULONG_PTR, - PackageDataA: ::PVOID, - PackageDataW: ::PVOID, - PrefixLen: ::ULONG_PTR, - Prefix: [::UCHAR; NEGOTIATE_MAX_PREFIX], -}} -pub type PNEGOTIATE_PACKAGE_PREFIX = *mut NEGOTIATE_PACKAGE_PREFIX; -STRUCT!{struct NEGOTIATE_PACKAGE_PREFIXES { - MessageType: ::ULONG, - PrefixCount: ::ULONG, - Offset: ::ULONG, - Pad: ::ULONG, -}} -pub type PNEGOTIATE_PACKAGE_PREFIXES = *mut NEGOTIATE_PACKAGE_PREFIXES; -STRUCT!{struct NEGOTIATE_CALLER_NAME_REQUEST { - MessageType: ::ULONG, - LogonId: ::LUID, -}} -pub type PNEGOTIATE_CALLER_NAME_REQUEST = *mut NEGOTIATE_CALLER_NAME_REQUEST; -STRUCT!{struct NEGOTIATE_CALLER_NAME_RESPONSE { - MessageType: ::ULONG, - CallerName: ::PWSTR, -}} -pub type PNEGOTIATE_CALLER_NAME_RESPONSE = *mut NEGOTIATE_CALLER_NAME_RESPONSE; -STRUCT!{struct DOMAIN_PASSWORD_INFORMATION { - MinPasswordLength: ::USHORT, - PasswordHistoryLength: ::USHORT, - PasswordProperties: ::ULONG, - MaxPasswordAge: ::LARGE_INTEGER, - MinPasswordAge: ::LARGE_INTEGER, -}} -pub type PDOMAIN_PASSWORD_INFORMATION = *mut DOMAIN_PASSWORD_INFORMATION; -pub const DOMAIN_PASSWORD_COMPLEX: ::ULONG = 0x00000001; -pub const DOMAIN_PASSWORD_NO_ANON_CHANGE: ::ULONG = 0x00000002; -pub const DOMAIN_PASSWORD_NO_CLEAR_CHANGE: ::ULONG = 0x00000004; -pub const DOMAIN_LOCKOUT_ADMINS: ::ULONG = 0x00000008; -pub const DOMAIN_PASSWORD_STORE_CLEARTEXT: ::ULONG = 0x00000010; -pub const DOMAIN_REFUSE_PASSWORD_CHANGE: ::ULONG = 0x00000020; -pub const DOMAIN_NO_LM_OWF_CHANGE: ::ULONG = 0x00000040; -pub type PSAM_PASSWORD_NOTIFICATION_ROUTINE = Option ::NTSTATUS>; -pub type PSAM_INIT_NOTIFICATION_ROUTINE = Option ::BOOLEAN>; -pub type PSAM_PASSWORD_FILTER_ROUTINE = Option ::BOOLEAN>; -ENUM!{enum MSV1_0_LOGON_SUBMIT_TYPE { - MsV1_0InteractiveLogon = 2, - MsV1_0Lm20Logon, - MsV1_0NetworkLogon, - MsV1_0SubAuthLogon, - MsV1_0WorkstationUnlockLogon = 7, - MsV1_0S4ULogon = 12, - MsV1_0VirtualLogon = 82, - MsV1_0NoElevationLogon = 83, - MsV1_0LuidLogon = 84, -}} -pub type PMSV1_0_LOGON_SUBMIT_TYPE = *mut MSV1_0_LOGON_SUBMIT_TYPE; -ENUM!{enum MSV1_0_PROFILE_BUFFER_TYPE { - MsV1_0InteractiveProfile = 2, - MsV1_0Lm20LogonProfile, - MsV1_0SmartCardProfile, -}} -pub type PMSV1_0_PROFILE_BUFFER_TYPE = *mut MSV1_0_PROFILE_BUFFER_TYPE; -STRUCT!{struct MSV1_0_INTERACTIVE_LOGON { - MessageType: MSV1_0_LOGON_SUBMIT_TYPE, - LogonDomainName: ::UNICODE_STRING, - UserName: ::UNICODE_STRING, - Password: ::UNICODE_STRING, -}} -pub type PMSV1_0_INTERACTIVE_LOGON = *mut MSV1_0_INTERACTIVE_LOGON; -STRUCT!{struct MSV1_0_INTERACTIVE_PROFILE { - MessageType: MSV1_0_PROFILE_BUFFER_TYPE, - LogonCount: ::USHORT, - BadPasswordCount: ::USHORT, - LogonTime: ::LARGE_INTEGER, - LogoffTime: ::LARGE_INTEGER, - KickOffTime: ::LARGE_INTEGER, - PasswordLastSet: ::LARGE_INTEGER, - PasswordCanChange: ::LARGE_INTEGER, - PasswordMustChange: ::LARGE_INTEGER, - LogonScript: ::UNICODE_STRING, - HomeDirectory: ::UNICODE_STRING, - FullName: ::UNICODE_STRING, - ProfilePath: ::UNICODE_STRING, - HomeDirectoryDrive: ::UNICODE_STRING, - LogonServer: ::UNICODE_STRING, - UserFlags: ::ULONG, -}} -pub type PMSV1_0_INTERACTIVE_PROFILE = *mut MSV1_0_INTERACTIVE_PROFILE; -pub const MSV1_0_CHALLENGE_LENGTH: usize = 8; -pub const MSV1_0_USER_SESSION_KEY_LENGTH: usize = 16; -pub const MSV1_0_LANMAN_SESSION_KEY_LENGTH: usize = 8; -pub const MSV1_0_CLEARTEXT_PASSWORD_ALLOWED: ::ULONG = 0x02; -pub const MSV1_0_UPDATE_LOGON_STATISTICS: ::ULONG = 0x04; -pub const MSV1_0_RETURN_USER_PARAMETERS: ::ULONG = 0x08; -pub const MSV1_0_DONT_TRY_GUEST_ACCOUNT: ::ULONG = 0x10; -pub const MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT: ::ULONG = 0x20; -pub const MSV1_0_RETURN_PASSWORD_EXPIRY: ::ULONG = 0x40; -pub const MSV1_0_USE_CLIENT_CHALLENGE: ::ULONG = 0x80; -pub const MSV1_0_TRY_GUEST_ACCOUNT_ONLY: ::ULONG = 0x100; -pub const MSV1_0_RETURN_PROFILE_PATH: ::ULONG = 0x200; -pub const MSV1_0_TRY_SPECIFIED_DOMAIN_ONLY: ::ULONG = 0x400; -pub const MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT: ::ULONG = 0x800; -pub const MSV1_0_DISABLE_PERSONAL_FALLBACK: ::ULONG = 0x00001000; -pub const MSV1_0_ALLOW_FORCE_GUEST: ::ULONG = 0x00002000; -pub const MSV1_0_CLEARTEXT_PASSWORD_SUPPLIED: ::ULONG = 0x00004000; -pub const MSV1_0_USE_DOMAIN_FOR_ROUTING_ONLY: ::ULONG = 0x00008000; -pub const MSV1_0_SUBAUTHENTICATION_DLL_EX: ::ULONG = 0x00100000; -pub const MSV1_0_ALLOW_MSVCHAPV2: ::ULONG = 0x00010000; -pub const MSV1_0_S4U2SELF: ::ULONG = 0x00020000; -pub const MSV1_0_CHECK_LOGONHOURS_FOR_S4U: ::ULONG = 0x00040000; -pub const MSV1_0_INTERNET_DOMAIN: ::ULONG = 0x00080000; -pub const MSV1_0_SUBAUTHENTICATION_DLL: ::ULONG = 0xFF000000; -pub const MSV1_0_SUBAUTHENTICATION_DLL_SHIFT: ::ULONG = 24; -pub const MSV1_0_MNS_LOGON: ::ULONG = 0x01000000; -pub const MSV1_0_SUBAUTHENTICATION_DLL_RAS: ::ULONG = 2; -pub const MSV1_0_SUBAUTHENTICATION_DLL_IIS: ::ULONG = 132; -STRUCT!{struct MSV1_0_LM20_LOGON { - MessageType: MSV1_0_LOGON_SUBMIT_TYPE, - LogonDomainName: ::UNICODE_STRING, - UserName: ::UNICODE_STRING, - Workstation: ::UNICODE_STRING, - ChallengeToClient: [::UCHAR; MSV1_0_CHALLENGE_LENGTH], - CaseSensitiveChallengeResponse: ::STRING, - CaseInsensitiveChallengeResponse: ::STRING, - ParameterControl: ::ULONG, -}} -pub type PMSV1_0_LM20_LOGON = *mut MSV1_0_LM20_LOGON; -STRUCT!{struct MSV1_0_SUBAUTH_LOGON { - MessageType: MSV1_0_LOGON_SUBMIT_TYPE, - LogonDomainName: ::UNICODE_STRING, - UserName: ::UNICODE_STRING, - Workstation: ::UNICODE_STRING, - ChallengeToClient: [::UCHAR; MSV1_0_CHALLENGE_LENGTH], - AuthenticationInfo1: ::STRING, - AuthenticationInfo2: ::STRING, - ParameterControl: ::ULONG, - SubAuthPackageId: ::ULONG, -}} -pub type PMSV1_0_SUBAUTH_LOGON = *mut MSV1_0_SUBAUTH_LOGON; -STRUCT!{struct MSV1_0_S4U_LOGON { - MessageType: MSV1_0_LOGON_SUBMIT_TYPE, - MSV1_0_LOGON_SUBMIT_TYPE: ::ULONG, - UserPrincipalName: ::UNICODE_STRING, - DomainName: ::UNICODE_STRING, -}} -pub type PMSV1_0_S4U_LOGON = *mut MSV1_0_S4U_LOGON; -pub const LOGON_GUEST: ::ULONG = 0x01; -pub const LOGON_NOENCRYPTION: ::ULONG = 0x02; -pub const LOGON_CACHED_ACCOUNT: ::ULONG = 0x04; -pub const LOGON_USED_LM_PASSWORD: ::ULONG = 0x08; -pub const LOGON_EXTRA_SIDS: ::ULONG = 0x20; -pub const LOGON_SUBAUTH_SESSION_KEY: ::ULONG = 0x40; -pub const LOGON_SERVER_TRUST_ACCOUNT: ::ULONG = 0x80; -pub const LOGON_NTLMV2_ENABLED: ::ULONG = 0x100; -pub const LOGON_RESOURCE_GROUPS: ::ULONG = 0x200; -pub const LOGON_PROFILE_PATH_RETURNED: ::ULONG = 0x400; -pub const LOGON_NT_V2: ::ULONG = 0x800; -pub const LOGON_LM_V2: ::ULONG = 0x1000; -pub const LOGON_NTLM_V2: ::ULONG = 0x2000; -pub const LOGON_OPTIMIZED: ::ULONG = 0x4000; -pub const LOGON_WINLOGON: ::ULONG = 0x8000; -pub const LOGON_PKINIT: ::ULONG = 0x10000; -pub const LOGON_NO_OPTIMIZED: ::ULONG = 0x20000; -pub const LOGON_NO_ELEVATION: ::ULONG = 0x40000; -pub const LOGON_MANAGED_SERVICE: ::ULONG = 0x80000; -pub const LOGON_GRACE_LOGON: ::ULONG = 0x01000000; -STRUCT!{struct MSV1_0_LM20_LOGON_PROFILE { - MessageType: MSV1_0_PROFILE_BUFFER_TYPE, - KickOffTime: ::LARGE_INTEGER, - LogoffTime: ::LARGE_INTEGER, - UserFlags: ::ULONG, - UserSessionKey: [::UCHAR; MSV1_0_USER_SESSION_KEY_LENGTH], - LogonDomainName: ::UNICODE_STRING, - LanmanSessionKey: [::UCHAR; MSV1_0_LANMAN_SESSION_KEY_LENGTH], - LogonServer: ::UNICODE_STRING, - UserParameters: ::UNICODE_STRING, -}} -pub type PMSV1_0_LM20_LOGON_PROFILE = *mut MSV1_0_LM20_LOGON_PROFILE; -pub const MSV1_0_OWF_PASSWORD_LENGTH: usize = 16; -STRUCT!{struct MSV1_0_SUPPLEMENTAL_CREDENTIAL { - Version: ::ULONG, - Flags: ::ULONG, - LmPassword: [::UCHAR; MSV1_0_OWF_PASSWORD_LENGTH], - NtPassword: [::UCHAR; MSV1_0_OWF_PASSWORD_LENGTH], -}} -pub type PMSV1_0_SUPPLEMENTAL_CREDENTIAL = *mut MSV1_0_SUPPLEMENTAL_CREDENTIAL; -pub const MSV1_0_NTLM3_RESPONSE_LENGTH: usize = 16; -pub const MSV1_0_NTLM3_OWF_LENGTH: usize = 16; -STRUCT!{struct MSV1_0_NTLM3_RESPONSE { - Response: [::UCHAR; MSV1_0_NTLM3_RESPONSE_LENGTH], - RespType: ::UCHAR, - HiRespType: ::UCHAR, - Flags: ::USHORT, - MsgWord: ::ULONG, - TimeStamp: ::ULONGLONG, - ChallengeFromClient: [::UCHAR; MSV1_0_CHALLENGE_LENGTH], - AvPairsOff: ::ULONG, - Buffer: [::UCHAR; 1], -}} -pub type PMSV1_0_NTLM3_RESPONSE = *mut MSV1_0_NTLM3_RESPONSE; -ENUM!{enum MSV1_0_AVID { - MsvAvEOL, - MsvAvNbComputerName, - MsvAvNbDomainName, - MsvAvDnsComputerName, - MsvAvDnsDomainName, - MsvAvDnsTreeName, - MsvAvFlags, - MsvAvTimestamp, - MsvAvRestrictions, - MsvAvTargetName, - MsvAvChannelBindings, -}} -STRUCT!{struct MSV1_0_AV_PAIR { - AvId: ::USHORT, - AvLen: ::USHORT, -}} -pub type PMSV1_0_AV_PAIR = *mut MSV1_0_AV_PAIR; -ENUM!{enum MSV1_0_PROTOCOL_MESSAGE_TYPE { - MsV1_0Lm20ChallengeRequest = 0, - MsV1_0Lm20GetChallengeResponse, - MsV1_0EnumerateUsers, - MsV1_0GetUserInfo, - MsV1_0ReLogonUsers, - MsV1_0ChangePassword, - MsV1_0ChangeCachedPassword, - MsV1_0GenericPassthrough, - MsV1_0CacheLogon, - MsV1_0SubAuth, - MsV1_0DeriveCredential, - MsV1_0CacheLookup, - MsV1_0SetProcessOption, - MsV1_0ConfigLocalAliases, - MsV1_0ClearCachedCredentials, - MsV1_0LookupToken, - MsV1_0ValidateAuth, - MsV1_0CacheLookupEx, - MsV1_0GetCredentialKey, - MsV1_0SetThreadOption, -}} -pub type PMSV1_0_PROTOCOL_MESSAGE_TYPE = *mut MSV1_0_PROTOCOL_MESSAGE_TYPE; -STRUCT!{struct MSV1_0_CHANGEPASSWORD_REQUEST { - MessageType: MSV1_0_PROTOCOL_MESSAGE_TYPE, - DomainName: ::UNICODE_STRING, - AccountName: ::UNICODE_STRING, - OldPassword: ::UNICODE_STRING, - NewPassword: ::UNICODE_STRING, - Impersonating: ::BOOLEAN, -}} -pub type PMSV1_0_CHANGEPASSWORD_REQUEST = *mut MSV1_0_CHANGEPASSWORD_REQUEST; -STRUCT!{struct MSV1_0_CHANGEPASSWORD_RESPONSE { - MessageType: MSV1_0_PROTOCOL_MESSAGE_TYPE, - PasswordInfoValid: ::BOOLEAN, - DomainPasswordInfo: DOMAIN_PASSWORD_INFORMATION, -}} -pub type PMSV1_0_CHANGEPASSWORD_RESPONSE = *mut MSV1_0_CHANGEPASSWORD_RESPONSE; -STRUCT!{struct MSV1_0_PASSTHROUGH_REQUEST { - MessageType: MSV1_0_PROTOCOL_MESSAGE_TYPE, - DomainName: ::UNICODE_STRING, - PackageName: ::UNICODE_STRING, - DataLength: ::ULONG, - LogonData: ::PUCHAR, - Pad: ::ULONG, -}} -pub type PMSV1_0_PASSTHROUGH_REQUEST = *mut MSV1_0_PASSTHROUGH_REQUEST; -STRUCT!{struct MSV1_0_PASSTHROUGH_RESPONSE { - MessageType: MSV1_0_PROTOCOL_MESSAGE_TYPE, - Pad: ::ULONG, - DataLength: ::ULONG, - ValidationData: ::PUCHAR, -}} -pub type PMSV1_0_PASSTHROUGH_RESPONSE = *mut MSV1_0_PASSTHROUGH_RESPONSE; -STRUCT!{struct MSV1_0_SUBAUTH_REQUEST { - MessageType: MSV1_0_PROTOCOL_MESSAGE_TYPE, - SubAuthPackageId: ::ULONG, - SubAuthInfoLength: ::ULONG, - SubAuthSubmitBuffer: ::PUCHAR, -}} -pub type PMSV1_0_SUBAUTH_REQUEST = *mut MSV1_0_SUBAUTH_REQUEST; -STRUCT!{struct MSV1_0_SUBAUTH_RESPONSE { - MessageType: MSV1_0_PROTOCOL_MESSAGE_TYPE, - SubAuthInfoLength: ::ULONG, - SubAuthReturnBuffer: ::PUCHAR, -}} -pub type PMSV1_0_SUBAUTH_RESPONSE = *mut MSV1_0_SUBAUTH_RESPONSE; -pub const RTL_ENCRYPT_MEMORY_SIZE: ::ULONG = 8; -pub const RTL_ENCRYPT_OPTION_CROSS_PROCESS: ::ULONG = 0x01; -pub const RTL_ENCRYPT_OPTION_SAME_LOGON: ::ULONG = 0x02; -pub const KERB_ETYPE_NULL: ::LONG = 0; -pub const KERB_ETYPE_DES_CBC_CRC: ::LONG = 1; -pub const KERB_ETYPE_DES_CBC_MD4: ::LONG = 2; -pub const KERB_ETYPE_DES_CBC_MD5: ::LONG = 3; -pub const KERB_ETYPE_AES128_CTS_HMAC_SHA1_96: ::LONG = 17; -pub const KERB_ETYPE_AES256_CTS_HMAC_SHA1_96: ::LONG = 18; -pub const KERB_ETYPE_RC4_MD4: ::LONG = -128; -pub const KERB_ETYPE_RC4_PLAIN2: ::LONG = -129; -pub const KERB_ETYPE_RC4_LM: ::LONG = -130; -pub const KERB_ETYPE_RC4_SHA: ::LONG = -131; -pub const KERB_ETYPE_DES_PLAIN: ::LONG = -132; -pub const KERB_ETYPE_RC4_HMAC_OLD: ::LONG = -133; -pub const KERB_ETYPE_RC4_PLAIN_OLD: ::LONG = -134; -pub const KERB_ETYPE_RC4_HMAC_OLD_EXP: ::LONG = -135; -pub const KERB_ETYPE_RC4_PLAIN_OLD_EXP: ::LONG = -136; -pub const KERB_ETYPE_RC4_PLAIN: ::LONG = -140; -pub const KERB_ETYPE_RC4_PLAIN_EXP: ::LONG = -141; -pub const KERB_ETYPE_AES128_CTS_HMAC_SHA1_96_PLAIN: ::LONG = -148; -pub const KERB_ETYPE_AES256_CTS_HMAC_SHA1_96_PLAIN: ::LONG = -149; -pub const KERB_ETYPE_DSA_SHA1_CMS: ::LONG = 9; -pub const KERB_ETYPE_RSA_MD5_CMS: ::LONG = 10; -pub const KERB_ETYPE_RSA_SHA1_CMS: ::LONG = 11; -pub const KERB_ETYPE_RC2_CBC_ENV: ::LONG = 12; -pub const KERB_ETYPE_RSA_ENV: ::LONG = 13; -pub const KERB_ETYPE_RSA_ES_OEAP_ENV: ::LONG = 14; -pub const KERB_ETYPE_DES_EDE3_CBC_ENV: ::LONG = 15; -pub const KERB_ETYPE_DSA_SIGN: ::LONG = 8; -pub const KERB_ETYPE_RSA_PRIV: ::LONG = 9; -pub const KERB_ETYPE_RSA_PUB: ::LONG = 10; -pub const KERB_ETYPE_RSA_PUB_MD5: ::LONG = 11; -pub const KERB_ETYPE_RSA_PUB_SHA1: ::LONG = 12; -pub const KERB_ETYPE_PKCS7_PUB: ::LONG = 13; -pub const KERB_ETYPE_DES3_CBC_MD5: ::LONG = 5; -pub const KERB_ETYPE_DES3_CBC_SHA1: ::LONG = 7; -pub const KERB_ETYPE_DES3_CBC_SHA1_KD: ::LONG = 16; -pub const KERB_ETYPE_DES_CBC_MD5_NT: ::LONG = 20; -pub const KERB_ETYPE_RC4_HMAC_NT: ::LONG = 23; -pub const KERB_ETYPE_RC4_HMAC_NT_EXP: ::LONG = 24; -pub const KERB_CHECKSUM_NONE: ::LONG = 0; -pub const KERB_CHECKSUM_CRC32: ::LONG = 1; -pub const KERB_CHECKSUM_MD4: ::LONG = 2; -pub const KERB_CHECKSUM_KRB_DES_MAC: ::LONG = 4; -pub const KERB_CHECKSUM_KRB_DES_MAC_K: ::LONG = 5; -pub const KERB_CHECKSUM_MD5: ::LONG = 7; -pub const KERB_CHECKSUM_MD5_DES: ::LONG = 8; -pub const KERB_CHECKSUM_SHA1_NEW: ::LONG = 14; -pub const KERB_CHECKSUM_HMAC_SHA1_96_AES128: ::LONG = 15; -pub const KERB_CHECKSUM_HMAC_SHA1_96_AES256: ::LONG = 16; -pub const KERB_CHECKSUM_LM: ::LONG = -130; -pub const KERB_CHECKSUM_SHA1: ::LONG = -131; -pub const KERB_CHECKSUM_REAL_CRC32: ::LONG = -132; -pub const KERB_CHECKSUM_DES_MAC: ::LONG = -133; -pub const KERB_CHECKSUM_DES_MAC_MD5: ::LONG = -134; -pub const KERB_CHECKSUM_MD25: ::LONG = -135; -pub const KERB_CHECKSUM_RC4_MD5: ::LONG = -136; -pub const KERB_CHECKSUM_MD5_HMAC: ::LONG = -137; -pub const KERB_CHECKSUM_HMAC_MD5: ::LONG = -138; -pub const KERB_CHECKSUM_HMAC_SHA1_96_AES128_Ki: ::LONG = -150; -pub const KERB_CHECKSUM_HMAC_SHA1_96_AES256_Ki: ::LONG = -151; -pub const KERB_TICKET_FLAGS_reserved: ::ULONG = 0x80000000; -pub const KERB_TICKET_FLAGS_forwardable: ::ULONG = 0x40000000; -pub const KERB_TICKET_FLAGS_forwarded: ::ULONG = 0x20000000; -pub const KERB_TICKET_FLAGS_proxiable: ::ULONG = 0x10000000; -pub const KERB_TICKET_FLAGS_proxy: ::ULONG = 0x08000000; -pub const KERB_TICKET_FLAGS_may_postdate: ::ULONG = 0x04000000; -pub const KERB_TICKET_FLAGS_postdated: ::ULONG = 0x02000000; -pub const KERB_TICKET_FLAGS_invalid: ::ULONG = 0x01000000; -pub const KERB_TICKET_FLAGS_renewable: ::ULONG = 0x00800000; -pub const KERB_TICKET_FLAGS_initial: ::ULONG = 0x00400000; -pub const KERB_TICKET_FLAGS_pre_authent: ::ULONG = 0x00200000; -pub const KERB_TICKET_FLAGS_hw_authent: ::ULONG = 0x00100000; -pub const KERB_TICKET_FLAGS_ok_as_delegate: ::ULONG = 0x00040000; -pub const KERB_TICKET_FLAGS_name_canonicalize: ::ULONG = 0x00010000; -pub const KERB_TICKET_FLAGS_cname_in_pa_data: ::ULONG = 0x00040000; -pub const KERB_TICKET_FLAGS_enc_pa_rep: ::ULONG = 0x00010000; -pub const KERB_TICKET_FLAGS_reserved1: ::ULONG = 0x00000001; -pub const KRB_NT_UNKNOWN: ::LONG = 0; -pub const KRB_NT_PRINCIPAL: ::LONG = 1; -pub const KRB_NT_PRINCIPAL_AND_ID: ::LONG = -131; -pub const KRB_NT_SRV_INST: ::LONG = 2; -pub const KRB_NT_SRV_INST_AND_ID: ::LONG = -132; -pub const KRB_NT_SRV_HST: ::LONG = 3; -pub const KRB_NT_SRV_XHST: ::LONG = 4; -pub const KRB_NT_UID: ::LONG = 5; -pub const KRB_NT_ENTERPRISE_PRINCIPAL: ::LONG = 10; -pub const KRB_NT_WELLKNOWN: ::LONG = 11; -pub const KRB_NT_ENT_PRINCIPAL_AND_ID: ::LONG = -130; -pub const KRB_NT_MS_PRINCIPAL: ::LONG = -128; -pub const KRB_NT_MS_PRINCIPAL_AND_ID: ::LONG = -129; -pub const KRB_NT_MS_BRANCH_ID: ::LONG = -133; -pub const KRB_NT_X500_PRINCIPAL: ::LONG = 6; -pub const KERB_WRAP_NO_ENCRYPT: ::ULONG = 0x80000001; -ENUM!{enum KERB_LOGON_SUBMIT_TYPE { - KerbInteractiveLogon = 2, - KerbSmartCardLogon = 6, - KerbWorkstationUnlockLogon = 7, - KerbSmartCardUnlockLogon = 8, - KerbProxyLogon = 9, - KerbTicketLogon = 10, - KerbTicketUnlockLogon = 11, - KerbS4ULogon = 12, - KerbCertificateLogon = 13, - KerbCertificateS4ULogon = 14, - KerbCertificateUnlockLogon = 15, - KerbNoElevationLogon = 83, - KerbLuidLogon = 84, -}} -pub type PKERB_LOGON_SUBMIT_TYPE = *mut KERB_LOGON_SUBMIT_TYPE; -STRUCT!{struct KERB_INTERACTIVE_LOGON { - MessageType: KERB_LOGON_SUBMIT_TYPE, - LogonDomainName: ::UNICODE_STRING, - UserName: ::UNICODE_STRING, - Password: ::UNICODE_STRING, -}} -pub type PKERB_INTERACTIVE_LOGON = *mut KERB_INTERACTIVE_LOGON; -STRUCT!{struct KERB_INTERACTIVE_UNLOCK_LOGON { - Logon: KERB_INTERACTIVE_LOGON, - LogonId: ::LUID, -}} -pub type PKERB_INTERACTIVE_UNLOCK_LOGON = *mut KERB_INTERACTIVE_UNLOCK_LOGON; -STRUCT!{struct KERB_SMART_CARD_LOGON { - MessageType: KERB_LOGON_SUBMIT_TYPE, - Pin: ::UNICODE_STRING, - CspDataLength: ::ULONG, - CspData: ::PUCHAR, -}} -pub type PKERB_SMART_CARD_LOGON = *mut KERB_SMART_CARD_LOGON; -STRUCT!{struct KERB_SMART_CARD_UNLOCK_LOGON { - Logon: KERB_SMART_CARD_LOGON, - LogonId: ::LUID, -}} -pub type PKERB_SMART_CARD_UNLOCK_LOGON = *mut KERB_SMART_CARD_UNLOCK_LOGON; -pub const KERB_CERTIFICATE_LOGON_FLAG_CHECK_DUPLICATES: ::ULONG = 0x1; -pub const KERB_CERTIFICATE_LOGON_FLAG_USE_CERTIFICATE_INFO: ::ULONG = 0x2; -STRUCT!{struct KERB_CERTIFICATE_LOGON { - MessageType: KERB_LOGON_SUBMIT_TYPE, - DomainName: ::UNICODE_STRING, - UserName: ::UNICODE_STRING, - Pin: ::UNICODE_STRING, - Flags: ::ULONG, - CspDataLength: ::ULONG, - CspData: ::PUCHAR, -}} -pub type PKERB_CERTIFICATE_LOGON = *mut KERB_CERTIFICATE_LOGON; -STRUCT!{struct KERB_CERTIFICATE_UNLOCK_LOGON { - Logon: KERB_CERTIFICATE_LOGON, - LogonId: ::LUID, -}} -pub type PKERB_CERTIFICATE_UNLOCK_LOGON = *mut KERB_CERTIFICATE_UNLOCK_LOGON; -pub const KERB_CERTIFICATE_S4U_LOGON_FLAG_CHECK_DUPLICATES: ::ULONG = 0x1; -pub const KERB_CERTIFICATE_S4U_LOGON_FLAG_CHECK_LOGONHOURS: ::ULONG = 0x2; -pub const KERB_CERTIFICATE_S4U_LOGON_FLAG_FAIL_IF_NT_AUTH_POLICY_REQUIRED: ::ULONG = 0x4; -pub const KERB_CERTIFICATE_S4U_LOGON_FLAG_IDENTIFY: ::ULONG = 0x8; -STRUCT!{struct KERB_CERTIFICATE_S4U_LOGON { - MessageType: KERB_LOGON_SUBMIT_TYPE, - Flags: ::ULONG, - UserPrincipalName: ::UNICODE_STRING, - DomainName: ::UNICODE_STRING, - CertificateLength: ::ULONG, - Certificate: ::PUCHAR, -}} -pub type PKERB_CERTIFICATE_S4U_LOGON = *mut KERB_CERTIFICATE_S4U_LOGON; -STRUCT!{struct KERB_TICKET_LOGON { - MessageType: KERB_LOGON_SUBMIT_TYPE, - Flags: ::ULONG, - ServiceTicketLength: ::ULONG, - TicketGrantingTicketLength: ::ULONG, - ServiceTicket: ::PUCHAR, - TicketGrantingTicket: ::PUCHAR, -}} -pub type PKERB_TICKET_LOGON = *mut KERB_TICKET_LOGON; -STRUCT!{struct KERB_TICKET_UNLOCK_LOGON { - Logon: KERB_TICKET_LOGON, - LogonId: ::LUID, -}} -pub type PKERB_TICKET_UNLOCK_LOGON = *mut KERB_TICKET_UNLOCK_LOGON; -pub const KERB_S4U_LOGON_FLAG_CHECK_LOGONHOURS: ::ULONG = 0x2; -pub const KERB_S4U_LOGON_FLAG_IDENTIFY: ::ULONG = 0x8; -STRUCT!{struct KERB_S4U_LOGON { - MessageType: KERB_LOGON_SUBMIT_TYPE, - Flags: ::ULONG, - ClientUpn: ::UNICODE_STRING, - ClientRealm: ::UNICODE_STRING, -}} -pub type PKERB_S4U_LOGON = *mut KERB_S4U_LOGON; -ENUM!{enum KERB_PROFILE_BUFFER_TYPE { - KerbInteractiveProfile = 2, - KerbSmartCardProfile = 4, - KerbTicketProfile = 6, -}} -pub type PKERB_PROFILE_BUFFER_TYPE = *mut KERB_PROFILE_BUFFER_TYPE; -STRUCT!{struct KERB_INTERACTIVE_PROFILE { - MessageType: KERB_PROFILE_BUFFER_TYPE, - LogonCount: ::USHORT, - BadPasswordCount: ::USHORT, - LogonTime: ::LARGE_INTEGER, - LogoffTime: ::LARGE_INTEGER, - KickOffTime: ::LARGE_INTEGER, - PasswordLastSet: ::LARGE_INTEGER, - PasswordCanChange: ::LARGE_INTEGER, - PasswordMustChange: ::LARGE_INTEGER, - LogonScript: ::UNICODE_STRING, - HomeDirectory: ::UNICODE_STRING, - FullName: ::UNICODE_STRING, - ProfilePath: ::UNICODE_STRING, - HomeDirectoryDrive: ::UNICODE_STRING, - LogonServer: ::UNICODE_STRING, - UserFlags: ::ULONG, -}} -pub type PKERB_INTERACTIVE_PROFILE = *mut KERB_INTERACTIVE_PROFILE; -STRUCT!{struct KERB_SMART_CARD_PROFILE { - Profile: KERB_INTERACTIVE_PROFILE, - CertificateSize: ::ULONG, - CertificateData: ::PUCHAR, -}} -pub type PKERB_SMART_CARD_PROFILE = *mut KERB_SMART_CARD_PROFILE; -STRUCT!{struct KERB_CRYPTO_KEY { - KeyType: ::LONG, - Length: ::ULONG, - Value: ::PUCHAR, -}} -pub type PKERB_CRYPTO_KEY = *mut KERB_CRYPTO_KEY; -STRUCT!{struct KERB_CRYPTO_KEY32 { - KeyType: ::LONG, - Length: ::ULONG, - Offset: ::ULONG, -}} -pub type PKERB_CRYPTO_KEY32 = *mut KERB_CRYPTO_KEY32; -STRUCT!{struct KERB_TICKET_PROFILE { - Profile: KERB_INTERACTIVE_PROFILE, - SessionKey: KERB_CRYPTO_KEY, -}} -pub type PKERB_TICKET_PROFILE = *mut KERB_TICKET_PROFILE; -ENUM!{enum KERB_PROTOCOL_MESSAGE_TYPE { - KerbDebugRequestMessage = 0, - KerbQueryTicketCacheMessage, - KerbChangeMachinePasswordMessage, - KerbVerifyPacMessage, - KerbRetrieveTicketMessage, - KerbUpdateAddressesMessage, - KerbPurgeTicketCacheMessage, - KerbChangePasswordMessage, - KerbRetrieveEncodedTicketMessage, - KerbDecryptDataMessage, - KerbAddBindingCacheEntryMessage, - KerbSetPasswordMessage, - KerbSetPasswordExMessage, - KerbVerifyCredentialsMessage, - KerbQueryTicketCacheExMessage, - KerbPurgeTicketCacheExMessage, - KerbRefreshSmartcardCredentialsMessage, - KerbAddExtraCredentialsMessage, - KerbQuerySupplementalCredentialsMessage, - KerbTransferCredentialsMessage, - KerbQueryTicketCacheEx2Message, - KerbSubmitTicketMessage, - KerbAddExtraCredentialsExMessage, - KerbQueryKdcProxyCacheMessage, - KerbPurgeKdcProxyCacheMessage, - KerbQueryTicketCacheEx3Message, - KerbCleanupMachinePkinitCredsMessage, - KerbAddBindingCacheEntryExMessage, - KerbQueryBindingCacheMessage, - KerbPurgeBindingCacheMessage, - KerbPinKdcMessage, - KerbUnpinAllKdcsMessage, - KerbQueryDomainExtendedPoliciesMessage, - KerbQueryS4U2ProxyCacheMessage, -}} -pub type PKERB_PROTOCOL_MESSAGE_TYPE = *mut KERB_PROTOCOL_MESSAGE_TYPE; -STRUCT!{struct KERB_QUERY_TKT_CACHE_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - LogonId: ::LUID, -}} -pub type PKERB_QUERY_TKT_CACHE_REQUEST = *mut KERB_QUERY_TKT_CACHE_REQUEST; -STRUCT!{struct KERB_TICKET_CACHE_INFO { - ServerName: ::UNICODE_STRING, - RealmName: ::UNICODE_STRING, - StartTime: ::LARGE_INTEGER, - EndTime: ::LARGE_INTEGER, - RenewTime: ::LARGE_INTEGER, - EncryptionType: ::LONG, - TicketFlags: ::ULONG, -}} -pub type PKERB_TICKET_CACHE_INFO = *mut KERB_TICKET_CACHE_INFO; -STRUCT!{struct KERB_TICKET_CACHE_INFO_EX { - ClientName: ::UNICODE_STRING, - ClientRealm: ::UNICODE_STRING, - ServerName: ::UNICODE_STRING, - ServerRealm: ::UNICODE_STRING, - StartTime: ::LARGE_INTEGER, - EndTime: ::LARGE_INTEGER, - RenewTime: ::LARGE_INTEGER, - EncryptionType: ::LONG, - TicketFlags: ::ULONG, -}} -pub type PKERB_TICKET_CACHE_INFO_EX = *mut KERB_TICKET_CACHE_INFO_EX; -STRUCT!{struct KERB_TICKET_CACHE_INFO_EX2 { - ClientName: ::UNICODE_STRING, - ClientRealm: ::UNICODE_STRING, - ServerName: ::UNICODE_STRING, - ServerRealm: ::UNICODE_STRING, - StartTime: ::LARGE_INTEGER, - EndTime: ::LARGE_INTEGER, - RenewTime: ::LARGE_INTEGER, - EncryptionType: ::LONG, - TicketFlags: ::ULONG, - SessionKeyType: ::ULONG, - BranchId: ::ULONG, -}} -pub type PKERB_TICKET_CACHE_INFO_EX2 = *mut KERB_TICKET_CACHE_INFO_EX2; -STRUCT!{struct KERB_TICKET_CACHE_INFO_EX3 { - ClientName: ::UNICODE_STRING, - ClientRealm: ::UNICODE_STRING, - ServerName: ::UNICODE_STRING, - ServerRealm: ::UNICODE_STRING, - StartTime: ::LARGE_INTEGER, - EndTime: ::LARGE_INTEGER, - RenewTime: ::LARGE_INTEGER, - EncryptionType: ::LONG, - TicketFlags: ::ULONG, - SessionKeyType: ::ULONG, - BranchId: ::ULONG, - CacheFlags: ::ULONG, - KdcCalled: ::UNICODE_STRING, -}} -pub type PKERB_TICKET_CACHE_INFO_EX3 = *mut KERB_TICKET_CACHE_INFO_EX3; -STRUCT!{struct KERB_QUERY_TKT_CACHE_RESPONSE { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - CountOfTickets: ::ULONG, - Tickets: [KERB_TICKET_CACHE_INFO; ::ANYSIZE_ARRAY], -}} -pub type PKERB_QUERY_TKT_CACHE_RESPONSE = *mut KERB_QUERY_TKT_CACHE_RESPONSE; -STRUCT!{struct KERB_QUERY_TKT_CACHE_EX_RESPONSE { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - CountOfTickets: ::ULONG, - Tickets: [KERB_TICKET_CACHE_INFO_EX; ::ANYSIZE_ARRAY], -}} -pub type PKERB_QUERY_TKT_CACHE_EX_RESPONSE = *mut KERB_QUERY_TKT_CACHE_EX_RESPONSE; -STRUCT!{struct KERB_QUERY_TKT_CACHE_EX2_RESPONSE { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - CountOfTickets: ::ULONG, - Tickets: [KERB_TICKET_CACHE_INFO_EX2; ::ANYSIZE_ARRAY], -}} -pub type PKERB_QUERY_TKT_CACHE_EX2_RESPONSE = *mut KERB_QUERY_TKT_CACHE_EX2_RESPONSE; -STRUCT!{struct KERB_QUERY_TKT_CACHE_EX3_RESPONSE { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - CountOfTickets: ::ULONG, - Tickets: [KERB_TICKET_CACHE_INFO_EX3; ::ANYSIZE_ARRAY], -}} -pub type PKERB_QUERY_TKT_CACHE_EX3_RESPONSE = *mut KERB_QUERY_TKT_CACHE_EX3_RESPONSE; -pub const KERB_USE_DEFAULT_TICKET_FLAGS: ::ULONG = 0x0; -pub const KERB_RETRIEVE_TICKET_DEFAULT: ::ULONG = 0x0; -pub const KERB_RETRIEVE_TICKET_DONT_USE_CACHE: ::ULONG = 0x1; -pub const KERB_RETRIEVE_TICKET_USE_CACHE_ONLY: ::ULONG = 0x2; -pub const KERB_RETRIEVE_TICKET_USE_CREDHANDLE: ::ULONG = 0x4; -pub const KERB_RETRIEVE_TICKET_AS_KERB_CRED: ::ULONG = 0x8; -pub const KERB_RETRIEVE_TICKET_WITH_SEC_CRED: ::ULONG = 0x10; -pub const KERB_RETRIEVE_TICKET_CACHE_TICKET: ::ULONG = 0x20; -pub const KERB_RETRIEVE_TICKET_MAX_LIFETIME: ::ULONG = 0x40; -STRUCT!{struct KERB_AUTH_DATA { - Type: ::ULONG, - Length: ::ULONG, - Data: ::PUCHAR, -}} -pub type PKERB_AUTH_DATA = *mut KERB_AUTH_DATA; -STRUCT!{struct KERB_NET_ADDRESS { - Family: ::ULONG, - Length: ::ULONG, - Address: ::PUCHAR, -}} -pub type PKERB_NET_ADDRESS = *mut KERB_NET_ADDRESS; -STRUCT!{struct KERB_NET_ADDRESSES { - Number: ::ULONG, - Addresses: [KERB_NET_ADDRESS; ::ANYSIZE_ARRAY], -}} -pub type PKERB_NET_ADDRESSES = *mut KERB_NET_ADDRESSES; -STRUCT!{struct KERB_EXTERNAL_NAME { - NameType: ::SHORT, - NameCount: ::USHORT, - Names: [::UNICODE_STRING; ::ANYSIZE_ARRAY], -}} -pub type PKERB_EXTERNAL_NAME = *mut KERB_EXTERNAL_NAME; -STRUCT!{struct KERB_EXTERNAL_TICKET { - ServiceName: PKERB_EXTERNAL_NAME, - TargetName: PKERB_EXTERNAL_NAME, - ClientName: PKERB_EXTERNAL_NAME, - DomainName: ::UNICODE_STRING, - TargetDomainName: ::UNICODE_STRING, - AltTargetDomainName: ::UNICODE_STRING, - SessionKey: KERB_CRYPTO_KEY, - TicketFlags: ::ULONG, - Flags: ::ULONG, - KeyExpirationTime: ::LARGE_INTEGER, - StartTime: ::LARGE_INTEGER, - EndTime: ::LARGE_INTEGER, - RenewUntil: ::LARGE_INTEGER, - TimeSkew: ::LARGE_INTEGER, - EncodedTicketSize: ::ULONG, - EncodedTicket: ::PUCHAR, -}} -pub type PKERB_EXTERNAL_TICKET = *mut KERB_EXTERNAL_TICKET; -STRUCT!{struct KERB_RETRIEVE_TKT_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - LogonId: ::LUID, - TargetName: ::UNICODE_STRING, - TicketFlags: ::ULONG, - CacheOptions: ::ULONG, - EncryptionType: ::LONG, - CredentialsHandle: ::SecHandle, -}} -pub type PKERB_RETRIEVE_TKT_REQUEST = *mut KERB_RETRIEVE_TKT_REQUEST; -STRUCT!{struct KERB_RETRIEVE_TKT_RESPONSE { - Ticket: KERB_EXTERNAL_TICKET, -}} -pub type PKERB_RETRIEVE_TKT_RESPONSE = *mut KERB_RETRIEVE_TKT_RESPONSE; -STRUCT!{struct KERB_PURGE_TKT_CACHE_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - LogonId: ::LUID, - ServerName: ::UNICODE_STRING, - RealmName: ::UNICODE_STRING, -}} -pub type PKERB_PURGE_TKT_CACHE_REQUEST = *mut KERB_PURGE_TKT_CACHE_REQUEST; -pub const KERB_PURGE_ALL_TICKETS: ::ULONG = 1; -STRUCT!{struct KERB_PURGE_TKT_CACHE_EX_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - LogonId: ::LUID, - Flags: ::ULONG, - TicketTemplate: KERB_TICKET_CACHE_INFO_EX, -}} -pub type PKERB_PURGE_TKT_CACHE_EX_REQUEST = *mut KERB_PURGE_TKT_CACHE_EX_REQUEST; -STRUCT!{struct KERB_SUBMIT_TKT_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - LogonId: ::LUID, - Flags: ::ULONG, - Key: KERB_CRYPTO_KEY32, - KerbCredSize: ::ULONG, - KerbCredOffset: ::ULONG, -}} -pub type PKERB_SUBMIT_TKT_REQUEST = *mut KERB_SUBMIT_TKT_REQUEST; -STRUCT!{struct KERB_QUERY_KDC_PROXY_CACHE_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - Flags: ::ULONG, - LogonId: ::LUID, -}} -pub type PKERB_QUERY_KDC_PROXY_CACHE_REQUEST = *mut KERB_QUERY_KDC_PROXY_CACHE_REQUEST; -STRUCT!{struct KDC_PROXY_CACHE_ENTRY_DATA { - SinceLastUsed: ::ULONG64, - DomainName: ::UNICODE_STRING, - ProxyServerName: ::UNICODE_STRING, - ProxyServerVdir: ::UNICODE_STRING, - ProxyServerPort: ::USHORT, - LogonId: ::LUID, - CredUserName: ::UNICODE_STRING, - CredDomainName: ::UNICODE_STRING, - GlobalCache: ::BOOLEAN, -}} -pub type PKDC_PROXY_CACHE_ENTRY_DATA = *mut KDC_PROXY_CACHE_ENTRY_DATA; -STRUCT!{struct KERB_QUERY_KDC_PROXY_CACHE_RESPONSE { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - CountOfEntries: ::ULONG, - Entries: PKDC_PROXY_CACHE_ENTRY_DATA, -}} -pub type PKERB_QUERY_KDC_PROXY_CACHE_RESPONSE = *mut KERB_QUERY_KDC_PROXY_CACHE_RESPONSE; -STRUCT!{struct KERB_PURGE_KDC_PROXY_CACHE_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - Flags: ::ULONG, - LogonId: ::LUID, -}} -pub type PKERB_PURGE_KDC_PROXY_CACHE_REQUEST = *mut KERB_PURGE_KDC_PROXY_CACHE_REQUEST; -STRUCT!{struct KERB_PURGE_KDC_PROXY_CACHE_RESPONSE { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - CountOfPurged: ::ULONG, -}} -pub type PKERB_PURGE_KDC_PROXY_CACHE_RESPONSE = *mut KERB_PURGE_KDC_PROXY_CACHE_RESPONSE; -pub const KERB_S4U2PROXY_CACHE_ENTRY_INFO_FLAG_NEGATIVE: ::ULONG = 0x1; -STRUCT!{struct KERB_S4U2PROXY_CACHE_ENTRY_INFO { - ServerName: ::UNICODE_STRING, - Flags: ::ULONG, - LastStatus: ::NTSTATUS, - Expiry: ::LARGE_INTEGER, -}} -pub type PKERB_S4U2PROXY_CACHE_ENTRY_INFO = *mut KERB_S4U2PROXY_CACHE_ENTRY_INFO; -pub const KERB_S4U2PROXY_CRED_FLAG_NEGATIVE: ::ULONG = 0x1; -STRUCT!{struct KERB_S4U2PROXY_CRED { - UserName: ::UNICODE_STRING, - DomainName: ::UNICODE_STRING, - Flags: ::ULONG, - LastStatus: ::NTSTATUS, - Expiry: ::LARGE_INTEGER, - CountOfEntries: ::ULONG, - Entries: PKERB_S4U2PROXY_CACHE_ENTRY_INFO, -}} -pub type PKERB_S4U2PROXY_CRED = *mut KERB_S4U2PROXY_CRED; -STRUCT!{struct KERB_QUERY_S4U2PROXY_CACHE_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - Flags: ::ULONG, - LogonId: ::LUID, -}} -pub type PKERB_QUERY_S4U2PROXY_CACHE_REQUEST = *mut KERB_QUERY_S4U2PROXY_CACHE_REQUEST; -STRUCT!{struct KERB_QUERY_S4U2PROXY_CACHE_RESPONSE { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - CountOfCreds: ::ULONG, - Creds: PKERB_S4U2PROXY_CRED, -}} -pub type PKERB_QUERY_S4U2PROXY_CACHE_RESPONSE = *mut KERB_QUERY_S4U2PROXY_CACHE_RESPONSE; -STRUCT!{struct KERB_CHANGEPASSWORD_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - DomainName: ::UNICODE_STRING, - AccountName: ::UNICODE_STRING, - OldPassword: ::UNICODE_STRING, - NewPassword: ::UNICODE_STRING, - Impersonating: ::BOOLEAN, -}} -pub type PKERB_CHANGEPASSWORD_REQUEST = *mut KERB_CHANGEPASSWORD_REQUEST; -STRUCT!{struct KERB_SETPASSWORD_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - LogonId: ::LUID, - CredentialsHandle: ::SecHandle, - Flags: ::ULONG, - DomainName: ::UNICODE_STRING, - AccountName: ::UNICODE_STRING, - Password: ::UNICODE_STRING, -}} -pub type PKERB_SETPASSWORD_REQUEST = *mut KERB_SETPASSWORD_REQUEST; -STRUCT!{struct KERB_SETPASSWORD_EX_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - LogonId: ::LUID, - CredentialsHandle: ::SecHandle, - Flags: ::ULONG, - AccountRealm: ::UNICODE_STRING, - AccountName: ::UNICODE_STRING, - Password: ::UNICODE_STRING, - ClientRealm: ::UNICODE_STRING, - ClientName: ::UNICODE_STRING, - Impersonating: ::BOOLEAN, - KdcAddress: ::UNICODE_STRING, - KdcAddressType: ::ULONG, -}} -pub type PKERB_SETPASSWORD_EX_REQUEST = *mut KERB_SETPASSWORD_EX_REQUEST; -pub const DS_UNKNOWN_ADDRESS_TYPE: ::ULONG = 0; -pub const KERB_SETPASS_USE_LOGONID: ::ULONG = 1; -pub const KERB_SETPASS_USE_CREDHANDLE: ::ULONG = 2; -STRUCT!{struct KERB_DECRYPT_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - LogonId: ::LUID, - Flags: ::ULONG, - CryptoType: ::LONG, - KeyUsage: ::LONG, - Key: KERB_CRYPTO_KEY, - EncryptedDataSize: ::ULONG, - InitialVectorSize: ::ULONG, - InitialVector: ::PUCHAR, - EncryptedData: ::PUCHAR, -}} -pub type PKERB_DECRYPT_REQUEST = *mut KERB_DECRYPT_REQUEST; -pub const KERB_DECRYPT_FLAG_DEFAULT_KEY: ::ULONG = 0x00000001; -STRUCT!{struct KERB_DECRYPT_RESPONSE { - DecryptedData: [::UCHAR; ::ANYSIZE_ARRAY], -}} -pub type PKERB_DECRYPT_RESPONSE = *mut KERB_DECRYPT_RESPONSE; -STRUCT!{struct KERB_ADD_BINDING_CACHE_ENTRY_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - RealmName: ::UNICODE_STRING, - KdcAddress: ::UNICODE_STRING, - AddressType: ::ULONG, -}} -pub type PKERB_ADD_BINDING_CACHE_ENTRY_REQUEST = *mut KERB_ADD_BINDING_CACHE_ENTRY_REQUEST; -STRUCT!{struct KERB_REFRESH_SCCRED_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - CredentialBlob: ::UNICODE_STRING, - LogonId: ::LUID, - Flags: ::ULONG, -}} -pub type PKERB_REFRESH_SCCRED_REQUEST = *mut KERB_REFRESH_SCCRED_REQUEST; -pub const KERB_REFRESH_SCCRED_RELEASE: ::ULONG = 0x0; -pub const KERB_REFRESH_SCCRED_GETTGT: ::ULONG = 0x1; -STRUCT!{struct KERB_ADD_CREDENTIALS_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - UserName: ::UNICODE_STRING, - DomainName: ::UNICODE_STRING, - Password: ::UNICODE_STRING, - LogonId: ::LUID, - Flags: ::ULONG, -}} -pub type PKERB_ADD_CREDENTIALS_REQUEST = *mut KERB_ADD_CREDENTIALS_REQUEST; -pub const KERB_REQUEST_ADD_CREDENTIAL: ::ULONG = 1; -pub const KERB_REQUEST_REPLACE_CREDENTIAL: ::ULONG = 2; -pub const KERB_REQUEST_REMOVE_CREDENTIAL: ::ULONG = 4; -STRUCT!{struct KERB_ADD_CREDENTIALS_REQUEST_EX { - Credentials: KERB_ADD_CREDENTIALS_REQUEST, - PrincipalNameCount: ::ULONG, - PrincipalNames: [::UNICODE_STRING; ::ANYSIZE_ARRAY], -}} -pub type PKERB_ADD_CREDENTIALS_REQUEST_EX = *mut KERB_ADD_CREDENTIALS_REQUEST_EX; -STRUCT!{struct KERB_TRANSFER_CRED_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - OriginLogonId: ::LUID, - DestinationLogonId: ::LUID, - Flags: ::ULONG, -}} -pub type PKERB_TRANSFER_CRED_REQUEST = *mut KERB_TRANSFER_CRED_REQUEST; -pub const KERB_TRANSFER_CRED_WITH_TICKETS: ::ULONG = 0x1; -pub const KERB_TRANSFER_CRED_CLEANUP_CREDENTIALS: ::ULONG = 0x2; -STRUCT!{struct KERB_CLEANUP_MACHINE_PKINIT_CREDS_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - LogonId: ::LUID, -}} -pub type PKERB_CLEANUP_MACHINE_PKINIT_CREDS_REQUEST = - *mut KERB_CLEANUP_MACHINE_PKINIT_CREDS_REQUEST; -STRUCT!{struct KERB_BINDING_CACHE_ENTRY_DATA { - DiscoveryTime: ::ULONG64, - RealmName: ::UNICODE_STRING, - KdcAddress: ::UNICODE_STRING, - AddressType: ::ULONG, - Flags: ::ULONG, - DcFlags: ::ULONG, - CacheFlags: ::ULONG, - KdcName: ::UNICODE_STRING, -}} -pub type PKERB_BINDING_CACHE_ENTRY_DATA = *mut KERB_BINDING_CACHE_ENTRY_DATA; -STRUCT!{struct KERB_QUERY_BINDING_CACHE_RESPONSE { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - CountOfEntries: ::ULONG, - Entries: PKERB_BINDING_CACHE_ENTRY_DATA, -}} -pub type PKERB_QUERY_BINDING_CACHE_RESPONSE = *mut KERB_QUERY_BINDING_CACHE_RESPONSE; -STRUCT!{struct KERB_ADD_BINDING_CACHE_ENTRY_EX_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - RealmName: ::UNICODE_STRING, - KdcAddress: ::UNICODE_STRING, - AddressType: ::ULONG, - DcFlags: ::ULONG, -}} -pub type PKERB_ADD_BINDING_CACHE_ENTRY_EX_REQUEST = *mut KERB_ADD_BINDING_CACHE_ENTRY_EX_REQUEST; -STRUCT!{struct KERB_QUERY_BINDING_CACHE_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, -}} -pub type PKERB_QUERY_BINDING_CACHE_REQUEST = *mut KERB_QUERY_BINDING_CACHE_REQUEST; -STRUCT!{struct KERB_PURGE_BINDING_CACHE_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, -}} -pub type PKERB_PURGE_BINDING_CACHE_REQUEST = *mut KERB_PURGE_BINDING_CACHE_REQUEST; -STRUCT!{struct KERB_QUERY_DOMAIN_EXTENDED_POLICIES_REQUEST { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - Flags: ::ULONG, - DomainName: ::UNICODE_STRING, -}} -pub type PKERB_QUERY_DOMAIN_EXTENDED_POLICIES_REQUEST = - *mut KERB_QUERY_DOMAIN_EXTENDED_POLICIES_REQUEST; -STRUCT!{struct KERB_QUERY_DOMAIN_EXTENDED_POLICIES_RESPONSE { - MessageType: KERB_PROTOCOL_MESSAGE_TYPE, - Flags: ::ULONG, - ExtendedPolicies: ::ULONG, - DsFlags: ::ULONG, -}} -pub type PKERB_QUERY_DOMAIN_EXTENDED_POLICIES_RESPONSE = - *mut KERB_QUERY_DOMAIN_EXTENDED_POLICIES_RESPONSE; -ENUM!{enum KERB_CERTIFICATE_INFO_TYPE { - CertHashInfo = 1, -}} -pub type PKERB_CERTIFICATE_INFO_TYPE = *mut KERB_CERTIFICATE_INFO_TYPE; -STRUCT!{struct KERB_CERTIFICATE_HASHINFO { - StoreNameLength: ::USHORT, - HashLength: ::USHORT, -}} -pub type PKERB_CERTIFICATE_HASHINFO = *mut KERB_CERTIFICATE_HASHINFO; -STRUCT!{struct KERB_CERTIFICATE_INFO { - CertInfoSize: ::ULONG, - InfoType: ::ULONG, -}} -pub type PKERB_CERTIFICATE_INFO = *mut KERB_CERTIFICATE_INFO; -STRUCT!{struct POLICY_AUDIT_SID_ARRAY { - UsersCount: ::ULONG, - UserSidArray: *mut ::PSID, -}} -pub type PPOLICY_AUDIT_SID_ARRAY = *mut POLICY_AUDIT_SID_ARRAY; -STRUCT!{struct AUDIT_POLICY_INFORMATION { - AuditSubCategoryGuid: ::GUID, - AuditingInformation: ::ULONG, - AuditCategoryGuid: ::GUID, -}} -pub type PAUDIT_POLICY_INFORMATION = *mut AUDIT_POLICY_INFORMATION; -pub type LPAUDIT_POLICY_INFORMATION = PAUDIT_POLICY_INFORMATION; -pub type PCAUDIT_POLICY_INFORMATION = *const AUDIT_POLICY_INFORMATION; -pub const AUDIT_SET_SYSTEM_POLICY: ::ULONG = 0x0001; -pub const AUDIT_QUERY_SYSTEM_POLICY: ::ULONG = 0x0002; -pub const AUDIT_SET_USER_POLICY: ::ULONG = 0x0004; -pub const AUDIT_QUERY_USER_POLICY: ::ULONG = 0x0008; -pub const AUDIT_ENUMERATE_USERS: ::ULONG = 0x0010; -pub const AUDIT_SET_MISC_POLICY: ::ULONG = 0x0020; -pub const AUDIT_QUERY_MISC_POLICY: ::ULONG = 0x0040; -pub const AUDIT_GENERIC_ALL: ::ULONG = ::STANDARD_RIGHTS_REQUIRED | AUDIT_SET_SYSTEM_POLICY - | AUDIT_QUERY_SYSTEM_POLICY | AUDIT_SET_USER_POLICY | AUDIT_QUERY_USER_POLICY - | AUDIT_ENUMERATE_USERS | AUDIT_SET_MISC_POLICY | AUDIT_QUERY_MISC_POLICY; -pub const AUDIT_GENERIC_READ: ::ULONG = ::STANDARD_RIGHTS_READ | AUDIT_QUERY_SYSTEM_POLICY - | AUDIT_QUERY_USER_POLICY | AUDIT_ENUMERATE_USERS | AUDIT_QUERY_MISC_POLICY; -pub const AUDIT_GENERIC_WRITE: ::ULONG = ::STANDARD_RIGHTS_WRITE | AUDIT_SET_USER_POLICY - | AUDIT_SET_MISC_POLICY | AUDIT_SET_SYSTEM_POLICY; -pub const AUDIT_GENERIC_EXECUTE: ::ULONG = ::STANDARD_RIGHTS_EXECUTE; -STRUCT!{struct PKU2U_CERT_BLOB { - CertOffset: ::ULONG, - CertLength: ::USHORT, -}} -pub type PPKU2U_CERT_BLOB = *mut PKU2U_CERT_BLOB; -pub const PKU2U_CREDUI_CONTEXT_VERSION: ::ULONG64 = 0x4154414454524543; -STRUCT!{struct PKU2U_CREDUI_CONTEXT { - Version: ::ULONG64, - cbHeaderLength: ::USHORT, - cbStructureLength: ::ULONG, - CertArrayCount: ::USHORT, - CertArrayOffset: ::ULONG, -}} -pub type PPKU2U_CREDUI_CONTEXT = *mut PKU2U_CREDUI_CONTEXT; -ENUM!{enum PKU2U_LOGON_SUBMIT_TYPE { - Pku2uCertificateS4ULogon = 14, -}} -pub type PPKU2U_LOGON_SUBMIT_TYPE = *mut PKU2U_LOGON_SUBMIT_TYPE; -STRUCT!{struct PKU2U_CERTIFICATE_S4U_LOGON { - MessageType: PKU2U_LOGON_SUBMIT_TYPE, - Flags: ::ULONG, - UserPrincipalName: ::UNICODE_STRING, - DomainName: ::UNICODE_STRING, - CertificateLength: ::ULONG, - Certificate: ::PUCHAR, -}} -pub type PPKU2U_CERTIFICATE_S4U_LOGON = *mut PKU2U_CERTIFICATE_S4U_LOGON; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/ntstatus.rs cargo-0.37.0/vendor/winapi-0.2.8/src/ntstatus.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/ntstatus.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/ntstatus.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,2474 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Constant definitions for the NTSTATUS values. -pub const STATUS_WAIT_0: ::NTSTATUS = 0x00000000; -pub const FACILITY_VSM: ::NTSTATUS = 0x45; -pub const FACILITY_VOLSNAP: ::NTSTATUS = 0x50; -pub const FACILITY_VOLMGR: ::NTSTATUS = 0x38; -pub const FACILITY_VIRTUALIZATION: ::NTSTATUS = 0x37; -pub const FACILITY_VIDEO: ::NTSTATUS = 0x1B; -pub const FACILITY_USB_ERROR_CODE: ::NTSTATUS = 0x10; -pub const FACILITY_TRANSACTION: ::NTSTATUS = 0x19; -pub const FACILITY_TPM: ::NTSTATUS = 0x29; -pub const FACILITY_TERMINAL_SERVER: ::NTSTATUS = 0xA; -pub const FACILITY_SXS_ERROR_CODE: ::NTSTATUS = 0x15; -pub const FACILITY_NTSSPI: ::NTSTATUS = 0x9; -pub const FACILITY_SPACES: ::NTSTATUS = 0xE7; -pub const FACILITY_SMB: ::NTSTATUS = 0x5D; -pub const FACILITY_SYSTEM_INTEGRITY: ::NTSTATUS = 0xE9; -pub const FACILITY_SHARED_VHDX: ::NTSTATUS = 0x5C; -pub const FACILITY_SECUREBOOT: ::NTSTATUS = 0x43; -pub const FACILITY_SECURITY_CORE: ::NTSTATUS = 0xE8; -pub const FACILITY_SDBUS: ::NTSTATUS = 0x51; -pub const FACILITY_RTPM: ::NTSTATUS = 0x2A; -pub const FACILITY_RPC_STUBS: ::NTSTATUS = 0x3; -pub const FACILITY_RPC_RUNTIME: ::NTSTATUS = 0x2; -pub const FACILITY_RESUME_KEY_FILTER: ::NTSTATUS = 0x40; -pub const FACILITY_RDBSS: ::NTSTATUS = 0x41; -pub const FACILITY_NTWIN32: ::NTSTATUS = 0x7; -pub const FACILITY_WIN32K_NTUSER: ::NTSTATUS = 0x3E; -pub const FACILITY_WIN32K_NTGDI: ::NTSTATUS = 0x3F; -pub const FACILITY_NDIS_ERROR_CODE: ::NTSTATUS = 0x23; -pub const FACILTIY_MUI_ERROR_CODE: ::NTSTATUS = 0xB; -pub const FACILITY_MONITOR: ::NTSTATUS = 0x1D; -pub const FACILITY_MAXIMUM_VALUE: ::NTSTATUS = 0xEB; -pub const FACILITY_LICENSING: ::NTSTATUS = 0xEA; -pub const FACILITY_IPSEC: ::NTSTATUS = 0x36; -pub const FACILITY_IO_ERROR_CODE: ::NTSTATUS = 0x4; -pub const FACILITY_INTERIX: ::NTSTATUS = 0x99; -pub const FACILITY_HYPERVISOR: ::NTSTATUS = 0x35; -pub const FACILITY_HID_ERROR_CODE: ::NTSTATUS = 0x11; -pub const FACILITY_GRAPHICS_KERNEL: ::NTSTATUS = 0x1E; -pub const FACILITY_FWP_ERROR_CODE: ::NTSTATUS = 0x22; -pub const FACILITY_FVE_ERROR_CODE: ::NTSTATUS = 0x21; -pub const FACILITY_FIREWIRE_ERROR_CODE: ::NTSTATUS = 0x12; -pub const FACILITY_FILTER_MANAGER: ::NTSTATUS = 0x1C; -pub const FACILITY_DRIVER_FRAMEWORK: ::NTSTATUS = 0x20; -pub const FACILITY_DEBUGGER: ::NTSTATUS = 0x1; -pub const FACILITY_COMMONLOG: ::NTSTATUS = 0x1A; -pub const FACILITY_CODCLASS_ERROR_CODE: ::NTSTATUS = 0x6; -pub const FACILITY_CLUSTER_ERROR_CODE: ::NTSTATUS = 0x13; -pub const FACILITY_NTCERT: ::NTSTATUS = 0x8; -pub const FACILITY_BTH_ATT: ::NTSTATUS = 0x42; -pub const FACILITY_BCD_ERROR_CODE: ::NTSTATUS = 0x39; -pub const FACILITY_AUDIO_KERNEL: ::NTSTATUS = 0x44; -pub const FACILITY_ACPI_ERROR_CODE: ::NTSTATUS = 0x14; -pub const STATUS_SEVERITY_WARNING: ::NTSTATUS = 0x2; -pub const STATUS_SEVERITY_SUCCESS: ::NTSTATUS = 0x0; -pub const STATUS_SEVERITY_INFORMATIONAL: ::NTSTATUS = 0x1; -pub const STATUS_SEVERITY_ERROR: ::NTSTATUS = 0x3; -pub const STATUS_SUCCESS: ::NTSTATUS = 0x00000000; -pub const STATUS_WAIT_1: ::NTSTATUS = 0x00000001; -pub const STATUS_WAIT_2: ::NTSTATUS = 0x00000002; -pub const STATUS_WAIT_3: ::NTSTATUS = 0x00000003; -pub const STATUS_WAIT_63: ::NTSTATUS = 0x0000003F; -pub const STATUS_ABANDONED: ::NTSTATUS = 0x00000080; -pub const STATUS_ABANDONED_WAIT_0: ::NTSTATUS = 0x00000080; -pub const STATUS_ABANDONED_WAIT_63: ::NTSTATUS = 0x000000BF; -pub const STATUS_USER_APC: ::NTSTATUS = 0x000000C0; -pub const STATUS_KERNEL_APC: ::NTSTATUS = 0x00000100; -pub const STATUS_ALERTED: ::NTSTATUS = 0x00000101; -pub const STATUS_TIMEOUT: ::NTSTATUS = 0x00000102; -pub const STATUS_PENDING: ::NTSTATUS = 0x00000103; -pub const STATUS_REPARSE: ::NTSTATUS = 0x00000104; -pub const STATUS_MORE_ENTRIES: ::NTSTATUS = 0x00000105; -pub const STATUS_NOT_ALL_ASSIGNED: ::NTSTATUS = 0x00000106; -pub const STATUS_SOME_NOT_MAPPED: ::NTSTATUS = 0x00000107; -pub const STATUS_OPLOCK_BREAK_IN_PROGRESS: ::NTSTATUS = 0x00000108; -pub const STATUS_VOLUME_MOUNTED: ::NTSTATUS = 0x00000109; -pub const STATUS_RXACT_COMMITTED: ::NTSTATUS = 0x0000010A; -pub const STATUS_NOTIFY_CLEANUP: ::NTSTATUS = 0x0000010B; -pub const STATUS_NOTIFY_ENUM_DIR: ::NTSTATUS = 0x0000010C; -pub const STATUS_NO_QUOTAS_FOR_ACCOUNT: ::NTSTATUS = 0x0000010D; -pub const STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED: ::NTSTATUS = 0x0000010E; -pub const STATUS_PAGE_FAULT_TRANSITION: ::NTSTATUS = 0x00000110; -pub const STATUS_PAGE_FAULT_DEMAND_ZERO: ::NTSTATUS = 0x00000111; -pub const STATUS_PAGE_FAULT_COPY_ON_WRITE: ::NTSTATUS = 0x00000112; -pub const STATUS_PAGE_FAULT_GUARD_PAGE: ::NTSTATUS = 0x00000113; -pub const STATUS_PAGE_FAULT_PAGING_FILE: ::NTSTATUS = 0x00000114; -pub const STATUS_CACHE_PAGE_LOCKED: ::NTSTATUS = 0x00000115; -pub const STATUS_CRASH_DUMP: ::NTSTATUS = 0x00000116; -pub const STATUS_BUFFER_ALL_ZEROS: ::NTSTATUS = 0x00000117; -pub const STATUS_REPARSE_OBJECT: ::NTSTATUS = 0x00000118; -pub const STATUS_RESOURCE_REQUIREMENTS_CHANGED: ::NTSTATUS = 0x00000119; -pub const STATUS_TRANSLATION_COMPLETE: ::NTSTATUS = 0x00000120; -pub const STATUS_DS_MEMBERSHIP_EVALUATED_LOCALLY: ::NTSTATUS = 0x00000121; -pub const STATUS_NOTHING_TO_TERMINATE: ::NTSTATUS = 0x00000122; -pub const STATUS_PROCESS_NOT_IN_JOB: ::NTSTATUS = 0x00000123; -pub const STATUS_PROCESS_IN_JOB: ::NTSTATUS = 0x00000124; -pub const STATUS_VOLSNAP_HIBERNATE_READY: ::NTSTATUS = 0x00000125; -pub const STATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY: ::NTSTATUS = 0x00000126; -pub const STATUS_INTERRUPT_VECTOR_ALREADY_CONNECTED: ::NTSTATUS = 0x00000127; -pub const STATUS_INTERRUPT_STILL_CONNECTED: ::NTSTATUS = 0x00000128; -pub const STATUS_PROCESS_CLONED: ::NTSTATUS = 0x00000129; -pub const STATUS_FILE_LOCKED_WITH_ONLY_READERS: ::NTSTATUS = 0x0000012A; -pub const STATUS_FILE_LOCKED_WITH_WRITERS: ::NTSTATUS = 0x0000012B; -pub const STATUS_VALID_IMAGE_HASH: ::NTSTATUS = 0x0000012C; -pub const STATUS_VALID_CATALOG_HASH: ::NTSTATUS = 0x0000012D; -pub const STATUS_VALID_STRONG_CODE_HASH: ::NTSTATUS = 0x0000012E; -pub const STATUS_RESOURCEMANAGER_READ_ONLY: ::NTSTATUS = 0x00000202; -pub const STATUS_RING_PREVIOUSLY_EMPTY: ::NTSTATUS = 0x00000210; -pub const STATUS_RING_PREVIOUSLY_FULL: ::NTSTATUS = 0x00000211; -pub const STATUS_RING_PREVIOUSLY_ABOVE_QUOTA: ::NTSTATUS = 0x00000212; -pub const STATUS_RING_NEWLY_EMPTY: ::NTSTATUS = 0x00000213; -pub const STATUS_RING_SIGNAL_OPPOSITE_ENDPOINT: ::NTSTATUS = 0x00000214; -pub const STATUS_OPLOCK_SWITCHED_TO_NEW_HANDLE: ::NTSTATUS = 0x00000215; -pub const STATUS_OPLOCK_HANDLE_CLOSED: ::NTSTATUS = 0x00000216; -pub const STATUS_WAIT_FOR_OPLOCK: ::NTSTATUS = 0x00000367; -pub const DBG_EXCEPTION_HANDLED: ::NTSTATUS = 0x00010001; -pub const DBG_CONTINUE: ::NTSTATUS = 0x00010002; -pub const STATUS_FLT_IO_COMPLETE: ::NTSTATUS = 0x001C0001; -pub const STATUS_OBJECT_NAME_EXISTS: ::NTSTATUS = 0x40000000; -pub const STATUS_THREAD_WAS_SUSPENDED: ::NTSTATUS = 0x40000001; -pub const STATUS_WORKING_SET_LIMIT_RANGE: ::NTSTATUS = 0x40000002; -pub const STATUS_IMAGE_NOT_AT_BASE: ::NTSTATUS = 0x40000003; -pub const STATUS_RXACT_STATE_CREATED: ::NTSTATUS = 0x40000004; -pub const STATUS_SEGMENT_NOTIFICATION: ::NTSTATUS = 0x40000005; -pub const STATUS_LOCAL_USER_SESSION_KEY: ::NTSTATUS = 0x40000006; -pub const STATUS_BAD_CURRENT_DIRECTORY: ::NTSTATUS = 0x40000007; -pub const STATUS_SERIAL_MORE_WRITES: ::NTSTATUS = 0x40000008; -pub const STATUS_REGISTRY_RECOVERED: ::NTSTATUS = 0x40000009; -pub const STATUS_FT_READ_RECOVERY_FROM_BACKUP: ::NTSTATUS = 0x4000000A; -pub const STATUS_FT_WRITE_RECOVERY: ::NTSTATUS = 0x4000000B; -pub const STATUS_SERIAL_COUNTER_TIMEOUT: ::NTSTATUS = 0x4000000C; -pub const STATUS_NULL_LM_PASSWORD: ::NTSTATUS = 0x4000000D; -pub const STATUS_IMAGE_MACHINE_TYPE_MISMATCH: ::NTSTATUS = 0x4000000E; -pub const STATUS_RECEIVE_PARTIAL: ::NTSTATUS = 0x4000000F; -pub const STATUS_RECEIVE_EXPEDITED: ::NTSTATUS = 0x40000010; -pub const STATUS_RECEIVE_PARTIAL_EXPEDITED: ::NTSTATUS = 0x40000011; -pub const STATUS_EVENT_DONE: ::NTSTATUS = 0x40000012; -pub const STATUS_EVENT_PENDING: ::NTSTATUS = 0x40000013; -pub const STATUS_CHECKING_FILE_SYSTEM: ::NTSTATUS = 0x40000014; -pub const STATUS_FATAL_APP_EXIT: ::NTSTATUS = 0x40000015; -pub const STATUS_PREDEFINED_HANDLE: ::NTSTATUS = 0x40000016; -pub const STATUS_WAS_UNLOCKED: ::NTSTATUS = 0x40000017; -pub const STATUS_SERVICE_NOTIFICATION: ::NTSTATUS = 0x40000018; -pub const STATUS_WAS_LOCKED: ::NTSTATUS = 0x40000019; -pub const STATUS_LOG_HARD_ERROR: ::NTSTATUS = 0x4000001A; -pub const STATUS_ALREADY_WIN32: ::NTSTATUS = 0x4000001B; -pub const STATUS_WX86_UNSIMULATE: ::NTSTATUS = 0x4000001C; -pub const STATUS_WX86_CONTINUE: ::NTSTATUS = 0x4000001D; -pub const STATUS_WX86_SINGLE_STEP: ::NTSTATUS = 0x4000001E; -pub const STATUS_WX86_BREAKPOINT: ::NTSTATUS = 0x4000001F; -pub const STATUS_WX86_EXCEPTION_CONTINUE: ::NTSTATUS = 0x40000020; -pub const STATUS_WX86_EXCEPTION_LASTCHANCE: ::NTSTATUS = 0x40000021; -pub const STATUS_WX86_EXCEPTION_CHAIN: ::NTSTATUS = 0x40000022; -pub const STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE: ::NTSTATUS = 0x40000023; -pub const STATUS_NO_YIELD_PERFORMED: ::NTSTATUS = 0x40000024; -pub const STATUS_TIMER_RESUME_IGNORED: ::NTSTATUS = 0x40000025; -pub const STATUS_ARBITRATION_UNHANDLED: ::NTSTATUS = 0x40000026; -pub const STATUS_CARDBUS_NOT_SUPPORTED: ::NTSTATUS = 0x40000027; -pub const STATUS_WX86_CREATEWX86TIB: ::NTSTATUS = 0x40000028; -pub const STATUS_MP_PROCESSOR_MISMATCH: ::NTSTATUS = 0x40000029; -pub const STATUS_HIBERNATED: ::NTSTATUS = 0x4000002A; -pub const STATUS_RESUME_HIBERNATION: ::NTSTATUS = 0x4000002B; -pub const STATUS_FIRMWARE_UPDATED: ::NTSTATUS = 0x4000002C; -pub const STATUS_DRIVERS_LEAKING_LOCKED_PAGES: ::NTSTATUS = 0x4000002D; -pub const STATUS_MESSAGE_RETRIEVED: ::NTSTATUS = 0x4000002E; -pub const STATUS_SYSTEM_POWERSTATE_TRANSITION: ::NTSTATUS = 0x4000002F; -pub const STATUS_ALPC_CHECK_COMPLETION_LIST: ::NTSTATUS = 0x40000030; -pub const STATUS_SYSTEM_POWERSTATE_COMPLEX_TRANSITION: ::NTSTATUS = 0x40000031; -pub const STATUS_ACCESS_AUDIT_BY_POLICY: ::NTSTATUS = 0x40000032; -pub const STATUS_ABANDON_HIBERFILE: ::NTSTATUS = 0x40000033; -pub const STATUS_BIZRULES_NOT_ENABLED: ::NTSTATUS = 0x40000034; -pub const STATUS_FT_READ_FROM_COPY: ::NTSTATUS = 0x40000035; -pub const STATUS_IMAGE_AT_DIFFERENT_BASE: ::NTSTATUS = 0x40000036; -pub const DBG_REPLY_LATER: ::NTSTATUS = 0x40010001; -pub const DBG_UNABLE_TO_PROVIDE_HANDLE: ::NTSTATUS = 0x40010002; -pub const DBG_TERMINATE_THREAD: ::NTSTATUS = 0x40010003; -pub const DBG_TERMINATE_PROCESS: ::NTSTATUS = 0x40010004; -pub const DBG_CONTROL_C: ::NTSTATUS = 0x40010005; -pub const DBG_PRINTEXCEPTION_C: ::NTSTATUS = 0x40010006; -pub const DBG_RIPEXCEPTION: ::NTSTATUS = 0x40010007; -pub const DBG_CONTROL_BREAK: ::NTSTATUS = 0x40010008; -pub const DBG_COMMAND_EXCEPTION: ::NTSTATUS = 0x40010009; -pub const DBG_PRINTEXCEPTION_WIDE_C: ::NTSTATUS = 0x4001000A; -pub const STATUS_HEURISTIC_DAMAGE_POSSIBLE: ::NTSTATUS = 0x40190001; -pub const STATUS_GUARD_PAGE_VIOLATION: ::NTSTATUS = 0x80000001u32 as i32; -pub const STATUS_DATATYPE_MISALIGNMENT: ::NTSTATUS = 0x80000002u32 as i32; -pub const STATUS_BREAKPOINT: ::NTSTATUS = 0x80000003u32 as i32; -pub const STATUS_SINGLE_STEP: ::NTSTATUS = 0x80000004u32 as i32; -pub const STATUS_BUFFER_OVERFLOW: ::NTSTATUS = 0x80000005u32 as i32; -pub const STATUS_NO_MORE_FILES: ::NTSTATUS = 0x80000006u32 as i32; -pub const STATUS_WAKE_SYSTEM_DEBUGGER: ::NTSTATUS = 0x80000007u32 as i32; -pub const STATUS_HANDLES_CLOSED: ::NTSTATUS = 0x8000000Au32 as i32; -pub const STATUS_NO_INHERITANCE: ::NTSTATUS = 0x8000000Bu32 as i32; -pub const STATUS_GUID_SUBSTITUTION_MADE: ::NTSTATUS = 0x8000000Cu32 as i32; -pub const STATUS_PARTIAL_COPY: ::NTSTATUS = 0x8000000Du32 as i32; -pub const STATUS_DEVICE_PAPER_EMPTY: ::NTSTATUS = 0x8000000Eu32 as i32; -pub const STATUS_DEVICE_POWERED_OFF: ::NTSTATUS = 0x8000000Fu32 as i32; -pub const STATUS_DEVICE_OFF_LINE: ::NTSTATUS = 0x80000010u32 as i32; -pub const STATUS_DEVICE_BUSY: ::NTSTATUS = 0x80000011u32 as i32; -pub const STATUS_NO_MORE_EAS: ::NTSTATUS = 0x80000012u32 as i32; -pub const STATUS_INVALID_EA_NAME: ::NTSTATUS = 0x80000013u32 as i32; -pub const STATUS_EA_LIST_INCONSISTENT: ::NTSTATUS = 0x80000014u32 as i32; -pub const STATUS_INVALID_EA_FLAG: ::NTSTATUS = 0x80000015u32 as i32; -pub const STATUS_VERIFY_REQUIRED: ::NTSTATUS = 0x80000016u32 as i32; -pub const STATUS_EXTRANEOUS_INFORMATION: ::NTSTATUS = 0x80000017u32 as i32; -pub const STATUS_RXACT_COMMIT_NECESSARY: ::NTSTATUS = 0x80000018u32 as i32; -pub const STATUS_NO_MORE_ENTRIES: ::NTSTATUS = 0x8000001Au32 as i32; -pub const STATUS_FILEMARK_DETECTED: ::NTSTATUS = 0x8000001Bu32 as i32; -pub const STATUS_MEDIA_CHANGED: ::NTSTATUS = 0x8000001Cu32 as i32; -pub const STATUS_BUS_RESET: ::NTSTATUS = 0x8000001Du32 as i32; -pub const STATUS_END_OF_MEDIA: ::NTSTATUS = 0x8000001Eu32 as i32; -pub const STATUS_BEGINNING_OF_MEDIA: ::NTSTATUS = 0x8000001Fu32 as i32; -pub const STATUS_MEDIA_CHECK: ::NTSTATUS = 0x80000020u32 as i32; -pub const STATUS_SETMARK_DETECTED: ::NTSTATUS = 0x80000021u32 as i32; -pub const STATUS_NO_DATA_DETECTED: ::NTSTATUS = 0x80000022u32 as i32; -pub const STATUS_REDIRECTOR_HAS_OPEN_HANDLES: ::NTSTATUS = 0x80000023u32 as i32; -pub const STATUS_SERVER_HAS_OPEN_HANDLES: ::NTSTATUS = 0x80000024u32 as i32; -pub const STATUS_ALREADY_DISCONNECTED: ::NTSTATUS = 0x80000025u32 as i32; -pub const STATUS_LONGJUMP: ::NTSTATUS = 0x80000026u32 as i32; -pub const STATUS_CLEANER_CARTRIDGE_INSTALLED: ::NTSTATUS = 0x80000027u32 as i32; -pub const STATUS_PLUGPLAY_QUERY_VETOED: ::NTSTATUS = 0x80000028u32 as i32; -pub const STATUS_UNWIND_CONSOLIDATE: ::NTSTATUS = 0x80000029u32 as i32; -pub const STATUS_REGISTRY_HIVE_RECOVERED: ::NTSTATUS = 0x8000002Au32 as i32; -pub const STATUS_DLL_MIGHT_BE_INSECURE: ::NTSTATUS = 0x8000002Bu32 as i32; -pub const STATUS_DLL_MIGHT_BE_INCOMPATIBLE: ::NTSTATUS = 0x8000002Cu32 as i32; -pub const STATUS_STOPPED_ON_SYMLINK: ::NTSTATUS = 0x8000002Du32 as i32; -pub const STATUS_CANNOT_GRANT_REQUESTED_OPLOCK: ::NTSTATUS = 0x8000002Eu32 as i32; -pub const STATUS_NO_ACE_CONDITION: ::NTSTATUS = 0x8000002Fu32 as i32; -pub const STATUS_DEVICE_SUPPORT_IN_PROGRESS: ::NTSTATUS = 0x80000030u32 as i32; -pub const STATUS_DEVICE_POWER_CYCLE_REQUIRED: ::NTSTATUS = 0x80000031u32 as i32; -pub const DBG_EXCEPTION_NOT_HANDLED: ::NTSTATUS = 0x80010001u32 as i32; -pub const STATUS_CLUSTER_NODE_ALREADY_UP: ::NTSTATUS = 0x80130001u32 as i32; -pub const STATUS_CLUSTER_NODE_ALREADY_DOWN: ::NTSTATUS = 0x80130002u32 as i32; -pub const STATUS_CLUSTER_NETWORK_ALREADY_ONLINE: ::NTSTATUS = 0x80130003u32 as i32; -pub const STATUS_CLUSTER_NETWORK_ALREADY_OFFLINE: ::NTSTATUS = 0x80130004u32 as i32; -pub const STATUS_CLUSTER_NODE_ALREADY_MEMBER: ::NTSTATUS = 0x80130005u32 as i32; -pub const STATUS_FLT_BUFFER_TOO_SMALL: ::NTSTATUS = 0x801C0001u32 as i32; -pub const STATUS_FVE_PARTIAL_METADATA: ::NTSTATUS = 0x80210001u32 as i32; -pub const STATUS_FVE_TRANSIENT_STATE: ::NTSTATUS = 0x80210002u32 as i32; -pub const STATUS_UNSUCCESSFUL: ::NTSTATUS = 0xC0000001u32 as i32; -pub const STATUS_NOT_IMPLEMENTED: ::NTSTATUS = 0xC0000002u32 as i32; -pub const STATUS_INVALID_INFO_CLASS: ::NTSTATUS = 0xC0000003u32 as i32; -pub const STATUS_INFO_LENGTH_MISMATCH: ::NTSTATUS = 0xC0000004u32 as i32; -pub const STATUS_ACCESS_VIOLATION: ::NTSTATUS = 0xC0000005u32 as i32; -pub const STATUS_IN_PAGE_ERROR: ::NTSTATUS = 0xC0000006u32 as i32; -pub const STATUS_PAGEFILE_QUOTA: ::NTSTATUS = 0xC0000007u32 as i32; -pub const STATUS_INVALID_HANDLE: ::NTSTATUS = 0xC0000008u32 as i32; -pub const STATUS_BAD_INITIAL_STACK: ::NTSTATUS = 0xC0000009u32 as i32; -pub const STATUS_BAD_INITIAL_PC: ::NTSTATUS = 0xC000000Au32 as i32; -pub const STATUS_INVALID_CID: ::NTSTATUS = 0xC000000Bu32 as i32; -pub const STATUS_TIMER_NOT_CANCELED: ::NTSTATUS = 0xC000000Cu32 as i32; -pub const STATUS_INVALID_PARAMETER: ::NTSTATUS = 0xC000000Du32 as i32; -pub const STATUS_NO_SUCH_DEVICE: ::NTSTATUS = 0xC000000Eu32 as i32; -pub const STATUS_NO_SUCH_FILE: ::NTSTATUS = 0xC000000Fu32 as i32; -pub const STATUS_INVALID_DEVICE_REQUEST: ::NTSTATUS = 0xC0000010u32 as i32; -pub const STATUS_END_OF_FILE: ::NTSTATUS = 0xC0000011u32 as i32; -pub const STATUS_WRONG_VOLUME: ::NTSTATUS = 0xC0000012u32 as i32; -pub const STATUS_NO_MEDIA_IN_DEVICE: ::NTSTATUS = 0xC0000013u32 as i32; -pub const STATUS_UNRECOGNIZED_MEDIA: ::NTSTATUS = 0xC0000014u32 as i32; -pub const STATUS_NONEXISTENT_SECTOR: ::NTSTATUS = 0xC0000015u32 as i32; -pub const STATUS_MORE_PROCESSING_REQUIRED: ::NTSTATUS = 0xC0000016u32 as i32; -pub const STATUS_NO_MEMORY: ::NTSTATUS = 0xC0000017u32 as i32; -pub const STATUS_CONFLICTING_ADDRESSES: ::NTSTATUS = 0xC0000018u32 as i32; -pub const STATUS_NOT_MAPPED_VIEW: ::NTSTATUS = 0xC0000019u32 as i32; -pub const STATUS_UNABLE_TO_FREE_VM: ::NTSTATUS = 0xC000001Au32 as i32; -pub const STATUS_UNABLE_TO_DELETE_SECTION: ::NTSTATUS = 0xC000001Bu32 as i32; -pub const STATUS_INVALID_SYSTEM_SERVICE: ::NTSTATUS = 0xC000001Cu32 as i32; -pub const STATUS_ILLEGAL_INSTRUCTION: ::NTSTATUS = 0xC000001Du32 as i32; -pub const STATUS_INVALID_LOCK_SEQUENCE: ::NTSTATUS = 0xC000001Eu32 as i32; -pub const STATUS_INVALID_VIEW_SIZE: ::NTSTATUS = 0xC000001Fu32 as i32; -pub const STATUS_INVALID_FILE_FOR_SECTION: ::NTSTATUS = 0xC0000020u32 as i32; -pub const STATUS_ALREADY_COMMITTED: ::NTSTATUS = 0xC0000021u32 as i32; -pub const STATUS_ACCESS_DENIED: ::NTSTATUS = 0xC0000022u32 as i32; -pub const STATUS_BUFFER_TOO_SMALL: ::NTSTATUS = 0xC0000023u32 as i32; -pub const STATUS_OBJECT_TYPE_MISMATCH: ::NTSTATUS = 0xC0000024u32 as i32; -pub const STATUS_NONCONTINUABLE_EXCEPTION: ::NTSTATUS = 0xC0000025u32 as i32; -pub const STATUS_INVALID_DISPOSITION: ::NTSTATUS = 0xC0000026u32 as i32; -pub const STATUS_UNWIND: ::NTSTATUS = 0xC0000027u32 as i32; -pub const STATUS_BAD_STACK: ::NTSTATUS = 0xC0000028u32 as i32; -pub const STATUS_INVALID_UNWIND_TARGET: ::NTSTATUS = 0xC0000029u32 as i32; -pub const STATUS_NOT_LOCKED: ::NTSTATUS = 0xC000002Au32 as i32; -pub const STATUS_PARITY_ERROR: ::NTSTATUS = 0xC000002Bu32 as i32; -pub const STATUS_UNABLE_TO_DECOMMIT_VM: ::NTSTATUS = 0xC000002Cu32 as i32; -pub const STATUS_NOT_COMMITTED: ::NTSTATUS = 0xC000002Du32 as i32; -pub const STATUS_INVALID_PORT_ATTRIBUTES: ::NTSTATUS = 0xC000002Eu32 as i32; -pub const STATUS_PORT_MESSAGE_TOO_LONG: ::NTSTATUS = 0xC000002Fu32 as i32; -pub const STATUS_INVALID_PARAMETER_MIX: ::NTSTATUS = 0xC0000030u32 as i32; -pub const STATUS_INVALID_QUOTA_LOWER: ::NTSTATUS = 0xC0000031u32 as i32; -pub const STATUS_DISK_CORRUPT_ERROR: ::NTSTATUS = 0xC0000032u32 as i32; -pub const STATUS_OBJECT_NAME_INVALID: ::NTSTATUS = 0xC0000033u32 as i32; -pub const STATUS_OBJECT_NAME_NOT_FOUND: ::NTSTATUS = 0xC0000034u32 as i32; -pub const STATUS_OBJECT_NAME_COLLISION: ::NTSTATUS = 0xC0000035u32 as i32; -pub const STATUS_PORT_DO_NOT_DISTURB: ::NTSTATUS = 0xC0000036u32 as i32; -pub const STATUS_PORT_DISCONNECTED: ::NTSTATUS = 0xC0000037u32 as i32; -pub const STATUS_DEVICE_ALREADY_ATTACHED: ::NTSTATUS = 0xC0000038u32 as i32; -pub const STATUS_OBJECT_PATH_INVALID: ::NTSTATUS = 0xC0000039u32 as i32; -pub const STATUS_OBJECT_PATH_NOT_FOUND: ::NTSTATUS = 0xC000003Au32 as i32; -pub const STATUS_OBJECT_PATH_SYNTAX_BAD: ::NTSTATUS = 0xC000003Bu32 as i32; -pub const STATUS_DATA_OVERRUN: ::NTSTATUS = 0xC000003Cu32 as i32; -pub const STATUS_DATA_LATE_ERROR: ::NTSTATUS = 0xC000003Du32 as i32; -pub const STATUS_DATA_ERROR: ::NTSTATUS = 0xC000003Eu32 as i32; -pub const STATUS_CRC_ERROR: ::NTSTATUS = 0xC000003Fu32 as i32; -pub const STATUS_SECTION_TOO_BIG: ::NTSTATUS = 0xC0000040u32 as i32; -pub const STATUS_PORT_CONNECTION_REFUSED: ::NTSTATUS = 0xC0000041u32 as i32; -pub const STATUS_INVALID_PORT_HANDLE: ::NTSTATUS = 0xC0000042u32 as i32; -pub const STATUS_SHARING_VIOLATION: ::NTSTATUS = 0xC0000043u32 as i32; -pub const STATUS_QUOTA_EXCEEDED: ::NTSTATUS = 0xC0000044u32 as i32; -pub const STATUS_INVALID_PAGE_PROTECTION: ::NTSTATUS = 0xC0000045u32 as i32; -pub const STATUS_MUTANT_NOT_OWNED: ::NTSTATUS = 0xC0000046u32 as i32; -pub const STATUS_SEMAPHORE_LIMIT_EXCEEDED: ::NTSTATUS = 0xC0000047u32 as i32; -pub const STATUS_PORT_ALREADY_SET: ::NTSTATUS = 0xC0000048u32 as i32; -pub const STATUS_SECTION_NOT_IMAGE: ::NTSTATUS = 0xC0000049u32 as i32; -pub const STATUS_SUSPEND_COUNT_EXCEEDED: ::NTSTATUS = 0xC000004Au32 as i32; -pub const STATUS_THREAD_IS_TERMINATING: ::NTSTATUS = 0xC000004Bu32 as i32; -pub const STATUS_BAD_WORKING_SET_LIMIT: ::NTSTATUS = 0xC000004Cu32 as i32; -pub const STATUS_INCOMPATIBLE_FILE_MAP: ::NTSTATUS = 0xC000004Du32 as i32; -pub const STATUS_SECTION_PROTECTION: ::NTSTATUS = 0xC000004Eu32 as i32; -pub const STATUS_EAS_NOT_SUPPORTED: ::NTSTATUS = 0xC000004Fu32 as i32; -pub const STATUS_EA_TOO_LARGE: ::NTSTATUS = 0xC0000050u32 as i32; -pub const STATUS_NONEXISTENT_EA_ENTRY: ::NTSTATUS = 0xC0000051u32 as i32; -pub const STATUS_NO_EAS_ON_FILE: ::NTSTATUS = 0xC0000052u32 as i32; -pub const STATUS_EA_CORRUPT_ERROR: ::NTSTATUS = 0xC0000053u32 as i32; -pub const STATUS_FILE_LOCK_CONFLICT: ::NTSTATUS = 0xC0000054u32 as i32; -pub const STATUS_LOCK_NOT_GRANTED: ::NTSTATUS = 0xC0000055u32 as i32; -pub const STATUS_DELETE_PENDING: ::NTSTATUS = 0xC0000056u32 as i32; -pub const STATUS_CTL_FILE_NOT_SUPPORTED: ::NTSTATUS = 0xC0000057u32 as i32; -pub const STATUS_UNKNOWN_REVISION: ::NTSTATUS = 0xC0000058u32 as i32; -pub const STATUS_REVISION_MISMATCH: ::NTSTATUS = 0xC0000059u32 as i32; -pub const STATUS_INVALID_OWNER: ::NTSTATUS = 0xC000005Au32 as i32; -pub const STATUS_INVALID_PRIMARY_GROUP: ::NTSTATUS = 0xC000005Bu32 as i32; -pub const STATUS_NO_IMPERSONATION_TOKEN: ::NTSTATUS = 0xC000005Cu32 as i32; -pub const STATUS_CANT_DISABLE_MANDATORY: ::NTSTATUS = 0xC000005Du32 as i32; -pub const STATUS_NO_LOGON_SERVERS: ::NTSTATUS = 0xC000005Eu32 as i32; -pub const STATUS_NO_SUCH_LOGON_SESSION: ::NTSTATUS = 0xC000005Fu32 as i32; -pub const STATUS_NO_SUCH_PRIVILEGE: ::NTSTATUS = 0xC0000060u32 as i32; -pub const STATUS_PRIVILEGE_NOT_HELD: ::NTSTATUS = 0xC0000061u32 as i32; -pub const STATUS_INVALID_ACCOUNT_NAME: ::NTSTATUS = 0xC0000062u32 as i32; -pub const STATUS_USER_EXISTS: ::NTSTATUS = 0xC0000063u32 as i32; -pub const STATUS_NO_SUCH_USER: ::NTSTATUS = 0xC0000064u32 as i32; -pub const STATUS_GROUP_EXISTS: ::NTSTATUS = 0xC0000065u32 as i32; -pub const STATUS_NO_SUCH_GROUP: ::NTSTATUS = 0xC0000066u32 as i32; -pub const STATUS_MEMBER_IN_GROUP: ::NTSTATUS = 0xC0000067u32 as i32; -pub const STATUS_MEMBER_NOT_IN_GROUP: ::NTSTATUS = 0xC0000068u32 as i32; -pub const STATUS_LAST_ADMIN: ::NTSTATUS = 0xC0000069u32 as i32; -pub const STATUS_WRONG_PASSWORD: ::NTSTATUS = 0xC000006Au32 as i32; -pub const STATUS_ILL_FORMED_PASSWORD: ::NTSTATUS = 0xC000006Bu32 as i32; -pub const STATUS_PASSWORD_RESTRICTION: ::NTSTATUS = 0xC000006Cu32 as i32; -pub const STATUS_LOGON_FAILURE: ::NTSTATUS = 0xC000006Du32 as i32; -pub const STATUS_ACCOUNT_RESTRICTION: ::NTSTATUS = 0xC000006Eu32 as i32; -pub const STATUS_INVALID_LOGON_HOURS: ::NTSTATUS = 0xC000006Fu32 as i32; -pub const STATUS_INVALID_WORKSTATION: ::NTSTATUS = 0xC0000070u32 as i32; -pub const STATUS_PASSWORD_EXPIRED: ::NTSTATUS = 0xC0000071u32 as i32; -pub const STATUS_ACCOUNT_DISABLED: ::NTSTATUS = 0xC0000072u32 as i32; -pub const STATUS_NONE_MAPPED: ::NTSTATUS = 0xC0000073u32 as i32; -pub const STATUS_TOO_MANY_LUIDS_REQUESTED: ::NTSTATUS = 0xC0000074u32 as i32; -pub const STATUS_LUIDS_EXHAUSTED: ::NTSTATUS = 0xC0000075u32 as i32; -pub const STATUS_INVALID_SUB_AUTHORITY: ::NTSTATUS = 0xC0000076u32 as i32; -pub const STATUS_INVALID_ACL: ::NTSTATUS = 0xC0000077u32 as i32; -pub const STATUS_INVALID_SID: ::NTSTATUS = 0xC0000078u32 as i32; -pub const STATUS_INVALID_SECURITY_DESCR: ::NTSTATUS = 0xC0000079u32 as i32; -pub const STATUS_PROCEDURE_NOT_FOUND: ::NTSTATUS = 0xC000007Au32 as i32; -pub const STATUS_INVALID_IMAGE_FORMAT: ::NTSTATUS = 0xC000007Bu32 as i32; -pub const STATUS_NO_TOKEN: ::NTSTATUS = 0xC000007Cu32 as i32; -pub const STATUS_BAD_INHERITANCE_ACL: ::NTSTATUS = 0xC000007Du32 as i32; -pub const STATUS_RANGE_NOT_LOCKED: ::NTSTATUS = 0xC000007Eu32 as i32; -pub const STATUS_DISK_FULL: ::NTSTATUS = 0xC000007Fu32 as i32; -pub const STATUS_SERVER_DISABLED: ::NTSTATUS = 0xC0000080u32 as i32; -pub const STATUS_SERVER_NOT_DISABLED: ::NTSTATUS = 0xC0000081u32 as i32; -pub const STATUS_TOO_MANY_GUIDS_REQUESTED: ::NTSTATUS = 0xC0000082u32 as i32; -pub const STATUS_GUIDS_EXHAUSTED: ::NTSTATUS = 0xC0000083u32 as i32; -pub const STATUS_INVALID_ID_AUTHORITY: ::NTSTATUS = 0xC0000084u32 as i32; -pub const STATUS_AGENTS_EXHAUSTED: ::NTSTATUS = 0xC0000085u32 as i32; -pub const STATUS_INVALID_VOLUME_LABEL: ::NTSTATUS = 0xC0000086u32 as i32; -pub const STATUS_SECTION_NOT_EXTENDED: ::NTSTATUS = 0xC0000087u32 as i32; -pub const STATUS_NOT_MAPPED_DATA: ::NTSTATUS = 0xC0000088u32 as i32; -pub const STATUS_RESOURCE_DATA_NOT_FOUND: ::NTSTATUS = 0xC0000089u32 as i32; -pub const STATUS_RESOURCE_TYPE_NOT_FOUND: ::NTSTATUS = 0xC000008Au32 as i32; -pub const STATUS_RESOURCE_NAME_NOT_FOUND: ::NTSTATUS = 0xC000008Bu32 as i32; -pub const STATUS_ARRAY_BOUNDS_EXCEEDED: ::NTSTATUS = 0xC000008Cu32 as i32; -pub const STATUS_FLOAT_DENORMAL_OPERAND: ::NTSTATUS = 0xC000008Du32 as i32; -pub const STATUS_FLOAT_DIVIDE_BY_ZERO: ::NTSTATUS = 0xC000008Eu32 as i32; -pub const STATUS_FLOAT_INEXACT_RESULT: ::NTSTATUS = 0xC000008Fu32 as i32; -pub const STATUS_FLOAT_INVALID_OPERATION: ::NTSTATUS = 0xC0000090u32 as i32; -pub const STATUS_FLOAT_OVERFLOW: ::NTSTATUS = 0xC0000091u32 as i32; -pub const STATUS_FLOAT_STACK_CHECK: ::NTSTATUS = 0xC0000092u32 as i32; -pub const STATUS_FLOAT_UNDERFLOW: ::NTSTATUS = 0xC0000093u32 as i32; -pub const STATUS_INTEGER_DIVIDE_BY_ZERO: ::NTSTATUS = 0xC0000094u32 as i32; -pub const STATUS_INTEGER_OVERFLOW: ::NTSTATUS = 0xC0000095u32 as i32; -pub const STATUS_PRIVILEGED_INSTRUCTION: ::NTSTATUS = 0xC0000096u32 as i32; -pub const STATUS_TOO_MANY_PAGING_FILES: ::NTSTATUS = 0xC0000097u32 as i32; -pub const STATUS_FILE_INVALID: ::NTSTATUS = 0xC0000098u32 as i32; -pub const STATUS_ALLOTTED_SPACE_EXCEEDED: ::NTSTATUS = 0xC0000099u32 as i32; -pub const STATUS_INSUFFICIENT_RESOURCES: ::NTSTATUS = 0xC000009Au32 as i32; -pub const STATUS_DFS_EXIT_PATH_FOUND: ::NTSTATUS = 0xC000009Bu32 as i32; -pub const STATUS_DEVICE_DATA_ERROR: ::NTSTATUS = 0xC000009Cu32 as i32; -pub const STATUS_DEVICE_NOT_CONNECTED: ::NTSTATUS = 0xC000009Du32 as i32; -pub const STATUS_DEVICE_POWER_FAILURE: ::NTSTATUS = 0xC000009Eu32 as i32; -pub const STATUS_FREE_VM_NOT_AT_BASE: ::NTSTATUS = 0xC000009Fu32 as i32; -pub const STATUS_MEMORY_NOT_ALLOCATED: ::NTSTATUS = 0xC00000A0u32 as i32; -pub const STATUS_WORKING_SET_QUOTA: ::NTSTATUS = 0xC00000A1u32 as i32; -pub const STATUS_MEDIA_WRITE_PROTECTED: ::NTSTATUS = 0xC00000A2u32 as i32; -pub const STATUS_DEVICE_NOT_READY: ::NTSTATUS = 0xC00000A3u32 as i32; -pub const STATUS_INVALID_GROUP_ATTRIBUTES: ::NTSTATUS = 0xC00000A4u32 as i32; -pub const STATUS_BAD_IMPERSONATION_LEVEL: ::NTSTATUS = 0xC00000A5u32 as i32; -pub const STATUS_CANT_OPEN_ANONYMOUS: ::NTSTATUS = 0xC00000A6u32 as i32; -pub const STATUS_BAD_VALIDATION_CLASS: ::NTSTATUS = 0xC00000A7u32 as i32; -pub const STATUS_BAD_TOKEN_TYPE: ::NTSTATUS = 0xC00000A8u32 as i32; -pub const STATUS_BAD_MASTER_BOOT_RECORD: ::NTSTATUS = 0xC00000A9u32 as i32; -pub const STATUS_INSTRUCTION_MISALIGNMENT: ::NTSTATUS = 0xC00000AAu32 as i32; -pub const STATUS_INSTANCE_NOT_AVAILABLE: ::NTSTATUS = 0xC00000ABu32 as i32; -pub const STATUS_PIPE_NOT_AVAILABLE: ::NTSTATUS = 0xC00000ACu32 as i32; -pub const STATUS_INVALID_PIPE_STATE: ::NTSTATUS = 0xC00000ADu32 as i32; -pub const STATUS_PIPE_BUSY: ::NTSTATUS = 0xC00000AEu32 as i32; -pub const STATUS_ILLEGAL_FUNCTION: ::NTSTATUS = 0xC00000AFu32 as i32; -pub const STATUS_PIPE_DISCONNECTED: ::NTSTATUS = 0xC00000B0u32 as i32; -pub const STATUS_PIPE_CLOSING: ::NTSTATUS = 0xC00000B1u32 as i32; -pub const STATUS_PIPE_CONNECTED: ::NTSTATUS = 0xC00000B2u32 as i32; -pub const STATUS_PIPE_LISTENING: ::NTSTATUS = 0xC00000B3u32 as i32; -pub const STATUS_INVALID_READ_MODE: ::NTSTATUS = 0xC00000B4u32 as i32; -pub const STATUS_IO_TIMEOUT: ::NTSTATUS = 0xC00000B5u32 as i32; -pub const STATUS_FILE_FORCED_CLOSED: ::NTSTATUS = 0xC00000B6u32 as i32; -pub const STATUS_PROFILING_NOT_STARTED: ::NTSTATUS = 0xC00000B7u32 as i32; -pub const STATUS_PROFILING_NOT_STOPPED: ::NTSTATUS = 0xC00000B8u32 as i32; -pub const STATUS_COULD_NOT_INTERPRET: ::NTSTATUS = 0xC00000B9u32 as i32; -pub const STATUS_FILE_IS_A_DIRECTORY: ::NTSTATUS = 0xC00000BAu32 as i32; -pub const STATUS_NOT_SUPPORTED: ::NTSTATUS = 0xC00000BBu32 as i32; -pub const STATUS_REMOTE_NOT_LISTENING: ::NTSTATUS = 0xC00000BCu32 as i32; -pub const STATUS_DUPLICATE_NAME: ::NTSTATUS = 0xC00000BDu32 as i32; -pub const STATUS_BAD_NETWORK_PATH: ::NTSTATUS = 0xC00000BEu32 as i32; -pub const STATUS_NETWORK_BUSY: ::NTSTATUS = 0xC00000BFu32 as i32; -pub const STATUS_DEVICE_DOES_NOT_EXIST: ::NTSTATUS = 0xC00000C0u32 as i32; -pub const STATUS_TOO_MANY_COMMANDS: ::NTSTATUS = 0xC00000C1u32 as i32; -pub const STATUS_ADAPTER_HARDWARE_ERROR: ::NTSTATUS = 0xC00000C2u32 as i32; -pub const STATUS_INVALID_NETWORK_RESPONSE: ::NTSTATUS = 0xC00000C3u32 as i32; -pub const STATUS_UNEXPECTED_NETWORK_ERROR: ::NTSTATUS = 0xC00000C4u32 as i32; -pub const STATUS_BAD_REMOTE_ADAPTER: ::NTSTATUS = 0xC00000C5u32 as i32; -pub const STATUS_PRINT_QUEUE_FULL: ::NTSTATUS = 0xC00000C6u32 as i32; -pub const STATUS_NO_SPOOL_SPACE: ::NTSTATUS = 0xC00000C7u32 as i32; -pub const STATUS_PRINT_CANCELLED: ::NTSTATUS = 0xC00000C8u32 as i32; -pub const STATUS_NETWORK_NAME_DELETED: ::NTSTATUS = 0xC00000C9u32 as i32; -pub const STATUS_NETWORK_ACCESS_DENIED: ::NTSTATUS = 0xC00000CAu32 as i32; -pub const STATUS_BAD_DEVICE_TYPE: ::NTSTATUS = 0xC00000CBu32 as i32; -pub const STATUS_BAD_NETWORK_NAME: ::NTSTATUS = 0xC00000CCu32 as i32; -pub const STATUS_TOO_MANY_NAMES: ::NTSTATUS = 0xC00000CDu32 as i32; -pub const STATUS_TOO_MANY_SESSIONS: ::NTSTATUS = 0xC00000CEu32 as i32; -pub const STATUS_SHARING_PAUSED: ::NTSTATUS = 0xC00000CFu32 as i32; -pub const STATUS_REQUEST_NOT_ACCEPTED: ::NTSTATUS = 0xC00000D0u32 as i32; -pub const STATUS_REDIRECTOR_PAUSED: ::NTSTATUS = 0xC00000D1u32 as i32; -pub const STATUS_NET_WRITE_FAULT: ::NTSTATUS = 0xC00000D2u32 as i32; -pub const STATUS_PROFILING_AT_LIMIT: ::NTSTATUS = 0xC00000D3u32 as i32; -pub const STATUS_NOT_SAME_DEVICE: ::NTSTATUS = 0xC00000D4u32 as i32; -pub const STATUS_FILE_RENAMED: ::NTSTATUS = 0xC00000D5u32 as i32; -pub const STATUS_VIRTUAL_CIRCUIT_CLOSED: ::NTSTATUS = 0xC00000D6u32 as i32; -pub const STATUS_NO_SECURITY_ON_OBJECT: ::NTSTATUS = 0xC00000D7u32 as i32; -pub const STATUS_CANT_WAIT: ::NTSTATUS = 0xC00000D8u32 as i32; -pub const STATUS_PIPE_EMPTY: ::NTSTATUS = 0xC00000D9u32 as i32; -pub const STATUS_CANT_ACCESS_DOMAIN_INFO: ::NTSTATUS = 0xC00000DAu32 as i32; -pub const STATUS_CANT_TERMINATE_SELF: ::NTSTATUS = 0xC00000DBu32 as i32; -pub const STATUS_INVALID_SERVER_STATE: ::NTSTATUS = 0xC00000DCu32 as i32; -pub const STATUS_INVALID_DOMAIN_STATE: ::NTSTATUS = 0xC00000DDu32 as i32; -pub const STATUS_INVALID_DOMAIN_ROLE: ::NTSTATUS = 0xC00000DEu32 as i32; -pub const STATUS_NO_SUCH_DOMAIN: ::NTSTATUS = 0xC00000DFu32 as i32; -pub const STATUS_DOMAIN_EXISTS: ::NTSTATUS = 0xC00000E0u32 as i32; -pub const STATUS_DOMAIN_LIMIT_EXCEEDED: ::NTSTATUS = 0xC00000E1u32 as i32; -pub const STATUS_OPLOCK_NOT_GRANTED: ::NTSTATUS = 0xC00000E2u32 as i32; -pub const STATUS_INVALID_OPLOCK_PROTOCOL: ::NTSTATUS = 0xC00000E3u32 as i32; -pub const STATUS_INTERNAL_DB_CORRUPTION: ::NTSTATUS = 0xC00000E4u32 as i32; -pub const STATUS_INTERNAL_ERROR: ::NTSTATUS = 0xC00000E5u32 as i32; -pub const STATUS_GENERIC_NOT_MAPPED: ::NTSTATUS = 0xC00000E6u32 as i32; -pub const STATUS_BAD_DESCRIPTOR_FORMAT: ::NTSTATUS = 0xC00000E7u32 as i32; -pub const STATUS_INVALID_USER_BUFFER: ::NTSTATUS = 0xC00000E8u32 as i32; -pub const STATUS_UNEXPECTED_IO_ERROR: ::NTSTATUS = 0xC00000E9u32 as i32; -pub const STATUS_UNEXPECTED_MM_CREATE_ERR: ::NTSTATUS = 0xC00000EAu32 as i32; -pub const STATUS_UNEXPECTED_MM_MAP_ERROR: ::NTSTATUS = 0xC00000EBu32 as i32; -pub const STATUS_UNEXPECTED_MM_EXTEND_ERR: ::NTSTATUS = 0xC00000ECu32 as i32; -pub const STATUS_NOT_LOGON_PROCESS: ::NTSTATUS = 0xC00000EDu32 as i32; -pub const STATUS_LOGON_SESSION_EXISTS: ::NTSTATUS = 0xC00000EEu32 as i32; -pub const STATUS_INVALID_PARAMETER_1: ::NTSTATUS = 0xC00000EFu32 as i32; -pub const STATUS_INVALID_PARAMETER_2: ::NTSTATUS = 0xC00000F0u32 as i32; -pub const STATUS_INVALID_PARAMETER_3: ::NTSTATUS = 0xC00000F1u32 as i32; -pub const STATUS_INVALID_PARAMETER_4: ::NTSTATUS = 0xC00000F2u32 as i32; -pub const STATUS_INVALID_PARAMETER_5: ::NTSTATUS = 0xC00000F3u32 as i32; -pub const STATUS_INVALID_PARAMETER_6: ::NTSTATUS = 0xC00000F4u32 as i32; -pub const STATUS_INVALID_PARAMETER_7: ::NTSTATUS = 0xC00000F5u32 as i32; -pub const STATUS_INVALID_PARAMETER_8: ::NTSTATUS = 0xC00000F6u32 as i32; -pub const STATUS_INVALID_PARAMETER_9: ::NTSTATUS = 0xC00000F7u32 as i32; -pub const STATUS_INVALID_PARAMETER_10: ::NTSTATUS = 0xC00000F8u32 as i32; -pub const STATUS_INVALID_PARAMETER_11: ::NTSTATUS = 0xC00000F9u32 as i32; -pub const STATUS_INVALID_PARAMETER_12: ::NTSTATUS = 0xC00000FAu32 as i32; -pub const STATUS_REDIRECTOR_NOT_STARTED: ::NTSTATUS = 0xC00000FBu32 as i32; -pub const STATUS_REDIRECTOR_STARTED: ::NTSTATUS = 0xC00000FCu32 as i32; -pub const STATUS_STACK_OVERFLOW: ::NTSTATUS = 0xC00000FDu32 as i32; -pub const STATUS_NO_SUCH_PACKAGE: ::NTSTATUS = 0xC00000FEu32 as i32; -pub const STATUS_BAD_FUNCTION_TABLE: ::NTSTATUS = 0xC00000FFu32 as i32; -pub const STATUS_VARIABLE_NOT_FOUND: ::NTSTATUS = 0xC0000100u32 as i32; -pub const STATUS_DIRECTORY_NOT_EMPTY: ::NTSTATUS = 0xC0000101u32 as i32; -pub const STATUS_FILE_CORRUPT_ERROR: ::NTSTATUS = 0xC0000102u32 as i32; -pub const STATUS_NOT_A_DIRECTORY: ::NTSTATUS = 0xC0000103u32 as i32; -pub const STATUS_BAD_LOGON_SESSION_STATE: ::NTSTATUS = 0xC0000104u32 as i32; -pub const STATUS_LOGON_SESSION_COLLISION: ::NTSTATUS = 0xC0000105u32 as i32; -pub const STATUS_NAME_TOO_LONG: ::NTSTATUS = 0xC0000106u32 as i32; -pub const STATUS_FILES_OPEN: ::NTSTATUS = 0xC0000107u32 as i32; -pub const STATUS_CONNECTION_IN_USE: ::NTSTATUS = 0xC0000108u32 as i32; -pub const STATUS_MESSAGE_NOT_FOUND: ::NTSTATUS = 0xC0000109u32 as i32; -pub const STATUS_PROCESS_IS_TERMINATING: ::NTSTATUS = 0xC000010Au32 as i32; -pub const STATUS_INVALID_LOGON_TYPE: ::NTSTATUS = 0xC000010Bu32 as i32; -pub const STATUS_NO_GUID_TRANSLATION: ::NTSTATUS = 0xC000010Cu32 as i32; -pub const STATUS_CANNOT_IMPERSONATE: ::NTSTATUS = 0xC000010Du32 as i32; -pub const STATUS_IMAGE_ALREADY_LOADED: ::NTSTATUS = 0xC000010Eu32 as i32; -pub const STATUS_ABIOS_NOT_PRESENT: ::NTSTATUS = 0xC000010Fu32 as i32; -pub const STATUS_ABIOS_LID_NOT_EXIST: ::NTSTATUS = 0xC0000110u32 as i32; -pub const STATUS_ABIOS_LID_ALREADY_OWNED: ::NTSTATUS = 0xC0000111u32 as i32; -pub const STATUS_ABIOS_NOT_LID_OWNER: ::NTSTATUS = 0xC0000112u32 as i32; -pub const STATUS_ABIOS_INVALID_COMMAND: ::NTSTATUS = 0xC0000113u32 as i32; -pub const STATUS_ABIOS_INVALID_LID: ::NTSTATUS = 0xC0000114u32 as i32; -pub const STATUS_ABIOS_SELECTOR_NOT_AVAILABLE: ::NTSTATUS = 0xC0000115u32 as i32; -pub const STATUS_ABIOS_INVALID_SELECTOR: ::NTSTATUS = 0xC0000116u32 as i32; -pub const STATUS_NO_LDT: ::NTSTATUS = 0xC0000117u32 as i32; -pub const STATUS_INVALID_LDT_SIZE: ::NTSTATUS = 0xC0000118u32 as i32; -pub const STATUS_INVALID_LDT_OFFSET: ::NTSTATUS = 0xC0000119u32 as i32; -pub const STATUS_INVALID_LDT_DESCRIPTOR: ::NTSTATUS = 0xC000011Au32 as i32; -pub const STATUS_INVALID_IMAGE_NE_FORMAT: ::NTSTATUS = 0xC000011Bu32 as i32; -pub const STATUS_RXACT_INVALID_STATE: ::NTSTATUS = 0xC000011Cu32 as i32; -pub const STATUS_RXACT_COMMIT_FAILURE: ::NTSTATUS = 0xC000011Du32 as i32; -pub const STATUS_MAPPED_FILE_SIZE_ZERO: ::NTSTATUS = 0xC000011Eu32 as i32; -pub const STATUS_TOO_MANY_OPENED_FILES: ::NTSTATUS = 0xC000011Fu32 as i32; -pub const STATUS_CANCELLED: ::NTSTATUS = 0xC0000120u32 as i32; -pub const STATUS_CANNOT_DELETE: ::NTSTATUS = 0xC0000121u32 as i32; -pub const STATUS_INVALID_COMPUTER_NAME: ::NTSTATUS = 0xC0000122u32 as i32; -pub const STATUS_FILE_DELETED: ::NTSTATUS = 0xC0000123u32 as i32; -pub const STATUS_SPECIAL_ACCOUNT: ::NTSTATUS = 0xC0000124u32 as i32; -pub const STATUS_SPECIAL_GROUP: ::NTSTATUS = 0xC0000125u32 as i32; -pub const STATUS_SPECIAL_USER: ::NTSTATUS = 0xC0000126u32 as i32; -pub const STATUS_MEMBERS_PRIMARY_GROUP: ::NTSTATUS = 0xC0000127u32 as i32; -pub const STATUS_FILE_CLOSED: ::NTSTATUS = 0xC0000128u32 as i32; -pub const STATUS_TOO_MANY_THREADS: ::NTSTATUS = 0xC0000129u32 as i32; -pub const STATUS_THREAD_NOT_IN_PROCESS: ::NTSTATUS = 0xC000012Au32 as i32; -pub const STATUS_TOKEN_ALREADY_IN_USE: ::NTSTATUS = 0xC000012Bu32 as i32; -pub const STATUS_PAGEFILE_QUOTA_EXCEEDED: ::NTSTATUS = 0xC000012Cu32 as i32; -pub const STATUS_COMMITMENT_LIMIT: ::NTSTATUS = 0xC000012Du32 as i32; -pub const STATUS_INVALID_IMAGE_LE_FORMAT: ::NTSTATUS = 0xC000012Eu32 as i32; -pub const STATUS_INVALID_IMAGE_NOT_MZ: ::NTSTATUS = 0xC000012Fu32 as i32; -pub const STATUS_INVALID_IMAGE_PROTECT: ::NTSTATUS = 0xC0000130u32 as i32; -pub const STATUS_INVALID_IMAGE_WIN_16: ::NTSTATUS = 0xC0000131u32 as i32; -pub const STATUS_LOGON_SERVER_CONFLICT: ::NTSTATUS = 0xC0000132u32 as i32; -pub const STATUS_TIME_DIFFERENCE_AT_DC: ::NTSTATUS = 0xC0000133u32 as i32; -pub const STATUS_SYNCHRONIZATION_REQUIRED: ::NTSTATUS = 0xC0000134u32 as i32; -pub const STATUS_DLL_NOT_FOUND: ::NTSTATUS = 0xC0000135u32 as i32; -pub const STATUS_OPEN_FAILED: ::NTSTATUS = 0xC0000136u32 as i32; -pub const STATUS_IO_PRIVILEGE_FAILED: ::NTSTATUS = 0xC0000137u32 as i32; -pub const STATUS_ORDINAL_NOT_FOUND: ::NTSTATUS = 0xC0000138u32 as i32; -pub const STATUS_ENTRYPOINT_NOT_FOUND: ::NTSTATUS = 0xC0000139u32 as i32; -pub const STATUS_CONTROL_C_EXIT: ::NTSTATUS = 0xC000013Au32 as i32; -pub const STATUS_LOCAL_DISCONNECT: ::NTSTATUS = 0xC000013Bu32 as i32; -pub const STATUS_REMOTE_DISCONNECT: ::NTSTATUS = 0xC000013Cu32 as i32; -pub const STATUS_REMOTE_RESOURCES: ::NTSTATUS = 0xC000013Du32 as i32; -pub const STATUS_LINK_FAILED: ::NTSTATUS = 0xC000013Eu32 as i32; -pub const STATUS_LINK_TIMEOUT: ::NTSTATUS = 0xC000013Fu32 as i32; -pub const STATUS_INVALID_CONNECTION: ::NTSTATUS = 0xC0000140u32 as i32; -pub const STATUS_INVALID_ADDRESS: ::NTSTATUS = 0xC0000141u32 as i32; -pub const STATUS_DLL_INIT_FAILED: ::NTSTATUS = 0xC0000142u32 as i32; -pub const STATUS_MISSING_SYSTEMFILE: ::NTSTATUS = 0xC0000143u32 as i32; -pub const STATUS_UNHANDLED_EXCEPTION: ::NTSTATUS = 0xC0000144u32 as i32; -pub const STATUS_APP_INIT_FAILURE: ::NTSTATUS = 0xC0000145u32 as i32; -pub const STATUS_PAGEFILE_CREATE_FAILED: ::NTSTATUS = 0xC0000146u32 as i32; -pub const STATUS_NO_PAGEFILE: ::NTSTATUS = 0xC0000147u32 as i32; -pub const STATUS_INVALID_LEVEL: ::NTSTATUS = 0xC0000148u32 as i32; -pub const STATUS_WRONG_PASSWORD_CORE: ::NTSTATUS = 0xC0000149u32 as i32; -pub const STATUS_ILLEGAL_FLOAT_CONTEXT: ::NTSTATUS = 0xC000014Au32 as i32; -pub const STATUS_PIPE_BROKEN: ::NTSTATUS = 0xC000014Bu32 as i32; -pub const STATUS_REGISTRY_CORRUPT: ::NTSTATUS = 0xC000014Cu32 as i32; -pub const STATUS_REGISTRY_IO_FAILED: ::NTSTATUS = 0xC000014Du32 as i32; -pub const STATUS_NO_EVENT_PAIR: ::NTSTATUS = 0xC000014Eu32 as i32; -pub const STATUS_UNRECOGNIZED_VOLUME: ::NTSTATUS = 0xC000014Fu32 as i32; -pub const STATUS_SERIAL_NO_DEVICE_INITED: ::NTSTATUS = 0xC0000150u32 as i32; -pub const STATUS_NO_SUCH_ALIAS: ::NTSTATUS = 0xC0000151u32 as i32; -pub const STATUS_MEMBER_NOT_IN_ALIAS: ::NTSTATUS = 0xC0000152u32 as i32; -pub const STATUS_MEMBER_IN_ALIAS: ::NTSTATUS = 0xC0000153u32 as i32; -pub const STATUS_ALIAS_EXISTS: ::NTSTATUS = 0xC0000154u32 as i32; -pub const STATUS_LOGON_NOT_GRANTED: ::NTSTATUS = 0xC0000155u32 as i32; -pub const STATUS_TOO_MANY_SECRETS: ::NTSTATUS = 0xC0000156u32 as i32; -pub const STATUS_SECRET_TOO_LONG: ::NTSTATUS = 0xC0000157u32 as i32; -pub const STATUS_INTERNAL_DB_ERROR: ::NTSTATUS = 0xC0000158u32 as i32; -pub const STATUS_FULLSCREEN_MODE: ::NTSTATUS = 0xC0000159u32 as i32; -pub const STATUS_TOO_MANY_CONTEXT_IDS: ::NTSTATUS = 0xC000015Au32 as i32; -pub const STATUS_LOGON_TYPE_NOT_GRANTED: ::NTSTATUS = 0xC000015Bu32 as i32; -pub const STATUS_NOT_REGISTRY_FILE: ::NTSTATUS = 0xC000015Cu32 as i32; -pub const STATUS_NT_CROSS_ENCRYPTION_REQUIRED: ::NTSTATUS = 0xC000015Du32 as i32; -pub const STATUS_DOMAIN_CTRLR_CONFIG_ERROR: ::NTSTATUS = 0xC000015Eu32 as i32; -pub const STATUS_FT_MISSING_MEMBER: ::NTSTATUS = 0xC000015Fu32 as i32; -pub const STATUS_ILL_FORMED_SERVICE_ENTRY: ::NTSTATUS = 0xC0000160u32 as i32; -pub const STATUS_ILLEGAL_CHARACTER: ::NTSTATUS = 0xC0000161u32 as i32; -pub const STATUS_UNMAPPABLE_CHARACTER: ::NTSTATUS = 0xC0000162u32 as i32; -pub const STATUS_UNDEFINED_CHARACTER: ::NTSTATUS = 0xC0000163u32 as i32; -pub const STATUS_FLOPPY_VOLUME: ::NTSTATUS = 0xC0000164u32 as i32; -pub const STATUS_FLOPPY_ID_MARK_NOT_FOUND: ::NTSTATUS = 0xC0000165u32 as i32; -pub const STATUS_FLOPPY_WRONG_CYLINDER: ::NTSTATUS = 0xC0000166u32 as i32; -pub const STATUS_FLOPPY_UNKNOWN_ERROR: ::NTSTATUS = 0xC0000167u32 as i32; -pub const STATUS_FLOPPY_BAD_REGISTERS: ::NTSTATUS = 0xC0000168u32 as i32; -pub const STATUS_DISK_RECALIBRATE_FAILED: ::NTSTATUS = 0xC0000169u32 as i32; -pub const STATUS_DISK_OPERATION_FAILED: ::NTSTATUS = 0xC000016Au32 as i32; -pub const STATUS_DISK_RESET_FAILED: ::NTSTATUS = 0xC000016Bu32 as i32; -pub const STATUS_SHARED_IRQ_BUSY: ::NTSTATUS = 0xC000016Cu32 as i32; -pub const STATUS_FT_ORPHANING: ::NTSTATUS = 0xC000016Du32 as i32; -pub const STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT: ::NTSTATUS = 0xC000016Eu32 as i32; -pub const STATUS_PARTITION_FAILURE: ::NTSTATUS = 0xC0000172u32 as i32; -pub const STATUS_INVALID_BLOCK_LENGTH: ::NTSTATUS = 0xC0000173u32 as i32; -pub const STATUS_DEVICE_NOT_PARTITIONED: ::NTSTATUS = 0xC0000174u32 as i32; -pub const STATUS_UNABLE_TO_LOCK_MEDIA: ::NTSTATUS = 0xC0000175u32 as i32; -pub const STATUS_UNABLE_TO_UNLOAD_MEDIA: ::NTSTATUS = 0xC0000176u32 as i32; -pub const STATUS_EOM_OVERFLOW: ::NTSTATUS = 0xC0000177u32 as i32; -pub const STATUS_NO_MEDIA: ::NTSTATUS = 0xC0000178u32 as i32; -pub const STATUS_NO_SUCH_MEMBER: ::NTSTATUS = 0xC000017Au32 as i32; -pub const STATUS_INVALID_MEMBER: ::NTSTATUS = 0xC000017Bu32 as i32; -pub const STATUS_KEY_DELETED: ::NTSTATUS = 0xC000017Cu32 as i32; -pub const STATUS_NO_LOG_SPACE: ::NTSTATUS = 0xC000017Du32 as i32; -pub const STATUS_TOO_MANY_SIDS: ::NTSTATUS = 0xC000017Eu32 as i32; -pub const STATUS_LM_CROSS_ENCRYPTION_REQUIRED: ::NTSTATUS = 0xC000017Fu32 as i32; -pub const STATUS_KEY_HAS_CHILDREN: ::NTSTATUS = 0xC0000180u32 as i32; -pub const STATUS_CHILD_MUST_BE_VOLATILE: ::NTSTATUS = 0xC0000181u32 as i32; -pub const STATUS_DEVICE_CONFIGURATION_ERROR: ::NTSTATUS = 0xC0000182u32 as i32; -pub const STATUS_DRIVER_INTERNAL_ERROR: ::NTSTATUS = 0xC0000183u32 as i32; -pub const STATUS_INVALID_DEVICE_STATE: ::NTSTATUS = 0xC0000184u32 as i32; -pub const STATUS_IO_DEVICE_ERROR: ::NTSTATUS = 0xC0000185u32 as i32; -pub const STATUS_DEVICE_PROTOCOL_ERROR: ::NTSTATUS = 0xC0000186u32 as i32; -pub const STATUS_BACKUP_CONTROLLER: ::NTSTATUS = 0xC0000187u32 as i32; -pub const STATUS_LOG_FILE_FULL: ::NTSTATUS = 0xC0000188u32 as i32; -pub const STATUS_TOO_LATE: ::NTSTATUS = 0xC0000189u32 as i32; -pub const STATUS_NO_TRUST_LSA_SECRET: ::NTSTATUS = 0xC000018Au32 as i32; -pub const STATUS_NO_TRUST_SAM_ACCOUNT: ::NTSTATUS = 0xC000018Bu32 as i32; -pub const STATUS_TRUSTED_DOMAIN_FAILURE: ::NTSTATUS = 0xC000018Cu32 as i32; -pub const STATUS_TRUSTED_RELATIONSHIP_FAILURE: ::NTSTATUS = 0xC000018Du32 as i32; -pub const STATUS_EVENTLOG_FILE_CORRUPT: ::NTSTATUS = 0xC000018Eu32 as i32; -pub const STATUS_EVENTLOG_CANT_START: ::NTSTATUS = 0xC000018Fu32 as i32; -pub const STATUS_TRUST_FAILURE: ::NTSTATUS = 0xC0000190u32 as i32; -pub const STATUS_MUTANT_LIMIT_EXCEEDED: ::NTSTATUS = 0xC0000191u32 as i32; -pub const STATUS_NETLOGON_NOT_STARTED: ::NTSTATUS = 0xC0000192u32 as i32; -pub const STATUS_ACCOUNT_EXPIRED: ::NTSTATUS = 0xC0000193u32 as i32; -pub const STATUS_POSSIBLE_DEADLOCK: ::NTSTATUS = 0xC0000194u32 as i32; -pub const STATUS_NETWORK_CREDENTIAL_CONFLICT: ::NTSTATUS = 0xC0000195u32 as i32; -pub const STATUS_REMOTE_SESSION_LIMIT: ::NTSTATUS = 0xC0000196u32 as i32; -pub const STATUS_EVENTLOG_FILE_CHANGED: ::NTSTATUS = 0xC0000197u32 as i32; -pub const STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT: ::NTSTATUS = 0xC0000198u32 as i32; -pub const STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT: ::NTSTATUS = 0xC0000199u32 as i32; -pub const STATUS_NOLOGON_SERVER_TRUST_ACCOUNT: ::NTSTATUS = 0xC000019Au32 as i32; -pub const STATUS_DOMAIN_TRUST_INCONSISTENT: ::NTSTATUS = 0xC000019Bu32 as i32; -pub const STATUS_FS_DRIVER_REQUIRED: ::NTSTATUS = 0xC000019Cu32 as i32; -pub const STATUS_IMAGE_ALREADY_LOADED_AS_DLL: ::NTSTATUS = 0xC000019Du32 as i32; -pub const STATUS_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING: ::NTSTATUS = 0xC000019Eu32 as i32; -pub const STATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME: ::NTSTATUS = 0xC000019Fu32 as i32; -pub const STATUS_SECURITY_STREAM_IS_INCONSISTENT: ::NTSTATUS = 0xC00001A0u32 as i32; -pub const STATUS_INVALID_LOCK_RANGE: ::NTSTATUS = 0xC00001A1u32 as i32; -pub const STATUS_INVALID_ACE_CONDITION: ::NTSTATUS = 0xC00001A2u32 as i32; -pub const STATUS_IMAGE_SUBSYSTEM_NOT_PRESENT: ::NTSTATUS = 0xC00001A3u32 as i32; -pub const STATUS_NOTIFICATION_GUID_ALREADY_DEFINED: ::NTSTATUS = 0xC00001A4u32 as i32; -pub const STATUS_INVALID_EXCEPTION_HANDLER: ::NTSTATUS = 0xC00001A5u32 as i32; -pub const STATUS_DUPLICATE_PRIVILEGES: ::NTSTATUS = 0xC00001A6u32 as i32; -pub const STATUS_NOT_ALLOWED_ON_SYSTEM_FILE: ::NTSTATUS = 0xC00001A7u32 as i32; -pub const STATUS_REPAIR_NEEDED: ::NTSTATUS = 0xC00001A8u32 as i32; -pub const STATUS_QUOTA_NOT_ENABLED: ::NTSTATUS = 0xC00001A9u32 as i32; -pub const STATUS_NO_APPLICATION_PACKAGE: ::NTSTATUS = 0xC00001AAu32 as i32; -pub const STATUS_FILE_METADATA_OPTIMIZATION_IN_PROGRESS: ::NTSTATUS = 0xC00001ABu32 as i32; -pub const STATUS_NOT_SAME_OBJECT: ::NTSTATUS = 0xC00001ACu32 as i32; -pub const STATUS_FATAL_MEMORY_EXHAUSTION: ::NTSTATUS = 0xC00001ADu32 as i32; -pub const STATUS_ERROR_PROCESS_NOT_IN_JOB: ::NTSTATUS = 0xC00001AEu32 as i32; -pub const STATUS_NETWORK_OPEN_RESTRICTION: ::NTSTATUS = 0xC0000201u32 as i32; -pub const STATUS_NO_USER_SESSION_KEY: ::NTSTATUS = 0xC0000202u32 as i32; -pub const STATUS_USER_SESSION_DELETED: ::NTSTATUS = 0xC0000203u32 as i32; -pub const STATUS_RESOURCE_LANG_NOT_FOUND: ::NTSTATUS = 0xC0000204u32 as i32; -pub const STATUS_INSUFF_SERVER_RESOURCES: ::NTSTATUS = 0xC0000205u32 as i32; -pub const STATUS_INVALID_BUFFER_SIZE: ::NTSTATUS = 0xC0000206u32 as i32; -pub const STATUS_INVALID_ADDRESS_COMPONENT: ::NTSTATUS = 0xC0000207u32 as i32; -pub const STATUS_INVALID_ADDRESS_WILDCARD: ::NTSTATUS = 0xC0000208u32 as i32; -pub const STATUS_TOO_MANY_ADDRESSES: ::NTSTATUS = 0xC0000209u32 as i32; -pub const STATUS_ADDRESS_ALREADY_EXISTS: ::NTSTATUS = 0xC000020Au32 as i32; -pub const STATUS_ADDRESS_CLOSED: ::NTSTATUS = 0xC000020Bu32 as i32; -pub const STATUS_CONNECTION_DISCONNECTED: ::NTSTATUS = 0xC000020Cu32 as i32; -pub const STATUS_CONNECTION_RESET: ::NTSTATUS = 0xC000020Du32 as i32; -pub const STATUS_TOO_MANY_NODES: ::NTSTATUS = 0xC000020Eu32 as i32; -pub const STATUS_TRANSACTION_ABORTED: ::NTSTATUS = 0xC000020Fu32 as i32; -pub const STATUS_TRANSACTION_TIMED_OUT: ::NTSTATUS = 0xC0000210u32 as i32; -pub const STATUS_TRANSACTION_NO_RELEASE: ::NTSTATUS = 0xC0000211u32 as i32; -pub const STATUS_TRANSACTION_NO_MATCH: ::NTSTATUS = 0xC0000212u32 as i32; -pub const STATUS_TRANSACTION_RESPONDED: ::NTSTATUS = 0xC0000213u32 as i32; -pub const STATUS_TRANSACTION_INVALID_ID: ::NTSTATUS = 0xC0000214u32 as i32; -pub const STATUS_TRANSACTION_INVALID_TYPE: ::NTSTATUS = 0xC0000215u32 as i32; -pub const STATUS_NOT_SERVER_SESSION: ::NTSTATUS = 0xC0000216u32 as i32; -pub const STATUS_NOT_CLIENT_SESSION: ::NTSTATUS = 0xC0000217u32 as i32; -pub const STATUS_CANNOT_LOAD_REGISTRY_FILE: ::NTSTATUS = 0xC0000218u32 as i32; -pub const STATUS_DEBUG_ATTACH_FAILED: ::NTSTATUS = 0xC0000219u32 as i32; -pub const STATUS_SYSTEM_PROCESS_TERMINATED: ::NTSTATUS = 0xC000021Au32 as i32; -pub const STATUS_DATA_NOT_ACCEPTED: ::NTSTATUS = 0xC000021Bu32 as i32; -pub const STATUS_NO_BROWSER_SERVERS_FOUND: ::NTSTATUS = 0xC000021Cu32 as i32; -pub const STATUS_VDM_HARD_ERROR: ::NTSTATUS = 0xC000021Du32 as i32; -pub const STATUS_DRIVER_CANCEL_TIMEOUT: ::NTSTATUS = 0xC000021Eu32 as i32; -pub const STATUS_REPLY_MESSAGE_MISMATCH: ::NTSTATUS = 0xC000021Fu32 as i32; -pub const STATUS_MAPPED_ALIGNMENT: ::NTSTATUS = 0xC0000220u32 as i32; -pub const STATUS_IMAGE_CHECKSUM_MISMATCH: ::NTSTATUS = 0xC0000221u32 as i32; -pub const STATUS_LOST_WRITEBEHIND_DATA: ::NTSTATUS = 0xC0000222u32 as i32; -pub const STATUS_CLIENT_SERVER_PARAMETERS_INVALID: ::NTSTATUS = 0xC0000223u32 as i32; -pub const STATUS_PASSWORD_MUST_CHANGE: ::NTSTATUS = 0xC0000224u32 as i32; -pub const STATUS_NOT_FOUND: ::NTSTATUS = 0xC0000225u32 as i32; -pub const STATUS_NOT_TINY_STREAM: ::NTSTATUS = 0xC0000226u32 as i32; -pub const STATUS_RECOVERY_FAILURE: ::NTSTATUS = 0xC0000227u32 as i32; -pub const STATUS_STACK_OVERFLOW_READ: ::NTSTATUS = 0xC0000228u32 as i32; -pub const STATUS_FAIL_CHECK: ::NTSTATUS = 0xC0000229u32 as i32; -pub const STATUS_DUPLICATE_OBJECTID: ::NTSTATUS = 0xC000022Au32 as i32; -pub const STATUS_OBJECTID_EXISTS: ::NTSTATUS = 0xC000022Bu32 as i32; -pub const STATUS_CONVERT_TO_LARGE: ::NTSTATUS = 0xC000022Cu32 as i32; -pub const STATUS_RETRY: ::NTSTATUS = 0xC000022Du32 as i32; -pub const STATUS_FOUND_OUT_OF_SCOPE: ::NTSTATUS = 0xC000022Eu32 as i32; -pub const STATUS_ALLOCATE_BUCKET: ::NTSTATUS = 0xC000022Fu32 as i32; -pub const STATUS_PROPSET_NOT_FOUND: ::NTSTATUS = 0xC0000230u32 as i32; -pub const STATUS_MARSHALL_OVERFLOW: ::NTSTATUS = 0xC0000231u32 as i32; -pub const STATUS_INVALID_VARIANT: ::NTSTATUS = 0xC0000232u32 as i32; -pub const STATUS_DOMAIN_CONTROLLER_NOT_FOUND: ::NTSTATUS = 0xC0000233u32 as i32; -pub const STATUS_ACCOUNT_LOCKED_OUT: ::NTSTATUS = 0xC0000234u32 as i32; -pub const STATUS_HANDLE_NOT_CLOSABLE: ::NTSTATUS = 0xC0000235u32 as i32; -pub const STATUS_CONNECTION_REFUSED: ::NTSTATUS = 0xC0000236u32 as i32; -pub const STATUS_GRACEFUL_DISCONNECT: ::NTSTATUS = 0xC0000237u32 as i32; -pub const STATUS_ADDRESS_ALREADY_ASSOCIATED: ::NTSTATUS = 0xC0000238u32 as i32; -pub const STATUS_ADDRESS_NOT_ASSOCIATED: ::NTSTATUS = 0xC0000239u32 as i32; -pub const STATUS_CONNECTION_INVALID: ::NTSTATUS = 0xC000023Au32 as i32; -pub const STATUS_CONNECTION_ACTIVE: ::NTSTATUS = 0xC000023Bu32 as i32; -pub const STATUS_NETWORK_UNREACHABLE: ::NTSTATUS = 0xC000023Cu32 as i32; -pub const STATUS_HOST_UNREACHABLE: ::NTSTATUS = 0xC000023Du32 as i32; -pub const STATUS_PROTOCOL_UNREACHABLE: ::NTSTATUS = 0xC000023Eu32 as i32; -pub const STATUS_PORT_UNREACHABLE: ::NTSTATUS = 0xC000023Fu32 as i32; -pub const STATUS_REQUEST_ABORTED: ::NTSTATUS = 0xC0000240u32 as i32; -pub const STATUS_CONNECTION_ABORTED: ::NTSTATUS = 0xC0000241u32 as i32; -pub const STATUS_BAD_COMPRESSION_BUFFER: ::NTSTATUS = 0xC0000242u32 as i32; -pub const STATUS_USER_MAPPED_FILE: ::NTSTATUS = 0xC0000243u32 as i32; -pub const STATUS_AUDIT_FAILED: ::NTSTATUS = 0xC0000244u32 as i32; -pub const STATUS_TIMER_RESOLUTION_NOT_SET: ::NTSTATUS = 0xC0000245u32 as i32; -pub const STATUS_CONNECTION_COUNT_LIMIT: ::NTSTATUS = 0xC0000246u32 as i32; -pub const STATUS_LOGIN_TIME_RESTRICTION: ::NTSTATUS = 0xC0000247u32 as i32; -pub const STATUS_LOGIN_WKSTA_RESTRICTION: ::NTSTATUS = 0xC0000248u32 as i32; -pub const STATUS_IMAGE_MP_UP_MISMATCH: ::NTSTATUS = 0xC0000249u32 as i32; -pub const STATUS_INSUFFICIENT_LOGON_INFO: ::NTSTATUS = 0xC0000250u32 as i32; -pub const STATUS_BAD_DLL_ENTRYPOINT: ::NTSTATUS = 0xC0000251u32 as i32; -pub const STATUS_BAD_SERVICE_ENTRYPOINT: ::NTSTATUS = 0xC0000252u32 as i32; -pub const STATUS_LPC_REPLY_LOST: ::NTSTATUS = 0xC0000253u32 as i32; -pub const STATUS_IP_ADDRESS_CONFLICT1: ::NTSTATUS = 0xC0000254u32 as i32; -pub const STATUS_IP_ADDRESS_CONFLICT2: ::NTSTATUS = 0xC0000255u32 as i32; -pub const STATUS_REGISTRY_QUOTA_LIMIT: ::NTSTATUS = 0xC0000256u32 as i32; -pub const STATUS_PATH_NOT_COVERED: ::NTSTATUS = 0xC0000257u32 as i32; -pub const STATUS_NO_CALLBACK_ACTIVE: ::NTSTATUS = 0xC0000258u32 as i32; -pub const STATUS_LICENSE_QUOTA_EXCEEDED: ::NTSTATUS = 0xC0000259u32 as i32; -pub const STATUS_PWD_TOO_SHORT: ::NTSTATUS = 0xC000025Au32 as i32; -pub const STATUS_PWD_TOO_RECENT: ::NTSTATUS = 0xC000025Bu32 as i32; -pub const STATUS_PWD_HISTORY_CONFLICT: ::NTSTATUS = 0xC000025Cu32 as i32; -pub const STATUS_PLUGPLAY_NO_DEVICE: ::NTSTATUS = 0xC000025Eu32 as i32; -pub const STATUS_UNSUPPORTED_COMPRESSION: ::NTSTATUS = 0xC000025Fu32 as i32; -pub const STATUS_INVALID_HW_PROFILE: ::NTSTATUS = 0xC0000260u32 as i32; -pub const STATUS_INVALID_PLUGPLAY_DEVICE_PATH: ::NTSTATUS = 0xC0000261u32 as i32; -pub const STATUS_DRIVER_ORDINAL_NOT_FOUND: ::NTSTATUS = 0xC0000262u32 as i32; -pub const STATUS_DRIVER_ENTRYPOINT_NOT_FOUND: ::NTSTATUS = 0xC0000263u32 as i32; -pub const STATUS_RESOURCE_NOT_OWNED: ::NTSTATUS = 0xC0000264u32 as i32; -pub const STATUS_TOO_MANY_LINKS: ::NTSTATUS = 0xC0000265u32 as i32; -pub const STATUS_QUOTA_LIST_INCONSISTENT: ::NTSTATUS = 0xC0000266u32 as i32; -pub const STATUS_FILE_IS_OFFLINE: ::NTSTATUS = 0xC0000267u32 as i32; -pub const STATUS_EVALUATION_EXPIRATION: ::NTSTATUS = 0xC0000268u32 as i32; -pub const STATUS_ILLEGAL_DLL_RELOCATION: ::NTSTATUS = 0xC0000269u32 as i32; -pub const STATUS_LICENSE_VIOLATION: ::NTSTATUS = 0xC000026Au32 as i32; -pub const STATUS_DLL_INIT_FAILED_LOGOFF: ::NTSTATUS = 0xC000026Bu32 as i32; -pub const STATUS_DRIVER_UNABLE_TO_LOAD: ::NTSTATUS = 0xC000026Cu32 as i32; -pub const STATUS_DFS_UNAVAILABLE: ::NTSTATUS = 0xC000026Du32 as i32; -pub const STATUS_VOLUME_DISMOUNTED: ::NTSTATUS = 0xC000026Eu32 as i32; -pub const STATUS_WX86_INTERNAL_ERROR: ::NTSTATUS = 0xC000026Fu32 as i32; -pub const STATUS_WX86_FLOAT_STACK_CHECK: ::NTSTATUS = 0xC0000270u32 as i32; -pub const STATUS_VALIDATE_CONTINUE: ::NTSTATUS = 0xC0000271u32 as i32; -pub const STATUS_NO_MATCH: ::NTSTATUS = 0xC0000272u32 as i32; -pub const STATUS_NO_MORE_MATCHES: ::NTSTATUS = 0xC0000273u32 as i32; -pub const STATUS_NOT_A_REPARSE_POINT: ::NTSTATUS = 0xC0000275u32 as i32; -pub const STATUS_IO_REPARSE_TAG_INVALID: ::NTSTATUS = 0xC0000276u32 as i32; -pub const STATUS_IO_REPARSE_TAG_MISMATCH: ::NTSTATUS = 0xC0000277u32 as i32; -pub const STATUS_IO_REPARSE_DATA_INVALID: ::NTSTATUS = 0xC0000278u32 as i32; -pub const STATUS_IO_REPARSE_TAG_NOT_HANDLED: ::NTSTATUS = 0xC0000279u32 as i32; -pub const STATUS_PWD_TOO_LONG: ::NTSTATUS = 0xC000027Au32 as i32; -pub const STATUS_STOWED_EXCEPTION: ::NTSTATUS = 0xC000027Bu32 as i32; -pub const STATUS_REPARSE_POINT_NOT_RESOLVED: ::NTSTATUS = 0xC0000280u32 as i32; -pub const STATUS_DIRECTORY_IS_A_REPARSE_POINT: ::NTSTATUS = 0xC0000281u32 as i32; -pub const STATUS_RANGE_LIST_CONFLICT: ::NTSTATUS = 0xC0000282u32 as i32; -pub const STATUS_SOURCE_ELEMENT_EMPTY: ::NTSTATUS = 0xC0000283u32 as i32; -pub const STATUS_DESTINATION_ELEMENT_FULL: ::NTSTATUS = 0xC0000284u32 as i32; -pub const STATUS_ILLEGAL_ELEMENT_ADDRESS: ::NTSTATUS = 0xC0000285u32 as i32; -pub const STATUS_MAGAZINE_NOT_PRESENT: ::NTSTATUS = 0xC0000286u32 as i32; -pub const STATUS_REINITIALIZATION_NEEDED: ::NTSTATUS = 0xC0000287u32 as i32; -pub const STATUS_DEVICE_REQUIRES_CLEANING: ::NTSTATUS = 0x80000288u32 as i32; -pub const STATUS_DEVICE_DOOR_OPEN: ::NTSTATUS = 0x80000289u32 as i32; -pub const STATUS_ENCRYPTION_FAILED: ::NTSTATUS = 0xC000028Au32 as i32; -pub const STATUS_DECRYPTION_FAILED: ::NTSTATUS = 0xC000028Bu32 as i32; -pub const STATUS_RANGE_NOT_FOUND: ::NTSTATUS = 0xC000028Cu32 as i32; -pub const STATUS_NO_RECOVERY_POLICY: ::NTSTATUS = 0xC000028Du32 as i32; -pub const STATUS_NO_EFS: ::NTSTATUS = 0xC000028Eu32 as i32; -pub const STATUS_WRONG_EFS: ::NTSTATUS = 0xC000028Fu32 as i32; -pub const STATUS_NO_USER_KEYS: ::NTSTATUS = 0xC0000290u32 as i32; -pub const STATUS_FILE_NOT_ENCRYPTED: ::NTSTATUS = 0xC0000291u32 as i32; -pub const STATUS_NOT_EXPORT_FORMAT: ::NTSTATUS = 0xC0000292u32 as i32; -pub const STATUS_FILE_ENCRYPTED: ::NTSTATUS = 0xC0000293u32 as i32; -pub const STATUS_WAKE_SYSTEM: ::NTSTATUS = 0x40000294; -pub const STATUS_WMI_GUID_NOT_FOUND: ::NTSTATUS = 0xC0000295u32 as i32; -pub const STATUS_WMI_INSTANCE_NOT_FOUND: ::NTSTATUS = 0xC0000296u32 as i32; -pub const STATUS_WMI_ITEMID_NOT_FOUND: ::NTSTATUS = 0xC0000297u32 as i32; -pub const STATUS_WMI_TRY_AGAIN: ::NTSTATUS = 0xC0000298u32 as i32; -pub const STATUS_SHARED_POLICY: ::NTSTATUS = 0xC0000299u32 as i32; -pub const STATUS_POLICY_OBJECT_NOT_FOUND: ::NTSTATUS = 0xC000029Au32 as i32; -pub const STATUS_POLICY_ONLY_IN_DS: ::NTSTATUS = 0xC000029Bu32 as i32; -pub const STATUS_VOLUME_NOT_UPGRADED: ::NTSTATUS = 0xC000029Cu32 as i32; -pub const STATUS_REMOTE_STORAGE_NOT_ACTIVE: ::NTSTATUS = 0xC000029Du32 as i32; -pub const STATUS_REMOTE_STORAGE_MEDIA_ERROR: ::NTSTATUS = 0xC000029Eu32 as i32; -pub const STATUS_NO_TRACKING_SERVICE: ::NTSTATUS = 0xC000029Fu32 as i32; -pub const STATUS_SERVER_SID_MISMATCH: ::NTSTATUS = 0xC00002A0u32 as i32; -pub const STATUS_DS_NO_ATTRIBUTE_OR_VALUE: ::NTSTATUS = 0xC00002A1u32 as i32; -pub const STATUS_DS_INVALID_ATTRIBUTE_SYNTAX: ::NTSTATUS = 0xC00002A2u32 as i32; -pub const STATUS_DS_ATTRIBUTE_TYPE_UNDEFINED: ::NTSTATUS = 0xC00002A3u32 as i32; -pub const STATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS: ::NTSTATUS = 0xC00002A4u32 as i32; -pub const STATUS_DS_BUSY: ::NTSTATUS = 0xC00002A5u32 as i32; -pub const STATUS_DS_UNAVAILABLE: ::NTSTATUS = 0xC00002A6u32 as i32; -pub const STATUS_DS_NO_RIDS_ALLOCATED: ::NTSTATUS = 0xC00002A7u32 as i32; -pub const STATUS_DS_NO_MORE_RIDS: ::NTSTATUS = 0xC00002A8u32 as i32; -pub const STATUS_DS_INCORRECT_ROLE_OWNER: ::NTSTATUS = 0xC00002A9u32 as i32; -pub const STATUS_DS_RIDMGR_INIT_ERROR: ::NTSTATUS = 0xC00002AAu32 as i32; -pub const STATUS_DS_OBJ_CLASS_VIOLATION: ::NTSTATUS = 0xC00002ABu32 as i32; -pub const STATUS_DS_CANT_ON_NON_LEAF: ::NTSTATUS = 0xC00002ACu32 as i32; -pub const STATUS_DS_CANT_ON_RDN: ::NTSTATUS = 0xC00002ADu32 as i32; -pub const STATUS_DS_CANT_MOD_OBJ_CLASS: ::NTSTATUS = 0xC00002AEu32 as i32; -pub const STATUS_DS_CROSS_DOM_MOVE_FAILED: ::NTSTATUS = 0xC00002AFu32 as i32; -pub const STATUS_DS_GC_NOT_AVAILABLE: ::NTSTATUS = 0xC00002B0u32 as i32; -pub const STATUS_DIRECTORY_SERVICE_REQUIRED: ::NTSTATUS = 0xC00002B1u32 as i32; -pub const STATUS_REPARSE_ATTRIBUTE_CONFLICT: ::NTSTATUS = 0xC00002B2u32 as i32; -pub const STATUS_CANT_ENABLE_DENY_ONLY: ::NTSTATUS = 0xC00002B3u32 as i32; -pub const STATUS_FLOAT_MULTIPLE_FAULTS: ::NTSTATUS = 0xC00002B4u32 as i32; -pub const STATUS_FLOAT_MULTIPLE_TRAPS: ::NTSTATUS = 0xC00002B5u32 as i32; -pub const STATUS_DEVICE_REMOVED: ::NTSTATUS = 0xC00002B6u32 as i32; -pub const STATUS_JOURNAL_DELETE_IN_PROGRESS: ::NTSTATUS = 0xC00002B7u32 as i32; -pub const STATUS_JOURNAL_NOT_ACTIVE: ::NTSTATUS = 0xC00002B8u32 as i32; -pub const STATUS_NOINTERFACE: ::NTSTATUS = 0xC00002B9u32 as i32; -pub const STATUS_DS_RIDMGR_DISABLED: ::NTSTATUS = 0xC00002BAu32 as i32; -pub const STATUS_DS_ADMIN_LIMIT_EXCEEDED: ::NTSTATUS = 0xC00002C1u32 as i32; -pub const STATUS_DRIVER_FAILED_SLEEP: ::NTSTATUS = 0xC00002C2u32 as i32; -pub const STATUS_MUTUAL_AUTHENTICATION_FAILED: ::NTSTATUS = 0xC00002C3u32 as i32; -pub const STATUS_CORRUPT_SYSTEM_FILE: ::NTSTATUS = 0xC00002C4u32 as i32; -pub const STATUS_DATATYPE_MISALIGNMENT_ERROR: ::NTSTATUS = 0xC00002C5u32 as i32; -pub const STATUS_WMI_READ_ONLY: ::NTSTATUS = 0xC00002C6u32 as i32; -pub const STATUS_WMI_SET_FAILURE: ::NTSTATUS = 0xC00002C7u32 as i32; -pub const STATUS_COMMITMENT_MINIMUM: ::NTSTATUS = 0xC00002C8u32 as i32; -pub const STATUS_REG_NAT_CONSUMPTION: ::NTSTATUS = 0xC00002C9u32 as i32; -pub const STATUS_TRANSPORT_FULL: ::NTSTATUS = 0xC00002CAu32 as i32; -pub const STATUS_DS_SAM_INIT_FAILURE: ::NTSTATUS = 0xC00002CBu32 as i32; -pub const STATUS_ONLY_IF_CONNECTED: ::NTSTATUS = 0xC00002CCu32 as i32; -pub const STATUS_DS_SENSITIVE_GROUP_VIOLATION: ::NTSTATUS = 0xC00002CDu32 as i32; -pub const STATUS_PNP_RESTART_ENUMERATION: ::NTSTATUS = 0xC00002CEu32 as i32; -pub const STATUS_JOURNAL_ENTRY_DELETED: ::NTSTATUS = 0xC00002CFu32 as i32; -pub const STATUS_DS_CANT_MOD_PRIMARYGROUPID: ::NTSTATUS = 0xC00002D0u32 as i32; -pub const STATUS_SYSTEM_IMAGE_BAD_SIGNATURE: ::NTSTATUS = 0xC00002D1u32 as i32; -pub const STATUS_PNP_REBOOT_REQUIRED: ::NTSTATUS = 0xC00002D2u32 as i32; -pub const STATUS_POWER_STATE_INVALID: ::NTSTATUS = 0xC00002D3u32 as i32; -pub const STATUS_DS_INVALID_GROUP_TYPE: ::NTSTATUS = 0xC00002D4u32 as i32; -pub const STATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN: ::NTSTATUS = 0xC00002D5u32 as i32; -pub const STATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN: ::NTSTATUS = 0xC00002D6u32 as i32; -pub const STATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER: ::NTSTATUS = 0xC00002D7u32 as i32; -pub const STATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER: ::NTSTATUS = 0xC00002D8u32 as i32; -pub const STATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER: ::NTSTATUS = 0xC00002D9u32 as i32; -pub const STATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER: ::NTSTATUS = 0xC00002DAu32 as i32; -pub const STATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER: ::NTSTATUS = 0xC00002DBu32 as i32; -pub const STATUS_DS_HAVE_PRIMARY_MEMBERS: ::NTSTATUS = 0xC00002DCu32 as i32; -pub const STATUS_WMI_NOT_SUPPORTED: ::NTSTATUS = 0xC00002DDu32 as i32; -pub const STATUS_INSUFFICIENT_POWER: ::NTSTATUS = 0xC00002DEu32 as i32; -pub const STATUS_SAM_NEED_BOOTKEY_PASSWORD: ::NTSTATUS = 0xC00002DFu32 as i32; -pub const STATUS_SAM_NEED_BOOTKEY_FLOPPY: ::NTSTATUS = 0xC00002E0u32 as i32; -pub const STATUS_DS_CANT_START: ::NTSTATUS = 0xC00002E1u32 as i32; -pub const STATUS_DS_INIT_FAILURE: ::NTSTATUS = 0xC00002E2u32 as i32; -pub const STATUS_SAM_INIT_FAILURE: ::NTSTATUS = 0xC00002E3u32 as i32; -pub const STATUS_DS_GC_REQUIRED: ::NTSTATUS = 0xC00002E4u32 as i32; -pub const STATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY: ::NTSTATUS = 0xC00002E5u32 as i32; -pub const STATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS: ::NTSTATUS = 0xC00002E6u32 as i32; -pub const STATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED: ::NTSTATUS = 0xC00002E7u32 as i32; -pub const STATUS_MULTIPLE_FAULT_VIOLATION: ::NTSTATUS = 0xC00002E8u32 as i32; -pub const STATUS_CURRENT_DOMAIN_NOT_ALLOWED: ::NTSTATUS = 0xC00002E9u32 as i32; -pub const STATUS_CANNOT_MAKE: ::NTSTATUS = 0xC00002EAu32 as i32; -pub const STATUS_SYSTEM_SHUTDOWN: ::NTSTATUS = 0xC00002EBu32 as i32; -pub const STATUS_DS_INIT_FAILURE_CONSOLE: ::NTSTATUS = 0xC00002ECu32 as i32; -pub const STATUS_DS_SAM_INIT_FAILURE_CONSOLE: ::NTSTATUS = 0xC00002EDu32 as i32; -pub const STATUS_UNFINISHED_CONTEXT_DELETED: ::NTSTATUS = 0xC00002EEu32 as i32; -pub const STATUS_NO_TGT_REPLY: ::NTSTATUS = 0xC00002EFu32 as i32; -pub const STATUS_OBJECTID_NOT_FOUND: ::NTSTATUS = 0xC00002F0u32 as i32; -pub const STATUS_NO_IP_ADDRESSES: ::NTSTATUS = 0xC00002F1u32 as i32; -pub const STATUS_WRONG_CREDENTIAL_HANDLE: ::NTSTATUS = 0xC00002F2u32 as i32; -pub const STATUS_CRYPTO_SYSTEM_INVALID: ::NTSTATUS = 0xC00002F3u32 as i32; -pub const STATUS_MAX_REFERRALS_EXCEEDED: ::NTSTATUS = 0xC00002F4u32 as i32; -pub const STATUS_MUST_BE_KDC: ::NTSTATUS = 0xC00002F5u32 as i32; -pub const STATUS_STRONG_CRYPTO_NOT_SUPPORTED: ::NTSTATUS = 0xC00002F6u32 as i32; -pub const STATUS_TOO_MANY_PRINCIPALS: ::NTSTATUS = 0xC00002F7u32 as i32; -pub const STATUS_NO_PA_DATA: ::NTSTATUS = 0xC00002F8u32 as i32; -pub const STATUS_PKINIT_NAME_MISMATCH: ::NTSTATUS = 0xC00002F9u32 as i32; -pub const STATUS_SMARTCARD_LOGON_REQUIRED: ::NTSTATUS = 0xC00002FAu32 as i32; -pub const STATUS_KDC_INVALID_REQUEST: ::NTSTATUS = 0xC00002FBu32 as i32; -pub const STATUS_KDC_UNABLE_TO_REFER: ::NTSTATUS = 0xC00002FCu32 as i32; -pub const STATUS_KDC_UNKNOWN_ETYPE: ::NTSTATUS = 0xC00002FDu32 as i32; -pub const STATUS_SHUTDOWN_IN_PROGRESS: ::NTSTATUS = 0xC00002FEu32 as i32; -pub const STATUS_SERVER_SHUTDOWN_IN_PROGRESS: ::NTSTATUS = 0xC00002FFu32 as i32; -pub const STATUS_NOT_SUPPORTED_ON_SBS: ::NTSTATUS = 0xC0000300u32 as i32; -pub const STATUS_WMI_GUID_DISCONNECTED: ::NTSTATUS = 0xC0000301u32 as i32; -pub const STATUS_WMI_ALREADY_DISABLED: ::NTSTATUS = 0xC0000302u32 as i32; -pub const STATUS_WMI_ALREADY_ENABLED: ::NTSTATUS = 0xC0000303u32 as i32; -pub const STATUS_MFT_TOO_FRAGMENTED: ::NTSTATUS = 0xC0000304u32 as i32; -pub const STATUS_COPY_PROTECTION_FAILURE: ::NTSTATUS = 0xC0000305u32 as i32; -pub const STATUS_CSS_AUTHENTICATION_FAILURE: ::NTSTATUS = 0xC0000306u32 as i32; -pub const STATUS_CSS_KEY_NOT_PRESENT: ::NTSTATUS = 0xC0000307u32 as i32; -pub const STATUS_CSS_KEY_NOT_ESTABLISHED: ::NTSTATUS = 0xC0000308u32 as i32; -pub const STATUS_CSS_SCRAMBLED_SECTOR: ::NTSTATUS = 0xC0000309u32 as i32; -pub const STATUS_CSS_REGION_MISMATCH: ::NTSTATUS = 0xC000030Au32 as i32; -pub const STATUS_CSS_RESETS_EXHAUSTED: ::NTSTATUS = 0xC000030Bu32 as i32; -pub const STATUS_PASSWORD_CHANGE_REQUIRED: ::NTSTATUS = 0xC000030Cu32 as i32; -pub const STATUS_PKINIT_FAILURE: ::NTSTATUS = 0xC0000320u32 as i32; -pub const STATUS_SMARTCARD_SUBSYSTEM_FAILURE: ::NTSTATUS = 0xC0000321u32 as i32; -pub const STATUS_NO_KERB_KEY: ::NTSTATUS = 0xC0000322u32 as i32; -pub const STATUS_HOST_DOWN: ::NTSTATUS = 0xC0000350u32 as i32; -pub const STATUS_UNSUPPORTED_PREAUTH: ::NTSTATUS = 0xC0000351u32 as i32; -pub const STATUS_EFS_ALG_BLOB_TOO_BIG: ::NTSTATUS = 0xC0000352u32 as i32; -pub const STATUS_PORT_NOT_SET: ::NTSTATUS = 0xC0000353u32 as i32; -pub const STATUS_DEBUGGER_INACTIVE: ::NTSTATUS = 0xC0000354u32 as i32; -pub const STATUS_DS_VERSION_CHECK_FAILURE: ::NTSTATUS = 0xC0000355u32 as i32; -pub const STATUS_AUDITING_DISABLED: ::NTSTATUS = 0xC0000356u32 as i32; -pub const STATUS_PRENT4_MACHINE_ACCOUNT: ::NTSTATUS = 0xC0000357u32 as i32; -pub const STATUS_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER: ::NTSTATUS = 0xC0000358u32 as i32; -pub const STATUS_INVALID_IMAGE_WIN_32: ::NTSTATUS = 0xC0000359u32 as i32; -pub const STATUS_INVALID_IMAGE_WIN_64: ::NTSTATUS = 0xC000035Au32 as i32; -pub const STATUS_BAD_BINDINGS: ::NTSTATUS = 0xC000035Bu32 as i32; -pub const STATUS_NETWORK_SESSION_EXPIRED: ::NTSTATUS = 0xC000035Cu32 as i32; -pub const STATUS_APPHELP_BLOCK: ::NTSTATUS = 0xC000035Du32 as i32; -pub const STATUS_ALL_SIDS_FILTERED: ::NTSTATUS = 0xC000035Eu32 as i32; -pub const STATUS_NOT_SAFE_MODE_DRIVER: ::NTSTATUS = 0xC000035Fu32 as i32; -pub const STATUS_ACCESS_DISABLED_BY_POLICY_DEFAULT: ::NTSTATUS = 0xC0000361u32 as i32; -pub const STATUS_ACCESS_DISABLED_BY_POLICY_PATH: ::NTSTATUS = 0xC0000362u32 as i32; -pub const STATUS_ACCESS_DISABLED_BY_POLICY_PUBLISHER: ::NTSTATUS = 0xC0000363u32 as i32; -pub const STATUS_ACCESS_DISABLED_BY_POLICY_OTHER: ::NTSTATUS = 0xC0000364u32 as i32; -pub const STATUS_FAILED_DRIVER_ENTRY: ::NTSTATUS = 0xC0000365u32 as i32; -pub const STATUS_DEVICE_ENUMERATION_ERROR: ::NTSTATUS = 0xC0000366u32 as i32; -pub const STATUS_MOUNT_POINT_NOT_RESOLVED: ::NTSTATUS = 0xC0000368u32 as i32; -pub const STATUS_INVALID_DEVICE_OBJECT_PARAMETER: ::NTSTATUS = 0xC0000369u32 as i32; -pub const STATUS_MCA_OCCURED: ::NTSTATUS = 0xC000036Au32 as i32; -pub const STATUS_DRIVER_BLOCKED_CRITICAL: ::NTSTATUS = 0xC000036Bu32 as i32; -pub const STATUS_DRIVER_BLOCKED: ::NTSTATUS = 0xC000036Cu32 as i32; -pub const STATUS_DRIVER_DATABASE_ERROR: ::NTSTATUS = 0xC000036Du32 as i32; -pub const STATUS_SYSTEM_HIVE_TOO_LARGE: ::NTSTATUS = 0xC000036Eu32 as i32; -pub const STATUS_INVALID_IMPORT_OF_NON_DLL: ::NTSTATUS = 0xC000036Fu32 as i32; -pub const STATUS_DS_SHUTTING_DOWN: ::NTSTATUS = 0x40000370; -pub const STATUS_NO_SECRETS: ::NTSTATUS = 0xC0000371u32 as i32; -pub const STATUS_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY: ::NTSTATUS = 0xC0000372u32 as i32; -pub const STATUS_FAILED_STACK_SWITCH: ::NTSTATUS = 0xC0000373u32 as i32; -pub const STATUS_HEAP_CORRUPTION: ::NTSTATUS = 0xC0000374u32 as i32; -pub const STATUS_SMARTCARD_WRONG_PIN: ::NTSTATUS = 0xC0000380u32 as i32; -pub const STATUS_SMARTCARD_CARD_BLOCKED: ::NTSTATUS = 0xC0000381u32 as i32; -pub const STATUS_SMARTCARD_CARD_NOT_AUTHENTICATED: ::NTSTATUS = 0xC0000382u32 as i32; -pub const STATUS_SMARTCARD_NO_CARD: ::NTSTATUS = 0xC0000383u32 as i32; -pub const STATUS_SMARTCARD_NO_KEY_CONTAINER: ::NTSTATUS = 0xC0000384u32 as i32; -pub const STATUS_SMARTCARD_NO_CERTIFICATE: ::NTSTATUS = 0xC0000385u32 as i32; -pub const STATUS_SMARTCARD_NO_KEYSET: ::NTSTATUS = 0xC0000386u32 as i32; -pub const STATUS_SMARTCARD_IO_ERROR: ::NTSTATUS = 0xC0000387u32 as i32; -pub const STATUS_DOWNGRADE_DETECTED: ::NTSTATUS = 0xC0000388u32 as i32; -pub const STATUS_SMARTCARD_CERT_REVOKED: ::NTSTATUS = 0xC0000389u32 as i32; -pub const STATUS_ISSUING_CA_UNTRUSTED: ::NTSTATUS = 0xC000038Au32 as i32; -pub const STATUS_REVOCATION_OFFLINE_C: ::NTSTATUS = 0xC000038Bu32 as i32; -pub const STATUS_PKINIT_CLIENT_FAILURE: ::NTSTATUS = 0xC000038Cu32 as i32; -pub const STATUS_SMARTCARD_CERT_EXPIRED: ::NTSTATUS = 0xC000038Du32 as i32; -pub const STATUS_DRIVER_FAILED_PRIOR_UNLOAD: ::NTSTATUS = 0xC000038Eu32 as i32; -pub const STATUS_SMARTCARD_SILENT_CONTEXT: ::NTSTATUS = 0xC000038Fu32 as i32; -pub const STATUS_PER_USER_TRUST_QUOTA_EXCEEDED: ::NTSTATUS = 0xC0000401u32 as i32; -pub const STATUS_ALL_USER_TRUST_QUOTA_EXCEEDED: ::NTSTATUS = 0xC0000402u32 as i32; -pub const STATUS_USER_DELETE_TRUST_QUOTA_EXCEEDED: ::NTSTATUS = 0xC0000403u32 as i32; -pub const STATUS_DS_NAME_NOT_UNIQUE: ::NTSTATUS = 0xC0000404u32 as i32; -pub const STATUS_DS_DUPLICATE_ID_FOUND: ::NTSTATUS = 0xC0000405u32 as i32; -pub const STATUS_DS_GROUP_CONVERSION_ERROR: ::NTSTATUS = 0xC0000406u32 as i32; -pub const STATUS_VOLSNAP_PREPARE_HIBERNATE: ::NTSTATUS = 0xC0000407u32 as i32; -pub const STATUS_USER2USER_REQUIRED: ::NTSTATUS = 0xC0000408u32 as i32; -pub const STATUS_STACK_BUFFER_OVERRUN: ::NTSTATUS = 0xC0000409u32 as i32; -pub const STATUS_NO_S4U_PROT_SUPPORT: ::NTSTATUS = 0xC000040Au32 as i32; -pub const STATUS_CROSSREALM_DELEGATION_FAILURE: ::NTSTATUS = 0xC000040Bu32 as i32; -pub const STATUS_REVOCATION_OFFLINE_KDC: ::NTSTATUS = 0xC000040Cu32 as i32; -pub const STATUS_ISSUING_CA_UNTRUSTED_KDC: ::NTSTATUS = 0xC000040Du32 as i32; -pub const STATUS_KDC_CERT_EXPIRED: ::NTSTATUS = 0xC000040Eu32 as i32; -pub const STATUS_KDC_CERT_REVOKED: ::NTSTATUS = 0xC000040Fu32 as i32; -pub const STATUS_PARAMETER_QUOTA_EXCEEDED: ::NTSTATUS = 0xC0000410u32 as i32; -pub const STATUS_HIBERNATION_FAILURE: ::NTSTATUS = 0xC0000411u32 as i32; -pub const STATUS_DELAY_LOAD_FAILED: ::NTSTATUS = 0xC0000412u32 as i32; -pub const STATUS_AUTHENTICATION_FIREWALL_FAILED: ::NTSTATUS = 0xC0000413u32 as i32; -pub const STATUS_VDM_DISALLOWED: ::NTSTATUS = 0xC0000414u32 as i32; -pub const STATUS_HUNG_DISPLAY_DRIVER_THREAD: ::NTSTATUS = 0xC0000415u32 as i32; -pub const STATUS_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE: ::NTSTATUS = 0xC0000416u32 as i32; -pub const STATUS_INVALID_CRUNTIME_PARAMETER: ::NTSTATUS = 0xC0000417u32 as i32; -pub const STATUS_NTLM_BLOCKED: ::NTSTATUS = 0xC0000418u32 as i32; -pub const STATUS_DS_SRC_SID_EXISTS_IN_FOREST: ::NTSTATUS = 0xC0000419u32 as i32; -pub const STATUS_DS_DOMAIN_NAME_EXISTS_IN_FOREST: ::NTSTATUS = 0xC000041Au32 as i32; -pub const STATUS_DS_FLAT_NAME_EXISTS_IN_FOREST: ::NTSTATUS = 0xC000041Bu32 as i32; -pub const STATUS_INVALID_USER_PRINCIPAL_NAME: ::NTSTATUS = 0xC000041Cu32 as i32; -pub const STATUS_FATAL_USER_CALLBACK_EXCEPTION: ::NTSTATUS = 0xC000041Du32 as i32; -pub const STATUS_ASSERTION_FAILURE: ::NTSTATUS = 0xC0000420u32 as i32; -pub const STATUS_VERIFIER_STOP: ::NTSTATUS = 0xC0000421u32 as i32; -pub const STATUS_CALLBACK_POP_STACK: ::NTSTATUS = 0xC0000423u32 as i32; -pub const STATUS_INCOMPATIBLE_DRIVER_BLOCKED: ::NTSTATUS = 0xC0000424u32 as i32; -pub const STATUS_HIVE_UNLOADED: ::NTSTATUS = 0xC0000425u32 as i32; -pub const STATUS_COMPRESSION_DISABLED: ::NTSTATUS = 0xC0000426u32 as i32; -pub const STATUS_FILE_SYSTEM_LIMITATION: ::NTSTATUS = 0xC0000427u32 as i32; -pub const STATUS_INVALID_IMAGE_HASH: ::NTSTATUS = 0xC0000428u32 as i32; -pub const STATUS_NOT_CAPABLE: ::NTSTATUS = 0xC0000429u32 as i32; -pub const STATUS_REQUEST_OUT_OF_SEQUENCE: ::NTSTATUS = 0xC000042Au32 as i32; -pub const STATUS_IMPLEMENTATION_LIMIT: ::NTSTATUS = 0xC000042Bu32 as i32; -pub const STATUS_ELEVATION_REQUIRED: ::NTSTATUS = 0xC000042Cu32 as i32; -pub const STATUS_NO_SECURITY_CONTEXT: ::NTSTATUS = 0xC000042Du32 as i32; -pub const STATUS_PKU2U_CERT_FAILURE: ::NTSTATUS = 0xC000042Fu32 as i32; -pub const STATUS_BEYOND_VDL: ::NTSTATUS = 0xC0000432u32 as i32; -pub const STATUS_ENCOUNTERED_WRITE_IN_PROGRESS: ::NTSTATUS = 0xC0000433u32 as i32; -pub const STATUS_PTE_CHANGED: ::NTSTATUS = 0xC0000434u32 as i32; -pub const STATUS_PURGE_FAILED: ::NTSTATUS = 0xC0000435u32 as i32; -pub const STATUS_CRED_REQUIRES_CONFIRMATION: ::NTSTATUS = 0xC0000440u32 as i32; -pub const STATUS_CS_ENCRYPTION_INVALID_SERVER_RESPONSE: ::NTSTATUS = 0xC0000441u32 as i32; -pub const STATUS_CS_ENCRYPTION_UNSUPPORTED_SERVER: ::NTSTATUS = 0xC0000442u32 as i32; -pub const STATUS_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE: ::NTSTATUS = 0xC0000443u32 as i32; -pub const STATUS_CS_ENCRYPTION_NEW_ENCRYPTED_FILE: ::NTSTATUS = 0xC0000444u32 as i32; -pub const STATUS_CS_ENCRYPTION_FILE_NOT_CSE: ::NTSTATUS = 0xC0000445u32 as i32; -pub const STATUS_INVALID_LABEL: ::NTSTATUS = 0xC0000446u32 as i32; -pub const STATUS_DRIVER_PROCESS_TERMINATED: ::NTSTATUS = 0xC0000450u32 as i32; -pub const STATUS_AMBIGUOUS_SYSTEM_DEVICE: ::NTSTATUS = 0xC0000451u32 as i32; -pub const STATUS_SYSTEM_DEVICE_NOT_FOUND: ::NTSTATUS = 0xC0000452u32 as i32; -pub const STATUS_RESTART_BOOT_APPLICATION: ::NTSTATUS = 0xC0000453u32 as i32; -pub const STATUS_INSUFFICIENT_NVRAM_RESOURCES: ::NTSTATUS = 0xC0000454u32 as i32; -pub const STATUS_INVALID_SESSION: ::NTSTATUS = 0xC0000455u32 as i32; -pub const STATUS_THREAD_ALREADY_IN_SESSION: ::NTSTATUS = 0xC0000456u32 as i32; -pub const STATUS_THREAD_NOT_IN_SESSION: ::NTSTATUS = 0xC0000457u32 as i32; -pub const STATUS_INVALID_WEIGHT: ::NTSTATUS = 0xC0000458u32 as i32; -pub const STATUS_REQUEST_PAUSED: ::NTSTATUS = 0xC0000459u32 as i32; -pub const STATUS_NO_RANGES_PROCESSED: ::NTSTATUS = 0xC0000460u32 as i32; -pub const STATUS_DISK_RESOURCES_EXHAUSTED: ::NTSTATUS = 0xC0000461u32 as i32; -pub const STATUS_NEEDS_REMEDIATION: ::NTSTATUS = 0xC0000462u32 as i32; -pub const STATUS_DEVICE_FEATURE_NOT_SUPPORTED: ::NTSTATUS = 0xC0000463u32 as i32; -pub const STATUS_DEVICE_UNREACHABLE: ::NTSTATUS = 0xC0000464u32 as i32; -pub const STATUS_INVALID_TOKEN: ::NTSTATUS = 0xC0000465u32 as i32; -pub const STATUS_SERVER_UNAVAILABLE: ::NTSTATUS = 0xC0000466u32 as i32; -pub const STATUS_FILE_NOT_AVAILABLE: ::NTSTATUS = 0xC0000467u32 as i32; -pub const STATUS_DEVICE_INSUFFICIENT_RESOURCES: ::NTSTATUS = 0xC0000468u32 as i32; -pub const STATUS_PACKAGE_UPDATING: ::NTSTATUS = 0xC0000469u32 as i32; -pub const STATUS_NOT_READ_FROM_COPY: ::NTSTATUS = 0xC000046Au32 as i32; -pub const STATUS_FT_WRITE_FAILURE: ::NTSTATUS = 0xC000046Bu32 as i32; -pub const STATUS_FT_DI_SCAN_REQUIRED: ::NTSTATUS = 0xC000046Cu32 as i32; -pub const STATUS_OBJECT_NOT_EXTERNALLY_BACKED: ::NTSTATUS = 0xC000046Du32 as i32; -pub const STATUS_EXTERNAL_BACKING_PROVIDER_UNKNOWN: ::NTSTATUS = 0xC000046Eu32 as i32; -pub const STATUS_COMPRESSION_NOT_BENEFICIAL: ::NTSTATUS = 0xC000046Fu32 as i32; -pub const STATUS_DATA_CHECKSUM_ERROR: ::NTSTATUS = 0xC0000470u32 as i32; -pub const STATUS_INTERMIXED_KERNEL_EA_OPERATION: ::NTSTATUS = 0xC0000471u32 as i32; -pub const STATUS_TRIM_READ_ZERO_NOT_SUPPORTED: ::NTSTATUS = 0xC0000472u32 as i32; -pub const STATUS_TOO_MANY_SEGMENT_DESCRIPTORS: ::NTSTATUS = 0xC0000473u32 as i32; -pub const STATUS_INVALID_OFFSET_ALIGNMENT: ::NTSTATUS = 0xC0000474u32 as i32; -pub const STATUS_INVALID_FIELD_IN_PARAMETER_LIST: ::NTSTATUS = 0xC0000475u32 as i32; -pub const STATUS_OPERATION_IN_PROGRESS: ::NTSTATUS = 0xC0000476u32 as i32; -pub const STATUS_INVALID_INITIATOR_TARGET_PATH: ::NTSTATUS = 0xC0000477u32 as i32; -pub const STATUS_SCRUB_DATA_DISABLED: ::NTSTATUS = 0xC0000478u32 as i32; -pub const STATUS_NOT_REDUNDANT_STORAGE: ::NTSTATUS = 0xC0000479u32 as i32; -pub const STATUS_RESIDENT_FILE_NOT_SUPPORTED: ::NTSTATUS = 0xC000047Au32 as i32; -pub const STATUS_COMPRESSED_FILE_NOT_SUPPORTED: ::NTSTATUS = 0xC000047Bu32 as i32; -pub const STATUS_DIRECTORY_NOT_SUPPORTED: ::NTSTATUS = 0xC000047Cu32 as i32; -pub const STATUS_IO_OPERATION_TIMEOUT: ::NTSTATUS = 0xC000047Du32 as i32; -pub const STATUS_SYSTEM_NEEDS_REMEDIATION: ::NTSTATUS = 0xC000047Eu32 as i32; -pub const STATUS_APPX_INTEGRITY_FAILURE_CLR_NGEN: ::NTSTATUS = 0xC000047Fu32 as i32; -pub const STATUS_SHARE_UNAVAILABLE: ::NTSTATUS = 0xC0000480u32 as i32; -pub const STATUS_APISET_NOT_HOSTED: ::NTSTATUS = 0xC0000481u32 as i32; -pub const STATUS_APISET_NOT_PRESENT: ::NTSTATUS = 0xC0000482u32 as i32; -pub const STATUS_DEVICE_HARDWARE_ERROR: ::NTSTATUS = 0xC0000483u32 as i32; -pub const STATUS_FIRMWARE_SLOT_INVALID: ::NTSTATUS = 0xC0000484u32 as i32; -pub const STATUS_FIRMWARE_IMAGE_INVALID: ::NTSTATUS = 0xC0000485u32 as i32; -pub const STATUS_STORAGE_TOPOLOGY_ID_MISMATCH: ::NTSTATUS = 0xC0000486u32 as i32; -pub const STATUS_WIM_NOT_BOOTABLE: ::NTSTATUS = 0xC0000487u32 as i32; -pub const STATUS_BLOCKED_BY_PARENTAL_CONTROLS: ::NTSTATUS = 0xC0000488u32 as i32; -pub const STATUS_NEEDS_REGISTRATION: ::NTSTATUS = 0xC0000489u32 as i32; -pub const STATUS_QUOTA_ACTIVITY: ::NTSTATUS = 0xC000048Au32 as i32; -pub const STATUS_INVALID_TASK_NAME: ::NTSTATUS = 0xC0000500u32 as i32; -pub const STATUS_INVALID_TASK_INDEX: ::NTSTATUS = 0xC0000501u32 as i32; -pub const STATUS_THREAD_ALREADY_IN_TASK: ::NTSTATUS = 0xC0000502u32 as i32; -pub const STATUS_CALLBACK_BYPASS: ::NTSTATUS = 0xC0000503u32 as i32; -pub const STATUS_UNDEFINED_SCOPE: ::NTSTATUS = 0xC0000504u32 as i32; -pub const STATUS_INVALID_CAP: ::NTSTATUS = 0xC0000505u32 as i32; -pub const STATUS_NOT_GUI_PROCESS: ::NTSTATUS = 0xC0000506u32 as i32; -pub const STATUS_DEVICE_HUNG: ::NTSTATUS = 0xC0000507u32 as i32; -pub const STATUS_FAIL_FAST_EXCEPTION: ::NTSTATUS = 0xC0000602u32 as i32; -pub const STATUS_IMAGE_CERT_REVOKED: ::NTSTATUS = 0xC0000603u32 as i32; -pub const STATUS_DYNAMIC_CODE_BLOCKED: ::NTSTATUS = 0xC0000604u32 as i32; -pub const STATUS_IMAGE_CERT_EXPIRED: ::NTSTATUS = 0xC0000605u32 as i32; -pub const STATUS_PORT_CLOSED: ::NTSTATUS = 0xC0000700u32 as i32; -pub const STATUS_MESSAGE_LOST: ::NTSTATUS = 0xC0000701u32 as i32; -pub const STATUS_INVALID_MESSAGE: ::NTSTATUS = 0xC0000702u32 as i32; -pub const STATUS_REQUEST_CANCELED: ::NTSTATUS = 0xC0000703u32 as i32; -pub const STATUS_RECURSIVE_DISPATCH: ::NTSTATUS = 0xC0000704u32 as i32; -pub const STATUS_LPC_RECEIVE_BUFFER_EXPECTED: ::NTSTATUS = 0xC0000705u32 as i32; -pub const STATUS_LPC_INVALID_CONNECTION_USAGE: ::NTSTATUS = 0xC0000706u32 as i32; -pub const STATUS_LPC_REQUESTS_NOT_ALLOWED: ::NTSTATUS = 0xC0000707u32 as i32; -pub const STATUS_RESOURCE_IN_USE: ::NTSTATUS = 0xC0000708u32 as i32; -pub const STATUS_HARDWARE_MEMORY_ERROR: ::NTSTATUS = 0xC0000709u32 as i32; -pub const STATUS_THREADPOOL_HANDLE_EXCEPTION: ::NTSTATUS = 0xC000070Au32 as i32; -pub const STATUS_THREADPOOL_SET_EVENT_ON_COMPLETION_FAILED: ::NTSTATUS = 0xC000070Bu32 as i32; -pub const STATUS_THREADPOOL_RELEASE_SEMAPHORE_ON_COMPLETION_FAILED: ::NTSTATUS = 0xC000070Cu32 as i32; -pub const STATUS_THREADPOOL_RELEASE_MUTEX_ON_COMPLETION_FAILED: ::NTSTATUS = 0xC000070Du32 as i32; -pub const STATUS_THREADPOOL_FREE_LIBRARY_ON_COMPLETION_FAILED: ::NTSTATUS = 0xC000070Eu32 as i32; -pub const STATUS_THREADPOOL_RELEASED_DURING_OPERATION: ::NTSTATUS = 0xC000070Fu32 as i32; -pub const STATUS_CALLBACK_RETURNED_WHILE_IMPERSONATING: ::NTSTATUS = 0xC0000710u32 as i32; -pub const STATUS_APC_RETURNED_WHILE_IMPERSONATING: ::NTSTATUS = 0xC0000711u32 as i32; -pub const STATUS_PROCESS_IS_PROTECTED: ::NTSTATUS = 0xC0000712u32 as i32; -pub const STATUS_MCA_EXCEPTION: ::NTSTATUS = 0xC0000713u32 as i32; -pub const STATUS_CERTIFICATE_MAPPING_NOT_UNIQUE: ::NTSTATUS = 0xC0000714u32 as i32; -pub const STATUS_SYMLINK_CLASS_DISABLED: ::NTSTATUS = 0xC0000715u32 as i32; -pub const STATUS_INVALID_IDN_NORMALIZATION: ::NTSTATUS = 0xC0000716u32 as i32; -pub const STATUS_NO_UNICODE_TRANSLATION: ::NTSTATUS = 0xC0000717u32 as i32; -pub const STATUS_ALREADY_REGISTERED: ::NTSTATUS = 0xC0000718u32 as i32; -pub const STATUS_CONTEXT_MISMATCH: ::NTSTATUS = 0xC0000719u32 as i32; -pub const STATUS_PORT_ALREADY_HAS_COMPLETION_LIST: ::NTSTATUS = 0xC000071Au32 as i32; -pub const STATUS_CALLBACK_RETURNED_THREAD_PRIORITY: ::NTSTATUS = 0xC000071Bu32 as i32; -pub const STATUS_INVALID_THREAD: ::NTSTATUS = 0xC000071Cu32 as i32; -pub const STATUS_CALLBACK_RETURNED_TRANSACTION: ::NTSTATUS = 0xC000071Du32 as i32; -pub const STATUS_CALLBACK_RETURNED_LDR_LOCK: ::NTSTATUS = 0xC000071Eu32 as i32; -pub const STATUS_CALLBACK_RETURNED_LANG: ::NTSTATUS = 0xC000071Fu32 as i32; -pub const STATUS_CALLBACK_RETURNED_PRI_BACK: ::NTSTATUS = 0xC0000720u32 as i32; -pub const STATUS_CALLBACK_RETURNED_THREAD_AFFINITY: ::NTSTATUS = 0xC0000721u32 as i32; -pub const STATUS_DISK_REPAIR_DISABLED: ::NTSTATUS = 0xC0000800u32 as i32; -pub const STATUS_DS_DOMAIN_RENAME_IN_PROGRESS: ::NTSTATUS = 0xC0000801u32 as i32; -pub const STATUS_DISK_QUOTA_EXCEEDED: ::NTSTATUS = 0xC0000802u32 as i32; -pub const STATUS_DATA_LOST_REPAIR: ::NTSTATUS = 0x80000803u32 as i32; -pub const STATUS_CONTENT_BLOCKED: ::NTSTATUS = 0xC0000804u32 as i32; -pub const STATUS_BAD_CLUSTERS: ::NTSTATUS = 0xC0000805u32 as i32; -pub const STATUS_VOLUME_DIRTY: ::NTSTATUS = 0xC0000806u32 as i32; -pub const STATUS_DISK_REPAIR_REDIRECTED: ::NTSTATUS = 0x40000807; -pub const STATUS_DISK_REPAIR_UNSUCCESSFUL: ::NTSTATUS = 0xC0000808u32 as i32; -pub const STATUS_CORRUPT_LOG_OVERFULL: ::NTSTATUS = 0xC0000809u32 as i32; -pub const STATUS_CORRUPT_LOG_CORRUPTED: ::NTSTATUS = 0xC000080Au32 as i32; -pub const STATUS_CORRUPT_LOG_UNAVAILABLE: ::NTSTATUS = 0xC000080Bu32 as i32; -pub const STATUS_CORRUPT_LOG_DELETED_FULL: ::NTSTATUS = 0xC000080Cu32 as i32; -pub const STATUS_CORRUPT_LOG_CLEARED: ::NTSTATUS = 0xC000080Du32 as i32; -pub const STATUS_ORPHAN_NAME_EXHAUSTED: ::NTSTATUS = 0xC000080Eu32 as i32; -pub const STATUS_PROACTIVE_SCAN_IN_PROGRESS: ::NTSTATUS = 0xC000080Fu32 as i32; -pub const STATUS_ENCRYPTED_IO_NOT_POSSIBLE: ::NTSTATUS = 0xC0000810u32 as i32; -pub const STATUS_CORRUPT_LOG_UPLEVEL_RECORDS: ::NTSTATUS = 0xC0000811u32 as i32; -pub const STATUS_FILE_CHECKED_OUT: ::NTSTATUS = 0xC0000901u32 as i32; -pub const STATUS_CHECKOUT_REQUIRED: ::NTSTATUS = 0xC0000902u32 as i32; -pub const STATUS_BAD_FILE_TYPE: ::NTSTATUS = 0xC0000903u32 as i32; -pub const STATUS_FILE_TOO_LARGE: ::NTSTATUS = 0xC0000904u32 as i32; -pub const STATUS_FORMS_AUTH_REQUIRED: ::NTSTATUS = 0xC0000905u32 as i32; -pub const STATUS_VIRUS_INFECTED: ::NTSTATUS = 0xC0000906u32 as i32; -pub const STATUS_VIRUS_DELETED: ::NTSTATUS = 0xC0000907u32 as i32; -pub const STATUS_BAD_MCFG_TABLE: ::NTSTATUS = 0xC0000908u32 as i32; -pub const STATUS_CANNOT_BREAK_OPLOCK: ::NTSTATUS = 0xC0000909u32 as i32; -pub const STATUS_BAD_KEY: ::NTSTATUS = 0xC000090Au32 as i32; -pub const STATUS_BAD_DATA: ::NTSTATUS = 0xC000090Bu32 as i32; -pub const STATUS_NO_KEY: ::NTSTATUS = 0xC000090Cu32 as i32; -pub const STATUS_FILE_HANDLE_REVOKED: ::NTSTATUS = 0xC0000910u32 as i32; -pub const STATUS_WOW_ASSERTION: ::NTSTATUS = 0xC0009898u32 as i32; -pub const STATUS_INVALID_SIGNATURE: ::NTSTATUS = 0xC000A000u32 as i32; -pub const STATUS_HMAC_NOT_SUPPORTED: ::NTSTATUS = 0xC000A001u32 as i32; -pub const STATUS_AUTH_TAG_MISMATCH: ::NTSTATUS = 0xC000A002u32 as i32; -pub const STATUS_INVALID_STATE_TRANSITION: ::NTSTATUS = 0xC000A003u32 as i32; -pub const STATUS_INVALID_KERNEL_INFO_VERSION: ::NTSTATUS = 0xC000A004u32 as i32; -pub const STATUS_INVALID_PEP_INFO_VERSION: ::NTSTATUS = 0xC000A005u32 as i32; -pub const STATUS_HANDLE_REVOKED: ::NTSTATUS = 0xC000A006u32 as i32; -pub const STATUS_IPSEC_QUEUE_OVERFLOW: ::NTSTATUS = 0xC000A010u32 as i32; -pub const STATUS_ND_QUEUE_OVERFLOW: ::NTSTATUS = 0xC000A011u32 as i32; -pub const STATUS_HOPLIMIT_EXCEEDED: ::NTSTATUS = 0xC000A012u32 as i32; -pub const STATUS_PROTOCOL_NOT_SUPPORTED: ::NTSTATUS = 0xC000A013u32 as i32; -pub const STATUS_FASTPATH_REJECTED: ::NTSTATUS = 0xC000A014u32 as i32; -pub const STATUS_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED: ::NTSTATUS = 0xC000A080u32 as i32; -pub const STATUS_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR: ::NTSTATUS = 0xC000A081u32 as i32; -pub const STATUS_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR: ::NTSTATUS = 0xC000A082u32 as i32; -pub const STATUS_XML_PARSE_ERROR: ::NTSTATUS = 0xC000A083u32 as i32; -pub const STATUS_XMLDSIG_ERROR: ::NTSTATUS = 0xC000A084u32 as i32; -pub const STATUS_WRONG_COMPARTMENT: ::NTSTATUS = 0xC000A085u32 as i32; -pub const STATUS_AUTHIP_FAILURE: ::NTSTATUS = 0xC000A086u32 as i32; -pub const STATUS_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS: ::NTSTATUS = 0xC000A087u32 as i32; -pub const STATUS_DS_OID_NOT_FOUND: ::NTSTATUS = 0xC000A088u32 as i32; -pub const STATUS_INCORRECT_ACCOUNT_TYPE: ::NTSTATUS = 0xC000A089u32 as i32; -pub const STATUS_HASH_NOT_SUPPORTED: ::NTSTATUS = 0xC000A100u32 as i32; -pub const STATUS_HASH_NOT_PRESENT: ::NTSTATUS = 0xC000A101u32 as i32; -pub const STATUS_SECONDARY_IC_PROVIDER_NOT_REGISTERED: ::NTSTATUS = 0xC000A121u32 as i32; -pub const STATUS_GPIO_CLIENT_INFORMATION_INVALID: ::NTSTATUS = 0xC000A122u32 as i32; -pub const STATUS_GPIO_VERSION_NOT_SUPPORTED: ::NTSTATUS = 0xC000A123u32 as i32; -pub const STATUS_GPIO_INVALID_REGISTRATION_PACKET: ::NTSTATUS = 0xC000A124u32 as i32; -pub const STATUS_GPIO_OPERATION_DENIED: ::NTSTATUS = 0xC000A125u32 as i32; -pub const STATUS_GPIO_INCOMPATIBLE_CONNECT_MODE: ::NTSTATUS = 0xC000A126u32 as i32; -pub const STATUS_GPIO_INTERRUPT_ALREADY_UNMASKED: ::NTSTATUS = 0x8000A127u32 as i32; -pub const STATUS_CANNOT_SWITCH_RUNLEVEL: ::NTSTATUS = 0xC000A141u32 as i32; -pub const STATUS_INVALID_RUNLEVEL_SETTING: ::NTSTATUS = 0xC000A142u32 as i32; -pub const STATUS_RUNLEVEL_SWITCH_TIMEOUT: ::NTSTATUS = 0xC000A143u32 as i32; -pub const STATUS_SERVICES_FAILED_AUTOSTART: ::NTSTATUS = 0x4000A144; -pub const STATUS_RUNLEVEL_SWITCH_AGENT_TIMEOUT: ::NTSTATUS = 0xC000A145u32 as i32; -pub const STATUS_RUNLEVEL_SWITCH_IN_PROGRESS: ::NTSTATUS = 0xC000A146u32 as i32; -pub const STATUS_NOT_APPCONTAINER: ::NTSTATUS = 0xC000A200u32 as i32; -pub const STATUS_NOT_SUPPORTED_IN_APPCONTAINER: ::NTSTATUS = 0xC000A201u32 as i32; -pub const STATUS_INVALID_PACKAGE_SID_LENGTH: ::NTSTATUS = 0xC000A202u32 as i32; -pub const STATUS_APP_DATA_NOT_FOUND: ::NTSTATUS = 0xC000A281u32 as i32; -pub const STATUS_APP_DATA_EXPIRED: ::NTSTATUS = 0xC000A282u32 as i32; -pub const STATUS_APP_DATA_CORRUPT: ::NTSTATUS = 0xC000A283u32 as i32; -pub const STATUS_APP_DATA_LIMIT_EXCEEDED: ::NTSTATUS = 0xC000A284u32 as i32; -pub const STATUS_APP_DATA_REBOOT_REQUIRED: ::NTSTATUS = 0xC000A285u32 as i32; -pub const STATUS_OFFLOAD_READ_FLT_NOT_SUPPORTED: ::NTSTATUS = 0xC000A2A1u32 as i32; -pub const STATUS_OFFLOAD_WRITE_FLT_NOT_SUPPORTED: ::NTSTATUS = 0xC000A2A2u32 as i32; -pub const STATUS_OFFLOAD_READ_FILE_NOT_SUPPORTED: ::NTSTATUS = 0xC000A2A3u32 as i32; -pub const STATUS_OFFLOAD_WRITE_FILE_NOT_SUPPORTED: ::NTSTATUS = 0xC000A2A4u32 as i32; -pub const DBG_NO_STATE_CHANGE: ::NTSTATUS = 0xC0010001u32 as i32; -pub const DBG_APP_NOT_IDLE: ::NTSTATUS = 0xC0010002u32 as i32; -pub const RPC_NT_INVALID_STRING_BINDING: ::NTSTATUS = 0xC0020001u32 as i32; -pub const RPC_NT_WRONG_KIND_OF_BINDING: ::NTSTATUS = 0xC0020002u32 as i32; -pub const RPC_NT_INVALID_BINDING: ::NTSTATUS = 0xC0020003u32 as i32; -pub const RPC_NT_PROTSEQ_NOT_SUPPORTED: ::NTSTATUS = 0xC0020004u32 as i32; -pub const RPC_NT_INVALID_RPC_PROTSEQ: ::NTSTATUS = 0xC0020005u32 as i32; -pub const RPC_NT_INVALID_STRING_UUID: ::NTSTATUS = 0xC0020006u32 as i32; -pub const RPC_NT_INVALID_ENDPOINT_FORMAT: ::NTSTATUS = 0xC0020007u32 as i32; -pub const RPC_NT_INVALID_NET_ADDR: ::NTSTATUS = 0xC0020008u32 as i32; -pub const RPC_NT_NO_ENDPOINT_FOUND: ::NTSTATUS = 0xC0020009u32 as i32; -pub const RPC_NT_INVALID_TIMEOUT: ::NTSTATUS = 0xC002000Au32 as i32; -pub const RPC_NT_OBJECT_NOT_FOUND: ::NTSTATUS = 0xC002000Bu32 as i32; -pub const RPC_NT_ALREADY_REGISTERED: ::NTSTATUS = 0xC002000Cu32 as i32; -pub const RPC_NT_TYPE_ALREADY_REGISTERED: ::NTSTATUS = 0xC002000Du32 as i32; -pub const RPC_NT_ALREADY_LISTENING: ::NTSTATUS = 0xC002000Eu32 as i32; -pub const RPC_NT_NO_PROTSEQS_REGISTERED: ::NTSTATUS = 0xC002000Fu32 as i32; -pub const RPC_NT_NOT_LISTENING: ::NTSTATUS = 0xC0020010u32 as i32; -pub const RPC_NT_UNKNOWN_MGR_TYPE: ::NTSTATUS = 0xC0020011u32 as i32; -pub const RPC_NT_UNKNOWN_IF: ::NTSTATUS = 0xC0020012u32 as i32; -pub const RPC_NT_NO_BINDINGS: ::NTSTATUS = 0xC0020013u32 as i32; -pub const RPC_NT_NO_PROTSEQS: ::NTSTATUS = 0xC0020014u32 as i32; -pub const RPC_NT_CANT_CREATE_ENDPOINT: ::NTSTATUS = 0xC0020015u32 as i32; -pub const RPC_NT_OUT_OF_RESOURCES: ::NTSTATUS = 0xC0020016u32 as i32; -pub const RPC_NT_SERVER_UNAVAILABLE: ::NTSTATUS = 0xC0020017u32 as i32; -pub const RPC_NT_SERVER_TOO_BUSY: ::NTSTATUS = 0xC0020018u32 as i32; -pub const RPC_NT_INVALID_NETWORK_OPTIONS: ::NTSTATUS = 0xC0020019u32 as i32; -pub const RPC_NT_NO_CALL_ACTIVE: ::NTSTATUS = 0xC002001Au32 as i32; -pub const RPC_NT_CALL_FAILED: ::NTSTATUS = 0xC002001Bu32 as i32; -pub const RPC_NT_CALL_FAILED_DNE: ::NTSTATUS = 0xC002001Cu32 as i32; -pub const RPC_NT_PROTOCOL_ERROR: ::NTSTATUS = 0xC002001Du32 as i32; -pub const RPC_NT_UNSUPPORTED_TRANS_SYN: ::NTSTATUS = 0xC002001Fu32 as i32; -pub const RPC_NT_UNSUPPORTED_TYPE: ::NTSTATUS = 0xC0020021u32 as i32; -pub const RPC_NT_INVALID_TAG: ::NTSTATUS = 0xC0020022u32 as i32; -pub const RPC_NT_INVALID_BOUND: ::NTSTATUS = 0xC0020023u32 as i32; -pub const RPC_NT_NO_ENTRY_NAME: ::NTSTATUS = 0xC0020024u32 as i32; -pub const RPC_NT_INVALID_NAME_SYNTAX: ::NTSTATUS = 0xC0020025u32 as i32; -pub const RPC_NT_UNSUPPORTED_NAME_SYNTAX: ::NTSTATUS = 0xC0020026u32 as i32; -pub const RPC_NT_UUID_NO_ADDRESS: ::NTSTATUS = 0xC0020028u32 as i32; -pub const RPC_NT_DUPLICATE_ENDPOINT: ::NTSTATUS = 0xC0020029u32 as i32; -pub const RPC_NT_UNKNOWN_AUTHN_TYPE: ::NTSTATUS = 0xC002002Au32 as i32; -pub const RPC_NT_MAX_CALLS_TOO_SMALL: ::NTSTATUS = 0xC002002Bu32 as i32; -pub const RPC_NT_STRING_TOO_LONG: ::NTSTATUS = 0xC002002Cu32 as i32; -pub const RPC_NT_PROTSEQ_NOT_FOUND: ::NTSTATUS = 0xC002002Du32 as i32; -pub const RPC_NT_PROCNUM_OUT_OF_RANGE: ::NTSTATUS = 0xC002002Eu32 as i32; -pub const RPC_NT_BINDING_HAS_NO_AUTH: ::NTSTATUS = 0xC002002Fu32 as i32; -pub const RPC_NT_UNKNOWN_AUTHN_SERVICE: ::NTSTATUS = 0xC0020030u32 as i32; -pub const RPC_NT_UNKNOWN_AUTHN_LEVEL: ::NTSTATUS = 0xC0020031u32 as i32; -pub const RPC_NT_INVALID_AUTH_IDENTITY: ::NTSTATUS = 0xC0020032u32 as i32; -pub const RPC_NT_UNKNOWN_AUTHZ_SERVICE: ::NTSTATUS = 0xC0020033u32 as i32; -pub const EPT_NT_INVALID_ENTRY: ::NTSTATUS = 0xC0020034u32 as i32; -pub const EPT_NT_CANT_PERFORM_OP: ::NTSTATUS = 0xC0020035u32 as i32; -pub const EPT_NT_NOT_REGISTERED: ::NTSTATUS = 0xC0020036u32 as i32; -pub const RPC_NT_NOTHING_TO_EXPORT: ::NTSTATUS = 0xC0020037u32 as i32; -pub const RPC_NT_INCOMPLETE_NAME: ::NTSTATUS = 0xC0020038u32 as i32; -pub const RPC_NT_INVALID_VERS_OPTION: ::NTSTATUS = 0xC0020039u32 as i32; -pub const RPC_NT_NO_MORE_MEMBERS: ::NTSTATUS = 0xC002003Au32 as i32; -pub const RPC_NT_NOT_ALL_OBJS_UNEXPORTED: ::NTSTATUS = 0xC002003Bu32 as i32; -pub const RPC_NT_INTERFACE_NOT_FOUND: ::NTSTATUS = 0xC002003Cu32 as i32; -pub const RPC_NT_ENTRY_ALREADY_EXISTS: ::NTSTATUS = 0xC002003Du32 as i32; -pub const RPC_NT_ENTRY_NOT_FOUND: ::NTSTATUS = 0xC002003Eu32 as i32; -pub const RPC_NT_NAME_SERVICE_UNAVAILABLE: ::NTSTATUS = 0xC002003Fu32 as i32; -pub const RPC_NT_INVALID_NAF_ID: ::NTSTATUS = 0xC0020040u32 as i32; -pub const RPC_NT_CANNOT_SUPPORT: ::NTSTATUS = 0xC0020041u32 as i32; -pub const RPC_NT_NO_CONTEXT_AVAILABLE: ::NTSTATUS = 0xC0020042u32 as i32; -pub const RPC_NT_INTERNAL_ERROR: ::NTSTATUS = 0xC0020043u32 as i32; -pub const RPC_NT_ZERO_DIVIDE: ::NTSTATUS = 0xC0020044u32 as i32; -pub const RPC_NT_ADDRESS_ERROR: ::NTSTATUS = 0xC0020045u32 as i32; -pub const RPC_NT_FP_DIV_ZERO: ::NTSTATUS = 0xC0020046u32 as i32; -pub const RPC_NT_FP_UNDERFLOW: ::NTSTATUS = 0xC0020047u32 as i32; -pub const RPC_NT_FP_OVERFLOW: ::NTSTATUS = 0xC0020048u32 as i32; -pub const RPC_NT_NO_MORE_ENTRIES: ::NTSTATUS = 0xC0030001u32 as i32; -pub const RPC_NT_SS_CHAR_TRANS_OPEN_FAIL: ::NTSTATUS = 0xC0030002u32 as i32; -pub const RPC_NT_SS_CHAR_TRANS_SHORT_FILE: ::NTSTATUS = 0xC0030003u32 as i32; -pub const RPC_NT_SS_IN_NULL_CONTEXT: ::NTSTATUS = 0xC0030004u32 as i32; -pub const RPC_NT_SS_CONTEXT_MISMATCH: ::NTSTATUS = 0xC0030005u32 as i32; -pub const RPC_NT_SS_CONTEXT_DAMAGED: ::NTSTATUS = 0xC0030006u32 as i32; -pub const RPC_NT_SS_HANDLES_MISMATCH: ::NTSTATUS = 0xC0030007u32 as i32; -pub const RPC_NT_SS_CANNOT_GET_CALL_HANDLE: ::NTSTATUS = 0xC0030008u32 as i32; -pub const RPC_NT_NULL_REF_POINTER: ::NTSTATUS = 0xC0030009u32 as i32; -pub const RPC_NT_ENUM_VALUE_OUT_OF_RANGE: ::NTSTATUS = 0xC003000Au32 as i32; -pub const RPC_NT_BYTE_COUNT_TOO_SMALL: ::NTSTATUS = 0xC003000Bu32 as i32; -pub const RPC_NT_BAD_STUB_DATA: ::NTSTATUS = 0xC003000Cu32 as i32; -pub const RPC_NT_CALL_IN_PROGRESS: ::NTSTATUS = 0xC0020049u32 as i32; -pub const RPC_NT_NO_MORE_BINDINGS: ::NTSTATUS = 0xC002004Au32 as i32; -pub const RPC_NT_GROUP_MEMBER_NOT_FOUND: ::NTSTATUS = 0xC002004Bu32 as i32; -pub const EPT_NT_CANT_CREATE: ::NTSTATUS = 0xC002004Cu32 as i32; -pub const RPC_NT_INVALID_OBJECT: ::NTSTATUS = 0xC002004Du32 as i32; -pub const RPC_NT_NO_INTERFACES: ::NTSTATUS = 0xC002004Fu32 as i32; -pub const RPC_NT_CALL_CANCELLED: ::NTSTATUS = 0xC0020050u32 as i32; -pub const RPC_NT_BINDING_INCOMPLETE: ::NTSTATUS = 0xC0020051u32 as i32; -pub const RPC_NT_COMM_FAILURE: ::NTSTATUS = 0xC0020052u32 as i32; -pub const RPC_NT_UNSUPPORTED_AUTHN_LEVEL: ::NTSTATUS = 0xC0020053u32 as i32; -pub const RPC_NT_NO_PRINC_NAME: ::NTSTATUS = 0xC0020054u32 as i32; -pub const RPC_NT_NOT_RPC_ERROR: ::NTSTATUS = 0xC0020055u32 as i32; -pub const RPC_NT_UUID_LOCAL_ONLY: ::NTSTATUS = 0x40020056; -pub const RPC_NT_SEC_PKG_ERROR: ::NTSTATUS = 0xC0020057u32 as i32; -pub const RPC_NT_NOT_CANCELLED: ::NTSTATUS = 0xC0020058u32 as i32; -pub const RPC_NT_INVALID_ES_ACTION: ::NTSTATUS = 0xC0030059u32 as i32; -pub const RPC_NT_WRONG_ES_VERSION: ::NTSTATUS = 0xC003005Au32 as i32; -pub const RPC_NT_WRONG_STUB_VERSION: ::NTSTATUS = 0xC003005Bu32 as i32; -pub const RPC_NT_INVALID_PIPE_OBJECT: ::NTSTATUS = 0xC003005Cu32 as i32; -pub const RPC_NT_INVALID_PIPE_OPERATION: ::NTSTATUS = 0xC003005Du32 as i32; -pub const RPC_NT_WRONG_PIPE_VERSION: ::NTSTATUS = 0xC003005Eu32 as i32; -pub const RPC_NT_PIPE_CLOSED: ::NTSTATUS = 0xC003005Fu32 as i32; -pub const RPC_NT_PIPE_DISCIPLINE_ERROR: ::NTSTATUS = 0xC0030060u32 as i32; -pub const RPC_NT_PIPE_EMPTY: ::NTSTATUS = 0xC0030061u32 as i32; -pub const RPC_NT_INVALID_ASYNC_HANDLE: ::NTSTATUS = 0xC0020062u32 as i32; -pub const RPC_NT_INVALID_ASYNC_CALL: ::NTSTATUS = 0xC0020063u32 as i32; -pub const RPC_NT_PROXY_ACCESS_DENIED: ::NTSTATUS = 0xC0020064u32 as i32; -pub const RPC_NT_COOKIE_AUTH_FAILED: ::NTSTATUS = 0xC0020065u32 as i32; -pub const RPC_NT_SEND_INCOMPLETE: ::NTSTATUS = 0x400200AF; -pub const STATUS_ACPI_INVALID_OPCODE: ::NTSTATUS = 0xC0140001u32 as i32; -pub const STATUS_ACPI_STACK_OVERFLOW: ::NTSTATUS = 0xC0140002u32 as i32; -pub const STATUS_ACPI_ASSERT_FAILED: ::NTSTATUS = 0xC0140003u32 as i32; -pub const STATUS_ACPI_INVALID_INDEX: ::NTSTATUS = 0xC0140004u32 as i32; -pub const STATUS_ACPI_INVALID_ARGUMENT: ::NTSTATUS = 0xC0140005u32 as i32; -pub const STATUS_ACPI_FATAL: ::NTSTATUS = 0xC0140006u32 as i32; -pub const STATUS_ACPI_INVALID_SUPERNAME: ::NTSTATUS = 0xC0140007u32 as i32; -pub const STATUS_ACPI_INVALID_ARGTYPE: ::NTSTATUS = 0xC0140008u32 as i32; -pub const STATUS_ACPI_INVALID_OBJTYPE: ::NTSTATUS = 0xC0140009u32 as i32; -pub const STATUS_ACPI_INVALID_TARGETTYPE: ::NTSTATUS = 0xC014000Au32 as i32; -pub const STATUS_ACPI_INCORRECT_ARGUMENT_COUNT: ::NTSTATUS = 0xC014000Bu32 as i32; -pub const STATUS_ACPI_ADDRESS_NOT_MAPPED: ::NTSTATUS = 0xC014000Cu32 as i32; -pub const STATUS_ACPI_INVALID_EVENTTYPE: ::NTSTATUS = 0xC014000Du32 as i32; -pub const STATUS_ACPI_HANDLER_COLLISION: ::NTSTATUS = 0xC014000Eu32 as i32; -pub const STATUS_ACPI_INVALID_DATA: ::NTSTATUS = 0xC014000Fu32 as i32; -pub const STATUS_ACPI_INVALID_REGION: ::NTSTATUS = 0xC0140010u32 as i32; -pub const STATUS_ACPI_INVALID_ACCESS_SIZE: ::NTSTATUS = 0xC0140011u32 as i32; -pub const STATUS_ACPI_ACQUIRE_GLOBAL_LOCK: ::NTSTATUS = 0xC0140012u32 as i32; -pub const STATUS_ACPI_ALREADY_INITIALIZED: ::NTSTATUS = 0xC0140013u32 as i32; -pub const STATUS_ACPI_NOT_INITIALIZED: ::NTSTATUS = 0xC0140014u32 as i32; -pub const STATUS_ACPI_INVALID_MUTEX_LEVEL: ::NTSTATUS = 0xC0140015u32 as i32; -pub const STATUS_ACPI_MUTEX_NOT_OWNED: ::NTSTATUS = 0xC0140016u32 as i32; -pub const STATUS_ACPI_MUTEX_NOT_OWNER: ::NTSTATUS = 0xC0140017u32 as i32; -pub const STATUS_ACPI_RS_ACCESS: ::NTSTATUS = 0xC0140018u32 as i32; -pub const STATUS_ACPI_INVALID_TABLE: ::NTSTATUS = 0xC0140019u32 as i32; -pub const STATUS_ACPI_REG_HANDLER_FAILED: ::NTSTATUS = 0xC0140020u32 as i32; -pub const STATUS_ACPI_POWER_REQUEST_FAILED: ::NTSTATUS = 0xC0140021u32 as i32; -pub const STATUS_CTX_WINSTATION_NAME_INVALID: ::NTSTATUS = 0xC00A0001u32 as i32; -pub const STATUS_CTX_INVALID_PD: ::NTSTATUS = 0xC00A0002u32 as i32; -pub const STATUS_CTX_PD_NOT_FOUND: ::NTSTATUS = 0xC00A0003u32 as i32; -pub const STATUS_CTX_CDM_CONNECT: ::NTSTATUS = 0x400A0004; -pub const STATUS_CTX_CDM_DISCONNECT: ::NTSTATUS = 0x400A0005; -pub const STATUS_CTX_CLOSE_PENDING: ::NTSTATUS = 0xC00A0006u32 as i32; -pub const STATUS_CTX_NO_OUTBUF: ::NTSTATUS = 0xC00A0007u32 as i32; -pub const STATUS_CTX_MODEM_INF_NOT_FOUND: ::NTSTATUS = 0xC00A0008u32 as i32; -pub const STATUS_CTX_INVALID_MODEMNAME: ::NTSTATUS = 0xC00A0009u32 as i32; -pub const STATUS_CTX_RESPONSE_ERROR: ::NTSTATUS = 0xC00A000Au32 as i32; -pub const STATUS_CTX_MODEM_RESPONSE_TIMEOUT: ::NTSTATUS = 0xC00A000Bu32 as i32; -pub const STATUS_CTX_MODEM_RESPONSE_NO_CARRIER: ::NTSTATUS = 0xC00A000Cu32 as i32; -pub const STATUS_CTX_MODEM_RESPONSE_NO_DIALTONE: ::NTSTATUS = 0xC00A000Du32 as i32; -pub const STATUS_CTX_MODEM_RESPONSE_BUSY: ::NTSTATUS = 0xC00A000Eu32 as i32; -pub const STATUS_CTX_MODEM_RESPONSE_VOICE: ::NTSTATUS = 0xC00A000Fu32 as i32; -pub const STATUS_CTX_TD_ERROR: ::NTSTATUS = 0xC00A0010u32 as i32; -pub const STATUS_CTX_LICENSE_CLIENT_INVALID: ::NTSTATUS = 0xC00A0012u32 as i32; -pub const STATUS_CTX_LICENSE_NOT_AVAILABLE: ::NTSTATUS = 0xC00A0013u32 as i32; -pub const STATUS_CTX_LICENSE_EXPIRED: ::NTSTATUS = 0xC00A0014u32 as i32; -pub const STATUS_CTX_WINSTATION_NOT_FOUND: ::NTSTATUS = 0xC00A0015u32 as i32; -pub const STATUS_CTX_WINSTATION_NAME_COLLISION: ::NTSTATUS = 0xC00A0016u32 as i32; -pub const STATUS_CTX_WINSTATION_BUSY: ::NTSTATUS = 0xC00A0017u32 as i32; -pub const STATUS_CTX_BAD_VIDEO_MODE: ::NTSTATUS = 0xC00A0018u32 as i32; -pub const STATUS_CTX_GRAPHICS_INVALID: ::NTSTATUS = 0xC00A0022u32 as i32; -pub const STATUS_CTX_NOT_CONSOLE: ::NTSTATUS = 0xC00A0024u32 as i32; -pub const STATUS_CTX_CLIENT_QUERY_TIMEOUT: ::NTSTATUS = 0xC00A0026u32 as i32; -pub const STATUS_CTX_CONSOLE_DISCONNECT: ::NTSTATUS = 0xC00A0027u32 as i32; -pub const STATUS_CTX_CONSOLE_CONNECT: ::NTSTATUS = 0xC00A0028u32 as i32; -pub const STATUS_CTX_SHADOW_DENIED: ::NTSTATUS = 0xC00A002Au32 as i32; -pub const STATUS_CTX_WINSTATION_ACCESS_DENIED: ::NTSTATUS = 0xC00A002Bu32 as i32; -pub const STATUS_CTX_INVALID_WD: ::NTSTATUS = 0xC00A002Eu32 as i32; -pub const STATUS_CTX_WD_NOT_FOUND: ::NTSTATUS = 0xC00A002Fu32 as i32; -pub const STATUS_CTX_SHADOW_INVALID: ::NTSTATUS = 0xC00A0030u32 as i32; -pub const STATUS_CTX_SHADOW_DISABLED: ::NTSTATUS = 0xC00A0031u32 as i32; -pub const STATUS_RDP_PROTOCOL_ERROR: ::NTSTATUS = 0xC00A0032u32 as i32; -pub const STATUS_CTX_CLIENT_LICENSE_NOT_SET: ::NTSTATUS = 0xC00A0033u32 as i32; -pub const STATUS_CTX_CLIENT_LICENSE_IN_USE: ::NTSTATUS = 0xC00A0034u32 as i32; -pub const STATUS_CTX_SHADOW_ENDED_BY_MODE_CHANGE: ::NTSTATUS = 0xC00A0035u32 as i32; -pub const STATUS_CTX_SHADOW_NOT_RUNNING: ::NTSTATUS = 0xC00A0036u32 as i32; -pub const STATUS_CTX_LOGON_DISABLED: ::NTSTATUS = 0xC00A0037u32 as i32; -pub const STATUS_CTX_SECURITY_LAYER_ERROR: ::NTSTATUS = 0xC00A0038u32 as i32; -pub const STATUS_TS_INCOMPATIBLE_SESSIONS: ::NTSTATUS = 0xC00A0039u32 as i32; -pub const STATUS_TS_VIDEO_SUBSYSTEM_ERROR: ::NTSTATUS = 0xC00A003Au32 as i32; -pub const STATUS_PNP_BAD_MPS_TABLE: ::NTSTATUS = 0xC0040035u32 as i32; -pub const STATUS_PNP_TRANSLATION_FAILED: ::NTSTATUS = 0xC0040036u32 as i32; -pub const STATUS_PNP_IRQ_TRANSLATION_FAILED: ::NTSTATUS = 0xC0040037u32 as i32; -pub const STATUS_PNP_INVALID_ID: ::NTSTATUS = 0xC0040038u32 as i32; -pub const STATUS_IO_REISSUE_AS_CACHED: ::NTSTATUS = 0xC0040039u32 as i32; -pub const STATUS_MUI_FILE_NOT_FOUND: ::NTSTATUS = 0xC00B0001u32 as i32; -pub const STATUS_MUI_INVALID_FILE: ::NTSTATUS = 0xC00B0002u32 as i32; -pub const STATUS_MUI_INVALID_RC_CONFIG: ::NTSTATUS = 0xC00B0003u32 as i32; -pub const STATUS_MUI_INVALID_LOCALE_NAME: ::NTSTATUS = 0xC00B0004u32 as i32; -pub const STATUS_MUI_INVALID_ULTIMATEFALLBACK_NAME: ::NTSTATUS = 0xC00B0005u32 as i32; -pub const STATUS_MUI_FILE_NOT_LOADED: ::NTSTATUS = 0xC00B0006u32 as i32; -pub const STATUS_RESOURCE_ENUM_USER_STOP: ::NTSTATUS = 0xC00B0007u32 as i32; -pub const STATUS_FLT_NO_HANDLER_DEFINED: ::NTSTATUS = 0xC01C0001u32 as i32; -pub const STATUS_FLT_CONTEXT_ALREADY_DEFINED: ::NTSTATUS = 0xC01C0002u32 as i32; -pub const STATUS_FLT_INVALID_ASYNCHRONOUS_REQUEST: ::NTSTATUS = 0xC01C0003u32 as i32; -pub const STATUS_FLT_DISALLOW_FAST_IO: ::NTSTATUS = 0xC01C0004u32 as i32; -pub const STATUS_FLT_INVALID_NAME_REQUEST: ::NTSTATUS = 0xC01C0005u32 as i32; -pub const STATUS_FLT_NOT_SAFE_TO_POST_OPERATION: ::NTSTATUS = 0xC01C0006u32 as i32; -pub const STATUS_FLT_NOT_INITIALIZED: ::NTSTATUS = 0xC01C0007u32 as i32; -pub const STATUS_FLT_FILTER_NOT_READY: ::NTSTATUS = 0xC01C0008u32 as i32; -pub const STATUS_FLT_POST_OPERATION_CLEANUP: ::NTSTATUS = 0xC01C0009u32 as i32; -pub const STATUS_FLT_INTERNAL_ERROR: ::NTSTATUS = 0xC01C000Au32 as i32; -pub const STATUS_FLT_DELETING_OBJECT: ::NTSTATUS = 0xC01C000Bu32 as i32; -pub const STATUS_FLT_MUST_BE_NONPAGED_POOL: ::NTSTATUS = 0xC01C000Cu32 as i32; -pub const STATUS_FLT_DUPLICATE_ENTRY: ::NTSTATUS = 0xC01C000Du32 as i32; -pub const STATUS_FLT_CBDQ_DISABLED: ::NTSTATUS = 0xC01C000Eu32 as i32; -pub const STATUS_FLT_DO_NOT_ATTACH: ::NTSTATUS = 0xC01C000Fu32 as i32; -pub const STATUS_FLT_DO_NOT_DETACH: ::NTSTATUS = 0xC01C0010u32 as i32; -pub const STATUS_FLT_INSTANCE_ALTITUDE_COLLISION: ::NTSTATUS = 0xC01C0011u32 as i32; -pub const STATUS_FLT_INSTANCE_NAME_COLLISION: ::NTSTATUS = 0xC01C0012u32 as i32; -pub const STATUS_FLT_FILTER_NOT_FOUND: ::NTSTATUS = 0xC01C0013u32 as i32; -pub const STATUS_FLT_VOLUME_NOT_FOUND: ::NTSTATUS = 0xC01C0014u32 as i32; -pub const STATUS_FLT_INSTANCE_NOT_FOUND: ::NTSTATUS = 0xC01C0015u32 as i32; -pub const STATUS_FLT_CONTEXT_ALLOCATION_NOT_FOUND: ::NTSTATUS = 0xC01C0016u32 as i32; -pub const STATUS_FLT_INVALID_CONTEXT_REGISTRATION: ::NTSTATUS = 0xC01C0017u32 as i32; -pub const STATUS_FLT_NAME_CACHE_MISS: ::NTSTATUS = 0xC01C0018u32 as i32; -pub const STATUS_FLT_NO_DEVICE_OBJECT: ::NTSTATUS = 0xC01C0019u32 as i32; -pub const STATUS_FLT_VOLUME_ALREADY_MOUNTED: ::NTSTATUS = 0xC01C001Au32 as i32; -pub const STATUS_FLT_ALREADY_ENLISTED: ::NTSTATUS = 0xC01C001Bu32 as i32; -pub const STATUS_FLT_CONTEXT_ALREADY_LINKED: ::NTSTATUS = 0xC01C001Cu32 as i32; -pub const STATUS_FLT_NO_WAITER_FOR_REPLY: ::NTSTATUS = 0xC01C0020u32 as i32; -pub const STATUS_FLT_REGISTRATION_BUSY: ::NTSTATUS = 0xC01C0023u32 as i32; -pub const STATUS_SXS_SECTION_NOT_FOUND: ::NTSTATUS = 0xC0150001u32 as i32; -pub const STATUS_SXS_CANT_GEN_ACTCTX: ::NTSTATUS = 0xC0150002u32 as i32; -pub const STATUS_SXS_INVALID_ACTCTXDATA_FORMAT: ::NTSTATUS = 0xC0150003u32 as i32; -pub const STATUS_SXS_ASSEMBLY_NOT_FOUND: ::NTSTATUS = 0xC0150004u32 as i32; -pub const STATUS_SXS_MANIFEST_FORMAT_ERROR: ::NTSTATUS = 0xC0150005u32 as i32; -pub const STATUS_SXS_MANIFEST_PARSE_ERROR: ::NTSTATUS = 0xC0150006u32 as i32; -pub const STATUS_SXS_ACTIVATION_CONTEXT_DISABLED: ::NTSTATUS = 0xC0150007u32 as i32; -pub const STATUS_SXS_KEY_NOT_FOUND: ::NTSTATUS = 0xC0150008u32 as i32; -pub const STATUS_SXS_VERSION_CONFLICT: ::NTSTATUS = 0xC0150009u32 as i32; -pub const STATUS_SXS_WRONG_SECTION_TYPE: ::NTSTATUS = 0xC015000Au32 as i32; -pub const STATUS_SXS_THREAD_QUERIES_DISABLED: ::NTSTATUS = 0xC015000Bu32 as i32; -pub const STATUS_SXS_ASSEMBLY_MISSING: ::NTSTATUS = 0xC015000Cu32 as i32; -pub const STATUS_SXS_RELEASE_ACTIVATION_CONTEXT: ::NTSTATUS = 0x4015000D; -pub const STATUS_SXS_PROCESS_DEFAULT_ALREADY_SET: ::NTSTATUS = 0xC015000Eu32 as i32; -pub const STATUS_SXS_EARLY_DEACTIVATION: ::NTSTATUS = 0xC015000Fu32 as i32; -pub const STATUS_SXS_INVALID_DEACTIVATION: ::NTSTATUS = 0xC0150010u32 as i32; -pub const STATUS_SXS_MULTIPLE_DEACTIVATION: ::NTSTATUS = 0xC0150011u32 as i32; -pub const STATUS_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY: ::NTSTATUS = 0xC0150012u32 as i32; -pub const STATUS_SXS_PROCESS_TERMINATION_REQUESTED: ::NTSTATUS = 0xC0150013u32 as i32; -pub const STATUS_SXS_CORRUPT_ACTIVATION_STACK: ::NTSTATUS = 0xC0150014u32 as i32; -pub const STATUS_SXS_CORRUPTION: ::NTSTATUS = 0xC0150015u32 as i32; -pub const STATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE: ::NTSTATUS = 0xC0150016u32 as i32; -pub const STATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME: ::NTSTATUS = 0xC0150017u32 as i32; -pub const STATUS_SXS_IDENTITY_DUPLICATE_ATTRIBUTE: ::NTSTATUS = 0xC0150018u32 as i32; -pub const STATUS_SXS_IDENTITY_PARSE_ERROR: ::NTSTATUS = 0xC0150019u32 as i32; -pub const STATUS_SXS_COMPONENT_STORE_CORRUPT: ::NTSTATUS = 0xC015001Au32 as i32; -pub const STATUS_SXS_FILE_HASH_MISMATCH: ::NTSTATUS = 0xC015001Bu32 as i32; -pub const STATUS_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT: ::NTSTATUS = 0xC015001Cu32 as i32; -pub const STATUS_SXS_IDENTITIES_DIFFERENT: ::NTSTATUS = 0xC015001Du32 as i32; -pub const STATUS_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT: ::NTSTATUS = 0xC015001Eu32 as i32; -pub const STATUS_SXS_FILE_NOT_PART_OF_ASSEMBLY: ::NTSTATUS = 0xC015001Fu32 as i32; -pub const STATUS_ADVANCED_INSTALLER_FAILED: ::NTSTATUS = 0xC0150020u32 as i32; -pub const STATUS_XML_ENCODING_MISMATCH: ::NTSTATUS = 0xC0150021u32 as i32; -pub const STATUS_SXS_MANIFEST_TOO_BIG: ::NTSTATUS = 0xC0150022u32 as i32; -pub const STATUS_SXS_SETTING_NOT_REGISTERED: ::NTSTATUS = 0xC0150023u32 as i32; -pub const STATUS_SXS_TRANSACTION_CLOSURE_INCOMPLETE: ::NTSTATUS = 0xC0150024u32 as i32; -pub const STATUS_SMI_PRIMITIVE_INSTALLER_FAILED: ::NTSTATUS = 0xC0150025u32 as i32; -pub const STATUS_GENERIC_COMMAND_FAILED: ::NTSTATUS = 0xC0150026u32 as i32; -pub const STATUS_SXS_FILE_HASH_MISSING: ::NTSTATUS = 0xC0150027u32 as i32; -pub const STATUS_CLUSTER_INVALID_NODE: ::NTSTATUS = 0xC0130001u32 as i32; -pub const STATUS_CLUSTER_NODE_EXISTS: ::NTSTATUS = 0xC0130002u32 as i32; -pub const STATUS_CLUSTER_JOIN_IN_PROGRESS: ::NTSTATUS = 0xC0130003u32 as i32; -pub const STATUS_CLUSTER_NODE_NOT_FOUND: ::NTSTATUS = 0xC0130004u32 as i32; -pub const STATUS_CLUSTER_LOCAL_NODE_NOT_FOUND: ::NTSTATUS = 0xC0130005u32 as i32; -pub const STATUS_CLUSTER_NETWORK_EXISTS: ::NTSTATUS = 0xC0130006u32 as i32; -pub const STATUS_CLUSTER_NETWORK_NOT_FOUND: ::NTSTATUS = 0xC0130007u32 as i32; -pub const STATUS_CLUSTER_NETINTERFACE_EXISTS: ::NTSTATUS = 0xC0130008u32 as i32; -pub const STATUS_CLUSTER_NETINTERFACE_NOT_FOUND: ::NTSTATUS = 0xC0130009u32 as i32; -pub const STATUS_CLUSTER_INVALID_REQUEST: ::NTSTATUS = 0xC013000Au32 as i32; -pub const STATUS_CLUSTER_INVALID_NETWORK_PROVIDER: ::NTSTATUS = 0xC013000Bu32 as i32; -pub const STATUS_CLUSTER_NODE_DOWN: ::NTSTATUS = 0xC013000Cu32 as i32; -pub const STATUS_CLUSTER_NODE_UNREACHABLE: ::NTSTATUS = 0xC013000Du32 as i32; -pub const STATUS_CLUSTER_NODE_NOT_MEMBER: ::NTSTATUS = 0xC013000Eu32 as i32; -pub const STATUS_CLUSTER_JOIN_NOT_IN_PROGRESS: ::NTSTATUS = 0xC013000Fu32 as i32; -pub const STATUS_CLUSTER_INVALID_NETWORK: ::NTSTATUS = 0xC0130010u32 as i32; -pub const STATUS_CLUSTER_NO_NET_ADAPTERS: ::NTSTATUS = 0xC0130011u32 as i32; -pub const STATUS_CLUSTER_NODE_UP: ::NTSTATUS = 0xC0130012u32 as i32; -pub const STATUS_CLUSTER_NODE_PAUSED: ::NTSTATUS = 0xC0130013u32 as i32; -pub const STATUS_CLUSTER_NODE_NOT_PAUSED: ::NTSTATUS = 0xC0130014u32 as i32; -pub const STATUS_CLUSTER_NO_SECURITY_CONTEXT: ::NTSTATUS = 0xC0130015u32 as i32; -pub const STATUS_CLUSTER_NETWORK_NOT_INTERNAL: ::NTSTATUS = 0xC0130016u32 as i32; -pub const STATUS_CLUSTER_POISONED: ::NTSTATUS = 0xC0130017u32 as i32; -pub const STATUS_CLUSTER_NON_CSV_PATH: ::NTSTATUS = 0xC0130018u32 as i32; -pub const STATUS_CLUSTER_CSV_VOLUME_NOT_LOCAL: ::NTSTATUS = 0xC0130019u32 as i32; -pub const STATUS_CLUSTER_CSV_READ_OPLOCK_BREAK_IN_PROGRESS: ::NTSTATUS = 0xC0130020u32 as i32; -pub const STATUS_CLUSTER_CSV_AUTO_PAUSE_ERROR: ::NTSTATUS = 0xC0130021u32 as i32; -pub const STATUS_CLUSTER_CSV_REDIRECTED: ::NTSTATUS = 0xC0130022u32 as i32; -pub const STATUS_CLUSTER_CSV_NOT_REDIRECTED: ::NTSTATUS = 0xC0130023u32 as i32; -pub const STATUS_CLUSTER_CSV_VOLUME_DRAINING: ::NTSTATUS = 0xC0130024u32 as i32; -pub const STATUS_CLUSTER_CSV_SNAPSHOT_CREATION_IN_PROGRESS: ::NTSTATUS = 0xC0130025u32 as i32; -pub const STATUS_CLUSTER_CSV_VOLUME_DRAINING_SUCCEEDED_DOWNLEVEL: ::NTSTATUS = 0xC0130026u32 as i32; -pub const STATUS_CLUSTER_CSV_NO_SNAPSHOTS: ::NTSTATUS = 0xC0130027u32 as i32; -pub const STATUS_CSV_IO_PAUSE_TIMEOUT: ::NTSTATUS = 0xC0130028u32 as i32; -pub const STATUS_TRANSACTIONAL_CONFLICT: ::NTSTATUS = 0xC0190001u32 as i32; -pub const STATUS_INVALID_TRANSACTION: ::NTSTATUS = 0xC0190002u32 as i32; -pub const STATUS_TRANSACTION_NOT_ACTIVE: ::NTSTATUS = 0xC0190003u32 as i32; -pub const STATUS_TM_INITIALIZATION_FAILED: ::NTSTATUS = 0xC0190004u32 as i32; -pub const STATUS_RM_NOT_ACTIVE: ::NTSTATUS = 0xC0190005u32 as i32; -pub const STATUS_RM_METADATA_CORRUPT: ::NTSTATUS = 0xC0190006u32 as i32; -pub const STATUS_TRANSACTION_NOT_JOINED: ::NTSTATUS = 0xC0190007u32 as i32; -pub const STATUS_DIRECTORY_NOT_RM: ::NTSTATUS = 0xC0190008u32 as i32; -pub const STATUS_COULD_NOT_RESIZE_LOG: ::NTSTATUS = 0x80190009u32 as i32; -pub const STATUS_TRANSACTIONS_UNSUPPORTED_REMOTE: ::NTSTATUS = 0xC019000Au32 as i32; -pub const STATUS_LOG_RESIZE_INVALID_SIZE: ::NTSTATUS = 0xC019000Bu32 as i32; -pub const STATUS_REMOTE_FILE_VERSION_MISMATCH: ::NTSTATUS = 0xC019000Cu32 as i32; -pub const STATUS_CRM_PROTOCOL_ALREADY_EXISTS: ::NTSTATUS = 0xC019000Fu32 as i32; -pub const STATUS_TRANSACTION_PROPAGATION_FAILED: ::NTSTATUS = 0xC0190010u32 as i32; -pub const STATUS_CRM_PROTOCOL_NOT_FOUND: ::NTSTATUS = 0xC0190011u32 as i32; -pub const STATUS_TRANSACTION_SUPERIOR_EXISTS: ::NTSTATUS = 0xC0190012u32 as i32; -pub const STATUS_TRANSACTION_REQUEST_NOT_VALID: ::NTSTATUS = 0xC0190013u32 as i32; -pub const STATUS_TRANSACTION_NOT_REQUESTED: ::NTSTATUS = 0xC0190014u32 as i32; -pub const STATUS_TRANSACTION_ALREADY_ABORTED: ::NTSTATUS = 0xC0190015u32 as i32; -pub const STATUS_TRANSACTION_ALREADY_COMMITTED: ::NTSTATUS = 0xC0190016u32 as i32; -pub const STATUS_TRANSACTION_INVALID_MARSHALL_BUFFER: ::NTSTATUS = 0xC0190017u32 as i32; -pub const STATUS_CURRENT_TRANSACTION_NOT_VALID: ::NTSTATUS = 0xC0190018u32 as i32; -pub const STATUS_LOG_GROWTH_FAILED: ::NTSTATUS = 0xC0190019u32 as i32; -pub const STATUS_OBJECT_NO_LONGER_EXISTS: ::NTSTATUS = 0xC0190021u32 as i32; -pub const STATUS_STREAM_MINIVERSION_NOT_FOUND: ::NTSTATUS = 0xC0190022u32 as i32; -pub const STATUS_STREAM_MINIVERSION_NOT_VALID: ::NTSTATUS = 0xC0190023u32 as i32; -pub const STATUS_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION: ::NTSTATUS = 0xC0190024u32 as i32; -pub const STATUS_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT: ::NTSTATUS = 0xC0190025u32 as i32; -pub const STATUS_CANT_CREATE_MORE_STREAM_MINIVERSIONS: ::NTSTATUS = 0xC0190026u32 as i32; -pub const STATUS_HANDLE_NO_LONGER_VALID: ::NTSTATUS = 0xC0190028u32 as i32; -pub const STATUS_NO_TXF_METADATA: ::NTSTATUS = 0x80190029u32 as i32; -pub const STATUS_LOG_CORRUPTION_DETECTED: ::NTSTATUS = 0xC0190030u32 as i32; -pub const STATUS_CANT_RECOVER_WITH_HANDLE_OPEN: ::NTSTATUS = 0x80190031u32 as i32; -pub const STATUS_RM_DISCONNECTED: ::NTSTATUS = 0xC0190032u32 as i32; -pub const STATUS_ENLISTMENT_NOT_SUPERIOR: ::NTSTATUS = 0xC0190033u32 as i32; -pub const STATUS_RECOVERY_NOT_NEEDED: ::NTSTATUS = 0x40190034; -pub const STATUS_RM_ALREADY_STARTED: ::NTSTATUS = 0x40190035; -pub const STATUS_FILE_IDENTITY_NOT_PERSISTENT: ::NTSTATUS = 0xC0190036u32 as i32; -pub const STATUS_CANT_BREAK_TRANSACTIONAL_DEPENDENCY: ::NTSTATUS = 0xC0190037u32 as i32; -pub const STATUS_CANT_CROSS_RM_BOUNDARY: ::NTSTATUS = 0xC0190038u32 as i32; -pub const STATUS_TXF_DIR_NOT_EMPTY: ::NTSTATUS = 0xC0190039u32 as i32; -pub const STATUS_INDOUBT_TRANSACTIONS_EXIST: ::NTSTATUS = 0xC019003Au32 as i32; -pub const STATUS_TM_VOLATILE: ::NTSTATUS = 0xC019003Bu32 as i32; -pub const STATUS_ROLLBACK_TIMER_EXPIRED: ::NTSTATUS = 0xC019003Cu32 as i32; -pub const STATUS_TXF_ATTRIBUTE_CORRUPT: ::NTSTATUS = 0xC019003Du32 as i32; -pub const STATUS_EFS_NOT_ALLOWED_IN_TRANSACTION: ::NTSTATUS = 0xC019003Eu32 as i32; -pub const STATUS_TRANSACTIONAL_OPEN_NOT_ALLOWED: ::NTSTATUS = 0xC019003Fu32 as i32; -pub const STATUS_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE: ::NTSTATUS = 0xC0190040u32 as i32; -pub const STATUS_TXF_METADATA_ALREADY_PRESENT: ::NTSTATUS = 0x80190041u32 as i32; -pub const STATUS_TRANSACTION_SCOPE_CALLBACKS_NOT_SET: ::NTSTATUS = 0x80190042u32 as i32; -pub const STATUS_TRANSACTION_REQUIRED_PROMOTION: ::NTSTATUS = 0xC0190043u32 as i32; -pub const STATUS_CANNOT_EXECUTE_FILE_IN_TRANSACTION: ::NTSTATUS = 0xC0190044u32 as i32; -pub const STATUS_TRANSACTIONS_NOT_FROZEN: ::NTSTATUS = 0xC0190045u32 as i32; -pub const STATUS_TRANSACTION_FREEZE_IN_PROGRESS: ::NTSTATUS = 0xC0190046u32 as i32; -pub const STATUS_NOT_SNAPSHOT_VOLUME: ::NTSTATUS = 0xC0190047u32 as i32; -pub const STATUS_NO_SAVEPOINT_WITH_OPEN_FILES: ::NTSTATUS = 0xC0190048u32 as i32; -pub const STATUS_SPARSE_NOT_ALLOWED_IN_TRANSACTION: ::NTSTATUS = 0xC0190049u32 as i32; -pub const STATUS_TM_IDENTITY_MISMATCH: ::NTSTATUS = 0xC019004Au32 as i32; -pub const STATUS_FLOATED_SECTION: ::NTSTATUS = 0xC019004Bu32 as i32; -pub const STATUS_CANNOT_ACCEPT_TRANSACTED_WORK: ::NTSTATUS = 0xC019004Cu32 as i32; -pub const STATUS_CANNOT_ABORT_TRANSACTIONS: ::NTSTATUS = 0xC019004Du32 as i32; -pub const STATUS_TRANSACTION_NOT_FOUND: ::NTSTATUS = 0xC019004Eu32 as i32; -pub const STATUS_RESOURCEMANAGER_NOT_FOUND: ::NTSTATUS = 0xC019004Fu32 as i32; -pub const STATUS_ENLISTMENT_NOT_FOUND: ::NTSTATUS = 0xC0190050u32 as i32; -pub const STATUS_TRANSACTIONMANAGER_NOT_FOUND: ::NTSTATUS = 0xC0190051u32 as i32; -pub const STATUS_TRANSACTIONMANAGER_NOT_ONLINE: ::NTSTATUS = 0xC0190052u32 as i32; -pub const STATUS_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION: ::NTSTATUS = 0xC0190053u32 as i32; -pub const STATUS_TRANSACTION_NOT_ROOT: ::NTSTATUS = 0xC0190054u32 as i32; -pub const STATUS_TRANSACTION_OBJECT_EXPIRED: ::NTSTATUS = 0xC0190055u32 as i32; -pub const STATUS_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION: ::NTSTATUS = 0xC0190056u32 as i32; -pub const STATUS_TRANSACTION_RESPONSE_NOT_ENLISTED: ::NTSTATUS = 0xC0190057u32 as i32; -pub const STATUS_TRANSACTION_RECORD_TOO_LONG: ::NTSTATUS = 0xC0190058u32 as i32; -pub const STATUS_NO_LINK_TRACKING_IN_TRANSACTION: ::NTSTATUS = 0xC0190059u32 as i32; -pub const STATUS_OPERATION_NOT_SUPPORTED_IN_TRANSACTION: ::NTSTATUS = 0xC019005Au32 as i32; -pub const STATUS_TRANSACTION_INTEGRITY_VIOLATED: ::NTSTATUS = 0xC019005Bu32 as i32; -pub const STATUS_TRANSACTIONMANAGER_IDENTITY_MISMATCH: ::NTSTATUS = 0xC019005Cu32 as i32; -pub const STATUS_RM_CANNOT_BE_FROZEN_FOR_SNAPSHOT: ::NTSTATUS = 0xC019005Du32 as i32; -pub const STATUS_TRANSACTION_MUST_WRITETHROUGH: ::NTSTATUS = 0xC019005Eu32 as i32; -pub const STATUS_TRANSACTION_NO_SUPERIOR: ::NTSTATUS = 0xC019005Fu32 as i32; -pub const STATUS_EXPIRED_HANDLE: ::NTSTATUS = 0xC0190060u32 as i32; -pub const STATUS_TRANSACTION_NOT_ENLISTED: ::NTSTATUS = 0xC0190061u32 as i32; -pub const STATUS_LOG_SECTOR_INVALID: ::NTSTATUS = 0xC01A0001u32 as i32; -pub const STATUS_LOG_SECTOR_PARITY_INVALID: ::NTSTATUS = 0xC01A0002u32 as i32; -pub const STATUS_LOG_SECTOR_REMAPPED: ::NTSTATUS = 0xC01A0003u32 as i32; -pub const STATUS_LOG_BLOCK_INCOMPLETE: ::NTSTATUS = 0xC01A0004u32 as i32; -pub const STATUS_LOG_INVALID_RANGE: ::NTSTATUS = 0xC01A0005u32 as i32; -pub const STATUS_LOG_BLOCKS_EXHAUSTED: ::NTSTATUS = 0xC01A0006u32 as i32; -pub const STATUS_LOG_READ_CONTEXT_INVALID: ::NTSTATUS = 0xC01A0007u32 as i32; -pub const STATUS_LOG_RESTART_INVALID: ::NTSTATUS = 0xC01A0008u32 as i32; -pub const STATUS_LOG_BLOCK_VERSION: ::NTSTATUS = 0xC01A0009u32 as i32; -pub const STATUS_LOG_BLOCK_INVALID: ::NTSTATUS = 0xC01A000Au32 as i32; -pub const STATUS_LOG_READ_MODE_INVALID: ::NTSTATUS = 0xC01A000Bu32 as i32; -pub const STATUS_LOG_NO_RESTART: ::NTSTATUS = 0x401A000C; -pub const STATUS_LOG_METADATA_CORRUPT: ::NTSTATUS = 0xC01A000Du32 as i32; -pub const STATUS_LOG_METADATA_INVALID: ::NTSTATUS = 0xC01A000Eu32 as i32; -pub const STATUS_LOG_METADATA_INCONSISTENT: ::NTSTATUS = 0xC01A000Fu32 as i32; -pub const STATUS_LOG_RESERVATION_INVALID: ::NTSTATUS = 0xC01A0010u32 as i32; -pub const STATUS_LOG_CANT_DELETE: ::NTSTATUS = 0xC01A0011u32 as i32; -pub const STATUS_LOG_CONTAINER_LIMIT_EXCEEDED: ::NTSTATUS = 0xC01A0012u32 as i32; -pub const STATUS_LOG_START_OF_LOG: ::NTSTATUS = 0xC01A0013u32 as i32; -pub const STATUS_LOG_POLICY_ALREADY_INSTALLED: ::NTSTATUS = 0xC01A0014u32 as i32; -pub const STATUS_LOG_POLICY_NOT_INSTALLED: ::NTSTATUS = 0xC01A0015u32 as i32; -pub const STATUS_LOG_POLICY_INVALID: ::NTSTATUS = 0xC01A0016u32 as i32; -pub const STATUS_LOG_POLICY_CONFLICT: ::NTSTATUS = 0xC01A0017u32 as i32; -pub const STATUS_LOG_PINNED_ARCHIVE_TAIL: ::NTSTATUS = 0xC01A0018u32 as i32; -pub const STATUS_LOG_RECORD_NONEXISTENT: ::NTSTATUS = 0xC01A0019u32 as i32; -pub const STATUS_LOG_RECORDS_RESERVED_INVALID: ::NTSTATUS = 0xC01A001Au32 as i32; -pub const STATUS_LOG_SPACE_RESERVED_INVALID: ::NTSTATUS = 0xC01A001Bu32 as i32; -pub const STATUS_LOG_TAIL_INVALID: ::NTSTATUS = 0xC01A001Cu32 as i32; -pub const STATUS_LOG_FULL: ::NTSTATUS = 0xC01A001Du32 as i32; -pub const STATUS_LOG_MULTIPLEXED: ::NTSTATUS = 0xC01A001Eu32 as i32; -pub const STATUS_LOG_DEDICATED: ::NTSTATUS = 0xC01A001Fu32 as i32; -pub const STATUS_LOG_ARCHIVE_NOT_IN_PROGRESS: ::NTSTATUS = 0xC01A0020u32 as i32; -pub const STATUS_LOG_ARCHIVE_IN_PROGRESS: ::NTSTATUS = 0xC01A0021u32 as i32; -pub const STATUS_LOG_EPHEMERAL: ::NTSTATUS = 0xC01A0022u32 as i32; -pub const STATUS_LOG_NOT_ENOUGH_CONTAINERS: ::NTSTATUS = 0xC01A0023u32 as i32; -pub const STATUS_LOG_CLIENT_ALREADY_REGISTERED: ::NTSTATUS = 0xC01A0024u32 as i32; -pub const STATUS_LOG_CLIENT_NOT_REGISTERED: ::NTSTATUS = 0xC01A0025u32 as i32; -pub const STATUS_LOG_FULL_HANDLER_IN_PROGRESS: ::NTSTATUS = 0xC01A0026u32 as i32; -pub const STATUS_LOG_CONTAINER_READ_FAILED: ::NTSTATUS = 0xC01A0027u32 as i32; -pub const STATUS_LOG_CONTAINER_WRITE_FAILED: ::NTSTATUS = 0xC01A0028u32 as i32; -pub const STATUS_LOG_CONTAINER_OPEN_FAILED: ::NTSTATUS = 0xC01A0029u32 as i32; -pub const STATUS_LOG_CONTAINER_STATE_INVALID: ::NTSTATUS = 0xC01A002Au32 as i32; -pub const STATUS_LOG_STATE_INVALID: ::NTSTATUS = 0xC01A002Bu32 as i32; -pub const STATUS_LOG_PINNED: ::NTSTATUS = 0xC01A002Cu32 as i32; -pub const STATUS_LOG_METADATA_FLUSH_FAILED: ::NTSTATUS = 0xC01A002Du32 as i32; -pub const STATUS_LOG_INCONSISTENT_SECURITY: ::NTSTATUS = 0xC01A002Eu32 as i32; -pub const STATUS_LOG_APPENDED_FLUSH_FAILED: ::NTSTATUS = 0xC01A002Fu32 as i32; -pub const STATUS_LOG_PINNED_RESERVATION: ::NTSTATUS = 0xC01A0030u32 as i32; -pub const STATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD: ::NTSTATUS = 0xC01B00EAu32 as i32; -pub const STATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD_RECOVERED: ::NTSTATUS = 0x801B00EBu32 as i32; -pub const STATUS_VIDEO_DRIVER_DEBUG_REPORT_REQUEST: ::NTSTATUS = 0x401B00EC; -pub const STATUS_MONITOR_NO_DESCRIPTOR: ::NTSTATUS = 0xC01D0001u32 as i32; -pub const STATUS_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT: ::NTSTATUS = 0xC01D0002u32 as i32; -pub const STATUS_MONITOR_INVALID_DESCRIPTOR_CHECKSUM: ::NTSTATUS = 0xC01D0003u32 as i32; -pub const STATUS_MONITOR_INVALID_STANDARD_TIMING_BLOCK: ::NTSTATUS = 0xC01D0004u32 as i32; -pub const STATUS_MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED: ::NTSTATUS = 0xC01D0005u32 as i32; -pub const STATUS_MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK: ::NTSTATUS = 0xC01D0006u32 as i32; -pub const STATUS_MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK: ::NTSTATUS = 0xC01D0007u32 as i32; -pub const STATUS_MONITOR_NO_MORE_DESCRIPTOR_DATA: ::NTSTATUS = 0xC01D0008u32 as i32; -pub const STATUS_MONITOR_INVALID_DETAILED_TIMING_BLOCK: ::NTSTATUS = 0xC01D0009u32 as i32; -pub const STATUS_MONITOR_INVALID_MANUFACTURE_DATE: ::NTSTATUS = 0xC01D000Au32 as i32; -pub const STATUS_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER: ::NTSTATUS = 0xC01E0000u32 as i32; -pub const STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER: ::NTSTATUS = 0xC01E0001u32 as i32; -pub const STATUS_GRAPHICS_INVALID_DISPLAY_ADAPTER: ::NTSTATUS = 0xC01E0002u32 as i32; -pub const STATUS_GRAPHICS_ADAPTER_WAS_RESET: ::NTSTATUS = 0xC01E0003u32 as i32; -pub const STATUS_GRAPHICS_INVALID_DRIVER_MODEL: ::NTSTATUS = 0xC01E0004u32 as i32; -pub const STATUS_GRAPHICS_PRESENT_MODE_CHANGED: ::NTSTATUS = 0xC01E0005u32 as i32; -pub const STATUS_GRAPHICS_PRESENT_OCCLUDED: ::NTSTATUS = 0xC01E0006u32 as i32; -pub const STATUS_GRAPHICS_PRESENT_DENIED: ::NTSTATUS = 0xC01E0007u32 as i32; -pub const STATUS_GRAPHICS_CANNOTCOLORCONVERT: ::NTSTATUS = 0xC01E0008u32 as i32; -pub const STATUS_GRAPHICS_DRIVER_MISMATCH: ::NTSTATUS = 0xC01E0009u32 as i32; -pub const STATUS_GRAPHICS_PARTIAL_DATA_POPULATED: ::NTSTATUS = 0x401E000A; -pub const STATUS_GRAPHICS_PRESENT_REDIRECTION_DISABLED: ::NTSTATUS = 0xC01E000Bu32 as i32; -pub const STATUS_GRAPHICS_PRESENT_UNOCCLUDED: ::NTSTATUS = 0xC01E000Cu32 as i32; -pub const STATUS_GRAPHICS_WINDOWDC_NOT_AVAILABLE: ::NTSTATUS = 0xC01E000Du32 as i32; -pub const STATUS_GRAPHICS_WINDOWLESS_PRESENT_DISABLED: ::NTSTATUS = 0xC01E000Eu32 as i32; -pub const STATUS_GRAPHICS_NO_VIDEO_MEMORY: ::NTSTATUS = 0xC01E0100u32 as i32; -pub const STATUS_GRAPHICS_CANT_LOCK_MEMORY: ::NTSTATUS = 0xC01E0101u32 as i32; -pub const STATUS_GRAPHICS_ALLOCATION_BUSY: ::NTSTATUS = 0xC01E0102u32 as i32; -pub const STATUS_GRAPHICS_TOO_MANY_REFERENCES: ::NTSTATUS = 0xC01E0103u32 as i32; -pub const STATUS_GRAPHICS_TRY_AGAIN_LATER: ::NTSTATUS = 0xC01E0104u32 as i32; -pub const STATUS_GRAPHICS_TRY_AGAIN_NOW: ::NTSTATUS = 0xC01E0105u32 as i32; -pub const STATUS_GRAPHICS_ALLOCATION_INVALID: ::NTSTATUS = 0xC01E0106u32 as i32; -pub const STATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE: ::NTSTATUS = 0xC01E0107u32 as i32; -pub const STATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED: ::NTSTATUS = 0xC01E0108u32 as i32; -pub const STATUS_GRAPHICS_CANT_EVICT_PINNED_ALLOCATION: ::NTSTATUS = 0xC01E0109u32 as i32; -pub const STATUS_GRAPHICS_INVALID_ALLOCATION_USAGE: ::NTSTATUS = 0xC01E0110u32 as i32; -pub const STATUS_GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION: ::NTSTATUS = 0xC01E0111u32 as i32; -pub const STATUS_GRAPHICS_ALLOCATION_CLOSED: ::NTSTATUS = 0xC01E0112u32 as i32; -pub const STATUS_GRAPHICS_INVALID_ALLOCATION_INSTANCE: ::NTSTATUS = 0xC01E0113u32 as i32; -pub const STATUS_GRAPHICS_INVALID_ALLOCATION_HANDLE: ::NTSTATUS = 0xC01E0114u32 as i32; -pub const STATUS_GRAPHICS_WRONG_ALLOCATION_DEVICE: ::NTSTATUS = 0xC01E0115u32 as i32; -pub const STATUS_GRAPHICS_ALLOCATION_CONTENT_LOST: ::NTSTATUS = 0xC01E0116u32 as i32; -pub const STATUS_GRAPHICS_GPU_EXCEPTION_ON_DEVICE: ::NTSTATUS = 0xC01E0200u32 as i32; -pub const STATUS_GRAPHICS_SKIP_ALLOCATION_PREPARATION: ::NTSTATUS = 0x401E0201; -pub const STATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY: ::NTSTATUS = 0xC01E0300u32 as i32; -pub const STATUS_GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0301u32 as i32; -pub const STATUS_GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0302u32 as i32; -pub const STATUS_GRAPHICS_INVALID_VIDPN: ::NTSTATUS = 0xC01E0303u32 as i32; -pub const STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE: ::NTSTATUS = 0xC01E0304u32 as i32; -pub const STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET: ::NTSTATUS = 0xC01E0305u32 as i32; -pub const STATUS_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0306u32 as i32; -pub const STATUS_GRAPHICS_MODE_NOT_PINNED: ::NTSTATUS = 0x401E0307; -pub const STATUS_GRAPHICS_INVALID_VIDPN_SOURCEMODESET: ::NTSTATUS = 0xC01E0308u32 as i32; -pub const STATUS_GRAPHICS_INVALID_VIDPN_TARGETMODESET: ::NTSTATUS = 0xC01E0309u32 as i32; -pub const STATUS_GRAPHICS_INVALID_FREQUENCY: ::NTSTATUS = 0xC01E030Au32 as i32; -pub const STATUS_GRAPHICS_INVALID_ACTIVE_REGION: ::NTSTATUS = 0xC01E030Bu32 as i32; -pub const STATUS_GRAPHICS_INVALID_TOTAL_REGION: ::NTSTATUS = 0xC01E030Cu32 as i32; -pub const STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE: ::NTSTATUS = 0xC01E0310u32 as i32; -pub const STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE: ::NTSTATUS = 0xC01E0311u32 as i32; -pub const STATUS_GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET: ::NTSTATUS = 0xC01E0312u32 as i32; -pub const STATUS_GRAPHICS_PATH_ALREADY_IN_TOPOLOGY: ::NTSTATUS = 0xC01E0313u32 as i32; -pub const STATUS_GRAPHICS_MODE_ALREADY_IN_MODESET: ::NTSTATUS = 0xC01E0314u32 as i32; -pub const STATUS_GRAPHICS_INVALID_VIDEOPRESENTSOURCESET: ::NTSTATUS = 0xC01E0315u32 as i32; -pub const STATUS_GRAPHICS_INVALID_VIDEOPRESENTTARGETSET: ::NTSTATUS = 0xC01E0316u32 as i32; -pub const STATUS_GRAPHICS_SOURCE_ALREADY_IN_SET: ::NTSTATUS = 0xC01E0317u32 as i32; -pub const STATUS_GRAPHICS_TARGET_ALREADY_IN_SET: ::NTSTATUS = 0xC01E0318u32 as i32; -pub const STATUS_GRAPHICS_INVALID_VIDPN_PRESENT_PATH: ::NTSTATUS = 0xC01E0319u32 as i32; -pub const STATUS_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY: ::NTSTATUS = 0xC01E031Au32 as i32; -pub const STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET: ::NTSTATUS = 0xC01E031Bu32 as i32; -pub const STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE: ::NTSTATUS = 0xC01E031Cu32 as i32; -pub const STATUS_GRAPHICS_FREQUENCYRANGE_NOT_IN_SET: ::NTSTATUS = 0xC01E031Du32 as i32; -pub const STATUS_GRAPHICS_NO_PREFERRED_MODE: ::NTSTATUS = 0x401E031E; -pub const STATUS_GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET: ::NTSTATUS = 0xC01E031Fu32 as i32; -pub const STATUS_GRAPHICS_STALE_MODESET: ::NTSTATUS = 0xC01E0320u32 as i32; -pub const STATUS_GRAPHICS_INVALID_MONITOR_SOURCEMODESET: ::NTSTATUS = 0xC01E0321u32 as i32; -pub const STATUS_GRAPHICS_INVALID_MONITOR_SOURCE_MODE: ::NTSTATUS = 0xC01E0322u32 as i32; -pub const STATUS_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN: ::NTSTATUS = 0xC01E0323u32 as i32; -pub const STATUS_GRAPHICS_MODE_ID_MUST_BE_UNIQUE: ::NTSTATUS = 0xC01E0324u32 as i32; -pub const STATUS_GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION: ::NTSTATUS = 0xC01E0325u32 as i32; -pub const STATUS_GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES: ::NTSTATUS = 0xC01E0326u32 as i32; -pub const STATUS_GRAPHICS_PATH_NOT_IN_TOPOLOGY: ::NTSTATUS = 0xC01E0327u32 as i32; -pub const STATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE: ::NTSTATUS = 0xC01E0328u32 as i32; -pub const STATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET: ::NTSTATUS = 0xC01E0329u32 as i32; -pub const STATUS_GRAPHICS_INVALID_MONITORDESCRIPTORSET: ::NTSTATUS = 0xC01E032Au32 as i32; -pub const STATUS_GRAPHICS_INVALID_MONITORDESCRIPTOR: ::NTSTATUS = 0xC01E032Bu32 as i32; -pub const STATUS_GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET: ::NTSTATUS = 0xC01E032Cu32 as i32; -pub const STATUS_GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET: ::NTSTATUS = 0xC01E032Du32 as i32; -pub const STATUS_GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE: ::NTSTATUS = 0xC01E032Eu32 as i32; -pub const STATUS_GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE: ::NTSTATUS = 0xC01E032Fu32 as i32; -pub const STATUS_GRAPHICS_RESOURCES_NOT_RELATED: ::NTSTATUS = 0xC01E0330u32 as i32; -pub const STATUS_GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE: ::NTSTATUS = 0xC01E0331u32 as i32; -pub const STATUS_GRAPHICS_TARGET_ID_MUST_BE_UNIQUE: ::NTSTATUS = 0xC01E0332u32 as i32; -pub const STATUS_GRAPHICS_NO_AVAILABLE_VIDPN_TARGET: ::NTSTATUS = 0xC01E0333u32 as i32; -pub const STATUS_GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER: ::NTSTATUS = 0xC01E0334u32 as i32; -pub const STATUS_GRAPHICS_NO_VIDPNMGR: ::NTSTATUS = 0xC01E0335u32 as i32; -pub const STATUS_GRAPHICS_NO_ACTIVE_VIDPN: ::NTSTATUS = 0xC01E0336u32 as i32; -pub const STATUS_GRAPHICS_STALE_VIDPN_TOPOLOGY: ::NTSTATUS = 0xC01E0337u32 as i32; -pub const STATUS_GRAPHICS_MONITOR_NOT_CONNECTED: ::NTSTATUS = 0xC01E0338u32 as i32; -pub const STATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY: ::NTSTATUS = 0xC01E0339u32 as i32; -pub const STATUS_GRAPHICS_INVALID_PRIMARYSURFACE_SIZE: ::NTSTATUS = 0xC01E033Au32 as i32; -pub const STATUS_GRAPHICS_INVALID_VISIBLEREGION_SIZE: ::NTSTATUS = 0xC01E033Bu32 as i32; -pub const STATUS_GRAPHICS_INVALID_STRIDE: ::NTSTATUS = 0xC01E033Cu32 as i32; -pub const STATUS_GRAPHICS_INVALID_PIXELFORMAT: ::NTSTATUS = 0xC01E033Du32 as i32; -pub const STATUS_GRAPHICS_INVALID_COLORBASIS: ::NTSTATUS = 0xC01E033Eu32 as i32; -pub const STATUS_GRAPHICS_INVALID_PIXELVALUEACCESSMODE: ::NTSTATUS = 0xC01E033Fu32 as i32; -pub const STATUS_GRAPHICS_TARGET_NOT_IN_TOPOLOGY: ::NTSTATUS = 0xC01E0340u32 as i32; -pub const STATUS_GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT: ::NTSTATUS = 0xC01E0341u32 as i32; -pub const STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE: ::NTSTATUS = 0xC01E0342u32 as i32; -pub const STATUS_GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN: ::NTSTATUS = 0xC01E0343u32 as i32; -pub const STATUS_GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL: ::NTSTATUS = 0xC01E0344u32 as i32; -pub const STATUS_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION: ::NTSTATUS = 0xC01E0345u32 as i32; -pub const STATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0346u32 as i32; -pub const STATUS_GRAPHICS_INVALID_GAMMA_RAMP: ::NTSTATUS = 0xC01E0347u32 as i32; -pub const STATUS_GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0348u32 as i32; -pub const STATUS_GRAPHICS_MULTISAMPLING_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0349u32 as i32; -pub const STATUS_GRAPHICS_MODE_NOT_IN_MODESET: ::NTSTATUS = 0xC01E034Au32 as i32; -pub const STATUS_GRAPHICS_DATASET_IS_EMPTY: ::NTSTATUS = 0x401E034B; -pub const STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET: ::NTSTATUS = 0x401E034C; -pub const STATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON: ::NTSTATUS = 0xC01E034Du32 as i32; -pub const STATUS_GRAPHICS_INVALID_PATH_CONTENT_TYPE: ::NTSTATUS = 0xC01E034Eu32 as i32; -pub const STATUS_GRAPHICS_INVALID_COPYPROTECTION_TYPE: ::NTSTATUS = 0xC01E034Fu32 as i32; -pub const STATUS_GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS: ::NTSTATUS = 0xC01E0350u32 as i32; -pub const STATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED: ::NTSTATUS = 0x401E0351; -pub const STATUS_GRAPHICS_INVALID_SCANLINE_ORDERING: ::NTSTATUS = 0xC01E0352u32 as i32; -pub const STATUS_GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED: ::NTSTATUS = 0xC01E0353u32 as i32; -pub const STATUS_GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS: ::NTSTATUS = 0xC01E0354u32 as i32; -pub const STATUS_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT: ::NTSTATUS = 0xC01E0355u32 as i32; -pub const STATUS_GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM: ::NTSTATUS = 0xC01E0356u32 as i32; -pub const STATUS_GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN: ::NTSTATUS = 0xC01E0357u32 as i32; -pub const STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT: ::NTSTATUS = 0xC01E0358u32 as i32; -pub const STATUS_GRAPHICS_MAX_NUM_PATHS_REACHED: ::NTSTATUS = 0xC01E0359u32 as i32; -pub const STATUS_GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION: ::NTSTATUS = 0xC01E035Au32 as i32; -pub const STATUS_GRAPHICS_INVALID_CLIENT_TYPE: ::NTSTATUS = 0xC01E035Bu32 as i32; -pub const STATUS_GRAPHICS_CLIENTVIDPN_NOT_SET: ::NTSTATUS = 0xC01E035Cu32 as i32; -pub const STATUS_GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED: ::NTSTATUS = 0xC01E0400u32 as i32; -pub const STATUS_GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0401u32 as i32; -pub const STATUS_GRAPHICS_UNKNOWN_CHILD_STATUS: ::NTSTATUS = 0x401E042F; -pub const STATUS_GRAPHICS_NOT_A_LINKED_ADAPTER: ::NTSTATUS = 0xC01E0430u32 as i32; -pub const STATUS_GRAPHICS_LEADLINK_NOT_ENUMERATED: ::NTSTATUS = 0xC01E0431u32 as i32; -pub const STATUS_GRAPHICS_CHAINLINKS_NOT_ENUMERATED: ::NTSTATUS = 0xC01E0432u32 as i32; -pub const STATUS_GRAPHICS_ADAPTER_CHAIN_NOT_READY: ::NTSTATUS = 0xC01E0433u32 as i32; -pub const STATUS_GRAPHICS_CHAINLINKS_NOT_STARTED: ::NTSTATUS = 0xC01E0434u32 as i32; -pub const STATUS_GRAPHICS_CHAINLINKS_NOT_POWERED_ON: ::NTSTATUS = 0xC01E0435u32 as i32; -pub const STATUS_GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE: ::NTSTATUS = 0xC01E0436u32 as i32; -pub const STATUS_GRAPHICS_LEADLINK_START_DEFERRED: ::NTSTATUS = 0x401E0437; -pub const STATUS_GRAPHICS_NOT_POST_DEVICE_DRIVER: ::NTSTATUS = 0xC01E0438u32 as i32; -pub const STATUS_GRAPHICS_POLLING_TOO_FREQUENTLY: ::NTSTATUS = 0x401E0439; -pub const STATUS_GRAPHICS_START_DEFERRED: ::NTSTATUS = 0x401E043A; -pub const STATUS_GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED: ::NTSTATUS = 0xC01E043Bu32 as i32; -pub const STATUS_GRAPHICS_DEPENDABLE_CHILD_STATUS: ::NTSTATUS = 0x401E043C; -pub const STATUS_GRAPHICS_OPM_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0500u32 as i32; -pub const STATUS_GRAPHICS_COPP_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0501u32 as i32; -pub const STATUS_GRAPHICS_UAB_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0502u32 as i32; -pub const STATUS_GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS: ::NTSTATUS = 0xC01E0503u32 as i32; -pub const STATUS_GRAPHICS_OPM_NO_PROTECTED_OUTPUTS_EXIST: ::NTSTATUS = 0xC01E0505u32 as i32; -pub const STATUS_GRAPHICS_OPM_INTERNAL_ERROR: ::NTSTATUS = 0xC01E050Bu32 as i32; -pub const STATUS_GRAPHICS_OPM_INVALID_HANDLE: ::NTSTATUS = 0xC01E050Cu32 as i32; -pub const STATUS_GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH: ::NTSTATUS = 0xC01E050Eu32 as i32; -pub const STATUS_GRAPHICS_OPM_SPANNING_MODE_ENABLED: ::NTSTATUS = 0xC01E050Fu32 as i32; -pub const STATUS_GRAPHICS_OPM_THEATER_MODE_ENABLED: ::NTSTATUS = 0xC01E0510u32 as i32; -pub const STATUS_GRAPHICS_PVP_HFS_FAILED: ::NTSTATUS = 0xC01E0511u32 as i32; -pub const STATUS_GRAPHICS_OPM_INVALID_SRM: ::NTSTATUS = 0xC01E0512u32 as i32; -pub const STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP: ::NTSTATUS = 0xC01E0513u32 as i32; -pub const STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP: ::NTSTATUS = 0xC01E0514u32 as i32; -pub const STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA: ::NTSTATUS = 0xC01E0515u32 as i32; -pub const STATUS_GRAPHICS_OPM_HDCP_SRM_NEVER_SET: ::NTSTATUS = 0xC01E0516u32 as i32; -pub const STATUS_GRAPHICS_OPM_RESOLUTION_TOO_HIGH: ::NTSTATUS = 0xC01E0517u32 as i32; -pub const STATUS_GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE: ::NTSTATUS = 0xC01E0518u32 as i32; -pub const STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_NO_LONGER_EXISTS: ::NTSTATUS = 0xC01E051Au32 as i32; -pub const STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS: ::NTSTATUS = 0xC01E051Cu32 as i32; -pub const STATUS_GRAPHICS_OPM_INVALID_INFORMATION_REQUEST: ::NTSTATUS = 0xC01E051Du32 as i32; -pub const STATUS_GRAPHICS_OPM_DRIVER_INTERNAL_ERROR: ::NTSTATUS = 0xC01E051Eu32 as i32; -pub const STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS: ::NTSTATUS = 0xC01E051Fu32 as i32; -pub const STATUS_GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0520u32 as i32; -pub const STATUS_GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST: ::NTSTATUS = 0xC01E0521u32 as i32; -pub const STATUS_GRAPHICS_I2C_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0580u32 as i32; -pub const STATUS_GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST: ::NTSTATUS = 0xC01E0581u32 as i32; -pub const STATUS_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA: ::NTSTATUS = 0xC01E0582u32 as i32; -pub const STATUS_GRAPHICS_I2C_ERROR_RECEIVING_DATA: ::NTSTATUS = 0xC01E0583u32 as i32; -pub const STATUS_GRAPHICS_DDCCI_VCP_NOT_SUPPORTED: ::NTSTATUS = 0xC01E0584u32 as i32; -pub const STATUS_GRAPHICS_DDCCI_INVALID_DATA: ::NTSTATUS = 0xC01E0585u32 as i32; -pub const STATUS_GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE: ::NTSTATUS = 0xC01E0586u32 as i32; -pub const STATUS_GRAPHICS_DDCCI_INVALID_CAPABILITIES_STRING: ::NTSTATUS = 0xC01E0587u32 as i32; -pub const STATUS_GRAPHICS_MCA_INTERNAL_ERROR: ::NTSTATUS = 0xC01E0588u32 as i32; -pub const STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND: ::NTSTATUS = 0xC01E0589u32 as i32; -pub const STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH: ::NTSTATUS = 0xC01E058Au32 as i32; -pub const STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM: ::NTSTATUS = 0xC01E058Bu32 as i32; -pub const STATUS_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE: ::NTSTATUS = 0xC01E058Cu32 as i32; -pub const STATUS_GRAPHICS_MONITOR_NO_LONGER_EXISTS: ::NTSTATUS = 0xC01E058Du32 as i32; -pub const STATUS_GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED: ::NTSTATUS = 0xC01E05E0u32 as i32; -pub const STATUS_GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME: ::NTSTATUS = 0xC01E05E1u32 as i32; -pub const STATUS_GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP: ::NTSTATUS = 0xC01E05E2u32 as i32; -pub const STATUS_GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED: ::NTSTATUS = 0xC01E05E3u32 as i32; -pub const STATUS_GRAPHICS_INVALID_POINTER: ::NTSTATUS = 0xC01E05E4u32 as i32; -pub const STATUS_GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE: ::NTSTATUS = 0xC01E05E5u32 as i32; -pub const STATUS_GRAPHICS_PARAMETER_ARRAY_TOO_SMALL: ::NTSTATUS = 0xC01E05E6u32 as i32; -pub const STATUS_GRAPHICS_INTERNAL_ERROR: ::NTSTATUS = 0xC01E05E7u32 as i32; -pub const STATUS_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS: ::NTSTATUS = 0xC01E05E8u32 as i32; -pub const STATUS_FVE_LOCKED_VOLUME: ::NTSTATUS = 0xC0210000u32 as i32; -pub const STATUS_FVE_NOT_ENCRYPTED: ::NTSTATUS = 0xC0210001u32 as i32; -pub const STATUS_FVE_BAD_INFORMATION: ::NTSTATUS = 0xC0210002u32 as i32; -pub const STATUS_FVE_TOO_SMALL: ::NTSTATUS = 0xC0210003u32 as i32; -pub const STATUS_FVE_FAILED_WRONG_FS: ::NTSTATUS = 0xC0210004u32 as i32; -pub const STATUS_FVE_BAD_PARTITION_SIZE: ::NTSTATUS = 0xC0210005u32 as i32; -pub const STATUS_FVE_FS_NOT_EXTENDED: ::NTSTATUS = 0xC0210006u32 as i32; -pub const STATUS_FVE_FS_MOUNTED: ::NTSTATUS = 0xC0210007u32 as i32; -pub const STATUS_FVE_NO_LICENSE: ::NTSTATUS = 0xC0210008u32 as i32; -pub const STATUS_FVE_ACTION_NOT_ALLOWED: ::NTSTATUS = 0xC0210009u32 as i32; -pub const STATUS_FVE_BAD_DATA: ::NTSTATUS = 0xC021000Au32 as i32; -pub const STATUS_FVE_VOLUME_NOT_BOUND: ::NTSTATUS = 0xC021000Bu32 as i32; -pub const STATUS_FVE_NOT_DATA_VOLUME: ::NTSTATUS = 0xC021000Cu32 as i32; -pub const STATUS_FVE_CONV_READ_ERROR: ::NTSTATUS = 0xC021000Du32 as i32; -pub const STATUS_FVE_CONV_WRITE_ERROR: ::NTSTATUS = 0xC021000Eu32 as i32; -pub const STATUS_FVE_OVERLAPPED_UPDATE: ::NTSTATUS = 0xC021000Fu32 as i32; -pub const STATUS_FVE_FAILED_SECTOR_SIZE: ::NTSTATUS = 0xC0210010u32 as i32; -pub const STATUS_FVE_FAILED_AUTHENTICATION: ::NTSTATUS = 0xC0210011u32 as i32; -pub const STATUS_FVE_NOT_OS_VOLUME: ::NTSTATUS = 0xC0210012u32 as i32; -pub const STATUS_FVE_KEYFILE_NOT_FOUND: ::NTSTATUS = 0xC0210013u32 as i32; -pub const STATUS_FVE_KEYFILE_INVALID: ::NTSTATUS = 0xC0210014u32 as i32; -pub const STATUS_FVE_KEYFILE_NO_VMK: ::NTSTATUS = 0xC0210015u32 as i32; -pub const STATUS_FVE_TPM_DISABLED: ::NTSTATUS = 0xC0210016u32 as i32; -pub const STATUS_FVE_TPM_SRK_AUTH_NOT_ZERO: ::NTSTATUS = 0xC0210017u32 as i32; -pub const STATUS_FVE_TPM_INVALID_PCR: ::NTSTATUS = 0xC0210018u32 as i32; -pub const STATUS_FVE_TPM_NO_VMK: ::NTSTATUS = 0xC0210019u32 as i32; -pub const STATUS_FVE_PIN_INVALID: ::NTSTATUS = 0xC021001Au32 as i32; -pub const STATUS_FVE_AUTH_INVALID_APPLICATION: ::NTSTATUS = 0xC021001Bu32 as i32; -pub const STATUS_FVE_AUTH_INVALID_CONFIG: ::NTSTATUS = 0xC021001Cu32 as i32; -pub const STATUS_FVE_DEBUGGER_ENABLED: ::NTSTATUS = 0xC021001Du32 as i32; -pub const STATUS_FVE_DRY_RUN_FAILED: ::NTSTATUS = 0xC021001Eu32 as i32; -pub const STATUS_FVE_BAD_METADATA_POINTER: ::NTSTATUS = 0xC021001Fu32 as i32; -pub const STATUS_FVE_OLD_METADATA_COPY: ::NTSTATUS = 0xC0210020u32 as i32; -pub const STATUS_FVE_REBOOT_REQUIRED: ::NTSTATUS = 0xC0210021u32 as i32; -pub const STATUS_FVE_RAW_ACCESS: ::NTSTATUS = 0xC0210022u32 as i32; -pub const STATUS_FVE_RAW_BLOCKED: ::NTSTATUS = 0xC0210023u32 as i32; -pub const STATUS_FVE_NO_AUTOUNLOCK_MASTER_KEY: ::NTSTATUS = 0xC0210024u32 as i32; -pub const STATUS_FVE_MOR_FAILED: ::NTSTATUS = 0xC0210025u32 as i32; -pub const STATUS_FVE_NO_FEATURE_LICENSE: ::NTSTATUS = 0xC0210026u32 as i32; -pub const STATUS_FVE_POLICY_USER_DISABLE_RDV_NOT_ALLOWED: ::NTSTATUS = 0xC0210027u32 as i32; -pub const STATUS_FVE_CONV_RECOVERY_FAILED: ::NTSTATUS = 0xC0210028u32 as i32; -pub const STATUS_FVE_VIRTUALIZED_SPACE_TOO_BIG: ::NTSTATUS = 0xC0210029u32 as i32; -pub const STATUS_FVE_INVALID_DATUM_TYPE: ::NTSTATUS = 0xC021002Au32 as i32; -pub const STATUS_FVE_VOLUME_TOO_SMALL: ::NTSTATUS = 0xC0210030u32 as i32; -pub const STATUS_FVE_ENH_PIN_INVALID: ::NTSTATUS = 0xC0210031u32 as i32; -pub const STATUS_FVE_FULL_ENCRYPTION_NOT_ALLOWED_ON_TP_STORAGE: ::NTSTATUS = 0xC0210032u32 as i32; -pub const STATUS_FVE_WIPE_NOT_ALLOWED_ON_TP_STORAGE: ::NTSTATUS = 0xC0210033u32 as i32; -pub const STATUS_FVE_NOT_ALLOWED_ON_CSV_STACK: ::NTSTATUS = 0xC0210034u32 as i32; -pub const STATUS_FVE_NOT_ALLOWED_ON_CLUSTER: ::NTSTATUS = 0xC0210035u32 as i32; -pub const STATUS_FVE_NOT_ALLOWED_TO_UPGRADE_WHILE_CONVERTING: ::NTSTATUS = 0xC0210036u32 as i32; -pub const STATUS_FVE_WIPE_CANCEL_NOT_APPLICABLE: ::NTSTATUS = 0xC0210037u32 as i32; -pub const STATUS_FVE_EDRIVE_DRY_RUN_FAILED: ::NTSTATUS = 0xC0210038u32 as i32; -pub const STATUS_FVE_SECUREBOOT_DISABLED: ::NTSTATUS = 0xC0210039u32 as i32; -pub const STATUS_FVE_SECUREBOOT_CONFIG_CHANGE: ::NTSTATUS = 0xC021003Au32 as i32; -pub const STATUS_FVE_DEVICE_LOCKEDOUT: ::NTSTATUS = 0xC021003Bu32 as i32; -pub const STATUS_FVE_VOLUME_EXTEND_PREVENTS_EOW_DECRYPT: ::NTSTATUS = 0xC021003Cu32 as i32; -pub const STATUS_FVE_NOT_DE_VOLUME: ::NTSTATUS = 0xC021003Du32 as i32; -pub const STATUS_FVE_PROTECTION_DISABLED: ::NTSTATUS = 0xC021003Eu32 as i32; -pub const STATUS_FVE_PROTECTION_CANNOT_BE_DISABLED: ::NTSTATUS = 0xC021003Fu32 as i32; -pub const STATUS_FWP_CALLOUT_NOT_FOUND: ::NTSTATUS = 0xC0220001u32 as i32; -pub const STATUS_FWP_CONDITION_NOT_FOUND: ::NTSTATUS = 0xC0220002u32 as i32; -pub const STATUS_FWP_FILTER_NOT_FOUND: ::NTSTATUS = 0xC0220003u32 as i32; -pub const STATUS_FWP_LAYER_NOT_FOUND: ::NTSTATUS = 0xC0220004u32 as i32; -pub const STATUS_FWP_PROVIDER_NOT_FOUND: ::NTSTATUS = 0xC0220005u32 as i32; -pub const STATUS_FWP_PROVIDER_CONTEXT_NOT_FOUND: ::NTSTATUS = 0xC0220006u32 as i32; -pub const STATUS_FWP_SUBLAYER_NOT_FOUND: ::NTSTATUS = 0xC0220007u32 as i32; -pub const STATUS_FWP_NOT_FOUND: ::NTSTATUS = 0xC0220008u32 as i32; -pub const STATUS_FWP_ALREADY_EXISTS: ::NTSTATUS = 0xC0220009u32 as i32; -pub const STATUS_FWP_IN_USE: ::NTSTATUS = 0xC022000Au32 as i32; -pub const STATUS_FWP_DYNAMIC_SESSION_IN_PROGRESS: ::NTSTATUS = 0xC022000Bu32 as i32; -pub const STATUS_FWP_WRONG_SESSION: ::NTSTATUS = 0xC022000Cu32 as i32; -pub const STATUS_FWP_NO_TXN_IN_PROGRESS: ::NTSTATUS = 0xC022000Du32 as i32; -pub const STATUS_FWP_TXN_IN_PROGRESS: ::NTSTATUS = 0xC022000Eu32 as i32; -pub const STATUS_FWP_TXN_ABORTED: ::NTSTATUS = 0xC022000Fu32 as i32; -pub const STATUS_FWP_SESSION_ABORTED: ::NTSTATUS = 0xC0220010u32 as i32; -pub const STATUS_FWP_INCOMPATIBLE_TXN: ::NTSTATUS = 0xC0220011u32 as i32; -pub const STATUS_FWP_TIMEOUT: ::NTSTATUS = 0xC0220012u32 as i32; -pub const STATUS_FWP_NET_EVENTS_DISABLED: ::NTSTATUS = 0xC0220013u32 as i32; -pub const STATUS_FWP_INCOMPATIBLE_LAYER: ::NTSTATUS = 0xC0220014u32 as i32; -pub const STATUS_FWP_KM_CLIENTS_ONLY: ::NTSTATUS = 0xC0220015u32 as i32; -pub const STATUS_FWP_LIFETIME_MISMATCH: ::NTSTATUS = 0xC0220016u32 as i32; -pub const STATUS_FWP_BUILTIN_OBJECT: ::NTSTATUS = 0xC0220017u32 as i32; -pub const STATUS_FWP_TOO_MANY_CALLOUTS: ::NTSTATUS = 0xC0220018u32 as i32; -pub const STATUS_FWP_NOTIFICATION_DROPPED: ::NTSTATUS = 0xC0220019u32 as i32; -pub const STATUS_FWP_TRAFFIC_MISMATCH: ::NTSTATUS = 0xC022001Au32 as i32; -pub const STATUS_FWP_INCOMPATIBLE_SA_STATE: ::NTSTATUS = 0xC022001Bu32 as i32; -pub const STATUS_FWP_NULL_POINTER: ::NTSTATUS = 0xC022001Cu32 as i32; -pub const STATUS_FWP_INVALID_ENUMERATOR: ::NTSTATUS = 0xC022001Du32 as i32; -pub const STATUS_FWP_INVALID_FLAGS: ::NTSTATUS = 0xC022001Eu32 as i32; -pub const STATUS_FWP_INVALID_NET_MASK: ::NTSTATUS = 0xC022001Fu32 as i32; -pub const STATUS_FWP_INVALID_RANGE: ::NTSTATUS = 0xC0220020u32 as i32; -pub const STATUS_FWP_INVALID_INTERVAL: ::NTSTATUS = 0xC0220021u32 as i32; -pub const STATUS_FWP_ZERO_LENGTH_ARRAY: ::NTSTATUS = 0xC0220022u32 as i32; -pub const STATUS_FWP_NULL_DISPLAY_NAME: ::NTSTATUS = 0xC0220023u32 as i32; -pub const STATUS_FWP_INVALID_ACTION_TYPE: ::NTSTATUS = 0xC0220024u32 as i32; -pub const STATUS_FWP_INVALID_WEIGHT: ::NTSTATUS = 0xC0220025u32 as i32; -pub const STATUS_FWP_MATCH_TYPE_MISMATCH: ::NTSTATUS = 0xC0220026u32 as i32; -pub const STATUS_FWP_TYPE_MISMATCH: ::NTSTATUS = 0xC0220027u32 as i32; -pub const STATUS_FWP_OUT_OF_BOUNDS: ::NTSTATUS = 0xC0220028u32 as i32; -pub const STATUS_FWP_RESERVED: ::NTSTATUS = 0xC0220029u32 as i32; -pub const STATUS_FWP_DUPLICATE_CONDITION: ::NTSTATUS = 0xC022002Au32 as i32; -pub const STATUS_FWP_DUPLICATE_KEYMOD: ::NTSTATUS = 0xC022002Bu32 as i32; -pub const STATUS_FWP_ACTION_INCOMPATIBLE_WITH_LAYER: ::NTSTATUS = 0xC022002Cu32 as i32; -pub const STATUS_FWP_ACTION_INCOMPATIBLE_WITH_SUBLAYER: ::NTSTATUS = 0xC022002Du32 as i32; -pub const STATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_LAYER: ::NTSTATUS = 0xC022002Eu32 as i32; -pub const STATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_CALLOUT: ::NTSTATUS = 0xC022002Fu32 as i32; -pub const STATUS_FWP_INCOMPATIBLE_AUTH_METHOD: ::NTSTATUS = 0xC0220030u32 as i32; -pub const STATUS_FWP_INCOMPATIBLE_DH_GROUP: ::NTSTATUS = 0xC0220031u32 as i32; -pub const STATUS_FWP_EM_NOT_SUPPORTED: ::NTSTATUS = 0xC0220032u32 as i32; -pub const STATUS_FWP_NEVER_MATCH: ::NTSTATUS = 0xC0220033u32 as i32; -pub const STATUS_FWP_PROVIDER_CONTEXT_MISMATCH: ::NTSTATUS = 0xC0220034u32 as i32; -pub const STATUS_FWP_INVALID_PARAMETER: ::NTSTATUS = 0xC0220035u32 as i32; -pub const STATUS_FWP_TOO_MANY_SUBLAYERS: ::NTSTATUS = 0xC0220036u32 as i32; -pub const STATUS_FWP_CALLOUT_NOTIFICATION_FAILED: ::NTSTATUS = 0xC0220037u32 as i32; -pub const STATUS_FWP_INVALID_AUTH_TRANSFORM: ::NTSTATUS = 0xC0220038u32 as i32; -pub const STATUS_FWP_INVALID_CIPHER_TRANSFORM: ::NTSTATUS = 0xC0220039u32 as i32; -pub const STATUS_FWP_INCOMPATIBLE_CIPHER_TRANSFORM: ::NTSTATUS = 0xC022003Au32 as i32; -pub const STATUS_FWP_INVALID_TRANSFORM_COMBINATION: ::NTSTATUS = 0xC022003Bu32 as i32; -pub const STATUS_FWP_DUPLICATE_AUTH_METHOD: ::NTSTATUS = 0xC022003Cu32 as i32; -pub const STATUS_FWP_INVALID_TUNNEL_ENDPOINT: ::NTSTATUS = 0xC022003Du32 as i32; -pub const STATUS_FWP_L2_DRIVER_NOT_READY: ::NTSTATUS = 0xC022003Eu32 as i32; -pub const STATUS_FWP_KEY_DICTATOR_ALREADY_REGISTERED: ::NTSTATUS = 0xC022003Fu32 as i32; -pub const STATUS_FWP_KEY_DICTATION_INVALID_KEYING_MATERIAL: ::NTSTATUS = 0xC0220040u32 as i32; -pub const STATUS_FWP_CONNECTIONS_DISABLED: ::NTSTATUS = 0xC0220041u32 as i32; -pub const STATUS_FWP_INVALID_DNS_NAME: ::NTSTATUS = 0xC0220042u32 as i32; -pub const STATUS_FWP_STILL_ON: ::NTSTATUS = 0xC0220043u32 as i32; -pub const STATUS_FWP_IKEEXT_NOT_RUNNING: ::NTSTATUS = 0xC0220044u32 as i32; -pub const STATUS_FWP_TCPIP_NOT_READY: ::NTSTATUS = 0xC0220100u32 as i32; -pub const STATUS_FWP_INJECT_HANDLE_CLOSING: ::NTSTATUS = 0xC0220101u32 as i32; -pub const STATUS_FWP_INJECT_HANDLE_STALE: ::NTSTATUS = 0xC0220102u32 as i32; -pub const STATUS_FWP_CANNOT_PEND: ::NTSTATUS = 0xC0220103u32 as i32; -pub const STATUS_FWP_DROP_NOICMP: ::NTSTATUS = 0xC0220104u32 as i32; -pub const STATUS_NDIS_CLOSING: ::NTSTATUS = 0xC0230002u32 as i32; -pub const STATUS_NDIS_BAD_VERSION: ::NTSTATUS = 0xC0230004u32 as i32; -pub const STATUS_NDIS_BAD_CHARACTERISTICS: ::NTSTATUS = 0xC0230005u32 as i32; -pub const STATUS_NDIS_ADAPTER_NOT_FOUND: ::NTSTATUS = 0xC0230006u32 as i32; -pub const STATUS_NDIS_OPEN_FAILED: ::NTSTATUS = 0xC0230007u32 as i32; -pub const STATUS_NDIS_DEVICE_FAILED: ::NTSTATUS = 0xC0230008u32 as i32; -pub const STATUS_NDIS_MULTICAST_FULL: ::NTSTATUS = 0xC0230009u32 as i32; -pub const STATUS_NDIS_MULTICAST_EXISTS: ::NTSTATUS = 0xC023000Au32 as i32; -pub const STATUS_NDIS_MULTICAST_NOT_FOUND: ::NTSTATUS = 0xC023000Bu32 as i32; -pub const STATUS_NDIS_REQUEST_ABORTED: ::NTSTATUS = 0xC023000Cu32 as i32; -pub const STATUS_NDIS_RESET_IN_PROGRESS: ::NTSTATUS = 0xC023000Du32 as i32; -pub const STATUS_NDIS_NOT_SUPPORTED: ::NTSTATUS = 0xC02300BBu32 as i32; -pub const STATUS_NDIS_INVALID_PACKET: ::NTSTATUS = 0xC023000Fu32 as i32; -pub const STATUS_NDIS_ADAPTER_NOT_READY: ::NTSTATUS = 0xC0230011u32 as i32; -pub const STATUS_NDIS_INVALID_LENGTH: ::NTSTATUS = 0xC0230014u32 as i32; -pub const STATUS_NDIS_INVALID_DATA: ::NTSTATUS = 0xC0230015u32 as i32; -pub const STATUS_NDIS_BUFFER_TOO_SHORT: ::NTSTATUS = 0xC0230016u32 as i32; -pub const STATUS_NDIS_INVALID_OID: ::NTSTATUS = 0xC0230017u32 as i32; -pub const STATUS_NDIS_ADAPTER_REMOVED: ::NTSTATUS = 0xC0230018u32 as i32; -pub const STATUS_NDIS_UNSUPPORTED_MEDIA: ::NTSTATUS = 0xC0230019u32 as i32; -pub const STATUS_NDIS_GROUP_ADDRESS_IN_USE: ::NTSTATUS = 0xC023001Au32 as i32; -pub const STATUS_NDIS_FILE_NOT_FOUND: ::NTSTATUS = 0xC023001Bu32 as i32; -pub const STATUS_NDIS_ERROR_READING_FILE: ::NTSTATUS = 0xC023001Cu32 as i32; -pub const STATUS_NDIS_ALREADY_MAPPED: ::NTSTATUS = 0xC023001Du32 as i32; -pub const STATUS_NDIS_RESOURCE_CONFLICT: ::NTSTATUS = 0xC023001Eu32 as i32; -pub const STATUS_NDIS_MEDIA_DISCONNECTED: ::NTSTATUS = 0xC023001Fu32 as i32; -pub const STATUS_NDIS_INVALID_ADDRESS: ::NTSTATUS = 0xC0230022u32 as i32; -pub const STATUS_NDIS_INVALID_DEVICE_REQUEST: ::NTSTATUS = 0xC0230010u32 as i32; -pub const STATUS_NDIS_PAUSED: ::NTSTATUS = 0xC023002Au32 as i32; -pub const STATUS_NDIS_INTERFACE_NOT_FOUND: ::NTSTATUS = 0xC023002Bu32 as i32; -pub const STATUS_NDIS_UNSUPPORTED_REVISION: ::NTSTATUS = 0xC023002Cu32 as i32; -pub const STATUS_NDIS_INVALID_PORT: ::NTSTATUS = 0xC023002Du32 as i32; -pub const STATUS_NDIS_INVALID_PORT_STATE: ::NTSTATUS = 0xC023002Eu32 as i32; -pub const STATUS_NDIS_LOW_POWER_STATE: ::NTSTATUS = 0xC023002Fu32 as i32; -pub const STATUS_NDIS_REINIT_REQUIRED: ::NTSTATUS = 0xC0230030u32 as i32; -pub const STATUS_NDIS_DOT11_AUTO_CONFIG_ENABLED: ::NTSTATUS = 0xC0232000u32 as i32; -pub const STATUS_NDIS_DOT11_MEDIA_IN_USE: ::NTSTATUS = 0xC0232001u32 as i32; -pub const STATUS_NDIS_DOT11_POWER_STATE_INVALID: ::NTSTATUS = 0xC0232002u32 as i32; -pub const STATUS_NDIS_PM_WOL_PATTERN_LIST_FULL: ::NTSTATUS = 0xC0232003u32 as i32; -pub const STATUS_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL: ::NTSTATUS = 0xC0232004u32 as i32; -pub const STATUS_NDIS_INDICATION_REQUIRED: ::NTSTATUS = 0x40230001; -pub const STATUS_NDIS_OFFLOAD_POLICY: ::NTSTATUS = 0xC023100Fu32 as i32; -pub const STATUS_NDIS_OFFLOAD_CONNECTION_REJECTED: ::NTSTATUS = 0xC0231012u32 as i32; -pub const STATUS_NDIS_OFFLOAD_PATH_REJECTED: ::NTSTATUS = 0xC0231013u32 as i32; -pub const STATUS_TPM_ERROR_MASK: ::NTSTATUS = 0xC0290000u32 as i32; -pub const STATUS_TPM_AUTHFAIL: ::NTSTATUS = 0xC0290001u32 as i32; -pub const STATUS_TPM_BADINDEX: ::NTSTATUS = 0xC0290002u32 as i32; -pub const STATUS_TPM_BAD_PARAMETER: ::NTSTATUS = 0xC0290003u32 as i32; -pub const STATUS_TPM_AUDITFAILURE: ::NTSTATUS = 0xC0290004u32 as i32; -pub const STATUS_TPM_CLEAR_DISABLED: ::NTSTATUS = 0xC0290005u32 as i32; -pub const STATUS_TPM_DEACTIVATED: ::NTSTATUS = 0xC0290006u32 as i32; -pub const STATUS_TPM_DISABLED: ::NTSTATUS = 0xC0290007u32 as i32; -pub const STATUS_TPM_DISABLED_CMD: ::NTSTATUS = 0xC0290008u32 as i32; -pub const STATUS_TPM_FAIL: ::NTSTATUS = 0xC0290009u32 as i32; -pub const STATUS_TPM_BAD_ORDINAL: ::NTSTATUS = 0xC029000Au32 as i32; -pub const STATUS_TPM_INSTALL_DISABLED: ::NTSTATUS = 0xC029000Bu32 as i32; -pub const STATUS_TPM_INVALID_KEYHANDLE: ::NTSTATUS = 0xC029000Cu32 as i32; -pub const STATUS_TPM_KEYNOTFOUND: ::NTSTATUS = 0xC029000Du32 as i32; -pub const STATUS_TPM_INAPPROPRIATE_ENC: ::NTSTATUS = 0xC029000Eu32 as i32; -pub const STATUS_TPM_MIGRATEFAIL: ::NTSTATUS = 0xC029000Fu32 as i32; -pub const STATUS_TPM_INVALID_PCR_INFO: ::NTSTATUS = 0xC0290010u32 as i32; -pub const STATUS_TPM_NOSPACE: ::NTSTATUS = 0xC0290011u32 as i32; -pub const STATUS_TPM_NOSRK: ::NTSTATUS = 0xC0290012u32 as i32; -pub const STATUS_TPM_NOTSEALED_BLOB: ::NTSTATUS = 0xC0290013u32 as i32; -pub const STATUS_TPM_OWNER_SET: ::NTSTATUS = 0xC0290014u32 as i32; -pub const STATUS_TPM_RESOURCES: ::NTSTATUS = 0xC0290015u32 as i32; -pub const STATUS_TPM_SHORTRANDOM: ::NTSTATUS = 0xC0290016u32 as i32; -pub const STATUS_TPM_SIZE: ::NTSTATUS = 0xC0290017u32 as i32; -pub const STATUS_TPM_WRONGPCRVAL: ::NTSTATUS = 0xC0290018u32 as i32; -pub const STATUS_TPM_BAD_PARAM_SIZE: ::NTSTATUS = 0xC0290019u32 as i32; -pub const STATUS_TPM_SHA_THREAD: ::NTSTATUS = 0xC029001Au32 as i32; -pub const STATUS_TPM_SHA_ERROR: ::NTSTATUS = 0xC029001Bu32 as i32; -pub const STATUS_TPM_FAILEDSELFTEST: ::NTSTATUS = 0xC029001Cu32 as i32; -pub const STATUS_TPM_AUTH2FAIL: ::NTSTATUS = 0xC029001Du32 as i32; -pub const STATUS_TPM_BADTAG: ::NTSTATUS = 0xC029001Eu32 as i32; -pub const STATUS_TPM_IOERROR: ::NTSTATUS = 0xC029001Fu32 as i32; -pub const STATUS_TPM_ENCRYPT_ERROR: ::NTSTATUS = 0xC0290020u32 as i32; -pub const STATUS_TPM_DECRYPT_ERROR: ::NTSTATUS = 0xC0290021u32 as i32; -pub const STATUS_TPM_INVALID_AUTHHANDLE: ::NTSTATUS = 0xC0290022u32 as i32; -pub const STATUS_TPM_NO_ENDORSEMENT: ::NTSTATUS = 0xC0290023u32 as i32; -pub const STATUS_TPM_INVALID_KEYUSAGE: ::NTSTATUS = 0xC0290024u32 as i32; -pub const STATUS_TPM_WRONG_ENTITYTYPE: ::NTSTATUS = 0xC0290025u32 as i32; -pub const STATUS_TPM_INVALID_POSTINIT: ::NTSTATUS = 0xC0290026u32 as i32; -pub const STATUS_TPM_INAPPROPRIATE_SIG: ::NTSTATUS = 0xC0290027u32 as i32; -pub const STATUS_TPM_BAD_KEY_PROPERTY: ::NTSTATUS = 0xC0290028u32 as i32; -pub const STATUS_TPM_BAD_MIGRATION: ::NTSTATUS = 0xC0290029u32 as i32; -pub const STATUS_TPM_BAD_SCHEME: ::NTSTATUS = 0xC029002Au32 as i32; -pub const STATUS_TPM_BAD_DATASIZE: ::NTSTATUS = 0xC029002Bu32 as i32; -pub const STATUS_TPM_BAD_MODE: ::NTSTATUS = 0xC029002Cu32 as i32; -pub const STATUS_TPM_BAD_PRESENCE: ::NTSTATUS = 0xC029002Du32 as i32; -pub const STATUS_TPM_BAD_VERSION: ::NTSTATUS = 0xC029002Eu32 as i32; -pub const STATUS_TPM_NO_WRAP_TRANSPORT: ::NTSTATUS = 0xC029002Fu32 as i32; -pub const STATUS_TPM_AUDITFAIL_UNSUCCESSFUL: ::NTSTATUS = 0xC0290030u32 as i32; -pub const STATUS_TPM_AUDITFAIL_SUCCESSFUL: ::NTSTATUS = 0xC0290031u32 as i32; -pub const STATUS_TPM_NOTRESETABLE: ::NTSTATUS = 0xC0290032u32 as i32; -pub const STATUS_TPM_NOTLOCAL: ::NTSTATUS = 0xC0290033u32 as i32; -pub const STATUS_TPM_BAD_TYPE: ::NTSTATUS = 0xC0290034u32 as i32; -pub const STATUS_TPM_INVALID_RESOURCE: ::NTSTATUS = 0xC0290035u32 as i32; -pub const STATUS_TPM_NOTFIPS: ::NTSTATUS = 0xC0290036u32 as i32; -pub const STATUS_TPM_INVALID_FAMILY: ::NTSTATUS = 0xC0290037u32 as i32; -pub const STATUS_TPM_NO_NV_PERMISSION: ::NTSTATUS = 0xC0290038u32 as i32; -pub const STATUS_TPM_REQUIRES_SIGN: ::NTSTATUS = 0xC0290039u32 as i32; -pub const STATUS_TPM_KEY_NOTSUPPORTED: ::NTSTATUS = 0xC029003Au32 as i32; -pub const STATUS_TPM_AUTH_CONFLICT: ::NTSTATUS = 0xC029003Bu32 as i32; -pub const STATUS_TPM_AREA_LOCKED: ::NTSTATUS = 0xC029003Cu32 as i32; -pub const STATUS_TPM_BAD_LOCALITY: ::NTSTATUS = 0xC029003Du32 as i32; -pub const STATUS_TPM_READ_ONLY: ::NTSTATUS = 0xC029003Eu32 as i32; -pub const STATUS_TPM_PER_NOWRITE: ::NTSTATUS = 0xC029003Fu32 as i32; -pub const STATUS_TPM_FAMILYCOUNT: ::NTSTATUS = 0xC0290040u32 as i32; -pub const STATUS_TPM_WRITE_LOCKED: ::NTSTATUS = 0xC0290041u32 as i32; -pub const STATUS_TPM_BAD_ATTRIBUTES: ::NTSTATUS = 0xC0290042u32 as i32; -pub const STATUS_TPM_INVALID_STRUCTURE: ::NTSTATUS = 0xC0290043u32 as i32; -pub const STATUS_TPM_KEY_OWNER_CONTROL: ::NTSTATUS = 0xC0290044u32 as i32; -pub const STATUS_TPM_BAD_COUNTER: ::NTSTATUS = 0xC0290045u32 as i32; -pub const STATUS_TPM_NOT_FULLWRITE: ::NTSTATUS = 0xC0290046u32 as i32; -pub const STATUS_TPM_CONTEXT_GAP: ::NTSTATUS = 0xC0290047u32 as i32; -pub const STATUS_TPM_MAXNVWRITES: ::NTSTATUS = 0xC0290048u32 as i32; -pub const STATUS_TPM_NOOPERATOR: ::NTSTATUS = 0xC0290049u32 as i32; -pub const STATUS_TPM_RESOURCEMISSING: ::NTSTATUS = 0xC029004Au32 as i32; -pub const STATUS_TPM_DELEGATE_LOCK: ::NTSTATUS = 0xC029004Bu32 as i32; -pub const STATUS_TPM_DELEGATE_FAMILY: ::NTSTATUS = 0xC029004Cu32 as i32; -pub const STATUS_TPM_DELEGATE_ADMIN: ::NTSTATUS = 0xC029004Du32 as i32; -pub const STATUS_TPM_TRANSPORT_NOTEXCLUSIVE: ::NTSTATUS = 0xC029004Eu32 as i32; -pub const STATUS_TPM_OWNER_CONTROL: ::NTSTATUS = 0xC029004Fu32 as i32; -pub const STATUS_TPM_DAA_RESOURCES: ::NTSTATUS = 0xC0290050u32 as i32; -pub const STATUS_TPM_DAA_INPUT_DATA0: ::NTSTATUS = 0xC0290051u32 as i32; -pub const STATUS_TPM_DAA_INPUT_DATA1: ::NTSTATUS = 0xC0290052u32 as i32; -pub const STATUS_TPM_DAA_ISSUER_SETTINGS: ::NTSTATUS = 0xC0290053u32 as i32; -pub const STATUS_TPM_DAA_TPM_SETTINGS: ::NTSTATUS = 0xC0290054u32 as i32; -pub const STATUS_TPM_DAA_STAGE: ::NTSTATUS = 0xC0290055u32 as i32; -pub const STATUS_TPM_DAA_ISSUER_VALIDITY: ::NTSTATUS = 0xC0290056u32 as i32; -pub const STATUS_TPM_DAA_WRONG_W: ::NTSTATUS = 0xC0290057u32 as i32; -pub const STATUS_TPM_BAD_HANDLE: ::NTSTATUS = 0xC0290058u32 as i32; -pub const STATUS_TPM_BAD_DELEGATE: ::NTSTATUS = 0xC0290059u32 as i32; -pub const STATUS_TPM_BADCONTEXT: ::NTSTATUS = 0xC029005Au32 as i32; -pub const STATUS_TPM_TOOMANYCONTEXTS: ::NTSTATUS = 0xC029005Bu32 as i32; -pub const STATUS_TPM_MA_TICKET_SIGNATURE: ::NTSTATUS = 0xC029005Cu32 as i32; -pub const STATUS_TPM_MA_DESTINATION: ::NTSTATUS = 0xC029005Du32 as i32; -pub const STATUS_TPM_MA_SOURCE: ::NTSTATUS = 0xC029005Eu32 as i32; -pub const STATUS_TPM_MA_AUTHORITY: ::NTSTATUS = 0xC029005Fu32 as i32; -pub const STATUS_TPM_PERMANENTEK: ::NTSTATUS = 0xC0290061u32 as i32; -pub const STATUS_TPM_BAD_SIGNATURE: ::NTSTATUS = 0xC0290062u32 as i32; -pub const STATUS_TPM_NOCONTEXTSPACE: ::NTSTATUS = 0xC0290063u32 as i32; -pub const STATUS_TPM_COMMAND_BLOCKED: ::NTSTATUS = 0xC0290400u32 as i32; -pub const STATUS_TPM_INVALID_HANDLE: ::NTSTATUS = 0xC0290401u32 as i32; -pub const STATUS_TPM_DUPLICATE_VHANDLE: ::NTSTATUS = 0xC0290402u32 as i32; -pub const STATUS_TPM_EMBEDDED_COMMAND_BLOCKED: ::NTSTATUS = 0xC0290403u32 as i32; -pub const STATUS_TPM_EMBEDDED_COMMAND_UNSUPPORTED: ::NTSTATUS = 0xC0290404u32 as i32; -pub const STATUS_TPM_RETRY: ::NTSTATUS = 0xC0290800u32 as i32; -pub const STATUS_TPM_NEEDS_SELFTEST: ::NTSTATUS = 0xC0290801u32 as i32; -pub const STATUS_TPM_DOING_SELFTEST: ::NTSTATUS = 0xC0290802u32 as i32; -pub const STATUS_TPM_DEFEND_LOCK_RUNNING: ::NTSTATUS = 0xC0290803u32 as i32; -pub const STATUS_TPM_COMMAND_CANCELED: ::NTSTATUS = 0xC0291001u32 as i32; -pub const STATUS_TPM_TOO_MANY_CONTEXTS: ::NTSTATUS = 0xC0291002u32 as i32; -pub const STATUS_TPM_NOT_FOUND: ::NTSTATUS = 0xC0291003u32 as i32; -pub const STATUS_TPM_ACCESS_DENIED: ::NTSTATUS = 0xC0291004u32 as i32; -pub const STATUS_TPM_INSUFFICIENT_BUFFER: ::NTSTATUS = 0xC0291005u32 as i32; -pub const STATUS_TPM_PPI_FUNCTION_UNSUPPORTED: ::NTSTATUS = 0xC0291006u32 as i32; -pub const STATUS_PCP_ERROR_MASK: ::NTSTATUS = 0xC0292000u32 as i32; -pub const STATUS_PCP_DEVICE_NOT_READY: ::NTSTATUS = 0xC0292001u32 as i32; -pub const STATUS_PCP_INVALID_HANDLE: ::NTSTATUS = 0xC0292002u32 as i32; -pub const STATUS_PCP_INVALID_PARAMETER: ::NTSTATUS = 0xC0292003u32 as i32; -pub const STATUS_PCP_FLAG_NOT_SUPPORTED: ::NTSTATUS = 0xC0292004u32 as i32; -pub const STATUS_PCP_NOT_SUPPORTED: ::NTSTATUS = 0xC0292005u32 as i32; -pub const STATUS_PCP_BUFFER_TOO_SMALL: ::NTSTATUS = 0xC0292006u32 as i32; -pub const STATUS_PCP_INTERNAL_ERROR: ::NTSTATUS = 0xC0292007u32 as i32; -pub const STATUS_PCP_AUTHENTICATION_FAILED: ::NTSTATUS = 0xC0292008u32 as i32; -pub const STATUS_PCP_AUTHENTICATION_IGNORED: ::NTSTATUS = 0xC0292009u32 as i32; -pub const STATUS_PCP_POLICY_NOT_FOUND: ::NTSTATUS = 0xC029200Au32 as i32; -pub const STATUS_PCP_PROFILE_NOT_FOUND: ::NTSTATUS = 0xC029200Bu32 as i32; -pub const STATUS_PCP_VALIDATION_FAILED: ::NTSTATUS = 0xC029200Cu32 as i32; -pub const STATUS_PCP_DEVICE_NOT_FOUND: ::NTSTATUS = 0xC029200Du32 as i32; -pub const STATUS_RTPM_CONTEXT_CONTINUE: ::NTSTATUS = 0x00293000; -pub const STATUS_RTPM_CONTEXT_COMPLETE: ::NTSTATUS = 0x00293001; -pub const STATUS_RTPM_NO_RESULT: ::NTSTATUS = 0xC0293002u32 as i32; -pub const STATUS_RTPM_PCR_READ_INCOMPLETE: ::NTSTATUS = 0xC0293003u32 as i32; -pub const STATUS_RTPM_INVALID_CONTEXT: ::NTSTATUS = 0xC0293004u32 as i32; -pub const STATUS_RTPM_UNSUPPORTED_CMD: ::NTSTATUS = 0xC0293005u32 as i32; -pub const STATUS_HV_INVALID_HYPERCALL_CODE: ::NTSTATUS = 0xC0350002u32 as i32; -pub const STATUS_HV_INVALID_HYPERCALL_INPUT: ::NTSTATUS = 0xC0350003u32 as i32; -pub const STATUS_HV_INVALID_ALIGNMENT: ::NTSTATUS = 0xC0350004u32 as i32; -pub const STATUS_HV_INVALID_PARAMETER: ::NTSTATUS = 0xC0350005u32 as i32; -pub const STATUS_HV_ACCESS_DENIED: ::NTSTATUS = 0xC0350006u32 as i32; -pub const STATUS_HV_INVALID_PARTITION_STATE: ::NTSTATUS = 0xC0350007u32 as i32; -pub const STATUS_HV_OPERATION_DENIED: ::NTSTATUS = 0xC0350008u32 as i32; -pub const STATUS_HV_UNKNOWN_PROPERTY: ::NTSTATUS = 0xC0350009u32 as i32; -pub const STATUS_HV_PROPERTY_VALUE_OUT_OF_RANGE: ::NTSTATUS = 0xC035000Au32 as i32; -pub const STATUS_HV_INSUFFICIENT_MEMORY: ::NTSTATUS = 0xC035000Bu32 as i32; -pub const STATUS_HV_PARTITION_TOO_DEEP: ::NTSTATUS = 0xC035000Cu32 as i32; -pub const STATUS_HV_INVALID_PARTITION_ID: ::NTSTATUS = 0xC035000Du32 as i32; -pub const STATUS_HV_INVALID_VP_INDEX: ::NTSTATUS = 0xC035000Eu32 as i32; -pub const STATUS_HV_INVALID_PORT_ID: ::NTSTATUS = 0xC0350011u32 as i32; -pub const STATUS_HV_INVALID_CONNECTION_ID: ::NTSTATUS = 0xC0350012u32 as i32; -pub const STATUS_HV_INSUFFICIENT_BUFFERS: ::NTSTATUS = 0xC0350013u32 as i32; -pub const STATUS_HV_NOT_ACKNOWLEDGED: ::NTSTATUS = 0xC0350014u32 as i32; -pub const STATUS_HV_ACKNOWLEDGED: ::NTSTATUS = 0xC0350016u32 as i32; -pub const STATUS_HV_INVALID_SAVE_RESTORE_STATE: ::NTSTATUS = 0xC0350017u32 as i32; -pub const STATUS_HV_INVALID_SYNIC_STATE: ::NTSTATUS = 0xC0350018u32 as i32; -pub const STATUS_HV_OBJECT_IN_USE: ::NTSTATUS = 0xC0350019u32 as i32; -pub const STATUS_HV_INVALID_PROXIMITY_DOMAIN_INFO: ::NTSTATUS = 0xC035001Au32 as i32; -pub const STATUS_HV_NO_DATA: ::NTSTATUS = 0xC035001Bu32 as i32; -pub const STATUS_HV_INACTIVE: ::NTSTATUS = 0xC035001Cu32 as i32; -pub const STATUS_HV_NO_RESOURCES: ::NTSTATUS = 0xC035001Du32 as i32; -pub const STATUS_HV_FEATURE_UNAVAILABLE: ::NTSTATUS = 0xC035001Eu32 as i32; -pub const STATUS_HV_INSUFFICIENT_BUFFER: ::NTSTATUS = 0xC0350033u32 as i32; -pub const STATUS_HV_INSUFFICIENT_DEVICE_DOMAINS: ::NTSTATUS = 0xC0350038u32 as i32; -pub const STATUS_HV_CPUID_FEATURE_VALIDATION_ERROR: ::NTSTATUS = 0xC035003Cu32 as i32; -pub const STATUS_HV_CPUID_XSAVE_FEATURE_VALIDATION_ERROR: ::NTSTATUS = 0xC035003Du32 as i32; -pub const STATUS_HV_PROCESSOR_STARTUP_TIMEOUT: ::NTSTATUS = 0xC035003Eu32 as i32; -pub const STATUS_HV_SMX_ENABLED: ::NTSTATUS = 0xC035003Fu32 as i32; -pub const STATUS_HV_INVALID_LP_INDEX: ::NTSTATUS = 0xC0350041u32 as i32; -pub const STATUS_HV_INVALID_REGISTER_VALUE: ::NTSTATUS = 0xC0350050u32 as i32; -pub const STATUS_HV_INVALID_VTL_STATE: ::NTSTATUS = 0xC0350051u32 as i32; -pub const STATUS_HV_NX_NOT_DETECTED: ::NTSTATUS = 0xC0350055u32 as i32; -pub const STATUS_HV_INVALID_DEVICE_ID: ::NTSTATUS = 0xC0350057u32 as i32; -pub const STATUS_HV_INVALID_DEVICE_STATE: ::NTSTATUS = 0xC0350058u32 as i32; -pub const STATUS_HV_PENDING_PAGE_REQUESTS: ::NTSTATUS = 0x00350059; -pub const STATUS_HV_PAGE_REQUEST_INVALID: ::NTSTATUS = 0xC0350060u32 as i32; -pub const STATUS_HV_NOT_PRESENT: ::NTSTATUS = 0xC0351000u32 as i32; -pub const STATUS_VID_DUPLICATE_HANDLER: ::NTSTATUS = 0xC0370001u32 as i32; -pub const STATUS_VID_TOO_MANY_HANDLERS: ::NTSTATUS = 0xC0370002u32 as i32; -pub const STATUS_VID_QUEUE_FULL: ::NTSTATUS = 0xC0370003u32 as i32; -pub const STATUS_VID_HANDLER_NOT_PRESENT: ::NTSTATUS = 0xC0370004u32 as i32; -pub const STATUS_VID_INVALID_OBJECT_NAME: ::NTSTATUS = 0xC0370005u32 as i32; -pub const STATUS_VID_PARTITION_NAME_TOO_LONG: ::NTSTATUS = 0xC0370006u32 as i32; -pub const STATUS_VID_MESSAGE_QUEUE_NAME_TOO_LONG: ::NTSTATUS = 0xC0370007u32 as i32; -pub const STATUS_VID_PARTITION_ALREADY_EXISTS: ::NTSTATUS = 0xC0370008u32 as i32; -pub const STATUS_VID_PARTITION_DOES_NOT_EXIST: ::NTSTATUS = 0xC0370009u32 as i32; -pub const STATUS_VID_PARTITION_NAME_NOT_FOUND: ::NTSTATUS = 0xC037000Au32 as i32; -pub const STATUS_VID_MESSAGE_QUEUE_ALREADY_EXISTS: ::NTSTATUS = 0xC037000Bu32 as i32; -pub const STATUS_VID_EXCEEDED_MBP_ENTRY_MAP_LIMIT: ::NTSTATUS = 0xC037000Cu32 as i32; -pub const STATUS_VID_MB_STILL_REFERENCED: ::NTSTATUS = 0xC037000Du32 as i32; -pub const STATUS_VID_CHILD_GPA_PAGE_SET_CORRUPTED: ::NTSTATUS = 0xC037000Eu32 as i32; -pub const STATUS_VID_INVALID_NUMA_SETTINGS: ::NTSTATUS = 0xC037000Fu32 as i32; -pub const STATUS_VID_INVALID_NUMA_NODE_INDEX: ::NTSTATUS = 0xC0370010u32 as i32; -pub const STATUS_VID_NOTIFICATION_QUEUE_ALREADY_ASSOCIATED: ::NTSTATUS = 0xC0370011u32 as i32; -pub const STATUS_VID_INVALID_MEMORY_BLOCK_HANDLE: ::NTSTATUS = 0xC0370012u32 as i32; -pub const STATUS_VID_PAGE_RANGE_OVERFLOW: ::NTSTATUS = 0xC0370013u32 as i32; -pub const STATUS_VID_INVALID_MESSAGE_QUEUE_HANDLE: ::NTSTATUS = 0xC0370014u32 as i32; -pub const STATUS_VID_INVALID_GPA_RANGE_HANDLE: ::NTSTATUS = 0xC0370015u32 as i32; -pub const STATUS_VID_NO_MEMORY_BLOCK_NOTIFICATION_QUEUE: ::NTSTATUS = 0xC0370016u32 as i32; -pub const STATUS_VID_MEMORY_BLOCK_LOCK_COUNT_EXCEEDED: ::NTSTATUS = 0xC0370017u32 as i32; -pub const STATUS_VID_INVALID_PPM_HANDLE: ::NTSTATUS = 0xC0370018u32 as i32; -pub const STATUS_VID_MBPS_ARE_LOCKED: ::NTSTATUS = 0xC0370019u32 as i32; -pub const STATUS_VID_MESSAGE_QUEUE_CLOSED: ::NTSTATUS = 0xC037001Au32 as i32; -pub const STATUS_VID_VIRTUAL_PROCESSOR_LIMIT_EXCEEDED: ::NTSTATUS = 0xC037001Bu32 as i32; -pub const STATUS_VID_STOP_PENDING: ::NTSTATUS = 0xC037001Cu32 as i32; -pub const STATUS_VID_INVALID_PROCESSOR_STATE: ::NTSTATUS = 0xC037001Du32 as i32; -pub const STATUS_VID_EXCEEDED_KM_CONTEXT_COUNT_LIMIT: ::NTSTATUS = 0xC037001Eu32 as i32; -pub const STATUS_VID_KM_INTERFACE_ALREADY_INITIALIZED: ::NTSTATUS = 0xC037001Fu32 as i32; -pub const STATUS_VID_MB_PROPERTY_ALREADY_SET_RESET: ::NTSTATUS = 0xC0370020u32 as i32; -pub const STATUS_VID_MMIO_RANGE_DESTROYED: ::NTSTATUS = 0xC0370021u32 as i32; -pub const STATUS_VID_INVALID_CHILD_GPA_PAGE_SET: ::NTSTATUS = 0xC0370022u32 as i32; -pub const STATUS_VID_RESERVE_PAGE_SET_IS_BEING_USED: ::NTSTATUS = 0xC0370023u32 as i32; -pub const STATUS_VID_RESERVE_PAGE_SET_TOO_SMALL: ::NTSTATUS = 0xC0370024u32 as i32; -pub const STATUS_VID_MBP_ALREADY_LOCKED_USING_RESERVED_PAGE: ::NTSTATUS = 0xC0370025u32 as i32; -pub const STATUS_VID_MBP_COUNT_EXCEEDED_LIMIT: ::NTSTATUS = 0xC0370026u32 as i32; -pub const STATUS_VID_SAVED_STATE_CORRUPT: ::NTSTATUS = 0xC0370027u32 as i32; -pub const STATUS_VID_SAVED_STATE_UNRECOGNIZED_ITEM: ::NTSTATUS = 0xC0370028u32 as i32; -pub const STATUS_VID_SAVED_STATE_INCOMPATIBLE: ::NTSTATUS = 0xC0370029u32 as i32; -pub const STATUS_VID_REMOTE_NODE_PARENT_GPA_PAGES_USED: ::NTSTATUS = 0x80370001u32 as i32; -pub const STATUS_IPSEC_BAD_SPI: ::NTSTATUS = 0xC0360001u32 as i32; -pub const STATUS_IPSEC_SA_LIFETIME_EXPIRED: ::NTSTATUS = 0xC0360002u32 as i32; -pub const STATUS_IPSEC_WRONG_SA: ::NTSTATUS = 0xC0360003u32 as i32; -pub const STATUS_IPSEC_REPLAY_CHECK_FAILED: ::NTSTATUS = 0xC0360004u32 as i32; -pub const STATUS_IPSEC_INVALID_PACKET: ::NTSTATUS = 0xC0360005u32 as i32; -pub const STATUS_IPSEC_INTEGRITY_CHECK_FAILED: ::NTSTATUS = 0xC0360006u32 as i32; -pub const STATUS_IPSEC_CLEAR_TEXT_DROP: ::NTSTATUS = 0xC0360007u32 as i32; -pub const STATUS_IPSEC_AUTH_FIREWALL_DROP: ::NTSTATUS = 0xC0360008u32 as i32; -pub const STATUS_IPSEC_THROTTLE_DROP: ::NTSTATUS = 0xC0360009u32 as i32; -pub const STATUS_IPSEC_DOSP_BLOCK: ::NTSTATUS = 0xC0368000u32 as i32; -pub const STATUS_IPSEC_DOSP_RECEIVED_MULTICAST: ::NTSTATUS = 0xC0368001u32 as i32; -pub const STATUS_IPSEC_DOSP_INVALID_PACKET: ::NTSTATUS = 0xC0368002u32 as i32; -pub const STATUS_IPSEC_DOSP_STATE_LOOKUP_FAILED: ::NTSTATUS = 0xC0368003u32 as i32; -pub const STATUS_IPSEC_DOSP_MAX_ENTRIES: ::NTSTATUS = 0xC0368004u32 as i32; -pub const STATUS_IPSEC_DOSP_KEYMOD_NOT_ALLOWED: ::NTSTATUS = 0xC0368005u32 as i32; -pub const STATUS_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES: ::NTSTATUS = 0xC0368006u32 as i32; -pub const STATUS_VOLMGR_INCOMPLETE_REGENERATION: ::NTSTATUS = 0x80380001u32 as i32; -pub const STATUS_VOLMGR_INCOMPLETE_DISK_MIGRATION: ::NTSTATUS = 0x80380002u32 as i32; -pub const STATUS_VOLMGR_DATABASE_FULL: ::NTSTATUS = 0xC0380001u32 as i32; -pub const STATUS_VOLMGR_DISK_CONFIGURATION_CORRUPTED: ::NTSTATUS = 0xC0380002u32 as i32; -pub const STATUS_VOLMGR_DISK_CONFIGURATION_NOT_IN_SYNC: ::NTSTATUS = 0xC0380003u32 as i32; -pub const STATUS_VOLMGR_PACK_CONFIG_UPDATE_FAILED: ::NTSTATUS = 0xC0380004u32 as i32; -pub const STATUS_VOLMGR_DISK_CONTAINS_NON_SIMPLE_VOLUME: ::NTSTATUS = 0xC0380005u32 as i32; -pub const STATUS_VOLMGR_DISK_DUPLICATE: ::NTSTATUS = 0xC0380006u32 as i32; -pub const STATUS_VOLMGR_DISK_DYNAMIC: ::NTSTATUS = 0xC0380007u32 as i32; -pub const STATUS_VOLMGR_DISK_ID_INVALID: ::NTSTATUS = 0xC0380008u32 as i32; -pub const STATUS_VOLMGR_DISK_INVALID: ::NTSTATUS = 0xC0380009u32 as i32; -pub const STATUS_VOLMGR_DISK_LAST_VOTER: ::NTSTATUS = 0xC038000Au32 as i32; -pub const STATUS_VOLMGR_DISK_LAYOUT_INVALID: ::NTSTATUS = 0xC038000Bu32 as i32; -pub const STATUS_VOLMGR_DISK_LAYOUT_NON_BASIC_BETWEEN_BASIC_PARTITIONS: ::NTSTATUS = 0xC038000Cu32 as i32; -pub const STATUS_VOLMGR_DISK_LAYOUT_NOT_CYLINDER_ALIGNED: ::NTSTATUS = 0xC038000Du32 as i32; -pub const STATUS_VOLMGR_DISK_LAYOUT_PARTITIONS_TOO_SMALL: ::NTSTATUS = 0xC038000Eu32 as i32; -pub const STATUS_VOLMGR_DISK_LAYOUT_PRIMARY_BETWEEN_LOGICAL_PARTITIONS: ::NTSTATUS = 0xC038000Fu32 as i32; -pub const STATUS_VOLMGR_DISK_LAYOUT_TOO_MANY_PARTITIONS: ::NTSTATUS = 0xC0380010u32 as i32; -pub const STATUS_VOLMGR_DISK_MISSING: ::NTSTATUS = 0xC0380011u32 as i32; -pub const STATUS_VOLMGR_DISK_NOT_EMPTY: ::NTSTATUS = 0xC0380012u32 as i32; -pub const STATUS_VOLMGR_DISK_NOT_ENOUGH_SPACE: ::NTSTATUS = 0xC0380013u32 as i32; -pub const STATUS_VOLMGR_DISK_REVECTORING_FAILED: ::NTSTATUS = 0xC0380014u32 as i32; -pub const STATUS_VOLMGR_DISK_SECTOR_SIZE_INVALID: ::NTSTATUS = 0xC0380015u32 as i32; -pub const STATUS_VOLMGR_DISK_SET_NOT_CONTAINED: ::NTSTATUS = 0xC0380016u32 as i32; -pub const STATUS_VOLMGR_DISK_USED_BY_MULTIPLE_MEMBERS: ::NTSTATUS = 0xC0380017u32 as i32; -pub const STATUS_VOLMGR_DISK_USED_BY_MULTIPLE_PLEXES: ::NTSTATUS = 0xC0380018u32 as i32; -pub const STATUS_VOLMGR_DYNAMIC_DISK_NOT_SUPPORTED: ::NTSTATUS = 0xC0380019u32 as i32; -pub const STATUS_VOLMGR_EXTENT_ALREADY_USED: ::NTSTATUS = 0xC038001Au32 as i32; -pub const STATUS_VOLMGR_EXTENT_NOT_CONTIGUOUS: ::NTSTATUS = 0xC038001Bu32 as i32; -pub const STATUS_VOLMGR_EXTENT_NOT_IN_PUBLIC_REGION: ::NTSTATUS = 0xC038001Cu32 as i32; -pub const STATUS_VOLMGR_EXTENT_NOT_SECTOR_ALIGNED: ::NTSTATUS = 0xC038001Du32 as i32; -pub const STATUS_VOLMGR_EXTENT_OVERLAPS_EBR_PARTITION: ::NTSTATUS = 0xC038001Eu32 as i32; -pub const STATUS_VOLMGR_EXTENT_VOLUME_LENGTHS_DO_NOT_MATCH: ::NTSTATUS = 0xC038001Fu32 as i32; -pub const STATUS_VOLMGR_FAULT_TOLERANT_NOT_SUPPORTED: ::NTSTATUS = 0xC0380020u32 as i32; -pub const STATUS_VOLMGR_INTERLEAVE_LENGTH_INVALID: ::NTSTATUS = 0xC0380021u32 as i32; -pub const STATUS_VOLMGR_MAXIMUM_REGISTERED_USERS: ::NTSTATUS = 0xC0380022u32 as i32; -pub const STATUS_VOLMGR_MEMBER_IN_SYNC: ::NTSTATUS = 0xC0380023u32 as i32; -pub const STATUS_VOLMGR_MEMBER_INDEX_DUPLICATE: ::NTSTATUS = 0xC0380024u32 as i32; -pub const STATUS_VOLMGR_MEMBER_INDEX_INVALID: ::NTSTATUS = 0xC0380025u32 as i32; -pub const STATUS_VOLMGR_MEMBER_MISSING: ::NTSTATUS = 0xC0380026u32 as i32; -pub const STATUS_VOLMGR_MEMBER_NOT_DETACHED: ::NTSTATUS = 0xC0380027u32 as i32; -pub const STATUS_VOLMGR_MEMBER_REGENERATING: ::NTSTATUS = 0xC0380028u32 as i32; -pub const STATUS_VOLMGR_ALL_DISKS_FAILED: ::NTSTATUS = 0xC0380029u32 as i32; -pub const STATUS_VOLMGR_NO_REGISTERED_USERS: ::NTSTATUS = 0xC038002Au32 as i32; -pub const STATUS_VOLMGR_NO_SUCH_USER: ::NTSTATUS = 0xC038002Bu32 as i32; -pub const STATUS_VOLMGR_NOTIFICATION_RESET: ::NTSTATUS = 0xC038002Cu32 as i32; -pub const STATUS_VOLMGR_NUMBER_OF_MEMBERS_INVALID: ::NTSTATUS = 0xC038002Du32 as i32; -pub const STATUS_VOLMGR_NUMBER_OF_PLEXES_INVALID: ::NTSTATUS = 0xC038002Eu32 as i32; -pub const STATUS_VOLMGR_PACK_DUPLICATE: ::NTSTATUS = 0xC038002Fu32 as i32; -pub const STATUS_VOLMGR_PACK_ID_INVALID: ::NTSTATUS = 0xC0380030u32 as i32; -pub const STATUS_VOLMGR_PACK_INVALID: ::NTSTATUS = 0xC0380031u32 as i32; -pub const STATUS_VOLMGR_PACK_NAME_INVALID: ::NTSTATUS = 0xC0380032u32 as i32; -pub const STATUS_VOLMGR_PACK_OFFLINE: ::NTSTATUS = 0xC0380033u32 as i32; -pub const STATUS_VOLMGR_PACK_HAS_QUORUM: ::NTSTATUS = 0xC0380034u32 as i32; -pub const STATUS_VOLMGR_PACK_WITHOUT_QUORUM: ::NTSTATUS = 0xC0380035u32 as i32; -pub const STATUS_VOLMGR_PARTITION_STYLE_INVALID: ::NTSTATUS = 0xC0380036u32 as i32; -pub const STATUS_VOLMGR_PARTITION_UPDATE_FAILED: ::NTSTATUS = 0xC0380037u32 as i32; -pub const STATUS_VOLMGR_PLEX_IN_SYNC: ::NTSTATUS = 0xC0380038u32 as i32; -pub const STATUS_VOLMGR_PLEX_INDEX_DUPLICATE: ::NTSTATUS = 0xC0380039u32 as i32; -pub const STATUS_VOLMGR_PLEX_INDEX_INVALID: ::NTSTATUS = 0xC038003Au32 as i32; -pub const STATUS_VOLMGR_PLEX_LAST_ACTIVE: ::NTSTATUS = 0xC038003Bu32 as i32; -pub const STATUS_VOLMGR_PLEX_MISSING: ::NTSTATUS = 0xC038003Cu32 as i32; -pub const STATUS_VOLMGR_PLEX_REGENERATING: ::NTSTATUS = 0xC038003Du32 as i32; -pub const STATUS_VOLMGR_PLEX_TYPE_INVALID: ::NTSTATUS = 0xC038003Eu32 as i32; -pub const STATUS_VOLMGR_PLEX_NOT_RAID5: ::NTSTATUS = 0xC038003Fu32 as i32; -pub const STATUS_VOLMGR_PLEX_NOT_SIMPLE: ::NTSTATUS = 0xC0380040u32 as i32; -pub const STATUS_VOLMGR_STRUCTURE_SIZE_INVALID: ::NTSTATUS = 0xC0380041u32 as i32; -pub const STATUS_VOLMGR_TOO_MANY_NOTIFICATION_REQUESTS: ::NTSTATUS = 0xC0380042u32 as i32; -pub const STATUS_VOLMGR_TRANSACTION_IN_PROGRESS: ::NTSTATUS = 0xC0380043u32 as i32; -pub const STATUS_VOLMGR_UNEXPECTED_DISK_LAYOUT_CHANGE: ::NTSTATUS = 0xC0380044u32 as i32; -pub const STATUS_VOLMGR_VOLUME_CONTAINS_MISSING_DISK: ::NTSTATUS = 0xC0380045u32 as i32; -pub const STATUS_VOLMGR_VOLUME_ID_INVALID: ::NTSTATUS = 0xC0380046u32 as i32; -pub const STATUS_VOLMGR_VOLUME_LENGTH_INVALID: ::NTSTATUS = 0xC0380047u32 as i32; -pub const STATUS_VOLMGR_VOLUME_LENGTH_NOT_SECTOR_SIZE_MULTIPLE: ::NTSTATUS = 0xC0380048u32 as i32; -pub const STATUS_VOLMGR_VOLUME_NOT_MIRRORED: ::NTSTATUS = 0xC0380049u32 as i32; -pub const STATUS_VOLMGR_VOLUME_NOT_RETAINED: ::NTSTATUS = 0xC038004Au32 as i32; -pub const STATUS_VOLMGR_VOLUME_OFFLINE: ::NTSTATUS = 0xC038004Bu32 as i32; -pub const STATUS_VOLMGR_VOLUME_RETAINED: ::NTSTATUS = 0xC038004Cu32 as i32; -pub const STATUS_VOLMGR_NUMBER_OF_EXTENTS_INVALID: ::NTSTATUS = 0xC038004Du32 as i32; -pub const STATUS_VOLMGR_DIFFERENT_SECTOR_SIZE: ::NTSTATUS = 0xC038004Eu32 as i32; -pub const STATUS_VOLMGR_BAD_BOOT_DISK: ::NTSTATUS = 0xC038004Fu32 as i32; -pub const STATUS_VOLMGR_PACK_CONFIG_OFFLINE: ::NTSTATUS = 0xC0380050u32 as i32; -pub const STATUS_VOLMGR_PACK_CONFIG_ONLINE: ::NTSTATUS = 0xC0380051u32 as i32; -pub const STATUS_VOLMGR_NOT_PRIMARY_PACK: ::NTSTATUS = 0xC0380052u32 as i32; -pub const STATUS_VOLMGR_PACK_LOG_UPDATE_FAILED: ::NTSTATUS = 0xC0380053u32 as i32; -pub const STATUS_VOLMGR_NUMBER_OF_DISKS_IN_PLEX_INVALID: ::NTSTATUS = 0xC0380054u32 as i32; -pub const STATUS_VOLMGR_NUMBER_OF_DISKS_IN_MEMBER_INVALID: ::NTSTATUS = 0xC0380055u32 as i32; -pub const STATUS_VOLMGR_VOLUME_MIRRORED: ::NTSTATUS = 0xC0380056u32 as i32; -pub const STATUS_VOLMGR_PLEX_NOT_SIMPLE_SPANNED: ::NTSTATUS = 0xC0380057u32 as i32; -pub const STATUS_VOLMGR_NO_VALID_LOG_COPIES: ::NTSTATUS = 0xC0380058u32 as i32; -pub const STATUS_VOLMGR_PRIMARY_PACK_PRESENT: ::NTSTATUS = 0xC0380059u32 as i32; -pub const STATUS_VOLMGR_NUMBER_OF_DISKS_INVALID: ::NTSTATUS = 0xC038005Au32 as i32; -pub const STATUS_VOLMGR_MIRROR_NOT_SUPPORTED: ::NTSTATUS = 0xC038005Bu32 as i32; -pub const STATUS_VOLMGR_RAID5_NOT_SUPPORTED: ::NTSTATUS = 0xC038005Cu32 as i32; -pub const STATUS_BCD_NOT_ALL_ENTRIES_IMPORTED: ::NTSTATUS = 0x80390001u32 as i32; -pub const STATUS_BCD_TOO_MANY_ELEMENTS: ::NTSTATUS = 0xC0390002u32 as i32; -pub const STATUS_BCD_NOT_ALL_ENTRIES_SYNCHRONIZED: ::NTSTATUS = 0x80390003u32 as i32; -pub const STATUS_VHD_DRIVE_FOOTER_MISSING: ::NTSTATUS = 0xC03A0001u32 as i32; -pub const STATUS_VHD_DRIVE_FOOTER_CHECKSUM_MISMATCH: ::NTSTATUS = 0xC03A0002u32 as i32; -pub const STATUS_VHD_DRIVE_FOOTER_CORRUPT: ::NTSTATUS = 0xC03A0003u32 as i32; -pub const STATUS_VHD_FORMAT_UNKNOWN: ::NTSTATUS = 0xC03A0004u32 as i32; -pub const STATUS_VHD_FORMAT_UNSUPPORTED_VERSION: ::NTSTATUS = 0xC03A0005u32 as i32; -pub const STATUS_VHD_SPARSE_HEADER_CHECKSUM_MISMATCH: ::NTSTATUS = 0xC03A0006u32 as i32; -pub const STATUS_VHD_SPARSE_HEADER_UNSUPPORTED_VERSION: ::NTSTATUS = 0xC03A0007u32 as i32; -pub const STATUS_VHD_SPARSE_HEADER_CORRUPT: ::NTSTATUS = 0xC03A0008u32 as i32; -pub const STATUS_VHD_BLOCK_ALLOCATION_FAILURE: ::NTSTATUS = 0xC03A0009u32 as i32; -pub const STATUS_VHD_BLOCK_ALLOCATION_TABLE_CORRUPT: ::NTSTATUS = 0xC03A000Au32 as i32; -pub const STATUS_VHD_INVALID_BLOCK_SIZE: ::NTSTATUS = 0xC03A000Bu32 as i32; -pub const STATUS_VHD_BITMAP_MISMATCH: ::NTSTATUS = 0xC03A000Cu32 as i32; -pub const STATUS_VHD_PARENT_VHD_NOT_FOUND: ::NTSTATUS = 0xC03A000Du32 as i32; -pub const STATUS_VHD_CHILD_PARENT_ID_MISMATCH: ::NTSTATUS = 0xC03A000Eu32 as i32; -pub const STATUS_VHD_CHILD_PARENT_TIMESTAMP_MISMATCH: ::NTSTATUS = 0xC03A000Fu32 as i32; -pub const STATUS_VHD_METADATA_READ_FAILURE: ::NTSTATUS = 0xC03A0010u32 as i32; -pub const STATUS_VHD_METADATA_WRITE_FAILURE: ::NTSTATUS = 0xC03A0011u32 as i32; -pub const STATUS_VHD_INVALID_SIZE: ::NTSTATUS = 0xC03A0012u32 as i32; -pub const STATUS_VHD_INVALID_FILE_SIZE: ::NTSTATUS = 0xC03A0013u32 as i32; -pub const STATUS_VIRTDISK_PROVIDER_NOT_FOUND: ::NTSTATUS = 0xC03A0014u32 as i32; -pub const STATUS_VIRTDISK_NOT_VIRTUAL_DISK: ::NTSTATUS = 0xC03A0015u32 as i32; -pub const STATUS_VHD_PARENT_VHD_ACCESS_DENIED: ::NTSTATUS = 0xC03A0016u32 as i32; -pub const STATUS_VHD_CHILD_PARENT_SIZE_MISMATCH: ::NTSTATUS = 0xC03A0017u32 as i32; -pub const STATUS_VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED: ::NTSTATUS = 0xC03A0018u32 as i32; -pub const STATUS_VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT: ::NTSTATUS = 0xC03A0019u32 as i32; -pub const STATUS_VIRTUAL_DISK_LIMITATION: ::NTSTATUS = 0xC03A001Au32 as i32; -pub const STATUS_VHD_INVALID_TYPE: ::NTSTATUS = 0xC03A001Bu32 as i32; -pub const STATUS_VHD_INVALID_STATE: ::NTSTATUS = 0xC03A001Cu32 as i32; -pub const STATUS_VIRTDISK_UNSUPPORTED_DISK_SECTOR_SIZE: ::NTSTATUS = 0xC03A001Du32 as i32; -pub const STATUS_VIRTDISK_DISK_ALREADY_OWNED: ::NTSTATUS = 0xC03A001Eu32 as i32; -pub const STATUS_VIRTDISK_DISK_ONLINE_AND_WRITABLE: ::NTSTATUS = 0xC03A001Fu32 as i32; -pub const STATUS_CTLOG_TRACKING_NOT_INITIALIZED: ::NTSTATUS = 0xC03A0020u32 as i32; -pub const STATUS_CTLOG_LOGFILE_SIZE_EXCEEDED_MAXSIZE: ::NTSTATUS = 0xC03A0021u32 as i32; -pub const STATUS_CTLOG_VHD_CHANGED_OFFLINE: ::NTSTATUS = 0xC03A0022u32 as i32; -pub const STATUS_CTLOG_INVALID_TRACKING_STATE: ::NTSTATUS = 0xC03A0023u32 as i32; -pub const STATUS_CTLOG_INCONSISTENT_TRACKING_FILE: ::NTSTATUS = 0xC03A0024u32 as i32; -pub const STATUS_VHD_METADATA_FULL: ::NTSTATUS = 0xC03A0028u32 as i32; -pub const STATUS_VHD_INVALID_CHANGE_TRACKING_ID: ::NTSTATUS = 0xC03A0029u32 as i32; -pub const STATUS_VHD_CHANGE_TRACKING_DISABLED: ::NTSTATUS = 0xC03A002Au32 as i32; -pub const STATUS_VHD_MISSING_CHANGE_TRACKING_INFORMATION: ::NTSTATUS = 0xC03A0030u32 as i32; -pub const STATUS_VHD_RESIZE_WOULD_TRUNCATE_DATA: ::NTSTATUS = 0xC03A0031u32 as i32; -pub const STATUS_VHD_COULD_NOT_COMPUTE_MINIMUM_VIRTUAL_SIZE: ::NTSTATUS = 0xC03A0032u32 as i32; -pub const STATUS_VHD_ALREADY_AT_OR_BELOW_MINIMUM_VIRTUAL_SIZE: ::NTSTATUS = 0xC03A0033u32 as i32; -pub const STATUS_QUERY_STORAGE_ERROR: ::NTSTATUS = 0x803A0001u32 as i32; -pub const STATUS_RKF_KEY_NOT_FOUND: ::NTSTATUS = 0xC0400001u32 as i32; -pub const STATUS_RKF_DUPLICATE_KEY: ::NTSTATUS = 0xC0400002u32 as i32; -pub const STATUS_RKF_BLOB_FULL: ::NTSTATUS = 0xC0400003u32 as i32; -pub const STATUS_RKF_STORE_FULL: ::NTSTATUS = 0xC0400004u32 as i32; -pub const STATUS_RKF_FILE_BLOCKED: ::NTSTATUS = 0xC0400005u32 as i32; -pub const STATUS_RKF_ACTIVE_KEY: ::NTSTATUS = 0xC0400006u32 as i32; -pub const STATUS_RDBSS_RESTART_OPERATION: ::NTSTATUS = 0xC0410001u32 as i32; -pub const STATUS_RDBSS_CONTINUE_OPERATION: ::NTSTATUS = 0xC0410002u32 as i32; -pub const STATUS_RDBSS_POST_OPERATION: ::NTSTATUS = 0xC0410003u32 as i32; -pub const STATUS_BTH_ATT_INVALID_HANDLE: ::NTSTATUS = 0xC0420001u32 as i32; -pub const STATUS_BTH_ATT_READ_NOT_PERMITTED: ::NTSTATUS = 0xC0420002u32 as i32; -pub const STATUS_BTH_ATT_WRITE_NOT_PERMITTED: ::NTSTATUS = 0xC0420003u32 as i32; -pub const STATUS_BTH_ATT_INVALID_PDU: ::NTSTATUS = 0xC0420004u32 as i32; -pub const STATUS_BTH_ATT_INSUFFICIENT_AUTHENTICATION: ::NTSTATUS = 0xC0420005u32 as i32; -pub const STATUS_BTH_ATT_REQUEST_NOT_SUPPORTED: ::NTSTATUS = 0xC0420006u32 as i32; -pub const STATUS_BTH_ATT_INVALID_OFFSET: ::NTSTATUS = 0xC0420007u32 as i32; -pub const STATUS_BTH_ATT_INSUFFICIENT_AUTHORIZATION: ::NTSTATUS = 0xC0420008u32 as i32; -pub const STATUS_BTH_ATT_PREPARE_QUEUE_FULL: ::NTSTATUS = 0xC0420009u32 as i32; -pub const STATUS_BTH_ATT_ATTRIBUTE_NOT_FOUND: ::NTSTATUS = 0xC042000Au32 as i32; -pub const STATUS_BTH_ATT_ATTRIBUTE_NOT_LONG: ::NTSTATUS = 0xC042000Bu32 as i32; -pub const STATUS_BTH_ATT_INSUFFICIENT_ENCRYPTION_KEY_SIZE: ::NTSTATUS = 0xC042000Cu32 as i32; -pub const STATUS_BTH_ATT_INVALID_ATTRIBUTE_VALUE_LENGTH: ::NTSTATUS = 0xC042000Du32 as i32; -pub const STATUS_BTH_ATT_UNLIKELY: ::NTSTATUS = 0xC042000Eu32 as i32; -pub const STATUS_BTH_ATT_INSUFFICIENT_ENCRYPTION: ::NTSTATUS = 0xC042000Fu32 as i32; -pub const STATUS_BTH_ATT_UNSUPPORTED_GROUP_TYPE: ::NTSTATUS = 0xC0420010u32 as i32; -pub const STATUS_BTH_ATT_INSUFFICIENT_RESOURCES: ::NTSTATUS = 0xC0420011u32 as i32; -pub const STATUS_BTH_ATT_UNKNOWN_ERROR: ::NTSTATUS = 0xC0421000u32 as i32; -pub const STATUS_SECUREBOOT_ROLLBACK_DETECTED: ::NTSTATUS = 0xC0430001u32 as i32; -pub const STATUS_SECUREBOOT_POLICY_VIOLATION: ::NTSTATUS = 0xC0430002u32 as i32; -pub const STATUS_SECUREBOOT_INVALID_POLICY: ::NTSTATUS = 0xC0430003u32 as i32; -pub const STATUS_SECUREBOOT_POLICY_PUBLISHER_NOT_FOUND: ::NTSTATUS = 0xC0430004u32 as i32; -pub const STATUS_SECUREBOOT_POLICY_NOT_SIGNED: ::NTSTATUS = 0xC0430005u32 as i32; -pub const STATUS_SECUREBOOT_NOT_ENABLED: ::NTSTATUS = 0x80430006u32 as i32; -pub const STATUS_SECUREBOOT_FILE_REPLACED: ::NTSTATUS = 0xC0430007u32 as i32; -pub const STATUS_SYSTEM_INTEGRITY_ROLLBACK_DETECTED: ::NTSTATUS = 0xC0E90001u32 as i32; -pub const STATUS_SYSTEM_INTEGRITY_POLICY_VIOLATION: ::NTSTATUS = 0xC0E90002u32 as i32; -pub const STATUS_SYSTEM_INTEGRITY_INVALID_POLICY: ::NTSTATUS = 0xC0E90003u32 as i32; -pub const STATUS_SYSTEM_INTEGRITY_POLICY_NOT_SIGNED: ::NTSTATUS = 0xC0E90004u32 as i32; -pub const STATUS_NO_APPLICABLE_APP_LICENSES_FOUND: ::NTSTATUS = 0xC0EA0001u32 as i32; -pub const STATUS_AUDIO_ENGINE_NODE_NOT_FOUND: ::NTSTATUS = 0xC0440001u32 as i32; -pub const STATUS_HDAUDIO_EMPTY_CONNECTION_LIST: ::NTSTATUS = 0xC0440002u32 as i32; -pub const STATUS_HDAUDIO_CONNECTION_LIST_NOT_SUPPORTED: ::NTSTATUS = 0xC0440003u32 as i32; -pub const STATUS_HDAUDIO_NO_LOGICAL_DEVICES_CREATED: ::NTSTATUS = 0xC0440004u32 as i32; -pub const STATUS_HDAUDIO_NULL_LINKED_LIST_ENTRY: ::NTSTATUS = 0xC0440005u32 as i32; -pub const STATUS_SPACES_RESILIENCY_TYPE_INVALID: ::NTSTATUS = 0xC0E70003u32 as i32; -pub const STATUS_SPACES_DRIVE_SECTOR_SIZE_INVALID: ::NTSTATUS = 0xC0E70004u32 as i32; -pub const STATUS_SPACES_DRIVE_REDUNDANCY_INVALID: ::NTSTATUS = 0xC0E70006u32 as i32; -pub const STATUS_SPACES_NUMBER_OF_DATA_COPIES_INVALID: ::NTSTATUS = 0xC0E70007u32 as i32; -pub const STATUS_SPACES_INTERLEAVE_LENGTH_INVALID: ::NTSTATUS = 0xC0E70009u32 as i32; -pub const STATUS_SPACES_NUMBER_OF_COLUMNS_INVALID: ::NTSTATUS = 0xC0E7000Au32 as i32; -pub const STATUS_SPACES_NOT_ENOUGH_DRIVES: ::NTSTATUS = 0xC0E7000Bu32 as i32; -pub const STATUS_SPACES_EXTENDED_ERROR: ::NTSTATUS = 0xC0E7000Cu32 as i32; -pub const STATUS_SPACES_PROVISIONING_TYPE_INVALID: ::NTSTATUS = 0xC0E7000Du32 as i32; -pub const STATUS_SPACES_ALLOCATION_SIZE_INVALID: ::NTSTATUS = 0xC0E7000Eu32 as i32; -pub const STATUS_SPACES_ENCLOSURE_AWARE_INVALID: ::NTSTATUS = 0xC0E7000Fu32 as i32; -pub const STATUS_SPACES_WRITE_CACHE_SIZE_INVALID: ::NTSTATUS = 0xC0E70010u32 as i32; -pub const STATUS_SPACES_NUMBER_OF_GROUPS_INVALID: ::NTSTATUS = 0xC0E70011u32 as i32; -pub const STATUS_SPACES_DRIVE_OPERATIONAL_STATE_INVALID: ::NTSTATUS = 0xC0E70012u32 as i32; -pub const STATUS_SPACES_UPDATE_COLUMN_STATE: ::NTSTATUS = 0xC0E70013u32 as i32; -pub const STATUS_SPACES_MAP_REQUIRED: ::NTSTATUS = 0xC0E70014u32 as i32; -pub const STATUS_SPACES_UNSUPPORTED_VERSION: ::NTSTATUS = 0xC0E70015u32 as i32; -pub const STATUS_SPACES_CORRUPT_METADATA: ::NTSTATUS = 0xC0E70016u32 as i32; -pub const STATUS_SPACES_DRT_FULL: ::NTSTATUS = 0xC0E70017u32 as i32; -pub const STATUS_SPACES_INCONSISTENCY: ::NTSTATUS = 0xC0E70018u32 as i32; -pub const STATUS_SPACES_LOG_NOT_READY: ::NTSTATUS = 0xC0E70019u32 as i32; -pub const STATUS_SPACES_NO_REDUNDANCY: ::NTSTATUS = 0xC0E7001Au32 as i32; -pub const STATUS_SPACES_DRIVE_NOT_READY: ::NTSTATUS = 0xC0E7001Bu32 as i32; -pub const STATUS_SPACES_REPAIRED: ::NTSTATUS = 0x00E7001C; -pub const STATUS_SPACES_PAUSE: ::NTSTATUS = 0x00E7001D; -pub const STATUS_SPACES_COMPLETE: ::NTSTATUS = 0x00E7001E; -pub const STATUS_VOLSNAP_BOOTFILE_NOT_VALID: ::NTSTATUS = 0xC0500003u32 as i32; -pub const STATUS_IO_PREEMPTED: ::NTSTATUS = 0xC0510001u32 as i32; -pub const STATUS_SVHDX_ERROR_STORED: ::NTSTATUS = 0xC05C0000u32 as i32; -pub const STATUS_SVHDX_ERROR_NOT_AVAILABLE: ::NTSTATUS = 0xC05CFF00u32 as i32; -pub const STATUS_SVHDX_UNIT_ATTENTION_AVAILABLE: ::NTSTATUS = 0xC05CFF01u32 as i32; -pub const STATUS_SVHDX_UNIT_ATTENTION_CAPACITY_DATA_CHANGED: ::NTSTATUS = 0xC05CFF02u32 as i32; -pub const STATUS_SVHDX_UNIT_ATTENTION_RESERVATIONS_PREEMPTED: ::NTSTATUS = 0xC05CFF03u32 as i32; -pub const STATUS_SVHDX_UNIT_ATTENTION_RESERVATIONS_RELEASED: ::NTSTATUS = 0xC05CFF04u32 as i32; -pub const STATUS_SVHDX_UNIT_ATTENTION_REGISTRATIONS_PREEMPTED: ::NTSTATUS = 0xC05CFF05u32 as i32; -pub const STATUS_SVHDX_UNIT_ATTENTION_OPERATING_DEFINITION_CHANGED: ::NTSTATUS = 0xC05CFF06u32 as i32; -pub const STATUS_SVHDX_RESERVATION_CONFLICT: ::NTSTATUS = 0xC05CFF07u32 as i32; -pub const STATUS_SVHDX_WRONG_FILE_TYPE: ::NTSTATUS = 0xC05CFF08u32 as i32; -pub const STATUS_SVHDX_VERSION_MISMATCH: ::NTSTATUS = 0xC05CFF09u32 as i32; -pub const STATUS_VHD_SHARED: ::NTSTATUS = 0xC05CFF0Au32 as i32; -pub const STATUS_SVHDX_NO_INITIATOR: ::NTSTATUS = 0xC05CFF0Bu32 as i32; -pub const STATUS_VHDSET_BACKING_STORAGE_NOT_FOUND: ::NTSTATUS = 0xC05CFF0Cu32 as i32; -pub const STATUS_SMB_NO_PREAUTH_INTEGRITY_HASH_OVERLAP: ::NTSTATUS = 0xC05D0000u32 as i32; -pub const STATUS_SMB_BAD_CLUSTER_DIALECT: ::NTSTATUS = 0xC05D0001u32 as i32; -pub const STATUS_SMB_GUEST_LOGON_BLOCKED: ::NTSTATUS = 0xC05D0002u32 as i32; -pub const STATUS_SECCORE_INVALID_COMMAND: ::NTSTATUS = 0xC0E80000u32 as i32; -pub const STATUS_VSM_NOT_INITIALIZED: ::NTSTATUS = 0xC0450000u32 as i32; -pub const STATUS_VSM_DMA_PROTECTION_NOT_IN_USE: ::NTSTATUS = 0xC0450001u32 as i32; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/oaidl.rs cargo-0.37.0/vendor/winapi-0.2.8/src/oaidl.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/oaidl.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/oaidl.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,590 +0,0 @@ -// Copyright © 2015, Connor Hilarides -// Licensed under the MIT License -//! Mappings for the contents of OAIdl.h -pub type wireBRECORD = *mut _wireBRECORD; -pub type wireVARIANT = *mut _wireVARIANT; -STRUCT!{struct SAFEARRAYBOUND { - cElements: ::ULONG, - lLbound: ::LONG, -}} -STRUCT!{struct SAFEARR_BSTR { - Size: ::ULONG, - aBstr: *mut ::wireBSTR, -}} -STRUCT!{struct SAFEARR_UNKNOWN { - Size: ::ULONG, - apUnknown: *mut *mut ::IUnknown, -}} -STRUCT!{struct SAFEARR_DISPATCH { - Size: ::ULONG, - apDispatch: *mut *mut IDispatch, -}} -STRUCT!{struct SAFEARR_VARIANT { - Size: ::ULONG, - aVariant: *mut wireVARIANT, -}} -STRUCT!{struct SAFEARR_BRECORD { - Size: ::ULONG, - aRecord: *mut wireBRECORD, -}} -STRUCT!{struct SAFEARR_HAVEIID { - Size: ::ULONG, - apUnknown: *mut *mut ::IUnknown, - iid: ::IID, -}} -ENUM!{enum SF_TYPE { - SF_ERROR = ::VT_ERROR.0, - SF_I1 = ::VT_I1.0, - SF_I2 = ::VT_I2.0, - SF_I4 = ::VT_I4.0, - SF_I8 = ::VT_I8.0, - SF_BSTR = ::VT_BSTR.0, - SF_UNKNOWN = ::VT_UNKNOWN.0, - SF_DISPATCH = ::VT_DISPATCH.0, - SF_VARIANT = ::VT_VARIANT.0, - SF_RECORD = ::VT_RECORD.0, - SF_HAVEIID = ::VT_UNKNOWN.0 | ::VT_RESERVED.0, -}} -STRUCT!{struct SAFEARRAYUNION { - sfType: ::ULONG, - u: __MIDL_IOleAutomationTypes_0001, -}} -#[cfg(target_arch = "x86_64")] -STRUCT!{struct __MIDL_IOleAutomationTypes_0001 { - data0: u32, - data1: [u32; 6], -}} -#[cfg(target_arch = "x86")] -STRUCT!{struct __MIDL_IOleAutomationTypes_0001 { - data0: u32, - data1: [u32; 5], -}} -UNION!(__MIDL_IOleAutomationTypes_0001, data0, BstrStr, BstrStr_mut, SAFEARR_BSTR); -UNION!(__MIDL_IOleAutomationTypes_0001, data0, UnknownStr, UnknownStr_mut, SAFEARR_UNKNOWN); -UNION!(__MIDL_IOleAutomationTypes_0001, data0, DispatchStr, DispatchStr_mut, SAFEARR_DISPATCH); -UNION!(__MIDL_IOleAutomationTypes_0001, data0, VariantStr, VariantStr_mut, SAFEARR_VARIANT); -UNION!(__MIDL_IOleAutomationTypes_0001, data0, RecordStr, RecordStr_mut, SAFEARR_BRECORD); -UNION!(__MIDL_IOleAutomationTypes_0001, data0, HaveIidStr, HaveIidStr_mut, SAFEARR_HAVEIID); -UNION!(__MIDL_IOleAutomationTypes_0001, data0, ByteStr, ByteStr_mut, ::BYTE_SIZEDARR); -UNION!(__MIDL_IOleAutomationTypes_0001, data0, WordStr, WordStr_mut, ::WORD_SIZEDARR); -UNION!(__MIDL_IOleAutomationTypes_0001, data0, LongStr, LongStr_mut, ::DWORD_SIZEDARR); -UNION!(__MIDL_IOleAutomationTypes_0001, data0, HyperStr, HyperStr_mut, ::HYPER_SIZEDARR); -STRUCT!{struct _wireSAFEARRAY { - cDims: ::USHORT, - fFeatures: ::USHORT, - cbElements: ::ULONG, - cLocks: ::ULONG, - uArrayStructs: SAFEARRAYUNION, - rgsaBound: [SAFEARRAYBOUND; 1], -}} -pub type wireSAFEARRAY = *mut _wireSAFEARRAY; -pub type wirePSAFEARRAY = *mut wireSAFEARRAY; -STRUCT!{struct SAFEARRAY { - cDims: ::USHORT, - fFeatures: ::USHORT, - cbElements: ::ULONG, - cLocks: ::ULONG, - pvData: ::PVOID, - rgsabound: [SAFEARRAYBOUND; 1], -}} -pub type LPSAFEARRAY = *mut SAFEARRAY; -pub const FADF_AUTO: ::DWORD = 0x1; -pub const FADF_STATIC: ::DWORD = 0x2; -pub const FADF_EMBEDDED: ::DWORD = 0x4; -pub const FADF_FIXEDSIZE: ::DWORD = 0x10; -pub const FADF_RECORD: ::DWORD = 0x20; -pub const FADF_HAVEIID: ::DWORD = 0x40; -pub const FADF_HAVEVARTYPE: ::DWORD = 0x80; -pub const FADF_BSTR: ::DWORD = 0x100; -pub const FADF_UNKNOWN: ::DWORD = 0x200; -pub const FADF_DISPATCH: ::DWORD = 0x400; -pub const FADF_VARIANT: ::DWORD = 0x800; -pub const FADF_RESERVED: ::DWORD = 0xf008; -#[cfg(target_arch = "x86_64")] -STRUCT!{struct VARIANT { - data0: u64, - data1: u64, - data2: u64, -}} -#[cfg(target_arch = "x86")] -STRUCT!{struct VARIANT { - data0: u64, - data1: u32, - data2: u32, -}} -UNION!(VARIANT, data0, vt, vt_mut, ::VARTYPE); -UNION!(VARIANT, data1, llVal, llVal_mut, ::LONGLONG); -UNION!(VARIANT, data1, lVal, lVal_mut, ::LONG); -UNION!(VARIANT, data1, bVal, bVal_mut, ::BYTE); -UNION!(VARIANT, data1, iVal, iVal_mut, ::SHORT); -UNION!(VARIANT, data1, fltVal, fltVal_mut, ::FLOAT); -UNION!(VARIANT, data1, dblVal, dblVal_mut, ::DOUBLE); -UNION!(VARIANT, data1, boolVal, boolVal_mut, ::VARIANT_BOOL); -UNION!(VARIANT, data1, scode, scode_mut, ::SCODE); -UNION!(VARIANT, data1, cyVal, cyVal_mut, ::CY); -UNION!(VARIANT, data1, date, date_mut, ::DATE); -UNION!(VARIANT, data1, bstrVal, bstrVal_mut, ::BSTR); -UNION!(VARIANT, data1, punkVal, punkVal_mut, *mut ::IUnknown); -UNION!(VARIANT, data1, pdispVal, pdispVal_mut, *mut IDispatch); -UNION!(VARIANT, data1, parray, parray_mut, *mut SAFEARRAY); -UNION!(VARIANT, data1, pllVal, pllVal_mut, *mut ::LONGLONG); -UNION!(VARIANT, data1, plVal, plVal_mut, *mut ::LONG); -UNION!(VARIANT, data1, pbVal, pbVal_mut, *mut ::BYTE); -UNION!(VARIANT, data1, piVal, piVal_mut, *mut ::SHORT); -UNION!(VARIANT, data1, pfltVal, pfltVal_mut, *mut ::FLOAT); -UNION!(VARIANT, data1, pdblVal, pdblVal_mut, *mut ::DOUBLE); -UNION!(VARIANT, data1, pboolVal, pboolVal_mut, *mut ::VARIANT_BOOL); -UNION!(VARIANT, data1, pscode, pscode_mut, *mut ::SCODE); -UNION!(VARIANT, data1, pcyVal, pcyVal_mut, *mut ::CY); -UNION!(VARIANT, data1, pdate, pdate_mut, *mut ::DATE); -UNION!(VARIANT, data1, pbstrVal, pbstrVal_mut, *mut ::BSTR); -UNION!(VARIANT, data1, ppunkVal, ppunkVal_mut, *mut *mut ::IUnknown); -UNION!(VARIANT, data1, ppdispVal, ppdispVal_mut, *mut *mut IDispatch); -UNION!(VARIANT, data1, pparray, pparray_mut, *mut *mut SAFEARRAY); -UNION!(VARIANT, data1, pvarVal, pvarVal_mut, *mut VARIANT); -UNION!(VARIANT, data1, byref, byref_mut, ::PVOID); -UNION!(VARIANT, data1, cVal, cVal_mut, ::CHAR); -UNION!(VARIANT, data1, uiVal, uiVal_mut, ::USHORT); -UNION!(VARIANT, data1, ulVal, ulVal_mut, ::ULONG); -UNION!(VARIANT, data1, ullVal, ullVal_mut, ::ULONGLONG); -UNION!(VARIANT, data1, intVal, intVal_mut, ::INT); -UNION!(VARIANT, data1, uintVal, uintVal_mut, ::UINT); -UNION!(VARIANT, data1, pdecVal, pdecVal_mut, *mut ::DECIMAL); -UNION!(VARIANT, data1, pcVal, pcVal_mut, *mut ::CHAR); -UNION!(VARIANT, data1, puiVal, puiVal_mut, *mut ::USHORT); -UNION!(VARIANT, data1, pulVal, pulVal_mut, *mut ::ULONG); -UNION!(VARIANT, data1, pullVal, pullVal_mut, *mut ::ULONGLONG); -UNION!(VARIANT, data1, pintVal, pintVal_mut, *mut ::INT); -UNION!(VARIANT, data1, puintVal, puintVal_mut, *mut ::UINT); -UNION!(VARIANT, data1, pvRecord, pvRecord_mut, ::PVOID); -UNION!(VARIANT, data2, pRecInfo, pRecInfo_mut, *mut IRecordInfo); -UNION!(VARIANT, data0, decVal, decVal_mut, ::DECIMAL); -pub type LPVARIANT = *mut VARIANT; -pub type VARIANTARG = VARIANT; -pub type LPVARIANTARG = *mut VARIANT; -pub type REFVARIANT = *const VARIANT; -STRUCT!{struct _wireBRECORD { - fFlags: ::ULONG, - clSize: ::ULONG, - pRecInfo: *mut IRecordInfo, - pRecord: *mut ::BYTE, -}} -STRUCT!{struct _wireVARIANT { - clSize: ::DWORD, - rpcReserved: ::DWORD, - vt: ::USHORT, - wReserved1: ::USHORT, - wReserved2: ::USHORT, - wReserved3: ::USHORT, - data0: u64, - data1: u64, -}} -UNION!(_wireVARIANT, data0, llVal, llVal_mut, ::LONGLONG); -UNION!(_wireVARIANT, data0, lVal, lVal_mut, ::LONG); -UNION!(_wireVARIANT, data0, bVal, bVal_mut, ::BYTE); -UNION!(_wireVARIANT, data0, iVal, iVal_mut, ::SHORT); -UNION!(_wireVARIANT, data0, fltVal, fltVal_mut, ::FLOAT); -UNION!(_wireVARIANT, data0, dblVal, dblVal_mut, ::DOUBLE); -UNION!(_wireVARIANT, data0, boolVal, boolVal_mut, ::VARIANT_BOOL); -UNION!(_wireVARIANT, data0, scode, scode_mut, ::SCODE); -UNION!(_wireVARIANT, data0, cyVal, cyVal_mut, ::CY); -UNION!(_wireVARIANT, data0, date, date_mut, ::DATE); -UNION!(_wireVARIANT, data0, bstrVal, bstrVal_mut, ::wireBSTR); -UNION!(_wireVARIANT, data0, punkVal, punkVal_mut, *mut ::IUnknown); -UNION!(_wireVARIANT, data0, pdispVal, pdispVal_mut, *mut IDispatch); -UNION!(_wireVARIANT, data0, parray, parray_mut, wirePSAFEARRAY); -UNION!(_wireVARIANT, data0, brecVal, brecVal_mut, wireBRECORD); -UNION!(_wireVARIANT, data0, pllVal, pllVal_mut, *mut ::LONGLONG); -UNION!(_wireVARIANT, data0, plVal, plVal_mut, *mut ::LONG); -UNION!(_wireVARIANT, data0, pbVal, pbVal_mut, *mut ::BYTE); -UNION!(_wireVARIANT, data0, piVal, piVal_mut, *mut ::SHORT); -UNION!(_wireVARIANT, data0, pfltVal, pfltVal_mut, *mut ::FLOAT); -UNION!(_wireVARIANT, data0, pdblVal, pdblVal_mut, *mut ::DOUBLE); -UNION!(_wireVARIANT, data0, pboolVal, pboolVal_mut, *mut ::VARIANT_BOOL); -UNION!(_wireVARIANT, data0, pscode, pscode_mut, *mut ::SCODE); -UNION!(_wireVARIANT, data0, pcyVal, pcyVal_mut, *mut ::CY); -UNION!(_wireVARIANT, data0, pdate, pdate_mut, *mut ::DATE); -UNION!(_wireVARIANT, data0, pbstrVal, pbstrVal_mut, *mut ::wireBSTR); -UNION!(_wireVARIANT, data0, ppunkVal, ppunkVal_mut, *mut *mut ::IUnknown); -UNION!(_wireVARIANT, data0, ppdispVal, ppdispVal_mut, *mut *mut IDispatch); -UNION!(_wireVARIANT, data0, pparray, pparray_mut, *mut wirePSAFEARRAY); -UNION!(_wireVARIANT, data0, pvarVal, pvarVal_mut, *mut wireVARIANT); -UNION!(_wireVARIANT, data0, cVal, cVal_mut, ::CHAR); -UNION!(_wireVARIANT, data0, uiVal, uiVal_mut, ::USHORT); -UNION!(_wireVARIANT, data0, ulVal, ulVal_mut, ::ULONG); -UNION!(_wireVARIANT, data0, ullVal, ullVal_mut, ::ULONGLONG); -UNION!(_wireVARIANT, data0, intVal, intVal_mut, ::INT); -UNION!(_wireVARIANT, data0, uintVal, uintVal_mut, ::UINT); -UNION!(_wireVARIANT, data0, decVal, decVal_mut, ::DECIMAL); -UNION!(_wireVARIANT, data0, pcVal, pcVal_mut, *mut ::CHAR); -UNION!(_wireVARIANT, data0, puiVal, puiVal_mut, *mut ::USHORT); -UNION!(_wireVARIANT, data0, pulVal, pulVal_mut, *mut ::ULONG); -UNION!(_wireVARIANT, data0, pullVal, pullVal_mut, *mut ::ULONGLONG); -UNION!(_wireVARIANT, data0, pintVal, pintVal_mut, *mut ::INT); -UNION!(_wireVARIANT, data0, puintVal, puintVal_mut, *mut ::UINT); -UNION!(_wireVARIANT, data0, pdecVal, pdecVal_mut, *mut ::DECIMAL); -pub type DISPID = ::LONG; -pub type MEMBERID = DISPID; -pub type HREFTYPE = ::DWORD; -ENUM!{enum TYPEKIND { - TKIND_ENUM = 0, - TKIND_RECORD, - TKIND_MODULE, - TKIND_INTERFACE, - TKIND_DISPATCH, - TKIND_COCLASS, - TKIND_ALIAS, - TKIND_UNION, - TKIND_MAX, -}} -#[cfg(target_arch = "x86_64")] -STRUCT!{struct TYPEDESC { - data: u64, - vt: ::VARTYPE, -}} -#[cfg(target_arch = "x86")] -STRUCT!{struct TYPEDESC { - data: u32, - vt: ::VARTYPE, -}} -UNION!(TYPEDESC, data, lptdesc, lptdesc_mut, *mut TYPEDESC); -UNION!(TYPEDESC, data, lpadesc, lpadesc_mut, *mut ARRAYDESC); -UNION!(TYPEDESC, data, hreftype, hreftype_mut, HREFTYPE); -STRUCT!{struct ARRAYDESC { - tdescElem: TYPEDESC, - cDims: ::USHORT, - rgbounds: [SAFEARRAYBOUND; 1], -}} -STRUCT!{struct PARAMDESCEX { - cBytes: ::ULONG, - varDefaultValue: VARIANTARG, -}} -pub type LPPARAMDESCEX = *mut PARAMDESCEX; -STRUCT!{struct PARAMDESC { - pparamdescex: LPPARAMDESCEX, - wParamFlags: ::USHORT, -}} -pub type LPPARAMDESC = *mut PARAMDESC; -pub const PARAMFLAG_NONE: ::DWORD = 0; -pub const PARAMFLAG_FIN: ::DWORD = 0x1; -pub const PARAMFLAG_FOUT: ::DWORD = 0x2; -pub const PARAMFLAG_FLCID: ::DWORD = 0x4; -pub const PARAMFLAG_FRETVAL: ::DWORD = 0x8; -pub const PARAMFLAG_FOPT: ::DWORD = 0x10; -pub const PARAMFLAG_FHASDEFAULT: ::DWORD = 0x20; -pub const PARAMFLAG_FHASCUSTDATA: ::DWORD = 0x40; -STRUCT!{struct IDLDESC { - dwReserved: ::ULONG_PTR, - wIDLFlags: ::USHORT, -}} -pub type LPIDLDESC = *mut IDLDESC; -pub const IDLFLAG_NONE: ::DWORD = PARAMFLAG_NONE; -pub const IDLFLAG_FIN: ::DWORD = PARAMFLAG_FIN; -pub const IDLFLAG_FOUT: ::DWORD = PARAMFLAG_FOUT; -pub const IDLFLAG_FLCID: ::DWORD = PARAMFLAG_FLCID; -pub const IDLFLAG_FRETVAL: ::DWORD = PARAMFLAG_FRETVAL; -STRUCT!{struct ELEMDESC { - tdesc: TYPEDESC, - idldesc: IDLDESC, -}} -UNION!(ELEMDESC, idldesc, paramdesc, paramdesc_mut, PARAMDESC); -pub type LPELEMDESC = *mut ELEMDESC; -STRUCT!{struct TYPEATTR { - guid: ::GUID, - lcid: ::LCID, - dwReserved: ::DWORD, - memidConstructor: ::MEMBERID, - memidDestructor: ::MEMBERID, - lpstrSchema: ::LPOLESTR, - cbSizeInstance: ::ULONG, - typekind: ::TYPEKIND, - cFuncs: ::WORD, - cVars: ::WORD, - cImplTypes: ::WORD, - cbSizeVft: ::WORD, - cbAlignment: ::WORD, - wTypeFlags: ::WORD, - wMajorVerNum: ::WORD, - wMinorVerNum: ::WORD, - tdescAlias: ::TYPEDESC, - idldescType: ::IDLDESC, -}} -pub type LPTYPEATTR = *mut TYPEATTR; -STRUCT!{struct DISPPARAMS { - rgvarg: *mut VARIANTARG, - rgdispidNamedArgs: *mut DISPID, - cArgs: ::UINT, - cNamedArgs: ::UINT, -}} -STRUCT!{nodebug struct EXCEPINFO { - wCode: ::WORD, - wReserved: ::WORD, - bstrSource: ::BSTR, - bstrDescription: ::BSTR, - bstrHelpFile: ::BSTR, - dwHelpContext: ::DWORD, - pvReserved: ::PVOID, - pfnDeferredFillIn: Option ::HRESULT>, - scode: ::SCODE, -}} -ENUM!{enum CALLCONV { - CC_FASTCALL = 0, - CC_CDECL = 1, - CC_MSCPASCAL, - CC_PASCAL, - CC_MACPASCAL, - CC_STDCALL, - CC_FPFASTCALL, - CC_SYSCALL, - CC_MPWCDECL, - CC_MPWPASCAL, - CC_MAX, -}} -ENUM!{enum FUNCKIND { - FUNC_VIRTUAL = 0, - FUNC_PUREVIRTUAL, - FUNC_NONVIRTUAL, - FUNC_STATIC, - FUNC_DISPATCH, -}} -FLAGS!{enum INVOKEKIND { - INVOKE_FUNC = 1, - INVOKE_PROPERTYGET = 2, - INVOKE_PROPERTYPUT = 4, - INVOKE_PROPERTYPUTREF = 8, -}} -STRUCT!{struct FUNCDESC { - memid: ::MEMBERID, - lprgscode: *mut ::SCODE, - lprgelemdescParam: *mut ::ELEMDESC, - funckind: ::FUNCKIND, - invkind: ::INVOKEKIND, - callconv: ::CALLCONV, - cParams: ::SHORT, - cParamsOpt: ::SHORT, - oVft: ::SHORT, - cScodes: ::SHORT, - elemdescFunc: ::ELEMDESC, - wFuncFlags: ::WORD, -}} -pub type LPFUNCDESC = *mut FUNCDESC; -ENUM!{enum VARKIND { - VAR_PERINSTANCE = 0, - VAR_STATIC, - VAR_CONST, - VAR_DISPATCH, -}} -pub const IMPLTYPEFLAG_FDEFAULT: ::DWORD = 0x1; -pub const IMPLTYPEFLAG_FSOURCE: ::DWORD = 0x2; -pub const IMPLTYPEFLAG_FRESTRICTED: ::DWORD = 0x4; -pub const IMPLTYPEFLAG_FDEFAULTVTABLE: ::DWORD = 0x8; -STRUCT!{struct VARDESC { - memid: MEMBERID, - lpstrSchema: ::LPOLESTR, - lpvarValue: *mut VARIANT, - elemdescVar: ::ELEMDESC, - wVarFlags: ::WORD, - varkind: VARKIND, -}} -UNION!(VARDESC, lpvarValue, oInst, oInst_mut, ::ULONG); -pub type LPVARDESC = *mut VARDESC; -FLAGS!{enum TYPEFLAGS { - TYPEFLAG_FAPPOBJECT = 0x1, - TYPEFLAG_FCANCREATE = 0x2, - TYPEFLAG_FLICENSED = 0x4, - TYPEFLAG_FPREDECLID = 0x8, - TYPEFLAG_FHIDDEN = 0x10, - TYPEFLAG_FCONTROL = 0x20, - TYPEFLAG_FDUAL = 0x40, - TYPEFLAG_FNONEXTENSIBLE = 0x80, - TYPEFLAG_FOLEAUTOMATION = 0x100, - TYPEFLAG_FRESTRICTED = 0x200, - TYPEFLAG_FAGGREGATABLE = 0x400, - TYPEFLAG_FREPLACEABLE = 0x800, - TYPEFLAG_FDISPATCHABLE = 0x1000, - TYPEFLAG_FREVERSEBIND = 0x2000, - TYPEFLAG_FPROXY = 0x4000, -}} -FLAGS!{enum FUNCFLAGS { - FUNCFLAG_FRESTRICTED = 0x1, - FUNCFLAG_FSOURCE = 0x2, - FUNCFLAG_FBINDABLE = 0x4, - FUNCFLAG_FREQUESTEDIT = 0x8, - FUNCFLAG_FDISPLAYBIND = 0x10, - FUNCFLAG_FDEFAULTBIND = 0x20, - FUNCFLAG_FHIDDEN = 0x40, - FUNCFLAG_FUSESGETLASTERROR = 0x80, - FUNCFLAG_FDEFAULTCOLLELEM = 0x100, - FUNCFLAG_FUIDEFAULT = 0x200, - FUNCFLAG_FNONBROWSABLE = 0x400, - FUNCFLAG_FREPLACEABLE = 0x800, - FUNCFLAG_FIMMEDIATEBIND = 0x1000, -}} -FLAGS!{enum VARFLAGS { - VARFLAG_FREADONLY = 0x1, - VARFLAG_FSOURCE = 0x2, - VARFLAG_FBINDABLE = 0x4, - VARFLAG_FREQUESTEDIT = 0x8, - VARFLAG_FDISPLAYBIND = 0x10, - VARFLAG_FDEFAULTBIND = 0x20, - VARFLAG_FHIDDEN = 0x40, - VARFLAG_FRESTRICTED = 0x80, - VARFLAG_FDEFAULTCOLLELEM = 0x100, - VARFLAG_FUIDEFAULT = 0x200, - VARFLAG_FNONBROWSABLE = 0x400, - VARFLAG_FREPLACEABLE = 0x800, - VARFLAG_FIMMEDIATEBIND = 0x1000, -}} -STRUCT!{struct CLEANLOCALSTORAGE { - pInterface: *mut ::IUnknown, - pStorage: ::PVOID, - flags: ::DWORD, -}} -STRUCT!{struct CUSTDATAITEM { - guid: ::GUID, - varValue: VARIANTARG, -}} -pub type LPCUSTDATAITEM = *mut CUSTDATAITEM; -STRUCT!{struct CUSTDATA { - cCustData: ::DWORD, - prgCustData: LPCUSTDATAITEM, -}} -pub type LPCUSTDATA = *mut CUSTDATA; -pub type LPCREATETYPEINFO = *mut ICreateTypeInfo; -RIDL!( -interface ICreateTypeInfo(ICreateTypeInfoVtbl): IUnknown(IUnknownVtbl) { - fn SetGuid(&mut self, guid: ::REFGUID) -> ::HRESULT, - fn SetTypeFlags(&mut self, uTypeFlags: ::UINT) -> ::HRESULT, - fn SetDocString(&mut self, pStrDoc: ::LPOLESTR) -> ::HRESULT, - fn SetHelpContext(&mut self, dwHelpContext: ::DWORD) -> ::HRESULT, - fn SetVersion(&mut self, wMajorVerNum: ::WORD, wMinorVerNum: ::WORD) -> ::HRESULT, - fn AddRefTypeInfo(&mut self, pTInfo: *mut ITypeInfo) -> ::HRESULT, - fn AddFuncDesc(&mut self, index: ::UINT, pFuncDesc: *mut FUNCDESC) -> ::HRESULT, - fn SetImplTypeFlags(&mut self, index: ::UINT, implTypeFlags: ::INT) -> ::HRESULT, - fn SetAlignment(&mut self, cbAlignment: ::WORD) -> ::HRESULT, - fn SetSchema(&mut self, pStrSchema: ::LPOLESTR) -> ::HRESULT, - fn AddVarDesc(&mut self, index: ::UINT, pVarDesc: *mut VARDESC) -> ::HRESULT, - fn SetFuncAndParamNames( - &mut self, index: ::UINT, rgszNames: *mut ::LPOLESTR, cNames: ::UINT - ) -> ::HRESULT, - fn SetVarName(&mut self, index: ::UINT, szName: ::LPOLESTR) -> ::HRESULT, - fn SetTypeDescAlias(&mut self, pTDescAlias: *mut TYPEDESC) -> ::HRESULT, - fn DefineFuncAsDllEntry( - &mut self, index: ::UINT, szDllName: ::LPOLESTR, szProcName: ::LPOLESTR - ) -> ::HRESULT, - fn SetFuncDocString(&mut self, index: ::UINT, szDocString: ::LPOLESTR) -> ::HRESULT, - fn SetVarDocString(&mut self, index: ::UINT, szDocString: ::LPOLESTR) -> ::HRESULT, - fn SetFuncHelpContext(&mut self, index: ::UINT, dwHelpContext: ::DWORD) -> ::HRESULT, - fn SetVarHelpContext(&mut self, index: ::UINT, dwHelpContext: ::DWORD) -> ::HRESULT, - fn SetMops(&mut self, index: ::UINT, bstrMops: ::BSTR) -> ::HRESULT, - fn SetTypeIdldesc(&mut self, pIdlDesc: *mut IDLDESC) -> ::HRESULT, - fn LayOut(&mut self) -> ::HRESULT -} -); -// FIXME: Implement these interfaces -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ICreateTypeInfo2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ICreateTypeLib; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ICreateTypeLib2; -pub type LPDISPATCH = *mut IDispatch; -pub const DISPID_UNKNOWN: ::INT = -1; -pub const DISPID_VALUE: ::INT = 0; -pub const DISPID_PROPERTYPUT: ::INT = -3; -pub const DISPID_NEWENUM: ::INT = -4; -pub const DISPID_EVALUATE: ::INT = -5; -pub const DISPID_CONSTRUCTOR: ::INT = -6; -pub const DISPID_DESTRUCTOR: ::INT = -7; -pub const DISPID_COLLECT: ::INT = -8; -RIDL!( -interface IDispatch(IDispatchVtbl): IUnknown(IUnknownVtbl) { - fn GetTypeInfoCount(&mut self, pctinfo: *mut ::UINT) -> ::HRESULT, - fn GetTypeInfo( - &mut self, iTInfo: ::UINT, lcid: ::LCID, ppTInfo: *mut *mut ITypeInfo - ) -> ::HRESULT, - fn GetIDsOfNames( - &mut self, riid: ::REFIID, rgszNames: *mut ::LPOLESTR, cNames: ::UINT, lcid: ::LCID, - rgDispId: *mut ::DISPID - ) -> ::HRESULT, - fn Invoke( - &mut self, dispIdMember: ::DISPID, riid: ::REFIID, lcid: ::LCID, wFlags: ::WORD, - pDispParams: *mut ::DISPPARAMS, pVarResult: *mut VARIANT, pExcepInfo: *mut ::EXCEPINFO, - puArgErr: *mut ::UINT - ) -> ::HRESULT -} -); -// FIXME: Implement these interfaces -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IEnumVARIANT; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ITypeComp; -RIDL!( -interface ITypeInfo(ITypeInfoVtbl): IUnknown(IUnknownVtbl) { - fn GetTypeAttr(&mut self, ppTypeAttr: *mut *mut TYPEATTR) -> ::HRESULT, - fn GetTypeComp(&mut self, ppTComp: *mut *mut ITypeComp) -> ::HRESULT, - fn GetFuncDesc(&mut self, index: ::UINT, ppFunDesc: *mut *mut FUNCDESC) -> ::HRESULT, - fn GetVarDesc(&mut self, index: ::UINT, pPVarDesc: *mut *mut VARDESC) -> ::HRESULT, - fn GetNames( - &mut self, memid: MEMBERID, rgBstrNames: *mut ::BSTR, cMaxNames: ::UINT, - pcNames: *mut ::UINT - ) -> ::HRESULT, - fn GetRefTypeOfImplType(&mut self, index: ::UINT, pRefType: *mut HREFTYPE) -> ::HRESULT, - fn GetImplTypeFlags(&mut self, index: ::UINT, pImplTypeFlags: *mut ::INT) -> ::HRESULT, - fn GetIDsOfNames( - &mut self, rgszNames: *mut ::LPOLESTR, cNames: ::UINT, pMemId: *mut MEMBERID - ) -> ::HRESULT, - fn Invoke( - &mut self, pvInstance: ::PVOID, memid: MEMBERID, wFlags: ::WORD, - pDispParams: *mut DISPPARAMS, pVarResult: *mut VARIANT, pExcepInfo: *mut EXCEPINFO, - puArgErr: *mut ::UINT - ) -> ::HRESULT, - fn GetDocumentation( - &mut self, memid: MEMBERID, pBstrName: *mut ::BSTR, pBstrDocString: *mut ::BSTR, - pdwHelpContext: *mut ::DWORD, pBstrHelpFile: *mut ::BSTR - ) -> ::HRESULT, - fn GetDllEntry( - &mut self, memid: MEMBERID, invKind: ::INVOKEKIND, pBstrDllName: *mut ::BSTR, - pBstrName: *mut ::BSTR, pwOrdinal: *mut ::WORD - ) -> ::HRESULT, - fn GetRefTypeInfo(&mut self, hRefType: HREFTYPE, ppTInfo: *mut *mut ITypeInfo) -> ::HRESULT, - fn AddressOfMember( - &mut self, memid: MEMBERID, invKind: ::INVOKEKIND, ppv: *mut ::PVOID - ) -> ::HRESULT, - fn CreateInstance( - &mut self, pUnkOuter: *mut ::IUnknown, riid: ::REFIID, ppvObj: *mut ::PVOID - ) -> ::HRESULT, - fn GetMops(&mut self, memid: MEMBERID, pBstrMops: *mut ::BSTR) -> ::HRESULT, - fn GetContainingTypeLib( - &mut self, ppTLib: *mut *mut ITypeLib, pIndex: *mut ::UINT - ) -> ::HRESULT, - fn ReleaseTypeAttr(&mut self, pTypeAttr: *mut TYPEATTR) -> (), - fn ReleaseFuncDesc(&mut self, pFuncDesc: *mut FUNCDESC) -> (), - fn ReleaseVarDesc(&mut self, pVarDesc: *mut VARDESC) -> () -} -); -// FIXME: Implement these interfaces -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ITypeInfo2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ITypeLib; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ITypeLib2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ITypeChangeEvents; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IErrorInfo; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ICreateErrorInfo; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ISupportErrorInfo; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ITypeFactory; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ITypeMarshal; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IRecordInfo; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IErrorLog; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IPropertyBag; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/objbase.rs cargo-0.37.0/vendor/winapi-0.2.8/src/objbase.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/objbase.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/objbase.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -//! Component object model defintions -pub const COINIT_APARTMENTTHREADED: ::DWORD = 0x2; -pub const COINIT_MULTITHREADED: ::DWORD = 0x0; -pub const COINIT_DISABLE_OLE1DDE: ::DWORD = 0x4; -pub const COINIT_SPEED_OVER_MEMORY: ::DWORD = 0x8; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/objidlbase.rs cargo-0.37.0/vendor/winapi-0.2.8/src/objidlbase.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/objidlbase.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/objidlbase.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! this ALWAYS GENERATED file contains the definitions for the interfaces -RIDL!( -interface IMalloc(IMallocVtbl): IUnknown(IUnknownVtbl) { - fn Alloc(&mut self, cb: ::SIZE_T) -> *mut ::c_void, - fn Realloc(&mut self, pv: *mut ::c_void, cb: ::SIZE_T) -> *mut ::c_void, - fn Free(&mut self, pv: *mut ::c_void) -> (), - fn GetSize(&mut self, pv: *mut ::c_void) -> ::SIZE_T, - fn DidAlloc(&mut self, pv: *mut ::c_void) -> ::c_int, - fn HeapMinimize(&mut self) -> () -} -); -pub type LPMALLOC = *mut IMalloc; -STRUCT!{struct STATSTG { - pwcsName: ::LPOLESTR, - type_: ::DWORD, - cbSize: ::ULARGE_INTEGER, - mtime: ::FILETIME, - ctime: ::FILETIME, - atime: ::FILETIME, - grfMode: ::DWORD, - grfLocksSupported: ::DWORD, - clsid: ::CLSID, - grfStateBits: ::DWORD, - reserved: ::DWORD, -}} -//1945 -pub type IEnumString = ::IUnknown; // TODO -//2075 -RIDL!( -interface ISequentialStream(ISequentialStreamVtbl): IUnknown(IUnknownVtbl) { - fn Read(&mut self, pv: *mut ::c_void, cb: ::ULONG, pcbRead: *mut ::ULONG) -> ::HRESULT, - fn Write(&mut self, pv: *const ::c_void, cb: ::ULONG, pcbWritten: *mut ::ULONG) -> ::HRESULT -} -); -ENUM!{enum STGTY { - STGTY_STORAGE = 1, - STGTY_STREAM = 2, - STGTY_LOCKBYTES = 3, - STGTY_PROPERTY = 4, -}} -ENUM!{enum STREAM_SEEK { - STREAM_SEEK_SET = 0, - STREAM_SEEK_CUR = 1, - STREAM_SEEK_END = 2, -}} -ENUM!{enum LOCKTYPE { - LOCK_WRITE = 1, - LOCK_EXCLUSIVE = 2, - LOCK_ONLYONCE = 4, -}} -//2255 -RIDL!( -interface IStream(IStreamVtbl): ISequentialStream(ISequentialStreamVtbl) { - fn Seek( - &mut self, dlibMove: ::LARGE_INTEGER, dwOrigin: ::DWORD, - plibNewPosition: *mut ::ULARGE_INTEGER - ) -> ::HRESULT, - fn SetSize(&mut self, libNewSize: ::ULARGE_INTEGER) -> ::HRESULT, - fn CopyTo( - &mut self, pstm: *mut IStream, cb: ::ULARGE_INTEGER, pcbRead: *mut ::ULARGE_INTEGER, - pcbWritten: *mut ::ULARGE_INTEGER - ) -> ::HRESULT, - fn Commit(&mut self, grfCommitFlags: ::DWORD) -> ::HRESULT, - fn Revert(&mut self) -> ::HRESULT, - fn LockRegion( - &mut self, libOffset: ::ULARGE_INTEGER, cb: ::ULARGE_INTEGER, dwLockType: ::DWORD - ) -> ::HRESULT, - fn UnlockRegion( - &mut self, libOffset: ::ULARGE_INTEGER, cb: ::ULARGE_INTEGER, dwLockType: ::DWORD - ) -> ::HRESULT, - fn Stat(&mut self, pstatstg: *mut STATSTG, grfStatFlag: ::DWORD) -> ::HRESULT, - fn Clone(&mut self, ppstm: *mut *mut IStream) -> ::HRESULT -} -); -pub type LPSTREAM = *mut IStream; -ENUM!{enum APTTYPEQUALIFIER { - APTTYPEQUALIFIER_NONE = 0, - APTTYPEQUALIFIER_IMPLICIT_MTA = 1, - APTTYPEQUALIFIER_NA_ON_MTA = 2, - APTTYPEQUALIFIER_NA_ON_STA = 3, - APTTYPEQUALIFIER_NA_ON_IMPLICIT_MTA = 4, - APTTYPEQUALIFIER_NA_ON_MAINSTA = 5, - APTTYPEQUALIFIER_APPLICATION_STA= 6, -}} -ENUM!{enum APTTYPE { - APTTYPE_CURRENT = -1i32 as u32, - APTTYPE_STA = 0, - APTTYPE_MTA = 1, - APTTYPE_NA = 2, - APTTYPE_MAINSTA = 3, -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/objidl.rs cargo-0.37.0/vendor/winapi-0.2.8/src/objidl.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/objidl.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/objidl.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,100 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! this ALWAYS GENERATED file contains the definitions for the interfaces -//8402 -STRUCT!{struct BIND_OPTS { - cbStruct: ::DWORD, - grfFlags: ::DWORD, - grfMode: ::DWORD, - dwTickCountDeadline: ::DWORD, -}} -pub type LPBIND_OPTS = *mut BIND_OPTS; -//8479 -RIDL!( -interface IBindCtx(IBindCtxVtbl): IUnknown(IUnknownVtbl) { - fn RegisterObjectBound(&mut self, punk: *mut ::IUnknown) -> ::HRESULT, - fn RevokeObjectBound(&mut self, punk: *mut ::IUnknown) -> ::HRESULT, - fn ReleaseBoundObjects(&mut self) -> ::HRESULT, - fn SetBindOptions(&mut self, pbindopts: *mut BIND_OPTS) -> ::HRESULT, - fn GetBindOptions(&mut self, pbindopts: *mut BIND_OPTS) -> ::HRESULT, - fn GetRunningObjectTable(&mut self, pprot: *mut *mut IRunningObjectTable) -> ::HRESULT, - fn RegisterObjectParam(&mut self, pszKey: ::LPOLESTR, punk: *mut ::IUnknown) -> ::HRESULT, - fn GetObjectParam(&mut self, pszKey: ::LPOLESTR, ppunk: *mut *mut ::IUnknown) -> ::HRESULT, - fn EnumObjectParam(&mut self, ppenum: *mut *mut ::IEnumString) -> ::HRESULT, - fn RevokeObjectParam(&mut self, pszKey: ::LPOLESTR) -> ::HRESULT -} -); -//8681 -pub type IEnumMoniker = ::IUnknown; // TODO -//8958 -RIDL!( -interface IRunningObjectTable(IRunningObjectTableVtbl): IUnknown(IUnknownVtbl) { - fn Register( - &mut self, grfFlags: ::DWORD, punkObject: *mut ::IUnknown, pmkObjectName: *mut IMoniker, - pdwRegister: *mut ::DWORD - ) -> ::HRESULT, - fn Revoke(&mut self, dwRegister: ::DWORD) -> ::HRESULT, - fn IsRunning(&mut self, pmkObjectName: *mut IMoniker) -> ::HRESULT, - fn GetObject( - &mut self, pmkObjectName: *mut IMoniker, ppunkObject: *mut *mut ::IUnknown - ) -> ::HRESULT, - fn NoteChangeTime(&mut self, dwRegister: ::DWORD, pfiletime: *mut ::FILETIME) -> ::HRESULT, - fn GetTimeOfLastChange( - &mut self, pmkObjectName: *mut IMoniker, pfiletime: *mut ::FILETIME - ) -> ::HRESULT, - fn EnumRunning(&mut self, ppenumMoniker: *mut *mut IEnumMoniker) -> ::HRESULT -} -); -//9350 -pub type IMoniker = ::IUnknown; // TODO -pub type EOLE_AUTHENTICATION_CAPABILITIES = ::DWORD; -pub const EOAC_NONE: ::DWORD = 0; -pub const EOAC_MUTUAL_AUTH: ::DWORD = 0x1; -pub const EOAC_STATIC_CLOAKING: ::DWORD = 0x20; -pub const EOAC_DYNAMIC_CLOAKING: ::DWORD = 0x40; -pub const EOAC_ANY_AUTHORITY: ::DWORD = 0x80; -pub const EOAC_MAKE_FULLSIC: ::DWORD = 0x100; -pub const EOAC_DEFAULT: ::DWORD = 0x800; -pub const EOAC_SECURE_REFS: ::DWORD = 0x2; -pub const EOAC_ACCESS_CONTROL: ::DWORD = 0x4; -pub const EOAC_APPID: ::DWORD = 0x8; -pub const EOAC_DYNAMIC: ::DWORD = 0x10; -pub const EOAC_REQUIRE_FULLSIC: ::DWORD = 0x200; -pub const EOAC_AUTO_IMPERSONATE: ::DWORD = 0x400; -pub const EOAC_NO_CUSTOM_MARSHAL: ::DWORD = 0x2000; -pub const EOAC_DISABLE_AAA: ::DWORD = 0x1000; -STRUCT!{struct SOLE_AUTHENTICATION_SERVICE { - dwAuthnSvc: ::DWORD, - dwAuthzSvc: ::DWORD, - pPrincipalName: *mut ::OLECHAR, - hr: ::HRESULT, -}} - -RIDL!( -interface IApartmentShutdown(IApartmentShutdownVtbl): IUnknown(IUnknownVtbl) { - fn OnUninitialize(&mut self, ui64ApartmentIdentifier: ::UINT64) -> ::VOID -} -); - -RIDL!( -interface IMarshal(IMarshalVtbl): IUnknown(IUnknownVtbl) { - fn GetUnmarshalClass( - &mut self, riid: ::REFIID, pv: *const ::VOID, dwDestContext: ::DWORD, - pvDestContext: *const ::VOID, mshlflags: ::DWORD, pCid: *mut ::CLSID - ) -> ::HRESULT, - fn GetMarshalSizeMax( - &mut self, riid: ::REFIID, pv: *const ::VOID, dwDestContext: ::DWORD, - pvDestContext: *const ::VOID, mshlflags: ::DWORD, pSize: *mut ::DWORD - ) -> ::HRESULT, - fn MarshalInterface( - &mut self, pStm: *const ::IStream, riid: ::REFIID, pv: *const ::VOID, - dwDestContext: ::DWORD, pvDestContext: *const ::VOID, - mshlflags: ::DWORD - ) -> ::HRESULT, - fn UnmarshalInterface( - &mut self, pStm: *const ::IStream, riid: ::REFIID, ppv: *mut *mut ::VOID - ) -> ::HRESULT, - fn ReleaseMarshalData(&mut self, pStm: *const ::IStream) -> ::HRESULT, - fn DisconnectObject(&mut self, dwReserved: ::DWORD) -> ::HRESULT -} -); \ No newline at end of file diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/olectl.rs cargo-0.37.0/vendor/winapi-0.2.8/src/olectl.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/olectl.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/olectl.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! OLE Control interfaces -//299 -pub const SELFREG_E_FIRST: ::HRESULT = MAKE_SCODE!(::SEVERITY_ERROR, ::FACILITY_ITF, 0x0200); -pub const SELFREG_E_LAST: ::HRESULT = MAKE_SCODE!(::SEVERITY_ERROR, ::FACILITY_ITF, 0x020F); -pub const SELFREG_S_FIRST: ::HRESULT = MAKE_SCODE!(::SEVERITY_SUCCESS, ::FACILITY_ITF, 0x0200); -pub const SELFREG_S_LAST: ::HRESULT = MAKE_SCODE!(::SEVERITY_SUCCESS, ::FACILITY_ITF, 0x020F); -pub const SELFREG_E_TYPELIB: ::HRESULT = SELFREG_E_FIRST + 0; -pub const SELFREG_E_CLASS: ::HRESULT = SELFREG_E_FIRST + 1; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/pdh.rs cargo-0.37.0/vendor/winapi-0.2.8/src/pdh.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/pdh.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/pdh.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -// Copyright © 2016, Klavs Madsen -// Licensed under the MIT License -//! Common Performance Data Helper definitions -pub const PDH_FMT_RAW: ::DWORD = 0x00000010; -pub const PDH_FMT_ANSI: ::DWORD = 0x00000020; -pub const PDH_FMT_UNICODE: ::DWORD = 0x00000040; -pub const PDH_FMT_LONG: ::DWORD = 0x00000100; -pub const PDH_FMT_DOUBLE: ::DWORD = 0x00000200; -pub const PDH_FMT_LARGE: ::DWORD = 0x00000400; -pub const PDH_FMT_NOSCALE: ::DWORD = 0x00001000; -pub const PDH_FMT_1000: ::DWORD = 0x00002000; -pub const PDH_FMT_NODATA: ::DWORD = 0x00004000; -pub const PDH_FMT_NOCAP100: ::DWORD = 0x00008000; -pub const PERF_DETAIL_COSTLY: ::DWORD = 0x00010000; -pub const PERF_DETAIL_STANDARD: ::DWORD = 0x0000FFFF; - -pub type PDH_STATUS = ::LONG; -pub type PDH_HQUERY = ::HANDLE; -pub type HQUERY = PDH_HQUERY; -pub type PDH_HCOUNTER = ::HANDLE; -pub type HCOUNTER = PDH_HCOUNTER; - -STRUCT!{struct PDH_FMT_COUNTERVALUE { - CStatus: ::DWORD, - largeValue: ::LONGLONG, -}} -UNION!(PDH_FMT_COUNTERVALUE, largeValue, largeValue, largeValue_mut, ::LONGLONG); -UNION!(PDH_FMT_COUNTERVALUE, largeValue, longValue, longValue_mut, ::LONG); -UNION!(PDH_FMT_COUNTERVALUE, largeValue, doubleValue, doubleValue_mut, ::DOUBLE); -UNION!(PDH_FMT_COUNTERVALUE, largeValue, AnsiStringValue, AnsiStringValue_mut, ::LPCSTR); -UNION!(PDH_FMT_COUNTERVALUE, largeValue, WideStringValue, WideStringValue_mut, ::LPCWSTR); -pub type PPDH_FMT_COUNTERVALUE = *mut PDH_FMT_COUNTERVALUE; - -STRUCT!{struct PDH_COUNTER_PATH_ELEMENTS_A { - szMachineName: ::LPSTR, - szObjectName: ::LPSTR, - szInstanceName: ::LPSTR, - szParentInstance: ::LPSTR, - dwInstanceIndex: ::DWORD, - szCounterName: ::LPSTR, -}} -pub type PPDH_COUNTER_PATH_ELEMENTS_A = *mut PDH_COUNTER_PATH_ELEMENTS_A; - -STRUCT!{struct PDH_COUNTER_PATH_ELEMENTS_W { - szMachineName: ::LPWSTR, - szObjectName: ::LPWSTR, - szInstanceName: ::LPWSTR, - szParentInstance: ::LPWSTR, - dwInstanceIndex: ::DWORD, - szCounterName: ::LPWSTR, -}} -pub type PPDH_COUNTER_PATH_ELEMENTS_W = *mut PDH_COUNTER_PATH_ELEMENTS_W; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/playsoundapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/playsoundapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/playsoundapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/playsoundapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -// Copyright © 2016, Peter Atashian -// Licensed under the MIT License -use super::*; -pub const SND_SYNC: DWORD = 0x0000; -pub const SND_ASYNC: DWORD = 0x0001; -pub const SND_NODEFAULT: DWORD = 0x0002; -pub const SND_MEMORY: DWORD = 0x0004; -pub const SND_LOOP: DWORD = 0x0008; -pub const SND_NOSTOP: DWORD = 0x0010; -pub const SND_NOWAIT: DWORD = 0x00002000; -pub const SND_ALIAS: DWORD = 0x00010000; -pub const SND_ALIAS_ID: DWORD = 0x00110000; -pub const SND_FILENAME: DWORD = 0x00020000; -pub const SND_RESOURCE: DWORD = 0x00040004; -pub const SND_PURGE: DWORD = 0x0040; -pub const SND_APPLICATION: DWORD = 0x0080; -pub const SND_SENTRY: DWORD = 0x00080000; -pub const SND_RING: DWORD = 0x00100000; -pub const SND_SYSTEM: DWORD = 0x00200000; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/processsnapshot.rs cargo-0.37.0/vendor/winapi-0.2.8/src/processsnapshot.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/processsnapshot.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/processsnapshot.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! Defines the process snapshot API -FLAGS!{enum PSS_CAPTURE_FLAGS { - PSS_CAPTURE_NONE = 0x00000000, - PSS_CAPTURE_VA_CLONE = 0x00000001, - PSS_CAPTURE_RESERVED_00000002 = 0x00000002, - PSS_CAPTURE_HANDLES = 0x00000004, - PSS_CAPTURE_HANDLE_NAME_INFORMATION = 0x00000008, - PSS_CAPTURE_HANDLE_BASIC_INFORMATION = 0x00000010, - PSS_CAPTURE_HANDLE_TYPE_SPECIFIC_INFORMATION = 0x00000020, - PSS_CAPTURE_HANDLE_TRACE = 0x00000040, - PSS_CAPTURE_THREADS = 0x00000080, - PSS_CAPTURE_THREAD_CONTEXT = 0x00000100, - PSS_CAPTURE_THREAD_CONTEXT_EXTENDED = 0x00000200, - PSS_CAPTURE_RESERVED_00000400 = 0x00000400, - PSS_CAPTURE_VA_SPACE = 0x00000800, - PSS_CAPTURE_VA_SPACE_SECTION_INFORMATION = 0x00001000, - PSS_CREATE_BREAKAWAY_OPTIONAL = 0x04000000, - PSS_CREATE_BREAKAWAY = 0x08000000, - PSS_CREATE_FORCE_BREAKAWAY = 0x10000000, - PSS_CREATE_USE_VM_ALLOCATIONS = 0x20000000, - PSS_CREATE_MEASURE_PERFORMANCE = 0x40000000, - PSS_CREATE_RELEASE_SECTION = -2147483648i32 as u32, -}} -ENUM!{enum PSS_QUERY_INFORMATION_CLASS { - PSS_QUERY_PROCESS_INFORMATION = 0, - PSS_QUERY_VA_CLONE_INFORMATION = 1, - PSS_QUERY_AUXILIARY_PAGES_INFORMATION = 2, - PSS_QUERY_VA_SPACE_INFORMATION = 3, - PSS_QUERY_HANDLE_INFORMATION = 4, - PSS_QUERY_THREAD_INFORMATION = 5, - PSS_QUERY_HANDLE_TRACE_INFORMATION = 6, - PSS_QUERY_PERFORMANCE_COUNTERS = 7, -}} -ENUM!{enum PSS_WALK_INFORMATION_CLASS { - PSS_WALK_AUXILIARY_PAGES = 0, - PSS_WALK_VA_SPACE = 1, - PSS_WALK_HANDLES = 2, - PSS_WALK_THREADS = 3, -}} -FLAGS!{enum PSS_DUPLICATE_FLAGS { - PSS_DUPLICATE_NONE = 0x00, - PSS_DUPLICATE_CLOSE_SOURCE = 0x01, -}} -DECLARE_HANDLE!(HPSS, HPSS__); -DECLARE_HANDLE!(HPSSWALK, HPSSWALK__); -pub type pAllocRoutine = Option *mut ::c_void>; -pub type pFreeRoutine = Option; -STRUCT!{nodebug struct PSS_ALLOCATOR { - Context: *mut ::c_void, - AllocRoutine: pAllocRoutine, - FreeRoutine: pFreeRoutine, -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/processthreadsapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/processthreadsapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/processthreadsapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/processthreadsapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -STRUCT!{struct PROCESS_INFORMATION { - hProcess: ::HANDLE, - hThread: ::HANDLE, - dwProcessId: ::DWORD, - dwThreadId: ::DWORD, -}} -pub type PPROCESS_INFORMATION = *mut PROCESS_INFORMATION; -pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION; -STRUCT!{struct STARTUPINFOA { - cb: ::DWORD, - lpReserved: ::LPSTR, - lpDesktop: ::LPSTR, - lpTitle: ::LPSTR, - dwX: ::DWORD, - dwY: ::DWORD, - dwXSize: ::DWORD, - dwYSize: ::DWORD, - dwXCountChars: ::DWORD, - dwYCountChars: ::DWORD, - dwFillAttribute: ::DWORD, - dwFlags: ::DWORD, - wShowWindow: ::WORD, - cbReserved2: ::WORD, - lpReserved2: ::LPBYTE, - hStdInput: ::HANDLE, - hStdOutput: ::HANDLE, - hStdError: ::HANDLE, -}} -pub type LPSTARTUPINFOA = *mut STARTUPINFOA; -STRUCT!{struct STARTUPINFOW { - cb: ::DWORD, - lpReserved: ::LPWSTR, - lpDesktop: ::LPWSTR, - lpTitle: ::LPWSTR, - dwX: ::DWORD, - dwY: ::DWORD, - dwXSize: ::DWORD, - dwYSize: ::DWORD, - dwXCountChars: ::DWORD, - dwYCountChars: ::DWORD, - dwFillAttribute: ::DWORD, - dwFlags: ::DWORD, - wShowWindow: ::WORD, - cbReserved2: ::WORD, - lpReserved2: ::LPBYTE, - hStdInput: ::HANDLE, - hStdOutput: ::HANDLE, - hStdError: ::HANDLE, -}} -pub type LPSTARTUPINFOW = *mut STARTUPINFOW; -STRUCT!{struct PROC_THREAD_ATTRIBUTE_LIST { - dummy: *mut ::c_void, -}} -pub type PPROC_THREAD_ATTRIBUTE_LIST = *mut PROC_THREAD_ATTRIBUTE_LIST; -pub type LPPROC_THREAD_ATTRIBUTE_LIST = *mut PROC_THREAD_ATTRIBUTE_LIST; -ENUM!{enum THREAD_INFORMATION_CLASS { - ThreadMemoryPriority, - ThreadAbsoluteCpuPriority, - ThreadInformationClassMax, -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/propidl.rs cargo-0.37.0/vendor/winapi-0.2.8/src/propidl.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/propidl.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/propidl.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -// Copyright © 2016, Peter Atashian -// Licensed under the MIT License -use super::*; -STRUCT!{struct PROPVARIANT { - vt: VARTYPE, - wReserved1: WORD, - wReserved2: WORD, - wReserved3: WORD, - data: [u8; 16], -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/propsys.rs cargo-0.37.0/vendor/winapi-0.2.8/src/propsys.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/propsys.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/propsys.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -pub type IPropertyDescriptionList = ::IUnknown; // TODO -pub type IPropertyStore = ::IUnknown; // TODO diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/prsht.rs cargo-0.37.0/vendor/winapi-0.2.8/src/prsht.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/prsht.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/prsht.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,262 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! Interface for the Windows Property Sheet Pages -pub enum PSP {} -pub type HPROPSHEETPAGE = *mut PSP; -pub type LPFNPSPCALLBACKA = Option ::UINT>; -pub type LPFNPSPCALLBACKW = Option ::UINT>; -pub const PSP_DEFAULT: ::DWORD = 0x00000000; -pub const PSP_DLGINDIRECT: ::DWORD = 0x00000001; -pub const PSP_USEHICON: ::DWORD = 0x00000002; -pub const PSP_USEICONID: ::DWORD = 0x00000004; -pub const PSP_USETITLE: ::DWORD = 0x00000008; -pub const PSP_RTLREADING: ::DWORD = 0x00000010; -pub const PSP_HASHELP: ::DWORD = 0x00000020; -pub const PSP_USEREFPARENT: ::DWORD = 0x00000040; -pub const PSP_USECALLBACK: ::DWORD = 0x00000080; -pub const PSP_PREMATURE: ::DWORD = 0x00000400; -pub const PSP_HIDEHEADER: ::DWORD = 0x00000800; -pub const PSP_USEHEADERTITLE: ::DWORD = 0x00001000; -pub const PSP_USEHEADERSUBTITLE: ::DWORD = 0x00002000; -pub const PSP_USEFUSIONCONTEXT: ::DWORD = 0x00004000; -pub const PSPCB_ADDREF: ::UINT = 0; -pub const PSPCB_RELEASE: ::UINT = 1; -pub const PSPCB_CREATE: ::UINT = 2; -pub type PROPSHEETPAGE_RESOURCE = ::LPCDLGTEMPLATEA; -STRUCT!{nodebug struct PROPSHEETPAGEA_V4 { - dwSize: ::DWORD, - dwFlags: ::DWORD, - hInstance: ::HINSTANCE, - pszTemplate: ::LPCSTR, - hIcon: ::HICON, - pszTitle: ::LPCSTR, - pfnDlgProc: ::DLGPROC, - lParam: ::LPARAM, - pfnCallback: LPFNPSPCALLBACKA, - pcRefParent: *mut ::UINT, - pszHeaderTitle: ::LPCSTR, - pszHeaderSubTitle: ::LPCSTR, - hActCtx: ::HANDLE, - hbmHeader: ::HBITMAP, -}} -UNION!(PROPSHEETPAGEA_V4, pszTemplate, pResource, pResource_mut, PROPSHEETPAGE_RESOURCE); -UNION!(PROPSHEETPAGEA_V4, hIcon, pszIcon, pszIcon_mut, ::LPCSTR); -UNION!(PROPSHEETPAGEA_V4, hbmHeader, pszbmHeader, pszbmHeader_mut, ::LPCSTR); -pub type LPPROPSHEETPAGEA_V4 = *mut PROPSHEETPAGEA_V4; -pub type LPCPROPSHEETPAGEA_V4 = *const PROPSHEETPAGEA_V4; -STRUCT!{nodebug struct PROPSHEETPAGEW_V4 { - dwSize: ::DWORD, - dwFlags: ::DWORD, - hInstance: ::HINSTANCE, - pszTemplate: ::LPCWSTR, - hIcon: ::HICON, - pszTitle: ::LPCWSTR, - pfnDlgProc: ::DLGPROC, - lParam: ::LPARAM, - pfnCallback: LPFNPSPCALLBACKW, - pcRefParent: *mut ::UINT, - pszHeaderTitle: ::LPCWSTR, - pszHeaderSubTitle: ::LPCWSTR, - hActCtx: ::HANDLE, - hbmHeader: ::HBITMAP, -}} -UNION!(PROPSHEETPAGEW_V4, pszTemplate, pResource, pResource_mut, PROPSHEETPAGE_RESOURCE); -UNION!(PROPSHEETPAGEW_V4, hIcon, pszIcon, pszIcon_mut, ::LPCWSTR); -UNION!(PROPSHEETPAGEW_V4, hbmHeader, pszbmHeader, pszbmHeader_mut, ::LPCWSTR); -pub type LPPROPSHEETPAGEW_V4 = *mut PROPSHEETPAGEW_V4; -pub type LPCPROPSHEETPAGEW_V4 = *const PROPSHEETPAGEW_V4; -pub type PROPSHEETPAGEA_LATEST = PROPSHEETPAGEA_V4; -pub type PROPSHEETPAGEW_LATEST = PROPSHEETPAGEW_V4; -pub type LPPROPSHEETPAGEA_LATEST = LPPROPSHEETPAGEA_V4; -pub type LPPROPSHEETPAGEW_LATEST = LPPROPSHEETPAGEW_V4; -pub type LPCPROPSHEETPAGEA_LATEST = LPCPROPSHEETPAGEA_V4; -pub type LPCPROPSHEETPAGEW_LATEST = LPCPROPSHEETPAGEW_V4; -pub type PROPSHEETPAGEA = PROPSHEETPAGEA_V4; -pub type PROPSHEETPAGEW = PROPSHEETPAGEW_V4; -pub type LPPROPSHEETPAGEA = LPPROPSHEETPAGEA_V4; -pub type LPPROPSHEETPAGEW = LPPROPSHEETPAGEW_V4; -pub type LPCPROPSHEETPAGEA = LPCPROPSHEETPAGEA_V4; -pub type LPCPROPSHEETPAGEW = LPCPROPSHEETPAGEW_V4; -pub const PSH_DEFAULT: ::DWORD = 0x00000000; -pub const PSH_PROPTITLE: ::DWORD = 0x00000001; -pub const PSH_USEHICON: ::DWORD = 0x00000002; -pub const PSH_USEICONID: ::DWORD = 0x00000004; -pub const PSH_PROPSHEETPAGE: ::DWORD = 0x00000008; -pub const PSH_WIZARDHASFINISH: ::DWORD = 0x00000010; -pub const PSH_WIZARD: ::DWORD = 0x00000020; -pub const PSH_USEPSTARTPAGE: ::DWORD = 0x00000040; -pub const PSH_NOAPPLYNOW: ::DWORD = 0x00000080; -pub const PSH_USECALLBACK: ::DWORD = 0x00000100; -pub const PSH_HASHELP: ::DWORD = 0x00000200; -pub const PSH_MODELESS: ::DWORD = 0x00000400; -pub const PSH_RTLREADING: ::DWORD = 0x00000800; -pub const PSH_WIZARDCONTEXTHELP: ::DWORD = 0x00001000; -pub const PSH_WIZARD97: ::DWORD = 0x01000000; -pub const PSH_WATERMARK: ::DWORD = 0x00008000; -pub const PSH_USEHBMWATERMARK: ::DWORD = 0x00010000; -pub const PSH_USEHPLWATERMARK: ::DWORD = 0x00020000; -pub const PSH_STRETCHWATERMARK: ::DWORD = 0x00040000; -pub const PSH_HEADER: ::DWORD = 0x00080000; -pub const PSH_USEHBMHEADER: ::DWORD = 0x00100000; -pub const PSH_USEPAGELANG: ::DWORD = 0x00200000; -pub const PSH_WIZARD_LITE: ::DWORD = 0x00400000; -pub const PSH_NOCONTEXTHELP: ::DWORD = 0x02000000; -pub const PSH_AEROWIZARD: ::DWORD = 0x00004000; -pub const PSH_RESIZABLE: ::DWORD = 0x04000000; -pub const PSH_HEADERBITMAP: ::DWORD = 0x08000000; -pub const PSH_NOMARGIN: ::DWORD = 0x10000000; -pub type PFNPROPSHEETCALLBACK = Option ::c_int>; -STRUCT!{nodebug struct PROPSHEETHEADERA_V2 { - dwSize: ::DWORD, - dwFlags: ::DWORD, - hwndParent: ::HWND, - hInstance: ::HINSTANCE, - hIcon: ::HICON, - pszCaption: ::LPCSTR, - nPages: ::UINT, - pStartPage: ::LPCSTR, - ppsp: LPCPROPSHEETPAGEA, - pfnCallback: PFNPROPSHEETCALLBACK, - hbmWatermark: ::HBITMAP, - hplWatermark: ::HPALETTE, - hbmHeader: ::HBITMAP, -}} -UNION!(PROPSHEETHEADERA_V2, hIcon, pszIcon, pszIcon_mut, ::LPCSTR); -UNION!(PROPSHEETHEADERA_V2, pStartPage, nStartPage, nStartPage_mut, ::UINT); -UNION!(PROPSHEETHEADERA_V2, ppsp, phpage, phpage_mut, *mut HPROPSHEETPAGE); -UNION!(PROPSHEETHEADERA_V2, hbmWatermark, pszbmWatermark, pszbmWatermark_mut, ::LPCSTR); -UNION!(PROPSHEETHEADERA_V2, hbmHeader, pszbmHeader, pszbmHeader_mut, ::LPCSTR); -pub type LPPROPSHEETHEADERA_V2 = *mut PROPSHEETHEADERA_V2; -pub type LPCPROPSHEETHEADERA_V2 = *const PROPSHEETHEADERA_V2; -STRUCT!{nodebug struct PROPSHEETHEADERW_V2 { - dwSize: ::DWORD, - dwFlags: ::DWORD, - hwndParent: ::HWND, - hInstance: ::HINSTANCE, - hIcon: ::HICON, - pszCaption: ::LPCWSTR, - nPages: ::UINT, - pStartPage: ::LPCWSTR, - ppsp: LPCPROPSHEETPAGEW, - pfnCallback: PFNPROPSHEETCALLBACK, - hbmWatermark: ::HBITMAP, - hplWatermark: ::HPALETTE, - hbmHeader: ::HBITMAP, -}} -UNION!(PROPSHEETHEADERW_V2, hIcon, pszIcon, pszIcon_mut, ::LPCWSTR); -UNION!(PROPSHEETHEADERW_V2, pStartPage, nStartPage, nStartPage_mut, ::UINT); -UNION!(PROPSHEETHEADERW_V2, ppsp, phpage, phpage_mut, *mut HPROPSHEETPAGE); -UNION!(PROPSHEETHEADERW_V2, hbmWatermark, pszbmWatermark, pszbmWatermark_mut, ::LPCWSTR); -UNION!(PROPSHEETHEADERW_V2, hbmHeader, pszbmHeader, pszbmHeader_mut, ::LPCWSTR); -pub type LPPROPSHEETHEADERW_V2 = *mut PROPSHEETHEADERW_V2; -pub type LPCPROPSHEETHEADERW_V2 = *const PROPSHEETHEADERW_V2; -pub type PROPSHEETHEADERA = PROPSHEETHEADERA_V2; -pub type PROPSHEETHEADERW = PROPSHEETHEADERW_V2; -pub type LPPROPSHEETHEADERA = LPPROPSHEETHEADERA_V2; -pub type LPPROPSHEETHEADERW = LPPROPSHEETHEADERW_V2; -pub type LPCPROPSHEETHEADERA = LPCPROPSHEETHEADERA_V2; -pub type LPCPROPSHEETHEADERW = LPCPROPSHEETHEADERW_V2; -pub const PSCB_INITIALIZED: ::UINT = 1; -pub const PSCB_PRECREATE: ::UINT = 2; -pub const PSCB_BUTTONPRESSED: ::UINT = 3; -pub type LPFNADDPROPSHEETPAGE = Option ::BOOL>; -pub type LPFNADDPROPSHEETPAGES = Option ::BOOL>; -STRUCT!{struct PSHNOTIFY { - hdr: ::NMHDR, - lParam: ::LPARAM, -}} -pub type LPPSHNOTIFY = *mut PSHNOTIFY; -pub const PSN_FIRST: ::UINT = -200i32 as ::UINT; -pub const PSN_LAST: ::UINT = -299i32 as ::UINT; -pub const PSN_SETACTIVE: ::UINT = PSN_FIRST - 0; -pub const PSN_KILLACTIVE: ::UINT = PSN_FIRST - 1; -pub const PSN_APPLY: ::UINT = PSN_FIRST - 2; -pub const PSN_RESET: ::UINT = PSN_FIRST - 3; -pub const PSN_HELP: ::UINT = PSN_FIRST - 5; -pub const PSN_WIZBACK: ::UINT = PSN_FIRST - 6; -pub const PSN_WIZNEXT: ::UINT = PSN_FIRST - 7; -pub const PSN_WIZFINISH: ::UINT = PSN_FIRST - 8; -pub const PSN_QUERYCANCEL: ::UINT = PSN_FIRST - 9; -pub const PSN_GETOBJECT: ::UINT = PSN_FIRST - 10; -pub const PSN_TRANSLATEACCELERATOR: ::UINT = PSN_FIRST - 12; -pub const PSN_QUERYINITIALFOCUS: ::UINT = PSN_FIRST - 13; -pub const PSNRET_NOERROR: ::LRESULT = 0; -pub const PSNRET_INVALID: ::LRESULT = 1; -pub const PSNRET_INVALID_NOCHANGEPAGE: ::LRESULT = 2; -pub const PSNRET_MESSAGEHANDLED: ::LRESULT = 3; -pub const PSM_SETCURSEL: ::UINT = ::WM_USER + 101; -pub const PSM_REMOVEPAGE: ::UINT = ::WM_USER + 102; -pub const PSM_ADDPAGE: ::UINT = ::WM_USER + 103; -pub const PSM_CHANGED: ::UINT = ::WM_USER + 104; -pub const PSM_RESTARTWINDOWS: ::UINT = ::WM_USER + 105; -pub const PSM_REBOOTSYSTEM: ::UINT = ::WM_USER + 106; -pub const PSM_CANCELTOCLOSE: ::UINT = ::WM_USER + 107; -pub const PSM_QUERYSIBLINGS: ::UINT = ::WM_USER + 108; -pub const PSM_UNCHANGED: ::UINT = ::WM_USER + 109; -pub const PSM_APPLY: ::UINT = ::WM_USER + 110; -pub const PSM_SETTITLEA: ::UINT = ::WM_USER + 111; -pub const PSM_SETTITLEW: ::UINT = ::WM_USER + 120; -pub const PSM_SETWIZBUTTONS: ::UINT = ::WM_USER + 112; -pub const PSWIZB_BACK: ::DWORD = 0x00000001; -pub const PSWIZB_NEXT: ::DWORD = 0x00000002; -pub const PSWIZB_FINISH: ::DWORD = 0x00000004; -pub const PSWIZB_DISABLEDFINISH: ::DWORD = 0x00000008; -pub const PSWIZB_CANCEL: ::DWORD = 0x00000008; -pub const PSWIZBF_ELEVATIONREQUIRED: ::WPARAM = 0x00000001; -pub const PSBTN_BACK: ::c_int = 0; -pub const PSBTN_NEXT: ::c_int = 1; -pub const PSBTN_FINISH: ::c_int = 2; -pub const PSBTN_OK: ::c_int = 3; -pub const PSBTN_APPLYNOW: ::c_int = 4; -pub const PSBTN_CANCEL: ::c_int = 5; -pub const PSBTN_HELP: ::c_int = 6; -pub const PSBTN_MAX: ::c_int = 6; -pub const PSM_PRESSBUTTON: ::UINT = ::WM_USER + 113; -pub const PSM_SETCURSELID: ::UINT = ::WM_USER + 114; -pub const PSM_SETFINISHTEXTA: ::UINT = ::WM_USER + 115; -pub const PSM_SETFINISHTEXTW: ::UINT = ::WM_USER + 121; -pub const PSM_GETTABCONTROL: ::UINT = ::WM_USER + 116; -pub const PSM_ISDIALOGMESSAGE: ::UINT = ::WM_USER + 117; -pub const PSM_GETCURRENTPAGEHWND: ::UINT = ::WM_USER + 118; -pub const PSM_INSERTPAGE: ::UINT = ::WM_USER + 119; -pub const PSM_SETHEADERTITLEA: ::UINT = ::WM_USER + 125; -pub const PSM_SETHEADERTITLEW: ::UINT = ::WM_USER + 126; -pub const PSWIZF_SETCOLOR: ::UINT = (0 - 1) as ::UINT; -pub const PSM_SETHEADERSUBTITLEA: ::UINT = ::WM_USER + 127; -pub const PSM_SETHEADERSUBTITLEW: ::UINT = ::WM_USER + 128; -pub const PSM_HWNDTOINDEX: ::UINT = ::WM_USER + 129; -pub const PSM_INDEXTOHWND: ::UINT = ::WM_USER + 130; -pub const PSM_PAGETOINDEX: ::UINT = ::WM_USER + 131; -pub const PSM_INDEXTOPAGE: ::UINT = ::WM_USER + 132; -pub const PSM_IDTOINDEX: ::UINT = ::WM_USER + 133; -pub const PSM_INDEXTOID: ::UINT = ::WM_USER + 134; -pub const PSM_GETRESULT: ::UINT = ::WM_USER + 135; -pub const PSM_RECALCPAGESIZES: ::UINT = ::WM_USER + 136; -pub const PSM_SETNEXTTEXTW: ::UINT = ::WM_USER + 137; -pub const PSM_SHOWWIZBUTTONS: ::UINT = ::WM_USER + 138; -pub const PSM_ENABLEWIZBUTTONS: ::UINT = ::WM_USER + 139; -pub const PSM_SETBUTTONTEXTW: ::UINT = ::WM_USER + 140; -pub const PSM_SETBUTTONTEXT: ::UINT = PSM_SETBUTTONTEXTW; -pub const ID_PSRESTARTWINDOWS: ::INT_PTR = 0x2; -pub const ID_PSREBOOTSYSTEM: ::INT_PTR = ID_PSRESTARTWINDOWS | 0x1; -pub const WIZ_CXDLG: ::DWORD = 276; -pub const WIZ_CYDLG: ::DWORD = 140; -pub const WIZ_CXBMP: ::DWORD = 80; -pub const WIZ_BODYX: ::DWORD = 92; -pub const WIZ_BODYCX: ::DWORD = 184; -pub const PROP_SM_CXDLG: ::c_short = 212; -pub const PROP_SM_CYDLG: ::c_short = 188; -pub const PROP_MED_CXDLG: ::c_short = 227; -pub const PROP_MED_CYDLG: ::c_short = 215; -pub const PROP_LG_CXDLG: ::c_short = 252; -pub const PROP_LG_CYDLG: ::c_short = 218; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/psapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/psapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/psapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/psapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,166 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! API Prototypes and Definitions for PSAPI.DLL -pub const LIST_MODULES_DEFAULT: ::DWORD = 0x0; -pub const LIST_MODULES_32BIT: ::DWORD = 0x01; -pub const LIST_MODULES_64BIT: ::DWORD = 0x02; -pub const LIST_MODULES_ALL: ::DWORD = LIST_MODULES_32BIT | LIST_MODULES_64BIT; -STRUCT!{struct MODULEINFO { - lpBaseOfDll: ::LPVOID, - SizeOfImage: ::DWORD, - EntryPoint: ::LPVOID, -}} -pub type LPMODULEINFO = *mut MODULEINFO; -STRUCT!{struct PSAPI_WORKING_SET_BLOCK { - Flags: ::ULONG_PTR, - BitFields: ::ULONG_PTR, -}} -#[cfg(target_arch="x86")] -BITFIELD!(PSAPI_WORKING_SET_BLOCK BitFields: ::ULONG_PTR [ - Protection set_Protection[0..5], - ShareCount set_ShareCount[5..8], - Shared set_Shared[8..9], - Reserved set_Reserved[9..12], - VirtualPage set_VirtualPage[12..32], -]); -#[cfg(target_arch="x86_64")] -BITFIELD!(PSAPI_WORKING_SET_BLOCK BitFields: ::ULONG_PTR [ - Protection set_Protection[0..5], - ShareCount set_ShareCount[5..8], - Shared set_Shared[8..9], - Reserved set_Reserved[9..12], - VirtualPage set_VirtualPage[12..64], -]); -pub type PPSAPI_WORKING_SET_BLOCK = *mut PSAPI_WORKING_SET_BLOCK; -STRUCT!{struct PSAPI_WORKING_SET_INFORMATION { - NumberOfEntries: ::ULONG_PTR, - WorkingSetInfo: [PSAPI_WORKING_SET_BLOCK; 1], -}} -pub type PPSAPI_WORKING_SET_INFORMATION = *mut PSAPI_WORKING_SET_INFORMATION; -STRUCT!{struct PSAPI_WORKING_SET_EX_BLOCK_Invalid { - BitFields: ::ULONG_PTR, -}} -#[cfg(target_arch="x86")] -BITFIELD!(PSAPI_WORKING_SET_EX_BLOCK_Invalid BitFields: ::ULONG_PTR [ - Valid set_Valid[0..1], - Reserved0 set_Reserved0[1..15], - Shared set_Shared[15..16], - Reserved1 set_Reserved1[16..31], - Bad set_Bad[31..32], -]); -#[cfg(target_arch="x86_64")] -BITFIELD!(PSAPI_WORKING_SET_EX_BLOCK_Invalid BitFields: ::ULONG_PTR [ - Valid set_Valid[0..1], - Reserved0 set_Reserved0[1..15], - Shared set_Shared[15..16], - Reserved1 set_Reserved1[16..31], - Bad set_Bad[31..32], - ReservedUlong set_ReservedUlong[32..64], -]); -STRUCT!{struct PSAPI_WORKING_SET_EX_BLOCK { - Flags: ::ULONG_PTR, - BitFields: ::ULONG_PTR, -}} -#[cfg(target_arch="x86")] -BITFIELD!(PSAPI_WORKING_SET_EX_BLOCK BitFields: ::ULONG_PTR [ - Valid set_Valid[0..1], - ShareCount set_ShareCount[1..4], - Win32Protection set_Win32Protection[4..15], - Shared set_Shared[15..16], - Node set_Node[16..22], - Locked set_Locked[22..23], - LargePage set_LargePage[23..24], - Reserved set_Reserved[24..31], - Bad set_Bad[31..32], -]); -#[cfg(target_arch="x86_64")] -BITFIELD!(PSAPI_WORKING_SET_EX_BLOCK BitFields: ::ULONG_PTR [ - Valid set_Valid[0..1], - ShareCount set_ShareCount[1..4], - Win32Protection set_Win32Protection[4..15], - Shared set_Shared[15..16], - Node set_Node[16..22], - Locked set_Locked[22..23], - LargePage set_LargePage[23..24], - Reserved set_Reserved[24..31], - Bad set_Bad[31..32], - ReservedUlong set_ReservedUlong[32..64], -]); -UNION!( - PSAPI_WORKING_SET_EX_BLOCK, BitFields, Invalid, Invalid_mut, PSAPI_WORKING_SET_EX_BLOCK_Invalid -); -pub type PPSAPI_WORKING_SET_EX_BLOCK = *mut PSAPI_WORKING_SET_EX_BLOCK; -STRUCT!{struct PSAPI_WORKING_SET_EX_INFORMATION { - VirtualAddress: ::PVOID, - VirtualAttributes: PSAPI_WORKING_SET_EX_BLOCK, -}} -pub type PPSAPI_WORKING_SET_EX_INFORMATION = *mut PSAPI_WORKING_SET_EX_INFORMATION; -STRUCT!{struct PSAPI_WS_WATCH_INFORMATION { - FaultingPc: ::LPVOID, - FaultingVa: ::LPVOID, -}} -pub type PPSAPI_WS_WATCH_INFORMATION = *mut PSAPI_WS_WATCH_INFORMATION; -STRUCT!{struct PSAPI_WS_WATCH_INFORMATION_EX { - BasicInfo: PSAPI_WS_WATCH_INFORMATION, - FaultingThreadId: ::ULONG_PTR, - Flags: ::ULONG_PTR, -}} -pub type PPSAPI_WS_WATCH_INFORMATION_EX = *mut PSAPI_WS_WATCH_INFORMATION_EX; -STRUCT!{struct PROCESS_MEMORY_COUNTERS { - cb: ::DWORD, - PageFaultCount: ::DWORD, - PeakWorkingSetSize: ::SIZE_T, - WorkingSetSize: ::SIZE_T, - QuotaPeakPagedPoolUsage: ::SIZE_T, - QuotaPagedPoolUsage: ::SIZE_T, - QuotaPeakNonPagedPoolUsage: ::SIZE_T, - QuotaNonPagedPoolUsage: ::SIZE_T, - PagefileUsage: ::SIZE_T, - PeakPagefileUsage: ::SIZE_T, -}} -pub type PPROCESS_MEMORY_COUNTERS = *mut PROCESS_MEMORY_COUNTERS; -STRUCT!{struct PROCESS_MEMORY_COUNTERS_EX { - cb: ::DWORD, - PageFaultCount: ::DWORD, - PeakWorkingSetSize: ::SIZE_T, - WorkingSetSize: ::SIZE_T, - QuotaPeakPagedPoolUsage: ::SIZE_T, - QuotaPagedPoolUsage: ::SIZE_T, - QuotaPeakNonPagedPoolUsage: ::SIZE_T, - QuotaNonPagedPoolUsage: ::SIZE_T, - PagefileUsage: ::SIZE_T, - PeakPagefileUsage: ::SIZE_T, - PrivateUsage: ::SIZE_T, -}} -pub type PPROCESS_MEMORY_COUNTERS_EX = *mut PROCESS_MEMORY_COUNTERS_EX; -STRUCT!{struct PERFORMANCE_INFORMATION { - cb: ::DWORD, - CommitTotal: ::SIZE_T, - CommitLimit: ::SIZE_T, - CommitPeak: ::SIZE_T, - PhysicalTotal: ::SIZE_T, - PhysicalAvailable: ::SIZE_T, - SystemCache: ::SIZE_T, - KernelTotal: ::SIZE_T, - KernelPaged: ::SIZE_T, - KernelNonpaged: ::SIZE_T, - PageSize: ::SIZE_T, - HandleCount: ::DWORD, - ProcessCount: ::DWORD, - ThreadCount: ::DWORD, -}} -pub type PPERFORMANCE_INFORMATION = *mut PERFORMANCE_INFORMATION; -STRUCT!{struct ENUM_PAGE_FILE_INFORMATION { - cb: ::DWORD, - Reserved: ::DWORD, - TotalSize: ::SIZE_T, - TotalInUse: ::SIZE_T, - PeakUsage: ::SIZE_T, -}} -pub type PENUM_PAGE_FILE_INFORMATION = *mut ENUM_PAGE_FILE_INFORMATION; -pub type PENUM_PAGE_FILE_CALLBACKA = Option ::BOOL>; -pub type PENUM_PAGE_FILE_CALLBACKW = Option ::BOOL>; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/qos.rs cargo-0.37.0/vendor/winapi-0.2.8/src/qos.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/qos.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/qos.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! QoS definitions for NDIS components. -pub type SERVICETYPE = ::ULONG; -STRUCT!{struct FLOWSPEC { - TokenRate: ::ULONG, - TokenBucketSize: ::ULONG, - PeakBandwidth: ::ULONG, - Latency: ::ULONG, - DelayVariation: ::ULONG, - ServiceType: SERVICETYPE, - MaxSduSize: ::ULONG, - MinimumPolicedSize: ::ULONG, -}} -pub type PFLOWSPEC = *mut FLOWSPEC; -pub type LPFLOWSPEC = *mut FLOWSPEC; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/reason.rs cargo-0.37.0/vendor/winapi-0.2.8/src/reason.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/reason.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/reason.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -// Flags used by the various UIs -pub const SHTDN_REASON_FLAG_COMMENT_REQUIRED: ::DWORD = 0x01000000; -pub const SHTDN_REASON_FLAG_DIRTY_PROBLEM_ID_REQUIRED: ::DWORD = 0x02000000; -pub const SHTDN_REASON_FLAG_CLEAN_UI: ::DWORD = 0x04000000; -pub const SHTDN_REASON_FLAG_DIRTY_UI: ::DWORD = 0x08000000; -// Flags that end up in the event log code. -pub const SHTDN_REASON_FLAG_USER_DEFINED: ::DWORD = 0x40000000; -pub const SHTDN_REASON_FLAG_PLANNED: ::DWORD = 0x80000000; -// Microsoft major reasons. -pub const SHTDN_REASON_MAJOR_OTHER: ::DWORD = 0x00000000; -pub const SHTDN_REASON_MAJOR_NONE: ::DWORD = 0x00000000; -pub const SHTDN_REASON_MAJOR_HARDWARE: ::DWORD = 0x00010000; -pub const SHTDN_REASON_MAJOR_OPERATINGSYSTEM: ::DWORD = 0x00020000; -pub const SHTDN_REASON_MAJOR_SOFTWARE: ::DWORD = 0x00030000; -pub const SHTDN_REASON_MAJOR_APPLICATION: ::DWORD = 0x00040000; -pub const SHTDN_REASON_MAJOR_SYSTEM: ::DWORD = 0x00050000; -pub const SHTDN_REASON_MAJOR_POWER: ::DWORD = 0x00060000; -pub const SHTDN_REASON_MAJOR_LEGACY_API: ::DWORD = 0x00070000; -// Microsoft minor reasons. -pub const SHTDN_REASON_MINOR_OTHER: ::DWORD = 0x00000000; -pub const SHTDN_REASON_MINOR_NONE: ::DWORD = 0x000000ff; -pub const SHTDN_REASON_MINOR_MAINTENANCE: ::DWORD = 0x00000001; -pub const SHTDN_REASON_MINOR_INSTALLATION: ::DWORD = 0x00000002; -pub const SHTDN_REASON_MINOR_UPGRADE: ::DWORD = 0x00000003; -pub const SHTDN_REASON_MINOR_RECONFIG: ::DWORD = 0x00000004; -pub const SHTDN_REASON_MINOR_HUNG: ::DWORD = 0x00000005; -pub const SHTDN_REASON_MINOR_UNSTABLE: ::DWORD = 0x00000006; -pub const SHTDN_REASON_MINOR_DISK: ::DWORD = 0x00000007; -pub const SHTDN_REASON_MINOR_PROCESSOR: ::DWORD = 0x00000008; -pub const SHTDN_REASON_MINOR_NETWORKCARD: ::DWORD = 0x00000009; -pub const SHTDN_REASON_MINOR_POWER_SUPPLY: ::DWORD = 0x0000000a; -pub const SHTDN_REASON_MINOR_CORDUNPLUGGED: ::DWORD = 0x0000000b; -pub const SHTDN_REASON_MINOR_ENVIRONMENT: ::DWORD = 0x0000000c; -pub const SHTDN_REASON_MINOR_HARDWARE_DRIVER: ::DWORD = 0x0000000d; -pub const SHTDN_REASON_MINOR_OTHERDRIVER: ::DWORD = 0x0000000e; -pub const SHTDN_REASON_MINOR_BLUESCREEN: ::DWORD = 0x0000000F; -pub const SHTDN_REASON_MINOR_SERVICEPACK: ::DWORD = 0x00000010; -pub const SHTDN_REASON_MINOR_HOTFIX: ::DWORD = 0x00000011; -pub const SHTDN_REASON_MINOR_SECURITYFIX: ::DWORD = 0x00000012; -pub const SHTDN_REASON_MINOR_SECURITY: ::DWORD = 0x00000013; -pub const SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY: ::DWORD = 0x00000014; -pub const SHTDN_REASON_MINOR_WMI: ::DWORD = 0x00000015; -pub const SHTDN_REASON_MINOR_SERVICEPACK_UNINSTALL: ::DWORD = 0x00000016; -pub const SHTDN_REASON_MINOR_HOTFIX_UNINSTALL: ::DWORD = 0x00000017; -pub const SHTDN_REASON_MINOR_SECURITYFIX_UNINSTALL: ::DWORD = 0x00000018; -pub const SHTDN_REASON_MINOR_MMC: ::DWORD = 0x00000019; -pub const SHTDN_REASON_MINOR_SYSTEMRESTORE: ::DWORD = 0x0000001a; -pub const SHTDN_REASON_MINOR_TERMSRV: ::DWORD = 0x00000020; -pub const SHTDN_REASON_MINOR_DC_PROMOTION: ::DWORD = 0x00000021; -pub const SHTDN_REASON_MINOR_DC_DEMOTION: ::DWORD = 0x00000022; -pub const SHTDN_REASON_UNKNOWN: ::DWORD = SHTDN_REASON_MINOR_NONE; -pub const SHTDN_REASON_LEGACY_API: ::DWORD = - (SHTDN_REASON_MAJOR_LEGACY_API | SHTDN_REASON_FLAG_PLANNED); -// This mask cuts out UI flags. -pub const SHTDN_REASON_VALID_BIT_MASK: ::DWORD = 0xc0ffffff; -// Convenience flags. -pub const PCLEANUI: ::DWORD = (SHTDN_REASON_FLAG_PLANNED | SHTDN_REASON_FLAG_CLEAN_UI); -pub const UCLEANUI: ::DWORD = (SHTDN_REASON_FLAG_CLEAN_UI); -pub const PDIRTYUI: ::DWORD = (SHTDN_REASON_FLAG_PLANNED | SHTDN_REASON_FLAG_DIRTY_UI); -pub const UDIRTYUI: ::DWORD = (SHTDN_REASON_FLAG_DIRTY_UI); -//89 diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/restrictederrorinfo.rs cargo-0.37.0/vendor/winapi-0.2.8/src/restrictederrorinfo.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/restrictederrorinfo.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/restrictederrorinfo.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -RIDL!( -interface IRestrictedErrorInfo(IRestrictedErrorInfoVtbl): IUnknown(IUnknownVtbl) { - fn GetErrorDetails( - &mut self, description: *mut ::BSTR, error: *mut ::HRESULT, - restrictedDescription: *mut ::BSTR, capabilitySid: *mut ::BSTR - ) -> ::HRESULT, - fn GetReference(&mut self, reference: *mut ::BSTR) -> ::HRESULT -} -); diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/roapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/roapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/roapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/roapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -ENUM!{enum RO_INIT_TYPE { - RO_INIT_SINGLETHREADED = 0, - RO_INIT_MULTITHREADED = 1, -}} - -pub enum RO_REGISTRATION_COOKIE__{} -pub type RO_REGISTRATION_COOKIE = *mut RO_REGISTRATION_COOKIE__; - -pub type PFNGETACTIVATIONFACTORY = Option ::HRESULT>; - -DECLARE_HANDLE!(APARTMENT_SHUTDOWN_REGISTRATION_COOKIE, APARTMENT_SHUTDOWN_REGISTRATION_COOKIE__); diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/roerrorapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/roerrorapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/roerrorapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/roerrorapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -FLAGS!{enum RO_ERROR_REPORTING_FLAGS { - RO_ERROR_REPORTING_NONE = 0x00000000, - RO_ERROR_REPORTING_SUPPRESSEXCEPTIONS = 0x00000001, - RO_ERROR_REPORTING_FORCEEXCEPTIONS = 0x00000002, - RO_ERROR_REPORTING_USESETERRORINFO = 0x00000004, - RO_ERROR_REPORTING_SUPPRESSSETERRORINFO = 0x00000008, -}} - -pub type PINSPECT_MEMORY_CALLBACK = Option ::HRESULT>; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/rpcdce.rs cargo-0.37.0/vendor/winapi-0.2.8/src/rpcdce.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/rpcdce.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/rpcdce.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,535 +0,0 @@ -// Copyright © 2015, Brian Vincent -// Licensed under the MIT License -// This module contains the DCE RPC runtime APIs. -pub type RPC_CSTR = *mut ::c_uchar; -pub type RPC_WSTR = *mut ::wchar_t; -pub type RPC_CWSTR = *const ::wchar_t; -pub type RPC_BINDING_HANDLE = ::I_RPC_HANDLE; -pub type handle_t = RPC_BINDING_HANDLE; -pub type rpc_binding_handle_t = RPC_BINDING_HANDLE; -pub type UUID = ::GUID; -pub type uuid_t = UUID; -STRUCT!{struct RPC_BINDING_VECTOR { - Count: ::c_ulong, - BindingH: [RPC_BINDING_HANDLE; 1], -}} -pub type rpc_binding_vector_t = RPC_BINDING_VECTOR; -STRUCT!{struct UUID_VECTOR { - Count: ::c_ulong, - Uuid: [*mut UUID; 1], -}} -pub type uuid_vector_t = UUID_VECTOR; -pub type RPC_IF_HANDLE = *mut ::c_void; -STRUCT!{struct RPC_IF_ID { - Uuid: UUID, - VersMajor: ::c_ushort, - VersMinor: ::c_ushort, -}} -pub const RPC_C_BINDING_INFINITE_TIMEOUT: ::DWORD = 10; -pub const RPC_C_BINDING_MIN_TIMEOUT: ::DWORD = 0; -pub const RPC_C_BINDING_DEFAULT_TIMEOUT: ::DWORD = 5; -pub const RPC_C_BINDING_MAX_TIMEOUT: ::DWORD = 9; -pub const RPC_C_CANCEL_INFINITE_TIMEOUT: ::c_int = -1; -pub const RPC_C_LISTEN_MAX_CALLS_DEFAULT: ::DWORD = 1234; -pub const RPC_C_PROTSEQ_MAX_REQS_DEFAULT: ::DWORD = 10; -pub const RPC_C_BIND_TO_ALL_NICS: ::DWORD = 1; -pub const RPC_C_USE_INTERNET_PORT: ::DWORD = 0x1; -pub const RPC_C_USE_INTRANET_PORT: ::DWORD = 0x2; -pub const RPC_C_DONT_FAIL: ::DWORD = 0x4; -pub const RPC_C_RPCHTTP_USE_LOAD_BALANCE: ::DWORD = 0x8; -pub const RPC_C_MQ_TEMPORARY: ::DWORD = 0x0000; -pub const RPC_C_MQ_PERMANENT: ::DWORD = 0x0001; -pub const RPC_C_MQ_CLEAR_ON_OPEN: ::DWORD = 0x0002; -pub const RPC_C_MQ_USE_EXISTING_SECURITY: ::DWORD = 0x0004; -pub const RPC_C_MQ_AUTHN_LEVEL_NONE: ::DWORD = 0x0000; -pub const RPC_C_MQ_AUTHN_LEVEL_PKT_INTEGRITY: ::DWORD = 0x0008; -pub const RPC_C_MQ_AUTHN_LEVEL_PKT_PRIVACY: ::DWORD = 0x0010; -pub const RPC_C_OPT_MQ_DELIVERY: ::DWORD = 1; -pub const RPC_C_OPT_MQ_PRIORITY: ::DWORD = 2; -pub const RPC_C_OPT_MQ_JOURNAL: ::DWORD = 3; -pub const RPC_C_OPT_MQ_ACKNOWLEDGE: ::DWORD = 4; -pub const RPC_C_OPT_MQ_AUTHN_SERVICE: ::DWORD = 5; -pub const RPC_C_OPT_MQ_AUTHN_LEVEL: ::DWORD = 6; -pub const RPC_C_OPT_MQ_TIME_TO_REACH_QUEUE: ::DWORD = 7; -pub const RPC_C_OPT_MQ_TIME_TO_BE_RECEIVED: ::DWORD = 8; -pub const RPC_C_OPT_BINDING_NONCAUSAL: ::DWORD = 9; -pub const RPC_C_OPT_SECURITY_CALLBACK: ::DWORD = 10; -pub const RPC_C_OPT_UNIQUE_BINDING: ::DWORD = 11; -pub const RPC_C_OPT_CALL_TIMEOUT: ::DWORD = 12; -pub const RPC_C_OPT_DONT_LINGER: ::DWORD = 13; -pub const RPC_C_OPT_TRUST_PEER: ::DWORD = 14; -pub const RPC_C_OPT_ASYNC_BLOCK: ::DWORD = 15; -pub const RPC_C_OPT_OPTIMIZE_TIME: ::DWORD = 16; -pub const RPC_C_OPT_MAX_OPTIONS: ::DWORD = 17; -pub const RPC_C_MQ_EXPRESS: ::DWORD = 0; -pub const RPC_C_MQ_RECOVERABLE: ::DWORD = 1; -pub const RPC_C_MQ_JOURNAL_NONE: ::DWORD = 0; -pub const RPC_C_MQ_JOURNAL_DEADLETTER: ::DWORD = 1; -pub const RPC_C_MQ_JOURNAL_ALWAYS: ::DWORD = 2; -pub const RPC_C_FULL_CERT_CHAIN: ::DWORD = 0x0001; -STRUCT!{struct RPC_PROTSEQ_VECTORA { - Count: ::c_uint, - Protseq: [*mut ::c_uchar; 1], -}} -STRUCT!{struct RPC_PROTSEQ_VECTORW { - Count: ::c_uint, - Protseq: [*mut ::c_ushort; 1], -}} -STRUCT!{struct RPC_POLICY { - Length: ::c_uint, - EndpointFlags: ::c_ulong, - NICFlags: ::c_ulong, -}} -pub type PRPC_POLICY = *mut RPC_POLICY; -pub type RPC_OBJECT_INQ_FN = Option; -pub type RPC_IF_CALLBACK_FN = Option ::RPC_STATUS>; -pub type RPC_SECURITY_CALLBACK_FN = Option; -pub type RPC_MGR_EPV = ::c_void; -STRUCT!{struct RPC_STATS_VECTOR { - Count: ::c_uint, - Stats: [::c_ulong; 1], -}} -pub const RPC_C_STATS_CALLS_IN: ::c_ulong = 0; -pub const RPC_C_STATS_CALLS_OUT: ::c_ulong = 1; -pub const RPC_C_STATS_PKTS_IN: ::c_ulong = 2; -pub const RPC_C_STATS_PKTS_OUT: ::c_ulong = 3; -STRUCT!{struct RPC_IF_ID_VECTOR { - Count: ::c_ulong, - IfId: [*mut RPC_IF_ID; 1], -}} -pub type RPC_AUTH_IDENTITY_HANDLE = *mut ::c_void; -pub type RPC_AUTHZ_HANDLE = *mut ::c_void; -pub const RPC_C_AUTHN_LEVEL_DEFAULT: ::DWORD = 0; -pub const RPC_C_AUTHN_LEVEL_NONE: ::DWORD = 1; -pub const RPC_C_AUTHN_LEVEL_CONNECT: ::DWORD = 2; -pub const RPC_C_AUTHN_LEVEL_CALL: ::DWORD = 3; -pub const RPC_C_AUTHN_LEVEL_PKT: ::DWORD = 4; -pub const RPC_C_AUTHN_LEVEL_PKT_INTEGRITY: ::DWORD = 5; -pub const RPC_C_AUTHN_LEVEL_PKT_PRIVACY: ::DWORD = 6; -pub const RPC_C_IMP_LEVEL_DEFAULT: ::DWORD = 0; -pub const RPC_C_IMP_LEVEL_ANONYMOUS: ::DWORD = 1; -pub const RPC_C_IMP_LEVEL_IDENTIFY: ::DWORD = 2; -pub const RPC_C_IMP_LEVEL_IMPERSONATE: ::DWORD = 3; -pub const RPC_C_IMP_LEVEL_DELEGATE: ::DWORD = 4; -pub const RPC_C_QOS_IDENTITY_STATIC: ::DWORD = 0; -pub const RPC_C_QOS_IDENTITY_DYNAMIC: ::DWORD = 1; -pub const RPC_C_QOS_CAPABILITIES_DEFAULT: ::DWORD = 0x0; -pub const RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH: ::DWORD = 0x1; -pub const RPC_C_QOS_CAPABILITIES_MAKE_FULLSIC: ::DWORD = 0x2; -pub const RPC_C_QOS_CAPABILITIES_ANY_AUTHORITY: ::DWORD = 0x4; -pub const RPC_C_QOS_CAPABILITIES_IGNORE_DELEGATE_FAILURE: ::DWORD = 0x8; -pub const RPC_C_QOS_CAPABILITIES_LOCAL_MA_HINT: ::DWORD = 0x10; -pub const RPC_C_QOS_CAPABILITIES_SCHANNEL_FULL_AUTH_IDENTITY: ::DWORD = 0x20; -pub const RPC_C_PROTECT_LEVEL_DEFAULT: ::DWORD = RPC_C_AUTHN_LEVEL_DEFAULT; -pub const RPC_C_PROTECT_LEVEL_NONE: ::DWORD = RPC_C_AUTHN_LEVEL_NONE; -pub const RPC_C_PROTECT_LEVEL_CONNECT: ::DWORD = RPC_C_AUTHN_LEVEL_CONNECT; -pub const RPC_C_PROTECT_LEVEL_CALL: ::DWORD = RPC_C_AUTHN_LEVEL_CALL; -pub const RPC_C_PROTECT_LEVEL_PKT: ::DWORD = RPC_C_AUTHN_LEVEL_PKT; -pub const RPC_C_PROTECT_LEVEL_PKT_INTEGRITY: ::DWORD = RPC_C_AUTHN_LEVEL_PKT_INTEGRITY; -pub const RPC_C_PROTECT_LEVEL_PKT_PRIVACY: ::DWORD = RPC_C_AUTHN_LEVEL_PKT_PRIVACY; -pub const RPC_C_AUTHN_NONE: ::DWORD = 0; -pub const RPC_C_AUTHN_DCE_PRIVATE: ::DWORD = 1; -pub const RPC_C_AUTHN_DCE_PUBLIC: ::DWORD = 2; -pub const RPC_C_AUTHN_DEC_PUBLIC: ::DWORD = 4; -pub const RPC_C_AUTHN_GSS_NEGOTIATE: ::DWORD = 9; -pub const RPC_C_AUTHN_WINNT: ::DWORD = 10; -pub const RPC_C_AUTHN_GSS_SCHANNEL: ::DWORD = 14; -pub const RPC_C_AUTHN_GSS_KERBEROS: ::DWORD = 16; -pub const RPC_C_AUTHN_DPA: ::DWORD = 17; -pub const RPC_C_AUTHN_MSN: ::DWORD = 18; -pub const RPC_C_AUTHN_DIGEST: ::DWORD = 21; -pub const RPC_C_AUTHN_KERNEL: ::DWORD = 20; -pub const RPC_C_AUTHN_NEGO_EXTENDER: ::DWORD = 30; -pub const RPC_C_AUTHN_PKU2U: ::DWORD = 31; -pub const RPC_C_AUTHN_LIVE_SSP: ::DWORD = 32; -pub const RPC_C_AUTHN_LIVEXP_SSP: ::DWORD = 35; -pub const RPC_C_AUTHN_MSONLINE: ::DWORD = 82; -pub const RPC_C_AUTHN_MQ: ::DWORD = 100; -pub const RPC_C_AUTHN_DEFAULT: ::DWORD = 0xFFFFFFFF; -pub const RPC_C_NO_CREDENTIALS: ::DWORD = 0xFFFFFFFF; -pub const RPC_C_SECURITY_QOS_VERSION: ::DWORD = 1; -pub const RPC_C_SECURITY_QOS_VERSION_1: ::DWORD = 1; -STRUCT!{struct RPC_SECURITY_QOS { - Version: ::c_ulong, - Capabilities: ::c_ulong, - IdentityTracking: ::c_ulong, - ImpersonationType: ::c_ulong, -}} -pub type PRPC_SECURITY_QOS = *mut RPC_SECURITY_QOS; -STRUCT!{struct SEC_WINNT_AUTH_IDENTITY_W { - User: *mut ::c_ushort, - UserLength: ::c_ulong, - Domain: *mut ::c_ushort, - DomainLength: ::c_ulong, - Password: *mut ::c_ushort, - PasswordLength: ::c_ulong, - Flags: ::c_ulong, -}} -pub type PSEC_WINNT_AUTH_IDENTITY_W = *mut SEC_WINNT_AUTH_IDENTITY_W; -STRUCT!{struct SEC_WINNT_AUTH_IDENTITY_A { - User: *mut ::c_uchar, - UserLength: ::c_ulong, - Domain: *mut ::c_uchar, - DomainLength: ::c_ulong, - Password: *mut ::c_uchar, - PasswordLength: ::c_ulong, - Flags: ::c_ulong, -}} -pub type PSEC_WINNT_AUTH_IDENTITY_A = *mut SEC_WINNT_AUTH_IDENTITY_A; -pub const RPC_C_AUTHN_INFO_TYPE_HTTP: ::c_ulong = 1; -pub const RPC_C_HTTP_AUTHN_TARGET_SERVER: ::c_ulong = 1; -pub const RPC_C_HTTP_AUTHN_TARGET_PROXY: ::c_ulong = 2; -pub const RPC_C_HTTP_AUTHN_SCHEME_BASIC: ::c_ulong = 0x00000001; -pub const RPC_C_HTTP_AUTHN_SCHEME_NTLM: ::c_ulong = 0x00000002; -pub const RPC_C_HTTP_AUTHN_SCHEME_PASSPORT: ::c_ulong = 0x00000004; -pub const RPC_C_HTTP_AUTHN_SCHEME_DIGEST: ::c_ulong = 0x00000008; -pub const RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE: ::c_ulong = 0x00000010; -pub const RPC_C_HTTP_AUTHN_SCHEME_CERT: ::c_ulong = 0x00010000; -pub const RPC_C_HTTP_FLAG_USE_SSL: ::c_ulong = 1; -pub const RPC_C_HTTP_FLAG_USE_FIRST_AUTH_SCHEME: ::c_ulong = 2; -pub const RPC_C_HTTP_FLAG_IGNORE_CERT_CN_INVALID: ::c_ulong = 8; -pub const RPC_C_HTTP_FLAG_ENABLE_CERT_REVOCATION_CHECK: ::c_ulong = 16; -STRUCT!{struct RPC_HTTP_TRANSPORT_CREDENTIALS_W { - TransportCredentials: *mut SEC_WINNT_AUTH_IDENTITY_W, - Flags: ::c_ulong, - AuthenticationTarget: ::c_ulong, - NumberOfAuthnSchemes: ::c_ulong, - AuthnSchemes: *mut ::c_ulong, - ServerCertificateSubject: *mut ::c_ushort, -}} -pub type PRPC_HTTP_TRANSPORT_CREDENTIALS_W = *mut RPC_HTTP_TRANSPORT_CREDENTIALS_W; -STRUCT!{struct RPC_HTTP_TRANSPORT_CREDENTIALS_A { - TransportCredentials: *mut SEC_WINNT_AUTH_IDENTITY_A, - Flags: ::c_ulong, - AuthenticationTarget: ::c_ulong, - NumberOfAuthnSchemes: ::c_ulong, - AuthnSchemes: *mut ::c_ulong, - ServerCertificateSubject: *mut ::c_uchar, -}} -pub type PRPC_HTTP_TRANSPORT_CREDENTIALS_A = *mut RPC_HTTP_TRANSPORT_CREDENTIALS_A; -STRUCT!{struct RPC_HTTP_TRANSPORT_CREDENTIALS_V2_W { - TransportCredentials: *mut SEC_WINNT_AUTH_IDENTITY_W, - Flags: ::c_ulong, - AuthenticationTarget: ::c_ulong, - NumberOfAuthnSchemes: ::c_ulong, - AuthnSchemes: *mut ::c_ulong, - ServerCertificateSubject: *mut ::c_ushort, - ProxyCredentials: *mut SEC_WINNT_AUTH_IDENTITY_W, - NumberOfProxyAuthnSchemes: ::c_ulong, - ProxyAuthnSchemes: *mut ::c_ulong, -}} -pub type PRPC_HTTP_TRANSPORT_CREDENTIALS_V2_W = *mut RPC_HTTP_TRANSPORT_CREDENTIALS_V2_W; -STRUCT!{struct RPC_HTTP_TRANSPORT_CREDENTIALS_V2_A { - TransportCredentials: *mut SEC_WINNT_AUTH_IDENTITY_A, - Flags: ::c_ulong, - AuthenticationTarget: ::c_ulong, - NumberOfAuthnSchemes: ::c_ulong, - AuthnSchemes: *mut ::c_ulong, - ServerCertificateSubject: *mut ::c_uchar, - ProxyCredentials: *mut SEC_WINNT_AUTH_IDENTITY_A, - NumberOfProxyAuthnSchemes: ::c_ulong, - ProxyAuthnSchemes: *mut ::c_ulong, -}} -pub type PRPC_HTTP_TRANSPORT_CREDENTIALS_V2_A = *mut RPC_HTTP_TRANSPORT_CREDENTIALS_V2_A; -STRUCT!{struct RPC_HTTP_TRANSPORT_CREDENTIALS_V3_W { - TransportCredentials: RPC_AUTH_IDENTITY_HANDLE, - Flags: ::c_ulong, - AuthenticationTarget: ::c_ulong, - NumberOfAuthnSchemes: ::c_ulong, - AuthnSchemes: *mut ::c_ulong, - ServerCertificateSubject: *mut ::c_ushort, - ProxyCredentials: *mut RPC_AUTH_IDENTITY_HANDLE, - NumberOfProxyAuthnSchemes: ::c_ulong, - ProxyAuthnSchemes: *mut ::c_ulong, -}} -pub type PRPC_HTTP_TRANSPORT_CREDENTIALS_V3_W = *mut RPC_HTTP_TRANSPORT_CREDENTIALS_V3_W; -STRUCT!{struct RPC_HTTP_TRANSPORT_CREDENTIALS_V3_A { - TransportCredentials: RPC_AUTH_IDENTITY_HANDLE, - Flags: ::c_ulong, - AuthenticationTarget: ::c_ulong, - NumberOfAuthnSchemes: ::c_ulong, - AuthnSchemes: *mut ::c_ulong, - ServerCertificateSubject: *mut ::c_uchar, - ProxyCredentials: *mut RPC_AUTH_IDENTITY_HANDLE, - NumberOfProxyAuthnSchemes: ::c_ulong, - ProxyAuthnSchemes: *mut ::c_ulong, -}} -pub type PRPC_HTTP_TRANSPORT_CREDENTIALS_V3_A = *mut RPC_HTTP_TRANSPORT_CREDENTIALS_V3_A; -STRUCT!{struct RPC_SECURITY_QOS_V2_W_union { - HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_W, -}} -STRUCT!{struct RPC_SECURITY_QOS_V2_W { - Version: ::c_ulong, - Capabilities: ::c_ulong, - IdentityTracking: ::c_ulong, - ImpersonationType: ::c_ulong, - AdditionalSecurityInfoType: ::c_ulong, - u: RPC_SECURITY_QOS_V2_W_union, -}} -pub type PRPC_SECURITY_QOS_V2_W = *mut RPC_SECURITY_QOS_V2_W; -STRUCT!{struct RPC_SECURITY_QOS_V2_A_union { - HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_A, -}} -STRUCT!{struct RPC_SECURITY_QOS_V2_A { - Version: ::c_ulong, - Capabilities: ::c_ulong, - IdentityTracking: ::c_ulong, - ImpersonationType: ::c_ulong, - AdditionalSecurityInfoType: ::c_ulong, - u: RPC_SECURITY_QOS_V2_A_union, -}} -pub type PRPC_SECURITY_QOS_V2_A = *mut RPC_SECURITY_QOS_V2_A; -STRUCT!{struct RPC_SECURITY_QOS_V3_W_union { - HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_W, -}} -STRUCT!{struct RPC_SECURITY_QOS_V3_W { - Version: ::c_ulong, - Capabilities: ::c_ulong, - IdentityTracking: ::c_ulong, - ImpersonationType: ::c_ulong, - AdditionalSecurityInfoType: ::c_ulong, - u: RPC_SECURITY_QOS_V3_W_union, - Sid: *mut ::c_void, -}} -pub type PRPC_SECURITY_QOS_V3_W = *mut RPC_SECURITY_QOS_V3_W; -STRUCT!{struct RPC_SECURITY_QOS_V3_A_union { - HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_A, -}} -STRUCT!{struct RPC_SECURITY_QOS_V3_A { - Version: ::c_ulong, - Capabilities: ::c_ulong, - IdentityTracking: ::c_ulong, - ImpersonationType: ::c_ulong, - AdditionalSecurityInfoType: ::c_ulong, - u: RPC_SECURITY_QOS_V3_A_union, - Sid: *mut ::c_void, -}} -pub type PRPC_SECURITY_QOS_V3_A = *mut RPC_SECURITY_QOS_V3_A; -STRUCT!{struct RPC_SECURITY_QOS_V4_W_union { - HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_W, -}} -STRUCT!{struct RPC_SECURITY_QOS_V4_W { - Version: ::c_ulong, - Capabilities: ::c_ulong, - IdentityTracking: ::c_ulong, - ImpersonationType: ::c_ulong, - AdditionalSecurityInfoType: ::c_ulong, - u: RPC_SECURITY_QOS_V4_W_union, - Sid: *mut ::c_void, - EffectiveOnly: ::c_uint, -}} -pub type PRPC_SECURITY_QOS_V4_W = *mut RPC_SECURITY_QOS_V4_W; -STRUCT!{struct RPC_SECURITY_QOS_V4_A_union { - HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_A, -}} -STRUCT!{struct RPC_SECURITY_QOS_V4_A { - Version: ::c_ulong, - Capabilities: ::c_ulong, - IdentityTracking: ::c_ulong, - ImpersonationType: ::c_ulong, - AdditionalSecurityInfoType: ::c_ulong, - u: RPC_SECURITY_QOS_V4_A_union, - Sid: *mut ::c_void, - EffectiveOnly: ::c_uint, -}} -pub type PRPC_SECURITY_QOS_V4_A = *mut RPC_SECURITY_QOS_V4_A; -STRUCT!{struct RPC_SECURITY_QOS_V5_W_union { - HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_W, -}} -STRUCT!{struct RPC_SECURITY_QOS_V5_W { - Version: ::c_ulong, - Capabilities: ::c_ulong, - IdentityTracking: ::c_ulong, - ImpersonationType: ::c_ulong, - AdditionalSecurityInfoType: ::c_ulong, - u: RPC_SECURITY_QOS_V5_W_union, - Sid: *mut ::c_void, - EffectiveOnly: ::c_uint, - ServerSecurityDescriptor: *mut ::c_void, -}} -pub type PRPC_SECURITY_QOS_V5_W = *mut RPC_SECURITY_QOS_V5_W; -STRUCT!{struct RPC_SECURITY_QOS_V5_A_union { - HttpCredentials: *mut RPC_HTTP_TRANSPORT_CREDENTIALS_A, -}} -STRUCT!{struct RPC_SECURITY_QOS_V5_A { - Version: ::c_ulong, - Capabilities: ::c_ulong, - IdentityTracking: ::c_ulong, - ImpersonationType: ::c_ulong, - AdditionalSecurityInfoType: ::c_ulong, - u: RPC_SECURITY_QOS_V5_A_union, - Sid: *mut ::c_void, - EffectiveOnly: ::c_uint, - ServerSecurityDescriptor: *mut ::c_void, -}} -pub type PRPC_SECURITY_QOS_V5_A = *mut RPC_SECURITY_QOS_V5_A; -pub const RPC_PROTSEQ_TCP: ::c_ulong = 0x1; -pub const RPC_PROTSEQ_NMP: ::c_ulong = 0x2; -pub const RPC_PROTSEQ_LRPC: ::c_ulong = 0x3; -pub const RPC_PROTSEQ_HTTP: ::c_ulong = 0x4; -pub const RPC_BHT_OBJECT_UUID_VALID: ::c_ulong = 0x1; -pub const RPC_BHO_NONCAUSAL: ::c_ulong = 0x1; -pub const RPC_BHO_DONTLINGER: ::c_ulong = 0x2; -pub const RPC_BHO_EXCLUSIVE_AND_GUARANTEED: ::c_ulong = 0x4; -STRUCT!{struct RPC_BINDING_HANDLE_TEMPLATE_V1_W_union { - Reserved: *mut ::c_ushort, -}} -STRUCT!{struct RPC_BINDING_HANDLE_TEMPLATE_V1_W { - Version: ::c_ulong, - Flags: ::c_ulong, - ProtocolSequence: ::c_ulong, - NetworkAddress: *mut ::c_ushort, - StringEndpoint: *mut ::c_ushort, - u1: RPC_BINDING_HANDLE_TEMPLATE_V1_W_union, - ObjectUuid: UUID, -}} -pub type PRPC_BINDING_HANDLE_TEMPLATE_V1_W = *mut RPC_BINDING_HANDLE_TEMPLATE_V1_W; -STRUCT!{struct RPC_BINDING_HANDLE_TEMPLATE_V1_A_union { - Reserved: *mut ::c_uchar, -}} -STRUCT!{struct RPC_BINDING_HANDLE_TEMPLATE_V1_A { - Version: ::c_ulong, - Flags: ::c_ulong, - ProtocolSequence: ::c_ulong, - NetworkAddress: *mut ::c_uchar, - StringEndpoint: *mut ::c_uchar, - u1: RPC_BINDING_HANDLE_TEMPLATE_V1_A_union, - ObjectUuid: UUID, -}} -pub type PRPC_BINDING_HANDLE_TEMPLATE_V1_A = *mut RPC_BINDING_HANDLE_TEMPLATE_V1_A; -STRUCT!{struct RPC_BINDING_HANDLE_SECURITY_V1_W { - Version: ::c_ulong, - ServerPrincName: *mut ::c_ushort, - AuthnLevel: ::c_ulong, - AuthnSvc: ::c_ulong, - AuthIdentity: *mut SEC_WINNT_AUTH_IDENTITY_W, - SecurityQos: *mut RPC_SECURITY_QOS, -}} -pub type PRPC_BINDING_HANDLE_SECURITY_V1_W = *mut RPC_BINDING_HANDLE_SECURITY_V1_W; -STRUCT!{struct RPC_BINDING_HANDLE_SECURITY_V1_A { - Version: ::c_ulong, - ServerPrincName: *mut ::c_uchar, - AuthnLevel: ::c_ulong, - AuthnSvc: ::c_ulong, - AuthIdentity: *mut SEC_WINNT_AUTH_IDENTITY_A, - SecurityQos: *mut RPC_SECURITY_QOS, -}} -pub type PRPC_BINDING_HANDLE_SECURITY_V1_A = *mut RPC_BINDING_HANDLE_SECURITY_V1_A; -STRUCT!{struct RPC_BINDING_HANDLE_OPTIONS_V1 { - Version: ::c_ulong, - Flags: ::c_ulong, - ComTimeout: ::c_ulong, - CallTimeout: ::c_ulong, -}} -pub type PRPC_BINDING_HANDLE_OPTIONS_V1 = *mut RPC_BINDING_HANDLE_OPTIONS_V1; -ENUM!{enum RPC_HTTP_REDIRECTOR_STAGE { - RPCHTTP_RS_REDIRECT = 1, - RPCHTTP_RS_ACCESS_1, - RPCHTTP_RS_SESSION, - RPCHTTP_RS_ACCESS_2, - RPCHTTP_RS_INTERFACE, -}} -pub type RPC_NEW_HTTP_PROXY_CHANNEL = Option ::RPC_STATUS>; -pub type RPC_HTTP_PROXY_FREE_STRING = Option; -pub const RPC_C_AUTHZ_NONE: ::DWORD = 0; -pub const RPC_C_AUTHZ_NAME: ::DWORD = 1; -pub const RPC_C_AUTHZ_DCE: ::DWORD = 2; -pub const RPC_C_AUTHZ_DEFAULT: ::DWORD = 0xffffffff; -pub type RPC_AUTH_KEY_RETRIEVAL_FN = Option; -STRUCT!{struct RPC_CLIENT_INFORMATION1 { - UserName: *mut ::c_uchar, - ComputerName: *mut ::c_uchar, - Privilege: ::c_ushort, - AuthFlags: ::c_ulong, -}} -pub type PRPC_CLIENT_INFORMATION1 = *mut RPC_CLIENT_INFORMATION1; -pub type RPC_EP_INQ_HANDLE = *mut ::I_RPC_HANDLE; -pub const RPC_C_EP_ALL_ELTS: ::c_ulong = 0; -pub const RPC_C_EP_MATCH_BY_IF: ::c_ulong = 1; -pub const RPC_C_EP_MATCH_BY_OBJ: ::c_ulong = 2; -pub const RPC_C_EP_MATCH_BY_BOTH: ::c_ulong = 3; -pub const RPC_C_VERS_ALL: ::c_ulong = 1; -pub const RPC_C_VERS_COMPATIBLE: ::c_ulong = 2; -pub const RPC_C_VERS_EXACT: ::c_ulong = 3; -pub const RPC_C_VERS_MAJOR_ONLY: ::c_ulong = 4; -pub const RPC_C_VERS_UPTO: ::c_ulong = 5; -pub type RPC_MGMT_AUTHORIZATION_FN = Option ::c_int>; -pub const RPC_C_MGMT_INQ_IF_IDS: ::c_ulong = 0; -pub const RPC_C_MGMT_INQ_PRINC_NAME: ::c_ulong = 1; -pub const RPC_C_MGMT_INQ_STATS: ::c_ulong = 2; -pub const RPC_C_MGMT_IS_SERVER_LISTEN: ::c_ulong = 3; -pub const RPC_C_MGMT_STOP_SERVER_LISTEN: ::c_ulong = 4; -pub const RPC_IF_AUTOLISTEN: ::c_uint = 0x0001; -pub const RPC_IF_OLE: ::c_uint = 0x0002; -pub const RPC_IF_ALLOW_UNKNOWN_AUTHORITY: ::c_uint = 0x0004; -pub const RPC_IF_ALLOW_SECURE_ONLY: ::c_uint = 0x0008; -pub const RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH: ::c_uint = 0x0010; -pub const RPC_IF_ALLOW_LOCAL_ONLY: ::c_uint = 0x0020; -pub const RPC_IF_SEC_NO_CACHE: ::c_uint = 0x0040; -pub const RPC_IF_SEC_CACHE_PER_PROC: ::c_uint = 0x0080; -pub const RPC_IF_ASYNC_CALLBACK: ::c_uint = 0x0100; -pub const RPC_FW_IF_FLAG_DCOM: ::c_uint = 0x0001; -pub type RPC_INTERFACE_GROUP = *mut ::c_void; -pub type PRPC_INTERFACE_GROUP = *mut *mut ::c_void; -STRUCT!{struct RPC_ENDPOINT_TEMPLATEW { - Version: ::c_ulong, - ProtSeq: RPC_WSTR, - Endpoint: RPC_WSTR, - SecurityDescriptor: *mut ::c_void, - Backlog: ::c_ulong, -}} -pub type PRPC_ENDPOINT_TEMPLATEW = *mut RPC_ENDPOINT_TEMPLATEW; -STRUCT!{struct RPC_ENDPOINT_TEMPLATEA { - Version: ::c_ulong, - ProtSeq: RPC_CSTR, - Endpoint: RPC_CSTR, - SecurityDescriptor: *mut ::c_void, - Backlog: ::c_ulong, -}} -pub type PRPC_ENDPOINT_TEMPLATEA = *mut RPC_ENDPOINT_TEMPLATEA; -STRUCT!{struct RPC_INTERFACE_TEMPLATEA { - Version: ::c_ulong, - IfSpec: RPC_IF_HANDLE, - MgrTypeUuid: *mut UUID, - MgrEpv: *mut RPC_MGR_EPV, - Flags: ::c_uint, - MaxCalls: ::c_uint, - MaxRpcSize: ::c_uint, - IfCallback: *mut RPC_IF_CALLBACK_FN, - UuidVector: *mut UUID_VECTOR, - Annotation: RPC_CSTR, - SecurityDescriptor: *mut ::c_void, -}} -pub type PRPC_INTERFACE_TEMPLATEA = *mut RPC_INTERFACE_TEMPLATEA; -STRUCT!{struct RPC_INTERFACE_TEMPLATEW { - Version: ::c_ulong, - IfSpec: RPC_IF_HANDLE, - MgrTypeUuid: *mut UUID, - MgrEpv: *mut RPC_MGR_EPV, - Flags: ::c_uint, - MaxCalls: ::c_uint, - MaxRpcSize: ::c_uint, - IfCallback: *mut RPC_IF_CALLBACK_FN, - UuidVector: *mut UUID_VECTOR, - Annotation: RPC_WSTR, - SecurityDescriptor: *mut ::c_void, -}} -pub type PRPC_INTERFACE_TEMPLATEW = *mut RPC_INTERFACE_TEMPLATEW; -pub type RPC_INTERFACE_GROUP_IDLE_CALLBACK_FN = Option; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/rpc.rs cargo-0.37.0/vendor/winapi-0.2.8/src/rpc.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/rpc.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/rpc.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -// Master include file for RPC applications. -pub type I_RPC_HANDLE = *mut ::c_void; -pub type RPC_STATUS = ::c_long; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/sapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/sapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/sapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/sapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,2431 +0,0 @@ -// Copyright © 2015, Connor Hilarides -// Licensed under the MIT License -//! Mappings for the contents of sapi.h -ENUM!{enum SPDATAKEYLOCATION { - SPDKL_DefaultLocation = 0, - SPDKL_CurrentUser = 1, - SPDKL_LocalMachine = 2, - SPDKL_CurrentConfig = 5, -}} -pub const SPDUI_EngineProperties: &'static str = "EngineProperties"; -pub const SPDUI_AddRemoveWord: &'static str = "AddRemoveWord"; -pub const SPDUI_UserTraining: &'static str = "UserTraining"; -pub const SPDUI_MicTraining: &'static str = "MicTraining"; -pub const SPDUI_RecoProfileProperties: &'static str = "RecoProfileProperties"; -pub const SPDUI_AudioProperties: &'static str = "AudioProperties"; -pub const SPDUI_AudioVolume: &'static str = "AudioVolume"; -pub const SPDUI_UserEnrollment: &'static str = "UserEnrollment"; -pub const SPDUI_ShareData: &'static str = "ShareData"; -pub const SPDUI_Tutorial: &'static str = "Tutorial"; -ENUM!{enum SPSTREAMFORMAT { - SPSF_Default = -1i32 as u32, - SPSF_NoAssignedFormat = 0, - SPSF_Text = 1, - SPSF_NonStandardFormat = 2, - SPSF_ExtendedAudioFormat = 3, - SPSF_8kHz8BitMono = 4, - SPSF_8kHz8BitStereo = 5, - SPSF_8kHz16BitMono = 6, - SPSF_8kHz16BitStereo = 7, - SPSF_11kHz8BitMono = 8, - SPSF_11kHz8BitStereo = 9, - SPSF_11kHz16BitMono = 10, - SPSF_11kHz16BitStereo = 11, - SPSF_12kHz8BitMono = 12, - SPSF_12kHz8BitStereo = 13, - SPSF_12kHz16BitMono = 14, - SPSF_12kHz16BitStereo = 15, - SPSF_16kHz8BitMono = 16, - SPSF_16kHz8BitStereo = 17, - SPSF_16kHz16BitMono = 18, - SPSF_16kHz16BitStereo = 19, - SPSF_22kHz8BitMono = 20, - SPSF_22kHz8BitStereo = 21, - SPSF_22kHz16BitMono = 22, - SPSF_22kHz16BitStereo = 23, - SPSF_24kHz8BitMono = 24, - SPSF_24kHz8BitStereo = 25, - SPSF_24kHz16BitMono = 26, - SPSF_24kHz16BitStereo = 27, - SPSF_32kHz8BitMono = 28, - SPSF_32kHz8BitStereo = 29, - SPSF_32kHz16BitMono = 30, - SPSF_32kHz16BitStereo = 31, - SPSF_44kHz8BitMono = 32, - SPSF_44kHz8BitStereo = 33, - SPSF_44kHz16BitMono = 34, - SPSF_44kHz16BitStereo = 35, - SPSF_48kHz8BitMono = 36, - SPSF_48kHz8BitStereo = 37, - SPSF_48kHz16BitMono = 38, - SPSF_48kHz16BitStereo = 39, - SPSF_TrueSpeech_8kHz1BitMono = 40, - SPSF_CCITT_ALaw_8kHzMono = 41, - SPSF_CCITT_ALaw_8kHzStereo = 42, - SPSF_CCITT_ALaw_11kHzMono = 43, - SPSF_CCITT_ALaw_11kHzStereo = 44, - SPSF_CCITT_ALaw_22kHzMono = 45, - SPSF_CCITT_ALaw_22kHzStereo = 46, - SPSF_CCITT_ALaw_44kHzMono = 47, - SPSF_CCITT_ALaw_44kHzStereo = 48, - SPSF_CCITT_uLaw_8kHzMono = 49, - SPSF_CCITT_uLaw_8kHzStereo = 50, - SPSF_CCITT_uLaw_11kHzMono = 51, - SPSF_CCITT_uLaw_11kHzStereo = 52, - SPSF_CCITT_uLaw_22kHzMono = 53, - SPSF_CCITT_uLaw_22kHzStereo = 54, - SPSF_CCITT_uLaw_44kHzMono = 55, - SPSF_CCITT_uLaw_44kHzStereo = 56, - SPSF_ADPCM_8kHzMono = 57, - SPSF_ADPCM_8kHzStereo = 58, - SPSF_ADPCM_11kHzMono = 59, - SPSF_ADPCM_11kHzStereo = 60, - SPSF_ADPCM_22kHzMono = 61, - SPSF_ADPCM_22kHzStereo = 62, - SPSF_ADPCM_44kHzMono = 63, - SPSF_ADPCM_44kHzStereo = 64, - SPSF_GSM610_8kHzMono = 65, - SPSF_GSM610_11kHzMono = 66, - SPSF_GSM610_22kHzMono = 67, - SPSF_GSM610_44kHzMono = 68, - SPSF_NUM_FORMATS = 69, -}} -pub const SPREG_USER_ROOT: &'static str = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech"; -pub const SPREG_LOCAL_MACHINE_ROOT: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech"; -pub const SPCAT_AUDIOOUT: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioOutput"; -pub const SPCAT_AUDIOIN: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioInput"; -pub const SPCAT_VOICES: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Voices"; -pub const SPCAT_RECOGNIZERS: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Recognizers"; -pub const SPCAT_APPLEXICONS: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AppLexicons"; -pub const SPCAT_PHONECONVERTERS: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\PhoneConverters"; -pub const SPCAT_TEXTNORMALIZERS: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\TextNormalizers"; -pub const SPCAT_RECOPROFILES: &'static str = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech\\RecoProfiles"; -pub const SPMMSYS_AUDIO_IN_TOKEN_ID: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioInput\\TokenEnums\\MMAudioIn\\"; -pub const SPMMSYS_AUDIO_OUT_TOKEN_ID: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioOutput\\TokenEnums\\MMAudioOut\\"; -pub const SPCURRENT_USER_LEXICON_TOKEN_ID: &'static str = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech\\CurrentUserLexicon"; -pub const SPCURRENT_USER_SHORTCUT_TOKEN_ID: &'static str = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech\\CurrentUserShortcut"; -pub const SPTOKENVALUE_CLSID: &'static str = "CLSID"; -pub const SPTOKENKEY_FILES: &'static str = "Files"; -pub const SPTOKENKEY_UI: &'static str = "UI"; -pub const SPTOKENKEY_ATTRIBUTES: &'static str = "Attributes"; -pub const SPTOKENKEY_RETAINEDAUDIO: &'static str = "SecondsPerRetainedAudioEvent"; -pub const SPTOKENKEY_AUDIO_LATENCY_WARNING: &'static str = "LatencyWarningThreshold"; -pub const SPTOKENKEY_AUDIO_LATENCY_TRUNCATE: &'static str = "LatencyTruncateThreshold"; -pub const SPTOKENKEY_AUDIO_LATENCY_UPDATE_INTERVAL: &'static str = "LatencyUpdateInterval"; -pub const SPVOICECATEGORY_TTSRATE: &'static str = "DefaultTTSRate"; -pub const SPPROP_RESOURCE_USAGE: &'static str = "ResourceUsage"; -pub const SPPROP_HIGH_CONFIDENCE_THRESHOLD: &'static str = "HighConfidenceThreshold"; -pub const SPPROP_NORMAL_CONFIDENCE_THRESHOLD: &'static str = "NormalConfidenceThreshold"; -pub const SPPROP_LOW_CONFIDENCE_THRESHOLD: &'static str = "LowConfidenceThreshold"; -pub const SPPROP_RESPONSE_SPEED: &'static str = "ResponseSpeed"; -pub const SPPROP_COMPLEX_RESPONSE_SPEED: &'static str = "ComplexResponseSpeed"; -pub const SPPROP_ADAPTATION_ON: &'static str = "AdaptationOn"; -pub const SPPROP_PERSISTED_BACKGROUND_ADAPTATION: &'static str = "PersistedBackgroundAdaptation"; -pub const SPPROP_PERSISTED_LANGUAGE_MODEL_ADAPTATION: &'static str = "PersistedLanguageModelAdaptation"; -pub const SPPROP_UX_IS_LISTENING: &'static str = "UXIsListening"; -pub const SPTOPIC_SPELLING: &'static str = "Spelling"; -pub const SPWILDCARD: &'static str = "..."; -pub const SPDICTATION: &'static str = "*"; -pub const SPINFDICTATION: &'static str = "*+"; -pub const SPREG_SAFE_USER_TOKENS: &'static str = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\UserTokens"; -pub const SP_LOW_CONFIDENCE: i32 = -1; -pub const SP_NORMAL_CONFIDENCE: i32 = 0; -pub const SP_HIGH_CONFIDENCE: i32 = 1; -pub const DEFAULT_WEIGHT: i32 = 1; -pub const SP_MAX_WORD_LENGTH: i32 = 128; -pub const SP_MAX_PRON_LENGTH: i32 = 384; -pub const SP_EMULATE_RESULT: i32 = 0x40000000; -RIDL!( -interface ISpNotifyCallback(ISpNotifyCallbackVtbl) { - fn NotifyCallback(&mut self, wParam: ::WPARAM, lParam: ::LPARAM) -> ::HRESULT -} -); -pub type SPNOTIFYCALLBACK = unsafe extern "system" fn(wParam: ::WPARAM, lParam: ::LPARAM); -RIDL!( -interface ISpNotifySource(ISpNotifySourceVtbl): IUnknown(IUnknownVtbl) { - fn SetNotifySink(&mut self, pNotifySink: *mut ISpNotifySink) -> ::HRESULT, - fn SetNotifyWindowMessage( - &mut self, hWnd: ::HWND, Msg: ::UINT, wParam: ::WPARAM, lParam: ::LPARAM - ) -> ::HRESULT, - fn SetNotifyCallbackFunction( - &mut self, pfnCallback: SPNOTIFYCALLBACK, wParam: ::WPARAM, lParam: ::LPARAM - ) -> ::HRESULT, - fn SetNotifyCallbackInterface( - &mut self, pSpCallback: *mut ISpNotifyCallback, wParam: ::WPARAM, lParam: ::LPARAM - ) -> ::HRESULT, - fn SetNotifyWin32Event(&mut self) -> ::HRESULT, - fn WaitForNotifyEvent(&mut self, dwMilliseconds: ::DWORD) -> ::HRESULT, - fn GetNotifyEventHandle(&mut self) -> ::HANDLE -} -); -RIDL!( -interface ISpNotifySink(ISpNotifySinkVtbl): IUnknown(IUnknownVtbl) { - fn Notify(&mut self) -> ::HRESULT -} -); -RIDL!( -interface ISpNotifyTranslator(ISpNotifyTranslatorVtbl): ISpNotifySink(ISpNotifySinkVtbl) { - fn InitWindowMessage( - &mut self, hWnd: ::HWND, Msg: ::UINT, wParam: ::WPARAM, lParam: ::LPARAM - ) -> ::HRESULT, - fn InitCallback( - &mut self, pfnCallback: SPNOTIFYCALLBACK, wParam: ::WPARAM, lParam: ::LPARAM - ) -> ::HRESULT, - fn InitSpNotifyCallback( - &mut self, pSpCallback: *mut ISpNotifyCallback, wParam: ::WPARAM, lParam: ::LPARAM - ) -> ::HRESULT, - fn InitWin32Event(&mut self, hEvent: ::HANDLE, fCloseHandleOnRelease: ::BOOL) -> ::HRESULT, - fn Wait(&mut self, dwMilliseconds: ::DWORD) -> ::HRESULT, - fn GetEventHandle(&mut self) -> ::HANDLE -} -); -RIDL!( -interface ISpDataKey(ISpDataKeyVtbl): IUnknown(IUnknownVtbl) { - fn SetData( - &mut self, pszValueName: ::LPCWSTR, cbData: ::ULONG, pData: *const ::BYTE - ) -> ::HRESULT, - fn GetData( - &mut self, pszValueName: ::LPCWSTR, pcbData: *mut ::ULONG, pData: *mut ::BYTE - ) -> ::HRESULT, - fn SetStringValue(&mut self, pszValueName: ::LPCWSTR, pszValue: ::LPCWSTR) -> ::HRESULT, - fn GetStringValue(&mut self, pszValueName: ::LPCWSTR, ppszValue: *mut ::LPWSTR) -> ::HRESULT, - fn SetDWORD(&mut self, pszValueName: ::LPCWSTR, dwValue: ::DWORD) -> ::HRESULT, - fn GetDWORD(&mut self, pszValueName: ::LPCWSTR, pdwValue: *mut ::DWORD) -> ::HRESULT, - fn OpenKey(&mut self, pszSubKeyName: ::LPCWSTR, ppSubKey: *mut *mut ISpDataKey) -> ::HRESULT, - fn CreateKey(&mut self, pszSubKey: ::LPCWSTR, ppSubKey: *mut *mut ISpDataKey) -> ::HRESULT, - fn DeleteKey(&mut self, pszSubKey: ::LPCWSTR) -> ::HRESULT, - fn DeleteValue(&mut self, pszValueName: ::LPCWSTR) -> ::HRESULT, - fn EnumKeys(&mut self, Index: ::ULONG, ppszSubKeyName: *mut ::LPWSTR) -> ::HRESULT, - fn EnumValues(&mut self, Index: ::ULONG, ppszValueName: *mut ::LPWSTR) -> ::HRESULT -} -); -RIDL!( -interface ISpRegDataKey(ISpRegDataKeyVtbl): ISpDataKey(ISpDataKeyVtbl) { - fn SetKey(&mut self, hkey: ::HKEY, fReadOnly: ::BOOL) -> ::HRESULT -} -); -RIDL!( -interface ISpObjectTokenCategory(ISpObjectTokenCategoryVtbl): ISpDataKey(ISpDataKeyVtbl) { - fn SetId(&mut self, pszCategoryId: ::LPCWSTR, fCreateIfNotExist: ::BOOL) -> ::HRESULT, - fn GetId(&mut self, ppszCoMemCategoryId: *mut ::LPWSTR) -> ::HRESULT, - fn GetDataKey( - &mut self, spdkl: SPDATAKEYLOCATION, pppDataKey: *mut *mut ISpDataKey - ) -> ::HRESULT, - fn EnumTokens( - &mut self, pzsReqAttribs: ::LPCWSTR, pszOptAttribs: ::LPCWSTR, - ppEnum: *mut *mut IEnumSpObjectTokens - ) -> ::HRESULT, - fn SetDefaultTokenId(&mut self, pszTokenId: ::LPCWSTR) -> ::HRESULT, - fn GetDefaultTokenId(&mut self, ppszCoMemTokenId: *mut ::LPWSTR) -> ::HRESULT -} -); -RIDL!( -interface ISpObjectToken(ISpObjectTokenVtbl): ISpDataKey(ISpDataKeyVtbl) { - fn SetId( - &mut self, pszCategoryId: ::LPCWSTR, pszTokenId: ::LPCWSTR, fCreateIfNotExist: ::BOOL - ) -> ::HRESULT, - fn GetId(&mut self, ppszCoMemTokenId: *mut ::LPWSTR) -> ::HRESULT, - fn GetCategory(&mut self, ppTokenCategory: *mut *mut ISpObjectTokenCategory) -> ::HRESULT, - fn CreateInstance( - &mut self, pUnkOuter: *mut ::IUnknown, dwClsContext: ::DWORD, riid: ::REFIID, - ppvObject: *mut *mut ::c_void - ) -> ::HRESULT, - fn GetStorageFileName( - &mut self, clsidCaller: ::REFCLSID, pszValueName: ::LPCWSTR, - pszFileNameSpecifier: ::LPCWSTR, nFolder: ::ULONG, ppszFilePath: *mut ::LPWSTR - ) -> ::HRESULT, - fn RemoveStorageFileName(&mut self, pszKeyName: ::LPCWSTR, fDeleteFile: ::BOOL) -> ::HRESULT, - fn Remove(&mut self, pclsidCaller: *const ::CLSID) -> ::HRESULT, - fn IsUISupported( - &mut self, pszTypeOfUI: ::LPCWSTR, pvExtraData: *mut ::c_void, cbExtraData: ::ULONG, - punkObject: *mut ::IUnknown, pfSupported: *mut ::BOOL - ) -> ::HRESULT, - fn DisplayUI( - &mut self, hwndParent: ::HWND, pszTitle: ::LPCWSTR, pszTypeOfUI: ::LPCWSTR, - pvExtraData: *mut ::c_void, cbExtraData: ::ULONG, punkObject: *mut ::IUnknown - ) -> ::HRESULT, - fn MatchesAttributes(&mut self, pszAttributes: ::LPCWSTR, pfMatches: *mut ::BOOL) -> ::HRESULT -} -); -RIDL!( -interface ISpObjectTokenInit(ISpObjectTokenInitVtbl): ISpObjectToken(ISpObjectTokenVtbl) { - fn InitFromDataKey( - &mut self, pszCategoryId: ::LPCWSTR, pszTokenId: ::LPCWSTR, pDataKey: *mut ISpDataKey - ) -> ::HRESULT -} -); -RIDL!( -interface IEnumSpObjectTokens(IEnumSpObjectTokensVtbl): IUnknown(IUnknownVtbl) { - fn Next( - &mut self, celt: ::ULONG, pelt: *mut *mut ISpObjectToken, pceltFetched: *mut ::ULONG - ) -> ::HRESULT, - fn Skip(&mut self, celt: ::ULONG) -> ::HRESULT, - fn Reset(&mut self) -> ::HRESULT, - fn Clone(&mut self, ppEnum: *mut *mut IEnumSpObjectTokens) -> ::HRESULT, - fn Item(&mut self, Index: ::ULONG, ppToken: *mut *mut ISpObjectToken) -> ::HRESULT, - fn GetCount(&mut self, pCount: *mut ::ULONG) -> ::HRESULT -} -); -RIDL!( -interface ISpObjectWithToken(ISpObjectWithTokenVtbl): IUnknown(IUnknownVtbl) { - fn SetObjectToken(&mut self, pToken: *mut ISpObjectToken) -> ::HRESULT, - fn GetObjectToken(&mut self, ppToken: *mut *mut ISpObjectToken) -> ::HRESULT -} -); -RIDL!( -interface ISpResourceManager(ISpResourceManagerVtbl): IServiceProvider(IServiceProviderVtbl) { - fn SetObject(&mut self, guidServiceId: ::REFGUID, pUnkObject: *mut ::IUnknown) -> ::HRESULT, - fn GetObject( - &mut self, guidServiceId: ::REFGUID, ObjectCLSID: ::REFCLSID, ObjectIID: ::REFIID, - fReleaseWhenLastExternalRefReleased: ::BOOL, ppObject: *mut *mut ::c_void - ) -> ::HRESULT -} -); -ENUM!{enum SPEVENTLPARAMTYPE { - SPET_LPARAM_IS_UNDEFINED = 0, - SPET_LPARAM_IS_TOKEN, - SPET_LPARAM_IS_OBJECT, - SPET_LPARAM_IS_POINTER, - SPET_LPARAM_IS_STRING, -}} -ENUM!{enum SPEVENTENUM { - SPEI_UNDEFINED = 0, - SPEI_START_INPUT_STREAM = 1, - SPEI_END_INPUT_STREAM = 2, - SPEI_VOICE_CHANGE = 3, - SPEI_TTS_BOOKMARK = 4, - SPEI_WORD_BOUNDARY = 5, - SPEI_PHONEME = 6, - SPEI_SENTENCE_BOUNDARY = 7, - SPEI_VISEME = 8, - SPEI_TTS_AUDIO_LEVEL = 9, - SPEI_TTS_PRIVATE = 15, - SPEI_END_SR_STREAM = 34, - SPEI_SOUND_START = 35, - SPEI_SOUND_END = 36, - SPEI_PHRASE_START = 37, - SPEI_RECOGNITION = 38, - SPEI_HYPOTHESIS = 39, - SPEI_SR_BOOKMARK = 40, - SPEI_PROPERTY_NUM_CHANGE = 41, - SPEI_PROPERTY_STRING_CHANGE = 42, - SPEI_FALSE_RECOGNITION = 43, - SPEI_INTERFERENCE = 44, - SPEI_REQUEST_UI = 45, - SPEI_RECO_STATE_CHANGE = 46, - SPEI_ADAPTATION = 47, - SPEI_START_SR_STREAM = 48, - SPEI_RECO_OTHER_CONTEXT = 49, - SPEI_SR_AUDIO_LEVEL = 50, - SPEI_SR_RETAINEDAUDIO = 51, - SPEI_SR_PRIVATE = 52, - SPEI_ACTIVE_CATEGORY_CHANGED = 53, - SPEI_RESERVED5 = 54, - SPEI_RESERVED6 = 55, - SPEI_RESERVED1 = 30, - SPEI_RESERVED2 = 33, - SPEI_RESERVED3 = 63, -}} -pub const SPEI_MIN_TTS: SPEVENTENUM = SPEI_START_INPUT_STREAM; -pub const SPEI_MAX_TTS: SPEVENTENUM = SPEI_TTS_PRIVATE; -pub const SPEI_MIN_SR: SPEVENTENUM = SPEI_END_SR_STREAM; -pub const SPEI_MAX_SR: SPEVENTENUM = SPEI_RESERVED6; -pub const SPFEI_FLAGCHECK: u64 = (1 << SPEI_RESERVED1.0 as u64) | (1 << SPEI_RESERVED2.0 as u64); -pub const SPFEI_ALL_TTS_EVENTS: u64 = 0x000000000000FFFE | SPFEI_FLAGCHECK; -pub const SPFEI_ALL_SR_EVENTS: u64 = 0x003FFFFC00000000 | SPFEI_FLAGCHECK; -pub const SPFEI_ALL_EVENTS: u64 = 0xEFFFFFFFFFFFFFFF; -#[inline] -pub fn SPFEI(SPEI_ord: u64) -> u64 { - (1 << SPEI_ord) | SPFEI_FLAGCHECK -} -STRUCT!{struct SPEVENT { - eEventId: ::WORD, - elParamType: ::WORD, - ulStreamNum: ::ULONG, - ullAudioStreamOffset: ::ULONGLONG, - wParam: ::WPARAM, - lParam: ::LPARAM, -}} -STRUCT!{struct SPSERIALIZEDEVENT { - eEventId: ::WORD, - elParamType: ::WORD, - ulStreamNum: ::ULONG, - ullAudioStreamOffset: ::ULONGLONG, - SerializedwParam: ::ULONG, - SerializedlParam: ::LONG, -}} -STRUCT!{struct SPSERIALIZEDEVENT64 { - eEventId: ::WORD, - elParamType: ::WORD, - ulStreamNum: ::ULONG, - ullAudioStreamOffset: ::ULONGLONG, - SerializedwParam: ::ULONGLONG, - SerializedlParam: ::LONGLONG, -}} -STRUCT!{struct SPEVENTEX { - eEventId: ::WORD, - elParamType: ::WORD, - ulStreamNum: ::ULONG, - ullAudioStreamOffset: ::ULONGLONG, - wParam: ::WPARAM, - lParam: ::LPARAM, - ullAudioTimeOffset: ::ULONGLONG, -}} -ENUM!{enum SPINTERFERENCE { - SPINTERFERENCE_NONE = 0, - SPINTERFERENCE_NOISE = 1, - SPINTERFERENCE_NOSIGNAL = 2, - SPINTERFERENCE_TOOLOUD = 3, - SPINTERFERENCE_TOOQUIET = 4, - SPINTERFERENCE_TOOFAST = 5, - SPINTERFERENCE_TOOSLOW = 6, - SPINTERFERENCE_LATENCY_WARNING = 7, - SPINTERFERENCE_LATENCY_TRUNCATE_BEGIN = 8, - SPINTERFERENCE_LATENCY_TRUNCATE_END = 9, -}} -FLAGS!{enum SPENDSRSTREAMFLAGS { - SPESF_NONE = 0, - SPESF_STREAM_RELEASED = 1 << 0, - SPESF_EMULATED = 1 << 1, -}} -FLAGS!{enum SPVFEATURE { - SPVFEATURE_STRESSED = 1 << 0, - SPVFEATURE_EMPHASIS = 1 << 1, -}} -ENUM!{enum SPVISEMES { - SP_VISEME_0 = 0, - SP_VISEME_1, - SP_VISEME_2, - SP_VISEME_3, - SP_VISEME_4, - SP_VISEME_5, - SP_VISEME_6, - SP_VISEME_7, - SP_VISEME_8, - SP_VISEME_9, - SP_VISEME_10, - SP_VISEME_11, - SP_VISEME_12, - SP_VISEME_13, - SP_VISEME_14, - SP_VISEME_15, - SP_VISEME_16, - SP_VISEME_17, - SP_VISEME_18, - SP_VISEME_19, - SP_VISEME_20, - SP_VISEME_21, -}} -STRUCT!{struct SPEVENTSOURCEINFO { - ullEventInterest: ::ULONGLONG, - ullQueuedInterest: ::ULONGLONG, - ulCount: ::ULONG, -}} -RIDL!( -interface ISpEventSource(ISpEventSourceVtbl): ISpNotifySource(ISpNotifySourceVtbl) { - fn SetInterest( - &mut self, ullEventInterest: ::ULONGLONG, ullQueuedInterest: ::ULONGLONG - ) -> ::HRESULT, - fn GetEvents( - &mut self, ulCount: ::ULONG, pEventArray: *mut SPEVENT, pulFetched: *mut ::ULONG - ) -> ::HRESULT, - fn GetInfo(&mut self, pInfo: *mut SPEVENTSOURCEINFO) -> ::HRESULT -} -); -RIDL!( -interface ISpEventSource2(ISpEventSource2Vtbl): ISpEventSource(ISpEventSourceVtbl) { - fn GetEventsEx( - &mut self, ulCount: ::ULONG, pEventArray: *mut SPEVENTEX, pulFetched: *mut ::ULONG - ) -> ::HRESULT -} -); -RIDL!( -interface ISpEventSink(ISpEventSinkVtbl): IUnknown(IUnknownVtbl) { - fn AddEvents(&mut self, pEventArray: *const SPEVENT, ulCount: ::ULONG) -> ::HRESULT, - fn GetEventInterest(&mut self, pullEventInterest: *mut ::ULONGLONG) -> ::HRESULT -} -); -RIDL!( -interface ISpStreamFormat(ISpStreamFormatVtbl): IStream(IStreamVtbl) { - fn GetFormat( - &mut self, pguidFormatId: *mut ::GUID, ppCoMemWaveFormatEx: *mut *mut ::WAVEFORMATEX - ) -> ::HRESULT -} -); -ENUM!{enum SPFILEMODE { - SPFM_OPEN_READONLY = 0, - SPFM_OPEN_READWRITE = 1, - SPFM_CREATE = 2, - SPFM_CREATE_ALWAYS = 3, - SPFM_NUM_MODES = 4, -}} -RIDL!( -interface ISpStream(ISpStreamVtbl): ISpStreamFormat(ISpStreamFormatVtbl) { - fn SetBaseStream( - &mut self, pStream: *mut ::IStream, rguidFormat: ::REFGUID, - pWaveFormatEx: *const ::WAVEFORMATEX - ) -> ::HRESULT, - fn GetBaseStream(&mut self, ppStream: *mut *mut ::IStream) -> ::HRESULT, - fn BindToFile( - &mut self, pszFileName: ::LPCWSTR, eMode: SPFILEMODE, pFormatId: *const ::GUID, - pWaveFormatEx: *const ::WAVEFORMATEX, ullEventInterest: ::ULONGLONG - ) -> ::HRESULT, - fn Close(&mut self) -> ::HRESULT -} -); -RIDL!( -interface ISpStreamFormatConverter(ISpStreamFormatConverterVtbl) - : ISpStreamFormat(ISpStreamFormatVtbl) { - fn SetBaseStream( - &mut self, pStream: *mut ISpStreamFormat, fSetFormatToBaseStreamFormat: ::BOOL, - fWriteToBaseStream: ::BOOL - ) -> ::HRESULT, - fn GetBaseStream(&mut self, ppStream: *mut *mut ISpStreamFormat) -> ::HRESULT, - fn SetFormat( - &mut self, rguidFormatIdOfConvertedStream: ::REFGUID, - pWaveFormatExOfConvertedStream: *const ::WAVEFORMATEX - ) -> ::HRESULT, - fn ResetSeekPosition(&mut self) -> ::HRESULT, - fn ScaleConvertedToBaseOffset( - &mut self, ullOffsetConvertedStream: ::ULONGLONG, pullOffsetBaseStream: *mut ::ULONGLONG - ) -> ::HRESULT, - fn ScaleBaseToConvertedOffset( - &mut self, ullOffsetBaseStream: ::ULONGLONG, pullOffsetConvertedStream: *mut ::ULONGLONG - ) -> ::HRESULT -} -); -ENUM!{enum SPAUDIOSTATE { - SPAS_CLOSED = 0, - SPAS_STOP = 1, - SPAS_PAUSE = 2, - SPAS_RUN = 3, -}} -STRUCT!{struct SPAUDIOSTATUS { - cbFreeBuffSpace: ::LONG, - cbNonBlockingIO: ::ULONG, - State: SPAUDIOSTATE, - CurSeekPos: ::ULONGLONG, - CurDevicePos: ::ULONGLONG, - dwAudioLevel: ::DWORD, - dwReserved2: ::DWORD, -}} -STRUCT!{struct SPAUDIOBUFFERINFO { - ulMsMinNotification: ::ULONG, - ulMsBufferSize: ::ULONG, - ulMsEventBias: ::ULONG, -}} -RIDL!( -interface ISpAudio(ISpAudioVtbl): ISpStreamFormat(ISpStreamFormatVtbl) { - fn SetState(&mut self, NewState: SPAUDIOSTATE, ullReserved: ::ULONGLONG) -> ::HRESULT, - fn SetFormat( - &mut self, rguidFmtId: ::REFGUID, pWaveFormatEx: *const ::WAVEFORMATEX - ) -> ::HRESULT, - fn GetStatus(&mut self, pStatus: *mut SPAUDIOSTATUS) -> ::HRESULT, - fn SetBufferInfo(&mut self, pBuffInfo: *const SPAUDIOBUFFERINFO) -> ::HRESULT, - fn GetBufferInfo(&mut self, pBuffInfo: *mut SPAUDIOBUFFERINFO) -> ::HRESULT, - fn GetDefaultFormat( - &mut self, pFormatId: *mut ::GUID, ppCoMemWaveFormatEx: *mut *mut ::WAVEFORMATEX - ) -> ::HRESULT, - fn EventHandle(&mut self) -> ::HANDLE, - fn GetVolumeLevel(&mut self, pLevel: *mut ::ULONG) -> ::HRESULT, - fn SetVolumeLevel(&mut self, Level: ::ULONG) -> ::HRESULT, - fn GetBufferNotifySize(&mut self, pcbSize: *mut ::ULONG) -> ::HRESULT, - fn SetBufferNotifySize(&mut self, cbSize: ::ULONG) -> ::HRESULT -} -); -RIDL!( -interface ISpMMSysAudio(ISpMMSysAudioVtbl): ISpAudio(ISpAudioVtbl) { - fn GetDeviceId(&mut self, puDeviceId: *mut ::UINT) -> ::HRESULT, - fn SetDeviceId(&mut self, uDeviceId: ::UINT) -> ::HRESULT, - fn GetMMHandle(&mut self, pHandle: *mut *mut ::c_void) -> ::HRESULT, - fn GetLineId(&mut self, puLineId: *mut ::UINT) -> ::HRESULT, - fn SetLineId(&mut self, uLineId: ::UINT) -> ::HRESULT -} -); -RIDL!( -interface ISpTranscript(ISpTranscriptVtbl): IUnknown(IUnknownVtbl) { - fn GetTranscript(&mut self, ppszTranscript: *mut ::LPWSTR) -> ::HRESULT, - fn AppendTranscript(&mut self, pszTranscript: ::LPCWSTR) -> ::HRESULT -} -); -FLAGS!{enum SPDISPLYATTRIBUTES { - SPAF_ONE_TRAILING_SPACE = 0x2, - SPAF_TWO_TRAILING_SPACES = 0x4, - SPAF_CONSUME_LEADING_SPACES = 0x8, - SPAF_BUFFER_POSITION = 0x10, - SPAF_ALL = 0x1f, - SPAF_USER_SPECIFIED = 0x80, -}} -pub type SPPHONEID = ::WCHAR; -pub type PSPPHONEID = ::LPWSTR; -pub type PCSPPHONEID = ::LPCWSTR; -STRUCT!{struct SPPHRASEELEMENT { - ulAudioTimeOffset: ::ULONG, - ulAudioSizeTime: ::ULONG, - ulAudioStreamOffset: ::ULONG, - ulAudioSizeBytes: ::ULONG, - ulRetainedStreamOffset: ::ULONG, - ulRetainedSizeBytes: ::ULONG, - pszDisplayText: ::LPCWSTR, - pszLexicalForm: ::LPCWSTR, - pszPronunciation: *const SPPHONEID, - bDisplayAttributes: ::BYTE, - RequiredConfidence: ::c_char, - ActualConfidence: ::c_char, - Reserved: ::BYTE, - SREngineConfidence: ::c_float, -}} -STRUCT!{struct SPPHRASERULE { - pszName: ::LPCWSTR, - ulId: ::ULONG, - ulFirstElement: ::ULONG, - ulCountOfElements: ::ULONG, - pNextSibling: *const SPPHRASERULE, - pFirstChild: *const SPPHRASERULE, - SREngineConfidence: ::c_float, - Confidence: ::c_char, -}} -ENUM!{enum SPPHRASEPROPERTYUNIONTYPE { - SPPPUT_UNUSED = 0, - SPPPUT_ARRAY_INDEX, -}} -STRUCT!{struct SPPHRASEPROPERTY { - pszName: ::LPCWSTR, - bType: ::BYTE, - bReserved: ::BYTE, - usArrayIndex: u16, - pszValue: ::LPCWSTR, - vValue: ::VARIANT, - ulFirstElement: ::ULONG, - ulCountOfElements: ::ULONG, - pNextSibling: *const SPPHRASEPROPERTY, - pFirstChild: *const SPPHRASEPROPERTY, - SREngineConfidence: ::c_float, - Confidence: ::c_char, -}} -UNION!(SPPHRASEPROPERTY, bType, ulId, ulId_mut, ::ULONG); -STRUCT!{struct SPPHRASEREPLACEMENT { - bDisplayAttributes: ::BYTE, - pszReplacementText: ::LPCWSTR, - ulFirstElement: ::ULONG, - ulCountOfElements: ::ULONG, -}} -STRUCT!{struct SPSEMANTICERRORINFO { - ulLineNumber: ::ULONG, - pszScriptLine: ::LPWSTR, - pszSource: ::LPWSTR, - pszDescription: ::LPWSTR, - hrResultCode: ::HRESULT, -}} -ENUM!{enum SPSEMANTICFORMAT { - SPSMF_SAPI_PROPERTIES = 0, - SPSMF_SRGS_SEMANTICINTERPRETATION_MS = 1, - SPSMF_SRGS_SAPIPROPERTIES = 2, - SPSMF_UPS = 4, - SPSMF_SRGS_SEMANTICINTERPRETATION_W3C = 8, -}} -STRUCT!{struct SPPHRASE_50 { - cbSize: ::ULONG, - LangID: ::WORD, - wHomophoneGroupId: ::WORD, - ullGrammarID: ::ULONGLONG, - ftStartTime: ::ULONGLONG, - ullAudioStreamPosition: ::ULONGLONG, - ulAudioSizeBytes: ::ULONG, - ulRetainedSizeBytes: ::ULONG, - ulAudioSizeTime: ::ULONG, - Rule: ::SPPHRASERULE, - pProperties: *const ::SPPHRASEPROPERTY, - pElements: *const ::SPPHRASEELEMENT, - cReplacements: ::ULONG, - pReplacements: *const ::SPPHRASEREPLACEMENT, - SREngineID: ::GUID, - ulSREnginePrivateDataSize: ::ULONG, - pSREnginePrivateData: *const ::BYTE, -}} -STRUCT!{struct SPPHRASE_53 { - cbSize: ::ULONG, - LangID: ::WORD, - wHomophoneGroupId: ::WORD, - ullGrammarID: ::ULONGLONG, - ftStartTime: ::ULONGLONG, - ullAudioStreamPosition: ::ULONGLONG, - ulAudioSizeBytes: ::ULONG, - ulRetainedSizeBytes: ::ULONG, - ulAudioSizeTime: ::ULONG, - Rule: ::SPPHRASERULE, - pProperties: *const ::SPPHRASEPROPERTY, - pElements: *const ::SPPHRASEELEMENT, - cReplacements: ::ULONG, - pReplacements: *const ::SPPHRASEREPLACEMENT, - SREngineID: ::GUID, - ulSREnginePrivateDataSize: ::ULONG, - pSREnginePrivateData: *const ::BYTE, - pSML: ::LPWSTR, - pSemanticErrorInfo: *mut SPSEMANTICERRORINFO, -}} -STRUCT!{struct SPPHRASE { - cbSize: ::ULONG, - LangID: ::WORD, - wHomophoneGroupId: ::WORD, - ullGrammarID: ::ULONGLONG, - ftStartTime: ::ULONGLONG, - ullAudioStreamPosition: ::ULONGLONG, - ulAudioSizeBytes: ::ULONG, - ulRetainedSizeBytes: ::ULONG, - ulAudioSizeTime: ::ULONG, - Rule: ::SPPHRASERULE, - pProperties: *const ::SPPHRASEPROPERTY, - pElements: *const ::SPPHRASEELEMENT, - cReplacements: ::ULONG, - pReplacements: *const ::SPPHRASEREPLACEMENT, - SREngineID: ::GUID, - ulSREnginePrivateDataSize: ::ULONG, - pSREnginePrivateData: *const ::BYTE, - pSML: ::LPWSTR, - pSemanticErrorInfo: *mut SPSEMANTICERRORINFO, - SemanticTagFormat: SPSEMANTICFORMAT, -}} -STRUCT!{struct SPSERIALIZEDPHRASE { - ulSerializedSize: ::ULONG, -}} -STRUCT!{struct SPRULE { - pszRuleName: ::LPCWSTR, - ulRuleId: ::ULONG, - dwAttributes: ::DWORD, -}} -FLAGS!{enum SPVALUETYPE { - SPDF_PROPERTY = 0x1, - SPDF_REPLACEMENT = 0x2, - SPDF_RULE = 0x4, - SPDF_DISPLAYTEXT = 0x8, - SPDF_LEXICALFORM = 0x10, - SPDF_PRONUNCIATION = 0x20, - SPDF_AUDIO = 0x40, - SPDF_ALTERNATES = 0x80, - SPDF_ALL = 0xff, -}} -STRUCT!{struct SPBINARYGRAMMAR { - ulTotalSerializedSize: ::ULONG, -}} -ENUM!{enum SPPHRASERNG { - SPPR_ALL_ELEMENTS = -1i32 as u32, -}} -pub const SP_GETWHOLEPHRASE: SPPHRASERNG = SPPR_ALL_ELEMENTS; -pub const SPRR_ALL_ELEMENTS: SPPHRASERNG = SPPR_ALL_ELEMENTS; -DECLARE_HANDLE!(SPSTATEHANDLE, SPSTATEHANDLE__); -FLAGS!{enum SPRECOEVENTFLAGS { - SPREF_AutoPause = 1 << 0, - SPREF_Emulated = 1 << 1, - SPREF_SMLTimeout = 1 << 2, - SPREF_ExtendableParse = 1 << 3, - SPREF_ReSent = 1 << 4, - SPREF_Hypothesis = 1 << 5, - SPREF_FalseRecognition = 1 << 6, -}} -ENUM!{enum SPPARTOFSPEECH { - SPPS_NotOverriden = -1i32 as u32, - SPPS_Unknown = 0, - SPPS_Noun = 0x1000, - SPPS_Verb = 0x2000, - SPPS_Modifier = 0x3000, - SPPS_Function = 0x4000, - SPPS_Interjection = 0x5000, - SPPS_Noncontent = 0x6000, - SPPS_LMA = 0x7000, - SPPS_SuppressWord = 0xf000, -}} -FLAGS!{enum SPLEXICONTYPE { - eLEXTYPE_USER = 1 << 0, - eLEXTYPE_APP = 1 << 1, - eLEXTYPE_VENDORLEXICON = 1 << 2, - eLEXTYPE_LETTERTOSOUND = 1 << 3, - eLEXTYPE_MORPHOLOGY = 1 << 4, - eLEXTYPE_RESERVED4 = 1 << 5, - eLEXTYPE_USER_SHORTCUT = 1 << 6, - eLEXTYPE_RESERVED6 = 1 << 7, - eLEXTYPE_RESERVED7 = 1 << 8, - eLEXTYPE_RESERVED8 = 1 << 9, - eLEXTYPE_RESERVED9 = 1 << 10, - eLEXTYPE_RESERVED10 = 1 << 11, - eLEXTYPE_PRIVATE1 = 1 << 12, - eLEXTYPE_PRIVATE2 = 1 << 13, - eLEXTYPE_PRIVATE3 = 1 << 14, - eLEXTYPE_PRIVATE4 = 1 << 15, - eLEXTYPE_PRIVATE5 = 1 << 16, - eLEXTYPE_PRIVATE6 = 1 << 17, - eLEXTYPE_PRIVATE7 = 1 << 18, - eLEXTYPE_PRIVATE8 = 1 << 19, - eLEXTYPE_PRIVATE9 = 1 << 20, - eLEXTYPE_PRIVATE10 = 1 << 21, - eLEXTYPE_PRIVATE11 = 1 << 22, - eLEXTYPE_PRIVATE12 = 1 << 23, - eLEXTYPE_PRIVATE13 = 1 << 24, - eLEXTYPE_PRIVATE14 = 1 << 25, - eLEXTYPE_PRIVATE15 = 1 << 26, - eLEXTYPE_PRIVATE16 = 1 << 27, - eLEXTYPE_PRIVATE17 = 1 << 28, - eLEXTYPE_PRIVATE18 = 1 << 29, - eLEXTYPE_PRIVATE19 = 1 << 30, - eLEXTYPE_PRIVATE20 = 1 << 31, -}} -FLAGS!{enum SPWORDTYPE { - eWORDTYPE_ADDED = 1 << 0, - eWORDTYPE_DELETED = 1 << 1, -}} -FLAGS!{enum SPPRONUNCIATIONFLAGS { - ePRONFLAG_USED = 1 << 0, -}} -STRUCT!{struct SPWORDPRONUNCIATION { - pNextWordPronunciation: *mut SPWORDPRONUNCIATION, - eLexiconType: SPLEXICONTYPE, - LangID: ::WORD, - wPronunciationFlags: ::WORD, - ePartOfSpeech: SPPARTOFSPEECH, - szPronunciation: [SPPHONEID; 1], -}} -STRUCT!{struct SPWORDPRONUNCIATIONLIST { - ulSize: ::ULONG, - pvBuffer: *mut ::BYTE, - pFirstWordPronunciation: *mut SPWORDPRONUNCIATION, -}} -STRUCT!{struct SPWORD { - pNextWord: *mut SPWORD, - LangID: ::WORD, - wReserved: ::WORD, - eWordType: SPWORDTYPE, - pszWord: ::LPWSTR, - pFirstWordPronunciation: *mut SPWORDPRONUNCIATION, -}} -STRUCT!{struct SPWORDLIST { - ulSize: ::ULONG, - pvBuffer: *mut ::BYTE, - pFirstWord: *mut SPWORD, -}} -RIDL!( -interface ISpLexicon(ISpLexiconVtbl): IUnknown(IUnknownVtbl) { - fn GetPronunciations( - &mut self, pszWord: ::LPCWSTR, LangID: ::WORD, dwFlags: ::DWORD, - pWordPronunciationList: *mut SPWORDPRONUNCIATIONLIST - ) -> ::HRESULT, - fn AddPronunciation( - &mut self, pszWord: ::LPCWSTR, LangID: ::WORD, ePartOfSpeech: SPPARTOFSPEECH, - pszPronunciation: PCSPPHONEID - ) -> ::HRESULT, - fn RemovePronunciation( - &mut self, pszWord: ::LPCWSTR, LangID: ::WORD, ePartOfSpeech: SPPARTOFSPEECH, - pszPronunciation: PCSPPHONEID - ) -> ::HRESULT, - fn GetGeneration(&mut self, pdwGeneration: *mut ::DWORD) -> ::HRESULT, - fn GetGenerationChange( - &mut self, dwFlags: ::DWORD, pdwGeneration: *mut ::DWORD, pWordList: *mut SPWORDLIST - ) -> ::HRESULT, - fn GetWords( - &mut self, dwFlags: ::DWORD, pdwGeneration: *mut ::DWORD, pdwCookie: *mut ::DWORD, - pWordList: *mut SPWORDLIST - ) -> ::HRESULT -} -); -RIDL!( -interface ISpContainerLexicon(ISpContainerLexiconVtbl): ISpLexicon(ISpLexiconVtbl) { - fn AddLexicon(&mut self, pAddLexicon: *mut ISpLexicon, dwFlags: ::DWORD) -> ::HRESULT -} -); -ENUM!{enum SPSHORTCUTTYPE { - SPSHT_NotOverriden = -1i32 as u32, - SPSHT_Unknown = 0, - SPSHT_EMAIL = 0x1000, - SPSHT_OTHER = 0x2000, - SPPS_RESERVED1 = 0x3000, - SPPS_RESERVED2 = 0x4000, - SPPS_RESERVED3 = 0x5000, - SPPS_RESERVED4 = 0xf000, -}} -STRUCT!{struct SPSHORTCUTPAIR { - pNextSHORTCUTPAIR: *mut SPSHORTCUTPAIR, - LangID: ::WORD, - shType: SPSHORTCUTTYPE, - pszDisplay: ::LPWSTR, - pszSpoken: ::LPWSTR, -}} -STRUCT!{struct SPSHORTCUTPAIRLIST { - ulSize: ::ULONG, - pvBuffer: *mut ::BYTE, - pFirstShortcutPair: *mut SPSHORTCUTPAIR, -}} -RIDL!( -interface ISpShortcut(ISpShortcutVtbl): IUnknown(IUnknownVtbl) { - fn AddShortcut( - &mut self, pszDisplay: ::LPCWSTR, LangID: ::WORD, pszSpoken: ::LPCWSTR, - shType: SPSHORTCUTTYPE - ) -> ::HRESULT, - fn RemoveShortcut( - &mut self, pszDisplay: ::LPCWSTR, LangID: ::WORD, pszSpoken: ::LPCWSTR, - shType: SPSHORTCUTTYPE - ) -> ::HRESULT, - fn GetShortcuts( - &mut self, LangId: ::WORD, pShortcutpairList: *mut SPSHORTCUTPAIRLIST - ) -> ::HRESULT, - fn GetGeneration(&mut self, pdwGeneration: *mut ::DWORD) -> ::HRESULT, - fn GetWordsFromGenerationChange( - &mut self, pdwGeneration: *mut ::DWORD, pWordList: *mut SPWORDLIST - ) -> ::HRESULT, - fn GetWords( - &mut self, pdwGeneration: *mut ::DWORD, pdwCookie: *mut ::DWORD, pWordList: *mut SPWORDLIST - ) -> ::HRESULT, - fn GetShortcutsForGeneration( - &mut self, pdwGeneration: *mut ::DWORD, pdwCookie: *mut ::DWORD, - pShortcutpairList: *mut SPSHORTCUTPAIRLIST - ) -> ::HRESULT, - fn GetGenerationChange( - &mut self, pdwGeneration: *mut ::DWORD, pShortcutpairList: *mut SPSHORTCUTPAIRLIST - ) -> ::HRESULT -} -); -RIDL!( -interface ISpPhoneConverter(ISpPhoneConverterVtbl): ISpObjectWithToken(ISpObjectWithTokenVtbl) { - fn PhoneToId(&mut self, pszPhone: ::LPCWSTR, pId: *mut SPPHONEID) -> ::HRESULT, - fn IdToPhone(&mut self, pId: PCSPPHONEID, pszPhone: *mut ::WCHAR) -> ::HRESULT -} -); -RIDL!( -interface ISpPhoneticAlphabetConverter(ISpPhoneticAlphabetConverterVtbl): IUnknown(IUnknownVtbl) { - fn GetLangId(&mut self, pLangID: *mut ::WORD) -> ::HRESULT, - fn SetLangId(&mut self, LangID: *mut ::WORD) -> ::HRESULT, - fn SAPI2UPS( - &mut self, pszSAPIId: *const SPPHONEID, pszUPSId: *mut SPPHONEID, cMaxLength: ::DWORD - ) -> ::HRESULT, - fn UPS2SAPI( - &mut self, pszUPSId: *const SPPHONEID, pszSAPIId: *mut SPPHONEID, cMaxLength: ::DWORD - ) -> ::HRESULT, - fn GetMaxConvertLength( - &mut self, cSrcLength: ::DWORD, bSAPI2UPS: ::BOOL, pcMaxDestLength: *mut ::DWORD - ) -> ::HRESULT -} -); -RIDL!( -interface ISpPhoneticAlphabetSelection(ISpPhoneticAlphabetSelectionVtbl): IUnknown(IUnknownVtbl) { - fn IsAlphabetUPS(&mut self, pfIsUPS: *mut ::BOOL) -> ::HRESULT, - fn SetAlphabetToUPS(&mut self, fForceUPS: ::BOOL) -> ::HRESULT -} -); -STRUCT!{struct SPVPITCH { - MiddleAdj: ::c_long, - RangeAdj: ::c_long, -}} -ENUM!{enum SPVACTIONS { - SPVA_Speak = 0, - SPVA_Silence, - SPVA_Pronounce, - SPVA_Bookmark, - SPVA_SpellOut, - SPVA_Section, - SPVA_ParseUnknownTag, -}} -STRUCT!{struct SPVCONTEXT { - pCategory: ::LPCWSTR, - pBefore: ::LPCWSTR, - pAfter: ::LPCWSTR, -}} -STRUCT!{struct SPVSTATE { - eAction: SPVACTIONS, - LangID: ::WORD, - wReserved: ::WORD, - EmphAdj: ::c_long, - RateAdj: ::c_long, - Volume: ::ULONG, - PitchAdj: SPVPITCH, - SilenceMSecs: ::ULONG, - pPhoneIds: *mut SPPHONEID, - ePartOfSpeech: SPPARTOFSPEECH, - Context: SPVCONTEXT, -}} -ENUM!{enum SPRUNSTATE { - SPRS_DONE = 1 << 0, - SPRS_IS_SPEAKING = 1 << 1, -}} -ENUM!{enum SPVLIMITS { - SPMIN_VOLUME = 0, - SPMAX_VOLUME = 100, - SPMIN_RATE = -10i32 as u32, - SPMAX_RATE = 10, -}} -ENUM!{enum SPVPRIORITY { - SPVPRI_NORMAL = 0, - SPVPRI_ALERT = 1 << 0, - SPVPRI_OVER = 1 << 1, -}} -STRUCT!{struct SPVOICESTATUS { - ulCurrentStream: ::ULONG, - ulLastStreamQueued: ::ULONG, - hrLastResult: ::HRESULT, - dwRunningState: ::DWORD, - ulInputWordPos: ::ULONG, - ulInputWordLen: ::ULONG, - ulInputSentPos: ::ULONG, - ulInputSentLen: ::ULONG, - lBookmarkId: ::LONG, - PhonemeId: SPPHONEID, - VisemeId: SPVISEMES, - dwReserved1: ::DWORD, - dwReserved2: ::DWORD, -}} -FLAGS!{enum SPEAKFLAGS { - SPF_DEFAULT = 0, - SPF_ASYNC = 1 << 0, - SPF_PURGEBEFORESPEAK = 1 << 1, - SPF_IS_FILENAME = 1 << 2, - SPF_IS_XML = 1 << 3, - SPF_IS_NOT_XML = 1 << 4, - SPF_PERSIST_XML = 1 << 5, - SPF_NLP_SPEAK_PUNC = 1 << 6, - SPF_PARSE_SAPI = 1 << 7, - SPF_PARSE_SSML = 1 << 8, -}} -pub const SPF_PARSE_AUTODETECT: SPEAKFLAGS = SPF_DEFAULT; -pub const SPF_NLP_MASK: SPEAKFLAGS = SPF_NLP_SPEAK_PUNC; -pub const SPF_PARSE_MASK: i32 = SPF_PARSE_SAPI.0 as i32 | SPF_PARSE_SSML.0 as i32; -pub const SPF_VOICE_MASK: i32 = - SPF_ASYNC.0 as i32 | SPF_PURGEBEFORESPEAK.0 as i32 | SPF_IS_FILENAME.0 as i32 | SPF_IS_XML.0 as i32 | - SPF_IS_NOT_XML.0 as i32 | SPF_NLP_MASK.0 as i32 | SPF_PERSIST_XML.0 as i32 | SPF_PARSE_MASK; -pub const SPF_UNUSED_FLAGS: i32 = !SPF_VOICE_MASK; -RIDL!( -interface ISpVoice(ISpVoiceVtbl): ISpEventSource(ISpEventSourceVtbl) { - fn SetOutput(&mut self, pUnkOutput: *mut ::IUnknown, fAllowFormatChanges: ::BOOL) -> ::HRESULT, - fn GetOutputObjectToken(&mut self, ppObjectToken: *mut *mut ISpObjectToken) -> ::HRESULT, - fn GetOutputStream(&mut self, ppStream: *mut *mut ISpStreamFormat) -> ::HRESULT, - fn Pause(&mut self) -> ::HRESULT, - fn Resume(&mut self) -> ::HRESULT, - fn SetVoice(&mut self, pToken: *mut ISpObjectToken) -> ::HRESULT, - fn GetVoice(&mut self, ppToken: *mut *mut ISpObjectToken) -> ::HRESULT, - fn Speak( - &mut self, pwcs: ::LPCWSTR, dwFlags: ::DWORD, pulStreamNumber: *mut ::ULONG - ) -> ::HRESULT, - fn SpeakStream( - &mut self, pStream: *mut ::IStream, dwFlags: ::DWORD, pulStreamNumber: *mut ::ULONG - ) -> ::HRESULT, - fn GetStatus( - &mut self, pStatus: *mut SPVOICESTATUS, ppszLastBookmark: *mut ::LPWSTR - ) -> ::HRESULT, - fn Skip( - &mut self, pItemType: ::LPCWSTR, lNumItems: ::c_long, pulNumSkipped: *mut ::ULONG - ) -> ::HRESULT, - fn SetPriority(&mut self, ePriority: SPVPRIORITY) -> ::HRESULT, - fn GetPriority(&mut self, pePriority: *mut SPVPRIORITY) -> ::HRESULT, - fn SetAlertBoundary(&mut self, eBoundary: SPEVENTENUM) -> ::HRESULT, - fn GetAlertBoundary(&mut self, peBoundary: *mut SPEVENTENUM) -> ::HRESULT, - fn SetRate(&mut self, RateAdjust: ::c_long) -> ::HRESULT, - fn GetRate(&mut self, pRateAdjust: *mut ::c_long) -> ::HRESULT, - fn SetVolume(&mut self, usVolume: ::USHORT) -> ::HRESULT, - fn GetVolume(&mut self, pusVolume: *mut ::USHORT) -> ::HRESULT, - fn WaitUntilDone(&mut self, msTimeout: ::ULONG) -> ::HRESULT, - fn SetSyncSpeakTimeout(&mut self, msTimeout: ::ULONG) -> ::HRESULT, - fn GetSyncSpeakTimeout(&mut self, pmsTimeout: *mut ::ULONG) -> ::HRESULT, - fn SpeakCompleteEvent(&mut self) -> ::HANDLE, - fn IsUISupported( - &mut self, pszTypeOfUI: ::LPCWSTR, pvExtraData: *mut ::c_void, cbExtraData: ::ULONG, - pfSupported: *mut ::BOOL - ) -> ::HRESULT, - fn DisplayUI( - &mut self, hwndParent: ::HWND, pszTitle: ::LPCWSTR, pszTypeOfUI: ::LPCWSTR, - pvExtraData: *mut ::c_void, cbExtraData: ::ULONG - ) -> ::HRESULT -} -); -DEFINE_GUID!( - UuidOfISpVoice, - 0x6C44DF74, 0x72B9, 0x4992, 0xA1, 0xEC, 0xEF, 0x99, 0x6E, 0x04, 0x22, 0xD4 -); -RIDL!( -interface ISpPhrase(ISpPhraseVtbl): IUnknown(IUnknownVtbl) { - fn GetPhrase(&mut self, ppCoMemPhrase: *mut *mut SPPHRASE) -> ::HRESULT, - fn GetSerializedPhrase(&mut self, ppCoMemPhrase: *mut *mut SPSERIALIZEDPHRASE) -> ::HRESULT, - fn GetText( - &mut self, ulStart: ::ULONG, ulCount: ::ULONG, fUseTextReplacements: ::BOOL, - ppszCoMemText: *mut ::LPWSTR, pbDisplayAttributes: *mut ::BYTE - ) -> ::HRESULT, - fn Discard(&mut self, dwValueTypes: ::DWORD) -> ::HRESULT -} -); -RIDL!( -interface ISpPhraseAlt(ISpPhraseAltVtbl): ISpPhrase(ISpPhraseVtbl) { - fn GetAltInfo( - &mut self, pParent: *mut *mut ISpPhrase, pulStartElementInParent: *mut ::ULONG, - pcElementsInParent: *mut ::ULONG, pcElementsInAlt: *mut ::ULONG - ) -> ::HRESULT, - fn Commit(&mut self) -> ::HRESULT -} -); -ENUM!{enum SPXMLRESULTOPTIONS { - SPXRO_SML = 0, - SPXRO_Alternates_SML = 1, -}} -RIDL!( -interface ISpPhrase2(ISpPhrase2Vtbl): ISpPhrase(ISpPhraseVtbl) { - fn GetXMLResult( - &mut self, ppszCoMemXMLResult: *mut ::LPWSTR, Options: SPXMLRESULTOPTIONS - ) -> ::HRESULT, - fn GetXMLErrorInfo(&mut self, pSemanticErrorInfo: *mut SPSEMANTICERRORINFO) -> ::HRESULT, - fn GetAudio( - &mut self, ulStartElement: ::ULONG, cElements: ::ULONG, ppStream: *mut *mut ISpStreamFormat - ) -> ::HRESULT -} -); -STRUCT!{struct SPRECORESULTTIMES { - ftStreamTime: ::FILETIME, - ullLength: ::ULONGLONG, - dwTickCount: ::DWORD, - ullStart: ::ULONGLONG, -}} -STRUCT!{struct SPSERIALIZEDRESULT { - ulSerializedSize: ::ULONG, -}} -RIDL!( -interface ISpRecoResult(ISpRecoResultVtbl): ISpPhrase(ISpPhraseVtbl) { - fn GetResultTimes(&mut self, pTimes: *mut SPRECORESULTTIMES) -> ::HRESULT, - fn GetAlternates( - &mut self, ulStartElement: ::ULONG, cElements: ::ULONG, ulRequestCount: ::ULONG, - ppPhrases: *mut *mut ISpPhraseAlt, pcPhrasesReturned: *mut ::ULONG - ) -> ::HRESULT, - fn GetAudio( - &mut self, ulStartElement: ::ULONG, cElements: ::ULONG, ppStream: *mut *mut ISpStreamFormat - ) -> ::HRESULT, - fn SpeakAudio( - &mut self, ulStartElement: ::ULONG, cElements: ::ULONG, dwFlags: ::DWORD, - pulStreamNumber: *mut ::ULONG - ) -> ::HRESULT, - fn Serialize(&mut self, ppCoMemSerializedResult: *mut *mut SPSERIALIZEDRESULT) -> ::HRESULT, - fn ScaleAudio( - &mut self, pAudioFormatId: *const ::GUID, pWaveFormatEx: *const ::WAVEFORMATEX - ) -> ::HRESULT, - fn GetRecoContext(&mut self, ppRecoContext: *mut *mut ISpRecoContext) -> ::HRESULT -} -); -FLAGS!{enum SPCOMMITFLAGS { - SPCF_NONE = 0, - SPCF_ADD_TO_USER_LEXICON = 1 << 0, - SPCF_DEFINITE_CORRECTION = 1 << 1, -}} -RIDL!( -interface ISpRecoResult2(ISpRecoResult2Vtbl): ISpRecoResult(ISpRecoResultVtbl) { - fn CommitAlternate( - &mut self, pPhraseAlt: *mut ISpPhraseAlt, ppNewResult: *mut *mut ISpRecoResult - ) -> ::HRESULT, - fn CommitText( - &mut self, ulStartElement: ::ULONG, cElements: ::ULONG, pszCorrectedData: ::LPCWSTR, - eCommitFlags: ::DWORD - ) -> ::HRESULT, - fn SetTextFeedback(&mut self, pszFeedback: ::LPCWSTR, fSuccessful: ::BOOL) -> ::HRESULT -} -); -RIDL!( -interface ISpXMLRecoResult(ISpXMLRecoResultVtbl): ISpRecoResult(ISpRecoResultVtbl) { - fn GetXMLResult( - &mut self, ppszCoMemXMLResult: *mut ::LPWSTR, Options: SPXMLRESULTOPTIONS - ) -> ::HRESULT, - fn GetXMLErrorInfo(&mut self, pSemanticErrorInfo: *mut SPSEMANTICERRORINFO) -> ::HRESULT -} -); -STRUCT!{struct SPTEXTSELECTIONINFO { - ulStartActiveOffset: ::ULONG, - cchActiveChars: ::ULONG, - ulStartSelection: ::ULONG, - cchSelection: ::ULONG, -}} -ENUM!{enum SPWORDPRONOUNCEABLE { - SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE = 0, - SPWP_UNKNOWN_WORD_PRONOUNCEABLE = 1, - SPWP_KNOWN_WORD_PRONOUNCEABLE = 2, -}} -ENUM!{enum SPGRAMMARSTATE { - SPGS_DISABLED = 0, - SPGS_ENABLED = 1, - SPGS_EXCLUSIVE = 3, -}} -ENUM!{enum SPCONTEXTSTATE { - SPCS_DISABLED = 0, - SPCS_ENABLED = 1, -}} -ENUM!{enum SPRULESTATE { - SPRS_INACTIVE = 0, - SPRS_ACTIVE = 1, - SPRS_ACTIVE_WITH_AUTO_PAUSE = 3, - SPRS_ACTIVE_USER_DELIMITED = 4, -}} -pub const SP_STREAMPOS_ASAP: ::INT = 0; -pub const SP_STREAMPOS_REALTIME: ::INT = -1; -pub const SPRULETRANS_TEXTBUFFER: SPSTATEHANDLE = -1isize as SPSTATEHANDLE; -pub const SPRULETRANS_WILDCARD: SPSTATEHANDLE = -2isize as SPSTATEHANDLE; -pub const SPRULETRANS_DICTATION: SPSTATEHANDLE = -3isize as SPSTATEHANDLE; -ENUM!{enum SPGRAMMARWORDTYPE { - SPWT_DISPLAY = 0, - SPWT_LEXICAL = 1, - SPWT_PRONUNCIATION = 2, - SPWT_LEXICAL_NO_SPECIAL_CHARS = 3, -}} -STRUCT!{struct SPPROPERTYINFO { - pszName: ::LPCWSTR, - ulId: ::ULONG, - pszValue: ::LPCWSTR, - vValue: ::VARIANT, -}} -FLAGS!{enum SPCFGRULEATTRIBUTES { - SPRAF_TopLevel = 1 << 0, - SPRAF_Active = 1 << 1, - SPRAF_Export = 1 << 2, - SPRAF_Import = 1 << 3, - SPRAF_Interpreter = 1 << 4, - SPRAF_Dynamic = 1 << 5, - SPRAF_Root = 1 << 6, - SPRAF_AutoPause = 1 << 16, - SPRAF_UserDelimited = 1 << 17, -}} -RIDL!( -interface ISpGrammarBuilder(ISpGrammarBuilderVtbl): IUnknown(IUnknownVtbl) { - fn ResetGrammar(&mut self, NewLanguage: ::WORD) -> ::HRESULT, - fn GetRule( - &mut self, pszRuleName: ::LPCWSTR, dwRuleId: ::DWORD, dwAttributes: ::DWORD, - fCreateIfNotExist: ::BOOL, phInitialState: *mut SPSTATEHANDLE - ) -> ::HRESULT, - fn ClearRule(&mut self, hState: SPSTATEHANDLE) -> ::HRESULT, - fn CreateNewState(&mut self, hState: SPSTATEHANDLE, phState: *mut SPSTATEHANDLE) -> ::HRESULT, - fn AddWordTransition( - &mut self, hFromState: SPSTATEHANDLE, hToState: SPSTATEHANDLE, psz: ::LPCWSTR, - pszSeparators: ::LPCWSTR, eWordType: SPGRAMMARWORDTYPE, Weight: ::c_float, - pPropInfo: *const SPPROPERTYINFO - ) -> ::HRESULT, - fn AddRuleTransition( - &mut self, hFromState: SPSTATEHANDLE, hToState: SPSTATEHANDLE, hRule: SPSTATEHANDLE, - Weight: ::c_float, pPropInfo: *const SPPROPERTYINFO - ) -> ::HRESULT, - fn AddResource( - &mut self, hRuleState: SPSTATEHANDLE, pszResourceName: ::LPCWSTR, - pszResourceValue: ::LPCWSTR - ) -> ::HRESULT, - fn Commit(&mut self, dwReserved: ::DWORD) -> ::HRESULT -} -); -ENUM!{enum SPLOADOPTIONS { - SPLO_STATIC = 0, - SPLO_DYNAMIC = 1, -}} -RIDL!( -interface ISpRecoGrammar(ISpRecoGrammarVtbl): ISpGrammarBuilder(ISpGrammarBuilderVtbl) { - fn GetGrammarId(&mut self, pullGrammarId: *mut ::ULONGLONG) -> ::HRESULT, - fn GetRecoContext(&mut self, ppRecoCtxt: *mut *mut ISpRecoContext) -> ::HRESULT, - fn LoadCmdFromFile(&mut self, pszFileName: ::LPCWSTR, Options: SPLOADOPTIONS) -> ::HRESULT, - fn LoadCmdFromObject( - &mut self, rcid: ::REFCLSID, pszGrammarName: ::LPCWSTR, Options: SPLOADOPTIONS - ) -> ::HRESULT, - fn LoadCmdFromResource( - &mut self, hModule: ::HMODULE, pszResourceName: ::LPCWSTR, pszResourceType: ::LPCWSTR, - wLanguage: ::WORD, Options: SPLOADOPTIONS - ) -> ::HRESULT, - fn LoadCmdFromMemory( - &mut self, pGrammar: *const SPBINARYGRAMMAR, Options: SPLOADOPTIONS - ) -> ::HRESULT, - fn LoadCmdFromProprietaryGrammar( - &mut self, rguidParam: ::REFGUID, pszStringParam: ::LPCWSTR, pvDataPrarm: *const ::c_void, - cbDataSize: ::ULONG, Options: SPLOADOPTIONS - ) -> ::HRESULT, - fn SetRuleState( - &mut self, pszName: ::LPCWSTR, pReserved: *mut ::c_void, NewState: SPRULESTATE - ) -> ::HRESULT, - fn SetRuleIdState(&mut self, ulRuleId: ::ULONG, NewState: SPRULESTATE) -> ::HRESULT, - fn LoadDictation(&mut self, pszTopicName: ::LPCWSTR, Options: SPLOADOPTIONS) -> ::HRESULT, - fn UnloadDictation(&mut self) -> ::HRESULT, - fn SetDictationState(&mut self, NewState: SPRULESTATE) -> ::HRESULT, - fn SetWordSequenceData( - &mut self, pText: *const ::WCHAR, cchText: ::ULONG, pInfo: *const SPTEXTSELECTIONINFO - ) -> ::HRESULT, - fn SetTextSelection(&mut self, pInfo: *const SPTEXTSELECTIONINFO) -> ::HRESULT, - fn IsPronounceable( - &mut self, pszWord: ::LPCWSTR, pWordPronounceable: *mut SPWORDPRONOUNCEABLE - ) -> ::HRESULT, - fn SetGrammarState(&mut self, eGrammarState: SPGRAMMARSTATE) -> ::HRESULT, - fn SaveCmd(&mut self, pStream: *mut ::IStream, ppszCoMemErrorText: *mut ::LPWSTR) -> ::HRESULT, - fn GetGrammarState(&mut self, peGrammarState: *mut SPGRAMMARSTATE) -> ::HRESULT -} -); -ENUM!{enum SPMATCHINGMODE { - AllWords = 0, - Subsequence = 1, - OrderedSubset = 3, - SubsequenceContentRequired = 5, - OrderedSubsetContentRequired = 7, -}} -ENUM!{enum PHONETICALPHABET { - PA_Ipa = 0, - PA_Ups = 1, - PA_Sapi = 2, -}} -RIDL!( -interface ISpGrammarBuilder2(ISpGrammarBuilder2Vtbl): IUnknown(IUnknownVtbl) { - fn AddTextSubset( - &mut self, hFromState: SPSTATEHANDLE, hToState: SPSTATEHANDLE, psz: ::LPCWSTR, - eMatchMode: SPMATCHINGMODE - ) -> ::HRESULT, - fn SetPhoneticAlphabet(&mut self, phoneticALphabet: PHONETICALPHABET) -> ::HRESULT -} -); -RIDL!( -interface ISpRecoGrammar2(ISpRecoGrammar2Vtbl): IUnknown(IUnknownVtbl) { - fn GetRules(&mut self, ppCoMemRules: *mut *mut SPRULE, puNumRules: *mut ::UINT) -> ::HRESULT, - fn LoadCmdFromFile2( - &mut self, pszFileName: ::LPCWSTR, Options: SPLOADOPTIONS, pszSharingUri: ::LPCWSTR, - pszBaseUri: ::LPCWSTR - ) -> ::HRESULT, - fn LoadCmdFromMemory2( - &mut self, pGrammar: *const SPBINARYGRAMMAR, Options: SPLOADOPTIONS, - pszSharingUri: ::LPCWSTR, pszBaseUri: ::LPCWSTR - ) -> ::HRESULT, - fn SetRulePriority( - &mut self, pszRuleName: ::LPCWSTR, ulRuleId: ::ULONG, nRulePriority: ::c_int - ) -> ::HRESULT, - fn SetRuleWeight( - &mut self, pszRuleName: ::LPCWSTR, ulRuleId: ::ULONG, flWeight: ::c_float - ) -> ::HRESULT, - fn SetDictationWeight(&mut self, flWeight: ::c_float) -> ::HRESULT, - fn SetGrammarLoader(&mut self, pLoader: *mut ISpeechResourceLoader) -> ::HRESULT, - fn SetSMLSecurityManager( - &mut self, pSMLSecurityManager: *mut ::IInternetSecurityManager - ) -> ::HRESULT -} -); -RIDL!( -interface ISpeechResourceLoader(ISpeechResourceLoaderVtbl): IDispatch(IDispatchVtbl) { - fn LoadResource( - &mut self, bstrResourceUri: ::BSTR, fAlwaysReload: ::VARIANT_BOOL, - pStream: *mut *mut ::IUnknown, pbstrMIMEType: *mut ::BSTR, pfModified: *mut ::VARIANT_BOOL, - pbstrRedirectUrl: *mut ::BSTR - ) -> ::HRESULT, - fn GetLocalCopy( - &mut self, bstrResourceUri: ::BSTR, pbstrLocalPath: *mut ::BSTR, - pbstrMIMEType: *mut ::BSTR, pbstrRedirectUrl: *mut ::BSTR - ) -> ::HRESULT, - fn ReleaseLocalCopy(&mut self, pbstrLocalPath: ::BSTR) -> ::HRESULT -} -); -STRUCT!{nodebug struct SPRECOCONTEXTSTATUS { - eInterference: SPINTERFERENCE, - szRequestTypeOfUI: [::WCHAR; 255], - dwReserved1: ::DWORD, - dwReserved2: ::DWORD, -}} -FLAGS!{enum SPBOOKMARKOPTIONS { - SPBO_NONE = 0, - SPBO_PAUSE = 1 << 0, - SPBO_AHEAD = 1 << 1, - SPBO_TIME_UNITS = 1 << 2, -}} -FLAGS!{enum SPAUDIOOPTIONS { - SPAO_NONE = 0, - SPAO_RETAIN_AUDIO = 1 << 0, -}} -RIDL!( -interface ISpRecoContext(ISpRecoContextVtbl): ISpEventSource(ISpEventSourceVtbl) { - fn GetRecognizer(&mut self, ppRecognizer: *mut *mut ISpRecognizer) -> ::HRESULT, - fn CreateGrammer( - &mut self, ullGrammarId: ::ULONGLONG, ppGrammar: *mut *mut ISpRecoGrammar - ) -> ::HRESULT, - fn GetStatus(&mut self, pState: *mut SPRECOCONTEXTSTATUS) -> ::HRESULT, - fn GetMaxAlternates(&mut self, pcAlternates: *mut ::ULONG) -> ::HRESULT, - fn SetMaxAlternates(&mut self, cAlternates: ::ULONG) -> ::HRESULT, - fn SetAudioOptions( - &mut self, Options: SPAUDIOOPTIONS, pAudioFormatId: *const ::GUID, - pWaveFormatEx: *const ::WAVEFORMATEX - ) -> ::HRESULT, - fn GetAudioOptions( - &mut self, pOptions: *mut SPAUDIOOPTIONS, pAudioFormatId: *mut ::GUID, - ppCoMemWFEX: *mut *mut ::WAVEFORMATEX - ) -> ::HRESULT, - fn DeserializeResult( - &mut self, pSerializedResult: *const SPSERIALIZEDRESULT, ppResult: *mut *mut ISpRecoResult - ) -> ::HRESULT, - fn Bookmark( - &mut self, Options: SPBOOKMARKOPTIONS, ullStreamPosition: ::ULONGLONG, - lparamEvent: ::LPARAM - ) -> ::HRESULT, - fn SetAdaptionData(&mut self, pAdaptionData: ::LPCWSTR, cch: ::ULONG) -> ::HRESULT, - fn Pause(&mut self, dwReserved: ::DWORD) -> ::HRESULT, - fn Resume(&mut self, dwReserved: ::DWORD) -> ::HRESULT, - fn SetVoice(&mut self, pVoice: *mut ISpVoice, fAllowFormatChanges: ::BOOL) -> ::HRESULT, - fn GetVoice(&mut self, ppVoice: *mut *mut ISpVoice) -> ::HRESULT, - fn SetVoicePurgeEvent(&mut self, ullEventIntereset: ::ULONGLONG) -> ::HRESULT, - fn GetVoicePurgeEvent(&mut self, pullEventIntereset: *mut ::ULONGLONG) -> ::HRESULT, - fn SetContextState(&mut self, eContextState: SPCONTEXTSTATE) -> ::HRESULT, - fn GetContextState(&mut self, peContextState: *mut SPCONTEXTSTATE) -> ::HRESULT -} -); -FLAGS!{enum SPGRAMMAROPTIONS { - SPGO_SAPI = 0x1, - SPGO_SRGS = 0x2, - SPGO_UPS = 0x4, - SPGO_SRGS_MS_SCRIPT = 0x8, - SPGO_SRGS_W3C_SCRIPT = 0x100, - SPGO_SRGS_STG_SCRIPT = 0x200, - SPGO_SRGS_SCRIPT = - SPGO_SRGS.0 | SPGO_SRGS_MS_SCRIPT.0 | SPGO_SRGS_W3C_SCRIPT.0 | - SPGO_SRGS_STG_SCRIPT.0, - SPGO_FILE = 0x10, - SPGO_HTTP = 0x20, - SPGO_RES = 0x40, - SPGO_OBJECT = 0x80, - SPGO_DEFAULT = 0x3fb, - SPGO_ALL = 0x3ff, -}} -FLAGS!{enum SPADAPTATIONSETTINGS { - SPADS_Default = 0, - SPADS_CurrentRecognizer = 0x1, - SPADS_RecoProfile = 0x2, - SPADS_Immediate = 0x4, - SPADS_Reset = 0x8, - SPADS_HighVolumeDataSource = 0x10, -}} -ENUM!{enum SPADAPTATIONRELEVANCE { - SPAR_Unknown = 0, - SPAR_Low = 1, - SPAR_Medium = 2, - SPAR_High = 3, -}} -RIDL!( -interface ISpRecoContext2(ISpRecoContext2Vtbl): IUnknown(IUnknownVtbl) { - fn SetGrammarOptions(&mut self, eGrammarOptions: ::DWORD) -> ::HRESULT, - fn GetGrammarOptions(&mut self, peGrammarOptions: *mut ::DWORD) -> ::HRESULT, - fn SetAdaptationData2( - &mut self, pAdaptationData: ::LPCWSTR, cch: ::ULONG, pTopicName: ::LPCWSTR, - eAdaptationSettings: ::DWORD, eRelevance: SPADAPTATIONRELEVANCE - ) -> ::HRESULT -} -); -RIDL!( -interface ISpProperties(ISpPropertiesVtbl): IUnknown(IUnknownVtbl) { - fn SetPropertyNum(&mut self, pName: ::LPCWSTR, lValue: ::LONG) -> ::HRESULT, - fn GetPropertyNum(&mut self, pName: ::LPCWSTR, plValue: *mut ::LONG) -> ::HRESULT, - fn SetPropertyString(&mut self, pName: ::LPCWSTR, pValue: ::LPCWSTR) -> ::HRESULT, - fn GetPropertyString(&mut self, pName: ::LPCWSTR, ppCoMemValue: *mut ::LPWSTR) -> ::HRESULT -} -); -STRUCT!{struct SPRECOGNIZERSTATUS { - AudioStatus: SPAUDIOSTATUS, - ullRecognitionStreamPos: ::ULONGLONG, - ulStreamNumber: ::ULONG, - ulNumActive: ::ULONG, - clsidEngine: ::CLSID, - cLangIDs: ::ULONG, - aLangID: [::WORD; 20], - ullRecognitionStreamTime: ::ULONGLONG, -}} -ENUM!{enum SPWAVEFORMATTYPE { - SPWF_INPUT = 0, - SPWF_SRENGINE = 1, -}} -pub type SPSTREAMFORMATTYPE = SPWAVEFORMATTYPE; -ENUM!{enum SPRECOSTATE { - SPRST_INACTIVE = 0, - SPRST_ACTIVE = 1, - SPRST_ACTIVE_ALWAYS = 2, - SPRST_INACTIVE_WITH_PURGE = 3, - SPRST_NUM_STATES = 4, -}} -RIDL!( -interface ISpRecognizer(ISpRecognizerVtbl): ISpProperties(ISpPropertiesVtbl) { - fn SetRecognizer(&mut self, pRecognizer: *mut ISpObjectToken) -> ::HRESULT, - fn GetRecognizer(&mut self, ppRecognizer: *mut *mut ISpObjectToken) -> ::HRESULT, - fn SetInput(&mut self, pUnkInput: *mut ::IUnknown, fAllowFormatChanges: ::BOOL) -> ::HRESULT, - fn GetInputObjectToken(&mut self, ppToken: *mut *mut ISpObjectToken) -> ::HRESULT, - fn GetInputStream(&mut self, ppStream: *mut *mut ISpStreamFormat) -> ::HRESULT, - fn CreateRecoContext(&mut self, ppNewCtxt: *mut *mut ISpRecoContext) -> ::HRESULT, - fn GetRecoProfile(&mut self, ppToken: *mut *mut ISpObjectToken) -> ::HRESULT, - fn SetRecoProfile(&mut self, pToken: *mut ISpObjectToken) -> ::HRESULT, - fn IsSharedInstance(&mut self) -> ::HRESULT, - fn GetRecoState(&mut self, pState: *mut SPRECOSTATE) -> ::HRESULT, - fn SetRecoState(&mut self, NewState: SPRECOSTATE) -> ::HRESULT, - fn GetStatus(&mut self, pStatus: *mut SPRECOGNIZERSTATUS) -> ::HRESULT, - fn GetFormat( - &mut self, WaveFormatType: SPSTREAMFORMATTYPE, pFormatId: *mut ::GUID, - ppCoMemWFEX: *mut ::WAVEFORMATEX - ) -> ::HRESULT, - fn IsUISupported( - &mut self, pszTypeOfUI: ::LPCWSTR, pvExtraData: *mut ::c_void, cbExtraData: ::ULONG, - pfSupported: *mut ::BOOL - ) -> ::HRESULT, - fn DisplayUI( - &mut self, hwndParent: ::HWND, pszTitle: ::LPCWSTR, pszTypeOfUI: ::LPCWSTR, - pvExtraData: *mut ::c_void, cbExtraData: ::ULONG - ) -> ::HRESULT, - fn EmulateRecognition(&mut self, pPhrase: *mut ISpPhrase) -> ::HRESULT -} -); -RIDL!( -interface ISpSerializeState(ISpSerializeStateVtbl): IUnknown(IUnknownVtbl) { - fn GetSerializedState( - &mut self, ppbData: *mut *mut ::BYTE, pulSize: *mut ::ULONG, dwReserved: ::DWORD - ) -> ::HRESULT, - fn SetSerializedState( - &mut self, pbData: *mut ::BYTE, ulSize: ::ULONG, dwReserved: ::DWORD - ) -> ::HRESULT -} -); -RIDL!( -interface ISpRecognizer2(ISpRecognizer2Vtbl): IUnknown(IUnknownVtbl) { - fn EmulateRecognitionEx( - &mut self, pPhrase: *mut ISpPhrase, dwCompareFlags: ::DWORD - ) -> ::HRESULT, - fn SetTrainingState( - &mut self, fDoingTraining: ::BOOL, fAdaptFromTrainingData: ::BOOL - ) -> ::HRESULT, - fn ResetAcousticModelAdaptation(&mut self) -> ::HRESULT -} -); -ENUM!{enum SPCATEGORYTYPE { - SPCT_COMMAND = 0, - SPCT_DICTATION, - SPCT_SLEEP, - SPCT_SUB_COMMAND, - SPCT_SUB_DICTATION, -}} -RIDL!( -interface ISpRecoCategory(ISpRecoCategoryVtbl): IUnknown(IUnknownVtbl) { - fn GetType(&mut self, peCategoryType: *mut SPCATEGORYTYPE) -> ::HRESULT -} -); -RIDL!( -interface ISpRecognizer3(ISpRecognizer3Vtbl): IUnknown(IUnknownVtbl) { - fn GetCategory( - &mut self, categoryType: SPCATEGORYTYPE, ppCategory: *mut *mut ISpRecoCategory - ) -> ::HRESULT, - fn SetActiveCategory(&mut self, pCategory: *mut ISpRecoCategory) -> ::HRESULT, - fn GetActiveCategory(&mut self, ppCategory: *mut *mut ISpRecoCategory) -> ::HRESULT -} -); -STRUCT!{struct SPNORMALIZATIONLIST { - ulSize: ::ULONG, - ppszzNormalizedList: *mut *mut ::WCHAR, -}} -RIDL!( -interface ISpEnginePronunciation(ISpEnginePronunciationVtbl): IUnknown(IUnknownVtbl) { - fn Normalize( - &mut self, pszWord: ::LPCWSTR, pszLeftContext: ::LPCWSTR, pszRightContext: ::LPCWSTR, - LangID: ::WORD, pNormalizationList: *mut SPNORMALIZATIONLIST - ) -> ::HRESULT, - fn GetPronunciations( - &mut self, pszWord: ::LPCWSTR, pszLeftContext: ::LPCWSTR, pszRightContext: ::LPCWSTR, - LangID: ::WORD, pEnginePronunciationList: *mut SPWORDPRONUNCIATIONLIST - ) -> ::HRESULT -} -); -STRUCT!{struct SPDISPLAYTOKEN { - pszLexical: *const ::WCHAR, - pszDisplay: *const ::WCHAR, - bDisplayAttributes: ::BYTE, -}} -STRUCT!{struct SPDISPLAYPHRASE { - ulNumTokens: ::ULONG, - pTokens: *mut SPDISPLAYTOKEN, -}} -RIDL!( -interface ISpDisplayAlternates(ISpDisplayAlternatesVtbl): IUnknown(IUnknownVtbl) { - fn GetDisplayAlternates( - &mut self, pPhrase: *const SPDISPLAYPHRASE, cRequestCount: ::ULONG, - ppCoMemPhrases: *mut *mut SPDISPLAYPHRASE, pcPhrasesReturned: *mut ::ULONG - ) -> ::HRESULT, - fn SetFullStopTrailSpace(&mut self, ulTrailSpace: ::ULONG) -> ::HRESULT -} -); -pub type SpeechLanguageId = ::c_long; -ENUM!{enum DISPID_SpeechDataKey { - DISPID_SDKSetBinaryValue = 1, - DISPID_SDKGetBinaryValue, - DISPID_SDKSetStringValue, - DISPID_SDKGetStringValue, - DISPID_SDKSetLongValue, - DISPID_SDKGetlongValue, - DISPID_SDKOpenKey, - DISPID_SDKCreateKey, - DISPID_SDKDeleteKey, - DISPID_SDKDeleteValue, - DISPID_SDKEnumKeys, - DISPID_SDKEnumValues, -}} -ENUM!{enum DISPID_SpeechObjectToken { - DISPID_SOTId = 1, - DISPID_SOTDataKey, - DISPID_SOTCategory, - DISPID_SOTGetDescription, - DISPID_SOTSetId, - DISPID_SOTGetAttribute, - DISPID_SOTCreateInstance, - DISPID_SOTRemove, - DISPID_SOTGetStorageFileName, - DISPID_SOTRemoveStorageFileName, - DISPID_SOTIsUISupported, - DISPID_SOTDisplayUI, - DISPID_SOTMatchesAttributes, -}} -ENUM!{enum SpeechDataKeyLocation { - SDKLDefaultLocation = SPDKL_DefaultLocation.0, - SDKLCurrentUser = SPDKL_CurrentUser.0, - SDKLLocalMachine = SPDKL_LocalMachine.0, - SDKLCurrentConfig = SPDKL_CurrentConfig.0, -}} -ENUM!{enum SpeechTokenContext { - STCInprocServer = ::CLSCTX_INPROC_SERVER, - STCInprocHandler = ::CLSCTX_INPROC_HANDLER, - STCLocalServer = ::CLSCTX_LOCAL_SERVER, - STCRemoteServer = ::CLSCTX_REMOTE_SERVER, - STCAll = ::CLSCTX_INPROC_SERVER | ::CLSCTX_INPROC_HANDLER | - ::CLSCTX_LOCAL_SERVER | ::CLSCTX_REMOTE_SERVER, -}} -ENUM!{enum SpeechTokenShellFolder { - STSF_AppData = 0x1a, - STSF_LocalAppData = 0x1c, - STSF_CommonAppData = 0x23, - STSF_FlagCreate = 0x8000, -}} -ENUM!{enum DISPID_SpeechObjectTokens { - DISPID_SOTsCount = 1, - DISPID_SOTsItem = ::DISPID_VALUE as u32, - DISPID_SOTs_NewEnum = ::DISPID_NEWENUM as u32, -}} -ENUM!{enum DISPID_SpeechObjectTokenCategory { - DISPID_SOTCId = 1, - DISPID_SOTCDefault, - DISPID_SOTCSetId, - DISPID_SOTCGetDataKey, - DISPID_SOTCEnumerateTokens, -}} -ENUM!{enum SpeechAudioFormatType { - SAFTDefault = -1i32 as u32, - SAFTNoAssignedFormat = 0, - SAFTText = 1, - SAFTNonStandardFormat = 2, - SAFTExtendedAudioFormat = 3, - SAFT8kHz8BitMono = 4, - SAFT8kHz8BitStereo = 5, - SAFT8kHz16BitMono = 6, - SAFT8kHz16BitStereo = 7, - SAFT11kHz8BitMono = 8, - SAFT11kHz8BitStereo = 9, - SAFT11kHz16BitMono = 10, - SAFT11kHz16BitStereo = 11, - SAFT12kHz8BitMono = 12, - SAFT12kHz8BitStereo = 13, - SAFT12kHz16BitMono = 14, - SAFT12kHz16BitStereo = 15, - SAFT16kHz8BitMono = 16, - SAFT16kHz8BitStereo = 17, - SAFT16kHz16BitMono = 18, - SAFT16kHz16BitStereo = 19, - SAFT22kHz8BitMono = 20, - SAFT22kHz8BitStereo = 21, - SAFT22kHz16BitMono = 22, - SAFT22kHz16BitStereo = 23, - SAFT24kHz8BitMono = 24, - SAFT24kHz8BitStereo = 25, - SAFT24kHz16BitMono = 26, - SAFT24kHz16BitStereo = 27, - SAFT32kHz8BitMono = 28, - SAFT32kHz8BitStereo = 29, - SAFT32kHz16BitMono = 30, - SAFT32kHz16BitStereo = 31, - SAFT44kHz8BitMono = 32, - SAFT44kHz8BitStereo = 33, - SAFT44kHz16BitMono = 34, - SAFT44kHz16BitStereo = 35, - SAFT48kHz8BitMono = 36, - SAFT48kHz8BitStereo = 37, - SAFT48kHz16BitMono = 38, - SAFT48kHz16BitStereo = 39, - SAFTTrueSpeech_8kHz1BitMono = 40, - SAFTCCITT_ALaw_8kHzMono = 41, - SAFTCCITT_ALaw_8kHzStereo = 42, - SAFTCCITT_ALaw_11kHzMono = 43, - SAFTCCITT_ALaw_11kHzStereo = 44, - SAFTCCITT_ALaw_22kHzMono = 45, - SAFTCCITT_ALaw_22kHzStereo = 46, - SAFTCCITT_ALaw_44kHzMono = 47, - SAFTCCITT_ALaw_44kHzStereo = 48, - SAFTCCITT_uLaw_8kHzMono = 49, - SAFTCCITT_uLaw_8kHzStereo = 50, - SAFTCCITT_uLaw_11kHzMono = 51, - SAFTCCITT_uLaw_11kHzStereo = 52, - SAFTCCITT_uLaw_22kHzMono = 53, - SAFTCCITT_uLaw_22kHzStereo = 54, - SAFTCCITT_uLaw_44kHzMono = 55, - SAFTCCITT_uLaw_44kHzStereo = 56, - SAFTADPCM_8kHzMono = 57, - SAFTADPCM_8kHzStereo = 58, - SAFTADPCM_11kHzMono = 59, - SAFTADPCM_11kHzStereo = 60, - SAFTADPCM_22kHzMono = 61, - SAFTADPCM_22kHzStereo = 62, - SAFTADPCM_44kHzMono = 63, - SAFTADPCM_44kHzStereo = 64, - SAFTGSM610_8kHzMono = 65, - SAFTGSM610_11kHzMono = 66, - SAFTGSM610_22kHzMono = 67, - SAFTGSM610_44kHzMono = 68, -}} -ENUM!{enum DISPID_SpeechAudioFormat { - DISPID_SAFType = 1, - DISPID_SAFGuid, - DISPID_SAFGetWaveFormatEx, - DISPID_SAFSetWaveFormatEx, -}} -ENUM!{enum DISPID_SpeechBaseStream { - DISPID_SBSFormat = 1, - DISPID_SBSRead, - DISPID_SBSWrite, - DISPID_SBSSeek, -}} -ENUM!{enum SpeechStreamSeekPositionType { - SSSPTRelativeToStart = ::STREAM_SEEK_SET.0, - SSSPTRelativeToCurrentPosition = ::STREAM_SEEK_CUR.0, - SSSPTRelativeToEnd = ::STREAM_SEEK_END.0, -}} -ENUM!{enum DISPID_SpeechAudio { - DISPID_SAStatus = 200, - DISPID_SABufferInfo, - DISPID_SADefaultFormat, - DISPID_SAVolume, - DISPID_SABufferNotifySize, - DISPID_SAEventHandle, - DISPID_SASetState, -}} -ENUM!{enum SpeechAudioState { - SASClosed = SPAS_CLOSED.0, - SASStop = SPAS_STOP.0, - SASPause = SPAS_PAUSE.0, - SASRun = SPAS_RUN.0, -}} -ENUM!{enum DISPID_SpeechMMSysAudio { - DISPID_SMSADeviceId = 300, - DISPID_SMSALineId, - DISPID_SMSAMMHandle, -}} -ENUM!{enum DISPID_SpeechFileStream { - DISPID_SFSOpen = 100, - DISPID_SFSClose, -}} -ENUM!{enum SpeechStreamFileMode { - SSFMOpenForRead = SPFM_OPEN_READONLY.0, - SSFMOpenReadWrite = SPFM_OPEN_READWRITE.0, - SSFMCreate = SPFM_CREATE.0, - SSFMCreateForWrite = SPFM_CREATE_ALWAYS.0, -}} -ENUM!{enum DISPID_SpeechCustomStream { - DISPID_SCSBaseStream = 100, -}} -ENUM!{enum DISPID_SpeechMemoryStream { - DISPID_SMSSetData = 100, - DISPID_SMSGetData, -}} -ENUM!{enum DISPID_SpeechAudioStatus { - DISPID_SASFreeBufferSpace = 1, - DISPID_SASNonBlockingIO, - DISPID_SASState, - DISPID_SASCurrentSeekPosition, - DISPID_SASCurrentDevicePosition, -}} -ENUM!{enum DISPID_SpeechAudioBufferInfo { - DISPID_SABIMinNotification = 1, - DISPID_SABIBufferSize, - DISPID_SABIEventBias, -}} -ENUM!{enum DISPID_SpeechWaveFormatEx { - DISPID_SWFEFormatTag = 1, - DISPID_SWFEChannels, - DISPID_SWFESamplesPerSec, - DISPID_SWFEAvgBytesPerSec, - DISPID_SWFEBlockAlign, - DISPID_SWFEBitsPerSample, - DISPID_SWFEExtraData, -}} -ENUM!{enum DISPID_SpeechVoice { - DISPID_SVStatus = 1, - DISPID_SVVoice, - DISPID_SVAudioOutput, - DISPID_SVAudioOutputStream, - DISPID_SVRate, - DISPID_SVVolume, - DISPID_SVAllowAudioOuputFormatChangesOnNextSet, - DISPID_SVEventInterests, - DISPID_SVPriority, - DISPID_SVAlertBoundary, - DISPID_SVSyncronousSpeakTimeout, - DISPID_SVSpeak, - DISPID_SVSpeakStream, - DISPID_SVPause, - DISPID_SVResume, - DISPID_SVSkip, - DISPID_SVGetVoices, - DISPID_SVGetAudioOutputs, - DISPID_SVWaitUntilDone, - DISPID_SVSpeakCompleteEvent, - DISPID_SVIsUISupported, - DISPID_SVDisplayUI, -}} -ENUM!{enum SpeechVoicePriority { - SVPNormal = SPVPRI_NORMAL.0, - SVPAlert = SPVPRI_ALERT.0, - SVPOver = SPVPRI_OVER.0, -}} -FLAGS!{enum SpeechVoiceSpeakFlags { - SVSFDefault = SPF_DEFAULT.0, - SVSFlagsAsync = SPF_ASYNC.0, - SVSFPurgeBeforeSpeak = SPF_PURGEBEFORESPEAK.0, - SVSFIsFilename = SPF_IS_FILENAME.0, - SVSFIsXML = SPF_IS_XML.0, - SVSFIsNotXML = SPF_IS_NOT_XML.0, - SVSFPersistXML = SPF_PERSIST_XML.0, - SVSFNLPSpeakPunc = SPF_NLP_SPEAK_PUNC.0, - SVSFParseSapi = SPF_PARSE_SAPI.0, - SVSFParseSsml = SPF_PARSE_SSML.0, - SVSFParseMask = SPF_PARSE_MASK as u32, - SVSFVoiceMask = SPF_VOICE_MASK as u32, - SVSFUnusedFlags = SPF_UNUSED_FLAGS as u32, -}} -pub const SVSFParseAutodetect: SpeechVoiceSpeakFlags = SVSFDefault; -pub const SVSFNLPMask: SpeechVoiceSpeakFlags = SVSFNLPSpeakPunc; -FLAGS!{enum SpeechVoiceEvents { - SVEStartInputStream = 1 << 1, - SVEEndInputStream = 1 << 2, - SVEVoiceChange = 1 << 3, - SVEBookmark = 1 << 4, - SVEWordBoundary = 1 << 5, - SVEPhoneme = 1 << 6, - SVESentenceBoundary = 1 << 7, - SVEViseme = 1 << 8, - SVEAudioLevel = 1 << 9, - SVEPrivate = 1 << 15, - SVEAllEvents = 0x83fe, -}} -ENUM!{enum DISPID_SpeechVoiceStatus { - DISPID_SVSCurrentStreamNumber = 1, - DISPID_SVSLastStreamNumberQueued, - DISPID_SVSLastResult, - DISPID_SVSRunningState, - DISPID_SVSInputWordPosition, - DISPID_SVSInputWordLength, - DISPID_SVSInputSentencePosition, - DISPID_SVSInputSentenceLength, - DISPID_SVSLastBookmark, - DISPID_SVSLastBookmarkId, - DISPID_SVSPhonemeId, - DISPID_SVSVisemeId, -}} -ENUM!{enum SpeechRunState { - SRSEDone = SPRS_DONE.0, - SRSEIsSpeaking = SPRS_IS_SPEAKING.0, -}} -ENUM!{enum SpeechVisemeType { - SVP_0 = 0, - SVP_1, - SVP_2, - SVP_3, - SVP_4, - SVP_5, - SVP_6, - SVP_7, - SVP_8, - SVP_9, - SVP_10, - SVP_11, - SVP_12, - SVP_13, - SVP_14, - SVP_15, - SVP_16, - SVP_17, - SVP_18, - SVP_19, - SVP_20, - SVP_21, -}} -ENUM!{enum SpeechVisemeFeature { - SVF_None = 0, - SVF_Stressed = SPVFEATURE_STRESSED.0, - SVF_Emphasis = SPVFEATURE_EMPHASIS.0, -}} -ENUM!{enum DISPID_SpeechVoiceEvent { - DISPID_SVEStreamStart = 1, - DISPID_SVEStreamEnd, - DISPID_SVEVoiceChange, - DISPID_SVEBookmark, - DISPID_SVEWord, - DISPID_SVEPhoneme, - DISPID_SVESentenceBoundary, - DISPID_SVEViseme, - DISPID_SVEAudioLevel, - DISPID_SVEEnginePrivate, -}} -ENUM!{enum DISPID_SpeechRecognizer { - DISPID_SRRecognizer = 1, - DISPID_SRAllowAudioInputFormatChangesOnNextSet, - DISPID_SRAudioInput, - DISPID_SRAudioInputStream, - DISPID_SRIsShared, - DISPID_SRState, - DISPID_SRStatus, - DISPID_SRProfile, - DISPID_SREmulateRecognition, - DISPID_SRCreateRecoContext, - DISPID_SRGetFormat, - DISPID_SRSetPropertyNumber, - DISPID_SRGetPropertyNumber, - DISPID_SRSetPropertyString, - DISPID_SRGetPropertyString, - DISPID_SRIsUISupported, - DISPID_SRDisplayUI, - DISPID_SRGetRecognizers, - DISPID_SVGetAudioInputs, - DISPID_SVGetProfiles, -}} -ENUM!{enum SpeechRecognizerState { - SRSInactive = SPRST_INACTIVE.0, - SRSActive = SPRST_ACTIVE.0, - SRSActiveAlways = SPRST_ACTIVE_ALWAYS.0, - SRSInactiveWithPurge = SPRST_INACTIVE_WITH_PURGE.0, -}} -ENUM!{enum SpeechDisplayAttributes { - SDA_No_Trailing_Space = 0, - SDA_One_Trailing_Space = SPAF_ONE_TRAILING_SPACE.0, - SDA_Two_Trailing_Spaces = SPAF_TWO_TRAILING_SPACES.0, - SDA_Consume_Leading_Spaces = SPAF_CONSUME_LEADING_SPACES.0, -}} -ENUM!{enum SpeechFormatType { - SFTInput = SPWF_INPUT.0, - SFTSREngine = SPWF_SRENGINE.0, -}} -FLAGS!{enum SpeechEmulationCompareFlags { - SECFIgnoreCase = 0x1, - SECFIgnoreKanaType = 0x10000, - SECFIgnoreWidth = 0x20000, - SECFNoSpecialChars = 0x20000000, - SECFEmulateResult = 0x40000000, - SECFDefault = SECFIgnoreCase.0 | SECFIgnoreKanaType.0 | SECFIgnoreWidth.0, -}} -ENUM!{enum DISPID_SpeechRecognizerStatus { - DISPID_SRSAudioStatus = 1, - DISPID_SRSCurrentStreamPosition, - DISPID_SRSCurrentStreamNumber, - DISPID_SRSNumberOfActiveRules, - DISPID_SRSClsidEngine, - DISPID_SRSSupportedLanguages, -}} -ENUM!{enum DISPID_SpeechRecoContext { - DISPID_SRCRecognizer = 1, - DISPID_SRCAudioInInterferenceStatus, - DISPID_SRCRequestedUIType, - DISPID_SRCVoice, - DISPID_SRAllowVoiceFormatMatchingOnNextSet, - DISPID_SRCVoicePurgeEvent, - DISPID_SRCEventInterests, - DISPID_SRCCmdMaxAlternates, - DISPID_SRCState, - DISPID_SRCRetainedAudio, - DISPID_SRCRetainedAudioFormat, - DISPID_SRCPause, - DISPID_SRCResume, - DISPID_SRCCreateGrammar, - DISPID_SRCCreateResultFromMemory, - DISPID_SRCBookmark, - DISPID_SRCSetAdaptationData, -}} -ENUM!{enum SpeechRetainedAudioOptions { - SRAONone = SPAO_NONE.0, - SRAORetainAudio = SPAO_RETAIN_AUDIO.0, -}} -ENUM!{enum SpeechBookmarkOptions { - SBONone = SPBO_NONE.0, - SBOPause = SPBO_PAUSE.0, -}} -ENUM!{enum SpeechInterference { - SINone = SPINTERFERENCE_NONE.0, - SINoise = SPINTERFERENCE_NOISE.0, - SINoSignal = SPINTERFERENCE_NOSIGNAL.0, - SITooLoud = SPINTERFERENCE_TOOLOUD.0, - SITooQuiet = SPINTERFERENCE_TOOQUIET.0, - SITooFast = SPINTERFERENCE_TOOFAST.0, - SITooSlow = SPINTERFERENCE_TOOSLOW.0, -}} -FLAGS!{enum SpeechRecoEvents { - SREStreamEnd = 1 << 0, - SRESoundStart = 1 << 1, - SRESoundEnd = 1 << 2, - SREPhraseStart = 1 << 3, - SRERecognition = 1 << 4, - SREHypothesis = 1 << 5, - SREBookmark = 1 << 6, - SREPropertyNumChange = 1 << 7, - SREPropertyStringChange = 1 << 8, - SREFalseRecognition = 1 << 9, - SREInterference = 1 << 10, - SRERequestUI = 1 << 11, - SREStateChange = 1 << 12, - SREAdaptation = 1 << 13, - SREStreamStart = 1 << 14, - SRERecoOtherContext = 1 << 15, - SREAudioLevel = 1 << 16, - SREPrivate = 1 << 18, - SREAllEvents = 0x5ffff, -}} -ENUM!{enum SpeechRecoContextState { - SRCS_Disabled = SPCS_DISABLED.0, - SRCS_Enabled = SPCS_ENABLED.0, -}} -ENUM!{enum DISPIDSPRG { - DISPID_SRGId = 1, - DISPID_SRGRecoContext, - DISPID_SRGState, - DISPID_SRGRules, - DISPID_SRGReset, - DISPID_SRGCommit, - DISPID_SRGCmdLoadFromFile, - DISPID_SRGCmdLoadFromObject, - DISPID_SRGCmdLoadFromResource, - DISPID_SRGCmdLoadFromMemory, - DISPID_SRGCmdLoadFromProprietaryGrammar, - DISPID_SRGCmdSetRuleState, - DISPID_SRGCmdSetRuleIdState, - DISPID_SRGDictationLoad, - DISPID_SRGDictationUnload, - DISPID_SRGDictationSetState, - DISPID_SRGSetWordSequenceData, - DISPID_SRGSetTextSelection, - DISPID_SRGIsPronounceable, -}} -ENUM!{enum SpeechLoadOption { - SLOStatic = SPLO_STATIC.0, - SLODynamic = SPLO_DYNAMIC.0, -}} -ENUM!{enum SpeechWordPronounceable { - SWPUnknownWordUnpronounceable = SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE.0, - SWPUnknownWordPronounceable = SPWP_UNKNOWN_WORD_PRONOUNCEABLE.0, - SWPKnownWordPronounceable = SPWP_KNOWN_WORD_PRONOUNCEABLE.0, -}} -ENUM!{enum SpeechGrammarState { - SGSEnabled = SPGS_ENABLED.0, - SGSDisabled = SPGS_DISABLED.0, - SGSExclusive = SPGS_EXCLUSIVE.0, -}} -ENUM!{enum SpeechRuleState { - SGDSInactive = SPRS_INACTIVE.0, - SGDSActive = SPRS_ACTIVE.0, - SGDSActiveWithAutoPause = SPRS_ACTIVE_WITH_AUTO_PAUSE.0, - SGDSActiveUserDelimited = SPRS_ACTIVE_USER_DELIMITED.0, -}} -ENUM!{enum SpeechRuleAttributes { - SRATopLevel = SPRAF_TopLevel.0, - SRADefaultToActive = SPRAF_Active.0, - SRAExport = SPRAF_Export.0, - SRAImport = SPRAF_Import.0, - SRAInterpreter = SPRAF_Interpreter.0, - SRADynamic = SPRAF_Dynamic.0, - SRARoot = SPRAF_Root.0, -}} -ENUM!{enum SpeechGrammarWordType { - SGDisplay = SPWT_DISPLAY.0, - SGLexical = SPWT_LEXICAL.0, - SGPronounciation = SPWT_PRONUNCIATION.0, - SGLexicalNoSpecialChars = SPWT_LEXICAL_NO_SPECIAL_CHARS.0, -}} -ENUM!{enum DISPID_SpeechRecoContextEvents { - DISPID_SRCEStartStream = 1, - DISPID_SRCEEndStream, - DISPID_SRCEBookmark, - DISPID_SRCESoundStart, - DISPID_SRCESoundEnd, - DISPID_SRCEPhraseStart, - DISPID_SRCERecognition, - DISPID_SRCEHypothesis, - DISPID_SRCEPropertyNumberChange, - DISPID_SRCEPropertyStringChange, - DISPID_SRCEFalseRecognition, - DISPID_SRCEInterference, - DISPID_SRCERequestUI, - DISPID_SRCERecognizerStateChange, - DISPID_SRCEAdaptation, - DISPID_SRCERecognitionForOtherContext, - DISPID_SRCEAudioLevel, - DISPID_SRCEEnginePrivate, -}} -ENUM!{enum SpeechRecognitionType { - SRTStandard = 0, - SRTAutopause = SPREF_AutoPause.0, - SRTEmulated = SPREF_Emulated.0, - SRTSMLTimeout = SPREF_SMLTimeout.0, - SRTExtendableParse = SPREF_ExtendableParse.0, - SRTReSent = SPREF_ReSent.0, -}} -ENUM!{enum DISPID_SpeechGrammarRule { - DISPID_SGRAttributes = 1, - DISPID_SGRInitialState, - DISPID_SGRName, - DISPID_SGRId, - DISPID_SGRClear, - DISPID_SGRAddResource, - DISPID_SGRAddState, -}} -ENUM!{enum DISPID_SpeechGrammarRules { - DISPID_SGRsCount = 1, - DISPID_SGRsDynamic, - DISPID_SGRsAdd, - DISPID_SGRsCommit, - DISPID_SGRsCommitAndSave, - DISPID_SGRsFindRule, - DISPID_SGRsItem = ::DISPID_VALUE as u32, - DISPID_SGRs_NewEnum = ::DISPID_NEWENUM as u32, -}} -ENUM!{enum DISPID_SpeechGrammarRuleState { - DISPID_SGRSRule = 1, - DISPID_SGRSTransitions, - DISPID_SGRSAddWordTransition, - DISPID_SGRSAddRuleTransition, - DISPID_SGRSAddSpecialTransition, -}} -ENUM!{enum SpeechSpecialTransitionType { - SSTTWildcard = 1, - SSTTDictation, - SSTTTextBuffer, -}} -ENUM!{enum DISPID_SpeechGrammarRuleStateTransitions { - DISPID_SGRSTsCount = 1, - DISPID_SGRSTsItem = ::DISPID_VALUE as u32, - DISPID_SGRSTs_NewEnum = ::DISPID_NEWENUM as u32, -}} -ENUM!{enum DISPID_SpeechGrammarRuleStateTransition { - DISPID_SGRSTType = 1, - DISPID_SGRSTText, - DISPID_SGRSTRule, - DISPID_SGRSTWeight, - DISPID_SGRSTPropertyName, - DISPID_SGRSTPropertyId, - DISPID_SGRSTPropertyValue, - DISPID_SGRSTNextState, -}} -ENUM!{enum SpeechGrammarRuleStateTransitionType { - SGRSTTEpsilon = 0, - SGRSTTWord, - SGRSTTRule, - SGRSTTDictation, - SGRSTTWildcard, - SGRSTTTextBuffer, -}} -ENUM!{enum DISPIDSPTSI { - DISPIDSPTSI_ActiveOffset = 1, - DISPIDSPTSI_ActiveLength, - DISPIDSPTSI_SelectionOffset, - DISPIDSPTSI_SelectionLength, -}} -ENUM!{enum DISPID_SpeechRecoResult { - DISPID_SRRRecoContext = 1, - DISPID_SRRTimes, - DISPID_SRRAudioFormat, - DISPID_SRRPhraseInfo, - DISPID_SRRAlternates, - DISPID_SRRAudio, - DISPID_SRRSpeakAudio, - DISPID_SRRSaveToMemory, - DISPID_SRRDiscardResultInfo, -}} -ENUM!{enum SpeechDiscardType { - SDTProperty = SPDF_PROPERTY.0, - SDTReplacement = SPDF_REPLACEMENT.0, - SDTRule = SPDF_RULE.0, - SDTDisplayText = SPDF_DISPLAYTEXT.0, - SDTLexicalForm = SPDF_LEXICALFORM.0, - SDTPronunciation = SPDF_PRONUNCIATION.0, - SDTAudio = SPDF_AUDIO.0, - SDTAlternates = SPDF_ALTERNATES.0, - SDTAll = SPDF_ALL.0, -}} -ENUM!{enum DISPID_SpeechXMLRecoResult { - DISPID_SRRGetXMLResult, - DISPID_SRRGetXMLErrorInfo, -}} -ENUM!{enum DISPID_SpeechRecoResult2 { - DISPID_SRRSetTextFeedback, -}} -ENUM!{enum DISPID_SpeechPhraseBuilder { - DISPID_SPPBRestorePhraseFromMemory = 1, -}} -ENUM!{enum DISPID_SpeechRecoResultTimes { - DISPID_SRRTStreamTime = 1, - DISPID_SRRTLength, - DISPID_SRRTTickCount, - DISPID_SRRTOffsetFromStart, -}} -ENUM!{enum DISPID_SpeechPhraseAlternate { - DISPID_SPARecoResult = 1, - DISPID_SPAStartElementInResult, - DISPID_SPANumberOfElementsInResult, - DISPID_SPAPhraseInfo, - DISPID_SPACommit, -}} -ENUM!{enum DISPID_SpeechPhraseAlternates { - DISPID_SPAsCount = 1, - DISPID_SPAsItem = ::DISPID_VALUE as u32, - DISPID_SPAs_NewEnum = ::DISPID_NEWENUM as u32, -}} -ENUM!{enum DISPID_SpeechPhraseInfo { - DISPID_SPILanguageId = 1, - DISPID_SPIGrammarId, - DISPID_SPIStartTime, - DISPID_SPIAudioStreamPosition, - DISPID_SPIAudioSizeBytes, - DISPID_SPIRetainedSizeBytes, - DISPID_SPIAudioSizeTime, - DISPID_SPIRule, - DISPID_SPIProperties, - DISPID_SPIElements, - DISPID_SPIReplacements, - DISPID_SPIEngineId, - DISPID_SPIEnginePrivateData, - DISPID_SPISaveToMemory, - DISPID_SPIGetText, - DISPID_SPIGetDisplayAttributes, -}} -ENUM!{enum DISPID_SpeechPhraseElement { - DISPID_SPEAudioTimeOffset = 1, - DISPID_SPEAudioSizeTime, - DISPID_SPEAudioStreamOffset, - DISPID_SPEAudioSizeBytes, - DISPID_SPERetainedStreamOffset, - DISPID_SPERetainedSizeBytes, - DISPID_SPEDisplayText, - DISPID_SPELexicalForm, - DISPID_SPEPronunciation, - DISPID_SPEDisplayAttributes, - DISPID_SPERequiredConfidence, - DISPID_SPEActualConfidence, - DISPID_SPEEngineConfidence, -}} -ENUM!{enum SpeechEngineConfidence { - SECLowConfidence = -1i32 as u32, - SECNormalConfidence = 0, - SECHighConfidence = 1, -}} -ENUM!{enum DISPID_SpeechPhraseElements { - DISPID_SPEsCount = 1, - DISPID_SPEsItem = ::DISPID_VALUE as u32, - DISPID_SPEs_NewEnum = ::DISPID_NEWENUM as u32, -}} -ENUM!{enum DISPID_SpeechPhraseReplacement { - DISPID_SPRDisplayAttributes = 1, - DISPID_SPRText, - DISPID_SPRFirstElement, - DISPID_SPRNumberOfElements, -}} -ENUM!{enum DISPID_SpeechPhraseReplacements { - DISPID_SPRsCount = 1, - DISPID_SPRsItem = ::DISPID_VALUE as u32, - DISPID_SPRs_NewEnum = ::DISPID_NEWENUM as u32, -}} -ENUM!{enum DISPID_SpeechPhraseProperty { - DISPID_SPPName = 1, - DISPID_SPPId, - DISPID_SPPValue, - DISPID_SPPFirstElement, - DISPID_SPPNumberOfElements, - DISPID_SPPEngineConfidence, - DISPID_SPPConfidence, - DISPID_SPPParent, - DISPID_SPPChildren, -}} -ENUM!{enum DISPID_SpeechPhraseProperties { - DISPID_SPPsCount = 1, - DISPID_SPPsItem = ::DISPID_VALUE as u32, - DISPID_SPPs_NewEnum = ::DISPID_NEWENUM as u32, -}} -ENUM!{enum DISPID_SpeechPhraseRule { - DISPID_SPRuleName = 1, - DISPID_SPRuleId, - DISPID_SPRuleFirstElement, - DISPID_SPRuleNumberOfElements, - DISPID_SPRuleParent, - DISPID_SPRuleChildren, - DISPID_SPRuleConfidence, - DISPID_SPRuleEngineConfidence, -}} -ENUM!{enum DISPID_SpeechPhraseRules { - DISPID_SPRulesCount = 1, - DISPID_SPRulesItem = ::DISPID_VALUE as u32, - DISPID_SPRules_NewEnum = ::DISPID_NEWENUM as u32, -}} -ENUM!{enum DISPID_SpeechLexicon { - DISPID_SLGenerationId = 1, - DISPID_SLGetWords, - DISPID_SLAddPronunciation, - DISPID_SLAddPronunciationByPhoneIds, - DISPID_SLRemovePronunciation, - DISPID_SLRemovePronunciationByPhoneIds, - DISPID_SLGetPronunciations, - DISPID_SLGetGenerationChange, -}} -ENUM!{enum SpeechLexiconType { - SLTUser = eLEXTYPE_USER.0, - SLTApp = eLEXTYPE_APP.0, -}} -ENUM!{enum SpeechPartOfSpeech { - SPSNotOverriden = SPPS_NotOverriden.0, - SPSUnknown = SPPS_Unknown.0, - SPSNoun = SPPS_Noun.0, - SPSVerb = SPPS_Verb.0, - SPSModifier = SPPS_Modifier.0, - SPSFunction = SPPS_Function.0, - SPSInterjection = SPPS_Interjection.0, - SPSLMA = SPPS_LMA.0, - SPSSuppressWord = SPPS_SuppressWord.0, -}} -ENUM!{enum DISPID_SpeechLexiconWords { - DISPID_SLWsCount = 1, - DISPID_SLWsItem = ::DISPID_VALUE as u32, - DISPID_SLWs_NewEnum = ::DISPID_NEWENUM as u32, -}} -ENUM!{enum SpeechWordType { - SWTAdded = eWORDTYPE_ADDED.0, - SWTDeleted = eWORDTYPE_DELETED.0, -}} -ENUM!{enum DISPID_SpeechLexiconWord { - DISPID_SLWLangId = 1, - DISPID_SLWType, - DISPID_SLWWord, - DISPID_SLWPronunciations, -}} -ENUM!{enum DISPID_SpeechLexiconProns { - DISPID_SLPsCount = 1, - DISPID_SLPsItem = ::DISPID_VALUE as u32, - DISPID_SLPs_NewEnum = ::DISPID_NEWENUM as u32, -}} -ENUM!{enum DISPID_SpeechLexiconPronunciation { - DISPID_SLPType = 1, - DISPID_SLPLangId, - DISPID_SLPPartOfSpeech, - DISPID_SLPPhoneIds, - DISPID_SLPSymbolic, -}} -ENUM!{enum DISPID_SpeechPhoneConverter { - DISPID_SPCLangId = 1, - DISPID_SPCPhoneToId, - DISPID_SPCIdToPhone, -}} -RIDL!( -interface ISpeechDataKey(ISpeechDataKeyVtbl): IDispatch(IDispatchVtbl) { - fn SetBinaryValue(&mut self, ValueName: ::BSTR, Value: ::VARIANT) -> ::HRESULT, - fn GetBinaryValue(&mut self, ValueName: ::BSTR, Value: *mut ::VARIANT) -> ::HRESULT, - fn SetStringValue(&mut self, ValueName: ::BSTR, Value: ::BSTR) -> ::HRESULT, - fn GetStringValue(&mut self, ValueName: ::BSTR, Value: *mut ::BSTR) -> ::HRESULT, - fn SetLongValue(&mut self, ValueName: ::BSTR, Value: ::c_long) -> ::HRESULT, - fn GetLongValue(&mut self, ValueName: ::BSTR, Value: *mut ::c_long) -> ::HRESULT, - fn OpenKey(&mut self, SubKeyName: ::BSTR, SubKey: *mut *mut ISpeechDataKey) -> ::HRESULT, - fn CreateKey(&mut self, SubKeyName: ::BSTR, SubKey: *mut *mut ISpeechDataKey) -> ::HRESULT, - fn DeleteKey(&mut self, SubKeyName: ::BSTR) -> ::HRESULT, - fn DeleteValue(&mut self, ValueName: ::BSTR) -> ::HRESULT, - fn EnumKeys(&mut self, Index: ::c_long, SubKeyName: *mut ::BSTR) -> ::HRESULT, - fn EnumValues(&mut self, Index: ::c_long, ValueName: *mut ::BSTR) -> ::HRESULT -} -); -RIDL!( -interface ISpeechObjectToken(ISpeechObjectTokenVtbl): IDispatch(IDispatchVtbl) { - fn get_Id(&mut self, ObjectId: *mut ::BSTR) -> ::HRESULT, - fn get_DataKey(&mut self, DataKey: *mut *mut ISpeechDataKey) -> ::HRESULT, - fn get_Category(&mut self, Category: *mut *mut ISpeechObjectTokenCategory) -> ::HRESULT, - fn GetDescription(&mut self, Locale: ::c_long, Description: *mut ::BSTR) -> ::HRESULT, - fn SetId( - &mut self, Id: ::BSTR, CategoryId: ::BSTR, CreateIfNotExist: ::VARIANT_BOOL - ) -> ::HRESULT, - fn GetAttribute(&mut self, AttributeName: ::BSTR, AttributeValue: *mut ::BSTR) -> ::HRESULT, - fn CreateInstance( - &mut self, pUnkOuter: *mut ::IUnknown, ClsContext: SpeechTokenContext, - Object: *mut *mut ::IUnknown - ) -> ::HRESULT, - fn Remove(&mut self, ObjectStorageCLSID: ::BSTR) -> ::HRESULT, - fn GetStorageFileName( - &mut self, ObjectStorageCLSID: ::BSTR, KeyName: ::BSTR, FileName: ::BSTR, Folder: ::BSTR, - FilePath: *mut ::BSTR - ) -> ::HRESULT, - fn RemoveStorageFileName( - &mut self, ObjectStorageCLSID: ::BSTR, KeyName: ::BSTR, DeleteFile: ::VARIANT_BOOL - ) -> ::HRESULT, - fn IsUISupported( - &mut self, TypeOfUI: ::BSTR, ExtraData: *const ::VARIANT, Object: *mut ::IUnknown, - Supported: *mut ::VARIANT_BOOL - ) -> ::HRESULT, - fn DisplayUI( - &mut self, hWnd: ::c_long, Title: ::BSTR, TypeOfUI: ::BSTR, ExtraData: *const ::VARIANT, - Object: *mut ::IUnknown - ) -> ::HRESULT, - fn MatchesAttributes(&mut self, Attributes: ::BSTR, Matches: *mut ::VARIANT_BOOL) -> ::HRESULT -} -); -RIDL!( -interface ISpeechObjectTokens(ISpeechObjectTokensVtbl): IDispatch(IDispatchVtbl) { - fn get_Count(&mut self, Count: *mut ::c_long) -> ::HRESULT, - fn Item(&mut self, Index: ::c_long, Token: *mut *mut ISpeechObjectToken) -> ::HRESULT, - fn get__NewEnum(&mut self, ppEnumVARIANT: *mut *mut ::IUnknown) -> ::HRESULT -} -); -RIDL!( -interface ISpeechObjectTokenCategory(ISpeechObjectTokenCategoryVtbl): IDispatch(IDispatchVtbl) { - fn get_Id(&mut self, Id: *mut ::BSTR) -> ::HRESULT, - fn put_Default(&mut self, TokenId: ::BSTR) -> ::HRESULT, - fn get_Default(&mut self, TokenId: *mut ::BSTR) -> ::HRESULT, - fn SetId(&mut self, Id: ::BSTR, CreateIfNotExist: ::VARIANT_BOOL) -> ::HRESULT, - fn GetDataKey( - &mut self, Location: SpeechDataKeyLocation, DataKey: *mut *mut ISpeechDataKey - ) -> ::HRESULT, - fn EnumerateTokens( - &mut self, RequiredAttributes: ::BSTR, OptionalAttributes: ::BSTR, - Tokens: *mut *mut ISpeechObjectTokens - ) -> ::HRESULT -} -); -RIDL!( -interface ISpeechAudioBufferInfo(ISpeechAudioBufferInfoVtbl): IDispatch(IDispatchVtbl) { - fn get_MinNotification(&mut self, MinNotification: *mut ::c_long) -> ::HRESULT, - fn put_MinNotification(&mut self, MinNotification: ::c_long) -> ::HRESULT, - fn get_BufferSize(&mut self, BufferSize: *mut ::c_long) -> ::HRESULT, - fn put_BufferSize(&mut self, BufferSize: ::c_long) -> ::HRESULT, - fn get_EventBias(&mut self, EventBias: *mut ::c_long) -> ::HRESULT, - fn put_EventBias(&mut self, EventBias: ::c_long) -> ::HRESULT -} -); -RIDL!( -interface ISpeechAudioStatus(ISpeechAudioStatusVtbl): IDispatch(IDispatchVtbl) { - fn get_FreeBufferSpace(&mut self, FreeBufferSpace: *mut ::c_long) -> ::HRESULT, - fn get_NonBlockingIO(&mut self, NonBlockingIO: *mut ::c_long) -> ::HRESULT, - fn get_State(&mut self, State: *mut SpeechAudioState) -> ::HRESULT, - fn get_CurrentSeekPosition(&mut self, CurrentSeekPosition: *mut ::VARIANT) -> ::HRESULT, - fn get_CurrentDevicePosition(&mut self, CurrentDevicePosition: *mut ::VARIANT) -> ::HRESULT -} -); -RIDL!( -interface ISpeechAudioFormat(ISpeechAudioFormatVtbl): IDispatch(IDispatchVtbl) { - fn get_Type(&mut self, AudioFormat: *mut SpeechAudioFormatType) -> ::HRESULT, - fn put_Type(&mut self, AudioFormat: SpeechAudioFormatType) -> ::HRESULT, - fn get_Guid(&mut self, Guid: *mut ::BSTR) -> ::HRESULT, - fn put_Guid(&mut self, Guid: ::BSTR) -> ::HRESULT, - fn GetWaveFormatEx(&mut self, SpeechWaveFormatEx: *mut *mut ISpeechWaveFormatEx) -> ::HRESULT, - fn SetWaveFormatEx(&mut self, SpeechWaveFormatEx: *mut ISpeechWaveFormatEx) -> ::HRESULT -} -); -RIDL!( -interface ISpeechWaveFormatEx(ISpeechWaveFormatExVtbl): IDispatch(IDispatchVtbl) { - fn get_FormatTag(&mut self, FormatTag: *mut ::c_short) -> ::HRESULT, - fn put_FormatTag(&mut self, FormatTag: ::c_short) -> ::HRESULT, - fn get_Channels(&mut self, Channels: *mut ::c_short) -> ::HRESULT, - fn put_Channels(&mut self, Channels: ::c_short) -> ::HRESULT, - fn get_SamplesPerSec(&mut self, SamplesPerSec: *mut ::c_long) -> ::HRESULT, - fn put_SamplesPerSec(&mut self, SamplesPerSec: ::c_long) -> ::HRESULT, - fn get_AvgBytesPerSec(&mut self, AvgBytesPerSec: *mut ::c_long) -> ::HRESULT, - fn put_AvgBytesPerSec(&mut self, AvgBytesPerSec: ::c_long) -> ::HRESULT, - fn get_BlockAlign(&mut self, BlockAlign: *mut ::c_short) -> ::HRESULT, - fn put_BlockAlign(&mut self, BlockAlign: ::c_short) -> ::HRESULT, - fn get_BitsPerSample(&mut self, BitsPerSample: *mut ::c_short) -> ::HRESULT, - fn put_BitsPerSample(&mut self, BitsPerSample: ::c_short) -> ::HRESULT, - fn get_ExtraData(&mut self, ExtraData: *mut ::VARIANT) -> ::HRESULT, - fn put_ExtraData(&mut self, ExtraData: ::VARIANT) -> ::HRESULT -} -); diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/schannel.rs cargo-0.37.0/vendor/winapi-0.2.8/src/schannel.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/schannel.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/schannel.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,333 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Public Definitions for SCHANNEL Security Provider -pub const UNISP_NAME: &'static str = "Microsoft Unified Security Protocol Provider"; -pub const SSL2SP_NAME: &'static str = "Microsoft SSL 2.0"; -pub const SSL3SP_NAME: &'static str = "Microsoft SSL 3.0"; -pub const TLS1SP_NAME: &'static str = "Microsoft TLS 1.0"; -pub const PCT1SP_NAME: &'static str = "Microsoft PCT 1.0"; -pub const SCHANNEL_NAME: &'static str = "Schannel"; -ENUM!{enum eTlsSignatureAlgorithm { - TlsSignatureAlgorithm_Anonymous = 0, - TlsSignatureAlgorithm_Rsa = 1, - TlsSignatureAlgorithm_Dsa = 2, - TlsSignatureAlgorithm_Ecdsa = 3, -}} -ENUM!{enum eTlsHashAlgorithm { - TlsHashAlgorithm_None = 0, - TlsHashAlgorithm_Md5 = 1, - TlsHashAlgorithm_Sha1 = 2, - TlsHashAlgorithm_Sha224 = 3, - TlsHashAlgorithm_Sha256 = 4, - TlsHashAlgorithm_Sha384 = 5, - TlsHashAlgorithm_Sha512 = 6, -}} -pub const UNISP_RPC_ID: ::DWORD = 14; -STRUCT!{struct SecPkgContext_RemoteCredentialInfo { - cbCertificateChain: ::DWORD, - pbCertificateChain: ::PBYTE, - cCertificates: ::DWORD, - fFlags: ::DWORD, - dwBits: ::DWORD, -}} -pub type PSecPkgContext_RemoteCredentialInfo = *mut SecPkgContext_RemoteCredentialInfo; -pub type SecPkgContext_RemoteCredenitalInfo = SecPkgContext_RemoteCredentialInfo; -pub type PSecPkgContext_RemoteCredenitalInfo = *mut SecPkgContext_RemoteCredentialInfo; -pub const RCRED_STATUS_NOCRED: ::DWORD = 0x00000000; -pub const RCRED_CRED_EXISTS: ::DWORD = 0x00000001; -pub const RCRED_STATUS_UNKNOWN_ISSUER: ::DWORD = 0x00000002; -STRUCT!{struct SecPkgContext_LocalCredentialInfo { - cbCertificateChain: ::DWORD, - pbCertificateChain: ::PBYTE, - cCertificates: ::DWORD, - fFlags: ::DWORD, - dwBits: ::DWORD, -}} -pub type PSecPkgContext_LocalCredentialInfo = *mut SecPkgContext_LocalCredentialInfo; -pub type SecPkgContext_LocalCredenitalInfo = SecPkgContext_LocalCredentialInfo; -pub type PSecPkgContext_LocalCredenitalInfo = *mut SecPkgContext_LocalCredentialInfo; -pub const LCRED_STATUS_NOCRED: ::DWORD = 0x00000000; -pub const LCRED_CRED_EXISTS: ::DWORD = 0x00000001; -pub const LCRED_STATUS_UNKNOWN_ISSUER: ::DWORD = 0x00000002; -STRUCT!{struct SecPkgContext_ClientCertPolicyResult { - dwPolicyResult: ::HRESULT, - guidPolicyId: ::GUID, -}} -pub type PSecPkgContext_ClientCertPolicyResult = *mut SecPkgContext_ClientCertPolicyResult; -STRUCT!{struct SecPkgContext_IssuerListInfoEx { - aIssuers: ::PCERT_NAME_BLOB, - cIssuers: ::DWORD, -}} -pub type PSecPkgContext_IssuerListInfoEx = *mut SecPkgContext_IssuerListInfoEx; -STRUCT!{struct SecPkgContext_ConnectionInfo { - dwProtocol: ::DWORD, - aiCipher: ::ALG_ID, - dwCipherStrength: ::DWORD, - aiHash: ::ALG_ID, - dwHashStrength: ::DWORD, - aiExch: ::ALG_ID, - dwExchStrength: ::DWORD, -}} -pub type PSecPkgContext_ConnectionInfo = *mut SecPkgContext_ConnectionInfo; -pub const SZ_ALG_MAX_SIZE: usize = 64; -pub const SECPKGCONTEXT_CIPHERINFO_V1: ::DWORD = 1; -STRUCT!{nodebug struct SecPkgContext_CipherInfo { - dwVersion: ::DWORD, - dwProtocol: ::DWORD, - dwCipherSuite: ::DWORD, - dwBaseCipherSuite: ::DWORD, - szCipherSuite: [::WCHAR; SZ_ALG_MAX_SIZE], - szCipher: [::WCHAR; SZ_ALG_MAX_SIZE], - dwCipherLen: ::DWORD, - dwCipherBlockLen: ::DWORD, - szHash: [::WCHAR; SZ_ALG_MAX_SIZE], - dwHashLen: ::DWORD, - szExchange: [::WCHAR; SZ_ALG_MAX_SIZE], - dwMinExchangeLen: ::DWORD, - dwMaxExchangeLen: ::DWORD, - szCertificate: [::WCHAR; SZ_ALG_MAX_SIZE], - dwKeyType: ::DWORD, -}} -pub type PSecPkgContext_CipherInfo = *mut SecPkgContext_CipherInfo; -STRUCT!{nodebug struct SecPkgContext_EapKeyBlock { - rgbKeys: [::BYTE; 128], - rgbIVs: [::BYTE; 64], -}} -pub type PSecPkgContext_EapKeyBlock = *mut SecPkgContext_EapKeyBlock; -STRUCT!{struct SecPkgContext_MappedCredAttr { - dwAttribute: ::DWORD, - pvBuffer: ::PVOID, -}} -pub type PSecPkgContext_MappedCredAttr = *mut SecPkgContext_MappedCredAttr; -pub const SSL_SESSION_RECONNECT: ::DWORD = 1; -STRUCT!{struct SecPkgContext_SessionInfo { - dwFlags: ::DWORD, - cbSessionId: ::DWORD, - rgbSessionId: [::BYTE; 32], -}} -pub type PSecPkgContext_SessionInfo = *mut SecPkgContext_SessionInfo; -STRUCT!{struct SecPkgContext_SessionAppData { - dwFlags: ::DWORD, - cbAppData: ::DWORD, - pbAppData: ::PBYTE, -}} -pub type PSecPkgContext_SessionAppData = *mut SecPkgContext_SessionAppData; -STRUCT!{struct SecPkgContext_EapPrfInfo { - dwVersion: ::DWORD, - cbPrfData: ::DWORD, - pbPrfData: ::PBYTE, -}} -pub type PSecPkgContext_EapPrfInfo = *mut SecPkgContext_EapPrfInfo; -STRUCT!{struct SecPkgContext_SupportedSignatures { - cSignatureAndHashAlgorithms: ::WORD, - pSignatureAndHashAlgorithms: *mut ::WORD, -}} -pub type PSecPkgContext_SupportedSignatures = *mut SecPkgContext_SupportedSignatures; -STRUCT!{struct SecPkgContext_Certificates { - cCertificates: ::DWORD, - cbCertificateChain: ::DWORD, - pbCertificateChain: ::PBYTE, -}} -pub type PSecPkgContext_Certificates = *mut SecPkgContext_Certificates; -STRUCT!{struct SecPkgContext_CertInfo { - dwVersion: ::DWORD, - cbSubjectName: ::DWORD, - pwszSubjectName: ::LPWSTR, - cbIssuerName: ::DWORD, - pwszIssuerName: ::LPWSTR, - dwKeySize: ::DWORD, -}} -pub type PSecPkgContext_CertInfo = *mut SecPkgContext_CertInfo; -pub const KERN_CONTEXT_CERT_INFO_V1: ::DWORD = 0x00000000; -STRUCT!{struct SecPkgContext_UiInfo { - hParentWindow: ::HWND, -}} -pub type PSecPkgContext_UiInfo = *mut SecPkgContext_UiInfo; -STRUCT!{struct SecPkgContext_EarlyStart { - dwEarlyStartFlags: ::DWORD, -}} -pub type PSecPkgContext_EarlyStart = *mut SecPkgContext_EarlyStart; -pub const ENABLE_TLS_CLIENT_EARLY_START: ::DWORD = 0x00000001; -pub const SCH_CRED_V1: ::DWORD = 0x00000001; -pub const SCH_CRED_V2: ::DWORD = 0x00000002; -pub const SCH_CRED_VERSION: ::DWORD = 0x00000002; -pub const SCH_CRED_V3: ::DWORD = 0x00000003; -pub const SCHANNEL_CRED_VERSION: ::DWORD = 0x00000004; -pub enum _HMAPPER {} -STRUCT!{struct SCHANNEL_CRED { - dwVersion: ::DWORD, - cCreds: ::DWORD, - paCred: *mut ::PCCERT_CONTEXT, - hRootStore: ::HCERTSTORE, - cMappers: ::DWORD, - aphMappers: *mut *mut _HMAPPER, - cSupportedAlgs: ::DWORD, - palgSupportedAlgs: *mut ::ALG_ID, - grbitEnabledProtocols: ::DWORD, - dwMinimumCipherStrength: ::DWORD, - dwMaximumCipherStrength: ::DWORD, - dwSessionLifespan: ::DWORD, - dwFlags: ::DWORD, - dwCredFormat: ::DWORD, -}} -pub type PSCHANNEL_CRED = *mut SCHANNEL_CRED; -pub const SCH_CRED_FORMAT_CERT_CONTEXT: ::DWORD = 0x00000000; -pub const SCH_CRED_FORMAT_CERT_HASH: ::DWORD = 0x00000001; -pub const SCH_CRED_FORMAT_CERT_HASH_STORE: ::DWORD = 0x00000002; -pub const SCH_CRED_MAX_STORE_NAME_SIZE: usize = 128; -pub const SCH_CRED_MAX_SUPPORTED_ALGS: ::DWORD = 256; -pub const SCH_CRED_MAX_SUPPORTED_CERTS: ::DWORD = 100; -STRUCT!{struct SCHANNEL_CERT_HASH { - dwLength: ::DWORD, - dwFlags: ::DWORD, - hProv: ::HCRYPTPROV, - ShaHash: [::BYTE; 20], -}} -pub type PSCHANNEL_CERT_HASH = *mut SCHANNEL_CERT_HASH; -STRUCT!{nodebug struct SCHANNEL_CERT_HASH_STORE { - dwLength: ::DWORD, - dwFlags: ::DWORD, - hProv: ::HCRYPTPROV, - ShaHash: [::BYTE; 20], - pwszStoreName: [::WCHAR; SCH_CRED_MAX_STORE_NAME_SIZE], -}} -pub type PSCHANNEL_CERT_HASH_STORE = *mut SCHANNEL_CERT_HASH_STORE; -pub const SCH_MACHINE_CERT_HASH: ::DWORD = 0x00000001; -pub const SCH_CRED_NO_SYSTEM_MAPPER: ::DWORD = 0x00000002; -pub const SCH_CRED_NO_SERVERNAME_CHECK: ::DWORD = 0x00000004; -pub const SCH_CRED_MANUAL_CRED_VALIDATION: ::DWORD = 0x00000008; -pub const SCH_CRED_NO_DEFAULT_CREDS: ::DWORD = 0x00000010; -pub const SCH_CRED_AUTO_CRED_VALIDATION: ::DWORD = 0x00000020; -pub const SCH_CRED_USE_DEFAULT_CREDS: ::DWORD = 0x00000040; -pub const SCH_CRED_DISABLE_RECONNECTS: ::DWORD = 0x00000080; -pub const SCH_CRED_REVOCATION_CHECK_END_CERT: ::DWORD = 0x00000100; -pub const SCH_CRED_REVOCATION_CHECK_CHAIN: ::DWORD = 0x00000200; -pub const SCH_CRED_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT: ::DWORD = 0x00000400; -pub const SCH_CRED_IGNORE_NO_REVOCATION_CHECK: ::DWORD = 0x00000800; -pub const SCH_CRED_IGNORE_REVOCATION_OFFLINE: ::DWORD = 0x00001000; -pub const SCH_CRED_RESTRICTED_ROOTS: ::DWORD = 0x00002000; -pub const SCH_CRED_REVOCATION_CHECK_CACHE_ONLY: ::DWORD = 0x00004000; -pub const SCH_CRED_CACHE_ONLY_URL_RETRIEVAL: ::DWORD = 0x00008000; -pub const SCH_CRED_MEMORY_STORE_CERT: ::DWORD = 0x00010000; -pub const SCH_CRED_CACHE_ONLY_URL_RETRIEVAL_ON_CREATE: ::DWORD = 0x00020000; -pub const SCH_SEND_ROOT_CERT: ::DWORD = 0x00040000; -pub const SCH_CRED_SNI_CREDENTIAL: ::DWORD = 0x00080000; -pub const SCH_CRED_SNI_ENABLE_OCSP: ::DWORD = 0x00100000; -pub const SCH_SEND_AUX_RECORD: ::DWORD = 0x00200000; -pub const SCH_USE_STRONG_CRYPTO: ::DWORD = 0x00400000; -pub const SCHANNEL_RENEGOTIATE: ::DWORD = 0; -pub const SCHANNEL_SHUTDOWN: ::DWORD = 1; -pub const SCHANNEL_ALERT: ::DWORD = 2; -pub const SCHANNEL_SESSION: ::DWORD = 3; -STRUCT!{struct SCHANNEL_ALERT_TOKEN { - dwTokenType: ::DWORD, - dwAlertType: ::DWORD, - dwAlertNumber: ::DWORD, -}} -pub const TLS1_ALERT_WARNING: ::DWORD = 1; -pub const TLS1_ALERT_FATAL: ::DWORD = 2; -pub const TLS1_ALERT_CLOSE_NOTIFY: ::DWORD = 0; -pub const TLS1_ALERT_UNEXPECTED_MESSAGE: ::DWORD = 10; -pub const TLS1_ALERT_BAD_RECORD_MAC: ::DWORD = 20; -pub const TLS1_ALERT_DECRYPTION_FAILED: ::DWORD = 21; -pub const TLS1_ALERT_RECORD_OVERFLOW: ::DWORD = 22; -pub const TLS1_ALERT_DECOMPRESSION_FAIL: ::DWORD = 30; -pub const TLS1_ALERT_HANDSHAKE_FAILURE: ::DWORD = 40; -pub const TLS1_ALERT_BAD_CERTIFICATE: ::DWORD = 42; -pub const TLS1_ALERT_UNSUPPORTED_CERT: ::DWORD = 43; -pub const TLS1_ALERT_CERTIFICATE_REVOKED: ::DWORD = 44; -pub const TLS1_ALERT_CERTIFICATE_EXPIRED: ::DWORD = 45; -pub const TLS1_ALERT_CERTIFICATE_UNKNOWN: ::DWORD = 46; -pub const TLS1_ALERT_ILLEGAL_PARAMETER: ::DWORD = 47; -pub const TLS1_ALERT_UNKNOWN_CA: ::DWORD = 48; -pub const TLS1_ALERT_ACCESS_DENIED: ::DWORD = 49; -pub const TLS1_ALERT_DECODE_ERROR: ::DWORD = 50; -pub const TLS1_ALERT_DECRYPT_ERROR: ::DWORD = 51; -pub const TLS1_ALERT_EXPORT_RESTRICTION: ::DWORD = 60; -pub const TLS1_ALERT_PROTOCOL_VERSION: ::DWORD = 70; -pub const TLS1_ALERT_INSUFFIENT_SECURITY: ::DWORD = 71; -pub const TLS1_ALERT_INTERNAL_ERROR: ::DWORD = 80; -pub const TLS1_ALERT_USER_CANCELED: ::DWORD = 90; -pub const TLS1_ALERT_NO_RENEGOTIATION: ::DWORD = 100; -pub const TLS1_ALERT_UNSUPPORTED_EXT: ::DWORD = 110; -pub const TLS1_ALERT_NO_APP_PROTOCOL: ::DWORD = 120; -pub const SSL_SESSION_ENABLE_RECONNECTS: ::DWORD = 1; -pub const SSL_SESSION_DISABLE_RECONNECTS: ::DWORD = 2; -STRUCT!{struct SCHANNEL_SESSION_TOKEN { - dwTokenType: ::DWORD, - dwFlags: ::DWORD, -}} -STRUCT!{nodebug struct SCHANNEL_CLIENT_SIGNATURE { - cbLength: ::DWORD, - aiHash: ::ALG_ID, - cbHash: ::DWORD, - HashValue: [::BYTE; 36], - CertThumbprint: [::BYTE; 20], -}} -pub type PSCHANNEL_CLIENT_SIGNATURE = *mut SCHANNEL_CLIENT_SIGNATURE; -pub const SP_PROT_PCT1_SERVER: ::DWORD = 0x00000001; -pub const SP_PROT_PCT1_CLIENT: ::DWORD = 0x00000002; -pub const SP_PROT_PCT1: ::DWORD = SP_PROT_PCT1_SERVER | SP_PROT_PCT1_CLIENT; -pub const SP_PROT_SSL2_SERVER: ::DWORD = 0x00000004; -pub const SP_PROT_SSL2_CLIENT: ::DWORD = 0x00000008; -pub const SP_PROT_SSL2: ::DWORD = SP_PROT_SSL2_SERVER | SP_PROT_SSL2_CLIENT; -pub const SP_PROT_SSL3_SERVER: ::DWORD = 0x00000010; -pub const SP_PROT_SSL3_CLIENT: ::DWORD = 0x00000020; -pub const SP_PROT_SSL3: ::DWORD = SP_PROT_SSL3_SERVER | SP_PROT_SSL3_CLIENT; -pub const SP_PROT_TLS1_SERVER: ::DWORD = 0x00000040; -pub const SP_PROT_TLS1_CLIENT: ::DWORD = 0x00000080; -pub const SP_PROT_TLS1: ::DWORD = SP_PROT_TLS1_SERVER | SP_PROT_TLS1_CLIENT; -pub const SP_PROT_SSL3TLS1_CLIENTS: ::DWORD = SP_PROT_TLS1_CLIENT | SP_PROT_SSL3_CLIENT; -pub const SP_PROT_SSL3TLS1_SERVERS: ::DWORD = SP_PROT_TLS1_SERVER | SP_PROT_SSL3_SERVER; -pub const SP_PROT_SSL3TLS1: ::DWORD = SP_PROT_SSL3 | SP_PROT_TLS1; -pub const SP_PROT_UNI_SERVER: ::DWORD = 0x40000000; -pub const SP_PROT_UNI_CLIENT: ::DWORD = 0x80000000; -pub const SP_PROT_UNI: ::DWORD = SP_PROT_UNI_SERVER | SP_PROT_UNI_CLIENT; -pub const SP_PROT_ALL: ::DWORD = 0xffffffff; -pub const SP_PROT_NONE: ::DWORD = 0; -pub const SP_PROT_CLIENTS: ::DWORD = SP_PROT_PCT1_CLIENT | SP_PROT_SSL2_CLIENT - | SP_PROT_SSL3_CLIENT | SP_PROT_UNI_CLIENT | SP_PROT_TLS1_CLIENT; -pub const SP_PROT_SERVERS: ::DWORD = SP_PROT_PCT1_SERVER | SP_PROT_SSL2_SERVER - | SP_PROT_SSL3_SERVER | SP_PROT_UNI_SERVER | SP_PROT_TLS1_SERVER; -pub const SP_PROT_TLS1_0_SERVER: ::DWORD = SP_PROT_TLS1_SERVER; -pub const SP_PROT_TLS1_0_CLIENT: ::DWORD = SP_PROT_TLS1_CLIENT; -pub const SP_PROT_TLS1_0: ::DWORD = SP_PROT_TLS1_0_SERVER | SP_PROT_TLS1_0_CLIENT; -pub const SP_PROT_TLS1_1_SERVER: ::DWORD = 0x00000100; -pub const SP_PROT_TLS1_1_CLIENT: ::DWORD = 0x00000200; -pub const SP_PROT_TLS1_1: ::DWORD = SP_PROT_TLS1_1_SERVER | SP_PROT_TLS1_1_CLIENT; -pub const SP_PROT_TLS1_2_SERVER: ::DWORD = 0x00000400; -pub const SP_PROT_TLS1_2_CLIENT: ::DWORD = 0x00000800; -pub const SP_PROT_TLS1_2: ::DWORD = SP_PROT_TLS1_2_SERVER | SP_PROT_TLS1_2_CLIENT; -pub const SP_PROT_DTLS_SERVER: ::DWORD = 0x00010000; -pub const SP_PROT_DTLS_CLIENT: ::DWORD = 0x00020000; -pub const SP_PROT_DTLS: ::DWORD = SP_PROT_DTLS_SERVER | SP_PROT_DTLS_CLIENT; -pub const SP_PROT_DTLS1_0_SERVER: ::DWORD = SP_PROT_DTLS_SERVER; -pub const SP_PROT_DTLS1_0_CLIENT: ::DWORD = SP_PROT_DTLS_CLIENT; -pub const SP_PROT_DTLS1_0: ::DWORD = SP_PROT_DTLS1_0_SERVER | SP_PROT_DTLS1_0_CLIENT; -pub const SP_PROT_DTLS1_X_SERVER: ::DWORD = SP_PROT_DTLS1_0_SERVER; -pub const SP_PROT_DTLS1_X_CLIENT: ::DWORD = SP_PROT_DTLS1_0_CLIENT; -pub const SP_PROT_DTLS1_X: ::DWORD = SP_PROT_DTLS1_X_SERVER | SP_PROT_DTLS1_X_CLIENT; -pub const SP_PROT_TLS1_1PLUS_SERVER: ::DWORD = SP_PROT_TLS1_1_SERVER | SP_PROT_TLS1_2_SERVER; -pub const SP_PROT_TLS1_1PLUS_CLIENT: ::DWORD = SP_PROT_TLS1_1_CLIENT | SP_PROT_TLS1_2_CLIENT; -pub const SP_PROT_TLS1_1PLUS: ::DWORD = SP_PROT_TLS1_1PLUS_SERVER | SP_PROT_TLS1_1PLUS_CLIENT; -pub const SP_PROT_TLS1_X_SERVER: ::DWORD = SP_PROT_TLS1_0_SERVER | SP_PROT_TLS1_1_SERVER - | SP_PROT_TLS1_2_SERVER; -pub const SP_PROT_TLS1_X_CLIENT: ::DWORD = SP_PROT_TLS1_0_CLIENT | SP_PROT_TLS1_1_CLIENT - | SP_PROT_TLS1_2_CLIENT; -pub const SP_PROT_TLS1_X: ::DWORD = SP_PROT_TLS1_X_SERVER | SP_PROT_TLS1_X_CLIENT; -pub const SP_PROT_SSL3TLS1_X_CLIENTS: ::DWORD = SP_PROT_TLS1_X_CLIENT | SP_PROT_SSL3_CLIENT; -pub const SP_PROT_SSL3TLS1_X_SERVERS: ::DWORD = SP_PROT_TLS1_X_SERVER | SP_PROT_SSL3_SERVER; -pub const SP_PROT_SSL3TLS1_X: ::DWORD = SP_PROT_SSL3 | SP_PROT_TLS1_X; -pub const SP_PROT_X_CLIENTS: ::DWORD = SP_PROT_CLIENTS | SP_PROT_TLS1_X_CLIENT - | SP_PROT_DTLS1_X_CLIENT; -pub const SP_PROT_X_SERVERS: ::DWORD = SP_PROT_SERVERS | SP_PROT_TLS1_X_SERVER - | SP_PROT_DTLS1_X_SERVER; -//716 -pub const SCHANNEL_SECRET_TYPE_CAPI: ::DWORD = 0x00000001; -pub const SCHANNEL_SECRET_PRIVKEY: ::DWORD = 0x00000002; -pub const SCH_CRED_X509_CERTCHAIN: ::DWORD = 0x00000001; -pub const SCH_CRED_X509_CAPI: ::DWORD = 0x00000002; -pub const SCH_CRED_CERT_CONTEXT: ::DWORD = 0x00000003; -//838 -pub const SSL_CRACK_CERTIFICATE_NAME: &'static str = "SslCrackCertificate"; -pub const SSL_FREE_CERTIFICATE_NAME: &'static str = "SslFreeCertificate"; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/servprov.rs cargo-0.37.0/vendor/winapi-0.2.8/src/servprov.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/servprov.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/servprov.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -// Copyright © 2015, Connor Hilarides -// Licensed under the MIT License -//! Mappings for the contents of servprov.h -pub type LPSERVICEPROVIDER = *mut IServiceProvider; -RIDL!( -interface IServiceProvider(IServiceProviderVtbl): IUnknown(IUnknownVtbl) { - fn QueryService( - &mut self, guidService: ::REFGUID, riid: ::REFIID, ppvObject: *mut *mut ::c_void - ) -> ::HRESULT -} -); diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/setupapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/setupapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/setupapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/setupapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,1301 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! Windows NT Setup and Device Installer services -pub const LINE_LEN: usize = 256; -pub const MAX_INF_STRING_LENGTH: usize = 4096; -pub const MAX_INF_SECTION_NAME_LENGTH: usize = 255; -pub const MAX_TITLE_LEN: usize = 60; -pub const MAX_INSTRUCTION_LEN: usize = 256; -pub const MAX_LABEL_LEN: usize = 30; -pub const MAX_SERVICE_NAME_LEN: usize = 256; -pub const MAX_SUBTITLE_LEN: usize = 256; -pub const SP_MAX_MACHINENAME_LENGTH: usize = ::MAX_PATH + 3; -pub type HINF = ::PVOID; -STRUCT!{struct INFCONTEXT { - Inf: ::PVOID, - CurrentInf: ::PVOID, - Section: ::UINT, - Line: ::UINT, -}} -pub type PINFCONTEXT = *mut INFCONTEXT; -STRUCT!{struct SP_INF_INFORMATION { - InfStyle: ::DWORD, - InfCount: ::DWORD, - VersionData: [::BYTE; ::ANYSIZE_ARRAY], -}} -pub type PSP_INF_INFORMATION = *mut SP_INF_INFORMATION; -STRUCT!{struct SP_ALTPLATFORM_INFO_V2 { - cbSize: ::DWORD, - Platform: ::DWORD, - MajorVersion: ::DWORD, - MinorVersion: ::DWORD, - ProcessorArchitecture: ::WORD, - Reserved: ::WORD, - FirstValidatedMajorVersion: ::DWORD, - FirstValidatedMinorVersion: ::DWORD, -}} -UNION!(SP_ALTPLATFORM_INFO_V2, Reserved, Flags, Flags_mut, ::WORD); -pub type PSP_ALTPLATFORM_INFO_V2 = *mut SP_ALTPLATFORM_INFO_V2; -STRUCT!{struct SP_ALTPLATFORM_INFO_V1 { - cbSize: ::DWORD, - Platform: ::DWORD, - MajorVersion: ::DWORD, - MinorVersion: ::DWORD, - ProcessorArchitecture: ::WORD, - Reserved: ::WORD, -}} -pub type PSP_ALTPLATFORM_INFO_V1 = *mut SP_ALTPLATFORM_INFO_V1; -pub type SP_ALTPLATFORM_INFO = SP_ALTPLATFORM_INFO_V2; -pub type PSP_ALTPLATFORM_INFO = PSP_ALTPLATFORM_INFO_V2; -pub const SP_ALTPLATFORM_FLAGS_VERSION_RANGE: ::WORD = 0x0001; -STRUCT!{nodebug struct SP_ORIGINAL_FILE_INFO_A { - cbSize: ::DWORD, - OriginalInfName: [::CHAR; ::MAX_PATH], - OriginalCatalogName: [::CHAR; ::MAX_PATH], -}} -pub type PSP_ORIGINAL_FILE_INFO_A = *mut SP_ORIGINAL_FILE_INFO_A; -STRUCT!{nodebug struct SP_ORIGINAL_FILE_INFO_W { - cbSize: ::DWORD, - OriginalInfName: [::WCHAR; ::MAX_PATH], - OriginalCatalogName: [::WCHAR; ::MAX_PATH], -}} -pub type PSP_ORIGINAL_FILE_INFO_W = *mut SP_ORIGINAL_FILE_INFO_W; -pub const INF_STYLE_NONE: ::DWORD = 0x00000000; -pub const INF_STYLE_OLDNT: ::DWORD = 0x00000001; -pub const INF_STYLE_WIN4: ::DWORD = 0x00000002; -pub const INF_STYLE_CACHE_ENABLE: ::DWORD = 0x00000010; -pub const INF_STYLE_CACHE_DISABLE: ::DWORD = 0x00000020; -pub const INF_STYLE_CACHE_IGNORE: ::DWORD = 0x00000040; -pub const DIRID_ABSOLUTE: ::DWORD = -1i32 as ::DWORD; -pub const DIRID_ABSOLUTE_16BIT: ::DWORD = 0xffff; -pub const DIRID_NULL: ::DWORD = 0; -pub const DIRID_SRCPATH: ::DWORD = 1; -pub const DIRID_WINDOWS: ::DWORD = 10; -pub const DIRID_SYSTEM: ::DWORD = 11; -pub const DIRID_DRIVERS: ::DWORD = 12; -pub const DIRID_IOSUBSYS: ::DWORD = DIRID_DRIVERS; -pub const DIRID_DRIVER_STORE: ::DWORD = 13; -pub const DIRID_INF: ::DWORD = 17; -pub const DIRID_HELP: ::DWORD = 18; -pub const DIRID_FONTS: ::DWORD = 20; -pub const DIRID_VIEWERS: ::DWORD = 21; -pub const DIRID_COLOR: ::DWORD = 23; -pub const DIRID_APPS: ::DWORD = 24; -pub const DIRID_SHARED: ::DWORD = 25; -pub const DIRID_BOOT: ::DWORD = 30; -pub const DIRID_SYSTEM16: ::DWORD = 50; -pub const DIRID_SPOOL: ::DWORD = 51; -pub const DIRID_SPOOLDRIVERS: ::DWORD = 52; -pub const DIRID_USERPROFILE: ::DWORD = 53; -pub const DIRID_LOADER: ::DWORD = 54; -pub const DIRID_PRINTPROCESSOR: ::DWORD = 55; -pub const DIRID_DEFAULT: ::DWORD = DIRID_SYSTEM; -pub const DIRID_COMMON_STARTMENU: ::DWORD = 16406; -pub const DIRID_COMMON_PROGRAMS: ::DWORD = 16407; -pub const DIRID_COMMON_STARTUP: ::DWORD = 16408; -pub const DIRID_COMMON_DESKTOPDIRECTORY: ::DWORD = 16409; -pub const DIRID_COMMON_FAVORITES: ::DWORD = 16415; -pub const DIRID_COMMON_APPDATA: ::DWORD = 16419; -pub const DIRID_PROGRAM_FILES: ::DWORD = 16422; -pub const DIRID_SYSTEM_X86: ::DWORD = 16425; -pub const DIRID_PROGRAM_FILES_X86: ::DWORD = 16426; -pub const DIRID_PROGRAM_FILES_COMMON: ::DWORD = 16427; -pub const DIRID_PROGRAM_FILES_COMMONX86: ::DWORD = 16428; -pub const DIRID_COMMON_TEMPLATES: ::DWORD = 16429; -pub const DIRID_COMMON_DOCUMENTS: ::DWORD = 16430; -pub const DIRID_USER: ::DWORD = 0x8000; -pub type PSP_FILE_CALLBACK_A = Option ::UINT>; -pub type PSP_FILE_CALLBACK_W = Option ::UINT>; -pub const SPFILENOTIFY_STARTQUEUE: ::UINT = 0x00000001; -pub const SPFILENOTIFY_ENDQUEUE: ::UINT = 0x00000002; -pub const SPFILENOTIFY_STARTSUBQUEUE: ::UINT = 0x00000003; -pub const SPFILENOTIFY_ENDSUBQUEUE: ::UINT = 0x00000004; -pub const SPFILENOTIFY_STARTDELETE: ::UINT = 0x00000005; -pub const SPFILENOTIFY_ENDDELETE: ::UINT = 0x00000006; -pub const SPFILENOTIFY_DELETEERROR: ::UINT = 0x00000007; -pub const SPFILENOTIFY_STARTRENAME: ::UINT = 0x00000008; -pub const SPFILENOTIFY_ENDRENAME: ::UINT = 0x00000009; -pub const SPFILENOTIFY_RENAMEERROR: ::UINT = 0x0000000a; -pub const SPFILENOTIFY_STARTCOPY: ::UINT = 0x0000000b; -pub const SPFILENOTIFY_ENDCOPY: ::UINT = 0x0000000c; -pub const SPFILENOTIFY_COPYERROR: ::UINT = 0x0000000d; -pub const SPFILENOTIFY_NEEDMEDIA: ::UINT = 0x0000000e; -pub const SPFILENOTIFY_QUEUESCAN: ::UINT = 0x0000000f; -pub const SPFILENOTIFY_CABINETINFO: ::UINT = 0x00000010; -pub const SPFILENOTIFY_FILEINCABINET: ::UINT = 0x00000011; -pub const SPFILENOTIFY_NEEDNEWCABINET: ::UINT = 0x00000012; -pub const SPFILENOTIFY_FILEEXTRACTED: ::UINT = 0x00000013; -pub const SPFILENOTIFY_FILEOPDELAYED: ::UINT = 0x00000014; -pub const SPFILENOTIFY_STARTBACKUP: ::UINT = 0x00000015; -pub const SPFILENOTIFY_BACKUPERROR: ::UINT = 0x00000016; -pub const SPFILENOTIFY_ENDBACKUP: ::UINT = 0x00000017; -pub const SPFILENOTIFY_QUEUESCAN_EX: ::UINT = 0x00000018; -pub const SPFILENOTIFY_STARTREGISTRATION: ::UINT = 0x00000019; -pub const SPFILENOTIFY_ENDREGISTRATION: ::UINT = 0x00000020; -pub const SPFILENOTIFY_QUEUESCAN_SIGNERINFO: ::UINT = 0x00000040; -pub const SPFILENOTIFY_LANGMISMATCH: ::UINT = 0x00010000; -pub const SPFILENOTIFY_TARGETEXISTS: ::UINT = 0x00020000; -pub const SPFILENOTIFY_TARGETNEWER: ::UINT = 0x00040000; -pub const FILEOP_COPY: ::UINT = 0; -pub const FILEOP_RENAME: ::UINT = 1; -pub const FILEOP_DELETE: ::UINT = 2; -pub const FILEOP_BACKUP: ::UINT = 3; -pub const FILEOP_ABORT: ::UINT = 0; -pub const FILEOP_DOIT: ::UINT = 1; -pub const FILEOP_SKIP: ::UINT = 2; -pub const FILEOP_RETRY: ::UINT = FILEOP_DOIT; -pub const FILEOP_NEWPATH: ::UINT = 4; -pub const COPYFLG_WARN_IF_SKIP: ::UINT = 0x00000001; -pub const COPYFLG_NOSKIP: ::UINT = 0x00000002; -pub const COPYFLG_NOVERSIONCHECK: ::UINT = 0x00000004; -pub const COPYFLG_FORCE_FILE_IN_USE: ::UINT = 0x00000008; -pub const COPYFLG_NO_OVERWRITE: ::UINT = 0x00000010; -pub const COPYFLG_NO_VERSION_DIALOG: ::UINT = 0x00000020; -pub const COPYFLG_OVERWRITE_OLDER_ONLY: ::UINT = 0x00000040; -pub const COPYFLG_PROTECTED_WINDOWS_DRIVER_FILE: ::UINT = 0x00000100; -pub const COPYFLG_REPLACEONLY: ::UINT = 0x00000400; -pub const COPYFLG_NODECOMP: ::UINT = 0x00000800; -pub const COPYFLG_REPLACE_BOOT_FILE: ::UINT = 0x00001000; -pub const COPYFLG_NOPRUNE: ::UINT = 0x00002000; -pub const COPYFLG_IN_USE_TRY_RENAME: ::UINT = 0x00004000; -pub const DELFLG_IN_USE: ::UINT = 0x00000001; -pub const DELFLG_IN_USE1: ::UINT = 0x00010000; -STRUCT!{struct FILEPATHS_A { - Target: ::PCSTR, - Source: ::PCSTR, - Win32Error: ::UINT, - Flags: ::DWORD, -}} -pub type PFILEPATHS_A = *mut FILEPATHS_A; -STRUCT!{struct FILEPATHS_W { - Target: ::PCWSTR, - Source: ::PCWSTR, - Win32Error: ::UINT, - Flags: ::DWORD, -}} -pub type PFILEPATHS_W = *mut FILEPATHS_W; -STRUCT!{struct FILEPATHS_SIGNERINFO_A { - Target: ::PCSTR, - Source: ::PCSTR, - Win32Error: ::UINT, - Flags: ::DWORD, - DigitalSigner: ::PCSTR, - Version: ::PCSTR, - CatalogFile: ::PCSTR, -}} -pub type PFILEPATHS_SIGNERINFO_A = *mut FILEPATHS_SIGNERINFO_A; -STRUCT!{struct FILEPATHS_SIGNERINFO_W { - Target: ::PCWSTR, - Source: ::PCWSTR, - Win32Error: ::UINT, - Flags: ::DWORD, - DigitalSigner: ::PCWSTR, - Version: ::PCWSTR, - CatalogFile: ::PCWSTR, -}} -pub type PFILEPATHS_SIGNERINFO_W = *mut FILEPATHS_SIGNERINFO_W; -STRUCT!{struct SOURCE_MEDIA_A { - Reserved: ::PCSTR, - Tagfile: ::PCSTR, - Description: ::PCSTR, - SourcePath: ::PCSTR, - SourceFile: ::PCSTR, - Flags: ::DWORD, -}} -pub type PSOURCE_MEDIA_A = *mut SOURCE_MEDIA_A; -STRUCT!{struct SOURCE_MEDIA_W { - Reserved: ::PCWSTR, - Tagfile: ::PCWSTR, - Description: ::PCWSTR, - SourcePath: ::PCWSTR, - SourceFile: ::PCWSTR, - Flags: ::DWORD, -}} -pub type PSOURCE_MEDIA_W = *mut SOURCE_MEDIA_W; -STRUCT!{struct CABINET_INFO_A { - CabinetPath: ::PCSTR, - CabinetFile: ::PCSTR, - DiskName: ::PCSTR, - SetId: ::USHORT, - CabinetNumber: ::USHORT, -}} -pub type PCABINET_INFO_A = *mut CABINET_INFO_A; -STRUCT!{struct CABINET_INFO_W { - CabinetPath: ::PCWSTR, - CabinetFile: ::PCWSTR, - DiskName: ::PCWSTR, - SetId: ::USHORT, - CabinetNumber: ::USHORT, -}} -pub type PCABINET_INFO_W = *mut CABINET_INFO_W; -STRUCT!{nodebug struct FILE_IN_CABINET_INFO_A { - NameInCabinet: ::PCSTR, - FileSize: ::DWORD, - Win32Error: ::DWORD, - DosDate: ::WORD, - DosTime: ::WORD, - DosAttribs: ::WORD, - FullTargetName: [::CHAR; ::MAX_PATH], -}} -pub type PFILE_IN_CABINET_INFO_A = *mut FILE_IN_CABINET_INFO_A; -STRUCT!{nodebug struct FILE_IN_CABINET_INFO_W { - NameInCabinet: ::PCWSTR, - FileSize: ::DWORD, - Win32Error: ::DWORD, - DosDate: ::WORD, - DosTime: ::WORD, - DosAttribs: ::WORD, - FullTargetName: [::WCHAR; ::MAX_PATH], -}} -pub type PFILE_IN_CABINET_INFO_W = *mut FILE_IN_CABINET_INFO_W; -STRUCT!{struct SP_REGISTER_CONTROL_STATUSA { - cbSize: ::DWORD, - FileName: ::PCSTR, - Win32Error: ::DWORD, - FailureCode: ::DWORD, -}} -pub type PSP_REGISTER_CONTROL_STATUSA = *mut SP_REGISTER_CONTROL_STATUSA; -STRUCT!{struct SP_REGISTER_CONTROL_STATUSW { - cbSize: ::DWORD, - FileName: ::PCWSTR, - Win32Error: ::DWORD, - FailureCode: ::DWORD, -}} -pub type PSP_REGISTER_CONTROL_STATUSW = *mut SP_REGISTER_CONTROL_STATUSW; -pub const SPREG_SUCCESS: ::DWORD = 0x00000000; -pub const SPREG_LOADLIBRARY: ::DWORD = 0x00000001; -pub const SPREG_GETPROCADDR: ::DWORD = 0x00000002; -pub const SPREG_REGSVR: ::DWORD = 0x00000003; -pub const SPREG_DLLINSTALL: ::DWORD = 0x00000004; -pub const SPREG_TIMEOUT: ::DWORD = 0x00000005; -pub const SPREG_UNKNOWN: ::DWORD = 0xFFFFFFFF; -pub type HSPFILEQ = ::PVOID; -STRUCT!{struct SP_FILE_COPY_PARAMS_A { - cbSize: ::DWORD, - QueueHandle: HSPFILEQ, - SourceRootPath: ::PCSTR, - SourcePath: ::PCSTR, - SourceFilename: ::PCSTR, - SourceDescription: ::PCSTR, - SourceTagfile: ::PCSTR, - TargetDirectory: ::PCSTR, - TargetFilename: ::PCSTR, - CopyStyle: ::DWORD, - LayoutInf: HINF, - SecurityDescriptor: ::PCSTR, -}} -pub type PSP_FILE_COPY_PARAMS_A = *mut SP_FILE_COPY_PARAMS_A; -STRUCT!{struct SP_FILE_COPY_PARAMS_W { - cbSize: ::DWORD, - QueueHandle: HSPFILEQ, - SourceRootPath: ::PCWSTR, - SourcePath: ::PCWSTR, - SourceFilename: ::PCWSTR, - SourceDescription: ::PCWSTR, - SourceTagfile: ::PCWSTR, - TargetDirectory: ::PCWSTR, - TargetFilename: ::PCWSTR, - CopyStyle: ::DWORD, - LayoutInf: HINF, - SecurityDescriptor: ::PCWSTR, -}} -pub type PSP_FILE_COPY_PARAMS_W = *mut SP_FILE_COPY_PARAMS_W; -pub type HDSKSPC = ::PVOID; -pub type HDEVINFO = ::PVOID; -STRUCT!{struct SP_DEVINFO_DATA { - cbSize: ::DWORD, - ClassGuid: ::GUID, - DevInst: ::DWORD, - Reserved: ::ULONG_PTR, -}} -pub type PSP_DEVINFO_DATA = *mut SP_DEVINFO_DATA; -STRUCT!{struct SP_DEVICE_INTERFACE_DATA { - cbSize: ::DWORD, - InterfaceClassGuid: ::GUID, - Flags: ::DWORD, - Reserved: ::ULONG_PTR, -}} -pub type PSP_DEVICE_INTERFACE_DATA = *mut SP_DEVICE_INTERFACE_DATA; -pub const SPINT_ACTIVE: ::DWORD = 0x00000001; -pub const SPINT_DEFAULT: ::DWORD = 0x00000002; -pub const SPINT_REMOVED: ::DWORD = 0x00000004; -pub type SP_INTERFACE_DEVICE_DATA = SP_DEVICE_INTERFACE_DATA; -pub type PSP_INTERFACE_DEVICE_DATA = PSP_DEVICE_INTERFACE_DATA; -pub const SPID_ACTIVE: ::DWORD = SPINT_ACTIVE; -pub const SPID_DEFAULT: ::DWORD = SPINT_DEFAULT; -pub const SPID_REMOVED: ::DWORD = SPINT_REMOVED; -STRUCT!{struct SP_DEVICE_INTERFACE_DETAIL_DATA_A { - cbSize: ::DWORD, - DevicePath: [::CHAR; ::ANYSIZE_ARRAY], -}} -pub type PSP_DEVICE_INTERFACE_DETAIL_DATA_A = *mut SP_DEVICE_INTERFACE_DETAIL_DATA_A; -STRUCT!{struct SP_DEVICE_INTERFACE_DETAIL_DATA_W { - cbSize: ::DWORD, - DevicePath: [::WCHAR; ::ANYSIZE_ARRAY], -}} -pub type PSP_DEVICE_INTERFACE_DETAIL_DATA_W = *mut SP_DEVICE_INTERFACE_DETAIL_DATA_W; -STRUCT!{nodebug struct SP_DEVINFO_LIST_DETAIL_DATA_A { - cbSize: ::DWORD, - ClassGuid: ::GUID, - RemoteMachineHandle: ::HANDLE, - RemoteMachineName: [::CHAR; SP_MAX_MACHINENAME_LENGTH], -}} -pub type PSP_DEVINFO_LIST_DETAIL_DATA_A = *mut SP_DEVINFO_LIST_DETAIL_DATA_A; -STRUCT!{nodebug struct SP_DEVINFO_LIST_DETAIL_DATA_W { - cbSize: ::DWORD, - ClassGuid: ::GUID, - RemoteMachineHandle: ::HANDLE, - RemoteMachineName: [::WCHAR; SP_MAX_MACHINENAME_LENGTH], -}} -pub type PSP_DEVINFO_LIST_DETAIL_DATA_W = *mut SP_DEVINFO_LIST_DETAIL_DATA_W; -pub const DIF_SELECTDEVICE: DI_FUNCTION = 0x00000001; -pub const DIF_INSTALLDEVICE: DI_FUNCTION = 0x00000002; -pub const DIF_ASSIGNRESOURCES: DI_FUNCTION = 0x00000003; -pub const DIF_PROPERTIES: DI_FUNCTION = 0x00000004; -pub const DIF_REMOVE: DI_FUNCTION = 0x00000005; -pub const DIF_FIRSTTIMESETUP: DI_FUNCTION = 0x00000006; -pub const DIF_FOUNDDEVICE: DI_FUNCTION = 0x00000007; -pub const DIF_SELECTCLASSDRIVERS: DI_FUNCTION = 0x00000008; -pub const DIF_VALIDATECLASSDRIVERS: DI_FUNCTION = 0x00000009; -pub const DIF_INSTALLCLASSDRIVERS: DI_FUNCTION = 0x0000000A; -pub const DIF_CALCDISKSPACE: DI_FUNCTION = 0x0000000B; -pub const DIF_DESTROYPRIVATEDATA: DI_FUNCTION = 0x0000000C; -pub const DIF_VALIDATEDRIVER: DI_FUNCTION = 0x0000000D; -pub const DIF_DETECT: DI_FUNCTION = 0x0000000F; -pub const DIF_INSTALLWIZARD: DI_FUNCTION = 0x00000010; -pub const DIF_DESTROYWIZARDDATA: DI_FUNCTION = 0x00000011; -pub const DIF_PROPERTYCHANGE: DI_FUNCTION = 0x00000012; -pub const DIF_ENABLECLASS: DI_FUNCTION = 0x00000013; -pub const DIF_DETECTVERIFY: DI_FUNCTION = 0x00000014; -pub const DIF_INSTALLDEVICEFILES: DI_FUNCTION = 0x00000015; -pub const DIF_UNREMOVE: DI_FUNCTION = 0x00000016; -pub const DIF_SELECTBESTCOMPATDRV: DI_FUNCTION = 0x00000017; -pub const DIF_ALLOW_INSTALL: DI_FUNCTION = 0x00000018; -pub const DIF_REGISTERDEVICE: DI_FUNCTION = 0x00000019; -pub const DIF_NEWDEVICEWIZARD_PRESELECT: DI_FUNCTION = 0x0000001A; -pub const DIF_NEWDEVICEWIZARD_SELECT: DI_FUNCTION = 0x0000001B; -pub const DIF_NEWDEVICEWIZARD_PREANALYZE: DI_FUNCTION = 0x0000001C; -pub const DIF_NEWDEVICEWIZARD_POSTANALYZE: DI_FUNCTION = 0x0000001D; -pub const DIF_NEWDEVICEWIZARD_FINISHINSTALL: DI_FUNCTION = 0x0000001E; -pub const DIF_UNUSED1: DI_FUNCTION = 0x0000001F; -pub const DIF_INSTALLINTERFACES: DI_FUNCTION = 0x00000020; -pub const DIF_DETECTCANCEL: DI_FUNCTION = 0x00000021; -pub const DIF_REGISTER_COINSTALLERS: DI_FUNCTION = 0x00000022; -pub const DIF_ADDPROPERTYPAGE_ADVANCED: DI_FUNCTION = 0x00000023; -pub const DIF_ADDPROPERTYPAGE_BASIC: DI_FUNCTION = 0x00000024; -pub const DIF_RESERVED1: DI_FUNCTION = 0x00000025; -pub const DIF_TROUBLESHOOTER: DI_FUNCTION = 0x00000026; -pub const DIF_POWERMESSAGEWAKE: DI_FUNCTION = 0x00000027; -pub const DIF_ADDREMOTEPROPERTYPAGE_ADVANCED: DI_FUNCTION = 0x00000028; -pub const DIF_UPDATEDRIVER_UI: DI_FUNCTION = 0x00000029; -pub const DIF_FINISHINSTALL_ACTION: DI_FUNCTION = 0x0000002A; -pub const DIF_RESERVED2: DI_FUNCTION = 0x00000030; -pub const DIF_MOVEDEVICE: DI_FUNCTION = 0x0000000E; -pub type DI_FUNCTION = ::UINT; -STRUCT!{nodebug struct SP_DEVINSTALL_PARAMS_A { - cbSize: ::DWORD, - Flags: ::DWORD, - FlagsEx: ::DWORD, - hwndParent: ::HWND, - InstallMsgHandler: PSP_FILE_CALLBACK_A, - InstallMsgHandlerContext: ::PVOID, - FileQueue: HSPFILEQ, - ClassInstallReserved: ::ULONG_PTR, - Reserved: ::DWORD, - DriverPath: [::CHAR; ::MAX_PATH], -}} -pub type PSP_DEVINSTALL_PARAMS_A = *mut SP_DEVINSTALL_PARAMS_A; -STRUCT!{nodebug struct SP_DEVINSTALL_PARAMS_W { - cbSize: ::DWORD, - Flags: ::DWORD, - FlagsEx: ::DWORD, - hwndParent: ::HWND, - InstallMsgHandler: PSP_FILE_CALLBACK_W, - InstallMsgHandlerContext: ::PVOID, - FileQueue: HSPFILEQ, - ClassInstallReserved: ::ULONG_PTR, - Reserved: ::DWORD, - DriverPath: [::WCHAR; ::MAX_PATH], -}} -pub type PSP_DEVINSTALL_PARAMS_W = *mut SP_DEVINSTALL_PARAMS_W; -pub const DI_SHOWOEM: ::DWORD = 0x00000001; -pub const DI_SHOWCOMPAT: ::DWORD = 0x00000002; -pub const DI_SHOWCLASS: ::DWORD = 0x00000004; -pub const DI_SHOWALL: ::DWORD = 0x00000007; -pub const DI_NOVCP: ::DWORD = 0x00000008; -pub const DI_DIDCOMPAT: ::DWORD = 0x00000010; -pub const DI_DIDCLASS: ::DWORD = 0x00000020; -pub const DI_AUTOASSIGNRES: ::DWORD = 0x00000040; -pub const DI_NEEDRESTART: ::DWORD = 0x00000080; -pub const DI_NEEDREBOOT: ::DWORD = 0x00000100; -pub const DI_NOBROWSE: ::DWORD = 0x00000200; -pub const DI_MULTMFGS: ::DWORD = 0x00000400; -pub const DI_DISABLED: ::DWORD = 0x00000800; -pub const DI_GENERALPAGE_ADDED: ::DWORD = 0x00001000; -pub const DI_RESOURCEPAGE_ADDED: ::DWORD = 0x00002000; -pub const DI_PROPERTIES_CHANGE: ::DWORD = 0x00004000; -pub const DI_INF_IS_SORTED: ::DWORD = 0x00008000; -pub const DI_ENUMSINGLEINF: ::DWORD = 0x00010000; -pub const DI_DONOTCALLCONFIGMG: ::DWORD = 0x00020000; -pub const DI_INSTALLDISABLED: ::DWORD = 0x00040000; -pub const DI_COMPAT_FROM_CLASS: ::DWORD = 0x00080000; -pub const DI_CLASSINSTALLPARAMS: ::DWORD = 0x00100000; -pub const DI_NODI_DEFAULTACTION: ::DWORD = 0x00200000; -pub const DI_QUIETINSTALL: ::DWORD = 0x00800000; -pub const DI_NOFILECOPY: ::DWORD = 0x01000000; -pub const DI_FORCECOPY: ::DWORD = 0x02000000; -pub const DI_DRIVERPAGE_ADDED: ::DWORD = 0x04000000; -pub const DI_USECI_SELECTSTRINGS: ::DWORD = 0x08000000; -pub const DI_OVERRIDE_INFFLAGS: ::DWORD = 0x10000000; -pub const DI_PROPS_NOCHANGEUSAGE: ::DWORD = 0x20000000; -pub const DI_NOSELECTICONS: ::DWORD = 0x40000000; -pub const DI_NOWRITE_IDS: ::DWORD = 0x80000000; -pub const DI_FLAGSEX_RESERVED2: ::DWORD = 0x00000001; -pub const DI_FLAGSEX_RESERVED3: ::DWORD = 0x00000002; -pub const DI_FLAGSEX_CI_FAILED: ::DWORD = 0x00000004; -pub const DI_FLAGSEX_FINISHINSTALL_ACTION: ::DWORD = 0x00000008; -pub const DI_FLAGSEX_DIDINFOLIST: ::DWORD = 0x00000010; -pub const DI_FLAGSEX_DIDCOMPATINFO: ::DWORD = 0x00000020; -pub const DI_FLAGSEX_FILTERCLASSES: ::DWORD = 0x00000040; -pub const DI_FLAGSEX_SETFAILEDINSTALL: ::DWORD = 0x00000080; -pub const DI_FLAGSEX_DEVICECHANGE: ::DWORD = 0x00000100; -pub const DI_FLAGSEX_ALWAYSWRITEIDS: ::DWORD = 0x00000200; -pub const DI_FLAGSEX_PROPCHANGE_PENDING: ::DWORD = 0x00000400; -pub const DI_FLAGSEX_ALLOWEXCLUDEDDRVS: ::DWORD = 0x00000800; -pub const DI_FLAGSEX_NOUIONQUERYREMOVE: ::DWORD = 0x00001000; -pub const DI_FLAGSEX_USECLASSFORCOMPAT: ::DWORD = 0x00002000; -pub const DI_FLAGSEX_RESERVED4: ::DWORD = 0x00004000; -pub const DI_FLAGSEX_NO_DRVREG_MODIFY: ::DWORD = 0x00008000; -pub const DI_FLAGSEX_IN_SYSTEM_SETUP: ::DWORD = 0x00010000; -pub const DI_FLAGSEX_INET_DRIVER: ::DWORD = 0x00020000; -pub const DI_FLAGSEX_APPENDDRIVERLIST: ::DWORD = 0x00040000; -pub const DI_FLAGSEX_PREINSTALLBACKUP: ::DWORD = 0x00080000; -pub const DI_FLAGSEX_BACKUPONREPLACE: ::DWORD = 0x00100000; -pub const DI_FLAGSEX_DRIVERLIST_FROM_URL: ::DWORD = 0x00200000; -pub const DI_FLAGSEX_RESERVED1: ::DWORD = 0x00400000; -pub const DI_FLAGSEX_EXCLUDE_OLD_INET_DRIVERS: ::DWORD = 0x00800000; -pub const DI_FLAGSEX_POWERPAGE_ADDED: ::DWORD = 0x01000000; -pub const DI_FLAGSEX_FILTERSIMILARDRIVERS: ::DWORD = 0x02000000; -pub const DI_FLAGSEX_INSTALLEDDRIVER: ::DWORD = 0x04000000; -pub const DI_FLAGSEX_NO_CLASSLIST_NODE_MERGE: ::DWORD = 0x08000000; -pub const DI_FLAGSEX_ALTPLATFORM_DRVSEARCH: ::DWORD = 0x10000000; -pub const DI_FLAGSEX_RESTART_DEVICE_ONLY: ::DWORD = 0x20000000; -pub const DI_FLAGSEX_RECURSIVESEARCH: ::DWORD = 0x40000000; -pub const DI_FLAGSEX_SEARCH_PUBLISHED_INFS: ::DWORD = 0x80000000; -STRUCT!{struct SP_CLASSINSTALL_HEADER { - cbSize: ::DWORD, - InstallFunction: DI_FUNCTION, -}} -pub type PSP_CLASSINSTALL_HEADER = *mut SP_CLASSINSTALL_HEADER; -STRUCT!{struct SP_ENABLECLASS_PARAMS { - ClassInstallHeader: SP_CLASSINSTALL_HEADER, - ClassGuid: ::GUID, - EnableMessage: ::DWORD, -}} -pub type PSP_ENABLECLASS_PARAMS = *mut SP_ENABLECLASS_PARAMS; -pub const ENABLECLASS_QUERY: ::DWORD = 0; -pub const ENABLECLASS_SUCCESS: ::DWORD = 1; -pub const ENABLECLASS_FAILURE: ::DWORD = 2; -pub const DICS_ENABLE: ::DWORD = 0x00000001; -pub const DICS_DISABLE: ::DWORD = 0x00000002; -pub const DICS_PROPCHANGE: ::DWORD = 0x00000003; -pub const DICS_START: ::DWORD = 0x00000004; -pub const DICS_STOP: ::DWORD = 0x00000005; -pub const DICS_FLAG_GLOBAL: ::DWORD = 0x00000001; -pub const DICS_FLAG_CONFIGSPECIFIC: ::DWORD = 0x00000002; -pub const DICS_FLAG_CONFIGGENERAL: ::DWORD = 0x00000004; -STRUCT!{struct SP_PROPCHANGE_PARAMS { - ClassInstallHeader: SP_CLASSINSTALL_HEADER, - StateChange: ::DWORD, - Scope: ::DWORD, - HwProfile: ::DWORD, -}} -pub type PSP_PROPCHANGE_PARAMS = *mut SP_PROPCHANGE_PARAMS; -STRUCT!{struct SP_REMOVEDEVICE_PARAMS { - ClassInstallHeader: SP_CLASSINSTALL_HEADER, - Scope: ::DWORD, - HwProfile: ::DWORD, -}} -pub type PSP_REMOVEDEVICE_PARAMS = *mut SP_REMOVEDEVICE_PARAMS; -pub const DI_REMOVEDEVICE_GLOBAL: ::DWORD = 0x00000001; -pub const DI_REMOVEDEVICE_CONFIGSPECIFIC: ::DWORD = 0x00000002; -STRUCT!{struct SP_UNREMOVEDEVICE_PARAMS { - ClassInstallHeader: SP_CLASSINSTALL_HEADER, - Scope: ::DWORD, - HwProfile: ::DWORD, -}} -pub type PSP_UNREMOVEDEVICE_PARAMS = *mut SP_UNREMOVEDEVICE_PARAMS; -pub const DI_UNREMOVEDEVICE_CONFIGSPECIFIC: ::DWORD = 0x00000002; -STRUCT!{nodebug struct SP_SELECTDEVICE_PARAMS_A { - ClassInstallHeader: SP_CLASSINSTALL_HEADER, - Title: [::CHAR; MAX_TITLE_LEN], - Instructions: [::CHAR; MAX_INSTRUCTION_LEN], - ListLabel: [::CHAR; MAX_LABEL_LEN], - SubTitle: [::CHAR; MAX_SUBTITLE_LEN], - Reserved: [::BYTE; 2], -}} -pub type PSP_SELECTDEVICE_PARAMS_A = *mut SP_SELECTDEVICE_PARAMS_A; -STRUCT!{nodebug struct SP_SELECTDEVICE_PARAMS_W { - ClassInstallHeader: SP_CLASSINSTALL_HEADER, - Title: [::WCHAR; MAX_TITLE_LEN], - Instructions: [::WCHAR; MAX_INSTRUCTION_LEN], - ListLabel: [::WCHAR; MAX_LABEL_LEN], - SubTitle: [::WCHAR; MAX_SUBTITLE_LEN], -}} -pub type PSP_SELECTDEVICE_PARAMS_W = *mut SP_SELECTDEVICE_PARAMS_W; -pub type PDETECT_PROGRESS_NOTIFY = Option ::BOOL>; -STRUCT!{nodebug struct SP_DETECTDEVICE_PARAMS { - ClassInstallHeader: SP_CLASSINSTALL_HEADER, - DetectProgressNotify: PDETECT_PROGRESS_NOTIFY, - ProgressNotifyParam: ::PVOID, -}} -pub type PSP_DETECTDEVICE_PARAMS = *mut SP_DETECTDEVICE_PARAMS; -pub const MAX_INSTALLWIZARD_DYNAPAGES: usize = 20; -STRUCT!{struct SP_INSTALLWIZARD_DATA { - ClassInstallHeader: SP_CLASSINSTALL_HEADER, - Flags: ::DWORD, - DynamicPages: [::HPROPSHEETPAGE; MAX_INSTALLWIZARD_DYNAPAGES], - NumDynamicPages: ::DWORD, - DynamicPageFlags: ::DWORD, - PrivateFlags: ::DWORD, - PrivateData: ::LPARAM, - hwndWizardDlg: ::HWND, -}} -pub type PSP_INSTALLWIZARD_DATA = *mut SP_INSTALLWIZARD_DATA; -pub const NDW_INSTALLFLAG_DIDFACTDEFS: ::DWORD = 0x00000001; -pub const NDW_INSTALLFLAG_HARDWAREALLREADYIN: ::DWORD = 0x00000002; -pub const NDW_INSTALLFLAG_NEEDRESTART: ::DWORD = DI_NEEDRESTART; -pub const NDW_INSTALLFLAG_NEEDREBOOT: ::DWORD = DI_NEEDREBOOT; -pub const NDW_INSTALLFLAG_NEEDSHUTDOWN: ::DWORD = 0x00000200; -pub const NDW_INSTALLFLAG_EXPRESSINTRO: ::DWORD = 0x00000400; -pub const NDW_INSTALLFLAG_SKIPISDEVINSTALLED: ::DWORD = 0x00000800; -pub const NDW_INSTALLFLAG_NODETECTEDDEVS: ::DWORD = 0x00001000; -pub const NDW_INSTALLFLAG_INSTALLSPECIFIC: ::DWORD = 0x00002000; -pub const NDW_INSTALLFLAG_SKIPCLASSLIST: ::DWORD = 0x00004000; -pub const NDW_INSTALLFLAG_CI_PICKED_OEM: ::DWORD = 0x00008000; -pub const NDW_INSTALLFLAG_PCMCIAMODE: ::DWORD = 0x00010000; -pub const NDW_INSTALLFLAG_PCMCIADEVICE: ::DWORD = 0x00020000; -pub const NDW_INSTALLFLAG_USERCANCEL: ::DWORD = 0x00040000; -pub const NDW_INSTALLFLAG_KNOWNCLASS: ::DWORD = 0x00080000; -pub const DYNAWIZ_FLAG_PAGESADDED: ::DWORD = 0x00000001; -pub const DYNAWIZ_FLAG_ANALYZE_HANDLECONFLICT: ::DWORD = 0x00000008; -pub const DYNAWIZ_FLAG_INSTALLDET_NEXT: ::DWORD = 0x00000002; -pub const DYNAWIZ_FLAG_INSTALLDET_PREV: ::DWORD = 0x00000004; -pub const MIN_IDD_DYNAWIZ_RESOURCE_ID: ::c_int = 10000; -pub const MAX_IDD_DYNAWIZ_RESOURCE_ID: ::c_int = 11000; -pub const IDD_DYNAWIZ_FIRSTPAGE: ::c_int = 10000; -pub const IDD_DYNAWIZ_SELECT_PREVPAGE: ::c_int = 10001; -pub const IDD_DYNAWIZ_SELECT_NEXTPAGE: ::c_int = 10002; -pub const IDD_DYNAWIZ_ANALYZE_PREVPAGE: ::c_int = 10003; -pub const IDD_DYNAWIZ_ANALYZE_NEXTPAGE: ::c_int = 10004; -pub const IDD_DYNAWIZ_SELECTDEV_PAGE: ::c_int = 10009; -pub const IDD_DYNAWIZ_ANALYZEDEV_PAGE: ::c_int = 10010; -pub const IDD_DYNAWIZ_INSTALLDETECTEDDEVS_PAGE: ::c_int = 10011; -pub const IDD_DYNAWIZ_SELECTCLASS_PAGE: ::c_int = 10012; -pub const IDD_DYNAWIZ_INSTALLDETECTED_PREVPAGE: ::c_int = 10006; -pub const IDD_DYNAWIZ_INSTALLDETECTED_NEXTPAGE: ::c_int = 10007; -pub const IDD_DYNAWIZ_INSTALLDETECTED_NODEVS: ::c_int = 10008; -STRUCT!{struct SP_NEWDEVICEWIZARD_DATA { - ClassInstallHeader: SP_CLASSINSTALL_HEADER, - Flags: ::DWORD, - DynamicPages: [::HPROPSHEETPAGE; MAX_INSTALLWIZARD_DYNAPAGES], - NumDynamicPages: ::DWORD, - hwndWizardDlg: ::HWND, -}} -pub type PSP_NEWDEVICEWIZARD_DATA = *mut SP_NEWDEVICEWIZARD_DATA; -pub type SP_ADDPROPERTYPAGE_DATA = SP_NEWDEVICEWIZARD_DATA; -pub type PSP_ADDPROPERTYPAGE_DATA = PSP_NEWDEVICEWIZARD_DATA; -STRUCT!{nodebug struct SP_TROUBLESHOOTER_PARAMS_A { - ClassInstallHeader: SP_CLASSINSTALL_HEADER, - ChmFile: [::CHAR; ::MAX_PATH], - HtmlTroubleShooter: [::CHAR; ::MAX_PATH], -}} -pub type PSP_TROUBLESHOOTER_PARAMS_A = *mut SP_TROUBLESHOOTER_PARAMS_A; -STRUCT!{nodebug struct SP_TROUBLESHOOTER_PARAMS_W { - ClassInstallHeader: SP_CLASSINSTALL_HEADER, - ChmFile: [::WCHAR; ::MAX_PATH], - HtmlTroubleShooter: [::WCHAR; ::MAX_PATH], -}} -pub type PSP_TROUBLESHOOTER_PARAMS_W = *mut SP_TROUBLESHOOTER_PARAMS_W; -STRUCT!{nodebug struct SP_POWERMESSAGEWAKE_PARAMS_A { - ClassInstallHeader: SP_CLASSINSTALL_HEADER, - PowerMessageWake: [::CHAR; LINE_LEN * 2], -}} -pub type PSP_POWERMESSAGEWAKE_PARAMS_A = *mut SP_POWERMESSAGEWAKE_PARAMS_A; -STRUCT!{nodebug struct SP_POWERMESSAGEWAKE_PARAMS_W { - ClassInstallHeader: SP_CLASSINSTALL_HEADER, - PowerMessageWake: [::WCHAR; LINE_LEN * 2], -}} -pub type PSP_POWERMESSAGEWAKE_PARAMS_W = *mut SP_POWERMESSAGEWAKE_PARAMS_W; -STRUCT!{nodebug struct SP_DRVINFO_DATA_V2_A { - cbSize: ::DWORD, - DriverType: ::DWORD, - Reserved: ::ULONG_PTR, - Description: [::CHAR; LINE_LEN], - MfgName: [::CHAR; LINE_LEN], - ProviderName: [::CHAR; LINE_LEN], - DriverDate: ::FILETIME, - DriverVersion: ::DWORDLONG, -}} -pub type PSP_DRVINFO_DATA_V2_A = *mut SP_DRVINFO_DATA_V2_A; -STRUCT!{nodebug struct SP_DRVINFO_DATA_V2_W { - cbSize: ::DWORD, - DriverType: ::DWORD, - Reserved: ::ULONG_PTR, - Description: [::WCHAR; LINE_LEN], - MfgName: [::WCHAR; LINE_LEN], - ProviderName: [::WCHAR; LINE_LEN], - DriverDate: ::FILETIME, - DriverVersion: ::DWORDLONG, -}} -pub type PSP_DRVINFO_DATA_V2_W = *mut SP_DRVINFO_DATA_V2_W; -STRUCT!{nodebug struct SP_DRVINFO_DATA_V1_A { - cbSize: ::DWORD, - DriverType: ::DWORD, - Reserved: ::ULONG_PTR, - Description: [::CHAR; LINE_LEN], - MfgName: [::CHAR; LINE_LEN], - ProviderName: [::CHAR; LINE_LEN], -}} -pub type PSP_DRVINFO_DATA_V1_A = *mut SP_DRVINFO_DATA_V1_A; -STRUCT!{nodebug struct SP_DRVINFO_DATA_V1_W { - cbSize: ::DWORD, - DriverType: ::DWORD, - Reserved: ::ULONG_PTR, - Description: [::WCHAR; LINE_LEN], - MfgName: [::WCHAR; LINE_LEN], - ProviderName: [::WCHAR; LINE_LEN], -}} -pub type PSP_DRVINFO_DATA_V1_W = *mut SP_DRVINFO_DATA_V1_W; -pub type SP_DRVINFO_DATA_A = SP_DRVINFO_DATA_V2_A; -pub type PSP_DRVINFO_DATA_A = PSP_DRVINFO_DATA_V2_A; -pub type SP_DRVINFO_DATA_W = SP_DRVINFO_DATA_V2_W; -pub type PSP_DRVINFO_DATA_W = PSP_DRVINFO_DATA_V2_W; -STRUCT!{nodebug struct SP_DRVINFO_DETAIL_DATA_A { - cbSize: ::DWORD, - InfDate: ::FILETIME, - CompatIDsOffset: ::DWORD, - CompatIDsLength: ::DWORD, - Reserved: ::ULONG_PTR, - SectionName: [::CHAR; LINE_LEN], - InfFileName: [::CHAR; ::MAX_PATH], - DrvDescription: [::CHAR; LINE_LEN], - HardwareID: [::CHAR; ::ANYSIZE_ARRAY], -}} -pub type PSP_DRVINFO_DETAIL_DATA_A = *mut SP_DRVINFO_DETAIL_DATA_A; -STRUCT!{nodebug struct SP_DRVINFO_DETAIL_DATA_W { - cbSize: ::DWORD, - InfDate: ::FILETIME, - CompatIDsOffset: ::DWORD, - CompatIDsLength: ::DWORD, - Reserved: ::ULONG_PTR, - SectionName: [::WCHAR; LINE_LEN], - InfFileName: [::WCHAR; ::MAX_PATH], - DrvDescription: [::WCHAR; LINE_LEN], - HardwareID: [::WCHAR; ::ANYSIZE_ARRAY], -}} -pub type PSP_DRVINFO_DETAIL_DATA_W = *mut SP_DRVINFO_DETAIL_DATA_W; -STRUCT!{struct SP_DRVINSTALL_PARAMS { - cbSize: ::DWORD, - Rank: ::DWORD, - Flags: ::DWORD, - PrivateData: ::DWORD_PTR, - Reserved: ::DWORD, -}} -pub type PSP_DRVINSTALL_PARAMS = *mut SP_DRVINSTALL_PARAMS; -pub const DNF_DUPDESC: ::DWORD = 0x00000001; -pub const DNF_OLDDRIVER: ::DWORD = 0x00000002; -pub const DNF_EXCLUDEFROMLIST: ::DWORD = 0x00000004; -pub const DNF_NODRIVER: ::DWORD = 0x00000008; -pub const DNF_LEGACYINF: ::DWORD = 0x00000010; -pub const DNF_CLASS_DRIVER: ::DWORD = 0x00000020; -pub const DNF_COMPATIBLE_DRIVER: ::DWORD = 0x00000040; -pub const DNF_INET_DRIVER: ::DWORD = 0x00000080; -pub const DNF_UNUSED1: ::DWORD = 0x00000100; -pub const DNF_UNUSED2: ::DWORD = 0x00000200; -pub const DNF_OLD_INET_DRIVER: ::DWORD = 0x00000400; -pub const DNF_BAD_DRIVER: ::DWORD = 0x00000800; -pub const DNF_DUPPROVIDER: ::DWORD = 0x00001000; -pub const DNF_INF_IS_SIGNED: ::DWORD = 0x00002000; -pub const DNF_OEM_F6_INF: ::DWORD = 0x00004000; -pub const DNF_DUPDRIVERVER: ::DWORD = 0x00008000; -pub const DNF_BASIC_DRIVER: ::DWORD = 0x00010000; -pub const DNF_AUTHENTICODE_SIGNED: ::DWORD = 0x00020000; -pub const DNF_INSTALLEDDRIVER: ::DWORD = 0x00040000; -pub const DNF_ALWAYSEXCLUDEFROMLIST: ::DWORD = 0x00080000; -pub const DNF_INBOX_DRIVER: ::DWORD = 0x00100000; -pub const DNF_REQUESTADDITIONALSOFTWARE: ::DWORD = 0x00200000; -pub const DNF_UNUSED_22: ::DWORD = 0x00400000; -pub const DNF_UNUSED_23: ::DWORD = 0x00800000; -pub const DNF_UNUSED_24: ::DWORD = 0x01000000; -pub const DNF_UNUSED_25: ::DWORD = 0x02000000; -pub const DNF_UNUSED_26: ::DWORD = 0x04000000; -pub const DNF_UNUSED_27: ::DWORD = 0x08000000; -pub const DNF_UNUSED_28: ::DWORD = 0x10000000; -pub const DNF_UNUSED_29: ::DWORD = 0x20000000; -pub const DNF_UNUSED_30: ::DWORD = 0x40000000; -pub const DNF_UNUSED_31: ::DWORD = 0x80000000; -pub type PSP_DETSIG_CMPPROC = Option ::DWORD>; -STRUCT!{struct COINSTALLER_CONTEXT_DATA { - PostProcessing: ::BOOL, - InstallResult: ::DWORD, - PrivateData: ::PVOID, -}} -pub type PCOINSTALLER_CONTEXT_DATA = *mut COINSTALLER_CONTEXT_DATA; -STRUCT!{struct SP_CLASSIMAGELIST_DATA { - cbSize: ::DWORD, - ImageList: ::HIMAGELIST, - Reserved: ::ULONG_PTR, -}} -pub type PSP_CLASSIMAGELIST_DATA = *mut SP_CLASSIMAGELIST_DATA; -STRUCT!{struct SP_PROPSHEETPAGE_REQUEST { - cbSize: ::DWORD, - PageRequested: ::DWORD, - DeviceInfoSet: HDEVINFO, - DeviceInfoData: PSP_DEVINFO_DATA, -}} -pub type PSP_PROPSHEETPAGE_REQUEST = *mut SP_PROPSHEETPAGE_REQUEST; -pub const SPPSR_SELECT_DEVICE_RESOURCES: ::DWORD = 1; -pub const SPPSR_ENUM_BASIC_DEVICE_PROPERTIES: ::DWORD = 2; -pub const SPPSR_ENUM_ADV_DEVICE_PROPERTIES: ::DWORD = 3; -STRUCT!{nodebug struct SP_BACKUP_QUEUE_PARAMS_V2_A { - cbSize: ::DWORD, - FullInfPath: [::CHAR; ::MAX_PATH], - FilenameOffset: ::INT, - ReinstallInstance: [::CHAR; ::MAX_PATH], -}} -pub type PSP_BACKUP_QUEUE_PARAMS_V2_A = *mut SP_BACKUP_QUEUE_PARAMS_V2_A; -STRUCT!{nodebug struct SP_BACKUP_QUEUE_PARAMS_V2_W { - cbSize: ::DWORD, - FullInfPath: [::WCHAR; ::MAX_PATH], - FilenameOffset: ::INT, - ReinstallInstance: [::WCHAR; ::MAX_PATH], -}} -pub type PSP_BACKUP_QUEUE_PARAMS_V2_W = *mut SP_BACKUP_QUEUE_PARAMS_V2_W; -STRUCT!{nodebug struct SP_BACKUP_QUEUE_PARAMS_V1_A { - cbSize: ::DWORD, - FullInfPath: [::CHAR; ::MAX_PATH], - FilenameOffset: ::INT, -}} -pub type PSP_BACKUP_QUEUE_PARAMS_V1_A = *mut SP_BACKUP_QUEUE_PARAMS_V1_A; -STRUCT!{nodebug struct SP_BACKUP_QUEUE_PARAMS_V1_W { - cbSize: ::DWORD, - FullInfPath: [::WCHAR; ::MAX_PATH], - FilenameOffset: ::INT, -}} -pub type PSP_BACKUP_QUEUE_PARAMS_V1_W = *mut SP_BACKUP_QUEUE_PARAMS_V1_W; -pub type SP_BACKUP_QUEUE_PARAMS_A = SP_BACKUP_QUEUE_PARAMS_V2_A; -pub type PSP_BACKUP_QUEUE_PARAMS_A = PSP_BACKUP_QUEUE_PARAMS_V2_A; -pub type SP_BACKUP_QUEUE_PARAMS_W = SP_BACKUP_QUEUE_PARAMS_V2_W; -pub type PSP_BACKUP_QUEUE_PARAMS_W = PSP_BACKUP_QUEUE_PARAMS_V2_W; -pub const ERROR_EXPECTED_SECTION_NAME: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0; -pub const ERROR_BAD_SECTION_NAME_LINE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 1; -pub const ERROR_SECTION_NAME_TOO_LONG: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 2; -pub const ERROR_GENERAL_SYNTAX: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 3; -pub const ERROR_WRONG_INF_STYLE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x100; -pub const ERROR_SECTION_NOT_FOUND: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x101; -pub const ERROR_LINE_NOT_FOUND: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x102; -pub const ERROR_NO_BACKUP: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x103; -pub const ERROR_NO_ASSOCIATED_CLASS: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x200; -pub const ERROR_CLASS_MISMATCH: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x201; -pub const ERROR_DUPLICATE_FOUND: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x202; -pub const ERROR_NO_DRIVER_SELECTED: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x203; -pub const ERROR_KEY_DOES_NOT_EXIST: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x204; -pub const ERROR_INVALID_DEVINST_NAME: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x205; -pub const ERROR_INVALID_CLASS: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x206; -pub const ERROR_DEVINST_ALREADY_EXISTS: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x207; -pub const ERROR_DEVINFO_NOT_REGISTERED: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x208; -pub const ERROR_INVALID_REG_PROPERTY: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x209; -pub const ERROR_NO_INF: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x20A; -pub const ERROR_NO_SUCH_DEVINST: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x20B; -pub const ERROR_CANT_LOAD_CLASS_ICON: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x20C; -pub const ERROR_INVALID_CLASS_INSTALLER: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x20D; -pub const ERROR_DI_DO_DEFAULT: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x20E; -pub const ERROR_DI_NOFILECOPY: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x20F; -pub const ERROR_INVALID_HWPROFILE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x210; -pub const ERROR_NO_DEVICE_SELECTED: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x211; -pub const ERROR_DEVINFO_LIST_LOCKED: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x212; -pub const ERROR_DEVINFO_DATA_LOCKED: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x213; -pub const ERROR_DI_BAD_PATH: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x214; -pub const ERROR_NO_CLASSINSTALL_PARAMS: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x215; -pub const ERROR_FILEQUEUE_LOCKED: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x216; -pub const ERROR_BAD_SERVICE_INSTALLSECT: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x217; -pub const ERROR_NO_CLASS_DRIVER_LIST: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x218; -pub const ERROR_NO_ASSOCIATED_SERVICE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x219; -pub const ERROR_NO_DEFAULT_DEVICE_INTERFACE: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x21A; -pub const ERROR_DEVICE_INTERFACE_ACTIVE: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x21B; -pub const ERROR_DEVICE_INTERFACE_REMOVED: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x21C; -pub const ERROR_BAD_INTERFACE_INSTALLSECT: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x21D; -pub const ERROR_NO_SUCH_INTERFACE_CLASS: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x21E; -pub const ERROR_INVALID_REFERENCE_STRING: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x21F; -pub const ERROR_INVALID_MACHINENAME: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x220; -pub const ERROR_REMOTE_COMM_FAILURE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x221; -pub const ERROR_MACHINE_UNAVAILABLE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x222; -pub const ERROR_NO_CONFIGMGR_SERVICES: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x223; -pub const ERROR_INVALID_PROPPAGE_PROVIDER: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x224; -pub const ERROR_NO_SUCH_DEVICE_INTERFACE: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x225; -pub const ERROR_DI_POSTPROCESSING_REQUIRED: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x226; -pub const ERROR_INVALID_COINSTALLER: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x227; -pub const ERROR_NO_COMPAT_DRIVERS: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x228; -pub const ERROR_NO_DEVICE_ICON: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x229; -pub const ERROR_INVALID_INF_LOGCONFIG: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x22A; -pub const ERROR_DI_DONT_INSTALL: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x22B; -pub const ERROR_INVALID_FILTER_DRIVER: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x22C; -pub const ERROR_NON_WINDOWS_NT_DRIVER: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x22D; -pub const ERROR_NON_WINDOWS_DRIVER: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x22E; -pub const ERROR_NO_CATALOG_FOR_OEM_INF: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x22F; -pub const ERROR_DEVINSTALL_QUEUE_NONNATIVE: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x230; -pub const ERROR_NOT_DISABLEABLE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x231; -pub const ERROR_CANT_REMOVE_DEVINST: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x232; -pub const ERROR_INVALID_TARGET: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x233; -pub const ERROR_DRIVER_NONNATIVE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x234; -pub const ERROR_IN_WOW64: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x235; -pub const ERROR_SET_SYSTEM_RESTORE_POINT: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x236; -pub const ERROR_SCE_DISABLED: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR | 0x238; -pub const ERROR_UNKNOWN_EXCEPTION: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x239; -pub const ERROR_PNP_REGISTRY_ERROR: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x23A; -pub const ERROR_REMOTE_REQUEST_UNSUPPORTED: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x23B; -pub const ERROR_NOT_AN_INSTALLED_OEM_INF: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x23C; -pub const ERROR_INF_IN_USE_BY_DEVICES: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x23D; -pub const ERROR_DI_FUNCTION_OBSOLETE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x23E; -pub const ERROR_NO_AUTHENTICODE_CATALOG: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x23F; -pub const ERROR_AUTHENTICODE_DISALLOWED: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x240; -pub const ERROR_AUTHENTICODE_TRUSTED_PUBLISHER: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x241; -pub const ERROR_AUTHENTICODE_TRUST_NOT_ESTABLISHED: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x242; -pub const ERROR_AUTHENTICODE_PUBLISHER_NOT_TRUSTED: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x243; -pub const ERROR_SIGNATURE_OSATTRIBUTE_MISMATCH: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x244; -pub const ERROR_ONLY_VALIDATE_VIA_AUTHENTICODE: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x245; -pub const ERROR_DEVICE_INSTALLER_NOT_READY: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x246; -pub const ERROR_DRIVER_STORE_ADD_FAILED: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x247; -pub const ERROR_DEVICE_INSTALL_BLOCKED: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x248; -pub const ERROR_DRIVER_INSTALL_BLOCKED: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x249; -pub const ERROR_WRONG_INF_TYPE: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x24A; -pub const ERROR_FILE_HASH_NOT_IN_CATALOG: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x24B; -pub const ERROR_DRIVER_STORE_DELETE_FAILED: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x24C; -pub const ERROR_UNRECOVERABLE_STACK_OVERFLOW: ::DWORD = ::APPLICATION_ERROR_MASK - | ::ERROR_SEVERITY_ERROR | 0x300; -pub const EXCEPTION_SPAPI_UNRECOVERABLE_STACK_OVERFLOW: ::DWORD = - ERROR_UNRECOVERABLE_STACK_OVERFLOW; -pub const ERROR_NO_DEFAULT_INTERFACE_DEVICE: ::DWORD = ERROR_NO_DEFAULT_DEVICE_INTERFACE; -pub const ERROR_INTERFACE_DEVICE_ACTIVE: ::DWORD = ERROR_DEVICE_INTERFACE_ACTIVE; -pub const ERROR_INTERFACE_DEVICE_REMOVED: ::DWORD = ERROR_DEVICE_INTERFACE_REMOVED; -pub const ERROR_NO_SUCH_INTERFACE_DEVICE: ::DWORD = ERROR_NO_SUCH_DEVICE_INTERFACE; -pub const ERROR_NOT_INSTALLED: ::DWORD = ::APPLICATION_ERROR_MASK | ::ERROR_SEVERITY_ERROR - | 0x1000; -pub const INFINFO_INF_SPEC_IS_HINF: ::DWORD = 1; -pub const INFINFO_INF_NAME_IS_ABSOLUTE: ::DWORD = 2; -pub const INFINFO_DEFAULT_SEARCH: ::DWORD = 3; -pub const INFINFO_REVERSE_DEFAULT_SEARCH: ::DWORD = 4; -pub const INFINFO_INF_PATH_LIST_SEARCH: ::DWORD = 5; -pub const FILE_COMPRESSION_NONE: ::UINT = 0; -pub const FILE_COMPRESSION_WINLZA: ::UINT = 1; -pub const FILE_COMPRESSION_MSZIP: ::UINT = 2; -pub const FILE_COMPRESSION_NTCAB: ::UINT = 3; -pub const SRCLIST_TEMPORARY: ::DWORD = 0x00000001; -pub const SRCLIST_NOBROWSE: ::DWORD = 0x00000002; -pub const SRCLIST_SYSTEM: ::DWORD = 0x00000010; -pub const SRCLIST_USER: ::DWORD = 0x00000020; -pub const SRCLIST_SYSIFADMIN: ::DWORD = 0x00000040; -pub const SRCLIST_SUBDIRS: ::DWORD = 0x00000100; -pub const SRCLIST_APPEND: ::DWORD = 0x00000200; -pub const SRCLIST_NOSTRIPPLATFORM: ::DWORD = 0x00000400; -pub const IDF_NOBROWSE: ::DWORD = 0x00000001; -pub const IDF_NOSKIP: ::DWORD = 0x00000002; -pub const IDF_NODETAILS: ::DWORD = 0x00000004; -pub const IDF_NOCOMPRESSED: ::DWORD = 0x00000008; -pub const IDF_CHECKFIRST: ::DWORD = 0x00000100; -pub const IDF_NOBEEP: ::DWORD = 0x00000200; -pub const IDF_NOFOREGROUND: ::DWORD = 0x00000400; -pub const IDF_WARNIFSKIP: ::DWORD = 0x00000800; -pub const IDF_NOREMOVABLEMEDIAPROMPT: ::DWORD = 0x00001000; -pub const IDF_USEDISKNAMEASPROMPT: ::DWORD = 0x00002000; -pub const IDF_OEMDISK: ::DWORD = 0x80000000; -pub const DPROMPT_SUCCESS: ::UINT = 0; -pub const DPROMPT_CANCEL: ::UINT = 1; -pub const DPROMPT_SKIPFILE: ::UINT = 2; -pub const DPROMPT_BUFFERTOOSMALL: ::UINT = 3; -pub const DPROMPT_OUTOFMEMORY: ::UINT = 4; -pub const SETDIRID_NOT_FULL_PATH: ::DWORD = 0x00000001; -pub const SRCINFO_PATH: ::UINT = 1; -pub const SRCINFO_TAGFILE: ::UINT = 2; -pub const SRCINFO_DESCRIPTION: ::UINT = 3; -pub const SRCINFO_FLAGS: ::UINT = 4; -pub const SRCINFO_TAGFILE2: ::UINT = 4; -pub const SRC_FLAGS_CABFILE: ::UINT = 0x0010; -pub const SP_COPY_DELETESOURCE: ::DWORD = 0x0000001; -pub const SP_COPY_REPLACEONLY: ::DWORD = 0x0000002; -pub const SP_COPY_NEWER: ::DWORD = 0x0000004; -pub const SP_COPY_NEWER_OR_SAME: ::DWORD = SP_COPY_NEWER; -pub const SP_COPY_NOOVERWRITE: ::DWORD = 0x0000008; -pub const SP_COPY_NODECOMP: ::DWORD = 0x0000010; -pub const SP_COPY_LANGUAGEAWARE: ::DWORD = 0x0000020; -pub const SP_COPY_SOURCE_ABSOLUTE: ::DWORD = 0x0000040; -pub const SP_COPY_SOURCEPATH_ABSOLUTE: ::DWORD = 0x0000080; -pub const SP_COPY_IN_USE_NEEDS_REBOOT: ::DWORD = 0x0000100; -pub const SP_COPY_FORCE_IN_USE: ::DWORD = 0x0000200; -pub const SP_COPY_NOSKIP: ::DWORD = 0x0000400; -pub const SP_FLAG_CABINETCONTINUATION: ::DWORD = 0x0000800; -pub const SP_COPY_FORCE_NOOVERWRITE: ::DWORD = 0x0001000; -pub const SP_COPY_FORCE_NEWER: ::DWORD = 0x0002000; -pub const SP_COPY_WARNIFSKIP: ::DWORD = 0x0004000; -pub const SP_COPY_NOBROWSE: ::DWORD = 0x0008000; -pub const SP_COPY_NEWER_ONLY: ::DWORD = 0x0010000; -pub const SP_COPY_RESERVED: ::DWORD = 0x0020000; -pub const SP_COPY_OEMINF_CATALOG_ONLY: ::DWORD = 0x0040000; -pub const SP_COPY_REPLACE_BOOT_FILE: ::DWORD = 0x0080000; -pub const SP_COPY_NOPRUNE: ::DWORD = 0x0100000; -pub const SP_COPY_OEM_F6_INF: ::DWORD = 0x0200000; -pub const SP_COPY_ALREADYDECOMP: ::DWORD = 0x0400000; -pub const SP_COPY_WINDOWS_SIGNED: ::DWORD = 0x1000000; -pub const SP_COPY_PNPLOCKED: ::DWORD = 0x2000000; -pub const SP_COPY_IN_USE_TRY_RENAME: ::DWORD = 0x4000000; -pub const SP_COPY_INBOX_INF: ::DWORD = 0x8000000; -pub const SP_COPY_HARDLINK: ::DWORD = 0x10000000; -pub const SP_BACKUP_BACKUPPASS: ::DWORD = 0x00000001; -pub const SP_BACKUP_DEMANDPASS: ::DWORD = 0x00000002; -pub const SP_BACKUP_SPECIAL: ::DWORD = 0x00000004; -pub const SP_BACKUP_BOOTFILE: ::DWORD = 0x00000008; -pub const SPQ_SCAN_FILE_PRESENCE: ::DWORD = 0x00000001; -pub const SPQ_SCAN_FILE_VALIDITY: ::DWORD = 0x00000002; -pub const SPQ_SCAN_USE_CALLBACK: ::DWORD = 0x00000004; -pub const SPQ_SCAN_USE_CALLBACKEX: ::DWORD = 0x00000008; -pub const SPQ_SCAN_INFORM_USER: ::DWORD = 0x00000010; -pub const SPQ_SCAN_PRUNE_COPY_QUEUE: ::DWORD = 0x00000020; -pub const SPQ_SCAN_USE_CALLBACK_SIGNERINFO: ::DWORD = 0x00000040; -pub const SPQ_SCAN_PRUNE_DELREN: ::DWORD = 0x00000080; -pub const SPQ_SCAN_FILE_PRESENCE_WITHOUT_SOURCE: ::DWORD = 0x00000100; -pub const SPQ_SCAN_FILE_COMPARISON: ::DWORD = 0x00000200; -pub const SPQ_SCAN_ACTIVATE_DRP: ::DWORD = 0x00000400; -pub const SPQ_DELAYED_COPY: ::DWORD = 0x00000001; -pub const SPQ_FLAG_BACKUP_AWARE: ::DWORD = 0x00000001; -pub const SPQ_FLAG_ABORT_IF_UNSIGNED: ::DWORD = 0x00000002; -pub const SPQ_FLAG_FILES_MODIFIED: ::DWORD = 0x00000004; -pub const SPQ_FLAG_DO_SHUFFLEMOVE: ::DWORD = 0x00000008; -pub const SPQ_FLAG_VALID: ::DWORD = 0x0000000F; -pub const SPOST_NONE: ::DWORD = 0; -pub const SPOST_PATH: ::DWORD = 1; -pub const SPOST_URL: ::DWORD = 2; -pub const SPOST_MAX: ::DWORD = 3; -pub const SUOI_FORCEDELETE: ::DWORD = 0x00000001; -pub const SUOI_INTERNAL1: ::DWORD = 0x00000002; -pub const SPDSL_IGNORE_DISK: ::UINT = 0x00000001; -pub const SPDSL_DISALLOW_NEGATIVE_ADJUST: ::UINT = 0x00000002; -pub const SPFILEQ_FILE_IN_USE: ::INT = 0x00000001; -pub const SPFILEQ_REBOOT_RECOMMENDED: ::INT = 0x00000002; -pub const SPFILEQ_REBOOT_IN_PROGRESS: ::INT = 0x00000004; -pub const FLG_ADDREG_DELREG_BIT: ::DWORD = 0x00008000; -pub const FLG_ADDREG_BINVALUETYPE: ::DWORD = 0x00000001; -pub const FLG_ADDREG_NOCLOBBER: ::DWORD = 0x00000002; -pub const FLG_ADDREG_DELVAL: ::DWORD = 0x00000004; -pub const FLG_ADDREG_APPEND: ::DWORD = 0x00000008; -pub const FLG_ADDREG_KEYONLY: ::DWORD = 0x00000010; -pub const FLG_ADDREG_OVERWRITEONLY: ::DWORD = 0x00000020; -pub const FLG_ADDREG_64BITKEY: ::DWORD = 0x00001000; -pub const FLG_ADDREG_KEYONLY_COMMON: ::DWORD = 0x00002000; -pub const FLG_ADDREG_32BITKEY: ::DWORD = 0x00004000; -pub const FLG_ADDREG_TYPE_MASK: ::DWORD = 0xFFFF0000 | FLG_ADDREG_BINVALUETYPE; -pub const FLG_ADDREG_TYPE_SZ: ::DWORD = 0x00000000; -pub const FLG_ADDREG_TYPE_MULTI_SZ: ::DWORD = 0x00010000; -pub const FLG_ADDREG_TYPE_EXPAND_SZ: ::DWORD = 0x00020000; -pub const FLG_ADDREG_TYPE_BINARY: ::DWORD = 0x00000000 | FLG_ADDREG_BINVALUETYPE; -pub const FLG_ADDREG_TYPE_DWORD: ::DWORD = 0x00010000 | FLG_ADDREG_BINVALUETYPE; -pub const FLG_ADDREG_TYPE_NONE: ::DWORD = 0x00020000 | FLG_ADDREG_BINVALUETYPE; -pub const FLG_DELREG_VALUE: ::DWORD = 0x00000000; -pub const FLG_DELREG_TYPE_MASK: ::DWORD = FLG_ADDREG_TYPE_MASK; -pub const FLG_DELREG_TYPE_SZ: ::DWORD = FLG_ADDREG_TYPE_SZ; -pub const FLG_DELREG_TYPE_MULTI_SZ: ::DWORD = FLG_ADDREG_TYPE_MULTI_SZ; -pub const FLG_DELREG_TYPE_EXPAND_SZ: ::DWORD = FLG_ADDREG_TYPE_EXPAND_SZ; -pub const FLG_DELREG_TYPE_BINARY: ::DWORD = FLG_ADDREG_TYPE_BINARY; -pub const FLG_DELREG_TYPE_DWORD: ::DWORD = FLG_ADDREG_TYPE_DWORD; -pub const FLG_DELREG_TYPE_NONE: ::DWORD = FLG_ADDREG_TYPE_NONE; -pub const FLG_DELREG_64BITKEY: ::DWORD = FLG_ADDREG_64BITKEY; -pub const FLG_DELREG_KEYONLY_COMMON: ::DWORD = FLG_ADDREG_KEYONLY_COMMON; -pub const FLG_DELREG_32BITKEY: ::DWORD = FLG_ADDREG_32BITKEY; -pub const FLG_DELREG_OPERATION_MASK: ::DWORD = 0x000000FE; -pub const FLG_DELREG_MULTI_SZ_DELSTRING: ::DWORD = FLG_DELREG_TYPE_MULTI_SZ | FLG_ADDREG_DELREG_BIT - | 0x00000002; -pub const FLG_BITREG_CLEARBITS: ::DWORD = 0x00000000; -pub const FLG_BITREG_SETBITS: ::DWORD = 0x00000001; -pub const FLG_BITREG_64BITKEY: ::DWORD = 0x00001000; -pub const FLG_BITREG_32BITKEY: ::DWORD = 0x00004000; -pub const FLG_INI2REG_64BITKEY: ::DWORD = 0x00001000; -pub const FLG_INI2REG_32BITKEY: ::DWORD = 0x00004000; -pub const FLG_REGSVR_DLLREGISTER: ::DWORD = 0x00000001; -pub const FLG_REGSVR_DLLINSTALL: ::DWORD = 0x00000002; -pub const FLG_PROFITEM_CURRENTUSER: ::DWORD = 0x00000001; -pub const FLG_PROFITEM_DELETE: ::DWORD = 0x00000002; -pub const FLG_PROFITEM_GROUP: ::DWORD = 0x00000004; -pub const FLG_PROFITEM_CSIDL: ::DWORD = 0x00000008; -pub const FLG_ADDPROPERTY_NOCLOBBER: ::DWORD = 0x00000001; -pub const FLG_ADDPROPERTY_OVERWRITEONLY: ::DWORD = 0x00000002; -pub const FLG_ADDPROPERTY_APPEND: ::DWORD = 0x00000004; -pub const FLG_ADDPROPERTY_OR: ::DWORD = 0x00000008; -pub const FLG_ADDPROPERTY_AND: ::DWORD = 0x00000010; -pub const FLG_DELPROPERTY_MULTI_SZ_DELSTRING: ::DWORD = 0x00000001; -pub const SPINST_LOGCONFIG: ::UINT = 0x00000001; -pub const SPINST_INIFILES: ::UINT = 0x00000002; -pub const SPINST_REGISTRY: ::UINT = 0x00000004; -pub const SPINST_INI2REG: ::UINT = 0x00000008; -pub const SPINST_FILES: ::UINT = 0x00000010; -pub const SPINST_BITREG: ::UINT = 0x00000020; -pub const SPINST_REGSVR: ::UINT = 0x00000040; -pub const SPINST_UNREGSVR: ::UINT = 0x00000080; -pub const SPINST_PROFILEITEMS: ::UINT = 0x00000100; -pub const SPINST_COPYINF: ::UINT = 0x00000200; -pub const SPINST_PROPERTIES: ::UINT = 0x00000400; -pub const SPINST_ALL: ::UINT = 0x000007ff; -pub const SPINST_SINGLESECTION: ::UINT = 0x00010000; -pub const SPINST_LOGCONFIG_IS_FORCED: ::UINT = 0x00020000; -pub const SPINST_LOGCONFIGS_ARE_OVERRIDES: ::UINT = 0x00040000; -pub const SPINST_REGISTERCALLBACKAWARE: ::UINT = 0x00080000; -pub const SPINST_DEVICEINSTALL: ::UINT = 0x00100000; -pub const SPSVCINST_TAGTOFRONT: ::DWORD = 0x00000001; -pub const SPSVCINST_ASSOCSERVICE: ::DWORD = 0x00000002; -pub const SPSVCINST_DELETEEVENTLOGENTRY: ::DWORD = 0x00000004; -pub const SPSVCINST_NOCLOBBER_DISPLAYNAME: ::DWORD = 0x00000008; -pub const SPSVCINST_NOCLOBBER_STARTTYPE: ::DWORD = 0x00000010; -pub const SPSVCINST_NOCLOBBER_ERRORCONTROL: ::DWORD = 0x00000020; -pub const SPSVCINST_NOCLOBBER_LOADORDERGROUP: ::DWORD = 0x00000040; -pub const SPSVCINST_NOCLOBBER_DEPENDENCIES: ::DWORD = 0x00000080; -pub const SPSVCINST_NOCLOBBER_DESCRIPTION: ::DWORD = 0x00000100; -pub const SPSVCINST_STOPSERVICE: ::DWORD = 0x00000200; -pub const SPSVCINST_CLOBBER_SECURITY: ::DWORD = 0x00000400; -pub const SPSVCINST_STARTSERVICE: ::DWORD = 0x00000800; -pub const SPSVCINST_NOCLOBBER_REQUIREDPRIVILEGES: ::DWORD = 0x00001000; -pub type HSPFILELOG = ::PVOID; -pub const SPFILELOG_SYSTEMLOG: ::DWORD = 0x00000001; -pub const SPFILELOG_FORCENEW: ::DWORD = 0x00000002; -pub const SPFILELOG_QUERYONLY: ::DWORD = 0x00000004; -pub const SPFILELOG_OEMFILE: ::DWORD = 0x00000001; -ENUM!{enum SetupFileLogInfo { - SetupFileLogSourceFilename, - SetupFileLogChecksum, - SetupFileLogDiskTagfile, - SetupFileLogDiskDescription, - SetupFileLogOtherInfo, - SetupFileLogMax, -}} -pub type LogSeverity = ::DWORD; -pub const LogSevInformation: LogSeverity = 0x00000000; -pub const LogSevWarning: LogSeverity = 0x00000001; -pub const LogSevError: LogSeverity = 0x00000002; -pub const LogSevFatalError: LogSeverity = 0x00000003; -pub const LogSevMaximum: LogSeverity = 0x00000004; -pub const DICD_GENERATE_ID: ::DWORD = 0x00000001; -pub const DICD_INHERIT_CLASSDRVS: ::DWORD = 0x00000002; -pub const DIOD_INHERIT_CLASSDRVS: ::DWORD = 0x00000002; -pub const DIOD_CANCEL_REMOVE: ::DWORD = 0x00000004; -pub const DIODI_NO_ADD: ::DWORD = 0x00000001; -pub const SPRDI_FIND_DUPS: ::DWORD = 0x00000001; -pub const SPDIT_NODRIVER: ::DWORD = 0x00000000; -pub const SPDIT_CLASSDRIVER: ::DWORD = 0x00000001; -pub const SPDIT_COMPATDRIVER: ::DWORD = 0x00000002; -pub const DIGCF_DEFAULT: ::DWORD = 0x00000001; -pub const DIGCF_PRESENT: ::DWORD = 0x00000002; -pub const DIGCF_ALLCLASSES: ::DWORD = 0x00000004; -pub const DIGCF_PROFILE: ::DWORD = 0x00000008; -pub const DIGCF_DEVICEINTERFACE: ::DWORD = 0x00000010; -pub const DIBCI_NOINSTALLCLASS: ::DWORD = 0x00000001; -pub const DIBCI_NODISPLAYCLASS: ::DWORD = 0x00000002; -pub const DIOCR_INSTALLER: ::DWORD = 0x00000001; -pub const DIOCR_INTERFACE: ::DWORD = 0x00000002; -pub const DIREG_DEV: ::DWORD = 0x00000001; -pub const DIREG_DRV: ::DWORD = 0x00000002; -pub const DIREG_BOTH: ::DWORD = 0x00000004; -pub const DICLASSPROP_INSTALLER: ::DWORD = 0x00000001; -pub const DICLASSPROP_INTERFACE: ::DWORD = 0x00000002; -pub const SPDRP_DEVICEDESC: ::DWORD = 0x00000000; -pub const SPDRP_HARDWAREID: ::DWORD = 0x00000001; -pub const SPDRP_COMPATIBLEIDS: ::DWORD = 0x00000002; -pub const SPDRP_UNUSED0: ::DWORD = 0x00000003; -pub const SPDRP_SERVICE: ::DWORD = 0x00000004; -pub const SPDRP_UNUSED1: ::DWORD = 0x00000005; -pub const SPDRP_UNUSED2: ::DWORD = 0x00000006; -pub const SPDRP_CLASS: ::DWORD = 0x00000007; -pub const SPDRP_CLASSGUID: ::DWORD = 0x00000008; -pub const SPDRP_DRIVER: ::DWORD = 0x00000009; -pub const SPDRP_CONFIGFLAGS: ::DWORD = 0x0000000A; -pub const SPDRP_MFG: ::DWORD = 0x0000000B; -pub const SPDRP_FRIENDLYNAME: ::DWORD = 0x0000000C; -pub const SPDRP_LOCATION_INFORMATION: ::DWORD = 0x0000000D; -pub const SPDRP_PHYSICAL_DEVICE_OBJECT_NAME: ::DWORD = 0x0000000E; -pub const SPDRP_CAPABILITIES: ::DWORD = 0x0000000F; -pub const SPDRP_UI_NUMBER: ::DWORD = 0x00000010; -pub const SPDRP_UPPERFILTERS: ::DWORD = 0x00000011; -pub const SPDRP_LOWERFILTERS: ::DWORD = 0x00000012; -pub const SPDRP_BUSTYPEGUID: ::DWORD = 0x00000013; -pub const SPDRP_LEGACYBUSTYPE: ::DWORD = 0x00000014; -pub const SPDRP_BUSNUMBER: ::DWORD = 0x00000015; -pub const SPDRP_ENUMERATOR_NAME: ::DWORD = 0x00000016; -pub const SPDRP_SECURITY: ::DWORD = 0x00000017; -pub const SPDRP_SECURITY_SDS: ::DWORD = 0x00000018; -pub const SPDRP_DEVTYPE: ::DWORD = 0x00000019; -pub const SPDRP_EXCLUSIVE: ::DWORD = 0x0000001A; -pub const SPDRP_CHARACTERISTICS: ::DWORD = 0x0000001B; -pub const SPDRP_ADDRESS: ::DWORD = 0x0000001C; -pub const SPDRP_UI_NUMBER_DESC_FORMAT: ::DWORD = 0x0000001D; -pub const SPDRP_DEVICE_POWER_DATA: ::DWORD = 0x0000001E; -pub const SPDRP_REMOVAL_POLICY: ::DWORD = 0x0000001F; -pub const SPDRP_REMOVAL_POLICY_HW_DEFAULT: ::DWORD = 0x00000020; -pub const SPDRP_REMOVAL_POLICY_OVERRIDE: ::DWORD = 0x00000021; -pub const SPDRP_INSTALL_STATE: ::DWORD = 0x00000022; -pub const SPDRP_LOCATION_PATHS: ::DWORD = 0x00000023; -pub const SPDRP_BASE_CONTAINERID: ::DWORD = 0x00000024; -pub const SPDRP_MAXIMUM_PROPERTY: ::DWORD = 0x00000025; -pub const SPCRP_UPPERFILTERS: ::DWORD = 0x00000011; -pub const SPCRP_LOWERFILTERS: ::DWORD = 0x00000012; -pub const SPCRP_SECURITY: ::DWORD = 0x00000017; -pub const SPCRP_SECURITY_SDS: ::DWORD = 0x00000018; -pub const SPCRP_DEVTYPE: ::DWORD = 0x00000019; -pub const SPCRP_EXCLUSIVE: ::DWORD = 0x0000001A; -pub const SPCRP_CHARACTERISTICS: ::DWORD = 0x0000001B; -pub const SPCRP_MAXIMUM_PROPERTY: ::DWORD = 0x0000001C; -pub const DMI_MASK: ::DWORD = 0x00000001; -pub const DMI_BKCOLOR: ::DWORD = 0x00000002; -pub const DMI_USERECT: ::DWORD = 0x00000004; -pub const DIGCDP_FLAG_BASIC: ::DWORD = 0x00000001; -pub const DIGCDP_FLAG_ADVANCED: ::DWORD = 0x00000002; -pub const DIGCDP_FLAG_REMOTE_BASIC: ::DWORD = 0x00000003; -pub const DIGCDP_FLAG_REMOTE_ADVANCED: ::DWORD = 0x00000004; -pub const IDI_RESOURCEFIRST: ::c_int = 159; -pub const IDI_RESOURCE: ::c_int = 159; -pub const IDI_RESOURCELAST: ::c_int = 161; -pub const IDI_RESOURCEOVERLAYFIRST: ::c_int = 161; -pub const IDI_RESOURCEOVERLAYLAST: ::c_int = 161; -pub const IDI_CONFLICT: ::c_int = 161; -pub const IDI_CLASSICON_OVERLAYFIRST: ::c_int = 500; -pub const IDI_CLASSICON_OVERLAYLAST: ::c_int = 502; -pub const IDI_PROBLEM_OVL: ::c_int = 500; -pub const IDI_DISABLED_OVL: ::c_int = 501; -pub const IDI_FORCED_OVL: ::c_int = 502; -pub const SPWPT_SELECTDEVICE: ::DWORD = 0x00000001; -pub const SPWP_USE_DEVINFO_DATA: ::DWORD = 0x00000001; -STRUCT!{nodebug struct SP_INF_SIGNER_INFO_V1_A { - cbSize: ::DWORD, - CatalogFile: [::CHAR; ::MAX_PATH], - DigitalSigner: [::CHAR; ::MAX_PATH], - DigitalSignerVersion: [::CHAR; ::MAX_PATH], -}} -pub type PSP_INF_SIGNER_INFO_V1_A = *mut SP_INF_SIGNER_INFO_V1_A; -STRUCT!{nodebug struct SP_INF_SIGNER_INFO_V1_W { - cbSize: ::DWORD, - CatalogFile: [::WCHAR; ::MAX_PATH], - DigitalSigner: [::WCHAR; ::MAX_PATH], - DigitalSignerVersion: [::WCHAR; ::MAX_PATH], -}} -pub type PSP_INF_SIGNER_INFO_V1_W = *mut SP_INF_SIGNER_INFO_V1_W; -STRUCT!{nodebug struct SP_INF_SIGNER_INFO_V2_A { - cbSize: ::DWORD, - CatalogFile: [::CHAR; ::MAX_PATH], - DigitalSigner: [::CHAR; ::MAX_PATH], - DigitalSignerVersion: [::CHAR; ::MAX_PATH], - SignerScore: ::DWORD, -}} -pub type PSP_INF_SIGNER_INFO_V2_A = *mut SP_INF_SIGNER_INFO_V2_A; -STRUCT!{nodebug struct SP_INF_SIGNER_INFO_V2_W { - cbSize: ::DWORD, - CatalogFile: [::WCHAR; ::MAX_PATH], - DigitalSigner: [::WCHAR; ::MAX_PATH], - DigitalSignerVersion: [::WCHAR; ::MAX_PATH], - SignerScore: ::DWORD, -}} -pub type PSP_INF_SIGNER_INFO_V2_W = *mut SP_INF_SIGNER_INFO_V2_W; -pub type SP_INF_SIGNER_INFO_A = SP_INF_SIGNER_INFO_V2_A; -pub type PSP_INF_SIGNER_INFO_A = PSP_INF_SIGNER_INFO_V2_A; -pub type SP_INF_SIGNER_INFO_W = SP_INF_SIGNER_INFO_V2_W; -pub type PSP_INF_SIGNER_INFO_W = PSP_INF_SIGNER_INFO_V2_W; -pub const SIGNERSCORE_UNKNOWN: ::DWORD = 0xFF000000; -pub const SIGNERSCORE_W9X_SUSPECT: ::DWORD = 0xC0000000; -pub const SIGNERSCORE_UNSIGNED: ::DWORD = 0x80000000; -pub const SIGNERSCORE_AUTHENTICODE: ::DWORD = 0x0F000000; -pub const SIGNERSCORE_WHQL: ::DWORD = 0x0D000005; -pub const SIGNERSCORE_UNCLASSIFIED: ::DWORD = 0x0D000004; -pub const SIGNERSCORE_INBOX: ::DWORD = 0x0D000003; -pub const SIGNERSCORE_LOGO_STANDARD: ::DWORD = 0x0D000002; -pub const SIGNERSCORE_LOGO_PREMIUM: ::DWORD = 0x0D000001; -pub const SIGNERSCORE_MASK: ::DWORD = 0xFF000000; -pub const SIGNERSCORE_SIGNED_MASK: ::DWORD = 0xF0000000; -pub const DICUSTOMDEVPROP_MERGE_MULTISZ: ::DWORD = 0x00000001; -pub const SCWMI_CLOBBER_SECURITY: ::DWORD = 0x00000001; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/shellapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/shellapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/shellapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/shellapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -// STUB -DECLARE_HANDLE!(HDROP, HDROP__); - -pub const NIM_ADD: ::DWORD = 0x00000000; -pub const NIM_MODIFY: ::DWORD = 0x00000001; -pub const NIM_DELETE: ::DWORD = 0x00000002; -pub const NIM_SETFOCUS: ::DWORD = 0x00000003; -pub const NIM_SETVERSION: ::DWORD = 0x00000004; -pub const NIF_MESSAGE: ::UINT = 0x00000001; -pub const NIF_ICON: ::UINT = 0x00000002; -pub const NIF_TIP: ::UINT = 0x00000004; -pub const NIF_STATE: ::UINT = 0x00000008; -pub const NIF_INFO: ::UINT = 0x00000010; -pub const NIF_GUID: ::UINT = 0x00000020; -pub const NIF_REALTIME: ::UINT = 0x00000040; -pub const NIF_SHOWTIP: ::UINT = 0x00000080; -pub const NOTIFYICON_VERSION: ::UINT = 3; -pub const NOTIFYICON_VERSION_4: ::UINT = 4; - -STRUCT!{nodebug struct NOTIFYICONDATAA { - cbSize: ::DWORD, - hWnd: ::HWND, - uID: ::UINT, - uFlags: ::UINT, - uCallbackMessage: ::UINT, - hIcon: ::HICON, - szTip: [::CHAR; 128], - dwState: ::DWORD, - dwStateMask: ::DWORD, - szInfo: [::CHAR; 256], - uTimeout: ::UINT, - szInfoTitle: [::CHAR; 64], - dwInfoFlags: ::DWORD, - guidItem: ::GUID, - hBalloonIcon: ::HICON, -}} -UNION!(NOTIFYICONDATAA, uTimeout, uTimeout, uTimeout_mut, ::UINT); -UNION!(NOTIFYICONDATAA, uTimeout, uVersion, uVersion_mut, ::UINT); -pub type PNOTIFYICONDATAA = *mut NOTIFYICONDATAA; - -STRUCT!{nodebug struct NOTIFYICONDATAW { - cbSize: ::DWORD, - hWnd: ::HWND, - uID: ::UINT, - uFlags: ::UINT, - uCallbackMessage: ::UINT, - hIcon: ::HICON, - szTip: [::WCHAR; 128], - dwState: ::DWORD, - dwStateMask: ::DWORD, - szInfo: [::WCHAR; 256], - uTimeout: ::UINT, - szInfoTitle: [::WCHAR; 64], - dwInfoFlags: ::DWORD, - guidItem: ::GUID, - hBalloonIcon: ::HICON, -}} -UNION!(NOTIFYICONDATAW, uTimeout, uTimeout, uTimeout_mut, ::UINT); -UNION!(NOTIFYICONDATAW, uTimeout, uVersion, uVersion_mut, ::UINT); // used with NIM_SETVERSION, values 0, 3 and 4 -pub type PNOTIFYICONDATAW = *mut NOTIFYICONDATAW; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/shellscalingapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/shellscalingapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/shellscalingapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/shellscalingapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -// ShellScalingApi.h -ENUM!{enum PROCESS_DPI_AWARENESS { - Process_DPI_Unaware = 0, - Process_System_DPI_Aware = 1, - Process_Per_Monitor_DPI_Aware = 2, -}} -ENUM!{enum SHELL_UI_COMPONENT { - SHELL_UI_COMPONENT_TASKBARS = 0, - SHELL_UI_COMPONENT_NOTIFICATIONAREA = 1, - SHELL_UI_COMPONENT_DESKBAND = 2, -}} -ENUM!{enum MONITOR_DPI_TYPE { - MDT_EFFECTIVE_DPI = 0, - MDT_ANGULAR_DPI = 1, - MDT_RAW_DPI = 2, -}} -pub const MDT_DEFAULT: MONITOR_DPI_TYPE = MDT_EFFECTIVE_DPI; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/shlguid.rs cargo-0.37.0/vendor/winapi-0.2.8/src/shlguid.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/shlguid.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/shlguid.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/shlobj.rs cargo-0.37.0/vendor/winapi-0.2.8/src/shlobj.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/shlobj.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/shlobj.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ -// Copyright © 2015, Peter Atashian, skdltmxn -// Licensed under the MIT License -pub const INVALID_HANDLE_VALUE: ::HANDLE = -1isize as ::HANDLE; -pub type GPFIDL_FLAGS = ::c_int; -ENUM!{enum KNOWN_FOLDER_FLAG { - KF_FLAG_DEFAULT = 0x00000000, - KF_FLAG_NO_APPCONTAINER_REDIRECTION = 0x00010000, - KF_FLAG_CREATE = 0x00008000, - KF_FLAG_DONT_VERIFY = 0x00004000, - KF_FLAG_DONT_UNEXPAND = 0x00002000, - KF_FLAG_NO_ALIAS = 0x00001000, - KF_FLAG_INIT = 0x00000800, - KF_FLAG_DEFAULT_PATH = 0x00000400, - KF_FLAG_NOT_PARENT_RELATIVE = 0x00000200, - KF_FLAG_SIMPLE_IDLIST = 0x00000100, - KF_FLAG_ALIAS_ONLY = 0x80000000, -}} -pub const IDO_SHGIOI_SHARE: ::c_int = 0x0FFFFFFF; -pub const IDO_SHGIOI_LINK: ::c_int = 0x0FFFFFFE; -// Yes, these values are supposed to overflow. Blame Microsoft. -pub const IDO_SHGIOI_SLOWFILE: ::c_int = 0xFFFFFFFDu32 as ::c_int; -pub const IDO_SHGIOI_DEFAULT: ::c_int = 0xFFFFFFFCu32 as ::c_int; -pub const GPFIDL_DEFAULT: GPFIDL_FLAGS = 0x0000; -pub const GPFIDL_ALTNAME: GPFIDL_FLAGS = 0x0001; -pub const GPFIDL_UNCPRINTER: GPFIDL_FLAGS = 0x0002; -pub const OFASI_EDIT: ::DWORD = 0x0001; -pub const OFASI_OPENDESKTOP: ::DWORD = 0x0002; -// 1204 -pub const CSIDL_DESKTOP: ::c_int = 0x0000; -pub const CSIDL_INTERNET: ::c_int = 0x0001; -pub const CSIDL_PROGRAMS: ::c_int = 0x0002; -pub const CSIDL_CONTROLS: ::c_int = 0x0003; -pub const CSIDL_PRINTERS: ::c_int = 0x0004; -pub const CSIDL_PERSONAL: ::c_int = 0x0005; -pub const CSIDL_FAVORITES: ::c_int = 0x0006; -pub const CSIDL_STARTUP: ::c_int = 0x0007; -pub const CSIDL_RECENT: ::c_int = 0x0008; -pub const CSIDL_SENDTO: ::c_int = 0x0009; -pub const CSIDL_BITBUCKET: ::c_int = 0x000a; -pub const CSIDL_STARTMENU: ::c_int = 0x000b; -pub const CSIDL_MYDOCUMENTS: ::c_int = CSIDL_PERSONAL; -pub const CSIDL_MYMUSIC: ::c_int = 0x000d; -pub const CSIDL_MYVIDEO: ::c_int = 0x000e; -pub const CSIDL_DESKTOPDIRECTORY: ::c_int = 0x0010; -pub const CSIDL_DRIVES: ::c_int = 0x0011; -pub const CSIDL_NETWORK: ::c_int = 0x0012; -pub const CSIDL_NETHOOD: ::c_int = 0x0013; -pub const CSIDL_FONTS: ::c_int = 0x0014; -pub const CSIDL_TEMPLATES: ::c_int = 0x0015; -pub const CSIDL_COMMON_STARTMENU: ::c_int = 0x0016; -pub const CSIDL_COMMON_PROGRAMS: ::c_int = 0x0017; -pub const CSIDL_COMMON_STARTUP: ::c_int = 0x0018; -pub const CSIDL_COMMON_DESKTOPDIRECTORY: ::c_int = 0x0019; -pub const CSIDL_APPDATA: ::c_int = 0x001a; -pub const CSIDL_PRINTHOOD: ::c_int = 0x001b; -pub const CSIDL_LOCAL_APPDATA: ::c_int = 0x001c; -pub const CSIDL_ALTSTARTUP: ::c_int = 0x001d; -pub const CSIDL_COMMON_ALTSTARTUP: ::c_int = 0x001e; -pub const CSIDL_COMMON_FAVORITES: ::c_int = 0x001f; -pub const CSIDL_INTERNET_CACHE: ::c_int = 0x0020; -pub const CSIDL_COOKIES: ::c_int = 0x0021; -pub const CSIDL_HISTORY: ::c_int = 0x0022; -pub const CSIDL_COMMON_APPDATA: ::c_int = 0x0023; -pub const CSIDL_WINDOWS: ::c_int = 0x0024; -pub const CSIDL_SYSTEM: ::c_int = 0x0025; -pub const CSIDL_PROGRAM_FILES: ::c_int = 0x0026; -pub const CSIDL_MYPICTURES: ::c_int = 0x0027; -pub const CSIDL_PROFILE: ::c_int = 0x0028; -pub const CSIDL_SYSTEMX86: ::c_int = 0x0029; -pub const CSIDL_PROGRAM_FILESX86: ::c_int = 0x002a; -pub const CSIDL_PROGRAM_FILES_COMMON: ::c_int = 0x002b; -pub const CSIDL_PROGRAM_FILES_COMMONX86: ::c_int = 0x002c; -pub const CSIDL_COMMON_TEMPLATES: ::c_int = 0x002d; -pub const CSIDL_COMMON_DOCUMENTS: ::c_int = 0x002e; -pub const CSIDL_COMMON_ADMINTOOLS: ::c_int = 0x002f; -pub const CSIDL_ADMINTOOLS: ::c_int = 0x0030; -pub const CSIDL_CONNECTIONS: ::c_int = 0x0031; -pub const CSIDL_COMMON_MUSIC: ::c_int = 0x0035; -pub const CSIDL_COMMON_PICTURES: ::c_int = 0x0036; -pub const CSIDL_COMMON_VIDEO: ::c_int = 0x0037; -pub const CSIDL_RESOURCES: ::c_int = 0x0038; -pub const CSIDL_RESOURCES_LOCALIZED: ::c_int = 0x0039; -pub const CSIDL_COMMON_OEM_LINKS: ::c_int = 0x003a; -pub const CSIDL_CDBURN_AREA: ::c_int = 0x003b; -pub const CSIDL_COMPUTERSNEARME: ::c_int = 0x003d; -pub const CSIDL_FLAG_CREATE: ::c_int = 0x8000; -pub const CSIDL_FLAG_DONT_VERIFY: ::c_int = 0x4000; -pub const CSIDL_FLAG_DONT_UNEXPAND: ::c_int = 0x2000; -pub const CSIDL_FLAG_NO_ALIAS: ::c_int = 0x1000; -pub const CSIDL_FLAG_PER_USER_INIT: ::c_int = 0x0800; -pub const CSIDL_FLAG_MASK: ::c_int = 0xff00; -//1312 -pub const SHGFP_TYPE_CURRENT: ::DWORD = 0; -pub const SHGFP_TYPE_DEFAULT: ::DWORD = 1; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/shobjidl.rs cargo-0.37.0/vendor/winapi-0.2.8/src/shobjidl.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/shobjidl.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/shobjidl.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,652 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! this ALWAYS GENERATED file contains the definitions for the interfaces -//Terrible forward declarations that need to be filled in -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IContextMenu; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IContextMenu2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IContextMenu3; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IExecuteCommand; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IPersistFolder; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IRunnableTask; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellTaskScheduler; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IQueryCodePage; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IPersistFolder2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IPersistFolder3; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IPersistIDList; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IEnumIDList; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IEnumFullIDList; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IFileSyncMergeHandler; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IObjectWithFolderEnumMode; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IParseAndCreateItem; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellFolder; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IEnumExtraSearch; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellFolder2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IFolderViewOptions; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellView; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellView2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellView3; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IFolderView; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ISearchBoxInfo; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IFolderView2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IFolderViewSettings; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IPreviewHandlerVisuals; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IVisualProperties; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ICommDlgBrowser; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ICommDlgBrowser2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ICommDlgBrowser3; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IColumnManager; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IFolderFilterSite; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IFolderFilter; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IInputObjectSite; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IInputObject; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IInputObject2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellIcon; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellBrowser; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IProfferService; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellItem2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellItemImageFactory; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IUserAccountChangeCallback; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IEnumShellItems; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ITransferAdviseSink; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ITransferSource; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IEnumResources; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellItemResources; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ITransferDestination; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IStreamAsync; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IStreamUnbufferedInfo; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IInitializeWithItem; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IObjectWithSelection; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IObjectWithBackReferences; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IPropertyUI; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ICategoryProvider; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ICategorizer; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDropTargetHelper; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDragSourceHelper; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDragSourceHelper2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellLinkA; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellLinkW; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellLinkDataList; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IResolveShellLink; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IActionProgressDialog; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IHWEventHandler; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IHWEventHandler2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IQueryCancelAutoPlay; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDynamicHWHandler; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IActionProgress; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellExtInit; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellPropSheetExt; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IRemoteComputer; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IQueryContinue; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IObjectWithCancelEvent; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IUserNotification; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IUserNotificationCallback; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IUserNotification2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IItemNameLimits; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ISearchFolderItemFactory; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IExtractImage; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IExtractImage2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IThumbnailHandlerFactory; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IParentAndItem; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDockingWindow; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDeskBand; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDeskBandInfo; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDeskBand2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ITaskbarList; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ITaskbarList2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ITaskbarList3; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ITaskbarList4; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IStartMenuPinnedList; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ICDBurn; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IWizardSite; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IWizardExtension; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IWebWizardExtension; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IPublishingWizard; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IFolderViewHost; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IExplorerBrowserEvents; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IExplorerBrowser; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IAccessibleObject; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IResultsFolder; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IEnumObjects; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IOperationsProgressDialog; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IIOCancelInformation; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IFileOperation; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IObjectProvider; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct INamespaceWalkCB; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct INamespaceWalkCB2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct INamespaceWalk; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IAutoCompleteDropDown; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IBandSite; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ICDBurnExt; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IContextMenuSite; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IEnumReadyCallback; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IEnumerableView; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IInsertItem; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IMenuBand; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IFolderBandPriv; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IRegTreeItem; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IImageRecompress; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDeskBar; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IMenuPopup; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IFileIsInUse; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IApplicationAssociationRegistration; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IApplicationAssociationRegistrationUI; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDelegateFolder; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IBrowserFrameOptions; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct INewWindowManager; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IAttachmentExecute; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellMenuCallback; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellMenu; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellRunDll; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IKnownFolder; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IKnownFolderManager; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ISharingConfigurationManager; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IPreviousVersionsInfo; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IRelatedItem; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IIdentityName; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDelegateItem; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ICurrentItem; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ITransferMediumItem; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IUseToBrowseItem; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDisplayItem; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IViewStateIdentityItem; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IPreviewItem; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDestinationStreamFactory; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct INewMenuClient; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IInitializeWithBindCtx; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct INameSpaceTreeControl; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct INameSpaceTreeControl2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct INameSpaceTreeControlEvents; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct INameSpaceTreeControlDropHandler; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct INameSpaceTreeAccessible; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct INameSpaceTreeControlCustomDraw; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct INameSpaceTreeControlFolderCapabilities; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IPreviewHandler; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IPreviewHandlerFrame; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ITrayDeskBand; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IBandHost; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IExplorerPaneVisibility; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IContextMenuCB; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDefaultExtractIconInit; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IExplorerCommand; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IExplorerCommandState; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IInitializeCommand; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IEnumExplorerCommand; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IExplorerCommandProvider; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IMarkupCallback; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IControlMarkup; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IInitializeNetworkFolder; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IOpenControlPanel; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IComputerInfoChangeNotify; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IFileSystemBindData; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IFileSystemBindData2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ICustomDestinationList; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IApplicationDestinations; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IApplicationDocumentLists; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IObjectWithAppUserModelID; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IObjectWithProgID; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IUpdateIDList; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDesktopGadget; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDesktopWallpaper; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IHomeGroup; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IInitializeWithPropertyStore; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IOpenSearchSource; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IShellLibrary; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDefaultFolderMenuInitialize; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IApplicationActivationManager; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IAssocHandlerInvoker; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IAssocHandler; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IEnumAssocHandlers; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDataObjectProvider; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IDataTransferManagerInterop; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IFrameworkInputPaneHandler; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IFrameworkInputPane; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IAccessibilityDockingServiceCallback; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IAccessibilityDockingService; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IAppVisibilityEvents; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IAppVisibility; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IPackageExecutionStateChangeNotification; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IPackageDebugSettings; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ISuspensionDependencyManager; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IExecuteCommandApplicationHostEnvironment; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IExecuteCommandHost; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IApplicationDesignModeSettings; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IApplicationDesignModeSettings2; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ILaunchTargetMonitor; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ILaunchSourceViewSizePreference; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ILaunchTargetViewSizePreference; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct ILaunchSourceAppUserModelId; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IInitializeWithWindow; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IHandlerInfo; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IHandlerActivationHost; -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IContactManagerInterop; -//4498 -pub type SFGAOF = ::ULONG; -//9466 -ENUM!{enum SIGDN { - SIGDN_NORMALDISPLAY = 0, - SIGDN_PARENTRELATIVEPARSING = 0x80018001, - SIGDN_DESKTOPABSOLUTEPARSING = 0x80028000, - SIGDN_PARENTRELATIVEEDITING = 0x80031001, - SIGDN_DESKTOPABSOLUTEEDITING = 0x8004c000, - SIGDN_FILESYSPATH = 0x80058000, - SIGDN_URL = 0x80068000, - SIGDN_PARENTRELATIVEFORADDRESSBAR = 0x8007c001, - SIGDN_PARENTRELATIVE = 0x80080001, - SIGDN_PARENTRELATIVEFORUI = 0x80094001, -}} -ENUM!{enum SICHINTF { - SICHINT_DISPLAY = 0, - SICHINT_ALLFIELDS = 0x80000000, - SICHINT_CANONICAL = 0x10000000, - SICHINT_TEST_FILESYSPATH_IF_NOT_EQUAL = 0x20000000, -}} -//9498 -RIDL!( -interface IShellItem(IShellItemVtbl): IUnknown(IUnknownVtbl) { - fn BindToHandler( - &mut self, pbc: *mut ::IBindCtx, bhid: ::REFGUID, riid: ::REFIID, ppv: *mut *mut ::c_void - ) -> ::HRESULT, - fn GetParent(&mut self, ppsi: *mut *mut IShellItem) -> ::HRESULT, - fn GetDisplayName(&mut self, sigdnName: SIGDN, ppszName: *mut ::LPWSTR) -> ::HRESULT, - fn GetAttributes(&mut self, sfgaoMask: SFGAOF, psfgaoAttribs: *mut SFGAOF) -> ::HRESULT, - fn Compare(&mut self, psi: *mut IShellItem, hint: SICHINTF, piOrder: *mut ::c_int) -> ::HRESULT -} -); -//11963 -pub type IFileOperationProgressSink = ::IUnknown; // TODO -pub type IShellItemArray = ::IUnknown; // TODO -//20869 -RIDL!( -interface IModalWindow(IModalWindowVtbl): IUnknown(IUnknownVtbl) { - fn Show(&mut self, hwndOwner: ::HWND) -> ::HRESULT -} -); -//22307 -ENUM!{enum FDE_OVERWRITE_RESPONSE { - FDEOR_DEFAULT = 0, - FDEOR_ACCEPT = 1, - FDEOR_REFUSE = 2, -}} -ENUM!{enum FDE_SHAREVIOLATION_RESPONSE { - FDESVR_DEFAULT = 0, - FDESVR_ACCEPT = 1, - FDESVR_REFUSE = 2, -}} -ENUM!{enum FDAP { - FDAP_BOTTOM = 0, - FDAP_TOP = 1, -}} -RIDL!( -interface IFileDialogEvents(IFileDialogEventsVtbl): IUnknown(IUnknownVtbl) { - fn OnFileOk(&mut self, pfd: *mut IFileDialog) -> ::HRESULT, - fn OnFolderChanging(&mut self, pfd: *mut IFileDialog, psiFolder: *mut IShellItem) -> ::HRESULT, - fn OnFolderChange(&mut self, pfd: *mut IFileDialog) -> ::HRESULT, - fn OnSelectionChange(&mut self, pfd: *mut IFileDialog) -> ::HRESULT, - fn OnShareViolation( - &mut self, pfd: *mut IFileDialog, psi: *mut IShellItem, - pResponse: *mut FDE_SHAREVIOLATION_RESPONSE - ) -> ::HRESULT, - fn OnTypeChange(&mut self, pfd: *mut IFileDialog) -> ::HRESULT, - fn OnOverwrite( - &mut self, pfd: *mut IFileDialog, psi: *mut IShellItem, - pResponse: *mut FDE_OVERWRITE_RESPONSE - ) -> ::HRESULT -} -); -FLAGS!{enum FILEOPENDIALOGOPTIONS { - FOS_OVERWRITEPROMPT = 0x2, - FOS_STRICTFILETYPES = 0x4, - FOS_NOCHANGEDIR = 0x8, - FOS_PICKFOLDERS = 0x20, - FOS_FORCEFILESYSTEM = 0x40, - FOS_ALLNONSTORAGEITEMS = 0x80, - FOS_NOVALIDATE = 0x100, - FOS_ALLOWMULTISELECT = 0x200, - FOS_PATHMUSTEXIST = 0x800, - FOS_FILEMUSTEXIST = 0x1000, - FOS_CREATEPROMPT = 0x2000, - FOS_SHAREAWARE = 0x4000, - FOS_NOREADONLYRETURN = 0x8000, - FOS_NOTESTFILECREATE = 0x10000, - FOS_HIDEMRUPLACES = 0x20000, - FOS_HIDEPINNEDPLACES = 0x40000, - FOS_NODEREFERENCELINKS = 0x100000, - FOS_DONTADDTORECENT = 0x2000000, - FOS_FORCESHOWHIDDEN = 0x10000000, - FOS_DEFAULTNOMINIMODE = 0x20000000, - FOS_FORCEPREVIEWPANEON = 0x40000000, - FOS_SUPPORTSTREAMABLEITEMS = 0x80000000, -}} -RIDL!( -interface IFileDialog(IFileDialogVtbl): IModalWindow(IModalWindowVtbl) { - fn SetFileTypes( - &mut self, cFileTypes: ::UINT, rgFilterSpec: *const ::COMDLG_FILTERSPEC - ) -> ::HRESULT, - fn SetFileTypeIndex(&mut self, iFileType: ::UINT) -> ::HRESULT, - fn GetFileTypeIndex(&mut self, piFileType: *mut ::UINT) -> ::HRESULT, - fn Advise(&mut self, pfde: *mut IFileDialogEvents, pdwCookie: *mut ::DWORD) -> ::HRESULT, - fn Unadvise(&mut self, dwCookie: ::DWORD) -> ::HRESULT, - fn SetOptions(&mut self, fos: FILEOPENDIALOGOPTIONS) -> ::HRESULT, - fn GetOptions(&mut self, pfos: *mut FILEOPENDIALOGOPTIONS) -> ::HRESULT, - fn SetDefaultFolder(&mut self, psi: *mut IShellItem) -> ::HRESULT, - fn SetFolder(&mut self, psi: *mut IShellItem) -> ::HRESULT, - fn GetFolder(&mut self, ppsi: *mut *mut IShellItem) -> ::HRESULT, - fn GetCurrentSelection(&mut self, ppsi: *mut *mut IShellItem) -> ::HRESULT, - fn SetFileName(&mut self, pszName: ::LPCWSTR) -> ::HRESULT, - fn GetFileName(&mut self, pszName: *mut ::LPWSTR) -> ::HRESULT, - fn SetTitle(&mut self, pszTitle: ::LPCWSTR) -> ::HRESULT, - fn SetOkButtonLabel(&mut self, pszText: ::LPCWSTR) -> ::HRESULT, - fn SetFileNameLabel(&mut self, pszLabel: ::LPCWSTR) -> ::HRESULT, - fn GetResult(&mut self, ppsi: *mut *mut IShellItem) -> ::HRESULT, - fn AddPlace(&mut self, psi: *mut IShellItem, fdap: FDAP) -> ::HRESULT, - fn SetDefaultExtension(&mut self, pszDefaultExtension: ::LPCWSTR) -> ::HRESULT, - fn Close(&mut self, hr: ::HRESULT) -> ::HRESULT, - fn SetClientGuid(&mut self, guid: ::REFGUID) -> ::HRESULT, - fn ClearClientData(&mut self) -> ::HRESULT, - fn SetFilter(&mut self, pFilter: *mut IShellItemFilter) -> ::HRESULT -} -); -RIDL!( -interface IFileSaveDialog(IFileSaveDialogVtbl): IFileDialog(IFileDialogVtbl) { - fn SetSaveAsItem(&mut self, psi: *mut IShellItem) -> ::HRESULT, - fn SetProperties(&mut self, pStore: *mut ::IPropertyStore) -> ::HRESULT, - fn SetCollectedProperties( - &mut self, pList: *mut ::IPropertyDescriptionList, fAppendDefault: ::BOOL - ) -> ::HRESULT, - fn GetProperties(&mut self, ppStore: *mut *mut ::IPropertyStore) -> ::HRESULT, - fn ApplyProperties( - &mut self, psi: *mut IShellItem, pStore: *mut ::IPropertyStore, hwnd: ::HWND, - pSink: *mut IFileOperationProgressSink - ) -> ::HRESULT -} -); -RIDL!( -interface IFileOpenDialog(IFileOpenDialogVtbl): IFileDialog(IFileDialogVtbl) { - fn GetResults(&mut self, ppenum: *mut *mut IShellItemArray) -> ::HRESULT, - fn GetSelectedItems(&mut self, ppsai: *mut *mut IShellItemArray) -> ::HRESULT -} -); -ENUM!{enum CDCONTROLSTATE { - CDCS_INACTIVE = 0x00000000, - CDCS_ENABLED = 0x00000001, - CDCS_VISIBLE = 0x00000002, - CDCS_ENABLEDVISIBLE = 0x00000003, -}} -RIDL!( -interface IFileDialogCustomize(IFileDialogCustomizeVtbl): IUnknown(IUnknownVtbl) { - fn EnableOpenDropDown(&mut self, dwIDCtl: ::DWORD) -> ::HRESULT, - fn AddMenu(&mut self, dwIDCtl: ::DWORD, pszLabel: ::LPCWSTR) -> ::HRESULT, - fn AddPushButton(&mut self, dwIDCtl: ::DWORD, pszLabel: ::LPCWSTR) -> ::HRESULT, - fn AddComboBox(&mut self, dwIDCtl: ::DWORD) -> ::HRESULT, - fn AddRadioButtonList(&mut self, dwIDCtl: ::DWORD) -> ::HRESULT, - fn AddCheckButton( - &mut self, dwIDCtl: ::DWORD, pszLabel: ::LPCWSTR, bChecked: ::BOOL - ) -> ::HRESULT, - fn AddEditBox(&mut self, dwIDCtl: ::DWORD, pszText: ::LPCWSTR) -> ::HRESULT, - fn AddSeparator(&mut self, dwIDCtl: ::DWORD) -> ::HRESULT, - fn AddText(&mut self, dwIDCtl: ::DWORD, pszText: ::LPCWSTR) -> ::HRESULT, - fn SetControlLabel(&mut self, dwIDCtl: ::DWORD, pszLabel: ::LPCWSTR) -> ::HRESULT, - fn GetControlState(&mut self, dwIDCtl: ::DWORD, pdwState: *mut CDCONTROLSTATE) -> ::HRESULT, - fn SetControlState(&mut self, dwIDCtl: ::DWORD, dwState: CDCONTROLSTATE) -> ::HRESULT, - fn GetEditBoxText(&mut self, dwIDCtl: ::DWORD, ppszText: *mut *mut ::WCHAR) -> ::HRESULT, - fn SetEditBoxText(&mut self, dwIDCtl: ::DWORD, pszText: ::LPCWSTR) -> ::HRESULT, - fn GetCheckButtonState(&mut self, dwIDCtl: ::DWORD, pbChecked: *mut ::BOOL) -> ::HRESULT, - fn SetCheckButtonState(&mut self, dwIDCtl: ::DWORD, bChecked: ::BOOL) -> ::HRESULT, - fn AddControlItem( - &mut self, dwIDCtl: ::DWORD, dwIDItem: ::DWORD, pszLabel: ::LPCWSTR - ) -> ::HRESULT, - fn RemoveControlItem(&mut self, dwIDCtl: ::DWORD, dwIDItem: ::DWORD) -> ::HRESULT, - fn RemoveAllControlItems(&mut self, dwIDCtl: ::DWORD) -> ::HRESULT, - fn GetControlItemState( - &mut self, dwIDCtl: ::DWORD, dwIDItem: ::DWORD, pdwState: *mut CDCONTROLSTATE - ) -> ::HRESULT, - fn SetControlItemState( - &mut self, dwIDCtl: ::DWORD, dwIDItem: ::DWORD, dwState: CDCONTROLSTATE - ) -> ::HRESULT, - fn GetSelectedControlItem(&mut self, dwIDCtl: ::DWORD, pdwIDItem: *mut ::DWORD) -> ::HRESULT, - fn SetSelectedControlItem(&mut self, dwIDCtl: ::DWORD, dwIDItem: ::DWORD) -> ::HRESULT, - fn StartVisualGroup(&mut self, dwIDCtl: ::DWORD, pszLabel: ::LPCWSTR) -> ::HRESULT, - fn EndVisualGroup(&mut self) -> ::HRESULT, - fn MakeProminent(&mut self, dwIDCtl: ::DWORD) -> ::HRESULT, - fn SetControlItemText(&mut self, dwIDCtl: ::DWORD, dwIDItem: ::DWORD, pszLabel: ::LPCWSTR) -> ::HRESULT -} -); -RIDL!( -interface IFileDialogControlEvents(IFileDialogControlEventsVtbl): IUnknown(IUnknownVtbl) { - fn OnItemSelected( - &mut self, pfdc: *mut IFileDialogCustomize, dwIDCtl: ::DWORD, dwIDItem: ::DWORD - ) -> ::HRESULT, - fn OnButtonClicked(&mut self, pfdc: *mut IFileDialogCustomize, dwIDCtl: ::DWORD) -> ::HRESULT, - fn OnCheckButtonToggled( - &mut self, pfdc: *mut IFileDialogCustomize, dwIDCtl: ::DWORD, bChecked: ::BOOL - ) -> ::HRESULT, - fn OnControlActivating( - &mut self, pfdc: *mut IFileDialogCustomize, dwIDCtl: ::DWORD - ) -> ::HRESULT -} -); -RIDL!( -interface IFileDialog2(IFileDialog2Vtbl): IFileDialog(IFileDialogVtbl) { - fn SetCancelButtonLabel(&mut self, pszLabel: ::LPCWSTR) -> ::HRESULT, - fn SetNavigationRoot(&mut self, psi: IShellItem) -> ::HRESULT -} -); -//27457 -pub type IShellItemFilter = ::IUnknown; // TODO diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/shtypes.rs cargo-0.37.0/vendor/winapi-0.2.8/src/shtypes.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/shtypes.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/shtypes.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! this ALWAYS GENERATED file contains the definitions for the interfaces -#[repr(C)] #[allow(missing_copy_implementations)] -pub struct SHITEMID { - pub cb: ::USHORT, - pub abID: [::BYTE; 0], -} -pub type LPSHITEMID = *mut SHITEMID; -pub type LPCSHITEMID = *const SHITEMID; -#[repr(C)] -pub struct ITEMIDLIST { - pub mkid: SHITEMID, -} -pub type ITEMIDLIST_RELATIVE = ITEMIDLIST; -pub type ITEMID_CHILD = ITEMIDLIST; -pub type ITEMIDLIST_ABSOLUTE = ITEMIDLIST; -pub type LPITEMIDLIST = *mut ITEMIDLIST; -pub type LPCITEMIDLIST = *const ITEMIDLIST; -pub type PIDLIST_ABSOLUTE = *mut ITEMIDLIST_ABSOLUTE; -pub type PCIDLIST_ABSOLUTE = *const ITEMIDLIST_ABSOLUTE; -pub type PCUIDLIST_ABSOLUTE = *const ITEMIDLIST_ABSOLUTE; -pub type PIDLIST_RELATIVE = *mut ITEMIDLIST_RELATIVE; -pub type PCIDLIST_RELATIVE = *const ITEMIDLIST_RELATIVE; -pub type PUIDLIST_RELATIVE = *mut ITEMIDLIST_RELATIVE; -pub type PCUIDLIST_RELATIVE = *const ITEMIDLIST_RELATIVE; -pub type PITEMID_CHILD = *mut ITEMID_CHILD; -pub type PCITEMID_CHILD = *const ITEMID_CHILD; -pub type PUITEMID_CHILD = *mut ITEMID_CHILD; -pub type PCUITEMID_CHILD = *const ITEMID_CHILD; -pub type PCUITEMID_CHILD_ARRAY = *const PCUITEMID_CHILD; -pub type PCUIDLIST_RELATIVE_ARRAY = *const PCUIDLIST_RELATIVE; -pub type PCIDLIST_ABSOLUTE_ARRAY = *const PCIDLIST_ABSOLUTE; -pub type PCUIDLIST_ABSOLUTE_ARRAY = *const PCUIDLIST_ABSOLUTE; -STRUCT!{struct COMDLG_FILTERSPEC { - pszName: ::LPCWSTR, - pszSpec: ::LPCWSTR, -}} -pub type KNOWNFOLDERID = ::GUID; -pub type REFKNOWNFOLDERID = *const KNOWNFOLDERID; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/spapidef.rs cargo-0.37.0/vendor/winapi-0.2.8/src/spapidef.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/spapidef.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/spapidef.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! Windows NT Setup and Device Installer services -pub type SP_LOG_TOKEN = ::DWORDLONG; -pub type PSP_LOG_TOKEN = *mut ::DWORDLONG; -pub const LOGTOKEN_TYPE_MASK: SP_LOG_TOKEN = 3; -pub const LOGTOKEN_UNSPECIFIED: SP_LOG_TOKEN = 0; -pub const LOGTOKEN_NO_LOG: SP_LOG_TOKEN = 1; -pub const LOGTOKEN_SETUPAPI_APPLOG: SP_LOG_TOKEN = 2; -pub const LOGTOKEN_SETUPAPI_DEVLOG: SP_LOG_TOKEN = 3; -pub const TXTLOG_SETUPAPI_DEVLOG: ::DWORD = 0x00000001; -pub const TXTLOG_SETUPAPI_CMDLINE: ::DWORD = 0x00000002; -pub const TXTLOG_SETUPAPI_BITS: ::DWORD = 0x00000003; -pub const TXTLOG_ERROR: ::DWORD = 0x1; -pub const TXTLOG_WARNING: ::DWORD = 0x2; -pub const TXTLOG_SYSTEM_STATE_CHANGE: ::DWORD = 0x3; -pub const TXTLOG_SUMMARY: ::DWORD = 0x4; -pub const TXTLOG_DETAILS: ::DWORD = 0x5; -pub const TXTLOG_VERBOSE: ::DWORD = 0x6; -pub const TXTLOG_VERY_VERBOSE: ::DWORD = 0x7; -pub const TXTLOG_RESERVED_FLAGS: ::DWORD = 0x0000FFF0; -pub const TXTLOG_TIMESTAMP: ::DWORD = 0x00010000; -pub const TXTLOG_DEPTH_INCR: ::DWORD = 0x00020000; -pub const TXTLOG_DEPTH_DECR: ::DWORD = 0x00040000; -pub const TXTLOG_TAB_1: ::DWORD = 0x00080000; -pub const TXTLOG_FLUSH_FILE: ::DWORD = 0x00100000; -#[inline] #[allow(dead_code)] -pub fn TXTLOG_LEVEL(flags: ::DWORD) -> ::DWORD { - return flags & 0xf; -} -pub const TXTLOG_DEVINST: ::DWORD = 0x00000001; -pub const TXTLOG_INF: ::DWORD = 0x00000002; -pub const TXTLOG_FILEQ: ::DWORD = 0x00000004; -pub const TXTLOG_COPYFILES: ::DWORD = 0x00000008; -pub const TXTLOG_SIGVERIF: ::DWORD = 0x00000020; -pub const TXTLOG_BACKUP: ::DWORD = 0x00000080; -pub const TXTLOG_UI: ::DWORD = 0x00000100; -pub const TXTLOG_UTIL: ::DWORD = 0x00000200; -pub const TXTLOG_INFDB: ::DWORD = 0x00000400; -pub const TXTLOG_POLICY: ::DWORD = 0x00800000; -pub const TXTLOG_NEWDEV: ::DWORD = 0x01000000; -pub const TXTLOG_UMPNPMGR: ::DWORD = 0x02000000; -pub const TXTLOG_DRIVER_STORE: ::DWORD = 0x04000000; -pub const TXTLOG_SETUP: ::DWORD = 0x08000000; -pub const TXTLOG_CMI: ::DWORD = 0x10000000; -pub const TXTLOG_DEVMGR: ::DWORD = 0x20000000; -pub const TXTLOG_INSTALLER: ::DWORD = 0x40000000; -pub const TXTLOG_VENDOR: ::DWORD = 0x80000000; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/sql.rs cargo-0.37.0/vendor/winapi-0.2.8/src/sql.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/sql.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/sql.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,179 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -pub const SQL_NULL_DATA: SQLLEN = -1; -pub const SQL_DATA_AT_EXEC: SQLLEN = -2; -pub const SQL_SUCCESS: SQLRETURN = 0; -pub const SQL_SUCCESS_WITH_INFO: SQLRETURN = 1; -pub const SQL_NO_DATA: SQLRETURN = 100; -pub const SQL_PARAM_DATA_AVAILABLE: SQLRETURN = 101; -pub const SQL_ERROR: SQLRETURN = -1; -pub const SQL_INVALID_HANDLE: SQLRETURN = -2; -pub const SQL_STILL_EXECUTING: SQLRETURN = 2; -pub const SQL_NEED_DATA: SQLRETURN = 99; -pub const SQL_NTS: SQLSMALLINT = -3; -pub const SQL_MAX_MESSAGE_LENGTH: usize = 512; -pub const SQL_DATE_LEN: usize = 10; -pub const SQL_TIME_LEN: usize = 8; -pub const SQL_TIMESTAMP_LEN: usize = 19; -pub const SQL_HANDLE_ENV: SQLSMALLINT = 1; -pub const SQL_HANDLE_DBC: SQLSMALLINT = 2; -pub const SQL_HANDLE_STMT: SQLSMALLINT = 3; -pub const SQL_HANDLE_DESC: SQLSMALLINT = 4; -pub const SQL_ATTR_OUTPUT_NTS: SQLINTEGER = 10001; -pub const SQL_ATTR_AUTO_IPD: SQLINTEGER = 10001; -pub const SQL_ATTR_METADATA_ID: SQLINTEGER = 10014; -pub const SQL_ATTR_APP_ROW_DESC: SQLINTEGER = 10010; -pub const SQL_ATTR_APP_PARAM_DESC: SQLINTEGER = 10011; -pub const SQL_ATTR_IMP_ROW_DESC: SQLINTEGER = 10012; -pub const SQL_ATTR_IMP_PARAM_DESC: SQLINTEGER = 10013; -pub const SQL_ATTR_CURSOR_SCROLLABLE: SQLINTEGER = -1; -pub const SQL_ATTR_CURSOR_SENSITIVITY: SQLINTEGER = -2; - -//Null handle used in place of parent handle when allocating HENV -pub const SQL_NULL_HANDLE: SQLHANDLE = 0 as SQLHANDLE; - -//Special length/indicator values - -//Return values from functions - - -//Values of NULLABLE field in descriptor -pub const SQL_NO_NULLS: SQLSMALLINT = 0; -pub const SQL_NULLABLE: SQLSMALLINT = 1; -pub const SQL_NULLABLE_UNKNOWN: SQLSMALLINT = 2; - -//Env attribute -pub const SQL_ATTR_ODBC_VERSION: SQLINTEGER = 200; -pub const SQL_ATTR_CONNECTION_POOLING: SQLINTEGER = 201; -pub const SQL_ATTR_CP_MATCH: SQLINTEGER = 202; - -//Values for SQL_ATTR_ODBC_VERSION -pub const SQL_OV_ODBC2: SQLINTEGER = 2; -pub const SQL_OV_ODBC3: SQLINTEGER = 3; -pub const SQL_OV_ODBC3_80: SQLINTEGER = 380; - -//Connection attributes -pub const SQL_ACCESS_MODE: SQLINTEGER = 101; -pub const SQL_AUTOCOMMIT: SQLINTEGER = 102; -pub const SQL_LOGIN_TIMEOUT: SQLINTEGER = 103; -pub const SQL_OPT_TRACE: SQLINTEGER = 104; -pub const SQL_OPT_TRACEFILE: SQLINTEGER = 105; -pub const SQL_TRANSLATE_DLL: SQLINTEGER = 106; -pub const SQL_TRANSLATE_OPTION: SQLINTEGER = 107; -pub const SQL_TXN_ISOLATION: SQLINTEGER = 108; -pub const SQL_CURRENT_QUALIFIER: SQLINTEGER = 109; -pub const SQL_ODBC_CURSORS: SQLINTEGER = 110; -pub const SQL_QUIET_MODE: SQLINTEGER = 111; -pub const SQL_PACKET_SIZE: SQLINTEGER = 112; - -//Connection attributes with new names -pub const SQL_ATTR_ACCESS_MODE: SQLINTEGER = SQL_ACCESS_MODE; -pub const SQL_ATTR_AUTOCOMMIT: SQLINTEGER = SQL_AUTOCOMMIT; -pub const SQL_ATTR_CONNECTION_TIMEOUT: SQLINTEGER = 113; -pub const SQL_ATTR_CURRENT_CATALOG: SQLINTEGER = SQL_CURRENT_QUALIFIER; -pub const SQL_ATTR_DISCONNECT_BEHAVIOR: SQLINTEGER = 114; -pub const SQL_ATTR_ENLIST_IN_DTC: SQLINTEGER = 1207; -pub const SQL_ATTR_ENLIST_IN_XA: SQLINTEGER = 1208; -pub const SQL_ATTR_LOGIN_TIMEOUT: SQLINTEGER = SQL_LOGIN_TIMEOUT; -pub const SQL_ATTR_ODBC_CURSORS: SQLINTEGER = SQL_ODBC_CURSORS; -pub const SQL_ATTR_PACKET_SIZE: SQLINTEGER = SQL_PACKET_SIZE; -pub const SQL_ATTR_QUIET_MODE: SQLINTEGER = SQL_QUIET_MODE; -pub const SQL_ATTR_TRACE: SQLINTEGER = SQL_OPT_TRACE; -pub const SQL_ATTR_TRACEFILE: SQLINTEGER = SQL_OPT_TRACEFILE; -pub const SQL_ATTR_TRANSLATE_LIB: SQLINTEGER = SQL_TRANSLATE_DLL; -pub const SQL_ATTR_TRANSLATE_OPTION: SQLINTEGER = SQL_TRANSLATE_OPTION; -pub const SQL_ATTR_TXN_ISOLATION: SQLINTEGER = SQL_TXN_ISOLATION; -pub const SQL_ATTR_CONNECTION_DEAD: SQLINTEGER = 1209; - -//Flags for null-terminated string -pub const SQL_NTS: SQLSMALLINT = -3; - -//Options for SQLDriverConnect -pub const SQL_DRIVER_NOPROMPT: SQLUSMALLINT = 0; -pub const SQL_DRIVER_COMPLETE: SQLUSMALLINT = 1; -pub const SQL_DRIVER_PROMPT: SQLUSMALLINT = 2; -pub const SQL_DRIVER_COMPLETE_REQUIRED: SQLUSMALLINT = 3; - -//Whether an attribute is a pointer or not -pub const SQL_IS_POINTER: SQLINTEGER = -4; -pub const SQL_IS_UINTEGER: SQLINTEGER = -5; -pub const SQL_IS_INTEGER: SQLINTEGER = -6; -pub const SQL_IS_USMALLINT: SQLINTEGER = -7; -pub const SQL_IS_SMALLINT: SQLINTEGER = -8; - -//FreeStmt options -pub const SQL_CLOSE: SQLUSMALLINT = 0; -pub const SQL_DROP: SQLUSMALLINT = 1; -pub const SQL_UNBIND: SQLUSMALLINT = 2; -pub const SQL_RESET_PARAMS: SQLUSMALLINT = 3; - -//C datatype to SQL datatype mapping -pub const SQL_UNKNOWN_TYPE: SQLSMALLINT = 0; -pub const SQL_CHAR: SQLSMALLINT = 1; -pub const SQL_NUMERIC: SQLSMALLINT = 2; -pub const SQL_DECIMAL: SQLSMALLINT = 3; -pub const SQL_INTEGER: SQLSMALLINT = 4; -pub const SQL_SMALLINT: SQLSMALLINT = 5; -pub const SQL_FLOAT: SQLSMALLINT = 6; -pub const SQL_REAL: SQLSMALLINT = 7; -pub const SQL_DOUBLE: SQLSMALLINT = 8; -pub const SQL_DATETIME: SQLSMALLINT = 9; -pub const SQL_VARCHAR: SQLSMALLINT = 12; - -pub const SQL_TYPE_DATE: SQLSMALLINT = 91; -pub const SQL_TYPE_TIME: SQLSMALLINT = 92; -pub const SQL_TYPE_TIMESTAMP: SQLSMALLINT = 93; - -pub const SQL_DATE: SQLSMALLINT = 9; -pub const SQL_INTERVAL: SQLSMALLINT = 10; -pub const SQL_TIME: SQLSMALLINT = 10; -pub const SQL_TIMESTAMP: SQLSMALLINT = 11; -pub const SQL_LONGVARCHAR: SQLSMALLINT = -1; -pub const SQL_BINARY: SQLSMALLINT = -2; -pub const SQL_VARBINARY: SQLSMALLINT = -3; -pub const SQL_LONGVARBINARY: SQLSMALLINT = -4; -pub const SQL_BIGINT: SQLSMALLINT = -5; -pub const SQL_TINYINT: SQLSMALLINT = -6; -pub const SQL_BIT: SQLSMALLINT = -7; -pub const SQL_GUID: SQLSMALLINT = -11; - -pub const SQL_C_CHAR: SQLSMALLINT = SQL_CHAR; -pub const SQL_C_LONG: SQLSMALLINT = SQL_INTEGER; -pub const SQL_C_SHORT: SQLSMALLINT = SQL_SMALLINT; -pub const SQL_C_FLOAT: SQLSMALLINT = SQL_REAL; -pub const SQL_C_DOUBLE: SQLSMALLINT = SQL_DOUBLE; -pub const SQL_C_NUMERIC: SQLSMALLINT = SQL_NUMERIC; -pub const SQL_C_DEFAULT: SQLSMALLINT = 99; - -pub const SQL_SIGNED_OFFSET: SQLSMALLINT = -20; -pub const SQL_UNSIGNED_OFFSET: SQLSMALLINT = -22; - -pub const SQL_C_DATE: SQLSMALLINT = SQL_DATE; -pub const SQL_C_TIME: SQLSMALLINT = SQL_TIME; -pub const SQL_C_TIMESTAMP: SQLSMALLINT = SQL_TIMESTAMP; - -pub const SQL_C_TYPE_DATE: SQLSMALLINT = SQL_TYPE_DATE; -pub const SQL_C_TYPE_TIME: SQLSMALLINT = SQL_TYPE_TIME; -pub const SQL_C_TYPE_TIMESTAMP: SQLSMALLINT = SQL_TYPE_TIMESTAMP; - -pub const SQL_C_BINARY: SQLSMALLINT = SQL_BINARY; -pub const SQL_C_BIT: SQLSMALLINT = SQL_BIT; -pub const SQL_C_SBIGINT: SQLSMALLINT = SQL_BIGINT + SQL_SIGNED_OFFSET; -pub const SQL_C_UBIGINT: SQLSMALLINT = SQL_BIGINT + SQL_UNSIGNED_OFFSET; -pub const SQL_C_TINYINT: SQLSMALLINT = SQL_TINYINT; -pub const SQL_C_SLONG: SQLSMALLINT = SQL_C_LONG + SQL_SIGNED_OFFSET; -pub const SQL_C_SSHORT: SQLSMALLINT = SQL_C_SHORT + SQL_SIGNED_OFFSET; -pub const SQL_C_STINYINT: SQLSMALLINT = SQL_TINYINT + SQL_SIGNED_OFFSET; -pub const SQL_C_ULONG: SQLSMALLINT = SQL_C_LONG + SQL_UNSIGNED_OFFSET; -pub const SQL_C_USHORT: SQLSMALLINT = SQL_C_SHORT + SQL_UNSIGNED_OFFSET; -pub const SQL_C_UTINYINT: SQLSMALLINT = SQL_TINYINT + SQL_UNSIGNED_OFFSET; - -pub const SQL_C_GUID: SQLSMALLINT = SQL_GUID; - -pub const SQL_WCHAR: SQLSMALLINT = -8; -pub const SQL_WVARCHAR: SQLSMALLINT = -9; -pub const SQL_WLONGVARCHAR: SQLSMALLINT = -10; -pub const SQL_C_WCHAR: SQLSMALLINT = SQL_WCHAR; - -pub const SQL_TYPE_NULL: SQLSMALLINT = 0; - diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/sqltypes.rs cargo-0.37.0/vendor/winapi-0.2.8/src/sqltypes.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/sqltypes.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/sqltypes.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,130 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -pub type SQLCHAR = ::c_uchar; -pub type SQLSCHAR = ::c_schar; -pub type SQLDATE = ::c_uchar; -pub type SQLDECIMAL = ::c_uchar; -pub type SQLDOUBLE = ::c_double; -pub type SQLFLOAT = ::c_double; -pub type SQLINTEGER = ::c_long; -pub type SQLUINTEGER = ::c_ulong; -#[cfg(target_arch = "x86_64")] -pub type SQLLEN = ::INT64; -#[cfg(target_arch = "x86_64")] -pub type SQLULEN = ::UINT64; -#[cfg(target_arch = "x86_64")] -pub type SQLSETPOSIROW = ::UINT64; -#[cfg(target_arch = "x86")] -pub type SQLLEN = SQLINTEGER; -#[cfg(target_arch = "x86")] -pub type SQLULEN = SQLUINTEGER; -#[cfg(target_arch = "x86")] -pub type SQLSETPOSIROW = SQLUSMALLINT; -pub type SQLROWCOUNT = SQLULEN; -pub type SQLROWSETSIZE = SQLULEN; -pub type SQLTRANSID = SQLULEN; -pub type SQLROWOFFSET = SQLLEN; -pub type SQLNUMERIC = ::c_uchar; -pub type SQLPOINTER = *mut ::c_void; -pub type SQLREAL = ::c_float; -pub type SQLSMALLINT = ::c_short; -pub type SQLUSMALLINT = ::c_ushort; -pub type SQLTIME = ::c_uchar; -pub type SQLTIMESTAMP = ::c_uchar; -pub type SQLVARCHAR = ::c_uchar; -pub type SQLRETURN = SQLSMALLINT; -pub type SQLHANDLE = *mut ::c_void; -pub type SQLHENV = SQLHANDLE; -pub type SQLHDBC = SQLHANDLE; -pub type SQLHSTMT = SQLHANDLE; -pub type SQLHDESC = SQLHANDLE; -//pub type UCHAR = ::c_uchar; -pub type SCHAR = ::c_schar; -//pub type SQLSCHAR = SCHAR; -pub type SDWORD = ::c_long; -pub type SWORD = ::c_short; -pub type UDWORD = ::c_ulong; -//pub type UWORD = ::c_ushort; -//#[cfg(target_arch = "x86")] -//pub type SQLUINTEGER = ::UDWORD; -pub type SLONG = ::c_long; -pub type SSHORT = ::c_short; -//pub type ULONG = ::c_ulong; -//pub type USHORT = ::c_ushort; -pub type SDOUBLE = ::c_double; -pub type LDOUBLE = ::c_double; -pub type SFLOAT = ::c_float; -pub type PTR = *mut ::c_void; -pub type HENV = *mut ::c_void; -pub type HDBC = *mut ::c_void; -pub type HSTMT = *mut ::c_void; -pub type RETCODE = ::c_short; -pub type SQLHWND = ::HWND; -STRUCT!{struct DATE_STRUCT { - year: SQLSMALLINT, - month: SQLUSMALLINT, - day: SQLUSMALLINT, -}} -pub type SQL_DATE_STRUCT = DATE_STRUCT; -STRUCT!{struct TIME_STRUCT { - hour: SQLUSMALLINT, - minute: SQLUSMALLINT, - second: SQLUSMALLINT, -}} -pub type SQL_TIME_STRUCT = TIME_STRUCT; -STRUCT!{struct TIMESTAMP_STRUCT { - year: SQLSMALLINT, - month: SQLUSMALLINT, - day: SQLUSMALLINT, - hour: SQLUSMALLINT, - minute: SQLUSMALLINT, - second: SQLUSMALLINT, - fraction: SQLUINTEGER, -}} -pub type SQL_TIMESTAMP_STRUCT = TIMESTAMP_STRUCT; -ENUM!{enum SQLINTERVAL { - SQL_IS_YEAR = 1, - SQL_IS_MONTH = 2, - SQL_IS_DAY = 3, - SQL_IS_HOUR = 4, - SQL_IS_MINUTE = 5, - SQL_IS_SECOND = 6, - SQL_IS_YEAR_TO_MONTH = 7, - SQL_IS_DAY_TO_HOUR = 8, - SQL_IS_DAY_TO_MINUTE = 9, - SQL_IS_DAY_TO_SECOND = 10, - SQL_IS_HOUR_TO_MINUTE = 11, - SQL_IS_HOUR_TO_SECOND = 12, - SQL_IS_MINUTE_TO_SECOND = 13, -}} -STRUCT!{struct SQL_YEAR_MONTH_STRUCT { - year: SQLUINTEGER, - month: SQLUINTEGER, -}} -STRUCT!{struct SQL_DAY_SECOND_STRUCT { - day: SQLUINTEGER, - hour: SQLUINTEGER, - minute: SQLUINTEGER, - second: SQLUINTEGER, - fraction: SQLUINTEGER, -}} -STRUCT!{struct SQL_INTERVAL_STRUCT { - interval_type: SQLINTERVAL, - interval_sign: SQLSMALLINT, - intval: [u32; 5], -}} -UNION!{SQL_INTERVAL_STRUCT, intval, year_month, year_month_mut, SQL_YEAR_MONTH_STRUCT} -UNION!{SQL_INTERVAL_STRUCT, intval, day_second, day_second_mut, SQL_DAY_SECOND_STRUCT} -pub type ODBCINT64 = ::__int64; -pub type SQLBIGINT = ODBCINT64; -pub type SQLUBIGINT = ::__uint64; -pub const SQL_MAX_NUMERIC_LEN: usize = 16; -STRUCT!{struct SQL_NUMERIC_STRUCT { - precision: SQLCHAR, - scale: SQLSCHAR, - sign: SQLCHAR, - val: [SQLCHAR; SQL_MAX_NUMERIC_LEN], -}} -pub type SQLGUID = ::GUID; -pub type BOOKMARK = SQLULEN; -pub type SQLWCHAR = ::wchar_t; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/sspi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/sspi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/sspi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/sspi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,657 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Security Support Provider Interface Prototypes and structure definitions -pub type SEC_WCHAR = ::WCHAR; -pub type SEC_CHAR = ::CHAR; -pub type SECURITY_STATUS = ::LONG; -STRUCT!{struct SecHandle { - dwLower: ::ULONG_PTR, - dwUpper: ::ULONG_PTR, -}} -pub type PSecHandle = *mut SecHandle; -pub const SEC_DELETED_HANDLE: ::ULONG_PTR = 2; -pub type CredHandle = SecHandle; -pub type PCredHandle = PSecHandle; -pub type CtxtHandle = SecHandle; -pub type PCtxtHandle = PSecHandle; -pub type SECURITY_INTEGER = ::LARGE_INTEGER; -pub type PSECURITY_INTEGER = *mut ::LARGE_INTEGER; -pub type TimeStamp = SECURITY_INTEGER; -pub type PTimeStamp = *mut SECURITY_INTEGER; -STRUCT!{struct SECURITY_STRING { - Length: ::c_ushort, - MaximumLength: ::c_ushort, - Buffer: *mut ::c_ushort, -}} -pub type PSECURITY_STRING = *mut SECURITY_STRING; -STRUCT!{struct SecPkgInfoW { - fCapabilities: ::c_ulong, - wVersion: ::c_ushort, - wRPCID: ::c_ushort, - cbMaxToken: ::c_ulong, - Name: *mut SEC_WCHAR, - Comment: *mut SEC_WCHAR, -}} -pub type PSecPkgInfoW = *mut SecPkgInfoW; -STRUCT!{struct SecPkgInfoA { - fCapabilities: ::c_ulong, - wVersion: ::c_ushort, - wRPCID: ::c_ushort, - cbMaxToken: ::c_ulong, - Name: *mut SEC_CHAR, - Comment: *mut SEC_CHAR, -}} -pub type PSecPkgInfoA = *mut SecPkgInfoA; -pub const SECPKG_FLAG_INTEGRITY: ::c_ulong = 0x00000001; -pub const SECPKG_FLAG_PRIVACY: ::c_ulong = 0x00000002; -pub const SECPKG_FLAG_TOKEN_ONLY: ::c_ulong = 0x00000004; -pub const SECPKG_FLAG_DATAGRAM: ::c_ulong = 0x00000008; -pub const SECPKG_FLAG_CONNECTION: ::c_ulong = 0x00000010; -pub const SECPKG_FLAG_MULTI_REQUIRED: ::c_ulong = 0x00000020; -pub const SECPKG_FLAG_CLIENT_ONLY: ::c_ulong = 0x00000040; -pub const SECPKG_FLAG_EXTENDED_ERROR: ::c_ulong = 0x00000080; -pub const SECPKG_FLAG_IMPERSONATION: ::c_ulong = 0x00000100; -pub const SECPKG_FLAG_ACCEPT_WIN32_NAME: ::c_ulong = 0x00000200; -pub const SECPKG_FLAG_STREAM: ::c_ulong = 0x00000400; -pub const SECPKG_FLAG_NEGOTIABLE: ::c_ulong = 0x00000800; -pub const SECPKG_FLAG_GSS_COMPATIBLE: ::c_ulong = 0x00001000; -pub const SECPKG_FLAG_LOGON: ::c_ulong = 0x00002000; -pub const SECPKG_FLAG_ASCII_BUFFERS: ::c_ulong = 0x00004000; -pub const SECPKG_FLAG_FRAGMENT: ::c_ulong = 0x00008000; -pub const SECPKG_FLAG_MUTUAL_AUTH: ::c_ulong = 0x00010000; -pub const SECPKG_FLAG_DELEGATION: ::c_ulong = 0x00020000; -pub const SECPKG_FLAG_READONLY_WITH_CHECKSUM: ::c_ulong = 0x00040000; -pub const SECPKG_FLAG_RESTRICTED_TOKENS: ::c_ulong = 0x00080000; -pub const SECPKG_FLAG_NEGO_EXTENDER: ::c_ulong = 0x00100000; -pub const SECPKG_FLAG_NEGOTIABLE2: ::c_ulong = 0x00200000; -pub const SECPKG_FLAG_APPCONTAINER_PASSTHROUGH: ::c_ulong = 0x00400000; -pub const SECPKG_FLAG_APPCONTAINER_CHECKS: ::c_ulong = 0x00800000; -pub const SECPKG_ID_NONE: ::c_ulong = 0xFFFF; -pub const SECPKG_CALLFLAGS_APPCONTAINER: ::c_ulong = 0x00000001; -pub const SECPKG_CALLFLAGS_APPCONTAINER_AUTHCAPABLE: ::c_ulong = 0x00000002; -pub const SECPKG_CALLFLAGS_FORCE_SUPPLIED: ::c_ulong = 0x00000004; -STRUCT!{struct SecBuffer { - cbBuffer: ::c_ulong, - BufferType: ::c_ulong, - pvBuffer: *mut ::c_void, -}} -pub type PSecBuffer = *mut SecBuffer; -STRUCT!{struct SecBufferDesc { - ulVersion: ::c_ulong, - cBuffers: ::c_ulong, - pBuffers: PSecBuffer, -}} -pub type PSecBufferDesc = *mut SecBufferDesc; -pub const SECBUFFER_VERSION: ::c_ulong = 0; -pub const SECBUFFER_EMPTY: ::c_ulong = 0; -pub const SECBUFFER_DATA: ::c_ulong = 1; -pub const SECBUFFER_TOKEN: ::c_ulong = 2; -pub const SECBUFFER_PKG_PARAMS: ::c_ulong = 3; -pub const SECBUFFER_MISSING: ::c_ulong = 4; -pub const SECBUFFER_EXTRA: ::c_ulong = 5; -pub const SECBUFFER_STREAM_TRAILER: ::c_ulong = 6; -pub const SECBUFFER_STREAM_HEADER: ::c_ulong = 7; -pub const SECBUFFER_NEGOTIATION_INFO: ::c_ulong = 8; -pub const SECBUFFER_PADDING: ::c_ulong = 9; -pub const SECBUFFER_STREAM: ::c_ulong = 10; -pub const SECBUFFER_MECHLIST: ::c_ulong = 11; -pub const SECBUFFER_MECHLIST_SIGNATURE: ::c_ulong = 12; -pub const SECBUFFER_TARGET: ::c_ulong = 13; -pub const SECBUFFER_CHANNEL_BINDINGS: ::c_ulong = 14; -pub const SECBUFFER_CHANGE_PASS_RESPONSE: ::c_ulong = 15; -pub const SECBUFFER_TARGET_HOST: ::c_ulong = 16; -pub const SECBUFFER_ALERT: ::c_ulong = 17; -pub const SECBUFFER_APPLICATION_PROTOCOLS: ::c_ulong = 18; -pub const SECBUFFER_ATTRMASK: ::c_ulong = 0xF0000000; -pub const SECBUFFER_READONLY: ::c_ulong = 0x80000000; -pub const SECBUFFER_READONLY_WITH_CHECKSUM: ::c_ulong = 0x10000000; -pub const SECBUFFER_RESERVED: ::c_ulong = 0x60000000; -STRUCT!{struct SEC_NEGOTIATION_INFO { - Size: ::c_ulong, - NameLength: ::c_ulong, - Name: *mut SEC_WCHAR, - Reserved: *mut ::c_void, -}} -pub type PSEC_NEGOTIATION_INFO = *mut SEC_NEGOTIATION_INFO; -STRUCT!{struct SEC_CHANNEL_BINDINGS { - dwInitiatorAddrType: ::c_ulong, - cbInitiatorLength: ::c_ulong, - dwInitiatorOffset: ::c_ulong, - dwAcceptorAddrType: ::c_ulong, - cbAcceptorLength: ::c_ulong, - dwAcceptorOffset: ::c_ulong, - cbApplicationDataLength: ::c_ulong, - dwApplicationDataOffset: ::c_ulong, -}} -pub type PSEC_CHANNEL_BINDINGS = *mut SEC_CHANNEL_BINDINGS; -ENUM!{enum SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT { - SecApplicationProtocolNegotiationExt_None, - SecApplicationProtocolNegotiationExt_NPN, - SecApplicationProtocolNegotiationExt_ALPN, -}} -pub type PSEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT = *mut SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT; -STRUCT!{struct SEC_APPLICATION_PROTOCOL_LIST { - ProtoNegoExt: ::SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT, - ProtocolListSize: ::c_ushort, - ProtocolList: [::c_uchar; 0], -}} -STRUCT!{struct SEC_APPLICATION_PROTOCOLS { - ProtocolListsSize: ::c_ulong, - ProtocolLists: [SEC_APPLICATION_PROTOCOL_LIST; 0], -}} -pub type PSEC_APPLICATION_PROTOCOLS = *mut SEC_APPLICATION_PROTOCOLS; -pub const SECURITY_NATIVE_DREP: ::c_ulong = 0x00000010; -pub const SECURITY_NETWORK_DREP: ::c_ulong = 0x00000000; -pub const SECPKG_CRED_INBOUND: ::c_ulong = 0x00000001; -pub const SECPKG_CRED_OUTBOUND: ::c_ulong = 0x00000002; -pub const SECPKG_CRED_BOTH: ::c_ulong = 0x00000003; -pub const SECPKG_CRED_DEFAULT: ::c_ulong = 0x00000004; -pub const SECPKG_CRED_RESERVED: ::c_ulong = 0xF0000000; -pub const SECPKG_CRED_AUTOLOGON_RESTRICTED: ::c_ulong = 0x00000010; -pub const SECPKG_CRED_PROCESS_POLICY_ONLY: ::c_ulong = 0x00000020; -pub const ISC_REQ_DELEGATE: ::c_ulong = 0x00000001; -pub const ISC_REQ_MUTUAL_AUTH: ::c_ulong = 0x00000002; -pub const ISC_REQ_REPLAY_DETECT: ::c_ulong = 0x00000004; -pub const ISC_REQ_SEQUENCE_DETECT: ::c_ulong = 0x00000008; -pub const ISC_REQ_CONFIDENTIALITY: ::c_ulong = 0x00000010; -pub const ISC_REQ_USE_SESSION_KEY: ::c_ulong = 0x00000020; -pub const ISC_REQ_PROMPT_FOR_CREDS: ::c_ulong = 0x00000040; -pub const ISC_REQ_USE_SUPPLIED_CREDS: ::c_ulong = 0x00000080; -pub const ISC_REQ_ALLOCATE_MEMORY: ::c_ulong = 0x00000100; -pub const ISC_REQ_USE_DCE_STYLE: ::c_ulong = 0x00000200; -pub const ISC_REQ_DATAGRAM: ::c_ulong = 0x00000400; -pub const ISC_REQ_CONNECTION: ::c_ulong = 0x00000800; -pub const ISC_REQ_CALL_LEVEL: ::c_ulong = 0x00001000; -pub const ISC_REQ_FRAGMENT_SUPPLIED: ::c_ulong = 0x00002000; -pub const ISC_REQ_EXTENDED_ERROR: ::c_ulong = 0x00004000; -pub const ISC_REQ_STREAM: ::c_ulong = 0x00008000; -pub const ISC_REQ_INTEGRITY: ::c_ulong = 0x00010000; -pub const ISC_REQ_IDENTIFY: ::c_ulong = 0x00020000; -pub const ISC_REQ_NULL_SESSION: ::c_ulong = 0x00040000; -pub const ISC_REQ_MANUAL_CRED_VALIDATION: ::c_ulong = 0x00080000; -pub const ISC_REQ_RESERVED1: ::c_ulong = 0x00100000; -pub const ISC_REQ_FRAGMENT_TO_FIT: ::c_ulong = 0x00200000; -pub const ISC_REQ_FORWARD_CREDENTIALS: ::c_ulong = 0x00400000; -pub const ISC_REQ_NO_INTEGRITY: ::c_ulong = 0x00800000; -pub const ISC_REQ_USE_HTTP_STYLE: ::c_ulong = 0x01000000; -pub const ISC_REQ_UNVERIFIED_TARGET_NAME: ::c_ulong = 0x20000000; -pub const ISC_REQ_CONFIDENTIALITY_ONLY: ::c_ulong = 0x40000000; -pub const ISC_RET_DELEGATE: ::c_ulong = 0x00000001; -pub const ISC_RET_MUTUAL_AUTH: ::c_ulong = 0x00000002; -pub const ISC_RET_REPLAY_DETECT: ::c_ulong = 0x00000004; -pub const ISC_RET_SEQUENCE_DETECT: ::c_ulong = 0x00000008; -pub const ISC_RET_CONFIDENTIALITY: ::c_ulong = 0x00000010; -pub const ISC_RET_USE_SESSION_KEY: ::c_ulong = 0x00000020; -pub const ISC_RET_USED_COLLECTED_CREDS: ::c_ulong = 0x00000040; -pub const ISC_RET_USED_SUPPLIED_CREDS: ::c_ulong = 0x00000080; -pub const ISC_RET_ALLOCATED_MEMORY: ::c_ulong = 0x00000100; -pub const ISC_RET_USED_DCE_STYLE: ::c_ulong = 0x00000200; -pub const ISC_RET_DATAGRAM: ::c_ulong = 0x00000400; -pub const ISC_RET_CONNECTION: ::c_ulong = 0x00000800; -pub const ISC_RET_INTERMEDIATE_RETURN: ::c_ulong = 0x00001000; -pub const ISC_RET_CALL_LEVEL: ::c_ulong = 0x00002000; -pub const ISC_RET_EXTENDED_ERROR: ::c_ulong = 0x00004000; -pub const ISC_RET_STREAM: ::c_ulong = 0x00008000; -pub const ISC_RET_INTEGRITY: ::c_ulong = 0x00010000; -pub const ISC_RET_IDENTIFY: ::c_ulong = 0x00020000; -pub const ISC_RET_NULL_SESSION: ::c_ulong = 0x00040000; -pub const ISC_RET_MANUAL_CRED_VALIDATION: ::c_ulong = 0x00080000; -pub const ISC_RET_RESERVED1: ::c_ulong = 0x00100000; -pub const ISC_RET_FRAGMENT_ONLY: ::c_ulong = 0x00200000; -pub const ISC_RET_FORWARD_CREDENTIALS: ::c_ulong = 0x00400000; -pub const ISC_RET_USED_HTTP_STYLE: ::c_ulong = 0x01000000; -pub const ISC_RET_NO_ADDITIONAL_TOKEN: ::c_ulong = 0x02000000; -pub const ISC_RET_REAUTHENTICATION: ::c_ulong = 0x08000000; -pub const ISC_RET_CONFIDENTIALITY_ONLY: ::c_ulong = 0x40000000; -pub const ASC_REQ_DELEGATE: ::c_ulong = 0x00000001; -pub const ASC_REQ_MUTUAL_AUTH: ::c_ulong = 0x00000002; -pub const ASC_REQ_REPLAY_DETECT: ::c_ulong = 0x00000004; -pub const ASC_REQ_SEQUENCE_DETECT: ::c_ulong = 0x00000008; -pub const ASC_REQ_CONFIDENTIALITY: ::c_ulong = 0x00000010; -pub const ASC_REQ_USE_SESSION_KEY: ::c_ulong = 0x00000020; -pub const ASC_REQ_SESSION_TICKET: ::c_ulong = 0x00000040; -pub const ASC_REQ_ALLOCATE_MEMORY: ::c_ulong = 0x00000100; -pub const ASC_REQ_USE_DCE_STYLE: ::c_ulong = 0x00000200; -pub const ASC_REQ_DATAGRAM: ::c_ulong = 0x00000400; -pub const ASC_REQ_CONNECTION: ::c_ulong = 0x00000800; -pub const ASC_REQ_CALL_LEVEL: ::c_ulong = 0x00001000; -pub const ASC_REQ_EXTENDED_ERROR: ::c_ulong = 0x00008000; -pub const ASC_REQ_STREAM: ::c_ulong = 0x00010000; -pub const ASC_REQ_INTEGRITY: ::c_ulong = 0x00020000; -pub const ASC_REQ_LICENSING: ::c_ulong = 0x00040000; -pub const ASC_REQ_IDENTIFY: ::c_ulong = 0x00080000; -pub const ASC_REQ_ALLOW_NULL_SESSION: ::c_ulong = 0x00100000; -pub const ASC_REQ_ALLOW_NON_USER_LOGONS: ::c_ulong = 0x00200000; -pub const ASC_REQ_ALLOW_CONTEXT_REPLAY: ::c_ulong = 0x00400000; -pub const ASC_REQ_FRAGMENT_TO_FIT: ::c_ulong = 0x00800000; -pub const ASC_REQ_FRAGMENT_SUPPLIED: ::c_ulong = 0x00002000; -pub const ASC_REQ_NO_TOKEN: ::c_ulong = 0x01000000; -pub const ASC_REQ_PROXY_BINDINGS: ::c_ulong = 0x04000000; -pub const ASC_REQ_ALLOW_MISSING_BINDINGS: ::c_ulong = 0x10000000; -pub const ASC_RET_DELEGATE: ::c_ulong = 0x00000001; -pub const ASC_RET_MUTUAL_AUTH: ::c_ulong = 0x00000002; -pub const ASC_RET_REPLAY_DETECT: ::c_ulong = 0x00000004; -pub const ASC_RET_SEQUENCE_DETECT: ::c_ulong = 0x00000008; -pub const ASC_RET_CONFIDENTIALITY: ::c_ulong = 0x00000010; -pub const ASC_RET_USE_SESSION_KEY: ::c_ulong = 0x00000020; -pub const ASC_RET_SESSION_TICKET: ::c_ulong = 0x00000040; -pub const ASC_RET_ALLOCATED_MEMORY: ::c_ulong = 0x00000100; -pub const ASC_RET_USED_DCE_STYLE: ::c_ulong = 0x00000200; -pub const ASC_RET_DATAGRAM: ::c_ulong = 0x00000400; -pub const ASC_RET_CONNECTION: ::c_ulong = 0x00000800; -pub const ASC_RET_CALL_LEVEL: ::c_ulong = 0x00002000; -pub const ASC_RET_THIRD_LEG_FAILED: ::c_ulong = 0x00004000; -pub const ASC_RET_EXTENDED_ERROR: ::c_ulong = 0x00008000; -pub const ASC_RET_STREAM: ::c_ulong = 0x00010000; -pub const ASC_RET_INTEGRITY: ::c_ulong = 0x00020000; -pub const ASC_RET_LICENSING: ::c_ulong = 0x00040000; -pub const ASC_RET_IDENTIFY: ::c_ulong = 0x00080000; -pub const ASC_RET_NULL_SESSION: ::c_ulong = 0x00100000; -pub const ASC_RET_ALLOW_NON_USER_LOGONS: ::c_ulong = 0x00200000; -pub const ASC_RET_ALLOW_CONTEXT_REPLAY: ::c_ulong = 0x00400000; -pub const ASC_RET_FRAGMENT_ONLY: ::c_ulong = 0x00800000; -pub const ASC_RET_NO_TOKEN: ::c_ulong = 0x01000000; -pub const ASC_RET_NO_ADDITIONAL_TOKEN: ::c_ulong = 0x02000000; -pub const SECPKG_CRED_ATTR_NAMES: ::c_ulong = 1; -pub const SECPKG_CRED_ATTR_SSI_PROVIDER: ::c_ulong = 2; -pub const SECPKG_CRED_ATTR_KDC_PROXY_SETTINGS: ::c_ulong = 3; -pub const SECPKG_CRED_ATTR_CERT: ::c_ulong = 4; -STRUCT!{struct SecPkgCredentials_NamesW { - sUserName: *mut SEC_WCHAR, -}} -pub type PSecPkgCredentials_NamesW = *mut SecPkgCredentials_NamesW; -STRUCT!{struct SecPkgCredentials_NamesA { - sUserName: *mut SEC_CHAR, -}} -pub type PSecPkgCredentials_NamesA = *mut SecPkgCredentials_NamesA; -STRUCT!{struct SecPkgCredentials_SSIProviderW { - sProviderName: *mut SEC_WCHAR, - ProviderInfoLength: ::c_ulong, - ProviderInfo: *mut ::c_char, -}} -pub type PSecPkgCredentials_SSIProviderW = *mut SecPkgCredentials_SSIProviderW; -STRUCT!{struct SecPkgCredentials_SSIProviderA { - sProviderName: *mut SEC_CHAR, - ProviderInfoLength: ::c_ulong, - ProviderInfo: *mut ::c_char, -}} -pub type PSecPkgCredentials_SSIProviderA = *mut SecPkgCredentials_SSIProviderA; -pub const KDC_PROXY_SETTINGS_V1: ::ULONG = 1; -pub const KDC_PROXY_SETTINGS_FLAGS_FORCEPROXY: ::ULONG = 0x1; -STRUCT!{struct SecPkgCredentials_KdcProxySettingsW { - Version: ::ULONG, - Flags: ::ULONG, - ProxyServerOffset: ::USHORT, - ProxyServerLength: ::USHORT, - ClientTlsCredOffset: ::USHORT, - ClientTlsCredLength: ::USHORT, -}} -pub type PSecPkgCredentials_KdcProxySettingsW = *mut SecPkgCredentials_KdcProxySettingsW; -STRUCT!{struct SecPkgCredentials_Cert { - EncodedCertSize: ::c_ulong, - EncodedCert: *mut ::c_uchar, -}} -pub type PSecPkgCredentials_Cert = *mut SecPkgCredentials_Cert; -pub const SECPKG_ATTR_SIZES: ::c_ulong = 0; -pub const SECPKG_ATTR_NAMES: ::c_ulong = 1; -pub const SECPKG_ATTR_LIFESPAN: ::c_ulong = 2; -pub const SECPKG_ATTR_DCE_INFO: ::c_ulong = 3; -pub const SECPKG_ATTR_STREAM_SIZES: ::c_ulong = 4; -pub const SECPKG_ATTR_KEY_INFO: ::c_ulong = 5; -pub const SECPKG_ATTR_AUTHORITY: ::c_ulong = 6; -pub const SECPKG_ATTR_PROTO_INFO: ::c_ulong = 7; -pub const SECPKG_ATTR_PASSWORD_EXPIRY: ::c_ulong = 8; -pub const SECPKG_ATTR_SESSION_KEY: ::c_ulong = 9; -pub const SECPKG_ATTR_PACKAGE_INFO: ::c_ulong = 10; -pub const SECPKG_ATTR_USER_FLAGS: ::c_ulong = 11; -pub const SECPKG_ATTR_NEGOTIATION_INFO: ::c_ulong = 12; -pub const SECPKG_ATTR_NATIVE_NAMES: ::c_ulong = 13; -pub const SECPKG_ATTR_FLAGS: ::c_ulong = 14; -pub const SECPKG_ATTR_USE_VALIDATED: ::c_ulong = 15; -pub const SECPKG_ATTR_CREDENTIAL_NAME: ::c_ulong = 16; -pub const SECPKG_ATTR_TARGET_INFORMATION: ::c_ulong = 17; -pub const SECPKG_ATTR_ACCESS_TOKEN: ::c_ulong = 18; -pub const SECPKG_ATTR_TARGET: ::c_ulong = 19; -pub const SECPKG_ATTR_AUTHENTICATION_ID: ::c_ulong = 20; -pub const SECPKG_ATTR_LOGOFF_TIME: ::c_ulong = 21; -pub const SECPKG_ATTR_NEGO_KEYS: ::c_ulong = 22; -pub const SECPKG_ATTR_PROMPTING_NEEDED: ::c_ulong = 24; -pub const SECPKG_ATTR_UNIQUE_BINDINGS: ::c_ulong = 25; -pub const SECPKG_ATTR_ENDPOINT_BINDINGS: ::c_ulong = 26; -pub const SECPKG_ATTR_CLIENT_SPECIFIED_TARGET: ::c_ulong = 27; -pub const SECPKG_ATTR_LAST_CLIENT_TOKEN_STATUS: ::c_ulong = 30; -pub const SECPKG_ATTR_NEGO_PKG_INFO: ::c_ulong = 31; -pub const SECPKG_ATTR_NEGO_STATUS: ::c_ulong = 32; -pub const SECPKG_ATTR_CONTEXT_DELETED: ::c_ulong = 33; -pub const SECPKG_ATTR_DTLS_MTU: ::c_ulong = 34; -pub const SECPKG_ATTR_DATAGRAM_SIZES: ::c_ulong = SECPKG_ATTR_STREAM_SIZES; -pub const SECPKG_ATTR_SUBJECT_SECURITY_ATTRIBUTES: ::c_ulong = 128; -pub const SECPKG_ATTR_APPLICATION_PROTOCOL: ::c_ulong = 35; -STRUCT!{struct SecPkgContext_SubjectAttributes { - AttributeInfo: *mut ::c_void, -}} -pub type PSecPkgContext_SubjectAttributes = *mut SecPkgContext_SubjectAttributes; -pub const SECPKG_ATTR_NEGO_INFO_FLAG_NO_KERBEROS: ::c_ulong = 0x1; -pub const SECPKG_ATTR_NEGO_INFO_FLAG_NO_NTLM: ::c_ulong = 0x2; -ENUM!{enum SECPKG_CRED_CLASS { - SecPkgCredClass_None = 0, - SecPkgCredClass_Ephemeral = 10, - SecPkgCredClass_PersistedGeneric = 20, - SecPkgCredClass_PersistedSpecific = 30, - SecPkgCredClass_Explicit = 40, -}} -pub type PSECPKG_CRED_CLASS = *mut SECPKG_CRED_CLASS; -STRUCT!{struct SecPkgContext_CredInfo { - CredClass: SECPKG_CRED_CLASS, - IsPromptingNeeded: ::c_ulong, -}} -pub type PSecPkgContext_CredInfo = *mut SecPkgContext_CredInfo; -STRUCT!{struct SecPkgContext_NegoPackageInfo { - PackageMask: ::c_ulong, -}} -pub type PSecPkgContext_NegoPackageInfo = *mut SecPkgContext_NegoPackageInfo; -STRUCT!{struct SecPkgContext_NegoStatus { - LastStatus: ::c_ulong, -}} -pub type PSecPkgContext_NegoStatus = *mut SecPkgContext_NegoStatus; -STRUCT!{struct SecPkgContext_Sizes { - cbMaxToken: ::c_ulong, - cbMaxSignature: ::c_ulong, - cbBlockSize: ::c_ulong, - cbSecurityTrailer: ::c_ulong, -}} -pub type PSecPkgContext_Sizes = *mut SecPkgContext_Sizes; -STRUCT!{struct SecPkgContext_StreamSizes { - cbHeader: ::c_ulong, - cbTrailer: ::c_ulong, - cbMaximumMessage: ::c_ulong, - cBuffers: ::c_ulong, - cbBlockSize: ::c_ulong, -}} -pub type PSecPkgContext_StreamSizes = *mut SecPkgContext_StreamSizes; -pub type SecPkgContext_DatagramSizes = SecPkgContext_StreamSizes; -pub type PSecPkgContext_DatagramSizes = PSecPkgContext_StreamSizes; -STRUCT!{struct SecPkgContext_NamesW { - sUserName: *mut SEC_WCHAR, -}} -pub type PSecPkgContext_NamesW = *mut SecPkgContext_NamesW; -ENUM!{enum SECPKG_ATTR_LCT_STATUS { - SecPkgAttrLastClientTokenYes, - SecPkgAttrLastClientTokenNo, - SecPkgAttrLastClientTokenMaybe, -}} -pub type PSECPKG_ATTR_LCT_STATUS = *mut SECPKG_ATTR_LCT_STATUS; -STRUCT!{struct SecPkgContext_LastClientTokenStatus { - LastClientTokenStatus: SECPKG_ATTR_LCT_STATUS, -}} -pub type PSecPkgContext_LastClientTokenStatus = *mut SecPkgContext_LastClientTokenStatus; -STRUCT!{struct SecPkgContext_NamesA { - sUserName: *mut SEC_CHAR, -}} -pub type PSecPkgContext_NamesA = *mut SecPkgContext_NamesA; -STRUCT!{struct SecPkgContext_Lifespan { - tsStart: TimeStamp, - tsExpiry: TimeStamp, -}} -pub type PSecPkgContext_Lifespan = *mut SecPkgContext_Lifespan; -STRUCT!{struct SecPkgContext_DceInfo { - AuthzSvc: ::c_ulong, - pPac: *mut ::c_void, -}} -pub type PSecPkgContext_DceInfo = *mut SecPkgContext_DceInfo; -STRUCT!{struct SecPkgContext_KeyInfoA { - sSignatureAlgorithmName: *mut ::SEC_CHAR, - sEncryptAlgorithmName: *mut ::SEC_CHAR, - KeySize: ::c_ulong, - SignatureAlgorithm: ::c_ulong, - EncryptAlgorithm: ::c_ulong, -}} -pub type PSecPkgContext_KeyInfoA = *mut SecPkgContext_KeyInfoA; -STRUCT!{struct SecPkgContext_KeyInfoW { - sSignatureAlgorithmName: *mut ::SEC_WCHAR, - sEncryptAlgorithmName: *mut ::SEC_WCHAR, - KeySize: ::c_ulong, - SignatureAlgorithm: ::c_ulong, - EncryptAlgorithm: ::c_ulong, -}} -pub type PSecPkgContext_KeyInfoW = *mut SecPkgContext_KeyInfoW; -STRUCT!{struct SecPkgContext_AuthorityA { - sAuthorityName: *mut SEC_CHAR, -}} -pub type PSecPkgContext_AuthorityA = *mut SecPkgContext_AuthorityA; -STRUCT!{struct SecPkgContext_AuthorityW { - sAuthorityName: *mut SEC_WCHAR, -}} -pub type PSecPkgContext_AuthorityW = *mut SecPkgContext_AuthorityW; -STRUCT!{struct SecPkgContext_ProtoInfoA { - sProtocolName: *mut SEC_CHAR, - majorVersion: ::c_ulong, - minorVersion: ::c_ulong, -}} -pub type PSecPkgContext_ProtoInfoA = *mut SecPkgContext_ProtoInfoA; -STRUCT!{struct SecPkgContext_ProtoInfoW { - sProtocolName: *mut SEC_WCHAR, - majorVersion: ::c_ulong, - minorVersion: ::c_ulong, -}} -pub type PSecPkgContext_ProtoInfoW = *mut SecPkgContext_ProtoInfoW; -STRUCT!{struct SecPkgContext_PasswordExpiry { - tsPasswordExpires: TimeStamp, -}} -pub type PSecPkgContext_PasswordExpiry = *mut SecPkgContext_PasswordExpiry; -STRUCT!{struct SecPkgContext_LogoffTime { - tsLogoffTime: TimeStamp, -}} -pub type PSecPkgContext_LogoffTime = *mut SecPkgContext_LogoffTime; -STRUCT!{struct SecPkgContext_SessionKey { - SessionKeyLength: ::c_ulong, - SessionKey: *mut ::c_uchar, -}} -pub type PSecPkgContext_SessionKey = *mut SecPkgContext_SessionKey; -STRUCT!{struct SecPkgContext_NegoKeys { - KeyType: ::c_ulong, - KeyLength: ::c_ushort, - KeyValue: *mut ::c_uchar, - VerifyKeyType: ::c_ulong, - VerifyKeyLength: ::c_ushort, - VerifyKeyValue: *mut ::c_uchar, -}} -pub type PSecPkgContext_NegoKeys = *mut SecPkgContext_NegoKeys; -STRUCT!{struct SecPkgContext_PackageInfoW { - PackageInfo: PSecPkgInfoW, -}} -pub type PSecPkgContext_PackageInfoW = *mut SecPkgContext_PackageInfoW; -STRUCT!{struct SecPkgContext_PackageInfoA { - PackageInfo: PSecPkgInfoA, -}} -pub type PSecPkgContext_PackageInfoA = *mut SecPkgContext_PackageInfoA; -STRUCT!{struct SecPkgContext_UserFlags { - UserFlags: ::c_ulong, -}} -pub type PSecPkgContext_UserFlags = *mut SecPkgContext_UserFlags; -STRUCT!{struct SecPkgContext_Flags { - Flags: ::c_ulong, -}} -pub type PSecPkgContext_Flags = *mut SecPkgContext_Flags; -STRUCT!{struct SecPkgContext_NegotiationInfoA { - PackageInfo: PSecPkgInfoA, - NegotiationState: ::c_ulong, -}} -pub type PSecPkgContext_NegotiationInfoA = *mut SecPkgContext_NegotiationInfoA; -STRUCT!{struct SecPkgContext_NegotiationInfoW { - PackageInfo: PSecPkgInfoW, - NegotiationState: ::c_ulong, -}} -pub type PSecPkgContext_NegotiationInfoW = *mut SecPkgContext_NegotiationInfoW; -pub const SECPKG_NEGOTIATION_COMPLETE: ::c_ulong = 0; -pub const SECPKG_NEGOTIATION_OPTIMISTIC: ::c_ulong = 1; -pub const SECPKG_NEGOTIATION_IN_PROGRESS: ::c_ulong = 2; -pub const SECPKG_NEGOTIATION_DIRECT: ::c_ulong = 3; -pub const SECPKG_NEGOTIATION_TRY_MULTICRED: ::c_ulong = 4; -STRUCT!{struct SecPkgContext_NativeNamesW { - sClientName: SEC_WCHAR, - sServerName: SEC_WCHAR, -}} -pub type PSecPkgContext_NativeNamesW = *mut SecPkgContext_NativeNamesW; -STRUCT!{struct SecPkgContext_NativeNamesA { - sClientName: SEC_CHAR, - sServerName: SEC_CHAR, -}} -pub type PSecPkgContext_NativeNamesA = *mut SecPkgContext_NativeNamesA; -STRUCT!{struct SecPkgContext_CredentialNameW { - CredentialType: ::c_ulong, - sCredentialName: *mut SEC_WCHAR, -}} -pub type PSecPkgContext_CredentialNameW = *mut SecPkgContext_CredentialNameW; -STRUCT!{struct SecPkgContext_CredentialNameA { - CredentialType: ::c_ulong, - sCredentialName: *mut SEC_CHAR, -}} -pub type PSecPkgContext_CredentialNameA = *mut SecPkgContext_CredentialNameA; -STRUCT!{struct SecPkgContext_AccessToken { - AccessToken: *mut ::c_void, -}} -pub type PSecPkgContext_AccessToken = *mut SecPkgContext_AccessToken; -STRUCT!{struct SecPkgContext_TargetInformation { - MarshalledTargetInfoLength: ::c_ulong, - MarshalledTargetInfo: *mut ::c_uchar, -}} -pub type PSecPkgContext_TargetInformation = *mut SecPkgContext_TargetInformation; -STRUCT!{struct SecPkgContext_AuthzID { - AuthzIDLength: ::c_ulong, - AuthzID: *mut ::c_char, -}} -pub type PSecPkgContext_AuthzID = *mut SecPkgContext_AuthzID; -STRUCT!{struct SecPkgContext_Target { - TargetLength: ::c_ulong, - Target: *mut ::c_char, -}} -pub type PSecPkgContext_Target = *mut SecPkgContext_Target; -STRUCT!{struct SecPkgContext_ClientSpecifiedTarget { - sTargetName: *mut SEC_WCHAR, -}} -pub type PSecPkgContext_ClientSpecifiedTarget = *mut SecPkgContext_ClientSpecifiedTarget; -STRUCT!{struct SecPkgContext_Bindings { - BindingsLength: ::c_ulong, - Bindings: *mut SEC_CHANNEL_BINDINGS, -}} -pub type PSecPkgContext_Bindings = *mut SecPkgContext_Bindings; -ENUM!{enum SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS { - SecApplicationProtocolNegotiationStatus_None, - SecApplicationProtocolNegotiationStatus_Success, - SecApplicationProtocolNegotiationStatus_SelectedClientOnly, -}} -pub type PSEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS = - *mut SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS; -pub const MAX_PROTOCOL_ID_SIZE: usize = 0xff; -STRUCT!{nodebug struct SecPkgContext_ApplicationProtocol { - ProtoNegoStatus: SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS, - ProtoNegoExt: SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT, - ProtocolIdSize: ::c_uchar, - ProtocolId: [::c_uchar; MAX_PROTOCOL_ID_SIZE], -}} -pub type PSecPkgContext_ApplicationProtocol = *mut SecPkgContext_ApplicationProtocol; -pub type SEC_GET_KEY_FN = Option; -pub const SECPKG_CONTEXT_EXPORT_RESET_NEW: ::c_ulong = 0x00000001; -pub const SECPKG_CONTEXT_EXPORT_DELETE_OLD: ::c_ulong = 0x00000002; -pub const SECPKG_CONTEXT_EXPORT_TO_KERNEL: ::c_ulong = 0x00000004; -pub type ACQUIRE_CREDENTIALS_HANDLE_FN_W = Option SECURITY_STATUS>; -pub type ACQUIRE_CREDENTIALS_HANDLE_FN_A = Option SECURITY_STATUS>; -pub type FREE_CREDENTIALS_HANDLE_FN = Option SECURITY_STATUS>; -pub type ADD_CREDENTIALS_FN_W = Option SECURITY_STATUS>; -pub type ADD_CREDENTIALS_FN_A = Option SECURITY_STATUS>; -pub type CHANGE_PASSWORD_FN_W = Option SECURITY_STATUS>; -pub type CHANGE_PASSWORD_FN_A = Option SECURITY_STATUS>; -//1844 -ENUM!{enum SecDelegationType { - SecFull, - SecService, - SecTree, - SecDirectory, - SecObject, -}} -pub type PSecDelegationType = *mut SecDelegationType; -STRUCT!{struct SEC_WINNT_AUTH_BYTE_VECTOR { - ByteArrayOffset: ::c_ulong, - ByteArrayLength: ::c_ushort, -}} -pub type PSEC_WINNT_AUTH_BYTE_VECTOR = *mut SEC_WINNT_AUTH_BYTE_VECTOR; -STRUCT!{struct SEC_WINNT_AUTH_DATA { - CredType: ::GUID, - CredData: SEC_WINNT_AUTH_BYTE_VECTOR, -}} -pub type PSEC_WINNT_AUTH_DATA = *mut SEC_WINNT_AUTH_DATA; -STRUCT!{struct SEC_WINNT_AUTH_PACKED_CREDENTIALS { - cbHeaderLength: ::c_ushort, - cbStructureLength: ::c_ushort, - AuthData: SEC_WINNT_AUTH_DATA, -}} -pub type PSEC_WINNT_AUTH_PACKED_CREDENTIALS = *mut SEC_WINNT_AUTH_PACKED_CREDENTIALS; -DEFINE_GUID!(SEC_WINNT_AUTH_DATA_TYPE_PASSWORD, 0x28bfc32f, 0x10f6, 0x4738, - 0x98, 0xd1, 0x1a, 0xc0, 0x61, 0xdf, 0x71, 0x6a); -DEFINE_GUID!(SEC_WINNT_AUTH_DATA_TYPE_CERT, 0x235f69ad, 0x73fb, 0x4dbc, - 0x82, 0x3, 0x6, 0x29, 0xe7, 0x39, 0x33, 0x9b); -STRUCT!{struct SEC_WINNT_AUTH_DATA_PASSWORD { - UnicodePassword: SEC_WINNT_AUTH_BYTE_VECTOR, -}} -pub type PSEC_WINNT_AUTH_DATA_PASSWORD = *mut SEC_WINNT_AUTH_DATA_PASSWORD; -DEFINE_GUID!(SEC_WINNT_AUTH_DATA_TYPE_CSP_DATA, 0x68fd9879, 0x79c, 0x4dfe, - 0x82, 0x81, 0x57, 0x8a, 0xad, 0xc1, 0xc1, 0x0); -STRUCT!{struct SEC_WINNT_AUTH_CERTIFICATE_DATA { - cbHeaderLength: ::c_ushort, - cbStructureLength: ::c_ushort, - Certificate: SEC_WINNT_AUTH_BYTE_VECTOR, -}} -pub type PSEC_WINNT_AUTH_CERTIFICATE_DATA = *mut SEC_WINNT_AUTH_CERTIFICATE_DATA; -STRUCT!{struct SEC_WINNT_CREDUI_CONTEXT_VECTOR { - CredUIContextArrayOffset: ::ULONG, - CredUIContextCount: ::USHORT, -}} -pub type PSEC_WINNT_CREDUI_CONTEXT_VECTOR = *mut SEC_WINNT_CREDUI_CONTEXT_VECTOR; -STRUCT!{struct SEC_WINNT_AUTH_SHORT_VECTOR { - ShortArrayOffset: ::ULONG, - ShortArrayCount: ::USHORT, -}} -pub type PSEC_WINNT_AUTH_SHORT_VECTOR = *mut SEC_WINNT_AUTH_SHORT_VECTOR; -STRUCT!{struct CREDUIWIN_MARSHALED_CONTEXT { - StructureType: ::GUID, - cbHeaderLength: ::USHORT, - LogonId: ::LUID, - MarshaledDataType: ::GUID, - MarshaledDataOffset: ::ULONG, - MarshaledDataLength: ::USHORT, -}} -pub type PCREDUIWIN_MARSHALED_CONTEXT = *mut CREDUIWIN_MARSHALED_CONTEXT; -STRUCT!{struct SEC_WINNT_CREDUI_CONTEXT { - cbHeaderLength: ::USHORT, - CredUIContextHandle: ::HANDLE, - UIInfo: ::PCREDUI_INFOW, - dwAuthError: ::ULONG, - pInputAuthIdentity: PSEC_WINNT_AUTH_IDENTITY_OPAQUE, - TargetName: ::PUNICODE_STRING, -}} -pub type PSEC_WINNT_CREDUI_CONTEXT = *mut SEC_WINNT_CREDUI_CONTEXT; -pub type PSEC_WINNT_AUTH_IDENTITY_OPAQUE = ::PVOID; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/strmif.rs cargo-0.37.0/vendor/winapi-0.2.8/src/strmif.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/strmif.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/strmif.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -// Copyright © 2016, Peter Atashian -// Licensed under the MIT License -use super::*; -pub type REFERENCE_TIME = LONGLONG; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/subauth.rs cargo-0.37.0/vendor/winapi-0.2.8/src/subauth.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/subauth.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/subauth.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,198 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! Types and macros for Subauthentication Packages. -STRUCT!{struct UNICODE_STRING { - Length: ::USHORT, - MaximumLength: ::USHORT, - Buffer: ::PWSTR, -}} -pub type PUNICODE_STRING = *mut UNICODE_STRING; -STRUCT!{struct STRING { - Length: ::USHORT, - MaximumLength: ::USHORT, - Buffer: ::PCHAR, -}} -pub type PSTRING = *mut STRING; -STRUCT!{struct OLD_LARGE_INTEGER { - LowPart: ::ULONG, - HighPart: ::LONG, -}} -pub type POLD_LARGE_INTEGER = *mut OLD_LARGE_INTEGER; -pub type SAM_HANDLE = ::PVOID; -pub type PSAM_HANDLE = *mut ::PVOID; -pub const USER_ACCOUNT_DISABLED: ::ULONG = 0x00000001; -pub const USER_HOME_DIRECTORY_REQUIRED: ::ULONG = 0x00000002; -pub const USER_PASSWORD_NOT_REQUIRED: ::ULONG = 0x00000004; -pub const USER_TEMP_DUPLICATE_ACCOUNT: ::ULONG = 0x00000008; -pub const USER_NORMAL_ACCOUNT: ::ULONG = 0x00000010; -pub const USER_MNS_LOGON_ACCOUNT: ::ULONG = 0x00000020; -pub const USER_INTERDOMAIN_TRUST_ACCOUNT: ::ULONG = 0x00000040; -pub const USER_WORKSTATION_TRUST_ACCOUNT: ::ULONG = 0x00000080; -pub const USER_SERVER_TRUST_ACCOUNT: ::ULONG = 0x00000100; -pub const USER_DONT_EXPIRE_PASSWORD: ::ULONG = 0x00000200; -pub const USER_ACCOUNT_AUTO_LOCKED: ::ULONG = 0x00000400; -pub const USER_ENCRYPTED_TEXT_PASSWORD_ALLOWED: ::ULONG = 0x00000800; -pub const USER_SMARTCARD_REQUIRED: ::ULONG = 0x00001000; -pub const USER_TRUSTED_FOR_DELEGATION: ::ULONG = 0x00002000; -pub const USER_NOT_DELEGATED: ::ULONG = 0x00004000; -pub const USER_USE_DES_KEY_ONLY: ::ULONG = 0x00008000; -pub const USER_DONT_REQUIRE_PREAUTH: ::ULONG = 0x00010000; -pub const USER_PASSWORD_EXPIRED: ::ULONG = 0x00020000; -pub const USER_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION: ::ULONG = 0x00040000; -pub const USER_NO_AUTH_DATA_REQUIRED: ::ULONG = 0x00080000; -pub const USER_PARTIAL_SECRETS_ACCOUNT: ::ULONG = 0x00100000; -pub const USER_USE_AES_KEYS: ::ULONG = 0x00200000; -pub const NEXT_FREE_ACCOUNT_CONTROL_BIT: ::ULONG = USER_USE_AES_KEYS << 1; -pub const USER_MACHINE_ACCOUNT_MASK: ::ULONG = USER_INTERDOMAIN_TRUST_ACCOUNT - | USER_WORKSTATION_TRUST_ACCOUNT | USER_SERVER_TRUST_ACCOUNT; -pub const USER_ACCOUNT_TYPE_MASK: ::ULONG = USER_TEMP_DUPLICATE_ACCOUNT | USER_NORMAL_ACCOUNT - | USER_MACHINE_ACCOUNT_MASK; -pub const USER_COMPUTED_ACCOUNT_CONTROL_BITS: ::ULONG = USER_ACCOUNT_AUTO_LOCKED -| USER_PASSWORD_EXPIRED; -pub const SAM_DAYS_PER_WEEK: ::USHORT = 7; -pub const SAM_HOURS_PER_WEEK: ::USHORT = 24 * SAM_DAYS_PER_WEEK; -pub const SAM_MINUTES_PER_WEEK: ::USHORT = 60 * SAM_HOURS_PER_WEEK; -STRUCT!{struct LOGON_HOURS { - UnitsPerWeek: ::USHORT, - LogonHours: ::PUCHAR, -}} -pub type PLOGON_HOURS = *mut LOGON_HOURS; -STRUCT!{struct SR_SECURITY_DESCRIPTOR { - Length: ::ULONG, - SecurityDescriptor: ::PUCHAR, -}} -pub type PSR_SECURITY_DESCRIPTOR = *mut SR_SECURITY_DESCRIPTOR; -STRUCT!{struct USER_ALL_INFORMATION { - LastLogon: ::LARGE_INTEGER, - LastLogoff: ::LARGE_INTEGER, - PasswordLastSet: ::LARGE_INTEGER, - AccountExpires: ::LARGE_INTEGER, - PasswordCanChange: ::LARGE_INTEGER, - PasswordMustChange: ::LARGE_INTEGER, - UserName: UNICODE_STRING, - FullName: UNICODE_STRING, - HomeDirectory: UNICODE_STRING, - HomeDirectoryDrive: UNICODE_STRING, - ScriptPath: UNICODE_STRING, - ProfilePath: UNICODE_STRING, - AdminComment: UNICODE_STRING, - WorkStations: UNICODE_STRING, - UserComment: UNICODE_STRING, - Parameters: UNICODE_STRING, - LmPassword: UNICODE_STRING, - NtPassword: UNICODE_STRING, - PrivateData: UNICODE_STRING, - SecurityDescriptor: SR_SECURITY_DESCRIPTOR, - UserId: ::ULONG, - PrimaryGroupId: ::ULONG, - UserAccountControl: ::ULONG, - WhichFields: ::ULONG, - LogonHours: LOGON_HOURS, - BadPasswordCount: ::USHORT, - LogonCount: ::USHORT, - CountryCode: ::USHORT, - CodePage: ::USHORT, - LmPasswordPresent: ::BOOLEAN, - NtPasswordPresent: ::BOOLEAN, - PasswordExpired: ::BOOLEAN, - PrivateDataSensitive: ::BOOLEAN, -}} -pub type PUSER_ALL_INFORMATION = *mut USER_ALL_INFORMATION; -pub const USER_ALL_PARAMETERS: ::ULONG = 0x00200000; -pub const CLEAR_BLOCK_LENGTH: usize = 8; -STRUCT!{struct CLEAR_BLOCK { - data: [::CHAR; CLEAR_BLOCK_LENGTH], -}} -pub type PCLEAR_BLOCK = *mut CLEAR_BLOCK; -pub const CYPHER_BLOCK_LENGTH: usize = 8; -STRUCT!{struct CYPHER_BLOCK { - data: [::CHAR; CYPHER_BLOCK_LENGTH], -}} -pub type PCYPHER_BLOCK = *mut CYPHER_BLOCK; -STRUCT!{struct LM_OWF_PASSWORD { - data: [CYPHER_BLOCK; 2], -}} -pub type PLM_OWF_PASSWORD = *mut LM_OWF_PASSWORD; -pub type LM_CHALLENGE = CLEAR_BLOCK; -pub type PLM_CHALLENGE = *mut LM_CHALLENGE; -pub type NT_OWF_PASSWORD = LM_OWF_PASSWORD; -pub type PNT_OWF_PASSWORD = *mut NT_OWF_PASSWORD; -pub type NT_CHALLENGE = LM_CHALLENGE; -pub type PNT_CHALLENGE = *mut NT_CHALLENGE; -pub const USER_SESSION_KEY_LENGTH: usize = CYPHER_BLOCK_LENGTH * 2; -STRUCT!{struct USER_SESSION_KEY { - data: [CYPHER_BLOCK; 2], -}} -pub type PUSER_SESSION_KEY = *mut USER_SESSION_KEY; -ENUM!{enum NETLOGON_LOGON_INFO_CLASS { - NetlogonInteractiveInformation = 1, - NetlogonNetworkInformation, - NetlogonServiceInformation, - NetlogonGenericInformation, - NetlogonInteractiveTransitiveInformation, - NetlogonNetworkTransitiveInformation, - NetlogonServiceTransitiveInformation, -}} -STRUCT!{struct NETLOGON_LOGON_IDENTITY_INFO { - LogonDomainName: UNICODE_STRING, - ParameterControl: ::ULONG, - LogonId: OLD_LARGE_INTEGER, - UserName: UNICODE_STRING, - Workstation: UNICODE_STRING, -}} -pub type PNETLOGON_LOGON_IDENTITY_INFO = *mut NETLOGON_LOGON_IDENTITY_INFO; -STRUCT!{struct NETLOGON_INTERACTIVE_INFO { - Identity: NETLOGON_LOGON_IDENTITY_INFO, - LmOwfPassword: LM_OWF_PASSWORD, - NtOwfPassword: NT_OWF_PASSWORD, -}} -pub type PNETLOGON_INTERACTIVE_INFO = *mut NETLOGON_INTERACTIVE_INFO; -STRUCT!{struct NETLOGON_SERVICE_INFO { - Identity: NETLOGON_LOGON_IDENTITY_INFO, - LmOwfPassword: LM_OWF_PASSWORD, - NtOwfPassword: NT_OWF_PASSWORD, -}} -pub type PNETLOGON_SERVICE_INFO = *mut NETLOGON_SERVICE_INFO; -STRUCT!{struct NETLOGON_NETWORK_INFO { - Identity: NETLOGON_LOGON_IDENTITY_INFO, - LmChallenge: LM_CHALLENGE, - NtChallengeResponse: STRING, - LmChallengeResponse: STRING, -}} -pub type PNETLOGON_NETWORK_INFO = *mut NETLOGON_NETWORK_INFO; -STRUCT!{struct NETLOGON_GENERIC_INFO { - Identity: NETLOGON_LOGON_IDENTITY_INFO, - PackageName: UNICODE_STRING, - DataLength: ::ULONG, - LogonData: ::PUCHAR, -}} -pub type PNETLOGON_GENERIC_INFO = *mut NETLOGON_GENERIC_INFO; -pub const MSV1_0_PASSTHRU: ::ULONG = 0x01; -pub const MSV1_0_GUEST_LOGON: ::ULONG = 0x02; -STRUCT!{struct MSV1_0_VALIDATION_INFO { - LogoffTime: ::LARGE_INTEGER, - KickoffTime: ::LARGE_INTEGER, - LogonServer: UNICODE_STRING, - LogonDomainName: UNICODE_STRING, - SessionKey: USER_SESSION_KEY, - Authoritative: ::BOOLEAN, - UserFlags: ::ULONG, - WhichFields: ::ULONG, - UserId: ::ULONG, -}} -pub type PMSV1_0_VALIDATION_INFO = *mut MSV1_0_VALIDATION_INFO; -pub const MSV1_0_VALIDATION_LOGOFF_TIME: ::ULONG = 0x00000001; -pub const MSV1_0_VALIDATION_KICKOFF_TIME: ::ULONG = 0x00000002; -pub const MSV1_0_VALIDATION_LOGON_SERVER: ::ULONG = 0x00000004; -pub const MSV1_0_VALIDATION_LOGON_DOMAIN: ::ULONG = 0x00000008; -pub const MSV1_0_VALIDATION_SESSION_KEY: ::ULONG = 0x00000010; -pub const MSV1_0_VALIDATION_USER_FLAGS: ::ULONG = 0x00000020; -pub const MSV1_0_VALIDATION_USER_ID: ::ULONG = 0x00000040; -pub const MSV1_0_SUBAUTH_ACCOUNT_DISABLED: ::ULONG = 0x00000001; -pub const MSV1_0_SUBAUTH_PASSWORD: ::ULONG = 0x00000002; -pub const MSV1_0_SUBAUTH_WORKSTATIONS: ::ULONG = 0x00000004; -pub const MSV1_0_SUBAUTH_LOGON_HOURS: ::ULONG = 0x00000008; -pub const MSV1_0_SUBAUTH_ACCOUNT_EXPIRY: ::ULONG = 0x00000010; -pub const MSV1_0_SUBAUTH_PASSWORD_EXPIRY: ::ULONG = 0x00000020; -pub const MSV1_0_SUBAUTH_ACCOUNT_TYPE: ::ULONG = 0x00000040; -pub const MSV1_0_SUBAUTH_LOCKOUT: ::ULONG = 0x00000080; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/synchapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/synchapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/synchapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/synchapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! ApiSet Contract for api-ms-win-core-synch-l1 -pub type SRWLOCK = ::RTL_SRWLOCK; -pub type PSRWLOCK = *mut ::RTL_SRWLOCK; -pub type SYNCHRONIZATION_BARRIER = ::RTL_BARRIER; -pub type PSYNCHRONIZATION_BARRIER = ::PRTL_BARRIER; -pub type LPSYNCHRONIZATION_BARRIER = ::PRTL_BARRIER; -pub type PINIT_ONCE_FN = Option ::BOOL>; -pub type PTIMERAPCROUTINE = Option; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/sysinfoapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/sysinfoapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/sysinfoapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/sysinfoapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! ApiSet Contract for api-ms-win-core-sysinfo-l1. -STRUCT!{struct SYSTEM_INFO { - wProcessorArchitecture: ::WORD, - wReserved: ::WORD, - dwPageSize: ::DWORD, - lpMinimumApplicationAddress: ::LPVOID, - lpMaximumApplicationAddress: ::LPVOID, - dwActiveProcessorMask: ::DWORD_PTR, - dwNumberOfProcessors: ::DWORD, - dwProcessorType: ::DWORD, - dwAllocationGranularity: ::DWORD, - wProcessorLevel: ::WORD, - wProcessorRevision: ::WORD, -}} -UNION!(SYSTEM_INFO, wProcessorArchitecture, dwOemId, dwOemId_mut, ::DWORD); -pub type LPSYSTEM_INFO = *mut SYSTEM_INFO; -STRUCT!{struct MEMORYSTATUSEX { - dwLength: ::DWORD, - dwMemoryLoad: ::DWORD, - ullTotalPhys: ::DWORDLONG, - ullAvailPhys: ::DWORDLONG, - ullTotalPageFile: ::DWORDLONG, - ullAvailPageFile: ::DWORDLONG, - ullTotalVirtual: ::DWORDLONG, - ullAvailVirtual: ::DWORDLONG, - ullAvailExtendedVirtual: ::DWORDLONG, -}} -pub type LPMEMORYSTATUSEX = *mut MEMORYSTATUSEX; -ENUM!{enum COMPUTER_NAME_FORMAT { - ComputerNameNetBIOS, - ComputerNameDnsHostname, - ComputerNameDnsDomain, - ComputerNameDnsFullyQualified, - ComputerNamePhysicalNetBIOS, - ComputerNamePhysicalDnsHostname, - ComputerNamePhysicalDnsDomain, - ComputerNamePhysicalDnsFullyQualified, - ComputerNameMax, -}} -pub type INIT_ONCE = ::RTL_RUN_ONCE; -pub type PINIT_ONCE = ::PRTL_RUN_ONCE; -pub type LPINIT_ONCE = ::PRTL_RUN_ONCE; -pub type CONDITION_VARIABLE = ::RTL_CONDITION_VARIABLE; -pub type PCONDITION_VARIABLE = *mut CONDITION_VARIABLE; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/threadpoolapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/threadpoolapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/threadpoolapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/threadpoolapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! ApiSet Contract for api-ms-win-core-threadpool-l1. -pub type PTP_WIN32_IO_CALLBACK = Option; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/timezoneapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/timezoneapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/timezoneapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/timezoneapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! ApiSet Contract for api-ms-win-core-timezone-l1 -pub const TIME_ZONE_ID_INVALID: ::DWORD = 0xFFFFFFFF; -STRUCT!{struct TIME_ZONE_INFORMATION { - Bias: ::LONG, - StandardName: [::WCHAR; 32], - StandardDate: ::SYSTEMTIME, - StandardBias: ::LONG, - DaylightName: [::WCHAR; 32], - DaylightDate: ::SYSTEMTIME, - DaylightBias: ::LONG, -}} -pub type PTIME_ZONE_INFORMATION = *mut TIME_ZONE_INFORMATION; -pub type LPTIME_ZONE_INFORMATION = *mut TIME_ZONE_INFORMATION; -STRUCT!{nodebug struct DYNAMIC_TIME_ZONE_INFORMATION { - Bias: ::LONG, - StandardName: [::WCHAR; 32], - StandardDate: ::SYSTEMTIME, - StandardBias: ::LONG, - DaylightName: [::WCHAR; 32], - DaylightDate: ::SYSTEMTIME, - DaylightBias: ::LONG, - TimeZoneKeyName: [::WCHAR; 128], - DynamicDaylightTimeDisabled: ::BOOLEAN, -}} -pub type PDYNAMIC_TIME_ZONE_INFORMATION = *mut DYNAMIC_TIME_ZONE_INFORMATION; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/tlhelp32.rs cargo-0.37.0/vendor/winapi-0.2.8/src/tlhelp32.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/tlhelp32.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/tlhelp32.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,104 +0,0 @@ -// Copyright © 2015, Gigih Aji Ibrahim -// Licensed under the MIT License -pub const MAX_MODULE_NAME32: usize = 255; -pub const TH32CS_SNAPHEAPLIST: ::DWORD = 0x00000001; -pub const TH32CS_SNAPPROCESS: ::DWORD = 0x00000002; -pub const TH32CS_SNAPTHREAD: ::DWORD = 0x00000004; -pub const TH32CS_SNAPMODULE: ::DWORD = 0x00000008; -pub const TH32CS_SNAPMODULE32: ::DWORD = 0x00000010; -pub const TH32CS_SNAPALL: ::DWORD = - (TH32CS_SNAPHEAPLIST | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD | TH32CS_SNAPMODULE); -pub const TH32CS_INHERIT: ::DWORD = 0x80000000; -STRUCT!{struct HEAPLIST32 { - dwSize: ::SIZE_T, - th32ProcessID: ::DWORD, - th32HeapID: :: ULONG_PTR, - dwFlags: ::DWORD, -}} -pub type PHEAPLIST32 = *mut HEAPLIST32; -pub type LPHEAPLIST32 = *mut HEAPLIST32; -pub const HF32_DEFAULT: ::DWORD = 1; -pub const HF32_SHARED: ::DWORD = 2; -STRUCT!{struct HEAPENTRY32 { - dwSize: ::SIZE_T, - hHandle: ::HANDLE, - dwAddress: ::ULONG_PTR, - dwBlockSize: ::SIZE_T, - dwFlags: ::DWORD, - dwLockCount: ::DWORD, - dwResvd: ::DWORD, - th32ProcessID: ::DWORD, - th32HeapID: ::ULONG_PTR, -}} -pub type PHEAPENTRY32 = *mut HEAPENTRY32; -pub type LPHEAPENTRY32 = *mut HEAPENTRY32; -pub const LF32_FIXED: ::DWORD = 0x00000001; -pub const LF32_FREE: ::DWORD = 0x00000002; -pub const LF32_MOVEABLE: ::DWORD = 0x00000004; -STRUCT!{nodebug struct PROCESSENTRY32W { - dwSize: ::DWORD, - cntUsage: ::DWORD, - th32ProcessID: ::DWORD, - th32DefaultHeapID: ::ULONG_PTR, - th32ModuleID: ::DWORD, - cntThreads: ::DWORD, - th32ParentProcessID: ::DWORD, - pcPriClassBase: ::LONG, - dwFlags: ::DWORD, - szExeFile: [::WCHAR; ::MAX_PATH], -}} -pub type PPROCESSENTRY32W = *mut PROCESSENTRY32W; -pub type LPPROCESSENTRY32W = *mut PROCESSENTRY32W; -STRUCT!{nodebug struct PROCESSENTRY32 { - dwSize: ::DWORD, - cntUsage: ::DWORD, - th32ProcessID: ::DWORD, - th32DefaultHeapID: ::ULONG_PTR, - th32ModuleID: ::DWORD, - cntThreads: ::DWORD, - th32ParentProcessID: ::DWORD, - pcPriClassBase: ::LONG, - dwFlags: ::DWORD, - szExeFile: [::CHAR; ::MAX_PATH], -}} -pub type PPROCESSENTRY32 = *mut PROCESSENTRY32; -pub type LPPROCESSENTRY32 = *mut PROCESSENTRY32; -STRUCT!{struct THREADENTRY32 { - dwSize: ::DWORD, - cntUsage: ::DWORD, - th32ThreadID: ::DWORD, - th32OwnerProcessID: ::DWORD, - tpBasePri: ::LONG, - tpDeltaPri: ::LONG, - dwFlags: ::DWORD, -}} -pub type PTHREADENTRY32 = *mut THREADENTRY32; -pub type LPTHREADENTRY32 = *mut THREADENTRY32; -STRUCT!{nodebug struct MODULEENTRY32W { - dwSize: ::DWORD, - th32ModuleID: ::DWORD, - th32ProcessID: ::DWORD, - GlblcntUsage: ::DWORD, - ProccntUsage: ::DWORD, - modBaseAddr: *mut ::BYTE, - modBaseSize: ::DWORD, - hModule: ::HMODULE, - szModule: [::WCHAR; ::MAX_MODULE_NAME32 + 1], - szExePath: [::WCHAR; ::MAX_PATH], -}} -pub type PMODULEENTRY32W = *mut MODULEENTRY32W; -pub type LPMODULEENTRY32W = *mut MODULEENTRY32W; -STRUCT!{nodebug struct MODULEENTRY32 { - dwSize: ::DWORD, - th32ModuleID: ::DWORD, - th32ProcessID: ::DWORD, - GlblcntUsage: ::DWORD, - ProccntUsage: ::DWORD, - modBaseAddr: *mut ::BYTE, - modBaseSize: ::DWORD, - hModule: ::HMODULE, - szModule: [::CHAR; ::MAX_MODULE_NAME32 + 1], - szExePath: [::CHAR; ::MAX_PATH], -}} -pub type PMODULEENTRY32 = *mut MODULEENTRY32; -pub type LPMODULEENTRY32 = *mut MODULEENTRY32; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/unknwnbase.rs cargo-0.37.0/vendor/winapi-0.2.8/src/unknwnbase.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/unknwnbase.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/unknwnbase.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! this ALWAYS GENERATED file contains the definitions for the interfaces -RIDL!( -interface IUnknown(IUnknownVtbl) { - fn QueryInterface(&mut self, riid: ::REFIID, ppvObject: *mut *mut ::c_void) -> ::HRESULT, - fn AddRef(&mut self) -> ::ULONG, - fn Release(&mut self) -> ::ULONG -} -); -pub type LPUNKNOWN = *mut IUnknown; -RIDL!( -interface AsyncIUnknown(AsyncIUnknownVtbl): IUnknown(IUnknownVtbl) { - fn Begin_QueryInterface(&mut self, riid: ::REFIID) -> ::HRESULT, - fn Finish_QueryInterface(&mut self, ppvObject: *mut *mut ::c_void) -> ::HRESULT, - fn Begin_AddRef(&mut self) -> ::HRESULT, - fn Finish_AddRef(&mut self) -> ::ULONG, - fn Begin_Release(&mut self) -> ::HRESULT, - fn Finish_Release(&mut self) -> ::ULONG -} -); -RIDL!( -interface IClassFactory(IClassFactoryVtbl): IUnknown(IUnknownVtbl) { - fn CreateInstance( - &mut self, pUnkOuter: *mut IUnknown, riid: ::REFIID, ppvObject: *mut *mut ::c_void - ) -> ::HRESULT, - fn LockServer(&mut self, fLock: ::BOOL) -> ::HRESULT -} -); diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/urlhist.rs cargo-0.37.0/vendor/winapi-0.2.8/src/urlhist.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/urlhist.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/urlhist.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Url History Interfaces -pub const STATURL_QUERYFLAG_ISCACHED: ::DWORD = 0x00010000; -pub const STATURL_QUERYFLAG_NOURL: ::DWORD = 0x00020000; -pub const STATURL_QUERYFLAG_NOTITLE: ::DWORD = 0x00040000; -pub const STATURL_QUERYFLAG_TOPLEVEL: ::DWORD = 0x00080000; -pub const STATURLFLAG_ISCACHED: ::DWORD = 0x00000001; -pub const STATURLFLAG_ISTOPLEVEL: ::DWORD = 0x00000002; -ENUM!{enum ADDURL_FLAG { - ADDURL_FIRST = 0, - ADDURL_ADDTOHISTORYANDCACHE = 0, - ADDURL_ADDTOCACHE = 1, - ADDURL_Max = 2147483647, -}} -pub type LPENUMSTATURL = *mut IEnumSTATURL; -STRUCT!{struct STATURL { - cbSize: ::DWORD, - pwcsUrl: ::LPWSTR, - pwcsTitle: ::LPWSTR, - ftLastVisited: ::FILETIME, - ftLastUpdated: ::FILETIME, - ftExpires: ::FILETIME, - dwFlags: ::DWORD, -}} -pub type LPSTATURL = *mut STATURL; -RIDL!{interface IEnumSTATURL(IEnumSTATURLVtbl): IUnknown(IUnknownVtbl) { - fn Next(&mut self, celt: ::ULONG, rgelt: LPSTATURL, pceltFetched: *mut ::ULONG) -> ::HRESULT, - fn Skip(&mut self, celt: ::ULONG) -> ::HRESULT, - fn Reset(&mut self) -> ::HRESULT, - fn Clone(&mut self, ppenum: *mut *mut ::IEnumSTATURL) -> ::HRESULT, - fn SetFilter(&mut self, poszFilter: ::LPCOLESTR, dwFlags: ::DWORD) -> ::HRESULT -}} -pub type LPURLHISTORYSTG = *mut IUrlHistoryStg; -RIDL!{interface IUrlHistoryStg(IUrlHistoryStgVtbl): IUnknown(IUnknownVtbl) { - fn AddUrl(&mut self, pocsUrl: ::LPCOLESTR) -> ::HRESULT, - fn DeleteUrl(&mut self, pocsUrl: ::LPCOLESTR, dwFlags: ::DWORD) -> ::HRESULT, - fn QueryUrl( - &mut self, pocsUrl: ::LPCOLESTR, dwFlags: ::DWORD, lpSTATURL: LPSTATURL - ) -> ::HRESULT, - fn BindToObject( - &mut self, pocsUrl: ::LPCOLESTR, riid: ::REFIID, ppvOut: *mut *mut ::c_void - ) -> ::HRESULT, - fn EnumUrls(&mut self, ppEnum: *mut *mut ::IEnumSTATURL) -> ::HRESULT -}} -pub type LPURLHISTORYSTG2 = *mut IUrlHistoryStg2; -RIDL!{interface IUrlHistoryStg2(IUrlHistoryStg2Vtbl): IUrlHistoryStg(IUrlHistoryStgVtbl) { - fn AddUrlAndNotify( - &mut self, pocsUrl: ::LPCOLESTR, pocsTitle: ::LPCOLESTR, dwFlags: ::DWORD, - fWriteHistory: ::BOOL, poctNotify: *mut ::IOleCommandTarget, punkISFolder: *mut ::IUnknown - ) -> ::HRESULT, - fn ClearHistory(&mut self) -> ::HRESULT -}} -pub type LPURLHISTORYNOTIFY = *mut IUrlHistoryNotify; -RIDL!{interface IUrlHistoryNotify(IUrlHistoryNotifyVtbl): - IOleCommandTarget(IOleCommandTargetVtbl) {}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/urlmon.rs cargo-0.37.0/vendor/winapi-0.2.8/src/urlmon.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/urlmon.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/urlmon.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -// Copyright © 2015, Connor Hilarides -// Licensed under the MIT License -//! Mappings for the contents of Urlmon.h -// FIXME: Implement these interfaces -#[repr(C)] #[derive(Clone, Copy, Debug)] -pub struct IInternetSecurityManager; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/usb.rs cargo-0.37.0/vendor/winapi-0.2.8/src/usb.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/usb.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/usb.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -// Copyright © 2016, bitbegin -// Licensed under the MIT License -//! USB Definitions. -ENUM!{enum USBD_PIPE_TYPE { - UsbdPipeTypeControl, - UsbdPipeTypeIsochronous, - UsbdPipeTypeBulk, - UsbdPipeTypeInterrupt, -}} - -pub type USBD_STATUS = ::LONG; - -STRUCT!{struct USBD_ISO_PACKET_DESCRIPTOR { - Offset: ::ULONG, - Length: ::ULONG, - Status: ::USBD_STATUS, -}} -pub type PUSBD_ISO_PACKET_DESCRIPTOR = *mut USBD_ISO_PACKET_DESCRIPTOR; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/usbspec.rs cargo-0.37.0/vendor/winapi-0.2.8/src/usbspec.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/usbspec.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/usbspec.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -// Copyright © 2016, bitbegin -// Licensed under the MIT License -//! USB Spec Definitions. -ENUM!{enum USB_DEVICE_SPEED { - UsbLowSpeed = 0, - UsbFullSpeed, - UsbHighSpeed, - UsbSuperSpeed, -}} -ENUM!{enum USB_DEVICE_TYPE { - Usb11Device = 0, - Usb20Device, -}} -STRUCT!{struct BM_REQUEST_TYPE { - _BM: ::UCHAR, - B: ::UCHAR, -}} -BITFIELD!{BM_REQUEST_TYPE _BM: ::UINT8 [ - Recipient set_Recipient[0..2], - Reserved set_Reserved[2..5], - Type set_Type[5..7], - Dir set_Dir[7..8], -]} -pub type PBM_REQUEST_TYPE = *mut BM_REQUEST_TYPE; - -STRUCT!{#[repr(packed)] struct USB_CONFIGURATION_DESCRIPTOR { - bLength: ::UCHAR, - bDescriptorType: ::UCHAR, - wTotalLength: ::USHORT, - bNumInterfaces: ::UCHAR, - bConfigurationValue: ::UCHAR, - iConfiguration: ::UCHAR, - bmAttributes: ::UCHAR, - MaxPower: ::UCHAR, -}} -pub type PUSB_CONFIGURATION_DESCRIPTOR = *mut USB_CONFIGURATION_DESCRIPTOR; -#[test] -fn test_USB_CONFIGURATION_DESCRIPTOR_size() { - use std::mem::size_of; - assert_eq!(size_of::(), 9) -} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/usp10.rs cargo-0.37.0/vendor/winapi-0.2.8/src/usp10.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/usp10.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/usp10.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,201 +0,0 @@ -// Copyright © 2015, Jordan Miner -// Licensed under the MIT License -//! Uniscribe structure declarations and constant definitions -pub const SCRIPT_UNDEFINED: ::WORD = 0; -pub const USP_E_SCRIPT_NOT_IN_FONT: ::HRESULT = MAKE_HRESULT!( - ::SEVERITY_ERROR, ::FACILITY_ITF, 0x200 -); -DECLARE_HANDLE!(SCRIPT_CACHE, SCRIPT_CACHE__); -STRUCT!{struct SCRIPT_CONTROL { - bit_fields: ::DWORD, -}} -BITFIELD!(SCRIPT_CONTROL bit_fields: ::DWORD [ - uDefaultLanguage set_uDefaultLanguage[0..16], - fContextDigits set_fContextDigits[16..17], - fInvertPreBoundDir set_fInvertPreBoundDir[17..18], - fInvertPostBoundDir set_fInvertPostBoundDir[18..19], - fLinkStringBefore set_fLinkStringBefore[19..20], - fLinkStringAfter set_fLinkStringAfter[20..21], - fNeutralOverride set_fNeutralOverride[21..22], - fNumericOverride set_fNumericOverride[22..23], - fLegacyBidiClass set_fLegacyBidiClass[23..24], - fMergeNeutralItems set_fMergeNeutralItems[24..25], - fReserved set_fReserved[25..32], -]); -STRUCT!{struct SCRIPT_STATE { - bit_fields: ::WORD, -}} -BITFIELD!(SCRIPT_STATE bit_fields: ::WORD [ - uBidiLevel set_uBidiLevel[0..5], - fOverrideDirection set_fOverrideDirection[5..6], - fInhibitSymSwap set_fInhibitSymSwap[6..7], - fCharShape set_fCharShape[7..8], - fDigitSubstitute set_fDigitSubstitute[8..9], - fInhibitLigate set_fInhibitLigate[9..10], - fDisplayZWG set_fDisplayZWG[10..11], - fArabicNumContext set_fArabicNumContext[11..12], - fGcpClusters set_fGcpClusters[12..13], - fReserved set_fReserved[13..14], - fEngineReserved set_fEngineReserved[14..16], -]); -STRUCT!{struct SCRIPT_ANALYSIS { - bit_fields: ::WORD, - s: SCRIPT_STATE, -}} -BITFIELD!(SCRIPT_ANALYSIS bit_fields: ::WORD [ - eScript set_eScript[0..10], - fRTL set_fRTL[10..11], - fLayoutRTL set_fLayoutRTL[11..12], - fLinkBefore set_fLinkBefore[12..13], - fLinkAfter set_fLinkAfter[13..14], - fLogicalOrder set_fLogicalOrder[14..15], - fNoGlyphIndex set_fNoGlyphIndex[15..16], -]); -STRUCT!{struct SCRIPT_ITEM { - iCharPos: ::c_int, - a: SCRIPT_ANALYSIS, -}} -//490 -pub const SCRIPT_JUSTIFY_NONE: ::WORD = 0; -pub const SCRIPT_JUSTIFY_ARABIC_BLANK: ::WORD = 1; -pub const SCRIPT_JUSTIFY_CHARACTER: ::WORD = 2; -pub const SCRIPT_JUSTIFY_RESERVED1: ::WORD = 3; -pub const SCRIPT_JUSTIFY_BLANK: ::WORD = 4; -pub const SCRIPT_JUSTIFY_RESERVED2: ::WORD = 5; -pub const SCRIPT_JUSTIFY_RESERVED3: ::WORD = 6; -pub const SCRIPT_JUSTIFY_ARABIC_NORMAL: ::WORD = 7; -pub const SCRIPT_JUSTIFY_ARABIC_KASHIDA: ::WORD = 8; -pub const SCRIPT_JUSTIFY_ARABIC_ALEF: ::WORD = 9; -pub const SCRIPT_JUSTIFY_ARABIC_HA: ::WORD = 10; -pub const SCRIPT_JUSTIFY_ARABIC_RA: ::WORD = 11; -pub const SCRIPT_JUSTIFY_ARABIC_BA: ::WORD = 12; -pub const SCRIPT_JUSTIFY_ARABIC_BARA: ::WORD = 13; -pub const SCRIPT_JUSTIFY_ARABIC_SEEN: ::WORD = 14; -pub const SCRIPT_JUSTIFY_ARABIC_SEEN_M: ::WORD = 15; -STRUCT!{struct SCRIPT_VISATTR { - bit_fields: ::WORD, -}} -BITFIELD!(SCRIPT_VISATTR bit_fields: ::WORD [ - uJustification set_uJustification[0..4], - fClusterStart set_fClusterStart[4..5], - fDiacritic set_fDiacritic[5..6], - fZeroWidth set_fZeroWidth[6..7], - fReserved set_fReserved[7..8], - fShapeReserved set_fShapeReserved[8..16], -]); -STRUCT!{struct GOFFSET { - du: ::LONG, - dv: ::LONG, -}} -STRUCT!{struct SCRIPT_LOGATTR { - bit_fields: ::BYTE, -}} -BITFIELD!(SCRIPT_LOGATTR bit_fields: ::BYTE [ - fSoftBreak set_fSoftBreak[0..1], - fWhiteSpace set_fWhiteSpace[1..2], - fCharStop set_fCharStop[2..3], - fWordStop set_fWordStop[3..4], - fInvalid set_fInvalid[4..5], - fReserved set_fReserved[5..8], -]); -pub const SGCM_RTL: ::DWORD = 0x00000001; -STRUCT!{struct SCRIPT_PROPERTIES { - bit_fields1: ::DWORD, - bit_fields2: ::DWORD, -}} -BITFIELD!(SCRIPT_PROPERTIES bit_fields1: ::DWORD [ - langid set_langid[0..16], - fNumeric set_fNumeric[16..17], - fComplex set_fComplex[17..18], - fNeedsWordBreaking set_fNeedsWordBreaking[18..19], - fNeedsCaretInfo set_fNeedsCaretInfo[19..20], - bCharSet set_bCharSet[20..28], - fControl set_fControl[28..29], - fPrivateUseArea set_fPrivateUseArea[29..30], - fNeedsCharacterJustify set_fNeedsCharacterJustify[30..31], - fInvalidGlyph set_fInvalidGlyph[31..32], -]); -BITFIELD!(SCRIPT_PROPERTIES bit_fields2: ::DWORD [ - fInvalidLogAttr set_fInvalidLogAttr[0..1], - fCDM set_fCDM[1..2], - fAmbiguousCharSet set_fAmbiguousCharSet[2..3], - fClusterSizeVaries set_fClusterSizeVaries[3..4], - fRejectInvalid set_fRejectInvalid[4..5], -]); -STRUCT!{struct SCRIPT_FONTPROPERTIES { - cBytes: ::c_int, - wgBlank: ::WORD, - wgDefault: ::WORD, - wgInvalid: ::WORD, - wgKashida: ::WORD, - iKashidaWidth: ::c_int, -}} -//1440 -pub const SSA_PASSWORD: ::DWORD = 0x00000001; -pub const SSA_TAB: ::DWORD = 0x00000002; -pub const SSA_CLIP: ::DWORD = 0x00000004; -pub const SSA_FIT: ::DWORD = 0x00000008; -pub const SSA_DZWG: ::DWORD = 0x00000010; -pub const SSA_FALLBACK: ::DWORD = 0x00000020; -pub const SSA_BREAK: ::DWORD = 0x00000040; -pub const SSA_GLYPHS: ::DWORD = 0x00000080; -pub const SSA_RTL: ::DWORD = 0x00000100; -pub const SSA_GCP: ::DWORD = 0x00000200; -pub const SSA_HOTKEY: ::DWORD = 0x00000400; -pub const SSA_METAFILE: ::DWORD = 0x00000800; -pub const SSA_LINK: ::DWORD = 0x00001000; -pub const SSA_HIDEHOTKEY: ::DWORD = 0x00002000; -pub const SSA_HOTKEYONLY: ::DWORD = 0x00002400; -pub const SSA_FULLMEASURE: ::DWORD = 0x04000000; -pub const SSA_LPKANSIFALLBACK: ::DWORD = 0x08000000; -pub const SSA_PIDX: ::DWORD = 0x10000000; -pub const SSA_LAYOUTRTL: ::DWORD = 0x20000000; -pub const SSA_DONTGLYPH: ::DWORD = 0x40000000; -pub const SSA_NOKASHIDA: ::DWORD = 0x80000000; -STRUCT!{struct SCRIPT_TABDEF { - cTabStops: ::c_int, - iScale: ::c_int, - pTabStops: *mut ::c_int, - iTabOrigin: ::c_int, -}} -DECLARE_HANDLE!(SCRIPT_STRING_ANALYSIS, SCRIPT_STRING_ANALYSIS__); -pub const SIC_COMPLEX: ::DWORD = 1; -pub const SIC_ASCIIDIGIT: ::DWORD = 2; -pub const SIC_NEUTRAL: ::DWORD = 4; -STRUCT!{struct SCRIPT_DIGITSUBSTITUTE { - bit_fields1: ::DWORD, - bit_fields2: ::DWORD, - dwReserved: ::DWORD, -}} -BITFIELD!(SCRIPT_DIGITSUBSTITUTE bit_fields1: ::DWORD [ - NationalDigitLanguage set_NationalDigitLanguage[0..16], - TraditionalDigitLanguage set_TraditionalDigitLanguage[16..32], -]); -BITFIELD!(SCRIPT_DIGITSUBSTITUTE bit_fields2: ::DWORD [ - DigitSubstitute set_DigitSubstitute[0..8], -]); -pub const SCRIPT_DIGITSUBSTITUTE_CONTEXT: ::BYTE = 0; -pub const SCRIPT_DIGITSUBSTITUTE_NONE: ::BYTE = 1; -pub const SCRIPT_DIGITSUBSTITUTE_NATIONAL: ::BYTE = 2; -pub const SCRIPT_DIGITSUBSTITUTE_TRADITIONAL: ::BYTE = 3; -pub type OPENTYPE_TAG = ::ULONG; -pub const SCRIPT_TAG_UNKNOWN: OPENTYPE_TAG = 0x00000000; -STRUCT!{struct OPENTYPE_FEATURE_RECORD { - tagFeature: OPENTYPE_TAG, - lParameter: ::LONG, -}} -STRUCT!{struct TEXTRANGE_PROPERTIES { - potfRecords: *mut OPENTYPE_FEATURE_RECORD, - cotfRecords: ::c_int, -}} -STRUCT!{struct SCRIPT_CHARPROP { - bit_fields: ::WORD, -}} -BITFIELD!(SCRIPT_CHARPROP bit_fields: ::WORD [ - fCanGlyphAlone set_fCanGlyphAlone[0..1], - reserved set_reserved[1..16], -]); -STRUCT!{struct SCRIPT_GLYPHPROP { - sva: SCRIPT_VISATTR, - reserved: ::WORD, -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/vadefs.rs cargo-0.37.0/vendor/winapi-0.2.8/src/vadefs.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/vadefs.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/vadefs.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Definitions of macro helpers used by . This is the topmost header in the CRT header -//! lattice, and is always the first CRT header to be included, explicitly or implicitly. -//! Therefore, this header also has several definitions that are used throughout the CRT. -//39 -pub type va_list = *mut ::c_char; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/vsbackup.rs cargo-0.37.0/vendor/winapi-0.2.8/src/vsbackup.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/vsbackup.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/vsbackup.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,303 +0,0 @@ -// Copyright © 2015, Brian Vincent -// Licensed under the MIT License -//! VSS backup interfaces -DEFINE_GUID!(IID_IVssExamineWriterMetadata, 0x902fcf7f, 0xb7fd, 0x42f8, - 0x81, 0xf1, 0xb2, 0xe4, 0x00, 0xb1, 0xe5, 0xbd); -DEFINE_GUID!(IID_IVssExamineWriterMetadataEx, 0x0c0e5ec0, 0xca44, 0x472b, - 0xb7, 0x02, 0xe6, 0x52, 0xdb, 0x1c, 0x04, 0x51); -DEFINE_GUID!(IID_IVssBackupComponents, 0x665c1d5f, 0xc218, 0x414d, - 0xa0, 0x5d, 0x7f, 0xef, 0x5f, 0x9d, 0x5c, 0x86); -DEFINE_GUID!(IID_IVssBackupComponentsEx, 0x963f03ad, 0x9e4c, 0x4a34, - 0xac, 0x15, 0xe4, 0xb6, 0x17, 0x4e, 0x50, 0x36); -STRUCT!{struct VSS_COMPONENTINFO { - type_: ::VSS_COMPONENT_TYPE, // type is a keyword in rust - bstrLogicalPath: ::BSTR, - bstrComponentName: ::BSTR, - bstrCaption: ::BSTR, - pbIcon: *mut ::BYTE, - cbIcon: ::UINT, - bRestoreMetadata: bool, - bNotifyOnBackupComplete: bool, - bSelectable: bool, - bSelectableForRestore: bool, - dwComponentFlags: ::DWORD, - cFileCount: ::UINT, - cDatabases: ::UINT, - cLogFiles: ::UINT, - cDependencies: ::UINT, -}} -pub type PVSSCOMPONENTINFO = *const ::VSS_COMPONENTINFO; -RIDL!( -interface IVssWMComponent(IVssWMComponentVtbl): IUnknown(IUnknownVtbl) { - fn GetComponentInfo(&mut self, ppInfo: *mut ::PVSSCOMPONENTINFO) -> ::HRESULT, - fn FreeComponentInfo(&mut self, pInfo: ::PVSSCOMPONENTINFO) -> ::HRESULT, - fn GetFile(&mut self, iFile: ::UINT, ppFiledesc: *mut *mut ::IVssWMFiledesc) -> ::HRESULT, - fn GetDatabaseFile( - &mut self, iDBFile: ::UINT, ppFiledesc: *mut *mut ::IVssWMFiledesc - ) -> ::HRESULT, - fn GetDatabaseLogFile( - &mut self, iDbLogFile: ::UINT, ppFiledesc: *mut *mut ::IVssWMFiledesc - ) -> ::HRESULT, - fn GetDependency( - &mut self, iDependency: ::UINT, ppDependency: *mut *mut ::IVssWMDependency - ) -> ::HRESULT -} -); -RIDL!( -interface IVssExamineWriterMetadata(IVssExamineWriterMetadataVtbl): IUnknown(IUnknownVtbl) { - fn GetIdentity( - &mut self, pidInstance: *mut ::VSS_ID, pidWriter: *mut ::VSS_ID, - pbstrWriterName: *mut ::BSTR, pUsage: *mut ::VSS_USAGE_TYPE, - pSource: *mut ::VSS_SOURCE_TYPE - ) -> ::HRESULT, - fn GetFileCounts(&mut self, pcIncludeFiles: *mut ::UINT, pcExcludeFiles: *mut ::UINT, - pcComponents: *mut ::UINT - ) -> ::HRESULT, - fn GetIncludeFile( - &mut self, iFile: ::UINT, ppFiledesc: *mut *mut ::IVssWMFiledesc - ) -> ::HRESULT, - fn GetExcludeFile( - &mut self, iFile: ::UINT, ppFiledesc: *mut *mut ::IVssWMFiledesc - ) -> ::HRESULT, - fn GetComponent( - &mut self, iComponent: ::UINT, ppComponent: *mut *mut ::IVssWMComponent - ) -> ::HRESULT, - fn GetRestoreMethod( - &mut self, pMethod: *mut ::VSS_RESTOREMETHOD_ENUM, pbstrService: *mut ::BSTR, - pbstrUserProcedure: *mut ::BSTR, pwriterRestore: *mut ::VSS_WRITERRESTORE_ENUM, - pbRebootRequired: *mut bool, pcMappings: *mut ::UINT - ) -> ::HRESULT, - fn GetAlternateLocationMapping( - &mut self, iMapping: ::UINT, ppFiledesc: *mut *mut ::IVssWMFiledesc - ) -> ::HRESULT, - fn GetBackupSchema(&mut self, pdwSchemaMask: *mut ::DWORD) -> ::HRESULT, - fn GetDocument(&mut self, pDoc: *mut ::c_void) -> ::HRESULT, //TODO IXMLDOMDocument - fn SaveAsXML(&mut self, pbstrXML: *mut ::BSTR) -> ::HRESULT, - fn LoadFromXML(&mut self, pbstrXML: *mut ::BSTR) -> ::HRESULT -} -); -RIDL!( -interface IVssExamineWriterMetadataEx(IVssExamineWriterMetadataExVtbl): - IVssExamineWriterMetadata(IVssExamineWriterMetadataVtbl) { - fn GetIdentityEx( - &mut self, pidInstance: *mut ::VSS_ID, pidWriter: *mut ::VSS_ID, - pbstrWriterName: *mut ::BSTR, pbstrInstanceName: *mut ::BSTR, - pUsage: *mut ::VSS_USAGE_TYPE, pSource: *mut ::VSS_SOURCE_TYPE - ) -> ::HRESULT -} -); -RIDL!( -interface IVssExamineWriterMetadataEx2(IVssExamineWriterMetadataEx2Vtbl): - IVssExamineWriterMetadataEx(IVssExamineWriterMetadataExVtbl) { - fn GetVersion( - &mut self, pdwMajorVersion: *mut ::DWORD, pdwMinorVersion: *mut ::DWORD - ) -> ::HRESULT, - fn GetExcludeFromSnapshotCount(&mut self, pcExcludedFromSnapshot: *mut ::UINT) -> ::HRESULT, - fn GetExcludeFromSnapshotFile( - &mut self, iFile: ::UINT, ppFiledesc: *mut *mut ::IVssWMFiledesc - ) -> ::HRESULT -} -); -#[repr(C)] -pub struct IVssWriterComponentsExt { - pub lpVtbl: *const IVssWriterComponentsExtVtbl, -} -#[repr(C)] -pub struct IVssWriterComponentsExtVtbl { - pub parent1: ::IVssWriterComponentsVtbl, - pub parent2: ::IUnknownVtbl, -} -RIDL!( -interface IVssBackupComponents(IVssBackupComponentsVtbl): IUnknown(IUnknownVtbl) { - fn GetWriterComponentsCount(&mut self, pcComponents: *mut ::UINT) -> ::HRESULT, - fn GetWriterComponents( - &mut self, iWriter: ::UINT, ppWriter: *mut *mut IVssWriterComponentsExt - ) -> ::HRESULT, - fn InitializeForBackup(&mut self, bstrXML: ::BSTR) -> ::HRESULT, - fn SetBackupState( - &mut self, bSelectComponents: bool, bBackupBootableSystemState: bool, - backupType: ::VSS_BACKUP_TYPE, bPartialFileSupport: bool - ) -> ::HRESULT, - fn InitializeForRestore(&mut self, bstrXML: ::BSTR) -> ::HRESULT, - fn SetRestoreState(&mut self, restoreType: ::VSS_RESTORE_TYPE) -> ::HRESULT, - fn GatherWriterMetadata(&mut self, pAsync: *mut *mut ::IVssAsync) -> ::HRESULT, - fn GetWriterMetadataCount(&mut self, pcWriters: *mut ::UINT) -> ::HRESULT, - fn GetWriterMetadata( - &mut self, iWriter: ::UINT, pidInstance: *mut ::VSS_ID, - ppMetadata: *mut *mut IVssExamineWriterMetadata - ) -> ::HRESULT, - fn FreeWriterMetadata(&mut self) -> ::HRESULT, - fn AddComponent( - &mut self, instanceId: ::VSS_ID, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, - wszLogicalPath: ::LPCWSTR, wszComponentName: ::LPCWSTR - ) -> ::HRESULT, - fn PrepareForBackup(&mut self, ppAsync: *mut *mut ::IVssAsync) -> ::HRESULT, - fn AbortBackup(&mut self) -> ::HRESULT, - fn GatherWriterStatus(&mut self, ppAsync: *mut *mut ::IVssAsync) -> ::HRESULT, - fn GetWriterStatusCount(&mut self, pcWriters: *mut ::UINT) -> ::HRESULT, - fn FreeWriterStatus(&mut self) -> ::HRESULT, - fn GetWriterStatus( - &mut self, iWriter: ::UINT, pidInstance: *mut ::VSS_ID, pidWriter: *mut ::VSS_ID, - pbstrWriter: *mut ::BSTR, pnStatus: *mut ::VSS_WRITER_STATE, - phResultFailure: *mut ::HRESULT - ) -> ::HRESULT, - fn SetBackupSucceeded( - &mut self, instanceId: ::VSS_ID, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, - wszLogicalPath: ::LPCWSTR, wszComponentName: ::LPCWSTR, bSucceded: bool - ) -> ::HRESULT, - fn SetBackupOptions( - &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, - wszComponentName: ::LPCWSTR, wszBackupOptions: ::LPCWSTR - ) -> ::HRESULT, - fn SetSelectedForRestore( - &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, - wszComponentName: ::LPCWSTR, bSelectedForRestore: bool - ) -> ::HRESULT, - fn SetRestoreOptions( - &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, - wszComponentName: ::LPCWSTR, wszRestoreOptions: ::LPCWSTR - ) -> ::HRESULT, - fn SetAdditionalRestores( - &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, - wszComponentName: ::LPCWSTR, bAdditionalRestores: bool - ) -> ::HRESULT, - fn SetPreviousBackupStamp( - &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, - wszComponentName: ::LPCWSTR, wszPreviousBackupStamp: ::LPCWSTR - ) -> ::HRESULT, - fn SaveAsXML(&mut self, pbstrXML: *mut ::BSTR) -> ::HRESULT, - fn BackupComplete(&mut self, ppAsync: *mut *mut ::IVssAsync) -> ::HRESULT, - fn AddAlternativeLocationMapping( - &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, - wszComponentName: ::LPCWSTR, wszPath: ::LPCWSTR, wszFilespec: ::LPCWSTR, bRecursive: bool, - wszDestination: ::LPCWSTR - ) -> ::HRESULT, - fn AddRestoreSubcomponent( - &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, - wszComponentName: ::LPCWSTR, wszSubComponentLogicalPath: ::LPCWSTR, - wszSubComponentName: ::LPCWSTR, bRepair: bool - ) -> ::HRESULT, - fn SetFileRestoreStatus( - &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, - wszComponentName: ::LPCWSTR, status: ::VSS_FILE_RESTORE_STATUS - ) -> ::HRESULT, - fn AddNewTarget( - &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, - wszComponentName: ::LPCWSTR, wszPath: ::LPCWSTR, wszFileName: ::LPCWSTR, bRecursive: bool, - wszAlternatePath: ::LPCWSTR - ) -> ::HRESULT, - fn SetRangesFilePath( - &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, - wszComponentName: ::LPCWSTR, iPartialFile: ::UINT, wszRangesFile: ::LPCWSTR - ) -> ::HRESULT, - fn PreRestore(&mut self, ppAsync: *mut *mut ::IVssAsync) -> ::HRESULT, - fn PostRestore(&mut self, ppAsync: *mut *mut ::IVssAsync) -> ::HRESULT, - fn SetContext(&mut self, lContext: ::LONG) -> ::HRESULT, - fn StartSnapshotSet(&mut self, pSnapshotSetId: *mut ::VSS_ID) -> ::HRESULT, - fn AddToSnapshotSet( - &mut self, pwszVolumeName: ::VSS_PWSZ, ProviderId: ::VSS_ID, pidSnapshot: *mut ::VSS_ID - ) -> ::HRESULT, - fn DoSnapshotSet(&mut self, ppAsync: *mut *mut ::IVssAsync) -> ::HRESULT, - fn DeleteSnapshots( - &mut self, SourceObjectId: ::VSS_ID, eSourceObjectType: ::VSS_OBJECT_TYPE, - bForceDelete: ::BOOL, plDeletedSnapshots: *mut ::LONG, pNondeletedSnapshotID: *mut ::VSS_ID - ) -> ::HRESULT, - fn ImportSnapshots(&mut self, ppAsync: *mut *mut ::IVssAsync) -> ::HRESULT, - fn BreakSnapshotSet(&mut self, SnapshotSetId: ::VSS_ID) -> ::HRESULT, - fn GetSnapshotProperties( - &mut self, SnapshotId: ::VSS_ID, - pProp: *mut ::VSS_SNAPSHOT_PROP - ) -> ::HRESULT, - fn Query(&mut self, QueriedObjectId: ::VSS_ID, eQueriedObjectType: ::VSS_OBJECT_TYPE, - eReturnedObjectsType: ::VSS_OBJECT_TYPE, ppEnum: *mut *mut ::IVssEnumObject) -> ::HRESULT, - fn IsVolumeSupported( - &mut self, ProviderId: ::VSS_ID, pwszVolumeName: ::VSS_PWSZ, - pbSupportedByThisProvider: *mut ::BOOL - ) -> ::HRESULT, - fn DisableWriterClasses( - &mut self, rgWriterClassId: *const ::VSS_ID, cClassId: ::UINT - ) -> ::HRESULT, - fn EnableWriterClasses( - &mut self, rgWriterClassId: *const ::VSS_ID, cClassId: ::UINT - ) -> ::HRESULT, - fn DisableWriterInstances( - &mut self, rgWriterInstanceId: *const ::VSS_ID, cInstanceId: ::UINT - ) -> ::HRESULT, - fn ExposeSnapshot(&mut self, SnapshotId: ::VSS_ID, wszPathFromRoot: ::VSS_PWSZ, - lAttributes: ::LONG, wszExpose: ::VSS_PWSZ, pwszExposed: ::VSS_PWSZ - ) -> ::HRESULT, - fn RevertToSnapshot(&mut self, SnapshotId: ::VSS_ID, bForceDismount: ::BOOL) -> ::HRESULT, - fn QueryRevertStatus( - &mut self, pwszVolume: ::VSS_PWSZ, ppAsync: *mut *mut ::IVssAsync - ) -> ::HRESULT -} -); -RIDL!( -interface IVssBackupComponentsEx(IVssBackupComponentsExVtbl): - IVssBackupComponents(IVssBackupComponentsVtbl) { - fn GetWriterMetadataEx( - &mut self, iWriter: ::UINT, pidInstance: *mut ::VSS_ID, - ppMetadata: *mut *mut ::IVssExamineWriterMetadataEx - ) -> ::HRESULT, - fn SetSelectedForRestoreEx( - &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, - wszComponentName: ::LPCWSTR, bSelectedForRestore: bool, instanceId: ::VSS_ID - ) -> ::HRESULT -} -); -RIDL!( -interface IVssBackupComponentsEx2(IVssBackupComponentsEx2Vtbl): - IVssBackupComponentsEx(IVssBackupComponentsExVtbl) { - fn UnexposeSnapshot(&mut self, snapshotId: ::VSS_ID) -> ::HRESULT, - fn SetAuthoritativeRestore( - &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, - wszComponentName: ::LPCWSTR, bAuth: bool - ) -> ::HRESULT, - fn SetRollForward( - &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, - wszComponentName: ::LPCWSTR, rollType: ::VSS_ROLLFORWARD_TYPE, - wszRollForwardPoint: ::LPCWSTR - ) -> ::HRESULT, - fn SetRestoreName( - &mut self, writerId: ::VSS_ID, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, - wszComponentName: ::LPCWSTR, wszRestoreName: ::LPCWSTR - ) -> ::HRESULT, - fn BreakSnapshotSetEx( - &mut self, SnapshotSetID: ::VSS_ID, dwBreakFlags: ::DWORD, ppAsync: *mut *mut ::IVssAsync - ) -> ::HRESULT, - fn PreFastRecovery( - &mut self, SnapshotSetID: ::VSS_ID, dwPreFastRecoveryFlags: ::DWORD, - ppAsync: *mut *mut ::IVssAsync - ) -> ::HRESULT, - fn FastRecovery( - &mut self, SnapshotSetID: ::VSS_ID, dwFastRecoveryFlags: ::DWORD, - ppAsync: *mut *mut ::IVssAsync - ) -> ::HRESULT -} -); -RIDL!( -interface IVssBackupComponentsEx3(IVssBackupComponentsEx3Vtbl): - IVssBackupComponentsEx2(IVssBackupComponentsEx2Vtbl) { - fn GetWriterStatusEx( - &mut self, iWriter: ::UINT, pidInstance: *mut ::VSS_ID, pidWriter: *mut ::VSS_ID, - pbstrWriter: *mut ::BSTR, pnStatus: *mut ::VSS_WRITER_STATE, - phrFailureWriter: *mut ::HRESULT, phrApplication: *mut ::HRESULT, - pbstrApplicationMessage: *mut ::BSTR - ) -> ::HRESULT, - fn AddSnapshotToRecoverySet( - &mut self, snapshotId: ::VSS_ID, dwFlags: ::DWORD, pwszDestinationVolume: ::VSS_PWSZ - ) -> ::HRESULT, - fn RecoverSet(&mut self, dwFlags: ::DWORD, ppAsync: *mut *mut ::IVssAsync) -> ::HRESULT, - fn GetSessionId(&mut self, idSession: *mut ::VSS_ID) -> ::HRESULT -} -); -RIDL!( -interface IVssBackupComponentsEx4(IVssBackupComponentsEx4Vtbl): - IVssBackupComponentsEx3(IVssBackupComponentsEx3Vtbl) { - fn GetRootAndLogicalPrefixPaths( - &mut self, pwszFilePath: ::VSS_PWSZ, ppwszRootPath: *mut ::VSS_PWSZ, - ppwszLogicalPrefix: *mut ::VSS_PWSZ, bNormalizeFQDNforRootPath: ::BOOL - ) -> ::HRESULT -} -); -pub const VSS_SW_BOOTABLE_STATE: ::DWORD = 1; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/vsserror.rs cargo-0.37.0/vendor/winapi-0.2.8/src/vsserror.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/vsserror.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/vsserror.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ -// Copyright © 2015, Brian Vincent -// Licensed under the MIT License -//! VSS Error header file -pub const VSS_E_BAD_STATE: ::HRESULT = 0x80042301u32 as i32; -pub const VSS_E_UNEXPECTED: ::HRESULT = 0x80042302u32 as i32; -pub const VSS_E_PROVIDER_ALREADY_REGISTERED: ::HRESULT = 0x80042303u32 as i32; -pub const VSS_E_PROVIDER_NOT_REGISTERED: ::HRESULT = 0x80042304u32 as i32; -pub const VSS_E_PROVIDER_VETO: ::HRESULT = 0x80042306u32 as i32; -pub const VSS_E_PROVIDER_IN_USE: ::HRESULT = 0x80042307u32 as i32; -pub const VSS_E_OBJECT_NOT_FOUND: ::HRESULT = 0x80042308u32 as i32; -pub const VSS_S_ASYNC_PENDING: ::HRESULT = 0x00042309u32 as i32; -pub const VSS_S_ASYNC_FINISHED: ::HRESULT = 0x0004230Au32 as i32; -pub const VSS_S_ASYNC_CANCELLED: ::HRESULT = 0x0004230Bu32 as i32; -pub const VSS_E_VOLUME_NOT_SUPPORTED: ::HRESULT = 0x8004230Cu32 as i32; -pub const VSS_E_VOLUME_NOT_SUPPORTED_BY_PROVIDER: ::HRESULT = 0x8004230Eu32 as i32; -pub const VSS_E_OBJECT_ALREADY_EXISTS: ::HRESULT = 0x8004230Du32 as i32; -pub const VSS_E_UNEXPECTED_PROVIDER_ERROR: ::HRESULT = 0x8004230Fu32 as i32; -pub const VSS_E_CORRUPT_XML_DOCUMENT: ::HRESULT = 0x80042310u32 as i32; -pub const VSS_E_INVALID_XML_DOCUMENT: ::HRESULT = 0x80042311u32 as i32; -pub const VSS_E_MAXIMUM_NUMBER_OF_VOLUMES_REACHED: ::HRESULT = 0x80042312u32 as i32; -pub const VSS_E_FLUSH_WRITES_TIMEOUT: ::HRESULT = 0x80042313u32 as i32; -pub const VSS_E_HOLD_WRITES_TIMEOUT: ::HRESULT = 0x80042314u32 as i32; -pub const VSS_E_UNEXPECTED_WRITER_ERROR: ::HRESULT = 0x80042315u32 as i32; -pub const VSS_E_SNAPSHOT_SET_IN_PROGRESS: ::HRESULT = 0x80042316u32 as i32; -pub const VSS_E_MAXIMUM_NUMBER_OF_SNAPSHOTS_REACHED: ::HRESULT = 0x80042317u32 as i32; -pub const VSS_E_WRITER_INFRASTRUCTURE: ::HRESULT = 0x80042318u32 as i32; -pub const VSS_E_WRITER_NOT_RESPONDING: ::HRESULT = 0x80042319u32 as i32; -pub const VSS_E_WRITER_ALREADY_SUBSCRIBED: ::HRESULT = 0x8004231Au32 as i32; -pub const VSS_E_UNSUPPORTED_CONTEXT: ::HRESULT = 0x8004231Bu32 as i32; -pub const VSS_E_VOLUME_IN_USE: ::HRESULT = 0x8004231Du32 as i32; -pub const VSS_E_MAXIMUM_DIFFAREA_ASSOCIATIONS_REACHED: ::HRESULT = 0x8004231Eu32 as i32; -pub const VSS_E_INSUFFICIENT_STORAGE: ::HRESULT = 0x8004231Fu32 as i32; -pub const VSS_E_NO_SNAPSHOTS_IMPORTED: ::HRESULT = 0x80042320u32 as i32; -pub const VSS_S_SOME_SNAPSHOTS_NOT_IMPORTED: ::HRESULT = 0x00042321u32 as i32; -pub const VSS_E_SOME_SNAPSHOTS_NOT_IMPORTED: ::HRESULT = 0x80042321u32 as i32; -pub const VSS_E_MAXIMUM_NUMBER_OF_REMOTE_MACHINES_REACHED: ::HRESULT = 0x80042322u32 as i32; -pub const VSS_E_REMOTE_SERVER_UNAVAILABLE: ::HRESULT = 0x80042323u32 as i32; -pub const VSS_E_REMOTE_SERVER_UNSUPPORTED: ::HRESULT = 0x80042324u32 as i32; -pub const VSS_E_REVERT_IN_PROGRESS: ::HRESULT = 0x80042325u32 as i32; -pub const VSS_E_REVERT_VOLUME_LOST: ::HRESULT = 0x80042326u32 as i32; -pub const VSS_E_REBOOT_REQUIRED: ::HRESULT = 0x80042327u32 as i32; -pub const VSS_E_TRANSACTION_FREEZE_TIMEOUT: ::HRESULT = 0x80042328u32 as i32; -pub const VSS_E_TRANSACTION_THAW_TIMEOUT: ::HRESULT = 0x80042329u32 as i32; -pub const VSS_E_VOLUME_NOT_LOCAL: ::HRESULT = 0x8004232Du32 as i32; -pub const VSS_E_CLUSTER_TIMEOUT: ::HRESULT = 0x8004232Eu32 as i32; -pub const VSS_E_WRITERERROR_INCONSISTENTSNAPSHOT: ::HRESULT = 0x800423F0u32 as i32; -pub const VSS_E_WRITERERROR_OUTOFRESOURCES: ::HRESULT = 0x800423F1u32 as i32; -pub const VSS_E_WRITERERROR_TIMEOUT: ::HRESULT = 0x800423F2u32 as i32; -pub const VSS_E_WRITERERROR_RETRYABLE: ::HRESULT = 0x800423F3u32 as i32; -pub const VSS_E_WRITERERROR_NONRETRYABLE: ::HRESULT = 0x800423F4u32 as i32; -pub const VSS_E_WRITERERROR_RECOVERY_FAILED: ::HRESULT = 0x800423F5u32 as i32; -pub const VSS_E_BREAK_REVERT_ID_FAILED: ::HRESULT = 0x800423F6u32 as i32; -pub const VSS_E_LEGACY_PROVIDER: ::HRESULT = 0x800423F7u32 as i32; -pub const VSS_E_MISSING_DISK: ::HRESULT = 0x800423F8u32 as i32; -pub const VSS_E_MISSING_HIDDEN_VOLUME: ::HRESULT = 0x800423F9u32 as i32; -pub const VSS_E_MISSING_VOLUME: ::HRESULT = 0x800423FAu32 as i32; -pub const VSS_E_AUTORECOVERY_FAILED: ::HRESULT = 0x800423FBu32 as i32; -pub const VSS_E_DYNAMIC_DISK_ERROR: ::HRESULT = 0x800423FCu32 as i32; -pub const VSS_E_NONTRANSPORTABLE_BCD: ::HRESULT = 0x800423FDu32 as i32; -pub const VSS_E_CANNOT_REVERT_DISKID: ::HRESULT = 0x800423FEu32 as i32; -pub const VSS_E_RESYNC_IN_PROGRESS: ::HRESULT = 0x800423FFu32 as i32; -pub const VSS_E_CLUSTER_ERROR: ::HRESULT = 0x80042400u32 as i32; -pub const VSS_E_UNSELECTED_VOLUME: ::HRESULT = 0x8004232Au32 as i32; -pub const VSS_E_SNAPSHOT_NOT_IN_SET: ::HRESULT = 0x8004232Bu32 as i32; -pub const VSS_E_NESTED_VOLUME_LIMIT: ::HRESULT = 0x8004232Cu32 as i32; -pub const VSS_E_NOT_SUPPORTED: ::HRESULT = 0x8004232Fu32 as i32; -pub const VSS_E_WRITERERROR_PARTIAL_FAILURE: ::HRESULT = 0x80042336u32 as i32; -pub const VSS_E_ASRERROR_DISK_ASSIGNMENT_FAILED: ::HRESULT = 0x80042401u32 as i32; -pub const VSS_E_ASRERROR_DISK_RECREATION_FAILED: ::HRESULT = 0x80042402u32 as i32; -pub const VSS_E_ASRERROR_NO_ARCPATH: ::HRESULT = 0x80042403u32 as i32; -pub const VSS_E_ASRERROR_MISSING_DYNDISK: ::HRESULT = 0x80042404u32 as i32; -pub const VSS_E_ASRERROR_SHARED_CRIDISK: ::HRESULT = 0x80042405u32 as i32; -pub const VSS_E_ASRERROR_DATADISK_RDISK0: ::HRESULT = 0x80042406u32 as i32; -pub const VSS_E_ASRERROR_RDISK0_TOOSMALL: ::HRESULT = 0x80042407u32 as i32; -pub const VSS_E_ASRERROR_CRITICAL_DISKS_TOO_SMALL: ::HRESULT = 0x80042408u32 as i32; -pub const VSS_E_WRITER_STATUS_NOT_AVAILABLE: ::HRESULT = 0x80042409u32 as i32; -pub const VSS_E_ASRERROR_DYNAMIC_VHD_NOT_SUPPORTED: ::HRESULT = 0x8004240Au32 as i32; -pub const VSS_E_CRITICAL_VOLUME_ON_INVALID_DISK: ::HRESULT = 0x80042411u32 as i32; -pub const VSS_E_ASRERROR_RDISK_FOR_SYSTEM_DISK_NOT_FOUND: ::HRESULT = 0x80042412u32 as i32; -pub const VSS_E_ASRERROR_NO_PHYSICAL_DISK_AVAILABLE: ::HRESULT = 0x80042413u32 as i32; -pub const VSS_E_ASRERROR_FIXED_PHYSICAL_DISK_AVAILABLE_AFTER_DISK_EXCLUSION: ::HRESULT = - 0x80042414u32 as i32; -pub const VSS_E_ASRERROR_CRITICAL_DISK_CANNOT_BE_EXCLUDED: ::HRESULT = 0x80042415u32 as i32; -pub const VSS_E_ASRERROR_SYSTEM_PARTITION_HIDDEN: ::HRESULT = 0x80042416u32 as i32; -pub const VSS_E_FSS_TIMEOUT: ::HRESULT = 0x80042417u32 as i32; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/vss.rs cargo-0.37.0/vendor/winapi-0.2.8/src/vss.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/vss.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/vss.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,256 +0,0 @@ -// Copyright © 2015, Brian Vincent -// Licensed under the MIT License -//! VSS header file -ENUM!{enum VSS_OBJECT_TYPE { - VSS_OBJECT_UNKNOWN = 0, - VSS_OBJECT_NONE = 1, - VSS_OBJECT_SNAPSHOT_SET = 2, - VSS_OBJECT_SNAPSHOT = 3, - VSS_OBJECT_PROVIDER = 4, - VSS_OBJECT_TYPE_COUNT = 5, -}} -pub type PVSS_OBJECT_TYPE = *mut VSS_OBJECT_TYPE; -ENUM!{enum VSS_SNAPSHOT_STATE { - VSS_SS_UNKNOWN = 0x00, - VSS_SS_PREPARING = 0x01, - VSS_SS_PROCESSING_PREPARE = 0x02, - VSS_SS_PREPARED = 0x03, - VSS_SS_PROCESSING_PRECOMMIT = 0x04, - VSS_SS_PRECOMMITTED = 0x05, - VSS_SS_PROCESSING_COMMIT = 0x06, - VSS_SS_COMMITTED = 0x07, - VSS_SS_PROCESSING_POSTCOMMIT = 0x08, - VSS_SS_PROCESSING_PREFINALCOMMIT = 0x09, - VSS_SS_PREFINALCOMMITTED = 0x0a, - VSS_SS_PROCESSING_POSTFINALCOMMIT = 0x0b, - VSS_SS_CREATED = 0x0c, - VSS_SS_ABORTED = 0x0d, - VSS_SS_DELETED = 0x0e, - VSS_SS_POSTCOMMITTED = 0x0f, - VSS_SS_COUNT = 0x10, -}} -pub type PVSS_SNAPSHOT_STATE = *mut VSS_SNAPSHOT_STATE; -pub type VSS_VOLUME_SNAPSHOT_ATTRIBUTES = ::LONG; -pub const VSS_VOLSNAP_ATTR_PERSISTENT: ::LONG = 0x00000001; -pub const VSS_VOLSNAP_ATTR_NO_AUTORECOVERY: ::LONG = 0x00000002; -pub const VSS_VOLSNAP_ATTR_CLIENT_ACCESSIBLE: ::LONG = 0x00000004; -pub const VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE: ::LONG = 0x00000008; -pub const VSS_VOLSNAP_ATTR_NO_WRITERS: ::LONG = 0x00000010; -pub const VSS_VOLSNAP_ATTR_TRANSPORTABLE: ::LONG = 0x00000020; -pub const VSS_VOLSNAP_ATTR_NOT_SURFACED: ::LONG = 0x00000040; -pub const VSS_VOLSNAP_ATTR_NOT_TRANSACTED: ::LONG = 0x00000080; -pub const VSS_VOLSNAP_ATTR_HARDWARE_ASSISTED: ::LONG = 0x00010000; -pub const VSS_VOLSNAP_ATTR_DIFFERENTIAL: ::LONG = 0x00020000; -pub const VSS_VOLSNAP_ATTR_PLEX: ::LONG = 0x00040000; -pub const VSS_VOLSNAP_ATTR_IMPORTED: ::LONG = 0x00080000; -pub const VSS_VOLSNAP_ATTR_EXPOSED_LOCALLY: ::LONG = 0x00100000; -pub const VSS_VOLSNAP_ATTR_EXPOSED_REMOTELY: ::LONG = 0x00200000; -pub const VSS_VOLSNAP_ATTR_AUTORECOVER: ::LONG = 0x00400000; -pub const VSS_VOLSNAP_ATTR_ROLLBACK_RECOVERY: ::LONG = 0x00800000; -pub const VSS_VOLSNAP_ATTR_DELAYED_POSTSNAPSHOT: ::LONG = 0x01000000; -pub const VSS_VOLSNAP_ATTR_TXF_RECOVERY: ::LONG = 0x02000000; -pub const VSS_VOLSNAP_ATTR_FILE_SHARE: ::LONG = 0x04000000; -pub type PVSS_VOLUME_SNAPSHOT_ATTRIBUTES = *mut VSS_VOLUME_SNAPSHOT_ATTRIBUTES; -pub type VSS_SNAPSHOT_CONTEXT = ::LONG; -pub type PVSS_SNAPSHOT_CONTEXT = *mut VSS_SNAPSHOT_CONTEXT; -pub const VSS_CTX_BACKUP: ::LONG = 0; -pub const VSS_CTX_FILE_SHARE_BACKUP: ::LONG = VSS_VOLSNAP_ATTR_NO_WRITERS; -pub const VSS_CTX_NAS_ROLLBACK: ::LONG = VSS_VOLSNAP_ATTR_PERSISTENT - | VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE | VSS_VOLSNAP_ATTR_NO_WRITERS; -pub const VSS_CTX_APP_ROLLBACK: ::LONG = VSS_VOLSNAP_ATTR_PERSISTENT - | VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE; -pub const VSS_CTX_CLIENT_ACCESSIBLE: ::LONG = VSS_VOLSNAP_ATTR_PERSISTENT - | VSS_VOLSNAP_ATTR_CLIENT_ACCESSIBLE | VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE - | VSS_VOLSNAP_ATTR_NO_WRITERS; -pub const VSS_CTX_CLIENT_ACCESSIBLE_WRITERS: ::LONG = VSS_VOLSNAP_ATTR_PERSISTENT - | VSS_VOLSNAP_ATTR_CLIENT_ACCESSIBLE | VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE; -pub const VSS_CTX_ALL: ::LONG = 0xffffffffu32 as ::LONG; -pub type VSS_PROVIDER_CAPABILITIES = ::DWORD; -pub type PVSS_PROVIDER_CAPABILITIES = *mut VSS_PROVIDER_CAPABILITIES; -pub const VSS_PRV_CAPABILITY_LEGACY: ::DWORD = 0x1; -pub const VSS_PRV_CAPABILITY_COMPLIANT: ::DWORD = 0x2; -pub const VSS_PRV_CAPABILITY_LUN_REPOINT: ::DWORD = 0x4; -pub const VSS_PRV_CAPABILITY_LUN_RESYNC: ::DWORD = 0x8; -pub const VSS_PRV_CAPABILITY_OFFLINE_CREATION: ::DWORD = 0x10; -pub const VSS_PRV_CAPABILITY_MULTIPLE_IMPORT: ::DWORD = 0x20; -pub const VSS_PRV_CAPABILITY_RECYCLING: ::DWORD = 0x40; -pub const VSS_PRV_CAPABILITY_PLEX: ::DWORD = 0x80; -pub const VSS_PRV_CAPABILITY_DIFFERENTIAL: ::DWORD = 0x100; -pub const VSS_PRV_CAPABILITY_CLUSTERED: ::DWORD = 0x200; -pub type VSS_HARDWARE_OPTIONS = ::DWORD; -pub type PVSS_HARDWARE_OPTIONS = *mut VSS_HARDWARE_OPTIONS; -pub const VSS_BREAKEX_FLAG_MASK_LUNS: ::DWORD = 0x1; -pub const VSS_BREAKEX_FLAG_MAKE_READ_WRITE: ::DWORD = 0x2; -pub const VSS_BREAKEX_FLAG_REVERT_IDENTITY_ALL: ::DWORD = 0x4; -pub const VSS_BREAKEX_FLAG_REVERT_IDENTITY_NONE: ::DWORD = 0x8; -pub const VSS_ONLUNSTATECHANGE_NOTIFY_READ_WRITE: ::DWORD = 0x100; -pub const VSS_ONLUNSTATECHANGE_NOTIFY_LUN_PRE_RECOVERY: ::DWORD = 0x200; -pub const VSS_ONLUNSTATECHANGE_NOTIFY_LUN_POST_RECOVERY: ::DWORD = 0x400; -pub const VSS_ONLUNSTATECHANGE_DO_MASK_LUNS: ::DWORD = 0x800; -pub type VSS_RECOVERY_OPTIONS = ::DWORD; -pub type PVSS_RECOVERY_OPTIONS = *mut VSS_RECOVERY_OPTIONS; -pub const VSS_RECOVERY_REVERT_IDENTITY_ALL: ::DWORD = 0x00000100; -pub const VSS_RECOVERY_NO_VOLUME_CHECK: ::DWORD = 0x00000200; -ENUM!{enum VSS_WRITER_STATE { - VSS_WS_UNKNOWN = 0, - VSS_WS_STABLE = 1, - VSS_WS_WAITING_FOR_FREEZE = 2, - VSS_WS_WAITING_FOR_THAW = 3, - VSS_WS_WAITING_FOR_POST_SNAPSHOT = 4, - VSS_WS_WAITING_FOR_BACKUP_COMPLETE = 5, - VSS_WS_FAILED_AT_IDENTIFY = 6, - VSS_WS_FAILED_AT_PREPARE_BACKUP = 7, - VSS_WS_FAILED_AT_PREPARE_SNAPSHOT = 8, - VSS_WS_FAILED_AT_FREEZE = 9, - VSS_WS_FAILED_AT_THAW = 10, - VSS_WS_FAILED_AT_POST_SNAPSHOT = 11, - VSS_WS_FAILED_AT_BACKUP_COMPLETE = 12, - VSS_WS_FAILED_AT_PRE_RESTORE = 13, - VSS_WS_FAILED_AT_POST_RESTORE = 14, - VSS_WS_FAILED_AT_BACKUPSHUTDOWN = 15, - VSS_WS_COUNT = 16, -}} -pub type PVSS_WRITER_STATE = *mut VSS_WRITER_STATE; -ENUM!{enum VSS_BACKUP_TYPE { - VSS_BT_UNDEFINED = 0, - VSS_BT_FULL = 1, - VSS_BT_INCREMENTAL = 2, - VSS_BT_DIFFERENTIAL = 3, - VSS_BT_LOG = 4, - VSS_BT_COPY = 5, - VSS_BT_OTHER = 6, -}} -pub type PVSS_BACKUP_TYPE = *mut VSS_BACKUP_TYPE; -ENUM!{enum VSS_RESTORE_TYPE { - VSS_RTYPE_UNDEFINED = 0, - VSS_RTYPE_BY_COPY = 1, - VSS_RTYPE_IMPORT = 2, - VSS_RTYPE_OTHER = 3, -}} -pub type PVSS_RESTORE_TYPE = *mut VSS_RESTORE_TYPE; -ENUM!{enum VSS_ROLLFORWARD_TYPE { - VSS_RF_UNDEFINED = 0, - VSS_RF_NONE = 1, - VSS_RF_ALL = 2, - VSS_RF_PARTIAL = 3, -}} -pub type PVSS_ROLLFORWARD_TYPE = *mut VSS_ROLLFORWARD_TYPE; -ENUM!{enum VSS_PROVIDER_TYPE { - VSS_PROV_UNKNOWN = 0, - VSS_PROV_SYSTEM = 1, - VSS_PROV_SOFTWARE = 2, - VSS_PROV_HARDWARE = 3, - VSS_PROV_FILESHARE = 4, -}} -pub type PVSS_PROVIDER_TYPE = *mut VSS_PROVIDER_TYPE; -ENUM!{enum VSS_APPLICATION_LEVEL { - VSS_APP_UNKNOWN = 0, - VSS_APP_SYSTEM = 1, - VSS_APP_BACK_END = 2, - VSS_APP_FRONT_END = 3, - VSS_APP_SYSTEM_RM = 4, - VSS_APP_AUTO = -1i32 as u32, -}} -pub type PVSS_APPLICATION_LEVEL = *mut VSS_APPLICATION_LEVEL; -ENUM!{enum VSS_SNAPSHOT_PROPERTY_ID { - VSS_SPROPID_UNKNOWN = 0, - VSS_SPROPID_SNAPSHOT_ID = 0x1, - VSS_SPROPID_SNAPSHOT_SET_ID = 0x2, - VSS_SPROPID_SNAPSHOTS_COUNT = 0x3, - VSS_SPROPID_SNAPSHOT_DEVICE = 0x4, - VSS_SPROPID_ORIGINAL_VOLUME = 0x5, - VSS_SPROPID_ORIGINATING_MACHINE = 0x6, - VSS_SPROPID_SERVICE_MACHINE = 0x7, - VSS_SPROPID_EXPOSED_NAME = 0x8, - VSS_SPROPID_EXPOSED_PATH = 0x9, - VSS_SPROPID_PROVIDER_ID = 0xa, - VSS_SPROPID_SNAPSHOT_ATTRIBUTES = 0xb, - VSS_SPROPID_CREATION_TIMESTAMP = 0xc, - VSS_SPROPID_STATUS = 0xd, -}} -pub type PVSS_SNAPSHOT_PROPERTY_ID = *mut VSS_SNAPSHOT_PROPERTY_ID; -pub type VSS_FILE_SPEC_BACKUP_TYPE = ::DWORD; -pub type PVSS_FILE_SPEC_BACKUP_TYPE = *mut VSS_FILE_SPEC_BACKUP_TYPE; -pub const VSS_FSBT_FULL_BACKUP_REQUIRED: ::DWORD = 0x1; -pub const VSS_FSBT_DIFFERENTIAL_BACKUP_REQUIRED: ::DWORD = 0x2; -pub const VSS_FSBT_INCREMENTAL_BACKUP_REQUIRED: ::DWORD = 0x4; -pub const VSS_FSBT_LOG_BACKUP_REQUIRED: ::DWORD = 0x8; -pub const VSS_FSBT_FULL_SNAPSHOT_REQUIRED: ::DWORD = 0x100; -pub const VSS_FSBT_DIFFERENTIAL_SNAPSHOT_REQUIRED: ::DWORD = 0x200; -pub const VSS_FSBT_INCREMENTAL_SNAPSHOT_REQUIRED: ::DWORD = 0x400; -pub const VSS_FSBT_LOG_SNAPSHOT_REQUIRED: ::DWORD = 0x800; -pub const VSS_FSBT_CREATED_DURING_BACKUP: ::DWORD = 0x10000; -pub const VSS_FSBT_ALL_BACKUP_REQUIRED: ::DWORD = 0xf; -pub const VSS_FSBT_ALL_SNAPSHOT_REQUIRED: ::DWORD = 0xf00; -pub type VSS_BACKUP_SCHEMA = ::DWORD; -pub type PVSS_BACKUP_SCHEMA = *mut VSS_BACKUP_SCHEMA; -pub const VSS_BS_UNDEFINED: ::DWORD = 0; -pub const VSS_BS_DIFFERENTIAL: ::DWORD = 0x1; -pub const VSS_BS_INCREMENTAL: ::DWORD = 0x2; -pub const VSS_BS_EXCLUSIVE_INCREMENTAL_DIFFERENTIAL: ::DWORD = 0x4; -pub const VSS_BS_LOG: ::DWORD = 0x8; -pub const VSS_BS_COPY: ::DWORD = 0x10; -pub const VSS_BS_TIMESTAMPED: ::DWORD = 0x20; -pub const VSS_BS_LAST_MODIFY: ::DWORD = 0x40; -pub const VSS_BS_LSN: ::DWORD = 0x80; -pub const VSS_BS_WRITER_SUPPORTS_NEW_TARGET: ::DWORD = 0x100; -pub const VSS_BS_WRITER_SUPPORTS_RESTORE_WITH_MOVE: ::DWORD = 0x200; -pub const VSS_BS_INDEPENDENT_SYSTEM_STATE: ::DWORD = 0x400; -pub const VSS_BS_ROLLFORWARD_RESTORE: ::DWORD = 0x1000; -pub const VSS_BS_RESTORE_RENAME: ::DWORD = 0x2000; -pub const VSS_BS_AUTHORITATIVE_RESTORE: ::DWORD = 0x4000; -pub const VSS_BS_WRITER_SUPPORTS_PARALLEL_RESTORES: ::DWORD = 0x8000; -pub type VSS_ID = ::GUID; -pub type VSS_PWSZ = *mut ::WCHAR; -pub type VSS_TIMESTAMP = ::LONGLONG; -STRUCT!{struct VSS_SNAPSHOT_PROP { - m_SnapshotId: ::VSS_ID, - m_SnapshotSetId: ::VSS_ID, - m_lSnapshotsCount: ::LONG, - m_pwszSnapshotDeviceObject: ::VSS_PWSZ, - m_pwszOriginalVolumeName: ::VSS_PWSZ, - m_pwszOriginatingMachine: ::VSS_PWSZ, - m_pwszServiceMachine: ::VSS_PWSZ, - m_pwszExposedName: ::VSS_PWSZ, - m_pwszExposedPath: ::VSS_PWSZ, - m_ProviderId: ::VSS_ID, - m_lSnapshotAttributes: ::LONG, - m_tsCreationTimestamp: ::VSS_TIMESTAMP, - m_eStatus: ::VSS_SNAPSHOT_STATE, -}} -type PVSS_SNAPSHOT_PROP = *mut VSS_SNAPSHOT_PROP; -STRUCT!{struct VSS_PROVIDER_PROP { - m_ProviderId: ::VSS_ID, - m_pwszProviderName: ::VSS_PWSZ, - m_eProviderType: ::VSS_PROVIDER_TYPE, - m_pwszProviderVersion: ::VSS_PWSZ, - m_ProviderVersionId: ::VSS_ID, - m_ClassId: ::CLSID, -}} -type PVSS_PROVIDER_PROP = *mut VSS_PROVIDER_PROP; -STRUCT!{struct VSS_OBJECT_UNION { - Snap: ::VSS_SNAPSHOT_PROP, -}} -UNION!(VSS_OBJECT_UNION, Snap, Prov, Prov_mut, VSS_PROVIDER_PROP); -STRUCT!{struct VSS_OBJECT_PROP { - Type: ::VSS_OBJECT_TYPE, - Obj: ::VSS_OBJECT_UNION, -}} -type PVSS_OBJECT_PROP = *mut VSS_OBJECT_PROP; -RIDL!( -interface IVssEnumObject(IVssEnumObjectVtbl): IUnknown(IUnknownVtbl) { - fn Next( - &mut self, celt: ::ULONG, rgelt: *mut ::VSS_OBJECT_PROP, pceltFetched: *mut ::ULONG - ) -> ::HRESULT, - fn Skip(&mut self, celt: ::ULONG) -> ::HRESULT, - fn Reset(&mut self) -> ::HRESULT, - fn Clone(&mut self, ppenum: *mut *mut ::IVssEnumObject) -> ::HRESULT -} -); -RIDL!( -interface IVssAsync(IVssAsyncVtbl): IUnknown(IUnknownVtbl) { - fn Cancel(&mut self) -> ::HRESULT, - fn Wait(&mut self, dwMilliseconds: ::DWORD) -> ::HRESULT, - fn QueryStatus(&mut self, pHrResult: *mut ::HRESULT, pReserved: *mut ::INT) -> ::HRESULT -} -); diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/vswriter.rs cargo-0.37.0/vendor/winapi-0.2.8/src/vswriter.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/vswriter.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/vswriter.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,241 +0,0 @@ -// Copyright © 2015, Brian Vincent -// Licensed under the MIT License -//! VSS Writer header file -ENUM!{enum VSS_USAGE_TYPE { - VSS_UT_UNDEFINED = 0, - VSS_UT_BOOTABLESYSTEMSTATE = 1, - VSS_UT_SYSTEMSERVICE = 2, - VSS_UT_USERDATA = 3, - VSS_UT_OTHER = 4, -}} -ENUM!{enum VSS_SOURCE_TYPE { - VSS_ST_UNDEFINED = 0, - VSS_ST_TRANSACTEDDB = 1, - VSS_ST_NONTRANSACTEDDB = 2, - VSS_ST_OTHER = 3, -}} -ENUM!{enum VSS_RESTOREMETHOD_ENUM { - VSS_RME_UNDEFINED = 0, - VSS_RME_RESTORE_IF_NOT_THERE = 1, - VSS_RME_RESTORE_IF_CAN_REPLACE = 2, - VSS_RME_STOP_RESTORE_START = 3, - VSS_RME_RESTORE_TO_ALTERNATE_LOCATION = 4, - VSS_RME_RESTORE_AT_REBOOT = 5, - VSS_RME_RESTORE_AT_REBOOT_IF_CANNOT_REPLACE = 6, - VSS_RME_CUSTOM = 7, - VSS_RME_RESTORE_STOP_START = 8, -}} -ENUM!{enum VSS_WRITERRESTORE_ENUM { - VSS_WRE_UNDEFINED = 0, - VSS_WRE_NEVER = 1, - VSS_WRE_IF_REPLACE_FAILS = 2, - VSS_WRE_ALWAYS = 3, -}} -ENUM!{enum VSS_COMPONENT_TYPE { - VSS_CT_UNDEFINED = 0, - VSS_CT_DATABASE = 1, - VSS_CT_FILEGROUP = 2, -}} -ENUM!{enum VSS_ALTERNATE_WRITER_STATE { - VSS_AWS_UNDEFINED = 0, - VSS_AWS_NO_ALTERNATE_WRITER = 1, - VSS_AWS_ALTERNATE_WRITER_EXISTS = 2, - VSS_AWS_THIS_IS_ALTERNATE_WRITER = 3, -}} -pub type VSS_SUBSCRIBE_MASK = ::DWORD; -pub const VSS_SM_POST_SNAPSHOT_FLAG: ::DWORD = 0x00000001; -pub const VSS_SM_BACKUP_EVENTS_FLAG: ::DWORD = 0x00000002; -pub const VSS_SM_RESTORE_EVENTS_FLAG: ::DWORD = 0x00000004; -pub const VSS_SM_IO_THROTTLING_FLAG: ::DWORD = 0x00000008; -pub const VSS_SM_ALL_FLAGS: ::DWORD = 0xffffffff; -ENUM!{enum VSS_RESTORE_TARGET { - VSS_RT_UNDEFINED = 0, - VSS_RT_ORIGINAL = 1, - VSS_RT_ALTERNATE = 2, - VSS_RT_DIRECTED = 3, - VSS_RT_ORIGINAL_LOCATION = 4, -}} -ENUM!{enum VSS_FILE_RESTORE_STATUS { - VSS_RS_UNDEFINED = 0, - VSS_RS_NONE = 1, - VSS_RS_ALL = 2, - VSS_RS_FAILED = 3, -}} -pub type VSS_COMPONENT_FLAGS = ::DWORD; -pub const VSS_CF_BACKUP_RECOVERY: ::DWORD = 0x00000001; -pub const VSS_CF_APP_ROLLBACK_RECOVERY: ::DWORD = 0x00000002; -pub const VSS_CF_NOT_SYSTEM_STATE: ::DWORD = 0x00000004; -RIDL!( -interface IVssWMFiledesc(IVssWMFiledescVtbl): IUnknown(IUnknownVtbl) { - fn GetPath(&mut self, pbstrPath: *mut ::BSTR) -> ::HRESULT, - fn GetFilespec(&mut self, pbstrFilespec: *mut ::BSTR) -> ::HRESULT, - fn GetRecursive(&mut self, pbRecursive: *mut bool) -> ::HRESULT, - fn GetAlternateLocation(&mut self, pbstrAlternateLocation: *mut ::BSTR) -> ::HRESULT, - fn GetBackupTypeMask(&mut self, pdwTypeMask: *mut ::DWORD) -> ::HRESULT -} -); -RIDL!( -interface IVssWMDependency(IVssWMDependencyVtbl): IUnknown(IUnknownVtbl) { - fn GetWriterId(&mut self, pWriterId: *mut ::VSS_ID) -> ::HRESULT, - fn GetLogicalPath(&mut self, pbstrLogicalPath: *mut ::BSTR) -> ::HRESULT, - fn GetComponentName(&mut self, pbstrComponentName: *mut ::BSTR) -> ::HRESULT -} -); -RIDL!( -interface IVssComponent(IVssComponentVtbl): IUnknown(IUnknownVtbl) { - fn GetLogicalPath(&mut self, pbstrPath: *mut ::BSTR) -> ::HRESULT, - fn GetComponentType(&mut self, pct: *mut ::VSS_COMPONENT_TYPE) -> ::HRESULT, - fn GetComponentName(&mut self, pbstrName: *mut ::BSTR) -> ::HRESULT, - fn GetBackupSucceeded(&mut self, pbSucceeded: *mut bool) -> ::HRESULT, - fn GetAlternateLocationMappingCount(&mut self, pcMappings: *mut ::UINT) -> ::HRESULT, - fn GetAlternateLocationMapping( - &mut self, iMapping: ::UINT, ppFiledesc: *mut *mut ::IVssWMFiledesc - ) -> ::HRESULT, - fn SetBackupMetadata(&mut self, wszData: ::LPCWSTR) -> ::HRESULT, - fn GetBackupMetadata(&mut self, pbstrData: *mut ::BSTR) -> ::HRESULT, - fn AddPartialFile( - &mut self, wszPath: ::LPCWSTR, wszFilename: ::LPCWSTR, wszRanges: ::LPCWSTR, - wszMetadata: ::LPCWSTR - ) -> ::HRESULT, - fn GetPartialFileCount(&mut self, pcPartialFiles: *mut ::UINT) -> ::HRESULT, - fn GetPartialFile( - &mut self, iPartialFile: ::UINT, pbstrPath: *mut ::BSTR, pbstrFilename: *mut ::BSTR, - pbstrRange: *mut ::BSTR, pbstrMetadata: *mut ::BSTR - ) -> ::HRESULT, - fn IsSelectedForRestore(&mut self, pbSelectedForRestore: *mut bool) -> ::HRESULT, - fn GetAdditionalRestores(&mut self, pbAdditionalRestores: *mut bool) -> ::HRESULT, - fn GetNewTargetCount(&mut self, pcNewTarget: *mut ::UINT) -> ::HRESULT, - fn GetNewTarget( - &mut self, iNewTarget: ::UINT, ppFiledesc: *mut *mut ::IVssWMFiledesc - ) -> ::HRESULT, - fn AddDirectedTarget( - &mut self, wszSourcePath: ::LPCWSTR, wszSourceFilename: ::LPCWSTR, - wszSourceRangeList: ::LPCWSTR, wszDestinationPath: ::LPCWSTR, - wszDestinationFilename: ::LPCWSTR, wszDestinationRangeList: ::LPCWSTR - ) -> ::HRESULT, - fn GetDirectedTargetCount(&mut self, pcDirectedTarget: *mut ::UINT) -> ::HRESULT, - fn GetDirectedTarget( - &mut self, iDirectedTarget: ::UINT, pbstrSourcePath: *mut ::BSTR, - pbstrSourceFileName: *mut ::BSTR, pbstrSourceRangeList: *mut ::BSTR, - pbstrDestinationPath: *mut ::BSTR, pbstrDestinationFilename: *mut ::BSTR, - pbstrDestinationRangeList: *mut ::BSTR - ) -> ::HRESULT, - fn SetRestoreMetadata(&mut self, wszRestoreMetadata: ::LPCWSTR) -> ::HRESULT, - fn GetRestoreMetadata(&mut self, pbstrRestoreMetadata: *mut ::BSTR) -> ::HRESULT, - fn SetRestoreTarget(&mut self, target: ::VSS_RESTORE_TARGET) -> ::HRESULT, - fn GetRestoreTarget(&mut self, pTarget: *mut ::VSS_RESTORE_TARGET) -> ::HRESULT, - fn SetPreRestoreFailureMsg(&mut self, wszPreRestoreFailureMsg: ::LPCWSTR) -> ::HRESULT, - fn GetPreRestoreFailureMsg(&mut self, pbstrPreRestoreFailureMsg: *mut ::BSTR) -> ::HRESULT, - fn SetPostRestoreFailureMsg(&mut self, wszPostRestoreFailureMsg: ::LPCWSTR) -> ::HRESULT, - fn GetPostRestoreFailureMsg(&mut self, pbstrPostRestoreFailureMsg: *mut ::BSTR) -> ::HRESULT, - fn SetBackupStamp(&mut self, wszBackupStamp: ::LPCWSTR) -> ::HRESULT, - fn GetBackupStamp(&mut self, pbstrBackupStamp: *mut ::BSTR) -> ::HRESULT, - fn GetPreviousBackupStamp(&mut self, pbstrBackupStamp: *mut ::BSTR) -> ::HRESULT, - fn GetBackupOptions(&mut self, pbstrBackupOptions: *mut ::BSTR) -> ::HRESULT, - fn GetRestoreOptions(&mut self, pbstrRestoreOptions: *mut ::BSTR) -> ::HRESULT, - fn GetRestoreSubcomponentCount(&mut self, pcRestoreSubcomponent: *mut ::UINT) -> ::HRESULT, - fn GetRestoreSubcomponent( - &mut self, iComponent: ::UINT, pbstrLogicalPath: *mut ::BSTR, - pbstrComponentName: *mut ::BSTR, pbRepair: *mut bool - ) -> ::HRESULT, - fn GetFileRestoreStatus(&mut self, pStatus: *mut VSS_FILE_RESTORE_STATUS) -> ::HRESULT, - fn AddDifferencedFilesByLastModifyTime( - &mut self, wszPath: ::LPCWSTR, wszFilespec: ::LPCWSTR, bRecursive: ::BOOL, - ftLastModifyTime: ::FILETIME - ) -> ::HRESULT, - fn AddDifferencedFilesByLastModifyLSN( - &mut self, wszPath: ::LPCWSTR, wszFilespec: ::LPCWSTR, bRecursive: ::BOOL, - bstrLsnString: ::BSTR - ) -> ::HRESULT, - fn GetDifferencedFilesCount(&mut self, pcDifferencedFiles: *mut ::UINT) -> ::HRESULT, - fn GetDifferencedFile( - &mut self, iDifferencedFile: ::UINT, pbstrPath: *mut ::BSTR, pbstrFilespec: *mut ::BSTR, - pbRecursive: *mut ::BOOL, pbstrLsnString: *mut ::BSTR, pftLastModifyTime: *mut ::FILETIME - ) -> ::HRESULT -} -); -RIDL!( -interface IVssWriterComponents(IVssWriterComponentsVtbl) { - fn GetComponentCount(&mut self, pcComponents: *mut ::UINT) -> ::HRESULT, - fn GetWriterInfo( - &mut self, pidInstance: *mut ::VSS_ID, pidWriter: *mut ::VSS_ID - ) -> ::HRESULT, - fn GetComponent( - &mut self, iComponent: ::UINT, ppComponent: *mut *mut ::IVssComponent - ) -> ::HRESULT -} -); -RIDL!( -interface IVssComponentEx(IVssComponentExVtbl): IVssComponent(IVssComponentVtbl) { - fn SetPrepareForBackupFailureMsg(&mut self, wszFailureMsg: ::LPCWSTR) -> ::HRESULT, - fn SetPostSnapshotFailureMsg(&mut self, wszFailureMsg: ::LPCWSTR) -> ::HRESULT, - fn GetPrepareForBackupFailureMsg(&mut self, pbstrFailureMsg: *mut ::BSTR) -> ::HRESULT, - fn GetPostSnapshotFailureMsg(&mut self, pbstrFailureMsg: *mut ::BSTR) -> ::HRESULT, - fn GetAuthoritativeRestore(&mut self, pbAuth: *mut bool) -> ::HRESULT, - fn GetRollForward( - &mut self, pRollType: *mut ::VSS_ROLLFORWARD_TYPE, pbstrPoint: *mut ::BSTR - ) -> ::HRESULT, - fn GetRestoreName(&mut self, pbstrName: *mut ::BSTR) -> ::HRESULT -} -); -RIDL!( -interface IVssComponentEx2(IVssComponentEx2Vtbl): IVssComponentEx(IVssComponentExVtbl) { - fn SetFailure( - &mut self, hr: ::HRESULT, hrApplication: ::HRESULT, wszApplicationMessage: ::LPCWSTR, - dwReserved: ::DWORD - ) -> ::HRESULT, - fn GetFailure( - &mut self, phr: *mut ::HRESULT, phrApplication: *mut ::HRESULT, - pbstrApplicationMessage: *mut ::BSTR, pdwReserved: *mut ::DWORD - ) -> ::HRESULT -} -); -RIDL!( -interface IVssCreateWriterMetadata(IVssCreateWriterMetadataVtbl) { - fn AddIncludeFiles( - &mut self, wszPath: ::LPCWSTR, wszFilespec: ::LPCWSTR, bRecursive: bool, - wszAlternateLocation: ::LPCWSTR - ) -> ::HRESULT, - fn AddExcludeFiles( - &mut self, wszPath: ::LPCWSTR, wszFilespec: ::LPCWSTR, bRecursive: bool - ) -> ::HRESULT, - fn AddComponent( - &mut self, ct: ::VSS_COMPONENT_TYPE, wszLogicalPath: ::LPCWSTR, - wszComponentName: ::LPCWSTR, wszCaption: ::LPCWSTR, pbIcon: *const ::BYTE, cbIcon: ::UINT, - bRestoreMetadata: bool, bNotifyOnBackupComplete: bool, bSelectableForRestore: bool, - dwComponentFlags: ::DWORD - ) -> ::HRESULT, - fn AddDatabaseFiles( - &mut self, wszLogicalPath: ::LPCWSTR, wszDatabaseName: ::LPCWSTR, wszPath: ::LPCWSTR, - wszFilespec: ::LPCWSTR, dwBackupTypeMask: ::DWORD - ) -> ::HRESULT, - fn AddDatabaseLogFiles(&mut self, wszLogicalPath: ::LPCWSTR, wszDatabaseName: ::LPCWSTR, - wszPath: ::LPCWSTR, wszFilespec: ::LPCWSTR, dwBackupTypeMask: ::DWORD - ) -> ::HRESULT, - fn AddFilesToFileGroup(&mut self, wszLogicalPath: ::LPCWSTR, wszGroupName: ::LPCWSTR, - wszPath: ::LPCWSTR, wszFilespec: ::LPCWSTR, bRecursive: bool, - wszAlternateLocation: ::LPCWSTR, dwBackupTypeMask: ::DWORD - ) -> ::HRESULT, - fn SetRestoreMethod(&mut self, method: ::VSS_RESTOREMETHOD_ENUM, wszService: ::LPCWSTR, - wszUserProcedure: ::LPCWSTR, writerRestore: ::VSS_WRITERRESTORE_ENUM, - bRebootRequired: bool - ) -> ::HRESULT, - fn AddAlternateLocationMapping(&mut self, wszSourcePath: ::LPCWSTR, - wszSourceFilespec: ::LPCWSTR, bRecursive: bool, wszDestination: ::LPCWSTR - ) -> ::HRESULT, - fn AddComponentDependency(&mut self, wszForLogicalPath: ::LPCWSTR, - wszForComponentName: ::LPCWSTR, onWriterId: ::VSS_ID, wszOnLogicalPath: ::LPCWSTR, - wszOnComponentName: ::LPCWSTR - ) -> ::HRESULT, - fn SetBackupSchema(&mut self, dwSchemaMask: ::DWORD) -> ::HRESULT, - fn GetDocument(&mut self, pDoc: *mut *mut ::VOID) -> ::HRESULT, //TODO IXMLDOMDocument - fn SaveAsXML(&mut self, pbstrXML: *mut ::BSTR) -> ::HRESULT -} -); -//IVssCreateWriterMetadataEx -//IVssWriterImpl -//IVssCreateExpressWriterMetadata -//IVssExpressWriter -//CVssWriter -//CVssWriterEx -//CVssWriterEx2 diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/werapi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/werapi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/werapi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/werapi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! Function prototypes for Windows Error Reporting (WER) -ENUM!{enum WER_REGISTER_FILE_TYPE { - WerRegFileTypeUserDocument = 1, - WerRegFileTypeOther = 2, - WerRegFileTypeMax, -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/winbase.rs cargo-0.37.0/vendor/winapi-0.2.8/src/winbase.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/winbase.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/winbase.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,552 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! This module defines the 32-Bit Windows Base APIs -pub const FILE_BEGIN: ::DWORD = 0; -pub const FILE_CURRENT: ::DWORD = 1; -pub const FILE_END: ::DWORD = 2; -pub const WAIT_FAILED: ::DWORD = 0xFFFFFFFF; -pub const WAIT_OBJECT_0: ::DWORD = ::STATUS_WAIT_0 as ::DWORD; -pub const WAIT_ABANDONED: ::DWORD = ::STATUS_ABANDONED_WAIT_0 as ::DWORD; -pub const WAIT_ABANDONED_0: ::DWORD = ::STATUS_ABANDONED_WAIT_0 as ::DWORD; -pub const WAIT_IO_COMPLETION: ::DWORD = ::STATUS_USER_APC as ::DWORD; -pub const FILE_FLAG_WRITE_THROUGH: ::DWORD = 0x80000000; -pub const FILE_FLAG_OVERLAPPED: ::DWORD = 0x40000000; -pub const FILE_FLAG_NO_BUFFERING: ::DWORD = 0x20000000; -pub const FILE_FLAG_RANDOM_ACCESS: ::DWORD = 0x10000000; -pub const FILE_FLAG_SEQUENTIAL_SCAN: ::DWORD = 0x08000000; -pub const FILE_FLAG_DELETE_ON_CLOSE: ::DWORD = 0x04000000; -pub const FILE_FLAG_BACKUP_SEMANTICS: ::DWORD = 0x02000000; -pub const FILE_FLAG_POSIX_SEMANTICS: ::DWORD = 0x01000000; -pub const FILE_FLAG_SESSION_AWARE: ::DWORD = 0x00800000; -pub const FILE_FLAG_OPEN_REPARSE_POINT: ::DWORD = 0x00200000; -pub const FILE_FLAG_OPEN_NO_RECALL: ::DWORD = 0x00100000; -pub const FILE_FLAG_FIRST_PIPE_INSTANCE: ::DWORD = 0x00080000; -pub const FILE_FLAG_OPEN_REQUIRING_OPLOCK: ::DWORD = 0x00040000; -pub const PROGRESS_CONTINUE: ::DWORD = 0; -pub const PROGRESS_CANCEL: ::DWORD = 1; -pub const PROGRESS_STOP: ::DWORD = 2; -pub const PROGRESS_QUIET: ::DWORD = 3; -pub const CALLBACK_CHUNK_FINISHED: ::DWORD = 0x00000000; -pub const CALLBACK_STREAM_SWITCH: ::DWORD = 0x00000001; -pub const COPY_FILE_FAIL_IF_EXISTS: ::DWORD = 0x00000001; -pub const COPY_FILE_RESTARTABLE: ::DWORD = 0x00000002; -pub const COPY_FILE_OPEN_SOURCE_FOR_WRITE: ::DWORD = 0x00000004; -pub const COPY_FILE_ALLOW_DECRYPTED_DESTINATION: ::DWORD = 0x00000008; -pub const COPY_FILE_COPY_SYMLINK: ::DWORD = 0x00000800; -pub const COPY_FILE_NO_BUFFERING: ::DWORD = 0x00001000; -pub const COPY_FILE_REQUEST_SECURITY_PRIVILEGES: ::DWORD = 0x00002000; -pub const COPY_FILE_RESUME_FROM_PAUSE: ::DWORD = 0x00004000; -pub const COPY_FILE_NO_OFFLOAD: ::DWORD = 0x00040000; -pub const REPLACEFILE_WRITE_THROUGH: ::DWORD = 0x00000001; -pub const REPLACEFILE_IGNORE_MERGE_ERRORS: ::DWORD = 0x00000002; -pub const REPLACEFILE_IGNORE_ACL_ERRORS: ::DWORD = 0x00000004; -pub const PIPE_ACCESS_INBOUND: ::DWORD = 0x00000001; -pub const PIPE_ACCESS_OUTBOUND: ::DWORD = 0x00000002; -pub const PIPE_ACCESS_DUPLEX: ::DWORD = 0x00000003; -pub const PIPE_CLIENT_END: ::DWORD = 0x00000000; -pub const PIPE_SERVER_END: ::DWORD = 0x00000001; -pub const PIPE_WAIT: ::DWORD = 0x00000000; -pub const PIPE_NOWAIT: ::DWORD = 0x00000001; -pub const PIPE_READMODE_BYTE: ::DWORD = 0x00000000; -pub const PIPE_READMODE_MESSAGE: ::DWORD = 0x00000002; -pub const PIPE_TYPE_BYTE: ::DWORD = 0x00000000; -pub const PIPE_TYPE_MESSAGE: ::DWORD = 0x00000004; -pub const PIPE_ACCEPT_REMOTE_CLIENTS: ::DWORD = 0x00000000; -pub const PIPE_REJECT_REMOTE_CLIENTS: ::DWORD = 0x00000008; -pub const PIPE_UNLIMITED_INSTANCES: ::DWORD = 255; -//270 -pub const SECURITY_CONTEXT_TRACKING: ::DWORD = 0x00040000; -pub const SECURITY_EFFECTIVE_ONLY: ::DWORD = 0x00080000; -pub const SECURITY_SQOS_PRESENT: ::DWORD = 0x00100000; -pub const SECURITY_VALID_SQOS_FLAGS: ::DWORD = 0x001F0000; -//282 -pub type PFIBER_START_ROUTINE = Option; -pub type LPFIBER_START_ROUTINE = PFIBER_START_ROUTINE; -pub type PFIBER_CALLOUT_ROUTINE = Option ::LPVOID>; -//299 -pub type LPLDT_ENTRY = ::LPVOID; // TODO - fix this for 32-bit -//405 -STRUCT!{struct COMMPROP { - wPacketLength: ::WORD, - wPacketVersion: ::WORD, - dwServiceMask: ::DWORD, - dwReserved1: ::DWORD, - dwMaxTxQueue: ::DWORD, - dwMaxRxQueue: ::DWORD, - dwMaxBaud: ::DWORD, - dwProvSubType: ::DWORD, - dwProvCapabilities: ::DWORD, - dwSettableParams: ::DWORD, - dwSettableBaud: ::DWORD, - wSettableData: ::WORD, - wSettableStopParity: ::WORD, - dwCurrentTxQueue: ::DWORD, - dwCurrentRxQueue: ::DWORD, - dwProvSpec1: ::DWORD, - dwProvSpec2: ::DWORD, - wcProvChar: [::WCHAR; 1], -}} -pub type LPCOMMPROP = *mut COMMPROP; -//432 -STRUCT!{struct COMSTAT { - BitFields: ::DWORD, - cbInQue: ::DWORD, - cbOutQue : ::DWORD, -}} -BITFIELD!(COMSTAT BitFields: ::DWORD [ - fCtsHold set_fCtsHold[0..1], - fDsrHold set_fDsrHold[1..2], - fRlsdHold set_fRlsdHold[2..3], - fXoffHold set_fXoffHold[3..4], - fXoffSent set_fXoffSent[4..5], - fEof set_fEof[5..6], - fTxim set_fTxim[6..7], - fReserved set_fReserved[7..32], -]); -pub type LPCOMSTAT = *mut COMSTAT; -//460 -STRUCT!{struct DCB { - DCBlength: ::DWORD, - BaudRate: ::DWORD, - BitFields: ::DWORD, - wReserved: ::WORD, - XonLim: ::WORD, - XoffLim: ::WORD, - ByteSize: ::BYTE, - Parity: ::BYTE, - StopBits: ::BYTE, - XonChar: ::c_char, - XoffChar: ::c_char, - ErrorChar: ::c_char, - EofChar: ::c_char, - EvtChar: ::c_char, - wReserved1: ::WORD, -}} -BITFIELD!(DCB BitFields: ::DWORD [ - fBinary set_fBinary[0..1], - fParity set_fParity[1..2], - fOutxCtsFlow set_fOutxCtsFlow[2..3], - fOutxDsrFlow set_fOutxDsrFlow[3..4], - fDtrControl set_fDtrControl[4..6], - fDsrSensitivity set_fDsrSensitivity[6..7], - fTXContinueOnXoff set_fTXContinueOnXoff[7..8], - fOutX set_fOutX[8..9], - fInX set_fInX[9..10], - fErrorChar set_fErrorChar[10..11], - fNull set_fNull[11..12], - fRtsControl set_fRtsControl[12..14], - fAbortOnError set_fAbortOnError[14..15], - fDummy2 set_fDummy2[15..32], -]); -pub type LPDCB = *mut DCB; -STRUCT!{struct COMMTIMEOUTS { - ReadIntervalTimeout: ::DWORD, - ReadTotalTimeoutMultiplier: ::DWORD, - ReadTotalTimeoutConstant: ::DWORD, - WriteTotalTimeoutMultiplier: ::DWORD, - WriteTotalTimeoutConstant: ::DWORD, -}} -pub type LPCOMMTIMEOUTS = *mut COMMTIMEOUTS; -STRUCT!{struct COMMCONFIG { - dwSize: ::DWORD, - wVersion: ::WORD, - wReserved: ::WORD, - dcb: DCB, - dwProviderSubType: ::DWORD, - dwProviderOffset: ::DWORD, - dwProviderSize: ::DWORD, - wcProviderData: [::WCHAR; 1], -}} -pub type LPCOMMCONFIG = *mut COMMCONFIG; -//547 -STRUCT!{struct MEMORYSTATUS { - dwLength: ::DWORD, - dwMemoryLoad: ::DWORD, - dwTotalPhys: ::SIZE_T, - dwAvailPhys: ::SIZE_T, - dwTotalPageFile: ::SIZE_T, - dwAvailPageFile: ::SIZE_T, - dwTotalVirtual: ::SIZE_T, - dwAvailVirtual: ::SIZE_T, -}} -pub type LPMEMORYSTATUS = *mut MEMORYSTATUS; -//568 -pub const DEBUG_PROCESS: ::DWORD = 0x00000001; -pub const DEBUG_ONLY_THIS_PROCESS: ::DWORD = 0x00000002; -pub const CREATE_SUSPENDED: ::DWORD = 0x00000004; -pub const DETACHED_PROCESS: ::DWORD = 0x00000008; -pub const CREATE_NEW_CONSOLE: ::DWORD = 0x00000010; -pub const NORMAL_PRIORITY_CLASS: ::DWORD = 0x00000020; -pub const IDLE_PRIORITY_CLASS: ::DWORD = 0x00000040; -pub const HIGH_PRIORITY_CLASS: ::DWORD = 0x00000080; -pub const REALTIME_PRIORITY_CLASS: ::DWORD = 0x00000100; -pub const CREATE_NEW_PROCESS_GROUP: ::DWORD = 0x00000200; -pub const CREATE_UNICODE_ENVIRONMENT: ::DWORD = 0x00000400; -pub const CREATE_SEPARATE_WOW_VDM: ::DWORD = 0x00000800; -pub const CREATE_SHARED_WOW_VDM: ::DWORD = 0x00001000; -pub const CREATE_FORCEDOS: ::DWORD = 0x00002000; -pub const BELOW_NORMAL_PRIORITY_CLASS: ::DWORD = 0x00004000; -pub const ABOVE_NORMAL_PRIORITY_CLASS: ::DWORD = 0x00008000; -pub const INHERIT_PARENT_AFFINITY: ::DWORD = 0x00010000; -pub const INHERIT_CALLER_PRIORITY: ::DWORD = 0x00020000; -pub const CREATE_PROTECTED_PROCESS: ::DWORD = 0x00040000; -pub const EXTENDED_STARTUPINFO_PRESENT: ::DWORD = 0x00080000; -pub const PROCESS_MODE_BACKGROUND_BEGIN: ::DWORD = 0x00100000; -pub const PROCESS_MODE_BACKGROUND_END: ::DWORD = 0x00200000; -pub const CREATE_BREAKAWAY_FROM_JOB: ::DWORD = 0x01000000; -pub const CREATE_PRESERVE_CODE_AUTHZ_LEVEL: ::DWORD = 0x02000000; -pub const CREATE_DEFAULT_ERROR_MODE: ::DWORD = 0x04000000; -pub const CREATE_NO_WINDOW: ::DWORD = 0x08000000; -pub const PROFILE_USER: ::DWORD = 0x10000000; -pub const PROFILE_KERNEL: ::DWORD = 0x20000000; -pub const PROFILE_SERVER: ::DWORD = 0x40000000; -pub const CREATE_IGNORE_SYSTEM_DEFAULT: ::DWORD = 0x80000000; -//618 -pub const THREAD_PRIORITY_LOWEST: ::DWORD = ::THREAD_BASE_PRIORITY_MIN; -pub const THREAD_PRIORITY_BELOW_NORMAL: ::DWORD = THREAD_PRIORITY_LOWEST + 1; -pub const THREAD_PRIORITY_NORMAL: ::DWORD = 0; -pub const THREAD_PRIORITY_HIGHEST: ::DWORD = ::THREAD_BASE_PRIORITY_MAX; -pub const THREAD_PRIORITY_ABOVE_NORMAL: ::DWORD = THREAD_PRIORITY_HIGHEST - 1; -pub const THREAD_PRIORITY_ERROR_RETURN: ::DWORD = ::MAXLONG as ::DWORD; -pub const THREAD_PRIORITY_TIME_CRITICAL: ::DWORD = ::THREAD_BASE_PRIORITY_LOWRT; -pub const THREAD_PRIORITY_IDLE: ::DWORD = ::THREAD_BASE_PRIORITY_IDLE; -pub const THREAD_MODE_BACKGROUND_BEGIN: ::DWORD = 0x00010000; -pub const THREAD_MODE_BACKGROUND_END: ::DWORD = 0x00020000; -//666 -pub const DRIVE_UNKNOWN: ::DWORD = 0; -pub const DRIVE_NO_ROOT_DIR: ::DWORD = 1; -pub const DRIVE_REMOVABLE: ::DWORD = 2; -pub const DRIVE_FIXED: ::DWORD = 3; -pub const DRIVE_REMOTE: ::DWORD = 4; -pub const DRIVE_CDROM: ::DWORD = 5; -pub const DRIVE_RAMDISK: ::DWORD = 6; -pub const FILE_TYPE_UNKNOWN: ::DWORD = 0x0000; -pub const FILE_TYPE_DISK: ::DWORD = 0x0001; -pub const FILE_TYPE_CHAR: ::DWORD = 0x0002; -pub const FILE_TYPE_PIPE: ::DWORD = 0x0003; -pub const FILE_TYPE_REMOTE: ::DWORD = 0x8000; -pub const STD_INPUT_HANDLE: ::DWORD = 0xFFFFFFF6; -pub const STD_OUTPUT_HANDLE: ::DWORD = 0xFFFFFFF5; -pub const STD_ERROR_HANDLE: ::DWORD = 0xFFFFFFF4; -pub const NOPARITY: ::DWORD = 0; -pub const ODDPARITY: ::DWORD = 1; -pub const EVENPARITY: ::DWORD = 2; -pub const MARKPARITY: ::DWORD = 3; -pub const SPACEPARITY: ::DWORD = 4; -pub const ONESTOPBIT: ::DWORD = 0; -pub const ONE5STOPBITS: ::DWORD = 1; -pub const TWOSTOPBITS: ::DWORD = 2; -pub const IGNORE: ::DWORD = 0; -pub const INFINITE: ::DWORD = 0xFFFFFFFF; -//1729 -pub const SEM_FAILCRITICALERRORS: ::UINT = 0x0001; -pub const SEM_NOGPFAULTERRORBOX: ::UINT = 0x0002; -pub const SEM_NOALIGNMENTFAULTEXCEPT: ::UINT = 0x0004; -pub const SEM_NOOPENFILEERRORBOX: ::UINT = 0x8000; -//2320 -pub const FORMAT_MESSAGE_IGNORE_INSERTS: ::DWORD = 0x00000200; -pub const FORMAT_MESSAGE_FROM_STRING: ::DWORD = 0x00000400; -pub const FORMAT_MESSAGE_FROM_HMODULE: ::DWORD = 0x00000800; -pub const FORMAT_MESSAGE_FROM_SYSTEM: ::DWORD = 0x00001000; -pub const FORMAT_MESSAGE_ARGUMENT_ARRAY: ::DWORD = 0x00002000; -pub const FORMAT_MESSAGE_MAX_WIDTH_MASK: ::DWORD = 0x000000FF; -pub const FORMAT_MESSAGE_ALLOCATE_BUFFER: ::DWORD = 0x00000100; -//2873 -pub const STARTF_USESHOWWINDOW: ::DWORD = 0x00000001; -pub const STARTF_USESIZE: ::DWORD = 0x00000002; -pub const STARTF_USEPOSITION: ::DWORD = 0x00000004; -pub const STARTF_USECOUNTCHARS: ::DWORD = 0x00000008; -pub const STARTF_USEFILLATTRIBUTE: ::DWORD = 0x00000010; -pub const STARTF_RUNFULLSCREEN: ::DWORD = 0x00000020; -pub const STARTF_FORCEONFEEDBACK: ::DWORD = 0x00000040; -pub const STARTF_FORCEOFFFEEDBACK: ::DWORD = 0x00000080; -pub const STARTF_USESTDHANDLES: ::DWORD = 0x00000100; -pub const STARTF_USEHOTKEY: ::DWORD = 0x00000200; -pub const STARTF_TITLEISLINKNAME: ::DWORD = 0x00000800; -pub const STARTF_TITLEISAPPID: ::DWORD = 0x00001000; -pub const STARTF_PREVENTPINNING: ::DWORD = 0x00002000; -pub const STARTF_UNTRUSTEDSOURCE: ::DWORD = 0x00008000; -//5002 -pub type LPPROGRESS_ROUTINE = Option ::DWORD>; -//5095 -ENUM!{enum COPYFILE2_MESSAGE_TYPE { - COPYFILE2_CALLBACK_NONE = 0, - COPYFILE2_CALLBACK_CHUNK_STARTED, - COPYFILE2_CALLBACK_CHUNK_FINISHED, - COPYFILE2_CALLBACK_STREAM_STARTED, - COPYFILE2_CALLBACK_STREAM_FINISHED, - COPYFILE2_CALLBACK_POLL_CONTINUE, - COPYFILE2_CALLBACK_ERROR, - COPYFILE2_CALLBACK_MAX, -}} -ENUM!{enum COPYFILE2_MESSAGE_ACTION { - COPYFILE2_PROGRESS_CONTINUE = 0, - COPYFILE2_PROGRESS_CANCEL, - COPYFILE2_PROGRESS_STOP, - COPYFILE2_PROGRESS_QUIET, - COPYFILE2_PROGRESS_PAUSE, -}} -ENUM!{enum COPYFILE2_COPY_PHASE { - COPYFILE2_PHASE_NONE = 0, - COPYFILE2_PHASE_PREPARE_SOURCE, - COPYFILE2_PHASE_PREPARE_DEST, - COPYFILE2_PHASE_READ_SOURCE, - COPYFILE2_PHASE_WRITE_DESTINATION, - COPYFILE2_PHASE_SERVER_COPY, - COPYFILE2_PHASE_NAMEGRAFT_COPY, - COPYFILE2_PHASE_MAX, -}} -//5129 -STRUCT!{struct COPYFILE2_MESSAGE_ChunkStarted { - dwStreamNumber: ::DWORD, - dwReserved: ::DWORD, - hSourceFile: ::HANDLE, - hDestinationFile: ::HANDLE, - uliChunkNumber: ::ULARGE_INTEGER, - uliChunkSize: ::ULARGE_INTEGER, - uliStreamSize: ::ULARGE_INTEGER, - uliTotalFileSize: ::ULARGE_INTEGER, -}} -STRUCT!{struct COPYFILE2_MESSAGE_ChunkFinished { - dwStreamNumber: ::DWORD, - dwFlags: ::DWORD, - hSourceFile: ::HANDLE, - hDestinationFile: ::HANDLE, - uliChunkNumber: ::ULARGE_INTEGER, - uliChunkSize: ::ULARGE_INTEGER, - uliStreamSize: ::ULARGE_INTEGER, - uliStreamBytesTransferred: ::ULARGE_INTEGER, - uliTotalFileSize: ::ULARGE_INTEGER, - uliTotalBytesTransferred: ::ULARGE_INTEGER, -}} -STRUCT!{struct COPYFILE2_MESSAGE_StreamStarted { - dwStreamNumber: ::DWORD, - dwReserved: ::DWORD, - hSourceFile: ::HANDLE, - hDestinationFile: ::HANDLE, - uliStreamSize: ::ULARGE_INTEGER, - uliTotalFileSize: ::ULARGE_INTEGER, -}} -STRUCT!{struct COPYFILE2_MESSAGE_StreamFinished { - dwStreamNumber: ::DWORD, - dwReserved: ::DWORD, - hSourceFile: ::HANDLE, - hDestinationFile: ::HANDLE, - uliStreamSize: ::ULARGE_INTEGER, - uliStreamBytesTransferred: ::ULARGE_INTEGER, - uliTotalFileSize: ::ULARGE_INTEGER, - uliTotalBytesTransferred: ::ULARGE_INTEGER, -}} -STRUCT!{struct COPYFILE2_MESSAGE_PollContinue { - dwReserved: ::DWORD, -}} -STRUCT!{struct COPYFILE2_MESSAGE_Error { - CopyPhase: COPYFILE2_COPY_PHASE, - dwStreamNumber: ::DWORD, - hrFailure: ::HRESULT, - dwReserved: ::DWORD, - uliChunkNumber: ::ULARGE_INTEGER, - uliStreamSize: ::ULARGE_INTEGER, - uliStreamBytesTransferred: ::ULARGE_INTEGER, - uliTotalFileSize: ::ULARGE_INTEGER, - uliTotalBytesTransferred: ::ULARGE_INTEGER, -}} -#[cfg(target_arch="x86")] -STRUCT!{struct COPYFILE2_MESSAGE { - Type: COPYFILE2_MESSAGE_TYPE, - dwPadding: ::DWORD, - Info: [u64; 8], -}} -#[cfg(target_arch="x86_64")] -STRUCT!{struct COPYFILE2_MESSAGE { - Type: COPYFILE2_MESSAGE_TYPE, - dwPadding: ::DWORD, - Info: [u64; 9], -}} -UNION!{COPYFILE2_MESSAGE, Info, ChunkStarted, ChunkStarted_mut, COPYFILE2_MESSAGE_ChunkStarted} -UNION!{COPYFILE2_MESSAGE, Info, ChunkFinished, ChunkFinished_mut, COPYFILE2_MESSAGE_ChunkFinished} -UNION!{COPYFILE2_MESSAGE, Info, StreamStarted, StreamStarted_mut, COPYFILE2_MESSAGE_StreamStarted} -UNION!{COPYFILE2_MESSAGE, Info, StreamFinished, StreamFinished_mut, - COPYFILE2_MESSAGE_StreamFinished} -UNION!{COPYFILE2_MESSAGE, Info, PollContinue, PollContinue_mut, COPYFILE2_MESSAGE_PollContinue} -UNION!{COPYFILE2_MESSAGE, Info, Error, Error_mut, COPYFILE2_MESSAGE_Error} -pub type PCOPYFILE2_PROGRESS_ROUTINE = Option COPYFILE2_MESSAGE_ACTION>; -STRUCT!{nodebug struct COPYFILE2_EXTENDED_PARAMETERS { - dwSize: ::DWORD, - dwCopyFlags: ::DWORD, - pfCancel: *mut ::BOOL, - pProgressRoutine: PCOPYFILE2_PROGRESS_ROUTINE, - pvCallbackContext: ::PVOID, -}} -//5377 -pub const MOVEFILE_REPLACE_EXISTING: ::DWORD = 0x00000001; -pub const MOVEFILE_COPY_ALLOWED: ::DWORD = 0x00000002; -pub const MOVEFILE_DELAY_UNTIL_REBOOT: ::DWORD = 0x00000004; -pub const MOVEFILE_WRITE_THROUGH: ::DWORD = 0x00000008; -pub const MOVEFILE_CREATE_HARDLINK: ::DWORD = 0x00000010; -pub const MOVEFILE_FAIL_IF_NOT_TRACKABLE: ::DWORD = 0x00000020; -//7176 -pub const HW_PROFILE_GUIDLEN: usize = 39; -//pub const MAX_PROFILE_LEN: usize = 80; -pub const DOCKINFO_UNDOCKED: ::DWORD = 0x1; -pub const DOCKINFO_DOCKED: ::DWORD = 0x2; -pub const DOCKINFO_USER_SUPPLIED: ::DWORD = 0x4; -pub const DOCKINFO_USER_UNDOCKED: ::DWORD = DOCKINFO_USER_SUPPLIED | DOCKINFO_UNDOCKED; -pub const DOCKINFO_USER_DOCKED: ::DWORD = DOCKINFO_USER_SUPPLIED | DOCKINFO_DOCKED; -STRUCT!{nodebug struct HW_PROFILE_INFOA { - dwDockInfo: ::DWORD, - szHwProfileGuid: [::CHAR; HW_PROFILE_GUIDLEN], - szHwProfileName: [::CHAR; ::MAX_PROFILE_LEN], -}} -pub type LPHW_PROFILE_INFOA = *mut HW_PROFILE_INFOA; -STRUCT!{nodebug struct HW_PROFILE_INFOW { - dwDockInfo: ::DWORD, - szHwProfileGuid: [::WCHAR; HW_PROFILE_GUIDLEN], - szHwProfileName: [::WCHAR; ::MAX_PROFILE_LEN], -}} -pub type LPHW_PROFILE_INFOW = *mut HW_PROFILE_INFOW; -//7574 -STRUCT!{struct ACTCTXA { - cbSize: ::ULONG, - dwFlags: ::DWORD, - lpSource: ::LPCSTR, - wProcessorArchitecture: ::USHORT, - wLangId: ::LANGID, - lpAssemblyDirectory: ::LPCSTR, - lpResourceName: ::LPCSTR, - lpApplicationName: ::LPCSTR, - hModule: ::HMODULE, -}} -pub type PACTCTXA = *mut ACTCTXA; -STRUCT!{struct ACTCTXW { - cbSize: ::ULONG, - dwFlags: ::DWORD, - lpSource: ::LPCWSTR, - wProcessorArchitecture: ::USHORT, - wLangId: ::LANGID, - lpAssemblyDirectory: ::LPCWSTR, - lpResourceName: ::LPCWSTR, - lpApplicationName: ::LPCWSTR, - hModule: ::HMODULE, -}} -pub type PACTCTXW = *mut ACTCTXW; -pub type PCACTCTXA = *const ACTCTXA; -pub type PCACTCTXW = *const ACTCTXW; -// -pub type PUMS_CONTEXT = *mut ::c_void; -pub type PUMS_COMPLETION_LIST = *mut ::c_void; -pub type UMS_THREAD_INFO_CLASS = ::RTL_UMS_THREAD_INFO_CLASS; -pub type PUMS_THREAD_INFO_CLASS = *mut UMS_THREAD_INFO_CLASS; -pub type PUMS_SCHEDULER_ENTRY_POINT = ::PRTL_UMS_SCHEDULER_ENTRY_POINT; -STRUCT!{nodebug struct UMS_SCHEDULER_STARTUP_INFO { - UmsVersion: ::ULONG, - CompletionList: PUMS_COMPLETION_LIST, - SchedulerProc: PUMS_SCHEDULER_ENTRY_POINT, - SchedulerParam: ::PVOID, -}} -pub type PUMS_SCHEDULER_STARTUP_INFO = *mut UMS_SCHEDULER_STARTUP_INFO; -STRUCT!{struct UMS_SYSTEM_THREAD_INFORMATION { - UmsVersion: ::ULONG, - BitFields: ::ULONG, -}} -BITFIELD!(UMS_SYSTEM_THREAD_INFORMATION BitFields: ::ULONG [ - IsUmsSchedulerThread set_IsUmsSchedulerThread[0..1], - IsUmsWorkerThread set_IsUmsWorkerThread[1..2], -]); -UNION!( - UMS_SYSTEM_THREAD_INFORMATION, BitFields, ThreadUmsFlags, ThreadUmsFlags_mut, - ::ULONG -); -pub type PUMS_SYSTEM_THREAD_INFORMATION = *mut UMS_SYSTEM_THREAD_INFORMATION; -STRUCT!{struct ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA { - lpInformation: ::PVOID, - lpSectionBase: ::PVOID, - ulSectionLength: ::ULONG, - lpSectionGlobalDataBase: ::PVOID, - ulSectionGlobalDataLength: ::ULONG, -}} -pub type PACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA = - *mut ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA; -pub type PCACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA = - *const ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA; -STRUCT!{struct ACTCTX_SECTION_KEYED_DATA { - cbSize: ::ULONG, - ulDataFormatVersion: ::ULONG, - lpData: ::PVOID, - ulLength: ::ULONG, - lpSectionGlobalData: ::PVOID, - ulSectionGlobalDataLength: ::ULONG, - lpSectionBase: ::PVOID, - ulSectionTotalLength: ::ULONG, - hActCtx: ::HANDLE, - ulAssemblyRosterIndex: ::ULONG, - ulFlags: ::ULONG, - AssemblyMetadata: ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA, -}} -pub type PACTCTX_SECTION_KEYED_DATA = *mut ACTCTX_SECTION_KEYED_DATA; -pub type PCACTCTX_SECTION_KEYED_DATA = *const ACTCTX_SECTION_KEYED_DATA; -ENUM!{enum STREAM_INFO_LEVELS { - FindStreamInfoStandard, - FindStreamInfoMaxInfoLevel, -}} -ENUM!{enum PROCESS_INFORMATION_CLASS { - ProcessMemoryPriority, - ProcessInformationClassMax, -}} -ENUM!{enum DEP_SYSTEM_POLICY_TYPE { - DEPPolicyAlwaysOff = 0, - DEPPolicyAlwaysOn, - DEPPolicyOptIn, - DEPPolicyOptOut, - DEPTotalPolicyCount, -}} -ENUM!{enum PIPE_ATTRIBUTE_TYPE { - PipeAttribute, - PipeConnectionAttribute, - PipeHandleAttribute, -}} -pub type APPLICATION_RECOVERY_CALLBACK = Option ::DWORD>; -STRUCT!{struct SYSTEM_POWER_STATUS { - ACLineStatus: ::BYTE, - BatteryFlag: ::BYTE, - BatteryLifePercent: ::BYTE, - Reserved1: ::BYTE, - BatteryLifeTime: ::DWORD, - BatteryFullLifeTime: ::DWORD, -}} -pub type LPSYSTEM_POWER_STATUS = *mut SYSTEM_POWER_STATUS; -pub const OFS_MAXPATHNAME: usize = 128; -STRUCT!{nodebug struct OFSTRUCT { - cBytes: ::BYTE, - fFixedDisk: ::BYTE, - nErrCode: ::WORD, - Reserved1: ::WORD, - Reserved2: ::WORD, - szPathName: [::CHAR; OFS_MAXPATHNAME], -}} -pub type POFSTRUCT = *mut OFSTRUCT; -pub type LPOFSTRUCT = *mut OFSTRUCT; -ENUM!{enum FILE_ID_TYPE { - FileIdType, - ObjectIdType, - ExtendedFileIdType, - MaximumFileIdType, -}} -STRUCT!{struct FILE_ID_DESCRIPTOR { - dwSize: ::DWORD, - Type: FILE_ID_TYPE, - ObjectId: ::GUID, -}} -UNION!(FILE_ID_DESCRIPTOR, ObjectId, FileId, FileId_mut, ::LARGE_INTEGER); -UNION!(FILE_ID_DESCRIPTOR, ObjectId, ExtendedFileId, ExtendedFileId_mut, ::FILE_ID_128); -pub type LPFILE_ID_DESCRIPTOR = *mut FILE_ID_DESCRIPTOR; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/wincon.rs cargo-0.37.0/vendor/winapi-0.2.8/src/wincon.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/wincon.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/wincon.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,198 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! This module contains the public data structures, data types, and procedures exported by the NT -//! console subsystem. -STRUCT!{struct COORD { - X: ::SHORT, - Y: ::SHORT, -}} -pub type PCOORD = *mut COORD; -STRUCT!{struct SMALL_RECT { - Left: ::SHORT, - Top: ::SHORT, - Right: ::SHORT, - Bottom: ::SHORT, -}} -pub type PSMALL_RECT = *mut SMALL_RECT; -STRUCT!{struct KEY_EVENT_RECORD { - bKeyDown: ::BOOL, - wRepeatCount: ::WORD, - wVirtualKeyCode: ::WORD, - wVirtualScanCode: ::WORD, - UnicodeChar: ::WCHAR, - dwControlKeyState: ::DWORD, -}} -UNION!{KEY_EVENT_RECORD, UnicodeChar, AsciiChar, AsciiChar_mut, ::CHAR} -pub type PKEY_EVENT_RECORD = *mut KEY_EVENT_RECORD; -pub const RIGHT_ALT_PRESSED: ::DWORD = 0x0001; -pub const LEFT_ALT_PRESSED: ::DWORD = 0x0002; -pub const RIGHT_CTRL_PRESSED: ::DWORD = 0x0004; -pub const LEFT_CTRL_PRESSED: ::DWORD = 0x0008; -pub const SHIFT_PRESSED: ::DWORD = 0x0010; -pub const NUMLOCK_ON: ::DWORD = 0x0020; -pub const SCROLLLOCK_ON: ::DWORD = 0x0040; -pub const CAPSLOCK_ON: ::DWORD = 0x0080; -pub const ENHANCED_KEY: ::DWORD = 0x0100; -pub const NLS_DBCSCHAR: ::DWORD = 0x00010000; -pub const NLS_ALPHANUMERIC: ::DWORD = 0x00000000; -pub const NLS_KATAKANA: ::DWORD = 0x00020000; -pub const NLS_HIRAGANA: ::DWORD = 0x00040000; -pub const NLS_ROMAN: ::DWORD = 0x00400000; -pub const NLS_IME_CONVERSION: ::DWORD = 0x00800000; -pub const NLS_IME_DISABLE: ::DWORD = 0x20000000; -STRUCT!{struct MOUSE_EVENT_RECORD { - dwMousePosition: COORD, - dwButtonState: ::DWORD, - dwControlKeyState: ::DWORD, - dwEventFlags: ::DWORD, -}} -pub type PMOUSE_EVENT_RECORD = *mut MOUSE_EVENT_RECORD; -pub const FROM_LEFT_1ST_BUTTON_PRESSED: ::DWORD = 0x0001; -pub const RIGHTMOST_BUTTON_PRESSED: ::DWORD = 0x0002; -pub const FROM_LEFT_2ND_BUTTON_PRESSED: ::DWORD = 0x0004; -pub const FROM_LEFT_3RD_BUTTON_PRESSED: ::DWORD = 0x0008; -pub const FROM_LEFT_4TH_BUTTON_PRESSED: ::DWORD = 0x0010; -pub const MOUSE_MOVED: ::DWORD = 0x0001; -pub const DOUBLE_CLICK: ::DWORD = 0x0002; -pub const MOUSE_WHEELED: ::DWORD = 0x0004; -pub const MOUSE_HWHEELED: ::DWORD = 0x0008; -STRUCT!{struct WINDOW_BUFFER_SIZE_RECORD { - dwSize: COORD, -}} -pub type PWINDOW_BUFFER_SIZE_RECORD = *mut WINDOW_BUFFER_SIZE_RECORD; -STRUCT!{struct MENU_EVENT_RECORD { - dwCommandId: ::UINT, -}} -pub type PMENU_EVENT_RECORD = *mut MENU_EVENT_RECORD; -STRUCT!{struct FOCUS_EVENT_RECORD { - bSetFocus: ::BOOL, -}} -pub type PFOCUS_EVENT_RECORD = *mut FOCUS_EVENT_RECORD; -STRUCT!{struct INPUT_RECORD { - EventType: ::WORD, - Event: [u32; 4], -}} -UNION!{INPUT_RECORD, Event, KeyEvent, KeyEvent_mut, KEY_EVENT_RECORD} -UNION!{INPUT_RECORD, Event, MouseEvent, MouseEvent_mut, MOUSE_EVENT_RECORD} -UNION!{INPUT_RECORD, Event, WindowBufferSizeEvent, WindowBufferSizeEvent_mut, - WINDOW_BUFFER_SIZE_RECORD} -UNION!{INPUT_RECORD, Event, MenuEvent, MenuEvent_mut, MENU_EVENT_RECORD} -UNION!{INPUT_RECORD, Event, FocusEvent, FocusEvent_mut, FOCUS_EVENT_RECORD} -pub type PINPUT_RECORD = *mut INPUT_RECORD; -pub const KEY_EVENT: ::WORD = 0x0001; -pub const MOUSE_EVENT: ::WORD = 0x0002; -pub const WINDOW_BUFFER_SIZE_EVENT: ::WORD = 0x0004; -pub const MENU_EVENT: ::WORD = 0x0008; -pub const FOCUS_EVENT: ::WORD = 0x0010; -STRUCT!{struct CHAR_INFO { - UnicodeChar: ::WCHAR, - Attributes: ::WORD, -}} -UNION!{CHAR_INFO, UnicodeChar, AsciiChar, AsciiChar_mut, ::CHAR} -pub type PCHAR_INFO = *mut CHAR_INFO; -pub const FOREGROUND_BLUE: ::DWORD = 0x0001; -pub const FOREGROUND_GREEN: ::DWORD = 0x0002; -pub const FOREGROUND_RED: ::DWORD = 0x0004; -pub const FOREGROUND_INTENSITY: ::DWORD = 0x0008; -pub const BACKGROUND_BLUE: ::DWORD = 0x0010; -pub const BACKGROUND_GREEN: ::DWORD = 0x0020; -pub const BACKGROUND_RED: ::DWORD = 0x0040; -pub const BACKGROUND_INTENSITY: ::DWORD = 0x0080; -pub const COMMON_LVB_LEADING_BYTE: ::DWORD = 0x0100; -pub const COMMON_LVB_TRAILING_BYTE: ::DWORD = 0x0200; -pub const COMMON_LVB_GRID_HORIZONTAL: ::DWORD = 0x0400; -pub const COMMON_LVB_GRID_LVERTICAL: ::DWORD = 0x0800; -pub const COMMON_LVB_GRID_RVERTICAL: ::DWORD = 0x1000; -pub const COMMON_LVB_REVERSE_VIDEO: ::DWORD = 0x4000; -pub const COMMON_LVB_UNDERSCORE: ::DWORD = 0x8000; -pub const COMMON_LVB_SBCSDBCS: ::DWORD = 0x0300; -STRUCT!{struct CONSOLE_SCREEN_BUFFER_INFO { - dwSize: COORD, - dwCursorPosition: COORD, - wAttributes: ::WORD, - srWindow: SMALL_RECT, - dwMaximumWindowSize: COORD, -}} -pub type PCONSOLE_SCREEN_BUFFER_INFO = *mut CONSOLE_SCREEN_BUFFER_INFO; -STRUCT!{struct CONSOLE_SCREEN_BUFFER_INFOEX { - cbSize: ::ULONG, - dwSize: COORD, - dwCursorPosition: COORD, - wAttributes: ::WORD, - srWindow: SMALL_RECT, - dwMaximumWindowSize: COORD, - wPopupAttributes: ::WORD, - bFullscreenSupported: ::BOOL, - ColorTable: [::COLORREF; 16], -}} -pub type PCONSOLE_SCREEN_BUFFER_INFOEX = *mut CONSOLE_SCREEN_BUFFER_INFOEX; -STRUCT!{struct CONSOLE_CURSOR_INFO { - dwSize: ::DWORD, - bVisible: ::BOOL, -}} -pub type PCONSOLE_CURSOR_INFO = *mut CONSOLE_CURSOR_INFO; -STRUCT!{struct CONSOLE_FONT_INFO { - nFont: ::DWORD, - dwFontSize: ::COORD, -}} -pub type PCONSOLE_FONT_INFO = *mut CONSOLE_FONT_INFO; -STRUCT!{struct CONSOLE_FONT_INFOEX { - cbSize: ::ULONG, - nFont: ::DWORD, - dwFontSize: COORD, - FontFamily: ::UINT, - FontWeight: ::UINT, - FaceName: [::WCHAR; ::LF_FACESIZE], -}} -pub type PCONSOLE_FONT_INFOEX = *mut CONSOLE_FONT_INFOEX; -pub const HISTORY_NO_DUP_FLAG: ::DWORD = 0x1; -STRUCT!{struct CONSOLE_HISTORY_INFO { - cbSize: ::UINT, - HistoryBufferSize: ::UINT, - NumberOfHistoryBuffers: ::UINT, - dwFlags: ::DWORD, -}} -pub type PCONSOLE_HISTORY_INFO = *mut CONSOLE_HISTORY_INFO; -STRUCT!{struct CONSOLE_SELECTION_INFO { - dwFlags: ::DWORD, - dwSelectionAnchor: COORD, - srSelection: SMALL_RECT, -}} -pub type PCONSOLE_SELECTION_INFO = *mut CONSOLE_SELECTION_INFO; -pub const CONSOLE_NO_SELECTION: ::DWORD = 0x0000; -pub const CONSOLE_SELECTION_IN_PROGRESS: ::DWORD = 0x0001; -pub const CONSOLE_SELECTION_NOT_EMPTY: ::DWORD = 0x0002; -pub const CONSOLE_MOUSE_SELECTION: ::DWORD = 0x0004; -pub const CONSOLE_MOUSE_DOWN: ::DWORD = 0x0008; -pub type PHANDLER_ROUTINE = Option ::BOOL>; -pub const CTRL_C_EVENT: ::DWORD = 0; -pub const CTRL_BREAK_EVENT: ::DWORD = 1; -pub const CTRL_CLOSE_EVENT: ::DWORD = 2; -pub const CTRL_LOGOFF_EVENT: ::DWORD = 5; -pub const CTRL_SHUTDOWN_EVENT: ::DWORD = 6; -pub const ENABLE_PROCESSED_INPUT: ::DWORD = 0x0001; -pub const ENABLE_LINE_INPUT: ::DWORD = 0x0002; -pub const ENABLE_ECHO_INPUT: ::DWORD = 0x0004; -pub const ENABLE_WINDOW_INPUT: ::DWORD = 0x0008; -pub const ENABLE_MOUSE_INPUT: ::DWORD = 0x0010; -pub const ENABLE_INSERT_MODE: ::DWORD = 0x0020; -pub const ENABLE_QUICK_EDIT_MODE: ::DWORD = 0x0040; -pub const ENABLE_EXTENDED_FLAGS: ::DWORD = 0x0080; -pub const ENABLE_AUTO_POSITION: ::DWORD = 0x0100; -pub const ENABLE_PROCESSED_OUTPUT: ::DWORD = 0x0001; -pub const ENABLE_WRAP_AT_EOL_OUTPUT: ::DWORD = 0x0002; -pub const CONSOLE_REAL_OUTPUT_HANDLE: *mut ::c_void = -2isize as *mut ::c_void; -pub const CONSOLE_REAL_INPUT_HANDLE: *mut ::c_void = -3isize as *mut ::c_void; -pub const ATTACH_PARENT_PROCESS: ::DWORD = 0xFFFFFFFF; -STRUCT!{struct CONSOLE_READCONSOLE_CONTROL { - nLength: ::ULONG, - nInitialChars: ::ULONG, - dwCtrlWakeupMask: ::ULONG, - dwControlKeyState: ::ULONG, -}} -pub type PCONSOLE_READCONSOLE_CONTROL = *mut CONSOLE_READCONSOLE_CONTROL; -pub const CONSOLE_TEXTMODE_BUFFER: ::DWORD = 1; -pub const CONSOLE_FULLSCREEN: ::DWORD = 1; -pub const CONSOLE_FULLSCREEN_HARDWARE: ::DWORD = 2; -pub const CONSOLE_FULLSCREEN_MODE: ::DWORD = 1; -pub const CONSOLE_WINDOWED_MODE: ::DWORD = 2; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/wincred.rs cargo-0.37.0/vendor/winapi-0.2.8/src/wincred.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/wincred.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/wincred.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,209 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Authentication API Prototypes and Definitions -pub const NERR_BASE: ::DWORD = 2100; -pub const NERR_PasswordExpired: ::DWORD = NERR_BASE+142; -pub const CRED_MAX_STRING_LENGTH: ::DWORD = 256; -pub const CRED_MAX_USERNAME_LENGTH: ::DWORD = 256+1+256; -pub const CRED_MAX_GENERIC_TARGET_NAME_LENGTH: ::DWORD = 32767; -pub const CRED_MAX_DOMAIN_TARGET_NAME_LENGTH: ::DWORD = 256+1+80; -pub const CRED_MAX_TARGETNAME_NAMESPACE_LENGTH: ::DWORD = 256; -pub const CRED_MAX_TARGETNAME_ATTRIBUTE_LENGTH: ::DWORD = 256; -pub const CRED_MAX_VALUE_SIZE: ::DWORD = 256; -pub const CRED_MAX_ATTRIBUTES: ::DWORD = 64; -pub const CRED_LOGON_TYPES_MASK: ::DWORD = 0xF000; -pub const CRED_FLAGS_PASSWORD_FOR_CERT: ::DWORD = 0x0001; -pub const CRED_FLAGS_PROMPT_NOW: ::DWORD = 0x0002; -pub const CRED_FLAGS_USERNAME_TARGET: ::DWORD = 0x0004; -pub const CRED_FLAGS_OWF_CRED_BLOB: ::DWORD = 0x0008; -pub const CRED_FLAGS_REQUIRE_CONFIRMATION: ::DWORD = 0x0010; -pub const CRED_FLAGS_WILDCARD_MATCH: ::DWORD = 0x0020; -pub const CRED_FLAGS_VALID_FLAGS: ::DWORD = 0xF03F; -pub const CRED_FLAGS_VALID_INPUT_FLAGS: ::DWORD = 0xF01F; -pub const CRED_TYPE_GENERIC: ::DWORD = 1; -pub const CRED_TYPE_DOMAIN_PASSWORD: ::DWORD = 2; -pub const CRED_TYPE_DOMAIN_CERTIFICATE: ::DWORD = 3; -pub const CRED_TYPE_DOMAIN_VISIBLE_PASSWORD: ::DWORD = 4; -pub const CRED_TYPE_GENERIC_CERTIFICATE: ::DWORD = 5; -pub const CRED_TYPE_DOMAIN_EXTENDED: ::DWORD = 6; -pub const CRED_TYPE_MAXIMUM: ::DWORD = 7; -pub const CRED_TYPE_MAXIMUM_EX: ::DWORD = CRED_TYPE_MAXIMUM+1000; -pub const CRED_MAX_CREDENTIAL_BLOB_SIZE: ::DWORD = 5*512; -pub const CRED_PERSIST_NONE: ::DWORD = 0; -pub const CRED_PERSIST_SESSION: ::DWORD = 1; -pub const CRED_PERSIST_LOCAL_MACHINE: ::DWORD = 2; -pub const CRED_PERSIST_ENTERPRISE: ::DWORD = 3; -STRUCT!{struct CREDENTIAL_ATTRIBUTEA { - Keyword: ::LPSTR, - Flags: ::DWORD, - ValueSize: ::DWORD, - Value: ::LPBYTE, -}} -pub type PCREDENTIAL_ATTRIBUTEA = *mut CREDENTIAL_ATTRIBUTEA; -STRUCT!{struct CREDENTIAL_ATTRIBUTEW { - Keyword: ::LPWSTR, - Flags: ::DWORD, - ValueSize: ::DWORD, - Value: ::LPBYTE, -}} -pub type PCREDENTIAL_ATTRIBUTEW = *mut CREDENTIAL_ATTRIBUTEW; -STRUCT!{struct CREDENTIALA { - Flags: ::DWORD, - Type: ::DWORD, - TargetName: ::LPSTR, - Comment: ::LPSTR, - LastWritten: ::FILETIME, - CredentialBlobSize: ::DWORD, - CredentialBlob: ::LPBYTE, - Persist: ::DWORD, - AttributeCount: ::DWORD, - Attributes: PCREDENTIAL_ATTRIBUTEA, - TargetAlias: ::LPSTR, - UserName: ::LPSTR, -}} -pub type PCREDENTIALA = *mut CREDENTIALA; -STRUCT!{struct CREDENTIALW { - Flags: ::DWORD, - Type: ::DWORD, - TargetName: ::LPWSTR, - Comment: ::LPWSTR, - LastWritten: ::FILETIME, - CredentialBlobSize: ::DWORD, - CredentialBlob: ::LPBYTE, - Persist: ::DWORD, - AttributeCount: ::DWORD, - Attributes: PCREDENTIAL_ATTRIBUTEW, - TargetAlias: ::LPWSTR, - UserName: ::LPWSTR, -}} -pub type PCREDENTIALW = *mut CREDENTIALW; -pub const CRED_TI_SERVER_FORMAT_UNKNOWN: ::ULONG = 0x0001; -pub const CRED_TI_DOMAIN_FORMAT_UNKNOWN: ::ULONG = 0x0002; -pub const CRED_TI_ONLY_PASSWORD_REQUIRED: ::ULONG = 0x0004; -pub const CRED_TI_USERNAME_TARGET: ::ULONG = 0x0008; -pub const CRED_TI_CREATE_EXPLICIT_CRED: ::ULONG = 0x0010; -pub const CRED_TI_WORKGROUP_MEMBER: ::ULONG = 0x0020; -pub const CRED_TI_VALID_FLAGS: ::ULONG = 0xF07F; -STRUCT!{struct CREDENTIAL_TARGET_INFORMATIONA { - TargetName: ::LPSTR, - NetbiosServerName: ::LPSTR, - DnsServerName: ::LPSTR, - NetbiosDomainName: ::LPSTR, - DnsDomainName: ::LPSTR, - DnsTreeName: ::LPSTR, - PackageName: ::LPSTR, - Flags: ::ULONG, - CredTypeCount: ::DWORD, - CredTypes: ::LPDWORD, -}} -pub type PCREDENTIAL_TARGET_INFORMATIONA = *mut CREDENTIAL_TARGET_INFORMATIONA; -STRUCT!{struct CREDENTIAL_TARGET_INFORMATIONW { - TargetName: ::LPWSTR, - NetbiosServerName: ::LPWSTR, - DnsServerName: ::LPWSTR, - NetbiosDomainName: ::LPWSTR, - DnsDomainName: ::LPWSTR, - DnsTreeName: ::LPWSTR, - PackageName: ::LPWSTR, - Flags: ::ULONG, - CredTypeCount: ::DWORD, - CredTypes: ::LPDWORD, -}} -pub type PCREDENTIAL_TARGET_INFORMATIONW = *mut CREDENTIAL_TARGET_INFORMATIONW; -pub const CERT_HASH_LENGTH: usize = 20; -STRUCT!{struct CERT_CREDENTIAL_INFO { - cbSize: ::ULONG, - rgbHashOfCert: [::UCHAR; CERT_HASH_LENGTH], -}} -pub type PCERT_CREDENTIAL_INFO = *mut CERT_CREDENTIAL_INFO; -STRUCT!{struct USERNAME_TARGET_CREDENTIAL_INFO { - UserName: ::LPWSTR, -}} -pub type PUSERNAME_TARGET_CREDENTIAL_INFO = *mut USERNAME_TARGET_CREDENTIAL_INFO; -STRUCT!{struct BINARY_BLOB_CREDENTIAL_INFO { - cbBlob: ::ULONG, - pbBlob: ::LPBYTE, -}} -pub type PBINARY_BLOB_CREDENTIAL_INFO = *mut BINARY_BLOB_CREDENTIAL_INFO; -ENUM!{enum CRED_MARSHAL_TYPE { - CertCredential = 1, - UsernameTargetCredential, - BinaryBlobCredential, - UsernameForPackedCredentials, -}} -pub type PCRED_MARSHAL_TYPE = *mut CRED_MARSHAL_TYPE; -ENUM!{enum CRED_PROTECTION_TYPE { - CredUnprotected, - CredUserProtection, - CredTrustedProtection, -}} -pub type PCRED_PROTECTION_TYPE = *mut CRED_PROTECTION_TYPE; -pub const CRED_PACK_PROTECTED_CREDENTIALS: ::DWORD = 0x1; -pub const CRED_PACK_WOW_BUFFER: ::DWORD = 0x2; -pub const CRED_PACK_GENERIC_CREDENTIALS: ::DWORD = 0x4; -pub const CRED_PACK_ID_PROVIDER_CREDENTIALS: ::DWORD = 0x8; -STRUCT!{struct CREDUI_INFOA { - cbSize: ::DWORD, - hwndParent: ::HWND, - pszMessageText: ::PCSTR, - pszCaptionText: ::PCSTR, - hbmBanner: ::HBITMAP, -}} -pub type PCREDUI_INFOA = *mut CREDUI_INFOA; -STRUCT!{struct CREDUI_INFOW { - cbSize: ::DWORD, - hwndParent: ::HWND, - pszMessageText: ::PCWSTR, - pszCaptionText: ::PCWSTR, - hbmBanner: ::HBITMAP, -}} -pub type PCREDUI_INFOW = *mut CREDUI_INFOW; -pub const CREDUI_MAX_MESSAGE_LENGTH: ::DWORD = 1024; -pub const CREDUI_MAX_CAPTION_LENGTH: ::DWORD = 128; -pub const CREDUI_MAX_GENERIC_TARGET_LENGTH: ::DWORD = CRED_MAX_GENERIC_TARGET_NAME_LENGTH; -pub const CREDUI_MAX_DOMAIN_TARGET_LENGTH: ::DWORD = CRED_MAX_DOMAIN_TARGET_NAME_LENGTH; -pub const CREDUI_MAX_USERNAME_LENGTH: ::DWORD = CRED_MAX_USERNAME_LENGTH; -pub const CREDUI_MAX_PASSWORD_LENGTH: ::DWORD = 512 / 2; -pub const CREDUI_FLAGS_INCORRECT_PASSWORD: ::DWORD = 0x00001; -pub const CREDUI_FLAGS_DO_NOT_PERSIST: ::DWORD = 0x00002; -pub const CREDUI_FLAGS_REQUEST_ADMINISTRATOR: ::DWORD = 0x00004; -pub const CREDUI_FLAGS_EXCLUDE_CERTIFICATES: ::DWORD = 0x00008; -pub const CREDUI_FLAGS_REQUIRE_CERTIFICATE: ::DWORD = 0x00010; -pub const CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX: ::DWORD = 0x00040; -pub const CREDUI_FLAGS_ALWAYS_SHOW_UI: ::DWORD = 0x00080; -pub const CREDUI_FLAGS_REQUIRE_SMARTCARD: ::DWORD = 0x00100; -pub const CREDUI_FLAGS_PASSWORD_ONLY_OK: ::DWORD = 0x00200; -pub const CREDUI_FLAGS_VALIDATE_USERNAME: ::DWORD = 0x00400; -pub const CREDUI_FLAGS_COMPLETE_USERNAME: ::DWORD = 0x00800; -pub const CREDUI_FLAGS_PERSIST: ::DWORD = 0x01000; -pub const CREDUI_FLAGS_SERVER_CREDENTIAL: ::DWORD = 0x04000; -pub const CREDUI_FLAGS_EXPECT_CONFIRMATION: ::DWORD = 0x20000; -pub const CREDUI_FLAGS_GENERIC_CREDENTIALS: ::DWORD = 0x40000; -pub const CREDUI_FLAGS_USERNAME_TARGET_CREDENTIALS: ::DWORD = 0x80000; -pub const CREDUI_FLAGS_KEEP_USERNAME: ::DWORD = 0x100000; -pub const CREDUI_FLAGS_PROMPT_VALID: ::DWORD = CREDUI_FLAGS_INCORRECT_PASSWORD - | CREDUI_FLAGS_DO_NOT_PERSIST | CREDUI_FLAGS_REQUEST_ADMINISTRATOR - | CREDUI_FLAGS_EXCLUDE_CERTIFICATES | CREDUI_FLAGS_REQUIRE_CERTIFICATE - | CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX | CREDUI_FLAGS_ALWAYS_SHOW_UI - | CREDUI_FLAGS_REQUIRE_SMARTCARD | CREDUI_FLAGS_PASSWORD_ONLY_OK - | CREDUI_FLAGS_VALIDATE_USERNAME | CREDUI_FLAGS_COMPLETE_USERNAME | CREDUI_FLAGS_PERSIST - | CREDUI_FLAGS_SERVER_CREDENTIAL | CREDUI_FLAGS_EXPECT_CONFIRMATION - | CREDUI_FLAGS_GENERIC_CREDENTIALS | CREDUI_FLAGS_USERNAME_TARGET_CREDENTIALS - | CREDUI_FLAGS_KEEP_USERNAME; -pub const CREDUIWIN_GENERIC: ::DWORD = 0x00000001; -pub const CREDUIWIN_CHECKBOX: ::DWORD = 0x00000002; -pub const CREDUIWIN_AUTHPACKAGE_ONLY: ::DWORD = 0x00000010; -pub const CREDUIWIN_IN_CRED_ONLY: ::DWORD = 0x00000020; -pub const CREDUIWIN_ENUMERATE_ADMINS: ::DWORD = 0x00000100; -pub const CREDUIWIN_ENUMERATE_CURRENT_USER: ::DWORD = 0x00000200; -pub const CREDUIWIN_SECURE_PROMPT: ::DWORD = 0x00001000; -pub const CREDUIWIN_PREPROMPTING: ::DWORD = 0x00002000; -pub const CREDUIWIN_PACK_32_WOW: ::DWORD = 0x10000000; -pub const CREDUIWIN_VALID_FLAGS: ::DWORD = CREDUIWIN_GENERIC | CREDUIWIN_CHECKBOX - | CREDUIWIN_AUTHPACKAGE_ONLY | CREDUIWIN_IN_CRED_ONLY | CREDUIWIN_ENUMERATE_ADMINS - | CREDUIWIN_ENUMERATE_CURRENT_USER | CREDUIWIN_SECURE_PROMPT | CREDUIWIN_PREPROMPTING - | CREDUIWIN_PACK_32_WOW; -pub const CRED_PRESERVE_CREDENTIAL_BLOB: ::DWORD = 0x1; -pub const CRED_ENUMERATE_ALL_CREDENTIALS: ::DWORD = 0x1; -pub const CRED_CACHE_TARGET_INFORMATION: ::DWORD = 0x1; -pub const CRED_ALLOW_NAME_RESOLUTION: ::DWORD = 0x1; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/wincrypt.rs cargo-0.37.0/vendor/winapi-0.2.8/src/wincrypt.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/wincrypt.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/wincrypt.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,2206 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Cryptographic API Prototypes and Definitions -//108 -pub const ALG_CLASS_ANY: ALG_ID = 0; -pub const ALG_CLASS_SIGNATURE: ALG_ID = 1 << 13; -pub const ALG_CLASS_MSG_ENCRYPT: ALG_ID = 2 << 13; -pub const ALG_CLASS_DATA_ENCRYPT: ALG_ID = 3 << 13; -pub const ALG_CLASS_HASH: ALG_ID = 4 << 13; -pub const ALG_CLASS_KEY_EXCHANGE: ALG_ID = 5 << 13; -pub const ALG_CLASS_ALL: ALG_ID = 7 << 13; -pub const ALG_TYPE_ANY: ALG_ID = 0; -pub const ALG_TYPE_DSS: ALG_ID = 1 << 9; -pub const ALG_TYPE_RSA: ALG_ID = 2 << 9; -pub const ALG_TYPE_BLOCK: ALG_ID = 3 << 9; -pub const ALG_TYPE_STREAM: ALG_ID = 4 << 9; -pub const ALG_TYPE_DH: ALG_ID = 5 << 9; -pub const ALG_TYPE_SECURECHANNEL: ALG_ID = 6 << 9; -pub const ALG_SID_ANY: ALG_ID = 0; -pub const ALG_SID_RSA_ANY: ALG_ID = 0; -pub const ALG_SID_RSA_PKCS: ALG_ID = 1; -pub const ALG_SID_RSA_MSATWORK: ALG_ID = 2; -pub const ALG_SID_RSA_ENTRUST: ALG_ID = 3; -pub const ALG_SID_RSA_PGP: ALG_ID = 4; -pub const ALG_SID_DSS_ANY: ALG_ID = 0; -pub const ALG_SID_DSS_PKCS: ALG_ID = 1; -pub const ALG_SID_DSS_DMS: ALG_ID = 2; -pub const ALG_SID_ECDSA: ALG_ID = 3; -pub const ALG_SID_DES: ALG_ID = 1; -pub const ALG_SID_3DES: ALG_ID = 3; -pub const ALG_SID_DESX: ALG_ID = 4; -pub const ALG_SID_IDEA: ALG_ID = 5; -pub const ALG_SID_CAST: ALG_ID = 6; -pub const ALG_SID_SAFERSK64: ALG_ID = 7; -pub const ALG_SID_SAFERSK128: ALG_ID = 8; -pub const ALG_SID_3DES_112: ALG_ID = 9; -pub const ALG_SID_CYLINK_MEK: ALG_ID = 12; -pub const ALG_SID_RC5: ALG_ID = 13; -pub const ALG_SID_AES_128: ALG_ID = 14; -pub const ALG_SID_AES_192: ALG_ID = 15; -pub const ALG_SID_AES_256: ALG_ID = 16; -pub const ALG_SID_AES: ALG_ID = 17; -pub const ALG_SID_SKIPJACK: ALG_ID = 10; -pub const ALG_SID_TEK: ALG_ID = 11; -pub const CRYPT_MODE_CBCI: ALG_ID = 6; -pub const CRYPT_MODE_CFBP: ALG_ID = 7; -pub const CRYPT_MODE_OFBP: ALG_ID = 8; -pub const CRYPT_MODE_CBCOFM: ALG_ID = 9; -pub const CRYPT_MODE_CBCOFMI: ALG_ID = 10; -pub const ALG_SID_RC2: ALG_ID = 2; -pub const ALG_SID_RC4: ALG_ID = 1; -pub const ALG_SID_SEAL: ALG_ID = 2; -pub const ALG_SID_DH_SANDF: ALG_ID = 1; -pub const ALG_SID_DH_EPHEM: ALG_ID = 2; -pub const ALG_SID_AGREED_KEY_ANY: ALG_ID = 3; -pub const ALG_SID_KEA: ALG_ID = 4; -pub const ALG_SID_ECDH: ALG_ID = 5; -pub const ALG_SID_MD2: ALG_ID = 1; -pub const ALG_SID_MD4: ALG_ID = 2; -pub const ALG_SID_MD5: ALG_ID = 3; -pub const ALG_SID_SHA: ALG_ID = 4; -pub const ALG_SID_SHA1: ALG_ID = 4; -pub const ALG_SID_MAC: ALG_ID = 5; -pub const ALG_SID_RIPEMD: ALG_ID = 6; -pub const ALG_SID_RIPEMD160: ALG_ID = 7; -pub const ALG_SID_SSL3SHAMD5: ALG_ID = 8; -pub const ALG_SID_HMAC: ALG_ID = 9; -pub const ALG_SID_TLS1PRF: ALG_ID = 10; -pub const ALG_SID_HASH_REPLACE_OWF: ALG_ID = 11; -pub const ALG_SID_SHA_256: ALG_ID = 12; -pub const ALG_SID_SHA_384: ALG_ID = 13; -pub const ALG_SID_SHA_512: ALG_ID = 14; -pub const ALG_SID_SSL3_MASTER: ALG_ID = 1; -pub const ALG_SID_SCHANNEL_MASTER_HASH: ALG_ID = 2; -pub const ALG_SID_SCHANNEL_MAC_KEY: ALG_ID = 3; -pub const ALG_SID_PCT1_MASTER: ALG_ID = 4; -pub const ALG_SID_SSL2_MASTER: ALG_ID = 5; -pub const ALG_SID_TLS1_MASTER: ALG_ID = 6; -pub const ALG_SID_SCHANNEL_ENC_KEY: ALG_ID = 7; -pub const ALG_SID_ECMQV: ALG_ID = 1; -pub const ALG_SID_EXAMPLE: ALG_ID = 80; -pub type ALG_ID = ::c_uint; -pub const CALG_MD2: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD2; -pub const CALG_MD4: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD4; -pub const CALG_MD5: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD5; -pub const CALG_SHA: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA; -pub const CALG_SHA1: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA1; -pub const CALG_MAC: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MAC; -pub const CALG_RSA_SIGN: ALG_ID = ALG_CLASS_SIGNATURE | ALG_TYPE_RSA | ALG_SID_RSA_ANY; -pub const CALG_DSS_SIGN: ALG_ID = ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_DSS_ANY; -pub const CALG_NO_SIGN: ALG_ID = ALG_CLASS_SIGNATURE | ALG_TYPE_ANY | ALG_SID_ANY; -pub const CALG_RSA_KEYX: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_RSA | ALG_SID_RSA_ANY; -pub const CALG_DES: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DES; -pub const CALG_3DES_112: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_3DES_112; -pub const CALG_3DES: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_3DES; -pub const CALG_DESX: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DESX; -pub const CALG_RC2: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC2; -pub const CALG_RC4: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_RC4; -pub const CALG_SEAL: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_SEAL; -pub const CALG_DH_SF: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_SANDF; -pub const CALG_DH_EPHEM: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_EPHEM; -pub const CALG_AGREEDKEY_ANY: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH - | ALG_SID_AGREED_KEY_ANY; -pub const CALG_KEA_KEYX: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_KEA; -pub const CALG_HUGHES_MD5: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_ANY | ALG_SID_MD5; -pub const CALG_SKIPJACK: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_SKIPJACK; -pub const CALG_TEK: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_TEK; -pub const CALG_CYLINK_MEK: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_CYLINK_MEK; -pub const CALG_SSL3_SHAMD5: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SSL3SHAMD5; -pub const CALG_SSL3_MASTER: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL - | ALG_SID_SSL3_MASTER; -pub const CALG_SCHANNEL_MASTER_HASH: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL - | ALG_SID_SCHANNEL_MASTER_HASH; -pub const CALG_SCHANNEL_MAC_KEY: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL - | ALG_SID_SCHANNEL_MAC_KEY; -pub const CALG_SCHANNEL_ENC_KEY: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL - | ALG_SID_SCHANNEL_ENC_KEY; -pub const CALG_PCT1_MASTER: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL - | ALG_SID_PCT1_MASTER; -pub const CALG_SSL2_MASTER: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL - | ALG_SID_SSL2_MASTER; -pub const CALG_TLS1_MASTER: ALG_ID = ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL - | ALG_SID_TLS1_MASTER; -pub const CALG_RC5: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC5; -pub const CALG_HMAC: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HMAC; -pub const CALG_TLS1PRF: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_TLS1PRF; -pub const CALG_HASH_REPLACE_OWF: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HASH_REPLACE_OWF; -pub const CALG_AES_128: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES_128; -pub const CALG_AES_192: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES_192; -pub const CALG_AES_256: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES_256; -pub const CALG_AES: ALG_ID = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES; -pub const CALG_SHA_256: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_256; -pub const CALG_SHA_384: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_384; -pub const CALG_SHA_512: ALG_ID = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_512; -pub const CALG_ECDH: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_ECDH; -pub const CALG_ECMQV: ALG_ID = ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_ANY | ALG_SID_ECMQV; -pub const CALG_ECDSA: ALG_ID = ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_ECDSA; -pub type HCRYPTPROV = ::ULONG_PTR; -pub type HCRYPTKEY = ::ULONG_PTR; -pub type HCRYPTHASH = ::ULONG_PTR; -pub const CRYPT_VERIFYCONTEXT: ::DWORD = 0xF0000000; -pub const CRYPT_NEWKEYSET: ::DWORD = 0x00000008; -pub const CRYPT_DELETEKEYSET: ::DWORD = 0x00000010; -pub const CRYPT_MACHINE_KEYSET: ::DWORD = 0x00000020; -pub const CRYPT_SILENT: ::DWORD = 0x00000040; -pub const CRYPT_DEFAULT_CONTAINER_OPTIONAL: ::DWORD = 0x00000080; -pub const CRYPT_EXPORTABLE: ::DWORD = 0x00000001; -pub const CRYPT_USER_PROTECTED: ::DWORD = 0x00000002; -pub const CRYPT_CREATE_SALT: ::DWORD = 0x00000004; -pub const CRYPT_UPDATE_KEY: ::DWORD = 0x00000008; -pub const CRYPT_NO_SALT: ::DWORD = 0x00000010; -pub const CRYPT_PREGEN: ::DWORD = 0x00000040; -pub const CRYPT_RECIPIENT: ::DWORD = 0x00000010; -pub const CRYPT_INITIATOR: ::DWORD = 0x00000040; -pub const CRYPT_ONLINE: ::DWORD = 0x00000080; -pub const CRYPT_SF: ::DWORD = 0x00000100; -pub const CRYPT_CREATE_IV: ::DWORD = 0x00000200; -pub const CRYPT_KEK: ::DWORD = 0x00000400; -pub const CRYPT_DATA_KEY: ::DWORD = 0x00000800; -pub const CRYPT_VOLATILE: ::DWORD = 0x00001000; -pub const CRYPT_SGCKEY: ::DWORD = 0x00002000; -pub const CRYPT_USER_PROTECTED_STRONG: ::DWORD = 0x00100000; -pub const CRYPT_ARCHIVABLE: ::DWORD = 0x00004000; -pub const CRYPT_FORCE_KEY_PROTECTION_HIGH: ::DWORD = 0x00008000; -pub const RSA1024BIT_KEY: ::DWORD = 0x04000000; -pub const CRYPT_SERVER: ::DWORD = 0x00000400; -pub const KEY_LENGTH_MASK: ::DWORD = 0xFFFF0000; -pub const CRYPT_Y_ONLY: ::DWORD = 0x00000001; -pub const CRYPT_SSL2_FALLBACK: ::DWORD = 0x00000002; -pub const CRYPT_DESTROYKEY: ::DWORD = 0x00000004; -pub const CRYPT_OAEP: ::DWORD = 0x00000040; -pub const CRYPT_BLOB_VER3: ::DWORD = 0x00000080; -pub const CRYPT_IPSEC_HMAC_KEY: ::DWORD = 0x00000100; -pub const CRYPT_DECRYPT_RSA_NO_PADDING_CHECK: ::DWORD = 0x00000020; -pub const CRYPT_SECRETDIGEST: ::DWORD = 0x00000001; -pub const CRYPT_OWF_REPL_LM_HASH: ::DWORD = 0x00000001; -pub const CRYPT_LITTLE_ENDIAN: ::DWORD = 0x00000001; -pub const CRYPT_NOHASHOID: ::DWORD = 0x00000001; -pub const CRYPT_TYPE2_FORMAT: ::DWORD = 0x00000002; -pub const CRYPT_X931_FORMAT: ::DWORD = 0x00000004; -pub const CRYPT_MACHINE_DEFAULT: ::DWORD = 0x00000001; -pub const CRYPT_USER_DEFAULT: ::DWORD = 0x00000002; -pub const CRYPT_DELETE_DEFAULT: ::DWORD = 0x00000004; -pub const SIMPLEBLOB: ::DWORD = 0x1; -pub const PUBLICKEYBLOB: ::DWORD = 0x6; -pub const PRIVATEKEYBLOB: ::DWORD = 0x7; -pub const PLAINTEXTKEYBLOB: ::DWORD = 0x8; -pub const OPAQUEKEYBLOB: ::DWORD = 0x9; -pub const PUBLICKEYBLOBEX: ::DWORD = 0xA; -pub const SYMMETRICWRAPKEYBLOB: ::DWORD = 0xB; -pub const KEYSTATEBLOB: ::DWORD = 0xC; -pub const AT_KEYEXCHANGE: ::DWORD = 1; -pub const AT_SIGNATURE: ::DWORD = 2; -pub const CRYPT_USERDATA: ::DWORD = 1; -pub const KP_IV: ::DWORD = 1; -pub const KP_SALT: ::DWORD = 2; -pub const KP_PADDING: ::DWORD = 3; -pub const KP_MODE: ::DWORD = 4; -pub const KP_MODE_BITS: ::DWORD = 5; -pub const KP_PERMISSIONS: ::DWORD = 6; -pub const KP_ALGID: ::DWORD = 7; -pub const KP_BLOCKLEN: ::DWORD = 8; -pub const KP_KEYLEN: ::DWORD = 9; -pub const KP_SALT_EX: ::DWORD = 10; -pub const KP_P: ::DWORD = 11; -pub const KP_G: ::DWORD = 12; -pub const KP_Q: ::DWORD = 13; -pub const KP_X: ::DWORD = 14; -pub const KP_Y: ::DWORD = 15; -pub const KP_RA: ::DWORD = 16; -pub const KP_RB: ::DWORD = 17; -pub const KP_INFO: ::DWORD = 18; -pub const KP_EFFECTIVE_KEYLEN: ::DWORD = 19; -pub const KP_SCHANNEL_ALG: ::DWORD = 20; -pub const KP_CLIENT_RANDOM: ::DWORD = 21; -pub const KP_SERVER_RANDOM: ::DWORD = 22; -pub const KP_RP: ::DWORD = 23; -pub const KP_PRECOMP_MD5: ::DWORD = 24; -pub const KP_PRECOMP_SHA: ::DWORD = 25; -pub const KP_CERTIFICATE: ::DWORD = 26; -pub const KP_CLEAR_KEY: ::DWORD = 27; -pub const KP_PUB_EX_LEN: ::DWORD = 28; -pub const KP_PUB_EX_VAL: ::DWORD = 29; -pub const KP_KEYVAL: ::DWORD = 30; -pub const KP_ADMIN_PIN: ::DWORD = 31; -pub const KP_KEYEXCHANGE_PIN: ::DWORD = 32; -pub const KP_SIGNATURE_PIN: ::DWORD = 33; -pub const KP_PREHASH: ::DWORD = 34; -pub const KP_ROUNDS: ::DWORD = 35; -pub const KP_OAEP_PARAMS: ::DWORD = 36; -pub const KP_CMS_KEY_INFO: ::DWORD = 37; -pub const KP_CMS_DH_KEY_INFO: ::DWORD = 38; -pub const KP_PUB_PARAMS: ::DWORD = 39; -pub const KP_VERIFY_PARAMS: ::DWORD = 40; -pub const KP_HIGHEST_VERSION: ::DWORD = 41; -pub const KP_GET_USE_COUNT: ::DWORD = 42; -pub const KP_PIN_ID: ::DWORD = 43; -pub const KP_PIN_INFO: ::DWORD = 44; -pub const PKCS5_PADDING: ::DWORD = 1; -pub const RANDOM_PADDING: ::DWORD = 2; -pub const ZERO_PADDING: ::DWORD = 3; -pub const CRYPT_MODE_CBC: ::DWORD = 1; -pub const CRYPT_MODE_ECB: ::DWORD = 2; -pub const CRYPT_MODE_OFB: ::DWORD = 3; -pub const CRYPT_MODE_CFB: ::DWORD = 4; -pub const CRYPT_MODE_CTS: ::DWORD = 5; -pub const CRYPT_ENCRYPT: ::DWORD = 0x0001; -pub const CRYPT_DECRYPT: ::DWORD = 0x0002; -pub const CRYPT_EXPORT: ::DWORD = 0x0004; -pub const CRYPT_READ: ::DWORD = 0x0008; -pub const CRYPT_WRITE: ::DWORD = 0x0010; -pub const CRYPT_MAC: ::DWORD = 0x0020; -pub const CRYPT_EXPORT_KEY: ::DWORD = 0x0040; -pub const CRYPT_IMPORT_KEY: ::DWORD = 0x0080; -pub const CRYPT_ARCHIVE: ::DWORD = 0x0100; -pub const HP_ALGID: ::DWORD = 0x0001; -pub const HP_HASHVAL: ::DWORD = 0x0002; -pub const HP_HASHSIZE: ::DWORD = 0x0004; -pub const HP_HMAC_INFO: ::DWORD = 0x0005; -pub const HP_TLS1PRF_LABEL: ::DWORD = 0x0006; -pub const HP_TLS1PRF_SEED: ::DWORD = 0x0007; -pub const CRYPT_FAILED: ::BOOL = ::FALSE; -pub const CRYPT_SUCCEED: ::BOOL = ::TRUE; -pub const PP_ENUMALGS: ::DWORD = 1; -pub const PP_ENUMCONTAINERS: ::DWORD = 2; -pub const PP_IMPTYPE: ::DWORD = 3; -pub const PP_NAME: ::DWORD = 4; -pub const PP_VERSION: ::DWORD = 5; -pub const PP_CONTAINER: ::DWORD = 6; -pub const PP_CHANGE_PASSWORD: ::DWORD = 7; -pub const PP_KEYSET_SEC_DESCR: ::DWORD = 8; -pub const PP_CERTCHAIN: ::DWORD = 9; -pub const PP_KEY_TYPE_SUBTYPE: ::DWORD = 10; -pub const PP_PROVTYPE: ::DWORD = 16; -pub const PP_KEYSTORAGE: ::DWORD = 17; -pub const PP_APPLI_CERT: ::DWORD = 18; -pub const PP_SYM_KEYSIZE: ::DWORD = 19; -pub const PP_SESSION_KEYSIZE: ::DWORD = 20; -pub const PP_UI_PROMPT: ::DWORD = 21; -pub const PP_ENUMALGS_EX: ::DWORD = 22; -pub const PP_ENUMMANDROOTS: ::DWORD = 25; -pub const PP_ENUMELECTROOTS: ::DWORD = 26; -pub const PP_KEYSET_TYPE: ::DWORD = 27; -pub const PP_ADMIN_PIN: ::DWORD = 31; -pub const PP_KEYEXCHANGE_PIN: ::DWORD = 32; -pub const PP_SIGNATURE_PIN: ::DWORD = 33; -pub const PP_SIG_KEYSIZE_INC: ::DWORD = 34; -pub const PP_KEYX_KEYSIZE_INC: ::DWORD = 35; -pub const PP_UNIQUE_CONTAINER: ::DWORD = 36; -pub const PP_SGC_INFO: ::DWORD = 37; -pub const PP_USE_HARDWARE_RNG: ::DWORD = 38; -pub const PP_KEYSPEC: ::DWORD = 39; -pub const PP_ENUMEX_SIGNING_PROT: ::DWORD = 40; -pub const PP_CRYPT_COUNT_KEY_USE: ::DWORD = 41; -pub const PP_USER_CERTSTORE: ::DWORD = 42; -pub const PP_SMARTCARD_READER: ::DWORD = 43; -pub const PP_SMARTCARD_GUID: ::DWORD = 45; -pub const PP_ROOT_CERTSTORE: ::DWORD = 46; -pub const PP_SMARTCARD_READER_ICON: ::DWORD = 47; -pub const CRYPT_FIRST: ::DWORD = 1; -pub const CRYPT_NEXT: ::DWORD = 2; -pub const CRYPT_SGC_ENUM: ::DWORD = 4; -pub const CRYPT_IMPL_HARDWARE: ::DWORD = 1; -pub const CRYPT_IMPL_SOFTWARE: ::DWORD = 2; -pub const CRYPT_IMPL_MIXED: ::DWORD = 3; -pub const CRYPT_IMPL_UNKNOWN: ::DWORD = 4; -pub const CRYPT_IMPL_REMOVABLE: ::DWORD = 8; -pub const CRYPT_SEC_DESCR: ::DWORD = 0x00000001; -pub const CRYPT_PSTORE: ::DWORD = 0x00000002; -pub const CRYPT_UI_PROMPT: ::DWORD = 0x00000004; -pub const CRYPT_FLAG_PCT1: ::DWORD = 0x0001; -pub const CRYPT_FLAG_SSL2: ::DWORD = 0x0002; -pub const CRYPT_FLAG_SSL3: ::DWORD = 0x0004; -pub const CRYPT_FLAG_TLS1: ::DWORD = 0x0008; -pub const CRYPT_FLAG_IPSEC: ::DWORD = 0x0010; -pub const CRYPT_FLAG_SIGNING: ::DWORD = 0x0020; -pub const CRYPT_SGC: ::DWORD = 0x0001; -pub const CRYPT_FASTSGC: ::DWORD = 0x0002; -pub const PP_CLIENT_HWND: ::DWORD = 1; -pub const PP_CONTEXT_INFO: ::DWORD = 11; -pub const PP_KEYEXCHANGE_KEYSIZE: ::DWORD = 12; -pub const PP_SIGNATURE_KEYSIZE: ::DWORD = 13; -pub const PP_KEYEXCHANGE_ALG: ::DWORD = 14; -pub const PP_SIGNATURE_ALG: ::DWORD = 15; -pub const PP_DELETEKEY: ::DWORD = 24; -pub const PP_PIN_PROMPT_STRING: ::DWORD = 44; -pub const PP_SECURE_KEYEXCHANGE_PIN: ::DWORD = 47; -pub const PP_SECURE_SIGNATURE_PIN: ::DWORD = 48; -pub const PROV_RSA_FULL: ::DWORD = 1; -pub const PROV_RSA_SIG: ::DWORD = 2; -pub const PROV_DSS: ::DWORD = 3; -pub const PROV_FORTEZZA: ::DWORD = 4; -pub const PROV_MS_EXCHANGE: ::DWORD = 5; -pub const PROV_SSL: ::DWORD = 6; -pub const PROV_RSA_SCHANNEL: ::DWORD = 12; -pub const PROV_DSS_DH: ::DWORD = 13; -pub const PROV_EC_ECDSA_SIG: ::DWORD = 14; -pub const PROV_EC_ECNRA_SIG: ::DWORD = 15; -pub const PROV_EC_ECDSA_FULL: ::DWORD = 16; -pub const PROV_EC_ECNRA_FULL: ::DWORD = 17; -pub const PROV_DH_SCHANNEL: ::DWORD = 18; -pub const PROV_SPYRUS_LYNKS: ::DWORD = 20; -pub const PROV_RNG: ::DWORD = 21; -pub const PROV_INTEL_SEC: ::DWORD = 22; -pub const PROV_REPLACE_OWF: ::DWORD = 23; -pub const PROV_RSA_AES: ::DWORD = 24; -pub const MS_DEF_PROV: &'static str = "Microsoft Base Cryptographic Provider v1.0"; -pub const MS_ENHANCED_PROV: &'static str = "Microsoft Enhanced Cryptographic Provider v1.0"; -pub const MS_STRONG_PROV: &'static str = "Microsoft Strong Cryptographic Provider"; -pub const MS_DEF_RSA_SIG_PROV: &'static str = "Microsoft RSA Signature Cryptographic Provider"; -pub const MS_DEF_RSA_SCHANNEL_PROV: &'static str = "Microsoft RSA SChannel Cryptographic Provider"; -pub const MS_DEF_DSS_PROV: &'static str = "Microsoft Base DSS Cryptographic Provider"; -pub const MS_DEF_DSS_DH_PROV: &'static str = - "Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"; -pub const MS_ENH_DSS_DH_PROV: &'static str = - "Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"; -pub const MS_DEF_DH_SCHANNEL_PROV: &'static str = "Microsoft DH SChannel Cryptographic Provider"; -pub const MS_SCARD_PROV: &'static str = "Microsoft Base Smart Card Crypto Provider"; -pub const MS_ENH_RSA_AES_PROV: &'static str = - "Microsoft Enhanced RSA and AES Cryptographic Provider"; -pub const MS_ENH_RSA_AES_PROV_XP: &'static str = - "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"; -pub const MAXUIDLEN: usize = 64; -pub const EXPO_OFFLOAD_REG_VALUE: &'static str = "ExpoOffload"; -pub const EXPO_OFFLOAD_FUNC_NAME: &'static str = "OffloadModExpo"; -pub const szKEY_CRYPTOAPI_PRIVATE_KEY_OPTIONS: &'static str = - "Software\\Policies\\Microsoft\\Cryptography"; -pub const szKEY_CACHE_ENABLED: &'static str = "CachePrivateKeys"; -pub const szKEY_CACHE_SECONDS: &'static str = "PrivateKeyLifetimeSeconds"; -pub const szPRIV_KEY_CACHE_MAX_ITEMS: &'static str = "PrivKeyCacheMaxItems"; -pub const cPRIV_KEY_CACHE_MAX_ITEMS_DEFAULT: ::DWORD = 20; -pub const szPRIV_KEY_CACHE_PURGE_INTERVAL_SECONDS: &'static str = - "PrivKeyCachePurgeIntervalSeconds"; -pub const cPRIV_KEY_CACHE_PURGE_INTERVAL_SECONDS_DEFAULT: ::DWORD = 86400; -pub const CUR_BLOB_VERSION: ::DWORD = 2; -STRUCT!{struct CMS_KEY_INFO { - dwVersion: ::DWORD, - Algid: ALG_ID, - pbOID: *mut ::BYTE, - cbOID: ::DWORD, -}} -pub type PCMS_KEY_INFO = *mut CMS_KEY_INFO; -STRUCT!{struct HMAC_INFO { - HashAlgid: ALG_ID, - pbInnerString: *mut ::BYTE, - cbInnerString: ::DWORD, - pbOuterString: *mut ::BYTE, - cbOuterString: ::DWORD, -}} -pub type PHMAC_INFO = *mut HMAC_INFO; -STRUCT!{struct SCHANNEL_ALG { - dwUse: ::DWORD, - Algid: ALG_ID, - cBits: ::DWORD, - dwFlags: ::DWORD, - dwReserved: ::DWORD, -}} -pub type PSCHANNEL_ALG = *mut SCHANNEL_ALG; -pub const SCHANNEL_MAC_KEY: ::DWORD = 0x00000000; -pub const SCHANNEL_ENC_KEY: ::DWORD = 0x00000001; -pub const INTERNATIONAL_USAGE: ::DWORD = 0x00000001; -STRUCT!{struct PROV_ENUMALGS { - aiAlgid: ALG_ID, - dwBitLen: ::DWORD, - dwNameLen: ::DWORD, - szName: [::CHAR; 20], -}} -STRUCT!{nodebug struct PROV_ENUMALGS_EX { - aiAlgid: ALG_ID, - dwDefaultLen: ::DWORD, - dwMinLen: ::DWORD, - dwMaxLen: ::DWORD, - dwProtocols: ::DWORD, - dwNameLen: ::DWORD, - szName: [::CHAR; 20], - dwLongNameLen: ::DWORD, - szLongName: [::CHAR; 40], -}} -STRUCT!{struct BLOBHEADER { - bType: ::BYTE, - bVersion: ::BYTE, - reserved: ::WORD, - aiKeyAlg: ::ALG_ID, -}} -pub type PUBLICKEYSTRUC = BLOBHEADER; -STRUCT!{struct RSAPUBKEY { - magic: ::DWORD, - bitlen: ::DWORD, - pubexp: ::DWORD, -}} -STRUCT!{struct DHPUBKEY { - magic: ::DWORD, - bitlen: ::DWORD, -}} -pub type DSSPUBKEY = DHPUBKEY; -pub type KEAPUBKEY = DHPUBKEY; -pub type TEKPUBKEY = DHPUBKEY; -STRUCT!{struct DSSSEED { - counter: ::DWORD, - seed: [::BYTE; 20], -}} -STRUCT!{struct DHPUBKEY_VER3 { - magic: ::DWORD, - bitlenP: ::DWORD, - bitlenQ: ::DWORD, - bitlenJ: ::DWORD, - DSSSeed: DSSSEED, -}} -pub type DSSPUBKEY_VER3 = DHPUBKEY_VER3; -STRUCT!{struct DHPRIVKEY_VER3 { - magic: ::DWORD, - bitlenP: ::DWORD, - bitlenQ: ::DWORD, - bitlenJ: ::DWORD, - bitlenX: ::DWORD, - DSSSeed: DSSSEED, -}} -pub type DSSPRIVKEY_VER3 = DHPRIVKEY_VER3; -STRUCT!{struct KEY_TYPE_SUBTYPE { - dwKeySpec: ::DWORD, - Type: ::GUID, - Subtype: ::GUID, -}} -pub type PKEY_TYPE_SUBTYPE = *mut KEY_TYPE_SUBTYPE; -STRUCT!{nodebug struct CERT_FORTEZZA_DATA_PROP { - SerialNumber: [::c_uchar; 8], - CertIndex: ::c_int, - CertLabel: [::c_uchar; 36], -}} -STRUCT!{nodebug struct CRYPT_RC4_KEY_STATE { - Key: [::c_uchar; 16], - SBox: [::c_uchar; 256], - i: ::c_uchar, - j: ::c_uchar, -}} -pub type PCRYPT_RC4_KEY_STATE = *mut CRYPT_RC4_KEY_STATE; -STRUCT!{struct CRYPT_DES_KEY_STATE { - Key: [::c_uchar; 8], - IV: [::c_uchar; 8], - Feedback: [::c_uchar; 8], -}} -pub type PCRYPT_DES_KEY_STATE = *mut CRYPT_DES_KEY_STATE; -STRUCT!{struct CRYPT_3DES_KEY_STATE { - Key: [::c_uchar; 24], - IV: [::c_uchar; 8], - Feedback: [::c_uchar; 8], -}} -pub type PCRYPT_3DES_KEY_STATE = *mut CRYPT_3DES_KEY_STATE; -STRUCT!{struct CRYPT_AES_128_KEY_STATE { - Key: [::c_uchar; 16], - IV: [::c_uchar; 16], - EncryptionState: [[::c_uchar; 16]; 11], - DecryptionState: [[::c_uchar; 16]; 11], - Feedback: [::c_uchar; 16], -}} -pub type PCRYPT_AES_128_KEY_STATE = *mut CRYPT_AES_128_KEY_STATE; -STRUCT!{struct CRYPT_AES_256_KEY_STATE { - Key: [::c_uchar; 32], - IV: [::c_uchar; 16], - EncryptionState: [[::c_uchar; 16]; 15], - DecryptionState: [[::c_uchar; 16]; 15], - Feedback: [::c_uchar; 16], -}} -pub type PCRYPT_AES_256_KEY_STATE = *mut CRYPT_AES_256_KEY_STATE; -STRUCT!{struct CRYPTOAPI_BLOB { - cbData: ::DWORD, - pbData: *mut ::BYTE, -}} -pub type CRYPT_INTEGER_BLOB = CRYPTOAPI_BLOB; -pub type PCRYPT_INTEGER_BLOB = *mut CRYPTOAPI_BLOB; -pub type CRYPT_UINT_BLOB = CRYPTOAPI_BLOB; -pub type PCRYPT_UINT_BLOB = *mut CRYPTOAPI_BLOB; -pub type CRYPT_OBJID_BLOB = CRYPTOAPI_BLOB; -pub type PCRYPT_OBJID_BLOB = *mut CRYPTOAPI_BLOB; -pub type CERT_NAME_BLOB = CRYPTOAPI_BLOB; -pub type PCERT_NAME_BLOB = *mut CRYPTOAPI_BLOB; -pub type CERT_RDN_VALUE_BLOB = CRYPTOAPI_BLOB; -pub type PCERT_RDN_VALUE_BLOB = *mut CRYPTOAPI_BLOB; -pub type CERT_BLOB = CRYPTOAPI_BLOB; -pub type PCERT_BLOB = *mut CRYPTOAPI_BLOB; -pub type CRL_BLOB = CRYPTOAPI_BLOB; -pub type PCRL_BLOB = *mut CRYPTOAPI_BLOB; -pub type DATA_BLOB = CRYPTOAPI_BLOB; -pub type PDATA_BLOB = *mut CRYPTOAPI_BLOB; -pub type CRYPT_DATA_BLOB = CRYPTOAPI_BLOB; -pub type PCRYPT_DATA_BLOB = *mut CRYPTOAPI_BLOB; -pub type CRYPT_HASH_BLOB = CRYPTOAPI_BLOB; -pub type PCRYPT_HASH_BLOB = *mut CRYPTOAPI_BLOB; -pub type CRYPT_DIGEST_BLOB = CRYPTOAPI_BLOB; -pub type PCRYPT_DIGEST_BLOB = *mut CRYPTOAPI_BLOB; -pub type CRYPT_DER_BLOB = CRYPTOAPI_BLOB; -pub type PCRYPT_DER_BLOB = *mut CRYPTOAPI_BLOB; -pub type CRYPT_ATTR_BLOB = CRYPTOAPI_BLOB; -pub type PCRYPT_ATTR_BLOB = *mut CRYPTOAPI_BLOB; -STRUCT!{struct CMS_DH_KEY_INFO { - dwVersion: ::DWORD, - Algid: ALG_ID, - pszContentEncObjId: ::LPSTR, - PubInfo: CRYPT_DATA_BLOB, - pReserved: *mut ::c_void, -}} -pub type PCMS_DH_KEY_INFO = *mut CMS_DH_KEY_INFO; -pub type HCRYPTPROV_OR_NCRYPT_KEY_HANDLE = ::ULONG_PTR; -pub type HCRYPTPROV_LEGACY = ::ULONG_PTR; -STRUCT!{struct CRYPT_BIT_BLOB { - cbData: ::DWORD, - pbData: *mut ::BYTE, - cUnusedBits: ::DWORD, -}} -pub type PCRYPT_BIT_BLOB = *mut CRYPT_BIT_BLOB; -STRUCT!{struct CRYPT_ALGORITHM_IDENTIFIER { - pszObjId: ::LPSTR, - Parameters: CRYPT_OBJID_BLOB, -}} -pub type PCRYPT_ALGORITHM_IDENTIFIER = *mut CRYPT_ALGORITHM_IDENTIFIER; -pub const szOID_RSA: &'static str = "1.2.840.113549"; -pub const szOID_PKCS: &'static str = "1.2.840.113549.1"; -pub const szOID_RSA_HASH: &'static str = "1.2.840.113549.2"; -pub const szOID_RSA_ENCRYPT: &'static str = "1.2.840.113549.3"; -pub const szOID_PKCS_1: &'static str = "1.2.840.113549.1.1"; -pub const szOID_PKCS_2: &'static str = "1.2.840.113549.1.2"; -pub const szOID_PKCS_3: &'static str = "1.2.840.113549.1.3"; -pub const szOID_PKCS_4: &'static str = "1.2.840.113549.1.4"; -pub const szOID_PKCS_5: &'static str = "1.2.840.113549.1.5"; -pub const szOID_PKCS_6: &'static str = "1.2.840.113549.1.6"; -pub const szOID_PKCS_7: &'static str = "1.2.840.113549.1.7"; -pub const szOID_PKCS_8: &'static str = "1.2.840.113549.1.8"; -pub const szOID_PKCS_9: &'static str = "1.2.840.113549.1.9"; -pub const szOID_PKCS_10: &'static str = "1.2.840.113549.1.10"; -pub const szOID_PKCS_12: &'static str = "1.2.840.113549.1.12"; -pub const szOID_RSA_RSA: &'static str = "1.2.840.113549.1.1.1"; -pub const szOID_RSA_MD2RSA: &'static str = "1.2.840.113549.1.1.2"; -pub const szOID_RSA_MD4RSA: &'static str = "1.2.840.113549.1.1.3"; -pub const szOID_RSA_MD5RSA: &'static str = "1.2.840.113549.1.1.4"; -pub const szOID_RSA_SHA1RSA: &'static str = "1.2.840.113549.1.1.5"; -pub const szOID_RSA_SETOAEP_RSA: &'static str = "1.2.840.113549.1.1.6"; -pub const szOID_RSAES_OAEP: &'static str = "1.2.840.113549.1.1.7"; -pub const szOID_RSA_MGF1: &'static str = "1.2.840.113549.1.1.8"; -pub const szOID_RSA_PSPECIFIED: &'static str = "1.2.840.113549.1.1.9"; -pub const szOID_RSA_SSA_PSS: &'static str = "1.2.840.113549.1.1.10"; -pub const szOID_RSA_SHA256RSA: &'static str = "1.2.840.113549.1.1.11"; -pub const szOID_RSA_SHA384RSA: &'static str = "1.2.840.113549.1.1.12"; -pub const szOID_RSA_SHA512RSA: &'static str = "1.2.840.113549.1.1.13"; -pub const szOID_RSA_DH: &'static str = "1.2.840.113549.1.3.1"; -pub const szOID_RSA_data: &'static str = "1.2.840.113549.1.7.1"; -pub const szOID_RSA_signedData: &'static str = "1.2.840.113549.1.7.2"; -pub const szOID_RSA_envelopedData: &'static str = "1.2.840.113549.1.7.3"; -pub const szOID_RSA_signEnvData: &'static str = "1.2.840.113549.1.7.4"; -pub const szOID_RSA_digestedData: &'static str = "1.2.840.113549.1.7.5"; -pub const szOID_RSA_hashedData: &'static str = "1.2.840.113549.1.7.5"; -pub const szOID_RSA_encryptedData: &'static str = "1.2.840.113549.1.7.6"; -pub const szOID_RSA_emailAddr: &'static str = "1.2.840.113549.1.9.1"; -pub const szOID_RSA_unstructName: &'static str = "1.2.840.113549.1.9.2"; -pub const szOID_RSA_contentType: &'static str = "1.2.840.113549.1.9.3"; -pub const szOID_RSA_messageDigest: &'static str = "1.2.840.113549.1.9.4"; -pub const szOID_RSA_signingTime: &'static str = "1.2.840.113549.1.9.5"; -pub const szOID_RSA_counterSign: &'static str = "1.2.840.113549.1.9.6"; -pub const szOID_RSA_challengePwd: &'static str = "1.2.840.113549.1.9.7"; -pub const szOID_RSA_unstructAddr: &'static str = "1.2.840.113549.1.9.8"; -pub const szOID_RSA_extCertAttrs: &'static str = "1.2.840.113549.1.9.9"; -pub const szOID_RSA_certExtensions: &'static str = "1.2.840.113549.1.9.14"; -pub const szOID_RSA_SMIMECapabilities: &'static str = "1.2.840.113549.1.9.15"; -pub const szOID_RSA_preferSignedData: &'static str = "1.2.840.113549.1.9.15.1"; -pub const szOID_TIMESTAMP_TOKEN: &'static str = "1.2.840.113549.1.9.16.1.4"; -pub const szOID_RFC3161_counterSign: &'static str = "1.3.6.1.4.1.311.3.3.1"; -pub const szOID_RSA_SMIMEalg: &'static str = "1.2.840.113549.1.9.16.3"; -pub const szOID_RSA_SMIMEalgESDH: &'static str = "1.2.840.113549.1.9.16.3.5"; -pub const szOID_RSA_SMIMEalgCMS3DESwrap: &'static str = "1.2.840.113549.1.9.16.3.6"; -pub const szOID_RSA_SMIMEalgCMSRC2wrap: &'static str = "1.2.840.113549.1.9.16.3.7"; -pub const szOID_RSA_MD2: &'static str = "1.2.840.113549.2.2"; -pub const szOID_RSA_MD4: &'static str = "1.2.840.113549.2.4"; -pub const szOID_RSA_MD5: &'static str = "1.2.840.113549.2.5"; -pub const szOID_RSA_RC2CBC: &'static str = "1.2.840.113549.3.2"; -pub const szOID_RSA_RC4: &'static str = "1.2.840.113549.3.4"; -pub const szOID_RSA_DES_EDE3_CBC: &'static str = "1.2.840.113549.3.7"; -pub const szOID_RSA_RC5_CBCPad: &'static str = "1.2.840.113549.3.9"; -pub const szOID_ANSI_X942: &'static str = "1.2.840.10046"; -pub const szOID_ANSI_X942_DH: &'static str = "1.2.840.10046.2.1"; -pub const szOID_X957: &'static str = "1.2.840.10040"; -pub const szOID_X957_DSA: &'static str = "1.2.840.10040.4.1"; -pub const szOID_X957_SHA1DSA: &'static str = "1.2.840.10040.4.3"; -pub const szOID_ECC_PUBLIC_KEY: &'static str = "1.2.840.10045.2.1"; -pub const szOID_ECC_CURVE_P256: &'static str = "1.2.840.10045.3.1.7"; -pub const szOID_ECC_CURVE_P384: &'static str = "1.3.132.0.34"; -pub const szOID_ECC_CURVE_P521: &'static str = "1.3.132.0.35"; -pub const szOID_ECDSA_SHA1: &'static str = "1.2.840.10045.4.1"; -pub const szOID_ECDSA_SPECIFIED: &'static str = "1.2.840.10045.4.3"; -pub const szOID_ECDSA_SHA256: &'static str = "1.2.840.10045.4.3.2"; -pub const szOID_ECDSA_SHA384: &'static str = "1.2.840.10045.4.3.3"; -pub const szOID_ECDSA_SHA512: &'static str = "1.2.840.10045.4.3.4"; -pub const szOID_NIST_AES128_CBC: &'static str = "2.16.840.1.101.3.4.1.2"; -pub const szOID_NIST_AES192_CBC: &'static str = "2.16.840.1.101.3.4.1.22"; -pub const szOID_NIST_AES256_CBC: &'static str = "2.16.840.1.101.3.4.1.42"; -pub const szOID_NIST_AES128_WRAP: &'static str = "2.16.840.1.101.3.4.1.5"; -pub const szOID_NIST_AES192_WRAP: &'static str = "2.16.840.1.101.3.4.1.25"; -pub const szOID_NIST_AES256_WRAP: &'static str = "2.16.840.1.101.3.4.1.45"; -pub const szOID_DH_SINGLE_PASS_STDDH_SHA1_KDF: &'static str = "1.3.133.16.840.63.0.2"; -pub const szOID_DH_SINGLE_PASS_STDDH_SHA256_KDF: &'static str = "1.3.132.1.11.1"; -pub const szOID_DH_SINGLE_PASS_STDDH_SHA384_KDF: &'static str = "1.3.132.1.11.2"; -pub const szOID_DS: &'static str = "2.5"; -pub const szOID_DSALG: &'static str = "2.5.8"; -pub const szOID_DSALG_CRPT: &'static str = "2.5.8.1"; -pub const szOID_DSALG_HASH: &'static str = "2.5.8.2"; -pub const szOID_DSALG_SIGN: &'static str = "2.5.8.3"; -pub const szOID_DSALG_RSA: &'static str = "2.5.8.1.1"; -pub const szOID_OIW: &'static str = "1.3.14"; -pub const szOID_OIWSEC: &'static str = "1.3.14.3.2"; -pub const szOID_OIWSEC_md4RSA: &'static str = "1.3.14.3.2.2"; -pub const szOID_OIWSEC_md5RSA: &'static str = "1.3.14.3.2.3"; -pub const szOID_OIWSEC_md4RSA2: &'static str = "1.3.14.3.2.4"; -pub const szOID_OIWSEC_desECB: &'static str = "1.3.14.3.2.6"; -pub const szOID_OIWSEC_desCBC: &'static str = "1.3.14.3.2.7"; -pub const szOID_OIWSEC_desOFB: &'static str = "1.3.14.3.2.8"; -pub const szOID_OIWSEC_desCFB: &'static str = "1.3.14.3.2.9"; -pub const szOID_OIWSEC_desMAC: &'static str = "1.3.14.3.2.10"; -pub const szOID_OIWSEC_rsaSign: &'static str = "1.3.14.3.2.11"; -pub const szOID_OIWSEC_dsa: &'static str = "1.3.14.3.2.12"; -pub const szOID_OIWSEC_shaDSA: &'static str = "1.3.14.3.2.13"; -pub const szOID_OIWSEC_mdc2RSA: &'static str = "1.3.14.3.2.14"; -pub const szOID_OIWSEC_shaRSA: &'static str = "1.3.14.3.2.15"; -pub const szOID_OIWSEC_dhCommMod: &'static str = "1.3.14.3.2.16"; -pub const szOID_OIWSEC_desEDE: &'static str = "1.3.14.3.2.17"; -pub const szOID_OIWSEC_sha: &'static str = "1.3.14.3.2.18"; -pub const szOID_OIWSEC_mdc2: &'static str = "1.3.14.3.2.19"; -pub const szOID_OIWSEC_dsaComm: &'static str = "1.3.14.3.2.20"; -pub const szOID_OIWSEC_dsaCommSHA: &'static str = "1.3.14.3.2.21"; -pub const szOID_OIWSEC_rsaXchg: &'static str = "1.3.14.3.2.22"; -pub const szOID_OIWSEC_keyHashSeal: &'static str = "1.3.14.3.2.23"; -pub const szOID_OIWSEC_md2RSASign: &'static str = "1.3.14.3.2.24"; -pub const szOID_OIWSEC_md5RSASign: &'static str = "1.3.14.3.2.25"; -pub const szOID_OIWSEC_sha1: &'static str = "1.3.14.3.2.26"; -pub const szOID_OIWSEC_dsaSHA1: &'static str = "1.3.14.3.2.27"; -pub const szOID_OIWSEC_dsaCommSHA1: &'static str = "1.3.14.3.2.28"; -pub const szOID_OIWSEC_sha1RSASign: &'static str = "1.3.14.3.2.29"; -pub const szOID_OIWDIR: &'static str = "1.3.14.7.2"; -pub const szOID_OIWDIR_CRPT: &'static str = "1.3.14.7.2.1"; -pub const szOID_OIWDIR_HASH: &'static str = "1.3.14.7.2.2"; -pub const szOID_OIWDIR_SIGN: &'static str = "1.3.14.7.2.3"; -pub const szOID_OIWDIR_md2: &'static str = "1.3.14.7.2.2.1"; -pub const szOID_OIWDIR_md2RSA: &'static str = "1.3.14.7.2.3.1"; -pub const szOID_INFOSEC: &'static str = "2.16.840.1.101.2.1"; -pub const szOID_INFOSEC_sdnsSignature: &'static str = "2.16.840.1.101.2.1.1.1"; -pub const szOID_INFOSEC_mosaicSignature: &'static str = "2.16.840.1.101.2.1.1.2"; -pub const szOID_INFOSEC_sdnsConfidentiality: &'static str = "2.16.840.1.101.2.1.1.3"; -pub const szOID_INFOSEC_mosaicConfidentiality: &'static str = "2.16.840.1.101.2.1.1.4"; -pub const szOID_INFOSEC_sdnsIntegrity: &'static str = "2.16.840.1.101.2.1.1.5"; -pub const szOID_INFOSEC_mosaicIntegrity: &'static str = "2.16.840.1.101.2.1.1.6"; -pub const szOID_INFOSEC_sdnsTokenProtection: &'static str = "2.16.840.1.101.2.1.1.7"; -pub const szOID_INFOSEC_mosaicTokenProtection: &'static str = "2.16.840.1.101.2.1.1.8"; -pub const szOID_INFOSEC_sdnsKeyManagement: &'static str = "2.16.840.1.101.2.1.1.9"; -pub const szOID_INFOSEC_mosaicKeyManagement: &'static str = "2.16.840.1.101.2.1.1.10"; -pub const szOID_INFOSEC_sdnsKMandSig: &'static str = "2.16.840.1.101.2.1.1.11"; -pub const szOID_INFOSEC_mosaicKMandSig: &'static str = "2.16.840.1.101.2.1.1.12"; -pub const szOID_INFOSEC_SuiteASignature: &'static str = "2.16.840.1.101.2.1.1.13"; -pub const szOID_INFOSEC_SuiteAConfidentiality: &'static str = "2.16.840.1.101.2.1.1.14"; -pub const szOID_INFOSEC_SuiteAIntegrity: &'static str = "2.16.840.1.101.2.1.1.15"; -pub const szOID_INFOSEC_SuiteATokenProtection: &'static str = "2.16.840.1.101.2.1.1.16"; -pub const szOID_INFOSEC_SuiteAKeyManagement: &'static str = "2.16.840.1.101.2.1.1.17"; -pub const szOID_INFOSEC_SuiteAKMandSig: &'static str = "2.16.840.1.101.2.1.1.18"; -pub const szOID_INFOSEC_mosaicUpdatedSig: &'static str = "2.16.840.1.101.2.1.1.19"; -pub const szOID_INFOSEC_mosaicKMandUpdSig: &'static str = "2.16.840.1.101.2.1.1.20"; -pub const szOID_INFOSEC_mosaicUpdatedInteg: &'static str = "2.16.840.1.101.2.1.1.21"; -pub const szOID_NIST_sha256: &'static str = "2.16.840.1.101.3.4.2.1"; -pub const szOID_NIST_sha384: &'static str = "2.16.840.1.101.3.4.2.2"; -pub const szOID_NIST_sha512: &'static str = "2.16.840.1.101.3.4.2.3"; -STRUCT!{struct CRYPT_OBJID_TABLE { - dwAlgId: ::DWORD, - pszObjId: ::LPCSTR, -}} -pub type PCRYPT_OBJID_TABLE = *mut CRYPT_OBJID_TABLE; -STRUCT!{struct CRYPT_HASH_INFO { - HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, - Hash: CRYPT_HASH_BLOB, -}} -pub type PCRYPT_HASH_INFO = *mut CRYPT_HASH_INFO; -STRUCT!{struct CERT_EXTENSION { - pszObjId: ::LPSTR, - fCritical: ::BOOL, - Value: CRYPT_OBJID_BLOB, -}} -pub type PCERT_EXTENSION = *mut CERT_EXTENSION; -pub type PCCERT_EXTENSION = *const CERT_EXTENSION; -STRUCT!{struct CRYPT_ATTRIBUTE_TYPE_VALUE { - pszObjId: ::LPSTR, - Value: CRYPT_OBJID_BLOB, -}} -pub type PCRYPT_ATTRIBUTE_TYPE_VALUE = *mut CRYPT_ATTRIBUTE_TYPE_VALUE; -STRUCT!{struct CRYPT_ATTRIBUTE { - pszObjId: ::LPSTR, - cValue: ::DWORD, - rgValue: PCRYPT_ATTR_BLOB, -}} -pub type PCRYPT_ATTRIBUTE = *mut CRYPT_ATTRIBUTE; -STRUCT!{struct CRYPT_ATTRIBUTES { - cAttr: ::DWORD, - rgAttr: PCRYPT_ATTRIBUTE, -}} -pub type PCRYPT_ATTRIBUTES = *mut CRYPT_ATTRIBUTES; -STRUCT!{struct CERT_RDN_ATTR { - pszObjId: ::LPSTR, - dwValueType: ::DWORD, - Value: CERT_RDN_VALUE_BLOB, -}} -pub type PCERT_RDN_ATTR = *mut CERT_RDN_ATTR; -pub const szOID_COMMON_NAME: &'static str = "2.5.4.3"; -pub const szOID_SUR_NAME: &'static str = "2.5.4.4"; -pub const szOID_DEVICE_SERIAL_NUMBER: &'static str = "2.5.4.5"; -pub const szOID_COUNTRY_NAME: &'static str = "2.5.4.6"; -pub const szOID_LOCALITY_NAME: &'static str = "2.5.4.7"; -pub const szOID_STATE_OR_PROVINCE_NAME: &'static str = "2.5.4.8"; -pub const szOID_STREET_ADDRESS: &'static str = "2.5.4.9"; -pub const szOID_ORGANIZATION_NAME: &'static str = "2.5.4.10"; -pub const szOID_ORGANIZATIONAL_UNIT_NAME: &'static str = "2.5.4.11"; -pub const szOID_TITLE: &'static str = "2.5.4.12"; -pub const szOID_DESCRIPTION: &'static str = "2.5.4.13"; -pub const szOID_SEARCH_GUIDE: &'static str = "2.5.4.14"; -pub const szOID_BUSINESS_CATEGORY: &'static str = "2.5.4.15"; -pub const szOID_POSTAL_ADDRESS: &'static str = "2.5.4.16"; -pub const szOID_POSTAL_CODE: &'static str = "2.5.4.17"; -pub const szOID_POST_OFFICE_BOX: &'static str = "2.5.4.18"; -pub const szOID_PHYSICAL_DELIVERY_OFFICE_NAME: &'static str = "2.5.4.19"; -pub const szOID_TELEPHONE_NUMBER: &'static str = "2.5.4.20"; -pub const szOID_TELEX_NUMBER: &'static str = "2.5.4.21"; -pub const szOID_TELETEXT_TERMINAL_IDENTIFIER: &'static str = "2.5.4.22"; -pub const szOID_FACSIMILE_TELEPHONE_NUMBER: &'static str = "2.5.4.23"; -pub const szOID_X21_ADDRESS: &'static str = "2.5.4.24"; -pub const szOID_INTERNATIONAL_ISDN_NUMBER: &'static str = "2.5.4.25"; -pub const szOID_REGISTERED_ADDRESS: &'static str = "2.5.4.26"; -pub const szOID_DESTINATION_INDICATOR: &'static str = "2.5.4.27"; -pub const szOID_PREFERRED_DELIVERY_METHOD: &'static str = "2.5.4.28"; -pub const szOID_PRESENTATION_ADDRESS: &'static str = "2.5.4.29"; -pub const szOID_SUPPORTED_APPLICATION_CONTEXT: &'static str = "2.5.4.30"; -pub const szOID_MEMBER: &'static str = "2.5.4.31"; -pub const szOID_OWNER: &'static str = "2.5.4.32"; -pub const szOID_ROLE_OCCUPANT: &'static str = "2.5.4.33"; -pub const szOID_SEE_ALSO: &'static str = "2.5.4.34"; -pub const szOID_USER_PASSWORD: &'static str = "2.5.4.35"; -pub const szOID_USER_CERTIFICATE: &'static str = "2.5.4.36"; -pub const szOID_CA_CERTIFICATE: &'static str = "2.5.4.37"; -pub const szOID_AUTHORITY_REVOCATION_LIST: &'static str = "2.5.4.38"; -pub const szOID_CERTIFICATE_REVOCATION_LIST: &'static str = "2.5.4.39"; -pub const szOID_CROSS_CERTIFICATE_PAIR: &'static str = "2.5.4.40"; -pub const szOID_GIVEN_NAME: &'static str = "2.5.4.42"; -pub const szOID_INITIALS: &'static str = "2.5.4.43"; -pub const szOID_DN_QUALIFIER: &'static str = "2.5.4.46"; -pub const szOID_DOMAIN_COMPONENT: &'static str = "0.9.2342.19200300.100.1.25"; -pub const szOID_PKCS_12_FRIENDLY_NAME_ATTR: &'static str = "1.2.840.113549.1.9.20"; -pub const szOID_PKCS_12_LOCAL_KEY_ID: &'static str = "1.2.840.113549.1.9.21"; -pub const szOID_PKCS_12_KEY_PROVIDER_NAME_ATTR: &'static str = "1.3.6.1.4.1.311.17.1"; -pub const szOID_LOCAL_MACHINE_KEYSET: &'static str = "1.3.6.1.4.1.311.17.2"; -pub const szOID_PKCS_12_EXTENDED_ATTRIBUTES: &'static str = "1.3.6.1.4.1.311.17.3"; -pub const szOID_PKCS_12_PROTECTED_PASSWORD_SECRET_BAG_TYPE_ID: &'static str = - "1.3.6.1.4.1.311.17.4"; -pub const szOID_KEYID_RDN: &'static str = "1.3.6.1.4.1.311.10.7.1"; -pub const szOID_EV_RDN_LOCALE: &'static str = "1.3.6.1.4.1.311.60.2.1.1"; -pub const szOID_EV_RDN_STATE_OR_PROVINCE: &'static str = "1.3.6.1.4.1.311.60.2.1.2"; -pub const szOID_EV_RDN_COUNTRY: &'static str = "1.3.6.1.4.1.311.60.2.1.3"; -pub const CERT_RDN_ANY_TYPE: ::DWORD = 0; -pub const CERT_RDN_ENCODED_BLOB: ::DWORD = 1; -pub const CERT_RDN_OCTET_STRING: ::DWORD = 2; -pub const CERT_RDN_NUMERIC_STRING: ::DWORD = 3; -pub const CERT_RDN_PRINTABLE_STRING: ::DWORD = 4; -pub const CERT_RDN_TELETEX_STRING: ::DWORD = 5; -pub const CERT_RDN_T61_STRING: ::DWORD = 5; -pub const CERT_RDN_VIDEOTEX_STRING: ::DWORD = 6; -pub const CERT_RDN_IA5_STRING: ::DWORD = 7; -pub const CERT_RDN_GRAPHIC_STRING: ::DWORD = 8; -pub const CERT_RDN_VISIBLE_STRING: ::DWORD = 9; -pub const CERT_RDN_ISO646_STRING: ::DWORD = 9; -pub const CERT_RDN_GENERAL_STRING: ::DWORD = 10; -pub const CERT_RDN_UNIVERSAL_STRING: ::DWORD = 11; -pub const CERT_RDN_INT4_STRING: ::DWORD = 11; -pub const CERT_RDN_BMP_STRING: ::DWORD = 12; -pub const CERT_RDN_UNICODE_STRING: ::DWORD = 12; -pub const CERT_RDN_UTF8_STRING: ::DWORD = 13; -pub const CERT_RDN_TYPE_MASK: ::DWORD = 0x000000FF; -pub const CERT_RDN_FLAGS_MASK: ::DWORD = 0xFF000000; -pub const CERT_RDN_ENABLE_T61_UNICODE_FLAG: ::DWORD = 0x80000000; -pub const CERT_RDN_ENABLE_UTF8_UNICODE_FLAG: ::DWORD = 0x20000000; -pub const CERT_RDN_FORCE_UTF8_UNICODE_FLAG: ::DWORD = 0x10000000; -pub const CERT_RDN_DISABLE_CHECK_TYPE_FLAG: ::DWORD = 0x40000000; -pub const CERT_RDN_DISABLE_IE4_UTF8_FLAG: ::DWORD = 0x01000000; -pub const CERT_RDN_ENABLE_PUNYCODE_FLAG: ::DWORD = 0x02000000; -STRUCT!{struct CERT_RDN { - cRDNAttr: ::DWORD, - rgRDNAttr: PCERT_RDN_ATTR, -}} -pub type PCERT_RDN = *mut CERT_RDN; -STRUCT!{struct CERT_NAME_INFO { - cRDN: ::DWORD, - rgRDN: PCERT_RDN, -}} -pub type PCERT_NAME_INFO = *mut CERT_NAME_INFO; -STRUCT!{struct CERT_NAME_VALUE { - dwValueType: ::DWORD, - Value: CERT_RDN_VALUE_BLOB, -}} -pub type PCERT_NAME_VALUE = *mut CERT_NAME_VALUE; -STRUCT!{struct CERT_PUBLIC_KEY_INFO { - Algorithm: CRYPT_ALGORITHM_IDENTIFIER, - PublicKey: CRYPT_BIT_BLOB, -}} -pub type PCERT_PUBLIC_KEY_INFO = *mut CERT_PUBLIC_KEY_INFO; -pub const CERT_RSA_PUBLIC_KEY_OBJID: &'static str = szOID_RSA_RSA; -pub const CERT_DEFAULT_OID_PUBLIC_KEY_SIGN: &'static str = szOID_RSA_RSA; -pub const CERT_DEFAULT_OID_PUBLIC_KEY_XCHG: &'static str = szOID_RSA_RSA; -STRUCT!{struct CRYPT_ECC_PRIVATE_KEY_INFO { - dwVersion: ::DWORD, - PrivateKey: CRYPT_DER_BLOB, - szCurveOid: ::LPSTR, - PublicKey: CRYPT_BIT_BLOB, -}} -pub type PCRYPT_ECC_PRIVATE_KEY_INFO = *mut CRYPT_ECC_PRIVATE_KEY_INFO; -pub const CRYPT_ECC_PRIVATE_KEY_INFO_v1: ::DWORD = 1; -STRUCT!{struct CRYPT_PRIVATE_KEY_INFO { - Version: ::DWORD, - Algorithm: CRYPT_ALGORITHM_IDENTIFIER, - PrivateKey: CRYPT_DER_BLOB, - pAttributes: PCRYPT_ATTRIBUTES, -}} -pub type PCRYPT_PRIVATE_KEY_INFO = *mut CRYPT_PRIVATE_KEY_INFO; -STRUCT!{struct CRYPT_ENCRYPTED_PRIVATE_KEY_INFO { - EncryptionAlgorithm: ::CRYPT_ALGORITHM_IDENTIFIER, - EncryptedPrivateKey: ::CRYPT_DATA_BLOB, -}} -pub type PCRYPT_ENCRYPTED_PRIVATE_KEY_INFO = *mut CRYPT_ENCRYPTED_PRIVATE_KEY_INFO; -pub type PCRYPT_DECRYPT_PRIVATE_KEY_FUNC = Option ::BOOL>; -pub type PCRYPT_ENCRYPT_PRIVATE_KEY_FUNC = Option ::BOOL>; -pub type PCRYPT_RESOLVE_HCRYPTPROV_FUNC = Option ::BOOL>; -STRUCT!{nodebug struct CRYPT_PKCS8_IMPORT_PARAMS { - PrivateKey: CRYPT_DIGEST_BLOB, - pResolvehCryptProvFunc: PCRYPT_RESOLVE_HCRYPTPROV_FUNC, - pVoidResolveFunc: ::LPVOID, - pDecryptPrivateKeyFunc: PCRYPT_DECRYPT_PRIVATE_KEY_FUNC, - pVoidDecryptFunc: ::LPVOID, -}} -pub type PCRYPT_PKCS8_IMPORT_PARAMS = *mut CRYPT_PKCS8_IMPORT_PARAMS; -pub type CRYPT_PRIVATE_KEY_BLOB_AND_PARAMS = CRYPT_PKCS8_IMPORT_PARAMS; -pub type PPCRYPT_PRIVATE_KEY_BLOB_AND_PARAMS = *mut CRYPT_PKCS8_IMPORT_PARAMS; -STRUCT!{nodebug struct CRYPT_PKCS8_EXPORT_PARAMS { - hCryptProv: HCRYPTPROV, - dwKeySpec: ::DWORD, - pszPrivateKeyObjId: ::LPSTR, - pEncryptPrivateKeyFunc: PCRYPT_ENCRYPT_PRIVATE_KEY_FUNC, - pVoidEncryptFunc: ::LPVOID, -}} -pub type PCRYPT_PKCS8_EXPORT_PARAMS = *mut CRYPT_PKCS8_EXPORT_PARAMS; -STRUCT!{struct CERT_INFO { - dwVersion: ::DWORD, - SerialNumber: CRYPT_INTEGER_BLOB, - SignatureAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, - Issuer: CERT_NAME_BLOB, - NotBefore: ::FILETIME, - NotAfter: ::FILETIME, - Subject: CERT_NAME_BLOB, - SubjectPublicKeyInfo: CERT_PUBLIC_KEY_INFO, - IssuerUniqueId: CRYPT_BIT_BLOB, - SubjectUniqueId: CRYPT_BIT_BLOB, - cExtension: ::DWORD, - rgExtension: PCERT_EXTENSION, -}} -pub type PCERT_INFO = *mut CERT_INFO; -pub const CERT_V1: ::DWORD = 0; -pub const CERT_V2: ::DWORD = 1; -pub const CERT_V3: ::DWORD = 2; -pub const CERT_INFO_VERSION_FLAG: ::DWORD = 1; -pub const CERT_INFO_SERIAL_NUMBER_FLAG: ::DWORD = 2; -pub const CERT_INFO_SIGNATURE_ALGORITHM_FLAG: ::DWORD = 3; -pub const CERT_INFO_ISSUER_FLAG: ::DWORD = 4; -pub const CERT_INFO_NOT_BEFORE_FLAG: ::DWORD = 5; -pub const CERT_INFO_NOT_AFTER_FLAG: ::DWORD = 6; -pub const CERT_INFO_SUBJECT_FLAG: ::DWORD = 7; -pub const CERT_INFO_SUBJECT_PUBLIC_KEY_INFO_FLAG: ::DWORD = 8; -pub const CERT_INFO_ISSUER_UNIQUE_ID_FLAG: ::DWORD = 9; -pub const CERT_INFO_SUBJECT_UNIQUE_ID_FLAG: ::DWORD = 10; -pub const CERT_INFO_EXTENSION_FLAG: ::DWORD = 11; -STRUCT!{struct CRL_ENTRY { - SerialNumber: CRYPT_INTEGER_BLOB, - RevocationDate: ::FILETIME, - cExtension: ::DWORD, - rgExtension: PCERT_EXTENSION, -}} -pub type PCRL_ENTRY = *mut CRL_ENTRY; -STRUCT!{struct CRL_INFO { - dwVersion: ::DWORD, - SignatureAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, - Issuer: CERT_NAME_BLOB, - ThisUpdate: ::FILETIME, - NextUpdate: ::FILETIME, - cCRLEntry: ::DWORD, - rgCRLEntry: PCRL_ENTRY, - cExtension: ::DWORD, - rgExtension: PCERT_EXTENSION, -}} -pub type PCRL_INFO = *mut CRL_INFO; -pub const CRL_V1: ::DWORD = 0; -pub const CRL_V2: ::DWORD = 1; -pub const CERT_BUNDLE_CERTIFICATE: ::DWORD = 0; -pub const CERT_BUNDLE_CRL: ::DWORD = 1; -STRUCT!{struct CERT_OR_CRL_BLOB { - dwChoice: ::DWORD, - cbEncoded: ::DWORD, - pbEncoded: *mut ::BYTE, -}} -pub type PCERT_OR_CRL_BLOB = *mut CERT_OR_CRL_BLOB; -STRUCT!{struct CERT_OR_CRL_BUNDLE { - cItem: ::DWORD, - rgItem: PCERT_OR_CRL_BLOB, -}} -pub type PCERT_OR_CRL_BUNDLE = *mut CERT_OR_CRL_BUNDLE; -STRUCT!{struct CERT_REQUEST_INFO { - dwVersion: ::DWORD, - Subject: CERT_NAME_BLOB, - SubjectPublicKeyInfo: CERT_PUBLIC_KEY_INFO, - cAttribute: ::DWORD, - rgAttribute: PCRYPT_ATTRIBUTE, -}} -pub type PCERT_REQUEST_INFO = *mut CERT_REQUEST_INFO; -pub const CERT_REQUEST_V1: ::DWORD = 0; -STRUCT!{struct CERT_KEYGEN_REQUEST_INFO { - dwVersion: ::DWORD, - SubjectPublicKeyInfo: CERT_PUBLIC_KEY_INFO, - pwszChallengeString: ::LPWSTR, -}} -pub type PCERT_KEYGEN_REQUEST_INFO = *mut CERT_KEYGEN_REQUEST_INFO; -pub const CERT_KEYGEN_REQUEST_V1: ::DWORD = 0; -STRUCT!{struct CERT_SIGNED_CONTENT_INFO { - ToBeSigned: CRYPT_DER_BLOB, - SignatureAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, - Signature: CRYPT_BIT_BLOB, -}} -pub type PCERT_SIGNED_CONTENT_INFO = *mut CERT_SIGNED_CONTENT_INFO; -STRUCT!{struct CTL_USAGE { - cUsageIdentifier: ::DWORD, - rgpszUsageIdentifier: *mut ::LPSTR, -}} -pub type PCTL_USAGE = *mut CTL_USAGE; -pub type CERT_ENHKEY_USAGE = CTL_USAGE; -pub type PCERT_ENHKEY_USAGE = *mut CERT_ENHKEY_USAGE; -pub type PCCTL_USAGE = *const CTL_USAGE; -pub type PCCERT_ENHKEY_USAGE = *const CERT_ENHKEY_USAGE; -STRUCT!{struct CTL_ENTRY { - SubjectIdentifier: CRYPT_DATA_BLOB, - cAttribute: ::DWORD, - rgAttribute: PCRYPT_ATTRIBUTE, -}} -pub type PCTL_ENTRY = *mut CTL_ENTRY; -STRUCT!{struct CTL_INFO { - dwVersion: ::DWORD, - SubjectUsage: CTL_USAGE, - ListIdentifier: CRYPT_DATA_BLOB, - SequenceNumber: CRYPT_INTEGER_BLOB, - ThisUpdate: ::FILETIME, - NextUpdate: ::FILETIME, - SubjectAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, - cCTLEntry: ::DWORD, - rgCTLEntry: PCTL_ENTRY, - cExtension: ::DWORD, - rgExtension: PCERT_EXTENSION, -}} -pub type PCTL_INFO = *mut CTL_INFO; -pub const CTL_V1: ::DWORD = 0; -STRUCT!{struct CRYPT_TIME_STAMP_REQUEST_INFO { - pszTimeStampAlgorithm: ::LPSTR, - pszContentType: ::LPSTR, - Content: CRYPT_OBJID_BLOB, - cAttribute: ::DWORD, - rgAttribute: PCRYPT_ATTRIBUTE, -}} -pub type PCRYPT_TIME_STAMP_REQUEST_INFO = *mut CRYPT_TIME_STAMP_REQUEST_INFO; -STRUCT!{struct CRYPT_ENROLLMENT_NAME_VALUE_PAIR { - pwszName: ::LPWSTR, - pwszValue: ::LPWSTR, -}} -pub type PCRYPT_ENROLLMENT_NAME_VALUE_PAIR = *mut CRYPT_ENROLLMENT_NAME_VALUE_PAIR; -STRUCT!{struct CRYPT_CSP_PROVIDER { - dwKeySpec: ::DWORD, - pwszProviderName: ::LPWSTR, - Signature: CRYPT_BIT_BLOB, -}} -pub type PCRYPT_CSP_PROVIDER = *mut CRYPT_CSP_PROVIDER; -pub const CERT_ENCODING_TYPE_MASK: ::DWORD = 0x0000FFFF; -pub const CMSG_ENCODING_TYPE_MASK: ::DWORD = 0xFFFF0000; -pub const CRYPT_ASN_ENCODING: ::DWORD = 0x00000001; -pub const CRYPT_NDR_ENCODING: ::DWORD = 0x00000002; -pub const X509_ASN_ENCODING: ::DWORD = 0x00000001; -pub const X509_NDR_ENCODING: ::DWORD = 0x00000002; -pub const PKCS_7_ASN_ENCODING: ::DWORD = 0x00010000; -pub const PKCS_7_NDR_ENCODING: ::DWORD = 0x00020000; -pub const CRYPT_FORMAT_STR_MULTI_LINE: ::DWORD = 0x0001; -pub const CRYPT_FORMAT_STR_NO_HEX: ::DWORD = 0x0010; -pub const CRYPT_FORMAT_SIMPLE: ::DWORD = 0x0001; -pub const CRYPT_FORMAT_X509: ::DWORD = 0x0002; -pub const CRYPT_FORMAT_OID: ::DWORD = 0x0004; -pub const CRYPT_FORMAT_RDN_SEMICOLON: ::DWORD = 0x0100; -pub const CRYPT_FORMAT_RDN_CRLF: ::DWORD = 0x0200; -pub const CRYPT_FORMAT_RDN_UNQUOTE: ::DWORD = 0x0400; -pub const CRYPT_FORMAT_RDN_REVERSE: ::DWORD = 0x0800; -pub const CRYPT_FORMAT_COMMA: ::DWORD = 0x1000; -pub const CRYPT_FORMAT_SEMICOLON: ::DWORD = CRYPT_FORMAT_RDN_SEMICOLON; -pub const CRYPT_FORMAT_CRLF: ::DWORD = CRYPT_FORMAT_RDN_CRLF; -pub type PFN_CRYPT_ALLOC = Option; -pub type PFN_CRYPT_FREE = Option; -STRUCT!{nodebug struct CRYPT_ENCODE_PARA { - cbSize: ::DWORD, - pfnAlloc: PFN_CRYPT_ALLOC, - pfnFree: PFN_CRYPT_FREE, -}} -pub type PCRYPT_ENCODE_PARA = *mut CRYPT_ENCODE_PARA; -pub const CRYPT_ENCODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG: ::DWORD = 0x8; -pub const CRYPT_ENCODE_ALLOC_FLAG: ::DWORD = 0x8000; -pub const CRYPT_UNICODE_NAME_ENCODE_ENABLE_T61_UNICODE_FLAG: ::DWORD = - CERT_RDN_ENABLE_T61_UNICODE_FLAG; -pub const CRYPT_UNICODE_NAME_ENCODE_ENABLE_UTF8_UNICODE_FLAG: ::DWORD = - CERT_RDN_ENABLE_UTF8_UNICODE_FLAG; -pub const CRYPT_UNICODE_NAME_ENCODE_FORCE_UTF8_UNICODE_FLAG: ::DWORD = - CERT_RDN_FORCE_UTF8_UNICODE_FLAG; -pub const CRYPT_UNICODE_NAME_ENCODE_DISABLE_CHECK_TYPE_FLAG: ::DWORD = - CERT_RDN_DISABLE_CHECK_TYPE_FLAG; -pub const CRYPT_SORTED_CTL_ENCODE_HASHED_SUBJECT_IDENTIFIER_FLAG: ::DWORD = 0x10000; -pub const CRYPT_ENCODE_ENABLE_PUNYCODE_FLAG: ::DWORD = 0x20000; -pub const CRYPT_ENCODE_ENABLE_UTF8PERCENT_FLAG: ::DWORD = 0x40000; -pub const CRYPT_ENCODE_ENABLE_IA5CONVERSION_FLAG: ::DWORD = CRYPT_ENCODE_ENABLE_PUNYCODE_FLAG - | CRYPT_ENCODE_ENABLE_UTF8PERCENT_FLAG; -STRUCT!{nodebug struct CRYPT_DECODE_PARA { - cbSize: ::DWORD, - pfnAlloc: PFN_CRYPT_ALLOC, - pfnFree: PFN_CRYPT_FREE, -}} -pub type PCRYPT_DECODE_PARA = *mut CRYPT_DECODE_PARA; -pub const CRYPT_DECODE_NOCOPY_FLAG: ::DWORD = 0x1; -pub const CRYPT_DECODE_TO_BE_SIGNED_FLAG: ::DWORD = 0x2; -pub const CRYPT_DECODE_SHARE_OID_STRING_FLAG: ::DWORD = 0x4; -pub const CRYPT_DECODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG: ::DWORD = 0x8; -pub const CRYPT_DECODE_ALLOC_FLAG: ::DWORD = 0x8000; -pub const CRYPT_UNICODE_NAME_DECODE_DISABLE_IE4_UTF8_FLAG: ::DWORD = - CERT_RDN_DISABLE_IE4_UTF8_FLAG; -pub const CRYPT_DECODE_ENABLE_PUNYCODE_FLAG: ::DWORD = 0x02000000; -pub const CRYPT_DECODE_ENABLE_UTF8PERCENT_FLAG: ::DWORD = 0x04000000; -pub const CRYPT_DECODE_ENABLE_IA5CONVERSION_FLAG: ::DWORD = CRYPT_DECODE_ENABLE_PUNYCODE_FLAG - | CRYPT_DECODE_ENABLE_UTF8PERCENT_FLAG; -pub const CRYPT_ENCODE_DECODE_NONE: ::LPCSTR = 0 as ::LPCSTR; -pub const X509_CERT: ::LPCSTR = 1 as ::LPCSTR; -pub const X509_CERT_TO_BE_SIGNED: ::LPCSTR = 2 as ::LPCSTR; -pub const X509_CERT_CRL_TO_BE_SIGNED: ::LPCSTR = 3 as ::LPCSTR; -pub const X509_CERT_REQUEST_TO_BE_SIGNED: ::LPCSTR = 4 as ::LPCSTR; -pub const X509_EXTENSIONS: ::LPCSTR = 5 as ::LPCSTR; -pub const X509_NAME_VALUE: ::LPCSTR = 6 as ::LPCSTR; -pub const X509_NAME: ::LPCSTR = 7 as ::LPCSTR; -pub const X509_PUBLIC_KEY_INFO: ::LPCSTR = 8 as ::LPCSTR; -pub const X509_AUTHORITY_KEY_ID: ::LPCSTR = 9 as ::LPCSTR; -pub const X509_KEY_ATTRIBUTES: ::LPCSTR = 10 as ::LPCSTR; -pub const X509_KEY_USAGE_RESTRICTION: ::LPCSTR = 11 as ::LPCSTR; -pub const X509_ALTERNATE_NAME: ::LPCSTR = 12 as ::LPCSTR; -pub const X509_BASIC_CONSTRAINTS: ::LPCSTR = 13 as ::LPCSTR; -pub const X509_KEY_USAGE: ::LPCSTR = 14 as ::LPCSTR; -pub const X509_BASIC_CONSTRAINTS2: ::LPCSTR = 15 as ::LPCSTR; -pub const X509_CERT_POLICIES: ::LPCSTR = 16 as ::LPCSTR; -pub const PKCS_UTC_TIME: ::LPCSTR = 17 as ::LPCSTR; -pub const PKCS_TIME_REQUEST: ::LPCSTR = 18 as ::LPCSTR; -pub const RSA_CSP_PUBLICKEYBLOB: ::LPCSTR = 19 as ::LPCSTR; -pub const X509_UNICODE_NAME: ::LPCSTR = 20 as ::LPCSTR; -pub const X509_KEYGEN_REQUEST_TO_BE_SIGNED: ::LPCSTR = 21 as ::LPCSTR; -pub const PKCS_ATTRIBUTE: ::LPCSTR = 22 as ::LPCSTR; -pub const PKCS_CONTENT_INFO_SEQUENCE_OF_ANY: ::LPCSTR = 23 as ::LPCSTR; -pub const X509_UNICODE_NAME_VALUE: ::LPCSTR = 24 as ::LPCSTR; -pub const X509_ANY_STRING: ::LPCSTR = X509_NAME_VALUE; -pub const X509_UNICODE_ANY_STRING: ::LPCSTR = X509_UNICODE_NAME_VALUE; -pub const X509_OCTET_STRING: ::LPCSTR = 25 as ::LPCSTR; -pub const X509_BITS: ::LPCSTR = 26 as ::LPCSTR; -pub const X509_INTEGER: ::LPCSTR = 27 as ::LPCSTR; -pub const X509_MULTI_BYTE_INTEGER: ::LPCSTR = 28 as ::LPCSTR; -pub const X509_ENUMERATED: ::LPCSTR = 29 as ::LPCSTR; -pub const X509_CHOICE_OF_TIME: ::LPCSTR = 30 as ::LPCSTR; -pub const X509_AUTHORITY_KEY_ID2: ::LPCSTR = 31 as ::LPCSTR; -pub const X509_AUTHORITY_INFO_ACCESS: ::LPCSTR = 32 as ::LPCSTR; -pub const X509_SUBJECT_INFO_ACCESS: ::LPCSTR = X509_AUTHORITY_INFO_ACCESS; -pub const X509_CRL_REASON_CODE: ::LPCSTR = X509_ENUMERATED; -pub const PKCS_CONTENT_INFO: ::LPCSTR = 33 as ::LPCSTR; -pub const X509_SEQUENCE_OF_ANY: ::LPCSTR = 34 as ::LPCSTR; -pub const X509_CRL_DIST_POINTS: ::LPCSTR = 35 as ::LPCSTR; -pub const X509_ENHANCED_KEY_USAGE: ::LPCSTR = 36 as ::LPCSTR; -pub const PKCS_CTL: ::LPCSTR = 37 as ::LPCSTR; -pub const X509_MULTI_BYTE_UINT: ::LPCSTR = 38 as ::LPCSTR; -pub const X509_DSS_PUBLICKEY: ::LPCSTR = X509_MULTI_BYTE_UINT; -pub const X509_DSS_PARAMETERS: ::LPCSTR = 39 as ::LPCSTR; -pub const X509_DSS_SIGNATURE: ::LPCSTR = 40 as ::LPCSTR; -pub const PKCS_RC2_CBC_PARAMETERS: ::LPCSTR = 41 as ::LPCSTR; -pub const PKCS_SMIME_CAPABILITIES: ::LPCSTR = 42 as ::LPCSTR; -pub const X509_QC_STATEMENTS_EXT: ::LPCSTR = 42 as ::LPCSTR; -pub const PKCS_RSA_PRIVATE_KEY: ::LPCSTR = 43 as ::LPCSTR; -pub const PKCS_PRIVATE_KEY_INFO: ::LPCSTR = 44 as ::LPCSTR; -pub const PKCS_ENCRYPTED_PRIVATE_KEY_INFO: ::LPCSTR = 45 as ::LPCSTR; -pub const X509_PKIX_POLICY_QUALIFIER_USERNOTICE: ::LPCSTR = 46 as ::LPCSTR; -pub const X509_DH_PUBLICKEY: ::LPCSTR = X509_MULTI_BYTE_UINT; -pub const X509_DH_PARAMETERS: ::LPCSTR = 47 as ::LPCSTR; -pub const PKCS_ATTRIBUTES: ::LPCSTR = 48 as ::LPCSTR; -pub const PKCS_SORTED_CTL: ::LPCSTR = 49 as ::LPCSTR; -pub const X509_ECC_SIGNATURE: ::LPCSTR = 47 as ::LPCSTR; -pub const X942_DH_PARAMETERS: ::LPCSTR = 50 as ::LPCSTR; -pub const X509_BITS_WITHOUT_TRAILING_ZEROES: ::LPCSTR = 51 as ::LPCSTR; -pub const X942_OTHER_INFO: ::LPCSTR = 52 as ::LPCSTR; -pub const X509_CERT_PAIR: ::LPCSTR = 53 as ::LPCSTR; -pub const X509_ISSUING_DIST_POINT: ::LPCSTR = 54 as ::LPCSTR; -pub const X509_NAME_CONSTRAINTS: ::LPCSTR = 55 as ::LPCSTR; -pub const X509_POLICY_MAPPINGS: ::LPCSTR = 56 as ::LPCSTR; -pub const X509_POLICY_CONSTRAINTS: ::LPCSTR = 57 as ::LPCSTR; -pub const X509_CROSS_CERT_DIST_POINTS: ::LPCSTR = 58 as ::LPCSTR; -pub const CMC_DATA: ::LPCSTR = 59 as ::LPCSTR; -pub const CMC_RESPONSE: ::LPCSTR = 60 as ::LPCSTR; -pub const CMC_STATUS: ::LPCSTR = 61 as ::LPCSTR; -pub const CMC_ADD_EXTENSIONS: ::LPCSTR = 62 as ::LPCSTR; -pub const CMC_ADD_ATTRIBUTES: ::LPCSTR = 63 as ::LPCSTR; -pub const X509_CERTIFICATE_TEMPLATE: ::LPCSTR = 64 as ::LPCSTR; -pub const OCSP_SIGNED_REQUEST: ::LPCSTR = 65 as ::LPCSTR; -pub const OCSP_REQUEST: ::LPCSTR = 66 as ::LPCSTR; -pub const OCSP_RESPONSE: ::LPCSTR = 67 as ::LPCSTR; -pub const OCSP_BASIC_SIGNED_RESPONSE: ::LPCSTR = 68 as ::LPCSTR; -pub const OCSP_BASIC_RESPONSE: ::LPCSTR = 69 as ::LPCSTR; -pub const X509_LOGOTYPE_EXT: ::LPCSTR = 70 as ::LPCSTR; -pub const X509_BIOMETRIC_EXT: ::LPCSTR = 71 as ::LPCSTR; -pub const CNG_RSA_PUBLIC_KEY_BLOB: ::LPCSTR = 72 as ::LPCSTR; -pub const X509_OBJECT_IDENTIFIER: ::LPCSTR = 73 as ::LPCSTR; -pub const X509_ALGORITHM_IDENTIFIER: ::LPCSTR = 74 as ::LPCSTR; -pub const PKCS_RSA_SSA_PSS_PARAMETERS: ::LPCSTR = 75 as ::LPCSTR; -pub const PKCS_RSAES_OAEP_PARAMETERS: ::LPCSTR = 76 as ::LPCSTR; -pub const ECC_CMS_SHARED_INFO: ::LPCSTR = 77 as ::LPCSTR; -pub const TIMESTAMP_REQUEST: ::LPCSTR = 78 as ::LPCSTR; -pub const TIMESTAMP_RESPONSE: ::LPCSTR = 79 as ::LPCSTR; -pub const TIMESTAMP_INFO: ::LPCSTR = 80 as ::LPCSTR; -pub const X509_CERT_BUNDLE: ::LPCSTR = 81 as ::LPCSTR; -pub const X509_ECC_PRIVATE_KEY: ::LPCSTR = 82 as ::LPCSTR; -pub const CNG_RSA_PRIVATE_KEY_BLOB: ::LPCSTR = 83 as ::LPCSTR; -pub const X509_SUBJECT_DIR_ATTRS: ::LPCSTR = 84 as ::LPCSTR; -pub const PKCS7_SIGNER_INFO: ::LPCSTR = 500 as ::LPCSTR; -pub const CMS_SIGNER_INFO: ::LPCSTR = 501 as ::LPCSTR; -pub const szOID_AUTHORITY_KEY_IDENTIFIER: &'static str = "2.5.29.1"; -pub const szOID_KEY_ATTRIBUTES: &'static str = "2.5.29.2"; -pub const szOID_CERT_POLICIES_95: &'static str = "2.5.29.3"; -pub const szOID_KEY_USAGE_RESTRICTION: &'static str = "2.5.29.4"; -pub const szOID_SUBJECT_ALT_NAME: &'static str = "2.5.29.7"; -pub const szOID_ISSUER_ALT_NAME: &'static str = "2.5.29.8"; -pub const szOID_BASIC_CONSTRAINTS: &'static str = "2.5.29.10"; -pub const szOID_KEY_USAGE: &'static str = "2.5.29.15"; -pub const szOID_PRIVATEKEY_USAGE_PERIOD: &'static str = "2.5.29.16"; -pub const szOID_BASIC_CONSTRAINTS2: &'static str = "2.5.29.19"; -pub const szOID_CERT_POLICIES: &'static str = "2.5.29.32"; -pub const szOID_ANY_CERT_POLICY: &'static str = "2.5.29.32.0"; -pub const szOID_INHIBIT_ANY_POLICY: &'static str = "2.5.29.54"; -pub const szOID_AUTHORITY_KEY_IDENTIFIER2: &'static str = "2.5.29.35"; -pub const szOID_SUBJECT_KEY_IDENTIFIER: &'static str = "2.5.29.14"; -pub const szOID_SUBJECT_ALT_NAME2: &'static str = "2.5.29.17"; -pub const szOID_ISSUER_ALT_NAME2: &'static str = "2.5.29.18"; -pub const szOID_CRL_REASON_CODE: &'static str = "2.5.29.21"; -pub const szOID_REASON_CODE_HOLD: &'static str = "2.5.29.23"; -pub const szOID_CRL_DIST_POINTS: &'static str = "2.5.29.31"; -pub const szOID_ENHANCED_KEY_USAGE: &'static str = "2.5.29.37"; -pub const szOID_ANY_ENHANCED_KEY_USAGE: &'static str = "2.5.29.37.0"; -pub const szOID_CRL_NUMBER: &'static str = "2.5.29.20"; -pub const szOID_DELTA_CRL_INDICATOR: &'static str = "2.5.29.27"; -pub const szOID_ISSUING_DIST_POINT: &'static str = "2.5.29.28"; -pub const szOID_FRESHEST_CRL: &'static str = "2.5.29.46"; -pub const szOID_NAME_CONSTRAINTS: &'static str = "2.5.29.30"; -pub const szOID_POLICY_MAPPINGS: &'static str = "2.5.29.33"; -pub const szOID_LEGACY_POLICY_MAPPINGS: &'static str = "2.5.29.5"; -pub const szOID_POLICY_CONSTRAINTS: &'static str = "2.5.29.36"; -pub const szOID_RENEWAL_CERTIFICATE: &'static str = "1.3.6.1.4.1.311.13.1"; -pub const szOID_ENROLLMENT_NAME_VALUE_PAIR: &'static str = "1.3.6.1.4.1.311.13.2.1"; -pub const szOID_ENROLLMENT_CSP_PROVIDER: &'static str = "1.3.6.1.4.1.311.13.2.2"; -pub const szOID_OS_VERSION: &'static str = "1.3.6.1.4.1.311.13.2.3"; -pub const szOID_ENROLLMENT_AGENT: &'static str = "1.3.6.1.4.1.311.20.2.1"; -pub const szOID_PKIX: &'static str = "1.3.6.1.5.5.7"; -pub const szOID_PKIX_PE: &'static str = "1.3.6.1.5.5.7.1"; -pub const szOID_AUTHORITY_INFO_ACCESS: &'static str = "1.3.6.1.5.5.7.1.1"; -pub const szOID_SUBJECT_INFO_ACCESS: &'static str = "1.3.6.1.5.5.7.1.11"; -pub const szOID_BIOMETRIC_EXT: &'static str = "1.3.6.1.5.5.7.1.2"; -pub const szOID_QC_STATEMENTS_EXT: &'static str = "1.3.6.1.5.5.7.1.3"; -pub const szOID_LOGOTYPE_EXT: &'static str = "1.3.6.1.5.5.7.1.12"; -pub const szOID_CERT_EXTENSIONS: &'static str = "1.3.6.1.4.1.311.2.1.14"; -pub const szOID_NEXT_UPDATE_LOCATION: &'static str = "1.3.6.1.4.1.311.10.2"; -pub const szOID_REMOVE_CERTIFICATE: &'static str = "1.3.6.1.4.1.311.10.8.1"; -pub const szOID_CROSS_CERT_DIST_POINTS: &'static str = "1.3.6.1.4.1.311.10.9.1"; -pub const szOID_CTL: &'static str = "1.3.6.1.4.1.311.10.1"; -pub const szOID_SORTED_CTL: &'static str = "1.3.6.1.4.1.311.10.1.1"; -pub const szOID_SERIALIZED: &'static str = "1.3.6.1.4.1.311.10.3.3.1"; -pub const szOID_NT_PRINCIPAL_NAME: &'static str = "1.3.6.1.4.1.311.20.2.3"; -pub const szOID_INTERNATIONALIZED_EMAIL_ADDRESS: &'static str = "1.3.6.1.4.1.311.20.2.4"; -pub const szOID_PRODUCT_UPDATE: &'static str = "1.3.6.1.4.1.311.31.1"; -pub const szOID_ANY_APPLICATION_POLICY: &'static str = "1.3.6.1.4.1.311.10.12.1"; -pub const szOID_AUTO_ENROLL_CTL_USAGE: &'static str = "1.3.6.1.4.1.311.20.1"; -pub const szOID_ENROLL_CERTTYPE_EXTENSION: &'static str = "1.3.6.1.4.1.311.20.2"; -pub const szOID_CERT_MANIFOLD: &'static str = "1.3.6.1.4.1.311.20.3"; -pub const szOID_CERTSRV_CA_VERSION: &'static str = "1.3.6.1.4.1.311.21.1"; -pub const szOID_CERTSRV_PREVIOUS_CERT_HASH: &'static str = "1.3.6.1.4.1.311.21.2"; -pub const szOID_CRL_VIRTUAL_BASE: &'static str = "1.3.6.1.4.1.311.21.3"; -pub const szOID_CRL_NEXT_PUBLISH: &'static str = "1.3.6.1.4.1.311.21.4"; -pub const szOID_KP_CA_EXCHANGE: &'static str = "1.3.6.1.4.1.311.21.5"; -pub const szOID_KP_KEY_RECOVERY_AGENT: &'static str = "1.3.6.1.4.1.311.21.6"; -pub const szOID_CERTIFICATE_TEMPLATE: &'static str = "1.3.6.1.4.1.311.21.7"; -pub const szOID_ENTERPRISE_OID_ROOT: &'static str = "1.3.6.1.4.1.311.21.8"; -pub const szOID_RDN_DUMMY_SIGNER: &'static str = "1.3.6.1.4.1.311.21.9"; -pub const szOID_APPLICATION_CERT_POLICIES: &'static str = "1.3.6.1.4.1.311.21.10"; -pub const szOID_APPLICATION_POLICY_MAPPINGS: &'static str = "1.3.6.1.4.1.311.21.11"; -pub const szOID_APPLICATION_POLICY_CONSTRAINTS: &'static str = "1.3.6.1.4.1.311.21.12"; -pub const szOID_ARCHIVED_KEY_ATTR: &'static str = "1.3.6.1.4.1.311.21.13"; -pub const szOID_CRL_SELF_CDP: &'static str = "1.3.6.1.4.1.311.21.14"; -pub const szOID_REQUIRE_CERT_CHAIN_POLICY: &'static str = "1.3.6.1.4.1.311.21.15"; -pub const szOID_ARCHIVED_KEY_CERT_HASH: &'static str = "1.3.6.1.4.1.311.21.16"; -pub const szOID_ISSUED_CERT_HASH: &'static str = "1.3.6.1.4.1.311.21.17"; -pub const szOID_DS_EMAIL_REPLICATION: &'static str = "1.3.6.1.4.1.311.21.19"; -pub const szOID_REQUEST_CLIENT_INFO: &'static str = "1.3.6.1.4.1.311.21.20"; -pub const szOID_ENCRYPTED_KEY_HASH: &'static str = "1.3.6.1.4.1.311.21.21"; -pub const szOID_CERTSRV_CROSSCA_VERSION: &'static str = "1.3.6.1.4.1.311.21.22"; -pub const szOID_NTDS_REPLICATION: &'static str = "1.3.6.1.4.1.311.25.1"; -pub const szOID_SUBJECT_DIR_ATTRS: &'static str = "2.5.29.9"; -pub const szOID_PKIX_KP: &'static str = "1.3.6.1.5.5.7.3"; -pub const szOID_PKIX_KP_SERVER_AUTH: &'static str = "1.3.6.1.5.5.7.3.1"; -pub const szOID_PKIX_KP_CLIENT_AUTH: &'static str = "1.3.6.1.5.5.7.3.2"; -pub const szOID_PKIX_KP_CODE_SIGNING: &'static str = "1.3.6.1.5.5.7.3.3"; -pub const szOID_PKIX_KP_EMAIL_PROTECTION: &'static str = "1.3.6.1.5.5.7.3.4"; -pub const szOID_PKIX_KP_IPSEC_END_SYSTEM: &'static str = "1.3.6.1.5.5.7.3.5"; -pub const szOID_PKIX_KP_IPSEC_TUNNEL: &'static str = "1.3.6.1.5.5.7.3.6"; -pub const szOID_PKIX_KP_IPSEC_USER: &'static str = "1.3.6.1.5.5.7.3.7"; -pub const szOID_PKIX_KP_TIMESTAMP_SIGNING: &'static str = "1.3.6.1.5.5.7.3.8"; -pub const szOID_PKIX_KP_OCSP_SIGNING: &'static str = "1.3.6.1.5.5.7.3.9"; -pub const szOID_PKIX_OCSP_NOCHECK: &'static str = "1.3.6.1.5.5.7.48.1.5"; -pub const szOID_PKIX_OCSP_NONCE: &'static str = "1.3.6.1.5.5.7.48.1.2"; -pub const szOID_IPSEC_KP_IKE_INTERMEDIATE: &'static str = "1.3.6.1.5.5.8.2.2"; -pub const szOID_PKINIT_KP_KDC: &'static str = "1.3.6.1.5.2.3.5"; -pub const szOID_KP_CTL_USAGE_SIGNING: &'static str = "1.3.6.1.4.1.311.10.3.1"; -pub const szOID_KP_TIME_STAMP_SIGNING: &'static str = "1.3.6.1.4.1.311.10.3.2"; -pub const szOID_SERVER_GATED_CRYPTO: &'static str = "1.3.6.1.4.1.311.10.3.3"; -pub const szOID_SGC_NETSCAPE: &'static str = "2.16.840.1.113730.4.1"; -pub const szOID_KP_EFS: &'static str = "1.3.6.1.4.1.311.10.3.4"; -pub const szOID_EFS_RECOVERY: &'static str = "1.3.6.1.4.1.311.10.3.4.1"; -pub const szOID_WHQL_CRYPTO: &'static str = "1.3.6.1.4.1.311.10.3.5"; -pub const szOID_NT5_CRYPTO: &'static str = "1.3.6.1.4.1.311.10.3.6"; -pub const szOID_OEM_WHQL_CRYPTO: &'static str = "1.3.6.1.4.1.311.10.3.7"; -pub const szOID_EMBEDDED_NT_CRYPTO: &'static str = "1.3.6.1.4.1.311.10.3.8"; -pub const szOID_ROOT_LIST_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.9"; -pub const szOID_KP_QUALIFIED_SUBORDINATION: &'static str = "1.3.6.1.4.1.311.10.3.10"; -pub const szOID_KP_KEY_RECOVERY: &'static str = "1.3.6.1.4.1.311.10.3.11"; -pub const szOID_KP_DOCUMENT_SIGNING: &'static str = "1.3.6.1.4.1.311.10.3.12"; -pub const szOID_KP_LIFETIME_SIGNING: &'static str = "1.3.6.1.4.1.311.10.3.13"; -pub const szOID_KP_MOBILE_DEVICE_SOFTWARE: &'static str = "1.3.6.1.4.1.311.10.3.14"; -pub const szOID_KP_SMART_DISPLAY: &'static str = "1.3.6.1.4.1.311.10.3.15"; -pub const szOID_KP_CSP_SIGNATURE: &'static str = "1.3.6.1.4.1.311.10.3.16"; -pub const szOID_DRM: &'static str = "1.3.6.1.4.1.311.10.5.1"; -pub const szOID_DRM_INDIVIDUALIZATION: &'static str = "1.3.6.1.4.1.311.10.5.2"; -pub const szOID_LICENSES: &'static str = "1.3.6.1.4.1.311.10.6.1"; -pub const szOID_LICENSE_SERVER: &'static str = "1.3.6.1.4.1.311.10.6.2"; -pub const szOID_KP_SMARTCARD_LOGON: &'static str = "1.3.6.1.4.1.311.20.2.2"; -pub const szOID_KP_KERNEL_MODE_CODE_SIGNING: &'static str = "1.3.6.1.4.1.311.61.1.1"; -pub const szOID_KP_KERNEL_MODE_TRUSTED_BOOT_SIGNING: &'static str = "1.3.6.1.4.1.311.61.4.1"; -pub const szOID_REVOKED_LIST_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.19"; -pub const szOID_WINDOWS_KITS_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.20"; -pub const szOID_WINDOWS_RT_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.21"; -pub const szOID_PROTECTED_PROCESS_LIGHT_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.22"; -pub const szOID_WINDOWS_TCB_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.23"; -pub const szOID_PROTECTED_PROCESS_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.24"; -pub const szOID_WINDOWS_THIRD_PARTY_COMPONENT_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.25"; -pub const szOID_WINDOWS_SOFTWARE_EXTENSION_SIGNER: &'static str = "1.3.6.1.4.1.311.10.3.26"; -pub const szOID_DISALLOWED_LIST: &'static str = "1.3.6.1.4.1.311.10.3.30"; -pub const szOID_SYNC_ROOT_CTL_EXT: &'static str = "1.3.6.1.4.1.311.10.3.50"; -pub const szOID_KP_KERNEL_MODE_HAL_EXTENSION_SIGNING: &'static str = "1.3.6.1.4.1.311.61.5.1"; -pub const szOID_WINDOWS_STORE_SIGNER: &'static str = "1.3.6.1.4.1.311.76.3.1"; -pub const szOID_DYNAMIC_CODE_GEN_SIGNER: &'static str = "1.3.6.1.4.1.311.76.5.1"; -pub const szOID_MICROSOFT_PUBLISHER_SIGNER: &'static str = "1.3.6.1.4.1.311.76.8.1"; -pub const szOID_YESNO_TRUST_ATTR: &'static str = "1.3.6.1.4.1.311.10.4.1"; -pub const szOID_PKIX_POLICY_QUALIFIER_CPS: &'static str = "1.3.6.1.5.5.7.2.1"; -pub const szOID_PKIX_POLICY_QUALIFIER_USERNOTICE: &'static str = "1.3.6.1.5.5.7.2.2"; -pub const szOID_ROOT_PROGRAM_FLAGS: &'static str = "1.3.6.1.4.1.311.60.1.1"; -//6992 -pub type HCRYPTMSG = *mut ::c_void; -//9353 -pub type HCERTSTORE = *mut ::c_void; -STRUCT!{struct CERT_CONTEXT { - dwCertEncodingType: ::DWORD, - pbCertEncoded: *mut ::BYTE, - cbCertEncoded: ::DWORD, - pCertInfo: ::PCERT_INFO, - hCertStore: HCERTSTORE, -}} -pub type PCERT_CONTEXT = *mut CERT_CONTEXT; -pub type PCCERT_CONTEXT = *const CERT_CONTEXT; -STRUCT!{struct CRL_CONTEXT { - dwCertEncodingType: ::DWORD, - pbCrlEncoded: *mut ::BYTE, - cbCrlEncoded: ::DWORD, - pCrlInfo: ::PCRL_INFO, - hCertStore: HCERTSTORE, -}} -pub type PCRL_CONTEXT = *mut CRL_CONTEXT; -pub type PCCRL_CONTEXT = *const CRL_CONTEXT; -STRUCT!{struct CTL_CONTEXT { - dwMsgAndCertEncodingType: ::DWORD, - pbCtlEncoded: *mut ::BYTE, - cbCtlEncoded: ::DWORD, - pCtlInfo: ::PCTL_INFO, - hCertStore: HCERTSTORE, - hCryptMsg: HCRYPTMSG, - pbCtlContent: *mut ::BYTE, - cbCtlContent: ::DWORD, -}} -pub type PCTL_CONTEXT = *mut CTL_CONTEXT; -pub type PCCTL_CONTEXT = *const CTL_CONTEXT; -pub const CERT_STORE_PROV_MSG: ::DWORD = 1; -pub const CERT_STORE_PROV_MEMORY: ::DWORD = 2; -pub const CERT_STORE_PROV_FILE: ::DWORD = 3; -pub const CERT_STORE_PROV_REG: ::DWORD = 4; -pub const CERT_STORE_PROV_PKCS7: ::DWORD = 5; -pub const CERT_STORE_PROV_SERIALIZED: ::DWORD = 6; -pub const CERT_STORE_PROV_FILENAME_A: ::DWORD = 7; -pub const CERT_STORE_PROV_FILENAME_W: ::DWORD = 8; -pub const CERT_STORE_PROV_FILENAME: ::DWORD = CERT_STORE_PROV_FILENAME_W; -pub const CERT_STORE_PROV_SYSTEM_A: ::DWORD = 9; -pub const CERT_STORE_PROV_SYSTEM_W: ::DWORD = 10; -pub const CERT_STORE_PROV_SYSTEM: ::DWORD = CERT_STORE_PROV_SYSTEM_W; -pub const CERT_STORE_PROV_COLLECTION: ::DWORD = 11; -pub const CERT_STORE_PROV_SYSTEM_REGISTRY_A: ::DWORD = 12; -pub const CERT_STORE_PROV_SYSTEM_REGISTRY_W: ::DWORD = 13; -pub const CERT_STORE_PROV_SYSTEM_REGISTRY: ::DWORD = CERT_STORE_PROV_SYSTEM_REGISTRY_W; -pub const CERT_STORE_PROV_PHYSICAL_W: ::DWORD = 14; -pub const CERT_STORE_PROV_PHYSICAL: ::DWORD = CERT_STORE_PROV_PHYSICAL_W; -pub const CERT_STORE_PROV_SMART_CARD_W: ::DWORD = 15; -pub const CERT_STORE_PROV_SMART_CARD: ::DWORD = CERT_STORE_PROV_SMART_CARD_W; -pub const CERT_STORE_PROV_LDAP_W: ::DWORD = 16; -pub const CERT_STORE_PROV_LDAP: ::DWORD = CERT_STORE_PROV_LDAP_W; -pub const CERT_STORE_NO_CRYPT_RELEASE_FLAG: ::DWORD = 0x00000001; -pub const CERT_STORE_SET_LOCALIZED_NAME_FLAG: ::DWORD = 0x00000002; -pub const CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG: ::DWORD = 0x00000004; -pub const CERT_STORE_DELETE_FLAG: ::DWORD = 0x00000010; -pub const CERT_STORE_SHARE_STORE_FLAG: ::DWORD = 0x00000040; -pub const CERT_STORE_SHARE_CONTEXT_FLAG: ::DWORD = 0x00000080; -pub const CERT_STORE_MANIFOLD_FLAG: ::DWORD = 0x00000100; -pub const CERT_STORE_ENUM_ARCHIVED_FLAG: ::DWORD = 0x00000200; -pub const CERT_STORE_UPDATE_KEYID_FLAG: ::DWORD = 0x00000400; -pub const CERT_STORE_BACKUP_RESTORE_FLAG: ::DWORD = 0x00000800; -pub const CERT_STORE_READONLY_FLAG: ::DWORD = 0x00008000; -pub const CERT_STORE_OPEN_EXISTING_FLAG: ::DWORD = 0x00004000; -pub const CERT_STORE_CREATE_NEW_FLAG: ::DWORD = 0x00002000; -pub const CERT_STORE_MAXIMUM_ALLOWED_FLAG: ::DWORD = 0x00001000; -pub const CERT_SYSTEM_STORE_UNPROTECTED_FLAG: ::DWORD = 0x40000000; -pub const CERT_SYSTEM_STORE_LOCATION_MASK: ::DWORD = 0x00FF0000; -pub const CERT_SYSTEM_STORE_LOCATION_SHIFT: ::DWORD = 16; -pub const CERT_SYSTEM_STORE_CURRENT_USER_ID: ::DWORD = 1; -pub const CERT_SYSTEM_STORE_LOCAL_MACHINE_ID: ::DWORD = 2; -pub const CERT_SYSTEM_STORE_CURRENT_SERVICE_ID: ::DWORD = 4; -pub const CERT_SYSTEM_STORE_SERVICES_ID: ::DWORD = 5; -pub const CERT_SYSTEM_STORE_USERS_ID: ::DWORD = 6; -pub const CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID: ::DWORD = 7; -pub const CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID: ::DWORD = 8; -pub const CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID: ::DWORD = 9; -pub const CERT_SYSTEM_STORE_CURRENT_USER: ::DWORD = CERT_SYSTEM_STORE_CURRENT_USER_ID - << CERT_SYSTEM_STORE_LOCATION_SHIFT; -pub const CERT_SYSTEM_STORE_LOCAL_MACHINE: ::DWORD = CERT_SYSTEM_STORE_LOCAL_MACHINE_ID - << CERT_SYSTEM_STORE_LOCATION_SHIFT; -pub const CERT_SYSTEM_STORE_CURRENT_SERVICE: ::DWORD = CERT_SYSTEM_STORE_CURRENT_SERVICE_ID - << CERT_SYSTEM_STORE_LOCATION_SHIFT; -pub const CERT_SYSTEM_STORE_SERVICES: ::DWORD = CERT_SYSTEM_STORE_SERVICES_ID - << CERT_SYSTEM_STORE_LOCATION_SHIFT; -pub const CERT_SYSTEM_STORE_USERS: ::DWORD = CERT_SYSTEM_STORE_USERS_ID - << CERT_SYSTEM_STORE_LOCATION_SHIFT; -pub const CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY: ::DWORD = - CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT; -pub const CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY: ::DWORD = - CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT; -pub const CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE: ::DWORD = - CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT; -pub const CERT_NAME_EMAIL_TYPE: ::DWORD = 1; -pub const CERT_NAME_RDN_TYPE: ::DWORD = 2; -pub const CERT_NAME_ATTR_TYPE: ::DWORD = 3; -pub const CERT_NAME_SIMPLE_DISPLAY_TYPE: ::DWORD = 4; -pub const CERT_NAME_FRIENDLY_DISPLAY_TYPE: ::DWORD = 5; -pub const CERT_NAME_DNS_TYPE: ::DWORD = 6; -pub const CERT_NAME_URL_TYPE: ::DWORD = 7; -pub const CERT_NAME_UPN_TYPE: ::DWORD = 8; -pub const CERT_SIMPLE_NAME_STR: ::DWORD = 1; -pub const CERT_OID_NAME_STR: ::DWORD = 2; -pub const CERT_X500_NAME_STR: ::DWORD = 3; - -pub const CERT_NAME_STR_SEMICOLON_FLAG: ::DWORD = 0x40000000; -pub const CERT_NAME_STR_NO_PLUS_FLAG: ::DWORD = 0x20000000; -pub const CERT_NAME_STR_NO_QUOTING_FLAG: ::DWORD = 0x10000000; -pub const CERT_NAME_STR_CRLF_FLAG: ::DWORD = 0x08000000; -pub const CERT_NAME_STR_COMMA_FLAG: ::DWORD = 0x04000000; -pub const CERT_NAME_STR_REVERSE_FLAG: ::DWORD = 0x02000000; - -pub const CERT_NAME_ISSUER_FLAG: ::DWORD = 0x1; -pub const CERT_NAME_STR_DISABLE_IE4_UTF8_FLAG: ::DWORD = 0x00010000; -pub const CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG: ::DWORD = 0x00020000; -pub const CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG: ::DWORD = 0x00040000; -pub const CERT_NAME_STR_FORCE_UTF8_DIR_STR_FLAG: ::DWORD = 0x00080000; -pub const CERT_DELETE_KEYSET_PROP_ID: ::DWORD = 101; -pub const CERT_COMPARE_MASK: ::DWORD = 0xFFFF; -pub const CERT_COMPARE_SHIFT: ::DWORD = 16; -pub const CERT_COMPARE_ANY: ::DWORD = 0; -pub const CERT_COMPARE_SHA1_HASH: ::DWORD = 1; -pub const CERT_COMPARE_NAME: ::DWORD = 2; -pub const CERT_COMPARE_ATTR: ::DWORD = 3; -pub const CERT_COMPARE_MD5_HASH: ::DWORD = 4; -pub const CERT_COMPARE_PROPERTY: ::DWORD = 5; -pub const CERT_COMPARE_PUBLIC_KEY: ::DWORD = 6; -pub const CERT_COMPARE_HASH: ::DWORD = CERT_COMPARE_SHA1_HASH; -pub const CERT_COMPARE_NAME_STR_A: ::DWORD = 7; -pub const CERT_COMPARE_NAME_STR_W: ::DWORD = 8; -pub const CERT_COMPARE_KEY_SPEC: ::DWORD = 9; -pub const CERT_COMPARE_ENHKEY_USAGE: ::DWORD = 10; -pub const CERT_COMPARE_CTL_USAGE: ::DWORD = CERT_COMPARE_ENHKEY_USAGE; -pub const CERT_COMPARE_SUBJECT_CERT: ::DWORD = 11; -pub const CERT_COMPARE_ISSUER_OF: ::DWORD = 12; -pub const CERT_COMPARE_EXISTING: ::DWORD = 13; -pub const CERT_COMPARE_SIGNATURE_HASH: ::DWORD = 14; -pub const CERT_COMPARE_KEY_IDENTIFIER: ::DWORD = 15; -pub const CERT_COMPARE_CERT_ID: ::DWORD = 16; -pub const CERT_COMPARE_CROSS_CERT_DIST_POINTS: ::DWORD = 17; -pub const CERT_COMPARE_PUBKEY_MD5_HASH: ::DWORD = 18; -pub const CERT_FIND_ANY: ::DWORD = CERT_COMPARE_ANY << CERT_COMPARE_SHIFT; -pub const CERT_FIND_SHA1_HASH: ::DWORD = CERT_COMPARE_SHA1_HASH << CERT_COMPARE_SHIFT; -pub const CERT_FIND_MD5_HASH: ::DWORD = CERT_COMPARE_MD5_HASH << CERT_COMPARE_SHIFT; -pub const CERT_FIND_SIGNATURE_HASH: ::DWORD = CERT_COMPARE_SIGNATURE_HASH << CERT_COMPARE_SHIFT; -pub const CERT_FIND_KEY_IDENTIFIER: ::DWORD = CERT_COMPARE_KEY_IDENTIFIER << CERT_COMPARE_SHIFT; -pub const CERT_FIND_HASH: ::DWORD = CERT_FIND_SHA1_HASH; -pub const CERT_FIND_PROPERTY: ::DWORD = CERT_COMPARE_PROPERTY << CERT_COMPARE_SHIFT; -pub const CERT_FIND_PUBLIC_KEY: ::DWORD = CERT_COMPARE_PUBLIC_KEY << CERT_COMPARE_SHIFT; -pub const CERT_FIND_SUBJECT_NAME: ::DWORD = (CERT_COMPARE_NAME << CERT_COMPARE_SHIFT) - | CERT_INFO_SUBJECT_FLAG; -pub const CERT_FIND_SUBJECT_ATTR: ::DWORD = (CERT_COMPARE_ATTR << CERT_COMPARE_SHIFT) - | CERT_INFO_SUBJECT_FLAG; -pub const CERT_FIND_ISSUER_NAME: ::DWORD = (CERT_COMPARE_NAME << CERT_COMPARE_SHIFT) - | CERT_INFO_ISSUER_FLAG; -pub const CERT_FIND_ISSUER_ATTR: ::DWORD = (CERT_COMPARE_ATTR << CERT_COMPARE_SHIFT) - | CERT_INFO_ISSUER_FLAG; -pub const CERT_FIND_SUBJECT_STR_A: ::DWORD = (CERT_COMPARE_NAME_STR_A << CERT_COMPARE_SHIFT) - | CERT_INFO_SUBJECT_FLAG; -pub const CERT_FIND_SUBJECT_STR_W: ::DWORD = (CERT_COMPARE_NAME_STR_W << CERT_COMPARE_SHIFT) - | CERT_INFO_SUBJECT_FLAG; -pub const CERT_FIND_SUBJECT_STR: ::DWORD = CERT_FIND_SUBJECT_STR_W; -pub const CERT_FIND_ISSUER_STR_A: ::DWORD = (CERT_COMPARE_NAME_STR_A << CERT_COMPARE_SHIFT) - | CERT_INFO_ISSUER_FLAG; -pub const CERT_FIND_ISSUER_STR_W: ::DWORD = (CERT_COMPARE_NAME_STR_W << CERT_COMPARE_SHIFT) - | CERT_INFO_ISSUER_FLAG; -pub const CERT_FIND_ISSUER_STR: ::DWORD = CERT_FIND_ISSUER_STR_W; -pub const CERT_FIND_KEY_SPEC: ::DWORD = CERT_COMPARE_KEY_SPEC << CERT_COMPARE_SHIFT; -pub const CERT_FIND_ENHKEY_USAGE: ::DWORD = CERT_COMPARE_ENHKEY_USAGE << CERT_COMPARE_SHIFT; -pub const CERT_FIND_CTL_USAGE: ::DWORD = CERT_FIND_ENHKEY_USAGE; -pub const CERT_FIND_SUBJECT_CERT: ::DWORD = CERT_COMPARE_SUBJECT_CERT << CERT_COMPARE_SHIFT; -pub const CERT_FIND_ISSUER_OF: ::DWORD = CERT_COMPARE_ISSUER_OF << CERT_COMPARE_SHIFT; -pub const CERT_FIND_EXISTING: ::DWORD = CERT_COMPARE_EXISTING << CERT_COMPARE_SHIFT; -pub const CERT_FIND_CERT_ID: ::DWORD = CERT_COMPARE_CERT_ID << CERT_COMPARE_SHIFT; -pub const CERT_FIND_CROSS_CERT_DIST_POINTS: ::DWORD = CERT_COMPARE_CROSS_CERT_DIST_POINTS - << CERT_COMPARE_SHIFT; -pub const CERT_FIND_PUBKEY_MD5_HASH: ::DWORD = CERT_COMPARE_PUBKEY_MD5_HASH << CERT_COMPARE_SHIFT; -pub const CERT_ENCIPHER_ONLY_KEY_USAGE: ::DWORD = 0x0001; -pub const CERT_CRL_SIGN_KEY_USAGE: ::DWORD = 0x0002; -pub const CERT_KEY_CERT_SIGN_KEY_USAGE: ::DWORD = 0x0004; -pub const CERT_KEY_AGREEMENT_KEY_USAGE: ::DWORD = 0x0008; -pub const CERT_DATA_ENCIPHERMENT_KEY_USAGE: ::DWORD = 0x0010; -pub const CERT_KEY_ENCIPHERMENT_KEY_USAGE: ::DWORD = 0x0020; -pub const CERT_NON_REPUDIATION_KEY_USAGE: ::DWORD = 0x0040; -pub const CERT_DIGITAL_SIGNATURE_KEY_USAGE: ::DWORD = 0x0080; -pub const CERT_DECIPHER_ONLY_KEY_USAGE: ::DWORD = 0x8000; -pub const CERT_STORE_ADD_NEW: ::DWORD = 1; -pub const CERT_STORE_ADD_USE_EXISTING: ::DWORD = 2; -pub const CERT_STORE_ADD_REPLACE_EXISTING: ::DWORD = 3; -pub const CERT_STORE_ADD_ALWAYS: ::DWORD = 4; -pub const CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES: ::DWORD = 5; -pub const CERT_STORE_ADD_NEWER: ::DWORD = 6; -pub const CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES: ::DWORD = 7; -pub const CERT_STORE_SAVE_AS_STORE: ::DWORD = 1; -pub const CERT_STORE_SAVE_AS_PKCS7: ::DWORD = 2; -pub const CERT_STORE_SAVE_TO_FILE: ::DWORD = 1; -pub const CERT_STORE_SAVE_TO_MEMORY: ::DWORD = 2; -pub const CERT_STORE_SAVE_TO_FILENAME_A: ::DWORD = 3; -pub const CERT_STORE_SAVE_TO_FILENAME_W: ::DWORD = 4; -pub const CERT_STORE_SAVE_TO_FILENAME: ::DWORD = CERT_STORE_SAVE_TO_FILENAME_W; -pub const CERT_CA_SUBJECT_FLAG: ::DWORD = 0x80; -pub const CERT_END_ENTITY_SUBJECT_FLAG: ::DWORD = 0x40; -pub const CERT_CHAIN_POLICY_BASE: ::DWORD = 1; -pub const CERT_CHAIN_POLICY_AUTHENTICODE: ::DWORD = 2; -pub const CERT_CHAIN_POLICY_AUTHENTICODE_TS: ::DWORD = 3; -pub const CERT_CHAIN_POLICY_SSL: ::DWORD = 4; -pub const CERT_CHAIN_POLICY_BASIC_CONSTRAINTS: ::DWORD = 5; -pub const CERT_CHAIN_POLICY_NT_AUTH: ::DWORD = 6; -pub const CERT_CHAIN_POLICY_MICROSOFT_ROOT: ::DWORD = 7; -pub const CERT_CHAIN_REVOCATION_CHECK_END_CERT: ::DWORD = 0x10000000; -pub const CERT_CHAIN_REVOCATION_CHECK_CHAIN: ::DWORD = 0x20000000; -pub const CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT: ::DWORD = 0x40000000; -pub const CERT_CHAIN_REVOCATION_CHECK_CACHE_ONLY: ::DWORD = 0x80000000; -pub const CERT_CHAIN_REVOCATION_ACCUMULATIVE_TIMEOUT: ::DWORD = 0x08000000; -pub const CERT_TRUST_NO_ERROR: ::DWORD = 0x00000000; -pub const CERT_TRUST_IS_NOT_TIME_VALID: ::DWORD = 0x00000001; -pub const CERT_TRUST_IS_NOT_TIME_NESTED: ::DWORD = 0x00000002; -pub const CERT_TRUST_IS_REVOKED: ::DWORD = 0x00000004; -pub const CERT_TRUST_IS_NOT_SIGNATURE_VALID: ::DWORD = 0x00000008; -pub const CERT_TRUST_IS_NOT_VALID_FOR_USAGE: ::DWORD = 0x00000010; -pub const CERT_TRUST_IS_UNTRUSTED_ROOT: ::DWORD = 0x00000020; -pub const CERT_TRUST_REVOCATION_STATUS_UNKNOWN: ::DWORD = 0x00000040; -pub const CERT_TRUST_IS_CYCLIC: ::DWORD = 0x00000080; - -pub const CERT_TRUST_INVALID_EXTENSION: ::DWORD = 0x00000100; -pub const CERT_TRUST_INVALID_POLICY_CONSTRAINTS: ::DWORD = 0x00000200; -pub const CERT_TRUST_INVALID_BASIC_CONSTRAINTS: ::DWORD = 0x00000400; -pub const CERT_TRUST_INVALID_NAME_CONSTRAINTS: ::DWORD = 0x00000800; -pub const CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT: ::DWORD = 0x00001000; -pub const CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT: ::DWORD = 0x00002000; -pub const CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT: ::DWORD = 0x00004000; -pub const CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT: ::DWORD = 0x00008000; - -pub const CERT_TRUST_IS_OFFLINE_REVOCATION: ::DWORD = 0x01000000; -pub const CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY: ::DWORD = 0x02000000; -pub const CERT_TRUST_IS_PARTIAL_CHAIN: ::DWORD = 0x00010000; -pub const CERT_TRUST_CTL_IS_NOT_TIME_VALID: ::DWORD = 0x00020000; -pub const CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID: ::DWORD = 0x00040000; -pub const CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE: ::DWORD = 0x00080000; -pub const CERT_CHAIN_POLICY_IGNORE_NOT_TIME_VALID_FLAG: ::DWORD = 0x00000001; -pub const CERT_CHAIN_POLICY_IGNORE_CTL_NOT_TIME_VALID_FLAG: ::DWORD = 0x00000002; -pub const CERT_CHAIN_POLICY_IGNORE_NOT_TIME_NESTED_FLAG: ::DWORD = 0x00000004; -pub const CERT_CHAIN_POLICY_IGNORE_INVALID_BASIC_CONSTRAINTS_FLAG: ::DWORD = 0x00000008; - -pub const CERT_CHAIN_POLICY_ALLOW_UNKNOWN_CA_FLAG: ::DWORD = 0x00000010; -pub const CERT_CHAIN_POLICY_IGNORE_WRONG_USAGE_FLAG: ::DWORD = 0x00000020; -pub const CERT_CHAIN_POLICY_IGNORE_INVALID_NAME_FLAG: ::DWORD = 0x00000040; -pub const CERT_CHAIN_POLICY_IGNORE_INVALID_POLICY_FLAG: ::DWORD = 0x00000080; - -pub const CERT_CHAIN_POLICY_IGNORE_END_REV_UNKNOWN_FLAG: ::DWORD = 0x00000100; -pub const CERT_CHAIN_POLICY_IGNORE_CTL_SIGNER_REV_UNKNOWN_FLAG: ::DWORD = 0x00000200; -pub const CERT_CHAIN_POLICY_IGNORE_CA_REV_UNKNOWN_FLAG: ::DWORD = 0x00000400; -pub const CERT_CHAIN_POLICY_IGNORE_ROOT_REV_UNKNOWN_FLAG: ::DWORD = 0x00000800; - -pub const CERT_CHAIN_POLICY_IGNORE_ALL_REV_UNKNOWN_FLAGS: ::DWORD = - CERT_CHAIN_POLICY_IGNORE_END_REV_UNKNOWN_FLAG | - CERT_CHAIN_POLICY_IGNORE_CTL_SIGNER_REV_UNKNOWN_FLAG | - CERT_CHAIN_POLICY_IGNORE_CA_REV_UNKNOWN_FLAG | - CERT_CHAIN_POLICY_IGNORE_ROOT_REV_UNKNOWN_FLAG; -pub const CERT_TRUST_HAS_EXACT_MATCH_ISSUER: ::DWORD = 0x00000001; -pub const CERT_TRUST_HAS_KEY_MATCH_ISSUER: ::DWORD = 0x00000002; -pub const CERT_TRUST_HAS_NAME_MATCH_ISSUER: ::DWORD = 0x00000004; -pub const CERT_TRUST_IS_SELF_SIGNED: ::DWORD = 0x00000008; -pub const CERT_TRUST_HAS_PREFERRED_ISSUER: ::DWORD = 0x00000100; -pub const CERT_TRUST_HAS_ISSUANCE_CHAIN_POLICY: ::DWORD = 0x00000200; -pub const CERT_TRUST_HAS_VALID_NAME_CONSTRAINTS: ::DWORD = 0x00000400; -pub const CERT_TRUST_IS_COMPLEX_CHAIN: ::DWORD = 0x00010000; -pub const CERT_ALT_NAME_OTHER_NAME: ::DWORD = 1; -pub const CERT_ALT_NAME_RFC822_NAME: ::DWORD = 2; -pub const CERT_ALT_NAME_DNS_NAME: ::DWORD = 3; -pub const CERT_ALT_NAME_X400_ADDRESS: ::DWORD = 4; -pub const CERT_ALT_NAME_DIRECTORY_NAME: ::DWORD = 5; -pub const CERT_ALT_NAME_EDI_PARTY_NAME: ::DWORD = 6; -pub const CERT_ALT_NAME_URL: ::DWORD = 7; -pub const CERT_ALT_NAME_IP_ADDRESS: ::DWORD = 8; -pub const CERT_ALT_NAME_REGISTERED_ID: ::DWORD = 9; -pub const CERT_STORE_CTRL_RESYNC: ::DWORD = 1; -pub const CERT_STORE_CTRL_NOTIFY_CHANGE: ::DWORD = 2; -pub const CERT_STORE_CTRL_COMMIT: ::DWORD = 3; -pub const CERT_STORE_CTRL_AUTO_RESYNC: ::DWORD = 4; -pub const CERT_STORE_CTRL_CANCEL_NOTIFY: ::DWORD = 5; -pub const CERT_ID_ISSUER_SERIAL_NUMBER: ::DWORD = 1; -pub const CERT_ID_KEY_IDENTIFIER: ::DWORD = 2; -pub const CERT_ID_SHA1_HASH: ::DWORD = 3; -pub const CERT_KEY_PROV_HANDLE_PROP_ID: ::DWORD = 1; -pub const CERT_KEY_PROV_INFO_PROP_ID: ::DWORD = 2; -pub const CERT_SHA1_HASH_PROP_ID: ::DWORD = 3; -pub const CERT_MD5_HASH_PROP_ID: ::DWORD = 4; -pub const CERT_HASH_PROP_ID: ::DWORD = CERT_SHA1_HASH_PROP_ID; -pub const CERT_KEY_CONTEXT_PROP_ID: ::DWORD = 5; -pub const CERT_KEY_SPEC_PROP_ID: ::DWORD = 6; -pub const CERT_IE30_RESERVED_PROP_ID: ::DWORD = 7; -pub const CERT_PUBKEY_HASH_RESERVED_PROP_ID: ::DWORD = 8; -pub const CERT_ENHKEY_USAGE_PROP_ID: ::DWORD = 9; -pub const CERT_CTL_USAGE_PROP_ID: ::DWORD = CERT_ENHKEY_USAGE_PROP_ID; -pub const CERT_NEXT_UPDATE_LOCATION_PROP_ID: ::DWORD = 10; -pub const CERT_FRIENDLY_NAME_PROP_ID: ::DWORD = 11; -pub const CERT_PVK_FILE_PROP_ID: ::DWORD = 12; -pub const CERT_DESCRIPTION_PROP_ID: ::DWORD = 13; -pub const CERT_ACCESS_STATE_PROP_ID: ::DWORD = 14; -pub const CERT_SIGNATURE_HASH_PROP_ID: ::DWORD = 15; -pub const CERT_SMART_CARD_DATA_PROP_ID: ::DWORD = 16; -pub const CERT_EFS_PROP_ID: ::DWORD = 17; -pub const CERT_FORTEZZA_DATA_PROP_ID: ::DWORD = 18; -pub const CERT_ARCHIVED_PROP_ID: ::DWORD = 19; -pub const CERT_KEY_IDENTIFIER_PROP_ID: ::DWORD = 20; -pub const CERT_AUTO_ENROLL_PROP_ID: ::DWORD = 21; -pub const CERT_PUBKEY_ALG_PARA_PROP_ID: ::DWORD = 22; -pub const CERT_CROSS_CERT_DIST_POINTS_PROP_ID: ::DWORD = 23; -pub const CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID: ::DWORD = 24; -pub const CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID: ::DWORD = 25; -pub const CERT_ENROLLMENT_PROP_ID: ::DWORD = 26; -pub const CERT_DATE_STAMP_PROP_ID: ::DWORD = 27; -pub const CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID: ::DWORD = 28; -pub const CERT_SUBJECT_NAME_MD5_HASH_PROP_ID: ::DWORD = 29; -pub const CERT_EXTENDED_ERROR_INFO_PROP_ID: ::DWORD = 30; -pub const CERT_RENEWAL_PROP_ID: ::DWORD = 64; -pub const CERT_ARCHIVED_KEY_HASH_PROP_ID: ::DWORD = 65; -pub const CERT_AUTO_ENROLL_RETRY_PROP_ID: ::DWORD = 66; -pub const CERT_AIA_URL_RETRIEVED_PROP_ID: ::DWORD = 67; -pub const CERT_AUTHORITY_INFO_ACCESS_PROP_ID: ::DWORD = 68; -pub const CERT_BACKED_UP_PROP_ID: ::DWORD = 69; -pub const CERT_OCSP_RESPONSE_PROP_ID: ::DWORD = 70; -pub const CERT_REQUEST_ORIGINATOR_PROP_ID: ::DWORD = 71; -pub const CERT_SOURCE_LOCATION_PROP_ID: ::DWORD = 72; -pub const CERT_SOURCE_URL_PROP_ID: ::DWORD = 73; -pub const CERT_NEW_KEY_PROP_ID: ::DWORD = 74; -pub const CERT_OCSP_CACHE_PREFIX_PROP_ID: ::DWORD = 75; -pub const CERT_SMART_CARD_ROOT_INFO_PROP_ID: ::DWORD = 76; -pub const CERT_NO_AUTO_EXPIRE_CHECK_PROP_ID: ::DWORD = 77; -pub const CERT_NCRYPT_KEY_HANDLE_PROP_ID: ::DWORD = 78; -pub const CERT_HCRYPTPROV_OR_NCRYPT_KEY_HANDLE_PROP_ID: ::DWORD = 79; -pub const CERT_SUBJECT_INFO_ACCESS_PROP_ID: ::DWORD = 80; -pub const CERT_CA_OCSP_AUTHORITY_INFO_ACCESS_PROP_ID: ::DWORD = 81; -pub const CERT_CA_DISABLE_CRL_PROP_ID: ::DWORD = 82; -pub const CERT_ROOT_PROGRAM_CERT_POLICIES_PROP_ID: ::DWORD = 83; -pub const CERT_ROOT_PROGRAM_NAME_CONSTRAINTS_PROP_ID: ::DWORD = 84; -pub const CERT_SUBJECT_OCSP_AUTHORITY_INFO_ACCESS_PROP_ID: ::DWORD = 85; -pub const CERT_SUBJECT_DISABLE_CRL_PROP_ID: ::DWORD = 86; -pub const CERT_CEP_PROP_ID: ::DWORD = 87; -pub const CERT_SIGN_HASH_CNG_ALG_PROP_ID: ::DWORD = 89; -pub const CERT_SCARD_PIN_ID_PROP_ID: ::DWORD = 90; -pub const CERT_SCARD_PIN_INFO_PROP_ID: ::DWORD = 91; -pub const CERT_SUBJECT_PUB_KEY_BIT_LENGTH_PROP_ID: ::DWORD = 92; -pub const CERT_PUB_KEY_CNG_ALG_BIT_LENGTH_PROP_ID: ::DWORD = 93; -pub const CERT_ISSUER_PUB_KEY_BIT_LENGTH_PROP_ID: ::DWORD = 94; -pub const CERT_ISSUER_CHAIN_SIGN_HASH_CNG_ALG_PROP_ID: ::DWORD = 95; -pub const CERT_ISSUER_CHAIN_PUB_KEY_CNG_ALG_BIT_LENGTH_PROP_ID: ::DWORD = 96; -pub const CERT_NO_EXPIRE_NOTIFICATION_PROP_ID: ::DWORD = 97; -pub const CERT_AUTH_ROOT_SHA256_HASH_PROP_ID: ::DWORD = 98; -pub const CERT_NCRYPT_KEY_HANDLE_TRANSFER_PROP_ID: ::DWORD = 99; -pub const CERT_HCRYPTPROV_TRANSFER_PROP_ID: ::DWORD = 100; -pub const CERT_SMART_CARD_READER_PROP_ID: ::DWORD = 101; -pub const CERT_SEND_AS_TRUSTED_ISSUER_PROP_ID: ::DWORD = 102; -pub const CERT_KEY_REPAIR_ATTEMPTED_PROP_ID: ::DWORD = 103; -pub const CERT_DISALLOWED_FILETIME_PROP_ID: ::DWORD = 104; -pub const CERT_ROOT_PROGRAM_CHAIN_POLICIES_PROP_ID: ::DWORD = 105; -pub const CERT_SMART_CARD_READER_NON_REMOVABLE_PROP_ID: ::DWORD = 106; -pub const CERT_SHA256_HASH_PROP_ID: ::DWORD = 107; -pub const CERT_SCEP_SERVER_CERTS_PROP_ID: ::DWORD = 108; -pub const CERT_SCEP_RA_SIGNATURE_CERT_PROP_ID: ::DWORD = 109; -pub const CERT_SCEP_RA_ENCRYPTION_CERT_PROP_ID: ::DWORD = 110; -pub const CERT_SCEP_CA_CERT_PROP_ID: ::DWORD = 111; -pub const CERT_SCEP_SIGNER_CERT_PROP_ID: ::DWORD = 112; -pub const CERT_SCEP_NONCE_PROP_ID: ::DWORD = 113; -pub const CERT_SCEP_ENCRYPT_HASH_CNG_ALG_PROP_ID: ::DWORD = 114; -pub const CERT_SCEP_FLAGS_PROP_ID: ::DWORD = 115; -pub const CERT_SCEP_GUID_PROP_ID: ::DWORD = 116; -pub const CERT_SERIALIZABLE_KEY_CONTEXT_PROP_ID: ::DWORD = 117; -pub const CERT_ISOLATED_KEY_PROP_ID: ::DWORD = 118; -pub const CERT_FIRST_RESERVED_PROP_ID: ::DWORD = 119; -pub const CERT_LAST_RESERVED_PROP_ID: ::DWORD = 0x00007FFF; -pub const CERT_FIRST_USER_PROP_ID: ::DWORD = 0x00008000; -pub const CERT_LAST_USER_PROP_ID: ::DWORD = 0x0000FFFF; -pub const szOID_CERT_PROP_ID_PREFIX: &'static str = "1.3.6.1.4.1.311.10.11."; -pub const szOID_CERT_KEY_IDENTIFIER_PROP_ID: &'static str = "1.3.6.1.4.1.311.10.11.20"; -pub const szOID_CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID: &'static str - = "1.3.6.1.4.1.311.10.11.28"; -pub const szOID_CERT_SUBJECT_NAME_MD5_HASH_PROP_ID: &'static str = "1.3.6.1.4.1.311.10.11.29"; -pub const szOID_CERT_MD5_HASH_PROP_ID: &'static str = "1.3.6.1.4.1.311.10.11.4"; -pub const szOID_CERT_SIGNATURE_HASH_PROP_ID: &'static str = "1.3.6.1.4.1.311.10.11.15"; -pub const szOID_DISALLOWED_HASH: &'static str = szOID_CERT_SIGNATURE_HASH_PROP_ID; -pub const szOID_CERT_DISALLOWED_FILETIME_PROP_ID: &'static str = "1.3.6.1.4.1.311.10.11.104"; -pub const CERT_ACCESS_STATE_WRITE_PERSIST_FLAG: ::DWORD = 0x1; -pub const CERT_ACCESS_STATE_SYSTEM_STORE_FLAG: ::DWORD = 0x2; -pub const CERT_ACCESS_STATE_LM_SYSTEM_STORE_FLAG: ::DWORD = 0x4; -pub const CERT_ACCESS_STATE_GP_SYSTEM_STORE_FLAG: ::DWORD = 0x8; -pub const CERT_ACCESS_STATE_SHARED_USER_FLAG: ::DWORD = 0x10; -pub const szOID_ROOT_PROGRAM_AUTO_UPDATE_CA_REVOCATION: &'static str = "1.3.6.1.4.1.311.60.3.1"; -pub const szOID_ROOT_PROGRAM_AUTO_UPDATE_END_REVOCATION: &'static str = "1.3.6.1.4.1.311.60.3.2"; -pub const szOID_ROOT_PROGRAM_NO_OCSP_FAILOVER_TO_CRL: &'static str = "1.3.6.1.4.1.311.60.3.3"; -STRUCT!{struct CRYPT_KEY_PROV_PARAM { - dwParam: ::DWORD, - pbData: *mut ::BYTE, - cbData: ::DWORD, - dwFlags: ::DWORD, -}} -pub type PCRYPT_KEY_PROV_PARAM = *mut CRYPT_KEY_PROV_PARAM; -STRUCT!{struct CRYPT_KEY_PROV_INFO { - pwszContainerName: ::LPWSTR, - pwszProvName: ::LPWSTR, - dwProvType: ::DWORD, - dwFlags: ::DWORD, - cProvParam: ::DWORD, - rgProvParam: PCRYPT_KEY_PROV_PARAM, - dwKeySpec: ::DWORD, -}} -pub type PCRYPT_KEY_PROV_INFO = *mut CRYPT_KEY_PROV_INFO; -pub const CERT_SET_KEY_PROV_HANDLE_PROP_ID: ::DWORD = 0x00000001; -pub const CERT_SET_KEY_CONTEXT_PROP_ID: ::DWORD = 0x00000001; -pub const CERT_NCRYPT_KEY_SPEC: ::DWORD = 0xFFFFFFFF; -//20213 -pub type HCERT_SERVER_OCSP_RESPONSE = *mut ::c_void; -STRUCT!{struct CERT_SERVER_OCSP_RESPONSE_CONTEXT { - cbSize: ::DWORD, - pbEncodedOcspResponse: *mut ::BYTE, - cbEncodedOcspResponse: ::DWORD, -}} -pub type PCERT_SERVER_OCSP_RESPONSE_CONTEXT = *mut CERT_SERVER_OCSP_RESPONSE_CONTEXT; -pub type PCCERT_SERVER_OCSP_RESPONSE_CONTEXT = *const CERT_SERVER_OCSP_RESPONSE_CONTEXT; - -pub const CERT_CHAIN_CACHE_END_CERT: ::DWORD = 0x00000001; -pub const CERT_CHAIN_THREAD_STORE_SYNC: ::DWORD = 0x00000002; -pub const CERT_CHAIN_CACHE_ONLY_URL_RETRIEVAL: ::DWORD = 0x00000004; -pub const CERT_CHAIN_USE_LOCAL_MACHINE_STORE: ::DWORD = 0x00000008; -pub const CERT_CHAIN_ENABLE_CACHE_AUTO_UPDATE: ::DWORD = 0x00000010; -pub const CERT_CHAIN_ENABLE_SHARE_STORE: ::DWORD = 0x00000020; - -STRUCT!{struct CERT_CHAIN_ENGINE_CONFIG { - cbSize: ::DWORD, - hRestrictedRoot: HCERTSTORE, - hRestrictedTrust: HCERTSTORE, - hRestrictedOther: HCERTSTORE, - cAdditionalStore: ::DWORD, - rghAdditionalStore: *mut HCERTSTORE, - dwFlags: ::DWORD, - dwUrlRetrievalTimeout: ::DWORD, - MaximumCachedCertificates: ::DWORD, - CycleDetectionModulus: ::DWORD, - // #if (NTDDI_VERSION >= NTDDI_WIN7) - hExclusiveRoot: HCERTSTORE, - hExclusiveTrustedPeople: HCERTSTORE, - // #if (NTDDI_VERSION >= NTDDI_WIN8) - dwExclusiveFlags: ::DWORD, -}} -pub type PCERT_CHAIN_ENGINE_CONFIG = *mut CERT_CHAIN_ENGINE_CONFIG; -// 18748 -pub type HCERTCHAINENGINE = ::HANDLE; -pub type PFN_CERT_CREATE_CONTEXT_SORT_FUNC = Option ::BOOL>; -STRUCT!{nodebug struct CERT_CREATE_CONTEXT_PARA { - cbSize: ::DWORD, - pfnFree: PFN_CRYPT_FREE, - pvFree: *mut ::c_void, - pfnSort: PFN_CERT_CREATE_CONTEXT_SORT_FUNC, - pvSort: *mut ::c_void, -}} -pub type PCERT_CREATE_CONTEXT_PARA = *mut CERT_CREATE_CONTEXT_PARA; -STRUCT!{struct CERT_EXTENSIONS { - cExtension: ::DWORD, - rgExtension: PCERT_EXTENSION, -}} -pub type PCERT_EXTENSIONS = *mut CERT_EXTENSIONS; -STRUCT!{struct CERT_REVOCATION_CRL_INFO { - cbSize: ::DWORD, - pBaseCrlContext: PCCRL_CONTEXT, - pDeltaCrlContext: PCCRL_CONTEXT, - pCrlEntry: PCRL_ENTRY, - fDeltaCrlEntry: ::BOOL, -}} -pub type PCERT_REVOCATION_CRL_INFO = *mut CERT_REVOCATION_CRL_INFO; -STRUCT!{struct CERT_TRUST_STATUS { - dwErrorStatus: ::DWORD, - dwInfoStatus: ::DWORD, -}} -pub type PCERT_TRUST_STATUS = *mut CERT_TRUST_STATUS; -STRUCT!{struct CERT_REVOCATION_INFO { - cbSize: ::DWORD, - dwRevocationResult: ::DWORD, - pszRevocationOid: ::LPCSTR, - pvOidSpecificInfo: ::LPVOID, - fHasFreshnessTime: ::BOOL, - dwFreshnessTime: ::DWORD, - pCrlInfo: PCERT_REVOCATION_CRL_INFO, -}} -pub type PCERT_REVOCATION_INFO = *mut CERT_REVOCATION_INFO; -STRUCT!{struct CERT_TRUST_LIST_INFO { - cbSize: ::DWORD, - pCtlEntry: PCTL_ENTRY, - pCtlContext: PCCTL_CONTEXT, -}} -pub type PCERT_TRUST_LIST_INFO = *mut CERT_TRUST_LIST_INFO; -STRUCT!{struct CERT_CHAIN_ELEMENT { - cbSize: ::DWORD, - pCertContext: PCCERT_CONTEXT, - TrustStatus: CERT_TRUST_STATUS, - pRevocationInfo: PCERT_REVOCATION_INFO, - pIssuanceUsage: PCERT_ENHKEY_USAGE, - pApplicationUsage: PCERT_ENHKEY_USAGE, - pwszExtendedErrorInfo: ::LPWSTR, -}} -pub type PCERT_CHAIN_ELEMENT = *mut CERT_CHAIN_ELEMENT; -pub type PCCERT_CHAIN_ELEMENT = *const CERT_CHAIN_ELEMENT; -STRUCT!{struct CERT_SIMPLE_CHAIN { - cbSize: ::DWORD, - TrustStatus: CERT_TRUST_STATUS, - cElement: ::DWORD, - rgpElement: *mut PCERT_CHAIN_ELEMENT, - pTrustListInfo: PCERT_TRUST_LIST_INFO, - fHasRevocationFreshnessTime: ::BOOL, - dwRevocationFreshnessTime: ::DWORD, -}} -pub type PCERT_SIMPLE_CHAIN = *mut CERT_SIMPLE_CHAIN; -pub type PCCERT_SIMPLE_CHAIN = *const CERT_SIMPLE_CHAIN; -STRUCT!{struct CERT_CHAIN_CONTEXT { - cbSize: ::DWORD, - TrustStatus: CERT_TRUST_STATUS, - cChain: ::DWORD, - rgpChain: *mut PCERT_SIMPLE_CHAIN, - cLowerQualityChainContext: ::DWORD, - rgpLowerQualityChainContext: *mut PCCERT_CHAIN_CONTEXT, - fHasRevocationFreshnessTime: ::BOOL, - dwRevocationFreshnessTime: ::DWORD, - dwCreateFlags: ::DWORD, - ChainId: ::GUID, -}} -pub type PCERT_CHAIN_CONTEXT = *mut CERT_CHAIN_CONTEXT; -pub type PCCERT_CHAIN_CONTEXT = *const CERT_CHAIN_CONTEXT; -STRUCT!{struct CERT_PHYSICAL_STORE_INFO { - cbSize: ::DWORD, - pszOpenStoreProvider: ::LPSTR, - dwOpenEncodingType: ::DWORD, - dwOpenFlags: ::DWORD, - OpenParameters: CRYPT_DATA_BLOB, - dwFlags: ::DWORD, - dwPriority: ::DWORD, -}} -pub type PCERT_PHYSICAL_STORE_INFO = *mut CERT_PHYSICAL_STORE_INFO; -STRUCT!{struct CERT_SYSTEM_STORE_INFO { - cbSize: ::DWORD, -}} -pub type PCERT_SYSTEM_STORE_INFO = *mut CERT_SYSTEM_STORE_INFO; -//13401 -pub type PFN_CERT_ENUM_SYSTEM_STORE_LOCATION = Option ::BOOL>; -//13408 -pub type PFN_CERT_ENUM_SYSTEM_STORE = Option ::BOOL>; -//13416 -pub type PFN_CERT_ENUM_PHYSICAL_STORE = Option ::BOOL>; -STRUCT!{struct CERT_STRONG_SIGN_SERIALIZED_INFO { - dwFlags: ::DWORD, - pwszCNGSignHashAlgids: ::LPWSTR, - pwszCNGPubKeyMinBitLengths: ::LPWSTR, -}} -pub type PCERT_STRONG_SIGN_SERIALIZED_INFO = *mut CERT_STRONG_SIGN_SERIALIZED_INFO; -STRUCT!{struct CERT_STRONG_SIGN_PARA { - cbSize: ::DWORD, - dwInfoChoice: ::DWORD, - pvInfo: *mut ::c_void, -}} -UNION!( - CERT_STRONG_SIGN_PARA, pvInfo, pSerializedInfo, pSerializedInfo_mut, - PCERT_STRONG_SIGN_SERIALIZED_INFO -); -UNION!(CERT_STRONG_SIGN_PARA, pvInfo, pszOID, pszOID_mut, ::LPSTR); -pub type PCERT_STRONG_SIGN_PARA = *mut CERT_STRONG_SIGN_PARA; -pub type PCCERT_STRONG_SIGN_PARA = *const CERT_STRONG_SIGN_PARA; -pub const USAGE_MATCH_TYPE_AND: ::DWORD = 0x00000000; -pub const USAGE_MATCH_TYPE_OR: ::DWORD = 0x00000001; -STRUCT!{struct CERT_USAGE_MATCH { - dwType: ::DWORD, - Usage: CERT_ENHKEY_USAGE, -}} -pub type PCERT_USAGE_MATCH = *mut CERT_USAGE_MATCH; -STRUCT!{struct CERT_CHAIN_PARA { - cbSize: ::DWORD, - RequestedUsage: CERT_USAGE_MATCH, - RequestedIssuancePolicy: CERT_USAGE_MATCH, - dwUrlRetrievalTimeout: ::DWORD, - fCheckRevocationFreshnessTime: ::BOOL, - dwRevocationFreshnessTime: ::DWORD, - pftCacheResync: ::LPFILETIME, - pStrongSignPara: PCCERT_STRONG_SIGN_PARA, - dwStrongSignFlags: ::DWORD, -}} -pub type PCERT_CHAIN_PARA = *mut CERT_CHAIN_PARA; -STRUCT!{struct CERT_SELECT_CHAIN_PARA { - hChainEngine: HCERTCHAINENGINE, - pTime: ::PFILETIME, - hAdditionalStore: HCERTSTORE, - pChainPara: PCERT_CHAIN_PARA, - dwFlags: ::DWORD, -}} -pub type PCERT_SELECT_CHAIN_PARA = *mut CERT_SELECT_CHAIN_PARA; -pub type PCCERT_SELECT_CHAIN_PARA = *const CERT_SELECT_CHAIN_PARA; -STRUCT!{struct CERT_SELECT_CRITERIA { - dwType: ::DWORD, - cPara: ::DWORD, - ppPara: *mut *mut ::c_void, -}} -pub type PCERT_SELECT_CRITERIA = *mut CERT_SELECT_CRITERIA; -pub type PCCERT_SELECT_CRITERIA = *const CERT_SELECT_CRITERIA; -STRUCT!{struct CTL_VERIFY_USAGE_PARA { - cbSize: ::DWORD, - ListIdentifier: CRYPT_DATA_BLOB, - cCtlStore: ::DWORD, - rghCtlStore: *mut HCERTSTORE, - cSignerStore: ::DWORD, - rghSignerStore: *mut HCERTSTORE, -}} -pub type PCTL_VERIFY_USAGE_PARA = *mut CTL_VERIFY_USAGE_PARA; -STRUCT!{struct CTL_VERIFY_USAGE_STATUS { - cbSize: ::DWORD, - dwError: ::DWORD, - dwFlags: ::DWORD, - ppCtl: *mut PCCTL_CONTEXT, - dwCtlEntryIndex: ::DWORD, - ppSigner: *mut PCCERT_CONTEXT, - dwSignerIndex: ::DWORD, -}} -pub type PCTL_VERIFY_USAGE_STATUS = *mut CTL_VERIFY_USAGE_STATUS; -STRUCT!{struct CERT_CHAIN_POLICY_PARA { - cbSize: ::DWORD, - dwFlags: ::DWORD, - pvExtraPolicyPara: *mut ::c_void, -}} -pub type PCERT_CHAIN_POLICY_PARA = *mut CERT_CHAIN_POLICY_PARA; -STRUCT!{struct CERT_CHAIN_POLICY_STATUS { - cbSize: ::DWORD, - dwError: ::DWORD, - lChainIndex: ::LONG, - lElementIndex: ::LONG, - pvExtraPolicyStatus: *mut ::c_void, -}} -pub type PCERT_CHAIN_POLICY_STATUS = *mut CERT_CHAIN_POLICY_STATUS; -STRUCT!{struct CERT_REVOCATION_CHAIN_PARA { - cbSize: ::DWORD, - hChainEngine: HCERTCHAINENGINE, - hAdditionalStore: HCERTSTORE, - dwChainFlags: ::DWORD, - dwUrlRetrievalTimeout: ::DWORD, - pftCurrentTime: ::LPFILETIME, - pftCacheResync: ::LPFILETIME, -}} -pub type PCERT_REVOCATION_CHAIN_PARA = *mut CERT_REVOCATION_CHAIN_PARA; -STRUCT!{struct CERT_REVOCATION_PARA { - cbSize: ::DWORD, - pIssuerCert: PCCERT_CONTEXT, - cCertStore: ::DWORD, - rgCertStore: *mut HCERTSTORE, - hCrlStore: HCERTSTORE, - pftTimeToUse: ::LPFILETIME, - dwUrlRetrievalTimeout: ::DWORD, - fCheckFreshnessTime: ::BOOL, - dwFreshnessTime: ::DWORD, - pftCurrentTime: ::LPFILETIME, - pCrlInfo: PCERT_REVOCATION_CRL_INFO, - pftCacheResync: ::LPFILETIME, - pChainPara: PCERT_REVOCATION_CHAIN_PARA, -}} -pub type PCERT_REVOCATION_PARA = *mut CERT_REVOCATION_PARA; -STRUCT!{struct CERT_REVOCATION_STATUS { - cbSize: ::DWORD, - dwIndex: ::DWORD, - dwError: ::DWORD, - dwReason: ::DWORD, - fHasFreshnessTime: ::BOOL, - dwFreshnessTime: ::DWORD, -}} -pub type PCERT_REVOCATION_STATUS = *mut CERT_REVOCATION_STATUS; -//16990 -pub type HCRYPTASYNC = ::HANDLE; -pub type PHCRYPTASYNC = *mut ::HANDLE; -STRUCT!{struct CRYPT_ENCRYPT_MESSAGE_PARA { - cbSize: ::DWORD, - dwMsgEncodingType: ::DWORD, - hCryptProv: HCRYPTPROV_LEGACY, - ContentEncryptionAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, - pvEncryptionAuxInfo: *mut ::c_void, - dwFlags: ::DWORD, - dwInnerContentType: ::DWORD, -}} -pub type PCRYPT_ENCRYPT_MESSAGE_PARA = *mut CRYPT_DECRYPT_MESSAGE_PARA; -STRUCT!{struct CRYPT_DECRYPT_MESSAGE_PARA { - cbSize: ::DWORD, - dwMsgAndCertEncodingType: ::DWORD, - cCertStore: ::DWORD, - rghCertStore: *mut HCERTSTORE, - dwFlags: ::DWORD, -}} -pub type PCRYPT_DECRYPT_MESSAGE_PARA = *mut CRYPT_DECRYPT_MESSAGE_PARA; -pub type PFN_CRYPT_GET_SIGNER_CERTIFICATE = Option PCCERT_CONTEXT>; -STRUCT!{nodebug struct CRYPT_VERIFY_MESSAGE_PARA { - cbSize: ::DWORD, - dwMsgAndCertEncodingType: ::DWORD, - hCryptProv: HCRYPTPROV_LEGACY, - pfnGetSignerCertificate: PFN_CRYPT_GET_SIGNER_CERTIFICATE, - pvGetArg: *mut ::c_void, - pStrongSignPara: PCCERT_STRONG_SIGN_PARA, -}} -pub type PCRYPT_VERIFY_MESSAGE_PARA = *mut CRYPT_VERIFY_MESSAGE_PARA; -STRUCT!{struct CRYPT_OID_INFO { - cbSize: ::DWORD, - oszOID: ::LPCSTR, - pwszName: ::LPCWSTR, - dwGroupId: ::DWORD, - dwValue: ::DWORD, - ExtraInfo: CRYPT_DATA_BLOB, - pwszCNGAlgid: ::LPCWSTR, - pwszCNGExtraAlgid: ::LPCWSTR, -}} -UNION!(CRYPT_OID_INFO, dwValue, Algid, Algid_mut, ALG_ID); -UNION!(CRYPT_OID_INFO, dwValue, dwLength, dwLength_mut, ::DWORD); -pub type PCRYPT_OID_INFO = *mut CRYPT_OID_INFO; -pub type PCCRYPT_OID_INFO = *const CRYPT_OID_INFO; -//18004 -pub type PFN_CRYPT_ENUM_KEYID_PROP = Option ::BOOL>; -//6379 -pub type PFN_CRYPT_ENUM_OID_FUNC = Option ::BOOL>; -//6675 -pub type PFN_CRYPT_ENUM_OID_INFO = Option ::BOOL>; -//6022 -pub type HCRYPTOIDFUNCSET = *mut ::c_void; -pub type HCRYPTOIDFUNCADDR = *mut ::c_void; -pub type PFN_CRYPT_ASYNC_PARAM_FREE_FUNC = Option; -STRUCT!{struct CRYPT_HASH_MESSAGE_PARA { - cbSize: ::DWORD, - dwMsgEncodingType: ::DWORD, - hCryptProv: HCRYPTPROV_LEGACY, - HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, - pvHashAuxInfo: *mut ::c_void, -}} -pub type PCRYPT_HASH_MESSAGE_PARA = *mut CRYPT_HASH_MESSAGE_PARA; -//14750 -pub type HCRYPTDEFAULTCONTEXT = *mut ::c_void; -STRUCT!{struct CRYPT_OID_FUNC_ENTRY { - pszOID: ::LPCSTR, - pvFuncAddr: *mut ::c_void, -}} -pub type PCRYPT_OID_FUNC_ENTRY = *mut CRYPT_OID_FUNC_ENTRY; -STRUCT!{struct CMSG_SIGNER_ENCODE_INFO { - cbSize: ::DWORD, - pCertInfo: PCERT_INFO, - hCryptProv: HCRYPTPROV, - dwKeySpec: ::DWORD, - HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, - pvHashAuxInfo: *mut ::c_void, - cAuthAttr: ::DWORD, - rgAuthAttr: PCRYPT_ATTRIBUTE, - cUnauthAttr: ::DWORD, - rgUnauthAttr: PCRYPT_ATTRIBUTE, -}} -UNION!(CMSG_SIGNER_ENCODE_INFO, hCryptProv, hNCryptKey, hNCryptKey_mut, ::NCRYPT_KEY_HANDLE); -pub type PCMSG_SIGNER_ENCODE_INFO = *mut CMSG_SIGNER_ENCODE_INFO; -STRUCT!{struct CMSG_SIGNED_ENCODE_INFO { - cbSize: ::DWORD, - cSigners: ::DWORD, - rgSigners: PCMSG_SIGNER_ENCODE_INFO, - cCertEncoded: ::DWORD, - rgCertEncoded: PCERT_BLOB, - cCrlEncoded: ::DWORD, - rgCrlEncoded: PCRL_BLOB, -}} -pub type PCMSG_SIGNED_ENCODE_INFO = *mut CMSG_SIGNED_ENCODE_INFO; -//7393 -pub type PFN_CMSG_STREAM_OUTPUT = Option ::BOOL>; -STRUCT!{nodebug struct CMSG_STREAM_INFO { - cbContent: ::DWORD, - pfnStreamOutput: PFN_CMSG_STREAM_OUTPUT, - pvArg: *mut ::c_void, -}} -pub type PCMSG_STREAM_INFO = *mut CMSG_STREAM_INFO; -STRUCT!{struct CRYPT_TIMESTAMP_ACCURACY { - dwSeconds: ::DWORD, - dwMillis: ::DWORD, - dwMicros: ::DWORD, -}} -pub type PCRYPT_TIMESTAMP_ACCURACY = *mut CRYPT_TIMESTAMP_ACCURACY; -STRUCT!{struct CRYPT_TIMESTAMP_INFO { - dwVersion: ::DWORD, - pszTSAPolicyId: ::LPSTR, - HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, - HashedMessage: CRYPT_DER_BLOB, - SerialNumber: CRYPT_INTEGER_BLOB, - ftTime: ::FILETIME, - pvAccuracy: PCRYPT_TIMESTAMP_ACCURACY, - fOrdering: ::BOOL, - Nonce: CRYPT_DER_BLOB, - Tsa: CRYPT_DER_BLOB, - cExtension: ::DWORD, - rgExtension: PCERT_EXTENSION, -}} -pub type PCRYPT_TIMESTAMP_INFO = *mut CRYPT_TIMESTAMP_INFO; -STRUCT!{struct CRYPT_TIMESTAMP_CONTEXT { - cbEncoded: ::DWORD, - pbEncoded: *mut ::BYTE, - pTimeStamp: PCRYPT_TIMESTAMP_INFO, -}} -pub type PCRYPT_TIMESTAMP_CONTEXT = *mut CRYPT_TIMESTAMP_CONTEXT; -STRUCT!{struct CRYPT_TIMESTAMP_PARA { - pszTSAPolicyId: ::LPCSTR, - fRequestCerts: ::BOOL, - Nonce: CRYPT_INTEGER_BLOB, - cExtension: ::DWORD, - rgExtension: PCERT_EXTENSION, -}} -pub type PCRYPT_TIMESTAMP_PARA = *mut CRYPT_TIMESTAMP_PARA; -STRUCT!{struct CRYPT_SIGN_MESSAGE_PARA { - cbSize: ::DWORD, - dwMsgEncodingType: ::DWORD, - pSigningCert: PCCERT_CONTEXT, - HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, - pvHashAuxInfo: *mut ::c_void, - cMsgCert: ::DWORD, - rgpMsgCert: *mut PCCERT_CONTEXT, - cMsgCrl: ::DWORD, - rgpMsgCrl: *mut PCCRL_CONTEXT, - cAuthAttr: ::DWORD, - rgAuthAttr: PCRYPT_ATTRIBUTE, - cUnauthAttr: ::DWORD, - rgUnauthAttr: PCRYPT_ATTRIBUTE, - dwFlags: ::DWORD, - dwInnerContentType: ::DWORD, -}} -pub type PCRYPT_SIGN_MESSAGE_PARA = *mut CRYPT_SIGN_MESSAGE_PARA; -STRUCT!{struct CRYPT_KEY_SIGN_MESSAGE_PARA { - cbSize: ::DWORD, - dwMsgAndCertEncodingType: ::DWORD, - hCryptProv: HCRYPTPROV, - dwKeySpec: ::DWORD, - HashAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, - pvHashAuxInfo: *mut ::c_void, - PubKeyAlgorithm: CRYPT_ALGORITHM_IDENTIFIER, -}} -UNION!(CRYPT_KEY_SIGN_MESSAGE_PARA, hCryptProv, hNCryptKey, hNCryptKey_mut, ::NCRYPT_KEY_HANDLE); -pub type PCRYPT_KEY_SIGN_MESSAGE_PARA = *mut CRYPT_KEY_SIGN_MESSAGE_PARA; -STRUCT!{struct CRYPT_KEY_VERIFY_MESSAGE_PARA { - cbSize: ::DWORD, - dwMsgEncodingType: ::DWORD, - hCryptProv: HCRYPTPROV_LEGACY, -}} -pub type PCRYPT_KEY_VERIFY_MESSAGE_PARA = *mut CRYPT_KEY_VERIFY_MESSAGE_PARA; -STRUCT!{struct HTTPSPolicyCallbackData { - cbSize: ::DWORD, - dwAuthType: ::DWORD, - fdwChecks: ::DWORD, - pwszServerName: *mut ::WCHAR, -}} -pub type PHTTPSPolicyCallbackData = *mut HTTPSPolicyCallbackData; -pub type SSL_EXTRA_CERT_CHAIN_POLICY_PARA = HTTPSPolicyCallbackData; -pub type PSSL_EXTRA_CERT_CHAIN_POLICY_PARA = *mut HTTPSPolicyCallbackData; -pub const AUTHTYPE_CLIENT: ::DWORD = 1; -pub const AUTHTYPE_SERVER: ::DWORD = 2; -pub const CTL_ENTRY_FROM_PROP_CHAIN_FLAG: ::DWORD = 0x1; -pub const CMSG_ENCODE_SORTED_CTL_FLAG: ::DWORD = 0x1; -pub const CMSG_ENCODE_HASHED_SUBJECT_IDENTIFIER_FLAG: ::DWORD = 0x2; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/windef.rs cargo-0.37.0/vendor/winapi-0.2.8/src/windef.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/windef.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/windef.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Basic Windows Type Definitions -DECLARE_HANDLE!(HWND, HWND__); -DECLARE_HANDLE!(HHOOK, HHOOK__); -DECLARE_HANDLE!(HEVENT, HEVENT__); -pub type HGDIOBJ = *mut ::c_void; -DECLARE_HANDLE!(HACCEL, HACCEL__); -DECLARE_HANDLE!(HBITMAP, HBITMAP__); -DECLARE_HANDLE!(HBRUSH, HBRUSH__); -DECLARE_HANDLE!(HCOLORSPACE, HCOLORSPACE__); -DECLARE_HANDLE!(HDC, HDC__); -DECLARE_HANDLE!(HGLRC, HGLRC__); -DECLARE_HANDLE!(HDESK, HDESK__); -DECLARE_HANDLE!(HENHMETAFILE, HENHMETAFILE__); -DECLARE_HANDLE!(HFONT, HFONT__); -DECLARE_HANDLE!(HICON, HICON__); -DECLARE_HANDLE!(HMENU, HMENU__); -DECLARE_HANDLE!(HPALETTE, HPALETTE__); -DECLARE_HANDLE!(HPEN, HPEN__); -DECLARE_HANDLE!(HWINEVENTHOOK, HWINEVENTHOOK__); -DECLARE_HANDLE!(HMONITOR, HMONITOR__); -DECLARE_HANDLE!(HUMPD, HUMPD__); -pub type HCURSOR = HICON; -pub type COLORREF = ::DWORD; -pub type LPCOLORREF = *mut ::DWORD; -STRUCT!{struct RECT { - left: ::LONG, - top: ::LONG, - right: ::LONG, - bottom: ::LONG, -}} -pub type PRECT = *mut RECT; -pub type NPRECT = *mut RECT; -pub type LPRECT = *mut RECT; -pub type LPCRECT = *const RECT; -STRUCT!{struct RECTL { - left: ::LONG, - top: ::LONG, - right: ::LONG, - bottom: ::LONG, -}} -pub type PRECTL = *mut RECTL; -pub type LPRECTL = *mut RECTL; -pub type LPCRECTL = *const RECTL; -STRUCT!{struct POINT { - x: ::LONG, - y: ::LONG, -}} -pub type PPOINT = *mut POINT; -pub type NPPOINT = *mut POINT; -pub type LPPOINT = *mut POINT; -STRUCT!{struct POINTL { - x: ::LONG, - y: ::LONG, -}} -pub type PPOINTL = *mut POINTL; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/windowscodecs.rs cargo-0.37.0/vendor/winapi-0.2.8/src/windowscodecs.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/windowscodecs.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/windowscodecs.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,363 +0,0 @@ -// Copyright © 2015; Connor Hilarides -// Licensed under the MIT License -//! Mappings for the contents of wincodec.h -pub type WICColor = ::UINT32; -pub type WICInProcPointer = *mut ::BYTE; -pub type REFWICPixelFormatGUID = ::REFGUID; -pub type WICPixelFormatGUID = ::GUID; -STRUCT!{struct WICRect { - X: ::INT, - Y: ::INT, - Width: ::INT, - Height: ::INT, -}} -ENUM!{enum WICColorContextType { - WICColorContextUninitialized = 0, - WICColorContextProfile = 0x1, - WICColorContextExifColorSpace = 0x2, -}} -ENUM!{enum WICBitmapCreateCacheOption { - WICBitmapNoCache = 0, - WICBitmapCacheOnDemand = 0x1, - WICBitmapCacheOnLoad = 0x2, -}} -ENUM!{enum WICDecodeOptions { - WICDecodeMetadataCacheOnDemand = 0, - WICDecodeMetadataCacheOnLoad = 0x1, -}} -ENUM!{enum WICBitmapEncoderCacheOption { - WICBitmapEncoderCacheInMemory = 0, - WICBitmapEncoderCacheTempFile = 0x1, - WICBitmapEncoderNoCache = 0x2, -}} -FLAGS!{enum WICComponentType { - WICDecoder = 0x1, - WICEncoder = 0x2, - WICPixelFormatConverter = 0x4, - WICMetadataReader = 0x8, - WICMetadataWriter = 0x10, - WICPixelFormat = 0x20, - WICAllComponents = 0x3f, -}} -FLAGS!{enum WICComponentEnumerateOptions { - WICComponentEnumerateDefault = 0, - WICComponentEnumerateRefresh = 0x1, - WICComponentEnumerateDisabled = 0x80000000, - WICComponentEnumerateUnsigned = 0x40000000, - WICComponentEnumerateBuiltInOnly = 0x20000000, -}} -#[allow(unused_qualifications)] -STRUCT!{struct WICBitmapPattern { - Position: ::ULARGE_INTEGER, - Length: ::ULONG, - Pattern: *mut ::BYTE, - Mask: *mut ::BYTE, - EndOfStream: ::BOOL, -}} -ENUM!{enum WICBitmapInterpolationMode { - WICBitmapInterpolationModeNearestNeighbor = 0, - WICBitmapInterpolationModeLinear = 0x1, - WICBitmapInterpolationModeCubic = 0x2, - WICBitmapInterpolationModeFant = 0x3, -}} -ENUM!{enum WICBitmapPaletteType { - WICBitmapPaletteTypeCustom = 0, - WICBitmapPaletteTypeMedianCut = 0x1, - WICBitmapPaletteTypeFixedBW = 0x2, - WICBitmapPaletteTypeFixedHalftone8 = 0x3, - WICBitmapPaletteTypeFixedHalftone27 = 0x4, - WICBitmapPaletteTypeFixedHalftone64 = 0x5, - WICBitmapPaletteTypeFixedHalftone125 = 0x6, - WICBitmapPaletteTypeFixedHalftone216 = 0x7, - WICBitmapPaletteTypeFixedHalftone252 = 0x8, - WICBitmapPaletteTypeFixedHalftone256 = 0x9, - WICBitmapPaletteTypeFixedGray4 = 0xa, - WICBitmapPaletteTypeFixedGray16 = 0xb, - WICBitmapPaletteTypeFixedGray256 = 0xc, -}} -pub const WICBitmapPaletteTypeFixedWebPalette: WICBitmapPaletteType = - WICBitmapPaletteTypeFixedHalftone216; -ENUM!{enum WICBitmapDitherType { - WICBitmapDitherTypeSolid = 0, - WICBitmapDitherTypeOrdered4x4 = 0x1, - WICBitmapDitherTypeOrdered8x8 = 0x2, - WICBitmapDitherTypeOrdered16x16 = 0x3, - WICBitmapDitherTypeSpiral4x4 = 0x4, - WICBitmapDitherTypeSpiral8x8 = 0x5, - WICBitmapDitherTypeDualSpiral4x4 = 0x6, - WICBitmapDitherTypeDualSpiral8x8 = 0x7, - WICBitmapDitherTypeErrorDiffusion = 0x8, -}} -pub const WICBitmapDitherTypeNone: WICBitmapDitherType = WICBitmapDitherTypeSolid; -ENUM!{enum WICBitmapAlphaChannelOption { - WICBitmapUseAlpha = 0, - WICBitmapUsePremultipliedAlpha = 0x1, - WICBitmapIgnoreAlpha = 0x2, -}} -FLAGS!{enum WICBitmapTransformOptions { - WICBitmapTransformRotate0 = 0, - WICBitmapTransformRotate90 = 0x1, - WICBitmapTransformRotate180 = 0x2, - WICBitmapTransformRotate270 = 0x3, - WICBitmapTransformFlipHorizontal = 0x8, - WICBitmapTransformFlipVertical = 0x10, -}} -FLAGS!{enum WICBitmapLockFlags { - WICBitmapLockRead = 0x1, - WICBitmapLockWrite = 0x2, -}} -FLAGS!{enum WICBitmapDecoderCapabilities { - WICBitmapDecoderCapabilitySameEncoder = 0x1, - WICBitmapDecoderCapabilityCanDecodeAllImages = 0x2, - WICBitmapDecoderCapabilityCanDecodeSomeImages = 0x4, - WICBitmapDecoderCapabilityCanEnumerateMetadata = 0x8, - WICBitmapDecoderCapabilityCanDecodeThumbnail = 0x10, -}} -FLAGS!{enum WICProgressOperation { - WICProgressOperationCopyPixels = 0x1, - WICProgressOperationWritePixels = 0x2, - WICProgressOperationAll = 0xffff, -}} -FLAGS!{enum WICProgressNotification { - WICProgressNotificationBegin = 0x10000, - WICProgressNotificationEnd = 0x20000, - WICProgressNotificationFrequent = 0x40000, - WICProgressNotificationAll = 0xffff0000, -}} -FLAGS!{enum WICComponentSigning { - WICComponentSigned = 0x1, - WICComponentUnsigned = 0x2, - WICComponentSafe = 0x4, - WICComponentDisabled = 0x80000000, -}} -ENUM!{enum WICGifLogicalScreenDescriptorProperties { - WICGifLogicalScreenSignature = 0x1, - WICGifLogicalScreenDescriptorWidth = 0x2, - WICGifLogicalScreenDescriptorHeight = 0x3, - WICGifLogicalScreenDescriptorGlobalColorTableFlag = 0x4, - WICGifLogicalScreenDescriptorColorResolution = 0x5, - WICGifLogicalScreenDescriptorSortFlag = 0x6, - WICGifLogicalScreenDescriptorGlobalColorTableSize = 0x7, - WICGifLogicalScreenDescriptorBackgroundColorIndex = 0x8, - WICGifLogicalScreenDescriptorPixelAspectRatio = 0x9, -}} -ENUM!{enum WICGifImageDescriptorProperties { - WICGifImageDescriptorLeft = 0x1, - WICGifImageDescriptorTop = 0x2, - WICGifImageDescriptorWidth = 0x3, - WICGifImageDescriptorHeight = 0x4, - WICGifImageDescriptorLocalColorTableFlag = 0x5, - WICGifImageDescriptorInterlaceFlag = 0x6, - WICGifImageDescriptorSortFlag = 0x7, - WICGifImageDescriptorLocalColorTableSize = 0x8, -}} -ENUM!{enum WICGifGraphicControlExtensionProperties { - WICGifGraphicControlExtensionDisposal = 0x1, - WICGifGraphicControlExtensionUserInputFlag = 0x2, - WICGifGraphicControlExtensionTransparencyFlag = 0x3, - WICGifGraphicControlExtensionDelay = 0x4, - WICGifGraphicControlExtensionTransparentColorIndex = 0x5, -}} -ENUM!{enum WICGifApplicationExtensionProperties { - WICGifApplicationExtensionApplication = 0x1, - WICGifApplicationExtensionData = 0x2, -}} -ENUM!{enum WICGifCommentExtensionProperties { - WICGifCommentExtensionText = 0x1, -}} -ENUM!{enum WICJpegCommentProperties { - WICJpegCommentText = 0x1, -}} -ENUM!{enum WICJpegLuminanceProperties { - WICJpegLuminanceTable = 0x1, -}} -ENUM!{enum WICJpegChrominanceProperties { - WICJpegChrominanceTable = 0x1, -}} -ENUM!{enum WIC8BIMIptcProperties { - WIC8BIMIptcPString = 0, - WIC8BIMIptcEmbeddedIPTC = 0x1, -}} -ENUM!{enum WIC8BIMResolutionInfoProperties { - WIC8BIMResolutionInfoPString = 0x1, - WIC8BIMResolutionInfoHResolution = 0x2, - WIC8BIMResolutionInfoHResolutionUnit = 0x3, - WIC8BIMResolutionInfoWidthUnit = 0x4, - WIC8BIMResolutionInfoVResolution = 0x5, - WIC8BIMResolutionInfoVResolutionUnit = 0x6, - WIC8BIMResolutionInfoHeightUnit = 0x7, -}} -ENUM!{enum WIC8BIMIptcDigestProperties { - WIC8BIMIptcDigestPString = 0x1, - WIC8BIMIptcDigestIptcDigest = 0x2, -}} -ENUM!{enum WICPngGamaProperties { - WICPngGamaGamma = 0x1, -}} -ENUM!{enum WICPngBkgdProperties { - WICPngBkgdBackgroundColor = 0x1, -}} -ENUM!{enum WICPngItxtProperties { - WICPngItxtKeyword = 0x1, - WICPngItxtCompressionFlag = 0x2, - WICPngItxtLanguageTag = 0x3, - WICPngItxtTranslatedKeyword = 0x4, - WICPngItxtText = 0x5, -}} -ENUM!{enum WICPngChrmProperties { - WICPngChrmWhitePointX = 0x1, - WICPngChrmWhitePointY = 0x2, - WICPngChrmRedX = 0x3, - WICPngChrmRedY = 0x4, - WICPngChrmGreenX = 0x5, - WICPngChrmGreenY = 0x6, - WICPngChrmBlueX = 0x7, - WICPngChrmBlueY = 0x8, -}} -ENUM!{enum WICPngHistProperties { - WICPngHistFrequencies = 0x1, -}} -ENUM!{enum WICPngIccpProperties { - WICPngIccpProfileName = 0x1, - WICPngIccpProfileData = 0x2, -}} -ENUM!{enum WICPngSrgbProperties { - WICPngSrgbRenderingIntent = 0x1, -}} -ENUM!{enum WICPngTimeProperties { - WICPngTimeYear = 0x1, - WICPngTimeMonth = 0x2, - WICPngTimeDay = 0x3, - WICPngTimeHour = 0x4, - WICPngTimeMinute = 0x5, - WICPngTimeSecond = 0x6, -}} -ENUM!{enum WICSectionAccessLevel { - WICSectionAccessLevelRead = 0x1, - WICSectionAccessLevelReadWrite = 0x3, -}} -ENUM!{enum WICPixelFormatNumericRepresentation { - WICPixelFormatNumericRepresentationUnspecified = 0, - WICPixelFormatNumericRepresentationIndexed = 0x1, - WICPixelFormatNumericRepresentationUnsignedInteger = 0x2, - WICPixelFormatNumericRepresentationSignedInteger = 0x3, - WICPixelFormatNumericRepresentationFixed = 0x4, - WICPixelFormatNumericRepresentationFloat = 0x5, -}} -ENUM!{enum WICPlanarOptions { - WICPlanarOptionsDefault = 0, - WICPlanarOptionsPreserveSubsampling = 0x1, -}} -#[allow(unused_qualifications)] -STRUCT!{struct WICImageParameters { - PixelFormat: ::D2D1_PIXEL_FORMAT, - DpiX: ::FLOAT, - DpiY: ::FLOAT, - Top: ::FLOAT, - Left: ::FLOAT, - PixelWidth: ::FLOAT, - PixelHeight: ::FLOAT, -}} -#[allow(unused_qualifications)] -STRUCT!{struct WICBitmapPlaneDescription { - Format: WICPixelFormatGUID, - Width: ::UINT, - Height: ::UINT, -}} -#[allow(unused_qualifications)] -STRUCT!{struct WICBitmapPlane { - Format: WICPixelFormatGUID, - pbBuffer: *mut ::BYTE, - cbStride: ::UINT, - cbBufferSize: ::UINT, -}} -RIDL!( -interface IWICPalette(IWICPaletteVtbl): IUnknown(IUnknownVtbl) { - fn InitializePredefined( - &mut self, ePaletteType: WICBitmapPaletteType, fAddTransparentColor: ::BOOL - ) -> ::HRESULT, - fn InitializeCustom(&mut self, pColors: *mut WICColor, cCount: ::UINT) -> ::HRESULT, - fn InitializeFromBitmap( - &mut self, pISurface: *mut IWICBitmapSource, cCount: ::UINT, fAddTransparentColor: ::BOOL - ) -> ::HRESULT, - fn InitializeFromPalette(&mut self, pIPalette: *mut IWICPalette) -> ::HRESULT, - fn GetType(&mut self, pePaletteType: *mut WICBitmapPaletteType) -> ::HRESULT, - fn GetColorCount(&mut self, pcCount: *mut ::UINT) -> ::HRESULT, - fn GetColors( - &mut self, cCount: ::UINT, pColros: *mut WICColor, pcActualColors: *mut ::UINT - ) -> ::HRESULT, - fn IsBlackWhite(&mut self, pfIsBlackWhite: *mut ::BOOL) -> ::HRESULT, - fn IsGrayscale(&mut self, pfIsGrayscale: *mut ::BOOL) -> ::HRESULT, - fn HasAlpha(&mut self, pfHasAlpha: *mut ::BOOL) -> ::HRESULT -}); -RIDL!( -interface IWICBitmapSource(IWICBitmapSourceVtbl): IUnknown(IUnknownVtbl) { - fn GetSize(&mut self, puiWidth: *mut ::UINT, puiHeight: ::UINT) -> ::HRESULT, - fn GetPixelFormat(&mut self, pPixelFormat: *mut WICPixelFormatGUID) -> ::HRESULT, - fn GetResolution(&mut self, pDpiX: *mut f64, pDpiY: *mut f64) -> ::HRESULT, - fn CopyPalette(&mut self, pIPalette: *mut IWICPalette) -> ::HRESULT, - fn CopyPixels( - &mut self, prc: *const WICRect, cbStride: ::UINT, cbBufferSize: ::UINT, - pbBuffer: *mut ::BYTE - ) -> ::HRESULT -}); -RIDL!( -interface IWICFormatConverter(IWICFormatConverterVtbl): IWICBitmapSource(IWICBitmapSourceVtbl) { - fn Initialize( - &mut self, pISource: *mut IWICBitmapSource, dstFormat: REFWICPixelFormatGUID, - dither: WICBitmapDitherType, pIPalette: *mut IWICPalette, alphaThreasholdPercent: f64, - paletteTranslate: WICBitmapPaletteType - ) -> ::HRESULT, - fn CanConvert( - &mut self, srcPixelFormat: REFWICPixelFormatGUID, dstPixelFormat: REFWICPixelFormatGUID, - pfCanConvert: *mut ::BOOL - ) -> ::HRESULT -}); -RIDL!( -interface IWICPlanarFormatConverter(IWICPlanarFormatConverterVtbl) - : IWICBitmapSource(IWICBitmapSourceVtbl) { - fn Initialize( - &mut self, ppPlanes: *mut *mut IWICBitmapSource, cPlanes: ::UINT, - dstFormat: REFWICPixelFormatGUID, dither: WICBitmapDitherType, pIPalette: *mut IWICPalette, - alphaThreasholdPercent: f64, paletteTranslate: WICBitmapPaletteType - ) -> ::HRESULT, - fn CanConvert( - &mut self, pSrcPixelFormats: *const WICPixelFormatGUID, cSrcPlanes: ::UINT, - dstPixelFormat: REFWICPixelFormatGUID, pfCanConvert: *mut ::BOOL - ) -> ::HRESULT -}); -RIDL!( -interface IWICBitmapScaler(IWICBitmapScalerVtbl): IWICBitmapSource(IWICBitmapSourceVtbl) { - fn Initialize( - &mut self, pISource: *mut IWICBitmapSource, uiWidth: ::UINT, uiHeight: ::UINT, - mode: WICBitmapInterpolationMode - ) -> ::HRESULT -}); -RIDL!( -interface IWICBitmapClipper(IWICBitmapClipperVtbl): IWICBitmapSource(IWICBitmapSourceVtbl) { - fn Initialize(&mut self, pISource: *mut IWICBitmapSource, prc: *const WICRect) -> ::HRESULT -}); -RIDL!( -interface IWICBitmapFlipRotator(IWICBitmapFlipRotatorVtbl) - : IWICBitmapSource(IWICBitmapSourceVtbl) { - fn Initialize( - &mut self, pISource: *mut IWICBitmapSource, options: WICBitmapTransformOptions - ) -> ::HRESULT -}); -RIDL!( -interface IWICBitmapLock(IWICBitmapLockVtbl): IUnknown(IUnknownVtbl) { - fn GetSize(&mut self, puiWidth: *mut ::UINT, puiHeight: *mut ::UINT) -> ::HRESULT, - fn GetStride(&mut self, pcbStride: *mut ::UINT) -> ::HRESULT, - fn GetDataPointer( - &mut self, pcbBufferSize: *mut ::UINT, ppbData: *mut WICInProcPointer - ) -> ::HRESULT, - fn GetPixelFormat(&mut self, pPixelFormat: *mut WICPixelFormatGUID) -> ::HRESULT -}); -RIDL!( -interface IWICBitmap(IWICBitmapVtbl): IWICBitmapSource(IWICBitmapSourceVtbl) { - fn Lock( - &mut self, prcLock: *const WICRect, flags: ::DWORD, ppILock: *mut *mut IWICBitmapLock - ) -> ::HRESULT, - fn SetPalette(&mut self, pIPalette: *mut IWICPalette) -> ::HRESULT, - fn SetResolution(&mut self, dpiX: f64, dpiY: f64) -> ::HRESULT -}); diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/windowsx.rs cargo-0.37.0/vendor/winapi-0.2.8/src/windowsx.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/windowsx.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/windowsx.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Macro APIs, window message crackers, and control APIs -//1233 -pub fn GET_X_LPARAM(lp: ::LPARAM) -> ::c_int { - ::LOWORD(lp as ::DWORD) as ::c_short as ::c_int -} -pub fn GET_Y_LPARAM(lp: ::LPARAM) -> ::c_int { - ::HIWORD(lp as ::DWORD) as ::c_short as ::c_int -} -#[test] -fn test_get_x_lparam() { - assert_eq!(GET_X_LPARAM(0xDEAD1234u32 as ::LPARAM), 0x1234); - assert_eq!(GET_X_LPARAM(0xBEEFffffu32 as ::LPARAM), -1); - assert_eq!(GET_X_LPARAM(0xCAFEFB2Eu32 as ::LPARAM), -1234); -} -#[test] -fn test_get_y_lparam() { - assert_eq!(GET_Y_LPARAM(0x1234DEADu32 as ::LPARAM), 0x1234); - assert_eq!(GET_Y_LPARAM(0xffffBEEFu32 as ::LPARAM), -1); - assert_eq!(GET_Y_LPARAM(0xFB2ECAFEu32 as ::LPARAM), -1234); -} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/winerror.rs cargo-0.37.0/vendor/winapi-0.2.8/src/winerror.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/winerror.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/winerror.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,6065 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! error code definitions for the Win32 API functions -#[inline] -pub fn SUCCEEDED(hr: HRESULT) -> bool { - hr >= 0 -} -pub const FACILITY_XPS: HRESULT = 82; -pub const FACILITY_XAML: HRESULT = 43; -pub const FACILITY_USN: HRESULT = 129; -pub const FACILITY_BLBUI: HRESULT = 128; -pub const FACILITY_SPP: HRESULT = 256; -pub const FACILITY_WSB_ONLINE: HRESULT = 133; -pub const FACILITY_DLS: HRESULT = 153; -pub const FACILITY_BLB_CLI: HRESULT = 121; -pub const FACILITY_BLB: HRESULT = 120; -pub const FACILITY_WSBAPP: HRESULT = 122; -pub const FACILITY_WPN: HRESULT = 62; -pub const FACILITY_WMAAECMA: HRESULT = 1996; -pub const FACILITY_WINRM: HRESULT = 51; -pub const FACILITY_WINPE: HRESULT = 61; -pub const FACILITY_WINDOWSUPDATE: HRESULT = 36; -pub const FACILITY_WINDOWS_STORE: HRESULT = 63; -pub const FACILITY_WINDOWS_SETUP: HRESULT = 48; -pub const FACILITY_WINDOWS_DEFENDER: HRESULT = 80; -pub const FACILITY_WINDOWS_CE: HRESULT = 24; -pub const FACILITY_WINDOWS: HRESULT = 8; -pub const FACILITY_WINCODEC_DWRITE_DWM: HRESULT = 2200; -pub const FACILITY_WIA: HRESULT = 33; -pub const FACILITY_WER: HRESULT = 27; -pub const FACILITY_WEP: HRESULT = 2049; -pub const FACILITY_WEB_SOCKET: HRESULT = 886; -pub const FACILITY_WEB: HRESULT = 885; -pub const FACILITY_USERMODE_VOLSNAP: HRESULT = 130; -pub const FACILITY_USERMODE_VOLMGR: HRESULT = 56; -pub const FACILITY_VISUALCPP: HRESULT = 109; -pub const FACILITY_USERMODE_VIRTUALIZATION: HRESULT = 55; -pub const FACILITY_USERMODE_VHD: HRESULT = 58; -pub const FACILITY_URT: HRESULT = 19; -pub const FACILITY_UMI: HRESULT = 22; -pub const FACILITY_UI: HRESULT = 42; -pub const FACILITY_TPM_SOFTWARE: HRESULT = 41; -pub const FACILITY_TPM_SERVICES: HRESULT = 40; -pub const FACILITY_TIERING: HRESULT = 131; -pub const FACILITY_SYNCENGINE: HRESULT = 2050; -pub const FACILITY_SXS: HRESULT = 23; -pub const FACILITY_STORAGE: HRESULT = 3; -pub const FACILITY_STATE_MANAGEMENT: HRESULT = 34; -pub const FACILITY_SSPI: HRESULT = 9; -pub const FACILITY_USERMODE_SPACES: HRESULT = 231; -pub const FACILITY_SOS: HRESULT = 160; -pub const FACILITY_SCARD: HRESULT = 16; -pub const FACILITY_SHELL: HRESULT = 39; -pub const FACILITY_SETUPAPI: HRESULT = 15; -pub const FACILITY_SECURITY: HRESULT = 9; -pub const FACILITY_SDIAG: HRESULT = 60; -pub const FACILITY_USERMODE_SDBUS: HRESULT = 2305; -pub const FACILITY_RPC: HRESULT = 1; -pub const FACILITY_RESTORE: HRESULT = 256; -pub const FACILITY_SCRIPT: HRESULT = 112; -pub const FACILITY_PARSE: HRESULT = 113; -pub const FACILITY_RAS: HRESULT = 83; -pub const FACILITY_POWERSHELL: HRESULT = 84; -pub const FACILITY_PLA: HRESULT = 48; -pub const FACILITY_PIDGENX: HRESULT = 2561; -pub const FACILITY_P2P_INT: HRESULT = 98; -pub const FACILITY_P2P: HRESULT = 99; -pub const FACILITY_OPC: HRESULT = 81; -pub const FACILITY_ONLINE_ID: HRESULT = 134; -pub const FACILITY_WIN32: HRESULT = 7; -pub const FACILITY_CONTROL: HRESULT = 10; -pub const FACILITY_WEBSERVICES: HRESULT = 61; -pub const FACILITY_NULL: HRESULT = 0; -pub const FACILITY_NDIS: HRESULT = 52; -pub const FACILITY_NAP: HRESULT = 39; -pub const FACILITY_MOBILE: HRESULT = 1793; -pub const FACILITY_METADIRECTORY: HRESULT = 35; -pub const FACILITY_MSMQ: HRESULT = 14; -pub const FACILITY_MEDIASERVER: HRESULT = 13; -pub const FACILITY_MBN: HRESULT = 84; -pub const FACILITY_LINGUISTIC_SERVICES: HRESULT = 305; -pub const FACILITY_LEAP: HRESULT = 2184; -pub const FACILITY_JSCRIPT: HRESULT = 2306; -pub const FACILITY_INTERNET: HRESULT = 12; -pub const FACILITY_ITF: HRESULT = 4; -pub const FACILITY_INPUT: HRESULT = 64; -pub const FACILITY_USERMODE_HYPERVISOR: HRESULT = 53; -pub const FACILITY_ACCELERATOR: HRESULT = 1536; -pub const FACILITY_HTTP: HRESULT = 25; -pub const FACILITY_GRAPHICS: HRESULT = 38; -pub const FACILITY_FWP: HRESULT = 50; -pub const FACILITY_FVE: HRESULT = 49; -pub const FACILITY_USERMODE_FILTER_MANAGER: HRESULT = 31; -pub const FACILITY_EAS: HRESULT = 85; -pub const FACILITY_EAP: HRESULT = 66; -pub const FACILITY_DXGI_DDI: HRESULT = 2171; -pub const FACILITY_DXGI: HRESULT = 2170; -pub const FACILITY_DPLAY: HRESULT = 21; -pub const FACILITY_DMSERVER: HRESULT = 256; -pub const FACILITY_DISPATCH: HRESULT = 2; -pub const FACILITY_DIRECTORYSERVICE: HRESULT = 37; -pub const FACILITY_DIRECTMUSIC: HRESULT = 2168; -pub const FACILITY_DIRECT3D11: HRESULT = 2172; -pub const FACILITY_DIRECT3D10: HRESULT = 2169; -pub const FACILITY_DIRECT2D: HRESULT = 2201; -pub const FACILITY_DAF: HRESULT = 100; -pub const FACILITY_DEPLOYMENT_SERVICES_UTIL: HRESULT = 260; -pub const FACILITY_DEPLOYMENT_SERVICES_TRANSPORT_MANAGEMENT: HRESULT = 272; -pub const FACILITY_DEPLOYMENT_SERVICES_TFTP: HRESULT = 264; -pub const FACILITY_DEPLOYMENT_SERVICES_PXE: HRESULT = 263; -pub const FACILITY_DEPLOYMENT_SERVICES_MULTICAST_SERVER: HRESULT = 289; -pub const FACILITY_DEPLOYMENT_SERVICES_MULTICAST_CLIENT: HRESULT = 290; -pub const FACILITY_DEPLOYMENT_SERVICES_MANAGEMENT: HRESULT = 259; -pub const FACILITY_DEPLOYMENT_SERVICES_IMAGING: HRESULT = 258; -pub const FACILITY_DEPLOYMENT_SERVICES_DRIVER_PROVISIONING: HRESULT = 278; -pub const FACILITY_DEPLOYMENT_SERVICES_SERVER: HRESULT = 257; -pub const FACILITY_DEPLOYMENT_SERVICES_CONTENT_PROVIDER: HRESULT = 293; -pub const FACILITY_DEPLOYMENT_SERVICES_BINLSVC: HRESULT = 261; -pub const FACILITY_DEFRAG: HRESULT = 2304; -pub const FACILITY_DEBUGGERS: HRESULT = 176; -pub const FACILITY_CONFIGURATION: HRESULT = 33; -pub const FACILITY_COMPLUS: HRESULT = 17; -pub const FACILITY_USERMODE_COMMONLOG: HRESULT = 26; -pub const FACILITY_CMI: HRESULT = 54; -pub const FACILITY_CERT: HRESULT = 11; -pub const FACILITY_BLUETOOTH_ATT: HRESULT = 101; -pub const FACILITY_BCD: HRESULT = 57; -pub const FACILITY_BACKGROUNDCOPY: HRESULT = 32; -pub const FACILITY_AUDIOSTREAMING: HRESULT = 1094; -pub const FACILITY_AUDCLNT: HRESULT = 2185; -pub const FACILITY_AUDIO: HRESULT = 102; -pub const FACILITY_ACTION_QUEUE: HRESULT = 44; -pub const FACILITY_ACS: HRESULT = 20; -pub const FACILITY_AAF: HRESULT = 18; -pub const ERROR_SUCCESS: ::DWORD = 0; -pub const NO_ERROR: ::DWORD = 0; -pub const SEC_E_OK: HRESULT = 0; -pub const ERROR_INVALID_FUNCTION: ::DWORD = 1; -pub const ERROR_FILE_NOT_FOUND: ::DWORD = 2; -pub const ERROR_PATH_NOT_FOUND: ::DWORD = 3; -pub const ERROR_TOO_MANY_OPEN_FILES: ::DWORD = 4; -pub const ERROR_ACCESS_DENIED: ::DWORD = 5; -pub const ERROR_INVALID_HANDLE: ::DWORD = 6; -pub const ERROR_ARENA_TRASHED: ::DWORD = 7; -pub const ERROR_NOT_ENOUGH_MEMORY: ::DWORD = 8; -pub const ERROR_INVALID_BLOCK: ::DWORD = 9; -pub const ERROR_BAD_ENVIRONMENT: ::DWORD = 10; -pub const ERROR_BAD_FORMAT: ::DWORD = 11; -pub const ERROR_INVALID_ACCESS: ::DWORD = 12; -pub const ERROR_INVALID_DATA: ::DWORD = 13; -pub const ERROR_OUTOFMEMORY: ::DWORD = 14; -pub const ERROR_INVALID_DRIVE: ::DWORD = 15; -pub const ERROR_CURRENT_DIRECTORY: ::DWORD = 16; -pub const ERROR_NOT_SAME_DEVICE: ::DWORD = 17; -pub const ERROR_NO_MORE_FILES: ::DWORD = 18; -pub const ERROR_WRITE_PROTECT: ::DWORD = 19; -pub const ERROR_BAD_UNIT: ::DWORD = 20; -pub const ERROR_NOT_READY: ::DWORD = 21; -pub const ERROR_BAD_COMMAND: ::DWORD = 22; -pub const ERROR_CRC: ::DWORD = 23; -pub const ERROR_BAD_LENGTH: ::DWORD = 24; -pub const ERROR_SEEK: ::DWORD = 25; -pub const ERROR_NOT_DOS_DISK: ::DWORD = 26; -pub const ERROR_SECTOR_NOT_FOUND: ::DWORD = 27; -pub const ERROR_OUT_OF_PAPER: ::DWORD = 28; -pub const ERROR_WRITE_FAULT: ::DWORD = 29; -pub const ERROR_READ_FAULT: ::DWORD = 30; -pub const ERROR_GEN_FAILURE: ::DWORD = 31; -pub const ERROR_SHARING_VIOLATION: ::DWORD = 32; -pub const ERROR_LOCK_VIOLATION: ::DWORD = 33; -pub const ERROR_WRONG_DISK: ::DWORD = 34; -pub const ERROR_SHARING_BUFFER_EXCEEDED: ::DWORD = 36; -pub const ERROR_HANDLE_EOF: ::DWORD = 38; -pub const ERROR_HANDLE_DISK_FULL: ::DWORD = 39; -pub const ERROR_NOT_SUPPORTED: ::DWORD = 50; -pub const ERROR_REM_NOT_LIST: ::DWORD = 51; -pub const ERROR_DUP_NAME: ::DWORD = 52; -pub const ERROR_BAD_NETPATH: ::DWORD = 53; -pub const ERROR_NETWORK_BUSY: ::DWORD = 54; -pub const ERROR_DEV_NOT_EXIST: ::DWORD = 55; -pub const ERROR_TOO_MANY_CMDS: ::DWORD = 56; -pub const ERROR_ADAP_HDW_ERR: ::DWORD = 57; -pub const ERROR_BAD_NET_RESP: ::DWORD = 58; -pub const ERROR_UNEXP_NET_ERR: ::DWORD = 59; -pub const ERROR_BAD_REM_ADAP: ::DWORD = 60; -pub const ERROR_PRINTQ_FULL: ::DWORD = 61; -pub const ERROR_NO_SPOOL_SPACE: ::DWORD = 62; -pub const ERROR_PRINT_CANCELLED: ::DWORD = 63; -pub const ERROR_NETNAME_DELETED: ::DWORD = 64; -pub const ERROR_NETWORK_ACCESS_DENIED: ::DWORD = 65; -pub const ERROR_BAD_DEV_TYPE: ::DWORD = 66; -pub const ERROR_BAD_NET_NAME: ::DWORD = 67; -pub const ERROR_TOO_MANY_NAMES: ::DWORD = 68; -pub const ERROR_TOO_MANY_SESS: ::DWORD = 69; -pub const ERROR_SHARING_PAUSED: ::DWORD = 70; -pub const ERROR_REQ_NOT_ACCEP: ::DWORD = 71; -pub const ERROR_REDIR_PAUSED: ::DWORD = 72; -pub const ERROR_FILE_EXISTS: ::DWORD = 80; -pub const ERROR_CANNOT_MAKE: ::DWORD = 82; -pub const ERROR_FAIL_I24: ::DWORD = 83; -pub const ERROR_OUT_OF_STRUCTURES: ::DWORD = 84; -pub const ERROR_ALREADY_ASSIGNED: ::DWORD = 85; -pub const ERROR_INVALID_PASSWORD: ::DWORD = 86; -pub const ERROR_INVALID_PARAMETER: ::DWORD = 87; -pub const ERROR_NET_WRITE_FAULT: ::DWORD = 88; -pub const ERROR_NO_PROC_SLOTS: ::DWORD = 89; -pub const ERROR_TOO_MANY_SEMAPHORES: ::DWORD = 100; -pub const ERROR_EXCL_SEM_ALREADY_OWNED: ::DWORD = 101; -pub const ERROR_SEM_IS_SET: ::DWORD = 102; -pub const ERROR_TOO_MANY_SEM_REQUESTS: ::DWORD = 103; -pub const ERROR_INVALID_AT_INTERRUPT_TIME: ::DWORD = 104; -pub const ERROR_SEM_OWNER_DIED: ::DWORD = 105; -pub const ERROR_SEM_USER_LIMIT: ::DWORD = 106; -pub const ERROR_DISK_CHANGE: ::DWORD = 107; -pub const ERROR_DRIVE_LOCKED: ::DWORD = 108; -pub const ERROR_BROKEN_PIPE: ::DWORD = 109; -pub const ERROR_OPEN_FAILED: ::DWORD = 110; -pub const ERROR_BUFFER_OVERFLOW: ::DWORD = 111; -pub const ERROR_DISK_FULL: ::DWORD = 112; -pub const ERROR_NO_MORE_SEARCH_HANDLES: ::DWORD = 113; -pub const ERROR_INVALID_TARGET_HANDLE: ::DWORD = 114; -pub const ERROR_INVALID_CATEGORY: ::DWORD = 117; -pub const ERROR_INVALID_VERIFY_SWITCH: ::DWORD = 118; -pub const ERROR_BAD_DRIVER_LEVEL: ::DWORD = 119; -pub const ERROR_CALL_NOT_IMPLEMENTED: ::DWORD = 120; -pub const ERROR_SEM_TIMEOUT: ::DWORD = 121; -pub const ERROR_INSUFFICIENT_BUFFER: ::DWORD = 122; -pub const ERROR_INVALID_NAME: ::DWORD = 123; -pub const ERROR_INVALID_LEVEL: ::DWORD = 124; -pub const ERROR_NO_VOLUME_LABEL: ::DWORD = 125; -pub const ERROR_MOD_NOT_FOUND: ::DWORD = 126; -pub const ERROR_PROC_NOT_FOUND: ::DWORD = 127; -pub const ERROR_WAIT_NO_CHILDREN: ::DWORD = 128; -pub const ERROR_CHILD_NOT_COMPLETE: ::DWORD = 129; -pub const ERROR_DIRECT_ACCESS_HANDLE: ::DWORD = 130; -pub const ERROR_NEGATIVE_SEEK: ::DWORD = 131; -pub const ERROR_SEEK_ON_DEVICE: ::DWORD = 132; -pub const ERROR_IS_JOIN_TARGET: ::DWORD = 133; -pub const ERROR_IS_JOINED: ::DWORD = 134; -pub const ERROR_IS_SUBSTED: ::DWORD = 135; -pub const ERROR_NOT_JOINED: ::DWORD = 136; -pub const ERROR_NOT_SUBSTED: ::DWORD = 137; -pub const ERROR_JOIN_TO_JOIN: ::DWORD = 138; -pub const ERROR_SUBST_TO_SUBST: ::DWORD = 139; -pub const ERROR_JOIN_TO_SUBST: ::DWORD = 140; -pub const ERROR_SUBST_TO_JOIN: ::DWORD = 141; -pub const ERROR_BUSY_DRIVE: ::DWORD = 142; -pub const ERROR_SAME_DRIVE: ::DWORD = 143; -pub const ERROR_DIR_NOT_ROOT: ::DWORD = 144; -pub const ERROR_DIR_NOT_EMPTY: ::DWORD = 145; -pub const ERROR_IS_SUBST_PATH: ::DWORD = 146; -pub const ERROR_IS_JOIN_PATH: ::DWORD = 147; -pub const ERROR_PATH_BUSY: ::DWORD = 148; -pub const ERROR_IS_SUBST_TARGET: ::DWORD = 149; -pub const ERROR_SYSTEM_TRACE: ::DWORD = 150; -pub const ERROR_INVALID_EVENT_COUNT: ::DWORD = 151; -pub const ERROR_TOO_MANY_MUXWAITERS: ::DWORD = 152; -pub const ERROR_INVALID_LIST_FORMAT: ::DWORD = 153; -pub const ERROR_LABEL_TOO_LONG: ::DWORD = 154; -pub const ERROR_TOO_MANY_TCBS: ::DWORD = 155; -pub const ERROR_SIGNAL_REFUSED: ::DWORD = 156; -pub const ERROR_DISCARDED: ::DWORD = 157; -pub const ERROR_NOT_LOCKED: ::DWORD = 158; -pub const ERROR_BAD_THREADID_ADDR: ::DWORD = 159; -pub const ERROR_BAD_ARGUMENTS: ::DWORD = 160; -pub const ERROR_BAD_PATHNAME: ::DWORD = 161; -pub const ERROR_SIGNAL_PENDING: ::DWORD = 162; -pub const ERROR_MAX_THRDS_REACHED: ::DWORD = 164; -pub const ERROR_LOCK_FAILED: ::DWORD = 167; -pub const ERROR_BUSY: ::DWORD = 170; -pub const ERROR_DEVICE_SUPPORT_IN_PROGRESS: ::DWORD = 171; -pub const ERROR_CANCEL_VIOLATION: ::DWORD = 173; -pub const ERROR_ATOMIC_LOCKS_NOT_SUPPORTED: ::DWORD = 174; -pub const ERROR_INVALID_SEGMENT_NUMBER: ::DWORD = 180; -pub const ERROR_INVALID_ORDINAL: ::DWORD = 182; -pub const ERROR_ALREADY_EXISTS: ::DWORD = 183; -pub const ERROR_INVALID_FLAG_NUMBER: ::DWORD = 186; -pub const ERROR_SEM_NOT_FOUND: ::DWORD = 187; -pub const ERROR_INVALID_STARTING_CODESEG: ::DWORD = 188; -pub const ERROR_INVALID_STACKSEG: ::DWORD = 189; -pub const ERROR_INVALID_MODULETYPE: ::DWORD = 190; -pub const ERROR_INVALID_EXE_SIGNATURE: ::DWORD = 191; -pub const ERROR_EXE_MARKED_INVALID: ::DWORD = 192; -pub const ERROR_BAD_EXE_FORMAT: ::DWORD = 193; -pub const ERROR_ITERATED_DATA_EXCEEDS_64k: ::DWORD = 194; -pub const ERROR_INVALID_MINALLOCSIZE: ::DWORD = 195; -pub const ERROR_DYNLINK_FROM_INVALID_RING: ::DWORD = 196; -pub const ERROR_IOPL_NOT_ENABLED: ::DWORD = 197; -pub const ERROR_INVALID_SEGDPL: ::DWORD = 198; -pub const ERROR_AUTODATASEG_EXCEEDS_64k: ::DWORD = 199; -pub const ERROR_RING2SEG_MUST_BE_MOVABLE: ::DWORD = 200; -pub const ERROR_RELOC_CHAIN_XEEDS_SEGLIM: ::DWORD = 201; -pub const ERROR_INFLOOP_IN_RELOC_CHAIN: ::DWORD = 202; -pub const ERROR_ENVVAR_NOT_FOUND: ::DWORD = 203; -pub const ERROR_NO_SIGNAL_SENT: ::DWORD = 205; -pub const ERROR_FILENAME_EXCED_RANGE: ::DWORD = 206; -pub const ERROR_RING2_STACK_IN_USE: ::DWORD = 207; -pub const ERROR_META_EXPANSION_TOO_LONG: ::DWORD = 208; -pub const ERROR_INVALID_SIGNAL_NUMBER: ::DWORD = 209; -pub const ERROR_THREAD_1_INACTIVE: ::DWORD = 210; -pub const ERROR_LOCKED: ::DWORD = 212; -pub const ERROR_TOO_MANY_MODULES: ::DWORD = 214; -pub const ERROR_NESTING_NOT_ALLOWED: ::DWORD = 215; -pub const ERROR_EXE_MACHINE_TYPE_MISMATCH: ::DWORD = 216; -pub const ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY: ::DWORD = 217; -pub const ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY: ::DWORD = 218; -pub const ERROR_FILE_CHECKED_OUT: ::DWORD = 220; -pub const ERROR_CHECKOUT_REQUIRED: ::DWORD = 221; -pub const ERROR_BAD_FILE_TYPE: ::DWORD = 222; -pub const ERROR_FILE_TOO_LARGE: ::DWORD = 223; -pub const ERROR_FORMS_AUTH_REQUIRED: ::DWORD = 224; -pub const ERROR_VIRUS_INFECTED: ::DWORD = 225; -pub const ERROR_VIRUS_DELETED: ::DWORD = 226; -pub const ERROR_PIPE_LOCAL: ::DWORD = 229; -pub const ERROR_BAD_PIPE: ::DWORD = 230; -pub const ERROR_PIPE_BUSY: ::DWORD = 231; -pub const ERROR_NO_DATA: ::DWORD = 232; -pub const ERROR_PIPE_NOT_CONNECTED: ::DWORD = 233; -pub const ERROR_MORE_DATA: ::DWORD = 234; -pub const ERROR_VC_DISCONNECTED: ::DWORD = 240; -pub const ERROR_INVALID_EA_NAME: ::DWORD = 254; -pub const ERROR_EA_LIST_INCONSISTENT: ::DWORD = 255; -pub const WAIT_TIMEOUT: ::DWORD = 258; -pub const ERROR_NO_MORE_ITEMS: ::DWORD = 259; -pub const ERROR_CANNOT_COPY: ::DWORD = 266; -pub const ERROR_DIRECTORY: ::DWORD = 267; -pub const ERROR_EAS_DIDNT_FIT: ::DWORD = 275; -pub const ERROR_EA_FILE_CORRUPT: ::DWORD = 276; -pub const ERROR_EA_TABLE_FULL: ::DWORD = 277; -pub const ERROR_INVALID_EA_HANDLE: ::DWORD = 278; -pub const ERROR_EAS_NOT_SUPPORTED: ::DWORD = 282; -pub const ERROR_NOT_OWNER: ::DWORD = 288; -pub const ERROR_TOO_MANY_POSTS: ::DWORD = 298; -pub const ERROR_PARTIAL_COPY: ::DWORD = 299; -pub const ERROR_OPLOCK_NOT_GRANTED: ::DWORD = 300; -pub const ERROR_INVALID_OPLOCK_PROTOCOL: ::DWORD = 301; -pub const ERROR_DISK_TOO_FRAGMENTED: ::DWORD = 302; -pub const ERROR_DELETE_PENDING: ::DWORD = 303; -pub const ERROR_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING: ::DWORD = 304; -pub const ERROR_SHORT_NAMES_NOT_ENABLED_ON_VOLUME: ::DWORD = 305; -pub const ERROR_SECURITY_STREAM_IS_INCONSISTENT: ::DWORD = 306; -pub const ERROR_INVALID_LOCK_RANGE: ::DWORD = 307; -pub const ERROR_IMAGE_SUBSYSTEM_NOT_PRESENT: ::DWORD = 308; -pub const ERROR_NOTIFICATION_GUID_ALREADY_DEFINED: ::DWORD = 309; -pub const ERROR_INVALID_EXCEPTION_HANDLER: ::DWORD = 310; -pub const ERROR_DUPLICATE_PRIVILEGES: ::DWORD = 311; -pub const ERROR_NO_RANGES_PROCESSED: ::DWORD = 312; -pub const ERROR_NOT_ALLOWED_ON_SYSTEM_FILE: ::DWORD = 313; -pub const ERROR_DISK_RESOURCES_EXHAUSTED: ::DWORD = 314; -pub const ERROR_INVALID_TOKEN: ::DWORD = 315; -pub const ERROR_DEVICE_FEATURE_NOT_SUPPORTED: ::DWORD = 316; -pub const ERROR_MR_MID_NOT_FOUND: ::DWORD = 317; -pub const ERROR_SCOPE_NOT_FOUND: ::DWORD = 318; -pub const ERROR_UNDEFINED_SCOPE: ::DWORD = 319; -pub const ERROR_INVALID_CAP: ::DWORD = 320; -pub const ERROR_DEVICE_UNREACHABLE: ::DWORD = 321; -pub const ERROR_DEVICE_NO_RESOURCES: ::DWORD = 322; -pub const ERROR_DATA_CHECKSUM_ERROR: ::DWORD = 323; -pub const ERROR_INTERMIXED_KERNEL_EA_OPERATION: ::DWORD = 324; -pub const ERROR_FILE_LEVEL_TRIM_NOT_SUPPORTED: ::DWORD = 326; -pub const ERROR_OFFSET_ALIGNMENT_VIOLATION: ::DWORD = 327; -pub const ERROR_INVALID_FIELD_IN_PARAMETER_LIST: ::DWORD = 328; -pub const ERROR_OPERATION_IN_PROGRESS: ::DWORD = 329; -pub const ERROR_BAD_DEVICE_PATH: ::DWORD = 330; -pub const ERROR_TOO_MANY_DESCRIPTORS: ::DWORD = 331; -pub const ERROR_SCRUB_DATA_DISABLED: ::DWORD = 332; -pub const ERROR_NOT_REDUNDANT_STORAGE: ::DWORD = 333; -pub const ERROR_RESIDENT_FILE_NOT_SUPPORTED: ::DWORD = 334; -pub const ERROR_COMPRESSED_FILE_NOT_SUPPORTED: ::DWORD = 335; -pub const ERROR_DIRECTORY_NOT_SUPPORTED: ::DWORD = 336; -pub const ERROR_NOT_READ_FROM_COPY: ::DWORD = 337; -pub const ERROR_FT_WRITE_FAILURE: ::DWORD = 338; -pub const ERROR_FT_DI_SCAN_REQUIRED: ::DWORD = 339; -pub const ERROR_INVALID_KERNEL_INFO_VERSION: ::DWORD = 340; -pub const ERROR_INVALID_PEP_INFO_VERSION: ::DWORD = 341; -pub const ERROR_OBJECT_NOT_EXTERNALLY_BACKED: ::DWORD = 342; -pub const ERROR_EXTERNAL_BACKING_PROVIDER_UNKNOWN: ::DWORD = 343; -pub const ERROR_FAIL_NOACTION_REBOOT: ::DWORD = 350; -pub const ERROR_FAIL_SHUTDOWN: ::DWORD = 351; -pub const ERROR_FAIL_RESTART: ::DWORD = 352; -pub const ERROR_MAX_SESSIONS_REACHED: ::DWORD = 353; -pub const ERROR_THREAD_MODE_ALREADY_BACKGROUND: ::DWORD = 400; -pub const ERROR_THREAD_MODE_NOT_BACKGROUND: ::DWORD = 401; -pub const ERROR_PROCESS_MODE_ALREADY_BACKGROUND: ::DWORD = 402; -pub const ERROR_PROCESS_MODE_NOT_BACKGROUND: ::DWORD = 403; -pub const ERROR_DEVICE_HARDWARE_ERROR: ::DWORD = 483; -pub const ERROR_INVALID_ADDRESS: ::DWORD = 487; -pub const ERROR_USER_PROFILE_LOAD: ::DWORD = 500; -pub const ERROR_ARITHMETIC_OVERFLOW: ::DWORD = 534; -pub const ERROR_PIPE_CONNECTED: ::DWORD = 535; -pub const ERROR_PIPE_LISTENING: ::DWORD = 536; -pub const ERROR_VERIFIER_STOP: ::DWORD = 537; -pub const ERROR_ABIOS_ERROR: ::DWORD = 538; -pub const ERROR_WX86_WARNING: ::DWORD = 539; -pub const ERROR_WX86_ERROR: ::DWORD = 540; -pub const ERROR_TIMER_NOT_CANCELED: ::DWORD = 541; -pub const ERROR_UNWIND: ::DWORD = 542; -pub const ERROR_BAD_STACK: ::DWORD = 543; -pub const ERROR_INVALID_UNWIND_TARGET: ::DWORD = 544; -pub const ERROR_INVALID_PORT_ATTRIBUTES: ::DWORD = 545; -pub const ERROR_PORT_MESSAGE_TOO_LONG: ::DWORD = 546; -pub const ERROR_INVALID_QUOTA_LOWER: ::DWORD = 547; -pub const ERROR_DEVICE_ALREADY_ATTACHED: ::DWORD = 548; -pub const ERROR_INSTRUCTION_MISALIGNMENT: ::DWORD = 549; -pub const ERROR_PROFILING_NOT_STARTED: ::DWORD = 550; -pub const ERROR_PROFILING_NOT_STOPPED: ::DWORD = 551; -pub const ERROR_COULD_NOT_INTERPRET: ::DWORD = 552; -pub const ERROR_PROFILING_AT_LIMIT: ::DWORD = 553; -pub const ERROR_CANT_WAIT: ::DWORD = 554; -pub const ERROR_CANT_TERMINATE_SELF: ::DWORD = 555; -pub const ERROR_UNEXPECTED_MM_CREATE_ERR: ::DWORD = 556; -pub const ERROR_UNEXPECTED_MM_MAP_ERROR: ::DWORD = 557; -pub const ERROR_UNEXPECTED_MM_EXTEND_ERR: ::DWORD = 558; -pub const ERROR_BAD_FUNCTION_TABLE: ::DWORD = 559; -pub const ERROR_NO_GUID_TRANSLATION: ::DWORD = 560; -pub const ERROR_INVALID_LDT_SIZE: ::DWORD = 561; -pub const ERROR_INVALID_LDT_OFFSET: ::DWORD = 563; -pub const ERROR_INVALID_LDT_DESCRIPTOR: ::DWORD = 564; -pub const ERROR_TOO_MANY_THREADS: ::DWORD = 565; -pub const ERROR_THREAD_NOT_IN_PROCESS: ::DWORD = 566; -pub const ERROR_PAGEFILE_QUOTA_EXCEEDED: ::DWORD = 567; -pub const ERROR_LOGON_SERVER_CONFLICT: ::DWORD = 568; -pub const ERROR_SYNCHRONIZATION_REQUIRED: ::DWORD = 569; -pub const ERROR_NET_OPEN_FAILED: ::DWORD = 570; -pub const ERROR_IO_PRIVILEGE_FAILED: ::DWORD = 571; -pub const ERROR_CONTROL_C_EXIT: ::DWORD = 572; -pub const ERROR_MISSING_SYSTEMFILE: ::DWORD = 573; -pub const ERROR_UNHANDLED_EXCEPTION: ::DWORD = 574; -pub const ERROR_APP_INIT_FAILURE: ::DWORD = 575; -pub const ERROR_PAGEFILE_CREATE_FAILED: ::DWORD = 576; -pub const ERROR_INVALID_IMAGE_HASH: ::DWORD = 577; -pub const ERROR_NO_PAGEFILE: ::DWORD = 578; -pub const ERROR_ILLEGAL_FLOAT_CONTEXT: ::DWORD = 579; -pub const ERROR_NO_EVENT_PAIR: ::DWORD = 580; -pub const ERROR_DOMAIN_CTRLR_CONFIG_ERROR: ::DWORD = 581; -pub const ERROR_ILLEGAL_CHARACTER: ::DWORD = 582; -pub const ERROR_UNDEFINED_CHARACTER: ::DWORD = 583; -pub const ERROR_FLOPPY_VOLUME: ::DWORD = 584; -pub const ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT: ::DWORD = 585; -pub const ERROR_BACKUP_CONTROLLER: ::DWORD = 586; -pub const ERROR_MUTANT_LIMIT_EXCEEDED: ::DWORD = 587; -pub const ERROR_FS_DRIVER_REQUIRED: ::DWORD = 588; -pub const ERROR_CANNOT_LOAD_REGISTRY_FILE: ::DWORD = 589; -pub const ERROR_DEBUG_ATTACH_FAILED: ::DWORD = 590; -pub const ERROR_SYSTEM_PROCESS_TERMINATED: ::DWORD = 591; -pub const ERROR_DATA_NOT_ACCEPTED: ::DWORD = 592; -pub const ERROR_VDM_HARD_ERROR: ::DWORD = 593; -pub const ERROR_DRIVER_CANCEL_TIMEOUT: ::DWORD = 594; -pub const ERROR_REPLY_MESSAGE_MISMATCH: ::DWORD = 595; -pub const ERROR_LOST_WRITEBEHIND_DATA: ::DWORD = 596; -pub const ERROR_CLIENT_SERVER_PARAMETERS_INVALID: ::DWORD = 597; -pub const ERROR_NOT_TINY_STREAM: ::DWORD = 598; -pub const ERROR_STACK_OVERFLOW_READ: ::DWORD = 599; -pub const ERROR_CONVERT_TO_LARGE: ::DWORD = 600; -pub const ERROR_FOUND_OUT_OF_SCOPE: ::DWORD = 601; -pub const ERROR_ALLOCATE_BUCKET: ::DWORD = 602; -pub const ERROR_MARSHALL_OVERFLOW: ::DWORD = 603; -pub const ERROR_INVALID_VARIANT: ::DWORD = 604; -pub const ERROR_BAD_COMPRESSION_BUFFER: ::DWORD = 605; -pub const ERROR_AUDIT_FAILED: ::DWORD = 606; -pub const ERROR_TIMER_RESOLUTION_NOT_SET: ::DWORD = 607; -pub const ERROR_INSUFFICIENT_LOGON_INFO: ::DWORD = 608; -pub const ERROR_BAD_DLL_ENTRYPOINT: ::DWORD = 609; -pub const ERROR_BAD_SERVICE_ENTRYPOINT: ::DWORD = 610; -pub const ERROR_IP_ADDRESS_CONFLICT1: ::DWORD = 611; -pub const ERROR_IP_ADDRESS_CONFLICT2: ::DWORD = 612; -pub const ERROR_REGISTRY_QUOTA_LIMIT: ::DWORD = 613; -pub const ERROR_NO_CALLBACK_ACTIVE: ::DWORD = 614; -pub const ERROR_PWD_TOO_SHORT: ::DWORD = 615; -pub const ERROR_PWD_TOO_RECENT: ::DWORD = 616; -pub const ERROR_PWD_HISTORY_CONFLICT: ::DWORD = 617; -pub const ERROR_UNSUPPORTED_COMPRESSION: ::DWORD = 618; -pub const ERROR_INVALID_HW_PROFILE: ::DWORD = 619; -pub const ERROR_INVALID_PLUGPLAY_DEVICE_PATH: ::DWORD = 620; -pub const ERROR_QUOTA_LIST_INCONSISTENT: ::DWORD = 621; -pub const ERROR_EVALUATION_EXPIRATION: ::DWORD = 622; -pub const ERROR_ILLEGAL_DLL_RELOCATION: ::DWORD = 623; -pub const ERROR_DLL_INIT_FAILED_LOGOFF: ::DWORD = 624; -pub const ERROR_VALIDATE_CONTINUE: ::DWORD = 625; -pub const ERROR_NO_MORE_MATCHES: ::DWORD = 626; -pub const ERROR_RANGE_LIST_CONFLICT: ::DWORD = 627; -pub const ERROR_SERVER_SID_MISMATCH: ::DWORD = 628; -pub const ERROR_CANT_ENABLE_DENY_ONLY: ::DWORD = 629; -pub const ERROR_FLOAT_MULTIPLE_FAULTS: ::DWORD = 630; -pub const ERROR_FLOAT_MULTIPLE_TRAPS: ::DWORD = 631; -pub const ERROR_NOINTERFACE: ::DWORD = 632; -pub const ERROR_DRIVER_FAILED_SLEEP: ::DWORD = 633; -pub const ERROR_CORRUPT_SYSTEM_FILE: ::DWORD = 634; -pub const ERROR_COMMITMENT_MINIMUM: ::DWORD = 635; -pub const ERROR_PNP_RESTART_ENUMERATION: ::DWORD = 636; -pub const ERROR_SYSTEM_IMAGE_BAD_SIGNATURE: ::DWORD = 637; -pub const ERROR_PNP_REBOOT_REQUIRED: ::DWORD = 638; -pub const ERROR_INSUFFICIENT_POWER: ::DWORD = 639; -pub const ERROR_MULTIPLE_FAULT_VIOLATION: ::DWORD = 640; -pub const ERROR_SYSTEM_SHUTDOWN: ::DWORD = 641; -pub const ERROR_PORT_NOT_SET: ::DWORD = 642; -pub const ERROR_DS_VERSION_CHECK_FAILURE: ::DWORD = 643; -pub const ERROR_RANGE_NOT_FOUND: ::DWORD = 644; -pub const ERROR_NOT_SAFE_MODE_DRIVER: ::DWORD = 646; -pub const ERROR_FAILED_DRIVER_ENTRY: ::DWORD = 647; -pub const ERROR_DEVICE_ENUMERATION_ERROR: ::DWORD = 648; -pub const ERROR_MOUNT_POINT_NOT_RESOLVED: ::DWORD = 649; -pub const ERROR_INVALID_DEVICE_OBJECT_PARAMETER: ::DWORD = 650; -pub const ERROR_MCA_OCCURED: ::DWORD = 651; -pub const ERROR_DRIVER_DATABASE_ERROR: ::DWORD = 652; -pub const ERROR_SYSTEM_HIVE_TOO_LARGE: ::DWORD = 653; -pub const ERROR_DRIVER_FAILED_PRIOR_UNLOAD: ::DWORD = 654; -pub const ERROR_VOLSNAP_PREPARE_HIBERNATE: ::DWORD = 655; -pub const ERROR_HIBERNATION_FAILURE: ::DWORD = 656; -pub const ERROR_PWD_TOO_LONG: ::DWORD = 657; -pub const ERROR_FILE_SYSTEM_LIMITATION: ::DWORD = 665; -pub const ERROR_ASSERTION_FAILURE: ::DWORD = 668; -pub const ERROR_ACPI_ERROR: ::DWORD = 669; -pub const ERROR_WOW_ASSERTION: ::DWORD = 670; -pub const ERROR_PNP_BAD_MPS_TABLE: ::DWORD = 671; -pub const ERROR_PNP_TRANSLATION_FAILED: ::DWORD = 672; -pub const ERROR_PNP_IRQ_TRANSLATION_FAILED: ::DWORD = 673; -pub const ERROR_PNP_INVALID_ID: ::DWORD = 674; -pub const ERROR_WAKE_SYSTEM_DEBUGGER: ::DWORD = 675; -pub const ERROR_HANDLES_CLOSED: ::DWORD = 676; -pub const ERROR_EXTRANEOUS_INFORMATION: ::DWORD = 677; -pub const ERROR_RXACT_COMMIT_NECESSARY: ::DWORD = 678; -pub const ERROR_MEDIA_CHECK: ::DWORD = 679; -pub const ERROR_GUID_SUBSTITUTION_MADE: ::DWORD = 680; -pub const ERROR_STOPPED_ON_SYMLINK: ::DWORD = 681; -pub const ERROR_LONGJUMP: ::DWORD = 682; -pub const ERROR_PLUGPLAY_QUERY_VETOED: ::DWORD = 683; -pub const ERROR_UNWIND_CONSOLIDATE: ::DWORD = 684; -pub const ERROR_REGISTRY_HIVE_RECOVERED: ::DWORD = 685; -pub const ERROR_DLL_MIGHT_BE_INSECURE: ::DWORD = 686; -pub const ERROR_DLL_MIGHT_BE_INCOMPATIBLE: ::DWORD = 687; -pub const ERROR_DBG_EXCEPTION_NOT_HANDLED: ::DWORD = 688; -pub const ERROR_DBG_REPLY_LATER: ::DWORD = 689; -pub const ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE: ::DWORD = 690; -pub const ERROR_DBG_TERMINATE_THREAD: ::DWORD = 691; -pub const ERROR_DBG_TERMINATE_PROCESS: ::DWORD = 692; -pub const ERROR_DBG_CONTROL_C: ::DWORD = 693; -pub const ERROR_DBG_PRINTEXCEPTION_C: ::DWORD = 694; -pub const ERROR_DBG_RIPEXCEPTION: ::DWORD = 695; -pub const ERROR_DBG_CONTROL_BREAK: ::DWORD = 696; -pub const ERROR_DBG_COMMAND_EXCEPTION: ::DWORD = 697; -pub const ERROR_OBJECT_NAME_EXISTS: ::DWORD = 698; -pub const ERROR_THREAD_WAS_SUSPENDED: ::DWORD = 699; -pub const ERROR_IMAGE_NOT_AT_BASE: ::DWORD = 700; -pub const ERROR_RXACT_STATE_CREATED: ::DWORD = 701; -pub const ERROR_SEGMENT_NOTIFICATION: ::DWORD = 702; -pub const ERROR_BAD_CURRENT_DIRECTORY: ::DWORD = 703; -pub const ERROR_FT_READ_RECOVERY_FROM_BACKUP: ::DWORD = 704; -pub const ERROR_FT_WRITE_RECOVERY: ::DWORD = 705; -pub const ERROR_IMAGE_MACHINE_TYPE_MISMATCH: ::DWORD = 706; -pub const ERROR_RECEIVE_PARTIAL: ::DWORD = 707; -pub const ERROR_RECEIVE_EXPEDITED: ::DWORD = 708; -pub const ERROR_RECEIVE_PARTIAL_EXPEDITED: ::DWORD = 709; -pub const ERROR_EVENT_DONE: ::DWORD = 710; -pub const ERROR_EVENT_PENDING: ::DWORD = 711; -pub const ERROR_CHECKING_FILE_SYSTEM: ::DWORD = 712; -pub const ERROR_FATAL_APP_EXIT: ::DWORD = 713; -pub const ERROR_PREDEFINED_HANDLE: ::DWORD = 714; -pub const ERROR_WAS_UNLOCKED: ::DWORD = 715; -pub const ERROR_SERVICE_NOTIFICATION: ::DWORD = 716; -pub const ERROR_WAS_LOCKED: ::DWORD = 717; -pub const ERROR_LOG_HARD_ERROR: ::DWORD = 718; -pub const ERROR_ALREADY_WIN32: ::DWORD = 719; -pub const ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE: ::DWORD = 720; -pub const ERROR_NO_YIELD_PERFORMED: ::DWORD = 721; -pub const ERROR_TIMER_RESUME_IGNORED: ::DWORD = 722; -pub const ERROR_ARBITRATION_UNHANDLED: ::DWORD = 723; -pub const ERROR_CARDBUS_NOT_SUPPORTED: ::DWORD = 724; -pub const ERROR_MP_PROCESSOR_MISMATCH: ::DWORD = 725; -pub const ERROR_HIBERNATED: ::DWORD = 726; -pub const ERROR_RESUME_HIBERNATION: ::DWORD = 727; -pub const ERROR_FIRMWARE_UPDATED: ::DWORD = 728; -pub const ERROR_DRIVERS_LEAKING_LOCKED_PAGES: ::DWORD = 729; -pub const ERROR_WAKE_SYSTEM: ::DWORD = 730; -pub const ERROR_WAIT_1: ::DWORD = 731; -pub const ERROR_WAIT_2: ::DWORD = 732; -pub const ERROR_WAIT_3: ::DWORD = 733; -pub const ERROR_WAIT_63: ::DWORD = 734; -pub const ERROR_ABANDONED_WAIT_0: ::DWORD = 735; -pub const ERROR_ABANDONED_WAIT_63: ::DWORD = 736; -pub const ERROR_USER_APC: ::DWORD = 737; -pub const ERROR_KERNEL_APC: ::DWORD = 738; -pub const ERROR_ALERTED: ::DWORD = 739; -pub const ERROR_ELEVATION_REQUIRED: ::DWORD = 740; -pub const ERROR_REPARSE: ::DWORD = 741; -pub const ERROR_OPLOCK_BREAK_IN_PROGRESS: ::DWORD = 742; -pub const ERROR_VOLUME_MOUNTED: ::DWORD = 743; -pub const ERROR_RXACT_COMMITTED: ::DWORD = 744; -pub const ERROR_NOTIFY_CLEANUP: ::DWORD = 745; -pub const ERROR_PRIMARY_TRANSPORT_CONNECT_FAILED: ::DWORD = 746; -pub const ERROR_PAGE_FAULT_TRANSITION: ::DWORD = 747; -pub const ERROR_PAGE_FAULT_DEMAND_ZERO: ::DWORD = 748; -pub const ERROR_PAGE_FAULT_COPY_ON_WRITE: ::DWORD = 749; -pub const ERROR_PAGE_FAULT_GUARD_PAGE: ::DWORD = 750; -pub const ERROR_PAGE_FAULT_PAGING_FILE: ::DWORD = 751; -pub const ERROR_CACHE_PAGE_LOCKED: ::DWORD = 752; -pub const ERROR_CRASH_DUMP: ::DWORD = 753; -pub const ERROR_BUFFER_ALL_ZEROS: ::DWORD = 754; -pub const ERROR_REPARSE_OBJECT: ::DWORD = 755; -pub const ERROR_RESOURCE_REQUIREMENTS_CHANGED: ::DWORD = 756; -pub const ERROR_TRANSLATION_COMPLETE: ::DWORD = 757; -pub const ERROR_NOTHING_TO_TERMINATE: ::DWORD = 758; -pub const ERROR_PROCESS_NOT_IN_JOB: ::DWORD = 759; -pub const ERROR_PROCESS_IN_JOB: ::DWORD = 760; -pub const ERROR_VOLSNAP_HIBERNATE_READY: ::DWORD = 761; -pub const ERROR_FSFILTER_OP_COMPLETED_SUCCESSFULLY: ::DWORD = 762; -pub const ERROR_INTERRUPT_VECTOR_ALREADY_CONNECTED: ::DWORD = 763; -pub const ERROR_INTERRUPT_STILL_CONNECTED: ::DWORD = 764; -pub const ERROR_WAIT_FOR_OPLOCK: ::DWORD = 765; -pub const ERROR_DBG_EXCEPTION_HANDLED: ::DWORD = 766; -pub const ERROR_DBG_CONTINUE: ::DWORD = 767; -pub const ERROR_CALLBACK_POP_STACK: ::DWORD = 768; -pub const ERROR_COMPRESSION_DISABLED: ::DWORD = 769; -pub const ERROR_CANTFETCHBACKWARDS: ::DWORD = 770; -pub const ERROR_CANTSCROLLBACKWARDS: ::DWORD = 771; -pub const ERROR_ROWSNOTRELEASED: ::DWORD = 772; -pub const ERROR_BAD_ACCESSOR_FLAGS: ::DWORD = 773; -pub const ERROR_ERRORS_ENCOUNTERED: ::DWORD = 774; -pub const ERROR_NOT_CAPABLE: ::DWORD = 775; -pub const ERROR_REQUEST_OUT_OF_SEQUENCE: ::DWORD = 776; -pub const ERROR_VERSION_PARSE_ERROR: ::DWORD = 777; -pub const ERROR_BADSTARTPOSITION: ::DWORD = 778; -pub const ERROR_MEMORY_HARDWARE: ::DWORD = 779; -pub const ERROR_DISK_REPAIR_DISABLED: ::DWORD = 780; -pub const ERROR_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE: ::DWORD = 781; -pub const ERROR_SYSTEM_POWERSTATE_TRANSITION: ::DWORD = 782; -pub const ERROR_SYSTEM_POWERSTATE_COMPLEX_TRANSITION: ::DWORD = 783; -pub const ERROR_MCA_EXCEPTION: ::DWORD = 784; -pub const ERROR_ACCESS_AUDIT_BY_POLICY: ::DWORD = 785; -pub const ERROR_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY: ::DWORD = 786; -pub const ERROR_ABANDON_HIBERFILE: ::DWORD = 787; -pub const ERROR_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED: ::DWORD = 788; -pub const ERROR_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR: ::DWORD = 789; -pub const ERROR_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR: ::DWORD = 790; -pub const ERROR_BAD_MCFG_TABLE: ::DWORD = 791; -pub const ERROR_DISK_REPAIR_REDIRECTED: ::DWORD = 792; -pub const ERROR_DISK_REPAIR_UNSUCCESSFUL: ::DWORD = 793; -pub const ERROR_CORRUPT_LOG_OVERFULL: ::DWORD = 794; -pub const ERROR_CORRUPT_LOG_CORRUPTED: ::DWORD = 795; -pub const ERROR_CORRUPT_LOG_UNAVAILABLE: ::DWORD = 796; -pub const ERROR_CORRUPT_LOG_DELETED_FULL: ::DWORD = 797; -pub const ERROR_CORRUPT_LOG_CLEARED: ::DWORD = 798; -pub const ERROR_ORPHAN_NAME_EXHAUSTED: ::DWORD = 799; -pub const ERROR_OPLOCK_SWITCHED_TO_NEW_HANDLE: ::DWORD = 800; -pub const ERROR_CANNOT_GRANT_REQUESTED_OPLOCK: ::DWORD = 801; -pub const ERROR_CANNOT_BREAK_OPLOCK: ::DWORD = 802; -pub const ERROR_OPLOCK_HANDLE_CLOSED: ::DWORD = 803; -pub const ERROR_NO_ACE_CONDITION: ::DWORD = 804; -pub const ERROR_INVALID_ACE_CONDITION: ::DWORD = 805; -pub const ERROR_FILE_HANDLE_REVOKED: ::DWORD = 806; -pub const ERROR_IMAGE_AT_DIFFERENT_BASE: ::DWORD = 807; -pub const ERROR_ENCRYPTED_IO_NOT_POSSIBLE: ::DWORD = 808; -pub const ERROR_EA_ACCESS_DENIED: ::DWORD = 994; -pub const ERROR_OPERATION_ABORTED: ::DWORD = 995; -pub const ERROR_IO_INCOMPLETE: ::DWORD = 996; -pub const ERROR_IO_PENDING: ::DWORD = 997; -pub const ERROR_NOACCESS: ::DWORD = 998; -pub const ERROR_SWAPERROR: ::DWORD = 999; -pub const ERROR_STACK_OVERFLOW: ::DWORD = 1001; -pub const ERROR_INVALID_MESSAGE: ::DWORD = 1002; -pub const ERROR_CAN_NOT_COMPLETE: ::DWORD = 1003; -pub const ERROR_INVALID_FLAGS: ::DWORD = 1004; -pub const ERROR_UNRECOGNIZED_VOLUME: ::DWORD = 1005; -pub const ERROR_FILE_INVALID: ::DWORD = 1006; -pub const ERROR_FULLSCREEN_MODE: ::DWORD = 1007; -pub const ERROR_NO_TOKEN: ::DWORD = 1008; -pub const ERROR_BADDB: ::DWORD = 1009; -pub const ERROR_BADKEY: ::DWORD = 1010; -pub const ERROR_CANTOPEN: ::DWORD = 1011; -pub const ERROR_CANTREAD: ::DWORD = 1012; -pub const ERROR_CANTWRITE: ::DWORD = 1013; -pub const ERROR_REGISTRY_RECOVERED: ::DWORD = 1014; -pub const ERROR_REGISTRY_CORRUPT: ::DWORD = 1015; -pub const ERROR_REGISTRY_IO_FAILED: ::DWORD = 1016; -pub const ERROR_NOT_REGISTRY_FILE: ::DWORD = 1017; -pub const ERROR_KEY_DELETED: ::DWORD = 1018; -pub const ERROR_NO_LOG_SPACE: ::DWORD = 1019; -pub const ERROR_KEY_HAS_CHILDREN: ::DWORD = 1020; -pub const ERROR_CHILD_MUST_BE_VOLATILE: ::DWORD = 1021; -pub const ERROR_NOTIFY_ENUM_DIR: ::DWORD = 1022; -pub const ERROR_DEPENDENT_SERVICES_RUNNING: ::DWORD = 1051; -pub const ERROR_INVALID_SERVICE_CONTROL: ::DWORD = 1052; -pub const ERROR_SERVICE_REQUEST_TIMEOUT: ::DWORD = 1053; -pub const ERROR_SERVICE_NO_THREAD: ::DWORD = 1054; -pub const ERROR_SERVICE_DATABASE_LOCKED: ::DWORD = 1055; -pub const ERROR_SERVICE_ALREADY_RUNNING: ::DWORD = 1056; -pub const ERROR_INVALID_SERVICE_ACCOUNT: ::DWORD = 1057; -pub const ERROR_SERVICE_DISABLED: ::DWORD = 1058; -pub const ERROR_CIRCULAR_DEPENDENCY: ::DWORD = 1059; -pub const ERROR_SERVICE_DOES_NOT_EXIST: ::DWORD = 1060; -pub const ERROR_SERVICE_CANNOT_ACCEPT_CTRL: ::DWORD = 1061; -pub const ERROR_SERVICE_NOT_ACTIVE: ::DWORD = 1062; -pub const ERROR_FAILED_SERVICE_CONTROLLER_CONNECT: ::DWORD = 1063; -pub const ERROR_EXCEPTION_IN_SERVICE: ::DWORD = 1064; -pub const ERROR_DATABASE_DOES_NOT_EXIST: ::DWORD = 1065; -pub const ERROR_SERVICE_SPECIFIC_ERROR: ::DWORD = 1066; -pub const ERROR_PROCESS_ABORTED: ::DWORD = 1067; -pub const ERROR_SERVICE_DEPENDENCY_FAIL: ::DWORD = 1068; -pub const ERROR_SERVICE_LOGON_FAILED: ::DWORD = 1069; -pub const ERROR_SERVICE_START_HANG: ::DWORD = 1070; -pub const ERROR_INVALID_SERVICE_LOCK: ::DWORD = 1071; -pub const ERROR_SERVICE_MARKED_FOR_DELETE: ::DWORD = 1072; -pub const ERROR_SERVICE_EXISTS: ::DWORD = 1073; -pub const ERROR_ALREADY_RUNNING_LKG: ::DWORD = 1074; -pub const ERROR_SERVICE_DEPENDENCY_DELETED: ::DWORD = 1075; -pub const ERROR_BOOT_ALREADY_ACCEPTED: ::DWORD = 1076; -pub const ERROR_SERVICE_NEVER_STARTED: ::DWORD = 1077; -pub const ERROR_DUPLICATE_SERVICE_NAME: ::DWORD = 1078; -pub const ERROR_DIFFERENT_SERVICE_ACCOUNT: ::DWORD = 1079; -pub const ERROR_CANNOT_DETECT_DRIVER_FAILURE: ::DWORD = 1080; -pub const ERROR_CANNOT_DETECT_PROCESS_ABORT: ::DWORD = 1081; -pub const ERROR_NO_RECOVERY_PROGRAM: ::DWORD = 1082; -pub const ERROR_SERVICE_NOT_IN_EXE: ::DWORD = 1083; -pub const ERROR_NOT_SAFEBOOT_SERVICE: ::DWORD = 1084; -pub const ERROR_END_OF_MEDIA: ::DWORD = 1100; -pub const ERROR_FILEMARK_DETECTED: ::DWORD = 1101; -pub const ERROR_BEGINNING_OF_MEDIA: ::DWORD = 1102; -pub const ERROR_SETMARK_DETECTED: ::DWORD = 1103; -pub const ERROR_NO_DATA_DETECTED: ::DWORD = 1104; -pub const ERROR_PARTITION_FAILURE: ::DWORD = 1105; -pub const ERROR_INVALID_BLOCK_LENGTH: ::DWORD = 1106; -pub const ERROR_DEVICE_NOT_PARTITIONED: ::DWORD = 1107; -pub const ERROR_UNABLE_TO_LOCK_MEDIA: ::DWORD = 1108; -pub const ERROR_UNABLE_TO_UNLOAD_MEDIA: ::DWORD = 1109; -pub const ERROR_MEDIA_CHANGED: ::DWORD = 1110; -pub const ERROR_BUS_RESET: ::DWORD = 1111; -pub const ERROR_NO_MEDIA_IN_DRIVE: ::DWORD = 1112; -pub const ERROR_NO_UNICODE_TRANSLATION: ::DWORD = 1113; -pub const ERROR_DLL_INIT_FAILED: ::DWORD = 1114; -pub const ERROR_SHUTDOWN_IN_PROGRESS: ::DWORD = 1115; -pub const ERROR_NO_SHUTDOWN_IN_PROGRESS: ::DWORD = 1116; -pub const ERROR_IO_DEVICE: ::DWORD = 1117; -pub const ERROR_SERIAL_NO_DEVICE: ::DWORD = 1118; -pub const ERROR_IRQ_BUSY: ::DWORD = 1119; -pub const ERROR_MORE_WRITES: ::DWORD = 1120; -pub const ERROR_COUNTER_TIMEOUT: ::DWORD = 1121; -pub const ERROR_FLOPPY_ID_MARK_NOT_FOUND: ::DWORD = 1122; -pub const ERROR_FLOPPY_WRONG_CYLINDER: ::DWORD = 1123; -pub const ERROR_FLOPPY_UNKNOWN_ERROR: ::DWORD = 1124; -pub const ERROR_FLOPPY_BAD_REGISTERS: ::DWORD = 1125; -pub const ERROR_DISK_RECALIBRATE_FAILED: ::DWORD = 1126; -pub const ERROR_DISK_OPERATION_FAILED: ::DWORD = 1127; -pub const ERROR_DISK_RESET_FAILED: ::DWORD = 1128; -pub const ERROR_EOM_OVERFLOW: ::DWORD = 1129; -pub const ERROR_NOT_ENOUGH_SERVER_MEMORY: ::DWORD = 1130; -pub const ERROR_POSSIBLE_DEADLOCK: ::DWORD = 1131; -pub const ERROR_MAPPED_ALIGNMENT: ::DWORD = 1132; -pub const ERROR_SET_POWER_STATE_VETOED: ::DWORD = 1140; -pub const ERROR_SET_POWER_STATE_FAILED: ::DWORD = 1141; -pub const ERROR_TOO_MANY_LINKS: ::DWORD = 1142; -pub const ERROR_OLD_WIN_VERSION: ::DWORD = 1150; -pub const ERROR_APP_WRONG_OS: ::DWORD = 1151; -pub const ERROR_SINGLE_INSTANCE_APP: ::DWORD = 1152; -pub const ERROR_RMODE_APP: ::DWORD = 1153; -pub const ERROR_INVALID_DLL: ::DWORD = 1154; -pub const ERROR_NO_ASSOCIATION: ::DWORD = 1155; -pub const ERROR_DDE_FAIL: ::DWORD = 1156; -pub const ERROR_DLL_NOT_FOUND: ::DWORD = 1157; -pub const ERROR_NO_MORE_USER_HANDLES: ::DWORD = 1158; -pub const ERROR_MESSAGE_SYNC_ONLY: ::DWORD = 1159; -pub const ERROR_SOURCE_ELEMENT_EMPTY: ::DWORD = 1160; -pub const ERROR_DESTINATION_ELEMENT_FULL: ::DWORD = 1161; -pub const ERROR_ILLEGAL_ELEMENT_ADDRESS: ::DWORD = 1162; -pub const ERROR_MAGAZINE_NOT_PRESENT: ::DWORD = 1163; -pub const ERROR_DEVICE_REINITIALIZATION_NEEDED: ::DWORD = 1164; -pub const ERROR_DEVICE_REQUIRES_CLEANING: ::DWORD = 1165; -pub const ERROR_DEVICE_DOOR_OPEN: ::DWORD = 1166; -pub const ERROR_DEVICE_NOT_CONNECTED: ::DWORD = 1167; -pub const ERROR_NOT_FOUND: ::DWORD = 1168; -pub const ERROR_NO_MATCH: ::DWORD = 1169; -pub const ERROR_SET_NOT_FOUND: ::DWORD = 1170; -pub const ERROR_POINT_NOT_FOUND: ::DWORD = 1171; -pub const ERROR_NO_TRACKING_SERVICE: ::DWORD = 1172; -pub const ERROR_NO_VOLUME_ID: ::DWORD = 1173; -pub const ERROR_UNABLE_TO_REMOVE_REPLACED: ::DWORD = 1175; -pub const ERROR_UNABLE_TO_MOVE_REPLACEMENT: ::DWORD = 1176; -pub const ERROR_UNABLE_TO_MOVE_REPLACEMENT_2: ::DWORD = 1177; -pub const ERROR_JOURNAL_DELETE_IN_PROGRESS: ::DWORD = 1178; -pub const ERROR_JOURNAL_NOT_ACTIVE: ::DWORD = 1179; -pub const ERROR_POTENTIAL_FILE_FOUND: ::DWORD = 1180; -pub const ERROR_JOURNAL_ENTRY_DELETED: ::DWORD = 1181; -pub const ERROR_SHUTDOWN_IS_SCHEDULED: ::DWORD = 1190; -pub const ERROR_SHUTDOWN_USERS_LOGGED_ON: ::DWORD = 1191; -pub const ERROR_BAD_DEVICE: ::DWORD = 1200; -pub const ERROR_CONNECTION_UNAVAIL: ::DWORD = 1201; -pub const ERROR_DEVICE_ALREADY_REMEMBERED: ::DWORD = 1202; -pub const ERROR_NO_NET_OR_BAD_PATH: ::DWORD = 1203; -pub const ERROR_BAD_PROVIDER: ::DWORD = 1204; -pub const ERROR_CANNOT_OPEN_PROFILE: ::DWORD = 1205; -pub const ERROR_BAD_PROFILE: ::DWORD = 1206; -pub const ERROR_NOT_CONTAINER: ::DWORD = 1207; -pub const ERROR_EXTENDED_ERROR: ::DWORD = 1208; -pub const ERROR_INVALID_GROUPNAME: ::DWORD = 1209; -pub const ERROR_INVALID_COMPUTERNAME: ::DWORD = 1210; -pub const ERROR_INVALID_EVENTNAME: ::DWORD = 1211; -pub const ERROR_INVALID_DOMAINNAME: ::DWORD = 1212; -pub const ERROR_INVALID_SERVICENAME: ::DWORD = 1213; -pub const ERROR_INVALID_NETNAME: ::DWORD = 1214; -pub const ERROR_INVALID_SHARENAME: ::DWORD = 1215; -pub const ERROR_INVALID_PASSWORDNAME: ::DWORD = 1216; -pub const ERROR_INVALID_MESSAGENAME: ::DWORD = 1217; -pub const ERROR_INVALID_MESSAGEDEST: ::DWORD = 1218; -pub const ERROR_SESSION_CREDENTIAL_CONFLICT: ::DWORD = 1219; -pub const ERROR_REMOTE_SESSION_LIMIT_EXCEEDED: ::DWORD = 1220; -pub const ERROR_DUP_DOMAINNAME: ::DWORD = 1221; -pub const ERROR_NO_NETWORK: ::DWORD = 1222; -pub const ERROR_CANCELLED: ::DWORD = 1223; -pub const ERROR_USER_MAPPED_FILE: ::DWORD = 1224; -pub const ERROR_CONNECTION_REFUSED: ::DWORD = 1225; -pub const ERROR_GRACEFUL_DISCONNECT: ::DWORD = 1226; -pub const ERROR_ADDRESS_ALREADY_ASSOCIATED: ::DWORD = 1227; -pub const ERROR_ADDRESS_NOT_ASSOCIATED: ::DWORD = 1228; -pub const ERROR_CONNECTION_INVALID: ::DWORD = 1229; -pub const ERROR_CONNECTION_ACTIVE: ::DWORD = 1230; -pub const ERROR_NETWORK_UNREACHABLE: ::DWORD = 1231; -pub const ERROR_HOST_UNREACHABLE: ::DWORD = 1232; -pub const ERROR_PROTOCOL_UNREACHABLE: ::DWORD = 1233; -pub const ERROR_PORT_UNREACHABLE: ::DWORD = 1234; -pub const ERROR_REQUEST_ABORTED: ::DWORD = 1235; -pub const ERROR_CONNECTION_ABORTED: ::DWORD = 1236; -pub const ERROR_RETRY: ::DWORD = 1237; -pub const ERROR_CONNECTION_COUNT_LIMIT: ::DWORD = 1238; -pub const ERROR_LOGIN_TIME_RESTRICTION: ::DWORD = 1239; -pub const ERROR_LOGIN_WKSTA_RESTRICTION: ::DWORD = 1240; -pub const ERROR_INCORRECT_ADDRESS: ::DWORD = 1241; -pub const ERROR_ALREADY_REGISTERED: ::DWORD = 1242; -pub const ERROR_SERVICE_NOT_FOUND: ::DWORD = 1243; -pub const ERROR_NOT_AUTHENTICATED: ::DWORD = 1244; -pub const ERROR_NOT_LOGGED_ON: ::DWORD = 1245; -pub const ERROR_CONTINUE: ::DWORD = 1246; -pub const ERROR_ALREADY_INITIALIZED: ::DWORD = 1247; -pub const ERROR_NO_MORE_DEVICES: ::DWORD = 1248; -pub const ERROR_NO_SUCH_SITE: ::DWORD = 1249; -pub const ERROR_DOMAIN_CONTROLLER_EXISTS: ::DWORD = 1250; -pub const ERROR_ONLY_IF_CONNECTED: ::DWORD = 1251; -pub const ERROR_OVERRIDE_NOCHANGES: ::DWORD = 1252; -pub const ERROR_BAD_USER_PROFILE: ::DWORD = 1253; -pub const ERROR_NOT_SUPPORTED_ON_SBS: ::DWORD = 1254; -pub const ERROR_SERVER_SHUTDOWN_IN_PROGRESS: ::DWORD = 1255; -pub const ERROR_HOST_DOWN: ::DWORD = 1256; -pub const ERROR_NON_ACCOUNT_SID: ::DWORD = 1257; -pub const ERROR_NON_DOMAIN_SID: ::DWORD = 1258; -pub const ERROR_APPHELP_BLOCK: ::DWORD = 1259; -pub const ERROR_ACCESS_DISABLED_BY_POLICY: ::DWORD = 1260; -pub const ERROR_REG_NAT_CONSUMPTION: ::DWORD = 1261; -pub const ERROR_CSCSHARE_OFFLINE: ::DWORD = 1262; -pub const ERROR_PKINIT_FAILURE: ::DWORD = 1263; -pub const ERROR_SMARTCARD_SUBSYSTEM_FAILURE: ::DWORD = 1264; -pub const ERROR_DOWNGRADE_DETECTED: ::DWORD = 1265; -pub const ERROR_MACHINE_LOCKED: ::DWORD = 1271; -pub const ERROR_CALLBACK_SUPPLIED_INVALID_DATA: ::DWORD = 1273; -pub const ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED: ::DWORD = 1274; -pub const ERROR_DRIVER_BLOCKED: ::DWORD = 1275; -pub const ERROR_INVALID_IMPORT_OF_NON_DLL: ::DWORD = 1276; -pub const ERROR_ACCESS_DISABLED_WEBBLADE: ::DWORD = 1277; -pub const ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER: ::DWORD = 1278; -pub const ERROR_RECOVERY_FAILURE: ::DWORD = 1279; -pub const ERROR_ALREADY_FIBER: ::DWORD = 1280; -pub const ERROR_ALREADY_THREAD: ::DWORD = 1281; -pub const ERROR_STACK_BUFFER_OVERRUN: ::DWORD = 1282; -pub const ERROR_PARAMETER_QUOTA_EXCEEDED: ::DWORD = 1283; -pub const ERROR_DEBUGGER_INACTIVE: ::DWORD = 1284; -pub const ERROR_DELAY_LOAD_FAILED: ::DWORD = 1285; -pub const ERROR_VDM_DISALLOWED: ::DWORD = 1286; -pub const ERROR_UNIDENTIFIED_ERROR: ::DWORD = 1287; -pub const ERROR_INVALID_CRUNTIME_PARAMETER: ::DWORD = 1288; -pub const ERROR_BEYOND_VDL: ::DWORD = 1289; -pub const ERROR_INCOMPATIBLE_SERVICE_SID_TYPE: ::DWORD = 1290; -pub const ERROR_DRIVER_PROCESS_TERMINATED: ::DWORD = 1291; -pub const ERROR_IMPLEMENTATION_LIMIT: ::DWORD = 1292; -pub const ERROR_PROCESS_IS_PROTECTED: ::DWORD = 1293; -pub const ERROR_SERVICE_NOTIFY_CLIENT_LAGGING: ::DWORD = 1294; -pub const ERROR_DISK_QUOTA_EXCEEDED: ::DWORD = 1295; -pub const ERROR_CONTENT_BLOCKED: ::DWORD = 1296; -pub const ERROR_INCOMPATIBLE_SERVICE_PRIVILEGE: ::DWORD = 1297; -pub const ERROR_APP_HANG: ::DWORD = 1298; -pub const ERROR_INVALID_LABEL: ::DWORD = 1299; -pub const ERROR_NOT_ALL_ASSIGNED: ::DWORD = 1300; -pub const ERROR_SOME_NOT_MAPPED: ::DWORD = 1301; -pub const ERROR_NO_QUOTAS_FOR_ACCOUNT: ::DWORD = 1302; -pub const ERROR_LOCAL_USER_SESSION_KEY: ::DWORD = 1303; -pub const ERROR_NULL_LM_PASSWORD: ::DWORD = 1304; -pub const ERROR_UNKNOWN_REVISION: ::DWORD = 1305; -pub const ERROR_REVISION_MISMATCH: ::DWORD = 1306; -pub const ERROR_INVALID_OWNER: ::DWORD = 1307; -pub const ERROR_INVALID_PRIMARY_GROUP: ::DWORD = 1308; -pub const ERROR_NO_IMPERSONATION_TOKEN: ::DWORD = 1309; -pub const ERROR_CANT_DISABLE_MANDATORY: ::DWORD = 1310; -pub const ERROR_NO_LOGON_SERVERS: ::DWORD = 1311; -pub const ERROR_NO_SUCH_LOGON_SESSION: ::DWORD = 1312; -pub const ERROR_NO_SUCH_PRIVILEGE: ::DWORD = 1313; -pub const ERROR_PRIVILEGE_NOT_HELD: ::DWORD = 1314; -pub const ERROR_INVALID_ACCOUNT_NAME: ::DWORD = 1315; -pub const ERROR_USER_EXISTS: ::DWORD = 1316; -pub const ERROR_NO_SUCH_USER: ::DWORD = 1317; -pub const ERROR_GROUP_EXISTS: ::DWORD = 1318; -pub const ERROR_NO_SUCH_GROUP: ::DWORD = 1319; -pub const ERROR_MEMBER_IN_GROUP: ::DWORD = 1320; -pub const ERROR_MEMBER_NOT_IN_GROUP: ::DWORD = 1321; -pub const ERROR_LAST_ADMIN: ::DWORD = 1322; -pub const ERROR_WRONG_PASSWORD: ::DWORD = 1323; -pub const ERROR_ILL_FORMED_PASSWORD: ::DWORD = 1324; -pub const ERROR_PASSWORD_RESTRICTION: ::DWORD = 1325; -pub const ERROR_LOGON_FAILURE: ::DWORD = 1326; -pub const ERROR_ACCOUNT_RESTRICTION: ::DWORD = 1327; -pub const ERROR_INVALID_LOGON_HOURS: ::DWORD = 1328; -pub const ERROR_INVALID_WORKSTATION: ::DWORD = 1329; -pub const ERROR_PASSWORD_EXPIRED: ::DWORD = 1330; -pub const ERROR_ACCOUNT_DISABLED: ::DWORD = 1331; -pub const ERROR_NONE_MAPPED: ::DWORD = 1332; -pub const ERROR_TOO_MANY_LUIDS_REQUESTED: ::DWORD = 1333; -pub const ERROR_LUIDS_EXHAUSTED: ::DWORD = 1334; -pub const ERROR_INVALID_SUB_AUTHORITY: ::DWORD = 1335; -pub const ERROR_INVALID_ACL: ::DWORD = 1336; -pub const ERROR_INVALID_SID: ::DWORD = 1337; -pub const ERROR_INVALID_SECURITY_DESCR: ::DWORD = 1338; -pub const ERROR_BAD_INHERITANCE_ACL: ::DWORD = 1340; -pub const ERROR_SERVER_DISABLED: ::DWORD = 1341; -pub const ERROR_SERVER_NOT_DISABLED: ::DWORD = 1342; -pub const ERROR_INVALID_ID_AUTHORITY: ::DWORD = 1343; -pub const ERROR_ALLOTTED_SPACE_EXCEEDED: ::DWORD = 1344; -pub const ERROR_INVALID_GROUP_ATTRIBUTES: ::DWORD = 1345; -pub const ERROR_BAD_IMPERSONATION_LEVEL: ::DWORD = 1346; -pub const ERROR_CANT_OPEN_ANONYMOUS: ::DWORD = 1347; -pub const ERROR_BAD_VALIDATION_CLASS: ::DWORD = 1348; -pub const ERROR_BAD_TOKEN_TYPE: ::DWORD = 1349; -pub const ERROR_NO_SECURITY_ON_OBJECT: ::DWORD = 1350; -pub const ERROR_CANT_ACCESS_DOMAIN_INFO: ::DWORD = 1351; -pub const ERROR_INVALID_SERVER_STATE: ::DWORD = 1352; -pub const ERROR_INVALID_DOMAIN_STATE: ::DWORD = 1353; -pub const ERROR_INVALID_DOMAIN_ROLE: ::DWORD = 1354; -pub const ERROR_NO_SUCH_DOMAIN: ::DWORD = 1355; -pub const ERROR_DOMAIN_EXISTS: ::DWORD = 1356; -pub const ERROR_DOMAIN_LIMIT_EXCEEDED: ::DWORD = 1357; -pub const ERROR_INTERNAL_DB_CORRUPTION: ::DWORD = 1358; -pub const ERROR_INTERNAL_ERROR: ::DWORD = 1359; -pub const ERROR_GENERIC_NOT_MAPPED: ::DWORD = 1360; -pub const ERROR_BAD_DESCRIPTOR_FORMAT: ::DWORD = 1361; -pub const ERROR_NOT_LOGON_PROCESS: ::DWORD = 1362; -pub const ERROR_LOGON_SESSION_EXISTS: ::DWORD = 1363; -pub const ERROR_NO_SUCH_PACKAGE: ::DWORD = 1364; -pub const ERROR_BAD_LOGON_SESSION_STATE: ::DWORD = 1365; -pub const ERROR_LOGON_SESSION_COLLISION: ::DWORD = 1366; -pub const ERROR_INVALID_LOGON_TYPE: ::DWORD = 1367; -pub const ERROR_CANNOT_IMPERSONATE: ::DWORD = 1368; -pub const ERROR_RXACT_INVALID_STATE: ::DWORD = 1369; -pub const ERROR_RXACT_COMMIT_FAILURE: ::DWORD = 1370; -pub const ERROR_SPECIAL_ACCOUNT: ::DWORD = 1371; -pub const ERROR_SPECIAL_GROUP: ::DWORD = 1372; -pub const ERROR_SPECIAL_USER: ::DWORD = 1373; -pub const ERROR_MEMBERS_PRIMARY_GROUP: ::DWORD = 1374; -pub const ERROR_TOKEN_ALREADY_IN_USE: ::DWORD = 1375; -pub const ERROR_NO_SUCH_ALIAS: ::DWORD = 1376; -pub const ERROR_MEMBER_NOT_IN_ALIAS: ::DWORD = 1377; -pub const ERROR_MEMBER_IN_ALIAS: ::DWORD = 1378; -pub const ERROR_ALIAS_EXISTS: ::DWORD = 1379; -pub const ERROR_LOGON_NOT_GRANTED: ::DWORD = 1380; -pub const ERROR_TOO_MANY_SECRETS: ::DWORD = 1381; -pub const ERROR_SECRET_TOO_LONG: ::DWORD = 1382; -pub const ERROR_INTERNAL_DB_ERROR: ::DWORD = 1383; -pub const ERROR_TOO_MANY_CONTEXT_IDS: ::DWORD = 1384; -pub const ERROR_LOGON_TYPE_NOT_GRANTED: ::DWORD = 1385; -pub const ERROR_NT_CROSS_ENCRYPTION_REQUIRED: ::DWORD = 1386; -pub const ERROR_NO_SUCH_MEMBER: ::DWORD = 1387; -pub const ERROR_INVALID_MEMBER: ::DWORD = 1388; -pub const ERROR_TOO_MANY_SIDS: ::DWORD = 1389; -pub const ERROR_LM_CROSS_ENCRYPTION_REQUIRED: ::DWORD = 1390; -pub const ERROR_NO_INHERITANCE: ::DWORD = 1391; -pub const ERROR_FILE_CORRUPT: ::DWORD = 1392; -pub const ERROR_DISK_CORRUPT: ::DWORD = 1393; -pub const ERROR_NO_USER_SESSION_KEY: ::DWORD = 1394; -pub const ERROR_LICENSE_QUOTA_EXCEEDED: ::DWORD = 1395; -pub const ERROR_WRONG_TARGET_NAME: ::DWORD = 1396; -pub const ERROR_MUTUAL_AUTH_FAILED: ::DWORD = 1397; -pub const ERROR_TIME_SKEW: ::DWORD = 1398; -pub const ERROR_CURRENT_DOMAIN_NOT_ALLOWED: ::DWORD = 1399; -pub const ERROR_INVALID_WINDOW_HANDLE: ::DWORD = 1400; -pub const ERROR_INVALID_MENU_HANDLE: ::DWORD = 1401; -pub const ERROR_INVALID_CURSOR_HANDLE: ::DWORD = 1402; -pub const ERROR_INVALID_ACCEL_HANDLE: ::DWORD = 1403; -pub const ERROR_INVALID_HOOK_HANDLE: ::DWORD = 1404; -pub const ERROR_INVALID_DWP_HANDLE: ::DWORD = 1405; -pub const ERROR_TLW_WITH_WSCHILD: ::DWORD = 1406; -pub const ERROR_CANNOT_FIND_WND_CLASS: ::DWORD = 1407; -pub const ERROR_WINDOW_OF_OTHER_THREAD: ::DWORD = 1408; -pub const ERROR_HOTKEY_ALREADY_REGISTERED: ::DWORD = 1409; -pub const ERROR_CLASS_ALREADY_EXISTS: ::DWORD = 1410; -pub const ERROR_CLASS_DOES_NOT_EXIST: ::DWORD = 1411; -pub const ERROR_CLASS_HAS_WINDOWS: ::DWORD = 1412; -pub const ERROR_INVALID_INDEX: ::DWORD = 1413; -pub const ERROR_INVALID_ICON_HANDLE: ::DWORD = 1414; -pub const ERROR_PRIVATE_DIALOG_INDEX: ::DWORD = 1415; -pub const ERROR_LISTBOX_ID_NOT_FOUND: ::DWORD = 1416; -pub const ERROR_NO_WILDCARD_CHARACTERS: ::DWORD = 1417; -pub const ERROR_CLIPBOARD_NOT_OPEN: ::DWORD = 1418; -pub const ERROR_HOTKEY_NOT_REGISTERED: ::DWORD = 1419; -pub const ERROR_WINDOW_NOT_DIALOG: ::DWORD = 1420; -pub const ERROR_CONTROL_ID_NOT_FOUND: ::DWORD = 1421; -pub const ERROR_INVALID_COMBOBOX_MESSAGE: ::DWORD = 1422; -pub const ERROR_WINDOW_NOT_COMBOBOX: ::DWORD = 1423; -pub const ERROR_INVALID_EDIT_HEIGHT: ::DWORD = 1424; -pub const ERROR_DC_NOT_FOUND: ::DWORD = 1425; -pub const ERROR_INVALID_HOOK_FILTER: ::DWORD = 1426; -pub const ERROR_INVALID_FILTER_PROC: ::DWORD = 1427; -pub const ERROR_HOOK_NEEDS_HMOD: ::DWORD = 1428; -pub const ERROR_GLOBAL_ONLY_HOOK: ::DWORD = 1429; -pub const ERROR_JOURNAL_HOOK_SET: ::DWORD = 1430; -pub const ERROR_HOOK_NOT_INSTALLED: ::DWORD = 1431; -pub const ERROR_INVALID_LB_MESSAGE: ::DWORD = 1432; -pub const ERROR_SETCOUNT_ON_BAD_LB: ::DWORD = 1433; -pub const ERROR_LB_WITHOUT_TABSTOPS: ::DWORD = 1434; -pub const ERROR_DESTROY_OBJECT_OF_OTHER_THREAD: ::DWORD = 1435; -pub const ERROR_CHILD_WINDOW_MENU: ::DWORD = 1436; -pub const ERROR_NO_SYSTEM_MENU: ::DWORD = 1437; -pub const ERROR_INVALID_MSGBOX_STYLE: ::DWORD = 1438; -pub const ERROR_INVALID_SPI_VALUE: ::DWORD = 1439; -pub const ERROR_SCREEN_ALREADY_LOCKED: ::DWORD = 1440; -pub const ERROR_HWNDS_HAVE_DIFF_PARENT: ::DWORD = 1441; -pub const ERROR_NOT_CHILD_WINDOW: ::DWORD = 1442; -pub const ERROR_INVALID_GW_COMMAND: ::DWORD = 1443; -pub const ERROR_INVALID_THREAD_ID: ::DWORD = 1444; -pub const ERROR_NON_MDICHILD_WINDOW: ::DWORD = 1445; -pub const ERROR_POPUP_ALREADY_ACTIVE: ::DWORD = 1446; -pub const ERROR_NO_SCROLLBARS: ::DWORD = 1447; -pub const ERROR_INVALID_SCROLLBAR_RANGE: ::DWORD = 1448; -pub const ERROR_INVALID_SHOWWIN_COMMAND: ::DWORD = 1449; -pub const ERROR_NO_SYSTEM_RESOURCES: ::DWORD = 1450; -pub const ERROR_NONPAGED_SYSTEM_RESOURCES: ::DWORD = 1451; -pub const ERROR_PAGED_SYSTEM_RESOURCES: ::DWORD = 1452; -pub const ERROR_WORKING_SET_QUOTA: ::DWORD = 1453; -pub const ERROR_PAGEFILE_QUOTA: ::DWORD = 1454; -pub const ERROR_COMMITMENT_LIMIT: ::DWORD = 1455; -pub const ERROR_MENU_ITEM_NOT_FOUND: ::DWORD = 1456; -pub const ERROR_INVALID_KEYBOARD_HANDLE: ::DWORD = 1457; -pub const ERROR_HOOK_TYPE_NOT_ALLOWED: ::DWORD = 1458; -pub const ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION: ::DWORD = 1459; -pub const ERROR_TIMEOUT: ::DWORD = 1460; -pub const ERROR_INVALID_MONITOR_HANDLE: ::DWORD = 1461; -pub const ERROR_INCORRECT_SIZE: ::DWORD = 1462; -pub const ERROR_SYMLINK_CLASS_DISABLED: ::DWORD = 1463; -pub const ERROR_SYMLINK_NOT_SUPPORTED: ::DWORD = 1464; -pub const ERROR_XML_PARSE_ERROR: ::DWORD = 1465; -pub const ERROR_XMLDSIG_ERROR: ::DWORD = 1466; -pub const ERROR_RESTART_APPLICATION: ::DWORD = 1467; -pub const ERROR_WRONG_COMPARTMENT: ::DWORD = 1468; -pub const ERROR_AUTHIP_FAILURE: ::DWORD = 1469; -pub const ERROR_NO_NVRAM_RESOURCES: ::DWORD = 1470; -pub const ERROR_NOT_GUI_PROCESS: ::DWORD = 1471; -pub const ERROR_EVENTLOG_FILE_CORRUPT: ::DWORD = 1500; -pub const ERROR_EVENTLOG_CANT_START: ::DWORD = 1501; -pub const ERROR_LOG_FILE_FULL: ::DWORD = 1502; -pub const ERROR_EVENTLOG_FILE_CHANGED: ::DWORD = 1503; -pub const ERROR_INVALID_TASK_NAME: ::DWORD = 1550; -pub const ERROR_INVALID_TASK_INDEX: ::DWORD = 1551; -pub const ERROR_THREAD_ALREADY_IN_TASK: ::DWORD = 1552; -pub const ERROR_INSTALL_SERVICE_FAILURE: ::DWORD = 1601; -pub const ERROR_INSTALL_USEREXIT: ::DWORD = 1602; -pub const ERROR_INSTALL_FAILURE: ::DWORD = 1603; -pub const ERROR_INSTALL_SUSPEND: ::DWORD = 1604; -pub const ERROR_UNKNOWN_PRODUCT: ::DWORD = 1605; -pub const ERROR_UNKNOWN_FEATURE: ::DWORD = 1606; -pub const ERROR_UNKNOWN_COMPONENT: ::DWORD = 1607; -pub const ERROR_UNKNOWN_PROPERTY: ::DWORD = 1608; -pub const ERROR_INVALID_HANDLE_STATE: ::DWORD = 1609; -pub const ERROR_BAD_CONFIGURATION: ::DWORD = 1610; -pub const ERROR_INDEX_ABSENT: ::DWORD = 1611; -pub const ERROR_INSTALL_SOURCE_ABSENT: ::DWORD = 1612; -pub const ERROR_INSTALL_PACKAGE_VERSION: ::DWORD = 1613; -pub const ERROR_PRODUCT_UNINSTALLED: ::DWORD = 1614; -pub const ERROR_BAD_QUERY_SYNTAX: ::DWORD = 1615; -pub const ERROR_INVALID_FIELD: ::DWORD = 1616; -pub const ERROR_DEVICE_REMOVED: ::DWORD = 1617; -pub const ERROR_INSTALL_ALREADY_RUNNING: ::DWORD = 1618; -pub const ERROR_INSTALL_PACKAGE_OPEN_FAILED: ::DWORD = 1619; -pub const ERROR_INSTALL_PACKAGE_INVALID: ::DWORD = 1620; -pub const ERROR_INSTALL_UI_FAILURE: ::DWORD = 1621; -pub const ERROR_INSTALL_LOG_FAILURE: ::DWORD = 1622; -pub const ERROR_INSTALL_LANGUAGE_UNSUPPORTED: ::DWORD = 1623; -pub const ERROR_INSTALL_TRANSFORM_FAILURE: ::DWORD = 1624; -pub const ERROR_INSTALL_PACKAGE_REJECTED: ::DWORD = 1625; -pub const ERROR_FUNCTION_NOT_CALLED: ::DWORD = 1626; -pub const ERROR_FUNCTION_FAILED: ::DWORD = 1627; -pub const ERROR_INVALID_TABLE: ::DWORD = 1628; -pub const ERROR_DATATYPE_MISMATCH: ::DWORD = 1629; -pub const ERROR_UNSUPPORTED_TYPE: ::DWORD = 1630; -pub const ERROR_CREATE_FAILED: ::DWORD = 1631; -pub const ERROR_INSTALL_TEMP_UNWRITABLE: ::DWORD = 1632; -pub const ERROR_INSTALL_PLATFORM_UNSUPPORTED: ::DWORD = 1633; -pub const ERROR_INSTALL_NOTUSED: ::DWORD = 1634; -pub const ERROR_PATCH_PACKAGE_OPEN_FAILED: ::DWORD = 1635; -pub const ERROR_PATCH_PACKAGE_INVALID: ::DWORD = 1636; -pub const ERROR_PATCH_PACKAGE_UNSUPPORTED: ::DWORD = 1637; -pub const ERROR_PRODUCT_VERSION: ::DWORD = 1638; -pub const ERROR_INVALID_COMMAND_LINE: ::DWORD = 1639; -pub const ERROR_INSTALL_REMOTE_DISALLOWED: ::DWORD = 1640; -pub const ERROR_SUCCESS_REBOOT_INITIATED: ::DWORD = 1641; -pub const ERROR_PATCH_TARGET_NOT_FOUND: ::DWORD = 1642; -pub const ERROR_PATCH_PACKAGE_REJECTED: ::DWORD = 1643; -pub const ERROR_INSTALL_TRANSFORM_REJECTED: ::DWORD = 1644; -pub const ERROR_INSTALL_REMOTE_PROHIBITED: ::DWORD = 1645; -pub const ERROR_PATCH_REMOVAL_UNSUPPORTED: ::DWORD = 1646; -pub const ERROR_UNKNOWN_PATCH: ::DWORD = 1647; -pub const ERROR_PATCH_NO_SEQUENCE: ::DWORD = 1648; -pub const ERROR_PATCH_REMOVAL_DISALLOWED: ::DWORD = 1649; -pub const ERROR_INVALID_PATCH_XML: ::DWORD = 1650; -pub const ERROR_PATCH_MANAGED_ADVERTISED_PRODUCT: ::DWORD = 1651; -pub const ERROR_INSTALL_SERVICE_SAFEBOOT: ::DWORD = 1652; -pub const ERROR_FAIL_FAST_EXCEPTION: ::DWORD = 1653; -pub const ERROR_INSTALL_REJECTED: ::DWORD = 1654; -pub const ERROR_DYNAMIC_CODE_BLOCKED: ::DWORD = 1655; -pub const RPC_S_INVALID_STRING_BINDING: ::DWORD = 1700; -pub const RPC_S_WRONG_KIND_OF_BINDING: ::DWORD = 1701; -pub const RPC_S_INVALID_BINDING: ::DWORD = 1702; -pub const RPC_S_PROTSEQ_NOT_SUPPORTED: ::DWORD = 1703; -pub const RPC_S_INVALID_RPC_PROTSEQ: ::DWORD = 1704; -pub const RPC_S_INVALID_STRING_UUID: ::DWORD = 1705; -pub const RPC_S_INVALID_ENDPOINT_FORMAT: ::DWORD = 1706; -pub const RPC_S_INVALID_NET_ADDR: ::DWORD = 1707; -pub const RPC_S_NO_ENDPOINT_FOUND: ::DWORD = 1708; -pub const RPC_S_INVALID_TIMEOUT: ::DWORD = 1709; -pub const RPC_S_OBJECT_NOT_FOUND: ::DWORD = 1710; -pub const RPC_S_ALREADY_REGISTERED: ::DWORD = 1711; -pub const RPC_S_TYPE_ALREADY_REGISTERED: ::DWORD = 1712; -pub const RPC_S_ALREADY_LISTENING: ::DWORD = 1713; -pub const RPC_S_NO_PROTSEQS_REGISTERED: ::DWORD = 1714; -pub const RPC_S_NOT_LISTENING: ::DWORD = 1715; -pub const RPC_S_UNKNOWN_MGR_TYPE: ::DWORD = 1716; -pub const RPC_S_UNKNOWN_IF: ::DWORD = 1717; -pub const RPC_S_NO_BINDINGS: ::DWORD = 1718; -pub const RPC_S_NO_PROTSEQS: ::DWORD = 1719; -pub const RPC_S_CANT_CREATE_ENDPOINT: ::DWORD = 1720; -pub const RPC_S_OUT_OF_RESOURCES: ::DWORD = 1721; -pub const RPC_S_SERVER_UNAVAILABLE: ::DWORD = 1722; -pub const RPC_S_SERVER_TOO_BUSY: ::DWORD = 1723; -pub const RPC_S_INVALID_NETWORK_OPTIONS: ::DWORD = 1724; -pub const RPC_S_NO_CALL_ACTIVE: ::DWORD = 1725; -pub const RPC_S_CALL_FAILED: ::DWORD = 1726; -pub const RPC_S_CALL_FAILED_DNE: ::DWORD = 1727; -pub const RPC_S_PROTOCOL_ERROR: ::DWORD = 1728; -pub const RPC_S_PROXY_ACCESS_DENIED: ::DWORD = 1729; -pub const RPC_S_UNSUPPORTED_TRANS_SYN: ::DWORD = 1730; -pub const RPC_S_UNSUPPORTED_TYPE: ::DWORD = 1732; -pub const RPC_S_INVALID_TAG: ::DWORD = 1733; -pub const RPC_S_INVALID_BOUND: ::DWORD = 1734; -pub const RPC_S_NO_ENTRY_NAME: ::DWORD = 1735; -pub const RPC_S_INVALID_NAME_SYNTAX: ::DWORD = 1736; -pub const RPC_S_UNSUPPORTED_NAME_SYNTAX: ::DWORD = 1737; -pub const RPC_S_UUID_NO_ADDRESS: ::DWORD = 1739; -pub const RPC_S_DUPLICATE_ENDPOINT: ::DWORD = 1740; -pub const RPC_S_UNKNOWN_AUTHN_TYPE: ::DWORD = 1741; -pub const RPC_S_MAX_CALLS_TOO_SMALL: ::DWORD = 1742; -pub const RPC_S_STRING_TOO_LONG: ::DWORD = 1743; -pub const RPC_S_PROTSEQ_NOT_FOUND: ::DWORD = 1744; -pub const RPC_S_PROCNUM_OUT_OF_RANGE: ::DWORD = 1745; -pub const RPC_S_BINDING_HAS_NO_AUTH: ::DWORD = 1746; -pub const RPC_S_UNKNOWN_AUTHN_SERVICE: ::DWORD = 1747; -pub const RPC_S_UNKNOWN_AUTHN_LEVEL: ::DWORD = 1748; -pub const RPC_S_INVALID_AUTH_IDENTITY: ::DWORD = 1749; -pub const RPC_S_UNKNOWN_AUTHZ_SERVICE: ::DWORD = 1750; -pub const EPT_S_INVALID_ENTRY: ::DWORD = 1751; -pub const EPT_S_CANT_PERFORM_OP: ::DWORD = 1752; -pub const EPT_S_NOT_REGISTERED: ::DWORD = 1753; -pub const RPC_S_NOTHING_TO_EXPORT: ::DWORD = 1754; -pub const RPC_S_INCOMPLETE_NAME: ::DWORD = 1755; -pub const RPC_S_INVALID_VERS_OPTION: ::DWORD = 1756; -pub const RPC_S_NO_MORE_MEMBERS: ::DWORD = 1757; -pub const RPC_S_NOT_ALL_OBJS_UNEXPORTED: ::DWORD = 1758; -pub const RPC_S_INTERFACE_NOT_FOUND: ::DWORD = 1759; -pub const RPC_S_ENTRY_ALREADY_EXISTS: ::DWORD = 1760; -pub const RPC_S_ENTRY_NOT_FOUND: ::DWORD = 1761; -pub const RPC_S_NAME_SERVICE_UNAVAILABLE: ::DWORD = 1762; -pub const RPC_S_INVALID_NAF_ID: ::DWORD = 1763; -pub const RPC_S_CANNOT_SUPPORT: ::DWORD = 1764; -pub const RPC_S_NO_CONTEXT_AVAILABLE: ::DWORD = 1765; -pub const RPC_S_INTERNAL_ERROR: ::DWORD = 1766; -pub const RPC_S_ZERO_DIVIDE: ::DWORD = 1767; -pub const RPC_S_ADDRESS_ERROR: ::DWORD = 1768; -pub const RPC_S_FP_DIV_ZERO: ::DWORD = 1769; -pub const RPC_S_FP_UNDERFLOW: ::DWORD = 1770; -pub const RPC_S_FP_OVERFLOW: ::DWORD = 1771; -pub const RPC_X_NO_MORE_ENTRIES: ::DWORD = 1772; -pub const RPC_X_SS_CHAR_TRANS_OPEN_FAIL: ::DWORD = 1773; -pub const RPC_X_SS_CHAR_TRANS_SHORT_FILE: ::DWORD = 1774; -pub const RPC_X_SS_IN_NULL_CONTEXT: ::DWORD = 1775; -pub const RPC_X_SS_CONTEXT_DAMAGED: ::DWORD = 1777; -pub const RPC_X_SS_HANDLES_MISMATCH: ::DWORD = 1778; -pub const RPC_X_SS_CANNOT_GET_CALL_HANDLE: ::DWORD = 1779; -pub const RPC_X_NULL_REF_POINTER: ::DWORD = 1780; -pub const RPC_X_ENUM_VALUE_OUT_OF_RANGE: ::DWORD = 1781; -pub const RPC_X_BYTE_COUNT_TOO_SMALL: ::DWORD = 1782; -pub const RPC_X_BAD_STUB_DATA: ::DWORD = 1783; -pub const ERROR_INVALID_USER_BUFFER: ::DWORD = 1784; -pub const ERROR_UNRECOGNIZED_MEDIA: ::DWORD = 1785; -pub const ERROR_NO_TRUST_LSA_SECRET: ::DWORD = 1786; -pub const ERROR_NO_TRUST_SAM_ACCOUNT: ::DWORD = 1787; -pub const ERROR_TRUSTED_DOMAIN_FAILURE: ::DWORD = 1788; -pub const ERROR_TRUSTED_RELATIONSHIP_FAILURE: ::DWORD = 1789; -pub const ERROR_TRUST_FAILURE: ::DWORD = 1790; -pub const RPC_S_CALL_IN_PROGRESS: ::DWORD = 1791; -pub const ERROR_NETLOGON_NOT_STARTED: ::DWORD = 1792; -pub const ERROR_ACCOUNT_EXPIRED: ::DWORD = 1793; -pub const ERROR_REDIRECTOR_HAS_OPEN_HANDLES: ::DWORD = 1794; -pub const ERROR_PRINTER_DRIVER_ALREADY_INSTALLED: ::DWORD = 1795; -pub const ERROR_UNKNOWN_PORT: ::DWORD = 1796; -pub const ERROR_UNKNOWN_PRINTER_DRIVER: ::DWORD = 1797; -pub const ERROR_UNKNOWN_PRINTPROCESSOR: ::DWORD = 1798; -pub const ERROR_INVALID_SEPARATOR_FILE: ::DWORD = 1799; -pub const ERROR_INVALID_PRIORITY: ::DWORD = 1800; -pub const ERROR_INVALID_PRINTER_NAME: ::DWORD = 1801; -pub const ERROR_PRINTER_ALREADY_EXISTS: ::DWORD = 1802; -pub const ERROR_INVALID_PRINTER_COMMAND: ::DWORD = 1803; -pub const ERROR_INVALID_DATATYPE: ::DWORD = 1804; -pub const ERROR_INVALID_ENVIRONMENT: ::DWORD = 1805; -pub const RPC_S_NO_MORE_BINDINGS: ::DWORD = 1806; -pub const ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT: ::DWORD = 1807; -pub const ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT: ::DWORD = 1808; -pub const ERROR_NOLOGON_SERVER_TRUST_ACCOUNT: ::DWORD = 1809; -pub const ERROR_DOMAIN_TRUST_INCONSISTENT: ::DWORD = 1810; -pub const ERROR_SERVER_HAS_OPEN_HANDLES: ::DWORD = 1811; -pub const ERROR_RESOURCE_DATA_NOT_FOUND: ::DWORD = 1812; -pub const ERROR_RESOURCE_TYPE_NOT_FOUND: ::DWORD = 1813; -pub const ERROR_RESOURCE_NAME_NOT_FOUND: ::DWORD = 1814; -pub const ERROR_RESOURCE_LANG_NOT_FOUND: ::DWORD = 1815; -pub const ERROR_NOT_ENOUGH_QUOTA: ::DWORD = 1816; -pub const RPC_S_NO_INTERFACES: ::DWORD = 1817; -pub const RPC_S_CALL_CANCELLED: ::DWORD = 1818; -pub const RPC_S_BINDING_INCOMPLETE: ::DWORD = 1819; -pub const RPC_S_COMM_FAILURE: ::DWORD = 1820; -pub const RPC_S_UNSUPPORTED_AUTHN_LEVEL: ::DWORD = 1821; -pub const RPC_S_NO_PRINC_NAME: ::DWORD = 1822; -pub const RPC_S_NOT_RPC_ERROR: ::DWORD = 1823; -pub const RPC_S_UUID_LOCAL_ONLY: ::DWORD = 1824; -pub const RPC_S_SEC_PKG_ERROR: ::DWORD = 1825; -pub const RPC_S_NOT_CANCELLED: ::DWORD = 1826; -pub const RPC_X_INVALID_ES_ACTION: ::DWORD = 1827; -pub const RPC_X_WRONG_ES_VERSION: ::DWORD = 1828; -pub const RPC_X_WRONG_STUB_VERSION: ::DWORD = 1829; -pub const RPC_X_INVALID_PIPE_OBJECT: ::DWORD = 1830; -pub const RPC_X_WRONG_PIPE_ORDER: ::DWORD = 1831; -pub const RPC_X_WRONG_PIPE_VERSION: ::DWORD = 1832; -pub const RPC_S_COOKIE_AUTH_FAILED: ::DWORD = 1833; -pub const RPC_S_GROUP_MEMBER_NOT_FOUND: ::DWORD = 1898; -pub const EPT_S_CANT_CREATE: ::DWORD = 1899; -pub const RPC_S_INVALID_OBJECT: ::DWORD = 1900; -pub const ERROR_INVALID_TIME: ::DWORD = 1901; -pub const ERROR_INVALID_FORM_NAME: ::DWORD = 1902; -pub const ERROR_INVALID_FORM_SIZE: ::DWORD = 1903; -pub const ERROR_ALREADY_WAITING: ::DWORD = 1904; -pub const ERROR_PRINTER_DELETED: ::DWORD = 1905; -pub const ERROR_INVALID_PRINTER_STATE: ::DWORD = 1906; -pub const ERROR_PASSWORD_MUST_CHANGE: ::DWORD = 1907; -pub const ERROR_DOMAIN_CONTROLLER_NOT_FOUND: ::DWORD = 1908; -pub const ERROR_ACCOUNT_LOCKED_OUT: ::DWORD = 1909; -pub const OR_INVALID_OXID: ::DWORD = 1910; -pub const OR_INVALID_OID: ::DWORD = 1911; -pub const OR_INVALID_SET: ::DWORD = 1912; -pub const RPC_S_SEND_INCOMPLETE: ::DWORD = 1913; -pub const RPC_S_INVALID_ASYNC_HANDLE: ::DWORD = 1914; -pub const RPC_S_INVALID_ASYNC_CALL: ::DWORD = 1915; -pub const RPC_X_PIPE_CLOSED: ::DWORD = 1916; -pub const RPC_X_PIPE_DISCIPLINE_ERROR: ::DWORD = 1917; -pub const RPC_X_PIPE_EMPTY: ::DWORD = 1918; -pub const ERROR_NO_SITENAME: ::DWORD = 1919; -pub const ERROR_CANT_ACCESS_FILE: ::DWORD = 1920; -pub const ERROR_CANT_RESOLVE_FILENAME: ::DWORD = 1921; -pub const RPC_S_ENTRY_TYPE_MISMATCH: ::DWORD = 1922; -pub const RPC_S_NOT_ALL_OBJS_EXPORTED: ::DWORD = 1923; -pub const RPC_S_INTERFACE_NOT_EXPORTED: ::DWORD = 1924; -pub const RPC_S_PROFILE_NOT_ADDED: ::DWORD = 1925; -pub const RPC_S_PRF_ELT_NOT_ADDED: ::DWORD = 1926; -pub const RPC_S_PRF_ELT_NOT_REMOVED: ::DWORD = 1927; -pub const RPC_S_GRP_ELT_NOT_ADDED: ::DWORD = 1928; -pub const RPC_S_GRP_ELT_NOT_REMOVED: ::DWORD = 1929; -pub const ERROR_KM_DRIVER_BLOCKED: ::DWORD = 1930; -pub const ERROR_CONTEXT_EXPIRED: ::DWORD = 1931; -pub const ERROR_PER_USER_TRUST_QUOTA_EXCEEDED: ::DWORD = 1932; -pub const ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED: ::DWORD = 1933; -pub const ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED: ::DWORD = 1934; -pub const ERROR_AUTHENTICATION_FIREWALL_FAILED: ::DWORD = 1935; -pub const ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED: ::DWORD = 1936; -pub const ERROR_NTLM_BLOCKED: ::DWORD = 1937; -pub const ERROR_PASSWORD_CHANGE_REQUIRED: ::DWORD = 1938; -pub const ERROR_INVALID_PIXEL_FORMAT: ::DWORD = 2000; -pub const ERROR_BAD_DRIVER: ::DWORD = 2001; -pub const ERROR_INVALID_WINDOW_STYLE: ::DWORD = 2002; -pub const ERROR_METAFILE_NOT_SUPPORTED: ::DWORD = 2003; -pub const ERROR_TRANSFORM_NOT_SUPPORTED: ::DWORD = 2004; -pub const ERROR_CLIPPING_NOT_SUPPORTED: ::DWORD = 2005; -pub const ERROR_INVALID_CMM: ::DWORD = 2010; -pub const ERROR_INVALID_PROFILE: ::DWORD = 2011; -pub const ERROR_TAG_NOT_FOUND: ::DWORD = 2012; -pub const ERROR_TAG_NOT_PRESENT: ::DWORD = 2013; -pub const ERROR_DUPLICATE_TAG: ::DWORD = 2014; -pub const ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE: ::DWORD = 2015; -pub const ERROR_PROFILE_NOT_FOUND: ::DWORD = 2016; -pub const ERROR_INVALID_COLORSPACE: ::DWORD = 2017; -pub const ERROR_ICM_NOT_ENABLED: ::DWORD = 2018; -pub const ERROR_DELETING_ICM_XFORM: ::DWORD = 2019; -pub const ERROR_INVALID_TRANSFORM: ::DWORD = 2020; -pub const ERROR_COLORSPACE_MISMATCH: ::DWORD = 2021; -pub const ERROR_INVALID_COLORINDEX: ::DWORD = 2022; -pub const ERROR_PROFILE_DOES_NOT_MATCH_DEVICE: ::DWORD = 2023; -pub const ERROR_CONNECTED_OTHER_PASSWORD: ::DWORD = 2108; -pub const ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT: ::DWORD = 2109; -pub const ERROR_BAD_USERNAME: ::DWORD = 2202; -pub const ERROR_NOT_CONNECTED: ::DWORD = 2250; -pub const ERROR_OPEN_FILES: ::DWORD = 2401; -pub const ERROR_ACTIVE_CONNECTIONS: ::DWORD = 2402; -pub const ERROR_DEVICE_IN_USE: ::DWORD = 2404; -pub const ERROR_UNKNOWN_PRINT_MONITOR: ::DWORD = 3000; -pub const ERROR_PRINTER_DRIVER_IN_USE: ::DWORD = 3001; -pub const ERROR_SPOOL_FILE_NOT_FOUND: ::DWORD = 3002; -pub const ERROR_SPL_NO_STARTDOC: ::DWORD = 3003; -pub const ERROR_SPL_NO_ADDJOB: ::DWORD = 3004; -pub const ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED: ::DWORD = 3005; -pub const ERROR_PRINT_MONITOR_ALREADY_INSTALLED: ::DWORD = 3006; -pub const ERROR_INVALID_PRINT_MONITOR: ::DWORD = 3007; -pub const ERROR_PRINT_MONITOR_IN_USE: ::DWORD = 3008; -pub const ERROR_PRINTER_HAS_JOBS_QUEUED: ::DWORD = 3009; -pub const ERROR_SUCCESS_REBOOT_REQUIRED: ::DWORD = 3010; -pub const ERROR_SUCCESS_RESTART_REQUIRED: ::DWORD = 3011; -pub const ERROR_PRINTER_NOT_FOUND: ::DWORD = 3012; -pub const ERROR_PRINTER_DRIVER_WARNED: ::DWORD = 3013; -pub const ERROR_PRINTER_DRIVER_BLOCKED: ::DWORD = 3014; -pub const ERROR_PRINTER_DRIVER_PACKAGE_IN_USE: ::DWORD = 3015; -pub const ERROR_CORE_DRIVER_PACKAGE_NOT_FOUND: ::DWORD = 3016; -pub const ERROR_FAIL_REBOOT_REQUIRED: ::DWORD = 3017; -pub const ERROR_FAIL_REBOOT_INITIATED: ::DWORD = 3018; -pub const ERROR_PRINTER_DRIVER_DOWNLOAD_NEEDED: ::DWORD = 3019; -pub const ERROR_PRINT_JOB_RESTART_REQUIRED: ::DWORD = 3020; -pub const ERROR_INVALID_PRINTER_DRIVER_MANIFEST: ::DWORD = 3021; -pub const ERROR_PRINTER_NOT_SHAREABLE: ::DWORD = 3022; -pub const ERROR_REQUEST_PAUSED: ::DWORD = 3050; -pub const ERROR_IO_REISSUE_AS_CACHED: ::DWORD = 3950; -pub const ERROR_WINS_INTERNAL: ::DWORD = 4000; -pub const ERROR_CAN_NOT_DEL_LOCAL_WINS: ::DWORD = 4001; -pub const ERROR_STATIC_INIT: ::DWORD = 4002; -pub const ERROR_INC_BACKUP: ::DWORD = 4003; -pub const ERROR_FULL_BACKUP: ::DWORD = 4004; -pub const ERROR_REC_NON_EXISTENT: ::DWORD = 4005; -pub const ERROR_RPL_NOT_ALLOWED: ::DWORD = 4006; -pub const PEERDIST_ERROR_CONTENTINFO_VERSION_UNSUPPORTED: ::DWORD = 4050; -pub const PEERDIST_ERROR_CANNOT_PARSE_CONTENTINFO: ::DWORD = 4051; -pub const PEERDIST_ERROR_MISSING_DATA: ::DWORD = 4052; -pub const PEERDIST_ERROR_NO_MORE: ::DWORD = 4053; -pub const PEERDIST_ERROR_NOT_INITIALIZED: ::DWORD = 4054; -pub const PEERDIST_ERROR_ALREADY_INITIALIZED: ::DWORD = 4055; -pub const PEERDIST_ERROR_SHUTDOWN_IN_PROGRESS: ::DWORD = 4056; -pub const PEERDIST_ERROR_INVALIDATED: ::DWORD = 4057; -pub const PEERDIST_ERROR_ALREADY_EXISTS: ::DWORD = 4058; -pub const PEERDIST_ERROR_OPERATION_NOTFOUND: ::DWORD = 4059; -pub const PEERDIST_ERROR_ALREADY_COMPLETED: ::DWORD = 4060; -pub const PEERDIST_ERROR_OUT_OF_BOUNDS: ::DWORD = 4061; -pub const PEERDIST_ERROR_VERSION_UNSUPPORTED: ::DWORD = 4062; -pub const PEERDIST_ERROR_INVALID_CONFIGURATION: ::DWORD = 4063; -pub const PEERDIST_ERROR_NOT_LICENSED: ::DWORD = 4064; -pub const PEERDIST_ERROR_SERVICE_UNAVAILABLE: ::DWORD = 4065; -pub const PEERDIST_ERROR_TRUST_FAILURE: ::DWORD = 4066; -pub const ERROR_DHCP_ADDRESS_CONFLICT: ::DWORD = 4100; -pub const ERROR_WMI_GUID_NOT_FOUND: ::DWORD = 4200; -pub const ERROR_WMI_INSTANCE_NOT_FOUND: ::DWORD = 4201; -pub const ERROR_WMI_ITEMID_NOT_FOUND: ::DWORD = 4202; -pub const ERROR_WMI_TRY_AGAIN: ::DWORD = 4203; -pub const ERROR_WMI_DP_NOT_FOUND: ::DWORD = 4204; -pub const ERROR_WMI_UNRESOLVED_INSTANCE_REF: ::DWORD = 4205; -pub const ERROR_WMI_ALREADY_ENABLED: ::DWORD = 4206; -pub const ERROR_WMI_GUID_DISCONNECTED: ::DWORD = 4207; -pub const ERROR_WMI_SERVER_UNAVAILABLE: ::DWORD = 4208; -pub const ERROR_WMI_DP_FAILED: ::DWORD = 4209; -pub const ERROR_WMI_INVALID_MOF: ::DWORD = 4210; -pub const ERROR_WMI_INVALID_REGINFO: ::DWORD = 4211; -pub const ERROR_WMI_ALREADY_DISABLED: ::DWORD = 4212; -pub const ERROR_WMI_READ_ONLY: ::DWORD = 4213; -pub const ERROR_WMI_SET_FAILURE: ::DWORD = 4214; -pub const ERROR_NOT_APPCONTAINER: ::DWORD = 4250; -pub const ERROR_APPCONTAINER_REQUIRED: ::DWORD = 4251; -pub const ERROR_NOT_SUPPORTED_IN_APPCONTAINER: ::DWORD = 4252; -pub const ERROR_INVALID_PACKAGE_SID_LENGTH: ::DWORD = 4253; -pub const ERROR_INVALID_MEDIA: ::DWORD = 4300; -pub const ERROR_INVALID_LIBRARY: ::DWORD = 4301; -pub const ERROR_INVALID_MEDIA_POOL: ::DWORD = 4302; -pub const ERROR_DRIVE_MEDIA_MISMATCH: ::DWORD = 4303; -pub const ERROR_MEDIA_OFFLINE: ::DWORD = 4304; -pub const ERROR_LIBRARY_OFFLINE: ::DWORD = 4305; -pub const ERROR_EMPTY: ::DWORD = 4306; -pub const ERROR_NOT_EMPTY: ::DWORD = 4307; -pub const ERROR_MEDIA_UNAVAILABLE: ::DWORD = 4308; -pub const ERROR_RESOURCE_DISABLED: ::DWORD = 4309; -pub const ERROR_INVALID_CLEANER: ::DWORD = 4310; -pub const ERROR_UNABLE_TO_CLEAN: ::DWORD = 4311; -pub const ERROR_OBJECT_NOT_FOUND: ::DWORD = 4312; -pub const ERROR_DATABASE_FAILURE: ::DWORD = 4313; -pub const ERROR_DATABASE_FULL: ::DWORD = 4314; -pub const ERROR_MEDIA_INCOMPATIBLE: ::DWORD = 4315; -pub const ERROR_RESOURCE_NOT_PRESENT: ::DWORD = 4316; -pub const ERROR_INVALID_OPERATION: ::DWORD = 4317; -pub const ERROR_MEDIA_NOT_AVAILABLE: ::DWORD = 4318; -pub const ERROR_DEVICE_NOT_AVAILABLE: ::DWORD = 4319; -pub const ERROR_REQUEST_REFUSED: ::DWORD = 4320; -pub const ERROR_INVALID_DRIVE_OBJECT: ::DWORD = 4321; -pub const ERROR_LIBRARY_FULL: ::DWORD = 4322; -pub const ERROR_MEDIUM_NOT_ACCESSIBLE: ::DWORD = 4323; -pub const ERROR_UNABLE_TO_LOAD_MEDIUM: ::DWORD = 4324; -pub const ERROR_UNABLE_TO_INVENTORY_DRIVE: ::DWORD = 4325; -pub const ERROR_UNABLE_TO_INVENTORY_SLOT: ::DWORD = 4326; -pub const ERROR_UNABLE_TO_INVENTORY_TRANSPORT: ::DWORD = 4327; -pub const ERROR_TRANSPORT_FULL: ::DWORD = 4328; -pub const ERROR_CONTROLLING_IEPORT: ::DWORD = 4329; -pub const ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA: ::DWORD = 4330; -pub const ERROR_CLEANER_SLOT_SET: ::DWORD = 4331; -pub const ERROR_CLEANER_SLOT_NOT_SET: ::DWORD = 4332; -pub const ERROR_CLEANER_CARTRIDGE_SPENT: ::DWORD = 4333; -pub const ERROR_UNEXPECTED_OMID: ::DWORD = 4334; -pub const ERROR_CANT_DELETE_LAST_ITEM: ::DWORD = 4335; -pub const ERROR_MESSAGE_EXCEEDS_MAX_SIZE: ::DWORD = 4336; -pub const ERROR_VOLUME_CONTAINS_SYS_FILES: ::DWORD = 4337; -pub const ERROR_INDIGENOUS_TYPE: ::DWORD = 4338; -pub const ERROR_NO_SUPPORTING_DRIVES: ::DWORD = 4339; -pub const ERROR_CLEANER_CARTRIDGE_INSTALLED: ::DWORD = 4340; -pub const ERROR_IEPORT_FULL: ::DWORD = 4341; -pub const ERROR_FILE_OFFLINE: ::DWORD = 4350; -pub const ERROR_REMOTE_STORAGE_NOT_ACTIVE: ::DWORD = 4351; -pub const ERROR_REMOTE_STORAGE_MEDIA_ERROR: ::DWORD = 4352; -pub const ERROR_NOT_A_REPARSE_POINT: ::DWORD = 4390; -pub const ERROR_REPARSE_ATTRIBUTE_CONFLICT: ::DWORD = 4391; -pub const ERROR_INVALID_REPARSE_DATA: ::DWORD = 4392; -pub const ERROR_REPARSE_TAG_INVALID: ::DWORD = 4393; -pub const ERROR_REPARSE_TAG_MISMATCH: ::DWORD = 4394; -pub const ERROR_APP_DATA_NOT_FOUND: ::DWORD = 4400; -pub const ERROR_APP_DATA_EXPIRED: ::DWORD = 4401; -pub const ERROR_APP_DATA_CORRUPT: ::DWORD = 4402; -pub const ERROR_APP_DATA_LIMIT_EXCEEDED: ::DWORD = 4403; -pub const ERROR_APP_DATA_REBOOT_REQUIRED: ::DWORD = 4404; -pub const ERROR_SECUREBOOT_ROLLBACK_DETECTED: ::DWORD = 4420; -pub const ERROR_SECUREBOOT_POLICY_VIOLATION: ::DWORD = 4421; -pub const ERROR_SECUREBOOT_INVALID_POLICY: ::DWORD = 4422; -pub const ERROR_SECUREBOOT_POLICY_PUBLISHER_NOT_FOUND: ::DWORD = 4423; -pub const ERROR_SECUREBOOT_POLICY_NOT_SIGNED: ::DWORD = 4424; -pub const ERROR_SECUREBOOT_NOT_ENABLED: ::DWORD = 4425; -pub const ERROR_SECUREBOOT_FILE_REPLACED: ::DWORD = 4426; -pub const ERROR_OFFLOAD_READ_FLT_NOT_SUPPORTED: ::DWORD = 4440; -pub const ERROR_OFFLOAD_WRITE_FLT_NOT_SUPPORTED: ::DWORD = 4441; -pub const ERROR_OFFLOAD_READ_FILE_NOT_SUPPORTED: ::DWORD = 4442; -pub const ERROR_OFFLOAD_WRITE_FILE_NOT_SUPPORTED: ::DWORD = 4443; -pub const ERROR_VOLUME_NOT_SIS_ENABLED: ::DWORD = 4500; -pub const ERROR_DEPENDENT_RESOURCE_EXISTS: ::DWORD = 5001; -pub const ERROR_DEPENDENCY_NOT_FOUND: ::DWORD = 5002; -pub const ERROR_DEPENDENCY_ALREADY_EXISTS: ::DWORD = 5003; -pub const ERROR_RESOURCE_NOT_ONLINE: ::DWORD = 5004; -pub const ERROR_HOST_NODE_NOT_AVAILABLE: ::DWORD = 5005; -pub const ERROR_RESOURCE_NOT_AVAILABLE: ::DWORD = 5006; -pub const ERROR_RESOURCE_NOT_FOUND: ::DWORD = 5007; -pub const ERROR_SHUTDOWN_CLUSTER: ::DWORD = 5008; -pub const ERROR_CANT_EVICT_ACTIVE_NODE: ::DWORD = 5009; -pub const ERROR_OBJECT_ALREADY_EXISTS: ::DWORD = 5010; -pub const ERROR_OBJECT_IN_LIST: ::DWORD = 5011; -pub const ERROR_GROUP_NOT_AVAILABLE: ::DWORD = 5012; -pub const ERROR_GROUP_NOT_FOUND: ::DWORD = 5013; -pub const ERROR_GROUP_NOT_ONLINE: ::DWORD = 5014; -pub const ERROR_HOST_NODE_NOT_RESOURCE_OWNER: ::DWORD = 5015; -pub const ERROR_HOST_NODE_NOT_GROUP_OWNER: ::DWORD = 5016; -pub const ERROR_RESMON_CREATE_FAILED: ::DWORD = 5017; -pub const ERROR_RESMON_ONLINE_FAILED: ::DWORD = 5018; -pub const ERROR_RESOURCE_ONLINE: ::DWORD = 5019; -pub const ERROR_QUORUM_RESOURCE: ::DWORD = 5020; -pub const ERROR_NOT_QUORUM_CAPABLE: ::DWORD = 5021; -pub const ERROR_CLUSTER_SHUTTING_DOWN: ::DWORD = 5022; -pub const ERROR_INVALID_STATE: ::DWORD = 5023; -pub const ERROR_RESOURCE_PROPERTIES_STORED: ::DWORD = 5024; -pub const ERROR_NOT_QUORUM_CLASS: ::DWORD = 5025; -pub const ERROR_CORE_RESOURCE: ::DWORD = 5026; -pub const ERROR_QUORUM_RESOURCE_ONLINE_FAILED: ::DWORD = 5027; -pub const ERROR_QUORUMLOG_OPEN_FAILED: ::DWORD = 5028; -pub const ERROR_CLUSTERLOG_CORRUPT: ::DWORD = 5029; -pub const ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE: ::DWORD = 5030; -pub const ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE: ::DWORD = 5031; -pub const ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND: ::DWORD = 5032; -pub const ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE: ::DWORD = 5033; -pub const ERROR_QUORUM_OWNER_ALIVE: ::DWORD = 5034; -pub const ERROR_NETWORK_NOT_AVAILABLE: ::DWORD = 5035; -pub const ERROR_NODE_NOT_AVAILABLE: ::DWORD = 5036; -pub const ERROR_ALL_NODES_NOT_AVAILABLE: ::DWORD = 5037; -pub const ERROR_RESOURCE_FAILED: ::DWORD = 5038; -pub const ERROR_CLUSTER_INVALID_NODE: ::DWORD = 5039; -pub const ERROR_CLUSTER_NODE_EXISTS: ::DWORD = 5040; -pub const ERROR_CLUSTER_JOIN_IN_PROGRESS: ::DWORD = 5041; -pub const ERROR_CLUSTER_NODE_NOT_FOUND: ::DWORD = 5042; -pub const ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND: ::DWORD = 5043; -pub const ERROR_CLUSTER_NETWORK_EXISTS: ::DWORD = 5044; -pub const ERROR_CLUSTER_NETWORK_NOT_FOUND: ::DWORD = 5045; -pub const ERROR_CLUSTER_NETINTERFACE_EXISTS: ::DWORD = 5046; -pub const ERROR_CLUSTER_NETINTERFACE_NOT_FOUND: ::DWORD = 5047; -pub const ERROR_CLUSTER_INVALID_REQUEST: ::DWORD = 5048; -pub const ERROR_CLUSTER_INVALID_NETWORK_PROVIDER: ::DWORD = 5049; -pub const ERROR_CLUSTER_NODE_DOWN: ::DWORD = 5050; -pub const ERROR_CLUSTER_NODE_UNREACHABLE: ::DWORD = 5051; -pub const ERROR_CLUSTER_NODE_NOT_MEMBER: ::DWORD = 5052; -pub const ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS: ::DWORD = 5053; -pub const ERROR_CLUSTER_INVALID_NETWORK: ::DWORD = 5054; -pub const ERROR_CLUSTER_NODE_UP: ::DWORD = 5056; -pub const ERROR_CLUSTER_IPADDR_IN_USE: ::DWORD = 5057; -pub const ERROR_CLUSTER_NODE_NOT_PAUSED: ::DWORD = 5058; -pub const ERROR_CLUSTER_NO_SECURITY_CONTEXT: ::DWORD = 5059; -pub const ERROR_CLUSTER_NETWORK_NOT_INTERNAL: ::DWORD = 5060; -pub const ERROR_CLUSTER_NODE_ALREADY_UP: ::DWORD = 5061; -pub const ERROR_CLUSTER_NODE_ALREADY_DOWN: ::DWORD = 5062; -pub const ERROR_CLUSTER_NETWORK_ALREADY_ONLINE: ::DWORD = 5063; -pub const ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE: ::DWORD = 5064; -pub const ERROR_CLUSTER_NODE_ALREADY_MEMBER: ::DWORD = 5065; -pub const ERROR_CLUSTER_LAST_INTERNAL_NETWORK: ::DWORD = 5066; -pub const ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS: ::DWORD = 5067; -pub const ERROR_INVALID_OPERATION_ON_QUORUM: ::DWORD = 5068; -pub const ERROR_DEPENDENCY_NOT_ALLOWED: ::DWORD = 5069; -pub const ERROR_CLUSTER_NODE_PAUSED: ::DWORD = 5070; -pub const ERROR_NODE_CANT_HOST_RESOURCE: ::DWORD = 5071; -pub const ERROR_CLUSTER_NODE_NOT_READY: ::DWORD = 5072; -pub const ERROR_CLUSTER_NODE_SHUTTING_DOWN: ::DWORD = 5073; -pub const ERROR_CLUSTER_JOIN_ABORTED: ::DWORD = 5074; -pub const ERROR_CLUSTER_INCOMPATIBLE_VERSIONS: ::DWORD = 5075; -pub const ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED: ::DWORD = 5076; -pub const ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED: ::DWORD = 5077; -pub const ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND: ::DWORD = 5078; -pub const ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED: ::DWORD = 5079; -pub const ERROR_CLUSTER_RESNAME_NOT_FOUND: ::DWORD = 5080; -pub const ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED: ::DWORD = 5081; -pub const ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST: ::DWORD = 5082; -pub const ERROR_CLUSTER_DATABASE_SEQMISMATCH: ::DWORD = 5083; -pub const ERROR_RESMON_INVALID_STATE: ::DWORD = 5084; -pub const ERROR_CLUSTER_GUM_NOT_LOCKER: ::DWORD = 5085; -pub const ERROR_QUORUM_DISK_NOT_FOUND: ::DWORD = 5086; -pub const ERROR_DATABASE_BACKUP_CORRUPT: ::DWORD = 5087; -pub const ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT: ::DWORD = 5088; -pub const ERROR_RESOURCE_PROPERTY_UNCHANGEABLE: ::DWORD = 5089; -pub const ERROR_NO_ADMIN_ACCESS_POINT: ::DWORD = 5090; -pub const ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE: ::DWORD = 5890; -pub const ERROR_CLUSTER_QUORUMLOG_NOT_FOUND: ::DWORD = 5891; -pub const ERROR_CLUSTER_MEMBERSHIP_HALT: ::DWORD = 5892; -pub const ERROR_CLUSTER_INSTANCE_ID_MISMATCH: ::DWORD = 5893; -pub const ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP: ::DWORD = 5894; -pub const ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH: ::DWORD = 5895; -pub const ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP: ::DWORD = 5896; -pub const ERROR_CLUSTER_PARAMETER_MISMATCH: ::DWORD = 5897; -pub const ERROR_NODE_CANNOT_BE_CLUSTERED: ::DWORD = 5898; -pub const ERROR_CLUSTER_WRONG_OS_VERSION: ::DWORD = 5899; -pub const ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME: ::DWORD = 5900; -pub const ERROR_CLUSCFG_ALREADY_COMMITTED: ::DWORD = 5901; -pub const ERROR_CLUSCFG_ROLLBACK_FAILED: ::DWORD = 5902; -pub const ERROR_CLUSCFG_SYSTEM_DISK_DRIVE_LETTER_CONFLICT: ::DWORD = 5903; -pub const ERROR_CLUSTER_OLD_VERSION: ::DWORD = 5904; -pub const ERROR_CLUSTER_MISMATCHED_COMPUTER_ACCT_NAME: ::DWORD = 5905; -pub const ERROR_CLUSTER_NO_NET_ADAPTERS: ::DWORD = 5906; -pub const ERROR_CLUSTER_POISONED: ::DWORD = 5907; -pub const ERROR_CLUSTER_GROUP_MOVING: ::DWORD = 5908; -pub const ERROR_CLUSTER_RESOURCE_TYPE_BUSY: ::DWORD = 5909; -pub const ERROR_RESOURCE_CALL_TIMED_OUT: ::DWORD = 5910; -pub const ERROR_INVALID_CLUSTER_IPV6_ADDRESS: ::DWORD = 5911; -pub const ERROR_CLUSTER_INTERNAL_INVALID_FUNCTION: ::DWORD = 5912; -pub const ERROR_CLUSTER_PARAMETER_OUT_OF_BOUNDS: ::DWORD = 5913; -pub const ERROR_CLUSTER_PARTIAL_SEND: ::DWORD = 5914; -pub const ERROR_CLUSTER_REGISTRY_INVALID_FUNCTION: ::DWORD = 5915; -pub const ERROR_CLUSTER_INVALID_STRING_TERMINATION: ::DWORD = 5916; -pub const ERROR_CLUSTER_INVALID_STRING_FORMAT: ::DWORD = 5917; -pub const ERROR_CLUSTER_DATABASE_TRANSACTION_IN_PROGRESS: ::DWORD = 5918; -pub const ERROR_CLUSTER_DATABASE_TRANSACTION_NOT_IN_PROGRESS: ::DWORD = 5919; -pub const ERROR_CLUSTER_NULL_DATA: ::DWORD = 5920; -pub const ERROR_CLUSTER_PARTIAL_READ: ::DWORD = 5921; -pub const ERROR_CLUSTER_PARTIAL_WRITE: ::DWORD = 5922; -pub const ERROR_CLUSTER_CANT_DESERIALIZE_DATA: ::DWORD = 5923; -pub const ERROR_DEPENDENT_RESOURCE_PROPERTY_CONFLICT: ::DWORD = 5924; -pub const ERROR_CLUSTER_NO_QUORUM: ::DWORD = 5925; -pub const ERROR_CLUSTER_INVALID_IPV6_NETWORK: ::DWORD = 5926; -pub const ERROR_CLUSTER_INVALID_IPV6_TUNNEL_NETWORK: ::DWORD = 5927; -pub const ERROR_QUORUM_NOT_ALLOWED_IN_THIS_GROUP: ::DWORD = 5928; -pub const ERROR_DEPENDENCY_TREE_TOO_COMPLEX: ::DWORD = 5929; -pub const ERROR_EXCEPTION_IN_RESOURCE_CALL: ::DWORD = 5930; -pub const ERROR_CLUSTER_RHS_FAILED_INITIALIZATION: ::DWORD = 5931; -pub const ERROR_CLUSTER_NOT_INSTALLED: ::DWORD = 5932; -pub const ERROR_CLUSTER_RESOURCES_MUST_BE_ONLINE_ON_THE_SAME_NODE: ::DWORD = 5933; -pub const ERROR_CLUSTER_MAX_NODES_IN_CLUSTER: ::DWORD = 5934; -pub const ERROR_CLUSTER_TOO_MANY_NODES: ::DWORD = 5935; -pub const ERROR_CLUSTER_OBJECT_ALREADY_USED: ::DWORD = 5936; -pub const ERROR_NONCORE_GROUPS_FOUND: ::DWORD = 5937; -pub const ERROR_FILE_SHARE_RESOURCE_CONFLICT: ::DWORD = 5938; -pub const ERROR_CLUSTER_EVICT_INVALID_REQUEST: ::DWORD = 5939; -pub const ERROR_CLUSTER_SINGLETON_RESOURCE: ::DWORD = 5940; -pub const ERROR_CLUSTER_GROUP_SINGLETON_RESOURCE: ::DWORD = 5941; -pub const ERROR_CLUSTER_RESOURCE_PROVIDER_FAILED: ::DWORD = 5942; -pub const ERROR_CLUSTER_RESOURCE_CONFIGURATION_ERROR: ::DWORD = 5943; -pub const ERROR_CLUSTER_GROUP_BUSY: ::DWORD = 5944; -pub const ERROR_CLUSTER_NOT_SHARED_VOLUME: ::DWORD = 5945; -pub const ERROR_CLUSTER_INVALID_SECURITY_DESCRIPTOR: ::DWORD = 5946; -pub const ERROR_CLUSTER_SHARED_VOLUMES_IN_USE: ::DWORD = 5947; -pub const ERROR_CLUSTER_USE_SHARED_VOLUMES_API: ::DWORD = 5948; -pub const ERROR_CLUSTER_BACKUP_IN_PROGRESS: ::DWORD = 5949; -pub const ERROR_NON_CSV_PATH: ::DWORD = 5950; -pub const ERROR_CSV_VOLUME_NOT_LOCAL: ::DWORD = 5951; -pub const ERROR_CLUSTER_WATCHDOG_TERMINATING: ::DWORD = 5952; -pub const ERROR_CLUSTER_RESOURCE_VETOED_MOVE_INCOMPATIBLE_NODES: ::DWORD = 5953; -pub const ERROR_CLUSTER_INVALID_NODE_WEIGHT: ::DWORD = 5954; -pub const ERROR_CLUSTER_RESOURCE_VETOED_CALL: ::DWORD = 5955; -pub const ERROR_RESMON_SYSTEM_RESOURCES_LACKING: ::DWORD = 5956; -pub const ERROR_CLUSTER_RESOURCE_VETOED_MOVE_NOT_ENOUGH_RESOURCES_ON_DESTINATION: ::DWORD = 5957; -pub const ERROR_CLUSTER_RESOURCE_VETOED_MOVE_NOT_ENOUGH_RESOURCES_ON_SOURCE: ::DWORD = 5958; -pub const ERROR_CLUSTER_GROUP_QUEUED: ::DWORD = 5959; -pub const ERROR_CLUSTER_RESOURCE_LOCKED_STATUS: ::DWORD = 5960; -pub const ERROR_CLUSTER_SHARED_VOLUME_FAILOVER_NOT_ALLOWED: ::DWORD = 5961; -pub const ERROR_CLUSTER_NODE_DRAIN_IN_PROGRESS: ::DWORD = 5962; -pub const ERROR_CLUSTER_DISK_NOT_CONNECTED: ::DWORD = 5963; -pub const ERROR_DISK_NOT_CSV_CAPABLE: ::DWORD = 5964; -pub const ERROR_RESOURCE_NOT_IN_AVAILABLE_STORAGE: ::DWORD = 5965; -pub const ERROR_CLUSTER_SHARED_VOLUME_REDIRECTED: ::DWORD = 5966; -pub const ERROR_CLUSTER_SHARED_VOLUME_NOT_REDIRECTED: ::DWORD = 5967; -pub const ERROR_CLUSTER_CANNOT_RETURN_PROPERTIES: ::DWORD = 5968; -pub const ERROR_CLUSTER_RESOURCE_CONTAINS_UNSUPPORTED_DIFF_AREA_FOR_SHARED_VOLUMES: ::DWORD = 5969; -pub const ERROR_CLUSTER_RESOURCE_IS_IN_MAINTENANCE_MODE: ::DWORD = 5970; -pub const ERROR_CLUSTER_AFFINITY_CONFLICT: ::DWORD = 5971; -pub const ERROR_CLUSTER_RESOURCE_IS_REPLICA_VIRTUAL_MACHINE: ::DWORD = 5972; -pub const ERROR_ENCRYPTION_FAILED: ::DWORD = 6000; -pub const ERROR_DECRYPTION_FAILED: ::DWORD = 6001; -pub const ERROR_FILE_ENCRYPTED: ::DWORD = 6002; -pub const ERROR_NO_RECOVERY_POLICY: ::DWORD = 6003; -pub const ERROR_NO_EFS: ::DWORD = 6004; -pub const ERROR_WRONG_EFS: ::DWORD = 6005; -pub const ERROR_NO_USER_KEYS: ::DWORD = 6006; -pub const ERROR_FILE_NOT_ENCRYPTED: ::DWORD = 6007; -pub const ERROR_NOT_EXPORT_FORMAT: ::DWORD = 6008; -pub const ERROR_FILE_READ_ONLY: ::DWORD = 6009; -pub const ERROR_DIR_EFS_DISALLOWED: ::DWORD = 6010; -pub const ERROR_EFS_SERVER_NOT_TRUSTED: ::DWORD = 6011; -pub const ERROR_BAD_RECOVERY_POLICY: ::DWORD = 6012; -pub const ERROR_EFS_ALG_BLOB_TOO_BIG: ::DWORD = 6013; -pub const ERROR_VOLUME_NOT_SUPPORT_EFS: ::DWORD = 6014; -pub const ERROR_EFS_DISABLED: ::DWORD = 6015; -pub const ERROR_EFS_VERSION_NOT_SUPPORT: ::DWORD = 6016; -pub const ERROR_CS_ENCRYPTION_INVALID_SERVER_RESPONSE: ::DWORD = 6017; -pub const ERROR_CS_ENCRYPTION_UNSUPPORTED_SERVER: ::DWORD = 6018; -pub const ERROR_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE: ::DWORD = 6019; -pub const ERROR_CS_ENCRYPTION_NEW_ENCRYPTED_FILE: ::DWORD = 6020; -pub const ERROR_CS_ENCRYPTION_FILE_NOT_CSE: ::DWORD = 6021; -pub const ERROR_ENCRYPTION_POLICY_DENIES_OPERATION: ::DWORD = 6022; -pub const ERROR_NO_BROWSER_SERVERS_FOUND: ::DWORD = 6118; -pub const SCHED_E_SERVICE_NOT_LOCALSYSTEM: ::DWORD = 6200; -pub const ERROR_LOG_SECTOR_INVALID: ::DWORD = 6600; -pub const ERROR_LOG_SECTOR_PARITY_INVALID: ::DWORD = 6601; -pub const ERROR_LOG_SECTOR_REMAPPED: ::DWORD = 6602; -pub const ERROR_LOG_BLOCK_INCOMPLETE: ::DWORD = 6603; -pub const ERROR_LOG_INVALID_RANGE: ::DWORD = 6604; -pub const ERROR_LOG_BLOCKS_EXHAUSTED: ::DWORD = 6605; -pub const ERROR_LOG_READ_CONTEXT_INVALID: ::DWORD = 6606; -pub const ERROR_LOG_RESTART_INVALID: ::DWORD = 6607; -pub const ERROR_LOG_BLOCK_VERSION: ::DWORD = 6608; -pub const ERROR_LOG_BLOCK_INVALID: ::DWORD = 6609; -pub const ERROR_LOG_READ_MODE_INVALID: ::DWORD = 6610; -pub const ERROR_LOG_NO_RESTART: ::DWORD = 6611; -pub const ERROR_LOG_METADATA_CORRUPT: ::DWORD = 6612; -pub const ERROR_LOG_METADATA_INVALID: ::DWORD = 6613; -pub const ERROR_LOG_METADATA_INCONSISTENT: ::DWORD = 6614; -pub const ERROR_LOG_RESERVATION_INVALID: ::DWORD = 6615; -pub const ERROR_LOG_CANT_DELETE: ::DWORD = 6616; -pub const ERROR_LOG_CONTAINER_LIMIT_EXCEEDED: ::DWORD = 6617; -pub const ERROR_LOG_START_OF_LOG: ::DWORD = 6618; -pub const ERROR_LOG_POLICY_ALREADY_INSTALLED: ::DWORD = 6619; -pub const ERROR_LOG_POLICY_NOT_INSTALLED: ::DWORD = 6620; -pub const ERROR_LOG_POLICY_INVALID: ::DWORD = 6621; -pub const ERROR_LOG_POLICY_CONFLICT: ::DWORD = 6622; -pub const ERROR_LOG_PINNED_ARCHIVE_TAIL: ::DWORD = 6623; -pub const ERROR_LOG_RECORD_NONEXISTENT: ::DWORD = 6624; -pub const ERROR_LOG_RECORDS_RESERVED_INVALID: ::DWORD = 6625; -pub const ERROR_LOG_SPACE_RESERVED_INVALID: ::DWORD = 6626; -pub const ERROR_LOG_TAIL_INVALID: ::DWORD = 6627; -pub const ERROR_LOG_FULL: ::DWORD = 6628; -pub const ERROR_COULD_NOT_RESIZE_LOG: ::DWORD = 6629; -pub const ERROR_LOG_MULTIPLEXED: ::DWORD = 6630; -pub const ERROR_LOG_DEDICATED: ::DWORD = 6631; -pub const ERROR_LOG_ARCHIVE_NOT_IN_PROGRESS: ::DWORD = 6632; -pub const ERROR_LOG_ARCHIVE_IN_PROGRESS: ::DWORD = 6633; -pub const ERROR_LOG_EPHEMERAL: ::DWORD = 6634; -pub const ERROR_LOG_NOT_ENOUGH_CONTAINERS: ::DWORD = 6635; -pub const ERROR_LOG_CLIENT_ALREADY_REGISTERED: ::DWORD = 6636; -pub const ERROR_LOG_CLIENT_NOT_REGISTERED: ::DWORD = 6637; -pub const ERROR_LOG_FULL_HANDLER_IN_PROGRESS: ::DWORD = 6638; -pub const ERROR_LOG_CONTAINER_READ_FAILED: ::DWORD = 6639; -pub const ERROR_LOG_CONTAINER_WRITE_FAILED: ::DWORD = 6640; -pub const ERROR_LOG_CONTAINER_OPEN_FAILED: ::DWORD = 6641; -pub const ERROR_LOG_CONTAINER_STATE_INVALID: ::DWORD = 6642; -pub const ERROR_LOG_STATE_INVALID: ::DWORD = 6643; -pub const ERROR_LOG_PINNED: ::DWORD = 6644; -pub const ERROR_LOG_METADATA_FLUSH_FAILED: ::DWORD = 6645; -pub const ERROR_LOG_INCONSISTENT_SECURITY: ::DWORD = 6646; -pub const ERROR_LOG_APPENDED_FLUSH_FAILED: ::DWORD = 6647; -pub const ERROR_LOG_PINNED_RESERVATION: ::DWORD = 6648; -pub const ERROR_INVALID_TRANSACTION: ::DWORD = 6700; -pub const ERROR_TRANSACTION_NOT_ACTIVE: ::DWORD = 6701; -pub const ERROR_TRANSACTION_REQUEST_NOT_VALID: ::DWORD = 6702; -pub const ERROR_TRANSACTION_NOT_REQUESTED: ::DWORD = 6703; -pub const ERROR_TRANSACTION_ALREADY_ABORTED: ::DWORD = 6704; -pub const ERROR_TRANSACTION_ALREADY_COMMITTED: ::DWORD = 6705; -pub const ERROR_TM_INITIALIZATION_FAILED: ::DWORD = 6706; -pub const ERROR_RESOURCEMANAGER_READ_ONLY: ::DWORD = 6707; -pub const ERROR_TRANSACTION_NOT_JOINED: ::DWORD = 6708; -pub const ERROR_TRANSACTION_SUPERIOR_EXISTS: ::DWORD = 6709; -pub const ERROR_CRM_PROTOCOL_ALREADY_EXISTS: ::DWORD = 6710; -pub const ERROR_TRANSACTION_PROPAGATION_FAILED: ::DWORD = 6711; -pub const ERROR_CRM_PROTOCOL_NOT_FOUND: ::DWORD = 6712; -pub const ERROR_TRANSACTION_INVALID_MARSHALL_BUFFER: ::DWORD = 6713; -pub const ERROR_CURRENT_TRANSACTION_NOT_VALID: ::DWORD = 6714; -pub const ERROR_TRANSACTION_NOT_FOUND: ::DWORD = 6715; -pub const ERROR_RESOURCEMANAGER_NOT_FOUND: ::DWORD = 6716; -pub const ERROR_ENLISTMENT_NOT_FOUND: ::DWORD = 6717; -pub const ERROR_TRANSACTIONMANAGER_NOT_FOUND: ::DWORD = 6718; -pub const ERROR_TRANSACTIONMANAGER_NOT_ONLINE: ::DWORD = 6719; -pub const ERROR_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION: ::DWORD = 6720; -pub const ERROR_TRANSACTION_NOT_ROOT: ::DWORD = 6721; -pub const ERROR_TRANSACTION_OBJECT_EXPIRED: ::DWORD = 6722; -pub const ERROR_TRANSACTION_RESPONSE_NOT_ENLISTED: ::DWORD = 6723; -pub const ERROR_TRANSACTION_RECORD_TOO_LONG: ::DWORD = 6724; -pub const ERROR_IMPLICIT_TRANSACTION_NOT_SUPPORTED: ::DWORD = 6725; -pub const ERROR_TRANSACTION_INTEGRITY_VIOLATED: ::DWORD = 6726; -pub const ERROR_TRANSACTIONMANAGER_IDENTITY_MISMATCH: ::DWORD = 6727; -pub const ERROR_RM_CANNOT_BE_FROZEN_FOR_SNAPSHOT: ::DWORD = 6728; -pub const ERROR_TRANSACTION_MUST_WRITETHROUGH: ::DWORD = 6729; -pub const ERROR_TRANSACTION_NO_SUPERIOR: ::DWORD = 6730; -pub const ERROR_HEURISTIC_DAMAGE_POSSIBLE: ::DWORD = 6731; -pub const ERROR_TRANSACTIONAL_CONFLICT: ::DWORD = 6800; -pub const ERROR_RM_NOT_ACTIVE: ::DWORD = 6801; -pub const ERROR_RM_METADATA_CORRUPT: ::DWORD = 6802; -pub const ERROR_DIRECTORY_NOT_RM: ::DWORD = 6803; -pub const ERROR_TRANSACTIONS_UNSUPPORTED_REMOTE: ::DWORD = 6805; -pub const ERROR_LOG_RESIZE_INVALID_SIZE: ::DWORD = 6806; -pub const ERROR_OBJECT_NO_LONGER_EXISTS: ::DWORD = 6807; -pub const ERROR_STREAM_MINIVERSION_NOT_FOUND: ::DWORD = 6808; -pub const ERROR_STREAM_MINIVERSION_NOT_VALID: ::DWORD = 6809; -pub const ERROR_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION: ::DWORD = 6810; -pub const ERROR_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT: ::DWORD = 6811; -pub const ERROR_CANT_CREATE_MORE_STREAM_MINIVERSIONS: ::DWORD = 6812; -pub const ERROR_REMOTE_FILE_VERSION_MISMATCH: ::DWORD = 6814; -pub const ERROR_HANDLE_NO_LONGER_VALID: ::DWORD = 6815; -pub const ERROR_NO_TXF_METADATA: ::DWORD = 6816; -pub const ERROR_LOG_CORRUPTION_DETECTED: ::DWORD = 6817; -pub const ERROR_CANT_RECOVER_WITH_HANDLE_OPEN: ::DWORD = 6818; -pub const ERROR_RM_DISCONNECTED: ::DWORD = 6819; -pub const ERROR_ENLISTMENT_NOT_SUPERIOR: ::DWORD = 6820; -pub const ERROR_RECOVERY_NOT_NEEDED: ::DWORD = 6821; -pub const ERROR_RM_ALREADY_STARTED: ::DWORD = 6822; -pub const ERROR_FILE_IDENTITY_NOT_PERSISTENT: ::DWORD = 6823; -pub const ERROR_CANT_BREAK_TRANSACTIONAL_DEPENDENCY: ::DWORD = 6824; -pub const ERROR_CANT_CROSS_RM_BOUNDARY: ::DWORD = 6825; -pub const ERROR_TXF_DIR_NOT_EMPTY: ::DWORD = 6826; -pub const ERROR_INDOUBT_TRANSACTIONS_EXIST: ::DWORD = 6827; -pub const ERROR_TM_VOLATILE: ::DWORD = 6828; -pub const ERROR_ROLLBACK_TIMER_EXPIRED: ::DWORD = 6829; -pub const ERROR_TXF_ATTRIBUTE_CORRUPT: ::DWORD = 6830; -pub const ERROR_EFS_NOT_ALLOWED_IN_TRANSACTION: ::DWORD = 6831; -pub const ERROR_TRANSACTIONAL_OPEN_NOT_ALLOWED: ::DWORD = 6832; -pub const ERROR_LOG_GROWTH_FAILED: ::DWORD = 6833; -pub const ERROR_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE: ::DWORD = 6834; -pub const ERROR_TXF_METADATA_ALREADY_PRESENT: ::DWORD = 6835; -pub const ERROR_TRANSACTION_SCOPE_CALLBACKS_NOT_SET: ::DWORD = 6836; -pub const ERROR_TRANSACTION_REQUIRED_PROMOTION: ::DWORD = 6837; -pub const ERROR_CANNOT_EXECUTE_FILE_IN_TRANSACTION: ::DWORD = 6838; -pub const ERROR_TRANSACTIONS_NOT_FROZEN: ::DWORD = 6839; -pub const ERROR_TRANSACTION_FREEZE_IN_PROGRESS: ::DWORD = 6840; -pub const ERROR_NOT_SNAPSHOT_VOLUME: ::DWORD = 6841; -pub const ERROR_NO_SAVEPOINT_WITH_OPEN_FILES: ::DWORD = 6842; -pub const ERROR_DATA_LOST_REPAIR: ::DWORD = 6843; -pub const ERROR_SPARSE_NOT_ALLOWED_IN_TRANSACTION: ::DWORD = 6844; -pub const ERROR_TM_IDENTITY_MISMATCH: ::DWORD = 6845; -pub const ERROR_FLOATED_SECTION: ::DWORD = 6846; -pub const ERROR_CANNOT_ACCEPT_TRANSACTED_WORK: ::DWORD = 6847; -pub const ERROR_CANNOT_ABORT_TRANSACTIONS: ::DWORD = 6848; -pub const ERROR_BAD_CLUSTERS: ::DWORD = 6849; -pub const ERROR_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION: ::DWORD = 6850; -pub const ERROR_VOLUME_DIRTY: ::DWORD = 6851; -pub const ERROR_NO_LINK_TRACKING_IN_TRANSACTION: ::DWORD = 6852; -pub const ERROR_OPERATION_NOT_SUPPORTED_IN_TRANSACTION: ::DWORD = 6853; -pub const ERROR_EXPIRED_HANDLE: ::DWORD = 6854; -pub const ERROR_TRANSACTION_NOT_ENLISTED: ::DWORD = 6855; -pub const ERROR_CTX_WINSTATION_NAME_INVALID: ::DWORD = 7001; -pub const ERROR_CTX_INVALID_PD: ::DWORD = 7002; -pub const ERROR_CTX_PD_NOT_FOUND: ::DWORD = 7003; -pub const ERROR_CTX_WD_NOT_FOUND: ::DWORD = 7004; -pub const ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY: ::DWORD = 7005; -pub const ERROR_CTX_SERVICE_NAME_COLLISION: ::DWORD = 7006; -pub const ERROR_CTX_CLOSE_PENDING: ::DWORD = 7007; -pub const ERROR_CTX_NO_OUTBUF: ::DWORD = 7008; -pub const ERROR_CTX_MODEM_INF_NOT_FOUND: ::DWORD = 7009; -pub const ERROR_CTX_INVALID_MODEMNAME: ::DWORD = 7010; -pub const ERROR_CTX_MODEM_RESPONSE_ERROR: ::DWORD = 7011; -pub const ERROR_CTX_MODEM_RESPONSE_TIMEOUT: ::DWORD = 7012; -pub const ERROR_CTX_MODEM_RESPONSE_NO_CARRIER: ::DWORD = 7013; -pub const ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE: ::DWORD = 7014; -pub const ERROR_CTX_MODEM_RESPONSE_BUSY: ::DWORD = 7015; -pub const ERROR_CTX_MODEM_RESPONSE_VOICE: ::DWORD = 7016; -pub const ERROR_CTX_TD_ERROR: ::DWORD = 7017; -pub const ERROR_CTX_WINSTATION_NOT_FOUND: ::DWORD = 7022; -pub const ERROR_CTX_WINSTATION_ALREADY_EXISTS: ::DWORD = 7023; -pub const ERROR_CTX_WINSTATION_BUSY: ::DWORD = 7024; -pub const ERROR_CTX_BAD_VIDEO_MODE: ::DWORD = 7025; -pub const ERROR_CTX_GRAPHICS_INVALID: ::DWORD = 7035; -pub const ERROR_CTX_LOGON_DISABLED: ::DWORD = 7037; -pub const ERROR_CTX_NOT_CONSOLE: ::DWORD = 7038; -pub const ERROR_CTX_CLIENT_QUERY_TIMEOUT: ::DWORD = 7040; -pub const ERROR_CTX_CONSOLE_DISCONNECT: ::DWORD = 7041; -pub const ERROR_CTX_CONSOLE_CONNECT: ::DWORD = 7042; -pub const ERROR_CTX_SHADOW_DENIED: ::DWORD = 7044; -pub const ERROR_CTX_WINSTATION_ACCESS_DENIED: ::DWORD = 7045; -pub const ERROR_CTX_INVALID_WD: ::DWORD = 7049; -pub const ERROR_CTX_SHADOW_INVALID: ::DWORD = 7050; -pub const ERROR_CTX_SHADOW_DISABLED: ::DWORD = 7051; -pub const ERROR_CTX_CLIENT_LICENSE_IN_USE: ::DWORD = 7052; -pub const ERROR_CTX_CLIENT_LICENSE_NOT_SET: ::DWORD = 7053; -pub const ERROR_CTX_LICENSE_NOT_AVAILABLE: ::DWORD = 7054; -pub const ERROR_CTX_LICENSE_CLIENT_INVALID: ::DWORD = 7055; -pub const ERROR_CTX_LICENSE_EXPIRED: ::DWORD = 7056; -pub const ERROR_CTX_SHADOW_NOT_RUNNING: ::DWORD = 7057; -pub const ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE: ::DWORD = 7058; -pub const ERROR_ACTIVATION_COUNT_EXCEEDED: ::DWORD = 7059; -pub const ERROR_CTX_WINSTATIONS_DISABLED: ::DWORD = 7060; -pub const ERROR_CTX_ENCRYPTION_LEVEL_REQUIRED: ::DWORD = 7061; -pub const ERROR_CTX_SESSION_IN_USE: ::DWORD = 7062; -pub const ERROR_CTX_NO_FORCE_LOGOFF: ::DWORD = 7063; -pub const ERROR_CTX_ACCOUNT_RESTRICTION: ::DWORD = 7064; -pub const ERROR_RDP_PROTOCOL_ERROR: ::DWORD = 7065; -pub const ERROR_CTX_CDM_CONNECT: ::DWORD = 7066; -pub const ERROR_CTX_CDM_DISCONNECT: ::DWORD = 7067; -pub const ERROR_CTX_SECURITY_LAYER_ERROR: ::DWORD = 7068; -pub const ERROR_TS_INCOMPATIBLE_SESSIONS: ::DWORD = 7069; -pub const ERROR_TS_VIDEO_SUBSYSTEM_ERROR: ::DWORD = 7070; -pub const FRS_ERR_INVALID_API_SEQUENCE: ::DWORD = 8001; -pub const FRS_ERR_STARTING_SERVICE: ::DWORD = 8002; -pub const FRS_ERR_STOPPING_SERVICE: ::DWORD = 8003; -pub const FRS_ERR_INTERNAL_API: ::DWORD = 8004; -pub const FRS_ERR_INTERNAL: ::DWORD = 8005; -pub const FRS_ERR_SERVICE_COMM: ::DWORD = 8006; -pub const FRS_ERR_INSUFFICIENT_PRIV: ::DWORD = 8007; -pub const FRS_ERR_AUTHENTICATION: ::DWORD = 8008; -pub const FRS_ERR_PARENT_INSUFFICIENT_PRIV: ::DWORD = 8009; -pub const FRS_ERR_PARENT_AUTHENTICATION: ::DWORD = 8010; -pub const FRS_ERR_CHILD_TO_PARENT_COMM: ::DWORD = 8011; -pub const FRS_ERR_PARENT_TO_CHILD_COMM: ::DWORD = 8012; -pub const FRS_ERR_SYSVOL_POPULATE: ::DWORD = 8013; -pub const FRS_ERR_SYSVOL_POPULATE_TIMEOUT: ::DWORD = 8014; -pub const FRS_ERR_SYSVOL_IS_BUSY: ::DWORD = 8015; -pub const FRS_ERR_SYSVOL_DEMOTE: ::DWORD = 8016; -pub const FRS_ERR_INVALID_SERVICE_PARAMETER: ::DWORD = 8017; -pub const DS_S_SUCCESS: ::DWORD = NO_ERROR; -pub const ERROR_DS_NOT_INSTALLED: ::DWORD = 8200; -pub const ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY: ::DWORD = 8201; -pub const ERROR_DS_NO_ATTRIBUTE_OR_VALUE: ::DWORD = 8202; -pub const ERROR_DS_INVALID_ATTRIBUTE_SYNTAX: ::DWORD = 8203; -pub const ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED: ::DWORD = 8204; -pub const ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS: ::DWORD = 8205; -pub const ERROR_DS_BUSY: ::DWORD = 8206; -pub const ERROR_DS_UNAVAILABLE: ::DWORD = 8207; -pub const ERROR_DS_NO_RIDS_ALLOCATED: ::DWORD = 8208; -pub const ERROR_DS_NO_MORE_RIDS: ::DWORD = 8209; -pub const ERROR_DS_INCORRECT_ROLE_OWNER: ::DWORD = 8210; -pub const ERROR_DS_RIDMGR_INIT_ERROR: ::DWORD = 8211; -pub const ERROR_DS_OBJ_CLASS_VIOLATION: ::DWORD = 8212; -pub const ERROR_DS_CANT_ON_NON_LEAF: ::DWORD = 8213; -pub const ERROR_DS_CANT_ON_RDN: ::DWORD = 8214; -pub const ERROR_DS_CANT_MOD_OBJ_CLASS: ::DWORD = 8215; -pub const ERROR_DS_CROSS_DOM_MOVE_ERROR: ::DWORD = 8216; -pub const ERROR_DS_GC_NOT_AVAILABLE: ::DWORD = 8217; -pub const ERROR_SHARED_POLICY: ::DWORD = 8218; -pub const ERROR_POLICY_OBJECT_NOT_FOUND: ::DWORD = 8219; -pub const ERROR_POLICY_ONLY_IN_DS: ::DWORD = 8220; -pub const ERROR_PROMOTION_ACTIVE: ::DWORD = 8221; -pub const ERROR_NO_PROMOTION_ACTIVE: ::DWORD = 8222; -pub const ERROR_DS_OPERATIONS_ERROR: ::DWORD = 8224; -pub const ERROR_DS_PROTOCOL_ERROR: ::DWORD = 8225; -pub const ERROR_DS_TIMELIMIT_EXCEEDED: ::DWORD = 8226; -pub const ERROR_DS_SIZELIMIT_EXCEEDED: ::DWORD = 8227; -pub const ERROR_DS_ADMIN_LIMIT_EXCEEDED: ::DWORD = 8228; -pub const ERROR_DS_COMPARE_FALSE: ::DWORD = 8229; -pub const ERROR_DS_COMPARE_TRUE: ::DWORD = 8230; -pub const ERROR_DS_AUTH_METHOD_NOT_SUPPORTED: ::DWORD = 8231; -pub const ERROR_DS_STRONG_AUTH_REQUIRED: ::DWORD = 8232; -pub const ERROR_DS_INAPPROPRIATE_AUTH: ::DWORD = 8233; -pub const ERROR_DS_AUTH_UNKNOWN: ::DWORD = 8234; -pub const ERROR_DS_REFERRAL: ::DWORD = 8235; -pub const ERROR_DS_UNAVAILABLE_CRIT_EXTENSION: ::DWORD = 8236; -pub const ERROR_DS_CONFIDENTIALITY_REQUIRED: ::DWORD = 8237; -pub const ERROR_DS_INAPPROPRIATE_MATCHING: ::DWORD = 8238; -pub const ERROR_DS_CONSTRAINT_VIOLATION: ::DWORD = 8239; -pub const ERROR_DS_NO_SUCH_OBJECT: ::DWORD = 8240; -pub const ERROR_DS_ALIAS_PROBLEM: ::DWORD = 8241; -pub const ERROR_DS_INVALID_DN_SYNTAX: ::DWORD = 8242; -pub const ERROR_DS_IS_LEAF: ::DWORD = 8243; -pub const ERROR_DS_ALIAS_DEREF_PROBLEM: ::DWORD = 8244; -pub const ERROR_DS_UNWILLING_TO_PERFORM: ::DWORD = 8245; -pub const ERROR_DS_LOOP_DETECT: ::DWORD = 8246; -pub const ERROR_DS_NAMING_VIOLATION: ::DWORD = 8247; -pub const ERROR_DS_OBJECT_RESULTS_TOO_LARGE: ::DWORD = 8248; -pub const ERROR_DS_AFFECTS_MULTIPLE_DSAS: ::DWORD = 8249; -pub const ERROR_DS_SERVER_DOWN: ::DWORD = 8250; -pub const ERROR_DS_LOCAL_ERROR: ::DWORD = 8251; -pub const ERROR_DS_ENCODING_ERROR: ::DWORD = 8252; -pub const ERROR_DS_DECODING_ERROR: ::DWORD = 8253; -pub const ERROR_DS_FILTER_UNKNOWN: ::DWORD = 8254; -pub const ERROR_DS_PARAM_ERROR: ::DWORD = 8255; -pub const ERROR_DS_NOT_SUPPORTED: ::DWORD = 8256; -pub const ERROR_DS_NO_RESULTS_RETURNED: ::DWORD = 8257; -pub const ERROR_DS_CONTROL_NOT_FOUND: ::DWORD = 8258; -pub const ERROR_DS_CLIENT_LOOP: ::DWORD = 8259; -pub const ERROR_DS_REFERRAL_LIMIT_EXCEEDED: ::DWORD = 8260; -pub const ERROR_DS_SORT_CONTROL_MISSING: ::DWORD = 8261; -pub const ERROR_DS_OFFSET_RANGE_ERROR: ::DWORD = 8262; -pub const ERROR_DS_RIDMGR_DISABLED: ::DWORD = 8263; -pub const ERROR_DS_ROOT_MUST_BE_NC: ::DWORD = 8301; -pub const ERROR_DS_ADD_REPLICA_INHIBITED: ::DWORD = 8302; -pub const ERROR_DS_ATT_NOT_DEF_IN_SCHEMA: ::DWORD = 8303; -pub const ERROR_DS_MAX_OBJ_SIZE_EXCEEDED: ::DWORD = 8304; -pub const ERROR_DS_OBJ_STRING_NAME_EXISTS: ::DWORD = 8305; -pub const ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA: ::DWORD = 8306; -pub const ERROR_DS_RDN_DOESNT_MATCH_SCHEMA: ::DWORD = 8307; -pub const ERROR_DS_NO_REQUESTED_ATTS_FOUND: ::DWORD = 8308; -pub const ERROR_DS_USER_BUFFER_TO_SMALL: ::DWORD = 8309; -pub const ERROR_DS_ATT_IS_NOT_ON_OBJ: ::DWORD = 8310; -pub const ERROR_DS_ILLEGAL_MOD_OPERATION: ::DWORD = 8311; -pub const ERROR_DS_OBJ_TOO_LARGE: ::DWORD = 8312; -pub const ERROR_DS_BAD_INSTANCE_TYPE: ::DWORD = 8313; -pub const ERROR_DS_MASTERDSA_REQUIRED: ::DWORD = 8314; -pub const ERROR_DS_OBJECT_CLASS_REQUIRED: ::DWORD = 8315; -pub const ERROR_DS_MISSING_REQUIRED_ATT: ::DWORD = 8316; -pub const ERROR_DS_ATT_NOT_DEF_FOR_CLASS: ::DWORD = 8317; -pub const ERROR_DS_ATT_ALREADY_EXISTS: ::DWORD = 8318; -pub const ERROR_DS_CANT_ADD_ATT_VALUES: ::DWORD = 8320; -pub const ERROR_DS_SINGLE_VALUE_CONSTRAINT: ::DWORD = 8321; -pub const ERROR_DS_RANGE_CONSTRAINT: ::DWORD = 8322; -pub const ERROR_DS_ATT_VAL_ALREADY_EXISTS: ::DWORD = 8323; -pub const ERROR_DS_CANT_REM_MISSING_ATT: ::DWORD = 8324; -pub const ERROR_DS_CANT_REM_MISSING_ATT_VAL: ::DWORD = 8325; -pub const ERROR_DS_ROOT_CANT_BE_SUBREF: ::DWORD = 8326; -pub const ERROR_DS_NO_CHAINING: ::DWORD = 8327; -pub const ERROR_DS_NO_CHAINED_EVAL: ::DWORD = 8328; -pub const ERROR_DS_NO_PARENT_OBJECT: ::DWORD = 8329; -pub const ERROR_DS_PARENT_IS_AN_ALIAS: ::DWORD = 8330; -pub const ERROR_DS_CANT_MIX_MASTER_AND_REPS: ::DWORD = 8331; -pub const ERROR_DS_CHILDREN_EXIST: ::DWORD = 8332; -pub const ERROR_DS_OBJ_NOT_FOUND: ::DWORD = 8333; -pub const ERROR_DS_ALIASED_OBJ_MISSING: ::DWORD = 8334; -pub const ERROR_DS_BAD_NAME_SYNTAX: ::DWORD = 8335; -pub const ERROR_DS_ALIAS_POINTS_TO_ALIAS: ::DWORD = 8336; -pub const ERROR_DS_CANT_DEREF_ALIAS: ::DWORD = 8337; -pub const ERROR_DS_OUT_OF_SCOPE: ::DWORD = 8338; -pub const ERROR_DS_OBJECT_BEING_REMOVED: ::DWORD = 8339; -pub const ERROR_DS_CANT_DELETE_DSA_OBJ: ::DWORD = 8340; -pub const ERROR_DS_GENERIC_ERROR: ::DWORD = 8341; -pub const ERROR_DS_DSA_MUST_BE_INT_MASTER: ::DWORD = 8342; -pub const ERROR_DS_CLASS_NOT_DSA: ::DWORD = 8343; -pub const ERROR_DS_INSUFF_ACCESS_RIGHTS: ::DWORD = 8344; -pub const ERROR_DS_ILLEGAL_SUPERIOR: ::DWORD = 8345; -pub const ERROR_DS_ATTRIBUTE_OWNED_BY_SAM: ::DWORD = 8346; -pub const ERROR_DS_NAME_TOO_MANY_PARTS: ::DWORD = 8347; -pub const ERROR_DS_NAME_TOO_LONG: ::DWORD = 8348; -pub const ERROR_DS_NAME_VALUE_TOO_LONG: ::DWORD = 8349; -pub const ERROR_DS_NAME_UNPARSEABLE: ::DWORD = 8350; -pub const ERROR_DS_NAME_TYPE_UNKNOWN: ::DWORD = 8351; -pub const ERROR_DS_NOT_AN_OBJECT: ::DWORD = 8352; -pub const ERROR_DS_SEC_DESC_TOO_SHORT: ::DWORD = 8353; -pub const ERROR_DS_SEC_DESC_INVALID: ::DWORD = 8354; -pub const ERROR_DS_NO_DELETED_NAME: ::DWORD = 8355; -pub const ERROR_DS_SUBREF_MUST_HAVE_PARENT: ::DWORD = 8356; -pub const ERROR_DS_NCNAME_MUST_BE_NC: ::DWORD = 8357; -pub const ERROR_DS_CANT_ADD_SYSTEM_ONLY: ::DWORD = 8358; -pub const ERROR_DS_CLASS_MUST_BE_CONCRETE: ::DWORD = 8359; -pub const ERROR_DS_INVALID_DMD: ::DWORD = 8360; -pub const ERROR_DS_OBJ_GUID_EXISTS: ::DWORD = 8361; -pub const ERROR_DS_NOT_ON_BACKLINK: ::DWORD = 8362; -pub const ERROR_DS_NO_CROSSREF_FOR_NC: ::DWORD = 8363; -pub const ERROR_DS_SHUTTING_DOWN: ::DWORD = 8364; -pub const ERROR_DS_UNKNOWN_OPERATION: ::DWORD = 8365; -pub const ERROR_DS_INVALID_ROLE_OWNER: ::DWORD = 8366; -pub const ERROR_DS_COULDNT_CONTACT_FSMO: ::DWORD = 8367; -pub const ERROR_DS_CROSS_NC_DN_RENAME: ::DWORD = 8368; -pub const ERROR_DS_CANT_MOD_SYSTEM_ONLY: ::DWORD = 8369; -pub const ERROR_DS_REPLICATOR_ONLY: ::DWORD = 8370; -pub const ERROR_DS_OBJ_CLASS_NOT_DEFINED: ::DWORD = 8371; -pub const ERROR_DS_OBJ_CLASS_NOT_SUBCLASS: ::DWORD = 8372; -pub const ERROR_DS_NAME_REFERENCE_INVALID: ::DWORD = 8373; -pub const ERROR_DS_CROSS_REF_EXISTS: ::DWORD = 8374; -pub const ERROR_DS_CANT_DEL_MASTER_CROSSREF: ::DWORD = 8375; -pub const ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD: ::DWORD = 8376; -pub const ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX: ::DWORD = 8377; -pub const ERROR_DS_DUP_RDN: ::DWORD = 8378; -pub const ERROR_DS_DUP_OID: ::DWORD = 8379; -pub const ERROR_DS_DUP_MAPI_ID: ::DWORD = 8380; -pub const ERROR_DS_DUP_SCHEMA_ID_GUID: ::DWORD = 8381; -pub const ERROR_DS_DUP_LDAP_DISPLAY_NAME: ::DWORD = 8382; -pub const ERROR_DS_SEMANTIC_ATT_TEST: ::DWORD = 8383; -pub const ERROR_DS_SYNTAX_MISMATCH: ::DWORD = 8384; -pub const ERROR_DS_EXISTS_IN_MUST_HAVE: ::DWORD = 8385; -pub const ERROR_DS_EXISTS_IN_MAY_HAVE: ::DWORD = 8386; -pub const ERROR_DS_NONEXISTENT_MAY_HAVE: ::DWORD = 8387; -pub const ERROR_DS_NONEXISTENT_MUST_HAVE: ::DWORD = 8388; -pub const ERROR_DS_AUX_CLS_TEST_FAIL: ::DWORD = 8389; -pub const ERROR_DS_NONEXISTENT_POSS_SUP: ::DWORD = 8390; -pub const ERROR_DS_SUB_CLS_TEST_FAIL: ::DWORD = 8391; -pub const ERROR_DS_BAD_RDN_ATT_ID_SYNTAX: ::DWORD = 8392; -pub const ERROR_DS_EXISTS_IN_AUX_CLS: ::DWORD = 8393; -pub const ERROR_DS_EXISTS_IN_SUB_CLS: ::DWORD = 8394; -pub const ERROR_DS_EXISTS_IN_POSS_SUP: ::DWORD = 8395; -pub const ERROR_DS_RECALCSCHEMA_FAILED: ::DWORD = 8396; -pub const ERROR_DS_TREE_DELETE_NOT_FINISHED: ::DWORD = 8397; -pub const ERROR_DS_CANT_DELETE: ::DWORD = 8398; -pub const ERROR_DS_ATT_SCHEMA_REQ_ID: ::DWORD = 8399; -pub const ERROR_DS_BAD_ATT_SCHEMA_SYNTAX: ::DWORD = 8400; -pub const ERROR_DS_CANT_CACHE_ATT: ::DWORD = 8401; -pub const ERROR_DS_CANT_CACHE_CLASS: ::DWORD = 8402; -pub const ERROR_DS_CANT_REMOVE_ATT_CACHE: ::DWORD = 8403; -pub const ERROR_DS_CANT_REMOVE_CLASS_CACHE: ::DWORD = 8404; -pub const ERROR_DS_CANT_RETRIEVE_DN: ::DWORD = 8405; -pub const ERROR_DS_MISSING_SUPREF: ::DWORD = 8406; -pub const ERROR_DS_CANT_RETRIEVE_INSTANCE: ::DWORD = 8407; -pub const ERROR_DS_CODE_INCONSISTENCY: ::DWORD = 8408; -pub const ERROR_DS_DATABASE_ERROR: ::DWORD = 8409; -pub const ERROR_DS_GOVERNSID_MISSING: ::DWORD = 8410; -pub const ERROR_DS_MISSING_EXPECTED_ATT: ::DWORD = 8411; -pub const ERROR_DS_NCNAME_MISSING_CR_REF: ::DWORD = 8412; -pub const ERROR_DS_SECURITY_CHECKING_ERROR: ::DWORD = 8413; -pub const ERROR_DS_SCHEMA_NOT_LOADED: ::DWORD = 8414; -pub const ERROR_DS_SCHEMA_ALLOC_FAILED: ::DWORD = 8415; -pub const ERROR_DS_ATT_SCHEMA_REQ_SYNTAX: ::DWORD = 8416; -pub const ERROR_DS_GCVERIFY_ERROR: ::DWORD = 8417; -pub const ERROR_DS_DRA_SCHEMA_MISMATCH: ::DWORD = 8418; -pub const ERROR_DS_CANT_FIND_DSA_OBJ: ::DWORD = 8419; -pub const ERROR_DS_CANT_FIND_EXPECTED_NC: ::DWORD = 8420; -pub const ERROR_DS_CANT_FIND_NC_IN_CACHE: ::DWORD = 8421; -pub const ERROR_DS_CANT_RETRIEVE_CHILD: ::DWORD = 8422; -pub const ERROR_DS_SECURITY_ILLEGAL_MODIFY: ::DWORD = 8423; -pub const ERROR_DS_CANT_REPLACE_HIDDEN_REC: ::DWORD = 8424; -pub const ERROR_DS_BAD_HIERARCHY_FILE: ::DWORD = 8425; -pub const ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED: ::DWORD = 8426; -pub const ERROR_DS_CONFIG_PARAM_MISSING: ::DWORD = 8427; -pub const ERROR_DS_COUNTING_AB_INDICES_FAILED: ::DWORD = 8428; -pub const ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED: ::DWORD = 8429; -pub const ERROR_DS_INTERNAL_FAILURE: ::DWORD = 8430; -pub const ERROR_DS_UNKNOWN_ERROR: ::DWORD = 8431; -pub const ERROR_DS_ROOT_REQUIRES_CLASS_TOP: ::DWORD = 8432; -pub const ERROR_DS_REFUSING_FSMO_ROLES: ::DWORD = 8433; -pub const ERROR_DS_MISSING_FSMO_SETTINGS: ::DWORD = 8434; -pub const ERROR_DS_UNABLE_TO_SURRENDER_ROLES: ::DWORD = 8435; -pub const ERROR_DS_DRA_GENERIC: ::DWORD = 8436; -pub const ERROR_DS_DRA_INVALID_PARAMETER: ::DWORD = 8437; -pub const ERROR_DS_DRA_BUSY: ::DWORD = 8438; -pub const ERROR_DS_DRA_BAD_DN: ::DWORD = 8439; -pub const ERROR_DS_DRA_BAD_NC: ::DWORD = 8440; -pub const ERROR_DS_DRA_DN_EXISTS: ::DWORD = 8441; -pub const ERROR_DS_DRA_INTERNAL_ERROR: ::DWORD = 8442; -pub const ERROR_DS_DRA_INCONSISTENT_DIT: ::DWORD = 8443; -pub const ERROR_DS_DRA_CONNECTION_FAILED: ::DWORD = 8444; -pub const ERROR_DS_DRA_BAD_INSTANCE_TYPE: ::DWORD = 8445; -pub const ERROR_DS_DRA_OUT_OF_MEM: ::DWORD = 8446; -pub const ERROR_DS_DRA_MAIL_PROBLEM: ::DWORD = 8447; -pub const ERROR_DS_DRA_REF_ALREADY_EXISTS: ::DWORD = 8448; -pub const ERROR_DS_DRA_REF_NOT_FOUND: ::DWORD = 8449; -pub const ERROR_DS_DRA_OBJ_IS_REP_SOURCE: ::DWORD = 8450; -pub const ERROR_DS_DRA_DB_ERROR: ::DWORD = 8451; -pub const ERROR_DS_DRA_NO_REPLICA: ::DWORD = 8452; -pub const ERROR_DS_DRA_ACCESS_DENIED: ::DWORD = 8453; -pub const ERROR_DS_DRA_NOT_SUPPORTED: ::DWORD = 8454; -pub const ERROR_DS_DRA_RPC_CANCELLED: ::DWORD = 8455; -pub const ERROR_DS_DRA_SOURCE_DISABLED: ::DWORD = 8456; -pub const ERROR_DS_DRA_SINK_DISABLED: ::DWORD = 8457; -pub const ERROR_DS_DRA_NAME_COLLISION: ::DWORD = 8458; -pub const ERROR_DS_DRA_SOURCE_REINSTALLED: ::DWORD = 8459; -pub const ERROR_DS_DRA_MISSING_PARENT: ::DWORD = 8460; -pub const ERROR_DS_DRA_PREEMPTED: ::DWORD = 8461; -pub const ERROR_DS_DRA_ABANDON_SYNC: ::DWORD = 8462; -pub const ERROR_DS_DRA_SHUTDOWN: ::DWORD = 8463; -pub const ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET: ::DWORD = 8464; -pub const ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA: ::DWORD = 8465; -pub const ERROR_DS_DRA_EXTN_CONNECTION_FAILED: ::DWORD = 8466; -pub const ERROR_DS_INSTALL_SCHEMA_MISMATCH: ::DWORD = 8467; -pub const ERROR_DS_DUP_LINK_ID: ::DWORD = 8468; -pub const ERROR_DS_NAME_ERROR_RESOLVING: ::DWORD = 8469; -pub const ERROR_DS_NAME_ERROR_NOT_FOUND: ::DWORD = 8470; -pub const ERROR_DS_NAME_ERROR_NOT_UNIQUE: ::DWORD = 8471; -pub const ERROR_DS_NAME_ERROR_NO_MAPPING: ::DWORD = 8472; -pub const ERROR_DS_NAME_ERROR_DOMAIN_ONLY: ::DWORD = 8473; -pub const ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING: ::DWORD = 8474; -pub const ERROR_DS_CONSTRUCTED_ATT_MOD: ::DWORD = 8475; -pub const ERROR_DS_WRONG_OM_OBJ_CLASS: ::DWORD = 8476; -pub const ERROR_DS_DRA_REPL_PENDING: ::DWORD = 8477; -pub const ERROR_DS_DS_REQUIRED: ::DWORD = 8478; -pub const ERROR_DS_INVALID_LDAP_DISPLAY_NAME: ::DWORD = 8479; -pub const ERROR_DS_NON_BASE_SEARCH: ::DWORD = 8480; -pub const ERROR_DS_CANT_RETRIEVE_ATTS: ::DWORD = 8481; -pub const ERROR_DS_BACKLINK_WITHOUT_LINK: ::DWORD = 8482; -pub const ERROR_DS_EPOCH_MISMATCH: ::DWORD = 8483; -pub const ERROR_DS_SRC_NAME_MISMATCH: ::DWORD = 8484; -pub const ERROR_DS_SRC_AND_DST_NC_IDENTICAL: ::DWORD = 8485; -pub const ERROR_DS_DST_NC_MISMATCH: ::DWORD = 8486; -pub const ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC: ::DWORD = 8487; -pub const ERROR_DS_SRC_GUID_MISMATCH: ::DWORD = 8488; -pub const ERROR_DS_CANT_MOVE_DELETED_OBJECT: ::DWORD = 8489; -pub const ERROR_DS_PDC_OPERATION_IN_PROGRESS: ::DWORD = 8490; -pub const ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD: ::DWORD = 8491; -pub const ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION: ::DWORD = 8492; -pub const ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS: ::DWORD = 8493; -pub const ERROR_DS_NC_MUST_HAVE_NC_PARENT: ::DWORD = 8494; -pub const ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE: ::DWORD = 8495; -pub const ERROR_DS_DST_DOMAIN_NOT_NATIVE: ::DWORD = 8496; -pub const ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER: ::DWORD = 8497; -pub const ERROR_DS_CANT_MOVE_ACCOUNT_GROUP: ::DWORD = 8498; -pub const ERROR_DS_CANT_MOVE_RESOURCE_GROUP: ::DWORD = 8499; -pub const ERROR_DS_INVALID_SEARCH_FLAG: ::DWORD = 8500; -pub const ERROR_DS_NO_TREE_DELETE_ABOVE_NC: ::DWORD = 8501; -pub const ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE: ::DWORD = 8502; -pub const ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE: ::DWORD = 8503; -pub const ERROR_DS_SAM_INIT_FAILURE: ::DWORD = 8504; -pub const ERROR_DS_SENSITIVE_GROUP_VIOLATION: ::DWORD = 8505; -pub const ERROR_DS_CANT_MOD_PRIMARYGROUPID: ::DWORD = 8506; -pub const ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD: ::DWORD = 8507; -pub const ERROR_DS_NONSAFE_SCHEMA_CHANGE: ::DWORD = 8508; -pub const ERROR_DS_SCHEMA_UPDATE_DISALLOWED: ::DWORD = 8509; -pub const ERROR_DS_CANT_CREATE_UNDER_SCHEMA: ::DWORD = 8510; -pub const ERROR_DS_INSTALL_NO_SRC_SCH_VERSION: ::DWORD = 8511; -pub const ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE: ::DWORD = 8512; -pub const ERROR_DS_INVALID_GROUP_TYPE: ::DWORD = 8513; -pub const ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN: ::DWORD = 8514; -pub const ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN: ::DWORD = 8515; -pub const ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER: ::DWORD = 8516; -pub const ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER: ::DWORD = 8517; -pub const ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER: ::DWORD = 8518; -pub const ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER: ::DWORD = 8519; -pub const ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER: ::DWORD = 8520; -pub const ERROR_DS_HAVE_PRIMARY_MEMBERS: ::DWORD = 8521; -pub const ERROR_DS_STRING_SD_CONVERSION_FAILED: ::DWORD = 8522; -pub const ERROR_DS_NAMING_MASTER_GC: ::DWORD = 8523; -pub const ERROR_DS_DNS_LOOKUP_FAILURE: ::DWORD = 8524; -pub const ERROR_DS_COULDNT_UPDATE_SPNS: ::DWORD = 8525; -pub const ERROR_DS_CANT_RETRIEVE_SD: ::DWORD = 8526; -pub const ERROR_DS_KEY_NOT_UNIQUE: ::DWORD = 8527; -pub const ERROR_DS_WRONG_LINKED_ATT_SYNTAX: ::DWORD = 8528; -pub const ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD: ::DWORD = 8529; -pub const ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY: ::DWORD = 8530; -pub const ERROR_DS_CANT_START: ::DWORD = 8531; -pub const ERROR_DS_INIT_FAILURE: ::DWORD = 8532; -pub const ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION: ::DWORD = 8533; -pub const ERROR_DS_SOURCE_DOMAIN_IN_FOREST: ::DWORD = 8534; -pub const ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST: ::DWORD = 8535; -pub const ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED: ::DWORD = 8536; -pub const ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN: ::DWORD = 8537; -pub const ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER: ::DWORD = 8538; -pub const ERROR_DS_SRC_SID_EXISTS_IN_FOREST: ::DWORD = 8539; -pub const ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH: ::DWORD = 8540; -pub const ERROR_SAM_INIT_FAILURE: ::DWORD = 8541; -pub const ERROR_DS_DRA_SCHEMA_INFO_SHIP: ::DWORD = 8542; -pub const ERROR_DS_DRA_SCHEMA_CONFLICT: ::DWORD = 8543; -pub const ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT: ::DWORD = 8544; -pub const ERROR_DS_DRA_OBJ_NC_MISMATCH: ::DWORD = 8545; -pub const ERROR_DS_NC_STILL_HAS_DSAS: ::DWORD = 8546; -pub const ERROR_DS_GC_REQUIRED: ::DWORD = 8547; -pub const ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY: ::DWORD = 8548; -pub const ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS: ::DWORD = 8549; -pub const ERROR_DS_CANT_ADD_TO_GC: ::DWORD = 8550; -pub const ERROR_DS_NO_CHECKPOINT_WITH_PDC: ::DWORD = 8551; -pub const ERROR_DS_SOURCE_AUDITING_NOT_ENABLED: ::DWORD = 8552; -pub const ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC: ::DWORD = 8553; -pub const ERROR_DS_INVALID_NAME_FOR_SPN: ::DWORD = 8554; -pub const ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS: ::DWORD = 8555; -pub const ERROR_DS_UNICODEPWD_NOT_IN_QUOTES: ::DWORD = 8556; -pub const ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED: ::DWORD = 8557; -pub const ERROR_DS_MUST_BE_RUN_ON_DST_DC: ::DWORD = 8558; -pub const ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER: ::DWORD = 8559; -pub const ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ: ::DWORD = 8560; -pub const ERROR_DS_INIT_FAILURE_CONSOLE: ::DWORD = 8561; -pub const ERROR_DS_SAM_INIT_FAILURE_CONSOLE: ::DWORD = 8562; -pub const ERROR_DS_FOREST_VERSION_TOO_HIGH: ::DWORD = 8563; -pub const ERROR_DS_DOMAIN_VERSION_TOO_HIGH: ::DWORD = 8564; -pub const ERROR_DS_FOREST_VERSION_TOO_LOW: ::DWORD = 8565; -pub const ERROR_DS_DOMAIN_VERSION_TOO_LOW: ::DWORD = 8566; -pub const ERROR_DS_INCOMPATIBLE_VERSION: ::DWORD = 8567; -pub const ERROR_DS_LOW_DSA_VERSION: ::DWORD = 8568; -pub const ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN: ::DWORD = 8569; -pub const ERROR_DS_NOT_SUPPORTED_SORT_ORDER: ::DWORD = 8570; -pub const ERROR_DS_NAME_NOT_UNIQUE: ::DWORD = 8571; -pub const ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4: ::DWORD = 8572; -pub const ERROR_DS_OUT_OF_VERSION_STORE: ::DWORD = 8573; -pub const ERROR_DS_INCOMPATIBLE_CONTROLS_USED: ::DWORD = 8574; -pub const ERROR_DS_NO_REF_DOMAIN: ::DWORD = 8575; -pub const ERROR_DS_RESERVED_LINK_ID: ::DWORD = 8576; -pub const ERROR_DS_LINK_ID_NOT_AVAILABLE: ::DWORD = 8577; -pub const ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER: ::DWORD = 8578; -pub const ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE: ::DWORD = 8579; -pub const ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC: ::DWORD = 8580; -pub const ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG: ::DWORD = 8581; -pub const ERROR_DS_MODIFYDN_WRONG_GRANDPARENT: ::DWORD = 8582; -pub const ERROR_DS_NAME_ERROR_TRUST_REFERRAL: ::DWORD = 8583; -pub const ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER: ::DWORD = 8584; -pub const ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD: ::DWORD = 8585; -pub const ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2: ::DWORD = 8586; -pub const ERROR_DS_THREAD_LIMIT_EXCEEDED: ::DWORD = 8587; -pub const ERROR_DS_NOT_CLOSEST: ::DWORD = 8588; -pub const ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF: ::DWORD = 8589; -pub const ERROR_DS_SINGLE_USER_MODE_FAILED: ::DWORD = 8590; -pub const ERROR_DS_NTDSCRIPT_SYNTAX_ERROR: ::DWORD = 8591; -pub const ERROR_DS_NTDSCRIPT_PROCESS_ERROR: ::DWORD = 8592; -pub const ERROR_DS_DIFFERENT_REPL_EPOCHS: ::DWORD = 8593; -pub const ERROR_DS_DRS_EXTENSIONS_CHANGED: ::DWORD = 8594; -pub const ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR: ::DWORD = 8595; -pub const ERROR_DS_NO_MSDS_INTID: ::DWORD = 8596; -pub const ERROR_DS_DUP_MSDS_INTID: ::DWORD = 8597; -pub const ERROR_DS_EXISTS_IN_RDNATTID: ::DWORD = 8598; -pub const ERROR_DS_AUTHORIZATION_FAILED: ::DWORD = 8599; -pub const ERROR_DS_INVALID_SCRIPT: ::DWORD = 8600; -pub const ERROR_DS_REMOTE_CROSSREF_OP_FAILED: ::DWORD = 8601; -pub const ERROR_DS_CROSS_REF_BUSY: ::DWORD = 8602; -pub const ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN: ::DWORD = 8603; -pub const ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC: ::DWORD = 8604; -pub const ERROR_DS_DUPLICATE_ID_FOUND: ::DWORD = 8605; -pub const ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT: ::DWORD = 8606; -pub const ERROR_DS_GROUP_CONVERSION_ERROR: ::DWORD = 8607; -pub const ERROR_DS_CANT_MOVE_APP_BASIC_GROUP: ::DWORD = 8608; -pub const ERROR_DS_CANT_MOVE_APP_QUERY_GROUP: ::DWORD = 8609; -pub const ERROR_DS_ROLE_NOT_VERIFIED: ::DWORD = 8610; -pub const ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL: ::DWORD = 8611; -pub const ERROR_DS_DOMAIN_RENAME_IN_PROGRESS: ::DWORD = 8612; -pub const ERROR_DS_EXISTING_AD_CHILD_NC: ::DWORD = 8613; -pub const ERROR_DS_REPL_LIFETIME_EXCEEDED: ::DWORD = 8614; -pub const ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER: ::DWORD = 8615; -pub const ERROR_DS_LDAP_SEND_QUEUE_FULL: ::DWORD = 8616; -pub const ERROR_DS_DRA_OUT_SCHEDULE_WINDOW: ::DWORD = 8617; -pub const ERROR_DS_POLICY_NOT_KNOWN: ::DWORD = 8618; -pub const ERROR_NO_SITE_SETTINGS_OBJECT: ::DWORD = 8619; -pub const ERROR_NO_SECRETS: ::DWORD = 8620; -pub const ERROR_NO_WRITABLE_DC_FOUND: ::DWORD = 8621; -pub const ERROR_DS_NO_SERVER_OBJECT: ::DWORD = 8622; -pub const ERROR_DS_NO_NTDSA_OBJECT: ::DWORD = 8623; -pub const ERROR_DS_NON_ASQ_SEARCH: ::DWORD = 8624; -pub const ERROR_DS_AUDIT_FAILURE: ::DWORD = 8625; -pub const ERROR_DS_INVALID_SEARCH_FLAG_SUBTREE: ::DWORD = 8626; -pub const ERROR_DS_INVALID_SEARCH_FLAG_TUPLE: ::DWORD = 8627; -pub const ERROR_DS_HIERARCHY_TABLE_TOO_DEEP: ::DWORD = 8628; -pub const ERROR_DS_DRA_CORRUPT_UTD_VECTOR: ::DWORD = 8629; -pub const ERROR_DS_DRA_SECRETS_DENIED: ::DWORD = 8630; -pub const ERROR_DS_RESERVED_MAPI_ID: ::DWORD = 8631; -pub const ERROR_DS_MAPI_ID_NOT_AVAILABLE: ::DWORD = 8632; -pub const ERROR_DS_DRA_MISSING_KRBTGT_SECRET: ::DWORD = 8633; -pub const ERROR_DS_DOMAIN_NAME_EXISTS_IN_FOREST: ::DWORD = 8634; -pub const ERROR_DS_FLAT_NAME_EXISTS_IN_FOREST: ::DWORD = 8635; -pub const ERROR_INVALID_USER_PRINCIPAL_NAME: ::DWORD = 8636; -pub const ERROR_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS: ::DWORD = 8637; -pub const ERROR_DS_OID_NOT_FOUND: ::DWORD = 8638; -pub const ERROR_DS_DRA_RECYCLED_TARGET: ::DWORD = 8639; -pub const ERROR_DS_DISALLOWED_NC_REDIRECT: ::DWORD = 8640; -pub const ERROR_DS_HIGH_ADLDS_FFL: ::DWORD = 8641; -pub const ERROR_DS_HIGH_DSA_VERSION: ::DWORD = 8642; -pub const ERROR_DS_LOW_ADLDS_FFL: ::DWORD = 8643; -pub const ERROR_DOMAIN_SID_SAME_AS_LOCAL_WORKSTATION: ::DWORD = 8644; -pub const ERROR_DS_UNDELETE_SAM_VALIDATION_FAILED: ::DWORD = 8645; -pub const ERROR_INCORRECT_ACCOUNT_TYPE: ::DWORD = 8646; -pub const ERROR_DS_SPN_VALUE_NOT_UNIQUE_IN_FOREST: ::DWORD = 8647; -pub const ERROR_DS_UPN_VALUE_NOT_UNIQUE_IN_FOREST: ::DWORD = 8648; -pub const DNS_ERROR_RESPONSE_CODES_BASE: ::DWORD = 9000; -pub const DNS_ERROR_RCODE_NO_ERROR: ::DWORD = NO_ERROR; -pub const DNS_ERROR_MASK: ::DWORD = 0x00002328; -pub const DNS_ERROR_RCODE_FORMAT_ERROR: ::DWORD = 9001; -pub const DNS_ERROR_RCODE_SERVER_FAILURE: ::DWORD = 9002; -pub const DNS_ERROR_RCODE_NAME_ERROR: ::DWORD = 9003; -pub const DNS_ERROR_RCODE_NOT_IMPLEMENTED: ::DWORD = 9004; -pub const DNS_ERROR_RCODE_REFUSED: ::DWORD = 9005; -pub const DNS_ERROR_RCODE_YXDOMAIN: ::DWORD = 9006; -pub const DNS_ERROR_RCODE_YXRRSET: ::DWORD = 9007; -pub const DNS_ERROR_RCODE_NXRRSET: ::DWORD = 9008; -pub const DNS_ERROR_RCODE_NOTAUTH: ::DWORD = 9009; -pub const DNS_ERROR_RCODE_NOTZONE: ::DWORD = 9010; -pub const DNS_ERROR_RCODE_BADSIG: ::DWORD = 9016; -pub const DNS_ERROR_RCODE_BADKEY: ::DWORD = 9017; -pub const DNS_ERROR_RCODE_BADTIME: ::DWORD = 9018; -pub const DNS_ERROR_RCODE_LAST: ::DWORD = DNS_ERROR_RCODE_BADTIME; -pub const DNS_ERROR_DNSSEC_BASE: ::DWORD = 9100; -pub const DNS_ERROR_KEYMASTER_REQUIRED: ::DWORD = 9101; -pub const DNS_ERROR_NOT_ALLOWED_ON_SIGNED_ZONE: ::DWORD = 9102; -pub const DNS_ERROR_NSEC3_INCOMPATIBLE_WITH_RSA_SHA1: ::DWORD = 9103; -pub const DNS_ERROR_NOT_ENOUGH_SIGNING_KEY_DESCRIPTORS: ::DWORD = 9104; -pub const DNS_ERROR_UNSUPPORTED_ALGORITHM: ::DWORD = 9105; -pub const DNS_ERROR_INVALID_KEY_SIZE: ::DWORD = 9106; -pub const DNS_ERROR_SIGNING_KEY_NOT_ACCESSIBLE: ::DWORD = 9107; -pub const DNS_ERROR_KSP_DOES_NOT_SUPPORT_PROTECTION: ::DWORD = 9108; -pub const DNS_ERROR_UNEXPECTED_DATA_PROTECTION_ERROR: ::DWORD = 9109; -pub const DNS_ERROR_UNEXPECTED_CNG_ERROR: ::DWORD = 9110; -pub const DNS_ERROR_UNKNOWN_SIGNING_PARAMETER_VERSION: ::DWORD = 9111; -pub const DNS_ERROR_KSP_NOT_ACCESSIBLE: ::DWORD = 9112; -pub const DNS_ERROR_TOO_MANY_SKDS: ::DWORD = 9113; -pub const DNS_ERROR_INVALID_ROLLOVER_PERIOD: ::DWORD = 9114; -pub const DNS_ERROR_INVALID_INITIAL_ROLLOVER_OFFSET: ::DWORD = 9115; -pub const DNS_ERROR_ROLLOVER_IN_PROGRESS: ::DWORD = 9116; -pub const DNS_ERROR_STANDBY_KEY_NOT_PRESENT: ::DWORD = 9117; -pub const DNS_ERROR_NOT_ALLOWED_ON_ZSK: ::DWORD = 9118; -pub const DNS_ERROR_NOT_ALLOWED_ON_ACTIVE_SKD: ::DWORD = 9119; -pub const DNS_ERROR_ROLLOVER_ALREADY_QUEUED: ::DWORD = 9120; -pub const DNS_ERROR_NOT_ALLOWED_ON_UNSIGNED_ZONE: ::DWORD = 9121; -pub const DNS_ERROR_BAD_KEYMASTER: ::DWORD = 9122; -pub const DNS_ERROR_INVALID_SIGNATURE_VALIDITY_PERIOD: ::DWORD = 9123; -pub const DNS_ERROR_INVALID_NSEC3_ITERATION_COUNT: ::DWORD = 9124; -pub const DNS_ERROR_DNSSEC_IS_DISABLED: ::DWORD = 9125; -pub const DNS_ERROR_INVALID_XML: ::DWORD = 9126; -pub const DNS_ERROR_NO_VALID_TRUST_ANCHORS: ::DWORD = 9127; -pub const DNS_ERROR_ROLLOVER_NOT_POKEABLE: ::DWORD = 9128; -pub const DNS_ERROR_NSEC3_NAME_COLLISION: ::DWORD = 9129; -pub const DNS_ERROR_NSEC_INCOMPATIBLE_WITH_NSEC3_RSA_SHA1: ::DWORD = 9130; -pub const DNS_ERROR_PACKET_FMT_BASE: ::DWORD = 9500; -pub const DNS_INFO_NO_RECORDS: ::DWORD = 9501; -pub const DNS_ERROR_BAD_PACKET: ::DWORD = 9502; -pub const DNS_ERROR_NO_PACKET: ::DWORD = 9503; -pub const DNS_ERROR_RCODE: ::DWORD = 9504; -pub const DNS_ERROR_UNSECURE_PACKET: ::DWORD = 9505; -pub const DNS_STATUS_PACKET_UNSECURE: ::DWORD = DNS_ERROR_UNSECURE_PACKET; -pub const DNS_REQUEST_PENDING: ::DWORD = 9506; -pub const DNS_ERROR_NO_MEMORY: ::DWORD = ERROR_OUTOFMEMORY; -pub const DNS_ERROR_INVALID_NAME: ::DWORD = ERROR_INVALID_NAME; -pub const DNS_ERROR_INVALID_DATA: ::DWORD = ERROR_INVALID_DATA; -pub const DNS_ERROR_GENERAL_API_BASE: ::DWORD = 9550; -pub const DNS_ERROR_INVALID_TYPE: ::DWORD = 9551; -pub const DNS_ERROR_INVALID_IP_ADDRESS: ::DWORD = 9552; -pub const DNS_ERROR_INVALID_PROPERTY: ::DWORD = 9553; -pub const DNS_ERROR_TRY_AGAIN_LATER: ::DWORD = 9554; -pub const DNS_ERROR_NOT_UNIQUE: ::DWORD = 9555; -pub const DNS_ERROR_NON_RFC_NAME: ::DWORD = 9556; -pub const DNS_STATUS_FQDN: ::DWORD = 9557; -pub const DNS_STATUS_DOTTED_NAME: ::DWORD = 9558; -pub const DNS_STATUS_SINGLE_PART_NAME: ::DWORD = 9559; -pub const DNS_ERROR_INVALID_NAME_CHAR: ::DWORD = 9560; -pub const DNS_ERROR_NUMERIC_NAME: ::DWORD = 9561; -pub const DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER: ::DWORD = 9562; -pub const DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION: ::DWORD = 9563; -pub const DNS_ERROR_CANNOT_FIND_ROOT_HINTS: ::DWORD = 9564; -pub const DNS_ERROR_INCONSISTENT_ROOT_HINTS: ::DWORD = 9565; -pub const DNS_ERROR_DWORD_VALUE_TOO_SMALL: ::DWORD = 9566; -pub const DNS_ERROR_DWORD_VALUE_TOO_LARGE: ::DWORD = 9567; -pub const DNS_ERROR_BACKGROUND_LOADING: ::DWORD = 9568; -pub const DNS_ERROR_NOT_ALLOWED_ON_RODC: ::DWORD = 9569; -pub const DNS_ERROR_NOT_ALLOWED_UNDER_DNAME: ::DWORD = 9570; -pub const DNS_ERROR_DELEGATION_REQUIRED: ::DWORD = 9571; -pub const DNS_ERROR_INVALID_POLICY_TABLE: ::DWORD = 9572; -pub const DNS_ERROR_ZONE_BASE: ::DWORD = 9600; -pub const DNS_ERROR_ZONE_DOES_NOT_EXIST: ::DWORD = 9601; -pub const DNS_ERROR_NO_ZONE_INFO: ::DWORD = 9602; -pub const DNS_ERROR_INVALID_ZONE_OPERATION: ::DWORD = 9603; -pub const DNS_ERROR_ZONE_CONFIGURATION_ERROR: ::DWORD = 9604; -pub const DNS_ERROR_ZONE_HAS_NO_SOA_RECORD: ::DWORD = 9605; -pub const DNS_ERROR_ZONE_HAS_NO_NS_RECORDS: ::DWORD = 9606; -pub const DNS_ERROR_ZONE_LOCKED: ::DWORD = 9607; -pub const DNS_ERROR_ZONE_CREATION_FAILED: ::DWORD = 9608; -pub const DNS_ERROR_ZONE_ALREADY_EXISTS: ::DWORD = 9609; -pub const DNS_ERROR_AUTOZONE_ALREADY_EXISTS: ::DWORD = 9610; -pub const DNS_ERROR_INVALID_ZONE_TYPE: ::DWORD = 9611; -pub const DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP: ::DWORD = 9612; -pub const DNS_ERROR_ZONE_NOT_SECONDARY: ::DWORD = 9613; -pub const DNS_ERROR_NEED_SECONDARY_ADDRESSES: ::DWORD = 9614; -pub const DNS_ERROR_WINS_INIT_FAILED: ::DWORD = 9615; -pub const DNS_ERROR_NEED_WINS_SERVERS: ::DWORD = 9616; -pub const DNS_ERROR_NBSTAT_INIT_FAILED: ::DWORD = 9617; -pub const DNS_ERROR_SOA_DELETE_INVALID: ::DWORD = 9618; -pub const DNS_ERROR_FORWARDER_ALREADY_EXISTS: ::DWORD = 9619; -pub const DNS_ERROR_ZONE_REQUIRES_MASTER_IP: ::DWORD = 9620; -pub const DNS_ERROR_ZONE_IS_SHUTDOWN: ::DWORD = 9621; -pub const DNS_ERROR_ZONE_LOCKED_FOR_SIGNING: ::DWORD = 9622; -pub const DNS_ERROR_DATAFILE_BASE: ::DWORD = 9650; -pub const DNS_ERROR_PRIMARY_REQUIRES_DATAFILE: ::DWORD = 9651; -pub const DNS_ERROR_INVALID_DATAFILE_NAME: ::DWORD = 9652; -pub const DNS_ERROR_DATAFILE_OPEN_FAILURE: ::DWORD = 9653; -pub const DNS_ERROR_FILE_WRITEBACK_FAILED: ::DWORD = 9654; -pub const DNS_ERROR_DATAFILE_PARSING: ::DWORD = 9655; -pub const DNS_ERROR_DATABASE_BASE: ::DWORD = 9700; -pub const DNS_ERROR_RECORD_DOES_NOT_EXIST: ::DWORD = 9701; -pub const DNS_ERROR_RECORD_FORMAT: ::DWORD = 9702; -pub const DNS_ERROR_NODE_CREATION_FAILED: ::DWORD = 9703; -pub const DNS_ERROR_UNKNOWN_RECORD_TYPE: ::DWORD = 9704; -pub const DNS_ERROR_RECORD_TIMED_OUT: ::DWORD = 9705; -pub const DNS_ERROR_NAME_NOT_IN_ZONE: ::DWORD = 9706; -pub const DNS_ERROR_CNAME_LOOP: ::DWORD = 9707; -pub const DNS_ERROR_NODE_IS_CNAME: ::DWORD = 9708; -pub const DNS_ERROR_CNAME_COLLISION: ::DWORD = 9709; -pub const DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT: ::DWORD = 9710; -pub const DNS_ERROR_RECORD_ALREADY_EXISTS: ::DWORD = 9711; -pub const DNS_ERROR_SECONDARY_DATA: ::DWORD = 9712; -pub const DNS_ERROR_NO_CREATE_CACHE_DATA: ::DWORD = 9713; -pub const DNS_ERROR_NAME_DOES_NOT_EXIST: ::DWORD = 9714; -pub const DNS_WARNING_PTR_CREATE_FAILED: ::DWORD = 9715; -pub const DNS_WARNING_DOMAIN_UNDELETED: ::DWORD = 9716; -pub const DNS_ERROR_DS_UNAVAILABLE: ::DWORD = 9717; -pub const DNS_ERROR_DS_ZONE_ALREADY_EXISTS: ::DWORD = 9718; -pub const DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE: ::DWORD = 9719; -pub const DNS_ERROR_NODE_IS_DNAME: ::DWORD = 9720; -pub const DNS_ERROR_DNAME_COLLISION: ::DWORD = 9721; -pub const DNS_ERROR_ALIAS_LOOP: ::DWORD = 9722; -pub const DNS_ERROR_OPERATION_BASE: ::DWORD = 9750; -pub const DNS_INFO_AXFR_COMPLETE: ::DWORD = 9751; -pub const DNS_ERROR_AXFR: ::DWORD = 9752; -pub const DNS_INFO_ADDED_LOCAL_WINS: ::DWORD = 9753; -pub const DNS_ERROR_SECURE_BASE: ::DWORD = 9800; -pub const DNS_STATUS_CONTINUE_NEEDED: ::DWORD = 9801; -pub const DNS_ERROR_SETUP_BASE: ::DWORD = 9850; -pub const DNS_ERROR_NO_TCPIP: ::DWORD = 9851; -pub const DNS_ERROR_NO_DNS_SERVERS: ::DWORD = 9852; -pub const DNS_ERROR_DP_BASE: ::DWORD = 9900; -pub const DNS_ERROR_DP_DOES_NOT_EXIST: ::DWORD = 9901; -pub const DNS_ERROR_DP_ALREADY_EXISTS: ::DWORD = 9902; -pub const DNS_ERROR_DP_NOT_ENLISTED: ::DWORD = 9903; -pub const DNS_ERROR_DP_ALREADY_ENLISTED: ::DWORD = 9904; -pub const DNS_ERROR_DP_NOT_AVAILABLE: ::DWORD = 9905; -pub const DNS_ERROR_DP_FSMO_ERROR: ::DWORD = 9906; -pub const DNS_ERROR_ZONESCOPE_ALREADY_EXISTS: ::DWORD = 9951; -pub const DNS_ERROR_ZONESCOPE_DOES_NOT_EXIST: ::DWORD = 9952; -pub const DNS_ERROR_DEFAULT_ZONESCOPE: ::DWORD = 9953; -pub const DNS_ERROR_INVALID_ZONESCOPE_NAME: ::DWORD = 9954; -pub const DNS_ERROR_NOT_ALLOWED_WITH_ZONESCOPES: ::DWORD = 9955; -pub const DNS_ERROR_LOAD_ZONESCOPE_FAILED: ::DWORD = 9956; -pub const DNS_ERROR_ZONESCOPE_FILE_WRITEBACK_FAILED: ::DWORD = 9957; -pub const DNS_ERROR_INVALID_SCOPE_NAME: ::DWORD = 9958; -pub const DNS_ERROR_SCOPE_DOES_NOT_EXIST: ::DWORD = 9959; -pub const DNS_ERROR_DEFAULT_SCOPE: ::DWORD = 9960; -pub const DNS_ERROR_INVALID_SCOPE_OPERATION: ::DWORD = 9961; -pub const DNS_ERROR_SCOPE_LOCKED: ::DWORD = 9962; -pub const DNS_ERROR_SCOPE_ALREADY_EXISTS: ::DWORD = 9963; -pub const WSABASEERR: ::DWORD = 10000; -pub const WSAEINTR: ::DWORD = 10004; -pub const WSAEBADF: ::DWORD = 10009; -pub const WSAEACCES: ::DWORD = 10013; -pub const WSAEFAULT: ::DWORD = 10014; -pub const WSAEINVAL: ::DWORD = 10022; -pub const WSAEMFILE: ::DWORD = 10024; -pub const WSAEWOULDBLOCK: ::DWORD = 10035; -pub const WSAEINPROGRESS: ::DWORD = 10036; -pub const WSAEALREADY: ::DWORD = 10037; -pub const WSAENOTSOCK: ::DWORD = 10038; -pub const WSAEDESTADDRREQ: ::DWORD = 10039; -pub const WSAEMSGSIZE: ::DWORD = 10040; -pub const WSAEPROTOTYPE: ::DWORD = 10041; -pub const WSAENOPROTOOPT: ::DWORD = 10042; -pub const WSAEPROTONOSUPPORT: ::DWORD = 10043; -pub const WSAESOCKTNOSUPPORT: ::DWORD = 10044; -pub const WSAEOPNOTSUPP: ::DWORD = 10045; -pub const WSAEPFNOSUPPORT: ::DWORD = 10046; -pub const WSAEAFNOSUPPORT: ::DWORD = 10047; -pub const WSAEADDRINUSE: ::DWORD = 10048; -pub const WSAEADDRNOTAVAIL: ::DWORD = 10049; -pub const WSAENETDOWN: ::DWORD = 10050; -pub const WSAENETUNREACH: ::DWORD = 10051; -pub const WSAENETRESET: ::DWORD = 10052; -pub const WSAECONNABORTED: ::DWORD = 10053; -pub const WSAECONNRESET: ::DWORD = 10054; -pub const WSAENOBUFS: ::DWORD = 10055; -pub const WSAEISCONN: ::DWORD = 10056; -pub const WSAENOTCONN: ::DWORD = 10057; -pub const WSAESHUTDOWN: ::DWORD = 10058; -pub const WSAETOOMANYREFS: ::DWORD = 10059; -pub const WSAETIMEDOUT: ::DWORD = 10060; -pub const WSAECONNREFUSED: ::DWORD = 10061; -pub const WSAELOOP: ::DWORD = 10062; -pub const WSAENAMETOOLONG: ::DWORD = 10063; -pub const WSAEHOSTDOWN: ::DWORD = 10064; -pub const WSAEHOSTUNREACH: ::DWORD = 10065; -pub const WSAENOTEMPTY: ::DWORD = 10066; -pub const WSAEPROCLIM: ::DWORD = 10067; -pub const WSAEUSERS: ::DWORD = 10068; -pub const WSAEDQUOT: ::DWORD = 10069; -pub const WSAESTALE: ::DWORD = 10070; -pub const WSAEREMOTE: ::DWORD = 10071; -pub const WSASYSNOTREADY: ::DWORD = 10091; -pub const WSAVERNOTSUPPORTED: ::DWORD = 10092; -pub const WSANOTINITIALISED: ::DWORD = 10093; -pub const WSAEDISCON: ::DWORD = 10101; -pub const WSAENOMORE: ::DWORD = 10102; -pub const WSAECANCELLED: ::DWORD = 10103; -pub const WSAEINVALIDPROCTABLE: ::DWORD = 10104; -pub const WSAEINVALIDPROVIDER: ::DWORD = 10105; -pub const WSAEPROVIDERFAILEDINIT: ::DWORD = 10106; -pub const WSASYSCALLFAILURE: ::DWORD = 10107; -pub const WSASERVICE_NOT_FOUND: ::DWORD = 10108; -pub const WSATYPE_NOT_FOUND: ::DWORD = 10109; -pub const WSA_E_NO_MORE: ::DWORD = 10110; -pub const WSA_E_CANCELLED: ::DWORD = 10111; -pub const WSAEREFUSED: ::DWORD = 10112; -pub const WSAHOST_NOT_FOUND: ::DWORD = 11001; -pub const WSATRY_AGAIN: ::DWORD = 11002; -pub const WSANO_RECOVERY: ::DWORD = 11003; -pub const WSANO_DATA: ::DWORD = 11004; -pub const WSA_QOS_RECEIVERS: ::DWORD = 11005; -pub const WSA_QOS_SENDERS: ::DWORD = 11006; -pub const WSA_QOS_NO_SENDERS: ::DWORD = 11007; -pub const WSA_QOS_NO_RECEIVERS: ::DWORD = 11008; -pub const WSA_QOS_REQUEST_CONFIRMED: ::DWORD = 11009; -pub const WSA_QOS_ADMISSION_FAILURE: ::DWORD = 11010; -pub const WSA_QOS_POLICY_FAILURE: ::DWORD = 11011; -pub const WSA_QOS_BAD_STYLE: ::DWORD = 11012; -pub const WSA_QOS_BAD_OBJECT: ::DWORD = 11013; -pub const WSA_QOS_TRAFFIC_CTRL_ERROR: ::DWORD = 11014; -pub const WSA_QOS_GENERIC_ERROR: ::DWORD = 11015; -pub const WSA_QOS_ESERVICETYPE: ::DWORD = 11016; -pub const WSA_QOS_EFLOWSPEC: ::DWORD = 11017; -pub const WSA_QOS_EPROVSPECBUF: ::DWORD = 11018; -pub const WSA_QOS_EFILTERSTYLE: ::DWORD = 11019; -pub const WSA_QOS_EFILTERTYPE: ::DWORD = 11020; -pub const WSA_QOS_EFILTERCOUNT: ::DWORD = 11021; -pub const WSA_QOS_EOBJLENGTH: ::DWORD = 11022; -pub const WSA_QOS_EFLOWCOUNT: ::DWORD = 11023; -pub const WSA_QOS_EUNKOWNPSOBJ: ::DWORD = 11024; -pub const WSA_QOS_EPOLICYOBJ: ::DWORD = 11025; -pub const WSA_QOS_EFLOWDESC: ::DWORD = 11026; -pub const WSA_QOS_EPSFLOWSPEC: ::DWORD = 11027; -pub const WSA_QOS_EPSFILTERSPEC: ::DWORD = 11028; -pub const WSA_QOS_ESDMODEOBJ: ::DWORD = 11029; -pub const WSA_QOS_ESHAPERATEOBJ: ::DWORD = 11030; -pub const WSA_QOS_RESERVED_PETYPE: ::DWORD = 11031; -pub const WSA_SECURE_HOST_NOT_FOUND: ::DWORD = 11032; -pub const WSA_IPSEC_NAME_POLICY_ERROR: ::DWORD = 11033; -pub const ERROR_IPSEC_QM_POLICY_EXISTS: ::DWORD = 13000; -pub const ERROR_IPSEC_QM_POLICY_NOT_FOUND: ::DWORD = 13001; -pub const ERROR_IPSEC_QM_POLICY_IN_USE: ::DWORD = 13002; -pub const ERROR_IPSEC_MM_POLICY_EXISTS: ::DWORD = 13003; -pub const ERROR_IPSEC_MM_POLICY_NOT_FOUND: ::DWORD = 13004; -pub const ERROR_IPSEC_MM_POLICY_IN_USE: ::DWORD = 13005; -pub const ERROR_IPSEC_MM_FILTER_EXISTS: ::DWORD = 13006; -pub const ERROR_IPSEC_MM_FILTER_NOT_FOUND: ::DWORD = 13007; -pub const ERROR_IPSEC_TRANSPORT_FILTER_EXISTS: ::DWORD = 13008; -pub const ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND: ::DWORD = 13009; -pub const ERROR_IPSEC_MM_AUTH_EXISTS: ::DWORD = 13010; -pub const ERROR_IPSEC_MM_AUTH_NOT_FOUND: ::DWORD = 13011; -pub const ERROR_IPSEC_MM_AUTH_IN_USE: ::DWORD = 13012; -pub const ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND: ::DWORD = 13013; -pub const ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND: ::DWORD = 13014; -pub const ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND: ::DWORD = 13015; -pub const ERROR_IPSEC_TUNNEL_FILTER_EXISTS: ::DWORD = 13016; -pub const ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND: ::DWORD = 13017; -pub const ERROR_IPSEC_MM_FILTER_PENDING_DELETION: ::DWORD = 13018; -pub const ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION: ::DWORD = 13019; -pub const ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION: ::DWORD = 13020; -pub const ERROR_IPSEC_MM_POLICY_PENDING_DELETION: ::DWORD = 13021; -pub const ERROR_IPSEC_MM_AUTH_PENDING_DELETION: ::DWORD = 13022; -pub const ERROR_IPSEC_QM_POLICY_PENDING_DELETION: ::DWORD = 13023; -pub const WARNING_IPSEC_MM_POLICY_PRUNED: ::DWORD = 13024; -pub const WARNING_IPSEC_QM_POLICY_PRUNED: ::DWORD = 13025; -pub const ERROR_IPSEC_IKE_NEG_STATUS_BEGIN: ::DWORD = 13800; -pub const ERROR_IPSEC_IKE_AUTH_FAIL: ::DWORD = 13801; -pub const ERROR_IPSEC_IKE_ATTRIB_FAIL: ::DWORD = 13802; -pub const ERROR_IPSEC_IKE_NEGOTIATION_PENDING: ::DWORD = 13803; -pub const ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR: ::DWORD = 13804; -pub const ERROR_IPSEC_IKE_TIMED_OUT: ::DWORD = 13805; -pub const ERROR_IPSEC_IKE_NO_CERT: ::DWORD = 13806; -pub const ERROR_IPSEC_IKE_SA_DELETED: ::DWORD = 13807; -pub const ERROR_IPSEC_IKE_SA_REAPED: ::DWORD = 13808; -pub const ERROR_IPSEC_IKE_MM_ACQUIRE_DROP: ::DWORD = 13809; -pub const ERROR_IPSEC_IKE_QM_ACQUIRE_DROP: ::DWORD = 13810; -pub const ERROR_IPSEC_IKE_QUEUE_DROP_MM: ::DWORD = 13811; -pub const ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM: ::DWORD = 13812; -pub const ERROR_IPSEC_IKE_DROP_NO_RESPONSE: ::DWORD = 13813; -pub const ERROR_IPSEC_IKE_MM_DELAY_DROP: ::DWORD = 13814; -pub const ERROR_IPSEC_IKE_QM_DELAY_DROP: ::DWORD = 13815; -pub const ERROR_IPSEC_IKE_ERROR: ::DWORD = 13816; -pub const ERROR_IPSEC_IKE_CRL_FAILED: ::DWORD = 13817; -pub const ERROR_IPSEC_IKE_INVALID_KEY_USAGE: ::DWORD = 13818; -pub const ERROR_IPSEC_IKE_INVALID_CERT_TYPE: ::DWORD = 13819; -pub const ERROR_IPSEC_IKE_NO_PRIVATE_KEY: ::DWORD = 13820; -pub const ERROR_IPSEC_IKE_SIMULTANEOUS_REKEY: ::DWORD = 13821; -pub const ERROR_IPSEC_IKE_DH_FAIL: ::DWORD = 13822; -pub const ERROR_IPSEC_IKE_CRITICAL_PAYLOAD_NOT_RECOGNIZED: ::DWORD = 13823; -pub const ERROR_IPSEC_IKE_INVALID_HEADER: ::DWORD = 13824; -pub const ERROR_IPSEC_IKE_NO_POLICY: ::DWORD = 13825; -pub const ERROR_IPSEC_IKE_INVALID_SIGNATURE: ::DWORD = 13826; -pub const ERROR_IPSEC_IKE_KERBEROS_ERROR: ::DWORD = 13827; -pub const ERROR_IPSEC_IKE_NO_PUBLIC_KEY: ::DWORD = 13828; -pub const ERROR_IPSEC_IKE_PROCESS_ERR: ::DWORD = 13829; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_SA: ::DWORD = 13830; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_PROP: ::DWORD = 13831; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_TRANS: ::DWORD = 13832; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_KE: ::DWORD = 13833; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_ID: ::DWORD = 13834; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_CERT: ::DWORD = 13835; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ: ::DWORD = 13836; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_HASH: ::DWORD = 13837; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_SIG: ::DWORD = 13838; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_NONCE: ::DWORD = 13839; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY: ::DWORD = 13840; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_DELETE: ::DWORD = 13841; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR: ::DWORD = 13842; -pub const ERROR_IPSEC_IKE_INVALID_PAYLOAD: ::DWORD = 13843; -pub const ERROR_IPSEC_IKE_LOAD_SOFT_SA: ::DWORD = 13844; -pub const ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN: ::DWORD = 13845; -pub const ERROR_IPSEC_IKE_INVALID_COOKIE: ::DWORD = 13846; -pub const ERROR_IPSEC_IKE_NO_PEER_CERT: ::DWORD = 13847; -pub const ERROR_IPSEC_IKE_PEER_CRL_FAILED: ::DWORD = 13848; -pub const ERROR_IPSEC_IKE_POLICY_CHANGE: ::DWORD = 13849; -pub const ERROR_IPSEC_IKE_NO_MM_POLICY: ::DWORD = 13850; -pub const ERROR_IPSEC_IKE_NOTCBPRIV: ::DWORD = 13851; -pub const ERROR_IPSEC_IKE_SECLOADFAIL: ::DWORD = 13852; -pub const ERROR_IPSEC_IKE_FAILSSPINIT: ::DWORD = 13853; -pub const ERROR_IPSEC_IKE_FAILQUERYSSP: ::DWORD = 13854; -pub const ERROR_IPSEC_IKE_SRVACQFAIL: ::DWORD = 13855; -pub const ERROR_IPSEC_IKE_SRVQUERYCRED: ::DWORD = 13856; -pub const ERROR_IPSEC_IKE_GETSPIFAIL: ::DWORD = 13857; -pub const ERROR_IPSEC_IKE_INVALID_FILTER: ::DWORD = 13858; -pub const ERROR_IPSEC_IKE_OUT_OF_MEMORY: ::DWORD = 13859; -pub const ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED: ::DWORD = 13860; -pub const ERROR_IPSEC_IKE_INVALID_POLICY: ::DWORD = 13861; -pub const ERROR_IPSEC_IKE_UNKNOWN_DOI: ::DWORD = 13862; -pub const ERROR_IPSEC_IKE_INVALID_SITUATION: ::DWORD = 13863; -pub const ERROR_IPSEC_IKE_DH_FAILURE: ::DWORD = 13864; -pub const ERROR_IPSEC_IKE_INVALID_GROUP: ::DWORD = 13865; -pub const ERROR_IPSEC_IKE_ENCRYPT: ::DWORD = 13866; -pub const ERROR_IPSEC_IKE_DECRYPT: ::DWORD = 13867; -pub const ERROR_IPSEC_IKE_POLICY_MATCH: ::DWORD = 13868; -pub const ERROR_IPSEC_IKE_UNSUPPORTED_ID: ::DWORD = 13869; -pub const ERROR_IPSEC_IKE_INVALID_HASH: ::DWORD = 13870; -pub const ERROR_IPSEC_IKE_INVALID_HASH_ALG: ::DWORD = 13871; -pub const ERROR_IPSEC_IKE_INVALID_HASH_SIZE: ::DWORD = 13872; -pub const ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG: ::DWORD = 13873; -pub const ERROR_IPSEC_IKE_INVALID_AUTH_ALG: ::DWORD = 13874; -pub const ERROR_IPSEC_IKE_INVALID_SIG: ::DWORD = 13875; -pub const ERROR_IPSEC_IKE_LOAD_FAILED: ::DWORD = 13876; -pub const ERROR_IPSEC_IKE_RPC_DELETE: ::DWORD = 13877; -pub const ERROR_IPSEC_IKE_BENIGN_REINIT: ::DWORD = 13878; -pub const ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY: ::DWORD = 13879; -pub const ERROR_IPSEC_IKE_INVALID_MAJOR_VERSION: ::DWORD = 13880; -pub const ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN: ::DWORD = 13881; -pub const ERROR_IPSEC_IKE_MM_LIMIT: ::DWORD = 13882; -pub const ERROR_IPSEC_IKE_NEGOTIATION_DISABLED: ::DWORD = 13883; -pub const ERROR_IPSEC_IKE_QM_LIMIT: ::DWORD = 13884; -pub const ERROR_IPSEC_IKE_MM_EXPIRED: ::DWORD = 13885; -pub const ERROR_IPSEC_IKE_PEER_MM_ASSUMED_INVALID: ::DWORD = 13886; -pub const ERROR_IPSEC_IKE_CERT_CHAIN_POLICY_MISMATCH: ::DWORD = 13887; -pub const ERROR_IPSEC_IKE_UNEXPECTED_MESSAGE_ID: ::DWORD = 13888; -pub const ERROR_IPSEC_IKE_INVALID_AUTH_PAYLOAD: ::DWORD = 13889; -pub const ERROR_IPSEC_IKE_DOS_COOKIE_SENT: ::DWORD = 13890; -pub const ERROR_IPSEC_IKE_SHUTTING_DOWN: ::DWORD = 13891; -pub const ERROR_IPSEC_IKE_CGA_AUTH_FAILED: ::DWORD = 13892; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_NATOA: ::DWORD = 13893; -pub const ERROR_IPSEC_IKE_INVALID_MM_FOR_QM: ::DWORD = 13894; -pub const ERROR_IPSEC_IKE_QM_EXPIRED: ::DWORD = 13895; -pub const ERROR_IPSEC_IKE_TOO_MANY_FILTERS: ::DWORD = 13896; -pub const ERROR_IPSEC_IKE_NEG_STATUS_END: ::DWORD = 13897; -pub const ERROR_IPSEC_IKE_KILL_DUMMY_NAP_TUNNEL: ::DWORD = 13898; -pub const ERROR_IPSEC_IKE_INNER_IP_ASSIGNMENT_FAILURE: ::DWORD = 13899; -pub const ERROR_IPSEC_IKE_REQUIRE_CP_PAYLOAD_MISSING: ::DWORD = 13900; -pub const ERROR_IPSEC_KEY_MODULE_IMPERSONATION_NEGOTIATION_PENDING: ::DWORD = 13901; -pub const ERROR_IPSEC_IKE_COEXISTENCE_SUPPRESS: ::DWORD = 13902; -pub const ERROR_IPSEC_IKE_RATELIMIT_DROP: ::DWORD = 13903; -pub const ERROR_IPSEC_IKE_PEER_DOESNT_SUPPORT_MOBIKE: ::DWORD = 13904; -pub const ERROR_IPSEC_IKE_AUTHORIZATION_FAILURE: ::DWORD = 13905; -pub const ERROR_IPSEC_IKE_STRONG_CRED_AUTHORIZATION_FAILURE: ::DWORD = 13906; -pub const ERROR_IPSEC_IKE_AUTHORIZATION_FAILURE_WITH_OPTIONAL_RETRY: ::DWORD = 13907; -pub const ERROR_IPSEC_IKE_STRONG_CRED_AUTHORIZATION_AND_CERTMAP_FAILURE: ::DWORD = 13908; -pub const ERROR_IPSEC_IKE_NEG_STATUS_EXTENDED_END: ::DWORD = 13909; -pub const ERROR_IPSEC_BAD_SPI: ::DWORD = 13910; -pub const ERROR_IPSEC_SA_LIFETIME_EXPIRED: ::DWORD = 13911; -pub const ERROR_IPSEC_WRONG_SA: ::DWORD = 13912; -pub const ERROR_IPSEC_REPLAY_CHECK_FAILED: ::DWORD = 13913; -pub const ERROR_IPSEC_INVALID_PACKET: ::DWORD = 13914; -pub const ERROR_IPSEC_INTEGRITY_CHECK_FAILED: ::DWORD = 13915; -pub const ERROR_IPSEC_CLEAR_TEXT_DROP: ::DWORD = 13916; -pub const ERROR_IPSEC_AUTH_FIREWALL_DROP: ::DWORD = 13917; -pub const ERROR_IPSEC_THROTTLE_DROP: ::DWORD = 13918; -pub const ERROR_IPSEC_DOSP_BLOCK: ::DWORD = 13925; -pub const ERROR_IPSEC_DOSP_RECEIVED_MULTICAST: ::DWORD = 13926; -pub const ERROR_IPSEC_DOSP_INVALID_PACKET: ::DWORD = 13927; -pub const ERROR_IPSEC_DOSP_STATE_LOOKUP_FAILED: ::DWORD = 13928; -pub const ERROR_IPSEC_DOSP_MAX_ENTRIES: ::DWORD = 13929; -pub const ERROR_IPSEC_DOSP_KEYMOD_NOT_ALLOWED: ::DWORD = 13930; -pub const ERROR_IPSEC_DOSP_NOT_INSTALLED: ::DWORD = 13931; -pub const ERROR_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES: ::DWORD = 13932; -pub const ERROR_SXS_SECTION_NOT_FOUND: ::DWORD = 14000; -pub const ERROR_SXS_CANT_GEN_ACTCTX: ::DWORD = 14001; -pub const ERROR_SXS_INVALID_ACTCTXDATA_FORMAT: ::DWORD = 14002; -pub const ERROR_SXS_ASSEMBLY_NOT_FOUND: ::DWORD = 14003; -pub const ERROR_SXS_MANIFEST_FORMAT_ERROR: ::DWORD = 14004; -pub const ERROR_SXS_MANIFEST_PARSE_ERROR: ::DWORD = 14005; -pub const ERROR_SXS_ACTIVATION_CONTEXT_DISABLED: ::DWORD = 14006; -pub const ERROR_SXS_KEY_NOT_FOUND: ::DWORD = 14007; -pub const ERROR_SXS_VERSION_CONFLICT: ::DWORD = 14008; -pub const ERROR_SXS_WRONG_SECTION_TYPE: ::DWORD = 14009; -pub const ERROR_SXS_THREAD_QUERIES_DISABLED: ::DWORD = 14010; -pub const ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET: ::DWORD = 14011; -pub const ERROR_SXS_UNKNOWN_ENCODING_GROUP: ::DWORD = 14012; -pub const ERROR_SXS_UNKNOWN_ENCODING: ::DWORD = 14013; -pub const ERROR_SXS_INVALID_XML_NAMESPACE_URI: ::DWORD = 14014; -pub const ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED: ::DWORD = 14015; -pub const ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED: ::DWORD = 14016; -pub const ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE: ::DWORD = 14017; -pub const ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE: ::DWORD = 14018; -pub const ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE: ::DWORD = 14019; -pub const ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT: ::DWORD = 14020; -pub const ERROR_SXS_DUPLICATE_DLL_NAME: ::DWORD = 14021; -pub const ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME: ::DWORD = 14022; -pub const ERROR_SXS_DUPLICATE_CLSID: ::DWORD = 14023; -pub const ERROR_SXS_DUPLICATE_IID: ::DWORD = 14024; -pub const ERROR_SXS_DUPLICATE_TLBID: ::DWORD = 14025; -pub const ERROR_SXS_DUPLICATE_PROGID: ::DWORD = 14026; -pub const ERROR_SXS_DUPLICATE_ASSEMBLY_NAME: ::DWORD = 14027; -pub const ERROR_SXS_FILE_HASH_MISMATCH: ::DWORD = 14028; -pub const ERROR_SXS_POLICY_PARSE_ERROR: ::DWORD = 14029; -pub const ERROR_SXS_XML_E_MISSINGQUOTE: ::DWORD = 14030; -pub const ERROR_SXS_XML_E_COMMENTSYNTAX: ::DWORD = 14031; -pub const ERROR_SXS_XML_E_BADSTARTNAMECHAR: ::DWORD = 14032; -pub const ERROR_SXS_XML_E_BADNAMECHAR: ::DWORD = 14033; -pub const ERROR_SXS_XML_E_BADCHARINSTRING: ::DWORD = 14034; -pub const ERROR_SXS_XML_E_XMLDECLSYNTAX: ::DWORD = 14035; -pub const ERROR_SXS_XML_E_BADCHARDATA: ::DWORD = 14036; -pub const ERROR_SXS_XML_E_MISSINGWHITESPACE: ::DWORD = 14037; -pub const ERROR_SXS_XML_E_EXPECTINGTAGEND: ::DWORD = 14038; -pub const ERROR_SXS_XML_E_MISSINGSEMICOLON: ::DWORD = 14039; -pub const ERROR_SXS_XML_E_UNBALANCEDPAREN: ::DWORD = 14040; -pub const ERROR_SXS_XML_E_INTERNALERROR: ::DWORD = 14041; -pub const ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE: ::DWORD = 14042; -pub const ERROR_SXS_XML_E_INCOMPLETE_ENCODING: ::DWORD = 14043; -pub const ERROR_SXS_XML_E_MISSING_PAREN: ::DWORD = 14044; -pub const ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE: ::DWORD = 14045; -pub const ERROR_SXS_XML_E_MULTIPLE_COLONS: ::DWORD = 14046; -pub const ERROR_SXS_XML_E_INVALID_DECIMAL: ::DWORD = 14047; -pub const ERROR_SXS_XML_E_INVALID_HEXIDECIMAL: ::DWORD = 14048; -pub const ERROR_SXS_XML_E_INVALID_UNICODE: ::DWORD = 14049; -pub const ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK: ::DWORD = 14050; -pub const ERROR_SXS_XML_E_UNEXPECTEDENDTAG: ::DWORD = 14051; -pub const ERROR_SXS_XML_E_UNCLOSEDTAG: ::DWORD = 14052; -pub const ERROR_SXS_XML_E_DUPLICATEATTRIBUTE: ::DWORD = 14053; -pub const ERROR_SXS_XML_E_MULTIPLEROOTS: ::DWORD = 14054; -pub const ERROR_SXS_XML_E_INVALIDATROOTLEVEL: ::DWORD = 14055; -pub const ERROR_SXS_XML_E_BADXMLDECL: ::DWORD = 14056; -pub const ERROR_SXS_XML_E_MISSINGROOT: ::DWORD = 14057; -pub const ERROR_SXS_XML_E_UNEXPECTEDEOF: ::DWORD = 14058; -pub const ERROR_SXS_XML_E_BADPEREFINSUBSET: ::DWORD = 14059; -pub const ERROR_SXS_XML_E_UNCLOSEDSTARTTAG: ::DWORD = 14060; -pub const ERROR_SXS_XML_E_UNCLOSEDENDTAG: ::DWORD = 14061; -pub const ERROR_SXS_XML_E_UNCLOSEDSTRING: ::DWORD = 14062; -pub const ERROR_SXS_XML_E_UNCLOSEDCOMMENT: ::DWORD = 14063; -pub const ERROR_SXS_XML_E_UNCLOSEDDECL: ::DWORD = 14064; -pub const ERROR_SXS_XML_E_UNCLOSEDCDATA: ::DWORD = 14065; -pub const ERROR_SXS_XML_E_RESERVEDNAMESPACE: ::DWORD = 14066; -pub const ERROR_SXS_XML_E_INVALIDENCODING: ::DWORD = 14067; -pub const ERROR_SXS_XML_E_INVALIDSWITCH: ::DWORD = 14068; -pub const ERROR_SXS_XML_E_BADXMLCASE: ::DWORD = 14069; -pub const ERROR_SXS_XML_E_INVALID_STANDALONE: ::DWORD = 14070; -pub const ERROR_SXS_XML_E_UNEXPECTED_STANDALONE: ::DWORD = 14071; -pub const ERROR_SXS_XML_E_INVALID_VERSION: ::DWORD = 14072; -pub const ERROR_SXS_XML_E_MISSINGEQUALS: ::DWORD = 14073; -pub const ERROR_SXS_PROTECTION_RECOVERY_FAILED: ::DWORD = 14074; -pub const ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT: ::DWORD = 14075; -pub const ERROR_SXS_PROTECTION_CATALOG_NOT_VALID: ::DWORD = 14076; -pub const ERROR_SXS_UNTRANSLATABLE_HRESULT: ::DWORD = 14077; -pub const ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING: ::DWORD = 14078; -pub const ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE: ::DWORD = 14079; -pub const ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME: ::DWORD = 14080; -pub const ERROR_SXS_ASSEMBLY_MISSING: ::DWORD = 14081; -pub const ERROR_SXS_CORRUPT_ACTIVATION_STACK: ::DWORD = 14082; -pub const ERROR_SXS_CORRUPTION: ::DWORD = 14083; -pub const ERROR_SXS_EARLY_DEACTIVATION: ::DWORD = 14084; -pub const ERROR_SXS_INVALID_DEACTIVATION: ::DWORD = 14085; -pub const ERROR_SXS_MULTIPLE_DEACTIVATION: ::DWORD = 14086; -pub const ERROR_SXS_PROCESS_TERMINATION_REQUESTED: ::DWORD = 14087; -pub const ERROR_SXS_RELEASE_ACTIVATION_CONTEXT: ::DWORD = 14088; -pub const ERROR_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY: ::DWORD = 14089; -pub const ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE: ::DWORD = 14090; -pub const ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME: ::DWORD = 14091; -pub const ERROR_SXS_IDENTITY_DUPLICATE_ATTRIBUTE: ::DWORD = 14092; -pub const ERROR_SXS_IDENTITY_PARSE_ERROR: ::DWORD = 14093; -pub const ERROR_MALFORMED_SUBSTITUTION_STRING: ::DWORD = 14094; -pub const ERROR_SXS_INCORRECT_PUBLIC_KEY_TOKEN: ::DWORD = 14095; -pub const ERROR_UNMAPPED_SUBSTITUTION_STRING: ::DWORD = 14096; -pub const ERROR_SXS_ASSEMBLY_NOT_LOCKED: ::DWORD = 14097; -pub const ERROR_SXS_COMPONENT_STORE_CORRUPT: ::DWORD = 14098; -pub const ERROR_ADVANCED_INSTALLER_FAILED: ::DWORD = 14099; -pub const ERROR_XML_ENCODING_MISMATCH: ::DWORD = 14100; -pub const ERROR_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT: ::DWORD = 14101; -pub const ERROR_SXS_IDENTITIES_DIFFERENT: ::DWORD = 14102; -pub const ERROR_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT: ::DWORD = 14103; -pub const ERROR_SXS_FILE_NOT_PART_OF_ASSEMBLY: ::DWORD = 14104; -pub const ERROR_SXS_MANIFEST_TOO_BIG: ::DWORD = 14105; -pub const ERROR_SXS_SETTING_NOT_REGISTERED: ::DWORD = 14106; -pub const ERROR_SXS_TRANSACTION_CLOSURE_INCOMPLETE: ::DWORD = 14107; -pub const ERROR_SMI_PRIMITIVE_INSTALLER_FAILED: ::DWORD = 14108; -pub const ERROR_GENERIC_COMMAND_FAILED: ::DWORD = 14109; -pub const ERROR_SXS_FILE_HASH_MISSING: ::DWORD = 14110; -pub const ERROR_EVT_INVALID_CHANNEL_PATH: ::DWORD = 15000; -pub const ERROR_EVT_INVALID_QUERY: ::DWORD = 15001; -pub const ERROR_EVT_PUBLISHER_METADATA_NOT_FOUND: ::DWORD = 15002; -pub const ERROR_EVT_EVENT_TEMPLATE_NOT_FOUND: ::DWORD = 15003; -pub const ERROR_EVT_INVALID_PUBLISHER_NAME: ::DWORD = 15004; -pub const ERROR_EVT_INVALID_EVENT_DATA: ::DWORD = 15005; -pub const ERROR_EVT_CHANNEL_NOT_FOUND: ::DWORD = 15007; -pub const ERROR_EVT_MALFORMED_XML_TEXT: ::DWORD = 15008; -pub const ERROR_EVT_SUBSCRIPTION_TO_DIRECT_CHANNEL: ::DWORD = 15009; -pub const ERROR_EVT_CONFIGURATION_ERROR: ::DWORD = 15010; -pub const ERROR_EVT_QUERY_RESULT_STALE: ::DWORD = 15011; -pub const ERROR_EVT_QUERY_RESULT_INVALID_POSITION: ::DWORD = 15012; -pub const ERROR_EVT_NON_VALIDATING_MSXML: ::DWORD = 15013; -pub const ERROR_EVT_FILTER_ALREADYSCOPED: ::DWORD = 15014; -pub const ERROR_EVT_FILTER_NOTELTSET: ::DWORD = 15015; -pub const ERROR_EVT_FILTER_INVARG: ::DWORD = 15016; -pub const ERROR_EVT_FILTER_INVTEST: ::DWORD = 15017; -pub const ERROR_EVT_FILTER_INVTYPE: ::DWORD = 15018; -pub const ERROR_EVT_FILTER_PARSEERR: ::DWORD = 15019; -pub const ERROR_EVT_FILTER_UNSUPPORTEDOP: ::DWORD = 15020; -pub const ERROR_EVT_FILTER_UNEXPECTEDTOKEN: ::DWORD = 15021; -pub const ERROR_EVT_INVALID_OPERATION_OVER_ENABLED_DIRECT_CHANNEL: ::DWORD = 15022; -pub const ERROR_EVT_INVALID_CHANNEL_PROPERTY_VALUE: ::DWORD = 15023; -pub const ERROR_EVT_INVALID_PUBLISHER_PROPERTY_VALUE: ::DWORD = 15024; -pub const ERROR_EVT_CHANNEL_CANNOT_ACTIVATE: ::DWORD = 15025; -pub const ERROR_EVT_FILTER_TOO_COMPLEX: ::DWORD = 15026; -pub const ERROR_EVT_MESSAGE_NOT_FOUND: ::DWORD = 15027; -pub const ERROR_EVT_MESSAGE_ID_NOT_FOUND: ::DWORD = 15028; -pub const ERROR_EVT_UNRESOLVED_VALUE_INSERT: ::DWORD = 15029; -pub const ERROR_EVT_UNRESOLVED_PARAMETER_INSERT: ::DWORD = 15030; -pub const ERROR_EVT_MAX_INSERTS_REACHED: ::DWORD = 15031; -pub const ERROR_EVT_EVENT_DEFINITION_NOT_FOUND: ::DWORD = 15032; -pub const ERROR_EVT_MESSAGE_LOCALE_NOT_FOUND: ::DWORD = 15033; -pub const ERROR_EVT_VERSION_TOO_OLD: ::DWORD = 15034; -pub const ERROR_EVT_VERSION_TOO_NEW: ::DWORD = 15035; -pub const ERROR_EVT_CANNOT_OPEN_CHANNEL_OF_QUERY: ::DWORD = 15036; -pub const ERROR_EVT_PUBLISHER_DISABLED: ::DWORD = 15037; -pub const ERROR_EVT_FILTER_OUT_OF_RANGE: ::DWORD = 15038; -pub const ERROR_EC_SUBSCRIPTION_CANNOT_ACTIVATE: ::DWORD = 15080; -pub const ERROR_EC_LOG_DISABLED: ::DWORD = 15081; -pub const ERROR_EC_CIRCULAR_FORWARDING: ::DWORD = 15082; -pub const ERROR_EC_CREDSTORE_FULL: ::DWORD = 15083; -pub const ERROR_EC_CRED_NOT_FOUND: ::DWORD = 15084; -pub const ERROR_EC_NO_ACTIVE_CHANNEL: ::DWORD = 15085; -pub const ERROR_MUI_FILE_NOT_FOUND: ::DWORD = 15100; -pub const ERROR_MUI_INVALID_FILE: ::DWORD = 15101; -pub const ERROR_MUI_INVALID_RC_CONFIG: ::DWORD = 15102; -pub const ERROR_MUI_INVALID_LOCALE_NAME: ::DWORD = 15103; -pub const ERROR_MUI_INVALID_ULTIMATEFALLBACK_NAME: ::DWORD = 15104; -pub const ERROR_MUI_FILE_NOT_LOADED: ::DWORD = 15105; -pub const ERROR_RESOURCE_ENUM_USER_STOP: ::DWORD = 15106; -pub const ERROR_MUI_INTLSETTINGS_UILANG_NOT_INSTALLED: ::DWORD = 15107; -pub const ERROR_MUI_INTLSETTINGS_INVALID_LOCALE_NAME: ::DWORD = 15108; -pub const ERROR_MRM_RUNTIME_NO_DEFAULT_OR_NEUTRAL_RESOURCE: ::DWORD = 15110; -pub const ERROR_MRM_INVALID_PRICONFIG: ::DWORD = 15111; -pub const ERROR_MRM_INVALID_FILE_TYPE: ::DWORD = 15112; -pub const ERROR_MRM_UNKNOWN_QUALIFIER: ::DWORD = 15113; -pub const ERROR_MRM_INVALID_QUALIFIER_VALUE: ::DWORD = 15114; -pub const ERROR_MRM_NO_CANDIDATE: ::DWORD = 15115; -pub const ERROR_MRM_NO_MATCH_OR_DEFAULT_CANDIDATE: ::DWORD = 15116; -pub const ERROR_MRM_RESOURCE_TYPE_MISMATCH: ::DWORD = 15117; -pub const ERROR_MRM_DUPLICATE_MAP_NAME: ::DWORD = 15118; -pub const ERROR_MRM_DUPLICATE_ENTRY: ::DWORD = 15119; -pub const ERROR_MRM_INVALID_RESOURCE_IDENTIFIER: ::DWORD = 15120; -pub const ERROR_MRM_FILEPATH_TOO_LONG: ::DWORD = 15121; -pub const ERROR_MRM_UNSUPPORTED_DIRECTORY_TYPE: ::DWORD = 15122; -pub const ERROR_MRM_INVALID_PRI_FILE: ::DWORD = 15126; -pub const ERROR_MRM_NAMED_RESOURCE_NOT_FOUND: ::DWORD = 15127; -pub const ERROR_MRM_MAP_NOT_FOUND: ::DWORD = 15135; -pub const ERROR_MRM_UNSUPPORTED_PROFILE_TYPE: ::DWORD = 15136; -pub const ERROR_MRM_INVALID_QUALIFIER_OPERATOR: ::DWORD = 15137; -pub const ERROR_MRM_INDETERMINATE_QUALIFIER_VALUE: ::DWORD = 15138; -pub const ERROR_MRM_AUTOMERGE_ENABLED: ::DWORD = 15139; -pub const ERROR_MRM_TOO_MANY_RESOURCES: ::DWORD = 15140; -pub const ERROR_MRM_UNSUPPORTED_FILE_TYPE_FOR_MERGE: ::DWORD = 15141; -pub const ERROR_MRM_UNSUPPORTED_FILE_TYPE_FOR_LOAD_UNLOAD_PRI_FILE: ::DWORD = 15142; -pub const ERROR_MRM_NO_CURRENT_VIEW_ON_THREAD: ::DWORD = 15143; -pub const ERROR_DIFFERENT_PROFILE_RESOURCE_MANAGER_EXIST: ::DWORD = 15144; -pub const ERROR_OPERATION_NOT_ALLOWED_FROM_SYSTEM_COMPONENT: ::DWORD = 15145; -pub const ERROR_MRM_DIRECT_REF_TO_NON_DEFAULT_RESOURCE: ::DWORD = 15146; -pub const ERROR_MRM_GENERATION_COUNT_MISMATCH: ::DWORD = 15147; -pub const ERROR_MCA_INVALID_CAPABILITIES_STRING: ::DWORD = 15200; -pub const ERROR_MCA_INVALID_VCP_VERSION: ::DWORD = 15201; -pub const ERROR_MCA_MONITOR_VIOLATES_MCCS_SPECIFICATION: ::DWORD = 15202; -pub const ERROR_MCA_MCCS_VERSION_MISMATCH: ::DWORD = 15203; -pub const ERROR_MCA_UNSUPPORTED_MCCS_VERSION: ::DWORD = 15204; -pub const ERROR_MCA_INTERNAL_ERROR: ::DWORD = 15205; -pub const ERROR_MCA_INVALID_TECHNOLOGY_TYPE_RETURNED: ::DWORD = 15206; -pub const ERROR_MCA_UNSUPPORTED_COLOR_TEMPERATURE: ::DWORD = 15207; -pub const ERROR_AMBIGUOUS_SYSTEM_DEVICE: ::DWORD = 15250; -pub const ERROR_SYSTEM_DEVICE_NOT_FOUND: ::DWORD = 15299; -pub const ERROR_HASH_NOT_SUPPORTED: ::DWORD = 15300; -pub const ERROR_HASH_NOT_PRESENT: ::DWORD = 15301; -pub const ERROR_SECONDARY_IC_PROVIDER_NOT_REGISTERED: ::DWORD = 15321; -pub const ERROR_GPIO_CLIENT_INFORMATION_INVALID: ::DWORD = 15322; -pub const ERROR_GPIO_VERSION_NOT_SUPPORTED: ::DWORD = 15323; -pub const ERROR_GPIO_INVALID_REGISTRATION_PACKET: ::DWORD = 15324; -pub const ERROR_GPIO_OPERATION_DENIED: ::DWORD = 15325; -pub const ERROR_GPIO_INCOMPATIBLE_CONNECT_MODE: ::DWORD = 15326; -pub const ERROR_GPIO_INTERRUPT_ALREADY_UNMASKED: ::DWORD = 15327; -pub const ERROR_CANNOT_SWITCH_RUNLEVEL: ::DWORD = 15400; -pub const ERROR_INVALID_RUNLEVEL_SETTING: ::DWORD = 15401; -pub const ERROR_RUNLEVEL_SWITCH_TIMEOUT: ::DWORD = 15402; -pub const ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT: ::DWORD = 15403; -pub const ERROR_RUNLEVEL_SWITCH_IN_PROGRESS: ::DWORD = 15404; -pub const ERROR_SERVICES_FAILED_AUTOSTART: ::DWORD = 15405; -pub const ERROR_COM_TASK_STOP_PENDING: ::DWORD = 15501; -pub const ERROR_INSTALL_OPEN_PACKAGE_FAILED: ::DWORD = 15600; -pub const ERROR_INSTALL_PACKAGE_NOT_FOUND: ::DWORD = 15601; -pub const ERROR_INSTALL_INVALID_PACKAGE: ::DWORD = 15602; -pub const ERROR_INSTALL_RESOLVE_DEPENDENCY_FAILED: ::DWORD = 15603; -pub const ERROR_INSTALL_OUT_OF_DISK_SPACE: ::DWORD = 15604; -pub const ERROR_INSTALL_NETWORK_FAILURE: ::DWORD = 15605; -pub const ERROR_INSTALL_REGISTRATION_FAILURE: ::DWORD = 15606; -pub const ERROR_INSTALL_DEREGISTRATION_FAILURE: ::DWORD = 15607; -pub const ERROR_INSTALL_CANCEL: ::DWORD = 15608; -pub const ERROR_INSTALL_FAILED: ::DWORD = 15609; -pub const ERROR_REMOVE_FAILED: ::DWORD = 15610; -pub const ERROR_PACKAGE_ALREADY_EXISTS: ::DWORD = 15611; -pub const ERROR_NEEDS_REMEDIATION: ::DWORD = 15612; -pub const ERROR_INSTALL_PREREQUISITE_FAILED: ::DWORD = 15613; -pub const ERROR_PACKAGE_REPOSITORY_CORRUPTED: ::DWORD = 15614; -pub const ERROR_INSTALL_POLICY_FAILURE: ::DWORD = 15615; -pub const ERROR_PACKAGE_UPDATING: ::DWORD = 15616; -pub const ERROR_DEPLOYMENT_BLOCKED_BY_POLICY: ::DWORD = 15617; -pub const ERROR_PACKAGES_IN_USE: ::DWORD = 15618; -pub const ERROR_RECOVERY_FILE_CORRUPT: ::DWORD = 15619; -pub const ERROR_INVALID_STAGED_SIGNATURE: ::DWORD = 15620; -pub const ERROR_DELETING_EXISTING_APPLICATIONDATA_STORE_FAILED: ::DWORD = 15621; -pub const ERROR_INSTALL_PACKAGE_DOWNGRADE: ::DWORD = 15622; -pub const ERROR_SYSTEM_NEEDS_REMEDIATION: ::DWORD = 15623; -pub const ERROR_APPX_INTEGRITY_FAILURE_CLR_NGEN: ::DWORD = 15624; -pub const ERROR_RESILIENCY_FILE_CORRUPT: ::DWORD = 15625; -pub const ERROR_INSTALL_FIREWALL_SERVICE_NOT_RUNNING: ::DWORD = 15626; -pub const APPMODEL_ERROR_NO_PACKAGE: ::DWORD = 15700; -pub const APPMODEL_ERROR_PACKAGE_RUNTIME_CORRUPT: ::DWORD = 15701; -pub const APPMODEL_ERROR_PACKAGE_IDENTITY_CORRUPT: ::DWORD = 15702; -pub const APPMODEL_ERROR_NO_APPLICATION: ::DWORD = 15703; -pub const APPMODEL_ERROR_DYNAMIC_PROPERTY_READ_FAILED: ::DWORD = 15704; -pub const APPMODEL_ERROR_DYNAMIC_PROPERTY_INVALID: ::DWORD = 15705; -pub const ERROR_STATE_LOAD_STORE_FAILED: ::DWORD = 15800; -pub const ERROR_STATE_GET_VERSION_FAILED: ::DWORD = 15801; -pub const ERROR_STATE_SET_VERSION_FAILED: ::DWORD = 15802; -pub const ERROR_STATE_STRUCTURED_RESET_FAILED: ::DWORD = 15803; -pub const ERROR_STATE_OPEN_CONTAINER_FAILED: ::DWORD = 15804; -pub const ERROR_STATE_CREATE_CONTAINER_FAILED: ::DWORD = 15805; -pub const ERROR_STATE_DELETE_CONTAINER_FAILED: ::DWORD = 15806; -pub const ERROR_STATE_READ_SETTING_FAILED: ::DWORD = 15807; -pub const ERROR_STATE_WRITE_SETTING_FAILED: ::DWORD = 15808; -pub const ERROR_STATE_DELETE_SETTING_FAILED: ::DWORD = 15809; -pub const ERROR_STATE_QUERY_SETTING_FAILED: ::DWORD = 15810; -pub const ERROR_STATE_READ_COMPOSITE_SETTING_FAILED: ::DWORD = 15811; -pub const ERROR_STATE_WRITE_COMPOSITE_SETTING_FAILED: ::DWORD = 15812; -pub const ERROR_STATE_ENUMERATE_CONTAINER_FAILED: ::DWORD = 15813; -pub const ERROR_STATE_ENUMERATE_SETTINGS_FAILED: ::DWORD = 15814; -pub const ERROR_STATE_COMPOSITE_SETTING_VALUE_SIZE_LIMIT_EXCEEDED: ::DWORD = 15815; -pub const ERROR_STATE_SETTING_VALUE_SIZE_LIMIT_EXCEEDED: ::DWORD = 15816; -pub const ERROR_STATE_SETTING_NAME_SIZE_LIMIT_EXCEEDED: ::DWORD = 15817; -pub const ERROR_STATE_CONTAINER_NAME_SIZE_LIMIT_EXCEEDED: ::DWORD = 15818; -pub const ERROR_API_UNAVAILABLE: ::DWORD = 15841; -pub const STORE_ERROR_UNLICENSED: ::DWORD = 15861; -pub const STORE_ERROR_UNLICENSED_USER: ::DWORD = 15862; -pub const STORE_ERROR_PENDING_COM_TRANSACTION: ::DWORD = 15863; -pub const STORE_ERROR_LICENSE_REVOKED: ::DWORD = 15864; -pub const SEVERITY_SUCCESS: HRESULT = 0; -pub const SEVERITY_ERROR: HRESULT = 1; -#[inline] -pub fn MAKE_HRESULT(sev: HRESULT, fac: HRESULT, code: HRESULT) -> HRESULT { - (sev << 31) | (fac << 16) | code -} -pub type HRESULT = ::c_long; -pub const NOERROR: HRESULT = 0; -pub const E_UNEXPECTED: HRESULT = 0x8000FFFFu32 as HRESULT; -pub const E_NOTIMPL: HRESULT = 0x80004001u32 as HRESULT; -pub const E_OUTOFMEMORY: HRESULT = 0x8007000Eu32 as HRESULT; -pub const E_INVALIDARG: HRESULT = 0x80070057u32 as HRESULT; -pub const E_NOINTERFACE: HRESULT = 0x80004002u32 as HRESULT; -pub const E_POINTER: HRESULT = 0x80004003u32 as HRESULT; -pub const E_HANDLE: HRESULT = 0x80070006u32 as HRESULT; -pub const E_ABORT: HRESULT = 0x80004004u32 as HRESULT; -pub const E_FAIL: HRESULT = 0x80004005u32 as HRESULT; -pub const E_ACCESSDENIED: HRESULT = 0x80070005u32 as HRESULT; -pub const E_PENDING: HRESULT = 0x8000000Au32 as HRESULT; -pub const E_BOUNDS: HRESULT = 0x8000000Bu32 as HRESULT; -pub const E_CHANGED_STATE: HRESULT = 0x8000000Cu32 as HRESULT; -pub const E_ILLEGAL_STATE_CHANGE: HRESULT = 0x8000000Du32 as HRESULT; -pub const E_ILLEGAL_METHOD_CALL: HRESULT = 0x8000000Eu32 as HRESULT; -pub const RO_E_METADATA_NAME_NOT_FOUND: HRESULT = 0x8000000Fu32 as HRESULT; -pub const RO_E_METADATA_NAME_IS_NAMESPACE: HRESULT = 0x80000010u32 as HRESULT; -pub const RO_E_METADATA_INVALID_TYPE_FORMAT: HRESULT = 0x80000011u32 as HRESULT; -pub const RO_E_INVALID_METADATA_FILE: HRESULT = 0x80000012u32 as HRESULT; -pub const RO_E_CLOSED: HRESULT = 0x80000013u32 as HRESULT; -pub const RO_E_EXCLUSIVE_WRITE: HRESULT = 0x80000014u32 as HRESULT; -pub const RO_E_CHANGE_NOTIFICATION_IN_PROGRESS: HRESULT = 0x80000015u32 as HRESULT; -pub const RO_E_ERROR_STRING_NOT_FOUND: HRESULT = 0x80000016u32 as HRESULT; -pub const E_STRING_NOT_NULL_TERMINATED: HRESULT = 0x80000017u32 as HRESULT; -pub const E_ILLEGAL_DELEGATE_ASSIGNMENT: HRESULT = 0x80000018u32 as HRESULT; -pub const E_ASYNC_OPERATION_NOT_STARTED: HRESULT = 0x80000019u32 as HRESULT; -pub const E_APPLICATION_EXITING: HRESULT = 0x8000001Au32 as HRESULT; -pub const E_APPLICATION_VIEW_EXITING: HRESULT = 0x8000001Bu32 as HRESULT; -pub const RO_E_MUST_BE_AGILE: HRESULT = 0x8000001Cu32 as HRESULT; -pub const RO_E_UNSUPPORTED_FROM_MTA: HRESULT = 0x8000001Du32 as HRESULT; -pub const RO_E_COMMITTED: HRESULT = 0x8000001Eu32 as HRESULT; -pub const RO_E_BLOCKED_CROSS_ASTA_CALL: HRESULT = 0x8000001Fu32 as HRESULT; -pub const CO_E_INIT_TLS: HRESULT = 0x80004006u32 as HRESULT; -pub const CO_E_INIT_SHARED_ALLOCATOR: HRESULT = 0x80004007u32 as HRESULT; -pub const CO_E_INIT_MEMORY_ALLOCATOR: HRESULT = 0x80004008u32 as HRESULT; -pub const CO_E_INIT_CLASS_CACHE: HRESULT = 0x80004009u32 as HRESULT; -pub const CO_E_INIT_RPC_CHANNEL: HRESULT = 0x8000400Au32 as HRESULT; -pub const CO_E_INIT_TLS_SET_CHANNEL_CONTROL: HRESULT = 0x8000400Bu32 as HRESULT; -pub const CO_E_INIT_TLS_CHANNEL_CONTROL: HRESULT = 0x8000400Cu32 as HRESULT; -pub const CO_E_INIT_UNACCEPTED_USER_ALLOCATOR: HRESULT = 0x8000400Du32 as HRESULT; -pub const CO_E_INIT_SCM_MUTEX_EXISTS: HRESULT = 0x8000400Eu32 as HRESULT; -pub const CO_E_INIT_SCM_FILE_MAPPING_EXISTS: HRESULT = 0x8000400Fu32 as HRESULT; -pub const CO_E_INIT_SCM_MAP_VIEW_OF_FILE: HRESULT = 0x80004010u32 as HRESULT; -pub const CO_E_INIT_SCM_EXEC_FAILURE: HRESULT = 0x80004011u32 as HRESULT; -pub const CO_E_INIT_ONLY_SINGLE_THREADED: HRESULT = 0x80004012u32 as HRESULT; -pub const CO_E_CANT_REMOTE: HRESULT = 0x80004013u32 as HRESULT; -pub const CO_E_BAD_SERVER_NAME: HRESULT = 0x80004014u32 as HRESULT; -pub const CO_E_WRONG_SERVER_IDENTITY: HRESULT = 0x80004015u32 as HRESULT; -pub const CO_E_OLE1DDE_DISABLED: HRESULT = 0x80004016u32 as HRESULT; -pub const CO_E_RUNAS_SYNTAX: HRESULT = 0x80004017u32 as HRESULT; -pub const CO_E_CREATEPROCESS_FAILURE: HRESULT = 0x80004018u32 as HRESULT; -pub const CO_E_RUNAS_CREATEPROCESS_FAILURE: HRESULT = 0x80004019u32 as HRESULT; -pub const CO_E_RUNAS_LOGON_FAILURE: HRESULT = 0x8000401Au32 as HRESULT; -pub const CO_E_LAUNCH_PERMSSION_DENIED: HRESULT = 0x8000401Bu32 as HRESULT; -pub const CO_E_START_SERVICE_FAILURE: HRESULT = 0x8000401Cu32 as HRESULT; -pub const CO_E_REMOTE_COMMUNICATION_FAILURE: HRESULT = 0x8000401Du32 as HRESULT; -pub const CO_E_SERVER_START_TIMEOUT: HRESULT = 0x8000401Eu32 as HRESULT; -pub const CO_E_CLSREG_INCONSISTENT: HRESULT = 0x8000401Fu32 as HRESULT; -pub const CO_E_IIDREG_INCONSISTENT: HRESULT = 0x80004020u32 as HRESULT; -pub const CO_E_NOT_SUPPORTED: HRESULT = 0x80004021u32 as HRESULT; -pub const CO_E_RELOAD_DLL: HRESULT = 0x80004022u32 as HRESULT; -pub const CO_E_MSI_ERROR: HRESULT = 0x80004023u32 as HRESULT; -pub const CO_E_ATTEMPT_TO_CREATE_OUTSIDE_CLIENT_CONTEXT: HRESULT = 0x80004024u32 as HRESULT; -pub const CO_E_SERVER_PAUSED: HRESULT = 0x80004025u32 as HRESULT; -pub const CO_E_SERVER_NOT_PAUSED: HRESULT = 0x80004026u32 as HRESULT; -pub const CO_E_CLASS_DISABLED: HRESULT = 0x80004027u32 as HRESULT; -pub const CO_E_CLRNOTAVAILABLE: HRESULT = 0x80004028u32 as HRESULT; -pub const CO_E_ASYNC_WORK_REJECTED: HRESULT = 0x80004029u32 as HRESULT; -pub const CO_E_SERVER_INIT_TIMEOUT: HRESULT = 0x8000402Au32 as HRESULT; -pub const CO_E_NO_SECCTX_IN_ACTIVATE: HRESULT = 0x8000402Bu32 as HRESULT; -pub const CO_E_TRACKER_CONFIG: HRESULT = 0x80004030u32 as HRESULT; -pub const CO_E_THREADPOOL_CONFIG: HRESULT = 0x80004031u32 as HRESULT; -pub const CO_E_SXS_CONFIG: HRESULT = 0x80004032u32 as HRESULT; -pub const CO_E_MALFORMED_SPN: HRESULT = 0x80004033u32 as HRESULT; -pub const CO_E_UNREVOKED_REGISTRATION_ON_APARTMENT_SHUTDOWN: HRESULT = 0x80004034u32 as HRESULT; -pub const CO_E_PREMATURE_STUB_RUNDOWN: HRESULT = 0x80004035u32 as HRESULT; -pub const S_OK: HRESULT = 0; -pub const S_FALSE: HRESULT = 1; -pub const OLE_E_FIRST: HRESULT = 0x80040000u32 as HRESULT; -pub const OLE_E_LAST: HRESULT = 0x800400FFu32 as HRESULT; -pub const OLE_S_FIRST: HRESULT = 0x00040000; -pub const OLE_S_LAST: HRESULT = 0x000400FF; -pub const OLE_E_OLEVERB: HRESULT = 0x80040000u32 as HRESULT; -pub const OLE_E_ADVF: HRESULT = 0x80040001u32 as HRESULT; -pub const OLE_E_ENUM_NOMORE: HRESULT = 0x80040002u32 as HRESULT; -pub const OLE_E_ADVISENOTSUPPORTED: HRESULT = 0x80040003u32 as HRESULT; -pub const OLE_E_NOCONNECTION: HRESULT = 0x80040004u32 as HRESULT; -pub const OLE_E_NOTRUNNING: HRESULT = 0x80040005u32 as HRESULT; -pub const OLE_E_NOCACHE: HRESULT = 0x80040006u32 as HRESULT; -pub const OLE_E_BLANK: HRESULT = 0x80040007u32 as HRESULT; -pub const OLE_E_CLASSDIFF: HRESULT = 0x80040008u32 as HRESULT; -pub const OLE_E_CANT_GETMONIKER: HRESULT = 0x80040009u32 as HRESULT; -pub const OLE_E_CANT_BINDTOSOURCE: HRESULT = 0x8004000Au32 as HRESULT; -pub const OLE_E_STATIC: HRESULT = 0x8004000Bu32 as HRESULT; -pub const OLE_E_PROMPTSAVECANCELLED: HRESULT = 0x8004000Cu32 as HRESULT; -pub const OLE_E_INVALIDRECT: HRESULT = 0x8004000Du32 as HRESULT; -pub const OLE_E_WRONGCOMPOBJ: HRESULT = 0x8004000Eu32 as HRESULT; -pub const OLE_E_INVALIDHWND: HRESULT = 0x8004000Fu32 as HRESULT; -pub const OLE_E_NOT_INPLACEACTIVE: HRESULT = 0x80040010u32 as HRESULT; -pub const OLE_E_CANTCONVERT: HRESULT = 0x80040011u32 as HRESULT; -pub const OLE_E_NOSTORAGE: HRESULT = 0x80040012u32 as HRESULT; -pub const DV_E_FORMATETC: HRESULT = 0x80040064u32 as HRESULT; -pub const DV_E_DVTARGETDEVICE: HRESULT = 0x80040065u32 as HRESULT; -pub const DV_E_STGMEDIUM: HRESULT = 0x80040066u32 as HRESULT; -pub const DV_E_STATDATA: HRESULT = 0x80040067u32 as HRESULT; -pub const DV_E_LINDEX: HRESULT = 0x80040068u32 as HRESULT; -pub const DV_E_TYMED: HRESULT = 0x80040069u32 as HRESULT; -pub const DV_E_CLIPFORMAT: HRESULT = 0x8004006Au32 as HRESULT; -pub const DV_E_DVASPECT: HRESULT = 0x8004006Bu32 as HRESULT; -pub const DV_E_DVTARGETDEVICE_SIZE: HRESULT = 0x8004006Cu32 as HRESULT; -pub const DV_E_NOIVIEWOBJECT: HRESULT = 0x8004006Du32 as HRESULT; -pub const DRAGDROP_E_FIRST: HRESULT = 0x80040100u32 as HRESULT; -pub const DRAGDROP_E_LAST: HRESULT = 0x8004010Fu32 as HRESULT; -pub const DRAGDROP_S_FIRST: HRESULT = 0x00040100; -pub const DRAGDROP_S_LAST: HRESULT = 0x0004010F; -pub const DRAGDROP_E_NOTREGISTERED: HRESULT = 0x80040100u32 as HRESULT; -pub const DRAGDROP_E_ALREADYREGISTERED: HRESULT = 0x80040101u32 as HRESULT; -pub const DRAGDROP_E_INVALIDHWND: HRESULT = 0x80040102u32 as HRESULT; -pub const DRAGDROP_E_CONCURRENT_DRAG_ATTEMPTED: HRESULT = 0x80040103u32 as HRESULT; -pub const CLASSFACTORY_E_FIRST: HRESULT = 0x80040110u32 as HRESULT; -pub const CLASSFACTORY_E_LAST: HRESULT = 0x8004011Fu32 as HRESULT; -pub const CLASSFACTORY_S_FIRST: HRESULT = 0x00040110; -pub const CLASSFACTORY_S_LAST: HRESULT = 0x0004011F; -pub const CLASS_E_NOAGGREGATION: HRESULT = 0x80040110u32 as HRESULT; -pub const CLASS_E_CLASSNOTAVAILABLE: HRESULT = 0x80040111u32 as HRESULT; -pub const CLASS_E_NOTLICENSED: HRESULT = 0x80040112u32 as HRESULT; -pub const MARSHAL_E_FIRST: HRESULT = 0x80040120u32 as HRESULT; -pub const MARSHAL_E_LAST: HRESULT = 0x8004012Fu32 as HRESULT; -pub const MARSHAL_S_FIRST: HRESULT = 0x00040120; -pub const MARSHAL_S_LAST: HRESULT = 0x0004012F; -pub const DATA_E_FIRST: HRESULT = 0x80040130u32 as HRESULT; -pub const DATA_E_LAST: HRESULT = 0x8004013Fu32 as HRESULT; -pub const DATA_S_FIRST: HRESULT = 0x00040130; -pub const DATA_S_LAST: HRESULT = 0x0004013F; -pub const VIEW_E_FIRST: HRESULT = 0x80040140u32 as HRESULT; -pub const VIEW_E_LAST: HRESULT = 0x8004014Fu32 as HRESULT; -pub const VIEW_S_FIRST: HRESULT = 0x00040140; -pub const VIEW_S_LAST: HRESULT = 0x0004014F; -pub const VIEW_E_DRAW: HRESULT = 0x80040140u32 as HRESULT; -pub const REGDB_E_FIRST: HRESULT = 0x80040150u32 as HRESULT; -pub const REGDB_E_LAST: HRESULT = 0x8004015Fu32 as HRESULT; -pub const REGDB_S_FIRST: HRESULT = 0x00040150; -pub const REGDB_S_LAST: HRESULT = 0x0004015F; -pub const REGDB_E_READREGDB: HRESULT = 0x80040150u32 as HRESULT; -pub const REGDB_E_WRITEREGDB: HRESULT = 0x80040151u32 as HRESULT; -pub const REGDB_E_KEYMISSING: HRESULT = 0x80040152u32 as HRESULT; -pub const REGDB_E_INVALIDVALUE: HRESULT = 0x80040153u32 as HRESULT; -pub const REGDB_E_CLASSNOTREG: HRESULT = 0x80040154u32 as HRESULT; -pub const REGDB_E_IIDNOTREG: HRESULT = 0x80040155u32 as HRESULT; -pub const REGDB_E_BADTHREADINGMODEL: HRESULT = 0x80040156u32 as HRESULT; -pub const CAT_E_FIRST: HRESULT = 0x80040160u32 as HRESULT; -pub const CAT_E_LAST: HRESULT = 0x80040161u32 as HRESULT; -pub const CAT_E_CATIDNOEXIST: HRESULT = 0x80040160u32 as HRESULT; -pub const CAT_E_NODESCRIPTION: HRESULT = 0x80040161u32 as HRESULT; -pub const CS_E_FIRST: HRESULT = 0x80040164u32 as HRESULT; -pub const CS_E_LAST: HRESULT = 0x8004016Fu32 as HRESULT; -pub const CS_E_PACKAGE_NOTFOUND: HRESULT = 0x80040164u32 as HRESULT; -pub const CS_E_NOT_DELETABLE: HRESULT = 0x80040165u32 as HRESULT; -pub const CS_E_CLASS_NOTFOUND: HRESULT = 0x80040166u32 as HRESULT; -pub const CS_E_INVALID_VERSION: HRESULT = 0x80040167u32 as HRESULT; -pub const CS_E_NO_CLASSSTORE: HRESULT = 0x80040168u32 as HRESULT; -pub const CS_E_OBJECT_NOTFOUND: HRESULT = 0x80040169u32 as HRESULT; -pub const CS_E_OBJECT_ALREADY_EXISTS: HRESULT = 0x8004016Au32 as HRESULT; -pub const CS_E_INVALID_PATH: HRESULT = 0x8004016Bu32 as HRESULT; -pub const CS_E_NETWORK_ERROR: HRESULT = 0x8004016Cu32 as HRESULT; -pub const CS_E_ADMIN_LIMIT_EXCEEDED: HRESULT = 0x8004016Du32 as HRESULT; -pub const CS_E_SCHEMA_MISMATCH: HRESULT = 0x8004016Eu32 as HRESULT; -pub const CS_E_INTERNAL_ERROR: HRESULT = 0x8004016Fu32 as HRESULT; -pub const CACHE_E_FIRST: HRESULT = 0x80040170u32 as HRESULT; -pub const CACHE_E_LAST: HRESULT = 0x8004017Fu32 as HRESULT; -pub const CACHE_S_FIRST: HRESULT = 0x00040170; -pub const CACHE_S_LAST: HRESULT = 0x0004017F; -pub const CACHE_E_NOCACHE_UPDATED: HRESULT = 0x80040170u32 as HRESULT; -pub const OLEOBJ_E_FIRST: HRESULT = 0x80040180u32 as HRESULT; -pub const OLEOBJ_E_LAST: HRESULT = 0x8004018Fu32 as HRESULT; -pub const OLEOBJ_S_FIRST: HRESULT = 0x00040180; -pub const OLEOBJ_S_LAST: HRESULT = 0x0004018F; -pub const OLEOBJ_E_NOVERBS: HRESULT = 0x80040180u32 as HRESULT; -pub const OLEOBJ_E_INVALIDVERB: HRESULT = 0x80040181u32 as HRESULT; -pub const CLIENTSITE_E_FIRST: HRESULT = 0x80040190u32 as HRESULT; -pub const CLIENTSITE_E_LAST: HRESULT = 0x8004019Fu32 as HRESULT; -pub const CLIENTSITE_S_FIRST: HRESULT = 0x00040190; -pub const CLIENTSITE_S_LAST: HRESULT = 0x0004019F; -pub const INPLACE_E_NOTUNDOABLE: HRESULT = 0x800401A0u32 as HRESULT; -pub const INPLACE_E_NOTOOLSPACE: HRESULT = 0x800401A1u32 as HRESULT; -pub const INPLACE_E_FIRST: HRESULT = 0x800401A0u32 as HRESULT; -pub const INPLACE_E_LAST: HRESULT = 0x800401AFu32 as HRESULT; -pub const INPLACE_S_FIRST: HRESULT = 0x000401A0; -pub const INPLACE_S_LAST: HRESULT = 0x000401AF; -pub const ENUM_E_FIRST: HRESULT = 0x800401B0u32 as HRESULT; -pub const ENUM_E_LAST: HRESULT = 0x800401BFu32 as HRESULT; -pub const ENUM_S_FIRST: HRESULT = 0x000401B0; -pub const ENUM_S_LAST: HRESULT = 0x000401BF; -pub const CONVERT10_E_FIRST: HRESULT = 0x800401C0u32 as HRESULT; -pub const CONVERT10_E_LAST: HRESULT = 0x800401CFu32 as HRESULT; -pub const CONVERT10_S_FIRST: HRESULT = 0x000401C0; -pub const CONVERT10_S_LAST: HRESULT = 0x000401CF; -pub const CONVERT10_E_OLESTREAM_GET: HRESULT = 0x800401C0u32 as HRESULT; -pub const CONVERT10_E_OLESTREAM_PUT: HRESULT = 0x800401C1u32 as HRESULT; -pub const CONVERT10_E_OLESTREAM_FMT: HRESULT = 0x800401C2u32 as HRESULT; -pub const CONVERT10_E_OLESTREAM_BITMAP_TO_DIB: HRESULT = 0x800401C3u32 as HRESULT; -pub const CONVERT10_E_STG_FMT: HRESULT = 0x800401C4u32 as HRESULT; -pub const CONVERT10_E_STG_NO_STD_STREAM: HRESULT = 0x800401C5u32 as HRESULT; -pub const CONVERT10_E_STG_DIB_TO_BITMAP: HRESULT = 0x800401C6u32 as HRESULT; -pub const CLIPBRD_E_FIRST: HRESULT = 0x800401D0u32 as HRESULT; -pub const CLIPBRD_E_LAST: HRESULT = 0x800401DFu32 as HRESULT; -pub const CLIPBRD_S_FIRST: HRESULT = 0x000401D0; -pub const CLIPBRD_S_LAST: HRESULT = 0x000401DF; -pub const CLIPBRD_E_CANT_OPEN: HRESULT = 0x800401D0u32 as HRESULT; -pub const CLIPBRD_E_CANT_EMPTY: HRESULT = 0x800401D1u32 as HRESULT; -pub const CLIPBRD_E_CANT_SET: HRESULT = 0x800401D2u32 as HRESULT; -pub const CLIPBRD_E_BAD_DATA: HRESULT = 0x800401D3u32 as HRESULT; -pub const CLIPBRD_E_CANT_CLOSE: HRESULT = 0x800401D4u32 as HRESULT; -pub const MK_E_FIRST: HRESULT = 0x800401E0u32 as HRESULT; -pub const MK_E_LAST: HRESULT = 0x800401EFu32 as HRESULT; -pub const MK_S_FIRST: HRESULT = 0x000401E0; -pub const MK_S_LAST: HRESULT = 0x000401EF; -pub const MK_E_CONNECTMANUALLY: HRESULT = 0x800401E0u32 as HRESULT; -pub const MK_E_EXCEEDEDDEADLINE: HRESULT = 0x800401E1u32 as HRESULT; -pub const MK_E_NEEDGENERIC: HRESULT = 0x800401E2u32 as HRESULT; -pub const MK_E_UNAVAILABLE: HRESULT = 0x800401E3u32 as HRESULT; -pub const MK_E_SYNTAX: HRESULT = 0x800401E4u32 as HRESULT; -pub const MK_E_NOOBJECT: HRESULT = 0x800401E5u32 as HRESULT; -pub const MK_E_INVALIDEXTENSION: HRESULT = 0x800401E6u32 as HRESULT; -pub const MK_E_INTERMEDIATEINTERFACENOTSUPPORTED: HRESULT = 0x800401E7u32 as HRESULT; -pub const MK_E_NOTBINDABLE: HRESULT = 0x800401E8u32 as HRESULT; -pub const MK_E_NOTBOUND: HRESULT = 0x800401E9u32 as HRESULT; -pub const MK_E_CANTOPENFILE: HRESULT = 0x800401EAu32 as HRESULT; -pub const MK_E_MUSTBOTHERUSER: HRESULT = 0x800401EBu32 as HRESULT; -pub const MK_E_NOINVERSE: HRESULT = 0x800401ECu32 as HRESULT; -pub const MK_E_NOSTORAGE: HRESULT = 0x800401EDu32 as HRESULT; -pub const MK_E_NOPREFIX: HRESULT = 0x800401EEu32 as HRESULT; -pub const MK_E_ENUMERATION_FAILED: HRESULT = 0x800401EFu32 as HRESULT; -pub const CO_E_FIRST: HRESULT = 0x800401F0u32 as HRESULT; -pub const CO_E_LAST: HRESULT = 0x800401FFu32 as HRESULT; -pub const CO_S_FIRST: HRESULT = 0x000401F0; -pub const CO_S_LAST: HRESULT = 0x000401FF; -pub const CO_E_NOTINITIALIZED: HRESULT = 0x800401F0u32 as HRESULT; -pub const CO_E_ALREADYINITIALIZED: HRESULT = 0x800401F1u32 as HRESULT; -pub const CO_E_CANTDETERMINECLASS: HRESULT = 0x800401F2u32 as HRESULT; -pub const CO_E_CLASSSTRING: HRESULT = 0x800401F3u32 as HRESULT; -pub const CO_E_IIDSTRING: HRESULT = 0x800401F4u32 as HRESULT; -pub const CO_E_APPNOTFOUND: HRESULT = 0x800401F5u32 as HRESULT; -pub const CO_E_APPSINGLEUSE: HRESULT = 0x800401F6u32 as HRESULT; -pub const CO_E_ERRORINAPP: HRESULT = 0x800401F7u32 as HRESULT; -pub const CO_E_DLLNOTFOUND: HRESULT = 0x800401F8u32 as HRESULT; -pub const CO_E_ERRORINDLL: HRESULT = 0x800401F9u32 as HRESULT; -pub const CO_E_WRONGOSFORAPP: HRESULT = 0x800401FAu32 as HRESULT; -pub const CO_E_OBJNOTREG: HRESULT = 0x800401FBu32 as HRESULT; -pub const CO_E_OBJISREG: HRESULT = 0x800401FCu32 as HRESULT; -pub const CO_E_OBJNOTCONNECTED: HRESULT = 0x800401FDu32 as HRESULT; -pub const CO_E_APPDIDNTREG: HRESULT = 0x800401FEu32 as HRESULT; -pub const CO_E_RELEASED: HRESULT = 0x800401FFu32 as HRESULT; -pub const EVENT_E_FIRST: HRESULT = 0x80040200u32 as HRESULT; -pub const EVENT_E_LAST: HRESULT = 0x8004021Fu32 as HRESULT; -pub const EVENT_S_FIRST: HRESULT = 0x00040200; -pub const EVENT_S_LAST: HRESULT = 0x0004021F; -pub const EVENT_S_SOME_SUBSCRIBERS_FAILED: HRESULT = 0x00040200; -pub const EVENT_E_ALL_SUBSCRIBERS_FAILED: HRESULT = 0x80040201u32 as HRESULT; -pub const EVENT_S_NOSUBSCRIBERS: HRESULT = 0x00040202; -pub const EVENT_E_QUERYSYNTAX: HRESULT = 0x80040203u32 as HRESULT; -pub const EVENT_E_QUERYFIELD: HRESULT = 0x80040204u32 as HRESULT; -pub const EVENT_E_INTERNALEXCEPTION: HRESULT = 0x80040205u32 as HRESULT; -pub const EVENT_E_INTERNALERROR: HRESULT = 0x80040206u32 as HRESULT; -pub const EVENT_E_INVALID_PER_USER_SID: HRESULT = 0x80040207u32 as HRESULT; -pub const EVENT_E_USER_EXCEPTION: HRESULT = 0x80040208u32 as HRESULT; -pub const EVENT_E_TOO_MANY_METHODS: HRESULT = 0x80040209u32 as HRESULT; -pub const EVENT_E_MISSING_EVENTCLASS: HRESULT = 0x8004020Au32 as HRESULT; -pub const EVENT_E_NOT_ALL_REMOVED: HRESULT = 0x8004020Bu32 as HRESULT; -pub const EVENT_E_COMPLUS_NOT_INSTALLED: HRESULT = 0x8004020Cu32 as HRESULT; -pub const EVENT_E_CANT_MODIFY_OR_DELETE_UNCONFIGURED_OBJECT: HRESULT = 0x8004020Du32 as HRESULT; -pub const EVENT_E_CANT_MODIFY_OR_DELETE_CONFIGURED_OBJECT: HRESULT = 0x8004020Eu32 as HRESULT; -pub const EVENT_E_INVALID_EVENT_CLASS_PARTITION: HRESULT = 0x8004020Fu32 as HRESULT; -pub const EVENT_E_PER_USER_SID_NOT_LOGGED_ON: HRESULT = 0x80040210u32 as HRESULT; -pub const TPC_E_INVALID_PROPERTY: HRESULT = 0x80040241u32 as HRESULT; -pub const TPC_E_NO_DEFAULT_TABLET: HRESULT = 0x80040212u32 as HRESULT; -pub const TPC_E_UNKNOWN_PROPERTY: HRESULT = 0x8004021Bu32 as HRESULT; -pub const TPC_E_INVALID_INPUT_RECT: HRESULT = 0x80040219u32 as HRESULT; -pub const TPC_E_INVALID_STROKE: HRESULT = 0x80040222u32 as HRESULT; -pub const TPC_E_INITIALIZE_FAIL: HRESULT = 0x80040223u32 as HRESULT; -pub const TPC_E_NOT_RELEVANT: HRESULT = 0x80040232u32 as HRESULT; -pub const TPC_E_INVALID_PACKET_DESCRIPTION: HRESULT = 0x80040233u32 as HRESULT; -pub const TPC_E_RECOGNIZER_NOT_REGISTERED: HRESULT = 0x80040235u32 as HRESULT; -pub const TPC_E_INVALID_RIGHTS: HRESULT = 0x80040236u32 as HRESULT; -pub const TPC_E_OUT_OF_ORDER_CALL: HRESULT = 0x80040237u32 as HRESULT; -pub const TPC_E_QUEUE_FULL: HRESULT = 0x80040238u32 as HRESULT; -pub const TPC_E_INVALID_CONFIGURATION: HRESULT = 0x80040239u32 as HRESULT; -pub const TPC_E_INVALID_DATA_FROM_RECOGNIZER: HRESULT = 0x8004023Au32 as HRESULT; -pub const TPC_S_TRUNCATED: HRESULT = 0x00040252; -pub const TPC_S_INTERRUPTED: HRESULT = 0x00040253; -pub const TPC_S_NO_DATA_TO_PROCESS: HRESULT = 0x00040254; -pub const XACT_E_FIRST: HRESULT = 0x8004D000u32 as HRESULT; -pub const XACT_E_LAST: HRESULT = 0x8004D02Bu32 as HRESULT; -pub const XACT_S_FIRST: HRESULT = 0x0004D000; -pub const XACT_S_LAST: HRESULT = 0x0004D010; -pub const XACT_E_ALREADYOTHERSINGLEPHASE: HRESULT = 0x8004D000u32 as HRESULT; -pub const XACT_E_CANTRETAIN: HRESULT = 0x8004D001u32 as HRESULT; -pub const XACT_E_COMMITFAILED: HRESULT = 0x8004D002u32 as HRESULT; -pub const XACT_E_COMMITPREVENTED: HRESULT = 0x8004D003u32 as HRESULT; -pub const XACT_E_HEURISTICABORT: HRESULT = 0x8004D004u32 as HRESULT; -pub const XACT_E_HEURISTICCOMMIT: HRESULT = 0x8004D005u32 as HRESULT; -pub const XACT_E_HEURISTICDAMAGE: HRESULT = 0x8004D006u32 as HRESULT; -pub const XACT_E_HEURISTICDANGER: HRESULT = 0x8004D007u32 as HRESULT; -pub const XACT_E_ISOLATIONLEVEL: HRESULT = 0x8004D008u32 as HRESULT; -pub const XACT_E_NOASYNC: HRESULT = 0x8004D009u32 as HRESULT; -pub const XACT_E_NOENLIST: HRESULT = 0x8004D00Au32 as HRESULT; -pub const XACT_E_NOISORETAIN: HRESULT = 0x8004D00Bu32 as HRESULT; -pub const XACT_E_NORESOURCE: HRESULT = 0x8004D00Cu32 as HRESULT; -pub const XACT_E_NOTCURRENT: HRESULT = 0x8004D00Du32 as HRESULT; -pub const XACT_E_NOTRANSACTION: HRESULT = 0x8004D00Eu32 as HRESULT; -pub const XACT_E_NOTSUPPORTED: HRESULT = 0x8004D00Fu32 as HRESULT; -pub const XACT_E_UNKNOWNRMGRID: HRESULT = 0x8004D010u32 as HRESULT; -pub const XACT_E_WRONGSTATE: HRESULT = 0x8004D011u32 as HRESULT; -pub const XACT_E_WRONGUOW: HRESULT = 0x8004D012u32 as HRESULT; -pub const XACT_E_XTIONEXISTS: HRESULT = 0x8004D013u32 as HRESULT; -pub const XACT_E_NOIMPORTOBJECT: HRESULT = 0x8004D014u32 as HRESULT; -pub const XACT_E_INVALIDCOOKIE: HRESULT = 0x8004D015u32 as HRESULT; -pub const XACT_E_INDOUBT: HRESULT = 0x8004D016u32 as HRESULT; -pub const XACT_E_NOTIMEOUT: HRESULT = 0x8004D017u32 as HRESULT; -pub const XACT_E_ALREADYINPROGRESS: HRESULT = 0x8004D018u32 as HRESULT; -pub const XACT_E_ABORTED: HRESULT = 0x8004D019u32 as HRESULT; -pub const XACT_E_LOGFULL: HRESULT = 0x8004D01Au32 as HRESULT; -pub const XACT_E_TMNOTAVAILABLE: HRESULT = 0x8004D01Bu32 as HRESULT; -pub const XACT_E_CONNECTION_DOWN: HRESULT = 0x8004D01Cu32 as HRESULT; -pub const XACT_E_CONNECTION_DENIED: HRESULT = 0x8004D01Du32 as HRESULT; -pub const XACT_E_REENLISTTIMEOUT: HRESULT = 0x8004D01Eu32 as HRESULT; -pub const XACT_E_TIP_CONNECT_FAILED: HRESULT = 0x8004D01Fu32 as HRESULT; -pub const XACT_E_TIP_PROTOCOL_ERROR: HRESULT = 0x8004D020u32 as HRESULT; -pub const XACT_E_TIP_PULL_FAILED: HRESULT = 0x8004D021u32 as HRESULT; -pub const XACT_E_DEST_TMNOTAVAILABLE: HRESULT = 0x8004D022u32 as HRESULT; -pub const XACT_E_TIP_DISABLED: HRESULT = 0x8004D023u32 as HRESULT; -pub const XACT_E_NETWORK_TX_DISABLED: HRESULT = 0x8004D024u32 as HRESULT; -pub const XACT_E_PARTNER_NETWORK_TX_DISABLED: HRESULT = 0x8004D025u32 as HRESULT; -pub const XACT_E_XA_TX_DISABLED: HRESULT = 0x8004D026u32 as HRESULT; -pub const XACT_E_UNABLE_TO_READ_DTC_CONFIG: HRESULT = 0x8004D027u32 as HRESULT; -pub const XACT_E_UNABLE_TO_LOAD_DTC_PROXY: HRESULT = 0x8004D028u32 as HRESULT; -pub const XACT_E_ABORTING: HRESULT = 0x8004D029u32 as HRESULT; -pub const XACT_E_PUSH_COMM_FAILURE: HRESULT = 0x8004D02Au32 as HRESULT; -pub const XACT_E_PULL_COMM_FAILURE: HRESULT = 0x8004D02Bu32 as HRESULT; -pub const XACT_E_LU_TX_DISABLED: HRESULT = 0x8004D02Cu32 as HRESULT; -pub const XACT_E_CLERKNOTFOUND: HRESULT = 0x8004D080u32 as HRESULT; -pub const XACT_E_CLERKEXISTS: HRESULT = 0x8004D081u32 as HRESULT; -pub const XACT_E_RECOVERYINPROGRESS: HRESULT = 0x8004D082u32 as HRESULT; -pub const XACT_E_TRANSACTIONCLOSED: HRESULT = 0x8004D083u32 as HRESULT; -pub const XACT_E_INVALIDLSN: HRESULT = 0x8004D084u32 as HRESULT; -pub const XACT_E_REPLAYREQUEST: HRESULT = 0x8004D085u32 as HRESULT; -pub const XACT_S_ASYNC: HRESULT = 0x0004D000; -pub const XACT_S_DEFECT: HRESULT = 0x0004D001; -pub const XACT_S_READONLY: HRESULT = 0x0004D002; -pub const XACT_S_SOMENORETAIN: HRESULT = 0x0004D003; -pub const XACT_S_OKINFORM: HRESULT = 0x0004D004; -pub const XACT_S_MADECHANGESCONTENT: HRESULT = 0x0004D005; -pub const XACT_S_MADECHANGESINFORM: HRESULT = 0x0004D006; -pub const XACT_S_ALLNORETAIN: HRESULT = 0x0004D007; -pub const XACT_S_ABORTING: HRESULT = 0x0004D008; -pub const XACT_S_SINGLEPHASE: HRESULT = 0x0004D009; -pub const XACT_S_LOCALLY_OK: HRESULT = 0x0004D00A; -pub const XACT_S_LASTRESOURCEMANAGER: HRESULT = 0x0004D010; -pub const CONTEXT_E_FIRST: HRESULT = 0x8004E000u32 as HRESULT; -pub const CONTEXT_E_LAST: HRESULT = 0x8004E02Fu32 as HRESULT; -pub const CONTEXT_S_FIRST: HRESULT = 0x0004E000; -pub const CONTEXT_S_LAST: HRESULT = 0x0004E02F; -pub const CONTEXT_E_ABORTED: HRESULT = 0x8004E002u32 as HRESULT; -pub const CONTEXT_E_ABORTING: HRESULT = 0x8004E003u32 as HRESULT; -pub const CONTEXT_E_NOCONTEXT: HRESULT = 0x8004E004u32 as HRESULT; -pub const CONTEXT_E_WOULD_DEADLOCK: HRESULT = 0x8004E005u32 as HRESULT; -pub const CONTEXT_E_SYNCH_TIMEOUT: HRESULT = 0x8004E006u32 as HRESULT; -pub const CONTEXT_E_OLDREF: HRESULT = 0x8004E007u32 as HRESULT; -pub const CONTEXT_E_ROLENOTFOUND: HRESULT = 0x8004E00Cu32 as HRESULT; -pub const CONTEXT_E_TMNOTAVAILABLE: HRESULT = 0x8004E00Fu32 as HRESULT; -pub const CO_E_ACTIVATIONFAILED: HRESULT = 0x8004E021u32 as HRESULT; -pub const CO_E_ACTIVATIONFAILED_EVENTLOGGED: HRESULT = 0x8004E022u32 as HRESULT; -pub const CO_E_ACTIVATIONFAILED_CATALOGERROR: HRESULT = 0x8004E023u32 as HRESULT; -pub const CO_E_ACTIVATIONFAILED_TIMEOUT: HRESULT = 0x8004E024u32 as HRESULT; -pub const CO_E_INITIALIZATIONFAILED: HRESULT = 0x8004E025u32 as HRESULT; -pub const CONTEXT_E_NOJIT: HRESULT = 0x8004E026u32 as HRESULT; -pub const CONTEXT_E_NOTRANSACTION: HRESULT = 0x8004E027u32 as HRESULT; -pub const CO_E_THREADINGMODEL_CHANGED: HRESULT = 0x8004E028u32 as HRESULT; -pub const CO_E_NOIISINTRINSICS: HRESULT = 0x8004E029u32 as HRESULT; -pub const CO_E_NOCOOKIES: HRESULT = 0x8004E02Au32 as HRESULT; -pub const CO_E_DBERROR: HRESULT = 0x8004E02Bu32 as HRESULT; -pub const CO_E_NOTPOOLED: HRESULT = 0x8004E02Cu32 as HRESULT; -pub const CO_E_NOTCONSTRUCTED: HRESULT = 0x8004E02Du32 as HRESULT; -pub const CO_E_NOSYNCHRONIZATION: HRESULT = 0x8004E02Eu32 as HRESULT; -pub const CO_E_ISOLEVELMISMATCH: HRESULT = 0x8004E02Fu32 as HRESULT; -pub const CO_E_CALL_OUT_OF_TX_SCOPE_NOT_ALLOWED: HRESULT = 0x8004E030u32 as HRESULT; -pub const CO_E_EXIT_TRANSACTION_SCOPE_NOT_CALLED: HRESULT = 0x8004E031u32 as HRESULT; -pub const OLE_S_USEREG: HRESULT = 0x00040000; -pub const OLE_S_STATIC: HRESULT = 0x00040001; -pub const OLE_S_MAC_CLIPFORMAT: HRESULT = 0x00040002; -pub const DRAGDROP_S_DROP: HRESULT = 0x00040100; -pub const DRAGDROP_S_CANCEL: HRESULT = 0x00040101; -pub const DRAGDROP_S_USEDEFAULTCURSORS: HRESULT = 0x00040102; -pub const DATA_S_SAMEFORMATETC: HRESULT = 0x00040130; -pub const VIEW_S_ALREADY_FROZEN: HRESULT = 0x00040140; -pub const CACHE_S_FORMATETC_NOTSUPPORTED: HRESULT = 0x00040170; -pub const CACHE_S_SAMECACHE: HRESULT = 0x00040171; -pub const CACHE_S_SOMECACHES_NOTUPDATED: HRESULT = 0x00040172; -pub const OLEOBJ_S_INVALIDVERB: HRESULT = 0x00040180; -pub const OLEOBJ_S_CANNOT_DOVERB_NOW: HRESULT = 0x00040181; -pub const OLEOBJ_S_INVALIDHWND: HRESULT = 0x00040182; -pub const INPLACE_S_TRUNCATED: HRESULT = 0x000401A0; -pub const CONVERT10_S_NO_PRESENTATION: HRESULT = 0x000401C0; -pub const MK_S_REDUCED_TO_SELF: HRESULT = 0x000401E2; -pub const MK_S_ME: HRESULT = 0x000401E4; -pub const MK_S_HIM: HRESULT = 0x000401E5; -pub const MK_S_US: HRESULT = 0x000401E6; -pub const MK_S_MONIKERALREADYREGISTERED: HRESULT = 0x000401E7; -pub const SCHED_S_TASK_READY: HRESULT = 0x00041300; -pub const SCHED_S_TASK_RUNNING: HRESULT = 0x00041301; -pub const SCHED_S_TASK_DISABLED: HRESULT = 0x00041302; -pub const SCHED_S_TASK_HAS_NOT_RUN: HRESULT = 0x00041303; -pub const SCHED_S_TASK_NO_MORE_RUNS: HRESULT = 0x00041304; -pub const SCHED_S_TASK_NOT_SCHEDULED: HRESULT = 0x00041305; -pub const SCHED_S_TASK_TERMINATED: HRESULT = 0x00041306; -pub const SCHED_S_TASK_NO_VALID_TRIGGERS: HRESULT = 0x00041307; -pub const SCHED_S_EVENT_TRIGGER: HRESULT = 0x00041308; -pub const SCHED_E_TRIGGER_NOT_FOUND: HRESULT = 0x80041309u32 as HRESULT; -pub const SCHED_E_TASK_NOT_READY: HRESULT = 0x8004130Au32 as HRESULT; -pub const SCHED_E_TASK_NOT_RUNNING: HRESULT = 0x8004130Bu32 as HRESULT; -pub const SCHED_E_SERVICE_NOT_INSTALLED: HRESULT = 0x8004130Cu32 as HRESULT; -pub const SCHED_E_CANNOT_OPEN_TASK: HRESULT = 0x8004130Du32 as HRESULT; -pub const SCHED_E_INVALID_TASK: HRESULT = 0x8004130Eu32 as HRESULT; -pub const SCHED_E_ACCOUNT_INFORMATION_NOT_SET: HRESULT = 0x8004130Fu32 as HRESULT; -pub const SCHED_E_ACCOUNT_NAME_NOT_FOUND: HRESULT = 0x80041310u32 as HRESULT; -pub const SCHED_E_ACCOUNT_DBASE_CORRUPT: HRESULT = 0x80041311u32 as HRESULT; -pub const SCHED_E_NO_SECURITY_SERVICES: HRESULT = 0x80041312u32 as HRESULT; -pub const SCHED_E_UNKNOWN_OBJECT_VERSION: HRESULT = 0x80041313u32 as HRESULT; -pub const SCHED_E_UNSUPPORTED_ACCOUNT_OPTION: HRESULT = 0x80041314u32 as HRESULT; -pub const SCHED_E_SERVICE_NOT_RUNNING: HRESULT = 0x80041315u32 as HRESULT; -pub const SCHED_E_UNEXPECTEDNODE: HRESULT = 0x80041316u32 as HRESULT; -pub const SCHED_E_NAMESPACE: HRESULT = 0x80041317u32 as HRESULT; -pub const SCHED_E_INVALIDVALUE: HRESULT = 0x80041318u32 as HRESULT; -pub const SCHED_E_MISSINGNODE: HRESULT = 0x80041319u32 as HRESULT; -pub const SCHED_E_MALFORMEDXML: HRESULT = 0x8004131Au32 as HRESULT; -pub const SCHED_S_SOME_TRIGGERS_FAILED: HRESULT = 0x0004131B; -pub const SCHED_S_BATCH_LOGON_PROBLEM: HRESULT = 0x0004131C; -pub const SCHED_E_TOO_MANY_NODES: HRESULT = 0x8004131Du32 as HRESULT; -pub const SCHED_E_PAST_END_BOUNDARY: HRESULT = 0x8004131Eu32 as HRESULT; -pub const SCHED_E_ALREADY_RUNNING: HRESULT = 0x8004131Fu32 as HRESULT; -pub const SCHED_E_USER_NOT_LOGGED_ON: HRESULT = 0x80041320u32 as HRESULT; -pub const SCHED_E_INVALID_TASK_HASH: HRESULT = 0x80041321u32 as HRESULT; -pub const SCHED_E_SERVICE_NOT_AVAILABLE: HRESULT = 0x80041322u32 as HRESULT; -pub const SCHED_E_SERVICE_TOO_BUSY: HRESULT = 0x80041323u32 as HRESULT; -pub const SCHED_E_TASK_ATTEMPTED: HRESULT = 0x80041324u32 as HRESULT; -pub const SCHED_S_TASK_QUEUED: HRESULT = 0x00041325; -pub const SCHED_E_TASK_DISABLED: HRESULT = 0x80041326u32 as HRESULT; -pub const SCHED_E_TASK_NOT_V1_COMPAT: HRESULT = 0x80041327u32 as HRESULT; -pub const SCHED_E_START_ON_DEMAND: HRESULT = 0x80041328u32 as HRESULT; -pub const SCHED_E_TASK_NOT_UBPM_COMPAT: HRESULT = 0x80041329u32 as HRESULT; -pub const SCHED_E_DEPRECATED_FEATURE_USED: HRESULT = 0x80041330u32 as HRESULT; -pub const CO_E_CLASS_CREATE_FAILED: HRESULT = 0x80080001u32 as HRESULT; -pub const CO_E_SCM_ERROR: HRESULT = 0x80080002u32 as HRESULT; -pub const CO_E_SCM_RPC_FAILURE: HRESULT = 0x80080003u32 as HRESULT; -pub const CO_E_BAD_PATH: HRESULT = 0x80080004u32 as HRESULT; -pub const CO_E_SERVER_EXEC_FAILURE: HRESULT = 0x80080005u32 as HRESULT; -pub const CO_E_OBJSRV_RPC_FAILURE: HRESULT = 0x80080006u32 as HRESULT; -pub const MK_E_NO_NORMALIZED: HRESULT = 0x80080007u32 as HRESULT; -pub const CO_E_SERVER_STOPPING: HRESULT = 0x80080008u32 as HRESULT; -pub const MEM_E_INVALID_ROOT: HRESULT = 0x80080009u32 as HRESULT; -pub const MEM_E_INVALID_LINK: HRESULT = 0x80080010u32 as HRESULT; -pub const MEM_E_INVALID_SIZE: HRESULT = 0x80080011u32 as HRESULT; -pub const CO_S_NOTALLINTERFACES: HRESULT = 0x00080012; -pub const CO_S_MACHINENAMENOTFOUND: HRESULT = 0x00080013; -pub const CO_E_MISSING_DISPLAYNAME: HRESULT = 0x80080015u32 as HRESULT; -pub const CO_E_RUNAS_VALUE_MUST_BE_AAA: HRESULT = 0x80080016u32 as HRESULT; -pub const CO_E_ELEVATION_DISABLED: HRESULT = 0x80080017u32 as HRESULT; -pub const APPX_E_PACKAGING_INTERNAL: HRESULT = 0x80080200u32 as HRESULT; -pub const APPX_E_INTERLEAVING_NOT_ALLOWED: HRESULT = 0x80080201u32 as HRESULT; -pub const APPX_E_RELATIONSHIPS_NOT_ALLOWED: HRESULT = 0x80080202u32 as HRESULT; -pub const APPX_E_MISSING_REQUIRED_FILE: HRESULT = 0x80080203u32 as HRESULT; -pub const APPX_E_INVALID_MANIFEST: HRESULT = 0x80080204u32 as HRESULT; -pub const APPX_E_INVALID_BLOCKMAP: HRESULT = 0x80080205u32 as HRESULT; -pub const APPX_E_CORRUPT_CONTENT: HRESULT = 0x80080206u32 as HRESULT; -pub const APPX_E_BLOCK_HASH_INVALID: HRESULT = 0x80080207u32 as HRESULT; -pub const APPX_E_REQUESTED_RANGE_TOO_LARGE: HRESULT = 0x80080208u32 as HRESULT; -pub const APPX_E_INVALID_SIP_CLIENT_DATA: HRESULT = 0x80080209u32 as HRESULT; -pub const BT_E_SPURIOUS_ACTIVATION: HRESULT = 0x80080300u32 as HRESULT; -pub const DISP_E_UNKNOWNINTERFACE: HRESULT = 0x80020001u32 as HRESULT; -pub const DISP_E_MEMBERNOTFOUND: HRESULT = 0x80020003u32 as HRESULT; -pub const DISP_E_PARAMNOTFOUND: HRESULT = 0x80020004u32 as HRESULT; -pub const DISP_E_TYPEMISMATCH: HRESULT = 0x80020005u32 as HRESULT; -pub const DISP_E_UNKNOWNNAME: HRESULT = 0x80020006u32 as HRESULT; -pub const DISP_E_NONAMEDARGS: HRESULT = 0x80020007u32 as HRESULT; -pub const DISP_E_BADVARTYPE: HRESULT = 0x80020008u32 as HRESULT; -pub const DISP_E_EXCEPTION: HRESULT = 0x80020009u32 as HRESULT; -pub const DISP_E_OVERFLOW: HRESULT = 0x8002000Au32 as HRESULT; -pub const DISP_E_BADINDEX: HRESULT = 0x8002000Bu32 as HRESULT; -pub const DISP_E_UNKNOWNLCID: HRESULT = 0x8002000Cu32 as HRESULT; -pub const DISP_E_ARRAYISLOCKED: HRESULT = 0x8002000Du32 as HRESULT; -pub const DISP_E_BADPARAMCOUNT: HRESULT = 0x8002000Eu32 as HRESULT; -pub const DISP_E_PARAMNOTOPTIONAL: HRESULT = 0x8002000Fu32 as HRESULT; -pub const DISP_E_BADCALLEE: HRESULT = 0x80020010u32 as HRESULT; -pub const DISP_E_NOTACOLLECTION: HRESULT = 0x80020011u32 as HRESULT; -pub const DISP_E_DIVBYZERO: HRESULT = 0x80020012u32 as HRESULT; -pub const DISP_E_BUFFERTOOSMALL: HRESULT = 0x80020013u32 as HRESULT; -pub const TYPE_E_BUFFERTOOSMALL: HRESULT = 0x80028016u32 as HRESULT; -pub const TYPE_E_FIELDNOTFOUND: HRESULT = 0x80028017u32 as HRESULT; -pub const TYPE_E_INVDATAREAD: HRESULT = 0x80028018u32 as HRESULT; -pub const TYPE_E_UNSUPFORMAT: HRESULT = 0x80028019u32 as HRESULT; -pub const TYPE_E_REGISTRYACCESS: HRESULT = 0x8002801Cu32 as HRESULT; -pub const TYPE_E_LIBNOTREGISTERED: HRESULT = 0x8002801Du32 as HRESULT; -pub const TYPE_E_UNDEFINEDTYPE: HRESULT = 0x80028027u32 as HRESULT; -pub const TYPE_E_QUALIFIEDNAMEDISALLOWED: HRESULT = 0x80028028u32 as HRESULT; -pub const TYPE_E_INVALIDSTATE: HRESULT = 0x80028029u32 as HRESULT; -pub const TYPE_E_WRONGTYPEKIND: HRESULT = 0x8002802Au32 as HRESULT; -pub const TYPE_E_ELEMENTNOTFOUND: HRESULT = 0x8002802Bu32 as HRESULT; -pub const TYPE_E_AMBIGUOUSNAME: HRESULT = 0x8002802Cu32 as HRESULT; -pub const TYPE_E_NAMECONFLICT: HRESULT = 0x8002802Du32 as HRESULT; -pub const TYPE_E_UNKNOWNLCID: HRESULT = 0x8002802Eu32 as HRESULT; -pub const TYPE_E_DLLFUNCTIONNOTFOUND: HRESULT = 0x8002802Fu32 as HRESULT; -pub const TYPE_E_BADMODULEKIND: HRESULT = 0x800288BDu32 as HRESULT; -pub const TYPE_E_SIZETOOBIG: HRESULT = 0x800288C5u32 as HRESULT; -pub const TYPE_E_DUPLICATEID: HRESULT = 0x800288C6u32 as HRESULT; -pub const TYPE_E_INVALIDID: HRESULT = 0x800288CFu32 as HRESULT; -pub const TYPE_E_TYPEMISMATCH: HRESULT = 0x80028CA0u32 as HRESULT; -pub const TYPE_E_OUTOFBOUNDS: HRESULT = 0x80028CA1u32 as HRESULT; -pub const TYPE_E_IOERROR: HRESULT = 0x80028CA2u32 as HRESULT; -pub const TYPE_E_CANTCREATETMPFILE: HRESULT = 0x80028CA3u32 as HRESULT; -pub const TYPE_E_CANTLOADLIBRARY: HRESULT = 0x80029C4Au32 as HRESULT; -pub const TYPE_E_INCONSISTENTPROPFUNCS: HRESULT = 0x80029C83u32 as HRESULT; -pub const TYPE_E_CIRCULARTYPE: HRESULT = 0x80029C84u32 as HRESULT; -pub const STG_E_INVALIDFUNCTION: HRESULT = 0x80030001u32 as HRESULT; -pub const STG_E_FILENOTFOUND: HRESULT = 0x80030002u32 as HRESULT; -pub const STG_E_PATHNOTFOUND: HRESULT = 0x80030003u32 as HRESULT; -pub const STG_E_TOOMANYOPENFILES: HRESULT = 0x80030004u32 as HRESULT; -pub const STG_E_ACCESSDENIED: HRESULT = 0x80030005u32 as HRESULT; -pub const STG_E_INVALIDHANDLE: HRESULT = 0x80030006u32 as HRESULT; -pub const STG_E_INSUFFICIENTMEMORY: HRESULT = 0x80030008u32 as HRESULT; -pub const STG_E_INVALIDPOINTER: HRESULT = 0x80030009u32 as HRESULT; -pub const STG_E_NOMOREFILES: HRESULT = 0x80030012u32 as HRESULT; -pub const STG_E_DISKISWRITEPROTECTED: HRESULT = 0x80030013u32 as HRESULT; -pub const STG_E_SEEKERROR: HRESULT = 0x80030019u32 as HRESULT; -pub const STG_E_WRITEFAULT: HRESULT = 0x8003001Du32 as HRESULT; -pub const STG_E_READFAULT: HRESULT = 0x8003001Eu32 as HRESULT; -pub const STG_E_SHAREVIOLATION: HRESULT = 0x80030020u32 as HRESULT; -pub const STG_E_LOCKVIOLATION: HRESULT = 0x80030021u32 as HRESULT; -pub const STG_E_FILEALREADYEXISTS: HRESULT = 0x80030050u32 as HRESULT; -pub const STG_E_INVALIDPARAMETER: HRESULT = 0x80030057u32 as HRESULT; -pub const STG_E_MEDIUMFULL: HRESULT = 0x80030070u32 as HRESULT; -pub const STG_E_PROPSETMISMATCHED: HRESULT = 0x800300F0u32 as HRESULT; -pub const STG_E_ABNORMALAPIEXIT: HRESULT = 0x800300FAu32 as HRESULT; -pub const STG_E_INVALIDHEADER: HRESULT = 0x800300FBu32 as HRESULT; -pub const STG_E_INVALIDNAME: HRESULT = 0x800300FCu32 as HRESULT; -pub const STG_E_UNKNOWN: HRESULT = 0x800300FDu32 as HRESULT; -pub const STG_E_UNIMPLEMENTEDFUNCTION: HRESULT = 0x800300FEu32 as HRESULT; -pub const STG_E_INVALIDFLAG: HRESULT = 0x800300FFu32 as HRESULT; -pub const STG_E_INUSE: HRESULT = 0x80030100u32 as HRESULT; -pub const STG_E_NOTCURRENT: HRESULT = 0x80030101u32 as HRESULT; -pub const STG_E_REVERTED: HRESULT = 0x80030102u32 as HRESULT; -pub const STG_E_CANTSAVE: HRESULT = 0x80030103u32 as HRESULT; -pub const STG_E_OLDFORMAT: HRESULT = 0x80030104u32 as HRESULT; -pub const STG_E_OLDDLL: HRESULT = 0x80030105u32 as HRESULT; -pub const STG_E_SHAREREQUIRED: HRESULT = 0x80030106u32 as HRESULT; -pub const STG_E_NOTFILEBASEDSTORAGE: HRESULT = 0x80030107u32 as HRESULT; -pub const STG_E_EXTANTMARSHALLINGS: HRESULT = 0x80030108u32 as HRESULT; -pub const STG_E_DOCFILECORRUPT: HRESULT = 0x80030109u32 as HRESULT; -pub const STG_E_BADBASEADDRESS: HRESULT = 0x80030110u32 as HRESULT; -pub const STG_E_DOCFILETOOLARGE: HRESULT = 0x80030111u32 as HRESULT; -pub const STG_E_NOTSIMPLEFORMAT: HRESULT = 0x80030112u32 as HRESULT; -pub const STG_E_INCOMPLETE: HRESULT = 0x80030201u32 as HRESULT; -pub const STG_E_TERMINATED: HRESULT = 0x80030202u32 as HRESULT; -pub const STG_S_CONVERTED: HRESULT = 0x00030200; -pub const STG_S_BLOCK: HRESULT = 0x00030201; -pub const STG_S_RETRYNOW: HRESULT = 0x00030202; -pub const STG_S_MONITORING: HRESULT = 0x00030203; -pub const STG_S_MULTIPLEOPENS: HRESULT = 0x00030204; -pub const STG_S_CONSOLIDATIONFAILED: HRESULT = 0x00030205; -pub const STG_S_CANNOTCONSOLIDATE: HRESULT = 0x00030206; -pub const STG_E_STATUS_COPY_PROTECTION_FAILURE: HRESULT = 0x80030305u32 as HRESULT; -pub const STG_E_CSS_AUTHENTICATION_FAILURE: HRESULT = 0x80030306u32 as HRESULT; -pub const STG_E_CSS_KEY_NOT_PRESENT: HRESULT = 0x80030307u32 as HRESULT; -pub const STG_E_CSS_KEY_NOT_ESTABLISHED: HRESULT = 0x80030308u32 as HRESULT; -pub const STG_E_CSS_SCRAMBLED_SECTOR: HRESULT = 0x80030309u32 as HRESULT; -pub const STG_E_CSS_REGION_MISMATCH: HRESULT = 0x8003030Au32 as HRESULT; -pub const STG_E_RESETS_EXHAUSTED: HRESULT = 0x8003030Bu32 as HRESULT; -pub const RPC_E_CALL_REJECTED: HRESULT = 0x80010001u32 as HRESULT; -pub const RPC_E_CALL_CANCELED: HRESULT = 0x80010002u32 as HRESULT; -pub const RPC_E_CANTPOST_INSENDCALL: HRESULT = 0x80010003u32 as HRESULT; -pub const RPC_E_CANTCALLOUT_INASYNCCALL: HRESULT = 0x80010004u32 as HRESULT; -pub const RPC_E_CANTCALLOUT_INEXTERNALCALL: HRESULT = 0x80010005u32 as HRESULT; -pub const RPC_E_CONNECTION_TERMINATED: HRESULT = 0x80010006u32 as HRESULT; -pub const RPC_E_SERVER_DIED: HRESULT = 0x80010007u32 as HRESULT; -pub const RPC_E_CLIENT_DIED: HRESULT = 0x80010008u32 as HRESULT; -pub const RPC_E_INVALID_DATAPACKET: HRESULT = 0x80010009u32 as HRESULT; -pub const RPC_E_CANTTRANSMIT_CALL: HRESULT = 0x8001000Au32 as HRESULT; -pub const RPC_E_CLIENT_CANTMARSHAL_DATA: HRESULT = 0x8001000Bu32 as HRESULT; -pub const RPC_E_CLIENT_CANTUNMARSHAL_DATA: HRESULT = 0x8001000Cu32 as HRESULT; -pub const RPC_E_SERVER_CANTMARSHAL_DATA: HRESULT = 0x8001000Du32 as HRESULT; -pub const RPC_E_SERVER_CANTUNMARSHAL_DATA: HRESULT = 0x8001000Eu32 as HRESULT; -pub const RPC_E_INVALID_DATA: HRESULT = 0x8001000Fu32 as HRESULT; -pub const RPC_E_INVALID_PARAMETER: HRESULT = 0x80010010u32 as HRESULT; -pub const RPC_E_CANTCALLOUT_AGAIN: HRESULT = 0x80010011u32 as HRESULT; -pub const RPC_E_SERVER_DIED_DNE: HRESULT = 0x80010012u32 as HRESULT; -pub const RPC_E_SYS_CALL_FAILED: HRESULT = 0x80010100u32 as HRESULT; -pub const RPC_E_OUT_OF_RESOURCES: HRESULT = 0x80010101u32 as HRESULT; -pub const RPC_E_ATTEMPTED_MULTITHREAD: HRESULT = 0x80010102u32 as HRESULT; -pub const RPC_E_NOT_REGISTERED: HRESULT = 0x80010103u32 as HRESULT; -pub const RPC_E_FAULT: HRESULT = 0x80010104u32 as HRESULT; -pub const RPC_E_SERVERFAULT: HRESULT = 0x80010105u32 as HRESULT; -pub const RPC_E_CHANGED_MODE: HRESULT = 0x80010106u32 as HRESULT; -pub const RPC_E_INVALIDMETHOD: HRESULT = 0x80010107u32 as HRESULT; -pub const RPC_E_DISCONNECTED: HRESULT = 0x80010108u32 as HRESULT; -pub const RPC_E_RETRY: HRESULT = 0x80010109u32 as HRESULT; -pub const RPC_E_SERVERCALL_RETRYLATER: HRESULT = 0x8001010Au32 as HRESULT; -pub const RPC_E_SERVERCALL_REJECTED: HRESULT = 0x8001010Bu32 as HRESULT; -pub const RPC_E_INVALID_CALLDATA: HRESULT = 0x8001010Cu32 as HRESULT; -pub const RPC_E_CANTCALLOUT_ININPUTSYNCCALL: HRESULT = 0x8001010Du32 as HRESULT; -pub const RPC_E_WRONG_THREAD: HRESULT = 0x8001010Eu32 as HRESULT; -pub const RPC_E_THREAD_NOT_INIT: HRESULT = 0x8001010Fu32 as HRESULT; -pub const RPC_E_VERSION_MISMATCH: HRESULT = 0x80010110u32 as HRESULT; -pub const RPC_E_INVALID_HEADER: HRESULT = 0x80010111u32 as HRESULT; -pub const RPC_E_INVALID_EXTENSION: HRESULT = 0x80010112u32 as HRESULT; -pub const RPC_E_INVALID_IPID: HRESULT = 0x80010113u32 as HRESULT; -pub const RPC_E_INVALID_OBJECT: HRESULT = 0x80010114u32 as HRESULT; -pub const RPC_S_CALLPENDING: HRESULT = 0x80010115u32 as HRESULT; -pub const RPC_S_WAITONTIMER: HRESULT = 0x80010116u32 as HRESULT; -pub const RPC_E_CALL_COMPLETE: HRESULT = 0x80010117u32 as HRESULT; -pub const RPC_E_UNSECURE_CALL: HRESULT = 0x80010118u32 as HRESULT; -pub const RPC_E_TOO_LATE: HRESULT = 0x80010119u32 as HRESULT; -pub const RPC_E_NO_GOOD_SECURITY_PACKAGES: HRESULT = 0x8001011Au32 as HRESULT; -pub const RPC_E_ACCESS_DENIED: HRESULT = 0x8001011Bu32 as HRESULT; -pub const RPC_E_REMOTE_DISABLED: HRESULT = 0x8001011Cu32 as HRESULT; -pub const RPC_E_INVALID_OBJREF: HRESULT = 0x8001011Du32 as HRESULT; -pub const RPC_E_NO_CONTEXT: HRESULT = 0x8001011Eu32 as HRESULT; -pub const RPC_E_TIMEOUT: HRESULT = 0x8001011Fu32 as HRESULT; -pub const RPC_E_NO_SYNC: HRESULT = 0x80010120u32 as HRESULT; -pub const RPC_E_FULLSIC_REQUIRED: HRESULT = 0x80010121u32 as HRESULT; -pub const RPC_E_INVALID_STD_NAME: HRESULT = 0x80010122u32 as HRESULT; -pub const CO_E_FAILEDTOIMPERSONATE: HRESULT = 0x80010123u32 as HRESULT; -pub const CO_E_FAILEDTOGETSECCTX: HRESULT = 0x80010124u32 as HRESULT; -pub const CO_E_FAILEDTOOPENTHREADTOKEN: HRESULT = 0x80010125u32 as HRESULT; -pub const CO_E_FAILEDTOGETTOKENINFO: HRESULT = 0x80010126u32 as HRESULT; -pub const CO_E_TRUSTEEDOESNTMATCHCLIENT: HRESULT = 0x80010127u32 as HRESULT; -pub const CO_E_FAILEDTOQUERYCLIENTBLANKET: HRESULT = 0x80010128u32 as HRESULT; -pub const CO_E_FAILEDTOSETDACL: HRESULT = 0x80010129u32 as HRESULT; -pub const CO_E_ACCESSCHECKFAILED: HRESULT = 0x8001012Au32 as HRESULT; -pub const CO_E_NETACCESSAPIFAILED: HRESULT = 0x8001012Bu32 as HRESULT; -pub const CO_E_WRONGTRUSTEENAMESYNTAX: HRESULT = 0x8001012Cu32 as HRESULT; -pub const CO_E_INVALIDSID: HRESULT = 0x8001012Du32 as HRESULT; -pub const CO_E_CONVERSIONFAILED: HRESULT = 0x8001012Eu32 as HRESULT; -pub const CO_E_NOMATCHINGSIDFOUND: HRESULT = 0x8001012Fu32 as HRESULT; -pub const CO_E_LOOKUPACCSIDFAILED: HRESULT = 0x80010130u32 as HRESULT; -pub const CO_E_NOMATCHINGNAMEFOUND: HRESULT = 0x80010131u32 as HRESULT; -pub const CO_E_LOOKUPACCNAMEFAILED: HRESULT = 0x80010132u32 as HRESULT; -pub const CO_E_SETSERLHNDLFAILED: HRESULT = 0x80010133u32 as HRESULT; -pub const CO_E_FAILEDTOGETWINDIR: HRESULT = 0x80010134u32 as HRESULT; -pub const CO_E_PATHTOOLONG: HRESULT = 0x80010135u32 as HRESULT; -pub const CO_E_FAILEDTOGENUUID: HRESULT = 0x80010136u32 as HRESULT; -pub const CO_E_FAILEDTOCREATEFILE: HRESULT = 0x80010137u32 as HRESULT; -pub const CO_E_FAILEDTOCLOSEHANDLE: HRESULT = 0x80010138u32 as HRESULT; -pub const CO_E_EXCEEDSYSACLLIMIT: HRESULT = 0x80010139u32 as HRESULT; -pub const CO_E_ACESINWRONGORDER: HRESULT = 0x8001013Au32 as HRESULT; -pub const CO_E_INCOMPATIBLESTREAMVERSION: HRESULT = 0x8001013Bu32 as HRESULT; -pub const CO_E_FAILEDTOOPENPROCESSTOKEN: HRESULT = 0x8001013Cu32 as HRESULT; -pub const CO_E_DECODEFAILED: HRESULT = 0x8001013Du32 as HRESULT; -pub const CO_E_ACNOTINITIALIZED: HRESULT = 0x8001013Fu32 as HRESULT; -pub const CO_E_CANCEL_DISABLED: HRESULT = 0x80010140u32 as HRESULT; -pub const RPC_E_UNEXPECTED: HRESULT = 0x8001FFFFu32 as HRESULT; -pub const ERROR_AUDITING_DISABLED: HRESULT = 0xC0090001u32 as HRESULT; -pub const ERROR_ALL_SIDS_FILTERED: HRESULT = 0xC0090002u32 as HRESULT; -pub const ERROR_BIZRULES_NOT_ENABLED: HRESULT = 0xC0090003u32 as HRESULT; -pub const NTE_BAD_UID: HRESULT = 0x80090001u32 as HRESULT; -pub const NTE_BAD_HASH: HRESULT = 0x80090002u32 as HRESULT; -pub const NTE_BAD_KEY: HRESULT = 0x80090003u32 as HRESULT; -pub const NTE_BAD_LEN: HRESULT = 0x80090004u32 as HRESULT; -pub const NTE_BAD_DATA: HRESULT = 0x80090005u32 as HRESULT; -pub const NTE_BAD_SIGNATURE: HRESULT = 0x80090006u32 as HRESULT; -pub const NTE_BAD_VER: HRESULT = 0x80090007u32 as HRESULT; -pub const NTE_BAD_ALGID: HRESULT = 0x80090008u32 as HRESULT; -pub const NTE_BAD_FLAGS: HRESULT = 0x80090009u32 as HRESULT; -pub const NTE_BAD_TYPE: HRESULT = 0x8009000Au32 as HRESULT; -pub const NTE_BAD_KEY_STATE: HRESULT = 0x8009000Bu32 as HRESULT; -pub const NTE_BAD_HASH_STATE: HRESULT = 0x8009000Cu32 as HRESULT; -pub const NTE_NO_KEY: HRESULT = 0x8009000Du32 as HRESULT; -pub const NTE_NO_MEMORY: HRESULT = 0x8009000Eu32 as HRESULT; -pub const NTE_EXISTS: HRESULT = 0x8009000Fu32 as HRESULT; -pub const NTE_PERM: HRESULT = 0x80090010u32 as HRESULT; -pub const NTE_NOT_FOUND: HRESULT = 0x80090011u32 as HRESULT; -pub const NTE_DOUBLE_ENCRYPT: HRESULT = 0x80090012u32 as HRESULT; -pub const NTE_BAD_PROVIDER: HRESULT = 0x80090013u32 as HRESULT; -pub const NTE_BAD_PROV_TYPE: HRESULT = 0x80090014u32 as HRESULT; -pub const NTE_BAD_PUBLIC_KEY: HRESULT = 0x80090015u32 as HRESULT; -pub const NTE_BAD_KEYSET: HRESULT = 0x80090016u32 as HRESULT; -pub const NTE_PROV_TYPE_NOT_DEF: HRESULT = 0x80090017u32 as HRESULT; -pub const NTE_PROV_TYPE_ENTRY_BAD: HRESULT = 0x80090018u32 as HRESULT; -pub const NTE_KEYSET_NOT_DEF: HRESULT = 0x80090019u32 as HRESULT; -pub const NTE_KEYSET_ENTRY_BAD: HRESULT = 0x8009001Au32 as HRESULT; -pub const NTE_PROV_TYPE_NO_MATCH: HRESULT = 0x8009001Bu32 as HRESULT; -pub const NTE_SIGNATURE_FILE_BAD: HRESULT = 0x8009001Cu32 as HRESULT; -pub const NTE_PROVIDER_DLL_FAIL: HRESULT = 0x8009001Du32 as HRESULT; -pub const NTE_PROV_DLL_NOT_FOUND: HRESULT = 0x8009001Eu32 as HRESULT; -pub const NTE_BAD_KEYSET_PARAM: HRESULT = 0x8009001Fu32 as HRESULT; -pub const NTE_FAIL: HRESULT = 0x80090020u32 as HRESULT; -pub const NTE_SYS_ERR: HRESULT = 0x80090021u32 as HRESULT; -pub const NTE_SILENT_CONTEXT: HRESULT = 0x80090022u32 as HRESULT; -pub const NTE_TOKEN_KEYSET_STORAGE_FULL: HRESULT = 0x80090023u32 as HRESULT; -pub const NTE_TEMPORARY_PROFILE: HRESULT = 0x80090024u32 as HRESULT; -pub const NTE_FIXEDPARAMETER: HRESULT = 0x80090025u32 as HRESULT; -pub const NTE_INVALID_HANDLE: HRESULT = 0x80090026u32 as HRESULT; -pub const NTE_INVALID_PARAMETER: HRESULT = 0x80090027u32 as HRESULT; -pub const NTE_BUFFER_TOO_SMALL: HRESULT = 0x80090028u32 as HRESULT; -pub const NTE_NOT_SUPPORTED: HRESULT = 0x80090029u32 as HRESULT; -pub const NTE_NO_MORE_ITEMS: HRESULT = 0x8009002Au32 as HRESULT; -pub const NTE_BUFFERS_OVERLAP: HRESULT = 0x8009002Bu32 as HRESULT; -pub const NTE_DECRYPTION_FAILURE: HRESULT = 0x8009002Cu32 as HRESULT; -pub const NTE_INTERNAL_ERROR: HRESULT = 0x8009002Du32 as HRESULT; -pub const NTE_UI_REQUIRED: HRESULT = 0x8009002Eu32 as HRESULT; -pub const NTE_HMAC_NOT_SUPPORTED: HRESULT = 0x8009002Fu32 as HRESULT; -pub const NTE_DEVICE_NOT_READY: HRESULT = 0x80090030u32 as HRESULT; -pub const NTE_AUTHENTICATION_IGNORED: HRESULT = 0x80090031u32 as HRESULT; -pub const NTE_VALIDATION_FAILED: HRESULT = 0x80090032u32 as HRESULT; -pub const NTE_INCORRECT_PASSWORD: HRESULT = 0x80090033u32 as HRESULT; -pub const NTE_ENCRYPTION_FAILURE: HRESULT = 0x80090034u32 as HRESULT; -pub const NTE_DEVICE_NOT_FOUND: HRESULT = 0x80090035u32 as HRESULT; -pub const SEC_E_INSUFFICIENT_MEMORY: HRESULT = 0x80090300u32 as HRESULT; -pub const SEC_E_INVALID_HANDLE: HRESULT = 0x80090301u32 as HRESULT; -pub const SEC_E_UNSUPPORTED_FUNCTION: HRESULT = 0x80090302u32 as HRESULT; -pub const SEC_E_TARGET_UNKNOWN: HRESULT = 0x80090303u32 as HRESULT; -pub const SEC_E_INTERNAL_ERROR: HRESULT = 0x80090304u32 as HRESULT; -pub const SEC_E_SECPKG_NOT_FOUND: HRESULT = 0x80090305u32 as HRESULT; -pub const SEC_E_NOT_OWNER: HRESULT = 0x80090306u32 as HRESULT; -pub const SEC_E_CANNOT_INSTALL: HRESULT = 0x80090307u32 as HRESULT; -pub const SEC_E_INVALID_TOKEN: HRESULT = 0x80090308u32 as HRESULT; -pub const SEC_E_CANNOT_PACK: HRESULT = 0x80090309u32 as HRESULT; -pub const SEC_E_QOP_NOT_SUPPORTED: HRESULT = 0x8009030Au32 as HRESULT; -pub const SEC_E_NO_IMPERSONATION: HRESULT = 0x8009030Bu32 as HRESULT; -pub const SEC_E_LOGON_DENIED: HRESULT = 0x8009030Cu32 as HRESULT; -pub const SEC_E_UNKNOWN_CREDENTIALS: HRESULT = 0x8009030Du32 as HRESULT; -pub const SEC_E_NO_CREDENTIALS: HRESULT = 0x8009030Eu32 as HRESULT; -pub const SEC_E_MESSAGE_ALTERED: HRESULT = 0x8009030Fu32 as HRESULT; -pub const SEC_E_OUT_OF_SEQUENCE: HRESULT = 0x80090310u32 as HRESULT; -pub const SEC_E_NO_AUTHENTICATING_AUTHORITY: HRESULT = 0x80090311u32 as HRESULT; -pub const SEC_I_CONTINUE_NEEDED: HRESULT = 0x00090312; -pub const SEC_I_COMPLETE_NEEDED: HRESULT = 0x00090313; -pub const SEC_I_COMPLETE_AND_CONTINUE: HRESULT = 0x00090314; -pub const SEC_I_LOCAL_LOGON: HRESULT = 0x00090315; -pub const SEC_E_BAD_PKGID: HRESULT = 0x80090316u32 as HRESULT; -pub const SEC_E_CONTEXT_EXPIRED: HRESULT = 0x80090317u32 as HRESULT; -pub const SEC_I_CONTEXT_EXPIRED: HRESULT = 0x00090317; -pub const SEC_E_INCOMPLETE_MESSAGE: HRESULT = 0x80090318u32 as HRESULT; -pub const SEC_E_INCOMPLETE_CREDENTIALS: HRESULT = 0x80090320u32 as HRESULT; -pub const SEC_E_BUFFER_TOO_SMALL: HRESULT = 0x80090321u32 as HRESULT; -pub const SEC_I_INCOMPLETE_CREDENTIALS: HRESULT = 0x00090320; -pub const SEC_I_RENEGOTIATE: HRESULT = 0x00090321; -pub const SEC_E_WRONG_PRINCIPAL: HRESULT = 0x80090322u32 as HRESULT; -pub const SEC_I_NO_LSA_CONTEXT: HRESULT = 0x00090323; -pub const SEC_E_TIME_SKEW: HRESULT = 0x80090324u32 as HRESULT; -pub const SEC_E_UNTRUSTED_ROOT: HRESULT = 0x80090325u32 as HRESULT; -pub const SEC_E_ILLEGAL_MESSAGE: HRESULT = 0x80090326u32 as HRESULT; -pub const SEC_E_CERT_UNKNOWN: HRESULT = 0x80090327u32 as HRESULT; -pub const SEC_E_CERT_EXPIRED: HRESULT = 0x80090328u32 as HRESULT; -pub const SEC_E_ENCRYPT_FAILURE: HRESULT = 0x80090329u32 as HRESULT; -pub const SEC_E_DECRYPT_FAILURE: HRESULT = 0x80090330u32 as HRESULT; -pub const SEC_E_ALGORITHM_MISMATCH: HRESULT = 0x80090331u32 as HRESULT; -pub const SEC_E_SECURITY_QOS_FAILED: HRESULT = 0x80090332u32 as HRESULT; -pub const SEC_E_UNFINISHED_CONTEXT_DELETED: HRESULT = 0x80090333u32 as HRESULT; -pub const SEC_E_NO_TGT_REPLY: HRESULT = 0x80090334u32 as HRESULT; -pub const SEC_E_NO_IP_ADDRESSES: HRESULT = 0x80090335u32 as HRESULT; -pub const SEC_E_WRONG_CREDENTIAL_HANDLE: HRESULT = 0x80090336u32 as HRESULT; -pub const SEC_E_CRYPTO_SYSTEM_INVALID: HRESULT = 0x80090337u32 as HRESULT; -pub const SEC_E_MAX_REFERRALS_EXCEEDED: HRESULT = 0x80090338u32 as HRESULT; -pub const SEC_E_MUST_BE_KDC: HRESULT = 0x80090339u32 as HRESULT; -pub const SEC_E_STRONG_CRYPTO_NOT_SUPPORTED: HRESULT = 0x8009033Au32 as HRESULT; -pub const SEC_E_TOO_MANY_PRINCIPALS: HRESULT = 0x8009033Bu32 as HRESULT; -pub const SEC_E_NO_PA_DATA: HRESULT = 0x8009033Cu32 as HRESULT; -pub const SEC_E_PKINIT_NAME_MISMATCH: HRESULT = 0x8009033Du32 as HRESULT; -pub const SEC_E_SMARTCARD_LOGON_REQUIRED: HRESULT = 0x8009033Eu32 as HRESULT; -pub const SEC_E_SHUTDOWN_IN_PROGRESS: HRESULT = 0x8009033Fu32 as HRESULT; -pub const SEC_E_KDC_INVALID_REQUEST: HRESULT = 0x80090340u32 as HRESULT; -pub const SEC_E_KDC_UNABLE_TO_REFER: HRESULT = 0x80090341u32 as HRESULT; -pub const SEC_E_KDC_UNKNOWN_ETYPE: HRESULT = 0x80090342u32 as HRESULT; -pub const SEC_E_UNSUPPORTED_PREAUTH: HRESULT = 0x80090343u32 as HRESULT; -pub const SEC_E_DELEGATION_REQUIRED: HRESULT = 0x80090345u32 as HRESULT; -pub const SEC_E_BAD_BINDINGS: HRESULT = 0x80090346u32 as HRESULT; -pub const SEC_E_MULTIPLE_ACCOUNTS: HRESULT = 0x80090347u32 as HRESULT; -pub const SEC_E_NO_KERB_KEY: HRESULT = 0x80090348u32 as HRESULT; -pub const SEC_E_CERT_WRONG_USAGE: HRESULT = 0x80090349u32 as HRESULT; -pub const SEC_E_DOWNGRADE_DETECTED: HRESULT = 0x80090350u32 as HRESULT; -pub const SEC_E_SMARTCARD_CERT_REVOKED: HRESULT = 0x80090351u32 as HRESULT; -pub const SEC_E_ISSUING_CA_UNTRUSTED: HRESULT = 0x80090352u32 as HRESULT; -pub const SEC_E_REVOCATION_OFFLINE_C: HRESULT = 0x80090353u32 as HRESULT; -pub const SEC_E_PKINIT_CLIENT_FAILURE: HRESULT = 0x80090354u32 as HRESULT; -pub const SEC_E_SMARTCARD_CERT_EXPIRED: HRESULT = 0x80090355u32 as HRESULT; -pub const SEC_E_NO_S4U_PROT_SUPPORT: HRESULT = 0x80090356u32 as HRESULT; -pub const SEC_E_CROSSREALM_DELEGATION_FAILURE: HRESULT = 0x80090357u32 as HRESULT; -pub const SEC_E_REVOCATION_OFFLINE_KDC: HRESULT = 0x80090358u32 as HRESULT; -pub const SEC_E_ISSUING_CA_UNTRUSTED_KDC: HRESULT = 0x80090359u32 as HRESULT; -pub const SEC_E_KDC_CERT_EXPIRED: HRESULT = 0x8009035Au32 as HRESULT; -pub const SEC_E_KDC_CERT_REVOKED: HRESULT = 0x8009035Bu32 as HRESULT; -pub const SEC_I_SIGNATURE_NEEDED: HRESULT = 0x0009035C; -pub const SEC_E_INVALID_PARAMETER: HRESULT = 0x8009035Du32 as HRESULT; -pub const SEC_E_DELEGATION_POLICY: HRESULT = 0x8009035Eu32 as HRESULT; -pub const SEC_E_POLICY_NLTM_ONLY: HRESULT = 0x8009035Fu32 as HRESULT; -pub const SEC_I_NO_RENEGOTIATION: HRESULT = 0x00090360; -pub const SEC_E_NO_CONTEXT: HRESULT = 0x80090361u32 as HRESULT; -pub const SEC_E_PKU2U_CERT_FAILURE: HRESULT = 0x80090362u32 as HRESULT; -pub const SEC_E_MUTUAL_AUTH_FAILED: HRESULT = 0x80090363u32 as HRESULT; -pub const SEC_I_MESSAGE_FRAGMENT: HRESULT = 0x00090364; -pub const SEC_E_ONLY_HTTPS_ALLOWED: HRESULT = 0x80090365u32 as HRESULT; -pub const SEC_I_CONTINUE_NEEDED_MESSAGE_OK: HRESULT = 0x00090366; -pub const SEC_E_APPLICATION_PROTOCOL_MISMATCH: HRESULT = 0x80090367u32 as HRESULT; -pub const SEC_E_NO_SPM: HRESULT = SEC_E_INTERNAL_ERROR; -pub const SEC_E_NOT_SUPPORTED: HRESULT = SEC_E_UNSUPPORTED_FUNCTION; -pub const CRYPT_E_MSG_ERROR: HRESULT = 0x80091001u32 as HRESULT; -pub const CRYPT_E_UNKNOWN_ALGO: HRESULT = 0x80091002u32 as HRESULT; -pub const CRYPT_E_OID_FORMAT: HRESULT = 0x80091003u32 as HRESULT; -pub const CRYPT_E_INVALID_MSG_TYPE: HRESULT = 0x80091004u32 as HRESULT; -pub const CRYPT_E_UNEXPECTED_ENCODING: HRESULT = 0x80091005u32 as HRESULT; -pub const CRYPT_E_AUTH_ATTR_MISSING: HRESULT = 0x80091006u32 as HRESULT; -pub const CRYPT_E_HASH_VALUE: HRESULT = 0x80091007u32 as HRESULT; -pub const CRYPT_E_INVALID_INDEX: HRESULT = 0x80091008u32 as HRESULT; -pub const CRYPT_E_ALREADY_DECRYPTED: HRESULT = 0x80091009u32 as HRESULT; -pub const CRYPT_E_NOT_DECRYPTED: HRESULT = 0x8009100Au32 as HRESULT; -pub const CRYPT_E_RECIPIENT_NOT_FOUND: HRESULT = 0x8009100Bu32 as HRESULT; -pub const CRYPT_E_CONTROL_TYPE: HRESULT = 0x8009100Cu32 as HRESULT; -pub const CRYPT_E_ISSUER_SERIALNUMBER: HRESULT = 0x8009100Du32 as HRESULT; -pub const CRYPT_E_SIGNER_NOT_FOUND: HRESULT = 0x8009100Eu32 as HRESULT; -pub const CRYPT_E_ATTRIBUTES_MISSING: HRESULT = 0x8009100Fu32 as HRESULT; -pub const CRYPT_E_STREAM_MSG_NOT_READY: HRESULT = 0x80091010u32 as HRESULT; -pub const CRYPT_E_STREAM_INSUFFICIENT_DATA: HRESULT = 0x80091011u32 as HRESULT; -pub const CRYPT_I_NEW_PROTECTION_REQUIRED: HRESULT = 0x00091012; -pub const CRYPT_E_BAD_LEN: HRESULT = 0x80092001u32 as HRESULT; -pub const CRYPT_E_BAD_ENCODE: HRESULT = 0x80092002u32 as HRESULT; -pub const CRYPT_E_FILE_ERROR: HRESULT = 0x80092003u32 as HRESULT; -pub const CRYPT_E_NOT_FOUND: HRESULT = 0x80092004u32 as HRESULT; -pub const CRYPT_E_EXISTS: HRESULT = 0x80092005u32 as HRESULT; -pub const CRYPT_E_NO_PROVIDER: HRESULT = 0x80092006u32 as HRESULT; -pub const CRYPT_E_SELF_SIGNED: HRESULT = 0x80092007u32 as HRESULT; -pub const CRYPT_E_DELETED_PREV: HRESULT = 0x80092008u32 as HRESULT; -pub const CRYPT_E_NO_MATCH: HRESULT = 0x80092009u32 as HRESULT; -pub const CRYPT_E_UNEXPECTED_MSG_TYPE: HRESULT = 0x8009200Au32 as HRESULT; -pub const CRYPT_E_NO_KEY_PROPERTY: HRESULT = 0x8009200Bu32 as HRESULT; -pub const CRYPT_E_NO_DECRYPT_CERT: HRESULT = 0x8009200Cu32 as HRESULT; -pub const CRYPT_E_BAD_MSG: HRESULT = 0x8009200Du32 as HRESULT; -pub const CRYPT_E_NO_SIGNER: HRESULT = 0x8009200Eu32 as HRESULT; -pub const CRYPT_E_PENDING_CLOSE: HRESULT = 0x8009200Fu32 as HRESULT; -pub const CRYPT_E_REVOKED: HRESULT = 0x80092010u32 as HRESULT; -pub const CRYPT_E_NO_REVOCATION_DLL: HRESULT = 0x80092011u32 as HRESULT; -pub const CRYPT_E_NO_REVOCATION_CHECK: HRESULT = 0x80092012u32 as HRESULT; -pub const CRYPT_E_REVOCATION_OFFLINE: HRESULT = 0x80092013u32 as HRESULT; -pub const CRYPT_E_NOT_IN_REVOCATION_DATABASE: HRESULT = 0x80092014u32 as HRESULT; -pub const CRYPT_E_INVALID_NUMERIC_STRING: HRESULT = 0x80092020u32 as HRESULT; -pub const CRYPT_E_INVALID_PRINTABLE_STRING: HRESULT = 0x80092021u32 as HRESULT; -pub const CRYPT_E_INVALID_IA5_STRING: HRESULT = 0x80092022u32 as HRESULT; -pub const CRYPT_E_INVALID_X500_STRING: HRESULT = 0x80092023u32 as HRESULT; -pub const CRYPT_E_NOT_CHAR_STRING: HRESULT = 0x80092024u32 as HRESULT; -pub const CRYPT_E_FILERESIZED: HRESULT = 0x80092025u32 as HRESULT; -pub const CRYPT_E_SECURITY_SETTINGS: HRESULT = 0x80092026u32 as HRESULT; -pub const CRYPT_E_NO_VERIFY_USAGE_DLL: HRESULT = 0x80092027u32 as HRESULT; -pub const CRYPT_E_NO_VERIFY_USAGE_CHECK: HRESULT = 0x80092028u32 as HRESULT; -pub const CRYPT_E_VERIFY_USAGE_OFFLINE: HRESULT = 0x80092029u32 as HRESULT; -pub const CRYPT_E_NOT_IN_CTL: HRESULT = 0x8009202Au32 as HRESULT; -pub const CRYPT_E_NO_TRUSTED_SIGNER: HRESULT = 0x8009202Bu32 as HRESULT; -pub const CRYPT_E_MISSING_PUBKEY_PARA: HRESULT = 0x8009202Cu32 as HRESULT; -pub const CRYPT_E_OBJECT_LOCATOR_OBJECT_NOT_FOUND: HRESULT = 0x8009202Du32 as HRESULT; -pub const CRYPT_E_OSS_ERROR: HRESULT = 0x80093000u32 as HRESULT; -pub const OSS_MORE_BUF: HRESULT = 0x80093001u32 as HRESULT; -pub const OSS_NEGATIVE_UINTEGER: HRESULT = 0x80093002u32 as HRESULT; -pub const OSS_PDU_RANGE: HRESULT = 0x80093003u32 as HRESULT; -pub const OSS_MORE_INPUT: HRESULT = 0x80093004u32 as HRESULT; -pub const OSS_DATA_ERROR: HRESULT = 0x80093005u32 as HRESULT; -pub const OSS_BAD_ARG: HRESULT = 0x80093006u32 as HRESULT; -pub const OSS_BAD_VERSION: HRESULT = 0x80093007u32 as HRESULT; -pub const OSS_OUT_MEMORY: HRESULT = 0x80093008u32 as HRESULT; -pub const OSS_PDU_MISMATCH: HRESULT = 0x80093009u32 as HRESULT; -pub const OSS_LIMITED: HRESULT = 0x8009300Au32 as HRESULT; -pub const OSS_BAD_PTR: HRESULT = 0x8009300Bu32 as HRESULT; -pub const OSS_BAD_TIME: HRESULT = 0x8009300Cu32 as HRESULT; -pub const OSS_INDEFINITE_NOT_SUPPORTED: HRESULT = 0x8009300Du32 as HRESULT; -pub const OSS_MEM_ERROR: HRESULT = 0x8009300Eu32 as HRESULT; -pub const OSS_BAD_TABLE: HRESULT = 0x8009300Fu32 as HRESULT; -pub const OSS_TOO_LONG: HRESULT = 0x80093010u32 as HRESULT; -pub const OSS_CONSTRAINT_VIOLATED: HRESULT = 0x80093011u32 as HRESULT; -pub const OSS_FATAL_ERROR: HRESULT = 0x80093012u32 as HRESULT; -pub const OSS_ACCESS_SERIALIZATION_ERROR: HRESULT = 0x80093013u32 as HRESULT; -pub const OSS_NULL_TBL: HRESULT = 0x80093014u32 as HRESULT; -pub const OSS_NULL_FCN: HRESULT = 0x80093015u32 as HRESULT; -pub const OSS_BAD_ENCRULES: HRESULT = 0x80093016u32 as HRESULT; -pub const OSS_UNAVAIL_ENCRULES: HRESULT = 0x80093017u32 as HRESULT; -pub const OSS_CANT_OPEN_TRACE_WINDOW: HRESULT = 0x80093018u32 as HRESULT; -pub const OSS_UNIMPLEMENTED: HRESULT = 0x80093019u32 as HRESULT; -pub const OSS_OID_DLL_NOT_LINKED: HRESULT = 0x8009301Au32 as HRESULT; -pub const OSS_CANT_OPEN_TRACE_FILE: HRESULT = 0x8009301Bu32 as HRESULT; -pub const OSS_TRACE_FILE_ALREADY_OPEN: HRESULT = 0x8009301Cu32 as HRESULT; -pub const OSS_TABLE_MISMATCH: HRESULT = 0x8009301Du32 as HRESULT; -pub const OSS_TYPE_NOT_SUPPORTED: HRESULT = 0x8009301Eu32 as HRESULT; -pub const OSS_REAL_DLL_NOT_LINKED: HRESULT = 0x8009301Fu32 as HRESULT; -pub const OSS_REAL_CODE_NOT_LINKED: HRESULT = 0x80093020u32 as HRESULT; -pub const OSS_OUT_OF_RANGE: HRESULT = 0x80093021u32 as HRESULT; -pub const OSS_COPIER_DLL_NOT_LINKED: HRESULT = 0x80093022u32 as HRESULT; -pub const OSS_CONSTRAINT_DLL_NOT_LINKED: HRESULT = 0x80093023u32 as HRESULT; -pub const OSS_COMPARATOR_DLL_NOT_LINKED: HRESULT = 0x80093024u32 as HRESULT; -pub const OSS_COMPARATOR_CODE_NOT_LINKED: HRESULT = 0x80093025u32 as HRESULT; -pub const OSS_MEM_MGR_DLL_NOT_LINKED: HRESULT = 0x80093026u32 as HRESULT; -pub const OSS_PDV_DLL_NOT_LINKED: HRESULT = 0x80093027u32 as HRESULT; -pub const OSS_PDV_CODE_NOT_LINKED: HRESULT = 0x80093028u32 as HRESULT; -pub const OSS_API_DLL_NOT_LINKED: HRESULT = 0x80093029u32 as HRESULT; -pub const OSS_BERDER_DLL_NOT_LINKED: HRESULT = 0x8009302Au32 as HRESULT; -pub const OSS_PER_DLL_NOT_LINKED: HRESULT = 0x8009302Bu32 as HRESULT; -pub const OSS_OPEN_TYPE_ERROR: HRESULT = 0x8009302Cu32 as HRESULT; -pub const OSS_MUTEX_NOT_CREATED: HRESULT = 0x8009302Du32 as HRESULT; -pub const OSS_CANT_CLOSE_TRACE_FILE: HRESULT = 0x8009302Eu32 as HRESULT; -pub const CRYPT_E_ASN1_ERROR: HRESULT = 0x80093100u32 as HRESULT; -pub const CRYPT_E_ASN1_INTERNAL: HRESULT = 0x80093101u32 as HRESULT; -pub const CRYPT_E_ASN1_EOD: HRESULT = 0x80093102u32 as HRESULT; -pub const CRYPT_E_ASN1_CORRUPT: HRESULT = 0x80093103u32 as HRESULT; -pub const CRYPT_E_ASN1_LARGE: HRESULT = 0x80093104u32 as HRESULT; -pub const CRYPT_E_ASN1_CONSTRAINT: HRESULT = 0x80093105u32 as HRESULT; -pub const CRYPT_E_ASN1_MEMORY: HRESULT = 0x80093106u32 as HRESULT; -pub const CRYPT_E_ASN1_OVERFLOW: HRESULT = 0x80093107u32 as HRESULT; -pub const CRYPT_E_ASN1_BADPDU: HRESULT = 0x80093108u32 as HRESULT; -pub const CRYPT_E_ASN1_BADARGS: HRESULT = 0x80093109u32 as HRESULT; -pub const CRYPT_E_ASN1_BADREAL: HRESULT = 0x8009310Au32 as HRESULT; -pub const CRYPT_E_ASN1_BADTAG: HRESULT = 0x8009310Bu32 as HRESULT; -pub const CRYPT_E_ASN1_CHOICE: HRESULT = 0x8009310Cu32 as HRESULT; -pub const CRYPT_E_ASN1_RULE: HRESULT = 0x8009310Du32 as HRESULT; -pub const CRYPT_E_ASN1_UTF8: HRESULT = 0x8009310Eu32 as HRESULT; -pub const CRYPT_E_ASN1_PDU_TYPE: HRESULT = 0x80093133u32 as HRESULT; -pub const CRYPT_E_ASN1_NYI: HRESULT = 0x80093134u32 as HRESULT; -pub const CRYPT_E_ASN1_EXTENDED: HRESULT = 0x80093201u32 as HRESULT; -pub const CRYPT_E_ASN1_NOEOD: HRESULT = 0x80093202u32 as HRESULT; -pub const CERTSRV_E_BAD_REQUESTSUBJECT: HRESULT = 0x80094001u32 as HRESULT; -pub const CERTSRV_E_NO_REQUEST: HRESULT = 0x80094002u32 as HRESULT; -pub const CERTSRV_E_BAD_REQUESTSTATUS: HRESULT = 0x80094003u32 as HRESULT; -pub const CERTSRV_E_PROPERTY_EMPTY: HRESULT = 0x80094004u32 as HRESULT; -pub const CERTSRV_E_INVALID_CA_CERTIFICATE: HRESULT = 0x80094005u32 as HRESULT; -pub const CERTSRV_E_SERVER_SUSPENDED: HRESULT = 0x80094006u32 as HRESULT; -pub const CERTSRV_E_ENCODING_LENGTH: HRESULT = 0x80094007u32 as HRESULT; -pub const CERTSRV_E_ROLECONFLICT: HRESULT = 0x80094008u32 as HRESULT; -pub const CERTSRV_E_RESTRICTEDOFFICER: HRESULT = 0x80094009u32 as HRESULT; -pub const CERTSRV_E_KEY_ARCHIVAL_NOT_CONFIGURED: HRESULT = 0x8009400Au32 as HRESULT; -pub const CERTSRV_E_NO_VALID_KRA: HRESULT = 0x8009400Bu32 as HRESULT; -pub const CERTSRV_E_BAD_REQUEST_KEY_ARCHIVAL: HRESULT = 0x8009400Cu32 as HRESULT; -pub const CERTSRV_E_NO_CAADMIN_DEFINED: HRESULT = 0x8009400Du32 as HRESULT; -pub const CERTSRV_E_BAD_RENEWAL_CERT_ATTRIBUTE: HRESULT = 0x8009400Eu32 as HRESULT; -pub const CERTSRV_E_NO_DB_SESSIONS: HRESULT = 0x8009400Fu32 as HRESULT; -pub const CERTSRV_E_ALIGNMENT_FAULT: HRESULT = 0x80094010u32 as HRESULT; -pub const CERTSRV_E_ENROLL_DENIED: HRESULT = 0x80094011u32 as HRESULT; -pub const CERTSRV_E_TEMPLATE_DENIED: HRESULT = 0x80094012u32 as HRESULT; -pub const CERTSRV_E_DOWNLEVEL_DC_SSL_OR_UPGRADE: HRESULT = 0x80094013u32 as HRESULT; -pub const CERTSRV_E_ADMIN_DENIED_REQUEST: HRESULT = 0x80094014u32 as HRESULT; -pub const CERTSRV_E_NO_POLICY_SERVER: HRESULT = 0x80094015u32 as HRESULT; -pub const CERTSRV_E_WEAK_SIGNATURE_OR_KEY: HRESULT = 0x80094016u32 as HRESULT; -pub const CERTSRV_E_KEY_ATTESTATION_NOT_SUPPORTED: HRESULT = 0x80094017u32 as HRESULT; -pub const CERTSRV_E_ENCRYPTION_CERT_REQUIRED: HRESULT = 0x80094018u32 as HRESULT; -pub const CERTSRV_E_UNSUPPORTED_CERT_TYPE: HRESULT = 0x80094800u32 as HRESULT; -pub const CERTSRV_E_NO_CERT_TYPE: HRESULT = 0x80094801u32 as HRESULT; -pub const CERTSRV_E_TEMPLATE_CONFLICT: HRESULT = 0x80094802u32 as HRESULT; -pub const CERTSRV_E_SUBJECT_ALT_NAME_REQUIRED: HRESULT = 0x80094803u32 as HRESULT; -pub const CERTSRV_E_ARCHIVED_KEY_REQUIRED: HRESULT = 0x80094804u32 as HRESULT; -pub const CERTSRV_E_SMIME_REQUIRED: HRESULT = 0x80094805u32 as HRESULT; -pub const CERTSRV_E_BAD_RENEWAL_SUBJECT: HRESULT = 0x80094806u32 as HRESULT; -pub const CERTSRV_E_BAD_TEMPLATE_VERSION: HRESULT = 0x80094807u32 as HRESULT; -pub const CERTSRV_E_TEMPLATE_POLICY_REQUIRED: HRESULT = 0x80094808u32 as HRESULT; -pub const CERTSRV_E_SIGNATURE_POLICY_REQUIRED: HRESULT = 0x80094809u32 as HRESULT; -pub const CERTSRV_E_SIGNATURE_COUNT: HRESULT = 0x8009480Au32 as HRESULT; -pub const CERTSRV_E_SIGNATURE_REJECTED: HRESULT = 0x8009480Bu32 as HRESULT; -pub const CERTSRV_E_ISSUANCE_POLICY_REQUIRED: HRESULT = 0x8009480Cu32 as HRESULT; -pub const CERTSRV_E_SUBJECT_UPN_REQUIRED: HRESULT = 0x8009480Du32 as HRESULT; -pub const CERTSRV_E_SUBJECT_DIRECTORY_GUID_REQUIRED: HRESULT = 0x8009480Eu32 as HRESULT; -pub const CERTSRV_E_SUBJECT_DNS_REQUIRED: HRESULT = 0x8009480Fu32 as HRESULT; -pub const CERTSRV_E_ARCHIVED_KEY_UNEXPECTED: HRESULT = 0x80094810u32 as HRESULT; -pub const CERTSRV_E_KEY_LENGTH: HRESULT = 0x80094811u32 as HRESULT; -pub const CERTSRV_E_SUBJECT_EMAIL_REQUIRED: HRESULT = 0x80094812u32 as HRESULT; -pub const CERTSRV_E_UNKNOWN_CERT_TYPE: HRESULT = 0x80094813u32 as HRESULT; -pub const CERTSRV_E_CERT_TYPE_OVERLAP: HRESULT = 0x80094814u32 as HRESULT; -pub const CERTSRV_E_TOO_MANY_SIGNATURES: HRESULT = 0x80094815u32 as HRESULT; -pub const CERTSRV_E_RENEWAL_BAD_PUBLIC_KEY: HRESULT = 0x80094816u32 as HRESULT; -pub const CERTSRV_E_INVALID_EK: HRESULT = 0x80094817u32 as HRESULT; -pub const CERTSRV_E_INVALID_IDBINDING: HRESULT = 0x80094818u32 as HRESULT; -pub const CERTSRV_E_INVALID_ATTESTATION: HRESULT = 0x80094819u32 as HRESULT; -pub const CERTSRV_E_KEY_ATTESTATION: HRESULT = 0x8009481Au32 as HRESULT; -pub const CERTSRV_E_CORRUPT_KEY_ATTESTATION: HRESULT = 0x8009481Bu32 as HRESULT; -pub const CERTSRV_E_EXPIRED_CHALLENGE: HRESULT = 0x8009481Cu32 as HRESULT; -pub const CERTSRV_E_INVALID_RESPONSE: HRESULT = 0x8009481Du32 as HRESULT; -pub const CERTSRV_E_INVALID_REQUESTID: HRESULT = 0x8009481Eu32 as HRESULT; -pub const XENROLL_E_KEY_NOT_EXPORTABLE: HRESULT = 0x80095000u32 as HRESULT; -pub const XENROLL_E_CANNOT_ADD_ROOT_CERT: HRESULT = 0x80095001u32 as HRESULT; -pub const XENROLL_E_RESPONSE_KA_HASH_NOT_FOUND: HRESULT = 0x80095002u32 as HRESULT; -pub const XENROLL_E_RESPONSE_UNEXPECTED_KA_HASH: HRESULT = 0x80095003u32 as HRESULT; -pub const XENROLL_E_RESPONSE_KA_HASH_MISMATCH: HRESULT = 0x80095004u32 as HRESULT; -pub const XENROLL_E_KEYSPEC_SMIME_MISMATCH: HRESULT = 0x80095005u32 as HRESULT; -pub const TRUST_E_SYSTEM_ERROR: HRESULT = 0x80096001u32 as HRESULT; -pub const TRUST_E_NO_SIGNER_CERT: HRESULT = 0x80096002u32 as HRESULT; -pub const TRUST_E_COUNTER_SIGNER: HRESULT = 0x80096003u32 as HRESULT; -pub const TRUST_E_CERT_SIGNATURE: HRESULT = 0x80096004u32 as HRESULT; -pub const TRUST_E_TIME_STAMP: HRESULT = 0x80096005u32 as HRESULT; -pub const TRUST_E_BAD_DIGEST: HRESULT = 0x80096010u32 as HRESULT; -pub const TRUST_E_BASIC_CONSTRAINTS: HRESULT = 0x80096019u32 as HRESULT; -pub const TRUST_E_FINANCIAL_CRITERIA: HRESULT = 0x8009601Eu32 as HRESULT; -pub const MSSIPOTF_E_OUTOFMEMRANGE: HRESULT = 0x80097001u32 as HRESULT; -pub const MSSIPOTF_E_CANTGETOBJECT: HRESULT = 0x80097002u32 as HRESULT; -pub const MSSIPOTF_E_NOHEADTABLE: HRESULT = 0x80097003u32 as HRESULT; -pub const MSSIPOTF_E_BAD_MAGICNUMBER: HRESULT = 0x80097004u32 as HRESULT; -pub const MSSIPOTF_E_BAD_OFFSET_TABLE: HRESULT = 0x80097005u32 as HRESULT; -pub const MSSIPOTF_E_TABLE_TAGORDER: HRESULT = 0x80097006u32 as HRESULT; -pub const MSSIPOTF_E_TABLE_LONGWORD: HRESULT = 0x80097007u32 as HRESULT; -pub const MSSIPOTF_E_BAD_FIRST_TABLE_PLACEMENT: HRESULT = 0x80097008u32 as HRESULT; -pub const MSSIPOTF_E_TABLES_OVERLAP: HRESULT = 0x80097009u32 as HRESULT; -pub const MSSIPOTF_E_TABLE_PADBYTES: HRESULT = 0x8009700Au32 as HRESULT; -pub const MSSIPOTF_E_FILETOOSMALL: HRESULT = 0x8009700Bu32 as HRESULT; -pub const MSSIPOTF_E_TABLE_CHECKSUM: HRESULT = 0x8009700Cu32 as HRESULT; -pub const MSSIPOTF_E_FILE_CHECKSUM: HRESULT = 0x8009700Du32 as HRESULT; -pub const MSSIPOTF_E_FAILED_POLICY: HRESULT = 0x80097010u32 as HRESULT; -pub const MSSIPOTF_E_FAILED_HINTS_CHECK: HRESULT = 0x80097011u32 as HRESULT; -pub const MSSIPOTF_E_NOT_OPENTYPE: HRESULT = 0x80097012u32 as HRESULT; -pub const MSSIPOTF_E_FILE: HRESULT = 0x80097013u32 as HRESULT; -pub const MSSIPOTF_E_CRYPT: HRESULT = 0x80097014u32 as HRESULT; -pub const MSSIPOTF_E_BADVERSION: HRESULT = 0x80097015u32 as HRESULT; -pub const MSSIPOTF_E_DSIG_STRUCTURE: HRESULT = 0x80097016u32 as HRESULT; -pub const MSSIPOTF_E_PCONST_CHECK: HRESULT = 0x80097017u32 as HRESULT; -pub const MSSIPOTF_E_STRUCTURE: HRESULT = 0x80097018u32 as HRESULT; -pub const ERROR_CRED_REQUIRES_CONFIRMATION: HRESULT = 0x80097019u32 as HRESULT; -pub const NTE_OP_OK: HRESULT = 0; -pub const TRUST_E_PROVIDER_UNKNOWN: HRESULT = 0x800B0001u32 as HRESULT; -pub const TRUST_E_ACTION_UNKNOWN: HRESULT = 0x800B0002u32 as HRESULT; -pub const TRUST_E_SUBJECT_FORM_UNKNOWN: HRESULT = 0x800B0003u32 as HRESULT; -pub const TRUST_E_SUBJECT_NOT_TRUSTED: HRESULT = 0x800B0004u32 as HRESULT; -pub const DIGSIG_E_ENCODE: HRESULT = 0x800B0005u32 as HRESULT; -pub const DIGSIG_E_DECODE: HRESULT = 0x800B0006u32 as HRESULT; -pub const DIGSIG_E_EXTENSIBILITY: HRESULT = 0x800B0007u32 as HRESULT; -pub const DIGSIG_E_CRYPTO: HRESULT = 0x800B0008u32 as HRESULT; -pub const PERSIST_E_SIZEDEFINITE: HRESULT = 0x800B0009u32 as HRESULT; -pub const PERSIST_E_SIZEINDEFINITE: HRESULT = 0x800B000Au32 as HRESULT; -pub const PERSIST_E_NOTSELFSIZING: HRESULT = 0x800B000Bu32 as HRESULT; -pub const TRUST_E_NOSIGNATURE: HRESULT = 0x800B0100u32 as HRESULT; -pub const CERT_E_EXPIRED: HRESULT = 0x800B0101u32 as HRESULT; -pub const CERT_E_VALIDITYPERIODNESTING: HRESULT = 0x800B0102u32 as HRESULT; -pub const CERT_E_ROLE: HRESULT = 0x800B0103u32 as HRESULT; -pub const CERT_E_PATHLENCONST: HRESULT = 0x800B0104u32 as HRESULT; -pub const CERT_E_CRITICAL: HRESULT = 0x800B0105u32 as HRESULT; -pub const CERT_E_PURPOSE: HRESULT = 0x800B0106u32 as HRESULT; -pub const CERT_E_ISSUERCHAINING: HRESULT = 0x800B0107u32 as HRESULT; -pub const CERT_E_MALFORMED: HRESULT = 0x800B0108u32 as HRESULT; -pub const CERT_E_UNTRUSTEDROOT: HRESULT = 0x800B0109u32 as HRESULT; -pub const CERT_E_CHAINING: HRESULT = 0x800B010Au32 as HRESULT; -pub const TRUST_E_FAIL: HRESULT = 0x800B010Bu32 as HRESULT; -pub const CERT_E_REVOKED: HRESULT = 0x800B010Cu32 as HRESULT; -pub const CERT_E_UNTRUSTEDTESTROOT: HRESULT = 0x800B010Du32 as HRESULT; -pub const CERT_E_REVOCATION_FAILURE: HRESULT = 0x800B010Eu32 as HRESULT; -pub const CERT_E_CN_NO_MATCH: HRESULT = 0x800B010Fu32 as HRESULT; -pub const CERT_E_WRONG_USAGE: HRESULT = 0x800B0110u32 as HRESULT; -pub const TRUST_E_EXPLICIT_DISTRUST: HRESULT = 0x800B0111u32 as HRESULT; -pub const CERT_E_UNTRUSTEDCA: HRESULT = 0x800B0112u32 as HRESULT; -pub const CERT_E_INVALID_POLICY: HRESULT = 0x800B0113u32 as HRESULT; -pub const CERT_E_INVALID_NAME: HRESULT = 0x800B0114u32 as HRESULT; -pub const SPAPI_E_EXPECTED_SECTION_NAME: HRESULT = 0x800F0000u32 as HRESULT; -pub const SPAPI_E_BAD_SECTION_NAME_LINE: HRESULT = 0x800F0001u32 as HRESULT; -pub const SPAPI_E_SECTION_NAME_TOO_LONG: HRESULT = 0x800F0002u32 as HRESULT; -pub const SPAPI_E_GENERAL_SYNTAX: HRESULT = 0x800F0003u32 as HRESULT; -pub const SPAPI_E_WRONG_INF_STYLE: HRESULT = 0x800F0100u32 as HRESULT; -pub const SPAPI_E_SECTION_NOT_FOUND: HRESULT = 0x800F0101u32 as HRESULT; -pub const SPAPI_E_LINE_NOT_FOUND: HRESULT = 0x800F0102u32 as HRESULT; -pub const SPAPI_E_NO_BACKUP: HRESULT = 0x800F0103u32 as HRESULT; -pub const SPAPI_E_NO_ASSOCIATED_CLASS: HRESULT = 0x800F0200u32 as HRESULT; -pub const SPAPI_E_CLASS_MISMATCH: HRESULT = 0x800F0201u32 as HRESULT; -pub const SPAPI_E_DUPLICATE_FOUND: HRESULT = 0x800F0202u32 as HRESULT; -pub const SPAPI_E_NO_DRIVER_SELECTED: HRESULT = 0x800F0203u32 as HRESULT; -pub const SPAPI_E_KEY_DOES_NOT_EXIST: HRESULT = 0x800F0204u32 as HRESULT; -pub const SPAPI_E_INVALID_DEVINST_NAME: HRESULT = 0x800F0205u32 as HRESULT; -pub const SPAPI_E_INVALID_CLASS: HRESULT = 0x800F0206u32 as HRESULT; -pub const SPAPI_E_DEVINST_ALREADY_EXISTS: HRESULT = 0x800F0207u32 as HRESULT; -pub const SPAPI_E_DEVINFO_NOT_REGISTERED: HRESULT = 0x800F0208u32 as HRESULT; -pub const SPAPI_E_INVALID_REG_PROPERTY: HRESULT = 0x800F0209u32 as HRESULT; -pub const SPAPI_E_NO_INF: HRESULT = 0x800F020Au32 as HRESULT; -pub const SPAPI_E_NO_SUCH_DEVINST: HRESULT = 0x800F020Bu32 as HRESULT; -pub const SPAPI_E_CANT_LOAD_CLASS_ICON: HRESULT = 0x800F020Cu32 as HRESULT; -pub const SPAPI_E_INVALID_CLASS_INSTALLER: HRESULT = 0x800F020Du32 as HRESULT; -pub const SPAPI_E_DI_DO_DEFAULT: HRESULT = 0x800F020Eu32 as HRESULT; -pub const SPAPI_E_DI_NOFILECOPY: HRESULT = 0x800F020Fu32 as HRESULT; -pub const SPAPI_E_INVALID_HWPROFILE: HRESULT = 0x800F0210u32 as HRESULT; -pub const SPAPI_E_NO_DEVICE_SELECTED: HRESULT = 0x800F0211u32 as HRESULT; -pub const SPAPI_E_DEVINFO_LIST_LOCKED: HRESULT = 0x800F0212u32 as HRESULT; -pub const SPAPI_E_DEVINFO_DATA_LOCKED: HRESULT = 0x800F0213u32 as HRESULT; -pub const SPAPI_E_DI_BAD_PATH: HRESULT = 0x800F0214u32 as HRESULT; -pub const SPAPI_E_NO_CLASSINSTALL_PARAMS: HRESULT = 0x800F0215u32 as HRESULT; -pub const SPAPI_E_FILEQUEUE_LOCKED: HRESULT = 0x800F0216u32 as HRESULT; -pub const SPAPI_E_BAD_SERVICE_INSTALLSECT: HRESULT = 0x800F0217u32 as HRESULT; -pub const SPAPI_E_NO_CLASS_DRIVER_LIST: HRESULT = 0x800F0218u32 as HRESULT; -pub const SPAPI_E_NO_ASSOCIATED_SERVICE: HRESULT = 0x800F0219u32 as HRESULT; -pub const SPAPI_E_NO_DEFAULT_DEVICE_INTERFACE: HRESULT = 0x800F021Au32 as HRESULT; -pub const SPAPI_E_DEVICE_INTERFACE_ACTIVE: HRESULT = 0x800F021Bu32 as HRESULT; -pub const SPAPI_E_DEVICE_INTERFACE_REMOVED: HRESULT = 0x800F021Cu32 as HRESULT; -pub const SPAPI_E_BAD_INTERFACE_INSTALLSECT: HRESULT = 0x800F021Du32 as HRESULT; -pub const SPAPI_E_NO_SUCH_INTERFACE_CLASS: HRESULT = 0x800F021Eu32 as HRESULT; -pub const SPAPI_E_INVALID_REFERENCE_STRING: HRESULT = 0x800F021Fu32 as HRESULT; -pub const SPAPI_E_INVALID_MACHINENAME: HRESULT = 0x800F0220u32 as HRESULT; -pub const SPAPI_E_REMOTE_COMM_FAILURE: HRESULT = 0x800F0221u32 as HRESULT; -pub const SPAPI_E_MACHINE_UNAVAILABLE: HRESULT = 0x800F0222u32 as HRESULT; -pub const SPAPI_E_NO_CONFIGMGR_SERVICES: HRESULT = 0x800F0223u32 as HRESULT; -pub const SPAPI_E_INVALID_PROPPAGE_PROVIDER: HRESULT = 0x800F0224u32 as HRESULT; -pub const SPAPI_E_NO_SUCH_DEVICE_INTERFACE: HRESULT = 0x800F0225u32 as HRESULT; -pub const SPAPI_E_DI_POSTPROCESSING_REQUIRED: HRESULT = 0x800F0226u32 as HRESULT; -pub const SPAPI_E_INVALID_COINSTALLER: HRESULT = 0x800F0227u32 as HRESULT; -pub const SPAPI_E_NO_COMPAT_DRIVERS: HRESULT = 0x800F0228u32 as HRESULT; -pub const SPAPI_E_NO_DEVICE_ICON: HRESULT = 0x800F0229u32 as HRESULT; -pub const SPAPI_E_INVALID_INF_LOGCONFIG: HRESULT = 0x800F022Au32 as HRESULT; -pub const SPAPI_E_DI_DONT_INSTALL: HRESULT = 0x800F022Bu32 as HRESULT; -pub const SPAPI_E_INVALID_FILTER_DRIVER: HRESULT = 0x800F022Cu32 as HRESULT; -pub const SPAPI_E_NON_WINDOWS_NT_DRIVER: HRESULT = 0x800F022Du32 as HRESULT; -pub const SPAPI_E_NON_WINDOWS_DRIVER: HRESULT = 0x800F022Eu32 as HRESULT; -pub const SPAPI_E_NO_CATALOG_FOR_OEM_INF: HRESULT = 0x800F022Fu32 as HRESULT; -pub const SPAPI_E_DEVINSTALL_QUEUE_NONNATIVE: HRESULT = 0x800F0230u32 as HRESULT; -pub const SPAPI_E_NOT_DISABLEABLE: HRESULT = 0x800F0231u32 as HRESULT; -pub const SPAPI_E_CANT_REMOVE_DEVINST: HRESULT = 0x800F0232u32 as HRESULT; -pub const SPAPI_E_INVALID_TARGET: HRESULT = 0x800F0233u32 as HRESULT; -pub const SPAPI_E_DRIVER_NONNATIVE: HRESULT = 0x800F0234u32 as HRESULT; -pub const SPAPI_E_IN_WOW64: HRESULT = 0x800F0235u32 as HRESULT; -pub const SPAPI_E_SET_SYSTEM_RESTORE_POINT: HRESULT = 0x800F0236u32 as HRESULT; -pub const SPAPI_E_INCORRECTLY_COPIED_INF: HRESULT = 0x800F0237u32 as HRESULT; -pub const SPAPI_E_SCE_DISABLED: HRESULT = 0x800F0238u32 as HRESULT; -pub const SPAPI_E_UNKNOWN_EXCEPTION: HRESULT = 0x800F0239u32 as HRESULT; -pub const SPAPI_E_PNP_REGISTRY_ERROR: HRESULT = 0x800F023Au32 as HRESULT; -pub const SPAPI_E_REMOTE_REQUEST_UNSUPPORTED: HRESULT = 0x800F023Bu32 as HRESULT; -pub const SPAPI_E_NOT_AN_INSTALLED_OEM_INF: HRESULT = 0x800F023Cu32 as HRESULT; -pub const SPAPI_E_INF_IN_USE_BY_DEVICES: HRESULT = 0x800F023Du32 as HRESULT; -pub const SPAPI_E_DI_FUNCTION_OBSOLETE: HRESULT = 0x800F023Eu32 as HRESULT; -pub const SPAPI_E_NO_AUTHENTICODE_CATALOG: HRESULT = 0x800F023Fu32 as HRESULT; -pub const SPAPI_E_AUTHENTICODE_DISALLOWED: HRESULT = 0x800F0240u32 as HRESULT; -pub const SPAPI_E_AUTHENTICODE_TRUSTED_PUBLISHER: HRESULT = 0x800F0241u32 as HRESULT; -pub const SPAPI_E_AUTHENTICODE_TRUST_NOT_ESTABLISHED: HRESULT = 0x800F0242u32 as HRESULT; -pub const SPAPI_E_AUTHENTICODE_PUBLISHER_NOT_TRUSTED: HRESULT = 0x800F0243u32 as HRESULT; -pub const SPAPI_E_SIGNATURE_OSATTRIBUTE_MISMATCH: HRESULT = 0x800F0244u32 as HRESULT; -pub const SPAPI_E_ONLY_VALIDATE_VIA_AUTHENTICODE: HRESULT = 0x800F0245u32 as HRESULT; -pub const SPAPI_E_DEVICE_INSTALLER_NOT_READY: HRESULT = 0x800F0246u32 as HRESULT; -pub const SPAPI_E_DRIVER_STORE_ADD_FAILED: HRESULT = 0x800F0247u32 as HRESULT; -pub const SPAPI_E_DEVICE_INSTALL_BLOCKED: HRESULT = 0x800F0248u32 as HRESULT; -pub const SPAPI_E_DRIVER_INSTALL_BLOCKED: HRESULT = 0x800F0249u32 as HRESULT; -pub const SPAPI_E_WRONG_INF_TYPE: HRESULT = 0x800F024Au32 as HRESULT; -pub const SPAPI_E_FILE_HASH_NOT_IN_CATALOG: HRESULT = 0x800F024Bu32 as HRESULT; -pub const SPAPI_E_DRIVER_STORE_DELETE_FAILED: HRESULT = 0x800F024Cu32 as HRESULT; -pub const SPAPI_E_UNRECOVERABLE_STACK_OVERFLOW: HRESULT = 0x800F0300u32 as HRESULT; -pub const SPAPI_E_ERROR_NOT_INSTALLED: HRESULT = 0x800F1000u32 as HRESULT; -pub const SCARD_S_SUCCESS: HRESULT = NO_ERROR as HRESULT; -pub const SCARD_F_INTERNAL_ERROR: HRESULT = 0x80100001u32 as HRESULT; -pub const SCARD_E_CANCELLED: HRESULT = 0x80100002u32 as HRESULT; -pub const SCARD_E_INVALID_HANDLE: HRESULT = 0x80100003u32 as HRESULT; -pub const SCARD_E_INVALID_PARAMETER: HRESULT = 0x80100004u32 as HRESULT; -pub const SCARD_E_INVALID_TARGET: HRESULT = 0x80100005u32 as HRESULT; -pub const SCARD_E_NO_MEMORY: HRESULT = 0x80100006u32 as HRESULT; -pub const SCARD_F_WAITED_TOO_LONG: HRESULT = 0x80100007u32 as HRESULT; -pub const SCARD_E_INSUFFICIENT_BUFFER: HRESULT = 0x80100008u32 as HRESULT; -pub const SCARD_E_UNKNOWN_READER: HRESULT = 0x80100009u32 as HRESULT; -pub const SCARD_E_TIMEOUT: HRESULT = 0x8010000Au32 as HRESULT; -pub const SCARD_E_SHARING_VIOLATION: HRESULT = 0x8010000Bu32 as HRESULT; -pub const SCARD_E_NO_SMARTCARD: HRESULT = 0x8010000Cu32 as HRESULT; -pub const SCARD_E_UNKNOWN_CARD: HRESULT = 0x8010000Du32 as HRESULT; -pub const SCARD_E_CANT_DISPOSE: HRESULT = 0x8010000Eu32 as HRESULT; -pub const SCARD_E_PROTO_MISMATCH: HRESULT = 0x8010000Fu32 as HRESULT; -pub const SCARD_E_NOT_READY: HRESULT = 0x80100010u32 as HRESULT; -pub const SCARD_E_INVALID_VALUE: HRESULT = 0x80100011u32 as HRESULT; -pub const SCARD_E_SYSTEM_CANCELLED: HRESULT = 0x80100012u32 as HRESULT; -pub const SCARD_F_COMM_ERROR: HRESULT = 0x80100013u32 as HRESULT; -pub const SCARD_F_UNKNOWN_ERROR: HRESULT = 0x80100014u32 as HRESULT; -pub const SCARD_E_INVALID_ATR: HRESULT = 0x80100015u32 as HRESULT; -pub const SCARD_E_NOT_TRANSACTED: HRESULT = 0x80100016u32 as HRESULT; -pub const SCARD_E_READER_UNAVAILABLE: HRESULT = 0x80100017u32 as HRESULT; -pub const SCARD_P_SHUTDOWN: HRESULT = 0x80100018u32 as HRESULT; -pub const SCARD_E_PCI_TOO_SMALL: HRESULT = 0x80100019u32 as HRESULT; -pub const SCARD_E_READER_UNSUPPORTED: HRESULT = 0x8010001Au32 as HRESULT; -pub const SCARD_E_DUPLICATE_READER: HRESULT = 0x8010001Bu32 as HRESULT; -pub const SCARD_E_CARD_UNSUPPORTED: HRESULT = 0x8010001Cu32 as HRESULT; -pub const SCARD_E_NO_SERVICE: HRESULT = 0x8010001Du32 as HRESULT; -pub const SCARD_E_SERVICE_STOPPED: HRESULT = 0x8010001Eu32 as HRESULT; -pub const SCARD_E_UNEXPECTED: HRESULT = 0x8010001Fu32 as HRESULT; -pub const SCARD_E_ICC_INSTALLATION: HRESULT = 0x80100020u32 as HRESULT; -pub const SCARD_E_ICC_CREATEORDER: HRESULT = 0x80100021u32 as HRESULT; -pub const SCARD_E_UNSUPPORTED_FEATURE: HRESULT = 0x80100022u32 as HRESULT; -pub const SCARD_E_DIR_NOT_FOUND: HRESULT = 0x80100023u32 as HRESULT; -pub const SCARD_E_FILE_NOT_FOUND: HRESULT = 0x80100024u32 as HRESULT; -pub const SCARD_E_NO_DIR: HRESULT = 0x80100025u32 as HRESULT; -pub const SCARD_E_NO_FILE: HRESULT = 0x80100026u32 as HRESULT; -pub const SCARD_E_NO_ACCESS: HRESULT = 0x80100027u32 as HRESULT; -pub const SCARD_E_WRITE_TOO_MANY: HRESULT = 0x80100028u32 as HRESULT; -pub const SCARD_E_BAD_SEEK: HRESULT = 0x80100029u32 as HRESULT; -pub const SCARD_E_INVALID_CHV: HRESULT = 0x8010002Au32 as HRESULT; -pub const SCARD_E_UNKNOWN_RES_MNG: HRESULT = 0x8010002Bu32 as HRESULT; -pub const SCARD_E_NO_SUCH_CERTIFICATE: HRESULT = 0x8010002Cu32 as HRESULT; -pub const SCARD_E_CERTIFICATE_UNAVAILABLE: HRESULT = 0x8010002Du32 as HRESULT; -pub const SCARD_E_NO_READERS_AVAILABLE: HRESULT = 0x8010002Eu32 as HRESULT; -pub const SCARD_E_COMM_DATA_LOST: HRESULT = 0x8010002Fu32 as HRESULT; -pub const SCARD_E_NO_KEY_CONTAINER: HRESULT = 0x80100030u32 as HRESULT; -pub const SCARD_E_SERVER_TOO_BUSY: HRESULT = 0x80100031u32 as HRESULT; -pub const SCARD_E_PIN_CACHE_EXPIRED: HRESULT = 0x80100032u32 as HRESULT; -pub const SCARD_E_NO_PIN_CACHE: HRESULT = 0x80100033u32 as HRESULT; -pub const SCARD_E_READ_ONLY_CARD: HRESULT = 0x80100034u32 as HRESULT; -pub const SCARD_W_UNSUPPORTED_CARD: HRESULT = 0x80100065u32 as HRESULT; -pub const SCARD_W_UNRESPONSIVE_CARD: HRESULT = 0x80100066u32 as HRESULT; -pub const SCARD_W_UNPOWERED_CARD: HRESULT = 0x80100067u32 as HRESULT; -pub const SCARD_W_RESET_CARD: HRESULT = 0x80100068u32 as HRESULT; -pub const SCARD_W_REMOVED_CARD: HRESULT = 0x80100069u32 as HRESULT; -pub const SCARD_W_SECURITY_VIOLATION: HRESULT = 0x8010006Au32 as HRESULT; -pub const SCARD_W_WRONG_CHV: HRESULT = 0x8010006Bu32 as HRESULT; -pub const SCARD_W_CHV_BLOCKED: HRESULT = 0x8010006Cu32 as HRESULT; -pub const SCARD_W_EOF: HRESULT = 0x8010006Du32 as HRESULT; -pub const SCARD_W_CANCELLED_BY_USER: HRESULT = 0x8010006Eu32 as HRESULT; -pub const SCARD_W_CARD_NOT_AUTHENTICATED: HRESULT = 0x8010006Fu32 as HRESULT; -pub const SCARD_W_CACHE_ITEM_NOT_FOUND: HRESULT = 0x80100070u32 as HRESULT; -pub const SCARD_W_CACHE_ITEM_STALE: HRESULT = 0x80100071u32 as HRESULT; -pub const SCARD_W_CACHE_ITEM_TOO_BIG: HRESULT = 0x80100072u32 as HRESULT; -pub const COMADMIN_E_OBJECTERRORS: HRESULT = 0x80110401u32 as HRESULT; -pub const COMADMIN_E_OBJECTINVALID: HRESULT = 0x80110402u32 as HRESULT; -pub const COMADMIN_E_KEYMISSING: HRESULT = 0x80110403u32 as HRESULT; -pub const COMADMIN_E_ALREADYINSTALLED: HRESULT = 0x80110404u32 as HRESULT; -pub const COMADMIN_E_APP_FILE_WRITEFAIL: HRESULT = 0x80110407u32 as HRESULT; -pub const COMADMIN_E_APP_FILE_READFAIL: HRESULT = 0x80110408u32 as HRESULT; -pub const COMADMIN_E_APP_FILE_VERSION: HRESULT = 0x80110409u32 as HRESULT; -pub const COMADMIN_E_BADPATH: HRESULT = 0x8011040Au32 as HRESULT; -pub const COMADMIN_E_APPLICATIONEXISTS: HRESULT = 0x8011040Bu32 as HRESULT; -pub const COMADMIN_E_ROLEEXISTS: HRESULT = 0x8011040Cu32 as HRESULT; -pub const COMADMIN_E_CANTCOPYFILE: HRESULT = 0x8011040Du32 as HRESULT; -pub const COMADMIN_E_NOUSER: HRESULT = 0x8011040Fu32 as HRESULT; -pub const COMADMIN_E_INVALIDUSERIDS: HRESULT = 0x80110410u32 as HRESULT; -pub const COMADMIN_E_NOREGISTRYCLSID: HRESULT = 0x80110411u32 as HRESULT; -pub const COMADMIN_E_BADREGISTRYPROGID: HRESULT = 0x80110412u32 as HRESULT; -pub const COMADMIN_E_AUTHENTICATIONLEVEL: HRESULT = 0x80110413u32 as HRESULT; -pub const COMADMIN_E_USERPASSWDNOTVALID: HRESULT = 0x80110414u32 as HRESULT; -pub const COMADMIN_E_CLSIDORIIDMISMATCH: HRESULT = 0x80110418u32 as HRESULT; -pub const COMADMIN_E_REMOTEINTERFACE: HRESULT = 0x80110419u32 as HRESULT; -pub const COMADMIN_E_DLLREGISTERSERVER: HRESULT = 0x8011041Au32 as HRESULT; -pub const COMADMIN_E_NOSERVERSHARE: HRESULT = 0x8011041Bu32 as HRESULT; -pub const COMADMIN_E_DLLLOADFAILED: HRESULT = 0x8011041Du32 as HRESULT; -pub const COMADMIN_E_BADREGISTRYLIBID: HRESULT = 0x8011041Eu32 as HRESULT; -pub const COMADMIN_E_APPDIRNOTFOUND: HRESULT = 0x8011041Fu32 as HRESULT; -pub const COMADMIN_E_REGISTRARFAILED: HRESULT = 0x80110423u32 as HRESULT; -pub const COMADMIN_E_COMPFILE_DOESNOTEXIST: HRESULT = 0x80110424u32 as HRESULT; -pub const COMADMIN_E_COMPFILE_LOADDLLFAIL: HRESULT = 0x80110425u32 as HRESULT; -pub const COMADMIN_E_COMPFILE_GETCLASSOBJ: HRESULT = 0x80110426u32 as HRESULT; -pub const COMADMIN_E_COMPFILE_CLASSNOTAVAIL: HRESULT = 0x80110427u32 as HRESULT; -pub const COMADMIN_E_COMPFILE_BADTLB: HRESULT = 0x80110428u32 as HRESULT; -pub const COMADMIN_E_COMPFILE_NOTINSTALLABLE: HRESULT = 0x80110429u32 as HRESULT; -pub const COMADMIN_E_NOTCHANGEABLE: HRESULT = 0x8011042Au32 as HRESULT; -pub const COMADMIN_E_NOTDELETEABLE: HRESULT = 0x8011042Bu32 as HRESULT; -pub const COMADMIN_E_SESSION: HRESULT = 0x8011042Cu32 as HRESULT; -pub const COMADMIN_E_COMP_MOVE_LOCKED: HRESULT = 0x8011042Du32 as HRESULT; -pub const COMADMIN_E_COMP_MOVE_BAD_DEST: HRESULT = 0x8011042Eu32 as HRESULT; -pub const COMADMIN_E_REGISTERTLB: HRESULT = 0x80110430u32 as HRESULT; -pub const COMADMIN_E_SYSTEMAPP: HRESULT = 0x80110433u32 as HRESULT; -pub const COMADMIN_E_COMPFILE_NOREGISTRAR: HRESULT = 0x80110434u32 as HRESULT; -pub const COMADMIN_E_COREQCOMPINSTALLED: HRESULT = 0x80110435u32 as HRESULT; -pub const COMADMIN_E_SERVICENOTINSTALLED: HRESULT = 0x80110436u32 as HRESULT; -pub const COMADMIN_E_PROPERTYSAVEFAILED: HRESULT = 0x80110437u32 as HRESULT; -pub const COMADMIN_E_OBJECTEXISTS: HRESULT = 0x80110438u32 as HRESULT; -pub const COMADMIN_E_COMPONENTEXISTS: HRESULT = 0x80110439u32 as HRESULT; -pub const COMADMIN_E_REGFILE_CORRUPT: HRESULT = 0x8011043Bu32 as HRESULT; -pub const COMADMIN_E_PROPERTY_OVERFLOW: HRESULT = 0x8011043Cu32 as HRESULT; -pub const COMADMIN_E_NOTINREGISTRY: HRESULT = 0x8011043Eu32 as HRESULT; -pub const COMADMIN_E_OBJECTNOTPOOLABLE: HRESULT = 0x8011043Fu32 as HRESULT; -pub const COMADMIN_E_APPLID_MATCHES_CLSID: HRESULT = 0x80110446u32 as HRESULT; -pub const COMADMIN_E_ROLE_DOES_NOT_EXIST: HRESULT = 0x80110447u32 as HRESULT; -pub const COMADMIN_E_START_APP_NEEDS_COMPONENTS: HRESULT = 0x80110448u32 as HRESULT; -pub const COMADMIN_E_REQUIRES_DIFFERENT_PLATFORM: HRESULT = 0x80110449u32 as HRESULT; -pub const COMADMIN_E_CAN_NOT_EXPORT_APP_PROXY: HRESULT = 0x8011044Au32 as HRESULT; -pub const COMADMIN_E_CAN_NOT_START_APP: HRESULT = 0x8011044Bu32 as HRESULT; -pub const COMADMIN_E_CAN_NOT_EXPORT_SYS_APP: HRESULT = 0x8011044Cu32 as HRESULT; -pub const COMADMIN_E_CANT_SUBSCRIBE_TO_COMPONENT: HRESULT = 0x8011044Du32 as HRESULT; -pub const COMADMIN_E_EVENTCLASS_CANT_BE_SUBSCRIBER: HRESULT = 0x8011044Eu32 as HRESULT; -pub const COMADMIN_E_LIB_APP_PROXY_INCOMPATIBLE: HRESULT = 0x8011044Fu32 as HRESULT; -pub const COMADMIN_E_BASE_PARTITION_ONLY: HRESULT = 0x80110450u32 as HRESULT; -pub const COMADMIN_E_START_APP_DISABLED: HRESULT = 0x80110451u32 as HRESULT; -pub const COMADMIN_E_CAT_DUPLICATE_PARTITION_NAME: HRESULT = 0x80110457u32 as HRESULT; -pub const COMADMIN_E_CAT_INVALID_PARTITION_NAME: HRESULT = 0x80110458u32 as HRESULT; -pub const COMADMIN_E_CAT_PARTITION_IN_USE: HRESULT = 0x80110459u32 as HRESULT; -pub const COMADMIN_E_FILE_PARTITION_DUPLICATE_FILES: HRESULT = 0x8011045Au32 as HRESULT; -pub const COMADMIN_E_CAT_IMPORTED_COMPONENTS_NOT_ALLOWED: HRESULT = 0x8011045Bu32 as HRESULT; -pub const COMADMIN_E_AMBIGUOUS_APPLICATION_NAME: HRESULT = 0x8011045Cu32 as HRESULT; -pub const COMADMIN_E_AMBIGUOUS_PARTITION_NAME: HRESULT = 0x8011045Du32 as HRESULT; -pub const COMADMIN_E_REGDB_NOTINITIALIZED: HRESULT = 0x80110472u32 as HRESULT; -pub const COMADMIN_E_REGDB_NOTOPEN: HRESULT = 0x80110473u32 as HRESULT; -pub const COMADMIN_E_REGDB_SYSTEMERR: HRESULT = 0x80110474u32 as HRESULT; -pub const COMADMIN_E_REGDB_ALREADYRUNNING: HRESULT = 0x80110475u32 as HRESULT; -pub const COMADMIN_E_MIG_VERSIONNOTSUPPORTED: HRESULT = 0x80110480u32 as HRESULT; -pub const COMADMIN_E_MIG_SCHEMANOTFOUND: HRESULT = 0x80110481u32 as HRESULT; -pub const COMADMIN_E_CAT_BITNESSMISMATCH: HRESULT = 0x80110482u32 as HRESULT; -pub const COMADMIN_E_CAT_UNACCEPTABLEBITNESS: HRESULT = 0x80110483u32 as HRESULT; -pub const COMADMIN_E_CAT_WRONGAPPBITNESS: HRESULT = 0x80110484u32 as HRESULT; -pub const COMADMIN_E_CAT_PAUSE_RESUME_NOT_SUPPORTED: HRESULT = 0x80110485u32 as HRESULT; -pub const COMADMIN_E_CAT_SERVERFAULT: HRESULT = 0x80110486u32 as HRESULT; -pub const COMQC_E_APPLICATION_NOT_QUEUED: HRESULT = 0x80110600u32 as HRESULT; -pub const COMQC_E_NO_QUEUEABLE_INTERFACES: HRESULT = 0x80110601u32 as HRESULT; -pub const COMQC_E_QUEUING_SERVICE_NOT_AVAILABLE: HRESULT = 0x80110602u32 as HRESULT; -pub const COMQC_E_NO_IPERSISTSTREAM: HRESULT = 0x80110603u32 as HRESULT; -pub const COMQC_E_BAD_MESSAGE: HRESULT = 0x80110604u32 as HRESULT; -pub const COMQC_E_UNAUTHENTICATED: HRESULT = 0x80110605u32 as HRESULT; -pub const COMQC_E_UNTRUSTED_ENQUEUER: HRESULT = 0x80110606u32 as HRESULT; -pub const MSDTC_E_DUPLICATE_RESOURCE: HRESULT = 0x80110701u32 as HRESULT; -pub const COMADMIN_E_OBJECT_PARENT_MISSING: HRESULT = 0x80110808u32 as HRESULT; -pub const COMADMIN_E_OBJECT_DOES_NOT_EXIST: HRESULT = 0x80110809u32 as HRESULT; -pub const COMADMIN_E_APP_NOT_RUNNING: HRESULT = 0x8011080Au32 as HRESULT; -pub const COMADMIN_E_INVALID_PARTITION: HRESULT = 0x8011080Bu32 as HRESULT; -pub const COMADMIN_E_SVCAPP_NOT_POOLABLE_OR_RECYCLABLE: HRESULT = 0x8011080Du32 as HRESULT; -pub const COMADMIN_E_USER_IN_SET: HRESULT = 0x8011080Eu32 as HRESULT; -pub const COMADMIN_E_CANTRECYCLELIBRARYAPPS: HRESULT = 0x8011080Fu32 as HRESULT; -pub const COMADMIN_E_CANTRECYCLESERVICEAPPS: HRESULT = 0x80110811u32 as HRESULT; -pub const COMADMIN_E_PROCESSALREADYRECYCLED: HRESULT = 0x80110812u32 as HRESULT; -pub const COMADMIN_E_PAUSEDPROCESSMAYNOTBERECYCLED: HRESULT = 0x80110813u32 as HRESULT; -pub const COMADMIN_E_CANTMAKEINPROCSERVICE: HRESULT = 0x80110814u32 as HRESULT; -pub const COMADMIN_E_PROGIDINUSEBYCLSID: HRESULT = 0x80110815u32 as HRESULT; -pub const COMADMIN_E_DEFAULT_PARTITION_NOT_IN_SET: HRESULT = 0x80110816u32 as HRESULT; -pub const COMADMIN_E_RECYCLEDPROCESSMAYNOTBEPAUSED: HRESULT = 0x80110817u32 as HRESULT; -pub const COMADMIN_E_PARTITION_ACCESSDENIED: HRESULT = 0x80110818u32 as HRESULT; -pub const COMADMIN_E_PARTITION_MSI_ONLY: HRESULT = 0x80110819u32 as HRESULT; -pub const COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_1_0_FORMAT: HRESULT = 0x8011081Au32 as HRESULT; -pub const COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_NONBASE_PARTITIONS: HRESULT = 0x8011081Bu32 as HRESULT; -pub const COMADMIN_E_COMP_MOVE_SOURCE: HRESULT = 0x8011081Cu32 as HRESULT; -pub const COMADMIN_E_COMP_MOVE_DEST: HRESULT = 0x8011081Du32 as HRESULT; -pub const COMADMIN_E_COMP_MOVE_PRIVATE: HRESULT = 0x8011081Eu32 as HRESULT; -pub const COMADMIN_E_BASEPARTITION_REQUIRED_IN_SET: HRESULT = 0x8011081Fu32 as HRESULT; -pub const COMADMIN_E_CANNOT_ALIAS_EVENTCLASS: HRESULT = 0x80110820u32 as HRESULT; -pub const COMADMIN_E_PRIVATE_ACCESSDENIED: HRESULT = 0x80110821u32 as HRESULT; -pub const COMADMIN_E_SAFERINVALID: HRESULT = 0x80110822u32 as HRESULT; -pub const COMADMIN_E_REGISTRY_ACCESSDENIED: HRESULT = 0x80110823u32 as HRESULT; -pub const COMADMIN_E_PARTITIONS_DISABLED: HRESULT = 0x80110824u32 as HRESULT; -pub const WER_S_REPORT_DEBUG: HRESULT = 0x001B0000; -pub const WER_S_REPORT_UPLOADED: HRESULT = 0x001B0001; -pub const WER_S_REPORT_QUEUED: HRESULT = 0x001B0002; -pub const WER_S_DISABLED: HRESULT = 0x001B0003; -pub const WER_S_SUSPENDED_UPLOAD: HRESULT = 0x001B0004; -pub const WER_S_DISABLED_QUEUE: HRESULT = 0x001B0005; -pub const WER_S_DISABLED_ARCHIVE: HRESULT = 0x001B0006; -pub const WER_S_REPORT_ASYNC: HRESULT = 0x001B0007; -pub const WER_S_IGNORE_ASSERT_INSTANCE: HRESULT = 0x001B0008; -pub const WER_S_IGNORE_ALL_ASSERTS: HRESULT = 0x001B0009; -pub const WER_S_ASSERT_CONTINUE: HRESULT = 0x001B000A; -pub const WER_S_THROTTLED: HRESULT = 0x001B000B; -pub const WER_E_CRASH_FAILURE: HRESULT = 0x801B8000u32 as HRESULT; -pub const WER_E_CANCELED: HRESULT = 0x801B8001u32 as HRESULT; -pub const WER_E_NETWORK_FAILURE: HRESULT = 0x801B8002u32 as HRESULT; -pub const WER_E_NOT_INITIALIZED: HRESULT = 0x801B8003u32 as HRESULT; -pub const WER_E_ALREADY_REPORTING: HRESULT = 0x801B8004u32 as HRESULT; -pub const WER_E_DUMP_THROTTLED: HRESULT = 0x801B8005u32 as HRESULT; -pub const ERROR_FLT_IO_COMPLETE: HRESULT = 0x001F0001; -pub const ERROR_FLT_NO_HANDLER_DEFINED: HRESULT = 0x801F0001u32 as HRESULT; -pub const ERROR_FLT_CONTEXT_ALREADY_DEFINED: HRESULT = 0x801F0002u32 as HRESULT; -pub const ERROR_FLT_INVALID_ASYNCHRONOUS_REQUEST: HRESULT = 0x801F0003u32 as HRESULT; -pub const ERROR_FLT_DISALLOW_FAST_IO: HRESULT = 0x801F0004u32 as HRESULT; -pub const ERROR_FLT_INVALID_NAME_REQUEST: HRESULT = 0x801F0005u32 as HRESULT; -pub const ERROR_FLT_NOT_SAFE_TO_POST_OPERATION: HRESULT = 0x801F0006u32 as HRESULT; -pub const ERROR_FLT_NOT_INITIALIZED: HRESULT = 0x801F0007u32 as HRESULT; -pub const ERROR_FLT_FILTER_NOT_READY: HRESULT = 0x801F0008u32 as HRESULT; -pub const ERROR_FLT_POST_OPERATION_CLEANUP: HRESULT = 0x801F0009u32 as HRESULT; -pub const ERROR_FLT_INTERNAL_ERROR: HRESULT = 0x801F000Au32 as HRESULT; -pub const ERROR_FLT_DELETING_OBJECT: HRESULT = 0x801F000Bu32 as HRESULT; -pub const ERROR_FLT_MUST_BE_NONPAGED_POOL: HRESULT = 0x801F000Cu32 as HRESULT; -pub const ERROR_FLT_DUPLICATE_ENTRY: HRESULT = 0x801F000Du32 as HRESULT; -pub const ERROR_FLT_CBDQ_DISABLED: HRESULT = 0x801F000Eu32 as HRESULT; -pub const ERROR_FLT_DO_NOT_ATTACH: HRESULT = 0x801F000Fu32 as HRESULT; -pub const ERROR_FLT_DO_NOT_DETACH: HRESULT = 0x801F0010u32 as HRESULT; -pub const ERROR_FLT_INSTANCE_ALTITUDE_COLLISION: HRESULT = 0x801F0011u32 as HRESULT; -pub const ERROR_FLT_INSTANCE_NAME_COLLISION: HRESULT = 0x801F0012u32 as HRESULT; -pub const ERROR_FLT_FILTER_NOT_FOUND: HRESULT = 0x801F0013u32 as HRESULT; -pub const ERROR_FLT_VOLUME_NOT_FOUND: HRESULT = 0x801F0014u32 as HRESULT; -pub const ERROR_FLT_INSTANCE_NOT_FOUND: HRESULT = 0x801F0015u32 as HRESULT; -pub const ERROR_FLT_CONTEXT_ALLOCATION_NOT_FOUND: HRESULT = 0x801F0016u32 as HRESULT; -pub const ERROR_FLT_INVALID_CONTEXT_REGISTRATION: HRESULT = 0x801F0017u32 as HRESULT; -pub const ERROR_FLT_NAME_CACHE_MISS: HRESULT = 0x801F0018u32 as HRESULT; -pub const ERROR_FLT_NO_DEVICE_OBJECT: HRESULT = 0x801F0019u32 as HRESULT; -pub const ERROR_FLT_VOLUME_ALREADY_MOUNTED: HRESULT = 0x801F001Au32 as HRESULT; -pub const ERROR_FLT_ALREADY_ENLISTED: HRESULT = 0x801F001Bu32 as HRESULT; -pub const ERROR_FLT_CONTEXT_ALREADY_LINKED: HRESULT = 0x801F001Cu32 as HRESULT; -pub const ERROR_FLT_NO_WAITER_FOR_REPLY: HRESULT = 0x801F0020u32 as HRESULT; -pub const ERROR_FLT_REGISTRATION_BUSY: HRESULT = 0x801F0023u32 as HRESULT; -pub const ERROR_HUNG_DISPLAY_DRIVER_THREAD: HRESULT = 0x80260001u32 as HRESULT; -pub const DWM_E_COMPOSITIONDISABLED: HRESULT = 0x80263001u32 as HRESULT; -pub const DWM_E_REMOTING_NOT_SUPPORTED: HRESULT = 0x80263002u32 as HRESULT; -pub const DWM_E_NO_REDIRECTION_SURFACE_AVAILABLE: HRESULT = 0x80263003u32 as HRESULT; -pub const DWM_E_NOT_QUEUING_PRESENTS: HRESULT = 0x80263004u32 as HRESULT; -pub const DWM_E_ADAPTER_NOT_FOUND: HRESULT = 0x80263005u32 as HRESULT; -pub const DWM_S_GDI_REDIRECTION_SURFACE: HRESULT = 0x00263005; -pub const DWM_E_TEXTURE_TOO_LARGE: HRESULT = 0x80263007u32 as HRESULT; -pub const ERROR_MONITOR_NO_DESCRIPTOR: HRESULT = 0x80261001u32 as HRESULT; -pub const ERROR_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT: HRESULT = 0x80261002u32 as HRESULT; -pub const ERROR_MONITOR_INVALID_DESCRIPTOR_CHECKSUM: HRESULT = 0xC0261003u32 as HRESULT; -pub const ERROR_MONITOR_INVALID_STANDARD_TIMING_BLOCK: HRESULT = 0xC0261004u32 as HRESULT; -pub const ERROR_MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED: HRESULT = 0xC0261005u32 as HRESULT; -pub const ERROR_MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK: HRESULT = 0xC0261006u32 as HRESULT; -pub const ERROR_MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK: HRESULT = 0xC0261007u32 as HRESULT; -pub const ERROR_MONITOR_NO_MORE_DESCRIPTOR_DATA: HRESULT = 0xC0261008u32 as HRESULT; -pub const ERROR_MONITOR_INVALID_DETAILED_TIMING_BLOCK: HRESULT = 0xC0261009u32 as HRESULT; -pub const ERROR_MONITOR_INVALID_MANUFACTURE_DATE: HRESULT = 0xC026100Au32 as HRESULT; -pub const ERROR_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER: HRESULT = 0xC0262000u32 as HRESULT; -pub const ERROR_GRAPHICS_INSUFFICIENT_DMA_BUFFER: HRESULT = 0xC0262001u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_DISPLAY_ADAPTER: HRESULT = 0xC0262002u32 as HRESULT; -pub const ERROR_GRAPHICS_ADAPTER_WAS_RESET: HRESULT = 0xC0262003u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_DRIVER_MODEL: HRESULT = 0xC0262004u32 as HRESULT; -pub const ERROR_GRAPHICS_PRESENT_MODE_CHANGED: HRESULT = 0xC0262005u32 as HRESULT; -pub const ERROR_GRAPHICS_PRESENT_OCCLUDED: HRESULT = 0xC0262006u32 as HRESULT; -pub const ERROR_GRAPHICS_PRESENT_DENIED: HRESULT = 0xC0262007u32 as HRESULT; -pub const ERROR_GRAPHICS_CANNOTCOLORCONVERT: HRESULT = 0xC0262008u32 as HRESULT; -pub const ERROR_GRAPHICS_DRIVER_MISMATCH: HRESULT = 0xC0262009u32 as HRESULT; -pub const ERROR_GRAPHICS_PARTIAL_DATA_POPULATED: HRESULT = 0x4026200A; -pub const ERROR_GRAPHICS_PRESENT_REDIRECTION_DISABLED: HRESULT = 0xC026200Bu32 as HRESULT; -pub const ERROR_GRAPHICS_PRESENT_UNOCCLUDED: HRESULT = 0xC026200Cu32 as HRESULT; -pub const ERROR_GRAPHICS_WINDOWDC_NOT_AVAILABLE: HRESULT = 0xC026200Du32 as HRESULT; -pub const ERROR_GRAPHICS_WINDOWLESS_PRESENT_DISABLED: HRESULT = 0xC026200Eu32 as HRESULT; -pub const ERROR_GRAPHICS_NO_VIDEO_MEMORY: HRESULT = 0xC0262100u32 as HRESULT; -pub const ERROR_GRAPHICS_CANT_LOCK_MEMORY: HRESULT = 0xC0262101u32 as HRESULT; -pub const ERROR_GRAPHICS_ALLOCATION_BUSY: HRESULT = 0xC0262102u32 as HRESULT; -pub const ERROR_GRAPHICS_TOO_MANY_REFERENCES: HRESULT = 0xC0262103u32 as HRESULT; -pub const ERROR_GRAPHICS_TRY_AGAIN_LATER: HRESULT = 0xC0262104u32 as HRESULT; -pub const ERROR_GRAPHICS_TRY_AGAIN_NOW: HRESULT = 0xC0262105u32 as HRESULT; -pub const ERROR_GRAPHICS_ALLOCATION_INVALID: HRESULT = 0xC0262106u32 as HRESULT; -pub const ERROR_GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE: HRESULT = 0xC0262107u32 as HRESULT; -pub const ERROR_GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED: HRESULT = 0xC0262108u32 as HRESULT; -pub const ERROR_GRAPHICS_CANT_EVICT_PINNED_ALLOCATION: HRESULT = 0xC0262109u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_ALLOCATION_USAGE: HRESULT = 0xC0262110u32 as HRESULT; -pub const ERROR_GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION: HRESULT = 0xC0262111u32 as HRESULT; -pub const ERROR_GRAPHICS_ALLOCATION_CLOSED: HRESULT = 0xC0262112u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_ALLOCATION_INSTANCE: HRESULT = 0xC0262113u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_ALLOCATION_HANDLE: HRESULT = 0xC0262114u32 as HRESULT; -pub const ERROR_GRAPHICS_WRONG_ALLOCATION_DEVICE: HRESULT = 0xC0262115u32 as HRESULT; -pub const ERROR_GRAPHICS_ALLOCATION_CONTENT_LOST: HRESULT = 0xC0262116u32 as HRESULT; -pub const ERROR_GRAPHICS_GPU_EXCEPTION_ON_DEVICE: HRESULT = 0xC0262200u32 as HRESULT; -pub const ERROR_GRAPHICS_SKIP_ALLOCATION_PREPARATION: HRESULT = 0x40262201; -pub const ERROR_GRAPHICS_INVALID_VIDPN_TOPOLOGY: HRESULT = 0xC0262300u32 as HRESULT; -pub const ERROR_GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED: HRESULT = 0xC0262301u32 as HRESULT; -pub const ERROR_GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED: HRESULT = 0xC0262302u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_VIDPN: HRESULT = 0xC0262303u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE: HRESULT = 0xC0262304u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET: HRESULT = 0xC0262305u32 as HRESULT; -pub const ERROR_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED: HRESULT = 0xC0262306u32 as HRESULT; -pub const ERROR_GRAPHICS_MODE_NOT_PINNED: HRESULT = 0x00262307; -pub const ERROR_GRAPHICS_INVALID_VIDPN_SOURCEMODESET: HRESULT = 0xC0262308u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_VIDPN_TARGETMODESET: HRESULT = 0xC0262309u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_FREQUENCY: HRESULT = 0xC026230Au32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_ACTIVE_REGION: HRESULT = 0xC026230Bu32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_TOTAL_REGION: HRESULT = 0xC026230Cu32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE: HRESULT = 0xC0262310u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE: HRESULT = 0xC0262311u32 as HRESULT; -pub const ERROR_GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET: HRESULT = 0xC0262312u32 as HRESULT; -pub const ERROR_GRAPHICS_PATH_ALREADY_IN_TOPOLOGY: HRESULT = 0xC0262313u32 as HRESULT; -pub const ERROR_GRAPHICS_MODE_ALREADY_IN_MODESET: HRESULT = 0xC0262314u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_VIDEOPRESENTSOURCESET: HRESULT = 0xC0262315u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_VIDEOPRESENTTARGETSET: HRESULT = 0xC0262316u32 as HRESULT; -pub const ERROR_GRAPHICS_SOURCE_ALREADY_IN_SET: HRESULT = 0xC0262317u32 as HRESULT; -pub const ERROR_GRAPHICS_TARGET_ALREADY_IN_SET: HRESULT = 0xC0262318u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_VIDPN_PRESENT_PATH: HRESULT = 0xC0262319u32 as HRESULT; -pub const ERROR_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY: HRESULT = 0xC026231Au32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET: HRESULT = 0xC026231Bu32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE: HRESULT = 0xC026231Cu32 as HRESULT; -pub const ERROR_GRAPHICS_FREQUENCYRANGE_NOT_IN_SET: HRESULT = 0xC026231Du32 as HRESULT; -pub const ERROR_GRAPHICS_NO_PREFERRED_MODE: HRESULT = 0x0026231E; -pub const ERROR_GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET: HRESULT = 0xC026231Fu32 as HRESULT; -pub const ERROR_GRAPHICS_STALE_MODESET: HRESULT = 0xC0262320u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_MONITOR_SOURCEMODESET: HRESULT = 0xC0262321u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_MONITOR_SOURCE_MODE: HRESULT = 0xC0262322u32 as HRESULT; -pub const ERROR_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN: HRESULT = 0xC0262323u32 as HRESULT; -pub const ERROR_GRAPHICS_MODE_ID_MUST_BE_UNIQUE: HRESULT = 0xC0262324u32 as HRESULT; -pub const ERROR_GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION: HRESULT = 0xC0262325u32 as HRESULT; -pub const ERROR_GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES: HRESULT = 0xC0262326u32 as HRESULT; -pub const ERROR_GRAPHICS_PATH_NOT_IN_TOPOLOGY: HRESULT = 0xC0262327u32 as HRESULT; -pub const ERROR_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE: HRESULT = 0xC0262328u32 as HRESULT; -pub const ERROR_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET: HRESULT = 0xC0262329u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_MONITORDESCRIPTORSET: HRESULT = 0xC026232Au32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_MONITORDESCRIPTOR: HRESULT = 0xC026232Bu32 as HRESULT; -pub const ERROR_GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET: HRESULT = 0xC026232Cu32 as HRESULT; -pub const ERROR_GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET: HRESULT = 0xC026232Du32 as HRESULT; -pub const ERROR_GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE: HRESULT = 0xC026232Eu32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE: HRESULT = 0xC026232Fu32 as HRESULT; -pub const ERROR_GRAPHICS_RESOURCES_NOT_RELATED: HRESULT = 0xC0262330u32 as HRESULT; -pub const ERROR_GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE: HRESULT = 0xC0262331u32 as HRESULT; -pub const ERROR_GRAPHICS_TARGET_ID_MUST_BE_UNIQUE: HRESULT = 0xC0262332u32 as HRESULT; -pub const ERROR_GRAPHICS_NO_AVAILABLE_VIDPN_TARGET: HRESULT = 0xC0262333u32 as HRESULT; -pub const ERROR_GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER: HRESULT = 0xC0262334u32 as HRESULT; -pub const ERROR_GRAPHICS_NO_VIDPNMGR: HRESULT = 0xC0262335u32 as HRESULT; -pub const ERROR_GRAPHICS_NO_ACTIVE_VIDPN: HRESULT = 0xC0262336u32 as HRESULT; -pub const ERROR_GRAPHICS_STALE_VIDPN_TOPOLOGY: HRESULT = 0xC0262337u32 as HRESULT; -pub const ERROR_GRAPHICS_MONITOR_NOT_CONNECTED: HRESULT = 0xC0262338u32 as HRESULT; -pub const ERROR_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY: HRESULT = 0xC0262339u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_PRIMARYSURFACE_SIZE: HRESULT = 0xC026233Au32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_VISIBLEREGION_SIZE: HRESULT = 0xC026233Bu32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_STRIDE: HRESULT = 0xC026233Cu32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_PIXELFORMAT: HRESULT = 0xC026233Du32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_COLORBASIS: HRESULT = 0xC026233Eu32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_PIXELVALUEACCESSMODE: HRESULT = 0xC026233Fu32 as HRESULT; -pub const ERROR_GRAPHICS_TARGET_NOT_IN_TOPOLOGY: HRESULT = 0xC0262340u32 as HRESULT; -pub const ERROR_GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT: HRESULT = 0xC0262341u32 as HRESULT; -pub const ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE: HRESULT = 0xC0262342u32 as HRESULT; -pub const ERROR_GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN: HRESULT = 0xC0262343u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL: HRESULT = 0xC0262344u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION: HRESULT = 0xC0262345u32 as HRESULT; -pub const ERROR_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED: HRESULT = 0xC0262346u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_GAMMA_RAMP: HRESULT = 0xC0262347u32 as HRESULT; -pub const ERROR_GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED: HRESULT = 0xC0262348u32 as HRESULT; -pub const ERROR_GRAPHICS_MULTISAMPLING_NOT_SUPPORTED: HRESULT = 0xC0262349u32 as HRESULT; -pub const ERROR_GRAPHICS_MODE_NOT_IN_MODESET: HRESULT = 0xC026234Au32 as HRESULT; -pub const ERROR_GRAPHICS_DATASET_IS_EMPTY: HRESULT = 0x0026234B; -pub const ERROR_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET: HRESULT = 0x0026234C; -pub const ERROR_GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON: HRESULT = 0xC026234Du32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_PATH_CONTENT_TYPE: HRESULT = 0xC026234Eu32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_COPYPROTECTION_TYPE: HRESULT = 0xC026234Fu32 as HRESULT; -pub const ERROR_GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS: HRESULT = 0xC0262350u32 as HRESULT; -pub const ERROR_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED: HRESULT = 0x00262351; -pub const ERROR_GRAPHICS_INVALID_SCANLINE_ORDERING: HRESULT = 0xC0262352u32 as HRESULT; -pub const ERROR_GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED: HRESULT = 0xC0262353u32 as HRESULT; -pub const ERROR_GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS: HRESULT = 0xC0262354u32 as HRESULT; -pub const ERROR_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT: HRESULT = 0xC0262355u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM: HRESULT = 0xC0262356u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN: HRESULT = 0xC0262357u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT: HRESULT = 0xC0262358u32 as HRESULT; -pub const ERROR_GRAPHICS_MAX_NUM_PATHS_REACHED: HRESULT = 0xC0262359u32 as HRESULT; -pub const ERROR_GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION: HRESULT = 0xC026235Au32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_CLIENT_TYPE: HRESULT = 0xC026235Bu32 as HRESULT; -pub const ERROR_GRAPHICS_CLIENTVIDPN_NOT_SET: HRESULT = 0xC026235Cu32 as HRESULT; -pub const ERROR_GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED: HRESULT = 0xC0262400u32 as HRESULT; -pub const ERROR_GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED: HRESULT = 0xC0262401u32 as HRESULT; -pub const ERROR_GRAPHICS_UNKNOWN_CHILD_STATUS: HRESULT = 0x4026242F; -pub const ERROR_GRAPHICS_NOT_A_LINKED_ADAPTER: HRESULT = 0xC0262430u32 as HRESULT; -pub const ERROR_GRAPHICS_LEADLINK_NOT_ENUMERATED: HRESULT = 0xC0262431u32 as HRESULT; -pub const ERROR_GRAPHICS_CHAINLINKS_NOT_ENUMERATED: HRESULT = 0xC0262432u32 as HRESULT; -pub const ERROR_GRAPHICS_ADAPTER_CHAIN_NOT_READY: HRESULT = 0xC0262433u32 as HRESULT; -pub const ERROR_GRAPHICS_CHAINLINKS_NOT_STARTED: HRESULT = 0xC0262434u32 as HRESULT; -pub const ERROR_GRAPHICS_CHAINLINKS_NOT_POWERED_ON: HRESULT = 0xC0262435u32 as HRESULT; -pub const ERROR_GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE: HRESULT = 0xC0262436u32 as HRESULT; -pub const ERROR_GRAPHICS_LEADLINK_START_DEFERRED: HRESULT = 0x40262437; -pub const ERROR_GRAPHICS_NOT_POST_DEVICE_DRIVER: HRESULT = 0xC0262438u32 as HRESULT; -pub const ERROR_GRAPHICS_POLLING_TOO_FREQUENTLY: HRESULT = 0x40262439; -pub const ERROR_GRAPHICS_START_DEFERRED: HRESULT = 0x4026243A; -pub const ERROR_GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED: HRESULT = 0xC026243Bu32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_NOT_SUPPORTED: HRESULT = 0xC0262500u32 as HRESULT; -pub const ERROR_GRAPHICS_COPP_NOT_SUPPORTED: HRESULT = 0xC0262501u32 as HRESULT; -pub const ERROR_GRAPHICS_UAB_NOT_SUPPORTED: HRESULT = 0xC0262502u32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS: HRESULT = 0xC0262503u32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_NO_VIDEO_OUTPUTS_EXIST: HRESULT = 0xC0262505u32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_INTERNAL_ERROR: HRESULT = 0xC026250Bu32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_INVALID_HANDLE: HRESULT = 0xC026250Cu32 as HRESULT; -pub const ERROR_GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH: HRESULT = 0xC026250Eu32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_SPANNING_MODE_ENABLED: HRESULT = 0xC026250Fu32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_THEATER_MODE_ENABLED: HRESULT = 0xC0262510u32 as HRESULT; -pub const ERROR_GRAPHICS_PVP_HFS_FAILED: HRESULT = 0xC0262511u32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_INVALID_SRM: HRESULT = 0xC0262512u32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP: HRESULT = 0xC0262513u32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP: HRESULT = 0xC0262514u32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA: HRESULT = 0xC0262515u32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_HDCP_SRM_NEVER_SET: HRESULT = 0xC0262516u32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_RESOLUTION_TOO_HIGH: HRESULT = 0xC0262517u32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE: HRESULT = 0xC0262518u32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_NO_LONGER_EXISTS: HRESULT = 0xC026251Au32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_SESSION_TYPE_CHANGE_IN_PROGRESS: HRESULT = 0xC026251Bu32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS: HRESULT = 0xC026251Cu32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_INVALID_INFORMATION_REQUEST: HRESULT = 0xC026251Du32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_DRIVER_INTERNAL_ERROR: HRESULT = 0xC026251Eu32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS: HRESULT = 0xC026251Fu32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED: HRESULT = 0xC0262520u32 as HRESULT; -pub const ERROR_GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST: HRESULT = 0xC0262521u32 as HRESULT; -pub const ERROR_GRAPHICS_I2C_NOT_SUPPORTED: HRESULT = 0xC0262580u32 as HRESULT; -pub const ERROR_GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST: HRESULT = 0xC0262581u32 as HRESULT; -pub const ERROR_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA: HRESULT = 0xC0262582u32 as HRESULT; -pub const ERROR_GRAPHICS_I2C_ERROR_RECEIVING_DATA: HRESULT = 0xC0262583u32 as HRESULT; -pub const ERROR_GRAPHICS_DDCCI_VCP_NOT_SUPPORTED: HRESULT = 0xC0262584u32 as HRESULT; -pub const ERROR_GRAPHICS_DDCCI_INVALID_DATA: HRESULT = 0xC0262585u32 as HRESULT; -pub const ERROR_GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE: HRESULT = 0xC0262586u32 as HRESULT; -pub const ERROR_GRAPHICS_MCA_INVALID_CAPABILITIES_STRING: HRESULT = 0xC0262587u32 as HRESULT; -pub const ERROR_GRAPHICS_MCA_INTERNAL_ERROR: HRESULT = 0xC0262588u32 as HRESULT; -pub const ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND: HRESULT = 0xC0262589u32 as HRESULT; -pub const ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH: HRESULT = 0xC026258Au32 as HRESULT; -pub const ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM: HRESULT = 0xC026258Bu32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE: HRESULT = 0xC026258Cu32 as HRESULT; -pub const ERROR_GRAPHICS_MONITOR_NO_LONGER_EXISTS: HRESULT = 0xC026258Du32 as HRESULT; -pub const ERROR_GRAPHICS_DDCCI_CURRENT_CURRENT_VALUE_GREATER_THAN_MAXIMUM_VALUE: HRESULT = 0xC02625D8u32 as HRESULT; -pub const ERROR_GRAPHICS_MCA_INVALID_VCP_VERSION: HRESULT = 0xC02625D9u32 as HRESULT; -pub const ERROR_GRAPHICS_MCA_MONITOR_VIOLATES_MCCS_SPECIFICATION: HRESULT = 0xC02625DAu32 as HRESULT; -pub const ERROR_GRAPHICS_MCA_MCCS_VERSION_MISMATCH: HRESULT = 0xC02625DBu32 as HRESULT; -pub const ERROR_GRAPHICS_MCA_UNSUPPORTED_MCCS_VERSION: HRESULT = 0xC02625DCu32 as HRESULT; -pub const ERROR_GRAPHICS_MCA_INVALID_TECHNOLOGY_TYPE_RETURNED: HRESULT = 0xC02625DEu32 as HRESULT; -pub const ERROR_GRAPHICS_MCA_UNSUPPORTED_COLOR_TEMPERATURE: HRESULT = 0xC02625DFu32 as HRESULT; -pub const ERROR_GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED: HRESULT = 0xC02625E0u32 as HRESULT; -pub const ERROR_GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME: HRESULT = 0xC02625E1u32 as HRESULT; -pub const ERROR_GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP: HRESULT = 0xC02625E2u32 as HRESULT; -pub const ERROR_GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED: HRESULT = 0xC02625E3u32 as HRESULT; -pub const ERROR_GRAPHICS_INVALID_POINTER: HRESULT = 0xC02625E4u32 as HRESULT; -pub const ERROR_GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE: HRESULT = 0xC02625E5u32 as HRESULT; -pub const ERROR_GRAPHICS_PARAMETER_ARRAY_TOO_SMALL: HRESULT = 0xC02625E6u32 as HRESULT; -pub const ERROR_GRAPHICS_INTERNAL_ERROR: HRESULT = 0xC02625E7u32 as HRESULT; -pub const ERROR_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS: HRESULT = 0xC02605E8u32 as HRESULT; -pub const NAP_E_INVALID_PACKET: HRESULT = 0x80270001u32 as HRESULT; -pub const NAP_E_MISSING_SOH: HRESULT = 0x80270002u32 as HRESULT; -pub const NAP_E_CONFLICTING_ID: HRESULT = 0x80270003u32 as HRESULT; -pub const NAP_E_NO_CACHED_SOH: HRESULT = 0x80270004u32 as HRESULT; -pub const NAP_E_STILL_BOUND: HRESULT = 0x80270005u32 as HRESULT; -pub const NAP_E_NOT_REGISTERED: HRESULT = 0x80270006u32 as HRESULT; -pub const NAP_E_NOT_INITIALIZED: HRESULT = 0x80270007u32 as HRESULT; -pub const NAP_E_MISMATCHED_ID: HRESULT = 0x80270008u32 as HRESULT; -pub const NAP_E_NOT_PENDING: HRESULT = 0x80270009u32 as HRESULT; -pub const NAP_E_ID_NOT_FOUND: HRESULT = 0x8027000Au32 as HRESULT; -pub const NAP_E_MAXSIZE_TOO_SMALL: HRESULT = 0x8027000Bu32 as HRESULT; -pub const NAP_E_SERVICE_NOT_RUNNING: HRESULT = 0x8027000Cu32 as HRESULT; -pub const NAP_S_CERT_ALREADY_PRESENT: HRESULT = 0x0027000D; -pub const NAP_E_ENTITY_DISABLED: HRESULT = 0x8027000Eu32 as HRESULT; -pub const NAP_E_NETSH_GROUPPOLICY_ERROR: HRESULT = 0x8027000Fu32 as HRESULT; -pub const NAP_E_TOO_MANY_CALLS: HRESULT = 0x80270010u32 as HRESULT; -pub const NAP_E_SHV_CONFIG_EXISTED: HRESULT = 0x80270011u32 as HRESULT; -pub const NAP_E_SHV_CONFIG_NOT_FOUND: HRESULT = 0x80270012u32 as HRESULT; -pub const NAP_E_SHV_TIMEOUT: HRESULT = 0x80270013u32 as HRESULT; -pub const TPM_E_ERROR_MASK: HRESULT = 0x80280000u32 as HRESULT; -pub const TPM_E_AUTHFAIL: HRESULT = 0x80280001u32 as HRESULT; -pub const TPM_E_BADINDEX: HRESULT = 0x80280002u32 as HRESULT; -pub const TPM_E_BAD_PARAMETER: HRESULT = 0x80280003u32 as HRESULT; -pub const TPM_E_AUDITFAILURE: HRESULT = 0x80280004u32 as HRESULT; -pub const TPM_E_CLEAR_DISABLED: HRESULT = 0x80280005u32 as HRESULT; -pub const TPM_E_DEACTIVATED: HRESULT = 0x80280006u32 as HRESULT; -pub const TPM_E_DISABLED: HRESULT = 0x80280007u32 as HRESULT; -pub const TPM_E_DISABLED_CMD: HRESULT = 0x80280008u32 as HRESULT; -pub const TPM_E_FAIL: HRESULT = 0x80280009u32 as HRESULT; -pub const TPM_E_BAD_ORDINAL: HRESULT = 0x8028000Au32 as HRESULT; -pub const TPM_E_INSTALL_DISABLED: HRESULT = 0x8028000Bu32 as HRESULT; -pub const TPM_E_INVALID_KEYHANDLE: HRESULT = 0x8028000Cu32 as HRESULT; -pub const TPM_E_KEYNOTFOUND: HRESULT = 0x8028000Du32 as HRESULT; -pub const TPM_E_INAPPROPRIATE_ENC: HRESULT = 0x8028000Eu32 as HRESULT; -pub const TPM_E_MIGRATEFAIL: HRESULT = 0x8028000Fu32 as HRESULT; -pub const TPM_E_INVALID_PCR_INFO: HRESULT = 0x80280010u32 as HRESULT; -pub const TPM_E_NOSPACE: HRESULT = 0x80280011u32 as HRESULT; -pub const TPM_E_NOSRK: HRESULT = 0x80280012u32 as HRESULT; -pub const TPM_E_NOTSEALED_BLOB: HRESULT = 0x80280013u32 as HRESULT; -pub const TPM_E_OWNER_SET: HRESULT = 0x80280014u32 as HRESULT; -pub const TPM_E_RESOURCES: HRESULT = 0x80280015u32 as HRESULT; -pub const TPM_E_SHORTRANDOM: HRESULT = 0x80280016u32 as HRESULT; -pub const TPM_E_SIZE: HRESULT = 0x80280017u32 as HRESULT; -pub const TPM_E_WRONGPCRVAL: HRESULT = 0x80280018u32 as HRESULT; -pub const TPM_E_BAD_PARAM_SIZE: HRESULT = 0x80280019u32 as HRESULT; -pub const TPM_E_SHA_THREAD: HRESULT = 0x8028001Au32 as HRESULT; -pub const TPM_E_SHA_ERROR: HRESULT = 0x8028001Bu32 as HRESULT; -pub const TPM_E_FAILEDSELFTEST: HRESULT = 0x8028001Cu32 as HRESULT; -pub const TPM_E_AUTH2FAIL: HRESULT = 0x8028001Du32 as HRESULT; -pub const TPM_E_BADTAG: HRESULT = 0x8028001Eu32 as HRESULT; -pub const TPM_E_IOERROR: HRESULT = 0x8028001Fu32 as HRESULT; -pub const TPM_E_ENCRYPT_ERROR: HRESULT = 0x80280020u32 as HRESULT; -pub const TPM_E_DECRYPT_ERROR: HRESULT = 0x80280021u32 as HRESULT; -pub const TPM_E_INVALID_AUTHHANDLE: HRESULT = 0x80280022u32 as HRESULT; -pub const TPM_E_NO_ENDORSEMENT: HRESULT = 0x80280023u32 as HRESULT; -pub const TPM_E_INVALID_KEYUSAGE: HRESULT = 0x80280024u32 as HRESULT; -pub const TPM_E_WRONG_ENTITYTYPE: HRESULT = 0x80280025u32 as HRESULT; -pub const TPM_E_INVALID_POSTINIT: HRESULT = 0x80280026u32 as HRESULT; -pub const TPM_E_INAPPROPRIATE_SIG: HRESULT = 0x80280027u32 as HRESULT; -pub const TPM_E_BAD_KEY_PROPERTY: HRESULT = 0x80280028u32 as HRESULT; -pub const TPM_E_BAD_MIGRATION: HRESULT = 0x80280029u32 as HRESULT; -pub const TPM_E_BAD_SCHEME: HRESULT = 0x8028002Au32 as HRESULT; -pub const TPM_E_BAD_DATASIZE: HRESULT = 0x8028002Bu32 as HRESULT; -pub const TPM_E_BAD_MODE: HRESULT = 0x8028002Cu32 as HRESULT; -pub const TPM_E_BAD_PRESENCE: HRESULT = 0x8028002Du32 as HRESULT; -pub const TPM_E_BAD_VERSION: HRESULT = 0x8028002Eu32 as HRESULT; -pub const TPM_E_NO_WRAP_TRANSPORT: HRESULT = 0x8028002Fu32 as HRESULT; -pub const TPM_E_AUDITFAIL_UNSUCCESSFUL: HRESULT = 0x80280030u32 as HRESULT; -pub const TPM_E_AUDITFAIL_SUCCESSFUL: HRESULT = 0x80280031u32 as HRESULT; -pub const TPM_E_NOTRESETABLE: HRESULT = 0x80280032u32 as HRESULT; -pub const TPM_E_NOTLOCAL: HRESULT = 0x80280033u32 as HRESULT; -pub const TPM_E_BAD_TYPE: HRESULT = 0x80280034u32 as HRESULT; -pub const TPM_E_INVALID_RESOURCE: HRESULT = 0x80280035u32 as HRESULT; -pub const TPM_E_NOTFIPS: HRESULT = 0x80280036u32 as HRESULT; -pub const TPM_E_INVALID_FAMILY: HRESULT = 0x80280037u32 as HRESULT; -pub const TPM_E_NO_NV_PERMISSION: HRESULT = 0x80280038u32 as HRESULT; -pub const TPM_E_REQUIRES_SIGN: HRESULT = 0x80280039u32 as HRESULT; -pub const TPM_E_KEY_NOTSUPPORTED: HRESULT = 0x8028003Au32 as HRESULT; -pub const TPM_E_AUTH_CONFLICT: HRESULT = 0x8028003Bu32 as HRESULT; -pub const TPM_E_AREA_LOCKED: HRESULT = 0x8028003Cu32 as HRESULT; -pub const TPM_E_BAD_LOCALITY: HRESULT = 0x8028003Du32 as HRESULT; -pub const TPM_E_READ_ONLY: HRESULT = 0x8028003Eu32 as HRESULT; -pub const TPM_E_PER_NOWRITE: HRESULT = 0x8028003Fu32 as HRESULT; -pub const TPM_E_FAMILYCOUNT: HRESULT = 0x80280040u32 as HRESULT; -pub const TPM_E_WRITE_LOCKED: HRESULT = 0x80280041u32 as HRESULT; -pub const TPM_E_BAD_ATTRIBUTES: HRESULT = 0x80280042u32 as HRESULT; -pub const TPM_E_INVALID_STRUCTURE: HRESULT = 0x80280043u32 as HRESULT; -pub const TPM_E_KEY_OWNER_CONTROL: HRESULT = 0x80280044u32 as HRESULT; -pub const TPM_E_BAD_COUNTER: HRESULT = 0x80280045u32 as HRESULT; -pub const TPM_E_NOT_FULLWRITE: HRESULT = 0x80280046u32 as HRESULT; -pub const TPM_E_CONTEXT_GAP: HRESULT = 0x80280047u32 as HRESULT; -pub const TPM_E_MAXNVWRITES: HRESULT = 0x80280048u32 as HRESULT; -pub const TPM_E_NOOPERATOR: HRESULT = 0x80280049u32 as HRESULT; -pub const TPM_E_RESOURCEMISSING: HRESULT = 0x8028004Au32 as HRESULT; -pub const TPM_E_DELEGATE_LOCK: HRESULT = 0x8028004Bu32 as HRESULT; -pub const TPM_E_DELEGATE_FAMILY: HRESULT = 0x8028004Cu32 as HRESULT; -pub const TPM_E_DELEGATE_ADMIN: HRESULT = 0x8028004Du32 as HRESULT; -pub const TPM_E_TRANSPORT_NOTEXCLUSIVE: HRESULT = 0x8028004Eu32 as HRESULT; -pub const TPM_E_OWNER_CONTROL: HRESULT = 0x8028004Fu32 as HRESULT; -pub const TPM_E_DAA_RESOURCES: HRESULT = 0x80280050u32 as HRESULT; -pub const TPM_E_DAA_INPUT_DATA0: HRESULT = 0x80280051u32 as HRESULT; -pub const TPM_E_DAA_INPUT_DATA1: HRESULT = 0x80280052u32 as HRESULT; -pub const TPM_E_DAA_ISSUER_SETTINGS: HRESULT = 0x80280053u32 as HRESULT; -pub const TPM_E_DAA_TPM_SETTINGS: HRESULT = 0x80280054u32 as HRESULT; -pub const TPM_E_DAA_STAGE: HRESULT = 0x80280055u32 as HRESULT; -pub const TPM_E_DAA_ISSUER_VALIDITY: HRESULT = 0x80280056u32 as HRESULT; -pub const TPM_E_DAA_WRONG_W: HRESULT = 0x80280057u32 as HRESULT; -pub const TPM_E_BAD_HANDLE: HRESULT = 0x80280058u32 as HRESULT; -pub const TPM_E_BAD_DELEGATE: HRESULT = 0x80280059u32 as HRESULT; -pub const TPM_E_BADCONTEXT: HRESULT = 0x8028005Au32 as HRESULT; -pub const TPM_E_TOOMANYCONTEXTS: HRESULT = 0x8028005Bu32 as HRESULT; -pub const TPM_E_MA_TICKET_SIGNATURE: HRESULT = 0x8028005Cu32 as HRESULT; -pub const TPM_E_MA_DESTINATION: HRESULT = 0x8028005Du32 as HRESULT; -pub const TPM_E_MA_SOURCE: HRESULT = 0x8028005Eu32 as HRESULT; -pub const TPM_E_MA_AUTHORITY: HRESULT = 0x8028005Fu32 as HRESULT; -pub const TPM_E_PERMANENTEK: HRESULT = 0x80280061u32 as HRESULT; -pub const TPM_E_BAD_SIGNATURE: HRESULT = 0x80280062u32 as HRESULT; -pub const TPM_E_NOCONTEXTSPACE: HRESULT = 0x80280063u32 as HRESULT; -pub const TPM_E_COMMAND_BLOCKED: HRESULT = 0x80280400u32 as HRESULT; -pub const TPM_E_INVALID_HANDLE: HRESULT = 0x80280401u32 as HRESULT; -pub const TPM_E_DUPLICATE_VHANDLE: HRESULT = 0x80280402u32 as HRESULT; -pub const TPM_E_EMBEDDED_COMMAND_BLOCKED: HRESULT = 0x80280403u32 as HRESULT; -pub const TPM_E_EMBEDDED_COMMAND_UNSUPPORTED: HRESULT = 0x80280404u32 as HRESULT; -pub const TPM_E_RETRY: HRESULT = 0x80280800u32 as HRESULT; -pub const TPM_E_NEEDS_SELFTEST: HRESULT = 0x80280801u32 as HRESULT; -pub const TPM_E_DOING_SELFTEST: HRESULT = 0x80280802u32 as HRESULT; -pub const TPM_E_DEFEND_LOCK_RUNNING: HRESULT = 0x80280803u32 as HRESULT; -pub const TBS_E_INTERNAL_ERROR: HRESULT = 0x80284001u32 as HRESULT; -pub const TBS_E_BAD_PARAMETER: HRESULT = 0x80284002u32 as HRESULT; -pub const TBS_E_INVALID_OUTPUT_POINTER: HRESULT = 0x80284003u32 as HRESULT; -pub const TBS_E_INVALID_CONTEXT: HRESULT = 0x80284004u32 as HRESULT; -pub const TBS_E_INSUFFICIENT_BUFFER: HRESULT = 0x80284005u32 as HRESULT; -pub const TBS_E_IOERROR: HRESULT = 0x80284006u32 as HRESULT; -pub const TBS_E_INVALID_CONTEXT_PARAM: HRESULT = 0x80284007u32 as HRESULT; -pub const TBS_E_SERVICE_NOT_RUNNING: HRESULT = 0x80284008u32 as HRESULT; -pub const TBS_E_TOO_MANY_TBS_CONTEXTS: HRESULT = 0x80284009u32 as HRESULT; -pub const TBS_E_TOO_MANY_RESOURCES: HRESULT = 0x8028400Au32 as HRESULT; -pub const TBS_E_SERVICE_START_PENDING: HRESULT = 0x8028400Bu32 as HRESULT; -pub const TBS_E_PPI_NOT_SUPPORTED: HRESULT = 0x8028400Cu32 as HRESULT; -pub const TBS_E_COMMAND_CANCELED: HRESULT = 0x8028400Du32 as HRESULT; -pub const TBS_E_BUFFER_TOO_LARGE: HRESULT = 0x8028400Eu32 as HRESULT; -pub const TBS_E_TPM_NOT_FOUND: HRESULT = 0x8028400Fu32 as HRESULT; -pub const TBS_E_SERVICE_DISABLED: HRESULT = 0x80284010u32 as HRESULT; -pub const TBS_E_NO_EVENT_LOG: HRESULT = 0x80284011u32 as HRESULT; -pub const TBS_E_ACCESS_DENIED: HRESULT = 0x80284012u32 as HRESULT; -pub const TBS_E_PROVISIONING_NOT_ALLOWED: HRESULT = 0x80284013u32 as HRESULT; -pub const TBS_E_PPI_FUNCTION_UNSUPPORTED: HRESULT = 0x80284014u32 as HRESULT; -pub const TBS_E_OWNERAUTH_NOT_FOUND: HRESULT = 0x80284015u32 as HRESULT; -pub const TBS_E_PROVISIONING_INCOMPLETE: HRESULT = 0x80284016u32 as HRESULT; -pub const TPMAPI_E_INVALID_STATE: HRESULT = 0x80290100u32 as HRESULT; -pub const TPMAPI_E_NOT_ENOUGH_DATA: HRESULT = 0x80290101u32 as HRESULT; -pub const TPMAPI_E_TOO_MUCH_DATA: HRESULT = 0x80290102u32 as HRESULT; -pub const TPMAPI_E_INVALID_OUTPUT_POINTER: HRESULT = 0x80290103u32 as HRESULT; -pub const TPMAPI_E_INVALID_PARAMETER: HRESULT = 0x80290104u32 as HRESULT; -pub const TPMAPI_E_OUT_OF_MEMORY: HRESULT = 0x80290105u32 as HRESULT; -pub const TPMAPI_E_BUFFER_TOO_SMALL: HRESULT = 0x80290106u32 as HRESULT; -pub const TPMAPI_E_INTERNAL_ERROR: HRESULT = 0x80290107u32 as HRESULT; -pub const TPMAPI_E_ACCESS_DENIED: HRESULT = 0x80290108u32 as HRESULT; -pub const TPMAPI_E_AUTHORIZATION_FAILED: HRESULT = 0x80290109u32 as HRESULT; -pub const TPMAPI_E_INVALID_CONTEXT_HANDLE: HRESULT = 0x8029010Au32 as HRESULT; -pub const TPMAPI_E_TBS_COMMUNICATION_ERROR: HRESULT = 0x8029010Bu32 as HRESULT; -pub const TPMAPI_E_TPM_COMMAND_ERROR: HRESULT = 0x8029010Cu32 as HRESULT; -pub const TPMAPI_E_MESSAGE_TOO_LARGE: HRESULT = 0x8029010Du32 as HRESULT; -pub const TPMAPI_E_INVALID_ENCODING: HRESULT = 0x8029010Eu32 as HRESULT; -pub const TPMAPI_E_INVALID_KEY_SIZE: HRESULT = 0x8029010Fu32 as HRESULT; -pub const TPMAPI_E_ENCRYPTION_FAILED: HRESULT = 0x80290110u32 as HRESULT; -pub const TPMAPI_E_INVALID_KEY_PARAMS: HRESULT = 0x80290111u32 as HRESULT; -pub const TPMAPI_E_INVALID_MIGRATION_AUTHORIZATION_BLOB: HRESULT = 0x80290112u32 as HRESULT; -pub const TPMAPI_E_INVALID_PCR_INDEX: HRESULT = 0x80290113u32 as HRESULT; -pub const TPMAPI_E_INVALID_DELEGATE_BLOB: HRESULT = 0x80290114u32 as HRESULT; -pub const TPMAPI_E_INVALID_CONTEXT_PARAMS: HRESULT = 0x80290115u32 as HRESULT; -pub const TPMAPI_E_INVALID_KEY_BLOB: HRESULT = 0x80290116u32 as HRESULT; -pub const TPMAPI_E_INVALID_PCR_DATA: HRESULT = 0x80290117u32 as HRESULT; -pub const TPMAPI_E_INVALID_OWNER_AUTH: HRESULT = 0x80290118u32 as HRESULT; -pub const TPMAPI_E_FIPS_RNG_CHECK_FAILED: HRESULT = 0x80290119u32 as HRESULT; -pub const TPMAPI_E_EMPTY_TCG_LOG: HRESULT = 0x8029011Au32 as HRESULT; -pub const TPMAPI_E_INVALID_TCG_LOG_ENTRY: HRESULT = 0x8029011Bu32 as HRESULT; -pub const TPMAPI_E_TCG_SEPARATOR_ABSENT: HRESULT = 0x8029011Cu32 as HRESULT; -pub const TPMAPI_E_TCG_INVALID_DIGEST_ENTRY: HRESULT = 0x8029011Du32 as HRESULT; -pub const TPMAPI_E_POLICY_DENIES_OPERATION: HRESULT = 0x8029011Eu32 as HRESULT; -pub const TBSIMP_E_BUFFER_TOO_SMALL: HRESULT = 0x80290200u32 as HRESULT; -pub const TBSIMP_E_CLEANUP_FAILED: HRESULT = 0x80290201u32 as HRESULT; -pub const TBSIMP_E_INVALID_CONTEXT_HANDLE: HRESULT = 0x80290202u32 as HRESULT; -pub const TBSIMP_E_INVALID_CONTEXT_PARAM: HRESULT = 0x80290203u32 as HRESULT; -pub const TBSIMP_E_TPM_ERROR: HRESULT = 0x80290204u32 as HRESULT; -pub const TBSIMP_E_HASH_BAD_KEY: HRESULT = 0x80290205u32 as HRESULT; -pub const TBSIMP_E_DUPLICATE_VHANDLE: HRESULT = 0x80290206u32 as HRESULT; -pub const TBSIMP_E_INVALID_OUTPUT_POINTER: HRESULT = 0x80290207u32 as HRESULT; -pub const TBSIMP_E_INVALID_PARAMETER: HRESULT = 0x80290208u32 as HRESULT; -pub const TBSIMP_E_RPC_INIT_FAILED: HRESULT = 0x80290209u32 as HRESULT; -pub const TBSIMP_E_SCHEDULER_NOT_RUNNING: HRESULT = 0x8029020Au32 as HRESULT; -pub const TBSIMP_E_COMMAND_CANCELED: HRESULT = 0x8029020Bu32 as HRESULT; -pub const TBSIMP_E_OUT_OF_MEMORY: HRESULT = 0x8029020Cu32 as HRESULT; -pub const TBSIMP_E_LIST_NO_MORE_ITEMS: HRESULT = 0x8029020Du32 as HRESULT; -pub const TBSIMP_E_LIST_NOT_FOUND: HRESULT = 0x8029020Eu32 as HRESULT; -pub const TBSIMP_E_NOT_ENOUGH_SPACE: HRESULT = 0x8029020Fu32 as HRESULT; -pub const TBSIMP_E_NOT_ENOUGH_TPM_CONTEXTS: HRESULT = 0x80290210u32 as HRESULT; -pub const TBSIMP_E_COMMAND_FAILED: HRESULT = 0x80290211u32 as HRESULT; -pub const TBSIMP_E_UNKNOWN_ORDINAL: HRESULT = 0x80290212u32 as HRESULT; -pub const TBSIMP_E_RESOURCE_EXPIRED: HRESULT = 0x80290213u32 as HRESULT; -pub const TBSIMP_E_INVALID_RESOURCE: HRESULT = 0x80290214u32 as HRESULT; -pub const TBSIMP_E_NOTHING_TO_UNLOAD: HRESULT = 0x80290215u32 as HRESULT; -pub const TBSIMP_E_HASH_TABLE_FULL: HRESULT = 0x80290216u32 as HRESULT; -pub const TBSIMP_E_TOO_MANY_TBS_CONTEXTS: HRESULT = 0x80290217u32 as HRESULT; -pub const TBSIMP_E_TOO_MANY_RESOURCES: HRESULT = 0x80290218u32 as HRESULT; -pub const TBSIMP_E_PPI_NOT_SUPPORTED: HRESULT = 0x80290219u32 as HRESULT; -pub const TBSIMP_E_TPM_INCOMPATIBLE: HRESULT = 0x8029021Au32 as HRESULT; -pub const TBSIMP_E_NO_EVENT_LOG: HRESULT = 0x8029021Bu32 as HRESULT; -pub const TPM_E_PPI_ACPI_FAILURE: HRESULT = 0x80290300u32 as HRESULT; -pub const TPM_E_PPI_USER_ABORT: HRESULT = 0x80290301u32 as HRESULT; -pub const TPM_E_PPI_BIOS_FAILURE: HRESULT = 0x80290302u32 as HRESULT; -pub const TPM_E_PPI_NOT_SUPPORTED: HRESULT = 0x80290303u32 as HRESULT; -pub const TPM_E_PPI_BLOCKED_IN_BIOS: HRESULT = 0x80290304u32 as HRESULT; -pub const TPM_E_PCP_ERROR_MASK: HRESULT = 0x80290400u32 as HRESULT; -pub const TPM_E_PCP_DEVICE_NOT_READY: HRESULT = 0x80290401u32 as HRESULT; -pub const TPM_E_PCP_INVALID_HANDLE: HRESULT = 0x80290402u32 as HRESULT; -pub const TPM_E_PCP_INVALID_PARAMETER: HRESULT = 0x80290403u32 as HRESULT; -pub const TPM_E_PCP_FLAG_NOT_SUPPORTED: HRESULT = 0x80290404u32 as HRESULT; -pub const TPM_E_PCP_NOT_SUPPORTED: HRESULT = 0x80290405u32 as HRESULT; -pub const TPM_E_PCP_BUFFER_TOO_SMALL: HRESULT = 0x80290406u32 as HRESULT; -pub const TPM_E_PCP_INTERNAL_ERROR: HRESULT = 0x80290407u32 as HRESULT; -pub const TPM_E_PCP_AUTHENTICATION_FAILED: HRESULT = 0x80290408u32 as HRESULT; -pub const TPM_E_PCP_AUTHENTICATION_IGNORED: HRESULT = 0x80290409u32 as HRESULT; -pub const TPM_E_PCP_POLICY_NOT_FOUND: HRESULT = 0x8029040Au32 as HRESULT; -pub const TPM_E_PCP_PROFILE_NOT_FOUND: HRESULT = 0x8029040Bu32 as HRESULT; -pub const TPM_E_PCP_VALIDATION_FAILED: HRESULT = 0x8029040Cu32 as HRESULT; -pub const PLA_E_DCS_NOT_FOUND: HRESULT = 0x80300002u32 as HRESULT; -pub const PLA_E_DCS_IN_USE: HRESULT = 0x803000AAu32 as HRESULT; -pub const PLA_E_TOO_MANY_FOLDERS: HRESULT = 0x80300045u32 as HRESULT; -pub const PLA_E_NO_MIN_DISK: HRESULT = 0x80300070u32 as HRESULT; -pub const PLA_E_DCS_ALREADY_EXISTS: HRESULT = 0x803000B7u32 as HRESULT; -pub const PLA_S_PROPERTY_IGNORED: HRESULT = 0x00300100; -pub const PLA_E_PROPERTY_CONFLICT: HRESULT = 0x80300101u32 as HRESULT; -pub const PLA_E_DCS_SINGLETON_REQUIRED: HRESULT = 0x80300102u32 as HRESULT; -pub const PLA_E_CREDENTIALS_REQUIRED: HRESULT = 0x80300103u32 as HRESULT; -pub const PLA_E_DCS_NOT_RUNNING: HRESULT = 0x80300104u32 as HRESULT; -pub const PLA_E_CONFLICT_INCL_EXCL_API: HRESULT = 0x80300105u32 as HRESULT; -pub const PLA_E_NETWORK_EXE_NOT_VALID: HRESULT = 0x80300106u32 as HRESULT; -pub const PLA_E_EXE_ALREADY_CONFIGURED: HRESULT = 0x80300107u32 as HRESULT; -pub const PLA_E_EXE_PATH_NOT_VALID: HRESULT = 0x80300108u32 as HRESULT; -pub const PLA_E_DC_ALREADY_EXISTS: HRESULT = 0x80300109u32 as HRESULT; -pub const PLA_E_DCS_START_WAIT_TIMEOUT: HRESULT = 0x8030010Au32 as HRESULT; -pub const PLA_E_DC_START_WAIT_TIMEOUT: HRESULT = 0x8030010Bu32 as HRESULT; -pub const PLA_E_REPORT_WAIT_TIMEOUT: HRESULT = 0x8030010Cu32 as HRESULT; -pub const PLA_E_NO_DUPLICATES: HRESULT = 0x8030010Du32 as HRESULT; -pub const PLA_E_EXE_FULL_PATH_REQUIRED: HRESULT = 0x8030010Eu32 as HRESULT; -pub const PLA_E_INVALID_SESSION_NAME: HRESULT = 0x8030010Fu32 as HRESULT; -pub const PLA_E_PLA_CHANNEL_NOT_ENABLED: HRESULT = 0x80300110u32 as HRESULT; -pub const PLA_E_TASKSCHED_CHANNEL_NOT_ENABLED: HRESULT = 0x80300111u32 as HRESULT; -pub const PLA_E_RULES_MANAGER_FAILED: HRESULT = 0x80300112u32 as HRESULT; -pub const PLA_E_CABAPI_FAILURE: HRESULT = 0x80300113u32 as HRESULT; -pub const FVE_E_LOCKED_VOLUME: HRESULT = 0x80310000u32 as HRESULT; -pub const FVE_E_NOT_ENCRYPTED: HRESULT = 0x80310001u32 as HRESULT; -pub const FVE_E_NO_TPM_BIOS: HRESULT = 0x80310002u32 as HRESULT; -pub const FVE_E_NO_MBR_METRIC: HRESULT = 0x80310003u32 as HRESULT; -pub const FVE_E_NO_BOOTSECTOR_METRIC: HRESULT = 0x80310004u32 as HRESULT; -pub const FVE_E_NO_BOOTMGR_METRIC: HRESULT = 0x80310005u32 as HRESULT; -pub const FVE_E_WRONG_BOOTMGR: HRESULT = 0x80310006u32 as HRESULT; -pub const FVE_E_SECURE_KEY_REQUIRED: HRESULT = 0x80310007u32 as HRESULT; -pub const FVE_E_NOT_ACTIVATED: HRESULT = 0x80310008u32 as HRESULT; -pub const FVE_E_ACTION_NOT_ALLOWED: HRESULT = 0x80310009u32 as HRESULT; -pub const FVE_E_AD_SCHEMA_NOT_INSTALLED: HRESULT = 0x8031000Au32 as HRESULT; -pub const FVE_E_AD_INVALID_DATATYPE: HRESULT = 0x8031000Bu32 as HRESULT; -pub const FVE_E_AD_INVALID_DATASIZE: HRESULT = 0x8031000Cu32 as HRESULT; -pub const FVE_E_AD_NO_VALUES: HRESULT = 0x8031000Du32 as HRESULT; -pub const FVE_E_AD_ATTR_NOT_SET: HRESULT = 0x8031000Eu32 as HRESULT; -pub const FVE_E_AD_GUID_NOT_FOUND: HRESULT = 0x8031000Fu32 as HRESULT; -pub const FVE_E_BAD_INFORMATION: HRESULT = 0x80310010u32 as HRESULT; -pub const FVE_E_TOO_SMALL: HRESULT = 0x80310011u32 as HRESULT; -pub const FVE_E_SYSTEM_VOLUME: HRESULT = 0x80310012u32 as HRESULT; -pub const FVE_E_FAILED_WRONG_FS: HRESULT = 0x80310013u32 as HRESULT; -pub const FVE_E_BAD_PARTITION_SIZE: HRESULT = 0x80310014u32 as HRESULT; -pub const FVE_E_NOT_SUPPORTED: HRESULT = 0x80310015u32 as HRESULT; -pub const FVE_E_BAD_DATA: HRESULT = 0x80310016u32 as HRESULT; -pub const FVE_E_VOLUME_NOT_BOUND: HRESULT = 0x80310017u32 as HRESULT; -pub const FVE_E_TPM_NOT_OWNED: HRESULT = 0x80310018u32 as HRESULT; -pub const FVE_E_NOT_DATA_VOLUME: HRESULT = 0x80310019u32 as HRESULT; -pub const FVE_E_AD_INSUFFICIENT_BUFFER: HRESULT = 0x8031001Au32 as HRESULT; -pub const FVE_E_CONV_READ: HRESULT = 0x8031001Bu32 as HRESULT; -pub const FVE_E_CONV_WRITE: HRESULT = 0x8031001Cu32 as HRESULT; -pub const FVE_E_KEY_REQUIRED: HRESULT = 0x8031001Du32 as HRESULT; -pub const FVE_E_CLUSTERING_NOT_SUPPORTED: HRESULT = 0x8031001Eu32 as HRESULT; -pub const FVE_E_VOLUME_BOUND_ALREADY: HRESULT = 0x8031001Fu32 as HRESULT; -pub const FVE_E_OS_NOT_PROTECTED: HRESULT = 0x80310020u32 as HRESULT; -pub const FVE_E_PROTECTION_DISABLED: HRESULT = 0x80310021u32 as HRESULT; -pub const FVE_E_RECOVERY_KEY_REQUIRED: HRESULT = 0x80310022u32 as HRESULT; -pub const FVE_E_FOREIGN_VOLUME: HRESULT = 0x80310023u32 as HRESULT; -pub const FVE_E_OVERLAPPED_UPDATE: HRESULT = 0x80310024u32 as HRESULT; -pub const FVE_E_TPM_SRK_AUTH_NOT_ZERO: HRESULT = 0x80310025u32 as HRESULT; -pub const FVE_E_FAILED_SECTOR_SIZE: HRESULT = 0x80310026u32 as HRESULT; -pub const FVE_E_FAILED_AUTHENTICATION: HRESULT = 0x80310027u32 as HRESULT; -pub const FVE_E_NOT_OS_VOLUME: HRESULT = 0x80310028u32 as HRESULT; -pub const FVE_E_AUTOUNLOCK_ENABLED: HRESULT = 0x80310029u32 as HRESULT; -pub const FVE_E_WRONG_BOOTSECTOR: HRESULT = 0x8031002Au32 as HRESULT; -pub const FVE_E_WRONG_SYSTEM_FS: HRESULT = 0x8031002Bu32 as HRESULT; -pub const FVE_E_POLICY_PASSWORD_REQUIRED: HRESULT = 0x8031002Cu32 as HRESULT; -pub const FVE_E_CANNOT_SET_FVEK_ENCRYPTED: HRESULT = 0x8031002Du32 as HRESULT; -pub const FVE_E_CANNOT_ENCRYPT_NO_KEY: HRESULT = 0x8031002Eu32 as HRESULT; -pub const FVE_E_BOOTABLE_CDDVD: HRESULT = 0x80310030u32 as HRESULT; -pub const FVE_E_PROTECTOR_EXISTS: HRESULT = 0x80310031u32 as HRESULT; -pub const FVE_E_RELATIVE_PATH: HRESULT = 0x80310032u32 as HRESULT; -pub const FVE_E_PROTECTOR_NOT_FOUND: HRESULT = 0x80310033u32 as HRESULT; -pub const FVE_E_INVALID_KEY_FORMAT: HRESULT = 0x80310034u32 as HRESULT; -pub const FVE_E_INVALID_PASSWORD_FORMAT: HRESULT = 0x80310035u32 as HRESULT; -pub const FVE_E_FIPS_RNG_CHECK_FAILED: HRESULT = 0x80310036u32 as HRESULT; -pub const FVE_E_FIPS_PREVENTS_RECOVERY_PASSWORD: HRESULT = 0x80310037u32 as HRESULT; -pub const FVE_E_FIPS_PREVENTS_EXTERNAL_KEY_EXPORT: HRESULT = 0x80310038u32 as HRESULT; -pub const FVE_E_NOT_DECRYPTED: HRESULT = 0x80310039u32 as HRESULT; -pub const FVE_E_INVALID_PROTECTOR_TYPE: HRESULT = 0x8031003Au32 as HRESULT; -pub const FVE_E_NO_PROTECTORS_TO_TEST: HRESULT = 0x8031003Bu32 as HRESULT; -pub const FVE_E_KEYFILE_NOT_FOUND: HRESULT = 0x8031003Cu32 as HRESULT; -pub const FVE_E_KEYFILE_INVALID: HRESULT = 0x8031003Du32 as HRESULT; -pub const FVE_E_KEYFILE_NO_VMK: HRESULT = 0x8031003Eu32 as HRESULT; -pub const FVE_E_TPM_DISABLED: HRESULT = 0x8031003Fu32 as HRESULT; -pub const FVE_E_NOT_ALLOWED_IN_SAFE_MODE: HRESULT = 0x80310040u32 as HRESULT; -pub const FVE_E_TPM_INVALID_PCR: HRESULT = 0x80310041u32 as HRESULT; -pub const FVE_E_TPM_NO_VMK: HRESULT = 0x80310042u32 as HRESULT; -pub const FVE_E_PIN_INVALID: HRESULT = 0x80310043u32 as HRESULT; -pub const FVE_E_AUTH_INVALID_APPLICATION: HRESULT = 0x80310044u32 as HRESULT; -pub const FVE_E_AUTH_INVALID_CONFIG: HRESULT = 0x80310045u32 as HRESULT; -pub const FVE_E_FIPS_DISABLE_PROTECTION_NOT_ALLOWED: HRESULT = 0x80310046u32 as HRESULT; -pub const FVE_E_FS_NOT_EXTENDED: HRESULT = 0x80310047u32 as HRESULT; -pub const FVE_E_FIRMWARE_TYPE_NOT_SUPPORTED: HRESULT = 0x80310048u32 as HRESULT; -pub const FVE_E_NO_LICENSE: HRESULT = 0x80310049u32 as HRESULT; -pub const FVE_E_NOT_ON_STACK: HRESULT = 0x8031004Au32 as HRESULT; -pub const FVE_E_FS_MOUNTED: HRESULT = 0x8031004Bu32 as HRESULT; -pub const FVE_E_TOKEN_NOT_IMPERSONATED: HRESULT = 0x8031004Cu32 as HRESULT; -pub const FVE_E_DRY_RUN_FAILED: HRESULT = 0x8031004Du32 as HRESULT; -pub const FVE_E_REBOOT_REQUIRED: HRESULT = 0x8031004Eu32 as HRESULT; -pub const FVE_E_DEBUGGER_ENABLED: HRESULT = 0x8031004Fu32 as HRESULT; -pub const FVE_E_RAW_ACCESS: HRESULT = 0x80310050u32 as HRESULT; -pub const FVE_E_RAW_BLOCKED: HRESULT = 0x80310051u32 as HRESULT; -pub const FVE_E_BCD_APPLICATIONS_PATH_INCORRECT: HRESULT = 0x80310052u32 as HRESULT; -pub const FVE_E_NOT_ALLOWED_IN_VERSION: HRESULT = 0x80310053u32 as HRESULT; -pub const FVE_E_NO_AUTOUNLOCK_MASTER_KEY: HRESULT = 0x80310054u32 as HRESULT; -pub const FVE_E_MOR_FAILED: HRESULT = 0x80310055u32 as HRESULT; -pub const FVE_E_HIDDEN_VOLUME: HRESULT = 0x80310056u32 as HRESULT; -pub const FVE_E_TRANSIENT_STATE: HRESULT = 0x80310057u32 as HRESULT; -pub const FVE_E_PUBKEY_NOT_ALLOWED: HRESULT = 0x80310058u32 as HRESULT; -pub const FVE_E_VOLUME_HANDLE_OPEN: HRESULT = 0x80310059u32 as HRESULT; -pub const FVE_E_NO_FEATURE_LICENSE: HRESULT = 0x8031005Au32 as HRESULT; -pub const FVE_E_INVALID_STARTUP_OPTIONS: HRESULT = 0x8031005Bu32 as HRESULT; -pub const FVE_E_POLICY_RECOVERY_PASSWORD_NOT_ALLOWED: HRESULT = 0x8031005Cu32 as HRESULT; -pub const FVE_E_POLICY_RECOVERY_PASSWORD_REQUIRED: HRESULT = 0x8031005Du32 as HRESULT; -pub const FVE_E_POLICY_RECOVERY_KEY_NOT_ALLOWED: HRESULT = 0x8031005Eu32 as HRESULT; -pub const FVE_E_POLICY_RECOVERY_KEY_REQUIRED: HRESULT = 0x8031005Fu32 as HRESULT; -pub const FVE_E_POLICY_STARTUP_PIN_NOT_ALLOWED: HRESULT = 0x80310060u32 as HRESULT; -pub const FVE_E_POLICY_STARTUP_PIN_REQUIRED: HRESULT = 0x80310061u32 as HRESULT; -pub const FVE_E_POLICY_STARTUP_KEY_NOT_ALLOWED: HRESULT = 0x80310062u32 as HRESULT; -pub const FVE_E_POLICY_STARTUP_KEY_REQUIRED: HRESULT = 0x80310063u32 as HRESULT; -pub const FVE_E_POLICY_STARTUP_PIN_KEY_NOT_ALLOWED: HRESULT = 0x80310064u32 as HRESULT; -pub const FVE_E_POLICY_STARTUP_PIN_KEY_REQUIRED: HRESULT = 0x80310065u32 as HRESULT; -pub const FVE_E_POLICY_STARTUP_TPM_NOT_ALLOWED: HRESULT = 0x80310066u32 as HRESULT; -pub const FVE_E_POLICY_STARTUP_TPM_REQUIRED: HRESULT = 0x80310067u32 as HRESULT; -pub const FVE_E_POLICY_INVALID_PIN_LENGTH: HRESULT = 0x80310068u32 as HRESULT; -pub const FVE_E_KEY_PROTECTOR_NOT_SUPPORTED: HRESULT = 0x80310069u32 as HRESULT; -pub const FVE_E_POLICY_PASSPHRASE_NOT_ALLOWED: HRESULT = 0x8031006Au32 as HRESULT; -pub const FVE_E_POLICY_PASSPHRASE_REQUIRED: HRESULT = 0x8031006Bu32 as HRESULT; -pub const FVE_E_FIPS_PREVENTS_PASSPHRASE: HRESULT = 0x8031006Cu32 as HRESULT; -pub const FVE_E_OS_VOLUME_PASSPHRASE_NOT_ALLOWED: HRESULT = 0x8031006Du32 as HRESULT; -pub const FVE_E_INVALID_BITLOCKER_OID: HRESULT = 0x8031006Eu32 as HRESULT; -pub const FVE_E_VOLUME_TOO_SMALL: HRESULT = 0x8031006Fu32 as HRESULT; -pub const FVE_E_DV_NOT_SUPPORTED_ON_FS: HRESULT = 0x80310070u32 as HRESULT; -pub const FVE_E_DV_NOT_ALLOWED_BY_GP: HRESULT = 0x80310071u32 as HRESULT; -pub const FVE_E_POLICY_USER_CERTIFICATE_NOT_ALLOWED: HRESULT = 0x80310072u32 as HRESULT; -pub const FVE_E_POLICY_USER_CERTIFICATE_REQUIRED: HRESULT = 0x80310073u32 as HRESULT; -pub const FVE_E_POLICY_USER_CERT_MUST_BE_HW: HRESULT = 0x80310074u32 as HRESULT; -pub const FVE_E_POLICY_USER_CONFIGURE_FDV_AUTOUNLOCK_NOT_ALLOWED: HRESULT = 0x80310075u32 as HRESULT; -pub const FVE_E_POLICY_USER_CONFIGURE_RDV_AUTOUNLOCK_NOT_ALLOWED: HRESULT = 0x80310076u32 as HRESULT; -pub const FVE_E_POLICY_USER_CONFIGURE_RDV_NOT_ALLOWED: HRESULT = 0x80310077u32 as HRESULT; -pub const FVE_E_POLICY_USER_ENABLE_RDV_NOT_ALLOWED: HRESULT = 0x80310078u32 as HRESULT; -pub const FVE_E_POLICY_USER_DISABLE_RDV_NOT_ALLOWED: HRESULT = 0x80310079u32 as HRESULT; -pub const FVE_E_POLICY_INVALID_PASSPHRASE_LENGTH: HRESULT = 0x80310080u32 as HRESULT; -pub const FVE_E_POLICY_PASSPHRASE_TOO_SIMPLE: HRESULT = 0x80310081u32 as HRESULT; -pub const FVE_E_RECOVERY_PARTITION: HRESULT = 0x80310082u32 as HRESULT; -pub const FVE_E_POLICY_CONFLICT_FDV_RK_OFF_AUK_ON: HRESULT = 0x80310083u32 as HRESULT; -pub const FVE_E_POLICY_CONFLICT_RDV_RK_OFF_AUK_ON: HRESULT = 0x80310084u32 as HRESULT; -pub const FVE_E_NON_BITLOCKER_OID: HRESULT = 0x80310085u32 as HRESULT; -pub const FVE_E_POLICY_PROHIBITS_SELFSIGNED: HRESULT = 0x80310086u32 as HRESULT; -pub const FVE_E_POLICY_CONFLICT_RO_AND_STARTUP_KEY_REQUIRED: HRESULT = 0x80310087u32 as HRESULT; -pub const FVE_E_CONV_RECOVERY_FAILED: HRESULT = 0x80310088u32 as HRESULT; -pub const FVE_E_VIRTUALIZED_SPACE_TOO_BIG: HRESULT = 0x80310089u32 as HRESULT; -pub const FVE_E_POLICY_CONFLICT_OSV_RP_OFF_ADB_ON: HRESULT = 0x80310090u32 as HRESULT; -pub const FVE_E_POLICY_CONFLICT_FDV_RP_OFF_ADB_ON: HRESULT = 0x80310091u32 as HRESULT; -pub const FVE_E_POLICY_CONFLICT_RDV_RP_OFF_ADB_ON: HRESULT = 0x80310092u32 as HRESULT; -pub const FVE_E_NON_BITLOCKER_KU: HRESULT = 0x80310093u32 as HRESULT; -pub const FVE_E_PRIVATEKEY_AUTH_FAILED: HRESULT = 0x80310094u32 as HRESULT; -pub const FVE_E_REMOVAL_OF_DRA_FAILED: HRESULT = 0x80310095u32 as HRESULT; -pub const FVE_E_OPERATION_NOT_SUPPORTED_ON_VISTA_VOLUME: HRESULT = 0x80310096u32 as HRESULT; -pub const FVE_E_CANT_LOCK_AUTOUNLOCK_ENABLED_VOLUME: HRESULT = 0x80310097u32 as HRESULT; -pub const FVE_E_FIPS_HASH_KDF_NOT_ALLOWED: HRESULT = 0x80310098u32 as HRESULT; -pub const FVE_E_ENH_PIN_INVALID: HRESULT = 0x80310099u32 as HRESULT; -pub const FVE_E_INVALID_PIN_CHARS: HRESULT = 0x8031009Au32 as HRESULT; -pub const FVE_E_INVALID_DATUM_TYPE: HRESULT = 0x8031009Bu32 as HRESULT; -pub const FVE_E_EFI_ONLY: HRESULT = 0x8031009Cu32 as HRESULT; -pub const FVE_E_MULTIPLE_NKP_CERTS: HRESULT = 0x8031009Du32 as HRESULT; -pub const FVE_E_REMOVAL_OF_NKP_FAILED: HRESULT = 0x8031009Eu32 as HRESULT; -pub const FVE_E_INVALID_NKP_CERT: HRESULT = 0x8031009Fu32 as HRESULT; -pub const FVE_E_NO_EXISTING_PIN: HRESULT = 0x803100A0u32 as HRESULT; -pub const FVE_E_PROTECTOR_CHANGE_PIN_MISMATCH: HRESULT = 0x803100A1u32 as HRESULT; -pub const FVE_E_PIN_PROTECTOR_CHANGE_BY_STD_USER_DISALLOWED: HRESULT = 0x803100A2u32 as HRESULT; -pub const FVE_E_PROTECTOR_CHANGE_MAX_PIN_CHANGE_ATTEMPTS_REACHED: HRESULT = 0x803100A3u32 as HRESULT; -pub const FVE_E_POLICY_PASSPHRASE_REQUIRES_ASCII: HRESULT = 0x803100A4u32 as HRESULT; -pub const FVE_E_FULL_ENCRYPTION_NOT_ALLOWED_ON_TP_STORAGE: HRESULT = 0x803100A5u32 as HRESULT; -pub const FVE_E_WIPE_NOT_ALLOWED_ON_TP_STORAGE: HRESULT = 0x803100A6u32 as HRESULT; -pub const FVE_E_KEY_LENGTH_NOT_SUPPORTED_BY_EDRIVE: HRESULT = 0x803100A7u32 as HRESULT; -pub const FVE_E_NO_EXISTING_PASSPHRASE: HRESULT = 0x803100A8u32 as HRESULT; -pub const FVE_E_PROTECTOR_CHANGE_PASSPHRASE_MISMATCH: HRESULT = 0x803100A9u32 as HRESULT; -pub const FVE_E_PASSPHRASE_TOO_LONG: HRESULT = 0x803100AAu32 as HRESULT; -pub const FVE_E_NO_PASSPHRASE_WITH_TPM: HRESULT = 0x803100ABu32 as HRESULT; -pub const FVE_E_NO_TPM_WITH_PASSPHRASE: HRESULT = 0x803100ACu32 as HRESULT; -pub const FVE_E_NOT_ALLOWED_ON_CSV_STACK: HRESULT = 0x803100ADu32 as HRESULT; -pub const FVE_E_NOT_ALLOWED_ON_CLUSTER: HRESULT = 0x803100AEu32 as HRESULT; -pub const FVE_E_EDRIVE_NO_FAILOVER_TO_SW: HRESULT = 0x803100AFu32 as HRESULT; -pub const FVE_E_EDRIVE_BAND_IN_USE: HRESULT = 0x803100B0u32 as HRESULT; -pub const FVE_E_EDRIVE_DISALLOWED_BY_GP: HRESULT = 0x803100B1u32 as HRESULT; -pub const FVE_E_EDRIVE_INCOMPATIBLE_VOLUME: HRESULT = 0x803100B2u32 as HRESULT; -pub const FVE_E_NOT_ALLOWED_TO_UPGRADE_WHILE_CONVERTING: HRESULT = 0x803100B3u32 as HRESULT; -pub const FVE_E_EDRIVE_DV_NOT_SUPPORTED: HRESULT = 0x803100B4u32 as HRESULT; -pub const FVE_E_NO_PREBOOT_KEYBOARD_DETECTED: HRESULT = 0x803100B5u32 as HRESULT; -pub const FVE_E_NO_PREBOOT_KEYBOARD_OR_WINRE_DETECTED: HRESULT = 0x803100B6u32 as HRESULT; -pub const FVE_E_POLICY_REQUIRES_STARTUP_PIN_ON_TOUCH_DEVICE: HRESULT = 0x803100B7u32 as HRESULT; -pub const FVE_E_POLICY_REQUIRES_RECOVERY_PASSWORD_ON_TOUCH_DEVICE: HRESULT = 0x803100B8u32 as HRESULT; -pub const FVE_E_WIPE_CANCEL_NOT_APPLICABLE: HRESULT = 0x803100B9u32 as HRESULT; -pub const FVE_E_SECUREBOOT_DISABLED: HRESULT = 0x803100BAu32 as HRESULT; -pub const FVE_E_SECUREBOOT_CONFIGURATION_INVALID: HRESULT = 0x803100BBu32 as HRESULT; -pub const FVE_E_EDRIVE_DRY_RUN_FAILED: HRESULT = 0x803100BCu32 as HRESULT; -pub const FVE_E_SHADOW_COPY_PRESENT: HRESULT = 0x803100BDu32 as HRESULT; -pub const FVE_E_POLICY_INVALID_ENHANCED_BCD_SETTINGS: HRESULT = 0x803100BEu32 as HRESULT; -pub const FVE_E_EDRIVE_INCOMPATIBLE_FIRMWARE: HRESULT = 0x803100BFu32 as HRESULT; -pub const FVE_E_PROTECTOR_CHANGE_MAX_PASSPHRASE_CHANGE_ATTEMPTS_REACHED: HRESULT = 0x803100C0u32 as HRESULT; -pub const FVE_E_PASSPHRASE_PROTECTOR_CHANGE_BY_STD_USER_DISALLOWED: HRESULT = 0x803100C1u32 as HRESULT; -pub const FVE_E_LIVEID_ACCOUNT_SUSPENDED: HRESULT = 0x803100C2u32 as HRESULT; -pub const FVE_E_LIVEID_ACCOUNT_BLOCKED: HRESULT = 0x803100C3u32 as HRESULT; -pub const FVE_E_NOT_PROVISIONED_ON_ALL_VOLUMES: HRESULT = 0x803100C4u32 as HRESULT; -pub const FVE_E_DE_FIXED_DATA_NOT_SUPPORTED: HRESULT = 0x803100C5u32 as HRESULT; -pub const FVE_E_DE_HARDWARE_NOT_COMPLIANT: HRESULT = 0x803100C6u32 as HRESULT; -pub const FVE_E_DE_WINRE_NOT_CONFIGURED: HRESULT = 0x803100C7u32 as HRESULT; -pub const FVE_E_DE_PROTECTION_SUSPENDED: HRESULT = 0x803100C8u32 as HRESULT; -pub const FVE_E_DE_OS_VOLUME_NOT_PROTECTED: HRESULT = 0x803100C9u32 as HRESULT; -pub const FVE_E_DE_DEVICE_LOCKEDOUT: HRESULT = 0x803100CAu32 as HRESULT; -pub const FVE_E_DE_PROTECTION_NOT_YET_ENABLED: HRESULT = 0x803100CBu32 as HRESULT; -pub const FVE_E_INVALID_PIN_CHARS_DETAILED: HRESULT = 0x803100CCu32 as HRESULT; -pub const FVE_E_DEVICE_LOCKOUT_COUNTER_UNAVAILABLE: HRESULT = 0x803100CDu32 as HRESULT; -pub const FVE_E_DEVICELOCKOUT_COUNTER_MISMATCH: HRESULT = 0x803100CEu32 as HRESULT; -pub const FVE_E_BUFFER_TOO_LARGE: HRESULT = 0x803100CFu32 as HRESULT; -pub const FVE_E_NO_SUCH_CAPABILITY_ON_TARGET: HRESULT = 0x803100D0u32 as HRESULT; -pub const FVE_E_DE_PREVENTED_FOR_OS: HRESULT = 0x803100D1u32 as HRESULT; -pub const FVE_E_DE_VOLUME_OPTED_OUT: HRESULT = 0x803100D2u32 as HRESULT; -pub const FVE_E_DE_VOLUME_NOT_SUPPORTED: HRESULT = 0x803100D3u32 as HRESULT; -pub const FVE_E_EOW_NOT_SUPPORTED_IN_VERSION: HRESULT = 0x803100D4u32 as HRESULT; -pub const FVE_E_ADBACKUP_NOT_ENABLED: HRESULT = 0x803100D5u32 as HRESULT; -pub const FVE_E_VOLUME_EXTEND_PREVENTS_EOW_DECRYPT: HRESULT = 0x803100D6u32 as HRESULT; -pub const FVE_E_NOT_DE_VOLUME: HRESULT = 0x803100D7u32 as HRESULT; -pub const FVE_E_PROTECTION_CANNOT_BE_DISABLED: HRESULT = 0x803100D8u32 as HRESULT; -pub const FWP_E_CALLOUT_NOT_FOUND: HRESULT = 0x80320001u32 as HRESULT; -pub const FWP_E_CONDITION_NOT_FOUND: HRESULT = 0x80320002u32 as HRESULT; -pub const FWP_E_FILTER_NOT_FOUND: HRESULT = 0x80320003u32 as HRESULT; -pub const FWP_E_LAYER_NOT_FOUND: HRESULT = 0x80320004u32 as HRESULT; -pub const FWP_E_PROVIDER_NOT_FOUND: HRESULT = 0x80320005u32 as HRESULT; -pub const FWP_E_PROVIDER_CONTEXT_NOT_FOUND: HRESULT = 0x80320006u32 as HRESULT; -pub const FWP_E_SUBLAYER_NOT_FOUND: HRESULT = 0x80320007u32 as HRESULT; -pub const FWP_E_NOT_FOUND: HRESULT = 0x80320008u32 as HRESULT; -pub const FWP_E_ALREADY_EXISTS: HRESULT = 0x80320009u32 as HRESULT; -pub const FWP_E_IN_USE: HRESULT = 0x8032000Au32 as HRESULT; -pub const FWP_E_DYNAMIC_SESSION_IN_PROGRESS: HRESULT = 0x8032000Bu32 as HRESULT; -pub const FWP_E_WRONG_SESSION: HRESULT = 0x8032000Cu32 as HRESULT; -pub const FWP_E_NO_TXN_IN_PROGRESS: HRESULT = 0x8032000Du32 as HRESULT; -pub const FWP_E_TXN_IN_PROGRESS: HRESULT = 0x8032000Eu32 as HRESULT; -pub const FWP_E_TXN_ABORTED: HRESULT = 0x8032000Fu32 as HRESULT; -pub const FWP_E_SESSION_ABORTED: HRESULT = 0x80320010u32 as HRESULT; -pub const FWP_E_INCOMPATIBLE_TXN: HRESULT = 0x80320011u32 as HRESULT; -pub const FWP_E_TIMEOUT: HRESULT = 0x80320012u32 as HRESULT; -pub const FWP_E_NET_EVENTS_DISABLED: HRESULT = 0x80320013u32 as HRESULT; -pub const FWP_E_INCOMPATIBLE_LAYER: HRESULT = 0x80320014u32 as HRESULT; -pub const FWP_E_KM_CLIENTS_ONLY: HRESULT = 0x80320015u32 as HRESULT; -pub const FWP_E_LIFETIME_MISMATCH: HRESULT = 0x80320016u32 as HRESULT; -pub const FWP_E_BUILTIN_OBJECT: HRESULT = 0x80320017u32 as HRESULT; -pub const FWP_E_TOO_MANY_CALLOUTS: HRESULT = 0x80320018u32 as HRESULT; -pub const FWP_E_NOTIFICATION_DROPPED: HRESULT = 0x80320019u32 as HRESULT; -pub const FWP_E_TRAFFIC_MISMATCH: HRESULT = 0x8032001Au32 as HRESULT; -pub const FWP_E_INCOMPATIBLE_SA_STATE: HRESULT = 0x8032001Bu32 as HRESULT; -pub const FWP_E_NULL_POINTER: HRESULT = 0x8032001Cu32 as HRESULT; -pub const FWP_E_INVALID_ENUMERATOR: HRESULT = 0x8032001Du32 as HRESULT; -pub const FWP_E_INVALID_FLAGS: HRESULT = 0x8032001Eu32 as HRESULT; -pub const FWP_E_INVALID_NET_MASK: HRESULT = 0x8032001Fu32 as HRESULT; -pub const FWP_E_INVALID_RANGE: HRESULT = 0x80320020u32 as HRESULT; -pub const FWP_E_INVALID_INTERVAL: HRESULT = 0x80320021u32 as HRESULT; -pub const FWP_E_ZERO_LENGTH_ARRAY: HRESULT = 0x80320022u32 as HRESULT; -pub const FWP_E_NULL_DISPLAY_NAME: HRESULT = 0x80320023u32 as HRESULT; -pub const FWP_E_INVALID_ACTION_TYPE: HRESULT = 0x80320024u32 as HRESULT; -pub const FWP_E_INVALID_WEIGHT: HRESULT = 0x80320025u32 as HRESULT; -pub const FWP_E_MATCH_TYPE_MISMATCH: HRESULT = 0x80320026u32 as HRESULT; -pub const FWP_E_TYPE_MISMATCH: HRESULT = 0x80320027u32 as HRESULT; -pub const FWP_E_OUT_OF_BOUNDS: HRESULT = 0x80320028u32 as HRESULT; -pub const FWP_E_RESERVED: HRESULT = 0x80320029u32 as HRESULT; -pub const FWP_E_DUPLICATE_CONDITION: HRESULT = 0x8032002Au32 as HRESULT; -pub const FWP_E_DUPLICATE_KEYMOD: HRESULT = 0x8032002Bu32 as HRESULT; -pub const FWP_E_ACTION_INCOMPATIBLE_WITH_LAYER: HRESULT = 0x8032002Cu32 as HRESULT; -pub const FWP_E_ACTION_INCOMPATIBLE_WITH_SUBLAYER: HRESULT = 0x8032002Du32 as HRESULT; -pub const FWP_E_CONTEXT_INCOMPATIBLE_WITH_LAYER: HRESULT = 0x8032002Eu32 as HRESULT; -pub const FWP_E_CONTEXT_INCOMPATIBLE_WITH_CALLOUT: HRESULT = 0x8032002Fu32 as HRESULT; -pub const FWP_E_INCOMPATIBLE_AUTH_METHOD: HRESULT = 0x80320030u32 as HRESULT; -pub const FWP_E_INCOMPATIBLE_DH_GROUP: HRESULT = 0x80320031u32 as HRESULT; -pub const FWP_E_EM_NOT_SUPPORTED: HRESULT = 0x80320032u32 as HRESULT; -pub const FWP_E_NEVER_MATCH: HRESULT = 0x80320033u32 as HRESULT; -pub const FWP_E_PROVIDER_CONTEXT_MISMATCH: HRESULT = 0x80320034u32 as HRESULT; -pub const FWP_E_INVALID_PARAMETER: HRESULT = 0x80320035u32 as HRESULT; -pub const FWP_E_TOO_MANY_SUBLAYERS: HRESULT = 0x80320036u32 as HRESULT; -pub const FWP_E_CALLOUT_NOTIFICATION_FAILED: HRESULT = 0x80320037u32 as HRESULT; -pub const FWP_E_INVALID_AUTH_TRANSFORM: HRESULT = 0x80320038u32 as HRESULT; -pub const FWP_E_INVALID_CIPHER_TRANSFORM: HRESULT = 0x80320039u32 as HRESULT; -pub const FWP_E_INCOMPATIBLE_CIPHER_TRANSFORM: HRESULT = 0x8032003Au32 as HRESULT; -pub const FWP_E_INVALID_TRANSFORM_COMBINATION: HRESULT = 0x8032003Bu32 as HRESULT; -pub const FWP_E_DUPLICATE_AUTH_METHOD: HRESULT = 0x8032003Cu32 as HRESULT; -pub const FWP_E_INVALID_TUNNEL_ENDPOINT: HRESULT = 0x8032003Du32 as HRESULT; -pub const FWP_E_L2_DRIVER_NOT_READY: HRESULT = 0x8032003Eu32 as HRESULT; -pub const FWP_E_KEY_DICTATOR_ALREADY_REGISTERED: HRESULT = 0x8032003Fu32 as HRESULT; -pub const FWP_E_KEY_DICTATION_INVALID_KEYING_MATERIAL: HRESULT = 0x80320040u32 as HRESULT; -pub const FWP_E_CONNECTIONS_DISABLED: HRESULT = 0x80320041u32 as HRESULT; -pub const FWP_E_INVALID_DNS_NAME: HRESULT = 0x80320042u32 as HRESULT; -pub const FWP_E_STILL_ON: HRESULT = 0x80320043u32 as HRESULT; -pub const FWP_E_IKEEXT_NOT_RUNNING: HRESULT = 0x80320044u32 as HRESULT; -pub const FWP_E_DROP_NOICMP: HRESULT = 0x80320104u32 as HRESULT; -pub const WS_S_ASYNC: HRESULT = 0x003D0000; -pub const WS_S_END: HRESULT = 0x003D0001; -pub const WS_E_INVALID_FORMAT: HRESULT = 0x803D0000u32 as HRESULT; -pub const WS_E_OBJECT_FAULTED: HRESULT = 0x803D0001u32 as HRESULT; -pub const WS_E_NUMERIC_OVERFLOW: HRESULT = 0x803D0002u32 as HRESULT; -pub const WS_E_INVALID_OPERATION: HRESULT = 0x803D0003u32 as HRESULT; -pub const WS_E_OPERATION_ABORTED: HRESULT = 0x803D0004u32 as HRESULT; -pub const WS_E_ENDPOINT_ACCESS_DENIED: HRESULT = 0x803D0005u32 as HRESULT; -pub const WS_E_OPERATION_TIMED_OUT: HRESULT = 0x803D0006u32 as HRESULT; -pub const WS_E_OPERATION_ABANDONED: HRESULT = 0x803D0007u32 as HRESULT; -pub const WS_E_QUOTA_EXCEEDED: HRESULT = 0x803D0008u32 as HRESULT; -pub const WS_E_NO_TRANSLATION_AVAILABLE: HRESULT = 0x803D0009u32 as HRESULT; -pub const WS_E_SECURITY_VERIFICATION_FAILURE: HRESULT = 0x803D000Au32 as HRESULT; -pub const WS_E_ADDRESS_IN_USE: HRESULT = 0x803D000Bu32 as HRESULT; -pub const WS_E_ADDRESS_NOT_AVAILABLE: HRESULT = 0x803D000Cu32 as HRESULT; -pub const WS_E_ENDPOINT_NOT_FOUND: HRESULT = 0x803D000Du32 as HRESULT; -pub const WS_E_ENDPOINT_NOT_AVAILABLE: HRESULT = 0x803D000Eu32 as HRESULT; -pub const WS_E_ENDPOINT_FAILURE: HRESULT = 0x803D000Fu32 as HRESULT; -pub const WS_E_ENDPOINT_UNREACHABLE: HRESULT = 0x803D0010u32 as HRESULT; -pub const WS_E_ENDPOINT_ACTION_NOT_SUPPORTED: HRESULT = 0x803D0011u32 as HRESULT; -pub const WS_E_ENDPOINT_TOO_BUSY: HRESULT = 0x803D0012u32 as HRESULT; -pub const WS_E_ENDPOINT_FAULT_RECEIVED: HRESULT = 0x803D0013u32 as HRESULT; -pub const WS_E_ENDPOINT_DISCONNECTED: HRESULT = 0x803D0014u32 as HRESULT; -pub const WS_E_PROXY_FAILURE: HRESULT = 0x803D0015u32 as HRESULT; -pub const WS_E_PROXY_ACCESS_DENIED: HRESULT = 0x803D0016u32 as HRESULT; -pub const WS_E_NOT_SUPPORTED: HRESULT = 0x803D0017u32 as HRESULT; -pub const WS_E_PROXY_REQUIRES_BASIC_AUTH: HRESULT = 0x803D0018u32 as HRESULT; -pub const WS_E_PROXY_REQUIRES_DIGEST_AUTH: HRESULT = 0x803D0019u32 as HRESULT; -pub const WS_E_PROXY_REQUIRES_NTLM_AUTH: HRESULT = 0x803D001Au32 as HRESULT; -pub const WS_E_PROXY_REQUIRES_NEGOTIATE_AUTH: HRESULT = 0x803D001Bu32 as HRESULT; -pub const WS_E_SERVER_REQUIRES_BASIC_AUTH: HRESULT = 0x803D001Cu32 as HRESULT; -pub const WS_E_SERVER_REQUIRES_DIGEST_AUTH: HRESULT = 0x803D001Du32 as HRESULT; -pub const WS_E_SERVER_REQUIRES_NTLM_AUTH: HRESULT = 0x803D001Eu32 as HRESULT; -pub const WS_E_SERVER_REQUIRES_NEGOTIATE_AUTH: HRESULT = 0x803D001Fu32 as HRESULT; -pub const WS_E_INVALID_ENDPOINT_URL: HRESULT = 0x803D0020u32 as HRESULT; -pub const WS_E_OTHER: HRESULT = 0x803D0021u32 as HRESULT; -pub const WS_E_SECURITY_TOKEN_EXPIRED: HRESULT = 0x803D0022u32 as HRESULT; -pub const WS_E_SECURITY_SYSTEM_FAILURE: HRESULT = 0x803D0023u32 as HRESULT; -pub const ERROR_NDIS_INTERFACE_CLOSING: HRESULT = 0x80340002u32 as HRESULT; -pub const ERROR_NDIS_BAD_VERSION: HRESULT = 0x80340004u32 as HRESULT; -pub const ERROR_NDIS_BAD_CHARACTERISTICS: HRESULT = 0x80340005u32 as HRESULT; -pub const ERROR_NDIS_ADAPTER_NOT_FOUND: HRESULT = 0x80340006u32 as HRESULT; -pub const ERROR_NDIS_OPEN_FAILED: HRESULT = 0x80340007u32 as HRESULT; -pub const ERROR_NDIS_DEVICE_FAILED: HRESULT = 0x80340008u32 as HRESULT; -pub const ERROR_NDIS_MULTICAST_FULL: HRESULT = 0x80340009u32 as HRESULT; -pub const ERROR_NDIS_MULTICAST_EXISTS: HRESULT = 0x8034000Au32 as HRESULT; -pub const ERROR_NDIS_MULTICAST_NOT_FOUND: HRESULT = 0x8034000Bu32 as HRESULT; -pub const ERROR_NDIS_REQUEST_ABORTED: HRESULT = 0x8034000Cu32 as HRESULT; -pub const ERROR_NDIS_RESET_IN_PROGRESS: HRESULT = 0x8034000Du32 as HRESULT; -pub const ERROR_NDIS_NOT_SUPPORTED: HRESULT = 0x803400BBu32 as HRESULT; -pub const ERROR_NDIS_INVALID_PACKET: HRESULT = 0x8034000Fu32 as HRESULT; -pub const ERROR_NDIS_ADAPTER_NOT_READY: HRESULT = 0x80340011u32 as HRESULT; -pub const ERROR_NDIS_INVALID_LENGTH: HRESULT = 0x80340014u32 as HRESULT; -pub const ERROR_NDIS_INVALID_DATA: HRESULT = 0x80340015u32 as HRESULT; -pub const ERROR_NDIS_BUFFER_TOO_SHORT: HRESULT = 0x80340016u32 as HRESULT; -pub const ERROR_NDIS_INVALID_OID: HRESULT = 0x80340017u32 as HRESULT; -pub const ERROR_NDIS_ADAPTER_REMOVED: HRESULT = 0x80340018u32 as HRESULT; -pub const ERROR_NDIS_UNSUPPORTED_MEDIA: HRESULT = 0x80340019u32 as HRESULT; -pub const ERROR_NDIS_GROUP_ADDRESS_IN_USE: HRESULT = 0x8034001Au32 as HRESULT; -pub const ERROR_NDIS_FILE_NOT_FOUND: HRESULT = 0x8034001Bu32 as HRESULT; -pub const ERROR_NDIS_ERROR_READING_FILE: HRESULT = 0x8034001Cu32 as HRESULT; -pub const ERROR_NDIS_ALREADY_MAPPED: HRESULT = 0x8034001Du32 as HRESULT; -pub const ERROR_NDIS_RESOURCE_CONFLICT: HRESULT = 0x8034001Eu32 as HRESULT; -pub const ERROR_NDIS_MEDIA_DISCONNECTED: HRESULT = 0x8034001Fu32 as HRESULT; -pub const ERROR_NDIS_INVALID_ADDRESS: HRESULT = 0x80340022u32 as HRESULT; -pub const ERROR_NDIS_INVALID_DEVICE_REQUEST: HRESULT = 0x80340010u32 as HRESULT; -pub const ERROR_NDIS_PAUSED: HRESULT = 0x8034002Au32 as HRESULT; -pub const ERROR_NDIS_INTERFACE_NOT_FOUND: HRESULT = 0x8034002Bu32 as HRESULT; -pub const ERROR_NDIS_UNSUPPORTED_REVISION: HRESULT = 0x8034002Cu32 as HRESULT; -pub const ERROR_NDIS_INVALID_PORT: HRESULT = 0x8034002Du32 as HRESULT; -pub const ERROR_NDIS_INVALID_PORT_STATE: HRESULT = 0x8034002Eu32 as HRESULT; -pub const ERROR_NDIS_LOW_POWER_STATE: HRESULT = 0x8034002Fu32 as HRESULT; -pub const ERROR_NDIS_REINIT_REQUIRED: HRESULT = 0x80340030u32 as HRESULT; -pub const ERROR_NDIS_DOT11_AUTO_CONFIG_ENABLED: HRESULT = 0x80342000u32 as HRESULT; -pub const ERROR_NDIS_DOT11_MEDIA_IN_USE: HRESULT = 0x80342001u32 as HRESULT; -pub const ERROR_NDIS_DOT11_POWER_STATE_INVALID: HRESULT = 0x80342002u32 as HRESULT; -pub const ERROR_NDIS_PM_WOL_PATTERN_LIST_FULL: HRESULT = 0x80342003u32 as HRESULT; -pub const ERROR_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL: HRESULT = 0x80342004u32 as HRESULT; -pub const ERROR_NDIS_INDICATION_REQUIRED: HRESULT = 0x00340001; -pub const ERROR_NDIS_OFFLOAD_POLICY: HRESULT = 0xC034100Fu32 as HRESULT; -pub const ERROR_NDIS_OFFLOAD_CONNECTION_REJECTED: HRESULT = 0xC0341012u32 as HRESULT; -pub const ERROR_NDIS_OFFLOAD_PATH_REJECTED: HRESULT = 0xC0341013u32 as HRESULT; -pub const ERROR_HV_INVALID_HYPERCALL_CODE: HRESULT = 0xC0350002u32 as HRESULT; -pub const ERROR_HV_INVALID_HYPERCALL_INPUT: HRESULT = 0xC0350003u32 as HRESULT; -pub const ERROR_HV_INVALID_ALIGNMENT: HRESULT = 0xC0350004u32 as HRESULT; -pub const ERROR_HV_INVALID_PARAMETER: HRESULT = 0xC0350005u32 as HRESULT; -pub const ERROR_HV_ACCESS_DENIED: HRESULT = 0xC0350006u32 as HRESULT; -pub const ERROR_HV_INVALID_PARTITION_STATE: HRESULT = 0xC0350007u32 as HRESULT; -pub const ERROR_HV_OPERATION_DENIED: HRESULT = 0xC0350008u32 as HRESULT; -pub const ERROR_HV_UNKNOWN_PROPERTY: HRESULT = 0xC0350009u32 as HRESULT; -pub const ERROR_HV_PROPERTY_VALUE_OUT_OF_RANGE: HRESULT = 0xC035000Au32 as HRESULT; -pub const ERROR_HV_INSUFFICIENT_MEMORY: HRESULT = 0xC035000Bu32 as HRESULT; -pub const ERROR_HV_PARTITION_TOO_DEEP: HRESULT = 0xC035000Cu32 as HRESULT; -pub const ERROR_HV_INVALID_PARTITION_ID: HRESULT = 0xC035000Du32 as HRESULT; -pub const ERROR_HV_INVALID_VP_INDEX: HRESULT = 0xC035000Eu32 as HRESULT; -pub const ERROR_HV_INVALID_PORT_ID: HRESULT = 0xC0350011u32 as HRESULT; -pub const ERROR_HV_INVALID_CONNECTION_ID: HRESULT = 0xC0350012u32 as HRESULT; -pub const ERROR_HV_INSUFFICIENT_BUFFERS: HRESULT = 0xC0350013u32 as HRESULT; -pub const ERROR_HV_NOT_ACKNOWLEDGED: HRESULT = 0xC0350014u32 as HRESULT; -pub const ERROR_HV_ACKNOWLEDGED: HRESULT = 0xC0350016u32 as HRESULT; -pub const ERROR_HV_INVALID_SAVE_RESTORE_STATE: HRESULT = 0xC0350017u32 as HRESULT; -pub const ERROR_HV_INVALID_SYNIC_STATE: HRESULT = 0xC0350018u32 as HRESULT; -pub const ERROR_HV_OBJECT_IN_USE: HRESULT = 0xC0350019u32 as HRESULT; -pub const ERROR_HV_INVALID_PROXIMITY_DOMAIN_INFO: HRESULT = 0xC035001Au32 as HRESULT; -pub const ERROR_HV_NO_DATA: HRESULT = 0xC035001Bu32 as HRESULT; -pub const ERROR_HV_INACTIVE: HRESULT = 0xC035001Cu32 as HRESULT; -pub const ERROR_HV_NO_RESOURCES: HRESULT = 0xC035001Du32 as HRESULT; -pub const ERROR_HV_FEATURE_UNAVAILABLE: HRESULT = 0xC035001Eu32 as HRESULT; -pub const ERROR_HV_INSUFFICIENT_BUFFER: HRESULT = 0xC0350033u32 as HRESULT; -pub const ERROR_HV_INSUFFICIENT_DEVICE_DOMAINS: HRESULT = 0xC0350038u32 as HRESULT; -pub const ERROR_HV_INVALID_LP_INDEX: HRESULT = 0xC0350041u32 as HRESULT; -pub const ERROR_HV_NOT_PRESENT: HRESULT = 0xC0351000u32 as HRESULT; -pub const ERROR_VID_DUPLICATE_HANDLER: HRESULT = 0xC0370001u32 as HRESULT; -pub const ERROR_VID_TOO_MANY_HANDLERS: HRESULT = 0xC0370002u32 as HRESULT; -pub const ERROR_VID_QUEUE_FULL: HRESULT = 0xC0370003u32 as HRESULT; -pub const ERROR_VID_HANDLER_NOT_PRESENT: HRESULT = 0xC0370004u32 as HRESULT; -pub const ERROR_VID_INVALID_OBJECT_NAME: HRESULT = 0xC0370005u32 as HRESULT; -pub const ERROR_VID_PARTITION_NAME_TOO_LONG: HRESULT = 0xC0370006u32 as HRESULT; -pub const ERROR_VID_MESSAGE_QUEUE_NAME_TOO_LONG: HRESULT = 0xC0370007u32 as HRESULT; -pub const ERROR_VID_PARTITION_ALREADY_EXISTS: HRESULT = 0xC0370008u32 as HRESULT; -pub const ERROR_VID_PARTITION_DOES_NOT_EXIST: HRESULT = 0xC0370009u32 as HRESULT; -pub const ERROR_VID_PARTITION_NAME_NOT_FOUND: HRESULT = 0xC037000Au32 as HRESULT; -pub const ERROR_VID_MESSAGE_QUEUE_ALREADY_EXISTS: HRESULT = 0xC037000Bu32 as HRESULT; -pub const ERROR_VID_EXCEEDED_MBP_ENTRY_MAP_LIMIT: HRESULT = 0xC037000Cu32 as HRESULT; -pub const ERROR_VID_MB_STILL_REFERENCED: HRESULT = 0xC037000Du32 as HRESULT; -pub const ERROR_VID_CHILD_GPA_PAGE_SET_CORRUPTED: HRESULT = 0xC037000Eu32 as HRESULT; -pub const ERROR_VID_INVALID_NUMA_SETTINGS: HRESULT = 0xC037000Fu32 as HRESULT; -pub const ERROR_VID_INVALID_NUMA_NODE_INDEX: HRESULT = 0xC0370010u32 as HRESULT; -pub const ERROR_VID_NOTIFICATION_QUEUE_ALREADY_ASSOCIATED: HRESULT = 0xC0370011u32 as HRESULT; -pub const ERROR_VID_INVALID_MEMORY_BLOCK_HANDLE: HRESULT = 0xC0370012u32 as HRESULT; -pub const ERROR_VID_PAGE_RANGE_OVERFLOW: HRESULT = 0xC0370013u32 as HRESULT; -pub const ERROR_VID_INVALID_MESSAGE_QUEUE_HANDLE: HRESULT = 0xC0370014u32 as HRESULT; -pub const ERROR_VID_INVALID_GPA_RANGE_HANDLE: HRESULT = 0xC0370015u32 as HRESULT; -pub const ERROR_VID_NO_MEMORY_BLOCK_NOTIFICATION_QUEUE: HRESULT = 0xC0370016u32 as HRESULT; -pub const ERROR_VID_MEMORY_BLOCK_LOCK_COUNT_EXCEEDED: HRESULT = 0xC0370017u32 as HRESULT; -pub const ERROR_VID_INVALID_PPM_HANDLE: HRESULT = 0xC0370018u32 as HRESULT; -pub const ERROR_VID_MBPS_ARE_LOCKED: HRESULT = 0xC0370019u32 as HRESULT; -pub const ERROR_VID_MESSAGE_QUEUE_CLOSED: HRESULT = 0xC037001Au32 as HRESULT; -pub const ERROR_VID_VIRTUAL_PROCESSOR_LIMIT_EXCEEDED: HRESULT = 0xC037001Bu32 as HRESULT; -pub const ERROR_VID_STOP_PENDING: HRESULT = 0xC037001Cu32 as HRESULT; -pub const ERROR_VID_INVALID_PROCESSOR_STATE: HRESULT = 0xC037001Du32 as HRESULT; -pub const ERROR_VID_EXCEEDED_KM_CONTEXT_COUNT_LIMIT: HRESULT = 0xC037001Eu32 as HRESULT; -pub const ERROR_VID_KM_INTERFACE_ALREADY_INITIALIZED: HRESULT = 0xC037001Fu32 as HRESULT; -pub const ERROR_VID_MB_PROPERTY_ALREADY_SET_RESET: HRESULT = 0xC0370020u32 as HRESULT; -pub const ERROR_VID_MMIO_RANGE_DESTROYED: HRESULT = 0xC0370021u32 as HRESULT; -pub const ERROR_VID_INVALID_CHILD_GPA_PAGE_SET: HRESULT = 0xC0370022u32 as HRESULT; -pub const ERROR_VID_RESERVE_PAGE_SET_IS_BEING_USED: HRESULT = 0xC0370023u32 as HRESULT; -pub const ERROR_VID_RESERVE_PAGE_SET_TOO_SMALL: HRESULT = 0xC0370024u32 as HRESULT; -pub const ERROR_VID_MBP_ALREADY_LOCKED_USING_RESERVED_PAGE: HRESULT = 0xC0370025u32 as HRESULT; -pub const ERROR_VID_MBP_COUNT_EXCEEDED_LIMIT: HRESULT = 0xC0370026u32 as HRESULT; -pub const ERROR_VID_SAVED_STATE_CORRUPT: HRESULT = 0xC0370027u32 as HRESULT; -pub const ERROR_VID_SAVED_STATE_UNRECOGNIZED_ITEM: HRESULT = 0xC0370028u32 as HRESULT; -pub const ERROR_VID_SAVED_STATE_INCOMPATIBLE: HRESULT = 0xC0370029u32 as HRESULT; -pub const ERROR_VID_REMOTE_NODE_PARENT_GPA_PAGES_USED: HRESULT = 0x80370001u32 as HRESULT; -pub const ERROR_VOLMGR_INCOMPLETE_REGENERATION: HRESULT = 0x80380001u32 as HRESULT; -pub const ERROR_VOLMGR_INCOMPLETE_DISK_MIGRATION: HRESULT = 0x80380002u32 as HRESULT; -pub const ERROR_VOLMGR_DATABASE_FULL: HRESULT = 0xC0380001u32 as HRESULT; -pub const ERROR_VOLMGR_DISK_CONFIGURATION_CORRUPTED: HRESULT = 0xC0380002u32 as HRESULT; -pub const ERROR_VOLMGR_DISK_CONFIGURATION_NOT_IN_SYNC: HRESULT = 0xC0380003u32 as HRESULT; -pub const ERROR_VOLMGR_PACK_CONFIG_UPDATE_FAILED: HRESULT = 0xC0380004u32 as HRESULT; -pub const ERROR_VOLMGR_DISK_CONTAINS_NON_SIMPLE_VOLUME: HRESULT = 0xC0380005u32 as HRESULT; -pub const ERROR_VOLMGR_DISK_DUPLICATE: HRESULT = 0xC0380006u32 as HRESULT; -pub const ERROR_VOLMGR_DISK_DYNAMIC: HRESULT = 0xC0380007u32 as HRESULT; -pub const ERROR_VOLMGR_DISK_ID_INVALID: HRESULT = 0xC0380008u32 as HRESULT; -pub const ERROR_VOLMGR_DISK_INVALID: HRESULT = 0xC0380009u32 as HRESULT; -pub const ERROR_VOLMGR_DISK_LAST_VOTER: HRESULT = 0xC038000Au32 as HRESULT; -pub const ERROR_VOLMGR_DISK_LAYOUT_INVALID: HRESULT = 0xC038000Bu32 as HRESULT; -pub const ERROR_VOLMGR_DISK_LAYOUT_NON_BASIC_BETWEEN_BASIC_PARTITIONS: HRESULT = 0xC038000Cu32 as HRESULT; -pub const ERROR_VOLMGR_DISK_LAYOUT_NOT_CYLINDER_ALIGNED: HRESULT = 0xC038000Du32 as HRESULT; -pub const ERROR_VOLMGR_DISK_LAYOUT_PARTITIONS_TOO_SMALL: HRESULT = 0xC038000Eu32 as HRESULT; -pub const ERROR_VOLMGR_DISK_LAYOUT_PRIMARY_BETWEEN_LOGICAL_PARTITIONS: HRESULT = 0xC038000Fu32 as HRESULT; -pub const ERROR_VOLMGR_DISK_LAYOUT_TOO_MANY_PARTITIONS: HRESULT = 0xC0380010u32 as HRESULT; -pub const ERROR_VOLMGR_DISK_MISSING: HRESULT = 0xC0380011u32 as HRESULT; -pub const ERROR_VOLMGR_DISK_NOT_EMPTY: HRESULT = 0xC0380012u32 as HRESULT; -pub const ERROR_VOLMGR_DISK_NOT_ENOUGH_SPACE: HRESULT = 0xC0380013u32 as HRESULT; -pub const ERROR_VOLMGR_DISK_REVECTORING_FAILED: HRESULT = 0xC0380014u32 as HRESULT; -pub const ERROR_VOLMGR_DISK_SECTOR_SIZE_INVALID: HRESULT = 0xC0380015u32 as HRESULT; -pub const ERROR_VOLMGR_DISK_SET_NOT_CONTAINED: HRESULT = 0xC0380016u32 as HRESULT; -pub const ERROR_VOLMGR_DISK_USED_BY_MULTIPLE_MEMBERS: HRESULT = 0xC0380017u32 as HRESULT; -pub const ERROR_VOLMGR_DISK_USED_BY_MULTIPLE_PLEXES: HRESULT = 0xC0380018u32 as HRESULT; -pub const ERROR_VOLMGR_DYNAMIC_DISK_NOT_SUPPORTED: HRESULT = 0xC0380019u32 as HRESULT; -pub const ERROR_VOLMGR_EXTENT_ALREADY_USED: HRESULT = 0xC038001Au32 as HRESULT; -pub const ERROR_VOLMGR_EXTENT_NOT_CONTIGUOUS: HRESULT = 0xC038001Bu32 as HRESULT; -pub const ERROR_VOLMGR_EXTENT_NOT_IN_PUBLIC_REGION: HRESULT = 0xC038001Cu32 as HRESULT; -pub const ERROR_VOLMGR_EXTENT_NOT_SECTOR_ALIGNED: HRESULT = 0xC038001Du32 as HRESULT; -pub const ERROR_VOLMGR_EXTENT_OVERLAPS_EBR_PARTITION: HRESULT = 0xC038001Eu32 as HRESULT; -pub const ERROR_VOLMGR_EXTENT_VOLUME_LENGTHS_DO_NOT_MATCH: HRESULT = 0xC038001Fu32 as HRESULT; -pub const ERROR_VOLMGR_FAULT_TOLERANT_NOT_SUPPORTED: HRESULT = 0xC0380020u32 as HRESULT; -pub const ERROR_VOLMGR_INTERLEAVE_LENGTH_INVALID: HRESULT = 0xC0380021u32 as HRESULT; -pub const ERROR_VOLMGR_MAXIMUM_REGISTERED_USERS: HRESULT = 0xC0380022u32 as HRESULT; -pub const ERROR_VOLMGR_MEMBER_IN_SYNC: HRESULT = 0xC0380023u32 as HRESULT; -pub const ERROR_VOLMGR_MEMBER_INDEX_DUPLICATE: HRESULT = 0xC0380024u32 as HRESULT; -pub const ERROR_VOLMGR_MEMBER_INDEX_INVALID: HRESULT = 0xC0380025u32 as HRESULT; -pub const ERROR_VOLMGR_MEMBER_MISSING: HRESULT = 0xC0380026u32 as HRESULT; -pub const ERROR_VOLMGR_MEMBER_NOT_DETACHED: HRESULT = 0xC0380027u32 as HRESULT; -pub const ERROR_VOLMGR_MEMBER_REGENERATING: HRESULT = 0xC0380028u32 as HRESULT; -pub const ERROR_VOLMGR_ALL_DISKS_FAILED: HRESULT = 0xC0380029u32 as HRESULT; -pub const ERROR_VOLMGR_NO_REGISTERED_USERS: HRESULT = 0xC038002Au32 as HRESULT; -pub const ERROR_VOLMGR_NO_SUCH_USER: HRESULT = 0xC038002Bu32 as HRESULT; -pub const ERROR_VOLMGR_NOTIFICATION_RESET: HRESULT = 0xC038002Cu32 as HRESULT; -pub const ERROR_VOLMGR_NUMBER_OF_MEMBERS_INVALID: HRESULT = 0xC038002Du32 as HRESULT; -pub const ERROR_VOLMGR_NUMBER_OF_PLEXES_INVALID: HRESULT = 0xC038002Eu32 as HRESULT; -pub const ERROR_VOLMGR_PACK_DUPLICATE: HRESULT = 0xC038002Fu32 as HRESULT; -pub const ERROR_VOLMGR_PACK_ID_INVALID: HRESULT = 0xC0380030u32 as HRESULT; -pub const ERROR_VOLMGR_PACK_INVALID: HRESULT = 0xC0380031u32 as HRESULT; -pub const ERROR_VOLMGR_PACK_NAME_INVALID: HRESULT = 0xC0380032u32 as HRESULT; -pub const ERROR_VOLMGR_PACK_OFFLINE: HRESULT = 0xC0380033u32 as HRESULT; -pub const ERROR_VOLMGR_PACK_HAS_QUORUM: HRESULT = 0xC0380034u32 as HRESULT; -pub const ERROR_VOLMGR_PACK_WITHOUT_QUORUM: HRESULT = 0xC0380035u32 as HRESULT; -pub const ERROR_VOLMGR_PARTITION_STYLE_INVALID: HRESULT = 0xC0380036u32 as HRESULT; -pub const ERROR_VOLMGR_PARTITION_UPDATE_FAILED: HRESULT = 0xC0380037u32 as HRESULT; -pub const ERROR_VOLMGR_PLEX_IN_SYNC: HRESULT = 0xC0380038u32 as HRESULT; -pub const ERROR_VOLMGR_PLEX_INDEX_DUPLICATE: HRESULT = 0xC0380039u32 as HRESULT; -pub const ERROR_VOLMGR_PLEX_INDEX_INVALID: HRESULT = 0xC038003Au32 as HRESULT; -pub const ERROR_VOLMGR_PLEX_LAST_ACTIVE: HRESULT = 0xC038003Bu32 as HRESULT; -pub const ERROR_VOLMGR_PLEX_MISSING: HRESULT = 0xC038003Cu32 as HRESULT; -pub const ERROR_VOLMGR_PLEX_REGENERATING: HRESULT = 0xC038003Du32 as HRESULT; -pub const ERROR_VOLMGR_PLEX_TYPE_INVALID: HRESULT = 0xC038003Eu32 as HRESULT; -pub const ERROR_VOLMGR_PLEX_NOT_RAID5: HRESULT = 0xC038003Fu32 as HRESULT; -pub const ERROR_VOLMGR_PLEX_NOT_SIMPLE: HRESULT = 0xC0380040u32 as HRESULT; -pub const ERROR_VOLMGR_STRUCTURE_SIZE_INVALID: HRESULT = 0xC0380041u32 as HRESULT; -pub const ERROR_VOLMGR_TOO_MANY_NOTIFICATION_REQUESTS: HRESULT = 0xC0380042u32 as HRESULT; -pub const ERROR_VOLMGR_TRANSACTION_IN_PROGRESS: HRESULT = 0xC0380043u32 as HRESULT; -pub const ERROR_VOLMGR_UNEXPECTED_DISK_LAYOUT_CHANGE: HRESULT = 0xC0380044u32 as HRESULT; -pub const ERROR_VOLMGR_VOLUME_CONTAINS_MISSING_DISK: HRESULT = 0xC0380045u32 as HRESULT; -pub const ERROR_VOLMGR_VOLUME_ID_INVALID: HRESULT = 0xC0380046u32 as HRESULT; -pub const ERROR_VOLMGR_VOLUME_LENGTH_INVALID: HRESULT = 0xC0380047u32 as HRESULT; -pub const ERROR_VOLMGR_VOLUME_LENGTH_NOT_SECTOR_SIZE_MULTIPLE: HRESULT = 0xC0380048u32 as HRESULT; -pub const ERROR_VOLMGR_VOLUME_NOT_MIRRORED: HRESULT = 0xC0380049u32 as HRESULT; -pub const ERROR_VOLMGR_VOLUME_NOT_RETAINED: HRESULT = 0xC038004Au32 as HRESULT; -pub const ERROR_VOLMGR_VOLUME_OFFLINE: HRESULT = 0xC038004Bu32 as HRESULT; -pub const ERROR_VOLMGR_VOLUME_RETAINED: HRESULT = 0xC038004Cu32 as HRESULT; -pub const ERROR_VOLMGR_NUMBER_OF_EXTENTS_INVALID: HRESULT = 0xC038004Du32 as HRESULT; -pub const ERROR_VOLMGR_DIFFERENT_SECTOR_SIZE: HRESULT = 0xC038004Eu32 as HRESULT; -pub const ERROR_VOLMGR_BAD_BOOT_DISK: HRESULT = 0xC038004Fu32 as HRESULT; -pub const ERROR_VOLMGR_PACK_CONFIG_OFFLINE: HRESULT = 0xC0380050u32 as HRESULT; -pub const ERROR_VOLMGR_PACK_CONFIG_ONLINE: HRESULT = 0xC0380051u32 as HRESULT; -pub const ERROR_VOLMGR_NOT_PRIMARY_PACK: HRESULT = 0xC0380052u32 as HRESULT; -pub const ERROR_VOLMGR_PACK_LOG_UPDATE_FAILED: HRESULT = 0xC0380053u32 as HRESULT; -pub const ERROR_VOLMGR_NUMBER_OF_DISKS_IN_PLEX_INVALID: HRESULT = 0xC0380054u32 as HRESULT; -pub const ERROR_VOLMGR_NUMBER_OF_DISKS_IN_MEMBER_INVALID: HRESULT = 0xC0380055u32 as HRESULT; -pub const ERROR_VOLMGR_VOLUME_MIRRORED: HRESULT = 0xC0380056u32 as HRESULT; -pub const ERROR_VOLMGR_PLEX_NOT_SIMPLE_SPANNED: HRESULT = 0xC0380057u32 as HRESULT; -pub const ERROR_VOLMGR_NO_VALID_LOG_COPIES: HRESULT = 0xC0380058u32 as HRESULT; -pub const ERROR_VOLMGR_PRIMARY_PACK_PRESENT: HRESULT = 0xC0380059u32 as HRESULT; -pub const ERROR_VOLMGR_NUMBER_OF_DISKS_INVALID: HRESULT = 0xC038005Au32 as HRESULT; -pub const ERROR_VOLMGR_MIRROR_NOT_SUPPORTED: HRESULT = 0xC038005Bu32 as HRESULT; -pub const ERROR_VOLMGR_RAID5_NOT_SUPPORTED: HRESULT = 0xC038005Cu32 as HRESULT; -pub const ERROR_BCD_NOT_ALL_ENTRIES_IMPORTED: HRESULT = 0x80390001u32 as HRESULT; -pub const ERROR_BCD_TOO_MANY_ELEMENTS: HRESULT = 0xC0390002u32 as HRESULT; -pub const ERROR_BCD_NOT_ALL_ENTRIES_SYNCHRONIZED: HRESULT = 0x80390003u32 as HRESULT; -pub const ERROR_VHD_DRIVE_FOOTER_MISSING: HRESULT = 0xC03A0001u32 as HRESULT; -pub const ERROR_VHD_DRIVE_FOOTER_CHECKSUM_MISMATCH: HRESULT = 0xC03A0002u32 as HRESULT; -pub const ERROR_VHD_DRIVE_FOOTER_CORRUPT: HRESULT = 0xC03A0003u32 as HRESULT; -pub const ERROR_VHD_FORMAT_UNKNOWN: HRESULT = 0xC03A0004u32 as HRESULT; -pub const ERROR_VHD_FORMAT_UNSUPPORTED_VERSION: HRESULT = 0xC03A0005u32 as HRESULT; -pub const ERROR_VHD_SPARSE_HEADER_CHECKSUM_MISMATCH: HRESULT = 0xC03A0006u32 as HRESULT; -pub const ERROR_VHD_SPARSE_HEADER_UNSUPPORTED_VERSION: HRESULT = 0xC03A0007u32 as HRESULT; -pub const ERROR_VHD_SPARSE_HEADER_CORRUPT: HRESULT = 0xC03A0008u32 as HRESULT; -pub const ERROR_VHD_BLOCK_ALLOCATION_FAILURE: HRESULT = 0xC03A0009u32 as HRESULT; -pub const ERROR_VHD_BLOCK_ALLOCATION_TABLE_CORRUPT: HRESULT = 0xC03A000Au32 as HRESULT; -pub const ERROR_VHD_INVALID_BLOCK_SIZE: HRESULT = 0xC03A000Bu32 as HRESULT; -pub const ERROR_VHD_BITMAP_MISMATCH: HRESULT = 0xC03A000Cu32 as HRESULT; -pub const ERROR_VHD_PARENT_VHD_NOT_FOUND: HRESULT = 0xC03A000Du32 as HRESULT; -pub const ERROR_VHD_CHILD_PARENT_ID_MISMATCH: HRESULT = 0xC03A000Eu32 as HRESULT; -pub const ERROR_VHD_CHILD_PARENT_TIMESTAMP_MISMATCH: HRESULT = 0xC03A000Fu32 as HRESULT; -pub const ERROR_VHD_METADATA_READ_FAILURE: HRESULT = 0xC03A0010u32 as HRESULT; -pub const ERROR_VHD_METADATA_WRITE_FAILURE: HRESULT = 0xC03A0011u32 as HRESULT; -pub const ERROR_VHD_INVALID_SIZE: HRESULT = 0xC03A0012u32 as HRESULT; -pub const ERROR_VHD_INVALID_FILE_SIZE: HRESULT = 0xC03A0013u32 as HRESULT; -pub const ERROR_VIRTDISK_PROVIDER_NOT_FOUND: HRESULT = 0xC03A0014u32 as HRESULT; -pub const ERROR_VIRTDISK_NOT_VIRTUAL_DISK: HRESULT = 0xC03A0015u32 as HRESULT; -pub const ERROR_VHD_PARENT_VHD_ACCESS_DENIED: HRESULT = 0xC03A0016u32 as HRESULT; -pub const ERROR_VHD_CHILD_PARENT_SIZE_MISMATCH: HRESULT = 0xC03A0017u32 as HRESULT; -pub const ERROR_VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED: HRESULT = 0xC03A0018u32 as HRESULT; -pub const ERROR_VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT: HRESULT = 0xC03A0019u32 as HRESULT; -pub const ERROR_VIRTUAL_DISK_LIMITATION: HRESULT = 0xC03A001Au32 as HRESULT; -pub const ERROR_VHD_INVALID_TYPE: HRESULT = 0xC03A001Bu32 as HRESULT; -pub const ERROR_VHD_INVALID_STATE: HRESULT = 0xC03A001Cu32 as HRESULT; -pub const ERROR_VIRTDISK_UNSUPPORTED_DISK_SECTOR_SIZE: HRESULT = 0xC03A001Du32 as HRESULT; -pub const ERROR_VIRTDISK_DISK_ALREADY_OWNED: HRESULT = 0xC03A001Eu32 as HRESULT; -pub const ERROR_VIRTDISK_DISK_ONLINE_AND_WRITABLE: HRESULT = 0xC03A001Fu32 as HRESULT; -pub const ERROR_CTLOG_TRACKING_NOT_INITIALIZED: HRESULT = 0xC03A0020u32 as HRESULT; -pub const ERROR_CTLOG_LOGFILE_SIZE_EXCEEDED_MAXSIZE: HRESULT = 0xC03A0021u32 as HRESULT; -pub const ERROR_CTLOG_VHD_CHANGED_OFFLINE: HRESULT = 0xC03A0022u32 as HRESULT; -pub const ERROR_CTLOG_INVALID_TRACKING_STATE: HRESULT = 0xC03A0023u32 as HRESULT; -pub const ERROR_CTLOG_INCONSISTENT_TRACKING_FILE: HRESULT = 0xC03A0024u32 as HRESULT; -pub const ERROR_VHD_RESIZE_WOULD_TRUNCATE_DATA: HRESULT = 0xC03A0025u32 as HRESULT; -pub const ERROR_VHD_COULD_NOT_COMPUTE_MINIMUM_VIRTUAL_SIZE: HRESULT = 0xC03A0026u32 as HRESULT; -pub const ERROR_VHD_ALREADY_AT_OR_BELOW_MINIMUM_VIRTUAL_SIZE: HRESULT = 0xC03A0027u32 as HRESULT; -pub const ERROR_VHD_METADATA_FULL: HRESULT = 0xC03A0028u32 as HRESULT; -pub const ERROR_QUERY_STORAGE_ERROR: HRESULT = 0x803A0001u32 as HRESULT; -pub const SDIAG_E_CANCELLED: HRESULT = 0x803C0100u32 as HRESULT; -pub const SDIAG_E_SCRIPT: HRESULT = 0x803C0101u32 as HRESULT; -pub const SDIAG_E_POWERSHELL: HRESULT = 0x803C0102u32 as HRESULT; -pub const SDIAG_E_MANAGEDHOST: HRESULT = 0x803C0103u32 as HRESULT; -pub const SDIAG_E_NOVERIFIER: HRESULT = 0x803C0104u32 as HRESULT; -pub const SDIAG_S_CANNOTRUN: HRESULT = 0x003C0105; -pub const SDIAG_E_DISABLED: HRESULT = 0x803C0106u32 as HRESULT; -pub const SDIAG_E_TRUST: HRESULT = 0x803C0107u32 as HRESULT; -pub const SDIAG_E_CANNOTRUN: HRESULT = 0x803C0108u32 as HRESULT; -pub const SDIAG_E_VERSION: HRESULT = 0x803C0109u32 as HRESULT; -pub const SDIAG_E_RESOURCE: HRESULT = 0x803C010Au32 as HRESULT; -pub const SDIAG_E_ROOTCAUSE: HRESULT = 0x803C010Bu32 as HRESULT; -pub const WPN_E_CHANNEL_CLOSED: HRESULT = 0x803E0100u32 as HRESULT; -pub const WPN_E_CHANNEL_REQUEST_NOT_COMPLETE: HRESULT = 0x803E0101u32 as HRESULT; -pub const WPN_E_INVALID_APP: HRESULT = 0x803E0102u32 as HRESULT; -pub const WPN_E_OUTSTANDING_CHANNEL_REQUEST: HRESULT = 0x803E0103u32 as HRESULT; -pub const WPN_E_DUPLICATE_CHANNEL: HRESULT = 0x803E0104u32 as HRESULT; -pub const WPN_E_PLATFORM_UNAVAILABLE: HRESULT = 0x803E0105u32 as HRESULT; -pub const WPN_E_NOTIFICATION_POSTED: HRESULT = 0x803E0106u32 as HRESULT; -pub const WPN_E_NOTIFICATION_HIDDEN: HRESULT = 0x803E0107u32 as HRESULT; -pub const WPN_E_NOTIFICATION_NOT_POSTED: HRESULT = 0x803E0108u32 as HRESULT; -pub const WPN_E_CLOUD_DISABLED: HRESULT = 0x803E0109u32 as HRESULT; -pub const WPN_E_CLOUD_INCAPABLE: HRESULT = 0x803E0110u32 as HRESULT; -pub const WPN_E_CLOUD_AUTH_UNAVAILABLE: HRESULT = 0x803E011Au32 as HRESULT; -pub const WPN_E_CLOUD_SERVICE_UNAVAILABLE: HRESULT = 0x803E011Bu32 as HRESULT; -pub const WPN_E_FAILED_LOCK_SCREEN_UPDATE_INTIALIZATION: HRESULT = 0x803E011Cu32 as HRESULT; -pub const WPN_E_NOTIFICATION_DISABLED: HRESULT = 0x803E0111u32 as HRESULT; -pub const WPN_E_NOTIFICATION_INCAPABLE: HRESULT = 0x803E0112u32 as HRESULT; -pub const WPN_E_INTERNET_INCAPABLE: HRESULT = 0x803E0113u32 as HRESULT; -pub const WPN_E_NOTIFICATION_TYPE_DISABLED: HRESULT = 0x803E0114u32 as HRESULT; -pub const WPN_E_NOTIFICATION_SIZE: HRESULT = 0x803E0115u32 as HRESULT; -pub const WPN_E_TAG_SIZE: HRESULT = 0x803E0116u32 as HRESULT; -pub const WPN_E_ACCESS_DENIED: HRESULT = 0x803E0117u32 as HRESULT; -pub const WPN_E_DUPLICATE_REGISTRATION: HRESULT = 0x803E0118u32 as HRESULT; -pub const WPN_E_PUSH_NOTIFICATION_INCAPABLE: HRESULT = 0x803E0119u32 as HRESULT; -pub const WPN_E_DEV_ID_SIZE: HRESULT = 0x803E0120u32 as HRESULT; -pub const WPN_E_TAG_ALPHANUMERIC: HRESULT = 0x803E012Au32 as HRESULT; -pub const WPN_E_INVALID_HTTP_STATUS_CODE: HRESULT = 0x803E012Bu32 as HRESULT; -pub const WPN_E_OUT_OF_SESSION: HRESULT = 0x803E0200u32 as HRESULT; -pub const WPN_E_POWER_SAVE: HRESULT = 0x803E0201u32 as HRESULT; -pub const WPN_E_IMAGE_NOT_FOUND_IN_CACHE: HRESULT = 0x803E0202u32 as HRESULT; -pub const WPN_E_ALL_URL_NOT_COMPLETED: HRESULT = 0x803E0203u32 as HRESULT; -pub const WPN_E_INVALID_CLOUD_IMAGE: HRESULT = 0x803E0204u32 as HRESULT; -pub const WPN_E_NOTIFICATION_ID_MATCHED: HRESULT = 0x803E0205u32 as HRESULT; -pub const WPN_E_CALLBACK_ALREADY_REGISTERED: HRESULT = 0x803E0206u32 as HRESULT; -pub const WPN_E_TOAST_NOTIFICATION_DROPPED: HRESULT = 0x803E0207u32 as HRESULT; -pub const WPN_E_STORAGE_LOCKED: HRESULT = 0x803E0208u32 as HRESULT; -pub const E_MBN_CONTEXT_NOT_ACTIVATED: HRESULT = 0x80548201u32 as HRESULT; -pub const E_MBN_BAD_SIM: HRESULT = 0x80548202u32 as HRESULT; -pub const E_MBN_DATA_CLASS_NOT_AVAILABLE: HRESULT = 0x80548203u32 as HRESULT; -pub const E_MBN_INVALID_ACCESS_STRING: HRESULT = 0x80548204u32 as HRESULT; -pub const E_MBN_MAX_ACTIVATED_CONTEXTS: HRESULT = 0x80548205u32 as HRESULT; -pub const E_MBN_PACKET_SVC_DETACHED: HRESULT = 0x80548206u32 as HRESULT; -pub const E_MBN_PROVIDER_NOT_VISIBLE: HRESULT = 0x80548207u32 as HRESULT; -pub const E_MBN_RADIO_POWER_OFF: HRESULT = 0x80548208u32 as HRESULT; -pub const E_MBN_SERVICE_NOT_ACTIVATED: HRESULT = 0x80548209u32 as HRESULT; -pub const E_MBN_SIM_NOT_INSERTED: HRESULT = 0x8054820Au32 as HRESULT; -pub const E_MBN_VOICE_CALL_IN_PROGRESS: HRESULT = 0x8054820Bu32 as HRESULT; -pub const E_MBN_INVALID_CACHE: HRESULT = 0x8054820Cu32 as HRESULT; -pub const E_MBN_NOT_REGISTERED: HRESULT = 0x8054820Du32 as HRESULT; -pub const E_MBN_PROVIDERS_NOT_FOUND: HRESULT = 0x8054820Eu32 as HRESULT; -pub const E_MBN_PIN_NOT_SUPPORTED: HRESULT = 0x8054820Fu32 as HRESULT; -pub const E_MBN_PIN_REQUIRED: HRESULT = 0x80548210u32 as HRESULT; -pub const E_MBN_PIN_DISABLED: HRESULT = 0x80548211u32 as HRESULT; -pub const E_MBN_FAILURE: HRESULT = 0x80548212u32 as HRESULT; -pub const E_MBN_INVALID_PROFILE: HRESULT = 0x80548218u32 as HRESULT; -pub const E_MBN_DEFAULT_PROFILE_EXIST: HRESULT = 0x80548219u32 as HRESULT; -pub const E_MBN_SMS_ENCODING_NOT_SUPPORTED: HRESULT = 0x80548220u32 as HRESULT; -pub const E_MBN_SMS_FILTER_NOT_SUPPORTED: HRESULT = 0x80548221u32 as HRESULT; -pub const E_MBN_SMS_INVALID_MEMORY_INDEX: HRESULT = 0x80548222u32 as HRESULT; -pub const E_MBN_SMS_LANG_NOT_SUPPORTED: HRESULT = 0x80548223u32 as HRESULT; -pub const E_MBN_SMS_MEMORY_FAILURE: HRESULT = 0x80548224u32 as HRESULT; -pub const E_MBN_SMS_NETWORK_TIMEOUT: HRESULT = 0x80548225u32 as HRESULT; -pub const E_MBN_SMS_UNKNOWN_SMSC_ADDRESS: HRESULT = 0x80548226u32 as HRESULT; -pub const E_MBN_SMS_FORMAT_NOT_SUPPORTED: HRESULT = 0x80548227u32 as HRESULT; -pub const E_MBN_SMS_OPERATION_NOT_ALLOWED: HRESULT = 0x80548228u32 as HRESULT; -pub const E_MBN_SMS_MEMORY_FULL: HRESULT = 0x80548229u32 as HRESULT; -pub const PEER_E_IPV6_NOT_INSTALLED: HRESULT = 0x80630001u32 as HRESULT; -pub const PEER_E_NOT_INITIALIZED: HRESULT = 0x80630002u32 as HRESULT; -pub const PEER_E_CANNOT_START_SERVICE: HRESULT = 0x80630003u32 as HRESULT; -pub const PEER_E_NOT_LICENSED: HRESULT = 0x80630004u32 as HRESULT; -pub const PEER_E_INVALID_GRAPH: HRESULT = 0x80630010u32 as HRESULT; -pub const PEER_E_DBNAME_CHANGED: HRESULT = 0x80630011u32 as HRESULT; -pub const PEER_E_DUPLICATE_GRAPH: HRESULT = 0x80630012u32 as HRESULT; -pub const PEER_E_GRAPH_NOT_READY: HRESULT = 0x80630013u32 as HRESULT; -pub const PEER_E_GRAPH_SHUTTING_DOWN: HRESULT = 0x80630014u32 as HRESULT; -pub const PEER_E_GRAPH_IN_USE: HRESULT = 0x80630015u32 as HRESULT; -pub const PEER_E_INVALID_DATABASE: HRESULT = 0x80630016u32 as HRESULT; -pub const PEER_E_TOO_MANY_ATTRIBUTES: HRESULT = 0x80630017u32 as HRESULT; -pub const PEER_E_CONNECTION_NOT_FOUND: HRESULT = 0x80630103u32 as HRESULT; -pub const PEER_E_CONNECT_SELF: HRESULT = 0x80630106u32 as HRESULT; -pub const PEER_E_ALREADY_LISTENING: HRESULT = 0x80630107u32 as HRESULT; -pub const PEER_E_NODE_NOT_FOUND: HRESULT = 0x80630108u32 as HRESULT; -pub const PEER_E_CONNECTION_FAILED: HRESULT = 0x80630109u32 as HRESULT; -pub const PEER_E_CONNECTION_NOT_AUTHENTICATED: HRESULT = 0x8063010Au32 as HRESULT; -pub const PEER_E_CONNECTION_REFUSED: HRESULT = 0x8063010Bu32 as HRESULT; -pub const PEER_E_CLASSIFIER_TOO_LONG: HRESULT = 0x80630201u32 as HRESULT; -pub const PEER_E_TOO_MANY_IDENTITIES: HRESULT = 0x80630202u32 as HRESULT; -pub const PEER_E_NO_KEY_ACCESS: HRESULT = 0x80630203u32 as HRESULT; -pub const PEER_E_GROUPS_EXIST: HRESULT = 0x80630204u32 as HRESULT; -pub const PEER_E_RECORD_NOT_FOUND: HRESULT = 0x80630301u32 as HRESULT; -pub const PEER_E_DATABASE_ACCESSDENIED: HRESULT = 0x80630302u32 as HRESULT; -pub const PEER_E_DBINITIALIZATION_FAILED: HRESULT = 0x80630303u32 as HRESULT; -pub const PEER_E_MAX_RECORD_SIZE_EXCEEDED: HRESULT = 0x80630304u32 as HRESULT; -pub const PEER_E_DATABASE_ALREADY_PRESENT: HRESULT = 0x80630305u32 as HRESULT; -pub const PEER_E_DATABASE_NOT_PRESENT: HRESULT = 0x80630306u32 as HRESULT; -pub const PEER_E_IDENTITY_NOT_FOUND: HRESULT = 0x80630401u32 as HRESULT; -pub const PEER_E_EVENT_HANDLE_NOT_FOUND: HRESULT = 0x80630501u32 as HRESULT; -pub const PEER_E_INVALID_SEARCH: HRESULT = 0x80630601u32 as HRESULT; -pub const PEER_E_INVALID_ATTRIBUTES: HRESULT = 0x80630602u32 as HRESULT; -pub const PEER_E_INVITATION_NOT_TRUSTED: HRESULT = 0x80630701u32 as HRESULT; -pub const PEER_E_CHAIN_TOO_LONG: HRESULT = 0x80630703u32 as HRESULT; -pub const PEER_E_INVALID_TIME_PERIOD: HRESULT = 0x80630705u32 as HRESULT; -pub const PEER_E_CIRCULAR_CHAIN_DETECTED: HRESULT = 0x80630706u32 as HRESULT; -pub const PEER_E_CERT_STORE_CORRUPTED: HRESULT = 0x80630801u32 as HRESULT; -pub const PEER_E_NO_CLOUD: HRESULT = 0x80631001u32 as HRESULT; -pub const PEER_E_CLOUD_NAME_AMBIGUOUS: HRESULT = 0x80631005u32 as HRESULT; -pub const PEER_E_INVALID_RECORD: HRESULT = 0x80632010u32 as HRESULT; -pub const PEER_E_NOT_AUTHORIZED: HRESULT = 0x80632020u32 as HRESULT; -pub const PEER_E_PASSWORD_DOES_NOT_MEET_POLICY: HRESULT = 0x80632021u32 as HRESULT; -pub const PEER_E_DEFERRED_VALIDATION: HRESULT = 0x80632030u32 as HRESULT; -pub const PEER_E_INVALID_GROUP_PROPERTIES: HRESULT = 0x80632040u32 as HRESULT; -pub const PEER_E_INVALID_PEER_NAME: HRESULT = 0x80632050u32 as HRESULT; -pub const PEER_E_INVALID_CLASSIFIER: HRESULT = 0x80632060u32 as HRESULT; -pub const PEER_E_INVALID_FRIENDLY_NAME: HRESULT = 0x80632070u32 as HRESULT; -pub const PEER_E_INVALID_ROLE_PROPERTY: HRESULT = 0x80632071u32 as HRESULT; -pub const PEER_E_INVALID_CLASSIFIER_PROPERTY: HRESULT = 0x80632072u32 as HRESULT; -pub const PEER_E_INVALID_RECORD_EXPIRATION: HRESULT = 0x80632080u32 as HRESULT; -pub const PEER_E_INVALID_CREDENTIAL_INFO: HRESULT = 0x80632081u32 as HRESULT; -pub const PEER_E_INVALID_CREDENTIAL: HRESULT = 0x80632082u32 as HRESULT; -pub const PEER_E_INVALID_RECORD_SIZE: HRESULT = 0x80632083u32 as HRESULT; -pub const PEER_E_UNSUPPORTED_VERSION: HRESULT = 0x80632090u32 as HRESULT; -pub const PEER_E_GROUP_NOT_READY: HRESULT = 0x80632091u32 as HRESULT; -pub const PEER_E_GROUP_IN_USE: HRESULT = 0x80632092u32 as HRESULT; -pub const PEER_E_INVALID_GROUP: HRESULT = 0x80632093u32 as HRESULT; -pub const PEER_E_NO_MEMBERS_FOUND: HRESULT = 0x80632094u32 as HRESULT; -pub const PEER_E_NO_MEMBER_CONNECTIONS: HRESULT = 0x80632095u32 as HRESULT; -pub const PEER_E_UNABLE_TO_LISTEN: HRESULT = 0x80632096u32 as HRESULT; -pub const PEER_E_IDENTITY_DELETED: HRESULT = 0x806320A0u32 as HRESULT; -pub const PEER_E_SERVICE_NOT_AVAILABLE: HRESULT = 0x806320A1u32 as HRESULT; -pub const PEER_E_CONTACT_NOT_FOUND: HRESULT = 0x80636001u32 as HRESULT; -pub const PEER_S_GRAPH_DATA_CREATED: HRESULT = 0x00630001; -pub const PEER_S_NO_EVENT_DATA: HRESULT = 0x00630002; -pub const PEER_S_ALREADY_CONNECTED: HRESULT = 0x00632000; -pub const PEER_S_SUBSCRIPTION_EXISTS: HRESULT = 0x00636000; -pub const PEER_S_NO_CONNECTIVITY: HRESULT = 0x00630005; -pub const PEER_S_ALREADY_A_MEMBER: HRESULT = 0x00630006; -pub const PEER_E_CANNOT_CONVERT_PEER_NAME: HRESULT = 0x80634001u32 as HRESULT; -pub const PEER_E_INVALID_PEER_HOST_NAME: HRESULT = 0x80634002u32 as HRESULT; -pub const PEER_E_NO_MORE: HRESULT = 0x80634003u32 as HRESULT; -pub const PEER_E_PNRP_DUPLICATE_PEER_NAME: HRESULT = 0x80634005u32 as HRESULT; -pub const PEER_E_INVITE_CANCELLED: HRESULT = 0x80637000u32 as HRESULT; -pub const PEER_E_INVITE_RESPONSE_NOT_AVAILABLE: HRESULT = 0x80637001u32 as HRESULT; -pub const PEER_E_NOT_SIGNED_IN: HRESULT = 0x80637003u32 as HRESULT; -pub const PEER_E_PRIVACY_DECLINED: HRESULT = 0x80637004u32 as HRESULT; -pub const PEER_E_TIMEOUT: HRESULT = 0x80637005u32 as HRESULT; -pub const PEER_E_INVALID_ADDRESS: HRESULT = 0x80637007u32 as HRESULT; -pub const PEER_E_FW_EXCEPTION_DISABLED: HRESULT = 0x80637008u32 as HRESULT; -pub const PEER_E_FW_BLOCKED_BY_POLICY: HRESULT = 0x80637009u32 as HRESULT; -pub const PEER_E_FW_BLOCKED_BY_SHIELDS_UP: HRESULT = 0x8063700Au32 as HRESULT; -pub const PEER_E_FW_DECLINED: HRESULT = 0x8063700Bu32 as HRESULT; -pub const UI_E_CREATE_FAILED: HRESULT = 0x802A0001u32 as HRESULT; -pub const UI_E_SHUTDOWN_CALLED: HRESULT = 0x802A0002u32 as HRESULT; -pub const UI_E_ILLEGAL_REENTRANCY: HRESULT = 0x802A0003u32 as HRESULT; -pub const UI_E_OBJECT_SEALED: HRESULT = 0x802A0004u32 as HRESULT; -pub const UI_E_VALUE_NOT_SET: HRESULT = 0x802A0005u32 as HRESULT; -pub const UI_E_VALUE_NOT_DETERMINED: HRESULT = 0x802A0006u32 as HRESULT; -pub const UI_E_INVALID_OUTPUT: HRESULT = 0x802A0007u32 as HRESULT; -pub const UI_E_BOOLEAN_EXPECTED: HRESULT = 0x802A0008u32 as HRESULT; -pub const UI_E_DIFFERENT_OWNER: HRESULT = 0x802A0009u32 as HRESULT; -pub const UI_E_AMBIGUOUS_MATCH: HRESULT = 0x802A000Au32 as HRESULT; -pub const UI_E_FP_OVERFLOW: HRESULT = 0x802A000Bu32 as HRESULT; -pub const UI_E_WRONG_THREAD: HRESULT = 0x802A000Cu32 as HRESULT; -pub const UI_E_STORYBOARD_ACTIVE: HRESULT = 0x802A0101u32 as HRESULT; -pub const UI_E_STORYBOARD_NOT_PLAYING: HRESULT = 0x802A0102u32 as HRESULT; -pub const UI_E_START_KEYFRAME_AFTER_END: HRESULT = 0x802A0103u32 as HRESULT; -pub const UI_E_END_KEYFRAME_NOT_DETERMINED: HRESULT = 0x802A0104u32 as HRESULT; -pub const UI_E_LOOPS_OVERLAP: HRESULT = 0x802A0105u32 as HRESULT; -pub const UI_E_TRANSITION_ALREADY_USED: HRESULT = 0x802A0106u32 as HRESULT; -pub const UI_E_TRANSITION_NOT_IN_STORYBOARD: HRESULT = 0x802A0107u32 as HRESULT; -pub const UI_E_TRANSITION_ECLIPSED: HRESULT = 0x802A0108u32 as HRESULT; -pub const UI_E_TIME_BEFORE_LAST_UPDATE: HRESULT = 0x802A0109u32 as HRESULT; -pub const UI_E_TIMER_CLIENT_ALREADY_CONNECTED: HRESULT = 0x802A010Au32 as HRESULT; -pub const UI_E_INVALID_DIMENSION: HRESULT = 0x802A010Bu32 as HRESULT; -pub const UI_E_PRIMITIVE_OUT_OF_BOUNDS: HRESULT = 0x802A010Cu32 as HRESULT; -pub const UI_E_WINDOW_CLOSED: HRESULT = 0x802A0201u32 as HRESULT; -pub const E_BLUETOOTH_ATT_INVALID_HANDLE: HRESULT = 0x80650001u32 as HRESULT; -pub const E_BLUETOOTH_ATT_READ_NOT_PERMITTED: HRESULT = 0x80650002u32 as HRESULT; -pub const E_BLUETOOTH_ATT_WRITE_NOT_PERMITTED: HRESULT = 0x80650003u32 as HRESULT; -pub const E_BLUETOOTH_ATT_INVALID_PDU: HRESULT = 0x80650004u32 as HRESULT; -pub const E_BLUETOOTH_ATT_INSUFFICIENT_AUTHENTICATION: HRESULT = 0x80650005u32 as HRESULT; -pub const E_BLUETOOTH_ATT_REQUEST_NOT_SUPPORTED: HRESULT = 0x80650006u32 as HRESULT; -pub const E_BLUETOOTH_ATT_INVALID_OFFSET: HRESULT = 0x80650007u32 as HRESULT; -pub const E_BLUETOOTH_ATT_INSUFFICIENT_AUTHORIZATION: HRESULT = 0x80650008u32 as HRESULT; -pub const E_BLUETOOTH_ATT_PREPARE_QUEUE_FULL: HRESULT = 0x80650009u32 as HRESULT; -pub const E_BLUETOOTH_ATT_ATTRIBUTE_NOT_FOUND: HRESULT = 0x8065000Au32 as HRESULT; -pub const E_BLUETOOTH_ATT_ATTRIBUTE_NOT_LONG: HRESULT = 0x8065000Bu32 as HRESULT; -pub const E_BLUETOOTH_ATT_INSUFFICIENT_ENCRYPTION_KEY_SIZE: HRESULT = 0x8065000Cu32 as HRESULT; -pub const E_BLUETOOTH_ATT_INVALID_ATTRIBUTE_VALUE_LENGTH: HRESULT = 0x8065000Du32 as HRESULT; -pub const E_BLUETOOTH_ATT_UNLIKELY: HRESULT = 0x8065000Eu32 as HRESULT; -pub const E_BLUETOOTH_ATT_INSUFFICIENT_ENCRYPTION: HRESULT = 0x8065000Fu32 as HRESULT; -pub const E_BLUETOOTH_ATT_UNSUPPORTED_GROUP_TYPE: HRESULT = 0x80650010u32 as HRESULT; -pub const E_BLUETOOTH_ATT_INSUFFICIENT_RESOURCES: HRESULT = 0x80650011u32 as HRESULT; -pub const E_BLUETOOTH_ATT_UNKNOWN_ERROR: HRESULT = 0x80651000u32 as HRESULT; -pub const E_AUDIO_ENGINE_NODE_NOT_FOUND: HRESULT = 0x80660001u32 as HRESULT; -pub const E_HDAUDIO_EMPTY_CONNECTION_LIST: HRESULT = 0x80660002u32 as HRESULT; -pub const E_HDAUDIO_CONNECTION_LIST_NOT_SUPPORTED: HRESULT = 0x80660003u32 as HRESULT; -pub const E_HDAUDIO_NO_LOGICAL_DEVICES_CREATED: HRESULT = 0x80660004u32 as HRESULT; -pub const E_HDAUDIO_NULL_LINKED_LIST_ENTRY: HRESULT = 0x80660005u32 as HRESULT; -pub const ERROR_SPACES_POOL_WAS_DELETED: HRESULT = 0x00E70001; -pub const ERROR_SPACES_RESILIENCY_TYPE_INVALID: HRESULT = 0x80E70003u32 as HRESULT; -pub const ERROR_SPACES_DRIVE_SECTOR_SIZE_INVALID: HRESULT = 0x80E70004u32 as HRESULT; -pub const ERROR_SPACES_DRIVE_REDUNDANCY_INVALID: HRESULT = 0x80E70006u32 as HRESULT; -pub const ERROR_SPACES_NUMBER_OF_DATA_COPIES_INVALID: HRESULT = 0x80E70007u32 as HRESULT; -pub const ERROR_SPACES_PARITY_LAYOUT_INVALID: HRESULT = 0x80E70008u32 as HRESULT; -pub const ERROR_SPACES_INTERLEAVE_LENGTH_INVALID: HRESULT = 0x80E70009u32 as HRESULT; -pub const ERROR_SPACES_NUMBER_OF_COLUMNS_INVALID: HRESULT = 0x80E7000Au32 as HRESULT; -pub const ERROR_SPACES_NOT_ENOUGH_DRIVES: HRESULT = 0x80E7000Bu32 as HRESULT; -pub const ERROR_VOLSNAP_BOOTFILE_NOT_VALID: HRESULT = 0x80820001u32 as HRESULT; -pub const ERROR_TIERING_NOT_SUPPORTED_ON_VOLUME: HRESULT = 0x80830001u32 as HRESULT; -pub const ERROR_TIERING_VOLUME_DISMOUNT_IN_PROGRESS: HRESULT = 0x80830002u32 as HRESULT; -pub const ERROR_TIERING_STORAGE_TIER_NOT_FOUND: HRESULT = 0x80830003u32 as HRESULT; -pub const ERROR_TIERING_INVALID_FILE_ID: HRESULT = 0x80830004u32 as HRESULT; -pub const ERROR_TIERING_WRONG_CLUSTER_NODE: HRESULT = 0x80830005u32 as HRESULT; -pub const ERROR_TIERING_ALREADY_PROCESSING: HRESULT = 0x80830006u32 as HRESULT; -pub const ERROR_TIERING_CANNOT_PIN_OBJECT: HRESULT = 0x80830007u32 as HRESULT; -pub const DXGI_STATUS_OCCLUDED: HRESULT = 0x087A0001; -pub const DXGI_STATUS_CLIPPED: HRESULT = 0x087A0002; -pub const DXGI_STATUS_NO_REDIRECTION: HRESULT = 0x087A0004; -pub const DXGI_STATUS_NO_DESKTOP_ACCESS: HRESULT = 0x087A0005; -pub const DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE: HRESULT = 0x087A0006; -pub const DXGI_STATUS_MODE_CHANGED: HRESULT = 0x087A0007; -pub const DXGI_STATUS_MODE_CHANGE_IN_PROGRESS: HRESULT = 0x087A0008; -pub const DXGI_ERROR_INVALID_CALL: HRESULT = 0x887A0001u32 as HRESULT; -pub const DXGI_ERROR_NOT_FOUND: HRESULT = 0x887A0002u32 as HRESULT; -pub const DXGI_ERROR_MORE_DATA: HRESULT = 0x887A0003u32 as HRESULT; -pub const DXGI_ERROR_UNSUPPORTED: HRESULT = 0x887A0004u32 as HRESULT; -pub const DXGI_ERROR_DEVICE_REMOVED: HRESULT = 0x887A0005u32 as HRESULT; -pub const DXGI_ERROR_DEVICE_HUNG: HRESULT = 0x887A0006u32 as HRESULT; -pub const DXGI_ERROR_DEVICE_RESET: HRESULT = 0x887A0007u32 as HRESULT; -pub const DXGI_ERROR_WAS_STILL_DRAWING: HRESULT = 0x887A000Au32 as HRESULT; -pub const DXGI_ERROR_FRAME_STATISTICS_DISJOINT: HRESULT = 0x887A000Bu32 as HRESULT; -pub const DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE: HRESULT = 0x887A000Cu32 as HRESULT; -pub const DXGI_ERROR_DRIVER_INTERNAL_ERROR: HRESULT = 0x887A0020u32 as HRESULT; -pub const DXGI_ERROR_NONEXCLUSIVE: HRESULT = 0x887A0021u32 as HRESULT; -pub const DXGI_ERROR_NOT_CURRENTLY_AVAILABLE: HRESULT = 0x887A0022u32 as HRESULT; -pub const DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED: HRESULT = 0x887A0023u32 as HRESULT; -pub const DXGI_ERROR_REMOTE_OUTOFMEMORY: HRESULT = 0x887A0024u32 as HRESULT; -pub const DXGI_ERROR_ACCESS_LOST: HRESULT = 0x887A0026u32 as HRESULT; -pub const DXGI_ERROR_WAIT_TIMEOUT: HRESULT = 0x887A0027u32 as HRESULT; -pub const DXGI_ERROR_SESSION_DISCONNECTED: HRESULT = 0x887A0028u32 as HRESULT; -pub const DXGI_ERROR_RESTRICT_TO_OUTPUT_STALE: HRESULT = 0x887A0029u32 as HRESULT; -pub const DXGI_ERROR_CANNOT_PROTECT_CONTENT: HRESULT = 0x887A002Au32 as HRESULT; -pub const DXGI_ERROR_ACCESS_DENIED: HRESULT = 0x887A002Bu32 as HRESULT; -pub const DXGI_ERROR_NAME_ALREADY_EXISTS: HRESULT = 0x887A002Cu32 as HRESULT; -pub const DXGI_ERROR_SDK_COMPONENT_MISSING: HRESULT = 0x887A002Du32 as HRESULT; -pub const DXGI_STATUS_UNOCCLUDED: HRESULT = 0x087A0009; -pub const DXGI_STATUS_DDA_WAS_STILL_DRAWING: HRESULT = 0x087A000A; -pub const DXGI_ERROR_MODE_CHANGE_IN_PROGRESS: HRESULT = 0x887A0025u32 as HRESULT; -pub const DXGI_DDI_ERR_WASSTILLDRAWING: HRESULT = 0x887B0001u32 as HRESULT; -pub const DXGI_DDI_ERR_UNSUPPORTED: HRESULT = 0x887B0002u32 as HRESULT; -pub const DXGI_DDI_ERR_NONEXCLUSIVE: HRESULT = 0x887B0003u32 as HRESULT; -pub const D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS: HRESULT = 0x88790001u32 as HRESULT; -pub const D3D10_ERROR_FILE_NOT_FOUND: HRESULT = 0x88790002u32 as HRESULT; -pub const D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS: HRESULT = 0x887C0001u32 as HRESULT; -pub const D3D11_ERROR_FILE_NOT_FOUND: HRESULT = 0x887C0002u32 as HRESULT; -pub const D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS: HRESULT = 0x887C0003u32 as HRESULT; -pub const D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD: HRESULT = 0x887C0004u32 as HRESULT; -pub const D2DERR_WRONG_STATE: HRESULT = 0x88990001u32 as HRESULT; -pub const D2DERR_NOT_INITIALIZED: HRESULT = 0x88990002u32 as HRESULT; -pub const D2DERR_UNSUPPORTED_OPERATION: HRESULT = 0x88990003u32 as HRESULT; -pub const D2DERR_SCANNER_FAILED: HRESULT = 0x88990004u32 as HRESULT; -pub const D2DERR_SCREEN_ACCESS_DENIED: HRESULT = 0x88990005u32 as HRESULT; -pub const D2DERR_DISPLAY_STATE_INVALID: HRESULT = 0x88990006u32 as HRESULT; -pub const D2DERR_ZERO_VECTOR: HRESULT = 0x88990007u32 as HRESULT; -pub const D2DERR_INTERNAL_ERROR: HRESULT = 0x88990008u32 as HRESULT; -pub const D2DERR_DISPLAY_FORMAT_NOT_SUPPORTED: HRESULT = 0x88990009u32 as HRESULT; -pub const D2DERR_INVALID_CALL: HRESULT = 0x8899000Au32 as HRESULT; -pub const D2DERR_NO_HARDWARE_DEVICE: HRESULT = 0x8899000Bu32 as HRESULT; -pub const D2DERR_RECREATE_TARGET: HRESULT = 0x8899000Cu32 as HRESULT; -pub const D2DERR_TOO_MANY_SHADER_ELEMENTS: HRESULT = 0x8899000Du32 as HRESULT; -pub const D2DERR_SHADER_COMPILE_FAILED: HRESULT = 0x8899000Eu32 as HRESULT; -pub const D2DERR_MAX_TEXTURE_SIZE_EXCEEDED: HRESULT = 0x8899000Fu32 as HRESULT; -pub const D2DERR_UNSUPPORTED_VERSION: HRESULT = 0x88990010u32 as HRESULT; -pub const D2DERR_BAD_NUMBER: HRESULT = 0x88990011u32 as HRESULT; -pub const D2DERR_WRONG_FACTORY: HRESULT = 0x88990012u32 as HRESULT; -pub const D2DERR_LAYER_ALREADY_IN_USE: HRESULT = 0x88990013u32 as HRESULT; -pub const D2DERR_POP_CALL_DID_NOT_MATCH_PUSH: HRESULT = 0x88990014u32 as HRESULT; -pub const D2DERR_WRONG_RESOURCE_DOMAIN: HRESULT = 0x88990015u32 as HRESULT; -pub const D2DERR_PUSH_POP_UNBALANCED: HRESULT = 0x88990016u32 as HRESULT; -pub const D2DERR_RENDER_TARGET_HAS_LAYER_OR_CLIPRECT: HRESULT = 0x88990017u32 as HRESULT; -pub const D2DERR_INCOMPATIBLE_BRUSH_TYPES: HRESULT = 0x88990018u32 as HRESULT; -pub const D2DERR_WIN32_ERROR: HRESULT = 0x88990019u32 as HRESULT; -pub const D2DERR_TARGET_NOT_GDI_COMPATIBLE: HRESULT = 0x8899001Au32 as HRESULT; -pub const D2DERR_TEXT_EFFECT_IS_WRONG_TYPE: HRESULT = 0x8899001Bu32 as HRESULT; -pub const D2DERR_TEXT_RENDERER_NOT_RELEASED: HRESULT = 0x8899001Cu32 as HRESULT; -pub const D2DERR_EXCEEDS_MAX_BITMAP_SIZE: HRESULT = 0x8899001Du32 as HRESULT; -pub const D2DERR_INVALID_GRAPH_CONFIGURATION: HRESULT = 0x8899001Eu32 as HRESULT; -pub const D2DERR_INVALID_INTERNAL_GRAPH_CONFIGURATION: HRESULT = 0x8899001Fu32 as HRESULT; -pub const D2DERR_CYCLIC_GRAPH: HRESULT = 0x88990020u32 as HRESULT; -pub const D2DERR_BITMAP_CANNOT_DRAW: HRESULT = 0x88990021u32 as HRESULT; -pub const D2DERR_OUTSTANDING_BITMAP_REFERENCES: HRESULT = 0x88990022u32 as HRESULT; -pub const D2DERR_ORIGINAL_TARGET_NOT_BOUND: HRESULT = 0x88990023u32 as HRESULT; -pub const D2DERR_INVALID_TARGET: HRESULT = 0x88990024u32 as HRESULT; -pub const D2DERR_BITMAP_BOUND_AS_TARGET: HRESULT = 0x88990025u32 as HRESULT; -pub const D2DERR_INSUFFICIENT_DEVICE_CAPABILITIES: HRESULT = 0x88990026u32 as HRESULT; -pub const D2DERR_INTERMEDIATE_TOO_LARGE: HRESULT = 0x88990027u32 as HRESULT; -pub const D2DERR_EFFECT_IS_NOT_REGISTERED: HRESULT = 0x88990028u32 as HRESULT; -pub const D2DERR_INVALID_PROPERTY: HRESULT = 0x88990029u32 as HRESULT; -pub const D2DERR_NO_SUBPROPERTIES: HRESULT = 0x8899002Au32 as HRESULT; -pub const D2DERR_PRINT_JOB_CLOSED: HRESULT = 0x8899002Bu32 as HRESULT; -pub const D2DERR_PRINT_FORMAT_NOT_SUPPORTED: HRESULT = 0x8899002Cu32 as HRESULT; -pub const D2DERR_TOO_MANY_TRANSFORM_INPUTS: HRESULT = 0x8899002Du32 as HRESULT; -pub const DWRITE_E_FILEFORMAT: HRESULT = 0x88985000u32 as HRESULT; -pub const DWRITE_E_UNEXPECTED: HRESULT = 0x88985001u32 as HRESULT; -pub const DWRITE_E_NOFONT: HRESULT = 0x88985002u32 as HRESULT; -pub const DWRITE_E_FILENOTFOUND: HRESULT = 0x88985003u32 as HRESULT; -pub const DWRITE_E_FILEACCESS: HRESULT = 0x88985004u32 as HRESULT; -pub const DWRITE_E_FONTCOLLECTIONOBSOLETE: HRESULT = 0x88985005u32 as HRESULT; -pub const DWRITE_E_ALREADYREGISTERED: HRESULT = 0x88985006u32 as HRESULT; -pub const DWRITE_E_CACHEFORMAT: HRESULT = 0x88985007u32 as HRESULT; -pub const DWRITE_E_CACHEVERSION: HRESULT = 0x88985008u32 as HRESULT; -pub const DWRITE_E_UNSUPPORTEDOPERATION: HRESULT = 0x88985009u32 as HRESULT; -pub const DWRITE_E_TEXTRENDERERINCOMPATIBLE: HRESULT = 0x8898500Au32 as HRESULT; -pub const DWRITE_E_FLOWDIRECTIONCONFLICTS: HRESULT = 0x8898500Bu32 as HRESULT; -pub const DWRITE_E_NOCOLOR: HRESULT = 0x8898500Cu32 as HRESULT; -pub const WINCODEC_ERR_WRONGSTATE: HRESULT = 0x88982F04u32 as HRESULT; -pub const WINCODEC_ERR_VALUEOUTOFRANGE: HRESULT = 0x88982F05u32 as HRESULT; -pub const WINCODEC_ERR_UNKNOWNIMAGEFORMAT: HRESULT = 0x88982F07u32 as HRESULT; -pub const WINCODEC_ERR_UNSUPPORTEDVERSION: HRESULT = 0x88982F0Bu32 as HRESULT; -pub const WINCODEC_ERR_NOTINITIALIZED: HRESULT = 0x88982F0Cu32 as HRESULT; -pub const WINCODEC_ERR_ALREADYLOCKED: HRESULT = 0x88982F0Du32 as HRESULT; -pub const WINCODEC_ERR_PROPERTYNOTFOUND: HRESULT = 0x88982F40u32 as HRESULT; -pub const WINCODEC_ERR_PROPERTYNOTSUPPORTED: HRESULT = 0x88982F41u32 as HRESULT; -pub const WINCODEC_ERR_PROPERTYSIZE: HRESULT = 0x88982F42u32 as HRESULT; -pub const WINCODEC_ERR_CODECPRESENT: HRESULT = 0x88982F43u32 as HRESULT; -pub const WINCODEC_ERR_CODECNOTHUMBNAIL: HRESULT = 0x88982F44u32 as HRESULT; -pub const WINCODEC_ERR_PALETTEUNAVAILABLE: HRESULT = 0x88982F45u32 as HRESULT; -pub const WINCODEC_ERR_CODECTOOMANYSCANLINES: HRESULT = 0x88982F46u32 as HRESULT; -pub const WINCODEC_ERR_INTERNALERROR: HRESULT = 0x88982F48u32 as HRESULT; -pub const WINCODEC_ERR_SOURCERECTDOESNOTMATCHDIMENSIONS: HRESULT = 0x88982F49u32 as HRESULT; -pub const WINCODEC_ERR_COMPONENTNOTFOUND: HRESULT = 0x88982F50u32 as HRESULT; -pub const WINCODEC_ERR_IMAGESIZEOUTOFRANGE: HRESULT = 0x88982F51u32 as HRESULT; -pub const WINCODEC_ERR_TOOMUCHMETADATA: HRESULT = 0x88982F52u32 as HRESULT; -pub const WINCODEC_ERR_BADIMAGE: HRESULT = 0x88982F60u32 as HRESULT; -pub const WINCODEC_ERR_BADHEADER: HRESULT = 0x88982F61u32 as HRESULT; -pub const WINCODEC_ERR_FRAMEMISSING: HRESULT = 0x88982F62u32 as HRESULT; -pub const WINCODEC_ERR_BADMETADATAHEADER: HRESULT = 0x88982F63u32 as HRESULT; -pub const WINCODEC_ERR_BADSTREAMDATA: HRESULT = 0x88982F70u32 as HRESULT; -pub const WINCODEC_ERR_STREAMWRITE: HRESULT = 0x88982F71u32 as HRESULT; -pub const WINCODEC_ERR_STREAMREAD: HRESULT = 0x88982F72u32 as HRESULT; -pub const WINCODEC_ERR_STREAMNOTAVAILABLE: HRESULT = 0x88982F73u32 as HRESULT; -pub const WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT: HRESULT = 0x88982F80u32 as HRESULT; -pub const WINCODEC_ERR_UNSUPPORTEDOPERATION: HRESULT = 0x88982F81u32 as HRESULT; -pub const WINCODEC_ERR_INVALIDREGISTRATION: HRESULT = 0x88982F8Au32 as HRESULT; -pub const WINCODEC_ERR_COMPONENTINITIALIZEFAILURE: HRESULT = 0x88982F8Bu32 as HRESULT; -pub const WINCODEC_ERR_INSUFFICIENTBUFFER: HRESULT = 0x88982F8Cu32 as HRESULT; -pub const WINCODEC_ERR_DUPLICATEMETADATAPRESENT: HRESULT = 0x88982F8Du32 as HRESULT; -pub const WINCODEC_ERR_PROPERTYUNEXPECTEDTYPE: HRESULT = 0x88982F8Eu32 as HRESULT; -pub const WINCODEC_ERR_UNEXPECTEDSIZE: HRESULT = 0x88982F8Fu32 as HRESULT; -pub const WINCODEC_ERR_INVALIDQUERYREQUEST: HRESULT = 0x88982F90u32 as HRESULT; -pub const WINCODEC_ERR_UNEXPECTEDMETADATATYPE: HRESULT = 0x88982F91u32 as HRESULT; -pub const WINCODEC_ERR_REQUESTONLYVALIDATMETADATAROOT: HRESULT = 0x88982F92u32 as HRESULT; -pub const WINCODEC_ERR_INVALIDQUERYCHARACTER: HRESULT = 0x88982F93u32 as HRESULT; -pub const WINCODEC_ERR_WIN32ERROR: HRESULT = 0x88982F94u32 as HRESULT; -pub const WINCODEC_ERR_INVALIDPROGRESSIVELEVEL: HRESULT = 0x88982F95u32 as HRESULT; -pub const MILERR_OBJECTBUSY: HRESULT = 0x88980001u32 as HRESULT; -pub const MILERR_INSUFFICIENTBUFFER: HRESULT = 0x88980002u32 as HRESULT; -pub const MILERR_WIN32ERROR: HRESULT = 0x88980003u32 as HRESULT; -pub const MILERR_SCANNER_FAILED: HRESULT = 0x88980004u32 as HRESULT; -pub const MILERR_SCREENACCESSDENIED: HRESULT = 0x88980005u32 as HRESULT; -pub const MILERR_DISPLAYSTATEINVALID: HRESULT = 0x88980006u32 as HRESULT; -pub const MILERR_NONINVERTIBLEMATRIX: HRESULT = 0x88980007u32 as HRESULT; -pub const MILERR_ZEROVECTOR: HRESULT = 0x88980008u32 as HRESULT; -pub const MILERR_TERMINATED: HRESULT = 0x88980009u32 as HRESULT; -pub const MILERR_BADNUMBER: HRESULT = 0x8898000Au32 as HRESULT; -pub const MILERR_INTERNALERROR: HRESULT = 0x88980080u32 as HRESULT; -pub const MILERR_DISPLAYFORMATNOTSUPPORTED: HRESULT = 0x88980084u32 as HRESULT; -pub const MILERR_INVALIDCALL: HRESULT = 0x88980085u32 as HRESULT; -pub const MILERR_ALREADYLOCKED: HRESULT = 0x88980086u32 as HRESULT; -pub const MILERR_NOTLOCKED: HRESULT = 0x88980087u32 as HRESULT; -pub const MILERR_DEVICECANNOTRENDERTEXT: HRESULT = 0x88980088u32 as HRESULT; -pub const MILERR_GLYPHBITMAPMISSED: HRESULT = 0x88980089u32 as HRESULT; -pub const MILERR_MALFORMEDGLYPHCACHE: HRESULT = 0x8898008Au32 as HRESULT; -pub const MILERR_GENERIC_IGNORE: HRESULT = 0x8898008Bu32 as HRESULT; -pub const MILERR_MALFORMED_GUIDELINE_DATA: HRESULT = 0x8898008Cu32 as HRESULT; -pub const MILERR_NO_HARDWARE_DEVICE: HRESULT = 0x8898008Du32 as HRESULT; -pub const MILERR_NEED_RECREATE_AND_PRESENT: HRESULT = 0x8898008Eu32 as HRESULT; -pub const MILERR_ALREADY_INITIALIZED: HRESULT = 0x8898008Fu32 as HRESULT; -pub const MILERR_MISMATCHED_SIZE: HRESULT = 0x88980090u32 as HRESULT; -pub const MILERR_NO_REDIRECTION_SURFACE_AVAILABLE: HRESULT = 0x88980091u32 as HRESULT; -pub const MILERR_REMOTING_NOT_SUPPORTED: HRESULT = 0x88980092u32 as HRESULT; -pub const MILERR_QUEUED_PRESENT_NOT_SUPPORTED: HRESULT = 0x88980093u32 as HRESULT; -pub const MILERR_NOT_QUEUING_PRESENTS: HRESULT = 0x88980094u32 as HRESULT; -pub const MILERR_NO_REDIRECTION_SURFACE_RETRY_LATER: HRESULT = 0x88980095u32 as HRESULT; -pub const MILERR_TOOMANYSHADERELEMNTS: HRESULT = 0x88980096u32 as HRESULT; -pub const MILERR_MROW_READLOCK_FAILED: HRESULT = 0x88980097u32 as HRESULT; -pub const MILERR_MROW_UPDATE_FAILED: HRESULT = 0x88980098u32 as HRESULT; -pub const MILERR_SHADER_COMPILE_FAILED: HRESULT = 0x88980099u32 as HRESULT; -pub const MILERR_MAX_TEXTURE_SIZE_EXCEEDED: HRESULT = 0x8898009Au32 as HRESULT; -pub const MILERR_QPC_TIME_WENT_BACKWARD: HRESULT = 0x8898009Bu32 as HRESULT; -pub const MILERR_DXGI_ENUMERATION_OUT_OF_SYNC: HRESULT = 0x8898009Du32 as HRESULT; -pub const MILERR_ADAPTER_NOT_FOUND: HRESULT = 0x8898009Eu32 as HRESULT; -pub const MILERR_COLORSPACE_NOT_SUPPORTED: HRESULT = 0x8898009Fu32 as HRESULT; -pub const MILERR_PREFILTER_NOT_SUPPORTED: HRESULT = 0x889800A0u32 as HRESULT; -pub const MILERR_DISPLAYID_ACCESS_DENIED: HRESULT = 0x889800A1u32 as HRESULT; -pub const UCEERR_INVALIDPACKETHEADER: HRESULT = 0x88980400u32 as HRESULT; -pub const UCEERR_UNKNOWNPACKET: HRESULT = 0x88980401u32 as HRESULT; -pub const UCEERR_ILLEGALPACKET: HRESULT = 0x88980402u32 as HRESULT; -pub const UCEERR_MALFORMEDPACKET: HRESULT = 0x88980403u32 as HRESULT; -pub const UCEERR_ILLEGALHANDLE: HRESULT = 0x88980404u32 as HRESULT; -pub const UCEERR_HANDLELOOKUPFAILED: HRESULT = 0x88980405u32 as HRESULT; -pub const UCEERR_RENDERTHREADFAILURE: HRESULT = 0x88980406u32 as HRESULT; -pub const UCEERR_CTXSTACKFRSTTARGETNULL: HRESULT = 0x88980407u32 as HRESULT; -pub const UCEERR_CONNECTIONIDLOOKUPFAILED: HRESULT = 0x88980408u32 as HRESULT; -pub const UCEERR_BLOCKSFULL: HRESULT = 0x88980409u32 as HRESULT; -pub const UCEERR_MEMORYFAILURE: HRESULT = 0x8898040Au32 as HRESULT; -pub const UCEERR_PACKETRECORDOUTOFRANGE: HRESULT = 0x8898040Bu32 as HRESULT; -pub const UCEERR_ILLEGALRECORDTYPE: HRESULT = 0x8898040Cu32 as HRESULT; -pub const UCEERR_OUTOFHANDLES: HRESULT = 0x8898040Du32 as HRESULT; -pub const UCEERR_UNCHANGABLE_UPDATE_ATTEMPTED: HRESULT = 0x8898040Eu32 as HRESULT; -pub const UCEERR_NO_MULTIPLE_WORKER_THREADS: HRESULT = 0x8898040Fu32 as HRESULT; -pub const UCEERR_REMOTINGNOTSUPPORTED: HRESULT = 0x88980410u32 as HRESULT; -pub const UCEERR_MISSINGENDCOMMAND: HRESULT = 0x88980411u32 as HRESULT; -pub const UCEERR_MISSINGBEGINCOMMAND: HRESULT = 0x88980412u32 as HRESULT; -pub const UCEERR_CHANNELSYNCTIMEDOUT: HRESULT = 0x88980413u32 as HRESULT; -pub const UCEERR_CHANNELSYNCABANDONED: HRESULT = 0x88980414u32 as HRESULT; -pub const UCEERR_UNSUPPORTEDTRANSPORTVERSION: HRESULT = 0x88980415u32 as HRESULT; -pub const UCEERR_TRANSPORTUNAVAILABLE: HRESULT = 0x88980416u32 as HRESULT; -pub const UCEERR_FEEDBACK_UNSUPPORTED: HRESULT = 0x88980417u32 as HRESULT; -pub const UCEERR_COMMANDTRANSPORTDENIED: HRESULT = 0x88980418u32 as HRESULT; -pub const UCEERR_GRAPHICSSTREAMUNAVAILABLE: HRESULT = 0x88980419u32 as HRESULT; -pub const UCEERR_GRAPHICSSTREAMALREADYOPEN: HRESULT = 0x88980420u32 as HRESULT; -pub const UCEERR_TRANSPORTDISCONNECTED: HRESULT = 0x88980421u32 as HRESULT; -pub const UCEERR_TRANSPORTOVERLOADED: HRESULT = 0x88980422u32 as HRESULT; -pub const UCEERR_PARTITION_ZOMBIED: HRESULT = 0x88980423u32 as HRESULT; -pub const MILAVERR_NOCLOCK: HRESULT = 0x88980500u32 as HRESULT; -pub const MILAVERR_NOMEDIATYPE: HRESULT = 0x88980501u32 as HRESULT; -pub const MILAVERR_NOVIDEOMIXER: HRESULT = 0x88980502u32 as HRESULT; -pub const MILAVERR_NOVIDEOPRESENTER: HRESULT = 0x88980503u32 as HRESULT; -pub const MILAVERR_NOREADYFRAMES: HRESULT = 0x88980504u32 as HRESULT; -pub const MILAVERR_MODULENOTLOADED: HRESULT = 0x88980505u32 as HRESULT; -pub const MILAVERR_WMPFACTORYNOTREGISTERED: HRESULT = 0x88980506u32 as HRESULT; -pub const MILAVERR_INVALIDWMPVERSION: HRESULT = 0x88980507u32 as HRESULT; -pub const MILAVERR_INSUFFICIENTVIDEORESOURCES: HRESULT = 0x88980508u32 as HRESULT; -pub const MILAVERR_VIDEOACCELERATIONNOTAVAILABLE: HRESULT = 0x88980509u32 as HRESULT; -pub const MILAVERR_REQUESTEDTEXTURETOOBIG: HRESULT = 0x8898050Au32 as HRESULT; -pub const MILAVERR_SEEKFAILED: HRESULT = 0x8898050Bu32 as HRESULT; -pub const MILAVERR_UNEXPECTEDWMPFAILURE: HRESULT = 0x8898050Cu32 as HRESULT; -pub const MILAVERR_MEDIAPLAYERCLOSED: HRESULT = 0x8898050Du32 as HRESULT; -pub const MILAVERR_UNKNOWNHARDWAREERROR: HRESULT = 0x8898050Eu32 as HRESULT; -pub const MILEFFECTSERR_UNKNOWNPROPERTY: HRESULT = 0x8898060Eu32 as HRESULT; -pub const MILEFFECTSERR_EFFECTNOTPARTOFGROUP: HRESULT = 0x8898060Fu32 as HRESULT; -pub const MILEFFECTSERR_NOINPUTSOURCEATTACHED: HRESULT = 0x88980610u32 as HRESULT; -pub const MILEFFECTSERR_CONNECTORNOTCONNECTED: HRESULT = 0x88980611u32 as HRESULT; -pub const MILEFFECTSERR_CONNECTORNOTASSOCIATEDWITHEFFECT: HRESULT = 0x88980612u32 as HRESULT; -pub const MILEFFECTSERR_RESERVED: HRESULT = 0x88980613u32 as HRESULT; -pub const MILEFFECTSERR_CYCLEDETECTED: HRESULT = 0x88980614u32 as HRESULT; -pub const MILEFFECTSERR_EFFECTINMORETHANONEGRAPH: HRESULT = 0x88980615u32 as HRESULT; -pub const MILEFFECTSERR_EFFECTALREADYINAGRAPH: HRESULT = 0x88980616u32 as HRESULT; -pub const MILEFFECTSERR_EFFECTHASNOCHILDREN: HRESULT = 0x88980617u32 as HRESULT; -pub const MILEFFECTSERR_ALREADYATTACHEDTOLISTENER: HRESULT = 0x88980618u32 as HRESULT; -pub const MILEFFECTSERR_NOTAFFINETRANSFORM: HRESULT = 0x88980619u32 as HRESULT; -pub const MILEFFECTSERR_EMPTYBOUNDS: HRESULT = 0x8898061Au32 as HRESULT; -pub const MILEFFECTSERR_OUTPUTSIZETOOLARGE: HRESULT = 0x8898061Bu32 as HRESULT; -pub const DWMERR_STATE_TRANSITION_FAILED: HRESULT = 0x88980700u32 as HRESULT; -pub const DWMERR_THEME_FAILED: HRESULT = 0x88980701u32 as HRESULT; -pub const DWMERR_CATASTROPHIC_FAILURE: HRESULT = 0x88980702u32 as HRESULT; -pub const DCOMPOSITION_ERROR_WINDOW_ALREADY_COMPOSED: HRESULT = 0x88980800u32 as HRESULT; -pub const DCOMPOSITION_ERROR_SURFACE_BEING_RENDERED: HRESULT = 0x88980801u32 as HRESULT; -pub const DCOMPOSITION_ERROR_SURFACE_NOT_BEING_RENDERED: HRESULT = 0x88980802u32 as HRESULT; -pub const ONL_E_INVALID_AUTHENTICATION_TARGET: HRESULT = 0x80860001u32 as HRESULT; -pub const ONL_E_ACCESS_DENIED_BY_TOU: HRESULT = 0x80860002u32 as HRESULT; -pub const ONL_E_INVALID_APPLICATION: HRESULT = 0x80860003u32 as HRESULT; -pub const ONL_E_PASSWORD_UPDATE_REQUIRED: HRESULT = 0x80860004u32 as HRESULT; -pub const ONL_E_ACCOUNT_UPDATE_REQUIRED: HRESULT = 0x80860005u32 as HRESULT; -pub const ONL_E_FORCESIGNIN: HRESULT = 0x80860006u32 as HRESULT; -pub const ONL_E_ACCOUNT_LOCKED: HRESULT = 0x80860007u32 as HRESULT; -pub const ONL_E_PARENTAL_CONSENT_REQUIRED: HRESULT = 0x80860008u32 as HRESULT; -pub const ONL_E_EMAIL_VERIFICATION_REQUIRED: HRESULT = 0x80860009u32 as HRESULT; -pub const ONL_E_ACCOUNT_SUSPENDED_COMPROIMISE: HRESULT = 0x8086000Au32 as HRESULT; -pub const ONL_E_ACCOUNT_SUSPENDED_ABUSE: HRESULT = 0x8086000Bu32 as HRESULT; -pub const ONL_E_ACTION_REQUIRED: HRESULT = 0x8086000Cu32 as HRESULT; -pub const ONL_CONNECTION_COUNT_LIMIT: HRESULT = 0x8086000Du32 as HRESULT; -pub const ONL_E_CONNECTED_ACCOUNT_CAN_NOT_SIGNOUT: HRESULT = 0x8086000Eu32 as HRESULT; -pub const ONL_E_USER_AUTHENTICATION_REQUIRED: HRESULT = 0x8086000Fu32 as HRESULT; -pub const ONL_E_REQUEST_THROTTLED: HRESULT = 0x80860010u32 as HRESULT; -pub const FA_E_MAX_PERSISTED_ITEMS_REACHED: HRESULT = 0x80270220u32 as HRESULT; -pub const FA_E_HOMEGROUP_NOT_AVAILABLE: HRESULT = 0x80270222u32 as HRESULT; -pub const E_MONITOR_RESOLUTION_TOO_LOW: HRESULT = 0x80270250u32 as HRESULT; -pub const E_ELEVATED_ACTIVATION_NOT_SUPPORTED: HRESULT = 0x80270251u32 as HRESULT; -pub const E_UAC_DISABLED: HRESULT = 0x80270252u32 as HRESULT; -pub const E_FULL_ADMIN_NOT_SUPPORTED: HRESULT = 0x80270253u32 as HRESULT; -pub const E_APPLICATION_NOT_REGISTERED: HRESULT = 0x80270254u32 as HRESULT; -pub const E_MULTIPLE_EXTENSIONS_FOR_APPLICATION: HRESULT = 0x80270255u32 as HRESULT; -pub const E_MULTIPLE_PACKAGES_FOR_FAMILY: HRESULT = 0x80270256u32 as HRESULT; -pub const E_APPLICATION_MANAGER_NOT_RUNNING: HRESULT = 0x80270257u32 as HRESULT; -pub const S_STORE_LAUNCHED_FOR_REMEDIATION: HRESULT = 0x00270258; -pub const S_APPLICATION_ACTIVATION_ERROR_HANDLED_BY_DIALOG: HRESULT = 0x00270259; -pub const E_APPLICATION_ACTIVATION_TIMED_OUT: HRESULT = 0x8027025Au32 as HRESULT; -pub const E_APPLICATION_ACTIVATION_EXEC_FAILURE: HRESULT = 0x8027025Bu32 as HRESULT; -pub const E_APPLICATION_TEMPORARY_LICENSE_ERROR: HRESULT = 0x8027025Cu32 as HRESULT; -pub const E_APPLICATION_TRIAL_LICENSE_EXPIRED: HRESULT = 0x8027025Du32 as HRESULT; -pub const E_SKYDRIVE_ROOT_TARGET_FILE_SYSTEM_NOT_SUPPORTED: HRESULT = 0x80270260u32 as HRESULT; -pub const E_SKYDRIVE_ROOT_TARGET_OVERLAP: HRESULT = 0x80270261u32 as HRESULT; -pub const E_SKYDRIVE_ROOT_TARGET_CANNOT_INDEX: HRESULT = 0x80270262u32 as HRESULT; -pub const E_SKYDRIVE_FILE_NOT_UPLOADED: HRESULT = 0x80270263u32 as HRESULT; -pub const E_SKYDRIVE_UPDATE_AVAILABILITY_FAIL: HRESULT = 0x80270264u32 as HRESULT; -pub const E_SKYDRIVE_ROOT_TARGET_VOLUME_ROOT_NOT_SUPPORTED: HRESULT = 0x80270265u32 as HRESULT; -pub const E_SYNCENGINE_FILE_SIZE_OVER_LIMIT: HRESULT = 0x8802B001u32 as HRESULT; -pub const E_SYNCENGINE_FILE_SIZE_EXCEEDS_REMAINING_QUOTA: HRESULT = 0x8802B002u32 as HRESULT; -pub const E_SYNCENGINE_UNSUPPORTED_FILE_NAME: HRESULT = 0x8802B003u32 as HRESULT; -pub const E_SYNCENGINE_FOLDER_ITEM_COUNT_LIMIT_EXCEEDED: HRESULT = 0x8802B004u32 as HRESULT; -pub const E_SYNCENGINE_FILE_SYNC_PARTNER_ERROR: HRESULT = 0x8802B005u32 as HRESULT; -pub const E_SYNCENGINE_SYNC_PAUSED_BY_SERVICE: HRESULT = 0x8802B006u32 as HRESULT; -pub const E_SYNCENGINE_FILE_IDENTIFIER_UNKNOWN: HRESULT = 0x8802C002u32 as HRESULT; -pub const E_SYNCENGINE_SERVICE_AUTHENTICATION_FAILED: HRESULT = 0x8802C003u32 as HRESULT; -pub const E_SYNCENGINE_UNKNOWN_SERVICE_ERROR: HRESULT = 0x8802C004u32 as HRESULT; -pub const E_SYNCENGINE_SERVICE_RETURNED_UNEXPECTED_SIZE: HRESULT = 0x8802C005u32 as HRESULT; -pub const E_SYNCENGINE_REQUEST_BLOCKED_BY_SERVICE: HRESULT = 0x8802C006u32 as HRESULT; -pub const E_SYNCENGINE_REQUEST_BLOCKED_DUE_TO_CLIENT_ERROR: HRESULT = 0x8802C007u32 as HRESULT; -pub const E_SYNCENGINE_FOLDER_INACCESSIBLE: HRESULT = 0x8802D001u32 as HRESULT; -pub const E_SYNCENGINE_UNSUPPORTED_FOLDER_NAME: HRESULT = 0x8802D002u32 as HRESULT; -pub const E_SYNCENGINE_UNSUPPORTED_MARKET: HRESULT = 0x8802D003u32 as HRESULT; -pub const E_SYNCENGINE_PATH_LENGTH_LIMIT_EXCEEDED: HRESULT = 0x8802D004u32 as HRESULT; -pub const E_SYNCENGINE_REMOTE_PATH_LENGTH_LIMIT_EXCEEDED: HRESULT = 0x8802D005u32 as HRESULT; -pub const E_SYNCENGINE_CLIENT_UPDATE_NEEDED: HRESULT = 0x8802D006u32 as HRESULT; -pub const E_SYNCENGINE_PROXY_AUTHENTICATION_REQUIRED: HRESULT = 0x8802D007u32 as HRESULT; -pub const E_SYNCENGINE_STORAGE_SERVICE_PROVISIONING_FAILED: HRESULT = 0x8802D008u32 as HRESULT; -pub const E_SYNCENGINE_UNSUPPORTED_REPARSE_POINT: HRESULT = 0x8802D009u32 as HRESULT; -pub const E_SYNCENGINE_STORAGE_SERVICE_BLOCKED: HRESULT = 0x8802D00Au32 as HRESULT; -pub const E_SYNCENGINE_FOLDER_IN_REDIRECTION: HRESULT = 0x8802D00Bu32 as HRESULT; -pub const EAS_E_POLICY_NOT_MANAGED_BY_OS: HRESULT = 0x80550001u32 as HRESULT; -pub const EAS_E_POLICY_COMPLIANT_WITH_ACTIONS: HRESULT = 0x80550002u32 as HRESULT; -pub const EAS_E_REQUESTED_POLICY_NOT_ENFORCEABLE: HRESULT = 0x80550003u32 as HRESULT; -pub const EAS_E_CURRENT_USER_HAS_BLANK_PASSWORD: HRESULT = 0x80550004u32 as HRESULT; -pub const EAS_E_REQUESTED_POLICY_PASSWORD_EXPIRATION_INCOMPATIBLE: HRESULT = 0x80550005u32 as HRESULT; -pub const EAS_E_USER_CANNOT_CHANGE_PASSWORD: HRESULT = 0x80550006u32 as HRESULT; -pub const EAS_E_ADMINS_HAVE_BLANK_PASSWORD: HRESULT = 0x80550007u32 as HRESULT; -pub const EAS_E_ADMINS_CANNOT_CHANGE_PASSWORD: HRESULT = 0x80550008u32 as HRESULT; -pub const EAS_E_LOCAL_CONTROLLED_USERS_CANNOT_CHANGE_PASSWORD: HRESULT = 0x80550009u32 as HRESULT; -pub const EAS_E_PASSWORD_POLICY_NOT_ENFORCEABLE_FOR_CONNECTED_ADMINS: HRESULT = 0x8055000Au32 as HRESULT; -pub const EAS_E_CONNECTED_ADMINS_NEED_TO_CHANGE_PASSWORD: HRESULT = 0x8055000Bu32 as HRESULT; -pub const EAS_E_PASSWORD_POLICY_NOT_ENFORCEABLE_FOR_CURRENT_CONNECTED_USER: HRESULT = 0x8055000Cu32 as HRESULT; -pub const EAS_E_CURRENT_CONNECTED_USER_NEED_TO_CHANGE_PASSWORD: HRESULT = 0x8055000Du32 as HRESULT; -pub const WEB_E_UNSUPPORTED_FORMAT: HRESULT = 0x83750001u32 as HRESULT; -pub const WEB_E_INVALID_XML: HRESULT = 0x83750002u32 as HRESULT; -pub const WEB_E_MISSING_REQUIRED_ELEMENT: HRESULT = 0x83750003u32 as HRESULT; -pub const WEB_E_MISSING_REQUIRED_ATTRIBUTE: HRESULT = 0x83750004u32 as HRESULT; -pub const WEB_E_UNEXPECTED_CONTENT: HRESULT = 0x83750005u32 as HRESULT; -pub const WEB_E_RESOURCE_TOO_LARGE: HRESULT = 0x83750006u32 as HRESULT; -pub const WEB_E_INVALID_JSON_STRING: HRESULT = 0x83750007u32 as HRESULT; -pub const WEB_E_INVALID_JSON_NUMBER: HRESULT = 0x83750008u32 as HRESULT; -pub const WEB_E_JSON_VALUE_NOT_FOUND: HRESULT = 0x83750009u32 as HRESULT; -pub const HTTP_E_STATUS_UNEXPECTED: HRESULT = 0x80190001u32 as HRESULT; -pub const HTTP_E_STATUS_UNEXPECTED_REDIRECTION: HRESULT = 0x80190003u32 as HRESULT; -pub const HTTP_E_STATUS_UNEXPECTED_CLIENT_ERROR: HRESULT = 0x80190004u32 as HRESULT; -pub const HTTP_E_STATUS_UNEXPECTED_SERVER_ERROR: HRESULT = 0x80190005u32 as HRESULT; -pub const HTTP_E_STATUS_AMBIGUOUS: HRESULT = 0x8019012Cu32 as HRESULT; -pub const HTTP_E_STATUS_MOVED: HRESULT = 0x8019012Du32 as HRESULT; -pub const HTTP_E_STATUS_REDIRECT: HRESULT = 0x8019012Eu32 as HRESULT; -pub const HTTP_E_STATUS_REDIRECT_METHOD: HRESULT = 0x8019012Fu32 as HRESULT; -pub const HTTP_E_STATUS_NOT_MODIFIED: HRESULT = 0x80190130u32 as HRESULT; -pub const HTTP_E_STATUS_USE_PROXY: HRESULT = 0x80190131u32 as HRESULT; -pub const HTTP_E_STATUS_REDIRECT_KEEP_VERB: HRESULT = 0x80190133u32 as HRESULT; -pub const HTTP_E_STATUS_BAD_REQUEST: HRESULT = 0x80190190u32 as HRESULT; -pub const HTTP_E_STATUS_DENIED: HRESULT = 0x80190191u32 as HRESULT; -pub const HTTP_E_STATUS_PAYMENT_REQ: HRESULT = 0x80190192u32 as HRESULT; -pub const HTTP_E_STATUS_FORBIDDEN: HRESULT = 0x80190193u32 as HRESULT; -pub const HTTP_E_STATUS_NOT_FOUND: HRESULT = 0x80190194u32 as HRESULT; -pub const HTTP_E_STATUS_BAD_METHOD: HRESULT = 0x80190195u32 as HRESULT; -pub const HTTP_E_STATUS_NONE_ACCEPTABLE: HRESULT = 0x80190196u32 as HRESULT; -pub const HTTP_E_STATUS_PROXY_AUTH_REQ: HRESULT = 0x80190197u32 as HRESULT; -pub const HTTP_E_STATUS_REQUEST_TIMEOUT: HRESULT = 0x80190198u32 as HRESULT; -pub const HTTP_E_STATUS_CONFLICT: HRESULT = 0x80190199u32 as HRESULT; -pub const HTTP_E_STATUS_GONE: HRESULT = 0x8019019Au32 as HRESULT; -pub const HTTP_E_STATUS_LENGTH_REQUIRED: HRESULT = 0x8019019Bu32 as HRESULT; -pub const HTTP_E_STATUS_PRECOND_FAILED: HRESULT = 0x8019019Cu32 as HRESULT; -pub const HTTP_E_STATUS_REQUEST_TOO_LARGE: HRESULT = 0x8019019Du32 as HRESULT; -pub const HTTP_E_STATUS_URI_TOO_LONG: HRESULT = 0x8019019Eu32 as HRESULT; -pub const HTTP_E_STATUS_UNSUPPORTED_MEDIA: HRESULT = 0x8019019Fu32 as HRESULT; -pub const HTTP_E_STATUS_RANGE_NOT_SATISFIABLE: HRESULT = 0x801901A0u32 as HRESULT; -pub const HTTP_E_STATUS_EXPECTATION_FAILED: HRESULT = 0x801901A1u32 as HRESULT; -pub const HTTP_E_STATUS_SERVER_ERROR: HRESULT = 0x801901F4u32 as HRESULT; -pub const HTTP_E_STATUS_NOT_SUPPORTED: HRESULT = 0x801901F5u32 as HRESULT; -pub const HTTP_E_STATUS_BAD_GATEWAY: HRESULT = 0x801901F6u32 as HRESULT; -pub const HTTP_E_STATUS_SERVICE_UNAVAIL: HRESULT = 0x801901F7u32 as HRESULT; -pub const HTTP_E_STATUS_GATEWAY_TIMEOUT: HRESULT = 0x801901F8u32 as HRESULT; -pub const HTTP_E_STATUS_VERSION_NOT_SUP: HRESULT = 0x801901F9u32 as HRESULT; -pub const E_INVALID_PROTOCOL_OPERATION: HRESULT = 0x83760001u32 as HRESULT; -pub const E_INVALID_PROTOCOL_FORMAT: HRESULT = 0x83760002u32 as HRESULT; -pub const E_PROTOCOL_EXTENSIONS_NOT_SUPPORTED: HRESULT = 0x83760003u32 as HRESULT; -pub const E_SUBPROTOCOL_NOT_SUPPORTED: HRESULT = 0x83760004u32 as HRESULT; -pub const E_PROTOCOL_VERSION_NOT_SUPPORTED: HRESULT = 0x83760005u32 as HRESULT; -pub const INPUT_E_OUT_OF_ORDER: HRESULT = 0x80400000u32 as HRESULT; -pub const INPUT_E_REENTRANCY: HRESULT = 0x80400001u32 as HRESULT; -pub const INPUT_E_MULTIMODAL: HRESULT = 0x80400002u32 as HRESULT; -pub const INPUT_E_PACKET: HRESULT = 0x80400003u32 as HRESULT; -pub const INPUT_E_FRAME: HRESULT = 0x80400004u32 as HRESULT; -pub const INPUT_E_HISTORY: HRESULT = 0x80400005u32 as HRESULT; -pub const INPUT_E_DEVICE_INFO: HRESULT = 0x80400006u32 as HRESULT; -pub const INPUT_E_TRANSFORM: HRESULT = 0x80400007u32 as HRESULT; -pub const INPUT_E_DEVICE_PROPERTY: HRESULT = 0x80400008u32 as HRESULT; -pub const INET_E_INVALID_URL: HRESULT = 0x800C0002u32 as HRESULT; -pub const INET_E_NO_SESSION: HRESULT = 0x800C0003u32 as HRESULT; -pub const INET_E_CANNOT_CONNECT: HRESULT = 0x800C0004u32 as HRESULT; -pub const INET_E_RESOURCE_NOT_FOUND: HRESULT = 0x800C0005u32 as HRESULT; -pub const INET_E_OBJECT_NOT_FOUND: HRESULT = 0x800C0006u32 as HRESULT; -pub const INET_E_DATA_NOT_AVAILABLE: HRESULT = 0x800C0007u32 as HRESULT; -pub const INET_E_DOWNLOAD_FAILURE: HRESULT = 0x800C0008u32 as HRESULT; -pub const INET_E_AUTHENTICATION_REQUIRED: HRESULT = 0x800C0009u32 as HRESULT; -pub const INET_E_NO_VALID_MEDIA: HRESULT = 0x800C000Au32 as HRESULT; -pub const INET_E_CONNECTION_TIMEOUT: HRESULT = 0x800C000Bu32 as HRESULT; -pub const INET_E_INVALID_REQUEST: HRESULT = 0x800C000Cu32 as HRESULT; -pub const INET_E_UNKNOWN_PROTOCOL: HRESULT = 0x800C000Du32 as HRESULT; -pub const INET_E_SECURITY_PROBLEM: HRESULT = 0x800C000Eu32 as HRESULT; -pub const INET_E_CANNOT_LOAD_DATA: HRESULT = 0x800C000Fu32 as HRESULT; -pub const INET_E_CANNOT_INSTANTIATE_OBJECT: HRESULT = 0x800C0010u32 as HRESULT; -pub const INET_E_INVALID_CERTIFICATE: HRESULT = 0x800C0019u32 as HRESULT; -pub const INET_E_REDIRECT_FAILED: HRESULT = 0x800C0014u32 as HRESULT; -pub const INET_E_REDIRECT_TO_DIR: HRESULT = 0x800C0015u32 as HRESULT; -pub const ERROR_DBG_CREATE_PROCESS_FAILURE_LOCKDOWN: HRESULT = 0x80B00001u32 as HRESULT; -pub const ERROR_DBG_ATTACH_PROCESS_FAILURE_LOCKDOWN: HRESULT = 0x80B00002u32 as HRESULT; -pub const ERROR_DBG_CONNECT_SERVER_FAILURE_LOCKDOWN: HRESULT = 0x80B00003u32 as HRESULT; -pub const ERROR_DBG_START_SERVER_FAILURE_LOCKDOWN: HRESULT = 0x80B00004u32 as HRESULT; -pub const ERROR_IO_PREEMPTED: HRESULT = 0x89010001u32 as HRESULT; -pub const JSCRIPT_E_CANTEXECUTE: HRESULT = 0x89020001u32 as HRESULT; -pub const WEP_E_NOT_PROVISIONED_ON_ALL_VOLUMES: HRESULT = 0x88010001u32 as HRESULT; -pub const WEP_E_FIXED_DATA_NOT_SUPPORTED: HRESULT = 0x88010002u32 as HRESULT; -pub const WEP_E_HARDWARE_NOT_COMPLIANT: HRESULT = 0x88010003u32 as HRESULT; -pub const WEP_E_LOCK_NOT_CONFIGURED: HRESULT = 0x88010004u32 as HRESULT; -pub const WEP_E_PROTECTION_SUSPENDED: HRESULT = 0x88010005u32 as HRESULT; -pub const WEP_E_NO_LICENSE: HRESULT = 0x88010006u32 as HRESULT; -pub const WEP_E_OS_NOT_PROTECTED: HRESULT = 0x88010007u32 as HRESULT; -pub const WEP_E_UNEXPECTED_FAIL: HRESULT = 0x88010008u32 as HRESULT; -pub const WEP_E_BUFFER_TOO_LARGE: HRESULT = 0x88010009u32 as HRESULT; -pub const ERROR_SVHDX_ERROR_STORED: HRESULT = 0xC05C0000u32 as HRESULT; -pub const ERROR_SVHDX_ERROR_NOT_AVAILABLE: HRESULT = 0xC05CFF00u32 as HRESULT; -pub const ERROR_SVHDX_UNIT_ATTENTION_AVAILABLE: HRESULT = 0xC05CFF01u32 as HRESULT; -pub const ERROR_SVHDX_UNIT_ATTENTION_CAPACITY_DATA_CHANGED: HRESULT = 0xC05CFF02u32 as HRESULT; -pub const ERROR_SVHDX_UNIT_ATTENTION_RESERVATIONS_PREEMPTED: HRESULT = 0xC05CFF03u32 as HRESULT; -pub const ERROR_SVHDX_UNIT_ATTENTION_RESERVATIONS_RELEASED: HRESULT = 0xC05CFF04u32 as HRESULT; -pub const ERROR_SVHDX_UNIT_ATTENTION_REGISTRATIONS_PREEMPTED: HRESULT = 0xC05CFF05u32 as HRESULT; -pub const ERROR_SVHDX_UNIT_ATTENTION_OPERATING_DEFINITION_CHANGED: HRESULT = 0xC05CFF06u32 as HRESULT; -pub const ERROR_SVHDX_RESERVATION_CONFLICT: HRESULT = 0xC05CFF07u32 as HRESULT; -pub const ERROR_SVHDX_WRONG_FILE_TYPE: HRESULT = 0xC05CFF08u32 as HRESULT; -pub const ERROR_SVHDX_VERSION_MISMATCH: HRESULT = 0xC05CFF09u32 as HRESULT; -pub const ERROR_VHD_SHARED: HRESULT = 0xC05CFF0Au32 as HRESULT; -pub const WININET_E_OUT_OF_HANDLES: HRESULT = 0x80072EE1u32 as HRESULT; -pub const WININET_E_TIMEOUT: HRESULT = 0x80072EE2u32 as HRESULT; -pub const WININET_E_EXTENDED_ERROR: HRESULT = 0x80072EE3u32 as HRESULT; -pub const WININET_E_INTERNAL_ERROR: HRESULT = 0x80072EE4u32 as HRESULT; -pub const WININET_E_INVALID_URL: HRESULT = 0x80072EE5u32 as HRESULT; -pub const WININET_E_UNRECOGNIZED_SCHEME: HRESULT = 0x80072EE6u32 as HRESULT; -pub const WININET_E_NAME_NOT_RESOLVED: HRESULT = 0x80072EE7u32 as HRESULT; -pub const WININET_E_PROTOCOL_NOT_FOUND: HRESULT = 0x80072EE8u32 as HRESULT; -pub const WININET_E_INVALID_OPTION: HRESULT = 0x80072EE9u32 as HRESULT; -pub const WININET_E_BAD_OPTION_LENGTH: HRESULT = 0x80072EEAu32 as HRESULT; -pub const WININET_E_OPTION_NOT_SETTABLE: HRESULT = 0x80072EEBu32 as HRESULT; -pub const WININET_E_SHUTDOWN: HRESULT = 0x80072EECu32 as HRESULT; -pub const WININET_E_INCORRECT_USER_NAME: HRESULT = 0x80072EEDu32 as HRESULT; -pub const WININET_E_INCORRECT_PASSWORD: HRESULT = 0x80072EEEu32 as HRESULT; -pub const WININET_E_LOGIN_FAILURE: HRESULT = 0x80072EEFu32 as HRESULT; -pub const WININET_E_INVALID_OPERATION: HRESULT = 0x80072EF0u32 as HRESULT; -pub const WININET_E_OPERATION_CANCELLED: HRESULT = 0x80072EF1u32 as HRESULT; -pub const WININET_E_INCORRECT_HANDLE_TYPE: HRESULT = 0x80072EF2u32 as HRESULT; -pub const WININET_E_INCORRECT_HANDLE_STATE: HRESULT = 0x80072EF3u32 as HRESULT; -pub const WININET_E_NOT_PROXY_REQUEST: HRESULT = 0x80072EF4u32 as HRESULT; -pub const WININET_E_REGISTRY_VALUE_NOT_FOUND: HRESULT = 0x80072EF5u32 as HRESULT; -pub const WININET_E_BAD_REGISTRY_PARAMETER: HRESULT = 0x80072EF6u32 as HRESULT; -pub const WININET_E_NO_DIRECT_ACCESS: HRESULT = 0x80072EF7u32 as HRESULT; -pub const WININET_E_NO_CONTEXT: HRESULT = 0x80072EF8u32 as HRESULT; -pub const WININET_E_NO_CALLBACK: HRESULT = 0x80072EF9u32 as HRESULT; -pub const WININET_E_REQUEST_PENDING: HRESULT = 0x80072EFAu32 as HRESULT; -pub const WININET_E_INCORRECT_FORMAT: HRESULT = 0x80072EFBu32 as HRESULT; -pub const WININET_E_ITEM_NOT_FOUND: HRESULT = 0x80072EFCu32 as HRESULT; -pub const WININET_E_CANNOT_CONNECT: HRESULT = 0x80072EFDu32 as HRESULT; -pub const WININET_E_CONNECTION_ABORTED: HRESULT = 0x80072EFEu32 as HRESULT; -pub const WININET_E_CONNECTION_RESET: HRESULT = 0x80072EFFu32 as HRESULT; -pub const WININET_E_FORCE_RETRY: HRESULT = 0x80072F00u32 as HRESULT; -pub const WININET_E_INVALID_PROXY_REQUEST: HRESULT = 0x80072F01u32 as HRESULT; -pub const WININET_E_NEED_UI: HRESULT = 0x80072F02u32 as HRESULT; -pub const WININET_E_HANDLE_EXISTS: HRESULT = 0x80072F04u32 as HRESULT; -pub const WININET_E_SEC_CERT_DATE_INVALID: HRESULT = 0x80072F05u32 as HRESULT; -pub const WININET_E_SEC_CERT_CN_INVALID: HRESULT = 0x80072F06u32 as HRESULT; -pub const WININET_E_HTTP_TO_HTTPS_ON_REDIR: HRESULT = 0x80072F07u32 as HRESULT; -pub const WININET_E_HTTPS_TO_HTTP_ON_REDIR: HRESULT = 0x80072F08u32 as HRESULT; -pub const WININET_E_MIXED_SECURITY: HRESULT = 0x80072F09u32 as HRESULT; -pub const WININET_E_CHG_POST_IS_NON_SECURE: HRESULT = 0x80072F0Au32 as HRESULT; -pub const WININET_E_POST_IS_NON_SECURE: HRESULT = 0x80072F0Bu32 as HRESULT; -pub const WININET_E_CLIENT_AUTH_CERT_NEEDED: HRESULT = 0x80072F0Cu32 as HRESULT; -pub const WININET_E_INVALID_CA: HRESULT = 0x80072F0Du32 as HRESULT; -pub const WININET_E_CLIENT_AUTH_NOT_SETUP: HRESULT = 0x80072F0Eu32 as HRESULT; -pub const WININET_E_ASYNC_THREAD_FAILED: HRESULT = 0x80072F0Fu32 as HRESULT; -pub const WININET_E_REDIRECT_SCHEME_CHANGE: HRESULT = 0x80072F10u32 as HRESULT; -pub const WININET_E_DIALOG_PENDING: HRESULT = 0x80072F11u32 as HRESULT; -pub const WININET_E_RETRY_DIALOG: HRESULT = 0x80072F12u32 as HRESULT; -pub const WININET_E_NO_NEW_CONTAINERS: HRESULT = 0x80072F13u32 as HRESULT; -pub const WININET_E_HTTPS_HTTP_SUBMIT_REDIR: HRESULT = 0x80072F14u32 as HRESULT; -pub const WININET_E_SEC_CERT_ERRORS: HRESULT = 0x80072F17u32 as HRESULT; -pub const WININET_E_SEC_CERT_REV_FAILED: HRESULT = 0x80072F19u32 as HRESULT; -pub const WININET_E_HEADER_NOT_FOUND: HRESULT = 0x80072F76u32 as HRESULT; -pub const WININET_E_DOWNLEVEL_SERVER: HRESULT = 0x80072F77u32 as HRESULT; -pub const WININET_E_INVALID_SERVER_RESPONSE: HRESULT = 0x80072F78u32 as HRESULT; -pub const WININET_E_INVALID_HEADER: HRESULT = 0x80072F79u32 as HRESULT; -pub const WININET_E_INVALID_QUERY_REQUEST: HRESULT = 0x80072F7Au32 as HRESULT; -pub const WININET_E_HEADER_ALREADY_EXISTS: HRESULT = 0x80072F7Bu32 as HRESULT; -pub const WININET_E_REDIRECT_FAILED: HRESULT = 0x80072F7Cu32 as HRESULT; -pub const WININET_E_SECURITY_CHANNEL_ERROR: HRESULT = 0x80072F7Du32 as HRESULT; -pub const WININET_E_UNABLE_TO_CACHE_FILE: HRESULT = 0x80072F7Eu32 as HRESULT; -pub const WININET_E_TCPIP_NOT_INSTALLED: HRESULT = 0x80072F7Fu32 as HRESULT; -pub const WININET_E_DISCONNECTED: HRESULT = 0x80072F83u32 as HRESULT; -pub const WININET_E_SERVER_UNREACHABLE: HRESULT = 0x80072F84u32 as HRESULT; -pub const WININET_E_PROXY_SERVER_UNREACHABLE: HRESULT = 0x80072F85u32 as HRESULT; -pub const WININET_E_BAD_AUTO_PROXY_SCRIPT: HRESULT = 0x80072F86u32 as HRESULT; -pub const WININET_E_UNABLE_TO_DOWNLOAD_SCRIPT: HRESULT = 0x80072F87u32 as HRESULT; -pub const WININET_E_SEC_INVALID_CERT: HRESULT = 0x80072F89u32 as HRESULT; -pub const WININET_E_SEC_CERT_REVOKED: HRESULT = 0x80072F8Au32 as HRESULT; -pub const WININET_E_FAILED_DUETOSECURITYCHECK: HRESULT = 0x80072F8Bu32 as HRESULT; -pub const WININET_E_NOT_INITIALIZED: HRESULT = 0x80072F8Cu32 as HRESULT; -pub const WININET_E_LOGIN_FAILURE_DISPLAY_ENTITY_BODY: HRESULT = 0x80072F8Eu32 as HRESULT; -pub const WININET_E_DECODING_FAILED: HRESULT = 0x80072F8Fu32 as HRESULT; -pub const WININET_E_NOT_REDIRECTED: HRESULT = 0x80072F80u32 as HRESULT; -pub const WININET_E_COOKIE_NEEDS_CONFIRMATION: HRESULT = 0x80072F81u32 as HRESULT; -pub const WININET_E_COOKIE_DECLINED: HRESULT = 0x80072F82u32 as HRESULT; -pub const WININET_E_REDIRECT_NEEDS_CONFIRMATION: HRESULT = 0x80072F88u32 as HRESULT; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/winevt.rs cargo-0.37.0/vendor/winapi-0.2.8/src/winevt.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/winevt.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/winevt.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Windows Events API -pub type EVT_HANDLE = ::HANDLE; -pub type PEVT_HANDLE = *mut ::HANDLE; -ENUM!{enum EVT_VARIANT_TYPE { - EvtVarTypeNull = 0, - EvtVarTypeString = 1, - EvtVarTypeAnsiString = 2, - EvtVarTypeSByte = 3, - EvtVarTypeByte = 4, - EvtVarTypeInt16 = 5, - EvtVarTypeUInt16 = 6, - EvtVarTypeInt32 = 7, - EvtVarTypeUInt32 = 8, - EvtVarTypeInt64 = 9, - EvtVarTypeUInt64 = 10, - EvtVarTypeSingle = 11, - EvtVarTypeDouble = 12, - EvtVarTypeBoolean = 13, - EvtVarTypeBinary = 14, - EvtVarTypeGuid = 15, - EvtVarTypeSizeT = 16, - EvtVarTypeFileTime = 17, - EvtVarTypeSysTime = 18, - EvtVarTypeSid = 19, - EvtVarTypeHexInt32 = 20, - EvtVarTypeHexInt64 = 21, - EvtVarTypeEvtHandle = 32, - EvtVarTypeEvtXml = 35, -}} -pub const EVT_VARIANT_TYPE_MASK: ::DWORD = 0x7f; -pub const EVT_VARIANT_TYPE_ARRAY: ::DWORD = 128; -STRUCT!{struct EVT_VARIANT { - u: u64, - Count: ::DWORD, - Type: ::DWORD, -}} -// TODO - All the UNION! for each variant -// TODO - The rest of this header diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/wingdi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/wingdi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/wingdi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/wingdi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,1238 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! GDI procedure declarations, constant definitions and macros -pub const DISPLAY_DEVICE_ATTACHED_TO_DESKTOP: ::DWORD = 0x00000001; -pub const DISPLAY_DEVICE_MULTI_DRIVER: ::DWORD = 0x00000002; -pub const DISPLAY_DEVICE_PRIMARY_DEVICE: ::DWORD = 0x00000004; -pub const DISPLAY_DEVICE_MIRRORING_DRIVER: ::DWORD = 0x00000008; -pub const DISPLAY_DEVICE_VGA_COMPATIBLE: ::DWORD = 0x00000010; -pub const DISPLAY_DEVICE_REMOVABLE: ::DWORD = 0x00000020; -pub const DISPLAY_DEVICE_ACC_DRIVER: ::DWORD = 0x00000040; -pub const DISPLAY_DEVICE_MODESPRUNED: ::DWORD = 0x08000000; -pub const DISPLAY_DEVICE_REMOTE: ::DWORD = 0x04000000; -pub const DISPLAY_DEVICE_DISCONNECT: ::DWORD = 0x02000000; -pub const DISPLAY_DEVICE_TS_COMPATIBLE: ::DWORD = 0x00200000; -pub const DISPLAY_DEVICE_UNSAFE_MODES_ON: ::DWORD = 0x00080000; -pub const DISPLAY_DEVICE_ACTIVE: ::DWORD = 0x00000001; -pub const DISPLAY_DEVICE_ATTACHED: ::DWORD = 0x00000002; -pub const DM_ORIENTATION: ::DWORD = 0x00000001; -pub const DM_PAPERSIZE: ::DWORD = 0x00000002; -pub const DM_PAPERLENGTH: ::DWORD = 0x00000004; -pub const DM_PAPERWIDTH: ::DWORD = 0x00000008; -pub const DM_SCALE: ::DWORD = 0x00000010; -pub const DM_POSITION: ::DWORD = 0x00000020; -pub const DM_NUP: ::DWORD = 0x00000040; -pub const DM_DISPLAYORIENTATION: ::DWORD = 0x00000080; -pub const DM_COPIES: ::DWORD = 0x00000100; -pub const DM_DEFAULTSOURCE: ::DWORD = 0x00000200; -pub const DM_PRINTQUALITY: ::DWORD = 0x00000400; -pub const DM_COLOR: ::DWORD = 0x00000800; -pub const DM_DUPLEX: ::DWORD = 0x00001000; -pub const DM_YRESOLUTION: ::DWORD = 0x00002000; -pub const DM_TTOPTION: ::DWORD = 0x00004000; -pub const DM_COLLATE: ::DWORD = 0x00008000; -pub const DM_FORMNAME: ::DWORD = 0x00010000; -pub const DM_LOGPIXELS: ::DWORD = 0x00020000; -pub const DM_BITSPERPEL: ::DWORD = 0x00040000; -pub const DM_PELSWIDTH: ::DWORD = 0x00080000; -pub const DM_PELSHEIGHT: ::DWORD = 0x00100000; -pub const DM_DISPLAYFLAGS: ::DWORD = 0x00200000; -pub const DM_DISPLAYFREQUENCY: ::DWORD = 0x00400000; -pub const DM_ICMMETHOD: ::DWORD = 0x00800000; -pub const DM_ICMINTENT: ::DWORD = 0x01000000; -pub const DM_MEDIATYPE: ::DWORD = 0x02000000; -pub const DM_DITHERTYPE: ::DWORD = 0x04000000; -pub const DM_PANNINGWIDTH: ::DWORD = 0x08000000; -pub const DM_PANNINGHEIGHT: ::DWORD = 0x10000000; -pub const DM_DISPLAYFIXEDOUTPUT: ::DWORD = 0x20000000; -pub const PFD_TYPE_RGBA: ::BYTE = 0; -pub const PFD_TYPE_COLORINDEX: ::BYTE = 1; -pub const PFD_MAIN_PLANE: ::BYTE = 0; -pub const PFD_OVERLAY_PLANE: ::BYTE = 1; -pub const PFD_UNDERLAY_PLANE: ::BYTE = 0xFF; -pub const PFD_DOUBLEBUFFER: ::DWORD = 0x00000001; -pub const PFD_STEREO: ::DWORD = 0x00000002; -pub const PFD_DRAW_TO_WINDOW: ::DWORD = 0x00000004; -pub const PFD_DRAW_TO_BITMAP: ::DWORD = 0x00000008; -pub const PFD_SUPPORT_GDI: ::DWORD = 0x00000010; -pub const PFD_SUPPORT_OPENGL: ::DWORD = 0x00000020; -pub const PFD_GENERIC_FORMAT: ::DWORD = 0x00000040; -pub const PFD_NEED_PALETTE: ::DWORD = 0x00000080; -pub const PFD_NEED_SYSTEM_PALETTE: ::DWORD = 0x00000100; -pub const PFD_SWAP_EXCHANGE: ::DWORD = 0x00000200; -pub const PFD_SWAP_COPY: ::DWORD = 0x00000400; -pub const PFD_SWAP_LAYER_BUFFERS: ::DWORD = 0x00000800; -pub const PFD_GENERIC_ACCELERATED: ::DWORD = 0x00001000; -pub const PFD_SUPPORT_DIRECTDRAW: ::DWORD = 0x00002000; -pub const PFD_DIRECT3D_ACCELERATED: ::DWORD = 0x00004000; -pub const PFD_SUPPORT_COMPOSITION: ::DWORD = 0x00008000; -pub const PFD_DEPTH_DONTCARE: ::DWORD = 0x20000000; -pub const PFD_DOUBLEBUFFER_DONTCARE: ::DWORD = 0x40000000; -pub const PFD_STEREO_DONTCARE: ::DWORD = 0x80000000; -pub const CCHFORMNAME: usize = 32; -STRUCT!{struct DEVMODEA { - dmDeviceName: [::CHAR; ::CCHDEVICENAME], - dmSpecVersion: ::WORD, - dmDriverVersion: ::WORD, - dmSize: ::WORD, - dmDriverExtra: ::WORD, - dmFields: ::DWORD, - union1: [u8; 16], - dmColor: ::c_short, - dmDuplex: ::c_short, - dmYResolution: ::c_short, - dmTTOption: ::c_short, - dmCollate: ::c_short, - dmFormName: [::CHAR; CCHFORMNAME], - dmLogPixels: ::WORD, - dmBitsPerPel: ::DWORD, - dmPelsWidth: ::DWORD, - dmPelsHeight: ::DWORD, - dmDisplayFlags: ::DWORD, - dmDisplayFrequency: ::DWORD, - dmICMMethod: ::DWORD, - dmICMIntent: ::DWORD, - dmMediaType: ::DWORD, - dmDitherType: ::DWORD, - dmReserved1: ::DWORD, - dmReserved2: ::DWORD, - dmPanningWidth: ::DWORD, - dmPanningHeight: ::DWORD, -}} -pub type PDEVMODEA = *mut DEVMODEA; -pub type NPDEVMODEA = *mut DEVMODEA; -pub type LPDEVMODEA = *mut DEVMODEA; -STRUCT!{struct DEVMODEW { - dmDeviceName: [::WCHAR; ::CCHDEVICENAME], - dmSpecVersion: ::WORD, - dmDriverVersion: ::WORD, - dmSize: ::WORD, - dmDriverExtra: ::WORD, - dmFields: ::DWORD, - union1: [u8; 16], - dmColor: ::c_short, - dmDuplex: ::c_short, - dmYResolution: ::c_short, - dmTTOption: ::c_short, - dmCollate: ::c_short, - dmFormName: [::WCHAR; CCHFORMNAME], - dmLogPixels: ::WORD, - dmBitsPerPel: ::DWORD, - dmPelsWidth: ::DWORD, - dmPelsHeight: ::DWORD, - dmDisplayFlags: ::DWORD, - dmDisplayFrequency: ::DWORD, - dmICMMethod: ::DWORD, - dmICMIntent: ::DWORD, - dmMediaType: ::DWORD, - dmDitherType: ::DWORD, - dmReserved1: ::DWORD, - dmReserved2: ::DWORD, - dmPanningWidth: ::DWORD, - dmPanningHeight: ::DWORD, -}} -pub type PDEVMODEW = *mut DEVMODEW; -pub type NPDEVMODEW = *mut DEVMODEW; -pub type LPDEVMODEW = *mut DEVMODEW; -STRUCT!{nodebug struct DISPLAY_DEVICEW { - cb: ::DWORD, - DeviceName: [::WCHAR; 32], - DeviceString: [::WCHAR; 128], - StateFlags: ::DWORD, - DeviceID: [::WCHAR; 128], - DeviceKey: [::WCHAR; 128], -}} -pub type PDISPLAY_DEVICEW = *mut DISPLAY_DEVICEW; -pub type LPDISPLAY_DEVICEW = *mut DISPLAY_DEVICEW; -STRUCT!{nodebug struct DISPLAY_DEVICEA { - cb: ::DWORD, - DeviceName: [::CHAR; 32], - DeviceString: [::CHAR; 128], - StateFlags: ::DWORD, - DeviceID: [::CHAR; 128], - DeviceKey: [::CHAR; 128], -}} -pub type PDISPLAY_DEVICEA = *mut DISPLAY_DEVICEA; -pub type LPDISPLAY_DEVICEA = *mut DISPLAY_DEVICEA; -STRUCT!{struct PIXELFORMATDESCRIPTOR { - nSize: ::WORD, - nVersion: ::WORD, - dwFlags: ::DWORD, - iPixelType: ::BYTE, - cColorBits: ::BYTE, - cRedBits: ::BYTE, - cRedShift: ::BYTE, - cGreenBits: ::BYTE, - cGreenShift: ::BYTE, - cBlueBits: ::BYTE, - cBlueShift: ::BYTE, - cAlphaBits: ::BYTE, - cAlphaShift: ::BYTE, - cAccumBits: ::BYTE, - cAccumRedBits: ::BYTE, - cAccumGreenBits: ::BYTE, - cAccumBlueBits: ::BYTE, - cAccumAlphaBits: ::BYTE, - cDepthBits: ::BYTE, - cStencilBits: ::BYTE, - cAuxBuffers: ::BYTE, - iLayerType: ::BYTE, - bReserved: ::BYTE, - dwLayerMask: ::DWORD, - dwVisibleMask: ::DWORD, - dwDamageMask: ::DWORD, -}} -pub type PPIXELFORMATDESCRIPTOR = *mut PIXELFORMATDESCRIPTOR; -pub type LPPIXELFORMATDESCRIPTOR = *mut PIXELFORMATDESCRIPTOR; -pub const R2_BLACK: ::c_int = 1; -pub const R2_NOTMERGEPEN: ::c_int = 2; -pub const R2_MASKNOTPEN: ::c_int = 3; -pub const R2_NOTCOPYPEN: ::c_int = 4; -pub const R2_MASKPENNOT: ::c_int = 5; -pub const R2_NOT: ::c_int = 6; -pub const R2_XORPEN: ::c_int = 7; -pub const R2_NOTMASKPEN: ::c_int = 8; -pub const R2_MASKPEN: ::c_int = 9; -pub const R2_NOTXORPEN: ::c_int = 10; -pub const R2_NOP: ::c_int = 11; -pub const R2_MERGENOTPEN: ::c_int = 12; -pub const R2_COPYPEN: ::c_int = 13; -pub const R2_MERGEPENNOT: ::c_int = 14; -pub const R2_MERGEPEN: ::c_int = 15; -pub const R2_WHITE: ::c_int = 16; -pub const R2_LAST: ::c_int = 16; -//83 -pub const SRCCOPY: ::DWORD = 0x00CC0020; -pub const SRCPAINT: ::DWORD = 0x00EE0086; -pub const SRCAND: ::DWORD = 0x008800C6; -pub const SRCINVERT: ::DWORD = 0x00660046; -pub const SRCERASE: ::DWORD = 0x00440328; -pub const NOTSRCCOPY: ::DWORD = 0x00330008; -pub const NOTSRCERASE: ::DWORD = 0x001100A6; -pub const MERGECOPY: ::DWORD = 0x00C000CA; -pub const MERGEPAINT: ::DWORD = 0x00BB0226; -pub const PATCOPY: ::DWORD = 0x00F00021; -pub const PATPAINT: ::DWORD = 0x00FB0A09; -pub const PATINVERT: ::DWORD = 0x005A0049; -pub const DSTINVERT: ::DWORD = 0x00550009; -pub const BLACKNESS: ::DWORD = 0x00000042; -pub const WHITENESS: ::DWORD = 0x00FF0062; -//121 -// fnCombineMode values for CombineRgn -pub const RGN_AND: ::c_int = 1; -pub const RGN_OR: ::c_int = 2; -pub const RGN_XOR: ::c_int = 3; -pub const RGN_DIFF: ::c_int = 4; -pub const RGN_COPY: ::c_int = 5; -pub const RGN_MIN: ::c_int = RGN_AND; -pub const RGN_MAX: ::c_int = RGN_COPY; -//572 (Win 7 SDK) -STRUCT!{struct BITMAP { - bmType: ::LONG, - bmWidth: ::LONG, - bmHeight: ::LONG, - bmWidthBytes: ::LONG, - bmPlanes: ::WORD, - bmBitsPixel: ::WORD, - bmBits: ::LPVOID, -}} -pub type PBITMAP = *mut BITMAP; -pub type NPBITMAP = *mut BITMAP; -pub type LPBITMAP = *mut BITMAP; -STRUCT!{struct RGBQUAD { - rgbBlue: ::BYTE, - rgbGreen: ::BYTE, - rgbRed: ::BYTE, - rgbReserved: ::BYTE, -}} -pub type LPRGBQUAD = *mut RGBQUAD; -pub const CS_ENABLE: ::DWORD = 0x00000001; -pub const CS_DISABLE: ::DWORD = 0x00000002; -pub const CS_DELETE_TRANSFORM: ::DWORD = 0x00000003; -pub const LCS_SIGNATURE: ::DWORD = 0x5053_4F43; // 'PSOC' -pub const LCS_sRGB: LCSCSTYPE = 0x7352_4742; // 'sRGB' -pub const LCS_WINDOWS_COLOR_SPACE: LCSCSTYPE = 0x5769_6E20; // 'Win ' -pub type LCSCSTYPE = ::LONG; -pub const LCS_CALIBRATED_RGB: LCSCSTYPE = 0x00000000; -pub type LCSGAMUTMATCH = ::LONG; -pub const LCS_GM_BUSINESS: LCSGAMUTMATCH = 0x00000001; -pub const LCS_GM_GRAPHICS: LCSGAMUTMATCH = 0x00000002; -pub const LCS_GM_IMAGES: LCSGAMUTMATCH = 0x00000004; -pub const LCS_GM_ABS_COLORIMETRIC: LCSGAMUTMATCH = 0x00000008; -pub const CM_OUT_OF_GAMUT: ::BYTE = 255; -pub const CM_IN_GAMUT: ::BYTE = 0; -pub const ICM_ADDPROFILE: ::UINT = 1; -pub const ICM_DELETEPROFILE: ::UINT = 2; -pub const ICM_QUERYPROFILE: ::UINT = 3; -pub const ICM_SETDEFAULTPROFILE: ::UINT = 4; -pub const ICM_REGISTERICMATCHER: ::UINT = 5; -pub const ICM_UNREGISTERICMATCHER: ::UINT = 6; -pub const ICM_QUERYMATCH: ::UINT = 7; -pub type FXPT16DOT16 = ::c_long; -pub type LPFXPT16DOT16 = *mut ::c_long; -pub type FXPT2DOT30 = ::c_long; -pub type LPFXPT2DOT30 = *mut ::c_long; -STRUCT!{struct CIEXYZ { - ciexyzX: FXPT2DOT30, - ciexyzY: FXPT2DOT30, - ciexyzZ: FXPT2DOT30, -}} -pub type LPCIEXYZ = *mut CIEXYZ; -STRUCT!{struct CIEXYZTRIPLE { - ciexyzRed: CIEXYZ, - ciexyzGreen: CIEXYZ, - ciexyzBlue: CIEXYZ, -}} -pub type LPCIEXYZTRIPLE = *mut CIEXYZTRIPLE; -//716 (Win 7 SDK) -STRUCT!{struct BITMAPINFOHEADER { - biSize: ::DWORD, - biWidth: ::LONG, - biHeight: ::LONG, - biPlanes: ::WORD, - biBitCount: ::WORD, - biCompression: ::DWORD, - biSizeImage: ::DWORD, - biXPelsPerMeter: ::LONG, - biYPelsPerMeter: ::LONG, - biClrUsed: ::DWORD, - biClrImportant: ::DWORD, -}} -pub type LPBITMAPINFOHEADER = *mut BITMAPINFOHEADER; -pub type PBITMAPINFOHEADER = *mut BITMAPINFOHEADER; -STRUCT!{struct BITMAPV5HEADER { - bV5Size: ::DWORD, - bV5Width: ::LONG, - bV5Height: ::LONG, - bV5Planes: ::WORD, - bV5BitCount: ::WORD, - bV5Compression: ::DWORD, - bV5SizeImage: ::DWORD, - bV5XPelsPerMeter: ::LONG, - bV5YPelsPerMeter: ::LONG, - bV5ClrUsed: ::DWORD, - bV5ClrImportant: ::DWORD, - bV5RedMask: ::DWORD, - bV5GreenMask: ::DWORD, - bV5BlueMask: ::DWORD, - bV5AlphaMask: ::DWORD, - bV5CSType: ::LONG, // LONG to match LOGCOLORSPACE - bV5Endpoints: CIEXYZTRIPLE, - bV5GammaRed: ::DWORD, - bV5GammaGreen: ::DWORD, - bV5GammaBlue: ::DWORD, - bV5Intent: ::LONG, // LONG to match LOGCOLORSPACE - bV5ProfileData: ::DWORD, - bV5ProfileSize: ::DWORD, - bV5Reserved: ::DWORD, -}} -pub type LPBITMAPV5HEADER = *mut BITMAPV5HEADER; -pub type PBITMAPV5HEADER = *mut BITMAPV5HEADER; -pub const PROFILE_LINKED: ::LONG = 0x4C49_4E4B; // 'LINK' -pub const PROFILE_EMBEDDED: ::LONG = 0x4D42_4544; // 'MBED' -pub const BI_RGB: ::DWORD = 0; -pub const BI_RLE8: ::DWORD = 1; -pub const BI_RLE4: ::DWORD = 2; -pub const BI_BITFIELDS: ::DWORD = 3; -pub const BI_JPEG: ::DWORD = 4; -pub const BI_PNG: ::DWORD = 5; -STRUCT!{struct BITMAPINFO { - bmiHeader: BITMAPINFOHEADER, - bmiColors: [RGBQUAD; 0], -}} -pub type LPBITMAPINFO = *mut BITMAPINFO; -pub type PBITMAPINFO = *mut BITMAPINFO; -//1438 -pub const LF_FACESIZE: usize = 32; -STRUCT!{nodebug struct LOGFONTA { - lfHeight: ::LONG, - lfWidth: ::LONG, - lfEscapement: ::LONG, - lfOrientation: ::LONG, - lfWeight: ::LONG, - lfItalic: ::BYTE, - lfUnderline: ::BYTE, - lfStrikeOut: ::BYTE, - lfCharSet: ::BYTE, - lfOutPrecision: ::BYTE, - lfClipPrecision: ::BYTE, - lfQuality: ::BYTE, - lfPitchAndFamily: ::BYTE, - lfFaceName: [::CHAR; LF_FACESIZE], -}} -pub type LPLOGFONTA = *mut LOGFONTA; -STRUCT!{nodebug struct LOGFONTW { - lfHeight: ::LONG, - lfWidth: ::LONG, - lfEscapement: ::LONG, - lfOrientation: ::LONG, - lfWeight: ::LONG, - lfItalic: ::BYTE, - lfUnderline: ::BYTE, - lfStrikeOut: ::BYTE, - lfCharSet: ::BYTE, - lfOutPrecision: ::BYTE, - lfClipPrecision: ::BYTE, - lfQuality: ::BYTE, - lfPitchAndFamily: ::BYTE, - lfFaceName: [::WCHAR; LF_FACESIZE], -}} -pub type LPLOGFONTW = *mut LOGFONTW; -//1595 -#[inline] -pub fn RGB (r: ::BYTE, g: ::BYTE, b: ::BYTE) -> ::COLORREF { - r as ::COLORREF | ((g as ::COLORREF) << 8) | ((b as ::COLORREF) << 16) -} -// -pub const DRIVERVERSION: ::c_int = 0; -pub const TECHNOLOGY: ::c_int = 2; -pub const HORZSIZE: ::c_int = 4; -pub const VERTSIZE: ::c_int = 6; -pub const HORZRES: ::c_int = 8; -pub const VERTRES: ::c_int = 10; -pub const BITSPIXEL: ::c_int = 12; -pub const PLANES: ::c_int = 14; -pub const NUMBRUSHES: ::c_int = 16; -pub const NUMPENS: ::c_int = 18; -pub const NUMMARKERS: ::c_int = 20; -pub const NUMFONTS: ::c_int = 22; -pub const NUMCOLORS: ::c_int = 24; -pub const PDEVICESIZE: ::c_int = 26; -pub const CURVECAPS: ::c_int = 28; -pub const LINECAPS: ::c_int = 30; -pub const POLYGONALCAPS: ::c_int = 32; -pub const TEXTCAPS: ::c_int = 34; -pub const CLIPCAPS: ::c_int = 36; -pub const RASTERCAPS: ::c_int = 38; -pub const ASPECTX: ::c_int = 40; -pub const ASPECTY: ::c_int = 42; -pub const ASPECTXY: ::c_int = 44; -pub const LOGPIXELSX: ::c_int = 88; -pub const LOGPIXELSY: ::c_int = 90; -pub const SIZEPALETTE: ::c_int = 104; -pub const NUMRESERVED: ::c_int = 106; -pub const COLORRES: ::c_int = 108; -pub const PHYSICALWIDTH: ::c_int = 110; -pub const PHYSICALHEIGHT: ::c_int = 111; -pub const PHYSICALOFFSETX: ::c_int = 112; -pub const PHYSICALOFFSETY: ::c_int = 113; -pub const SCALINGFACTORX: ::c_int = 114; -pub const SCALINGFACTORY: ::c_int = 115; -pub const VREFRESH: ::c_int = 116; -pub const DESKTOPVERTRES: ::c_int = 117; -pub const DESKTOPHORZRES: ::c_int = 118; -pub const BLTALIGNMENT: ::c_int = 119; -pub const SHADEBLENDCAPS: ::c_int = 120; -pub const COLORMGMTCAPS: ::c_int = 121; -//1906 -pub const DIB_RGB_COLORS: ::UINT = 0; -pub const DIB_PAL_COLORS: ::UINT = 1; -pub const CBM_INIT: ::DWORD = 4; -STRUCT!{struct RGNDATAHEADER { - dwSize: ::DWORD, - iType: ::DWORD, - nCount: ::DWORD, - nRgnSize: ::DWORD, - rcBound: ::RECT, -}} -pub type PRGNDATAHEADER = *mut RGNDATAHEADER; -STRUCT!{nodebug struct RGNDATA { - rdh: RGNDATAHEADER, - Buffer: [::c_char; 0], -}} -pub type PRGNDATA = *mut RGNDATA; -pub type NPRGNDATA = *mut RGNDATA; -pub type LPRGNDATA = *mut RGNDATA; -STRUCT!{struct PALETTEENTRY { - peRed: ::BYTE, - peGreen: ::BYTE, - peBlue: ::BYTE, - peFlags: ::BYTE, -}} -pub type PPALETTEENTRY = *mut PALETTEENTRY; -pub type LPPALETTEENTRY = *mut PALETTEENTRY; -//2824 (Win 7 SDK) -STRUCT!{struct ABC { - abcA: ::c_int, - abcB: ::UINT, - abcC: ::c_int, -}} -pub type PABC = *mut ABC; -pub type NPABC = *mut ABC; -pub type LPABC = *mut ABC; -STRUCT!{struct ABCFLOAT { - abcfA: ::FLOAT, - abcfB: ::FLOAT, - abcfC: ::FLOAT, -}} -pub type PABCFLOAT = *mut ABCFLOAT; -pub type NPABCFLOAT = *mut ABCFLOAT; -pub type LPABCFLOAT = *mut ABCFLOAT; -//3581 -pub type LINEDDAPROC = Option; -STRUCT!{struct XFORM { - eM11: ::FLOAT, - eM12: ::FLOAT, - eM21: ::FLOAT, - eM22: ::FLOAT, - eDx: ::FLOAT, - eDy: ::FLOAT, -}} -pub type PXFORM = *mut XFORM; -pub type LPXFORM = *mut XFORM; -STRUCT!{struct LOGBRUSH { - lbStyle: ::UINT, - lbColor: ::COLORREF, - lbHatch: ::ULONG_PTR, -}} -pub type PLOGBRUSH = *mut LOGBRUSH; -STRUCT!{nodebug struct LOGCOLORSPACEA { - lcsSignature: ::DWORD, - lcsVersion: ::DWORD, - lcsSize: ::DWORD, - lcsCSType: LCSCSTYPE, - lcsIntent: LCSGAMUTMATCH, - lcsEndpoints: CIEXYZTRIPLE, - lcsGammaRed: ::DWORD, - lcsGammaGreen: ::DWORD, - lcsGammaBlue: ::DWORD, - lcsFilename: [::CHAR; ::MAX_PATH], -}} -pub type LPLOGCOLORSPACEA = *mut LOGCOLORSPACEA; -STRUCT!{nodebug struct LOGCOLORSPACEW { - lcsSignature: ::DWORD, - lcsVersion: ::DWORD, - lcsSize: ::DWORD, - lcsCSType: LCSCSTYPE, - lcsIntent: LCSGAMUTMATCH, - lcsEndpoints: CIEXYZTRIPLE, - lcsGammaRed: ::DWORD, - lcsGammaGreen: ::DWORD, - lcsGammaBlue: ::DWORD, - lcsFilename: [::WCHAR; ::MAX_PATH], -}} -pub type LPLOGCOLORSPACEW = *mut LOGCOLORSPACEW; -pub const LF_FULLFACESIZE: usize = 64; -STRUCT!{nodebug struct ENUMLOGFONTEXA { - elfLogFont: LOGFONTA, - elfFullName: [::BYTE; LF_FULLFACESIZE], - elfStyle: [::BYTE; LF_FACESIZE], - elfScript: [::BYTE; LF_FACESIZE], -}} -pub type LPENUMLOGFONTEXA = *mut ENUMLOGFONTEXA; -STRUCT!{nodebug struct ENUMLOGFONTEXW { - elfLogFont: LOGFONTW, - elfFullName: [::WCHAR; LF_FULLFACESIZE], - elfStyle: [::WCHAR; LF_FACESIZE], - elfScript: [::WCHAR; LF_FACESIZE], -}} -pub type LPENUMLOGFONTEXW = *mut ENUMLOGFONTEXW; -pub const MM_MAX_NUMAXES: usize = 16; -STRUCT!{struct DESIGNVECTOR { - dvReserved: ::DWORD, - dvNumAxes: ::DWORD, - dvValues: [::LONG; MM_MAX_NUMAXES], -}} -pub type PDESIGNVECTOR = *mut DESIGNVECTOR; -pub type LPDESIGNVECTOR = *mut DESIGNVECTOR; -STRUCT!{nodebug struct ENUMLOGFONTEXDVA { - elfEnumLogfontEx: ENUMLOGFONTEXA, - elfDesignVector: DESIGNVECTOR, -}} -pub type PENUMLOGFONTEXDVA = *mut ENUMLOGFONTEXDVA; -pub type LPENUMLOGFONTEXDVA = *mut ENUMLOGFONTEXDVA; -STRUCT!{nodebug struct ENUMLOGFONTEXDVW { - elfEnumLogfontEx: ENUMLOGFONTEXW, - elfDesignVector: DESIGNVECTOR, -}} -pub type PENUMLOGFONTEXDVW = *mut ENUMLOGFONTEXDVW; -pub type LPENUMLOGFONTEXDVW = *mut ENUMLOGFONTEXDVW; -STRUCT!{struct LOGPALETTE { - palVersion: ::WORD, - palNumEntries: ::WORD, - palPalEntry: [PALETTEENTRY; 1], -}} -pub type PLOGPALETTE = *mut LOGPALETTE; -pub type NPLOGPALETTE = *mut LOGPALETTE; -pub type LPLOGPALETTE = *mut LOGPALETTE; -STRUCT!{struct LOGPEN { - lopnStyle: ::UINT, - lopnWidth: ::POINT, - lopnColor: ::COLORREF, -}} -pub type PLOGPEN = *mut LOGPEN; -pub type NPLOGPEN = *mut LOGPEN; -pub type LPLOGPEN = *mut LOGPEN; -STRUCT!{struct BLENDFUNCTION { - BlendOp: ::BYTE, - BlendFlags: ::BYTE, - SourceConstantAlpha: ::BYTE, - AlphaFormat: ::BYTE, -}} -pub type PBLENDFUNCTION = *mut BLENDFUNCTION; -pub const TMPF_FIXED_PITCH: ::BYTE = 0x01; -pub const TMPF_VECTOR: ::BYTE = 0x02; -pub const TMPF_DEVICE: ::BYTE = 0x08; -pub const TMPF_TRUETYPE: ::BYTE = 0x04; -STRUCT!{struct TEXTMETRICA { - tmHeight: ::LONG, - tmAscent: ::LONG, - tmDescent: ::LONG, - tmInternalLeading: ::LONG, - tmExternalLeading: ::LONG, - tmAveCharWidth: ::LONG, - tmMaxCharWidth: ::LONG, - tmWeight: ::LONG, - tmOverhang: ::LONG, - tmDigitizedAspectX: ::LONG, - tmDigitizedAspectY: ::LONG, - tmFirstChar: ::BYTE, - tmLastChar: ::BYTE, - tmDefaultChar: ::BYTE, - tmBreakChar: ::BYTE, - tmItalic: ::BYTE, - tmUnderlined: ::BYTE, - tmStruckOut: ::BYTE, - tmPitchAndFamily: ::BYTE, - tmCharSet: ::BYTE, -}} -pub type PTEXTMETRICA = *mut TEXTMETRICA; -pub type NPTEXTMETRICA = *mut TEXTMETRICA; -pub type LPTEXTMETRICA = *mut TEXTMETRICA; -STRUCT!{struct TEXTMETRICW { - tmHeight: ::LONG, - tmAscent: ::LONG, - tmDescent: ::LONG, - tmInternalLeading: ::LONG, - tmExternalLeading: ::LONG, - tmAveCharWidth: ::LONG, - tmMaxCharWidth: ::LONG, - tmWeight: ::LONG, - tmOverhang: ::LONG, - tmDigitizedAspectX: ::LONG, - tmDigitizedAspectY: ::LONG, - tmFirstChar: ::WCHAR, - tmLastChar: ::WCHAR, - tmDefaultChar: ::WCHAR, - tmBreakChar: ::WCHAR, - tmItalic: ::BYTE, - tmUnderlined: ::BYTE, - tmStruckOut: ::BYTE, - tmPitchAndFamily: ::BYTE, - tmCharSet: ::BYTE, -}} -pub type PTEXTMETRICW = *mut TEXTMETRICW; -pub type NPTEXTMETRICW = *mut TEXTMETRICW; -pub type LPTEXTMETRICW = *mut TEXTMETRICW; -pub const TA_NOUPDATECP: ::UINT = 0; -pub const TA_UPDATECP: ::UINT = 1; -pub const TA_LEFT: ::UINT = 0; -pub const TA_RIGHT: ::UINT = 2; -pub const TA_CENTER: ::UINT = 6; -pub const TA_TOP: ::UINT = 0; -pub const TA_BOTTOM: ::UINT = 8; -pub const TA_BASELINE: ::UINT = 24; -pub const TA_RTLREADING: ::UINT = 256; -pub const TA_MASK: ::UINT = TA_BASELINE + TA_CENTER + TA_UPDATECP + TA_RTLREADING; -pub const WHITE_BRUSH: ::c_int = 0; -pub const LTGRAY_BRUSH: ::c_int = 1; -pub const GRAY_BRUSH: ::c_int = 2; -pub const DKGRAY_BRUSH: ::c_int = 3; -pub const BLACK_BRUSH: ::c_int = 4; -pub const NULL_BRUSH: ::c_int = 5; -pub const HOLLOW_BRUSH: ::c_int = 5; -pub const WHITE_PEN: ::c_int = 6; -pub const BLACK_PEN: ::c_int = 7; -pub const NULL_PEN: ::c_int = 8; -pub const OEM_FIXED_FONT: ::c_int = 10; -pub const ANSI_FIXED_FONT: ::c_int = 11; -pub const ANSI_VAR_FONT: ::c_int = 12; -pub const SYSTEM_FONT: ::c_int = 13; -pub const DEVICE_DEFAULT_FONT: ::c_int = 14; -pub const DEFAULT_PALETTE: ::c_int = 15; -pub const SYSTEM_FIXED_FONT: ::c_int = 16; -pub const DEFAULT_GUI_FONT: ::c_int = 17; -pub const DC_BRUSH: ::c_int = 18; -pub const DC_PEN: ::c_int = 19; -pub const STOCK_LAST: ::c_int = 19;pub const PS_SOLID: ::c_int = 0; -pub const PS_DASH: ::c_int = 1; -pub const PS_DOT: ::c_int = 2; -pub const PS_DASHDOT: ::c_int = 3; -pub const PS_DASHDOTDOT: ::c_int = 4; -pub const PS_NULL: ::c_int = 5; -pub const PS_INSIDEFRAME: ::c_int = 6; -pub const PS_USERSTYLE: ::c_int = 7; -pub const PS_ALTERNATE: ::c_int = 8; -pub const TRANSPARENT: ::c_int = 1; -pub const OPAQUE: ::c_int = 2; -pub const BKMODE_LAST: ::c_int = 2; -pub const MM_TEXT: ::c_int = 1; -pub const MM_LOMETRIC: ::c_int = 2; -pub const MM_HIMETRIC: ::c_int = 3; -pub const MM_LOENGLISH: ::c_int = 4; -pub const MM_HIENGLISH: ::c_int = 5; -pub const MM_TWIPS: ::c_int = 6; -pub const MM_ISOTROPIC: ::c_int = 7; -pub const MM_ANISOTROPIC: ::c_int = 8; -pub const ALTERNATE: ::c_int = 1; -pub const WINDING: ::c_int = 2; -pub const POLYFILL_LAST: ::c_int = 2; -pub const OUT_DEFAULT_PRECIS: ::DWORD = 0; -pub const OUT_STRING_PRECIS: ::DWORD = 1; -pub const OUT_CHARACTER_PRECIS: ::DWORD = 2; -pub const OUT_STROKE_PRECIS: ::DWORD = 3; -pub const OUT_TT_PRECIS: ::DWORD = 4; -pub const OUT_DEVICE_PRECIS: ::DWORD = 5; -pub const OUT_RASTER_PRECIS: ::DWORD = 6; -pub const OUT_TT_ONLY_PRECIS: ::DWORD = 7; -pub const OUT_OUTLINE_PRECIS: ::DWORD = 8; -pub const OUT_SCREEN_OUTLINE_PRECIS: ::DWORD = 9; -pub const OUT_PS_ONLY_PRECIS: ::DWORD = 10; -pub const CLIP_DEFAULT_PRECIS: ::DWORD = 0; -pub const CLIP_CHARACTER_PRECIS: ::DWORD = 1; -pub const CLIP_STROKE_PRECIS: ::DWORD = 2; -pub const CLIP_MASK: ::DWORD = 0xf; -pub const CLIP_LH_ANGLES: ::DWORD = 1 << 4; -pub const CLIP_TT_ALWAYS: ::DWORD = 2 << 4; -pub const CLIP_DFA_DISABLE: ::DWORD = 4 << 4; -pub const CLIP_EMBEDDED: ::DWORD = 8 << 4; -pub const DEFAULT_QUALITY: ::DWORD = 0; -pub const DRAFT_QUALITY: ::DWORD = 1; -pub const PROOF_QUALITY: ::DWORD = 2; -pub const NONANTIALIASED_QUALITY: ::DWORD = 3; -pub const ANTIALIASED_QUALITY: ::DWORD = 4; -pub const CLEARTYPE_QUALITY: ::DWORD = 5; -pub const CLEARTYPE_NATURAL_QUALITY: ::DWORD = 6; -pub const DEFAULT_PITCH: ::DWORD = 0; -pub const FIXED_PITCH: ::DWORD = 1; -pub const VARIABLE_PITCH: ::DWORD = 2; -pub const FF_DONTCARE: ::DWORD = 0 << 4; -pub const FF_ROMAN: ::DWORD = 1 << 4; -pub const FF_SWISS: ::DWORD = 2 << 4; -pub const FF_MODERN: ::DWORD = 3 << 4; -pub const FF_SCRIPT: ::DWORD = 4 << 4; -pub const FF_DECORATIVE: ::DWORD = 5 << 4; -pub const MONO_FONT: ::DWORD = 8; -pub const ANSI_CHARSET: ::DWORD = 0; -pub const DEFAULT_CHARSET: ::DWORD = 1; -pub const SYMBOL_CHARSET: ::DWORD = 2; -pub const SHIFTJIS_CHARSET: ::DWORD = 128; -pub const HANGEUL_CHARSET: ::DWORD = 129; -pub const HANGUL_CHARSET: ::DWORD = 129; -pub const GB2312_CHARSET: ::DWORD = 134; -pub const CHINESEBIG5_CHARSET: ::DWORD = 136; -pub const OEM_CHARSET: ::DWORD = 255; -pub const JOHAB_CHARSET: ::DWORD = 130; -pub const HEBREW_CHARSET: ::DWORD = 177; -pub const ARABIC_CHARSET: ::DWORD = 178; -pub const GREEK_CHARSET: ::DWORD = 161; -pub const TURKISH_CHARSET: ::DWORD = 162; -pub const VIETNAMESE_CHARSET: ::DWORD = 163; -pub const THAI_CHARSET: ::DWORD = 222; -pub const EASTEUROPE_CHARSET: ::DWORD = 238; -pub const RUSSIAN_CHARSET: ::DWORD = 204; -pub const MAC_CHARSET: ::DWORD = 77; -pub const BALTIC_CHARSET: ::DWORD = 186; -pub const FS_LATIN1: ::DWORD = 0x00000001; -pub const FS_LATIN2: ::DWORD = 0x00000002; -pub const FS_CYRILLIC: ::DWORD = 0x00000004; -pub const FS_GREEK: ::DWORD = 0x00000008; -pub const FS_TURKISH: ::DWORD = 0x00000010; -pub const FS_HEBREW: ::DWORD = 0x00000020; -pub const FS_ARABIC: ::DWORD = 0x00000040; -pub const FS_BALTIC: ::DWORD = 0x00000080; -pub const FS_VIETNAMESE: ::DWORD = 0x00000100; -pub const FS_THAI: ::DWORD = 0x00010000; -pub const FS_JISJAPAN: ::DWORD = 0x00020000; -pub const FS_CHINESESIMP: ::DWORD = 0x00040000; -pub const FS_WANSUNG: ::DWORD = 0x00080000; -pub const FS_CHINESETRAD: ::DWORD = 0x00100000; -pub const FS_JOHAB: ::DWORD = 0x00200000; -pub const FS_SYMBOL: ::DWORD = 0x80000000; -pub const FW_DONTCARE: ::c_int = 0; -pub const FW_THIN: ::c_int = 100; -pub const FW_EXTRALIGHT: ::c_int = 200; -pub const FW_LIGHT: ::c_int = 300; -pub const FW_NORMAL: ::c_int = 400; -pub const FW_MEDIUM: ::c_int = 500; -pub const FW_SEMIBOLD: ::c_int = 600; -pub const FW_BOLD: ::c_int = 700; -pub const FW_EXTRABOLD: ::c_int = 800; -pub const FW_HEAVY: ::c_int = 900; -pub const FW_ULTRALIGHT: ::c_int = FW_EXTRALIGHT; -pub const FW_REGULAR: ::c_int = FW_NORMAL; -pub const FW_DEMIBOLD: ::c_int = FW_SEMIBOLD; -pub const FW_ULTRABOLD: ::c_int = FW_EXTRABOLD; -pub const FW_BLACK: ::c_int = FW_HEAVY; -pub type COLOR16 = ::c_ushort; -STRUCT!{struct TRIVERTEX { - x: ::LONG, - y: ::LONG, - Red: COLOR16, - Green: COLOR16, - Blue: COLOR16, - Alpha: COLOR16, -}} -pub type PTRIVERTEX = *mut TRIVERTEX; -pub type LPTRIVERTEX = *mut TRIVERTEX; -STRUCT!{struct GRADIENT_RECT { - UpperLeft: ::ULONG, - LowerRight: ::ULONG, -}} -pub type PGRADIENT_RECT = *mut GRADIENT_RECT; -pub type LPGRADIENT_RECT = *mut GRADIENT_RECT; -/* Object Definitions for EnumObjects() */ -pub const OBJ_PEN: ::UINT = 1; -pub const OBJ_BRUSH: ::UINT = 2; -pub const OBJ_DC: ::UINT = 3; -pub const OBJ_METADC: ::UINT = 4; -pub const OBJ_PAL: ::UINT = 5; -pub const OBJ_FONT: ::UINT = 6; -pub const OBJ_BITMAP: ::UINT = 7; -pub const OBJ_REGION: ::UINT = 8; -pub const OBJ_METAFILE: ::UINT = 9; -pub const OBJ_MEMDC: ::UINT = 10; -pub const OBJ_EXTPEN: ::UINT = 11; -pub const OBJ_ENHMETADC: ::UINT = 12; -pub const OBJ_ENHMETAFILE: ::UINT = 13; -pub const OBJ_COLORSPACE: ::UINT = 14; -pub const GDI_OBJ_LAST: ::UINT = OBJ_COLORSPACE; -STRUCT!{struct COLORADJUSTMENT { - caSize: ::WORD, - caFlags: ::WORD, - caIlluminantIndex: ::WORD, - caRedGamma: ::WORD, - caGreenGamma: ::WORD, - caBlueGamma: ::WORD, - caReferenceBlack: ::WORD, - caReferenceWhite: ::WORD, - caContrast: ::SHORT, - caBrightness: ::SHORT, - caColorfulness: ::SHORT, - caRedGreenTint: ::SHORT, -}} -pub type PCOLORADJUSTMENT = *mut COLORADJUSTMENT; -pub type LPCOLORADJUSTMENT = *mut COLORADJUSTMENT; -pub type OLDFONTENUMPROCA = Option ::c_int>; -pub type OLDFONTENUMPROCW = Option ::c_int>; -pub type FONTENUMPROCA = OLDFONTENUMPROCA; -pub type FONTENUMPROCW = OLDFONTENUMPROCW; -STRUCT!{struct WCRANGE { - wcLow: ::WCHAR, - cGlyphs: ::USHORT, -}} -pub type PWCRANGE = *mut WCRANGE; -pub type LPWCRANGE = *mut WCRANGE; -STRUCT!{struct GLYPHSET { - cbThis: ::DWORD, - flAccel: ::DWORD, - cGlyphsSupported: ::DWORD, - cRanges: ::DWORD, - ranges: [WCRANGE;1], -}} -pub type PGLYPHSET = *mut GLYPHSET; -pub type LPGLYPHSET = *mut GLYPHSET; -pub type ABORTPROC = Option ::BOOL>; -STRUCT!{struct DOCINFOA { - cbSize: ::c_int, - lpszDocName: ::LPCSTR, - lpszOutput: ::LPCSTR, - lpszDatatype: ::LPCSTR, - fwType: ::DWORD, -}} -pub type LPDOCINFOA = *mut DOCINFOA; -STRUCT!{struct DOCINFOW { - cbSize: ::c_int, - lpszDocName: ::LPCWSTR, - lpszOutput: ::LPCWSTR, - lpszDatatype: ::LPCWSTR, - fwType: ::DWORD, -}} -pub type LPDOCINFOW = *mut DOCINFOW; -pub type ICMENUMPROCA = Option ::c_int>; -pub type ICMENUMPROCW = Option ::c_int>; -STRUCT!{struct HANDLETABLE { - objectHandle: [::HGDIOBJ; 1], -}} -pub type LPHANDLETABLE = *mut HANDLETABLE; -pub type PHANDLETABLE = *mut HANDLETABLE; -STRUCT!{struct METARECORD { - rdSize: ::DWORD, - rdFunction: ::WORD, - rdParm: [::WORD; 1], -}} -pub type PMETARECORD = *mut METARECORD; -pub type LPMETARECORD = *mut METARECORD; -pub type MFENUMPROC = Option ::c_int>; -pub type GOBJENUMPROC = Option ::c_int>; -STRUCT!{struct GCP_RESULTSA { - lStructSize: ::DWORD, - lpOutString: ::LPSTR, - lpOrder: *const ::UINT, - lpDx: *const ::c_int, - lpCaretPos: *const ::c_int, - lpClass: ::LPSTR, - lpGlyphs: ::LPWSTR, - nGlyphs: ::UINT, - nMaxFit: ::c_int, -}} -pub type LPGCP_RESULTSA = *mut GCP_RESULTSA; -STRUCT!{struct GCP_RESULTSW { - lStructSize: ::DWORD, - lpOutString: ::LPWSTR, - lpOrder: *const ::UINT, - lpDx: *const ::c_int, - lpCaretPos: *const ::c_int, - lpClass: ::LPSTR, - lpGlyphs: ::LPWSTR, - nGlyphs: ::UINT, - nMaxFit: ::c_int, -}} -pub type LPGCP_RESULTSW = *mut GCP_RESULTSW; -STRUCT!{struct FONTSIGNATURE { - fsUsb: [::DWORD; 4], - fsCsb: [::DWORD; 2], -}} -pub type LPFONTSIGNATURE = *mut FONTSIGNATURE; -pub type PFONTSIGNATURE = *mut FONTSIGNATURE; -STRUCT!{struct POLYTEXTA { - x: ::c_int, - y: ::c_int, - n: ::UINT, - lpstr: ::LPCSTR, - uiFlags: ::UINT, - rcl: ::RECT, - pdx: *const ::c_int, -}} -pub type PPOLYTEXTA = *mut POLYTEXTA; -pub type NPPOLYTEXTA = *mut POLYTEXTA; -pub type LPPOLYTEXTA = *mut POLYTEXTA; -STRUCT!{struct POLYTEXTW { - x: ::c_int, - y: ::c_int, - n: ::UINT, - lpstr: ::LPCWSTR, - uiFlags: ::UINT, - rcl: ::RECT, - pdx: *const ::c_int, -}} -pub type PPOLYTEXTW = *mut POLYTEXTW; -pub type NPPOLYTEXTW = *mut POLYTEXTW; -pub type LPPOLYTEXTW = *mut POLYTEXTW; -STRUCT!{struct CHARSETINFO { - ciCharset: ::UINT, - ciACP: ::UINT, - fs: ::FONTSIGNATURE, -}} -pub type PCHARSETINFO = *mut CHARSETINFO; -pub type NPCHARSETINFO = *mut CHARSETINFO; -pub type LPCHARSETINFO = *mut CHARSETINFO; -pub const GRADIENT_FILL_RECT_H: ::ULONG = 0x00000000; -pub const GRADIENT_FILL_RECT_V: ::ULONG = 0x00000001; -pub const GRADIENT_FILL_TRIANGLE: ::ULONG = 0x00000002; -pub const GRADIENT_FILL_OP_FLAG: ::ULONG = 0x000000ff; -STRUCT!{struct LAYERPLANEDESCRIPTOR { - nSize: ::WORD, - nVersion: ::WORD, - dwFlags: ::DWORD, - iPixelType: ::BYTE, - cColorBits: ::BYTE, - cRedBits: ::BYTE, - cRedShift: ::BYTE, - cGreenBits: ::BYTE, - cGreenShift: ::BYTE, - cBlueBits: ::BYTE, - cBlueShift: ::BYTE, - cAlphaBits: ::BYTE, - cAlphaShift: ::BYTE, - cAccumBits: ::BYTE, - cAccumRedBits: ::BYTE, - cAccumGreenBits: ::BYTE, - cAccumBlueBits: ::BYTE, - cAccumAlphaBits: ::BYTE, - cDepthBits: ::BYTE, - cStencilBits: ::BYTE, - cAuxBuffers: ::BYTE, - iLayerPlane: ::BYTE, - bReserved: ::BYTE, - crTransparent: ::COLORREF, -}} -pub type PLAYERPLANEDESCRIPTOR = *mut LAYERPLANEDESCRIPTOR; -pub type LPLAYERPLANEDESCRIPTOR = *mut LAYERPLANEDESCRIPTOR; -STRUCT!{struct ENHMETAHEADER { - iType: ::DWORD, - nSize: ::DWORD, - rclBounds: ::RECTL, - rclFrame: ::RECTL, - dSignature: ::DWORD, - nVersion: ::DWORD, - nBytes: ::DWORD, - nRecords: ::DWORD, - nHandles: ::WORD, - sReserved: ::WORD, - nDescription: ::DWORD, - offDescription: ::DWORD, - nPalEntries: ::DWORD, - szlDevice: ::SIZEL, - szlMillimeters: ::SIZEL, - cbPixelFormat: ::DWORD, - offPixelFormat: ::DWORD, - bOpenGL: ::DWORD, - szlMicrometers: ::SIZEL, -}} -pub type PENHMETAHEADER = *mut ENHMETAHEADER; -pub type LPENHMETAHEADER = *mut ENHMETAHEADER; -STRUCT!{struct FIXED { - fract: ::WORD, - value: ::c_short, -}} -STRUCT!{struct MAT2 { - eM11: FIXED, - eM12: FIXED, - eM21: FIXED, - eM22: FIXED, -}} -pub type LPMAT2 = *mut MAT2; -STRUCT!{struct GLYPHMETRICS { - gmBlackBoxX: ::UINT, - gmBlackBoxY: ::UINT, - gmptGlyphOrigin: ::POINT, - gmCellIncX: ::c_short, - gmCellIncY: ::c_short, -}} -pub type LPGLYPHMETRICS = *mut GLYPHMETRICS; -STRUCT!{struct KERNINGPAIR { - wFirst: ::WORD, - wSecond: ::WORD, - iKernAmount: ::c_int, -}} -pub type LPKERNINGPAIR = *mut KERNINGPAIR; -STRUCT!{struct PANOSE { - bFamilyType: ::BYTE, - bSerifStyle: ::BYTE, - bWeight: ::BYTE, - bProportion: ::BYTE, - bContrast: ::BYTE, - bStrokeVariation: ::BYTE, - bArmStyle: ::BYTE, - bLetterform: ::BYTE, - bMidline: ::BYTE, - bXHeight: ::BYTE, -}} -pub type LPPANOSE = *mut PANOSE; -STRUCT!{struct OUTLINETEXTMETRICA { - otmSize: ::UINT, - otmTextMetrics: TEXTMETRICA, - otmFiller: ::BYTE, - otmPanoseNumber: ::PANOSE, - otmfsSelection: ::UINT, - otmfsType: ::UINT, - otmsCharSlopeRise: ::c_int, - otmsCharSlopeRun: ::c_int, - otmItalicAngle: ::c_int, - otmEMSquare: ::UINT, - otmAscent: ::c_int, - otmDescent: ::c_int, - otmLineGap: ::UINT, - otmsCapEmHeight: ::UINT, - otmsXHeight: ::UINT, - otmrcFontBox: ::RECT, - otmMacAscent: ::c_int, - otmMacDescent: ::c_int, - otmMacLineGap: ::UINT, - otmusMinimumPPEM: ::UINT, - otmptSubscriptSize: ::POINT, - otmptSubscriptOffset: ::POINT, - otmptSuperscriptSize: ::POINT, - otmptSuperscriptOffset: ::POINT, - otmsStrikeoutSize: ::UINT, - otmsStrikeoutPosition: ::c_int, - otmsUnderscoreSize: ::c_int, - otmsUnderscorePosition: ::c_int, - otmpFamilyName: ::PSTR, - otmpFaceName: ::PSTR, - otmpStyleName: ::PSTR, - otmpFullName: ::PSTR, -}} -pub type POUTLINETEXTMETRICA = *mut OUTLINETEXTMETRICA; -pub type NPOUTLINETEXTMETRICA = *mut OUTLINETEXTMETRICA; -pub type LPOUTLINETEXTMETRICA = *mut OUTLINETEXTMETRICA; -STRUCT!{struct OUTLINETEXTMETRICW { - otmSize: ::UINT, - otmTextMetrics: TEXTMETRICW, - otmFiller: ::BYTE, - otmPanoseNumber: ::PANOSE, - otmfsSelection: ::UINT, - otmfsType: ::UINT, - otmsCharSlopeRise: ::c_int, - otmsCharSlopeRun: ::c_int, - otmItalicAngle: ::c_int, - otmEMSquare: ::UINT, - otmAscent: ::c_int, - otmDescent: ::c_int, - otmLineGap: ::UINT, - otmsCapEmHeight: ::UINT, - otmsXHeight: ::UINT, - otmrcFontBox: ::RECT, - otmMacAscent: ::c_int, - otmMacDescent: ::c_int, - otmMacLineGap: ::UINT, - otmusMinimumPPEM: ::UINT, - otmptSubscriptSize: ::POINT, - otmptSubscriptOffset: ::POINT, - otmptSuperscriptSize: ::POINT, - otmptSuperscriptOffset: ::POINT, - otmsStrikeoutSize: ::UINT, - otmsStrikeoutPosition: ::c_int, - otmsUnderscoreSize: ::c_int, - otmsUnderscorePosition: ::c_int, - otmpFamilyName: ::PSTR, - otmpFaceName: ::PSTR, - otmpStyleName: ::PSTR, - otmpFullName: ::PSTR, -}} -pub type POUTLINETEXTMETRICW = *mut OUTLINETEXTMETRICW; -pub type NPOUTLINETEXTMETRICW = *mut OUTLINETEXTMETRICW; -pub type LPOUTLINETEXTMETRICW = *mut OUTLINETEXTMETRICW; -STRUCT!{struct RASTERIZER_STATUS { - nSize: ::c_short, - wFlags: ::c_short, - nLanguageID: ::c_short, -}} -pub type LPRASTERIZER_STATUS = *mut RASTERIZER_STATUS; -STRUCT!{struct ENHMETARECORD { - iType: ::DWORD, - nSize: ::DWORD, - dParm: [::DWORD; 1], -}} -pub type PENHMETARECORD = *mut ENHMETARECORD; -pub type LPENHMETARECORD = *mut ENHMETARECORD; -STRUCT!{struct METAFILEPICT { - mm: ::LONG, - xExt: ::LONG, - yExt: ::LONG, - hMF: ::HMETAFILE, -}} -pub type LPMETAFILEPICT = *mut METAFILEPICT; -STRUCT!{struct POINTFLOAT { - x: ::FLOAT, - y: ::FLOAT, -}} -pub type PPOINTFLOAT = *mut POINTFLOAT; -STRUCT!{struct GLYPHMETRICSFLOAT { - gmfBlackBoxX: ::FLOAT, - gmfBlackBoxY: ::FLOAT, - gmfptGlyphOrigin: POINTFLOAT, - gmfCellIncX: ::FLOAT, - gmfCellIncY: ::FLOAT, -}} -pub type PGLYPHMETRICSFLOAT = *mut GLYPHMETRICSFLOAT; -pub type LPGLYPHMETRICSFLOAT = *mut GLYPHMETRICSFLOAT; -pub const DT_PLOTTER: ::c_int = 0; -pub const DT_RASDISPLAY: ::c_int = 1; -pub const DT_RASPRINTER: ::c_int = 2; -pub const DT_RASCAMERA: ::c_int = 3; -pub const DT_CHARSTREAM: ::c_int = 4; -pub const DT_METAFILE: ::c_int = 5; -pub const DT_DISPFILE: ::c_int = 6; -pub const CLR_INVALID: ::COLORREF = 0xFFFFFFFF; -pub const ETO_OPAQUE: ::UINT = 0x0002; -pub const ETO_CLIPPED: ::UINT = 0x0004; -pub const ETO_GLYPH_INDEX: ::UINT = 0x0010; -pub const ETO_RTLREADING: ::UINT = 0x0080; -pub const ETO_NUMERICSLOCAL: ::UINT = 0x0400; -pub const ETO_NUMERICSLATIN: ::UINT = 0x0800; -pub const ETO_IGNORELANGUAGE: ::UINT = 0x1000; -pub const ETO_PDY: ::UINT = 0x2000; -pub const ETO_REVERSE_INDEX_MAP: ::UINT = 0x10000; -STRUCT!{struct EXTLOGPEN { - elpPenStyle: ::DWORD, - elpWidth: ::DWORD, - elpBrushStyle: ::UINT, - elpColor: ::COLORREF, - elpHatch: ::ULONG_PTR, - elpNumEntries: ::DWORD, - elpStyleEntry: [::DWORD; 1], -}} -pub type PEXTLOGPEN = *mut EXTLOGPEN; -pub type NPEXTLOGPEN = *mut EXTLOGPEN; -pub type LPEXTLOGPEN = *mut EXTLOGPEN; -pub type ENHMFENUMPROC = Option ::c_int>; -/* Metafile Functions */ -pub const META_SETBKCOLOR: ::WORD = 0x0201; -pub const META_SETBKMODE: ::WORD = 0x0102; -pub const META_SETMAPMODE: ::WORD = 0x0103; -pub const META_SETROP2: ::WORD = 0x0104; -pub const META_SETRELABS: ::WORD = 0x0105; -pub const META_SETPOLYFILLMODE: ::WORD = 0x0106; -pub const META_SETSTRETCHBLTMODE: ::WORD = 0x0107; -pub const META_SETTEXTCHAREXTRA: ::WORD = 0x0108; -pub const META_SETTEXTCOLOR: ::WORD = 0x0209; -pub const META_SETTEXTJUSTIFICATION: ::WORD = 0x020A; -pub const META_SETWINDOWORG: ::WORD = 0x020B; -pub const META_SETWINDOWEXT: ::WORD = 0x020C; -pub const META_SETVIEWPORTORG: ::WORD = 0x020D; -pub const META_SETVIEWPORTEXT: ::WORD = 0x020E; -pub const META_OFFSETWINDOWORG: ::WORD = 0x020F; -pub const META_SCALEWINDOWEXT: ::WORD = 0x0410; -pub const META_OFFSETVIEWPORTORG: ::WORD = 0x0211; -pub const META_SCALEVIEWPORTEXT: ::WORD = 0x0412; -pub const META_LINETO: ::WORD = 0x0213; -pub const META_MOVETO: ::WORD = 0x0214; -pub const META_EXCLUDECLIPRECT: ::WORD = 0x0415; -pub const META_INTERSECTCLIPRECT: ::WORD = 0x0416; -pub const META_ARC: ::WORD = 0x0817; -pub const META_ELLIPSE: ::WORD = 0x0418; -pub const META_FLOODFILL: ::WORD = 0x0419; -pub const META_PIE: ::WORD = 0x081A; -pub const META_RECTANGLE: ::WORD = 0x041B; -pub const META_ROUNDRECT: ::WORD = 0x061C; -pub const META_PATBLT: ::WORD = 0x061D; -pub const META_SAVEDC: ::WORD = 0x001E; -pub const META_SETPIXEL: ::WORD = 0x041F; -pub const META_OFFSETCLIPRGN: ::WORD = 0x0220; -pub const META_TEXTOUT: ::WORD = 0x0521; -pub const META_BITBLT: ::WORD = 0x0922; -pub const META_STRETCHBLT: ::WORD = 0x0B23; -pub const META_POLYGON: ::WORD = 0x0324; -pub const META_POLYLINE: ::WORD = 0x0325; -pub const META_ESCAPE: ::WORD = 0x0626; -pub const META_RESTOREDC: ::WORD = 0x0127; -pub const META_FILLREGION: ::WORD = 0x0228; -pub const META_FRAMEREGION: ::WORD = 0x0429; -pub const META_INVERTREGION: ::WORD = 0x012A; -pub const META_PAINTREGION: ::WORD = 0x012B; -pub const META_SELECTCLIPREGION: ::WORD = 0x012C; -pub const META_SELECTOBJECT: ::WORD = 0x012D; -pub const META_SETTEXTALIGN: ::WORD = 0x012E; -pub const META_CHORD: ::WORD = 0x0830; -pub const META_SETMAPPERFLAGS: ::WORD = 0x0231; -pub const META_EXTTEXTOUT: ::WORD = 0x0a32; -pub const META_SETDIBTODEV: ::WORD = 0x0d33; -pub const META_SELECTPALETTE: ::WORD = 0x0234; -pub const META_REALIZEPALETTE: ::WORD = 0x0035; -pub const META_ANIMATEPALETTE: ::WORD = 0x0436; -pub const META_SETPALENTRIES: ::WORD = 0x0037; -pub const META_POLYPOLYGON: ::WORD = 0x0538; -pub const META_RESIZEPALETTE: ::WORD = 0x0139; -pub const META_DIBBITBLT: ::WORD = 0x0940; -pub const META_DIBSTRETCHBLT: ::WORD = 0x0b41; -pub const META_DIBCREATEPATTERNBRUSH: ::WORD = 0x0142; -pub const META_STRETCHDIB: ::WORD = 0x0f43; -pub const META_EXTFLOODFILL: ::WORD = 0x0548; -pub const META_SETLAYOUT: ::WORD = 0x0149; -pub const META_DELETEOBJECT: ::WORD = 0x01f0; -pub const META_CREATEPALETTE: ::WORD = 0x00f7; -pub const META_CREATEPATTERNBRUSH: ::WORD = 0x01F9; -pub const META_CREATEPENINDIRECT: ::WORD = 0x02FA; -pub const META_CREATEFONTINDIRECT: ::WORD = 0x02FB; -pub const META_CREATEBRUSHINDIRECT: ::WORD = 0x02FC; -pub const META_CREATEREGION: ::WORD = 0x06FF; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/winhttp.rs cargo-0.37.0/vendor/winapi-0.2.8/src/winhttp.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/winhttp.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/winhttp.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,441 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! Windows HTTP Services API constant definitions and macros -//54 -pub type HINTERNET = ::LPVOID; -pub type LPHINTERNET = *mut HINTERNET; -pub type INTERNET_PORT = ::WORD; -pub type LPINTERNET_PORT = *mut INTERNET_PORT; -pub const INTERNET_DEFAULT_PORT: INTERNET_PORT = 0; -pub const INTERNET_DEFAULT_HTTP_PORT: INTERNET_PORT = 80; -pub const INTERNET_DEFAULT_HTTPS_PORT: INTERNET_PORT = 443; -pub const WINHTTP_FLAG_ASYNC: ::DWORD = 0x10000000; -pub const WINHTTP_FLAG_SECURE: ::DWORD = 0x00800000; -pub const WINHTTP_FLAG_ESCAPE_PERCENT: ::DWORD = 0x00000004; -pub const WINHTTP_FLAG_NULL_CODEPAGE: ::DWORD = 0x00000008; -pub const WINHTTP_FLAG_BYPASS_PROXY_CACHE: ::DWORD = 0x00000100; -pub const WINHTTP_FLAG_REFRESH: ::DWORD = WINHTTP_FLAG_BYPASS_PROXY_CACHE; -pub const WINHTTP_FLAG_ESCAPE_DISABLE: ::DWORD = 0x00000040; -pub const WINHTTP_FLAG_ESCAPE_DISABLE_QUERY: ::DWORD = 0x00000080; -STRUCT!{struct WINHTTP_ASYNC_RESULT { - dwResult: ::DWORD_PTR, - dwError: ::DWORD, -}} -pub type LPWINHTTP_ASYNC_RESULT = *mut WINHTTP_ASYNC_RESULT; -pub type INTERNET_SCHEME = ::c_int; -pub type LPINTERNET_SCHEME = *mut ::c_int; -pub const INTERNET_SCHEME_HTTP: INTERNET_SCHEME = 1; -pub const INTERNET_SCHEME_HTTPS: INTERNET_SCHEME = 2; -pub const INTERNET_SCHEME_FTP: INTERNET_SCHEME = 3; -pub const INTERNET_SCHEME_SOCKS: INTERNET_SCHEME = 4; -STRUCT!{struct URL_COMPONENTS { - dwStructSize: ::DWORD, - lpszScheme: ::LPWSTR, - dwSchemeLength: ::DWORD, - nScheme: INTERNET_SCHEME, - lpszHostName: ::LPWSTR, - dwHostNameLength: ::DWORD, - nPort: INTERNET_PORT, - lpszUserName: ::LPWSTR, - dwUserNameLength: ::DWORD, - lpszPassword: ::LPWSTR, - dwPasswordLength: ::DWORD, - lpszUrlPath: ::LPWSTR, - dwUrlPathLength: ::DWORD, - lpszExtraInfo: ::LPWSTR, - dwExtraInfoLength: ::DWORD, -}} -pub type LPURL_COMPONENTS = *mut URL_COMPONENTS; -pub type URL_COMPONENTSW = URL_COMPONENTS; -pub type LPURL_COMPONENTSW = LPURL_COMPONENTS; -STRUCT!{struct WINHTTP_PROXY_INFO { - dwAccessType: ::DWORD, - lpszProxy: ::LPWSTR, - lpszProxyBypass: ::LPWSTR, -}} -pub type LPWINHTTP_PROXY_INFO = *mut WINHTTP_PROXY_INFO; -pub type WINHTTP_PROXY_INFOW = WINHTTP_PROXY_INFO; -pub type LPWINHTTP_PROXY_INFOW = LPWINHTTP_PROXY_INFO; -STRUCT!{struct WINHTTP_AUTOPROXY_OPTIONS { - dwFlags: ::DWORD, - dwAutoDetectFlags: ::DWORD, - lpszAutoConfigUrl: ::LPCWSTR, - lpvReserved: ::LPVOID, - dwReserved: ::DWORD, - fAutoLogonIfChallenged: ::BOOL, -}} -pub const WINHTTP_AUTOPROXY_AUTO_DETECT: ::DWORD = 0x00000001; -pub const WINHTTP_AUTOPROXY_CONFIG_URL: ::DWORD = 0x00000002; -pub const WINHTTP_AUTOPROXY_HOST_KEEPCASE: ::DWORD = 0x00000004; -pub const WINHTTP_AUTOPROXY_HOST_LOWERCASE: ::DWORD = 0x00000008; -pub const WINHTTP_AUTOPROXY_RUN_INPROCESS: ::DWORD = 0x00010000; -pub const WINHTTP_AUTOPROXY_RUN_OUTPROCESS_ONLY: ::DWORD = 0x00020000; -pub const WINHTTP_AUTOPROXY_NO_DIRECTACCESS: ::DWORD = 0x00040000; -pub const WINHTTP_AUTOPROXY_NO_CACHE_CLIENT: ::DWORD = 0x00080000; -pub const WINHTTP_AUTOPROXY_NO_CACHE_SVC: ::DWORD = 0x00100000; -pub const WINHTTP_AUTOPROXY_SORT_RESULTS: ::DWORD = 0x00400000; -pub const WINHTTP_AUTO_DETECT_TYPE_DHCP: ::DWORD = 0x00000001; -pub const WINHTTP_AUTO_DETECT_TYPE_DNS_A: ::DWORD = 0x00000002; -STRUCT!{struct WINHTTP_PROXY_RESULT_ENTRY { - fProxy: ::BOOL, - fBypass: ::BOOL, - ProxyScheme: INTERNET_SCHEME, - pwszProxy: ::PWSTR, - ProxyPort: INTERNET_PORT, -}} -STRUCT!{struct WINHTTP_PROXY_RESULT { - cEntries: ::DWORD, - pEntries: *mut WINHTTP_PROXY_RESULT_ENTRY, -}} -pub const WINHTTP_FIRST_OPTION: ::DWORD = WINHTTP_OPTION_CALLBACK; -pub const WINHTTP_OPTION_CALLBACK: ::DWORD = 1; -pub const WINHTTP_OPTION_RESOLVE_TIMEOUT: ::DWORD = 2; -pub const WINHTTP_OPTION_CONNECT_TIMEOUT: ::DWORD = 3; -pub const WINHTTP_OPTION_CONNECT_RETRIES: ::DWORD = 4; -pub const WINHTTP_OPTION_SEND_TIMEOUT: ::DWORD = 5; -pub const WINHTTP_OPTION_RECEIVE_TIMEOUT: ::DWORD = 6; -pub const WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT: ::DWORD = 7; -pub const WINHTTP_OPTION_HANDLE_TYPE: ::DWORD = 9; -pub const WINHTTP_OPTION_READ_BUFFER_SIZE: ::DWORD = 12; -pub const WINHTTP_OPTION_WRITE_BUFFER_SIZE: ::DWORD = 13; -pub const WINHTTP_OPTION_PARENT_HANDLE: ::DWORD = 21; -pub const WINHTTP_OPTION_EXTENDED_ERROR: ::DWORD = 24; -pub const WINHTTP_OPTION_SECURITY_FLAGS: ::DWORD = 31; -pub const WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT: ::DWORD = 32; -pub const WINHTTP_OPTION_URL: ::DWORD = 34; -pub const WINHTTP_OPTION_SECURITY_KEY_BITNESS: ::DWORD = 36; -pub const WINHTTP_OPTION_PROXY: ::DWORD = 38; -pub const WINHTTP_OPTION_PROXY_RESULT_ENTRY: ::DWORD = 39; -pub const WINHTTP_OPTION_USER_AGENT: ::DWORD = 41; -pub const WINHTTP_OPTION_CONTEXT_VALUE: ::DWORD = 45; -pub const WINHTTP_OPTION_CLIENT_CERT_CONTEXT: ::DWORD = 47; -pub const WINHTTP_OPTION_REQUEST_PRIORITY: ::DWORD = 58; -pub const WINHTTP_OPTION_HTTP_VERSION: ::DWORD = 59; -pub const WINHTTP_OPTION_DISABLE_FEATURE: ::DWORD = 63; -pub const WINHTTP_OPTION_CODEPAGE: ::DWORD = 68; -pub const WINHTTP_OPTION_MAX_CONNS_PER_SERVER: ::DWORD = 73; -pub const WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER: ::DWORD = 74; -pub const WINHTTP_OPTION_AUTOLOGON_POLICY: ::DWORD = 77; -pub const WINHTTP_OPTION_SERVER_CERT_CONTEXT: ::DWORD = 78; -pub const WINHTTP_OPTION_ENABLE_FEATURE: ::DWORD = 79; -pub const WINHTTP_OPTION_WORKER_THREAD_COUNT: ::DWORD = 80; -pub const WINHTTP_OPTION_PASSPORT_COBRANDING_TEXT: ::DWORD = 81; -pub const WINHTTP_OPTION_PASSPORT_COBRANDING_URL: ::DWORD = 82; -pub const WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH: ::DWORD = 83; -pub const WINHTTP_OPTION_SECURE_PROTOCOLS: ::DWORD = 84; -pub const WINHTTP_OPTION_ENABLETRACING: ::DWORD = 85; -pub const WINHTTP_OPTION_PASSPORT_SIGN_OUT: ::DWORD = 86; -pub const WINHTTP_OPTION_PASSPORT_RETURN_URL: ::DWORD = 87; -pub const WINHTTP_OPTION_REDIRECT_POLICY: ::DWORD = 88; -pub const WINHTTP_OPTION_MAX_HTTP_AUTOMATIC_REDIRECTS: ::DWORD = 89; -pub const WINHTTP_OPTION_MAX_HTTP_STATUS_CONTINUE: ::DWORD = 90; -pub const WINHTTP_OPTION_MAX_RESPONSE_HEADER_SIZE: ::DWORD = 91; -pub const WINHTTP_OPTION_MAX_RESPONSE_DRAIN_SIZE: ::DWORD = 92; -pub const WINHTTP_OPTION_CONNECTION_INFO: ::DWORD = 93; -pub const WINHTTP_OPTION_CLIENT_CERT_ISSUER_LIST: ::DWORD = 94; -pub const WINHTTP_OPTION_SPN: ::DWORD = 96; -pub const WINHTTP_OPTION_GLOBAL_PROXY_CREDS: ::DWORD = 97; -pub const WINHTTP_OPTION_GLOBAL_SERVER_CREDS: ::DWORD = 98; -pub const WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT: ::DWORD = 99; -pub const WINHTTP_OPTION_REJECT_USERPWD_IN_URL: ::DWORD = 100; -pub const WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS: ::DWORD = 101; -pub const WINHTTP_OPTION_RECEIVE_PROXY_CONNECT_RESPONSE: ::DWORD = 103; -pub const WINHTTP_OPTION_IS_PROXY_CONNECT_RESPONSE: ::DWORD = 104; -pub const WINHTTP_OPTION_SERVER_SPN_USED: ::DWORD = 106; -pub const WINHTTP_OPTION_PROXY_SPN_USED: ::DWORD = 107; -pub const WINHTTP_OPTION_SERVER_CBT: ::DWORD = 108; -pub const WINHTTP_OPTION_UNSAFE_HEADER_PARSING: ::DWORD = 110; -pub const WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS: ::DWORD = 111; -pub const WINHTTP_OPTION_UPGRADE_TO_WEB_SOCKET: ::DWORD = 114; -pub const WINHTTP_OPTION_WEB_SOCKET_CLOSE_TIMEOUT: ::DWORD = 115; -pub const WINHTTP_OPTION_WEB_SOCKET_KEEPALIVE_INTERVAL: ::DWORD = 116; -pub const WINHTTP_OPTION_DECOMPRESSION: ::DWORD = 118; -pub const WINHTTP_OPTION_WEB_SOCKET_RECEIVE_BUFFER_SIZE: ::DWORD = 122; -pub const WINHTTP_OPTION_WEB_SOCKET_SEND_BUFFER_SIZE: ::DWORD = 123; -pub const WINHTTP_LAST_OPTION: ::DWORD = WINHTTP_OPTION_WEB_SOCKET_SEND_BUFFER_SIZE; -pub const WINHTTP_OPTION_USERNAME: ::DWORD = 0x1000; -pub const WINHTTP_OPTION_PASSWORD: ::DWORD = 0x1001; -pub const WINHTTP_OPTION_PROXY_USERNAME: ::DWORD = 0x1002; -pub const WINHTTP_OPTION_PROXY_PASSWORD: ::DWORD = 0x1003; -//552 -pub type WINHTTP_STATUS_CALLBACK = Option; -pub type LPWINHTTP_STATUS_CALLBACK = *mut WINHTTP_STATUS_CALLBACK; -pub const WINHTTP_CALLBACK_STATUS_RESOLVING_NAME: ::DWORD = 0x00000001; -pub const WINHTTP_CALLBACK_STATUS_NAME_RESOLVED: ::DWORD = 0x00000002; -pub const WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER: ::DWORD = 0x00000004; -pub const WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER: ::DWORD = 0x00000008; -pub const WINHTTP_CALLBACK_STATUS_SENDING_REQUEST: ::DWORD = 0x00000010; -pub const WINHTTP_CALLBACK_STATUS_REQUEST_SENT: ::DWORD = 0x00000020; -pub const WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE: ::DWORD = 0x00000040; -pub const WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED: ::DWORD = 0x00000080; -pub const WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION: ::DWORD = 0x00000100; -pub const WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED: ::DWORD = 0x00000200; -pub const WINHTTP_CALLBACK_STATUS_HANDLE_CREATED: ::DWORD = 0x00000400; -pub const WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING: ::DWORD = 0x00000800; -pub const WINHTTP_CALLBACK_STATUS_DETECTING_PROXY: ::DWORD = 0x00001000; -pub const WINHTTP_CALLBACK_STATUS_REDIRECT: ::DWORD = 0x00004000; -pub const WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE: ::DWORD = 0x00008000; -pub const WINHTTP_CALLBACK_STATUS_SECURE_FAILURE: ::DWORD = 0x00010000; -pub const WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE: ::DWORD = 0x00020000; -pub const WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE: ::DWORD = 0x00040000; -pub const WINHTTP_CALLBACK_STATUS_READ_COMPLETE: ::DWORD = 0x00080000; -pub const WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE: ::DWORD = 0x00100000; -pub const WINHTTP_CALLBACK_STATUS_REQUEST_ERROR: ::DWORD = 0x00200000; -pub const WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE: ::DWORD = 0x00400000; -pub const WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE: ::DWORD = 0x01000000; -pub const WINHTTP_CALLBACK_STATUS_CLOSE_COMPLETE: ::DWORD = 0x02000000; -pub const WINHTTP_CALLBACK_STATUS_SHUTDOWN_COMPLETE: ::DWORD = 0x04000000; -pub const WINHTTP_CALLBACK_FLAG_RESOLVE_NAME: ::DWORD = WINHTTP_CALLBACK_STATUS_RESOLVING_NAME - | WINHTTP_CALLBACK_STATUS_NAME_RESOLVED; -pub const WINHTTP_CALLBACK_FLAG_CONNECT_TO_SERVER: ::DWORD = - WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER | WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER; -pub const WINHTTP_CALLBACK_FLAG_SEND_REQUEST: ::DWORD = - WINHTTP_CALLBACK_STATUS_SENDING_REQUEST | WINHTTP_CALLBACK_STATUS_REQUEST_SENT; -pub const WINHTTP_CALLBACK_FLAG_RECEIVE_RESPONSE: ::DWORD = - WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE | WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED; -pub const WINHTTP_CALLBACK_FLAG_CLOSE_CONNECTION: ::DWORD = - WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION | WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED; -pub const WINHTTP_CALLBACK_FLAG_HANDLES: ::DWORD = - WINHTTP_CALLBACK_STATUS_HANDLE_CREATED | WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING; -pub const WINHTTP_CALLBACK_FLAG_DETECTING_PROXY: ::DWORD = WINHTTP_CALLBACK_STATUS_DETECTING_PROXY; -pub const WINHTTP_CALLBACK_FLAG_REDIRECT: ::DWORD = WINHTTP_CALLBACK_STATUS_REDIRECT; -pub const WINHTTP_CALLBACK_FLAG_INTERMEDIATE_RESPONSE: ::DWORD = - WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE; -pub const WINHTTP_CALLBACK_FLAG_SECURE_FAILURE: ::DWORD = WINHTTP_CALLBACK_STATUS_SECURE_FAILURE; -pub const WINHTTP_CALLBACK_FLAG_SENDREQUEST_COMPLETE: ::DWORD = - WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE; -pub const WINHTTP_CALLBACK_FLAG_HEADERS_AVAILABLE: ::DWORD = - WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE; -pub const WINHTTP_CALLBACK_FLAG_DATA_AVAILABLE: ::DWORD = WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE; -pub const WINHTTP_CALLBACK_FLAG_READ_COMPLETE: ::DWORD = WINHTTP_CALLBACK_STATUS_READ_COMPLETE; -pub const WINHTTP_CALLBACK_FLAG_WRITE_COMPLETE: ::DWORD = WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE; -pub const WINHTTP_CALLBACK_FLAG_REQUEST_ERROR: ::DWORD = WINHTTP_CALLBACK_STATUS_REQUEST_ERROR; -pub const WINHTTP_CALLBACK_FLAG_GETPROXYFORURL_COMPLETE: ::DWORD = - WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE; -pub const WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS: ::DWORD = - WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE | WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE - | WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE | WINHTTP_CALLBACK_STATUS_READ_COMPLETE - | WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE | WINHTTP_CALLBACK_STATUS_REQUEST_ERROR - | WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE; -pub const WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS: ::DWORD = 0xffffffff; -pub const WINHTTP_QUERY_MIME_VERSION: ::DWORD = 0; -pub const WINHTTP_QUERY_CONTENT_TYPE: ::DWORD = 1; -pub const WINHTTP_QUERY_CONTENT_TRANSFER_ENCODING: ::DWORD = 2; -pub const WINHTTP_QUERY_CONTENT_ID: ::DWORD = 3; -pub const WINHTTP_QUERY_CONTENT_DESCRIPTION: ::DWORD = 4; -pub const WINHTTP_QUERY_CONTENT_LENGTH: ::DWORD = 5; -pub const WINHTTP_QUERY_CONTENT_LANGUAGE: ::DWORD = 6; -pub const WINHTTP_QUERY_ALLOW: ::DWORD = 7; -pub const WINHTTP_QUERY_PUBLIC: ::DWORD = 8; -pub const WINHTTP_QUERY_DATE: ::DWORD = 9; -pub const WINHTTP_QUERY_EXPIRES: ::DWORD = 10; -pub const WINHTTP_QUERY_LAST_MODIFIED: ::DWORD = 11; -pub const WINHTTP_QUERY_MESSAGE_ID: ::DWORD = 12; -pub const WINHTTP_QUERY_URI: ::DWORD = 13; -pub const WINHTTP_QUERY_DERIVED_FROM: ::DWORD = 14; -pub const WINHTTP_QUERY_COST: ::DWORD = 15; -pub const WINHTTP_QUERY_LINK: ::DWORD = 16; -pub const WINHTTP_QUERY_PRAGMA: ::DWORD = 17; -pub const WINHTTP_QUERY_VERSION: ::DWORD = 18; -pub const WINHTTP_QUERY_STATUS_CODE: ::DWORD = 19; -pub const WINHTTP_QUERY_STATUS_TEXT: ::DWORD = 20; -pub const WINHTTP_QUERY_RAW_HEADERS: ::DWORD = 21; -pub const WINHTTP_QUERY_RAW_HEADERS_CRLF: ::DWORD = 22; -pub const WINHTTP_QUERY_CONNECTION: ::DWORD = 23; -pub const WINHTTP_QUERY_ACCEPT: ::DWORD = 24; -pub const WINHTTP_QUERY_ACCEPT_CHARSET: ::DWORD = 25; -pub const WINHTTP_QUERY_ACCEPT_ENCODING: ::DWORD = 26; -pub const WINHTTP_QUERY_ACCEPT_LANGUAGE: ::DWORD = 27; -pub const WINHTTP_QUERY_AUTHORIZATION: ::DWORD = 28; -pub const WINHTTP_QUERY_CONTENT_ENCODING: ::DWORD = 29; -pub const WINHTTP_QUERY_FORWARDED: ::DWORD = 30; -pub const WINHTTP_QUERY_FROM: ::DWORD = 31; -pub const WINHTTP_QUERY_IF_MODIFIED_SINCE: ::DWORD = 32; -pub const WINHTTP_QUERY_LOCATION: ::DWORD = 33; -pub const WINHTTP_QUERY_ORIG_URI: ::DWORD = 34; -pub const WINHTTP_QUERY_REFERER: ::DWORD = 35; -pub const WINHTTP_QUERY_RETRY_AFTER: ::DWORD = 36; -pub const WINHTTP_QUERY_SERVER: ::DWORD = 37; -pub const WINHTTP_QUERY_TITLE: ::DWORD = 38; -pub const WINHTTP_QUERY_USER_AGENT: ::DWORD = 39; -pub const WINHTTP_QUERY_WWW_AUTHENTICATE: ::DWORD = 40; -pub const WINHTTP_QUERY_PROXY_AUTHENTICATE: ::DWORD = 41; -pub const WINHTTP_QUERY_ACCEPT_RANGES: ::DWORD = 42; -pub const WINHTTP_QUERY_SET_COOKIE: ::DWORD = 43; -pub const WINHTTP_QUERY_COOKIE: ::DWORD = 44; -pub const WINHTTP_QUERY_REQUEST_METHOD: ::DWORD = 45; -pub const WINHTTP_QUERY_REFRESH: ::DWORD = 46; -pub const WINHTTP_QUERY_CONTENT_DISPOSITION: ::DWORD = 47; -pub const WINHTTP_QUERY_AGE: ::DWORD = 48; -pub const WINHTTP_QUERY_CACHE_CONTROL: ::DWORD = 49; -pub const WINHTTP_QUERY_CONTENT_BASE: ::DWORD = 50; -pub const WINHTTP_QUERY_CONTENT_LOCATION: ::DWORD = 51; -pub const WINHTTP_QUERY_CONTENT_MD5: ::DWORD = 52; -pub const WINHTTP_QUERY_CONTENT_RANGE: ::DWORD = 53; -pub const WINHTTP_QUERY_ETAG: ::DWORD = 54; -pub const WINHTTP_QUERY_HOST: ::DWORD = 55; -pub const WINHTTP_QUERY_IF_MATCH: ::DWORD = 56; -pub const WINHTTP_QUERY_IF_NONE_MATCH: ::DWORD = 57; -pub const WINHTTP_QUERY_IF_RANGE: ::DWORD = 58; -pub const WINHTTP_QUERY_IF_UNMODIFIED_SINCE: ::DWORD = 59; -pub const WINHTTP_QUERY_MAX_FORWARDS: ::DWORD = 60; -pub const WINHTTP_QUERY_PROXY_AUTHORIZATION: ::DWORD = 61; -pub const WINHTTP_QUERY_RANGE: ::DWORD = 62; -pub const WINHTTP_QUERY_TRANSFER_ENCODING: ::DWORD = 63; -pub const WINHTTP_QUERY_UPGRADE: ::DWORD = 64; -pub const WINHTTP_QUERY_VARY: ::DWORD = 65; -pub const WINHTTP_QUERY_VIA: ::DWORD = 66; -pub const WINHTTP_QUERY_WARNING: ::DWORD = 67; -pub const WINHTTP_QUERY_EXPECT: ::DWORD = 68; -pub const WINHTTP_QUERY_PROXY_CONNECTION: ::DWORD = 69; -pub const WINHTTP_QUERY_UNLESS_MODIFIED_SINCE: ::DWORD = 70; -pub const WINHTTP_QUERY_PROXY_SUPPORT: ::DWORD = 75; -pub const WINHTTP_QUERY_AUTHENTICATION_INFO: ::DWORD = 76; -pub const WINHTTP_QUERY_PASSPORT_URLS: ::DWORD = 77; -pub const WINHTTP_QUERY_PASSPORT_CONFIG: ::DWORD = 78; -pub const WINHTTP_QUERY_MAX: ::DWORD = 78; -pub const WINHTTP_QUERY_CUSTOM: ::DWORD = 65535; -pub const WINHTTP_QUERY_FLAG_REQUEST_HEADERS: ::DWORD = 0x80000000; -pub const WINHTTP_QUERY_FLAG_SYSTEMTIME: ::DWORD = 0x40000000; -pub const WINHTTP_QUERY_FLAG_NUMBER: ::DWORD = 0x20000000; -pub const HTTP_STATUS_CONTINUE: ::DWORD = 100; -pub const HTTP_STATUS_SWITCH_PROTOCOLS: ::DWORD = 101; -pub const HTTP_STATUS_OK: ::DWORD = 200; -pub const HTTP_STATUS_CREATED: ::DWORD = 201; -pub const HTTP_STATUS_ACCEPTED: ::DWORD = 202; -pub const HTTP_STATUS_PARTIAL: ::DWORD = 203; -pub const HTTP_STATUS_NO_CONTENT: ::DWORD = 204; -pub const HTTP_STATUS_RESET_CONTENT: ::DWORD = 205; -pub const HTTP_STATUS_PARTIAL_CONTENT: ::DWORD = 206; -pub const HTTP_STATUS_WEBDAV_MULTI_STATUS: ::DWORD = 207; -pub const HTTP_STATUS_AMBIGUOUS: ::DWORD = 300; -pub const HTTP_STATUS_MOVED: ::DWORD = 301; -pub const HTTP_STATUS_REDIRECT: ::DWORD = 302; -pub const HTTP_STATUS_REDIRECT_METHOD: ::DWORD = 303; -pub const HTTP_STATUS_NOT_MODIFIED: ::DWORD = 304; -pub const HTTP_STATUS_USE_PROXY: ::DWORD = 305; -pub const HTTP_STATUS_REDIRECT_KEEP_VERB: ::DWORD = 307; -pub const HTTP_STATUS_BAD_REQUEST: ::DWORD = 400; -pub const HTTP_STATUS_DENIED: ::DWORD = 401; -pub const HTTP_STATUS_PAYMENT_REQ: ::DWORD = 402; -pub const HTTP_STATUS_FORBIDDEN: ::DWORD = 403; -pub const HTTP_STATUS_NOT_FOUND: ::DWORD = 404; -pub const HTTP_STATUS_BAD_METHOD: ::DWORD = 405; -pub const HTTP_STATUS_NONE_ACCEPTABLE: ::DWORD = 406; -pub const HTTP_STATUS_PROXY_AUTH_REQ: ::DWORD = 407; -pub const HTTP_STATUS_REQUEST_TIMEOUT: ::DWORD = 408; -pub const HTTP_STATUS_CONFLICT: ::DWORD = 409; -pub const HTTP_STATUS_GONE: ::DWORD = 410; -pub const HTTP_STATUS_LENGTH_REQUIRED: ::DWORD = 411; -pub const HTTP_STATUS_PRECOND_FAILED: ::DWORD = 412; -pub const HTTP_STATUS_REQUEST_TOO_LARGE: ::DWORD = 413; -pub const HTTP_STATUS_URI_TOO_LONG: ::DWORD = 414; -pub const HTTP_STATUS_UNSUPPORTED_MEDIA: ::DWORD = 415; -pub const HTTP_STATUS_RETRY_WITH: ::DWORD = 449; -pub const HTTP_STATUS_SERVER_ERROR: ::DWORD = 500; -pub const HTTP_STATUS_NOT_SUPPORTED: ::DWORD = 501; -pub const HTTP_STATUS_BAD_GATEWAY: ::DWORD = 502; -pub const HTTP_STATUS_SERVICE_UNAVAIL: ::DWORD = 503; -pub const HTTP_STATUS_GATEWAY_TIMEOUT: ::DWORD = 504; -pub const HTTP_STATUS_VERSION_NOT_SUP: ::DWORD = 505; -pub const HTTP_STATUS_FIRST: ::DWORD = HTTP_STATUS_CONTINUE; -pub const HTTP_STATUS_LAST: ::DWORD = HTTP_STATUS_VERSION_NOT_SUP; -pub const WINHTTP_ACCESS_TYPE_DEFAULT_PROXY: ::DWORD = 0; -pub const WINHTTP_ACCESS_TYPE_NO_PROXY: ::DWORD = 1; -pub const WINHTTP_ACCESS_TYPE_NAMED_PROXY: ::DWORD = 3; -pub const WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY: ::DWORD = 4; -pub const WINHTTP_ERROR_BASE: ::DWORD = 12000; -pub const ERROR_WINHTTP_OUT_OF_HANDLES: ::DWORD = WINHTTP_ERROR_BASE + 1; -pub const ERROR_WINHTTP_TIMEOUT: ::DWORD = WINHTTP_ERROR_BASE + 2; -pub const ERROR_WINHTTP_INTERNAL_ERROR: ::DWORD = WINHTTP_ERROR_BASE + 4; -pub const ERROR_WINHTTP_INVALID_URL: ::DWORD = WINHTTP_ERROR_BASE + 5; -pub const ERROR_WINHTTP_UNRECOGNIZED_SCHEME: ::DWORD = WINHTTP_ERROR_BASE + 6; -pub const ERROR_WINHTTP_NAME_NOT_RESOLVED: ::DWORD = WINHTTP_ERROR_BASE + 7; -pub const ERROR_WINHTTP_INVALID_OPTION: ::DWORD = WINHTTP_ERROR_BASE + 9; -pub const ERROR_WINHTTP_OPTION_NOT_SETTABLE: ::DWORD = WINHTTP_ERROR_BASE + 11; -pub const ERROR_WINHTTP_SHUTDOWN: ::DWORD = WINHTTP_ERROR_BASE + 12; -pub const ERROR_WINHTTP_LOGIN_FAILURE: ::DWORD = WINHTTP_ERROR_BASE + 15; -pub const ERROR_WINHTTP_OPERATION_CANCELLED: ::DWORD = WINHTTP_ERROR_BASE + 17; -pub const ERROR_WINHTTP_INCORRECT_HANDLE_TYPE: ::DWORD = WINHTTP_ERROR_BASE + 18; -pub const ERROR_WINHTTP_INCORRECT_HANDLE_STATE: ::DWORD = WINHTTP_ERROR_BASE + 19; -pub const ERROR_WINHTTP_CANNOT_CONNECT: ::DWORD = WINHTTP_ERROR_BASE + 29; -pub const ERROR_WINHTTP_CONNECTION_ERROR: ::DWORD = WINHTTP_ERROR_BASE + 30; -pub const ERROR_WINHTTP_RESEND_REQUEST: ::DWORD = WINHTTP_ERROR_BASE + 32; -pub const ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED: ::DWORD = WINHTTP_ERROR_BASE + 44; -pub const ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN: ::DWORD = WINHTTP_ERROR_BASE + 100; -pub const ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND: ::DWORD = WINHTTP_ERROR_BASE + 101; -pub const ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND: ::DWORD = WINHTTP_ERROR_BASE + 102; -pub const ERROR_WINHTTP_CANNOT_CALL_AFTER_OPEN: ::DWORD = WINHTTP_ERROR_BASE + 103; -pub const ERROR_WINHTTP_HEADER_NOT_FOUND: ::DWORD = WINHTTP_ERROR_BASE + 150; -pub const ERROR_WINHTTP_INVALID_SERVER_RESPONSE: ::DWORD = WINHTTP_ERROR_BASE + 152; -pub const ERROR_WINHTTP_INVALID_HEADER: ::DWORD = WINHTTP_ERROR_BASE + 153; -pub const ERROR_WINHTTP_INVALID_QUERY_REQUEST: ::DWORD = WINHTTP_ERROR_BASE + 154; -pub const ERROR_WINHTTP_HEADER_ALREADY_EXISTS: ::DWORD = WINHTTP_ERROR_BASE + 155; -pub const ERROR_WINHTTP_REDIRECT_FAILED: ::DWORD = WINHTTP_ERROR_BASE + 156; -pub const ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR: ::DWORD = WINHTTP_ERROR_BASE + 178; -pub const ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT: ::DWORD = WINHTTP_ERROR_BASE + 166; -pub const ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT: ::DWORD = WINHTTP_ERROR_BASE + 167; -pub const ERROR_WINHTTP_UNHANDLED_SCRIPT_TYPE: ::DWORD = WINHTTP_ERROR_BASE + 176; -pub const ERROR_WINHTTP_SCRIPT_EXECUTION_ERROR: ::DWORD = WINHTTP_ERROR_BASE + 177; -pub const ERROR_WINHTTP_NOT_INITIALIZED: ::DWORD = WINHTTP_ERROR_BASE + 172; -pub const ERROR_WINHTTP_SECURE_FAILURE: ::DWORD = WINHTTP_ERROR_BASE + 175; -pub const ERROR_WINHTTP_SECURE_CERT_DATE_INVALID: ::DWORD = WINHTTP_ERROR_BASE + 37; -pub const ERROR_WINHTTP_SECURE_CERT_CN_INVALID: ::DWORD = WINHTTP_ERROR_BASE + 38; -pub const ERROR_WINHTTP_SECURE_INVALID_CA: ::DWORD = WINHTTP_ERROR_BASE + 45; -pub const ERROR_WINHTTP_SECURE_CERT_REV_FAILED: ::DWORD = WINHTTP_ERROR_BASE + 57; -pub const ERROR_WINHTTP_SECURE_CHANNEL_ERROR: ::DWORD = WINHTTP_ERROR_BASE + 157; -pub const ERROR_WINHTTP_SECURE_INVALID_CERT: ::DWORD = WINHTTP_ERROR_BASE + 169; -pub const ERROR_WINHTTP_SECURE_CERT_REVOKED: ::DWORD = WINHTTP_ERROR_BASE + 170; -pub const ERROR_WINHTTP_SECURE_CERT_WRONG_USAGE: ::DWORD = WINHTTP_ERROR_BASE + 179; -pub const ERROR_WINHTTP_AUTODETECTION_FAILED: ::DWORD = WINHTTP_ERROR_BASE + 180; -pub const ERROR_WINHTTP_HEADER_COUNT_EXCEEDED: ::DWORD = WINHTTP_ERROR_BASE + 181; -pub const ERROR_WINHTTP_HEADER_SIZE_OVERFLOW: ::DWORD = WINHTTP_ERROR_BASE + 182; -pub const ERROR_WINHTTP_CHUNKED_ENCODING_HEADER_SIZE_OVERFLOW: ::DWORD = WINHTTP_ERROR_BASE + 183; -pub const ERROR_WINHTTP_RESPONSE_DRAIN_OVERFLOW: ::DWORD = WINHTTP_ERROR_BASE + 184; -pub const ERROR_WINHTTP_CLIENT_CERT_NO_PRIVATE_KEY: ::DWORD = WINHTTP_ERROR_BASE + 185; -pub const ERROR_WINHTTP_CLIENT_CERT_NO_ACCESS_PRIVATE_KEY: ::DWORD = WINHTTP_ERROR_BASE + 186; -pub const WINHTTP_ERROR_LAST: ::DWORD = WINHTTP_ERROR_BASE + 186; -pub const WINHTTP_RESET_STATE: ::DWORD = 0x00000001; -pub const WINHTTP_RESET_SWPAD_CURRENT_NETWORK: ::DWORD = 0x00000002; -pub const WINHTTP_RESET_SWPAD_ALL: ::DWORD = 0x00000004; -pub const WINHTTP_RESET_SCRIPT_CACHE: ::DWORD = 0x00000008; -pub const WINHTTP_RESET_ALL: ::DWORD = 0x0000FFFF; -pub const WINHTTP_RESET_NOTIFY_NETWORK_CHANGED: ::DWORD = 0x00010000; -pub const WINHTTP_RESET_OUT_OF_PROC: ::DWORD = 0x00020000; -STRUCT!{struct WINHTTP_CURRENT_USER_IE_PROXY_CONFIG { - fAutoDetect: ::BOOL, - lpszAutoConfigUrl: ::LPWSTR, - lpszProxy: ::LPWSTR, - lpszProxyBypass: ::LPWSTR, -}} -//1370 -ENUM!{enum WINHTTP_WEB_SOCKET_OPERATION { - WINHTTP_WEB_SOCKET_SEND_OPERATION = 0, - WINHTTP_WEB_SOCKET_RECEIVE_OPERATION = 1, - WINHTTP_WEB_SOCKET_CLOSE_OPERATION = 2, - WINHTTP_WEB_SOCKET_SHUTDOWN_OPERATION = 3, -}} -ENUM!{enum WINHTTP_WEB_SOCKET_BUFFER_TYPE { - WINHTTP_WEB_SOCKET_BINARY_MESSAGE_BUFFER_TYPE = 0, - WINHTTP_WEB_SOCKET_BINARY_FRAGMENT_BUFFER_TYPE = 1, - WINHTTP_WEB_SOCKET_UTF8_MESSAGE_BUFFER_TYPE = 2, - WINHTTP_WEB_SOCKET_UTF8_FRAGMENT_BUFFER_TYPE = 3, - WINHTTP_WEB_SOCKET_CLOSE_BUFFER_TYPE = 4, -}} -ENUM!{enum WINHTTP_WEB_SOCKET_CLOSE_STATUS { - WINHTTP_WEB_SOCKET_SUCCESS_CLOSE_STATUS = 1000, - WINHTTP_WEB_SOCKET_ENDPOINT_TERMINATED_CLOSE_STATUS = 1001, - WINHTTP_WEB_SOCKET_PROTOCOL_ERROR_CLOSE_STATUS = 1002, - WINHTTP_WEB_SOCKET_INVALID_DATA_TYPE_CLOSE_STATUS = 1003, - WINHTTP_WEB_SOCKET_EMPTY_CLOSE_STATUS = 1005, - WINHTTP_WEB_SOCKET_ABORTED_CLOSE_STATUS = 1006, - WINHTTP_WEB_SOCKET_INVALID_PAYLOAD_CLOSE_STATUS = 1007, - WINHTTP_WEB_SOCKET_POLICY_VIOLATION_CLOSE_STATUS = 1008, - WINHTTP_WEB_SOCKET_MESSAGE_TOO_BIG_CLOSE_STATUS = 1009, - WINHTTP_WEB_SOCKET_UNSUPPORTED_EXTENSIONS_CLOSE_STATUS = 1010, - WINHTTP_WEB_SOCKET_SERVER_ERROR_CLOSE_STATUS = 1011, - WINHTTP_WEB_SOCKET_SECURE_HANDSHAKE_ERROR_CLOSE_STATUS = 1015, -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/winioctl.rs cargo-0.37.0/vendor/winapi-0.2.8/src/winioctl.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/winioctl.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/winioctl.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,754 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! This module defines the 32-Bit Windows Device I/O control codes. -//123 -pub const FILE_DEVICE_BEEP: ::DWORD = 0x00000001; -pub const FILE_DEVICE_CD_ROM: ::DWORD = 0x00000002; -pub const FILE_DEVICE_CD_ROM_FILE_SYSTEM: ::DWORD = 0x00000003; -pub const FILE_DEVICE_CONTROLLER: ::DWORD = 0x00000004; -pub const FILE_DEVICE_DATALINK: ::DWORD = 0x00000005; -pub const FILE_DEVICE_DFS: ::DWORD = 0x00000006; -pub const FILE_DEVICE_DISK: ::DWORD = 0x00000007; -pub const FILE_DEVICE_DISK_FILE_SYSTEM: ::DWORD = 0x00000008; -pub const FILE_DEVICE_FILE_SYSTEM: ::DWORD = 0x00000009; -pub const FILE_DEVICE_INPORT_PORT: ::DWORD = 0x0000000a; -pub const FILE_DEVICE_KEYBOARD: ::DWORD = 0x0000000b; -pub const FILE_DEVICE_MAILSLOT: ::DWORD = 0x0000000c; -pub const FILE_DEVICE_MIDI_IN: ::DWORD = 0x0000000d; -pub const FILE_DEVICE_MIDI_OUT: ::DWORD = 0x0000000e; -pub const FILE_DEVICE_MOUSE: ::DWORD = 0x0000000f; -pub const FILE_DEVICE_MULTI_UNC_PROVIDER: ::DWORD = 0x00000010; -pub const FILE_DEVICE_NAMED_PIPE: ::DWORD = 0x00000011; -pub const FILE_DEVICE_NETWORK: ::DWORD = 0x00000012; -pub const FILE_DEVICE_NETWORK_BROWSER: ::DWORD = 0x00000013; -pub const FILE_DEVICE_NETWORK_FILE_SYSTEM: ::DWORD = 0x00000014; -pub const FILE_DEVICE_NULL: ::DWORD = 0x00000015; -pub const FILE_DEVICE_PARALLEL_PORT: ::DWORD = 0x00000016; -pub const FILE_DEVICE_PHYSICAL_NETCARD: ::DWORD = 0x00000017; -pub const FILE_DEVICE_PRINTER: ::DWORD = 0x00000018; -pub const FILE_DEVICE_SCANNER: ::DWORD = 0x00000019; -pub const FILE_DEVICE_SERIAL_MOUSE_PORT: ::DWORD = 0x0000001a; -pub const FILE_DEVICE_SERIAL_PORT: ::DWORD = 0x0000001b; -pub const FILE_DEVICE_SCREEN: ::DWORD = 0x0000001c; -pub const FILE_DEVICE_SOUND: ::DWORD = 0x0000001d; -pub const FILE_DEVICE_STREAMS: ::DWORD = 0x0000001e; -pub const FILE_DEVICE_TAPE: ::DWORD = 0x0000001f; -pub const FILE_DEVICE_TAPE_FILE_SYSTEM: ::DWORD = 0x00000020; -pub const FILE_DEVICE_TRANSPORT: ::DWORD = 0x00000021; -pub const FILE_DEVICE_UNKNOWN: ::DWORD = 0x00000022; -pub const FILE_DEVICE_VIDEO: ::DWORD = 0x00000023; -pub const FILE_DEVICE_VIRTUAL_DISK: ::DWORD = 0x00000024; -pub const FILE_DEVICE_WAVE_IN: ::DWORD = 0x00000025; -pub const FILE_DEVICE_WAVE_OUT: ::DWORD = 0x00000026; -pub const FILE_DEVICE_8042_PORT: ::DWORD = 0x00000027; -pub const FILE_DEVICE_NETWORK_REDIRECTOR: ::DWORD = 0x00000028; -pub const FILE_DEVICE_BATTERY: ::DWORD = 0x00000029; -pub const FILE_DEVICE_BUS_EXTENDER: ::DWORD = 0x0000002a; -pub const FILE_DEVICE_MODEM: ::DWORD = 0x0000002b; -pub const FILE_DEVICE_VDM: ::DWORD = 0x0000002c; -pub const FILE_DEVICE_MASS_STORAGE: ::DWORD = 0x0000002d; -pub const FILE_DEVICE_SMB: ::DWORD = 0x0000002e; -pub const FILE_DEVICE_KS: ::DWORD = 0x0000002f; -pub const FILE_DEVICE_CHANGER: ::DWORD = 0x00000030; -pub const FILE_DEVICE_SMARTCARD: ::DWORD = 0x00000031; -pub const FILE_DEVICE_ACPI: ::DWORD = 0x00000032; -pub const FILE_DEVICE_DVD: ::DWORD = 0x00000033; -pub const FILE_DEVICE_FULLSCREEN_VIDEO: ::DWORD = 0x00000034; -pub const FILE_DEVICE_DFS_FILE_SYSTEM: ::DWORD = 0x00000035; -pub const FILE_DEVICE_DFS_VOLUME: ::DWORD = 0x00000036; -pub const FILE_DEVICE_SERENUM: ::DWORD = 0x00000037; -pub const FILE_DEVICE_TERMSRV: ::DWORD = 0x00000038; -pub const FILE_DEVICE_KSEC: ::DWORD = 0x00000039; -pub const FILE_DEVICE_FIPS: ::DWORD = 0x0000003A; -pub const FILE_DEVICE_INFINIBAND: ::DWORD = 0x0000003B; -pub const FILE_DEVICE_VMBUS: ::DWORD = 0x0000003E; -pub const FILE_DEVICE_CRYPT_PROVIDER: ::DWORD = 0x0000003F; -pub const FILE_DEVICE_WPD: ::DWORD = 0x00000040; -pub const FILE_DEVICE_BLUETOOTH: ::DWORD = 0x00000041; -pub const FILE_DEVICE_MT_COMPOSITE: ::DWORD = 0x00000042; -pub const FILE_DEVICE_MT_TRANSPORT: ::DWORD = 0x00000043; -pub const FILE_DEVICE_BIOMETRIC: ::DWORD = 0x00000044; -pub const FILE_DEVICE_PMI: ::DWORD = 0x00000045; -pub const FILE_DEVICE_EHSTOR: ::DWORD = 0x00000046; -pub const FILE_DEVICE_DEVAPI: ::DWORD = 0x00000047; -pub const FILE_DEVICE_GPIO: ::DWORD = 0x00000048; -pub const FILE_DEVICE_USBEX: ::DWORD = 0x00000049; -pub const FILE_DEVICE_CONSOLE: ::DWORD = 0x00000050; -pub const FILE_DEVICE_NFP: ::DWORD = 0x00000051; -pub const FILE_DEVICE_SYSENV: ::DWORD = 0x00000052; -pub const FILE_DEVICE_VIRTUAL_BLOCK: ::DWORD = 0x00000053; -pub const FILE_DEVICE_POINT_OF_SERVICE: ::DWORD = 0x00000054; -//224 -pub const METHOD_BUFFERED: ::DWORD = 0; -pub const METHOD_IN_DIRECT: ::DWORD = 1; -pub const METHOD_OUT_DIRECT: ::DWORD = 2; -pub const METHOD_NEITHER: ::DWORD = 3; -//253 -pub const FILE_ANY_ACCESS: ::DWORD = 0; -pub const FILE_SPECIAL_ACCESS: ::DWORD = FILE_ANY_ACCESS; -pub const FILE_READ_ACCESS: ::DWORD = 0x0001; -pub const FILE_WRITE_ACCESS: ::DWORD = 0x0002; -//281 -pub const IOCTL_STORAGE_BASE: ::DWORD = FILE_DEVICE_MASS_STORAGE; -pub const IOCTL_STORAGE_CHECK_VERIFY: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0200, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_STORAGE_CHECK_VERIFY2: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0200, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_STORAGE_MEDIA_REMOVAL: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0201, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_STORAGE_EJECT_MEDIA: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0202, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_STORAGE_LOAD_MEDIA: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0203, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_STORAGE_LOAD_MEDIA2: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0203, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_STORAGE_RESERVE: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, - FILE_READ_ACCESS); -pub const IOCTL_STORAGE_RELEASE: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, - FILE_READ_ACCESS); -pub const IOCTL_STORAGE_FIND_NEW_DEVICES: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0206, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_STORAGE_EJECTION_CONTROL: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0250, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_STORAGE_MCN_CONTROL: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0251, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_STORAGE_GET_MEDIA_TYPES: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0300, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_STORAGE_GET_MEDIA_TYPES_EX: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0301, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0304, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_STORAGE_GET_HOTPLUG_INFO: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0305, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_STORAGE_SET_HOTPLUG_INFO: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0306, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_STORAGE_RESET_BUS: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, - FILE_READ_ACCESS); -pub const IOCTL_STORAGE_RESET_DEVICE: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0401, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_STORAGE_BREAK_RESERVATION: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0405, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_STORAGE_PERSISTENT_RESERVE_IN: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0406, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_STORAGE_PERSISTENT_RESERVE_OUT: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0407, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_STORAGE_GET_DEVICE_NUMBER: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0420, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_STORAGE_PREDICT_FAILURE: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0440, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_STORAGE_FAILURE_PREDICTION_CONFIG: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0441, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_STORAGE_READ_CAPACITY: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0450, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_STORAGE_GET_DEVICE_TELEMETRY: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0470, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_STORAGE_DEVICE_TELEMETRY_NOTIFY: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0471, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_STORAGE_DEVICE_TELEMETRY_QUERY_CAPS: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, - 0x0472, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_STORAGE_GET_DEVICE_TELEMETRY_RAW: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0473, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_STORAGE_QUERY_PROPERTY: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0500, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0501, - METHOD_BUFFERED, FILE_WRITE_ACCESS); -pub const IOCTL_STORAGE_GET_LB_PROVISIONING_MAP_RESOURCES: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, - 0x0502, METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_STORAGE_GET_BC_PROPERTIES: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0600, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_STORAGE_ALLOCATE_BC_STREAM: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0601, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_STORAGE_FREE_BC_STREAM: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0602, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_STORAGE_CHECK_PRIORITY_HINT_SUPPORT: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, - 0x0620, METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_STORAGE_START_DATA_INTEGRITY_CHECK: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0621, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_STORAGE_STOP_DATA_INTEGRITY_CHECK: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0622, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const OBSOLETE_IOCTL_STORAGE_RESET_BUS: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0400, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const OBSOLETE_IOCTL_STORAGE_RESET_DEVICE: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0401, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_STORAGE_ENABLE_IDLE_POWER: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0720, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_STORAGE_GET_IDLE_POWERUP_REASON: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0721, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_STORAGE_POWER_ACTIVE: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0722, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_STORAGE_POWER_IDLE: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0723, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_STORAGE_EVENT_NOTIFICATION: ::DWORD = CTL_CODE!(IOCTL_STORAGE_BASE, 0x0724, - METHOD_BUFFERED, FILE_ANY_ACCESS); -//2627 -pub const IOCTL_DISK_BASE: ::DWORD = FILE_DEVICE_DISK; -pub const IOCTL_DISK_GET_DRIVE_GEOMETRY: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0000, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_DISK_GET_PARTITION_INFO: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0001, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_DISK_SET_PARTITION_INFO: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0002, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_DISK_GET_DRIVE_LAYOUT: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0003, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_DISK_SET_DRIVE_LAYOUT: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0004, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_DISK_VERIFY: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0005, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const IOCTL_DISK_FORMAT_TRACKS: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0006, METHOD_BUFFERED, - FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_DISK_REASSIGN_BLOCKS: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0007, METHOD_BUFFERED, - FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_DISK_PERFORMANCE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0008, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const IOCTL_DISK_IS_WRITABLE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0009, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const IOCTL_DISK_LOGGING: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x000a, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const IOCTL_DISK_FORMAT_TRACKS_EX: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x000b, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_DISK_HISTOGRAM_STRUCTURE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x000c, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_DISK_HISTOGRAM_DATA: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x000d, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const IOCTL_DISK_HISTOGRAM_RESET: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x000e, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const IOCTL_DISK_REQUEST_STRUCTURE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x000f, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_DISK_REQUEST_DATA: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0010, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const IOCTL_DISK_PERFORMANCE_OFF: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0018, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const IOCTL_DISK_CONTROLLER_NUMBER: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0011, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const SMART_GET_VERSION: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0020, METHOD_BUFFERED, - FILE_READ_ACCESS); -pub const SMART_SEND_DRIVE_COMMAND: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0021, METHOD_BUFFERED, - FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const SMART_RCV_DRIVE_DATA: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0022, METHOD_BUFFERED, - FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_DISK_GET_PARTITION_INFO_EX: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0012, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_DISK_SET_PARTITION_INFO_EX: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0013, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_DISK_GET_DRIVE_LAYOUT_EX: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0014, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_DISK_SET_DRIVE_LAYOUT_EX: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0015, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_DISK_CREATE_DISK: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0016, METHOD_BUFFERED, - FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_DISK_GET_LENGTH_INFO: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0017, METHOD_BUFFERED, - FILE_READ_ACCESS); -pub const IOCTL_DISK_GET_DRIVE_GEOMETRY_EX: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0028, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_DISK_REASSIGN_BLOCKS_EX: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0029, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_DISK_UPDATE_DRIVE_SIZE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0032, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_DISK_GROW_PARTITION: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0034, METHOD_BUFFERED, - FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_DISK_GET_CACHE_INFORMATION: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0035, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_DISK_SET_CACHE_INFORMATION: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0036, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_DISK_GET_WRITE_CACHE_STATE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0037, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const OBSOLETE_DISK_GET_WRITE_CACHE_STATE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0037, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_DISK_DELETE_DRIVE_LAYOUT: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0040, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_DISK_UPDATE_PROPERTIES: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0050, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_DISK_FORMAT_DRIVE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x00f3, METHOD_BUFFERED, - FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_DISK_SENSE_DEVICE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x00f8, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const IOCTL_DISK_CHECK_VERIFY: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0200, METHOD_BUFFERED, - FILE_READ_ACCESS); -pub const IOCTL_DISK_MEDIA_REMOVAL: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0201, METHOD_BUFFERED, - FILE_READ_ACCESS); -pub const IOCTL_DISK_EJECT_MEDIA: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0202, METHOD_BUFFERED, - FILE_READ_ACCESS); -pub const IOCTL_DISK_LOAD_MEDIA: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0203, METHOD_BUFFERED, - FILE_READ_ACCESS); -pub const IOCTL_DISK_RESERVE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0204, METHOD_BUFFERED, - FILE_READ_ACCESS); -pub const IOCTL_DISK_RELEASE: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0205, METHOD_BUFFERED, - FILE_READ_ACCESS); -pub const IOCTL_DISK_FIND_NEW_DEVICES: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0206, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_DISK_GET_MEDIA_TYPES: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0300, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const IOCTL_DISK_GET_DISK_ATTRIBUTES: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x003c, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const IOCTL_DISK_SET_DISK_ATTRIBUTES: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x003d, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_DISK_RESET_SNAPSHOT_INFO: ::DWORD = CTL_CODE!(IOCTL_DISK_BASE, 0x0084, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -//3907 -pub const IOCTL_CHANGER_BASE: ::DWORD = FILE_DEVICE_CHANGER; -pub const IOCTL_CHANGER_GET_PARAMETERS: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0000, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_CHANGER_GET_STATUS: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0001, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_CHANGER_GET_PRODUCT_DATA: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0002, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_CHANGER_SET_ACCESS: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0004, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_CHANGER_GET_ELEMENT_STATUS: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0005, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_CHANGER_INITIALIZE_ELEMENT_STATUS: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0006, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_CHANGER_SET_POSITION: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0007, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_CHANGER_EXCHANGE_MEDIUM: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0008, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_CHANGER_MOVE_MEDIUM: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x0009, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_CHANGER_REINITIALIZE_TRANSPORT: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x000A, - METHOD_BUFFERED, FILE_READ_ACCESS); -pub const IOCTL_CHANGER_QUERY_VOLUME_TAGS: ::DWORD = CTL_CODE!(IOCTL_CHANGER_BASE, 0x000B, - METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_SERIAL_LSRMST_INSERT: ::DWORD = CTL_CODE!(FILE_DEVICE_SERIAL_PORT, 31, - METHOD_BUFFERED,FILE_ANY_ACCESS); -pub const IOCTL_SERENUM_EXPOSE_HARDWARE: ::DWORD = CTL_CODE!(FILE_DEVICE_SERENUM, 128, - METHOD_BUFFERED,FILE_ANY_ACCESS); -pub const IOCTL_SERENUM_REMOVE_HARDWARE: ::DWORD = CTL_CODE!(FILE_DEVICE_SERENUM, 129, - METHOD_BUFFERED,FILE_ANY_ACCESS); -pub const IOCTL_SERENUM_PORT_DESC: ::DWORD = CTL_CODE!(FILE_DEVICE_SERENUM, 130, - METHOD_BUFFERED,FILE_ANY_ACCESS); -pub const IOCTL_SERENUM_GET_PORT_NAME: ::DWORD = CTL_CODE!(FILE_DEVICE_SERENUM, 131, - METHOD_BUFFERED,FILE_ANY_ACCESS); -//4690 -pub const FSCTL_REQUEST_OPLOCK_LEVEL_1: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 0, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_REQUEST_OPLOCK_LEVEL_2: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 1, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_REQUEST_BATCH_OPLOCK: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 2, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_OPLOCK_BREAK_ACKNOWLEDGE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 3, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_OPBATCH_ACK_CLOSE_PENDING: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 4, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_OPLOCK_BREAK_NOTIFY: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 5, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_LOCK_VOLUME: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 6, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_UNLOCK_VOLUME: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 7, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_DISMOUNT_VOLUME: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 8, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_IS_VOLUME_MOUNTED: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 10, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_IS_PATHNAME_VALID: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 11, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_MARK_VOLUME_DIRTY: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 12, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_QUERY_RETRIEVAL_POINTERS: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 14, - METHOD_NEITHER, FILE_ANY_ACCESS); -pub const FSCTL_GET_COMPRESSION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 15, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_SET_COMPRESSION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 16, METHOD_BUFFERED, - ::FILE_READ_DATA | ::FILE_WRITE_DATA); -pub const FSCTL_SET_BOOTLOADER_ACCESSED: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 19, - METHOD_NEITHER, FILE_ANY_ACCESS); -pub const FSCTL_MARK_AS_SYSTEM_HIVE: ::DWORD = FSCTL_SET_BOOTLOADER_ACCESSED; -pub const FSCTL_OPLOCK_BREAK_ACK_NO_2: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 20, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_INVALIDATE_VOLUMES: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 21, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_QUERY_FAT_BPB: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 22, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_REQUEST_FILTER_OPLOCK: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 23, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_FILESYSTEM_GET_STATISTICS: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 24, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_GET_NTFS_VOLUME_DATA: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 25, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_GET_NTFS_FILE_RECORD: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 26, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_GET_VOLUME_BITMAP: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 27, METHOD_NEITHER, - FILE_ANY_ACCESS); -pub const FSCTL_GET_RETRIEVAL_POINTERS: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 28, - METHOD_NEITHER, FILE_ANY_ACCESS); -pub const FSCTL_MOVE_FILE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 29, METHOD_BUFFERED, - FILE_SPECIAL_ACCESS); -pub const FSCTL_IS_VOLUME_DIRTY: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 30, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_ALLOW_EXTENDED_DASD_IO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 32, - METHOD_NEITHER, FILE_ANY_ACCESS); -pub const FSCTL_FIND_FILES_BY_SID: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 35, METHOD_NEITHER, - FILE_ANY_ACCESS); -pub const FSCTL_SET_OBJECT_ID: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 38, METHOD_BUFFERED, - FILE_SPECIAL_ACCESS); -pub const FSCTL_GET_OBJECT_ID: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 39, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_DELETE_OBJECT_ID: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 40, METHOD_BUFFERED, - FILE_SPECIAL_ACCESS); -pub const FSCTL_SET_REPARSE_POINT: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 41, - METHOD_BUFFERED, FILE_SPECIAL_ACCESS); -pub const FSCTL_GET_REPARSE_POINT: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 42, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_DELETE_REPARSE_POINT: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 43, - METHOD_BUFFERED, FILE_SPECIAL_ACCESS); -pub const FSCTL_ENUM_USN_DATA: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 44, - METHOD_NEITHER, FILE_ANY_ACCESS); -pub const FSCTL_SECURITY_ID_CHECK: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 45, METHOD_NEITHER, - ::FILE_READ_DATA); -pub const FSCTL_READ_USN_JOURNAL: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 46, METHOD_NEITHER, - FILE_ANY_ACCESS); -pub const FSCTL_SET_OBJECT_ID_EXTENDED: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 47, - METHOD_BUFFERED, FILE_SPECIAL_ACCESS); -pub const FSCTL_CREATE_OR_GET_OBJECT_ID: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 48, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_SET_SPARSE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, - FILE_SPECIAL_ACCESS); -pub const FSCTL_SET_ZERO_DATA: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 50, METHOD_BUFFERED, - ::FILE_WRITE_DATA); -pub const FSCTL_QUERY_ALLOCATED_RANGES: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 51, - METHOD_NEITHER, ::FILE_READ_DATA); -pub const FSCTL_ENABLE_UPGRADE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 52, METHOD_BUFFERED, - ::FILE_WRITE_DATA); -pub const FSCTL_SET_ENCRYPTION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 53, METHOD_NEITHER, - FILE_ANY_ACCESS); -pub const FSCTL_ENCRYPTION_FSCTL_IO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 54, - METHOD_NEITHER, FILE_ANY_ACCESS); -pub const FSCTL_WRITE_RAW_ENCRYPTED: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 55, - METHOD_NEITHER, FILE_SPECIAL_ACCESS); -pub const FSCTL_READ_RAW_ENCRYPTED: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 56, - METHOD_NEITHER, FILE_SPECIAL_ACCESS); -pub const FSCTL_CREATE_USN_JOURNAL: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 57, - METHOD_NEITHER, FILE_ANY_ACCESS); -pub const FSCTL_READ_FILE_USN_DATA: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 58, - METHOD_NEITHER, FILE_ANY_ACCESS); -pub const FSCTL_WRITE_USN_CLOSE_RECORD: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 59, - METHOD_NEITHER, FILE_ANY_ACCESS); -pub const FSCTL_EXTEND_VOLUME: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 60, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_QUERY_USN_JOURNAL: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 61, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_DELETE_USN_JOURNAL: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 62, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_MARK_HANDLE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 63, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_SIS_COPYFILE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 64, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_SIS_LINK_FILES: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 65, METHOD_BUFFERED, - ::FILE_READ_DATA | ::FILE_WRITE_DATA); -pub const FSCTL_RECALL_FILE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 69, METHOD_NEITHER, - FILE_ANY_ACCESS); -pub const FSCTL_READ_FROM_PLEX: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 71, METHOD_OUT_DIRECT, - ::FILE_READ_DATA); -pub const FSCTL_FILE_PREFETCH: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 72, METHOD_BUFFERED, - FILE_SPECIAL_ACCESS); -pub const FSCTL_MAKE_MEDIA_COMPATIBLE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 76, - METHOD_BUFFERED, ::FILE_WRITE_DATA); -pub const FSCTL_SET_DEFECT_MANAGEMENT: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 77, - METHOD_BUFFERED, ::FILE_WRITE_DATA); -pub const FSCTL_QUERY_SPARING_INFO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 78, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_QUERY_ON_DISK_VOLUME_INFO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 79, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_SET_VOLUME_COMPRESSION_STATE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 80, - METHOD_BUFFERED, FILE_SPECIAL_ACCESS); -pub const FSCTL_TXFS_MODIFY_RM: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 81, METHOD_BUFFERED, - ::FILE_WRITE_DATA); -pub const FSCTL_TXFS_QUERY_RM_INFORMATION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 82, - METHOD_BUFFERED, ::FILE_READ_DATA); -pub const FSCTL_TXFS_ROLLFORWARD_REDO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 84, - METHOD_BUFFERED, ::FILE_WRITE_DATA); -pub const FSCTL_TXFS_ROLLFORWARD_UNDO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 85, - METHOD_BUFFERED, ::FILE_WRITE_DATA); -pub const FSCTL_TXFS_START_RM: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 86, METHOD_BUFFERED, - ::FILE_WRITE_DATA); -pub const FSCTL_TXFS_SHUTDOWN_RM: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 87, METHOD_BUFFERED, - ::FILE_WRITE_DATA); -pub const FSCTL_TXFS_READ_BACKUP_INFORMATION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 88, - METHOD_BUFFERED, ::FILE_READ_DATA); -pub const FSCTL_TXFS_WRITE_BACKUP_INFORMATION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 89, - METHOD_BUFFERED, ::FILE_WRITE_DATA); -pub const FSCTL_TXFS_CREATE_SECONDARY_RM: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 90, - METHOD_BUFFERED, ::FILE_WRITE_DATA); -pub const FSCTL_TXFS_GET_METADATA_INFO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 91, - METHOD_BUFFERED, ::FILE_READ_DATA); -pub const FSCTL_TXFS_GET_TRANSACTED_VERSION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 92, - METHOD_BUFFERED, ::FILE_READ_DATA); -pub const FSCTL_TXFS_SAVEPOINT_INFORMATION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 94, - METHOD_BUFFERED, ::FILE_WRITE_DATA); -pub const FSCTL_TXFS_CREATE_MINIVERSION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 95, - METHOD_BUFFERED, ::FILE_WRITE_DATA); -pub const FSCTL_TXFS_TRANSACTION_ACTIVE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 99, - METHOD_BUFFERED, ::FILE_READ_DATA); -pub const FSCTL_SET_ZERO_ON_DEALLOCATION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 101, - METHOD_BUFFERED, FILE_SPECIAL_ACCESS); -pub const FSCTL_SET_REPAIR: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 102, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_GET_REPAIR: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 103, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_WAIT_FOR_REPAIR: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 104, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_INITIATE_REPAIR: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 106, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_CSC_INTERNAL: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 107, METHOD_NEITHER, - FILE_ANY_ACCESS); -pub const FSCTL_SHRINK_VOLUME: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 108, METHOD_BUFFERED, - FILE_SPECIAL_ACCESS); -pub const FSCTL_SET_SHORT_NAME_BEHAVIOR: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 109, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_DFSR_SET_GHOST_HANDLE_STATE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 110, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_TXFS_LIST_TRANSACTION_LOCKED_FILES: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, - 120, METHOD_BUFFERED, ::FILE_READ_DATA); -pub const FSCTL_TXFS_LIST_TRANSACTIONS: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 121, - METHOD_BUFFERED, ::FILE_READ_DATA); -pub const FSCTL_QUERY_PAGEFILE_ENCRYPTION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 122, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_RESET_VOLUME_ALLOCATION_HINTS: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 123, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_QUERY_DEPENDENT_VOLUME: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 124, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_SD_GLOBAL_CHANGE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 125, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_TXFS_READ_BACKUP_INFORMATION2: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 126, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_LOOKUP_STREAM_FROM_CLUSTER: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 127, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_TXFS_WRITE_BACKUP_INFORMATION2: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 128, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_FILE_TYPE_NOTIFICATION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 129, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_FILE_LEVEL_TRIM: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 130, METHOD_BUFFERED, - ::FILE_WRITE_DATA); -pub const FSCTL_GET_BOOT_AREA_INFO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 140, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_GET_RETRIEVAL_POINTER_BASE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 141, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_SET_PERSISTENT_VOLUME_STATE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 142, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_QUERY_PERSISTENT_VOLUME_STATE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 143, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_REQUEST_OPLOCK: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 144, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_CSV_TUNNEL_REQUEST: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 145, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_IS_CSV_FILE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 146, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_QUERY_FILE_SYSTEM_RECOGNITION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 147, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_CSV_GET_VOLUME_PATH_NAME: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 148, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_CSV_GET_VOLUME_NAME_FOR_VOLUME_MOUNT_POINT: ::DWORD = CTL_CODE!( - FILE_DEVICE_FILE_SYSTEM, 149, METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_CSV_GET_VOLUME_PATH_NAMES_FOR_VOLUME_NAME: ::DWORD = CTL_CODE!( - FILE_DEVICE_FILE_SYSTEM, 150, METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_IS_FILE_ON_CSV_VOLUME: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 151, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_CORRUPTION_HANDLING: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 152, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_OFFLOAD_READ: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 153, METHOD_BUFFERED, - FILE_READ_ACCESS); -pub const FSCTL_OFFLOAD_WRITE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 154, METHOD_BUFFERED, - FILE_WRITE_ACCESS); -pub const FSCTL_CSV_INTERNAL: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 155, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_SET_PURGE_FAILURE_MODE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 156, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_QUERY_FILE_LAYOUT: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 157, - METHOD_NEITHER, FILE_ANY_ACCESS); -pub const FSCTL_IS_VOLUME_OWNED_BYCSVFS: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 158, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_GET_INTEGRITY_INFORMATION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 159, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_SET_INTEGRITY_INFORMATION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 160, - METHOD_BUFFERED, ::FILE_READ_DATA | ::FILE_WRITE_DATA); -pub const FSCTL_QUERY_FILE_REGIONS: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 161, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_DEDUP_FILE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 165, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_DEDUP_QUERY_FILE_HASHES: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 166, - METHOD_NEITHER, ::FILE_READ_DATA); -pub const FSCTL_DEDUP_QUERY_RANGE_STATE: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 167, - METHOD_NEITHER, ::FILE_READ_DATA); -pub const FSCTL_DEDUP_QUERY_REPARSE_INFO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 168, - METHOD_NEITHER, FILE_ANY_ACCESS); -pub const FSCTL_RKF_INTERNAL: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 171, METHOD_NEITHER, - FILE_ANY_ACCESS); -pub const FSCTL_SCRUB_DATA: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 172, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_REPAIR_COPIES: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 173, METHOD_BUFFERED, - ::FILE_READ_DATA | ::FILE_WRITE_DATA); -pub const FSCTL_DISABLE_LOCAL_BUFFERING: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 174, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_CSV_MGMT_LOCK: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 175, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_CSV_QUERY_DOWN_LEVEL_FILE_SYSTEM_CHARACTERISTICS: ::DWORD = CTL_CODE!( - FILE_DEVICE_FILE_SYSTEM, 176, METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_ADVANCE_FILE_ID: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 177, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_CSV_SYNC_TUNNEL_REQUEST: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 178, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_CSV_QUERY_VETO_FILE_DIRECT_IO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 179, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_WRITE_USN_REASON: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 180, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_CSV_CONTROL: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 181, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const FSCTL_GET_REFS_VOLUME_DATA: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 182, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_CSV_H_BREAKING_SYNC_TUNNEL_REQUEST: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, - 185, METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_QUERY_STORAGE_CLASSES: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 187, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_QUERY_REGION_INFO: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 188, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_USN_TRACK_MODIFIED_RANGES: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 189, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_QUERY_SHARED_VIRTUAL_DISK_SUPPORT: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, - 192, METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_SVHDX_SYNC_TUNNEL_REQUEST: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 193, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_SVHDX_SET_INITIATOR_INFORMATION: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 194, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_SET_EXTERNAL_BACKING: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 195, - METHOD_BUFFERED, FILE_SPECIAL_ACCESS); -pub const FSCTL_GET_EXTERNAL_BACKING: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 196, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_DELETE_EXTERNAL_BACKING: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 197, - METHOD_BUFFERED, FILE_SPECIAL_ACCESS); -pub const FSCTL_ENUM_EXTERNAL_BACKING: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 198, - METHOD_BUFFERED, FILE_ANY_ACCESS); -pub const FSCTL_ENUM_OVERLAY: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 199, METHOD_NEITHER, - FILE_ANY_ACCESS); -pub const FSCTL_ADD_OVERLAY: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 204, METHOD_BUFFERED, - ::FILE_WRITE_DATA); -pub const FSCTL_REMOVE_OVERLAY: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 205, METHOD_BUFFERED, - ::FILE_WRITE_DATA); -pub const FSCTL_UPDATE_OVERLAY: ::DWORD = CTL_CODE!(FILE_DEVICE_FILE_SYSTEM, 206, METHOD_BUFFERED, - ::FILE_WRITE_DATA); -// FILE_DEVICE_AVIO is defined nowhere -//pub const IOCTL_AVIO_ALLOCATE_STREAM: ::DWORD = CTL_CODE!(FILE_DEVICE_AVIO, 1, METHOD_BUFFERED, -// FILE_SPECIAL_ACCESS); -//pub const IOCTL_AVIO_FREE_STREAM: ::DWORD = CTL_CODE!(FILE_DEVICE_AVIO, 2, METHOD_BUFFERED, -// FILE_SPECIAL_ACCESS); -//pub const IOCTL_AVIO_MODIFY_STREAM: ::DWORD = CTL_CODE!(FILE_DEVICE_AVIO, 3, METHOD_BUFFERED, -// FILE_SPECIAL_ACCESS); -STRUCT!{struct PATHNAME_BUFFER { - PathNameLength: ::DWORD, - Name: [::WCHAR; 1], -}} -pub type PPATHNAME_BUFFER = *mut PATHNAME_BUFFER; -STRUCT!{nodebug struct FSCTL_QUERY_FAT_BPB_BUFFER { - First0x24BytesOfBootSector: [::BYTE; 0x24], -}} -pub type PFSCTL_QUERY_FAT_BPB_BUFFER = *mut FSCTL_QUERY_FAT_BPB_BUFFER; -STRUCT!{struct NTFS_VOLUME_DATA_BUFFER { - VolumeSerialNumber: ::LARGE_INTEGER, - NumberSectors: ::LARGE_INTEGER, - TotalClusters: ::LARGE_INTEGER, - FreeClusters: ::LARGE_INTEGER, - TotalReserved: ::LARGE_INTEGER, - BytesPerSector: ::DWORD, - BytesPerCluster: ::DWORD, - BytesPerFileRecordSegment: ::DWORD, - ClustersPerFileRecordSegment: ::DWORD, - MftValidDataLength: ::LARGE_INTEGER, - MftStartLcn: ::LARGE_INTEGER, - Mft2StartLcn: ::LARGE_INTEGER, - MftZoneStart: ::LARGE_INTEGER, - MftZoneEnd: ::LARGE_INTEGER, -}} -pub type PNTFS_VOLUME_DATA_BUFFER = *mut NTFS_VOLUME_DATA_BUFFER; -STRUCT!{struct NTFS_EXTENDED_VOLUME_DATA { - ByteCount: ::DWORD, - MajorVersion: ::WORD, - MinorVersion: ::WORD, - BytesPerPhysicalSector: ::DWORD, - LfsMajorVersion: ::WORD, - LfsMinorVersion: ::WORD, -}} -pub type PNTFS_EXTENDED_VOLUME_DATA = *mut NTFS_EXTENDED_VOLUME_DATA; -STRUCT!{struct REFS_VOLUME_DATA_BUFFER { - ByteCount: ::DWORD, - MajorVersion: ::DWORD, - MinorVersion: ::DWORD, - BytesPerPhysicalSector: ::DWORD, - VolumeSerialNumber: ::LARGE_INTEGER, - NumberSectors: ::LARGE_INTEGER, - TotalClusters: ::LARGE_INTEGER, - FreeClusters: ::LARGE_INTEGER, - TotalReserved: ::LARGE_INTEGER, - BytesPerSector: ::DWORD, - BytesPerCluster: ::DWORD, - MaximumSizeOfResidentFile: ::LARGE_INTEGER, - Reserved: [::LARGE_INTEGER; 10], -}} -pub type PREFS_VOLUME_DATA_BUFFER = *mut REFS_VOLUME_DATA_BUFFER; -STRUCT!{struct STARTING_LCN_INPUT_BUFFER { - StartingLcn: ::LARGE_INTEGER, -}} -pub type PSTARTING_LCN_INPUT_BUFFER = *mut STARTING_LCN_INPUT_BUFFER; -STRUCT!{struct VOLUME_BITMAP_BUFFER { - StartingLcn: ::LARGE_INTEGER, - BitmapSize: ::LARGE_INTEGER, - Buffer: [::BYTE; 1], -}} -pub type PVOLUME_BITMAP_BUFFER = *mut VOLUME_BITMAP_BUFFER; -STRUCT!{struct STARTING_VCN_INPUT_BUFFER { - StartingVcn: ::LARGE_INTEGER, -}} -pub type PSTARTING_VCN_INPUT_BUFFER = *mut STARTING_VCN_INPUT_BUFFER; -STRUCT!{struct RETRIEVAL_POINTERS_BUFFER_INTERNAL { - NextVcn: ::LARGE_INTEGER, - Lcn: ::LARGE_INTEGER, -}} -STRUCT!{struct RETRIEVAL_POINTERS_BUFFER { - ExtentCount: ::DWORD, - StartingVcn: ::LARGE_INTEGER, - Extents: [RETRIEVAL_POINTERS_BUFFER_INTERNAL; 1], -}} -pub type PRETRIEVAL_POINTERS_BUFFER = *mut RETRIEVAL_POINTERS_BUFFER; -STRUCT!{struct NTFS_FILE_RECORD_INPUT_BUFFER { - FileReferenceNumber: ::LARGE_INTEGER, -}} -pub type PNTFS_FILE_RECORD_INPUT_BUFFER = *mut NTFS_FILE_RECORD_INPUT_BUFFER; -STRUCT!{struct NTFS_FILE_RECORD_OUTPUT_BUFFER { - FileReferenceNumber: ::LARGE_INTEGER, - FileRecordLength: ::DWORD, - FileRecordBuffer: [::BYTE; 1], -}} -pub type PNTFS_FILE_RECORD_OUTPUT_BUFFER = *mut NTFS_FILE_RECORD_OUTPUT_BUFFER; -STRUCT!{struct MOVE_FILE_DATA { - FileHandle: ::HANDLE, - StartingVcn: ::LARGE_INTEGER, - StartingLcn: ::LARGE_INTEGER, - ClusterCount: ::DWORD, -}} -pub type PMOVE_FILE_DATA = *mut MOVE_FILE_DATA; -STRUCT!{struct MOVE_FILE_RECORD_DATA { - FileHandle: ::HANDLE, - SourceFileRecord: ::LARGE_INTEGER, - TargetFileRecord: ::LARGE_INTEGER, -}} -pub type PMOVE_FILE_RECORD_DATA = *mut MOVE_FILE_RECORD_DATA; -//9207 -pub const IOCTL_VOLUME_BASE: ::DWORD = 0x00000056; -pub const IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS: ::DWORD = CTL_CODE!(IOCTL_VOLUME_BASE, 0, - METHOD_BUFFERED, FILE_ANY_ACCESS); -STRUCT!{struct DISK_EXTENT { - DiskNumber: ::DWORD, - StartingOffset: ::LARGE_INTEGER, - ExtentLength: ::LARGE_INTEGER, -}} -pub type PDISK_EXTENT = *mut DISK_EXTENT; -STRUCT!{struct VOLUME_DISK_EXTENTS { - NumberOfDiskExtents: ::DWORD, - Extents: [DISK_EXTENT; ::ANYSIZE_ARRAY], -}} -pub type PVOLUME_DISK_EXTENTS = *mut VOLUME_DISK_EXTENTS; -pub const IOCTL_VOLUME_ONLINE: ::DWORD = CTL_CODE!(IOCTL_VOLUME_BASE, 2, METHOD_BUFFERED, - FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_VOLUME_OFFLINE: ::DWORD = CTL_CODE!(IOCTL_VOLUME_BASE, 3, METHOD_BUFFERED, - FILE_READ_ACCESS | FILE_WRITE_ACCESS); -pub const IOCTL_VOLUME_IS_CLUSTERED: ::DWORD = CTL_CODE!(IOCTL_VOLUME_BASE, 12, METHOD_BUFFERED, - FILE_ANY_ACCESS); -pub const IOCTL_VOLUME_GET_GPT_ATTRIBUTES: ::DWORD = CTL_CODE!(IOCTL_VOLUME_BASE, 14, - METHOD_BUFFERED, FILE_ANY_ACCESS); diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/winnetwk.rs cargo-0.37.0/vendor/winapi-0.2.8/src/winnetwk.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/winnetwk.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/winnetwk.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,275 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Standard WINNET Header File for WIN32 -pub const WNNC_NET_MSNET: ::DWORD = 0x00010000; -pub const WNNC_NET_SMB: ::DWORD = 0x00020000; -pub const WNNC_NET_NETWARE: ::DWORD = 0x00030000; -pub const WNNC_NET_VINES: ::DWORD = 0x00040000; -pub const WNNC_NET_10NET: ::DWORD = 0x00050000; -pub const WNNC_NET_LOCUS: ::DWORD = 0x00060000; -pub const WNNC_NET_SUN_PC_NFS: ::DWORD = 0x00070000; -pub const WNNC_NET_LANSTEP: ::DWORD = 0x00080000; -pub const WNNC_NET_9TILES: ::DWORD = 0x00090000; -pub const WNNC_NET_LANTASTIC: ::DWORD = 0x000A0000; -pub const WNNC_NET_AS400: ::DWORD = 0x000B0000; -pub const WNNC_NET_FTP_NFS: ::DWORD = 0x000C0000; -pub const WNNC_NET_PATHWORKS: ::DWORD = 0x000D0000; -pub const WNNC_NET_LIFENET: ::DWORD = 0x000E0000; -pub const WNNC_NET_POWERLAN: ::DWORD = 0x000F0000; -pub const WNNC_NET_BWNFS: ::DWORD = 0x00100000; -pub const WNNC_NET_COGENT: ::DWORD = 0x00110000; -pub const WNNC_NET_FARALLON: ::DWORD = 0x00120000; -pub const WNNC_NET_APPLETALK: ::DWORD = 0x00130000; -pub const WNNC_NET_INTERGRAPH: ::DWORD = 0x00140000; -pub const WNNC_NET_SYMFONET: ::DWORD = 0x00150000; -pub const WNNC_NET_CLEARCASE: ::DWORD = 0x00160000; -pub const WNNC_NET_FRONTIER: ::DWORD = 0x00170000; -pub const WNNC_NET_BMC: ::DWORD = 0x00180000; -pub const WNNC_NET_DCE: ::DWORD = 0x00190000; -pub const WNNC_NET_AVID: ::DWORD = 0x001A0000; -pub const WNNC_NET_DOCUSPACE: ::DWORD = 0x001B0000; -pub const WNNC_NET_MANGOSOFT: ::DWORD = 0x001C0000; -pub const WNNC_NET_SERNET: ::DWORD = 0x001D0000; -pub const WNNC_NET_RIVERFRONT1: ::DWORD = 0x001E0000; -pub const WNNC_NET_RIVERFRONT2: ::DWORD = 0x001F0000; -pub const WNNC_NET_DECORB: ::DWORD = 0x00200000; -pub const WNNC_NET_PROTSTOR: ::DWORD = 0x00210000; -pub const WNNC_NET_FJ_REDIR: ::DWORD = 0x00220000; -pub const WNNC_NET_DISTINCT: ::DWORD = 0x00230000; -pub const WNNC_NET_TWINS: ::DWORD = 0x00240000; -pub const WNNC_NET_RDR2SAMPLE: ::DWORD = 0x00250000; -pub const WNNC_NET_CSC: ::DWORD = 0x00260000; -pub const WNNC_NET_3IN1: ::DWORD = 0x00270000; -pub const WNNC_NET_EXTENDNET: ::DWORD = 0x00290000; -pub const WNNC_NET_STAC: ::DWORD = 0x002A0000; -pub const WNNC_NET_FOXBAT: ::DWORD = 0x002B0000; -pub const WNNC_NET_YAHOO: ::DWORD = 0x002C0000; -pub const WNNC_NET_EXIFS: ::DWORD = 0x002D0000; -pub const WNNC_NET_DAV: ::DWORD = 0x002E0000; -pub const WNNC_NET_KNOWARE: ::DWORD = 0x002F0000; -pub const WNNC_NET_OBJECT_DIRE: ::DWORD = 0x00300000; -pub const WNNC_NET_MASFAX: ::DWORD = 0x00310000; -pub const WNNC_NET_HOB_NFS: ::DWORD = 0x00320000; -pub const WNNC_NET_SHIVA: ::DWORD = 0x00330000; -pub const WNNC_NET_IBMAL: ::DWORD = 0x00340000; -pub const WNNC_NET_LOCK: ::DWORD = 0x00350000; -pub const WNNC_NET_TERMSRV: ::DWORD = 0x00360000; -pub const WNNC_NET_SRT: ::DWORD = 0x00370000; -pub const WNNC_NET_QUINCY: ::DWORD = 0x00380000; -pub const WNNC_NET_OPENAFS: ::DWORD = 0x00390000; -pub const WNNC_NET_AVID1: ::DWORD = 0x003A0000; -pub const WNNC_NET_DFS: ::DWORD = 0x003B0000; -pub const WNNC_NET_KWNP: ::DWORD = 0x003C0000; -pub const WNNC_NET_ZENWORKS: ::DWORD = 0x003D0000; -pub const WNNC_NET_DRIVEONWEB: ::DWORD = 0x003E0000; -pub const WNNC_NET_VMWARE: ::DWORD = 0x003F0000; -pub const WNNC_NET_RSFX: ::DWORD = 0x00400000; -pub const WNNC_NET_MFILES: ::DWORD = 0x00410000; -pub const WNNC_NET_MS_NFS: ::DWORD = 0x00420000; -pub const WNNC_NET_GOOGLE: ::DWORD = 0x00430000; -pub const WNNC_NET_NDFS: ::DWORD = 0x00440000; -pub const WNNC_NET_DOCUSHARE: ::DWORD = 0x00450000; -pub const WNNC_CRED_MANAGER: ::DWORD = 0xFFFF0000; -pub const WNNC_NET_LANMAN: ::DWORD = WNNC_NET_SMB; -pub const RESOURCE_CONNECTED: ::DWORD = 0x00000001; -pub const RESOURCE_GLOBALNET: ::DWORD = 0x00000002; -pub const RESOURCE_REMEMBERED: ::DWORD = 0x00000003; -pub const RESOURCE_RECENT: ::DWORD = 0x00000004; -pub const RESOURCE_CONTEXT: ::DWORD = 0x00000005; -pub const RESOURCETYPE_ANY: ::DWORD = 0x00000000; -pub const RESOURCETYPE_DISK: ::DWORD = 0x00000001; -pub const RESOURCETYPE_PRINT: ::DWORD = 0x00000002; -pub const RESOURCETYPE_RESERVED: ::DWORD = 0x00000008; -pub const RESOURCETYPE_UNKNOWN: ::DWORD = 0xFFFFFFFF; -pub const RESOURCEUSAGE_CONNECTABLE: ::DWORD = 0x00000001; -pub const RESOURCEUSAGE_CONTAINER: ::DWORD = 0x00000002; -pub const RESOURCEUSAGE_NOLOCALDEVICE: ::DWORD = 0x00000004; -pub const RESOURCEUSAGE_SIBLING: ::DWORD = 0x00000008; -pub const RESOURCEUSAGE_ATTACHED: ::DWORD = 0x00000010; -pub const RESOURCEUSAGE_ALL: ::DWORD = RESOURCEUSAGE_CONNECTABLE | RESOURCEUSAGE_CONTAINER - | RESOURCEUSAGE_ATTACHED; -pub const RESOURCEUSAGE_RESERVED: ::DWORD = 0x80000000; -pub const RESOURCEDISPLAYTYPE_GENERIC: ::DWORD = 0x00000000; -pub const RESOURCEDISPLAYTYPE_DOMAIN: ::DWORD = 0x00000001; -pub const RESOURCEDISPLAYTYPE_SERVER: ::DWORD = 0x00000002; -pub const RESOURCEDISPLAYTYPE_SHARE: ::DWORD = 0x00000003; -pub const RESOURCEDISPLAYTYPE_FILE: ::DWORD = 0x00000004; -pub const RESOURCEDISPLAYTYPE_GROUP: ::DWORD = 0x00000005; -pub const RESOURCEDISPLAYTYPE_NETWORK: ::DWORD = 0x00000006; -pub const RESOURCEDISPLAYTYPE_ROOT: ::DWORD = 0x00000007; -pub const RESOURCEDISPLAYTYPE_SHAREADMIN: ::DWORD = 0x00000008; -pub const RESOURCEDISPLAYTYPE_DIRECTORY: ::DWORD = 0x00000009; -pub const RESOURCEDISPLAYTYPE_TREE: ::DWORD = 0x0000000A; -pub const RESOURCEDISPLAYTYPE_NDSCONTAINER: ::DWORD = 0x0000000B; -STRUCT!{struct NETRESOURCEA { - dwScope: ::DWORD, - dwType: ::DWORD, - dwDisplayType: ::DWORD, - dwUsage: ::DWORD, - lpLocalName: ::LPSTR, - lpRemoteName: ::LPSTR, - lpComment: ::LPSTR, - lpProvider: ::LPSTR, -}} -pub type LPNETRESOURCEA = *mut NETRESOURCEA; -STRUCT!{struct NETRESOURCEW { - dwScope: ::DWORD, - dwType: ::DWORD, - dwDisplayType: ::DWORD, - dwUsage: ::DWORD, - lpLocalName: ::LPWSTR, - lpRemoteName: ::LPWSTR, - lpComment: ::LPWSTR, - lpProvider: ::LPWSTR, -}} -pub type LPNETRESOURCEW = *mut NETRESOURCEW; -pub const NETPROPERTY_PERSISTENT: ::DWORD = 1; -pub const CONNECT_UPDATE_PROFILE: ::DWORD = 0x00000001; -pub const CONNECT_UPDATE_RECENT: ::DWORD = 0x00000002; -pub const CONNECT_TEMPORARY: ::DWORD = 0x00000004; -pub const CONNECT_INTERACTIVE: ::DWORD = 0x00000008; -pub const CONNECT_PROMPT: ::DWORD = 0x00000010; -pub const CONNECT_NEED_DRIVE: ::DWORD = 0x00000020; -pub const CONNECT_REFCOUNT: ::DWORD = 0x00000040; -pub const CONNECT_REDIRECT: ::DWORD = 0x00000080; -pub const CONNECT_LOCALDRIVE: ::DWORD = 0x00000100; -pub const CONNECT_CURRENT_MEDIA: ::DWORD = 0x00000200; -pub const CONNECT_DEFERRED: ::DWORD = 0x00000400; -pub const CONNECT_RESERVED: ::DWORD = 0xFF000000; -pub const CONNECT_COMMANDLINE: ::DWORD = 0x00000800; -pub const CONNECT_CMD_SAVECRED: ::DWORD = 0x00001000; -pub const CONNECT_CRED_RESET: ::DWORD = 0x00002000; -STRUCT!{struct CONNECTDLGSTRUCTA { - cbStructure: ::DWORD, - hwndOwner: ::HWND, - lpConnRes: ::LPNETRESOURCEA, - dwFlags: ::DWORD, - dwDevNum: ::DWORD, -}} -pub type LPCONNECTDLGSTRUCTA = *mut CONNECTDLGSTRUCTA; -STRUCT!{struct CONNECTDLGSTRUCTW { - cbStructure: ::DWORD, - hwndOwner: ::HWND, - lpConnRes: ::LPNETRESOURCEW, - dwFlags: ::DWORD, - dwDevNum: ::DWORD, -}} -pub type LPCONNECTDLGSTRUCTW = *mut CONNECTDLGSTRUCTW; -pub const CONNDLG_RO_PATH: ::DWORD = 0x00000001; -pub const CONNDLG_CONN_POINT: ::DWORD = 0x00000002; -pub const CONNDLG_USE_MRU: ::DWORD = 0x00000004; -pub const CONNDLG_HIDE_BOX: ::DWORD = 0x00000008; -pub const CONNDLG_PERSIST: ::DWORD = 0x00000010; -pub const CONNDLG_NOT_PERSIST: ::DWORD = 0x00000020; -STRUCT!{struct DISCDLGSTRUCTA { - cbStructure: ::DWORD, - hwndOwner: ::HWND, - lpLocalName: ::LPSTR, - lpRemoteName: ::LPSTR, - dwFlags: ::DWORD, -}} -pub type LPDISCDLGSTRUCTA = *mut DISCDLGSTRUCTA; -STRUCT!{struct DISCDLGSTRUCTW { - cbStructure: ::DWORD, - hwndOwner: ::HWND, - lpLocalName: ::LPWSTR, - lpRemoteName: ::LPWSTR, - dwFlags: ::DWORD, -}} -pub type LPDISCDLGSTRUCTW = *mut DISCDLGSTRUCTW; -pub const DISC_UPDATE_PROFILE: ::DWORD = 0x00000001; -pub const DISC_NO_FORCE: ::DWORD = 0x00000040; -pub const UNIVERSAL_NAME_INFO_LEVEL: ::DWORD = 0x00000001; -pub const REMOTE_NAME_INFO_LEVEL: ::DWORD = 0x00000002; -STRUCT!{struct UNIVERSAL_NAME_INFOA { - lpUniversalName: ::LPSTR, -}} -pub type LPUNIVERSAL_NAME_INFOA = *mut UNIVERSAL_NAME_INFOA; -STRUCT!{struct UNIVERSAL_NAME_INFOW { - lpUniversalName: ::LPWSTR, -}} -pub type LPUNIVERSAL_NAME_INFOW = *mut UNIVERSAL_NAME_INFOW; -STRUCT!{struct REMOTE_NAME_INFOA { - lpUniversalName: ::LPSTR, - lpConnectionName: ::LPSTR, - lpRemainingPath: ::LPSTR, -}} -pub type LPREMOTE_NAME_INFOA = *mut REMOTE_NAME_INFOA; -STRUCT!{struct REMOTE_NAME_INFOW { - lpUniversalName: ::LPWSTR, - lpConnectionName: ::LPWSTR, - lpRemainingPath: ::LPWSTR, -}} -pub type LPREMOTE_NAME_INFOW = *mut REMOTE_NAME_INFOW; -pub const WNFMT_MULTILINE: ::DWORD = 0x01; -pub const WNFMT_ABBREVIATED: ::DWORD = 0x02; -pub const WNFMT_INENUM: ::DWORD = 0x10; -pub const WNFMT_CONNECTION: ::DWORD = 0x20; -STRUCT!{struct NETINFOSTRUCT { - cbStructure: ::DWORD, - dwProviderVersion: ::DWORD, - dwStatus: ::DWORD, - dwCharacteristics: ::DWORD, - dwHandle: ::ULONG_PTR, - wNetType: ::WORD, - dwPrinters: ::DWORD, - dwDrives: ::DWORD, -}} -pub type LPNETINFOSTRUCT = *mut NETINFOSTRUCT; -pub const NETINFO_DLL16: ::DWORD = 0x00000001; -pub const NETINFO_DISKRED: ::DWORD = 0x00000004; -pub const NETINFO_PRINTERRED: ::DWORD = 0x00000008; -pub const WN_SUCCESS: ::DWORD = ::NO_ERROR; -pub const WN_NO_ERROR: ::DWORD = ::NO_ERROR; -pub const WN_NOT_SUPPORTED: ::DWORD = ::ERROR_NOT_SUPPORTED; -pub const WN_CANCEL: ::DWORD = ::ERROR_CANCELLED; -pub const WN_RETRY: ::DWORD = ::ERROR_RETRY; -pub const WN_NET_ERROR: ::DWORD = ::ERROR_UNEXP_NET_ERR; -pub const WN_MORE_DATA: ::DWORD = ::ERROR_MORE_DATA; -pub const WN_BAD_POINTER: ::DWORD = ::ERROR_INVALID_ADDRESS; -pub const WN_BAD_VALUE: ::DWORD = ::ERROR_INVALID_PARAMETER; -pub const WN_BAD_USER: ::DWORD = ::ERROR_BAD_USERNAME; -pub const WN_BAD_PASSWORD: ::DWORD = ::ERROR_INVALID_PASSWORD; -pub const WN_ACCESS_DENIED: ::DWORD = ::ERROR_ACCESS_DENIED; -pub const WN_FUNCTION_BUSY: ::DWORD = ::ERROR_BUSY; -pub const WN_WINDOWS_ERROR: ::DWORD = ::ERROR_UNEXP_NET_ERR; -pub const WN_OUT_OF_MEMORY: ::DWORD = ::ERROR_NOT_ENOUGH_MEMORY; -pub const WN_NO_NETWORK: ::DWORD = ::ERROR_NO_NETWORK; -pub const WN_EXTENDED_ERROR: ::DWORD = ::ERROR_EXTENDED_ERROR; -pub const WN_BAD_LEVEL: ::DWORD = ::ERROR_INVALID_LEVEL; -pub const WN_BAD_HANDLE: ::DWORD = ::ERROR_INVALID_HANDLE; -pub const WN_NOT_INITIALIZING: ::DWORD = ::ERROR_ALREADY_INITIALIZED; -pub const WN_NO_MORE_DEVICES: ::DWORD = ::ERROR_NO_MORE_DEVICES; -pub const WN_NOT_CONNECTED: ::DWORD = ::ERROR_NOT_CONNECTED; -pub const WN_OPEN_FILES: ::DWORD = ::ERROR_OPEN_FILES; -pub const WN_DEVICE_IN_USE: ::DWORD = ::ERROR_DEVICE_IN_USE; -pub const WN_BAD_NETNAME: ::DWORD = ::ERROR_BAD_NET_NAME; -pub const WN_BAD_LOCALNAME: ::DWORD = ::ERROR_BAD_DEVICE; -pub const WN_ALREADY_CONNECTED: ::DWORD = ::ERROR_ALREADY_ASSIGNED; -pub const WN_DEVICE_ERROR: ::DWORD = ::ERROR_GEN_FAILURE; -pub const WN_CONNECTION_CLOSED: ::DWORD = ::ERROR_CONNECTION_UNAVAIL; -pub const WN_NO_NET_OR_BAD_PATH: ::DWORD = ::ERROR_NO_NET_OR_BAD_PATH; -pub const WN_BAD_PROVIDER: ::DWORD = ::ERROR_BAD_PROVIDER; -pub const WN_CANNOT_OPEN_PROFILE: ::DWORD = ::ERROR_CANNOT_OPEN_PROFILE; -pub const WN_BAD_PROFILE: ::DWORD = ::ERROR_BAD_PROFILE; -pub const WN_BAD_DEV_TYPE: ::DWORD = ::ERROR_BAD_DEV_TYPE; -pub const WN_DEVICE_ALREADY_REMEMBERED: ::DWORD = ::ERROR_DEVICE_ALREADY_REMEMBERED; -pub const WN_CONNECTED_OTHER_PASSWORD: ::DWORD = ::ERROR_CONNECTED_OTHER_PASSWORD; -pub const WN_CONNECTED_OTHER_PASSWORD_DEFAULT: ::DWORD = ::ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT; -pub const WN_NO_MORE_ENTRIES: ::DWORD = ::ERROR_NO_MORE_ITEMS; -pub const WN_NOT_CONTAINER: ::DWORD = ::ERROR_NOT_CONTAINER; -pub const WN_NOT_AUTHENTICATED: ::DWORD = ::ERROR_NOT_AUTHENTICATED; -pub const WN_NOT_LOGGED_ON: ::DWORD = ::ERROR_NOT_LOGGED_ON; -pub const WN_NOT_VALIDATED: ::DWORD = ::ERROR_NO_LOGON_SERVERS; -STRUCT!{struct NETCONNECTINFOSTRUCT { - cbStructure: ::DWORD, - dwFlags: ::DWORD, - dwSpeed: ::DWORD, - dwDelay: ::DWORD, - dwOptDataSize: ::DWORD, -}} -pub type LPNETCONNECTINFOSTRUCT = *mut NETCONNECTINFOSTRUCT; -pub const WNCON_FORNETCARD: ::DWORD = 0x00000001; -pub const WNCON_NOTROUTED: ::DWORD = 0x00000002; -pub const WNCON_SLOWLINK: ::DWORD = 0x00000004; -pub const WNCON_DYNAMIC: ::DWORD = 0x00000008; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/winnls.rs cargo-0.37.0/vendor/winapi-0.2.8/src/winnls.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/winnls.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/winnls.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,164 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Procedure declarations, constant definitions, and macros for the NLS component. -pub const CP_ACP: ::DWORD = 0; -pub const CP_OEMCP: ::DWORD = 1; -pub const CP_MACCP: ::DWORD = 2; -pub const CP_THREAD_ACP: ::DWORD = 3; -pub const CP_SYMBOL: ::DWORD = 42; -pub const CP_UTF7: ::DWORD = 65000; -pub const CP_UTF8: ::DWORD = 65001; -pub const MAX_LEADBYTES: usize = 12; -pub const MAX_DEFAULTCHAR: usize = 2; -pub type LGRPID = ::DWORD; -pub type LCTYPE = ::DWORD; -pub type CALTYPE = ::DWORD; -pub type CALID = ::DWORD; -pub type GEOID = ::LONG; -pub type GEOTYPE = ::DWORD; -pub type GEOCLASS = ::DWORD; -STRUCT!{struct NLSVERSIONINFO { - dwNLSVersionInfoSize: ::DWORD, - dwNLSVersion: ::DWORD, - dwDefinedVersion: ::DWORD, - dwEffectiveId: ::DWORD, - guidCustomVersion: ::GUID, -}} -pub type LPNLSVERSIONINFO = *mut NLSVERSIONINFO; -STRUCT!{struct NLSVERSIONINFOEX { - dwNLSVersionInfoSize: ::DWORD, - dwNLSVersion: ::DWORD, - dwDefinedVersion: ::DWORD, - dwEffectiveId: ::DWORD, - guidCustomVersion: ::GUID, -}} -pub type LPNLSVERSIONINFOEX = *mut NLSVERSIONINFOEX; -ENUM!{enum NORM_FORM { - NormalizationOther = 0, - NormalizationC = 0x1, - NormalizationD = 0x2, - NormalizationKC = 0x5, - NormalizationKD = 0x6, -}} -pub type LANGUAGEGROUP_ENUMPROCA = Option ::BOOL>; -pub type LANGGROUPLOCALE_ENUMPROCA = Option ::BOOL>; -pub type UILANGUAGE_ENUMPROCA = Option ::BOOL>; -pub type CODEPAGE_ENUMPROCA = Option ::BOOL>; -pub type DATEFMT_ENUMPROCA = Option ::BOOL>; -pub type DATEFMT_ENUMPROCEXA = Option ::BOOL>; -pub type TIMEFMT_ENUMPROCA = Option ::BOOL>; -pub type CALINFO_ENUMPROCA = Option ::BOOL>; -pub type CALINFO_ENUMPROCEXA = Option ::BOOL>; -pub type LOCALE_ENUMPROCA = Option ::BOOL>; -pub type LOCALE_ENUMPROCW = Option ::BOOL>; -pub type LANGUAGEGROUP_ENUMPROCW = Option ::BOOL>; -pub type LANGGROUPLOCALE_ENUMPROCW = Option ::BOOL>; -pub type UILANGUAGE_ENUMPROCW = Option ::BOOL>; -pub type CODEPAGE_ENUMPROCW = Option ::BOOL>; -pub type DATEFMT_ENUMPROCW = Option ::BOOL>; -pub type DATEFMT_ENUMPROCEXW = Option ::BOOL>; -pub type TIMEFMT_ENUMPROCW = Option ::BOOL>; -pub type CALINFO_ENUMPROCW = Option ::BOOL>; -pub type CALINFO_ENUMPROCEXW = Option ::BOOL>; -pub type GEO_ENUMPROC = Option ::BOOL>; -STRUCT!{struct CPINFO { - MaxCharSize: ::UINT, - DefaultChar: [::BYTE; MAX_DEFAULTCHAR], - LeadByte: [::BYTE; MAX_LEADBYTES], -}} -pub type LPCPINFO = *mut CPINFO; -STRUCT!{nodebug struct CPINFOEXA { - MaxCharSize: ::UINT, - DefaultChar: [::BYTE; MAX_DEFAULTCHAR], - LeadByte: [::BYTE; MAX_LEADBYTES], - UnicodeDefaultChar: ::WCHAR, - CodePage: ::UINT, - CodePageName: [::CHAR; ::MAX_PATH], -}} -pub type LPCPINFOEXA = *mut CPINFOEXA; -STRUCT!{nodebug struct CPINFOEXW { - MaxCharSize: ::UINT, - DefaultChar: [::BYTE; MAX_DEFAULTCHAR], - LeadByte: [::BYTE; MAX_LEADBYTES], - UnicodeDefaultChar: ::WCHAR, - CodePage: ::UINT, - CodePageName: [::WCHAR; ::MAX_PATH], -}} -pub type LPCPINFOEXW = *mut CPINFOEXW; -STRUCT!{struct NUMBERFMTA { - NumDigits: ::UINT, - LeadingZero: ::UINT, - Grouping: ::UINT, - lpDecimalSep: ::LPSTR, - lpThousandSep: ::LPSTR, - NegativeOrder: ::UINT, -}} -pub type LPNUMBERFMTA = *mut NUMBERFMTA; -STRUCT!{struct NUMBERFMTW { - NumDigits: ::UINT, - LeadingZero: ::UINT, - Grouping: ::UINT, - lpDecimalSep: ::LPWSTR, - lpThousandSep: ::LPWSTR, - NegativeOrder: ::UINT, -}} -pub type LPNUMBERFMTW = *mut NUMBERFMTW; -STRUCT!{struct CURRENCYFMTA { - NumDigits: ::UINT, - LeadingZero: ::UINT, - Grouping: ::UINT, - lpDecimalSep: ::LPSTR, - lpThousandSep: ::LPSTR, - NegativeOrder: ::UINT, - PositiveOrder: ::UINT, - lpCurrencySymbol: ::LPSTR, -}} -pub type LPCURRENCYFMTA = *mut CURRENCYFMTA; -STRUCT!{struct CURRENCYFMTW { - NumDigits: ::UINT, - LeadingZero: ::UINT, - Grouping: ::UINT, - lpDecimalSep: ::LPWSTR, - lpThousandSep: ::LPWSTR, - NegativeOrder: ::UINT, - PositiveOrder: ::UINT, - lpCurrencySymbol: ::LPWSTR, -}} -pub type LPCURRENCYFMTW = *mut CURRENCYFMTW; -pub type NLS_FUNCTION = ::DWORD; -STRUCT!{struct FILEMUIINFO { - dwSize: ::DWORD, - dwVersion: ::DWORD, - dwFileType: ::DWORD, - pChecksum: [::BYTE; 16], - pServiceChecksum: [::BYTE; 16], - dwLanguageNameOffset: ::DWORD, - dwTypeIDMainSize: ::DWORD, - dwTypeIDMainOffset: ::DWORD, - dwTypeNameMainOffset: ::DWORD, - dwTypeIDMUISize: ::DWORD, - dwTypeIDMUIOffset: ::DWORD, - dwTypeNameMUIOffset: ::DWORD, - abBuffer: [::BYTE; 8], -}} -pub type PFILEMUIINFO = *mut FILEMUIINFO; -pub type CALINFO_ENUMPROCEXEX = Option ::BOOL>; -pub type DATEFMT_ENUMPROCEXEX = Option ::BOOL>; -pub type TIMEFMT_ENUMPROCEX = Option ::BOOL>; -pub type LOCALE_ENUMPROCEX = Option ::BOOL>; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/winnt.rs cargo-0.37.0/vendor/winapi-0.2.8/src/winnt.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/winnt.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/winnt.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,2368 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! This module defines the 32-Bit Windows types and constants that are defined by NT, but exposed -//! through the Win32 API. -pub const ANYSIZE_ARRAY: usize = 1; -//341 -pub type PVOID = *mut ::c_void; -pub type PVOID64 = u64; // This is a 64-bit pointer, even when in 32-bit -//382 -pub type VOID = ::c_void; -pub type CHAR = ::c_char; -pub type SHORT = ::c_short; -pub type LONG = ::c_long; -// pub type INT = ::c_int; // Already defined by minwindef.h -pub type WCHAR = ::wchar_t; -pub type PWCHAR = *mut WCHAR; -pub type LPWCH = *mut WCHAR; -pub type PWCH = *mut WCHAR; -pub type LPCWCH = *const WCHAR; -pub type PCWCH = *const WCHAR; -pub type NWPSTR = *mut WCHAR; -pub type LPWSTR = *mut WCHAR; -pub type PWSTR = *mut WCHAR; -pub type PZPWSTR = *mut PWSTR; -pub type PCZPWSTR = *const PWSTR; -pub type LPUWSTR = *mut WCHAR; -pub type PUWSTR = *mut WCHAR; -pub type LPCWSTR = *const WCHAR; -pub type PCWSTR = *const WCHAR; -pub type PZPCWSTR= *mut PCWSTR; -pub type PCZPCWSTR = *const PCWSTR; -pub type LPCUWSTR = *const WCHAR; -pub type PCUWSTR = *const WCHAR; -pub type PZZWSTR= *mut WCHAR; -pub type PCZZWSTR = *const WCHAR; -pub type PUZZWSTR = *mut WCHAR; -pub type PCUZZWSTR = *const WCHAR; -pub type PNZWCH = *mut WCHAR; -pub type PCNZWCH = *const WCHAR; -pub type PUNZWCH = *mut WCHAR; -pub type PCUNZWCH = *const WCHAR; -pub type LPCWCHAR = *const WCHAR; -pub type PCWCHAR = *const WCHAR; -pub type LPCUWCHAR = *const WCHAR; -pub type PCUWCHAR = *const WCHAR; -pub type UCSCHAR = ::c_ulong; -pub type PUCSCHAR = *mut UCSCHAR; -pub type PCUCSCHAR = *const UCSCHAR; -pub type PUCSSTR = *mut UCSCHAR; -pub type PUUCSSTR = *mut UCSCHAR; -pub type PCUCSSTR = *const UCSCHAR; -pub type PCUUCSSTR = *const UCSCHAR; -pub type PUUCSCHAR = *mut UCSCHAR; -pub type PCUUCSCHAR = *const UCSCHAR; -pub type PCHAR = *mut CHAR; -pub type LPCH = *mut CHAR; -pub type PCH = *mut CHAR; -pub type LPCCH = *const CHAR; -pub type PCCH = *const CHAR; -pub type NPSTR = *mut CHAR; -pub type LPSTR = *mut CHAR; -pub type PSTR = *mut CHAR; -pub type PZPSTR = *mut PSTR; -pub type PCZPSTR = *const PSTR; -pub type LPCSTR = *const CHAR; -pub type PCSTR = *const CHAR; -pub type PZPCSTR = *mut PCSTR; -pub type PCZPCSTR = *const PCSTR; -pub type PZZSTR = *mut CHAR; -pub type PCZZSTR = *const CHAR; -pub type PNZCH = *mut CHAR; -pub type PCNZCH = *const CHAR; -// Skipping TCHAR things -pub type PSHORT = *mut SHORT; -pub type PLONG = *mut LONG; -STRUCT!{struct PROCESSOR_NUMBER { - Group: ::WORD, - Number: ::BYTE, - Reserved: ::BYTE, -}} -pub type PPROCESSOR_NUMBER = *mut PROCESSOR_NUMBER; -STRUCT!{struct GROUP_AFFINITY { - Mask: ::KAFFINITY, - Group: ::WORD, - Reserved: [::WORD; 3], -}} -pub type PGROUP_AFFINITY = *mut GROUP_AFFINITY; -pub type HANDLE = *mut ::c_void; -pub type PHANDLE = *mut HANDLE; -pub type FCHAR = ::BYTE; -pub type FSHORT = ::WORD; -pub type FLONG = ::DWORD; -//667 -pub type CCHAR = ::c_char; -pub type LCID = ::DWORD; -pub type PLCID = ::PDWORD; -pub type LANGID = ::WORD; -ENUM!{enum COMPARTMENT_ID { - UNSPECIFIED_COMPARTMENT_ID = 0, - DEFAULT_COMPARTMENT_ID = 1, -}} -pub type PCOMPARTMENT_ID = *mut COMPARTMENT_ID; -pub const APPLICATION_ERROR_MASK: ::DWORD = 0x20000000; -pub const ERROR_SEVERITY_SUCCESS: ::DWORD = 0x00000000; -pub const ERROR_SEVERITY_INFORMATIONAL: ::DWORD = 0x40000000; -pub const ERROR_SEVERITY_WARNING: ::DWORD = 0x80000000; -pub const ERROR_SEVERITY_ERROR: ::DWORD = 0xC0000000; -//710 -STRUCT!{struct FLOAT128 { - LowPart: ::__int64, - HighPart: ::__int64, -}} -pub type PFLOAT128 = *mut FLOAT128; -pub type LONGLONG = ::__int64; -pub type ULONGLONG = ::__uint64; -pub type PLONGLONG = *mut LONGLONG; -pub type PULONGLONG = *mut ULONGLONG; -pub type USN = LONGLONG; -pub type LARGE_INTEGER = LONGLONG; -pub type PLARGE_INTEGER = *mut LARGE_INTEGER; -pub type ULARGE_INTEGER = ULONGLONG; -pub type PULARGE_INTEGER= *mut ULARGE_INTEGER; -pub type RTL_REFERENCE_COUNT = ::LONG_PTR; -pub type PRTL_REFERENCE_COUNT = *mut ::LONG_PTR; -STRUCT!{struct LUID { - LowPart: ::DWORD, - HighPart: LONG, -}} -pub type PLUID = *mut LUID; -pub type DWORDLONG = ULONGLONG; -pub type PDWORDLONG = *mut DWORDLONG; -//1042 -pub type BOOLEAN = ::BYTE; -pub type PBOOLEAN = *mut BOOLEAN; -STRUCT!{struct LIST_ENTRY { - Flink: *mut LIST_ENTRY, - Blink: *mut LIST_ENTRY, -}} -pub type PLIST_ENTRY = *mut LIST_ENTRY; -STRUCT!{struct SINGLE_LIST_ENTRY { - Next: *mut SINGLE_LIST_ENTRY, -}} -pub type PSINGLE_LIST_ENTRY = *mut SINGLE_LIST_ENTRY; -STRUCT!{struct LIST_ENTRY32 { - Flink: ::DWORD, - Blink: ::DWORD, -}} -pub type PLIST_ENTRY32 = *mut LIST_ENTRY32; -STRUCT!{struct LIST_ENTRY64 { - Flink: ULONGLONG, - Blink: ULONGLONG, -}} -pub type PLIST_ENTRY64 = *mut LIST_ENTRY64; -STRUCT!{struct OBJECTID { - Lineage: ::GUID, - Uniquifier: ::DWORD, -}} -pub const MINCHAR: ::CHAR = 0x80u8 as ::CHAR; -pub const MAXCHAR: ::CHAR = 0x7f; -pub const MINSHORT: ::SHORT = 0x8000u16 as ::SHORT; -pub const MAXSHORT: ::SHORT = 0x7fff; -pub const MINLONG: ::LONG = 0x80000000u32 as ::LONG; -pub const MAXLONG: ::LONG = 0x7fffffff; -pub const MAXBYTE: ::BYTE = 0xff; -pub const MAXWORD: ::WORD = 0xffff; -pub const MAXDWORD: ::DWORD = 0xffffffff; -//1300 -pub type PEXCEPTION_ROUTINE = Option ::EXCEPTION_DISPOSITION>; -//1498 -pub const LANG_NEUTRAL: ::WORD = 0x00; -pub const LANG_INVARIANT: ::WORD = 0x7f; -pub const LANG_AFRIKAANS: ::WORD = 0x36; -pub const LANG_ALBANIAN: ::WORD = 0x1c; -pub const LANG_ALSATIAN: ::WORD = 0x84; -pub const LANG_AMHARIC: ::WORD = 0x5e; -pub const LANG_ARABIC: ::WORD = 0x01; -pub const LANG_ARMENIAN: ::WORD = 0x2b; -pub const LANG_ASSAMESE: ::WORD = 0x4d; -pub const LANG_AZERI: ::WORD = 0x2c; -pub const LANG_AZERBAIJANI: ::WORD = 0x2c; -pub const LANG_BANGLA: ::WORD = 0x45; -pub const LANG_BASHKIR: ::WORD = 0x6d; -pub const LANG_BASQUE: ::WORD = 0x2d; -pub const LANG_BELARUSIAN: ::WORD = 0x23; -pub const LANG_BENGALI: ::WORD = 0x45; -pub const LANG_BRETON: ::WORD = 0x7e; -pub const LANG_BOSNIAN: ::WORD = 0x1a; -pub const LANG_BOSNIAN_NEUTRAL: ::WORD = 0x781a; -pub const LANG_BULGARIAN: ::WORD = 0x02; -pub const LANG_CATALAN: ::WORD = 0x03; -pub const LANG_CENTRAL_KURDISH: ::WORD = 0x92; -pub const LANG_CHEROKEE: ::WORD = 0x5c; -pub const LANG_CHINESE: ::WORD = 0x04; -pub const LANG_CHINESE_SIMPLIFIED: ::WORD = 0x04; -pub const LANG_CHINESE_TRADITIONAL: ::WORD = 0x7c04; -pub const LANG_CORSICAN: ::WORD = 0x83; -pub const LANG_CROATIAN: ::WORD = 0x1a; -pub const LANG_CZECH: ::WORD = 0x05; -pub const LANG_DANISH: ::WORD = 0x06; -pub const LANG_DARI: ::WORD = 0x8c; -pub const LANG_DIVEHI: ::WORD = 0x65; -pub const LANG_DUTCH: ::WORD = 0x13; -pub const LANG_ENGLISH: ::WORD = 0x09; -pub const LANG_ESTONIAN: ::WORD = 0x25; -pub const LANG_FAEROESE: ::WORD = 0x38; -pub const LANG_FARSI: ::WORD = 0x29; -pub const LANG_FILIPINO: ::WORD = 0x64; -pub const LANG_FINNISH: ::WORD = 0x0b; -pub const LANG_FRENCH: ::WORD = 0x0c; -pub const LANG_FRISIAN: ::WORD = 0x62; -pub const LANG_FULAH: ::WORD = 0x67; -pub const LANG_GALICIAN: ::WORD = 0x56; -pub const LANG_GEORGIAN: ::WORD = 0x37; -pub const LANG_GERMAN: ::WORD = 0x07; -pub const LANG_GREEK: ::WORD = 0x08; -pub const LANG_GREENLANDIC: ::WORD = 0x6f; -pub const LANG_GUJARATI: ::WORD = 0x47; -pub const LANG_HAUSA: ::WORD = 0x68; -pub const LANG_HAWAIIAN: ::WORD = 0x75; -pub const LANG_HEBREW: ::WORD = 0x0d; -pub const LANG_HINDI: ::WORD = 0x39; -pub const LANG_HUNGARIAN: ::WORD = 0x0e; -pub const LANG_ICELANDIC: ::WORD = 0x0f; -pub const LANG_IGBO: ::WORD = 0x70; -pub const LANG_INDONESIAN: ::WORD = 0x21; -pub const LANG_INUKTITUT: ::WORD = 0x5d; -pub const LANG_IRISH: ::WORD = 0x3c; -pub const LANG_ITALIAN: ::WORD = 0x10; -pub const LANG_JAPANESE: ::WORD = 0x11; -pub const LANG_KANNADA: ::WORD = 0x4b; -pub const LANG_KASHMIRI: ::WORD = 0x60; -pub const LANG_KAZAK: ::WORD = 0x3f; -pub const LANG_KHMER: ::WORD = 0x53; -pub const LANG_KICHE: ::WORD = 0x86; -pub const LANG_KINYARWANDA: ::WORD = 0x87; -pub const LANG_KONKANI: ::WORD = 0x57; -pub const LANG_KOREAN: ::WORD = 0x12; -pub const LANG_KYRGYZ: ::WORD = 0x40; -pub const LANG_LAO: ::WORD = 0x54; -pub const LANG_LATVIAN: ::WORD = 0x26; -pub const LANG_LITHUANIAN: ::WORD = 0x27; -pub const LANG_LOWER_SORBIAN: ::WORD = 0x2e; -pub const LANG_LUXEMBOURGISH: ::WORD = 0x6e; -pub const LANG_MACEDONIAN: ::WORD = 0x2f; -pub const LANG_MALAY: ::WORD = 0x3e; -pub const LANG_MALAYALAM: ::WORD = 0x4c; -pub const LANG_MALTESE: ::WORD = 0x3a; -pub const LANG_MANIPURI: ::WORD = 0x58; -pub const LANG_MAORI: ::WORD = 0x81; -pub const LANG_MAPUDUNGUN: ::WORD = 0x7a; -pub const LANG_MARATHI: ::WORD = 0x4e; -pub const LANG_MOHAWK: ::WORD = 0x7c; -pub const LANG_MONGOLIAN: ::WORD = 0x50; -pub const LANG_NEPALI: ::WORD = 0x61; -pub const LANG_NORWEGIAN: ::WORD = 0x14; -pub const LANG_OCCITAN: ::WORD = 0x82; -pub const LANG_ODIA: ::WORD = 0x48; -pub const LANG_ORIYA: ::WORD = 0x48; -pub const LANG_PASHTO: ::WORD = 0x63; -pub const LANG_PERSIAN: ::WORD = 0x29; -pub const LANG_POLISH: ::WORD = 0x15; -pub const LANG_PORTUGUESE: ::WORD = 0x16; -pub const LANG_PULAR: ::WORD = 0x67; -pub const LANG_PUNJABI: ::WORD = 0x46; -pub const LANG_QUECHUA: ::WORD = 0x6b; -pub const LANG_ROMANIAN: ::WORD = 0x18; -pub const LANG_ROMANSH: ::WORD = 0x17; -pub const LANG_RUSSIAN: ::WORD = 0x19; -pub const LANG_SAKHA: ::WORD = 0x85; -pub const LANG_SAMI: ::WORD = 0x3b; -pub const LANG_SANSKRIT: ::WORD = 0x4f; -pub const LANG_SCOTTISH_GAELIC: ::WORD = 0x91; -pub const LANG_SERBIAN: ::WORD = 0x1a; -pub const LANG_SERBIAN_NEUTRAL: ::WORD = 0x7c1a; -pub const LANG_SINDHI: ::WORD = 0x59; -pub const LANG_SINHALESE: ::WORD = 0x5b; -pub const LANG_SLOVAK: ::WORD = 0x1b; -pub const LANG_SLOVENIAN: ::WORD = 0x24; -pub const LANG_SOTHO: ::WORD = 0x6c; -pub const LANG_SPANISH: ::WORD = 0x0a; -pub const LANG_SWAHILI: ::WORD = 0x41; -pub const LANG_SWEDISH: ::WORD = 0x1d; -pub const LANG_SYRIAC: ::WORD = 0x5a; -pub const LANG_TAJIK: ::WORD = 0x28; -pub const LANG_TAMAZIGHT: ::WORD = 0x5f; -pub const LANG_TAMIL: ::WORD = 0x49; -pub const LANG_TATAR: ::WORD = 0x44; -pub const LANG_TELUGU: ::WORD = 0x4a; -pub const LANG_THAI: ::WORD = 0x1e; -pub const LANG_TIBETAN: ::WORD = 0x51; -pub const LANG_TIGRIGNA: ::WORD = 0x73; -pub const LANG_TIGRINYA: ::WORD = 0x73; -pub const LANG_TSWANA: ::WORD = 0x32; -pub const LANG_TURKISH: ::WORD = 0x1f; -pub const LANG_TURKMEN: ::WORD = 0x42; -pub const LANG_UIGHUR: ::WORD = 0x80; -pub const LANG_UKRAINIAN: ::WORD = 0x22; -pub const LANG_UPPER_SORBIAN: ::WORD = 0x2e; -pub const LANG_URDU: ::WORD = 0x20; -pub const LANG_UZBEK: ::WORD = 0x43; -pub const LANG_VALENCIAN: ::WORD = 0x03; -pub const LANG_VIETNAMESE: ::WORD = 0x2a; -pub const LANG_WELSH: ::WORD = 0x52; -pub const LANG_WOLOF: ::WORD = 0x88; -pub const LANG_XHOSA: ::WORD = 0x34; -pub const LANG_YAKUT: ::WORD = 0x85; -pub const LANG_YI: ::WORD = 0x78; -pub const LANG_YORUBA: ::WORD = 0x6a; -pub const LANG_ZULU: ::WORD = 0x35; -//1651 -pub const SUBLANG_NEUTRAL: ::WORD = 0x00; -pub const SUBLANG_DEFAULT: ::WORD = 0x01; -pub const SUBLANG_SYS_DEFAULT: ::WORD = 0x02; -pub const SUBLANG_CUSTOM_DEFAULT: ::WORD = 0x03; -pub const SUBLANG_CUSTOM_UNSPECIFIED: ::WORD = 0x04; -pub const SUBLANG_UI_CUSTOM_DEFAULT: ::WORD = 0x05; -pub const SUBLANG_AFRIKAANS_SOUTH_AFRICA: ::WORD = 0x01; -pub const SUBLANG_ALBANIAN_ALBANIA: ::WORD = 0x01; -pub const SUBLANG_ALSATIAN_FRANCE: ::WORD = 0x01; -pub const SUBLANG_AMHARIC_ETHIOPIA: ::WORD = 0x01; -pub const SUBLANG_ARABIC_SAUDI_ARABIA: ::WORD = 0x01; -pub const SUBLANG_ARABIC_IRAQ: ::WORD = 0x02; -pub const SUBLANG_ARABIC_EGYPT: ::WORD = 0x03; -pub const SUBLANG_ARABIC_LIBYA: ::WORD = 0x04; -pub const SUBLANG_ARABIC_ALGERIA: ::WORD = 0x05; -pub const SUBLANG_ARABIC_MOROCCO: ::WORD = 0x06; -pub const SUBLANG_ARABIC_TUNISIA: ::WORD = 0x07; -pub const SUBLANG_ARABIC_OMAN: ::WORD = 0x08; -pub const SUBLANG_ARABIC_YEMEN: ::WORD = 0x09; -pub const SUBLANG_ARABIC_SYRIA: ::WORD = 0x0a; -pub const SUBLANG_ARABIC_JORDAN: ::WORD = 0x0b; -pub const SUBLANG_ARABIC_LEBANON: ::WORD = 0x0c; -pub const SUBLANG_ARABIC_KUWAIT: ::WORD = 0x0d; -pub const SUBLANG_ARABIC_UAE: ::WORD = 0x0e; -pub const SUBLANG_ARABIC_BAHRAIN: ::WORD = 0x0f; -pub const SUBLANG_ARABIC_QATAR: ::WORD = 0x10; -pub const SUBLANG_ARMENIAN_ARMENIA: ::WORD = 0x01; -pub const SUBLANG_ASSAMESE_INDIA: ::WORD = 0x01; -pub const SUBLANG_AZERI_LATIN: ::WORD = 0x01; -pub const SUBLANG_AZERI_CYRILLIC: ::WORD = 0x02; -pub const SUBLANG_AZERBAIJANI_AZERBAIJAN_LATIN: ::WORD = 0x01; -pub const SUBLANG_AZERBAIJANI_AZERBAIJAN_CYRILLIC: ::WORD = 0x02; -pub const SUBLANG_BANGLA_INDIA: ::WORD = 0x01; -pub const SUBLANG_BANGLA_BANGLADESH: ::WORD = 0x02; -pub const SUBLANG_BASHKIR_RUSSIA: ::WORD = 0x01; -pub const SUBLANG_BASQUE_BASQUE: ::WORD = 0x01; -pub const SUBLANG_BELARUSIAN_BELARUS: ::WORD = 0x01; -pub const SUBLANG_BENGALI_INDIA: ::WORD = 0x01; -pub const SUBLANG_BENGALI_BANGLADESH: ::WORD = 0x02; -pub const SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN: ::WORD = 0x05; -pub const SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC: ::WORD = 0x08; -pub const SUBLANG_BRETON_FRANCE: ::WORD = 0x01; -pub const SUBLANG_BULGARIAN_BULGARIA: ::WORD = 0x01; -pub const SUBLANG_CATALAN_CATALAN: ::WORD = 0x01; -pub const SUBLANG_CENTRAL_KURDISH_IRAQ: ::WORD = 0x01; -pub const SUBLANG_CHEROKEE_CHEROKEE: ::WORD = 0x01; -pub const SUBLANG_CHINESE_TRADITIONAL: ::WORD = 0x01; -pub const SUBLANG_CHINESE_SIMPLIFIED: ::WORD = 0x02; -pub const SUBLANG_CHINESE_HONGKONG: ::WORD = 0x03; -pub const SUBLANG_CHINESE_SINGAPORE: ::WORD = 0x04; -pub const SUBLANG_CHINESE_MACAU: ::WORD = 0x05; -pub const SUBLANG_CORSICAN_FRANCE: ::WORD = 0x01; -pub const SUBLANG_CZECH_CZECH_REPUBLIC: ::WORD = 0x01; -pub const SUBLANG_CROATIAN_CROATIA: ::WORD = 0x01; -pub const SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN: ::WORD = 0x04; -pub const SUBLANG_DANISH_DENMARK: ::WORD = 0x01; -pub const SUBLANG_DARI_AFGHANISTAN: ::WORD = 0x01; -pub const SUBLANG_DIVEHI_MALDIVES: ::WORD = 0x01; -pub const SUBLANG_DUTCH: ::WORD = 0x01; -pub const SUBLANG_DUTCH_BELGIAN: ::WORD = 0x02; -pub const SUBLANG_ENGLISH_US: ::WORD = 0x01; -pub const SUBLANG_ENGLISH_UK: ::WORD = 0x02; -pub const SUBLANG_ENGLISH_AUS: ::WORD = 0x03; -pub const SUBLANG_ENGLISH_CAN: ::WORD = 0x04; -pub const SUBLANG_ENGLISH_NZ: ::WORD = 0x05; -pub const SUBLANG_ENGLISH_EIRE: ::WORD = 0x06; -pub const SUBLANG_ENGLISH_SOUTH_AFRICA: ::WORD = 0x07; -pub const SUBLANG_ENGLISH_JAMAICA: ::WORD = 0x08; -pub const SUBLANG_ENGLISH_CARIBBEAN: ::WORD = 0x09; -pub const SUBLANG_ENGLISH_BELIZE: ::WORD = 0x0a; -pub const SUBLANG_ENGLISH_TRINIDAD: ::WORD = 0x0b; -pub const SUBLANG_ENGLISH_ZIMBABWE: ::WORD = 0x0c; -pub const SUBLANG_ENGLISH_PHILIPPINES: ::WORD = 0x0d; -pub const SUBLANG_ENGLISH_INDIA: ::WORD = 0x10; -pub const SUBLANG_ENGLISH_MALAYSIA: ::WORD = 0x11; -pub const SUBLANG_ENGLISH_SINGAPORE: ::WORD = 0x12; -pub const SUBLANG_ESTONIAN_ESTONIA: ::WORD = 0x01; -pub const SUBLANG_FAEROESE_FAROE_ISLANDS: ::WORD = 0x01; -pub const SUBLANG_FILIPINO_PHILIPPINES: ::WORD = 0x01; -pub const SUBLANG_FINNISH_FINLAND: ::WORD = 0x01; -pub const SUBLANG_FRENCH: ::WORD = 0x01; -pub const SUBLANG_FRENCH_BELGIAN: ::WORD = 0x02; -pub const SUBLANG_FRENCH_CANADIAN: ::WORD = 0x03; -pub const SUBLANG_FRENCH_SWISS: ::WORD = 0x04; -pub const SUBLANG_FRENCH_LUXEMBOURG: ::WORD = 0x05; -pub const SUBLANG_FRENCH_MONACO: ::WORD = 0x06; -pub const SUBLANG_FRISIAN_NETHERLANDS: ::WORD = 0x01; -pub const SUBLANG_FULAH_SENEGAL: ::WORD = 0x02; -pub const SUBLANG_GALICIAN_GALICIAN: ::WORD = 0x01; -pub const SUBLANG_GEORGIAN_GEORGIA: ::WORD = 0x01; -pub const SUBLANG_GERMAN: ::WORD = 0x01; -pub const SUBLANG_GERMAN_SWISS: ::WORD = 0x02; -pub const SUBLANG_GERMAN_AUSTRIAN: ::WORD = 0x03; -pub const SUBLANG_GERMAN_LUXEMBOURG: ::WORD = 0x04; -pub const SUBLANG_GERMAN_LIECHTENSTEIN: ::WORD = 0x05; -pub const SUBLANG_GREEK_GREECE: ::WORD = 0x01; -pub const SUBLANG_GREENLANDIC_GREENLAND: ::WORD = 0x01; -pub const SUBLANG_GUJARATI_INDIA: ::WORD = 0x01; -pub const SUBLANG_HAUSA_NIGERIA_LATIN: ::WORD = 0x01; -pub const SUBLANG_HAWAIIAN_US: ::WORD = 0x01; -pub const SUBLANG_HEBREW_ISRAEL: ::WORD = 0x01; -pub const SUBLANG_HINDI_INDIA: ::WORD = 0x01; -pub const SUBLANG_HUNGARIAN_HUNGARY: ::WORD = 0x01; -pub const SUBLANG_ICELANDIC_ICELAND: ::WORD = 0x01; -pub const SUBLANG_IGBO_NIGERIA: ::WORD = 0x01; -pub const SUBLANG_INDONESIAN_INDONESIA: ::WORD = 0x01; -pub const SUBLANG_INUKTITUT_CANADA: ::WORD = 0x01; -pub const SUBLANG_INUKTITUT_CANADA_LATIN: ::WORD = 0x02; -pub const SUBLANG_IRISH_IRELAND: ::WORD = 0x02; -pub const SUBLANG_ITALIAN: ::WORD = 0x01; -pub const SUBLANG_ITALIAN_SWISS: ::WORD = 0x02; -pub const SUBLANG_JAPANESE_JAPAN: ::WORD = 0x01; -pub const SUBLANG_KANNADA_INDIA: ::WORD = 0x01; -pub const SUBLANG_KASHMIRI_SASIA: ::WORD = 0x02; -pub const SUBLANG_KASHMIRI_INDIA: ::WORD = 0x02; -pub const SUBLANG_KAZAK_KAZAKHSTAN: ::WORD = 0x01; -pub const SUBLANG_KHMER_CAMBODIA: ::WORD = 0x01; -pub const SUBLANG_KICHE_GUATEMALA: ::WORD = 0x01; -pub const SUBLANG_KINYARWANDA_RWANDA: ::WORD = 0x01; -pub const SUBLANG_KONKANI_INDIA: ::WORD = 0x01; -pub const SUBLANG_KOREAN: ::WORD = 0x01; -pub const SUBLANG_KYRGYZ_KYRGYZSTAN: ::WORD = 0x01; -pub const SUBLANG_LAO_LAO: ::WORD = 0x01; -pub const SUBLANG_LATVIAN_LATVIA: ::WORD = 0x01; -pub const SUBLANG_LITHUANIAN: ::WORD = 0x01; -pub const SUBLANG_LOWER_SORBIAN_GERMANY: ::WORD = 0x02; -pub const SUBLANG_LUXEMBOURGISH_LUXEMBOURG: ::WORD = 0x01; -pub const SUBLANG_MACEDONIAN_MACEDONIA: ::WORD = 0x01; -pub const SUBLANG_MALAY_MALAYSIA: ::WORD = 0x01; -pub const SUBLANG_MALAY_BRUNEI_DARUSSALAM: ::WORD = 0x02; -pub const SUBLANG_MALAYALAM_INDIA: ::WORD = 0x01; -pub const SUBLANG_MALTESE_MALTA: ::WORD = 0x01; -pub const SUBLANG_MAORI_NEW_ZEALAND: ::WORD = 0x01; -pub const SUBLANG_MAPUDUNGUN_CHILE: ::WORD = 0x01; -pub const SUBLANG_MARATHI_INDIA: ::WORD = 0x01; -pub const SUBLANG_MOHAWK_MOHAWK: ::WORD = 0x01; -pub const SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA: ::WORD = 0x01; -pub const SUBLANG_MONGOLIAN_PRC: ::WORD = 0x02; -pub const SUBLANG_NEPALI_INDIA: ::WORD = 0x02; -pub const SUBLANG_NEPALI_NEPAL: ::WORD = 0x01; -pub const SUBLANG_NORWEGIAN_BOKMAL: ::WORD = 0x01; -pub const SUBLANG_NORWEGIAN_NYNORSK: ::WORD = 0x02; -pub const SUBLANG_OCCITAN_FRANCE: ::WORD = 0x01; -pub const SUBLANG_ODIA_INDIA: ::WORD = 0x01; -pub const SUBLANG_ORIYA_INDIA: ::WORD = 0x01; -pub const SUBLANG_PASHTO_AFGHANISTAN: ::WORD = 0x01; -pub const SUBLANG_PERSIAN_IRAN: ::WORD = 0x01; -pub const SUBLANG_POLISH_POLAND: ::WORD = 0x01; -pub const SUBLANG_PORTUGUESE: ::WORD = 0x02; -pub const SUBLANG_PORTUGUESE_BRAZILIAN: ::WORD = 0x01; -pub const SUBLANG_PULAR_SENEGAL: ::WORD = 0x02; -pub const SUBLANG_PUNJABI_INDIA: ::WORD = 0x01; -pub const SUBLANG_PUNJABI_PAKISTAN: ::WORD = 0x02; -pub const SUBLANG_QUECHUA_BOLIVIA: ::WORD = 0x01; -pub const SUBLANG_QUECHUA_ECUADOR: ::WORD = 0x02; -pub const SUBLANG_QUECHUA_PERU: ::WORD = 0x03; -pub const SUBLANG_ROMANIAN_ROMANIA: ::WORD = 0x01; -pub const SUBLANG_ROMANSH_SWITZERLAND: ::WORD = 0x01; -pub const SUBLANG_RUSSIAN_RUSSIA: ::WORD = 0x01; -pub const SUBLANG_SAKHA_RUSSIA: ::WORD = 0x01; -pub const SUBLANG_SAMI_NORTHERN_NORWAY: ::WORD = 0x01; -pub const SUBLANG_SAMI_NORTHERN_SWEDEN: ::WORD = 0x02; -pub const SUBLANG_SAMI_NORTHERN_FINLAND: ::WORD = 0x03; -pub const SUBLANG_SAMI_LULE_NORWAY: ::WORD = 0x04; -pub const SUBLANG_SAMI_LULE_SWEDEN: ::WORD = 0x05; -pub const SUBLANG_SAMI_SOUTHERN_NORWAY: ::WORD = 0x06; -pub const SUBLANG_SAMI_SOUTHERN_SWEDEN: ::WORD = 0x07; -pub const SUBLANG_SAMI_SKOLT_FINLAND: ::WORD = 0x08; -pub const SUBLANG_SAMI_INARI_FINLAND: ::WORD = 0x09; -pub const SUBLANG_SANSKRIT_INDIA: ::WORD = 0x01; -pub const SUBLANG_SCOTTISH_GAELIC: ::WORD = 0x01; -pub const SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN: ::WORD = 0x06; -pub const SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC: ::WORD = 0x07; -pub const SUBLANG_SERBIAN_MONTENEGRO_LATIN: ::WORD = 0x0b; -pub const SUBLANG_SERBIAN_MONTENEGRO_CYRILLIC: ::WORD = 0x0c; -pub const SUBLANG_SERBIAN_SERBIA_LATIN: ::WORD = 0x09; -pub const SUBLANG_SERBIAN_SERBIA_CYRILLIC: ::WORD = 0x0a; -pub const SUBLANG_SERBIAN_CROATIA: ::WORD = 0x01; -pub const SUBLANG_SERBIAN_LATIN: ::WORD = 0x02; -pub const SUBLANG_SERBIAN_CYRILLIC: ::WORD = 0x03; -pub const SUBLANG_SINDHI_INDIA: ::WORD = 0x01; -pub const SUBLANG_SINDHI_PAKISTAN: ::WORD = 0x02; -pub const SUBLANG_SINDHI_AFGHANISTAN: ::WORD = 0x02; -pub const SUBLANG_SINHALESE_SRI_LANKA: ::WORD = 0x01; -pub const SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA: ::WORD = 0x01; -pub const SUBLANG_SLOVAK_SLOVAKIA: ::WORD = 0x01; -pub const SUBLANG_SLOVENIAN_SLOVENIA: ::WORD = 0x01; -pub const SUBLANG_SPANISH: ::WORD = 0x01; -pub const SUBLANG_SPANISH_MEXICAN: ::WORD = 0x02; -pub const SUBLANG_SPANISH_MODERN: ::WORD = 0x03; -pub const SUBLANG_SPANISH_GUATEMALA: ::WORD = 0x04; -pub const SUBLANG_SPANISH_COSTA_RICA: ::WORD = 0x05; -pub const SUBLANG_SPANISH_PANAMA: ::WORD = 0x06; -pub const SUBLANG_SPANISH_DOMINICAN_REPUBLIC: ::WORD = 0x07; -pub const SUBLANG_SPANISH_VENEZUELA: ::WORD = 0x08; -pub const SUBLANG_SPANISH_COLOMBIA: ::WORD = 0x09; -pub const SUBLANG_SPANISH_PERU: ::WORD = 0x0a; -pub const SUBLANG_SPANISH_ARGENTINA: ::WORD = 0x0b; -pub const SUBLANG_SPANISH_ECUADOR: ::WORD = 0x0c; -pub const SUBLANG_SPANISH_CHILE: ::WORD = 0x0d; -pub const SUBLANG_SPANISH_URUGUAY: ::WORD = 0x0e; -pub const SUBLANG_SPANISH_PARAGUAY: ::WORD = 0x0f; -pub const SUBLANG_SPANISH_BOLIVIA: ::WORD = 0x10; -pub const SUBLANG_SPANISH_EL_SALVADOR: ::WORD = 0x11; -pub const SUBLANG_SPANISH_HONDURAS: ::WORD = 0x12; -pub const SUBLANG_SPANISH_NICARAGUA: ::WORD = 0x13; -pub const SUBLANG_SPANISH_PUERTO_RICO: ::WORD = 0x14; -pub const SUBLANG_SPANISH_US: ::WORD = 0x15; -pub const SUBLANG_SWAHILI_KENYA: ::WORD = 0x01; -pub const SUBLANG_SWEDISH: ::WORD = 0x01; -pub const SUBLANG_SWEDISH_FINLAND: ::WORD = 0x02; -pub const SUBLANG_SYRIAC_SYRIA: ::WORD = 0x01; -pub const SUBLANG_TAJIK_TAJIKISTAN: ::WORD = 0x01; -pub const SUBLANG_TAMAZIGHT_ALGERIA_LATIN: ::WORD = 0x02; -pub const SUBLANG_TAMAZIGHT_MOROCCO_TIFINAGH: ::WORD = 0x04; -pub const SUBLANG_TAMIL_INDIA: ::WORD = 0x01; -pub const SUBLANG_TAMIL_SRI_LANKA: ::WORD = 0x02; -pub const SUBLANG_TATAR_RUSSIA: ::WORD = 0x01; -pub const SUBLANG_TELUGU_INDIA: ::WORD = 0x01; -pub const SUBLANG_THAI_THAILAND: ::WORD = 0x01; -pub const SUBLANG_TIBETAN_PRC: ::WORD = 0x01; -pub const SUBLANG_TIGRIGNA_ERITREA: ::WORD = 0x02; -pub const SUBLANG_TIGRINYA_ERITREA: ::WORD = 0x02; -pub const SUBLANG_TIGRINYA_ETHIOPIA: ::WORD = 0x01; -pub const SUBLANG_TSWANA_BOTSWANA: ::WORD = 0x02; -pub const SUBLANG_TSWANA_SOUTH_AFRICA: ::WORD = 0x01; -pub const SUBLANG_TURKISH_TURKEY: ::WORD = 0x01; -pub const SUBLANG_TURKMEN_TURKMENISTAN: ::WORD = 0x01; -pub const SUBLANG_UIGHUR_PRC: ::WORD = 0x01; -pub const SUBLANG_UKRAINIAN_UKRAINE: ::WORD = 0x01; -pub const SUBLANG_UPPER_SORBIAN_GERMANY: ::WORD = 0x01; -pub const SUBLANG_URDU_PAKISTAN: ::WORD = 0x01; -pub const SUBLANG_URDU_INDIA: ::WORD = 0x02; -pub const SUBLANG_UZBEK_LATIN: ::WORD = 0x01; -pub const SUBLANG_UZBEK_CYRILLIC: ::WORD = 0x02; -pub const SUBLANG_VALENCIAN_VALENCIA: ::WORD = 0x02; -pub const SUBLANG_VIETNAMESE_VIETNAM: ::WORD = 0x01; -pub const SUBLANG_WELSH_UNITED_KINGDOM: ::WORD = 0x01; -pub const SUBLANG_WOLOF_SENEGAL: ::WORD = 0x01; -pub const SUBLANG_XHOSA_SOUTH_AFRICA: ::WORD = 0x01; -pub const SUBLANG_YAKUT_RUSSIA: ::WORD = 0x01; -pub const SUBLANG_YI_PRC: ::WORD = 0x01; -pub const SUBLANG_YORUBA_NIGERIA: ::WORD = 0x01; -pub const SUBLANG_ZULU_SOUTH_AFRICA: ::WORD = 0x01; -//1962 -// FIXME: Once feature(const_fn) or some CTFE alternative becomes stable, MAKELANGID! can go -// unless we want to #[macro_export] it ... -macro_rules! MAKELANGID { ($p:expr, $s:expr) => ($s << 10 | $p) } -pub fn MAKELANGID(p: ::WORD, s: ::WORD) -> ::LANGID { MAKELANGID!(p, s) } -pub fn PRIMARYLANGID(lgid: ::LANGID) -> ::WORD { lgid & 0x3ff } -pub fn SUBLANGID(lgid: ::LANGID) -> ::WORD { lgid >> 10 } -//2019 -pub const LANG_SYSTEM_DEFAULT: LANGID = MAKELANGID!(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT); -pub const LANG_USER_DEFAULT: LANGID = MAKELANGID!(LANG_NEUTRAL, SUBLANG_DEFAULT); -//2214 -pub const MAXIMUM_WAIT_OBJECTS: ::DWORD = 64; -pub const MAXIMUM_SUSPEND_COUNT: ::CHAR = MAXCHAR; -//2277 -pub type KSPIN_LOCK = ::ULONG_PTR; -pub type PKSPIN_LOCK = *mut KSPIN_LOCK; -STRUCT!{struct M128A { // FIXME align 16 - Low: ULONGLONG, - High: LONGLONG, -}} -pub type PM128A = *mut M128A; -#[cfg(target_arch = "x86")] -STRUCT!{nodebug struct XSAVE_FORMAT { // FIXME align 16 - ControlWord: ::WORD, - StatusWord: ::WORD, - TagWord: ::BYTE, - Reserved1: ::BYTE, - ErrorOpcode: ::WORD, - ErrorOffset: ::DWORD, - ErrorSelector: ::WORD, - Reserved2: ::WORD, - DataOffset: ::DWORD, - DataSelector: ::WORD, - Reserved3: ::WORD, - MxCsr: ::DWORD, - MxCsr_Mask: ::DWORD, - FloatRegisters: [M128A; 8], - XmmRegisters: [M128A; 8], - Reserved4: [::BYTE; 224], -}} -#[cfg(target_arch = "x86_64")] -STRUCT!{nodebug struct XSAVE_FORMAT { // FIXME align 16 - ControlWord: ::WORD, - StatusWord: ::WORD, - TagWord: ::BYTE, - Reserved1: ::BYTE, - ErrorOpcode: ::WORD, - ErrorOffset: ::DWORD, - ErrorSelector: ::WORD, - Reserved2: ::WORD, - DataOffset: ::DWORD, - DataSelector: ::WORD, - Reserved3: ::WORD, - MxCsr: ::DWORD, - MxCsr_Mask: ::DWORD, - FloatRegisters: [M128A; 8], - XmmRegisters: [M128A; 16], - Reserved4: [::BYTE; 96], -}} -//3563 -#[cfg(target_arch = "x86")] -pub const SIZE_OF_80387_REGISTERS: usize = 80; -#[cfg(target_arch = "x86")] -STRUCT!{nodebug struct FLOATING_SAVE_AREA { - ControlWord: ::DWORD, - StatusWord: ::DWORD, - TagWord: ::DWORD, - ErrorOffset: ::DWORD, - ErrorSelector: ::DWORD, - DataOffset: ::DWORD, - DataSelector: ::DWORD, - RegisterArea: [::BYTE; SIZE_OF_80387_REGISTERS], - Spare0: ::DWORD, -}} -#[cfg(target_arch = "x86")] -pub type PFLOATING_SAVE_AREA = *mut FLOATING_SAVE_AREA; -#[cfg(target_arch = "x86")] -pub const MAXIMUM_SUPPORTED_EXTENSION: usize = 512; -#[cfg(target_arch = "x86")] -STRUCT!{nodebug struct CONTEXT { - ContextFlags: ::DWORD, - Dr0: ::DWORD, - Dr1: ::DWORD, - Dr2: ::DWORD, - Dr3: ::DWORD, - Dr6: ::DWORD, - Dr7: ::DWORD, - FloatSave: FLOATING_SAVE_AREA, - SegGs: ::DWORD, - SegFs: ::DWORD, - SegEs: ::DWORD, - SegDs: ::DWORD, - Edi: ::DWORD, - Esi: ::DWORD, - Ebx: ::DWORD, - Edx: ::DWORD, - Ecx: ::DWORD, - Eax: ::DWORD, - Ebp: ::DWORD, - Eip: ::DWORD, - SegCs: ::DWORD, - EFlags: ::DWORD, - Esp: ::DWORD, - SegSs: ::DWORD, - ExtendedRegisters: [::BYTE; MAXIMUM_SUPPORTED_EXTENSION], -}} -#[cfg(target_arch = "x86_64")] -pub type XMM_SAVE_AREA32 = XSAVE_FORMAT; -pub type PXMM_SAVE_AREA32 = *mut XSAVE_FORMAT; -// FIXME - Align 16 -#[cfg(target_arch = "x86_64")] -STRUCT!{nodebug struct CONTEXT { - P1Home: ::DWORD64, - P2Home: ::DWORD64, - P3Home: ::DWORD64, - P4Home: ::DWORD64, - P5Home: ::DWORD64, - P6Home: ::DWORD64, - ContextFlags: ::DWORD, - MxCsr: ::DWORD, - SegCs: ::WORD, - SegDs: ::WORD, - SegEs: ::WORD, - SegFs: ::WORD, - SegGs: ::WORD, - SegSs: ::WORD, - EFlags: ::DWORD, - Dr0: ::DWORD64, - Dr1: ::DWORD64, - Dr2: ::DWORD64, - Dr3: ::DWORD64, - Dr6: ::DWORD64, - Dr7: ::DWORD64, - Rax: ::DWORD64, - Rcx: ::DWORD64, - Rdx: ::DWORD64, - Rbx: ::DWORD64, - Rsp: ::DWORD64, - Rbp: ::DWORD64, - Rsi: ::DWORD64, - Rdi: ::DWORD64, - R8: ::DWORD64, - R9: ::DWORD64, - R10: ::DWORD64, - R11: ::DWORD64, - R12: ::DWORD64, - R13: ::DWORD64, - R14: ::DWORD64, - R15: ::DWORD64, - Rip: ::DWORD64, - FltSave: XMM_SAVE_AREA32, - VectorRegister: [::M128A; 26], - VectorControl: ::DWORD64, - DebugControl: ::DWORD64, - LastBranchToRip: ::DWORD64, - LastBranchFromRip: ::DWORD64, - LastExceptionToRip: ::DWORD64, - LastExceptionFromRip: ::DWORD64, -}} -pub type PCONTEXT = *mut CONTEXT; -#[test] -fn test_CONTEXT_size() { - use std::mem::size_of; - if cfg!(target_arch = "x86_64") { - assert_eq!(size_of::(), 1232) - } else if cfg!(target_arch = "x86") { - assert_eq!(size_of::(), 716) - } -} -pub type RUNTIME_FUNCTION = IMAGE_RUNTIME_FUNCTION_ENTRY; -pub type PRUNTIME_FUNCTION = *mut RUNTIME_FUNCTION; -pub const UNWIND_HISTORY_TABLE_SIZE: usize = 12; -STRUCT!{struct UNWIND_HISTORY_TABLE_ENTRY { - ImageBase: ::DWORD64, - FunctionEntry: PRUNTIME_FUNCTION, -}} -pub type PUNWIND_HISTORY_TABLE_ENTRY = *mut UNWIND_HISTORY_TABLE_ENTRY; -STRUCT!{struct UNWIND_HISTORY_TABLE { - Count: ::DWORD, - LocalHint: ::BYTE, - GlobalHint: ::BYTE, - Search: ::BYTE, - Once: ::BYTE, - LowAddress: ::DWORD64, - HighAddress: ::DWORD64, - Entry: [UNWIND_HISTORY_TABLE_ENTRY; UNWIND_HISTORY_TABLE_SIZE], -}} -pub type PUNWIND_HISTORY_TABLE = *mut UNWIND_HISTORY_TABLE; -pub type PGET_RUNTIME_FUNCTION_CALLBACK = Option PRUNTIME_FUNCTION>; -STRUCT!{struct KNONVOLATILE_CONTEXT_POINTERS_u1 { - Xmm0: PM128A, - Xmm1: PM128A, - Xmm2: PM128A, - Xmm3: PM128A, - Xmm4: PM128A, - Xmm5: PM128A, - Xmm6: PM128A, - Xmm7: PM128A, - Xmm8: PM128A, - Xmm9: PM128A, - Xmm10: PM128A, - Xmm11: PM128A, - Xmm12: PM128A, - Xmm14: PM128A, - Xmm15: PM128A, -}} -STRUCT!{struct KNONVOLATILE_CONTEXT_POINTERS_u2 { - Rax: ::DWORD64, - Rcx: ::DWORD64, - Rdx: ::DWORD64, - Rbx: ::DWORD64, - Rsp: ::DWORD64, - Rbp: ::DWORD64, - Rsi: ::DWORD64, - Rdi: ::DWORD64, - R8: ::DWORD64, - R9: ::DWORD64, - R10: ::DWORD64, - R11: ::DWORD64, - R12: ::DWORD64, - R13: ::DWORD64, - R14: ::DWORD64, - R15: ::DWORD64, -}} -STRUCT!{struct KNONVOLATILE_CONTEXT_POINTERS { - FloatingContext: [PM128A; 16], - IntegerContext: [::PDWORD64; 16], -}} -// FIXME: all unions are untagged -UNION!( - KNONVOLATILE_CONTEXT_POINTERS, FloatingContext, Xmms, Xmms_mut, - KNONVOLATILE_CONTEXT_POINTERS_u1 -); -UNION!( - KNONVOLATILE_CONTEXT_POINTERS, IntegerContext, Regs, Regs_mut, - KNONVOLATILE_CONTEXT_POINTERS_u2 -); -pub type PKNONVOLATILE_CONTEXT_POINTERS = *mut KNONVOLATILE_CONTEXT_POINTERS; -//8983 -pub const EXCEPTION_MAXIMUM_PARAMETERS: usize = 15; -STRUCT!{struct EXCEPTION_RECORD { - ExceptionCode: ::DWORD, - ExceptionFlags: ::DWORD, - ExceptionRecord: *mut EXCEPTION_RECORD, - ExceptionAddress: ::PVOID, - NumberParameters: ::DWORD, - ExceptionInformation: [::ULONG_PTR; EXCEPTION_MAXIMUM_PARAMETERS], -}} -pub type PEXCEPTION_RECORD = *mut EXCEPTION_RECORD; -//9023 -STRUCT!{struct EXCEPTION_POINTERS { - ExceptionRecord: PEXCEPTION_RECORD, - ContextRecord: PCONTEXT, -}} -pub type PEXCEPTION_POINTERS = *mut EXCEPTION_POINTERS; -pub type PACCESS_TOKEN = ::PVOID; -pub type PSECURITY_DESCRIPTOR = ::PVOID; -pub type PSID = ::PVOID; -pub type PCLAIMS_BLOB = ::PVOID; -//9091 -pub type ACCESS_MASK = ::DWORD; -pub type PACCESS_MASK = *mut ACCESS_MASK; -pub const DELETE: ::DWORD = 0x00010000; -pub const READ_CONTROL: ::DWORD = 0x00020000; -pub const WRITE_DAC: ::DWORD = 0x00040000; -pub const WRITE_OWNER: ::DWORD = 0x00080000; -pub const SYNCHRONIZE: ::DWORD = 0x00100000; -pub const STANDARD_RIGHTS_REQUIRED: ::DWORD = 0x000F0000; -pub const STANDARD_RIGHTS_READ: ::DWORD = READ_CONTROL; -pub const STANDARD_RIGHTS_WRITE: ::DWORD = READ_CONTROL; -pub const STANDARD_RIGHTS_EXECUTE: ::DWORD = READ_CONTROL; -pub const STANDARD_RIGHTS_ALL: ::DWORD = 0x001F0000; -pub const SPECIFIC_RIGHTS_ALL: ::DWORD = 0x0000FFFF; -pub const ACCESS_SYSTEM_SECURITY: ::DWORD = 0x01000000; -pub const MAXIMUM_ALLOWED: ::DWORD = 0x02000000; -pub const GENERIC_READ: ::DWORD = 0x80000000; -pub const GENERIC_WRITE: ::DWORD = 0x40000000; -pub const GENERIC_EXECUTE: ::DWORD = 0x20000000; -pub const GENERIC_ALL: ::DWORD = 0x10000000; -//9170 -STRUCT!{struct LUID_AND_ATTRIBUTES { - Luid: LUID, - Attributes: ::DWORD, -}} -pub type PLUID_AND_ATTRIBUTES = *mut LUID_AND_ATTRIBUTES; -//9243 -ENUM!{enum SID_NAME_USE { - SidTypeUser = 1, - SidTypeGroup, - SidTypeDomain, - SidTypeAlias, - SidTypeWellKnownGroup, - SidTypeDeletedAccount, - SidTypeInvalid, - SidTypeUnknown, - SidTypeComputer, - SidTypeLabel, -}} -pub type PSID_NAME_USE = *mut SID_NAME_USE; -STRUCT!{struct SID_AND_ATTRIBUTES { - Sid: PSID, - Attributes: ::DWORD, -}} -pub type PSID_AND_ATTRIBUTES = *mut SID_AND_ATTRIBUTES; -//9802 -pub const ACL_REVISION: ::BYTE = 2; -pub const ACL_REVISION_DS: ::BYTE = 4; -pub const ACL_REVISION1: ::BYTE = 1; -pub const MIN_ACL_REVISION: ::BYTE = ACL_REVISION2; -pub const ACL_REVISION2: ::BYTE = 2; -pub const ACL_REVISION3: ::BYTE = 3; -pub const ACL_REVISION4: ::BYTE = 4; -pub const MAX_ACL_REVISION: ::BYTE = ACL_REVISION4; -STRUCT!{struct ACL { - AclRevision: ::BYTE, - Sbz1: ::BYTE, - AclSize: ::WORD, - AceCount: ::WORD, - Sbz2: ::WORD, -}} -pub type PACL = *mut ACL; -//9888 -pub const SE_PRIVILEGE_ENABLED_BY_DEFAULT: ::DWORD = 0x00000001; -pub const SE_PRIVILEGE_ENABLED: ::DWORD = 0x00000002; -pub const SE_PRIVILEGE_REMOVED: ::DWORD = 0x00000004; -pub const SE_PRIVILEGE_USED_FOR_ACCESS: ::DWORD = 0x80000000; -pub const SE_PRIVILEGE_VALID_ATTRIBUTES: ::DWORD = SE_PRIVILEGE_ENABLED_BY_DEFAULT | SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_REMOVED | SE_PRIVILEGE_USED_FOR_ACCESS; -pub const PRIVILEGE_SET_ALL_NECESSARY: ::DWORD = 1; -//10689 -pub const TOKEN_ASSIGN_PRIMARY: ::DWORD = 0x0001; -pub const TOKEN_DUPLICATE: ::DWORD = 0x0002; -pub const TOKEN_IMPERSONATE: ::DWORD = 0x0004; -pub const TOKEN_QUERY: ::DWORD = 0x0008; -pub const TOKEN_QUERY_SOURCE: ::DWORD = 0x0010; -pub const TOKEN_ADJUST_PRIVILEGES: ::DWORD = 0x0020; -pub const TOKEN_ADJUST_GROUPS: ::DWORD = 0x0040; -pub const TOKEN_ADJUST_DEFAULT: ::DWORD = 0x0080; -pub const TOKEN_ADJUST_SESSIONID: ::DWORD = 0x0100; -pub const TOKEN_ALL_ACCESS_P: ::DWORD = STANDARD_RIGHTS_REQUIRED | TOKEN_ASSIGN_PRIMARY - | TOKEN_DUPLICATE | TOKEN_IMPERSONATE | TOKEN_QUERY | TOKEN_QUERY_SOURCE - | TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT; -pub const TOKEN_ALL_ACCESS: ::DWORD = TOKEN_ALL_ACCESS_P | TOKEN_ADJUST_SESSIONID; -pub const TOKEN_READ: ::DWORD = STANDARD_RIGHTS_READ | TOKEN_QUERY; -pub const TOKEN_WRITE: ::DWORD = STANDARD_RIGHTS_WRITE | TOKEN_ADJUST_PRIVILEGES - | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT; -pub const TOKEN_EXECUTE: ::DWORD = STANDARD_RIGHTS_EXECUTE; -//10823 -STRUCT!{nodebug struct TOKEN_PRIVILEGES { - PrivilegeCount: ::DWORD, - Privileges: [LUID_AND_ATTRIBUTES; 0], -}} -pub type PTOKEN_PRIVILEGES = *mut TOKEN_PRIVILEGES; -//10965 -pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_INVALID: ::WORD = 0x00; -pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_INT64: ::WORD = 0x01; -pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_UINT64: ::WORD = 0x02; -pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_STRING: ::WORD = 0x03; -STRUCT!{struct CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE { - Version: ::DWORD64, - Name: ::PWSTR, -}} -pub type PCLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE = *mut CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE; -pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_FQBN: ::WORD = 0x04; -pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_SID: ::WORD = 0x05; -pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_BOOLEAN: ::WORD = 0x06; -STRUCT!{struct CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE { - pValue: ::PVOID, - ValueLength: ::DWORD, -}} -pub type PCLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE = - *mut CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE; -pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_OCTET_STRING: ::WORD = 0x10; -pub const CLAIM_SECURITY_ATTRIBUTE_NON_INHERITABLE: ::DWORD = 0x0001; -pub const CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE: ::DWORD = 0x0002; -pub const CLAIM_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY: ::DWORD = 0x0004; -pub const CLAIM_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT: ::DWORD = 0x0008; -pub const CLAIM_SECURITY_ATTRIBUTE_DISABLED: ::DWORD = 0x0010; -pub const CLAIM_SECURITY_ATTRIBUTE_MANDATORY: ::DWORD = 0x0020; -pub const CLAIM_SECURITY_ATTRIBUTE_VALID_FLAGS: ::DWORD = CLAIM_SECURITY_ATTRIBUTE_NON_INHERITABLE - | CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE | CLAIM_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY - | CLAIM_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT | CLAIM_SECURITY_ATTRIBUTE_DISABLED - | CLAIM_SECURITY_ATTRIBUTE_MANDATORY; -pub const CLAIM_SECURITY_ATTRIBUTE_CUSTOM_FLAGS: ::DWORD = 0xFFFF0000; -STRUCT!{struct CLAIM_SECURITY_ATTRIBUTE_V1 { - Name: ::PWSTR, - ValueType: ::WORD, - Reserved: ::WORD, - Flags: ::DWORD, - ValueCount: ::DWORD, - // Put data here -}} -pub type PCLAIM_SECURITY_ATTRIBUTE_V1 = *mut CLAIM_SECURITY_ATTRIBUTE_V1; -STRUCT!{struct CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 { - Name: ::DWORD, - ValueType: ::WORD, - Reserved: ::WORD, - Flags: ::DWORD, - ValueCount: ::DWORD, - // Put array here -}} -pub type PCLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 = *mut CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1; -pub const CLAIM_SECURITY_ATTRIBUTES_INFORMATION_VERSION_V1: ::WORD = 1; -pub const CLAIM_SECURITY_ATTRIBUTES_INFORMATION_VERSION: ::WORD = - CLAIM_SECURITY_ATTRIBUTES_INFORMATION_VERSION_V1; -STRUCT!{struct CLAIM_SECURITY_ATTRIBUTES_INFORMATION { - Version: ::WORD, - Reserved: ::WORD, - AttributeCount: ::DWORD, - pAttributeV1: PCLAIM_SECURITY_ATTRIBUTE_V1, -}} -pub type PCLAIM_SECURITY_ATTRIBUTES_INFORMATION = *mut CLAIM_SECURITY_ATTRIBUTES_INFORMATION; -//11257 -pub type SECURITY_INFORMATION = ::DWORD; -pub type PSECURITY_INFORMATION = *mut ::DWORD; -pub const OWNER_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000001; -pub const GROUP_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000002; -pub const DACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000004; -pub const SACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000008; -pub const LABEL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000010; -pub const ATTRIBUTE_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000020; -pub const SCOPE_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000040; -pub const PROCESS_TRUST_LABEL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000080; -pub const BACKUP_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00010000; -pub const PROTECTED_DACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x80000000; -pub const PROTECTED_SACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x40000000; -pub const UNPROTECTED_DACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x20000000; -pub const UNPROTECTED_SACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x10000000; -ENUM!{enum SE_LEARNING_MODE_DATA_TYPE { - SeLearningModeInvalidType = 0, - SeLearningModeSettings, - SeLearningModeMax, -}} -STRUCT!{struct SECURITY_CAPABILITIES { - AppContainerSid: PSID, - Capabilities: PSID_AND_ATTRIBUTES, - CapabilityCount: ::DWORD, - Reserved: ::DWORD, -}} -pub type PSECURITY_CAPABILITIES = *mut SECURITY_CAPABILITIES; -pub type LPSECURITY_CAPABILITIES = *mut SECURITY_CAPABILITIES; -pub const PROCESS_TERMINATE: ::DWORD = 0x0001; -pub const PROCESS_CREATE_THREAD: ::DWORD = 0x0002; -pub const PROCESS_SET_SESSIONID: ::DWORD = 0x0004; -pub const PROCESS_VM_OPERATION: ::DWORD = 0x0008; -pub const PROCESS_VM_READ: ::DWORD = 0x0010; -pub const PROCESS_VM_WRITE: ::DWORD = 0x0020; -pub const PROCESS_DUP_HANDLE: ::DWORD = 0x0040; -pub const PROCESS_CREATE_PROCESS: ::DWORD = 0x0080; -pub const PROCESS_SET_QUOTA: ::DWORD = 0x0100; -pub const PROCESS_SET_INFORMATION: ::DWORD = 0x0200; -pub const PROCESS_QUERY_INFORMATION: ::DWORD = 0x0400; -pub const PROCESS_SUSPEND_RESUME: ::DWORD = 0x0800; -pub const PROCESS_QUERY_LIMITED_INFORMATION: ::DWORD = 0x1000; -pub const PROCESS_SET_LIMITED_INFORMATION: ::DWORD = 0x2000; -pub const PROCESS_ALL_ACCESS: ::DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFFF; -//11007 -pub const THREAD_BASE_PRIORITY_LOWRT: ::DWORD = 15; -pub const THREAD_BASE_PRIORITY_MAX: ::DWORD = 2; -pub const THREAD_BASE_PRIORITY_MIN: ::DWORD = -2i32 as ::DWORD; -pub const THREAD_BASE_PRIORITY_IDLE: ::DWORD = -15i32 as ::DWORD; -//11018 -STRUCT!{struct QUOTA_LIMITS { - PagedPoolLimit: ::SIZE_T, - NonPagedPoolLimit: ::SIZE_T, - MinimumWorkingSetSize: ::SIZE_T, - MaximumWorkingSetSize: ::SIZE_T, - PagefileLimit: ::SIZE_T, - TimeLimit: ::LARGE_INTEGER, -}} -pub type PQUOTA_LIMITS = *mut QUOTA_LIMITS; -pub const QUOTA_LIMITS_HARDWS_MIN_ENABLE: ::DWORD = 0x00000001; -pub const QUOTA_LIMITS_HARDWS_MIN_DISABLE: ::DWORD = 0x00000002; -pub const QUOTA_LIMITS_HARDWS_MAX_ENABLE: ::DWORD = 0x00000004; -pub const QUOTA_LIMITS_HARDWS_MAX_DISABLE: ::DWORD = 0x00000008; -pub const QUOTA_LIMITS_USE_DEFAULT_LIMITS: ::DWORD = 0x00000010; -STRUCT!{struct RATE_QUOTA_LIMIT { - RateData: ::DWORD, - BitFields: ::DWORD, -}} -BITFIELD!(RATE_QUOTA_LIMIT BitFields: ::DWORD [ - RatePercent set_RatePercent[0..7], - Reserved0 set_Reserved0[7..32], -]); -pub type PRATE_QUOTA_LIMIT = *mut RATE_QUOTA_LIMIT; -STRUCT!{struct QUOTA_LIMITS_EX { - PagedPoolLimit: ::SIZE_T, - NonPagedPoolLimit: ::SIZE_T, - MinimumWorkingSetSize: ::SIZE_T, - MaximumWorkingSetSize: ::SIZE_T, - PagefileLimit: ::SIZE_T, - TimeLimit: ::LARGE_INTEGER, - WorkingSetLimit: ::SIZE_T, - Reserved2: ::SIZE_T, - Reserved3: ::SIZE_T, - Reserved4: ::SIZE_T, - Flags: ::DWORD, - CpuRateLimit: RATE_QUOTA_LIMIT, -}} -pub type PQUOTA_LIMITS_EX = *mut QUOTA_LIMITS_EX; -STRUCT!{struct IO_COUNTERS { - ReadOperationCount: ::ULONGLONG, - WriteOperationCount: ::ULONGLONG, - OtherOperationCount: ::ULONGLONG, - ReadTransferCount: ::ULONGLONG, - WriteTransferCount: ::ULONGLONG, - OtherTransferCount: ::ULONGLONG, -}} -pub type PIO_COUNTERS = *mut IO_COUNTERS; -//11192 -STRUCT!{struct JOBOBJECT_BASIC_LIMIT_INFORMATION { - PerProcessUserTimeLimit: ::LARGE_INTEGER, - PerJobUserTimeLimit: ::LARGE_INTEGER, - LimitFlags: ::DWORD, - MinimumWorkingSetSize: ::SIZE_T, - MaximumWorkingSetSize: ::SIZE_T, - ActiveProcessLimit: ::DWORD, - Affinity: ::ULONG_PTR, - PriorityClass: ::DWORD, - SchedulingClass: ::DWORD, -}} -pub type PJOBOBJECT_BASIC_LIMIT_INFORMATION = *mut JOBOBJECT_BASIC_LIMIT_INFORMATION; -STRUCT!{struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION { - BasicLimitInformation: JOBOBJECT_BASIC_LIMIT_INFORMATION, - IoInfo: IO_COUNTERS, - ProcessMemoryLimit: ::SIZE_T, - JobMemoryLimit: ::SIZE_T, - PeakProcessMemoryUsed: ::SIZE_T, - PeakJobMemoryUsed: ::SIZE_T, -}} -pub type PJOBOBJECT_EXTENDED_LIMIT_INFORMATION = *mut JOBOBJECT_EXTENDED_LIMIT_INFORMATION; -STRUCT!{struct JOBOBJECT_BASIC_PROCESS_ID_LIST { - NumberOfAssignedProcesses: ::DWORD, - NumberOfProcessIdsInList: ::DWORD, - ProcessIdList: [::ULONG_PTR; 0], -}} -//11712 -pub const JOB_OBJECT_TERMINATE_AT_END_OF_JOB: ::DWORD = 0; -pub const JOB_OBJECT_POST_AT_END_OF_JOB: ::DWORD = 1; -pub const JOB_OBJECT_MSG_END_OF_JOB_TIME: ::DWORD = 1; -pub const JOB_OBJECT_MSG_END_OF_PROCESS_TIME: ::DWORD = 2; -pub const JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT: ::DWORD = 3; -pub const JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO: ::DWORD = 4; -pub const JOB_OBJECT_MSG_NEW_PROCESS: ::DWORD = 6; -pub const JOB_OBJECT_MSG_EXIT_PROCESS: ::DWORD = 7; -pub const JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS: ::DWORD = 8; -pub const JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT: ::DWORD = 9; -pub const JOB_OBJECT_MSG_JOB_MEMORY_LIMIT: ::DWORD = 10; -pub const JOB_OBJECT_MSG_NOTIFICATION_LIMIT: ::DWORD = 11; -pub const JOB_OBJECT_MSG_JOB_CYCLE_TIME_LIMIT: ::DWORD = 12; -pub const JOB_OBJECT_MSG_MINIMUM: ::DWORD = 1; -pub const JOB_OBJECT_MSG_MAXIMUM: ::DWORD = 12; -pub const JOB_OBJECT_VALID_COMPLETION_FILTER: ::DWORD = ((1 << (JOB_OBJECT_MSG_MAXIMUM + 1)) - 1) - - ((1 << JOB_OBJECT_MSG_MINIMUM) - 1); -pub const JOB_OBJECT_LIMIT_WORKINGSET: ::DWORD = 0x00000001; -pub const JOB_OBJECT_LIMIT_PROCESS_TIME: ::DWORD = 0x00000002; -pub const JOB_OBJECT_LIMIT_JOB_TIME: ::DWORD = 0x00000004; -pub const JOB_OBJECT_LIMIT_ACTIVE_PROCESS: ::DWORD = 0x00000008; -pub const JOB_OBJECT_LIMIT_AFFINITY: ::DWORD = 0x00000010; -pub const JOB_OBJECT_LIMIT_PRIORITY_CLASS: ::DWORD = 0x00000020; -pub const JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME: ::DWORD = 0x00000040; -pub const JOB_OBJECT_LIMIT_SCHEDULING_CLASS: ::DWORD = 0x00000080; -pub const JOB_OBJECT_LIMIT_PROCESS_MEMORY: ::DWORD = 0x00000100; -pub const JOB_OBJECT_LIMIT_JOB_MEMORY: ::DWORD = 0x00000200; -pub const JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION: ::DWORD = 0x00000400; -pub const JOB_OBJECT_LIMIT_BREAKAWAY_OK: ::DWORD = 0x00000800; -pub const JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK: ::DWORD = 0x00001000; -pub const JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE: ::DWORD = 0x00002000; -pub const JOB_OBJECT_LIMIT_SUBSET_AFFINITY: ::DWORD = 0x00004000; -pub const JOB_OBJECT_LIMIT_JOB_READ_BYTES: ::DWORD = 0x00010000; -pub const JOB_OBJECT_LIMIT_JOB_WRITE_BYTES: ::DWORD = 0x00020000; -pub const JOB_OBJECT_LIMIT_RATE_CONTROL: ::DWORD = 0x00040000; -pub const JOB_OBJECT_LIMIT_RESERVED3: ::DWORD = 0x00008000; -pub const JOB_OBJECT_LIMIT_VALID_FLAGS: ::DWORD = 0x0007ffff; -pub const JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS: ::DWORD = 0x000000ff; -pub const JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS: ::DWORD = 0x00007fff; -pub const JOB_OBJECT_NOTIFICATION_LIMIT_VALID_FLAGS: ::DWORD = 0x00070204; -pub const JOB_OBJECT_RESERVED_LIMIT_VALID_FLAGS: ::DWORD = 0x0007ffff; -pub const JOB_OBJECT_UILIMIT_NONE: ::DWORD = 0x00000000; -pub const JOB_OBJECT_UILIMIT_HANDLES: ::DWORD = 0x00000001; -pub const JOB_OBJECT_UILIMIT_READCLIPBOARD: ::DWORD = 0x00000002; -pub const JOB_OBJECT_UILIMIT_WRITECLIPBOARD: ::DWORD = 0x00000004; -pub const JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS: ::DWORD = 0x00000008; -pub const JOB_OBJECT_UILIMIT_DISPLAYSETTINGS: ::DWORD = 0x00000010; -pub const JOB_OBJECT_UILIMIT_GLOBALATOMS: ::DWORD = 0x00000020; -pub const JOB_OBJECT_UILIMIT_DESKTOP: ::DWORD = 0x00000040; -pub const JOB_OBJECT_UILIMIT_EXITWINDOWS: ::DWORD = 0x00000080; -pub const JOB_OBJECT_UILIMIT_ALL: ::DWORD = 0x000000FF; -pub const JOB_OBJECT_UI_VALID_FLAGS: ::DWORD = 0x000000FF; -pub const JOB_OBJECT_SECURITY_NO_ADMIN: ::DWORD = 0x00000001; -pub const JOB_OBJECT_SECURITY_RESTRICTED_TOKEN: ::DWORD = 0x00000002; -pub const JOB_OBJECT_SECURITY_ONLY_TOKEN: ::DWORD = 0x00000004; -pub const JOB_OBJECT_SECURITY_FILTER_TOKENS: ::DWORD = 0x00000008; -pub const JOB_OBJECT_SECURITY_VALID_FLAGS: ::DWORD = 0x0000000f; -pub const JOB_OBJECT_CPU_RATE_CONTROL_ENABLE: ::DWORD = 0x1; -pub const JOB_OBJECT_CPU_RATE_CONTROL_WEIGHT_BASED: ::DWORD = 0x2; -pub const JOB_OBJECT_CPU_RATE_CONTROL_HARD_CAP: ::DWORD = 0x4; -pub const JOB_OBJECT_CPU_RATE_CONTROL_NOTIFY: ::DWORD = 0x8; -pub const JOB_OBJECT_CPU_RATE_CONTROL_VALID_FLAGS: ::DWORD = 0xf; -ENUM!{enum JOBOBJECTINFOCLASS { - JobObjectBasicAccountingInformation = 1, - JobObjectBasicLimitInformation, - JobObjectBasicProcessIdList, - JobObjectBasicUIRestrictions, - JobObjectSecurityLimitInformation, - JobObjectEndOfJobTimeInformation, - JobObjectAssociateCompletionPortInformation, - JobObjectBasicAndIoAccountingInformation, - JobObjectExtendedLimitInformation, - JobObjectJobSetInformation, - JobObjectGroupInformation, - JobObjectNotificationLimitInformation, - JobObjectLimitViolationInformation, - JobObjectGroupInformationEx, - JobObjectCpuRateControlInformation, - JobObjectCompletionFilter, - JobObjectCompletionCounter, - JobObjectReserved1Information = 18, - JobObjectReserved2Information, - JobObjectReserved3Information, - JobObjectReserved4Information, - JobObjectReserved5Information, - JobObjectReserved6Information, - JobObjectReserved7Information, - JobObjectReserved8Information, - JobObjectReserved9Information, - MaxJobObjectInfoClass, -}} -//12063 -pub const SECTION_QUERY: ::DWORD = 0x0001; -pub const SECTION_MAP_WRITE: ::DWORD = 0x0002; -pub const SECTION_MAP_READ: ::DWORD = 0x0004; -pub const SECTION_MAP_EXECUTE: ::DWORD = 0x0008; -pub const SECTION_EXTEND_SIZE: ::DWORD = 0x0010; -pub const SECTION_MAP_EXECUTE_EXPLICIT: ::DWORD = 0x0020; -pub const SECTION_ALL_ACCESS: ::DWORD = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY - | SECTION_MAP_WRITE | SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_EXTEND_SIZE; -//12100 -pub const PAGE_NOACCESS: ::DWORD = 0x01; -pub const PAGE_READONLY: ::DWORD = 0x02; -pub const PAGE_READWRITE: ::DWORD = 0x04; -pub const PAGE_WRITECOPY: ::DWORD = 0x08; -pub const PAGE_EXECUTE: ::DWORD = 0x10; -pub const PAGE_EXECUTE_READ: ::DWORD = 0x20; -pub const PAGE_EXECUTE_READWRITE: ::DWORD = 0x40; -pub const PAGE_EXECUTE_WRITECOPY: ::DWORD = 0x80; -pub const PAGE_GUARD: ::DWORD = 0x100; -pub const PAGE_NOCACHE: ::DWORD = 0x200; -pub const PAGE_WRITECOMBINE: ::DWORD = 0x400; -pub const PAGE_REVERT_TO_FILE_MAP: ::DWORD = 0x80000000; -pub const PAGE_TARGETS_NO_UPDATE: ::DWORD = 0x40000000; -pub const PAGE_TARGETS_INVALID: ::DWORD = 0x40000000; -pub const MEM_COMMIT: ::DWORD = 0x1000; -pub const MEM_RESERVE: ::DWORD = 0x2000; -pub const MEM_DECOMMIT: ::DWORD = 0x4000; -pub const MEM_RELEASE: ::DWORD = 0x8000; -pub const MEM_FREE: ::DWORD = 0x10000; -pub const MEM_PRIVATE: ::DWORD = 0x20000; -pub const MEM_MAPPED: ::DWORD = 0x40000; -pub const MEM_RESET: ::DWORD = 0x80000; -pub const MEM_TOP_DOWN: ::DWORD = 0x100000; -pub const MEM_WRITE_WATCH: ::DWORD = 0x200000; -pub const MEM_PHYSICAL: ::DWORD = 0x400000; -pub const MEM_ROTATE: ::DWORD = 0x800000; -pub const MEM_DIFFERENT_IMAGE_BASE_OK: ::DWORD = 0x800000; -pub const MEM_RESET_UNDO: ::DWORD = 0x1000000; -pub const MEM_LARGE_PAGES: ::DWORD = 0x20000000; -pub const MEM_4MB_PAGES: ::DWORD = 0x80000000; -pub const SEC_FILE: ::DWORD = 0x800000; -pub const SEC_IMAGE: ::DWORD = 0x1000000; -pub const SEC_PROTECTED_IMAGE: ::DWORD = 0x2000000; -pub const SEC_RESERVE: ::DWORD = 0x4000000; -pub const SEC_COMMIT: ::DWORD = 0x8000000; -pub const SEC_NOCACHE: ::DWORD = 0x10000000; -pub const SEC_WRITECOMBINE: ::DWORD = 0x40000000; -pub const SEC_LARGE_PAGES: ::DWORD = 0x80000000; -pub const SEC_IMAGE_NO_EXECUTE: ::DWORD = (SEC_IMAGE | SEC_NOCACHE); -pub const MEM_IMAGE: ::DWORD = SEC_IMAGE; -pub const WRITE_WATCH_FLAG_RESET: ::DWORD = 0x01; -pub const MEM_UNMAP_WITH_TRANSIENT_BOOST: ::DWORD = 0x01; -//12217 -pub const FILE_READ_DATA: ::DWORD = 0x0001; -pub const FILE_LIST_DIRECTORY: ::DWORD = 0x0001; -pub const FILE_WRITE_DATA: ::DWORD = 0x0002; -pub const FILE_ADD_FILE: ::DWORD = 0x0002; -pub const FILE_APPEND_DATA: ::DWORD = 0x0004; -pub const FILE_ADD_SUBDIRECTORY: ::DWORD = 0x0004; -pub const FILE_CREATE_PIPE_INSTANCE: ::DWORD = 0x0004; -pub const FILE_READ_EA: ::DWORD = 0x0008; -pub const FILE_WRITE_EA: ::DWORD = 0x0010; -pub const FILE_EXECUTE: ::DWORD = 0x0020; -pub const FILE_TRAVERSE: ::DWORD = 0x0020; -pub const FILE_DELETE_CHILD: ::DWORD = 0x0040; -pub const FILE_READ_ATTRIBUTES: ::DWORD = 0x0080; -pub const FILE_WRITE_ATTRIBUTES: ::DWORD = 0x0100; -pub const FILE_ALL_ACCESS: ::DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF; -pub const FILE_GENERIC_READ: ::DWORD = STANDARD_RIGHTS_READ | FILE_READ_DATA - | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE; -pub const FILE_GENERIC_WRITE: ::DWORD = STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA - | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE; -pub const FILE_GENERIC_EXECUTE: ::DWORD = STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES - | FILE_EXECUTE | SYNCHRONIZE; -pub const FILE_SHARE_READ: ::DWORD = 0x00000001; -pub const FILE_SHARE_WRITE: ::DWORD = 0x00000002; -pub const FILE_SHARE_DELETE: ::DWORD = 0x00000004; -pub const FILE_ATTRIBUTE_READONLY: ::DWORD = 0x00000001; -pub const FILE_ATTRIBUTE_HIDDEN: ::DWORD = 0x00000002; -pub const FILE_ATTRIBUTE_SYSTEM: ::DWORD = 0x00000004; -pub const FILE_ATTRIBUTE_DIRECTORY: ::DWORD = 0x00000010; -pub const FILE_ATTRIBUTE_ARCHIVE: ::DWORD = 0x00000020; -pub const FILE_ATTRIBUTE_DEVICE: ::DWORD = 0x00000040; -pub const FILE_ATTRIBUTE_NORMAL: ::DWORD = 0x00000080; -pub const FILE_ATTRIBUTE_TEMPORARY: ::DWORD = 0x00000100; -pub const FILE_ATTRIBUTE_SPARSE_FILE: ::DWORD = 0x00000200; -pub const FILE_ATTRIBUTE_REPARSE_POINT: ::DWORD = 0x00000400; -pub const FILE_ATTRIBUTE_COMPRESSED: ::DWORD = 0x00000800; -pub const FILE_ATTRIBUTE_OFFLINE: ::DWORD = 0x00001000; -pub const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: ::DWORD = 0x00002000; -pub const FILE_ATTRIBUTE_ENCRYPTED: ::DWORD = 0x00004000; -pub const FILE_ATTRIBUTE_INTEGRITY_STREAM: ::DWORD = 0x00008000; -pub const FILE_ATTRIBUTE_VIRTUAL: ::DWORD = 0x00010000; -pub const FILE_ATTRIBUTE_NO_SCRUB_DATA: ::DWORD = 0x00020000; -pub const FILE_ATTRIBUTE_EA: ::DWORD = 0x00040000; -pub const FILE_NOTIFY_CHANGE_FILE_NAME: ::DWORD = 0x00000001; -pub const FILE_NOTIFY_CHANGE_DIR_NAME: ::DWORD = 0x00000002; -pub const FILE_NOTIFY_CHANGE_ATTRIBUTES: ::DWORD = 0x00000004; -pub const FILE_NOTIFY_CHANGE_SIZE: ::DWORD = 0x00000008; -pub const FILE_NOTIFY_CHANGE_LAST_WRITE: ::DWORD = 0x00000010; -pub const FILE_NOTIFY_CHANGE_LAST_ACCESS: ::DWORD = 0x00000020; -pub const FILE_NOTIFY_CHANGE_CREATION: ::DWORD = 0x00000040; -pub const FILE_NOTIFY_CHANGE_SECURITY: ::DWORD = 0x00000100; -pub const FILE_ACTION_ADDED: ::DWORD = 0x00000001; -pub const FILE_ACTION_REMOVED: ::DWORD = 0x00000002; -pub const FILE_ACTION_MODIFIED: ::DWORD = 0x00000003; -pub const FILE_ACTION_RENAMED_OLD_NAME: ::DWORD = 0x00000004; -pub const FILE_ACTION_RENAMED_NEW_NAME: ::DWORD = 0x00000005; -pub const MAILSLOT_NO_MESSAGE: ::DWORD = 0xFFFFFFFF; -pub const MAILSLOT_WAIT_FOREVER: ::DWORD = 0xFFFFFFFF; -pub const FILE_CASE_SENSITIVE_SEARCH: ::DWORD = 0x00000001; -pub const FILE_CASE_PRESERVED_NAMES: ::DWORD = 0x00000002; -pub const FILE_UNICODE_ON_DISK: ::DWORD = 0x00000004; -pub const FILE_PERSISTENT_ACLS: ::DWORD = 0x00000008; -pub const FILE_FILE_COMPRESSION: ::DWORD = 0x00000010; -pub const FILE_VOLUME_QUOTAS: ::DWORD = 0x00000020; -pub const FILE_SUPPORTS_SPARSE_FILES: ::DWORD = 0x00000040; -pub const FILE_SUPPORTS_REPARSE_POINTS: ::DWORD = 0x00000080; -pub const FILE_SUPPORTS_REMOTE_STORAGE: ::DWORD = 0x00000100; -pub const FILE_VOLUME_IS_COMPRESSED: ::DWORD = 0x00008000; -pub const FILE_SUPPORTS_OBJECT_IDS: ::DWORD = 0x00010000; -pub const FILE_SUPPORTS_ENCRYPTION: ::DWORD = 0x00020000; -pub const FILE_NAMED_STREAMS: ::DWORD = 0x00040000; -pub const FILE_READ_ONLY_VOLUME: ::DWORD = 0x00080000; -pub const FILE_SEQUENTIAL_WRITE_ONCE: ::DWORD = 0x00100000; -pub const FILE_SUPPORTS_TRANSACTIONS: ::DWORD = 0x00200000; -pub const FILE_SUPPORTS_HARD_LINKS: ::DWORD = 0x00400000; -pub const FILE_SUPPORTS_EXTENDED_ATTRIBUTES: ::DWORD = 0x00800000; -pub const FILE_SUPPORTS_OPEN_BY_FILE_ID: ::DWORD = 0x01000000; -pub const FILE_SUPPORTS_USN_JOURNAL: ::DWORD = 0x02000000; -pub const FILE_SUPPORTS_INTEGRITY_STREAMS: ::DWORD = 0x04000000; -pub const FILE_INVALID_FILE_ID: ::LONGLONG = -1; -STRUCT!{struct FILE_ID_128 { - Identifier: [::BYTE; 16], -}} -pub type PFILE_ID_128 = *mut FILE_ID_128; -STRUCT!{struct FILE_NOTIFY_INFORMATION { - NextEntryOffset: ::DWORD, - Action: ::DWORD, - FileNameLength: ::DWORD, - FileName: [::WCHAR; 0], -}} -STRUCT!{struct FILE_SEGMENT_ELEMENT { - Buffer: ::PVOID64, - Alignment: ::ULONGLONG, -}} -pub type PFILE_SEGMENT_ELEMENT = *mut FILE_SEGMENT_ELEMENT; -//12475 -pub const IO_REPARSE_TAG_MOUNT_POINT: ::DWORD = 0xA0000003; -pub const IO_REPARSE_TAG_HSM: ::DWORD = 0xC0000004; -pub const IO_REPARSE_TAG_HSM2: ::DWORD = 0x80000006; -pub const IO_REPARSE_TAG_SIS: ::DWORD = 0x80000007; -pub const IO_REPARSE_TAG_WIM: ::DWORD = 0x80000008; -pub const IO_REPARSE_TAG_CSV: ::DWORD = 0x80000009; -pub const IO_REPARSE_TAG_DFS: ::DWORD = 0x8000000A; -pub const IO_REPARSE_TAG_SYMLINK: ::DWORD = 0xA000000C; -pub const IO_REPARSE_TAG_DFSR: ::DWORD = 0x80000012; -pub const IO_REPARSE_TAG_DEDUP: ::DWORD = 0x80000013; -pub const IO_REPARSE_TAG_NFS: ::DWORD = 0x80000014; -pub const IO_REPARSE_TAG_FILE_PLACEHOLDER: ::DWORD = 0x80000015; -pub const IO_REPARSE_TAG_WOF: ::DWORD = 0x80000017; -//12788 -pub const DUPLICATE_CLOSE_SOURCE: ::DWORD = 0x00000001; -pub const DUPLICATE_SAME_ACCESS: ::DWORD = 0x00000002; -//14708 -STRUCT!{struct PROCESSOR_POWER_POLICY_INFO { - TimeCheck: ::DWORD, - DemoteLimit: ::DWORD, - PromoteLimit: ::DWORD, - DemotePercent: ::BYTE, - PromotePercent: ::BYTE, - Spare: [::BYTE; 2], - Reserved: ::DWORD, -}} -BITFIELD!(PROCESSOR_POWER_POLICY_INFO Reserved: ::DWORD [ - AllowDemotion set_AllowDemotion[0..1], - AllowPromotion set_AllowPromotion[1..2], -]); -pub type PPROCESSOR_POWER_POLICY_INFO = *mut PROCESSOR_POWER_POLICY_INFO; -//15000 -STRUCT!{struct IMAGE_FILE_HEADER { - Machine: ::WORD, - NumberOfSections: ::WORD, - TimeDateStamp: ::DWORD, - PointerToSymbolTable: ::DWORD, - NumberOfSymbols: ::DWORD, - SizeOfOptionalHeader: ::WORD, - Characteristics: ::WORD, -}} -pub type PIMAGE_FILE_HEADER = *mut IMAGE_FILE_HEADER; -pub const IMAGE_SIZEOF_FILE_HEADER: usize = 20; -pub const IMAGE_FILE_RELOCS_STRIPPED: ::WORD = 0x0001; -pub const IMAGE_FILE_EXECUTABLE_IMAGE: ::WORD = 0x0002; -pub const IMAGE_FILE_LINE_NUMS_STRIPPED: ::WORD = 0x0004; -pub const IMAGE_FILE_LOCAL_SYMS_STRIPPED: ::WORD = 0x0008; -pub const IMAGE_FILE_AGGRESIVE_WS_TRIM: ::WORD = 0x0010; -pub const IMAGE_FILE_LARGE_ADDRESS_AWARE: ::WORD = 0x0020; -pub const IMAGE_FILE_BYTES_REVERSED_LO: ::WORD = 0x0080; -pub const IMAGE_FILE_32BIT_MACHINE: ::WORD = 0x0100; -pub const IMAGE_FILE_DEBUG_STRIPPED: ::WORD = 0x0200; -pub const IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP: ::WORD = 0x0400; -pub const IMAGE_FILE_NET_RUN_FROM_SWAP: ::WORD = 0x0800; -pub const IMAGE_FILE_SYSTEM: ::WORD = 0x1000; -pub const IMAGE_FILE_DLL: ::WORD = 0x2000; -pub const IMAGE_FILE_UP_SYSTEM_ONLY: ::WORD = 0x4000; -pub const IMAGE_FILE_BYTES_REVERSED_HI: ::WORD = 0x8000; -pub const IMAGE_FILE_MACHINE_UNKNOWN: ::WORD = 0; -pub const IMAGE_FILE_MACHINE_I386: ::WORD = 0x014c; -pub const IMAGE_FILE_MACHINE_R3000: ::WORD = 0x0162; -pub const IMAGE_FILE_MACHINE_R4000: ::WORD = 0x0166; -pub const IMAGE_FILE_MACHINE_R10000: ::WORD = 0x0168; -pub const IMAGE_FILE_MACHINE_WCEMIPSV2: ::WORD = 0x0169; -pub const IMAGE_FILE_MACHINE_ALPHA: ::WORD = 0x0184; -pub const IMAGE_FILE_MACHINE_SH3: ::WORD = 0x01a2; -pub const IMAGE_FILE_MACHINE_SH3DSP: ::WORD = 0x01a3; -pub const IMAGE_FILE_MACHINE_SH3E: ::WORD = 0x01a4; -pub const IMAGE_FILE_MACHINE_SH4: ::WORD = 0x01a6; -pub const IMAGE_FILE_MACHINE_SH5: ::WORD = 0x01a8; -pub const IMAGE_FILE_MACHINE_ARM: ::WORD = 0x01c0; -pub const IMAGE_FILE_MACHINE_THUMB: ::WORD = 0x01c2; -pub const IMAGE_FILE_MACHINE_ARMNT: ::WORD = 0x01c4; -pub const IMAGE_FILE_MACHINE_AM33: ::WORD = 0x01d3; -pub const IMAGE_FILE_MACHINE_POWERPC: ::WORD = 0x01F0; -pub const IMAGE_FILE_MACHINE_POWERPCFP: ::WORD = 0x01f1; -pub const IMAGE_FILE_MACHINE_IA64: ::WORD = 0x0200; -pub const IMAGE_FILE_MACHINE_MIPS16: ::WORD = 0x0266; -pub const IMAGE_FILE_MACHINE_ALPHA64: ::WORD = 0x0284; -pub const IMAGE_FILE_MACHINE_MIPSFPU: ::WORD = 0x0366; -pub const IMAGE_FILE_MACHINE_MIPSFPU16: ::WORD = 0x0466; -pub const IMAGE_FILE_MACHINE_AXP64: ::WORD = IMAGE_FILE_MACHINE_ALPHA64; -pub const IMAGE_FILE_MACHINE_TRICORE: ::WORD = 0x0520; -pub const IMAGE_FILE_MACHINE_CEF: ::WORD = 0x0CEF; -pub const IMAGE_FILE_MACHINE_EBC: ::WORD = 0x0EBC; -pub const IMAGE_FILE_MACHINE_AMD64: ::WORD = 0x8664; -pub const IMAGE_FILE_MACHINE_M32R: ::WORD = 0x9041; -pub const IMAGE_FILE_MACHINE_CEE: ::WORD = 0xC0EE; -STRUCT!{struct IMAGE_DATA_DIRECTORY { - VirtualAddress: ::DWORD, - Size: ::DWORD, -}} -pub type PIMAGE_DATA_DIRECTORY = *mut IMAGE_DATA_DIRECTORY; -pub const IMAGE_NUMBEROF_DIRECTORY_ENTRIES: usize = 16; -STRUCT!{struct IMAGE_OPTIONAL_HEADER32 { - Magic: ::WORD, - MajorLinkerVersion: ::BYTE, - MinorLinkerVersion: ::BYTE, - SizeOfCode: ::DWORD, - SizeOfInitializedData: ::DWORD, - SizeOfUninitializedData: ::DWORD, - AddressOfEntryPoint: ::DWORD, - BaseOfCode: ::DWORD, - BaseOfData: ::DWORD, - ImageBase: ::DWORD, - SectionAlignment: ::DWORD, - FileAlignment: ::DWORD, - MajorOperatingSystemVersion: ::WORD, - MinorOperatingSystemVersion: ::WORD, - MajorImageVersion: ::WORD, - MinorImageVersion: ::WORD, - MajorSubsystemVersion: ::WORD, - MinorSubsystemVersion: ::WORD, - Win32VersionValue: ::DWORD, - SizeOfImage: ::DWORD, - SizeOfHeaders: ::DWORD, - CheckSum: ::DWORD, - Subsystem: ::WORD, - DllCharacteristics: ::WORD, - SizeOfStackReserve: ::DWORD, - SizeOfStackCommit: ::DWORD, - SizeOfHeapReserve: ::DWORD, - SizeOfHeapCommit: ::DWORD, - LoaderFlags: ::DWORD, - NumberOfRvaAndSizes: ::DWORD, - DataDirectory: [IMAGE_DATA_DIRECTORY; IMAGE_NUMBEROF_DIRECTORY_ENTRIES], -}} -pub type PIMAGE_OPTIONAL_HEADER32 = *mut IMAGE_OPTIONAL_HEADER32; -STRUCT!{struct IMAGE_ROM_OPTIONAL_HEADER { - Magic: ::WORD, - MajorLinkerVersion: ::BYTE, - MinorLinkerVersion: ::BYTE, - SizeOfCode: ::DWORD, - SizeOfInitializedData: ::DWORD, - SizeOfUninitializedData: ::DWORD, - AddressOfEntryPoint: ::DWORD, - BaseOfCode: ::DWORD, - BaseOfData: ::DWORD, - BaseOfBss: ::DWORD, - GprMask: ::DWORD, - CprMask: [::DWORD; 4], - GpValue: ::DWORD, -}} -pub type PIMAGE_ROM_OPTIONAL_HEADER = *mut IMAGE_ROM_OPTIONAL_HEADER; -STRUCT!{struct IMAGE_OPTIONAL_HEADER64 { - Magic: ::WORD, - MajorLinkerVersion: ::BYTE, - MinorLinkerVersion: ::BYTE, - SizeOfCode: ::DWORD, - SizeOfInitializedData: ::DWORD, - SizeOfUninitializedData: ::DWORD, - AddressOfEntryPoint: ::DWORD, - BaseOfCode: ::DWORD, - ImageBase: ::ULONGLONG, - SectionAlignment: ::DWORD, - FileAlignment: ::DWORD, - MajorOperatingSystemVersion: ::WORD, - MinorOperatingSystemVersion: ::WORD, - MajorImageVersion: ::WORD, - MinorImageVersion: ::WORD, - MajorSubsystemVersion: ::WORD, - MinorSubsystemVersion: ::WORD, - Win32VersionValue: ::DWORD, - SizeOfImage: ::DWORD, - SizeOfHeaders: ::DWORD, - CheckSum: ::DWORD, - Subsystem: ::WORD, - DllCharacteristics: ::WORD, - SizeOfStackReserve: ULONGLONG, - SizeOfStackCommit: ULONGLONG, - SizeOfHeapReserve: ULONGLONG, - SizeOfHeapCommit: ULONGLONG, - LoaderFlags: ::DWORD, - NumberOfRvaAndSizes: ::DWORD, - DataDirectory: [IMAGE_DATA_DIRECTORY; IMAGE_NUMBEROF_DIRECTORY_ENTRIES], -}} -pub type PIMAGE_OPTIONAL_HEADER64 = *mut IMAGE_OPTIONAL_HEADER64; -pub const IMAGE_NT_OPTIONAL_HDR32_MAGIC: ::WORD = 0x10b; -pub const IMAGE_NT_OPTIONAL_HDR64_MAGIC: ::WORD = 0x20b; -pub const IMAGE_ROM_OPTIONAL_HDR_MAGIC: ::WORD = 0x107; -#[cfg(target_arch = "x86_64")] -pub type IMAGE_OPTIONAL_HEADER = IMAGE_OPTIONAL_HEADER64; -#[cfg(target_arch = "x86_64")] -pub type PIMAGE_OPTIONAL_HEADER = PIMAGE_OPTIONAL_HEADER64; -#[cfg(target_arch = "x86")] -pub type IMAGE_OPTIONAL_HEADER = IMAGE_OPTIONAL_HEADER32; -#[cfg(target_arch = "x86")] -pub type PIMAGE_OPTIONAL_HEADER = PIMAGE_OPTIONAL_HEADER32; -STRUCT!{struct IMAGE_NT_HEADERS64 { - Signature: ::DWORD, - FileHeader: IMAGE_FILE_HEADER, - OptionalHeader: IMAGE_OPTIONAL_HEADER64, -}} -pub type PIMAGE_NT_HEADERS64 = *mut IMAGE_NT_HEADERS64; -STRUCT!{struct IMAGE_NT_HEADERS32 { - Signature: ::DWORD, - FileHeader: IMAGE_FILE_HEADER, - OptionalHeader: IMAGE_OPTIONAL_HEADER32, -}} -pub type PIMAGE_NT_HEADERS32 = *mut IMAGE_NT_HEADERS32; -STRUCT!{struct IMAGE_ROM_HEADERS { - FileHeader: IMAGE_FILE_HEADER, - OptionalHeader: IMAGE_ROM_OPTIONAL_HEADER, -}} -pub type PIMAGE_ROM_HEADERS = *mut IMAGE_ROM_HEADERS; -#[cfg(target_arch = "x86_64")] -pub type IMAGE_NT_HEADERS = IMAGE_NT_HEADERS64; -#[cfg(target_arch = "x86_64")] -pub type PIMAGE_NT_HEADERS = PIMAGE_NT_HEADERS64; -#[cfg(target_arch = "x86")] -pub type IMAGE_NT_HEADERS = IMAGE_NT_HEADERS32; -#[cfg(target_arch = "x86")] -pub type PIMAGE_NT_HEADERS = PIMAGE_NT_HEADERS32; -pub const IMAGE_SUBSYSTEM_UNKNOWN: ::WORD = 0; -pub const IMAGE_SUBSYSTEM_NATIVE: ::WORD = 1; -pub const IMAGE_SUBSYSTEM_WINDOWS_GUI: ::WORD = 2; -pub const IMAGE_SUBSYSTEM_WINDOWS_CUI: ::WORD = 3; -pub const IMAGE_SUBSYSTEM_OS2_CUI: ::WORD = 5; -pub const IMAGE_SUBSYSTEM_POSIX_CUI: ::WORD = 7; -pub const IMAGE_SUBSYSTEM_NATIVE_WINDOWS: ::WORD = 8; -pub const IMAGE_SUBSYSTEM_WINDOWS_CE_GUI: ::WORD = 9; -pub const IMAGE_SUBSYSTEM_EFI_APPLICATION: ::WORD = 10; -pub const IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER: ::WORD = 11; -pub const IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER: ::WORD = 12; -pub const IMAGE_SUBSYSTEM_EFI_ROM: ::WORD = 13; -pub const IMAGE_SUBSYSTEM_XBOX: ::WORD = 14; -pub const IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION: ::WORD = 16; -pub const IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA: ::WORD = 0x0020; -pub const IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE: ::WORD = 0x0040; -pub const IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY: ::WORD = 0x0080; -pub const IMAGE_DLLCHARACTERISTICS_NX_COMPAT: ::WORD = 0x0100; -pub const IMAGE_DLLCHARACTERISTICS_NO_ISOLATION: ::WORD = 0x0200; -pub const IMAGE_DLLCHARACTERISTICS_NO_SEH: ::WORD = 0x0400; -pub const IMAGE_DLLCHARACTERISTICS_NO_BIND: ::WORD = 0x0800; -pub const IMAGE_DLLCHARACTERISTICS_APPCONTAINER: ::WORD = 0x1000; -pub const IMAGE_DLLCHARACTERISTICS_WDM_DRIVER: ::WORD = 0x2000; -pub const IMAGE_DLLCHARACTERISTICS_GUARD_CF: ::WORD = 0x4000; -pub const IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE: ::WORD = 0x8000; -pub const IMAGE_DIRECTORY_ENTRY_EXPORT: ::WORD = 0; -pub const IMAGE_DIRECTORY_ENTRY_IMPORT: ::WORD = 1; -pub const IMAGE_DIRECTORY_ENTRY_RESOURCE: ::WORD = 2; -pub const IMAGE_DIRECTORY_ENTRY_EXCEPTION: ::WORD = 3; -pub const IMAGE_DIRECTORY_ENTRY_SECURITY: ::WORD = 4; -pub const IMAGE_DIRECTORY_ENTRY_BASERELOC: ::WORD = 5; -pub const IMAGE_DIRECTORY_ENTRY_DEBUG: ::WORD = 6; -pub const IMAGE_DIRECTORY_ENTRY_ARCHITECTURE: ::WORD = 7; -pub const IMAGE_DIRECTORY_ENTRY_GLOBALPTR: ::WORD = 8; -pub const IMAGE_DIRECTORY_ENTRY_TLS: ::WORD = 9; -pub const IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG: ::WORD = 10; -pub const IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT: ::WORD = 11; -pub const IMAGE_DIRECTORY_ENTRY_IAT: ::WORD = 12; -pub const IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT: ::WORD = 13; -pub const IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR: ::WORD = 14; -STRUCT!{struct ANON_OBJECT_HEADER { - Sig1: ::WORD, - Sig2: ::WORD, - Version: ::WORD, - Machine: ::WORD, - TimeDateStamp: ::DWORD, - ClassID: ::CLSID, - SizeOfData: ::DWORD, -}} -STRUCT!{struct ANON_OBJECT_HEADER_V2 { - Sig1: ::WORD, - Sig2: ::WORD, - Version: ::WORD, - Machine: ::WORD, - TimeDateStamp: ::DWORD, - ClassID: ::CLSID, - SizeOfData: ::DWORD, - Flags: ::DWORD, - MetaDataSize: ::DWORD, - MetaDataOffset: ::DWORD, -}} -STRUCT!{struct ANON_OBJECT_HEADER_BIGOBJ { - Sig1: ::WORD, - Sig2: ::WORD, - Version: ::WORD, - Machine: ::WORD, - TimeDateStamp: ::DWORD, - ClassID: ::CLSID, - SizeOfData: ::DWORD, - Flags: ::DWORD, - MetaDataSize: ::DWORD, - MetaDataOffset: ::DWORD, - NumberOfSections: ::DWORD, - PointerToSymbolTable: ::DWORD, - NumberOfSymbols: ::DWORD, -}} -pub const IMAGE_SIZEOF_SHORT_NAME: usize = 8; -STRUCT!{struct IMAGE_SECTION_HEADER { - Name: [::BYTE; IMAGE_SIZEOF_SHORT_NAME], - PhysicalAddressOrVirtualSize: ::DWORD, - VirtualAddress: ::DWORD, - SizeOfRawData: ::DWORD, - PointerToRawData: ::DWORD, - PointerToRelocations: ::DWORD, - PointerToLinenumbers: ::DWORD, - NumberOfRelocations: ::WORD, - NumberOfLinenumbers: ::WORD, - Characteristics: ::DWORD, -}} -pub type PIMAGE_SECTION_HEADER = *mut IMAGE_SECTION_HEADER; -pub const IMAGE_SIZEOF_SECTION_HEADER: usize = 40; -pub const IMAGE_SCN_TYPE_NO_PAD: ::DWORD = 0x00000008; -pub const IMAGE_SCN_CNT_CODE: ::DWORD = 0x00000020; -pub const IMAGE_SCN_CNT_INITIALIZED_DATA: ::DWORD = 0x00000040; -pub const IMAGE_SCN_CNT_UNINITIALIZED_DATA: ::DWORD = 0x00000080; -pub const IMAGE_SCN_LNK_OTHER: ::DWORD = 0x00000100; -pub const IMAGE_SCN_LNK_INFO: ::DWORD = 0x00000200; -pub const IMAGE_SCN_LNK_REMOVE: ::DWORD = 0x00000800; -pub const IMAGE_SCN_LNK_COMDAT: ::DWORD = 0x00001000; -pub const IMAGE_SCN_NO_DEFER_SPEC_EXC: ::DWORD = 0x00004000; -pub const IMAGE_SCN_GPREL: ::DWORD = 0x00008000; -pub const IMAGE_SCN_MEM_FARDATA: ::DWORD = 0x00008000; -pub const IMAGE_SCN_MEM_PURGEABLE: ::DWORD = 0x00020000; -pub const IMAGE_SCN_MEM_16BIT: ::DWORD = 0x00020000; -pub const IMAGE_SCN_MEM_LOCKED: ::DWORD = 0x00040000; -pub const IMAGE_SCN_MEM_PRELOAD: ::DWORD = 0x00080000; -pub const IMAGE_SCN_ALIGN_1BYTES: ::DWORD = 0x00100000; -pub const IMAGE_SCN_ALIGN_2BYTES: ::DWORD = 0x00200000; -pub const IMAGE_SCN_ALIGN_4BYTES: ::DWORD = 0x00300000; -pub const IMAGE_SCN_ALIGN_8BYTES: ::DWORD = 0x00400000; -pub const IMAGE_SCN_ALIGN_16BYTES: ::DWORD = 0x00500000; -pub const IMAGE_SCN_ALIGN_32BYTES: ::DWORD = 0x00600000; -pub const IMAGE_SCN_ALIGN_64BYTES: ::DWORD = 0x00700000; -pub const IMAGE_SCN_ALIGN_128BYTES: ::DWORD = 0x00800000; -pub const IMAGE_SCN_ALIGN_256BYTES: ::DWORD = 0x00900000; -pub const IMAGE_SCN_ALIGN_512BYTES: ::DWORD = 0x00A00000; -pub const IMAGE_SCN_ALIGN_1024BYTES: ::DWORD = 0x00B00000; -pub const IMAGE_SCN_ALIGN_2048BYTES: ::DWORD = 0x00C00000; -pub const IMAGE_SCN_ALIGN_4096BYTES: ::DWORD = 0x00D00000; -pub const IMAGE_SCN_ALIGN_8192BYTES: ::DWORD = 0x00E00000; -pub const IMAGE_SCN_ALIGN_MASK: ::DWORD = 0x00F00000; -pub const IMAGE_SCN_LNK_NRELOC_OVFL: ::DWORD = 0x01000000; -pub const IMAGE_SCN_MEM_DISCARDABLE: ::DWORD = 0x02000000; -pub const IMAGE_SCN_MEM_NOT_CACHED: ::DWORD = 0x04000000; -pub const IMAGE_SCN_MEM_NOT_PAGED: ::DWORD = 0x08000000; -pub const IMAGE_SCN_MEM_SHARED: ::DWORD = 0x10000000; -pub const IMAGE_SCN_MEM_EXECUTE: ::DWORD = 0x20000000; -pub const IMAGE_SCN_MEM_READ: ::DWORD = 0x40000000; -pub const IMAGE_SCN_MEM_WRITE: ::DWORD = 0x80000000; -pub const IMAGE_SCN_SCALE_INDEX: ::DWORD = 0x00000001; -//16590 -STRUCT!{struct IMAGE_DEBUG_DIRECTORY { - Characteristics: ::DWORD, - TimeDateStamp: ::DWORD, - MajorVersion: ::WORD, - MinorVersion: ::WORD, - Type: ::DWORD, - SizeOfData: ::DWORD, - AddressOfRawData: ::DWORD, - PointerToRawData: ::DWORD, -}} -pub type PIMAGE_DEBUG_DIRECTORY = *mut IMAGE_DEBUG_DIRECTORY; -pub const IMAGE_DEBUG_TYPE_UNKNOWN: ::DWORD = 0; -pub const IMAGE_DEBUG_TYPE_COFF: ::DWORD = 1; -pub const IMAGE_DEBUG_TYPE_CODEVIEW: ::DWORD = 2; -pub const IMAGE_DEBUG_TYPE_FPO: ::DWORD = 3; -pub const IMAGE_DEBUG_TYPE_MISC: ::DWORD = 4; -pub const IMAGE_DEBUG_TYPE_EXCEPTION: ::DWORD = 5; -pub const IMAGE_DEBUG_TYPE_FIXUP: ::DWORD = 6; -pub const IMAGE_DEBUG_TYPE_OMAP_TO_SRC: ::DWORD = 7; -pub const IMAGE_DEBUG_TYPE_OMAP_FROM_SRC: ::DWORD = 8; -pub const IMAGE_DEBUG_TYPE_BORLAND: ::DWORD = 9; -pub const IMAGE_DEBUG_TYPE_RESERVED10: ::DWORD = 10; -pub const IMAGE_DEBUG_TYPE_CLSID: ::DWORD = 11; -STRUCT!{struct IMAGE_COFF_SYMBOLS_HEADER { - NumberOfSymbols: ::DWORD, - LvaToFirstSymbol: ::DWORD, - NumberOfLinenumbers: ::DWORD, - LvaToFirstLinenumber: ::DWORD, - RvaToFirstByteOfCode: ::DWORD, - RvaToLastByteOfCode: ::DWORD, - RvaToFirstByteOfData: ::DWORD, - RvaToLastByteOfData: ::DWORD, -}} -pub type PIMAGE_COFF_SYMBOLS_HEADER = *mut IMAGE_COFF_SYMBOLS_HEADER; -STRUCT!{struct IMAGE_RUNTIME_FUNCTION_ENTRY { - BeginAddress: ::DWORD, - EndAddress: ::DWORD, - UnwindInfoAddress: ::DWORD, -}} -UNION!(IMAGE_RUNTIME_FUNCTION_ENTRY, UnwindInfoAddress, UnwindData, UnwindData_mut, ::DWORD); -pub type PIMAGE_RUNTIME_FUNCTION_ENTRY = *mut IMAGE_RUNTIME_FUNCTION_ENTRY; -pub const FRAME_FPO: ::WORD = 0; -pub const FRAME_TRAP: ::WORD = 1; -pub const FRAME_TSS: ::WORD = 2; -pub const FRAME_NONFPO: ::WORD = 3; -STRUCT!{struct FPO_DATA { - ulOffStart: ::DWORD, - cbProcSize: ::DWORD, - cdwLocals: ::DWORD, - cdwParams: ::WORD, - bitfield: ::WORD, -}} -pub type PFPO_DATA = *mut FPO_DATA; -pub const SIZEOF_RFPO_DATA: usize = 16; -pub const IMAGE_DEBUG_MISC_EXENAME: ::DWORD = 1; -STRUCT!{struct IMAGE_DEBUG_MISC { - DataType: ::DWORD, - Length: ::DWORD, - Unicode: ::BOOLEAN, - Reserved: [::BYTE; 3], - Data: [::BYTE; 0], -}} -pub type PIMAGE_DEBUG_MISC = *mut IMAGE_DEBUG_MISC; -STRUCT!{struct IMAGE_FUNCTION_ENTRY { - StartingAddress: ::DWORD, - EndingAddress: ::DWORD, - EndOfPrologue: ::DWORD, -}} -pub type PIMAGE_FUNCTION_ENTRY = *mut IMAGE_FUNCTION_ENTRY; -STRUCT!{struct IMAGE_FUNCTION_ENTRY64 { - StartingAddress: ::ULONGLONG, - EndingAddress: ::ULONGLONG, - EndOfPrologueOrUnwindInfoAddress: ::ULONGLONG, -}} -pub type PIMAGE_FUNCTION_ENTRY64 = *mut IMAGE_FUNCTION_ENTRY64; -//18245 -pub const HEAP_NO_SERIALIZE: ::DWORD = 0x00000001; -pub const HEAP_GROWABLE: ::DWORD = 0x00000002; -pub const HEAP_GENERATE_EXCEPTIONS: ::DWORD = 0x00000004; -pub const HEAP_ZERO_MEMORY: ::DWORD = 0x00000008; -pub const HEAP_REALLOC_IN_PLACE_ONLY: ::DWORD = 0x00000010; -pub const HEAP_TAIL_CHECKING_ENABLED: ::DWORD = 0x00000020; -pub const HEAP_FREE_CHECKING_ENABLED: ::DWORD = 0x00000040; -pub const HEAP_DISABLE_COALESCE_ON_FREE: ::DWORD = 0x00000080; -pub const HEAP_CREATE_ALIGN_16: ::DWORD = 0x00010000; -pub const HEAP_CREATE_ENABLE_TRACING: ::DWORD = 0x00020000; -pub const HEAP_CREATE_ENABLE_EXECUTE: ::DWORD = 0x00040000; -pub const HEAP_MAXIMUM_TAG: ::DWORD = 0x0FFF; -pub const HEAP_PSEUDO_TAG_FLAG: ::DWORD = 0x8000; -pub const HEAP_TAG_SHIFT: ::DWORD = 18; -//18145 -STRUCT!{struct RTL_CRITICAL_SECTION_DEBUG { - Type: ::WORD, - CreatorBackTraceIndex: ::WORD, - CriticalSection: *mut ::RTL_CRITICAL_SECTION, - ProcessLocksList: ::LIST_ENTRY, - EntryCount: ::DWORD, - ContentionCount: ::DWORD, - Flags: ::DWORD, - CreatorBackTraceIndexHigh: ::WORD, - SpareWORD: ::WORD, -}} -pub type PRTL_CRITICAL_SECTION_DEBUG = *mut RTL_CRITICAL_SECTION_DEBUG; -pub type RTL_RESOURCE_DEBUG = RTL_CRITICAL_SECTION_DEBUG; -pub type PRTL_RESOURCE_DEBUG = *mut RTL_CRITICAL_SECTION_DEBUG; -pub const RTL_CRITSECT_TYPE: ::WORD = 0; -pub const RTL_RESOURCE_TYPE: ::WORD = 1; -pub const RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO: ::ULONG_PTR = 0x01000000; -pub const RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN: ::ULONG_PTR = 0x02000000; -pub const RTL_CRITICAL_SECTION_FLAG_STATIC_INIT: ::ULONG_PTR = 0x04000000; -pub const RTL_CRITICAL_SECTION_FLAG_RESOURCE_TYPE: ::ULONG_PTR = 0x08000000; -pub const RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO: ::ULONG_PTR = 0x10000000; -pub const RTL_CRITICAL_SECTION_ALL_FLAG_BITS: ::ULONG_PTR = 0xFF000000; -pub const RTL_CRITICAL_SECTION_FLAG_RESERVED: ::ULONG_PTR = RTL_CRITICAL_SECTION_ALL_FLAG_BITS & !(RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO | RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN | RTL_CRITICAL_SECTION_FLAG_STATIC_INIT | RTL_CRITICAL_SECTION_FLAG_RESOURCE_TYPE | RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO); -pub const RTL_CRITICAL_SECTION_DEBUG_FLAG_STATIC_INIT: ::DWORD = 0x00000001; -STRUCT!{struct RTL_CRITICAL_SECTION { - DebugInfo: ::PRTL_CRITICAL_SECTION_DEBUG, - LockCount: ::LONG, - RecursionCount: ::LONG, - OwningThread: ::HANDLE, - LockSemaphore: ::HANDLE, - SpinCount: ::ULONG_PTR, -}} -pub type PRTL_CRITICAL_SECTION = *mut RTL_CRITICAL_SECTION; -STRUCT!{struct RTL_SRWLOCK { - Ptr: ::PVOID, -}} -pub type PRTL_SRWLOCK = *mut RTL_SRWLOCK; -pub const RTL_SRWLOCK_INIT: RTL_SRWLOCK = RTL_SRWLOCK { Ptr: 0 as PVOID }; -STRUCT!{struct RTL_CONDITION_VARIABLE { - Ptr: ::PVOID, -}} -pub type PRTL_CONDITION_VARIABLE = *mut RTL_CONDITION_VARIABLE; -pub const RTL_CONDITION_VARIABLE_INIT: RTL_CONDITION_VARIABLE = RTL_CONDITION_VARIABLE { - Ptr: 0 as PVOID -}; -//18204 -pub type PAPCFUNC = Option; -pub type PVECTORED_EXCEPTION_HANDLER = Option ::LONG>; -ENUM!{enum HEAP_INFORMATION_CLASS { - HeapCompatibilityInformation = 0, - HeapEnableTerminationOnCorruption = 1, - HeapOptimizeResources = 3, -}} -//pub use self::HEAP_INFORMATION_CLASS::*; -pub const HEAP_OPTIMIZE_RESOURCES_CURRENT_VERSION: ::DWORD = 1; -STRUCT!{struct HEAP_OPTIMIZE_RESOURCES_INFORMATION { - Version: ::DWORD, - Flags: ::DWORD, -}} -pub type PHEAP_OPTIMIZE_RESOURCES_INFORMATION = *mut HEAP_OPTIMIZE_RESOURCES_INFORMATION; -pub const WT_EXECUTEDEFAULT: ::ULONG = 0x00000000; -pub const WT_EXECUTEINIOTHREAD: ::ULONG = 0x00000001; -pub const WT_EXECUTEINUITHREAD: ::ULONG = 0x00000002; -pub const WT_EXECUTEINWAITTHREAD: ::ULONG = 0x00000004; -pub const WT_EXECUTEONLYONCE: ::ULONG = 0x00000008; -pub const WT_EXECUTEINTIMERTHREAD: ::ULONG = 0x00000020; -pub const WT_EXECUTELONGFUNCTION: ::ULONG = 0x00000010; -pub const WT_EXECUTEINPERSISTENTIOTHREAD: ::ULONG = 0x00000040; -pub const WT_EXECUTEINPERSISTENTTHREAD: ::ULONG = 0x00000080; -pub const WT_TRANSFER_IMPERSONATION: ::ULONG = 0x00000100; -pub type WAITORTIMERCALLBACKFUNC = Option; -pub type WORKERCALLBACKFUNC = Option; -pub type APC_CALLBACK_FUNCTION = Option; -pub type WAITORTIMERCALLBACK = WAITORTIMERCALLBACKFUNC; -pub type PFLS_CALLBACK_FUNCTION = Option; -pub type PSECURE_MEMORY_CACHE_CALLBACK = Option ::BOOLEAN>; -pub const WT_EXECUTEINLONGTHREAD: ::ULONG = 0x00000010; -pub const WT_EXECUTEDELETEWAIT: ::ULONG = 0x00000008; -//18570 -pub const KEY_QUERY_VALUE: ::REGSAM = 0x0001; -pub const KEY_SET_VALUE: ::REGSAM = 0x0002; -pub const KEY_CREATE_SUB_KEY: ::REGSAM = 0x0004; -pub const KEY_ENUMERATE_SUB_KEYS: ::REGSAM = 0x0008; -pub const KEY_NOTIFY: ::REGSAM = 0x0010; -pub const KEY_CREATE_LINK: ::REGSAM = 0x0020; -pub const KEY_WOW64_32KEY: ::REGSAM = 0x0200; -pub const KEY_WOW64_64KEY: ::REGSAM = 0x0100; -pub const KEY_WOW64_RES: ::REGSAM = 0x0300; -pub const KEY_READ: ::REGSAM = ( - STANDARD_RIGHTS_READ | - KEY_QUERY_VALUE | - KEY_ENUMERATE_SUB_KEYS | - KEY_NOTIFY - ) & (!SYNCHRONIZE); -pub const KEY_WRITE: ::REGSAM = (STANDARD_RIGHTS_WRITE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY) & (!SYNCHRONIZE); -pub const KEY_EXECUTE: ::REGSAM = KEY_READ & (!SYNCHRONIZE); -pub const KEY_ALL_ACCESS: ::REGSAM = ( - STANDARD_RIGHTS_ALL | - KEY_QUERY_VALUE | - KEY_SET_VALUE | - KEY_CREATE_SUB_KEY | - KEY_ENUMERATE_SUB_KEYS | - KEY_NOTIFY | - KEY_CREATE_LINK - ) & (!SYNCHRONIZE); -pub const REG_CREATED_NEW_KEY: ::DWORD = 0x00000001; -pub const REG_OPENED_EXISTING_KEY: ::DWORD = 0x00000002; -pub const REG_NOTIFY_CHANGE_NAME: ::DWORD = 0x00000001; -pub const REG_NOTIFY_CHANGE_ATTRIBUTES: ::DWORD = 0x00000002; -pub const REG_NOTIFY_CHANGE_LAST_SET: ::DWORD = 0x00000004; -pub const REG_NOTIFY_CHANGE_SECURITY: ::DWORD = 0x00000008; -pub const REG_LEGAL_CHANGE_FILTER: ::DWORD = REG_NOTIFY_CHANGE_NAME | - REG_NOTIFY_CHANGE_ATTRIBUTES | - REG_NOTIFY_CHANGE_LAST_SET | - REG_NOTIFY_CHANGE_SECURITY; -pub const REG_NOTIFY_THREAD_AGNOSTIC: ::DWORD = 0x10000000; //supported only on Windows 8 and later -pub const REG_OPTION_RESERVED: ::DWORD = 0x00000000; -pub const REG_OPTION_NON_VOLATILE: ::DWORD = 0x00000000; -pub const REG_OPTION_VOLATILE: ::DWORD = 0x00000001; -pub const REG_OPTION_CREATE_LINK: ::DWORD = 0x00000002; -pub const REG_OPTION_BACKUP_RESTORE: ::DWORD = 0x00000004; -pub const REG_OPTION_OPEN_LINK: ::DWORD = 0x00000008; -pub const REG_NONE: ::DWORD = 0; -pub const REG_SZ: ::DWORD = 1; -pub const REG_EXPAND_SZ: ::DWORD = 2; -pub const REG_BINARY: ::DWORD = 3; -pub const REG_DWORD: ::DWORD = 4; -pub const REG_DWORD_LITTLE_ENDIAN: ::DWORD = 4; -pub const REG_DWORD_BIG_ENDIAN: ::DWORD = 5; -pub const REG_LINK: ::DWORD = 6; -pub const REG_MULTI_SZ: ::DWORD = 7; -pub const REG_RESOURCE_LIST: ::DWORD = 8; -pub const REG_FULL_RESOURCE_DESCRIPTOR: ::DWORD = 9; -pub const REG_RESOURCE_REQUIREMENTS_LIST: ::DWORD = 10; -pub const REG_QWORD: ::DWORD = 11; -pub const REG_QWORD_LITTLE_ENDIAN: ::DWORD = 11; -//18720 -pub const SERVICE_KERNEL_DRIVER: ::DWORD = 0x00000001; -pub const SERVICE_FILE_SYSTEM_DRIVER: ::DWORD = 0x00000002; -pub const SERVICE_ADAPTER: ::DWORD = 0x00000004; -pub const SERVICE_RECOGNIZER_DRIVER: ::DWORD = 0x00000008; -pub const SERVICE_DRIVER: ::DWORD = SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER - | SERVICE_RECOGNIZER_DRIVER; -pub const SERVICE_WIN32_OWN_PROCESS: ::DWORD = 0x00000010; -pub const SERVICE_WIN32_SHARE_PROCESS: ::DWORD = 0x00000020; -pub const SERVICE_WIN32: ::DWORD = SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS; -pub const SERVICE_INTERACTIVE_PROCESS: ::DWORD = 0x00000100; -pub const SERVICE_TYPE_ALL: ::DWORD = SERVICE_WIN32 | SERVICE_ADAPTER | SERVICE_DRIVER - | SERVICE_INTERACTIVE_PROCESS; -STRUCT!{struct TP_CALLBACK_INSTANCE { - dummy: *mut ::c_void, -}} -pub type PTP_CALLBACK_INSTANCE = *mut TP_CALLBACK_INSTANCE; -STRUCT!{struct TP_IO { - dummy: *mut ::c_void, -}} -pub type PTP_IO = *mut TP_IO; -STRUCT!{struct TP_POOL { - dummy: *mut ::c_void, -}} -pub type PTP_POOL = *mut TP_POOL; -STRUCT!{struct TP_CLEANUP_GROUP { - dummy: *mut ::c_void, -}} -pub type PTP_CLEANUP_GROUP = *mut TP_CLEANUP_GROUP; -STRUCT!{struct TP_TIMER { - dummy: *mut ::c_void, -}} -pub type PTP_TIMER = *mut TP_TIMER; -STRUCT!{struct TP_WAIT { - dummy: *mut ::c_void, -}} -pub type PTP_WAIT = *mut TP_WAIT; -STRUCT!{struct TP_WORK { - dummy: *mut ::c_void, -}} -pub type PTP_WORK = *mut TP_WORK; -STRUCT!{struct ACTIVATION_CONTEXT { - dummy: *mut ::c_void, -}} -ENUM!{enum TP_CALLBACK_PRIORITY { - TP_CALLBACK_PRIORITY_HIGH, - TP_CALLBACK_PRIORITY_NORMAL, - TP_CALLBACK_PRIORITY_LOW, - TP_CALLBACK_PRIORITY_INVALID, - TP_CALLBACK_PRIORITY_COUNT = 4, -}} -pub type PTP_CLEANUP_GROUP_CANCEL_CALLBACK = Option; -pub type PTP_SIMPLE_CALLBACK = Option; -pub type PTP_WORK_CALLBACK = Option; -pub type PTP_TIMER_CALLBACK = Option; -pub type TP_WAIT_RESULT = ::DWORD; -pub type PTP_WAIT_CALLBACK = Option; -pub type TP_VERSION = ::DWORD; -pub type PTP_VERSION = *mut ::DWORD; -STRUCT!{struct TP_POOL_STACK_INFORMATION { - StackReserve: ::SIZE_T, - StackCommit: ::SIZE_T, -}} -pub type PTP_POOL_STACK_INFORMATION = *mut TP_POOL_STACK_INFORMATION; -STRUCT!{struct TP_CALLBACK_ENVIRON_V3_s { - BitFields: ::DWORD, -}} -BITFIELD!(TP_CALLBACK_ENVIRON_V3_s BitFields: ::DWORD [ - LongFunction set_LongFunction[0..1], - Persistent set_Persistent[1..2], - Private set_Private[2..32], -]); -STRUCT!{nodebug struct TP_CALLBACK_ENVIRON_V3 { - Version: TP_VERSION, - Pool: PTP_POOL, - CleanupGroup: PTP_CLEANUP_GROUP, - CleanupGroupCancelCallback: PTP_CLEANUP_GROUP_CANCEL_CALLBACK, - RaceDll: ::PVOID, - ActivationContext: *mut ACTIVATION_CONTEXT, - FinalizationCallback: PTP_SIMPLE_CALLBACK, - u: ::DWORD, - CallbackPriority: TP_CALLBACK_PRIORITY, - Size: ::DWORD, -}} -UNION!(TP_CALLBACK_ENVIRON_V3, u, Flags, Flags_mut, ::DWORD); -UNION!(TP_CALLBACK_ENVIRON_V3, u, s, s_mut, TP_CALLBACK_ENVIRON_V3_s); -pub type TP_CALLBACK_ENVIRON = TP_CALLBACK_ENVIRON_V3; -pub type PTP_CALLBACK_ENVIRON = *mut TP_CALLBACK_ENVIRON_V3; -STRUCT!{struct JOB_SET_ARRAY { - JobHandle: ::HANDLE, - MemberLevel: ::DWORD, - Flags: ::DWORD, -}} -pub type PJOB_SET_ARRAY = *mut JOB_SET_ARRAY; -STRUCT!{struct RTL_BARRIER { - Reserved1: ::DWORD, - Reserved2: ::DWORD, - Reserved3: [::ULONG_PTR; 2], - Reserved4: ::DWORD, - Reserved5: ::DWORD, -}} -pub type PRTL_BARRIER = *mut RTL_BARRIER; -STRUCT!{struct RTL_RUN_ONCE { - Ptr: ::PVOID, -}} -pub type PRTL_RUN_ONCE = *mut RTL_RUN_ONCE; -ENUM!{enum RTL_UMS_THREAD_INFO_CLASS { - UmsThreadInvalidInfoClass = 0, - UmsThreadUserContext, - UmsThreadPriority, // Reserved - UmsThreadAffinity, // Reserved - UmsThreadTeb, - UmsThreadIsSuspended, - UmsThreadIsTerminated, - UmsThreadMaxInfoClass, -}} -ENUM!{enum RTL_UMS_SCHEDULER_REASON { - UmsSchedulerStartup = 0, - UmsSchedulerThreadBlocked, - UmsSchedulerThreadYield, -}} -pub type PRTL_UMS_SCHEDULER_ENTRY_POINT = Option; -ENUM!{enum FIRMWARE_TYPE { - FirmwareTypeUnknown, - FirmwareTypeBios, - FirmwareTypeUefi, - FirmwareTypeMax, -}} -pub type PFIRMWARE_TYPE = *mut FIRMWARE_TYPE; -ENUM!{enum LOGICAL_PROCESSOR_RELATIONSHIP { - RelationProcessorCore, - RelationNumaNode, - RelationCache, - RelationProcessorPackage, - RelationGroup, - RelationAll = 0xffff, -}} -ENUM!{enum PROCESSOR_CACHE_TYPE { - CacheUnified, - CacheInstruction, - CacheData, - CacheTrace, -}} -STRUCT!{struct CACHE_DESCRIPTOR { - Level: ::BYTE, - Associativity: ::BYTE, - LineSize: ::WORD, - Size: ::DWORD, - Type: PROCESSOR_CACHE_TYPE, -}} -pub type PCACHE_DESCRIPTOR = *mut CACHE_DESCRIPTOR; -STRUCT!{struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_ProcessorCore { - Flags: ::BYTE, -}} -STRUCT!{struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_NumaNode { - NodeNumber: ::DWORD, -}} -STRUCT!{struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION { - ProcessorMask: ::ULONG_PTR, - Relationship: LOGICAL_PROCESSOR_RELATIONSHIP, - Reserved: [::ULONGLONG; 2], -}} -UNION!( - SYSTEM_LOGICAL_PROCESSOR_INFORMATION, Reserved, ProcessorCore, ProcessorCore_mut, - SYSTEM_LOGICAL_PROCESSOR_INFORMATION_ProcessorCore -); -UNION!( - SYSTEM_LOGICAL_PROCESSOR_INFORMATION, Reserved, NumaNode, NumaNode_mut, - SYSTEM_LOGICAL_PROCESSOR_INFORMATION_NumaNode -); -UNION!(SYSTEM_LOGICAL_PROCESSOR_INFORMATION, Reserved, Cache, Cache_mut, CACHE_DESCRIPTOR); -pub type PSYSTEM_LOGICAL_PROCESSOR_INFORMATION = *mut SYSTEM_LOGICAL_PROCESSOR_INFORMATION; -STRUCT!{struct SYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION { - CycleTime: ::DWORD64, -}} -pub type PSYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION = *mut SYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION; -ENUM!{enum HARDWARE_COUNTER_TYPE { - PMCCounter, - MaxHardwareCounterType, -}} -pub type PHARDWARE_COUNTER_TYPE = *mut HARDWARE_COUNTER_TYPE; -ENUM!{enum PROCESS_MITIGATION_POLICY { - ProcessDEPPolicy, - ProcessASLRPolicy, - ProcessDynamicCodePolicy, - ProcessStrictHandleCheckPolicy, - ProcessSystemCallDisablePolicy, - ProcessMitigationOptionsMask, - ProcessExtensionPointDisablePolicy, - ProcessReserved1Policy, - ProcessSignaturePolicy, - MaxProcessMitigationPolicy, -}} -STRUCT!{nodebug struct OSVERSIONINFOA { - dwOSVersionInfoSize: ::DWORD, - dwMajorVersion: ::DWORD, - dwMinorVersion: ::DWORD, - dwBuildNumber: ::DWORD, - dwPlatformId: ::DWORD, - szCSDVersion: [::CHAR; 128], -}} -pub type POSVERSIONINFOA = *mut OSVERSIONINFOA; -pub type LPOSVERSIONINFOA = *mut OSVERSIONINFOA; -STRUCT!{nodebug struct OSVERSIONINFOW { - dwOSVersionInfoSize: ::DWORD, - dwMajorVersion: ::DWORD, - dwMinorVersion: ::DWORD, - dwBuildNumber: ::DWORD, - dwPlatformId: ::DWORD, - szCSDVersion: [::WCHAR; 128], -}} -pub type POSVERSIONINFOW = *mut OSVERSIONINFOW; -pub type LPOSVERSIONINFOW = *mut OSVERSIONINFOW; -STRUCT!{nodebug struct OSVERSIONINFOEXA { - dwOSVersionInfoSize: ::DWORD, - dwMajorVersion: ::DWORD, - dwMinorVersion: ::DWORD, - dwBuildNumber: ::DWORD, - dwPlatformId: ::DWORD, - szCSDVersion: [::CHAR; 128], - wServicePackMajor: ::WORD, - wServicePackMinor: ::WORD, - wSuiteMask: ::WORD, - wProductType: ::BYTE, - wReserved: ::BYTE, -}} -pub type POSVERSIONINFOEXA = *mut OSVERSIONINFOEXA; -pub type LPOSVERSIONINFOEXA = *mut OSVERSIONINFOEXA; -STRUCT!{nodebug struct OSVERSIONINFOEXW { - dwOSVersionInfoSize: ::DWORD, - dwMajorVersion: ::DWORD, - dwMinorVersion: ::DWORD, - dwBuildNumber: ::DWORD, - dwPlatformId: ::DWORD, - szCSDVersion: [::WCHAR; 128], - wServicePackMajor: ::WORD, - wServicePackMinor: ::WORD, - wSuiteMask: ::WORD, - wProductType: ::BYTE, - wReserved: ::BYTE, -}} -pub type POSVERSIONINFOEXW = *mut OSVERSIONINFOEXW; -pub type LPOSVERSIONINFOEXW = *mut OSVERSIONINFOEXW; -STRUCT!{struct SLIST_ENTRY { - Next: *mut SLIST_ENTRY, -}} -pub type PSLIST_ENTRY = *mut SLIST_ENTRY; -STRUCT!{struct SLIST_HEADER_HeaderX64 { - BitFields1: ::ULONGLONG, - BitFields2: ::ULONGLONG, -}} -BITFIELD!(SLIST_HEADER_HeaderX64 BitFields1: ::ULONGLONG [ - Depth set_Depth[0..16], - Sequence set_Sequence[16..64], -]); -BITFIELD!(SLIST_HEADER_HeaderX64 BitFields2: ::ULONGLONG [ - Reserved set_Reserved[0..4], - NextEntry set_NextEntry[4..64], -]); -STRUCT!{struct SLIST_HEADER { - Alignment: ::ULONGLONG, - Region: ::ULONGLONG, -}} -UNION!(SLIST_HEADER, Alignment, HeaderX64, HeaderX64_mut, SLIST_HEADER_HeaderX64); -pub type PSLIST_HEADER = *mut SLIST_HEADER; -ENUM!{enum SYSTEM_POWER_STATE { - PowerSystemUnspecified = 0, - PowerSystemWorking = 1, - PowerSystemSleeping1 = 2, - PowerSystemSleeping2 = 3, - PowerSystemSleeping3 = 4, - PowerSystemHibernate = 5, - PowerSystemShutdown = 6, - PowerSystemMaximum = 7, -}} -pub type PSYSTEM_POWER_STATE = *mut SYSTEM_POWER_STATE; -ENUM!{enum POWER_ACTION { - PowerActionNone = 0, - PowerActionReserved, - PowerActionSleep, - PowerActionHibernate, - PowerActionShutdown, - PowerActionShutdownReset, - PowerActionShutdownOff, - PowerActionWarmEject, -}} -pub type PPOWER_ACTION = *mut POWER_ACTION; -ENUM!{enum DEVICE_POWER_STATE { - PowerDeviceUnspecified = 0, - PowerDeviceD0, - PowerDeviceD1, - PowerDeviceD2, - PowerDeviceD3, - PowerDeviceMaximum, -}} -pub type PDEVICE_POWER_STATE = *mut DEVICE_POWER_STATE; -ENUM!{enum MONITOR_DISPLAY_STATE { - PowerMonitorOff = 0, - PowerMonitorOn, - PowerMonitorDim, -}} -pub type PMONITOR_DISPLAY_STATE = *mut MONITOR_DISPLAY_STATE; -ENUM!{enum USER_ACTIVITY_PRESENCE { - PowerUserPresent = 0, - PowerUserNotPresent, - PowerUserInactive, - PowerUserMaximum, - //PowerUserInvalid = 3, -}} -pub type PUSER_ACTIVITY_PRESENCE = *mut USER_ACTIVITY_PRESENCE; -pub type EXECUTION_STATE = ::DWORD; -pub type PEXECUTION_STATE = *mut ::DWORD; -ENUM!{enum LATENCY_TIME { - LT_DONT_CARE, - LT_LOWEST_LATENCY, -}} -ENUM!{enum POWER_REQUEST_TYPE { - PowerRequestDisplayRequired, - PowerRequestSystemRequired, - PowerRequestAwayModeRequired, - PowerRequestExecutionRequired, -}} -pub type PPOWER_REQUEST_TYPE = *mut POWER_REQUEST_TYPE; -pub const MAX_HW_COUNTERS: usize = 16; -STRUCT!{struct HARDWARE_COUNTER_DATA { - Type: HARDWARE_COUNTER_TYPE, - Reserved: ::DWORD, - Value: ::DWORD64, -}} -pub type PHARDWARE_COUNTER_DATA = *mut HARDWARE_COUNTER_DATA; -STRUCT!{struct PERFORMANCE_DATA { - Size: ::WORD, - Version: ::BYTE, - HwCountersCount: ::BYTE, - ContextSwitchCount: ::DWORD, - WaitReasonBitMap: ::DWORD64, - CycleTime: ::DWORD64, - RetryCount: ::DWORD, - Reserved: ::DWORD, - HwCounters: [HARDWARE_COUNTER_DATA; MAX_HW_COUNTERS], -}} -pub type PPERFORMANCE_DATA = *mut PERFORMANCE_DATA; -STRUCT!{struct MEMORY_BASIC_INFORMATION { - BaseAddress: ::PVOID, - AllocationBase: ::PVOID, - AllocationProtect: ::DWORD, - RegionSize: ::SIZE_T, - State: ::DWORD, - Protect: ::DWORD, - Type: ::DWORD, -}} -pub type PMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION; -STRUCT!{struct MEMORY_BASIC_INFORMATION32 { - BaseAddress: ::DWORD, - AllocationBase: ::DWORD, - AllocationProtect: ::DWORD, - RegionSize: ::DWORD, - State: ::DWORD, - Protect: ::DWORD, - Type: ::DWORD, -}} -pub type PMEMORY_BASIC_INFORMATION32 = *mut MEMORY_BASIC_INFORMATION32; -STRUCT!{struct MEMORY_BASIC_INFORMATION64 { // FIXME: align 16 - BaseAddress: ::ULONGLONG, - AllocationBase: ::ULONGLONG, - AllocationProtect: ::DWORD, - __alignment1: ::DWORD, - RegionSize: ::ULONGLONG, - State: ::DWORD, - Protect: ::DWORD, - Type: ::DWORD, - __alignment2: ::DWORD, -}} -pub type PMEMORY_BASIC_INFORMATION64 = *mut MEMORY_BASIC_INFORMATION64; -pub const WOW64_SIZE_OF_80387_REGISTERS: usize = 80; -pub const WOW64_MAXIMUM_SUPPORTED_EXTENSION: usize = 512; -STRUCT!{nodebug struct WOW64_FLOATING_SAVE_AREA { - ControlWord: ::DWORD, - StatusWord: ::DWORD, - TagWord: ::DWORD, - ErrorOffset: ::DWORD, - ErrorSelector: ::DWORD, - DataOffset: ::DWORD, - DataSelector: ::DWORD, - RegisterArea: [::BYTE; WOW64_SIZE_OF_80387_REGISTERS], - Cr0NpxState: ::DWORD, -}} -pub type PWOW64_FLOATING_SAVE_AREA = *mut WOW64_FLOATING_SAVE_AREA; -STRUCT!{nodebug struct WOW64_CONTEXT { - ContextFlags: ::DWORD, - Dr0: ::DWORD, - Dr1: ::DWORD, - Dr2: ::DWORD, - Dr3: ::DWORD, - Dr4: ::DWORD, - Dr5: ::DWORD, - Dr6: ::DWORD, - Dr7: ::DWORD, - FloatSave: WOW64_FLOATING_SAVE_AREA, - SegGs: ::DWORD, - SegFs: ::DWORD, - SegEs: ::DWORD, - SegDs: ::DWORD, - Edi: ::DWORD, - Esi: ::DWORD, - Ebx: ::DWORD, - Edx: ::DWORD, - Ecx: ::DWORD, - Eax: ::DWORD, - Ebp: ::DWORD, - Eip: ::DWORD, - SegCs: ::DWORD, - EFlags: ::DWORD, - Esp: ::DWORD, - SegSs: ::DWORD, - ExtendedRegisters: [::BYTE; WOW64_MAXIMUM_SUPPORTED_EXTENSION], -}} -pub type PWOW64_CONTEXT = *mut WOW64_CONTEXT; -STRUCT!{struct WOW64_LDT_ENTRY_Bytes { - BaseMid: ::BYTE, - Flags1: ::BYTE, - Flags2: ::BYTE, - BaseHi: ::BYTE, -}} -STRUCT!{struct WOW64_LDT_ENTRY_Bits { - BitFields: ::DWORD, -}} -BITFIELD!(WOW64_LDT_ENTRY_Bits BitFields: ::DWORD [ - BaseMid set_BaseMid[0..8], - Type set_Type[8..13], - Dpl set_Dpl[13..15], - Pres set_Pres[15..16], - LimitHi set_LimitHi[16..20], - Sys set_Sys[20..21], - Reserved_0 set_Reserved_0[21..22], - Default_Big set_Default_Big[22..23], - Granularity set_Granularity[23..24], - BaseHi set_BaseHi[24..32], -]); -STRUCT!{struct WOW64_LDT_ENTRY { - LimitLow: ::WORD, - BaseLow: ::WORD, - HighWord: ::DWORD, -}} -UNION!(WOW64_LDT_ENTRY, HighWord, Bytes, Bytes_mut, WOW64_LDT_ENTRY_Bytes); -UNION!(WOW64_LDT_ENTRY, HighWord, Bits, Bits_mut, WOW64_LDT_ENTRY_Bits); -pub type PWOW64_LDT_ENTRY = *mut WOW64_LDT_ENTRY; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/winreg.rs cargo-0.37.0/vendor/winapi-0.2.8/src/winreg.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/winreg.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/winreg.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -// Copyright © 2016, Peter Atashian -// Licensed under the MIT License -use super::*; -pub type REGSAM = ACCESS_MASK; -STRUCT!{struct VALENTA { - ve_valuename: LPSTR, - ve_valuelen: DWORD, - ve_valueptr: DWORD_PTR, - ve_type: DWORD, -}} -pub type PVALENTA = *mut VALENTA; -STRUCT!{struct VALENTW { - ve_valuename: LPWSTR, - ve_valuelen: DWORD, - ve_valueptr: DWORD_PTR, - ve_type: DWORD, -}} -pub type PVALENTW = *mut VALENTW; -pub const HKEY_CLASSES_ROOT: HKEY = 0x80000000 as HKEY; -pub const HKEY_CURRENT_USER: HKEY = 0x80000001 as HKEY; -pub const HKEY_LOCAL_MACHINE: HKEY = 0x80000002 as HKEY; -pub const HKEY_USERS: HKEY = 0x80000003 as HKEY; -pub const HKEY_PERFORMANCE_DATA: HKEY = 0x80000004 as HKEY; -pub const HKEY_PERFORMANCE_TEXT: HKEY = 0x80000050 as HKEY; -pub const HKEY_PERFORMANCE_NLSTEXT: HKEY = 0x80000060 as HKEY; -pub const HKEY_CURRENT_CONFIG: HKEY = 0x80000005 as HKEY; -pub const HKEY_DYN_DATA: HKEY = 0x80000006 as HKEY; -pub const HKEY_CURRENT_USER_LOCAL_SETTINGS: HKEY = 0x80000007 as HKEY; -pub const REG_MUI_STRING_TRUNCATE: DWORD = 0x00000001; -pub const RRF_RT_REG_NONE: DWORD = 0x00000001; -pub const RRF_RT_REG_SZ: DWORD = 0x00000002; -pub const RRF_RT_REG_EXPAND_SZ: DWORD = 0x00000004; -pub const RRF_RT_REG_BINARY: DWORD = 0x00000008; -pub const RRF_RT_REG_DWORD: DWORD = 0x00000010; -pub const RRF_RT_REG_MULTI_SZ: DWORD = 0x00000020; -pub const RRF_RT_REG_QWORD: DWORD = 0x00000040; -pub const RRF_RT_DWORD: DWORD = RRF_RT_REG_BINARY|RRF_RT_REG_DWORD; -pub const RRF_RT_QWORD: DWORD = RRF_RT_REG_BINARY|RRF_RT_REG_QWORD; -pub const RRF_RT_ANY: DWORD = 0x0000ffff; -pub const RRF_NOEXPAND: DWORD = 0x10000000; -pub const RRF_ZEROONFAILURE: DWORD = 0x20000000; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/winscard.rs cargo-0.37.0/vendor/winapi-0.2.8/src/winscard.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/winscard.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/winscard.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,269 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! Data Protection API Prototypes and Definitions -// This header file provides the definitions and symbols necessary for an -// Application or Smart Card Service Provider to access the Smartcard Subsystem. -pub type LPCBYTE = *const ::BYTE; -pub type SCARDCONTEXT = ::ULONG_PTR; -pub type PSCARDCONTEXT = *mut SCARDCONTEXT; -pub type LPSCARDCONTEXT = *mut SCARDCONTEXT; -pub type SCARDHANDLE = ::ULONG_PTR; -pub type PSCARDHANDLE = *mut SCARDHANDLE; -pub type LPSCARDHANDLE = *mut SCARDHANDLE; -pub const SCARD_AUTOALLOCATE: ::DWORD = -1i32 as ::DWORD; -pub const SCARD_SCOPE_USER: ::DWORD = 0; -pub const SCARD_SCOPE_TERMINAL: ::DWORD = 1; -pub const SCARD_SCOPE_SYSTEM: ::DWORD = 2; -pub const SCARD_PROVIDER_PRIMARY: ::DWORD = 1; -pub const SCARD_PROVIDER_CSP: ::DWORD = 2; -pub const SCARD_PROVIDER_KSP: ::DWORD = 3; -STRUCT!{nodebug struct SCARD_READERSTATEA { - szReader: ::LPCSTR, - pvUserData: ::LPVOID, - dwCurrentState: ::DWORD, - dwEventState: ::DWORD, - cbAtr: ::DWORD, - rgbAtr: [::BYTE; 36], -}} -pub type PSCARD_READERSTATEA = *mut SCARD_READERSTATEA; -pub type LPSCARD_READERSTATEA = *mut SCARD_READERSTATEA; -STRUCT!{nodebug struct SCARD_READERSTATEW { - szReader: ::LPCWSTR, - pvUserData: ::LPVOID, - dwCurrentState: ::DWORD, - dwEventState: ::DWORD, - cbAtr: ::DWORD, - rgbAtr: [::BYTE; 36], -}} -pub type PSCARD_READERSTATEW = *mut SCARD_READERSTATEW; -pub type LPSCARD_READERSTATEW = *mut SCARD_READERSTATEW; -pub type SCARD_READERSTATE_A = SCARD_READERSTATEA; -pub type SCARD_READERSTATE_W = SCARD_READERSTATEW; -pub type PSCARD_READERSTATE_A = PSCARD_READERSTATEA; -pub type PSCARD_READERSTATE_W = PSCARD_READERSTATEW; -pub type LPSCARD_READERSTATE_A = LPSCARD_READERSTATEA; -pub type LPSCARD_READERSTATE_W = LPSCARD_READERSTATEW; -pub const SCARD_STATE_UNAWARE: ::DWORD = 0x00000000; -pub const SCARD_STATE_IGNORE: ::DWORD = 0x00000001; -pub const SCARD_STATE_CHANGED: ::DWORD = 0x00000002; -pub const SCARD_STATE_UNKNOWN: ::DWORD = 0x00000004; -pub const SCARD_STATE_UNAVAILABLE: ::DWORD = 0x00000008; -pub const SCARD_STATE_EMPTY: ::DWORD = 0x00000010; -pub const SCARD_STATE_PRESENT: ::DWORD = 0x00000020; -pub const SCARD_STATE_ATRMATCH: ::DWORD = 0x00000040; -pub const SCARD_STATE_EXCLUSIVE: ::DWORD = 0x00000080; -pub const SCARD_STATE_INUSE: ::DWORD = 0x00000100; -pub const SCARD_STATE_MUTE: ::DWORD = 0x00000200; -pub const SCARD_STATE_UNPOWERED: ::DWORD = 0x00000400; -STRUCT!{nodebug struct SCARD_ATRMASK { - cbAtr: ::DWORD, - rgbAtr: [::BYTE; 36], - rgbMask: [::BYTE; 36], -}} -pub type PSCARD_ATRMASK = *mut SCARD_ATRMASK; -pub type LPSCARD_ATRMASK = *mut SCARD_ATRMASK; -pub const SCARD_SHARE_EXCLUSIVE: ::DWORD = 1; -pub const SCARD_SHARE_SHARED: ::DWORD = 2; -pub const SCARD_SHARE_DIRECT: ::DWORD = 3; -pub const SCARD_LEAVE_CARD: ::DWORD = 0; -pub const SCARD_RESET_CARD: ::DWORD = 1; -pub const SCARD_UNPOWER_CARD: ::DWORD = 2; -pub const SCARD_EJECT_CARD: ::DWORD = 3; -pub const SC_DLG_MINIMAL_UI: ::DWORD = 0x01; -pub const SC_DLG_NO_UI: ::DWORD = 0x02; -pub const SC_DLG_FORCE_UI: ::DWORD = 0x04; -pub const SCERR_NOCARDNAME: ::DWORD = 0x4000; -pub const SCERR_NOGUIDS: ::DWORD = 0x8000; -pub type LPOCNCONNPROCA = Option SCARDHANDLE>; -pub type LPOCNCONNPROCW = Option SCARDHANDLE>; -pub type LPOCNCHKPROC = Option ::BOOL>; -pub type LPOCNDSCPROC = Option; -STRUCT!{nodebug struct OPENCARD_SEARCH_CRITERIAA { - dwStructSize: ::DWORD, - lpstrGroupNames: ::LPSTR, - nMaxGroupNames: ::DWORD, - rgguidInterfaces: ::LPCGUID, - cguidInterfaces: ::DWORD, - lpstrCardNames: ::LPSTR, - nMaxCardNames: ::DWORD, - lpfnCheck: LPOCNCHKPROC, - lpfnConnect: LPOCNCONNPROCA, - lpfnDisconnect: LPOCNDSCPROC, - pvUserData: ::LPVOID, - dwShareMode: ::DWORD, - dwPreferredProtocols: ::DWORD, -}} -pub type POPENCARD_SEARCH_CRITERIAA = *mut OPENCARD_SEARCH_CRITERIAA; -pub type LPOPENCARD_SEARCH_CRITERIAA = *mut OPENCARD_SEARCH_CRITERIAA; -STRUCT!{nodebug struct OPENCARD_SEARCH_CRITERIAW { - dwStructSize: ::DWORD, - lpstrGroupNames: ::LPWSTR, - nMaxGroupNames: ::DWORD, - rgguidInterfaces: ::LPCGUID, - cguidInterfaces: ::DWORD, - lpstrCardNames: ::LPWSTR, - nMaxCardNames: ::DWORD, - lpfnCheck: LPOCNCHKPROC, - lpfnConnect: LPOCNCONNPROCW, - lpfnDisconnect: LPOCNDSCPROC, - pvUserData: ::LPVOID, - dwShareMode: ::DWORD, - dwPreferredProtocols: ::DWORD, -}} -pub type POPENCARD_SEARCH_CRITERIAW = *mut OPENCARD_SEARCH_CRITERIAW; -pub type LPOPENCARD_SEARCH_CRITERIAW = *mut OPENCARD_SEARCH_CRITERIAW; -STRUCT!{nodebug struct OPENCARDNAME_EXA { - dwStructSize: ::DWORD, - hSCardContext: SCARDCONTEXT, - hwndOwner: ::HWND, - dwFlags: ::DWORD, - lpstrTitle: ::LPCSTR, - lpstrSearchDesc: ::LPCSTR, - hIcon: ::HICON, - pOpenCardSearchCriteria: POPENCARD_SEARCH_CRITERIAA, - lpfnConnect: LPOCNCONNPROCA, - pvUserData: ::LPVOID, - dwShareMode: ::DWORD, - dwPreferredProtocols: ::DWORD, - lpstrRdr: ::LPSTR, - nMaxRdr: ::DWORD, - lpstrCard: ::LPSTR, - nMaxCard: ::DWORD, - dwActiveProtocol: ::DWORD, - hCardHandle: SCARDHANDLE, -}} -pub type POPENCARDNAME_EXA = *mut OPENCARDNAME_EXA; -pub type LPOPENCARDNAME_EXA = *mut OPENCARDNAME_EXA; -STRUCT!{nodebug struct OPENCARDNAME_EXW { - dwStructSize: ::DWORD, - hSCardContext: SCARDCONTEXT, - hwndOwner: ::HWND, - dwFlags: ::DWORD, - lpstrTitle: ::LPCWSTR, - lpstrSearchDesc: ::LPCWSTR, - hIcon: ::HICON, - pOpenCardSearchCriteria: POPENCARD_SEARCH_CRITERIAW, - lpfnConnect: LPOCNCONNPROCW, - pvUserData: ::LPVOID, - dwShareMode: ::DWORD, - dwPreferredProtocols: ::DWORD, - lpstrRdr: ::LPWSTR, - nMaxRdr: ::DWORD, - lpstrCard: ::LPWSTR, - nMaxCard: ::DWORD, - dwActiveProtocol: ::DWORD, - hCardHandle: SCARDHANDLE, -}} -pub type POPENCARDNAME_EXW = *mut OPENCARDNAME_EXW; -pub type LPOPENCARDNAME_EXW = *mut OPENCARDNAME_EXW; -pub type OPENCARDNAMEA_EX = OPENCARDNAME_EXA; -pub type OPENCARDNAMEW_EX = OPENCARDNAME_EXW; -pub type POPENCARDNAMEA_EX = POPENCARDNAME_EXA; -pub type POPENCARDNAMEW_EX = POPENCARDNAME_EXW; -pub type LPOPENCARDNAMEA_EX = LPOPENCARDNAME_EXA; -pub type LPOPENCARDNAMEW_EX = LPOPENCARDNAME_EXW; -pub const SCARD_READER_SEL_AUTH_PACKAGE: ::DWORD = -629i32 as ::DWORD; -ENUM!{enum READER_SEL_REQUEST_MATCH_TYPE { - RSR_MATCH_TYPE_READER_AND_CONTAINER = 1, - RSR_MATCH_TYPE_SERIAL_NUMBER, - RSR_MATCH_TYPE_ALL_CARDS, -}} -STRUCT!{struct READER_SEL_REQUEST_ReaderAndContainerParameter { - cbReaderNameOffset: ::DWORD, - cchReaderNameLength: ::DWORD, - cbContainerNameOffset: ::DWORD, - cchContainerNameLength: ::DWORD, - dwDesiredCardModuleVersion: ::DWORD, - dwCspFlags: ::DWORD, -}} -STRUCT!{struct READER_SEL_REQUEST_SerialNumberParameter { - cbSerialNumberOffset: ::DWORD, - cbSerialNumberLength: ::DWORD, - dwDesiredCardModuleVersion: ::DWORD, -}} -STRUCT!{struct READER_SEL_REQUEST { - dwShareMode: ::DWORD, - dwPreferredProtocols: ::DWORD, - MatchType: READER_SEL_REQUEST_MATCH_TYPE, - ReaderAndContainerParameter: READER_SEL_REQUEST_ReaderAndContainerParameter, -}} -UNION!( - READER_SEL_REQUEST, ReaderAndContainerParameter, SerialNumberParameter, - SerialNumberParameter_mut, READER_SEL_REQUEST_SerialNumberParameter -); -pub type PREADER_SEL_REQUEST = *mut READER_SEL_REQUEST; -STRUCT!{struct READER_SEL_RESPONSE { - cbReaderNameOffset: ::DWORD, - cchReaderNameLength: ::DWORD, - cbCardNameOffset: ::DWORD, - cchCardNameLength: ::DWORD, -}} -pub type PREADER_SEL_RESPONSE = *mut READER_SEL_RESPONSE; -STRUCT!{nodebug struct OPENCARDNAMEA { - dwStructSize: ::DWORD, - hwndOwner: ::HWND, - hSCardContext: SCARDCONTEXT, - lpstrGroupNames: ::LPSTR, - nMaxGroupNames: ::DWORD, - lpstrCardNames: ::LPSTR, - nMaxCardNames: ::DWORD, - rgguidInterfaces: ::LPCGUID, - cguidInterfaces: ::DWORD, - lpstrRdr: ::LPSTR, - nMaxRdr: ::DWORD, - lpstrCard: ::LPSTR, - nMaxCard: ::DWORD, - lpstrTitle: ::LPCSTR, - dwFlags: ::DWORD, - pvUserData: ::LPVOID, - dwShareMode: ::DWORD, - dwPreferredProtocols: ::DWORD, - dwActiveProtocol: ::DWORD, - lpfnConnect: LPOCNCONNPROCA, - lpfnCheck: LPOCNCHKPROC, - lpfnDisconnect: LPOCNDSCPROC, - hCardHandle: SCARDHANDLE, -}} -pub type POPENCARDNAMEA = *mut OPENCARDNAMEA; -pub type LPOPENCARDNAMEA = *mut OPENCARDNAMEA; -STRUCT!{nodebug struct OPENCARDNAMEW { - dwStructSize: ::DWORD, - hwndOwner: ::HWND, - hSCardContext: SCARDCONTEXT, - lpstrGroupNames: ::LPWSTR, - nMaxGroupNames: ::DWORD, - lpstrCardNames: ::LPWSTR, - nMaxCardNames: ::DWORD, - rgguidInterfaces: ::LPCGUID, - cguidInterfaces: ::DWORD, - lpstrRdr: ::LPWSTR, - nMaxRdr: ::DWORD, - lpstrCard: ::LPWSTR, - nMaxCard: ::DWORD, - lpstrTitle: ::LPCWSTR, - dwFlags: ::DWORD, - pvUserData: ::LPVOID, - dwShareMode: ::DWORD, - dwPreferredProtocols: ::DWORD, - dwActiveProtocol: ::DWORD, - lpfnConnect: LPOCNCONNPROCW, - lpfnCheck: LPOCNCHKPROC, - lpfnDisconnect: LPOCNDSCPROC, - hCardHandle: SCARDHANDLE, -}} -pub type POPENCARDNAMEW = *mut OPENCARDNAMEW; -pub type LPOPENCARDNAMEW = *mut OPENCARDNAMEW; -pub type OPENCARDNAME_A = OPENCARDNAMEA; -pub type OPENCARDNAME_W = OPENCARDNAMEW; -pub type POPENCARDNAME_A = POPENCARDNAMEA; -pub type POPENCARDNAME_W = POPENCARDNAMEW; -pub type LPOPENCARDNAME_A = LPOPENCARDNAMEA; -pub type LPOPENCARDNAME_W = LPOPENCARDNAMEW; -pub const SCARD_AUDIT_CHV_FAILURE: ::DWORD = 0x0; -pub const SCARD_AUDIT_CHV_SUCCESS: ::DWORD = 0x1; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/winsmcrd.rs cargo-0.37.0/vendor/winapi-0.2.8/src/winsmcrd.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/winsmcrd.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/winsmcrd.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,157 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -// Smart Card class/port IOCTL codes. -pub type UWORD = ::WORD; -DEFINE_GUID!(GUID_DEVINTERFACE_SMARTCARD_READER, 0x50DD5230, 0xBA8A, 0x11D1, - 0xBF, 0x5D, 0x00, 0x00, 0xF8, 0x05, 0xF5, 0x30); -pub const SCARD_ATR_LENGTHL: ::DWORD = 33; -pub const SCARD_PROTOCOL_UNDEFINED: ::DWORD = 0x00000000; -pub const SCARD_PROTOCOL_T0: ::DWORD = 0x00000001; -pub const SCARD_PROTOCOL_T1: ::DWORD = 0x00000002; -pub const SCARD_PROTOCOL_RAW: ::DWORD = 0x00010000; -pub const SCARD_PROTOCOL_Tx: ::DWORD = SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1; -pub const SCARD_PROTOCOL_DEFAULT: ::DWORD = 0x80000000; -pub const SCARD_PROTOCOL_OPTIMAL: ::DWORD = 0x00000000; -pub const SCARD_POWER_DOWN: ::DWORD = 0; -pub const SCARD_COLD_RESET: ::DWORD = 1; -pub const SCARD_WARM_RESET: ::DWORD = 2; -pub const IOCTL_SMARTCARD_POWER: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 1, ::METHOD_BUFFERED, - ::FILE_ANY_ACCESS); -pub const IOCTL_SMARTCARD_GET_ATTRIBUTE: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 2, - ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); -pub const IOCTL_SMARTCARD_SET_ATTRIBUTE: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 3, - ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); -pub const IOCTL_SMARTCARD_CONFISCATE: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 4, - ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); -pub const IOCTL_SMARTCARD_TRANSMIT: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 5, - ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); -pub const IOCTL_SMARTCARD_EJECT: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 6, ::METHOD_BUFFERED, - ::FILE_ANY_ACCESS); -pub const IOCTL_SMARTCARD_SWALLOW: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 7, - ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); -pub const IOCTL_SMARTCARD_IS_PRESENT: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 10, - ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); -pub const IOCTL_SMARTCARD_IS_ABSENT: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 11, - ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); -pub const IOCTL_SMARTCARD_SET_PROTOCOL: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 12, - ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); -pub const IOCTL_SMARTCARD_GET_STATE: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 14, - ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); -pub const IOCTL_SMARTCARD_GET_LAST_ERROR: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 15, - ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); -pub const IOCTL_SMARTCARD_GET_PERF_CNTR: ::DWORD = CTL_CODE!(::FILE_DEVICE_SMARTCARD, 16, - ::METHOD_BUFFERED, ::FILE_ANY_ACCESS); -pub const MAXIMUM_ATTR_STRING_LENGTH: ::DWORD = 32; -pub const MAXIMUM_SMARTCARD_READERS: ::DWORD = 10; -pub const SCARD_CLASS_VENDOR_INFO: ::ULONG = 1; -pub const SCARD_CLASS_COMMUNICATIONS: ::ULONG = 2; -pub const SCARD_CLASS_PROTOCOL: ::ULONG = 3; -pub const SCARD_CLASS_POWER_MGMT: ::ULONG = 4; -pub const SCARD_CLASS_SECURITY: ::ULONG = 5; -pub const SCARD_CLASS_MECHANICAL: ::ULONG = 6; -pub const SCARD_CLASS_VENDOR_DEFINED: ::ULONG = 7; -pub const SCARD_CLASS_IFD_PROTOCOL: ::ULONG = 8; -pub const SCARD_CLASS_ICC_STATE: ::ULONG = 9; -pub const SCARD_CLASS_PERF: ::ULONG = 0x7ffe; -pub const SCARD_CLASS_SYSTEM: ::ULONG = 0x7fff; -pub const SCARD_ATTR_VENDOR_NAME: ::ULONG = SCARD_CLASS_VENDOR_INFO << 16 | 0x0100; -pub const SCARD_ATTR_VENDOR_IFD_TYPE: ::ULONG = SCARD_CLASS_VENDOR_INFO << 16 | 0x0101; -pub const SCARD_ATTR_VENDOR_IFD_VERSION: ::ULONG = SCARD_CLASS_VENDOR_INFO << 16 | 0x0102; -pub const SCARD_ATTR_VENDOR_IFD_SERIAL_NO: ::ULONG = SCARD_CLASS_VENDOR_INFO << 16 | 0x0103; -pub const SCARD_ATTR_CHANNEL_ID: ::ULONG = SCARD_CLASS_COMMUNICATIONS << 16 | 0x0110; -pub const SCARD_ATTR_PROTOCOL_TYPES: ::ULONG = SCARD_CLASS_PROTOCOL << 16 | 0x0120; -pub const SCARD_ATTR_DEFAULT_CLK: ::ULONG = SCARD_CLASS_PROTOCOL << 16 | 0x0121; -pub const SCARD_ATTR_MAX_CLK: ::ULONG = SCARD_CLASS_PROTOCOL << 16 | 0x0122; -pub const SCARD_ATTR_DEFAULT_DATA_RATE: ::ULONG = SCARD_CLASS_PROTOCOL << 16 | 0x0123; -pub const SCARD_ATTR_MAX_DATA_RATE: ::ULONG = SCARD_CLASS_PROTOCOL << 16 | 0x0124; -pub const SCARD_ATTR_MAX_IFSD: ::ULONG = SCARD_CLASS_PROTOCOL << 16 | 0x0125; -pub const SCARD_ATTR_POWER_MGMT_SUPPORT: ::ULONG = SCARD_CLASS_POWER_MGMT << 16 | 0x0131; -pub const SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE: ::ULONG = SCARD_CLASS_SECURITY << 16 | 0x0140; -pub const SCARD_ATTR_USER_AUTH_INPUT_DEVICE: ::ULONG = SCARD_CLASS_SECURITY << 16 | 0x0142; -pub const SCARD_ATTR_CHARACTERISTICS: ::ULONG = SCARD_CLASS_MECHANICAL << 16 | 0x0150; -pub const SCARD_ATTR_CURRENT_PROTOCOL_TYPE: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0201; -pub const SCARD_ATTR_CURRENT_CLK: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0202; -pub const SCARD_ATTR_CURRENT_F: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0203; -pub const SCARD_ATTR_CURRENT_D: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0204; -pub const SCARD_ATTR_CURRENT_N: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0205; -pub const SCARD_ATTR_CURRENT_W: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0206; -pub const SCARD_ATTR_CURRENT_IFSC: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0207; -pub const SCARD_ATTR_CURRENT_IFSD: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0208; -pub const SCARD_ATTR_CURRENT_BWT: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x0209; -pub const SCARD_ATTR_CURRENT_CWT: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x020a; -pub const SCARD_ATTR_CURRENT_EBC_ENCODING: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x020b; -pub const SCARD_ATTR_EXTENDED_BWT: ::ULONG = SCARD_CLASS_IFD_PROTOCOL << 16 | 0x020c; -pub const SCARD_ATTR_ICC_PRESENCE: ::ULONG = SCARD_CLASS_ICC_STATE << 16 | 0x0300; -pub const SCARD_ATTR_ICC_INTERFACE_STATUS: ::ULONG = SCARD_CLASS_ICC_STATE << 16 | 0x0301; -pub const SCARD_ATTR_CURRENT_IO_STATE: ::ULONG = SCARD_CLASS_ICC_STATE << 16 | 0x0302; -pub const SCARD_ATTR_ATR_STRING: ::ULONG = SCARD_CLASS_ICC_STATE << 16 | 0x0303; -pub const SCARD_ATTR_ICC_TYPE_PER_ATR: ::ULONG = SCARD_CLASS_ICC_STATE << 16 | 0x0304; -pub const SCARD_ATTR_ESC_RESET: ::ULONG = SCARD_CLASS_VENDOR_DEFINED << 16 | 0xA000; -pub const SCARD_ATTR_ESC_CANCEL: ::ULONG = SCARD_CLASS_VENDOR_DEFINED << 16 | 0xA003; -pub const SCARD_ATTR_ESC_AUTHREQUEST: ::ULONG = SCARD_CLASS_VENDOR_DEFINED << 16 | 0xA005; -pub const SCARD_ATTR_MAXINPUT: ::ULONG = SCARD_CLASS_VENDOR_DEFINED << 16 | 0xA007; -pub const SCARD_ATTR_DEVICE_UNIT: ::ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0001; -pub const SCARD_ATTR_DEVICE_IN_USE: ::ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0002; -pub const SCARD_ATTR_DEVICE_FRIENDLY_NAME_A: ::ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0003; -pub const SCARD_ATTR_DEVICE_SYSTEM_NAME_A: ::ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0004; -pub const SCARD_ATTR_DEVICE_FRIENDLY_NAME_W: ::ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0005; -pub const SCARD_ATTR_DEVICE_SYSTEM_NAME_W: ::ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0006; -pub const SCARD_ATTR_SUPRESS_T1_IFS_REQUEST: ::ULONG = SCARD_CLASS_SYSTEM << 16 | 0x0007; -pub const SCARD_PERF_NUM_TRANSMISSIONS: ::ULONG = SCARD_CLASS_PERF << 16 | 0x0001; -pub const SCARD_PERF_BYTES_TRANSMITTED: ::ULONG = SCARD_CLASS_PERF << 16 | 0x0002; -pub const SCARD_PERF_TRANSMISSION_TIME: ::ULONG = SCARD_CLASS_PERF << 16 | 0x0003; -pub const SCARD_T0_HEADER_LENGTH: ::DWORD = 7; -pub const SCARD_T0_CMD_LENGTH: ::DWORD = 5; -pub const SCARD_T1_PROLOGUE_LENGTH: ::DWORD = 3; -pub const SCARD_T1_EPILOGUE_LENGTH: ::DWORD = 2; -pub const SCARD_T1_MAX_IFS: ::DWORD = 254; -pub const SCARD_UNKNOWN: ::ULONG = 0; -pub const SCARD_ABSENT: ::ULONG = 1; -pub const SCARD_PRESENT: ::ULONG = 2; -pub const SCARD_SWALLOWED: ::ULONG = 3; -pub const SCARD_POWERED: ::ULONG = 4; -pub const SCARD_NEGOTIABLE: ::ULONG = 5; -pub const SCARD_SPECIFIC: ::ULONG = 6; -STRUCT!{struct SCARD_IO_REQUEST { - dwProtocol: ::DWORD, - cbPciLength: ::DWORD, -}} -pub type PSCARD_IO_REQUEST = *mut SCARD_IO_REQUEST; -pub type LPSCARD_IO_REQUEST = *mut SCARD_IO_REQUEST; -pub type LPCSCARD_IO_REQUEST = *const SCARD_IO_REQUEST; -STRUCT!{struct SCARD_T0_COMMAND { - bCla: ::BYTE, - bIns: ::BYTE, - bP1: ::BYTE, - bP2: ::BYTE, - bP3: ::BYTE, -}} -pub type LPSCARD_T0_COMMAND = *mut SCARD_T0_COMMAND; -STRUCT!{struct SCARD_T0_REQUEST { - ioRequest: SCARD_IO_REQUEST, - bSw1: ::BYTE, - bSw2: ::BYTE, - CmdBytes: SCARD_T0_COMMAND, -}} -UNION!(SCARD_T0_REQUEST, CmdBytes, rgbHeader, rgbHeader_mut, [::BYTE; 5]); -pub type PSCARD_T0_REQUEST = *mut SCARD_T0_REQUEST; -pub type LPSCARD_T0_REQUEST = *mut SCARD_T0_REQUEST; -STRUCT!{struct SCARD_T1_REQUEST { - ioRequest: SCARD_IO_REQUEST, -}} -pub type PSCARD_T1_REQUEST = *mut SCARD_T1_REQUEST; -pub type LPSCARD_T1_REQUEST = *mut SCARD_T1_REQUEST; -pub const SCARD_READER_SWALLOWS: ::ULONG = 0x00000001; -pub const SCARD_READER_EJECTS: ::ULONG = 0x00000002; -pub const SCARD_READER_CONFISCATES: ::ULONG = 0x00000004; -pub const SCARD_READER_TYPE_SERIAL: ::ULONG = 0x01; -pub const SCARD_READER_TYPE_PARALELL: ::ULONG = 0x02; -pub const SCARD_READER_TYPE_KEYBOARD: ::ULONG = 0x04; -pub const SCARD_READER_TYPE_SCSI: ::ULONG = 0x08; -pub const SCARD_READER_TYPE_IDE: ::ULONG = 0x10; -pub const SCARD_READER_TYPE_USB: ::ULONG = 0x20; -pub const SCARD_READER_TYPE_PCMCIA: ::ULONG = 0x40; -pub const SCARD_READER_TYPE_TPM: ::ULONG = 0x80; -pub const SCARD_READER_TYPE_NFC: ::ULONG = 0x100; -pub const SCARD_READER_TYPE_UICC: ::ULONG = 0x200; -pub const SCARD_READER_TYPE_VENDOR: ::ULONG = 0xF0; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/winsock2.rs cargo-0.37.0/vendor/winapi-0.2.8/src/winsock2.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/winsock2.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/winsock2.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,429 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! definitions to be used with the WinSock 2 DLL and WinSock 2 applications. -//! -//! This header file corresponds to version 2.2.x of the WinSock API specification. -pub const WINSOCK_VERSION: ::WORD = 2 | (2 << 8); -pub type u_char = ::c_uchar; -pub type u_short = ::c_ushort; -pub type u_int = ::c_uint; -pub type u_long = ::c_ulong; -pub type u_int64 = ::__uint64; -pub type SOCKET = ::UINT_PTR; -pub type GROUP = ::c_uint; -pub const FD_SETSIZE: usize = 64; -pub const FD_MAX_EVENTS: usize = 10; -STRUCT!{nodebug struct fd_set { - fd_count: u_int, - fd_array: [SOCKET; FD_SETSIZE], -}} -STRUCT!{struct timeval { - tv_sec: ::c_long, - tv_usec: ::c_long, -}} -STRUCT!{struct hostent { - h_name: *mut ::c_char, - h_aliases: *mut *mut ::c_char, - h_addrtype: ::c_short, - h_length: ::c_short, - h_addr_list: *mut *mut ::c_char, -}} -STRUCT!{struct netent { - n_name: *mut ::c_char, - n_aliases: *mut *mut ::c_char, - n_addrtype: ::c_short, - n_net: u_long, -}} -#[cfg(target_arch="x86")] -STRUCT!{struct servent { - s_name: *mut ::c_char, - s_aliases: *mut *mut ::c_char, - s_port: ::c_short, - s_proto: *mut ::c_char, -}} -#[cfg(target_arch="x86_64")] -STRUCT!{struct servent { - s_name: *mut ::c_char, - s_aliases: *mut *mut ::c_char, - s_proto: *mut ::c_char, - s_port: ::c_short, -}} -STRUCT!{struct protoent { - p_name: *mut ::c_char, - p_aliases: *mut *mut ::c_char, - p_proto: ::c_short, -}} -pub const WSADESCRIPTION_LEN: usize = 256; -pub const WSASYS_STATUS_LEN: usize = 128; -#[cfg(target_arch="x86")] -STRUCT!{nodebug struct WSADATA { - wVersion: ::WORD, - wHighVersion: ::WORD, - szDescription: [::c_char; WSADESCRIPTION_LEN + 1], - szSystemStatus: [::c_char; WSASYS_STATUS_LEN + 1], - iMaxSockets: ::c_ushort, - iMaxUdpDg: ::c_ushort, - lpVendorInfo: *mut ::c_char, -}} -#[cfg(target_arch="x86_64")] -STRUCT!{nodebug struct WSADATA { - wVersion: ::WORD, - wHighVersion: ::WORD, - iMaxSockets: ::c_ushort, - iMaxUdpDg: ::c_ushort, - lpVendorInfo: *mut ::c_char, - szDescription: [::c_char; WSADESCRIPTION_LEN + 1], - szSystemStatus: [::c_char; WSASYS_STATUS_LEN + 1], -}} -pub type LPWSADATA = *mut WSADATA; -//391 -pub const INVALID_SOCKET: SOCKET = !0; -pub const SOCKET_ERROR: ::c_int = -1; -STRUCT!{struct sockproto { - sp_family: u_short, - sp_protocol: u_short, -}} -pub const PF_UNSPEC: ::c_int = ::AF_UNSPEC; -pub const PF_UNIX: ::c_int = ::AF_UNIX; -pub const PF_INET: ::c_int = ::AF_INET; -pub const PF_IMPLINK: ::c_int = ::AF_IMPLINK; -pub const PF_PUP: ::c_int = ::AF_PUP; -pub const PF_CHAOS: ::c_int = ::AF_CHAOS; -pub const PF_NS: ::c_int = ::AF_NS; -pub const PF_IPX: ::c_int = ::AF_IPX; -pub const PF_ISO: ::c_int = ::AF_ISO; -pub const PF_OSI: ::c_int = ::AF_OSI; -pub const PF_ECMA: ::c_int = ::AF_ECMA; -pub const PF_DATAKIT: ::c_int = ::AF_DATAKIT; -pub const PF_CCITT: ::c_int = ::AF_CCITT; -pub const PF_SNA: ::c_int = ::AF_SNA; -pub const PF_DECnet: ::c_int = ::AF_DECnet; -pub const PF_DLI: ::c_int = ::AF_DLI; -pub const PF_LAT: ::c_int = ::AF_LAT; -pub const PF_HYLINK: ::c_int = ::AF_HYLINK; -pub const PF_APPLETALK: ::c_int = ::AF_APPLETALK; -pub const PF_VOICEVIEW: ::c_int = ::AF_VOICEVIEW; -pub const PF_FIREFOX: ::c_int = ::AF_FIREFOX; -pub const PF_UNKNOWN1: ::c_int = ::AF_UNKNOWN1; -pub const PF_BAN: ::c_int = ::AF_BAN; -pub const PF_ATM: ::c_int = ::AF_ATM; -pub const PF_INET6: ::c_int = ::AF_INET6; -pub const PF_BTH: ::c_int = ::AF_BTH; -pub const PF_MAX: ::c_int = ::AF_MAX; -STRUCT!{struct linger { - l_onoff: u_short, - l_linger: u_short, -}} -pub const SOMAXCONN: ::c_int = 0x7fffffff; -pub type WSAEVENT = ::HANDLE; -pub type LPWSAEVENT = ::LPHANDLE; -pub type WSAOVERLAPPED = ::OVERLAPPED; -pub type LPWSAOVERLAPPED = *mut ::OVERLAPPED; -pub const WSA_IO_PENDING: ::DWORD = ::ERROR_IO_PENDING; -pub const WSA_IO_INCOMPLETE: ::DWORD = ::ERROR_IO_INCOMPLETE; -pub const WSA_INVALID_HANDLE: ::DWORD = ::ERROR_INVALID_HANDLE; -pub const WSA_INVALID_PARAMETER: ::DWORD = ::ERROR_INVALID_PARAMETER; -pub const WSA_NOT_ENOUGH_MEMORY: ::DWORD = ::ERROR_NOT_ENOUGH_MEMORY; -pub const WSA_OPERATION_ABORTED: ::DWORD = ::ERROR_OPERATION_ABORTED; -STRUCT!{struct QOS { - SendingFlowspec: ::FLOWSPEC, - FLOWSPEC: ::FLOWSPEC, - ProviderSpecific: ::WSABUF, -}} -pub type LPQOS = *mut QOS; -STRUCT!{struct WSANETWORKEVENTS { - lNetworkEvents: ::c_long, - iErrorCode: [::c_int; FD_MAX_EVENTS], -}} -pub type LPWSANETWORKEVENTS = *mut WSANETWORKEVENTS; -pub const MAX_PROTOCOL_CHAIN: usize = 7; -STRUCT!{struct WSAPROTOCOLCHAIN { - ChainLen: ::c_int, - ChainEntries: [::DWORD; MAX_PROTOCOL_CHAIN], -}} -pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN; -pub const WSAPROTOCOL_LEN: usize = 255; -STRUCT!{nodebug struct WSAPROTOCOL_INFOA { - dwServiceFlags1: ::DWORD, - dwServiceFlags2: ::DWORD, - dwServiceFlags3: ::DWORD, - dwServiceFlags4: ::DWORD, - dwServiceFlags5: ::DWORD, - ProviderId: ::GUID, - dwCatalogEntryId: ::DWORD, - ProtocolChain: WSAPROTOCOLCHAIN, - iVersion: ::c_int, - iAddressFamily: ::c_int, - iMaxSockAddr: ::c_int, - iMinSockAddr: ::c_int, - iSocketType: ::c_int, - iProtocol: ::c_int, - iProtocolMaxOffset: ::c_int, - iNetworkByteOrder: ::c_int, - iSecurityScheme: ::c_int, - dwMessageSize: ::DWORD, - dwProviderReserved: ::DWORD, - szProtocol: [::CHAR; WSAPROTOCOL_LEN + 1], -}} -pub type LPWSAPROTOCOL_INFOA = *mut WSAPROTOCOL_INFOA; -STRUCT!{nodebug struct WSAPROTOCOL_INFOW { - dwServiceFlags1: ::DWORD, - dwServiceFlags2: ::DWORD, - dwServiceFlags3: ::DWORD, - dwServiceFlags4: ::DWORD, - dwServiceFlags5: ::DWORD, - ProviderId: ::GUID, - dwCatalogEntryId: ::DWORD, - ProtocolChain: WSAPROTOCOLCHAIN, - iVersion: ::c_int, - iAddressFamily: ::c_int, - iMaxSockAddr: ::c_int, - iMinSockAddr: ::c_int, - iSocketType: ::c_int, - iProtocol: ::c_int, - iProtocolMaxOffset: ::c_int, - iNetworkByteOrder: ::c_int, - iSecurityScheme: ::c_int, - dwMessageSize: ::DWORD, - dwProviderReserved: ::DWORD, - szProtocol: [::WCHAR; WSAPROTOCOL_LEN + 1], -}} -pub type LPWSAPROTOCOL_INFOW = *mut WSAPROTOCOL_INFOW; -pub type LPCONDITIONPROC = Option ::c_int>; -pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = Option; -ENUM!{enum WSACOMPLETIONTYPE { - NSP_NOTIFY_IMMEDIATELY = 0, - NSP_NOTIFY_HWND, - NSP_NOTIFY_EVENT, - NSP_NOTIFY_PORT, - NSP_NOTIFY_APC, -}} -pub type PWSACOMPLETIONTYPE = *mut WSACOMPLETIONTYPE; -pub type LPWSACOMPLETIONTYPE = *mut WSACOMPLETIONTYPE; -STRUCT!{struct WSACOMPLETION_WindowMessage { - hWnd: ::HWND, - uMsg: ::UINT, - context: ::WPARAM, -}} -STRUCT!{struct WSACOMPLETION_Event { - lpOverlapped: LPWSAOVERLAPPED, -}} -STRUCT!{nodebug struct WSACOMPLETION_Apc { - lpOverlapped: LPWSAOVERLAPPED, - lpfnCompletionProc: LPWSAOVERLAPPED_COMPLETION_ROUTINE, -}} -STRUCT!{struct WSACOMPLETION_Port { - lpOverlapped: LPWSAOVERLAPPED, - hPort: ::HANDLE, - Key: ::ULONG_PTR, -}} -#[cfg(target_arch="x86")] -STRUCT!{struct WSACOMPLETION { - Type: WSACOMPLETIONTYPE, - Parameters: [u8; 12], -}} -#[cfg(target_arch="x86_64")] -STRUCT!{struct WSACOMPLETION { - Type: WSACOMPLETIONTYPE, - Parameters: [u8; 24], -}} -UNION!(WSACOMPLETION, Parameters, WindowMessage, WindowMessage_mut, WSACOMPLETION_WindowMessage); -UNION!(WSACOMPLETION, Parameters, Event, Event_mut, WSACOMPLETION_Event); -UNION!(WSACOMPLETION, Parameters, Apc, Apc_mut, WSACOMPLETION_Apc); -UNION!(WSACOMPLETION, Parameters, Port, Port_mut, WSACOMPLETION_Port); -pub type PWSACOMPLETION = *mut WSACOMPLETION; -pub type LPWSACOMPLETION = *mut WSACOMPLETION; -STRUCT!{struct AFPROTOCOLS { - iAddressFamily: ::INT, - iProtocol: ::INT, -}} -pub type PAFPROTOCOLS = *mut AFPROTOCOLS; -pub type LPAFPROTOCOLS = *mut AFPROTOCOLS; -ENUM!{enum WSAECOMPARATOR { - COMP_EQUAL = 0, - COMP_NOTLESS, -}} -pub type PWSAECOMPARATOR = *mut WSAECOMPARATOR; -pub type LPWSAECOMPARATOR = *mut WSAECOMPARATOR; -STRUCT!{struct WSAVERSION { - dwVersion: ::DWORD, - ecHow: WSAECOMPARATOR, -}} -pub type PWSAVERSION = *mut WSAVERSION; -pub type LPWSAVERSION = *mut WSAVERSION; -STRUCT!{struct WSAQUERYSETA { - dwSize: ::DWORD, - lpszServiceInstanceName: ::LPSTR, - lpServiceClassId: ::LPGUID, - lpVersion: LPWSAVERSION, - lpszComment: ::LPSTR, - dwNameSpace: ::DWORD, - lpNSProviderId: ::LPGUID, - lpszContext: ::LPSTR, - dwNumberOfProtocols: ::DWORD, - lpafpProtocols: LPAFPROTOCOLS, - lpszQueryString: ::LPSTR, - dwNumberOfCsAddrs: ::DWORD, - lpcsaBuffer: ::LPCSADDR_INFO, - dwOutputFlags: ::DWORD, - lpBlob: ::LPBLOB, -}} -pub type PWSAQUERYSETA = *mut WSAQUERYSETA; -pub type LPWSAQUERYSETA = *mut WSAQUERYSETA; -STRUCT!{struct WSAQUERYSETW { - dwSize: ::DWORD, - lpszServiceInstanceName: ::LPWSTR, - lpServiceClassId: ::LPGUID, - lpVersion: LPWSAVERSION, - lpszComment: ::LPWSTR, - dwNameSpace: ::DWORD, - lpNSProviderId: ::LPGUID, - lpszContext: ::LPWSTR, - dwNumberOfProtocols: ::DWORD, - lpafpProtocols: LPAFPROTOCOLS, - lpszQueryString: ::LPWSTR, - dwNumberOfCsAddrs: ::DWORD, - lpcsaBuffer: ::LPCSADDR_INFO, - dwOutputFlags: ::DWORD, - lpBlob: ::LPBLOB, -}} -pub type PWSAQUERYSETW = *mut WSAQUERYSETW; -pub type LPWSAQUERYSETW = *mut WSAQUERYSETW; -STRUCT!{struct WSAQUERYSET2A { - dwSize: ::DWORD, - lpszServiceInstanceName: ::LPSTR, - lpVersion: LPWSAVERSION, - lpszComment: ::LPSTR, - dwNameSpace: ::DWORD, - lpNSProviderId: ::LPGUID, - lpszContext: ::LPSTR, - dwNumberOfProtocols: ::DWORD, - lpafpProtocols: LPAFPROTOCOLS, - lpszQueryString: ::LPSTR, - dwNumberOfCsAddrs: ::DWORD, - lpcsaBuffer: ::LPCSADDR_INFO, - dwOutputFlags: ::DWORD, - lpBlob: ::LPBLOB, -}} -pub type PWSAQUERYSET2A = *mut WSAQUERYSET2A; -pub type LPWSAQUERYSET2A = *mut WSAQUERYSET2A; -STRUCT!{struct WSAQUERYSET2W { - dwSize: ::DWORD, - lpszServiceInstanceName: ::LPWSTR, - lpVersion: LPWSAVERSION, - lpszComment: ::LPWSTR, - dwNameSpace: ::DWORD, - lpNSProviderId: ::LPGUID, - lpszContext: ::LPWSTR, - dwNumberOfProtocols: ::DWORD, - lpafpProtocols: LPAFPROTOCOLS, - lpszQueryString: ::LPWSTR, - dwNumberOfCsAddrs: ::DWORD, - lpcsaBuffer: ::LPCSADDR_INFO, - dwOutputFlags: ::DWORD, - lpBlob: ::LPBLOB, -}} -pub type PWSAQUERYSET2W = *mut WSAQUERYSET2W; -pub type LPWSAQUERYSET2W = *mut WSAQUERYSET2W; -ENUM!{enum WSAESETSERVICEOP { - RNRSERVICE_REGISTER = 0, - RNRSERVICE_DEREGISTER, - RNRSERVICE_DELETE, -}} -pub type PWSAESETSERVICEOP = *mut WSAESETSERVICEOP; -pub type LPWSAESETSERVICEOP = *mut WSAESETSERVICEOP; -STRUCT!{struct WSANSCLASSINFOA { - lpszName: ::LPSTR, - dwNameSpace: ::DWORD, - dwValueType: ::DWORD, - dwValueSize: ::DWORD, - lpValue: ::LPVOID, -}} -pub type PWSANSCLASSINFOA = *mut WSANSCLASSINFOA; -pub type LPWSANSCLASSINFOA = *mut WSANSCLASSINFOA; -STRUCT!{struct WSANSCLASSINFOW { - lpszName: ::LPWSTR, - dwNameSpace: ::DWORD, - dwValueType: ::DWORD, - dwValueSize: ::DWORD, - lpValue: ::LPVOID, -}} -pub type PWSANSCLASSINFOW = *mut WSANSCLASSINFOW; -pub type LPWSANSCLASSINFOW = *mut WSANSCLASSINFOW; -STRUCT!{struct WSASERVICECLASSINFOA { - lpServiceClassId: ::LPGUID, - lpszServiceClassName: ::LPSTR, - dwCount: ::DWORD, - lpClassInfos: LPWSANSCLASSINFOA, -}} -pub type PWSASERVICECLASSINFOA = *mut WSASERVICECLASSINFOA; -pub type LPWSASERVICECLASSINFOA = *mut WSASERVICECLASSINFOA; -STRUCT!{struct WSASERVICECLASSINFOW { - lpServiceClassId: ::LPGUID, - lpszServiceClassName: ::LPWSTR, - dwCount: ::DWORD, - lpClassInfos: LPWSANSCLASSINFOW, -}} -pub type PWSASERVICECLASSINFOW = *mut WSASERVICECLASSINFOW; -pub type LPWSASERVICECLASSINFOW = *mut WSASERVICECLASSINFOW; -STRUCT!{struct WSANAMESPACE_INFOA { - NSProviderId: ::GUID, - dwNameSpace: ::DWORD, - fActive: ::BOOL, - dwVersion: ::DWORD, - lpszIdentifier: ::LPSTR, -}} -pub type PWSANAMESPACE_INFOA = *mut WSANAMESPACE_INFOA; -pub type LPWSANAMESPACE_INFOA = *mut WSANAMESPACE_INFOA; -STRUCT!{struct WSANAMESPACE_INFOW { - NSProviderId: ::GUID, - dwNameSpace: ::DWORD, - fActive: ::BOOL, - dwVersion: ::DWORD, - lpszIdentifier: ::LPWSTR, -}} -pub type PWSANAMESPACE_INFOW = *mut WSANAMESPACE_INFOW; -pub type LPWSANAMESPACE_INFOW = *mut WSANAMESPACE_INFOW; -STRUCT!{struct WSANAMESPACE_INFOEXA { - NSProviderId: ::GUID, - dwNameSpace: ::DWORD, - fActive: ::BOOL, - dwVersion: ::DWORD, - lpszIdentifier: ::LPSTR, - ProviderSpecific: ::BLOB, -}} -pub type PWSANAMESPACE_INFOEXA = *mut WSANAMESPACE_INFOEXA; -pub type LPWSANAMESPACE_INFOEXA = *mut WSANAMESPACE_INFOEXA; -STRUCT!{struct WSANAMESPACE_INFOEXW { - NSProviderId: ::GUID, - dwNameSpace: ::DWORD, - fActive: ::BOOL, - dwVersion: ::DWORD, - lpszIdentifier: ::LPWSTR, - ProviderSpecific: ::BLOB, -}} -pub type PWSANAMESPACE_INFOEXW = *mut WSANAMESPACE_INFOEXW; -pub type LPWSANAMESPACE_INFOEXW = *mut WSANAMESPACE_INFOEXW; -pub const POLLRDNORM: ::SHORT = 0x0100; -pub const POLLRDBAND: ::SHORT = 0x0200; -pub const POLLIN: ::SHORT = POLLRDNORM | POLLRDBAND; -pub const POLLPRI: ::SHORT = 0x0400; -pub const POLLWRNORM: ::SHORT = 0x0010; -pub const POLLOUT: ::SHORT = POLLWRNORM; -pub const POLLWRBAND: ::SHORT = 0x0020; -pub const POLLERR: ::SHORT = 0x0001; -pub const POLLHUP: ::SHORT = 0x0002; -pub const POLLNVAL: ::SHORT = 0x0004; -STRUCT!{struct WSAPOLLFD { - fd: ::SOCKET, - events: ::SHORT, - revents: ::SHORT, -}} -pub type PWSAPOLLFD = *mut WSAPOLLFD; -pub type LPWSAPOLLFD = *mut WSAPOLLFD; -pub const FIONBIO: ::c_ulong = 0x8004667e; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/winspool.rs cargo-0.37.0/vendor/winapi-0.2.8/src/winspool.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/winspool.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/winspool.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! Winspool header file -STRUCT!{struct PRINTER_DEFAULTSA { - pDataType: ::LPSTR, - pDevMode: ::LPDEVMODEA, - DesiredAccess: ::ACCESS_MASK, -}} -pub type PPRINTER_DEFAULTSA = *mut PRINTER_DEFAULTSA; -pub type LPPRINTER_DEFAULTSA = *mut PRINTER_DEFAULTSA; -STRUCT!{struct PRINTER_DEFAULTSW { - pDataType: ::LPWSTR, - pDevMode: ::LPDEVMODEW, - DesiredAccess: ::ACCESS_MASK, -}} -pub type PPRINTER_DEFAULTSW = *mut PRINTER_DEFAULTSW; -pub type LPPRINTER_DEFAULTSW = *mut PRINTER_DEFAULTSW; -STRUCT!{struct PRINTER_OPTIONSA { - cbSize: ::UINT, - dwFlags: ::DWORD, -}} -pub type PPRINTER_OPTIONSA = *mut PRINTER_OPTIONSA; -pub type LPPRINTER_OPTIONSA = *mut PRINTER_OPTIONSA; -STRUCT!{struct PRINTER_OPTIONSW { - cbSize: ::UINT, - dwFlags: ::DWORD, -}} -pub type PPRINTER_OPTIONSW = *mut PRINTER_OPTIONSW; -pub type LPPRINTER_OPTIONSW = *mut PRINTER_OPTIONSW; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/winstring.rs cargo-0.37.0/vendor/winapi-0.2.8/src/winstring.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/winstring.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/winstring.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -pub type PINSPECT_HSTRING_CALLBACK = Option ::HRESULT>; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/winsvc.rs cargo-0.37.0/vendor/winapi-0.2.8/src/winsvc.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/winsvc.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/winsvc.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,200 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! Header file for the Service Control Manager -//80 -pub const SERVICE_NO_CHANGE: ::DWORD = 0xffffffff; -pub const SERVICE_ACTIVE: ::DWORD = 0x00000001; -pub const SERVICE_INACTIVE: ::DWORD = 0x00000002; -pub const SERVICE_STATE_ALL: ::DWORD = SERVICE_ACTIVE | SERVICE_INACTIVE; -pub const SERVICE_CONTROL_STOP: ::DWORD = 0x00000001; -pub const SERVICE_CONTROL_PAUSE: ::DWORD = 0x00000002; -pub const SERVICE_CONTROL_CONTINUE: ::DWORD = 0x00000003; -pub const SERVICE_CONTROL_INTERROGATE: ::DWORD = 0x00000004; -pub const SERVICE_CONTROL_SHUTDOWN: ::DWORD = 0x00000005; -pub const SERVICE_CONTROL_PARAMCHANGE: ::DWORD = 0x00000006; -pub const SERVICE_CONTROL_NETBINDADD: ::DWORD = 0x00000007; -pub const SERVICE_CONTROL_NETBINDREMOVE: ::DWORD = 0x00000008; -pub const SERVICE_CONTROL_NETBINDENABLE: ::DWORD = 0x00000009; -pub const SERVICE_CONTROL_NETBINDDISABLE: ::DWORD = 0x0000000A; -pub const SERVICE_CONTROL_DEVICEEVENT: ::DWORD = 0x0000000B; -pub const SERVICE_CONTROL_HARDWAREPROFILECHANGE: ::DWORD = 0x0000000C; -pub const SERVICE_CONTROL_POWEREVENT: ::DWORD = 0x0000000D; -pub const SERVICE_CONTROL_SESSIONCHANGE: ::DWORD = 0x0000000E; -pub const SERVICE_CONTROL_PRESHUTDOWN: ::DWORD = 0x0000000F; -pub const SERVICE_CONTROL_TIMECHANGE: ::DWORD = 0x00000010; -pub const SERVICE_CONTROL_TRIGGEREVENT: ::DWORD = 0x00000020; -pub const SERVICE_STOPPED: ::DWORD = 0x00000001; -pub const SERVICE_START_PENDING: ::DWORD = 0x00000002; -pub const SERVICE_STOP_PENDING: ::DWORD = 0x00000003; -pub const SERVICE_RUNNING: ::DWORD = 0x00000004; -pub const SERVICE_CONTINUE_PENDING: ::DWORD = 0x00000005; -pub const SERVICE_PAUSE_PENDING: ::DWORD = 0x00000006; -pub const SERVICE_PAUSED: ::DWORD = 0x00000007; -pub const SERVICE_ACCEPT_STOP: ::DWORD = 0x00000001; -pub const SERVICE_ACCEPT_PAUSE_CONTINUE: ::DWORD = 0x00000002; -pub const SERVICE_ACCEPT_SHUTDOWN: ::DWORD = 0x00000004; -pub const SERVICE_ACCEPT_PARAMCHANGE: ::DWORD = 0x00000008; -pub const SERVICE_ACCEPT_NETBINDCHANGE: ::DWORD = 0x00000010; -pub const SERVICE_ACCEPT_HARDWAREPROFILECHANGE: ::DWORD = 0x00000020; -pub const SERVICE_ACCEPT_POWEREVENT: ::DWORD = 0x00000040; -pub const SERVICE_ACCEPT_SESSIONCHANGE: ::DWORD = 0x00000080; -pub const SERVICE_ACCEPT_PRESHUTDOWN: ::DWORD = 0x00000100; -pub const SERVICE_ACCEPT_TIMECHANGE: ::DWORD = 0x00000200; -pub const SERVICE_ACCEPT_TRIGGEREVENT: ::DWORD = 0x00000400; -pub const SC_MANAGER_CONNECT: ::DWORD = 0x0001; -pub const SC_MANAGER_CREATE_SERVICE: ::DWORD = 0x0002; -pub const SC_MANAGER_ENUMERATE_SERVICE: ::DWORD = 0x0004; -pub const SC_MANAGER_LOCK: ::DWORD = 0x0008; -pub const SC_MANAGER_QUERY_LOCK_STATUS: ::DWORD = 0x0010; -pub const SC_MANAGER_MODIFY_BOOT_CONFIG: ::DWORD = 0x0020; -pub const SC_MANAGER_ALL_ACCESS: ::DWORD = ::STANDARD_RIGHTS_REQUIRED | SC_MANAGER_CONNECT - | SC_MANAGER_CREATE_SERVICE | SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_LOCK - | SC_MANAGER_QUERY_LOCK_STATUS | SC_MANAGER_MODIFY_BOOT_CONFIG; -pub const SERVICE_QUERY_CONFIG: ::DWORD = 0x0001; -pub const SERVICE_CHANGE_CONFIG: ::DWORD = 0x0002; -pub const SERVICE_QUERY_STATUS: ::DWORD = 0x0004; -pub const SERVICE_ENUMERATE_DEPENDENTS: ::DWORD = 0x0008; -pub const SERVICE_START: ::DWORD = 0x0010; -pub const SERVICE_STOP: ::DWORD = 0x0020; -pub const SERVICE_PAUSE_CONTINUE: ::DWORD = 0x0040; -pub const SERVICE_INTERROGATE: ::DWORD = 0x0080; -pub const SERVICE_USER_DEFINED_CONTROL: ::DWORD = 0x0100; -pub const SERVICE_ALL_ACCESS: ::DWORD = ::STANDARD_RIGHTS_REQUIRED | SERVICE_QUERY_CONFIG - | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_START - | SERVICE_STOP | SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL; -pub const SERVICE_RUNS_IN_SYSTEM_PROCESS: ::DWORD = 0x00000001; -pub const SERVICE_CONFIG_DESCRIPTION: ::DWORD = 1; -pub const SERVICE_CONFIG_FAILURE_ACTIONS: ::DWORD = 2; -pub const SERVICE_CONFIG_DELAYED_AUTO_START_INFO: ::DWORD = 3; -pub const SERVICE_CONFIG_FAILURE_ACTIONS_FLAG: ::DWORD = 4; -pub const SERVICE_CONFIG_SERVICE_SID_INFO: ::DWORD = 5; -pub const SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO: ::DWORD = 6; -pub const SERVICE_CONFIG_PRESHUTDOWN_INFO: ::DWORD = 7; -pub const SERVICE_CONFIG_TRIGGER_INFO: ::DWORD = 8; -pub const SERVICE_CONFIG_PREFERRED_NODE: ::DWORD = 9; -pub const SERVICE_CONFIG_LAUNCH_PROTECTED: ::DWORD = 12; -pub const SERVICE_NOTIFY_STATUS_CHANGE_1: ::DWORD = 1; -pub const SERVICE_NOTIFY_STATUS_CHANGE_2: ::DWORD = 2; -pub const SERVICE_NOTIFY_STATUS_CHANGE: ::DWORD = SERVICE_NOTIFY_STATUS_CHANGE_2; -pub const SERVICE_NOTIFY_STOPPED: ::DWORD = 0x00000001; -pub const SERVICE_NOTIFY_START_PENDING: ::DWORD = 0x00000002; -pub const SERVICE_NOTIFY_STOP_PENDING: ::DWORD = 0x00000004; -pub const SERVICE_NOTIFY_RUNNING: ::DWORD = 0x00000008; -pub const SERVICE_NOTIFY_CONTINUE_PENDING: ::DWORD = 0x00000010; -pub const SERVICE_NOTIFY_PAUSE_PENDING: ::DWORD = 0x00000020; -pub const SERVICE_NOTIFY_PAUSED: ::DWORD = 0x00000040; -pub const SERVICE_NOTIFY_CREATED: ::DWORD = 0x00000080; -pub const SERVICE_NOTIFY_DELETED: ::DWORD = 0x00000100; -pub const SERVICE_NOTIFY_DELETE_PENDING: ::DWORD = 0x00000200; -pub const SERVICE_STOP_REASON_FLAG_MIN: ::DWORD = 0x00000000; -pub const SERVICE_STOP_REASON_FLAG_UNPLANNED: ::DWORD = 0x10000000; -pub const SERVICE_STOP_REASON_FLAG_CUSTOM: ::DWORD = 0x20000000; -pub const SERVICE_STOP_REASON_FLAG_PLANNED: ::DWORD = 0x40000000; -pub const SERVICE_STOP_REASON_FLAG_MAX: ::DWORD = 0x80000000; -pub const SERVICE_STOP_REASON_MAJOR_MIN: ::DWORD = 0x00000000; -pub const SERVICE_STOP_REASON_MAJOR_OTHER: ::DWORD = 0x00010000; -pub const SERVICE_STOP_REASON_MAJOR_HARDWARE: ::DWORD = 0x00020000; -pub const SERVICE_STOP_REASON_MAJOR_OPERATINGSYSTEM: ::DWORD = 0x00030000; -pub const SERVICE_STOP_REASON_MAJOR_SOFTWARE: ::DWORD = 0x00040000; -pub const SERVICE_STOP_REASON_MAJOR_APPLICATION: ::DWORD = 0x00050000; -pub const SERVICE_STOP_REASON_MAJOR_NONE: ::DWORD = 0x00060000; -pub const SERVICE_STOP_REASON_MAJOR_MAX: ::DWORD = 0x00070000; -pub const SERVICE_STOP_REASON_MAJOR_MIN_CUSTOM: ::DWORD = 0x00400000; -pub const SERVICE_STOP_REASON_MAJOR_MAX_CUSTOM: ::DWORD = 0x00ff0000; -pub const SERVICE_STOP_REASON_MINOR_MIN: ::DWORD = 0x00000000; -pub const SERVICE_STOP_REASON_MINOR_OTHER: ::DWORD = 0x00000001; -pub const SERVICE_STOP_REASON_MINOR_MAINTENANCE: ::DWORD = 0x00000002; -pub const SERVICE_STOP_REASON_MINOR_INSTALLATION: ::DWORD = 0x00000003; -pub const SERVICE_STOP_REASON_MINOR_UPGRADE: ::DWORD = 0x00000004; -pub const SERVICE_STOP_REASON_MINOR_RECONFIG: ::DWORD = 0x00000005; -pub const SERVICE_STOP_REASON_MINOR_HUNG: ::DWORD = 0x00000006; -pub const SERVICE_STOP_REASON_MINOR_UNSTABLE: ::DWORD = 0x00000007; -pub const SERVICE_STOP_REASON_MINOR_DISK: ::DWORD = 0x00000008; -pub const SERVICE_STOP_REASON_MINOR_NETWORKCARD: ::DWORD = 0x00000009; -pub const SERVICE_STOP_REASON_MINOR_ENVIRONMENT: ::DWORD = 0x0000000a; -pub const SERVICE_STOP_REASON_MINOR_HARDWARE_DRIVER: ::DWORD = 0x0000000b; -pub const SERVICE_STOP_REASON_MINOR_OTHERDRIVER: ::DWORD = 0x0000000c; -pub const SERVICE_STOP_REASON_MINOR_SERVICEPACK: ::DWORD = 0x0000000d; -pub const SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE: ::DWORD = 0x0000000e; -pub const SERVICE_STOP_REASON_MINOR_SECURITYFIX: ::DWORD = 0x0000000f; -pub const SERVICE_STOP_REASON_MINOR_SECURITY: ::DWORD = 0x00000010; -pub const SERVICE_STOP_REASON_MINOR_NETWORK_CONNECTIVITY: ::DWORD = 0x00000011; -pub const SERVICE_STOP_REASON_MINOR_WMI: ::DWORD = 0x00000012; -pub const SERVICE_STOP_REASON_MINOR_SERVICEPACK_UNINSTALL: ::DWORD = 0x00000013; -pub const SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE_UNINSTALL: ::DWORD = 0x00000014; -pub const SERVICE_STOP_REASON_MINOR_SECURITYFIX_UNINSTALL: ::DWORD = 0x00000015; -pub const SERVICE_STOP_REASON_MINOR_MMC: ::DWORD = 0x00000016; -pub const SERVICE_STOP_REASON_MINOR_NONE: ::DWORD = 0x00000017; -pub const SERVICE_STOP_REASON_MINOR_MAX: ::DWORD = 0x00000018; -pub const SERVICE_STOP_REASON_MINOR_MIN_CUSTOM: ::DWORD = 0x00000100; -pub const SERVICE_STOP_REASON_MINOR_MAX_CUSTOM: ::DWORD = 0x0000FFFF; -pub const SERVICE_CONTROL_STATUS_REASON_INFO: ::DWORD = 1; -pub const SERVICE_SID_TYPE_NONE: ::DWORD = 0x00000000; -pub const SERVICE_SID_TYPE_UNRESTRICTED: ::DWORD = 0x00000001; -pub const SERVICE_SID_TYPE_RESTRICTED: ::DWORD = 0x00000002 | SERVICE_SID_TYPE_UNRESTRICTED; -pub const SERVICE_TRIGGER_TYPE_DEVICE_INTERFACE_ARRIVAL: ::DWORD = 1; -pub const SERVICE_TRIGGER_TYPE_IP_ADDRESS_AVAILABILITY: ::DWORD = 2; -pub const SERVICE_TRIGGER_TYPE_DOMAIN_JOIN: ::DWORD = 3; -pub const SERVICE_TRIGGER_TYPE_FIREWALL_PORT_EVENT: ::DWORD = 4; -pub const SERVICE_TRIGGER_TYPE_GROUP_POLICY: ::DWORD = 5; -pub const SERVICE_TRIGGER_TYPE_NETWORK_ENDPOINT: ::DWORD = 6; -pub const SERVICE_TRIGGER_TYPE_CUSTOM_SYSTEM_STATE_CHANGE: ::DWORD = 7; -pub const SERVICE_TRIGGER_TYPE_CUSTOM: ::DWORD = 20; -pub const SERVICE_TRIGGER_DATA_TYPE_BINARY: ::DWORD = 1; -pub const SERVICE_TRIGGER_DATA_TYPE_STRING: ::DWORD = 2; -pub const SERVICE_TRIGGER_DATA_TYPE_LEVEL: ::DWORD = 3; -pub const SERVICE_TRIGGER_DATA_TYPE_KEYWORD_ANY: ::DWORD = 4; -pub const SERVICE_TRIGGER_DATA_TYPE_KEYWORD_ALL: ::DWORD = 5; -pub const SERVICE_START_REASON_DEMAND: ::DWORD = 0x00000001; -pub const SERVICE_START_REASON_AUTO: ::DWORD = 0x00000002; -pub const SERVICE_START_REASON_TRIGGER: ::DWORD = 0x00000004; -pub const SERVICE_START_REASON_RESTART_ON_FAILURE: ::DWORD = 0x00000008; -pub const SERVICE_START_REASON_DELAYEDAUTO: ::DWORD = 0x00000010; -pub const SERVICE_DYNAMIC_INFORMATION_LEVEL_START_REASON: ::DWORD = 1; -pub const SERVICE_LAUNCH_PROTECTED_NONE: ::DWORD = 0; -pub const SERVICE_LAUNCH_PROTECTED_WINDOWS: ::DWORD = 1; -pub const SERVICE_LAUNCH_PROTECTED_WINDOWS_LIGHT: ::DWORD = 2; -pub const SERVICE_LAUNCH_PROTECTED_ANTIMALWARE_LIGHT: ::DWORD = 3; -//678 -DECLARE_HANDLE!(SC_HANDLE, SC_HANDLE__); -pub type LPSC_HANDLE = *mut SC_HANDLE; -DECLARE_HANDLE!(SERVICE_STATUS_HANDLE, SERVICE_STATUS_HANDLE__); -ENUM!{enum SC_STATUS_TYPE { - SC_STATUS_PROCESS_INFO = 0, -}} -ENUM!{enum _SC_ENUM_TYPE { - SC_ENUM_PROCESS_INFO = 0, -}} -//700 -STRUCT!{struct SERVICE_STATUS { - dwServiceType: ::DWORD, - dwCurrentState: ::DWORD, - dwControlsAccepted: ::DWORD, - dwWin32ExitCode: ::DWORD, - dwServiceSpecificExitCode: ::DWORD, - dwCheckPoint: ::DWORD, - dwWaitHint: ::DWORD, -}} -pub type LPSERVICE_STATUS = *mut SERVICE_STATUS; -//848 -pub type LPSERVICE_MAIN_FUNCTIONW = Option; -pub type LPSERVICE_MAIN_FUNCTIONA = Option; -STRUCT!{nodebug struct SERVICE_TABLE_ENTRYA { - lpServiceName: ::LPCSTR, - lpServiceProc: LPSERVICE_MAIN_FUNCTIONA, -}} -pub type LPSERVICE_TABLE_ENTRYA = *mut SERVICE_TABLE_ENTRYA; -STRUCT!{nodebug struct SERVICE_TABLE_ENTRYW { - lpServiceName: ::LPCWSTR, - lpServiceProc: LPSERVICE_MAIN_FUNCTIONW, -}} -pub type LPSERVICE_TABLE_ENTRYW = *mut SERVICE_TABLE_ENTRYW; -//900 -pub type LPHANDLER_FUNCTION = Option; -pub type LPHANDLER_FUNCTION_EX = Option ::DWORD>; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/winusbio.rs cargo-0.37.0/vendor/winapi-0.2.8/src/winusbio.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/winusbio.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/winusbio.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -// Copyright © 2016, bitbegin -// Licensed under the MIT License -//! USBIO Definitions. -STRUCT!{struct WINUSB_PIPE_INFORMATION { - PipeType: ::USBD_PIPE_TYPE, - PipeId: ::UCHAR, - MaximumPacketSize: ::USHORT, - Interval: ::UCHAR, -}} -pub type PWINUSB_PIPE_INFORMATION = *mut WINUSB_PIPE_INFORMATION; -STRUCT!{struct WINUSB_PIPE_INFORMATION_EX { - PipeType: ::USBD_PIPE_TYPE, - PipeId: ::UCHAR, - MaximumPacketSize: ::USHORT, - Interval: ::UCHAR, - MaximumBytesPerInterval: ::ULONG, -}} -pub type PWINUSB_PIPE_INFORMATION_EX = *mut WINUSB_PIPE_INFORMATION_EX; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/winusb.rs cargo-0.37.0/vendor/winapi-0.2.8/src/winusb.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/winusb.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/winusb.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -// Copyright © 2016, bitbegin -// Licensed under the MIT License -//! FFI bindings to winusb. -pub type WINUSB_INTERFACE_HANDLE = ::PVOID; -pub type PWINUSB_INTERFACE_HANDLE = *mut ::PVOID; -pub type WINUSB_ISOCH_BUFFER_HANDLE = ::PVOID; -pub type PWINUSB_ISOCH_BUFFER_HANDLE = *mut ::PVOID; -STRUCT!{#[repr(packed)] struct WINUSB_SETUP_PACKET { - RequestType: ::UCHAR, - Request: ::UCHAR, - Value: ::USHORT, - Index: ::USHORT, - Length: ::USHORT, -}} -pub type PWINUSB_SETUP_PACKET = *mut WINUSB_SETUP_PACKET; - -STRUCT!{struct USB_INTERFACE_DESCRIPTOR { - bLength: ::UCHAR, - bDescriptorType: ::UCHAR, - bInterfaceNumber: ::UCHAR, - bAlternateSetting: ::UCHAR, - bNumEndpoints: ::UCHAR, - bInterfaceClass: ::UCHAR, - bInterfaceSubClass: ::UCHAR, - bInterfaceProtocol: ::UCHAR, - iInterface: ::UCHAR, -}} -pub type PUSB_INTERFACE_DESCRIPTOR = *mut USB_INTERFACE_DESCRIPTOR; -#[test] -fn test_USB_INTERFACE_DESCRIPTOR_size() { - use std::mem::size_of; - assert_eq!(size_of::(), 9) -} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/winuser.rs cargo-0.37.0/vendor/winapi-0.2.8/src/winuser.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/winuser.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/winuser.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,2334 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! USER procedure declarations, constant definitions and macros - -// Edit Control Styles -// -pub const ES_LEFT: ::DWORD = 0x0000; -pub const ES_CENTER: ::DWORD = 0x0001; -pub const ES_RIGHT: ::DWORD = 0x0002; -pub const ES_MULTILINE: ::DWORD = 0x0004; -pub const ES_UPPERCASE: ::DWORD = 0x0008; -pub const ES_LOWERCASE: ::DWORD = 0x0010; -pub const ES_PASSWORD: ::DWORD = 0x0020; -pub const ES_AUTOVSCROLL: ::DWORD = 0x0040; -pub const ES_AUTOHSCROLL: ::DWORD = 0x0080; -pub const ES_NOHIDESEL: ::DWORD = 0x0100; -pub const ES_OEMCONVERT: ::DWORD = 0x0400; -pub const ES_READONLY: ::DWORD = 0x0800; -pub const ES_WANTRETURN: ::DWORD = 0x1000; -pub const ES_NUMBER: ::DWORD = 0x2000; - -// Edit Control Notification Codes -// -pub const EN_SETFOCUS: ::WORD = 0x0100; -pub const EN_KILLFOCUS: ::WORD = 0x0200; -pub const EN_CHANGE: ::WORD = 0x0300; -pub const EN_UPDATE: ::WORD = 0x0400; -pub const EN_ERRSPACE: ::WORD = 0x0500; -pub const EN_MAXTEXT: ::WORD = 0x0501; -pub const EN_HSCROLL: ::WORD = 0x0601; -pub const EN_VSCROLL: ::WORD = 0x0602; - -pub const EN_ALIGN_LTR_EC: ::WORD = 0x0700; -pub const EN_ALIGN_RTL_EC: ::WORD = 0x0701; - -// Edit control EM_SETMARGIN parameters -pub const EC_LEFTMARGIN: ::WORD = 0x0001; -pub const EC_RIGHTMARGIN: ::WORD = 0x0002; -pub const EC_USEFONTINFO: ::WORD = 0xffff; - -// wParam of EM_GET/SETIMESTATUS -pub const EMSIS_COMPOSITIONSTRING: ::WORD = 0x0001; - -// lParam for EMSIS_COMPOSITIONSTRING -pub const EIMES_GETCOMPSTRATONCE: ::WORD = 0x0001; -pub const EIMES_CANCELCOMPSTRINFOCUS: ::WORD = 0x0002; -pub const EIMES_COMPLETECOMPSTRKILLFOCUS: ::WORD = 0x0004; - -// Edit Control Messages -// -pub const EM_GETSEL: ::WORD = 0x00B0; -pub const EM_SETSEL: ::WORD = 0x00B1; -pub const EM_GETRECT: ::WORD = 0x00B2; -pub const EM_SETRECT: ::WORD = 0x00B3; -pub const EM_SETRECTNP: ::WORD = 0x00B4; -pub const EM_SCROLL: ::WORD = 0x00B5; -pub const EM_LINESCROLL: ::WORD = 0x00B6; -pub const EM_SCROLLCARET: ::WORD = 0x00B7; -pub const EM_GETMODIFY: ::WORD = 0x00B8; -pub const EM_SETMODIFY: ::WORD = 0x00B9; -pub const EM_GETLINECOUNT: ::WORD = 0x00BA; -pub const EM_LINEINDEX: ::WORD = 0x00BB; -pub const EM_SETHANDLE: ::WORD = 0x00BC; -pub const EM_GETHANDLE: ::WORD = 0x00BD; -pub const EM_GETTHUMB: ::WORD = 0x00BE; -pub const EM_LINELENGTH: ::WORD = 0x00C1; -pub const EM_REPLACESEL: ::WORD = 0x00C2; -pub const EM_GETLINE: ::WORD = 0x00C4; -pub const EM_LIMITTEXT: ::WORD = 0x00C5; -pub const EM_CANUNDO: ::WORD = 0x00C6; -pub const EM_UNDO: ::WORD = 0x00C7; -pub const EM_FMTLINES: ::WORD = 0x00C8; -pub const EM_LINEFROMCHAR: ::WORD = 0x00C9; -pub const EM_SETTABSTOPS: ::WORD = 0x00CB; -pub const EM_SETPASSWORDCHAR: ::WORD = 0x00CC; -pub const EM_EMPTYUNDOBUFFER: ::WORD = 0x00CD; -pub const EM_GETFIRSTVISIBLELINE: ::WORD = 0x00CE; -pub const EM_SETREADONLY: ::WORD = 0x00CF; -pub const EM_SETWORDBREAKPROC: ::WORD = 0x00D0; -pub const EM_GETWORDBREAKPROC: ::WORD = 0x00D1; -pub const EM_GETPASSWORDCHAR: ::WORD = 0x00D2; - -pub const EM_SETMARGINS: ::WORD = 0x00D3; -pub const EM_GETMARGINS: ::WORD = 0x00D4; -pub const EM_SETLIMITTEXT: ::WORD = EM_LIMITTEXT; -pub const EM_GETLIMITTEXT: ::WORD = 0x00D5; -pub const EM_POSFROMCHAR: ::WORD = 0x00D6; -pub const EM_CHARFROMPOS: ::WORD = 0x00D7; - -pub const EM_SETIMESTATUS: ::WORD = 0x00D8; -pub const EM_GETIMESTATUS: ::WORD = 0x00D9; - -// EDITWORDBREAKPROC code values -// -pub const WB_LEFT: ::WORD = 0; -pub const WB_RIGHT: ::WORD = 1; -pub const WB_ISDELIMITER: ::WORD = 2; - -pub const BN_CLICKED: ::WORD = 0; -pub const BN_PAINT: ::WORD = 1; -pub const BN_HILITE: ::WORD = 2; -pub const BN_UNHILITE: ::WORD = 3; -pub const BN_DISABLE: ::WORD = 4; -pub const BN_DOUBLECLICKED: ::WORD = 5; -pub const BN_PUSHED: ::WORD = BN_HILITE; -pub const BN_UNPUSHED: ::WORD = BN_UNHILITE; -pub const BN_DBLCLK: ::WORD = BN_DOUBLECLICKED; -pub const BN_SETFOCUS: ::WORD = 6; -pub const BN_KILLFOCUS: ::WORD = 7; -pub const BS_PUSHBUTTON: ::DWORD = 0x00000000; -pub const BS_DEFPUSHBUTTON: ::DWORD = 0x00000001; -pub const BS_CHECKBOX: ::DWORD = 0x00000002; -pub const BS_AUTOCHECKBOX: ::DWORD = 0x00000003; -pub const BS_RADIOBUTTON: ::DWORD = 0x00000004; -pub const BS_3STATE: ::DWORD = 0x00000005; -pub const BS_AUTO3STATE: ::DWORD = 0x00000006; -pub const BS_GROUPBOX: ::DWORD = 0x00000007; -pub const BS_USERBUTTON: ::DWORD = 0x00000008; -pub const BS_AUTORADIOBUTTON: ::DWORD = 0x00000009; -pub const BS_PUSHBOX: ::DWORD = 0x0000000A; -pub const BS_OWNERDRAW: ::DWORD = 0x0000000B; -pub const BS_TYPEMASK: ::DWORD = 0x0000000F; -pub const BS_LEFTTEXT: ::DWORD = 0x00000020; -pub const BS_TEXT: ::DWORD = 0x00000000; -pub const BS_ICON: ::DWORD = 0x00000040; -pub const BS_BITMAP: ::DWORD = 0x00000080; -pub const BS_LEFT: ::DWORD = 0x00000100; -pub const BS_RIGHT: ::DWORD = 0x00000200; -pub const BS_CENTER: ::DWORD = 0x00000300; -pub const BS_TOP: ::DWORD = 0x00000400; -pub const BS_BOTTOM: ::DWORD = 0x00000800; -pub const BS_VCENTER: ::DWORD = 0x00000C00; -pub const BS_PUSHLIKE: ::DWORD = 0x00001000; -pub const BS_MULTILINE: ::DWORD = 0x00002000; -pub const BS_NOTIFY: ::DWORD = 0x00004000; -pub const BS_FLAT: ::DWORD = 0x00008000; -pub const BS_RIGHTBUTTON: ::DWORD = BS_LEFTTEXT; -pub const CCHILDREN_SCROLLBAR: usize = 5; -pub const CDS_UPDATEREGISTRY: ::DWORD = 0x00000001; -pub const CDS_TEST: ::DWORD = 0x00000002; -pub const CDS_FULLSCREEN: ::DWORD = 0x00000004; -pub const CDS_GLOBAL: ::DWORD = 0x00000008; -pub const CDS_SET_PRIMARY: ::DWORD = 0x00000010; -pub const CDS_VIDEOPARAMETERS: ::DWORD = 0x00000020; -pub const CDS_ENABLE_UNSAFE_MODES: ::DWORD = 0x00000100; -pub const CDS_DISABLE_UNSAFE_MODES: ::DWORD = 0x00000200; -pub const CDS_RESET: ::DWORD = 0x40000000; -pub const CDS_RESET_EX: ::DWORD = 0x20000000; -pub const CDS_NORESET: ::DWORD = 0x10000000; -pub const CF_TEXT: ::UINT = 1; -pub const CF_BITMAP: ::UINT = 2; -pub const CF_METAFILEPICT: ::UINT = 3; -pub const CF_SYLK: ::UINT = 4; -pub const CF_DIF: ::UINT = 5; -pub const CF_TIFF: ::UINT = 6; -pub const CF_OEMTEXT: ::UINT = 7; -pub const CF_DIB: ::UINT = 8; -pub const CF_PALETTE: ::UINT = 9; -pub const CF_PENDATA: ::UINT = 10; -pub const CF_RIFF: ::UINT = 11; -pub const CF_WAVE: ::UINT = 12; -pub const CF_UNICODETEXT: ::UINT = 13; -pub const CF_ENHMETAFILE: ::UINT = 14; -pub const CF_HDROP: ::UINT = 15; -pub const CF_LOCALE: ::UINT = 16; -pub const CF_DIBV5: ::UINT = 17; -pub const CF_OWNERDISPLAY: ::UINT = 0x0080; -pub const CF_DSPTEXT: ::UINT = 0x0081; -pub const CF_DSPBITMAP: ::UINT = 0x0082; -pub const CF_DSPENHMETAFILE: ::UINT = 0x008E; -pub const CF_DSPMETAFILEPICT: ::UINT = 0x0083; -pub const CF_PRIVATEFIRST: ::UINT = 0x0200; -pub const CF_PRIVATELAST: ::UINT = 0x02FF; -pub const CF_GDIOBJFIRST: ::UINT = 0x0300; -pub const CF_GDIOBJLAST: ::UINT = 0x03FF; -pub const CS_VREDRAW: ::DWORD = 0x0001; -pub const CS_HREDRAW: ::DWORD = 0x0002; -pub const CS_DBLCLKS: ::DWORD = 0x0008; -pub const CS_OWNDC: ::DWORD = 0x0020; -pub const CS_CLASSDC: ::DWORD = 0x0040; -pub const CS_PARENTDC: ::DWORD = 0x0080; -pub const CS_NOCLOSE: ::DWORD = 0x0200; -pub const CS_SAVEBITS: ::DWORD = 0x0800; -pub const CS_BYTEALIGNCLIENT: ::DWORD = 0x1000; -pub const CS_BYTEALIGNWINDOW: ::DWORD = 0x2000; -pub const CS_GLOBALCLASS: ::DWORD = 0x4000; -pub const CS_IME: ::DWORD = 0x00010000; -pub const CS_DROPSHADOW: ::DWORD = 0x00020000; -pub const DFC_CAPTION: ::UINT = 1; -pub const DFC_MENU: ::UINT = 2; -pub const DFC_SCROLL: ::UINT = 3; -pub const DFC_BUTTON: ::UINT = 4; -pub const DFCS_CAPTIONCLOSE: ::UINT = 0x0000; -pub const DFCS_CAPTIONMIN: ::UINT = 0x0001; -pub const DFCS_CAPTIONMAX: ::UINT = 0x0002; -pub const DFCS_CAPTIONRESTORE: ::UINT = 0x0003; -pub const DFCS_CAPTIONHELP: ::UINT = 0x0004; -pub const DFCS_MENUARROW: ::UINT = 0x0000; -pub const DFCS_MENUCHECK: ::UINT = 0x0001; -pub const DFCS_MENUBULLET: ::UINT = 0x0002; -pub const DFCS_MENUARROWRIGHT: ::UINT = 0x0004; -pub const DFCS_SCROLLUP: ::UINT = 0x0000; -pub const DFCS_SCROLLDOWN: ::UINT = 0x0001; -pub const DFCS_SCROLLLEFT: ::UINT = 0x0002; -pub const DFCS_SCROLLRIGHT: ::UINT = 0x0003; -pub const DFCS_SCROLLCOMBOBOX: ::UINT = 0x0005; -pub const DFCS_SCROLLSIZEGRIP: ::UINT = 0x0008; -pub const DFCS_SCROLLSIZEGRIPRIGHT: ::UINT = 0x0010; -pub const DFCS_BUTTONCHECK: ::UINT = 0x0000; -pub const DFCS_BUTTONRADIOIMAGE: ::UINT = 0x0001; -pub const DFCS_BUTTONRADIOMASK: ::UINT = 0x0002; -pub const DFCS_BUTTONRADIO: ::UINT = 0x0004; -pub const DFCS_BUTTON3STATE: ::UINT = 0x0008; -pub const DFCS_BUTTONPUSH: ::UINT = 0x0010; -pub const DFCS_INACTIVE: ::UINT = 0x0100; -pub const DFCS_PUSHED: ::UINT = 0x0200; -pub const DFCS_CHECKED: ::UINT = 0x0400; -// if WINVER >= 0x0500 -pub const DFCS_TRANSPARENT: ::UINT = 0x0800; -pub const DFCS_HOT: ::UINT = 0x1000; -// end if WINVER >= 0x0500 -pub const DFCS_ADJUSTRECT: ::UINT = 0x2000; -pub const DFCS_FLAT: ::UINT = 0x4000; -pub const DFCS_MONO: ::UINT = 0x8000; -pub const CW_USEDEFAULT: ::c_int = 0x80000000u32 as ::c_int; -pub const DISP_CHANGE_SUCCESSFUL: ::LONG = 0; -pub const DISP_CHANGE_RESTART: ::LONG = 1; -pub const DISP_CHANGE_FAILED: ::LONG = -1; -pub const DISP_CHANGE_BADMODE: ::LONG = -2; -pub const DISP_CHANGE_NOTUPDATED: ::LONG = -3; -pub const DISP_CHANGE_BADFLAGS: ::LONG = -4; -pub const DISP_CHANGE_BADPARAM: ::LONG = -5; -pub const DISP_CHANGE_BADDUALVIEW: ::LONG = -6; -pub const EDD_GET_DEVICE_INTERFACE_NAME: ::DWORD = 0x00000001; -pub const ENUM_CURRENT_SETTINGS: ::DWORD = 0xFFFFFFFF; -pub const ENUM_REGISTRY_SETTINGS: ::DWORD = 0xFFFFFFFE; -pub const GW_HWNDFIRST: ::UINT = 0; -pub const GW_HWNDLAST: ::UINT = 1; -pub const GW_HWNDNEXT: ::UINT = 2; -pub const GW_HWNDPREV: ::UINT = 3; -pub const GW_OWNER: ::UINT = 4; -pub const GW_CHILD: ::UINT = 5; -pub const GW_ENABLEDPOPUP: ::UINT = 6; -pub const GW_MAX: ::UINT = 6; -pub const HTERROR: ::c_int = -2; -pub const HTTRANSPARENT: ::c_int = -1; -pub const HTNOWHERE: ::c_int = 0; -pub const HTCLIENT: ::c_int = 1; -pub const HTCAPTION: ::c_int = 2; -pub const HTSYSMENU: ::c_int = 3; -pub const HTGROWBOX: ::c_int = 4; -pub const HTSIZE: ::c_int = HTGROWBOX; -pub const HTMENU: ::c_int = 5; -pub const HTHSCROLL: ::c_int = 6; -pub const HTVSCROLL: ::c_int = 7; -pub const HTMINBUTTON: ::c_int = 8; -pub const HTMAXBUTTON: ::c_int = 9; -pub const HTLEFT: ::c_int = 10; -pub const HTRIGHT: ::c_int = 11; -pub const HTTOP: ::c_int = 12; -pub const HTTOPLEFT: ::c_int = 13; -pub const HTTOPRIGHT: ::c_int = 14; -pub const HTBOTTOM: ::c_int = 15; -pub const HTBOTTOMLEFT: ::c_int = 16; -pub const HTBOTTOMRIGHT: ::c_int = 17; -pub const HTBORDER: ::c_int = 18; -pub const HTREDUCE: ::c_int = HTMINBUTTON; -pub const HTZOOM: ::c_int = HTMAXBUTTON; -pub const HTSIZEFIRST: ::c_int = HTLEFT; -pub const HTSIZELAST: ::c_int = HTBOTTOMRIGHT; -pub const HTOBJECT: ::c_int = 19; -pub const HTCLOSE: ::c_int = 20; -pub const HTHELP: ::c_int = 21; -pub const LSFW_LOCK: ::UINT = 1; -pub const LSFW_UNLOCK: ::UINT = 2; -pub const MDITILE_VERTICAL: ::UINT = 0x0000; -pub const MDITILE_HORIZONTAL: ::UINT = 0x0001; -pub const MDITILE_SKIPDISABLED: ::UINT = 0x0002; -pub const MDITILE_ZORDER: ::UINT = 0x0004; -pub const MB_OK: ::DWORD = 0x00000000; -pub const MB_OKCANCEL: ::DWORD = 0x00000001; -pub const MB_ABORTRETRYIGNORE: ::DWORD = 0x00000002; -pub const MB_YESNOCANCEL: ::DWORD = 0x00000003; -pub const MB_YESNO: ::DWORD = 0x00000004; -pub const MB_RETRYCANCEL: ::DWORD = 0x00000005; -pub const MB_CANCELTRYCONTINUE: ::DWORD = 0x00000006; -pub const MB_ICONHAND: ::DWORD = 0x00000010; -pub const MB_ICONQUESTION: ::DWORD = 0x00000020; -pub const MB_ICONEXCLAMATION: ::DWORD = 0x00000030; -pub const MB_ICONASTERISK: ::DWORD = 0x00000040; -pub const MB_USERICON: ::DWORD = 0x00000080; -pub const MB_ICONWARNING: ::DWORD = MB_ICONEXCLAMATION; -pub const MB_ICONERROR: ::DWORD = MB_ICONHAND; -pub const MB_ICONINFORMATION: ::DWORD = MB_ICONASTERISK; -pub const MB_ICONSTOP: ::DWORD = MB_ICONHAND; -pub const MB_DEFBUTTON1: ::DWORD = 0x00000000; -pub const MB_DEFBUTTON2: ::DWORD = 0x00000100; -pub const MB_DEFBUTTON3: ::DWORD = 0x00000200; -pub const MB_DEFBUTTON4: ::DWORD = 0x00000300; -pub const MB_APPLMODAL: ::DWORD = 0x00000000; -pub const MB_SYSTEMMODAL: ::DWORD = 0x00001000; -pub const MB_TASKMODAL: ::DWORD = 0x00002000; -pub const MB_HELP: ::DWORD = 0x00004000; -pub const MB_NOFOCUS: ::DWORD = 0x00008000; -pub const MB_SETFOREGROUND: ::DWORD = 0x00010000; -pub const MB_DEFAULT_DESKTOP_ONLY: ::DWORD = 0x00020000; -pub const MB_TOPMOST: ::DWORD = 0x00040000; -pub const MB_RIGHT: ::DWORD = 0x00080000; -pub const MB_RTLREADING: ::DWORD = 0x00100000; -pub const MB_SERVICE_NOTIFICATION: ::DWORD = 0x00200000; -pub const MB_SERVICE_NOTIFICATION_NT3X: ::DWORD = 0x00040000; -pub const MB_TYPEMASK: ::DWORD = 0x0000000F; -pub const MB_ICONMASK: ::DWORD = 0x000000F0; -pub const MB_DEFMASK: ::DWORD = 0x00000F00; -pub const MB_MODEMASK: ::DWORD = 0x00003000; -pub const MB_MISCMASK: ::DWORD = 0x0000C000; -pub const MF_BITMAP: ::UINT = 0x00000004; -pub const MF_CHECKED: ::UINT = 0x00000008; -pub const MF_DISABLED: ::UINT = 0x00000002; -pub const MF_ENABLED: ::UINT = 0x00000000; -pub const MF_GRAYED: ::UINT = 0x00000001; -pub const MF_MENUBARBREAK: ::UINT = 0x00000020; -pub const MF_MENUBREAK: ::UINT = 0x00000040; -pub const MF_OWNERDRAW: ::UINT = 0x00000100; -pub const MF_POPUP: ::UINT = 0x00000010; -pub const MF_SEPARATOR: ::UINT = 0x00000800; -pub const MF_STRING: ::UINT = 0x00000000; -pub const MF_UNCHECKED: ::UINT = 0x00000000; -pub const SB_HORZ: ::c_int = 0; -pub const SB_VERT: ::c_int = 1; -pub const SB_CTL: ::c_int = 2; -pub const SB_BOTH: ::c_int = 3; -pub const SW_HIDE: ::c_int = 0; -pub const SW_SHOWNORMAL: ::c_int = 1; -pub const SW_NORMAL: ::c_int = 1; -pub const SW_SHOWMINIMIZED: ::c_int = 2; -pub const SW_SHOWMAXIMIZED: ::c_int = 3; -pub const SW_MAXIMIZE: ::c_int = 3; -pub const SW_SHOWNOACTIVATE: ::c_int = 4; -pub const SW_SHOW: ::c_int = 5; -pub const SW_MINIMIZE: ::c_int = 6; -pub const SW_SHOWMINNOACTIVE: ::c_int = 7; -pub const SW_SHOWNA: ::c_int = 8; -pub const SW_RESTORE: ::c_int = 9; -pub const SW_SHOWDEFAULT: ::c_int = 10; -pub const SW_FORCEMINIMIZE: ::c_int = 11; -pub const SW_MAX: ::c_int = 11; -pub const SWP_NOSIZE: ::UINT = 0x0001; -pub const SWP_NOMOVE: ::UINT = 0x0002; -pub const SWP_NOZORDER: ::UINT = 0x0004; -pub const SWP_NOREDRAW: ::UINT = 0x0008; -pub const SWP_NOACTIVATE: ::UINT = 0x0010; -pub const SWP_FRAMECHANGED: ::UINT = 0x0020; -pub const SWP_SHOWWINDOW: ::UINT = 0x0040; -pub const SWP_HIDEWINDOW: ::UINT = 0x0080; -pub const SWP_NOCOPYBITS: ::UINT = 0x0100; -pub const SWP_NOOWNERZORDER: ::UINT = 0x0200; -pub const SWP_NOSENDCHANGING: ::UINT = 0x0400; -pub const SWP_DRAWFRAME: ::UINT = SWP_FRAMECHANGED; -pub const SWP_NOREPOSITION: ::UINT = SWP_NOOWNERZORDER; -pub const SWP_DEFERERASE: ::UINT = 0x2000; -pub const SWP_ASYNCWINDOWPOS: ::UINT = 0x4000; -pub const VK_LBUTTON: ::c_int = 0x01; -pub const VK_RBUTTON: ::c_int = 0x02; -pub const VK_CANCEL: ::c_int = 0x03; -pub const VK_MBUTTON: ::c_int = 0x04; -pub const VK_XBUTTON1: ::c_int = 0x05; -pub const VK_XBUTTON2: ::c_int = 0x06; -pub const VK_BACK: ::c_int = 0x08; -pub const VK_TAB: ::c_int = 0x09; -pub const VK_CLEAR: ::c_int = 0x0C; -pub const VK_RETURN: ::c_int = 0x0D; -pub const VK_SHIFT: ::c_int = 0x10; -pub const VK_CONTROL: ::c_int = 0x11; -pub const VK_MENU: ::c_int = 0x12; -pub const VK_PAUSE: ::c_int = 0x13; -pub const VK_CAPITAL: ::c_int = 0x14; -pub const VK_KANA: ::c_int = 0x15; -pub const VK_HANGUEL: ::c_int = 0x15; -pub const VK_HANGUL: ::c_int = 0x15; -pub const VK_JUNJA: ::c_int = 0x17; -pub const VK_FINAL: ::c_int = 0x18; -pub const VK_HANJA: ::c_int = 0x19; -pub const VK_KANJI: ::c_int = 0x19; -pub const VK_ESCAPE: ::c_int = 0x1B; -pub const VK_CONVERT: ::c_int = 0x1C; -pub const VK_NONCONVERT: ::c_int = 0x1D; -pub const VK_ACCEPT: ::c_int = 0x1E; -pub const VK_MODECHANGE: ::c_int = 0x1F; -pub const VK_SPACE: ::c_int = 0x20; -pub const VK_PRIOR: ::c_int = 0x21; -pub const VK_NEXT: ::c_int = 0x22; -pub const VK_END: ::c_int = 0x23; -pub const VK_HOME: ::c_int = 0x24; -pub const VK_LEFT: ::c_int = 0x25; -pub const VK_UP: ::c_int = 0x26; -pub const VK_RIGHT: ::c_int = 0x27; -pub const VK_DOWN: ::c_int = 0x28; -pub const VK_SELECT: ::c_int = 0x29; -pub const VK_PRINT: ::c_int = 0x2A; -pub const VK_EXECUTE: ::c_int = 0x2B; -pub const VK_SNAPSHOT: ::c_int = 0x2C; -pub const VK_INSERT: ::c_int = 0x2D; -pub const VK_DELETE: ::c_int = 0x2E; -pub const VK_HELP: ::c_int = 0x2F; -pub const VK_LWIN: ::c_int = 0x5B; -pub const VK_RWIN: ::c_int = 0x5C; -pub const VK_APPS: ::c_int = 0x5D; -pub const VK_SLEEP: ::c_int = 0x5F; -pub const VK_NUMPAD0: ::c_int = 0x60; -pub const VK_NUMPAD1: ::c_int = 0x61; -pub const VK_NUMPAD2: ::c_int = 0x62; -pub const VK_NUMPAD3: ::c_int = 0x63; -pub const VK_NUMPAD4: ::c_int = 0x64; -pub const VK_NUMPAD5: ::c_int = 0x65; -pub const VK_NUMPAD6: ::c_int = 0x66; -pub const VK_NUMPAD7: ::c_int = 0x67; -pub const VK_NUMPAD8: ::c_int = 0x68; -pub const VK_NUMPAD9: ::c_int = 0x69; -pub const VK_MULTIPLY: ::c_int = 0x6A; -pub const VK_ADD: ::c_int = 0x6B; -pub const VK_SEPARATOR: ::c_int = 0x6C; -pub const VK_SUBTRACT: ::c_int = 0x6D; -pub const VK_DECIMAL: ::c_int = 0x6E; -pub const VK_DIVIDE: ::c_int = 0x6F; -pub const VK_F1: ::c_int = 0x70; -pub const VK_F2: ::c_int = 0x71; -pub const VK_F3: ::c_int = 0x72; -pub const VK_F4: ::c_int = 0x73; -pub const VK_F5: ::c_int = 0x74; -pub const VK_F6: ::c_int = 0x75; -pub const VK_F7: ::c_int = 0x76; -pub const VK_F8: ::c_int = 0x77; -pub const VK_F9: ::c_int = 0x78; -pub const VK_F10: ::c_int = 0x79; -pub const VK_F11: ::c_int = 0x7A; -pub const VK_F12: ::c_int = 0x7B; -pub const VK_F13: ::c_int = 0x7C; -pub const VK_F14: ::c_int = 0x7D; -pub const VK_F15: ::c_int = 0x7E; -pub const VK_F16: ::c_int = 0x7F; -pub const VK_F17: ::c_int = 0x80; -pub const VK_F18: ::c_int = 0x81; -pub const VK_F19: ::c_int = 0x82; -pub const VK_F20: ::c_int = 0x83; -pub const VK_F21: ::c_int = 0x84; -pub const VK_F22: ::c_int = 0x85; -pub const VK_F23: ::c_int = 0x86; -pub const VK_F24: ::c_int = 0x87; -pub const VK_NUMLOCK: ::c_int = 0x90; -pub const VK_SCROLL: ::c_int = 0x91; -pub const VK_OEM_NEC_EQUAL: ::c_int = 0x92; -pub const VK_OEM_FJ_JISHO: ::c_int = 0x92; -pub const VK_OEM_FJ_MASSHOU: ::c_int = 0x93; -pub const VK_OEM_FJ_TOUROKU: ::c_int = 0x94; -pub const VK_OEM_FJ_LOYA: ::c_int = 0x95; -pub const VK_OEM_FJ_ROYA: ::c_int = 0x96; -pub const VK_LSHIFT: ::c_int = 0xA0; -pub const VK_RSHIFT: ::c_int = 0xA1; -pub const VK_LCONTROL: ::c_int = 0xA2; -pub const VK_RCONTROL: ::c_int = 0xA3; -pub const VK_LMENU: ::c_int = 0xA4; -pub const VK_RMENU: ::c_int = 0xA5; -pub const VK_BROWSER_BACK: ::c_int = 0xA6; -pub const VK_BROWSER_FORWARD: ::c_int = 0xA7; -pub const VK_BROWSER_REFRESH: ::c_int = 0xA8; -pub const VK_BROWSER_STOP: ::c_int = 0xA9; -pub const VK_BROWSER_SEARCH: ::c_int = 0xAA; -pub const VK_BROWSER_FAVORITES: ::c_int = 0xAB; -pub const VK_BROWSER_HOME: ::c_int = 0xAC; -pub const VK_VOLUME_MUTE: ::c_int = 0xAD; -pub const VK_VOLUME_DOWN: ::c_int = 0xAE; -pub const VK_VOLUME_UP: ::c_int = 0xAF; -pub const VK_MEDIA_NEXT_TRACK: ::c_int = 0xB0; -pub const VK_MEDIA_PREV_TRACK: ::c_int = 0xB1; -pub const VK_MEDIA_STOP: ::c_int = 0xB2; -pub const VK_MEDIA_PLAY_PAUSE: ::c_int = 0xB3; -pub const VK_LAUNCH_MAIL: ::c_int = 0xB4; -pub const VK_LAUNCH_MEDIA_SELECT: ::c_int = 0xB5; -pub const VK_LAUNCH_APP1: ::c_int = 0xB6; -pub const VK_LAUNCH_APP2: ::c_int = 0xB7; -pub const VK_OEM_1: ::c_int = 0xBA; -pub const VK_OEM_PLUS: ::c_int = 0xBB; -pub const VK_OEM_COMMA: ::c_int = 0xBC; -pub const VK_OEM_MINUS: ::c_int = 0xBD; -pub const VK_OEM_PERIOD: ::c_int = 0xBE; -pub const VK_OEM_2: ::c_int = 0xBF; -pub const VK_OEM_3: ::c_int = 0xC0; -pub const VK_OEM_4: ::c_int = 0xDB; -pub const VK_OEM_5: ::c_int = 0xDC; -pub const VK_OEM_6: ::c_int = 0xDD; -pub const VK_OEM_7: ::c_int = 0xDE; -pub const VK_OEM_8: ::c_int = 0xDF; -pub const VK_OEM_AX: ::c_int = 0xE1; -pub const VK_OEM_102: ::c_int = 0xE2; -pub const VK_ICO_HELP: ::c_int = 0xE3; -pub const VK_ICO_00: ::c_int = 0xE4; -pub const VK_PROCESSKEY: ::c_int = 0xE5; -pub const VK_ICO_CLEAR: ::c_int = 0xE6; -pub const VK_PACKET: ::c_int = 0xE7; -pub const VK_OEM_RESET: ::c_int = 0xE9; -pub const VK_OEM_JUMP: ::c_int = 0xEA; -pub const VK_OEM_PA1: ::c_int = 0xEB; -pub const VK_OEM_PA2: ::c_int = 0xEC; -pub const VK_OEM_PA3: ::c_int = 0xED; -pub const VK_OEM_WSCTRL: ::c_int = 0xEE; -pub const VK_OEM_CUSEL: ::c_int = 0xEF; -pub const VK_OEM_ATTN: ::c_int = 0xF0; -pub const VK_OEM_FINISH: ::c_int = 0xF1; -pub const VK_OEM_COPY: ::c_int = 0xF2; -pub const VK_OEM_AUTO: ::c_int = 0xF3; -pub const VK_OEM_ENLW: ::c_int = 0xF4; -pub const VK_OEM_BACKTAB: ::c_int = 0xF5; -pub const VK_ATTN: ::c_int = 0xF6; -pub const VK_CRSEL: ::c_int = 0xF7; -pub const VK_EXSEL: ::c_int = 0xF8; -pub const VK_EREOF: ::c_int = 0xF9; -pub const VK_PLAY: ::c_int = 0xFA; -pub const VK_ZOOM: ::c_int = 0xFB; -pub const VK_NONAME: ::c_int = 0xFC; -pub const VK_PA1: ::c_int = 0xFD; -pub const VK_OEM_CLEAR: ::c_int = 0xFE; -// if _WIN32_WINNT >= 0x0500 -pub const APPCOMMAND_BROWSER_BACKWARD: ::c_short = 1; -pub const APPCOMMAND_BROWSER_FORWARD: ::c_short = 2; -pub const APPCOMMAND_BROWSER_REFRESH: ::c_short = 3; -pub const APPCOMMAND_BROWSER_STOP: ::c_short = 4; -pub const APPCOMMAND_BROWSER_SEARCH: ::c_short = 5; -pub const APPCOMMAND_BROWSER_FAVORITES: ::c_short = 6; -pub const APPCOMMAND_BROWSER_HOME: ::c_short = 7; -pub const APPCOMMAND_VOLUME_MUTE: ::c_short = 8; -pub const APPCOMMAND_VOLUME_DOWN: ::c_short = 9; -pub const APPCOMMAND_VOLUME_UP: ::c_short = 10; -pub const APPCOMMAND_MEDIA_NEXTTRACK: ::c_short = 11; -pub const APPCOMMAND_MEDIA_PREVIOUSTRACK: ::c_short = 12; -pub const APPCOMMAND_MEDIA_STOP: ::c_short = 13; -pub const APPCOMMAND_MEDIA_PLAY_PAUSE: ::c_short = 14; -pub const APPCOMMAND_LAUNCH_MAIL: ::c_short = 15; -pub const APPCOMMAND_LAUNCH_MEDIA_SELECT: ::c_short = 16; -pub const APPCOMMAND_LAUNCH_APP1: ::c_short = 17; -pub const APPCOMMAND_LAUNCH_APP2: ::c_short = 18; -pub const APPCOMMAND_BASS_DOWN: ::c_short = 19; -pub const APPCOMMAND_BASS_BOOST: ::c_short = 20; -pub const APPCOMMAND_BASS_UP: ::c_short = 21; -pub const APPCOMMAND_TREBLE_DOWN: ::c_short = 22; -pub const APPCOMMAND_TREBLE_UP: ::c_short = 23; -// if _WIN32_WINNT >= 0x0501 -pub const APPCOMMAND_MICROPHONE_VOLUME_MUTE: ::c_short = 24; -pub const APPCOMMAND_MICROPHONE_VOLUME_DOWN: ::c_short = 25; -pub const APPCOMMAND_MICROPHONE_VOLUME_UP: ::c_short = 26; -pub const APPCOMMAND_HELP: ::c_short = 27; -pub const APPCOMMAND_FIND: ::c_short = 28; -pub const APPCOMMAND_NEW: ::c_short = 29; -pub const APPCOMMAND_OPEN: ::c_short = 30; -pub const APPCOMMAND_CLOSE: ::c_short = 31; -pub const APPCOMMAND_SAVE: ::c_short = 32; -pub const APPCOMMAND_PRINT: ::c_short = 33; -pub const APPCOMMAND_UNDO: ::c_short = 34; -pub const APPCOMMAND_REDO: ::c_short = 35; -pub const APPCOMMAND_COPY: ::c_short = 36; -pub const APPCOMMAND_CUT: ::c_short = 37; -pub const APPCOMMAND_PASTE: ::c_short = 38; -pub const APPCOMMAND_REPLY_TO_MAIL: ::c_short = 39; -pub const APPCOMMAND_FORWARD_MAIL: ::c_short = 40; -pub const APPCOMMAND_SEND_MAIL: ::c_short = 41; -pub const APPCOMMAND_SPELL_CHECK: ::c_short = 42; -pub const APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE: ::c_short = 43; -pub const APPCOMMAND_MIC_ON_OFF_TOGGLE: ::c_short = 44; -pub const APPCOMMAND_CORRECTION_LIST: ::c_short = 45; -pub const APPCOMMAND_MEDIA_PLAY: ::c_short = 46; -pub const APPCOMMAND_MEDIA_PAUSE: ::c_short = 47; -pub const APPCOMMAND_MEDIA_RECORD: ::c_short = 48; -pub const APPCOMMAND_MEDIA_FAST_FORWARD: ::c_short = 49; -pub const APPCOMMAND_MEDIA_REWIND: ::c_short = 50; -pub const APPCOMMAND_MEDIA_CHANNEL_UP: ::c_short = 51; -pub const APPCOMMAND_MEDIA_CHANNEL_DOWN: ::c_short = 52; -// end if _WIN32_WINNT >= 0x0501 -// if _WIN32_WINNT >= 0x0600 -pub const APPCOMMAND_DELETE: ::c_short = 53; -pub const APPCOMMAND_DWM_FLIP3D: ::c_short = 54; -// end if _WIN32_WINNT >= 0x0600 -pub const WM_NULL: ::UINT = 0x0000; -pub const WM_CREATE: ::UINT = 0x0001; -pub const WM_DESTROY: ::UINT = 0x0002; -pub const WM_MOVE: ::UINT = 0x0003; -pub const WM_SIZE: ::UINT = 0x0005; -pub const WM_ACTIVATE: ::UINT = 0x0006; -pub const WM_SETFOCUS: ::UINT = 0x0007; -pub const WM_KILLFOCUS: ::UINT = 0x0008; -pub const WM_ENABLE: ::UINT = 0x000A; -pub const WM_SETREDRAW: ::UINT = 0x000B; -pub const WM_SETTEXT: ::UINT = 0x000C; -pub const WM_GETTEXT: ::UINT = 0x000D; -pub const WM_GETTEXTLENGTH: ::UINT = 0x000E; -pub const WM_PAINT: ::UINT = 0x000F; -pub const WM_CLOSE: ::UINT = 0x0010; -pub const WM_QUERYENDSESSION: ::UINT = 0x0011; -pub const WM_QUERYOPEN: ::UINT = 0x0013; -pub const WM_ENDSESSION: ::UINT = 0x0016; -pub const WM_QUIT: ::UINT = 0x0012; -pub const WM_ERASEBKGND: ::UINT = 0x0014; -pub const WM_SYSCOLORCHANGE: ::UINT = 0x0015; -pub const WM_SHOWWINDOW: ::UINT = 0x0018; -pub const WM_WININICHANGE: ::UINT = 0x001A; -pub const WM_SETTINGCHANGE: ::UINT = WM_WININICHANGE; -pub const WM_DEVMODECHANGE: ::UINT = 0x001B; -pub const WM_ACTIVATEAPP: ::UINT = 0x001C; -pub const WM_FONTCHANGE: ::UINT = 0x001D; -pub const WM_TIMECHANGE: ::UINT = 0x001E; -pub const WM_CANCELMODE: ::UINT = 0x001F; -pub const WM_SETCURSOR: ::UINT = 0x0020; -pub const WM_MOUSEACTIVATE: ::UINT = 0x0021; -pub const WM_CHILDACTIVATE: ::UINT = 0x0022; -pub const WM_QUEUESYNC: ::UINT = 0x0023; -pub const WM_GETMINMAXINFO: ::UINT = 0x0024; -pub const WM_PAINTICON: ::UINT = 0x0026; -pub const WM_ICONERASEBKGND: ::UINT = 0x0027; -pub const WM_NEXTDLGCTL: ::UINT = 0x0028; -pub const WM_SPOOLERSTATUS: ::UINT = 0x002A; -pub const WM_DRAWITEM: ::UINT = 0x002B; -pub const WM_MEASUREITEM: ::UINT = 0x002C; -pub const WM_DELETEITEM: ::UINT = 0x002D; -pub const WM_VKEYTOITEM: ::UINT = 0x002E; -pub const WM_CHARTOITEM: ::UINT = 0x002F; -pub const WM_SETFONT: ::UINT = 0x0030; -pub const WM_GETFONT: ::UINT = 0x0031; -pub const WM_SETHOTKEY: ::UINT = 0x0032; -pub const WM_GETHOTKEY: ::UINT = 0x0033; -pub const WM_QUERYDRAGICON: ::UINT = 0x0037; -pub const WM_COMPAREITEM: ::UINT = 0x0039; -pub const WM_GETOBJECT: ::UINT = 0x003D; -pub const WM_COMPACTING: ::UINT = 0x0041; -pub const WM_COMMNOTIFY: ::UINT = 0x0044; -pub const WM_WINDOWPOSCHANGING: ::UINT = 0x0046; -pub const WM_WINDOWPOSCHANGED: ::UINT = 0x0047; -pub const WM_POWER: ::UINT = 0x0048; -pub const WM_COPYDATA: ::UINT = 0x004A; -pub const WM_CANCELJOURNAL: ::UINT = 0x004B; -pub const WM_NOTIFY: ::UINT = 0x004E; -pub const WM_INPUTLANGCHANGEREQUEST: ::UINT = 0x0050; -pub const WM_INPUTLANGCHANGE: ::UINT = 0x0051; -pub const WM_TCARD: ::UINT = 0x0052; -pub const WM_HELP: ::UINT = 0x0053; -pub const WM_USERCHANGED: ::UINT = 0x0054; -pub const WM_NOTIFYFORMAT: ::UINT = 0x0055; -pub const WM_CONTEXTMENU: ::UINT = 0x007B; -pub const WM_STYLECHANGING: ::UINT = 0x007C; -pub const WM_STYLECHANGED: ::UINT = 0x007D; -pub const WM_DISPLAYCHANGE: ::UINT = 0x007E; -pub const WM_GETICON: ::UINT = 0x007F; -pub const WM_SETICON: ::UINT = 0x0080; -pub const WM_NCCREATE: ::UINT = 0x0081; -pub const WM_NCDESTROY: ::UINT = 0x0082; -pub const WM_NCCALCSIZE: ::UINT = 0x0083; -pub const WM_NCHITTEST: ::UINT = 0x0084; -pub const WM_NCPAINT: ::UINT = 0x0085; -pub const WM_NCACTIVATE: ::UINT = 0x0086; -pub const WM_GETDLGCODE: ::UINT = 0x0087; -pub const WM_SYNCPAINT: ::UINT = 0x0088; -pub const WM_NCMOUSEMOVE: ::UINT = 0x00A0; -pub const WM_NCLBUTTONDOWN: ::UINT = 0x00A1; -pub const WM_NCLBUTTONUP: ::UINT = 0x00A2; -pub const WM_NCLBUTTONDBLCLK: ::UINT = 0x00A3; -pub const WM_NCRBUTTONDOWN: ::UINT = 0x00A4; -pub const WM_NCRBUTTONUP: ::UINT = 0x00A5; -pub const WM_NCRBUTTONDBLCLK: ::UINT = 0x00A6; -pub const WM_NCMBUTTONDOWN: ::UINT = 0x00A7; -pub const WM_NCMBUTTONUP: ::UINT = 0x00A8; -pub const WM_NCMBUTTONDBLCLK: ::UINT = 0x00A9; -pub const WM_NCXBUTTONDOWN: ::UINT = 0x00AB; -pub const WM_NCXBUTTONUP: ::UINT = 0x00AC; -pub const WM_NCXBUTTONDBLCLK: ::UINT = 0x00AD; -pub const WM_INPUT_DEVICE_CHANGE: ::UINT = 0x00FE; -pub const WM_INPUT: ::UINT = 0x00FF; -pub const WM_KEYFIRST: ::UINT = 0x0100; -pub const WM_KEYDOWN: ::UINT = 0x0100; -pub const WM_KEYUP: ::UINT = 0x0101; -pub const WM_CHAR: ::UINT = 0x0102; -pub const WM_DEADCHAR: ::UINT = 0x0103; -pub const WM_SYSKEYDOWN: ::UINT = 0x0104; -pub const WM_SYSKEYUP: ::UINT = 0x0105; -pub const WM_SYSCHAR: ::UINT = 0x0106; -pub const WM_SYSDEADCHAR: ::UINT = 0x0107; -pub const WM_UNICHAR: ::UINT = 0x0109; -pub const WM_KEYLAST: ::UINT = 0x0109; -pub const WM_IME_STARTCOMPOSITION: ::UINT = 0x010D; -pub const WM_IME_ENDCOMPOSITION: ::UINT = 0x010E; -pub const WM_IME_COMPOSITION: ::UINT = 0x010F; -pub const WM_IME_KEYLAST: ::UINT = 0x010F; -pub const WM_INITDIALOG: ::UINT = 0x0110; -pub const WM_COMMAND: ::UINT = 0x0111; -pub const WM_SYSCOMMAND: ::UINT = 0x0112; -pub const WM_TIMER: ::UINT = 0x0113; -pub const WM_HSCROLL: ::UINT = 0x0114; -pub const WM_VSCROLL: ::UINT = 0x0115; -pub const WM_INITMENU: ::UINT = 0x0116; -pub const WM_INITMENUPOPUP: ::UINT = 0x0117; -pub const WM_GESTURE: ::UINT = 0x0119; -pub const WM_GESTURENOTIFY: ::UINT = 0x011A; -pub const WM_MENUSELECT: ::UINT = 0x011F; -pub const WM_MENUCHAR: ::UINT = 0x0120; -pub const WM_ENTERIDLE: ::UINT = 0x0121; -pub const WM_MENURBUTTONUP: ::UINT = 0x0122; -pub const WM_MENUDRAG: ::UINT = 0x0123; -pub const WM_MENUGETOBJECT: ::UINT = 0x0124; -pub const WM_UNINITMENUPOPUP: ::UINT = 0x0125; -pub const WM_MENUCOMMAND: ::UINT = 0x0126; -pub const WM_CHANGEUISTATE: ::UINT = 0x0127; -pub const WM_UPDATEUISTATE: ::UINT = 0x0128; -pub const WM_QUERYUISTATE: ::UINT = 0x0129; -pub const WM_CTLCOLORMSGBOX: ::UINT = 0x0132; -pub const WM_CTLCOLOREDIT: ::UINT = 0x0133; -pub const WM_CTLCOLORLISTBOX: ::UINT = 0x0134; -pub const WM_CTLCOLORBTN: ::UINT = 0x0135; -pub const WM_CTLCOLORDLG: ::UINT = 0x0136; -pub const WM_CTLCOLORSCROLLBAR: ::UINT = 0x0137; -pub const WM_CTLCOLORSTATIC: ::UINT = 0x0138; -pub const WM_MOUSEFIRST: ::UINT = 0x0200; -pub const WM_MOUSEMOVE: ::UINT = 0x0200; -pub const WM_LBUTTONDOWN: ::UINT = 0x0201; -pub const WM_LBUTTONUP: ::UINT = 0x0202; -pub const WM_LBUTTONDBLCLK: ::UINT = 0x0203; -pub const WM_RBUTTONDOWN: ::UINT = 0x0204; -pub const WM_RBUTTONUP: ::UINT = 0x0205; -pub const WM_RBUTTONDBLCLK: ::UINT = 0x0206; -pub const WM_MBUTTONDOWN: ::UINT = 0x0207; -pub const WM_MBUTTONUP: ::UINT = 0x0208; -pub const WM_MBUTTONDBLCLK: ::UINT = 0x0209; -pub const WM_MOUSEWHEEL: ::UINT = 0x020A; -pub const WM_XBUTTONDOWN: ::UINT = 0x020B; -pub const WM_XBUTTONUP: ::UINT = 0x020C; -pub const WM_XBUTTONDBLCLK: ::UINT = 0x020D; -pub const WM_MOUSEHWHEEL: ::UINT = 0x020E; -pub const WM_MOUSELAST: ::UINT = 0x020E; -pub const WM_PARENTNOTIFY: ::UINT = 0x0210; -pub const WM_ENTERMENULOOP: ::UINT = 0x0211; -pub const WM_EXITMENULOOP: ::UINT = 0x0212; -pub const WM_NEXTMENU: ::UINT = 0x0213; -pub const WM_SIZING: ::UINT = 0x0214; -pub const WM_CAPTURECHANGED: ::UINT = 0x0215; -pub const WM_MOVING: ::UINT = 0x0216; -pub const WM_POWERBROADCAST: ::UINT = 0x0218; -pub const WM_DEVICECHANGE: ::UINT = 0x0219; -pub const WM_MDICREATE: ::UINT = 0x0220; -pub const WM_MDIDESTROY: ::UINT = 0x0221; -pub const WM_MDIACTIVATE: ::UINT = 0x0222; -pub const WM_MDIRESTORE: ::UINT = 0x0223; -pub const WM_MDINEXT: ::UINT = 0x0224; -pub const WM_MDIMAXIMIZE: ::UINT = 0x0225; -pub const WM_MDITILE: ::UINT = 0x0226; -pub const WM_MDICASCADE: ::UINT = 0x0227; -pub const WM_MDIICONARRANGE: ::UINT = 0x0228; -pub const WM_MDIGETACTIVE: ::UINT = 0x0229; -pub const WM_MDISETMENU: ::UINT = 0x0230; -pub const WM_ENTERSIZEMOVE: ::UINT = 0x0231; -pub const WM_EXITSIZEMOVE: ::UINT = 0x0232; -pub const WM_DROPFILES: ::UINT = 0x0233; -pub const WM_MDIREFRESHMENU: ::UINT = 0x0234; -pub const WM_POINTERDEVICECHANGE: ::UINT = 0x238; -pub const WM_POINTERDEVICEINRANGE: ::UINT = 0x239; -pub const WM_POINTERDEVICEOUTOFRANGE: ::UINT = 0x23A; -pub const WM_TOUCH: ::UINT = 0x0240; -pub const WM_NCPOINTERUPDATE: ::UINT = 0x0241; -pub const WM_NCPOINTERDOWN: ::UINT = 0x0242; -pub const WM_NCPOINTERUP: ::UINT = 0x0243; -pub const WM_POINTERUPDATE: ::UINT = 0x0245; -pub const WM_POINTERDOWN: ::UINT = 0x0246; -pub const WM_POINTERUP: ::UINT = 0x0247; -pub const WM_POINTERENTER: ::UINT = 0x0249; -pub const WM_POINTERLEAVE: ::UINT = 0x024A; -pub const WM_POINTERACTIVATE: ::UINT = 0x024B; -pub const WM_POINTERCAPTURECHANGED: ::UINT = 0x024C; -pub const WM_TOUCHHITTESTING: ::UINT = 0x024D; -pub const WM_POINTERWHEEL: ::UINT = 0x024E; -pub const WM_POINTERHWHEEL: ::UINT = 0x024F; -pub const WM_IME_SETCONTEXT: ::UINT = 0x0281; -pub const WM_IME_NOTIFY: ::UINT = 0x0282; -pub const WM_IME_CONTROL: ::UINT = 0x0283; -pub const WM_IME_COMPOSITIONFULL: ::UINT = 0x0284; -pub const WM_IME_SELECT: ::UINT = 0x0285; -pub const WM_IME_CHAR: ::UINT = 0x0286; -pub const WM_IME_REQUEST: ::UINT = 0x0288; -pub const WM_IME_KEYDOWN: ::UINT = 0x0290; -pub const WM_IME_KEYUP: ::UINT = 0x0291; -pub const WM_MOUSEHOVER: ::UINT = 0x02A1; -pub const WM_MOUSELEAVE: ::UINT = 0x02A3; -pub const WM_NCMOUSEHOVER: ::UINT = 0x02A0; -pub const WM_NCMOUSELEAVE: ::UINT = 0x02A2; -pub const WM_WTSSESSION_CHANGE: ::UINT = 0x02B1; -pub const WM_TABLET_FIRST: ::UINT = 0x02c0; -pub const WM_TABLET_LAST: ::UINT = 0x02df; -pub const WM_DPICHANGED: ::UINT = 0x02E0; -pub const WM_CUT: ::UINT = 0x0300; -pub const WM_COPY: ::UINT = 0x0301; -pub const WM_PASTE: ::UINT = 0x0302; -pub const WM_CLEAR: ::UINT = 0x0303; -pub const WM_UNDO: ::UINT = 0x0304; -pub const WM_RENDERFORMAT: ::UINT = 0x0305; -pub const WM_RENDERALLFORMATS: ::UINT = 0x0306; -pub const WM_DESTROYCLIPBOARD: ::UINT = 0x0307; -pub const WM_DRAWCLIPBOARD: ::UINT = 0x0308; -pub const WM_PAINTCLIPBOARD: ::UINT = 0x0309; -pub const WM_VSCROLLCLIPBOARD: ::UINT = 0x030A; -pub const WM_SIZECLIPBOARD: ::UINT = 0x030B; -pub const WM_ASKCBFORMATNAME: ::UINT = 0x030C; -pub const WM_CHANGECBCHAIN: ::UINT = 0x030D; -pub const WM_HSCROLLCLIPBOARD: ::UINT = 0x030E; -pub const WM_QUERYNEWPALETTE: ::UINT = 0x030F; -pub const WM_PALETTEISCHANGING: ::UINT = 0x0310; -pub const WM_PALETTECHANGED: ::UINT = 0x0311; -pub const WM_HOTKEY: ::UINT = 0x0312; -pub const WM_PRINT: ::UINT = 0x0317; -pub const WM_PRINTCLIENT: ::UINT = 0x0318; -pub const WM_APPCOMMAND: ::UINT = 0x0319; -pub const WM_THEMECHANGED: ::UINT = 0x031A; -pub const WM_CLIPBOARDUPDATE: ::UINT = 0x031D; -pub const WM_DWMCOMPOSITIONCHANGED: ::UINT = 0x031E; -pub const WM_DWMNCRENDERINGCHANGED: ::UINT = 0x031F; -pub const WM_DWMCOLORIZATIONCOLORCHANGED: ::UINT = 0x0320; -pub const WM_DWMWINDOWMAXIMIZEDCHANGE: ::UINT = 0x0321; -pub const WM_DWMSENDICONICTHUMBNAIL: ::UINT = 0x0323; -pub const WM_DWMSENDICONICLIVEPREVIEWBITMAP: ::UINT = 0x0326; -pub const WM_GETTITLEBARINFOEX: ::UINT = 0x033F; -pub const WM_HANDHELDFIRST: ::UINT = 0x0358; -pub const WM_HANDHELDLAST: ::UINT = 0x035F; -pub const WM_AFXFIRST: ::UINT = 0x0360; -pub const WM_AFXLAST: ::UINT = 0x037F; -pub const WM_PENWINFIRST: ::UINT = 0x0380; -pub const WM_PENWINLAST: ::UINT = 0x038F; -pub const WM_APP: ::UINT = 0x8000; -pub const WM_USER: ::UINT = 0x0400; -pub const WMSZ_LEFT: ::UINT = 1; -pub const WMSZ_RIGHT: ::UINT = 2; -pub const WMSZ_TOP: ::UINT = 3; -pub const WMSZ_TOPLEFT: ::UINT = 4; -pub const WMSZ_TOPRIGHT: ::UINT = 5; -pub const WMSZ_BOTTOM: ::UINT = 6; -pub const WMSZ_BOTTOMLEFT: ::UINT = 7; -pub const WMSZ_BOTTOMRIGHT: ::UINT = 8; -pub const SMTO_NORMAL: ::UINT = 0x0000; -pub const SMTO_BLOCK: ::UINT = 0x0001; -pub const SMTO_ABORTIFHUNG: ::UINT = 0x0002; -pub const SMTO_NOTIMEOUTIFNOTHUNG: ::UINT = 0x0008; -pub const SMTO_ERRORONEXIT: ::UINT = 0x0020; -pub const MA_ACTIVATE: ::UINT = 1; -pub const MA_ACTIVATEANDEAT: ::UINT = 2; -pub const MA_NOACTIVATE: ::UINT = 3; -pub const MA_NOACTIVATEANDEAT: ::UINT = 4; -pub const ICON_SMALL: ::UINT = 0; -pub const ICON_BIG: ::UINT = 1; -pub const ICON_SMALL2: ::UINT = 2; -pub const SIZE_RESTORED: ::UINT = 0; -pub const SIZE_MINIMIZED: ::UINT = 1; -pub const SIZE_MAXIMIZED: ::UINT = 2; -pub const SIZE_MAXSHOW: ::UINT = 3; -pub const SIZE_MAXHIDE: ::UINT = 4; -pub const SIZENORMAL: ::UINT = SIZE_RESTORED; -pub const SIZEICONIC: ::UINT = SIZE_MINIMIZED; -pub const SIZEFULLSCREEN: ::UINT = SIZE_MAXIMIZED; -pub const SIZEZOOMSHOW: ::UINT = SIZE_MAXSHOW; -pub const SIZEZOOMHIDE: ::UINT = SIZE_MAXHIDE; -STRUCT!{struct NCCALCSIZE_PARAMS { - rgrc: [::RECT; 3], - lppos: PWINDOWPOS, -}} -pub type PNCCALCSIZE_PARAMS = *mut NCCALCSIZE_PARAMS; -pub type NPNCCALCSIZE_PARAMS = *mut NCCALCSIZE_PARAMS; -pub type LPNCCALCSIZE_PARAMS = *mut NCCALCSIZE_PARAMS; -pub const WVR_ALIGNTOP: ::UINT = 0x0010; -pub const WVR_ALIGNLEFT: ::UINT = 0x0020; -pub const WVR_ALIGNBOTTOM: ::UINT = 0x0040; -pub const WVR_ALIGNRIGHT: ::UINT = 0x0080; -pub const WVR_HREDRAW: ::UINT = 0x0100; -pub const WVR_VREDRAW: ::UINT = 0x0200; -pub const WVR_REDRAW: ::UINT = WVR_HREDRAW | WVR_VREDRAW; -pub const WVR_VALIDRECTS: ::UINT = 0x0400; -pub const HOVER_DEFAULT: ::UINT = 0xFFFFFFFF; -pub const WS_OVERLAPPED: ::DWORD = 0x00000000; -pub const WS_POPUP: ::DWORD = 0x80000000; -pub const WS_CHILD: ::DWORD = 0x40000000; -pub const WS_MINIMIZE: ::DWORD = 0x20000000; -pub const WS_VISIBLE: ::DWORD = 0x10000000; -pub const WS_DISABLED: ::DWORD = 0x08000000; -pub const WS_CLIPSIBLINGS: ::DWORD = 0x04000000; -pub const WS_CLIPCHILDREN: ::DWORD = 0x02000000; -pub const WS_MAXIMIZE: ::DWORD = 0x01000000; -pub const WS_CAPTION: ::DWORD = 0x00C00000; -pub const WS_BORDER: ::DWORD = 0x00800000; -pub const WS_DLGFRAME: ::DWORD = 0x00400000; -pub const WS_VSCROLL: ::DWORD = 0x00200000; -pub const WS_HSCROLL: ::DWORD = 0x00100000; -pub const WS_SYSMENU: ::DWORD = 0x00080000; -pub const WS_THICKFRAME: ::DWORD = 0x00040000; -pub const WS_GROUP: ::DWORD = 0x00020000; -pub const WS_TABSTOP: ::DWORD = 0x00010000; -pub const WS_MINIMIZEBOX: ::DWORD = 0x00020000; -pub const WS_MAXIMIZEBOX: ::DWORD = 0x00010000; -pub const WS_TILED: ::DWORD = WS_OVERLAPPED; -pub const WS_ICONIC: ::DWORD = WS_MINIMIZE; -pub const WS_SIZEBOX: ::DWORD = WS_THICKFRAME; -pub const WS_TILEDWINDOW: ::DWORD = WS_OVERLAPPEDWINDOW; -pub const WS_OVERLAPPEDWINDOW: ::DWORD = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; -pub const WS_POPUPWINDOW: ::DWORD = WS_POPUP | WS_BORDER | WS_SYSMENU; -pub const WS_CHILDWINDOW: ::DWORD = WS_CHILD; -pub const WS_EX_DLGMODALFRAME: ::DWORD = 0x00000001; -pub const WS_EX_NOPARENTNOTIFY: ::DWORD = 0x00000004; -pub const WS_EX_TOPMOST: ::DWORD = 0x00000008; -pub const WS_EX_ACCEPTFILES: ::DWORD = 0x00000010; -pub const WS_EX_TRANSPARENT: ::DWORD = 0x00000020; -pub const WS_EX_MDICHILD: ::DWORD = 0x00000040; -pub const WS_EX_TOOLWINDOW: ::DWORD = 0x00000080; -pub const WS_EX_WINDOWEDGE: ::DWORD = 0x00000100; -pub const WS_EX_CLIENTEDGE: ::DWORD = 0x00000200; -pub const WS_EX_CONTEXTHELP: ::DWORD = 0x00000400; -pub const WS_EX_RIGHT: ::DWORD = 0x00001000; -pub const WS_EX_LEFT: ::DWORD = 0x00000000; -pub const WS_EX_RTLREADING: ::DWORD = 0x00002000; -pub const WS_EX_LTRREADING: ::DWORD = 0x00000000; -pub const WS_EX_LEFTSCROLLBAR: ::DWORD = 0x00004000; -pub const WS_EX_RIGHTSCROLLBAR: ::DWORD = 0x00000000; -pub const WS_EX_CONTROLPARENT: ::DWORD = 0x00010000; -pub const WS_EX_STATICEDGE: ::DWORD = 0x00020000; -pub const WS_EX_APPWINDOW: ::DWORD = 0x00040000; -pub const WS_EX_OVERLAPPEDWINDOW: ::DWORD = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE; -pub const WS_EX_PALETTEWINDOW: ::DWORD = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST; -pub const WS_EX_LAYERED: ::DWORD = 0x00080000; -pub const WS_EX_NOINHERITLAYOUT: ::DWORD = 0x00100000; -pub const WS_EX_NOREDIRECTIONBITMAP: ::DWORD = 0x00200000; -pub const WS_EX_LAYOUTRTL: ::DWORD = 0x00400000; -pub const WS_EX_COMPOSITED: ::DWORD = 0x02000000; -pub const WS_EX_NOACTIVATE: ::DWORD = 0x08000000; -pub type NAMEENUMPROCA = Option ::BOOL>; -pub type NAMEENUMPROCW = Option ::BOOL>; -pub type DESKTOPENUMPROCA = NAMEENUMPROCA; -pub type DESKTOPENUMPROCW = NAMEENUMPROCW; -pub type WINSTAENUMPROCA = NAMEENUMPROCA; -pub type WINSTAENUMPROCW = NAMEENUMPROCW; -pub type WNDENUMPROC = Option ::BOOL>; -pub type WNDPROC = Option ::LRESULT>; -pub type DLGPROC = Option ::INT_PTR>; -pub type HOOKPROC = Option ::LRESULT>; -pub type TimerProc = Option; -pub type DRAWSTATEPROC = Option ::BOOL>; -pub type PROPENUMPROCA = Option ::BOOL>; -pub type PROPENUMPROCW = Option ::BOOL>; -pub type GRAYSTRINGPROC = Option ::BOOL>; -pub type MSGBOXCALLBACK = Option; -pub type WINEVENTPROC = Option; -pub type HDEVNOTIFY = ::PVOID; -pub type MENUTEMPLATEA = ::VOID; -pub type MENUTEMPLATEW = ::VOID; -STRUCT!{struct MSG { - hwnd: ::HWND, - message: ::UINT, - wParam: ::WPARAM, - lParam: ::LPARAM, - time: ::DWORD, - pt: ::POINT, -}} -pub type PMSG = *mut MSG; -pub type NPMSG = *mut MSG; -pub type LPMSG = *mut MSG; -STRUCT!{struct PAINTSTRUCT { - hdc: ::HDC, - fErase: ::BOOL, - rcPaint: ::RECT, - fRestore: ::BOOL, - fIncUpdate: ::BOOL, - rgbReserved: [::BYTE; 32], -}} -pub type PPAINTSTRUCT = *mut PAINTSTRUCT; -pub type NPPAINTSTRUCT = *mut PAINTSTRUCT; -pub type LPPAINTSTRUCT = *mut PAINTSTRUCT; -STRUCT!{struct WINDOWPLACEMENT { - length: ::UINT, - flags: ::UINT, - showCmd: ::UINT, - ptMinPosition: ::POINT, - ptMaxPosition: ::POINT, - rcNormalPosition: ::RECT, -}} -pub type PWINDOWPLACEMENT = *mut WINDOWPLACEMENT; -pub type LPWINDOWPLACEMENT = *mut WINDOWPLACEMENT; -STRUCT!{nodebug struct WNDCLASSEXW { - cbSize: ::UINT, - style: ::UINT, - lpfnWndProc: WNDPROC, - cbClsExtra: ::c_int, - cbWndExtra: ::c_int, - hInstance: ::HINSTANCE, - hIcon: ::HICON, - hCursor: ::HCURSOR, - hbrBackground: ::HBRUSH, - lpszMenuName: ::LPCWSTR, - lpszClassName: ::LPCWSTR, - hIconSm: ::HICON, -}} -pub type PWNDCLASSEXW = *mut WNDCLASSEXW; -pub type NPWNDCLASSEXW = *mut WNDCLASSEXW; -pub type LPWNDCLASSEXW = *mut WNDCLASSEXW; -STRUCT!{nodebug struct WNDCLASSW { - style: ::UINT, - lpfnWndProc: WNDPROC, - cbClsExtra: ::c_int, - cbWndExtra: ::c_int, - hInstance: ::HINSTANCE, - hIcon: ::HICON, - hCursor: ::HCURSOR, - hbrBackground: ::HBRUSH, - lpszMenuName: ::LPCWSTR, - lpszClassName: ::LPCWSTR, -}} -pub type PWNDCLASSW = *mut WNDCLASSW; -pub type NPWNDCLASSW = *mut WNDCLASSW; -pub type LPWNDCLASSW = *mut WNDCLASSW; -STRUCT!{struct MINMAXINFO { - ptReserved: ::POINT, - ptMaxSize: ::POINT, - ptMaxPosition: ::POINT, - ptMinTrackSize: ::POINT, - ptMaxTrackSize: ::POINT, -}} -STRUCT!{struct SCROLLBARINFO { - cbSize: ::DWORD, - rcScrollBar: ::RECT, - dxyLineButton: ::c_int, - xyThumbTop: ::c_int, - xyThumbBottom: ::c_int, - reserved: ::c_int, - rgstate: [::DWORD; CCHILDREN_SCROLLBAR + 1], -}} -pub type PSCROLLBARINFO = *mut SCROLLBARINFO; -pub type LPSCROLLBARINFO = *mut SCROLLBARINFO; -STRUCT!{struct SCROLLINFO { - cbSize: ::UINT, - fMask: ::UINT, - nMin: ::c_int, - nMax: ::c_int, - nPage: ::UINT, - nPos: ::c_int, - nTrackPos: ::c_int, -}} -pub type LPSCROLLINFO = *mut SCROLLINFO; -pub type LPCSCROLLINFO = *const SCROLLINFO; -STRUCT!{struct SIZE { - cx: ::LONG, - cy: ::LONG, -}} -pub type PSIZE = *mut SIZE; -pub type LPSIZE = *mut SIZE; -pub type SIZEL = SIZE; -pub type PSIZEL = *mut SIZEL; -pub type LPSIZEL = *mut SIZEL; -//1913 -pub const UNICODE_NOCHAR: ::WPARAM = 0xffff; -pub type HDWP = *mut ::HANDLE; -//2193 -pub const WHEEL_DELTA: ::DWORD = 120; -//2206 -pub const XBUTTON1: ::DWORD = 0x0001; -pub const XBUTTON2: ::DWORD = 0x0002; -//2392 -pub const MK_LBUTTON: ::WPARAM = 0x0001; -pub const MK_RBUTTON: ::WPARAM = 0x0002; -pub const MK_SHIFT: ::WPARAM = 0x0004; -pub const MK_CONTROL: ::WPARAM = 0x0008; -pub const MK_MBUTTON: ::WPARAM = 0x0010; -pub const MK_XBUTTON1: ::WPARAM = 0x0020; -pub const MK_XBUTTON2: ::WPARAM = 0x0040; -//2408 -pub const TME_HOVER: ::DWORD = 0x0000_0001; -pub const TME_LEAVE: ::DWORD = 0x0000_0002; -pub const TME_NONCLIENT: ::DWORD = 0x0000_0010; -pub const TME_QUERY: ::DWORD = 0x4000_0000; -pub const TME_CANCEL: ::DWORD = 0x8000_0000; -pub const HWND_BROADCAST: ::HWND = 0xFFFF as ::HWND; -pub const HWND_MESSAGE: ::HWND = -3isize as ::HWND; -STRUCT!{struct TRACKMOUSEEVENT { - cbSize: ::DWORD, - dwFlags: ::DWORD, - hwndTrack: ::HWND, - dwHoverTime: ::DWORD, -}} -pub type LPTRACKMOUSEEVENT = *mut TRACKMOUSEEVENT; -//2575 -STRUCT!{nodebug struct WINDOWPOS { - hwnd: ::HWND, - hwndInsertAfter: ::HWND, - x: ::c_int, - y: ::c_int, - cx: ::c_int, - cy: ::c_int, - flags: ::UINT, -}} -pub type LPWINDOWPOS = *mut WINDOWPOS; -pub type PWINDOWPOS = *mut WINDOWPOS; -//3082 -STRUCT!{struct CREATESTRUCTA { - lpCreateParams: ::LPVOID, - hInstance: ::HINSTANCE, - hMenu: ::HMENU, - hwndParent: ::HWND, - cy: ::c_int, - cx: ::c_int, - y: ::c_int, - x: ::c_int, - style: ::LONG, - lpszName: ::LPCSTR, - lpszClass: ::LPCSTR, - dwExStyle: ::DWORD, -}} -pub type LPCREATESTRUCTA = *mut CREATESTRUCTA; -STRUCT!{struct CREATESTRUCTW { - lpCreateParams: ::LPVOID, - hInstance: ::HINSTANCE, - hMenu: ::HMENU, - hwndParent: ::HWND, - cy: ::c_int, - cx: ::c_int, - y: ::c_int, - x: ::c_int, - style: ::LONG, - lpszName: ::LPCWSTR, - lpszClass: ::LPCWSTR, - dwExStyle: ::DWORD, -}} -pub type LPCREATESTRUCTW = *mut CREATESTRUCTW; -//3145 -STRUCT!{struct NMHDR { - hwndFrom: ::HWND, - idFrom: ::UINT_PTR, - code: ::UINT, // NM_ code -}} -pub type LPNMHDR = *mut NMHDR; -//3400 -pub const PM_NOREMOVE: ::UINT = 0x0000; -pub const PM_REMOVE: ::UINT = 0x0001; -pub const PM_NOYIELD: ::UINT = 0x0002; -pub const PM_QS_INPUT: ::UINT = QS_INPUT << 16; -pub const PM_QS_POSTMESSAGE: ::UINT = (QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER) << 16; -pub const PM_QS_PAINT: ::UINT = QS_PAINT << 16; -pub const PM_QS_SENDMESSAGE: ::UINT = QS_SENDMESSAGE << 16; -// -pub const LWA_COLORKEY: ::DWORD = 0x00000001; -pub const LWA_ALPHA: ::DWORD = 0x00000002; -//3469 -pub const EWX_LOGOFF: ::UINT = 0x00000000; -pub const EWX_SHUTDOWN: ::UINT = 0x00000001; -pub const EWX_REBOOT: ::UINT = 0x00000002; -pub const EWX_FORCE: ::UINT = 0x00000004; -pub const EWX_POWEROFF: ::UINT = 0x00000008; -pub const EWX_FORCEIFHUNG: ::UINT = 0x00000010; -pub const EWX_QUICKRESOLVE: ::UINT = 0x00000020; -pub const EWX_RESTARTAPPS: ::UINT = 0x00000040; -pub const EWX_HYBRID_SHUTDOWN: ::UINT = 0x00400000; -pub const EWX_BOOTOPTIONS: ::UINT = 0x01000000; -//4054 (Win 7 SDK) -STRUCT!{struct FLASHWINFO { - cbSize: ::UINT, - hwnd: ::HWND, - dwFlags: ::DWORD, - uCount: ::UINT, - dwTimeout: ::DWORD, -}} -pub type PFLASHWINFO = *mut FLASHWINFO; -pub const FLASHW_STOP: ::DWORD = 0; -pub const FLASHW_CAPTION: ::DWORD = 0x00000001; -pub const FLASHW_TRAY: ::DWORD = 0x00000002; -pub const FLASHW_ALL: ::DWORD = FLASHW_CAPTION | FLASHW_TRAY; -pub const FLASHW_TIMER: ::DWORD = 0x00000004; -pub const FLASHW_TIMERNOFG: ::DWORD = 0x0000000C; -// 4674 -pub const HWND_TOP: ::HWND = 0 as ::HWND; -pub const HWND_BOTTOM: ::HWND = 1 as ::HWND; -pub const HWND_TOPMOST: ::HWND = -1isize as ::HWND; -pub const HWND_NOTOPMOST: ::HWND = -2isize as ::HWND; -//5499 -pub const MAPVK_VK_TO_VSC: ::UINT = 0; -pub const MAPVK_VSC_TO_VK: ::UINT = 1; -pub const MAPVK_VK_TO_CHAR: ::UINT = 2; -pub const MAPVK_VSC_TO_VK_EX: ::UINT = 3; -pub const MAPVK_VK_TO_VSC_EX: ::UINT = 4; -//5741 -pub const KEYEVENTF_EXTENDEDKEY: ::DWORD = 0x0001; -pub const KEYEVENTF_KEYUP: ::DWORD = 0x0002; -pub const KEYEVENTF_UNICODE: ::DWORD = 0x0004; -pub const KEYEVENTF_SCANCODE: ::DWORD = 0x0008; -pub const MOUSEEVENTF_MOVE: ::DWORD = 0x0001; -pub const MOUSEEVENTF_LEFTDOWN: ::DWORD = 0x0002; -pub const MOUSEEVENTF_LEFTUP: ::DWORD = 0x0004; -pub const MOUSEEVENTF_RIGHTDOWN: ::DWORD = 0x0008; -pub const MOUSEEVENTF_RIGHTUP: ::DWORD = 0x0010; -pub const MOUSEEVENTF_MIDDLEDOWN: ::DWORD = 0x0020; -pub const MOUSEEVENTF_MIDDLEUP: ::DWORD = 0x0040; -pub const MOUSEEVENTF_XDOWN: ::DWORD = 0x0080; -pub const MOUSEEVENTF_XUP: ::DWORD = 0x0100; -pub const MOUSEEVENTF_WHEEL: ::DWORD = 0x0800; -pub const MOUSEEVENTF_HWHEEL: ::DWORD = 0x01000; -pub const MOUSEEVENTF_MOVE_NOCOALESCE: ::DWORD = 0x2000; -pub const MOUSEEVENTF_VIRTUALDESK: ::DWORD = 0x4000; -pub const MOUSEEVENTF_ABSOLUTE: ::DWORD = 0x8000; -STRUCT!{struct MOUSEINPUT { - dx: ::LONG, - dy: ::LONG, - mouseData: ::DWORD, - dwFlags: ::DWORD, - time: ::DWORD, - dwExtraInfo: ::ULONG_PTR, -}} -pub type PMOUSEINPUT = *mut MOUSEINPUT; -pub type LPMOUSEINPUT = *mut MOUSEINPUT; -STRUCT!{struct KEYBDINPUT { - wVk: ::WORD, - wScan: ::WORD, - dwFlags: ::DWORD, - time: ::DWORD, - dwExtraInfo: ::ULONG_PTR, -}} -pub type PKEYBDINPUT = *mut KEYBDINPUT; -pub type LPKEYBDINPUT = *mut KEYBDINPUT; -STRUCT!{struct HARDWAREINPUT { - uMsg: ::DWORD, - wParamL: ::WORD, - wParamH: ::WORD, -}} -pub type PHARDWAREINPUT = *mut HARDWAREINPUT; -pub type LPHARDWAREINPUT= *mut HARDWAREINPUT; -pub const INPUT_MOUSE: ::DWORD = 0; -pub const INPUT_KEYBOARD: ::DWORD = 1; -pub const INPUT_HARDWARE: ::DWORD = 2; -#[cfg(target_arch = "x86")] -STRUCT!{struct INPUT { - type_: ::DWORD, - u: [u32; 6], -}} -#[cfg(target_arch = "x86_64")] -STRUCT!{struct INPUT { - type_: ::DWORD, - u: [u64; 4], -}} -UNION!{INPUT, u, mi, mi_mut, MOUSEINPUT} -UNION!{INPUT, u, ki, ki_mut, KEYBDINPUT} -UNION!{INPUT, u, hi, hi_mut, HARDWAREINPUT} -pub type PINPUT = *mut INPUT; -pub type LPINPUT = *mut INPUT; -// if WINVER >= 0x0601 -DECLARE_HANDLE!(HTOUCHINPUT, HTOUCHINPUT__); -STRUCT!{struct TOUCHINPUT { - x: ::LONG, - y: ::LONG, - hSource: ::HANDLE, - dwID: ::DWORD, - dwFlags: ::DWORD, - dwMask: ::DWORD, - dwTime: ::DWORD, - dwExtraInfo: ::ULONG_PTR, - cxContact: ::DWORD, - cyContact: ::DWORD, -}} -pub type PTOUCHINPUT = *mut TOUCHINPUT; -pub type PCTOUCHINPUT = *const TOUCHINPUT; -//Touch input flag values (TOUCHINPUT.dwFlags) -pub const TOUCHEVENTF_MOVE: ::DWORD = 0x0001; -pub const TOUCHEVENTF_DOWN: ::DWORD = 0x0002; -pub const TOUCHEVENTF_UP: ::DWORD = 0x0004; -pub const TOUCHEVENTF_INRANGE: ::DWORD = 0x0008; -pub const TOUCHEVENTF_PRIMARY: ::DWORD = 0x0010; -pub const TOUCHEVENTF_NOCOALESCE: ::DWORD = 0x0020; -pub const TOUCHEVENTF_PEN: ::DWORD = 0x0040; -pub const TOUCHEVENTF_PALM: ::DWORD = 0x0080; -//Touch input mask values (TOUCHINPUT.dwMask) -pub const TOUCHINPUTMASKF_TIMEFROMSYSTEM: ::DWORD = 0x0001; -pub const TOUCHINPUTMASKF_EXTRAINFO: ::DWORD = 0x0002; -pub const TOUCHINPUTMASKF_CONTACTAREA: ::DWORD = 0x0004; -//RegisterTouchWindow flag values -pub const TWF_FINETOUCH: ::ULONG = 0x00000001; -pub const TWF_WANTPALM: ::ULONG = 0x00000002; -// end if WINVER >= 0x0601 -//Indices for GetWindowLong etc. -pub const GWL_EXSTYLE: ::c_int = -20; -pub const GWL_STYLE: ::c_int = -16; -pub const GWL_WNDPROC: ::c_int = -4; -pub const GWLP_WNDPROC: ::c_int = -4; -pub const GWL_HINSTANCE: ::c_int = -6; -pub const GWLP_HINSTANCE: ::c_int = -6; -pub const GWL_HWNDPARENT: ::c_int = -8; -pub const GWLP_HWNDPARENT: ::c_int = -8; -pub const GWL_ID: ::c_int = -12; -pub const GWLP_ID: ::c_int = -12; -pub const GWL_USERDATA: ::c_int = -21; -pub const GWLP_USERDATA: ::c_int = -21; -//5976 -ENUM!{enum POINTER_INPUT_TYPE { - PT_POINTER = 0x00000001, - PT_TOUCH = 0x00000002, - PT_PEN = 0x00000003, - PT_MOUSE = 0x00000004, - PT_TOUCHPAD = 0x00000005, -}} -//6566 -// flags for MsgWaitForMultipleObjectsEx -pub const MWMO_WAITALL: ::DWORD = 0x0001; -pub const MWMO_ALERTABLE: ::DWORD = 0x0002; -pub const MWMO_INPUTAVAILABLE: ::DWORD = 0x0004; -//6573 -pub const QS_KEY: ::UINT = 0x0001; -pub const QS_MOUSEMOVE: ::UINT = 0x0002; -pub const QS_MOUSEBUTTON: ::UINT = 0x0004; -pub const QS_POSTMESSAGE: ::UINT = 0x0008; -pub const QS_TIMER: ::UINT = 0x0010; -pub const QS_PAINT: ::UINT = 0x0020; -pub const QS_SENDMESSAGE: ::UINT = 0x0040; -pub const QS_HOTKEY: ::UINT = 0x0080; -pub const QS_ALLPOSTMESSAGE: ::UINT = 0x0100; -pub const QS_RAWINPUT: ::UINT = 0x0400; -pub const QS_TOUCH: ::UINT = 0x0800; -pub const QS_POINTER: ::UINT = 0x1000; -pub const QS_MOUSE: ::UINT = QS_MOUSEMOVE | QS_MOUSEBUTTON; -pub const QS_INPUT: ::UINT = QS_MOUSE | QS_KEY | QS_RAWINPUT | QS_TOUCH | QS_POINTER; -pub const QS_ALLEVENTS: ::UINT = QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY; -pub const QS_ALLINPUT: ::UINT = QS_INPUT | QS_POSTMESSAGE | QS_TIMER - | QS_PAINT | QS_HOTKEY | QS_SENDMESSAGE; -//6789 -pub const SM_CXSCREEN: ::c_int = 0; -pub const SM_CYSCREEN: ::c_int = 1; -pub const SM_CXVSCROLL: ::c_int = 2; -pub const SM_CYHSCROLL: ::c_int = 3; -pub const SM_CYCAPTION: ::c_int = 4; -pub const SM_CXBORDER: ::c_int = 5; -pub const SM_CYBORDER: ::c_int = 6; -pub const SM_CXDLGFRAME: ::c_int = 7; -pub const SM_CYDLGFRAME: ::c_int = 8; -pub const SM_CYVTHUMB: ::c_int = 9; -pub const SM_CXHTHUMB: ::c_int = 10; -pub const SM_CXICON: ::c_int = 11; -pub const SM_CYICON: ::c_int = 12; -pub const SM_CXCURSOR: ::c_int = 13; -pub const SM_CYCURSOR: ::c_int = 14; -pub const SM_CYMENU: ::c_int = 15; -pub const SM_CXFULLSCREEN: ::c_int = 16; -pub const SM_CYFULLSCREEN: ::c_int = 17; -pub const SM_CYKANJIWINDOW: ::c_int = 18; -pub const SM_MOUSEPRESENT: ::c_int = 19; -pub const SM_CYVSCROLL: ::c_int = 20; -pub const SM_CXHSCROLL: ::c_int = 21; -pub const SM_DEBUG: ::c_int = 22; -pub const SM_SWAPBUTTON: ::c_int = 23; -pub const SM_RESERVED1: ::c_int = 24; -pub const SM_RESERVED2: ::c_int = 25; -pub const SM_RESERVED3: ::c_int = 26; -pub const SM_RESERVED4: ::c_int = 27; -pub const SM_CXMIN: ::c_int = 28; -pub const SM_CYMIN: ::c_int = 29; -pub const SM_CXSIZE: ::c_int = 30; -pub const SM_CYSIZE: ::c_int = 31; -pub const SM_CXFRAME: ::c_int = 32; -pub const SM_CYFRAME: ::c_int = 33; -pub const SM_CXMINTRACK: ::c_int = 34; -pub const SM_CYMINTRACK: ::c_int = 35; -pub const SM_CXDOUBLECLK: ::c_int = 36; -pub const SM_CYDOUBLECLK: ::c_int = 37; -pub const SM_CXICONSPACING: ::c_int = 38; -pub const SM_CYICONSPACING: ::c_int = 39; -pub const SM_MENUDROPALIGNMENT: ::c_int = 40; -pub const SM_PENWINDOWS: ::c_int = 41; -pub const SM_DBCSENABLED: ::c_int = 42; -pub const SM_CMOUSEBUTTONS: ::c_int = 43; -pub const SM_CXFIXEDFRAME: ::c_int = SM_CXDLGFRAME; -pub const SM_CYFIXEDFRAME: ::c_int = SM_CYDLGFRAME; -pub const SM_CXSIZEFRAME: ::c_int = SM_CXFRAME; -pub const SM_CYSIZEFRAME: ::c_int = SM_CYFRAME; -pub const SM_SECURE: ::c_int = 44; -pub const SM_CXEDGE: ::c_int = 45; -pub const SM_CYEDGE: ::c_int = 46; -pub const SM_CXMINSPACING: ::c_int = 47; -pub const SM_CYMINSPACING: ::c_int = 48; -pub const SM_CXSMICON: ::c_int = 49; -pub const SM_CYSMICON: ::c_int = 50; -pub const SM_CYSMCAPTION: ::c_int = 51; -pub const SM_CXSMSIZE: ::c_int = 52; -pub const SM_CYSMSIZE: ::c_int = 53; -pub const SM_CXMENUSIZE: ::c_int = 54; -pub const SM_CYMENUSIZE: ::c_int = 55; -pub const SM_ARRANGE: ::c_int = 56; -pub const SM_CXMINIMIZED: ::c_int = 57; -pub const SM_CYMINIMIZED: ::c_int = 58; -pub const SM_CXMAXTRACK: ::c_int = 59; -pub const SM_CYMAXTRACK: ::c_int = 60; -pub const SM_CXMAXIMIZED: ::c_int = 61; -pub const SM_CYMAXIMIZED: ::c_int = 62; -pub const SM_NETWORK: ::c_int = 63; -pub const SM_CLEANBOOT: ::c_int = 67; -pub const SM_CXDRAG: ::c_int = 68; -pub const SM_CYDRAG: ::c_int = 69; -pub const SM_SHOWSOUNDS: ::c_int = 70; -pub const SM_CXMENUCHECK: ::c_int = 71; -pub const SM_CYMENUCHECK: ::c_int = 72; -pub const SM_SLOWMACHINE: ::c_int = 73; -pub const SM_MIDEASTENABLED: ::c_int = 74; -pub const SM_MOUSEWHEELPRESENT: ::c_int = 75; -pub const SM_XVIRTUALSCREEN: ::c_int = 76; -pub const SM_YVIRTUALSCREEN: ::c_int = 77; -pub const SM_CXVIRTUALSCREEN: ::c_int = 78; -pub const SM_CYVIRTUALSCREEN: ::c_int = 79; -pub const SM_CMONITORS: ::c_int = 80; -pub const SM_SAMEDISPLAYFORMAT: ::c_int = 81; -pub const SM_IMMENABLED: ::c_int = 82; -pub const SM_CXFOCUSBORDER: ::c_int = 83; -pub const SM_CYFOCUSBORDER: ::c_int = 84; -pub const SM_TABLETPC: ::c_int = 86; -pub const SM_MEDIACENTER: ::c_int = 87; -pub const SM_STARTER: ::c_int = 88; -pub const SM_SERVERR2: ::c_int = 89; -pub const SM_MOUSEHORIZONTALWHEELPRESENT: ::c_int = 91; -pub const SM_CXPADDEDBORDER: ::c_int = 92; -pub const SM_DIGITIZER: ::c_int = 94; -pub const SM_MAXIMUMTOUCHES: ::c_int = 95; -pub const SM_CMETRICS: ::c_int = 97; -pub const SM_REMOTESESSION: ::c_int = 0x1000; -pub const SM_SHUTTINGDOWN: ::c_int = 0x2000; -pub const SM_REMOTECONTROL: ::c_int = 0x2001; -pub const SM_CARETBLINKINGENABLED: ::c_int = 0x2002; -pub const SM_CONVERTIBLESLATEMODE: ::c_int = 0x2003; -pub const SM_SYSTEMDOCKED: ::c_int = 0x2004; -//8855 (Win 7 SDK) -STRUCT!{struct ICONINFO { - fIcon: ::BOOL, - xHotspot: ::DWORD, - yHotspot: ::DWORD, - hbmMask: ::HBITMAP, - hbmColor: ::HBITMAP, -}} -pub type PICONINFO = *mut ICONINFO; -//9066 -// Color indexes for use in GetSysColor and SetSysColor -// 0-18 (after incrementing) are also valid in RegisterClass's WNDCLASS -pub const COLOR_SCROLLBAR: ::c_int = 0; -pub const COLOR_BACKGROUND: ::c_int = 1; -pub const COLOR_ACTIVECAPTION: ::c_int = 2; -pub const COLOR_INACTIVECAPTION: ::c_int = 3; -pub const COLOR_MENU: ::c_int = 4; -pub const COLOR_WINDOW: ::c_int = 5; -pub const COLOR_WINDOWFRAME: ::c_int = 6; -pub const COLOR_MENUTEXT: ::c_int = 7; -pub const COLOR_WINDOWTEXT: ::c_int = 8; -pub const COLOR_CAPTIONTEXT: ::c_int = 9; -pub const COLOR_ACTIVEBORDER: ::c_int = 10; -pub const COLOR_INACTIVEBORDER: ::c_int = 11; -pub const COLOR_APPWORKSPACE: ::c_int = 12; -pub const COLOR_HIGHLIGHT: ::c_int = 13; -pub const COLOR_HIGHLIGHTTEXT: ::c_int = 14; -pub const COLOR_BTNFACE: ::c_int = 15; -pub const COLOR_BTNSHADOW: ::c_int = 16; -pub const COLOR_GRAYTEXT: ::c_int = 17; -pub const COLOR_BTNTEXT: ::c_int = 18; -pub const COLOR_INACTIVECAPTIONTEXT: ::c_int = 19; -pub const COLOR_BTNHIGHLIGHT: ::c_int = 20; -// Introduced in Windows 95 (winver 0x0400): -pub const COLOR_3DDKSHADOW: ::c_int = 21; -pub const COLOR_3DLIGHT: ::c_int = 22; -pub const COLOR_INFOTEXT: ::c_int = 23; -pub const COLOR_INFOBK: ::c_int = 24; -pub const COLOR_DESKTOP: ::c_int = COLOR_BACKGROUND; -pub const COLOR_3DFACE: ::c_int = COLOR_BTNFACE; -pub const COLOR_3DSHADOW: ::c_int = COLOR_BTNSHADOW; -pub const COLOR_3DHIGHLIGHT: ::c_int = COLOR_BTNHIGHLIGHT; -pub const COLOR_3DHILIGHT: ::c_int = COLOR_BTNHIGHLIGHT; -pub const COLOR_BTNHILIGHT: ::c_int = COLOR_BTNHIGHLIGHT; -// Introduced in Windows 2000 (winver 0x0500) -pub const COLOR_HOTLIGHT: ::c_int = 26; -pub const COLOR_GRADIENTACTIVECAPTION: ::c_int = 27; -pub const COLOR_GRADIENTINACTIVECAPTION: ::c_int = 28; -// Introduced in Windows XP (winver 0x0501) -pub const COLOR_MENUHILIGHT: ::c_int = 29; -pub const COLOR_MENUBAR: ::c_int = 30; -//10069 -pub const IDC_ARROW: ::LPCWSTR = 32512 as ::LPCWSTR; -pub const IDC_IBEAM: ::LPCWSTR = 32513 as ::LPCWSTR; -pub const IDC_WAIT: ::LPCWSTR = 32514 as ::LPCWSTR; -pub const IDC_CROSS: ::LPCWSTR = 32515 as ::LPCWSTR; -pub const IDC_UPARROW: ::LPCWSTR = 32516 as ::LPCWSTR; -pub const IDC_SIZE: ::LPCWSTR = 32640 as ::LPCWSTR; -pub const IDC_ICON: ::LPCWSTR = 32641 as ::LPCWSTR; -pub const IDC_SIZENWSE: ::LPCWSTR = 32642 as ::LPCWSTR; -pub const IDC_SIZENESW: ::LPCWSTR = 32643 as ::LPCWSTR; -pub const IDC_SIZEWE: ::LPCWSTR = 32644 as ::LPCWSTR; -pub const IDC_SIZENS: ::LPCWSTR = 32645 as ::LPCWSTR; -pub const IDC_SIZEALL: ::LPCWSTR = 32646 as ::LPCWSTR; -pub const IDC_NO: ::LPCWSTR = 32648 as ::LPCWSTR; -pub const IDC_HAND: ::LPCWSTR = 32649 as ::LPCWSTR; -pub const IDC_APPSTARTING: ::LPCWSTR = 32650 as ::LPCWSTR; -pub const IDC_HELP: ::LPCWSTR = 32651 as ::LPCWSTR; -//10492 -pub const IDI_APPLICATION: ::LPCWSTR = 32512 as ::LPCWSTR; -pub const IDI_HAND: ::LPCWSTR = 32513 as ::LPCWSTR; -pub const IDI_QUESTION: ::LPCWSTR = 32514 as ::LPCWSTR; -pub const IDI_EXCLAMATION: ::LPCWSTR = 32515 as ::LPCWSTR; -pub const IDI_ASTERISK: ::LPCWSTR = 32516 as ::LPCWSTR; -pub const IDI_WINLOGO: ::LPCWSTR = 32517 as ::LPCWSTR; -pub const IDI_SHIELD: ::LPCWSTR = 32518 as ::LPCWSTR; -pub const IDI_WARNING: ::LPCWSTR = IDI_EXCLAMATION; -pub const IDI_ERROR: ::LPCWSTR = IDI_HAND; -pub const IDI_INFORMATION: ::LPCWSTR = IDI_ASTERISK; -pub const SPI_GETBEEP: ::UINT = 0x0001; -pub const SPI_SETBEEP: ::UINT = 0x0002; -pub const SPI_GETMOUSE: ::UINT = 0x0003; -pub const SPI_SETMOUSE: ::UINT = 0x0004; -pub const SPI_GETBORDER: ::UINT = 0x0005; -pub const SPI_SETBORDER: ::UINT = 0x0006; -pub const SPI_GETKEYBOARDSPEED: ::UINT = 0x000A; -pub const SPI_SETKEYBOARDSPEED: ::UINT = 0x000B; -pub const SPI_LANGDRIVER: ::UINT = 0x000C; -pub const SPI_ICONHORIZONTALSPACING: ::UINT = 0x000D; -pub const SPI_GETSCREENSAVETIMEOUT: ::UINT = 0x000E; -pub const SPI_SETSCREENSAVETIMEOUT: ::UINT = 0x000F; -pub const SPI_GETSCREENSAVEACTIVE: ::UINT = 0x0010; -pub const SPI_SETSCREENSAVEACTIVE: ::UINT = 0x0011; -pub const SPI_GETGRIDGRANULARITY: ::UINT = 0x0012; -pub const SPI_SETGRIDGRANULARITY: ::UINT = 0x0013; -pub const SPI_SETDESKWALLPAPER: ::UINT = 0x0014; -pub const SPI_SETDESKPATTERN: ::UINT = 0x0015; -pub const SPI_GETKEYBOARDDELAY: ::UINT = 0x0016; -pub const SPI_SETKEYBOARDDELAY: ::UINT = 0x0017; -pub const SPI_ICONVERTICALSPACING: ::UINT = 0x0018; -pub const SPI_GETICONTITLEWRAP: ::UINT = 0x0019; -pub const SPI_SETICONTITLEWRAP: ::UINT = 0x001A; -pub const SPI_GETMENUDROPALIGNMENT: ::UINT = 0x001B; -pub const SPI_SETMENUDROPALIGNMENT: ::UINT = 0x001C; -pub const SPI_SETDOUBLECLKWIDTH: ::UINT = 0x001D; -pub const SPI_SETDOUBLECLKHEIGHT: ::UINT = 0x001E; -pub const SPI_GETICONTITLELOGFONT: ::UINT = 0x001F; -pub const SPI_SETDOUBLECLICKTIME: ::UINT = 0x0020; -pub const SPI_SETMOUSEBUTTONSWAP: ::UINT = 0x0021; -pub const SPI_SETICONTITLELOGFONT: ::UINT = 0x0022; -pub const SPI_GETFASTTASKSWITCH: ::UINT = 0x0023; -pub const SPI_SETFASTTASKSWITCH: ::UINT = 0x0024; -pub const SPI_SETDRAGFULLWINDOWS: ::UINT = 0x0025; -pub const SPI_GETDRAGFULLWINDOWS: ::UINT = 0x0026; -pub const SPI_GETNONCLIENTMETRICS: ::UINT = 0x0029; -pub const SPI_SETNONCLIENTMETRICS: ::UINT = 0x002A; -pub const SPI_GETMINIMIZEDMETRICS: ::UINT = 0x002B; -pub const SPI_SETMINIMIZEDMETRICS: ::UINT = 0x002C; -pub const SPI_GETICONMETRICS: ::UINT = 0x002D; -pub const SPI_SETICONMETRICS: ::UINT = 0x002E; -pub const SPI_SETWORKAREA: ::UINT = 0x002F; -pub const SPI_GETWORKAREA: ::UINT = 0x0030; -pub const SPI_SETPENWINDOWS: ::UINT = 0x0031; -pub const SPI_GETHIGHCONTRAST: ::UINT = 0x0042; -pub const SPI_SETHIGHCONTRAST: ::UINT = 0x0043; -pub const SPI_GETKEYBOARDPREF: ::UINT = 0x0044; -pub const SPI_SETKEYBOARDPREF: ::UINT = 0x0045; -pub const SPI_GETSCREENREADER: ::UINT = 0x0046; -pub const SPI_SETSCREENREADER: ::UINT = 0x0047; -pub const SPI_GETANIMATION: ::UINT = 0x0048; -pub const SPI_SETANIMATION: ::UINT = 0x0049; -pub const SPI_GETFONTSMOOTHING: ::UINT = 0x004A; -pub const SPI_SETFONTSMOOTHING: ::UINT = 0x004B; -pub const SPI_SETDRAGWIDTH: ::UINT = 0x004C; -pub const SPI_SETDRAGHEIGHT: ::UINT = 0x004D; -pub const SPI_SETHANDHELD: ::UINT = 0x004E; -pub const SPI_GETLOWPOWERTIMEOUT: ::UINT = 0x004F; -pub const SPI_GETPOWEROFFTIMEOUT: ::UINT = 0x0050; -pub const SPI_SETLOWPOWERTIMEOUT: ::UINT = 0x0051; -pub const SPI_SETPOWEROFFTIMEOUT: ::UINT = 0x0052; -pub const SPI_GETLOWPOWERACTIVE: ::UINT = 0x0053; -pub const SPI_GETPOWEROFFACTIVE: ::UINT = 0x0054; -pub const SPI_SETLOWPOWERACTIVE: ::UINT = 0x0055; -pub const SPI_SETPOWEROFFACTIVE: ::UINT = 0x0056; -pub const SPI_SETCURSORS: ::UINT = 0x0057; -pub const SPI_SETICONS: ::UINT = 0x0058; -pub const SPI_GETDEFAULTINPUTLANG: ::UINT = 0x0059; -pub const SPI_SETDEFAULTINPUTLANG: ::UINT = 0x005A; -pub const SPI_SETLANGTOGGLE: ::UINT = 0x005B; -pub const SPI_GETWINDOWSEXTENSION: ::UINT = 0x005C; -pub const SPI_SETMOUSETRAILS: ::UINT = 0x005D; -pub const SPI_GETMOUSETRAILS: ::UINT = 0x005E; -pub const SPI_SETSCREENSAVERRUNNING: ::UINT = 0x0061; -pub const SPI_SCREENSAVERRUNNING: ::UINT = SPI_SETSCREENSAVERRUNNING; -pub const SPI_GETFILTERKEYS: ::UINT = 0x0032; -pub const SPI_SETFILTERKEYS: ::UINT = 0x0033; -pub const SPI_GETTOGGLEKEYS: ::UINT = 0x0034; -pub const SPI_SETTOGGLEKEYS: ::UINT = 0x0035; -pub const SPI_GETMOUSEKEYS: ::UINT = 0x0036; -pub const SPI_SETMOUSEKEYS: ::UINT = 0x0037; -pub const SPI_GETSHOWSOUNDS: ::UINT = 0x0038; -pub const SPI_SETSHOWSOUNDS: ::UINT = 0x0039; -pub const SPI_GETSTICKYKEYS: ::UINT = 0x003A; -pub const SPI_SETSTICKYKEYS: ::UINT = 0x003B; -pub const SPI_GETACCESSTIMEOUT: ::UINT = 0x003C; -pub const SPI_SETACCESSTIMEOUT: ::UINT = 0x003D; -pub const SPI_GETSERIALKEYS: ::UINT = 0x003E; -pub const SPI_SETSERIALKEYS: ::UINT = 0x003F; -pub const SPI_GETSOUNDSENTRY: ::UINT = 0x0040; -pub const SPI_SETSOUNDSENTRY: ::UINT = 0x0041; -pub const SPI_GETSNAPTODEFBUTTON: ::UINT = 0x005F; -pub const SPI_SETSNAPTODEFBUTTON: ::UINT = 0x0060; -pub const SPI_GETMOUSEHOVERWIDTH: ::UINT = 0x0062; -pub const SPI_SETMOUSEHOVERWIDTH: ::UINT = 0x0063; -pub const SPI_GETMOUSEHOVERHEIGHT: ::UINT = 0x0064; -pub const SPI_SETMOUSEHOVERHEIGHT: ::UINT = 0x0065; -pub const SPI_GETMOUSEHOVERTIME: ::UINT = 0x0066; -pub const SPI_SETMOUSEHOVERTIME: ::UINT = 0x0067; -pub const SPI_GETWHEELSCROLLLINES: ::UINT = 0x0068; -pub const SPI_SETWHEELSCROLLLINES: ::UINT = 0x0069; -pub const SPI_GETMENUSHOWDELAY: ::UINT = 0x006A; -pub const SPI_SETMENUSHOWDELAY: ::UINT = 0x006B; -pub const SPI_GETWHEELSCROLLCHARS: ::UINT = 0x006C; -pub const SPI_SETWHEELSCROLLCHARS: ::UINT = 0x006D; -pub const SPI_GETSHOWIMEUI: ::UINT = 0x006E; -pub const SPI_SETSHOWIMEUI: ::UINT = 0x006F; -pub const SPI_GETMOUSESPEED: ::UINT = 0x0070; -pub const SPI_SETMOUSESPEED: ::UINT = 0x0071; -pub const SPI_GETSCREENSAVERRUNNING: ::UINT = 0x0072; -pub const SPI_GETDESKWALLPAPER: ::UINT = 0x0073; -pub const SPI_GETAUDIODESCRIPTION: ::UINT = 0x0074; -pub const SPI_SETAUDIODESCRIPTION: ::UINT = 0x0075; -pub const SPI_GETSCREENSAVESECURE: ::UINT = 0x0076; -pub const SPI_SETSCREENSAVESECURE: ::UINT = 0x0077; -pub const SPI_GETHUNGAPPTIMEOUT: ::UINT = 0x0078; -pub const SPI_SETHUNGAPPTIMEOUT: ::UINT = 0x0079; -pub const SPI_GETWAITTOKILLTIMEOUT: ::UINT = 0x007A; -pub const SPI_SETWAITTOKILLTIMEOUT: ::UINT = 0x007B; -pub const SPI_GETWAITTOKILLSERVICETIMEOUT: ::UINT = 0x007C; -pub const SPI_SETWAITTOKILLSERVICETIMEOUT: ::UINT = 0x007D; -pub const SPI_GETMOUSEDOCKTHRESHOLD: ::UINT = 0x007E; -pub const SPI_SETMOUSEDOCKTHRESHOLD: ::UINT = 0x007F; -pub const SPI_GETPENDOCKTHRESHOLD: ::UINT = 0x0080; -pub const SPI_SETPENDOCKTHRESHOLD: ::UINT = 0x0081; -pub const SPI_GETWINARRANGING: ::UINT = 0x0082; -pub const SPI_SETWINARRANGING: ::UINT = 0x0083; -pub const SPI_GETMOUSEDRAGOUTTHRESHOLD: ::UINT = 0x0084; -pub const SPI_SETMOUSEDRAGOUTTHRESHOLD: ::UINT = 0x0085; -pub const SPI_GETPENDRAGOUTTHRESHOLD: ::UINT = 0x0086; -pub const SPI_SETPENDRAGOUTTHRESHOLD: ::UINT = 0x0087; -pub const SPI_GETMOUSESIDEMOVETHRESHOLD: ::UINT = 0x0088; -pub const SPI_SETMOUSESIDEMOVETHRESHOLD: ::UINT = 0x0089; -pub const SPI_GETPENSIDEMOVETHRESHOLD: ::UINT = 0x008A; -pub const SPI_SETPENSIDEMOVETHRESHOLD: ::UINT = 0x008B; -pub const SPI_GETDRAGFROMMAXIMIZE: ::UINT = 0x008C; -pub const SPI_SETDRAGFROMMAXIMIZE: ::UINT = 0x008D; -pub const SPI_GETSNAPSIZING: ::UINT = 0x008E; -pub const SPI_SETSNAPSIZING: ::UINT = 0x008F; -pub const SPI_GETDOCKMOVING: ::UINT = 0x0090; -pub const SPI_SETDOCKMOVING: ::UINT = 0x0091; -pub const SPI_GETACTIVEWINDOWTRACKING: ::UINT = 0x1000; -pub const SPI_SETACTIVEWINDOWTRACKING: ::UINT = 0x1001; -pub const SPI_GETMENUANIMATION: ::UINT = 0x1002; -pub const SPI_SETMENUANIMATION: ::UINT = 0x1003; -pub const SPI_GETCOMBOBOXANIMATION: ::UINT = 0x1004; -pub const SPI_SETCOMBOBOXANIMATION: ::UINT = 0x1005; -pub const SPI_GETLISTBOXSMOOTHSCROLLING: ::UINT = 0x1006; -pub const SPI_SETLISTBOXSMOOTHSCROLLING: ::UINT = 0x1007; -pub const SPI_GETGRADIENTCAPTIONS: ::UINT = 0x1008; -pub const SPI_SETGRADIENTCAPTIONS: ::UINT = 0x1009; -pub const SPI_GETKEYBOARDCUES: ::UINT = 0x100A; -pub const SPI_SETKEYBOARDCUES: ::UINT = 0x100B; -pub const SPI_GETMENUUNDERLINES: ::UINT = SPI_GETKEYBOARDCUES; -pub const SPI_SETMENUUNDERLINES: ::UINT = SPI_SETKEYBOARDCUES; -pub const SPI_GETACTIVEWNDTRKZORDER: ::UINT = 0x100C; -pub const SPI_SETACTIVEWNDTRKZORDER: ::UINT = 0x100D; -pub const SPI_GETHOTTRACKING: ::UINT = 0x100E; -pub const SPI_SETHOTTRACKING: ::UINT = 0x100F; -pub const SPI_GETMENUFADE: ::UINT = 0x1012; -pub const SPI_SETMENUFADE: ::UINT = 0x1013; -pub const SPI_GETSELECTIONFADE: ::UINT = 0x1014; -pub const SPI_SETSELECTIONFADE: ::UINT = 0x1015; -pub const SPI_GETTOOLTIPANIMATION: ::UINT = 0x1016; -pub const SPI_SETTOOLTIPANIMATION: ::UINT = 0x1017; -pub const SPI_GETTOOLTIPFADE: ::UINT = 0x1018; -pub const SPI_SETTOOLTIPFADE: ::UINT = 0x1019; -pub const SPI_GETCURSORSHADOW: ::UINT = 0x101A; -pub const SPI_SETCURSORSHADOW: ::UINT = 0x101B; -pub const SPI_GETMOUSESONAR: ::UINT = 0x101C; -pub const SPI_SETMOUSESONAR: ::UINT = 0x101D; -pub const SPI_GETMOUSECLICKLOCK: ::UINT = 0x101E; -pub const SPI_SETMOUSECLICKLOCK: ::UINT = 0x101F; -pub const SPI_GETMOUSEVANISH: ::UINT = 0x1020; -pub const SPI_SETMOUSEVANISH: ::UINT = 0x1021; -pub const SPI_GETFLATMENU: ::UINT = 0x1022; -pub const SPI_SETFLATMENU: ::UINT = 0x1023; -pub const SPI_GETDROPSHADOW: ::UINT = 0x1024; -pub const SPI_SETDROPSHADOW: ::UINT = 0x1025; -pub const SPI_GETBLOCKSENDINPUTRESETS: ::UINT = 0x1026; -pub const SPI_SETBLOCKSENDINPUTRESETS: ::UINT = 0x1027; -pub const SPI_GETUIEFFECTS: ::UINT = 0x103E; -pub const SPI_SETUIEFFECTS: ::UINT = 0x103F; -pub const SPI_GETDISABLEOVERLAPPEDCONTENT: ::UINT = 0x1040; -pub const SPI_SETDISABLEOVERLAPPEDCONTENT: ::UINT = 0x1041; -pub const SPI_GETCLIENTAREAANIMATION: ::UINT = 0x1042; -pub const SPI_SETCLIENTAREAANIMATION: ::UINT = 0x1043; -pub const SPI_GETCLEARTYPE: ::UINT = 0x1048; -pub const SPI_SETCLEARTYPE: ::UINT = 0x1049; -pub const SPI_GETSPEECHRECOGNITION: ::UINT = 0x104A; -pub const SPI_SETSPEECHRECOGNITION: ::UINT = 0x104B; -pub const SPI_GETFOREGROUNDLOCKTIMEOUT: ::UINT = 0x2000; -pub const SPI_SETFOREGROUNDLOCKTIMEOUT: ::UINT = 0x2001; -pub const SPI_GETACTIVEWNDTRKTIMEOUT: ::UINT = 0x2002; -pub const SPI_SETACTIVEWNDTRKTIMEOUT: ::UINT = 0x2003; -pub const SPI_GETFOREGROUNDFLASHCOUNT: ::UINT = 0x2004; -pub const SPI_SETFOREGROUNDFLASHCOUNT: ::UINT = 0x2005; -pub const SPI_GETCARETWIDTH: ::UINT = 0x2006; -pub const SPI_SETCARETWIDTH: ::UINT = 0x2007; -pub const SPI_GETMOUSECLICKLOCKTIME: ::UINT = 0x2008; -pub const SPI_SETMOUSECLICKLOCKTIME: ::UINT = 0x2009; -pub const SPI_GETFONTSMOOTHINGTYPE: ::UINT = 0x200A; -pub const SPI_SETFONTSMOOTHINGTYPE: ::UINT = 0x200B; -pub const FE_FONTSMOOTHINGSTANDARD: ::UINT = 0x0001; -pub const FE_FONTSMOOTHINGCLEARTYPE: ::UINT = 0x0002; -pub const SPI_GETFONTSMOOTHINGCONTRAST: ::UINT = 0x200C; -pub const SPI_SETFONTSMOOTHINGCONTRAST: ::UINT = 0x200D; -pub const SPI_GETFOCUSBORDERWIDTH: ::UINT = 0x200E; -pub const SPI_SETFOCUSBORDERWIDTH: ::UINT = 0x200F; -pub const SPI_GETFOCUSBORDERHEIGHT: ::UINT = 0x2010; -pub const SPI_SETFOCUSBORDERHEIGHT: ::UINT = 0x2011; -pub const SPI_GETFONTSMOOTHINGORIENTATION: ::UINT = 0x2012; -pub const SPI_SETFONTSMOOTHINGORIENTATION: ::UINT = 0x2013; -pub const FE_FONTSMOOTHINGORIENTATIONBGR: ::UINT = 0x0000; -pub const FE_FONTSMOOTHINGORIENTATIONRGB: ::UINT = 0x0001; -pub const SPI_GETMINIMUMHITRADIUS: ::UINT = 0x2014; -pub const SPI_SETMINIMUMHITRADIUS: ::UINT = 0x2015; -pub const SPI_GETMESSAGEDURATION: ::UINT = 0x2016; -pub const SPI_SETMESSAGEDURATION: ::UINT = 0x2017; -//11264 -pub const CB_GETEDITSEL: ::UINT = 0x0140; -pub const CB_LIMITTEXT: ::UINT = 0x0141; -pub const CB_SETEDITSEL: ::UINT = 0x0142; -pub const CB_ADDSTRING: ::UINT = 0x0143; -pub const CB_DELETESTRING: ::UINT = 0x0144; -pub const CB_DIR: ::UINT = 0x0145; -pub const CB_GETCOUNT: ::UINT = 0x0146; -pub const CB_GETCURSEL: ::UINT = 0x0147; -pub const CB_GETLBTEXT: ::UINT = 0x0148; -pub const CB_GETLBTEXTLEN: ::UINT = 0x0149; -pub const CB_INSERTSTRING: ::UINT = 0x014A; -pub const CB_RESETCONTENT: ::UINT = 0x014B; -pub const CB_FINDSTRING: ::UINT = 0x014C; -pub const CB_SELECTSTRING: ::UINT = 0x014D; -pub const CB_SETCURSEL: ::UINT = 0x014E; -pub const CB_SHOWDROPDOWN: ::UINT = 0x014F; -pub const CB_GETITEMDATA: ::UINT = 0x0150; -pub const CB_SETITEMDATA: ::UINT = 0x0151; -pub const CB_GETDROPPEDCONTROLRECT: ::UINT = 0x0152; -pub const CB_SETITEMHEIGHT: ::UINT = 0x0153; -pub const CB_GETITEMHEIGHT: ::UINT = 0x0154; -pub const CB_SETEXTENDEDUI: ::UINT = 0x0155; -pub const CB_GETEXTENDEDUI: ::UINT = 0x0156; -pub const CB_GETDROPPEDSTATE: ::UINT = 0x0157; -pub const CB_FINDSTRINGEXACT: ::UINT = 0x0158; -pub const CB_SETLOCALE: ::UINT = 0x0159; -pub const CB_GETLOCALE: ::UINT = 0x015A; -pub const CB_GETTOPINDEX: ::UINT = 0x015b; -pub const CB_SETTOPINDEX: ::UINT = 0x015c; -pub const CB_GETHORIZONTALEXTENT: ::UINT = 0x015d; -pub const CB_SETHORIZONTALEXTENT: ::UINT = 0x015e; -pub const CB_GETDROPPEDWIDTH: ::UINT = 0x015f; -pub const CB_SETDROPPEDWIDTH: ::UINT = 0x0160; -pub const CB_INITSTORAGE: ::UINT = 0x0161; -//12141 -STRUCT!{nodebug struct NONCLIENTMETRICSA { - cbSize: ::UINT, - iBorderWidth: ::c_int, - iScrollWidth: ::c_int, - iScrollHeight: ::c_int, - iCaptionWidth: ::c_int, - iCaptionHeight: ::c_int, - lfCaptionFont: ::LOGFONTA, - iSmCaptionWidth: ::c_int, - iSmCaptionHeight: ::c_int, - lfSmCaptionFont: ::LOGFONTA, - iMenuWidth: ::c_int, - iMenuHeight: ::c_int, - lfMenuFont: ::LOGFONTA, - lfStatusFont: ::LOGFONTA, - lfMessageFont: ::LOGFONTA, - iPaddedBorderWidth: ::c_int, -}} -pub type LPNONCLIENTMETRICSA = *mut NONCLIENTMETRICSA; -STRUCT!{nodebug struct NONCLIENTMETRICSW { - cbSize: ::UINT, - iBorderWidth: ::c_int, - iScrollWidth: ::c_int, - iScrollHeight: ::c_int, - iCaptionWidth: ::c_int, - iCaptionHeight: ::c_int, - lfCaptionFont: ::LOGFONTW, - iSmCaptionWidth: ::c_int, - iSmCaptionHeight: ::c_int, - lfSmCaptionFont: ::LOGFONTW, - iMenuWidth: ::c_int, - iMenuHeight: ::c_int, - lfMenuFont: ::LOGFONTW, - lfStatusFont: ::LOGFONTW, - lfMessageFont: ::LOGFONTW, - iPaddedBorderWidth: ::c_int, -}} -pub type LPNONCLIENTMETRICSW = *mut NONCLIENTMETRICSW; -//12869 -pub const MONITOR_DEFAULTTONULL: ::DWORD = 0x00000000; -pub const MONITOR_DEFAULTTOPRIMARY: ::DWORD = 0x00000001; -pub const MONITOR_DEFAULTTONEAREST: ::DWORD = 0x00000002; -//12900 -pub const MONITORINFOF_PRIMARY: ::DWORD = 1; -pub const CCHDEVICENAME: usize = 32; -STRUCT!{struct MONITORINFO { - cbSize: ::DWORD, - rcMonitor: ::RECT, - rcWork: ::RECT, - dwFlags: ::DWORD, -}} -pub type LPMONITORINFO = *mut MONITORINFO; -STRUCT!{struct MONITORINFOEXA { - cbSize: ::DWORD, - rcMonitor: ::RECT, - rcWork: ::RECT, - dwFlags: ::DWORD, - szDevice: [::CHAR; ::CCHDEVICENAME], -}} -pub type LPMONITORINFOEXA = *mut MONITORINFOEXA; -STRUCT!{struct MONITORINFOEXW { - cbSize: ::DWORD, - rcMonitor: ::RECT, - rcWork: ::RECT, - dwFlags: ::DWORD, - szDevice: [::WCHAR; ::CCHDEVICENAME], -}} -pub type LPMONITORINFOEXW = *mut MONITORINFOEXW; -//12971 -pub type MONITORENUMPROC = Option ::BOOL>; -//14098 -DECLARE_HANDLE!(HRAWINPUT, HRAWINPUT__); -pub fn GET_RAWINPUT_CODE_WPARAM(wParam: ::WPARAM) -> ::WPARAM { wParam & 0xff } -pub const RIM_INPUT: ::WPARAM = 0; -pub const RIM_INPUTSINK: ::WPARAM = 1; -STRUCT!{struct RAWINPUTHEADER { - dwType: ::DWORD, - dwSize: ::DWORD, - hDevice: ::HANDLE, - wParam: ::WPARAM, -}} -pub type PRAWINPUTHEADER = *mut RAWINPUTHEADER; -pub type LPRAWINPUTHEADER = *mut RAWINPUTHEADER; -pub const RIM_TYPEMOUSE: ::DWORD = 0; -pub const RIM_TYPEKEYBOARD: ::DWORD = 1; -pub const RIM_TYPEHID: ::DWORD = 2; -STRUCT!{struct RAWMOUSE { - usFlags: ::USHORT, - memory_padding: ::USHORT, // 16bit Padding for 32bit align in following union - usButtonFlags: ::USHORT, - usButtonData: ::USHORT, - ulRawButtons: ::ULONG, - lLastX: ::LONG, - lLastY: ::LONG, - ulExtraInformation: ::ULONG, -}} -pub type PRAWMOUSE = *mut RAWMOUSE; -pub type LPRAWMOUSE = *mut RAWMOUSE; -pub const RI_MOUSE_LEFT_BUTTON_DOWN: ::USHORT = 0x0001; -pub const RI_MOUSE_LEFT_BUTTON_UP: ::USHORT = 0x0002; -pub const RI_MOUSE_RIGHT_BUTTON_DOWN: ::USHORT = 0x0004; -pub const RI_MOUSE_RIGHT_BUTTON_UP: ::USHORT = 0x0008; -pub const RI_MOUSE_MIDDLE_BUTTON_DOWN: ::USHORT = 0x0010; -pub const RI_MOUSE_MIDDLE_BUTTON_UP: ::USHORT = 0x0020; -pub const RI_MOUSE_BUTTON_1_DOWN: ::USHORT = RI_MOUSE_LEFT_BUTTON_DOWN; -pub const RI_MOUSE_BUTTON_1_UP: ::USHORT = RI_MOUSE_LEFT_BUTTON_UP; -pub const RI_MOUSE_BUTTON_2_DOWN: ::USHORT = RI_MOUSE_RIGHT_BUTTON_DOWN; -pub const RI_MOUSE_BUTTON_2_UP: ::USHORT = RI_MOUSE_RIGHT_BUTTON_UP; -pub const RI_MOUSE_BUTTON_3_DOWN: ::USHORT = RI_MOUSE_MIDDLE_BUTTON_DOWN; -pub const RI_MOUSE_BUTTON_3_UP: ::USHORT = RI_MOUSE_MIDDLE_BUTTON_UP; -pub const RI_MOUSE_BUTTON_4_DOWN: ::USHORT = 0x0040; -pub const RI_MOUSE_BUTTON_4_UP: ::USHORT = 0x0080; -pub const RI_MOUSE_BUTTON_5_DOWN: ::USHORT = 0x0100; -pub const RI_MOUSE_BUTTON_5_UP: ::USHORT = 0x0200; -pub const RI_MOUSE_WHEEL: ::USHORT = 0x0400; -pub const MOUSE_MOVE_RELATIVE: ::USHORT = 0; -pub const MOUSE_MOVE_ABSOLUTE: ::USHORT = 1; -pub const MOUSE_VIRTUAL_DESKTOP: ::USHORT = 0x02; -pub const MOUSE_ATTRIBUTES_CHANGED: ::USHORT = 0x04; -pub const MOUSE_MOVE_NOCOALESCE: ::USHORT = 0x08; -STRUCT!{struct RAWKEYBOARD { - MakeCode: ::USHORT, - Flags: ::USHORT, - Reserved: ::USHORT, - VKey: ::USHORT, - Message: ::UINT, - ExtraInformation: ::ULONG, -}} -pub type PRAWKEYBOARD = *mut RAWKEYBOARD; -pub type LPRAWKEYBOARD = *mut RAWKEYBOARD; -pub const KEYBOARD_OVERRUN_MAKE_CODE: ::DWORD = 0xFF; -pub const RI_KEY_MAKE: ::DWORD = 0; -pub const RI_KEY_BREAK: ::DWORD = 1; -pub const RI_KEY_E0: ::DWORD = 2; -pub const RI_KEY_E1: ::DWORD = 4; -pub const RI_KEY_TERMSRV_SET_LED: ::DWORD = 8; -pub const RI_KEY_TERMSRV_SHADOW: ::DWORD = 0x10; -STRUCT!{struct RAWHID { - dwSizeHid: ::DWORD, - dwCount: ::DWORD, - bRawData: [::BYTE; 0], -}} -pub type PRAWHID = *mut RAWHID; -pub type LPRAWHID = *mut RAWHID; -STRUCT!{struct RAWINPUT { - header: RAWINPUTHEADER, - mouse: RAWMOUSE, -}} -UNION!(RAWINPUT, mouse, mouse, mouse_mut, RAWMOUSE); -UNION!(RAWINPUT, mouse, keyboard, keyboard_mut, RAWKEYBOARD); -UNION!(RAWINPUT, mouse, hid, hid_mut, RAWHID); -#[test] -fn test_RAWINPUT() { - use std::mem::{size_of, align_of}; - assert!(size_of::() >= size_of::()); - assert!(size_of::() >= size_of::()); - assert!(size_of::() >= size_of::()); - assert!(align_of::() >= align_of::()); - assert!(align_of::() >= align_of::()); - assert!(align_of::() >= align_of::()); -} -pub type PRAWINPUT = *mut RAWINPUT; -pub type LPRAWINPUT = *mut RAWINPUT; -pub const RID_INPUT: ::DWORD = 0x10000003; -pub const RID_HEADER: ::DWORD = 0x10000005; -pub const RIDI_PREPARSEDDATA: ::DWORD = 0x20000005; -pub const RIDI_DEVICENAME: ::DWORD = 0x20000007; -pub const RIDI_DEVICEINFO: ::DWORD = 0x2000000b; -STRUCT!{struct RID_DEVICE_INFO_MOUSE { - dwId: ::DWORD, - dwNumberOfButtons: ::DWORD, - dwSampleRate: ::DWORD, - fHasHorizontalWheel: ::BOOL, -}} -pub type PRID_DEVICE_INFO_MOUSE = *mut RID_DEVICE_INFO_MOUSE; -STRUCT!{struct RID_DEVICE_INFO_KEYBOARD { - dwType: ::DWORD, - dwSubType: ::DWORD, - dwKeyboardMode: ::DWORD, - dwNumberOfFunctionKeys: ::DWORD, - dwNumberOfIndicators: ::DWORD, - dwNumberOfKeysTotal: ::DWORD, -}} -pub type PRID_DEVICE_INFO_KEYBOARD = *mut RID_DEVICE_INFO_KEYBOARD; -STRUCT!{struct RID_DEVICE_INFO_HID { - dwVendorId: ::DWORD, - dwProductId: ::DWORD, - dwVersionNumber: ::DWORD, - usUsagePage: ::USHORT, - usUsage: ::USHORT, -}} -pub type PRID_DEVICE_INFO_HID = *mut RID_DEVICE_INFO_HID; -STRUCT!{struct RID_DEVICE_INFO { - cbSize: ::DWORD, - dwType: ::DWORD, - keyboard: RID_DEVICE_INFO_KEYBOARD, -}} -UNION!(RID_DEVICE_INFO, keyboard, mouse, mouse_mut, RID_DEVICE_INFO_MOUSE); -UNION!(RID_DEVICE_INFO, keyboard, keyboard, keyboard_mut, RID_DEVICE_INFO_KEYBOARD); -UNION!(RID_DEVICE_INFO, keyboard, hid, hid_mut, RID_DEVICE_INFO_HID); -#[test] -fn test_RID_DEVICE_INFO() { - use std::mem::{size_of, align_of}; - assert!(size_of::() >= size_of::()); - assert!(size_of::() >= size_of::()); - assert!(size_of::() >= size_of::()); - assert!(align_of::() >= align_of::()); - assert!(align_of::() - >= align_of::()); - assert!(align_of::() >= align_of::()); -} -pub type PRID_DEVICE_INFO = *mut RID_DEVICE_INFO; -pub type LPRID_DEVICE_INFO = *mut RID_DEVICE_INFO; -STRUCT!{struct RAWINPUTDEVICE { - usUsagePage: ::USHORT, - usUsage: ::USHORT, - dwFlags: ::DWORD, - hwndTarget: ::HWND, -}} -pub type PRAWINPUTDEVICE = *mut RAWINPUTDEVICE; -pub type LPRAWINPUTDEVICE = *mut RAWINPUTDEVICE; -pub type PCRAWINPUTDEVICE = *const RAWINPUTDEVICE; -pub const RIDEV_REMOVE: ::DWORD = 0x00000001; -pub const RIDEV_EXCLUDE: ::DWORD = 0x00000010; -pub const RIDEV_PAGEONLY: ::DWORD = 0x00000020; -pub const RIDEV_NOLEGACY: ::DWORD = 0x00000030; -pub const RIDEV_INPUTSINK: ::DWORD = 0x00000100; -pub const RIDEV_CAPTUREMOUSE: ::DWORD = 0x00000200; -pub const RIDEV_NOHOTKEYS: ::DWORD = 0x00000200; -pub const RIDEV_APPKEYS: ::DWORD = 0x00000400; -pub const RIDEV_EXINPUTSINK: ::DWORD = 0x00001000; -pub const RIDEV_DEVNOTIFY: ::DWORD = 0x00002000; -pub const RIDEV_EXMODEMASK: ::DWORD = 0x000000F0; -pub const GIDC_ARRIVAL: ::DWORD = 1; -pub const GIDC_REMOVAL: ::DWORD = 2; -STRUCT!{struct RAWINPUTDEVICELIST { - hDevice: ::HANDLE, - dwType: ::DWORD, -}} -pub type PRAWINPUTDEVICELIST = *mut RAWINPUTDEVICELIST; -STRUCT!{struct CHANGEFILTERSTRUCT { - cbSize: ::DWORD, - ExtStatus: ::DWORD, -}} -pub type PCHANGEFILTERSTRUCT = *mut CHANGEFILTERSTRUCT; -STRUCT!{struct DLGTEMPLATE { - style: ::DWORD, - dwExtendedStyle: ::DWORD, - cdit: ::WORD, - x: ::c_short, - y: ::c_short, - cx: ::c_short, - cy: ::c_short, -}} -pub type LPDLGTEMPLATEA = *mut DLGTEMPLATE; -pub type LPDLGTEMPLATEW = *mut DLGTEMPLATE; -pub type LPCDLGTEMPLATEA = *const DLGTEMPLATE; -pub type LPCDLGTEMPLATEW = *const DLGTEMPLATE; -STRUCT!{struct DRAWTEXTPARAMS { - cbSize: ::UINT, - iTabLength: ::c_int, - iLeftMargin: ::c_int, - iRightMargin: ::c_int, - uiLengthDrawn: ::UINT, -}} -pub type LPDRAWTEXTPARAMS = *mut DRAWTEXTPARAMS; -STRUCT!{struct ACCEL { - fVirt: ::BYTE, - key: ::WORD, - cmd: ::WORD, -}} -pub type LPACCEL = *mut ACCEL; -STRUCT!{struct MENUITEMINFOA { - cbSize: ::UINT, - fMask: ::UINT, - fType: ::UINT, - fState: ::UINT, - wID: ::UINT, - hSubMenu: ::HMENU, - hbmpChecked: ::HBITMAP, - hbmpUnchecked: ::HBITMAP, - dwItemData: ::ULONG_PTR, - dwTypeData: ::LPSTR, - cch: ::UINT, - hbmpItem: ::HBITMAP, -}} -pub type LPMENUITEMINFOA = *mut MENUITEMINFOA; -pub type LPCMENUITEMINFOA = *const MENUITEMINFOA; -STRUCT!{struct MENUITEMINFOW { - cbSize: ::UINT, - fMask: ::UINT, - fType: ::UINT, - fState: ::UINT, - wID: ::UINT, - hSubMenu: ::HMENU, - hbmpChecked: ::HBITMAP, - hbmpUnchecked: ::HBITMAP, - dwItemData: ::ULONG_PTR, - dwTypeData: ::LPWSTR, - cch: ::UINT, - hbmpItem: ::HBITMAP, -}} -pub type LPMENUITEMINFOW = *mut MENUITEMINFOW; -pub type LPCMENUITEMINFOW = *const MENUITEMINFOW; -STRUCT!{nodebug struct MSGBOXPARAMSA { - cbSize: ::UINT, - hwndOwner: ::HWND, - hInstance: ::HINSTANCE, - lpszText: ::LPCSTR, - lpszCaption: ::LPCSTR, - dwStyle: ::DWORD, - lpszIcon: ::LPCSTR, - dwContextHelpId: ::DWORD_PTR, - lpfnMsgBoxCallback: ::MSGBOXCALLBACK, - dwLanguageId: ::DWORD, -}} -pub type PMSGBOXPARAMSA = *mut MSGBOXPARAMSA; -pub type LPMSGBOXPARAMSA = *mut MSGBOXPARAMSA; -STRUCT!{nodebug struct MSGBOXPARAMSW { - cbSize: ::UINT, - hwndOwner: ::HWND, - hInstance: ::HINSTANCE, - lpszText: ::LPCWSTR, - lpszCaption: ::LPCWSTR, - dwStyle: ::DWORD, - lpszIcon: ::LPCWSTR, - dwContextHelpId: ::DWORD_PTR, - lpfnMsgBoxCallback: ::MSGBOXCALLBACK, - dwLanguageId: ::DWORD, -}} -pub type PMSGBOXPARAMSW = *mut MSGBOXPARAMSW; -pub type LPMSGBOXPARAMSW = *mut MSGBOXPARAMSW; -STRUCT!{struct HELPINFO { - cbSize: ::UINT, - iContextType: ::c_int, - iCtrlId: ::c_int, - hItemHandle: ::HANDLE, - dwContextId: ::DWORD, - MousePos: ::POINT, -}} -pub type LPHELPINFO = *mut HELPINFO; -#[allow(trivial_numeric_casts)] -pub fn GET_WHEEL_DELTA_WPARAM(wParam: ::WPARAM) -> ::c_short { - ::HIWORD(wParam as ::DWORD) as ::c_short -} -#[allow(trivial_numeric_casts)] -pub fn GET_KEYSTATE_WPARAM(wparam: ::WPARAM) -> ::c_int { - ::LOWORD(wparam as ::DWORD) as ::c_short as ::c_int -} -#[allow(trivial_numeric_casts)] -pub fn GET_XBUTTON_WPARAM(wparam: ::WPARAM) -> ::c_int { - ::HIWORD(wparam as ::DWORD) as ::c_int -} -pub const SIF_RANGE: ::UINT = 0x0001; -pub const SIF_PAGE: ::UINT = 0x0002; -pub const SIF_POS: ::UINT = 0x0004; -pub const SIF_DISABLENOSCROLL: ::UINT = 0x0008; -pub const SIF_TRACKPOS: ::UINT = 0x0010; -pub const SIF_ALL: ::UINT = SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS; -pub const SW_SCROLLCHILDREN: ::UINT = 0x0001; -pub const SW_INVALIDATE: ::UINT = 0x0002; -pub const SW_ERASE: ::UINT = 0x0004; -pub const SW_SMOOTHSCROLL: ::UINT = 0x0010; -pub const SB_LINEUP: ::c_int = 0; -pub const SB_LINELEFT: ::c_int = 0; -pub const SB_LINEDOWN: ::c_int = 1; -pub const SB_LINERIGHT: ::c_int = 1; -pub const SB_PAGEUP: ::c_int = 2; -pub const SB_PAGELEFT: ::c_int = 2; -pub const SB_PAGEDOWN: ::c_int = 3; -pub const SB_PAGERIGHT: ::c_int = 3; -pub const SB_THUMBPOSITION: ::c_int = 4; -pub const SB_THUMBTRACK: ::c_int = 5; -pub const SB_TOP: ::c_int = 6; -pub const SB_LEFT: ::c_int = 6; -pub const SB_BOTTOM: ::c_int = 7; -pub const SB_RIGHT: ::c_int = 7; -pub const SB_ENDSCROLL: ::c_int = 8; -pub const LR_DEFAULTCOLOR: ::UINT = 0x00000000; -pub const LR_MONOCHROME: ::UINT = 0x00000001; -pub const LR_COLOR: ::UINT = 0x00000002; -pub const LR_COPYRETURNORG: ::UINT = 0x00000004; -pub const LR_COPYDELETEORG: ::UINT = 0x00000008; -pub const LR_LOADFROMFILE: ::UINT = 0x00000010; -pub const LR_LOADTRANSPARENT: ::UINT = 0x00000020; -pub const LR_DEFAULTSIZE: ::UINT = 0x00000040; -pub const LR_VGACOLOR: ::UINT = 0x00000080; -pub const LR_LOADMAP3DCOLORS: ::UINT = 0x00001000; -pub const LR_CREATEDIBSECTION: ::UINT = 0x00002000; -pub const LR_COPYFROMRESOURCE: ::UINT = 0x00004000; -pub const LR_SHARED: ::UINT = 0x00008000; -pub const IMAGE_BITMAP: ::UINT = 0; -pub const IMAGE_ICON: ::UINT = 1; -pub const IMAGE_CURSOR: ::UINT = 2; -pub const IMAGE_ENHMETAFILE: ::UINT = 3; -pub const DT_TOP: ::UINT = 0x00000000; -pub const DT_LEFT: ::UINT = 0x00000000; -pub const DT_CENTER: ::UINT = 0x00000001; -pub const DT_RIGHT: ::UINT = 0x00000002; -pub const DT_VCENTER: ::UINT = 0x00000004; -pub const DT_BOTTOM: ::UINT = 0x00000008; -pub const DT_WORDBREAK: ::UINT = 0x00000010; -pub const DT_SINGLELINE: ::UINT = 0x00000020; -pub const DT_EXPANDTABS: ::UINT = 0x00000040; -pub const DT_TABSTOP: ::UINT = 0x00000080; -pub const DT_NOCLIP: ::UINT = 0x00000100; -pub const DT_EXTERNALLEADING: ::UINT = 0x00000200; -pub const DT_CALCRECT: ::UINT = 0x00000400; -pub const DT_NOPREFIX: ::UINT = 0x00000800; -pub const DT_INTERNAL: ::UINT = 0x00001000; -pub const DT_EDITCONTROL: ::UINT = 0x00002000; -pub const DT_PATH_ELLIPSIS: ::UINT = 0x00004000; -pub const DT_END_ELLIPSIS: ::UINT = 0x00008000; -pub const DT_MODIFYSTRING: ::UINT = 0x00010000; -pub const DT_RTLREADING: ::UINT = 0x00020000; -pub const DT_WORD_ELLIPSIS: ::UINT = 0x00040000; -pub const DT_NOFULLWIDTHCHARBREAK: ::UINT = 0x00080000; -pub const DT_HIDEPREFIX: ::UINT = 0x00100000; -pub const DT_PREFIXONLY: ::UINT = 0x00200000; -STRUCT!{struct KBDLLHOOKSTRUCT { - vkCode: ::DWORD, - scanCode: ::DWORD, - flags: ::DWORD, - time: ::DWORD, - dwExtraInfo: ::ULONG_PTR, -}} -pub type PKBDLLHOOKSTRUCT = *mut KBDLLHOOKSTRUCT; -pub type LPKBDLLHOOKSTRUCT = *mut KBDLLHOOKSTRUCT; -STRUCT!{struct MSLLHOOKSTRUCT { - pt: ::POINT, - mouseData: ::DWORD, - flags: ::DWORD, - time: ::DWORD, - dwExtraInfo: ::ULONG_PTR, -}} -pub type PMSLLHOOKSTRUCT = *mut MSLLHOOKSTRUCT; -pub type LPMSLLHOOKSTRUCT = *mut MSLLHOOKSTRUCT; -pub const WH_MIN: ::c_int = -1; -pub const WH_MSGFILTER: ::c_int = -1; -pub const WH_JOURNALRECORD: ::c_int = 0; -pub const WH_JOURNALPLAYBACK: ::c_int = 1; -pub const WH_KEYBOARD: ::c_int = 2; -pub const WH_GETMESSAGE: ::c_int = 3; -pub const WH_CALLWNDPROC: ::c_int = 4; -pub const WH_CBT: ::c_int = 5; -pub const WH_SYSMSGFILTER: ::c_int = 6; -pub const WH_MOUSE: ::c_int = 7; -pub const WH_HARDWARE: ::c_int = 8; -pub const WH_DEBUG: ::c_int = 9; -pub const WH_SHELL: ::c_int = 10; -pub const WH_FOREGROUNDIDLE: ::c_int = 11; -pub const WH_CALLWNDPROCRET: ::c_int = 12; -pub const WH_KEYBOARD_LL: ::c_int = 13; -pub const WH_MOUSE_LL: ::c_int = 14; -pub const WH_MAX: ::c_int = 14; -pub const WH_MINHOOK: ::c_int = WH_MIN; -pub const WH_MAXHOOK: ::c_int = WH_MAX; -pub const KLF_ACTIVATE: ::UINT = 1; -pub const KLF_SUBSTITUTE_OK: ::UINT = 2; -pub const KLF_UNLOADPREVIOUS: ::UINT = 4; -pub const KLF_REORDER: ::UINT = 8; -pub const KLF_REPLACELANG: ::UINT = 16; -pub const KLF_NOTELLSHELL: ::UINT = 128; -pub const KLF_SETFORPROCESS: ::UINT = 256; -//RedrawWindow() flags -pub const RDW_INVALIDATE: ::UINT = 0x0001; -pub const RDW_INTERNALPAINT: ::UINT = 0x0002; -pub const RDW_ERASE: ::UINT = 0x0004; -pub const RDW_VALIDATE: ::UINT = 0x0008; -pub const RDW_NOINTERNALPAINT: ::UINT = 0x0010; -pub const RDW_NOERASE: ::UINT = 0x0020; -pub const RDW_NOCHILDREN: ::UINT = 0x0040; -pub const RDW_ALLCHILDREN: ::UINT = 0x0080; -pub const RDW_UPDATENOW: ::UINT = 0x0100; -pub const RDW_ERASENOW: ::UINT = 0x0200; -pub const RDW_FRAME: ::UINT = 0x0400; -pub const RDW_NOFRAME: ::UINT = 0x0800; -STRUCT!{struct MEASUREITEMSTRUCT { - CtlType: ::UINT, - CtlID: ::UINT, - itemID: ::UINT, - itemWidth: ::UINT, - itemHeight: ::UINT, - itemData: ::ULONG_PTR, -}} -pub type LPMEASUREITEMSTRUCT = *mut MEASUREITEMSTRUCT; -STRUCT!{struct DRAWITEMSTRUCT { - CtlType: ::UINT, - CtlID: ::UINT, - itemID: ::UINT, - itemAction: ::UINT, - itemState: ::UINT, - hwndItem: ::HWND, - hDC: ::HDC, - rcItem: ::RECT, - itemData: ::ULONG_PTR, -}} -pub type LPDRAWITEMSTRUCT = *mut DRAWITEMSTRUCT; -STRUCT!{struct DELETEITEMSTRUCT { - CtlType: ::UINT, - CtlID: ::UINT, - itemID: ::UINT, - hwndItem: ::HWND, - itemData: ::ULONG_PTR, -}} -pub type LPDELETEITEMSTRUCT = *mut DELETEITEMSTRUCT; -STRUCT!{struct COMPAREITEMSTRUCT { - CtlType: ::UINT, - CtlID: ::UINT, - hwndItem: ::HWND, - itemID1: ::UINT, - itemData1: ::ULONG_PTR, - itemID2: ::UINT, - itemData2: ::ULONG_PTR, - dwLocaleId: ::DWORD, -}} -pub type LPCOMPAREITEMSTRUCT = *mut COMPAREITEMSTRUCT; -/* Image type */ -pub const DST_COMPLEX: ::UINT = 0x0000; -pub const DST_TEXT: ::UINT = 0x0001; -pub const DST_PREFIXTEXT: ::UINT = 0x0002; -pub const DST_ICON: ::UINT = 0x0003; -pub const DST_BITMAP: ::UINT = 0x0004; -pub const DI_MASK: ::UINT = 0x0001; -pub const DI_IMAGE: ::UINT = 0x0002; -pub const DI_NORMAL: ::UINT = 0x0003; -pub const DI_COMPAT: ::UINT = 0x0004; -pub const DI_DEFAULTSIZE: ::UINT = 0x0008; -// if WINVER >= 0x0601 -// GetSystemMetrics(SM_DIGITIZER) flag values -pub const NID_INTEGRATED_TOUCH: ::UINT = 0x00000001; -pub const NID_EXTERNAL_TOUCH: ::UINT = 0x00000002; -pub const NID_INTEGRATED_PEN: ::UINT = 0x00000004; -pub const NID_EXTERNAL_PEN: ::UINT = 0x00000008; -pub const NID_MULTI_INPUT: ::UINT = 0x00000040; -pub const NID_READY: ::UINT = 0x00000080; -// end if WINVER >= 0x0601 - -// System Menu Command Values -// -pub const SC_SIZE: ::WPARAM = 0xF000; -pub const SC_MOVE: ::WPARAM = 0xF010; -pub const SC_MINIMIZE: ::WPARAM = 0xF020; -pub const SC_MAXIMIZE: ::WPARAM = 0xF030; -pub const SC_NEXTWINDOW: ::WPARAM = 0xF040; -pub const SC_PREVWINDOW: ::WPARAM = 0xF050; -pub const SC_CLOSE: ::WPARAM = 0xF060; -pub const SC_VSCROLL: ::WPARAM = 0xF070; -pub const SC_HSCROLL: ::WPARAM = 0xF080; -pub const SC_MOUSEMENU: ::WPARAM = 0xF090; -pub const SC_KEYMENU: ::WPARAM = 0xF100; -pub const SC_ARRANGE: ::WPARAM = 0xF110; -pub const SC_RESTORE: ::WPARAM = 0xF120; -pub const SC_TASKLIST: ::WPARAM = 0xF130; -pub const SC_SCREENSAVE: ::WPARAM = 0xF140; -pub const SC_HOTKEY: ::WPARAM = 0xF150; -// if WINVER >= 0x0400 -pub const SC_DEFAULT: ::WPARAM = 0xF160; -pub const SC_MONITORPOWER: ::WPARAM = 0xF170; -pub const SC_CONTEXTHELP: ::WPARAM = 0xF180; -pub const SC_SEPARATOR: ::WPARAM = 0xF00F; -// endif WINVER >= 0x0400 diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/ws2def.rs cargo-0.37.0/vendor/winapi-0.2.8/src/ws2def.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/ws2def.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/ws2def.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,279 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! This file contains the core definitions for the Winsock2 specification that can be used by -//! both user-mode and kernel mode modules. -pub type ADDRESS_FAMILY = ::USHORT; -pub const AF_UNSPEC: ::c_int = 0; -pub const AF_UNIX: ::c_int = 1; -pub const AF_INET: ::c_int = 2; -pub const AF_IMPLINK: ::c_int = 3; -pub const AF_PUP: ::c_int = 4; -pub const AF_CHAOS: ::c_int = 5; -pub const AF_NS: ::c_int = 6; -pub const AF_IPX: ::c_int = AF_NS; -pub const AF_ISO: ::c_int = 7; -pub const AF_OSI: ::c_int = AF_ISO; -pub const AF_ECMA: ::c_int = 8; -pub const AF_DATAKIT: ::c_int = 9; -pub const AF_CCITT: ::c_int = 10; -pub const AF_SNA: ::c_int = 11; -pub const AF_DECnet: ::c_int = 12; -pub const AF_DLI: ::c_int = 13; -pub const AF_LAT: ::c_int = 14; -pub const AF_HYLINK: ::c_int = 15; -pub const AF_APPLETALK: ::c_int = 16; -pub const AF_NETBIOS: ::c_int = 17; -pub const AF_VOICEVIEW: ::c_int = 18; -pub const AF_FIREFOX: ::c_int = 19; -pub const AF_UNKNOWN1: ::c_int = 20; -pub const AF_BAN: ::c_int = 21; -pub const AF_ATM: ::c_int = 22; -pub const AF_INET6: ::c_int = 23; -pub const AF_CLUSTER: ::c_int = 24; -pub const AF_12844: ::c_int = 25; -pub const AF_IRDA: ::c_int = 26; -pub const AF_NETDES: ::c_int = 28; -pub const AF_TCNPROCESS: ::c_int = 29; -pub const AF_TCNMESSAGE: ::c_int = 30; -pub const AF_ICLFXBM: ::c_int = 31; -pub const AF_BTH: ::c_int = 32; -pub const AF_LINK: ::c_int = 33; -pub const AF_MAX: ::c_int = 34; -pub const SOCK_STREAM: ::c_int = 1; -pub const SOCK_DGRAM: ::c_int = 2; -pub const SOCK_RAW: ::c_int = 3; -pub const SOCK_RDM: ::c_int = 4; -pub const SOCK_SEQPACKET: ::c_int = 5; -pub const SOL_SOCKET: ::c_int = 0xffff; -pub const SO_DEBUG: ::c_int = 0x0001; -pub const SO_ACCEPTCONN: ::c_int = 0x0002; -pub const SO_REUSEADDR: ::c_int = 0x0004; -pub const SO_KEEPALIVE: ::c_int = 0x0008; -pub const SO_DONTROUTE: ::c_int = 0x0010; -pub const SO_BROADCAST: ::c_int = 0x0020; -pub const SO_USELOOPBACK: ::c_int = 0x0040; -pub const SO_LINGER: ::c_int = 0x0080; -pub const SO_OOBINLINE: ::c_int = 0x0100; -pub const SO_DONTLINGER: ::c_int = !SO_LINGER; -pub const SO_EXCLUSIVEADDRUSE: ::c_int = !SO_REUSEADDR; -pub const SO_SNDBUF: ::c_int = 0x1001; -pub const SO_RCVBUF: ::c_int = 0x1002; -pub const SO_SNDLOWAT: ::c_int = 0x1003; -pub const SO_RCVLOWAT: ::c_int = 0x1004; -pub const SO_SNDTIMEO: ::c_int = 0x1005; -pub const SO_RCVTIMEO: ::c_int = 0x1006; -pub const SO_ERROR: ::c_int = 0x1007; -pub const SO_TYPE: ::c_int = 0x1008; -pub const SO_BSP_STATE: ::c_int = 0x1009; -pub const SO_GROUP_ID: ::c_int = 0x2001; -pub const SO_GROUP_PRIORITY: ::c_int = 0x2002; -pub const SO_MAX_MSG_SIZE: ::c_int = 0x2003; -pub const SO_CONDITIONAL_ACCEPT: ::c_int = 0x3002; -pub const SO_PAUSE_ACCEPT: ::c_int = 0x3003; -pub const SO_COMPARTMENT_ID: ::c_int = 0x3004; -pub const SO_RANDOMIZE_PORT: ::c_int = 0x3005; -pub const SO_PORT_SCALABILITY: ::c_int = 0x3006; -pub const WSK_SO_BASE: ::c_int = 0x4000; -pub const TCP_NODELAY: ::c_int = 0x0001; -STRUCT!{struct SOCKADDR { - sa_family: ADDRESS_FAMILY, - sa_data: [::CHAR; 14], -}} -pub type PSOCKADDR = *mut SOCKADDR; -pub type LPSOCKADDR = *mut SOCKADDR; -STRUCT!{struct SOCKET_ADDRESS { - lpSockaddr: LPSOCKADDR, - iSockaddrLength: ::INT, -}} -pub type PSOCKET_ADDRESS = *mut SOCKET_ADDRESS; -pub type LPSOCKET_ADDRESS = *mut SOCKET_ADDRESS; -STRUCT!{nodebug struct SOCKET_ADDRESS_LIST { - iAddressCount: ::INT, - Address: [SOCKET_ADDRESS; 0], -}} -pub type PSOCKET_ADDRESS_LIST = *mut SOCKET_ADDRESS_LIST; -pub type LPSOCKET_ADDRESS_LIST = *mut SOCKET_ADDRESS_LIST; -STRUCT!{struct CSADDR_INFO { - LocalAddr: SOCKET_ADDRESS, - RemoteAddr: SOCKET_ADDRESS, - iSocketType: ::INT, - iProtocol: ::INT, -}} -pub type PCSADDR_INFO = *mut CSADDR_INFO; -pub type LPCSADDR_INFO = *mut CSADDR_INFO; -STRUCT!{nodebug struct SOCKADDR_STORAGE_LH { - ss_family: ADDRESS_FAMILY, - __ss_pad1: [::CHAR; 6], - __ss_align: ::__int64, - __ss_pad2: [::CHAR; 112], -}} -pub type PSOCKADDR_STORAGE_LH = *mut SOCKADDR_STORAGE_LH; -pub type LPSOCKADDR_STORAGE_LH = *mut SOCKADDR_STORAGE_LH; -STRUCT!{nodebug struct SOCKADDR_STORAGE_XP { - ss_family: ::c_short, - __ss_pad1: [::CHAR; 6], - __ss_align: ::__int64, - __ss_pad2: [::CHAR; 112], -}} -pub type PSOCKADDR_STORAGE_XP = *mut SOCKADDR_STORAGE_XP; -pub type LPSOCKADDR_STORAGE_XP = *mut SOCKADDR_STORAGE_XP; -pub type SOCKADDR_STORAGE = SOCKADDR_STORAGE_LH; -pub type PSOCKADDR_STORAGE = *mut SOCKADDR_STORAGE; -pub type LPSOCKADDR_STORAGE = *mut SOCKADDR_STORAGE; -STRUCT!{struct SOCKET_PROCESSOR_AFFINITY { - Processor: ::PROCESSOR_NUMBER, - NumaNodeId: ::USHORT, - Reserved: ::USHORT, -}} -pub type PSOCKET_PROCESSOR_AFFINITY = *mut SOCKET_PROCESSOR_AFFINITY; -pub const IOC_UNIX: ::DWORD = 0x00000000; -pub const IOC_WS2: ::DWORD = 0x08000000; -pub const IOC_PROTOCOL: ::DWORD = 0x10000000; -pub const IOC_VENDOR: ::DWORD = 0x18000000; -pub const IOC_WSK: ::DWORD = IOC_WS2 | 0x07000000; -macro_rules! _WSAIO { ($x:expr, $y:expr) => { IOC_VOID | $x | $y } } -macro_rules! _WSAIOR { ($x:expr, $y:expr) => { IOC_OUT | $x | $y } } -macro_rules! _WSAIOW { ($x:expr, $y:expr) => { IOC_IN | $x | $y } } -macro_rules! _WSAIORW { ($x:expr, $y:expr) => { IOC_INOUT | $x | $y } } -pub const SIO_ASSOCIATE_HANDLE: ::DWORD = _WSAIOW!(IOC_WS2, 1); -pub const SIO_ENABLE_CIRCULAR_QUEUEING: ::DWORD = _WSAIO!(IOC_WS2, 2); -pub const SIO_FIND_ROUTE: ::DWORD = _WSAIOR!(IOC_WS2, 3); -pub const SIO_FLUSH: ::DWORD = _WSAIO!(IOC_WS2, 4); -pub const SIO_GET_BROADCAST_ADDRESS: ::DWORD = _WSAIOR!(IOC_WS2, 5); -pub const SIO_GET_EXTENSION_FUNCTION_POINTER: ::DWORD = _WSAIORW!(IOC_WS2, 6); -pub const SIO_GET_QOS: ::DWORD = _WSAIORW!(IOC_WS2, 7); -pub const SIO_GET_GROUP_QOS: ::DWORD = _WSAIORW!(IOC_WS2, 8); -pub const SIO_MULTIPOINT_LOOPBACK: ::DWORD = _WSAIOW!(IOC_WS2, 9); -pub const SIO_MULTICAST_SCOPE: ::DWORD = _WSAIOW!(IOC_WS2, 10); -pub const SIO_SET_QOS: ::DWORD = _WSAIOW!(IOC_WS2, 11); -pub const SIO_SET_GROUP_QOS: ::DWORD = _WSAIOW!(IOC_WS2, 12); -pub const SIO_TRANSLATE_HANDLE: ::DWORD = _WSAIORW!(IOC_WS2, 13); -pub const SIO_ROUTING_INTERFACE_QUERY: ::DWORD = _WSAIORW!(IOC_WS2, 20); -pub const SIO_ROUTING_INTERFACE_CHANGE: ::DWORD = _WSAIOW!(IOC_WS2, 21); -pub const SIO_ADDRESS_LIST_QUERY: ::DWORD = _WSAIOR!(IOC_WS2, 22); -pub const SIO_ADDRESS_LIST_CHANGE: ::DWORD = _WSAIO!(IOC_WS2, 23); -pub const SIO_QUERY_TARGET_PNP_HANDLE: ::DWORD = _WSAIOR!(IOC_WS2, 24); -pub const SIO_QUERY_RSS_PROCESSOR_INFO: ::DWORD = _WSAIOR!(IOC_WS2, 37); -pub const SIO_ADDRESS_LIST_SORT: ::DWORD = _WSAIORW!(IOC_WS2, 25); -pub const SIO_RESERVED_1: ::DWORD = _WSAIOW!(IOC_WS2, 26); -pub const SIO_RESERVED_2: ::DWORD = _WSAIOW!(IOC_WS2, 33); -pub const SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER: ::DWORD = _WSAIORW!(IOC_WS2, 36); -pub const IPPROTO_IP: ::c_int = 0; -ENUM!{enum IPPROTO { - IPPROTO_HOPOPTS = 0, // IPv6 Hop-by-Hop options - IPPROTO_ICMP = 1, - IPPROTO_IGMP = 2, - IPPROTO_GGP = 3, - IPPROTO_IPV4 = 4, - IPPROTO_ST = 5, - IPPROTO_TCP = 6, - IPPROTO_CBT = 7, - IPPROTO_EGP = 8, - IPPROTO_IGP = 9, - IPPROTO_PUP = 12, - IPPROTO_UDP = 17, - IPPROTO_IDP = 22, - IPPROTO_RDP = 27, - IPPROTO_IPV6 = 41, // IPv6 header - IPPROTO_ROUTING = 43, // IPv6 Routing header - IPPROTO_FRAGMENT = 44, // IPv6 fragmentation header - IPPROTO_ESP = 50, // encapsulating security payload - IPPROTO_AH = 51, // authentication header - IPPROTO_ICMPV6 = 58, // ICMPv6 - IPPROTO_NONE = 59, // IPv6 no next header - IPPROTO_DSTOPTS = 60, // IPv6 Destination options - IPPROTO_ND = 77, - IPPROTO_ICLFXBM = 78, - IPPROTO_PIM = 103, - IPPROTO_PGM = 113, - IPPROTO_L2TP = 115, - IPPROTO_SCTP = 132, - IPPROTO_RAW = 255, - IPPROTO_MAX = 256, - IPPROTO_RESERVED_RAW = 257, - IPPROTO_RESERVED_IPSEC = 258, - IPPROTO_RESERVED_IPSECOFFLOAD = 259, - IPPROTO_RESERVED_WNV = 260, - IPPROTO_RESERVED_MAX = 261, -}} -pub type PIPPROTO = *mut IPPROTO; -STRUCT!{struct SOCKADDR_IN { - sin_family: ADDRESS_FAMILY, - sin_port: ::USHORT, - sin_addr: ::IN_ADDR, - sin_zero: [::CHAR; 8], -}} -pub type PSOCKADDR_IN = *mut SOCKADDR_IN; -//645 -pub const IOCPARM_MASK: ::DWORD = 0x7f; -pub const IOC_VOID: ::DWORD = 0x20000000; -pub const IOC_OUT: ::DWORD = 0x40000000; -pub const IOC_IN: ::DWORD = 0x80000000; -pub const IOC_INOUT: ::DWORD = IOC_IN | IOC_OUT; -STRUCT!{struct WSABUF { - len: ::ULONG, - buf: *mut ::CHAR, -}} -pub type LPWSABUF = *mut WSABUF; -STRUCT!{struct WSAMSG { - name: LPSOCKADDR, - namelen: ::INT, - lpBuffers: LPWSABUF, - dwBufferCount: ::ULONG, - Control: WSABUF, - dwFlags: ::ULONG, -}} -pub type PWSAMSG = *mut WSAMSG; -pub type LPWSAMSG = *mut WSAMSG; -STRUCT!{struct ADDRINFOA { - ai_flags: ::c_int, - ai_family: ::c_int, - ai_socktype: ::c_int, - ai_protocol: ::c_int, - ai_addrlen: ::size_t, - ai_canonname: *mut ::c_char, - ai_addr: *mut SOCKADDR, - ai_next: *mut ADDRINFOA, -}} -pub type PADDRINFOA = *mut ADDRINFOA; -STRUCT!{struct ADDRINFOW { - ai_flags: ::c_int, - ai_family: ::c_int, - ai_socktype: ::c_int, - ai_protocol: ::c_int, - ai_addrlen: ::size_t, - ai_canonname: ::PWSTR, - ai_addr: *mut SOCKADDR, - ai_next: *mut ADDRINFOW, -}} -pub type PADDRINFOW = *mut ADDRINFOW; -STRUCT!{struct ADDRINFOEXA { - ai_flags: ::c_int, - ai_family: ::c_int, - ai_socktype: ::c_int, - ai_protocol: ::c_int, - ai_addrlen: ::size_t, - ai_canonname: *mut ::c_char, - ai_addr: *mut SOCKADDR, - ai_blob: *mut ::c_void, - ai_bloblen: ::size_t, - ai_provider: ::LPGUID, - ai_next: *mut ADDRINFOEXW, -}} -pub type PADDRINFOEXA = *mut ADDRINFOEXA; -pub type LPADDRINFOEXA = *mut ADDRINFOEXA; -STRUCT!{struct ADDRINFOEXW { - ai_flags: ::c_int, - ai_family: ::c_int, - ai_socktype: ::c_int, - ai_protocol: ::c_int, - ai_addrlen: ::size_t, - ai_canonname: ::PWSTR, - ai_addr: *mut SOCKADDR, - ai_blob: *mut ::c_void, - ai_bloblen: ::size_t, - ai_provider: ::LPGUID, - ai_next: *mut ADDRINFOEXW, -}} -pub type PADDRINFOEXW = *mut ADDRINFOEXW; -pub type LPADDRINFOEXW = *mut ADDRINFOEXW; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/ws2ipdef.rs cargo-0.37.0/vendor/winapi-0.2.8/src/ws2ipdef.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/ws2ipdef.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/ws2ipdef.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -pub const IPV6_HOPOPTS: ::c_int = 1; -pub const IPV6_HDRINCL: ::c_int = 2; -pub const IPV6_UNICAST_HOPS: ::c_int = 4; -pub const IPV6_MULTICAST_IF: ::c_int = 9; -pub const IPV6_MULTICAST_HOPS: ::c_int = 10; -pub const IPV6_MULTICAST_LOOP: ::c_int = 11; -pub const IPV6_ADD_MEMBERSHIP: ::c_int = 12; -pub const IPV6_JOIN_GROUP: ::c_int = IPV6_ADD_MEMBERSHIP; -pub const IPV6_DROP_MEMBERSHIP: ::c_int = 13; -pub const IPV6_LEAVE_GROUP: ::c_int = IPV6_DROP_MEMBERSHIP; -pub const IPV6_DONTFRAG: ::c_int = 14; -pub const IPV6_PKTINFO: ::c_int = 19; -pub const IPV6_HOPLIMIT: ::c_int = 21; -pub const IPV6_PROTECTION_LEVEL: ::c_int = 23; -pub const IPV6_RECVIF: ::c_int = 24; -pub const IPV6_RECVDSTADDR: ::c_int = 25; -pub const IPV6_CHECKSUM: ::c_int = 26; -pub const IPV6_V6ONLY: ::c_int = 27; -pub const IPV6_IFLIST: ::c_int = 28; -pub const IPV6_ADD_IFLIST: ::c_int = 29; -pub const IPV6_DEL_IFLIST: ::c_int = 30; -pub const IPV6_UNICAST_IF: ::c_int = 31; -pub const IPV6_RTHDR: ::c_int = 32; -pub const IPV6_RECVRTHDR: ::c_int = 38; -pub const IPV6_TCLASS: ::c_int = 39; -pub const IPV6_RECVTCLASS: ::c_int = 40; -STRUCT!{struct ipv6_mreq { - ipv6mr_multiaddr: in6_addr, - ipv6mr_interface: ::c_uint, -}} -STRUCT!{struct in6_addr { - s6_addr: [u8; 16], -}} -STRUCT!{struct sockaddr_in6 { - sin6_family: ::c_short, - sin6_port: ::c_ushort, - sin6_flowinfo: ::c_ulong, - sin6_addr: in6_addr, - sin6_scope_id: ::c_ulong, -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/ws2spi.rs cargo-0.37.0/vendor/winapi-0.2.8/src/ws2spi.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/ws2spi.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/ws2spi.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! Definitions to be used with the WinSock service provider -pub const WSPDESCRIPTION_LEN: usize = 255; -STRUCT!{nodebug struct WSPDATA { - wVersion: ::WORD, - wHighVersion: ::WORD, - szDescription: [::WCHAR; WSPDESCRIPTION_LEN + 1], -}} -pub type LPWSPDATA = *mut WSPDATA; -STRUCT!{struct WSATHREADID { - ThreadHandle: ::HANDLE, - Reserved: ::DWORD_PTR, -}} -pub type LPWSATHREADID = *mut WSATHREADID; -pub type LPNSPV2STARTUP = Option ::INT>; -pub type LPNSPV2CLEANUP = Option ::INT>; -pub type LPNSPV2LOOKUPSERVICEBEGIN = Option ::INT>; -pub type LPNSPV2LOOKUPSERVICENEXTEX = Option; -pub type LPNSPV2LOOKUPSERVICEEND = Option ::INT>; -pub type LPNSPV2SETSERVICEEX = Option; -pub type LPNSPV2CLIENTSESSIONRUNDOWN = Option; -STRUCT!{nodebug struct NSPV2_ROUTINE { - cbSize: ::DWORD, - dwMajorVersion: ::DWORD, - dwMinorVersion: ::DWORD, - NSPv2Startup: LPNSPV2STARTUP, - NSPv2Cleanup: LPNSPV2CLEANUP, - NSPv2LookupServiceBegin: LPNSPV2LOOKUPSERVICEBEGIN, - NSPv2LookupServiceNextEx: LPNSPV2LOOKUPSERVICENEXTEX, - NSPv2LookupServiceEnd: LPNSPV2LOOKUPSERVICEEND, - NSPv2SetServiceEx: LPNSPV2SETSERVICEEX, - NSPv2ClientSessionRundown: LPNSPV2CLIENTSESSIONRUNDOWN, -}} -pub type PNSPV2_ROUTINE = *mut NSPV2_ROUTINE; -pub type LPNSPV2_ROUTINE = *mut NSPV2_ROUTINE; -pub type PCNSPV2_ROUTINE = *const NSPV2_ROUTINE; -pub type LPCNSPV2_ROUTINE = *const NSPV2_ROUTINE; -ENUM!{enum WSC_PROVIDER_INFO_TYPE { - ProviderInfoLspCategories, - ProviderInfoAudit, -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/ws2tcpip.rs cargo-0.37.0/vendor/winapi-0.2.8/src/ws2tcpip.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/ws2tcpip.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/ws2tcpip.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -// Copyright © 2015, skdltmxn -// Licensed under the MIT License -//! WinSock2 Extension for TCP/IP protocols -pub type LPLOOKUPSERVICE_COMPLETION_ROUTINE = Option; -pub type socklen_t = ::c_int; -STRUCT!{struct ip_mreq { - imr_multiaddr: ::in_addr, - imr_interface: ::in_addr, -}} -pub const IP_OPTIONS: ::c_int = 1; -pub const IP_HDRINCL: ::c_int = 2; -pub const IP_TOS: ::c_int = 3; -pub const IP_TTL: ::c_int = 4; -pub const IP_MULTICAST_IF: ::c_int = 9; -pub const IP_MULTICAST_TTL: ::c_int = 10; -pub const IP_MULTICAST_LOOP: ::c_int = 11; -pub const IP_ADD_MEMBERSHIP: ::c_int = 12; -pub const IP_DROP_MEMBERSHIP: ::c_int = 13; -pub const IP_DONTFRAGMENT: ::c_int = 14; -pub const IP_ADD_SOURCE_MEMBERSHIP: ::c_int = 15; -pub const IP_DROP_SOURCE_MEMBERSHIP: ::c_int = 16; -pub const IP_BLOCK_SOURCE: ::c_int = 17; -pub const IP_UNBLOCK_SOURCE: ::c_int = 18; -pub const IP_PKTINFO: ::c_int = 19; -pub const IP_RECEIVE_BROADCAST: ::c_int = 22; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/wtypesbase.rs cargo-0.37.0/vendor/winapi-0.2.8/src/wtypesbase.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/wtypesbase.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/wtypesbase.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//114 -pub type OLECHAR = ::WCHAR; -pub type LPOLESTR = *mut OLECHAR; -pub type LPCOLESTR = *const OLECHAR; -//147 -pub type DOUBLE = ::c_double; -//281 -pub type SCODE = ::LONG; -pub type PSCODE = *mut SCODE; -STRUCT!{struct BLOB { - cbSize: ::ULONG, - pBlobData: *mut ::BYTE, -}} -pub type LPBLOB = *mut BLOB; -STRUCT!{struct FLAGGED_WORD_BLOB { - fFlags: ::ULONG, - clSize: ::ULONG, - asData: [::c_ushort; 1], -}} -STRUCT!{struct BYTE_SIZEDARR { - clSize: ::ULONG, - pData: *mut ::BYTE, -}} -STRUCT!{struct WORD_SIZEDARR { - clSize: ::ULONG, - pData: *mut ::c_ushort, -}} -STRUCT!{struct DWORD_SIZEDARR { - clSize: ::ULONG, - pData: *mut ::ULONG, -}} -STRUCT!{struct HYPER_SIZEDARR { - clSize: ::ULONG, - pData: *mut i64, -}} diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/wtypes.rs cargo-0.37.0/vendor/winapi-0.2.8/src/wtypes.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/wtypes.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/wtypes.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,75 +0,0 @@ -// Copyright © 2015, Connor Hilarides -// Licensed under the MIT License -//! Mappings for the contents of wstypes.h -ENUM!{enum VARENUM { - VT_EMPTY = 0, - VT_NULL = 1, - VT_I2 = 2, - VT_I4 = 3, - VT_R4 = 4, - VT_R8 = 5, - VT_CY = 6, - VT_DATE = 7, - VT_BSTR = 8, - VT_DISPATCH = 9, - VT_ERROR = 10, - VT_BOOL = 11, - VT_VARIANT = 12, - VT_UNKNOWN = 13, - VT_DECIMAL = 14, - VT_I1 = 16, - VT_UI1 = 17, - VT_UI2 = 18, - VT_UI4 = 19, - VT_I8 = 20, - VT_UI8 = 21, - VT_INT = 22, - VT_UINT = 23, - VT_VOID = 24, - VT_HRESULT = 25, - VT_PTR = 26, - VT_SAFEARRAY = 27, - VT_CARRAY = 28, - VT_USERDEFINED = 29, - VT_LPSTR = 30, - VT_LPWSTR = 31, - VT_RECORD = 36, - VT_INT_PTR = 37, - VT_UINT_PTR = 38, - VT_FILETIME = 64, - VT_BLOB = 65, - VT_STREAM = 66, - VT_STORAGE = 67, - VT_STREAMED_OBJECT = 68, - VT_STORED_OBJECT = 69, - VT_BLOB_OBJECT = 70, - VT_CF = 71, - VT_CLSID = 72, - VT_VERSIONED_STREAM = 73, - VT_BSTR_BLOB = 0xfff, - VT_VECTOR = 0x1000, - VT_ARRAY = 0x2000, - VT_BYREF = 0x4000, - VT_RESERVED = 0x8000, - VT_ILLEGAL = 0xffff, -}} -pub const VT_ILLEGALMASKED: VARENUM = VT_BSTR_BLOB; -pub const VT_TYPEMASK: VARENUM = VT_BSTR_BLOB; -pub type DATE = ::c_double; -STRUCT!{struct CY { - int64: ::LONGLONG, -}} -STRUCT!{struct DECIMAL { - wReserved: ::USHORT, - scale: ::BYTE, - sign: ::BYTE, - Hi32: ::ULONG, - Lo64: ::ULONGLONG, -}} -pub const DECIMAL_NEG: ::BYTE = 0x80; -pub type LPDECIMAL = *mut DECIMAL; -pub type VARTYPE = ::c_ushort; -pub type wireBSTR = *mut ::FLAGGED_WORD_BLOB; -pub type BSTR = *mut ::OLECHAR; -pub type LPBSTR = *mut BSTR; -pub type VARIANT_BOOL = ::c_short; diff -Nru cargo-0.35.0/vendor/winapi-0.2.8/src/xinput.rs cargo-0.37.0/vendor/winapi-0.2.8/src/xinput.rs --- cargo-0.35.0/vendor/winapi-0.2.8/src/xinput.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-0.2.8/src/xinput.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,118 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -//! XInput procedure declarations, constant definitions and macros -pub const XINPUT_DEVTYPE_GAMEPAD: ::BYTE = 0x01; -pub const XINPUT_DEVSUBTYPE_GAMEPAD: ::BYTE = 0x01; -pub const XINPUT_DEVSUBTYPE_WHEEL: ::BYTE = 0x02; -pub const XINPUT_DEVSUBTYPE_ARCADE_STICK: ::BYTE = 0x03; -pub const XINPUT_DEVSUBTYPE_FLIGHT_SICK: ::BYTE = 0x04; -pub const XINPUT_DEVSUBTYPE_DANCE_PAD: ::BYTE = 0x05; -pub const XINPUT_DEVSUBTYPE_GUITAR: ::BYTE = 0x06; -pub const XINPUT_DEVSUBTYPE_DRUM_KIT: ::BYTE = 0x08; -pub const XINPUT_CAPS_VOICE_SUPPORTED: ::WORD = 0x0004; -pub const XINPUT_GAMEPAD_DPAD_UP: ::WORD = 0x0001; -pub const XINPUT_GAMEPAD_DPAD_DOWN: ::WORD = 0x0002; -pub const XINPUT_GAMEPAD_DPAD_LEFT: ::WORD = 0x0004; -pub const XINPUT_GAMEPAD_DPAD_RIGHT: ::WORD = 0x0008; -pub const XINPUT_GAMEPAD_START: ::WORD = 0x0010; -pub const XINPUT_GAMEPAD_BACK: ::WORD = 0x0020; -pub const XINPUT_GAMEPAD_LEFT_THUMB: ::WORD = 0x0040; -pub const XINPUT_GAMEPAD_RIGHT_THUMB: ::WORD = 0x0080; -pub const XINPUT_GAMEPAD_LEFT_SHOULDER: ::WORD = 0x0100; -pub const XINPUT_GAMEPAD_RIGHT_SHOULDER: ::WORD = 0x0200; -pub const XINPUT_GAMEPAD_A: ::WORD = 0x1000; -pub const XINPUT_GAMEPAD_B: ::WORD = 0x2000; -pub const XINPUT_GAMEPAD_X: ::WORD = 0x4000; -pub const XINPUT_GAMEPAD_Y: ::WORD = 0x8000; -pub const XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE: ::SHORT = 7849; -pub const XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE: ::SHORT = 8689; -pub const XINPUT_GAMEPAD_TRIGGER_THRESHOLD: ::BYTE = 30; -pub const XINPUT_FLAG_GAMEPAD: ::DWORD = 0x00000001; -pub const BATTERY_DEVTYPE_GAMEPAD: ::BYTE = 0x00; -pub const BATTERY_DEVTYPE_HEADSET: ::BYTE = 0x01; -pub const BATTERY_TYPE_DISCONNECTED: ::BYTE = 0x00; -pub const BATTERY_TYPE_WIRED: ::BYTE = 0x01; -pub const BATTERY_TYPE_ALKALINE: ::BYTE = 0x02; -pub const BATTERY_TYPE_NIMH: ::BYTE = 0x03; -pub const BATTERY_TYPE_UNKNOWN: ::BYTE = 0xFF; -pub const BATTERY_LEVEL_EMPTY: ::BYTE = 0x00; -pub const BATTERY_LEVEL_LOW: ::BYTE = 0x01; -pub const BATTERY_LEVEL_MEDIUM: ::BYTE = 0x02; -pub const BATTERY_LEVEL_FULL: ::BYTE = 0x03; -pub const XUSER_MAX_COUNT: ::DWORD = 4; -pub const XUSER_INDEX_ANY: ::DWORD = 0x000000FF; -pub const VK_PAD_A: ::WORD = 0x5800; -pub const VK_PAD_B: ::WORD = 0x5801; -pub const VK_PAD_X: ::WORD = 0x5802; -pub const VK_PAD_Y: ::WORD = 0x5803; -pub const VK_PAD_RSHOULDER: ::WORD = 0x5804; -pub const VK_PAD_LSHOULDER: ::WORD = 0x5805; -pub const VK_PAD_LTRIGGER: ::WORD = 0x5806; -pub const VK_PAD_RTRIGGER: ::WORD = 0x5807; -pub const VK_PAD_DPAD_UP: ::WORD = 0x5810; -pub const VK_PAD_DPAD_DOWN: ::WORD = 0x5811; -pub const VK_PAD_DPAD_LEFT: ::WORD = 0x5812; -pub const VK_PAD_DPAD_RIGHT: ::WORD = 0x5813; -pub const VK_PAD_START: ::WORD = 0x5814; -pub const VK_PAD_BACK: ::WORD = 0x5815; -pub const VK_PAD_LTHUMB_PRESS: ::WORD = 0x5816; -pub const VK_PAD_RTHUMB_PRESS: ::WORD = 0x5817; -pub const VK_PAD_LTHUMB_UP: ::WORD = 0x5820; -pub const VK_PAD_LTHUMB_DOWN: ::WORD = 0x5821; -pub const VK_PAD_LTHUMB_RIGHT: ::WORD = 0x5822; -pub const VK_PAD_LTHUMB_LEFT: ::WORD = 0x5823; -pub const VK_PAD_LTHUMB_UPLEFT: ::WORD = 0x5824; -pub const VK_PAD_LTHUMB_UPRIGHT: ::WORD = 0x5825; -pub const VK_PAD_LTHUMB_DOWNRIGHT: ::WORD = 0x5826; -pub const VK_PAD_LTHUMB_DOWNLEFT: ::WORD = 0x5827; -pub const VK_PAD_RTHUMB_UP: ::WORD = 0x5830; -pub const VK_PAD_RTHUMB_DOWN: ::WORD = 0x5831; -pub const VK_PAD_RTHUMB_RIGHT: ::WORD = 0x5832; -pub const VK_PAD_RTHUMB_LEFT: ::WORD = 0x5833; -pub const VK_PAD_RTHUMB_UPLEFT: ::WORD = 0x5834; -pub const VK_PAD_RTHUMB_UPRIGHT: ::WORD = 0x5835; -pub const VK_PAD_RTHUMB_DOWNRIGHT: ::WORD = 0x5836; -pub const VK_PAD_RTHUMB_DOWNLEFT: ::WORD = 0x5837; -pub const XINPUT_KEYSTROKE_KEYDOWN: ::WORD = 0x0001; -pub const XINPUT_KEYSTROKE_KEYUP: ::WORD = 0x0002; -pub const XINPUT_KEYSTROKE_REPEAT: ::WORD = 0x0004; -STRUCT!{struct XINPUT_GAMEPAD { - wButtons: ::WORD, - bLeftTrigger: ::BYTE, - bRightTrigger: ::BYTE, - sThumbLX: ::SHORT, - sThumbLY: ::SHORT, - sThumbRX: ::SHORT, - sThumbRY: ::SHORT, -}} -pub type PXINPUT_GAMEPAD = *mut XINPUT_GAMEPAD; -STRUCT!{struct XINPUT_STATE { - dwPacketNumber: ::DWORD, - Gamepad: ::XINPUT_GAMEPAD, -}} -pub type PXINPUT_STATE = *mut XINPUT_STATE; -STRUCT!{struct XINPUT_VIBRATION { - wLeftMotorSpeed: ::WORD, - wRightMotorSpeed: ::WORD, -}} -pub type PXINPUT_VIBRATION = *mut XINPUT_VIBRATION; -STRUCT!{struct XINPUT_CAPABILITIES { - Type: ::BYTE, - SubType: ::BYTE, - Flags: ::WORD, - Gamepad: ::XINPUT_GAMEPAD, - Vibration: ::XINPUT_VIBRATION, -}} -pub type PXINPUT_CAPABILITIES = *mut XINPUT_CAPABILITIES; -STRUCT!{struct XINPUT_BATTERY_INFORMATION { - BatteryType: ::BYTE, - BatteryLevel: ::BYTE, -}} -pub type PXINPUT_BATTERY_INFORMATION = *mut XINPUT_BATTERY_INFORMATION; -STRUCT!{struct XINPUT_KEYSTROKE { - VirtualKey: ::WORD, - Unicode: ::WCHAR, - UserIndex: ::BYTE, - HidCode: ::BYTE, -}} -pub type PXINPUT_KEYSTROKE = *mut XINPUT_KEYSTROKE; diff -Nru cargo-0.35.0/vendor/winapi-build/.cargo-checksum.json cargo-0.37.0/vendor/winapi-build/.cargo-checksum.json --- cargo-0.35.0/vendor/winapi-build/.cargo-checksum.json 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-build/.cargo-checksum.json 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"files":{},"package":"2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"} \ No newline at end of file diff -Nru cargo-0.35.0/vendor/winapi-build/Cargo.toml cargo-0.37.0/vendor/winapi-build/Cargo.toml --- cargo-0.35.0/vendor/winapi-build/Cargo.toml 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-build/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -[package] -name = "winapi-build" -version = "0.1.1" -authors = ["Peter Atashian "] -description = "Common code for build.rs in WinAPI -sys crates." -repository = "https://github.com/retep998/winapi-rs" -keywords = ["Windows", "FFI", "WinSDK"] -license = "MIT" - -[lib] -name = "build" diff -Nru cargo-0.35.0/vendor/winapi-build/src/lib.rs cargo-0.37.0/vendor/winapi-build/src/lib.rs --- cargo-0.35.0/vendor/winapi-build/src/lib.rs 2019-05-15 11:26:24.000000000 +0000 +++ cargo-0.37.0/vendor/winapi-build/src/lib.rs 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -// Copyright © 2015, Peter Atashian -// Licensed under the MIT License -pub fn link(name: &str, bundled: bool) { - use std::env::var; - let target = var("TARGET").unwrap(); - let target: Vec<_> = target.split('-').collect(); - if target.get(2) == Some(&"windows") { - println!("cargo:rustc-link-lib=dylib={}", name); - if bundled && target.get(3) == Some(&"gnu") { - let dir = var("CARGO_MANIFEST_DIR").unwrap(); - println!("cargo:rustc-link-search=native={}/{}", dir, target[0]); - } - } -}